| Server IP : 121.121.20.254 / Your IP : 216.73.217.89 Web Server : Microsoft-IIS/10.0 System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64 User : IUSR ( 0) PHP Version : 8.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Program Files/Microsoft VS Code/ce099c1ed2/resources/app/out/vs/sessions/ |
Upload File : |
/*!--------------------------------------------------------
* 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 NDo=Object.defineProperty;var ODo=Object.getOwnPropertyDescriptor;var XHi=a=>{throw TypeError(a)};var I=(a,i,e,t)=>{for(var o=t>1?void 0:t?ODo(i,e):i,n=a.length-1,r;n>=0;n--)(r=a[n])&&(o=(t?r(i,e,o):r(o))||o);return t&&o&&NDo(i,e,o),o},m=(a,i)=>(e,t)=>i(e,t,a);var R6t=(a,i,e)=>i.has(a)||XHi("Cannot "+e);var pf=(a,i,e)=>(R6t(a,i,"read from private field"),e?e.call(a):i.get(a)),Yve=(a,i,e)=>i.has(a)?XHi("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(a):i.set(a,e),j2e=(a,i,e,t)=>(R6t(a,i,"write to private field"),t?t.call(a,e):i.set(a,e),e),Q2e=(a,i,e)=>(R6t(a,i,"access private method"),e);function Y2e(){return globalThis._VSCODE_NLS_MESSAGES}function are(){return globalThis._VSCODE_NLS_LANGUAGE}var FDo=are()==="pseudo"||typeof document<"u"&&document.location&&typeof document.location.hash=="string"&&document.location.hash.indexOf("pseudo=true")>=0;function Tut(a,i){let e;return i.length===0?e=a:e=a.replace(/\{(\d+)\}/g,(t,o)=>{let n=o[0],r=i[n],s=t;return typeof r=="string"?s=r:(typeof r=="number"||typeof r=="boolean"||r===void 0||r===null)&&(s=String(r)),s}),FDo&&(e="\uFF3B"+e.replace(/[aouei]/g,"$&$&")+"\uFF3D"),e}function d(a,i,...e){return Tut(typeof a=="number"?JHi(a,i):i,e)}function JHi(a,i){let e=Y2e()?.[a];if(typeof e!="string"){if(typeof i=="string")return i;throw new Error(`!!! NLS MISSING: ${a} !!!`)}return e}function L(a,i,...e){let t;typeof a=="number"?t=JHi(a,i):t=i;let o=Tut(t,e);return{value:o,original:i===t?o:Tut(i,e)}}function _ut(a,i){let e=a;typeof e.vscodeWindowId!="number"&&Object.defineProperty(e,"vscodeWindowId",{get:()=>i})}var It=window;function Cy(a){return a===It?!1:typeof a?.vscodeWindowId=="number"}function wI(a,i){let e=Object.create(null);for(let t of a){let o=i(t),n=e[o];n||(n=e[o]=[]),n.push(t)}return e}function tUi(a,i){let e=new Map;for(let t of a){let o=i(t),n=e.get(o);n||(n=[],e.set(o,n)),n.push(t)}return e}function HH(a,i){let e=[],t=[];for(let o of a)i.has(o)||e.push(o);for(let o of i)a.has(o)||t.push(o);return{removed:e,added:t}}function X2e(a,i){let e=[],t=[];for(let[o,n]of a)i.has(o)||e.push(n);for(let[o,n]of i)a.has(o)||t.push(n);return{removed:e,added:t}}function Dut(a,i){let e=new Set;for(let t of i)a.has(t)&&e.add(t);return e}var ZHi,eUi,lre=class{constructor(i,e){this.toKey=e;this._map=new Map;this[ZHi]="SetWithKey";for(let t of i)this.add(t)}get size(){return this._map.size}add(i){let e=this.toKey(i);return this._map.set(e,i),this}delete(i){return this._map.delete(this.toKey(i))}has(i){return this._map.has(this.toKey(i))}*entries(){for(let i of this._map.values())yield[i,i]}keys(){return this.values()}*values(){for(let i of this._map.values())yield i}clear(){this._map.clear()}forEach(i,e){this._map.forEach(t=>i.call(e,t,t,this))}[(eUi=Symbol.iterator,ZHi=Symbol.toStringTag,eUi)](){return this.values()}};var M6t=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(i){setTimeout(()=>{throw i.stack?Zs.isErrorNoTelemetry(i)?new Zs(i.message+`
`+i.stack):new Error(i.message+`
`+i.stack):i},0)}}addListener(i){return this.listeners.push(i),()=>{this._removeListener(i)}}emit(i){this.listeners.forEach(e=>{e(i)})}_removeListener(i){this.listeners.splice(this.listeners.indexOf(i),1)}setUnexpectedErrorHandler(i){this.unexpectedErrorHandler=i}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(i){this.unexpectedErrorHandler(i),this.emit(i)}onUnexpectedExternalError(i){this.unexpectedErrorHandler(i)}},i6=new M6t;function iUi(a){i6.setUnexpectedErrorHandler(a)}function o6(a){i6.onUnexpectedError(a)}function mt(a){so(a)||i6.onUnexpectedError(a)}function ss(a){so(a)||i6.onUnexpectedExternalError(a)}function QG(a){if(a instanceof Error){let{name:i,message:e,cause:t}=a,o=a.stacktrace||a.stack;return{$isError:!0,name:i,message:e,stack:o,noTelemetry:Zs.isErrorNoTelemetry(a),cause:t?QG(t):void 0,code:a.code}}return a}function n6(a){let i;return a.noTelemetry?i=new Zs:(i=new Error,i.name=a.name),i.message=a.message,i.stack=a.stack,a.code&&(i.code=a.code),a.cause&&(i.cause=n6(a.cause)),i}var t6="Canceled";function so(a){return a instanceof ho?!0:a instanceof Error&&a.name===t6&&a.message===t6}var ho=class extends Error{constructor(){super(t6),this.name=this.message}},Lut=class a extends Error{static{this._name="PendingMigrationError"}static is(i){return i instanceof a||i instanceof Error&&i.name===a._name}constructor(i){super(i),this.name=a._name}};function CI(){let a=new Error(t6);return a.name=a.message,a}function Br(a){return a?new Error(`Illegal argument: ${a}`):new Error("Illegal argument")}function Xve(a){return a?new Error(`Illegal state: ${a}`):new Error("Illegal state")}function Cn(a){return a?a.message?a.message:a.stack?a.stack.split(`
`)[0]:String(a):"Error"}var jG=class extends Error{constructor(i){super("NotSupported"),i&&(this.message=i)}};var Zs=class a extends Error{constructor(i){super(i),this.name="CodeExpectedError"}static fromError(i){if(i instanceof a)return i;let e=new a;return e.message=i.message,e.stack=i.stack,e}static isErrorNoTelemetry(i){return i.name==="CodeExpectedError"}},ni=class a extends Error{constructor(i){super(i||"An unexpected bug occurred."),Object.setPrototypeOf(this,a.prototype)}};function wd(a,i){let e=this,t=!1,o;return function(){if(t)return o;if(t=!0,i)try{o=a.apply(e,arguments)}finally{i()}else o=a.apply(e,arguments);return o}}function ju(a,i,e=a.length-1){let t=Jve(a,i,e);if(t!==-1)return a[t]}function Jve(a,i,e=a.length-1){for(let t=e;t>=0;t--){let o=a[t];if(i(o,t))return t}return-1}function Rut(a,i,e=0){let t=VDo(a,i,e);if(t!==-1)return a[t]}function VDo(a,i,e=0){for(let t=e;t<a.length;t++){let o=a[t];if(i(o,t))return t}return-1}function YG(a,i){let e=XG(a,i);return e===-1?void 0:a[e]}function XG(a,i,e=0,t=a.length){let o=e,n=t;for(;o<n;){let r=Math.floor((o+n)/2);i(a[r])?o=r+1:n=r}return o-1}function oUi(a,i){let e=xy(a,i);return e===a.length?void 0:a[e]}function xy(a,i,e=0,t=a.length){let o=e,n=t;for(;o<n;){let r=Math.floor((o+n)/2);i(a[r])?n=r:o=r+1}return o}var J2e=class a{constructor(i){this._array=i;this._findLastMonotonousLastIdx=0}static{this.assertInvariants=!1}findLastMonotonous(i){if(a.assertInvariants){if(this._prevFindLastPredicate){for(let t of this._array)if(this._prevFindLastPredicate(t)&&!i(t))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=i}let e=XG(this._array,i,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=e+1,e===-1?void 0:this._array[e]}};function Z2e(a,i){if(a.length===0)return;let e=a[0];for(let t=1;t<a.length;t++){let o=a[t];i(o,e)>0&&(e=o)}return e}function Mut(a,i){if(a.length===0)return;let e=a[0];for(let t=1;t<a.length;t++){let o=a[t];i(o,e)>=0&&(e=o)}return e}function Put(a,i){return Z2e(a,(e,t)=>-i(e,t))}function nUi(a,i){if(a.length===0)return-1;let e=0;for(let t=1;t<a.length;t++){let o=a[t];i(o,a[e])>0&&(e=t)}return e}function DT(a,i){for(let e of a){let t=i(e);if(t!==void 0)return t}}function Mg(a){if(a.length===0)throw new Error("Invalid tail call");return[a.slice(0,a.length-1),a[a.length-1]]}function $i(a,i,e=(t,o)=>t===o){if(a===i)return!0;if(!a||!i||a.length!==i.length)return!1;for(let t=0,o=a.length;t<o;t++)if(!e(a[t],i[t]))return!1;return!0}function rUi(a,i){let e=a.length-1;i<e&&(a[i]=a[e]),a.pop()}function cx(a,i,e){return bM(a.length,t=>e(a[t],i))}function bM(a,i){let e=0,t=a-1;for(;e<=t;){let o=(e+t)/2|0,n=i(o);if(n<0)e=o+1;else if(n>0)t=o-1;else return o}return-(e+1)}function r6(a,i,e){if(a=a|0,a>=i.length)throw new TypeError("invalid index");let t=i[Math.floor(i.length*Math.random())],o=[],n=[],r=[];for(let s of i){let l=e(s,t);l<0?o.push(s):l>0?n.push(s):r.push(s)}return a<o.length?r6(a,o,e):a<o.length+r.length?r[0]:r6(a-(o.length+r.length),n,e)}function Pg(a,i){let e=[],t;for(let o of a.slice(0).sort(i))!t||i(t[0],o)!==0?(t=[o],e.push(t)):t.push(o);return e}function*s6(a,i){let e,t;for(let o of a)t!==void 0&&i(t,o)?e.push(o):(e&&(yield e),e=[o]),t=o;e&&(yield e)}function Nut(a,i){for(let e=0;e<=a.length;e++)i(e===0?void 0:a[e-1],e===a.length?void 0:a[e])}function sUi(a,i){for(let e=0;e<a.length;e++)i(e===0?void 0:a[e-1],a[e],e+1===a.length?void 0:a[e+1])}function Out(...a){return[].concat(...a)}function eGe(a,i,e){let t=[];function o(s,l,c){if(l===0&&c.length===0)return;let u=t[t.length-1];u&&u.start+u.deleteCount===s?(u.deleteCount+=l,u.toInsert.push(...c)):t.push({start:s,deleteCount:l,toInsert:c})}let n=0,r=0;for(;;){if(n===a.length){o(n,0,i.slice(r));break}if(r===i.length){o(n,a.length-n,[]);break}let s=a[n],l=i[r],c=e(s,l);c===0?(n+=1,r+=1):c<0?(o(n,1,[]),n+=1):c>0&&(o(n,0,[l]),r+=1)}return t}function cre(a,i,e){let t=eGe(a,i,e),o=[],n=[];for(let r of t)o.push(...a.slice(r.start,r.start+r.deleteCount)),n.push(...r.toInsert);return{removed:o,added:n}}function aUi(a,i,e){if(e===0)return[];let t=a.slice(0,e).sort(i);return BDo(a,i,t,e,a.length),t}function BDo(a,i,e,t,o){for(let n=e.length;t<o;t++){let r=a[t];if(i(r,e[n-1])<0){e.pop();let s=xy(e,l=>i(r,l)<0);e.splice(s,0,r)}}}function si(a){return a.filter(i=>!!i)}function ZG(a){let i=0;for(let e=0;e<a.length;e++)a[e]&&(a[i]=a[e],i+=1);a.length=i}function lUi(a,i,e){a.splice(e,0,a.splice(i,1)[0])}function JA(a){return!Array.isArray(a)||a.length===0}function dr(a){return Array.isArray(a)&&a.length>0}function Uo(a,i=e=>e){let e=new Set;return a.filter(t=>{let o=i(t);return e.has(o)?!1:(e.add(o),!0)})}function cUi(a){let i=new Set;return e=>{let t=a(e);return i.has(t)?!1:(i.add(t),!0)}}function dUi(a,i,e=(t,o)=>t===o){let t=0;for(let o=0,n=Math.min(a.length,i.length);o<n&&e(a[o],i[o]);o++)t++;return t}function ig(a,i){let e=typeof i=="number"?a:0;typeof i=="number"?e=a:(e=0,i=a);let t=[];if(e<=i)for(let o=e;o<i;o++)t.push(o);else for(let o=e;o>i;o--)t.push(o);return t}function a6(a,i,e){return a.reduce((t,o)=>(t[i(o)]=e?e(o):o,t),Object.create(null))}function Zm(a,i){return a.push(i),()=>tGe(a,i)}function tGe(a,i){let e=a.indexOf(i);if(e>-1)return a.splice(e,1),i}function UH(a,i,e){let t=a.slice(0,i),o=a.slice(i);return t.concat(e,o)}function l6(a,i){let e;if(typeof i=="number"){let t=i;e=()=>{let o=Math.sin(t++)*179426549;return o-Math.floor(o)}}else e=Math.random;for(let t=a.length-1;t>0;t-=1){let o=Math.floor(e()*(t+1)),n=a[t];a[t]=a[o],a[o]=n}}function Fut(a,i){let e=a.indexOf(i);e>-1&&(a.splice(e,1),a.unshift(i))}function iGe(a,i){let e=a.indexOf(i);e>-1&&(a.splice(e,1),a.push(i))}function e$(a,i){for(let e of i)a.push(e)}function uUi(a,i){return Array.isArray(a)?a.map(i):i(a)}function pUi(a,i){let e=[];for(let t of a){let o=i(t);o!==void 0&&e.push(o)}return e}function mUi(a){let i=new Set(a);return Array.from(i)}function Yl(a){return Array.isArray(a)?a:[a]}function dre(a,i,e){let t=hUi(a,i),o=a.length,n=e.length;a.length=o+n;for(let r=o-1;r>=t;r--)a[r+n]=a[r];for(let r=0;r<n;r++)a[r+t]=e[r]}function ure(a,i,e,t){let o=hUi(a,i),n=a.splice(o,e);return n===void 0&&(n=[]),dre(a,o,t),n}function hUi(a,i){return i<0?Math.max(i+a.length,0):Math.min(i,a.length)}var Fw;(s=>{function a(l){return l<0}s.isLessThan=a;function i(l){return l<=0}s.isLessThanOrEqual=i;function e(l){return l>0}s.isGreaterThan=e;function t(l){return l===0}s.isNeitherLessOrGreaterThan=t,s.greaterThan=1,s.lessThan=-1,s.neitherLessOrGreaterThan=0})(Fw||={});function tl(a,i){return(e,t)=>i(a(e),a(t))}function Wut(...a){return(i,e)=>{for(let t of a){let o=t(i,e);if(!Fw.isNeitherLessOrGreaterThan(o))return o}return Fw.neitherLessOrGreaterThan}}var qd=(a,i)=>a-i,Vut=(a,i)=>qd(a?1:0,i?1:0);function pre(a){return(i,e)=>-a(i,e)}function gUi(a){return(i,e)=>i===void 0?e===void 0?Fw.neitherLessOrGreaterThan:Fw.lessThan:e===void 0?Fw.greaterThan:a(i,e)}var bS=class{constructor(i){this.firstIdx=0;this.items=i,this.lastIdx=this.items.length-1}get length(){return this.lastIdx-this.firstIdx+1}takeWhile(i){let e=this.firstIdx;for(;e<this.items.length&&i(this.items[e]);)e++;let t=e===this.firstIdx?null:this.items.slice(this.firstIdx,e);return this.firstIdx=e,t}takeFromEndWhile(i){let e=this.lastIdx;for(;e>=0&&i(this.items[e]);)e--;let t=e===this.lastIdx?null:this.items.slice(e+1,this.lastIdx+1);return this.lastIdx=e,t}peek(){if(this.length!==0)return this.items[this.firstIdx]}peekLast(){if(this.length!==0)return this.items[this.lastIdx]}dequeue(){let i=this.items[this.firstIdx];return this.firstIdx++,i}removeLast(){let i=this.items[this.lastIdx];return this.lastIdx--,i}takeCount(i){let e=this.items.slice(this.firstIdx,this.firstIdx+i);return this.firstIdx+=i,e}},JG=class a{constructor(i){this.iterate=i}static{this.empty=new a(i=>{})}forEach(i){this.iterate(e=>(i(e),!0))}toArray(){let i=[];return this.iterate(e=>(i.push(e),!0)),i}filter(i){return new a(e=>this.iterate(t=>i(t)?e(t):!0))}map(i){return new a(e=>this.iterate(t=>e(i(t))))}some(i){let e=!1;return this.iterate(t=>(e=i(t),!e)),e}findFirst(i){let e;return this.iterate(t=>i(t)?(e=t,!1):!0),e}findLast(i){let e;return this.iterate(t=>(i(t)&&(e=t),!0)),e}findLastMaxBy(i){let e,t=!0;return this.iterate(o=>((t||Fw.isGreaterThan(i(o,e)))&&(t=!1,e=o),!0)),e}},Aut=class a{constructor(i){this._indexMap=i}static createSortPermutation(i,e){let t=Array.from(i.keys()).sort((o,n)=>e(i[o],i[n]));return new a(t)}apply(i){return i.map((e,t)=>i[this._indexMap[t]])}inverse(){let i=this._indexMap.slice();for(let e=0;e<this._indexMap.length;e++)i[this._indexMap[e]]=e;return new a(i)}};async function fUi(a,i){return(await Promise.all(a.map(async(t,o)=>({element:t,ok:await i(t,o)})))).find(t=>t.ok)?.element}function Zve(a){return a.reduce((i,e)=>i+e,0)}function ky(a,i){return a.reduce((e,t)=>e+i(t),0)}function $H(a,i,e){let t=a.get(i);return t===void 0&&(t=e,a.set(i,t)),t}var P6t=class{constructor(i,e){this.uri=i;this.value=e}};function HDo(a){return Array.isArray(a)}var vUi,vt=class a{constructor(i,e){this[vUi]="ResourceMap";if(i instanceof a)this.map=new Map(i.map),this.toKey=e??a.defaultToKey;else if(HDo(i)){this.map=new Map,this.toKey=e??a.defaultToKey;for(let[t,o]of i)this.set(t,o)}else this.map=new Map,this.toKey=i??a.defaultToKey}static{this.defaultToKey=i=>i.toString()}set(i,e){return this.map.set(this.toKey(i),new P6t(i,e)),this}get(i){return this.map.get(this.toKey(i))?.value}has(i){return this.map.has(this.toKey(i))}get size(){return this.map.size}clear(){this.map.clear()}delete(i){return this.map.delete(this.toKey(i))}forEach(i,e){typeof e<"u"&&(i=i.bind(e));for(let[t,o]of this.map)i(o.value,o.uri,this)}*values(){for(let i of this.map.values())yield i.value}*keys(){for(let i of this.map.values())yield i.uri}*entries(){for(let i of this.map.values())yield[i.uri,i.value]}*[(vUi=Symbol.toStringTag,Symbol.iterator)](){for(let[,i]of this.map)yield[i.uri,i.value]}},bUi,Mn=class{constructor(i,e){this[bUi]="ResourceSet";!i||typeof i=="function"?this._map=new vt(i):(this._map=new vt(e),i.forEach(this.add,this))}get size(){return this._map.size}add(i){return this._map.set(i,i),this}clear(){this._map.clear()}delete(i){return this._map.delete(i)}forEach(i,e){this._map.forEach((t,o)=>i.call(e,o,o,this))}has(i){return this._map.has(i)}entries(){return this._map.entries()}keys(){return this._map.keys()}values(){return this._map.keys()}[(bUi=Symbol.toStringTag,Symbol.iterator)](){return this.keys()}};var SUi,zH=class{constructor(){this[SUi]="LinkedMap";this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){return this._head?.value}get last(){return this._tail?.value}has(i){return this._map.has(i)}get(i,e=0){let t=this._map.get(i);if(t)return e!==0&&this.touch(t,e),t.value}set(i,e,t=0){let o=this._map.get(i);if(o)o.value=e,t!==0&&this.touch(o,t);else{switch(o={key:i,value:e,next:void 0,previous:void 0},t){case 0:this.addItemLast(o);break;case 1:this.addItemFirst(o);break;case 2:this.addItemLast(o);break;default:this.addItemLast(o);break}this._map.set(i,o),this._size++}return this}delete(i){return!!this.remove(i)}remove(i){let e=this._map.get(i);if(e)return this._map.delete(i),this.removeItem(e),this._size--,e.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");let i=this._head;return this._map.delete(i.key),this.removeItem(i),this._size--,i.value}forEach(i,e){let t=this._state,o=this._head;for(;o;){if(e?i.bind(e)(o.value,o.key,this):i(o.value,o.key,this),this._state!==t)throw new Error("LinkedMap got modified during iteration.");o=o.next}}keys(){let i=this,e=this._state,t=this._head,o={[Symbol.iterator](){return o},next(){if(i._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){let n={value:t.key,done:!1};return t=t.next,n}else return{value:void 0,done:!0}}};return o}values(){let i=this,e=this._state,t=this._head,o={[Symbol.iterator](){return o},next(){if(i._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){let n={value:t.value,done:!1};return t=t.next,n}else return{value:void 0,done:!0}}};return o}entries(){let i=this,e=this._state,t=this._head,o={[Symbol.iterator](){return o},next(){if(i._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){let n={value:[t.key,t.value],done:!1};return t=t.next,n}else return{value:void 0,done:!0}}};return o}[(SUi=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(i){if(i>=this.size)return;if(i===0){this.clear();return}let e=this._head,t=this.size;for(;e&&t>i;)this._map.delete(e.key),e=e.next,t--;this._head=e,this._size=t,e&&(e.previous=void 0),this._state++}trimNew(i){if(i>=this.size)return;if(i===0){this.clear();return}let e=this._tail,t=this.size;for(;e&&t>i;)this._map.delete(e.key),e=e.previous,t--;this._tail=e,this._size=t,e&&(e.next=void 0),this._state++}addItemFirst(i){if(!this._head&&!this._tail)this._tail=i;else if(this._head)i.next=this._head,this._head.previous=i;else throw new Error("Invalid list");this._head=i,this._state++}addItemLast(i){if(!this._head&&!this._tail)this._head=i;else if(this._tail)i.previous=this._tail,this._tail.next=i;else throw new Error("Invalid list");this._tail=i,this._state++}removeItem(i){if(i===this._head&&i===this._tail)this._head=void 0,this._tail=void 0;else if(i===this._head){if(!i.next)throw new Error("Invalid list");i.next.previous=void 0,this._head=i.next}else if(i===this._tail){if(!i.previous)throw new Error("Invalid list");i.previous.next=void 0,this._tail=i.previous}else{let e=i.next,t=i.previous;if(!e||!t)throw new Error("Invalid list");e.previous=t,t.next=e}i.next=void 0,i.previous=void 0,this._state++}touch(i,e){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(e!==1&&e!==2)){if(e===1){if(i===this._head)return;let t=i.next,o=i.previous;i===this._tail?(o.next=void 0,this._tail=o):(t.previous=o,o.next=t),i.previous=void 0,i.next=this._head,this._head.previous=i,this._head=i,this._state++}else if(e===2){if(i===this._tail)return;let t=i.next,o=i.previous;i===this._head?(t.previous=void 0,this._head=t):(t.previous=o,o.next=t),i.next=void 0,i.previous=this._tail,this._tail.next=i,this._tail=i,this._state++}}}toJSON(){let i=[];return this.forEach((e,t)=>{i.push([t,e])}),i}fromJSON(i){this.clear();for(let[e,t]of i)this.set(e,t)}},But=class extends zH{constructor(i,e=1){super(),this._limit=i,this._ratio=Math.min(Math.max(0,e),1)}get limit(){return this._limit}set limit(i){this._limit=i,this.checkTrim()}get ratio(){return this._ratio}set ratio(i){this._ratio=Math.min(Math.max(0,i),1),this.checkTrim()}get(i,e=2){return super.get(i,e)}peek(i){return super.get(i,0)}set(i,e){return super.set(i,e,2),this}checkTrim(){this.size>this._limit&&this.trim(Math.round(this._limit*this._ratio))}},il=class extends But{constructor(i,e=1){super(i,e)}trim(i){this.trimOld(i)}set(i,e){return super.set(i,e),this.checkTrim(),this}},Hut=class extends But{constructor(i,e=1){super(i,e)}trim(i){this.trimNew(i)}set(i,e){return this._limit<=this.size&&!this.has(i)&&this.trim(Math.round(this._limit*this._ratio)-1),super.set(i,e),this}},ebe=class{constructor(){this.map=new Map}add(i){return this.map.set(i,(this.map.get(i)||0)+1),this}delete(i){let e=this.map.get(i)||0;return e===0?!1:(e--,e===0?this.map.delete(i):this.map.set(i,e),!0)}has(i){return this.map.has(i)}},Uut=class{constructor(i){this._m1=new Map;this._m2=new Map;if(i)for(let[e,t]of i)this.set(e,t)}clear(){this._m1.clear(),this._m2.clear()}set(i,e){this._m1.set(i,e),this._m2.set(e,i)}get(i){return this._m1.get(i)}getKey(i){return this._m2.get(i)}delete(i){let e=this._m1.get(i);return e===void 0?!1:(this._m1.delete(i),this._m2.delete(e),!0)}forEach(i,e){this._m1.forEach((t,o)=>{i.call(e,t,o,this)})}keys(){return this._m1.keys()}values(){return this._m1.values()}},KH=class{constructor(){this.map=new Map}add(i,e){let t=this.map.get(i);t||(t=new Set,this.map.set(i,t)),t.add(e)}delete(i,e){let t=this.map.get(i);t&&(t.delete(e),t.size===0&&this.map.delete(i))}forEach(i,e){let t=this.map.get(i);t&&t.forEach(e)}get(i){let e=this.map.get(i);return e||new Set}};function mre(a,i){if(a===i)return!0;if(a.size!==i.size)return!1;for(let[e,t]of a)if(!i.has(e)||i.get(e)!==t)return!1;for(let[e]of i)if(!a.has(e))return!1;return!0}var GH=class{constructor(){this._data=new Map}set(i,...e){let t=this._data;for(let o=0;o<e.length-1;o++){let n=t.get(e[o]);n===void 0&&(n=new Map,t.set(e[o],n)),t=n}t.set(e[e.length-1],i)}get(...i){let e=this._data;for(let t=0;t<i.length-1;t++){let o=e.get(i[t]);if(o===void 0)return;e=o}return e.get(i[i.length-1])}clear(){this._data.clear()}*values(){function*i(e){for(let t of e.values())t instanceof Map?yield*i(t):yield t}yield*i(this._data)}toString(){let i=(e,t)=>{let o="";for(let[n,r]of e)o+=`${" ".repeat(t)}${n}: `,r instanceof Map?o+=`
`+i(r,t+1):o+=`${r}
`;return o};return i(this._data,0)}};function c6(a,i){if(!a)throw new Error(i?`Assertion failed (${i})`:"Assertion Failed")}function Hr(a,i="Unreachable"){throw new Error(i)}function Ey(a,i="unexpected state"){if(!a)throw typeof i=="string"?new ni(`Assertion Failed: ${i}`):i}function A6t(a,i="Soft Assertion Failed"){a||mt(new ni(i))}function eh(a){if(!a()){debugger;a(),mt(new ni("Assertion Failed"))}}function Ty(a,i){let e=0;for(;e<a.length-1;){let t=a[e],o=a[e+1];if(!i(t,o))return!1;e++}return!0}function Ae(a){return typeof a=="string"}function SS(a){return N6t(a,Ae)}function N6t(a,i){return Array.isArray(a)&&a.every(i)}function yi(a){return typeof a=="object"&&a!==null&&!Array.isArray(a)&&!(a instanceof RegExp)&&!(a instanceof Date)}function yUi(a){let i=Object.getPrototypeOf(Uint8Array);return typeof a=="object"&&a instanceof i}function Xo(a){return typeof a=="number"&&!isNaN(a)}function oGe(a){return!!a&&typeof a[Symbol.iterator]=="function"}function Da(a){return a===!0||a===!1}function cn(a){return typeof a>"u"}function mo(a){return!Jn(a)}function Jn(a){return cn(a)||a===null}function So(a,i){if(!a)throw new Error(i?`Unexpected type, expected '${i}'`:"Unexpected type")}function Oi(a){return Ey(a!=null,"Argument is `undefined` or `null`."),a}function O6t(a,i){if(a==null)throw typeof i=="string"?new Error(i):i}function _y(...a){let i=[];for(let e=0;e<a.length;e++){let t=a[e];if(Jn(t))throw new Error(`Assertion Failed: argument at index ${e} is undefined or null`);i.push(t)}return i}var UDo=Object.prototype.hasOwnProperty;function mf(a){if(!yi(a))return!1;for(let i in a)if(UDo.call(a,i))return!1;return!0}function HD(a){return typeof a=="function"}function zut(...a){return a.length>0&&a.every(HD)}function wUi(a,i){let e=Math.min(a.length,i.length);for(let t=0;t<e;t++)zDo(a[t],i[t])}function zDo(a,i){if(Ae(i)){if(typeof a!==i)throw new Error(`argument does not match constraint: typeof ${i}`)}else if(HD(i)){try{if(a instanceof i)return}catch{}if(!Jn(a)&&a.constructor===i||i.length===1&&i.call(void 0,a)===!0)return;throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function Wo(a,i){for(let e in i)if(!(e in a))return!1;return!0}var ht;(N=>{function a(O){return!!O&&typeof O=="object"&&typeof O[Symbol.iterator]=="function"}N.is=a;let i=Object.freeze([]);function e(){return i}N.empty=e;function*t(O){yield O}N.single=t;function o(O){return a(O)?O:t(O)}N.wrap=o;function n(O){return O??i}N.from=n;function*r(O){for(let V=O.length-1;V>=0;V--)yield O[V]}N.reverse=r;function s(O){return!O||O[Symbol.iterator]().next().done===!0}N.isEmpty=s;function l(O){return O[Symbol.iterator]().next().value}N.first=l;function c(O,V){let U=0;for(let G of O)if(V(G,U++))return!0;return!1}N.some=c;function u(O,V){let U=0;for(let G of O)if(!V(G,U++))return!1;return!0}N.every=u;function p(O,V){for(let U of O)if(V(U))return U}N.find=p;function*h(O,V){for(let U of O)V(U)&&(yield U)}N.filter=h;function*g(O,V){let U=0;for(let G of O)yield V(G,U++)}N.map=g;function*f(O,V){let U=0;for(let G of O)yield*V(G,U++)}N.flatMap=f;function*v(...O){for(let V of O)oGe(V)?yield*V:yield V}N.concat=v;function b(O,V,U){let G=U;for(let $ of O)G=V(G,$);return G}N.reduce=b;function S(O){let V=0;for(let U of O)V++;return V}N.length=S;function*y(O,V,U=O.length){for(V<-O.length&&(V=0),V<0&&(V+=O.length),U<0?U+=O.length:U>O.length&&(U=O.length);V<U;V++)yield O[V]}N.slice=y;function w(O,V=Number.POSITIVE_INFINITY){let U=[];if(V===0)return[U,O];let G=O[Symbol.iterator]();for(let $=0;$<V;$++){let te=G.next();if(te.done)return[U,N.empty()];U.push(te.value)}return[U,{[Symbol.iterator](){return G}}]}N.consume=w;async function k(O){let V=[];for await(let U of O)V.push(U);return V}N.asyncToArray=k;async function T(O){let V=[];for await(let U of O)V=V.concat(U);return V}N.asyncToArrayFlat=T})(ht||={});var KDo=!1,hre=null,Kut=class{constructor(){this._registry=new FinalizationRegistry(i=>{console.warn(`[LEAKED DISPOSABLE] ${i}`)})}trackDisposable(i){let e=new Error("CREATED via:").stack;this._registry.register(i,e,i)}setParent(i,e){e?this._registry.unregister(i):this.trackDisposable(i)}markAsDisposed(i){this._registry.unregister(i)}markAsSingleton(i){this._registry.unregister(i)}},Gut=class a{constructor(){this.livingDisposables=new Map}static{this.idx=0}getDisposableData(i){let e=this.livingDisposables.get(i);return e||(e={parent:null,source:null,isSingleton:!1,value:i,idx:a.idx++},this.livingDisposables.set(i,e)),e}trackDisposable(i){let e=this.getDisposableData(i);e.source||(e.source=new Error().stack)}setParent(i,e){let t=this.getDisposableData(i);t.parent=e}markAsDisposed(i){this.livingDisposables.delete(i)}markAsSingleton(i){this.getDisposableData(i).isSingleton=!0}getRootParent(i,e){let t=e.get(i);if(t)return t;let o=i.parent?this.getRootParent(this.getDisposableData(i.parent),e):i;return e.set(i,o),o}getTrackedDisposables(){let i=new Map;return[...this.livingDisposables.entries()].filter(([,t])=>t.source!==null&&!this.getRootParent(t,i).isSingleton).flatMap(([t])=>t)}computeLeakingDisposables(i=10,e){let t;if(e)t=e;else{let l=new Map,c=[...this.livingDisposables.values()].filter(p=>p.source!==null&&!this.getRootParent(p,l).isSingleton);if(c.length===0)return;let u=new Set(c.map(p=>p.value));if(t=c.filter(p=>!(p.parent&&u.has(p.parent))),t.length===0)throw new Error("There are cyclic diposable chains!")}if(!t)return;function o(l){function c(p,h){for(;p.length>0&&h.some(g=>typeof g=="string"?g===p[0]:p[0].match(g));)p.shift()}let u=l.source.split(`
`).map(p=>p.trim().replace("at ","")).filter(p=>p!=="");return c(u,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),u.reverse()}let n=new KH;for(let l of t){let c=o(l);for(let u=0;u<=c.length;u++)n.add(c.slice(0,u).join(`
`),l)}t.sort(tl(l=>l.idx,qd));let r="",s=0;for(let l of t.slice(0,i)){s++;let c=o(l),u=[];for(let p=0;p<c.length;p++){let h=c[p];h=`(shared with ${n.get(c.slice(0,p+1).join(`
`)).size}/${t.length} leaks) at ${h}`;let f=n.get(c.slice(0,p).join(`
`)),v=wI([...f].map(b=>o(b)[p]),b=>b);delete v[c[p]];for(let[b,S]of Object.entries(v))S&&u.unshift(` - stacktraces of ${S.length} other leaks continue with ${b}`);u.unshift(h)}r+=`
==================== Leaking disposable ${s}/${t.length}: ${l.value.constructor.name} ====================
${u.join(`
`)}
============================================================
`}return t.length>i&&(r+=`
... and ${t.length-i} more leaking disposables
`),{leaks:t,details:r}}};function obe(a){hre=a}if(KDo){let a="__is_disposable_tracked__";obe(new class{trackDisposable(i){let e=new Error("Potentially leaked disposable").stack;setTimeout(()=>{i[a]||console.log(e)},3e3)}setParent(i,e){if(i&&i!==C.None)try{i[a]=!0}catch{}}markAsDisposed(i){if(i&&i!==C.None)try{i[a]=!0}catch{}}markAsSingleton(i){}})}function i$(a){return hre?.trackDisposable(a),a}function o$(a){hre?.markAsDisposed(a)}function t$(a,i){hre?.setParent(a,i)}function GDo(a,i){if(hre)for(let e of a)hre.setParent(e,i)}function Mp(a){return hre?.markAsSingleton(a),a}function Ac(a){return typeof a=="object"&&a!==null&&typeof a.dispose=="function"&&a.dispose.length===0}function Ue(a){if(ht.is(a)){let i=[];for(let e of a)if(e)try{e.dispose()}catch(t){i.push(t)}if(i.length===1)throw i[0];if(i.length>1)throw new AggregateError(i,"Encountered errors while disposing of store");return Array.isArray(a)?[]:a}else if(a)return a.dispose(),a}function jH(a){for(let i of a)Ac(i)&&i.dispose();return[]}function hn(...a){let i=Z(()=>Ue(a));return GDo(a,i),i}var F6t=class{constructor(i){this._isDisposed=!1,this._fn=i,i$(this)}dispose(){if(!this._isDisposed){if(!this._fn)throw new Error("Unbound disposable context: Need to use an arrow function to preserve the value of this");this._isDisposed=!0,o$(this),this._fn()}}};function Z(a){return new F6t(a)}var P=class a{constructor(){this._toDispose=new Set;this._isDisposed=!1;i$(this)}static{this.DISABLE_DISPOSED_WARNING=!1}dispose(){this._isDisposed||(o$(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Ue(this._toDispose)}finally{this._toDispose.clear()}}add(i){if(!i||i===C.None)return i;if(i===this)throw new Error("Cannot register a disposable on itself!");return t$(i,this),this._isDisposed?a.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(i),i}delete(i){if(i){if(i===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(i),i.dispose()}}deleteAndLeak(i){i&&this._toDispose.delete(i)&&t$(i,null)}assertNotDisposed(){this._isDisposed&&mt(new ni("Object disposed"))}},C=class{constructor(){this._store=new P;i$(this),t$(this._store,this)}static{this.None=Object.freeze({dispose(){}})}dispose(){o$(this),this._store.dispose()}_register(i){if(i===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(i)}},me=class{constructor(){this._isDisposed=!1;i$(this)}get value(){return this._isDisposed?void 0:this._value}set value(i){this._isDisposed||i===this._value||(this._value?.dispose(),i&&t$(i,this),this._value=i)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,o$(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let i=this._value;return this._value=void 0,i&&t$(i,null),i}},$ut=class{constructor(i){this._disposable=new me;this._isDisposed=!1;this._disposable.value=i}get value(){return this._disposable.value}set value(i){this._isDisposed||i===this._disposable.value||(this._disposable.value=i)}dispose(){this._isDisposed=!0,this._disposable.dispose()}},qH=class{constructor(i){this._disposable=i;this._counter=1}acquire(){return this._counter++,this}release(){return--this._counter===0&&this._disposable.dispose(),this}},Ww=class{constructor(){this.references=new Map}acquire(i,...e){let t=this.references.get(i);t||(t={counter:0,object:this.createReferencedObject(i,...e)},this.references.set(i,t));let{object:o}=t,n=wd(()=>{--t.counter===0&&(this.destroyReferencedObject(i,t.object),this.references.delete(i))});return t.counter++,{object:o,dispose:n}}},tbe=class{constructor(i){this.referenceCollection=i}async acquire(i,...e){let t=this.referenceCollection.acquire(i,...e);try{return{object:await t.object,dispose:()=>t.dispose()}}catch(o){throw t.dispose(),o}}},qut=class{constructor(i){this.object=i}dispose(){}};var jt=class{constructor(i=new Map){this._isDisposed=!1;this._store=i,i$(this)}dispose(){o$(this),this._isDisposed=!0,this.clearAndDisposeAll()}clearAndDisposeAll(){if(this._store.size)try{Ue(this._store.values())}finally{this._store.clear()}}has(i){return this._store.has(i)}get size(){return this._store.size}get(i){return this._store.get(i)}set(i,e,t=!1){this._isDisposed&&console.warn(new Error("Trying to add a disposable to a DisposableMap that has already been disposed of. The added object will be leaked!").stack),t||this._store.get(i)?.dispose(),this._store.set(i,e),t$(e,this)}deleteAndDispose(i){this._store.get(i)?.dispose(),this._store.delete(i)}deleteAndLeak(i){let e=this._store.get(i);return e&&t$(e,null),this._store.delete(i),e}keys(){return this._store.keys()}values(){return this._store.values()}[Symbol.iterator](){return this._store[Symbol.iterator]()}},ibe=class{constructor(i=new Set){this._isDisposed=!1;this._store=i,i$(this)}dispose(){o$(this),this._isDisposed=!0,this.clearAndDisposeAll()}clearAndDisposeAll(){if(this._store.size)try{Ue(this._store.values())}finally{this._store.clear()}}has(i){return this._store.has(i)}get size(){return this._store.size}add(i){this._isDisposed&&console.warn(new Error("Trying to add a disposable to a DisposableSet that has already been disposed of. The added object will be leaked!").stack),this._store.add(i),t$(i,this)}deleteAndDispose(i){this._store.delete(i)&&i.dispose()}deleteAndLeak(i){if(this._store.delete(i))return t$(i,null),i}values(){return this._store.values()}[Symbol.iterator](){return this._store[Symbol.iterator]()}};function nbe(a,i){let e=!1;return a.then(t=>{e||i(t)}),Z(()=>{e=!0})}function jut(a,i){return a.then(e=>(i.isDisposed?e.dispose():i.add(e),e))}var UD=class extends jt{constructor(){super(new vt)}};var Ag=class a{static{this.Undefined=new a(void 0)}constructor(i){this.element=i,this.next=a.Undefined,this.prev=a.Undefined}},Vs=class{constructor(){this._first=Ag.Undefined;this._last=Ag.Undefined;this._size=0}get size(){return this._size}isEmpty(){return this._first===Ag.Undefined}clear(){let i=this._first;for(;i!==Ag.Undefined;){let e=i.next;i.prev=Ag.Undefined,i.next=Ag.Undefined,i=e}this._first=Ag.Undefined,this._last=Ag.Undefined,this._size=0}unshift(i){return this._insert(i,!1)}push(i){return this._insert(i,!0)}_insert(i,e){let t=new Ag(i);if(this._first===Ag.Undefined)this._first=t,this._last=t;else if(e){let n=this._last;this._last=t,t.prev=n,n.next=t}else{let n=this._first;this._first=t,t.next=n,n.prev=t}this._size+=1;let o=!1;return()=>{o||(o=!0,this._remove(t))}}shift(){if(this._first!==Ag.Undefined){let i=this._first.element;return this._remove(this._first),i}}pop(){if(this._last!==Ag.Undefined){let i=this._last.element;return this._remove(this._last),i}}peek(){if(this._last!==Ag.Undefined)return this._last.element}_remove(i){if(i.prev!==Ag.Undefined&&i.next!==Ag.Undefined){let e=i.prev;e.next=i.next,i.next.prev=e}else i.prev===Ag.Undefined&&i.next===Ag.Undefined?(this._first=Ag.Undefined,this._last=Ag.Undefined):i.next===Ag.Undefined?(this._last=this._last.prev,this._last.next=Ag.Undefined):i.prev===Ag.Undefined&&(this._first=this._first.next,this._first.prev=Ag.Undefined);this._size-=1}*[Symbol.iterator](){let i=this._first;for(;i!==Ag.Undefined;)yield i.element,i=i.next}};var QH="en",sGe=!1,aGe=!1,rGe=!1,EUi=!1,TUi=!1,V6t=!1,_Ui=!1,B6t=!1,DUi=!1,LUi=!1,nGe,Qut=QH,W6t=QH,RUi,n$,r$=globalThis,zD;typeof r$.vscode<"u"&&typeof r$.vscode.process<"u"?zD=r$.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(zD=process);var MUi=typeof zD?.versions?.electron=="string",$Do=MUi&&zD?.type==="renderer";if(typeof zD=="object"){sGe=zD.platform==="win32",aGe=zD.platform==="darwin",rGe=zD.platform==="linux",EUi=rGe&&!!zD.env.SNAP&&!!zD.env.SNAP_REVISION,_Ui=MUi,DUi=!!zD.env.CI||!!zD.env.BUILD_ARTIFACTSTAGINGDIRECTORY||!!zD.env.GITHUB_WORKSPACE,nGe=QH,Qut=QH;let a=zD.env.VSCODE_NLS_CONFIG;if(a)try{let i=JSON.parse(a);nGe=i.userLocale,W6t=i.osLocale,Qut=i.resolvedLanguage||QH,RUi=i.languagePack?.translationsConfigFile}catch{}TUi=!0}else typeof navigator=="object"&&!$Do?(n$=navigator.userAgent,sGe=n$.indexOf("Windows")>=0,aGe=n$.indexOf("Macintosh")>=0,B6t=(n$.indexOf("Macintosh")>=0||n$.indexOf("iPad")>=0||n$.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,rGe=n$.indexOf("Linux")>=0,LUi=n$?.indexOf("Mobi")>=0,V6t=!0,Qut=are()||QH,nGe=navigator.language.toLowerCase(),W6t=nGe):console.error("Unable to resolve platform.");function LT(a){switch(a){case 0:return"Web";case 1:return"Mac";case 2:return"Linux";case 3:return"Windows"}}var Yut=0;aGe?Yut=1:sGe?Yut=3:rGe&&(Yut=2);var ri=sGe,it=aGe,Wn=rGe,rbe=EUi,kr=TUi,Xut=_Ui,Gt=V6t,qDo=V6t&&typeof r$.importScripts=="function",PUi=qDo?r$.origin:void 0,Nc=B6t,sbe=LUi,Zf=DUi,Pp=Yut,YH=n$,Dr=Qut,IS;(t=>{function a(){return Dr}t.value=a;function i(){return Dr.length===2?Dr==="en":Dr.length>=3?Dr[0]==="e"&&Dr[1]==="n"&&Dr[2]==="-":!1}t.isDefaultVariant=i;function e(){return Dr==="en"}t.isDefault=e})(IS||={});var abe=nGe,AUi=W6t,H6t=RUi,jDo=typeof r$.postMessage=="function"&&!r$.importScripts,Vw=(()=>{if(jDo){let a=[];r$.addEventListener("message",e=>{if(e.data&&e.data.vscodeScheduleAsyncWork)for(let t=0,o=a.length;t<o;t++){let n=a[t];if(n.id===e.data.vscodeScheduleAsyncWork){a.splice(t,1),n.callback();return}}});let i=0;return e=>{let t=++i;a.push({id:t,callback:e}),r$.postMessage({vscodeScheduleAsyncWork:t},"*")}}return a=>setTimeout(a)})();var zo=aGe||B6t?2:sGe?1:3,xUi=!0,kUi=!1;function lGe(){if(!kUi){kUi=!0;let a=new Uint8Array(2);a[0]=1,a[1]=2,xUi=new Uint16Array(a.buffer)[0]===513}return xUi}var XH=!!(YH&&YH.indexOf("Chrome")>=0),lbe=!!(YH&&YH.indexOf("Firefox")>=0),cbe=!!(!XH&&YH&&YH.indexOf("Safari")>=0),dbe=!!(YH&&YH.indexOf("Edg/")>=0),Jut=!!(YH&&YH.indexOf("Android")>=0);function NUi(a){return parseFloat(a)>=25}var gre,U6t=globalThis.vscode;if(typeof U6t<"u"&&typeof U6t.process<"u"){let a=U6t.process;gre={get platform(){return a.platform},get arch(){return a.arch},get env(){return a.env},cwd(){return a.cwd()}}}else typeof process<"u"&&typeof process?.versions?.node=="string"?gre={get platform(){return process.platform},get arch(){return process.arch},get env(){return process.env},cwd(){return process.env.VSCODE_CWD||process.cwd()}}:gre={get platform(){return ri?"win32":it?"darwin":"linux"},get arch(){},get env(){return{}},cwd(){return"/"}};var fre=gre.cwd,fp=gre.env,ZA=gre.platform,ube=gre.arch;var QDo=globalThis.performance.now.bind(globalThis.performance),En=class a{static create(i){return new a(i)}constructor(i){this._now=i===!1?Date.now:QDo,this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}};var FUi=!1,YDo=!1,XDo=100,WUi=6e4;function VUi(){return!!fp.VSCODE_DEV}var H;(de=>{de.None=()=>C.None;function i(se){if(YDo){let{onDidAddListener:Se}=se,ke=hbe.create(),Ee=0;se.onDidAddListener=()=>{++Ee===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),ke.print()),Se?.()}}}function e(se,Se,ke){return g(se,()=>{},0,void 0,Se??!0,void 0,ke)}de.defer=e;function t(se){return(Se,ke=null,Ee)=>{let He=!1,Ve;return Ve=se(Fe=>{if(!He)return Ve?Ve.dispose():He=!0,Se.call(ke,Fe)},null,Ee),He&&Ve.dispose(),Ve}}de.once=t;function o(se,Se){return de.once(de.filter(se,Se))}de.onceIf=o;function n(se,Se,ke){return p((Ee,He=null,Ve)=>se(Fe=>Ee.call(He,Se(Fe)),null,Ve),ke)}de.map=n;function r(se,Se,ke){return p((Ee,He=null,Ve)=>se(Fe=>{Se(Fe),Ee.call(He,Fe)},null,Ve),ke)}de.forEach=r;function s(se,Se,ke){return p((Ee,He=null,Ve)=>se(Fe=>Se(Fe)&&Ee.call(He,Fe),null,Ve),ke)}de.filter=s;function l(se){return se}de.signal=l;function c(...se){return(Se,ke=null,Ee)=>{let He=hn(...se.map(Ve=>Ve(Fe=>Se.call(ke,Fe))));return h(He,Ee)}}de.any=c;function u(se,Se,ke,Ee){let He=ke;return n(se,Ve=>(He=Se(He,Ve),He),Ee)}de.reduce=u;function p(se,Se){let ke,Ee={onWillAddFirstListener(){ke=se(He.fire,He)},onDidRemoveLastListener(){ke?.dispose()}};Se||i(Ee);let He=new E(Ee);return Se?.add(He),He.event}function h(se,Se){return Se instanceof Array?Se.push(se):Se&&Se.add(se),se}function g(se,Se,ke=100,Ee=!1,He=!1,Ve,Fe){let Qt,Ze,Ti,ti=0,bo,Ro={leakWarningThreshold:Ve,onWillAddFirstListener(){Qt=se(sr=>{ti++,Ze=Se(Ze,sr),Ee&&!Ti&&(_o.fire(Ze),Ze=void 0),bo=()=>{let ln=Ze;Ze=void 0,Ti=void 0,(!Ee||ti>1)&&_o.fire(ln),ti=0},typeof ke=="number"?(Ti&&clearTimeout(Ti),Ti=setTimeout(bo,ke)):Ti===void 0&&(Ti=null,queueMicrotask(bo))})},onWillRemoveListener(){He&&ti>0&&bo?.()},onDidRemoveLastListener(){bo=void 0,Qt.dispose()}};Fe||i(Ro);let _o=new E(Ro);return Fe?.add(_o),_o.event}de.debounce=g;function f(se,Se=0,ke,Ee){return de.debounce(se,(He,Ve)=>He?(He.push(Ve),He):[Ve],Se,void 0,ke??!0,void 0,Ee)}de.accumulate=f;function v(se,Se,ke=100,Ee=!0,He=!0,Ve,Fe){let Qt,Ze,Ti,ti=0,bo={leakWarningThreshold:Ve,onWillAddFirstListener(){Qt=se(_o=>{ti++,Ze=Se(Ze,_o),Ti===void 0&&(Ee&&(Ro.fire(Ze),Ze=void 0,ti=0),typeof ke=="number"?Ti=setTimeout(()=>{He&&ti>0&&Ro.fire(Ze),Ze=void 0,Ti=void 0,ti=0},ke):(Ti=0,queueMicrotask(()=>{He&&ti>0&&Ro.fire(Ze),Ze=void 0,Ti=void 0,ti=0})))})},onDidRemoveLastListener(){Qt.dispose()}};Fe||i(bo);let Ro=new E(bo);return Fe?.add(Ro),Ro.event}de.throttle=v;function b(se,Se=(Ee,He)=>Ee===He,ke){let Ee=!0,He;return s(se,Ve=>{let Fe=Ee||!Se(Ve,He);return Ee=!1,He=Ve,Fe},ke)}de.latch=b;function S(se,Se,ke){return[de.filter(se,Se,ke),de.filter(se,Ee=>!Se(Ee),ke)]}de.split=S;function y(se,Se,ke=!1,Ee=[],He){let Ve=Ee.slice(),Fe;VUi()&&(Fe={stack:hbe.create(),timerId:setTimeout(()=>{Ve&&Ve.length>0&&Fe&&!Fe.warned&&(Fe.warned=!0,console.warn(`[Event.buffer][${Se}] potential LEAK detected: ${Ve.length} events buffered for ${WUi/1e3}s without being consumed. Buffered here:`),Fe.stack.print())},WUi),warned:!1},He&&He.add(Z(()=>clearTimeout(Fe.timerId))));let Qt=()=>{Fe&&clearTimeout(Fe.timerId)},Ze=se(bo=>{Ve?(Ve.push(bo),VUi()&&Fe&&!Fe.warned&&Ve.length>=XDo&&(Fe.warned=!0,console.warn(`[Event.buffer][${Se}] potential LEAK detected: ${Ve.length} events buffered without being consumed. Buffered here:`),Fe.stack.print())):ti.fire(bo)});He&&He.add(Ze);let Ti=()=>{Ve?.forEach(bo=>ti.fire(bo)),Ve=null,Qt()},ti=new E({onWillAddFirstListener(){Ze||(Ze=se(bo=>ti.fire(bo)),He&&He.add(Ze))},onDidAddFirstListener(){Ve&&(ke?setTimeout(Ti):Ti())},onDidRemoveLastListener(){Ze&&Ze.dispose(),Ze=null,Qt()}});return He&&He.add(ti),ti.event}de.buffer=y;function w(se,Se){return(Ee,He,Ve)=>{let Fe=Se(new T);return se(function(Qt){let Ze=Fe.evaluate(Qt);Ze!==k&&Ee.call(He,Ze)},void 0,Ve)}}de.chain=w;let k=Symbol("HaltChainable");class T{constructor(){this.steps=[]}map(Se){return this.steps.push(Se),this}forEach(Se){return this.steps.push(ke=>(Se(ke),ke)),this}filter(Se){return this.steps.push(ke=>Se(ke)?ke:k),this}reduce(Se,ke){let Ee=ke;return this.steps.push(He=>(Ee=Se(Ee,He),Ee)),this}latch(Se=(ke,Ee)=>ke===Ee){let ke=!0,Ee;return this.steps.push(He=>{let Ve=ke||!Se(He,Ee);return ke=!1,Ee=He,Ve?He:k}),this}evaluate(Se){for(let ke of this.steps)if(Se=ke(Se),Se===k)break;return Se}}function N(se,Se,ke=Ee=>Ee){let Ee=(...Qt)=>Fe.fire(ke(...Qt)),He=()=>se.on(Se,Ee),Ve=()=>se.removeListener(Se,Ee),Fe=new E({onWillAddFirstListener:He,onDidRemoveLastListener:Ve});return Fe.event}de.fromNodeEventEmitter=N;function O(se,Se,ke=Ee=>Ee){let Ee=(...Qt)=>Fe.fire(ke(...Qt)),He=()=>se.addEventListener(Se,Ee),Ve=()=>se.removeEventListener(Se,Ee),Fe=new E({onWillAddFirstListener:He,onDidRemoveLastListener:Ve});return Fe.event}de.fromDOMEventEmitter=O;function V(se,Se){let ke,Ee,He=new Promise(Ve=>{Ee=t(se)(Ve),q6t(Ee,Se),ke=()=>{BUi(Ee,Se)}});return He.cancel=ke,Se&&He.finally(()=>BUi(Ee,Se)),He}de.toPromise=V;function U(se,Se){return se(ke=>Se.fire(ke))}de.forward=U;function G(se,Se,ke){return Se(ke),se(Ee=>Se(Ee))}de.runAndSubscribe=G;class ${constructor(Se,ke){this._observable=Se;this._counter=0;this._hasChanged=!1;let Ee={onWillAddFirstListener:()=>{Se.addObserver(this),this._observable.reportChanges()},onDidRemoveLastListener:()=>{Se.removeObserver(this)}};ke||i(Ee),this.emitter=new E(Ee),ke&&ke.add(this.emitter)}beginUpdate(Se){this._counter++}handlePossibleChange(Se){}handleChange(Se,ke){this._hasChanged=!0}endUpdate(Se){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function te(se,Se){return new $(se,Se).emitter.event}de.fromObservable=te;function pe(se){return(Se,ke,Ee)=>{let He=0,Ve=!1,Fe={beginUpdate(){He++},endUpdate(){He--,He===0&&(se.reportChanges(),Ve&&(Ve=!1,Se.call(ke)))},handlePossibleChange(){},handleChange(){Ve=!0}};se.addObserver(Fe),se.reportChanges();let Qt={dispose(){se.removeObserver(Fe)}};return q6t(Qt,Ee),Qt}}de.fromObservableLight=pe})(H||={});var mbe=class a{constructor(i){this.listenerCount=0;this.invocationCount=0;this.elapsedOverall=0;this.durations=[];this.name=`${i}_${a._idPool++}`,a.all.add(this)}static{this.all=new Set}static{this._idPool=0}start(i){this._stopWatch=new En,this.listenerCount=i}stop(){if(this._stopWatch){let i=this._stopWatch.elapsed();this.durations.push(i),this.elapsedOverall+=i,this.invocationCount+=1,this._stopWatch=void 0}}},cGe=-1;function HUi(a){let i=cGe;return cGe=a,{dispose(){cGe=i}}}var z6t=class a{constructor(i,e,t=(a._idPool++).toString(16).padStart(3,"0")){this._errorHandler=i;this.threshold=e;this.name=t;this._warnCountdown=0}static{this._idPool=1}dispose(){this._stacks?.clear()}check(i,e){let t=this.threshold;if(t<=0||e<t)return;this._stacks||(this._stacks=new Map);let o=this._stacks.get(i.value)||0;if(this._stacks.set(i.value,o+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=t*.5;let[n,r]=this.getMostFrequentStack(),s=`[${this.name}] potential listener LEAK detected, having ${e} listeners already. MOST frequent listener (${r}):`;console.warn(s),console.warn(n);let l=new K6t(s,n);this._errorHandler(l)}return()=>{let n=this._stacks.get(i.value)||0;this._stacks.set(i.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let i,e=0;for(let[t,o]of this._stacks)(!i||e<o)&&(i=[t,o],e=o);return i}},hbe=class a{constructor(i){this.value=i}static create(){let i=new Error;return new a(i.stack??"")}print(){console.warn(this.value.split(`
`).slice(2).join(`
`))}},K6t=class extends Error{constructor(i,e){super(i),this.name="ListenerLeakError",this.stack=e}},G6t=class extends Error{constructor(i,e){super(i),this.name="ListenerRefusalError",this.stack=e}},JDo=0,pbe=class{constructor(i){this.value=i;this.id=JDo++}},ZDo=2,UUi=(a,i)=>{if(a instanceof pbe)i(a);else for(let e=0;e<a.length;e++){let t=a[e];t&&i(t)}},E=class{constructor(i){this._size=0;this._options=i,this._leakageMon=cGe>0||this._options?.leakWarningThreshold?new z6t(i?.onListenerError??mt,this._options?.leakWarningThreshold??cGe):void 0,this._perfMon=this._options?._profName?new mbe(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(FUi){let i=this._listeners;queueMicrotask(()=>{UUi(i,e=>e.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(i,e,t)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let l=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(l);let c=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],u=new G6t(`${l}. HINT: Stack shows most frequent listener (${c[1]}-times)`,c[0]);return(this._options?.onListenerError||mt)(u),C.None}if(this._disposed)return C.None;e&&(i=i.bind(e));let o=new pbe(i),n,r;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(o.stack=hbe.create(),n=this._leakageMon.check(o.stack,this._size+1)),FUi&&(o.stack=r??hbe.create()),this._listeners?this._listeners instanceof pbe?(this._deliveryQueue??=new Zut,this._listeners=[this._listeners,o]):this._listeners.push(o):(this._options?.onWillAddFirstListener?.(this),this._listeners=o,this._options?.onDidAddFirstListener?.(this)),this._options?.onDidAddListener?.(this),this._size++;let s=Z(()=>{n?.(),this._removeListener(o)});return q6t(s,t),s},this._event}_removeListener(i){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let e=this._listeners,t=e.indexOf(i);if(t===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,e[t]=void 0;let o=this._deliveryQueue.current===this;if(this._size*ZDo<=e.length){let n=0;for(let r=0;r<e.length;r++)e[r]?e[n++]=e[r]:o&&n<this._deliveryQueue.end&&(this._deliveryQueue.end--,n<this._deliveryQueue.i&&this._deliveryQueue.i--);e.length=n}}_deliver(i,e){if(!i)return;let t=this._options?.onListenerError||mt;if(!t){i.value(e);return}try{i.value(e)}catch(o){t(o)}}_deliverQueue(i){let e=i.current._listeners;for(;i.i<i.end;)this._deliver(e[i.i++],i.value);i.reset()}fire(i){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof pbe)this._deliver(this._listeners,i);else{let e=this._deliveryQueue;e.enqueue(this,i,this._listeners.length),this._deliverQueue(e)}this._perfMon?.stop()}hasListeners(){return this._size>0}},zUi=()=>new Zut,Zut=class{constructor(){this.i=-1;this.end=0}enqueue(i,e,t){this.i=0,this.end=t,this.current=i,this.value=e}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},JH=class extends E{async fireAsync(i,e,t){if(this._listeners)for(this._asyncDeliveryQueue||(this._asyncDeliveryQueue=new Vs),UUi(this._listeners,o=>this._asyncDeliveryQueue.push([o.value,i]));this._asyncDeliveryQueue.size>0&&!e.isCancellationRequested;){let[o,n]=this._asyncDeliveryQueue.shift(),r=[],s={...n,token:e,waitUntil:l=>{if(Object.isFrozen(r))throw new Error("waitUntil can NOT be called asynchronous");t&&(l=t(l,o)),r.push(l)}};try{o(s)}catch(l){mt(l);continue}Object.freeze(r),await Promise.allSettled(r).then(l=>{for(let c of l)c.status==="rejected"&&mt(c.reason)})}}},Pm=class extends E{constructor(e){super(e);this._isPaused=0;this._eventQueue=new Vs;this._mergeFn=e?.merge}get isPaused(){return this._isPaused!==0}pause(){this._isPaused++}resume(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){if(this._eventQueue.size>0){let e=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(e))}}else for(;!this._isPaused&&this._eventQueue.size!==0;)super.fire(this._eventQueue.shift())}fire(e){this._size&&(this._isPaused!==0?this._eventQueue.push(e):super.fire(e))}},gbe=class extends Pm{constructor(i){super(i),this._delay=i.delay??100}fire(i){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(i)}},d6=class extends E{constructor(e){super(e);this._queuedEvents=[];this._mergeFn=e?.merge}fire(e){this.hasListeners()&&(this._queuedEvents.push(e),this._queuedEvents.length===1&&queueMicrotask(()=>{this._mergeFn?super.fire(this._mergeFn(this._queuedEvents)):this._queuedEvents.forEach(t=>super.fire(t)),this._queuedEvents=[]}))}},xI=class{constructor(){this.hasListeners=!1;this.events=[];this.emitter=new E({onWillAddFirstListener:()=>this.onFirstListenerAdd(),onDidRemoveLastListener:()=>this.onLastListenerRemove()})}get event(){return this.emitter.event}add(i){let e={event:i,listener:null};return this.events.push(e),this.hasListeners&&this.hook(e),Z(wd(()=>{this.hasListeners&&this.unhook(e);let o=this.events.indexOf(e);this.events.splice(o,1)}))}onFirstListenerAdd(){this.hasListeners=!0,this.events.forEach(i=>this.hook(i))}onLastListenerRemove(){this.hasListeners=!1,this.events.forEach(i=>this.unhook(i))}hook(i){i.listener=i.event(e=>this.emitter.fire(e))}unhook(i){i.listener?.dispose(),i.listener=null}dispose(){this.emitter.dispose();for(let i of this.events)i.listener?.dispose();this.events=[]}},vre=class{constructor(i,e,t,o){this._store=new P;let n=this._store.add(new xI),r=this._store.add(new jt);function s(l){r.set(l,n.add(o(l)))}for(let l of i)s(l);this._store.add(e(l=>{s(l)})),this._store.add(t(l=>{r.deleteAndDispose(l)})),this.event=n.event}dispose(){this._store.dispose()}},eN=class{constructor(){this.data=[]}wrapEvent(i,e,t){return(o,n,r)=>i(s=>{let l=this.data[this.data.length-1];if(!e){l?l.buffers.push(()=>o.call(n,s)):o.call(n,s);return}let c=l;if(!c){o.call(n,e(t,s));return}c.items??=[],c.items.push(s),c.buffers.length===0&&l.buffers.push(()=>{c.reducedResult??=t?c.items.reduce(e,t):c.items.reduce(e),o.call(n,c.reducedResult)})},void 0,r)}bufferEvents(i){let e={buffers:new Array};this.data.push(e);let t=i();return this.data.pop(),e.buffers.forEach(o=>o()),t}},Mh=class{constructor(){this.listening=!1;this.inputEvent=H.None;this.inputEventListener=C.None;this.emitter=new E({onDidAddFirstListener:()=>{this.listening=!0,this.inputEventListener=this.inputEvent(this.emitter.fire,this.emitter)},onDidRemoveLastListener:()=>{this.listening=!1,this.inputEventListener.dispose()}});this.event=this.emitter.event}set input(i){this.inputEvent=i,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=i(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}},fbe=class{constructor(i){this._value=i;this._onDidChange=new E;this.onDidChange=this._onDidChange.event}static const(i){return new $6t(i)}get value(){return this._value}set value(i){i!==this._value&&(this._value=i,this._onDidChange.fire(void 0))}},$6t=class{constructor(i){this.value=i;this.onDidChange=H.None}};function KUi(a,i,e){let t=new jt,o=new Set(a());for(let r of o)t.set(r,e(r));let n=new P;return n.add(i(()=>{let r=a(),s=HH(o,r);for(let l of s.removed)t.deleteAndDispose(l);for(let l of s.added)t.set(l,e(l));o=new Set(r)})),n.add(t),n}function q6t(a,i){i instanceof P?i.add(a):Array.isArray(i)&&i.push(a)}function BUi(a,i){if(i instanceof P)i.delete(a);else if(Array.isArray(i)){let e=i.indexOf(a);e!==-1&&i.splice(e,1)}a.dispose()}var ZH=class a{constructor(){this.mapWindowIdToZoomLevel=new Map;this._onDidChangeZoomLevel=new E;this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event;this.mapWindowIdToZoomFactor=new Map;this._onDidChangeFullscreen=new E;this.onDidChangeFullscreen=this._onDidChangeFullscreen.event;this.mapWindowIdToFullScreen=new Map}static{this.INSTANCE=new a}getZoomLevel(i){return this.mapWindowIdToZoomLevel.get(this.getWindowId(i))??0}setZoomLevel(i,e){if(this.getZoomLevel(e)===i)return;let t=this.getWindowId(e);this.mapWindowIdToZoomLevel.set(t,i),this._onDidChangeZoomLevel.fire(t)}getZoomFactor(i){return this.mapWindowIdToZoomFactor.get(this.getWindowId(i))??1}setZoomFactor(i,e){this.mapWindowIdToZoomFactor.set(this.getWindowId(e),i)}setFullscreen(i,e){if(this.isFullscreen(e)===i)return;let t=this.getWindowId(e);this.mapWindowIdToFullScreen.set(t,i),this._onDidChangeFullscreen.fire(t)}isFullscreen(i){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(i))}getWindowId(i){return i.vscodeWindowId}};function eLo(a,i,e){typeof i=="string"&&(i=a.matchMedia(i)),i.addEventListener("change",e)}function GUi(a,i){ZH.INSTANCE.setZoomLevel(a,i)}function RT(a){return ZH.INSTANCE.getZoomLevel(a)}var tpt=ZH.INSTANCE.onDidChangeZoomLevel;function yS(a){return ZH.INSTANCE.getZoomFactor(a)}function $Ui(a,i){ZH.INSTANCE.setZoomFactor(a,i)}function s$(a,i){ZH.INSTANCE.setFullscreen(a,i)}function wS(a){return ZH.INSTANCE.isFullscreen(a)}var Bk=ZH.INSTANCE.onDidChangeFullscreen,vbe=navigator.userAgent,yc=vbe.indexOf("Firefox")>=0,H0=vbe.indexOf("AppleWebKit")>=0,eU=vbe.indexOf("Chrome")>=0,Vb=!eU&&vbe.indexOf("Safari")>=0,qUi=!eU&&!Vb&&H0,qgn=vbe.indexOf("Electron/")>=0,Q6t=vbe.indexOf("Android")>=0,ept=!1;if(typeof It.matchMedia=="function"){let a=It.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),i=It.matchMedia("(display-mode: fullscreen)");ept=a.matches,eLo(It,a,({matches:e})=>{ept&&i.matches||(ept=e)})}function bbe(){return ept}function dGe(){return!!navigator?.windowControlsOverlay?.visible}function jUi(a){return a.navigator?.windowControlsOverlay?.getTitlebarAreaRect()}function QUi(){return globalThis.MonacoEnvironment}var uGe=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(i,e){this._keyCodeToStr[i]=e,this._strToKeyCode[e.toLowerCase()]=i}keyCodeToStr(i){return this._keyCodeToStr[i]}strToKeyCode(i){return this._strToKeyCode[i.toLowerCase()]||0}},ipt=new uGe,Y6t=new uGe,X6t=new uGe,J6t=new Array(230),opt={},tLo={},YUi=[],XUi=Object.create(null),JUi=Object.create(null),Bb={lowerCaseToEnum:a=>JUi[a]||0,toEnum:a=>XUi[a]||0,toString:a=>YUi[a]||"None"},Dy=[],Sbe=[];for(let a=0;a<=193;a++)Dy[a]=-1;for(let a=0;a<=132;a++)Sbe[a]=-1;(function(){let i=[[1,0,"None",0,"unknown",0,"VK_UNKNOWN","",""],[1,1,"Hyper",0,"",0,"","",""],[1,2,"Super",0,"",0,"","",""],[1,3,"Fn",0,"",0,"","",""],[1,4,"FnLock",0,"",0,"","",""],[1,5,"Suspend",0,"",0,"","",""],[1,6,"Resume",0,"",0,"","",""],[1,7,"Turbo",0,"",0,"","",""],[1,8,"Sleep",0,"",0,"VK_SLEEP","",""],[1,9,"WakeUp",0,"",0,"","",""],[0,10,"KeyA",31,"A",65,"VK_A","",""],[0,11,"KeyB",32,"B",66,"VK_B","",""],[0,12,"KeyC",33,"C",67,"VK_C","",""],[0,13,"KeyD",34,"D",68,"VK_D","",""],[0,14,"KeyE",35,"E",69,"VK_E","",""],[0,15,"KeyF",36,"F",70,"VK_F","",""],[0,16,"KeyG",37,"G",71,"VK_G","",""],[0,17,"KeyH",38,"H",72,"VK_H","",""],[0,18,"KeyI",39,"I",73,"VK_I","",""],[0,19,"KeyJ",40,"J",74,"VK_J","",""],[0,20,"KeyK",41,"K",75,"VK_K","",""],[0,21,"KeyL",42,"L",76,"VK_L","",""],[0,22,"KeyM",43,"M",77,"VK_M","",""],[0,23,"KeyN",44,"N",78,"VK_N","",""],[0,24,"KeyO",45,"O",79,"VK_O","",""],[0,25,"KeyP",46,"P",80,"VK_P","",""],[0,26,"KeyQ",47,"Q",81,"VK_Q","",""],[0,27,"KeyR",48,"R",82,"VK_R","",""],[0,28,"KeyS",49,"S",83,"VK_S","",""],[0,29,"KeyT",50,"T",84,"VK_T","",""],[0,30,"KeyU",51,"U",85,"VK_U","",""],[0,31,"KeyV",52,"V",86,"VK_V","",""],[0,32,"KeyW",53,"W",87,"VK_W","",""],[0,33,"KeyX",54,"X",88,"VK_X","",""],[0,34,"KeyY",55,"Y",89,"VK_Y","",""],[0,35,"KeyZ",56,"Z",90,"VK_Z","",""],[0,36,"Digit1",22,"1",49,"VK_1","",""],[0,37,"Digit2",23,"2",50,"VK_2","",""],[0,38,"Digit3",24,"3",51,"VK_3","",""],[0,39,"Digit4",25,"4",52,"VK_4","",""],[0,40,"Digit5",26,"5",53,"VK_5","",""],[0,41,"Digit6",27,"6",54,"VK_6","",""],[0,42,"Digit7",28,"7",55,"VK_7","",""],[0,43,"Digit8",29,"8",56,"VK_8","",""],[0,44,"Digit9",30,"9",57,"VK_9","",""],[0,45,"Digit0",21,"0",48,"VK_0","",""],[1,46,"Enter",3,"Enter",13,"VK_RETURN","",""],[1,47,"Escape",9,"Escape",27,"VK_ESCAPE","",""],[1,48,"Backspace",1,"Backspace",8,"VK_BACK","",""],[1,49,"Tab",2,"Tab",9,"VK_TAB","",""],[1,50,"Space",10,"Space",32,"VK_SPACE","",""],[0,51,"Minus",88,"-",189,"VK_OEM_MINUS","-","OEM_MINUS"],[0,52,"Equal",86,"=",187,"VK_OEM_PLUS","=","OEM_PLUS"],[0,53,"BracketLeft",92,"[",219,"VK_OEM_4","[","OEM_4"],[0,54,"BracketRight",94,"]",221,"VK_OEM_6","]","OEM_6"],[0,55,"Backslash",93,"\\",220,"VK_OEM_5","\\","OEM_5"],[0,56,"IntlHash",0,"",0,"","",""],[0,57,"Semicolon",85,";",186,"VK_OEM_1",";","OEM_1"],[0,58,"Quote",95,"'",222,"VK_OEM_7","'","OEM_7"],[0,59,"Backquote",91,"`",192,"VK_OEM_3","`","OEM_3"],[0,60,"Comma",87,",",188,"VK_OEM_COMMA",",","OEM_COMMA"],[0,61,"Period",89,".",190,"VK_OEM_PERIOD",".","OEM_PERIOD"],[0,62,"Slash",90,"/",191,"VK_OEM_2","/","OEM_2"],[1,63,"CapsLock",8,"CapsLock",20,"VK_CAPITAL","",""],[1,64,"F1",59,"F1",112,"VK_F1","",""],[1,65,"F2",60,"F2",113,"VK_F2","",""],[1,66,"F3",61,"F3",114,"VK_F3","",""],[1,67,"F4",62,"F4",115,"VK_F4","",""],[1,68,"F5",63,"F5",116,"VK_F5","",""],[1,69,"F6",64,"F6",117,"VK_F6","",""],[1,70,"F7",65,"F7",118,"VK_F7","",""],[1,71,"F8",66,"F8",119,"VK_F8","",""],[1,72,"F9",67,"F9",120,"VK_F9","",""],[1,73,"F10",68,"F10",121,"VK_F10","",""],[1,74,"F11",69,"F11",122,"VK_F11","",""],[1,75,"F12",70,"F12",123,"VK_F12","",""],[1,76,"PrintScreen",0,"",0,"","",""],[1,77,"ScrollLock",84,"ScrollLock",145,"VK_SCROLL","",""],[1,78,"Pause",7,"PauseBreak",19,"VK_PAUSE","",""],[1,79,"Insert",19,"Insert",45,"VK_INSERT","",""],[1,80,"Home",14,"Home",36,"VK_HOME","",""],[1,81,"PageUp",11,"PageUp",33,"VK_PRIOR","",""],[1,82,"Delete",20,"Del",46,"VK_DELETE","Delete",""],[1,83,"End",13,"End",35,"VK_END","",""],[1,84,"PageDown",12,"PageDown",34,"VK_NEXT","",""],[1,85,"ArrowRight",17,"RightArrow",39,"VK_RIGHT","Right",""],[1,86,"ArrowLeft",15,"LeftArrow",37,"VK_LEFT","Left",""],[1,87,"ArrowDown",18,"DownArrow",40,"VK_DOWN","Down",""],[1,88,"ArrowUp",16,"UpArrow",38,"VK_UP","Up",""],[1,89,"NumLock",83,"NumLock",144,"VK_NUMLOCK","",""],[1,90,"NumpadDivide",113,"NumPad_Divide",111,"VK_DIVIDE","",""],[1,91,"NumpadMultiply",108,"NumPad_Multiply",106,"VK_MULTIPLY","",""],[1,92,"NumpadSubtract",111,"NumPad_Subtract",109,"VK_SUBTRACT","",""],[1,93,"NumpadAdd",109,"NumPad_Add",107,"VK_ADD","",""],[1,94,"NumpadEnter",3,"",0,"","",""],[1,95,"Numpad1",99,"NumPad1",97,"VK_NUMPAD1","",""],[1,96,"Numpad2",100,"NumPad2",98,"VK_NUMPAD2","",""],[1,97,"Numpad3",101,"NumPad3",99,"VK_NUMPAD3","",""],[1,98,"Numpad4",102,"NumPad4",100,"VK_NUMPAD4","",""],[1,99,"Numpad5",103,"NumPad5",101,"VK_NUMPAD5","",""],[1,100,"Numpad6",104,"NumPad6",102,"VK_NUMPAD6","",""],[1,101,"Numpad7",105,"NumPad7",103,"VK_NUMPAD7","",""],[1,102,"Numpad8",106,"NumPad8",104,"VK_NUMPAD8","",""],[1,103,"Numpad9",107,"NumPad9",105,"VK_NUMPAD9","",""],[1,104,"Numpad0",98,"NumPad0",96,"VK_NUMPAD0","",""],[1,105,"NumpadDecimal",112,"NumPad_Decimal",110,"VK_DECIMAL","",""],[0,106,"IntlBackslash",97,"OEM_102",226,"VK_OEM_102","",""],[1,107,"ContextMenu",58,"ContextMenu",93,"","",""],[1,108,"Power",0,"",0,"","",""],[1,109,"NumpadEqual",0,"",0,"","",""],[1,110,"F13",71,"F13",124,"VK_F13","",""],[1,111,"F14",72,"F14",125,"VK_F14","",""],[1,112,"F15",73,"F15",126,"VK_F15","",""],[1,113,"F16",74,"F16",127,"VK_F16","",""],[1,114,"F17",75,"F17",128,"VK_F17","",""],[1,115,"F18",76,"F18",129,"VK_F18","",""],[1,116,"F19",77,"F19",130,"VK_F19","",""],[1,117,"F20",78,"F20",131,"VK_F20","",""],[1,118,"F21",79,"F21",132,"VK_F21","",""],[1,119,"F22",80,"F22",133,"VK_F22","",""],[1,120,"F23",81,"F23",134,"VK_F23","",""],[1,121,"F24",82,"F24",135,"VK_F24","",""],[1,122,"Open",0,"",0,"","",""],[1,123,"Help",0,"",0,"","",""],[1,124,"Select",0,"",0,"","",""],[1,125,"Again",0,"",0,"","",""],[1,126,"Undo",0,"",0,"","",""],[1,127,"Cut",0,"",0,"","",""],[1,128,"Copy",0,"",0,"","",""],[1,129,"Paste",0,"",0,"","",""],[1,130,"Find",0,"",0,"","",""],[1,131,"AudioVolumeMute",117,"AudioVolumeMute",173,"VK_VOLUME_MUTE","",""],[1,132,"AudioVolumeUp",118,"AudioVolumeUp",175,"VK_VOLUME_UP","",""],[1,133,"AudioVolumeDown",119,"AudioVolumeDown",174,"VK_VOLUME_DOWN","",""],[1,134,"NumpadComma",110,"NumPad_Separator",108,"VK_SEPARATOR","",""],[0,135,"IntlRo",115,"ABNT_C1",193,"VK_ABNT_C1","",""],[1,136,"KanaMode",0,"",0,"","",""],[0,137,"IntlYen",0,"",0,"","",""],[1,138,"Convert",0,"",0,"","",""],[1,139,"NonConvert",0,"",0,"","",""],[1,140,"Lang1",0,"",0,"","",""],[1,141,"Lang2",0,"",0,"","",""],[1,142,"Lang3",0,"",0,"","",""],[1,143,"Lang4",0,"",0,"","",""],[1,144,"Lang5",0,"",0,"","",""],[1,145,"Abort",0,"",0,"","",""],[1,146,"Props",0,"",0,"","",""],[1,147,"NumpadParenLeft",0,"",0,"","",""],[1,148,"NumpadParenRight",0,"",0,"","",""],[1,149,"NumpadBackspace",0,"",0,"","",""],[1,150,"NumpadMemoryStore",0,"",0,"","",""],[1,151,"NumpadMemoryRecall",0,"",0,"","",""],[1,152,"NumpadMemoryClear",0,"",0,"","",""],[1,153,"NumpadMemoryAdd",0,"",0,"","",""],[1,154,"NumpadMemorySubtract",0,"",0,"","",""],[1,155,"NumpadClear",131,"Clear",12,"VK_CLEAR","",""],[1,156,"NumpadClearEntry",0,"",0,"","",""],[1,0,"",5,"Ctrl",17,"VK_CONTROL","",""],[1,0,"",4,"Shift",16,"VK_SHIFT","",""],[1,0,"",6,"Alt",18,"VK_MENU","",""],[1,0,"",57,"Meta",91,"VK_COMMAND","",""],[1,157,"ControlLeft",5,"",0,"VK_LCONTROL","",""],[1,158,"ShiftLeft",4,"",0,"VK_LSHIFT","",""],[1,159,"AltLeft",6,"",0,"VK_LMENU","",""],[1,160,"MetaLeft",57,"",0,"VK_LWIN","",""],[1,161,"ControlRight",5,"",0,"VK_RCONTROL","",""],[1,162,"ShiftRight",4,"",0,"VK_RSHIFT","",""],[1,163,"AltRight",6,"",0,"VK_RMENU","",""],[1,164,"MetaRight",57,"",0,"VK_RWIN","",""],[1,165,"BrightnessUp",0,"",0,"","",""],[1,166,"BrightnessDown",0,"",0,"","",""],[1,167,"MediaPlay",0,"",0,"","",""],[1,168,"MediaRecord",0,"",0,"","",""],[1,169,"MediaFastForward",0,"",0,"","",""],[1,170,"MediaRewind",0,"",0,"","",""],[1,171,"MediaTrackNext",124,"MediaTrackNext",176,"VK_MEDIA_NEXT_TRACK","",""],[1,172,"MediaTrackPrevious",125,"MediaTrackPrevious",177,"VK_MEDIA_PREV_TRACK","",""],[1,173,"MediaStop",126,"MediaStop",178,"VK_MEDIA_STOP","",""],[1,174,"Eject",0,"",0,"","",""],[1,175,"MediaPlayPause",127,"MediaPlayPause",179,"VK_MEDIA_PLAY_PAUSE","",""],[1,176,"MediaSelect",128,"LaunchMediaPlayer",181,"VK_MEDIA_LAUNCH_MEDIA_SELECT","",""],[1,177,"LaunchMail",129,"LaunchMail",180,"VK_MEDIA_LAUNCH_MAIL","",""],[1,178,"LaunchApp2",130,"LaunchApp2",183,"VK_MEDIA_LAUNCH_APP2","",""],[1,179,"LaunchApp1",0,"",0,"VK_MEDIA_LAUNCH_APP1","",""],[1,180,"SelectTask",0,"",0,"","",""],[1,181,"LaunchScreenSaver",0,"",0,"","",""],[1,182,"BrowserSearch",120,"BrowserSearch",170,"VK_BROWSER_SEARCH","",""],[1,183,"BrowserHome",121,"BrowserHome",172,"VK_BROWSER_HOME","",""],[1,184,"BrowserBack",122,"BrowserBack",166,"VK_BROWSER_BACK","",""],[1,185,"BrowserForward",123,"BrowserForward",167,"VK_BROWSER_FORWARD","",""],[1,186,"BrowserStop",0,"",0,"VK_BROWSER_STOP","",""],[1,187,"BrowserRefresh",0,"",0,"VK_BROWSER_REFRESH","",""],[1,188,"BrowserFavorites",0,"",0,"VK_BROWSER_FAVORITES","",""],[1,189,"ZoomToggle",0,"",0,"","",""],[1,190,"MailReply",0,"",0,"","",""],[1,191,"MailForward",0,"",0,"","",""],[1,192,"MailSend",0,"",0,"","",""],[1,0,"",114,"KeyInComposition",229,"","",""],[1,0,"",116,"ABNT_C2",194,"VK_ABNT_C2","",""],[1,0,"",96,"OEM_8",223,"VK_OEM_8","",""],[1,0,"",0,"",0,"VK_KANA","",""],[1,0,"",0,"",0,"VK_HANGUL","",""],[1,0,"",0,"",0,"VK_JUNJA","",""],[1,0,"",0,"",0,"VK_FINAL","",""],[1,0,"",0,"",0,"VK_HANJA","",""],[1,0,"",0,"",0,"VK_KANJI","",""],[1,0,"",0,"",0,"VK_CONVERT","",""],[1,0,"",0,"",0,"VK_NONCONVERT","",""],[1,0,"",0,"",0,"VK_ACCEPT","",""],[1,0,"",0,"",0,"VK_MODECHANGE","",""],[1,0,"",0,"",0,"VK_SELECT","",""],[1,0,"",0,"",0,"VK_PRINT","",""],[1,0,"",0,"",0,"VK_EXECUTE","",""],[1,0,"",0,"",0,"VK_SNAPSHOT","",""],[1,0,"",0,"",0,"VK_HELP","",""],[1,0,"",0,"",0,"VK_APPS","",""],[1,0,"",0,"",0,"VK_PROCESSKEY","",""],[1,0,"",0,"",0,"VK_PACKET","",""],[1,0,"",0,"",0,"VK_DBE_SBCSCHAR","",""],[1,0,"",0,"",0,"VK_DBE_DBCSCHAR","",""],[1,0,"",0,"",0,"VK_ATTN","",""],[1,0,"",0,"",0,"VK_CRSEL","",""],[1,0,"",0,"",0,"VK_EXSEL","",""],[1,0,"",0,"",0,"VK_EREOF","",""],[1,0,"",0,"",0,"VK_PLAY","",""],[1,0,"",0,"",0,"VK_ZOOM","",""],[1,0,"",0,"",0,"VK_NONAME","",""],[1,0,"",0,"",0,"VK_PA1","",""],[1,0,"",0,"",0,"VK_OEM_CLEAR","",""]],e=[],t=[];for(let o of i){let[n,r,s,l,c,u,p,h,g]=o;if(t[r]||(t[r]=!0,YUi[r]=s,XUi[s]=r,JUi[s.toLowerCase()]=r,n&&(Dy[r]=l,l!==0&&l!==3&&!tN(l)&&(Sbe[l]=r))),!e[l]){if(e[l]=!0,!c)throw new Error(`String representation missing for key code ${l} around scan code ${s}`);ipt.define(l,c),Y6t.define(l,h||c),X6t.define(l,g||h||c)}u&&(J6t[u]=l),s&&(tLo[s]=u),p&&(opt[p]=l)}Sbe[3]=46})();var vp;(r=>{function a(s){return ipt.keyCodeToStr(s)}r.toString=a;function i(s){return ipt.strToKeyCode(s)}r.fromString=i;function e(s){return Y6t.keyCodeToStr(s)}r.toUserSettingsUS=e;function t(s){return X6t.keyCodeToStr(s)}r.toUserSettingsGeneral=t;function o(s){return Y6t.strToKeyCode(s)||X6t.strToKeyCode(s)}r.fromUserSettings=o;function n(s){if(s>=98&&s<=113)return null;switch(s){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right";case 20:return"Delete"}return ipt.keyCodeToStr(s)}r.toElectronAccelerator=n})(vp||={});function Ai(a,i){let e=(i&65535)<<16>>>0;return(a|e)>>>0}function tN(a){return a===5||a===4||a===6||a===57}var og={clipboard:{writeText:kr||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(navigator&&navigator.clipboard&&navigator.clipboard.writeText),readText:kr||!!(navigator&&navigator.clipboard&&navigator.clipboard.readText)},keyboard:kr||bbe()?0:navigator.keyboard||Vb?1:2,touch:"ontouchstart"in It||navigator.maxTouchPoints>0,pointerEvents:It.PointerEvent&&("ontouchstart"in It||navigator.maxTouchPoints>0)};function Z6t(a,i){if(typeof a=="number"){if(a===0)return null;let e=(a&65535)>>>0,t=(a&4294901760)>>>16;return t!==0?new tU([npt(e,i),npt(t,i)]):new tU([npt(e,i)])}else{let e=[];for(let t=0;t<a.length;t++)e.push(npt(a[t],i));return new tU(e)}}function npt(a,i){let e=!!(a&2048),t=!!(a&256),o=i===2?t:e,n=!!(a&1024),r=!!(a&512),s=i===2?e:t,l=a&255;return new Hb(o,n,r,s,l)}var Hb=class a{constructor(i,e,t,o,n){this.ctrlKey=i;this.shiftKey=e;this.altKey=t;this.metaKey=o;this.keyCode=n}equals(i){return i instanceof a&&this.ctrlKey===i.ctrlKey&&this.shiftKey===i.shiftKey&&this.altKey===i.altKey&&this.metaKey===i.metaKey&&this.keyCode===i.keyCode}getHashCode(){let i=this.ctrlKey?"1":"0",e=this.shiftKey?"1":"0",t=this.altKey?"1":"0",o=this.metaKey?"1":"0";return`K${i}${e}${t}${o}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new tU([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},KD=class a{constructor(i,e,t,o,n){this.ctrlKey=i;this.shiftKey=e;this.altKey=t;this.metaKey=o;this.scanCode=n}equals(i){return i instanceof a&&this.ctrlKey===i.ctrlKey&&this.shiftKey===i.shiftKey&&this.altKey===i.altKey&&this.metaKey===i.metaKey&&this.scanCode===i.scanCode}getHashCode(){let i=this.ctrlKey?"1":"0",e=this.shiftKey?"1":"0",t=this.altKey?"1":"0",o=this.metaKey?"1":"0";return`S${i}${e}${t}${o}${this.scanCode}`}isDuplicateModifierCase(){return this.ctrlKey&&(this.scanCode===157||this.scanCode===161)||this.shiftKey&&(this.scanCode===158||this.scanCode===162)||this.altKey&&(this.scanCode===159||this.scanCode===163)||this.metaKey&&(this.scanCode===160||this.scanCode===164)}},tU=class{constructor(i){if(i.length===0)throw Br("chords");this.chords=i}getHashCode(){let i="";for(let e=0,t=this.chords.length;e<t;e++)e!==0&&(i+=";"),i+=this.chords[e].getHashCode();return i}equals(i){if(i===null||this.chords.length!==i.chords.length)return!1;for(let e=0;e<this.chords.length;e++)if(!this.chords[e].equals(i.chords[e]))return!1;return!0}},rpt=class{constructor(i,e,t,o,n,r){this.ctrlKey=i;this.shiftKey=e;this.altKey=t;this.metaKey=o;this.keyLabel=n;this.keyAriaLabel=r}},Ibe=class{};function iLo(a){if(a.charCode){let e=String.fromCharCode(a.charCode).toUpperCase();return vp.fromString(e)}let i=a.keyCode;if(i===3)return 7;if(yc)switch(i){case 59:return 85;case 60:if(Wn)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(it)return 57;break}else if(H0){if(it&&i===93)return 57;if(!it&&i===92)return 57}return J6t[i]||0}var oLo=it?256:2048,nLo=512,rLo=1024,sLo=it?2048:256;function ZUi(a){let i=[];return a.ctrlKey&&i.push("ctrl"),a.shiftKey&&i.push("shift"),a.altKey&&i.push("alt"),a.metaKey&&i.push("meta"),`modifiers: [${i.join(",")}], code: ${a.code}, keyCode: ${a.keyCode}, key: ${a.key}`}function e1i(a){let i=[];return a.ctrlKey&&i.push("ctrl"),a.shiftKey&&i.push("shift"),a.altKey&&i.push("alt"),a.metaKey&&i.push("meta"),`modifiers: [${i.join(",")}], code: ${a.code}, keyCode: ${a.keyCode} ('${vp.toString(a.keyCode)}')`}function spt(a){return a.ctrlKey||a.shiftKey||a.altKey||a.metaKey}var Ii=class{constructor(i){this._standardKeyboardEventBrand=!0;let e=i;this.browserEvent=e,this.target=e.target,this.ctrlKey=e.ctrlKey,this.shiftKey=e.shiftKey,this.altKey=e.altKey,this.metaKey=e.metaKey,this.altGraphKey=e.getModifierState?.("AltGraph"),this.keyCode=iLo(e),this.code=e.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(i){return this._asKeybinding===i}_computeKeybinding(){let i=0;tN(this.keyCode)||(i=this.keyCode);let e=0;return this.ctrlKey&&(e|=oLo),this.altKey&&(e|=nLo),this.shiftKey&&(e|=rLo),this.metaKey&&(e|=sLo),e|=i,e}_computeKeyCodeChord(){let i=0;return tN(this.keyCode)||(i=this.keyCode),new Hb(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,i)}};var t1i=new WeakMap;function aLo(a){if(!a.parent||a.parent===a)return null;try{let i=a.location,e=a.parent.location;if(i.origin!=="null"&&e.origin!=="null"&&i.origin!==e.origin)return null}catch{return null}return a.parent}var apt=class{static getSameOriginWindowChain(i){let e=t1i.get(i);if(!e){e=[],t1i.set(i,e);let t=i,o;do o=aLo(t),o?e.push({window:new WeakRef(t),iframeElement:t.frameElement||null}):e.push({window:new WeakRef(t),iframeElement:null}),t=o;while(t)}return e.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(i,e){if(!e||i===e)return{top:0,left:0};let t=0,o=0,n=this.getSameOriginWindowChain(i);for(let r of n){let s=r.window.deref();if(t+=s?.scrollY??0,o+=s?.scrollX??0,s===e||!r.iframeElement)break;let l=r.iframeElement.getBoundingClientRect();t+=l.top,o+=l.left}return{top:t,left:o}}};async function lpt(a,i){if(!crypto.subtle)throw new Error("'crypto.subtle' is not available so webviews will not work. This is likely because the editor is not running in a secure context (https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts).");let e=JSON.stringify({parentOrigin:a,salt:i}),o=new TextEncoder().encode(e),n=await crypto.subtle.digest("sha-256",o);return lLo(n)}function lLo(a){let e=Array.from(new Uint8Array(a)).map(t=>t.toString(16).padStart(2,"0")).join("");return BigInt(`0x${e}`).toString(32).padStart(52,"0")}var yn=class{constructor(i,e){this.timestamp=Date.now(),this.browserEvent=e,this.leftButton=e.button===0,this.middleButton=e.button===1,this.rightButton=e.button===2,this.buttons=e.buttons,this.defaultPrevented=e.defaultPrevented,this.target=e.target,this.detail=e.detail||1,e.type==="dblclick"&&(this.detail=2),this.ctrlKey=e.ctrlKey,this.shiftKey=e.shiftKey,this.altKey=e.altKey,this.metaKey=e.metaKey,typeof e.pageX=="number"?(this.posx=e.pageX,this.posy=e.pageY):(this.posx=e.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=e.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let t=apt.getPositionOfChildWindowRelativeToAncestorWindow(i,e.view);this.posx-=t.left,this.posy-=t.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}};var MT=class{constructor(i,e=0,t=0){this.browserEvent=i||null,this.target=i?i.target||i.targetNode||i.srcElement:null,this.deltaY=t,this.deltaX=e;let o=!1;if(eU){let n=navigator.userAgent.match(/Chrome\/(\d+)/);o=(n?parseInt(n[1]):123)<=122}if(i){let n=i,r=i,s=i.view?.devicePixelRatio||1;if(typeof n.wheelDeltaY<"u")o?this.deltaY=n.wheelDeltaY/(120*s):this.deltaY=n.wheelDeltaY/120;else if(typeof r.VERTICAL_AXIS<"u"&&r.axis===r.VERTICAL_AXIS)this.deltaY=-r.detail/3;else if(i.type==="wheel"){let l=i;l.deltaMode===l.DOM_DELTA_LINE?yc&&!it?this.deltaY=-i.deltaY/3:this.deltaY=-i.deltaY:this.deltaY=-i.deltaY/40}if(typeof n.wheelDeltaX<"u")Vb&&ri?this.deltaX=-(n.wheelDeltaX/120):o?this.deltaX=n.wheelDeltaX/(120*s):this.deltaX=n.wheelDeltaX/120;else if(typeof r.HORIZONTAL_AXIS<"u"&&r.axis===r.HORIZONTAL_AXIS)this.deltaX=-i.detail/3;else if(i.type==="wheel"){let l=i;l.deltaMode===l.DOM_DELTA_LINE?yc&&!it?this.deltaX=-i.deltaX/3:this.deltaX=-i.deltaX:this.deltaX=-i.deltaX/40}this.deltaY===0&&this.deltaX===0&&i.wheelDelta&&(o?this.deltaY=i.wheelDelta/(120*s):this.deltaY=i.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}};var i1i=Object.freeze(function(a,i){let e=setTimeout(a.bind(i),0);return{dispose(){clearTimeout(e)}}}),ve;(t=>{function a(o){return o===t.None||o===t.Cancelled||o instanceof wbe?!0:!o||typeof o!="object"?!1:typeof o.isCancellationRequested=="boolean"&&typeof o.onCancellationRequested=="function"}t.isCancellationToken=a,t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:H.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:i1i})})(ve||={});var wbe=class{constructor(){this._isCancelled=!1;this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?i1i:(this._emitter||(this._emitter=new E),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},$e=class{constructor(i){this._token=void 0;this._parentListener=void 0;this._parentListener=i&&i.onCancellationRequested(this.cancel,this)}get token(){return this._token||(this._token=new wbe),this._token}cancel(){this._token?this._token instanceof wbe&&this._token.cancel():this._token=ve.Cancelled}dispose(i=!1){i&&this.cancel(),this._parentListener?.dispose(),this._token?this._token instanceof wbe&&this._token.dispose():this._token=ve.None}};function u6(a){let i=new $e;return a.add({dispose(){i.cancel()}}),i.token}var cpt=class{constructor(){this._source=new $e;this._listeners=new P;this._total=0;this._cancelled=0;this._isDone=!1}get token(){return this._source.token}add(i){if(this._isDone)return;if(this._total++,i.isCancellationRequested){this._cancelled++,this._check();return}let e=i.onCancellationRequested(()=>{e.dispose(),this._cancelled++,this._check()});this._listeners.add(e)}_check(){!this._isDone&&this._total>0&&this._total===this._cancelled&&(this._isDone=!0,this._listeners.dispose(),this._source.cancel())}dispose(){this._listeners.dispose(),this._source.dispose()}};var cLo=65,dLo=97,uLo=90,pLo=122,bre=46,Bw=47,GD=92,a$=58,mLo=63,dpt=class extends Error{constructor(i,e,t){let o;typeof e=="string"&&e.indexOf("not ")===0?(o="must not be",e=e.replace(/^not /,"")):o="must be";let n=i.indexOf(".")!==-1?"property":"argument",r=`The "${i}" ${n} ${o} of type ${e}`;r+=`. Received type ${typeof t}`,super(r),this.code="ERR_INVALID_ARG_TYPE"}};function hLo(a,i){if(a===null||typeof a!="object")throw new dpt(i,"Object",a)}function Ub(a,i){if(typeof a!="string")throw new dpt(i,"string",a)}var $D=ZA==="win32";function Oc(a){return a===Bw||a===GD}function e9t(a){return a===Bw}function l$(a){return a>=cLo&&a<=uLo||a>=dLo&&a<=pLo}function upt(a,i,e,t){let o="",n=0,r=-1,s=0,l=0;for(let c=0;c<=a.length;++c){if(c<a.length)l=a.charCodeAt(c);else{if(t(l))break;l=Bw}if(t(l)){if(!(r===c-1||s===1))if(s===2){if(o.length<2||n!==2||o.charCodeAt(o.length-1)!==bre||o.charCodeAt(o.length-2)!==bre){if(o.length>2){let u=o.lastIndexOf(e);u===-1?(o="",n=0):(o=o.slice(0,u),n=o.length-1-o.lastIndexOf(e)),r=c,s=0;continue}else if(o.length!==0){o="",n=0,r=c,s=0;continue}}i&&(o+=o.length>0?`${e}..`:"..",n=2)}else o.length>0?o+=`${e}${a.slice(r+1,c)}`:o=a.slice(r+1,c),n=c-r-1;r=c,s=0}else l===bre&&s!==-1?++s:s=-1}return o}function gLo(a){return a?`${a[0]==="."?"":"."}${a}`:""}function o1i(a,i){hLo(i,"pathObject");let e=i.dir||i.root,t=i.base||`${i.name||""}${gLo(i.ext)}`;return e?e===i.root?`${e}${t}`:`${e}${a}${t}`:t}var Ms={resolve(...a){let i="",e="",t=!1;for(let o=a.length-1;o>=-1;o--){let n;if(o>=0){if(n=a[o],Ub(n,`paths[${o}]`),n.length===0)continue}else i.length===0?n=fre():(n=fp[`=${i}`]||fre(),(n===void 0||n.slice(0,2).toLowerCase()!==i.toLowerCase()&&n.charCodeAt(2)===GD)&&(n=`${i}\\`));let r=n.length,s=0,l="",c=!1,u=n.charCodeAt(0);if(r===1)Oc(u)&&(s=1,c=!0);else if(Oc(u))if(c=!0,Oc(n.charCodeAt(1))){let p=2,h=p;for(;p<r&&!Oc(n.charCodeAt(p));)p++;if(p<r&&p!==h){let g=n.slice(h,p);for(h=p;p<r&&Oc(n.charCodeAt(p));)p++;if(p<r&&p!==h){for(h=p;p<r&&!Oc(n.charCodeAt(p));)p++;(p===r||p!==h)&&(l=`\\\\${g}\\${n.slice(h,p)}`,s=p)}}}else s=1;else l$(u)&&n.charCodeAt(1)===a$&&(l=n.slice(0,2),s=2,r>2&&Oc(n.charCodeAt(2))&&(c=!0,s=3));if(l.length>0)if(i.length>0){if(l.toLowerCase()!==i.toLowerCase())continue}else i=l;if(t){if(i.length>0)break}else if(e=`${n.slice(s)}\\${e}`,t=c,c&&i.length>0)break}return e=upt(e,!t,"\\",Oc),t?`${i}\\${e}`:`${i}${e}`||"."},normalize(a){Ub(a,"path");let i=a.length;if(i===0)return".";let e=0,t,o=!1,n=a.charCodeAt(0);if(i===1)return e9t(n)?"\\":a;if(Oc(n))if(o=!0,Oc(a.charCodeAt(1))){let s=2,l=s;for(;s<i&&!Oc(a.charCodeAt(s));)s++;if(s<i&&s!==l){let c=a.slice(l,s);for(l=s;s<i&&Oc(a.charCodeAt(s));)s++;if(s<i&&s!==l){for(l=s;s<i&&!Oc(a.charCodeAt(s));)s++;if(s===i)return`\\\\${c}\\${a.slice(l)}\\`;s!==l&&(t=`\\\\${c}\\${a.slice(l,s)}`,e=s)}}}else e=1;else l$(n)&&a.charCodeAt(1)===a$&&(t=a.slice(0,2),e=2,i>2&&Oc(a.charCodeAt(2))&&(o=!0,e=3));let r=e<i?upt(a.slice(e),!o,"\\",Oc):"";if(r.length===0&&!o&&(r="."),r.length>0&&Oc(a.charCodeAt(i-1))&&(r+="\\"),!o&&t===void 0&&a.includes(":")){if(r.length>=2&&l$(r.charCodeAt(0))&&r.charCodeAt(1)===a$)return`.\\${r}`;let s=a.indexOf(":");do if(s===i-1||Oc(a.charCodeAt(s+1)))return`.\\${r}`;while((s=a.indexOf(":",s+1))!==-1)}return t===void 0?o?`\\${r}`:r:o?`${t}\\${r}`:`${t}${r}`},isAbsolute(a){Ub(a,"path");let i=a.length;if(i===0)return!1;let e=a.charCodeAt(0);return Oc(e)||i>2&&l$(e)&&a.charCodeAt(1)===a$&&Oc(a.charCodeAt(2))},join(...a){if(a.length===0)return".";let i,e;for(let n=0;n<a.length;++n){let r=a[n];Ub(r,"path"),r.length>0&&(i===void 0?i=e=r:i+=`\\${r}`)}if(i===void 0)return".";let t=!0,o=0;if(typeof e=="string"&&Oc(e.charCodeAt(0))){++o;let n=e.length;n>1&&Oc(e.charCodeAt(1))&&(++o,n>2&&(Oc(e.charCodeAt(2))?++o:t=!1))}if(t){for(;o<i.length&&Oc(i.charCodeAt(o));)o++;o>=2&&(i=`\\${i.slice(o)}`)}return Ms.normalize(i)},relative(a,i){if(Ub(a,"from"),Ub(i,"to"),a===i)return"";let e=Ms.resolve(a),t=Ms.resolve(i);if(e===t||(a=e.toLowerCase(),i=t.toLowerCase(),a===i))return"";if(e.length!==a.length||t.length!==i.length){let f=e.split("\\"),v=t.split("\\");f[f.length-1]===""&&f.pop(),v[v.length-1]===""&&v.pop();let b=f.length,S=v.length,y=b<S?b:S,w;for(w=0;w<y&&f[w].toLowerCase()===v[w].toLowerCase();w++);return w===0?t:w===y?S>y?v.slice(w).join("\\"):b>y?"..\\".repeat(b-1-w)+"..":"":"..\\".repeat(b-w)+v.slice(w).join("\\")}let o=0;for(;o<a.length&&a.charCodeAt(o)===GD;)o++;let n=a.length;for(;n-1>o&&a.charCodeAt(n-1)===GD;)n--;let r=n-o,s=0;for(;s<i.length&&i.charCodeAt(s)===GD;)s++;let l=i.length;for(;l-1>s&&i.charCodeAt(l-1)===GD;)l--;let c=l-s,u=r<c?r:c,p=-1,h=0;for(;h<u;h++){let f=a.charCodeAt(o+h);if(f!==i.charCodeAt(s+h))break;f===GD&&(p=h)}if(h!==u){if(p===-1)return t}else{if(c>u){if(i.charCodeAt(s+h)===GD)return t.slice(s+h+1);if(h===2)return t.slice(s+h)}r>u&&(a.charCodeAt(o+h)===GD?p=h:h===2&&(p=3)),p===-1&&(p=0)}let g="";for(h=o+p+1;h<=n;++h)(h===n||a.charCodeAt(h)===GD)&&(g+=g.length===0?"..":"\\..");return s+=p,g.length>0?`${g}${t.slice(s,l)}`:(t.charCodeAt(s)===GD&&++s,t.slice(s,l))},toNamespacedPath(a){if(typeof a!="string"||a.length===0)return a;let i=Ms.resolve(a);if(i.length<=2)return a;if(i.charCodeAt(0)===GD){if(i.charCodeAt(1)===GD){let e=i.charCodeAt(2);if(e!==mLo&&e!==bre)return`\\\\?\\UNC\\${i.slice(2)}`}}else if(l$(i.charCodeAt(0))&&i.charCodeAt(1)===a$&&i.charCodeAt(2)===GD)return`\\\\?\\${i}`;return i},dirname(a){Ub(a,"path");let i=a.length;if(i===0)return".";let e=-1,t=0,o=a.charCodeAt(0);if(i===1)return Oc(o)?a:".";if(Oc(o)){if(e=t=1,Oc(a.charCodeAt(1))){let s=2,l=s;for(;s<i&&!Oc(a.charCodeAt(s));)s++;if(s<i&&s!==l){for(l=s;s<i&&Oc(a.charCodeAt(s));)s++;if(s<i&&s!==l){for(l=s;s<i&&!Oc(a.charCodeAt(s));)s++;if(s===i)return a;s!==l&&(e=t=s+1)}}}}else l$(o)&&a.charCodeAt(1)===a$&&(e=i>2&&Oc(a.charCodeAt(2))?3:2,t=e);let n=-1,r=!0;for(let s=i-1;s>=t;--s)if(Oc(a.charCodeAt(s))){if(!r){n=s;break}}else r=!1;if(n===-1){if(e===-1)return".";n=e}return a.slice(0,n)},basename(a,i){i!==void 0&&Ub(i,"suffix"),Ub(a,"path");let e=0,t=-1,o=!0,n;if(a.length>=2&&l$(a.charCodeAt(0))&&a.charCodeAt(1)===a$&&(e=2),i!==void 0&&i.length>0&&i.length<=a.length){if(i===a)return"";let r=i.length-1,s=-1;for(n=a.length-1;n>=e;--n){let l=a.charCodeAt(n);if(Oc(l)){if(!o){e=n+1;break}}else s===-1&&(o=!1,s=n+1),r>=0&&(l===i.charCodeAt(r)?--r===-1&&(t=n):(r=-1,t=s))}return e===t?t=s:t===-1&&(t=a.length),a.slice(e,t)}for(n=a.length-1;n>=e;--n)if(Oc(a.charCodeAt(n))){if(!o){e=n+1;break}}else t===-1&&(o=!1,t=n+1);return t===-1?"":a.slice(e,t)},extname(a){Ub(a,"path");let i=0,e=-1,t=0,o=-1,n=!0,r=0;a.length>=2&&a.charCodeAt(1)===a$&&l$(a.charCodeAt(0))&&(i=t=2);for(let s=a.length-1;s>=i;--s){let l=a.charCodeAt(s);if(Oc(l)){if(!n){t=s+1;break}continue}o===-1&&(n=!1,o=s+1),l===bre?e===-1?e=s:r!==1&&(r=1):e!==-1&&(r=-1)}return e===-1||o===-1||r===0||r===1&&e===o-1&&e===t+1?"":a.slice(e,o)},format:o1i.bind(null,"\\"),parse(a){Ub(a,"path");let i={root:"",dir:"",base:"",ext:"",name:""};if(a.length===0)return i;let e=a.length,t=0,o=a.charCodeAt(0);if(e===1)return Oc(o)?(i.root=i.dir=a,i):(i.base=i.name=a,i);if(Oc(o)){if(t=1,Oc(a.charCodeAt(1))){let p=2,h=p;for(;p<e&&!Oc(a.charCodeAt(p));)p++;if(p<e&&p!==h){for(h=p;p<e&&Oc(a.charCodeAt(p));)p++;if(p<e&&p!==h){for(h=p;p<e&&!Oc(a.charCodeAt(p));)p++;p===e?t=p:p!==h&&(t=p+1)}}}}else if(l$(o)&&a.charCodeAt(1)===a$){if(e<=2)return i.root=i.dir=a,i;if(t=2,Oc(a.charCodeAt(2))){if(e===3)return i.root=i.dir=a,i;t=3}}t>0&&(i.root=a.slice(0,t));let n=-1,r=t,s=-1,l=!0,c=a.length-1,u=0;for(;c>=t;--c){if(o=a.charCodeAt(c),Oc(o)){if(!l){r=c+1;break}continue}s===-1&&(l=!1,s=c+1),o===bre?n===-1?n=c:u!==1&&(u=1):n!==-1&&(u=-1)}return s!==-1&&(n===-1||u===0||u===1&&n===s-1&&n===r+1?i.base=i.name=a.slice(r,s):(i.name=a.slice(r,n),i.base=a.slice(r,s),i.ext=a.slice(n,s))),r>0&&r!==t?i.dir=a.slice(0,r-1):i.dir=i.root,i},sep:"\\",delimiter:";",win32:null,posix:null},fLo=(()=>{if($D){let a=/\\/g;return()=>{let i=fre().replace(a,"/");return i.slice(i.indexOf("/"))}}return()=>fre()})(),Lo={resolve(...a){let i="",e=!1;for(let t=a.length-1;t>=0&&!e;t--){let o=a[t];Ub(o,`paths[${t}]`),o.length!==0&&(i=`${o}/${i}`,e=o.charCodeAt(0)===Bw)}if(!e){let t=fLo();i=`${t}/${i}`,e=t.charCodeAt(0)===Bw}return i=upt(i,!e,"/",e9t),e?`/${i}`:i.length>0?i:"."},normalize(a){if(Ub(a,"path"),a.length===0)return".";let i=a.charCodeAt(0)===Bw,e=a.charCodeAt(a.length-1)===Bw;return a=upt(a,!i,"/",e9t),a.length===0?i?"/":e?"./":".":(e&&(a+="/"),i?`/${a}`:a)},isAbsolute(a){return Ub(a,"path"),a.length>0&&a.charCodeAt(0)===Bw},join(...a){if(a.length===0)return".";let i=[];for(let e=0;e<a.length;++e){let t=a[e];Ub(t,"path"),t.length>0&&i.push(t)}return i.length===0?".":Lo.normalize(i.join("/"))},relative(a,i){if(Ub(a,"from"),Ub(i,"to"),a===i||(a=Lo.resolve(a),i=Lo.resolve(i),a===i))return"";let e=1,t=a.length,o=t-e,n=1,r=i.length-n,s=o<r?o:r,l=-1,c=0;for(;c<s;c++){let p=a.charCodeAt(e+c);if(p!==i.charCodeAt(n+c))break;p===Bw&&(l=c)}if(c===s)if(r>s){if(i.charCodeAt(n+c)===Bw)return i.slice(n+c+1);if(c===0)return i.slice(n+c)}else o>s&&(a.charCodeAt(e+c)===Bw?l=c:c===0&&(l=0));let u="";for(c=e+l+1;c<=t;++c)(c===t||a.charCodeAt(c)===Bw)&&(u+=u.length===0?"..":"/..");return`${u}${i.slice(n+l)}`},toNamespacedPath(a){return a},dirname(a){if(Ub(a,"path"),a.length===0)return".";let i=a.charCodeAt(0)===Bw,e=-1,t=!0;for(let o=a.length-1;o>=1;--o)if(a.charCodeAt(o)===Bw){if(!t){e=o;break}}else t=!1;return e===-1?i?"/":".":i&&e===1?"//":a.slice(0,e)},basename(a,i){i!==void 0&&Ub(i,"suffix"),Ub(a,"path");let e=0,t=-1,o=!0,n;if(i!==void 0&&i.length>0&&i.length<=a.length){if(i===a)return"";let r=i.length-1,s=-1;for(n=a.length-1;n>=0;--n){let l=a.charCodeAt(n);if(l===Bw){if(!o){e=n+1;break}}else s===-1&&(o=!1,s=n+1),r>=0&&(l===i.charCodeAt(r)?--r===-1&&(t=n):(r=-1,t=s))}return e===t?t=s:t===-1&&(t=a.length),a.slice(e,t)}for(n=a.length-1;n>=0;--n)if(a.charCodeAt(n)===Bw){if(!o){e=n+1;break}}else t===-1&&(o=!1,t=n+1);return t===-1?"":a.slice(e,t)},extname(a){Ub(a,"path");let i=-1,e=0,t=-1,o=!0,n=0;for(let r=a.length-1;r>=0;--r){let s=a[r];if(s==="/"){if(!o){e=r+1;break}continue}t===-1&&(o=!1,t=r+1),s==="."?i===-1?i=r:n!==1&&(n=1):i!==-1&&(n=-1)}return i===-1||t===-1||n===0||n===1&&i===t-1&&i===e+1?"":a.slice(i,t)},format:o1i.bind(null,"/"),parse(a){Ub(a,"path");let i={root:"",dir:"",base:"",ext:"",name:""};if(a.length===0)return i;let e=a.charCodeAt(0)===Bw,t;e?(i.root="/",t=1):t=0;let o=-1,n=0,r=-1,s=!0,l=a.length-1,c=0;for(;l>=t;--l){let u=a.charCodeAt(l);if(u===Bw){if(!s){n=l+1;break}continue}r===-1&&(s=!1,r=l+1),u===bre?o===-1?o=l:c!==1&&(c=1):o!==-1&&(c=-1)}if(r!==-1){let u=n===0&&e?1:n;o===-1||c===0||c===1&&o===r-1&&o===n+1?i.base=i.name=a.slice(u,r):(i.name=a.slice(u,o),i.base=a.slice(u,r),i.ext=a.slice(o,r))}return n>0?i.dir=a.slice(0,n-1):e&&(i.dir="/"),i},sep:"/",delimiter:":",win32:null,posix:null};Lo.win32=Ms.win32=Ms;Lo.posix=Ms.posix=Lo;var th=$D?Ms.normalize:Lo.normalize,Xl=$D?Ms.isAbsolute:Lo.isAbsolute,Ld=$D?Ms.join:Lo.join,iN=$D?Ms.resolve:Lo.resolve,SM=$D?Ms.relative:Lo.relative,wc=$D?Ms.dirname:Lo.dirname,No=$D?Ms.basename:Lo.basename,Am=$D?Ms.extname:Lo.extname,pfn=$D?Ms.format:Lo.format,c$=$D?Ms.parse:Lo.parse,mfn=$D?Ms.toNamespacedPath:Lo.toNamespacedPath,Rd=$D?Ms.sep:Lo.sep,hfn=$D?Ms.delimiter:Lo.delimiter;var z0=class{constructor(i){this.task=i;this.result=null}get(){if(this.result)return this.result;let i=new $e,e=this.task(i.token);return this.result={promise:e,dispose:()=>{this.result=null,i.cancel(),i.dispose()}},this.result}};function t9t(a){return a}var Cbe=class{constructor(i,e){this.lastCache=void 0;this.lastArgKey=void 0;typeof i=="function"?(this._fn=i,this._computeKey=t9t):(this._fn=e,this._computeKey=i.getCacheKey)}get(i){let e=this._computeKey(i);return this.lastArgKey!==e&&(this.lastArgKey=e,this.lastCache=this._fn(i)),this.lastCache}},kI=class{constructor(i,e){this._map=new Map;this._map2=new Map;typeof i=="function"?(this._fn=i,this._computeKey=t9t):(this._fn=e,this._computeKey=i.getCacheKey)}get cachedValues(){return this._map}get(i){let e=this._computeKey(i);if(this._map2.has(e))return this._map2.get(e);let t=this._fn(i);return this._map.set(i,t),this._map2.set(e,t),t}},ppt=class{constructor(i,e){this._map=new WeakMap;typeof i=="function"?(this._fn=i,this._computeKey=t9t):(this._fn=e,this._computeKey=i.getCacheKey)}get(i){let e=this._computeKey(i);if(this._map.has(e))return this._map.get(e);let t=this._fn(i);return this._map.set(e,t),t}};var co=class{constructor(i){this.executor=i;this._state=0}get hasValue(){return this._state===2}get value(){if(this._state===0){this._state=1;try{this._value=this.executor()}catch(i){this._error=i}finally{this._state=2}}else if(this._state===1)throw new Error("Cannot read the value of a lazy that is being initialized");if(this._error)throw this._error;return this._value}get rawValue(){return this._value}};function Sre(a){return a<0?0:a>255?255:a|0}function Ire(a){return a<0?0:a>4294967295?4294967295:a|0}function Jl(a){return!a||typeof a!="string"?!0:a.trim().length===0}var vLo=/{(\d+)}/g;function id(a,...i){return i.length===0?a:a.replace(vLo,function(e,t){let o=parseInt(t,10);return isNaN(o)||o<0||o>=i.length?e:i[o]})}var bLo=/{([^}]+)}/g;function PT(a,i){return Object.keys(i).length===0?a:a.replace(bLo,(e,t)=>i[t]??e)}function hpt(a){return a.replace(/[<>"'&]/g,i=>{switch(i){case"<":return"<";case">":return">";case'"':return""";case"'":return"'";case"&":return"&"}return i})}function ur(a){return a.replace(/[<>&]/g,function(i){switch(i){case"<":return"<";case">":return">";case"&":return"&";default:return i}})}function Yr(a){return a.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function IM(a,i){let e=0,t=a.indexOf(i);for(;t!==-1;)e++,t=a.indexOf(i,t+i.length);return e}function oN(a,i,e=f1i){return a.length<=i?a:`${a.substr(0,i)}${e}`}function o9t(a,i,e=f1i){if(a.length<=i)return a;let t=Math.ceil(i/2)-e.length/2,o=Math.floor(i/2)-e.length/2;return`${a.substr(0,t)}${e}${a.substr(a.length-o)}`}function qD(a,i=" "){let e=Hw(a,i);return ih(e,i)}function Hw(a,i){if(!a||!i)return a;let e=i.length,t=0;if(e===1){let o=i.charCodeAt(0);for(;t<a.length&&a.charCodeAt(t)===o;)t++}else for(;a.startsWith(i,t);)t+=e;return a.substring(t)}function ih(a,i){if(!a||!i)return a;let e=i.length,t=a.length;if(e===1){let n=t,r=i.charCodeAt(0);for(;n>0&&a.charCodeAt(n-1)===r;)n--;return a.substring(0,n)}let o=t;for(;o>0&&a.endsWith(i,o);)o-=e;return a.substring(0,o)}function r1i(a){return a.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function u$(a,i,e={}){if(!a)throw new Error("Cannot create regex from empty string");i||(a=Yr(a)),e.wholeWord&&(/\B/.test(a.charAt(0))||(a="\\b"+a),/\B/.test(a.charAt(a.length-1))||(a=a+"\\b"));let t="";return e.global&&(t+="g"),e.matchCase||(t+="i"),e.multiline&&(t+="m"),e.unicode&&(t+="u"),new RegExp(a,t)}function xbe(a){return a.source==="^"||a.source==="^$"||a.source==="$"||a.source==="^\\s*$"?!1:!!(a.exec("")&&a.lastIndex===0)}function s1i(a,i){return a.filter(e=>e!=null&&e!==!1).join(i)}function mc(a){return a.split(/\r\n|\r|\n/)}function a1i(a){let i=[],e=a.split(/(\r\n|\r|\n)/);for(let t=0;t<Math.ceil(e.length/2);t++)i.push(e[2*t]+(e[2*t+1]??""));return i}function Ap(a){for(let i=0,e=a.length;i<e;i++){let t=a.charCodeAt(i);if(t!==32&&t!==9)return i}return-1}function bl(a,i=0,e=a.length){for(let t=i;t<e;t++){let o=a.charCodeAt(t);if(o!==32&&o!==9)return a.substring(i,t)}return a.substring(i,e)}function tv(a,i=a.length-1){for(let e=i;e>=0;e--){let t=a.charCodeAt(e);if(t!==32&&t!==9)return e}return-1}function Al(a,i){return a<i?-1:a>i?1:0}function kbe(a,i,e=0,t=a.length,o=0,n=i.length){for(;e<t&&o<n;e++,o++){let l=a.charCodeAt(e),c=i.charCodeAt(o);if(l<c)return-1;if(l>c)return 1}let r=t-e,s=n-o;return r<s?-1:r>s?1:0}function Uw(a,i){return wre(a,i,0,a.length,0,i.length)}function wre(a,i,e=0,t=a.length,o=0,n=i.length){for(;e<t&&o<n;e++,o++){let l=a.charCodeAt(e),c=i.charCodeAt(o);if(l===c)continue;if(l>=128||c>=128)return kbe(a.toLowerCase(),i.toLowerCase(),e,t,o,n);iU(l)&&(l-=32),iU(c)&&(c-=32);let u=l-c;if(u!==0)return u}let r=t-e,s=n-o;return r<s?-1:r>s?1:0}function pGe(a){return a>=48&&a<=57}function iU(a){return a>=97&&a<=122}function Hk(a){return a>=65&&a<=90}function mr(a,i){return a.length===i.length&&wre(a,i)===0}function l1i(a,i,e){return a===i||!!e&&a!==void 0&&i!==void 0&&mr(a,i)}function Uk(a,i){let e=i.length;return e<=a.length&&wre(a,i,0,e)===0}function gpt(a,i){let e=a.length,t=e-i.length;return t>=0&&wre(a,i,t,e)===0}function Ng(a,i){let e=Math.min(a.length,i.length),t;for(t=0;t<e;t++)if(a.charCodeAt(t)!==i.charCodeAt(t))return t;return e}function zw(a,i){let e=Math.min(a.length,i.length),t,o=a.length-1,n=i.length-1;for(t=0;t<e;t++)if(a.charCodeAt(o-t)!==i.charCodeAt(n-t))return t;return e}function Ru(a){return 55296<=a&&a<=56319}function nN(a){return 56320<=a&&a<=57343}function fpt(a,i){return(a-55296<<10)+(i-56320)+65536}function Ebe(a,i,e){let t=a.charCodeAt(e);if(Ru(t)&&e+1<i){let o=a.charCodeAt(e+1);if(nN(o))return fpt(t,o)}return t}function SLo(a,i){let e=a.charCodeAt(i-1);if(nN(e)&&i>1){let t=a.charCodeAt(i-2);if(Ru(t))return fpt(t,e)}return e}var yre=class{get offset(){return this._offset}constructor(i,e=0){this._str=i,this._len=i.length,this._offset=e}setOffset(i){this._offset=i}prevCodePoint(){let i=SLo(this._str,this._offset);return this._offset-=i>=65536?2:1,i}nextCodePoint(){let i=Ebe(this._str,this._len,this._offset);return this._offset+=i>=65536?2:1,i}eol(){return this._offset>=this._len}},d$=class{get offset(){return this._iterator.offset}constructor(i,e=0){this._iterator=new yre(i,e)}nextGraphemeLength(){let i=mpt.getInstance(),e=this._iterator,t=e.offset,o=i.getGraphemeBreakType(e.nextCodePoint());for(;!e.eol();){let n=e.offset,r=i.getGraphemeBreakType(e.nextCodePoint());if(n1i(o,r)){e.setOffset(n);break}o=r}return e.offset-t}prevGraphemeLength(){let i=mpt.getInstance(),e=this._iterator,t=e.offset,o=i.getGraphemeBreakType(e.prevCodePoint());for(;e.offset>0;){let n=e.offset,r=i.getGraphemeBreakType(e.prevCodePoint());if(n1i(r,o)){e.setOffset(n);break}o=r}return t-e.offset}eol(){return this._iterator.eol()}};function Tbe(a,i){return new d$(a,i).nextGraphemeLength()}function n9t(a,i){return new d$(a,i).prevGraphemeLength()}function vpt(a,i){i>0&&nN(a.charCodeAt(i))&&i--;let e=i+Tbe(a,i);return[e-n9t(a,e),e]}var i9t;function ILo(){return/(?:[\u05BE\u05C0\u05C3\u05C6\u05D0-\u05F4\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u0710\u0712-\u072F\u074D-\u07A5\u07B1-\u07EA\u07F4\u07F5\u07FA\u07FE-\u0815\u081A\u0824\u0828\u0830-\u0858\u085E-\u088E\u08A0-\u08C9\u200F\uFB1D\uFB1F-\uFB28\uFB2A-\uFD3D\uFD50-\uFDC7\uFDF0-\uFDFC\uFE70-\uFEFC]|\uD802[\uDC00-\uDD1B\uDD20-\uDE00\uDE10-\uDE35\uDE40-\uDEE4\uDEEB-\uDF35\uDF40-\uDFFF]|\uD803[\uDC00-\uDD23\uDE80-\uDEA9\uDEAD-\uDF45\uDF51-\uDF81\uDF86-\uDFF6]|\uD83A[\uDC00-\uDCCF\uDD00-\uDD43\uDD4B-\uDFFF]|\uD83B[\uDC00-\uDEBB])/}function yM(a){return i9t||(i9t=ILo()),i9t.test(a)}var yLo=/^[\t\n\r\x20-\x7E]*$/;function oU(a){return yLo.test(a)}var r9t=/[\u2028\u2029]/;function bpt(a){return r9t.test(a)}function AT(a){return a>=11904&&a<=55215||a>=63744&&a<=64255||a>=65281&&a<=65374||a>=65504&&a<=65510}function mGe(a){return a>=127462&&a<=127487||a===8986||a===8987||a===9200||a===9203||a>=9728&&a<=10175||a===11088||a===11093||a>=127744&&a<=128591||a>=128640&&a<=128764||a>=128992&&a<=129008||a>=129280&&a<=129535||a>=129648&&a<=129782}function c1i(a,i,e=""){let t=a.trimStart();if(t.length<i)return t;let o=/\b/g,n=0;for(;o.test(t)&&!(t.length-o.lastIndex<i);)n=o.lastIndex,o.lastIndex+=1;return n===0?t:e+t.substring(n).trimStart()}function s9t(a,i,e=""){let t=a.trimEnd();if(t.length<=i)return t;let o=/\b/g,n=0,r=!1;for(;o.test(t);){if(o.lastIndex>i){r=!0;break}n=o.lastIndex,o.lastIndex+=1}if(!r)return t;if(n===0)return e;let s=t.substring(0,n).trimEnd();return s.length<n/2?t:s+e}var wLo=/(?:\x1b\[|\x9b)[=?>!]?[\d;:]*["$#'* ]?[a-zA-Z@^`{}|~]/,CLo=/(?:\x1b\]|\x9d).*?(?:\x1b\\|\x07|\x9c)/,xLo=/\x1b(?:[ #%\(\)\*\+\-\.\/]?[a-zA-Z0-9\|}~@])/,d1i=new RegExp("(?:"+[wLo.source,CLo.source,xLo.source].join("|")+")","g");function*u1i(a){let i=0;for(let e of a.matchAll(d1i))i!==e.index&&(yield{isCode:!1,str:a.substring(i,e.index)}),yield{isCode:!0,str:e[0]},i=e.index+e[0].length;i!==a.length&&(yield{isCode:!1,str:a.substring(i)})}function CS(a){return a&&(a=a.replace(d1i,"")),a}var kLo=/\\\[.*?\\\]/g;function p1i(a){return CS(a).replace(kLo,"")}var m1i=String.fromCharCode(65279);function Spt(a){return!!(a&&a.length>0&&a.charCodeAt(0)===65279)}function hGe(a,i){if(!a||!i||a.length<i.length)return!1;let e=i.length,t=a.toLowerCase(),o=0,n=-1;for(;o<e;){let r=t.indexOf(i[o],n+1);if(r<0)return!1;n=r,o++}return!0}function gGe(a,i=!1){return a?(i&&(a=a.replace(/\\./g,"")),a.toLowerCase()!==a):!1}function Cre(a){return a.charAt(0).toUpperCase()+a.slice(1)}function h1i(a,i=1){if(i===0)return"";let e=-1;do e=a.indexOf(`
`,e+1),i--;while(i>0&&e>=0);return e===-1?a:(a[e-1]==="\r"&&e--,a.substr(0,e))}function _be(a){let i=26;return a=a%(2*i),a<i?String.fromCharCode(97+a):String.fromCharCode(65+a-i)}function n1i(a,i){return a===0?i!==5&&i!==7:a===2&&i===3?!1:a===4||a===2||a===3||i===4||i===2||i===3?!0:!(a===8&&(i===8||i===9||i===11||i===12)||(a===11||a===9)&&(i===9||i===10)||(a===12||a===10)&&i===10||i===5||i===13||i===7||a===1||a===13&&i===14||a===6&&i===6)}var mpt=class a{static{this._INSTANCE=null}static getInstance(){return a._INSTANCE||(a._INSTANCE=new a),a._INSTANCE}constructor(){this._data=ELo()}getGraphemeBreakType(i){if(i<32)return i===10?3:i===13?2:4;if(i<127)return 0;let e=this._data,t=e.length/3,o=1;for(;o<=t;)if(i<e[3*o])o=2*o;else if(i>e[3*o+1])o=2*o+1;else return e[3*o+2];return 0}};function ELo(){return JSON.parse("[0,0,0,51229,51255,12,44061,44087,12,127462,127487,6,7083,7085,5,47645,47671,12,54813,54839,12,128678,128678,14,3270,3270,5,9919,9923,14,45853,45879,12,49437,49463,12,53021,53047,12,71216,71218,7,128398,128399,14,129360,129374,14,2519,2519,5,4448,4519,9,9742,9742,14,12336,12336,14,44957,44983,12,46749,46775,12,48541,48567,12,50333,50359,12,52125,52151,12,53917,53943,12,69888,69890,5,73018,73018,5,127990,127990,14,128558,128559,14,128759,128760,14,129653,129655,14,2027,2035,5,2891,2892,7,3761,3761,5,6683,6683,5,8293,8293,4,9825,9826,14,9999,9999,14,43452,43453,5,44509,44535,12,45405,45431,12,46301,46327,12,47197,47223,12,48093,48119,12,48989,49015,12,49885,49911,12,50781,50807,12,51677,51703,12,52573,52599,12,53469,53495,12,54365,54391,12,65279,65279,4,70471,70472,7,72145,72147,7,119173,119179,5,127799,127818,14,128240,128244,14,128512,128512,14,128652,128652,14,128721,128722,14,129292,129292,14,129445,129450,14,129734,129743,14,1476,1477,5,2366,2368,7,2750,2752,7,3076,3076,5,3415,3415,5,4141,4144,5,6109,6109,5,6964,6964,5,7394,7400,5,9197,9198,14,9770,9770,14,9877,9877,14,9968,9969,14,10084,10084,14,43052,43052,5,43713,43713,5,44285,44311,12,44733,44759,12,45181,45207,12,45629,45655,12,46077,46103,12,46525,46551,12,46973,46999,12,47421,47447,12,47869,47895,12,48317,48343,12,48765,48791,12,49213,49239,12,49661,49687,12,50109,50135,12,50557,50583,12,51005,51031,12,51453,51479,12,51901,51927,12,52349,52375,12,52797,52823,12,53245,53271,12,53693,53719,12,54141,54167,12,54589,54615,12,55037,55063,12,69506,69509,5,70191,70193,5,70841,70841,7,71463,71467,5,72330,72342,5,94031,94031,5,123628,123631,5,127763,127765,14,127941,127941,14,128043,128062,14,128302,128317,14,128465,128467,14,128539,128539,14,128640,128640,14,128662,128662,14,128703,128703,14,128745,128745,14,129004,129007,14,129329,129330,14,129402,129402,14,129483,129483,14,129686,129704,14,130048,131069,14,173,173,4,1757,1757,1,2200,2207,5,2434,2435,7,2631,2632,5,2817,2817,5,3008,3008,5,3201,3201,5,3387,3388,5,3542,3542,5,3902,3903,7,4190,4192,5,6002,6003,5,6439,6440,5,6765,6770,7,7019,7027,5,7154,7155,7,8205,8205,13,8505,8505,14,9654,9654,14,9757,9757,14,9792,9792,14,9852,9853,14,9890,9894,14,9937,9937,14,9981,9981,14,10035,10036,14,11035,11036,14,42654,42655,5,43346,43347,7,43587,43587,5,44006,44007,7,44173,44199,12,44397,44423,12,44621,44647,12,44845,44871,12,45069,45095,12,45293,45319,12,45517,45543,12,45741,45767,12,45965,45991,12,46189,46215,12,46413,46439,12,46637,46663,12,46861,46887,12,47085,47111,12,47309,47335,12,47533,47559,12,47757,47783,12,47981,48007,12,48205,48231,12,48429,48455,12,48653,48679,12,48877,48903,12,49101,49127,12,49325,49351,12,49549,49575,12,49773,49799,12,49997,50023,12,50221,50247,12,50445,50471,12,50669,50695,12,50893,50919,12,51117,51143,12,51341,51367,12,51565,51591,12,51789,51815,12,52013,52039,12,52237,52263,12,52461,52487,12,52685,52711,12,52909,52935,12,53133,53159,12,53357,53383,12,53581,53607,12,53805,53831,12,54029,54055,12,54253,54279,12,54477,54503,12,54701,54727,12,54925,54951,12,55149,55175,12,68101,68102,5,69762,69762,7,70067,70069,7,70371,70378,5,70720,70721,7,71087,71087,5,71341,71341,5,71995,71996,5,72249,72249,7,72850,72871,5,73109,73109,5,118576,118598,5,121505,121519,5,127245,127247,14,127568,127569,14,127777,127777,14,127872,127891,14,127956,127967,14,128015,128016,14,128110,128172,14,128259,128259,14,128367,128368,14,128424,128424,14,128488,128488,14,128530,128532,14,128550,128551,14,128566,128566,14,128647,128647,14,128656,128656,14,128667,128673,14,128691,128693,14,128715,128715,14,128728,128732,14,128752,128752,14,128765,128767,14,129096,129103,14,129311,129311,14,129344,129349,14,129394,129394,14,129413,129425,14,129466,129471,14,129511,129535,14,129664,129666,14,129719,129722,14,129760,129767,14,917536,917631,5,13,13,2,1160,1161,5,1564,1564,4,1807,1807,1,2085,2087,5,2307,2307,7,2382,2383,7,2497,2500,5,2563,2563,7,2677,2677,5,2763,2764,7,2879,2879,5,2914,2915,5,3021,3021,5,3142,3144,5,3263,3263,5,3285,3286,5,3398,3400,7,3530,3530,5,3633,3633,5,3864,3865,5,3974,3975,5,4155,4156,7,4229,4230,5,5909,5909,7,6078,6085,7,6277,6278,5,6451,6456,7,6744,6750,5,6846,6846,5,6972,6972,5,7074,7077,5,7146,7148,7,7222,7223,5,7416,7417,5,8234,8238,4,8417,8417,5,9000,9000,14,9203,9203,14,9730,9731,14,9748,9749,14,9762,9763,14,9776,9783,14,9800,9811,14,9831,9831,14,9872,9873,14,9882,9882,14,9900,9903,14,9929,9933,14,9941,9960,14,9974,9974,14,9989,9989,14,10006,10006,14,10062,10062,14,10160,10160,14,11647,11647,5,12953,12953,14,43019,43019,5,43232,43249,5,43443,43443,5,43567,43568,7,43696,43696,5,43765,43765,7,44013,44013,5,44117,44143,12,44229,44255,12,44341,44367,12,44453,44479,12,44565,44591,12,44677,44703,12,44789,44815,12,44901,44927,12,45013,45039,12,45125,45151,12,45237,45263,12,45349,45375,12,45461,45487,12,45573,45599,12,45685,45711,12,45797,45823,12,45909,45935,12,46021,46047,12,46133,46159,12,46245,46271,12,46357,46383,12,46469,46495,12,46581,46607,12,46693,46719,12,46805,46831,12,46917,46943,12,47029,47055,12,47141,47167,12,47253,47279,12,47365,47391,12,47477,47503,12,47589,47615,12,47701,47727,12,47813,47839,12,47925,47951,12,48037,48063,12,48149,48175,12,48261,48287,12,48373,48399,12,48485,48511,12,48597,48623,12,48709,48735,12,48821,48847,12,48933,48959,12,49045,49071,12,49157,49183,12,49269,49295,12,49381,49407,12,49493,49519,12,49605,49631,12,49717,49743,12,49829,49855,12,49941,49967,12,50053,50079,12,50165,50191,12,50277,50303,12,50389,50415,12,50501,50527,12,50613,50639,12,50725,50751,12,50837,50863,12,50949,50975,12,51061,51087,12,51173,51199,12,51285,51311,12,51397,51423,12,51509,51535,12,51621,51647,12,51733,51759,12,51845,51871,12,51957,51983,12,52069,52095,12,52181,52207,12,52293,52319,12,52405,52431,12,52517,52543,12,52629,52655,12,52741,52767,12,52853,52879,12,52965,52991,12,53077,53103,12,53189,53215,12,53301,53327,12,53413,53439,12,53525,53551,12,53637,53663,12,53749,53775,12,53861,53887,12,53973,53999,12,54085,54111,12,54197,54223,12,54309,54335,12,54421,54447,12,54533,54559,12,54645,54671,12,54757,54783,12,54869,54895,12,54981,55007,12,55093,55119,12,55243,55291,10,66045,66045,5,68325,68326,5,69688,69702,5,69817,69818,5,69957,69958,7,70089,70092,5,70198,70199,5,70462,70462,5,70502,70508,5,70750,70750,5,70846,70846,7,71100,71101,5,71230,71230,7,71351,71351,5,71737,71738,5,72000,72000,7,72160,72160,5,72273,72278,5,72752,72758,5,72882,72883,5,73031,73031,5,73461,73462,7,94192,94193,7,119149,119149,7,121403,121452,5,122915,122916,5,126980,126980,14,127358,127359,14,127535,127535,14,127759,127759,14,127771,127771,14,127792,127793,14,127825,127867,14,127897,127899,14,127945,127945,14,127985,127986,14,128000,128007,14,128021,128021,14,128066,128100,14,128184,128235,14,128249,128252,14,128266,128276,14,128335,128335,14,128379,128390,14,128407,128419,14,128444,128444,14,128481,128481,14,128499,128499,14,128526,128526,14,128536,128536,14,128543,128543,14,128556,128556,14,128564,128564,14,128577,128580,14,128643,128645,14,128649,128649,14,128654,128654,14,128660,128660,14,128664,128664,14,128675,128675,14,128686,128689,14,128695,128696,14,128705,128709,14,128717,128719,14,128725,128725,14,128736,128741,14,128747,128748,14,128755,128755,14,128762,128762,14,128981,128991,14,129009,129023,14,129160,129167,14,129296,129304,14,129320,129327,14,129340,129342,14,129356,129356,14,129388,129392,14,129399,129400,14,129404,129407,14,129432,129442,14,129454,129455,14,129473,129474,14,129485,129487,14,129648,129651,14,129659,129660,14,129671,129679,14,129709,129711,14,129728,129730,14,129751,129753,14,129776,129782,14,917505,917505,4,917760,917999,5,10,10,3,127,159,4,768,879,5,1471,1471,5,1536,1541,1,1648,1648,5,1767,1768,5,1840,1866,5,2070,2073,5,2137,2139,5,2274,2274,1,2363,2363,7,2377,2380,7,2402,2403,5,2494,2494,5,2507,2508,7,2558,2558,5,2622,2624,7,2641,2641,5,2691,2691,7,2759,2760,5,2786,2787,5,2876,2876,5,2881,2884,5,2901,2902,5,3006,3006,5,3014,3016,7,3072,3072,5,3134,3136,5,3157,3158,5,3260,3260,5,3266,3266,5,3274,3275,7,3328,3329,5,3391,3392,7,3405,3405,5,3457,3457,5,3536,3537,7,3551,3551,5,3636,3642,5,3764,3772,5,3895,3895,5,3967,3967,7,3993,4028,5,4146,4151,5,4182,4183,7,4226,4226,5,4253,4253,5,4957,4959,5,5940,5940,7,6070,6070,7,6087,6088,7,6158,6158,4,6432,6434,5,6448,6449,7,6679,6680,5,6742,6742,5,6754,6754,5,6783,6783,5,6912,6915,5,6966,6970,5,6978,6978,5,7042,7042,7,7080,7081,5,7143,7143,7,7150,7150,7,7212,7219,5,7380,7392,5,7412,7412,5,8203,8203,4,8232,8232,4,8265,8265,14,8400,8412,5,8421,8432,5,8617,8618,14,9167,9167,14,9200,9200,14,9410,9410,14,9723,9726,14,9733,9733,14,9745,9745,14,9752,9752,14,9760,9760,14,9766,9766,14,9774,9774,14,9786,9786,14,9794,9794,14,9823,9823,14,9828,9828,14,9833,9850,14,9855,9855,14,9875,9875,14,9880,9880,14,9885,9887,14,9896,9897,14,9906,9916,14,9926,9927,14,9935,9935,14,9939,9939,14,9962,9962,14,9972,9972,14,9978,9978,14,9986,9986,14,9997,9997,14,10002,10002,14,10017,10017,14,10055,10055,14,10071,10071,14,10133,10135,14,10548,10549,14,11093,11093,14,12330,12333,5,12441,12442,5,42608,42610,5,43010,43010,5,43045,43046,5,43188,43203,7,43302,43309,5,43392,43394,5,43446,43449,5,43493,43493,5,43571,43572,7,43597,43597,7,43703,43704,5,43756,43757,5,44003,44004,7,44009,44010,7,44033,44059,12,44089,44115,12,44145,44171,12,44201,44227,12,44257,44283,12,44313,44339,12,44369,44395,12,44425,44451,12,44481,44507,12,44537,44563,12,44593,44619,12,44649,44675,12,44705,44731,12,44761,44787,12,44817,44843,12,44873,44899,12,44929,44955,12,44985,45011,12,45041,45067,12,45097,45123,12,45153,45179,12,45209,45235,12,45265,45291,12,45321,45347,12,45377,45403,12,45433,45459,12,45489,45515,12,45545,45571,12,45601,45627,12,45657,45683,12,45713,45739,12,45769,45795,12,45825,45851,12,45881,45907,12,45937,45963,12,45993,46019,12,46049,46075,12,46105,46131,12,46161,46187,12,46217,46243,12,46273,46299,12,46329,46355,12,46385,46411,12,46441,46467,12,46497,46523,12,46553,46579,12,46609,46635,12,46665,46691,12,46721,46747,12,46777,46803,12,46833,46859,12,46889,46915,12,46945,46971,12,47001,47027,12,47057,47083,12,47113,47139,12,47169,47195,12,47225,47251,12,47281,47307,12,47337,47363,12,47393,47419,12,47449,47475,12,47505,47531,12,47561,47587,12,47617,47643,12,47673,47699,12,47729,47755,12,47785,47811,12,47841,47867,12,47897,47923,12,47953,47979,12,48009,48035,12,48065,48091,12,48121,48147,12,48177,48203,12,48233,48259,12,48289,48315,12,48345,48371,12,48401,48427,12,48457,48483,12,48513,48539,12,48569,48595,12,48625,48651,12,48681,48707,12,48737,48763,12,48793,48819,12,48849,48875,12,48905,48931,12,48961,48987,12,49017,49043,12,49073,49099,12,49129,49155,12,49185,49211,12,49241,49267,12,49297,49323,12,49353,49379,12,49409,49435,12,49465,49491,12,49521,49547,12,49577,49603,12,49633,49659,12,49689,49715,12,49745,49771,12,49801,49827,12,49857,49883,12,49913,49939,12,49969,49995,12,50025,50051,12,50081,50107,12,50137,50163,12,50193,50219,12,50249,50275,12,50305,50331,12,50361,50387,12,50417,50443,12,50473,50499,12,50529,50555,12,50585,50611,12,50641,50667,12,50697,50723,12,50753,50779,12,50809,50835,12,50865,50891,12,50921,50947,12,50977,51003,12,51033,51059,12,51089,51115,12,51145,51171,12,51201,51227,12,51257,51283,12,51313,51339,12,51369,51395,12,51425,51451,12,51481,51507,12,51537,51563,12,51593,51619,12,51649,51675,12,51705,51731,12,51761,51787,12,51817,51843,12,51873,51899,12,51929,51955,12,51985,52011,12,52041,52067,12,52097,52123,12,52153,52179,12,52209,52235,12,52265,52291,12,52321,52347,12,52377,52403,12,52433,52459,12,52489,52515,12,52545,52571,12,52601,52627,12,52657,52683,12,52713,52739,12,52769,52795,12,52825,52851,12,52881,52907,12,52937,52963,12,52993,53019,12,53049,53075,12,53105,53131,12,53161,53187,12,53217,53243,12,53273,53299,12,53329,53355,12,53385,53411,12,53441,53467,12,53497,53523,12,53553,53579,12,53609,53635,12,53665,53691,12,53721,53747,12,53777,53803,12,53833,53859,12,53889,53915,12,53945,53971,12,54001,54027,12,54057,54083,12,54113,54139,12,54169,54195,12,54225,54251,12,54281,54307,12,54337,54363,12,54393,54419,12,54449,54475,12,54505,54531,12,54561,54587,12,54617,54643,12,54673,54699,12,54729,54755,12,54785,54811,12,54841,54867,12,54897,54923,12,54953,54979,12,55009,55035,12,55065,55091,12,55121,55147,12,55177,55203,12,65024,65039,5,65520,65528,4,66422,66426,5,68152,68154,5,69291,69292,5,69633,69633,5,69747,69748,5,69811,69814,5,69826,69826,5,69932,69932,7,70016,70017,5,70079,70080,7,70095,70095,5,70196,70196,5,70367,70367,5,70402,70403,7,70464,70464,5,70487,70487,5,70709,70711,7,70725,70725,7,70833,70834,7,70843,70844,7,70849,70849,7,71090,71093,5,71103,71104,5,71227,71228,7,71339,71339,5,71344,71349,5,71458,71461,5,71727,71735,5,71985,71989,7,71998,71998,5,72002,72002,7,72154,72155,5,72193,72202,5,72251,72254,5,72281,72283,5,72344,72345,5,72766,72766,7,72874,72880,5,72885,72886,5,73023,73029,5,73104,73105,5,73111,73111,5,92912,92916,5,94095,94098,5,113824,113827,4,119142,119142,7,119155,119162,4,119362,119364,5,121476,121476,5,122888,122904,5,123184,123190,5,125252,125258,5,127183,127183,14,127340,127343,14,127377,127386,14,127491,127503,14,127548,127551,14,127744,127756,14,127761,127761,14,127769,127769,14,127773,127774,14,127780,127788,14,127796,127797,14,127820,127823,14,127869,127869,14,127894,127895,14,127902,127903,14,127943,127943,14,127947,127950,14,127972,127972,14,127988,127988,14,127992,127994,14,128009,128011,14,128019,128019,14,128023,128041,14,128064,128064,14,128102,128107,14,128174,128181,14,128238,128238,14,128246,128247,14,128254,128254,14,128264,128264,14,128278,128299,14,128329,128330,14,128348,128359,14,128371,128377,14,128392,128393,14,128401,128404,14,128421,128421,14,128433,128434,14,128450,128452,14,128476,128478,14,128483,128483,14,128495,128495,14,128506,128506,14,128519,128520,14,128528,128528,14,128534,128534,14,128538,128538,14,128540,128542,14,128544,128549,14,128552,128555,14,128557,128557,14,128560,128563,14,128565,128565,14,128567,128576,14,128581,128591,14,128641,128642,14,128646,128646,14,128648,128648,14,128650,128651,14,128653,128653,14,128655,128655,14,128657,128659,14,128661,128661,14,128663,128663,14,128665,128666,14,128674,128674,14,128676,128677,14,128679,128685,14,128690,128690,14,128694,128694,14,128697,128702,14,128704,128704,14,128710,128714,14,128716,128716,14,128720,128720,14,128723,128724,14,128726,128727,14,128733,128735,14,128742,128744,14,128746,128746,14,128749,128751,14,128753,128754,14,128756,128758,14,128761,128761,14,128763,128764,14,128884,128895,14,128992,129003,14,129008,129008,14,129036,129039,14,129114,129119,14,129198,129279,14,129293,129295,14,129305,129310,14,129312,129319,14,129328,129328,14,129331,129338,14,129343,129343,14,129351,129355,14,129357,129359,14,129375,129387,14,129393,129393,14,129395,129398,14,129401,129401,14,129403,129403,14,129408,129412,14,129426,129431,14,129443,129444,14,129451,129453,14,129456,129465,14,129472,129472,14,129475,129482,14,129484,129484,14,129488,129510,14,129536,129647,14,129652,129652,14,129656,129658,14,129661,129663,14,129667,129670,14,129680,129685,14,129705,129708,14,129712,129718,14,129723,129727,14,129731,129733,14,129744,129750,14,129754,129759,14,129768,129775,14,129783,129791,14,917504,917504,4,917506,917535,4,917632,917759,4,918000,921599,4,0,9,4,11,12,4,14,31,4,169,169,14,174,174,14,1155,1159,5,1425,1469,5,1473,1474,5,1479,1479,5,1552,1562,5,1611,1631,5,1750,1756,5,1759,1764,5,1770,1773,5,1809,1809,5,1958,1968,5,2045,2045,5,2075,2083,5,2089,2093,5,2192,2193,1,2250,2273,5,2275,2306,5,2362,2362,5,2364,2364,5,2369,2376,5,2381,2381,5,2385,2391,5,2433,2433,5,2492,2492,5,2495,2496,7,2503,2504,7,2509,2509,5,2530,2531,5,2561,2562,5,2620,2620,5,2625,2626,5,2635,2637,5,2672,2673,5,2689,2690,5,2748,2748,5,2753,2757,5,2761,2761,7,2765,2765,5,2810,2815,5,2818,2819,7,2878,2878,5,2880,2880,7,2887,2888,7,2893,2893,5,2903,2903,5,2946,2946,5,3007,3007,7,3009,3010,7,3018,3020,7,3031,3031,5,3073,3075,7,3132,3132,5,3137,3140,7,3146,3149,5,3170,3171,5,3202,3203,7,3262,3262,7,3264,3265,7,3267,3268,7,3271,3272,7,3276,3277,5,3298,3299,5,3330,3331,7,3390,3390,5,3393,3396,5,3402,3404,7,3406,3406,1,3426,3427,5,3458,3459,7,3535,3535,5,3538,3540,5,3544,3550,7,3570,3571,7,3635,3635,7,3655,3662,5,3763,3763,7,3784,3789,5,3893,3893,5,3897,3897,5,3953,3966,5,3968,3972,5,3981,3991,5,4038,4038,5,4145,4145,7,4153,4154,5,4157,4158,5,4184,4185,5,4209,4212,5,4228,4228,7,4237,4237,5,4352,4447,8,4520,4607,10,5906,5908,5,5938,5939,5,5970,5971,5,6068,6069,5,6071,6077,5,6086,6086,5,6089,6099,5,6155,6157,5,6159,6159,5,6313,6313,5,6435,6438,7,6441,6443,7,6450,6450,5,6457,6459,5,6681,6682,7,6741,6741,7,6743,6743,7,6752,6752,5,6757,6764,5,6771,6780,5,6832,6845,5,6847,6862,5,6916,6916,7,6965,6965,5,6971,6971,7,6973,6977,7,6979,6980,7,7040,7041,5,7073,7073,7,7078,7079,7,7082,7082,7,7142,7142,5,7144,7145,5,7149,7149,5,7151,7153,5,7204,7211,7,7220,7221,7,7376,7378,5,7393,7393,7,7405,7405,5,7415,7415,7,7616,7679,5,8204,8204,5,8206,8207,4,8233,8233,4,8252,8252,14,8288,8292,4,8294,8303,4,8413,8416,5,8418,8420,5,8482,8482,14,8596,8601,14,8986,8987,14,9096,9096,14,9193,9196,14,9199,9199,14,9201,9202,14,9208,9210,14,9642,9643,14,9664,9664,14,9728,9729,14,9732,9732,14,9735,9741,14,9743,9744,14,9746,9746,14,9750,9751,14,9753,9756,14,9758,9759,14,9761,9761,14,9764,9765,14,9767,9769,14,9771,9773,14,9775,9775,14,9784,9785,14,9787,9791,14,9793,9793,14,9795,9799,14,9812,9822,14,9824,9824,14,9827,9827,14,9829,9830,14,9832,9832,14,9851,9851,14,9854,9854,14,9856,9861,14,9874,9874,14,9876,9876,14,9878,9879,14,9881,9881,14,9883,9884,14,9888,9889,14,9895,9895,14,9898,9899,14,9904,9905,14,9917,9918,14,9924,9925,14,9928,9928,14,9934,9934,14,9936,9936,14,9938,9938,14,9940,9940,14,9961,9961,14,9963,9967,14,9970,9971,14,9973,9973,14,9975,9977,14,9979,9980,14,9982,9985,14,9987,9988,14,9992,9996,14,9998,9998,14,10000,10001,14,10004,10004,14,10013,10013,14,10024,10024,14,10052,10052,14,10060,10060,14,10067,10069,14,10083,10083,14,10085,10087,14,10145,10145,14,10175,10175,14,11013,11015,14,11088,11088,14,11503,11505,5,11744,11775,5,12334,12335,5,12349,12349,14,12951,12951,14,42607,42607,5,42612,42621,5,42736,42737,5,43014,43014,5,43043,43044,7,43047,43047,7,43136,43137,7,43204,43205,5,43263,43263,5,43335,43345,5,43360,43388,8,43395,43395,7,43444,43445,7,43450,43451,7,43454,43456,7,43561,43566,5,43569,43570,5,43573,43574,5,43596,43596,5,43644,43644,5,43698,43700,5,43710,43711,5,43755,43755,7,43758,43759,7,43766,43766,5,44005,44005,5,44008,44008,5,44012,44012,7,44032,44032,11,44060,44060,11,44088,44088,11,44116,44116,11,44144,44144,11,44172,44172,11,44200,44200,11,44228,44228,11,44256,44256,11,44284,44284,11,44312,44312,11,44340,44340,11,44368,44368,11,44396,44396,11,44424,44424,11,44452,44452,11,44480,44480,11,44508,44508,11,44536,44536,11,44564,44564,11,44592,44592,11,44620,44620,11,44648,44648,11,44676,44676,11,44704,44704,11,44732,44732,11,44760,44760,11,44788,44788,11,44816,44816,11,44844,44844,11,44872,44872,11,44900,44900,11,44928,44928,11,44956,44956,11,44984,44984,11,45012,45012,11,45040,45040,11,45068,45068,11,45096,45096,11,45124,45124,11,45152,45152,11,45180,45180,11,45208,45208,11,45236,45236,11,45264,45264,11,45292,45292,11,45320,45320,11,45348,45348,11,45376,45376,11,45404,45404,11,45432,45432,11,45460,45460,11,45488,45488,11,45516,45516,11,45544,45544,11,45572,45572,11,45600,45600,11,45628,45628,11,45656,45656,11,45684,45684,11,45712,45712,11,45740,45740,11,45768,45768,11,45796,45796,11,45824,45824,11,45852,45852,11,45880,45880,11,45908,45908,11,45936,45936,11,45964,45964,11,45992,45992,11,46020,46020,11,46048,46048,11,46076,46076,11,46104,46104,11,46132,46132,11,46160,46160,11,46188,46188,11,46216,46216,11,46244,46244,11,46272,46272,11,46300,46300,11,46328,46328,11,46356,46356,11,46384,46384,11,46412,46412,11,46440,46440,11,46468,46468,11,46496,46496,11,46524,46524,11,46552,46552,11,46580,46580,11,46608,46608,11,46636,46636,11,46664,46664,11,46692,46692,11,46720,46720,11,46748,46748,11,46776,46776,11,46804,46804,11,46832,46832,11,46860,46860,11,46888,46888,11,46916,46916,11,46944,46944,11,46972,46972,11,47000,47000,11,47028,47028,11,47056,47056,11,47084,47084,11,47112,47112,11,47140,47140,11,47168,47168,11,47196,47196,11,47224,47224,11,47252,47252,11,47280,47280,11,47308,47308,11,47336,47336,11,47364,47364,11,47392,47392,11,47420,47420,11,47448,47448,11,47476,47476,11,47504,47504,11,47532,47532,11,47560,47560,11,47588,47588,11,47616,47616,11,47644,47644,11,47672,47672,11,47700,47700,11,47728,47728,11,47756,47756,11,47784,47784,11,47812,47812,11,47840,47840,11,47868,47868,11,47896,47896,11,47924,47924,11,47952,47952,11,47980,47980,11,48008,48008,11,48036,48036,11,48064,48064,11,48092,48092,11,48120,48120,11,48148,48148,11,48176,48176,11,48204,48204,11,48232,48232,11,48260,48260,11,48288,48288,11,48316,48316,11,48344,48344,11,48372,48372,11,48400,48400,11,48428,48428,11,48456,48456,11,48484,48484,11,48512,48512,11,48540,48540,11,48568,48568,11,48596,48596,11,48624,48624,11,48652,48652,11,48680,48680,11,48708,48708,11,48736,48736,11,48764,48764,11,48792,48792,11,48820,48820,11,48848,48848,11,48876,48876,11,48904,48904,11,48932,48932,11,48960,48960,11,48988,48988,11,49016,49016,11,49044,49044,11,49072,49072,11,49100,49100,11,49128,49128,11,49156,49156,11,49184,49184,11,49212,49212,11,49240,49240,11,49268,49268,11,49296,49296,11,49324,49324,11,49352,49352,11,49380,49380,11,49408,49408,11,49436,49436,11,49464,49464,11,49492,49492,11,49520,49520,11,49548,49548,11,49576,49576,11,49604,49604,11,49632,49632,11,49660,49660,11,49688,49688,11,49716,49716,11,49744,49744,11,49772,49772,11,49800,49800,11,49828,49828,11,49856,49856,11,49884,49884,11,49912,49912,11,49940,49940,11,49968,49968,11,49996,49996,11,50024,50024,11,50052,50052,11,50080,50080,11,50108,50108,11,50136,50136,11,50164,50164,11,50192,50192,11,50220,50220,11,50248,50248,11,50276,50276,11,50304,50304,11,50332,50332,11,50360,50360,11,50388,50388,11,50416,50416,11,50444,50444,11,50472,50472,11,50500,50500,11,50528,50528,11,50556,50556,11,50584,50584,11,50612,50612,11,50640,50640,11,50668,50668,11,50696,50696,11,50724,50724,11,50752,50752,11,50780,50780,11,50808,50808,11,50836,50836,11,50864,50864,11,50892,50892,11,50920,50920,11,50948,50948,11,50976,50976,11,51004,51004,11,51032,51032,11,51060,51060,11,51088,51088,11,51116,51116,11,51144,51144,11,51172,51172,11,51200,51200,11,51228,51228,11,51256,51256,11,51284,51284,11,51312,51312,11,51340,51340,11,51368,51368,11,51396,51396,11,51424,51424,11,51452,51452,11,51480,51480,11,51508,51508,11,51536,51536,11,51564,51564,11,51592,51592,11,51620,51620,11,51648,51648,11,51676,51676,11,51704,51704,11,51732,51732,11,51760,51760,11,51788,51788,11,51816,51816,11,51844,51844,11,51872,51872,11,51900,51900,11,51928,51928,11,51956,51956,11,51984,51984,11,52012,52012,11,52040,52040,11,52068,52068,11,52096,52096,11,52124,52124,11,52152,52152,11,52180,52180,11,52208,52208,11,52236,52236,11,52264,52264,11,52292,52292,11,52320,52320,11,52348,52348,11,52376,52376,11,52404,52404,11,52432,52432,11,52460,52460,11,52488,52488,11,52516,52516,11,52544,52544,11,52572,52572,11,52600,52600,11,52628,52628,11,52656,52656,11,52684,52684,11,52712,52712,11,52740,52740,11,52768,52768,11,52796,52796,11,52824,52824,11,52852,52852,11,52880,52880,11,52908,52908,11,52936,52936,11,52964,52964,11,52992,52992,11,53020,53020,11,53048,53048,11,53076,53076,11,53104,53104,11,53132,53132,11,53160,53160,11,53188,53188,11,53216,53216,11,53244,53244,11,53272,53272,11,53300,53300,11,53328,53328,11,53356,53356,11,53384,53384,11,53412,53412,11,53440,53440,11,53468,53468,11,53496,53496,11,53524,53524,11,53552,53552,11,53580,53580,11,53608,53608,11,53636,53636,11,53664,53664,11,53692,53692,11,53720,53720,11,53748,53748,11,53776,53776,11,53804,53804,11,53832,53832,11,53860,53860,11,53888,53888,11,53916,53916,11,53944,53944,11,53972,53972,11,54000,54000,11,54028,54028,11,54056,54056,11,54084,54084,11,54112,54112,11,54140,54140,11,54168,54168,11,54196,54196,11,54224,54224,11,54252,54252,11,54280,54280,11,54308,54308,11,54336,54336,11,54364,54364,11,54392,54392,11,54420,54420,11,54448,54448,11,54476,54476,11,54504,54504,11,54532,54532,11,54560,54560,11,54588,54588,11,54616,54616,11,54644,54644,11,54672,54672,11,54700,54700,11,54728,54728,11,54756,54756,11,54784,54784,11,54812,54812,11,54840,54840,11,54868,54868,11,54896,54896,11,54924,54924,11,54952,54952,11,54980,54980,11,55008,55008,11,55036,55036,11,55064,55064,11,55092,55092,11,55120,55120,11,55148,55148,11,55176,55176,11,55216,55238,9,64286,64286,5,65056,65071,5,65438,65439,5,65529,65531,4,66272,66272,5,68097,68099,5,68108,68111,5,68159,68159,5,68900,68903,5,69446,69456,5,69632,69632,7,69634,69634,7,69744,69744,5,69759,69761,5,69808,69810,7,69815,69816,7,69821,69821,1,69837,69837,1,69927,69931,5,69933,69940,5,70003,70003,5,70018,70018,7,70070,70078,5,70082,70083,1,70094,70094,7,70188,70190,7,70194,70195,7,70197,70197,7,70206,70206,5,70368,70370,7,70400,70401,5,70459,70460,5,70463,70463,7,70465,70468,7,70475,70477,7,70498,70499,7,70512,70516,5,70712,70719,5,70722,70724,5,70726,70726,5,70832,70832,5,70835,70840,5,70842,70842,5,70845,70845,5,70847,70848,5,70850,70851,5,71088,71089,7,71096,71099,7,71102,71102,7,71132,71133,5,71219,71226,5,71229,71229,5,71231,71232,5,71340,71340,7,71342,71343,7,71350,71350,7,71453,71455,5,71462,71462,7,71724,71726,7,71736,71736,7,71984,71984,5,71991,71992,7,71997,71997,7,71999,71999,1,72001,72001,1,72003,72003,5,72148,72151,5,72156,72159,7,72164,72164,7,72243,72248,5,72250,72250,1,72263,72263,5,72279,72280,7,72324,72329,1,72343,72343,7,72751,72751,7,72760,72765,5,72767,72767,5,72873,72873,7,72881,72881,7,72884,72884,7,73009,73014,5,73020,73021,5,73030,73030,1,73098,73102,7,73107,73108,7,73110,73110,7,73459,73460,5,78896,78904,4,92976,92982,5,94033,94087,7,94180,94180,5,113821,113822,5,118528,118573,5,119141,119141,5,119143,119145,5,119150,119154,5,119163,119170,5,119210,119213,5,121344,121398,5,121461,121461,5,121499,121503,5,122880,122886,5,122907,122913,5,122918,122922,5,123566,123566,5,125136,125142,5,126976,126979,14,126981,127182,14,127184,127231,14,127279,127279,14,127344,127345,14,127374,127374,14,127405,127461,14,127489,127490,14,127514,127514,14,127538,127546,14,127561,127567,14,127570,127743,14,127757,127758,14,127760,127760,14,127762,127762,14,127766,127768,14,127770,127770,14,127772,127772,14,127775,127776,14,127778,127779,14,127789,127791,14,127794,127795,14,127798,127798,14,127819,127819,14,127824,127824,14,127868,127868,14,127870,127871,14,127892,127893,14,127896,127896,14,127900,127901,14,127904,127940,14,127942,127942,14,127944,127944,14,127946,127946,14,127951,127955,14,127968,127971,14,127973,127984,14,127987,127987,14,127989,127989,14,127991,127991,14,127995,127999,5,128008,128008,14,128012,128014,14,128017,128018,14,128020,128020,14,128022,128022,14,128042,128042,14,128063,128063,14,128065,128065,14,128101,128101,14,128108,128109,14,128173,128173,14,128182,128183,14,128236,128237,14,128239,128239,14,128245,128245,14,128248,128248,14,128253,128253,14,128255,128258,14,128260,128263,14,128265,128265,14,128277,128277,14,128300,128301,14,128326,128328,14,128331,128334,14,128336,128347,14,128360,128366,14,128369,128370,14,128378,128378,14,128391,128391,14,128394,128397,14,128400,128400,14,128405,128406,14,128420,128420,14,128422,128423,14,128425,128432,14,128435,128443,14,128445,128449,14,128453,128464,14,128468,128475,14,128479,128480,14,128482,128482,14,128484,128487,14,128489,128494,14,128496,128498,14,128500,128505,14,128507,128511,14,128513,128518,14,128521,128525,14,128527,128527,14,128529,128529,14,128533,128533,14,128535,128535,14,128537,128537,14]")}function g1i(a,i){if(a===0)return 0;let e=TLo(a,i);if(e!==void 0)return e;let t=new yre(i,a);return t.prevCodePoint(),t.offset}function TLo(a,i){let e=new yre(i,a),t=e.prevCodePoint();for(;_Lo(t)||t===65039||t===8419;){if(e.offset===0)return;t=e.prevCodePoint()}if(!mGe(t))return;let o=e.offset;return o>0&&e.prevCodePoint()===8205&&(o=e.offset),o}function _Lo(a){return 127995<=a&&a<=127999}var rN="\xA0",p6=class a{constructor(i){this.confusableDictionary=i}static{this.ambiguousCharacterData=new co(()=>JSON.parse('{"_common":[8232,32,8233,32,5760,32,8192,32,8193,32,8194,32,8195,32,8196,32,8197,32,8198,32,8200,32,8201,32,8202,32,8287,32,8199,32,8239,32,2042,95,65101,95,65102,95,65103,95,8208,45,8209,45,8210,45,65112,45,1748,45,8259,45,727,45,8722,45,10134,45,11450,45,1549,44,1643,44,184,44,42233,44,894,59,2307,58,2691,58,1417,58,1795,58,1796,58,5868,58,65072,58,6147,58,6153,58,8282,58,1475,58,760,58,42889,58,8758,58,720,58,42237,58,451,33,11601,33,660,63,577,63,2429,63,5038,63,42731,63,119149,46,8228,46,1793,46,1794,46,42510,46,68176,46,1632,46,1776,46,42232,46,1373,96,65287,96,8219,96,1523,96,8242,96,1370,96,8175,96,65344,96,900,96,8189,96,8125,96,8127,96,8190,96,697,96,884,96,712,96,714,96,715,96,756,96,699,96,701,96,700,96,702,96,42892,96,1497,96,2036,96,2037,96,5194,96,5836,96,94033,96,94034,96,65339,91,10088,40,10098,40,12308,40,64830,40,65341,93,10089,41,10099,41,12309,41,64831,41,10100,123,119060,123,10101,125,65342,94,8270,42,1645,42,8727,42,66335,42,5941,47,8257,47,8725,47,8260,47,9585,47,10187,47,10744,47,119354,47,12755,47,12339,47,11462,47,20031,47,12035,47,65340,92,65128,92,8726,92,10189,92,10741,92,10745,92,119311,92,119355,92,12756,92,20022,92,12034,92,42872,38,708,94,710,94,5869,43,10133,43,66203,43,8249,60,10094,60,706,60,119350,60,5176,60,5810,60,5120,61,11840,61,12448,61,42239,61,8250,62,10095,62,707,62,119351,62,5171,62,94015,62,8275,126,732,126,8128,126,8764,126,65372,124,65293,45,118002,50,120784,50,120794,50,120804,50,120814,50,120824,50,130034,50,42842,50,423,50,1000,50,42564,50,5311,50,42735,50,119302,51,118003,51,120785,51,120795,51,120805,51,120815,51,120825,51,130035,51,42923,51,540,51,439,51,42858,51,11468,51,1248,51,94011,51,71882,51,118004,52,120786,52,120796,52,120806,52,120816,52,120826,52,130036,52,5070,52,71855,52,118005,53,120787,53,120797,53,120807,53,120817,53,120827,53,130037,53,444,53,71867,53,118006,54,120788,54,120798,54,120808,54,120818,54,120828,54,130038,54,11474,54,5102,54,71893,54,119314,55,118007,55,120789,55,120799,55,120809,55,120819,55,120829,55,130039,55,66770,55,71878,55,2819,56,2538,56,2666,56,125131,56,118008,56,120790,56,120800,56,120810,56,120820,56,120830,56,130040,56,547,56,546,56,66330,56,2663,57,2920,57,2541,57,3437,57,118009,57,120791,57,120801,57,120811,57,120821,57,120831,57,130041,57,42862,57,11466,57,71884,57,71852,57,71894,57,9082,97,65345,97,119834,97,119886,97,119938,97,119990,97,120042,97,120094,97,120146,97,120198,97,120250,97,120302,97,120354,97,120406,97,120458,97,593,97,945,97,120514,97,120572,97,120630,97,120688,97,120746,97,65313,65,117974,65,119808,65,119860,65,119912,65,119964,65,120016,65,120068,65,120120,65,120172,65,120224,65,120276,65,120328,65,120380,65,120432,65,913,65,120488,65,120546,65,120604,65,120662,65,120720,65,5034,65,5573,65,42222,65,94016,65,66208,65,119835,98,119887,98,119939,98,119991,98,120043,98,120095,98,120147,98,120199,98,120251,98,120303,98,120355,98,120407,98,120459,98,388,98,5071,98,5234,98,5551,98,65314,66,8492,66,117975,66,119809,66,119861,66,119913,66,120017,66,120069,66,120121,66,120173,66,120225,66,120277,66,120329,66,120381,66,120433,66,42932,66,914,66,120489,66,120547,66,120605,66,120663,66,120721,66,5108,66,5623,66,42192,66,66178,66,66209,66,66305,66,65347,99,8573,99,119836,99,119888,99,119940,99,119992,99,120044,99,120096,99,120148,99,120200,99,120252,99,120304,99,120356,99,120408,99,120460,99,7428,99,1010,99,11429,99,43951,99,66621,99,128844,67,71913,67,71922,67,65315,67,8557,67,8450,67,8493,67,117976,67,119810,67,119862,67,119914,67,119966,67,120018,67,120174,67,120226,67,120278,67,120330,67,120382,67,120434,67,1017,67,11428,67,5087,67,42202,67,66210,67,66306,67,66581,67,66844,67,8574,100,8518,100,119837,100,119889,100,119941,100,119993,100,120045,100,120097,100,120149,100,120201,100,120253,100,120305,100,120357,100,120409,100,120461,100,1281,100,5095,100,5231,100,42194,100,8558,68,8517,68,117977,68,119811,68,119863,68,119915,68,119967,68,120019,68,120071,68,120123,68,120175,68,120227,68,120279,68,120331,68,120383,68,120435,68,5024,68,5598,68,5610,68,42195,68,8494,101,65349,101,8495,101,8519,101,119838,101,119890,101,119942,101,120046,101,120098,101,120150,101,120202,101,120254,101,120306,101,120358,101,120410,101,120462,101,43826,101,1213,101,8959,69,65317,69,8496,69,117978,69,119812,69,119864,69,119916,69,120020,69,120072,69,120124,69,120176,69,120228,69,120280,69,120332,69,120384,69,120436,69,917,69,120492,69,120550,69,120608,69,120666,69,120724,69,11577,69,5036,69,42224,69,71846,69,71854,69,66182,69,119839,102,119891,102,119943,102,119995,102,120047,102,120099,102,120151,102,120203,102,120255,102,120307,102,120359,102,120411,102,120463,102,43829,102,42905,102,383,102,7837,102,1412,102,119315,70,8497,70,117979,70,119813,70,119865,70,119917,70,120021,70,120073,70,120125,70,120177,70,120229,70,120281,70,120333,70,120385,70,120437,70,42904,70,988,70,120778,70,5556,70,42205,70,71874,70,71842,70,66183,70,66213,70,66853,70,65351,103,8458,103,119840,103,119892,103,119944,103,120048,103,120100,103,120152,103,120204,103,120256,103,120308,103,120360,103,120412,103,120464,103,609,103,7555,103,397,103,1409,103,117980,71,119814,71,119866,71,119918,71,119970,71,120022,71,120074,71,120126,71,120178,71,120230,71,120282,71,120334,71,120386,71,120438,71,1292,71,5056,71,5107,71,42198,71,65352,104,8462,104,119841,104,119945,104,119997,104,120049,104,120101,104,120153,104,120205,104,120257,104,120309,104,120361,104,120413,104,120465,104,1211,104,1392,104,5058,104,65320,72,8459,72,8460,72,8461,72,117981,72,119815,72,119867,72,119919,72,120023,72,120179,72,120231,72,120283,72,120335,72,120387,72,120439,72,919,72,120494,72,120552,72,120610,72,120668,72,120726,72,11406,72,5051,72,5500,72,42215,72,66255,72,731,105,9075,105,65353,105,8560,105,8505,105,8520,105,119842,105,119894,105,119946,105,119998,105,120050,105,120102,105,120154,105,120206,105,120258,105,120310,105,120362,105,120414,105,120466,105,120484,105,618,105,617,105,953,105,8126,105,890,105,120522,105,120580,105,120638,105,120696,105,120754,105,1110,105,42567,105,1231,105,43893,105,5029,105,71875,105,65354,106,8521,106,119843,106,119895,106,119947,106,119999,106,120051,106,120103,106,120155,106,120207,106,120259,106,120311,106,120363,106,120415,106,120467,106,1011,106,1112,106,65322,74,117983,74,119817,74,119869,74,119921,74,119973,74,120025,74,120077,74,120129,74,120181,74,120233,74,120285,74,120337,74,120389,74,120441,74,42930,74,895,74,1032,74,5035,74,5261,74,42201,74,119844,107,119896,107,119948,107,120000,107,120052,107,120104,107,120156,107,120208,107,120260,107,120312,107,120364,107,120416,107,120468,107,8490,75,65323,75,117984,75,119818,75,119870,75,119922,75,119974,75,120026,75,120078,75,120130,75,120182,75,120234,75,120286,75,120338,75,120390,75,120442,75,922,75,120497,75,120555,75,120613,75,120671,75,120729,75,11412,75,5094,75,5845,75,42199,75,66840,75,1472,108,8739,73,9213,73,65512,73,1633,108,1777,73,66336,108,125127,108,118001,108,120783,73,120793,73,120803,73,120813,73,120823,73,130033,73,65321,73,8544,73,8464,73,8465,73,117982,108,119816,73,119868,73,119920,73,120024,73,120128,73,120180,73,120232,73,120284,73,120336,73,120388,73,120440,73,65356,108,8572,73,8467,108,119845,108,119897,108,119949,108,120001,108,120053,108,120105,73,120157,73,120209,73,120261,73,120313,73,120365,73,120417,73,120469,73,448,73,120496,73,120554,73,120612,73,120670,73,120728,73,11410,73,1030,73,1216,73,1493,108,1503,108,1575,108,126464,108,126592,108,65166,108,65165,108,1994,108,11599,73,5825,73,42226,73,93992,73,66186,124,66313,124,119338,76,8556,76,8466,76,117985,76,119819,76,119871,76,119923,76,120027,76,120079,76,120131,76,120183,76,120235,76,120287,76,120339,76,120391,76,120443,76,11472,76,5086,76,5290,76,42209,76,93974,76,71843,76,71858,76,66587,76,66854,76,65325,77,8559,77,8499,77,117986,77,119820,77,119872,77,119924,77,120028,77,120080,77,120132,77,120184,77,120236,77,120288,77,120340,77,120392,77,120444,77,924,77,120499,77,120557,77,120615,77,120673,77,120731,77,1018,77,11416,77,5047,77,5616,77,5846,77,42207,77,66224,77,66321,77,119847,110,119899,110,119951,110,120003,110,120055,110,120107,110,120159,110,120211,110,120263,110,120315,110,120367,110,120419,110,120471,110,1400,110,1404,110,65326,78,8469,78,117987,78,119821,78,119873,78,119925,78,119977,78,120029,78,120081,78,120185,78,120237,78,120289,78,120341,78,120393,78,120445,78,925,78,120500,78,120558,78,120616,78,120674,78,120732,78,11418,78,42208,78,66835,78,3074,111,3202,111,3330,111,3458,111,2406,111,2662,111,2790,111,3046,111,3174,111,3302,111,3430,111,3664,111,3792,111,4160,111,1637,111,1781,111,65359,111,8500,111,119848,111,119900,111,119952,111,120056,111,120108,111,120160,111,120212,111,120264,111,120316,111,120368,111,120420,111,120472,111,7439,111,7441,111,43837,111,959,111,120528,111,120586,111,120644,111,120702,111,120760,111,963,111,120532,111,120590,111,120648,111,120706,111,120764,111,11423,111,4351,111,1413,111,1505,111,1607,111,126500,111,126564,111,126596,111,65259,111,65260,111,65258,111,65257,111,1726,111,64428,111,64429,111,64427,111,64426,111,1729,111,64424,111,64425,111,64423,111,64422,111,1749,111,3360,111,4125,111,66794,111,71880,111,71895,111,66604,111,1984,79,2534,79,2918,79,12295,79,70864,79,71904,79,118000,79,120782,79,120792,79,120802,79,120812,79,120822,79,130032,79,65327,79,117988,79,119822,79,119874,79,119926,79,119978,79,120030,79,120082,79,120134,79,120186,79,120238,79,120290,79,120342,79,120394,79,120446,79,927,79,120502,79,120560,79,120618,79,120676,79,120734,79,11422,79,1365,79,11604,79,4816,79,2848,79,66754,79,42227,79,71861,79,66194,79,66219,79,66564,79,66838,79,9076,112,65360,112,119849,112,119901,112,119953,112,120005,112,120057,112,120109,112,120161,112,120213,112,120265,112,120317,112,120369,112,120421,112,120473,112,961,112,120530,112,120544,112,120588,112,120602,112,120646,112,120660,112,120704,112,120718,112,120762,112,120776,112,11427,112,65328,80,8473,80,117989,80,119823,80,119875,80,119927,80,119979,80,120031,80,120083,80,120187,80,120239,80,120291,80,120343,80,120395,80,120447,80,929,80,120504,80,120562,80,120620,80,120678,80,120736,80,11426,80,5090,80,5229,80,42193,80,66197,80,119850,113,119902,113,119954,113,120006,113,120058,113,120110,113,120162,113,120214,113,120266,113,120318,113,120370,113,120422,113,120474,113,1307,113,1379,113,1382,113,8474,81,117990,81,119824,81,119876,81,119928,81,119980,81,120032,81,120084,81,120188,81,120240,81,120292,81,120344,81,120396,81,120448,81,11605,81,119851,114,119903,114,119955,114,120007,114,120059,114,120111,114,120163,114,120215,114,120267,114,120319,114,120371,114,120423,114,120475,114,43847,114,43848,114,7462,114,11397,114,43905,114,119318,82,8475,82,8476,82,8477,82,117991,82,119825,82,119877,82,119929,82,120033,82,120189,82,120241,82,120293,82,120345,82,120397,82,120449,82,422,82,5025,82,5074,82,66740,82,5511,82,42211,82,94005,82,65363,115,119852,115,119904,115,119956,115,120008,115,120060,115,120112,115,120164,115,120216,115,120268,115,120320,115,120372,115,120424,115,120476,115,42801,115,445,115,1109,115,43946,115,71873,115,66632,115,65331,83,117992,83,119826,83,119878,83,119930,83,119982,83,120034,83,120086,83,120138,83,120190,83,120242,83,120294,83,120346,83,120398,83,120450,83,1029,83,1359,83,5077,83,5082,83,42210,83,94010,83,66198,83,66592,83,119853,116,119905,116,119957,116,120009,116,120061,116,120113,116,120165,116,120217,116,120269,116,120321,116,120373,116,120425,116,120477,116,8868,84,10201,84,128872,84,65332,84,117993,84,119827,84,119879,84,119931,84,119983,84,120035,84,120087,84,120139,84,120191,84,120243,84,120295,84,120347,84,120399,84,120451,84,932,84,120507,84,120565,84,120623,84,120681,84,120739,84,11430,84,5026,84,42196,84,93962,84,71868,84,66199,84,66225,84,66325,84,119854,117,119906,117,119958,117,120010,117,120062,117,120114,117,120166,117,120218,117,120270,117,120322,117,120374,117,120426,117,120478,117,42911,117,7452,117,43854,117,43858,117,651,117,965,117,120534,117,120592,117,120650,117,120708,117,120766,117,1405,117,66806,117,71896,117,8746,85,8899,85,117994,85,119828,85,119880,85,119932,85,119984,85,120036,85,120088,85,120140,85,120192,85,120244,85,120296,85,120348,85,120400,85,120452,85,1357,85,4608,85,66766,85,5196,85,42228,85,94018,85,71864,85,8744,118,8897,118,65366,118,8564,118,119855,118,119907,118,119959,118,120011,118,120063,118,120115,118,120167,118,120219,118,120271,118,120323,118,120375,118,120427,118,120479,118,7456,118,957,118,120526,118,120584,118,120642,118,120700,118,120758,118,1141,118,1496,118,71430,118,43945,118,71872,118,119309,86,1639,86,1783,86,8548,86,117995,86,119829,86,119881,86,119933,86,119985,86,120037,86,120089,86,120141,86,120193,86,120245,86,120297,86,120349,86,120401,86,120453,86,1140,86,11576,86,5081,86,5167,86,42719,86,42214,86,93960,86,71840,86,66845,86,623,119,119856,119,119908,119,119960,119,120012,119,120064,119,120116,119,120168,119,120220,119,120272,119,120324,119,120376,119,120428,119,120480,119,7457,119,1121,119,1309,119,1377,119,71434,119,71438,119,71439,119,43907,119,71910,87,71919,87,117996,87,119830,87,119882,87,119934,87,119986,87,120038,87,120090,87,120142,87,120194,87,120246,87,120298,87,120350,87,120402,87,120454,87,1308,87,5043,87,5076,87,42218,87,5742,120,10539,120,10540,120,10799,120,65368,120,8569,120,119857,120,119909,120,119961,120,120013,120,120065,120,120117,120,120169,120,120221,120,120273,120,120325,120,120377,120,120429,120,120481,120,5441,120,5501,120,5741,88,9587,88,66338,88,71916,88,65336,88,8553,88,117997,88,119831,88,119883,88,119935,88,119987,88,120039,88,120091,88,120143,88,120195,88,120247,88,120299,88,120351,88,120403,88,120455,88,42931,88,935,88,120510,88,120568,88,120626,88,120684,88,120742,88,11436,88,11613,88,5815,88,42219,88,66192,88,66228,88,66327,88,66855,88,611,121,7564,121,65369,121,119858,121,119910,121,119962,121,120014,121,120066,121,120118,121,120170,121,120222,121,120274,121,120326,121,120378,121,120430,121,120482,121,655,121,7935,121,43866,121,947,121,8509,121,120516,121,120574,121,120632,121,120690,121,120748,121,1199,121,4327,121,71900,121,65337,89,117998,89,119832,89,119884,89,119936,89,119988,89,120040,89,120092,89,120144,89,120196,89,120248,89,120300,89,120352,89,120404,89,120456,89,933,89,978,89,120508,89,120566,89,120624,89,120682,89,120740,89,11432,89,1198,89,5033,89,5053,89,42220,89,94019,89,71844,89,66226,89,119859,122,119911,122,119963,122,120015,122,120067,122,120119,122,120171,122,120223,122,120275,122,120327,122,120379,122,120431,122,120483,122,7458,122,43923,122,71876,122,71909,90,66293,90,65338,90,8484,90,8488,90,117999,90,119833,90,119885,90,119937,90,119989,90,120041,90,120197,90,120249,90,120301,90,120353,90,120405,90,120457,90,918,90,120493,90,120551,90,120609,90,120667,90,120725,90,5059,90,42204,90,71849,90,65282,34,65283,35,65284,36,65285,37,65286,38,65290,42,65291,43,65294,46,65295,47,65296,48,65298,50,65299,51,65300,52,65301,53,65302,54,65303,55,65304,56,65305,57,65308,60,65309,61,65310,62,65312,64,65316,68,65318,70,65319,71,65324,76,65329,81,65330,82,65333,85,65334,86,65335,87,65343,95,65346,98,65348,100,65350,102,65355,107,65357,109,65358,110,65361,113,65362,114,65364,116,65365,117,65367,119,65370,122,65371,123,65373,125,119846,109],"_default":[160,32,8211,45,65374,126,8218,44,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"cs":[65374,126,8218,44,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"de":[65374,126,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"es":[8211,45,65374,126,8218,44,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"fr":[65374,126,8218,44,65306,58,65281,33,8216,96,8245,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"it":[160,32,8211,45,65374,126,8218,44,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"ja":[8211,45,8218,44,65281,33,8216,96,8245,96,180,96,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65292,44,65297,49,65307,59],"ko":[8211,45,65374,126,8218,44,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"pl":[65374,126,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"pt-BR":[65374,126,8218,44,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"qps-ploc":[160,32,8211,45,65374,126,8218,44,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"ru":[65374,126,8218,44,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,305,105,921,73,1009,112,215,120,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"tr":[160,32,8211,45,65374,126,8218,44,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"zh-hans":[160,32,65374,126,8218,44,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65297,49],"zh-hant":[8211,45,65374,126,8218,44,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89]}'))}static{this.cache=new Cbe(i=>{let e=i.split(",");function t(p){let h=new Map;for(let g=0;g<p.length;g+=2)h.set(p[g],p[g+1]);return h}function o(p,h){let g=new Map(p);for(let[f,v]of h)g.set(f,v);return g}function n(p,h){if(!p)return h;let g=new Map;for(let[f,v]of p)h.has(f)&&g.set(f,v);return g}let r=this.ambiguousCharacterData.value,s=e.filter(p=>!p.startsWith("_")&&Object.hasOwn(r,p));s.length===0&&(s=["_default"]);let l;for(let p of s){let h=t(r[p]);l=n(l,h)}let c=t(r._common),u=o(c,l);return new a(u)})}static getInstance(i){return a.cache.get(Array.from(i).join(","))}static{this._locales=new co(()=>Object.keys(a.ambiguousCharacterData.value).filter(i=>!i.startsWith("_")))}static getLocales(){return a._locales.value}isAmbiguous(i){return this.confusableDictionary.has(i)}containsAmbiguousCharacter(i){for(let e=0;e<i.length;e++){let t=i.codePointAt(e);if(typeof t=="number"&&this.isAmbiguous(t))return!0}return!1}getPrimaryConfusable(i){return this.confusableDictionary.get(i)}getConfusableCodePoints(){return new Set(this.confusableDictionary.keys())}},K0=class a{static getRawData(){return JSON.parse('{"_common":[11,12,13,127,847,1564,4447,4448,6068,6069,6155,6156,6157,6158,7355,7356,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8204,8205,8206,8207,8234,8235,8236,8237,8238,8239,8287,8288,8289,8290,8291,8292,8293,8294,8295,8296,8297,8298,8299,8300,8301,8302,8303,10240,12644,65024,65025,65026,65027,65028,65029,65030,65031,65032,65033,65034,65035,65036,65037,65038,65039,65279,65440,65520,65521,65522,65523,65524,65525,65526,65527,65528,65532,78844,119155,119156,119157,119158,119159,119160,119161,119162,917504,917505,917506,917507,917508,917509,917510,917511,917512,917513,917514,917515,917516,917517,917518,917519,917520,917521,917522,917523,917524,917525,917526,917527,917528,917529,917530,917531,917532,917533,917534,917535,917536,917537,917538,917539,917540,917541,917542,917543,917544,917545,917546,917547,917548,917549,917550,917551,917552,917553,917554,917555,917556,917557,917558,917559,917560,917561,917562,917563,917564,917565,917566,917567,917568,917569,917570,917571,917572,917573,917574,917575,917576,917577,917578,917579,917580,917581,917582,917583,917584,917585,917586,917587,917588,917589,917590,917591,917592,917593,917594,917595,917596,917597,917598,917599,917600,917601,917602,917603,917604,917605,917606,917607,917608,917609,917610,917611,917612,917613,917614,917615,917616,917617,917618,917619,917620,917621,917622,917623,917624,917625,917626,917627,917628,917629,917630,917631,917760,917761,917762,917763,917764,917765,917766,917767,917768,917769,917770,917771,917772,917773,917774,917775,917776,917777,917778,917779,917780,917781,917782,917783,917784,917785,917786,917787,917788,917789,917790,917791,917792,917793,917794,917795,917796,917797,917798,917799,917800,917801,917802,917803,917804,917805,917806,917807,917808,917809,917810,917811,917812,917813,917814,917815,917816,917817,917818,917819,917820,917821,917822,917823,917824,917825,917826,917827,917828,917829,917830,917831,917832,917833,917834,917835,917836,917837,917838,917839,917840,917841,917842,917843,917844,917845,917846,917847,917848,917849,917850,917851,917852,917853,917854,917855,917856,917857,917858,917859,917860,917861,917862,917863,917864,917865,917866,917867,917868,917869,917870,917871,917872,917873,917874,917875,917876,917877,917878,917879,917880,917881,917882,917883,917884,917885,917886,917887,917888,917889,917890,917891,917892,917893,917894,917895,917896,917897,917898,917899,917900,917901,917902,917903,917904,917905,917906,917907,917908,917909,917910,917911,917912,917913,917914,917915,917916,917917,917918,917919,917920,917921,917922,917923,917924,917925,917926,917927,917928,917929,917930,917931,917932,917933,917934,917935,917936,917937,917938,917939,917940,917941,917942,917943,917944,917945,917946,917947,917948,917949,917950,917951,917952,917953,917954,917955,917956,917957,917958,917959,917960,917961,917962,917963,917964,917965,917966,917967,917968,917969,917970,917971,917972,917973,917974,917975,917976,917977,917978,917979,917980,917981,917982,917983,917984,917985,917986,917987,917988,917989,917990,917991,917992,917993,917994,917995,917996,917997,917998,917999],"cs":[173,8203,12288],"de":[173,8203,12288],"es":[8203,12288],"fr":[173,8203,12288],"it":[160,173,12288],"ja":[173],"ko":[173,12288],"pl":[173,8203,12288],"pt-BR":[173,8203,12288],"qps-ploc":[160,173,8203,12288],"ru":[173,12288],"tr":[160,173,8203,12288],"zh-hans":[160,173,8203,12288],"zh-hant":[173,12288]}')}static{this._data=void 0}static getData(){return this._data||(this._data=new Set([...Object.values(a.getRawData())].flat())),this._data}static isInvisibleCharacter(i){return a.getData().has(i)}static containsInvisibleCharacter(i){for(let e=0;e<i.length;e++){let t=i.codePointAt(e);if(typeof t=="number"&&(a.isInvisibleCharacter(t)||t===32))return!0}return!1}static get codePoints(){return a.getData()}},f1i="\u2026";function DLo(a){let i=new Uint16Array(a.length);for(let o=0;o<i.length;o++)i[o]=a.charCodeAt(o);let e="",t=new Uint8Array(i.buffer);for(let o=0;o<t.length;o++)e+=String.fromCharCode(t[o]);return e}function m6(a){return btoa(DLo(a))}function h6(a){return a===47||a===92}function p$(a){return a.replace(/[\\/]/g,Lo.sep)}function v1i(a){return a.indexOf("/")===-1&&(a=p$(a)),/^[a-zA-Z]:(\/|$)/.test(a)&&(a="/"+a),a}function a9t(a,i=Lo.sep){if(!a)return"";let e=a.length,t=a.charCodeAt(0);if(h6(t)){if(h6(a.charCodeAt(1))&&!h6(a.charCodeAt(2))){let n=3,r=n;for(;n<e&&!h6(a.charCodeAt(n));n++);if(r!==n&&!h6(a.charCodeAt(n+1))){for(n+=1;n<e;n++)if(h6(a.charCodeAt(n)))return a.slice(0,n+1).replace(/[\\/]/g,i)}}return i}else if(S1i(t)&&a.charCodeAt(1)===58)return h6(a.charCodeAt(2))?a.slice(0,2)+i:a.slice(0,2);let o=a.indexOf("://");if(o!==-1){for(o+=3;o<e;o++)if(h6(a.charCodeAt(o)))return a.slice(0,o+1)}return""}function g6(a){if(!ri||!a||a.length<5)return!1;let i=a.charCodeAt(0);if(i!==92||(i=a.charCodeAt(1),i!==92))return!1;let e=2,t=e;for(;e<a.length&&(i=a.charCodeAt(e),i!==92);e++);return!(t===e||(i=a.charCodeAt(e+1),isNaN(i)||i===92))}var LLo=/[\\/:\*\?"<>\|]/g,RLo=/[/]/g,MLo=/^(con|prn|aux|clock\$|nul|lpt[0-9]|com[0-9])(\.(.*?))?$/i;function nU(a,i=ri){let e=i?LLo:RLo;return!(!a||a.length===0||/^\s+$/.test(a)||(e.lastIndex=0,e.test(a))||i&&MLo.test(a)||a==="."||a===".."||i&&a[a.length-1]==="."||i&&a.length!==a.trim().length||a.length>255)}function b1i(a,i,e){let t=a===i;return!e||t?t:!a||!i?!1:mr(a,i)}function rU(a,i,e,t=Rd){if(a===i)return!0;if(!a||!i||i.length>a.length)return!1;if(e){if(!Uk(a,i))return!1;if(i.length===a.length)return!0;let n=i.length;return i.charAt(i.length-1)===t&&n--,a.charAt(n)===t}return i.charAt(i.length-1)!==t&&(i+=t),a.indexOf(i)===0}function S1i(a){return a>=65&&a<=90||a>=97&&a<=122}function I1i(a){return ri?(a=ih(a,Rd),a.endsWith(":")&&(a+=Rd)):(a=ih(a,Rd),a||(a=Rd)),a}function f6(a,i=ri){return i?S1i(a.charCodeAt(0))&&a.charCodeAt(1)===58:!1}function y1i(a,i=ri){return f6(a,i)?a[0]:void 0}function Dbe(a,i,e){return i.length>a.length?-1:a===i?0:(e&&(a=a.toLowerCase(),i=i.toLowerCase()),a.indexOf(i))}function w1i(a){let i=a.split(":"),e,t,o;for(let n of i){let r=Number(n);Xo(r)?t===void 0?t=r:o===void 0&&(o=r):e=e?[e,n].join(":"):n}if(!e)throw new Error("Format for `--goto` should be: `FILE:LINE(:COLUMN)`");return{path:e,line:t!==void 0?t:void 0,column:o!==void 0?o:t!==void 0?1:void 0}}var PLo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",ALo="BDEFGHIJKMOQRSTUVWXYZbdefghijkmoqrstuvwxyz0123456789";function Lbe(a,i,e=8){let t="";for(let n=0;n<e;n++){let r;n===0&&ri&&!i&&(e===3||e===4)?r=ALo:r=PLo,t+=r.charAt(Math.floor(Math.random()*r.length))}let o;return i?o=`${i}-${t}`:o=t,a?Ld(a,o):o}var NLo=/^\w[\w\d+.-]*$/,OLo=/^\//,FLo=/^\/\//;function WLo(a,i){if(!a.scheme&&i)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${a.authority}", path: "${a.path}", query: "${a.query}", fragment: "${a.fragment}"}`);if(a.scheme&&!NLo.test(a.scheme)){let e=[...a.scheme.matchAll(/[^\w\d+.-]/gu)],t=e.length>0?` Found '${e[0][0]}' at index ${e[0].index} (${e.length} total)`:"";throw new Error(`[UriError]: Scheme contains illegal characters.${t} (len:${a.scheme.length})`)}if(a.path){if(a.authority){if(!OLo.test(a.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(FLo.test(a.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}function VLo(a,i){return!a&&!i?"file":a}function BLo(a,i){switch(a){case"https":case"http":case"file":i?i[0]!==G0&&(i=G0+i):i=G0;break}return i}var ng="",G0="/",HLo=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,A=class a{static isUri(i){return i instanceof a?!0:!i||typeof i!="object"?!1:typeof i.authority=="string"&&typeof i.fragment=="string"&&typeof i.path=="string"&&typeof i.query=="string"&&typeof i.scheme=="string"&&typeof i.fsPath=="string"&&typeof i.with=="function"&&typeof i.toString=="function"}constructor(i,e,t,o,n,r=!1){typeof i=="object"?(this.scheme=i.scheme||ng,this.authority=i.authority||ng,this.path=i.path||ng,this.query=i.query||ng,this.fragment=i.fragment||ng):(this.scheme=VLo(i,r),this.authority=e||ng,this.path=BLo(this.scheme,t||ng),this.query=o||ng,this.fragment=n||ng,WLo(this,r))}get fsPath(){return xre(this,!1)}with(i){if(!i)return this;let{scheme:e,authority:t,path:o,query:n,fragment:r}=i;return e===void 0?e=this.scheme:e===null&&(e=ng),t===void 0?t=this.authority:t===null&&(t=ng),o===void 0?o=this.path:o===null&&(o=ng),n===void 0?n=this.query:n===null&&(n=ng),r===void 0?r=this.fragment:r===null&&(r=ng),e===this.scheme&&t===this.authority&&o===this.path&&n===this.query&&r===this.fragment?this:new v6(e,t,o,n,r)}static parse(i,e=!1){let t=HLo.exec(i);return t?new v6(t[2]||ng,Ipt(t[4]||ng),Ipt(t[5]||ng),Ipt(t[7]||ng),Ipt(t[9]||ng),e):new v6(ng,ng,ng,ng,ng)}static file(i){let e=ng;if(ri&&(i=i.replace(/\\/g,G0)),i[0]===G0&&i[1]===G0){let t=i.indexOf(G0,2);t===-1?(e=i.substring(2),i=G0):(e=i.substring(2,t),i=i.substring(t)||G0)}return new v6("file",e,i,ng,ng)}static from(i,e){return new v6(i.scheme,i.authority,i.path,i.query,i.fragment,e)}static joinPath(i,...e){if(!i.path)throw new Error("[UriError]: cannot call joinPath on URI without path");let t;return ri&&i.scheme==="file"?t=a.file(Ms.join(xre(i,!0),...e)).path:t=Lo.join(i.path,...e),i.with({path:t})}toString(i=!1){return l9t(this,i)}toJSON(){return this}static revive(i){if(i){if(i instanceof a)return i;{let e=new v6(i);return e._formatted=i.external??null,e._fsPath=i._sep===E1i?i.fsPath??null:null,e}}else return i}[Symbol.for("debug.description")](){return`URI(${this.toString()})`}};function oh(a){return!a||typeof a!="object"?!1:typeof a.scheme=="string"&&(typeof a.authority=="string"||typeof a.authority>"u")&&(typeof a.path=="string"||typeof a.path>"u")&&(typeof a.query=="string"||typeof a.query>"u")&&(typeof a.fragment=="string"||typeof a.fragment>"u")}var E1i=ri?1:void 0,v6=class extends A{constructor(){super(...arguments);this._formatted=null;this._fsPath=null}get fsPath(){return this._fsPath||(this._fsPath=xre(this,!1)),this._fsPath}toString(e=!1){return e?l9t(this,!0):(this._formatted||(this._formatted=l9t(this,!1)),this._formatted)}toJSON(){let e={$mid:1};return this._fsPath&&(e.fsPath=this._fsPath,e._sep=E1i),this._formatted&&(e.external=this._formatted),this.path&&(e.path=this.path),this.scheme&&(e.scheme=this.scheme),this.authority&&(e.authority=this.authority),this.query&&(e.query=this.query),this.fragment&&(e.fragment=this.fragment),e}},T1i={58:"%3A",47:"%2F",63:"%3F",35:"%23",91:"%5B",93:"%5D",64:"%40",33:"%21",36:"%24",38:"%26",39:"%27",40:"%28",41:"%29",42:"%2A",43:"%2B",44:"%2C",59:"%3B",61:"%3D",32:"%20"};function x1i(a,i,e){let t,o=-1;for(let n=0;n<a.length;n++){let r=a.charCodeAt(n);if(r>=97&&r<=122||r>=65&&r<=90||r>=48&&r<=57||r===45||r===46||r===95||r===126||i&&r===47||e&&r===91||e&&r===93||e&&r===58)o!==-1&&(t+=encodeURIComponent(a.substring(o,n)),o=-1),t!==void 0&&(t+=a.charAt(n));else{t===void 0&&(t=a.substr(0,n));let s=T1i[r];s!==void 0?(o!==-1&&(t+=encodeURIComponent(a.substring(o,n)),o=-1),t+=s):o===-1&&(o=n)}}return o!==-1&&(t+=encodeURIComponent(a.substring(o))),t!==void 0?t:a}function ULo(a){let i;for(let e=0;e<a.length;e++){let t=a.charCodeAt(e);t===35||t===63?(i===void 0&&(i=a.substr(0,e)),i+=T1i[t]):i!==void 0&&(i+=a[e])}return i!==void 0?i:a}function xre(a,i){let e;return a.authority&&a.path.length>1&&a.scheme==="file"?e=`//${a.authority}${a.path}`:a.path.charCodeAt(0)===47&&(a.path.charCodeAt(1)>=65&&a.path.charCodeAt(1)<=90||a.path.charCodeAt(1)>=97&&a.path.charCodeAt(1)<=122)&&a.path.charCodeAt(2)===58?i?e=a.path.substr(1):e=a.path[1].toLowerCase()+a.path.substr(2):e=a.path,ri&&(e=e.replace(/\//g,"\\")),e}function l9t(a,i){let e=i?ULo:x1i,t="",{scheme:o,authority:n,path:r,query:s,fragment:l}=a;if(o&&(t+=o,t+=":"),(n||o==="file")&&(t+=G0,t+=G0),n){let c=n.indexOf("@");if(c!==-1){let u=n.substr(0,c);n=n.substr(c+1),c=u.lastIndexOf(":"),c===-1?t+=e(u,!1,!1):(t+=e(u.substr(0,c),!1,!1),t+=":",t+=e(u.substr(c+1),!1,!0)),t+="@"}n=n.toLowerCase(),c=n.lastIndexOf(":"),c===-1?t+=e(n,!1,!0):(t+=e(n.substr(0,c),!1,!0),t+=n.substr(c))}if(r){if(r.length>=3&&r.charCodeAt(0)===47&&r.charCodeAt(2)===58){let c=r.charCodeAt(1);c>=65&&c<=90&&(r=`/${String.fromCharCode(c+32)}:${r.substr(3)}`)}else if(r.length>=2&&r.charCodeAt(1)===58){let c=r.charCodeAt(0);c>=65&&c<=90&&(r=`${String.fromCharCode(c+32)}:${r.substr(2)}`)}t+=e(r,!0,!1)}return s&&(t+="?",t+=e(s,!1,!1)),l&&(t+="#",t+=i?l:x1i(l,!1,!1)),t}function _1i(a){try{return decodeURIComponent(a)}catch{return a.length>3?a.substr(0,3)+_1i(a.substr(3)):a}}var k1i=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function Ipt(a){return a.match(k1i)?a.replace(k1i,i=>_1i(i)):a}var Y;(en=>(en.inMemory="inmemory",en.vscode="vscode",en.internal="private",en.walkThrough="walkThrough",en.walkThroughSnippet="walkThroughSnippet",en.http="http",en.https="https",en.file="file",en.mailto="mailto",en.untitled="untitled",en.data="data",en.command="command",en.vscodeRemote="vscode-remote",en.vscodeRemoteResource="vscode-remote-resource",en.vscodeManagedRemoteResource="vscode-managed-remote-resource",en.vscodeUserData="vscode-userdata",en.vscodeCustomEditor="vscode-custom-editor",en.vscodeNotebookCell="vscode-notebook-cell",en.vscodeNotebookCellMetadata="vscode-notebook-cell-metadata",en.vscodeNotebookCellMetadataDiff="vscode-notebook-cell-metadata-diff",en.vscodeNotebookCellOutput="vscode-notebook-cell-output",en.vscodeNotebookCellOutputDiff="vscode-notebook-cell-output-diff",en.vscodeNotebookMetadata="vscode-notebook-metadata",en.vscodeInteractiveInput="vscode-interactive-input",en.vscodeSettings="vscode-settings",en.vscodeWorkspaceTrust="vscode-workspace-trust",en.vscodeTerminal="vscode-terminal",en.vscodeChatCodeBlock="vscode-chat-code-block",en.vscodeChatCodeCompareBlock="vscode-chat-code-compare-block",en.vscodeChatEditor="vscode-chat-editor",en.vscodeChatInput="chatSessionInput",en.vscodeLocalChatSession="vscode-chat-session",en.webviewPanel="webview-panel",en.vscodeWebview="vscode-webview",en.vscodeBrowser="vscode-browser",en.extension="extension",en.vscodeFileResource="vscode-file",en.tmp="tmp",en.vsls="vsls",en.vscodeSourceControl="vscode-scm",en.commentsInput="comment",en.codeSetting="code-setting",en.outputChannel="output",en.accessibleView="accessible-view",en.chatEditingSnapshotScheme="chat-editing-snapshot-text-model",en.chatEditingModel="chat-editing-text-model",en.copilotPr="copilot-pr"))(Y||={});function jd(a,i){return A.isUri(a)?mr(a.scheme,i):Uk(a,i+":")}function $0(a,...i){return i.some(e=>jd(a,e))}var zLo="tkn",c9t=class{constructor(){this._hosts=Object.create(null);this._ports=Object.create(null);this._connectionTokens=Object.create(null);this._preferredWebSchema="http";this._delegate=null;this._serverRootPath="/"}setPreferredWebSchema(i){this._preferredWebSchema=i}setDelegate(i){this._delegate=i}setServerRootPath(i,e){this._serverRootPath=Lo.join(e??"/",KLo(i))}getServerRootPath(){return this._serverRootPath}get _remoteResourcesPath(){return Lo.join(this._serverRootPath,Y.vscodeRemoteResource)}set(i,e,t){this._hosts[i]=e,this._ports[i]=t}setConnectionToken(i,e){this._connectionTokens[i]=e}getPreferredWebSchema(){return this._preferredWebSchema}rewrite(i){if(this._delegate)try{return this._delegate(i)}catch(s){return mt(s),i}let e=i.authority,t=this._hosts[e];t&&t.indexOf(":")!==-1&&t.indexOf("[")===-1&&(t=`[${t}]`);let o=this._ports[e],n=this._connectionTokens[e],r=`path=${encodeURIComponent(i.path)}`;return typeof n=="string"&&(r+=`&${zLo}=${encodeURIComponent(n)}`),A.from({scheme:Gt?this._preferredWebSchema:Y.vscodeRemoteResource,authority:`${t}:${o}`,path:this._remoteResourcesPath,query:r})}},jD=new c9t;function KLo(a){return`${a.quality??"oss"}-${a.commit??"dev"}`}var D1i="vs/../../extensions",sN="vs/../../node_modules",b6="vs/../../node_modules.asar",ypt="vs/../../node_modules.asar.unpacked",u9t="vscode-app",d9t=class a{static{this.FALLBACK_AUTHORITY=u9t}asBrowserUri(i){let e=this.toUri(i);return this.uriToBrowserUri(e)}uriToBrowserUri(i){return i.scheme===Y.vscodeRemote?jD.rewrite(i):i.scheme===Y.file&&(kr||PUi===`${Y.vscodeFileResource}://${a.FALLBACK_AUTHORITY}`)?i.with({scheme:Y.vscodeFileResource,authority:i.authority||a.FALLBACK_AUTHORITY,query:null,fragment:null}):i}asFileUri(i){let e=this.toUri(i);return this.uriToFileUri(e)}uriToFileUri(i){return i.scheme===Y.vscodeFileResource?i.with({scheme:Y.file,authority:i.authority!==a.FALLBACK_AUTHORITY?i.authority:null,query:null,fragment:null}):i}toUri(i){if(A.isUri(i))return i;if(globalThis._VSCODE_FILE_ROOT){let e=globalThis._VSCODE_FILE_ROOT;if(/^\w[\w\d+.-]*:\/\//.test(e))return A.joinPath(A.parse(e,!0),i);let t=Ld(e,i);return A.file(t)}throw new Error("Cannot determine URI for module id!")}},gn=new d9t,Ofn=Object.freeze({"Cache-Control":"no-cache, no-store"}),Ffn=Object.freeze({"Document-Policy":"include-js-call-stacks-in-crash-reports"}),kre;(n=>{let a=new Map([["1",{"Cross-Origin-Opener-Policy":"same-origin"}],["2",{"Cross-Origin-Embedder-Policy":"require-corp"}],["3",{"Cross-Origin-Opener-Policy":"same-origin","Cross-Origin-Embedder-Policy":"require-corp"}]]);n.CoopAndCoep=Object.freeze(a.get("3"));let e="vscode-coi";function t(r){let s;typeof r=="string"?s=new URL(r).searchParams:r instanceof URL?s=r.searchParams:A.isUri(r)&&(s=new URL(r.toString(!0)).searchParams);let l=s?.get(e);if(l)return a.get(l)}n.getHeadersFromQuery=t;function o(r,s,l){if(!globalThis.crossOriginIsolated)return;let c=s&&l?"3":l?"2":"1";r instanceof URLSearchParams?r.set(e,c):r[e]=c}n.addSearchParam=o})(kre||={});function q0(a){return xre(a,!0)}var Ere=class{constructor(i){this._ignorePathCasing=i}compare(i,e,t=!1){return i===e?0:Al(this.getComparisonKey(i,t),this.getComparisonKey(e,t))}isEqual(i,e,t=!1){return i===e?!0:!i||!e?!1:this.getComparisonKey(i,t)===this.getComparisonKey(e,t)}getComparisonKey(i,e=!1){return i.with({path:this._ignorePathCasing(i)?i.path.toLowerCase():void 0,fragment:e?null:void 0}).toString()}ignorePathCasing(i){return this._ignorePathCasing(i)}isEqualOrParent(i,e,t=!1){if(i.scheme===e.scheme){if(i.scheme===Y.file)return rU(q0(i),q0(e),this._ignorePathCasing(i))&&i.query===e.query&&(t||i.fragment===e.fragment);if(S6(i.authority,e.authority))return rU(i.path,e.path,this._ignorePathCasing(i),"/")&&i.query===e.query&&(t||i.fragment===e.fragment)}return!1}joinPath(i,...e){return A.joinPath(i,...e)}basenameOrAuthority(i){return Ye(i)||i.authority}basename(i){return Lo.basename(i.path)}extname(i){return Lo.extname(i.path)}dirname(i){if(i.path.length===0)return i;let e;return i.scheme===Y.file?e=A.file(wc(q0(i))).path:(e=Lo.dirname(i.path),i.authority&&e.length&&e.charCodeAt(0)!==47&&(console.error(`dirname("${i.toString})) resulted in a relative path`),e="/")),i.with({path:e})}normalizePath(i){if(!i.path.length)return i;let e;return i.scheme===Y.file?e=A.file(th(q0(i))).path:e=Lo.normalize(i.path),i.with({path:e})}relativePath(i,e){if(i.scheme!==e.scheme||!S6(i.authority,e.authority))return;if(i.scheme===Y.file){let n=SM(q0(i),q0(e));return ri?p$(n):n}let t=i.path||"/",o=e.path||"/";if(this._ignorePathCasing(i)){let n=0;for(let r=Math.min(t.length,o.length);n<r&&!(t.charCodeAt(n)!==o.charCodeAt(n)&&t.charAt(n).toLowerCase()!==o.charAt(n).toLowerCase());n++);t=o.substr(0,n)+t.substr(n)}return Lo.relative(t,o)}resolvePath(i,e){if(i.scheme===Y.file){let t=A.file(iN(q0(i),e));return i.with({authority:t.authority,path:t.path})}return e=v1i(e),i.with({path:Lo.resolve(i.path,e)})}isAbsolutePath(i){return!!i.path&&i.path[0]==="/"}isEqualAuthority(i,e){return i===e||i!==void 0&&e!==void 0&&mr(i,e)}hasTrailingPathSeparator(i,e=Rd){if(i.scheme===Y.file){let t=q0(i);return t.length>a9t(t).length&&t[t.length-1]===e}else{let t=i.path;return t.length>1&&t.charCodeAt(t.length-1)===47&&!/^[a-zA-Z]:(\/$|\\$)/.test(i.fsPath)}}removeTrailingPathSeparator(i,e=Rd){return Tre(i,e)?i.with({path:i.path.substr(0,i.path.length-1)}):i}addTrailingPathSeparator(i,e=Rd){let t=!1;if(i.scheme===Y.file){let o=q0(i);t=o!==void 0&&o.length===a9t(o).length&&o[o.length-1]===e}else{e="/";let o=i.path;t=o.length===1&&o.charCodeAt(o.length-1)===47}return!t&&!Tre(i,e)?i.with({path:i.path+"/"}):i}},ar=new Ere(()=>!1),m$=new Ere(a=>a.scheme===Y.file?!Wn:!0),dx=new Ere(a=>!0),Xe=ar.isEqual.bind(ar),La=ar.isEqualOrParent.bind(ar),zfn=ar.getComparisonKey.bind(ar),Ra=ar.basenameOrAuthority.bind(ar),Ye=ar.basename.bind(ar),ms=ar.extname.bind(ar),ci=ar.dirname.bind(ar),je=ar.joinPath.bind(ar),_re=ar.normalizePath.bind(ar),Fc=ar.relativePath.bind(ar),m9t=ar.resolvePath.bind(ar),wpt=ar.isAbsolutePath.bind(ar),S6=ar.isEqualAuthority.bind(ar),Tre=ar.hasTrailingPathSeparator.bind(ar),Rbe=ar.removeTrailingPathSeparator.bind(ar),h$=ar.addTrailingPathSeparator.bind(ar);function fGe(a,i){let e=[];for(let t=0;t<a.length;t++){let o=i(a[t]);a.some((n,r)=>r===t?!1:La(o,i(n)))||e.push(a[t])}return e}var g$;(n=>{n.META_DATA_LABEL="label",n.META_DATA_DESCRIPTION="description",n.META_DATA_SIZE="size",n.META_DATA_MIME="mime";function o(r){let s=new Map;r.path.substring(r.path.indexOf(";")+1,r.path.lastIndexOf(";")).split(";").forEach(u=>{let[p,h]=u.split(":");p&&h&&s.set(p,h)});let c=r.path.substring(0,r.path.indexOf(";"));return c&&s.set(n.META_DATA_MIME,c),s}n.parseMetaData=o})(g$||={});function Og(a,i,e){if(i){let t=a.path;return t&&t[0]!==Lo.sep&&(t=Lo.sep+t),a.with({scheme:e,authority:i,path:t})}return a.with({scheme:e})}var QD=Symbol("MicrotaskDelay");function FT(a){return!!a&&typeof a.then=="function"}function xn(a){let i=new $e,e=a(i.token),t=!1,o=new Promise((n,r)=>{let s=i.token.onCancellationRequested(()=>{t=!0,s.dispose(),r(new ho)});Promise.resolve(e).then(l=>{s.dispose(),i.dispose(),t?Ac(l)&&l.dispose():n(l)},l=>{s.dispose(),i.dispose(),r(l)})});return new class{cancel(){i.cancel(),i.dispose()}then(n,r){return o.then(n,r)}catch(n){return this.then(void 0,n)}finally(n){return o.finally(n)}}}function wa(a,i,e){return new Promise((t,o)=>{let n=i.onCancellationRequested(()=>{n.dispose(),t(e)});a.then(t,o).finally(()=>n.dispose())})}function pm(a,i){return new Promise((e,t)=>{let o=i.onCancellationRequested(()=>{o.dispose(),t(new ho)});a.then(e,t).finally(()=>o.dispose())})}function L1i(a){return new Promise((i,e)=>{a.then(i,e)})}function Dre(a){let i=-1,e=a.map((o,n)=>o.then(r=>(i=n,r))),t=Promise.race(e);return t.cancel=()=>{a.forEach((o,n)=>{n!==i&&o.cancel&&o.cancel()})},t.finally(()=>{t.cancel()}),t}function Wp(a,i,e){let t,o=setTimeout(()=>{t?.(void 0),e?.()},i);return Promise.race([a.finally(()=>clearTimeout(o)),new Promise(n=>t=n)])}function TI(){let a,i;return{promise:new Promise((t,o)=>{a=t,i=o}),resolve:a,reject:i}}var um=class{constructor(){this.activePromise=null,this.queuedPromise=null,this.queuedPromiseFactory=null,this.cancellationTokenSource=new $e}queue(i){if(this.cancellationTokenSource.token.isCancellationRequested)return Promise.reject(new Error("Throttler is disposed"));if(this.activePromise){if(this.queuedPromiseFactory=i,!this.queuedPromise){let e=()=>{if(this.queuedPromise=null,this.cancellationTokenSource.token.isCancellationRequested)return;let t=this.queue(this.queuedPromiseFactory);return this.queuedPromiseFactory=null,t};this.queuedPromise=new Promise(t=>{this.activePromise.then(e,e).then(t)})}return new Promise((e,t)=>{this.queuedPromise.then(e,t)})}return this.activePromise=i(this.cancellationTokenSource.token),new Promise((e,t)=>{this.activePromise.then(o=>{this.activePromise=null,e(o)},o=>{this.activePromise=null,t(o)})})}dispose(){this.cancellationTokenSource.cancel()}},Nm=class{constructor(){this.current=Promise.resolve(null)}queue(i){return this.current=this.current.then(()=>i(),()=>i())}},NT=class{constructor(){this.promiseMap=new Map}queue(i,e){let o=(this.promiseMap.get(i)??Promise.resolve()).catch(()=>{}).then(e).finally(()=>{this.promiseMap.get(i)===o&&this.promiseMap.delete(i)});return this.promiseMap.set(i,o),o}peek(i){return this.promiseMap.get(i)||void 0}keys(){return this.promiseMap.keys()}},GLo=(a,i)=>{let e=!0,t=setTimeout(()=>{e=!1,i()},a);return{isTriggered:()=>e,dispose:()=>{clearTimeout(t),e=!1}}},$Lo=a=>{let i=!0;return queueMicrotask(()=>{i&&(i=!1,a())}),{isTriggered:()=>i,dispose:()=>{i=!1}}},jo=class{constructor(i){this.defaultDelay=i;this.deferred=null,this.completionPromise=null,this.doResolve=null,this.doReject=null,this.task=null}trigger(i,e=this.defaultDelay){this.task=i,this.cancelTimeout(),this.completionPromise||(this.completionPromise=new Promise((o,n)=>{this.doResolve=o,this.doReject=n}).then(()=>{if(this.completionPromise=null,this.doResolve=null,this.task){let o=this.task;return this.task=null,o()}}));let t=()=>{this.deferred=null,this.doResolve?.(null)};return this.deferred=e===QD?$Lo(t):GLo(e,t),this.completionPromise}isTriggered(){return!!this.deferred?.isTriggered()}cancel(){this.cancelTimeout(),this.completionPromise&&(this.doReject?.(new ho),this.completionPromise=null)}cancelTimeout(){this.deferred?.dispose(),this.deferred=null}dispose(){this.cancel()}},ya=class{constructor(i){this.delayer=new jo(i),this.throttler=new um}trigger(i,e){return this.delayer.trigger(()=>this.throttler.queue(i),e)}isTriggered(){return this.delayer.isTriggered()}cancel(){this.delayer.cancel()}dispose(){this.delayer.dispose(),this.throttler.dispose()}},Np=class{constructor(){this._isOpen=!1,this._promise=new Promise((i,e)=>{this._completePromise=i})}isOpen(){return this._isOpen}open(){this._isOpen=!0,this._completePromise(!0)}wait(){return this._promise}},f$=class extends Np{constructor(i){super(),this._timeout=setTimeout(()=>this.open(),i)}open(){clearTimeout(this._timeout),super.open()}};function Pi(a,i){return i?new Promise((e,t)=>{let o=setTimeout(()=>{n.dispose(),e()},a),n=i.onCancellationRequested(()=>{clearTimeout(o),n.dispose(),t(new ho)})}):xn(e=>Pi(a,e))}function nn(a,i=0,e){let t=setTimeout(()=>{a(),e&&o.dispose()},i),o=Z(()=>{clearTimeout(t),e?.delete(o)});return e?.add(o),o}function Tpt(a){let i=[],e=0,t=a.length;function o(){return e<t?a[e++]():null}function n(r){r!=null&&i.push(r);let s=o();return s?s.then(n):Promise.resolve(i)}return Promise.resolve(null).then(n)}function Lre(a,i=t=>!!t,e=null){let t=0,o=a.length,n=()=>{if(t>=o)return Promise.resolve(e);let r=a[t++];return Promise.resolve(r()).then(l=>i(l)?Promise.resolve(l):n())};return n()}var OT=class{constructor(i){this._size=0;this._isDisposed=!1;this.maxDegreeOfParalellism=i,this.outstandingPromises=[],this.runningPromises=0,this._onDrained=new E}whenIdle(){return this.size>0?H.toPromise(this.onDrained):Promise.resolve()}get onDrained(){return this._onDrained.event}get size(){return this._size}queue(i){if(this._isDisposed)throw new Error("Object has been disposed");return this._size++,new Promise((e,t)=>{this.outstandingPromises.push({factory:i,c:e,e:t}),this.consume()})}consume(){for(;this.outstandingPromises.length&&this.runningPromises<this.maxDegreeOfParalellism;){let i=this.outstandingPromises.shift();this.runningPromises++;let e=i.factory();e.then(i.c,i.e),e.then(()=>this.consumed(),()=>this.consumed())}}consumed(){this._isDisposed||(this.runningPromises--,--this._size===0&&this._onDrained.fire(),this.outstandingPromises.length>0&&this.consume())}clear(){if(this._isDisposed)throw new Error("Object has been disposed");this.outstandingPromises.length=0,this._size=this.runningPromises}dispose(){this._isDisposed=!0,this.outstandingPromises.length=0,this._size=0,this._onDrained.dispose()}},Op=class extends OT{constructor(){super(1)}};var sU=class{constructor(){this.queues=new Map;this.drainers=new Set;this.drainListeners=void 0;this.drainListenerCount=0}async whenDrained(){if(this.isDrained())return;let i=new Go;return this.drainers.add(i),i.p}isDrained(){for(let[,i]of this.queues)if(i.size>0)return!1;return!0}queueSize(i,e=ar){let t=e.getComparisonKey(i);return this.queues.get(t)?.size??0}queueFor(i,e,t=ar){let o=t.getComparisonKey(i),n=this.queues.get(o);if(!n){n=new Op;let r=this.drainListenerCount++,s=H.once(n.onDrained)(()=>{n?.dispose(),this.queues.delete(o),this.onDidQueueDrain(),this.drainListeners?.deleteAndDispose(r),this.drainListeners?.size===0&&(this.drainListeners.dispose(),this.drainListeners=void 0)});this.drainListeners||(this.drainListeners=new jt),this.drainListeners.set(r,s),this.queues.set(o,n)}return n.queue(e)}onDidQueueDrain(){this.isDrained()&&this.releaseDrainers()}releaseDrainers(){for(let i of this.drainers)i.complete();this.drainers.clear()}dispose(){for(let[,i]of this.queues)i.dispose();this.queues.clear(),this.releaseDrainers(),this.drainListeners?.dispose()}},Pbe=class{constructor(){this._runningTask=void 0;this._pendingTasks=[]}schedule(i){let e=new Go;return this._pendingTasks.push({task:i,deferred:e,setUndefinedWhenCleared:!1}),this._runIfNotRunning(),e.p}scheduleSkipIfCleared(i){let e=new Go;return this._pendingTasks.push({task:i,deferred:e,setUndefinedWhenCleared:!0}),this._runIfNotRunning(),e.p}_runIfNotRunning(){this._runningTask===void 0&&this._processQueue()}async _processQueue(){if(this._pendingTasks.length===0)return;let i=this._pendingTasks.shift();if(i){if(this._runningTask)throw new ni;this._runningTask=i.task;try{let e=await i.task();i.deferred.complete(e)}catch(e){i.deferred.error(e)}finally{this._runningTask=void 0,this._processQueue()}}}clearPending(){let i=this._pendingTasks;this._pendingTasks=[];for(let e of i)e.setUndefinedWhenCleared?e.deferred.complete(void 0):e.deferred.error(new ho)}},Nl=class{constructor(i,e){this._isDisposed=!1;this._token=void 0,typeof i=="function"&&typeof e=="number"&&this.setIfNotSet(i,e)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==void 0&&(clearTimeout(this._token),this._token=void 0)}cancelAndSet(i,e){if(this._isDisposed)throw new ni("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=void 0,i()},e)}setIfNotSet(i,e){if(this._isDisposed)throw new ni("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===void 0&&(this._token=setTimeout(()=>{this._token=void 0,i()},e))}},EI=class{constructor(){this.disposable=void 0;this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(i,e,t=globalThis){if(this.isDisposed)throw new ni("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let o=t.setInterval(()=>{i()},e);this.disposable=Z(()=>{t.clearInterval(o),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},Dt=class{constructor(i,e){this.timeoutToken=void 0,this.runner=i,this.timeout=e,this.timeoutHandler=this.onTimeout.bind(this)}dispose(){this.cancel(),this.runner=null}cancel(){this.isScheduled()&&(clearTimeout(this.timeoutToken),this.timeoutToken=void 0)}schedule(i=this.timeout){this.cancel(),this.timeoutToken=setTimeout(this.timeoutHandler,i)}get delay(){return this.timeout}set delay(i){this.timeout=i}isScheduled(){return this.timeoutToken!==void 0}flush(){this.isScheduled()&&(this.cancel(),this.doRun())}onTimeout(){this.timeoutToken=void 0,this.runner&&this.doRun()}doRun(){this.runner?.()}};var wM=class extends Dt{constructor(e,t){super(e,t);this.units=[]}work(e){this.units.push(e),this.isScheduled()||this.schedule()}doRun(){let e=this.units;this.units=[],this.runner?.(e)}dispose(){this.units=[],super.dispose()}};var aN,Mbe;(function(){let a=globalThis;typeof a.requestIdleCallback!="function"||typeof a.cancelIdleCallback!="function"?Mbe=(i,e,t)=>{Vw(()=>{if(o)return;let n=Date.now()+15;e(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,n-Date.now())}}))});let o=!1;return{dispose(){o||(o=!0)}}}:Mbe=(i,e,t)=>{let o=i.requestIdleCallback(e,typeof t=="number"?{timeout:t}:void 0),n=!1;return{dispose(){n||(n=!0,i.cancelIdleCallback(o))}}},aN=(i,e)=>Mbe(globalThis,i,e)})();var vGe=class{constructor(i,e){this._didRun=!1;this._executor=()=>{try{this._value=e()}catch(t){this._error=t}finally{this._didRun=!0}},this._handle=Mbe(i,()=>this._executor())}dispose(){this._handle.dispose()}get value(){if(this._didRun||(this._handle.dispose(),this._executor()),this._error)throw this._error;return this._value}get isInitialized(){return this._didRun}},v$=class extends vGe{constructor(i){super(globalThis,i)}};async function R1i(a,i,e){let t;for(let o=0;o<e;o++)try{return await a()}catch(n){t=n,await Pi(i)}throw t}var Abe=class{isRunning(i){return typeof i=="number"?this._running?.taskId===i:!!this._running}get running(){return this._running?.promise}cancelRunning(){this._running?.cancel()}run(i,e,t){return this._running={taskId:i,cancel:()=>t?.(),promise:e},e.then(()=>this.doneRunning(i),()=>this.doneRunning(i)),e}doneRunning(i){this._running&&i===this._running.taskId&&(this._running=void 0,this.runQueued())}runQueued(){if(this._queued){let i=this._queued;this._queued=void 0,i.run().then(i.promiseResolve,i.promiseReject)}}queue(i){if(this._queued)this._queued.run=i;else{let{promise:e,resolve:t,reject:o}=TI();this._queued={run:i,promise:e,promiseResolve:t,promiseReject:o}}return this._queued.promise}hasQueued(){return!!this._queued}async join(){return this._queued?.promise??this._running?.promise}},Cpt=class{constructor(i,e=()=>Date.now()){this.interval=i;this.nowFn=e;this.lastIncrementTime=0;this.value=0}increment(){let i=this.nowFn();return i-this.lastIncrementTime>this.interval&&(this.lastIncrementTime=i,this.value=0),this.value++,this.value}};var Go=class a{static fromPromise(i){let e=new a;return e.settleWith(i),e}get isRejected(){return this.outcome?.outcome===1}get isResolved(){return this.outcome?.outcome===0}get isSettled(){return!!this.outcome}get value(){return this.outcome?.outcome===0?this.outcome?.value:void 0}constructor(){this.p=new Promise((i,e)=>{this.completeCallback=i,this.errorCallback=e})}complete(i){return this.isSettled?Promise.resolve():new Promise(e=>{this.completeCallback(i),this.outcome={outcome:0,value:i},e()})}error(i){return this.isSettled?Promise.resolve():new Promise(e=>{this.errorCallback(i),this.outcome={outcome:1,value:i},e()})}settleWith(i){return i.then(e=>this.complete(e),e=>this.error(e))}cancel(){return this.error(new ho)}},fn;(e=>{async function a(t){let o,n=await Promise.all(t.map(r=>r.then(s=>s,s=>{o||(o=s)})));if(typeof o<"u")throw o;return n}e.settled=a;function i(t){return new Promise(async(o,n)=>{try{await t(o,n)}catch(r){n(r)}})}e.withAsyncBody=i})(fn||={});var h9t=class{constructor(i){this._value=void 0;this._error=void 0;this._isResolved=!1;this.promise=i.then(e=>(this._value=e,this._isResolved=!0,e),e=>{throw this._error=e,this._isResolved=!0,e})}get value(){return this._value}get error(){return this._error}get isResolved(){return this._isResolved}requireValue(){if(!this._isResolved)throw new ni("Promise is not resolved yet");if(this._error)throw this._error;return this._value}},xpt=class{constructor(i){this._compute=i;this._promise=new co(()=>new h9t(this._compute()))}requireValue(){return this._promise.value.requireValue()}getPromise(){return this._promise.value.promise}get currentValue(){return this._promise.rawValue?.value}};var g9t=class a{static fromArray(i){return new a(e=>{e.emitMany(i)})}static fromPromise(i){return new a(async e=>{e.emitMany(await i)})}static fromPromisesResolveOrder(i){return new a(async e=>{await Promise.all(i.map(async t=>e.emitOne(await t)))})}static merge(i){return new a(async e=>{await Promise.all(i.map(async t=>{for await(let o of t)e.emitOne(o)}))})}static{this.EMPTY=a.fromArray([])}constructor(i,e){this._state=0,this._results=[],this._error=null,this._onReturn=e,this._onStateChanged=new E,queueMicrotask(async()=>{let t={emitOne:o=>this.emitOne(o),emitMany:o=>this.emitMany(o),reject:o=>this.reject(o)};try{await Promise.resolve(i(t)),this.resolve()}catch(o){this.reject(o)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let i=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(i<this._results.length)return{done:!1,value:this._results[i++]};if(this._state===1)return{done:!0,value:void 0};await H.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(i,e){return new a(async t=>{for await(let o of i)t.emitOne(e(o))})}map(i){return a.map(this,i)}static filter(i,e){return new a(async t=>{for await(let o of i)e(o)&&t.emitOne(o)})}filter(i){return a.filter(this,i)}static coalesce(i){return a.filter(i,e=>!!e)}coalesce(){return a.coalesce(this)}static async toPromise(i){let e=[];for await(let t of i)e.push(t);return e}toPromise(){return a.toPromise(this)}emitOne(i){this._state===0&&(this._results.push(i),this._onStateChanged.fire())}emitMany(i){this._state===0&&(this._results=this._results.concat(i),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(i){this._state===0&&(this._state=2,this._error=i,this._onStateChanged.fire())}};function M1i(a){let i=new $e,e=a(i.token);return new v9t(i,async t=>{let o=i.token.onCancellationRequested(()=>{o.dispose(),i.dispose(),t.reject(new ho)});try{for await(let n of e){if(i.token.isCancellationRequested)return;t.emitOne(n)}o.dispose(),i.dispose()}catch(n){o.dispose(),i.dispose(),t.reject(n)}})}var kpt=class{constructor(i){this._deferred=new Go;this._asyncIterable=new g9t(o=>{if(e){o.reject(e);return}return t&&o.emitMany(t),this._errorFn=n=>o.reject(n),this._emitOneFn=n=>o.emitOne(n),this._emitManyFn=n=>o.emitMany(n),this._deferred.p},i);let e,t;this._errorFn=o=>{e||(e=o)},this._emitOneFn=o=>{t||(t=[]),t.push(o)},this._emitManyFn=o=>{t?o.forEach(n=>t.push(n)):t=o.slice()}}get asyncIterable(){return this._asyncIterable}resolve(){this._deferred.complete()}reject(i){this._errorFn(i),this._deferred.complete()}emitOne(i){this._emitOneFn(i)}emitMany(i){this._emitManyFn(i)}};var f9t=class{constructor(){this._unsatisfiedConsumers=[];this._unconsumedValues=[]}get hasFinalValue(){return!!this._finalValue}produce(i){if(this._ensureNoFinalValue(),this._unsatisfiedConsumers.length>0){let e=this._unsatisfiedConsumers.shift();this._resolveOrRejectDeferred(e,i)}else this._unconsumedValues.push(i)}produceFinal(i){this._ensureNoFinalValue(),this._finalValue=i;for(let e of this._unsatisfiedConsumers)this._resolveOrRejectDeferred(e,i);this._unsatisfiedConsumers.length=0}_ensureNoFinalValue(){if(this._finalValue)throw new ni("ProducerConsumer: cannot produce after final value has been set")}_resolveOrRejectDeferred(i,e){e.ok?i.complete(e.value):i.error(e.error)}consume(){if(this._unconsumedValues.length>0||this._finalValue){let i=this._unconsumedValues.length>0?this._unconsumedValues.shift():this._finalValue;return i.ok?Promise.resolve(i.value):Promise.reject(i.error)}else{let i=new Go;return this._unsatisfiedConsumers.push(i),i.p}}},Fp=class a{constructor(i,e){this._onReturn=e;this._producerConsumer=new f9t;this._iterator={next:()=>this._producerConsumer.consume(),return:()=>(this._onReturn?.(),Promise.resolve({done:!0,value:void 0})),throw:async i=>(this._finishError(i),{done:!0,value:void 0})};queueMicrotask(async()=>{let t=i({emitOne:o=>this._producerConsumer.produce({ok:!0,value:{done:!1,value:o}}),emitMany:o=>{for(let n of o)this._producerConsumer.produce({ok:!0,value:{done:!1,value:n}})},reject:o=>this._finishError(o)});if(!this._producerConsumer.hasFinalValue)try{await t,this._finishOk()}catch(o){this._finishError(o)}})}static fromArray(i){return new a(e=>{e.emitMany(i)})}static fromPromise(i){return new a(async e=>{e.emitMany(await i)})}static fromPromisesResolveOrder(i){return new a(async e=>{await Promise.all(i.map(async t=>e.emitOne(await t)))})}static merge(i){return new a(async e=>{await Promise.all(i.map(async t=>{for await(let o of t)e.emitOne(o)}))})}static{this.EMPTY=a.fromArray([])}static map(i,e){return new a(async t=>{for await(let o of i)t.emitOne(e(o))})}static tee(i){let e,t,o=new Go,n=async()=>{if(!(!e||!t))try{for await(let l of i)e.emitOne(l),t.emitOne(l)}catch(l){e.reject(l),t.reject(l)}finally{o.complete()}},r=new a(async l=>(e=l,n(),o.p)),s=new a(async l=>(t=l,n(),o.p));return[r,s]}map(i){return a.map(this,i)}static coalesce(i){return a.filter(i,e=>!!e)}coalesce(){return a.coalesce(this)}static filter(i,e){return new a(async t=>{for await(let o of i)e(o)&&t.emitOne(o)})}filter(i){return a.filter(this,i)}_finishOk(){this._producerConsumer.hasFinalValue||this._producerConsumer.produceFinal({ok:!0,value:{done:!0,value:void 0}})}_finishError(i){this._producerConsumer.hasFinalValue||this._producerConsumer.produceFinal({ok:!1,error:i})}[Symbol.asyncIterator](){return this._iterator}},v9t=class extends Fp{constructor(e,t){super(t);this._source=e}cancel(){this._source.cancel()}},I6=Symbol("AsyncReaderEndOfStream"),Ept=class{constructor(i){this._source=i;this._buffer=[];this._atEnd=!1}get endOfStream(){return this._buffer.length===0&&this._atEnd}async read(){return this._buffer.length===0&&!this._atEnd&&await this._extendBuffer(),this._buffer.length===0?I6:this._buffer.shift()}async readWhile(i,e){do{let t=await this.peek();if(t===I6||!i(t))break;await this.read(),await e(t)}while(!0)}readBufferedOrThrow(){let i=this.peekBufferedOrThrow();return this._buffer.shift(),i}async consumeToEnd(){for(;!this.endOfStream;)await this.read()}async peek(){return this._buffer.length===0&&!this._atEnd&&await this._extendBuffer(),this._buffer.length===0?I6:this._buffer[0]}peekBufferedOrThrow(){if(this._buffer.length===0){if(this._atEnd)return I6;throw new ni("No buffered elements")}return this._buffer[0]}async peekTimeout(i){if(this._buffer.length===0&&!this._atEnd&&await Wp(this._extendBuffer(),i),this._atEnd)return I6;if(this._buffer.length!==0)return this._buffer[0]}_extendBuffer(){return this._atEnd?Promise.resolve():(this._extendBufferPromise||(this._extendBufferPromise=(async()=>{let{value:i,done:e}=await this._source.next();this._extendBufferPromise=void 0,e?this._atEnd=!0:this._buffer.push(i)})()),this._extendBufferPromise)}};function y6(a){let i=a;return i?[i.on,i.pause,i.resume,i.destroy].every(e=>typeof e=="function"):!1}function _pt(a){let i=a;return i?y6(i.stream)&&Array.isArray(i.buffer)&&typeof i.ended=="boolean":!1}function _I(a,i){return new b9t(a,i)}var b9t=class{constructor(i,e){this.reducer=i;this.options=e;this.state={flowing:!1,ended:!1,destroyed:!1};this.buffer={data:[],error:[]};this.listeners={data:[],error:[],end:[]};this.pendingWritePromises=[]}pause(){this.state.destroyed||(this.state.flowing=!1)}resume(){this.state.destroyed||this.state.flowing||(this.state.flowing=!0,this.flowData(),this.flowErrors(),this.flowEnd())}write(i){if(!this.state.destroyed){if(this.state.flowing)this.emitData(i);else if(this.buffer.data.push(i),typeof this.options?.highWaterMark=="number"&&this.buffer.data.length>this.options.highWaterMark)return new Promise(e=>this.pendingWritePromises.push(e))}}error(i){this.state.destroyed||(this.state.flowing?this.emitError(i):this.buffer.error.push(i))}end(i){this.state.destroyed||(typeof i<"u"&&this.write(i),this.state.flowing?(this.emitEnd(),this.destroy()):this.state.ended=!0)}emitData(i){this.listeners.data.slice(0).forEach(e=>e(i))}emitError(i){this.listeners.error.length===0?mt(i):this.listeners.error.slice(0).forEach(e=>e(i))}emitEnd(){this.listeners.end.slice(0).forEach(i=>i())}on(i,e){if(!this.state.destroyed)switch(i){case"data":this.listeners.data.push(e),this.resume();break;case"end":this.listeners.end.push(e),this.state.flowing&&this.flowEnd()&&this.destroy();break;case"error":this.listeners.error.push(e),this.state.flowing&&this.flowErrors();break}}removeListener(i,e){if(this.state.destroyed)return;let t;switch(i){case"data":t=this.listeners.data;break;case"end":t=this.listeners.end;break;case"error":t=this.listeners.error;break}if(t){let o=t.indexOf(e);o>=0&&t.splice(o,1)}}flowData(){if(this.buffer.data.length===0)return;if(typeof this.reducer=="function"){let e=this.reducer(this.buffer.data);this.emitData(e)}else for(let e of this.buffer.data)this.emitData(e);this.buffer.data.length=0;let i=[...this.pendingWritePromises];this.pendingWritePromises.length=0,i.forEach(e=>e())}flowErrors(){if(this.listeners.error.length>0){for(let i of this.buffer.error)this.emitError(i);this.buffer.error.length=0}}flowEnd(){return this.state.ended?(this.emitEnd(),this.listeners.end.length>0):!1}destroy(){this.state.destroyed||(this.state.destroyed=!0,this.state.ended=!0,this.buffer.data.length=0,this.buffer.error.length=0,this.listeners.data.length=0,this.listeners.error.length=0,this.listeners.end.length=0,this.pendingWritePromises.length=0)}};function P1i(a,i){let e=[],t;for(;(t=a.read())!==null;)e.push(t);return i(e)}function A1i(a,i,e){let t=[],o;for(;(o=a.read())!==null&&t.length<e;)t.push(o);return o===null&&t.length>0?i(t):{read:()=>{if(t.length>0)return t.shift();if(typeof o<"u"){let n=o;return o=void 0,n}return a.read()}}}function w6(a,i){return new Promise((e,t)=>{let o=[];j0(a,{onData:n=>{i&&o.push(n)},onError:n=>{i?t(n):e(void 0)},onEnd:()=>{e(i?i(o):void 0)}})})}function j0(a,i,e){a.on("error",t=>{e?.isCancellationRequested||i.onError(t)}),a.on("end",()=>{e?.isCancellationRequested||i.onEnd()}),a.on("data",t=>{e?.isCancellationRequested||i.onData(t)})}function Dpt(a,i){return new Promise((e,t)=>{let o=new P,n=[],r=c=>{if(n.push(c),n.length>i)return o.dispose(),a.pause(),e({stream:a,buffer:n,ended:!1})},s=c=>(o.dispose(),t(c)),l=()=>(o.dispose(),e({stream:a,buffer:n,ended:!0}));o.add(Z(()=>a.removeListener("error",s))),a.on("error",s),o.add(Z(()=>a.removeListener("end",l))),a.on("end",l),o.add(Z(()=>a.removeListener("data",r))),a.on("data",r)})}function N1i(a,i){let e=_I(i);return e.end(a),e}function O1i(){let a=_I(()=>{throw new Error("not supported")});return a.end(),a}function F1i(a){let i=!1;return{read:()=>i?null:(i=!0,a)}}function S9t(a,i,e){let t=_I(e);return j0(a,{onData:o=>t.write(i.data(o)),onError:o=>t.error(i.error?i.error(o):o),onEnd:()=>t.end()}),t}function W1i(a,i,e){let t=!1;return{read:()=>{let o=i.read();return t?o:(t=!0,o!==null?e([a,o]):a)}}}function V1i(a,i,e){let t=!1,o=_I(e);return j0(i,{onData:n=>t?o.write(n):(t=!0,o.write(e([a,n]))),onError:n=>o.error(n),onEnd:()=>{t||(t=!0,o.write(a)),o.end()}}),o}var bGe=typeof Buffer<"u",QLo=new co(()=>new Uint8Array(256)),I9t,y9t,Je=class a{static alloc(i){return bGe?new a(Buffer.allocUnsafe(i)):new a(new Uint8Array(i))}static wrap(i){return bGe&&!Buffer.isBuffer(i)&&(i=Buffer.from(i.buffer,i.byteOffset,i.byteLength)),new a(i)}static fromString(i,e){return!(e?.dontUseNodeBuffer||!1)&&bGe?new a(Buffer.from(i)):(I9t||(I9t=new TextEncoder),new a(I9t.encode(i)))}static fromByteArray(i){let e=a.alloc(i.length);for(let t=0,o=i.length;t<o;t++)e.buffer[t]=i[t];return e}static concat(i,e){if(typeof e>"u"){e=0;for(let n=0,r=i.length;n<r;n++)e+=i[n].byteLength}let t=a.alloc(e),o=0;for(let n=0,r=i.length;n<r;n++){let s=i[n];t.set(s,o),o+=s.byteLength}return t}static isNativeBuffer(i){return bGe&&Buffer.isBuffer(i)}constructor(i){this.buffer=i,this.byteLength=this.buffer.byteLength}clone(){let i=a.alloc(this.byteLength);return i.set(this),i}toString(){return bGe?this.buffer.toString():(y9t||(y9t=new TextDecoder(void 0,{ignoreBOM:!0})),y9t.decode(this.buffer))}slice(i,e){return new a(this.buffer.subarray(i,e))}set(i,e){if(i instanceof a)this.buffer.set(i.buffer,e);else if(i instanceof Uint8Array)this.buffer.set(i,e);else if(i instanceof ArrayBuffer)this.buffer.set(new Uint8Array(i),e);else if(ArrayBuffer.isView(i))this.buffer.set(new Uint8Array(i.buffer,i.byteOffset,i.byteLength),e);else throw new Error("Unknown argument 'array'")}readUInt32BE(i){return DI(this.buffer,i)}writeUInt32BE(i,e){LI(this.buffer,i,e)}readUInt32LE(i){return XLo(this.buffer,i)}writeUInt32LE(i,e){JLo(this.buffer,i,e)}readUInt8(i){return Lpt(this.buffer,i)}writeUInt8(i,e){Rpt(this.buffer,i,e)}indexOf(i,e=0){return YLo(this.buffer,i instanceof a?i.buffer:i,e)}equals(i){return this===i?!0:this.byteLength!==i.byteLength?!1:this.buffer.every((e,t)=>e===i.buffer[t])}};function YLo(a,i,e=0){let t=i.byteLength,o=a.byteLength;if(t===0)return 0;if(t===1)return a.indexOf(i[0],e);if(t>o-e)return-1;let n=QLo.value;n.fill(i.length);for(let c=0;c<i.length;c++)n[i[c]]=i.length-c-1;let r=e+i.length-1,s=r,l=-1;for(;r<o;)if(a[r]===i[s]){if(s===0){l=r;break}r--,s--}else r+=Math.max(i.length-s,n[a[r]]),s=i.length-1;return l}function U1i(a,i){return a[i+0]<<0>>>0|a[i+1]<<8>>>0}function z1i(a,i,e){a[e+0]=i&255,i=i>>>8,a[e+1]=i&255}function DI(a,i){return a[i]*2**24+a[i+1]*2**16+a[i+2]*2**8+a[i+3]}function LI(a,i,e){a[e+3]=i,i=i>>>8,a[e+2]=i,i=i>>>8,a[e+1]=i,i=i>>>8,a[e]=i}function XLo(a,i){return a[i+0]<<0>>>0|a[i+1]<<8>>>0|a[i+2]<<16>>>0|a[i+3]<<24>>>0}function JLo(a,i,e){a[e+0]=i&255,i=i>>>8,a[e+1]=i&255,i=i>>>8,a[e+2]=i&255,i=i>>>8,a[e+3]=i&255}function Lpt(a,i){return a[i]}function Rpt(a,i,e){a[e]=i}function Mpt(a){return P1i(a,i=>Je.concat(i))}function Nbe(a){return F1i(a)}function Kv(a){return w6(a,i=>Je.concat(i))}async function K1i(a){return a.ended?Je.concat(a.buffer):Je.concat([...a.buffer,await Kv(a.stream)])}function WT(a){return N1i(a,i=>Je.concat(i))}function Obe(a){return _I(i=>Je.concat(i),a)}function G1i(a,i){return W1i(a,i,e=>Je.concat(e))}function w9t(a,i){return V1i(a,i,e=>Je.concat(e))}function Sl(a){let i=0,e=0,t=0,o=new Uint8Array(Math.floor(a.length/4*3)),n=s=>{switch(e){case 3:o[t++]=i|s,e=0;break;case 2:o[t++]=i|s>>>2,i=s<<6,e=3;break;case 1:o[t++]=i|s>>>4,i=s<<4,e=2;break;default:i=s<<2,e=1}};for(let s=0;s<a.length;s++){let l=a.charCodeAt(s);if(l>=65&&l<=90)n(l-65);else if(l>=97&&l<=122)n(l-97+26);else if(l>=48&&l<=57)n(l-48+52);else if(l===43||l===45)n(62);else if(l===47||l===95)n(63);else{if(l===61)break;throw new SyntaxError(`Unexpected base64 character ${a[s]}`)}}let r=t;for(;e>0;)n(0);return Je.wrap(o).slice(0,r)}var ZLo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",eRo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";function Qd({buffer:a},i=!0,e=!1){let t=e?eRo:ZLo,o="",n=a.byteLength%3,r=0;for(;r<a.byteLength-n;r+=3){let s=a[r+0],l=a[r+1],c=a[r+2];o+=t[s>>>2],o+=t[(s<<4|l>>>4)&63],o+=t[(l<<2|c>>>6)&63],o+=t[c&63]}if(n===1){let s=a[r+0];o+=t[s>>>2],o+=t[s<<4&63],i&&(o+="==")}else if(n===2){let s=a[r+0],l=a[r+1];o+=t[s>>>2],o+=t[(s<<4|l>>>4)&63],o+=t[l<<2&63],i&&(o+="=")}return o}var B1i="0123456789abcdef";function b$({buffer:a}){let i="";for(let e=0;e<a.length;e++){let t=a[e];i+=B1i[t>>>4],i+=B1i[t&15]}return i}function Fbe(a){if(a.length%2!==0)throw new SyntaxError("Hex string must have an even length");let i=new Uint8Array(a.length>>1);for(let e=0;e<a.length;)i[e>>1]=H1i(a,e++)<<4|H1i(a,e++);return Je.wrap(i)}function H1i(a,i){let e=a.charCodeAt(i);if(e>=48&&e<=57)return e-48;if(e>=97&&e<=102)return e-87;if(e>=65&&e<=70)return e-55;throw new SyntaxError(`Invalid hex character at position ${i}`)}function Ir(a){return SGe(a,0)}function SGe(a,i){switch(typeof a){case"object":return a===null?S$(349,i):Array.isArray(a)?iRo(a,i):oRo(a,i);case"string":return Vbe(a,i);case"boolean":return tRo(a,i);case"number":return S$(a,i);case"undefined":return S$(937,i);default:return S$(617,i)}}function S$(a,i){return(i<<5)-i+a|0}function tRo(a,i){return S$(a?433:863,i)}function Vbe(a,i){i=S$(149417,i);for(let e=0,t=a.length;e<t;e++)i=S$(a.charCodeAt(e),i);return i}function iRo(a,i){return i=S$(104579,i),a.reduce((e,t)=>SGe(t,e),i)}function oRo(a,i){return i=S$(181387,i),Object.keys(a).sort().reduce((e,t)=>(e=Vbe(t,e),SGe(a[t],e)),i)}var Q0=a=>{if(typeof a=="string"&&a.length<250){let e=new Ly;return e.update(a),Promise.resolve(e.digest())}let i;return typeof a=="string"?i=new TextEncoder().encode(a):a instanceof Je?i=a.buffer:i=a,crypto.subtle.digest("sha-1",i).then(Wbe)};function x9t(a,i,e=32){let t=e-i,o=~((1<<t)-1);return(a<<i|(o&a)>>>t)>>>0}function Wbe(a,i=32){return a instanceof ArrayBuffer?b$(Je.wrap(new Uint8Array(a))):(a>>>0).toString(16).padStart(i/4,"0")}var Ly=class a{constructor(){this._h0=1732584193;this._h1=4023233417;this._h2=2562383102;this._h3=271733878;this._h4=3285377520;this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}static{this._bigBlock32=new DataView(new ArrayBuffer(320))}update(i){let e=i.length;if(e===0)return;let t=this._buff,o=this._buffLen,n=this._leftoverHighSurrogate,r,s;for(n!==0?(r=n,s=-1,n=0):(r=i.charCodeAt(0),s=0);;){let l=r;if(Ru(r))if(s+1<e){let c=i.charCodeAt(s+1);nN(c)?(s++,l=fpt(r,c)):l=65533}else{n=r;break}else nN(r)&&(l=65533);if(o=this._push(t,o,l),s++,s<e)r=i.charCodeAt(s);else break}this._buffLen=o,this._leftoverHighSurrogate=n}_push(i,e,t){return t<128?i[e++]=t:t<2048?(i[e++]=192|(t&1984)>>>6,i[e++]=128|(t&63)>>>0):t<65536?(i[e++]=224|(t&61440)>>>12,i[e++]=128|(t&4032)>>>6,i[e++]=128|(t&63)>>>0):(i[e++]=240|(t&1835008)>>>18,i[e++]=128|(t&258048)>>>12,i[e++]=128|(t&4032)>>>6,i[e++]=128|(t&63)>>>0),e>=64&&(this._step(),e-=64,this._totalLen+=64,i[0]=i[64],i[1]=i[65],i[2]=i[66]),e}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),Wbe(this._h0)+Wbe(this._h1)+Wbe(this._h2)+Wbe(this._h3)+Wbe(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,this._buff.subarray(this._buffLen).fill(0),this._buffLen>56&&(this._step(),this._buff.fill(0));let i=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(i/4294967296),!1),this._buffDV.setUint32(60,i%4294967296,!1),this._step()}_step(){let i=a._bigBlock32,e=this._buffDV;for(let p=0;p<64;p+=4)i.setUint32(p,e.getUint32(p,!1),!1);for(let p=64;p<320;p+=4)i.setUint32(p,x9t(i.getUint32(p-12,!1)^i.getUint32(p-32,!1)^i.getUint32(p-56,!1)^i.getUint32(p-64,!1),1),!1);let t=this._h0,o=this._h1,n=this._h2,r=this._h3,s=this._h4,l,c,u;for(let p=0;p<80;p++)p<20?(l=o&n|~o&r,c=1518500249):p<40?(l=o^n^r,c=1859775393):p<60?(l=o&n|o&r|n&r,c=2400959708):(l=o^n^r,c=3395469782),u=x9t(t,5)+l+s+c+i.getUint32(p*4,!1)&4294967295,s=r,r=n,n=x9t(o,30),o=t,t=u;this._h0=this._h0+t&4294967295,this._h1=this._h1+o&4294967295,this._h2=this._h2+n&4294967295,this._h3=this._h3+r&4294967295,this._h4=this._h4+s&4294967295}};function Kn(a,i,e){return Math.min(Math.max(a,i),e)}function Y0(a,i){return(i+a%i)%i}var IGe=class{constructor(){this._n=1;this._val=0}update(i){return this._val=this._val+(i-this._val)/this._n,this._n+=1,this._val}get value(){return this._val}},Ppt=class{constructor(i){this._n=0;this._val=0;this._values=[];this._index=0;this._sum=0;this._values=new Array(i),this._values.fill(0,0,i)}update(i){let e=this._values[this._index];return this._values[this._index]=i,this._index=(this._index+1)%this._values.length,this._sum-=e,this._sum+=i,this._n<this._values.length&&(this._n+=1),this._val=this._sum/this._n,this._val}get value(){return this._val}};function $1i(a,i,e,t,o,n,r,s){let l=r-e,c=s-t,u=o-e,p=n-t,h=a-e,g=i-t,f=l*l+c*c,v=l*u+c*p,b=l*h+c*g,S=u*u+p*p,y=u*h+p*g,w=1/(f*S-v*v),k=(S*b-v*y)*w,T=(f*y-v*b)*w;return k>=0&&T>=0&&k+T<1}function q1i(a){return Ey(a>=0&&a<=1,"p must be between 0 and 1"),Math.random()<a}var Pu=class{constructor(i,e,t){this.owner=i;this.debugNameSource=e;this.referenceFn=t}getDebugName(i){return E9t(i,this)}},j1i=new Map,k9t=new WeakMap;function E9t(a,i){let e=k9t.get(a);if(e)return e;let t=nRo(a,i);if(t){let o=j1i.get(t)??0;o++,j1i.set(t,o);let n=o===1?t:`${t}#${o}`;return k9t.set(a,n),n}}function nRo(a,i){let e=k9t.get(a);if(e)return e;let t=i.owner?sRo(i.owner)+".":"",o,n=i.debugNameSource;if(n!==void 0)if(typeof n=="function"){if(o=n(),o!==void 0)return t+o}else return t+n;let r=i.referenceFn;if(r!==void 0&&(o=yGe(r),o!==void 0))return t+o;if(i.owner!==void 0){let s=rRo(i.owner,a);if(s!==void 0)return t+s}}function rRo(a,i){for(let e in a)if(a[e]===i)return e}var Q1i=new Map,Y1i=new WeakMap;function sRo(a){let i=Y1i.get(a);if(i)return i;let e=T9t(a)??"Object",t=Q1i.get(e)??0;t++,Q1i.set(e,t);let o=t===1?e:`${e}#${t}`;return Y1i.set(a,o),o}function T9t(a){let i=a.constructor;if(i)return i.name==="Object"?void 0:i.name}function yGe(a){let i=a.toString(),t=/\/\*\*\s*@description\s*([^*]*)\*\//.exec(i);return(t?t[1]:void 0)?.trim()}function hf(a,i){return a===i}function aRo(){return(a,i)=>a===i}function D9t(a,i,e){return $i(a,i,e??hf)}function lN(a){return(i,e)=>$i(i,e,a??hf)}function VT(a,i){if(a===i)return!0;if(Array.isArray(a)&&Array.isArray(i)){if(a.length!==i.length)return!1;for(let e=0;e<a.length;e++)if(!VT(a[e],i[e]))return!1;return!0}if(a&&typeof a=="object"&&i&&typeof i=="object"&&Object.getPrototypeOf(a)===Object.prototype&&Object.getPrototypeOf(i)===Object.prototype){let e=a,t=i,o=Object.keys(e),n=Object.keys(t),r=new Set(n);if(o.length!==n.length)return!1;for(let s of o)if(!r.has(s)||!VT(e[s],t[s]))return!1;return!0}return!1}function lRo(){return(a,i)=>VT(a,i)}function J1i(a){return JSON.stringify(_9t(a))}var cRo=0,X1i=new WeakMap;function _9t(a){if(Array.isArray(a))return a.map(_9t);if(a&&typeof a=="object")if(Object.getPrototypeOf(a)===Object.prototype){let i=a,e=Object.create(null);for(let t of Object.keys(i).sort())e[t]=_9t(i[t]);return e}else{let i=X1i.get(a);return i===void 0&&(i=cRo++,X1i.set(a,i)),i+"----2b76a038c20c4bcc"}return a}function dRo(a,i){return JSON.stringify(a)===JSON.stringify(i)}function uRo(){return(a,i)=>JSON.stringify(a)===JSON.stringify(i)}function C6(){return(a,i)=>a.equals(i)}function L9t(a,i,e){return a==null||i===void 0||i===null?i===a:e(a,i)}function aU(a){return(i,e)=>i==null||e===void 0||e===null?e===i:a(i,e)}var Apt;(p=>(p.strict=hf,p.strictC=aRo,p.array=D9t,p.arrayC=lN,p.structural=VT,p.structuralC=lRo,p.jsonStringify=dRo,p.jsonStringifyC=uRo,p.thisC=C6,p.ifDefined=L9t,p.ifDefinedC=aU))(Apt||={});function R9t(a){let i=new Error("BugIndicatingErrorRecovery: "+a);mt(i),console.error("recovered from an error that indicates a bug",i)}var Rre;function wGe(a){Rre?Rre instanceof Npt?Rre.loggers.push(a):Rre=new Npt([Rre,a]):Rre=a}function Ph(){return Rre}var M9t;function Z1i(a){M9t=a}function ezi(a){M9t&&M9t(a)}var Npt=class{constructor(i){this.loggers=i}handleObservableCreated(i,e){for(let t of this.loggers)t.handleObservableCreated(i,e)}handleOnListenerCountChanged(i,e){for(let t of this.loggers)t.handleOnListenerCountChanged(i,e)}handleObservableUpdated(i,e){for(let t of this.loggers)t.handleObservableUpdated(i,e)}handleAutorunCreated(i,e){for(let t of this.loggers)t.handleAutorunCreated(i,e)}handleAutorunDisposed(i){for(let e of this.loggers)e.handleAutorunDisposed(i)}handleAutorunDependencyChanged(i,e,t){for(let o of this.loggers)o.handleAutorunDependencyChanged(i,e,t)}handleAutorunStarted(i){for(let e of this.loggers)e.handleAutorunStarted(i)}handleAutorunFinished(i){for(let e of this.loggers)e.handleAutorunFinished(i)}handleDerivedDependencyChanged(i,e,t){for(let o of this.loggers)o.handleDerivedDependencyChanged(i,e,t)}handleDerivedCleared(i){for(let e of this.loggers)e.handleDerivedCleared(i)}handleBeginTransaction(i){for(let e of this.loggers)e.handleBeginTransaction(i)}handleEndTransaction(i){for(let e of this.loggers)e.handleEndTransaction(i)}};function Ui(a,i){let e=new cN(a,i);try{a(e)}finally{e.finish()}}var Opt;function x6(a){if(Opt)a(Opt);else{let i=new cN(a,void 0);Opt=i;try{a(i)}finally{i.finish(),Opt=void 0}}}async function P9t(a,i){let e=new cN(a,i);try{await a(e)}finally{e.finish()}}function dN(a,i,e){a?i(a):Ui(i,e)}var cN=class{constructor(i,e){this._fn=i;this._getDebugName=e;this._updatingObservers=[];Ph()?.handleBeginTransaction(this)}getDebugName(){return this._getDebugName?this._getDebugName():yGe(this._fn)}updateObserver(i,e){if(!this._updatingObservers){R9t("Transaction already finished!"),Ui(t=>{t.updateObserver(i,e)});return}this._updatingObservers.push({observer:i,observable:e}),i.beginUpdate(e)}finish(){let i=this._updatingObservers;if(!i){R9t("transaction.finish() has already been called!");return}for(let e=0;e<i.length;e++){let{observer:t,observable:o}=i[e];t.endUpdate(o)}this._updatingObservers=null,Ph()?.handleEndTransaction(this)}debugGetUpdatingObservers(){return this._updatingObservers}};var Il;(t=>{let a=!1;function i(){a=!0}t.enable=i;function e(){if(!a)return;let o=Error,n=o.stackTraceLimit;o.stackTraceLimit=3;let r=new Error().stack;return o.stackTraceLimit=n,A9t.fromStack(r,2)}t.ofCaller=e})(Il||={});var A9t=class a{constructor(i,e,t,o){this.fileName=i;this.line=e;this.column=t;this.id=o}static fromStack(i,e){let t=i.split(`
`),o=pRo(t[e+1]);if(o)return new a(o.fileName,o.line,o.column,o.id)}};function pRo(a){let i=a.match(/\((.*):(\d+):(\d+)\)/);if(i)return{fileName:i[1],line:parseInt(i[2]),column:parseInt(i[3]),id:a};let e=a.match(/at ([^\(\)]*):(\d+):(\d+)/);if(e)return{fileName:e[1],line:parseInt(e[2]),column:parseInt(e[3]),id:a}}var N9t;function tzi(a){N9t=a}var izi;function ozi(a){izi=a}var nzi;function rzi(a){nzi=a}var O9t;function szi(a){O9t=a}var CGe=class{get TChange(){return null}reportChanges(){this.get()}read(i){return i?i.readObservable(this):this.get()}map(i,e,t=Il.ofCaller()){let o=e===void 0?void 0:i,n=e===void 0?i:e;return N9t({owner:o,debugName:()=>{let r=yGe(n);if(r!==void 0)return r;let l=/^\s*\(?\s*([a-zA-Z_$][a-zA-Z_$0-9]*)\s*\)?\s*=>\s*\1(?:\??)\.([a-zA-Z_$][a-zA-Z_$0-9]*)\s*$/.exec(n.toString());if(l)return`${this.debugName}.${l[2]}`;if(!o)return`${this.debugName} (mapped)`},debugReferenceFn:n},r=>n(this.read(r),r),t)}flatten(){return N9t({owner:void 0,debugName:()=>`${this.debugName} (flattened)`},i=>this.read(i).read(i))}recomputeInitiallyAndOnChange(i,e){return i.add(izi(this,e)),this}keepObserved(i){return i.add(nzi(this)),this}get debugValue(){return this.get()}get debug(){return new F9t(this)}},F9t=class{constructor(i){this.observable=i}getDependencyGraph(){return O9t(this.observable,{type:"dependencies"})}getObserverGraph(){return O9t(this.observable,{type:"observers"})}},YD=class extends CGe{constructor(e){super();this._observers=new Set;Ph()?.handleObservableCreated(this,e)}addObserver(e){let t=this._observers.size;this._observers.add(e),t===0&&this.onFirstObserverAdded(),t!==this._observers.size&&Ph()?.handleOnListenerCountChanged(this,this._observers.size)}removeObserver(e){let t=this._observers.delete(e);t&&this._observers.size===0&&this.onLastObserverRemoved(),t&&Ph()?.handleOnListenerCountChanged(this,this._observers.size)}onFirstObserverAdded(){}onLastObserverRemoved(){}log(){let e=!!Ph();return ezi(this),e||Ph()?.handleObservableCreated(this,Il.ofCaller()),this}debugGetObservers(){return this._observers}};function Le(a,i,e=Il.ofCaller()){let t;return typeof a=="string"?t=new Pu(void 0,a,void 0):t=new Pu(a,void 0,void 0),new CM(t,i,hf,e)}var CM=class extends YD{constructor(e,t,o,n){super(n);this._debugNameData=e;this._equalityComparator=o;this._value=t,Ph()?.handleObservableUpdated(this,{hadValue:!1,newValue:t,change:void 0,didChange:!0,oldValue:void 0})}get debugName(){return this._debugNameData.getDebugName(this)??"ObservableValue"}get(){return this._value}set(e,t,o){if(o===void 0&&this._equalityComparator(this._value,e))return;let n;t||(t=n=new cN(()=>{},()=>`Setting ${this.debugName}`));try{let r=this._value;this._setValue(e),Ph()?.handleObservableUpdated(this,{oldValue:r,newValue:e,change:o,didChange:!0,hadValue:!0});for(let s of this._observers)t.updateObserver(s,this),s.handleChange(this,o)}finally{n&&n.finish()}}toString(){return`${this.debugName}: ${this._value}`}_setValue(e){this._value=e}debugGetState(){return{value:this._value}}debugSetValue(e){this._value=e}};function X0(a,i,e=Il.ofCaller()){let t;return typeof a=="string"?t=new Pu(void 0,a,void 0):t=new Pu(a,void 0,void 0),new W9t(t,i,hf,e)}var W9t=class extends CM{_setValue(i){this._value!==i&&(this._value&&this._value.dispose(),this._value=i)}dispose(){this._value?.dispose()}};var Fpt=class extends YD{constructor(e,t,o,n){super(n);this._debugNameData=e;this._equalityComparator=o;this._isUpToDate=!0;this._deltas=[];this._updateCounter=0;this._value=t}get debugName(){return this._debugNameData.getDebugName(this)??"LazyObservableValue"}get(){return this._update(),this._value}_update(){if(!this._isUpToDate)if(this._isUpToDate=!0,this._deltas.length>0){for(let e of this._deltas){Ph()?.handleObservableUpdated(this,{change:e,didChange:!0,oldValue:"(unknown)",newValue:this._value,hadValue:!0});for(let t of this._observers)t.handleChange(this,e)}this._deltas.length=0}else{Ph()?.handleObservableUpdated(this,{change:void 0,didChange:!0,oldValue:"(unknown)",newValue:this._value,hadValue:!0});for(let e of this._observers)e.handleChange(this,void 0)}}_beginUpdate(){if(this._updateCounter++,this._updateCounter===1)for(let e of this._observers)e.beginUpdate(this)}_endUpdate(){if(this._updateCounter--,this._updateCounter===0){this._update();let e=[...this._observers];for(let t of e)t.endUpdate(this)}}addObserver(e){let t=!this._observers.has(e)&&this._updateCounter>0;super.addObserver(e),t&&e.beginUpdate(this)}removeObserver(e){let t=this._observers.has(e)&&this._updateCounter>0;super.removeObserver(e),t&&e.endUpdate(this)}set(e,t,o){if(o===void 0&&this._equalityComparator(this._value,e))return;let n;t||(t=n=new cN(()=>{},()=>`Setting ${this.debugName}`));try{if(this._isUpToDate=!1,this._setValue(e),o!==void 0&&this._deltas.push(o),t.updateObserver({beginUpdate:()=>this._beginUpdate(),endUpdate:()=>this._endUpdate(),handleChange:(r,s)=>{},handlePossibleChange:r=>{}},this),this._updateCounter>1)for(let r of this._observers)r.handlePossibleChange(this)}finally{n&&n.finish()}}toString(){return`${this.debugName}: ${this._value}`}_setValue(e){this._value=e}};function rg(a,i,e=Il.ofCaller()){return a.lazy?new Fpt(new Pu(a.owner,a.debugName,void 0),i,a.equalsFn??hf,e):new CM(new Pu(a.owner,a.debugName,void 0),i,a.equalsFn??hf,e)}function mRo(a){switch(a){case 1:return"dependenciesMightHaveChanged";case 2:return"stale";case 3:return"upToDate";default:return"<unknown>"}}var J0=class{constructor(i,e,t,o){this._debugNameData=i;this._runFn=e;this._changeTracker=t;this._state=2;this._updateCount=0;this._disposed=!1;this._dependencies=new Set;this._dependenciesToBeRemoved=new Set;this._isRunning=!1;this._iteration=0;this._store=void 0;this._delayedStore=void 0;this._changeSummary=this._changeTracker?.createChangeSummary(void 0),Ph()?.handleAutorunCreated(this,o),this._run(),i$(this)}get debugName(){return this._debugNameData.getDebugName(this)??"(anonymous)"}dispose(){if(!this._disposed){this._disposed=!0;for(let i of this._dependencies)i.removeObserver(this);this._dependencies.clear(),this._store!==void 0&&this._store.dispose(),this._delayedStore!==void 0&&this._delayedStore.dispose(),Ph()?.handleAutorunDisposed(this),o$(this)}}_run(){let i=this._dependenciesToBeRemoved;this._dependenciesToBeRemoved=this._dependencies,this._dependencies=i,this._state=3;try{if(!this._disposed){Ph()?.handleAutorunStarted(this);let e=this._changeSummary,t=this._delayedStore;t!==void 0&&(this._delayedStore=void 0);try{this._isRunning=!0,this._changeTracker&&(this._changeTracker.beforeUpdate?.(this,e),this._changeSummary=this._changeTracker.createChangeSummary(e)),this._store!==void 0&&(this._store.dispose(),this._store=void 0),this._runFn(this,e)}catch(o){o6(o)}finally{this._isRunning=!1,t!==void 0&&t.dispose()}}}finally{this._disposed||Ph()?.handleAutorunFinished(this);for(let e of this._dependenciesToBeRemoved)e.removeObserver(this);this._dependenciesToBeRemoved.clear()}}toString(){return`Autorun<${this.debugName}>`}beginUpdate(i){this._state===3&&(this._checkIterations(),this._state=1),this._updateCount++}endUpdate(i){try{if(this._updateCount===1){this._iteration=1;do{if(this._checkIterations())return;if(this._state===1){this._state=3;for(let e of this._dependencies)if(e.reportChanges(),this._state===2)break}this._iteration++,this._state!==3&&this._run()}while(this._state!==3)}}finally{this._updateCount--}eh(()=>this._updateCount>=0)}handlePossibleChange(i){this._state===3&&this._isDependency(i)&&(this._checkIterations(),this._state=1)}handleChange(i,e){if(this._isDependency(i)){Ph()?.handleAutorunDependencyChanged(this,i,e);try{(!this._changeTracker||this._changeTracker.handleChange({changedObservable:i,change:e,didChange:o=>o===i},this._changeSummary))&&(this._checkIterations(),this._state=2)}catch(t){o6(t)}}}_isDependency(i){return this._dependencies.has(i)&&!this._dependenciesToBeRemoved.has(i)}_ensureNoRunning(){if(!this._isRunning)throw new ni("The reader object cannot be used outside its compute function!")}readObservable(i){if(this._ensureNoRunning(),this._disposed)return i.get();i.addObserver(this);let e=i.get();return this._dependencies.add(i),this._dependenciesToBeRemoved.delete(i),e}get store(){if(this._ensureNoRunning(),this._disposed)throw new ni("Cannot access store after dispose");return this._store===void 0&&(this._store=new P),this._store}get delayedStore(){if(this._ensureNoRunning(),this._disposed)throw new ni("Cannot access store after dispose");return this._delayedStore===void 0&&(this._delayedStore=new P),this._delayedStore}debugGetState(){return{isRunning:this._isRunning,updateCount:this._updateCount,dependencies:this._dependencies,state:this._state,stateStr:mRo(this._state)}}debugRerun(){this._isRunning?this._state=2:this._run()}_checkIterations(){return this._iteration>100?(o6(new ni(`Autorun '${this.debugName}' is stuck in an infinite update loop.`)),!0):!1}};function he(a,i=Il.ofCaller()){return new J0(new Pu(void 0,void 0,a),a,void 0,i)}function XD(a,i,e=Il.ofCaller()){return new J0(new Pu(a.owner,a.debugName,a.debugReferenceFn??i),i,void 0,e)}function xM(a,i,e=Il.ofCaller()){return new J0(new Pu(a.owner,a.debugName,a.debugReferenceFn??i),i,a.changeTracker,e)}function V9t(a,i){let e=new P,t=xM({owner:a.owner,debugName:a.debugName,debugReferenceFn:a.debugReferenceFn??i,changeTracker:a.changeTracker},(o,n)=>{e.clear(),i(o,n,e)});return Z(()=>{t.dispose(),e.dispose()})}function Ga(a){let i=new P,e=XD({owner:void 0,debugName:void 0,debugReferenceFn:a},t=>{i.clear(),a(t,i)});return Z(()=>{e.dispose(),i.dispose()})}function Mre(a,i){let e;return XD({debugReferenceFn:i},t=>{let o=a.read(t),n=e;e=o,i({lastValue:n,newValue:o})})}function I$(a,i,e=t=>t){let t=new Map;return XD({debugReferenceFn:a},o=>{let n=new Map,r=new Map(t);for(let s of a(o)){let l=e(s);t.has(l)?r.delete(l):(n.set(l,s),t.set(l,s))}for(let s of r.keys())t.delete(s);(n.size||r.size)&&i({addedValues:[...n.values()],removedValues:[...r.values()]})})}function ux(a,i=Il.ofCaller()){let e,t=!1;return e=he(o=>{a({delayedStore:o.delayedStore,store:o.store,readObservable:o.readObservable.bind(o),dispose:()=>{e?.dispose(),t=!0}})},i),t&&e.dispose(),e}function hRo(a){switch(a){case 0:return"initial";case 1:return"dependenciesMightHaveChanged";case 2:return"stale";case 3:return"upToDate";default:return"<unknown>"}}var Gv=class extends YD{constructor(e,t,o,n=void 0,r,s){super(s);this._debugNameData=e;this._computeFn=t;this._changeTracker=o;this._handleLastObserverRemoved=n;this._equalityComparator=r;this._state=0;this._value=void 0;this._updateCount=0;this._dependencies=new Set;this._dependenciesToBeRemoved=new Set;this._changeSummary=void 0;this._isUpdating=!1;this._isComputing=!1;this._didReportChange=!1;this._isInBeforeUpdate=!1;this._isReaderValid=!1;this._store=void 0;this._delayedStore=void 0;this._removedObserverToCallEndUpdateOn=null;this._changeSummary=this._changeTracker?.createChangeSummary(void 0)}get debugName(){return this._debugNameData.getDebugName(this)??"(anonymous)"}onLastObserverRemoved(){this._state=0,this._value=void 0,Ph()?.handleDerivedCleared(this);for(let e of this._dependencies)e.removeObserver(this);this._dependencies.clear(),this._store!==void 0&&(this._store.dispose(),this._store=void 0),this._delayedStore!==void 0&&(this._delayedStore.dispose(),this._delayedStore=void 0),this._handleLastObserverRemoved?.()}get(){if(this._isComputing,this._observers.size===0){let t;try{this._isReaderValid=!0;let o;this._changeTracker&&(o=this._changeTracker.createChangeSummary(void 0),this._changeTracker.beforeUpdate?.(this,o)),t=this._computeFn(this,o)}finally{this._isReaderValid=!1}return this.onLastObserverRemoved(),t}else{do{if(this._state===1){for(let t of this._dependencies)if(t.reportChanges(),this._state===2)break}this._state===1&&(this._state=3),this._state!==3&&this._recompute()}while(this._state!==3);return this._value}}_recompute(){let e=!1;this._isComputing=!0,this._didReportChange=!1;let t=this._dependenciesToBeRemoved;this._dependenciesToBeRemoved=this._dependencies,this._dependencies=t;try{let o=this._changeSummary;this._isReaderValid=!0,this._changeTracker&&(this._isInBeforeUpdate=!0,this._changeTracker.beforeUpdate?.(this,o),this._isInBeforeUpdate=!1,this._changeSummary=this._changeTracker?.createChangeSummary(o));let n=this._state!==0,r=this._value;this._state=3;let s=this._delayedStore;s!==void 0&&(this._delayedStore=void 0);try{this._store!==void 0&&(this._store.dispose(),this._store=void 0),this._value=this._computeFn(this,o)}finally{this._isReaderValid=!1;for(let l of this._dependenciesToBeRemoved)l.removeObserver(this);this._dependenciesToBeRemoved.clear(),s!==void 0&&s.dispose()}e=this._didReportChange||n&&!this._equalityComparator(r,this._value),Ph()?.handleObservableUpdated(this,{oldValue:r,newValue:this._value,change:void 0,didChange:e,hadValue:n})}catch(o){o6(o)}if(this._isComputing=!1,!this._didReportChange&&e)for(let o of this._observers)o.handleChange(this,void 0);else this._didReportChange=!1}toString(){return`LazyDerived<${this.debugName}>`}beginUpdate(e){if(this._isUpdating)throw new ni("Cyclic deriveds are not supported yet!");this._updateCount++,this._isUpdating=!0;try{let t=this._updateCount===1;if(this._state===3&&(this._state=1,!t))for(let o of this._observers)o.handlePossibleChange(this);if(t)for(let o of this._observers)o.beginUpdate(this)}finally{this._isUpdating=!1}}endUpdate(e){if(this._updateCount--,this._updateCount===0){let t=[...this._observers];for(let o of t)o.endUpdate(this);if(this._removedObserverToCallEndUpdateOn){let o=[...this._removedObserverToCallEndUpdateOn];this._removedObserverToCallEndUpdateOn=null;for(let n of o)n.endUpdate(this)}}eh(()=>this._updateCount>=0)}handlePossibleChange(e){if(this._state===3&&this._dependencies.has(e)&&!this._dependenciesToBeRemoved.has(e)){this._state=1;for(let t of this._observers)t.handlePossibleChange(this)}}handleChange(e,t){if(this._dependencies.has(e)&&!this._dependenciesToBeRemoved.has(e)||this._isInBeforeUpdate){Ph()?.handleDerivedDependencyChanged(this,e,t);let o=!1;try{o=this._changeTracker?this._changeTracker.handleChange({changedObservable:e,change:t,didChange:r=>r===e},this._changeSummary):!0}catch(r){o6(r)}let n=this._state===3;if(o&&(this._state===1||n)&&(this._state=2,n))for(let r of this._observers)r.handlePossibleChange(this)}}_ensureReaderValid(){if(!this._isReaderValid)throw new ni("The reader object cannot be used outside its compute function!")}readObservable(e){this._ensureReaderValid(),e.addObserver(this);let t=e.get();return this._dependencies.add(e),this._dependenciesToBeRemoved.delete(e),t}reportChange(e){this._ensureReaderValid(),this._didReportChange=!0;for(let t of this._observers)t.handleChange(this,e)}get store(){return this._ensureReaderValid(),this._store===void 0&&(this._store=new P),this._store}get delayedStore(){return this._ensureReaderValid(),this._delayedStore===void 0&&(this._delayedStore=new P),this._delayedStore}addObserver(e){let t=!this._observers.has(e)&&this._updateCount>0;super.addObserver(e),t&&(this._removedObserverToCallEndUpdateOn?.delete(e)||e.beginUpdate(this))}removeObserver(e){this._observers.has(e)&&this._updateCount>0&&(this._removedObserverToCallEndUpdateOn||(this._removedObserverToCallEndUpdateOn=new Set),this._removedObserverToCallEndUpdateOn.add(e)),super.removeObserver(e)}debugGetState(){return{state:this._state,stateStr:hRo(this._state),updateCount:this._updateCount,isComputing:this._isComputing,dependencies:this._dependencies,value:this._value}}debugSetValue(e){this._value=e}debugRecompute(){this.beginUpdate(this);try{this._isComputing?this._state=2:this._recompute()}finally{this.endUpdate(this)}}setValue(e,t,o){this._value=e;let n=this._observers;t.updateObserver(this,this);for(let r of n)r.handleChange(this,o)}},Bbe=class extends Gv{constructor(e,t,o,n=void 0,r,s,l){super(e,t,o,n,r,l);this.set=s}};function Ce(a,i,e=Il.ofCaller()){return i!==void 0?new Gv(new Pu(a,void 0,i),i,void 0,void 0,hf,e):new Gv(new Pu(void 0,void 0,a),a,void 0,void 0,hf,e)}function y$(a,i,e,t=Il.ofCaller()){return new Bbe(new Pu(a,void 0,i),i,void 0,void 0,hf,e,t)}function hs(a,i,e=Il.ofCaller()){return new Gv(new Pu(a.owner,a.debugName,a.debugReferenceFn),i,void 0,a.onLastObserverRemoved,a.equalsFn??hf,e)}tzi(hs);function Hbe(a,i,e=Il.ofCaller()){return new Gv(new Pu(a.owner,a.debugName,void 0),i,a.changeTracker,void 0,a.equalityComparer??hf,e)}function RI(a,i,e=Il.ofCaller()){let t,o;i===void 0?(t=a,o=void 0):(o=a,t=i);let n;return new Gv(new Pu(o,void 0,t),r=>{n?n.clear():n=new P;let s=t(r);return s&&n.add(s),s},void 0,()=>{n&&(n.dispose(),n=void 0)},hf,e)}var Wpt=class{constructor(i){this._computeValue=i;this._value=Le(this,void 0)}get cachedValue(){return this._value}getValue(){let i=this._value.get();return i||(i=this._computeValue(),this._value.set(i,void 0)),i}},Au=class a{constructor(i){this._value=Le(this,void 0);this.promiseResult=this._value;this.resolvedValue=Ce(this,i=>{let e=this.promiseResult.read(i);if(e)return e.getDataOrThrow()});this.promise=i.then(e=>(Ui(t=>{this._value.set(new xGe(e,void 0),t)}),e),e=>{throw Ui(t=>{this._value.set(new xGe(void 0,e),t)}),e})}static fromFn(i){return new a(i())}static resolved(i){return new a(Promise.resolve(i))}},xGe=class{constructor(i,e){this.data=i;this.error=e}getDataOrThrow(){if(this.error)throw this.error;return this.data}},kGe=class{constructor(i){this._computePromise=i;this._lazyValue=new Wpt(()=>new Au(this._computePromise()));this.cachedPromiseResult=Ce(this,i=>this._lazyValue.cachedValue.read(i)?.promiseResult.read(i))}getPromise(){return this._lazyValue.getValue().promise}};function gf(a,i,e,t){return i||(i=o=>o!=null),new Promise((o,n)=>{let r=!0,s=!1,l=a.map(u=>({isFinished:i(u),error:e?e(u):!1,state:u})),c=he(u=>{let{isFinished:p,error:h,state:g}=l.read(u);(p||h)&&(r?s=!0:c.dispose(),h?n(h===!0?g:h):o(g))});if(t){let u=t.onCancellationRequested(()=>{c.dispose(),u.dispose(),n(new ho)});if(t.isCancellationRequested){c.dispose(),u.dispose(),n(new ho);return}}r=!1,s&&c.dispose()})}function ui(...a){let i,e,t,o;return a.length===2?[e,t]=a:[i,e,t,o]=a,new JD(new Pu(i,void 0,t),e,t,()=>JD.globalTransaction,hf,o??Il.ofCaller())}function ff(a,i,e,t=Il.ofCaller()){return new JD(new Pu(a.owner,a.debugName,a.debugReferenceFn??e),i,e,()=>a.getTransaction?.()??JD.globalTransaction,a.equalsFn??hf,t)}var JD=class extends YD{constructor(e,t,o,n,r,s){super(s);this._debugNameData=e;this.event=t;this._getValue=o;this._getTransaction=n;this._equalityComparator=r;this._hasValue=!1;this.handleEvent=e=>{let t=this._getValue(e),o=this._value,n=!this._hasValue||!this._equalityComparator(o,t),r=!1;n&&(this._value=t,this._hasValue&&(r=!0,dN(this._getTransaction(),s=>{Ph()?.handleObservableUpdated(this,{oldValue:o,newValue:t,change:void 0,didChange:n,hadValue:this._hasValue});for(let l of this._observers)s.updateObserver(l,this),l.handleChange(this,void 0)},()=>{let s=this.getDebugName();return"Event fired"+(s?`: ${s}`:"")})),this._hasValue=!0),r||Ph()?.handleObservableUpdated(this,{oldValue:o,newValue:t,change:void 0,didChange:n,hadValue:this._hasValue})}}getDebugName(){return this._debugNameData.getDebugName(this)}get debugName(){let e=this.getDebugName();return"From Event"+(e?`: ${e}`:"")}onFirstObserverAdded(){this._subscription=this.event(this.handleEvent)}onLastObserverRemoved(){this._subscription.dispose(),this._subscription=void 0,this._hasValue=!1,this._value=void 0}get(){return this._subscription?(this._hasValue||this.handleEvent(void 0),this._value):this._getValue(void 0)}debugSetValue(e){this._value=e}debugGetState(){return{value:this._value,hasValue:this._hasValue}}};(e=>{e.Observer=JD;function i(t,o){let n=!1;JD.globalTransaction===void 0&&(JD.globalTransaction=t,n=!0);try{o()}finally{n&&(JD.globalTransaction=void 0)}}e.batchEventsGlobally=i})(ui||={});function Wc(a,i=Il.ofCaller()){return typeof a=="string"?new Vpt(a,void 0,i):new Vpt(void 0,a,i)}var Vpt=class extends YD{constructor(e,t,o){super(o);this._debugName=e;this._owner=t}get debugName(){return new Pu(this._owner,this._debugName,void 0).getDebugName(this)??"Observable Signal"}toString(){return this.debugName}trigger(e,t){if(!e){Ui(o=>{this.trigger(o,t)},()=>`Trigger signal ${this.debugName}`);return}for(let o of this._observers)e.updateObserver(o,this),o.handleChange(this,t)}get(){}};function EGe(a){let i=Le("promiseValue",{});return a.then(e=>{i.set({value:e},void 0)}),i}function kM(a,i,e=Il.ofCaller()){let t=!1,o,n;return ui(void 0,r=>{let s=he(l=>{let c=a.read(l);if(!t)t=!0,o=c;else{n&&clearTimeout(n);let u=typeof i=="number"?i:i(o,c);if(u===0){o=c,r();return}n=setTimeout(()=>{o=c,r()},u)}});return{dispose(){s.dispose(),t=!1,o=void 0}}},()=>t?o:a.get(),e)}function B9t(a,i,e=Il.ofCaller()){let t=Wc("handleTimeout"),o,n;return hs({owner:void 0,onLastObserverRemoved:()=>{o=void 0}},s=>{let l=a.read(s);if(t.read(s),l!==o){let c=typeof i=="number"?i:i(o,l);if(c===0)return o=l,l;n&&clearTimeout(n),n=setTimeout(()=>{o=l,t.trigger(void 0)},c)}return o},e)}function H9t(a,i,e){let t=Le("triggeredRecently",!1),o;return e.add(a(()=>{t.set(!0,void 0),o&&clearTimeout(o),o=setTimeout(()=>{t.set(!1,void 0)},i)})),t}function lU(a){let i=new Bpt(!1,void 0);return a.addObserver(i),Z(()=>{a.removeObserver(i)})}rzi(lU);function EM(a,i){let e=new Bpt(!0,i);a.addObserver(e);try{e.beginUpdate(a)}finally{e.endUpdate(a)}return Z(()=>{a.removeObserver(e)})}ozi(EM);var Bpt=class{constructor(i,e){this._forceRecompute=i;this._handleValue=e;this._counter=0}beginUpdate(i){this._counter++}endUpdate(i){this._counter===1&&this._forceRecompute&&(this._handleValue?this._handleValue(i.get()):i.reportChanges()),this._counter--}handlePossibleChange(i){}handleChange(i,e){}};function vf(a,i){let e;return hs({owner:a,debugReferenceFn:i},o=>(e=i(o,e),e))}function TGe(a,i){let e,t=Wc("derivedObservableWithWritableCache"),o=Ce(a,n=>(t.read(n),e=i(n,e),e));return Object.assign(o,{clearCache:n=>{e=void 0,t.trigger(n)},setCache:(n,r)=>{e=n,t.trigger(r)}})}function $v(a,i,e,t){let o=new Hpt(e,t);return hs({debugReferenceFn:e,owner:a,onLastObserverRemoved:()=>{o.dispose(),o=new Hpt(e)}},r=>{let s=i.read(r);return o.setItems(s),o.getItems()})}var Hpt=class{constructor(i,e){this._map=i;this._keySelector=e;this._cache=new Map;this._items=[]}dispose(){this._cache.forEach(i=>i.store.dispose()),this._cache.clear()}setItems(i){let e=[],t=new Set(this._cache.keys());for(let o of i){let n=this._keySelector?this._keySelector(o):o,r=this._cache.get(n);if(r)t.delete(n);else{let s=new P;r={out:this._map(o,s),store:s},this._cache.set(n,r)}e.push(r.out)}for(let o of t)this._cache.get(o).store.dispose(),this._cache.delete(o);this._items=e}getItems(){return this._items}};function uN(a){return!!a&&a.read!==void 0&&a.reportChanges!==void 0}function U9t(a){return{createChangeSummary:i=>({changes:[]}),handleChange(i,e){for(let t in a)i.didChange(a[t])&&e.changes.push({key:t,change:i.change});return!0},beforeUpdate(i,e){for(let t in a){if(t==="changes")throw new ni('property name "changes" is reserved for change tracking');e[t]=a[t].read(i)}}}}function z9t(a){let i;return{createChangeSummary:e=>({changes:[]}),handleChange(e,t){i||(i=a());for(let o in i)e.didChange(i[o])&&t.changes.push({key:o,change:e.change});return!0},beforeUpdate(e,t){i||(i=a());for(let o in i){if(o==="changes")throw new ni('property name "changes" is reserved for change tracking');t[o]=i[o].read(e)}}}}function Oo(a){return new K9t(a)}var K9t=class extends CGe{constructor(e){super();this.value=e}get debugName(){return this.toString()}get(){return this.value}addObserver(e){}removeObserver(e){}log(){return this}toString(){return`Const: ${this.value}`}};function Nr(a,i,e=Il.ofCaller()){return new G9t(typeof a=="string"?a:new Pu(a,void 0,void 0),i,e)}var G9t=class extends YD{constructor(e,t,o){super(o);this.event=t;this.handleEvent=()=>{Ui(e=>{for(let t of this._observers)e.updateObserver(t,this),t.handleChange(this,void 0)},()=>this.debugName)};this.debugName=typeof e=="string"?e:e.getDebugName(this)??"Observable Signal From Event"}onFirstObserverAdded(){this.subscription=this.event(this.handleEvent)}onLastObserverRemoved(){this.subscription.dispose(),this.subscription=void 0}get(){}};var pN=class{constructor(i){this.observable=i}get onDidChange(){return H.fromObservableLight(this.observable)}get value(){return this.observable.get()}};function Pre(a,i){return i instanceof pN?i.observable:ui(a,i.onDidChange,()=>i.value)}function _s(a,i){let e,t=!0;return V9t({changeTracker:{createChangeSummary:()=>({deltas:[],didChange:!1}),handleChange:(o,n)=>{if(o.didChange(a)){let r=o.change;r!==void 0&&n.deltas.push(r),n.didChange=!0}return!0}}},(o,n)=>{let r=a.read(o),s=e;n.didChange&&(e=r,i(r,s,n.deltas)),t&&(t=!1,e=r)})}function Upt(a,i){let e=new P,t=_s(a,(o,n,r)=>{e.clear(),i(o,n,r,e)});return{dispose(){t.dispose(),e.dispose()}}}function $9t(a,i){return Upt(a,(e,t,o,n)=>{i(e,t,o,u6(n))})}function _Ge(a,i){if(i.length===0)throw new ni;let e=!1,t,o=ui(a,n=>{let r=new P;for(let s of i)r.add(XD({debugName:()=>E9t(o,new Pu(a,void 0,void 0))+".updateLastChangedValue"},l=>{e=!0,t=s.read(l),n()}));return r.add({dispose(){e=!1,t=void 0}}),r},()=>e?t:i[i.length-1].get());return o}function q9t(a,i){return vf(a,(e,t)=>t??i(e))}var k6=class{constructor(){this._data=new Set;this._obs=rg({equalsFn:()=>!1},this);this.observable=this._obs}get size(){return this._data.size}has(i){return this._data.has(i)}add(i,e){return this._data.has(i)||(this._data.add(i),this._obs.set(this,e)),this}delete(i,e){let t=this._data.delete(i);return t&&this._obs.set(this,e),t}clear(i){this._data.size>0&&(this._data.clear(),this._obs.set(this,i))}forEach(i,e){this._data.forEach((t,o,n)=>{i.call(e,t,o,this)})}*entries(){for(let i of this._data)yield[i,i]}*keys(){yield*this._data.keys()}*values(){yield*this._data.values()}[Symbol.iterator](){return this.values()}get[Symbol.toStringTag](){return"ObservableSet"}};var w$=class{constructor(){this._data=new Map;this._obs=rg({equalsFn:()=>!1},this);this.observable=this._obs}get size(){return this._data.size}has(i){return this._data.has(i)}get(i){return this._data.get(i)}set(i,e,t){let o=this._data.has(i),n=this._data.get(i);return(!o||n!==e)&&(this._data.set(i,e),this._obs.set(this,t)),this}delete(i,e){let t=this._data.delete(i);return t&&this._obs.set(this,e),t}clear(i){this._data.size>0&&(this._data.clear(),this._obs.set(this,i))}forEach(i,e){this._data.forEach((t,o,n)=>{i.call(e,t,o,this)})}*entries(){yield*this._data.entries()}*keys(){yield*this._data.keys()}*values(){yield*this._data.values()}[Symbol.iterator](){return this.entries()}get[Symbol.toStringTag](){return"ObservableMap"}};var zpt;function azi(a){zpt||(zpt=new DGe,wGe(zpt)),zpt.addFilteredObj(a)}var DGe=class{constructor(){this.indentation=0;this.changedObservablesSets=new WeakMap}addFilteredObj(i){this._filteredObjects||(this._filteredObjects=new Set),this._filteredObjects.add(i)}_isIncluded(i){return this._filteredObjects?.has(i)??!0}textToConsoleArgs(i){return gRo([Ube(bRo("| ",this.indentation)),i])}formatInfo(i){return i.hadValue?i.didChange?[Ube(" "),mN(TM(i.oldValue,70),{color:"red",strikeThrough:!0}),Ube(" "),mN(TM(i.newValue,60),{color:"green"})]:[Ube(" (unchanged)")]:[Ube(" "),mN(TM(i.newValue,60),{color:"green"}),Ube(" (initial)")]}handleObservableCreated(i){if(i instanceof Gv){let e=i;if(this.changedObservablesSets.set(e,new Set),!1){let o=[];e.__debugUpdating=o;let n=e.beginUpdate;e.beginUpdate=s=>(o.push(s),n.apply(e,[s]));let r=e.endUpdate;e.endUpdate=s=>{let l=o.indexOf(s);return l===-1&&console.error("endUpdate called without beginUpdate",e.debugName,s.debugName),o.splice(l,1),r.apply(e,[s])}}}}handleOnListenerCountChanged(i,e){}handleObservableUpdated(i,e){if(this._isIncluded(i)){if(i instanceof Gv){this._handleDerivedRecomputed(i,e);return}console.log(...this.textToConsoleArgs([zbe("observable value changed"),mN(i.debugName,{color:"BlueViolet"}),...this.formatInfo(e)]))}}formatChanges(i){if(i.size!==0)return mN(" (changed deps: "+[...i].map(e=>e.debugName).join(", ")+")",{color:"gray"})}handleDerivedDependencyChanged(i,e,t){this._isIncluded(i)&&this.changedObservablesSets.get(i)?.add(e)}_handleDerivedRecomputed(i,e){if(!this._isIncluded(i))return;let t=this.changedObservablesSets.get(i);t&&(console.log(...this.textToConsoleArgs([zbe("derived recomputed"),mN(i.debugName,{color:"BlueViolet"}),...this.formatInfo(e),this.formatChanges(t),{data:[{fn:i._debugNameData.referenceFn??i._computeFn}]}])),t.clear())}handleDerivedCleared(i){this._isIncluded(i)&&console.log(...this.textToConsoleArgs([zbe("derived cleared"),mN(i.debugName,{color:"BlueViolet"})]))}handleFromEventObservableTriggered(i,e){this._isIncluded(i)&&console.log(...this.textToConsoleArgs([zbe("observable from event triggered"),mN(i.debugName,{color:"BlueViolet"}),...this.formatInfo(e),{data:[{fn:i._getValue}]}]))}handleAutorunCreated(i){this._isIncluded(i)&&this.changedObservablesSets.set(i,new Set)}handleAutorunDisposed(i){}handleAutorunDependencyChanged(i,e,t){this._isIncluded(i)&&this.changedObservablesSets.get(i).add(e)}handleAutorunStarted(i){let e=this.changedObservablesSets.get(i);e&&(this._isIncluded(i)&&console.log(...this.textToConsoleArgs([zbe("autorun"),mN(i.debugName,{color:"BlueViolet"}),this.formatChanges(e),{data:[{fn:i._debugNameData.referenceFn??i._runFn}]}])),e.clear(),this.indentation++)}handleAutorunFinished(i){this.indentation--}handleBeginTransaction(i){let e=i.getDebugName();e===void 0&&(e=""),this._isIncluded(i)&&console.log(...this.textToConsoleArgs([zbe("transaction"),mN(e,{color:"BlueViolet"}),{data:[{fn:i._fn}]}])),this.indentation++}handleEndTransaction(){this.indentation--}};function gRo(a){let i=new Array,e=[],t="";function o(r){if("length"in r)for(let s of r)s&&o(s);else"text"in r?(t+=`%c${r.text}`,i.push(r.style),r.data&&e.push(...r.data)):"data"in r&&e.push(...r.data)}o(a);let n=[t,...i];return n.push(...e),n}function Ube(a){return mN(a,{color:"black"})}function zbe(a){return mN(SRo(`${a}: `,10),{color:"black",bold:!0})}function mN(a,i={color:"black"}){function e(o){return Object.entries(o).reduce((n,[r,s])=>`${n}${r}:${s};`,"")}let t={color:i.color};return i.strikeThrough&&(t["text-decoration"]="line-through"),i.bold&&(t["font-weight"]="bold"),{text:a,style:e(t)}}function TM(a,i){switch(typeof a){case"number":return""+a;case"string":return a.length+2<=i?`"${a}"`:`"${a.substr(0,i-7)}"+...`;case"boolean":return a?"true":"false";case"undefined":return"undefined";case"object":return a===null?"null":Array.isArray(a)?fRo(a,i):vRo(a,i);case"symbol":return a.toString();case"function":return`[[Function${a.name?" "+a.name:""}]]`;default:return""+a}}function fRo(a,i){let e="[ ",t=!0;for(let o of a){if(t||(e+=", "),e.length-5>i){e+="...";break}t=!1,e+=`${TM(o,i-e.length)}`}return e+=" ]",e}function vRo(a,i){if(typeof a.toString=="function"&&a.toString!==Object.prototype.toString){let n=a.toString();return n.length<=i?n:n.substring(0,i-3)+"..."}let e=T9t(a),t=e?e+"(":"{ ",o=!0;for(let[n,r]of Object.entries(a)){if(o||(t+=", "),t.length-5>i){t+="...";break}o=!1,t+=`${n}: ${TM(r,i-t.length)}`}return t+=e?")":" }",t}function bRo(a,i){let e="";for(let t=1;t<=i;t++)e+=a;return e}function SRo(a,i){for(;a.length<i;)a+=" ";return a}var Kpt=class a{constructor(i,e){this._channelFactory=i;this._getHandler=e;this._channel=this._channelFactory({handleNotification:n=>{let r=n,s=this._getHandler().notifications[r[0]];if(!s)throw new Error(`Unknown notification "${r[0]}"!`);s(...r[1])},handleRequest:n=>{let r=n;try{return{type:"result",value:this._getHandler().requests[r[0]](...r[1])}}catch(s){return{type:"error",value:s}}}});let t=new Proxy({},{get:(n,r)=>async(...s)=>{let l=await this._channel.sendRequest([r,s]);if(l.type==="error")throw l.value;return l.value}}),o=new Proxy({},{get:(n,r)=>(...s)=>{this._channel.sendNotification([r,s])}});this.api={notifications:o,requests:t}}static createHost(i,e){return new a(i,e)}static createClient(i,e){return new a(i,e)}};function lzi(a,i){let e=globalThis,t=[],o,{channel:n,handler:r}=IRo({sendNotification:l=>{o?o.sendNotification(l):t.push(l)}}),s;return(e.$$debugValueEditor_debugChannels??(e.$$debugValueEditor_debugChannels={}))[a]=l=>{s=i(),o=l;for(let c of t)l.sendNotification(c);return t=[],r},Kpt.createClient(n,()=>{if(!s)throw new Error("Not supported");return s})}function IRo(a){let i;return{channel:t=>(i=t,{sendNotification:o=>{a.sendNotification(o)},sendRequest:o=>{throw new Error("not supported")}}),handler:{handleRequest:t=>t.type==="notification"?i?.handleNotification(t.data):i?.handleRequest(t.data)}}}var Gpt=class{constructor(){this._timeout=void 0}throttle(i,e){this._timeout===void 0&&(this._timeout=setTimeout(()=>{this._timeout=void 0,i()},e))}dispose(){this._timeout!==void 0&&clearTimeout(this._timeout)}};function j9t(a,i){for(let e in i)a[e]&&typeof a[e]=="object"&&i[e]&&typeof i[e]=="object"?j9t(a[e],i[e]):a[e]=i[e]}function Q9t(a,i){for(let e in i)i[e]===null?delete a[e]:a[e]&&typeof a[e]=="object"&&i[e]&&typeof i[e]=="object"?Q9t(a[e],i[e]):a[e]=i[e]}var $pt=class a{constructor(){this._declarationId=0;this._instanceId=0;this._declarations=new Map;this._instanceInfos=new WeakMap;this._aliveInstances=new Map;this._activeTransactions=new Set;this._channel=lzi("observableDevTools",()=>({notifications:{setDeclarationIdFilter:i=>{},logObservableValue:i=>{console.log("logObservableValue",i)},flushUpdates:()=>{this._flushUpdates()},resetUpdates:()=>{this._pendingChanges=null,this._channel.api.notifications.handleChange(this._fullState,!0)}},requests:{getDeclarations:()=>{let i={};for(let e of this._declarations.values())i[e.id]=e;return{decls:i}},getSummarizedInstances:()=>null,getObservableValueInfo:i=>({observers:[...this._aliveInstances.get(i).debugGetObservers()].map(t=>this._formatObserver(t)).filter(mo)}),getDerivedInfo:i=>{let e=this._aliveInstances.get(i);return{dependencies:[...e.debugGetState().dependencies].map(t=>this._formatObservable(t)).filter(mo),observers:[...e.debugGetObservers()].map(t=>this._formatObserver(t)).filter(mo)}},getAutorunInfo:i=>({dependencies:[...this._aliveInstances.get(i).debugGetState().dependencies].map(t=>this._formatObservable(t)).filter(mo)}),getTransactionState:()=>this.getTransactionState(),setValue:(i,e)=>{let t=this._aliveInstances.get(i);if(t instanceof Gv)t.debugSetValue(e);else if(t instanceof CM)t.debugSetValue(e);else if(t instanceof JD)t.debugSetValue(e);else throw new ni("Observable is not supported");let o=[...t.debugGetObservers()];for(let n of o)n.beginUpdate(t);for(let n of o)n.handleChange(t,void 0);for(let n of o)n.endUpdate(t)},getValue:i=>{let e=this._aliveInstances.get(i);if(e instanceof Gv)return TM(e.debugGetState().value,200);if(e instanceof CM)return TM(e.debugGetState().value,200)},logValue:i=>{let e=this._aliveInstances.get(i);if(e&&"get"in e)console.log("Logged Value:",e.get());else throw new ni("Observable is not supported")},rerun:i=>{let e=this._aliveInstances.get(i);if(e instanceof Gv)e.debugRecompute();else if(e instanceof J0)e.debugRerun();else throw new ni("Observable is not supported")}}}));this._pendingChanges=null;this._changeThrottler=new Gpt;this._fullState={};this._flushUpdates=()=>{this._pendingChanges!==null&&(this._channel.api.notifications.handleChange(this._pendingChanges,!1),this._pendingChanges=null)};Il.enable()}static{this._instance=void 0}static getInstance(){return a._instance===void 0&&(a._instance=new a),a._instance}getTransactionState(){let i=[],e=[...this._activeTransactions];if(e.length===0)return;let t=e.flatMap(n=>n.debugGetUpdatingObservers()??[]).map(n=>n.observer),o=new Set;for(;t.length>0;){let n=t.shift();if(o.has(n))continue;o.add(n);let r=this._getInfo(n,s=>{o.has(s)||t.push(s)});r&&i.push(r)}return{names:e.map(n=>n.getDebugName()??"tx"),affected:i}}_getObservableInfo(i){let e=this._instanceInfos.get(i);if(!e){mt(new ni("No info found"));return}return e}_getAutorunInfo(i){let e=this._instanceInfos.get(i);if(!e){mt(new ni("No info found"));return}return e}_getInfo(i,e){if(i instanceof Gv){let t=[...i.debugGetObservers()];for(let l of t)e(l);let o=this._getObservableInfo(i);if(!o)return;let n=i.debugGetState(),r={name:i.debugName,instanceId:o.instanceId,updateCount:n.updateCount},s=[...o.changedObservables].map(l=>this._instanceInfos.get(l)?.instanceId).filter(mo);if(n.isComputing)return{...r,type:"observable/derived",state:"updating",changedDependencies:s,initialComputation:!1};switch(n.state){case 0:return{...r,type:"observable/derived",state:"noValue"};case 3:return{...r,type:"observable/derived",state:"upToDate"};case 2:return{...r,type:"observable/derived",state:"stale",changedDependencies:s};case 1:return{...r,type:"observable/derived",state:"possiblyStale"}}}else if(i instanceof J0){let t=this._getAutorunInfo(i);if(!t)return;let o={name:i.debugName,instanceId:t.instanceId,updateCount:t.updateCount},n=[...t.changedObservables].map(r=>this._instanceInfos.get(r).instanceId);if(i.debugGetState().isRunning)return{...o,type:"autorun",state:"updating",changedDependencies:n};switch(i.debugGetState().state){case 3:return{...o,type:"autorun",state:"upToDate"};case 2:return{...o,type:"autorun",state:"stale",changedDependencies:n};case 1:return{...o,type:"autorun",state:"possiblyStale"}}}}_formatObservable(i){let e=this._getObservableInfo(i);if(e)return{name:i.debugName,instanceId:e.instanceId}}_formatObserver(i){if(i instanceof Gv)return{name:i.toString(),instanceId:this._getObservableInfo(i)?.instanceId};let e=this._getAutorunInfo(i);if(e)return{name:i.toString(),instanceId:e.instanceId}}_handleChange(i){Q9t(this._fullState,i),this._pendingChanges===null?this._pendingChanges=i:j9t(this._pendingChanges,i),this._changeThrottler.throttle(this._flushUpdates,10)}_getDeclarationId(i,e){if(!e)return-1;let t=this._declarations.get(e.id);return t===void 0&&(t={id:this._declarationId++,type:i,url:e.fileName,line:e.line,column:e.column},this._declarations.set(e.id,t),this._handleChange({decls:{[t.id]:t}})),t.id}handleObservableCreated(i,e){let o={declarationId:this._getDeclarationId("observable/value",e),instanceId:this._instanceId++,listenerCount:0,lastValue:void 0,updateCount:0,changedObservables:new Set};this._instanceInfos.set(i,o)}handleOnListenerCountChanged(i,e){let t=this._getObservableInfo(i);if(t){if(t.listenerCount===0&&e>0){let o=i instanceof Gv?"observable/derived":"observable/value";this._aliveInstances.set(t.instanceId,i),this._handleChange({instances:{[t.instanceId]:{instanceId:t.instanceId,declarationId:t.declarationId,formattedValue:t.lastValue,type:o,name:i.debugName}}})}else t.listenerCount>0&&e===0&&(this._handleChange({instances:{[t.instanceId]:null}}),this._aliveInstances.delete(t.instanceId));t.listenerCount=e}}handleObservableUpdated(i,e){if(i instanceof Gv){this._handleDerivedRecomputed(i,e);return}let t=this._getObservableInfo(i);t&&e.didChange&&(t.lastValue=TM(e.newValue,30),t.listenerCount>0&&this._handleChange({instances:{[t.instanceId]:{formattedValue:t.lastValue}}}))}handleAutorunCreated(i,e){let o={declarationId:this._getDeclarationId("autorun",e),instanceId:this._instanceId++,updateCount:0,changedObservables:new Set};this._instanceInfos.set(i,o),this._aliveInstances.set(o.instanceId,i),o&&this._handleChange({instances:{[o.instanceId]:{instanceId:o.instanceId,declarationId:o.declarationId,runCount:0,type:"autorun",name:i.debugName}}})}handleAutorunDisposed(i){let e=this._getAutorunInfo(i);e&&(this._handleChange({instances:{[e.instanceId]:null}}),this._instanceInfos.delete(i),this._aliveInstances.delete(e.instanceId))}handleAutorunDependencyChanged(i,e,t){let o=this._getAutorunInfo(i);o&&o.changedObservables.add(e)}handleAutorunStarted(i){}handleAutorunFinished(i){let e=this._getAutorunInfo(i);e&&(e.changedObservables.clear(),e.updateCount++,this._handleChange({instances:{[e.instanceId]:{runCount:e.updateCount}}}))}handleDerivedDependencyChanged(i,e,t){let o=this._getObservableInfo(i);o&&o.changedObservables.add(e)}_handleDerivedRecomputed(i,e){let t=this._getObservableInfo(i);if(!t)return;let o=TM(e.newValue,30);t.updateCount++,t.changedObservables.clear(),t.lastValue=o,t.listenerCount>0&&this._handleChange({instances:{[t.instanceId]:{formattedValue:o,recomputationCount:t.updateCount}}})}handleDerivedCleared(i){let e=this._getObservableInfo(i);e&&(e.lastValue=void 0,e.changedObservables.clear(),e.listenerCount>0&&this._handleChange({instances:{[e.instanceId]:{formattedValue:void 0}}}))}handleBeginTransaction(i){this._activeTransactions.add(i)}handleEndTransaction(i){this._activeTransactions.delete(i)}};function czi(a,i){let e=i?.debugNamePostProcessor??(n=>n),t=Are.from(a,e);if(!t)return"";let o=new Set;return i.type==="observers"?uzi(t,0,o,i).trim():dzi(t,0,o,i).trim()}function dzi(a,i,e,t){let o=" ".repeat(i),n=[];if(e.has(a.sourceObj))return n.push(`${o}* ${a.type} ${a.name} (already listed)`),n.join(`
`);if(e.add(a.sourceObj),n.push(`${o}* ${a.type} ${a.name}:`),n.push(`${o} value: ${TM(a.value,50)}`),n.push(`${o} state: ${a.state}`),a.dependencies.length>0){n.push(`${o} dependencies:`);for(let s of a.dependencies){let l=Are.from(s,t.debugNamePostProcessor??(c=>c))??Are.unknown(s);n.push(dzi(l,i+1,e,t))}}return n.join(`
`)}function uzi(a,i,e,t){let o=" ".repeat(i),n=[];if(e.has(a.sourceObj))return n.push(`${o}* ${a.type} ${a.name} (already listed)`),n.join(`
`);if(e.add(a.sourceObj),n.push(`${o}* ${a.type} ${a.name}:`),n.push(`${o} value: ${TM(a.value,50)}`),n.push(`${o} state: ${a.state}`),a.observers.length>0){n.push(`${o} observers:`);for(let s of a.observers){let l=Are.from(s,t.debugNamePostProcessor??(c=>c))??Are.unknown(s);n.push(uzi(l,i+1,e,t))}}return n.join(`
`)}var Are=class a{constructor(i,e,t,o,n,r,s){this.sourceObj=i;this.name=e;this.type=t;this.value=o;this.state=n;this.dependencies=r;this.observers=s}static from(i,e){if(i instanceof J0){let t=i.debugGetState();return new a(i,e(i.debugName),"autorun",void 0,t.stateStr,Array.from(t.dependencies),[])}else if(i instanceof Gv){let t=i.debugGetState();return new a(i,e(i.debugName),"derived",t.value,t.stateStr,Array.from(t.dependencies),Array.from(i.debugGetObservers()))}else if(i instanceof CM){let t=i.debugGetState();return new a(i,e(i.debugName),"observableValue",t.value,"upToDate",[],Array.from(i.debugGetObservers()))}else if(i instanceof JD){let t=i.debugGetState();return new a(i,e(i.debugName),"fromEvent",t.value,t.hasValue?"upToDate":"initial",[],Array.from(i.debugGetObservers()))}}static unknown(i){return new a(i,"(unknown)","unknown",void 0,"unknown",[],[])}};szi(czi);Z1i(azi);var yRo=!1;yRo&&wGe(new DGe);fp&&fp.VSCODE_DEV_DEBUG_OBSERVABLES&&wGe($pt.getInstance());var{registerWindow:bzi,getWindow:Me,getDocument:Ore,getWindows:Gw,getWindowsCount:Kbe,getWindowId:sg,getWindowById:qv,hasWindow:E6,onDidRegisterWindow:Fg,onWillUnregisterWindow:Szi,onDidUnregisterWindow:Izi}=(function(){let a=new Map;_ut(It,1);let i={window:It,disposables:new P};a.set(It.vscodeWindowId,i);let e=new E,t=new E,o=new E;function n(r,s){return(typeof r=="number"?a.get(r):void 0)??(s?i:void 0)}return{onDidRegisterWindow:e.event,onWillUnregisterWindow:o.event,onDidUnregisterWindow:t.event,registerWindow(r){if(a.has(r.vscodeWindowId))return C.None;let s=new P,l={window:r,disposables:s.add(new P)};return a.set(r.vscodeWindowId,l),s.add(Z(()=>{a.delete(r.vscodeWindowId),t.fire(r)})),s.add(j(r,re.BEFORE_UNLOAD,()=>{o.fire(r)})),e.fire(l),s},getWindows(){return a.values()},getWindowsCount(){return a.size},getWindowId(r){return r.vscodeWindowId},hasWindow(r){return a.has(r)},getWindowById:n,getWindow(r){let s=r;if(s?.ownerDocument?.defaultView)return s.ownerDocument.defaultView.window;let l=r;return l?.view?l.view.window:It},getDocument(r){return Me(r).document}}})(),qpt=new Set;function yzi(a){return qpt.add(a),Z(()=>{qpt.delete(a)})}function wRo(){for(let a of qpt)if(a().hasFocus)return!0;return!1}function CRo(){for(let a of qpt){let i=a();if(i.hasFocus&&i.window)return i.window}}function wzi(){for(let{window:a}of Gw())if(a.document.hasFocus())return!0;return!!wRo()}function Rt(a){for(;a.firstChild;)a.firstChild.remove()}var Y9t=class{constructor(i,e,t,o){this._node=i,this._type=e,this._handler=t,this._options=o||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function j(a,i,e,t){return new Y9t(a,i,e,t)}function i7t(a,i){return function(e){return i(new yn(a,e))}}function xRo(a){return function(i){return a(new Ii(i))}}var Vo=function(i,e,t,o){let n=t;return e==="click"||e==="mousedown"||e==="contextmenu"?n=i7t(Me(i),t):(e==="keydown"||e==="keypress"||e==="keyup")&&(n=xRo(t)),j(i,e,n,o)},Gbe=function(i,e,t){let o=i7t(Me(i),e);return C$(i,o,t)},Qpt=function(i,e,t){let o=i7t(Me(i),e);return Fre(i,o,t)};function C$(a,i,e){return j(a,Nc&&og.pointerEvents?re.POINTER_DOWN:re.MOUSE_DOWN,i,e)}function $be(a,i,e){return j(a,Nc&&og.pointerEvents?re.POINTER_MOVE:re.MOUSE_MOVE,i,e)}function Fre(a,i,e){return j(a,Nc&&og.pointerEvents?re.POINTER_UP:re.MOUSE_UP,i,e)}function jv(a,i,e){return Mbe(a,i,e)}var hN=class extends vGe{constructor(i,e){super(i,e)}},Ah,$r;function MI(a,i,e,t){let o=0,n=a.setInterval(()=>{o++,(typeof t=="number"&&o>=t||i()===!0)&&r.dispose()},e),r=Z(()=>{a.clearInterval(n)});return r}var ZD=class extends EI{constructor(i){super(),this.defaultTarget=i&&Me(i)}cancelAndSet(i,e,t){return super.cancelAndSet(i,e,t??this.defaultTarget)}},LGe=class{constructor(i,e=0){this._runner=i,this.priority=e,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(i){mt(i)}}static sort(i,e){return e.priority-i.priority}};(function(){let a=new Map,i=new Map,e=new Map,t=new Map,o=n=>{e.set(n,!1);let r=a.get(n)??[];for(i.set(n,r),a.set(n,[]),t.set(n,!0);r.length>0;)r.sort(LGe.sort),r.shift().execute();t.set(n,!1)};$r=(n,r,s=0)=>{let l=sg(n),c=new LGe(r,s),u=a.get(l);return u||(u=[],a.set(l,u)),u.push(c),e.get(l)||(e.set(l,!0),n.requestAnimationFrame(()=>o(l))),c},Ah=(n,r,s)=>{let l=sg(n);if(t.get(l)){let c=new LGe(r,s),u=i.get(l);return u||(u=[],i.set(l,u)),u.push(c),c}else return $r(n,r,s)}})();function o7t(a,i){return $r(a,i,1e4)}function T6(a,i){return $r(a,i,-1e4)}var jpt=class{constructor(i,e){this.pendingRunner=new me;this.node=i,this.runner=e}dispose(){this.pendingRunner.dispose()}cancel(){this.pendingRunner.clear()}schedule(){this.pendingRunner.value||(this.pendingRunner.value=Ah(Me(this.node),()=>{this.pendingRunner.clear(),this.runner()}))}isScheduled(){return this.pendingRunner.value!==void 0}};function cU(a){return Me(a).getComputedStyle(a,null)}function Fm(a,i,e){let t=Me(a),o=t.document;if(a!==o.body)return new ai(a.clientWidth,a.clientHeight);if(Nc&&t?.visualViewport)return new ai(t.visualViewport.width,t.visualViewport.height);if(t?.innerWidth&&t.innerHeight)return new ai(t.innerWidth,t.innerHeight);if(o.body&&o.body.clientWidth&&o.body.clientHeight)return new ai(o.body.clientWidth,o.body.clientHeight);if(o.documentElement&&o.documentElement.clientWidth&&o.documentElement.clientHeight)return new ai(o.documentElement.clientWidth,o.documentElement.clientHeight);if(e)return Fm(e,i);if(i)return i;throw new Error("Unable to figure out browser width and height")}var Kw=class a{static convertToPixels(i,e){return parseFloat(e)||0}static getDimension(i,e){let t=cU(i),o=t?t.getPropertyValue(e):"0";return a.convertToPixels(i,o)}static getBorderLeftWidth(i){return a.getDimension(i,"border-left-width")}static getBorderRightWidth(i){return a.getDimension(i,"border-right-width")}static getBorderTopWidth(i){return a.getDimension(i,"border-top-width")}static getBorderBottomWidth(i){return a.getDimension(i,"border-bottom-width")}static getPaddingLeft(i){return a.getDimension(i,"padding-left")}static getPaddingRight(i){return a.getDimension(i,"padding-right")}static getPaddingTop(i){return a.getDimension(i,"padding-top")}static getPaddingBottom(i){return a.getDimension(i,"padding-bottom")}static getMarginLeft(i){return a.getDimension(i,"margin-left")}static getMarginTop(i){return a.getDimension(i,"margin-top")}static getMarginRight(i){return a.getDimension(i,"margin-right")}static getMarginBottom(i){return a.getDimension(i,"margin-bottom")}},ai=class a{constructor(i,e){this.width=i;this.height=e}static{this.None=new a(0,0)}with(i=this.width,e=this.height){return i!==this.width||e!==this.height?new a(i,e):this}static is(i){return typeof i=="object"&&typeof i.height=="number"&&typeof i.width=="number"}static lift(i){return i instanceof a?i:new a(i.width,i.height)}static equals(i,e){return i===e?!0:!i||!e?!1:i.width===e.width&&i.height===e.height}};function gN(a){let i=a.offsetParent,e=a.offsetTop,t=a.offsetLeft;for(;(a=a.parentNode)!==null&&a!==a.ownerDocument.body&&a!==a.ownerDocument.documentElement;){e-=a.scrollTop;let o=Ezi(a)?null:cU(a);o&&(t-=o.direction!=="rtl"?a.scrollLeft:-a.scrollLeft),a===i&&(t+=Kw.getBorderLeftWidth(a),e+=Kw.getBorderTopWidth(a),e+=a.offsetTop,t+=a.offsetLeft,i=a.offsetParent)}return{left:t,top:e}}function fN(a,i,e){typeof i=="number"&&(a.style.width=`${i}px`),typeof e=="number"&&(a.style.height=`${e}px`)}function Czi(a,i,e,t,o,n="absolute"){typeof i=="number"&&(a.style.top=`${i}px`),typeof e=="number"&&(a.style.right=`${e}px`),typeof t=="number"&&(a.style.bottom=`${t}px`),typeof o=="number"&&(a.style.left=`${o}px`),a.style.position=n}function Yn(a){let i=a.getBoundingClientRect(),e=Me(a);return{left:i.left+e.scrollX,top:i.top+e.scrollY,width:i.width,height:i.height}}function _6(a){let i=a,e=1;do{let t=cU(i).zoom;t!=null&&t!=="1"&&(e*=t),i=i.parentElement}while(i!==null&&i!==i.ownerDocument.documentElement);return e}function yl(a){let i=Kw.getMarginLeft(a)+Kw.getMarginRight(a);return a.offsetWidth+i}function D6(a){let i=Kw.getBorderLeftWidth(a)+Kw.getBorderRightWidth(a),e=Kw.getPaddingLeft(a)+Kw.getPaddingRight(a);return a.offsetWidth-i-e}function kRo(a){let i=Kw.getMarginLeft(a)+Kw.getMarginRight(a);return a.scrollWidth+i}function qbe(a){let i=Kw.getBorderTopWidth(a)+Kw.getBorderBottomWidth(a),e=Kw.getPaddingTop(a)+Kw.getPaddingBottom(a);return a.offsetHeight-i-e}function nh(a){let i=Kw.getMarginTop(a)+Kw.getMarginBottom(a);return a.offsetHeight+i}function ERo(a,i){if(a===null)return 0;let e=gN(a),t=gN(i);return e.left-t.left}function jbe(a,i){let e=i.map(o=>Math.max(kRo(o),yl(o))+ERo(o,a)||0);return Math.max(...e)}function gs(a,i){return!!i?.contains(a)}var xzi="parentFlowToElementId";function vN(a,i){a.dataset[xzi]=i.id}function TRo(a){let i=a.dataset[xzi];return typeof i=="string"?a.ownerDocument.getElementById(i):null}function kzi(a,i){let e=a;for(;e;){if(e===i)return!0;if(Ao(e)){let t=TRo(e);if(t){e=t;continue}}e=e.parentNode}return!1}function Nh(a,i,e){for(;a&&a.nodeType===a.ELEMENT_NODE;){if(a.classList.contains(i))return a;if(e){if(typeof e=="string"){if(a.classList.contains(e))return null}else if(a===e)return null}a=a.parentNode}return null}function Qbe(a,i,e){return!!Nh(a,i,e)}function Ezi(a){return a&&!!a.host&&!!a.mode}function x$(a){return!!_M(a)}function _M(a){for(;a.parentNode;){if(a===a.ownerDocument?.body)return null;a=a.parentNode}return Ezi(a)?a:null}function Pn(){let a=rh().activeElement;for(;a?.shadowRoot;)a=a.shadowRoot.activeElement;return a}function sa(a){return Pn()===a}function ts(a){return gs(Pn(),a)}function rh(){if(Kbe()<=1)return It.document;let i=Array.from(Gw()).map(({window:t})=>t.document).find(t=>t.hasFocus());if(i)return i;let e=CRo();return e?e.document:It.document}function Ki(){return rh().defaultView?.window??It}var MGe=new class{constructor(){this.mutationObservers=new Map}observe(a,i,e){let t=this.mutationObservers.get(a);t||(t=new Map,this.mutationObservers.set(a,t));let o=Ir(e),n=t.get(o);if(n)n.users+=1;else{let r=new E,s=new MutationObserver(c=>r.fire(c));s.observe(a,e);let l=n={users:1,observer:s,onDidMutate:r.event};i.add(Z(()=>{l.users-=1,l.users===0&&(r.dispose(),s.disconnect(),t?.delete(o),t?.size===0&&this.mutationObservers.delete(a))})),t.set(o,n)}return n.onDidMutate}};function Ypt(a=It.document.head){return Tzi("meta",a)}function Xpt(a=It.document.head){return Tzi("link",a)}function Tzi(a,i=It.document.head){let e=document.createElement(a);return i.appendChild(e),e}function Ao(a){return a instanceof HTMLElement||a instanceof Me(a).HTMLElement}function n7t(a){return a instanceof HTMLAnchorElement||a instanceof Me(a).HTMLAnchorElement}function L6(a){return a instanceof HTMLTextAreaElement||a instanceof Me(a).HTMLTextAreaElement}function Wre(a){return a instanceof HTMLInputElement||a instanceof Me(a).HTMLInputElement}function r7t(a){return a instanceof HTMLDivElement||a instanceof Me(a).HTMLDivElement}function s7t(a){return a instanceof SVGElement||a instanceof Me(a).SVGElement}function Vp(a){return a instanceof MouseEvent||a instanceof Me(a).MouseEvent}function ag(a){return a instanceof KeyboardEvent||a instanceof Me(a).KeyboardEvent}function Jpt(a){return a instanceof PointerEvent||a instanceof Me(a).PointerEvent}function _zi(a){return a instanceof DragEvent||a instanceof Me(a).DragEvent}var re={CLICK:"click",AUXCLICK:"auxclick",DBLCLICK:"dblclick",MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_MOVE:"mousemove",MOUSE_OUT:"mouseout",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",POINTER_LEAVE:"pointerleave",CONTEXT_MENU:"contextmenu",WHEEL:"wheel",KEY_DOWN:"keydown",KEY_PRESS:"keypress",KEY_UP:"keyup",LOAD:"load",BEFORE_UNLOAD:"beforeunload",UNLOAD:"unload",PAGE_SHOW:"pageshow",PAGE_HIDE:"pagehide",PASTE:"paste",ABORT:"abort",ERROR:"error",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_CHANGE:"fullscreenchange",WK_FULLSCREEN_CHANGE:"webkitfullscreenchange",SELECT:"select",CHANGE:"change",SUBMIT:"submit",RESET:"reset",FOCUS:"focus",FOCUS_IN:"focusin",FOCUS_OUT:"focusout",BLUR:"blur",INPUT:"input",STORAGE:"storage",DRAG_START:"dragstart",DRAG:"drag",DRAG_ENTER:"dragenter",DRAG_LEAVE:"dragleave",DRAG_OVER:"dragover",DROP:"drop",DRAG_END:"dragend",ANIMATION_START:H0?"webkitAnimationStart":"animationstart",ANIMATION_END:H0?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:H0?"webkitAnimationIteration":"animationiteration"};function Zpt(a){let i=a;return!!(i&&typeof i.preventDefault=="function"&&typeof i.stopPropagation=="function")}var $t={stop:(a,i)=>(a.preventDefault(),i&&a.stopPropagation(),a)};function Dzi(a){let i=[];for(let e=0;a&&a.nodeType===a.ELEMENT_NODE;e++)i[e]=a.scrollTop,a=a.parentNode;return i}function Lzi(a,i){for(let e=0;a&&a.nodeType===a.ELEMENT_NODE;e++)a.scrollTop!==i[e]&&(a.scrollTop=i[e]),a=a.parentNode}var X9t=class a extends C{constructor(e){super();this._onDidFocus=this._register(new E);this._onDidBlur=this._register(new E);let t=a.hasFocusWithin(e),o=!1,n=()=>{o=!1,t||(t=!0,this._onDidFocus.fire())},r=()=>{t&&(o=!0,(Ao(e)?Me(e):e).setTimeout(()=>{o&&(o=!1,t=!1,this._onDidBlur.fire())},0))};this._refreshStateHandler=()=>{a.hasFocusWithin(e)!==t&&(t?r():n())},this._register(j(e,re.FOCUS,n,!0)),this._register(j(e,re.BLUR,r,!0)),Ao(e)&&(this._register(j(e,re.FOCUS_IN,()=>this._refreshStateHandler())),this._register(j(e,re.FOCUS_OUT,()=>this._refreshStateHandler())))}get onDidFocus(){return this._onDidFocus.event}get onDidBlur(){return this._onDidBlur.event}static hasFocusWithin(e){if(Ao(e)){let t=_M(e),o=t?t.activeElement:e.ownerDocument.activeElement;return gs(o,e)}else{let t=e;return gs(t.document.activeElement,t.document)}}refreshState(){this._refreshStateHandler()}};function Vn(a){return new X9t(a)}function emt(a,i){return a.after(i),i}function R(a,...i){if(a.append(...i),i.length===1&&typeof i[0]!="string")return i[0]}function Sf(a,i){return a.insertBefore(i,a.firstChild),i}function Fi(a,...i){a.textContent="",R(a,...i)}var _Ro=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function Rzi(a,i,e,...t){let o=_Ro.exec(i);if(!o)throw new Error("Bad use of emmet");let n=o[1]||"div",r;return a!=="http://www.w3.org/1999/xhtml"?r=document.createElementNS(a,n):r=document.createElement(n),o[3]&&(r.id=o[3]),o[4]&&(r.className=o[4].replace(/\./g," ").trim()),e&&Object.entries(e).forEach(([s,l])=>{typeof l>"u"||(/^on\w+$/.test(s)?r[s]=l:s==="selected"?l&&r.setAttribute(s,"true"):r.setAttribute(s,l))}),r.append(...t),r}function _(a,i,...e){return Rzi("http://www.w3.org/1999/xhtml",a,i,...e)}_.SVG=function(a,i,...e){return Rzi("http://www.w3.org/2000/svg",a,i,...e)};function mm(a,...i){a?bn(...i):xo(...i)}function bn(...a){for(let i of a)i.style.display="",i.removeAttribute("aria-hidden")}function xo(...a){for(let i of a)i.style.display="none",i.setAttribute("aria-hidden","true")}function Ybe(a){return i=>{i.preventDefault(),i.stopPropagation(),a(i)}}function Mzi(a){return new Promise(i=>{if(a.document.readyState==="complete"||a.document&&a.document.body!==null)i(void 0);else{let t=()=>{a.window.removeEventListener("DOMContentLoaded",t,!1),i()};a.window.addEventListener("DOMContentLoaded",t,!1)}})}function a7t(a,i){let e=a.devicePixelRatio*i;return Math.max(1,Math.floor(e))/a.devicePixelRatio}function PGe(a){It.open(a,"_blank","noopener")}var pzi=780,mzi=640;function l7t(a){let i=Math.floor(It.screenLeft+It.innerWidth/2-pzi/2),e=Math.floor(It.screenTop+It.innerHeight/2-mzi/2);It.open(a,"_blank",`width=${pzi},height=${mzi},top=${e},left=${i}`)}function Pzi(a,i=!0){let e=It.open();return e?(i&&(e.opener=null),e.location.href=a,!0):!1}function Azi(a,i){let e=()=>{i(),t=$r(a,e)},t=$r(a,e);return Z(()=>t.dispose())}jD.setPreferredWebSchema(/^https:/.test(It.location.href)?"https":"http");function Nzi(a,i){let e;if(A.isUri(a))e=a.toString(!0);else{let n=new Blob([a]);e=URL.createObjectURL(n),setTimeout(()=>URL.revokeObjectURL(e))}let t=Ki(),o=document.createElement("a");t.document.body.appendChild(o),o.download=i,o.href=e,o.click(),setTimeout(()=>o.remove())}function Ozi(){return new Promise(a=>{let i=Ki(),e=document.createElement("input");i.document.body.appendChild(e),e.type="file",e.multiple=!0,H.once(H.fromDOMEventEmitter(e,"input"))(()=>{a(e.files??void 0)}),e.click(),setTimeout(()=>e.remove())})}var bf=class a extends E{constructor(){super();this._subscriptions=new P;this._keyStatus={altKey:!1,shiftKey:!1,ctrlKey:!1,metaKey:!1},this._subscriptions.add(H.runAndSubscribe(Fg,({window:e,disposables:t})=>this.registerListeners(e,t),{window:It,disposables:this._subscriptions}))}registerListeners(e,t){t.add(j(e,"keydown",o=>{if(o.defaultPrevented)return;let n=new Ii(o);if(!(n.keyCode===6&&o.repeat)){if(o.altKey&&!this._keyStatus.altKey)this._keyStatus.lastKeyPressed="alt";else if(o.ctrlKey&&!this._keyStatus.ctrlKey)this._keyStatus.lastKeyPressed="ctrl";else if(o.metaKey&&!this._keyStatus.metaKey)this._keyStatus.lastKeyPressed="meta";else if(o.shiftKey&&!this._keyStatus.shiftKey)this._keyStatus.lastKeyPressed="shift";else if(n.keyCode!==6)this._keyStatus.lastKeyPressed=void 0;else return;this._keyStatus.altKey=o.altKey,this._keyStatus.ctrlKey=o.ctrlKey,this._keyStatus.metaKey=o.metaKey,this._keyStatus.shiftKey=o.shiftKey,this._keyStatus.lastKeyPressed&&(this._keyStatus.event=o,this.fire(this._keyStatus))}},!0)),t.add(j(e,"keyup",o=>{o.defaultPrevented||(!o.altKey&&this._keyStatus.altKey?this._keyStatus.lastKeyReleased="alt":!o.ctrlKey&&this._keyStatus.ctrlKey?this._keyStatus.lastKeyReleased="ctrl":!o.metaKey&&this._keyStatus.metaKey?this._keyStatus.lastKeyReleased="meta":!o.shiftKey&&this._keyStatus.shiftKey?this._keyStatus.lastKeyReleased="shift":this._keyStatus.lastKeyReleased=void 0,this._keyStatus.lastKeyPressed!==this._keyStatus.lastKeyReleased&&(this._keyStatus.lastKeyPressed=void 0),this._keyStatus.altKey=o.altKey,this._keyStatus.ctrlKey=o.ctrlKey,this._keyStatus.metaKey=o.metaKey,this._keyStatus.shiftKey=o.shiftKey,this._keyStatus.lastKeyReleased&&(this._keyStatus.event=o,this.fire(this._keyStatus)))},!0)),t.add(j(e.document.body,"mousedown",()=>{this._keyStatus.lastKeyPressed=void 0},!0)),t.add(j(e.document.body,"mouseup",()=>{this._keyStatus.lastKeyPressed=void 0},!0)),t.add(j(e.document.body,"mousemove",o=>{o.buttons&&(this._keyStatus.lastKeyPressed=void 0)},!0)),t.add(j(e,"blur",()=>{this.resetKeyStatus()}))}get keyStatus(){return this._keyStatus}get isModifierPressed(){return spt(this._keyStatus)}resetKeyStatus(){this.doResetKeyStatus(),this.fire(this._keyStatus)}doResetKeyStatus(){this._keyStatus={altKey:!1,shiftKey:!1,ctrlKey:!1,metaKey:!1}}static getInstance(){return a.instance||(a.instance=new a),a.instance}static disposeInstance(){a.instance&&(a.instance.dispose(),a.instance=void 0)}dispose(){super.dispose(),this._subscriptions.dispose()}};var Om=class extends C{constructor(e,t){super();this.element=e;this.callbacks=t;this.counter=0;this.dragStartTime=0;this.registerListeners()}registerListeners(){this.callbacks.onDragStart&&this._register(j(this.element,re.DRAG_START,e=>{this.callbacks.onDragStart?.(e)})),this.callbacks.onDrag&&this._register(j(this.element,re.DRAG,e=>{this.callbacks.onDrag?.(e)})),this._register(j(this.element,re.DRAG_ENTER,e=>{this.counter++,this.dragStartTime=e.timeStamp,this.callbacks.onDragEnter?.(e)})),this._register(j(this.element,re.DRAG_OVER,e=>{e.preventDefault(),this.callbacks.onDragOver?.(e,e.timeStamp-this.dragStartTime)})),this._register(j(this.element,re.DRAG_LEAVE,e=>{this.counter--,this.counter===0&&(this.dragStartTime=0,this.callbacks.onDragLeave?.(e))})),this._register(j(this.element,re.DRAG_END,e=>{this.counter=0,this.dragStartTime=0,this.callbacks.onDragEnd?.(e)})),this._register(j(this.element,re.DROP,e=>{this.counter=0,this.dragStartTime=0,this.callbacks.onDrop?.(e)}))}},eL=class extends C{constructor(i){super(),this.observer=new ResizeObserver(i),this._register(Z(()=>this.observer.disconnect()))}observe(i,e){return this.observer.observe(i,e),Z(()=>this.observer.unobserve(i))}},Fzi=/(?<tag>[\w\-]+)?(?:#(?<id>[\w\-]+))?(?<class>(?:\.(?:[\w\-]+))*)(?:@(?<name>(?:[\w\_])+))?/;function bt(a,...i){let e,t;Array.isArray(i[0])?(e={},t=i[0]):(e=i[0]||{},t=i[1]);let o=Fzi.exec(a);if(!o||!o.groups)throw new Error("Bad use of h");let n=o.groups.tag||"div",r=document.createElement(n);o.groups.id&&(r.id=o.groups.id);let s=[];if(o.groups.class)for(let c of o.groups.class.split("."))c!==""&&s.push(c);if(e.className!==void 0)for(let c of e.className.split("."))c!==""&&s.push(c);s.length>0&&(r.className=s.join(" "));let l={};if(o.groups.name&&(l[o.groups.name]=r),t)for(let c of t)Ao(c)?r.appendChild(c):typeof c=="string"?r.append(c):"root"in c&&(Object.assign(l,c),r.appendChild(c.root));for(let[c,u]of Object.entries(e))if(c!=="className")if(c==="style")for(let[p,h]of Object.entries(u))r.style.setProperty(Nre(p),typeof h=="number"?h+"px":""+h);else c==="tabIndex"?r.tabIndex=u:r.setAttribute(Nre(c),u.toString());return l.root=r,l}function Wzi(a,...i){let e,t;Array.isArray(i[0])?(e={},t=i[0]):(e=i[0]||{},t=i[1]);let o=Fzi.exec(a);if(!o||!o.groups)throw new Error("Bad use of h");let n=o.groups.tag||"div",r=document.createElementNS("http://www.w3.org/2000/svg",n);o.groups.id&&(r.id=o.groups.id);let s=[];if(o.groups.class)for(let c of o.groups.class.split("."))c!==""&&s.push(c);if(e.className!==void 0)for(let c of e.className.split("."))c!==""&&s.push(c);s.length>0&&(r.className=s.join(" "));let l={};if(o.groups.name&&(l[o.groups.name]=r),t)for(let c of t)Ao(c)?r.appendChild(c):typeof c=="string"?r.append(c):"root"in c&&(Object.assign(l,c),r.appendChild(c.root));for(let[c,u]of Object.entries(e))if(c!=="className")if(c==="style")for(let[p,h]of Object.entries(u))r.style.setProperty(Nre(p),typeof h=="number"?h+"px":""+h);else c==="tabIndex"?r.tabIndex=u:r.setAttribute(Nre(c),u.toString());return l.root=r,l}function Nre(a){return a.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function tmt(a,i,e){for(let{name:t,value:o}of a.attributes)(!e||e.includes(t))&&i.setAttribute(t,o)}function DRo(a,i,e){let t=a.getAttribute(e);t?i.setAttribute(e,t):i.removeAttribute(e)}function imt(a,i,e){tmt(a,i,e);let t=new P;return t.add(MGe.observe(a,t,{attributes:!0,attributeFilter:e})(o=>{for(let n of o)n.type==="attributes"&&n.attributeName&&DRo(a,i,n.attributeName)})),t}function Oh(a){return a.tagName.toLowerCase()==="input"||a.tagName.toLowerCase()==="textarea"||Ao(a)&&!!a.editContext}var RGe=class{constructor(i,e,t){this.originX=i;this.originY=e;this.points=new Int16Array(8);let{top:o,left:n,right:r,bottom:s}=t.getBoundingClientRect(),l=this.points,c=0;l[c++]=n,l[c++]=o,l[c++]=r,l[c++]=o,l[c++]=n,l[c++]=s,l[c++]=r,l[c++]=s}contains(i,e){let{points:t,originX:o,originY:n}=this;for(let r=0;r<4;r++){let s=2*r,l=2*((r+1)%4);if($1i(i,e,o,n,t[s],t[s+1],t[l],t[l+1]))return!0}return!1}},Mo;(s=>{function a(l=void 0){return(c,u,p)=>{let h=u.class;delete u.class;let g=u.ref;delete u.ref;let f=u.obsRef;return delete u.obsRef,new e7t(c,g,f,l,h,u,p)}}function i(l,c=void 0){let u=a(c);return(p,h)=>u(l,p,h)}s.div=i("div"),s.elem=a(void 0),s.svg=i("svg","http://www.w3.org/2000/svg"),s.svgElem=a("http://www.w3.org/2000/svg");function r(){let l,c=function(u){l=u};return Object.defineProperty(c,"element",{get(){if(!l)throw new ni("Make sure the ref is set before accessing the element. Maybe wrong initialization order?");return l}}),c}s.ref=r})(Mo||={});var J9t=class a{constructor(i,e,t,o,n,r,s){this._deriveds=[];this._isHovered=void 0;this._didMouseMoveDuringHover=void 0;this._element=o?document.createElementNS(o,i):document.createElement(i),e&&e(this._element),t&&this._deriveds.push(Ce(l=>{t(this),l.store.add({dispose:()=>{t(null)}})})),n&&(Bzi(n)?this._deriveds.push(Ce(this,l=>{hzi(this._element,gzi(n,l))})):hzi(this._element,gzi(n,void 0)));for(let[l,c]of Object.entries(r))if(l==="style")for(let[u,p]of Object.entries(c)){let h=Nre(u);uN(p)?this._deriveds.push(hs({owner:this,debugName:()=>`set.style.${h}`},g=>{this._element.style.setProperty(h,fzi(p.read(g)))})):this._element.style.setProperty(h,fzi(p))}else l==="tabIndex"?uN(c)?this._deriveds.push(Ce(this,u=>{this._element.tabIndex=c.read(u)})):this._element.tabIndex=c:l.startsWith("on")?this._element[l]=c:uN(c)?this._deriveds.push(hs({owner:this,debugName:()=>`set.${l}`},u=>{vzi(this._element,l,c.read(u))})):vzi(this._element,l,c);if(s){let l=function(u,p){return uN(p)?l(u,p.read(u)):Array.isArray(p)?p.flatMap(h=>l(u,h)):p instanceof a?(u&&p.readEffect(u),[p._element]):p?[p]:[]},c=Ce(this,u=>{this._element.replaceChildren(...l(u,s))});this._deriveds.push(c),Hzi(s)||c.get()}}readEffect(i){for(let e of this._deriveds)e.read(i)}keepUpdated(i){return Ce(e=>{this.readEffect(e)}).recomputeInitiallyAndOnChange(i),this}toDisposableLiveElement(){let i=new P;return this.keepUpdated(i),new Z9t(this._element,i)}get isHovered(){if(!this._isHovered){let i=Le("hovered",!1);this._element.addEventListener("mouseenter",e=>i.set(!0,void 0)),this._element.addEventListener("mouseleave",e=>i.set(!1,void 0)),this._isHovered=i}return this._isHovered}get didMouseMoveDuringHover(){if(!this._didMouseMoveDuringHover){let i=!1,e=Le("didMouseMoveDuringHover",!1);this._element.addEventListener("mouseenter",t=>{i=!0}),this._element.addEventListener("mousemove",t=>{i&&e.set(!0,void 0)}),this._element.addEventListener("mouseleave",t=>{i=!1,e.set(!1,void 0)}),this._didMouseMoveDuringHover=e}return this._didMouseMoveDuringHover}};function hzi(a,i){s7t(a)?a.setAttribute("class",i):a.className=i}function Vzi(a,i,e){if(uN(a)){e(a.read(i));return}if(Array.isArray(a)){for(let t of a)Vzi(t,i,e);return}e(a)}function gzi(a,i){let e="";return Vzi(a,i,t=>{t&&(e.length===0?e=t:e+=" "+t)}),e}function Bzi(a){return uN(a)?!0:Array.isArray(a)?a.some(i=>Bzi(i)):!1}function fzi(a){return typeof a=="number"?a+"px":a}function Hzi(a){return uN(a)?!0:Array.isArray(a)?a.some(i=>Hzi(i)):!1}var Z9t=class{constructor(i,e){this.element=i;this._disposable=e}dispose(){this._disposable.dispose()}},e7t=class extends J9t{get element(){return this._element}};function vzi(a,i,e){e==null?a.removeAttribute(Nre(i)):a.setAttribute(Nre(i),String(e))}var t7t=class extends HTMLElement{disconnectedCallback(){this.onDidDisconnect?.()}connectedCallback(){this.onDidConnect?.()}};customElements.get("connection-observer")||customElements.define("connection-observer",t7t);var Uzi=2e4,Vre,omt,c7t,nmt,d7t;function zzi(a){Vre=document.createElement("div"),Vre.className="monaco-aria-container";let i=()=>{let t=document.createElement("div");return t.className="monaco-alert",t.setAttribute("role","alert"),t.setAttribute("aria-atomic","true"),Vre.appendChild(t),t};omt=i(),c7t=i();let e=()=>{let t=document.createElement("div");return t.className="monaco-status",t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),Vre.appendChild(t),t};nmt=e(),d7t=e(),a.appendChild(Vre)}function Jo(a){Vre&&(omt.textContent!==a?(Rt(c7t),rmt(omt,a)):(Rt(omt),rmt(c7t,a)))}function Or(a){Vre&&(nmt.textContent!==a?(Rt(d7t),rmt(nmt,a)):(Rt(nmt),rmt(d7t,a)))}function rmt(a,i){Rt(a),i.length>Uzi&&(i=i.substr(0,Uzi)),a.textContent=i,a.style.visibility="hidden",a.style.visibility="visible"}var Z0;(o=>{o.serviceIds=new Map,o.DI_TARGET="$di$target",o.DI_DEPENDENCIES="$di$dependencies";function t(n){return n[o.DI_DEPENDENCIES]||[]}o.getServiceDependencies=t})(Z0||={});var F=ae("instantiationService");function LRo(a,i,e){i[Z0.DI_TARGET]===i?i[Z0.DI_DEPENDENCIES].push({id:a,index:e}):(i[Z0.DI_DEPENDENCIES]=[{id:a,index:e}],i[Z0.DI_TARGET]=i)}function ae(a){if(Z0.serviceIds.has(a))return Z0.serviceIds.get(a);let i=function(e,t,o){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");LRo(i,e,o)};return i.toString=()=>a,Z0.serviceIds.set(a,i),i}var Kt=ae("codeEditorService");var Ie=class a{constructor(i,e){this.lineNumber=i,this.column=e}with(i=this.lineNumber,e=this.column){return i===this.lineNumber&&e===this.column?this:new a(i,e)}delta(i=0,e=0){return this.with(Math.max(1,this.lineNumber+i),Math.max(1,this.column+e))}equals(i){return a.equals(this,i)}static equals(i,e){return!i&&!e?!0:!!i&&!!e&&i.lineNumber===e.lineNumber&&i.column===e.column}isBefore(i){return a.isBefore(this,i)}static isBefore(i,e){return i.lineNumber<e.lineNumber?!0:e.lineNumber<i.lineNumber?!1:i.column<e.column}isBeforeOrEqual(i){return a.isBeforeOrEqual(this,i)}static isBeforeOrEqual(i,e){return i.lineNumber<e.lineNumber?!0:e.lineNumber<i.lineNumber?!1:i.column<=e.column}static compare(i,e){let t=i.lineNumber|0,o=e.lineNumber|0;if(t===o){let n=i.column|0,r=e.column|0;return n-r}return t-o}clone(){return new a(this.lineNumber,this.column)}toString(){return"("+this.lineNumber+","+this.column+")"}static lift(i){return new a(i.lineNumber,i.column)}static isIPosition(i){return!!i&&typeof i.lineNumber=="number"&&typeof i.column=="number"}toJSON(){return{lineNumber:this.lineNumber,column:this.column}}};var Ct=ae("modelService");var Nt=ae("textModelService");function Kzi(a){return!!a.textEditorModel}var st=class extends C{constructor(e,t="",o="",n=!0,r){super();this._onDidChange=this._register(new E);this._enabled=!0;this._id=e,this._label=t,this._cssClass=o,this._enabled=n,this._actionCallback=r}get onDidChange(){return this._onDidChange.event}get id(){return this._id}get label(){return this._label}set label(e){this._setLabel(e)}_setLabel(e){this._label!==e&&(this._label=e,this._onDidChange.fire({label:e}))}get tooltip(){return this._tooltip||""}set tooltip(e){this._setTooltip(e)}_setTooltip(e){this._tooltip!==e&&(this._tooltip=e,this._onDidChange.fire({tooltip:e}))}get class(){return this._cssClass}set class(e){this._setClass(e)}_setClass(e){this._cssClass!==e&&(this._cssClass=e,this._onDidChange.fire({class:e}))}get enabled(){return this._enabled}set enabled(e){this._setEnabled(e)}_setEnabled(e){this._enabled!==e&&(this._enabled=e,this._onDidChange.fire({enabled:e}))}get checked(){return this._checked}set checked(e){this._setChecked(e)}_setChecked(e){this._checked!==e&&(this._checked=e,this._onDidChange.fire({checked:e}))}async run(e,t){this._actionCallback&&await this._actionCallback(e)}},as=class extends C{constructor(){super(...arguments);this._onWillRun=this._register(new E);this._onDidRun=this._register(new E)}get onWillRun(){return this._onWillRun.event}get onDidRun(){return this._onDidRun.event}async run(e,t){if(!e.enabled)return;this._onWillRun.fire({action:e});let o;try{await this.runAction(e,t)}catch(n){o=n}this._onDidRun.fire({action:e,error:o})}async runAction(e,t){await e.run(t)}},li=class a{constructor(){this.id=a.ID;this.label="";this.tooltip="";this.class="separator";this.enabled=!1;this.checked=void 0}static join(...i){let e=[];for(let t of i)t.length&&(e.length?e=[...e,new a,...t]:e=t);return e}static clean(i){for(;i.length>0&&i[0].id===a.ID;)i.shift();for(;i.length>0&&i[i.length-1].id===a.ID;)i.pop();for(let e=i.length-2;e>=0;e--)i[e].id===a.ID&&i[e+1].id===a.ID&&i.splice(e+1,1);return i}static{this.ID="vs.actions.separator"}async run(){}},$l=class{constructor(i,e,t,o){this.tooltip="";this.enabled=!0;this.checked=void 0;this.id=i,this.label=e,this.class=o,this._actions=t}get actions(){return this._actions}async run(){}},smt=class a extends st{static{this.ID="vs.actions.empty"}constructor(){super(a.ID,d(46,null),void 0,!1)}};function pi(a){return{id:a.id,label:a.label,tooltip:a.tooltip??a.label,class:a.class,enabled:a.enabled??!0,checked:a.checked,run:async(...i)=>a.run(...i)}}var u7t=Object.create(null);function ce(a,i){if(Ae(i)){let e=u7t[i];if(e===void 0)throw new Error(`${a} references an unknown codicon: ${i}`);i=e}return u7t[a]=i,{id:a}}function amt(){return u7t}var R6={add:ce("add",6e4),plus:ce("plus",6e4),gistNew:ce("gist-new",6e4),repoCreate:ce("repo-create",6e4),lightbulb:ce("lightbulb",60001),lightBulb:ce("light-bulb",60001),repo:ce("repo",60002),repoDelete:ce("repo-delete",60002),gistFork:ce("gist-fork",60003),repoForked:ce("repo-forked",60003),gitPullRequest:ce("git-pull-request",60004),gitPullRequestAbandoned:ce("git-pull-request-abandoned",60004),recordKeys:ce("record-keys",60005),keyboard:ce("keyboard",60005),tag:ce("tag",60006),gitPullRequestLabel:ce("git-pull-request-label",60006),tagAdd:ce("tag-add",60006),tagRemove:ce("tag-remove",60006),person:ce("person",60007),personFollow:ce("person-follow",60007),personOutline:ce("person-outline",60007),personFilled:ce("person-filled",60007),sourceControl:ce("source-control",60008),mirror:ce("mirror",60009),mirrorPublic:ce("mirror-public",60009),star:ce("star",60010),starAdd:ce("star-add",60010),starDelete:ce("star-delete",60010),starEmpty:ce("star-empty",60010),comment:ce("comment",60011),commentAdd:ce("comment-add",60011),alert:ce("alert",60012),warning:ce("warning",60012),search:ce("search",60013),searchSave:ce("search-save",60013),logOut:ce("log-out",60014),signOut:ce("sign-out",60014),logIn:ce("log-in",60015),signIn:ce("sign-in",60015),eye:ce("eye",60016),eyeUnwatch:ce("eye-unwatch",60016),eyeWatch:ce("eye-watch",60016),circleFilled:ce("circle-filled",60017),primitiveDot:ce("primitive-dot",60017),closeDirty:ce("close-dirty",60017),debugBreakpoint:ce("debug-breakpoint",60017),debugBreakpointDisabled:ce("debug-breakpoint-disabled",60017),debugHint:ce("debug-hint",60017),terminalDecorationSuccess:ce("terminal-decoration-success",60017),primitiveSquare:ce("primitive-square",60018),edit:ce("edit",60019),pencil:ce("pencil",60019),info:ce("info",60020),issueOpened:ce("issue-opened",60020),gistPrivate:ce("gist-private",60021),gitForkPrivate:ce("git-fork-private",60021),lock:ce("lock",60021),mirrorPrivate:ce("mirror-private",60021),close:ce("close",60022),removeClose:ce("remove-close",60022),x:ce("x",60022),repoSync:ce("repo-sync",60023),sync:ce("sync",60023),clone:ce("clone",60024),desktopDownload:ce("desktop-download",60024),beaker:ce("beaker",60025),microscope:ce("microscope",60025),vm:ce("vm",60026),deviceDesktop:ce("device-desktop",60026),file:ce("file",60027),more:ce("more",60028),ellipsis:ce("ellipsis",60028),kebabHorizontal:ce("kebab-horizontal",60028),mailReply:ce("mail-reply",60029),reply:ce("reply",60029),organization:ce("organization",60030),organizationFilled:ce("organization-filled",60030),organizationOutline:ce("organization-outline",60030),newFile:ce("new-file",60031),fileAdd:ce("file-add",60031),newFolder:ce("new-folder",60032),fileDirectoryCreate:ce("file-directory-create",60032),trash:ce("trash",60033),trashcan:ce("trashcan",60033),history:ce("history",60034),clock:ce("clock",60034),folder:ce("folder",60035),fileDirectory:ce("file-directory",60035),symbolFolder:ce("symbol-folder",60035),logoGithub:ce("logo-github",60036),markGithub:ce("mark-github",60036),github:ce("github",60036),terminal:ce("terminal",60037),console:ce("console",60037),repl:ce("repl",60037),zap:ce("zap",60038),symbolEvent:ce("symbol-event",60038),error:ce("error",60039),stop:ce("stop",60039),variable:ce("variable",60040),symbolVariable:ce("symbol-variable",60040),array:ce("array",60042),symbolArray:ce("symbol-array",60042),symbolModule:ce("symbol-module",60043),symbolPackage:ce("symbol-package",60043),symbolNamespace:ce("symbol-namespace",60043),symbolObject:ce("symbol-object",60043),symbolMethod:ce("symbol-method",60044),symbolFunction:ce("symbol-function",60044),symbolConstructor:ce("symbol-constructor",60044),symbolBoolean:ce("symbol-boolean",60047),symbolNull:ce("symbol-null",60047),symbolNumeric:ce("symbol-numeric",60048),symbolNumber:ce("symbol-number",60048),symbolStructure:ce("symbol-structure",60049),symbolStruct:ce("symbol-struct",60049),symbolParameter:ce("symbol-parameter",60050),symbolTypeParameter:ce("symbol-type-parameter",60050),symbolKey:ce("symbol-key",60051),symbolText:ce("symbol-text",60051),symbolReference:ce("symbol-reference",60052),goToFile:ce("go-to-file",60052),symbolEnum:ce("symbol-enum",60053),symbolValue:ce("symbol-value",60053),symbolRuler:ce("symbol-ruler",60054),symbolUnit:ce("symbol-unit",60054),activateBreakpoints:ce("activate-breakpoints",60055),archive:ce("archive",60056),arrowBoth:ce("arrow-both",60057),arrowDown:ce("arrow-down",60058),arrowLeft:ce("arrow-left",60059),arrowRight:ce("arrow-right",60060),arrowSmallDown:ce("arrow-small-down",60061),arrowSmallLeft:ce("arrow-small-left",60062),arrowSmallRight:ce("arrow-small-right",60063),arrowSmallUp:ce("arrow-small-up",60064),arrowUp:ce("arrow-up",60065),bell:ce("bell",60066),bold:ce("bold",60067),book:ce("book",60068),bookmark:ce("bookmark",60069),debugBreakpointConditionalUnverified:ce("debug-breakpoint-conditional-unverified",60070),debugBreakpointConditional:ce("debug-breakpoint-conditional",60071),debugBreakpointConditionalDisabled:ce("debug-breakpoint-conditional-disabled",60071),debugBreakpointDataUnverified:ce("debug-breakpoint-data-unverified",60072),debugBreakpointData:ce("debug-breakpoint-data",60073),debugBreakpointDataDisabled:ce("debug-breakpoint-data-disabled",60073),debugBreakpointLogUnverified:ce("debug-breakpoint-log-unverified",60074),debugBreakpointLog:ce("debug-breakpoint-log",60075),debugBreakpointLogDisabled:ce("debug-breakpoint-log-disabled",60075),briefcase:ce("briefcase",60076),broadcast:ce("broadcast",60077),browser:ce("browser",60078),bug:ce("bug",60079),calendar:ce("calendar",60080),caseSensitive:ce("case-sensitive",60081),check:ce("check",60082),checklist:ce("checklist",60083),chevronDown:ce("chevron-down",60084),chevronLeft:ce("chevron-left",60085),chevronRight:ce("chevron-right",60086),chevronUp:ce("chevron-up",60087),chromeClose:ce("chrome-close",60088),chromeMaximize:ce("chrome-maximize",60089),chromeMinimize:ce("chrome-minimize",60090),chromeRestore:ce("chrome-restore",60091),circleOutline:ce("circle-outline",60092),circle:ce("circle",60092),debugBreakpointUnverified:ce("debug-breakpoint-unverified",60092),terminalDecorationIncomplete:ce("terminal-decoration-incomplete",60092),circleSlash:ce("circle-slash",60093),circuitBoard:ce("circuit-board",60094),clearAll:ce("clear-all",60095),clippy:ce("clippy",60096),closeAll:ce("close-all",60097),cloudDownload:ce("cloud-download",60098),cloudUpload:ce("cloud-upload",60099),code:ce("code",60100),collapseAll:ce("collapse-all",60101),colorMode:ce("color-mode",60102),commentDiscussion:ce("comment-discussion",60103),creditCard:ce("credit-card",60105),dash:ce("dash",60108),dashboard:ce("dashboard",60109),database:ce("database",60110),debugContinue:ce("debug-continue",60111),debugDisconnect:ce("debug-disconnect",60112),debugPause:ce("debug-pause",60113),debugRestart:ce("debug-restart",60114),debugStart:ce("debug-start",60115),debugStepInto:ce("debug-step-into",60116),debugStepOut:ce("debug-step-out",60117),debugStepOver:ce("debug-step-over",60118),debugStop:ce("debug-stop",60119),debug:ce("debug",60120),deviceCameraVideo:ce("device-camera-video",60121),deviceCamera:ce("device-camera",60122),deviceMobile:ce("device-mobile",60123),diffAdded:ce("diff-added",60124),diffIgnored:ce("diff-ignored",60125),diffModified:ce("diff-modified",60126),diffRemoved:ce("diff-removed",60127),diffRenamed:ce("diff-renamed",60128),diff:ce("diff",60129),diffSidebyside:ce("diff-sidebyside",60129),discard:ce("discard",60130),editorLayout:ce("editor-layout",60131),emptyWindow:ce("empty-window",60132),exclude:ce("exclude",60133),extensions:ce("extensions",60134),eyeClosed:ce("eye-closed",60135),fileBinary:ce("file-binary",60136),fileCode:ce("file-code",60137),fileMedia:ce("file-media",60138),filePdf:ce("file-pdf",60139),fileSubmodule:ce("file-submodule",60140),fileSymlinkDirectory:ce("file-symlink-directory",60141),fileSymlinkFile:ce("file-symlink-file",60142),fileZip:ce("file-zip",60143),files:ce("files",60144),filter:ce("filter",60145),flame:ce("flame",60146),foldDown:ce("fold-down",60147),foldUp:ce("fold-up",60148),fold:ce("fold",60149),folderActive:ce("folder-active",60150),folderOpened:ce("folder-opened",60151),gear:ce("gear",60152),gift:ce("gift",60153),gistSecret:ce("gist-secret",60154),gist:ce("gist",60155),gitCommit:ce("git-commit",60156),gitCompare:ce("git-compare",60157),compareChanges:ce("compare-changes",60157),gitMerge:ce("git-merge",60158),githubAction:ce("github-action",60159),githubAlt:ce("github-alt",60160),globe:ce("globe",60161),grabber:ce("grabber",60162),graph:ce("graph",60163),gripper:ce("gripper",60164),heart:ce("heart",60165),home:ce("home",60166),horizontalRule:ce("horizontal-rule",60167),hubot:ce("hubot",60168),inbox:ce("inbox",60169),issueReopened:ce("issue-reopened",60171),issues:ce("issues",60172),italic:ce("italic",60173),jersey:ce("jersey",60174),json:ce("json",60175),bracket:ce("bracket",60175),kebabVertical:ce("kebab-vertical",60176),key:ce("key",60177),law:ce("law",60178),lightbulbAutofix:ce("lightbulb-autofix",60179),linkExternal:ce("link-external",60180),link:ce("link",60181),listOrdered:ce("list-ordered",60182),listUnordered:ce("list-unordered",60183),liveShare:ce("live-share",60184),loading:ce("loading",60185),location:ce("location",60186),mailRead:ce("mail-read",60187),mail:ce("mail",60188),markdown:ce("markdown",60189),megaphone:ce("megaphone",60190),mention:ce("mention",60191),milestone:ce("milestone",60192),gitPullRequestMilestone:ce("git-pull-request-milestone",60192),mortarBoard:ce("mortar-board",60193),move:ce("move",60194),multipleWindows:ce("multiple-windows",60195),mute:ce("mute",60196),noNewline:ce("no-newline",60197),note:ce("note",60198),octoface:ce("octoface",60199),openPreview:ce("open-preview",60200),package:ce("package",60201),paintcan:ce("paintcan",60202),pin:ce("pin",60203),play:ce("play",60204),run:ce("run",60204),plug:ce("plug",60205),preserveCase:ce("preserve-case",60206),preview:ce("preview",60207),project:ce("project",60208),pulse:ce("pulse",60209),question:ce("question",60210),quote:ce("quote",60211),radioTower:ce("radio-tower",60212),reactions:ce("reactions",60213),references:ce("references",60214),refresh:ce("refresh",60215),regex:ce("regex",60216),remoteExplorer:ce("remote-explorer",60217),remote:ce("remote",60218),remove:ce("remove",60219),replaceAll:ce("replace-all",60220),replace:ce("replace",60221),repoClone:ce("repo-clone",60222),repoForcePush:ce("repo-force-push",60223),repoPull:ce("repo-pull",60224),repoPush:ce("repo-push",60225),report:ce("report",60226),requestChanges:ce("request-changes",60227),rocket:ce("rocket",60228),rootFolderOpened:ce("root-folder-opened",60229),rootFolder:ce("root-folder",60230),rss:ce("rss",60231),ruby:ce("ruby",60232),saveAll:ce("save-all",60233),saveAs:ce("save-as",60234),save:ce("save",60235),screenFull:ce("screen-full",60236),screenNormal:ce("screen-normal",60237),searchStop:ce("search-stop",60238),server:ce("server",60240),settingsGear:ce("settings-gear",60241),settings:ce("settings",60242),shield:ce("shield",60243),smiley:ce("smiley",60244),sortPrecedence:ce("sort-precedence",60245),splitHorizontal:ce("split-horizontal",60246),splitVertical:ce("split-vertical",60247),squirrel:ce("squirrel",60248),starFull:ce("star-full",60249),starHalf:ce("star-half",60250),symbolClass:ce("symbol-class",60251),symbolColor:ce("symbol-color",60252),symbolConstant:ce("symbol-constant",60253),symbolEnumMember:ce("symbol-enum-member",60254),symbolField:ce("symbol-field",60255),symbolFile:ce("symbol-file",60256),symbolInterface:ce("symbol-interface",60257),symbolKeyword:ce("symbol-keyword",60258),symbolMisc:ce("symbol-misc",60259),symbolOperator:ce("symbol-operator",60260),symbolProperty:ce("symbol-property",60261),wrench:ce("wrench",60261),wrenchSubaction:ce("wrench-subaction",60261),symbolSnippet:ce("symbol-snippet",60262),tasklist:ce("tasklist",60263),telescope:ce("telescope",60264),textSize:ce("text-size",60265),threeBars:ce("three-bars",60266),thumbsdown:ce("thumbsdown",60267),thumbsup:ce("thumbsup",60268),tools:ce("tools",60269),triangleDown:ce("triangle-down",60270),triangleLeft:ce("triangle-left",60271),triangleRight:ce("triangle-right",60272),triangleUp:ce("triangle-up",60273),twitter:ce("twitter",60274),unfold:ce("unfold",60275),unlock:ce("unlock",60276),unmute:ce("unmute",60277),unverified:ce("unverified",60278),verified:ce("verified",60279),versions:ce("versions",60280),vmActive:ce("vm-active",60281),vmOutline:ce("vm-outline",60282),vmRunning:ce("vm-running",60283),watch:ce("watch",60284),whitespace:ce("whitespace",60285),wholeWord:ce("whole-word",60286),window:ce("window",60287),wordWrap:ce("word-wrap",60288),zoomIn:ce("zoom-in",60289),zoomOut:ce("zoom-out",60290),listFilter:ce("list-filter",60291),listFlat:ce("list-flat",60292),listSelection:ce("list-selection",60293),selection:ce("selection",60293),listTree:ce("list-tree",60294),debugBreakpointFunctionUnverified:ce("debug-breakpoint-function-unverified",60295),debugBreakpointFunction:ce("debug-breakpoint-function",60296),debugBreakpointFunctionDisabled:ce("debug-breakpoint-function-disabled",60296),debugStackframeActive:ce("debug-stackframe-active",60297),circleSmallFilled:ce("circle-small-filled",60298),debugStackframeDot:ce("debug-stackframe-dot",60298),terminalDecorationMark:ce("terminal-decoration-mark",60298),debugStackframe:ce("debug-stackframe",60299),debugStackframeFocused:ce("debug-stackframe-focused",60299),debugBreakpointUnsupported:ce("debug-breakpoint-unsupported",60300),symbolString:ce("symbol-string",60301),debugReverseContinue:ce("debug-reverse-continue",60302),debugStepBack:ce("debug-step-back",60303),debugRestartFrame:ce("debug-restart-frame",60304),debugAlt:ce("debug-alt",60305),callIncoming:ce("call-incoming",60306),callOutgoing:ce("call-outgoing",60307),menu:ce("menu",60308),expandAll:ce("expand-all",60309),feedback:ce("feedback",60310),gitPullRequestReviewer:ce("git-pull-request-reviewer",60310),groupByRefType:ce("group-by-ref-type",60311),ungroupByRefType:ce("ungroup-by-ref-type",60312),account:ce("account",60313),gitPullRequestAssignee:ce("git-pull-request-assignee",60313),bellDot:ce("bell-dot",60314),debugConsole:ce("debug-console",60315),library:ce("library",60316),output:ce("output",60317),runAll:ce("run-all",60318),syncIgnored:ce("sync-ignored",60319),pinned:ce("pinned",60320),githubInverted:ce("github-inverted",60321),serverProcess:ce("server-process",60322),serverEnvironment:ce("server-environment",60323),pass:ce("pass",60324),issueClosed:ce("issue-closed",60324),stopCircle:ce("stop-circle",60325),playCircle:ce("play-circle",60326),record:ce("record",60327),debugAltSmall:ce("debug-alt-small",60328),vmConnect:ce("vm-connect",60329),cloud:ce("cloud",60330),merge:ce("merge",60331),export:ce("export",60332),graphLeft:ce("graph-left",60333),magnet:ce("magnet",60334),notebook:ce("notebook",60335),redo:ce("redo",60336),checkAll:ce("check-all",60337),pinnedDirty:ce("pinned-dirty",60338),passFilled:ce("pass-filled",60339),circleLargeFilled:ce("circle-large-filled",60340),circleLarge:ce("circle-large",60341),circleLargeOutline:ce("circle-large-outline",60341),combine:ce("combine",60342),gather:ce("gather",60342),table:ce("table",60343),variableGroup:ce("variable-group",60344),typeHierarchy:ce("type-hierarchy",60345),typeHierarchySub:ce("type-hierarchy-sub",60346),typeHierarchySuper:ce("type-hierarchy-super",60347),gitPullRequestCreate:ce("git-pull-request-create",60348),runAbove:ce("run-above",60349),runBelow:ce("run-below",60350),notebookTemplate:ce("notebook-template",60351),debugRerun:ce("debug-rerun",60352),workspaceTrusted:ce("workspace-trusted",60353),workspaceUntrusted:ce("workspace-untrusted",60354),workspaceUnknown:ce("workspace-unknown",60355),terminalCmd:ce("terminal-cmd",60356),terminalDebian:ce("terminal-debian",60357),terminalLinux:ce("terminal-linux",60358),terminalPowershell:ce("terminal-powershell",60359),terminalTmux:ce("terminal-tmux",60360),terminalUbuntu:ce("terminal-ubuntu",60361),terminalBash:ce("terminal-bash",60362),arrowSwap:ce("arrow-swap",60363),copy:ce("copy",60364),personAdd:ce("person-add",60365),filterFilled:ce("filter-filled",60366),wand:ce("wand",60367),debugLineByLine:ce("debug-line-by-line",60368),inspect:ce("inspect",60369),layers:ce("layers",60370),layersDot:ce("layers-dot",60371),layersActive:ce("layers-active",60372),compass:ce("compass",60373),compassDot:ce("compass-dot",60374),compassActive:ce("compass-active",60375),azure:ce("azure",60376),issueDraft:ce("issue-draft",60377),gitPullRequestClosed:ce("git-pull-request-closed",60378),gitPullRequestDraft:ce("git-pull-request-draft",60379),debugAll:ce("debug-all",60380),debugCoverage:ce("debug-coverage",60381),runErrors:ce("run-errors",60382),folderLibrary:ce("folder-library",60383),debugContinueSmall:ce("debug-continue-small",60384),beakerStop:ce("beaker-stop",60385),graphLine:ce("graph-line",60386),graphScatter:ce("graph-scatter",60387),pieChart:ce("pie-chart",60388),bracketDot:ce("bracket-dot",60389),bracketError:ce("bracket-error",60390),lockSmall:ce("lock-small",60391),azureDevops:ce("azure-devops",60392),verifiedFilled:ce("verified-filled",60393),newline:ce("newline",60394),layout:ce("layout",60395),layoutActivitybarLeft:ce("layout-activitybar-left",60396),layoutActivitybarRight:ce("layout-activitybar-right",60397),layoutPanelLeft:ce("layout-panel-left",60398),layoutPanelCenter:ce("layout-panel-center",60399),layoutPanelJustify:ce("layout-panel-justify",60400),layoutPanelRight:ce("layout-panel-right",60401),layoutPanel:ce("layout-panel",60402),layoutSidebarLeft:ce("layout-sidebar-left",60403),layoutSidebarRight:ce("layout-sidebar-right",60404),layoutStatusbar:ce("layout-statusbar",60405),layoutMenubar:ce("layout-menubar",60406),layoutCentered:ce("layout-centered",60407),target:ce("target",60408),indent:ce("indent",60409),recordSmall:ce("record-small",60410),errorSmall:ce("error-small",60411),terminalDecorationError:ce("terminal-decoration-error",60411),arrowCircleDown:ce("arrow-circle-down",60412),arrowCircleLeft:ce("arrow-circle-left",60413),arrowCircleRight:ce("arrow-circle-right",60414),arrowCircleUp:ce("arrow-circle-up",60415),layoutSidebarRightOff:ce("layout-sidebar-right-off",60416),layoutPanelOff:ce("layout-panel-off",60417),layoutSidebarLeftOff:ce("layout-sidebar-left-off",60418),blank:ce("blank",60419),heartFilled:ce("heart-filled",60420),map:ce("map",60421),mapHorizontal:ce("map-horizontal",60421),foldHorizontal:ce("fold-horizontal",60421),mapFilled:ce("map-filled",60422),mapHorizontalFilled:ce("map-horizontal-filled",60422),foldHorizontalFilled:ce("fold-horizontal-filled",60422),circleSmall:ce("circle-small",60423),bellSlash:ce("bell-slash",60424),bellSlashDot:ce("bell-slash-dot",60425),commentUnresolved:ce("comment-unresolved",60426),gitPullRequestGoToChanges:ce("git-pull-request-go-to-changes",60427),gitPullRequestNewChanges:ce("git-pull-request-new-changes",60428),searchFuzzy:ce("search-fuzzy",60429),commentDraft:ce("comment-draft",60430),send:ce("send",60431),sparkle:ce("sparkle",60432),insert:ce("insert",60433),mic:ce("mic",60434),thumbsdownFilled:ce("thumbsdown-filled",60435),thumbsupFilled:ce("thumbsup-filled",60436),coffee:ce("coffee",60437),snake:ce("snake",60438),game:ce("game",60439),vr:ce("vr",60440),chip:ce("chip",60441),piano:ce("piano",60442),music:ce("music",60443),micFilled:ce("mic-filled",60444),repoFetch:ce("repo-fetch",60445),copilot:ce("copilot",60446),lightbulbSparkle:ce("lightbulb-sparkle",60447),robot:ce("robot",60448),sparkleFilled:ce("sparkle-filled",60449),diffSingle:ce("diff-single",60450),diffMultiple:ce("diff-multiple",60451),surroundWith:ce("surround-with",60452),share:ce("share",60453),gitStash:ce("git-stash",60454),gitStashApply:ce("git-stash-apply",60455),gitStashPop:ce("git-stash-pop",60456),vscode:ce("vscode",60457),vscodeInsiders:ce("vscode-insiders",60458),codeOss:ce("code-oss",60459),runCoverage:ce("run-coverage",60460),runAllCoverage:ce("run-all-coverage",60461),coverage:ce("coverage",60462),githubProject:ce("github-project",60463),mapVertical:ce("map-vertical",60464),foldVertical:ce("fold-vertical",60464),mapVerticalFilled:ce("map-vertical-filled",60465),foldVerticalFilled:ce("fold-vertical-filled",60465),goToSearch:ce("go-to-search",60466),percentage:ce("percentage",60467),sortPercentage:ce("sort-percentage",60467),attach:ce("attach",60468),goToEditingSession:ce("go-to-editing-session",60469),editSession:ce("edit-session",60470),codeReview:ce("code-review",60471),copilotWarning:ce("copilot-warning",60472),python:ce("python",60473),copilotLarge:ce("copilot-large",60474),copilotWarningLarge:ce("copilot-warning-large",60475),keyboardTab:ce("keyboard-tab",60476),copilotBlocked:ce("copilot-blocked",60477),copilotNotConnected:ce("copilot-not-connected",60478),flag:ce("flag",60479),lightbulbEmpty:ce("lightbulb-empty",60480),symbolMethodArrow:ce("symbol-method-arrow",60481),copilotUnavailable:ce("copilot-unavailable",60482),repoPinned:ce("repo-pinned",60483),keyboardTabAbove:ce("keyboard-tab-above",60484),keyboardTabBelow:ce("keyboard-tab-below",60485),gitPullRequestDone:ce("git-pull-request-done",60486),mcp:ce("mcp",60487),extensionsLarge:ce("extensions-large",60488),layoutPanelDock:ce("layout-panel-dock",60489),layoutSidebarLeftDock:ce("layout-sidebar-left-dock",60490),layoutSidebarRightDock:ce("layout-sidebar-right-dock",60491),copilotInProgress:ce("copilot-in-progress",60492),copilotError:ce("copilot-error",60493),copilotSuccess:ce("copilot-success",60494),chatSparkle:ce("chat-sparkle",60495),searchSparkle:ce("search-sparkle",60496),editSparkle:ce("edit-sparkle",60497),copilotSnooze:ce("copilot-snooze",60498),sendToRemoteAgent:ce("send-to-remote-agent",60499),commentDiscussionSparkle:ce("comment-discussion-sparkle",60500),chatSparkleWarning:ce("chat-sparkle-warning",60501),chatSparkleError:ce("chat-sparkle-error",60502),collection:ce("collection",60503),newCollection:ce("new-collection",60504),thinking:ce("thinking",60505),build:ce("build",60506),commentDiscussionQuote:ce("comment-discussion-quote",60507),cursor:ce("cursor",60508),eraser:ce("eraser",60509),fileText:ce("file-text",60510),quotes:ce("quotes",60512),rename:ce("rename",60513),runWithDeps:ce("run-with-deps",60514),debugConnected:ce("debug-connected",60515),strikethrough:ce("strikethrough",60516),openInProduct:ce("open-in-product",60517),indexZero:ce("index-zero",60518),agent:ce("agent",60519),editCode:ce("edit-code",60520),repoSelected:ce("repo-selected",60521),skip:ce("skip",60522),mergeInto:ce("merge-into",60523),gitBranchChanges:ce("git-branch-changes",60524),gitBranchStagedChanges:ce("git-branch-staged-changes",60525),gitBranchConflicts:ce("git-branch-conflicts",60526),gitBranch:ce("git-branch",60527),gitBranchCreate:ce("git-branch-create",60527),gitBranchDelete:ce("git-branch-delete",60527),searchLarge:ce("search-large",60528),terminalGitBash:ce("terminal-git-bash",60529),windowActive:ce("window-active",60530),forward:ce("forward",60531),download:ce("download",60532),clockface:ce("clockface",60533),unarchive:ce("unarchive",60534),sessionInProgress:ce("session-in-progress",60535),collectionSmall:ce("collection-small",60536),vmSmall:ce("vm-small",60537),cloudSmall:ce("cloud-small",60538),addSmall:ce("add-small",60539),removeSmall:ce("remove-small",60540),worktreeSmall:ce("worktree-small",60541),worktree:ce("worktree",60542),screenCut:ce("screen-cut",60543),ask:ce("ask",60544),openai:ce("openai",60545),claude:ce("claude",60546),openInWindow:ce("open-in-window",60547),newSession:ce("new-session",60548)};function k$(){return Object.values(M)}var MRo={dialogError:ce("dialog-error","error"),dialogWarning:ce("dialog-warning","warning"),dialogInfo:ce("dialog-info","info"),dialogClose:ce("dialog-close","close"),treeItemExpanded:ce("tree-item-expanded","chevron-down"),treeFilterOnTypeOn:ce("tree-filter-on-type-on","list-filter"),treeFilterOnTypeOff:ce("tree-filter-on-type-off","list-selection"),treeFilterClear:ce("tree-filter-clear","close"),treeItemLoading:ce("tree-item-loading","loading"),menuSelection:ce("menu-selection","check"),menuSubmenu:ce("menu-submenu","chevron-right"),menuBarMore:ce("menubar-more","more"),scrollbarButtonLeft:ce("scrollbar-button-left","triangle-left"),scrollbarButtonRight:ce("scrollbar-button-right","triangle-right"),scrollbarButtonUp:ce("scrollbar-button-up","triangle-up"),scrollbarButtonDown:ce("scrollbar-button-down","triangle-down"),toolBarMore:ce("toolbar-more","more"),quickInputBack:ce("quick-input-back","arrow-left"),dropDownButton:ce("drop-down-button",60084),symbolCustomColor:ce("symbol-customcolor",60252),exportIcon:ce("export",60332),workspaceUnspecified:ce("workspace-unspecified",60355),newLine:ce("newline",60394),thumbsDownFilled:ce("thumbsdown-filled",60435),thumbsUpFilled:ce("thumbsup-filled",60436),gitFetch:ce("git-fetch",60445),lightbulbSparkleAutofix:ce("lightbulb-sparkle-autofix",60447),debugBreakpointPending:ce("debug-breakpoint-pending",60377)},M={...R6,...MRo};var Gzi;(i=>{function a(e){return!!e&&typeof e=="object"&&typeof e.id=="string"}i.isThemeColor=a})(Gzi||={});function If(a){return{id:a}}var q;(S=>{S.iconNameSegment="[A-Za-z0-9]+",S.iconNameExpression="[A-Za-z0-9-]+",S.iconModifierExpression="~[A-Za-z]+",S.iconNameCharacter="[A-Za-z0-9~-]";let o=new RegExp(`^(${S.iconNameExpression})(${S.iconModifierExpression})?$`);function n(y){let w=o.exec(y.id);if(!w)return n(M.error);let[,k,T]=w,N=["codicon","codicon-"+k];return T&&N.push("codicon-modifier-"+T.substring(1)),N}S.asClassNameArray=n;function r(y){return n(y).join(" ")}S.asClassName=r;function s(y){return"."+n(y).join(".")}S.asCSSSelector=s;function l(y){return!!y&&typeof y=="object"&&typeof y.id=="string"&&(typeof y.color>"u"||Gzi.isThemeColor(y.color))}S.isThemeIcon=l;let c=new RegExp(`^\\$\\((${S.iconNameExpression}(?:${S.iconModifierExpression})?)\\)$`);function u(y){let w=c.exec(y);if(!w)return;let[,k]=w;return{id:k}}S.fromString=u;function p(y){return{id:y}}S.fromId=p;function h(y,w){let k=y.id,T=k.lastIndexOf("~");return T!==-1&&(k=k.substring(0,T)),w&&(k=`${k}~${w}`),{id:k}}S.modify=h;function g(y){let w=y.id.lastIndexOf("~");if(w!==-1)return y.id.substring(w+1)}S.getModifier=g;function f(y,w){return y.id===w.id&&y.color?.id===w.color?.id}S.isEqual=f;function v(y){return y?.id===M.file.id}S.isFile=v;function b(y){return y?.id===M.folder.id}S.isFolder=b})(q||={});var ge=ae("commandService"),qe=new class{constructor(){this._commands=new Map;this._onDidRegisterCommand=new E;this.onDidRegisterCommand=this._onDidRegisterCommand.event}registerCommand(a,i){if(!a)throw new Error("invalid command");if(typeof a=="string"){if(!i)throw new Error("invalid command");return this.registerCommand({id:a,handler:i})}if(a.metadata&&Array.isArray(a.metadata.args)){let r=[];for(let l of a.metadata.args)r.push(l.constraint);let s=a.handler;a.handler=function(l,...c){return wUi(c,r),s(l,...c)}}let{id:e}=a,t=this._commands.get(e);t||(t=new Vs,this._commands.set(e,t));let o=t.unshift(a),n=Z(()=>{o(),this._commands.get(e)?.isEmpty()&&this._commands.delete(e)});return this._onDidRegisterCommand.fire(e),Mp(n)}registerCommandAlias(a,i){return qe.registerCommand(a,(e,...t)=>e.get(ge).executeCommand(i,...t))}getCommand(a){let i=this._commands.get(a);if(!(!i||i.isEmpty()))return ht.first(i)}getCommands(){let a=new Map;for(let i of this._commands.keys()){let e=this.getCommand(i);e&&a.set(i,e)}return a}};qe.registerCommand("noop",()=>{});function p7t(...a){switch(a.length){case 1:return d(1862,null,a[0]);case 2:return d(1863,null,a[0],a[1]);case 3:return d(1864,null,a[0],a[1],a[2]);default:return}}var PRo=d(1861,null),ARo=d(1860,null),M6=class a{constructor(){this._input="";this._start=0;this._current=0;this._tokens=[];this._errors=[];this.stringRe=/[a-zA-Z0-9_<>\-\./\\:\*\?\+\[\]\^,#@;"%\$\p{L}-]+/uy}static getLexeme(i){switch(i.type){case 0:return"(";case 1:return")";case 2:return"!";case 3:return i.isTripleEq?"===":"==";case 4:return i.isTripleEq?"!==":"!=";case 5:return"<";case 6:return"<=";case 7:return">=";case 8:return">=";case 9:return"=~";case 10:return i.lexeme;case 11:return"true";case 12:return"false";case 13:return"in";case 14:return"not";case 15:return"&&";case 16:return"||";case 17:return i.lexeme;case 18:return i.lexeme;case 19:return i.lexeme;case 20:return"EOF";default:throw Xve(`unhandled token type: ${JSON.stringify(i)}; have you forgotten to add a case?`)}}static{this._regexFlags=new Set(["i","g","s","m","y","u"].map(i=>i.charCodeAt(0)))}static{this._keywords=new Map([["not",14],["in",13],["false",12],["true",11]])}get errors(){return this._errors}reset(i){return this._input=i,this._start=0,this._current=0,this._tokens=[],this._errors=[],this}scan(){for(;!this._isAtEnd();)switch(this._start=this._current,this._advance()){case 40:this._addToken(0);break;case 41:this._addToken(1);break;case 33:if(this._match(61)){let e=this._match(61);this._tokens.push({type:4,offset:this._start,isTripleEq:e})}else this._addToken(2);break;case 39:this._quotedString();break;case 47:this._regex();break;case 61:if(this._match(61)){let e=this._match(61);this._tokens.push({type:3,offset:this._start,isTripleEq:e})}else this._match(126)?this._addToken(9):this._error(p7t("==","=~"));break;case 60:this._addToken(this._match(61)?6:5);break;case 62:this._addToken(this._match(61)?8:7);break;case 38:this._match(38)?this._addToken(15):this._error(p7t("&&"));break;case 124:this._match(124)?this._addToken(16):this._error(p7t("||"));break;case 32:case 13:case 9:case 10:case 160:break;default:this._string()}return this._start=this._current,this._addToken(20),Array.from(this._tokens)}_match(i){return this._isAtEnd()||this._input.charCodeAt(this._current)!==i?!1:(this._current++,!0)}_advance(){return this._input.charCodeAt(this._current++)}_peek(){return this._isAtEnd()?0:this._input.charCodeAt(this._current)}_addToken(i){this._tokens.push({type:i,offset:this._start})}_error(i){let e=this._start,t=this._input.substring(this._start,this._current),o={type:19,offset:this._start,lexeme:t};this._errors.push({offset:e,lexeme:t,additionalInfo:i}),this._tokens.push(o)}_string(){this.stringRe.lastIndex=this._start;let i=this.stringRe.exec(this._input);if(i){this._current=this._start+i[0].length;let e=this._input.substring(this._start,this._current),t=a._keywords.get(e);t?this._addToken(t):this._tokens.push({type:17,lexeme:e,offset:this._start})}}_quotedString(){for(;this._peek()!==39&&!this._isAtEnd();)this._advance();if(this._isAtEnd()){this._error(PRo);return}this._advance(),this._tokens.push({type:18,lexeme:this._input.substring(this._start+1,this._current-1),offset:this._start+1})}_regex(){let i=this._current,e=!1,t=!1;for(;;){if(i>=this._input.length){this._current=i,this._error(ARo);return}let n=this._input.charCodeAt(i);if(e)e=!1;else if(n===47&&!t){i++;break}else n===91?t=!0:n===92?e=!0:n===93&&(t=!1);i++}for(;i<this._input.length&&a._regexFlags.has(this._input.charCodeAt(i));)i++;this._current=i;let o=this._input.substring(this._start,this._current);this._tokens.push({type:10,lexeme:o,offset:this._start})}_isAtEnd(){return this._current>=this._input.length}};var xS=new Map;xS.set("false",!1);xS.set("true",!0);xS.set("isMac",it);xS.set("isLinux",Wn);xS.set("isWindows",ri);xS.set("isWeb",Gt);xS.set("isMacNative",it&&!Gt);xS.set("isEdge",dbe);xS.set("isFirefox",lbe);xS.set("isChrome",XH);xS.set("isSafari",cbe);function Qzi(a,i){if(xS.get(a)!==void 0)throw Br("contextkey.setConstant(k, v) invoked with already set constant `k`");xS.set(a,i)}var NRo=Object.prototype.hasOwnProperty;var ORo={regexParsingWithErrorRecovery:!0},FRo=d(1841,null),WRo=d(1842,null),VRo=d(1844,null),$zi=d(1840,null),BRo=d(1847,null),HRo=d(1848,null),URo=d(1845,null),zRo=d(1846,null),m7t=class a{constructor(i=ORo){this._config=i;this._scanner=new M6;this._tokens=[];this._current=0;this._parsingErrors=[];this._flagsGYRe=/g|y/g}static{this._parseError=new Error}get lexingErrors(){return this._scanner.errors}get parsingErrors(){return this._parsingErrors}parse(i){if(i===""){this._parsingErrors.push({message:FRo,offset:0,lexeme:"",additionalInfo:WRo});return}this._tokens=this._scanner.reset(i).scan(),this._current=0,this._parsingErrors=[];try{let e=this._expr();if(!this._isAtEnd()){let t=this._peek(),o=t.type===17?HRo:void 0;throw this._parsingErrors.push({message:BRo,offset:t.offset,lexeme:M6.getLexeme(t),additionalInfo:o}),a._parseError}return e}catch(e){if(e!==a._parseError)throw e;return}}_expr(){return this._or()}_or(){let i=[this._and()];for(;this._matchOne(16);){let e=this._and();i.push(e)}return i.length===1?i[0]:x.or(...i)}_and(){let i=[this._term()];for(;this._matchOne(15);){let e=this._term();i.push(e)}return i.length===1?i[0]:x.and(...i)}_term(){if(this._matchOne(2)){let i=this._peek();switch(i.type){case 11:return this._advance(),Ry.INSTANCE;case 12:return this._advance(),PI.INSTANCE;case 0:{this._advance();let e=this._expr();return this._consume(1,$zi),e?.negate()}case 17:return this._advance(),Bre.create(i.lexeme);default:throw this._errExpectedButGot("KEY | true | false | '(' expression ')'",i)}}return this._primary()}_primary(){let i=this._peek();switch(i.type){case 11:return this._advance(),x.true();case 12:return this._advance(),x.false();case 0:{this._advance();let e=this._expr();return this._consume(1,$zi),e}case 17:{let e=i.lexeme;if(this._advance(),this._matchOne(9)){let o=this._peek();if(!this._config.regexParsingWithErrorRecovery){if(this._advance(),o.type!==10)throw this._errExpectedButGot("REGEX",o);let n=o.lexeme,r=n.lastIndexOf("/"),s=r===n.length-1?void 0:this._removeFlagsGY(n.substring(r+1)),l;try{l=new RegExp(n.substring(1,r),s)}catch{throw this._errExpectedButGot("REGEX",o)}return VGe.create(e,l)}switch(o.type){case 10:case 19:{let n=[o.lexeme];this._advance();let r=this._peek(),s=0;for(let h=0;h<o.lexeme.length;h++)o.lexeme.charCodeAt(h)===40?s++:o.lexeme.charCodeAt(h)===41&&s--;for(;!this._isAtEnd()&&r.type!==15&&r.type!==16;){switch(r.type){case 0:s++;break;case 1:s--;break;case 10:case 18:for(let h=0;h<r.lexeme.length;h++)r.lexeme.charCodeAt(h)===40?s++:o.lexeme.charCodeAt(h)===41&&s--}if(s<0)break;n.push(M6.getLexeme(r)),this._advance(),r=this._peek()}let l=n.join(""),c=l.lastIndexOf("/"),u=c===l.length-1?void 0:this._removeFlagsGY(l.substring(c+1)),p;try{p=new RegExp(l.substring(1,c),u)}catch{throw this._errExpectedButGot("REGEX",o)}return x.regex(e,p)}case 18:{let n=o.lexeme;this._advance();let r=null;if(!Jl(n)){let s=n.indexOf("/"),l=n.lastIndexOf("/");if(s!==l&&s>=0){let c=n.slice(s+1,l),u=n[l+1]==="i"?"i":"";try{r=new RegExp(c,u)}catch{throw this._errExpectedButGot("REGEX",o)}}}if(r===null)throw this._errExpectedButGot("REGEX",o);return VGe.create(e,r)}default:throw this._errExpectedButGot("REGEX",this._peek())}}if(this._matchOne(14)){this._consume(13,VRo);let o=this._value();return x.notIn(e,o)}switch(this._peek().type){case 3:{this._advance();let o=this._value();if(this._previous().type===18)return x.equals(e,o);switch(o){case"true":return x.has(e);case"false":return x.not(e);default:return x.equals(e,o)}}case 4:{this._advance();let o=this._value();if(this._previous().type===18)return x.notEquals(e,o);switch(o){case"true":return x.not(e);case"false":return x.has(e);default:return x.notEquals(e,o)}}case 5:return this._advance(),FGe.create(e,this._value());case 6:return this._advance(),WGe.create(e,this._value());case 7:return this._advance(),P6.create(e,this._value());case 8:return this._advance(),OGe.create(e,this._value());case 13:return this._advance(),x.in(e,this._value());default:return x.has(e)}}case 20:throw this._parsingErrors.push({message:URo,offset:i.offset,lexeme:"",additionalInfo:zRo}),a._parseError;default:throw this._errExpectedButGot(`true | false | KEY
| KEY '=~' REGEX
| KEY ('==' | '!=' | '<' | '<=' | '>' | '>=' | 'in' | 'not' 'in') value`,this._peek())}}_value(){let i=this._peek();switch(i.type){case 17:case 18:return this._advance(),i.lexeme;case 11:return this._advance(),"true";case 12:return this._advance(),"false";case 13:return this._advance(),"in";default:return""}}_removeFlagsGY(i){return i.replaceAll(this._flagsGYRe,"")}_previous(){return this._tokens[this._current-1]}_matchOne(i){return this._check(i)?(this._advance(),!0):!1}_advance(){return this._isAtEnd()||this._current++,this._previous()}_consume(i,e){if(this._check(i))return this._advance();throw this._errExpectedButGot(e,this._peek())}_errExpectedButGot(i,e,t){let o=d(1843,null,i,M6.getLexeme(e)),n=e.offset,r=M6.getLexeme(e);return this._parsingErrors.push({message:o,offset:n,lexeme:r,additionalInfo:t}),a._parseError}_check(i){return this._peek().type===i}_peek(){return this._tokens[this._current]}_isAtEnd(){return this._peek().type===20}},x=class{static false(){return Ry.INSTANCE}static true(){return PI.INSTANCE}static has(i){return zk.create(i)}static equals(i,e){return eW.create(i,e)}static notEquals(i,e){return NGe.create(i,e)}static regex(i,e){return VGe.create(i,e)}static in(i,e){return lmt.create(i,e)}static notIn(i,e){return cmt.create(i,e)}static not(i){return Bre.create(i)}static and(...i){return dmt.create(i,null,!0)}static or(...i){return BGe.create(i,null,!0)}static greater(i,e){return P6.create(i,e)}static greaterEquals(i,e){return OGe.create(i,e)}static smaller(i,e){return FGe.create(i,e)}static smallerEquals(i,e){return WGe.create(i,e)}static{this._parser=new m7t({regexParsingWithErrorRecovery:!1})}static deserialize(i){return i==null?void 0:this._parser.parse(i)}};function Yzi(a,i){let e=a?a.substituteConstants():void 0,t=i?i.substituteConstants():void 0;return!e&&!t?!0:!e||!t?!1:e.equals(t)}function AGe(a,i){return a.cmp(i)}var Ry=class a{constructor(){this.type=0}static{this.INSTANCE=new a}cmp(i){return this.type-i.type}equals(i){return i.type===this.type}substituteConstants(){return this}evaluate(i){return!1}serialize(){return"false"}keys(){return[]}map(i){return this}negate(){return PI.INSTANCE}},PI=class a{constructor(){this.type=1}static{this.INSTANCE=new a}cmp(i){return this.type-i.type}equals(i){return i.type===this.type}substituteConstants(){return this}evaluate(i){return!0}serialize(){return"true"}keys(){return[]}map(i){return this}negate(){return Ry.INSTANCE}},zk=class a{constructor(i,e){this.key=i;this.negated=e;this.type=2}static create(i,e=null){let t=xS.get(i);return typeof t=="boolean"?t?PI.INSTANCE:Ry.INSTANCE:new a(i,e)}cmp(i){return i.type!==this.type?this.type-i.type:Jzi(this.key,i.key)}equals(i){return i.type===this.type?this.key===i.key:!1}substituteConstants(){let i=xS.get(this.key);return typeof i=="boolean"?i?PI.INSTANCE:Ry.INSTANCE:this}evaluate(i){return!!i.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}map(i){return i.mapDefined(this.key)}negate(){return this.negated||(this.negated=Bre.create(this.key,this)),this.negated}},eW=class a{constructor(i,e,t){this.key=i;this.value=e;this.negated=t;this.type=4}static create(i,e,t=null){if(typeof e=="boolean")return e?zk.create(i,t):Bre.create(i,t);let o=xS.get(i);return typeof o=="boolean"?e===(o?"true":"false")?PI.INSTANCE:Ry.INSTANCE:new a(i,e,t)}cmp(i){return i.type!==this.type?this.type-i.type:Hre(this.key,this.value,i.key,i.value)}equals(i){return i.type===this.type?this.key===i.key&&this.value===i.value:!1}substituteConstants(){let i=xS.get(this.key);if(typeof i=="boolean"){let e=i?"true":"false";return this.value===e?PI.INSTANCE:Ry.INSTANCE}return this}evaluate(i){return i.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}map(i){return i.mapEquals(this.key,this.value)}negate(){return this.negated||(this.negated=NGe.create(this.key,this.value,this)),this.negated}},lmt=class a{constructor(i,e){this.key=i;this.valueKey=e;this.type=10;this.negated=null}static create(i,e){return new a(i,e)}cmp(i){return i.type!==this.type?this.type-i.type:Hre(this.key,this.valueKey,i.key,i.valueKey)}equals(i){return i.type===this.type?this.key===i.key&&this.valueKey===i.valueKey:!1}substituteConstants(){return this}evaluate(i){let e=i.getValue(this.valueKey),t=i.getValue(this.key);if(Array.isArray(e)){if(e.includes(t))return!0;if(ri&&typeof t=="string"&&t.startsWith("file:///")){let o=t.toLowerCase();return e.some(n=>typeof n=="string"&&n.toLowerCase()===o)}return!1}if(typeof t=="string"&&typeof e=="object"&&e!==null){if(NRo.call(e,t))return!0;if(ri&&t.startsWith("file:///")){let o=t.toLowerCase();return Object.keys(e).some(n=>n.toLowerCase()===o)}return!1}return!1}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}map(i){return i.mapIn(this.key,this.valueKey)}negate(){return this.negated||(this.negated=cmt.create(this.key,this.valueKey)),this.negated}},cmt=class a{constructor(i,e){this.key=i;this.valueKey=e;this.type=11;this._negated=lmt.create(i,e)}static create(i,e){return new a(i,e)}cmp(i){return i.type!==this.type?this.type-i.type:this._negated.cmp(i._negated)}equals(i){return i.type===this.type?this._negated.equals(i._negated):!1}substituteConstants(){return this}evaluate(i){return!this._negated.evaluate(i)}serialize(){return`${this.key} not in '${this.valueKey}'`}keys(){return this._negated.keys()}map(i){return i.mapNotIn(this.key,this.valueKey)}negate(){return this._negated}},NGe=class a{constructor(i,e,t){this.key=i;this.value=e;this.negated=t;this.type=5}static create(i,e,t=null){if(typeof e=="boolean")return e?Bre.create(i,t):zk.create(i,t);let o=xS.get(i);return typeof o=="boolean"?e===(o?"true":"false")?Ry.INSTANCE:PI.INSTANCE:new a(i,e,t)}cmp(i){return i.type!==this.type?this.type-i.type:Hre(this.key,this.value,i.key,i.value)}equals(i){return i.type===this.type?this.key===i.key&&this.value===i.value:!1}substituteConstants(){let i=xS.get(this.key);if(typeof i=="boolean"){let e=i?"true":"false";return this.value===e?Ry.INSTANCE:PI.INSTANCE}return this}evaluate(i){return i.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}map(i){return i.mapNotEquals(this.key,this.value)}negate(){return this.negated||(this.negated=eW.create(this.key,this.value,this)),this.negated}},Bre=class a{constructor(i,e){this.key=i;this.negated=e;this.type=3}static create(i,e=null){let t=xS.get(i);return typeof t=="boolean"?t?Ry.INSTANCE:PI.INSTANCE:new a(i,e)}cmp(i){return i.type!==this.type?this.type-i.type:Jzi(this.key,i.key)}equals(i){return i.type===this.type?this.key===i.key:!1}substituteConstants(){let i=xS.get(this.key);return typeof i=="boolean"?i?Ry.INSTANCE:PI.INSTANCE:this}evaluate(i){return!i.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}map(i){return i.mapNot(this.key)}negate(){return this.negated||(this.negated=zk.create(this.key,this)),this.negated}};function pmt(a,i){if(typeof a=="string"){let e=parseFloat(a);isNaN(e)||(a=e)}return typeof a=="string"||typeof a=="number"?i(a):Ry.INSTANCE}var P6=class a{constructor(i,e,t){this.key=i;this.value=e;this.negated=t;this.type=12}static create(i,e,t=null){return pmt(e,o=>new a(i,o,t))}cmp(i){return i.type!==this.type?this.type-i.type:Hre(this.key,this.value,i.key,i.value)}equals(i){return i.type===this.type?this.key===i.key&&this.value===i.value:!1}substituteConstants(){return this}evaluate(i){return typeof this.value=="string"?!1:parseFloat(i.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}map(i){return i.mapGreater(this.key,this.value)}negate(){return this.negated||(this.negated=WGe.create(this.key,this.value,this)),this.negated}},OGe=class a{constructor(i,e,t){this.key=i;this.value=e;this.negated=t;this.type=13}static create(i,e,t=null){return pmt(e,o=>new a(i,o,t))}cmp(i){return i.type!==this.type?this.type-i.type:Hre(this.key,this.value,i.key,i.value)}equals(i){return i.type===this.type?this.key===i.key&&this.value===i.value:!1}substituteConstants(){return this}evaluate(i){return typeof this.value=="string"?!1:parseFloat(i.getValue(this.key))>=this.value}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}map(i){return i.mapGreaterEquals(this.key,this.value)}negate(){return this.negated||(this.negated=FGe.create(this.key,this.value,this)),this.negated}},FGe=class a{constructor(i,e,t){this.key=i;this.value=e;this.negated=t;this.type=14}static create(i,e,t=null){return pmt(e,o=>new a(i,o,t))}cmp(i){return i.type!==this.type?this.type-i.type:Hre(this.key,this.value,i.key,i.value)}equals(i){return i.type===this.type?this.key===i.key&&this.value===i.value:!1}substituteConstants(){return this}evaluate(i){return typeof this.value=="string"?!1:parseFloat(i.getValue(this.key))<this.value}serialize(){return`${this.key} < ${this.value}`}keys(){return[this.key]}map(i){return i.mapSmaller(this.key,this.value)}negate(){return this.negated||(this.negated=OGe.create(this.key,this.value,this)),this.negated}},WGe=class a{constructor(i,e,t){this.key=i;this.value=e;this.negated=t;this.type=15}static create(i,e,t=null){return pmt(e,o=>new a(i,o,t))}cmp(i){return i.type!==this.type?this.type-i.type:Hre(this.key,this.value,i.key,i.value)}equals(i){return i.type===this.type?this.key===i.key&&this.value===i.value:!1}substituteConstants(){return this}evaluate(i){return typeof this.value=="string"?!1:parseFloat(i.getValue(this.key))<=this.value}serialize(){return`${this.key} <= ${this.value}`}keys(){return[this.key]}map(i){return i.mapSmallerEquals(this.key,this.value)}negate(){return this.negated||(this.negated=P6.create(this.key,this.value,this)),this.negated}},VGe=class a{constructor(i,e){this.key=i;this.regexp=e;this.type=7;this.negated=null}static create(i,e){return new a(i,e)}cmp(i){if(i.type!==this.type)return this.type-i.type;if(this.key<i.key)return-1;if(this.key>i.key)return 1;let e=this.regexp?this.regexp.source:"",t=i.regexp?i.regexp.source:"";return e<t?-1:e>t?1:0}equals(i){if(i.type===this.type){let e=this.regexp?this.regexp.source:"",t=i.regexp?i.regexp.source:"";return this.key===i.key&&e===t}return!1}substituteConstants(){return this}evaluate(i){let e=i.getValue(this.key);return this.regexp?this.regexp.test(e):!1}serialize(){let i=this.regexp?`/${this.regexp.source}/${this.regexp.flags}`:"/invalid/";return`${this.key} =~ ${i}`}keys(){return[this.key]}map(i){return i.mapRegex(this.key,this.regexp)}negate(){return this.negated||(this.negated=h7t.create(this)),this.negated}},h7t=class a{constructor(i){this._actual=i;this.type=8}static create(i){return new a(i)}cmp(i){return i.type!==this.type?this.type-i.type:this._actual.cmp(i._actual)}equals(i){return i.type===this.type?this._actual.equals(i._actual):!1}substituteConstants(){return this}evaluate(i){return!this._actual.evaluate(i)}serialize(){return`!(${this._actual.serialize()})`}keys(){return this._actual.keys()}map(i){return new a(this._actual.map(i))}negate(){return this._actual}};function Xzi(a){let i=null;for(let e=0,t=a.length;e<t;e++){let o=a[e].substituteConstants();if(a[e]!==o&&i===null){i=[];for(let n=0;n<e;n++)i[n]=a[n]}i!==null&&(i[e]=o)}return i===null?a:i}var dmt=class a{constructor(i,e){this.expr=i;this.negated=e;this.type=6}static create(i,e,t){return a._normalizeArr(i,e,t)}cmp(i){if(i.type!==this.type)return this.type-i.type;if(this.expr.length<i.expr.length)return-1;if(this.expr.length>i.expr.length)return 1;for(let e=0,t=this.expr.length;e<t;e++){let o=AGe(this.expr[e],i.expr[e]);if(o!==0)return o}return 0}equals(i){if(i.type===this.type){if(this.expr.length!==i.expr.length)return!1;for(let e=0,t=this.expr.length;e<t;e++)if(!this.expr[e].equals(i.expr[e]))return!1;return!0}return!1}substituteConstants(){let i=Xzi(this.expr);return i===this.expr?this:a.create(i,this.negated,!1)}evaluate(i){for(let e=0,t=this.expr.length;e<t;e++)if(!this.expr[e].evaluate(i))return!1;return!0}static _normalizeArr(i,e,t){let o=[],n=!1;for(let r of i)if(r){if(r.type===1){n=!0;continue}if(r.type===0)return Ry.INSTANCE;if(r.type===6){o.push(...r.expr);continue}o.push(r)}if(o.length===0&&n)return PI.INSTANCE;if(o.length!==0){if(o.length===1)return o[0];o.sort(AGe);for(let r=1;r<o.length;r++)o[r-1].equals(o[r])&&(o.splice(r,1),r--);if(o.length===1)return o[0];for(;o.length>1;){let r=o[o.length-1];if(r.type!==9)break;o.pop();let s=o.pop(),l=o.length===0,c=BGe.create(r.expr.map(u=>a.create([u,s],null,t)),null,l);c&&(o.push(c),o.sort(AGe))}if(o.length===1)return o[0];if(t){for(let r=0;r<o.length;r++)for(let s=r+1;s<o.length;s++)if(o[r].negate().equals(o[s]))return Ry.INSTANCE;if(o.length===1)return o[0]}return new a(o,e)}}serialize(){return this.expr.map(i=>i.serialize()).join(" && ")}keys(){let i=[];for(let e of this.expr)i.push(...e.keys());return i}map(i){return new a(this.expr.map(e=>e.map(i)),null)}negate(){if(!this.negated){let i=[];for(let e of this.expr)i.push(e.negate());this.negated=BGe.create(i,this,!0)}return this.negated}},BGe=class a{constructor(i,e){this.expr=i;this.negated=e;this.type=9}static create(i,e,t){return a._normalizeArr(i,e,t)}cmp(i){if(i.type!==this.type)return this.type-i.type;if(this.expr.length<i.expr.length)return-1;if(this.expr.length>i.expr.length)return 1;for(let e=0,t=this.expr.length;e<t;e++){let o=AGe(this.expr[e],i.expr[e]);if(o!==0)return o}return 0}equals(i){if(i.type===this.type){if(this.expr.length!==i.expr.length)return!1;for(let e=0,t=this.expr.length;e<t;e++)if(!this.expr[e].equals(i.expr[e]))return!1;return!0}return!1}substituteConstants(){let i=Xzi(this.expr);return i===this.expr?this:a.create(i,this.negated,!1)}evaluate(i){for(let e=0,t=this.expr.length;e<t;e++)if(this.expr[e].evaluate(i))return!0;return!1}static _normalizeArr(i,e,t){let o=[],n=!1;if(i){for(let r=0,s=i.length;r<s;r++){let l=i[r];if(l){if(l.type===0){n=!0;continue}if(l.type===1)return PI.INSTANCE;if(l.type===9){o=o.concat(l.expr);continue}o.push(l)}}if(o.length===0&&n)return Ry.INSTANCE;o.sort(AGe)}if(o.length!==0){if(o.length===1)return o[0];for(let r=1;r<o.length;r++)o[r-1].equals(o[r])&&(o.splice(r,1),r--);if(o.length===1)return o[0];if(t){for(let r=0;r<o.length;r++)for(let s=r+1;s<o.length;s++)if(o[r].negate().equals(o[s]))return PI.INSTANCE;if(o.length===1)return o[0]}return new a(o,e)}}serialize(){return this.expr.map(i=>i.serialize()).join(" || ")}keys(){let i=[];for(let e of this.expr)i.push(...e.keys());return i}map(i){return new a(this.expr.map(e=>e.map(i)),null)}negate(){if(!this.negated){let i=[];for(let e of this.expr)i.push(e.negate());for(;i.length>1;){let e=i.shift(),t=i.shift(),o=[];for(let n of jzi(e))for(let r of jzi(t))o.push(dmt.create([n,r],null,!1));i.unshift(a.create(o,null,!1))}this.negated=a.create(i,this,!0)}return this.negated}},Q=class a extends zk{static{this._info=[]}static all(){return a._info.values()}constructor(i,e,t){super(i,null),this._defaultValue=e,typeof t=="object"?a._info.push({...t,key:i}):t!==!0&&a._info.push({key:i,description:t,type:e!=null?typeof e:void 0})}bindTo(i){return i.createKey(this.key,this._defaultValue)}getValue(i){return i.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(i){return eW.create(this.key,i)}notEqualsTo(i){return NGe.create(this.key,i)}greater(i){return P6.create(this.key,i)}},X=ae("contextKeyService");function Jzi(a,i){return a<i?-1:a>i?1:0}function Hre(a,i,e,t){return a<e?-1:a>e?1:i<t?-1:i>t?1:0}function umt(a,i){if(a.type===0||i.type===1)return!0;if(a.type===9)return i.type===9?qzi(a.expr,i.expr):!1;if(i.type===9){for(let e of i.expr)if(umt(a,e))return!0;return!1}if(a.type===6){if(i.type===6)return qzi(i.expr,a.expr);for(let e of a.expr)if(umt(e,i))return!0;return!1}return a.equals(i)}function qzi(a,i){let e=0,t=0;for(;e<a.length&&t<i.length;){let o=a[e].cmp(i[t]);if(o<0)return!1;o===0&&e++,t++}return e===a.length}function jzi(a){return a.type===9?a.expr:[a]}var g7t=class{constructor(){this.data=new Map}add(i,e){c6(Ae(i)),c6(yi(e)),c6(!this.data.has(i),"There is already an extension with this id"),this.data.set(i,e)}knows(i){return this.data.has(i)}as(i){return this.data.get(i)||null}dispose(){this.data.forEach(i=>{HD(i.dispose)&&i.dispose()}),this.data.clear()}},oe=new g7t;var f7t=class a{constructor(){this._coreKeybindings=new Vs,this._extensionKeybindings=[],this._cachedMergedKeybindings=null}static bindToCurrentPlatform(i){if(zo===1){if(i&&i.win)return i.win}else if(zo===2){if(i&&i.mac)return i.mac}else if(i&&i.linux)return i.linux;return i}registerKeybindingRule(i){let e=a.bindToCurrentPlatform(i),t=new P;if(e&&e.primary){let o=Z6t(e.primary,zo);o&&t.add(this._registerDefaultKeybinding(o,i.id,i.args,i.weight,0,i.when))}if(e&&Array.isArray(e.secondary))for(let o=0,n=e.secondary.length;o<n;o++){let r=e.secondary[o],s=Z6t(r,zo);s&&t.add(this._registerDefaultKeybinding(s,i.id,i.args,i.weight,-o-1,i.when))}return t}setExtensionKeybindings(i){let e=[],t=0;for(let o of i)o.keybinding&&(e[t++]={keybinding:o.keybinding,command:o.id,commandArgs:o.args,when:o.when,weight1:o.weight,weight2:0,extensionId:o.extensionId||null,isBuiltinExtension:o.isBuiltinExtension||!1});this._extensionKeybindings=e,this._cachedMergedKeybindings=null}registerCommandAndKeybindingRule(i){return hn(this.registerKeybindingRule(i),qe.registerCommand(i))}_registerDefaultKeybinding(i,e,t,o,n,r){let s=this._coreKeybindings.push({keybinding:i,command:e,commandArgs:t,when:r,weight1:o,weight2:n,extensionId:null,isBuiltinExtension:!1});return this._cachedMergedKeybindings=null,Z(()=>{s(),this._cachedMergedKeybindings=null})}getDefaultKeybindings(){return this._cachedMergedKeybindings||(this._cachedMergedKeybindings=Array.from(this._coreKeybindings).concat(this._extensionKeybindings),this._cachedMergedKeybindings.sort(GRo)),this._cachedMergedKeybindings.slice(0)}},yt=new f7t,KRo={EditorModes:"platform.keybindingsRegistry"};oe.add(KRo.EditorModes,yt);function GRo(a,i){if(a.weight1!==i.weight1)return a.weight1-i.weight1;if(a.command&&i.command){if(a.command<i.command)return-1;if(a.command>i.command)return 1}return a.weight2-i.weight2}function Kk(a){return a.command!==void 0}function Zzi(a){return a.submenu!==void 0}var D=class a{static{this._instances=new Map}static{this.CommandPalette=new a("CommandPalette")}static{this.DebugBreakpointsContext=new a("DebugBreakpointsContext")}static{this.DebugCallStackContext=new a("DebugCallStackContext")}static{this.DebugConsoleContext=new a("DebugConsoleContext")}static{this.DebugVariablesContext=new a("DebugVariablesContext")}static{this.NotebookVariablesContext=new a("NotebookVariablesContext")}static{this.DebugHoverContext=new a("DebugHoverContext")}static{this.DebugWatchContext=new a("DebugWatchContext")}static{this.DebugToolBar=new a("DebugToolBar")}static{this.DebugToolBarStop=new a("DebugToolBarStop")}static{this.DebugDisassemblyContext=new a("DebugDisassemblyContext")}static{this.DebugCallStackToolbar=new a("DebugCallStackToolbar")}static{this.DebugCreateConfiguration=new a("DebugCreateConfiguration")}static{this.DebugScopesContext=new a("DebugScopesContext")}static{this.EditorContext=new a("EditorContext")}static{this.SimpleEditorContext=new a("SimpleEditorContext")}static{this.EditorContent=new a("EditorContent")}static{this.EditorLineNumberContext=new a("EditorLineNumberContext")}static{this.EditorContextCopy=new a("EditorContextCopy")}static{this.EditorContextPeek=new a("EditorContextPeek")}static{this.EditorContextShare=new a("EditorContextShare")}static{this.EditorTitle=new a("EditorTitle")}static{this.ModalEditorTitle=new a("ModalEditorTitle")}static{this.CompactWindowEditorTitle=new a("CompactWindowEditorTitle")}static{this.EditorTitleRun=new a("EditorTitleRun")}static{this.EditorTitleContext=new a("EditorTitleContext")}static{this.EditorTitleContextShare=new a("EditorTitleContextShare")}static{this.EmptyEditorGroup=new a("EmptyEditorGroup")}static{this.EmptyEditorGroupContext=new a("EmptyEditorGroupContext")}static{this.EditorTabsBarContext=new a("EditorTabsBarContext")}static{this.EditorTabsBarShowTabsSubmenu=new a("EditorTabsBarShowTabsSubmenu")}static{this.EditorTabsBarShowTabsZenModeSubmenu=new a("EditorTabsBarShowTabsZenModeSubmenu")}static{this.EditorActionsPositionSubmenu=new a("EditorActionsPositionSubmenu")}static{this.EditorSplitMoveSubmenu=new a("EditorSplitMoveSubmenu")}static{this.ExplorerContext=new a("ExplorerContext")}static{this.ExplorerContextShare=new a("ExplorerContextShare")}static{this.ExtensionContext=new a("ExtensionContext")}static{this.ExtensionEditorContextMenu=new a("ExtensionEditorContextMenu")}static{this.GlobalActivity=new a("GlobalActivity")}static{this.CommandCenter=new a("CommandCenter")}static{this.CommandCenterCenter=new a("CommandCenterCenter")}static{this.LayoutControlMenuSubmenu=new a("LayoutControlMenuSubmenu")}static{this.LayoutControlMenu=new a("LayoutControlMenu")}static{this.MenubarMainMenu=new a("MenubarMainMenu")}static{this.MenubarAppearanceMenu=new a("MenubarAppearanceMenu")}static{this.MenubarDebugMenu=new a("MenubarDebugMenu")}static{this.MenubarEditMenu=new a("MenubarEditMenu")}static{this.MenubarCopy=new a("MenubarCopy")}static{this.MenubarFileMenu=new a("MenubarFileMenu")}static{this.MenubarGoMenu=new a("MenubarGoMenu")}static{this.MenubarHelpMenu=new a("MenubarHelpMenu")}static{this.MenubarLayoutMenu=new a("MenubarLayoutMenu")}static{this.MenubarNewBreakpointMenu=new a("MenubarNewBreakpointMenu")}static{this.PanelAlignmentMenu=new a("PanelAlignmentMenu")}static{this.PanelPositionMenu=new a("PanelPositionMenu")}static{this.ActivityBarPositionMenu=new a("ActivityBarPositionMenu")}static{this.NotificationsCenterPositionMenu=new a("NotificationsCenterPositionMenu")}static{this.MenubarPreferencesMenu=new a("MenubarPreferencesMenu")}static{this.MenubarRecentMenu=new a("MenubarRecentMenu")}static{this.MenubarSelectionMenu=new a("MenubarSelectionMenu")}static{this.MenubarShare=new a("MenubarShare")}static{this.MenubarSwitchEditorMenu=new a("MenubarSwitchEditorMenu")}static{this.MenubarSwitchGroupMenu=new a("MenubarSwitchGroupMenu")}static{this.MenubarTerminalMenu=new a("MenubarTerminalMenu")}static{this.MenubarTerminalSuggestStatusMenu=new a("MenubarTerminalSuggestStatusMenu")}static{this.MenubarViewMenu=new a("MenubarViewMenu")}static{this.MenubarHomeMenu=new a("MenubarHomeMenu")}static{this.OpenEditorsContext=new a("OpenEditorsContext")}static{this.OpenEditorsContextShare=new a("OpenEditorsContextShare")}static{this.ProblemsPanelContext=new a("ProblemsPanelContext")}static{this.SCMInputBox=new a("SCMInputBox")}static{this.SCMChangeContext=new a("SCMChangeContext")}static{this.SCMResourceContext=new a("SCMResourceContext")}static{this.SCMResourceContextShare=new a("SCMResourceContextShare")}static{this.SCMResourceFolderContext=new a("SCMResourceFolderContext")}static{this.SCMResourceGroupContext=new a("SCMResourceGroupContext")}static{this.SCMSourceControl=new a("SCMSourceControl")}static{this.SCMSourceControlInline=new a("SCMSourceControlInline")}static{this.SCMSourceControlTitle=new a("SCMSourceControlTitle")}static{this.SCMHistoryTitle=new a("SCMHistoryTitle")}static{this.SCMHistoryItemContext=new a("SCMHistoryItemContext")}static{this.SCMHistoryItemChangeContext=new a("SCMHistoryItemChangeContext")}static{this.SCMHistoryItemRefContext=new a("SCMHistoryItemRefContext")}static{this.SCMArtifactGroupContext=new a("SCMArtifactGroupContext")}static{this.SCMArtifactContext=new a("SCMArtifactContext")}static{this.SCMQuickDiffDecorations=new a("SCMQuickDiffDecorations")}static{this.SCMTitle=new a("SCMTitle")}static{this.SearchContext=new a("SearchContext")}static{this.SearchActionMenu=new a("SearchActionContext")}static{this.StatusBarWindowIndicatorMenu=new a("StatusBarWindowIndicatorMenu")}static{this.StatusBarRemoteIndicatorMenu=new a("StatusBarRemoteIndicatorMenu")}static{this.StickyScrollContext=new a("StickyScrollContext")}static{this.TestItem=new a("TestItem")}static{this.TestItemGutter=new a("TestItemGutter")}static{this.TestProfilesContext=new a("TestProfilesContext")}static{this.TestMessageContext=new a("TestMessageContext")}static{this.TestMessageContent=new a("TestMessageContent")}static{this.TestPeekElement=new a("TestPeekElement")}static{this.TestPeekTitle=new a("TestPeekTitle")}static{this.TestCallStack=new a("TestCallStack")}static{this.TestCoverageFilterItem=new a("TestCoverageFilterItem")}static{this.TouchBarContext=new a("TouchBarContext")}static{this.TitleBar=new a("TitleBar")}static{this.TitleBarContext=new a("TitleBarContext")}static{this.TitleBarTitleContext=new a("TitleBarTitleContext")}static{this.TunnelContext=new a("TunnelContext")}static{this.TunnelPrivacy=new a("TunnelPrivacy")}static{this.TunnelProtocol=new a("TunnelProtocol")}static{this.TunnelPortInline=new a("TunnelInline")}static{this.TunnelTitle=new a("TunnelTitle")}static{this.TunnelLocalAddressInline=new a("TunnelLocalAddressInline")}static{this.TunnelOriginInline=new a("TunnelOriginInline")}static{this.ViewItemContext=new a("ViewItemContext")}static{this.ViewContainerTitle=new a("ViewContainerTitle")}static{this.ViewContainerTitleContext=new a("ViewContainerTitleContext")}static{this.ViewTitle=new a("ViewTitle")}static{this.ViewTitleContext=new a("ViewTitleContext")}static{this.CommentEditorActions=new a("CommentEditorActions")}static{this.CommentThreadTitle=new a("CommentThreadTitle")}static{this.CommentThreadActions=new a("CommentThreadActions")}static{this.CommentThreadAdditionalActions=new a("CommentThreadAdditionalActions")}static{this.CommentThreadTitleContext=new a("CommentThreadTitleContext")}static{this.CommentThreadCommentContext=new a("CommentThreadCommentContext")}static{this.CommentTitle=new a("CommentTitle")}static{this.CommentActions=new a("CommentActions")}static{this.CommentsViewThreadActions=new a("CommentsViewThreadActions")}static{this.InteractiveToolbar=new a("InteractiveToolbar")}static{this.InteractiveCellTitle=new a("InteractiveCellTitle")}static{this.InteractiveCellDelete=new a("InteractiveCellDelete")}static{this.InteractiveCellExecute=new a("InteractiveCellExecute")}static{this.InteractiveInputExecute=new a("InteractiveInputExecute")}static{this.InteractiveInputConfig=new a("InteractiveInputConfig")}static{this.ReplInputExecute=new a("ReplInputExecute")}static{this.IssueReporter=new a("IssueReporter")}static{this.NotebookToolbar=new a("NotebookToolbar")}static{this.NotebookToolbarContext=new a("NotebookToolbarContext")}static{this.NotebookStickyScrollContext=new a("NotebookStickyScrollContext")}static{this.NotebookCellTitle=new a("NotebookCellTitle")}static{this.NotebookCellDelete=new a("NotebookCellDelete")}static{this.NotebookCellInsert=new a("NotebookCellInsert")}static{this.NotebookCellBetween=new a("NotebookCellBetween")}static{this.NotebookCellListTop=new a("NotebookCellTop")}static{this.NotebookCellExecute=new a("NotebookCellExecute")}static{this.NotebookCellExecuteGoTo=new a("NotebookCellExecuteGoTo")}static{this.NotebookCellExecutePrimary=new a("NotebookCellExecutePrimary")}static{this.NotebookDiffCellInputTitle=new a("NotebookDiffCellInputTitle")}static{this.NotebookDiffDocumentMetadata=new a("NotebookDiffDocumentMetadata")}static{this.NotebookDiffCellMetadataTitle=new a("NotebookDiffCellMetadataTitle")}static{this.NotebookDiffCellOutputsTitle=new a("NotebookDiffCellOutputsTitle")}static{this.NotebookOutputToolbar=new a("NotebookOutputToolbar")}static{this.NotebookOutlineFilter=new a("NotebookOutlineFilter")}static{this.NotebookOutlineActionMenu=new a("NotebookOutlineActionMenu")}static{this.NotebookEditorLayoutConfigure=new a("NotebookEditorLayoutConfigure")}static{this.NotebookKernelSource=new a("NotebookKernelSource")}static{this.BulkEditTitle=new a("BulkEditTitle")}static{this.BulkEditContext=new a("BulkEditContext")}static{this.TimelineItemContext=new a("TimelineItemContext")}static{this.TimelineTitle=new a("TimelineTitle")}static{this.TimelineTitleContext=new a("TimelineTitleContext")}static{this.TimelineFilterSubMenu=new a("TimelineFilterSubMenu")}static{this.AccountsContext=new a("AccountsContext")}static{this.SidebarTitle=new a("SidebarTitle")}static{this.PanelTitle=new a("PanelTitle")}static{this.AuxiliaryBarTitle=new a("AuxiliaryBarTitle")}static{this.TerminalInstanceContext=new a("TerminalInstanceContext")}static{this.TerminalEditorInstanceContext=new a("TerminalEditorInstanceContext")}static{this.TerminalNewDropdownContext=new a("TerminalNewDropdownContext")}static{this.TerminalTabContext=new a("TerminalTabContext")}static{this.TerminalTabEmptyAreaContext=new a("TerminalTabEmptyAreaContext")}static{this.TerminalStickyScrollContext=new a("TerminalStickyScrollContext")}static{this.WebviewContext=new a("WebviewContext")}static{this.InlineCompletionsActions=new a("InlineCompletionsActions")}static{this.InlineEditsActions=new a("InlineEditsActions")}static{this.NewFile=new a("NewFile")}static{this.MergeInput1Toolbar=new a("MergeToolbar1Toolbar")}static{this.MergeInput2Toolbar=new a("MergeToolbar2Toolbar")}static{this.MergeBaseToolbar=new a("MergeBaseToolbar")}static{this.MergeInputResultToolbar=new a("MergeToolbarResultToolbar")}static{this.InlineSuggestionToolbar=new a("InlineSuggestionToolbar")}static{this.InlineEditToolbar=new a("InlineEditToolbar")}static{this.ChatContext=new a("ChatContext")}static{this.ChatCodeBlock=new a("ChatCodeblock")}static{this.ChatCompareBlock=new a("ChatCompareBlock")}static{this.ChatMessageTitle=new a("ChatMessageTitle")}static{this.ChatWelcomeContext=new a("ChatWelcomeContext")}static{this.ChatMessageFooter=new a("ChatMessageFooter")}static{this.ChatExecute=new a("ChatExecute")}static{this.ChatExecuteQueue=new a("ChatExecuteQueue")}static{this.ChatInput=new a("ChatInput")}static{this.ChatInputSecondary=new a("ChatInputSecondary")}static{this.ChatInputSide=new a("ChatInputSide")}static{this.ChatModePicker=new a("ChatModePicker")}static{this.ChatEditingWidgetToolbar=new a("ChatEditingWidgetToolbar")}static{this.ChatEditingSessionChangesToolbar=new a("ChatEditingSessionChangesToolbar")}static{this.ChatEditingSessionApplySubmenu=new a("ChatEditingSessionApplySubmenu")}static{this.ChatEditingEditorContent=new a("ChatEditingEditorContent")}static{this.ChatEditingEditorHunk=new a("ChatEditingEditorHunk")}static{this.ChatEditingDeletedNotebookCell=new a("ChatEditingDeletedNotebookCell")}static{this.ChatInputAttachmentToolbar=new a("ChatInputAttachmentToolbar")}static{this.ChatEditingWidgetModifiedFilesToolbar=new a("ChatEditingWidgetModifiedFilesToolbar")}static{this.ChatInputResourceAttachmentContext=new a("ChatInputResourceAttachmentContext")}static{this.ChatInputSymbolAttachmentContext=new a("ChatInputSymbolAttachmentContext")}static{this.ChatInlineResourceAnchorContext=new a("ChatInlineResourceAnchorContext")}static{this.ChatInlineSymbolAnchorContext=new a("ChatInlineSymbolAnchorContext")}static{this.ChatMessageCheckpoint=new a("ChatMessageCheckpoint")}static{this.ChatMessageRestoreCheckpoint=new a("ChatMessageRestoreCheckpoint")}static{this.ChatNewMenu=new a("ChatNewMenu")}static{this.ChatEditingCodeBlockContext=new a("ChatEditingCodeBlockContext")}static{this.ChatTitleBarMenu=new a("ChatTitleBarMenu")}static{this.ChatAttachmentsContext=new a("ChatAttachmentsContext")}static{this.ChatTipContext=new a("ChatTipContext")}static{this.ChatTipToolbar=new a("ChatTipToolbar")}static{this.ChatToolOutputResourceToolbar=new a("ChatToolOutputResourceToolbar")}static{this.ChatTextEditorMenu=new a("ChatTextEditorMenu")}static{this.ChatToolOutputResourceContext=new a("ChatToolOutputResourceContext")}static{this.ChatMultiDiffContext=new a("ChatMultiDiffContext")}static{this.ChatConfirmationMenu=new a("ChatConfirmationMenu")}static{this.ChatEditorInlineMenu=new a("ChatEditorInlineGutter")}static{this.ChatEditorInlineExecute=new a("ChatEditorInputExecute")}static{this.ChatEditorInlineInputSide=new a("ChatEditorInputSide")}static{this.InlineChatEditorAffordance=new a("InlineChatEditorAffordance")}static{this.InlineChatInput=new a("InlineChatInput")}static{this.AccessibleView=new a("AccessibleView")}static{this.MultiDiffEditorContent=new a("MultiDiffEditorContent")}static{this.MultiDiffEditorFileToolbar=new a("MultiDiffEditorFileToolbar")}static{this.DiffEditorHunkToolbar=new a("DiffEditorHunkToolbar")}static{this.DiffEditorSelectionToolbar=new a("DiffEditorSelectionToolbar")}static{this.BrowserNavigationToolbar=new a("BrowserNavigationToolbar")}static{this.BrowserActionsToolbar=new a("BrowserActionsToolbar")}static{this.AgentSessionsViewerFilterSubMenu=new a("AgentSessionsViewerFilterSubMenu")}static{this.AgentSessionsContext=new a("AgentSessionsContext")}static{this.AgentSessionSectionContext=new a("AgentSessionSectionContext")}static{this.AgentSessionsCreateSubMenu=new a("AgentSessionsCreateSubMenu")}static{this.AgentSessionsToolbar=new a("AgentSessionsToolbar")}static{this.AgentSessionItemToolbar=new a("AgentSessionItemToolbar")}static{this.AgentSessionSectionToolbar=new a("AgentSessionSectionToolbar")}static{this.AgentsTitleBarControlMenu=new a("AgentsTitleBarControlMenu")}static{this.ChatViewSessionTitleNavigationToolbar=new a("ChatViewSessionTitleNavigationToolbar")}static{this.ChatViewSessionTitleToolbar=new a("ChatViewSessionTitleToolbar")}static{this.ChatContextUsageActions=new a("ChatContextUsageActions")}static for(i){return a._instances.get(i)??new a(i)}constructor(i){if(a._instances.has(i))throw new TypeError(`MenuId with identifier '${i}' already exists. Use MenuId.for(ident) or a unique identifier`);a._instances.set(i,this),this.id=i}},qt=ae("menuService"),Ure=class a{constructor(i){this.id=i;this.has=e=>e===i}static{this._all=new Map}static for(i){let e=this._all.get(i);return e||(e=new a(i),this._all.set(i,e)),e}static merge(i){let e=new Set;for(let t of i)t instanceof a&&e.add(t.id);return e}},fe=new class{constructor(){this._commands=new Map;this._menuItems=new Map;this._onDidChangeMenu=new d6({merge:Ure.merge});this.onDidChangeMenu=this._onDidChangeMenu.event}addCommand(a){return this._commands.set(a.id,a),this._onDidChangeMenu.fire(Ure.for(D.CommandPalette)),Mp(Z(()=>{this._commands.delete(a.id)&&this._onDidChangeMenu.fire(Ure.for(D.CommandPalette))}))}getCommand(a){return this._commands.get(a)}getCommands(){let a=new Map;return this._commands.forEach((i,e)=>a.set(e,i)),a}appendMenuItem(a,i){let e=this._menuItems.get(a);e||(e=new Vs,this._menuItems.set(a,e));let t=e.push(i);return this._onDidChangeMenu.fire(Ure.for(a)),Mp(Z(()=>{t(),this._onDidChangeMenu.fire(Ure.for(a))}))}appendMenuItems(a){let i=new P;for(let{id:e,item:t}of a)i.add(this.appendMenuItem(e,t));return i}getMenuItems(a){let i;return this._menuItems.has(a)?i=[...this._menuItems.get(a)]:i=[],a===D.CommandPalette&&this._appendImplicitItems(i),i}_appendImplicitItems(a){let i=new Set;for(let e of a)Kk(e)&&(i.add(e.command.id),e.alt&&i.add(e.alt.id));this._commands.forEach((e,t)=>{i.has(t)||a.push({command:e})})}},Cc=class extends $l{constructor(e,t,o){super(`submenuitem.${e.submenu.id}`,typeof e.title=="string"?e.title:e.title.value,o,"submenu");this.item=e;this.hideActions=t}},Eo=class{constructor(i,e,t,o,n,r,s){this.hideActions=o;this.menuKeybinding=n;this._commandService=s;this.id=i.id,this.label=Eo.label(i,t),this.tooltip=(typeof i.tooltip=="string"?i.tooltip:i.tooltip?.value)??"",this.enabled=!i.precondition||r.contextMatchesRules(i.precondition),this.checked=void 0;let l;if(i.toggled){let c=i.toggled.condition?i.toggled:{condition:i.toggled};this.checked=r.contextMatchesRules(c.condition),this.checked&&c.tooltip&&(this.tooltip=typeof c.tooltip=="string"?c.tooltip:c.tooltip.value),this.checked&&q.isThemeIcon(c.icon)&&(l=c.icon),this.checked&&c.title&&(this.label=typeof c.title=="string"?c.title:c.title.value)}l||(l=q.isThemeIcon(i.icon)?i.icon:void 0),this.item=i,this.alt=e?new Eo(e,void 0,t,o,void 0,r,s):void 0,this._options=t,this.class=l&&q.asClassName(l)}static label(i,e){return e?.renderShortTitle&&i.shortTitle?typeof i.shortTitle=="string"?i.shortTitle:i.shortTitle.value:typeof i.title=="string"?i.title:i.title.value}run(...i){let e=[];return this._options?.args?e=[...e,...this._options.args]:this._options?.arg&&(e=[...e,this._options.arg]),this._options?.shouldForwardArgs&&(e=[...e,...i]),this._commandService.executeCommand(this.id,...e)}};Eo=I([m(5,X),m(6,ge)],Eo);var K=class{constructor(i){this.desc=i}};function W(a){let i=[],e=new a,{f1:t,menu:o,keybinding:n,...r}=e.desc;if(qe.getCommand(r.id))throw new Error(`Cannot register two commands with the same id: ${r.id}`);if(i.push(qe.registerCommand({id:r.id,handler:(s,...l)=>e.run(s,...l),metadata:r.metadata??{description:e.desc.title}})),Array.isArray(o))for(let s of o)i.push(fe.appendMenuItem(s.id,{command:{...r,precondition:s.precondition===null?void 0:r.precondition},...s}));else o&&i.push(fe.appendMenuItem(o.id,{command:{...r,precondition:o.precondition===null?void 0:r.precondition},...o}));if(t&&(i.push(fe.appendMenuItem(D.CommandPalette,{command:r,when:r.precondition})),i.push(fe.addCommand(r))),Array.isArray(n))for(let s of n)i.push(yt.registerKeybindingRule({...s,id:r.id,when:r.precondition?x.and(r.precondition,s.when):s.when}));else n&&i.push(yt.registerKeybindingRule({...n,id:r.id,when:r.precondition?x.and(r.precondition,n.when):n.when}));return{dispose(){Ue(i)}}}var Te=ae("telemetryService");function eKi(a,i){return a.telemetryLevel>=i}var mmt=ae("customEndpointTelemetryService");var tKi="telemetry.firstSessionDate",iKi="telemetry.lastSessionDate";var oKi="telemetry",bN="telemetry.telemetryLevel",hmt="telemetry.enableCrashReporter",zre="telemetry.enableTelemetry";function v7t(a,i){return i&&(a.stack||a.stacktrace)?d(116,null,rKi(a),nKi(a.stack)||nKi(a.stacktrace)):rKi(a)}function nKi(a){return Array.isArray(a)?a.join(`
`):a}function rKi(a){return a.code==="ERR_UNC_HOST_NOT_ALLOWED"?`${a.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`:typeof a.code=="string"&&typeof a.errno=="number"&&typeof a.syscall=="string"?d(115,null,a.message):a.message||d(113,null)}function In(a=null,i=!1){if(!a)return d(113,null);if(Array.isArray(a)){let e=si(a),t=In(e[0],i);return e.length>1?d(114,null,t,e.length):t}if(Ae(a))return a;if(a.detail){let e=a.detail;if(e.error)return v7t(e.error,i);if(e.exception)return v7t(e.exception,i)}return a.stack?v7t(a,i):a.message?a.message:d(113,null)}function A6(a){let i=a;return i instanceof Error&&Array.isArray(i.actions)}function dU(a,i){let e;return typeof a=="string"?e=new Error(a):e=a,e.actions=i,e}var ne=ae("logService"),ol=ae("loggerService");function N6(a){return Xo(a)}var UGe=3;function eSe(a,i){return a!==0&&a<=i}function Kre(a,i,e){switch(i){case 1:a.trace(e);break;case 2:a.debug(e);break;case 3:a.info(e);break;case 4:a.warn(e);break;case 5:a.error(e);break;case 0:break;default:throw new Error(`Invalid log level ${i}`)}}function Jbe(a,i=!1){let e="";for(let t=0;t<a.length;t++){let o=a[t];if(o instanceof Error&&(o=In(o,i)),typeof o=="object")try{o=JSON.stringify(o)}catch{}e+=(t>0?" ":"")+o}return e}var uU=class extends C{constructor(){super(...arguments);this.level=UGe;this._onDidChangeLogLevel=this._register(new E)}get onDidChangeLogLevel(){return this._onDidChangeLogLevel.event}setLevel(e){this.level!==e&&(this.level=e,this._onDidChangeLogLevel.fire(this.level))}getLevel(){return this.level}checkLogLevel(e){return eSe(this.level,e)}canLog(e){return this._store.isDisposed?!1:this.checkLogLevel(e)}},Zbe=class extends uU{constructor(e){super();this.logAlways=e}checkLogLevel(e){return this.logAlways||super.checkLogLevel(e)}trace(e,...t){this.canLog(1)&&this.log(1,Jbe([e,...t],!0))}debug(e,...t){this.canLog(2)&&this.log(2,Jbe([e,...t]))}info(e,...t){this.canLog(3)&&this.log(3,Jbe([e,...t]))}warn(e,...t){this.canLog(4)&&this.log(4,Jbe([e,...t]))}error(e,...t){if(this.canLog(5))if(e instanceof Error){let o=Array.prototype.slice.call(arguments);o[0]=e.stack,this.log(5,Jbe(o))}else this.log(5,Jbe([e,...t]))}flush(){}};var gmt=class extends uU{constructor(e=UGe,t=!0){super();this.useColors=t;this.setLevel(e)}trace(e,...t){this.canLog(1)&&(this.useColors?console.log("%cTRACE","color: #888",e,...t):console.log(e,...t))}debug(e,...t){this.canLog(2)&&(this.useColors?console.log("%cDEBUG","background: #eee; color: #888",e,...t):console.log(e,...t))}info(e,...t){this.canLog(3)&&(this.useColors?console.log("%c INFO","color: #33f",e,...t):console.log(e,...t))}warn(e,...t){this.canLog(4)&&(this.useColors?console.warn("%c WARN","color: #993",e,...t):console.log(e,...t))}error(e,...t){this.canLog(5)&&(this.useColors?console.error("%c ERR","color: #f33",e,...t):console.error(e,...t))}flush(){}},HGe=class extends uU{constructor(e,t=UGe){super();this.adapter=e;this.setLevel(t)}trace(e,...t){this.canLog(1)&&this.adapter.log(1,[this.extractMessage(e),...t])}debug(e,...t){this.canLog(2)&&this.adapter.log(2,[this.extractMessage(e),...t])}info(e,...t){this.canLog(3)&&this.adapter.log(3,[this.extractMessage(e),...t])}warn(e,...t){this.canLog(4)&&this.adapter.log(4,[this.extractMessage(e),...t])}error(e,...t){this.canLog(5)&&this.adapter.log(5,[this.extractMessage(e),...t])}extractMessage(e){return typeof e=="string"?e:In(e,this.canLog(1))}flush(){}},fmt=class extends uU{constructor(e){super();this.loggers=e;e.length&&this.setLevel(e[0].getLevel())}setLevel(e){for(let t of this.loggers)t.setLevel(e);super.setLevel(e)}trace(e,...t){for(let o of this.loggers)o.trace(e,...t)}debug(e,...t){for(let o of this.loggers)o.debug(e,...t)}info(e,...t){for(let o of this.loggers)o.info(e,...t)}warn(e,...t){for(let o of this.loggers)o.warn(e,...t)}error(e,...t){for(let o of this.loggers)o.error(e,...t)}flush(){for(let e of this.loggers)e.flush()}dispose(){for(let e of this.loggers)e.dispose();super.dispose()}},vmt=class extends C{constructor(e,t,o){super();this.logLevel=e;this.logsHome=t;this._loggers=new vt;this._onDidChangeLoggers=this._register(new E);this.onDidChangeLoggers=this._onDidChangeLoggers.event;this._onDidChangeLogLevel=this._register(new E);this.onDidChangeLogLevel=this._onDidChangeLogLevel.event;this._onDidChangeVisibility=this._register(new E);this.onDidChangeVisibility=this._onDidChangeVisibility.event;if(o)for(let n of o)this._loggers.set(n.resource,{logger:void 0,info:n})}getLoggerEntry(e){return Ae(e)?[...this._loggers.values()].find(t=>t.info.id===e):this._loggers.get(e)}getLogger(e){return this.getLoggerEntry(e)?.logger}createLogger(e,t){let o=this.toResource(e),n=Ae(e)?e:t?.id??Ir(o.toString()).toString(16),r=this._loggers.get(o)?.logger,s=t?.logLevel==="always"?1:t?.logLevel;r||(r=this.doCreateLogger(o,s??this.getLogLevel(o)??this.logLevel,{...t,id:n}));let l={logger:r,info:{resource:o,id:n,logLevel:s,name:t?.name,hidden:t?.hidden,group:t?.group,extensionId:t?.extensionId,when:t?.when}};return this.registerLogger(l.info),this._loggers.set(o,l),r}toResource(e){return Ae(e)?je(this.logsHome,`${e.replace(/[\\/:\*\?"<>\|]/g,"")}.log`):e}setLogLevel(e,t){if(A.isUri(e)){let o=e,n=t,r=this._loggers.get(o);r&&n!==r.info.logLevel&&(r.info.logLevel=n===this.logLevel?void 0:n,r.logger?.setLevel(n),this._loggers.set(r.info.resource,r),this._onDidChangeLogLevel.fire([o,n]))}else{this.logLevel=e;for(let[o,n]of this._loggers.entries())this._loggers.get(o)?.info.logLevel===void 0&&n.logger?.setLevel(this.logLevel);this._onDidChangeLogLevel.fire(this.logLevel)}}setVisibility(e,t){let o=this.getLoggerEntry(e);o&&t!==!o.info.hidden&&(o.info.hidden=!t,this._loggers.set(o.info.resource,o),this._onDidChangeVisibility.fire([o.info.resource,t]))}getLogLevel(e){let t;return e&&(t=this._loggers.get(e)?.info.logLevel),t??this.logLevel}registerLogger(e){let t=this._loggers.get(e.resource);t?t.info.hidden!==e.hidden&&this.setVisibility(e.resource,!e.hidden):(this._loggers.set(e.resource,{info:e,logger:void 0}),this._onDidChangeLoggers.fire({added:[e],removed:[]}))}deregisterLogger(e){let t=this.toResource(e),o=this._loggers.get(t);o&&(o.logger&&o.logger.dispose(),this._loggers.delete(t),this._onDidChangeLoggers.fire({added:[],removed:[o.info]}))}*getRegisteredLoggers(){for(let e of this._loggers.values())yield e.info}getRegisteredLogger(e){return this._loggers.get(e)?.info}dispose(){this._loggers.forEach(e=>e.logger?.dispose()),this._loggers.clear(),super.dispose()}},b7t=class{constructor(){this.onDidChangeLogLevel=new E().event}setLevel(i){}getLevel(){return 3}trace(i,...e){}debug(i,...e){}info(i,...e){}warn(i,...e){}error(i,...e){}critical(i,...e){}dispose(){}flush(){}},bmt=class extends b7t{};function S7t(a){if(a.verbose)return 1;if(typeof a.logLevel=="string"){let i=Gre(a.logLevel.toLowerCase());if(i!==void 0)return i}return UGe}function $w(a){switch(a){case 1:return"trace";case 2:return"debug";case 3:return"info";case 4:return"warn";case 5:return"error";case 0:return"off"}}function zGe(a){switch(a){case 1:return{original:"Trace",value:d(2144,null)};case 2:return{original:"Debug",value:d(2140,null)};case 3:return{original:"Info",value:d(2142,null)};case 4:return{original:"Warning",value:d(2145,null)};case 5:return{original:"Error",value:d(2141,null)};case 0:return{original:"Off",value:d(2143,null)}}}function Gre(a){switch(a){case"trace":return 1;case"debug":return 2;case"info":return 3;case"warn":return 4;case"error":return 5;case"critical":return 5;case"off":return 0}}var sKi=new Q("logLevel",$w(3));var tSe=class a{static{this.REGISTERED_COMMANDS=new Set}static getRegisteredCommands(){return[...a.REGISTERED_COMMANDS]}static registerCommand(i){a.REGISTERED_COMMANDS.add(i)}};var $re=class{constructor(i){this.id=i.id,this.precondition=i.precondition,this._kbOpts=i.kbOpts,this._menuOpts=i.menuOpts,this.metadata=i.metadata,this.canTriggerInlineEdits=i.canTriggerInlineEdits}register(){if(Array.isArray(this._menuOpts)?this._menuOpts.forEach(this._registerMenuItem,this):this._menuOpts&&this._registerMenuItem(this._menuOpts),this._kbOpts){let i=Array.isArray(this._kbOpts)?this._kbOpts:[this._kbOpts];for(let e of i){let t=e.kbExpr;this.precondition&&(t?t=x.and(t,this.precondition):t=this.precondition);let o={id:this.id,weight:e.weight,args:e.args,when:t,primary:e.primary,secondary:e.secondary,win:e.win,linux:e.linux,mac:e.mac};yt.registerKeybindingRule(o)}}qe.registerCommand({id:this.id,handler:(i,e)=>this.runCommand(i,e),metadata:this.metadata}),this.canTriggerInlineEdits&&tSe.registerCommand(this.id)}_registerMenuItem(i){fe.appendMenuItem(i.menuId,{group:i.group,command:{id:this.id,title:i.title,icon:i.icon,precondition:this.precondition},when:i.when,order:i.order})}},SN=class extends $re{constructor(){super(...arguments);this._implementations=[]}addImplementation(e,t,o,n){return this._implementations.push({priority:e,name:t,implementation:o,when:n}),this._implementations.sort((r,s)=>s.priority-r.priority),{dispose:()=>{for(let r=0;r<this._implementations.length;r++)if(this._implementations[r].implementation===o){this._implementations.splice(r,1);return}}}}runCommand(e,t){let o=e.get(ne),n=e.get(X);o.trace(`Executing Command '${this.id}' which has ${this._implementations.length} bound.`);for(let r of this._implementations){if(r.when){let l=n.getContext(Pn());if(!r.when.evaluate(l))continue}let s=r.implementation(e,t);if(s)return o.trace(`Command '${this.id}' was handled by '${r.name}'.`),typeof s=="boolean"?void 0:s}o.trace(`The Command '${this.id}' was not handled by any implementation.`)}},Smt=class extends $re{constructor(e,t){super(t);this.command=e}runCommand(e,t){return this.command.runCommand(e,t)}},xc=class a extends $re{static bindToContribution(i){return class extends a{constructor(t){super(t),this._callback=t.handler}runEditorCommand(t,o,n){let r=i(o);r&&this._callback(r,n)}}}static runEditorCommand(i,e,t,o){let n=i.get(Kt),r=n.getFocusedCodeEditor()||n.getActiveCodeEditor();if(r)return r.invokeWithinContext(s=>{if(s.get(X).contextMatchesRules(t??void 0))return o(s,r,e)})}runCommand(i,e){return a.runEditorCommand(i,e,this.precondition,(t,o,n)=>this.runEditorCommand(t,o,n))}},xi=class a extends xc{static convertOptions(i){let e;Array.isArray(i.menuOpts)?e=i.menuOpts:i.menuOpts?e=[i.menuOpts]:e=[];function t(o){return o.menuId||(o.menuId=D.EditorContext),o.title||(o.title=typeof i.label=="string"?i.label:i.label.value),o.when=x.and(i.precondition,o.when),o}return Array.isArray(i.contextMenuOpts)?e.push(...i.contextMenuOpts.map(t)):i.contextMenuOpts&&e.push(t(i.contextMenuOpts)),i.menuOpts=e,i}constructor(i){super(a.convertOptions(i)),typeof i.label=="string"?(this.label=i.label,this.alias=i.alias??i.label):(this.label=i.label.value,this.alias=i.alias??i.label.original)}runEditorCommand(i,e,t){return this.reportTelemetry(i,e),this.run(i,e,t||{})}reportTelemetry(i,e){i.get(Te).publicLog2("editorActionInvoked",{name:this.label,id:this.id})}},qre=class extends xi{constructor(){super(...arguments);this._implementations=[]}addImplementation(e,t){return this._implementations.push([e,t]),this._implementations.sort((o,n)=>n[0]-o[0]),{dispose:()=>{for(let o=0;o<this._implementations.length;o++)if(this._implementations[o][1]===t){this._implementations.splice(o,1);return}}}}run(e,t,o){for(let n of this._implementations){let r=n[1](e,t,o);if(r)return typeof r=="boolean"?void 0:r}}},wl=class extends K{run(i,...e){let t=i.get(Kt),o=t.getFocusedCodeEditor()||t.getActiveCodeEditor();if(o)return o.invokeWithinContext(n=>{let r=n.get(X),s=n.get(ne);if(!r.contextMatchesRules(this.desc.precondition??void 0)){s.debug("[EditorAction2] NOT running command because its precondition is FALSE",this.desc.id,this.desc.precondition?.serialize());return}return this.runEditorCommand(n,o,...e)})}};function kS(a,i){qe.registerCommand(a,function(e,...t){let o=e.get(F),[n,r]=t;So(A.isUri(n)),So(Ie.isIPosition(r));let s=e.get(Ct).getModel(n);if(s){let l=Ie.lift(r);return o.invokeFunction(i,s,l,...t.slice(2))}return e.get(Nt).createModelReference(n).then(l=>new Promise((c,u)=>{try{let p=o.invokeFunction(i,l.object.textEditorModel,Ie.lift(r),t.slice(2));c(p)}catch(p){u(p)}}).finally(()=>{l.dispose()}))})}function qi(a){return iL.INSTANCE.registerEditorCommand(a),a}function Jt(a){let i=new a;return iL.INSTANCE.registerEditorAction(i),i}function KGe(a){return iL.INSTANCE.registerEditorAction(a),a}function aKi(a){iL.INSTANCE.registerEditorAction(a)}function go(a,i,e){iL.INSTANCE.registerEditorContribution(a,i,e)}function Imt(a,i){iL.INSTANCE.registerDiffEditorContribution(a,i)}var aa;(n=>{function a(r){return iL.INSTANCE.getEditorCommand(r)}n.getEditorCommand=a;function i(){return iL.INSTANCE.getEditorActions()}n.getEditorActions=i;function e(){return iL.INSTANCE.getEditorContributions()}n.getEditorContributions=e;function t(r){return iL.INSTANCE.getEditorContributions().filter(s=>r.indexOf(s.id)>=0)}n.getSomeEditorContributions=t;function o(){return iL.INSTANCE.getDiffEditorContributions()}n.getDiffEditorContributions=o})(aa||={});var $Ro={EditorCommonContributions:"editor.contributions"},iL=class a{constructor(){this.editorContributions=[];this.diffEditorContributions=[];this.editorActions=[];this.editorCommands=Object.create(null)}static{this.INSTANCE=new a}registerEditorContribution(i,e,t){this.editorContributions.push({id:i,ctor:e,instantiation:t})}getEditorContributions(){return this.editorContributions.slice(0)}registerDiffEditorContribution(i,e){this.diffEditorContributions.push({id:i,ctor:e})}getDiffEditorContributions(){return this.diffEditorContributions.slice(0)}registerEditorAction(i){i.register(),this.editorActions.push(i)}getEditorActions(){return this.editorActions}registerEditorCommand(i){i.register(),this.editorCommands[i.id]=i}getEditorCommand(i){return this.editorCommands[i]||null}};oe.add($Ro.EditorCommonContributions,iL.INSTANCE);function GGe(a){return a.register(),a}var BT=GGe(new SN({id:"undo",precondition:void 0,kbOpts:{weight:0,primary:2104},menuOpts:[{menuId:D.MenubarEditMenu,group:"1_do",title:d(185,null),order:1},{menuId:D.CommandPalette,group:"",title:d(188,null),order:1},{menuId:D.SimpleEditorContext,group:"1_do",title:d(188,null),order:1}]}));GGe(new Smt(BT,{id:"default:undo",precondition:void 0}));var HT=GGe(new SN({id:"redo",precondition:void 0,kbOpts:{weight:0,primary:2103,secondary:[3128],mac:{primary:3128}},menuOpts:[{menuId:D.MenubarEditMenu,group:"1_do",title:d(183,null),order:2},{menuId:D.CommandPalette,group:"",title:d(186,null),order:1},{menuId:D.SimpleEditorContext,group:"1_do",title:d(186,null),order:2}]}));GGe(new Smt(HT,{id:"default:redo",precondition:void 0}));var ymt=GGe(new SN({id:"editor.action.selectAll",precondition:void 0,kbOpts:{weight:0,kbExpr:null,primary:2079},menuOpts:[{menuId:D.MenubarSelectionMenu,group:"1_basic",title:d(184,null),order:1},{menuId:D.CommandPalette,group:"",title:d(187,null),order:1},{menuId:D.SimpleEditorContext,group:"9_select",title:d(187,null),order:1}]}));function Xi(a){if(!a||typeof a!="object"||a instanceof RegExp)return a;let i=Array.isArray(a)?[]:{};return Object.entries(a).forEach(([e,t])=>{i[e]=t&&typeof t=="object"?Xi(t):t}),i}function lKi(a){if(!a||typeof a!="object")return a;let i=[a];for(;i.length>0;){let e=i.shift();Object.freeze(e);for(let t in e)if(cKi.call(e,t)){let o=e[t];typeof o=="object"&&!Object.isFrozen(o)&&!yUi(o)&&i.push(o)}}return a}var cKi=Object.prototype.hasOwnProperty;function Gk(a,i){return I7t(a,i,new Set)}function I7t(a,i,e){if(Jn(a))return a;let t=i(a);if(typeof t<"u")return t;if(Array.isArray(a)){let o=[];for(let n of a)o.push(I7t(n,i,e));return o}if(yi(a)){if(e.has(a))throw new Error("Cannot clone recursive data-structure");e.add(a);let o={};for(let n in a)cKi.call(a,n)&&(o[n]=I7t(a[n],i,e));return e.delete(a),o}return a}function Nu(a,i,e=!0){return yi(a)?(yi(i)&&Object.keys(i).forEach(t=>{t in a?e&&(yi(a[t])&&yi(i[t])?Nu(a[t],i[t],e):a[t]=i[t]):a[t]=i[t]}),a):i}function uo(a,i){if(a===i)return!0;if(a==null||i===null||i===void 0||typeof a!=typeof i||typeof a!="object"||Array.isArray(a)!==Array.isArray(i))return!1;let e,t;if(Array.isArray(a)){if(a.length!==i.length)return!1;for(e=0;e<a.length;e++)if(!uo(a[e],i[e]))return!1}else{let o=[];for(t in a)o.push(t);o.sort();let n=[];for(t in i)n.push(t);if(n.sort(),!uo(o,n))return!1;for(e=0;e<o.length;e++)if(!uo(a[o[e]],i[o[e]]))return!1}return!0}function pU(a){let i=new Set;return JSON.stringify(a,(e,t)=>{if(yi(t)||Array.isArray(t)){if(i.has(t))return"[Circular]";i.add(t)}return typeof t=="bigint"?`[BigInt ${t.toString()}]`:t})}function $Ge(a,i){let e=Object.create(null);return!a||!i||Object.keys(i).forEach(o=>{let n=a[o],r=i[o];uo(n,r)||(e[o]=r)}),e}function DM(a,i){let e=Object.create(null);for(let[t,o]of Object.entries(a))i(t,o)&&(e[t]=o);return e}function iSe(a,i){let e={};for(let[t,o]of Object.entries(a))e[t]=i(o,t);return e}var w7t=class a{constructor(i,e,t,o,n,r,s){this._forceIntegerValues=i;this._scrollStateBrand=void 0;this._forceIntegerValues&&(e=e|0,t=t|0,o=o|0,n=n|0,r=r|0,s=s|0),this.rawScrollLeft=o,this.rawScrollTop=s,e<0&&(e=0),o+e>t&&(o=t-e),o<0&&(o=0),n<0&&(n=0),s+n>r&&(s=r-n),s<0&&(s=0),this.width=e,this.scrollWidth=t,this.scrollLeft=o,this.height=n,this.scrollHeight=r,this.scrollTop=s}equals(i){return this.rawScrollLeft===i.rawScrollLeft&&this.rawScrollTop===i.rawScrollTop&&this.width===i.width&&this.scrollWidth===i.scrollWidth&&this.scrollLeft===i.scrollLeft&&this.height===i.height&&this.scrollHeight===i.scrollHeight&&this.scrollTop===i.scrollTop}withScrollDimensions(i,e){return new a(this._forceIntegerValues,typeof i.width<"u"?i.width:this.width,typeof i.scrollWidth<"u"?i.scrollWidth:this.scrollWidth,e?this.rawScrollLeft:this.scrollLeft,typeof i.height<"u"?i.height:this.height,typeof i.scrollHeight<"u"?i.scrollHeight:this.scrollHeight,e?this.rawScrollTop:this.scrollTop)}withScrollPosition(i){return new a(this._forceIntegerValues,this.width,this.scrollWidth,typeof i.scrollLeft<"u"?i.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof i.scrollTop<"u"?i.scrollTop:this.rawScrollTop)}createScrollEvent(i,e){let t=this.width!==i.width,o=this.scrollWidth!==i.scrollWidth,n=this.scrollLeft!==i.scrollLeft,r=this.height!==i.height,s=this.scrollHeight!==i.scrollHeight,l=this.scrollTop!==i.scrollTop;return{inSmoothScrolling:e,oldWidth:i.width,oldScrollWidth:i.scrollWidth,oldScrollLeft:i.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:i.height,oldScrollHeight:i.scrollHeight,oldScrollTop:i.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:t,scrollWidthChanged:o,scrollLeftChanged:n,heightChanged:r,scrollHeightChanged:s,scrollTopChanged:l}}},UT=class extends C{constructor(e){super();this._scrollableBrand=void 0;this._onScroll=this._register(new E);this.onScroll=this._onScroll.event;this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new w7t(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let o=this._state.withScrollDimensions(e,t);this._setState(o,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let o=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===o.scrollLeft&&this._smoothScrolling.to.scrollTop===o.scrollTop)return;let n;t?n=new Cmt(this._smoothScrolling.from,o,this._smoothScrolling.startTime,this._smoothScrolling.duration):n=this._smoothScrolling.combine(this._state,o,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=n}else{let o=this._state.withScrollPosition(e);this._smoothScrolling=Cmt.start(this._state,o,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let o=this._state;o.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(o,t)))}},wmt=class{constructor(i,e,t){this.scrollLeft=i,this.scrollTop=e,this.isDone=t}};function y7t(a,i){let e=i-a;return function(t){return a+e*QRo(t)}}function qRo(a,i,e){return function(t){return t<e?a(t/e):i((t-e)/(1-e))}}var Cmt=class a{constructor(i,e,t,o){this.from=i,this.to=e,this.duration=o,this.startTime=t,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(i,e,t){if(Math.abs(i-e)>2.5*t){let n,r;return i<e?(n=i+.75*t,r=e-.75*t):(n=i-.75*t,r=e+.75*t),qRo(y7t(i,n),y7t(r,e),.33)}return y7t(i,e)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(i){this.to=i.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(i){let e=(i-this.startTime)/this.duration;if(e<1){let t=this.scrollLeft(e),o=this.scrollTop(e);return new wmt(t,o,!1)}return new wmt(this.to.scrollLeft,this.to.scrollTop,!0)}combine(i,e,t){return a.start(i,e,t)}static start(i,e,t){t=t+10;let o=Date.now()-10;return new a(i,e,o,t)}};function jRo(a){return Math.pow(a,3)}function QRo(a){return 1-jRo(1-a)}var $k=new class{constructor(){this._zoomLevel=0;this._onDidChangeZoomLevel=new E;this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event}getZoomLevel(){return this._zoomLevel}setZoomLevel(a){a=Math.min(Math.max(-5,a),20),this._zoomLevel!==a&&(this._zoomLevel=a,this._onDidChangeZoomLevel.fire(this._zoomLevel))}};var x7t=it?1.5:1.35,C7t=8,oSe=class a{constructor(i){this._bareFontInfoBrand=void 0;this.pixelRatio=i.pixelRatio,this.fontFamily=String(i.fontFamily),this.fontWeight=String(i.fontWeight),this.fontSize=i.fontSize,this.fontFeatureSettings=i.fontFeatureSettings,this.fontVariationSettings=i.fontVariationSettings,this.lineHeight=i.lineHeight|0,this.letterSpacing=i.letterSpacing}static _create(i,e,t,o,n,r,s,l,c){r===0?r=x7t*t:r<C7t&&(r=r*t),r=Math.round(r),r<C7t&&(r=C7t);let u=1+(c?0:$k.getZoomLevel()*.1);return t*=u,r*=u,n===T7t&&(e==="normal"||e==="bold"?n=E7t:(n=`'wght' ${parseInt(e,10)}`,e="normal")),new a({pixelRatio:l,fontFamily:i,fontWeight:e,fontSize:t,fontFeatureSettings:o,fontVariationSettings:n,lineHeight:r,letterSpacing:s})}getId(){return`${this.pixelRatio}-${this.fontFamily}-${this.fontWeight}-${this.fontSize}-${this.fontFeatureSettings}-${this.fontVariationSettings}-${this.lineHeight}-${this.letterSpacing}`}getMassagedFontFamily(){let i=Yd.fontFamily,e=a._wrapInQuotes(this.fontFamily);return i&&this.fontFamily!==i?`${e}, ${i}`:e}static _wrapInQuotes(i){return/[,"']/.test(i)?i:/[+ ]/.test(i)?`"${i}"`:i}},k7t=2,O6=class extends oSe{constructor(e,t){super(e);this._editorStylingBrand=void 0;this.version=k7t;this.isTrusted=t,this.isMonospace=e.isMonospace,this.typicalHalfwidthCharacterWidth=e.typicalHalfwidthCharacterWidth,this.typicalFullwidthCharacterWidth=e.typicalFullwidthCharacterWidth,this.canUseHalfwidthRightwardsArrow=e.canUseHalfwidthRightwardsArrow,this.spaceWidth=e.spaceWidth,this.middotWidth=e.middotWidth,this.wsmiddotWidth=e.wsmiddotWidth,this.maxDigitWidth=e.maxDigitWidth}equals(e){return this.fontFamily===e.fontFamily&&this.fontWeight===e.fontWeight&&this.fontSize===e.fontSize&&this.fontFeatureSettings===e.fontFeatureSettings&&this.fontVariationSettings===e.fontVariationSettings&&this.lineHeight===e.lineHeight&&this.letterSpacing===e.letterSpacing&&this.typicalHalfwidthCharacterWidth===e.typicalHalfwidthCharacterWidth&&this.typicalFullwidthCharacterWidth===e.typicalFullwidthCharacterWidth&&this.canUseHalfwidthRightwardsArrow===e.canUseHalfwidthRightwardsArrow&&this.spaceWidth===e.spaceWidth&&this.middotWidth===e.middotWidth&&this.wsmiddotWidth===e.wsmiddotWidth&&this.maxDigitWidth===e.maxDigitWidth}},E7t="normal",T7t="translate",YRo="Consolas, 'Courier New', monospace",XRo="Menlo, Monaco, 'Courier New', monospace",JRo="'Droid Sans Mono', monospace",Yd={fontFamily:it?XRo:ri?YRo:JRo,fontWeight:"normal",fontSize:it?12:14,lineHeight:0,letterSpacing:0};var iv={tabSize:4,indentSize:4,insertSpaces:!0,detectIndentation:!0,trimAutoWhitespace:!0,largeFileOptimizations:!0,bracketPairColorizationOptions:{enabled:!0,independentColorPoolPerBracketType:!1}};var tW="`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?";function ZRo(a=""){let i="(-?\\d*\\.\\d\\w*)|([^";for(let e of tW)a.indexOf(e)>=0||(i+="\\"+e);return i+="\\s]+)",new RegExp(i,"g")}var F6=ZRo();function E$(a){let i=F6;if(a&&a instanceof RegExp)if(a.global)i=a;else{let e="g";a.ignoreCase&&(e+="i"),a.multiline&&(e+="m"),a.unicode&&(e+="u"),i=new RegExp(a.source,e)}return i.lastIndex=0,i}var dKi=new Vs;dKi.unshift({maxLen:1e3,windowSize:15,timeBudget:150});function My(a,i,e,t,o){if(i=E$(i),o||(o=ht.first(dKi)),e.length>o.maxLen){let c=a-o.maxLen/2;return c<0?c=0:t+=c,e=e.substring(c,a+o.maxLen/2),My(a,i,e,t,o)}let n=Date.now(),r=a-1-t,s=-1,l=null;for(let c=1;!(Date.now()-n>=o.timeBudget);c++){let u=r-o.windowSize*c;i.lastIndex=Math.max(0,u);let p=eMo(i,e,r,s);if(!p&&l||(l=p,u<=0))break;s=u}if(l){let c={word:l[0],startColumn:t+1+l.index,endColumn:t+1+l.index+l[0].length};return i.lastIndex=0,c}return null}function eMo(a,i,e,t){let o;for(;o=a.exec(i);){let n=o.index||0;if(n<=e&&a.lastIndex>=e)return o;if(t>0&&n>t)return null}return null}var Bi=ae("accessibilityService");var $a=new Q("accessibilityModeEnabled",!1);function uKi(a){if(!a||typeof a!="object")return!1;let i=a;return typeof i.label=="string"&&(typeof i.role>"u"||typeof i.role=="string")}var qGe="ACCESSIBLE_VIEW_SHOWN_";var iW=8,xmt=class{constructor(i){this._values=i}hasChanged(i){return this._values[i]}},jGe=class{constructor(){this.stableMinimapLayoutInput=null,this.stableFitMaxMinimapScale=0,this.stableFitRemainingWidth=0}},Fu=class{constructor(i,e,t,o){this.id=i,this.name=e,this.defaultValue=t,this.schema=o}applyUpdate(i,e){return Emt(i,e)}compute(i,e,t){return t}},nSe=class{constructor(i,e){this.newValue=i;this.didChange=e}};function Emt(a,i){if(typeof a!="object"||typeof i!="object"||!a||!i)return new nSe(i,a!==i);if(Array.isArray(a)||Array.isArray(i)){let t=Array.isArray(a)&&Array.isArray(i)&&$i(a,i);return new nSe(i,!t)}let e=!1;for(let t in i)if(i.hasOwnProperty(t)){let o=Emt(a[t],i[t]);o.didChange&&(a[t]=o.newValue,e=!0)}return new nSe(a,e)}var mU=class{constructor(i,e){this.schema=void 0;this.id=i,this.name="_never_",this.defaultValue=e}applyUpdate(i,e){return Emt(i,e)}validate(i){return this.defaultValue}},W6=class{constructor(i,e,t,o){this.id=i,this.name=e,this.defaultValue=t,this.schema=o}applyUpdate(i,e){return Emt(i,e)}compute(i,e,t){return t}};function Sn(a,i){return typeof a>"u"?i:a==="false"?!1:!!a}var fs=class extends W6{constructor(i,e,t,o=void 0){typeof o<"u"&&(o.type="boolean",o.default=t),super(i,e,t,o)}validate(i){return Sn(i,this.defaultValue)}};function oW(a,i,e,t){if(typeof a=="string"&&(a=parseInt(a,10)),typeof a!="number"||isNaN(a))return i;let o=a;return o=Math.max(e,o),o=Math.min(t,o),o|0}var Vc=class a extends W6{static clampedInt(i,e,t,o){return oW(i,e,t,o)}constructor(i,e,t,o,n,r=void 0){typeof r<"u"&&(r.type="integer",r.default=t,r.minimum=o,r.maximum=n),super(i,e,t,r),this.minimum=o,this.maximum=n}validate(i){return a.clampedInt(i,this.defaultValue,this.minimum,this.maximum)}};function mKi(a,i,e,t){if(typeof a>"u")return i;let o=qk.float(a,i);return qk.clamp(o,e,t)}var qk=class a extends W6{static clamp(i,e,t){return i<e?e:i>t?t:i}static float(i,e){return typeof i=="string"&&(i=parseFloat(i)),typeof i!="number"||isNaN(i)?e:i}constructor(i,e,t,o,n,r,s){typeof n<"u"&&(n.type="number",n.default=t,n.minimum=r,n.maximum=s),super(i,e,t,n),this.validationFn=o,this.minimum=r,this.maximum=s}validate(i){return this.validationFn(a.float(i,this.defaultValue))}},qw=class a extends W6{static string(i,e){return typeof i!="string"?e:i}constructor(i,e,t,o=void 0){typeof o<"u"&&(o.type="string",o.default=t),super(i,e,t,o)}validate(i){return a.string(i,this.defaultValue)}};function Md(a,i,e,t){return typeof a!="string"?i:t&&a in t?t[a]:e.indexOf(a)===-1?i:a}var Ou=class extends W6{constructor(i,e,t,o,n=void 0){typeof n<"u"&&(n.type="string",n.enum=o.slice(0),n.default=t),super(i,e,t,n),this._allowedValues=o}validate(i){return Md(i,this.defaultValue,this._allowedValues)}},jre=class extends Fu{constructor(i,e,t,o,n,r,s=void 0){typeof s<"u"&&(s.type="string",s.enum=n,s.default=o),super(i,e,t,s),this._allowedValues=n,this._convert=r}validate(i){return typeof i!="string"?this.defaultValue:this._allowedValues.indexOf(i)===-1?this.defaultValue:this._convert(i)}};function tMo(a){switch(a){case"none":return 0;case"keep":return 1;case"brackets":return 2;case"advanced":return 3;case"full":return 4}}var _7t=class extends Fu{constructor(){super(2,"accessibilitySupport",0,{type:"string",enum:["auto","on","off"],enumDescriptions:[d(315,null),d(317,null),d(316,null)],default:"auto",tags:["accessibility"],description:d(314,null)})}validate(i){switch(i){case"auto":return 0;case"off":return 1;case"on":return 2}return this.defaultValue}compute(i,e,t){return t===0?i.accessibilitySupport:t}},D7t=class extends Fu{constructor(){let i={insertSpace:!0,ignoreEmptyLines:!0};super(29,"comments",i,{"editor.comments.insertSpace":{type:"boolean",default:i.insertSpace,description:d(345,null)},"editor.comments.ignoreEmptyLines":{type:"boolean",default:i.ignoreEmptyLines,description:d(344,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{insertSpace:Sn(e.insertSpace,this.defaultValue.insertSpace),ignoreEmptyLines:Sn(e.ignoreEmptyLines,this.defaultValue.ignoreEmptyLines)}}};function gYt(a){switch(a){case"blink":return 1;case"smooth":return 2;case"phase":return 3;case"expand":return 4;case"solid":return 5}}function hKi(a){switch(a){case 1:return"line";case 2:return"block";case 3:return"underline";case 4:return"line-thin";case 5:return"block-outline";case 6:return"underline-thin"}}function kmt(a){switch(a){case"line":return 1;case"block":return 2;case"underline":return 3;case"line-thin":return 4;case"block-outline":return 5;case"underline-thin":return 6}}var L7t=class extends mU{constructor(){super(162,"")}compute(i,e,t){let o=["monaco-editor"];return e.get(48)&&o.push(e.get(48)),i.extraEditorClassName&&o.push(i.extraEditorClassName),e.get(82)==="default"?o.push("mouse-default"):e.get(82)==="copy"&&o.push("mouse-copy"),e.get(127)&&o.push("showUnused"),e.get(157)&&o.push("showDeprecated"),o.join(" ")}},R7t=class extends fs{constructor(){super(45,"emptySelectionClipboard",!0,{description:d(468,null)})}compute(i,e,t){return t&&i.emptySelectionClipboard}},M7t=class extends Fu{constructor(){let i={cursorMoveOnType:!0,findOnType:!0,seedSearchStringFromSelection:"always",autoFindInSelection:"never",globalFindClipboard:!1,addExtraSpaceOnTop:!0,loop:!0,history:"workspace",replaceHistory:"workspace"};super(50,"find",i,{"editor.find.cursorMoveOnType":{type:"boolean",default:i.cursorMoveOnType,description:d(480,null)},"editor.find.seedSearchStringFromSelection":{type:"string",enum:["never","always","selection"],default:i.seedSearchStringFromSelection,enumDescriptions:[d(404,null),d(403,null),d(405,null)],description:d(486,null)},"editor.find.autoFindInSelection":{type:"string",enum:["never","always","multiline"],default:i.autoFindInSelection,enumDescriptions:[d(398,null),d(396,null),d(397,null)],description:d(479,null)},"editor.find.globalFindClipboard":{type:"boolean",default:i.globalFindClipboard,description:d(482,null),included:it},"editor.find.addExtraSpaceOnTop":{type:"boolean",default:i.addExtraSpaceOnTop,description:d(478,null)},"editor.find.loop":{type:"boolean",default:i.loop,description:d(484,null)},"editor.find.history":{type:"string",enum:["never","workspace"],default:"workspace",enumDescriptions:[d(399,null),d(400,null)],description:d(483,null)},"editor.find.replaceHistory":{type:"string",enum:["never","workspace"],default:"workspace",enumDescriptions:[d(401,null),d(402,null)],description:d(485,null)},"editor.find.findOnType":{type:"boolean",default:i.findOnType,description:d(481,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{cursorMoveOnType:Sn(e.cursorMoveOnType,this.defaultValue.cursorMoveOnType),findOnType:Sn(e.findOnType,this.defaultValue.findOnType),seedSearchStringFromSelection:typeof e.seedSearchStringFromSelection=="boolean"?e.seedSearchStringFromSelection?"always":"never":Md(e.seedSearchStringFromSelection,this.defaultValue.seedSearchStringFromSelection,["never","always","selection"]),autoFindInSelection:typeof e.autoFindInSelection=="boolean"?e.autoFindInSelection?"always":"never":Md(e.autoFindInSelection,this.defaultValue.autoFindInSelection,["never","always","multiline"]),globalFindClipboard:Sn(e.globalFindClipboard,this.defaultValue.globalFindClipboard),addExtraSpaceOnTop:Sn(e.addExtraSpaceOnTop,this.defaultValue.addExtraSpaceOnTop),loop:Sn(e.loop,this.defaultValue.loop),history:Md(e.history,this.defaultValue.history,["never","workspace"]),replaceHistory:Md(e.replaceHistory,this.defaultValue.replaceHistory,["never","workspace"])}}},mx=class a extends Fu{static{this.OFF='"liga" off, "calt" off'}static{this.ON='"liga" on, "calt" on'}constructor(){super(60,"fontLigatures",a.OFF,{anyOf:[{type:"boolean",description:d(496,null)},{type:"string",description:d(495,null)}],description:d(497,null),default:!1})}validate(i){return typeof i>"u"?this.defaultValue:typeof i=="string"?i==="false"||i.length===0?a.OFF:i==="true"?a.ON:i:i?a.ON:a.OFF}},P7t=class a extends Fu{static{this.OFF=E7t}static{this.TRANSLATE=T7t}constructor(){super(63,"fontVariations",a.OFF,{anyOf:[{type:"boolean",description:d(499,null)},{type:"string",description:d(500,null)}],description:d(501,null),default:!1})}validate(i){return typeof i>"u"?this.defaultValue:typeof i=="string"?i==="false"?a.OFF:i==="true"?a.TRANSLATE:i:i?a.TRANSLATE:a.OFF}compute(i,e,t){return i.fontInfo.fontVariationSettings}},A7t=class extends mU{constructor(){super(59,new O6({pixelRatio:0,fontFamily:"",fontWeight:"",fontSize:0,fontFeatureSettings:"",fontVariationSettings:"",lineHeight:0,letterSpacing:0,isMonospace:!1,typicalHalfwidthCharacterWidth:0,typicalFullwidthCharacterWidth:0,canUseHalfwidthRightwardsArrow:!1,spaceWidth:0,middotWidth:0,wsmiddotWidth:0,maxDigitWidth:0},!1))}compute(i,e,t){return i.fontInfo}},N7t=class extends mU{constructor(){super(161,1)}compute(i,e,t){return i.inputMode==="overtype"?e.get(92):e.get(34)}},O7t=class extends mU{constructor(){super(170,!1)}compute(i,e){return i.editContextSupported&&e.get(44)}},F7t=class extends mU{constructor(){super(172,!1)}compute(i,e){return i.accessibilitySupport===2?e.get(7):e.get(6)}},W7t=class extends W6{constructor(){super(61,"fontSize",Yd.fontSize,{type:"number",minimum:6,maximum:100,default:Yd.fontSize,description:d(498,null)})}validate(i){let e=qk.float(i,this.defaultValue);return e===0?Yd.fontSize:qk.clamp(e,6,100)}compute(i,e,t){return i.fontInfo.fontSize}},V7t=class a extends Fu{static{this.SUGGESTION_VALUES=["normal","bold","100","200","300","400","500","600","700","800","900"]}static{this.MINIMUM_VALUE=1}static{this.MAXIMUM_VALUE=1e3}constructor(){super(62,"fontWeight",Yd.fontWeight,{anyOf:[{type:"number",minimum:a.MINIMUM_VALUE,maximum:a.MAXIMUM_VALUE,errorMessage:d(503,null)},{type:"string",pattern:"^(normal|bold|1000|[1-9][0-9]{0,2})$"},{enum:a.SUGGESTION_VALUES}],default:Yd.fontWeight,description:d(502,null)})}validate(i){return i==="normal"||i==="bold"?i:String(Vc.clampedInt(i,Yd.fontWeight,a.MINIMUM_VALUE,a.MAXIMUM_VALUE))}},B7t=class extends Fu{constructor(){let i={multiple:"peek",multipleDefinitions:"peek",multipleTypeDefinitions:"peek",multipleDeclarations:"peek",multipleImplementations:"peek",multipleReferences:"peek",multipleTests:"peek",alternativeDefinitionCommand:"editor.action.goToReferences",alternativeTypeDefinitionCommand:"editor.action.goToReferences",alternativeDeclarationCommand:"editor.action.goToReferences",alternativeImplementationCommand:"",alternativeReferenceCommand:"",alternativeTestsCommand:""},e={type:"string",enum:["peek","gotoAndPeek","goto"],default:i.multiple,enumDescriptions:[d(409,null),d(408,null),d(407,null)]},t=["","editor.action.referenceSearch.trigger","editor.action.goToReferences","editor.action.peekImplementation","editor.action.goToImplementation","editor.action.peekTypeDefinition","editor.action.goToTypeDefinition","editor.action.peekDeclaration","editor.action.revealDeclaration","editor.action.peekDefinition","editor.action.revealDefinitionAside","editor.action.revealDefinition"];super(67,"gotoLocation",i,{"editor.gotoLocation.multiple":{deprecationMessage:d(406,null)},"editor.gotoLocation.multipleDefinitions":{description:d(392,null),...e},"editor.gotoLocation.multipleTypeDefinitions":{description:d(395,null),...e},"editor.gotoLocation.multipleDeclarations":{description:d(391,null),...e},"editor.gotoLocation.multipleImplementations":{description:d(393,null),...e},"editor.gotoLocation.multipleReferences":{description:d(394,null),...e},"editor.gotoLocation.alternativeDefinitionCommand":{type:"string",default:i.alternativeDefinitionCommand,enum:t,description:d(322,null)},"editor.gotoLocation.alternativeTypeDefinitionCommand":{type:"string",default:i.alternativeTypeDefinitionCommand,enum:t,description:d(325,null)},"editor.gotoLocation.alternativeDeclarationCommand":{type:"string",default:i.alternativeDeclarationCommand,enum:t,description:d(321,null)},"editor.gotoLocation.alternativeImplementationCommand":{type:"string",default:i.alternativeImplementationCommand,enum:t,description:d(323,null)},"editor.gotoLocation.alternativeReferenceCommand":{type:"string",default:i.alternativeReferenceCommand,enum:t,description:d(324,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{multiple:Md(e.multiple,this.defaultValue.multiple,["peek","gotoAndPeek","goto"]),multipleDefinitions:Md(e.multipleDefinitions,"peek",["peek","gotoAndPeek","goto"]),multipleTypeDefinitions:Md(e.multipleTypeDefinitions,"peek",["peek","gotoAndPeek","goto"]),multipleDeclarations:Md(e.multipleDeclarations,"peek",["peek","gotoAndPeek","goto"]),multipleImplementations:Md(e.multipleImplementations,"peek",["peek","gotoAndPeek","goto"]),multipleReferences:Md(e.multipleReferences,"peek",["peek","gotoAndPeek","goto"]),multipleTests:Md(e.multipleTests,"peek",["peek","gotoAndPeek","goto"]),alternativeDefinitionCommand:qw.string(e.alternativeDefinitionCommand,this.defaultValue.alternativeDefinitionCommand),alternativeTypeDefinitionCommand:qw.string(e.alternativeTypeDefinitionCommand,this.defaultValue.alternativeTypeDefinitionCommand),alternativeDeclarationCommand:qw.string(e.alternativeDeclarationCommand,this.defaultValue.alternativeDeclarationCommand),alternativeImplementationCommand:qw.string(e.alternativeImplementationCommand,this.defaultValue.alternativeImplementationCommand),alternativeReferenceCommand:qw.string(e.alternativeReferenceCommand,this.defaultValue.alternativeReferenceCommand),alternativeTestsCommand:qw.string(e.alternativeTestsCommand,this.defaultValue.alternativeTestsCommand)}}},H7t=class extends Fu{constructor(){let i={enabled:"on",delay:300,hidingDelay:300,sticky:!0,above:!0,showLongLineWarning:!0};super(69,"hover",i,{"editor.hover.enabled":{type:"string",enum:["on","off","onKeyboardModifier"],default:i.enabled,markdownEnumDescriptions:[d(512,null),d(511,null),d(513,null,it?"Command":"Control")],description:d(510,null)},"editor.hover.delay":{type:"number",default:i.delay,minimum:0,maximum:1e4,description:d(509,null)},"editor.hover.sticky":{type:"boolean",default:i.sticky,description:d(516,null)},"editor.hover.hidingDelay":{type:"integer",minimum:0,default:i.hidingDelay,markdownDescription:d(514,null)},"editor.hover.above":{type:"boolean",default:i.above,description:d(508,null)},"editor.hover.showLongLineWarning":{type:"boolean",default:i.showLongLineWarning,description:d(515,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{enabled:Md(e.enabled,this.defaultValue.enabled,["on","off","onKeyboardModifier"]),delay:Vc.clampedInt(e.delay,this.defaultValue.delay,0,1e4),sticky:Sn(e.sticky,this.defaultValue.sticky),hidingDelay:Vc.clampedInt(e.hidingDelay,this.defaultValue.hidingDelay,0,6e5),above:Sn(e.above,this.defaultValue.above),showLongLineWarning:Sn(e.showLongLineWarning,this.defaultValue.showLongLineWarning)}}};var QGe=class a extends mU{constructor(){super(165,{width:0,height:0,glyphMarginLeft:0,glyphMarginWidth:0,glyphMarginDecorationLaneCount:0,lineNumbersLeft:0,lineNumbersWidth:0,decorationsLeft:0,decorationsWidth:0,contentLeft:0,contentWidth:0,minimap:{renderMinimap:0,minimapLeft:0,minimapWidth:0,minimapHeightIsEditorHeight:!1,minimapIsSampling:!1,minimapScale:1,minimapLineHeight:1,minimapCanvasInnerWidth:0,minimapCanvasInnerHeight:0,minimapCanvasOuterWidth:0,minimapCanvasOuterHeight:0},viewportColumn:0,isWordWrapMinified:!1,isViewportWrapping:!1,wrappingColumn:-1,verticalScrollbarWidth:0,horizontalScrollbarHeight:0,overviewRuler:{top:0,width:0,height:0,right:0}})}compute(i,e,t){return a.computeLayout(e,{memory:i.memory,outerWidth:i.outerWidth,outerHeight:i.outerHeight,isDominatedByLongLines:i.isDominatedByLongLines,lineHeight:i.fontInfo.lineHeight,viewLineCount:i.viewLineCount,lineNumbersDigitCount:i.lineNumbersDigitCount,typicalHalfwidthCharacterWidth:i.fontInfo.typicalHalfwidthCharacterWidth,maxDigitWidth:i.fontInfo.maxDigitWidth,pixelRatio:i.pixelRatio,glyphMarginDecorationLaneCount:i.glyphMarginDecorationLaneCount})}static computeContainedMinimapLineCount(i){let e=i.height/i.lineHeight,t=Math.floor(i.paddingTop/i.lineHeight),o=Math.floor(i.paddingBottom/i.lineHeight);i.scrollBeyondLastLine&&(o=Math.max(o,e-1));let n=(t+i.viewLineCount+o)/(i.pixelRatio*i.height),r=Math.floor(i.viewLineCount/n);return{typicalViewportLineCount:e,extraLinesBeforeFirstLine:t,extraLinesBeyondLastLine:o,desiredRatio:n,minimapLineCount:r}}static _computeMinimapLayout(i,e){let t=i.outerWidth,o=i.outerHeight,n=i.pixelRatio;if(!i.minimap.enabled)return{renderMinimap:0,minimapLeft:0,minimapWidth:0,minimapHeightIsEditorHeight:!1,minimapIsSampling:!1,minimapScale:1,minimapLineHeight:1,minimapCanvasInnerWidth:0,minimapCanvasInnerHeight:Math.floor(n*o),minimapCanvasOuterWidth:0,minimapCanvasOuterHeight:o};let r=e.stableMinimapLayoutInput,s=r&&i.outerHeight===r.outerHeight&&i.lineHeight===r.lineHeight&&i.typicalHalfwidthCharacterWidth===r.typicalHalfwidthCharacterWidth&&i.pixelRatio===r.pixelRatio&&i.scrollBeyondLastLine===r.scrollBeyondLastLine&&i.paddingTop===r.paddingTop&&i.paddingBottom===r.paddingBottom&&i.minimap.enabled===r.minimap.enabled&&i.minimap.side===r.minimap.side&&i.minimap.size===r.minimap.size&&i.minimap.showSlider===r.minimap.showSlider&&i.minimap.renderCharacters===r.minimap.renderCharacters&&i.minimap.maxColumn===r.minimap.maxColumn&&i.minimap.scale===r.minimap.scale&&i.verticalScrollbarWidth===r.verticalScrollbarWidth&&i.isViewportWrapping===r.isViewportWrapping,l=i.lineHeight,c=i.typicalHalfwidthCharacterWidth,u=i.scrollBeyondLastLine,p=i.minimap.renderCharacters,h=n>=2?Math.round(i.minimap.scale*2):i.minimap.scale,g=i.minimap.maxColumn,f=i.minimap.size,v=i.minimap.side,b=i.verticalScrollbarWidth,S=i.viewLineCount,y=i.remainingWidth,w=i.isViewportWrapping,k=p?2:3,T=Math.floor(n*o),N=T/n,O=!1,V=!1,U=k*h,G=h/n,$=1;if(f==="fill"||f==="fit"){let{typicalViewportLineCount:Ee,extraLinesBeforeFirstLine:He,extraLinesBeyondLastLine:Ve,desiredRatio:Fe,minimapLineCount:Qt}=a.computeContainedMinimapLineCount({viewLineCount:S,scrollBeyondLastLine:u,paddingTop:i.paddingTop,paddingBottom:i.paddingBottom,height:o,lineHeight:l,pixelRatio:n});if(S/Qt>1)O=!0,V=!0,h=1,U=1,G=h/n;else{let Ti=!1,ti=h+1;if(f==="fit"){let bo=Math.ceil((He+S+Ve)*U);w&&s&&y<=e.stableFitRemainingWidth?(Ti=!0,ti=e.stableFitMaxMinimapScale):Ti=bo>T}if(f==="fill"||Ti){O=!0;let bo=h;U=Math.min(l*n,Math.max(1,Math.floor(1/Fe))),w&&s&&y<=e.stableFitRemainingWidth&&(ti=e.stableFitMaxMinimapScale),h=Math.min(ti,Math.max(1,Math.floor(U/k))),h>bo&&($=Math.min(2,h/bo)),G=h/n/$,T=Math.ceil(Math.max(Ee,He+S+Ve)*U),w?(e.stableMinimapLayoutInput=i,e.stableFitRemainingWidth=y,e.stableFitMaxMinimapScale=h):(e.stableMinimapLayoutInput=null,e.stableFitRemainingWidth=0)}}}let te=Math.floor(g*G),pe=Math.min(te,Math.max(0,Math.floor((y-b-2)*G/(c+G)))+iW),de=Math.floor(n*pe),se=de/n;de=Math.floor(de*$);let Se=p?1:2,ke=v==="left"?0:t-pe-b;return{renderMinimap:Se,minimapLeft:ke,minimapWidth:pe,minimapHeightIsEditorHeight:O,minimapIsSampling:V,minimapScale:h,minimapLineHeight:U,minimapCanvasInnerWidth:de,minimapCanvasInnerHeight:T,minimapCanvasOuterWidth:se,minimapCanvasOuterHeight:N}}static computeLayout(i,e){let t=e.outerWidth|0,o=e.outerHeight|0,n=e.lineHeight|0,r=e.lineNumbersDigitCount|0,s=e.typicalHalfwidthCharacterWidth,l=e.maxDigitWidth,c=e.pixelRatio,u=e.viewLineCount,p=i.get(154),h=p==="inherit"?i.get(153):p,g=h==="inherit"?i.get(149):h,f=i.get(152),v=e.isDominatedByLongLines,b=i.get(66),S=i.get(76).renderType!==0,y=i.get(77),w=i.get(119),k=i.get(96),T=i.get(81),N=i.get(117),O=N.verticalScrollbarSize,V=N.verticalHasArrows,U=N.arrowSize,G=N.horizontalScrollbarSize,$=i.get(52),te=i.get(126)!=="never",pe=i.get(74);$&&te&&(pe+=16);let de=0;if(S){let _o=Math.max(r,y);de=Math.round(_o*l)}let se=0;b&&(se=n*e.glyphMarginDecorationLaneCount);let Se=0,ke=Se+se,Ee=ke+de,He=Ee+pe,Ve=t-se-de-pe,Fe=!1,Qt=!1,Ze=-1;i.get(2)===2&&h==="inherit"&&v?(Fe=!0,Qt=!0):g==="on"||g==="bounded"?Qt=!0:g==="wordWrapColumn"&&(Ze=f);let Ti=a._computeMinimapLayout({outerWidth:t,outerHeight:o,lineHeight:n,typicalHalfwidthCharacterWidth:s,pixelRatio:c,scrollBeyondLastLine:w,paddingTop:k.top,paddingBottom:k.bottom,minimap:T,verticalScrollbarWidth:O,viewLineCount:u,remainingWidth:Ve,isViewportWrapping:Qt},e.memory||new jGe);Ti.renderMinimap!==0&&Ti.minimapLeft===0&&(Se+=Ti.minimapWidth,ke+=Ti.minimapWidth,Ee+=Ti.minimapWidth,He+=Ti.minimapWidth);let ti=Ve-Ti.minimapWidth,bo=Math.max(1,Math.floor((ti-O-2)/s)),Ro=V?U:0;return Qt&&(Ze=Math.max(1,bo),g==="bounded"&&(Ze=Math.min(Ze,f))),{width:t,height:o,glyphMarginLeft:Se,glyphMarginWidth:se,glyphMarginDecorationLaneCount:e.glyphMarginDecorationLaneCount,lineNumbersLeft:ke,lineNumbersWidth:de,decorationsLeft:Ee,decorationsWidth:pe,contentLeft:He,contentWidth:ti,minimap:Ti,viewportColumn:bo,isWordWrapMinified:Fe,isViewportWrapping:Qt,wrappingColumn:Ze,verticalScrollbarWidth:O,horizontalScrollbarHeight:G,overviewRuler:{top:Ro,width:O,height:o-2*Ro,right:0}}}},U7t=class extends Fu{constructor(){super(156,"wrappingStrategy","simple",{"editor.wrappingStrategy":{enumDescriptions:[d(729,null),d(728,null)],type:"string",enum:["simple","advanced"],default:"simple",description:d(727,null)}})}validate(i){return Md(i,"simple",["simple","advanced"])}compute(i,e,t){return e.get(2)===2?"advanced":t}};var z7t=class extends Fu{constructor(){let i={enabled:"onCode"};super(73,"lightbulb",i,{"editor.lightbulb.enabled":{type:"string",enum:["off","onCode","on"],default:i.enabled,enumDescriptions:[d(430,null),d(432,null),d(431,null)],description:d(469,null)}})}validate(i){return!i||typeof i!="object"?this.defaultValue:{enabled:Md(i.enabled,this.defaultValue.enabled,["off","onCode","on"])}}},K7t=class extends Fu{constructor(){let i={enabled:!0,maxLineCount:5,defaultModel:"outlineModel",scrollWithEditor:!0};super(131,"stickyScroll",i,{"editor.stickyScroll.enabled":{type:"boolean",default:i.enabled,description:d(434,null)},"editor.stickyScroll.maxLineCount":{type:"number",default:i.maxLineCount,minimum:1,maximum:20,description:d(435,null)},"editor.stickyScroll.defaultModel":{type:"string",enum:["outlineModel","foldingProviderModel","indentationModel"],default:i.defaultModel,description:d(433,null)},"editor.stickyScroll.scrollWithEditor":{type:"boolean",default:i.scrollWithEditor,description:d(436,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{enabled:Sn(e.enabled,this.defaultValue.enabled),maxLineCount:Vc.clampedInt(e.maxLineCount,this.defaultValue.maxLineCount,1,20),defaultModel:Md(e.defaultModel,this.defaultValue.defaultModel,["outlineModel","foldingProviderModel","indentationModel"]),scrollWithEditor:Sn(e.scrollWithEditor,this.defaultValue.scrollWithEditor)}}},G7t=class extends Fu{constructor(){let i={enabled:"on",fontSize:0,fontFamily:"",padding:!1,maximumLength:43};super(159,"inlayHints",i,{"editor.inlayHints.enabled":{type:"string",default:i.enabled,description:d(518,null),enum:["on","onUnlessPressed","offUnlessPressed","off"],markdownEnumDescriptions:[d(426,null),d(427,null,it?"Ctrl+Option":"Ctrl+Alt"),d(425,null,it?"Ctrl+Option":"Ctrl+Alt"),d(424,null)]},"editor.inlayHints.fontSize":{type:"number",default:i.fontSize,markdownDescription:d(520,null,"`#editor.fontSize#`","`5`")},"editor.inlayHints.fontFamily":{type:"string",default:i.fontFamily,markdownDescription:d(519,null,"`#editor.fontFamily#`")},"editor.inlayHints.padding":{type:"boolean",default:i.padding,description:d(522,null)},"editor.inlayHints.maximumLength":{type:"number",default:i.maximumLength,markdownDescription:d(521,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return typeof e.enabled=="boolean"&&(e.enabled=e.enabled?"on":"off"),{enabled:Md(e.enabled,this.defaultValue.enabled,["on","off","offUnlessPressed","onUnlessPressed"]),fontSize:Vc.clampedInt(e.fontSize,this.defaultValue.fontSize,0,100),fontFamily:qw.string(e.fontFamily,this.defaultValue.fontFamily),padding:Sn(e.padding,this.defaultValue.padding),maximumLength:Vc.clampedInt(e.maximumLength,this.defaultValue.maximumLength,0,Number.MAX_SAFE_INTEGER)}}},$7t=class extends Fu{constructor(){super(74,"lineDecorationsWidth",10)}validate(i){return typeof i=="string"&&/^\d+(\.\d+)?ch$/.test(i)?-parseFloat(i.substring(0,i.length-2)):Vc.clampedInt(i,this.defaultValue,0,1e3)}compute(i,e,t){return t<0?Vc.clampedInt(-t*i.fontInfo.typicalHalfwidthCharacterWidth,this.defaultValue,0,1e3):t}},q7t=class extends qk{constructor(){super(75,"lineHeight",Yd.lineHeight,i=>qk.clamp(i,0,150),{markdownDescription:d(544,null)},0,150)}compute(i,e,t){return i.fontInfo.lineHeight}},j7t=class extends Fu{constructor(){let i={enabled:!0,size:"proportional",side:"right",showSlider:"mouseover",autohide:"none",renderCharacters:!0,maxColumn:120,scale:1,showRegionSectionHeaders:!0,showMarkSectionHeaders:!0,markSectionHeaderRegex:"\\bMARK:\\s*(?<separator>-?)\\s*(?<label>.*)$",sectionHeaderFontSize:9,sectionHeaderLetterSpacing:1};super(81,"minimap",i,{"editor.minimap.enabled":{type:"boolean",default:i.enabled,description:d(557,null)},"editor.minimap.autohide":{type:"string",enum:["none","mouseover","scroll"],enumDescriptions:[d(555,null),d(554,null),d(556,null)],default:i.autohide,description:d(553,null)},"editor.minimap.size":{type:"string",enum:["proportional","fill","fit"],enumDescriptions:[d(571,null),d(569,null),d(570,null)],default:i.size,description:d(568,null)},"editor.minimap.side":{type:"string",enum:["left","right"],default:i.side,description:d(567,null)},"editor.minimap.showSlider":{type:"string",enum:["always","mouseover"],default:i.showSlider,description:d(566,null)},"editor.minimap.scale":{type:"number",default:i.scale,minimum:1,maximum:3,enum:[1,2,3],description:d(561,null)},"editor.minimap.renderCharacters":{type:"boolean",default:i.renderCharacters,description:d(560,null)},"editor.minimap.maxColumn":{type:"number",default:i.maxColumn,description:d(559,null)},"editor.minimap.showRegionSectionHeaders":{type:"boolean",default:i.showRegionSectionHeaders,description:d(565,null)},"editor.minimap.showMarkSectionHeaders":{type:"boolean",default:i.showMarkSectionHeaders,description:d(564,null)},"editor.minimap.markSectionHeaderRegex":{type:"string",default:i.markSectionHeaderRegex,description:d(558,null)},"editor.minimap.sectionHeaderFontSize":{type:"number",default:i.sectionHeaderFontSize,description:d(562,null)},"editor.minimap.sectionHeaderLetterSpacing":{type:"number",default:i.sectionHeaderLetterSpacing,description:d(563,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i,t=this.defaultValue.markSectionHeaderRegex,o=e.markSectionHeaderRegex;if(typeof o=="string")try{new RegExp(o,"d"),t=o}catch{}return{enabled:Sn(e.enabled,this.defaultValue.enabled),autohide:Md(e.autohide,this.defaultValue.autohide,["none","mouseover","scroll"]),size:Md(e.size,this.defaultValue.size,["proportional","fill","fit"]),side:Md(e.side,this.defaultValue.side,["right","left"]),showSlider:Md(e.showSlider,this.defaultValue.showSlider,["always","mouseover"]),renderCharacters:Sn(e.renderCharacters,this.defaultValue.renderCharacters),scale:Vc.clampedInt(e.scale,1,1,3),maxColumn:Vc.clampedInt(e.maxColumn,this.defaultValue.maxColumn,1,1e4),showRegionSectionHeaders:Sn(e.showRegionSectionHeaders,this.defaultValue.showRegionSectionHeaders),showMarkSectionHeaders:Sn(e.showMarkSectionHeaders,this.defaultValue.showMarkSectionHeaders),markSectionHeaderRegex:t,sectionHeaderFontSize:qk.clamp(qk.float(e.sectionHeaderFontSize,this.defaultValue.sectionHeaderFontSize),4,32),sectionHeaderLetterSpacing:qk.clamp(qk.float(e.sectionHeaderLetterSpacing,this.defaultValue.sectionHeaderLetterSpacing),0,5)}}};function iMo(a){return a==="ctrlCmd"?it?"metaKey":"ctrlKey":"altKey"}var Q7t=class extends Fu{constructor(){super(96,"padding",{top:0,bottom:0},{"editor.padding.top":{type:"number",default:0,minimum:0,maximum:1e3,description:d(596,null)},"editor.padding.bottom":{type:"number",default:0,minimum:0,maximum:1e3,description:d(595,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{top:Vc.clampedInt(e.top,0,0,1e3),bottom:Vc.clampedInt(e.bottom,0,0,1e3)}}},Y7t=class extends Fu{constructor(){let i={enabled:!0,cycle:!0};super(98,"parameterHints",i,{"editor.parameterHints.enabled":{type:"boolean",default:i.enabled,description:d(598,null)},"editor.parameterHints.cycle":{type:"boolean",default:i.cycle,description:d(597,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{enabled:Sn(e.enabled,this.defaultValue.enabled),cycle:Sn(e.cycle,this.defaultValue.cycle)}}},X7t=class extends mU{constructor(){super(163,1)}compute(i,e,t){return i.pixelRatio}},J7t=class extends Fu{constructor(){super(100,"placeholder",void 0)}validate(i){return typeof i>"u"?this.defaultValue:typeof i=="string"?i:this.defaultValue}},Z7t=class extends Fu{constructor(){let i={other:"on",comments:"off",strings:"off"},e=[{type:"boolean"},{type:"string",enum:["on","inline","off","offWhenInlineCompletions"],enumDescriptions:[d(591,null),d(523,null),d(589,null),d(590,null)]}];super(102,"quickSuggestions",i,{anyOf:[{type:"boolean"},{type:"string",enum:["on","inline","off","offWhenInlineCompletions"],enumDescriptions:[d(613,null),d(610,null),d(611,null),d(612,null)]},{type:"object",additionalProperties:!1,properties:{strings:{anyOf:e,default:i.strings,description:d(609,null)},comments:{anyOf:e,default:i.comments,description:d(607,null)},other:{anyOf:e,default:i.other,description:d(608,null)}}}],default:i,markdownDescription:d(606,null,"`#editor.suggestOnTriggerCharacters#`"),experiment:{mode:"auto"}}),this.defaultValue=i}validate(i){if(typeof i=="boolean"){let c=i?"on":"off";return{comments:c,strings:c,other:c}}if(typeof i=="string"){let c=["on","inline","off","offWhenInlineCompletions"],u=Md(i,this.defaultValue.other,c);return{comments:u,strings:u,other:u}}if(!i||typeof i!="object")return this.defaultValue;let{other:e,comments:t,strings:o}=i,n=["on","inline","off","offWhenInlineCompletions"],r,s,l;return typeof e=="boolean"?r=e?"on":"off":r=Md(e,this.defaultValue.other,n),typeof t=="boolean"?s=t?"on":"off":s=Md(t,this.defaultValue.comments,n),typeof o=="boolean"?l=o?"on":"off":l=Md(o,this.defaultValue.strings,n),{other:r,comments:s,strings:l}}};var eYt=class extends Fu{constructor(){super(76,"lineNumbers",{renderType:1,renderFn:null},{type:"string",enum:["off","on","relative","interval"],enumDescriptions:[d(547,null),d(548,null),d(549,null),d(546,null)],default:"on",description:d(545,null)})}validate(i){let e=this.defaultValue.renderType,t=this.defaultValue.renderFn;return typeof i<"u"&&(typeof i=="function"?(e=4,t=i):i==="interval"?e=3:i==="relative"?e=2:i==="on"?e=1:e=0),{renderType:e,renderFn:t}}};function Qre(a){let i=a.get(112);return i==="editable"?a.get(104):i!=="on"}function Yre(a){return!a.get(172)}var tYt=class extends Fu{constructor(){let i=[],e={type:"number",description:d(630,null)};super(116,"rulers",i,{type:"array",items:{anyOf:[e,{type:["object"],properties:{column:e,color:{type:"string",description:d(629,null),format:"color-hex"}}}]},default:i,description:d(628,null)})}validate(i){if(Array.isArray(i)){let e=[];for(let t of i)if(typeof t=="number")e.push({column:Vc.clampedInt(t,0,0,1e4),color:null});else if(t&&typeof t=="object"){let o=t;e.push({column:Vc.clampedInt(o.column,0,0,1e4),color:o.color})}return e.sort((t,o)=>t.column-o.column),e}return this.defaultValue}},iYt=class extends Fu{constructor(){super(105,"readOnlyMessage",void 0)}validate(i){return!i||typeof i!="object"?this.defaultValue:i}};function pKi(a,i){if(typeof a!="string")return i;switch(a){case"hidden":return 2;case"visible":return 3;default:return 1}}var oYt=class extends Fu{constructor(){let i={vertical:1,horizontal:1,arrowSize:11,useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,horizontalScrollbarSize:12,horizontalSliderSize:12,verticalScrollbarSize:14,verticalSliderSize:14,handleMouseWheel:!0,alwaysConsumeMouseWheel:!0,scrollByPage:!1,ignoreHorizontalScrollbarInContentHeight:!1};super(117,"scrollbar",i,{"editor.scrollbar.vertical":{type:"string",enum:["auto","visible","hidden"],enumDescriptions:[d(640,null),d(642,null),d(641,null)],default:"auto",description:d(639,null)},"editor.scrollbar.horizontal":{type:"string",enum:["auto","visible","hidden"],enumDescriptions:[d(633,null),d(635,null),d(634,null)],default:"auto",description:d(632,null)},"editor.scrollbar.verticalScrollbarSize":{type:"number",default:i.verticalScrollbarSize,description:d(643,null)},"editor.scrollbar.horizontalScrollbarSize":{type:"number",default:i.horizontalScrollbarSize,description:d(636,null)},"editor.scrollbar.scrollByPage":{type:"boolean",default:i.scrollByPage,description:d(638,null)},"editor.scrollbar.ignoreHorizontalScrollbarInContentHeight":{type:"boolean",default:i.ignoreHorizontalScrollbarInContentHeight,description:d(637,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i,t=Vc.clampedInt(e.horizontalScrollbarSize,this.defaultValue.horizontalScrollbarSize,0,1e3),o=Vc.clampedInt(e.verticalScrollbarSize,this.defaultValue.verticalScrollbarSize,0,1e3);return{arrowSize:Vc.clampedInt(e.arrowSize,this.defaultValue.arrowSize,0,1e3),vertical:pKi(e.vertical,this.defaultValue.vertical),horizontal:pKi(e.horizontal,this.defaultValue.horizontal),useShadows:Sn(e.useShadows,this.defaultValue.useShadows),verticalHasArrows:Sn(e.verticalHasArrows,this.defaultValue.verticalHasArrows),horizontalHasArrows:Sn(e.horizontalHasArrows,this.defaultValue.horizontalHasArrows),handleMouseWheel:Sn(e.handleMouseWheel,this.defaultValue.handleMouseWheel),alwaysConsumeMouseWheel:Sn(e.alwaysConsumeMouseWheel,this.defaultValue.alwaysConsumeMouseWheel),horizontalScrollbarSize:t,horizontalSliderSize:Vc.clampedInt(e.horizontalSliderSize,t,0,1e3),verticalScrollbarSize:o,verticalSliderSize:Vc.clampedInt(e.verticalSliderSize,o,0,1e3),scrollByPage:Sn(e.scrollByPage,this.defaultValue.scrollByPage),ignoreHorizontalScrollbarInContentHeight:Sn(e.ignoreHorizontalScrollbarInContentHeight,this.defaultValue.ignoreHorizontalScrollbarInContentHeight)}}},zT="inUntrustedWorkspace",px={allowedCharacters:"editor.unicodeHighlight.allowedCharacters",invisibleCharacters:"editor.unicodeHighlight.invisibleCharacters",nonBasicASCII:"editor.unicodeHighlight.nonBasicASCII",ambiguousCharacters:"editor.unicodeHighlight.ambiguousCharacters",includeComments:"editor.unicodeHighlight.includeComments",includeStrings:"editor.unicodeHighlight.includeStrings",allowedLocales:"editor.unicodeHighlight.allowedLocales"},nYt=class extends Fu{constructor(){let i={nonBasicASCII:zT,invisibleCharacters:!0,ambiguousCharacters:!0,includeComments:zT,includeStrings:!0,allowedCharacters:{},allowedLocales:{_os:!0,_vscode:!0}};super(142,"unicodeHighlight",i,{[px.nonBasicASCII]:{restricted:!0,type:["boolean","string"],enum:[!0,!1,zT],default:i.nonBasicASCII,description:d(704,null)},[px.invisibleCharacters]:{restricted:!0,type:"boolean",default:i.invisibleCharacters,description:d(703,null)},[px.ambiguousCharacters]:{restricted:!0,type:"boolean",default:i.ambiguousCharacters,description:d(700,null)},[px.includeComments]:{restricted:!0,type:["boolean","string"],enum:[!0,!1,zT],default:i.includeComments,description:d(701,null)},[px.includeStrings]:{restricted:!0,type:["boolean","string"],enum:[!0,!1,zT],default:i.includeStrings,description:d(702,null)},[px.allowedCharacters]:{restricted:!0,type:"object",default:i.allowedCharacters,description:d(698,null),additionalProperties:{type:"boolean"}},[px.allowedLocales]:{restricted:!0,type:"object",additionalProperties:{type:"boolean"},default:i.allowedLocales,description:d(699,null)}})}applyUpdate(i,e){let t=!1;e.allowedCharacters&&i&&(uo(i.allowedCharacters,e.allowedCharacters)||(i={...i,allowedCharacters:e.allowedCharacters},t=!0)),e.allowedLocales&&i&&(uo(i.allowedLocales,e.allowedLocales)||(i={...i,allowedLocales:e.allowedLocales},t=!0));let o=super.applyUpdate(i,e);return t?new nSe(o.newValue,!0):o}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{nonBasicASCII:rSe(e.nonBasicASCII,zT,[!0,!1,zT]),invisibleCharacters:Sn(e.invisibleCharacters,this.defaultValue.invisibleCharacters),ambiguousCharacters:Sn(e.ambiguousCharacters,this.defaultValue.ambiguousCharacters),includeComments:rSe(e.includeComments,zT,[!0,!1,zT]),includeStrings:rSe(e.includeStrings,zT,[!0,!1,zT]),allowedCharacters:this.validateBooleanMap(e.allowedCharacters,this.defaultValue.allowedCharacters),allowedLocales:this.validateBooleanMap(e.allowedLocales,this.defaultValue.allowedLocales)}}validateBooleanMap(i,e){if(typeof i!="object"||!i)return e;let t={};for(let[o,n]of Object.entries(i))n===!0&&(t[o]=!0);return t}},rYt=class extends Fu{constructor(){let i={enabled:!0,mode:"subwordSmart",showToolbar:"onHover",suppressSuggestions:!1,keepOnBlur:!1,fontFamily:"default",syntaxHighlightingEnabled:!0,minShowDelay:0,suppressInSnippetMode:!0,edits:{enabled:!0,showCollapsed:!1,renderSideBySide:"auto",allowCodeShifting:"always",showLongDistanceHint:!0},triggerCommandOnProviderChange:!1,experimental:{suppressInlineSuggestions:"",showOnSuggestConflict:"never",emptyResponseInformation:!0}};super(71,"inlineSuggest",i,{"editor.inlineSuggest.enabled":{type:"boolean",default:i.enabled,description:d(530,null)},"editor.inlineSuggest.showToolbar":{type:"string",default:i.showToolbar,enum:["always","onHover","never"],enumDescriptions:[d(535,null),d(537,null),d(536,null)],description:d(534,null)},"editor.inlineSuggest.syntaxHighlightingEnabled":{type:"boolean",default:i.syntaxHighlightingEnabled,description:d(541,null)},"editor.inlineSuggest.suppressSuggestions":{type:"boolean",default:i.suppressSuggestions,description:d(540,null)},"editor.inlineSuggest.suppressInSnippetMode":{type:"boolean",default:i.suppressInSnippetMode,description:d(539,null)},"editor.inlineSuggest.minShowDelay":{type:"number",default:0,minimum:0,maximum:1e4,description:d(532,null)},"editor.inlineSuggest.experimental.suppressInlineSuggestions":{type:"string",default:i.experimental.suppressInlineSuggestions,tags:["experimental"],description:d(538,null),experiment:{mode:"auto"}},"editor.inlineSuggest.experimental.emptyResponseInformation":{type:"boolean",default:i.experimental.emptyResponseInformation,tags:["experimental"],description:d(529,null),experiment:{mode:"auto"}},"editor.inlineSuggest.triggerCommandOnProviderChange":{type:"boolean",default:i.triggerCommandOnProviderChange,tags:["experimental"],description:d(542,null),experiment:{mode:"auto"}},"editor.inlineSuggest.experimental.showOnSuggestConflict":{type:"string",default:i.experimental.showOnSuggestConflict,tags:["experimental"],enum:["always","never","whenSuggestListIsIncomplete"],description:d(533,null),experiment:{mode:"auto"}},"editor.inlineSuggest.fontFamily":{type:"string",default:i.fontFamily,description:d(531,null)},"editor.inlineSuggest.edits.allowCodeShifting":{type:"string",default:i.edits.allowCodeShifting,description:d(525,null),enum:["always","horizontal","never"],tags:["nextEditSuggestions"]},"editor.inlineSuggest.edits.showLongDistanceHint":{type:"boolean",default:i.edits.showLongDistanceHint,description:d(528,null),tags:["nextEditSuggestions","experimental"]},"editor.inlineSuggest.edits.renderSideBySide":{type:"string",default:i.edits.renderSideBySide,description:d(526,null),enum:["auto","never"],enumDescriptions:[d(428,null),d(429,null)],tags:["nextEditSuggestions"]},"editor.inlineSuggest.edits.showCollapsed":{type:"boolean",default:i.edits.showCollapsed,description:d(527,null),tags:["nextEditSuggestions"]}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{enabled:Sn(e.enabled,this.defaultValue.enabled),mode:Md(e.mode,this.defaultValue.mode,["prefix","subword","subwordSmart"]),showToolbar:Md(e.showToolbar,this.defaultValue.showToolbar,["always","onHover","never"]),suppressSuggestions:Sn(e.suppressSuggestions,this.defaultValue.suppressSuggestions),keepOnBlur:Sn(e.keepOnBlur,this.defaultValue.keepOnBlur),fontFamily:qw.string(e.fontFamily,this.defaultValue.fontFamily),syntaxHighlightingEnabled:Sn(e.syntaxHighlightingEnabled,this.defaultValue.syntaxHighlightingEnabled),minShowDelay:Vc.clampedInt(e.minShowDelay,0,0,1e4),suppressInSnippetMode:Sn(e.suppressInSnippetMode,this.defaultValue.suppressInSnippetMode),edits:this._validateEdits(e.edits),triggerCommandOnProviderChange:Sn(e.triggerCommandOnProviderChange,this.defaultValue.triggerCommandOnProviderChange),experimental:this._validateExperimental(e.experimental)}}_validateEdits(i){if(!i||typeof i!="object")return this.defaultValue.edits;let e=i;return{enabled:Sn(e.enabled,this.defaultValue.edits.enabled),showCollapsed:Sn(e.showCollapsed,this.defaultValue.edits.showCollapsed),allowCodeShifting:Md(e.allowCodeShifting,this.defaultValue.edits.allowCodeShifting,["always","horizontal","never"]),showLongDistanceHint:Sn(e.showLongDistanceHint,this.defaultValue.edits.showLongDistanceHint),renderSideBySide:Md(e.renderSideBySide,this.defaultValue.edits.renderSideBySide,["never","auto"])}}_validateExperimental(i){if(!i||typeof i!="object")return this.defaultValue.experimental;let e=i;return{suppressInlineSuggestions:qw.string(e.suppressInlineSuggestions,this.defaultValue.experimental.suppressInlineSuggestions),showOnSuggestConflict:Md(e.showOnSuggestConflict,this.defaultValue.experimental.showOnSuggestConflict,["always","never","whenSuggestListIsIncomplete"]),emptyResponseInformation:Sn(e.emptyResponseInformation,this.defaultValue.experimental.emptyResponseInformation)}}},sYt=class extends Fu{constructor(){let i={enabled:iv.bracketPairColorizationOptions.enabled,independentColorPoolPerBracketType:iv.bracketPairColorizationOptions.independentColorPoolPerBracketType};super(21,"bracketPairColorization",i,{"editor.bracketPairColorization.enabled":{type:"boolean",default:i.enabled,markdownDescription:d(335,null,"`#workbench.colorCustomizations#`")},"editor.bracketPairColorization.independentColorPoolPerBracketType":{type:"boolean",default:i.independentColorPoolPerBracketType,description:d(336,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{enabled:Sn(e.enabled,this.defaultValue.enabled),independentColorPoolPerBracketType:Sn(e.independentColorPoolPerBracketType,this.defaultValue.independentColorPoolPerBracketType)}}},aYt=class extends Fu{constructor(){let i={bracketPairs:!1,bracketPairsHorizontal:"active",highlightActiveBracketPair:!0,indentation:!0,highlightActiveIndentation:!0};super(22,"guides",i,{"editor.guides.bracketPairs":{type:["boolean","string"],enum:[!0,"active",!1],enumDescriptions:[d(413,null),d(411,null),d(412,null)],default:i.bracketPairs,description:d(410,null)},"editor.guides.bracketPairsHorizontal":{type:["boolean","string"],enum:[!0,"active",!1],enumDescriptions:[d(417,null),d(415,null),d(416,null)],default:i.bracketPairsHorizontal,description:d(414,null)},"editor.guides.highlightActiveBracketPair":{type:"boolean",default:i.highlightActiveBracketPair,description:d(418,null)},"editor.guides.indentation":{type:"boolean",default:i.indentation,description:d(423,null)},"editor.guides.highlightActiveIndentation":{type:["boolean","string"],enum:[!0,"always",!1],enumDescriptions:[d(422,null),d(420,null),d(421,null)],default:i.highlightActiveIndentation,description:d(419,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{bracketPairs:rSe(e.bracketPairs,this.defaultValue.bracketPairs,[!0,!1,"active"]),bracketPairsHorizontal:rSe(e.bracketPairsHorizontal,this.defaultValue.bracketPairsHorizontal,[!0,!1,"active"]),highlightActiveBracketPair:Sn(e.highlightActiveBracketPair,this.defaultValue.highlightActiveBracketPair),indentation:Sn(e.indentation,this.defaultValue.indentation),highlightActiveIndentation:rSe(e.highlightActiveIndentation,this.defaultValue.highlightActiveIndentation,[!0,!1,"always"])}}};function rSe(a,i,e){let t=e.indexOf(a);return t===-1?i:e[t]}var lYt=class extends Fu{constructor(){let i={insertMode:"insert",filterGraceful:!0,snippetsPreventQuickSuggestions:!1,localityBonus:!1,shareSuggestSelections:!1,selectionMode:"always",showIcons:!0,showStatusBar:!1,preview:!1,previewMode:"subwordSmart",showInlineDetails:!0,showMethods:!0,showFunctions:!0,showConstructors:!0,showDeprecated:!0,matchOnWordStartOnly:!0,showFields:!0,showVariables:!0,showClasses:!0,showStructs:!0,showInterfaces:!0,showModules:!0,showProperties:!0,showEvents:!0,showOperators:!0,showUnits:!0,showValues:!0,showConstants:!0,showEnums:!0,showEnumMembers:!0,showKeywords:!0,showWords:!0,showColors:!0,showFiles:!0,showReferences:!0,showFolders:!0,showTypeParameters:!0,showSnippets:!0,showUsers:!0,showIssues:!0};super(134,"suggest",i,{"editor.suggest.insertMode":{type:"string",enum:["insert","replace"],enumDescriptions:[d(670,null),d(672,null)],default:i.insertMode,description:d(668,null)},"editor.suggest.filterGraceful":{type:"boolean",default:i.filterGraceful,description:d(667,null)},"editor.suggest.localityBonus":{type:"boolean",default:i.localityBonus,description:d(675,null)},"editor.suggest.shareSuggestSelections":{type:"boolean",default:i.shareSuggestSelections,markdownDescription:d(679,null)},"editor.suggest.selectionMode":{type:"string",enum:["always","never","whenTriggerCharacter","whenQuickSuggestion"],enumDescriptions:[d(669,null),d(671,null),d(674,null),d(673,null)],default:i.selectionMode,markdownDescription:d(678,null,"`#editor.quickSuggestions#`","`#editor.suggestOnTriggerCharacters#`")},"editor.suggest.snippetsPreventQuickSuggestions":{type:"boolean",default:i.snippetsPreventQuickSuggestions,description:d(683,null)},"editor.suggest.showIcons":{type:"boolean",default:i.showIcons,description:d(680,null)},"editor.suggest.showStatusBar":{type:"boolean",default:i.showStatusBar,description:d(682,null)},"editor.suggest.preview":{type:"boolean",default:i.preview,description:d(677,null)},"editor.suggest.showInlineDetails":{type:"boolean",default:i.showInlineDetails,description:d(681,null)},"editor.suggest.maxVisibleSuggestions":{type:"number",deprecationMessage:d(676,null)},"editor.suggest.filteredTypes":{type:"object",deprecationMessage:d(361,null)},"editor.suggest.showMethods":{type:"boolean",default:!0,markdownDescription:d(454,null)},"editor.suggest.showFunctions":{type:"boolean",default:!0,markdownDescription:d(450,null)},"editor.suggest.showConstructors":{type:"boolean",default:!0,markdownDescription:d(441,null)},"editor.suggest.showDeprecated":{type:"boolean",default:!0,markdownDescription:d(443,null)},"editor.suggest.matchOnWordStartOnly":{type:"boolean",default:!0,markdownDescription:d(437,null)},"editor.suggest.showFields":{type:"boolean",default:!0,markdownDescription:d(447,null)},"editor.suggest.showVariables":{type:"boolean",default:!0,markdownDescription:d(466,null)},"editor.suggest.showClasses":{type:"boolean",default:!0,markdownDescription:d(438,null)},"editor.suggest.showStructs":{type:"boolean",default:!0,markdownDescription:d(460,null)},"editor.suggest.showInterfaces":{type:"boolean",default:!0,markdownDescription:d(451,null)},"editor.suggest.showModules":{type:"boolean",default:!0,markdownDescription:d(455,null)},"editor.suggest.showProperties":{type:"boolean",default:!0,markdownDescription:d(457,null)},"editor.suggest.showEvents":{type:"boolean",default:!0,markdownDescription:d(446,null)},"editor.suggest.showOperators":{type:"boolean",default:!0,markdownDescription:d(456,null)},"editor.suggest.showUnits":{type:"boolean",default:!0,markdownDescription:d(463,null)},"editor.suggest.showValues":{type:"boolean",default:!0,markdownDescription:d(465,null)},"editor.suggest.showConstants":{type:"boolean",default:!0,markdownDescription:d(440,null)},"editor.suggest.showEnums":{type:"boolean",default:!0,markdownDescription:d(445,null)},"editor.suggest.showEnumMembers":{type:"boolean",default:!0,markdownDescription:d(444,null)},"editor.suggest.showKeywords":{type:"boolean",default:!0,markdownDescription:d(453,null)},"editor.suggest.showWords":{type:"boolean",default:!0,markdownDescription:d(461,null)},"editor.suggest.showColors":{type:"boolean",default:!0,markdownDescription:d(439,null)},"editor.suggest.showFiles":{type:"boolean",default:!0,markdownDescription:d(448,null)},"editor.suggest.showReferences":{type:"boolean",default:!0,markdownDescription:d(458,null)},"editor.suggest.showCustomcolors":{type:"boolean",default:!0,markdownDescription:d(442,null)},"editor.suggest.showFolders":{type:"boolean",default:!0,markdownDescription:d(449,null)},"editor.suggest.showTypeParameters":{type:"boolean",default:!0,markdownDescription:d(462,null)},"editor.suggest.showSnippets":{type:"boolean",default:!0,markdownDescription:d(459,null)},"editor.suggest.showUsers":{type:"boolean",default:!0,markdownDescription:d(464,null)},"editor.suggest.showIssues":{type:"boolean",default:!0,markdownDescription:d(452,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{insertMode:Md(e.insertMode,this.defaultValue.insertMode,["insert","replace"]),filterGraceful:Sn(e.filterGraceful,this.defaultValue.filterGraceful),snippetsPreventQuickSuggestions:Sn(e.snippetsPreventQuickSuggestions,this.defaultValue.filterGraceful),localityBonus:Sn(e.localityBonus,this.defaultValue.localityBonus),shareSuggestSelections:Sn(e.shareSuggestSelections,this.defaultValue.shareSuggestSelections),selectionMode:Md(e.selectionMode,this.defaultValue.selectionMode,["always","never","whenQuickSuggestion","whenTriggerCharacter"]),showIcons:Sn(e.showIcons,this.defaultValue.showIcons),showStatusBar:Sn(e.showStatusBar,this.defaultValue.showStatusBar),preview:Sn(e.preview,this.defaultValue.preview),previewMode:Md(e.previewMode,this.defaultValue.previewMode,["prefix","subword","subwordSmart"]),showInlineDetails:Sn(e.showInlineDetails,this.defaultValue.showInlineDetails),showMethods:Sn(e.showMethods,this.defaultValue.showMethods),showFunctions:Sn(e.showFunctions,this.defaultValue.showFunctions),showConstructors:Sn(e.showConstructors,this.defaultValue.showConstructors),showDeprecated:Sn(e.showDeprecated,this.defaultValue.showDeprecated),matchOnWordStartOnly:Sn(e.matchOnWordStartOnly,this.defaultValue.matchOnWordStartOnly),showFields:Sn(e.showFields,this.defaultValue.showFields),showVariables:Sn(e.showVariables,this.defaultValue.showVariables),showClasses:Sn(e.showClasses,this.defaultValue.showClasses),showStructs:Sn(e.showStructs,this.defaultValue.showStructs),showInterfaces:Sn(e.showInterfaces,this.defaultValue.showInterfaces),showModules:Sn(e.showModules,this.defaultValue.showModules),showProperties:Sn(e.showProperties,this.defaultValue.showProperties),showEvents:Sn(e.showEvents,this.defaultValue.showEvents),showOperators:Sn(e.showOperators,this.defaultValue.showOperators),showUnits:Sn(e.showUnits,this.defaultValue.showUnits),showValues:Sn(e.showValues,this.defaultValue.showValues),showConstants:Sn(e.showConstants,this.defaultValue.showConstants),showEnums:Sn(e.showEnums,this.defaultValue.showEnums),showEnumMembers:Sn(e.showEnumMembers,this.defaultValue.showEnumMembers),showKeywords:Sn(e.showKeywords,this.defaultValue.showKeywords),showWords:Sn(e.showWords,this.defaultValue.showWords),showColors:Sn(e.showColors,this.defaultValue.showColors),showFiles:Sn(e.showFiles,this.defaultValue.showFiles),showReferences:Sn(e.showReferences,this.defaultValue.showReferences),showFolders:Sn(e.showFolders,this.defaultValue.showFolders),showTypeParameters:Sn(e.showTypeParameters,this.defaultValue.showTypeParameters),showSnippets:Sn(e.showSnippets,this.defaultValue.showSnippets),showUsers:Sn(e.showUsers,this.defaultValue.showUsers),showIssues:Sn(e.showIssues,this.defaultValue.showIssues)}}},cYt=class extends Fu{constructor(){super(129,"smartSelect",{selectLeadingAndTrailingWhitespace:!0,selectSubwords:!0},{"editor.smartSelect.selectLeadingAndTrailingWhitespace":{description:d(652,null),default:!0,type:"boolean"},"editor.smartSelect.selectSubwords":{description:d(653,null),default:!0,type:"boolean"}})}validate(i){return!i||typeof i!="object"?this.defaultValue:{selectLeadingAndTrailingWhitespace:Sn(i.selectLeadingAndTrailingWhitespace,this.defaultValue.selectLeadingAndTrailingWhitespace),selectSubwords:Sn(i.selectSubwords,this.defaultValue.selectSubwords)}}},dYt=class extends Fu{constructor(){let i=[];super(147,"wordSegmenterLocales",i,{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}],description:d(713,null),type:"array",items:{type:"string"},default:i})}validate(i){if(typeof i=="string"&&(i=[i]),Array.isArray(i)){let e=[];for(let t of i)if(typeof t=="string")try{Intl.Segmenter.supportedLocalesOf(t).length>0&&e.push(t)}catch{}return e}return this.defaultValue}};var uYt=class extends Fu{constructor(){super(155,"wrappingIndent",1,{"editor.wrappingIndent":{type:"string",enum:["none","same","indent","deepIndent"],enumDescriptions:[d(725,null),d(726,null),d(724,null),d(723,null)],description:d(722,null),default:"same"}})}validate(i){switch(i){case"none":return 0;case"same":return 1;case"indent":return 2;case"deepIndent":return 3}return 1}compute(i,e,t){return e.get(2)===2?0:t}},pYt=class extends mU{constructor(){super(166,{isDominatedByLongLines:!1,isWordWrapMinified:!1,isViewportWrapping:!1,wrappingColumn:-1})}compute(i,e,t){let o=e.get(165);return{isDominatedByLongLines:i.isDominatedByLongLines,isWordWrapMinified:o.isWordWrapMinified,isViewportWrapping:o.isViewportWrapping,wrappingColumn:o.wrappingColumn}}},mYt=class extends Fu{constructor(){let i={enabled:!0,showDropSelector:"afterDrop"};super(43,"dropIntoEditor",i,{"editor.dropIntoEditor.enabled":{type:"boolean",default:i.enabled,markdownDescription:d(364,null)},"editor.dropIntoEditor.showDropSelector":{type:"string",markdownDescription:d(365,null),enum:["afterDrop","never"],enumDescriptions:[d(366,null),d(367,null)],default:"afterDrop"}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{enabled:Sn(e.enabled,this.defaultValue.enabled),showDropSelector:Md(e.showDropSelector,this.defaultValue.showDropSelector,["afterDrop","never"])}}},hYt=class extends Fu{constructor(){let i={enabled:!0,showPasteSelector:"afterPaste"};super(97,"pasteAs",i,{"editor.pasteAs.enabled":{type:"boolean",default:i.enabled,markdownDescription:d(599,null)},"editor.pasteAs.showPasteSelector":{type:"string",markdownDescription:d(600,null),enum:["afterPaste","never"],enumDescriptions:[d(601,null),d(602,null)],default:"afterPaste"}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{enabled:Sn(e.enabled,this.defaultValue.enabled),showPasteSelector:Md(e.showPasteSelector,this.defaultValue.showPasteSelector,["afterPaste","never"])}}},hU=[];function Di(a){return hU[a.id]=a,a}var zb={acceptSuggestionOnCommitCharacter:Di(new fs(0,"acceptSuggestionOnCommitCharacter",!0,{markdownDescription:d(310,null)})),acceptSuggestionOnEnter:Di(new Ou(1,"acceptSuggestionOnEnter","on",["on","smart","off"],{markdownEnumDescriptions:["",d(312,null),""],markdownDescription:d(311,null)})),accessibilitySupport:Di(new _7t),accessibilityPageSize:Di(new Vc(3,"accessibilityPageSize",500,1,1073741824,{description:d(313,null),tags:["accessibility"]})),allowOverflow:Di(new fs(4,"allowOverflow",!0)),allowVariableLineHeights:Di(new fs(5,"allowVariableLineHeights",!0,{description:d(320,null)})),allowVariableFonts:Di(new fs(6,"allowVariableFonts",!0,{description:d(318,null)})),allowVariableFontsInAccessibilityMode:Di(new fs(7,"allowVariableFontsInAccessibilityMode",!1,{description:d(319,null),tags:["accessibility"]})),ariaLabel:Di(new qw(8,"ariaLabel",d(467,null))),ariaRequired:Di(new fs(9,"ariaRequired",!1,void 0)),screenReaderAnnounceInlineSuggestion:Di(new fs(12,"screenReaderAnnounceInlineSuggestion",!0,{description:d(631,null),tags:["accessibility"]})),autoClosingBrackets:Di(new Ou(10,"autoClosingBrackets","languageDefined",["always","languageDefined","beforeWhitespace","never"],{enumDescriptions:["",d(370,null),d(369,null),""],description:d(326,null)})),autoClosingComments:Di(new Ou(11,"autoClosingComments","languageDefined",["always","languageDefined","beforeWhitespace","never"],{enumDescriptions:["",d(372,null),d(371,null),""],description:d(327,null)})),autoClosingDelete:Di(new Ou(13,"autoClosingDelete","auto",["always","auto","never"],{enumDescriptions:["",d(373,null),""],description:d(328,null)})),autoClosingOvertype:Di(new Ou(14,"autoClosingOvertype","auto",["always","auto","never"],{enumDescriptions:["",d(374,null),""],description:d(329,null)})),autoClosingQuotes:Di(new Ou(15,"autoClosingQuotes","languageDefined",["always","languageDefined","beforeWhitespace","never"],{enumDescriptions:["",d(376,null),d(375,null),""],description:d(330,null)})),autoIndent:Di(new jre(16,"autoIndent",4,"full",["none","keep","brackets","advanced","full"],tMo,{enumDescriptions:[d(381,null),d(380,null),d(378,null),d(377,null),d(379,null)],description:d(331,null)})),autoIndentOnPaste:Di(new fs(17,"autoIndentOnPaste",!1,{description:d(332,null)})),autoIndentOnPasteWithinString:Di(new fs(18,"autoIndentOnPasteWithinString",!0,{description:d(333,null)})),automaticLayout:Di(new fs(19,"automaticLayout",!1)),autoSurround:Di(new Ou(20,"autoSurround","languageDefined",["languageDefined","quotes","brackets","never"],{enumDescriptions:[d(383,null),d(384,null),d(382,null),""],description:d(334,null)})),bracketPairColorization:Di(new sYt),bracketPairGuides:Di(new aYt),stickyTabStops:Di(new fs(132,"stickyTabStops",!1,{description:d(666,null)})),codeLens:Di(new fs(23,"codeLens",!0,{description:d(337,null)})),codeLensFontFamily:Di(new qw(24,"codeLensFontFamily","",{description:d(338,null)})),codeLensFontSize:Di(new Vc(25,"codeLensFontSize",0,0,100,{type:"number",default:0,minimum:0,maximum:100,markdownDescription:d(339,null)})),colorDecorators:Di(new fs(26,"colorDecorators",!0,{description:d(341,null)})),colorDecoratorActivatedOn:Di(new Ou(168,"colorDecoratorsActivatedOn","clickAndHover",["clickAndHover","hover","click"],{enumDescriptions:[d(386,null),d(387,null),d(385,null)],description:d(340,null)})),colorDecoratorsLimit:Di(new Vc(27,"colorDecoratorsLimit",500,1,1e6,{markdownDescription:d(342,null)})),columnSelection:Di(new fs(28,"columnSelection",!1,{description:d(343,null)})),comments:Di(new D7t),contextmenu:Di(new fs(30,"contextmenu",!0)),copyWithSyntaxHighlighting:Di(new fs(31,"copyWithSyntaxHighlighting",!0,{description:d(346,null)})),cursorBlinking:Di(new jre(32,"cursorBlinking",1,"blink",["blink","smooth","phase","expand","solid"],gYt,{description:d(347,null)})),cursorSmoothCaretAnimation:Di(new Ou(33,"cursorSmoothCaretAnimation","off",["off","explicit","on"],{enumDescriptions:[d(351,null),d(350,null),d(352,null)],description:d(349,null)})),cursorStyle:Di(new jre(34,"cursorStyle",1,"line",["line","block","underline","line-thin","block-outline","underline-thin"],kmt,{description:d(353,null)})),overtypeCursorStyle:Di(new jre(92,"overtypeCursorStyle",2,"block",["line","block","underline","line-thin","block-outline","underline-thin"],kmt,{description:d(592,null)})),cursorSurroundingLines:Di(new Vc(35,"cursorSurroundingLines",0,0,1073741824,{description:d(354,null)})),cursorSurroundingLinesStyle:Di(new Ou(36,"cursorSurroundingLinesStyle","default",["default","all"],{enumDescriptions:[d(357,null),d(356,null)],markdownDescription:d(355,null)})),cursorWidth:Di(new Vc(37,"cursorWidth",0,0,1073741824,{markdownDescription:d(358,null)})),cursorHeight:Di(new Vc(38,"cursorHeight",0,0,1073741824,{markdownDescription:d(348,null)})),disableLayerHinting:Di(new fs(39,"disableLayerHinting",!1)),disableMonospaceOptimizations:Di(new fs(40,"disableMonospaceOptimizations",!1)),domReadOnly:Di(new fs(41,"domReadOnly",!1)),doubleClickSelectsBlock:Di(new fs(173,"doubleClickSelectsBlock",!0,{description:d(362,null)})),dragAndDrop:Di(new fs(42,"dragAndDrop",!0,{description:d(363,null)})),emptySelectionClipboard:Di(new R7t),dropIntoEditor:Di(new mYt),editContext:Di(new fs(44,"editContext",!0,{description:d(368,null),included:XH||dbe||kr})),renderRichScreenReaderContent:Di(new fs(107,"renderRichScreenReaderContent",!1,{markdownDescription:d(622,null)})),stickyScroll:Di(new K7t),experimentalGpuAcceleration:Di(new Ou(46,"experimentalGpuAcceleration","off",["off","on"],{tags:["experimental"],enumDescriptions:[d(471,null),d(472,null)],description:d(470,null)})),experimentalWhitespaceRendering:Di(new Ou(47,"experimentalWhitespaceRendering","svg",["svg","font","off"],{enumDescriptions:[d(476,null),d(474,null),d(475,null)],description:d(473,null)})),extraEditorClassName:Di(new qw(48,"extraEditorClassName","")),fastScrollSensitivity:Di(new qk(49,"fastScrollSensitivity",5,a=>a<=0?5:a,{markdownDescription:d(477,null)})),find:Di(new M7t),fixedOverflowWidgets:Di(new fs(51,"fixedOverflowWidgets",!1)),folding:Di(new fs(52,"folding",!0,{description:d(487,null)})),foldingStrategy:Di(new Ou(53,"foldingStrategy","auto",["auto","indentation"],{enumDescriptions:[d(492,null),d(493,null)],description:d(491,null)})),foldingHighlight:Di(new fs(54,"foldingHighlight",!0,{description:d(488,null)})),foldingImportsByDefault:Di(new fs(55,"foldingImportsByDefault",!1,{description:d(489,null)})),foldingMaximumRegions:Di(new Vc(56,"foldingMaximumRegions",5e3,10,65e3,{description:d(490,null)})),unfoldOnClickAfterEndOfLine:Di(new fs(57,"unfoldOnClickAfterEndOfLine",!1,{description:d(697,null)})),fontFamily:Di(new qw(58,"fontFamily",Yd.fontFamily,{description:d(494,null)})),fontInfo:Di(new A7t),fontLigatures2:Di(new mx),fontSize:Di(new W7t),fontWeight:Di(new V7t),fontVariations:Di(new P7t),formatOnPaste:Di(new fs(64,"formatOnPaste",!1,{description:d(504,null)})),formatOnType:Di(new fs(65,"formatOnType",!1,{description:d(505,null)})),glyphMargin:Di(new fs(66,"glyphMargin",!0,{description:d(506,null)})),gotoLocation:Di(new B7t),hideCursorInOverviewRuler:Di(new fs(68,"hideCursorInOverviewRuler",!1,{description:d(507,null)})),hover:Di(new H7t),inDiffEditor:Di(new fs(70,"inDiffEditor",!1)),inertialScroll:Di(new fs(158,"inertialScroll",!1,{description:d(517,null)})),letterSpacing:Di(new qk(72,"letterSpacing",Yd.letterSpacing,a=>qk.clamp(a,-5,20),{description:d(543,null)})),lightbulb:Di(new z7t),lineDecorationsWidth:Di(new $7t),lineHeight:Di(new q7t),lineNumbers:Di(new eYt),lineNumbersMinChars:Di(new Vc(77,"lineNumbersMinChars",5,1,300)),linkedEditing:Di(new fs(78,"linkedEditing",!1,{description:d(550,null)})),links:Di(new fs(79,"links",!0,{description:d(551,null)})),matchBrackets:Di(new Ou(80,"matchBrackets","always",["always","near","never"],{description:d(552,null)})),minimap:Di(new j7t),mouseStyle:Di(new Ou(82,"mouseStyle","text",["text","default","copy"])),mouseWheelScrollSensitivity:Di(new qk(83,"mouseWheelScrollSensitivity",1,a=>a===0?1:a,{markdownDescription:d(573,null)})),mouseWheelZoom:Di(new fs(84,"mouseWheelZoom",!1,{markdownDescription:it?d(575,null):d(574,null)})),multiCursorMergeOverlapping:Di(new fs(85,"multiCursorMergeOverlapping",!0,{description:d(577,null)})),multiCursorModifier:Di(new jre(86,"multiCursorModifier","altKey","alt",["ctrlCmd","alt"],iMo,{markdownEnumDescriptions:[d(580,null),d(579,null)],markdownDescription:d(578,null)})),mouseMiddleClickAction:Di(new Ou(87,"mouseMiddleClickAction","default",["default","openLink","ctrlLeftClick"],{description:d(572,null)})),multiCursorPaste:Di(new Ou(88,"multiCursorPaste","spread",["spread","full"],{markdownEnumDescriptions:[d(583,null),d(582,null)],markdownDescription:d(581,null)})),multiCursorLimit:Di(new Vc(89,"multiCursorLimit",1e4,1,1e5,{markdownDescription:d(576,null)})),occurrencesHighlight:Di(new Ou(90,"occurrencesHighlight","singleFile",["off","singleFile","multiFile"],{markdownEnumDescriptions:[d(586,null),d(587,null),d(585,null)],markdownDescription:d(584,null)})),occurrencesHighlightDelay:Di(new Vc(91,"occurrencesHighlightDelay",0,0,2e3,{description:d(588,null),tags:["preview"]})),overtypeOnPaste:Di(new fs(93,"overtypeOnPaste",!0,{description:d(593,null)})),overviewRulerBorder:Di(new fs(94,"overviewRulerBorder",!0,{description:d(594,null)})),overviewRulerLanes:Di(new Vc(95,"overviewRulerLanes",3,0,3)),padding:Di(new Q7t),pasteAs:Di(new hYt),parameterHints:Di(new Y7t),peekWidgetDefaultFocus:Di(new Ou(99,"peekWidgetDefaultFocus","tree",["tree","editor"],{enumDescriptions:[d(605,null),d(604,null)],description:d(603,null)})),placeholder:Di(new J7t),definitionLinkOpensInPeek:Di(new fs(101,"definitionLinkOpensInPeek",!1,{description:d(360,null)})),quickSuggestions:Di(new Z7t),quickSuggestionsDelay:Di(new Vc(103,"quickSuggestionsDelay",10,0,1073741824,{description:d(614,null),experiment:{mode:"auto"}})),readOnly:Di(new fs(104,"readOnly",!1)),readOnlyMessage:Di(new iYt),renameOnType:Di(new fs(106,"renameOnType",!1,{description:d(615,null),markdownDeprecationMessage:d(616,null)})),renderControlCharacters:Di(new fs(108,"renderControlCharacters",!0,{description:d(617,null),restricted:!0})),renderFinalNewline:Di(new Ou(109,"renderFinalNewline",Wn?"dimmed":"on",["off","on","dimmed"],{description:d(618,null)})),renderLineHighlight:Di(new Ou(110,"renderLineHighlight","line",["none","gutter","line","all"],{enumDescriptions:["","","",d(620,null)],description:d(619,null)})),renderLineHighlightOnlyWhenFocus:Di(new fs(111,"renderLineHighlightOnlyWhenFocus",!1,{description:d(621,null)})),renderValidationDecorations:Di(new Ou(112,"renderValidationDecorations","editable",["editable","on","off"])),renderWhitespace:Di(new Ou(113,"renderWhitespace","selection",["none","boundary","selection","trailing","all"],{enumDescriptions:["",d(624,null),d(625,null),d(626,null),""],description:d(623,null)})),revealHorizontalRightPadding:Di(new Vc(114,"revealHorizontalRightPadding",15,0,1e3)),roundedSelection:Di(new fs(115,"roundedSelection",!0,{description:d(627,null)})),rulers:Di(new tYt),scrollbar:Di(new oYt),scrollBeyondLastColumn:Di(new Vc(118,"scrollBeyondLastColumn",4,0,1073741824,{description:d(644,null)})),scrollBeyondLastLine:Di(new fs(119,"scrollBeyondLastLine",!0,{description:d(645,null)})),scrollOnMiddleClick:Di(new fs(171,"scrollOnMiddleClick",!1,{description:d(646,null)})),scrollPredominantAxis:Di(new fs(120,"scrollPredominantAxis",!0,{description:d(647,null)})),selectionClipboard:Di(new fs(121,"selectionClipboard",!0,{description:d(648,null),included:Wn})),selectionHighlight:Di(new fs(122,"selectionHighlight",!0,{description:d(649,null)})),selectionHighlightMaxLength:Di(new Vc(123,"selectionHighlightMaxLength",200,0,1073741824,{description:d(650,null)})),selectionHighlightMultiline:Di(new fs(124,"selectionHighlightMultiline",!1,{description:d(651,null)})),selectOnLineNumbers:Di(new fs(125,"selectOnLineNumbers",!0)),showFoldingControls:Di(new Ou(126,"showFoldingControls","mouseover",["always","never","mouseover"],{enumDescriptions:[d(656,null),d(658,null),d(657,null)],description:d(655,null)})),showUnused:Di(new fs(127,"showUnused",!0,{description:d(659,null)})),showDeprecated:Di(new fs(157,"showDeprecated",!0,{description:d(654,null)})),inlayHints:Di(new G7t),snippetSuggestions:Di(new Ou(128,"snippetSuggestions","inline",["top","bottom","inline","none"],{enumDescriptions:[d(665,null),d(662,null),d(663,null),d(664,null)],description:d(661,null)})),smartSelect:Di(new cYt),smoothScrolling:Di(new fs(130,"smoothScrolling",!1,{description:d(660,null)})),stopRenderingLineAfter:Di(new Vc(133,"stopRenderingLineAfter",1e4,-1,1073741824)),suggest:Di(new lYt),inlineSuggest:Di(new rYt),inlineCompletionsAccessibilityVerbose:Di(new fs(169,"inlineCompletionsAccessibilityVerbose",!1,{description:d(524,null)})),suggestFontSize:Di(new Vc(135,"suggestFontSize",0,0,1e3,{markdownDescription:d(684,null,"`0`","`#editor.fontSize#`")})),suggestLineHeight:Di(new Vc(136,"suggestLineHeight",0,0,1e3,{markdownDescription:d(685,null,"`0`","`#editor.lineHeight#`")})),suggestOnTriggerCharacters:Di(new fs(137,"suggestOnTriggerCharacters",!0,{description:d(686,null)})),suggestSelection:Di(new Ou(138,"suggestSelection","first",["first","recentlyUsed","recentlyUsedByPrefix"],{markdownEnumDescriptions:[d(688,null),d(689,null),d(690,null)],description:d(687,null)})),tabCompletion:Di(new Ou(139,"tabCompletion","off",["on","off","onlySnippets"],{enumDescriptions:[d(693,null),d(692,null),d(694,null)],description:d(691,null)})),tabIndex:Di(new Vc(140,"tabIndex",0,-1,1073741824)),trimWhitespaceOnDelete:Di(new fs(141,"trimWhitespaceOnDelete",!1,{description:d(696,null)})),unicodeHighlight:Di(new nYt),unusualLineTerminators:Di(new Ou(143,"unusualLineTerminators","prompt",["auto","off","prompt"],{enumDescriptions:[d(706,null),d(707,null),d(708,null)],description:d(705,null)})),useShadowDOM:Di(new fs(144,"useShadowDOM",!0)),useTabStops:Di(new fs(145,"useTabStops",!0,{description:d(709,null)})),wordBreak:Di(new Ou(146,"wordBreak","normal",["normal","keepAll"],{markdownEnumDescriptions:[d(712,null),d(711,null)],description:d(710,null)})),wordSegmenterLocales:Di(new dYt),wordSeparators:Di(new qw(148,"wordSeparators",tW,{description:d(714,null)})),wordWrap:Di(new Ou(149,"wordWrap","off",["off","on","wordWrapColumn","bounded"],{markdownEnumDescriptions:[d(717,null),d(718,null),d(719,null),d(716,null)],description:d(715,null)})),wordWrapBreakAfterCharacters:Di(new qw(150,"wordWrapBreakAfterCharacters"," })]?|/&.,;\xA2\xB0\u2032\u2033\u2030\u2103\u3001\u3002\uFF61\uFF64\uFFE0\uFF0C\uFF0E\uFF1A\uFF1B\uFF1F\uFF01\uFF05\u30FB\uFF65\u309D\u309E\u30FD\u30FE\u30FC\u30A1\u30A3\u30A5\u30A7\u30A9\u30C3\u30E3\u30E5\u30E7\u30EE\u30F5\u30F6\u3041\u3043\u3045\u3047\u3049\u3063\u3083\u3085\u3087\u308E\u3095\u3096\u31F0\u31F1\u31F2\u31F3\u31F4\u31F5\u31F6\u31F7\u31F8\u31F9\u31FA\u31FB\u31FC\u31FD\u31FE\u31FF\u3005\u303B\uFF67\uFF68\uFF69\uFF6A\uFF6B\uFF6C\uFF6D\uFF6E\uFF6F\uFF70\u201D\u3009\u300B\u300D\u300F\u3011\u3015\uFF09\uFF3D\uFF5D\uFF63")),wordWrapBreakBeforeCharacters:Di(new qw(151,"wordWrapBreakBeforeCharacters","([{\u2018\u201C\u3008\u300A\u300C\u300E\u3010\u3014\uFF08\uFF3B\uFF5B\uFF62\xA3\xA5\uFF04\uFFE1\uFFE5+\uFF0B")),wordWrapColumn:Di(new Vc(152,"wordWrapColumn",80,1,1073741824,{markdownDescription:d(720,null)})),wordWrapOverride1:Di(new Ou(153,"wordWrapOverride1","inherit",["off","on","inherit"])),wordWrapOverride2:Di(new Ou(154,"wordWrapOverride2","inherit",["off","on","inherit"])),wrapOnEscapedLineFeeds:Di(new fs(160,"wrapOnEscapedLineFeeds",!1,{markdownDescription:d(721,null)})),effectiveCursorStyle:Di(new N7t),editorClassName:Di(new L7t),defaultColorDecorators:Di(new Ou(167,"defaultColorDecorators","auto",["auto","always","never"],{enumDescriptions:[d(389,null),d(388,null),d(390,null)],description:d(359,null)})),pixelRatio:Di(new X7t),tabFocusMode:Di(new fs(164,"tabFocusMode",!1,{markdownDescription:d(695,null)})),layoutInfo:Di(new QGe),wrappingInfo:Di(new pYt),wrappingIndent:Di(new uYt),wrappingStrategy:Di(new U7t),effectiveEditContextEnabled:Di(new O7t),effectiveAllowVariableFonts:Di(new F7t)};var z=class a{constructor(i,e,t,o){i>t||i===t&&e>o?(this.startLineNumber=t,this.startColumn=o,this.endLineNumber=i,this.endColumn=e):(this.startLineNumber=i,this.startColumn=e,this.endLineNumber=t,this.endColumn=o)}isEmpty(){return a.isEmpty(this)}static isEmpty(i){return i.startLineNumber===i.endLineNumber&&i.startColumn===i.endColumn}containsPosition(i){return a.containsPosition(this,i)}static containsPosition(i,e){return!(e.lineNumber<i.startLineNumber||e.lineNumber>i.endLineNumber||e.lineNumber===i.startLineNumber&&e.column<i.startColumn||e.lineNumber===i.endLineNumber&&e.column>i.endColumn)}static strictContainsPosition(i,e){return!(e.lineNumber<i.startLineNumber||e.lineNumber>i.endLineNumber||e.lineNumber===i.startLineNumber&&e.column<=i.startColumn||e.lineNumber===i.endLineNumber&&e.column>=i.endColumn)}containsRange(i){return a.containsRange(this,i)}static containsRange(i,e){return!(e.startLineNumber<i.startLineNumber||e.endLineNumber<i.startLineNumber||e.startLineNumber>i.endLineNumber||e.endLineNumber>i.endLineNumber||e.startLineNumber===i.startLineNumber&&e.startColumn<i.startColumn||e.endLineNumber===i.endLineNumber&&e.endColumn>i.endColumn)}strictContainsRange(i){return a.strictContainsRange(this,i)}static strictContainsRange(i,e){return!(e.startLineNumber<i.startLineNumber||e.endLineNumber<i.startLineNumber||e.startLineNumber>i.endLineNumber||e.endLineNumber>i.endLineNumber||e.startLineNumber===i.startLineNumber&&e.startColumn<=i.startColumn||e.endLineNumber===i.endLineNumber&&e.endColumn>=i.endColumn)}plusRange(i){return a.plusRange(this,i)}static plusRange(i,e){let t,o,n,r;return e.startLineNumber<i.startLineNumber?(t=e.startLineNumber,o=e.startColumn):e.startLineNumber===i.startLineNumber?(t=e.startLineNumber,o=Math.min(e.startColumn,i.startColumn)):(t=i.startLineNumber,o=i.startColumn),e.endLineNumber>i.endLineNumber?(n=e.endLineNumber,r=e.endColumn):e.endLineNumber===i.endLineNumber?(n=e.endLineNumber,r=Math.max(e.endColumn,i.endColumn)):(n=i.endLineNumber,r=i.endColumn),new a(t,o,n,r)}intersectRanges(i){return a.intersectRanges(this,i)}static intersectRanges(i,e){let t=i.startLineNumber,o=i.startColumn,n=i.endLineNumber,r=i.endColumn,s=e.startLineNumber,l=e.startColumn,c=e.endLineNumber,u=e.endColumn;return t<s?(t=s,o=l):t===s&&(o=Math.max(o,l)),n>c?(n=c,r=u):n===c&&(r=Math.min(r,u)),t>n||t===n&&o>r?null:new a(t,o,n,r)}equalsRange(i){return a.equalsRange(this,i)}static equalsRange(i,e){return!i&&!e?!0:!!i&&!!e&&i.startLineNumber===e.startLineNumber&&i.startColumn===e.startColumn&&i.endLineNumber===e.endLineNumber&&i.endColumn===e.endColumn}getEndPosition(){return a.getEndPosition(this)}static getEndPosition(i){return new Ie(i.endLineNumber,i.endColumn)}getStartPosition(){return a.getStartPosition(this)}static getStartPosition(i){return new Ie(i.startLineNumber,i.startColumn)}toString(){return"["+this.startLineNumber+","+this.startColumn+" -> "+this.endLineNumber+","+this.endColumn+"]"}setEndPosition(i,e){return new a(this.startLineNumber,this.startColumn,i,e)}setStartPosition(i,e){return new a(i,e,this.endLineNumber,this.endColumn)}collapseToStart(){return a.collapseToStart(this)}static collapseToStart(i){return new a(i.startLineNumber,i.startColumn,i.startLineNumber,i.startColumn)}collapseToEnd(){return a.collapseToEnd(this)}static collapseToEnd(i){return new a(i.endLineNumber,i.endColumn,i.endLineNumber,i.endColumn)}delta(i){return new a(this.startLineNumber+i,this.startColumn,this.endLineNumber+i,this.endColumn)}isSingleLine(){return this.startLineNumber===this.endLineNumber}static fromPositions(i,e=i){return new a(i.lineNumber,i.column,e.lineNumber,e.column)}static lift(i){return i?new a(i.startLineNumber,i.startColumn,i.endLineNumber,i.endColumn):null}static isIRange(i){return!!i&&typeof i.startLineNumber=="number"&&typeof i.startColumn=="number"&&typeof i.endLineNumber=="number"&&typeof i.endColumn=="number"}static areIntersectingOrTouching(i,e){return!(i.endLineNumber<e.startLineNumber||i.endLineNumber===e.startLineNumber&&i.endColumn<e.startColumn||e.endLineNumber<i.startLineNumber||e.endLineNumber===i.startLineNumber&&e.endColumn<i.startColumn)}static areIntersecting(i,e){return!(i.endLineNumber<e.startLineNumber||i.endLineNumber===e.startLineNumber&&i.endColumn<=e.startColumn||e.endLineNumber<i.startLineNumber||e.endLineNumber===i.startLineNumber&&e.endColumn<=i.startColumn)}static areOnlyIntersecting(i,e){return!(i.endLineNumber<e.startLineNumber-1||i.endLineNumber===e.startLineNumber&&i.endColumn<e.startColumn-1||e.endLineNumber<i.startLineNumber-1||e.endLineNumber===i.startLineNumber&&e.endColumn<i.startColumn-1)}static compareRangesUsingStarts(i,e){if(i&&e){let n=i.startLineNumber|0,r=e.startLineNumber|0;if(n===r){let s=i.startColumn|0,l=e.startColumn|0;if(s===l){let c=i.endLineNumber|0,u=e.endLineNumber|0;if(c===u){let p=i.endColumn|0,h=e.endColumn|0;return p-h}return c-u}return s-l}return n-r}return(i?1:0)-(e?1:0)}static compareRangesUsingEnds(i,e){return i.endLineNumber===e.endLineNumber?i.endColumn===e.endColumn?i.startLineNumber===e.startLineNumber?i.startColumn-e.startColumn:i.startLineNumber-e.startLineNumber:i.endColumn-e.endColumn:i.endLineNumber-e.endLineNumber}static spansMultipleLines(i){return i.endLineNumber>i.startLineNumber}toJSON(){return this}};var Yt=class a extends z{constructor(i,e,t,o){super(i,e,t,o),this.selectionStartLineNumber=i,this.selectionStartColumn=e,this.positionLineNumber=t,this.positionColumn=o}toString(){return"["+this.selectionStartLineNumber+","+this.selectionStartColumn+" -> "+this.positionLineNumber+","+this.positionColumn+"]"}equalsSelection(i){return a.selectionsEqual(this,i)}static selectionsEqual(i,e){return i.selectionStartLineNumber===e.selectionStartLineNumber&&i.selectionStartColumn===e.selectionStartColumn&&i.positionLineNumber===e.positionLineNumber&&i.positionColumn===e.positionColumn}getDirection(){return this.selectionStartLineNumber===this.startLineNumber&&this.selectionStartColumn===this.startColumn?0:1}setEndPosition(i,e){return this.getDirection()===0?new a(this.startLineNumber,this.startColumn,i,e):new a(i,e,this.startLineNumber,this.startColumn)}getPosition(){return new Ie(this.positionLineNumber,this.positionColumn)}getSelectionStart(){return new Ie(this.selectionStartLineNumber,this.selectionStartColumn)}setStartPosition(i,e){return this.getDirection()===0?new a(i,e,this.endLineNumber,this.endColumn):new a(this.endLineNumber,this.endColumn,i,e)}static fromPositions(i,e=i){return new a(i.lineNumber,i.column,e.lineNumber,e.column)}static fromRange(i,e){return e===0?new a(i.startLineNumber,i.startColumn,i.endLineNumber,i.endColumn):new a(i.endLineNumber,i.endColumn,i.startLineNumber,i.startColumn)}static liftSelection(i){return new a(i.selectionStartLineNumber,i.selectionStartColumn,i.positionLineNumber,i.positionColumn)}static selectionsArrEqual(i,e){if(i&&!e||!i&&e)return!1;if(!i&&!e)return!0;if(i.length!==e.length)return!1;for(let t=0,o=i.length;t<o;t++)if(!this.selectionsEqual(i[t],e[t]))return!1;return!0}static isISelection(i){return!!i&&typeof i.selectionStartLineNumber=="number"&&typeof i.selectionStartColumn=="number"&&typeof i.positionLineNumber=="number"&&typeof i.positionColumn=="number"}static createWithDirection(i,e,t,o,n){return n===0?new a(i,e,t,o):new a(t,o,i,e)}};var Qu=class{static getLanguageId(i){return(i&255)>>>0}static getTokenType(i){return(i&768)>>>8}static containsBalancedBrackets(i){return(i&1024)!==0}static getFontStyle(i){return(i&30720)>>>11}static getForeground(i){return(i&16744448)>>>15}static getBackground(i){return(i&4278190080)>>>24}static getClassNameFromMetadata(i){let t="mtk"+this.getForeground(i),o=this.getFontStyle(i);return o&1&&(t+=" mtki"),o&2&&(t+=" mtkb"),o&4&&(t+=" mtku"),o&8&&(t+=" mtks"),t}static getInlineStyleFromMetadata(i,e){let t=this.getForeground(i),o=this.getFontStyle(i),n=`color: ${e[t]};`;o&1&&(n+="font-style: italic;"),o&2&&(n+="font-weight: bold;");let r="";return o&4&&(r+=" underline"),o&8&&(r+=" line-through"),r&&(n+=`text-decoration:${r};`),n}static getPresentationFromMetadata(i){let e=this.getForeground(i),t=this.getFontStyle(i);return{foreground:e,italic:!!(t&1),bold:!!(t&2),underline:!!(t&4),strikethrough:!!(t&8)}}};function gU(a,i){let e=a.getCount(),t=a.findTokenIndexAtOffset(i),o=a.getLanguageId(t),n=t;for(;n+1<e&&a.getLanguageId(n+1)===o;)n++;let r=t;for(;r>0&&a.getLanguageId(r-1)===o;)r--;return new fYt(a,o,r,n+1,a.getStartOffset(r),a.getEndOffset(n))}var fYt=class{constructor(i,e,t,o,n,r){this._scopedLineTokensBrand=void 0;this._actual=i,this.languageId=e,this._firstTokenIndex=t,this._lastTokenIndex=o,this.firstCharOffset=n,this._lastCharOffset=r,this.languageIdCodec=i.languageIdCodec}getLineContent(){return this._actual.getLineContent().substring(this.firstCharOffset,this._lastCharOffset)}getLineLength(){return this._lastCharOffset-this.firstCharOffset}getActualLineContentBefore(i){return this._actual.getLineContent().substring(0,this.firstCharOffset+i)}getTokenCount(){return this._lastTokenIndex-this._firstTokenIndex}findTokenIndexAtOffset(i){return this._actual.findTokenIndexAtOffset(i+this.firstCharOffset)-this._firstTokenIndex}getStandardTokenType(i){return this._actual.getStandardTokenType(i+this._firstTokenIndex)}toIViewLineTokens(){return this._actual.sliceAndInflate(this.firstCharOffset,this._lastCharOffset,0)}},gKi=(i=>(i[i.value=3]="value",i))(gKi||{});function IN(a){return(a&gKi.value)!==0}var al=class a{static _nextVisibleColumn(i,e,t){return i===9?a.nextRenderTabStop(e,t):AT(i)||mGe(i)?e+2:e+1}static visibleColumnFromColumn(i,e,t){let o=Math.min(e-1,i.length),n=i.substring(0,o),r=new d$(n),s=0;for(;!r.eol();){let l=Ebe(n,o,r.offset);r.nextGraphemeLength(),s=this._nextVisibleColumn(l,s,t)}return s}static toStatusbarColumn(i,e,t){let o=i.substring(0,Math.min(e-1,i.length)),n=new yre(o),r=0;for(;!n.eol();)n.nextCodePoint()===9?r=a.nextRenderTabStop(r,t):r=r+1;return r+1}static columnFromVisibleColumn(i,e,t){if(e<=0)return 1;let o=i.length,n=new d$(i),r=0,s=1;for(;!n.eol();){let l=Ebe(i,o,n.offset);n.nextGraphemeLength();let c=this._nextVisibleColumn(l,r,t),u=n.offset+1;if(c>=e){let p=e-r;return c-e<p?u:s}r=c,s=u}return o+1}static nextRenderTabStop(i,e){return i+e-i%e}static nextIndentTabStop(i,e){return a.nextRenderTabStop(i,e)}static prevRenderTabStop(i,e){return Math.max(0,i-1-(i-1)%e)}static prevIndentTabStop(i,e){return a.prevRenderTabStop(i,e)}};function rMo(a,i,e){let t=0;for(let n=0;n<a.length;n++)a.charAt(n)===" "?t=al.nextIndentTabStop(t,i):t++;let o="";if(!e){let n=Math.floor(t/i);t=t%i;for(let r=0;r<n;r++)o+=" "}for(let n=0;n<t;n++)o+=" ";return o}function sSe(a,i,e){let t=Ap(a);return t===-1&&(t=a.length),rMo(a.substring(0,t),i,e)+a.substring(t)}var vYt=class{constructor(){this._inputMode="insert";this._onDidChangeInputMode=new E;this.onDidChangeInputMode=this._onDidChangeInputMode.event}getInputMode(){return this._inputMode}setInputMode(i){this._inputMode=i,this._onDidChangeInputMode.fire(this._inputMode)}},nW=new vYt;var sMo=()=>!0,aMo=()=>!1,lMo=a=>a===" "||a===" ",rW=class{constructor(i,e,t,o){this.languageConfigurationService=o;this._cursorMoveConfigurationBrand=void 0;this._languageId=i;let n=t.options,r=n.get(165),s=n.get(59);this.readOnly=n.get(104),this.tabSize=e.tabSize,this.indentSize=e.indentSize,this.insertSpaces=e.insertSpaces,this.stickyTabStops=n.get(132),this.lineHeight=s.lineHeight,this.typicalHalfwidthCharacterWidth=s.typicalHalfwidthCharacterWidth,this.pageSize=Math.max(1,Math.floor(r.height/this.lineHeight)-2),this.useTabStops=n.get(145),this.trimWhitespaceOnDelete=n.get(141),this.wordSeparators=n.get(148),this.emptySelectionClipboard=n.get(45),this.copyWithSyntaxHighlighting=n.get(31),this.multiCursorMergeOverlapping=n.get(85),this.multiCursorPaste=n.get(88),this.multiCursorLimit=n.get(89),this.autoClosingBrackets=n.get(10),this.autoClosingComments=n.get(11),this.autoClosingQuotes=n.get(15),this.autoClosingDelete=n.get(13),this.autoClosingOvertype=n.get(14),this.autoSurround=n.get(20),this.autoIndent=n.get(16),this.wordSegmenterLocales=n.get(147),this.overtypeOnPaste=n.get(93),this.surroundingPairs={},this._electricChars=null,this.shouldAutoCloseBefore={quote:this._getShouldAutoClose(i,this.autoClosingQuotes,!0),comment:this._getShouldAutoClose(i,this.autoClosingComments,!1),bracket:this._getShouldAutoClose(i,this.autoClosingBrackets,!1)},this.autoClosingPairs=this.languageConfigurationService.getLanguageConfiguration(i).getAutoClosingPairs();let l=this.languageConfigurationService.getLanguageConfiguration(i).getSurroundingPairs();if(l)for(let u of l)this.surroundingPairs[u.open]=u.close;let c=this.languageConfigurationService.getLanguageConfiguration(i).comments;this.blockCommentStartToken=c?.blockCommentStartToken??null}static shouldRecreate(i){return i.hasChanged(165)||i.hasChanged(148)||i.hasChanged(45)||i.hasChanged(85)||i.hasChanged(88)||i.hasChanged(89)||i.hasChanged(10)||i.hasChanged(11)||i.hasChanged(15)||i.hasChanged(13)||i.hasChanged(14)||i.hasChanged(20)||i.hasChanged(145)||i.hasChanged(141)||i.hasChanged(59)||i.hasChanged(104)||i.hasChanged(147)||i.hasChanged(93)}get electricChars(){if(!this._electricChars){this._electricChars={};let i=this.languageConfigurationService.getLanguageConfiguration(this._languageId).electricCharacter?.getElectricCharacters();if(i)for(let e of i)this._electricChars[e]=!0}return this._electricChars}get inputMode(){return nW.getInputMode()}onElectricCharacter(i,e,t){let o=gU(e,t-1),n=this.languageConfigurationService.getLanguageConfiguration(o.languageId).electricCharacter;return n?n.onElectricCharacter(i,o,t-o.firstCharOffset):null}normalizeIndentation(i){return sSe(i,this.indentSize,this.insertSpaces)}_getShouldAutoClose(i,e,t){switch(e){case"beforeWhitespace":return lMo;case"languageDefined":return this._getLanguageDefinedShouldAutoClose(i,t);case"always":return sMo;case"never":return aMo}}_getLanguageDefinedShouldAutoClose(i,e){let t=this.languageConfigurationService.getLanguageConfiguration(i).getAutoCloseBeforeSet(e);return o=>t.indexOf(o)!==-1}visibleColumnFromColumn(i,e){return al.visibleColumnFromColumn(i.getLineContent(e.lineNumber),e.column,this.tabSize)}columnFromVisibleColumn(i,e,t){let o=al.columnFromVisibleColumn(i.getLineContent(e),t,this.tabSize),n=i.getLineMinColumn(e);if(o<n)return n;let r=i.getLineMaxColumn(e);return o>r?r:o}},Ps=class a{constructor(i,e){this._cursorStateBrand=void 0;this.modelState=i,this.viewState=e}static fromModelState(i){return new bYt(i)}static fromViewState(i){return new SYt(i)}static fromModelSelection(i){let e=Yt.liftSelection(i),t=new ov(z.fromPositions(e.getSelectionStart()),0,0,e.getPosition(),0);return a.fromModelState(t)}static fromModelSelections(i){let e=[];for(let t=0,o=i.length;t<o;t++)e[t]=this.fromModelSelection(i[t]);return e}equals(i){return this.viewState.equals(i.viewState)&&this.modelState.equals(i.modelState)}},bYt=class{constructor(i){this.modelState=i,this.viewState=null}},SYt=class{constructor(i){this.modelState=null,this.viewState=i}};var ov=class a{constructor(i,e,t,o,n){this.selectionStart=i;this.selectionStartKind=e;this.selectionStartLeftoverVisibleColumns=t;this.position=o;this.leftoverVisibleColumns=n;this._singleCursorStateBrand=void 0;this.selection=a._computeSelection(this.selectionStart,this.position)}equals(i){return this.selectionStartLeftoverVisibleColumns===i.selectionStartLeftoverVisibleColumns&&this.leftoverVisibleColumns===i.leftoverVisibleColumns&&this.selectionStartKind===i.selectionStartKind&&this.position.equals(i.position)&&this.selectionStart.equalsRange(i.selectionStart)}hasSelection(){return!this.selection.isEmpty()||!this.selectionStart.isEmpty()}move(i,e,t,o){return i?new a(this.selectionStart,this.selectionStartKind,this.selectionStartLeftoverVisibleColumns,new Ie(e,t),o):new a(new z(e,t,e,t),0,o,new Ie(e,t),o)}static _computeSelection(i,e){return i.isEmpty()||!e.isBeforeOrEqual(i.getStartPosition())?Yt.fromPositions(i.getStartPosition(),e):Yt.fromPositions(i.getEndPosition(),e)}},Yv=class{constructor(i,e,t){this._editOperationResultBrand=void 0;this.type=i,this.commands=e,this.shouldPushStackElementBefore=t.shouldPushStackElementBefore,this.shouldPushStackElementAfter=t.shouldPushStackElementAfter}};function sW(a){return a==="'"||a==='"'||a==="`"}var V6=class a{static columnSelect(i,e,t,o,n,r){let s=Math.abs(n-t)+1,l=t>n,c=o>r,u=o<r,p=[];for(let h=0;h<s;h++){let g=t+(l?-h:h),f=i.columnFromVisibleColumn(e,g,o),v=i.columnFromVisibleColumn(e,g,r),b=i.visibleColumnFromColumn(e,new Ie(g,f)),S=i.visibleColumnFromColumn(e,new Ie(g,v));u&&(b>r||S<o)||c&&(S>o||b<r)||p.push(new ov(new z(g,f,g,f),0,0,new Ie(g,v),0))}if(p.length===0)for(let h=0;h<s;h++){let g=t+(l?-h:h),f=e.getLineMaxColumn(g);p.push(new ov(new z(g,f,g,f),0,0,new Ie(g,f),0))}return{viewStates:p,reversed:l,fromLineNumber:t,fromVisualColumn:o,toLineNumber:n,toVisualColumn:r}}static columnSelectLeft(i,e,t){let o=t.toViewVisualColumn;return o>0&&o--,a.columnSelect(i,e,t.fromViewLineNumber,t.fromViewVisualColumn,t.toViewLineNumber,o)}static columnSelectRight(i,e,t){let o=0,n=Math.min(t.fromViewLineNumber,t.toViewLineNumber),r=Math.max(t.fromViewLineNumber,t.toViewLineNumber);for(let l=n;l<=r;l++){let c=e.getLineMaxColumn(l),u=i.visibleColumnFromColumn(e,new Ie(l,c));o=Math.max(o,u)}let s=t.toViewVisualColumn;return s<o&&s++,this.columnSelect(i,e,t.fromViewLineNumber,t.fromViewVisualColumn,t.toViewLineNumber,s)}static columnSelectUp(i,e,t,o){let n=o?i.pageSize:1,r=Math.max(1,t.toViewLineNumber-n);return this.columnSelect(i,e,t.fromViewLineNumber,t.fromViewVisualColumn,r,t.toViewVisualColumn)}static columnSelectDown(i,e,t,o){let n=o?i.pageSize:1,r=Math.min(e.getLineCount(),t.toViewLineNumber+n);return this.columnSelect(i,e,t.fromViewLineNumber,t.fromViewVisualColumn,r,t.toViewVisualColumn)}};var Wh=class{constructor(i,e,t=!1){this._range=i,this._text=e,this.insertsAutoWhitespace=t}getEditOperations(i,e){e.addTrackedEditOperation(this._range,this._text)}computeCursorState(i,e){let o=e.getInverseEditOperations()[0].range;return Yt.fromPositions(o.getEndPosition())}},aSe=class{constructor(i,e,t=!1){this._range=i,this._text=e,this.insertsAutoWhitespace=t}getEditOperations(i,e){let t=this._range.getStartPosition(),o=this._range.getEndPosition(),n=o.lineNumber,r=this._text.length+(this._range.isEmpty()?0:-1),s=fKi(i,o,r);s.lineNumber>n&&(s=new Ie(n,i.getLineMaxColumn(n)));let l=z.fromPositions(t,s);e.addTrackedEditOperation(l,this._text)}computeCursorState(i,e){let o=e.getInverseEditOperations()[0].range;return Yt.fromPositions(o.getEndPosition())}},_mt=class{constructor(i,e){this._range=i,this._text=e}getEditOperations(i,e){e.addTrackedEditOperation(this._range,this._text)}computeCursorState(i,e){let o=e.getInverseEditOperations()[0].range;return Yt.fromRange(o,0)}},Xre=class{constructor(i,e,t=!1){this._range=i,this._text=e,this.insertsAutoWhitespace=t}getEditOperations(i,e){e.addTrackedEditOperation(this._range,this._text)}computeCursorState(i,e){let o=e.getInverseEditOperations()[0].range;return Yt.fromPositions(o.getStartPosition())}},Jre=class{constructor(i,e,t,o,n=!1){this._range=i,this._text=e,this._columnDeltaOffset=o,this._lineNumberDeltaOffset=t,this.insertsAutoWhitespace=n}getEditOperations(i,e){e.addTrackedEditOperation(this._range,this._text)}computeCursorState(i,e){let o=e.getInverseEditOperations()[0].range;return Yt.fromPositions(o.getEndPosition().delta(this._lineNumberDeltaOffset,this._columnDeltaOffset))}},Dmt=class{constructor(i){this._range=i}getEditOperations(i,e){let t=i.getValueInRange(this._range),o=this._range.getEndPosition(),n=o.lineNumber,r=fKi(i,o,t.length);r.lineNumber>n&&(r=new Ie(n,i.getLineMaxColumn(n)));let s=z.fromPositions(o,r);e.addTrackedEditOperation(s,"")}computeCursorState(i,e){let o=e.getInverseEditOperations()[0].range;return Yt.fromPositions(o.getEndPosition())}},B6=class{constructor(i,e,t,o=!1){this._range=i,this._text=e,this._initialSelection=t,this._forceMoveMarkers=o,this._selectionId=null}getEditOperations(i,e){e.addTrackedEditOperation(this._range,this._text,this._forceMoveMarkers),this._selectionId=e.trackSelection(this._initialSelection)}computeCursorState(i,e){return e.getTrackedSelection(this._selectionId)}};function fKi(a,i,e){if(e<0)throw new Error("Unexpected negative delta");let t=a.getLineCount(),o=new Ie(t,a.getLineMaxColumn(t));for(let n=i.lineNumber;n<=t;n++)if(n===i.lineNumber){let r=e-a.getLineMaxColumn(i.lineNumber)+i.column;if(r<=0){o=new Ie(i.lineNumber,i.column+e);break}e=r}else{let r=e-a.getLineMaxColumn(n);if(r<=0){o=new Ie(n,e);break}e=r}return o}var Zre=class a{static whitespaceVisibleColumn(i,e,t){let o=i.length,n=0,r=-1,s=-1;for(let l=0;l<o;l++){if(l===e)return[r,s,n];switch(n%t===0&&(r=l,s=n),i.charCodeAt(l)){case 32:n+=1;break;case 9:n=al.nextRenderTabStop(n,t);break;default:return[-1,-1,-1]}}return e===o?[r,s,n]:[-1,-1,-1]}static atomicPosition(i,e,t,o){let n=i.length,[r,s,l]=a.whitespaceVisibleColumn(i,e,t);if(l===-1)return-1;let c;switch(o){case 0:c=!0;break;case 1:c=!1;break;case 2:if(l%t===0)return e;c=l%t<=t/2;break}if(c){if(r===-1)return-1;let h=s;for(let g=r;g<n;++g){if(h===s+t)return r;switch(i.charCodeAt(g)){case 32:h+=1;break;case 9:h=al.nextRenderTabStop(h,t);break;default:return-1}}return h===s+t?r:-1}let u=al.nextRenderTabStop(l,t),p=l;for(let h=e;h<n;h++){if(p===u)return h;switch(i.charCodeAt(h)){case 32:p+=1;break;case 9:p=al.nextRenderTabStop(p,t);break;default:return-1}}return p===u?n:-1}};var lSe=class{constructor(i){this._textModelResolvedOptionsBrand=void 0;this.tabSize=Math.max(1,i.tabSize|0),i.indentSize==="tabSize"?(this.indentSize=this.tabSize,this._indentSizeIsTabSize=!0):(this.indentSize=Math.max(1,i.indentSize|0),this._indentSizeIsTabSize=!1),this.insertSpaces=!!i.insertSpaces,this.defaultEOL=i.defaultEOL|0,this.trimAutoWhitespace=!!i.trimAutoWhitespace,this.bracketPairColorizationOptions=i.bracketPairColorizationOptions}get originalIndentSize(){return this._indentSizeIsTabSize?"tabSize":this.indentSize}equals(i){return this.tabSize===i.tabSize&&this._indentSizeIsTabSize===i._indentSizeIsTabSize&&this.indentSize===i.indentSize&&this.insertSpaces===i.insertSpaces&&this.defaultEOL===i.defaultEOL&&this.trimAutoWhitespace===i.trimAutoWhitespace&&uo(this.bracketPairColorizationOptions,i.bracketPairColorizationOptions)}createChangeEvent(i){return{tabSize:this.tabSize!==i.tabSize,indentSize:this.indentSize!==i.indentSize,insertSpaces:this.insertSpaces!==i.insertSpaces,trimAutoWhitespace:this.trimAutoWhitespace!==i.trimAutoWhitespace}}},vU=class{constructor(i,e){this._findMatchBrand=void 0;this.range=i,this.matches=e}};function vKi(a){return!!a&&typeof a.read=="function"}function U6(a){return!!(a&&a.uri)}var H6=class{constructor(i,e,t,o,n,r){this.identifier=i;this.range=e;this.text=t;this.forceMoveMarkers=o;this.isAutoWhitespaceEdit=n;this._isTracked=r}},Lmt=class{constructor(i,e,t){this.regex=i,this.wordSeparators=e,this.simpleSearch=t}},Rmt=class{constructor(i,e,t){this.reverseEdits=i;this.changes=e;this.trimAutoWhitespaceLineNumbers=t}};function hx(a){return!a.isTooLargeForSyncing()&&!a.isForSimpleWidget}var YGe=class{constructor(i,e,t){this._cursorPositionBrand=void 0;this.lineNumber=i,this.column=e,this.leftoverVisibleColumns=t}},pu=class a{static leftPosition(i,e){if(e.column>i.getLineMinColumn(e.lineNumber))return e.delta(void 0,-n9t(i.getLineContent(e.lineNumber),e.column-1));if(e.lineNumber>1){let t=e.lineNumber-1;return new Ie(t,i.getLineMaxColumn(t))}else return e}static leftPositionAtomicSoftTabs(i,e,t){if(e.column<=i.getLineIndentColumn(e.lineNumber)){let o=i.getLineMinColumn(e.lineNumber),n=i.getLineContent(e.lineNumber),r=Zre.atomicPosition(n,e.column-1,t,0);if(r!==-1&&r+1>=o)return new Ie(e.lineNumber,r+1)}return this.leftPosition(i,e)}static left(i,e,t){let o=i.stickyTabStops?a.leftPositionAtomicSoftTabs(e,t,i.tabSize):a.leftPosition(e,t);return new YGe(o.lineNumber,o.column,0)}static moveLeft(i,e,t,o,n){let r,s;if(t.hasSelection()&&!o)r=t.selection.startLineNumber,s=t.selection.startColumn;else{let l=t.position.delta(void 0,-(n-1)),c=e.normalizePosition(a.clipPositionColumn(l,e),0),u=a.left(i,e,c);r=u.lineNumber,s=u.column}return t.move(o,r,s,0)}static clipPositionColumn(i,e){return new Ie(i.lineNumber,a.clipRange(i.column,e.getLineMinColumn(i.lineNumber),e.getLineMaxColumn(i.lineNumber)))}static clipRange(i,e,t){return i<e?e:i>t?t:i}static rightPosition(i,e,t){return t<i.getLineMaxColumn(e)?t=t+Tbe(i.getLineContent(e),t-1):e<i.getLineCount()&&(e=e+1,t=i.getLineMinColumn(e)),new Ie(e,t)}static rightPositionAtomicSoftTabs(i,e,t,o,n){if(t<i.getLineIndentColumn(e)){let r=i.getLineContent(e),s=Zre.atomicPosition(r,t-1,o,1);if(s!==-1)return new Ie(e,s+1)}return this.rightPosition(i,e,t)}static right(i,e,t){let o=i.stickyTabStops?a.rightPositionAtomicSoftTabs(e,t.lineNumber,t.column,i.tabSize,i.indentSize):a.rightPosition(e,t.lineNumber,t.column);return new YGe(o.lineNumber,o.column,0)}static moveRight(i,e,t,o,n){let r,s;if(t.hasSelection()&&!o)r=t.selection.endLineNumber,s=t.selection.endColumn;else{let l=t.position.delta(void 0,n-1),c=e.normalizePosition(a.clipPositionColumn(l,e),1),u=a.right(i,e,c);r=u.lineNumber,s=u.column}return t.move(o,r,s,0)}static vertical(i,e,t,o,n,r,s,l){let c=al.visibleColumnFromColumn(e.getLineContent(t),o,i.tabSize)+n,u=e.getLineCount(),p=t===1&&o===1,h=t===u&&o===e.getLineMaxColumn(t),g=r<t?p:h;if(t=r,t<1?(t=1,s?o=e.getLineMinColumn(t):o=Math.min(e.getLineMaxColumn(t),o)):t>u?(t=u,s?o=e.getLineMaxColumn(t):o=Math.min(e.getLineMaxColumn(t),o)):o=i.columnFromVisibleColumn(e,t,c),g?n=0:n=c-al.visibleColumnFromColumn(e.getLineContent(t),o,i.tabSize),l!==void 0){let f=new Ie(t,o),v=e.normalizePosition(f,l);n=n+(o-v.column),t=v.lineNumber,o=v.column}return new YGe(t,o,n)}static down(i,e,t,o,n,r,s){return this.vertical(i,e,t,o,n,t+r,s,4)}static moveDown(i,e,t,o,n){let r,s;t.hasSelection()&&!o?(r=t.selection.endLineNumber,s=t.selection.endColumn):(r=t.position.lineNumber,s=t.position.column);let l=0,c;do if(c=a.down(i,e,r+l,s,t.leftoverVisibleColumns,n,!0),e.normalizePosition(new Ie(c.lineNumber,c.column),2).lineNumber>r)break;while(l++<10&&r+l<e.getLineCount());return t.move(o,c.lineNumber,c.column,c.leftoverVisibleColumns)}static translateDown(i,e,t){let o=t.selection,n=a.down(i,e,o.selectionStartLineNumber,o.selectionStartColumn,t.selectionStartLeftoverVisibleColumns,1,!1),r=a.down(i,e,o.positionLineNumber,o.positionColumn,t.leftoverVisibleColumns,1,!1);return new ov(new z(n.lineNumber,n.column,n.lineNumber,n.column),0,n.leftoverVisibleColumns,new Ie(r.lineNumber,r.column),r.leftoverVisibleColumns)}static up(i,e,t,o,n,r,s){return this.vertical(i,e,t,o,n,t-r,s,3)}static moveUp(i,e,t,o,n){let r,s;t.hasSelection()&&!o?(r=t.selection.startLineNumber,s=t.selection.startColumn):(r=t.position.lineNumber,s=t.position.column);let l=a.up(i,e,r,s,t.leftoverVisibleColumns,n,!0);return t.move(o,l.lineNumber,l.column,l.leftoverVisibleColumns)}static translateUp(i,e,t){let o=t.selection,n=a.up(i,e,o.selectionStartLineNumber,o.selectionStartColumn,t.selectionStartLeftoverVisibleColumns,1,!1),r=a.up(i,e,o.positionLineNumber,o.positionColumn,t.leftoverVisibleColumns,1,!1);return new ov(new z(n.lineNumber,n.column,n.lineNumber,n.column),0,n.leftoverVisibleColumns,new Ie(r.lineNumber,r.column),r.leftoverVisibleColumns)}static _isBlankLine(i,e){return i.getLineFirstNonWhitespaceColumn(e)===0}static moveToPrevBlankLine(i,e,t,o){let n=t.position.lineNumber;for(;n>1&&this._isBlankLine(e,n);)n--;for(;n>1&&!this._isBlankLine(e,n);)n--;return t.move(o,n,e.getLineMinColumn(n),0)}static moveToNextBlankLine(i,e,t,o){let n=e.getLineCount(),r=t.position.lineNumber;for(;r<n&&this._isBlankLine(e,r);)r++;for(;r<n&&!this._isBlankLine(e,r);)r++;return t.move(o,r,e.getLineMinColumn(r),0)}static moveToBeginningOfLine(i,e,t,o){let n=t.position.lineNumber,r=e.getLineMinColumn(n),s=e.getLineFirstNonWhitespaceColumn(n)||r,l;return t.position.column===s?l=r:l=s,t.move(o,n,l,0)}static moveToEndOfLine(i,e,t,o,n){let r=t.position.lineNumber,s=e.getLineMaxColumn(r);return t.move(o,r,s,n?1073741824-s:0)}static moveToBeginningOfBuffer(i,e,t,o){return t.move(o,1,1,0)}static moveToEndOfBuffer(i,e,t,o){let n=e.getLineCount(),r=e.getLineMaxColumn(n);return t.move(o,n,r,0)}};var wN=class a{static deleteRight(i,e,t,o){let n=[],r=i!==3;for(let s=0,l=o.length;s<l;s++){let c=o[s],u=this.getDeleteRightRange(c,t,e);if(u.isEmpty()){n[s]=null;continue}u.startLineNumber!==u.endLineNumber&&(r=!0),n[s]=new Wh(u,"")}return[r,n]}static getDeleteRightRange(i,e,t){if(!i.isEmpty())return i;let o=i.getPosition(),n=pu.right(t,e,o);if(t.trimWhitespaceOnDelete&&n.lineNumber!==o.lineNumber){let r=e.getLineFirstNonWhitespaceColumn(o.lineNumber)>0,s=e.getLineFirstNonWhitespaceColumn(n.lineNumber);if(r&&s>0)return new z(n.lineNumber,s,o.lineNumber,o.column)}return new z(n.lineNumber,n.column,o.lineNumber,o.column)}static isAutoClosingPairDelete(i,e,t,o,n,r,s){if(e==="never"&&t==="never"||i==="never")return!1;for(let l=0,c=r.length;l<c;l++){let u=r[l],p=u.getPosition();if(!u.isEmpty())return!1;let h=n.getLineContent(p.lineNumber);if(p.column<2||p.column>=h.length+1)return!1;let g=h.charAt(p.column-2),f=o.get(g);if(!f)return!1;if(sW(g)){if(t==="never")return!1}else if(e==="never")return!1;let v=h.charAt(p.column-1),b=!1;for(let S of f)S.open===g&&S.close===v&&(b=!0);if(!b)return!1;if(i==="auto"){let S=!1;for(let y=0,w=s.length;y<w;y++){let k=s[y];if(p.lineNumber===k.startLineNumber&&p.column===k.startColumn){S=!0;break}}if(!S)return!1}}return!0}static _runAutoClosingPairDelete(i,e,t){let o=[];for(let n=0,r=t.length;n<r;n++){let s=t[n].getPosition(),l=new z(s.lineNumber,s.column-1,s.lineNumber,s.column+1);o[n]=new Wh(l,"")}return[!0,o]}static deleteLeft(i,e,t,o,n){if(this.isAutoClosingPairDelete(e.autoClosingDelete,e.autoClosingBrackets,e.autoClosingQuotes,e.autoClosingPairs.autoClosingPairsOpenByEnd,t,o,n))return this._runAutoClosingPairDelete(e,t,o);let r=[],s=i!==2;for(let l=0,c=o.length;l<c;l++){let u=a.getDeleteLeftRange(o[l],t,e);if(u.isEmpty()){r[l]=null;continue}u.startLineNumber!==u.endLineNumber&&(s=!0),r[l]=new Wh(u,"")}return[s,r]}static getDeleteLeftRange(i,e,t){if(!i.isEmpty())return i;let o=i.getPosition();if(t.useTabStops&&o.column>1){let n=e.getLineContent(o.lineNumber),r=Ap(n),s=r===-1?n.length+1:r+1;if(o.column<=s){let l=t.visibleColumnFromColumn(e,o),c=al.prevIndentTabStop(l,t.indentSize),u=t.columnFromVisibleColumn(e,o.lineNumber,c);return new z(o.lineNumber,u,o.lineNumber,o.column)}}return z.fromPositions(a.getPositionAfterDeleteLeft(o,e),o)}static getPositionAfterDeleteLeft(i,e){if(i.column>1){let t=g1i(i.column-1,e.getLineContent(i.lineNumber));return i.with(void 0,t+1)}else if(i.lineNumber>1){let t=i.lineNumber-1;return new Ie(t,e.getLineMaxColumn(t))}else return i}static cut(i,e,t){let o=[],n=null;t.sort((r,s)=>Ie.compare(r.getStartPosition(),s.getEndPosition()));for(let r=0,s=t.length;r<s;r++){let l=t[r];if(l.isEmpty())if(i.emptySelectionClipboard){let c=l.getPosition(),u,p,h,g;c.lineNumber<e.getLineCount()?(u=c.lineNumber,p=1,h=c.lineNumber+1,g=1):c.lineNumber>1&&n?.endLineNumber!==c.lineNumber?(u=c.lineNumber-1,p=e.getLineMaxColumn(c.lineNumber-1),h=c.lineNumber,g=e.getLineMaxColumn(c.lineNumber)):(u=c.lineNumber,p=1,h=c.lineNumber,g=e.getLineMaxColumn(c.lineNumber));let f=new z(u,p,h,g);n=f,f.isEmpty()?o[r]=null:o[r]=new Wh(f,"")}else o[r]=null;else o[r]=new Wh(l,"")}return new Yv(0,o,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!0})}};var cSe=60,dSe=cSe*60,ese=dSe*24,SKi=ese*7,IKi=ese*30,yKi=ese*365;function Bs(a,i,e,t){if(typeof a>"u")return d(85,null);typeof a!="number"&&(a=a.getTime());let o=Math.round((new Date().getTime()-a)/1e3);if(o<-30)return d(59,null,Bs(new Date().getTime()+o*1e3,!1));if(!t&&o<30)return d(76,null);let n;return o<cSe?(n=o,i?n===1?e?d(83,null,n):d(82,null,n):e?d(79,null,n):d(78,null,n):n===1?e?d(84,null,n):d(81,null,n):e?d(80,null,n):d(77,null,n)):o<dSe?(n=Math.round(o/cSe),i?n===1?e?d(66,null,n):d(65,null,n):e?d(62,null,n):d(61,null,n):n===1?e?d(67,null,n):d(64,null,n):e?d(63,null,n):d(60,null,n)):o<ese?(n=Math.round(o/dSe),i?n===1?e?d(57,null,n):d(56,null,n):e?d(53,null,n):d(52,null,n):n===1?e?d(58,null,n):d(55,null,n):e?d(54,null,n):d(51,null,n)):o<SKi?(n=Math.round(o/ese),i?n===1?d(50,null,n):d(48,null,n):n===1?d(49,null,n):d(47,null,n)):o<IKi?(n=Math.round(o/SKi),i?n===1?e?d(92,null,n):d(91,null,n):e?d(88,null,n):d(87,null,n):n===1?e?d(93,null,n):d(90,null,n):e?d(89,null,n):d(86,null,n)):o<yKi?(n=Math.round(o/IKi),i?n===1?e?d(74,null,n):d(73,null,n):e?d(70,null,n):d(69,null,n):n===1?e?d(75,null,n):d(72,null,n):e?d(71,null,n):d(68,null,n)):(n=Math.round(o/yKi),i?n===1?e?d(100,null,n):d(99,null,n):e?d(96,null,n):d(95,null,n):n===1?e?d(101,null,n):d(98,null,n):e?d(97,null,n):d(94,null,n))}function z6(a,i){let e=Math.abs(a/1e3);return e<1?i?d(108,null,a):d(107,null,a):e<cSe?i?d(110,null,Math.round(a)/1e3):d(109,null,Math.round(a)/1e3):e<dSe?i?d(106,null,Math.round(a/(1e3*cSe))):d(105,null,Math.round(a/(1e3*cSe))):e<ese?i?d(104,null,Math.round(a/(1e3*dSe))):d(103,null,Math.round(a/(1e3*dSe))):d(102,null,Math.round(a/(1e3*ese)))}function Pmt(a){return a.getFullYear()+"-"+String(a.getMonth()+1).padStart(2,"0")+"-"+String(a.getDate()).padStart(2,"0")+"T"+String(a.getHours()).padStart(2,"0")+":"+String(a.getMinutes()).padStart(2,"0")+":"+String(a.getSeconds()).padStart(2,"0")+"."+(a.getMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"}var Wu={DateTimeFormat(a,i){return new co(()=>{try{return new Intl.DateTimeFormat(a,i)}catch{return new Intl.DateTimeFormat(void 0,i)}})},Collator(a,i){return new co(()=>{try{return new Intl.Collator(a,i)}catch{return new Intl.Collator(void 0,i)}})},Segmenter(a,i){return new co(()=>{try{return new Intl.Segmenter(a,i)}catch{return new Intl.Segmenter(void 0,i)}})},Locale(a,i){return new co(()=>{try{return new Intl.Locale(a,i)}catch{return new Intl.Locale(QH,i)}})},NumberFormat(a,i){return new co(()=>{try{return new Intl.NumberFormat(a,i)}catch{return new Intl.NumberFormat(void 0,i)}})}};var _$=class a{constructor(i){let e=Sre(i);this._defaultValue=e,this._asciiMap=a._createAsciiMap(e),this._map=new Map}static _createAsciiMap(i){let e=new Uint8Array(256);return e.fill(i),e}set(i,e){let t=Sre(e);i>=0&&i<256?this._asciiMap[i]=t:this._map.set(i,t)}get(i){return i>=0&&i<256?this._asciiMap[i]:this._map.get(i)||this._defaultValue}clear(){this._asciiMap.fill(this._defaultValue),this._map.clear()}};var D$=class{constructor(){this._actual=new _$(0)}add(i){this._actual.set(i,1)}has(i){return this._actual.get(i)===1}clear(){return this._actual.clear()}};var IYt=class extends _${constructor(e,t){super(0);this._segmenter=null;this._cachedLine=null;this._cachedSegments=[];this.intlSegmenterLocales=t,this.intlSegmenterLocales.length>0?this._segmenter=Wu.Segmenter(this.intlSegmenterLocales,{granularity:"word"}):this._segmenter=null;for(let o=0,n=e.length;o<n;o++)this.set(e.charCodeAt(o),2);this.set(32,1),this.set(9,1)}findPrevIntlWordBeforeOrAtOffset(e,t){let o=null;for(let n of this._getIntlSegmenterWordsOnLine(e)){if(n.index>t)break;o=n}return o}findNextIntlWordAtOrAfterOffset(e,t){for(let o of this._getIntlSegmenterWordsOnLine(e))if(!(o.index<t))return o;return null}_getIntlSegmenterWordsOnLine(e){return this._segmenter?this._cachedLine===e?this._cachedSegments:(this._cachedLine=e,this._cachedSegments=this._filterWordSegments(this._segmenter.value.segment(e)),this._cachedSegments):[]}_filterWordSegments(e){let t=[];for(let o of e)this._isWordLike(o)&&t.push(o);return t}_isWordLike(e){return!!e.isWordLike}},wKi=new il(10);function jw(a,i){let e=`${a}/${i.join(",")}`,t=wKi.get(e);return t||(t=new IYt(a,i),wKi.set(e,t)),t}var yf=class a{static _createWord(i,e,t,o,n){return{start:o,end:n,wordType:e,nextCharClass:t}}static _createIntlWord(i,e){return{start:i.index,end:i.index+i.segment.length,wordType:1,nextCharClass:e}}static _findPreviousWordOnLine(i,e,t){let o=e.getLineContent(t.lineNumber);return this._doFindPreviousWordOnLine(o,i,t)}static _doFindPreviousWordOnLine(i,e,t){let o=0,n=e.findPrevIntlWordBeforeOrAtOffset(i,t.column-2);for(let r=t.column-2;r>=0;r--){let s=i.charCodeAt(r),l=e.get(s);if(n&&r===n.index)return this._createIntlWord(n,l);if(l===0){if(o===2)return this._createWord(i,o,l,r+1,this._findEndOfWord(i,e,o,r+1));o=1}else if(l===2){if(o===1)return this._createWord(i,o,l,r+1,this._findEndOfWord(i,e,o,r+1));o=2}else if(l===1&&o!==0)return this._createWord(i,o,l,r+1,this._findEndOfWord(i,e,o,r+1))}return o!==0?this._createWord(i,o,1,0,this._findEndOfWord(i,e,o,0)):null}static _findEndOfWord(i,e,t,o){let n=e.findNextIntlWordAtOrAfterOffset(i,o),r=i.length;for(let s=o;s<r;s++){let l=i.charCodeAt(s),c=e.get(l);if(n&&s===n.index+n.segment.length||c===1||t===1&&c===2||t===2&&c===0)return s}return r}static _findNextWordOnLine(i,e,t){let o=e.getLineContent(t.lineNumber);return this._doFindNextWordOnLine(o,i,t)}static _doFindNextWordOnLine(i,e,t){let o=0,n=i.length,r=e.findNextIntlWordAtOrAfterOffset(i,t.column-1);for(let s=t.column-1;s<n;s++){let l=i.charCodeAt(s),c=e.get(l);if(r&&s===r.index)return this._createIntlWord(r,c);if(c===0){if(o===2)return this._createWord(i,o,c,this._findStartOfWord(i,e,o,s-1),s);o=1}else if(c===2){if(o===1)return this._createWord(i,o,c,this._findStartOfWord(i,e,o,s-1),s);o=2}else if(c===1&&o!==0)return this._createWord(i,o,c,this._findStartOfWord(i,e,o,s-1),s)}return o!==0?this._createWord(i,o,1,this._findStartOfWord(i,e,o,n-1),n):null}static _findStartOfWord(i,e,t,o){let n=e.findPrevIntlWordBeforeOrAtOffset(i,o);for(let r=o;r>=0;r--){let s=i.charCodeAt(r),l=e.get(s);if(n&&r===n.index)return r;if(l===1||t===1&&l===2||t===2&&l===0)return r+1}return 0}static moveWordLeft(i,e,t,o,n){let r=t.lineNumber,s=t.column;s===1&&r>1&&(r=r-1,s=e.getLineMaxColumn(r));let l=a._findPreviousWordOnLine(i,e,new Ie(r,s));if(o===0)return new Ie(r,l?l.start+1:1);if(o===1)return!n&&l&&l.wordType===2&&l.end-l.start===1&&l.nextCharClass===0&&(l=a._findPreviousWordOnLine(i,e,new Ie(r,l.start+1))),new Ie(r,l?l.start+1:1);if(o===3){for(;l&&l.wordType===2;)l=a._findPreviousWordOnLine(i,e,new Ie(r,l.start+1));return new Ie(r,l?l.start+1:1)}return l&&s<=l.end+1&&(l=a._findPreviousWordOnLine(i,e,new Ie(r,l.start+1))),new Ie(r,l?l.end+1:1)}static _moveWordPartLeft(i,e){let t=e.lineNumber,o=i.getLineMaxColumn(t);if(e.column===1)return t>1?new Ie(t-1,i.getLineMaxColumn(t-1)):e;let n=i.getLineContent(t);for(let r=e.column-1;r>1;r--){let s=n.charCodeAt(r-2),l=n.charCodeAt(r-1);if(s===95&&l!==95)return new Ie(t,r);if(s===45&&l!==45)return new Ie(t,r);if((iU(s)||pGe(s))&&Hk(l))return new Ie(t,r);if(Hk(s)&&Hk(l)&&r+1<o){let c=n.charCodeAt(r);if(iU(c)||pGe(c))return new Ie(t,r)}}return new Ie(t,1)}static moveWordRight(i,e,t,o){let n=t.lineNumber,r=t.column,s=!1;r===e.getLineMaxColumn(n)&&n<e.getLineCount()&&(s=!0,n=n+1,r=1);let l=a._findNextWordOnLine(i,e,new Ie(n,r));if(o===2)l&&l.wordType===2&&l.end-l.start===1&&l.nextCharClass===0&&(l=a._findNextWordOnLine(i,e,new Ie(n,l.end+1))),l?r=l.end+1:r=e.getLineMaxColumn(n);else if(o===3){for(s&&(r=0);l&&(l.wordType===2||l.start+1<=r);)l=a._findNextWordOnLine(i,e,new Ie(n,l.end+1));l?r=l.start+1:r=e.getLineMaxColumn(n)}else l&&!s&&r>=l.start+1&&(l=a._findNextWordOnLine(i,e,new Ie(n,l.end+1))),l?r=l.start+1:r=e.getLineMaxColumn(n);return new Ie(n,r)}static _moveWordPartRight(i,e){let t=e.lineNumber,o=i.getLineMaxColumn(t);if(e.column===o)return t<i.getLineCount()?new Ie(t+1,1):e;let n=i.getLineContent(t);for(let r=e.column+1;r<o;r++){let s=n.charCodeAt(r-2),l=n.charCodeAt(r-1);if(s!==95&&l===95)return new Ie(t,r);if(s!==45&&l===45)return new Ie(t,r);if((iU(s)||pGe(s))&&Hk(l))return new Ie(t,r);if(Hk(s)&&Hk(l)&&r+1<o){let c=n.charCodeAt(r);if(iU(c)||pGe(c))return new Ie(t,r)}}return new Ie(t,o)}static _deleteWordLeftWhitespace(i,e){let t=i.getLineContent(e.lineNumber),o=e.column-2,n=tv(t,o);return n+1<o?new z(e.lineNumber,n+2,e.lineNumber,e.column):null}static deleteWordLeft(i,e){let t=i.wordSeparators,o=i.model,n=i.selection,r=i.whitespaceHeuristics;if(!n.isEmpty())return n;if(wN.isAutoClosingPairDelete(i.autoClosingDelete,i.autoClosingBrackets,i.autoClosingQuotes,i.autoClosingPairs.autoClosingPairsOpenByEnd,i.model,[i.selection],i.autoClosedCharacters)){let p=i.selection.getPosition();return new z(p.lineNumber,p.column-1,p.lineNumber,p.column+1)}let s=new Ie(n.positionLineNumber,n.positionColumn),l=s.lineNumber,c=s.column;if(l===1&&c===1)return null;if(r){let p=this._deleteWordLeftWhitespace(o,s);if(p)return p}let u=a._findPreviousWordOnLine(t,o,s);return e===0?u?c=u.start+1:c>1?c=1:(l--,c=o.getLineMaxColumn(l)):(u&&c<=u.end+1&&(u=a._findPreviousWordOnLine(t,o,new Ie(l,u.start+1))),u?c=u.end+1:c>1?c=1:(l--,c=o.getLineMaxColumn(l))),new z(l,c,s.lineNumber,s.column)}static deleteInsideWord(i,e,t,o=!1){if(!t.isEmpty())return t;let n=new Ie(t.positionLineNumber,t.positionColumn),r=this._deleteInsideWordWhitespace(e,n);return r||this._deleteInsideWordDetermineDeleteRange(i,e,n,o)}static _charAtIsWhitespace(i,e){let t=i.charCodeAt(e);return t===32||t===9}static _deleteInsideWordWhitespace(i,e){let t=i.getLineContent(e.lineNumber),o=t.length;if(o===0)return null;let n=Math.max(e.column-2,0);if(!this._charAtIsWhitespace(t,n))return null;let r=Math.min(e.column-1,o-1);if(!this._charAtIsWhitespace(t,r))return null;for(;n>0&&this._charAtIsWhitespace(t,n-1);)n--;for(;r+1<o&&this._charAtIsWhitespace(t,r+1);)r++;return new z(e.lineNumber,n+1,e.lineNumber,r+2)}static _deleteInsideWordDetermineDeleteRange(i,e,t,o){let n=e.getLineContent(t.lineNumber),r=n.length;if(r===0)return t.lineNumber>1?new z(t.lineNumber-1,e.getLineMaxColumn(t.lineNumber-1),t.lineNumber,1):t.lineNumber<e.getLineCount()?new z(t.lineNumber,1,t.lineNumber+1,1):new z(t.lineNumber,1,t.lineNumber,1);let s=h=>h.start+1<=t.column&&t.column<=h.end+1,l=(h,g)=>(h=Math.min(h,t.column),g=Math.max(g,t.column),new z(t.lineNumber,h,t.lineNumber,g)),c=h=>{let g=h.start+1,f=h.end+1;if(o)return l(g,f);let v=!1;for(;f-1<r&&this._charAtIsWhitespace(n,f-1);)v=!0,f++;if(!v)for(;g>1&&this._charAtIsWhitespace(n,g-2);)g--;return l(g,f)},u=a._findPreviousWordOnLine(i,e,t);if(u&&s(u))return c(u);let p=a._findNextWordOnLine(i,e,t);return p&&s(p)?c(p):u&&p?l(u.end+1,p.start+1):u?l(u.start+1,u.end+1):p?l(p.start+1,p.end+1):l(1,r+1)}static _deleteWordPartLeft(i,e){if(!e.isEmpty())return e;let t=e.getPosition(),o=a._moveWordPartLeft(i,t);return new z(t.lineNumber,t.column,o.lineNumber,o.column)}static _findFirstNonWhitespaceChar(i,e){let t=i.length;for(let o=e;o<t;o++){let n=i.charAt(o);if(n!==" "&&n!==" ")return o}return t}static _deleteWordRightWhitespace(i,e){let t=i.getLineContent(e.lineNumber),o=e.column-1,n=this._findFirstNonWhitespaceChar(t,o);return o+1<n?new z(e.lineNumber,e.column,e.lineNumber,n+1):null}static deleteWordRight(i,e){let t=i.wordSeparators,o=i.model,n=i.selection,r=i.whitespaceHeuristics;if(!n.isEmpty())return n;let s=new Ie(n.positionLineNumber,n.positionColumn),l=s.lineNumber,c=s.column,u=o.getLineCount(),p=o.getLineMaxColumn(l);if(l===u&&c===p)return null;if(r){let g=this._deleteWordRightWhitespace(o,s);if(g)return g}let h=a._findNextWordOnLine(t,o,s);return e===2?h?c=h.end+1:c<p||l===u?c=p:(l++,h=a._findNextWordOnLine(t,o,new Ie(l,1)),h?c=h.start+1:c=o.getLineMaxColumn(l)):(h&&c>=h.start+1&&(h=a._findNextWordOnLine(t,o,new Ie(l,h.end+1))),h?c=h.start+1:c<p||l===u?c=p:(l++,h=a._findNextWordOnLine(t,o,new Ie(l,1)),h?c=h.start+1:c=o.getLineMaxColumn(l))),new z(l,c,s.lineNumber,s.column)}static _deleteWordPartRight(i,e){if(!e.isEmpty())return e;let t=e.getPosition(),o=a._moveWordPartRight(i,t);return new z(t.lineNumber,t.column,o.lineNumber,o.column)}static _createWordAtPosition(i,e,t){let o=new z(e,t.start+1,e,t.end+1);return{word:i.getValueInRange(o),startColumn:o.startColumn,endColumn:o.endColumn}}static getWordAtPosition(i,e,t,o){let n=jw(e,t),r=a._findPreviousWordOnLine(n,i,o);if(r&&r.wordType===1&&r.start<=o.column-1&&o.column-1<=r.end)return a._createWordAtPosition(i,o.lineNumber,r);let s=a._findNextWordOnLine(n,i,o);return s&&s.wordType===1&&s.start<=o.column-1&&o.column-1<=s.end?a._createWordAtPosition(i,o.lineNumber,s):null}static word(i,e,t,o,n){let r=jw(i.wordSeparators,i.wordSegmenterLocales),s=a._findPreviousWordOnLine(r,e,n),l=a._findNextWordOnLine(r,e,n);if(!o){let g,f;return s&&s.wordType===1&&s.start<=n.column-1&&n.column-1<=s.end||s&&s.wordType===2&&s.start<=n.column-1&&n.column-1<s.end?(g=s.start+1,f=s.end+1):l&&l.wordType===1&&l.start<=n.column-1&&n.column-1<=l.end||l&&l.wordType===2&&l.start<=n.column-1&&n.column-1<l.end?(g=l.start+1,f=l.end+1):(s?g=s.end+1:g=1,l?f=l.start+1:f=e.getLineMaxColumn(n.lineNumber)),new ov(new z(n.lineNumber,g,n.lineNumber,f),1,0,new Ie(n.lineNumber,f),0)}let c,u;s&&s.wordType===1&&s.start<n.column-1&&n.column-1<s.end?(c=s.start+1,u=s.end+1):l&&l.wordType===1&&l.start<n.column-1&&n.column-1<l.end?(c=l.start+1,u=l.end+1):(c=n.column,u=n.column);let p=n.lineNumber,h;if(t.selectionStart.containsPosition(n))h=t.selectionStart.endColumn;else if(n.isBeforeOrEqual(t.selectionStart.getStartPosition())){h=c;let g=new Ie(p,h);t.selectionStart.containsPosition(g)&&(h=t.selectionStart.endColumn)}else{h=u;let g=new Ie(p,h);t.selectionStart.containsPosition(g)&&(h=t.selectionStart.startColumn)}return t.move(!0,p,h,0)}},tse=class extends yf{static deleteWordPartLeft(i){let e=Amt([yf.deleteWordLeft(i,0),yf.deleteWordLeft(i,2),yf._deleteWordPartLeft(i.model,i.selection)]);return e.sort(z.compareRangesUsingEnds),e[2]}static deleteWordPartRight(i){let e=Amt([yf.deleteWordRight(i,0),yf.deleteWordRight(i,2),yf._deleteWordPartRight(i.model,i.selection)]);return e.sort(z.compareRangesUsingStarts),e[0]}static moveWordPartLeft(i,e,t,o){let n=Amt([yf.moveWordLeft(i,e,t,0,o),yf.moveWordLeft(i,e,t,2,o),yf._moveWordPartLeft(e,t)]);return n.sort(Ie.compare),n[2]}static moveWordPartRight(i,e,t){let o=Amt([yf.moveWordRight(i,e,t,0),yf.moveWordRight(i,e,t,2),yf._moveWordPartRight(e,t)]);return o.sort(Ie.compare),o[0]}};function Amt(a){return a.filter(i=>!!i)}var Wg=class a{static addCursorDown(i,e,t){let o=[],n=0;for(let r=0,s=e.length;r<s;r++){let l=e[r];o[n++]=new Ps(l.modelState,l.viewState),t?o[n++]=Ps.fromModelState(pu.translateDown(i.cursorConfig,i.model,l.modelState)):o[n++]=Ps.fromViewState(pu.translateDown(i.cursorConfig,i,l.viewState))}return o}static addCursorUp(i,e,t){let o=[],n=0;for(let r=0,s=e.length;r<s;r++){let l=e[r];o[n++]=new Ps(l.modelState,l.viewState),t?o[n++]=Ps.fromModelState(pu.translateUp(i.cursorConfig,i.model,l.modelState)):o[n++]=Ps.fromViewState(pu.translateUp(i.cursorConfig,i,l.viewState))}return o}static moveToBeginningOfLine(i,e,t){let o=[];for(let n=0,r=e.length;n<r;n++){let s=e[n];o[n]=this._moveToLineStart(i,s,t)}return o}static _moveToLineStart(i,e,t){let o=e.viewState.position.column,n=e.modelState.position.column,r=o===n,s=e.viewState.position.lineNumber,l=i.getLineFirstNonWhitespaceColumn(s);return!r&&!(o===l)?this._moveToLineStartByView(i,e,t):this._moveToLineStartByModel(i,e,t)}static _moveToLineStartByView(i,e,t){return Ps.fromViewState(pu.moveToBeginningOfLine(i.cursorConfig,i,e.viewState,t))}static _moveToLineStartByModel(i,e,t){return Ps.fromModelState(pu.moveToBeginningOfLine(i.cursorConfig,i.model,e.modelState,t))}static moveToEndOfLine(i,e,t,o){let n=[];for(let r=0,s=e.length;r<s;r++){let l=e[r];n[r]=this._moveToLineEnd(i,l,t,o)}return n}static _moveToLineEnd(i,e,t,o){let n=e.viewState.position,r=i.getLineMaxColumn(n.lineNumber),s=n.column===r,l=e.modelState.position,c=i.model.getLineMaxColumn(l.lineNumber),u=r-n.column===c-l.column;return s||u?this._moveToLineEndByModel(i,e,t,o):this._moveToLineEndByView(i,e,t,o)}static _moveToLineEndByView(i,e,t,o){return Ps.fromViewState(pu.moveToEndOfLine(i.cursorConfig,i,e.viewState,t,o))}static _moveToLineEndByModel(i,e,t,o){return Ps.fromModelState(pu.moveToEndOfLine(i.cursorConfig,i.model,e.modelState,t,o))}static expandLineSelection(i,e){let t=[];for(let o=0,n=e.length;o<n;o++){let r=e[o],s=r.modelState.selection.startLineNumber,l=i.model.getLineCount(),c=r.modelState.selection.endLineNumber,u;c===l?u=i.model.getLineMaxColumn(l):(c++,u=1),t[o]=Ps.fromModelState(new ov(new z(s,1,s,1),0,0,new Ie(c,u),0))}return t}static moveToBeginningOfBuffer(i,e,t){let o=[];for(let n=0,r=e.length;n<r;n++){let s=e[n];o[n]=Ps.fromModelState(pu.moveToBeginningOfBuffer(i.cursorConfig,i.model,s.modelState,t))}return o}static moveToEndOfBuffer(i,e,t){let o=[];for(let n=0,r=e.length;n<r;n++){let s=e[n];o[n]=Ps.fromModelState(pu.moveToEndOfBuffer(i.cursorConfig,i.model,s.modelState,t))}return o}static selectAll(i,e){let t=i.model.getLineCount(),o=i.model.getLineMaxColumn(t);return Ps.fromModelState(new ov(new z(1,1,1,1),0,0,new Ie(t,o),0))}static line(i,e,t,o,n){let r=i.model.validatePosition(o),s=n?i.coordinatesConverter.validateViewPosition(new Ie(n.lineNumber,n.column),r):i.coordinatesConverter.convertModelPositionToViewPosition(r);if(!t){let c=i.model.getLineCount(),u=r.lineNumber+1,p=1;return u>c&&(u=c,p=i.model.getLineMaxColumn(u)),Ps.fromModelState(new ov(new z(r.lineNumber,1,u,p),2,0,new Ie(u,p),0))}let l=e.modelState.selectionStart.getStartPosition().lineNumber;if(r.lineNumber<l)return Ps.fromViewState(e.viewState.move(!0,s.lineNumber,1,0));if(r.lineNumber>l){let c=i.getLineCount(),u=s.lineNumber+1,p=1;return u>c&&(u=c,p=i.getLineMaxColumn(u)),Ps.fromViewState(e.viewState.move(!0,u,p,0))}else{let c=e.modelState.selectionStart.getEndPosition();return Ps.fromModelState(e.modelState.move(!0,c.lineNumber,c.column,0))}}static word(i,e,t,o){let n=i.model.validatePosition(o);return Ps.fromModelState(yf.word(i.cursorConfig,i.model,e.modelState,t,n))}static cancelSelection(i,e){if(!e.modelState.hasSelection())return new Ps(e.modelState,e.viewState);let t=e.viewState.position.lineNumber,o=e.viewState.position.column;return Ps.fromViewState(new ov(new z(t,o,t,o),0,0,new Ie(t,o),0))}static moveTo(i,e,t,o,n){if(t){if(e.modelState.selectionStartKind===1)return this.word(i,e,t,o);if(e.modelState.selectionStartKind===2)return this.line(i,e,t,o,n)}let r=i.model.validatePosition(o),s=n?i.coordinatesConverter.validateViewPosition(new Ie(n.lineNumber,n.column),r):i.coordinatesConverter.convertModelPositionToViewPosition(r);return Ps.fromViewState(e.viewState.move(t,s.lineNumber,s.column,0))}static simpleMove(i,e,t,o,n,r){switch(t){case vs.Direction.Left:return r===vs.Unit.HalfLine?this._moveHalfLineLeft(i,e,o):this._moveLeft(i,e,o,n);case vs.Direction.Right:return r===vs.Unit.HalfLine?this._moveHalfLineRight(i,e,o):this._moveRight(i,e,o,n);case vs.Direction.Up:return r===vs.Unit.WrappedLine?this._moveUpByViewLines(i,e,o,n):r===vs.Unit.FoldedLine?this._moveUpByFoldedLines(i,e,o,n):this._moveUpByModelLines(i,e,o,n);case vs.Direction.Down:return r===vs.Unit.WrappedLine?this._moveDownByViewLines(i,e,o,n):r===vs.Unit.FoldedLine?this._moveDownByFoldedLines(i,e,o,n):this._moveDownByModelLines(i,e,o,n);case vs.Direction.PrevBlankLine:return r===vs.Unit.WrappedLine?e.map(s=>Ps.fromViewState(pu.moveToPrevBlankLine(i.cursorConfig,i,s.viewState,o))):e.map(s=>Ps.fromModelState(pu.moveToPrevBlankLine(i.cursorConfig,i.model,s.modelState,o)));case vs.Direction.NextBlankLine:return r===vs.Unit.WrappedLine?e.map(s=>Ps.fromViewState(pu.moveToNextBlankLine(i.cursorConfig,i,s.viewState,o))):e.map(s=>Ps.fromModelState(pu.moveToNextBlankLine(i.cursorConfig,i.model,s.modelState,o)));case vs.Direction.WrappedLineStart:return this._moveToViewMinColumn(i,e,o);case vs.Direction.WrappedLineFirstNonWhitespaceCharacter:return this._moveToViewFirstNonWhitespaceColumn(i,e,o);case vs.Direction.WrappedLineColumnCenter:return this._moveToViewCenterColumn(i,e,o);case vs.Direction.WrappedLineEnd:return this._moveToViewMaxColumn(i,e,o);case vs.Direction.WrappedLineLastNonWhitespaceCharacter:return this._moveToViewLastNonWhitespaceColumn(i,e,o);default:return null}}static viewportMove(i,e,t,o,n){let r=i.getCompletelyVisibleViewRange(),s=i.coordinatesConverter.convertViewRangeToModelRange(r);switch(t){case vs.Direction.ViewPortTop:{let l=this._firstLineNumberInRange(i.model,s,n),c=i.model.getLineFirstNonWhitespaceColumn(l);return[this._moveToModelPosition(i,e[0],o,l,c)]}case vs.Direction.ViewPortBottom:{let l=this._lastLineNumberInRange(i.model,s,n),c=i.model.getLineFirstNonWhitespaceColumn(l);return[this._moveToModelPosition(i,e[0],o,l,c)]}case vs.Direction.ViewPortCenter:{let l=Math.round((s.startLineNumber+s.endLineNumber)/2),c=i.model.getLineFirstNonWhitespaceColumn(l);return[this._moveToModelPosition(i,e[0],o,l,c)]}case vs.Direction.ViewPortIfOutside:{let l=[];for(let c=0,u=e.length;c<u;c++){let p=e[c];l[c]=this.findPositionInViewportIfOutside(i,p,r,o)}return l}default:return null}}static findPositionInViewportIfOutside(i,e,t,o){let n=e.viewState.position.lineNumber;if(t.startLineNumber<=n&&n<=t.endLineNumber-1)return new Ps(e.modelState,e.viewState);{let r;n>t.endLineNumber-1?r=t.endLineNumber-1:n<t.startLineNumber?r=t.startLineNumber:r=n;let s=pu.vertical(i.cursorConfig,i,n,e.viewState.position.column,e.viewState.leftoverVisibleColumns,r,!1);return Ps.fromViewState(e.viewState.move(o,s.lineNumber,s.column,s.leftoverVisibleColumns))}}static _firstLineNumberInRange(i,e,t){let o=e.startLineNumber;return e.startColumn!==i.getLineMinColumn(o)&&o++,Math.min(e.endLineNumber,o+t-1)}static _lastLineNumberInRange(i,e,t){let o=e.startLineNumber;return e.startColumn!==i.getLineMinColumn(o)&&o++,Math.max(o,e.endLineNumber-t+1)}static _moveLeft(i,e,t,o){return e.map(n=>{let s=i.getTextDirection(n.viewState.position.lineNumber)===1;return Ps.fromViewState(s?pu.moveRight(i.cursorConfig,i,n.viewState,t,o):pu.moveLeft(i.cursorConfig,i,n.viewState,t,o))})}static _moveHalfLineLeft(i,e,t){let o=[];for(let n=0,r=e.length;n<r;n++){let s=e[n],l=s.viewState.position.lineNumber,c=Math.round(i.getLineLength(l)/2);o[n]=Ps.fromViewState(pu.moveLeft(i.cursorConfig,i,s.viewState,t,c))}return o}static _moveRight(i,e,t,o){return e.map(n=>{let s=i.getTextDirection(n.viewState.position.lineNumber)===1;return Ps.fromViewState(s?pu.moveLeft(i.cursorConfig,i,n.viewState,t,o):pu.moveRight(i.cursorConfig,i,n.viewState,t,o))})}static _moveHalfLineRight(i,e,t){let o=[];for(let n=0,r=e.length;n<r;n++){let s=e[n],l=s.viewState.position.lineNumber,c=Math.round(i.getLineLength(l)/2);o[n]=Ps.fromViewState(pu.moveRight(i.cursorConfig,i,s.viewState,t,c))}return o}static _moveDownByViewLines(i,e,t,o){let n=[];for(let r=0,s=e.length;r<s;r++){let l=e[r];n[r]=Ps.fromViewState(pu.moveDown(i.cursorConfig,i,l.viewState,t,o))}return n}static _moveDownByModelLines(i,e,t,o){let n=[];for(let r=0,s=e.length;r<s;r++){let l=e[r];n[r]=Ps.fromModelState(pu.moveDown(i.cursorConfig,i.model,l.modelState,t,o))}return n}static _moveUpByViewLines(i,e,t,o){let n=[];for(let r=0,s=e.length;r<s;r++){let l=e[r];n[r]=Ps.fromViewState(pu.moveUp(i.cursorConfig,i,l.viewState,t,o))}return n}static _moveUpByModelLines(i,e,t,o){let n=[];for(let r=0,s=e.length;r<s;r++){let l=e[r];n[r]=Ps.fromModelState(pu.moveUp(i.cursorConfig,i.model,l.modelState,t,o))}return n}static _moveDownByFoldedLines(i,e,t,o){let n=i.model,r=n.getLineCount(),s=i.getHiddenAreas();return e.map(l=>{let c=l.modelState.hasSelection()&&!t?l.modelState.selection.endLineNumber:l.modelState.position.lineNumber,p=a._targetFoldedDown(c,o,s,r)-c;return p===0?Ps.fromModelState(l.modelState):Ps.fromModelState(pu.moveDown(i.cursorConfig,n,l.modelState,t,p))})}static _moveUpByFoldedLines(i,e,t,o){let n=i.model,r=i.getHiddenAreas();return e.map(s=>{let l=s.modelState.hasSelection()&&!t?s.modelState.selection.startLineNumber:s.modelState.position.lineNumber,c=a._targetFoldedUp(l,o,r),u=l-c;return u===0?Ps.fromModelState(s.modelState):Ps.fromModelState(pu.moveUp(i.cursorConfig,n,s.modelState,t,u))})}static _targetFoldedDown(i,e,t,o){let n=i,r=0;for(;r<t.length&&t[r].endLineNumber<n+1;)r++;for(let s=0;s<e;s++){if(n>=o)return o;let l=n+1;for(;r<t.length&&t[r].endLineNumber<l;)r++;if(r<t.length&&t[r].startLineNumber<=l&&(l=t[r].endLineNumber+1),l>o)return n;n=l}return n}static _targetFoldedUp(i,e,t){let o=i,n=t.length-1;for(;n>=0&&t[n].startLineNumber>o-1;)n--;for(let r=0;r<e;r++){if(o<=1)return 1;let s=o-1;for(;n>=0&&t[n].startLineNumber>s;)n--;if(n>=0&&t[n].endLineNumber>=s&&(s=t[n].startLineNumber-1),s<1)return o;o=s}return o}static _moveToViewPosition(i,e,t,o,n){return Ps.fromViewState(e.viewState.move(t,o,n,0))}static _moveToModelPosition(i,e,t,o,n){return Ps.fromModelState(e.modelState.move(t,o,n,0))}static _moveToViewMinColumn(i,e,t){let o=[];for(let n=0,r=e.length;n<r;n++){let s=e[n],l=s.viewState.position.lineNumber,c=i.getLineMinColumn(l);o[n]=this._moveToViewPosition(i,s,t,l,c)}return o}static _moveToViewFirstNonWhitespaceColumn(i,e,t){let o=[];for(let n=0,r=e.length;n<r;n++){let s=e[n],l=s.viewState.position.lineNumber,c=i.getLineFirstNonWhitespaceColumn(l);o[n]=this._moveToViewPosition(i,s,t,l,c)}return o}static _moveToViewCenterColumn(i,e,t){let o=[];for(let n=0,r=e.length;n<r;n++){let s=e[n],l=s.viewState.position.lineNumber,c=Math.round((i.getLineMaxColumn(l)+i.getLineMinColumn(l))/2);o[n]=this._moveToViewPosition(i,s,t,l,c)}return o}static _moveToViewMaxColumn(i,e,t){let o=[];for(let n=0,r=e.length;n<r;n++){let s=e[n],l=s.viewState.position.lineNumber,c=i.getLineMaxColumn(l);o[n]=this._moveToViewPosition(i,s,t,l,c)}return o}static _moveToViewLastNonWhitespaceColumn(i,e,t){let o=[];for(let n=0,r=e.length;n<r;n++){let s=e[n],l=s.viewState.position.lineNumber,c=i.getLineLastNonWhitespaceColumn(l);o[n]=this._moveToViewPosition(i,s,t,l,c)}return o}},vs;(s=>{let a=function(l){if(!yi(l))return!1;let c=l;return!(!Ae(c.to)||!cn(c.select)&&!Da(c.select)||!cn(c.by)&&!Ae(c.by)||!cn(c.value)&&!Xo(c.value)||!cn(c.noHistory)&&!Da(c.noHistory))};s.metadata={description:"Move cursor to a logical position in the view",args:[{name:"Cursor move argument object",description:`Property-value pairs that can be passed through this argument:
* 'to': A mandatory logical position value providing where to move the cursor.
\`\`\`
'left', 'right', 'up', 'down', 'prevBlankLine', 'nextBlankLine',
'wrappedLineStart', 'wrappedLineEnd', 'wrappedLineColumnCenter'
'wrappedLineFirstNonWhitespaceCharacter', 'wrappedLineLastNonWhitespaceCharacter'
'viewPortTop', 'viewPortCenter', 'viewPortBottom', 'viewPortIfOutside'
\`\`\`
* 'by': Unit to move. Default is computed based on 'to' value.
\`\`\`
'line', 'wrappedLine', 'character', 'halfLine', 'foldedLine'
\`\`\`
Use 'foldedLine' with 'up'/'down' to move by logical lines while treating each
folded region as a single step.
* 'value': Number of units to move. Default is '1'.
* 'select': If 'true' makes the selection. Default is 'false'.
* 'noHistory': If 'true' does not add the movement to navigation history. Default is 'false'.
`,constraint:a,schema:{type:"object",required:["to"],properties:{to:{type:"string",enum:["left","right","up","down","prevBlankLine","nextBlankLine","wrappedLineStart","wrappedLineEnd","wrappedLineColumnCenter","wrappedLineFirstNonWhitespaceCharacter","wrappedLineLastNonWhitespaceCharacter","viewPortTop","viewPortCenter","viewPortBottom","viewPortIfOutside"]},by:{type:"string",enum:["line","wrappedLine","character","halfLine","foldedLine"]},value:{type:"number",default:1},select:{type:"boolean",default:!1},noHistory:{type:"boolean",default:!1}}}}]},s.RawDirection={Left:"left",Right:"right",Up:"up",Down:"down",PrevBlankLine:"prevBlankLine",NextBlankLine:"nextBlankLine",WrappedLineStart:"wrappedLineStart",WrappedLineFirstNonWhitespaceCharacter:"wrappedLineFirstNonWhitespaceCharacter",WrappedLineColumnCenter:"wrappedLineColumnCenter",WrappedLineEnd:"wrappedLineEnd",WrappedLineLastNonWhitespaceCharacter:"wrappedLineLastNonWhitespaceCharacter",ViewPortTop:"viewPortTop",ViewPortCenter:"viewPortCenter",ViewPortBottom:"viewPortBottom",ViewPortIfOutside:"viewPortIfOutside"},s.RawUnit={Line:"line",WrappedLine:"wrappedLine",Character:"character",HalfLine:"halfLine",FoldedLine:"foldedLine"};function o(l){if(!l.to)return null;let c;switch(l.to){case s.RawDirection.Left:c=0;break;case s.RawDirection.Right:c=1;break;case s.RawDirection.Up:c=2;break;case s.RawDirection.Down:c=3;break;case s.RawDirection.PrevBlankLine:c=4;break;case s.RawDirection.NextBlankLine:c=5;break;case s.RawDirection.WrappedLineStart:c=6;break;case s.RawDirection.WrappedLineFirstNonWhitespaceCharacter:c=7;break;case s.RawDirection.WrappedLineColumnCenter:c=8;break;case s.RawDirection.WrappedLineEnd:c=9;break;case s.RawDirection.WrappedLineLastNonWhitespaceCharacter:c=10;break;case s.RawDirection.ViewPortTop:c=11;break;case s.RawDirection.ViewPortBottom:c=13;break;case s.RawDirection.ViewPortCenter:c=12;break;case s.RawDirection.ViewPortIfOutside:c=14;break;default:return null}let u=0;switch(l.by){case s.RawUnit.Line:u=1;break;case s.RawUnit.WrappedLine:u=2;break;case s.RawUnit.Character:u=3;break;case s.RawUnit.HalfLine:u=4;break;case s.RawUnit.FoldedLine:u=5;break}return{direction:c,unit:u,select:!!l.select,value:l.value||1,noHistory:!!l.noHistory}}s.parse=o;let n;(O=>(O[O.Left=0]="Left",O[O.Right=1]="Right",O[O.Up=2]="Up",O[O.Down=3]="Down",O[O.PrevBlankLine=4]="PrevBlankLine",O[O.NextBlankLine=5]="NextBlankLine",O[O.WrappedLineStart=6]="WrappedLineStart",O[O.WrappedLineFirstNonWhitespaceCharacter=7]="WrappedLineFirstNonWhitespaceCharacter",O[O.WrappedLineColumnCenter=8]="WrappedLineColumnCenter",O[O.WrappedLineEnd=9]="WrappedLineEnd",O[O.WrappedLineLastNonWhitespaceCharacter=10]="WrappedLineLastNonWhitespaceCharacter",O[O.ViewPortTop=11]="ViewPortTop",O[O.ViewPortCenter=12]="ViewPortCenter",O[O.ViewPortBottom=13]="ViewPortBottom",O[O.ViewPortIfOutside=14]="ViewPortIfOutside"))(n=s.Direction||={});let r;(f=>(f[f.None=0]="None",f[f.Line=1]="Line",f[f.WrappedLine=2]="WrappedLine",f[f.Character=3]="Character",f[f.HalfLine=4]="HalfLine",f[f.FoldedLine=5]="FoldedLine"))(r=s.Unit||={})})(vs||={});var pSe=class{constructor(i){this._neutralCharacter=null;this._neutralCharacterSearched=!1;if(this.open=i.open,this.close=i.close,this._inString=!0,this._inComment=!0,this._inRegEx=!0,Array.isArray(i.notIn))for(let e=0,t=i.notIn.length;e<t;e++)switch(i.notIn[e]){case"string":this._inString=!1;break;case"comment":this._inComment=!1;break;case"regex":this._inRegEx=!1;break}}isOK(i){switch(i){case 0:return!0;case 1:return this._inComment;case 2:return this._inString;case 3:return this._inRegEx}}shouldAutoClose(i,e){if(i.getTokenCount()===0)return!0;let t=i.findTokenIndexAtOffset(e-2),o=i.getStandardTokenType(t);return this.isOK(o)}_findNeutralCharacterInRange(i,e){for(let t=i;t<=e;t++){let o=String.fromCharCode(t);if(!this.open.includes(o)&&!this.close.includes(o))return o}return null}findNeutralCharacter(){return this._neutralCharacterSearched||(this._neutralCharacterSearched=!0,this._neutralCharacter||(this._neutralCharacter=this._findNeutralCharacterInRange(48,57)),this._neutralCharacter||(this._neutralCharacter=this._findNeutralCharacterInRange(97,122)),this._neutralCharacter||(this._neutralCharacter=this._findNeutralCharacterInRange(65,90))),this._neutralCharacter}},Nmt=class{constructor(i){this.autoClosingPairsOpenByStart=new Map,this.autoClosingPairsOpenByEnd=new Map,this.autoClosingPairsCloseByStart=new Map,this.autoClosingPairsCloseByEnd=new Map,this.autoClosingPairsCloseSingleChar=new Map;for(let e of i)XGe(this.autoClosingPairsOpenByStart,e.open.charAt(0),e),XGe(this.autoClosingPairsOpenByEnd,e.open.charAt(e.open.length-1),e),XGe(this.autoClosingPairsCloseByStart,e.close.charAt(0),e),XGe(this.autoClosingPairsCloseByEnd,e.close.charAt(e.close.length-1),e),e.close.length===1&&e.open.length===1&&XGe(this.autoClosingPairsCloseSingleChar,e.close,e)}};function XGe(a,i,e){a.has(i)?a.get(i).push(e):a.set(i,[e])}var Omt=class a{static{this.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_QUOTES=`;:.,=}])>
`}static{this.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_BRACKETS=`'"\`;:.,=}])>
`}static{this.DEFAULT_AUTOCLOSE_BEFORE_WHITESPACE=`
`}constructor(i){if(i.autoClosingPairs?this._autoClosingPairs=i.autoClosingPairs.map(e=>new pSe(e)):i.brackets?this._autoClosingPairs=i.brackets.map(e=>new pSe({open:e[0],close:e[1]})):this._autoClosingPairs=[],i.__electricCharacterSupport&&i.__electricCharacterSupport.docComment){let e=i.__electricCharacterSupport.docComment;this._autoClosingPairs.push(new pSe({open:e.open,close:e.close||""}))}this._autoCloseBeforeForQuotes=typeof i.autoCloseBefore=="string"?i.autoCloseBefore:a.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_QUOTES,this._autoCloseBeforeForBrackets=typeof i.autoCloseBefore=="string"?i.autoCloseBefore:a.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_BRACKETS,this._surroundingPairs=i.surroundingPairs||this._autoClosingPairs}getAutoClosingPairs(){return this._autoClosingPairs}getAutoCloseBeforeSet(i){return i?this._autoCloseBeforeForQuotes:this._autoCloseBeforeForBrackets}getSurroundingPairs(){return this._surroundingPairs}};var wYt;function CKi(){return wYt||(wYt=new TextDecoder("UTF-16LE")),wYt}var CYt;function dMo(){return CYt||(CYt=new TextDecoder("UTF-16BE")),CYt}var xYt;function kYt(){return xYt||(xYt=lGe()?CKi():dMo()),xYt}function xKi(a,i,e){let t=new Uint16Array(a.buffer,i,e);return e>0&&(t[0]===65279||t[0]===65534)?uMo(a,i,e):CKi().decode(t)}function uMo(a,i,e){let t=[],o=0;for(let n=0;n<e;n++){let r=U1i(a,i);i+=2,t[o++]=String.fromCharCode(r)}return t.join("")}var ES=class{constructor(i){this._capacity=i|0,this._buffer=new Uint16Array(this._capacity),this._completedStrings=null,this._bufferLength=0}reset(){this._completedStrings=null,this._bufferLength=0}build(){return this._completedStrings!==null?(this._flushBuffer(),this._completedStrings.join("")):this._buildBuffer()}_buildBuffer(){if(this._bufferLength===0)return"";let i=new Uint16Array(this._buffer.buffer,0,this._bufferLength);return kYt().decode(i)}_flushBuffer(){let i=this._buildBuffer();this._bufferLength=0,this._completedStrings===null?this._completedStrings=[i]:this._completedStrings[this._completedStrings.length]=i}appendCharCode(i){let e=this._capacity-this._bufferLength;e<=1&&(e===0||Ru(i))&&this._flushBuffer(),this._buffer[this._bufferLength++]=i}appendASCIICharCode(i){this._bufferLength===this._capacity&&this._flushBuffer(),this._buffer[this._bufferLength++]=i}appendString(i){let e=i.length;if(this._bufferLength+e>=this._capacity){this._flushBuffer(),this._completedStrings[this._completedStrings.length]=i;return}for(let t=0;t<e;t++)this._buffer[this._bufferLength++]=i.charCodeAt(t)}};var EYt=class a{constructor(i,e,t,o,n,r){this._richEditBracketBrand=void 0;this.languageId=i,this.index=e,this.open=t,this.close=o,this.forwardRegex=n,this.reversedRegex=r,this._openSet=a._toSet(this.open),this._closeSet=a._toSet(this.close)}isOpen(i){return this._openSet.has(i)}isClose(i){return this._closeSet.has(i)}static _toSet(i){let e=new Set;for(let t of i)e.add(t);return e}};function mMo(a){let i=a.length;a=a.map(r=>[r[0].toLowerCase(),r[1].toLowerCase()]);let e=[];for(let r=0;r<i;r++)e[r]=r;let t=(r,s)=>{let[l,c]=r,[u,p]=s;return l===u||l===p||c===u||c===p},o=(r,s)=>{let l=Math.min(r,s),c=Math.max(r,s);for(let u=0;u<i;u++)e[u]===c&&(e[u]=l)};for(let r=0;r<i;r++){let s=a[r];for(let l=r+1;l<i;l++){let c=a[l];t(s,c)&&o(e[r],e[l])}}let n=[];for(let r=0;r<i;r++){let s=[],l=[];for(let c=0;c<i;c++)if(e[c]===r){let[u,p]=a[c];s.push(u),l.push(p)}s.length>0&&n.push({open:s,close:l})}return n}var Fmt=class{constructor(i,e){this._richEditBracketsBrand=void 0;let t=mMo(e);this.brackets=t.map((o,n)=>new EYt(i,n,o.open,o.close,hMo(o.open,o.close,t,n),gMo(o.open,o.close,t,n))),this.forwardRegex=fMo(this.brackets),this.reversedRegex=vMo(this.brackets),this.textIsBracket={},this.textIsOpenBracket={},this.maxBracketLength=0;for(let o of this.brackets){for(let n of o.open)this.textIsBracket[n]=o,this.textIsOpenBracket[n]=!0,this.maxBracketLength=Math.max(this.maxBracketLength,n.length);for(let n of o.close)this.textIsBracket[n]=o,this.textIsOpenBracket[n]=!1,this.maxBracketLength=Math.max(this.maxBracketLength,n.length)}}};function kKi(a,i,e,t){for(let o=0,n=i.length;o<n;o++){if(o===e)continue;let r=i[o];for(let s of r.open)s.indexOf(a)>=0&&t.push(s);for(let s of r.close)s.indexOf(a)>=0&&t.push(s)}}function EKi(a,i){return a.length-i.length}function Wmt(a){if(a.length<=1)return a;let i=[],e=new Set;for(let t of a)e.has(t)||(i.push(t),e.add(t));return i}function hMo(a,i,e,t){let o=[];o=o.concat(a),o=o.concat(i);for(let n=0,r=o.length;n<r;n++)kKi(o[n],e,t,o);return o=Wmt(o),o.sort(EKi),o.reverse(),mSe(o)}function gMo(a,i,e,t){let o=[];o=o.concat(a),o=o.concat(i);for(let n=0,r=o.length;n<r;n++)kKi(o[n],e,t,o);return o=Wmt(o),o.sort(EKi),o.reverse(),mSe(o.map(TYt))}function fMo(a){let i=[];for(let e of a){for(let t of e.open)i.push(t);for(let t of e.close)i.push(t)}return i=Wmt(i),mSe(i)}function vMo(a){let i=[];for(let e of a){for(let t of e.open)i.push(t);for(let t of e.close)i.push(t)}return i=Wmt(i),mSe(i.map(TYt))}function bMo(a){let i=/^[\w ]+$/.test(a);return a=Yr(a),i?`\\b${a}\\b`:a}function mSe(a,i){let e=`(${a.map(bMo).join(")|(")})`;return u$(e,!0,i)}var TYt=(function(){function a(t){let o=new Uint16Array(t.length),n=0;for(let r=t.length-1;r>=0;r--)o[n++]=t.charCodeAt(r);return kYt().decode(o)}let i=null,e=null;return function(o){return i!==o&&(i=o,e=a(i)),e}})(),jk=class{static _findPrevBracketInText(i,e,t,o){let n=t.match(i);if(!n)return null;let r=t.length-(n.index||0),s=n[0].length,l=o+r;return new z(e,l-s+1,e,l+1)}static findPrevBracketInRange(i,e,t,o,n){let s=TYt(t).substring(t.length-n,t.length-o);return this._findPrevBracketInText(i,e,s,o)}static findNextBracketInText(i,e,t,o){let n=t.match(i);if(!n)return null;let r=n.index||0,s=n[0].length;if(s===0)return null;let l=o+r;return new z(e,l+1,e,l+1+s)}static findNextBracketInRange(i,e,t,o,n){let r=t.substring(o,n);return this.findNextBracketInText(i,e,r,o)}};var Vmt=class{constructor(i){this._richEditBrackets=i}getElectricCharacters(){let i=[];if(this._richEditBrackets)for(let e of this._richEditBrackets.brackets)for(let t of e.close){let o=t.charAt(t.length-1);i.push(o)}return Uo(i)}onElectricCharacter(i,e,t){if(!this._richEditBrackets||this._richEditBrackets.brackets.length===0)return null;let o=e.findTokenIndexAtOffset(t-1);if(IN(e.getStandardTokenType(o)))return null;let n=this._richEditBrackets.reversedRegex,r=e.getLineContent().substring(0,t-1)+i,s=jk.findPrevBracketInRange(n,1,r,0,r.length);if(!s)return null;let l=r.substring(s.startColumn-1,s.endColumn-1).toLowerCase();if(this._richEditBrackets.textIsOpenBracket[l])return null;let u=e.getActualLineContentBefore(s.startColumn-1);return/^\s*$/.test(u)?{matchOpenBracket:l}:null}};function Bmt(a){return a.global&&(a.lastIndex=0),!0}var Hmt=class{constructor(i){this._indentationRules=i}shouldIncrease(i){return!!(this._indentationRules&&this._indentationRules.increaseIndentPattern&&Bmt(this._indentationRules.increaseIndentPattern)&&this._indentationRules.increaseIndentPattern.test(i))}shouldDecrease(i){return!!(this._indentationRules&&this._indentationRules.decreaseIndentPattern&&Bmt(this._indentationRules.decreaseIndentPattern)&&this._indentationRules.decreaseIndentPattern.test(i))}shouldIndentNextLine(i){return!!(this._indentationRules&&this._indentationRules.indentNextLinePattern&&Bmt(this._indentationRules.indentNextLinePattern)&&this._indentationRules.indentNextLinePattern.test(i))}shouldIgnore(i){return!!(this._indentationRules&&this._indentationRules.unIndentedLinePattern&&Bmt(this._indentationRules.unIndentedLinePattern)&&this._indentationRules.unIndentedLinePattern.test(i))}getIndentMetadata(i){let e=0;return this.shouldIncrease(i)&&(e+=1),this.shouldDecrease(i)&&(e+=2),this.shouldIndentNextLine(i)&&(e+=4),this.shouldIgnore(i)&&(e+=8),e}};var Umt=class a{constructor(i){i=i||{},i.brackets=i.brackets||[["(",")"],["{","}"],["[","]"]],this._brackets=[],i.brackets.forEach(e=>{let t=a._createOpenBracketRegExp(e[0]),o=a._createCloseBracketRegExp(e[1]);t&&o&&this._brackets.push({open:e[0],openRegExp:t,close:e[1],closeRegExp:o})}),this._regExpRules=i.onEnterRules||[]}onEnter(i,e,t,o){if(i>=3)for(let n=0,r=this._regExpRules.length;n<r;n++){let s=this._regExpRules[n];if([{reg:s.beforeText,text:t},{reg:s.afterText,text:o},{reg:s.previousLineText,text:e}].every(c=>c.reg?(c.reg.lastIndex=0,c.reg.test(c.text)):!0))return s.action}if(i>=2&&t.length>0&&o.length>0)for(let n=0,r=this._brackets.length;n<r;n++){let s=this._brackets[n];if(s.openRegExp.test(t)&&s.closeRegExp.test(o))return{indentAction:2}}if(i>=2&&t.length>0){for(let n=0,r=this._brackets.length;n<r;n++)if(this._brackets[n].openRegExp.test(t))return{indentAction:1}}return null}static _createOpenBracketRegExp(i){let e=Yr(i);return/\B/.test(e.charAt(0))||(e="\\b"+e),e+="\\s*$",a._safeRegExp(e)}static _createCloseBracketRegExp(i){let e=Yr(i);return/\B/.test(e.charAt(e.length-1))||(e=e+"\\b"),e="^\\s*"+e,a._safeRegExp(e)}static _safeRegExp(i){try{return new RegExp(i)}catch(e){return mt(e),null}}};var B=ae("configurationService");function ZGe(a){let i=a;return i&&typeof i=="object"&&(!i.overrideIdentifier||typeof i.overrideIdentifier=="string")&&(!i.resource||i.resource instanceof A)}function _Yt(a){let i=a;return i&&typeof i=="object"&&(!i.overrideIdentifiers||Array.isArray(i.overrideIdentifiers))&&!i.overrideIdentifier&&(!i.resource||i.resource instanceof A)}function ise(a){switch(a){case 1:return"APPLICATION";case 2:return"USER";case 3:return"USER_LOCAL";case 4:return"USER_REMOTE";case 5:return"WORKSPACE";case 6:return"WORKSPACE_FOLDER";case 7:return"DEFAULT";case 8:return"MEMORY"}}function ose(a,i){switch(i){case 1:return a.applicationValue;case 2:return a.userValue;case 3:return a.userLocalValue;case 4:return a.userRemoteValue;case 5:return a.workspaceValue;case 6:return a.workspaceFolderValue;case 7:return a.defaultValue;case 8:return a.memoryValue;default:Hr(i)}}function e$e(a){return a.applicationValue!==void 0||a.userValue!==void 0||a.userLocalValue!==void 0||a.userRemoteValue!==void 0||a.workspaceValue!==void 0||a.workspaceFolderValue!==void 0}function hSe(a,i){let e=Object.create(null);for(let t in a)DYt(e,t,a[t],i);return e}function DYt(a,i,e,t){let o=i.split("."),n=o.pop(),r=a;for(let s=0;s<o.length;s++){let l=o[s],c=r[l];switch(typeof c){case"undefined":c=r[l]=Object.create(null);break;case"object":if(c===null){t(`Ignoring ${i} as ${o.slice(0,s+1).join(".")} is null`);return}break;default:t(`Ignoring ${i} as ${o.slice(0,s+1).join(".")} is ${JSON.stringify(c)}`);return}r=c}if(typeof r=="object"&&r!==null)try{r[n]=e}catch{t(`Ignoring ${i} as ${o.join(".")} is ${JSON.stringify(r)}`)}else t(`Ignoring ${i} as ${o.join(".")} is ${JSON.stringify(r)}`)}function TKi(a,i){let e=i.split(".");_Ki(a,e)}function _Ki(a,i){if(!a)return;let e=a,t=i.shift();if(i.length===0){delete e[t];return}if(Object.keys(e).indexOf(t)!==-1){let o=e[t];typeof o=="object"&&!Array.isArray(o)&&(_Ki(o,i),Object.keys(o).length===0&&delete e[t])}}function t$e(a,i,e){function t(r,s){let l=r;for(let c of s){if(typeof l!="object"||l===null)return;l=l[c]}return l}let o=i.split("."),n=t(a,o);return typeof n>"u"?e:n}function gSe(a){return a.replace(/^\[/,"").replace(/]$/g,"").replace(/\]\[/g,", ")}var kt=ae("languageService");var Mt=class{constructor(i,e=[],t=!1){this.ctor=i,this.staticArguments=e,this.supportsDelayedInstantiation=t}};var DKi=[];function we(a,i,e){i instanceof Mt||(i=new Mt(i,[],!!e)),DKi.push([a,i])}function LKi(){return DKi}var Zn=Object.freeze({text:"text/plain",binary:"application/octet-stream",unknown:"application/unknown",markdown:"text/markdown",latex:"text/latex",uriList:"text/uri-list",html:"text/html"}),SMo={".css":"text/css",".csv":"text/csv",".htm":"text/html",".html":"text/html",".ics":"text/calendar",".js":"text/javascript",".mjs":"text/javascript",".txt":"text/plain",".xml":"text/xml"},LYt={".aac":"audio/x-aac",".avi":"video/x-msvideo",".bmp":"image/bmp",".flv":"video/x-flv",".gif":"image/gif",".ico":"image/x-icon",".jpe":["image/jpg","image/jpeg"],".jpeg":["image/jpg","image/jpeg"],".jpg":["image/jpg","image/jpeg"],".m1v":"video/mpeg",".m2a":"audio/mpeg",".m2v":"video/mpeg",".m3a":"audio/mpeg",".mid":"audio/midi",".midi":"audio/midi",".mk3d":"video/x-matroska",".mks":"video/x-matroska",".mkv":"video/x-matroska",".mov":"video/quicktime",".movie":"video/x-sgi-movie",".mp2":"audio/mpeg",".mp2a":"audio/mpeg",".mp3":"audio/mpeg",".mp4":"video/mp4",".mp4a":"audio/mp4",".mp4v":"video/mp4",".mpe":"video/mpeg",".mpeg":"video/mpeg",".mpg":"video/mpeg",".mpg4":"video/mp4",".mpga":"audio/mpeg",".oga":"audio/ogg",".ogg":"audio/ogg",".opus":"audio/opus",".ogv":"video/ogg",".png":"image/png",".psd":"image/vnd.adobe.photoshop",".qt":"video/quicktime",".spx":"audio/ogg",".svg":"image/svg+xml",".tga":"image/x-tga",".tif":"image/tiff",".tiff":"image/tiff",".wav":"audio/x-wav",".webm":"video/webm",".webp":"image/webp",".wma":"audio/x-ms-wma",".wmv":"video/x-ms-wmv",".woff":"application/font-woff"};function RKi(a){let i=Am(a),e=SMo[i.toLowerCase()];return e!==void 0?e:i$e(a)}function i$e(a){let i=Am(a),e=LYt[i.toLowerCase()];return Array.isArray(e)?e[0]:e}function K6(a){for(let i in LYt){let e=LYt[i];if(Array.isArray(e)?e.includes(a):e===a)return i}}var IMo=/^(.+)\/(.+?)(;.+)?$/;function RYt(a,i){let e=IMo.exec(a);return e?`${e[1].toLowerCase()}/${e[2].toLowerCase()}${e[3]??""}`:i?void 0:a}function oL(a){return["application/vnd.code.notebook.stdout","application/vnd.code.notebook.stderr"].includes(a)}function MKi(a){let i=!1,e=new Map,t=new Map;if(yMo(a,u=>{if(a===u)return!0;let p=JSON.stringify(u);if(p.length<30)return!0;let h=e.get(p);if(!h){let g={schemas:[u]};return e.set(p,g),t.set(u,g),!0}return h.schemas.push(u),t.set(u,h),i=!0,!1}),e.clear(),!i)return JSON.stringify(a);let n="$defs";for(;a.hasOwnProperty(n);)n+="_";let r=[];function s(u){return JSON.stringify(u,(p,h)=>{if(h!==u){let g=t.get(h);if(g&&g.schemas.length>1)return g.id||(g.id=`_${r.length}`,r.push(g.schemas[0])),{$ref:`#/${n}/${g.id}`}}return h})}let l=s(a),c=[];for(let u=0;u<r.length;u++)c.push(`"_${u}":${s(r[u])}`);return c.length?`${l.substring(0,l.length-1)},"${n}":{${c.join(",")}}}`:l}function fSe(a){return typeof a=="object"&&a!==null}function yMo(a,i){if(!a||typeof a!="object")return;let e=(...l)=>{for(let c of l)fSe(c)&&r.push(c)},t=(...l)=>{for(let c of l)if(fSe(c))for(let u in c){let p=c[u];fSe(p)&&r.push(p)}},o=(...l)=>{for(let c of l)if(Array.isArray(c))for(let u of c)fSe(u)&&r.push(u)},n=l=>{if(Array.isArray(l))for(let c of l)fSe(c)&&r.push(c);else fSe(l)&&r.push(l)},r=[a],s=r.pop();for(;s;)i(s)&&(e(s.additionalItems,s.additionalProperties,s.not,s.contains,s.propertyNames,s.if,s.then,s.else,s.unevaluatedItems,s.unevaluatedProperties),t(s.definitions,s.$defs,s.properties,s.patternProperties,s.dependencies,s.dependentSchemas),o(s.anyOf,s.allOf,s.oneOf,s.prefixItems),n(s.items)),s=r.pop()}var ea={JSONContribution:"base.contributions.json"};function PKi(a){return a.length>0&&a.charAt(a.length-1)==="#"?a.substring(0,a.length-1):a}var MYt=class extends C{constructor(){super(...arguments);this.schemasById={};this.schemaAssociations={};this._onDidChangeSchema=this._register(new E);this.onDidChangeSchema=this._onDidChangeSchema.event;this._onDidChangeSchemaAssociations=this._register(new E);this.onDidChangeSchemaAssociations=this._onDidChangeSchemaAssociations.event}registerSchema(e,t,o){let n=PKi(e);this.schemasById[n]=t,this._onDidChangeSchema.fire(e),o&&o.add(Z(()=>{delete this.schemasById[n],this._onDidChangeSchema.fire(e)}))}registerSchemaAssociation(e,t){let o=PKi(e);return this.schemaAssociations[o]||(this.schemaAssociations[o]=[]),this.schemaAssociations[o].includes(t)||(this.schemaAssociations[o].push(t),this._onDidChangeSchemaAssociations.fire()),Z(()=>{let n=this.schemaAssociations[o];if(n){let r=n.indexOf(t);r!==-1&&(n.splice(r,1),n.length===0&&delete this.schemaAssociations[o],this._onDidChangeSchemaAssociations.fire())}})}notifySchemaChanged(e){this._onDidChangeSchema.fire(e)}getSchemaContributions(){return{schemas:this.schemasById}}getSchemaContent(e){let t=this.schemasById[e];return t?MKi(t):void 0}hasSchemaContent(e){return!!this.schemasById[e]}getSchemaAssociations(){return this.schemaAssociations}},wMo=new MYt;oe.add(ea.JSONContribution,wMo);var nL,PYt=globalThis.vscode;if(typeof PYt<"u"&&typeof PYt.context<"u"){let a=PYt.context.configuration();if(a)nL=a.product;else throw new Error("Sandbox: unable to resolve product configuration from preload script.")}else if(globalThis._VSCODE_PRODUCT_JSON&&globalThis._VSCODE_PACKAGE_JSON){if(nL=globalThis._VSCODE_PRODUCT_JSON,fp.VSCODE_DEV&&Object.assign(nL,{nameShort:`${nL.nameShort} Dev`,nameLong:`${nL.nameLong} Dev`,dataFolderName:`${nL.dataFolderName}-dev`,serverDataFolderName:nL.serverDataFolderName?`${nL.serverDataFolderName}-dev`:void 0}),!nL.version){let a=globalThis._VSCODE_PACKAGE_JSON;Object.assign(nL,{version:a.version})}}else nL={nameShort:"Code",nameLong:"Visual Studio Code",applicationName:"code",win32x64AppId:"{{EA457B21-F73E-494C-ACAB-524FDE069978}",win32arm64AppId:"{{A5270FC5-65AD-483E-AC30-2C276B63D0AC}",win32x64UserAppId:"{{771FD6B0-FA20-440A-A002-3B3BAC16DC50}",win32arm64UserAppId:"{{D9E514E7-1A56-452D-9337-2990C0DC4310}",win32NameVersion:"Microsoft Visual Studio Code",win32DirName:"Microsoft VS Code",win32SetupExeBasename:"VSCodeSetup",win32AppUserModelId:"Microsoft.VisualStudioCode",win32ShellNameShort:"Code",win32MutexName:"vscode",win32RegValueName:"VSCode",win32VersionedUpdate:!0,darwinCredits:"resources/darwin/Credits.rtf",darwinBundleIdentifier:"com.microsoft.VSCode",darwinProfileUUID:"EBAE60D6-C8A2-4419-92FF-24F8AD5077AB",darwinProfilePayloadUUID:"C6B5723A-6539-4F31-8A4E-3CC96E51F48C",darwinExecutable:"VSCode",linuxIconName:"vscode",licenseFileName:"LICENSE.rtf",licenseName:"Multiple, see https://code.visualstudio.com/license",serverGreeting:[],serverLicense:["*","* Visual Studio Code Server","*","* By using the software, you agree to","* the Visual Studio Code Server License Terms (https://aka.ms/vscode-server-license) and","* the Microsoft Privacy Statement (https://privacy.microsoft.com/en-US/privacystatement).","*"],serverLicensePrompt:"Do you accept the terms in the License Agreement (Y/n)?",serverApplicationName:"code-server",urlProtocol:"vscode",dataFolderName:".vscode",serverDataFolderName:".vscode-server",downloadUrl:"https://code.visualstudio.com",updateUrl:"https://update.code.visualstudio.com",webUrl:"https://vscode.dev",webEndpointUrl:"https://main.vscode-cdn.net",webEndpointUrlTemplate:"https://{{uuid}}.vscode-cdn.net/{{quality}}/{{commit}}",nlsCoreBaseUrl:"https://www.vscode-unpkg.net/nls/",webviewContentExternalBaseUrlTemplate:"https://{{uuid}}.vscode-cdn.net/{{quality}}/{{commit}}/out/vs/workbench/contrib/webview/browser/pre/",quality:"stable",embedded:{nameShort:"Sessions",nameLong:"Visual Studio Code Sessions",applicationName:"sessions",win32AppUserModelId:"Microsoft.VisualStudioCodeSessions",win32MutexName:"vscodesessions",win32RegValueName:"VSCodeSessions",win32NameVersion:"Microsoft Visual Studio Code Sessions",win32VersionedUpdate:!0,darwinBundleIdentifier:"com.microsoft.VSCodeSessions",dataFolderName:".vscode-sessions",urlProtocol:"vscode-sessions",inheritAuthAccountPreference:{"github.copilot":["github.copilot-chat"],"vscode.github":["github.copilot-chat"]}},extensionsGallery:{nlsBaseUrl:"https://www.vscode-unpkg.net/_lp/",serviceUrl:"https://marketplace.visualstudio.com/_apis/public/gallery",itemUrl:"https://marketplace.visualstudio.com/items",publisherUrl:"https://marketplace.visualstudio.com/publishers",resourceUrlTemplate:"https://{publisher}.vscode-unpkg.net/{publisher}/{name}/{version}/{path}",extensionUrlTemplate:"https://www.vscode-unpkg.net/_gallery/{publisher}/{name}/latest",controlUrl:"https://main.vscode-cdn.net/extensions/marketplace.json",mcpUrl:"https://main.vscode-cdn.net/mcp/servers.json",accessSKUs:["copilot_enterprise_seat","copilot_enterprise_seat_quota","copilot_enterprise_seat_multi_quota","copilot_enterprise_seat_assignment","copilot_enterprise_seat_assignment_quota","copilot_enterprise_seat_assignment_multi_quota","copilot_enterprise_trial_seat","copilot_enterprise_trial_seat_quota","copilot_for_business_seat","copilot_for_business_seat_quota","copilot_for_business_seat_multi_quota","copilot_for_business_seat_assignment","copilot_for_business_seat_assignment_quota","copilot_for_business_seat_assignment_multi_quota","copilot_for_business_trial_seat","copilot_for_business_trial_seat_quota"]},mcpGallery:{serviceUrl:"https://api.mcp.github.com",itemWebUrl:"https://github.com/mcp/{name}",publisherUrl:"https://github.com/{name}",supportUrl:"https://support.github.com",privacyPolicyUrl:"https://docs.github.com/site-policy/privacy-policies/github-general-privacy-statement",termsOfServiceUrl:"https://docs.github.com/site-policy/github-terms/github-terms-of-service",reportUrl:"https://docs.github.com/communities/maintaining-your-safety-on-github/reporting-abuse-or-spam"},extensionProperties:{"github.copilot-chat":{hasPrereleaseVersion:!1,excludeVersionRange:"<=0.16.1"},"github.copilot":{hasPrereleaseVersion:!0}},extensionsForceVersionByQuality:["github.copilot-chat","github.copilot"],profileTemplatesUrl:"https://main.vscode-cdn.net/core/profile-templates.json",emergencyAlertUrl:"https://main.vscode-cdn.net/core/stable.json",extensionPublisherOrgs:["microsoft"],trustedExtensionPublishers:["microsoft","github","openai"],extensionRecommendations:{"ms-dotnettools.csdevkit":{onFileOpen:[{pathGlob:"{**/*.cs,**/global.json,**/*.csproj,**/*.cshtml,**/*.sln}",important:!0},{languages:["csharp"],important:!0},{pathGlob:"{**/project.json,**/appsettings.json}"}]},"ms-python.python":{onFileOpen:[{pathGlob:"{**/*.py}",important:!0},{languages:["python"],important:!0},{pathGlob:"{**/*.ipynb}"}]},"ms-toolsai.jupyter":{onFileOpen:[{pathGlob:"{**/*.py}",contentPattern:"^#\\s*%%$",important:!0,whenInstalled:["ms-python.python"]},{pathGlob:"{**/*.ipynb}"}]},"ms-toolsai.datawrangler":{onFileOpen:[{pathGlob:"{**/*.ipynb}",contentPattern:"import\\s*pandas|from\\s*pandas",whenInstalled:["ms-toolsai.jupyter"]}]},"golang.Go":{onFileOpen:[{pathGlob:"**/*.go",important:!0},{languages:["go"],important:!0}]},"vscjava.vscode-java-pack":{onFileOpen:[{pathGlob:"{**/*.java}",important:!0,whenNotInstalled:["ASF.apache-netbeans-java","Oracle.oracle-java"]},{languages:["java"],important:!0,whenNotInstalled:["ASF.apache-netbeans-java","Oracle.oracle-java"]}]},"ms-vscode.PowerShell":{onFileOpen:[{pathGlob:"{**/*.ps1,**/*.psd1,**/*.psm1}",important:!0},{languages:["powershell"],important:!0},{pathGlob:"{**/*.ps.config,**/*.ps1.config}"}]},"ms-toolsai.prompty":{onFileOpen:[{pathGlob:"{**/*.prompty}",important:!1}]},"quantum.qsharp-lang-vscode":{onFileOpen:[{pathGlob:"{**/*.qs,**/*.qsc,**/*.qasm}",important:!0}]},"typespec.typespec-vscode":{onFileOpen:[{pathGlob:"{**/*.tsp,**/tspconfig.yaml}",important:!0}]},"ms-vscode.cpptools-extension-pack":{onFileOpen:[{pathGlob:"{**/*.c,**/*.cpp,**/*.cc,**/.cxx,**/*.hh,**/*.hpp,**/*.hxx,**/*.h}",important:!0,whenNotInstalled:["llvm-vs-code-extensions.vscode-clangd"]},{languages:["c","cpp"],important:!0,whenNotInstalled:["llvm-vs-code-extensions.vscode-clangd"]}]},"ms-azuretools.vscode-containers":{onFileOpen:[{pathGlob:"{**/dockerfile,**/Dockerfile,**/docker-compose.yml,**/docker-compose.*.yml}",important:!0,whenNotInstalled:["ms-azuretools.vscode-docker"]},{languages:["dockerfile"],important:!0,whenNotInstalled:["ms-azuretools.vscode-docker"]},{pathGlob:"{**/*.cs,**/project.json,**/global.json,**/*.csproj,**/*.cshtml,**/*.sln,**/appsettings.json,**/*.py,**/*.ipynb,**/*.js,**/*.ts,**/package.json}",whenNotInstalled:["ms-azuretools.vscode-docker"]}]},"vue.volar":{onFileOpen:[{pathGlob:"{**/*.vue}",important:!0},{languages:["vue"],important:!0}]},"ms-vscode.makefile-tools":{onFileOpen:[{pathGlob:"{**/makefile,**/Makefile}",important:!0},{languages:["makefile"],important:!0}]},"ms-vscode.cmake-tools":{onFileOpen:[{pathGlob:"{**/CMakeLists.txt}",important:!0}]},"ms-azure-devops.azure-pipelines":{onFileOpen:[{pathGlob:"{**/azure-pipelines.yaml}",important:!0}]},"msazurermtools.azurerm-vscode-tools":{onFileOpen:[{pathGlob:"{**/azuredeploy.json}",important:!0}]},"ms-vscode-remote.remote-containers":{onFileOpen:[{pathGlob:"{**/devcontainer.json}",important:!0}]},"ms-azuretools.vscode-bicep":{onFileOpen:[{pathGlob:"{**/*.bicep}",important:!0,whenNotInstalled:["ms-azuretools.rad-vscode-bicep"]}]},"svelte.svelte-vscode":{onFileOpen:[{pathGlob:"{**/*.svelte}",important:!0}]},"ms-vscode.vscode-github-issue-notebooks":{onFileOpen:[{pathGlob:"{**/*.github-issues}",important:!0}]},"ms-playwright.playwright":{onFileOpen:[{pathGlob:"{**/*playwright*.config.ts,**/*playwright*.config.js,**/*playwright*.config.mjs}",important:!0}]},"vscjava.vscode-gradle":{onFileOpen:[{pathGlob:"{**/gradlew,**/gradlew.bat,**/build.gradle,**/build.gradle.kts,**/settings.gradle,**/settings.gradle.kts}",important:!0}]},"REditorSupport.r":{onFileOpen:[{pathGlob:"{**/*.r}",important:!0},{languages:["r"],important:!0}]},"firefox-devtools.vscode-firefox-debug":{onFileOpen:[{pathGlob:"{**/*.ts,**/*.tsx,**/*.js,**/*.jsx,**/*.es6,**/.babelrc}"}]},"ms-edgedevtools.vscode-edge-devtools":{onFileOpen:[{pathGlob:"{**/*.ts,**/*.tsx,**/*.js,**/*.css,**/*.html}"}]},"Ionide.Ionide-fsharp":{onFileOpen:[{pathGlob:"{**/*.fsx,**/*.fsi,**/*.fs,**/*.ml,**/*.mli}"}]},"dbaeumer.vscode-eslint":{onFileOpen:[{pathGlob:"{**/*.js,**/*.jsx,**/*.es6,**/.eslintrc.*,**/.eslintrc,**/.babelrc,**/jsconfig.json}"}]},"bmewburn.vscode-intelephense-client":{onFileOpen:[{pathGlob:"{**/*.php,**/php.ini}"}]},"xdebug.php-debug":{onFileOpen:[{pathGlob:"{**/*.php,**/php.ini}"}]},"rust-lang.rust-analyzer":{onFileOpen:[{pathGlob:"{**/*.rs,**/*.rslib}"}]},"DavidAnson.vscode-markdownlint":{onFileOpen:[{pathGlob:"{**/*.md}"}]},"EditorConfig.EditorConfig":{onFileOpen:[{pathGlob:"{**/.editorconfig}"}]},"HookyQR.beautify":{onFileOpen:[{pathGlob:"{**/.jsbeautifyrc}"}]},"donjayamanne.githistory":{onFileOpen:[{pathGlob:"{**/.gitignore,**/.git}"}]},"eamodio.gitlens":{onFileOpen:[{pathGlob:"{**/.gitignore,**/.git}"}]},"Shopify.ruby-lsp":{onFileOpen:[{pathGlob:"{**/*.rb,**/*.erb,**/*.reek,**/.fasterer.yml,**/ruby-lint.yml,**/.rubocop.yml}"}]},"swiftlang.swift-vscode":{onFileOpen:[{pathGlob:"{**/*.swift,**/*.swiftinterface}",important:!0}]},"DotJoshJohnson.xml":{onFileOpen:[{pathGlob:"{**/*.xml}"}]},"stylelint.vscode-stylelint":{onFileOpen:[{pathGlob:"{**/.stylelintrc,**/stylelint.config.js}"}]},"ms-mssql.mssql":{onFileOpen:[{pathGlob:"{**/*.sql}"}]},"mtxr.sqltools":{onFileOpen:[{pathGlob:"{**/*.sql}"}]},"usqlextpublisher.usql-vscode-ext":{onFileOpen:[{pathGlob:"{**/*.usql}"}]},"ms-vscode.sublime-keybindings":{onFileOpen:[{pathGlob:"{**/.sublime-project,**/.sublime-workspace}"}]},"k--kato.intellij-idea-keybindings":{onFileOpen:[{pathGlob:"{**/.idea}"}]},"christian-kohler.npm-intellisense":{onFileOpen:[{pathGlob:"{**/package.json}"}]},"cake-build.cake-vscode":{onFileOpen:[{pathGlob:"{**/build.cake}"}]},"Angular.ng-template":{onFileOpen:[{pathGlob:"{**/.angular-cli.json,**/angular.json,**/*.ng.html,**/*.ng,**/*.ngml}"}]},"vscjava.vscode-maven":{onFileOpen:[{pathGlob:"**/pom.xml"}]},"ms-azuretools.vscode-azureterraform":{onFileOpen:[{pathGlob:"**/*.tf"}]},"HashiCorp.terraform":{onFileOpen:[{pathGlob:"**/*.tf"}]},"vsciot-vscode.vscode-arduino":{onFileOpen:[{pathGlob:"**/*.ino"}]},"ms-kubernetes-tools.vscode-kubernetes-tools":{onFileOpen:[{pathGlob:"{**/Chart.yaml}"}]},"Oracle.oracledevtools":{onFileOpen:[{pathGlob:"{**/*.sql}"}]},"betterthantomorrow.calva":{onFileOpen:[{pathGlob:"{**/*.clj,**/*.cljs}"}]},"vmware.vscode-boot-dev-pack":{onFileOpen:[{pathGlob:"{**/application.properties}"}]},"GitHub.copilot":{onFileOpen:[{pathGlob:"{**/*.ts,**/*.tsx,**/*.js,**/*.jsx,**/*.py,**/*.go,**/*.rb,**/*.html,**/*.css,**/*.php,**/*.cpp,**/*.vue,**/*.c,**/*.sql,**/*.java,**/*.cs,**/*.rs,**/*.dart,**/*.ps,**/*.ps1,**/*.tex}"}]},"GitHub.copilot-chat":{onSettingsEditorOpen:{descriptionOverride:"GitHub Copilot is an AI-powered coding assistant that helps you write code faster and smarter."}},"GitHub.vscode-github-actions":{onFileOpen:[{pathGlob:"{**/.github/workflows/*.yml}",important:!0}]},"circleci.circleci":{onFileOpen:[{pathGlob:"{**/.circleci/config.yml}"}]},"mechatroner.rainbow-csv":{onFileOpen:[{pathGlob:"**/*.csv",important:!0}]},"tomoki1207.pdf":{onFileOpen:[{pathGlob:"**/*.pdf",important:!0}]},"Redis.redis-for-vscode":{onFileOpen:[{pathGlob:"{**/redis.*,**/redis-server.*,**/redis_*,**/redisinsight.*}",important:!0}]},"SonarSource.sonarlint-vscode":{onFileOpen:[{pathGlob:"{**/sonar-project.properties,**/sonarcloud.properties,**/sonarlint.*}",important:!0}]}},keymapExtensionTips:["vscodevim.vim","ms-vscode.sublime-keybindings","ms-vscode.atom-keybindings","ms-vscode.brackets-keybindings","ms-vscode.vs-keybindings","ms-vscode.notepadplusplus-keybindings","k--kato.intellij-idea-keybindings","lfs.vscode-emacs-friendly","alphabotsec.vscode-eclipse-keybindings","alefragnani.delphi-keybindings"],languageExtensionTips:["ms-python.python","ms-vscode.cpptools-extension-pack","ms-dotnettools.csdevkit","ms-toolsai.jupyter","vscjava.vscode-java-pack","ecmel.vscode-html-css","vue.volar","bmewburn.vscode-intelephense-client","dsznajder.es7-react-js-snippets","golang.go","ms-vscode.powershell","dart-code.dart-code","rust-lang.rust-analyzer","Shopify.ruby-lsp","GitHub.copilot"],configBasedExtensionTips:{git:{configPath:".git/config",configName:"Git",recommendations:{"github.vscode-pull-request-github":{name:"GitHub Pull Request",contentPattern:"^\\s*url\\s*=\\s*https:\\/\\/github\\.com.*$"},"eamodio.gitlens":{name:"GitLens"}}},devContainer:{configPath:".devcontainer/devcontainer.json",configName:"Dev Container",recommendations:{"ms-vscode-remote.remote-containers":{name:"Dev Containers",important:!0}}},maven:{configPath:"pom.xml",configName:"Maven",recommendations:{"vscjava.vscode-java-pack":{name:"Java",important:!0,isExtensionPack:!0,whenNotInstalled:["ASF.apache-netbeans-java","Oracle.oracle-java"]},"vmware.vscode-boot-dev-pack":{name:"Spring Boot Extension Pack",isExtensionPack:!0}}},gradle:{configPath:"build.gradle",configName:"Gradle",recommendations:{"vscjava.vscode-java-pack":{name:"Java",important:!0,isExtensionPack:!0,whenNotInstalled:["ASF.apache-netbeans-java","Oracle.oracle-java"]}}},"github-pull-request":{configPath:".vscode/.github-pull-request.rec",configName:"GitHub",configScheme:"vscode-vfs",recommendations:{"github.vscode-pull-request-github":{name:"GitHub Pull Request",important:!0}}},"pyproject-formatter":{configPath:"pyproject.toml",configName:"Python Formatter",recommendations:{"ms-python.black-formatter":{name:"Black Formatter",contentPattern:'(^\\s*\\[\\[?\\s*"?tool"?\\s*\\.\\s*"?black"?\\s*[\\].])|("black\\s*["[(<=>!~;@])'},"ms-python.autopep8":{name:"Autopep8",contentPattern:'(^\\s*\\[\\[?\\s*"?tool"?\\s*\\.\\s*"?autopep8"?\\s*[\\].])|("autopep8\\s*["[(<=>!~;@])'}}},"pep8-formatter":{configPath:".pep8",configName:"Python Formatter",recommendations:{"ms-python.autopep8":{name:"Autopep8"}}},"python-setup-cgf-formatter":{configPath:"setup.cfg",configName:"Python Formatter",recommendations:{"ms-python.autopep8":{name:"Autopep8",contentPattern:"^\\[pep8\\]"}}},"tox-ini-formatter":{configPath:"tox.ini",configName:"Python Formatter",recommendations:{"ms-python.autopep8":{name:"Autopep8",contentPattern:"^\\[pep8\\]"}}},"pyproject-linter":{configPath:"pyproject.toml",configName:"Python Linter",recommendations:{"ms-python.pylint":{name:"Pylint",contentPattern:'(^\\s*\\[\\[?\\s*"?tool"?\\s*\\.\\s*"?pylint"?\\s*[\\].])|("pylint\\s*["[(<=>!~;@])'},"charliermarsh.ruff":{name:"Ruff",contentPattern:'(^\\s*\\[\\[?\\s*"?tool"?\\s*\\.\\s*"?ruff"?\\s*[\\].])|("ruff\\s*["[(<=>!~;@])'},"ms-python.mypy-type-checker":{name:"Mypy Type Checker",contentPattern:'(^\\s*\\[\\[?\\s*"?tool"?\\s*\\.\\s*"?mypy"?\\s*[\\].])|("mypy\\s*["[(<=>!~;@])'},"ms-python.flake8":{name:"Flake8",contentPattern:'(^\\s*\\[\\[?\\s*"?tool"?\\s*\\.\\s*"?flake8"?\\s*[\\].])|("flake8\\s*["[(<=>!~;@])'}}},".pylintrc-linter":{configPath:".pylintrc",configName:"Python Linter",recommendations:{"ms-python.pylint":{name:"Pylint"}}},"pylintrc-linter":{configPath:"pylintrc",configName:"Python Linter",recommendations:{"ms-python.pylint":{name:"Pylint"}}},"mypy-ini-linter":{configPath:".mypy.ini",configName:"Python Linter",recommendations:{"ms-python.mypy-type-checker":{name:"Mypy Type Checker"}}},"tox-ini-linter":{configPath:"tox.ini",configName:"Python Linter",recommendations:{"ms-python.flake8":{name:"Flake8",contentPattern:"^\\[flake8\\]"}}},".flake8-linter":{configPath:".flake8",configName:"Python Linter",recommendations:{"ms-python.flake8":{name:"Flake8"}}},"python-setup-cgf-linter":{configPath:"setup.cfg",configName:"Python Linter",recommendations:{"ms-python.flake8":{name:"Flake8",contentPattern:"^\\[flake8\\]"}}}},exeBasedExtensionTips:{az:{friendlyName:"Azure CLI",windowsPath:"%ProgramFiles(x86)%\\Microsoft SDKs\\Azure\\CLI2\\wbin\\az.cmd",recommendations:{"ms-vscode.vscode-node-azure-pack":{name:"Azure Tools"},"ms-azuretools.vscode-azure-github-copilot":{name:"GitHub Copilot for Azure"}}},azd:{friendlyName:"Azure Dev CLI",windowsPath:"%USERPROFILE%\\AppData\\Local\\Programs\\Azure Dev CLI\\azd.exe",recommendations:{"ms-vscode.vscode-node-azure-pack":{name:"Azure Tools"},"ms-azuretools.vscode-azure-github-copilot":{name:"GitHub Copilot for Azure"}}},"azd-user":{friendlyName:"Azure Dev CLI",windowsPath:"%ProgramFiles%\\Azure Dev CLI\\azd.exe",recommendations:{"ms-vscode.vscode-node-azure-pack":{name:"Azure Tools"},"ms-azuretools.vscode-azure-github-copilot":{name:"GitHub Copilot for Azure"}}},"azure-powershell":{friendlyName:"Azure PowerShell",windowsPath:"%USERPROFILE%\\.Azure",recommendations:{"ms-vscode.vscode-node-azure-pack":{name:"Azure Tools"}}},heroku:{friendlyName:"Heroku CLI",windowsPath:"%ProgramFiles%\\Heroku\\bin\\heroku.cmd",recommendations:{"ms-azuretools.vscode-azureappservice":{name:"Azure App Service"},"pkosta2005.heroku-command":{name:"heroku-cli"}}},mongo:{friendlyName:"Mongo",windowsPath:"%ProgramFiles%\\MongoDB\\Server\\3.6\\bin\\mongod.exe",recommendations:{"ms-azuretools.vscode-cosmosdb":{name:"Azure Databases"}}},serverless:{friendlyName:"Serverless framework",windowsPath:"%APPDATA%\\npm\\serverless.cmd",recommendations:{"ms-azuretools.vscode-azurefunctions":{name:"Azure Functions"}}},func:{friendlyName:"Azure Function SDK",windowsPath:"%APPDATA%\\npm\\func.cmd",recommendations:{"ms-azuretools.vscode-azurefunctions":{name:"Azure Functions"}}},mysql:{friendlyName:"MySQL",windowsPath:"%ProgramFiles%\\MySQL\\MySQL Server 8.0\\bin\\mysqld.exe",recommendations:{"mtxr.sqltools":{name:"SQLTools"}}},postgres:{friendlyName:"PostgreSQL",windowsPath:"%ProgramFiles%\\PostgreSQL\\11\\bin\\psql.exe",recommendations:{"ms-ossdata.vscode-postgresql":{name:"PostgreSQL"},"mtxr.sqltools":{name:"SQLTools"}}},sqlcmd:{friendlyName:"SQL CLI",recommendations:{"ms-mssql.mssql":{name:"SQL Server (mssql)"}}},now:{friendlyName:"Now CLI",windowsPath:"%APPDATA%\\npm\\now.cmd",recommendations:{"ms-azuretools.vscode-azureappservice":{name:"Azure App Service"},"ms-azuretools.vscode-containers":{name:"Docker"}}},docker:{friendlyName:"Docker",windowsPath:"%ProgramFiles%\\Docker\\Docker\\Resources\\bin\\docker.exe",recommendations:{"ms-azuretools.vscode-containers":{name:"Docker",important:!0,whenNotInstalled:["ms-azuretools.vscode-docker"]},"ms-vscode-remote.remote-containers":{name:"Dev Containers",important:!0},"ms-kubernetes-tools.vscode-kubernetes-tools":{name:"Kubernetes"}}},kubectl:{friendlyName:"Kubernetes",windowsPath:"%ProgramFiles%\\Docker\\Docker\\Resources\\bin\\kubectl.exe",recommendations:{"ms-azuretools.vscode-containers":{name:"Docker"},"ms-kubernetes-tools.vscode-kubernetes-tools":{name:"Kubernetes"},"ms-vscode-remote.remote-containers":{name:"Dev Containers"}}},ng:{friendlyName:"Angular CLI",windowsPath:"%APPDATA%\\npmexit\\ng.cmd",recommendations:{"johnpapa.Angular2":{name:"Angular Snippets"}}},"create-react-app":{friendlyName:"Create React App",windowsPath:"%APPDATA%\\npm\\create-react-app.cmd",recommendations:{"msjsdiag.vscode-react-native":{name:"React Native Tools"}}},"react-native":{friendlyName:"React Native",windowsPath:"%APPDATA%\\npm\\react-native-cli",recommendations:{"msjsdiag.vscode-react-native":{name:"React Native Tools"}}},p4:{friendlyName:"Perforce",recommendations:{"slevesque.perforce":{name:"Perforce for VS Code"}}},hg:{friendlyName:"Mercurial",recommendations:{"mrcrowl.hg":{name:"Hg"}}},git:{friendlyName:"Git",windowsPath:"%ProgramFiles%\\Git\\git-bash.exe",recommendations:{"eamodio.gitlens":{name:"GitLens"}}},svn:{friendlyName:"Subversion",windowsPath:"%ProgramFiles%\\TortoiseSVN\\bin\\TortoiseProc.exe",recommendations:{"johnstoncode.svn-scm":{name:"SVN"}}},subl:{friendlyName:"Sublime",windowsPath:"%ProgramFiles%\\Sublime Text3\\sublime_text.exe",recommendations:{"ms-vscode.sublime-keybindings":{name:"Sublime Text Keymap and Settings Importer"}}},atom:{friendlyName:"Atom",windowsPath:"%USERPROFILE%\\AppData\\Local\\atom\\bin\\atom.cmd",recommendations:{"ms-vscode.atom-keybindings":{name:"Atom Keymap"}}},brackets:{friendlyName:"Brackets",windowsPath:"%ProgramFiles(x86)%\\Brackets\\Brackets.exe",recommendations:{"ms-vscode.brackets-keybindings":{name:"Brackets Keymap"}}},notepadplusplus:{friendlyName:"Notepad++",windowsPath:"%ProgramFiles%\\Notepad++\\Notepad++.exe",recommendations:{"ms-vscode.notepadplusplus-keybindings":{name:"Notepad++ keymap"}}},vi:{friendlyName:"VIM",windowsPath:"%ProgramFiles(x86)%\\Vim\\vim80\\gvim.exe",recommendations:{"vscodevim.vim":{name:"Vim"}}},mvn:{friendlyName:"Maven",recommendations:{"vscjava.vscode-java-pack":{name:"Java",important:!0,isExtensionPack:!0,whenNotInstalled:["ASF.apache-netbeans-java","Oracle.oracle-java"]}}},gradle:{friendlyName:"Gradle",recommendations:{"vscjava.vscode-java-pack":{name:"Java",important:!0,isExtensionPack:!0,whenNotInstalled:["ASF.apache-netbeans-java","Oracle.oracle-java"]}}},ollama:{friendlyName:"Ollama",windowsPath:"%USERPROFILE%\\AppData\\Local\\Programs\\Ollama\\ollama.exe",recommendations:{"ms-windows-ai-studio.windows-ai-studio":{name:"AI Toolkit for Visual Studio Code"}}},"Microsoft Edge":{friendlyName:"Microsoft Edge",windowsPath:"%USERPROFILE%\\AppData\\Local\\Microsoft\\Edge\\Application\\msedge.exe",recommendations:{"ms-edgedevtools.vscode-edge-devtools":{name:"Microsoft Edge Developer Tools"}}},"Microsoft Edge Dev":{friendlyName:"Microsoft Edge Dev",windowsPath:"%USERPROFILE%\\AppData\\Local\\Microsoft\\Edge Dev\\Application\\msedge.exe",recommendations:{"ms-edgedevtools.vscode-edge-devtools":{name:"Microsoft Edge Developer Tools"}}},"Microsoft Edge Beta":{friendlyName:"Microsoft Edge Beta",windowsPath:"%USERPROFILE%\\AppData\\Local\\Microsoft\\Edge Beta\\Application\\msedge.exe",recommendations:{"ms-edgedevtools.vscode-edge-devtools":{name:"Microsoft Edge Developer Tools"}}},"Microsoft Edge Canary":{friendlyName:"Microsoft Edge Canary",windowsPath:"%USERPROFILE%\\AppData\\Local\\Microsoft\\Edge SxS\\Application\\msedge.exe",recommendations:{"ms-edgedevtools.vscode-edge-devtools":{name:"Microsoft Edge Developer Tools"}}},"Mozilla Firefox (x86)":{friendlyName:"Mozilla Firefox",windowsPath:"%ProgramFiles(x86)%\\Mozilla Firefox\\firefox.exe",recommendations:{"firefox-devtools.vscode-firefox-debug":{name:"Debugger for Firefox"}}},"Mozilla Firefox Developer Edition (x86)":{friendlyName:"Mozilla Firefox Developer Edition",windowsPath:"%ProgramFiles(x86)%\\Firefox Developer Edition\\firefox.exe",recommendations:{"firefox-devtools.vscode-firefox-debug":{name:"Debugger for Firefox"}}},"Mozilla Firefox":{friendlyName:"Mozilla Firefox",windowsPath:"%ProgramFiles%\\Mozilla Firefox\\firefox.exe",recommendations:{"firefox-devtools.vscode-firefox-debug":{name:"Debugger for Firefox"}}},"Mozilla Firefox Developer Edition":{friendlyName:"Mozilla Firefox Developer Edition",windowsPath:"%ProgramFiles%\\Firefox Developer Edition\\firefox.exe",recommendations:{"firefox-devtools.vscode-firefox-debug":{name:"Debugger for Firefox"}}},cordova:{friendlyName:"Cordova",windowsPath:"%APPDATA%\\npm\\cordova",recommendations:{"msjsdiag.cordova-tools":{name:"Cordova Tools"}}},gcloud:{friendlyName:"Google GCloud CLI",windowsPath:"%ProgramFiles(x86)%\\Google\\Cloud SDK\\google-cloud-sdk\\bin\\gcloud.cmd",recommendations:{"GoogleCloudTools.cloudcode":{name:"Cloud Code"}}},skaffold:{friendlyName:"Skaffold Code to Cluster",recommendations:{"ms-azuretools.vscode-containers":{name:"Docker"},"ms-kubernetes-tools.vscode-kubernetes-tools":{name:"Kubernetes"}}},minikube:{friendlyName:"MiniKube Local Kubernetes Cluster",recommendations:{"ms-azuretools.vscode-containers":{name:"Docker"},"ms-kubernetes-tools.vscode-kubernetes-tools":{name:"Kubernetes"},"ms-vscode-remote.remote-containers":{name:"Dev Containers"}}},podman:{friendlyName:"Podman",recommendations:{"ms-vscode-remote.remote-containers":{name:"Dev Containers"}}},wsl:{friendlyName:"Windows Subsystem for Linux (WSL)",windowsPath:"%WINDIR%\\system32\\lxss\\LxssManager.dll",recommendations:{"ms-vscode-remote.remote-wsl":{name:"WSL"}}}},webExtensionTips:["tyriar.luna-paint","codespaces-contrib.codeswing","ms-vscode.vscode-github-issue-notebooks","esbenp.prettier-vscode","hediet.vscode-drawio"],virtualWorkspaceExtensionTips:{"vscode-vfs":{friendlyName:"Remote Repositories",extensionId:"ms-vscode.remote-repositories",startEntry:{helpLink:"https://aka.ms/vscode-remote/remote-repositories",startConnectLabel:"Remote Repository",startCommand:"remoteHub.continueOn.openRepository",priority:5}}},remoteExtensionTips:{wsl:{friendlyName:"WSL",extensionId:"ms-vscode-remote.remote-wsl",supportedPlatforms:["Windows","Web"],startEntry:{helpLink:"https://aka.ms/vscode-remote/wsl",startConnectLabel:"WSL",startCommand:"remote-wsl.connect",priority:3}},"ssh-remote":{friendlyName:"Remote - SSH",extensionId:"ms-vscode-remote.remote-ssh",supportedPlatforms:["Windows","Linux","Mac"],startEntry:{helpLink:"https://aka.ms/vscode-remote/ssh",startConnectLabel:"SSH ",startCommand:"opensshremotes.openEmptyWindowInCurrentWindow",priority:1}},"dev-container":{friendlyName:"Dev Containers",extensionId:"ms-vscode-remote.remote-containers",supportedPlatforms:["Windows","Linux","Mac"],startEntry:{helpLink:"https://aka.ms/vscode-remote/containers",startConnectLabel:"Dev Container",startCommand:"remote-containers.reopenInContainer",priority:2}},"attached-container":{friendlyName:"Dev Containers",extensionId:"ms-vscode-remote.remote-containers"},codespaces:{friendlyName:"GitHub Codespaces",extensionId:"github.codespaces",startEntry:{helpLink:"https://aka.ms/vscode-remote-codespaces",startConnectLabel:"GitHub Codespace ",startCommand:"github.codespaces.connect",priority:4}},tunnel:{friendlyName:"Remote - Tunnels",extensionId:"ms-vscode.remote-server",startEntry:{helpLink:"https://aka.ms/remote-tunnels-doc",startConnectLabel:"Tunnel",startCommand:"remote-tunnels.connectCurrentWindowToTunnel",priority:0}},amlext:{friendlyName:"Azure Machine Learning",extensionId:"ms-toolsai.vscode-ai-remote"}},commandPaletteSuggestedCommandIds:["workbench.action.files.openFile","workbench.action.files.openFileFolder","workbench.action.files.openFolder","workbench.action.remote.showMenu","editor.action.formatDocument","editor.action.commentLine","workbench.action.tasks.runTask","workbench.action.openSettings2","workbench.action.selectTheme","workbench.action.openWalkthrough","workbench.action.openIssueReporter"],extensionKeywords:{md:["Markdown"],js:["JavaScript"],jsx:["JavaScript"],es6:["JavaScript"],html:["Html"],ts:["TypeScript"],tsx:["TypeScript"],css:["CSS"],scss:["SASS"],txt:["Text"],php:["PHP"],php3:["PHP"],php4:["PHP"],ph3:["PHP"],ph4:["PHP"],xml:["XML"],py:["Python"],pyc:["Python"],pyd:["Python"],pyo:["Python"],pyw:["Python"],pyz:["Python"],java:["Java"],class:["Java"],jar:["Java"],c:["c","objective c","objective-c"],m:["objective c","objective-c"],mm:["objective c","objective-c"],cpp:["cpp","c plus plus","c","c++"],cc:["cpp","c plus plus","c","c++"],cxx:["cpp","c plus plus","c++"],hh:["cpp","c plus plus","c++"],hpp:["cpp","c++"],h:["cpp","c plus plus","c++","c","objective c","objective-c"],sql:["sql"],sh:["bash"],bash:["bash"],zsh:["bash","zshell"],cs:["c#","csharp"],csproj:["c#","csharp"],sln:["c#","csharp"],go:["go"],sty:["latex"],tex:["latex"],ps:["powershell"],ps1:["powershell"],rs:["rust"],rslib:["rust"],hs:["haskell"],lhs:["haskell"],scm:["scheme"],ss:["scheme"],clj:["clojure"],cljs:["clojure"],cljc:["clojure"],edn:["clojure"],erl:["erlang"],hrl:["erlang"],scala:["scala"],sc:["scala"],pl:["perl"],pm:["perl"],t:["perl"],pod:["perl"],groovy:["groovy"],swift:["swift"],rb:["ruby"],rbw:["ruby"],jl:["julia"],f:["fortran"],for:["fortran"],f90:["fortran"],f95:["fortran"],coffee:["CoffeeScript"],litcoffee:["CoffeeScript"],yaml:["yaml"],yml:["yaml"],dart:["dart"],json:["json"]},extensionAllowedBadgeProviders:["api.travis-ci.com","app.fossa.io","badge.buildkite.com","badge.fury.io","badgen.net","badges.frapsoft.com","badges.gitter.im","cdn.travis-ci.com","ci.appveyor.com","circleci.com","cla.opensource.microsoft.com","codacy.com","codeclimate.com","codecov.io","coveralls.io","david-dm.org","deepscan.io","dev.azure.com","docs.rs","flat.badgen.net","gitlab.com","godoc.org","goreportcard.com","img.shields.io","isitmaintained.com","marketplace.visualstudio.com","nodesecurity.io","opencollective.com","snyk.io","travis-ci.com","travis-ci.org","visualstudio.com","vsmarketplacebadge.apphb.com"],extensionAllowedBadgeProvidersRegex:["^https:\\/\\/github\\.com\\/[^/]+\\/[^/]+\\/(actions\\/)?workflows\\/.*badge\\.svg"],crashReporter:{productName:"VSCode",companyName:"Microsoft"},appCenter:{"win32-x64":"appcenter://code?aid=a4e3233c-699c-46ec-b4f4-9c2a77254662","win32-arm64":"appcenter://code?aid=3712d786-7cc8-4f11-8b08-cc12eab6d4f7","linux-x64":"appcenter://code?aid=fba07a4d-84bd-4fc8-a125-9640fc8ce171",darwin:"appcenter://code?aid=860d6632-f65b-490b-85a8-3e72944f7774","darwin-arm64":"appcenter://code?aid=be71415d-3893-4ae5-b453-e537b9668a10","darwin-universal":"appcenter://code?aid=de75e3cc-e22f-4f42-a03f-1409c21d8af8"},enableTelemetry:!0,aiConfig:{ariaKey:"5bbf946d11a54f6783919c455abaddaf-fd62977b-c92d-4714-a45d-649d06980372-7168"},msftInternalDomains:["redmond.corp.microsoft.com","northamerica.corp.microsoft.com","fareast.corp.microsoft.com","ntdev.corp.microsoft.com","wingroup.corp.microsoft.com","southpacific.corp.microsoft.com","wingroup.windeploy.ntdev.microsoft.com","ddnet.microsoft.com","europe.corp.microsoft.com"],documentationUrl:"https://go.microsoft.com/fwlink/?LinkID=533484#vscode",serverDocumentationUrl:"https://aka.ms/vscode-server-doc",releaseNotesUrl:"https://go.microsoft.com/fwlink/?LinkID=533483#vscode",keyboardShortcutsUrlMac:"https://go.microsoft.com/fwlink/?linkid=832143",keyboardShortcutsUrlLinux:"https://go.microsoft.com/fwlink/?linkid=832144",keyboardShortcutsUrlWin:"https://go.microsoft.com/fwlink/?linkid=832145",introductoryVideosUrl:"https://go.microsoft.com/fwlink/?linkid=832146",tipsAndTricksUrl:"https://go.microsoft.com/fwlink/?linkid=852118",newsletterSignupUrl:"https://www.research.net/r/vsc-newsletter",youTubeUrl:"https://aka.ms/vscode-youtube",requestFeatureUrl:"https://go.microsoft.com/fwlink/?LinkID=533482",reportIssueUrl:"https://github.com/Microsoft/vscode/issues/new",reportMarketplaceIssueUrl:"https://github.com/microsoft/vsmarketplace/issues/new",licenseUrl:"https://go.microsoft.com/fwlink/?LinkID=533485",serverLicenseUrl:"https://aka.ms/vscode-server-license",privacyStatementUrl:"https://go.microsoft.com/fwlink/?LinkId=521839",showTelemetryOptOut:!0,npsSurveyUrl:"https://aka.ms/vscode-nps",checksumFailMoreInfoUrl:"https://go.microsoft.com/fwlink/?LinkId=828886",electronRepository:"Microsoft/vscode-electron-prebuilt",nodejsRepository:"Microsoft/vscode-node",settingsSearchUrl:"https://bingsettingssearch.trafficmanager.net/api/Search",surveys:[{surveyId:"cpp.1",surveyUrl:"https://www.research.net/r/VBVV6C6",languageId:"cpp",editCount:10,userProbability:.15},{surveyId:"java.2",surveyUrl:"https://www.research.net/r/vscodejava",languageId:"java",editCount:10,userProbability:.3},{surveyId:"javascript.1",surveyUrl:"https://www.research.net/r/vscode-js",languageId:"javascript",editCount:10,userProbability:.05},{surveyId:"typescript.1",surveyUrl:"https://www.research.net/r/vscode-ts",languageId:"typescript",editCount:10,userProbability:.05},{surveyId:"csharp.1",surveyUrl:"https://www.research.net/r/8KGJ9V8",languageId:"csharp",editCount:10,userProbability:.1}],extensionsEnabledWithApiProposalVersion:["GitHub.copilot-chat","ms-vscode.vscode-commander","ms-vscode.vscode-copilot-vision","GitHub.vscode-pull-request-github"],extensionEnabledApiProposals:{"mrleemurray.theme-2026":["css"],"ms-azuretools.vscode-containers":["authenticationChallenges"],"ms-azuretools.vscode-azureresourcegroups":["authenticationChallenges"],"ms-azuretools.vscode-azure-github-copilot":["authenticationChallenges"],"ms-azuretools.vscode-dev-azurecloudshell":["contribEditSessions","authenticationChallenges"],"ms-toolsai.vscode-ai":["authenticationChallenges"],"TeamsDevApp.vscode-ai-foundry":["authenticationChallenges"],"ms-vscode.vscode-selfhost-test-provider":["testObserver","testRelatedCode"],"VisualStudioExptTeam.vscodeintellicode-completions":["inlineCompletionsAdditions"],"ms-vsliveshare.vsliveshare":["contribMenuBarHome","contribShareMenu","contribStatusBarItems","diffCommand","documentFiltersExclusive","fileSearchProvider","findTextInFiles","notebookLiveShare","terminalDimensions","terminalDataWriteEvent","textSearchProvider"],"ms-vscode.js-debug":["portsAttributes","findTextInFiles","workspaceTrust","tunnels"],"ms-toolsai.vscode-ai-remote":["resolvers","authenticationChallenges"],"ms-python.python":["codeActionAI","contribEditorContentMenu","quickPickSortByLabel","portsAttributes","testObserver","quickPickItemTooltip","terminalDataWriteEvent","terminalExecuteCommandEvent","notebookReplDocument","notebookVariableProvider","terminalShellEnv"],"ms-python.vscode-python-envs":["terminalShellEnv","terminalDataWriteEvent","taskExecutionTerminal"],"ms-dotnettools.dotnet-interactive-vscode":["notebookMessaging"],"GitHub.codespaces":["contribEditSessions","contribMenuBarHome","contribRemoteHelp","contribViewsRemote","resolvers","tunnels","terminalDataWriteEvent","treeViewReveal","notebookKernelSource"],"ms-vscode.azure-repos":["extensionRuntime","fileSearchProvider","textSearchProvider"],"ms-vscode.remote-repositories":["canonicalUriProvider","contribEditSessions","contribRemoteHelp","contribMenuBarHome","contribViewsRemote","contribViewsWelcome","contribShareMenu","documentFiltersExclusive","editSessionIdentityProvider","extensionRuntime","fileSearchProvider","quickPickSortByLabel","workspaceTrust","shareProvider","scmActionButton","scmSelectedProvider","scmValidation","textSearchProvider","timeline"],"ms-vscode-remote.remote-wsl":["resolvers","contribRemoteHelp","contribViewsRemote","telemetry"],"ms-vscode-remote.remote-ssh":["resolvers","tunnels","terminalDataWriteEvent","contribRemoteHelp","contribViewsRemote","telemetry"],"ms-vscode.remote-server":["resolvers","tunnels","contribViewsWelcome"],"ms-vscode.remote-explorer":["contribRemoteHelp","contribViewsRemote","extensionsAny"],"ms-vscode-remote.remote-containers":["contribEditSessions","resolvers","portsAttributes","tunnels","workspaceTrust","terminalDimensions","contribRemoteHelp","contribViewsRemote"],"ms-vscode.js-debug-nightly":["portsAttributes","findTextInFiles","workspaceTrust","tunnels"],"ms-vscode.lsif-browser":["documentFiltersExclusive"],"ms-vscode.vscode-speech":["speech"],"GitHub.vscode-pull-request-github":["activeComment","chatContextProvider","chatParticipantAdditions","chatParticipantPrivate","chatSessionsProvider","codiconDecoration","codeActionRanges","commentingRangeHint","commentReactor","commentReveal","commentsDraftState","commentThreadApplicability","contribAccessibilityHelpContent","contribCommentEditorActionsMenu","contribCommentPeekContext","contribCommentThreadAdditionalMenu","contribCommentsViewThreadMenus","contribEditorContentMenu","contribMultiDiffEditorMenus","contribShareMenu","diffCommand","languageModelToolResultAudience","markdownAlertSyntax","quickDiffProvider","remoteCodingAgents","shareProvider","tabInputMultiDiff","tabInputTextMerge","tokenInformation","treeItemMarkdownLabel","treeViewMarkdownMessage"],"GitHub.copilot":["inlineCompletionsAdditions","devDeviceId"],"GitHub.copilot-nightly":["inlineCompletionsAdditions","devDeviceId"],"GitHub.copilot-chat":["agentSessionsWorkspace","interactive","terminalDataWriteEvent","terminalExecuteCommandEvent","terminalSelection","terminalQuickFixProvider","chatParticipantAdditions","defaultChatParticipant","embeddings","chatProvider","mappedEditsProvider","aiRelatedInformation","aiSettingsSearch","codeActionAI","findTextInFiles","findTextInFiles2","textSearchProvider","textSearchProvider2","activeComment","commentReveal","contribSourceControlInputBoxMenu","contribCommentEditorActionsMenu","contribCommentThreadAdditionalMenu","contribCommentsViewThreadMenus","contribChatEditorInlineGutterMenu","extensionAffinity","newSymbolNamesProvider","findFiles2","chatReferenceDiagnostic","extensionsAny","authLearnMore","testObserver","aiTextSearchProvider","documentFiltersExclusive","chatParticipantPrivate","contribDebugCreateConfiguration","inlineCompletionsAdditions","chatReferenceBinaryData","languageModelSystem","languageModelCapabilities","languageModelThinkingPart","languageModelToolSupportsModel","chatStatusItem","taskProblemMatcherStatus","contribLanguageModelToolSets","textDocumentChangeReason","resolvers","taskExecutionTerminal","dataChannels","chatSessionsProvider","devDeviceId","contribEditorContentMenu","tokenInformation","chatPromptFiles","mcpServerDefinitions","tabInputMultiDiff","workspaceTrust","chatHooks","chatDebug","environmentPower","terminalTitle"],"GitHub.remotehub":["contribRemoteHelp","contribMenuBarHome","contribViewsRemote","contribViewsWelcome","documentFiltersExclusive","extensionRuntime","fileSearchProvider","quickPickSortByLabel","workspaceTrust","scmSelectedProvider","scmValidation","textSearchProvider","timeline"],"ms-python.vscode-pylance":["terminalShellEnv","portsAttributes","codeActionAI"],"ms-python.debugpy":["contribViewsWelcome","debugVisualization","portsAttributes"],"ms-toolsai.jupyter-renderers":["contribNotebookStaticPreloads"],"ms-toolsai.jupyter":["notebookDeprecated","notebookMessaging","notebookMime","portsAttributes","quickPickSortByLabel","notebookKernelSource","interactiveWindow","notebookControllerAffinityHidden","contribNotebookStaticPreloads","quickPickItemTooltip","notebookExecution","notebookCellExecution","notebookVariableProvider","notebookReplDocument"],"donjayamanne.kusto":["notebookVariableProvider"],"ms-toolsai.tensorboard":["portsAttributes"],"dbaeumer.vscode-eslint":[],"ms-vscode.azure-sphere-tools-ui":["tunnels"],"ms-azuretools.vscode-azureappservice":["terminalDataWriteEvent"],"ms-vscode.anycode":["extensionsAny"],"ms-vscode.cpptools":["terminalDataWriteEvent","chatParticipantAdditions"],"vscjava.vscode-java-pack":[],"ms-dotnettools.csdevkit":["inlineCompletionsAdditions"],"ms-dotnettools.vscodeintellicode-csharp":["inlineCompletionsAdditions"],"ms-dotnettools.vscode-dotnet-modernize":["chatParticipantAdditions","chatPromptFiles"],"microsoft-IsvExpTools.powerplatform-vscode":["fileSearchProvider","textSearchProvider"],"microsoft-IsvExpTools.powerplatform-vscode-preview":["fileSearchProvider","textSearchProvider"],"TeamsDevApp.ms-teams-vscode-extension":["chatParticipantAdditions","languageModelSystem","mcpServerDefinitions"],"ms-toolsai.datawrangler":[],"ms-vscode.vscode-commander":[],"ms-vscode.vscode-websearchforcopilot":[],"ms-vscode.vscode-copilot-vision":["chatReferenceBinaryData","codeActionAI"],"ms-autodev.vscode-autodev":["chatParticipantAdditions"],"vscjava.vscode-java-upgrade":["chatParticipantAdditions","chatParticipantPrivate"],"FoundryLocal.foundry-local-chat":["chatProvider"],"Microsoft.foundry-local-chat":["chatProvider"],"ms-wmcp.windows-mcp-server-extension":["mcpToolDefinitions"],"openai.chatgpt":["languageModelProxy","chatSessionsProvider"],"TypeScriptTeam.native-preview":["editorHoverVerbosityLevel","multiDocumentHighlightProvider"],"ms-vscode.vscode-eng-codereview":["chatContextProvider"]},tasConfig:{endpoint:"https://default.exp-tas.com/vscode/ab",telemetryEventName:"query-expfeature",assignmentContextTelemetryPropertyName:"abexp.assignmentcontext"},extensionKind:{"Shan.code-settings-sync":["ui"],"shalldie.background":["ui"],"techer.open-in-browser":["ui"],"CoenraadS.bracket-pair-colorizer-2":["ui"],"CoenraadS.bracket-pair-colorizer":["ui","workspace"],"hiro-sun.vscode-emacs":["ui","workspace"],"hnw.vscode-auto-open-markdown-preview":["ui","workspace"],"wayou.vscode-todo-highlight":["ui","workspace"],"aaron-bond.better-comments":["ui","workspace"],"vscodevim.vim":["ui"],"ollyhayes.colmak-vim":["ui"]},extensionPointExtensionKind:{typescriptServerPlugins:["workspace"]},extensionSyncedKeys:{"ritwickdey.liveserver":["liveServer.setup.version"]},extensionVirtualWorkspacesSupport:{"esbenp.prettier-vscode":{default:!1},"msjsdiag.debugger-for-chrome":{default:!1},"redhat.java":{default:!1},"HookyQR.beautify":{default:!1},"ritwickdey.LiveServer":{default:!1},"VisualStudioExptTeam.vscodeintellicode":{default:!1},"octref.vetur":{default:!1},"formulahendry.code-runner":{default:!1},"xdebug.php-debug":{default:!1},"ms-mssql.mssql":{default:!1},"christian-kohler.path-intellisense":{default:!1},"eg2.tslint":{default:!1},"eg2.vscode-npm-script":{default:!1},"donjayamanne.githistory":{default:!1},"Zignd.html-css-class-completion":{default:!1},"christian-kohler.npm-intellisense":{default:!1},"EditorConfig.EditorConfig":{default:!1},"austin.code-gnu-global":{default:!1},"johnpapa.Angular2":{default:!1},"ms-vscode.vscode-typescript-tslint-plugin":{default:!1},"DotJoshJohnson.xml":{default:!1},"techer.open-in-browser":{default:!1},"tht13.python":{default:!1},"bmewburn.vscode-intelephense-client":{default:!1},"Angular.ng-template":{default:!1},"xdebug.php-pack":{default:!1},"dbaeumer.jshint":{default:!1},"yzhang.markdown-all-in-one":{default:!1},"Dart-Code.flutter":{default:!1},"streetsidesoftware.code-spell-checker":{default:!1},"rebornix.Ruby":{default:!1},"ms-vscode.sublime-keybindings":{default:!1},"mitaki28.vscode-clang":{default:!1},"steoates.autoimport":{default:!1},"donjayamanne.python-extension-pack":{default:!1},"shd101wyy.markdown-preview-enhanced":{default:!1},"mikestead.dotenv":{default:!1},"pranaygp.vscode-css-peek":{default:!1},"ikappas.phpcs":{default:!1},"platformio.platformio-ide":{default:!1},"jchannon.csharpextensions":{default:!1},"gruntfuggly.todo-tree":{default:!1}},linkProtectionTrustedDomains:["https://*.visualstudio.com","https://*.microsoft.com","https://aka.ms","https://*.gallerycdn.vsassets.io","https://*.github.com","https://login.microsoftonline.com","https://*.vscode.dev","https://*.github.dev","https://gh.io","https://portal.azure.com","https://raw.githubusercontent.com","https://private-user-images.githubusercontent.com","https://avatars.githubusercontent.com","https://auth.openai.com"],trustedExtensionAuthAccess:{github:["vscode.github","github.remotehub","ms-vscode.remote-server","github.vscode-pull-request-github","github.codespaces","github.copilot","github.copilot-chat","ms-vsliveshare.vsliveshare","ms-azuretools.vscode-azure-github-copilot"],"github-enterprise":["vscode.github","github.remotehub","ms-vscode.remote-server","github.vscode-pull-request-github","github.codespaces","github.copilot","github.copilot-chat","ms-vsliveshare.vsliveshare","ms-azuretools.vscode-azure-github-copilot"],microsoft:["github.copilot-chat","ms-vscode.azure-repos","ms-vscode.remote-server","ms-vsliveshare.vsliveshare","ms-azuretools.vscode-azure-github-copilot","ms-azuretools.vscode-azureresourcegroups","ms-azuretools.vscode-dev-azurecloudshell","ms-edu.vscode-learning","ms-toolsai.vscode-ai","ms-toolsai.vscode-ai-remote"],"microsoft-sovereign-cloud":["ms-vscode.azure-repos","ms-vscode.remote-server","ms-vsliveshare.vsliveshare","ms-azuretools.vscode-azure-github-copilot","ms-azuretools.vscode-azureresourcegroups","ms-azuretools.vscode-dev-azurecloudshell","ms-edu.vscode-learning","ms-toolsai.vscode-ai","ms-toolsai.vscode-ai-remote"],"__GitHub.copilot-chat":["ms-azuretools.vscode-azure-github-copilot","github.vscode-pull-request-github"]},trustedExtensionProtocolHandlers:["vscode.git","vscode.github-authentication","vscode.microsoft-authentication","github.vscode-pull-request-github"],authClientIdMetadataUrl:"https://vscode.dev/oauth/client-metadata.json",inheritAuthAccountPreference:{"github.copilot":["github.copilot-chat"]},auth:{loginUrl:"https://login.microsoftonline.com/common/oauth2/authorize",tokenUrl:"https://login.microsoftonline.com/common/oauth2/token",redirectUrl:"https://vscode-redirect.azurewebsites.net/",clientId:"aebc6443-996d-45c2-90f0-388ff96faa56"},"configurationSync.store":{url:"https://vscode-sync.trafficmanager.net/",stableUrl:"https://vscode-sync.trafficmanager.net/",insidersUrl:"https://vscode-sync-insiders.trafficmanager.net/",canSwitch:!1,authenticationProviders:{github:{scopes:["user:email"]},microsoft:{scopes:["openid","profile","email","offline_access"]}}},"editSessions.store":{url:"https://vscode-sync.trafficmanager.net/",authenticationProviders:{microsoft:{scopes:["openid","profile","email","offline_access"]},github:{scopes:["user:email"]}}},tunnelServerQualities:{stable:{serverApplicationName:"code-server"},exploration:{serverApplicationName:"code-server-exploration"},insider:{serverApplicationName:"code-server-insiders"}},tunnelApplicationName:"code-tunnel",tunnelApplicationConfig:{editorWebUrl:"https://vscode.dev",extension:{friendlyName:"Remote - Tunnels",extensionId:"ms-vscode.remote-server"},authenticationProviders:{github:{scopes:["user:email","read:org"]},microsoft:{scopes:["46da2f7e-b5ef-422a-88d4-2a7f9de6a0b2/.default","profile","openid"]}}},win32TunnelServiceMutex:"vscode-tunnelservice",win32TunnelMutex:"vscode-tunnel",aiGeneratedWorkspaceTrust:{title:"This workspace was generated by GitHub Copilot",checkboxText:"Trust the contents of all files in this workspace",trustOption:"Yes, I trust the contents",dontTrustOption:"No, I don't trust the contents",startupTrustRequestLearnMore:"If you don't trust the contents of the files generated by GitHub Copilot, we recommend continuing in restricted mode. See [our docs](https://aka.ms/vscode-workspace-trust) to learn more. "},defaultChatAgent:{providerExtensionId:"vscode.github-authentication",extensionId:"GitHub.copilot",chatExtensionId:"GitHub.copilot-chat",chatExtensionOutputId:"GitHub.copilot-chat.GitHub Copilot Chat.log",chatExtensionOutputExtensionStateCommand:"github.copilot.debug.extensionState",documentationUrl:"https://aka.ms/github-copilot-overview",termsStatementUrl:"https://aka.ms/github-copilot-terms-statement",privacyStatementUrl:"https://aka.ms/github-copilot-privacy-statement",skusDocumentationUrl:"https://aka.ms/github-copilot-plans",publicCodeMatchesUrl:"https://aka.ms/github-copilot-match-public-code",manageSettingsUrl:"https://aka.ms/github-copilot-settings",managePlanUrl:"https://aka.ms/github-copilot-manage-plan",manageOverageUrl:"https://aka.ms/github-copilot-manage-overage",upgradePlanUrl:"https://aka.ms/github-copilot-upgrade-plan",signUpUrl:"https://aka.ms/github-sign-up",provider:{default:{id:"github",name:"GitHub"},enterprise:{id:"github-enterprise",name:"GHE.com"},google:{id:"google",name:"Google"},apple:{id:"apple",name:"Apple"}},providerUriSetting:"github-enterprise.uri",providerScopes:[["read:user","user:email","repo","workflow"],["user:email"],["read:user"]],entitlementUrl:"https://api.github.com/copilot_internal/user",entitlementSignupLimitedUrl:"https://api.github.com/copilot_internal/subscribe_limited_user",chatQuotaExceededContext:"github.copilot.chat.quotaExceeded",completionsQuotaExceededContext:"github.copilot.completions.quotaExceeded",walkthroughCommand:"github.copilot.open.walkthrough",completionsMenuCommand:"github.copilot.toggleStatusMenu",completionsRefreshTokenCommand:"github.copilot.signIn",chatRefreshTokenCommand:"github.copilot.refreshToken",generateCommitMessageCommand:"github.copilot.git.generateCommitMessage",resolveMergeConflictsCommand:"github.copilot.git.resolveMergeConflicts",completionsAdvancedSetting:"github.copilot.advanced",completionsEnablementSetting:"github.copilot.enable",nextEditSuggestionsSetting:"github.copilot.nextEditSuggestions.enabled",tokenEntitlementUrl:"https://api.github.com/copilot_internal/v2/token",mcpRegistryDataUrl:"https://api.github.com/copilot/mcp_registry"},chatParticipantRegistry:"https://main.vscode-cdn.net/extensions/chat.json",remoteDefaultExtensionsIfInstalledLocally:["GitHub.copilot","GitHub.copilot-chat","GitHub.vscode-pull-request-github"],extensionConfigurationPolicy:{"github.copilot.nextEditSuggestions.enabled":{name:"CopilotNextEditSuggestions",minimumVersion:"1.99"},"github.copilot.chat.reviewSelection.enabled":{name:"CopilotReviewSelection",minimumVersion:"1.104"},"github.copilot.chat.reviewAgent.enabled":{name:"CopilotReviewAgent",minimumVersion:"1.104"}},win32ContextMenu:{x64:{clsid:"1C6DF0C0-192A-4451-BE36-6A59A86A692E"},arm64:{clsid:"F5EA5883-1DA8-4A05-864A-D5DE2D2B2854"}},chatSessionRecommendations:[{extensionId:"openai.chatgpt",extensionName:"Codex - OpenAI's coding agent",displayName:"Codex Agent",name:"codex",description:"Codex is OpenAI's coding agent that helps you write, review, and ship code faster.",postInstallCommand:"chatgpt.newCodexPanel"},{extensionId:"GitHub.copilot-chat",extensionName:"GitHub Copilot Chat",displayName:"Background Agent",name:"cli",description:"Delegate tasks to a background agent.",postInstallCommand:"workbench.action.chat.openNewSessionSidebar.copilotcli"},{extensionId:"GitHub.copilot-chat",extensionName:"GitHub Copilot Chat",displayName:"Cloud Agent",name:"cloud",description:"Delegate tasks to the GitHub Copilot Cloud Agent. The agent works asynchronously in the cloud to implement changes, iterates via chat, and can create or update pull requests as needed.",postInstallCommand:"workbench.action.chat.openNewSessionSidebar.copilot-cloud-agent"}],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.110.0",sha256:"ad3f7d935b64f4ee123853c464b47b3cba13e5018edef831770ae9c3eb218f5b",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"}}],version:"1.111.0",commit:"ce099c1ed25d9eb3076c11e4a280f3eb52b4fbeb",date:"2026-03-06T23:06:10Z"},Object.keys(nL).length===0&&Object.assign(nL,{version:"1.104.0-dev",nameShort:"Code - OSS Dev",nameLong:"Code - OSS Dev",applicationName:"code-oss",dataFolderName:".vscode-oss",urlProtocol:"code-oss",reportIssueUrl:"https://github.com/microsoft/vscode/issues/new",licenseName:"MIT",licenseUrl:"https://github.com/microsoft/vscode/blob/main/LICENSE.txt",serverLicenseUrl:"https://github.com/microsoft/vscode/blob/main/LICENSE.txt",defaultChatAgent:{extensionId:"GitHub.copilot",chatExtensionId:"GitHub.copilot-chat",provider:{default:{id:"github",name:"GitHub"},enterprise:{id:"github-enterprise",name:"GitHub Enterprise"}},providerScopes:[]}});var to=nL;var ii={Configuration:"base.contributions.configuration"};function NYt(a,i){return a===i?!0:!a||!i?!1:typeof a=="string"||typeof i=="string"?a===i:a.id===i.id}var Qw={properties:{},patternProperties:{}},vSe={properties:{},patternProperties:{}},bSe={properties:{},patternProperties:{}},rse={properties:{},patternProperties:{}},SU={properties:{},patternProperties:{}},IU={properties:{},patternProperties:{}},CN={properties:{},patternProperties:{}},L$="vscode://schemas/settings/resourceLanguage",Gmt="vscode://schemas/settings/configurationDefaults",Kmt=oe.as(ea.JSONContribution),AYt=class extends C{constructor(){super();this.registeredConfigurationDefaults=[];this.overrideIdentifiers=new Set;this._onDidSchemaChange=this._register(new E);this.onDidSchemaChange=this._onDidSchemaChange.event;this._onDidUpdateConfiguration=this._register(new E);this.onDidUpdateConfiguration=this._onDidUpdateConfiguration.event;this.configurationDefaultsOverrides=new Map,this.defaultLanguageConfigurationOverridesNode={id:"defaultOverrides",title:d(1836,null),properties:{}},this.configurationContributors=[this.defaultLanguageConfigurationOverridesNode],this.resourceLanguageSettingsSchema={properties:{},patternProperties:{},additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0},this.configurationProperties={},this.policyConfigurations=new Map,this.excludedConfigurationProperties={},Kmt.registerSchema(L$,this.resourceLanguageSettingsSchema),this.registerOverridePropertyPatternKey()}registerConfiguration(e,t=!0){return this.registerConfigurations([e],t),e}registerConfigurations(e,t=!0){let o=new Set;this.doRegisterConfigurations(e,t,o),Kmt.registerSchema(L$,this.resourceLanguageSettingsSchema),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:o})}deregisterConfigurations(e){let t=new Set;this.doDeregisterConfigurations(e,t),Kmt.registerSchema(L$,this.resourceLanguageSettingsSchema),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:t})}updateConfigurations({add:e,remove:t}){let o=new Set;this.doDeregisterConfigurations(t,o),this.doRegisterConfigurations(e,!1,o),Kmt.registerSchema(L$,this.resourceLanguageSettingsSchema),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:o})}registerDefaultConfigurations(e){let t=new Set;this.doRegisterDefaultConfigurations(e,t),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:t,defaultsOverrides:!0})}doRegisterDefaultConfigurations(e,t){this.registeredConfigurationDefaults.push(...e);let o=[];for(let{overrides:n,source:r}of e)for(let s in n){t.add(s);let l=this.configurationDefaultsOverrides.get(s)??this.configurationDefaultsOverrides.set(s,{configurationDefaultOverrides:[]}).get(s),c=n[s];if(l.configurationDefaultOverrides.push({value:c,source:r}),lg.test(s)){let u=this.mergeDefaultConfigurationsForOverrideIdentifier(s,c,r,l.configurationDefaultOverrideValue);if(!u)continue;l.configurationDefaultOverrideValue=u,this.updateDefaultOverrideProperty(s,u,r),o.push(...yU(s))}else{let u=this.mergeDefaultConfigurationsForConfigurationProperty(s,c,r,l.configurationDefaultOverrideValue);if(!u)continue;l.configurationDefaultOverrideValue=u;let p=this.configurationProperties[s];p&&(this.updatePropertyDefaultValue(s,p),this.updateSchema(s,p))}}this.doRegisterOverrideIdentifiers(o)}deregisterDefaultConfigurations(e){let t=new Set;this.doDeregisterDefaultConfigurations(e,t),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:t,defaultsOverrides:!0})}doDeregisterDefaultConfigurations(e,t){for(let o of e){let n=this.registeredConfigurationDefaults.indexOf(o);n!==-1&&this.registeredConfigurationDefaults.splice(n,1)}for(let{overrides:o,source:n}of e)for(let r in o){let s=this.configurationDefaultsOverrides.get(r);if(!s)continue;let l=s.configurationDefaultOverrides.findIndex(c=>n?NYt(c.source,n):c.value===o[r]);if(l!==-1){if(s.configurationDefaultOverrides.splice(l,1),s.configurationDefaultOverrides.length===0&&this.configurationDefaultsOverrides.delete(r),lg.test(r)){let c;for(let u of s.configurationDefaultOverrides)c=this.mergeDefaultConfigurationsForOverrideIdentifier(r,u.value,u.source,c);c&&!mf(c.value)?(s.configurationDefaultOverrideValue=c,this.updateDefaultOverrideProperty(r,c,n)):(this.configurationDefaultsOverrides.delete(r),delete this.configurationProperties[r],delete this.defaultLanguageConfigurationOverridesNode.properties[r])}else{let c;for(let p of s.configurationDefaultOverrides)c=this.mergeDefaultConfigurationsForConfigurationProperty(r,p.value,p.source,c);s.configurationDefaultOverrideValue=c;let u=this.configurationProperties[r];u&&(this.updatePropertyDefaultValue(r,u),this.updateSchema(r,u))}t.add(r)}}this.updateOverridePropertyPatternKey()}updateDefaultOverrideProperty(e,t,o){let n={section:{id:this.defaultLanguageConfigurationOverridesNode.id,title:this.defaultLanguageConfigurationOverridesNode.title,order:this.defaultLanguageConfigurationOverridesNode.order,extensionInfo:this.defaultLanguageConfigurationOverridesNode.extensionInfo},type:"object",default:t.value,description:d(1835,null,gSe(e)),$ref:L$,defaultDefaultValue:t.value,source:o,defaultValueSource:o};this.configurationProperties[e]=n,this.defaultLanguageConfigurationOverridesNode.properties[e]=n}mergeDefaultConfigurationsForOverrideIdentifier(e,t,o,n){let r=n?.value||{},s=n?.source??new Map;if(!(s instanceof Map)){console.error("objectConfigurationSources is not a Map");return}for(let l of Object.keys(t)){let c=t[l];if(yi(c)&&(cn(r[l])||yi(r[l]))){if(r[l]={...r[l]??{},...c},o)for(let p in c)s.set(`${l}.${p}`,o)}else r[l]=c,o?s.set(l,o):s.delete(l)}return{value:r,source:s}}mergeDefaultConfigurationsForConfigurationProperty(e,t,o,n){let r=this.configurationProperties[e],s=n?.value??r?.defaultDefaultValue,l=o;if(yi(t)&&(r!==void 0&&r.type==="object"||r===void 0&&(cn(s)||yi(s)))){if(l=n?.source??new Map,!(l instanceof Map)){console.error("defaultValueSource is not a Map");return}for(let u in t)o&&l.set(`${e}.${u}`,o);t={...yi(s)?s:{},...t}}return{value:t,source:l}}deltaConfiguration(e){let t=!1,o=new Set;e.removedDefaults&&(this.doDeregisterDefaultConfigurations(e.removedDefaults,o),t=!0),e.addedDefaults&&(this.doRegisterDefaultConfigurations(e.addedDefaults,o),t=!0),e.removedConfigurations&&this.doDeregisterConfigurations(e.removedConfigurations,o),e.addedConfigurations&&this.doRegisterConfigurations(e.addedConfigurations,!1,o),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:o,defaultsOverrides:t})}notifyConfigurationSchemaUpdated(...e){this._onDidSchemaChange.fire()}registerOverrideIdentifiers(e){this.doRegisterOverrideIdentifiers(e),this._onDidSchemaChange.fire()}doRegisterOverrideIdentifiers(e){for(let t of e)this.overrideIdentifiers.add(t);this.updateOverridePropertyPatternKey()}doRegisterConfigurations(e,t,o){e.forEach(n=>{this.validateAndRegisterProperties(n,t,n.extensionInfo,n.restrictedProperties,void 0,o),this.configurationContributors.push(n),this.registerJSONConfiguration(n)})}doDeregisterConfigurations(e,t){let o=n=>{if(n.properties)for(let r in n.properties){t.add(r);let s=this.configurationProperties[r];s?.policy?.name&&this.policyConfigurations.delete(s.policy.name),delete this.configurationProperties[r],this.removeFromSchema(r,n.properties[r])}n.allOf?.forEach(r=>o(r))};for(let n of e){o(n);let r=this.configurationContributors.indexOf(n);r!==-1&&this.configurationContributors.splice(r,1)}}validateAndRegisterProperties(e,t=!0,o,n,r=4,s){r=Jn(e.scope)?r:e.scope;let l=e.properties;if(l)for(let u in l){let p=l[u];if(p.section={id:e.id,title:e.title,order:e.order,extensionInfo:e.extensionInfo},t&&OYt(u,p,o?.id)){delete l[u];continue}p.source=o,p.defaultDefaultValue=l[u].default,this.updatePropertyDefaultValue(u,p),lg.test(u)?p.scope=void 0:(p.scope=Jn(p.scope)?r:p.scope,p.restricted=Jn(p.restricted)?!!n?.includes(u):p.restricted),p.experiment?p.tags?.some(f=>f.toLowerCase()==="onexp")||(p.tags=p.tags??[],p.tags.push("onExP")):p.tags?.some(f=>f.toLowerCase()==="onexp")&&(console.error(`Invalid tag 'onExP' found for property '${u}'. Please use 'experiment' property instead.`),p.experiment={mode:"startup"});let h=l[u].hasOwnProperty("included")&&!l[u].included,g=l[u].policy?.name;h?(this.excludedConfigurationProperties[u]=l[u],g&&(this.policyConfigurations.set(g,u),s.add(u)),delete l[u]):(s.add(u),g&&this.policyConfigurations.set(g,u),this.configurationProperties[u]=l[u],!l[u].deprecationMessage&&l[u].markdownDeprecationMessage&&(l[u].deprecationMessage=l[u].markdownDeprecationMessage))}let c=e.allOf;if(c)for(let u of c)this.validateAndRegisterProperties(u,t,o,n,r,s)}getConfigurations(){return this.configurationContributors}getConfigurationProperties(){return this.configurationProperties}getPolicyConfigurations(){return this.policyConfigurations}getExcludedConfigurationProperties(){return this.excludedConfigurationProperties}getRegisteredDefaultConfigurations(){return[...this.registeredConfigurationDefaults]}getConfigurationDefaultsOverrides(){let e=new Map;for(let[t,o]of this.configurationDefaultsOverrides)o.configurationDefaultOverrideValue&&e.set(t,o.configurationDefaultOverrideValue);return e}registerJSONConfiguration(e){let t=o=>{let n=o.properties;if(n)for(let s in n)this.updateSchema(s,n[s]);o.allOf?.forEach(t)};t(e)}updateSchema(e,t){switch(Qw.properties[e]=t,t.scope){case 1:vSe.properties[e]=t;break;case 2:rse.properties[e]=t;break;case 3:bSe.properties[e]=t;break;case 7:SU.properties[e]=t;break;case 4:IU.properties[e]=t;break;case 5:CN.properties[e]=t;break;case 6:CN.properties[e]=t,this.resourceLanguageSettingsSchema.properties[e]=t;break}}removeFromSchema(e,t){switch(delete Qw.properties[e],t.scope){case 1:delete vSe.properties[e];break;case 2:delete rse.properties[e];break;case 3:delete bSe.properties[e];break;case 7:delete SU.properties[e];break;case 4:delete IU.properties[e];break;case 5:case 6:delete CN.properties[e],delete this.resourceLanguageSettingsSchema.properties[e];break}}updateOverridePropertyPatternKey(){for(let e of this.overrideIdentifiers.values()){let t=`[${e}]`,o={type:"object",description:d(1837,null),errorMessage:d(1838,null),$ref:L$};this.updatePropertyDefaultValue(t,o),Qw.properties[t]=o,vSe.properties[t]=o,bSe.properties[t]=o,rse.properties[t]=o,SU.properties[t]=o,IU.properties[t]=o,CN.properties[t]=o}}registerOverridePropertyPatternKey(){let e={type:"object",description:d(1837,null),errorMessage:d(1838,null),$ref:L$};Qw.patternProperties[bU]=e,vSe.patternProperties[bU]=e,bSe.patternProperties[bU]=e,rse.patternProperties[bU]=e,SU.patternProperties[bU]=e,IU.patternProperties[bU]=e,CN.patternProperties[bU]=e,this._onDidSchemaChange.fire()}updatePropertyDefaultValue(e,t){let o=this.configurationDefaultsOverrides.get(e)?.configurationDefaultOverrideValue,n,r;o&&(!t.disallowConfigurationDefault||!o.source)&&(n=o.value,r=o.source),cn(n)&&(n=t.defaultDefaultValue,r=void 0),cn(n)&&(n=r$e(t.type)),t.default=n,t.defaultValueSource=r}},NKi="\\[([^\\]]+)\\]",AKi=new RegExp(NKi,"g"),bU=`^(${NKi})+$`,lg=new RegExp(bU);function yU(a){let i=[];if(lg.test(a)){let e=AKi.exec(a);for(;e?.length;){let t=e[1].trim();t&&i.push(t),e=AKi.exec(a)}}return Uo(i)}function n$e(a){return a.reduce((i,e)=>`${i}[${e}]`,"")}function r$e(a){switch(Array.isArray(a)?a[0]:a){case"boolean":return!1;case"integer":case"number":return 0;case"string":return"";case"array":return[];case"object":return{};default:return null}}var o$e=new AYt;oe.add(ii.Configuration,o$e);function OYt(a,i,e){return a.trim()?lg.test(a)?d(1834,null,a):o$e.getConfigurationProperties()[a]!==void 0&&(!e||!FYt.has(e.toLowerCase()))?d(1832,null,a):i.policy?.name&&o$e.getPolicyConfigurations().get(i.policy?.name)!==void 0?d(1831,null,a,i.policy?.name,o$e.getPolicyConfigurations().get(i.policy?.name)):null:d(1833,null)}function OKi(){let a=[],i=o$e.getConfigurationProperties();for(let e of Object.keys(i))a.push([e,i[e].scope]);return a.push(["launch",5]),a.push(["task",5]),a}function $mt(a){let i={};for(let e of a){let t=e.properties;if(yi(t))for(let o in t)i[o]=t[o];e.allOf&&Object.assign(i,$mt(e.allOf))}return i}function qmt(a){switch(a){case"application":return 1;case"machine":return 2;case"resource":return 5;case"machine-overridable":return 7;case"language-overridable":return 6;default:return 4}}var FYt=new Set(to.defaultChatAgent?[to.defaultChatAgent.extensionId,to.defaultChatAgent.chatExtensionId].map(a=>a.toLowerCase()):[]);var CMo={ModesRegistry:"editor.modesRegistry"},WYt=class extends C{constructor(){super();this._onDidChangeLanguages=this._register(new E);this.onDidChangeLanguages=this._onDidChangeLanguages.event;this._languages=[]}registerLanguage(e){return this._languages.push(e),this._onDidChangeLanguages.fire(void 0),{dispose:()=>{for(let t=0,o=this._languages.length;t<o;t++)if(this._languages[t]===e){this._languages.splice(t,1);return}}}}getLanguages(){return this._languages}},LM=new WYt;oe.add(CMo.ModesRegistry,LM);var Fr="plaintext",s$e=".txt";LM.registerLanguage({id:Fr,extensions:[s$e],aliases:[d(907,null),"text"],mimetypes:[Zn.text]});oe.as(ii.Configuration).registerDefaultConfigurations([{overrides:{"[plaintext]":{"editor.unicodeHighlight.ambiguousCharacters":!1,"editor.unicodeHighlight.invisibleCharacters":!1},"[go]":{"editor.insertSpaces":!1},"[makefile]":{"editor.insertSpaces":!1},"[shellscript]":{"files.eol":`
`},"[yaml]":{"editor.insertSpaces":!0,"editor.tabSize":2}}}]);var jmt=class{constructor(i,e){this.languageId=i;let t=e.brackets?FKi(e.brackets):[],o=new kI(s=>{let l=new Set;return{info:new VYt(this,s,l),closing:l}}),n=new kI(s=>{let l=new Set,c=new Set;return{info:new BYt(this,s,l,c),opening:l,openingColorized:c}});for(let[s,l]of t){let c=o.get(s),u=n.get(l);c.closing.add(u.info),u.opening.add(c.info)}let r=e.colorizedBracketPairs?FKi(e.colorizedBracketPairs):t.filter(s=>!(s[0]==="<"&&s[1]===">"));for(let[s,l]of r){let c=o.get(s),u=n.get(l);c.closing.add(u.info),u.openingColorized.add(c.info),u.opening.add(c.info)}this._openingBrackets=new Map([...o.cachedValues].map(([s,l])=>[s,l.info])),this._closingBrackets=new Map([...n.cachedValues].map(([s,l])=>[s,l.info]))}get openingBrackets(){return[...this._openingBrackets.values()]}get closingBrackets(){return[...this._closingBrackets.values()]}getOpeningBracketInfo(i){return this._openingBrackets.get(i)}getClosingBracketInfo(i){return this._closingBrackets.get(i)}getBracketInfo(i){return this.getOpeningBracketInfo(i)||this.getClosingBracketInfo(i)}getBracketRegExp(i){let e=Array.from([...this._openingBrackets.keys(),...this._closingBrackets.keys()]);return mSe(e,i)}};function FKi(a){return a.filter(([i,e])=>i!==""&&e!=="")}var Qmt=class{constructor(i,e){this.config=i;this.bracketText=e}get languageId(){return this.config.languageId}},VYt=class extends Qmt{constructor(e,t,o){super(e,t);this.openedBrackets=o;this.isOpeningBracket=!0}},BYt=class extends Qmt{constructor(e,t,o,n){super(e,t);this.openingBrackets=o;this.openingColorizedBrackets=n;this.isOpeningBracket=!1}closes(e){return e.config!==this.config?!1:this.openingBrackets.has(e)}closesColorized(e){return e.config!==this.config?!1:this.openingColorizedBrackets.has(e)}getOpeningBrackets(){return[...this.openingBrackets]}};var l$e=class{constructor(i){this.languageId=i}affects(i){return this.languageId?this.languageId===i:!0}},bs=ae("languageConfigurationService"),a$e=class extends C{constructor(e,t){super();this.configurationService=e;this.languageService=t;this._registry=this._register(new zYt);this.onDidChangeEmitter=this._register(new E);this.onDidChange=this.onDidChangeEmitter.event;this.configurations=new Map;let o=new Set(Object.values(HYt));this._register(this.configurationService.onDidChangeConfiguration(n=>{let r=n.change.keys.some(l=>o.has(l)),s=n.change.overrides.filter(([l,c])=>c.some(u=>o.has(u))).map(([l])=>l);if(r)this.configurations.clear(),this.onDidChangeEmitter.fire(new l$e(void 0));else for(let l of s)this.languageService.isRegisteredLanguageId(l)&&(this.configurations.delete(l),this.onDidChangeEmitter.fire(new l$e(l)))})),this._register(this._registry.onDidChange(n=>{this.configurations.delete(n.languageId),this.onDidChangeEmitter.fire(new l$e(n.languageId))}))}register(e,t,o){return this._registry.register(e,t,o)}getLanguageConfiguration(e){let t=this.configurations.get(e);return t||(t=xMo(e,this._registry,this.configurationService,this.languageService),this.configurations.set(e,t)),t}};a$e=I([m(0,B),m(1,kt)],a$e);function xMo(a,i,e,t){let o=i.getLanguageConfiguration(a);if(!o){if(!t.isRegisteredLanguageId(a))return new SSe(a,{});o=new SSe(a,{})}let n=kMo(o.languageId,e),r=VKi([o.underlyingConfig,n]);return new SSe(o.languageId,r)}var HYt={brackets:"editor.language.brackets",colorizedBracketPairs:"editor.language.colorizedBracketPairs"};function kMo(a,i){let e=i.getValue(HYt.brackets,{overrideIdentifier:a}),t=i.getValue(HYt.colorizedBracketPairs,{overrideIdentifier:a});return{brackets:WKi(e),colorizedBracketPairs:WKi(t)}}function WKi(a){if(Array.isArray(a))return a.map(i=>{if(!(!Array.isArray(i)||i.length!==2))return[i[0],i[1]]}).filter(i=>!!i)}function Jmt(a,i,e){let t=a.getLineContent(i),o=bl(t);return o.length>e-1&&(o=o.substring(0,e-1)),o}var UYt=class{constructor(i){this.languageId=i;this._resolved=null;this._entries=[],this._order=0,this._resolved=null}register(i,e){let t=new Ymt(i,e,++this._order);return this._entries.push(t),this._resolved=null,Mp(Z(()=>{for(let o=0;o<this._entries.length;o++)if(this._entries[o]===t){this._entries.splice(o,1),this._resolved=null;break}}))}getResolvedConfiguration(){if(!this._resolved){let i=this._resolve();i&&(this._resolved=new SSe(this.languageId,i))}return this._resolved}_resolve(){return this._entries.length===0?null:(this._entries.sort(Ymt.cmp),VKi(this._entries.map(i=>i.configuration)))}};function VKi(a){let i={comments:void 0,brackets:void 0,wordPattern:void 0,indentationRules:void 0,onEnterRules:void 0,autoClosingPairs:void 0,surroundingPairs:void 0,autoCloseBefore:void 0,folding:void 0,colorizedBracketPairs:void 0,__electricCharacterSupport:void 0};for(let e of a)i={comments:e.comments||i.comments,brackets:e.brackets||i.brackets,wordPattern:e.wordPattern||i.wordPattern,indentationRules:e.indentationRules||i.indentationRules,onEnterRules:e.onEnterRules||i.onEnterRules,autoClosingPairs:e.autoClosingPairs||i.autoClosingPairs,surroundingPairs:e.surroundingPairs||i.surroundingPairs,autoCloseBefore:e.autoCloseBefore||i.autoCloseBefore,folding:e.folding||i.folding,colorizedBracketPairs:e.colorizedBracketPairs||i.colorizedBracketPairs,__electricCharacterSupport:e.__electricCharacterSupport||i.__electricCharacterSupport};return i}var Ymt=class{constructor(i,e,t){this.configuration=i;this.priority=e;this.order=t}static cmp(i,e){return i.priority===e.priority?i.order-e.order:i.priority-e.priority}},Xmt=class{constructor(i){this.languageId=i}},zYt=class extends C{constructor(){super();this._entries=new Map;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._register(this.register(Fr,{brackets:[["(",")"],["[","]"],["{","}"]],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:"<",close:">"},{open:'"',close:'"'},{open:"'",close:"'"},{open:"`",close:"`"}],colorizedBracketPairs:[],folding:{offSide:!0}},0))}register(e,t,o=0){let n=this._entries.get(e);n||(n=new UYt(e),this._entries.set(e,n));let r=n.register(t,o);return this._onDidChange.fire(new Xmt(e)),Mp(Z(()=>{r.dispose(),this._onDidChange.fire(new Xmt(e))}))}getLanguageConfiguration(e){return this._entries.get(e)?.getResolvedConfiguration()||null}},SSe=class a{constructor(i,e){this.languageId=i;this.underlyingConfig=e;this._brackets=null,this._electricCharacter=null,this._onEnterSupport=this.underlyingConfig.brackets||this.underlyingConfig.indentationRules||this.underlyingConfig.onEnterRules?new Umt(this.underlyingConfig):null,this.comments=a._handleComments(this.underlyingConfig),this.characterPair=new Omt(this.underlyingConfig),this.wordDefinition=this.underlyingConfig.wordPattern||F6,this.indentationRules=this.underlyingConfig.indentationRules,this.underlyingConfig.indentationRules?this.indentRulesSupport=new Hmt(this.underlyingConfig.indentationRules):this.indentRulesSupport=null,this.foldingRules=this.underlyingConfig.folding||{},this.bracketsNew=new jmt(i,this.underlyingConfig)}getWordDefinition(){return E$(this.wordDefinition)}get brackets(){return!this._brackets&&this.underlyingConfig.brackets&&(this._brackets=new Fmt(this.languageId,this.underlyingConfig.brackets)),this._brackets}get electricCharacter(){return this._electricCharacter||(this._electricCharacter=new Vmt(this.brackets)),this._electricCharacter}onEnter(i,e,t,o){return this._onEnterSupport?this._onEnterSupport.onEnter(i,e,t,o):null}getAutoClosingPairs(){return new Nmt(this.characterPair.getAutoClosingPairs())}getAutoCloseBeforeSet(i){return this.characterPair.getAutoCloseBeforeSet(i)}getSurroundingPairs(){return this.characterPair.getSurroundingPairs()}static _handleComments(i){let e=i.comments;if(!e)return null;let t={};if(e.lineComment&&(typeof e.lineComment=="string"?t.lineCommentToken=e.lineComment:(t.lineCommentToken=e.lineComment.comment,t.lineCommentNoIndent=e.lineComment.noIndent)),e.blockComment){let[o,n]=e.blockComment;t.blockCommentStartToken=o,t.blockCommentEndToken=n}return t}};we(bs,a$e,1);var di=class a{constructor(i,e){this.start=i;this.endExclusive=e;if(i>e)throw new ni(`Invalid range: ${this.toString()}`)}static fromTo(i,e){return new a(i,e)}static equals(i,e){return i.start===e.start&&i.endExclusive===e.endExclusive}static addRange(i,e){let t=0;for(;t<e.length&&e[t].endExclusive<i.start;)t++;let o=t;for(;o<e.length&&e[o].start<=i.endExclusive;)o++;if(t===o)e.splice(t,0,i);else{let n=Math.min(i.start,e[t].start),r=Math.max(i.endExclusive,e[o-1].endExclusive);e.splice(t,o-t,new a(n,r))}}static tryCreate(i,e){if(!(i>e))return new a(i,e)}static ofLength(i){return new a(0,i)}static ofStartAndLength(i,e){return new a(i,i+e)}static emptyAt(i){return new a(i,i)}get isEmpty(){return this.start===this.endExclusive}delta(i){return new a(this.start+i,this.endExclusive+i)}deltaStart(i){return new a(this.start+i,this.endExclusive)}deltaEnd(i){return new a(this.start,this.endExclusive+i)}get length(){return this.endExclusive-this.start}toString(){return`[${this.start}, ${this.endExclusive})`}equals(i){return this.start===i.start&&this.endExclusive===i.endExclusive}containsRange(i){return this.start<=i.start&&i.endExclusive<=this.endExclusive}contains(i){return this.start<=i&&i<this.endExclusive}join(i){return new a(Math.min(this.start,i.start),Math.max(this.endExclusive,i.endExclusive))}intersect(i){let e=Math.max(this.start,i.start),t=Math.min(this.endExclusive,i.endExclusive);if(e<=t)return new a(e,t)}intersectionLength(i){let e=Math.max(this.start,i.start),t=Math.min(this.endExclusive,i.endExclusive);return Math.max(0,t-e)}intersects(i){let e=Math.max(this.start,i.start),t=Math.min(this.endExclusive,i.endExclusive);return e<t}intersectsOrTouches(i){let e=Math.max(this.start,i.start),t=Math.min(this.endExclusive,i.endExclusive);return e<=t}isBefore(i){return this.endExclusive<=i.start}isAfter(i){return this.start>=i.endExclusive}slice(i){return i.slice(this.start,this.endExclusive)}substring(i){return i.substring(this.start,this.endExclusive)}clip(i){if(this.isEmpty)throw new ni(`Invalid clipping range: ${this.toString()}`);return Math.max(this.start,Math.min(this.endExclusive-1,i))}clipCyclic(i){if(this.isEmpty)throw new ni(`Invalid clipping range: ${this.toString()}`);return i<this.start?this.endExclusive-(this.start-i)%this.length:i>=this.endExclusive?this.start+(i-this.start)%this.length:i}map(i){let e=[];for(let t=this.start;t<this.endExclusive;t++)e.push(i(t));return e}forEach(i){for(let e=this.start;e<this.endExclusive;e++)i(e)}joinRightTouching(i){if(this.endExclusive!==i.start)throw new ni(`Invalid join: ${this.toString()} and ${i.toString()}`);return new a(this.start,i.endExclusive)}withMargin(i,e){return e===void 0&&(e=i),new a(this.start-i,this.endExclusive+e)}},Zmt=class a{constructor(){this._sortedRanges=[]}get ranges(){return[...this._sortedRanges]}addRange(i){let e=0;for(;e<this._sortedRanges.length&&this._sortedRanges[e].endExclusive<i.start;)e++;let t=e;for(;t<this._sortedRanges.length&&this._sortedRanges[t].start<=i.endExclusive;)t++;if(e===t)this._sortedRanges.splice(e,0,i);else{let o=Math.min(i.start,this._sortedRanges[e].start),n=Math.max(i.endExclusive,this._sortedRanges[t-1].endExclusive);this._sortedRanges.splice(e,t-e,new di(o,n))}}toString(){return this._sortedRanges.map(i=>i.toString()).join(", ")}intersectsStrict(i){let e=0;for(;e<this._sortedRanges.length&&this._sortedRanges[e].endExclusive<=i.start;)e++;return e<this._sortedRanges.length&&this._sortedRanges[e].start<i.endExclusive}intersectWithRange(i){let e=new a;for(let t of this._sortedRanges){let o=t.intersect(i);o&&e.addRange(o)}return e}intersectWithRangeLength(i){return this.intersectWithRange(i).length}get length(){return this._sortedRanges.reduce((i,e)=>i+e.length,0)}};var Bc=class a{constructor(i,e,t){this._lineTokensBrand=void 0;(i.length>1?i[i.length-2]:0)!==e.length&&mt(new Error("Token length and text length do not match!")),this._tokens=i,this._tokensCount=this._tokens.length>>>1,this._text=e,this.languageIdCodec=t}static createEmpty(i,e){let t=a.defaultTokenMetadata,o=new Uint32Array(2);return o[0]=i.length,o[1]=t,new a(o,i,e)}static createFromTextAndMetadata(i,e){let t=0,o="",n=new Array;for(let{text:r,metadata:s}of i)n.push(t+r.length,s),t+=r.length,o+=r;return new a(new Uint32Array(n),o,e)}static convertToEndOffset(i,e){let o=(i.length>>>1)-1;for(let n=0;n<o;n++)i[n<<1]=i[n+1<<1];i[o<<1]=e}static findIndexInTokensArray(i,e){if(i.length<=2)return 0;let t=0,o=(i.length>>>1)-1;for(;t<o;){let n=t+Math.floor((o-t)/2),r=i[n<<1];if(r===e)return n+1;r<e?t=n+1:r>e&&(o=n)}return t}static{this.defaultTokenMetadata=(32768|2<<24)>>>0}getTextLength(){return this._text.length}equals(i){return i instanceof a?this.slicedEquals(i,0,this._tokensCount):!1}slicedEquals(i,e,t){if(this._text!==i._text||this._tokensCount!==i._tokensCount)return!1;let o=e<<1,n=o+(t<<1);for(let r=o;r<n;r++)if(this._tokens[r]!==i._tokens[r])return!1;return!0}getLineContent(){return this._text}getCount(){return this._tokensCount}getStartOffset(i){return i>0?this._tokens[i-1<<1]:0}getMetadata(i){return this._tokens[(i<<1)+1]}getLanguageId(i){let e=this._tokens[(i<<1)+1],t=Qu.getLanguageId(e);return this.languageIdCodec.decodeLanguageId(t)}getStandardTokenType(i){let e=this._tokens[(i<<1)+1];return Qu.getTokenType(e)}getForeground(i){let e=this._tokens[(i<<1)+1];return Qu.getForeground(e)}getClassName(i){let e=this._tokens[(i<<1)+1];return Qu.getClassNameFromMetadata(e)}getInlineStyle(i,e){let t=this._tokens[(i<<1)+1];return Qu.getInlineStyleFromMetadata(t,e)}getPresentation(i){let e=this._tokens[(i<<1)+1];return Qu.getPresentationFromMetadata(e)}getEndOffset(i){return this._tokens[i<<1]}findTokenIndexAtOffset(i){return a.findIndexInTokensArray(this._tokens,i)}inflate(){return this}sliceAndInflate(i,e,t){return new KYt(this,i,e,t)}sliceZeroCopy(i){return this.sliceAndInflate(i.start,i.endExclusive,0)}withInserted(i){if(i.length===0)return this;let e=0,t=0,o="",n=new Array,r=0;for(;;){let s=e<this._tokensCount?this._tokens[e<<1]:-1,l=t<i.length?i[t]:null;if(s!==-1&&(l===null||s<=l.offset)){o+=this._text.substring(r,s);let c=this._tokens[(e<<1)+1];n.push(o.length,c),e++,r=s}else if(l){if(l.offset>r){o+=this._text.substring(r,l.offset);let c=this._tokens[(e<<1)+1];n.push(o.length,c),r=l.offset}o+=l.text,n.push(o.length,l.tokenMetadata),t++}else break}return new a(new Uint32Array(n),o,this.languageIdCodec)}getTokensInRange(i){let e=new GYt,t=this.findTokenIndexAtOffset(i.start),o=this.findTokenIndexAtOffset(i.endExclusive);for(let n=t;n<=o;n++){let s=new di(this.getStartOffset(n),this.getEndOffset(n)).intersectionLength(i);s>0&&e.add(s,this.getMetadata(n))}return e.build()}getTokenText(i){let e=this.getStartOffset(i),t=this.getEndOffset(i);return this._text.substring(e,t)}forEach(i){let e=this.getCount();for(let t=0;t<e;t++)i(t)}toString(){let i="";return this.forEach(e=>{i+=`[${this.getTokenText(e)}]{${this.getClassName(e)}}`}),i}},KYt=class a{constructor(i,e,t,o){this._source=i,this._startOffset=e,this._endOffset=t,this._deltaOffset=o,this._firstTokenIndex=i.findTokenIndexAtOffset(e),this.languageIdCodec=i.languageIdCodec,this._tokensCount=0;for(let n=this._firstTokenIndex,r=i.getCount();n<r&&!(i.getStartOffset(n)>=t);n++)this._tokensCount++}getMetadata(i){return this._source.getMetadata(this._firstTokenIndex+i)}getLanguageId(i){return this._source.getLanguageId(this._firstTokenIndex+i)}getLineContent(){return this._source.getLineContent().substring(this._startOffset,this._endOffset)}equals(i){return i instanceof a?this._startOffset===i._startOffset&&this._endOffset===i._endOffset&&this._deltaOffset===i._deltaOffset&&this._source.slicedEquals(i._source,this._firstTokenIndex,this._tokensCount):!1}getCount(){return this._tokensCount}getStandardTokenType(i){return this._source.getStandardTokenType(this._firstTokenIndex+i)}getForeground(i){return this._source.getForeground(this._firstTokenIndex+i)}getEndOffset(i){let e=this._source.getEndOffset(this._firstTokenIndex+i);return Math.min(this._endOffset,e)-this._startOffset+this._deltaOffset}getClassName(i){return this._source.getClassName(this._firstTokenIndex+i)}getInlineStyle(i,e){return this._source.getInlineStyle(this._firstTokenIndex+i,e)}getPresentation(i){return this._source.getPresentation(this._firstTokenIndex+i)}findTokenIndexAtOffset(i){return this._source.findTokenIndexAtOffset(i+this._startOffset-this._deltaOffset)-this._firstTokenIndex}getTokenText(i){let e=this._firstTokenIndex+i,t=this._source.getStartOffset(e),o=this._source.getEndOffset(e),n=this._source.getTokenText(e);return t<this._startOffset&&(n=n.substring(this._startOffset-t)),o>this._endOffset&&(n=n.substring(0,n.length-(o-this._endOffset))),n}forEach(i){for(let e=0;e<this.getCount();e++)i(e)}};function BKi(a,i){let e=i.lineNumber;if(!a.tokenization.isCheapToTokenize(e))return;a.tokenization.forceTokenization(e);let t=a.tokenization.getLineTokens(e),o=t.findTokenIndexAtOffset(i.column-1);return t.getStandardTokenType(o)}var aW=class a{constructor(i){this._tokenInfo=i}static fromLineTokens(i){let e=[];for(let t=0;t<i.getCount();t++)e.push(new c$e(i.getEndOffset(t)-i.getStartOffset(t),i.getMetadata(t)));return a.create(e)}static create(i){return new a(i)}toLineTokens(i,e){return Bc.createFromTextAndMetadata(this.map((t,o)=>({text:t.substring(i),metadata:o.metadata})),e)}forEach(i){let e=0;for(let t of this._tokenInfo){let o=new di(e,e+t.length);i(o,t),e+=t.length}}map(i){let e=[],t=0;for(let o of this._tokenInfo){let n=new di(t,t+o.length);e.push(i(n,o)),t+=o.length}return e}slice(i){let e=[],t=0;for(let o of this._tokenInfo){let n=t,r=n+o.length;if(r>i.start){if(n>=i.endExclusive)break;let s=Math.max(0,i.start-n),l=Math.max(0,r-i.endExclusive);e.push(new c$e(o.length-s-l,o.metadata))}t+=o.length}return a.create(e)}append(i){let e=this._tokenInfo.concat(i._tokenInfo);return a.create(e)}},c$e=class{constructor(i,e){this.length=i;this.metadata=e}},GYt=class{constructor(){this._tokens=[]}add(i,e){this._tokens.push(new c$e(i,e))}build(){return aW.create(this._tokens)}};var lse=class{constructor(i,e,t){this._indentRulesSupport=e,this._indentationLineProcessor=new eht(i,t)}shouldIncrease(i,e){let t=this._indentationLineProcessor.getProcessedLine(i,e);return this._indentRulesSupport.shouldIncrease(t)}shouldDecrease(i,e){let t=this._indentationLineProcessor.getProcessedLine(i,e);return this._indentRulesSupport.shouldDecrease(t)}shouldIgnore(i,e){let t=this._indentationLineProcessor.getProcessedLine(i,e);return this._indentRulesSupport.shouldIgnore(t)}shouldIndentNextLine(i,e){let t=this._indentationLineProcessor.getProcessedLine(i,e);return this._indentRulesSupport.shouldIndentNextLine(t)}},cse=class{constructor(i,e){this.model=i,this.indentationLineProcessor=new eht(i,e)}getProcessedTokenContextAroundRange(i){let e=this._getProcessedTokensBeforeRange(i),t=this._getProcessedTokensAfterRange(i),o=this._getProcessedPreviousLineTokens(i);return{beforeRangeProcessedTokens:e,afterRangeProcessedTokens:t,previousLineProcessedTokens:o}}_getProcessedTokensBeforeRange(i){this.model.tokenization.forceTokenization(i.startLineNumber);let e=this.model.tokenization.getLineTokens(i.startLineNumber),t=gU(e,i.startColumn-1),o;if(tht(this.model,i.getStartPosition())){let r=i.startColumn-1-t.firstCharOffset,s=t.firstCharOffset,l=s+r;o=e.sliceAndInflate(s,l,0)}else{let r=i.startColumn-1;o=e.sliceAndInflate(0,r,0)}return this.indentationLineProcessor.getProcessedTokens(o)}_getProcessedTokensAfterRange(i){let e=i.isEmpty()?i.getStartPosition():i.getEndPosition();this.model.tokenization.forceTokenization(e.lineNumber);let t=this.model.tokenization.getLineTokens(e.lineNumber),o=gU(t,e.column-1),n=e.column-1-o.firstCharOffset,r=o.firstCharOffset+n,s=o.firstCharOffset+o.getLineLength(),l=t.sliceAndInflate(r,s,0);return this.indentationLineProcessor.getProcessedTokens(l)}_getProcessedPreviousLineTokens(i){let e=g=>{this.model.tokenization.forceTokenization(g);let f=this.model.tokenization.getLineTokens(g),v=this.model.getLineMaxColumn(g)-1;return gU(f,v)};this.model.tokenization.forceTokenization(i.startLineNumber);let t=this.model.tokenization.getLineTokens(i.startLineNumber),o=gU(t,i.startColumn-1),n=Bc.createEmpty("",o.languageIdCodec),r=i.startLineNumber-1;if(r===0||!(o.firstCharOffset===0))return n;let c=e(r);if(!(o.languageId===c.languageId))return n;let p=c.toIViewLineTokens();return this.indentationLineProcessor.getProcessedTokens(p)}},eht=class{constructor(i,e){this.model=i;this.languageConfigurationService=e}getProcessedLine(i,e){let t=(r,s)=>{let l=bl(r);return s+r.substring(l.length)};this.model.tokenization.forceTokenization?.(i);let o=this.model.tokenization.getLineTokens(i),n=this.getProcessedTokens(o).getLineContent();return e!==void 0&&(n=t(n,e)),n}getProcessedTokens(i){let e=l=>l===2||l===3||l===1,t=i.getLanguageId(0),n=this.languageConfigurationService.getLanguageConfiguration(t).bracketsNew.getBracketRegExp({global:!0}),r=[];return i.forEach(l=>{let c=i.getStandardTokenType(l),u=i.getTokenText(l);e(c)&&(u=u.replace(n,""));let p=i.getMetadata(l);r.push({text:u,metadata:p})}),Bc.createFromTextAndMetadata(r,i.languageIdCodec)}};function tht(a,i){a.tokenization.forceTokenization(i.lineNumber);let e=a.tokenization.getLineTokens(i.lineNumber),t=gU(e,i.column-1),o=t.firstCharOffset===0,n=e.getLanguageId(0)===t.languageId;return!o&&!n}function R$(a,i,e,t){i.tokenization.forceTokenization(e.startLineNumber);let o=i.getLanguageIdAtPosition(e.startLineNumber,e.startColumn),n=t.getLanguageConfiguration(o);if(!n)return null;let s=new cse(i,t).getProcessedTokenContextAroundRange(e),l=s.previousLineProcessedTokens.getLineContent(),c=s.beforeRangeProcessedTokens.getLineContent(),u=s.afterRangeProcessedTokens.getLineContent(),p=n.onEnter(a,l,c,u);if(!p)return null;let h=p.indentAction,g=p.appendText,f=p.removeText||0;g?h===1&&(g=" "+g):h===1||h===2?g=" ":g="";let v=Jmt(i,e.startLineNumber,e.startColumn);return f&&(v=v.substring(0,v.length-f)),{indentAction:h,appendText:g,removeText:f,indentation:v}}var $Yt=Object.create(null);function dse(a,i){if(i<=0)return"";$Yt[a]||($Yt[a]=["",a]);let e=$Yt[a];for(let t=e.length;t<=i;t++)e[t]=e[t-1]+a;return e[i]}var Xv=class{constructor(i,e,t){this._languageConfigurationService=t;this._opts=e,this._selection=i,this._selectionId=null,this._useLastEditRangeForCursorEndPosition=!1,this._selectionStartColumnStaysPut=!1}static unshiftIndent(i,e,t,o,n){let r=al.visibleColumnFromColumn(i,e,t);if(n){let s=dse(" ",o),c=al.prevIndentTabStop(r,o)/o;return dse(s,c)}else{let c=al.prevRenderTabStop(r,t)/t;return dse(" ",c)}}static shiftIndent(i,e,t,o,n){let r=al.visibleColumnFromColumn(i,e,t);if(n){let s=dse(" ",o),c=al.nextIndentTabStop(r,o)/o;return dse(s,c)}else{let c=al.nextRenderTabStop(r,t)/t;return dse(" ",c)}}_addEditOperation(i,e,t){this._useLastEditRangeForCursorEndPosition?i.addTrackedEditOperation(e,t):i.addEditOperation(e,t)}getEditOperations(i,e){let t=this._selection.startLineNumber,o=this._selection.endLineNumber;this._selection.endColumn===1&&t!==o&&(o=o-1);let{tabSize:n,indentSize:r,insertSpaces:s}=this._opts,l=t===o;if(this._opts.useTabStops){this._selection.isEmpty()&&/^\s*$/.test(i.getLineContent(t))&&(this._useLastEditRangeForCursorEndPosition=!0);let c=0,u=0;for(let p=t;p<=o;p++,c=u){u=0;let h=i.getLineContent(p),g=Ap(h);if(this._opts.isUnshift&&(h.length===0||g===0)||!l&&!this._opts.isUnshift&&h.length===0)continue;if(g===-1&&(g=h.length),p>1&&al.visibleColumnFromColumn(h,g+1,n)%r!==0&&i.tokenization.isCheapToTokenize(p-1)){let b=R$(this._opts.autoIndent,i,new z(p-1,i.getLineMaxColumn(p-1),p-1,i.getLineMaxColumn(p-1)),this._languageConfigurationService);if(b){if(u=c,b.appendText)for(let S=0,y=b.appendText.length;S<y&&u<r&&b.appendText.charCodeAt(S)===32;S++)u++;b.removeText&&(u=Math.max(0,u-b.removeText));for(let S=0;S<u&&!(g===0||h.charCodeAt(g-1)!==32);S++)g--}}if(this._opts.isUnshift&&g===0)continue;let f;this._opts.isUnshift?f=Xv.unshiftIndent(h,g+1,n,r,s):f=Xv.shiftIndent(h,g+1,n,r,s),this._addEditOperation(e,new z(p,1,p,g+1),f),p===t&&!this._selection.isEmpty()&&(this._selectionStartColumnStaysPut=this._selection.startColumn<=g+1)}}else{!this._opts.isUnshift&&this._selection.isEmpty()&&i.getLineLength(t)===0&&(this._useLastEditRangeForCursorEndPosition=!0);let c=s?dse(" ",r):" ";for(let u=t;u<=o;u++){let p=i.getLineContent(u),h=Ap(p);if(!(this._opts.isUnshift&&(p.length===0||h===0))&&!(!l&&!this._opts.isUnshift&&p.length===0)&&(h===-1&&(h=p.length),!(this._opts.isUnshift&&h===0)))if(this._opts.isUnshift){h=Math.min(h,r);for(let g=0;g<h;g++)if(p.charCodeAt(g)===9){h=g+1;break}this._addEditOperation(e,new z(u,1,u,h+1),"")}else this._addEditOperation(e,new z(u,1,u,1),c),u===t&&!this._selection.isEmpty()&&(this._selectionStartColumnStaysPut=this._selection.startColumn===1)}}this._selectionId=e.trackSelection(this._selection)}computeCursorState(i,e){if(this._useLastEditRangeForCursorEndPosition){let o=e.getInverseEditOperations()[0];return new Yt(o.range.endLineNumber,o.range.endColumn,o.range.endLineNumber,o.range.endColumn)}let t=e.getTrackedSelection(this._selectionId);if(this._selectionStartColumnStaysPut){let o=this._selection.startColumn;return t.startColumn<=o?t:t.getDirection()===0?new Yt(t.startLineNumber,o,t.endLineNumber,t.endColumn):new Yt(t.endLineNumber,t.endColumn,t.startLineNumber,o)}return t}};Xv=I([m(2,bs)],Xv);var iht=class{constructor(i,e,t){this._range=i,this._charBeforeSelection=e,this._charAfterSelection=t}getEditOperations(i,e){e.addTrackedEditOperation(new z(this._range.startLineNumber,this._range.startColumn,this._range.startLineNumber,this._range.startColumn),this._charBeforeSelection),e.addTrackedEditOperation(new z(this._range.endLineNumber,this._range.endColumn,this._range.endLineNumber,this._range.endColumn),this._charAfterSelection||null)}computeCursorState(i,e){let t=e.getInverseEditOperations(),o=t[0].range,n=t[1].range;return new Yt(o.endLineNumber,o.endColumn,n.endLineNumber,n.endColumn-this._charAfterSelection.length)}},oht=class{constructor(i,e,t){this._position=i;this._text=e;this._charAfter=t}getEditOperations(i,e){e.addTrackedEditOperation(new z(this._position.lineNumber,this._position.column,this._position.lineNumber,this._position.column),this._text+this._charAfter)}computeCursorState(i,e){let o=e.getInverseEditOperations()[0].range;return new Yt(o.endLineNumber,o.startColumn,o.endLineNumber,o.endColumn-this._charAfter.length)}};function EMo(a,i,e){let t=a.tokenization.getLanguageIdAtPosition(i,0);if(i>1){let o,n=-1;for(o=i-1;o>=1;o--){if(a.tokenization.getLanguageIdAtPosition(o,0)!==t)return n;let r=a.getLineContent(o);if(e.shouldIgnore(o)||/^\s+$/.test(r)||r===""){n=o;continue}return o}}return-1}function ISe(a,i,e,t=!0,o){if(a<4)return null;let n=o.getLanguageConfiguration(i.tokenization.getLanguageId()).indentRulesSupport;if(!n)return null;let r=new lse(i,n,o);if(e<=1)return{indentation:"",action:null};for(let l=e-1;l>0&&i.getLineContent(l)==="";l--)if(l===1)return{indentation:"",action:null};let s=EMo(i,e,r);if(s<0)return null;if(s<1)return{indentation:"",action:null};if(r.shouldIncrease(s)||r.shouldIndentNextLine(s)){let l=i.getLineContent(s);return{indentation:bl(l),action:1,line:s}}else if(r.shouldDecrease(s)){let l=i.getLineContent(s);return{indentation:bl(l),action:null,line:s}}else{if(s===1)return{indentation:bl(i.getLineContent(s)),action:null,line:s};let l=s-1,c=n.getIndentMetadata(i.getLineContent(l));if(!(c&3)&&c&4){let u=0;for(let p=l-1;p>0;p--)if(!r.shouldIndentNextLine(p)){u=p;break}return{indentation:bl(i.getLineContent(u+1)),action:null,line:u+1}}if(t)return{indentation:bl(i.getLineContent(s)),action:null,line:s};for(let u=s;u>0;u--){if(r.shouldIncrease(u))return{indentation:bl(i.getLineContent(u)),action:1,line:u};if(r.shouldIndentNextLine(u)){let p=0;for(let h=u-1;h>0;h--)if(!r.shouldIndentNextLine(u)){p=h;break}return{indentation:bl(i.getLineContent(p+1)),action:null,line:p+1}}else if(r.shouldDecrease(u))return{indentation:bl(i.getLineContent(u)),action:null,line:u}}return{indentation:bl(i.getLineContent(1)),action:null,line:1}}}function use(a,i,e,t,o,n){if(a<4)return null;let r=n.getLanguageConfiguration(e);if(!r)return null;let s=n.getLanguageConfiguration(e).indentRulesSupport;if(!s)return null;let l=new lse(i,s,n),c=ISe(a,i,t,void 0,n);if(c){let u=c.line;if(u!==void 0){let p=!0;for(let h=u;h<t-1;h++)if(!/^\s*$/.test(i.getLineContent(h))){p=!1;break}if(p){let h=r.onEnter(a,"",i.getLineContent(u),"");if(h){let g=bl(i.getLineContent(u));return h.removeText&&(g=g.substring(0,g.length-h.removeText)),h.indentAction===1||h.indentAction===2?g=o.shiftIndent(g):h.indentAction===3&&(g=o.unshiftIndent(g)),l.shouldDecrease(t)&&(g=o.unshiftIndent(g)),h.appendText&&(g+=h.appendText),bl(g)}}}return l.shouldDecrease(t)?c.action===1?c.indentation:o.unshiftIndent(c.indentation):c.action===1?o.shiftIndent(c.indentation):c.indentation}return null}function UKi(a,i,e,t,o){if(a<4)return null;let n=i.getLanguageIdAtPosition(e.startLineNumber,e.startColumn),r=o.getLanguageConfiguration(n).indentRulesSupport;if(!r)return null;i.tokenization.forceTokenization(e.startLineNumber);let l=new cse(i,o).getProcessedTokenContextAroundRange(e),c=l.afterRangeProcessedTokens,u=l.beforeRangeProcessedTokens,p=bl(u.getLineContent()),h=TMo(i,e.startLineNumber,u),g=tht(i,e.getStartPosition()),f=i.getLineContent(e.startLineNumber),v=bl(f),b=ISe(a,h,e.startLineNumber+1,void 0,o);if(!b){let y=g?v:p;return{beforeEnter:y,afterEnter:y}}let S=g?v:b.indentation;return b.action===1&&(S=t.shiftIndent(S)),r.shouldDecrease(c.getLineContent())&&(S=t.unshiftIndent(S)),{beforeEnter:g?v:p,afterEnter:S}}function zKi(a,i,e,t,o,n){let r=a.autoIndent;if(r<4||tht(i,e.getStartPosition()))return null;let l=i.getLanguageIdAtPosition(e.startLineNumber,e.startColumn),c=n.getLanguageConfiguration(l).indentRulesSupport;if(!c)return null;let p=new cse(i,n).getProcessedTokenContextAroundRange(e),h=p.beforeRangeProcessedTokens.getLineContent(),g=p.afterRangeProcessedTokens.getLineContent(),f=h+g,v=h+t+g;if(!c.shouldDecrease(f)&&c.shouldDecrease(v)){let S=ISe(r,i,e.startLineNumber,!1,n);if(!S)return null;let y=S.indentation;return S.action!==1&&(y=o.unshiftIndent(y)),y}let b=e.startLineNumber-1;if(b>0){let S=i.getLineContent(b);if(c.shouldIndentNextLine(S)&&c.shouldIncrease(v)){let w=ISe(r,i,e.startLineNumber,!1,n)?.indentation;if(w!==void 0){let k=i.getLineContent(e.startLineNumber),T=bl(k),O=o.shiftIndent(w)===T,V=/^\s*$/.test(f),U=a.autoClosingPairs.autoClosingPairsOpenByEnd.get(t),$=U&&U.length>0&&V;if(O&&$)return w}}}return null}function nht(a,i,e){let t=e.getLanguageConfiguration(a.getLanguageId()).indentRulesSupport;return!t||i<1||i>a.getLineCount()?null:t.getIndentMetadata(a.getLineContent(i))}function TMo(a,i,e){return{tokenization:{getLineTokens:o=>o===i?e:a.tokenization.getLineTokens(o),getLanguageId:()=>a.getLanguageId(),getLanguageIdAtPosition:(o,n)=>a.getLanguageIdAtPosition(o,n)},getLineContent:o=>o===i?e.getLineContent():a.getLineContent(o)}}var rht=class{static getEdits(i,e,t,o,n){if(!n&&this._isAutoIndentType(i,e,t)){let r=[];for(let l of t){let c=this._findActualIndentationForSelection(i,e,l,o);if(c===null)return;r.push({selection:l,indentation:c})}let s=ySe.getAutoClosingPairClose(i,e,t,o,!1);return this._getIndentationAndAutoClosingPairEdits(i,e,r,o,s)}}static _isAutoIndentType(i,e,t){if(i.autoIndent<4)return!1;for(let o=0,n=t.length;o<n;o++)if(!e.tokenization.isCheapToTokenize(t[o].getEndPosition().lineNumber))return!1;return!0}static _findActualIndentationForSelection(i,e,t,o){let n=zKi(i,e,t,o,{shiftIndent:s=>u$e(i,s),unshiftIndent:s=>CSe(i,s)},i.languageConfigurationService);if(n===null)return null;let r=Jmt(e,t.startLineNumber,t.startColumn);return n===i.normalizeIndentation(r)?null:n}static _getIndentationAndAutoClosingPairEdits(i,e,t,o,n){let r=t.map(({selection:l,indentation:c})=>{if(n!==null){let u=this._getEditFromIndentationAndSelection(i,e,c,l,o,!1);return new jYt(u,l,o,n)}else{let u=this._getEditFromIndentationAndSelection(i,e,c,l,o,!0);return pse(u.range,u.text,!1)}}),s={shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1};return new Yv(4,r,s)}static _getEditFromIndentationAndSelection(i,e,t,o,n,r=!0){let s=o.startLineNumber,l=e.getLineFirstNonWhitespaceColumn(s),c=i.normalizeIndentation(t);if(l!==0){let p=e.getLineContent(s);c+=p.substring(l-1,o.startColumn-1)}return c+=r?n:"",{range:new z(s,1,o.endLineNumber,o.endColumn),text:c}}},sht=class{static getEdits(i,e,t,o,n,r){if($Ki(e,t,o,n,r))return this._runAutoClosingOvertype(i,o,r)}static _runAutoClosingOvertype(i,e,t){let o=[];for(let n=0,r=e.length;n<r;n++){let l=e[n].getPosition(),c=new z(l.lineNumber,l.column,l.lineNumber,l.column+1);o[n]=new Wh(c,t)}return new Yv(4,o,{shouldPushStackElementBefore:ght(i,4),shouldPushStackElementAfter:!1})}},aht=class{static getEdits(i,e,t,o,n){if($Ki(i,e,t,o,n)){let r=t.map(s=>new Wh(new z(s.positionLineNumber,s.positionColumn,s.positionLineNumber,s.positionColumn+1),"",!1));return new Yv(4,r,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1})}}},ySe=class{static getEdits(i,e,t,o,n,r){if(!r){let s=this.getAutoClosingPairClose(i,e,t,o,n);if(s!==null)return this._runAutoClosingOpenCharType(t,o,n,s)}}static _runAutoClosingOpenCharType(i,e,t,o){let n=[];for(let r=0,s=i.length;r<s;r++){let l=i[r];n[r]=new qYt(l,e,!t,o)}return new Yv(4,n,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1})}static getAutoClosingPairClose(i,e,t,o,n){for(let f of t)if(!f.isEmpty())return null;let r=t.map(f=>{let v=f.getPosition();return n?{lineNumber:v.lineNumber,beforeColumn:v.column-o.length,afterColumn:v.column}:{lineNumber:v.lineNumber,beforeColumn:v.column,afterColumn:v.column}}),s=this._findAutoClosingPairOpen(i,e,r.map(f=>new Ie(f.lineNumber,f.beforeColumn)),o);if(!s)return null;let l,c;if(sW(o)?(l=i.autoClosingQuotes,c=i.shouldAutoCloseBefore.quote):(i.blockCommentStartToken?s.open.includes(i.blockCommentStartToken):!1)?(l=i.autoClosingComments,c=i.shouldAutoCloseBefore.comment):(l=i.autoClosingBrackets,c=i.shouldAutoCloseBefore.bracket),l==="never")return null;let p=this._findContainedAutoClosingPair(i,s),h=p?p.close:"",g=!0;for(let f of r){let{lineNumber:v,beforeColumn:b,afterColumn:S}=f,y=e.getLineContent(v),w=y.substring(0,b-1),k=y.substring(S-1);if(k.startsWith(h)||(g=!1),k.length>0){let V=k.charAt(0);if(!this._isBeforeClosingBrace(i,k)&&!c(V))return null}if(s.open.length===1&&(o==="'"||o==='"')&&l!=="always"){let V=jw(i.wordSeparators,[]);if(w.length>0){let U=w.charCodeAt(w.length-1);if(V.get(U)===0)return null}}if(!e.tokenization.isCheapToTokenize(v))return null;e.tokenization.forceTokenization(v);let T=e.tokenization.getLineTokens(v),N=gU(T,b-1);if(!s.shouldAutoClose(N,b-N.firstCharOffset))return null;let O=s.findNeutralCharacter();if(O){let V=e.tokenization.getTokenTypeIfInsertingCharacter(v,b,O);if(!s.isOK(V))return null}}return g?s.close.substring(0,s.close.length-h.length):s.close}static _findContainedAutoClosingPair(i,e){if(e.open.length<=1)return null;let t=e.close.charAt(e.close.length-1),o=i.autoClosingPairs.autoClosingPairsCloseByEnd.get(t)||[],n=null;for(let r of o)r.open!==e.open&&e.open.includes(r.open)&&e.close.endsWith(r.close)&&(!n||r.open.length>n.open.length)&&(n=r);return n}static _findAutoClosingPairOpen(i,e,t,o){let n=i.autoClosingPairs.autoClosingPairsOpenByEnd.get(o);if(!n)return null;let r=null;for(let s of n)if(r===null||s.open.length>r.open.length){let l=!0;for(let c of t)if(e.getValueInRange(new z(c.lineNumber,c.column-s.open.length+1,c.lineNumber,c.column))+o!==s.open){l=!1;break}l&&(r=s)}return r}static _isBeforeClosingBrace(i,e){let t=e.charAt(0),o=i.autoClosingPairs.autoClosingPairsOpenByStart.get(t)||[],n=i.autoClosingPairs.autoClosingPairsCloseByStart.get(t)||[],r=o.some(l=>e.startsWith(l.open)),s=n.some(l=>e.startsWith(l.close));return!r&&s}},d$e=class{static getEdits(i,e){if(!(i.inputMode==="overtype"))return null;let o=e.map(n=>new Dmt(n.insertedTextRange));return new Yv(4,o,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1})}},lht=class{static getEdits(i,e,t,o,n){if(!n&&this._isSurroundSelectionType(i,e,t,o))return this._runSurroundSelectionType(i,t,o)}static _runSurroundSelectionType(i,e,t){let o=[];for(let n=0,r=e.length;n<r;n++){let s=e[n],l=i.surroundingPairs[t];o[n]=new iht(s,t,l)}return new Yv(0,o,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!0})}static _isSurroundSelectionType(i,e,t,o){if(!YYt(i,o)||!i.surroundingPairs.hasOwnProperty(o))return!1;let n=sW(o);for(let r of t){if(r.isEmpty())return!1;let s=!0;for(let l=r.startLineNumber;l<=r.endLineNumber;l++){let c=e.getLineContent(l),u=l===r.startLineNumber?r.startColumn-1:0,p=l===r.endLineNumber?r.endColumn-1:c.length,h=c.substring(u,p);if(/[^ \t]/.test(h)){s=!1;break}}if(s)return!1;if(n&&r.startLineNumber===r.endLineNumber&&r.startColumn+1===r.endColumn){let l=e.getValueInRange(r);if(sW(l))return!1}}return!0}},cht=class{static getEdits(i,e,t,o,n,r){if(!r&&this._isTypeInterceptorElectricChar(e,t,o)){let s=this._typeInterceptorElectricChar(i,e,t,o[0],n);if(s)return s}}static _isTypeInterceptorElectricChar(i,e,t){return!!(t.length===1&&e.tokenization.isCheapToTokenize(t[0].getEndPosition().lineNumber))}static _typeInterceptorElectricChar(i,e,t,o,n){if(!e.electricChars.hasOwnProperty(n)||!o.isEmpty())return null;let r=o.getPosition();t.tokenization.forceTokenization(r.lineNumber);let s=t.tokenization.getLineTokens(r.lineNumber),l;try{l=e.onElectricCharacter(n,s,r.column)}catch(c){return mt(c),null}if(!l)return null;if(l.matchOpenBracket){let c=(s.getLineContent()+n).lastIndexOf(l.matchOpenBracket)+1,u=t.bracketPairs.findMatchingBracketUp(l.matchOpenBracket,{lineNumber:r.lineNumber,column:c},500);if(u){if(u.startLineNumber===r.lineNumber)return null;let p=t.getLineContent(u.startLineNumber),h=bl(p),g=e.normalizeIndentation(h),f=t.getLineContent(r.lineNumber),v=t.getLineFirstNonWhitespaceColumn(r.lineNumber)||r.column,b=f.substring(v-1,r.column-1),S=g+b+n,y=new z(r.lineNumber,1,r.lineNumber,r.column),w=new Wh(y,S);return new Yv(QYt(S,i),[w],{shouldPushStackElementBefore:!1,shouldPushStackElementAfter:!0})}}return null}},dht=class{static getEdits(i,e,t,o,n){let r=[];for(let l=0,c=t.length;l<c;l++){let u=i.inputMode==="overtype"&&!n?aSe:Wh;r[l]=new u(t[l],o)}let s=QYt(o,e);return new Yv(s,r,{shouldPushStackElementBefore:ght(e,s),shouldPushStackElementAfter:!1})}},M$=class{static getEdits(i,e,t,o,n){if(!n&&o===`
`){let r=[];for(let s=0,l=t.length;s<l;s++)r[s]=this._enter(i,e,!1,t[s]);return new Yv(4,r,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1})}}static _enter(i,e,t,o){if(i.autoIndent===0)return pse(o,`
`,t);if(!e.tokenization.isCheapToTokenize(o.getStartPosition().lineNumber)||i.autoIndent===1){let l=e.getLineContent(o.startLineNumber),c=bl(l).substring(0,o.startColumn-1);return pse(o,`
`+i.normalizeIndentation(c),t)}let n=R$(i.autoIndent,e,o,i.languageConfigurationService);if(n){if(n.indentAction===0)return pse(o,`
`+i.normalizeIndentation(n.indentation+n.appendText),t);if(n.indentAction===1)return pse(o,`
`+i.normalizeIndentation(n.indentation+n.appendText),t);if(n.indentAction===2){let l=i.normalizeIndentation(n.indentation),c=i.normalizeIndentation(n.indentation+n.appendText),u=`
`+c+`
`+l;return t?new Xre(o,u,!0):new Jre(o,u,-1,c.length-l.length,!0)}else if(n.indentAction===3){let l=CSe(i,n.indentation);return pse(o,`
`+i.normalizeIndentation(l+n.appendText),t)}}let r=e.getLineContent(o.startLineNumber),s=bl(r).substring(0,o.startColumn-1);if(i.autoIndent>=4){let l=UKi(i.autoIndent,e,o,{unshiftIndent:c=>CSe(i,c),shiftIndent:c=>u$e(i,c),normalizeIndentation:c=>i.normalizeIndentation(c)},i.languageConfigurationService);if(l){let c=i.visibleColumnFromColumn(e,o.getEndPosition()),u=o.endColumn,p=e.getLineContent(o.endLineNumber),h=Ap(p);if(h>=0?o=o.setEndPosition(o.endLineNumber,Math.max(o.endColumn,h+1)):o=o.setEndPosition(o.endLineNumber,e.getLineMaxColumn(o.endLineNumber)),t)return new Xre(o,`
`+i.normalizeIndentation(l.afterEnter),!0);{let g=0;return u<=h+1&&(i.insertSpaces||(c=Math.ceil(c/i.indentSize)),g=Math.min(c+1-i.normalizeIndentation(l.afterEnter).length-1,0)),new Jre(o,`
`+i.normalizeIndentation(l.afterEnter),0,g,!0)}}}return pse(o,`
`+i.normalizeIndentation(s),t)}static lineInsertBefore(i,e,t){if(e===null||t===null)return[];let o=[];for(let n=0,r=t.length;n<r;n++){let s=t[n].positionLineNumber;if(s===1)o[n]=new Xre(new z(1,1,1,1),`
`);else{s--;let l=e.getLineMaxColumn(s);o[n]=this._enter(i,e,!1,new z(s,l,s,l))}}return o}static lineInsertAfter(i,e,t){if(e===null||t===null)return[];let o=[];for(let n=0,r=t.length;n<r;n++){let s=t[n].positionLineNumber,l=e.getLineMaxColumn(s);o[n]=this._enter(i,e,!1,new z(s,l,s,l))}return o}static lineBreakInsert(i,e,t){let o=[];for(let n=0,r=t.length;n<r;n++)o[n]=this._enter(i,e,!0,t[n]);return o}},uht=class{static getEdits(i,e,t,o,n,r){let s=this._distributePasteToCursors(i,t,o,n,r);return s?(t=t.sort(z.compareRangesUsingStarts),this._distributedPaste(i,e,t,s)):this._simplePaste(i,e,t,o,n)}static _distributePasteToCursors(i,e,t,o,n){if(e.length===1)return null;if(n&&n.length===e.length)return n;if(o)return null;if(i.multiCursorPaste==="spread"){t.charCodeAt(t.length-1)===10&&(t=t.substring(0,t.length-1)),t.charCodeAt(t.length-1)===13&&(t=t.substring(0,t.length-1));let r=mc(t);if(r.length===e.length)return r}return null}static _distributedPaste(i,e,t,o){let n=[];for(let r=0,s=t.length;r<s;r++){let c=i.overtypeOnPaste&&i.inputMode==="overtype"?aSe:Wh;n[r]=new c(t[r],o[r])}return new Yv(0,n,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!0})}static _simplePaste(i,e,t,o,n){let r=[];for(let s=0,l=t.length;s<l;s++){let c=t[s],u=c.getPosition();if(n&&!c.isEmpty()&&(n=!1),n&&o.indexOf(`
`)!==o.length-1&&(n=!1),n){let p=new z(u.lineNumber,1,u.lineNumber,1);r[s]=new B6(p,o,c,!0)}else{let h=i.overtypeOnPaste&&i.inputMode==="overtype"?aSe:Wh;r[s]=new h(c,o)}}return new Yv(0,r,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!0})}},pht=class{static getEdits(i,e,t,o,n,r,s,l){let c=o.map(u=>this._compositionType(t,u,n,r,s,l));return new Yv(4,c,{shouldPushStackElementBefore:ght(i,4),shouldPushStackElementAfter:!1})}static _compositionType(i,e,t,o,n,r){if(!e.isEmpty())return null;let s=e.getPosition(),l=Math.max(1,s.column-o),c=Math.min(i.getLineMaxColumn(s.lineNumber),s.column+n),u=new z(s.lineNumber,l,s.lineNumber,c);return new Jre(u,t,0,r)}},mht=class{static getEdits(i,e,t){let o=[];for(let r=0,s=e.length;r<s;r++)o[r]=new Wh(e[r],t);let n=QYt(t,i);return new Yv(n,o,{shouldPushStackElementBefore:ght(i,n),shouldPushStackElementAfter:!1})}},hht=class{static getCommands(i,e,t){let o=[];for(let n=0,r=t.length;n<r;n++){let s=t[n];if(s.isEmpty()){let l=e.getLineContent(s.startLineNumber);if(/^\s*$/.test(l)&&e.tokenization.isCheapToTokenize(s.startLineNumber)){let c=this._goodIndentForLine(i,e,s.startLineNumber);c=c||" ";let u=i.normalizeIndentation(c);if(!l.startsWith(u)){o[n]=new Wh(new z(s.startLineNumber,1,s.startLineNumber,l.length+1),u,!0);continue}}o[n]=this._replaceJumpToNextIndent(i,e,s,!0)}else{if(s.startLineNumber===s.endLineNumber){let l=e.getLineMaxColumn(s.startLineNumber);if(s.startColumn!==1||s.endColumn!==l){o[n]=this._replaceJumpToNextIndent(i,e,s,!1);continue}}o[n]=new Xv(s,{isUnshift:!1,tabSize:i.tabSize,indentSize:i.indentSize,insertSpaces:i.insertSpaces,useTabStops:i.useTabStops,autoIndent:i.autoIndent},i.languageConfigurationService)}}return o}static _goodIndentForLine(i,e,t){let o=null,n="",r=ISe(i.autoIndent,e,t,!1,i.languageConfigurationService);if(r)o=r.action,n=r.indentation;else if(t>1){let s;for(s=t-1;s>=1;s--){let u=e.getLineContent(s);if(tv(u)>=0)break}if(s<1)return null;let l=e.getLineMaxColumn(s),c=R$(i.autoIndent,e,new z(s,l,s,l),i.languageConfigurationService);c&&(n=c.indentation+c.appendText)}return o&&(o===1&&(n=u$e(i,n)),o===3&&(n=CSe(i,n)),n=i.normalizeIndentation(n)),n||null}static _replaceJumpToNextIndent(i,e,t,o){let n="",r=t.getStartPosition();if(i.insertSpaces){let s=i.visibleColumnFromColumn(e,r),l=i.indentSize,c=l-s%l;for(let u=0;u<c;u++)n+=" "}else n=" ";return new Wh(t,n,o)}},wSe=class extends Jre{constructor(i,e,t,o,n,r){super(i,e,t,o),this._openCharacter=n,this._closeCharacter=r,this.closeCharacterRange=null,this.enclosingRange=null}_computeCursorStateWithRange(i,e,t){return this.closeCharacterRange=new z(e.startLineNumber,e.endColumn-this._closeCharacter.length,e.endLineNumber,e.endColumn),this.enclosingRange=new z(e.startLineNumber,e.endColumn-this._openCharacter.length-this._closeCharacter.length,e.endLineNumber,e.endColumn),super.computeCursorState(i,t)}},qYt=class extends wSe{constructor(i,e,t,o){let n=(t?e:"")+o,r=0,s=-o.length;super(i,n,r,s,e,o)}computeCursorState(i,e){let o=e.getInverseEditOperations()[0].range;return this._computeCursorStateWithRange(i,o,e)}},jYt=class extends wSe{constructor(i,e,t,o){let n=t+o,r=0,s=t.length;super(e,n,r,s,t,o),this._autoIndentationEdit=i,this._autoClosingEdit={range:e,text:n}}getEditOperations(i,e){e.addTrackedEditOperation(this._autoIndentationEdit.range,this._autoIndentationEdit.text),e.addTrackedEditOperation(this._autoClosingEdit.range,this._autoClosingEdit.text)}computeCursorState(i,e){let t=e.getInverseEditOperations();if(t.length!==2)throw new Error("There should be two inverse edit operations!");let o=t[0].range,n=t[1].range,r=o.plusRange(n);return this._computeCursorStateWithRange(i,r,e)}};function QYt(a,i){return a===" "?i===5||i===6?6:5:4}function ght(a,i){return GKi(a)&&!GKi(i)?!0:a===5?!1:KKi(a)!==KKi(i)}function KKi(a){return a===6||a===5?"space":a}function GKi(a){return a===4||a===5||a===6}function $Ki(a,i,e,t,o){if(a.autoClosingOvertype==="never"||!a.autoClosingPairs.autoClosingPairsCloseSingleChar.has(o))return!1;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(!s.isEmpty())return!1;let l=s.getPosition(),c=i.getLineContent(l.lineNumber);if(c.charAt(l.column-1)!==o)return!1;let p=sW(o);if((l.column>2?c.charCodeAt(l.column-2):0)===92&&p)return!1;if(a.autoClosingOvertype==="auto"){let g=!1;for(let f=0,v=t.length;f<v;f++){let b=t[f];if(l.lineNumber===b.startLineNumber&&l.column===b.startColumn){g=!0;break}}if(!g)return!1}}return!0}function pse(a,i,e){return e?new Xre(a,i,!0):new Wh(a,i,!0)}function u$e(a,i,e){return e=e||1,Xv.shiftIndent(i,i.length+e,a.tabSize,a.indentSize,a.insertSpaces)}function CSe(a,i,e){return e=e||1,Xv.unshiftIndent(i,i.length+e,a.tabSize,a.indentSize,a.insertSpaces)}function YYt(a,i){return sW(i)?a.autoSurround==="quotes"||a.autoSurround==="languageDefined":a.autoSurround==="brackets"||a.autoSurround==="languageDefined"}var RM=class{static indent(i,e,t){if(e===null||t===null)return[];let o=[];for(let n=0,r=t.length;n<r;n++)o[n]=new Xv(t[n],{isUnshift:!1,tabSize:i.tabSize,indentSize:i.indentSize,insertSpaces:i.insertSpaces,useTabStops:i.useTabStops,autoIndent:i.autoIndent},i.languageConfigurationService);return o}static outdent(i,e,t){let o=[];for(let n=0,r=t.length;n<r;n++)o[n]=new Xv(t[n],{isUnshift:!0,tabSize:i.tabSize,indentSize:i.indentSize,insertSpaces:i.insertSpaces,useTabStops:i.useTabStops,autoIndent:i.autoIndent},i.languageConfigurationService);return o}static shiftIndent(i,e,t){return u$e(i,e,t)}static unshiftIndent(i,e,t){return CSe(i,e,t)}static paste(i,e,t,o,n,r){return uht.getEdits(i,e,t,o,n,r)}static tab(i,e,t){return hht.getCommands(i,e,t)}static compositionType(i,e,t,o,n,r,s,l){return pht.getEdits(i,e,t,o,n,r,s,l)}static compositionEndWithInterceptors(i,e,t,o,n,r){if(!o)return null;let s=null;for(let h of o)if(s===null)s=h.insertedText;else if(s!==h.insertedText)return null;if(!s||s.length!==1)return d$e.getEdits(e,o);let l=s,c=!1;for(let h of o)if(h.deletedText.length!==0){c=!0;break}if(c){if(!YYt(e,l)||!e.surroundingPairs.hasOwnProperty(l))return null;let h=sW(l);for(let v of o)if(v.deletedSelectionStart!==0||v.deletedSelectionEnd!==v.deletedText.length||/^[ \t]+$/.test(v.deletedText)||h&&sW(v.deletedText))return null;let g=[];for(let v of n){if(!v.isEmpty())return null;g.push(v.getPosition())}if(g.length!==o.length)return null;let f=[];for(let v=0,b=g.length;v<b;v++)f.push(new oht(g[v],o[v].deletedText,e.surroundingPairs[l]));return new Yv(4,f,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1})}let u=aht.getEdits(e,t,n,r,l);if(u!==void 0)return u;let p=ySe.getEdits(e,t,n,l,!0,!1);return p!==void 0?p:d$e.getEdits(e,o)}static typeWithInterceptors(i,e,t,o,n,r,s){let l=M$.getEdits(t,o,n,s,i);if(l!==void 0)return l;let c=rht.getEdits(t,o,n,s,i);if(c!==void 0)return c;let u=sht.getEdits(e,t,o,n,r,s);if(u!==void 0)return u;let p=ySe.getEdits(t,o,n,s,!1,i);if(p!==void 0)return p;let h=lht.getEdits(t,o,n,s,i);if(h!==void 0)return h;let g=cht.getEdits(e,t,o,n,s,i);return g!==void 0?g:dht.getEdits(t,e,n,s,i)}static typeWithoutInterceptors(i,e,t,o,n){return mht.getEdits(i,o,n)}},fht=class{constructor(i,e,t,o,n,r,s){this.deletedText=i;this.deletedSelectionStart=e;this.deletedSelectionEnd=t;this.insertedText=o;this.insertedSelectionStart=n;this.insertedSelectionEnd=r;this.insertedTextRange=s}};function xSe(a){return!!a&&typeof a.id=="string"}var P$={ICodeEditor:"vs.editor.ICodeEditor",IDiffEditor:"vs.editor.IDiffEditor"};var ue;(Cr=>(Cr.editorSimpleInput=new Q("editorSimpleInput",!1,!0),Cr.editorTextFocus=new Q("editorTextFocus",!1,d(839,null)),Cr.focus=new Q("editorFocus",!1,d(812,null)),Cr.textInputFocus=new Q("textInputFocus",!1,d(850,null)),Cr.readOnly=new Q("editorReadonly",!1,d(836,null)),Cr.inDiffEditor=new Q("inDiffEditor",!1,d(841,null)),Cr.isEmbeddedDiffEditor=new Q("isEmbeddedDiffEditor",!1,d(844,null)),Cr.inMultiDiffEditor=new Q("inMultiDiffEditor",!1,d(842,null)),Cr.multiDiffEditorAllCollapsed=new Q("multiDiffEditorAllCollapsed",void 0,d(845,null)),Cr.hasChanges=new Q("diffEditorHasChanges",!1,d(804,null)),Cr.comparingMovedCode=new Q("comparingMovedCode",!1,d(803,null)),Cr.accessibleDiffViewerVisible=new Q("accessibleDiffViewerVisible",!1,d(802,null)),Cr.diffEditorRenderSideBySideInlineBreakpointReached=new Q("diffEditorRenderSideBySideInlineBreakpointReached",!1,d(810,null)),Cr.diffEditorInlineMode=new Q("diffEditorInlineMode",!1,d(805,null)),Cr.diffEditorOriginalWritable=new Q("diffEditorOriginalWritable",!1,d(809,null)),Cr.diffEditorModifiedWritable=new Q("diffEditorModifiedWritable",!1,d(807,null)),Cr.diffEditorOriginalUri=new Q("diffEditorOriginalUri","",d(808,null)),Cr.diffEditorModifiedUri=new Q("diffEditorModifiedUri","",d(806,null)),Cr.columnSelection=new Q("editorColumnSelection",!1,d(811,null)),Cr.writable=Cr.readOnly.toNegated(),Cr.hasNonEmptySelection=new Q("editorHasSelection",!1,d(830,null)),Cr.hasOnlyEmptySelection=Cr.hasNonEmptySelection.toNegated(),Cr.hasMultipleSelections=new Q("editorHasMultipleSelections",!1,d(827,null)),Cr.hasSingleSelection=Cr.hasMultipleSelections.toNegated(),Cr.tabMovesFocus=new Q("editorTabMovesFocus",!1,d(838,null)),Cr.tabDoesNotMoveFocus=Cr.tabMovesFocus.toNegated(),Cr.isInEmbeddedEditor=new Q("isInEmbeddedEditor",!1,!0),Cr.canUndo=new Q("canUndo",!1,!0),Cr.canRedo=new Q("canRedo",!1,!0),Cr.hoverVisible=new Q("editorHoverVisible",!1,d(834,null)),Cr.hoverFocused=new Q("editorHoverFocused",!1,d(833,null)),Cr.stickyScrollFocused=new Q("stickyScrollFocused",!1,d(848,null)),Cr.stickyScrollVisible=new Q("stickyScrollVisible",!1,d(849,null)),Cr.standaloneColorPickerVisible=new Q("standaloneColorPickerVisible",!1,d(847,null)),Cr.standaloneColorPickerFocused=new Q("standaloneColorPickerFocused",!1,d(846,null)),Cr.isComposing=new Q("isComposing",!1,d(843,null)),Cr.inCompositeEditor=new Q("inCompositeEditor",void 0,d(840,null)),Cr.notInCompositeEditor=Cr.inCompositeEditor.toNegated(),Cr.languageId=new Q("editorLangId","",d(835,null)),Cr.hasCompletionItemProvider=new Q("editorHasCompletionItemProvider",!1,d(815,null)),Cr.hasCodeActionsProvider=new Q("editorHasCodeActionsProvider",!1,d(813,null)),Cr.hasCodeLensProvider=new Q("editorHasCodeLensProvider",!1,d(814,null)),Cr.hasDefinitionProvider=new Q("editorHasDefinitionProvider",!1,d(817,null)),Cr.hasDeclarationProvider=new Q("editorHasDeclarationProvider",!1,d(816,null)),Cr.hasImplementationProvider=new Q("editorHasImplementationProvider",!1,d(823,null)),Cr.hasTypeDefinitionProvider=new Q("editorHasTypeDefinitionProvider",!1,d(832,null)),Cr.hasHoverProvider=new Q("editorHasHoverProvider",!1,d(822,null)),Cr.hasDocumentHighlightProvider=new Q("editorHasDocumentHighlightProvider",!1,d(819,null)),Cr.hasDocumentSymbolProvider=new Q("editorHasDocumentSymbolProvider",!1,d(821,null)),Cr.hasReferenceProvider=new Q("editorHasReferenceProvider",!1,d(828,null)),Cr.hasRenameProvider=new Q("editorHasRenameProvider",!1,d(829,null)),Cr.hasSignatureHelpProvider=new Q("editorHasSignatureHelpProvider",!1,d(831,null)),Cr.hasInlayHintsProvider=new Q("editorHasInlayHintsProvider",!1,d(824,null)),Cr.hasDocumentFormattingProvider=new Q("editorHasDocumentFormattingProvider",!1,d(818,null)),Cr.hasDocumentSelectionFormattingProvider=new Q("editorHasDocumentSelectionFormattingProvider",!1,d(820,null)),Cr.hasMultipleDocumentFormattingProvider=new Q("editorHasMultipleDocumentFormattingProvider",!1,d(825,null)),Cr.hasMultipleDocumentSelectionFormattingProvider=new Q("editorHasMultipleDocumentSelectionFormattingProvider",!1,d(826,null)),Cr.selectionHasDiagnostics=new Q("editorSelectionHasDiagnostics",!1,d(837,null))))(ue||={});var vht=class{constructor(){this.type=0}},bht=class{constructor(){this.type=1}},Sht=class{constructor(i){this.type=2;this._source=i}hasChanged(i){return this._source.hasChanged(i)}},Iht=class{constructor(i,e,t){this.selections=i;this.modelSelections=e;this.reason=t;this.type=3}},wU=class{constructor(i){this.type=4;i?(this.affectsMinimap=i.affectsMinimap,this.affectsOverviewRuler=i.affectsOverviewRuler,this.affectsGlyphMargin=i.affectsGlyphMargin,this.affectsLineNumber=i.affectsLineNumber):(this.affectsMinimap=!0,this.affectsOverviewRuler=!0,this.affectsGlyphMargin=!0,this.affectsLineNumber=!0)}},mse=class{constructor(){this.type=5}},yht=class{constructor(i){this.type=6;this.isFocused=i}},wht=class{constructor(){this.type=7}},hse=class{constructor(){this.type=8}},m$e=class{constructor(i,e){this.fromLineNumber=i;this.count=e;this.type=9}},kSe=class{constructor(i,e){this.type=10;this.fromLineNumber=i,this.toLineNumber=e}},ESe=class{constructor(i,e){this.type=11;this.fromLineNumber=i,this.toLineNumber=e}};var A$=class{constructor(i,e,t,o,n,r,s){this.source=i;this.minimalReveal=e;this.range=t;this.selections=o;this.verticalType=n;this.revealHorizontal=r;this.scrollType=s;this.type=12}},Cht=class{constructor(i){this.type=13;this.scrollWidth=i.scrollWidth,this.scrollLeft=i.scrollLeft,this.scrollHeight=i.scrollHeight,this.scrollTop=i.scrollTop,this.scrollWidthChanged=i.scrollWidthChanged,this.scrollLeftChanged=i.scrollLeftChanged,this.scrollHeightChanged=i.scrollHeightChanged,this.scrollTopChanged=i.scrollTopChanged}},xht=class{constructor(i){this.theme=i;this.type=14}},kht=class{constructor(i){this.type=15;this.ranges=i}},Eht=class{constructor(){this.type=16}},Tht=class{constructor(){this.type=17}};function XYt(a){let i=a;return typeof i?.resolve=="function"&&typeof i?.isResolved=="function"}function qKi(a,i,e){return i?.documentVersion===e?.documentVersion&&a.extUri.isEqual(i?.original,e?.original)&&a.extUri.isEqual(i?.modified,e?.modified)&&$i(i?.changes,e?.changes,(t,o)=>t[0]===o[0]&&t[1]===o[1]&&t[2]===o[2]&&t[3]===o[3])}var ql=0,hm=class extends xc{runEditorCommand(i,e,t){let o=e._getViewModel();o&&this.runCoreEditorCommand(o,t||{})}},Py;(s=>{let a=function(l){if(!yi(l))return!1;let c=l;return!(!Ae(c.to)||!cn(c.by)&&!Ae(c.by)||!cn(c.value)&&!Xo(c.value)||!cn(c.revealCursor)&&!Da(c.revealCursor))};s.metadata={description:"Scroll editor in the given direction",args:[{name:"Editor scroll argument object",description:"Property-value pairs that can be passed through this argument:\n * 'to': A mandatory direction value.\n ```\n 'up', 'down'\n ```\n * 'by': Unit to move. Default is computed based on 'to' value.\n ```\n 'line', 'wrappedLine', 'page', 'halfPage', 'editor'\n ```\n * 'value': Number of units to move. Default is '1'.\n * 'revealCursor': If 'true' reveals the cursor if it is outside view port.\n ",constraint:a,schema:{type:"object",required:["to"],properties:{to:{type:"string",enum:["up","down"]},by:{type:"string",enum:["line","wrappedLine","page","halfPage","editor"]},value:{type:"number",default:1},revealCursor:{type:"boolean"}}}}]},s.RawDirection={Up:"up",Right:"right",Down:"down",Left:"left"},s.RawUnit={Line:"line",WrappedLine:"wrappedLine",Page:"page",HalfPage:"halfPage",Editor:"editor",Column:"column"};function o(l){let c;switch(l.to){case s.RawDirection.Up:c=1;break;case s.RawDirection.Right:c=2;break;case s.RawDirection.Down:c=3;break;case s.RawDirection.Left:c=4;break;default:return null}let u;switch(l.by){case s.RawUnit.Line:u=1;break;case s.RawUnit.WrappedLine:u=2;break;case s.RawUnit.Page:u=3;break;case s.RawUnit.HalfPage:u=4;break;case s.RawUnit.Editor:u=5;break;case s.RawUnit.Column:u=6;break;default:u=2}let p=Math.floor(l.value||1),h=!!l.revealCursor;return{direction:c,unit:u,value:p,revealCursor:h,select:!!l.select}}s.parse=o;let n;(h=>(h[h.Up=1]="Up",h[h.Right=2]="Right",h[h.Down=3]="Down",h[h.Left=4]="Left"))(n=s.Direction||={});let r;(f=>(f[f.Line=1]="Line",f[f.WrappedLine=2]="WrappedLine",f[f.Page=3]="Page",f[f.HalfPage=4]="HalfPage",f[f.Editor=5]="Editor",f[f.Column=6]="Column"))(r=s.Unit||={})})(Py||={});var h$e;(t=>{let a=function(o){if(!yi(o))return!1;let n=o;return!(!Xo(n.lineNumber)&&!Ae(n.lineNumber)||!cn(n.at)&&!Ae(n.at))};t.metadata={description:"Reveal the given line at the given logical position",args:[{name:"Reveal line argument object",description:"Property-value pairs that can be passed through this argument:\n * 'lineNumber': A mandatory line number value.\n * 'at': Logical position at which line has to be revealed.\n ```\n 'top', 'center', 'bottom'\n ```\n ",constraint:a,schema:{type:"object",required:["lineNumber"],properties:{lineNumber:{type:["number","string"]},at:{type:"string",enum:["top","center","bottom"]}}}}]},t.RawAtArgument={Top:"top",Center:"center",Bottom:"bottom"}})(h$e||={});var g$e=class{constructor(i){i.addImplementation(1e4,"code-editor",(e,t)=>{let o=e.get(Kt).getFocusedCodeEditor();return o&&o.hasTextFocus()?this._runEditorCommand(e,o,t):!1}),i.addImplementation(1e3,"generic-dom-input-textarea",(e,t)=>{let o=Pn();return o&&Oh(o)?(this.runDOMCommand(o),!0):!1}),i.addImplementation(0,"generic-dom",(e,t)=>{let o=e.get(Kt).getActiveCodeEditor();return o?(o.focus(),this._runEditorCommand(e,o,t)):!1})}_runEditorCommand(i,e,t){let o=this.runEditorCommand(i,e,t);return o||!0}};var Vg;(wo=>{class a extends hm{constructor(Pt){super(Pt),this._inSelectionMode=Pt.inSelectionMode}runCoreEditorCommand(Pt,Ke){if(!Ke.position)return;Pt.model.pushStackElement(),Pt.setCursorStates(Ke.source,3,[Wg.moveTo(Pt,Pt.getPrimaryCursorState(),this._inSelectionMode,Ke.position,Ke.viewPosition)])&&Ke.revealType!==2&&Pt.revealAllCursors(Ke.source,!0,!0)}}wo.MoveTo=qi(new a({id:"_moveTo",inSelectionMode:!1,precondition:void 0})),wo.MoveToSelect=qi(new a({id:"_moveToSelect",inSelectionMode:!0,precondition:void 0}));class t extends hm{runCoreEditorCommand(Pt,Ke){Pt.model.pushStackElement();let ye=this._getColumnSelectResult(Pt,Pt.getPrimaryCursorState(),Pt.getCursorColumnSelectData(),Ke);ye!==null&&(Pt.setCursorStates(Ke.source,3,ye.viewStates.map(Be=>Ps.fromViewState(Be))),Pt.setCursorColumnSelectData({isReal:!0,fromViewLineNumber:ye.fromLineNumber,fromViewVisualColumn:ye.fromVisualColumn,toViewLineNumber:ye.toLineNumber,toViewVisualColumn:ye.toVisualColumn}),ye.reversed?Pt.revealTopMostCursor(Ke.source):Pt.revealBottomMostCursor(Ke.source))}}wo.ColumnSelect=qi(new class extends t{constructor(){super({id:"columnSelect",precondition:void 0})}_getColumnSelectResult(tn,Pt,Ke,ye){if(typeof ye.position>"u"||typeof ye.viewPosition>"u"||typeof ye.mouseColumn>"u")return null;let Be=tn.model.validatePosition(ye.position),Tt=tn.coordinatesConverter.validateViewPosition(new Ie(ye.viewPosition.lineNumber,ye.viewPosition.column),Be),Ht=ye.doColumnSelect?Ke.fromViewLineNumber:Tt.lineNumber,Do=ye.doColumnSelect?Ke.fromViewVisualColumn:ye.mouseColumn-1;return V6.columnSelect(tn.cursorConfig,tn,Ht,Do,Tt.lineNumber,ye.mouseColumn-1)}}),wo.CursorColumnSelectLeft=qi(new class extends t{constructor(){super({id:"cursorColumnSelectLeft",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:3599,linux:{primary:0}}})}_getColumnSelectResult(tn,Pt,Ke,ye){return V6.columnSelectLeft(tn.cursorConfig,tn,Ke)}}),wo.CursorColumnSelectRight=qi(new class extends t{constructor(){super({id:"cursorColumnSelectRight",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:3601,linux:{primary:0}}})}_getColumnSelectResult(tn,Pt,Ke,ye){return V6.columnSelectRight(tn.cursorConfig,tn,Ke)}});class s extends t{constructor(Pt){super(Pt),this._isPaged=Pt.isPaged}_getColumnSelectResult(Pt,Ke,ye,Be){return V6.columnSelectUp(Pt.cursorConfig,Pt,ye,this._isPaged)}}wo.CursorColumnSelectUp=qi(new s({isPaged:!1,id:"cursorColumnSelectUp",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:3600,linux:{primary:0}}})),wo.CursorColumnSelectPageUp=qi(new s({isPaged:!0,id:"cursorColumnSelectPageUp",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:3595,linux:{primary:0}}}));class u extends t{constructor(Pt){super(Pt),this._isPaged=Pt.isPaged}_getColumnSelectResult(Pt,Ke,ye,Be){return V6.columnSelectDown(Pt.cursorConfig,Pt,ye,this._isPaged)}}wo.CursorColumnSelectDown=qi(new u({isPaged:!1,id:"cursorColumnSelectDown",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:3602,linux:{primary:0}}})),wo.CursorColumnSelectPageDown=qi(new u({isPaged:!0,id:"cursorColumnSelectPageDown",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:3596,linux:{primary:0}}}));class g extends hm{constructor(){super({id:"cursorMove",precondition:void 0,metadata:vs.metadata})}runCoreEditorCommand(Pt,Ke){let ye=vs.parse(Ke);ye&&this._runCursorMove(Pt,Ke.source,ye)}_runCursorMove(Pt,Ke,ye){let Be=ye.noHistory?"api":Ke;Pt.model.pushStackElement(),Pt.setCursorStates(Be,3,g._move(Pt,Pt.getCursorStates(),ye)),Pt.revealAllCursors(Be,!0)}static _move(Pt,Ke,ye){let Be=ye.select,Tt=ye.value;switch(ye.direction){case vs.Direction.Left:case vs.Direction.Right:case vs.Direction.Up:case vs.Direction.Down:case vs.Direction.PrevBlankLine:case vs.Direction.NextBlankLine:case vs.Direction.WrappedLineStart:case vs.Direction.WrappedLineFirstNonWhitespaceCharacter:case vs.Direction.WrappedLineColumnCenter:case vs.Direction.WrappedLineEnd:case vs.Direction.WrappedLineLastNonWhitespaceCharacter:return Wg.simpleMove(Pt,Ke,ye.direction,Be,Tt,ye.unit);case vs.Direction.ViewPortTop:case vs.Direction.ViewPortBottom:case vs.Direction.ViewPortCenter:case vs.Direction.ViewPortIfOutside:return Wg.viewportMove(Pt,Ke,ye.direction,Be,Tt);default:return null}}}wo.CursorMoveImpl=g,wo.CursorMove=qi(new g);let v;(Pt=>Pt[Pt.PAGE_SIZE_MARKER=-1]="PAGE_SIZE_MARKER")(v||={});class b extends hm{constructor(Pt){super(Pt),this._staticArgs=Pt.args}runCoreEditorCommand(Pt,Ke){let ye=this._staticArgs;this._staticArgs.value===-1&&(ye={direction:this._staticArgs.direction,unit:this._staticArgs.unit,select:this._staticArgs.select,value:Ke.pageSize||Pt.cursorConfig.pageSize}),Pt.model.pushStackElement(),Pt.setCursorStates(Ke.source,3,Wg.simpleMove(Pt,Pt.getCursorStates(),ye.direction,ye.select,ye.value,ye.unit)),Pt.revealAllCursors(Ke.source,!0)}}wo.CursorLeft=qi(new b({args:{direction:vs.Direction.Left,unit:vs.Unit.None,select:!1,value:1},id:"cursorLeft",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:15,mac:{primary:15,secondary:[288]}}})),wo.CursorLeftSelect=qi(new b({args:{direction:vs.Direction.Left,unit:vs.Unit.None,select:!0,value:1},id:"cursorLeftSelect",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:1039}})),wo.CursorRight=qi(new b({args:{direction:vs.Direction.Right,unit:vs.Unit.None,select:!1,value:1},id:"cursorRight",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:17,mac:{primary:17,secondary:[292]}}})),wo.CursorRightSelect=qi(new b({args:{direction:vs.Direction.Right,unit:vs.Unit.None,select:!0,value:1},id:"cursorRightSelect",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:1041}})),wo.CursorUp=qi(new b({args:{direction:vs.Direction.Up,unit:vs.Unit.WrappedLine,select:!1,value:1},id:"cursorUp",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:16,mac:{primary:16,secondary:[302]}}})),wo.CursorUpSelect=qi(new b({args:{direction:vs.Direction.Up,unit:vs.Unit.WrappedLine,select:!0,value:1},id:"cursorUpSelect",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:1040,secondary:[3088],mac:{primary:1040},linux:{primary:1040}}})),wo.CursorPageUp=qi(new b({args:{direction:vs.Direction.Up,unit:vs.Unit.WrappedLine,select:!1,value:-1},id:"cursorPageUp",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:11}})),wo.CursorPageUpSelect=qi(new b({args:{direction:vs.Direction.Up,unit:vs.Unit.WrappedLine,select:!0,value:-1},id:"cursorPageUpSelect",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:1035}})),wo.CursorDown=qi(new b({args:{direction:vs.Direction.Down,unit:vs.Unit.WrappedLine,select:!1,value:1},id:"cursorDown",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:18,mac:{primary:18,secondary:[300]}}})),wo.CursorDownSelect=qi(new b({args:{direction:vs.Direction.Down,unit:vs.Unit.WrappedLine,select:!0,value:1},id:"cursorDownSelect",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:1042,secondary:[3090],mac:{primary:1042},linux:{primary:1042}}})),wo.CursorPageDown=qi(new b({args:{direction:vs.Direction.Down,unit:vs.Unit.WrappedLine,select:!1,value:-1},id:"cursorPageDown",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:12}})),wo.CursorPageDownSelect=qi(new b({args:{direction:vs.Direction.Down,unit:vs.Unit.WrappedLine,select:!0,value:-1},id:"cursorPageDownSelect",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:1036}})),wo.CreateCursor=qi(new class extends hm{constructor(){super({id:"createCursor",precondition:void 0})}runCoreEditorCommand(tn,Pt){if(!Pt.position)return;let Ke;Pt.wholeLine?Ke=Wg.line(tn,tn.getPrimaryCursorState(),!1,Pt.position,Pt.viewPosition):Ke=Wg.moveTo(tn,tn.getPrimaryCursorState(),!1,Pt.position,Pt.viewPosition);let ye=tn.getCursorStates();if(ye.length>1){let Be=Ke.modelState?Ke.modelState.position:null,Tt=Ke.viewState?Ke.viewState.position:null;for(let Ht=0,Do=ye.length;Ht<Do;Ht++){let io=ye[Ht];if(!(Be&&!io.modelState.selection.containsPosition(Be))&&!(Tt&&!io.viewState.selection.containsPosition(Tt))){ye.splice(Ht,1),tn.model.pushStackElement(),tn.setCursorStates(Pt.source,3,ye);return}}}ye.push(Ke),tn.model.pushStackElement(),tn.setCursorStates(Pt.source,3,ye)}}),wo.LastCursorMoveToSelect=qi(new class extends hm{constructor(){super({id:"_lastCursorMoveToSelect",precondition:void 0})}runCoreEditorCommand(tn,Pt){if(!Pt.position)return;let Ke=tn.getLastAddedCursorIndex(),ye=tn.getCursorStates(),Be=ye.slice(0);Be[Ke]=Wg.moveTo(tn,ye[Ke],!0,Pt.position,Pt.viewPosition),tn.model.pushStackElement(),tn.setCursorStates(Pt.source,3,Be)}});class se extends hm{constructor(Pt){super(Pt),this._inSelectionMode=Pt.inSelectionMode}runCoreEditorCommand(Pt,Ke){Pt.model.pushStackElement(),Pt.setCursorStates(Ke.source,3,Wg.moveToBeginningOfLine(Pt,Pt.getCursorStates(),this._inSelectionMode)),Pt.revealAllCursors(Ke.source,!0)}}wo.CursorHome=qi(new se({inSelectionMode:!1,id:"cursorHome",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:14,mac:{primary:14,secondary:[2063]}}})),wo.CursorHomeSelect=qi(new se({inSelectionMode:!0,id:"cursorHomeSelect",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:1038,mac:{primary:1038,secondary:[3087]}}}));class Ee extends hm{constructor(Pt){super(Pt),this._inSelectionMode=Pt.inSelectionMode}runCoreEditorCommand(Pt,Ke){Pt.model.pushStackElement(),Pt.setCursorStates(Ke.source,3,this._exec(Pt.getCursorStates())),Pt.revealAllCursors(Ke.source,!0)}_exec(Pt){let Ke=[];for(let ye=0,Be=Pt.length;ye<Be;ye++){let Tt=Pt[ye],Ht=Tt.modelState.position.lineNumber;Ke[ye]=Ps.fromModelState(Tt.modelState.move(this._inSelectionMode,Ht,1,0))}return Ke}}wo.CursorLineStart=qi(new Ee({inSelectionMode:!1,id:"cursorLineStart",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:0,mac:{primary:287}}})),wo.CursorLineStartSelect=qi(new Ee({inSelectionMode:!0,id:"cursorLineStartSelect",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:0,mac:{primary:1311}}}));class Fe extends hm{constructor(Pt){super(Pt),this._inSelectionMode=Pt.inSelectionMode}runCoreEditorCommand(Pt,Ke){Pt.model.pushStackElement(),Pt.setCursorStates(Ke.source,3,Wg.moveToEndOfLine(Pt,Pt.getCursorStates(),this._inSelectionMode,Ke.sticky||!1)),Pt.revealAllCursors(Ke.source,!0)}}wo.CursorEnd=qi(new Fe({inSelectionMode:!1,id:"cursorEnd",precondition:void 0,kbOpts:{args:{sticky:!1},weight:ql,kbExpr:ue.textInputFocus,primary:13,mac:{primary:13,secondary:[2065]}},metadata:{description:"Go to End",args:[{name:"args",schema:{type:"object",properties:{sticky:{description:d(182,null),type:"boolean",default:!1}}}}]}})),wo.CursorEndSelect=qi(new Fe({inSelectionMode:!0,id:"cursorEndSelect",precondition:void 0,kbOpts:{args:{sticky:!1},weight:ql,kbExpr:ue.textInputFocus,primary:1037,mac:{primary:1037,secondary:[3089]}},metadata:{description:"Select to End",args:[{name:"args",schema:{type:"object",properties:{sticky:{description:d(182,null),type:"boolean",default:!1}}}}]}}));class Ti extends hm{constructor(Pt){super(Pt),this._inSelectionMode=Pt.inSelectionMode}runCoreEditorCommand(Pt,Ke){Pt.model.pushStackElement(),Pt.setCursorStates(Ke.source,3,this._exec(Pt,Pt.getCursorStates())),Pt.revealAllCursors(Ke.source,!0)}_exec(Pt,Ke){let ye=[];for(let Be=0,Tt=Ke.length;Be<Tt;Be++){let Ht=Ke[Be],Do=Ht.modelState.position.lineNumber,io=Pt.model.getLineMaxColumn(Do);ye[Be]=Ps.fromModelState(Ht.modelState.move(this._inSelectionMode,Do,io,0))}return ye}}wo.CursorLineEnd=qi(new Ti({inSelectionMode:!1,id:"cursorLineEnd",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:0,mac:{primary:291}}})),wo.CursorLineEndSelect=qi(new Ti({inSelectionMode:!0,id:"cursorLineEndSelect",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:0,mac:{primary:1315}}}));class Ro extends hm{constructor(Pt){super(Pt),this._inSelectionMode=Pt.inSelectionMode}runCoreEditorCommand(Pt,Ke){Pt.model.pushStackElement(),Pt.setCursorStates(Ke.source,3,Wg.moveToBeginningOfBuffer(Pt,Pt.getCursorStates(),this._inSelectionMode)),Pt.revealAllCursors(Ke.source,!0)}}wo.CursorTop=qi(new Ro({inSelectionMode:!1,id:"cursorTop",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:2062,mac:{primary:2064}}})),wo.CursorTopSelect=qi(new Ro({inSelectionMode:!0,id:"cursorTopSelect",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:3086,mac:{primary:3088}}}));class ln extends hm{constructor(Pt){super(Pt),this._inSelectionMode=Pt.inSelectionMode}runCoreEditorCommand(Pt,Ke){Pt.model.pushStackElement(),Pt.setCursorStates(Ke.source,3,Wg.moveToEndOfBuffer(Pt,Pt.getCursorStates(),this._inSelectionMode)),Pt.revealAllCursors(Ke.source,!0)}}wo.CursorBottom=qi(new ln({inSelectionMode:!1,id:"cursorBottom",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:2061,mac:{primary:2066}}})),wo.CursorBottomSelect=qi(new ln({inSelectionMode:!0,id:"cursorBottomSelect",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:3085,mac:{primary:3090}}}));class ba extends hm{constructor(){super({id:"editorScroll",precondition:void 0,metadata:Py.metadata})}determineScrollMethod(Pt){let Ke=[6],ye=[1,2,3,4,5],Be=[4,2],Tt=[1,3];return Ke.includes(Pt.unit)&&Be.includes(Pt.direction)?this._runHorizontalEditorScroll.bind(this):ye.includes(Pt.unit)&&Tt.includes(Pt.direction)?this._runVerticalEditorScroll.bind(this):null}runCoreEditorCommand(Pt,Ke){let ye=Py.parse(Ke);if(!ye)return;let Be=this.determineScrollMethod(ye);Be&&Be(Pt,Ke.source,ye)}_runVerticalEditorScroll(Pt,Ke,ye){let Be=this._computeDesiredScrollTop(Pt,ye);if(ye.revealCursor){let Tt=Pt.getCompletelyVisibleViewRangeAtScrollTop(Be),Ht=Pt.getViewRangeWithCursorPadding(Tt);Pt.setCursorStates(Ke,3,[Wg.findPositionInViewportIfOutside(Pt,Pt.getPrimaryCursorState(),Ht,ye.select)])}Pt.viewLayout.setScrollPosition({scrollTop:Be},0)}_computeDesiredScrollTop(Pt,Ke){if(Ke.unit===1){let Tt=Pt.viewLayout.getFutureViewport(),Ht=Pt.getCompletelyVisibleViewRangeAtScrollTop(Tt.top),Do=Pt.coordinatesConverter.convertViewRangeToModelRange(Ht),io;Ke.direction===1?io=Math.max(1,Do.startLineNumber-Ke.value):io=Math.min(Pt.model.getLineCount(),Do.startLineNumber+Ke.value);let xr=Pt.coordinatesConverter.convertModelPositionToViewPosition(new Ie(io,1));return Pt.viewLayout.getVerticalOffsetForLineNumber(xr.lineNumber)}if(Ke.unit===5){let Tt=0;return Ke.direction===3&&(Tt=Pt.model.getLineCount()-Pt.cursorConfig.pageSize),Pt.viewLayout.getVerticalOffsetForLineNumber(Tt)}let ye;Ke.unit===3?ye=Pt.cursorConfig.pageSize*Ke.value:Ke.unit===4?ye=Math.round(Pt.cursorConfig.pageSize/2)*Ke.value:ye=Ke.value;let Be=(Ke.direction===1?-1:1)*ye;return Pt.viewLayout.getCurrentScrollTop()+Be*Pt.cursorConfig.lineHeight}_runHorizontalEditorScroll(Pt,Ke,ye){let Be=this._computeDesiredScrollLeft(Pt,ye);Pt.viewLayout.setScrollPosition({scrollLeft:Be},0)}_computeDesiredScrollLeft(Pt,Ke){let ye=(Ke.direction===4?-1:1)*Ke.value;return Pt.viewLayout.getCurrentScrollLeft()+ye*Pt.cursorConfig.typicalHalfwidthCharacterWidth}}wo.EditorScrollImpl=ba,wo.EditorScroll=qi(new ba),wo.ScrollLineUp=qi(new class extends hm{constructor(){super({id:"scrollLineUp",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:2064,mac:{primary:267}}})}runCoreEditorCommand(tn,Pt){wo.EditorScroll.runCoreEditorCommand(tn,{to:Py.RawDirection.Up,by:Py.RawUnit.WrappedLine,value:1,revealCursor:!1,select:!1,source:Pt.source})}}),wo.ScrollPageUp=qi(new class extends hm{constructor(){super({id:"scrollPageUp",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:2059,win:{primary:523},linux:{primary:523}}})}runCoreEditorCommand(tn,Pt){wo.EditorScroll.runCoreEditorCommand(tn,{to:Py.RawDirection.Up,by:Py.RawUnit.Page,value:1,revealCursor:!1,select:!1,source:Pt.source})}}),wo.ScrollEditorTop=qi(new class extends hm{constructor(){super({id:"scrollEditorTop",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus}})}runCoreEditorCommand(tn,Pt){wo.EditorScroll.runCoreEditorCommand(tn,{to:Py.RawDirection.Up,by:Py.RawUnit.Editor,value:1,revealCursor:!1,select:!1,source:Pt.source})}}),wo.ScrollLineDown=qi(new class extends hm{constructor(){super({id:"scrollLineDown",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:2066,mac:{primary:268}}})}runCoreEditorCommand(tn,Pt){wo.EditorScroll.runCoreEditorCommand(tn,{to:Py.RawDirection.Down,by:Py.RawUnit.WrappedLine,value:1,revealCursor:!1,select:!1,source:Pt.source})}}),wo.ScrollPageDown=qi(new class extends hm{constructor(){super({id:"scrollPageDown",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:2060,win:{primary:524},linux:{primary:524}}})}runCoreEditorCommand(tn,Pt){wo.EditorScroll.runCoreEditorCommand(tn,{to:Py.RawDirection.Down,by:Py.RawUnit.Page,value:1,revealCursor:!1,select:!1,source:Pt.source})}}),wo.ScrollEditorBottom=qi(new class extends hm{constructor(){super({id:"scrollEditorBottom",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus}})}runCoreEditorCommand(tn,Pt){wo.EditorScroll.runCoreEditorCommand(tn,{to:Py.RawDirection.Down,by:Py.RawUnit.Editor,value:1,revealCursor:!1,select:!1,source:Pt.source})}}),wo.ScrollLeft=qi(new class extends hm{constructor(){super({id:"scrollLeft",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus}})}runCoreEditorCommand(tn,Pt){wo.EditorScroll.runCoreEditorCommand(tn,{to:Py.RawDirection.Left,by:Py.RawUnit.Column,value:2,revealCursor:!1,select:!1,source:Pt.source})}}),wo.ScrollRight=qi(new class extends hm{constructor(){super({id:"scrollRight",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus}})}runCoreEditorCommand(tn,Pt){wo.EditorScroll.runCoreEditorCommand(tn,{to:Py.RawDirection.Right,by:Py.RawUnit.Column,value:2,revealCursor:!1,select:!1,source:Pt.source})}});class sx extends hm{constructor(Pt){super(Pt),this._inSelectionMode=Pt.inSelectionMode}runCoreEditorCommand(Pt,Ke){Ke.position&&(Pt.model.pushStackElement(),Pt.setCursorStates(Ke.source,3,[Wg.word(Pt,Pt.getPrimaryCursorState(),this._inSelectionMode,Ke.position)]),Ke.revealType!==2&&Pt.revealAllCursors(Ke.source,!0,!0))}}wo.WordSelect=qi(new sx({inSelectionMode:!1,id:"_wordSelect",precondition:void 0})),wo.WordSelectDrag=qi(new sx({inSelectionMode:!0,id:"_wordSelectDrag",precondition:void 0})),wo.LastCursorWordSelect=qi(new class extends hm{constructor(){super({id:"lastCursorWordSelect",precondition:void 0})}runCoreEditorCommand(tn,Pt){if(!Pt.position)return;let Ke=tn.getLastAddedCursorIndex(),ye=tn.getCursorStates(),Be=ye.slice(0),Tt=ye[Ke];Be[Ke]=Wg.word(tn,Tt,Tt.modelState.hasSelection(),Pt.position),tn.model.pushStackElement(),tn.setCursorStates(Pt.source,3,Be)}});class uf extends hm{constructor(Pt){super(Pt),this._inSelectionMode=Pt.inSelectionMode}runCoreEditorCommand(Pt,Ke){Ke.position&&(Pt.model.pushStackElement(),Pt.setCursorStates(Ke.source,3,[Wg.line(Pt,Pt.getPrimaryCursorState(),this._inSelectionMode,Ke.position,Ke.viewPosition)]),Ke.revealType!==2&&Pt.revealAllCursors(Ke.source,!1,!0))}}wo.LineSelect=qi(new uf({inSelectionMode:!1,id:"_lineSelect",precondition:void 0})),wo.LineSelectDrag=qi(new uf({inSelectionMode:!0,id:"_lineSelectDrag",precondition:void 0}));class ax extends hm{constructor(Pt){super(Pt),this._inSelectionMode=Pt.inSelectionMode}runCoreEditorCommand(Pt,Ke){if(!Ke.position)return;let ye=Pt.getLastAddedCursorIndex(),Be=Pt.getCursorStates(),Tt=Be.slice(0);Tt[ye]=Wg.line(Pt,Be[ye],this._inSelectionMode,Ke.position,Ke.viewPosition),Pt.model.pushStackElement(),Pt.setCursorStates(Ke.source,3,Tt)}}wo.LastCursorLineSelect=qi(new ax({inSelectionMode:!1,id:"lastCursorLineSelect",precondition:void 0})),wo.LastCursorLineSelectDrag=qi(new ax({inSelectionMode:!0,id:"lastCursorLineSelectDrag",precondition:void 0})),wo.CancelSelection=qi(new class extends hm{constructor(){super({id:"cancelSelection",precondition:ue.hasNonEmptySelection,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:9,secondary:[1033]}})}runCoreEditorCommand(tn,Pt){tn.model.pushStackElement(),tn.setCursorStates(Pt.source,3,[Wg.cancelSelection(tn,tn.getPrimaryCursorState())]),tn.revealAllCursors(Pt.source,!0)}}),wo.RemoveSecondaryCursors=qi(new class extends hm{constructor(){super({id:"removeSecondaryCursors",precondition:ue.hasMultipleSelections,kbOpts:{weight:ql+1,kbExpr:ue.textInputFocus,primary:9,secondary:[1033]}})}runCoreEditorCommand(tn,Pt){tn.model.pushStackElement(),tn.setCursorStates(Pt.source,3,[tn.getPrimaryCursorState()]),tn.revealAllCursors(Pt.source,!0),Or(d(181,null))}}),wo.RevealLine=qi(new class extends hm{constructor(){super({id:"revealLine",precondition:void 0,metadata:h$e.metadata})}runCoreEditorCommand(tn,Pt){let Ke=Pt,ye=Ke.lineNumber||0,Be=typeof ye=="number"?ye+1:parseInt(ye)+1;Be<1&&(Be=1);let Tt=tn.model.getLineCount();Be>Tt&&(Be=Tt);let Ht=new z(Be,1,Be,tn.model.getLineMaxColumn(Be)),Do=0;if(Ke.at)switch(Ke.at){case h$e.RawAtArgument.Top:Do=3;break;case h$e.RawAtArgument.Center:Do=1;break;case h$e.RawAtArgument.Bottom:Do=4;break;default:break}let io=tn.coordinatesConverter.convertModelRangeToViewRange(Ht);tn.revealRange(Pt.source,!1,io,Do,0)}}),wo.SelectAll=new class extends g$e{constructor(){super(ymt)}runDOMCommand(tn){yc&&(tn.focus(),tn.select()),tn.ownerDocument.execCommand("selectAll")}runEditorCommand(tn,Pt,Ke){let ye=Pt._getViewModel();ye&&this.runCoreEditorCommand(ye,Ke)}runCoreEditorCommand(tn,Pt){tn.model.pushStackElement(),tn.setCursorStates("keyboard",3,[Wg.selectAll(tn,tn.getPrimaryCursorState())])}},wo.SetSelection=qi(new class extends hm{constructor(){super({id:"setSelection",precondition:void 0})}runCoreEditorCommand(tn,Pt){Pt.selection&&(tn.model.pushStackElement(),tn.setCursorStates(Pt.source,3,[Ps.fromModelSelection(Pt.selection)]))}})})(Vg||={});var _Mo=x.and(ue.textInputFocus,ue.columnSelection);function DSe(a,i){yt.registerKeybindingRule({id:a,primary:i,when:_Mo,weight:ql+1})}DSe(Vg.CursorColumnSelectLeft.id,1039);DSe(Vg.CursorColumnSelectRight.id,1041);DSe(Vg.CursorColumnSelectUp.id,1040);DSe(Vg.CursorColumnSelectPageUp.id,1035);DSe(Vg.CursorColumnSelectDown.id,1042);DSe(Vg.CursorColumnSelectPageDown.id,1036);function jKi(a){return a.register(),a}var rL;(l=>{class a extends xc{runEditorCommand(u,p,h){let g=p._getViewModel();g&&this.runCoreEditingCommand(p,g,h||{})}}l.CoreEditingCommand=a,l.LineBreakInsert=qi(new class extends a{constructor(){super({id:"lineBreakInsert",precondition:ue.writable,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:0,mac:{primary:301}}})}runCoreEditingCommand(c,u,p){c.pushUndoStop(),c.executeCommands(this.id,M$.lineBreakInsert(u.cursorConfig,u.model,u.getCursorStates().map(h=>h.modelState.selection)))}}),l.Outdent=qi(new class extends a{constructor(){super({id:"outdent",precondition:ue.writable,kbOpts:{weight:ql,kbExpr:x.and(ue.editorTextFocus,ue.tabDoesNotMoveFocus),primary:1026}})}runCoreEditingCommand(c,u,p){c.pushUndoStop(),c.executeCommands(this.id,RM.outdent(u.cursorConfig,u.model,u.getCursorStates().map(h=>h.modelState.selection))),c.pushUndoStop()}}),l.Tab=qi(new class extends a{constructor(){super({id:"tab",precondition:ue.writable,kbOpts:{weight:ql,kbExpr:x.and(ue.editorTextFocus,ue.tabDoesNotMoveFocus),primary:2}})}runCoreEditingCommand(c,u,p){c.pushUndoStop(),c.executeCommands(this.id,RM.tab(u.cursorConfig,u.model,u.getCursorStates().map(h=>h.modelState.selection))),c.pushUndoStop()}}),l.DeleteLeft=qi(new class extends a{constructor(){super({id:"deleteLeft",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:1,secondary:[1025],mac:{primary:1,secondary:[1025,294,257]}}})}runCoreEditingCommand(c,u,p){let[h,g]=wN.deleteLeft(u.getPrevEditOperationType(),u.cursorConfig,u.model,u.getCursorStates().map(f=>f.modelState.selection),u.getCursorAutoClosedCharacters());h&&c.pushUndoStop(),c.executeCommands(this.id,g),u.setPrevEditOperationType(2)}}),l.DeleteRight=qi(new class extends a{constructor(){super({id:"deleteRight",precondition:void 0,kbOpts:{weight:ql,kbExpr:ue.textInputFocus,primary:20,mac:{primary:20,secondary:[290,276]}}})}runCoreEditingCommand(c,u,p){let[h,g]=wN.deleteRight(u.getPrevEditOperationType(),u.cursorConfig,u.model,u.getCursorStates().map(f=>f.modelState.selection));h&&c.pushUndoStop(),c.executeCommands(this.id,g),u.setPrevEditOperationType(3)}}),l.Undo=new class extends g$e{constructor(){super(BT)}runDOMCommand(c){c.ownerDocument.execCommand("undo")}runEditorCommand(c,u,p){if(!(!u.hasModel()||u.getOption(104)===!0))return u.getModel().undo()}},l.Redo=new class extends g$e{constructor(){super(HT)}runDOMCommand(c){c.ownerDocument.execCommand("redo")}runEditorCommand(c,u,p){if(!(!u.hasModel()||u.getOption(104)===!0))return u.getModel().redo()}}})(rL||={});var _ht=class extends $re{constructor(i,e,t){super({id:i,precondition:void 0,metadata:t}),this._handlerId=e}runCommand(i,e){let t=i.get(Kt).getFocusedCodeEditor();t&&t.trigger("keyboard",this._handlerId,e)}};function gse(a,i){jKi(new _ht("default:"+a,a)),jKi(new _ht(a,a,i))}gse("type",{description:"Type",args:[{name:"args",schema:{type:"object",required:["text"],properties:{text:{type:"string"}}}}]});gse("replacePreviousChar");gse("compositionType");gse("compositionStart");gse("compositionEnd");gse("paste");gse("cut");var $s=ae("editorWorkerService");var QKi="default",DMo="$initialize",YKi=!1;function Rht(a){Gt&&(YKi||(YKi=!0,console.warn("Could not create web worker(s). Falling back to loading web worker code in main thread, which might cause UI freezes. Please see https://github.com/microsoft/monaco-editor#faq")),console.warn(a.message))}var JYt=class{constructor(i,e,t,o,n){this.vsWorker=i;this.req=e;this.channel=t;this.method=o;this.args=n;this.type=0}},Dht=class{constructor(i,e,t,o){this.vsWorker=i;this.seq=e;this.res=t;this.err=o;this.type=1}},ZYt=class{constructor(i,e,t,o,n){this.vsWorker=i;this.req=e;this.channel=t;this.eventName=o;this.arg=n;this.type=2}},eXt=class{constructor(i,e,t){this.vsWorker=i;this.req=e;this.event=t;this.type=3}},tXt=class{constructor(i,e){this.vsWorker=i;this.req=e;this.type=4}},iXt=class{constructor(i){this._workerId=-1,this._handler=i,this._lastSentReq=0,this._pendingReplies=Object.create(null),this._pendingEmitters=new Map,this._pendingEvents=new Map}setWorkerId(i){this._workerId=i}async sendMessage(i,e,t){let o=String(++this._lastSentReq);return new Promise((n,r)=>{this._pendingReplies[o]={resolve:n,reject:r},this._send(new JYt(this._workerId,o,i,e,t))})}listen(i,e,t){let o=null,n=new E({onWillAddFirstListener:()=>{o=String(++this._lastSentReq),this._pendingEmitters.set(o,n),this._send(new ZYt(this._workerId,o,i,e,t))},onDidRemoveLastListener:()=>{this._pendingEmitters.delete(o),this._send(new tXt(this._workerId,o)),o=null}});return n.event}handleMessage(i){!i||!i.vsWorker||this._workerId!==-1&&i.vsWorker!==this._workerId||this._handleMessage(i)}createProxyToRemoteChannel(i,e){let t={get:(o,n)=>(typeof n=="string"&&!o[n]&&(JKi(n)?o[n]=r=>this.listen(i,n,r):XKi(n)?o[n]=this.listen(i,n,void 0):n.charCodeAt(0)===36&&(o[n]=async(...r)=>(await e?.(),this.sendMessage(i,n,r)))),o[n])};return new Proxy(Object.create(null),t)}_handleMessage(i){switch(i.type){case 1:return this._handleReplyMessage(i);case 0:return this._handleRequestMessage(i);case 2:return this._handleSubscribeEventMessage(i);case 3:return this._handleEventMessage(i);case 4:return this._handleUnsubscribeEventMessage(i)}}_handleReplyMessage(i){if(!this._pendingReplies[i.seq]){console.warn("Got reply to unknown seq");return}let e=this._pendingReplies[i.seq];if(delete this._pendingReplies[i.seq],i.err){let t=i.err;if(i.err.$isError){let o=new Error;o.name=i.err.name,o.message=i.err.message,o.stack=i.err.stack,t=o}e.reject(t);return}e.resolve(i.res)}_handleRequestMessage(i){let e=i.req;this._handler.handleMessage(i.channel,i.method,i.args).then(o=>{this._send(new Dht(this._workerId,e,o,void 0))},o=>{o.detail instanceof Error&&(o.detail=QG(o.detail)),this._send(new Dht(this._workerId,e,void 0,QG(o)))})}_handleSubscribeEventMessage(i){let e=i.req,t=this._handler.handleEvent(i.channel,i.eventName,i.arg)(o=>{this._send(new eXt(this._workerId,e,o))});this._pendingEvents.set(e,t)}_handleEventMessage(i){let e=this._pendingEmitters.get(i.req);if(e===void 0){console.warn("Got event for unknown req");return}e.fire(i.event)}_handleUnsubscribeEventMessage(i){let e=this._pendingEvents.get(i.req);if(e===void 0){console.warn("Got unsubscribe for unknown req");return}e.dispose(),this._pendingEvents.delete(i.req)}_send(i){let e=[];if(i.type===0)for(let t=0;t<i.args.length;t++){let o=i.args[t];o instanceof ArrayBuffer&&e.push(o)}else i.type===1&&i.res instanceof ArrayBuffer&&e.push(i.res);this._handler.sendMessage(i,e)}},Lht=class extends C{constructor(e){super();this._localChannels=new Map;this._remoteChannels=new Map;this._worker=this._register(e),this._register(this._worker.onMessage(t=>{this._protocol.handleMessage(t)})),this._register(this._worker.onError(t=>{Rht(t),mt(t)})),this._protocol=new iXt({sendMessage:(t,o)=>{this._worker.postMessage(t,o)},handleMessage:(t,o,n)=>this._handleMessage(t,o,n),handleEvent:(t,o,n)=>this._handleEvent(t,o,n)}),this._protocol.setWorkerId(this._worker.getId()),this._onModuleLoaded=this._protocol.sendMessage(QKi,DMo,[this._worker.getId()]).then(()=>{}),this.proxy=this._protocol.createProxyToRemoteChannel(QKi,async()=>{await this._onModuleLoaded}),this._onModuleLoaded.catch(t=>{this._onError("Worker failed to load ",t)})}_handleMessage(e,t,o){let n=this._localChannels.get(e);if(!n)return Promise.reject(new Error(`Missing channel ${e} on main thread`));let r=n[t];if(typeof r!="function")return Promise.reject(new Error(`Missing method ${t} on main thread channel ${e}`));try{return Promise.resolve(r.apply(n,o))}catch(s){return Promise.reject(s)}}_handleEvent(e,t,o){let n=this._localChannels.get(e);if(!n)throw new Error(`Missing channel ${e} on main thread`);if(JKi(t)){let r=n[t];if(typeof r!="function")throw new Error(`Missing dynamic event ${t} on main thread channel ${e}.`);let s=r.call(n,o);if(typeof s!="function")throw new Error(`Missing dynamic event ${t} on main thread channel ${e}.`);return s}if(XKi(t)){let r=n[t];if(typeof r!="function")throw new Error(`Missing event ${t} on main thread channel ${e}.`);return r}throw new Error(`Malformed event name ${t}`)}setChannel(e,t){this._localChannels.set(e,t)}getChannel(e){let t=this._remoteChannels.get(e);return t===void 0&&(t=this._protocol.createProxyToRemoteChannel(e,async()=>{await this._onModuleLoaded}),this._remoteChannels.set(e,t)),t}_onError(e,t){console.error(e),console.info(t)}};function XKi(a){return a[0]==="o"&&a[1]==="n"&&Hk(a.charCodeAt(2))}function JKi(a){return/^onDynamic/.test(a)&&Hk(a.charCodeAt(9))}var gx=class{constructor(i){this.esmModuleLocation=i.esmModuleLocation,this.esmModuleLocationBundler=i.esmModuleLocationBundler,this.label=i.label}};var Ay=ae("IWebWorkerService");var An=class{static insert(i,e){return{range:new z(i.lineNumber,i.column,i.lineNumber,i.column),text:e,forceMoveMarkers:!0}}static delete(i){return{range:i,text:null}}static replace(i,e){return{range:i,text:e}}static replaceMove(i,e){return{range:i,text:e,forceMoveMarkers:!0}}};var Mht=class{constructor(){this._tokenizationSupports=new Map;this._factories=new Map;this._onDidChange=new E;this.onDidChange=this._onDidChange.event;this._colorMap=null}handleChange(i){this._onDidChange.fire({changedLanguages:i,changedColorMap:!1})}register(i,e){return this._tokenizationSupports.set(i,e),this.handleChange([i]),Z(()=>{this._tokenizationSupports.get(i)===e&&(this._tokenizationSupports.delete(i),this.handleChange([i]))})}get(i){return this._tokenizationSupports.get(i)||null}registerFactory(i,e){this._factories.get(i)?.dispose();let t=new oXt(this,i,e);return this._factories.set(i,t),Z(()=>{let o=this._factories.get(i);!o||o!==t||(this._factories.delete(i),o.dispose())})}async getOrCreate(i){let e=this.get(i);if(e)return e;let t=this._factories.get(i);return!t||t.isResolved?null:(await t.resolve(),this.get(i))}isResolved(i){if(this.get(i))return!0;let t=this._factories.get(i);return!!(!t||t.isResolved)}setColorMap(i){this._colorMap=i,this._onDidChange.fire({changedLanguages:Array.from(this._tokenizationSupports.keys()),changedColorMap:!0})}getColorMap(){return this._colorMap}getDefaultBackground(){return this._colorMap&&this._colorMap.length>2?this._colorMap[2]:null}},oXt=class extends C{constructor(e,t,o){super();this._registry=e;this._languageId=t;this._factory=o;this._isDisposed=!1;this._resolvePromise=null;this._isResolved=!1}get isResolved(){return this._isResolved}dispose(){this._isDisposed=!0,super.dispose()}async resolve(){return this._resolvePromise||(this._resolvePromise=this._create()),this._resolvePromise}async _create(){let e=await this._factory.tokenizationSupport;this._isResolved=!0,e&&!this._isDisposed&&this._register(this._registry.register(this._languageId,e))}};var v$e=class{constructor(i,e,t){this.offset=i;this.type=e;this.language=t;this._tokenBrand=void 0}toString(){return"("+this.offset+", "+this.type+")"}};var fse=class{constructor(i,e,t){this.tokens=i;this.fontInfo=e;this.endState=t;this._encodedTokenizationResultBrand=void 0}};var xU;(n=>{let a=new Map;a.set(0,M.symbolMethod),a.set(1,M.symbolFunction),a.set(2,M.symbolConstructor),a.set(3,M.symbolField),a.set(4,M.symbolVariable),a.set(5,M.symbolClass),a.set(6,M.symbolStruct),a.set(7,M.symbolInterface),a.set(8,M.symbolModule),a.set(9,M.symbolProperty),a.set(10,M.symbolEvent),a.set(11,M.symbolOperator),a.set(12,M.symbolUnit),a.set(13,M.symbolValue),a.set(15,M.symbolEnum),a.set(14,M.symbolConstant),a.set(15,M.symbolEnum),a.set(16,M.symbolEnumMember),a.set(17,M.symbolKeyword),a.set(28,M.symbolSnippet),a.set(18,M.symbolText),a.set(19,M.symbolColor),a.set(20,M.symbolFile),a.set(21,M.symbolReference),a.set(22,M.symbolCustomColor),a.set(23,M.symbolFolder),a.set(24,M.symbolTypeParameter),a.set(25,M.account),a.set(26,M.issues),a.set(27,M.tools);function i(r){let s=a.get(r);return s||(console.info("No codicon found for CompletionItemKind "+r),s=M.symbolProperty),s}n.toIcon=i;function e(r){switch(r){case 0:return d(890,null);case 1:return d(886,null);case 2:return d(878,null);case 3:return d(883,null);case 4:return d(903,null);case 5:return d(875,null);case 6:return d(896,null);case 7:return d(887,null);case 8:return d(891,null);case 9:return d(893,null);case 10:return d(882,null);case 11:return d(892,null);case 12:return d(900,null);case 13:return d(902,null);case 14:return d(877,null);case 15:return d(880,null);case 16:return d(881,null);case 17:return d(889,null);case 18:return d(897,null);case 19:return d(876,null);case 20:return d(884,null);case 21:return d(894,null);case 22:return d(879,null);case 23:return d(885,null);case 24:return d(899,null);case 25:return d(901,null);case 26:return d(888,null);case 27:return d(898,null);case 28:return d(895,null);default:return""}}n.toLabel=e;let t=new Map;t.set("method",0),t.set("function",1),t.set("constructor",2),t.set("field",3),t.set("variable",4),t.set("class",5),t.set("struct",6),t.set("interface",7),t.set("module",8),t.set("property",9),t.set("event",10),t.set("operator",11),t.set("unit",12),t.set("value",13),t.set("constant",14),t.set("enum",15),t.set("enum-member",16),t.set("enumMember",16),t.set("keyword",17),t.set("snippet",28),t.set("text",18),t.set("color",19),t.set("file",20),t.set("reference",21),t.set("customcolor",22),t.set("folder",23),t.set("type-parameter",24),t.set("typeParameter",24),t.set("account",25),t.set("issue",26),t.set("tool",27);function o(r,s){let l=t.get(r);return typeof l>"u"&&!s&&(l=9),l}n.fromString=o})(xU||={});var Pht=class{constructor(i,e,t,o){this.range=i;this.text=e;this.completionKind=t;this.isSnippetText=o}equals(i){return z.lift(this.range).equalsRange(i.range)&&this.text===i.text&&this.completionKind===i.completionKind&&this.isSnippetText===i.isSnippetText}};var CU=class a{constructor(i,e,t){this.extensionId=i;this.extensionVersion=e;this.providerId=t}static fromExtensionId(i){return new a(i,void 0,void 0)}toString(){let i="";return this.extensionId&&(i+=this.extensionId),this.extensionVersion&&(i+=`@${this.extensionVersion}`),this.providerId&&(i+=`:${this.providerId}`),i.length===0&&(i="unknown"),i}toStringWithoutVersion(){let i="";return this.extensionId&&(i+=this.extensionId),this.providerId&&(i+=`:${this.providerId}`),i}},Aht=class a{constructor(i,e){this.extensionId=i;this.version=e}static tryCreate(i,e){if(!(!i||!e))return new a(i,e)}toString(){return`${this.extensionId}@${this.version}`}};function ZKi(a){return!!a&&A.isUri(a.uri)&&z.isIRange(a.range)&&(z.isIRange(a.originSelectionRange)||z.isIRange(a.targetSelectionRange))}function nv(a){return!!a&&A.isUri(a.uri)&&z.isIRange(a.range)}var nXt={17:d(851,null),16:d(852,null),4:d(853,null),13:d(854,null),8:d(855,null),9:d(856,null),21:d(857,null),23:d(858,null),7:d(859,null),0:d(860,null),11:d(861,null),10:d(862,null),19:d(863,null),5:d(864,null),1:d(865,null),2:d(866,null),20:d(867,null),15:d(868,null),18:d(869,null),24:d(870,null),3:d(871,null),6:d(872,null),14:d(873,null),22:d(874,null),25:d(905,null),12:d(906,null)};function Oht(a,i){return d(904,null,a,nXt[i])}var sh;(o=>{let a=new Map;a.set(0,M.symbolFile),a.set(1,M.symbolModule),a.set(2,M.symbolNamespace),a.set(3,M.symbolPackage),a.set(4,M.symbolClass),a.set(5,M.symbolMethod),a.set(6,M.symbolProperty),a.set(7,M.symbolField),a.set(8,M.symbolConstructor),a.set(9,M.symbolEnum),a.set(10,M.symbolInterface),a.set(11,M.symbolFunction),a.set(12,M.symbolVariable),a.set(13,M.symbolConstant),a.set(14,M.symbolString),a.set(15,M.symbolNumber),a.set(16,M.symbolBoolean),a.set(17,M.symbolArray),a.set(18,M.symbolObject),a.set(19,M.symbolKey),a.set(20,M.symbolNull),a.set(21,M.symbolEnumMember),a.set(22,M.symbolStruct),a.set(23,M.symbolEvent),a.set(24,M.symbolOperator),a.set(25,M.symbolTypeParameter);function i(n){let r=a.get(n);return r||(console.info("No codicon found for SymbolKind "+n),r=M.symbolProperty),r}o.toIcon=i;let e=new Map;e.set(0,20),e.set(1,8),e.set(2,8),e.set(3,8),e.set(4,5),e.set(5,0),e.set(6,9),e.set(7,3),e.set(8,2),e.set(9,15),e.set(10,7),e.set(11,1),e.set(12,4),e.set(13,14),e.set(14,18),e.set(15,13),e.set(16,13),e.set(17,13),e.set(18,13),e.set(19,17),e.set(20,13),e.set(21,16),e.set(22,6),e.set(23,10),e.set(24,11),e.set(25,24);function t(n){let r=e.get(n);return r===void 0&&(console.info("No completion kind found for SymbolKind "+n),r=20),r}o.toCompletionKind=t})(sh||={});var Qk=class{static asEditOperation(i){let e=z.lift(i.range);return e.isEmpty()?An.insert(e.getStartPosition(),i.text):An.replace(e,i.text)}static isTextEdit(i){let e=i;return typeof e.text=="string"&&z.isIRange(e.range)}},Yk=class a{constructor(i){this.value=i}static{this.Comment=new a("comment")}static{this.Imports=new a("imports")}static{this.Region=new a("region")}static fromValue(i){switch(i){case"comment":return a.Comment;case"imports":return a.Imports;case"region":return a.Region}return new a(i)}};var vse;(i=>{function a(e){return!e||typeof e!="object"?!1:typeof e.id=="string"&&typeof e.title=="string"}i.is=a})(vse||={});var Nht=class{constructor(i){this.createSupport=i;this._tokenizationSupport=null}dispose(){this._tokenizationSupport&&this._tokenizationSupport.then(i=>{i&&i.dispose()})}get tokenizationSupport(){return this._tokenizationSupport||(this._tokenizationSupport=this.createSupport()),this._tokenizationSupport}},kc=new Mht;var lW=class{constructor(i,e,t,o){this.originalStart=i,this.originalLength=e,this.modifiedStart=t,this.modifiedLength=o}getOriginalEnd(){return this.originalStart+this.originalLength}getModifiedEnd(){return this.modifiedStart+this.modifiedLength}};var bse=class{constructor(i){this.source=i}getElements(){let i=this.source,e=new Int32Array(i.length);for(let t=0,o=i.length;t<o;t++)e[t]=i.charCodeAt(t);return e}};function e2i(a,i,e){return new MM(new bse(a),new bse(i)).ComputeDiff(e).changes}var G6=class{static Assert(i,e){if(!i)throw new Error(e)}},$6=class{static Copy(i,e,t,o,n){for(let r=0;r<n;r++)t[o+r]=i[e+r]}static Copy2(i,e,t,o,n){for(let r=0;r<n;r++)t[o+r]=i[e+r]}};var Fht=class{constructor(){this.m_changes=[],this.m_originalStart=1073741824,this.m_modifiedStart=1073741824,this.m_originalCount=0,this.m_modifiedCount=0}MarkNextChange(){(this.m_originalCount>0||this.m_modifiedCount>0)&&this.m_changes.push(new lW(this.m_originalStart,this.m_originalCount,this.m_modifiedStart,this.m_modifiedCount)),this.m_originalCount=0,this.m_modifiedCount=0,this.m_originalStart=1073741824,this.m_modifiedStart=1073741824}AddOriginalElement(i,e){this.m_originalStart=Math.min(this.m_originalStart,i),this.m_modifiedStart=Math.min(this.m_modifiedStart,e),this.m_originalCount++}AddModifiedElement(i,e){this.m_originalStart=Math.min(this.m_originalStart,i),this.m_modifiedStart=Math.min(this.m_modifiedStart,e),this.m_modifiedCount++}getChanges(){return(this.m_originalCount>0||this.m_modifiedCount>0)&&this.MarkNextChange(),this.m_changes}getReverseChanges(){return(this.m_originalCount>0||this.m_modifiedCount>0)&&this.MarkNextChange(),this.m_changes.reverse(),this.m_changes}},MM=class a{constructor(i,e,t=null){this.ContinueProcessingPredicate=t,this._originalSequence=i,this._modifiedSequence=e;let[o,n,r]=a._getElements(i),[s,l,c]=a._getElements(e);this._hasStrings=r&&c,this._originalStringElements=o,this._originalElementsOrHash=n,this._modifiedStringElements=s,this._modifiedElementsOrHash=l,this.m_forwardHistory=[],this.m_reverseHistory=[]}static _isStringArray(i){return i.length>0&&typeof i[0]=="string"}static _getElements(i){let e=i.getElements();if(a._isStringArray(e)){let t=new Int32Array(e.length);for(let o=0,n=e.length;o<n;o++)t[o]=Vbe(e[o],0);return[e,t,!0]}return e instanceof Int32Array?[[],e,!1]:[[],new Int32Array(e),!1]}ElementsAreEqual(i,e){return this._originalElementsOrHash[i]!==this._modifiedElementsOrHash[e]?!1:this._hasStrings?this._originalStringElements[i]===this._modifiedStringElements[e]:!0}ElementsAreStrictEqual(i,e){if(!this.ElementsAreEqual(i,e))return!1;let t=a._getStrictElement(this._originalSequence,i),o=a._getStrictElement(this._modifiedSequence,e);return t===o}static _getStrictElement(i,e){return typeof i.getStrictElement=="function"?i.getStrictElement(e):null}OriginalElementsAreEqual(i,e){return this._originalElementsOrHash[i]!==this._originalElementsOrHash[e]?!1:this._hasStrings?this._originalStringElements[i]===this._originalStringElements[e]:!0}ModifiedElementsAreEqual(i,e){return this._modifiedElementsOrHash[i]!==this._modifiedElementsOrHash[e]?!1:this._hasStrings?this._modifiedStringElements[i]===this._modifiedStringElements[e]:!0}ComputeDiff(i){return this._ComputeDiff(0,this._originalElementsOrHash.length-1,0,this._modifiedElementsOrHash.length-1,i)}_ComputeDiff(i,e,t,o,n){let r=[!1],s=this.ComputeDiffRecursive(i,e,t,o,r);return n&&(s=this.PrettifyChanges(s)),{quitEarly:r[0],changes:s}}ComputeDiffRecursive(i,e,t,o,n){for(n[0]=!1;i<=e&&t<=o&&this.ElementsAreEqual(i,t);)i++,t++;for(;e>=i&&o>=t&&this.ElementsAreEqual(e,o);)e--,o--;if(i>e||t>o){let p;return t<=o?(G6.Assert(i===e+1,"originalStart should only be one more than originalEnd"),p=[new lW(i,0,t,o-t+1)]):i<=e?(G6.Assert(t===o+1,"modifiedStart should only be one more than modifiedEnd"),p=[new lW(i,e-i+1,t,0)]):(G6.Assert(i===e+1,"originalStart should only be one more than originalEnd"),G6.Assert(t===o+1,"modifiedStart should only be one more than modifiedEnd"),p=[]),p}let r=[0],s=[0],l=this.ComputeRecursionPoint(i,e,t,o,r,s,n),c=r[0],u=s[0];if(l!==null)return l;if(!n[0]){let p=this.ComputeDiffRecursive(i,c,t,u,n),h=[];return n[0]?h=[new lW(c+1,e-(c+1)+1,u+1,o-(u+1)+1)]:h=this.ComputeDiffRecursive(c+1,e,u+1,o,n),this.ConcatenateChanges(p,h)}return[new lW(i,e-i+1,t,o-t+1)]}WALKTRACE(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){let w=null,k=null,T=new Fht,N=e,O=t,V=g[0]-b[0]-o,U=-1073741824,G=this.m_forwardHistory.length-1;do{let $=V+i;$===N||$<O&&c[$-1]<c[$+1]?(p=c[$+1],f=p-V-o,p<U&&T.MarkNextChange(),U=p,T.AddModifiedElement(p+1,f),V=$+1-i):(p=c[$-1]+1,f=p-V-o,p<U&&T.MarkNextChange(),U=p-1,T.AddOriginalElement(p,f+1),V=$-1-i),G>=0&&(c=this.m_forwardHistory[G],i=c[0],N=1,O=c.length-1)}while(--G>=-1);if(w=T.getReverseChanges(),y[0]){let $=g[0]+1,te=b[0]+1;if(w!==null&&w.length>0){let pe=w[w.length-1];$=Math.max($,pe.getOriginalEnd()),te=Math.max(te,pe.getModifiedEnd())}k=[new lW($,h-$+1,te,v-te+1)]}else{T=new Fht,N=r,O=s,V=g[0]-b[0]-l,U=1073741824,G=S?this.m_reverseHistory.length-1:this.m_reverseHistory.length-2;do{let $=V+n;$===N||$<O&&u[$-1]>=u[$+1]?(p=u[$+1]-1,f=p-V-l,p>U&&T.MarkNextChange(),U=p+1,T.AddOriginalElement(p+1,f+1),V=$+1-n):(p=u[$-1],f=p-V-l,p>U&&T.MarkNextChange(),U=p,T.AddModifiedElement(p+1,f+1),V=$-1-n),G>=0&&(u=this.m_reverseHistory[G],n=u[0],N=1,O=u.length-1)}while(--G>=-1);k=T.getChanges()}return this.ConcatenateChanges(w,k)}ComputeRecursionPoint(i,e,t,o,n,r,s){let l=0,c=0,u=0,p=0,h=0,g=0;i--,t--,n[0]=0,r[0]=0,this.m_forwardHistory=[],this.m_reverseHistory=[];let f=e-i+(o-t),v=f+1,b=new Int32Array(v),S=new Int32Array(v),y=o-t,w=e-i,k=i-t,T=e-o,O=(w-y)%2===0;b[y]=i,S[w]=e,s[0]=!1;for(let V=1;V<=f/2+1;V++){let U=0,G=0;u=this.ClipDiagonalBound(y-V,V,y,v),p=this.ClipDiagonalBound(y+V,V,y,v);for(let te=u;te<=p;te+=2){te===u||te<p&&b[te-1]<b[te+1]?l=b[te+1]:l=b[te-1]+1,c=l-(te-y)-k;let pe=l;for(;l<e&&c<o&&this.ElementsAreEqual(l+1,c+1);)l++,c++;if(b[te]=l,l+c>U+G&&(U=l,G=c),!O&&Math.abs(te-w)<=V-1&&l>=S[te])return n[0]=l,r[0]=c,pe<=S[te]&&V<=1448?this.WALKTRACE(y,u,p,k,w,h,g,T,b,S,l,e,n,c,o,r,O,s):null}let $=(U-i+(G-t)-V)/2;if(this.ContinueProcessingPredicate!==null&&!this.ContinueProcessingPredicate(U,$))return s[0]=!0,n[0]=U,r[0]=G,$>0&&V<=1448?this.WALKTRACE(y,u,p,k,w,h,g,T,b,S,l,e,n,c,o,r,O,s):(i++,t++,[new lW(i,e-i+1,t,o-t+1)]);h=this.ClipDiagonalBound(w-V,V,w,v),g=this.ClipDiagonalBound(w+V,V,w,v);for(let te=h;te<=g;te+=2){te===h||te<g&&S[te-1]>=S[te+1]?l=S[te+1]-1:l=S[te-1],c=l-(te-w)-T;let pe=l;for(;l>i&&c>t&&this.ElementsAreEqual(l,c);)l--,c--;if(S[te]=l,O&&Math.abs(te-y)<=V&&l<=b[te])return n[0]=l,r[0]=c,pe>=b[te]&&V<=1448?this.WALKTRACE(y,u,p,k,w,h,g,T,b,S,l,e,n,c,o,r,O,s):null}if(V<=1447){let te=new Int32Array(p-u+2);te[0]=y-u+1,$6.Copy2(b,u,te,1,p-u+1),this.m_forwardHistory.push(te),te=new Int32Array(g-h+2),te[0]=w-h+1,$6.Copy2(S,h,te,1,g-h+1),this.m_reverseHistory.push(te)}}return this.WALKTRACE(y,u,p,k,w,h,g,T,b,S,l,e,n,c,o,r,O,s)}PrettifyChanges(i){for(let e=0;e<i.length;e++){let t=i[e],o=e<i.length-1?i[e+1].originalStart:this._originalElementsOrHash.length,n=e<i.length-1?i[e+1].modifiedStart:this._modifiedElementsOrHash.length,r=t.originalLength>0,s=t.modifiedLength>0;for(;t.originalStart+t.originalLength<o&&t.modifiedStart+t.modifiedLength<n&&(!r||this.OriginalElementsAreEqual(t.originalStart,t.originalStart+t.originalLength))&&(!s||this.ModifiedElementsAreEqual(t.modifiedStart,t.modifiedStart+t.modifiedLength));){let c=this.ElementsAreStrictEqual(t.originalStart,t.modifiedStart);if(this.ElementsAreStrictEqual(t.originalStart+t.originalLength,t.modifiedStart+t.modifiedLength)&&!c)break;t.originalStart++,t.modifiedStart++}let l=[null];if(e<i.length-1&&this.ChangesOverlap(i[e],i[e+1],l)){i[e]=l[0],i.splice(e+1,1),e--;continue}}for(let e=i.length-1;e>=0;e--){let t=i[e],o=0,n=0;if(e>0){let p=i[e-1];o=p.originalStart+p.originalLength,n=p.modifiedStart+p.modifiedLength}let r=t.originalLength>0,s=t.modifiedLength>0,l=0,c=this._boundaryScore(t.originalStart,t.originalLength,t.modifiedStart,t.modifiedLength);for(let p=1;;p++){let h=t.originalStart-p,g=t.modifiedStart-p;if(h<o||g<n||r&&!this.OriginalElementsAreEqual(h,h+t.originalLength)||s&&!this.ModifiedElementsAreEqual(g,g+t.modifiedLength))break;let v=(h===o&&g===n?5:0)+this._boundaryScore(h,t.originalLength,g,t.modifiedLength);v>c&&(c=v,l=p)}t.originalStart-=l,t.modifiedStart-=l;let u=[null];if(e>0&&this.ChangesOverlap(i[e-1],i[e],u)){i[e-1]=u[0],i.splice(e,1),e++;continue}}if(this._hasStrings)for(let e=1,t=i.length;e<t;e++){let o=i[e-1],n=i[e],r=n.originalStart-o.originalStart-o.originalLength,s=o.originalStart,l=n.originalStart+n.originalLength,c=l-s,u=o.modifiedStart,p=n.modifiedStart+n.modifiedLength,h=p-u;if(r<5&&c<20&&h<20){let g=this._findBetterContiguousSequence(s,c,u,h,r);if(g){let[f,v]=g;(f!==o.originalStart+o.originalLength||v!==o.modifiedStart+o.modifiedLength)&&(o.originalLength=f-o.originalStart,o.modifiedLength=v-o.modifiedStart,n.originalStart=f+r,n.modifiedStart=v+r,n.originalLength=l-n.originalStart,n.modifiedLength=p-n.modifiedStart)}}}return i}_findBetterContiguousSequence(i,e,t,o,n){if(e<n||o<n)return null;let r=i+e-n+1,s=t+o-n+1,l=0,c=0,u=0;for(let p=i;p<r;p++)for(let h=t;h<s;h++){let g=this._contiguousSequenceScore(p,h,n);g>0&&g>l&&(l=g,c=p,u=h)}return l>0?[c,u]:null}_contiguousSequenceScore(i,e,t){let o=0;for(let n=0;n<t;n++){if(!this.ElementsAreEqual(i+n,e+n))return 0;o+=this._originalStringElements[i+n].length}return o}_OriginalIsBoundary(i){return i<=0||i>=this._originalElementsOrHash.length-1?!0:this._hasStrings&&/^\s*$/.test(this._originalStringElements[i])}_OriginalRegionIsBoundary(i,e){if(this._OriginalIsBoundary(i)||this._OriginalIsBoundary(i-1))return!0;if(e>0){let t=i+e;if(this._OriginalIsBoundary(t-1)||this._OriginalIsBoundary(t))return!0}return!1}_ModifiedIsBoundary(i){return i<=0||i>=this._modifiedElementsOrHash.length-1?!0:this._hasStrings&&/^\s*$/.test(this._modifiedStringElements[i])}_ModifiedRegionIsBoundary(i,e){if(this._ModifiedIsBoundary(i)||this._ModifiedIsBoundary(i-1))return!0;if(e>0){let t=i+e;if(this._ModifiedIsBoundary(t-1)||this._ModifiedIsBoundary(t))return!0}return!1}_boundaryScore(i,e,t,o){let n=this._OriginalRegionIsBoundary(i,e)?1:0,r=this._ModifiedRegionIsBoundary(t,o)?1:0;return n+r}ConcatenateChanges(i,e){let t=[];if(i.length===0||e.length===0)return e.length>0?e:i;if(this.ChangesOverlap(i[i.length-1],e[0],t)){let o=new Array(i.length+e.length-1);return $6.Copy(i,0,o,0,i.length-1),o[i.length-1]=t[0],$6.Copy(e,1,o,i.length,e.length-1),o}else{let o=new Array(i.length+e.length);return $6.Copy(i,0,o,0,i.length),$6.Copy(e,0,o,i.length,e.length),o}}ChangesOverlap(i,e,t){if(G6.Assert(i.originalStart<=e.originalStart,"Left change is not less than or equal to right change"),G6.Assert(i.modifiedStart<=e.modifiedStart,"Left change is not less than or equal to right change"),i.originalStart+i.originalLength>=e.originalStart||i.modifiedStart+i.modifiedLength>=e.modifiedStart){let o=i.originalStart,n=i.originalLength,r=i.modifiedStart,s=i.modifiedLength;return i.originalStart+i.originalLength>=e.originalStart&&(n=e.originalStart+e.originalLength-i.originalStart),i.modifiedStart+i.modifiedLength>=e.modifiedStart&&(s=e.modifiedStart+e.modifiedLength-i.modifiedStart),t[0]=new lW(o,n,r,s),!0}else return t[0]=null,!1}ClipDiagonalBound(i,e,t,o){if(i>=0&&i<o)return i;let n=t,r=o-t-1,s=e%2===0;if(i<0){let l=n%2===0;return s===l?0:1}else{let l=r%2===0;return s===l?o-1:o-2}}},O$=new Uint32Array(65536),LMo=(a,i)=>{let e=a.length,t=i.length,o=1<<e-1,n=-1,r=0,s=e,l=e;for(;l--;)O$[a.charCodeAt(l)]|=1<<l;for(l=0;l<t;l++){let c=O$[i.charCodeAt(l)],u=c|r;c|=(c&n)+n^n,r|=~(c|n),n&=c,r&o&&s++,n&o&&s--,r=r<<1|1,n=n<<1|~(u|r),r&=u}for(l=e;l--;)O$[a.charCodeAt(l)]=0;return s};function RMo(a,i){let e=a.length,t=i.length,o=[],n=[],r=Math.ceil(e/32),s=Math.ceil(t/32);for(let f=0;f<r;f++)o[f]=-1,n[f]=0;let l=0;for(;l<s-1;l++){let f=0,v=-1,b=l*32,S=Math.min(32,t)+b;for(let y=b;y<S;y++)O$[i.charCodeAt(y)]|=1<<y;for(let y=0;y<e;y++){let w=O$[a.charCodeAt(y)],k=o[y/32|0]>>>y&1,T=n[y/32|0]>>>y&1,N=w|f,O=((w|T)&v)+v^v|w|T,V=f|~(O|v),U=v&O;V>>>31^k&&(o[y/32|0]^=1<<y),U>>>31^T&&(n[y/32|0]^=1<<y),V=V<<1|k,U=U<<1|T,v=U|~(N|V),f=V&N}for(let y=b;y<S;y++)O$[i.charCodeAt(y)]=0}let c=0,u=-1,p=l*32,h=Math.min(32,t-p)+p;for(let f=p;f<h;f++)O$[i.charCodeAt(f)]|=1<<f;let g=t;for(let f=0;f<e;f++){let v=O$[a.charCodeAt(f)],b=o[f/32|0]>>>f&1,S=n[f/32|0]>>>f&1,y=v|c,w=((v|S)&u)+u^u|v|S,k=c|~(w|u),T=u&w;g+=k>>>t-1&1,g-=T>>>t-1&1,k>>>31^b&&(o[f/32|0]^=1<<f),T>>>31^S&&(n[f/32|0]^=1<<f),k=k<<1|b,T=T<<1|S,u=T|~(y|k),c=k&y}for(let f=p;f<h;f++)O$[i.charCodeAt(f)]=0;return g}function t2i(a,i){if(a.length<i.length){let e=i;i=a,a=e}return i.length===0?a.length:a.length<=32?LMo(a,i):RMo(a,i)}var sXt=class{constructor(i,e,t){let o=new Uint8Array(i*e);for(let n=0,r=i*e;n<r;n++)o[n]=t;this._data=o,this.rows=i,this.cols=e}get(i,e){return this._data[i*this.cols+e]}set(i,e,t){this._data[i*this.cols+e]=t}},aXt=class{constructor(i){let e=0,t=0;for(let n=0,r=i.length;n<r;n++){let[s,l,c]=i[n];l>e&&(e=l),s>t&&(t=s),c>t&&(t=c)}e++,t++;let o=new sXt(t,e,0);for(let n=0,r=i.length;n<r;n++){let[s,l,c]=i[n];o.set(s,l,c)}this._states=o,this._maxCharCode=e}nextState(i,e){return e<0||e>=this._maxCharCode?0:this._states.get(i,e)}},rXt=null;function MMo(){return rXt===null&&(rXt=new aXt([[1,104,2],[1,72,2],[1,102,6],[1,70,6],[2,116,3],[2,84,3],[3,116,4],[3,84,4],[4,112,5],[4,80,5],[5,115,9],[5,83,9],[5,58,10],[6,105,7],[6,73,7],[7,108,8],[7,76,8],[8,101,9],[8,69,9],[9,58,10],[10,47,11],[11,47,12]])),rXt}var b$e=null;function PMo(){if(b$e===null){b$e=new _$(0);let a=` <>'"\u3001\u3002\uFF61\uFF64\uFF0C\uFF0E\uFF1A\uFF1B\u2018\u3008\u300C\u300E\u3014\uFF08\uFF3B\uFF5B\uFF62\uFF63\uFF5D\uFF3D\uFF09\u3015\u300F\u300D\u3009\u2019\uFF40\uFF5E\u2026|`;for(let e=0;e<a.length;e++)b$e.set(a.charCodeAt(e),1);let i=".,;:";for(let e=0;e<i.length;e++)b$e.set(i.charCodeAt(e),2)}return b$e}var S$e=class a{static _createLink(i,e,t,o,n){let r=n-1;do{let s=e.charCodeAt(r);if(i.get(s)!==2)break;r--}while(r>o);if(o>0){let s=e.charCodeAt(o-1),l=e.charCodeAt(r);(s===40&&l===41||s===91&&l===93||s===123&&l===125)&&r--}return{range:{startLineNumber:t,startColumn:o+1,endLineNumber:t,endColumn:r+2},url:e.substring(o,r+1)}}static computeLinks(i,e=MMo()){let t=PMo(),o=[];for(let n=1,r=i.getLineCount();n<=r;n++){let s=i.getLineContent(n),l=s.length,c=0,u=0,p=0,h=1,g=!1,f=!1,v=!1,b=!1;for(;c<l;){let S=!1,y=s.charCodeAt(c);if(h===13){let w;switch(y){case 40:g=!0,w=0;break;case 41:w=g?0:1;break;case 91:v=!0,f=!0,w=0;break;case 93:v=!1,w=f?0:1;break;case 123:b=!0,w=0;break;case 125:w=b?0:1;break;case 39:case 34:case 96:p===y?w=1:p===39||p===34||p===96?w=0:w=1;break;case 42:w=p===42?1:0;break;case 32:w=v?0:1;break;default:w=t.get(y)}w===1&&(o.push(a._createLink(t,s,n,u,c)),S=!0)}else if(h===12){let w;y===91?(f=!0,w=0):w=t.get(y),w===1?S=!0:h=13}else h=e.nextState(h,y),h===0&&(S=!0);S&&(h=1,g=!1,f=!1,b=!1,u=c+1,p=y),c++}h===13&&o.push(a._createLink(t,s,n,u,l))}return o}};function i2i(a){return!a||typeof a.getLineCount!="function"||typeof a.getLineContent!="function"?[]:S$e.computeLinks(a)}var Wht=class a{constructor(){this._defaultValueSet=[["true","false"],["True","False"],["Private","Public","Friend","ReadOnly","Partial","Protected","WriteOnly"],["public","protected","private"]]}static{this.INSTANCE=new a}navigateValueSet(i,e,t,o,n){if(i&&e){let r=this.doNavigateValueSet(e,n);if(r)return{range:i,value:r}}if(t&&o){let r=this.doNavigateValueSet(o,n);if(r)return{range:t,value:r}}return null}doNavigateValueSet(i,e){let t=this.numberReplace(i,e);return t!==null?t:this.textReplace(i,e)}numberReplace(i,e){let t=Math.pow(10,i.length-(i.lastIndexOf(".")+1)),o=Number(i),n=parseFloat(i);return!isNaN(o)&&!isNaN(n)&&o===n?o===0&&!e?null:(o=Math.floor(o*t),o+=e?t:-t,String(o/t)):null}textReplace(i,e){return this.valueSetsReplace(this._defaultValueSet,i,e)}valueSetsReplace(i,e,t){let o=null;for(let n=0,r=i.length;o===null&&n<r;n++)o=this.valueSetReplace(i[n],e,t);return o}valueSetReplace(i,e,t){let o=i.indexOf(e);return o>=0?(o+=t?1:-1,o<0?o=i.length-1:o%=i.length,i[o]):null}};var lXt=(Lt=>(Lt[Lt.DependsOnKbLayout=-1]="DependsOnKbLayout",Lt[Lt.Unknown=0]="Unknown",Lt[Lt.Backspace=1]="Backspace",Lt[Lt.Tab=2]="Tab",Lt[Lt.Enter=3]="Enter",Lt[Lt.Shift=4]="Shift",Lt[Lt.Ctrl=5]="Ctrl",Lt[Lt.Alt=6]="Alt",Lt[Lt.PauseBreak=7]="PauseBreak",Lt[Lt.CapsLock=8]="CapsLock",Lt[Lt.Escape=9]="Escape",Lt[Lt.Space=10]="Space",Lt[Lt.PageUp=11]="PageUp",Lt[Lt.PageDown=12]="PageDown",Lt[Lt.End=13]="End",Lt[Lt.Home=14]="Home",Lt[Lt.LeftArrow=15]="LeftArrow",Lt[Lt.UpArrow=16]="UpArrow",Lt[Lt.RightArrow=17]="RightArrow",Lt[Lt.DownArrow=18]="DownArrow",Lt[Lt.Insert=19]="Insert",Lt[Lt.Delete=20]="Delete",Lt[Lt.Digit0=21]="Digit0",Lt[Lt.Digit1=22]="Digit1",Lt[Lt.Digit2=23]="Digit2",Lt[Lt.Digit3=24]="Digit3",Lt[Lt.Digit4=25]="Digit4",Lt[Lt.Digit5=26]="Digit5",Lt[Lt.Digit6=27]="Digit6",Lt[Lt.Digit7=28]="Digit7",Lt[Lt.Digit8=29]="Digit8",Lt[Lt.Digit9=30]="Digit9",Lt[Lt.KeyA=31]="KeyA",Lt[Lt.KeyB=32]="KeyB",Lt[Lt.KeyC=33]="KeyC",Lt[Lt.KeyD=34]="KeyD",Lt[Lt.KeyE=35]="KeyE",Lt[Lt.KeyF=36]="KeyF",Lt[Lt.KeyG=37]="KeyG",Lt[Lt.KeyH=38]="KeyH",Lt[Lt.KeyI=39]="KeyI",Lt[Lt.KeyJ=40]="KeyJ",Lt[Lt.KeyK=41]="KeyK",Lt[Lt.KeyL=42]="KeyL",Lt[Lt.KeyM=43]="KeyM",Lt[Lt.KeyN=44]="KeyN",Lt[Lt.KeyO=45]="KeyO",Lt[Lt.KeyP=46]="KeyP",Lt[Lt.KeyQ=47]="KeyQ",Lt[Lt.KeyR=48]="KeyR",Lt[Lt.KeyS=49]="KeyS",Lt[Lt.KeyT=50]="KeyT",Lt[Lt.KeyU=51]="KeyU",Lt[Lt.KeyV=52]="KeyV",Lt[Lt.KeyW=53]="KeyW",Lt[Lt.KeyX=54]="KeyX",Lt[Lt.KeyY=55]="KeyY",Lt[Lt.KeyZ=56]="KeyZ",Lt[Lt.Meta=57]="Meta",Lt[Lt.ContextMenu=58]="ContextMenu",Lt[Lt.F1=59]="F1",Lt[Lt.F2=60]="F2",Lt[Lt.F3=61]="F3",Lt[Lt.F4=62]="F4",Lt[Lt.F5=63]="F5",Lt[Lt.F6=64]="F6",Lt[Lt.F7=65]="F7",Lt[Lt.F8=66]="F8",Lt[Lt.F9=67]="F9",Lt[Lt.F10=68]="F10",Lt[Lt.F11=69]="F11",Lt[Lt.F12=70]="F12",Lt[Lt.F13=71]="F13",Lt[Lt.F14=72]="F14",Lt[Lt.F15=73]="F15",Lt[Lt.F16=74]="F16",Lt[Lt.F17=75]="F17",Lt[Lt.F18=76]="F18",Lt[Lt.F19=77]="F19",Lt[Lt.F20=78]="F20",Lt[Lt.F21=79]="F21",Lt[Lt.F22=80]="F22",Lt[Lt.F23=81]="F23",Lt[Lt.F24=82]="F24",Lt[Lt.NumLock=83]="NumLock",Lt[Lt.ScrollLock=84]="ScrollLock",Lt[Lt.Semicolon=85]="Semicolon",Lt[Lt.Equal=86]="Equal",Lt[Lt.Comma=87]="Comma",Lt[Lt.Minus=88]="Minus",Lt[Lt.Period=89]="Period",Lt[Lt.Slash=90]="Slash",Lt[Lt.Backquote=91]="Backquote",Lt[Lt.BracketLeft=92]="BracketLeft",Lt[Lt.Backslash=93]="Backslash",Lt[Lt.BracketRight=94]="BracketRight",Lt[Lt.Quote=95]="Quote",Lt[Lt.OEM_8=96]="OEM_8",Lt[Lt.IntlBackslash=97]="IntlBackslash",Lt[Lt.Numpad0=98]="Numpad0",Lt[Lt.Numpad1=99]="Numpad1",Lt[Lt.Numpad2=100]="Numpad2",Lt[Lt.Numpad3=101]="Numpad3",Lt[Lt.Numpad4=102]="Numpad4",Lt[Lt.Numpad5=103]="Numpad5",Lt[Lt.Numpad6=104]="Numpad6",Lt[Lt.Numpad7=105]="Numpad7",Lt[Lt.Numpad8=106]="Numpad8",Lt[Lt.Numpad9=107]="Numpad9",Lt[Lt.NumpadMultiply=108]="NumpadMultiply",Lt[Lt.NumpadAdd=109]="NumpadAdd",Lt[Lt.NUMPAD_SEPARATOR=110]="NUMPAD_SEPARATOR",Lt[Lt.NumpadSubtract=111]="NumpadSubtract",Lt[Lt.NumpadDecimal=112]="NumpadDecimal",Lt[Lt.NumpadDivide=113]="NumpadDivide",Lt[Lt.KEY_IN_COMPOSITION=114]="KEY_IN_COMPOSITION",Lt[Lt.ABNT_C1=115]="ABNT_C1",Lt[Lt.ABNT_C2=116]="ABNT_C2",Lt[Lt.AudioVolumeMute=117]="AudioVolumeMute",Lt[Lt.AudioVolumeUp=118]="AudioVolumeUp",Lt[Lt.AudioVolumeDown=119]="AudioVolumeDown",Lt[Lt.BrowserSearch=120]="BrowserSearch",Lt[Lt.BrowserHome=121]="BrowserHome",Lt[Lt.BrowserBack=122]="BrowserBack",Lt[Lt.BrowserForward=123]="BrowserForward",Lt[Lt.MediaTrackNext=124]="MediaTrackNext",Lt[Lt.MediaTrackPrevious=125]="MediaTrackPrevious",Lt[Lt.MediaStop=126]="MediaStop",Lt[Lt.MediaPlayPause=127]="MediaPlayPause",Lt[Lt.LaunchMediaPlayer=128]="LaunchMediaPlayer",Lt[Lt.LaunchMail=129]="LaunchMail",Lt[Lt.LaunchApp2=130]="LaunchApp2",Lt[Lt.Clear=131]="Clear",Lt[Lt.MAX_VALUE=132]="MAX_VALUE",Lt))(lXt||{}),cXt=(o=>(o[o.Hint=1]="Hint",o[o.Info=2]="Info",o[o.Warning=4]="Warning",o[o.Error=8]="Error",o))(cXt||{}),dXt=(e=>(e[e.Unnecessary=1]="Unnecessary",e[e.Deprecated=2]="Deprecated",e))(dXt||{});var uXt=(e=>(e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e))(uXt||{});var pXt=class{static{this.CtrlCmd=2048}static{this.Shift=1024}static{this.Alt=512}static{this.WinCtrl=256}static chord(i,e){return Ai(i,e)}};function o2i(){return{editor:void 0,languages:void 0,CancellationTokenSource:$e,Emitter:E,KeyCode:lXt,KeyMod:pXt,Position:Ie,Range:z,Selection:Yt,SelectionDirection:uXt,MarkerSeverity:cXt,MarkerTag:dXt,Uri:A,Token:v$e}}var NMo=999,Oy=class{constructor(i,e,t,o){this.searchString=i,this.isRegex=e,this.matchCase=t,this.wordSeparators=o}parseSearchRequest(){if(this.searchString==="")return null;let i;this.isRegex?i=I$e(this.searchString):i=this.searchString.indexOf(`
`)>=0;let e=null;try{e=u$(this.searchString,this.isRegex,{matchCase:this.matchCase,wholeWord:!1,multiline:i,global:!0,unicode:!0})}catch{return null}if(!e)return null;let t=!this.isRegex&&!i;return t&&this.searchString.toLowerCase()!==this.searchString.toUpperCase()&&(t=this.matchCase),new Lmt(e,this.wordSeparators?jw(this.wordSeparators,[]):null,t?this.searchString:null)}};function I$e(a){if(!a||a.length===0)return!1;for(let i=0,e=a.length;i<e;i++){let t=a.charCodeAt(i);if(t===10)return!0;if(t===92){if(i++,i>=e)break;let o=a.charCodeAt(i);if(o===110||o===114||o===87)return!0}}return!1}function q6(a,i,e){if(!e)return new vU(a,null);let t=[];for(let o=0,n=i.length;o<n;o++)t[o]=i[o];return new vU(a,t)}var Vht=class{constructor(i){let e=[],t=0;for(let o=0,n=i.length;o<n;o++)i.charCodeAt(o)===10&&(e[t++]=o);this._lineFeedsOffsets=e}findLineFeedCountBeforeOffset(i){let e=this._lineFeedsOffsets,t=0,o=e.length-1;if(o===-1||i<=e[0])return 0;for(;t<o;){let n=t+((o-t)/2>>0);e[n]>=i?o=n-1:e[n+1]>=i?(t=n,o=n):t=n+1}return t+1}},Sse=class{static findMatches(i,e,t,o,n){let r=e.parseSearchRequest();return r?r.regex.multiline?this._doFindMatchesMultiline(i,t,new kU(r.wordSeparators,r.regex),o,n):this._doFindMatchesLineByLine(i,t,r,o,n):[]}static _getMultilineMatchRange(i,e,t,o,n,r){let s,l=0;o?(l=o.findLineFeedCountBeforeOffset(n),s=e+n+l):s=e+n;let c;if(o){let g=o.findLineFeedCountBeforeOffset(n+r.length)-l;c=s+r.length+g}else c=s+r.length;let u=i.getPositionAt(s),p=i.getPositionAt(c);return new z(u.lineNumber,u.column,p.lineNumber,p.column)}static _doFindMatchesMultiline(i,e,t,o,n){let r=i.getOffsetAt(e.getStartPosition()),s=i.getValueInRange(e,1),l=i.getEOL()===`\r
`?new Vht(s):null,c=[],u=0,p;for(t.reset(0);p=t.next(s);)if(c[u++]=q6(this._getMultilineMatchRange(i,r,s,l,p.index,p[0]),p,o),u>=n)return c;return c}static _doFindMatchesLineByLine(i,e,t,o,n){let r=[],s=0;if(e.startLineNumber===e.endLineNumber){let c=i.getLineContent(e.startLineNumber).substring(e.startColumn-1,e.endColumn-1);return s=this._findMatchesInLine(t,c,e.startLineNumber,e.startColumn-1,s,r,o,n),r}let l=i.getLineContent(e.startLineNumber).substring(e.startColumn-1);s=this._findMatchesInLine(t,l,e.startLineNumber,e.startColumn-1,s,r,o,n);for(let c=e.startLineNumber+1;c<e.endLineNumber&&s<n;c++)s=this._findMatchesInLine(t,i.getLineContent(c),c,0,s,r,o,n);if(s<n){let c=i.getLineContent(e.endLineNumber).substring(0,e.endColumn-1);s=this._findMatchesInLine(t,c,e.endLineNumber,0,s,r,o,n)}return r}static _findMatchesInLine(i,e,t,o,n,r,s,l){let c=i.wordSeparators;if(!s&&i.simpleSearch){let h=i.simpleSearch,g=h.length,f=e.length,v=-g;for(;(v=e.indexOf(h,v+g))!==-1;)if((!c||Bht(c,e,f,v,g))&&(r[n++]=new vU(new z(t,v+1+o,t,v+1+g+o),null),n>=l))return n;return n}let u=new kU(i.wordSeparators,i.regex),p;u.reset(0);do if(p=u.next(e),p&&(r[n++]=q6(new z(t,p.index+1+o,t,p.index+1+p[0].length+o),p,s),n>=l))return n;while(p);return n}static findNextMatch(i,e,t,o){let n=e.parseSearchRequest();if(!n)return null;let r=new kU(n.wordSeparators,n.regex);return n.regex.multiline?this._doFindNextMatchMultiline(i,t,r,o):this._doFindNextMatchLineByLine(i,t,r,o)}static _doFindNextMatchMultiline(i,e,t,o){let n=new Ie(e.lineNumber,1),r=i.getOffsetAt(n),s=i.getLineCount(),l=i.getValueInRange(new z(n.lineNumber,n.column,s,i.getLineMaxColumn(s)),1),c=i.getEOL()===`\r
`?new Vht(l):null;t.reset(e.column-1);let u=t.next(l);return u?q6(this._getMultilineMatchRange(i,r,l,c,u.index,u[0]),u,o):e.lineNumber!==1||e.column!==1?this._doFindNextMatchMultiline(i,new Ie(1,1),t,o):null}static _doFindNextMatchLineByLine(i,e,t,o){let n=i.getLineCount(),r=e.lineNumber,s=i.getLineContent(r),l=this._findFirstMatchInLine(t,s,r,e.column,o);if(l)return l;for(let c=1;c<=n;c++){let u=(r+c-1)%n,p=i.getLineContent(u+1),h=this._findFirstMatchInLine(t,p,u+1,1,o);if(h)return h}return null}static _findFirstMatchInLine(i,e,t,o,n){i.reset(o-1);let r=i.next(e);return r?q6(new z(t,r.index+1,t,r.index+1+r[0].length),r,n):null}static findPreviousMatch(i,e,t,o){let n=e.parseSearchRequest();if(!n)return null;let r=new kU(n.wordSeparators,n.regex);return n.regex.multiline?this._doFindPreviousMatchMultiline(i,t,r,o):this._doFindPreviousMatchLineByLine(i,t,r,o)}static _doFindPreviousMatchMultiline(i,e,t,o){let n=this._doFindMatchesMultiline(i,new z(1,1,e.lineNumber,e.column),t,o,10*NMo);if(n.length>0)return n[n.length-1];let r=i.getLineCount();return e.lineNumber!==r||e.column!==i.getLineMaxColumn(r)?this._doFindPreviousMatchMultiline(i,new Ie(r,i.getLineMaxColumn(r)),t,o):null}static _doFindPreviousMatchLineByLine(i,e,t,o){let n=i.getLineCount(),r=e.lineNumber,s=i.getLineContent(r).substring(0,e.column-1),l=this._findLastMatchInLine(t,s,r,o);if(l)return l;for(let c=1;c<=n;c++){let u=(n+r-c-1)%n,p=i.getLineContent(u+1),h=this._findLastMatchInLine(t,p,u+1,o);if(h)return h}return null}static _findLastMatchInLine(i,e,t,o){let n=null,r;for(i.reset(0);r=i.next(e);)n=q6(new z(t,r.index+1,t,r.index+1+r[0].length),r,o);return n}};function OMo(a,i,e,t,o){if(t===0)return!0;let n=i.charCodeAt(t-1);if(a.get(n)!==0||n===13||n===10)return!0;if(o>0){let r=i.charCodeAt(t);if(a.get(r)!==0)return!0}return!1}function FMo(a,i,e,t,o){if(t+o===e)return!0;let n=i.charCodeAt(t+o);if(a.get(n)!==0||n===13||n===10)return!0;if(o>0){let r=i.charCodeAt(t+o-1);if(a.get(r)!==0)return!0}return!1}function Bht(a,i,e,t,o){return OMo(a,i,e,t,o)&&FMo(a,i,e,t,o)}var kU=class{constructor(i,e){this._wordSeparators=i,this._searchRegex=e,this._prevMatchStartIndex=-1,this._prevMatchLength=0}reset(i){this._searchRegex.lastIndex=i,this._prevMatchStartIndex=-1,this._prevMatchLength=0}next(i){let e=i.length,t;do{if(this._prevMatchStartIndex+this._prevMatchLength===e||(t=this._searchRegex.exec(i),!t))return null;let o=t.index,n=t[0].length;if(o===this._prevMatchStartIndex&&n===this._prevMatchLength){if(n===0){Ebe(i,e,this._searchRegex.lastIndex)>65535?this._searchRegex.lastIndex+=2:this._searchRegex.lastIndex+=1;continue}return null}if(this._prevMatchStartIndex=o,this._prevMatchLength=n,!this._wordSeparators||Bht(this._wordSeparators,i,e,o,n))return t}while(t);return null}};var Ise=class{static computeUnicodeHighlights(i,e,t){let o=t?t.startLineNumber:1,n=t?t.endLineNumber:i.getLineCount(),r=new Hht(e),s=r.getCandidateCodePoints(),l;s==="allNonBasicAscii"?l=new RegExp("[^\\t\\n\\r\\x20-\\x7E]","g"):l=new RegExp(`${WMo(Array.from(s))}`,"g");let c=new kU(null,l),u=[],p=!1,h,g=0,f=0,v=0;e:for(let b=o,S=n;b<=S;b++){let y=i.getLineContent(b),w=y.length;c.reset(0);do if(h=c.next(y),h){let k=h.index,T=h.index+h[0].length;if(k>0){let U=y.charCodeAt(k-1);Ru(U)&&k--}if(T+1<w){let U=y.charCodeAt(T-1);Ru(U)&&T++}let N=y.substring(k,T),O=My(k+1,F6,y,0);O&&O.endColumn<=k+1&&(O=null);let V=r.shouldHighlightNonBasicASCII(N,O?O.word:null);if(V!==0){if(V===3?g++:V===2?f++:V===1?v++:Hr(V),u.length>=1e3){p=!0;break e}u.push(new z(b,k+1,b,T+1))}}while(h)}return{ranges:u,hasMore:p,ambiguousCharacterCount:g,invisibleCharacterCount:f,nonBasicAsciiCharacterCount:v}}static computeUnicodeHighlightReason(i,e){let t=new Hht(e);switch(t.shouldHighlightNonBasicASCII(i,null)){case 0:return null;case 2:return{kind:1};case 3:{let n=i.codePointAt(0),r=t.ambiguousCharacters.getPrimaryConfusable(n),s=p6.getLocales().filter(l=>!p6.getInstance(new Set([...e.allowedLocales,l])).isAmbiguous(n));return{kind:0,confusableWith:String.fromCodePoint(r),notAmbiguousInLocales:s}}case 1:return{kind:2}}}};function WMo(a,i){return`[${Yr(a.map(t=>String.fromCodePoint(t)).join(""))}]`}var Hht=class{constructor(i){this.options=i;this.allowedCodePoints=new Set(i.allowedCodePoints),this.ambiguousCharacters=p6.getInstance(new Set(i.allowedLocales))}getCandidateCodePoints(){if(this.options.nonBasicASCII)return"allNonBasicAscii";let i=new Set;if(this.options.invisibleCharacters)for(let e of K0.codePoints)n2i(String.fromCodePoint(e))||i.add(e);if(this.options.ambiguousCharacters)for(let e of this.ambiguousCharacters.getConfusableCodePoints())i.add(e);for(let e of this.allowedCodePoints)i.delete(e);return i}shouldHighlightNonBasicASCII(i,e){let t=i.codePointAt(0);if(this.allowedCodePoints.has(t))return 0;if(this.options.nonBasicASCII)return 1;let o=!1,n=!1;if(e)for(let r of e){let s=r.codePointAt(0),l=oU(r);o=o||l,!l&&!this.ambiguousCharacters.isAmbiguous(s)&&!K0.isInvisibleCharacter(s)&&(n=!0)}return!o&&n?0:this.options.invisibleCharacters&&!n2i(i)&&K0.isInvisibleCharacter(t)?2:this.options.ambiguousCharacters&&this.ambiguousCharacters.isAmbiguous(t)?3:0}};function n2i(a){return a===" "||a===`
`||a===" "}var j6=class{constructor(i,e,t){this.changes=i;this.moves=e;this.hitTimeout=t}},LSe=class a{constructor(i,e){this.lineRangeMapping=i,this.changes=e}flip(){return new a(this.lineRangeMapping.flip(),this.changes.map(i=>i.flip()))}};var ro=class a{static ofLength(i,e){return new a(i,i+e)}static fromRange(i){return new a(i.startLineNumber,i.endLineNumber)}static fromRangeInclusive(i){return new a(i.startLineNumber,i.endLineNumber+1)}static{this.compareByStart=tl(i=>i.startLineNumber,qd)}static subtract(i,e){return e?i.startLineNumber<e.startLineNumber&&e.endLineNumberExclusive<i.endLineNumberExclusive?[new a(i.startLineNumber,e.startLineNumber),new a(e.endLineNumberExclusive,i.endLineNumberExclusive)]:e.startLineNumber<=i.startLineNumber&&i.endLineNumberExclusive<=e.endLineNumberExclusive?[]:e.endLineNumberExclusive<i.endLineNumberExclusive?[new a(Math.max(e.endLineNumberExclusive,i.startLineNumber),i.endLineNumberExclusive)]:[new a(i.startLineNumber,Math.min(e.startLineNumber,i.endLineNumberExclusive))]:[i]}static joinMany(i){if(i.length===0)return[];let e=new PM(i[0].slice());for(let t=1;t<i.length;t++)e=e.getUnion(new PM(i[t].slice()));return e.ranges}static join(i){if(i.length===0)throw new ni("lineRanges cannot be empty");let e=i[0].startLineNumber,t=i[0].endLineNumberExclusive;for(let o=1;o<i.length;o++)e=Math.min(e,i[o].startLineNumber),t=Math.max(t,i[o].endLineNumberExclusive);return new a(e,t)}static deserialize(i){return new a(i[0],i[1])}constructor(i,e){if(i>e)throw new ni(`startLineNumber ${i} cannot be after endLineNumberExclusive ${e}`);this.startLineNumber=i,this.endLineNumberExclusive=e}contains(i){return this.startLineNumber<=i&&i<this.endLineNumberExclusive}containsRange(i){return this.startLineNumber<=i.startLineNumber&&i.endLineNumberExclusive<=this.endLineNumberExclusive}get isEmpty(){return this.startLineNumber===this.endLineNumberExclusive}delta(i){return new a(this.startLineNumber+i,this.endLineNumberExclusive+i)}deltaLength(i){return new a(this.startLineNumber,this.endLineNumberExclusive+i)}get length(){return this.endLineNumberExclusive-this.startLineNumber}join(i){return new a(Math.min(this.startLineNumber,i.startLineNumber),Math.max(this.endLineNumberExclusive,i.endLineNumberExclusive))}toString(){return`[${this.startLineNumber},${this.endLineNumberExclusive})`}intersect(i){let e=Math.max(this.startLineNumber,i.startLineNumber),t=Math.min(this.endLineNumberExclusive,i.endLineNumberExclusive);if(e<=t)return new a(e,t)}intersectsStrict(i){return this.startLineNumber<i.endLineNumberExclusive&&i.startLineNumber<this.endLineNumberExclusive}intersectsOrTouches(i){return this.startLineNumber<=i.endLineNumberExclusive&&i.startLineNumber<=this.endLineNumberExclusive}equals(i){return this.startLineNumber===i.startLineNumber&&this.endLineNumberExclusive===i.endLineNumberExclusive}toInclusiveRange(){return this.isEmpty?null:new z(this.startLineNumber,1,this.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER)}toExclusiveRange(){return new z(this.startLineNumber,1,this.endLineNumberExclusive,1)}mapToLineArray(i){let e=[];for(let t=this.startLineNumber;t<this.endLineNumberExclusive;t++)e.push(i(t));return e}forEach(i){for(let e=this.startLineNumber;e<this.endLineNumberExclusive;e++)i(e)}serialize(){return[this.startLineNumber,this.endLineNumberExclusive]}toOffsetRange(){return new di(this.startLineNumber-1,this.endLineNumberExclusive-1)}distanceToRange(i){return this.endLineNumberExclusive<=i.startLineNumber?i.startLineNumber-this.endLineNumberExclusive:i.endLineNumberExclusive<=this.startLineNumber?this.startLineNumber-i.endLineNumberExclusive:0}distanceToLine(i){return this.contains(i)?0:i<this.startLineNumber?this.startLineNumber-i:i-this.endLineNumberExclusive}addMargin(i,e){return new a(this.startLineNumber-i,this.endLineNumberExclusive+e)}},PM=class a{constructor(i=[]){this._normalizedRanges=i}get ranges(){return this._normalizedRanges}addRange(i){if(i.length===0)return;let e=xy(this._normalizedRanges,o=>o.endLineNumberExclusive>=i.startLineNumber),t=XG(this._normalizedRanges,o=>o.startLineNumber<=i.endLineNumberExclusive)+1;if(e===t)this._normalizedRanges.splice(e,0,i);else if(e===t-1){let o=this._normalizedRanges[e];this._normalizedRanges[e]=o.join(i)}else{let o=this._normalizedRanges[e].join(this._normalizedRanges[t-1]).join(i);this._normalizedRanges.splice(e,t-e,o)}}contains(i){let e=YG(this._normalizedRanges,t=>t.startLineNumber<=i);return!!e&&e.endLineNumberExclusive>i}intersects(i){let e=YG(this._normalizedRanges,t=>t.startLineNumber<i.endLineNumberExclusive);return!!e&&e.endLineNumberExclusive>i.startLineNumber}getUnion(i){if(this._normalizedRanges.length===0)return i;if(i._normalizedRanges.length===0)return this;let e=[],t=0,o=0,n=null;for(;t<this._normalizedRanges.length||o<i._normalizedRanges.length;){let r=null;if(t<this._normalizedRanges.length&&o<i._normalizedRanges.length){let s=this._normalizedRanges[t],l=i._normalizedRanges[o];s.startLineNumber<l.startLineNumber?(r=s,t++):(r=l,o++)}else t<this._normalizedRanges.length?(r=this._normalizedRanges[t],t++):(r=i._normalizedRanges[o],o++);n===null?n=r:n.endLineNumberExclusive>=r.startLineNumber?n=new ro(n.startLineNumber,Math.max(n.endLineNumberExclusive,r.endLineNumberExclusive)):(e.push(n),n=r)}return n!==null&&e.push(n),new a(e)}subtractFrom(i){let e=xy(this._normalizedRanges,r=>r.endLineNumberExclusive>=i.startLineNumber),t=XG(this._normalizedRanges,r=>r.startLineNumber<=i.endLineNumberExclusive)+1;if(e===t)return new a([i]);let o=[],n=i.startLineNumber;for(let r=e;r<t;r++){let s=this._normalizedRanges[r];s.startLineNumber>n&&o.push(new ro(n,s.startLineNumber)),n=s.endLineNumberExclusive}return n<i.endLineNumberExclusive&&o.push(new ro(n,i.endLineNumberExclusive)),new a(o)}toString(){return this._normalizedRanges.map(i=>i.toString()).join(", ")}getIntersection(i){let e=[],t=0,o=0;for(;t<this._normalizedRanges.length&&o<i._normalizedRanges.length;){let n=this._normalizedRanges[t],r=i._normalizedRanges[o],s=n.intersect(r);s&&!s.isEmpty&&e.push(s),n.endLineNumberExclusive<r.endLineNumberExclusive?t++:o++}return new a(e)}getWithDelta(i){return new a(this._normalizedRanges.map(e=>e.delta(i)))}};var Zl=class a{constructor(i,e){this.lineCount=i;this.columnCount=e}static{this.zero=new a(0,0)}static lengthDiffNonNegative(i,e){return e.isLessThan(i)?a.zero:i.lineCount===e.lineCount?new a(0,e.columnCount-i.columnCount):new a(e.lineCount-i.lineCount,e.columnCount)}static betweenPositions(i,e){return i.lineNumber===e.lineNumber?new a(0,e.column-i.column):new a(e.lineNumber-i.lineNumber,e.column-1)}static fromPosition(i){return new a(i.lineNumber-1,i.column-1)}static ofRange(i){return a.betweenPositions(i.getStartPosition(),i.getEndPosition())}static ofText(i){let e=0,t=0;for(let o of i)o===`
`?(e++,t=0):t++;return new a(e,t)}static ofSubstr(i,e){return a.ofText(e.substring(i))}static sum(i,e){return i.reduce((t,o)=>t.add(e(o)),a.zero)}isZero(){return this.lineCount===0&&this.columnCount===0}isLessThan(i){return this.lineCount!==i.lineCount?this.lineCount<i.lineCount:this.columnCount<i.columnCount}isGreaterThan(i){return this.lineCount!==i.lineCount?this.lineCount>i.lineCount:this.columnCount>i.columnCount}isGreaterThanOrEqualTo(i){return this.lineCount!==i.lineCount?this.lineCount>i.lineCount:this.columnCount>=i.columnCount}equals(i){return this.lineCount===i.lineCount&&this.columnCount===i.columnCount}compare(i){return this.lineCount!==i.lineCount?this.lineCount-i.lineCount:this.columnCount-i.columnCount}add(i){return i.lineCount===0?new a(this.lineCount,this.columnCount+i.columnCount):new a(this.lineCount+i.lineCount,i.columnCount)}createRange(i){return this.lineCount===0?new z(i.lineNumber,i.column,i.lineNumber,i.column+this.columnCount):new z(i.lineNumber,i.column,i.lineNumber+this.lineCount,this.columnCount+1)}toRange(){return new z(1,1,this.lineCount+1,this.columnCount+1)}toLineRange(){return ro.ofLength(1,this.lineCount+1)}addToPosition(i){return this.lineCount===0?new Ie(i.lineNumber,i.column+this.columnCount):new Ie(i.lineNumber+this.lineCount,this.columnCount+1)}addToRange(i){return z.fromPositions(this.addToPosition(i.getStartPosition()),this.addToPosition(i.getEndPosition()))}toString(){return`${this.lineCount},${this.columnCount}`}};var RSe=class{getOffsetRange(i){return new di(this.getOffset(i.getStartPosition()),this.getOffset(i.getEndPosition()))}getRange(i){return z.fromPositions(this.getPosition(i.start),this.getPosition(i.endExclusive))}getStringEdit(i){let e=i.replacements.map(t=>this.getStringReplacement(t));return new F$.deps.StringEdit(e)}getStringReplacement(i){return new F$.deps.StringReplacement(this.getOffsetRange(i.range),i.text)}getTextReplacement(i){return new F$.deps.TextReplacement(this.getRange(i.replaceRange),i.newText)}getTextEdit(i){let e=i.replacements.map(t=>this.getTextReplacement(t));return new F$.deps.TextEdit(e)}},F$=class{static{this._deps=void 0}static get deps(){if(!this._deps)throw new Error("Dependencies not set. Call _setDependencies first.");return this._deps}};function r2i(a){F$._deps=a}var AM=class extends RSe{constructor(e){super();this.text=e}get lineStartOffsetByLineIdx(){return this._lineStartOffsetByLineIdx||this._computeLineOffsets(),this._lineStartOffsetByLineIdx}get lineEndOffsetByLineIdx(){return this._lineEndOffsetByLineIdx||this._computeLineOffsets(),this._lineEndOffsetByLineIdx}_computeLineOffsets(){this._lineStartOffsetByLineIdx=[],this._lineEndOffsetByLineIdx=[],this._lineStartOffsetByLineIdx.push(0);for(let e=0;e<this.text.length;e++)this.text.charAt(e)===`
`&&(this._lineStartOffsetByLineIdx.push(e+1),e>0&&this.text.charAt(e-1)==="\r"?this._lineEndOffsetByLineIdx.push(e-1):this._lineEndOffsetByLineIdx.push(e));this._lineEndOffsetByLineIdx.push(this.text.length)}getOffset(e){let t=this._validatePosition(e);return this.lineStartOffsetByLineIdx[t.lineNumber-1]+t.column-1}_validatePosition(e){if(e.lineNumber<1)return new Ie(1,1);let t=this.textLength.lineCount+1;if(e.lineNumber>t){let n=this.getLineLength(t);return new Ie(t,n+1)}if(e.column<1)return new Ie(e.lineNumber,1);let o=this.getLineLength(e.lineNumber);return e.column-1>o?new Ie(e.lineNumber,o+1):e}getPosition(e){let t=XG(this.lineStartOffsetByLineIdx,r=>r<=e),o=t+1,n=e-this.lineStartOffsetByLineIdx[t]+1;return new Ie(o,n)}getTextLength(e){return F$.deps.TextLength.ofRange(this.getRange(e))}get textLength(){let e=this.lineStartOffsetByLineIdx.length-1;return new F$.deps.TextLength(e,this.text.length-this.lineStartOffsetByLineIdx[e])}getLineLength(e){return this.lineEndOffsetByLineIdx[e-1]-this.lineStartOffsetByLineIdx[e-1]}};var Q6=class{constructor(){this._transformer=void 0}get endPositionExclusive(){return this.length.addToPosition(new Ie(1,1))}get lineRange(){return this.length.toLineRange()}getValue(){return this.getValueOfRange(this.length.toRange())}getValueOfOffsetRange(i){return this.getValueOfRange(this.getTransformer().getRange(i))}getLineLength(i){return this.getValueOfRange(new z(i,1,i,Number.MAX_SAFE_INTEGER)).length}getTransformer(){return this._transformer||(this._transformer=new AM(this.getValue())),this._transformer}getLineAt(i){return this.getValueOfRange(new z(i,1,i,Number.MAX_SAFE_INTEGER))}getLines(){let i=this.getValue();return mc(i)}getLinesOfRange(i){return i.mapToLineArray(e=>this.getLineAt(e))}equals(i){return this===i?!0:this.getValue()===i.getValue()}},mXt=class extends Q6{constructor(e,t){Ey(t>=1);super();this._getLineContent=e;this._lineCount=t}getValueOfRange(e){if(e.startLineNumber===e.endLineNumber)return this._getLineContent(e.startLineNumber).substring(e.startColumn-1,e.endColumn-1);let t=this._getLineContent(e.startLineNumber).substring(e.startColumn-1);for(let o=e.startLineNumber+1;o<e.endLineNumber;o++)t+=`
`+this._getLineContent(o);return t+=`
`+this._getLineContent(e.endLineNumber).substring(0,e.endColumn-1),t}getLineLength(e){return this._getLineContent(e).length}get length(){let e=this._getLineContent(this._lineCount);return new Zl(this._lineCount-1,e.length)}},yse=class extends mXt{constructor(i){super(e=>i[e-1],i.length)}},_S=class extends Q6{constructor(e){super();this.value=e;this._t=new AM(this.value)}getValueOfRange(e){return this._t.getOffsetRange(e).substring(this.value)}get length(){return this._t.textLength}getTransformer(){return this._t}};var bp=class a{constructor(i){this.replacements=i;eh(()=>Ty(i,(e,t)=>e.range.getEndPosition().isBeforeOrEqual(t.range.getStartPosition())))}static fromStringEdit(i,e){let t=i.replacements.map(o=>Xr.fromStringReplacement(o,e));return new a(t)}static replace(i,e){return new a([new Xr(i,e)])}static delete(i){return new a([new Xr(i,"")])}static insert(i,e){return new a([new Xr(z.fromPositions(i,i),e)])}static fromParallelReplacementsUnsorted(i){let e=i.slice().sort(tl(t=>t.range,z.compareRangesUsingStarts));return new a(e)}normalize(){let i=[];for(let e of this.replacements)if(i.length>0&&i[i.length-1].range.getEndPosition().equals(e.range.getStartPosition())){let t=i[i.length-1];i[i.length-1]=new Xr(t.range.plusRange(e.range),t.text+e.text)}else e.isEmpty||i.push(e);return new a(i)}mapPosition(i){let e=0,t=0,o=0;for(let n of this.replacements){let r=n.range.getStartPosition();if(i.isBeforeOrEqual(r))break;let s=n.range.getEndPosition(),l=Zl.ofText(n.text);if(i.isBefore(s)){let c=new Ie(r.lineNumber+e,r.column+(r.lineNumber+e===t?o:0)),u=l.addToPosition(c);return Uht(c,u)}r.lineNumber+e!==t&&(o=0),e+=l.lineCount-(n.range.endLineNumber-n.range.startLineNumber),l.lineCount===0?s.lineNumber!==r.lineNumber?o+=l.columnCount-(s.column-1):o+=l.columnCount-(s.column-r.column):o=l.columnCount,t=s.lineNumber+e}return new Ie(i.lineNumber+e,i.column+(i.lineNumber+e===t?o:0))}mapRange(i){function e(r){return r instanceof Ie?r:r.getStartPosition()}function t(r){return r instanceof Ie?r:r.getEndPosition()}let o=e(this.mapPosition(i.getStartPosition())),n=t(this.mapPosition(i.getEndPosition()));return Uht(o,n)}inverseMapPosition(i,e){return this.inverse(e).mapPosition(i)}inverseMapRange(i,e){return this.inverse(e).mapRange(i)}apply(i){let e="",t=new Ie(1,1);for(let n of this.replacements){let r=n.range,s=r.getStartPosition(),l=r.getEndPosition(),c=Uht(t,s);c.isEmpty()||(e+=i.getValueOfRange(c)),e+=n.text,t=l}let o=Uht(t,i.endPositionExclusive);return o.isEmpty()||(e+=i.getValueOfRange(o)),e}applyToString(i){let e=new _S(i);return this.apply(e)}inverse(i){let e=this.getNewRanges();return new a(this.replacements.map((t,o)=>new Xr(e[o],i.getValueOfRange(t.range))))}getNewRanges(){let i=[],e=0,t=0,o=0;for(let n of this.replacements){let r=Zl.ofText(n.text),s=Ie.lift({lineNumber:n.range.startLineNumber+t,column:n.range.startColumn+(n.range.startLineNumber===e?o:0)}),l=r.createRange(s);i.push(l),t=l.endLineNumber-n.range.endLineNumber,o=l.endColumn-n.range.endColumn,e=n.range.endLineNumber}return i}toReplacement(i){if(this.replacements.length===0)throw new ni;if(this.replacements.length===1)return this.replacements[0];let e=this.replacements[0].range.getStartPosition(),t=this.replacements[this.replacements.length-1].range.getEndPosition(),o="";for(let n=0;n<this.replacements.length;n++){let r=this.replacements[n];if(o+=r.text,n<this.replacements.length-1){let s=this.replacements[n+1],l=z.fromPositions(r.range.getEndPosition(),s.range.getStartPosition()),c=i.getValueOfRange(l);o+=c}}return new Xr(z.fromPositions(e,t),o)}equals(i){return $i(this.replacements,i.replacements,(e,t)=>e.equals(t))}compose(i){let e=this.normalize(),t=i.normalize();if(e.replacements.length===0)return t;if(t.replacements.length===0)return e;let o=[],n=0,r=1,s=1,l=0,c=0,u=0,p=0,h=null,g=0,f=0,v=!1,b=!1,S=1,y=1;function w(){if(!v)if(n<e.replacements.length){let T=e.replacements[n],N=T.range.getStartPosition();if(!(r===N.lineNumber&&s===N.column))l=r,c=s,u=N.lineNumber,p=N.column,h=null,r===N.lineNumber?(g=0,f=N.column-s):(g=N.lineNumber-r,f=N.column-1),v=!0,r=N.lineNumber,s=N.column;else{let V=T.range.getEndPosition();l=N.lineNumber,c=N.column,u=V.lineNumber,p=V.column,h=T.text;let U=0,G=0,$=T.text;for(let te=0;te<$.length;te++)$.charCodeAt(te)===10?(U++,G=0):G++;g=U,f=G,v=!0,r=V.lineNumber,s=V.column,n++}}else b=!0,l=r,c=s,v=!0}function k(T,N,O){if(N===0&&O===0)return["",T];let V=0,U=0;for(;V<N;){let G=T.indexOf(`
`,U);if(G===-1)throw new ni("Text length mismatch");U=G+1,V++}return U+=O,[T.substring(0,U),T.substring(U)]}for(let T of t.replacements){let N=T.range.getStartPosition(),O=T.range.getEndPosition();for(;!(S===N.lineNumber&&y===N.column);){if(w(),b){let se,Se;S===N.lineNumber?(se=0,Se=N.column-y):(se=N.lineNumber-S,Se=N.column-1),S=N.lineNumber,y=N.column,se===0?c+=Se:(l+=se,c=Se+1);break}let te,pe;g===0?(te=S,pe=y+f):(te=S+g,pe=f+1);let de=!1;if(N.lineNumber<te?de=!0:N.lineNumber===te&&(de=N.column<pe),de){let se,Se;S===N.lineNumber?(se=0,Se=N.column-y):(se=N.lineNumber-S,Se=N.column-1);let ke,Ee;if(se===g?(ke=0,Ee=f-Se):(ke=g-se,Ee=f),h!==null){let[He,Ve]=k(h,se,Se);o.push(new Xr(new z(l,c,u,p),He)),h=Ve,g=ke,f=Ee,l=u,c=p}else{let He,Ve;se===0?(He=l,Ve=c+Se):(He=l+se,Ve=Se+1),l=He,c=Ve,g=ke,f=Ee}S=N.lineNumber,y=N.column;break}h!==null&&o.push(new Xr(new z(l,c,u,p),h)),S=te,y=pe,v=!1}let V=null,U=null,G=null,$=null;for(;!(S===O.lineNumber&&y===O.column);){if(w(),b){let se,Se;S===O.lineNumber?(se=0,Se=O.column-y):(se=O.lineNumber-S,Se=O.column-1);let ke,Ee;se===0?(ke=l,Ee=c+Se):(ke=l+se,Ee=Se+1),V===null&&(V=l,U=c),G=ke,$=Ee,S=O.lineNumber,y=O.column,l=ke,c=Ee;break}let te,pe;g===0?(te=S,pe=y+f):(te=S+g,pe=f+1);let de=!1;if(O.lineNumber<te?de=!0:O.lineNumber===te&&(de=O.column<pe),de){let se,Se;S===O.lineNumber?(se=0,Se=O.column-y):(se=O.lineNumber-S,Se=O.column-1);let ke,Ee;if(se===g?(ke=0,Ee=f-Se):(ke=g-se,Ee=f),h!==null){V===null&&(V=l,U=c),G=u,$=p;let[,He]=k(h,se,Se);h=He,g=ke,f=Ee,l=u,c=p}else{let He,Ve;se===0?(He=l,Ve=c+Se):(He=l+se,Ve=Se+1),V===null&&(V=l,U=c),G=He,$=Ve,l=He,c=Ve,g=ke,f=Ee}S=O.lineNumber,y=O.column;break}V===null&&(V=l,U=c),G=u,$=p,S=te,y=pe,v=!1}if(V!==null)o.push(new Xr(new z(V,U,G,$),T.text));else{w();let te=l,pe=c;o.push(new Xr(new z(te,pe,te,pe),T.text))}}for(;w(),!b;)h!==null&&o.push(new Xr(new z(l,c,u,p),h)),v=!1;return new a(o).normalize()}toString(i){return i===void 0?this.replacements.map(e=>e.toString()).join(`
`):typeof i=="string"?this.toString(new _S(i)):this.replacements.length===0?"":this.replacements.map(e=>{let o=i.getValueOfRange(e.range),n=z.fromPositions(new Ie(Math.max(1,e.range.startLineNumber-1),1),e.range.getStartPosition()),r=i.getValueOfRange(n);r.length>10&&(r="..."+r.substring(r.length-10));let s=z.fromPositions(e.range.getEndPosition(),new Ie(e.range.endLineNumber+1,1)),l=i.getValueOfRange(s);l.length>10&&(l=l.substring(0,10)+"...");let c=o;if(c.length>10){let p=Math.floor(5);c=c.substring(0,p)+"..."+c.substring(c.length-p)}let u=e.text;if(u.length>10){let p=Math.floor(5);u=u.substring(0,p)+"..."+u.substring(u.length-p)}return c.length===0?`${r}\u2770${u}\u2771${l}`:`${r}\u2770${c}\u21A6${u}\u2771${l}`}).join(`
`)}},Xr=class a{constructor(i,e){this.range=i;this.text=e}static joinReplacements(i,e){if(i.length===0)throw new ni;if(i.length===1)return i[0];let t=i[0].range.getStartPosition(),o=i[i.length-1].range.getEndPosition(),n="";for(let r=0;r<i.length;r++){let s=i[r];if(n+=s.text,r<i.length-1){let l=i[r+1],c=z.fromPositions(s.range.getEndPosition(),l.range.getStartPosition()),u=e.getValueOfRange(c);n+=u}}return new a(z.fromPositions(t,o),n)}static fromStringReplacement(i,e){return new a(e.getTransformer().getRange(i.replaceRange),i.newText)}static delete(i){return new a(i,"")}get isEmpty(){return this.range.isEmpty()&&this.text.length===0}static equals(i,e){return i.range.equalsRange(e.range)&&i.text===e.text}toSingleEditOperation(){return{range:this.range,text:this.text}}toEdit(){return new bp([this])}equals(i){return a.equals(this,i)}extendToCoverRange(i,e){if(this.range.containsRange(i))return this;let t=this.range.plusRange(i),o=e.getValueOfRange(z.fromPositions(t.getStartPosition(),this.range.getStartPosition())),n=e.getValueOfRange(z.fromPositions(this.range.getEndPosition(),t.getEndPosition())),r=o+this.text+n;return new a(t,r)}extendToFullLine(i){let e=new z(this.range.startLineNumber,1,this.range.endLineNumber,i.getTransformer().getLineLength(this.range.endLineNumber)+1);return this.extendToCoverRange(e,i)}removeCommonPrefixAndSuffix(i){return this.removeCommonPrefix(i).removeCommonSuffix(i)}removeCommonPrefix(i){let e=i.getValueOfRange(this.range).replaceAll(`\r
`,`
`),t=this.text.replaceAll(`\r
`,`
`),o=Ng(e,t),n=Zl.ofText(e.substring(0,o)).addToPosition(this.range.getStartPosition()),r=t.substring(o),s=z.fromPositions(n,this.range.getEndPosition());return new a(s,r)}removeCommonSuffix(i){let e=i.getValueOfRange(this.range).replaceAll(`\r
`,`
`),t=this.text.replaceAll(`\r
`,`
`),o=zw(e,t),n=Zl.ofText(e.substring(0,e.length-o)).addToPosition(this.range.getStartPosition()),r=t.substring(0,t.length-o),s=z.fromPositions(this.range.getStartPosition(),n);return new a(s,r)}isEffectiveDeletion(i){let e=this.text.replaceAll(`\r
`,`
`),t=i.getValueOfRange(this.range).replaceAll(`\r
`,`
`),o=Ng(e,t);e=e.substring(o),t=t.substring(o);let n=zw(e,t);return e=e.substring(0,e.length-n),t=t.substring(0,t.length-n),e===""}toString(){let i=this.range.getStartPosition(),e=this.range.getEndPosition();return`(${i.lineNumber},${i.column} -> ${e.lineNumber},${e.column}): "${this.text}"`}};function Uht(a,i){if(a.lineNumber===i.lineNumber&&a.column===Number.MAX_SAFE_INTEGER)return z.fromPositions(i,i);if(!a.isBeforeOrEqual(i))throw new ni("start must be before end");return new z(a.lineNumber,a.column,i.lineNumber,i.column)}var NI=class a{static inverse(i,e,t){let o=[],n=1,r=1;for(let l of i){let c=new a(new ro(n,l.original.startLineNumber),new ro(r,l.modified.startLineNumber));c.modified.isEmpty||o.push(c),n=l.original.endLineNumberExclusive,r=l.modified.endLineNumberExclusive}let s=new a(new ro(n,e+1),new ro(r,t+1));return s.modified.isEmpty||o.push(s),o}static clip(i,e,t){let o=[];for(let n of i){let r=n.original.intersect(e),s=n.modified.intersect(t);r&&!r.isEmpty&&s&&!s.isEmpty&&o.push(new a(r,s))}return o}constructor(i,e){this.original=i,this.modified=e}toString(){return`{${this.original.toString()}->${this.modified.toString()}}`}flip(){return new a(this.modified,this.original)}join(i){return new a(this.original.join(i.original),this.modified.join(i.modified))}get changedLineCount(){return Math.max(this.original.length,this.modified.length)}toRangeMapping(){let i=this.original.toInclusiveRange(),e=this.modified.toInclusiveRange();if(i&&e)return new cg(i,e);if(this.original.startLineNumber===1||this.modified.startLineNumber===1){if(!(this.modified.startLineNumber===1&&this.original.startLineNumber===1))throw new ni("not a valid diff");return new cg(new z(this.original.startLineNumber,1,this.original.endLineNumberExclusive,1),new z(this.modified.startLineNumber,1,this.modified.endLineNumberExclusive,1))}else return new cg(new z(this.original.startLineNumber-1,Number.MAX_SAFE_INTEGER,this.original.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),new z(this.modified.startLineNumber-1,Number.MAX_SAFE_INTEGER,this.modified.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER))}toRangeMapping2(i,e){if(s2i(this.original.endLineNumberExclusive,i)&&s2i(this.modified.endLineNumberExclusive,e))return new cg(new z(this.original.startLineNumber,1,this.original.endLineNumberExclusive,1),new z(this.modified.startLineNumber,1,this.modified.endLineNumberExclusive,1));if(!this.original.isEmpty&&!this.modified.isEmpty)return new cg(z.fromPositions(new Ie(this.original.startLineNumber,1),MSe(new Ie(this.original.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),i)),z.fromPositions(new Ie(this.modified.startLineNumber,1),MSe(new Ie(this.modified.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),e)));if(this.original.startLineNumber>1&&this.modified.startLineNumber>1)return new cg(z.fromPositions(MSe(new Ie(this.original.startLineNumber-1,Number.MAX_SAFE_INTEGER),i),MSe(new Ie(this.original.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),i)),z.fromPositions(MSe(new Ie(this.modified.startLineNumber-1,Number.MAX_SAFE_INTEGER),e),MSe(new Ie(this.modified.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),e)));throw new ni}};function MSe(a,i){if(a.lineNumber<1)return new Ie(1,1);if(a.lineNumber>i.length)return new Ie(i.length,i[i.length-1].length+1);let e=i[a.lineNumber-1];return a.column>e.length+1?new Ie(a.lineNumber,e.length+1):a}function s2i(a,i){return a>=1&&a<=i.length}var wf=class a extends NI{static toTextEdit(i,e){let t=[];for(let o of i)for(let n of o.innerChanges??[]){let r=n.toTextEdit(e);t.push(r)}return new bp(t)}static fromRangeMappings(i){let e=ro.join(i.map(o=>ro.fromRangeInclusive(o.originalRange))),t=ro.join(i.map(o=>ro.fromRangeInclusive(o.modifiedRange)));return new a(e,t,i)}constructor(i,e,t){super(i,e),this.innerChanges=t}flip(){return new a(this.modified,this.original,this.innerChanges?.map(i=>i.flip()))}withInnerChangesFromLineRanges(){return new a(this.original,this.modified,[this.toRangeMapping()])}},cg=class a{static fromEdit(i){let e=i.getNewRanges();return i.replacements.map((o,n)=>new a(o.range,e[n]))}static fromEditJoin(i){let e=i.getNewRanges(),t=i.replacements.map((o,n)=>new a(o.range,e[n]));return a.join(t)}static join(i){if(i.length===0)throw new ni("Cannot join an empty list of range mappings");let e=i[0];for(let t=1;t<i.length;t++)e=e.join(i[t]);return e}static assertSorted(i){for(let e=1;e<i.length;e++){let t=i[e-1],o=i[e];if(!(t.originalRange.getEndPosition().isBeforeOrEqual(o.originalRange.getStartPosition())&&t.modifiedRange.getEndPosition().isBeforeOrEqual(o.modifiedRange.getStartPosition())))throw new ni("Range mappings must be sorted")}}constructor(i,e){this.originalRange=i,this.modifiedRange=e}toString(){return`{${this.originalRange.toString()}->${this.modifiedRange.toString()}}`}flip(){return new a(this.modifiedRange,this.originalRange)}toTextEdit(i){let e=i.getValueOfRange(this.modifiedRange);return new Xr(this.originalRange,e)}join(i){return new a(this.originalRange.plusRange(i.originalRange),this.modifiedRange.plusRange(i.modifiedRange))}};function PSe(a,i,e,t=!1){let o=[];for(let n of s6(a.map(r=>VMo(r,i,e)),(r,s)=>r.original.intersectsOrTouches(s.original)||r.modified.intersectsOrTouches(s.modified))){let r=n[0],s=n[n.length-1];o.push(new wf(r.original.join(s.original),r.modified.join(s.modified),n.map(l=>l.innerChanges[0])))}return eh(()=>!t&&o.length>0&&(o[0].modified.startLineNumber!==o[0].original.startLineNumber||e.length.lineCount-o[o.length-1].modified.endLineNumberExclusive!==i.length.lineCount-o[o.length-1].original.endLineNumberExclusive)?!1:Ty(o,(n,r)=>r.original.startLineNumber-n.original.endLineNumberExclusive===r.modified.startLineNumber-n.modified.endLineNumberExclusive&&n.original.endLineNumberExclusive<r.original.startLineNumber&&n.modified.endLineNumberExclusive<r.modified.startLineNumber)),o}function VMo(a,i,e){let t=0,o=0;a.modifiedRange.endColumn===1&&a.originalRange.endColumn===1&&a.originalRange.startLineNumber+t<=a.originalRange.endLineNumber&&a.modifiedRange.startLineNumber+t<=a.modifiedRange.endLineNumber&&(o=-1),a.modifiedRange.startColumn-1>=e.getLineLength(a.modifiedRange.startLineNumber)&&a.originalRange.startColumn-1>=i.getLineLength(a.originalRange.startLineNumber)&&a.originalRange.startLineNumber<=a.originalRange.endLineNumber+o&&a.modifiedRange.startLineNumber<=a.modifiedRange.endLineNumber+o&&(t=1);let n=new ro(a.originalRange.startLineNumber+t,a.originalRange.endLineNumber+1+o),r=new ro(a.modifiedRange.startLineNumber+t,a.modifiedRange.endLineNumber+1+o);return new wf(n,r,[a])}var BMo=3,zht=class{computeDiff(i,e,t){let n=new w$e(i,e,{maxComputationTime:t.maxComputationTimeMs,shouldIgnoreTrimWhitespace:t.ignoreTrimWhitespace,shouldComputeCharChanges:!0,shouldMakePrettyDiff:!0,shouldPostProcessCharChanges:!0}).computeDiff(),r=[],s=null;for(let l of n.changes){let c;l.originalEndLineNumber===0?c=new ro(l.originalStartLineNumber+1,l.originalStartLineNumber+1):c=new ro(l.originalStartLineNumber,l.originalEndLineNumber+1);let u;l.modifiedEndLineNumber===0?u=new ro(l.modifiedStartLineNumber+1,l.modifiedStartLineNumber+1):u=new ro(l.modifiedStartLineNumber,l.modifiedEndLineNumber+1);let p=new wf(c,u,l.charChanges?.map(h=>new cg(new z(h.originalStartLineNumber,h.originalStartColumn,h.originalEndLineNumber,h.originalEndColumn),new z(h.modifiedStartLineNumber,h.modifiedStartColumn,h.modifiedEndLineNumber,h.modifiedEndColumn))));s&&(s.modified.endLineNumberExclusive===p.modified.startLineNumber||s.original.endLineNumberExclusive===p.original.startLineNumber)&&(p=new wf(s.original.join(p.original),s.modified.join(p.modified),s.innerChanges&&p.innerChanges?s.innerChanges.concat(p.innerChanges):void 0),r.pop()),r.push(p),s=p}return eh(()=>Ty(r,(l,c)=>c.original.startLineNumber-l.original.endLineNumberExclusive===c.modified.startLineNumber-l.modified.endLineNumberExclusive&&l.original.endLineNumberExclusive<c.original.startLineNumber&&l.modified.endLineNumberExclusive<c.modified.startLineNumber)),new j6(r,[],n.quitEarly)}};function l2i(a,i,e,t){return new MM(a,i,e).ComputeDiff(t)}var Kht=class{constructor(i){let e=[],t=[];for(let o=0,n=i.length;o<n;o++)e[o]=gXt(i[o],1),t[o]=fXt(i[o],1);this.lines=i,this._startColumns=e,this._endColumns=t}getElements(){let i=[];for(let e=0,t=this.lines.length;e<t;e++)i[e]=this.lines[e].substring(this._startColumns[e]-1,this._endColumns[e]-1);return i}getStrictElement(i){return this.lines[i]}getStartLineNumber(i){return i+1}getEndLineNumber(i){return i+1}createCharSequence(i,e,t){let o=[],n=[],r=[],s=0;for(let l=e;l<=t;l++){let c=this.lines[l],u=i?this._startColumns[l]:1,p=i?this._endColumns[l]:c.length+1;for(let h=u;h<p;h++)o[s]=c.charCodeAt(h-1),n[s]=l+1,r[s]=h,s++;!i&&l<t&&(o[s]=10,n[s]=l+1,r[s]=c.length+1,s++)}return new hXt(o,n,r)}},hXt=class{constructor(i,e,t){this._charCodes=i,this._lineNumbers=e,this._columns=t}toString(){return"["+this._charCodes.map((i,e)=>(i===10?"\\n":String.fromCharCode(i))+`-(${this._lineNumbers[e]},${this._columns[e]})`).join(", ")+"]"}_assertIndex(i,e){if(i<0||i>=e.length)throw new Error("Illegal index")}getElements(){return this._charCodes}getStartLineNumber(i){return i>0&&i===this._lineNumbers.length?this.getEndLineNumber(i-1):(this._assertIndex(i,this._lineNumbers),this._lineNumbers[i])}getEndLineNumber(i){return i===-1?this.getStartLineNumber(i+1):(this._assertIndex(i,this._lineNumbers),this._charCodes[i]===10?this._lineNumbers[i]+1:this._lineNumbers[i])}getStartColumn(i){return i>0&&i===this._columns.length?this.getEndColumn(i-1):(this._assertIndex(i,this._columns),this._columns[i])}getEndColumn(i){return i===-1?this.getStartColumn(i+1):(this._assertIndex(i,this._columns),this._charCodes[i]===10?1:this._columns[i]+1)}},ASe=class a{constructor(i,e,t,o,n,r,s,l){this.originalStartLineNumber=i,this.originalStartColumn=e,this.originalEndLineNumber=t,this.originalEndColumn=o,this.modifiedStartLineNumber=n,this.modifiedStartColumn=r,this.modifiedEndLineNumber=s,this.modifiedEndColumn=l}static createFromDiffChange(i,e,t){let o=e.getStartLineNumber(i.originalStart),n=e.getStartColumn(i.originalStart),r=e.getEndLineNumber(i.originalStart+i.originalLength-1),s=e.getEndColumn(i.originalStart+i.originalLength-1),l=t.getStartLineNumber(i.modifiedStart),c=t.getStartColumn(i.modifiedStart),u=t.getEndLineNumber(i.modifiedStart+i.modifiedLength-1),p=t.getEndColumn(i.modifiedStart+i.modifiedLength-1);return new a(o,n,r,s,l,c,u,p)}};function HMo(a){if(a.length<=1)return a;let i=[a[0]],e=i[0];for(let t=1,o=a.length;t<o;t++){let n=a[t],r=n.originalStart-(e.originalStart+e.originalLength),s=n.modifiedStart-(e.modifiedStart+e.modifiedLength);Math.min(r,s)<BMo?(e.originalLength=n.originalStart+n.originalLength-e.originalStart,e.modifiedLength=n.modifiedStart+n.modifiedLength-e.modifiedStart):(i.push(n),e=n)}return i}var y$e=class a{constructor(i,e,t,o,n){this.originalStartLineNumber=i,this.originalEndLineNumber=e,this.modifiedStartLineNumber=t,this.modifiedEndLineNumber=o,this.charChanges=n}static createFromDiffResult(i,e,t,o,n,r,s){let l,c,u,p,h;if(e.originalLength===0?(l=t.getStartLineNumber(e.originalStart)-1,c=0):(l=t.getStartLineNumber(e.originalStart),c=t.getEndLineNumber(e.originalStart+e.originalLength-1)),e.modifiedLength===0?(u=o.getStartLineNumber(e.modifiedStart)-1,p=0):(u=o.getStartLineNumber(e.modifiedStart),p=o.getEndLineNumber(e.modifiedStart+e.modifiedLength-1)),r&&e.originalLength>0&&e.originalLength<20&&e.modifiedLength>0&&e.modifiedLength<20&&n()){let g=t.createCharSequence(i,e.originalStart,e.originalStart+e.originalLength-1),f=o.createCharSequence(i,e.modifiedStart,e.modifiedStart+e.modifiedLength-1);if(g.getElements().length>0&&f.getElements().length>0){let v=l2i(g,f,n,!0).changes;s&&(v=HMo(v)),h=[];for(let b=0,S=v.length;b<S;b++)h.push(ASe.createFromDiffChange(v[b],g,f))}}return new a(l,c,u,p,h)}},w$e=class{constructor(i,e,t){this.shouldComputeCharChanges=t.shouldComputeCharChanges,this.shouldPostProcessCharChanges=t.shouldPostProcessCharChanges,this.shouldIgnoreTrimWhitespace=t.shouldIgnoreTrimWhitespace,this.shouldMakePrettyDiff=t.shouldMakePrettyDiff,this.originalLines=i,this.modifiedLines=e,this.original=new Kht(i),this.modified=new Kht(e),this.continueLineDiff=a2i(t.maxComputationTime),this.continueCharDiff=a2i(t.maxComputationTime===0?0:Math.min(t.maxComputationTime,5e3))}computeDiff(){if(this.original.lines.length===1&&this.original.lines[0].length===0)return this.modified.lines.length===1&&this.modified.lines[0].length===0?{quitEarly:!1,changes:[]}:{quitEarly:!1,changes:[{originalStartLineNumber:1,originalEndLineNumber:1,modifiedStartLineNumber:1,modifiedEndLineNumber:this.modified.lines.length,charChanges:void 0}]};if(this.modified.lines.length===1&&this.modified.lines[0].length===0)return{quitEarly:!1,changes:[{originalStartLineNumber:1,originalEndLineNumber:this.original.lines.length,modifiedStartLineNumber:1,modifiedEndLineNumber:1,charChanges:void 0}]};let i=l2i(this.original,this.modified,this.continueLineDiff,this.shouldMakePrettyDiff),e=i.changes,t=i.quitEarly;if(this.shouldIgnoreTrimWhitespace){let s=[];for(let l=0,c=e.length;l<c;l++)s.push(y$e.createFromDiffResult(this.shouldIgnoreTrimWhitespace,e[l],this.original,this.modified,this.continueCharDiff,this.shouldComputeCharChanges,this.shouldPostProcessCharChanges));return{quitEarly:t,changes:s}}let o=[],n=0,r=0;for(let s=-1,l=e.length;s<l;s++){let c=s+1<l?e[s+1]:null,u=c?c.originalStart:this.originalLines.length,p=c?c.modifiedStart:this.modifiedLines.length;for(;n<u&&r<p;){let h=this.originalLines[n],g=this.modifiedLines[r];if(h!==g){{let f=gXt(h,1),v=gXt(g,1);for(;f>1&&v>1;){let b=h.charCodeAt(f-2),S=g.charCodeAt(v-2);if(b!==S)break;f--,v--}(f>1||v>1)&&this._pushTrimWhitespaceCharChange(o,n+1,1,f,r+1,1,v)}{let f=fXt(h,1),v=fXt(g,1),b=h.length+1,S=g.length+1;for(;f<b&&v<S;){let y=h.charCodeAt(f-1),w=h.charCodeAt(v-1);if(y!==w)break;f++,v++}(f<b||v<S)&&this._pushTrimWhitespaceCharChange(o,n+1,f,b,r+1,v,S)}}n++,r++}c&&(o.push(y$e.createFromDiffResult(this.shouldIgnoreTrimWhitespace,c,this.original,this.modified,this.continueCharDiff,this.shouldComputeCharChanges,this.shouldPostProcessCharChanges)),n+=c.originalLength,r+=c.modifiedLength)}return{quitEarly:t,changes:o}}_pushTrimWhitespaceCharChange(i,e,t,o,n,r,s){if(this._mergeTrimWhitespaceCharChange(i,e,t,o,n,r,s))return;let l;this.shouldComputeCharChanges&&(l=[new ASe(e,t,e,o,n,r,n,s)]),i.push(new y$e(e,e,n,n,l))}_mergeTrimWhitespaceCharChange(i,e,t,o,n,r,s){let l=i.length;if(l===0)return!1;let c=i[l-1];return c.originalEndLineNumber===0||c.modifiedEndLineNumber===0?!1:c.originalEndLineNumber===e&&c.modifiedEndLineNumber===n?(this.shouldComputeCharChanges&&c.charChanges&&c.charChanges.push(new ASe(e,t,e,o,n,r,n,s)),!0):c.originalEndLineNumber+1===e&&c.modifiedEndLineNumber+1===n?(c.originalEndLineNumber=e,c.modifiedEndLineNumber=n,this.shouldComputeCharChanges&&c.charChanges&&c.charChanges.push(new ASe(e,t,e,o,n,r,n,s)),!0):!1}};function gXt(a,i){let e=Ap(a);return e===-1?i:e+1}function fXt(a,i){let e=tv(a);return e===-1?i:e+2}function a2i(a){if(a===0)return()=>!0;let i=Date.now();return()=>Date.now()-i<a}var TU=class a{constructor(i,e){this.diffs=i;this.hitTimeout=e}static trivial(i,e){return new a([new dg(di.ofLength(i.length),di.ofLength(e.length))],!1)}static trivialTimedOut(i,e){return new a([new dg(di.ofLength(i.length),di.ofLength(e.length))],!0)}},dg=class a{constructor(i,e){this.seq1Range=i;this.seq2Range=e}static invert(i,e){let t=[];return Nut(i,(o,n)=>{t.push(a.fromOffsetPairs(o?o.getEndExclusives():EU.zero,n?n.getStarts():new EU(e,(o?o.seq2Range.endExclusive-o.seq1Range.endExclusive:0)+e)))}),t}static fromOffsetPairs(i,e){return new a(new di(i.offset1,e.offset1),new di(i.offset2,e.offset2))}static assertSorted(i){let e;for(let t of i){if(e&&!(e.seq1Range.endExclusive<=t.seq1Range.start&&e.seq2Range.endExclusive<=t.seq2Range.start))throw new ni("Sequence diffs must be sorted");e=t}}swap(){return new a(this.seq2Range,this.seq1Range)}toString(){return`${this.seq1Range} <-> ${this.seq2Range}`}join(i){return new a(this.seq1Range.join(i.seq1Range),this.seq2Range.join(i.seq2Range))}delta(i){return i===0?this:new a(this.seq1Range.delta(i),this.seq2Range.delta(i))}deltaStart(i){return i===0?this:new a(this.seq1Range.deltaStart(i),this.seq2Range.deltaStart(i))}deltaEnd(i){return i===0?this:new a(this.seq1Range.deltaEnd(i),this.seq2Range.deltaEnd(i))}intersectsOrTouches(i){return this.seq1Range.intersectsOrTouches(i.seq1Range)||this.seq2Range.intersectsOrTouches(i.seq2Range)}intersect(i){let e=this.seq1Range.intersect(i.seq1Range),t=this.seq2Range.intersect(i.seq2Range);if(!(!e||!t))return new a(e,t)}getStarts(){return new EU(this.seq1Range.start,this.seq2Range.start)}getEndExclusives(){return new EU(this.seq1Range.endExclusive,this.seq2Range.endExclusive)}},EU=class a{constructor(i,e){this.offset1=i;this.offset2=e}static{this.zero=new a(0,0)}static{this.max=new a(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER)}toString(){return`${this.offset1} <-> ${this.offset2}`}delta(i){return i===0?this:new a(this.offset1+i,this.offset2+i)}equals(i){return this.offset1===i.offset1&&this.offset2===i.offset2}},Y6=class a{static{this.instance=new a}isValid(){return!0}},Ght=class{constructor(i){this.timeout=i;this.startTime=Date.now();this.valid=!0;if(i<=0)throw new ni("timeout must be positive")}isValid(){return!(Date.now()-this.startTime<this.timeout)&&this.valid&&(this.valid=!1),this.valid}disable(){this.timeout=Number.MAX_SAFE_INTEGER,this.isValid=()=>!0,this.valid=!0}};var NSe=class{constructor(i,e){this.width=i;this.height=e;this.array=[];this.array=new Array(i*e)}get(i,e){return this.array[i+e*this.width]}set(i,e,t){this.array[i+e*this.width]=t}};function x$e(a){return a===32||a===9}var C$e=class a{constructor(i,e,t){this.range=i;this.lines=e;this.source=t;this.histogram=[];let o=0;for(let n=i.startLineNumber-1;n<i.endLineNumberExclusive-1;n++){let r=e[n];for(let l=0;l<r.length;l++){o++;let c=r[l],u=a.getKey(c);this.histogram[u]=(this.histogram[u]||0)+1}o++;let s=a.getKey(`
`);this.histogram[s]=(this.histogram[s]||0)+1}this.totalCount=o}static{this.chrKeys=new Map}static getKey(i){let e=this.chrKeys.get(i);return e===void 0&&(e=this.chrKeys.size,this.chrKeys.set(i,e)),e}computeSimilarity(i){let e=0,t=Math.max(this.histogram.length,i.histogram.length);for(let o=0;o<t;o++)e+=Math.abs((this.histogram[o]??0)-(i.histogram[o]??0));return 1-e/(this.totalCount+i.totalCount)}};var $ht=class{compute(i,e,t=Y6.instance,o){if(i.length===0||e.length===0)return TU.trivial(i,e);let n=new NSe(i.length,e.length),r=new NSe(i.length,e.length),s=new NSe(i.length,e.length);for(let f=0;f<i.length;f++)for(let v=0;v<e.length;v++){if(!t.isValid())return TU.trivialTimedOut(i,e);let b=f===0?0:n.get(f-1,v),S=v===0?0:n.get(f,v-1),y;i.getElement(f)===e.getElement(v)?(f===0||v===0?y=0:y=n.get(f-1,v-1),f>0&&v>0&&r.get(f-1,v-1)===3&&(y+=s.get(f-1,v-1)),y+=o?o(f,v):1):y=-1;let w=Math.max(b,S,y);if(w===y){let k=f>0&&v>0?s.get(f-1,v-1):0;s.set(f,v,k+1),r.set(f,v,3)}else w===b?(s.set(f,v,0),r.set(f,v,1)):w===S&&(s.set(f,v,0),r.set(f,v,2));n.set(f,v,w)}let l=[],c=i.length,u=e.length;function p(f,v){(f+1!==c||v+1!==u)&&l.push(new dg(new di(f+1,c),new di(v+1,u))),c=f,u=v}let h=i.length-1,g=e.length-1;for(;h>=0&&g>=0;)r.get(h,g)===3?(p(h,g),h--,g--):r.get(h,g)===1?h--:g--;return p(-1,-1),l.reverse(),new TU(l,!1)}};var OSe=class{compute(i,e,t=Y6.instance){if(i.length===0||e.length===0)return TU.trivial(i,e);let o=i,n=e;function r(v,b){for(;v<o.length&&b<n.length&&o.getElement(v)===n.getElement(b);)v++,b++;return v}let s=0,l=new vXt;l.set(0,r(0,0));let c=new bXt;c.set(0,l.get(0)===0?null:new qht(null,0,0,l.get(0)));let u=0;e:for(;;){if(s++,!t.isValid())return TU.trivialTimedOut(o,n);let v=-Math.min(s,n.length+s%2),b=Math.min(s,o.length+s%2);for(u=v;u<=b;u+=2){let S=0,y=u===b?-1:l.get(u+1),w=u===v?-1:l.get(u-1)+1;S++;let k=Math.min(Math.max(y,w),o.length),T=k-u;if(S++,k>o.length||T>n.length)continue;let N=r(k,T);l.set(u,N);let O=k===y?c.get(u+1):c.get(u-1);if(c.set(u,N!==k?new qht(O,k,T,N-k):O),l.get(u)===o.length&&l.get(u)-u===n.length)break e}}let p=c.get(u),h=[],g=o.length,f=n.length;for(;;){let v=p?p.x+p.length:0,b=p?p.y+p.length:0;if((v!==g||b!==f)&&h.push(new dg(new di(v,g),new di(b,f))),!p)break;g=p.x,f=p.y,p=p.prev}return h.reverse(),new TU(h,!1)}},qht=class{constructor(i,e,t,o){this.prev=i;this.x=e;this.y=t;this.length=o}},vXt=class{constructor(){this.positiveArr=new Int32Array(10);this.negativeArr=new Int32Array(10)}get(i){return i<0?(i=-i-1,this.negativeArr[i]):this.positiveArr[i]}set(i,e){if(i<0){if(i=-i-1,i>=this.negativeArr.length){let t=this.negativeArr;this.negativeArr=new Int32Array(t.length*2),this.negativeArr.set(t)}this.negativeArr[i]=e}else{if(i>=this.positiveArr.length){let t=this.positiveArr;this.positiveArr=new Int32Array(t.length*2),this.positiveArr.set(t)}this.positiveArr[i]=e}}},bXt=class{constructor(){this.positiveArr=[];this.negativeArr=[]}get(i){return i<0?(i=-i-1,this.negativeArr[i]):this.positiveArr[i]}set(i,e){i<0?(i=-i-1,this.negativeArr[i]=e):this.positiveArr[i]=e}};var X6=class{constructor(i,e,t){this.lines=i;this.range=e;this.considerWhitespaceChanges=t;this.elements=[];this.firstElementOffsetByLineIdx=[];this.lineStartOffsets=[];this.trimmedWsLengthsByLineIdx=[];this.firstElementOffsetByLineIdx.push(0);for(let o=this.range.startLineNumber;o<=this.range.endLineNumber;o++){let n=i[o-1],r=0;o===this.range.startLineNumber&&this.range.startColumn>1&&(r=this.range.startColumn-1,n=n.substring(r)),this.lineStartOffsets.push(r);let s=0;if(!t){let c=n.trimStart();s=n.length-c.length,n=c.trimEnd()}this.trimmedWsLengthsByLineIdx.push(s);let l=o===this.range.endLineNumber?Math.min(this.range.endColumn-1-r-s,n.length):n.length;for(let c=0;c<l;c++)this.elements.push(n.charCodeAt(c));o<this.range.endLineNumber&&(this.elements.push(10),this.firstElementOffsetByLineIdx.push(this.elements.length))}}toString(){return`Slice: "${this.text}"`}get text(){return this.getText(new di(0,this.length))}getText(i){return this.elements.slice(i.start,i.endExclusive).map(e=>String.fromCharCode(e)).join("")}getElement(i){return this.elements[i]}get length(){return this.elements.length}getBoundaryScore(i){let e=u2i(i>0?this.elements[i-1]:-1),t=u2i(i<this.elements.length?this.elements[i]:-1);if(e===7&&t===8)return 0;if(e===8)return 150;let o=0;return e!==t&&(o+=10,e===0&&t===1&&(o+=1)),o+=d2i(e),o+=d2i(t),o}translateOffset(i,e="right"){let t=XG(this.firstElementOffsetByLineIdx,n=>n<=i),o=i-this.firstElementOffsetByLineIdx[t];return new Ie(this.range.startLineNumber+t,1+this.lineStartOffsets[t]+o+(o===0&&e==="left"?0:this.trimmedWsLengthsByLineIdx[t]))}translateRange(i){let e=this.translateOffset(i.start,"right"),t=this.translateOffset(i.endExclusive,"left");return t.isBefore(e)?z.fromPositions(t,t):z.fromPositions(e,t)}findWordContaining(i){if(i<0||i>=this.elements.length||!FSe(this.elements[i]))return;let e=i;for(;e>0&&FSe(this.elements[e-1]);)e--;let t=i;for(;t<this.elements.length&&FSe(this.elements[t]);)t++;return new di(e,t)}findSubWordContaining(i){if(i<0||i>=this.elements.length||!FSe(this.elements[i]))return;let e=i;for(;e>0&&FSe(this.elements[e-1])&&!c2i(this.elements[e]);)e--;let t=i;for(;t<this.elements.length&&FSe(this.elements[t])&&!c2i(this.elements[t]);)t++;return new di(e,t)}countLinesIn(i){return this.translateOffset(i.endExclusive).lineNumber-this.translateOffset(i.start).lineNumber}isStronglyEqual(i,e){return this.elements[i]===this.elements[e]}extendToFullLines(i){let e=YG(this.firstElementOffsetByLineIdx,o=>o<=i.start)??0,t=oUi(this.firstElementOffsetByLineIdx,o=>i.endExclusive<=o)??this.elements.length;return new di(e,t)}};function FSe(a){return a>=97&&a<=122||a>=65&&a<=90||a>=48&&a<=57}function c2i(a){return a>=65&&a<=90}var UMo={0:0,1:0,2:0,3:10,4:2,5:30,6:3,7:10,8:10};function d2i(a){return UMo[a]}function u2i(a){return a===10?8:a===13?7:x$e(a)?6:a>=97&&a<=122?0:a>=65&&a<=90?1:a>=48&&a<=57?2:a===-1?3:a===44||a===59?5:4}function m2i(a,i,e,t,o,n){let{moves:r,excludedChanges:s}=KMo(a,i,e,n);if(!n.isValid())return[];let l=a.filter(u=>!s.has(u)),c=GMo(l,t,o,i,e,n);return e$(r,c),r=$Mo(r),r=r.filter(u=>{let p=u.original.toOffsetRange().slice(i).map(g=>g.trim());return p.join(`
`).length>=15&&zMo(p,g=>g.length>=2)>=2}),r=qMo(a,r),r}function zMo(a,i){let e=0;for(let t of a)i(t)&&e++;return e}function KMo(a,i,e,t){let o=[],n=a.filter(l=>l.modified.isEmpty&&l.original.length>=3).map(l=>new C$e(l.original,i,l)),r=new Set(a.filter(l=>l.original.isEmpty&&l.modified.length>=3).map(l=>new C$e(l.modified,e,l))),s=new Set;for(let l of n){let c=-1,u;for(let p of r){let h=l.computeSimilarity(p);h>c&&(c=h,u=p)}if(c>.9&&u&&(r.delete(u),o.push(new NI(l.range,u.range)),s.add(l.source),s.add(u.source)),!t.isValid())return{moves:o,excludedChanges:s}}return{moves:o,excludedChanges:s}}function GMo(a,i,e,t,o,n){let r=[],s=new KH;for(let h of a)for(let g=h.original.startLineNumber;g<h.original.endLineNumberExclusive-2;g++){let f=`${i[g-1]}:${i[g+1-1]}:${i[g+2-1]}`;s.add(f,{range:new ro(g,g+3)})}let l=[];a.sort(tl(h=>h.modified.startLineNumber,qd));for(let h of a){let g=[];for(let f=h.modified.startLineNumber;f<h.modified.endLineNumberExclusive-2;f++){let v=`${e[f-1]}:${e[f+1-1]}:${e[f+2-1]}`,b=new ro(f,f+3),S=[];s.forEach(v,({range:y})=>{for(let k of g)if(k.originalLineRange.endLineNumberExclusive+1===y.endLineNumberExclusive&&k.modifiedLineRange.endLineNumberExclusive+1===b.endLineNumberExclusive){k.originalLineRange=new ro(k.originalLineRange.startLineNumber,y.endLineNumberExclusive),k.modifiedLineRange=new ro(k.modifiedLineRange.startLineNumber,b.endLineNumberExclusive),S.push(k);return}let w={modifiedLineRange:b,originalLineRange:y};l.push(w),S.push(w)}),g=S}if(!n.isValid())return[]}l.sort(pre(tl(h=>h.modifiedLineRange.length,qd)));let c=new PM,u=new PM;for(let h of l){let g=h.modifiedLineRange.startLineNumber-h.originalLineRange.startLineNumber,f=c.subtractFrom(h.modifiedLineRange),v=u.subtractFrom(h.originalLineRange).getWithDelta(g),b=f.getIntersection(v);for(let S of b.ranges){if(S.length<3)continue;let y=S,w=S.delta(-g);r.push(new NI(w,y)),c.addRange(y),u.addRange(w)}}r.sort(tl(h=>h.original.startLineNumber,qd));let p=new J2e(a);for(let h=0;h<r.length;h++){let g=r[h],f=p.findLastMonotonous(N=>N.original.startLineNumber<=g.original.startLineNumber),v=YG(a,N=>N.modified.startLineNumber<=g.modified.startLineNumber),b=Math.max(g.original.startLineNumber-f.original.startLineNumber,g.modified.startLineNumber-v.modified.startLineNumber),S=p.findLastMonotonous(N=>N.original.startLineNumber<g.original.endLineNumberExclusive),y=YG(a,N=>N.modified.startLineNumber<g.modified.endLineNumberExclusive),w=Math.max(S.original.endLineNumberExclusive-g.original.endLineNumberExclusive,y.modified.endLineNumberExclusive-g.modified.endLineNumberExclusive),k;for(k=0;k<b;k++){let N=g.original.startLineNumber-k-1,O=g.modified.startLineNumber-k-1;if(N>t.length||O>o.length||c.contains(O)||u.contains(N)||!p2i(t[N-1],o[O-1],n))break}k>0&&(u.addRange(new ro(g.original.startLineNumber-k,g.original.startLineNumber)),c.addRange(new ro(g.modified.startLineNumber-k,g.modified.startLineNumber)));let T;for(T=0;T<w;T++){let N=g.original.endLineNumberExclusive+T,O=g.modified.endLineNumberExclusive+T;if(N>t.length||O>o.length||c.contains(O)||u.contains(N)||!p2i(t[N-1],o[O-1],n))break}T>0&&(u.addRange(new ro(g.original.endLineNumberExclusive,g.original.endLineNumberExclusive+T)),c.addRange(new ro(g.modified.endLineNumberExclusive,g.modified.endLineNumberExclusive+T))),(k>0||T>0)&&(r[h]=new NI(new ro(g.original.startLineNumber-k,g.original.endLineNumberExclusive+T),new ro(g.modified.startLineNumber-k,g.modified.endLineNumberExclusive+T)))}return r}function p2i(a,i,e){if(a.trim()===i.trim())return!0;if(a.length>300&&i.length>300)return!1;let o=new OSe().compute(new X6([a],new z(1,1,1,a.length),!1),new X6([i],new z(1,1,1,i.length),!1),e),n=0,r=dg.invert(o.diffs,a.length);for(let u of r)u.seq1Range.forEach(p=>{x$e(a.charCodeAt(p))||n++});function s(u){let p=0;for(let h=0;h<a.length;h++)x$e(u.charCodeAt(h))||p++;return p}let l=s(a.length>i.length?a:i);return n/l>.6&&l>10}function $Mo(a){if(a.length===0)return a;a.sort(tl(e=>e.original.startLineNumber,qd));let i=[a[0]];for(let e=1;e<a.length;e++){let t=i[i.length-1],o=a[e],n=o.original.startLineNumber-t.original.endLineNumberExclusive,r=o.modified.startLineNumber-t.modified.endLineNumberExclusive;if(n>=0&&r>=0&&n+r<=2){i[i.length-1]=t.join(o);continue}i.push(o)}return i}function qMo(a,i){let e=new J2e(a);return i=i.filter(t=>{let o=e.findLastMonotonous(s=>s.original.startLineNumber<t.original.endLineNumberExclusive)||new NI(new ro(1,1),new ro(1,1)),n=YG(a,s=>s.modified.startLineNumber<t.modified.endLineNumberExclusive);return o!==n}),i}function k$e(a,i,e){let t=e;return t=h2i(a,i,t),t=h2i(a,i,t),t=jMo(a,i,t),t}function h2i(a,i,e){if(e.length===0)return e;let t=[];t.push(e[0]);for(let n=1;n<e.length;n++){let r=t[t.length-1],s=e[n];if(s.seq1Range.isEmpty||s.seq2Range.isEmpty){let l=s.seq1Range.start-r.seq1Range.endExclusive,c;for(c=1;c<=l&&!(a.getElement(s.seq1Range.start-c)!==a.getElement(s.seq1Range.endExclusive-c)||i.getElement(s.seq2Range.start-c)!==i.getElement(s.seq2Range.endExclusive-c));c++);if(c--,c===l){t[t.length-1]=new dg(new di(r.seq1Range.start,s.seq1Range.endExclusive-l),new di(r.seq2Range.start,s.seq2Range.endExclusive-l));continue}s=s.delta(-c)}t.push(s)}let o=[];for(let n=0;n<t.length-1;n++){let r=t[n+1],s=t[n];if(s.seq1Range.isEmpty||s.seq2Range.isEmpty){let l=r.seq1Range.start-s.seq1Range.endExclusive,c;for(c=0;c<l&&!(!a.isStronglyEqual(s.seq1Range.start+c,s.seq1Range.endExclusive+c)||!i.isStronglyEqual(s.seq2Range.start+c,s.seq2Range.endExclusive+c));c++);if(c===l){t[n+1]=new dg(new di(s.seq1Range.start+l,r.seq1Range.endExclusive),new di(s.seq2Range.start+l,r.seq2Range.endExclusive));continue}c>0&&(s=s.delta(c))}o.push(s)}return t.length>0&&o.push(t[t.length-1]),o}function jMo(a,i,e){if(!a.getBoundaryScore||!i.getBoundaryScore)return e;for(let t=0;t<e.length;t++){let o=t>0?e[t-1]:void 0,n=e[t],r=t+1<e.length?e[t+1]:void 0,s=new di(o?o.seq1Range.endExclusive+1:0,r?r.seq1Range.start-1:a.length),l=new di(o?o.seq2Range.endExclusive+1:0,r?r.seq2Range.start-1:i.length);n.seq1Range.isEmpty?e[t]=g2i(n,a,i,s,l):n.seq2Range.isEmpty&&(e[t]=g2i(n.swap(),i,a,l,s).swap())}return e}function g2i(a,i,e,t,o){let r=1;for(;a.seq1Range.start-r>=t.start&&a.seq2Range.start-r>=o.start&&e.isStronglyEqual(a.seq2Range.start-r,a.seq2Range.endExclusive-r)&&r<100;)r++;r--;let s=0;for(;a.seq1Range.start+s<t.endExclusive&&a.seq2Range.endExclusive+s<o.endExclusive&&e.isStronglyEqual(a.seq2Range.start+s,a.seq2Range.endExclusive+s)&&s<100;)s++;if(r===0&&s===0)return a;let l=0,c=-1;for(let u=-r;u<=s;u++){let p=a.seq2Range.start+u,h=a.seq2Range.endExclusive+u,g=a.seq1Range.start+u,f=i.getBoundaryScore(g)+e.getBoundaryScore(p)+e.getBoundaryScore(h);f>c&&(c=f,l=u)}return a.delta(l)}function f2i(a,i,e){let t=[];for(let o of e){let n=t[t.length-1];if(!n){t.push(o);continue}o.seq1Range.start-n.seq1Range.endExclusive<=2||o.seq2Range.start-n.seq2Range.endExclusive<=2?t[t.length-1]=new dg(n.seq1Range.join(o.seq1Range),n.seq2Range.join(o.seq2Range)):t.push(o)}return t}function SXt(a,i,e,t,o=!1){let n=dg.invert(e,a.length),r=[],s=new EU(0,0);function l(u,p){if(u.offset1<s.offset1||u.offset2<s.offset2)return;let h=t(a,u.offset1),g=t(i,u.offset2);if(!h||!g)return;let f=new dg(h,g),v=f.intersect(p),b=v.seq1Range.length,S=v.seq2Range.length;for(;n.length>0;){let y=n[0];if(!(y.seq1Range.intersects(f.seq1Range)||y.seq2Range.intersects(f.seq2Range)))break;let k=t(a,y.seq1Range.start),T=t(i,y.seq2Range.start),N=new dg(k,T),O=N.intersect(y);if(b+=O.seq1Range.length,S+=O.seq2Range.length,f=f.join(N),f.seq1Range.endExclusive>=y.seq1Range.endExclusive)n.shift();else break}(o&&b+S<f.seq1Range.length+f.seq2Range.length||b+S<(f.seq1Range.length+f.seq2Range.length)*2/3)&&r.push(f),s=f.getEndExclusives()}for(;n.length>0;){let u=n.shift();u.seq1Range.isEmpty||(l(u.getStarts(),u),l(u.getEndExclusives().delta(-1),u))}return QMo(e,r)}function QMo(a,i){let e=[];for(;a.length>0||i.length>0;){let t=a[0],o=i[0],n;t&&(!o||t.seq1Range.start<o.seq1Range.start)?n=a.shift():n=i.shift(),e.length>0&&e[e.length-1].seq1Range.endExclusive>=n.seq1Range.start?e[e.length-1]=e[e.length-1].join(n):e.push(n)}return e}function v2i(a,i,e){let t=e;if(t.length===0)return t;let o=0,n;do{n=!1;let r=[t[0]];for(let s=1;s<t.length;s++){let u=function(h,g){let f=new di(c.seq1Range.endExclusive,l.seq1Range.start);return a.getText(f).replace(/\s/g,"").length<=4&&(h.seq1Range.length+h.seq2Range.length>5||g.seq1Range.length+g.seq2Range.length>5)},l=t[s],c=r[r.length-1];u(c,l)?(n=!0,r[r.length-1]=r[r.length-1].join(l)):r.push(l)}t=r}while(o++<10&&n);return t}function b2i(a,i,e){let t=e;if(t.length===0)return t;let o=0,n;do{n=!1;let s=[t[0]];for(let l=1;l<t.length;l++){let p=function(g,f){let v=new di(u.seq1Range.endExclusive,c.seq1Range.start);if(a.countLinesIn(v)>5||v.length>500)return!1;let S=a.getText(v).trim();if(S.length>20||S.split(/\r\n|\r|\n/).length>1)return!1;let y=a.countLinesIn(g.seq1Range),w=g.seq1Range.length,k=i.countLinesIn(g.seq2Range),T=g.seq2Range.length,N=a.countLinesIn(f.seq1Range),O=f.seq1Range.length,V=i.countLinesIn(f.seq2Range),U=f.seq2Range.length,G=130;function $(te){return Math.min(te,G)}return Math.pow(Math.pow($(y*40+w),1.5)+Math.pow($(k*40+T),1.5),1.5)+Math.pow(Math.pow($(N*40+O),1.5)+Math.pow($(V*40+U),1.5),1.5)>(G**1.5)**1.5*1.3},c=t[l],u=s[s.length-1];p(u,c)?(n=!0,s[s.length-1]=s[s.length-1].join(c)):s.push(c)}t=s}while(o++<10&&n);let r=[];return sUi(t,(s,l,c)=>{let u=l;function p(S){return S.length>0&&S.trim().length<=3&&l.seq1Range.length+l.seq2Range.length>100}let h=a.extendToFullLines(l.seq1Range),g=a.getText(new di(h.start,l.seq1Range.start));p(g)&&(u=u.deltaStart(-g.length));let f=a.getText(new di(l.seq1Range.endExclusive,h.endExclusive));p(f)&&(u=u.deltaEnd(f.length));let v=dg.fromOffsetPairs(s?s.getEndExclusives():EU.zero,c?c.getStarts():EU.max),b=u.intersect(v);r.length>0&&b.getStarts().equals(r[r.length-1].getEndExclusives())?r[r.length-1]=r[r.length-1].join(b):r.push(b)}),r}var E$e=class{constructor(i,e){this.trimmedHash=i;this.lines=e}getElement(i){return this.trimmedHash[i]}get length(){return this.trimmedHash.length}getBoundaryScore(i){let e=i===0?0:S2i(this.lines[i-1]),t=i===this.lines.length?0:S2i(this.lines[i]);return 1e3-(e+t)}getText(i){return this.lines.slice(i.start,i.endExclusive).join(`
`)}isStronglyEqual(i,e){return this.lines[i]===this.lines[e]}};function S2i(a){let i=0;for(;i<a.length&&(a.charCodeAt(i)===32||a.charCodeAt(i)===9);)i++;return i}var WSe=class{constructor(){this.dynamicProgrammingDiffing=new $ht;this.myersDiffingAlgorithm=new OSe}computeDiff(i,e,t){if(i.length<=1&&$i(i,e,(O,V)=>O===V))return new j6([],[],!1);if(i.length===1&&i[0].length===0||e.length===1&&e[0].length===0)return new j6([new wf(new ro(1,i.length+1),new ro(1,e.length+1),[new cg(new z(1,1,i.length,i[i.length-1].length+1),new z(1,1,e.length,e[e.length-1].length+1))])],[],!1);let o=t.maxComputationTimeMs===0?Y6.instance:new Ght(t.maxComputationTimeMs),n=!t.ignoreTrimWhitespace,r=new Map;function s(O){let V=r.get(O);return V===void 0&&(V=r.size,r.set(O,V)),V}let l=i.map(O=>s(O.trim())),c=e.map(O=>s(O.trim())),u=new E$e(l,i),p=new E$e(c,e),h=u.length+p.length<1700?this.dynamicProgrammingDiffing.compute(u,p,o,(O,V)=>i[O]===e[V]?e[V].length===0?.1:1+Math.log(1+e[V].length):.99):this.myersDiffingAlgorithm.compute(u,p,o),g=h.diffs,f=h.hitTimeout;g=k$e(u,p,g),g=v2i(u,p,g);let v=[],b=O=>{if(n)for(let V=0;V<O;V++){let U=S+V,G=y+V;if(i[U]!==e[G]){let $=this.refineDiff(i,e,new dg(new di(U,U+1),new di(G,G+1)),o,n,t);for(let te of $.mappings)v.push(te);$.hitTimeout&&(f=!0)}}},S=0,y=0;for(let O of g){eh(()=>O.seq1Range.start-S===O.seq2Range.start-y);let V=O.seq1Range.start-S;b(V),S=O.seq1Range.endExclusive,y=O.seq2Range.endExclusive;let U=this.refineDiff(i,e,O,o,n,t);U.hitTimeout&&(f=!0);for(let G of U.mappings)v.push(G)}b(i.length-S);let w=new yse(i),k=new yse(e),T=PSe(v,w,k),N=[];return t.computeMoves&&(N=this.computeMoves(T,i,e,l,c,o,n,t)),eh(()=>{function O(U,G){if(U.lineNumber<1||U.lineNumber>G.length)return!1;let $=G[U.lineNumber-1];return!(U.column<1||U.column>$.length+1)}function V(U,G){return!(U.startLineNumber<1||U.startLineNumber>G.length+1||U.endLineNumberExclusive<1||U.endLineNumberExclusive>G.length+1)}for(let U of T){if(!U.innerChanges)return!1;for(let G of U.innerChanges)if(!(O(G.modifiedRange.getStartPosition(),e)&&O(G.modifiedRange.getEndPosition(),e)&&O(G.originalRange.getStartPosition(),i)&&O(G.originalRange.getEndPosition(),i)))return!1;if(!V(U.modified,e)||!V(U.original,i))return!1}return!0}),new j6(T,N,f)}computeMoves(i,e,t,o,n,r,s,l){return m2i(i,e,t,o,n,r).map(p=>{let h=this.refineDiff(e,t,new dg(p.original.toOffsetRange(),p.modified.toOffsetRange()),r,s,l),g=PSe(h.mappings,new yse(e),new yse(t),!0);return new LSe(p,g)})}refineDiff(i,e,t,o,n,r){let l=YMo(t).toRangeMapping2(i,e),c=new X6(i,l.originalRange,n),u=new X6(e,l.modifiedRange,n),p=c.length+u.length<500?this.dynamicProgrammingDiffing.compute(c,u,o):this.myersDiffingAlgorithm.compute(c,u,o),h=!1,g=p.diffs;h&&dg.assertSorted(g),g=k$e(c,u,g),h&&dg.assertSorted(g),g=SXt(c,u,g,(v,b)=>v.findWordContaining(b)),h&&dg.assertSorted(g),r.extendToSubwords&&(g=SXt(c,u,g,(v,b)=>v.findSubWordContaining(b),!0),h&&dg.assertSorted(g)),g=f2i(c,u,g),h&&dg.assertSorted(g),g=b2i(c,u,g),h&&dg.assertSorted(g);let f=g.map(v=>new cg(c.translateRange(v.seq1Range),u.translateRange(v.seq2Range)));return h&&cg.assertSorted(f),{mappings:f,hitTimeout:p.hitTimeout}}};function YMo(a){return new NI(new ro(a.seq1Range.start+1,a.seq1Range.endExclusive+1),new ro(a.seq2Range.start+1,a.seq2Range.endExclusive+1))}var _U={getLegacy:()=>new zht,getDefault:()=>new WSe};function J6(a,i){let e=Math.pow(10,i);return Math.round(a*e)/e}var Bt=class{constructor(i,e,t,o=1){this._rgbaBrand=void 0;this.r=Math.min(255,Math.max(0,i))|0,this.g=Math.min(255,Math.max(0,e))|0,this.b=Math.min(255,Math.max(0,t))|0,this.a=J6(Math.max(Math.min(1,o),0),3)}static equals(i,e){return i.r===e.r&&i.g===e.g&&i.b===e.b&&i.a===e.a}},DU=class a{constructor(i,e,t,o){this._hslaBrand=void 0;this.h=Math.max(Math.min(360,i),0)|0,this.s=J6(Math.max(Math.min(1,e),0),3),this.l=J6(Math.max(Math.min(1,t),0),3),this.a=J6(Math.max(Math.min(1,o),0),3)}static equals(i,e){return i.h===e.h&&i.s===e.s&&i.l===e.l&&i.a===e.a}static fromRGBA(i){let e=i.r/255,t=i.g/255,o=i.b/255,n=i.a,r=Math.max(e,t,o),s=Math.min(e,t,o),l=0,c=0,u=(s+r)/2,p=r-s;if(p>0){switch(c=Math.min(u<=.5?p/(2*u):p/(2-2*u),1),r){case e:l=(t-o)/p+(t<o?6:0);break;case t:l=(o-e)/p+2;break;case o:l=(e-t)/p+4;break}l*=60,l=Math.round(l)}return new a(l,c,u,n)}static _hue2rgb(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*(2/3-t)*6:i}static toRGBA(i){let e=i.h/360,{s:t,l:o,a:n}=i,r,s,l;if(t===0)r=s=l=o;else{let c=o<.5?o*(1+t):o+t-o*t,u=2*o-c;r=a._hue2rgb(u,c,e+1/3),s=a._hue2rgb(u,c,e),l=a._hue2rgb(u,c,e-1/3)}return new Bt(Math.round(r*255),Math.round(s*255),Math.round(l*255),n)}},kN=class a{constructor(i,e,t,o){this._hsvaBrand=void 0;this.h=Math.max(Math.min(360,i),0)|0,this.s=J6(Math.max(Math.min(1,e),0),3),this.v=J6(Math.max(Math.min(1,t),0),3),this.a=J6(Math.max(Math.min(1,o),0),3)}static equals(i,e){return i.h===e.h&&i.s===e.s&&i.v===e.v&&i.a===e.a}static fromRGBA(i){let e=i.r/255,t=i.g/255,o=i.b/255,n=Math.max(e,t,o),r=Math.min(e,t,o),s=n-r,l=n===0?0:s/n,c;return s===0?c=0:n===e?c=((t-o)/s%6+6)%6:n===t?c=(o-e)/s+2:c=(e-t)/s+4,new a(Math.round(c*60),l,n,i.a)}static toRGBA(i){let{h:e,s:t,v:o,a:n}=i,r=o*t,s=r*(1-Math.abs(e/60%2-1)),l=o-r,[c,u,p]=[0,0,0];return e<60?(c=r,u=s):e<120?(c=s,u=r):e<180?(u=r,p=s):e<240?(u=s,p=r):e<300?(c=s,p=r):e<=360&&(c=r,p=s),c=Math.round((c+l)*255),u=Math.round((u+l)*255),p=Math.round((p+l)*255),new Bt(c,u,p,n)}},Oe=class a{static fromHex(i){return a.Format.CSS.parseHex(i)||a.red}static equals(i,e){return!i&&!e?!0:!i||!e?!1:i.equals(e)}get hsla(){return this._hsla?this._hsla:DU.fromRGBA(this.rgba)}get hsva(){return this._hsva?this._hsva:kN.fromRGBA(this.rgba)}constructor(i){if(i)if(i instanceof Bt)this.rgba=i;else if(i instanceof DU)this._hsla=i,this.rgba=DU.toRGBA(i);else if(i instanceof kN)this._hsva=i,this.rgba=kN.toRGBA(i);else throw new Error("Invalid color ctor argument");else throw new Error("Color needs a value")}equals(i){return!!i&&Bt.equals(this.rgba,i.rgba)&&DU.equals(this.hsla,i.hsla)&&kN.equals(this.hsva,i.hsva)}getRelativeLuminance(){let i=a._relativeLuminanceForComponent(this.rgba.r),e=a._relativeLuminanceForComponent(this.rgba.g),t=a._relativeLuminanceForComponent(this.rgba.b),o=.2126*i+.7152*e+.0722*t;return J6(o,4)}reduceRelativeLuminace(i,e){let{r:t,g:o,b:n}=i.rgba,r=this.getContrastRatio(i);for(;r<e&&(t>0||o>0||n>0);)t-=Math.max(0,Math.ceil(t*.1)),o-=Math.max(0,Math.ceil(o*.1)),n-=Math.max(0,Math.ceil(n*.1)),r=this.getContrastRatio(new a(new Bt(t,o,n)));return new a(new Bt(t,o,n))}increaseRelativeLuminace(i,e){let{r:t,g:o,b:n}=i.rgba,r=this.getContrastRatio(i);for(;r<e&&(t<255||o<255||n<255);)t=Math.min(255,t+Math.ceil((255-t)*.1)),o=Math.min(255,o+Math.ceil((255-o)*.1)),n=Math.min(255,n+Math.ceil((255-n)*.1)),r=this.getContrastRatio(new a(new Bt(t,o,n)));return new a(new Bt(t,o,n))}static _relativeLuminanceForComponent(i){let e=i/255;return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}getContrastRatio(i){let e=this.getRelativeLuminance(),t=i.getRelativeLuminance();return e>t?(e+.05)/(t+.05):(t+.05)/(e+.05)}isDarker(){return(this.rgba.r*299+this.rgba.g*587+this.rgba.b*114)/1e3<128}isLighter(){return(this.rgba.r*299+this.rgba.g*587+this.rgba.b*114)/1e3>=128}isLighterThan(i){let e=this.getRelativeLuminance(),t=i.getRelativeLuminance();return e>t}isDarkerThan(i){let e=this.getRelativeLuminance(),t=i.getRelativeLuminance();return e<t}ensureConstrast(i,e){let t=this.getRelativeLuminance(),o=i.getRelativeLuminance();if(this.getContrastRatio(i)<e){if(o<t){let l=this.reduceRelativeLuminace(i,e),c=this.getContrastRatio(l);if(c<e){let u=this.increaseRelativeLuminace(i,e),p=this.getContrastRatio(u);return c>p?l:u}return l}let r=this.increaseRelativeLuminace(i,e),s=this.getContrastRatio(r);if(s<e){let l=this.reduceRelativeLuminace(i,e),c=this.getContrastRatio(l);return s>c?r:l}return r}return i}lighten(i){return new a(new DU(this.hsla.h,this.hsla.s,this.hsla.l+this.hsla.l*i,this.hsla.a))}darken(i){return new a(new DU(this.hsla.h,this.hsla.s,this.hsla.l-this.hsla.l*i,this.hsla.a))}transparent(i){let{r:e,g:t,b:o,a:n}=this.rgba;return new a(new Bt(e,t,o,n*i))}isTransparent(){return this.rgba.a===0}isOpaque(){return this.rgba.a===1}opposite(){return new a(new Bt(255-this.rgba.r,255-this.rgba.g,255-this.rgba.b,this.rgba.a))}blend(i){let e=i.rgba,t=this.rgba.a,o=e.a,n=t+o*(1-t);if(n<1e-6)return a.transparent;let r=this.rgba.r*t/n+e.r*o*(1-t)/n,s=this.rgba.g*t/n+e.g*o*(1-t)/n,l=this.rgba.b*t/n+e.b*o*(1-t)/n;return new a(new Bt(r,s,l,n))}mix(i,e=.5){let t=Math.min(Math.max(e,0),1),o=this.rgba,n=i.rgba,r=o.r+(n.r-o.r)*t,s=o.g+(n.g-o.g)*t,l=o.b+(n.b-o.b)*t,c=o.a+(n.a-o.a)*t;return new a(new Bt(r,s,l,c))}makeOpaque(i){if(this.isOpaque()||i.rgba.a!==1)return this;let{r:e,g:t,b:o,a:n}=this.rgba;return new a(new Bt(i.rgba.r-n*(i.rgba.r-e),i.rgba.g-n*(i.rgba.g-t),i.rgba.b-n*(i.rgba.b-o),1))}flatten(...i){let e=i.reduceRight((t,o)=>a._flatten(o,t));return a._flatten(this,e)}static _flatten(i,e){let t=1-i.rgba.a;return new a(new Bt(t*e.rgba.r+i.rgba.a*i.rgba.r,t*e.rgba.g+i.rgba.a*i.rgba.g,t*e.rgba.b+i.rgba.a*i.rgba.b))}toString(){return this._toString||(this._toString=a.Format.CSS.format(this)),this._toString}toNumber32Bit(){return this._toNumber32Bit||(this._toNumber32Bit=(this.rgba.r<<24|this.rgba.g<<16|this.rgba.b<<8|this.rgba.a*255<<0)>>>0),this._toNumber32Bit}static getLighterColor(i,e,t){if(i.isLighterThan(e))return i;t=t||.5;let o=i.getRelativeLuminance(),n=e.getRelativeLuminance();return t=t*(n-o)/n,i.lighten(t)}static getDarkerColor(i,e,t){if(i.isDarkerThan(e))return i;t=t||.5;let o=i.getRelativeLuminance(),n=e.getRelativeLuminance();return t=t*(o-n)/o,i.darken(t)}static{this.white=new a(new Bt(255,255,255,1))}static{this.black=new a(new Bt(0,0,0,1))}static{this.red=new a(new Bt(255,0,0,1))}static{this.blue=new a(new Bt(0,0,255,1))}static{this.green=new a(new Bt(0,255,0,1))}static{this.cyan=new a(new Bt(0,255,255,1))}static{this.lightgrey=new a(new Bt(211,211,211,1))}static{this.transparent=new a(new Bt(0,0,0,0))}};(i=>{let a;(t=>{let e;(b=>{function o(S){return S.rgba.a===1?`rgb(${S.rgba.r}, ${S.rgba.g}, ${S.rgba.b})`:i.Format.CSS.formatRGBA(S)}b.formatRGB=o;function n(S){return`rgba(${S.rgba.r}, ${S.rgba.g}, ${S.rgba.b}, ${+S.rgba.a.toFixed(2)})`}b.formatRGBA=n;function r(S){return S.hsla.a===1?`hsl(${S.hsla.h}, ${Math.round(S.hsla.s*100)}%, ${Math.round(S.hsla.l*100)}%)`:i.Format.CSS.formatHSLA(S)}b.formatHSL=r;function s(S){return`hsla(${S.hsla.h}, ${Math.round(S.hsla.s*100)}%, ${Math.round(S.hsla.l*100)}%, ${S.hsla.a.toFixed(2)})`}b.formatHSLA=s;function l(S){let y=S.toString(16);return y.length!==2?"0"+y:y}function c(S){return`#${l(S.rgba.r)}${l(S.rgba.g)}${l(S.rgba.b)}`}b.formatHex=c;function u(S,y=!1){return y&&S.rgba.a===1?i.Format.CSS.formatHex(S):`#${l(S.rgba.r)}${l(S.rgba.g)}${l(S.rgba.b)}${l(Math.round(S.rgba.a*255))}`}b.formatHexA=u;function p(S){return S.isOpaque()?i.Format.CSS.formatHex(S):i.Format.CSS.formatRGBA(S)}b.format=p;function h(S){if(S==="transparent")return i.transparent;if(S.startsWith("#"))return f(S);if(S.startsWith("rgba(")){let y=S.match(/rgba\((?<r>(?:\+|-)?\d+), *(?<g>(?:\+|-)?\d+), *(?<b>(?:\+|-)?\d+), *(?<a>(?:\+|-)?\d+(\.\d+)?)\)/);if(!y)throw new Error("Invalid color format "+S);let w=parseInt(y.groups?.r??"0"),k=parseInt(y.groups?.g??"0"),T=parseInt(y.groups?.b??"0"),N=parseFloat(y.groups?.a??"0");return new i(new Bt(w,k,T,N))}if(S.startsWith("rgb(")){let y=S.match(/rgb\((?<r>(?:\+|-)?\d+), *(?<g>(?:\+|-)?\d+), *(?<b>(?:\+|-)?\d+)\)/);if(!y)throw new Error("Invalid color format "+S);let w=parseInt(y.groups?.r??"0"),k=parseInt(y.groups?.g??"0"),T=parseInt(y.groups?.b??"0");return new i(new Bt(w,k,T))}return g(S)}b.parse=h;function g(S){switch(S){case"aliceblue":return new i(new Bt(240,248,255,1));case"antiquewhite":return new i(new Bt(250,235,215,1));case"aqua":return new i(new Bt(0,255,255,1));case"aquamarine":return new i(new Bt(127,255,212,1));case"azure":return new i(new Bt(240,255,255,1));case"beige":return new i(new Bt(245,245,220,1));case"bisque":return new i(new Bt(255,228,196,1));case"black":return new i(new Bt(0,0,0,1));case"blanchedalmond":return new i(new Bt(255,235,205,1));case"blue":return new i(new Bt(0,0,255,1));case"blueviolet":return new i(new Bt(138,43,226,1));case"brown":return new i(new Bt(165,42,42,1));case"burlywood":return new i(new Bt(222,184,135,1));case"cadetblue":return new i(new Bt(95,158,160,1));case"chartreuse":return new i(new Bt(127,255,0,1));case"chocolate":return new i(new Bt(210,105,30,1));case"coral":return new i(new Bt(255,127,80,1));case"cornflowerblue":return new i(new Bt(100,149,237,1));case"cornsilk":return new i(new Bt(255,248,220,1));case"crimson":return new i(new Bt(220,20,60,1));case"cyan":return new i(new Bt(0,255,255,1));case"darkblue":return new i(new Bt(0,0,139,1));case"darkcyan":return new i(new Bt(0,139,139,1));case"darkgoldenrod":return new i(new Bt(184,134,11,1));case"darkgray":return new i(new Bt(169,169,169,1));case"darkgreen":return new i(new Bt(0,100,0,1));case"darkgrey":return new i(new Bt(169,169,169,1));case"darkkhaki":return new i(new Bt(189,183,107,1));case"darkmagenta":return new i(new Bt(139,0,139,1));case"darkolivegreen":return new i(new Bt(85,107,47,1));case"darkorange":return new i(new Bt(255,140,0,1));case"darkorchid":return new i(new Bt(153,50,204,1));case"darkred":return new i(new Bt(139,0,0,1));case"darksalmon":return new i(new Bt(233,150,122,1));case"darkseagreen":return new i(new Bt(143,188,143,1));case"darkslateblue":return new i(new Bt(72,61,139,1));case"darkslategray":return new i(new Bt(47,79,79,1));case"darkslategrey":return new i(new Bt(47,79,79,1));case"darkturquoise":return new i(new Bt(0,206,209,1));case"darkviolet":return new i(new Bt(148,0,211,1));case"deeppink":return new i(new Bt(255,20,147,1));case"deepskyblue":return new i(new Bt(0,191,255,1));case"dimgray":return new i(new Bt(105,105,105,1));case"dimgrey":return new i(new Bt(105,105,105,1));case"dodgerblue":return new i(new Bt(30,144,255,1));case"firebrick":return new i(new Bt(178,34,34,1));case"floralwhite":return new i(new Bt(255,250,240,1));case"forestgreen":return new i(new Bt(34,139,34,1));case"fuchsia":return new i(new Bt(255,0,255,1));case"gainsboro":return new i(new Bt(220,220,220,1));case"ghostwhite":return new i(new Bt(248,248,255,1));case"gold":return new i(new Bt(255,215,0,1));case"goldenrod":return new i(new Bt(218,165,32,1));case"gray":return new i(new Bt(128,128,128,1));case"green":return new i(new Bt(0,128,0,1));case"greenyellow":return new i(new Bt(173,255,47,1));case"grey":return new i(new Bt(128,128,128,1));case"honeydew":return new i(new Bt(240,255,240,1));case"hotpink":return new i(new Bt(255,105,180,1));case"indianred":return new i(new Bt(205,92,92,1));case"indigo":return new i(new Bt(75,0,130,1));case"ivory":return new i(new Bt(255,255,240,1));case"khaki":return new i(new Bt(240,230,140,1));case"lavender":return new i(new Bt(230,230,250,1));case"lavenderblush":return new i(new Bt(255,240,245,1));case"lawngreen":return new i(new Bt(124,252,0,1));case"lemonchiffon":return new i(new Bt(255,250,205,1));case"lightblue":return new i(new Bt(173,216,230,1));case"lightcoral":return new i(new Bt(240,128,128,1));case"lightcyan":return new i(new Bt(224,255,255,1));case"lightgoldenrodyellow":return new i(new Bt(250,250,210,1));case"lightgray":return new i(new Bt(211,211,211,1));case"lightgreen":return new i(new Bt(144,238,144,1));case"lightgrey":return new i(new Bt(211,211,211,1));case"lightpink":return new i(new Bt(255,182,193,1));case"lightsalmon":return new i(new Bt(255,160,122,1));case"lightseagreen":return new i(new Bt(32,178,170,1));case"lightskyblue":return new i(new Bt(135,206,250,1));case"lightslategray":return new i(new Bt(119,136,153,1));case"lightslategrey":return new i(new Bt(119,136,153,1));case"lightsteelblue":return new i(new Bt(176,196,222,1));case"lightyellow":return new i(new Bt(255,255,224,1));case"lime":return new i(new Bt(0,255,0,1));case"limegreen":return new i(new Bt(50,205,50,1));case"linen":return new i(new Bt(250,240,230,1));case"magenta":return new i(new Bt(255,0,255,1));case"maroon":return new i(new Bt(128,0,0,1));case"mediumaquamarine":return new i(new Bt(102,205,170,1));case"mediumblue":return new i(new Bt(0,0,205,1));case"mediumorchid":return new i(new Bt(186,85,211,1));case"mediumpurple":return new i(new Bt(147,112,219,1));case"mediumseagreen":return new i(new Bt(60,179,113,1));case"mediumslateblue":return new i(new Bt(123,104,238,1));case"mediumspringgreen":return new i(new Bt(0,250,154,1));case"mediumturquoise":return new i(new Bt(72,209,204,1));case"mediumvioletred":return new i(new Bt(199,21,133,1));case"midnightblue":return new i(new Bt(25,25,112,1));case"mintcream":return new i(new Bt(245,255,250,1));case"mistyrose":return new i(new Bt(255,228,225,1));case"moccasin":return new i(new Bt(255,228,181,1));case"navajowhite":return new i(new Bt(255,222,173,1));case"navy":return new i(new Bt(0,0,128,1));case"oldlace":return new i(new Bt(253,245,230,1));case"olive":return new i(new Bt(128,128,0,1));case"olivedrab":return new i(new Bt(107,142,35,1));case"orange":return new i(new Bt(255,165,0,1));case"orangered":return new i(new Bt(255,69,0,1));case"orchid":return new i(new Bt(218,112,214,1));case"palegoldenrod":return new i(new Bt(238,232,170,1));case"palegreen":return new i(new Bt(152,251,152,1));case"paleturquoise":return new i(new Bt(175,238,238,1));case"palevioletred":return new i(new Bt(219,112,147,1));case"papayawhip":return new i(new Bt(255,239,213,1));case"peachpuff":return new i(new Bt(255,218,185,1));case"peru":return new i(new Bt(205,133,63,1));case"pink":return new i(new Bt(255,192,203,1));case"plum":return new i(new Bt(221,160,221,1));case"powderblue":return new i(new Bt(176,224,230,1));case"purple":return new i(new Bt(128,0,128,1));case"rebeccapurple":return new i(new Bt(102,51,153,1));case"red":return new i(new Bt(255,0,0,1));case"rosybrown":return new i(new Bt(188,143,143,1));case"royalblue":return new i(new Bt(65,105,225,1));case"saddlebrown":return new i(new Bt(139,69,19,1));case"salmon":return new i(new Bt(250,128,114,1));case"sandybrown":return new i(new Bt(244,164,96,1));case"seagreen":return new i(new Bt(46,139,87,1));case"seashell":return new i(new Bt(255,245,238,1));case"sienna":return new i(new Bt(160,82,45,1));case"silver":return new i(new Bt(192,192,192,1));case"skyblue":return new i(new Bt(135,206,235,1));case"slateblue":return new i(new Bt(106,90,205,1));case"slategray":return new i(new Bt(112,128,144,1));case"slategrey":return new i(new Bt(112,128,144,1));case"snow":return new i(new Bt(255,250,250,1));case"springgreen":return new i(new Bt(0,255,127,1));case"steelblue":return new i(new Bt(70,130,180,1));case"tan":return new i(new Bt(210,180,140,1));case"teal":return new i(new Bt(0,128,128,1));case"thistle":return new i(new Bt(216,191,216,1));case"tomato":return new i(new Bt(255,99,71,1));case"turquoise":return new i(new Bt(64,224,208,1));case"violet":return new i(new Bt(238,130,238,1));case"wheat":return new i(new Bt(245,222,179,1));case"white":return new i(new Bt(255,255,255,1));case"whitesmoke":return new i(new Bt(245,245,245,1));case"yellow":return new i(new Bt(255,255,0,1));case"yellowgreen":return new i(new Bt(154,205,50,1));default:return null}}function f(S){let y=S.length;if(y===0||S.charCodeAt(0)!==35)return null;if(y===7){let w=16*v(S.charCodeAt(1))+v(S.charCodeAt(2)),k=16*v(S.charCodeAt(3))+v(S.charCodeAt(4)),T=16*v(S.charCodeAt(5))+v(S.charCodeAt(6));return new i(new Bt(w,k,T,1))}if(y===9){let w=16*v(S.charCodeAt(1))+v(S.charCodeAt(2)),k=16*v(S.charCodeAt(3))+v(S.charCodeAt(4)),T=16*v(S.charCodeAt(5))+v(S.charCodeAt(6)),N=16*v(S.charCodeAt(7))+v(S.charCodeAt(8));return new i(new Bt(w,k,T,N/255))}if(y===4){let w=v(S.charCodeAt(1)),k=v(S.charCodeAt(2)),T=v(S.charCodeAt(3));return new i(new Bt(16*w+w,16*k+k,16*T+T))}if(y===5){let w=v(S.charCodeAt(1)),k=v(S.charCodeAt(2)),T=v(S.charCodeAt(3)),N=v(S.charCodeAt(4));return new i(new Bt(16*w+w,16*k+k,16*T+T,(16*N+N)/255))}return null}b.parseHex=f;function v(S){switch(S){case 48:return 0;case 49:return 1;case 50:return 2;case 51:return 3;case 52:return 4;case 53:return 5;case 54:return 6;case 55:return 7;case 56:return 8;case 57:return 9;case 97:return 10;case 65:return 10;case 98:return 11;case 66:return 11;case 99:return 12;case 67:return 12;case 100:return 13;case 68:return 13;case 101:return 14;case 69:return 14;case 102:return 15;case 70:return 15}return 0}})(e=t.CSS||={})})(a=i.Format||={})})(Oe||={});function w2i(a){let i=[];for(let e of a){let t=Number(e);(t||t===0&&e.replace(/\s/g,"")!=="")&&i.push(t)}return i}function IXt(a,i,e,t){return{red:a/255,blue:e/255,green:i/255,alpha:t}}function T$e(a,i){let e=i.index,t=i[0].length;if(e===void 0)return;let o=a.positionAt(e);return{startLineNumber:o.lineNumber,startColumn:o.column,endLineNumber:o.lineNumber,endColumn:o.column+t}}function XMo(a,i){if(!a)return;let e=Oe.Format.CSS.parseHex(i);if(e)return{range:a,color:IXt(e.rgba.r,e.rgba.g,e.rgba.b,e.rgba.a)}}function I2i(a,i,e){if(!a||i.length!==1)return;let o=i[0].values(),n=w2i(o);return{range:a,color:IXt(n[0],n[1],n[2],e?n[3]:1)}}function y2i(a,i,e){if(!a||i.length!==1)return;let o=i[0].values(),n=w2i(o),r=new Oe(new DU(n[0],n[1]/100,n[2]/100,e?n[3]:1));return{range:a,color:IXt(r.rgba.r,r.rgba.g,r.rgba.b,r.rgba.a)}}function _$e(a,i){return typeof a=="string"?[...a.matchAll(i)]:a.findMatches(i)}function JMo(a){let i=[],t=_$e(a,/\b(rgb|rgba|hsl|hsla)(\([0-9\s,.\%\/]*\))|^(#)([A-Fa-f0-9]{3})\b|^(#)([A-Fa-f0-9]{4})\b|^(#)([A-Fa-f0-9]{6})\b|^(#)([A-Fa-f0-9]{8})\b|(?<=['"\s])(#)([A-Fa-f0-9]{3})\b|(?<=['"\s])(#)([A-Fa-f0-9]{4})\b|(?<=['"\s])(#)([A-Fa-f0-9]{6})\b|(?<=['"\s])(#)([A-Fa-f0-9]{8})\b/gm);if(t.length>0)for(let o of t){let n=o.filter(c=>c!==void 0),r=n[1],s=n[2];if(!s)continue;let l;if(r==="rgb"){let c=/^\(\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*[\s,]\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*[\s,]\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*\)$/gm;l=I2i(T$e(a,o),_$e(s,c),!1)}else if(r==="rgba"){let c=/^\(\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*[\s,]\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*[\s,]\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*(?:[\s,]|[\s]*\/)\s*(0[.][0-9]+|[.][0-9]+|[01][.]|[01])\s*\)$/gm;l=I2i(T$e(a,o),_$e(s,c),!0)}else if(r==="hsl"){let c=/^\(\s*((?:360(?:\.0+)?|(?:36[0]|3[0-5][0-9]|[12][0-9][0-9]|[1-9]?[0-9])(?:\.\d+)?))\s*[\s,]\s*(100(?:\.0+)?|\d{1,2}[.]\d*|\d{1,2})%\s*[\s,]\s*(100(?:\.0+)?|\d{1,2}[.]\d*|\d{1,2})%\s*\)$/gm;l=y2i(T$e(a,o),_$e(s,c),!1)}else if(r==="hsla"){let c=/^\(\s*((?:360(?:\.0+)?|(?:36[0]|3[0-5][0-9]|[12][0-9][0-9]|[1-9]?[0-9])(?:\.\d+)?))\s*[\s,]\s*(100(?:\.0+)?|\d{1,2}[.]\d*|\d{1,2})%\s*[\s,]\s*(100(?:\.0+)?|\d{1,2}[.]\d*|\d{1,2})%\s*(?:[\s,]|[\s]*\/)\s*(0[.][0-9]+|[.][0-9]+|[01][.]0*|[01])\s*\)$/gm;l=y2i(T$e(a,o),_$e(s,c),!0)}else r==="#"&&(l=XMo(T$e(a,o),r+s));l&&i.push(l)}return i}function C2i(a){return!a||typeof a.getValue!="function"||typeof a.positionAt!="function"?[]:JMo(a)}var ZMo=/^-+|-+$/g,x2i=100,ePo=5;function k2i(a,i){let e=[];if(i.findRegionSectionHeaders&&i.foldingRules?.markers){let t=tPo(a,i);e=e.concat(t)}if(i.findMarkSectionHeaders){let t=iPo(a,i);e=e.concat(t)}return e}function tPo(a,i){let e=[],t=a.getLineCount();for(let o=1;o<=t;o++){let n=a.getLineContent(o),r=n.match(i.foldingRules.markers.start);if(r){let s={startLineNumber:o,startColumn:r[0].length+1,endLineNumber:o,endColumn:n.length+1};if(s.endColumn>s.startColumn){let l={range:s,...oPo(n.substring(r[0].length)),shouldBeInComments:!1};(l.text||l.hasSeparatorLine)&&e.push(l)}}}return e}function iPo(a,i){let e=[],t=a.getLineCount();if(!i.markSectionHeaderRegex||i.markSectionHeaderRegex.trim()==="")return e;let o=I$e(i.markSectionHeaderRegex),n=new RegExp(i.markSectionHeaderRegex,`gdm${o?"s":""}`);if(xbe(n))return e;for(let r=1;r<=t;r+=x2i-ePo){let s=Math.min(r+x2i-1,t),l=[];for(let p=r;p<=s;p++)l.push(a.getLineContent(p));let c=l.join(`
`);n.lastIndex=0;let u;for(;(u=n.exec(c))!==null;){let p=c.substring(0,u.index),h=(p.match(/\n/g)||[]).length,g=r+h,f=u[0].split(`
`),v=f.length,b=g+v-1,S=p.lastIndexOf(`
`)+1,y=u.index-S+1,w=f[f.length-1],k=v===1?y+u[0].length:w.length+1,T={startLineNumber:g,startColumn:y,endLineNumber:b,endColumn:k},N=(u.groups??{}).label??"",O=((u.groups??{}).separator??"")!=="",V={range:T,text:N,hasSeparatorLine:O,shouldBeInComments:!0};(V.text||V.hasSeparatorLine)&&(e.length===0||e[e.length-1].range.endLineNumber<V.range.startLineNumber)&&e.push(V),n.lastIndex=u.index+u[0].length}}return e}function oPo(a){a=a.trim();let i=a.startsWith("-");return a=a.replace(ZMo,""),{text:a,hasSeparatorLine:i}}var KT=class{constructor(i){this.values=i,this.prefixSum=new Uint32Array(i.length),this.prefixSumValidIndex=new Int32Array(1),this.prefixSumValidIndex[0]=-1}getCount(){return this.values.length}insertValues(i,e){i=Ire(i);let t=this.values,o=this.prefixSum,n=e.length;return n===0?!1:(this.values=new Uint32Array(t.length+n),this.values.set(t.subarray(0,i),0),this.values.set(t.subarray(i),i+n),this.values.set(e,i),i-1<this.prefixSumValidIndex[0]&&(this.prefixSumValidIndex[0]=i-1),this.prefixSum=new Uint32Array(this.values.length),this.prefixSumValidIndex[0]>=0&&this.prefixSum.set(o.subarray(0,this.prefixSumValidIndex[0]+1)),!0)}setValue(i,e){return i=Ire(i),e=Ire(e),this.values[i]===e?!1:(this.values[i]=e,i-1<this.prefixSumValidIndex[0]&&(this.prefixSumValidIndex[0]=i-1),!0)}removeValues(i,e){i=Ire(i),e=Ire(e);let t=this.values,o=this.prefixSum;if(i>=t.length)return!1;let n=t.length-i;return e>=n&&(e=n),e===0?!1:(this.values=new Uint32Array(t.length-e),this.values.set(t.subarray(0,i),0),this.values.set(t.subarray(i+e),i),this.prefixSum=new Uint32Array(this.values.length),i-1<this.prefixSumValidIndex[0]&&(this.prefixSumValidIndex[0]=i-1),this.prefixSumValidIndex[0]>=0&&this.prefixSum.set(o.subarray(0,this.prefixSumValidIndex[0]+1)),!0)}getTotalSum(){return this.values.length===0?0:this._getPrefixSum(this.values.length-1)}getPrefixSum(i){return i<0?0:(i=Ire(i),this._getPrefixSum(i))}_getPrefixSum(i){if(i<=this.prefixSumValidIndex[0])return this.prefixSum[i];let e=this.prefixSumValidIndex[0]+1;e===0&&(this.prefixSum[0]=this.values[0],e++),i>=this.values.length&&(i=this.values.length-1);for(let t=e;t<=i;t++)this.prefixSum[t]=this.prefixSum[t-1]+this.values[t];return this.prefixSumValidIndex[0]=Math.max(this.prefixSumValidIndex[0],i),this.prefixSum[i]}getIndexOf(i){i=Math.floor(i),this.getTotalSum();let e=0,t=this.values.length-1,o=0,n=0,r=0;for(;e<=t;)if(o=e+(t-e)/2|0,n=this.prefixSum[o],r=n-this.values[o],i<r)t=o-1;else if(i>=n)e=o+1;else break;return new D$e(o,i-r)}},VSe=class{constructor(i){this._values=i,this._isValid=!1,this._validEndIndex=-1,this._prefixSum=[],this._indexBySum=[]}getTotalSum(){return this._ensureValid(),this._indexBySum.length}getPrefixSum(i){return this._ensureValid(),i===0?0:this._prefixSum[i-1]}getIndexOf(i){this._ensureValid();let e=this._indexBySum[i];if(e===void 0){let o=Math.max(0,this._values.length-1),n=o>0?this._prefixSum[o-1]:0;return new D$e(o,i-n)}let t=e>0?this._prefixSum[e-1]:0;return new D$e(e,i-t)}removeValues(i,e){this._values.splice(i,e),this._invalidate(i)}insertValues(i,e){this._values=UH(this._values,i,e),this._invalidate(i)}_invalidate(i){this._isValid=!1,this._validEndIndex=Math.min(this._validEndIndex,i-1)}_ensureValid(){if(!this._isValid){for(let i=this._validEndIndex+1,e=this._values.length;i<e;i++){let t=this._values[i],o=i>0?this._prefixSum[i-1]:0;this._prefixSum[i]=o+t;for(let n=0;n<t;n++)this._indexBySum[o+n]=i}this._prefixSum.length=this._values.length,this._indexBySum.length=this._values.length>0?this._prefixSum[this._values.length-1]:0,this._isValid=!0,this._validEndIndex=this._values.length-1}}setValue(i,e){this._values[i]!==e&&(this._values[i]=e,this._invalidate(i))}},D$e=class{constructor(i,e){this.index=i;this.remainder=e;this._prefixSumIndexOfResultBrand=void 0;this.index=i,this.remainder=e}};var jht=class{constructor(i,e,t,o){this._uri=i,this._lines=e,this._eol=t,this._versionId=o,this._lineStarts=null,this._cachedTextValue=null}dispose(){this._lines.length=0}get version(){return this._versionId}getText(){return this._cachedTextValue===null&&(this._cachedTextValue=this._lines.join(this._eol)),this._cachedTextValue}onEvents(i){i.eol&&i.eol!==this._eol&&(this._eol=i.eol,this._lineStarts=null);let e=i.changes;for(let t of e)this._acceptDeleteRange(t.range),this._acceptInsertText(new Ie(t.range.startLineNumber,t.range.startColumn),t.text);this._versionId=i.versionId,this._cachedTextValue=null}_ensureLineStarts(){if(!this._lineStarts){let i=this._eol.length,e=this._lines.length,t=new Uint32Array(e);for(let o=0;o<e;o++)t[o]=this._lines[o].length+i;this._lineStarts=new KT(t)}}_setLineText(i,e){this._lines[i]=e,this._lineStarts&&this._lineStarts.setValue(i,this._lines[i].length+this._eol.length)}_acceptDeleteRange(i){if(i.startLineNumber===i.endLineNumber){if(i.startColumn===i.endColumn)return;this._setLineText(i.startLineNumber-1,this._lines[i.startLineNumber-1].substring(0,i.startColumn-1)+this._lines[i.startLineNumber-1].substring(i.endColumn-1));return}this._setLineText(i.startLineNumber-1,this._lines[i.startLineNumber-1].substring(0,i.startColumn-1)+this._lines[i.endLineNumber-1].substring(i.endColumn-1)),this._lines.splice(i.startLineNumber,i.endLineNumber-i.startLineNumber),this._lineStarts&&this._lineStarts.removeValues(i.startLineNumber,i.endLineNumber-i.startLineNumber)}_acceptInsertText(i,e){if(e.length===0)return;let t=mc(e);if(t.length===1){this._setLineText(i.lineNumber-1,this._lines[i.lineNumber-1].substring(0,i.column-1)+t[0]+this._lines[i.lineNumber-1].substring(i.column-1));return}t[t.length-1]+=this._lines[i.lineNumber-1].substring(i.column-1),this._setLineText(i.lineNumber-1,this._lines[i.lineNumber-1].substring(0,i.column-1)+t[0]);let o=new Uint32Array(t.length-1);for(let n=1;n<t.length;n++)this._lines.splice(i.lineNumber+n-1,0,t[n]),o[n-1]=t[n].length+this._eol.length;this._lineStarts&&this._lineStarts.insertValues(i.lineNumber,o)}};var E2i=60*1e3,T2i="workerTextModelSync",Z6=class a extends C{constructor(e,t,o=!1){super();this._syncedModels=Object.create(null);this._syncedModelsLastUsedTime=Object.create(null);if(this._proxy=e,this._modelService=t,!o){let n=new EI;n.cancelAndSet(()=>this._checkStopModelSync(),Math.round(E2i/2)),this._register(n)}}static create(e,t){return new a(e.getChannel(T2i),t)}dispose(){for(let e in this._syncedModels)Ue(this._syncedModels[e]);this._syncedModels=Object.create(null),this._syncedModelsLastUsedTime=Object.create(null),super.dispose()}ensureSyncedResources(e,t=!1){for(let o of e){let n=o.toString();this._syncedModels[n]||this._beginModelSync(o,t),this._syncedModels[n]&&(this._syncedModelsLastUsedTime[n]=new Date().getTime())}}_checkStopModelSync(){let e=new Date().getTime(),t=[];for(let o in this._syncedModelsLastUsedTime)e-this._syncedModelsLastUsedTime[o]>E2i&&t.push(o);for(let o of t)this._stopModelSync(o)}_beginModelSync(e,t){let o=this._modelService.getModel(e);if(!o||!t&&o.isTooLargeForSyncing())return;let n=e.toString();this._proxy.$acceptNewModel({url:o.uri.toString(),lines:o.getLinesContent(),EOL:o.getEOL(),versionId:o.getVersionId()});let r=new P;r.add(o.onDidChangeContent(s=>{this._proxy.$acceptModelChanged(n.toString(),s)})),r.add(o.onWillDispose(()=>{this._stopModelSync(n)})),r.add(Z(()=>{this._proxy.$acceptRemovedModel(n)})),this._syncedModels[n]=r}_stopModelSync(e){let t=this._syncedModels[e];delete this._syncedModels[e],delete this._syncedModelsLastUsedTime[e],Ue(t)}},Qht=class{constructor(){this._models=Object.create(null)}bindToServer(i){i.setChannel(T2i,this)}getModel(i){return this._models[i]}getModels(){let i=[];return Object.keys(this._models).forEach(e=>i.push(this._models[e])),i}$acceptNewModel(i){this._models[i.url]=new yXt(A.parse(i.url),i.lines,i.EOL,i.versionId)}$acceptModelChanged(i,e){if(!this._models[i])return;this._models[i].onEvents(e)}$acceptRemovedModel(i){this._models[i]&&delete this._models[i]}},yXt=class extends jht{get uri(){return this._uri}get eol(){return this._eol}getValue(){return this.getText()}findMatches(i){let e=[];for(let t=0;t<this._lines.length;t++){let o=this._lines[t],n=this.offsetAt(new Ie(t+1,1)),r=o.matchAll(i);for(let s of r)(s.index||s.index===0)&&(s.index=s.index+n),e.push(s)}return e}getLinesContent(){return this._lines.slice(0)}getLineCount(){return this._lines.length}getLineContent(i){return this._lines[i-1]}getWordAtPosition(i,e){let t=My(i.column,E$(e),this._lines[i.lineNumber-1],0);return t?new z(i.lineNumber,t.startColumn,i.lineNumber,t.endColumn):null}getWordUntilPosition(i,e){let t=this.getWordAtPosition(i,e);return t?{word:this._lines[i.lineNumber-1].substring(t.startColumn-1,i.column-1),startColumn:t.startColumn,endColumn:i.column}:{word:"",startColumn:i.column,endColumn:i.column}}words(i){let e=this._lines,t=this._wordenize.bind(this),o=0,n="",r=0,s=[];return{*[Symbol.iterator](){for(;;)if(r<s.length){let l=n.substring(s[r].start,s[r].end);r+=1,yield l}else if(o<e.length)n=e[o],s=t(n,i),r=0,o+=1;else break}}}getLineWords(i,e){let t=this._lines[i-1],o=this._wordenize(t,e),n=[];for(let r of o)n.push({word:t.substring(r.start,r.end),startColumn:r.start+1,endColumn:r.end+1});return n}_wordenize(i,e){let t=[],o;for(e.lastIndex=0;(o=e.exec(i))&&o[0].length!==0;)t.push({start:o.index,end:o.index+o[0].length});return t}getValueInRange(i){if(i=this._validateRange(i),i.startLineNumber===i.endLineNumber)return this._lines[i.startLineNumber-1].substring(i.startColumn-1,i.endColumn-1);let e=this._eol,t=i.startLineNumber-1,o=i.endLineNumber-1,n=[];n.push(this._lines[t].substring(i.startColumn-1));for(let r=t+1;r<o;r++)n.push(this._lines[r]);return n.push(this._lines[o].substring(0,i.endColumn-1)),n.join(e)}offsetAt(i){return i=this._validatePosition(i),this._ensureLineStarts(),this._lineStarts.getPrefixSum(i.lineNumber-2)+(i.column-1)}positionAt(i){i=Math.floor(i),i=Math.max(0,i),this._ensureLineStarts();let e=this._lineStarts.getIndexOf(i),t=this._lines[e.index].length;return{lineNumber:1+e.index,column:1+Math.min(e.remainder,t)}}_validateRange(i){let e=this._validatePosition({lineNumber:i.startLineNumber,column:i.startColumn}),t=this._validatePosition({lineNumber:i.endLineNumber,column:i.endColumn});return e.lineNumber!==i.startLineNumber||e.column!==i.startColumn||t.lineNumber!==i.endLineNumber||t.column!==i.endColumn?{startLineNumber:e.lineNumber,startColumn:e.column,endLineNumber:t.lineNumber,endColumn:t.column}:i}_validatePosition(i){if(!Ie.isIPosition(i))throw new Error("bad position");let{lineNumber:e,column:t}=i,o=!1;if(e<1)e=1,t=1,o=!0;else if(e>this._lines.length)e=this._lines.length,t=this._lines[e-1].length+1,o=!0;else{let n=this._lines[e-1].length+1;t<1?(t=1,o=!0):t>n&&(t=n,o=!0)}return o?{lineNumber:e,column:t}:i}};var wse=class{constructor(i){this.replacements=i;let e=-1;for(let t of i){if(!(t.replaceRange.start>=e))throw new ni(`Edits must be disjoint and sorted. Found ${t} after ${e}`);e=t.replaceRange.endExclusive}}equals(i){if(this.replacements.length!==i.replacements.length)return!1;for(let e=0;e<this.replacements.length;e++)if(!this.replacements[e].equals(i.replacements[e]))return!1;return!0}toString(){return`[${this.replacements.map(e=>e.toString()).join(", ")}]`}normalize(){let i=[],e;for(let t of this.replacements)if(!(t.getNewLength()===0&&t.replaceRange.length===0)){if(e&&e.replaceRange.endExclusive===t.replaceRange.start){let o=e.tryJoinTouching(t);if(o){e=o;continue}}e&&i.push(e),e=t}return e&&i.push(e),this._createNew(i)}compose(i){let e=this.normalize(),t=i.normalize();if(e.isEmpty())return t;if(t.isEmpty())return e;let o=[...e.replacements],n=[],r=0;for(let s of t.replacements){for(;;){let p=o[0];if(!p||p.replaceRange.start+r+p.getNewLength()>=s.replaceRange.start)break;o.shift(),n.push(p),r+=p.getNewLength()-p.replaceRange.length}let l=r,c,u;for(;;){let p=o[0];if(!p||p.replaceRange.start+r>s.replaceRange.endExclusive)break;c||(c=p),u=p,o.shift(),r+=p.getNewLength()-p.replaceRange.length}if(!c)n.push(s.delta(-r));else{let p=Math.min(c.replaceRange.start,s.replaceRange.start-l),h=s.replaceRange.start-(c.replaceRange.start+l);if(h>0){let b=c.slice(di.emptyAt(p),new di(0,h));n.push(b)}if(!u)throw new ni("Invariant violation: lastIntersecting is undefined");let g=u.replaceRange.endExclusive+r-s.replaceRange.endExclusive;if(g>0){let b=u.slice(di.ofStartAndLength(u.replaceRange.endExclusive,0),new di(u.getNewLength()-g,u.getNewLength()));o.unshift(b),r-=b.getNewLength()-b.replaceRange.length}let f=new di(p,s.replaceRange.endExclusive-r),v=s.slice(f,new di(0,s.getNewLength()));n.push(v)}}for(;;){let s=o.shift();if(!s)break;n.push(s)}return this._createNew(n).normalize()}decomposeSplit(i){let e=[],t=[],o=0;for(let n of this.replacements)i(n)?(e.push(n),o+=n.getNewLength()-n.replaceRange.length):t.push(n.slice(n.replaceRange.delta(o),new di(0,n.getNewLength())));return{e1:this._createNew(e),e2:this._createNew(t)}}getNewRanges(){let i=[],e=0;for(let t of this.replacements)i.push(di.ofStartAndLength(t.replaceRange.start+e,t.getNewLength())),e+=t.getLengthDelta();return i}getJoinedReplaceRange(){if(this.replacements.length!==0)return this.replacements[0].replaceRange.join(this.replacements.at(-1).replaceRange)}isEmpty(){return this.replacements.length===0}getLengthDelta(){return ky(this.replacements,i=>i.getLengthDelta())}getNewDataLength(i){return i+this.getLengthDelta()}applyToOffset(i){let e=0;for(let t of this.replacements)if(t.replaceRange.start<=i){if(i<t.replaceRange.endExclusive)return t.replaceRange.start+e;e+=t.getNewLength()-t.replaceRange.length}else break;return i+e}applyToOffsetRange(i){return new di(this.applyToOffset(i.start),this.applyToOffset(i.endExclusive))}applyInverseToOffset(i){let e=0;for(let t of this.replacements){let o=t.getNewLength();if(t.replaceRange.start<=i-e){if(i-e<t.replaceRange.start+o)return t.replaceRange.start;e+=o-t.replaceRange.length}else break}return i-e}applyToOffsetOrUndefined(i){let e=0;for(let t of this.replacements)if(t.replaceRange.start<=i){if(i<t.replaceRange.endExclusive)return;e+=t.getNewLength()-t.replaceRange.length}else break;return i+e}applyToOffsetRangeOrUndefined(i){let e=this.applyToOffsetOrUndefined(i.start);if(e===void 0)return;let t=this.applyToOffsetOrUndefined(i.endExclusive);if(t!==void 0)return new di(e,t)}},BSe=class{constructor(i){this.replaceRange=i}delta(i){return this.slice(this.replaceRange.delta(i),new di(0,this.getNewLength()))}getLengthDelta(){return this.getNewLength()-this.replaceRange.length}toString(){return`{ ${this.replaceRange.toString()} -> ${this.getNewLength()} }`}get isEmpty(){return this.getNewLength()===0&&this.replaceRange.length===0}getRangeAfterReplace(){return new di(this.replaceRange.start,this.replaceRange.start+this.getNewLength())}},_2i=class a extends wse{static{this.empty=new a([])}static create(i){return new a(i)}static single(i){return new a([i])}_createNew(i){return new a(i)}};var USe=class extends wse{get TReplacement(){throw new Error("TReplacement is not defined for BaseStringEdit")}static composeOrUndefined(i){if(i.length===0)return;let e=i[0];for(let t=1;t<i.length;t++)e=e.compose(i[t]);return e}static trySwap(i,e){let t=i.inverseOnSlice((r,s)=>" ".repeat(s-r)),o=e.tryRebase(t);if(!o)return;let n=i.tryRebase(o);if(n)return{e1:o,e2:n}}apply(i){let e=[],t=0;for(let o of this.replacements)e.push(i.substring(t,o.replaceRange.start)),e.push(o.newText),t=o.replaceRange.endExclusive;return e.push(i.substring(t)),e.join("")}inverseOnSlice(i){let e=[],t=0;for(let o of this.replacements)e.push(Hc.replace(di.ofStartAndLength(o.replaceRange.start+t,o.newText.length),i(o.replaceRange.start,o.replaceRange.endExclusive))),t+=o.newText.length-o.replaceRange.length;return new Qc(e)}inverse(i){return this.inverseOnSlice((e,t)=>i.substring(e,t))}rebaseSkipConflicting(i){return this._tryRebase(i,!1)}tryRebase(i){return this._tryRebase(i,!0)}_tryRebase(i,e){let t=[],o=0,n=0,r=0;for(;n<this.replacements.length||o<i.replacements.length;){let s=i.replacements.at(o),l=this.replacements.at(n);if(l)if(s)if(l.replaceRange.intersects(s.replaceRange)||nPo(l.replaceRange,s.replaceRange)||D2i(l.replaceRange,s.replaceRange)||D2i(s.replaceRange,l.replaceRange)){if(n++,e)return}else if(l.replaceRange.start<s.replaceRange.start||l.replaceRange.isEmpty&&l.replaceRange.start===s.replaceRange.start){let c=l.replaceRange.delta(r);t.push(new Hc(c,l.newText)),n++}else o++,r+=s.newText.length-s.replaceRange.length;else{let c=l.replaceRange.delta(r);t.push(new Hc(c,l.newText)),n++}else break}return new Qc(t)}toJson(){return this.replacements.map(i=>i.toJson())}isNeutralOn(i){return this.replacements.every(e=>e.isNeutralOn(i))}removeCommonSuffixPrefix(i){let e=[];for(let t of this.replacements){let o=t.removeCommonSuffixPrefix(i);o.isEmpty||e.push(o)}return new Qc(e)}normalizeEOL(i){return new Qc(this.replacements.map(e=>e.normalizeEOL(i)))}normalizeOnSource(i){let e=this.apply(i),o=Hc.replace(di.ofLength(i.length),e).removeCommonSuffixAndPrefix(i);return o.isEmpty?Qc.empty:o.toEdit()}removeCommonSuffixAndPrefix(i){return this._createNew(this.replacements.map(e=>e.removeCommonSuffixAndPrefix(i))).normalize()}applyOnText(i){return new _S(this.apply(i.value))}mapData(i){return new OI(this.replacements.map(e=>new HSe(e.replaceRange,e.newText,i(e))))}},Yht=class extends BSe{constructor(e,t){super(e);this.newText=t}getNewLength(){return this.newText.length}toString(){return`${this.replaceRange} -> ${JSON.stringify(this.newText)}`}replace(e){return e.substring(0,this.replaceRange.start)+this.newText+e.substring(this.replaceRange.endExclusive)}isNeutralOn(e){return this.newText===e.substring(this.replaceRange.start,this.replaceRange.endExclusive)}removeCommonSuffixPrefix(e){let t=e.substring(this.replaceRange.start,this.replaceRange.endExclusive),o=Ng(t,this.newText),n=Math.min(t.length-o,this.newText.length-o,zw(t,this.newText)),r=new di(this.replaceRange.start+o,this.replaceRange.endExclusive-n),s=this.newText.substring(o,this.newText.length-n);return new Hc(r,s)}normalizeEOL(e){let t=this.newText.replace(/\r\n|\n/g,e);return new Hc(this.replaceRange,t)}removeCommonSuffixAndPrefix(e){return this.removeCommonSuffix(e).removeCommonPrefix(e)}removeCommonPrefix(e){let t=this.replaceRange.substring(e),o=Ng(t,this.newText);return o===0?this:this.slice(this.replaceRange.deltaStart(o),new di(o,this.newText.length))}removeCommonSuffix(e){let t=this.replaceRange.substring(e),o=zw(t,this.newText);return o===0?this:this.slice(this.replaceRange.deltaEnd(-o),new di(0,this.newText.length-o))}toEdit(){return new Qc([this])}toJson(){return{txt:this.newText,pos:this.replaceRange.start,len:this.replaceRange.length}}},Qc=class a extends USe{static parse(i){let e=[],t=/\[(\d+),\s*(\d+)\)\s*->\s*"([^"]*)"/g,o;for(;(o=t.exec(i))!==null;){let n=parseInt(o[1],10),r=parseInt(o[2],10),s=o[3].replace(/\\n/g,`
`).replace(/\\r/g,"\r").replace(/\\\\/g,"\\");e.push(new Hc(new di(n,r),s))}return new a(e)}static{this.empty=new a([])}static create(i){return new a(i)}static single(i){return new a([i])}static replace(i,e){return new a([new Hc(i,e)])}static insert(i,e){return new a([new Hc(di.emptyAt(i),e)])}static delete(i){return new a([new Hc(i,"")])}static fromJson(i){return new a(i.map(Hc.fromJson))}static compose(i){if(i.length===0)return a.empty;let e=i[0];for(let t=1;t<i.length;t++)e=e.compose(i[t]);return e}static composeSequentialReplacements(i){let e=a.empty,t=[];for(let o of i){let n=t.at(-1);!n||o.replaceRange.isBefore(n.replaceRange)?t.push(o):(e=e.compose(a.create(t.reverse())),t=[o])}return e=e.compose(a.create(t.reverse())),e}constructor(i){super(i)}_createNew(i){return new a(i)}},Hc=class a extends Yht{static insert(i,e){return new a(di.emptyAt(i),e)}static replace(i,e){return new a(i,e)}static delete(i){return new a(i,"")}static fromJson(i){return new a(di.ofStartAndLength(i.pos,i.len),i.txt)}equals(i){return this.replaceRange.equals(i.replaceRange)&&this.newText===i.newText}tryJoinTouching(i){return new a(this.replaceRange.joinRightTouching(i.replaceRange),this.newText+i.newText)}slice(i,e){return new a(i,e?e.substring(this.newText):this.newText)}};function wXt(a,i){a=a.slice();let e=[],t=0;for(let o of i.replacements){for(;;){let r=a[0];if(!r||r.endExclusive>=o.replaceRange.start)break;a.shift(),e.push(r.delta(t))}let n=[];for(;;){let r=a[0];if(!r||!r.intersectsOrTouches(o.replaceRange))break;a.shift(),n.push(r)}for(let r=n.length-1;r>=0;r--){let s=n[r],l=s.intersect(o.replaceRange).length;s=s.deltaEnd(-l+(r===0?o.newText.length:0));let c=s.start-o.replaceRange.start;c>0&&(s=s.delta(-c)),r!==0&&(s=s.delta(o.newText.length)),s=s.delta(-(o.newText.length-o.replaceRange.length)),a.unshift(s)}t+=o.newText.length-o.replaceRange.length}for(;;){let o=a[0];if(!o)break;a.shift(),e.push(o.delta(t))}return e}var OI=class a extends USe{static{this.empty=new a([])}static create(i){return new a(i)}static single(i){return new a([i])}static replace(i,e,t){return new a([new HSe(i,e,t)])}static insert(i,e,t){return new a([new HSe(di.emptyAt(i),e,t)])}static delete(i,e){return new a([new HSe(i,"",e)])}static compose(i){if(i.length===0)return a.empty;let e=i[0];for(let t=1;t<i.length;t++)e=e.compose(i[t]);return e}constructor(i){super(i)}_createNew(i){return new a(i)}toStringEdit(i){let e=[];for(let t of this.replacements)(!i||i(t))&&e.push(new Hc(t.replaceRange,t.newText));return new Qc(e)}},HSe=class a extends Yht{constructor(e,t,o){super(e,t);this.data=o}static insert(e,t,o){return new a(di.emptyAt(e),t,o)}static replace(e,t,o){return new a(e,t,o)}static delete(e,t){return new a(e,"",t)}equals(e){return this.replaceRange.equals(e.replaceRange)&&this.newText===e.newText&&this.data===e.data}tryJoinTouching(e){let t=this.data.join(e.data);if(t!==void 0)return new a(this.replaceRange.joinRightTouching(e.replaceRange),this.newText+e.newText,t)}slice(e,t){return new a(e,t?t.substring(this.newText):this.newText,this.data)}};function nPo(a,i){return a.isEmpty&&i.isEmpty&&a.start===i.start}function D2i(a,i){return a.isEmpty&&i.start<a.start&&a.start<i.endExclusive}r2i({StringEdit:Qc,StringReplacement:Hc,TextReplacement:Xr,TextEdit:bp,TextLength:Zl});var Xht=class a{constructor(i=null){this._foreignModule=i;this._requestHandlerBrand=void 0;this._workerTextModelSyncServer=new Qht}dispose(){}async $ping(){return"pong"}_getModel(i){return this._workerTextModelSyncServer.getModel(i)}getModels(){return this._workerTextModelSyncServer.getModels()}$acceptNewModel(i){this._workerTextModelSyncServer.$acceptNewModel(i)}$acceptModelChanged(i,e){this._workerTextModelSyncServer.$acceptModelChanged(i,e)}$acceptRemovedModel(i){this._workerTextModelSyncServer.$acceptRemovedModel(i)}async $computeUnicodeHighlights(i,e,t){let o=this._getModel(i);return o?Ise.computeUnicodeHighlights(o,e,t):{ranges:[],hasMore:!1,ambiguousCharacterCount:0,invisibleCharacterCount:0,nonBasicAsciiCharacterCount:0}}async $findSectionHeaders(i,e){let t=this._getModel(i);return t?k2i(t,e):[]}async $computeDiff(i,e,t,o){let n=this._getModel(i),r=this._getModel(e);return!n||!r?null:a.computeDiff(n,r,t,o)}static computeDiff(i,e,t,o){let n=o==="advanced"?_U.getDefault():_U.getLegacy(),r=i.getLinesContent(),s=e.getLinesContent(),l=n.computeDiff(r,s,t),c=l.changes.length>0?!1:this._modelsAreIdentical(i,e);function u(p){return p.map(h=>[h.original.startLineNumber,h.original.endLineNumberExclusive,h.modified.startLineNumber,h.modified.endLineNumberExclusive,h.innerChanges?.map(g=>[g.originalRange.startLineNumber,g.originalRange.startColumn,g.originalRange.endLineNumber,g.originalRange.endColumn,g.modifiedRange.startLineNumber,g.modifiedRange.startColumn,g.modifiedRange.endLineNumber,g.modifiedRange.endColumn])])}return{identical:c,quitEarly:l.hitTimeout,changes:u(l.changes),moves:l.moves.map(p=>[p.lineRangeMapping.original.startLineNumber,p.lineRangeMapping.original.endLineNumberExclusive,p.lineRangeMapping.modified.startLineNumber,p.lineRangeMapping.modified.endLineNumberExclusive,u(p.changes)])}}static _modelsAreIdentical(i,e){let t=i.getLineCount(),o=e.getLineCount();if(t!==o)return!1;for(let n=1;n<=t;n++){let r=i.getLineContent(n),s=e.getLineContent(n);if(r!==s)return!1}return!0}async $computeDirtyDiff(i,e,t){let o=this._getModel(i),n=this._getModel(e);if(!o||!n)return null;let r=o.getLinesContent(),s=n.getLinesContent();return new w$e(r,s,{shouldComputeCharChanges:!1,shouldPostProcessCharChanges:!1,shouldIgnoreTrimWhitespace:t,shouldMakePrettyDiff:!0,maxComputationTime:1e3}).computeDiff().changes}$computeStringDiff(i,e,t,o){return rPo(i,e,t,o).toJson()}static{this._diffLimit=1e5}async $computeMoreMinimalEdits(i,e,t){let o=this._getModel(i);if(!o)return e;let n=[],r;e=e.slice(0).sort((l,c)=>{if(l.range&&c.range)return z.compareRangesUsingStarts(l.range,c.range);let u=l.range?0:1,p=c.range?0:1;return u-p});let s=0;for(let l=1;l<e.length;l++)z.getEndPosition(e[s].range).equals(z.getStartPosition(e[l].range))?(e[s].range=z.fromPositions(z.getStartPosition(e[s].range),z.getEndPosition(e[l].range)),e[s].text+=e[l].text):(s++,e[s]=e[l]);e.length=s+1;for(let{range:l,text:c,eol:u}of e){if(typeof u=="number"&&(r=u),z.isEmpty(l)&&!c)continue;let p=o.getValueInRange(l);if(c=c.replace(/\r\n|\n|\r/g,o.eol),p===c)continue;if(Math.max(c.length,p.length)>a._diffLimit){n.push({range:l,text:c});continue}let h=e2i(p,c,t),g=o.offsetAt(z.lift(l).getStartPosition());for(let f of h){let v=o.positionAt(g+f.originalStart),b=o.positionAt(g+f.originalStart+f.originalLength),S={text:c.substr(f.modifiedStart,f.modifiedLength),range:{startLineNumber:v.lineNumber,startColumn:v.column,endLineNumber:b.lineNumber,endColumn:b.column}};o.getValueInRange(S.range)!==S.text&&n.push(S)}}return typeof r=="number"&&n.push({eol:r,text:"",range:{startLineNumber:0,startColumn:0,endLineNumber:0,endColumn:0}}),n}$computeHumanReadableDiff(i,e,t){let o=this._getModel(i);if(!o)return e;let n=[],r;e=e.slice(0).sort((s,l)=>{if(s.range&&l.range)return z.compareRangesUsingStarts(s.range,l.range);let c=s.range?0:1,u=l.range?0:1;return c-u});for(let{range:s,text:l,eol:c}of e){let v=function(S,y){return new Ie(S.lineNumber+y.lineNumber-1,y.lineNumber===1?S.column+y.column-1:y.column)},b=function(S,y){let w=[];for(let k=y.startLineNumber;k<=y.endLineNumber;k++){let T=S[k-1];k===y.startLineNumber&&k===y.endLineNumber?w.push(T.substring(y.startColumn-1,y.endColumn-1)):k===y.startLineNumber?w.push(T.substring(y.startColumn-1)):k===y.endLineNumber?w.push(T.substring(0,y.endColumn-1)):w.push(T)}return w};if(typeof c=="number"&&(r=c),z.isEmpty(s)&&!l)continue;let u=o.getValueInRange(s);if(l=l.replace(/\r\n|\n|\r/g,o.eol),u===l)continue;if(Math.max(l.length,u.length)>a._diffLimit){n.push({range:s,text:l});continue}let p=u.split(/\r\n|\n|\r/),h=l.split(/\r\n|\n|\r/),g=_U.getDefault().computeDiff(p,h,t),f=z.lift(s).getStartPosition();for(let S of g.changes)if(S.innerChanges)for(let y of S.innerChanges)n.push({range:z.fromPositions(v(f,y.originalRange.getStartPosition()),v(f,y.originalRange.getEndPosition())),text:b(h,y.modifiedRange).join(o.eol)});else throw new ni("The experimental diff algorithm always produces inner changes")}return typeof r=="number"&&n.push({eol:r,text:"",range:{startLineNumber:0,startColumn:0,endLineNumber:0,endColumn:0}}),n}async $computeLinks(i){let e=this._getModel(i);return e?i2i(e):null}async $computeDefaultDocumentColors(i){let e=this._getModel(i);return e?C2i(e):null}static{this._suggestionsLimit=1e4}async $textualSuggest(i,e,t,o){let n=new En,r=new RegExp(t,o),s=new Set;e:for(let l of i){let c=this._getModel(l);if(c){for(let u of c.words(r))if(!(u===e||!isNaN(Number(u)))&&(s.add(u),s.size>a._suggestionsLimit))break e}}return{words:Array.from(s),duration:n.elapsed()}}async $computeWordRanges(i,e,t,o){let n=this._getModel(i);if(!n)return Object.create(null);let r=new RegExp(t,o),s=Object.create(null);for(let l=e.startLineNumber;l<e.endLineNumber;l++){let c=n.getLineWords(l,r);for(let u of c){if(!isNaN(Number(u.word)))continue;let p=s[u.word];p||(p=[],s[u.word]=p),p.push({startLineNumber:l,startColumn:u.startColumn,endLineNumber:l,endColumn:u.endColumn})}}return s}async $navigateValueSet(i,e,t,o,n){let r=this._getModel(i);if(!r)return null;let s=new RegExp(o,n);e.startColumn===e.endColumn&&(e={startLineNumber:e.startLineNumber,startColumn:e.startColumn,endLineNumber:e.endLineNumber,endColumn:e.endColumn+1});let l=r.getValueInRange(e),c=r.getWordAtPosition({lineNumber:e.startLineNumber,column:e.startColumn},s);if(!c)return null;let u=r.getValueInRange(c);return Wht.INSTANCE.navigateValueSet(e,l,c,u,t)}$fmr(i,e){if(!this._foreignModule||typeof this._foreignModule[i]!="function")return Promise.reject(new Error("Missing requestHandler or method: "+i));try{return Promise.resolve(this._foreignModule[i].apply(this._foreignModule,e))}catch(t){return Promise.reject(t)}}};typeof importScripts=="function"&&(globalThis.monaco=o2i());function rPo(a,i,e,t){let o=t==="advanced"?_U.getDefault():_U.getLegacy();let n=new _S(a),r=n.getLines(),s=new _S(i),l=s.getLines(),c=o.computeDiff(r,l,{ignoreTrimWhitespace:!1,maxComputationTimeMs:e.maxComputationTimeMs,computeMoves:!1,extendToSubwords:!1}),u=wf.toTextEdit(c.changes,s);return n.getTransformer().getStringEdit(u)}var Nn=ae("textResourceConfigurationService"),sL=ae("textResourcePropertiesService");var zt=ae("ILanguageFeaturesService");var Jht=class a{static{this.CHANNEL_NAME="editorWorkerHost"}static getChannel(i){return i.getChannel(a.CHANNEL_NAME)}static setChannel(i,e){i.setChannel(a.CHANNEL_NAME,e)}};function L2i(){return to.defaultChatAgent?.completionsEnablementSetting}function zSe(a,i="*"){let e=L2i();return e?Zht(a.getValue(e),i):!1}function R2i(a,i,e="*"){let t=L2i();return t?Zht(a.getValue(i,t),e):!1}function Zht(a,i="*"){return yi(a)?typeof a[i]<"u"?!!a[i]:!!a["*"]:!1}var M2i=300*1e3;function LU(a,i){let e=a.getModel(i);return!(!e||e.isTooLargeForSyncing())}var e9=class extends C{constructor(e,t,o,n,r,s){super();this._languageConfigurationService=n;this._webWorkerService=s;this._modelService=e,this._workerManager=this._register(new L$e(e9.workerDescriptor,this._modelService,this._webWorkerService)),this._logService=o,this._register(r.linkProvider.register({language:"*",hasAccessToAllModels:!0},{provideLinks:async(l,c)=>{if(!LU(this._modelService,l.uri))return Promise.resolve({links:[]});let p=await(await this._workerWithResources([l.uri])).$computeLinks(l.uri.toString());return p&&{links:p}}})),this._register(r.completionProvider.register("*",new CXt(this._workerManager,t,this._modelService,this._languageConfigurationService,this._logService,r)))}static{this.workerDescriptor=new gx({esmModuleLocation:()=>gn.asBrowserUri("vs/editor/common/services/editorWebWorkerMain.js"),esmModuleLocationBundler:()=>new URL("../../common/services/editorWebWorkerMain.ts?esm",import.meta.url),label:"editorWorkerService"})}dispose(){super.dispose()}canComputeUnicodeHighlights(e){return LU(this._modelService,e)}async computedUnicodeHighlights(e,t,o){return(await this._workerWithResources([e])).$computeUnicodeHighlights(e.toString(),t,o)}async computeDiff(e,t,o,n){let s=await(await this._workerWithResources([e,t],!0)).$computeDiff(e.toString(),t.toString(),o,n);if(!s)return null;return{identical:s.identical,quitEarly:s.quitEarly,changes:c(s.changes),moves:s.moves.map(u=>new LSe(new NI(new ro(u[0],u[1]),new ro(u[2],u[3])),c(u[4])))};function c(u){return u.map(p=>new wf(new ro(p[0],p[1]),new ro(p[2],p[3]),p[4]?.map(h=>new cg(new z(h[0],h[1],h[2],h[3]),new z(h[4],h[5],h[6],h[7])))))}}canComputeDirtyDiff(e,t){return LU(this._modelService,e)&&LU(this._modelService,t)}async computeDirtyDiff(e,t,o){return(await this._workerWithResources([e,t])).$computeDirtyDiff(e.toString(),t.toString(),o)}async computeMoreMinimalEdits(e,t,o=!1){if(dr(t)){if(!LU(this._modelService,e))return Promise.resolve(t);let n=En.create(),r=this._workerWithResources([e]).then(s=>s.$computeMoreMinimalEdits(e.toString(),t,o));return r.finally(()=>this._logService.trace("FORMAT#computeMoreMinimalEdits",e.toString(!0),n.elapsed())),Promise.race([r,Pi(1e3).then(()=>t)])}else return Promise.resolve(void 0)}computeHumanReadableDiff(e,t){if(dr(t)){if(!LU(this._modelService,e))return Promise.resolve(t);let o=En.create(),n={ignoreTrimWhitespace:!1,maxComputationTimeMs:1e3,computeMoves:!1},r=this._workerWithResources([e]).then(s=>s.$computeHumanReadableDiff(e.toString(),t,n)).catch(s=>(mt(s),this.computeMoreMinimalEdits(e,t,!0)));return r.finally(()=>this._logService.trace("FORMAT#computeHumanReadableDiff",e.toString(!0),o.elapsed())),r}else return Promise.resolve(void 0)}async computeStringEditFromDiff(e,t,o,n){try{let s=await(await this._workerWithResources([])).$computeStringDiff(e,t,o,n);return Qc.fromJson(s)}catch(r){return mt(r),Qc.replace(di.ofLength(e.length),t)}}canNavigateValueSet(e){return LU(this._modelService,e)}async navigateValueSet(e,t,o){let n=this._modelService.getModel(e);if(!n)return null;let r=this._languageConfigurationService.getLanguageConfiguration(n.getLanguageId()).getWordDefinition(),s=r.source,l=r.flags;return(await this._workerWithResources([e])).$navigateValueSet(e.toString(),t,o,s,l)}canComputeWordRanges(e){return LU(this._modelService,e)}async computeWordRanges(e,t){let o=this._modelService.getModel(e);if(!o)return Promise.resolve(null);let n=this._languageConfigurationService.getLanguageConfiguration(o.getLanguageId()).getWordDefinition(),r=n.source,s=n.flags;return(await this._workerWithResources([e])).$computeWordRanges(e.toString(),t,r,s)}async findSectionHeaders(e,t){return(await this._workerWithResources([e])).$findSectionHeaders(e.toString(),t)}async computeDefaultDocumentColors(e){return(await this._workerWithResources([e])).$computeDefaultDocumentColors(e.toString())}async _workerWithResources(e,t=!1){return await(await this._workerManager.withWorker()).workerWithSyncedResources(e,t)}};e9=I([m(0,Ct),m(1,Nn),m(2,ne),m(3,bs),m(4,zt),m(5,Ay)],e9);var CXt=class{constructor(i,e,t,o,n,r){this.languageConfigurationService=o;this.logService=n;this.languageFeaturesService=r;this._debugDisplayName="wordbasedCompletions";this._workerManager=i,this._configurationService=e,this._modelService=t}async provideCompletionItems(i,e){let t=this._configurationService.getValue(i.uri,e,"editor");if(t.wordBasedSuggestions==="off"||t.wordBasedSuggestions==="offWithInlineSuggestions"&&this.languageFeaturesService.inlineCompletionsProvider.has(i)&&R2i(this._configurationService,i.uri,i.getLanguageId()))return;let o=[];if(t.wordBasedSuggestions==="currentDocument")LU(this._modelService,i.uri)&&o.push(i.uri);else for(let p of this._modelService.getModels())LU(this._modelService,p.uri)&&(p===i?o.unshift(p.uri):(t.wordBasedSuggestions==="allDocuments"||p.getLanguageId()===i.getLanguageId())&&o.push(p.uri));if(o.length===0)return;let n=this.languageConfigurationService.getLanguageConfiguration(i.getLanguageId()).getWordDefinition(),r=i.getWordAtPosition(e),s=r?new z(e.lineNumber,r.startColumn,e.lineNumber,r.endColumn):z.fromPositions(e),l=s.setEndPosition(e.lineNumber,e.column);this.logService.trace("[WordBasedCompletionItemProvider]",`word: "${r?.word||""}", wordDef: "${n}", replace: [${s.toString()}], insert: [${l.toString()}]`);let u=await(await this._workerManager.withWorker()).textualSuggest(o,r?.word,n);if(u)return{duration:u.duration,suggestions:u.words.map(p=>({kind:18,label:p,insertText:p,range:{insert:l,replace:s}}))}}},L$e=class extends C{constructor(e,t,o){super();this._workerDescriptor=e;this._modelService=t,this._webWorkerService=o,this._editorWorkerClient=null,this._lastWorkerUsedTime=new Date().getTime(),this._register(new ZD).cancelAndSet(()=>this._checkStopIdleWorker(),Math.round(M2i/2),It),this._register(this._modelService.onModelRemoved(r=>this._checkStopEmptyWorker()))}dispose(){this._editorWorkerClient&&(this._editorWorkerClient.dispose(),this._editorWorkerClient=null),super.dispose()}_checkStopEmptyWorker(){if(!this._editorWorkerClient)return;this._modelService.getModels().length===0&&(this._editorWorkerClient.dispose(),this._editorWorkerClient=null)}_checkStopIdleWorker(){if(!this._editorWorkerClient)return;new Date().getTime()-this._lastWorkerUsedTime>M2i&&(this._editorWorkerClient.dispose(),this._editorWorkerClient=null)}withWorker(){return this._lastWorkerUsedTime=new Date().getTime(),this._editorWorkerClient||(this._editorWorkerClient=new R$e(this._workerDescriptor,!1,this._modelService,this._webWorkerService)),Promise.resolve(this._editorWorkerClient)}};L$e=I([m(1,Ct),m(2,Ay)],L$e);var xXt=class{constructor(i){this._instance=i,this.proxy=this._instance}dispose(){this._instance.dispose()}setChannel(i,e){throw new Error("Not supported")}getChannel(i){throw new Error("Not supported")}},R$e=class extends C{constructor(e,t,o,n){super();this._workerDescriptorOrWorker=e;this._disposed=!1;this._modelService=o,this._webWorkerService=n,this._keepIdleModels=t,this._worker=null,this._modelManager=null}fhr(e,t){throw new Error("Not implemented!")}_getOrCreateWorker(){if(!this._worker)try{this._worker=this._register(this._webWorkerService.createWorkerClient(this._workerDescriptorOrWorker)),Jht.setChannel(this._worker,this._createEditorWorkerHost())}catch(e){Rht(e),this._worker=this._createFallbackLocalWorker()}return this._worker}async _getProxy(){try{let e=this._getOrCreateWorker().proxy;return await e.$ping(),e}catch(e){return Rht(e),this._worker=this._createFallbackLocalWorker(),this._worker.proxy}}_createFallbackLocalWorker(){return new xXt(new Xht(null))}_createEditorWorkerHost(){return{$fhr:(e,t)=>this.fhr(e,t)}}_getOrCreateModelManager(e){return this._modelManager||(this._modelManager=this._register(new Z6(e,this._modelService,this._keepIdleModels))),this._modelManager}async workerWithSyncedResources(e,t=!1){if(this._disposed)return Promise.reject(CI());let o=await this._getProxy();return this._getOrCreateModelManager(o).ensureSyncedResources(e,t),o}async textualSuggest(e,t,o){let n=await this.workerWithSyncedResources(e),r=o.source,s=o.flags;return n.$textualSuggest(e.map(l=>l.toString()),t,r,s)}dispose(){super.dispose(),this._disposed=!0}};R$e=I([m(2,Ct),m(3,Ay)],R$e);var RU=ae("markerDecorationsService");var Cse=class{static{this.ID="editor.contrib.markerDecorations"}constructor(i,e){}dispose(){}};Cse=I([m(1,RU)],Cse);we($s,e9,0);go(Cse.ID,Cse,0);var Bg=class{constructor(i){this.domNode=i;this._maxWidth="";this._width="";this._height="";this._top="";this._left="";this._bottom="";this._right="";this._paddingTop="";this._paddingLeft="";this._paddingBottom="";this._paddingRight="";this._fontFamily="";this._fontWeight="";this._fontSize="";this._fontStyle="";this._fontFeatureSettings="";this._fontVariationSettings="";this._textDecoration="";this._lineHeight="";this._letterSpacing="";this._className="";this._display="";this._position="";this._visibility="";this._color="";this._backgroundColor="";this._layerHint=!1;this._contain="none";this._boxShadow=""}focus(){this.domNode.focus()}setMaxWidth(i){let e=aL(i);this._maxWidth!==e&&(this._maxWidth=e,this.domNode.style.maxWidth=this._maxWidth)}setWidth(i){let e=aL(i);this._width!==e&&(this._width=e,this.domNode.style.width=this._width)}setHeight(i){let e=aL(i);this._height!==e&&(this._height=e,this.domNode.style.height=this._height)}setTop(i){let e=aL(i);this._top!==e&&(this._top=e,this.domNode.style.top=this._top)}setLeft(i){let e=aL(i);this._left!==e&&(this._left=e,this.domNode.style.left=this._left)}setBottom(i){let e=aL(i);this._bottom!==e&&(this._bottom=e,this.domNode.style.bottom=this._bottom)}setRight(i){let e=aL(i);this._right!==e&&(this._right=e,this.domNode.style.right=this._right)}setPaddingTop(i){let e=aL(i);this._paddingTop!==e&&(this._paddingTop=e,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(i){let e=aL(i);this._paddingLeft!==e&&(this._paddingLeft=e,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(i){let e=aL(i);this._paddingBottom!==e&&(this._paddingBottom=e,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(i){let e=aL(i);this._paddingRight!==e&&(this._paddingRight=e,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(i){this._fontFamily!==i&&(this._fontFamily=i,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(i){this._fontWeight!==i&&(this._fontWeight=i,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(i){let e=aL(i);this._fontSize!==e&&(this._fontSize=e,this.domNode.style.fontSize=this._fontSize)}setFontStyle(i){this._fontStyle!==i&&(this._fontStyle=i,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(i){this._fontFeatureSettings!==i&&(this._fontFeatureSettings=i,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(i){this._fontVariationSettings!==i&&(this._fontVariationSettings=i,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(i){this._textDecoration!==i&&(this._textDecoration=i,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(i){let e=aL(i);this._lineHeight!==e&&(this._lineHeight=e,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(i){let e=aL(i);this._letterSpacing!==e&&(this._letterSpacing=e,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(i){this._className!==i&&(this._className=i,this.domNode.className=this._className)}toggleClassName(i,e){this.domNode.classList.toggle(i,e),this._className=this.domNode.className}setDisplay(i){this._display!==i&&(this._display=i,this.domNode.style.display=this._display)}setPosition(i){this._position!==i&&(this._position=i,this.domNode.style.position=this._position)}setVisibility(i){this._visibility!==i&&(this._visibility=i,this.domNode.style.visibility=this._visibility)}setColor(i){this._color!==i&&(this._color=i,this.domNode.style.color=this._color)}setBackgroundColor(i){this._backgroundColor!==i&&(this._backgroundColor=i,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(i){this._layerHint!==i&&(this._layerHint=i,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(i){this._boxShadow!==i&&(this._boxShadow=i,this.domNode.style.boxShadow=i)}setContain(i){this._contain!==i&&(this._contain=i,this.domNode.style.contain=this._contain)}setAttribute(i,e){this.domNode.setAttribute(i,e)}removeAttribute(i){this.domNode.removeAttribute(i)}appendChild(i){this.domNode.appendChild(i.domNode)}removeChild(i){this.domNode.removeChild(i.domNode)}};function aL(a){return typeof a=="number"?`${a}px`:a}function or(a){return new Bg(a)}function Pd(a,i){a instanceof Bg?(a.setFontFamily(i.getMassagedFontFamily()),a.setFontWeight(i.fontWeight),a.setFontSize(i.fontSize),a.setFontFeatureSettings(i.fontFeatureSettings),a.setFontVariationSettings(i.fontVariationSettings),a.setLineHeight(i.lineHeight),a.setLetterSpacing(i.letterSpacing)):(a.style.fontFamily=i.getMassagedFontFamily(),a.style.fontWeight=i.fontWeight,a.style.fontSize=i.fontSize+"px",a.style.fontFeatureSettings=i.fontFeatureSettings,a.style.fontVariationSettings=i.fontVariationSettings,a.style.lineHeight=i.lineHeight+"px",a.style.letterSpacing=i.letterSpacing+"px")}var t9=class extends C{constructor(e,t){super();this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._referenceDomElement=e,this._width=-1,this._height=-1,this._resizeObserver=null,this.measureReferenceDomElement(!1,t)}dispose(){this.stopObserving(),super.dispose()}getWidth(){return this._width}getHeight(){return this._height}startObserving(){if(!this._resizeObserver&&this._referenceDomElement){let e=null,t=()=>{e?this.observe({width:e.width,height:e.height}):this.observe()},o=!1,n=!1,r=()=>{if(o&&!n)try{o=!1,n=!0,t()}finally{$r(Me(this._referenceDomElement),()=>{n=!1,r()})}};this._resizeObserver=new ResizeObserver(s=>{s&&s[0]&&s[0].contentRect?e={width:s[0].contentRect.width,height:s[0].contentRect.height}:e=null,o=!0,r()}),this._resizeObserver.observe(this._referenceDomElement)}}stopObserving(){this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null)}observe(e){this.measureReferenceDomElement(!0,e)}measureReferenceDomElement(e,t){let o=0,n=0;t?(o=t.width,n=t.height):this._referenceDomElement&&(o=this._referenceDomElement.clientWidth,n=this._referenceDomElement.clientHeight),o=Math.max(5,o),n=Math.max(5,n),(this._width!==o||this._height!==n)&&(this._width=o,this._height=n,e&&this._onDidChange.fire())}};var kXt=class extends C{constructor(e){super();this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._listener=()=>this._handleChange(e,!0),this._mediaQueryList=null,this._handleChange(e,!1),this._register(Z(()=>this._mediaQueryList?.removeEventListener("change",this._listener)))}_handleChange(e,t){this._mediaQueryList?.removeEventListener("change",this._listener),this._mediaQueryList=e.matchMedia(`(resolution: ${e.devicePixelRatio}dppx)`),this._mediaQueryList.addEventListener("change",this._listener),t&&this._onDidChange.fire()}},EXt=class extends C{constructor(e){super();this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._value=this._getPixelRatio(e);let t=this._register(new kXt(e));this._register(t.onDidChange(()=>{this._value=this._getPixelRatio(e),this._onDidChange.fire(this._value)}))}get value(){return this._value}_getPixelRatio(e){let t=document.createElement("canvas").getContext("2d"),o=e.devicePixelRatio||1,n=t?.webkitBackingStorePixelRatio||t?.mozBackingStorePixelRatio||t?.msBackingStorePixelRatio||t?.oBackingStorePixelRatio||t?.backingStorePixelRatio||1;return o/n}},TXt=class{constructor(){this.mapWindowIdToPixelRatioMonitor=new Map}_getOrCreatePixelRatioMonitor(i){let e=sg(i),t=this.mapWindowIdToPixelRatioMonitor.get(e);return t||(t=Mp(new EXt(i)),this.mapWindowIdToPixelRatioMonitor.set(e,t),Mp(H.once(Izi)(({vscodeWindowId:o})=>{o===e&&(t?.dispose(),this.mapWindowIdToPixelRatioMonitor.delete(e))}))),t}getInstance(i){return this._getOrCreatePixelRatioMonitor(i)}},Xd=new TXt;var egt=class{constructor(i,e){this.chr=i,this.type=e,this.width=0}fulfill(i){this.width=i}},_Xt=class a{constructor(i,e){this._bareFontInfo=i,this._requests=e,this._container=null,this._testElements=null}read(i){this._createDomElements(),i.document.body.appendChild(this._container),this._readFromDomElements(),this._container?.remove(),this._container=null,this._testElements=null}_createDomElements(){let i=document.createElement("div");i.style.position="absolute",i.style.top="-50000px",i.style.width="50000px";let e=document.createElement("div");Pd(e,this._bareFontInfo),i.appendChild(e);let t=document.createElement("div");Pd(t,this._bareFontInfo),t.style.fontWeight="bold",i.appendChild(t);let o=document.createElement("div");Pd(o,this._bareFontInfo),o.style.fontStyle="italic",i.appendChild(o);let n=[];for(let r of this._requests){let s;r.type===0&&(s=e),r.type===2&&(s=t),r.type===1&&(s=o),s.appendChild(document.createElement("br"));let l=document.createElement("span");a._render(l,r),s.appendChild(l),n.push(l)}this._container=i,this._testElements=n}static _render(i,e){if(e.chr===" "){let t="\xA0";for(let o=0;o<8;o++)t+=t;i.innerText=t}else{let t=e.chr;for(let o=0;o<8;o++)t+=t;i.textContent=t}}_readFromDomElements(){for(let i=0,e=this._requests.length;i<e;i++){let t=this._requests[i],o=this._testElements[i];t.fulfill(o.offsetWidth/256)}}};function P2i(a,i,e){new _Xt(i,e).read(a)}var DXt=class extends C{constructor(){super(...arguments);this._cache=new Map;this._evictUntrustedReadingsTimeout=-1;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event}dispose(){this._evictUntrustedReadingsTimeout!==-1&&(clearTimeout(this._evictUntrustedReadingsTimeout),this._evictUntrustedReadingsTimeout=-1),super.dispose()}clearAllFontInfos(){this._cache.clear(),this._onDidChange.fire()}_ensureCache(e){let t=sg(e),o=this._cache.get(t);return o||(o=new LXt,this._cache.set(t,o)),o}_writeToCache(e,t,o){this._ensureCache(e).put(t,o),!o.isTrusted&&this._evictUntrustedReadingsTimeout===-1&&(this._evictUntrustedReadingsTimeout=e.setTimeout(()=>{this._evictUntrustedReadingsTimeout=-1,this._evictUntrustedReadings(e)},5e3))}_evictUntrustedReadings(e){let t=this._ensureCache(e),o=t.getValues(),n=!1;for(let r of o)r.isTrusted||(n=!0,t.remove(r));n&&this._onDidChange.fire()}serializeFontInfo(e){return this._ensureCache(e).getValues().filter(o=>o.isTrusted)}restoreFontInfo(e,t){for(let o of t){if(o.version!==k7t)continue;let n=new O6(o,!1);this._writeToCache(e,n,n)}}readFontInfo(e,t){let o=this._ensureCache(e);if(!o.has(t)){let n=this._actualReadFontInfo(e,t);(n.typicalHalfwidthCharacterWidth<=2||n.typicalFullwidthCharacterWidth<=2||n.spaceWidth<=2||n.maxDigitWidth<=2)&&(n=new O6({pixelRatio:Xd.getInstance(e).value,fontFamily:n.fontFamily,fontWeight:n.fontWeight,fontSize:n.fontSize,fontFeatureSettings:n.fontFeatureSettings,fontVariationSettings:n.fontVariationSettings,lineHeight:n.lineHeight,letterSpacing:n.letterSpacing,isMonospace:n.isMonospace,typicalHalfwidthCharacterWidth:Math.max(n.typicalHalfwidthCharacterWidth,5),typicalFullwidthCharacterWidth:Math.max(n.typicalFullwidthCharacterWidth,5),canUseHalfwidthRightwardsArrow:n.canUseHalfwidthRightwardsArrow,spaceWidth:Math.max(n.spaceWidth,5),middotWidth:Math.max(n.middotWidth,5),wsmiddotWidth:Math.max(n.wsmiddotWidth,5),maxDigitWidth:Math.max(n.maxDigitWidth,5)},!1)),this._writeToCache(e,t,n)}return o.get(t)}_createRequest(e,t,o,n){let r=new egt(e,t);return o.push(r),n?.push(r),r}_actualReadFontInfo(e,t){let o=[],n=[],r=this._createRequest("n",0,o,n),s=this._createRequest("\uFF4D",0,o,null),l=this._createRequest(" ",0,o,n),c=this._createRequest("0",0,o,n),u=this._createRequest("1",0,o,n),p=this._createRequest("2",0,o,n),h=this._createRequest("3",0,o,n),g=this._createRequest("4",0,o,n),f=this._createRequest("5",0,o,n),v=this._createRequest("6",0,o,n),b=this._createRequest("7",0,o,n),S=this._createRequest("8",0,o,n),y=this._createRequest("9",0,o,n),w=this._createRequest("\u2192",0,o,n),k=this._createRequest("\uFFEB",0,o,null),T=this._createRequest("\xB7",0,o,n),N=this._createRequest("\u2E31",0,o,null),O="|/-_ilm%";for(let te=0,pe=O.length;te<pe;te++)this._createRequest(O.charAt(te),0,o,n),this._createRequest(O.charAt(te),1,o,n),this._createRequest(O.charAt(te),2,o,n);P2i(e,t,o);let V=Math.max(c.width,u.width,p.width,h.width,g.width,f.width,v.width,b.width,S.width,y.width),U=t.fontFeatureSettings===mx.OFF,G=n[0].width;for(let te=1,pe=n.length;U&&te<pe;te++){let de=G-n[te].width;if(de<-.001||de>.001){U=!1;break}}let $=!0;return U&&k.width!==G&&($=!1),k.width>w.width&&($=!1),new O6({pixelRatio:Xd.getInstance(e).value,fontFamily:t.fontFamily,fontWeight:t.fontWeight,fontSize:t.fontSize,fontFeatureSettings:t.fontFeatureSettings,fontVariationSettings:t.fontVariationSettings,lineHeight:t.lineHeight,letterSpacing:t.letterSpacing,isMonospace:U,typicalHalfwidthCharacterWidth:r.width,typicalFullwidthCharacterWidth:s.width,canUseHalfwidthRightwardsArrow:$,spaceWidth:l.width,middotWidth:T.width,wsmiddotWidth:N.width,maxDigitWidth:V},!0)}},LXt=class{constructor(){this._keys=Object.create(null),this._values=Object.create(null)}has(i){let e=i.getId();return!!this._values[e]}get(i){let e=i.getId();return this._values[e]}put(i,e){let t=i.getId();this._keys[t]=i,this._values[t]=e}remove(i){let e=i.getId();delete this._keys[e],delete this._values[e]}getValues(){return Object.keys(this._keys).map(i=>this._values[i])}},Fy=new DXt;var xse=class a{constructor(i,e){this.key=i;this.migrate=e}static{this.items=[]}apply(i){let e=a._read(i,this.key),t=n=>a._read(i,n),o=(n,r)=>a._write(i,n,r);this.migrate(e,t,o)}static _read(i,e){if(typeof i>"u"||i===null)return;let t=e.indexOf(".");if(t>=0){let o=e.substring(0,t);return this._read(i[o],e.substring(t+1))}return i[e]}static _write(i,e,t){let o=e.indexOf(".");if(o>=0){let n=e.substring(0,o);i[n]=i[n]||{},this._write(i[n],e.substring(o+1),t);return}i[e]=t}};function lL(a,i){xse.items.push(new xse(a,i))}function fx(a,i){lL(a,(e,t,o)=>{if(typeof e<"u"){for(let[n,r]of i)if(e===n){o(a,r);return}}})}function A2i(a){xse.items.forEach(i=>i.apply(a))}fx("wordWrap",[[!0,"on"],[!1,"off"]]);fx("lineNumbers",[[!0,"on"],[!1,"off"]]);fx("cursorBlinking",[["visible","solid"]]);fx("renderWhitespace",[[!0,"boundary"],[!1,"none"]]);fx("renderLineHighlight",[[!0,"line"],[!1,"none"]]);fx("acceptSuggestionOnEnter",[[!0,"on"],[!1,"off"]]);fx("tabCompletion",[[!1,"off"],[!0,"onlySnippets"]]);fx("hover",[[!0,{enabled:!0}],[!1,{enabled:!1}]]);fx("parameterHints",[[!0,{enabled:!0}],[!1,{enabled:!1}]]);fx("autoIndent",[[!1,"advanced"],[!0,"full"]]);fx("matchBrackets",[[!0,"always"],[!1,"never"]]);fx("renderFinalNewline",[[!0,"on"],[!1,"off"]]);fx("cursorSmoothCaretAnimation",[[!0,"on"],[!1,"off"]]);fx("occurrencesHighlight",[[!0,"singleFile"],[!1,"off"]]);fx("wordBasedSuggestions",[[!0,"matchingDocuments"],[!1,"off"]]);fx("defaultColorDecorators",[[!0,"auto"],[!1,"never"]]);fx("minimap.autohide",[[!0,"mouseover"],[!1,"none"]]);lL("autoClosingBrackets",(a,i,e)=>{a===!1&&(e("autoClosingBrackets","never"),typeof i("autoClosingQuotes")>"u"&&e("autoClosingQuotes","never"),typeof i("autoSurround")>"u"&&e("autoSurround","never"))});lL("renderIndentGuides",(a,i,e)=>{typeof a<"u"&&(e("renderIndentGuides",void 0),typeof i("guides.indentation")>"u"&&e("guides.indentation",!!a))});lL("highlightActiveIndentGuide",(a,i,e)=>{typeof a<"u"&&(e("highlightActiveIndentGuide",void 0),typeof i("guides.highlightActiveIndentation")>"u"&&e("guides.highlightActiveIndentation",!!a))});var aPo={method:"showMethods",function:"showFunctions",constructor:"showConstructors",deprecated:"showDeprecated",field:"showFields",variable:"showVariables",class:"showClasses",struct:"showStructs",interface:"showInterfaces",module:"showModules",property:"showProperties",event:"showEvents",operator:"showOperators",unit:"showUnits",value:"showValues",constant:"showConstants",enum:"showEnums",enumMember:"showEnumMembers",keyword:"showKeywords",text:"showWords",color:"showColors",file:"showFiles",reference:"showReferences",folder:"showFolders",typeParameter:"showTypeParameters",snippet:"showSnippets"};lL("suggest.filteredTypes",(a,i,e)=>{if(a&&typeof a=="object"){for(let t of Object.entries(aPo))a[t[0]]===!1&&typeof i(`suggest.${t[1]}`)>"u"&&e(`suggest.${t[1]}`,!1);e("suggest.filteredTypes",void 0)}});lL("quickSuggestions",(a,i,e)=>{if(typeof a=="boolean"){let t=a?"on":"off";e("quickSuggestions",{comments:t,strings:t,other:t})}});lL("experimental.stickyScroll.enabled",(a,i,e)=>{typeof a=="boolean"&&(e("experimental.stickyScroll.enabled",void 0),typeof i("stickyScroll.enabled")>"u"&&e("stickyScroll.enabled",a))});lL("experimental.stickyScroll.maxLineCount",(a,i,e)=>{typeof a=="number"&&(e("experimental.stickyScroll.maxLineCount",void 0),typeof i("stickyScroll.maxLineCount")>"u"&&e("stickyScroll.maxLineCount",a))});lL("editor.experimentalEditContextEnabled",(a,i,e)=>{typeof a=="boolean"&&(e("editor.experimentalEditContextEnabled",void 0),typeof i("editor.editContext")>"u"&&e("editor.editContext",a))});lL("codeActionsOnSave",(a,i,e)=>{if(a&&typeof a=="object"){let t=!1,o={};for(let n of Object.entries(a))typeof n[1]=="boolean"?(t=!0,o[n[0]]=n[1]?"explicit":"never"):o[n[0]]=n[1];t&&e("codeActionsOnSave",o)}});lL("codeActionWidget.includeNearbyQuickfixes",(a,i,e)=>{typeof a=="boolean"&&(e("codeActionWidget.includeNearbyQuickfixes",void 0),typeof i("codeActionWidget.includeNearbyQuickFixes")>"u"&&e("codeActionWidget.includeNearbyQuickFixes",a))});lL("lightbulb.enabled",(a,i,e)=>{typeof a=="boolean"&&e("lightbulb.enabled",a?void 0:"off")});lL("inlineSuggest.edits.codeShifting",(a,i,e)=>{typeof a=="boolean"&&(e("inlineSuggest.edits.codeShifting",void 0),e("inlineSuggest.edits.allowCodeShifting",a?"always":"never"))});lL("hover.enabled",(a,i,e)=>{typeof a=="boolean"&&e("hover.enabled",a?"on":"off")});var RXt=class extends C{constructor(){super(...arguments);this._tabFocus=!1;this._onDidChangeTabFocus=this._register(new E);this.onDidChangeTabFocus=this._onDidChangeTabFocus.event}getTabFocusMode(){return this._tabFocus}setTabFocusMode(e){this._tabFocus=e,this._onDidChangeTabFocus.fire(this._tabFocus)}},GT=new RXt;function N2i(a,i,e){let t=a.get(58),o=a.get(62),n=a.get(61),r=a.get(60),s=a.get(63),l=a.get(75),c=a.get(72);return oSe._create(t,o,n,r,s,l,c,i,e)}function LS(a,i,e=!1){let t=zb.fontFamily.validate(a.fontFamily),o=zb.fontWeight.validate(a.fontWeight),n=zb.fontSize.validate(a.fontSize),r=zb.fontLigatures2.validate(a.fontLigatures),s=zb.fontVariations.validate(a.fontVariations),l=zb.lineHeight.validate(a.lineHeight),c=zb.letterSpacing.validate(a.letterSpacing);return oSe._create(t,o,n,r,s,l,c,i,e)}var i9=class extends C{constructor(e,t,o,n,r){super();this._accessibilityService=r;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._onDidChangeFast=this._register(new E);this.onDidChangeFast=this._onDidChangeFast.event;this._isDominatedByLongLines=!1;this._viewLineCount=1;this._lineNumbersDigitCount=1;this._reservedHeight=0;this._glyphMarginDecorationLaneCount=1;this._computeOptionsMemory=new jGe;this.isSimpleWidget=e,this.contextMenuId=t,this._containerObserver=this._register(new t9(n,o.dimension)),this._targetWindowId=Me(n).vscodeWindowId,this._rawOptions=O2i(o),this._validatedOptions=kse.validateOptions(this._rawOptions),this.options=this._computeOptions(),this.options.get(19)&&this._containerObserver.startObserving(),this._register($k.onDidChangeZoomLevel(()=>this._recomputeOptions())),this._register(GT.onDidChangeTabFocus(()=>this._recomputeOptions())),this._register(this._containerObserver.onDidChange(()=>this._recomputeOptions())),this._register(Fy.onDidChange(()=>this._recomputeOptions())),this._register(Xd.getInstance(Me(n)).onDidChange(()=>this._recomputeOptions())),this._register(this._accessibilityService.onDidChangeScreenReaderOptimized(()=>this._recomputeOptions())),this._register(nW.onDidChangeInputMode(()=>this._recomputeOptions()))}_recomputeOptions(){let e=this._computeOptions(),t=kse.checkEquals(this.options,e);t!==null&&(this.options=e,this._onDidChangeFast.fire(t),this._onDidChange.fire(t))}_computeOptions(){let e=this._readEnvConfiguration(),t=N2i(this._validatedOptions,e.pixelRatio,this.isSimpleWidget),o=this._readFontInfo(t),n={memory:this._computeOptionsMemory,outerWidth:e.outerWidth,outerHeight:e.outerHeight-this._reservedHeight,fontInfo:o,extraEditorClassName:e.extraEditorClassName,isDominatedByLongLines:this._isDominatedByLongLines,viewLineCount:this._viewLineCount,lineNumbersDigitCount:this._lineNumbersDigitCount,emptySelectionClipboard:e.emptySelectionClipboard,pixelRatio:e.pixelRatio,tabFocusMode:this._validatedOptions.get(164)||GT.getTabFocusMode(),inputMode:nW.getInputMode(),accessibilitySupport:e.accessibilitySupport,glyphMarginDecorationLaneCount:this._glyphMarginDecorationLaneCount,editContextSupported:e.editContextSupported};return kse.computeOptions(this._validatedOptions,n)}_readEnvConfiguration(){return{extraEditorClassName:cPo(),outerWidth:this._containerObserver.getWidth(),outerHeight:this._containerObserver.getHeight(),emptySelectionClipboard:H0||yc,pixelRatio:Xd.getInstance(qv(this._targetWindowId,!0).window).value,editContextSupported:typeof globalThis.EditContext=="function",accessibilitySupport:this._accessibilityService.isScreenReaderOptimized()?2:this._accessibilityService.getAccessibilitySupport()}}_readFontInfo(e){return Fy.readFontInfo(qv(this._targetWindowId,!0).window,e)}getRawOptions(){return this._rawOptions}updateOptions(e){let t=O2i(e);kse.applyUpdate(this._rawOptions,t)&&(this._validatedOptions=kse.validateOptions(this._rawOptions),this._recomputeOptions())}observeContainer(e){this._containerObserver.observe(e)}setIsDominatedByLongLines(e){this._isDominatedByLongLines!==e&&(this._isDominatedByLongLines=e,this._recomputeOptions())}setModelLineCount(e){let t=lPo(e);this._lineNumbersDigitCount!==t&&(this._lineNumbersDigitCount=t,this._recomputeOptions())}setViewLineCount(e){this._viewLineCount!==e&&(this._viewLineCount=e,this._recomputeOptions())}setReservedHeight(e){this._reservedHeight!==e&&(this._reservedHeight=e,this._recomputeOptions())}setGlyphMarginDecorationLaneCount(e){this._glyphMarginDecorationLaneCount!==e&&(this._glyphMarginDecorationLaneCount=e,this._recomputeOptions())}};i9=I([m(4,Bi)],i9);function lPo(a){let i=0;for(;a;)a=Math.floor(a/10),i++;return i||1}function cPo(){let a="";return Vb||qUi?(a+="no-minimap-shadow ",a+="enable-user-select "):a+="no-user-select ",it&&(a+="mac "),a}var MXt=class{constructor(){this._values=[]}_read(i){return this._values[i]}get(i){return this._values[i]}_write(i,e){this._values[i]=e}},PXt=class{constructor(){this._values=[]}_read(i){if(i>=this._values.length)throw new Error("Cannot read uninitialized value");return this._values[i]}get(i){return this._read(i)}_write(i,e){this._values[i]=e}},kse=class a{static validateOptions(i){let e=new MXt;for(let t of hU){let o=t.name==="_never_"?void 0:i[t.name];e._write(t.id,t.validate(o))}return e}static computeOptions(i,e){let t=new PXt;for(let o of hU)t._write(o.id,o.compute(e,t,i._read(o.id)));return t}static _deepEquals(i,e){if(typeof i!="object"||typeof e!="object"||!i||!e)return i===e;if(Array.isArray(i)||Array.isArray(e))return Array.isArray(i)&&Array.isArray(e)?$i(i,e):!1;if(Object.keys(i).length!==Object.keys(e).length)return!1;for(let t in i)if(!a._deepEquals(i[t],e[t]))return!1;return!0}static checkEquals(i,e){let t=[],o=!1;for(let n of hU){let r=!a._deepEquals(i._read(n.id),e._read(n.id));t[n.id]=r,r&&(o=!0)}return o?new xmt(t):null}static applyUpdate(i,e){let t=!1;for(let o of hU)if(e.hasOwnProperty(o.name)){let n=o.applyUpdate(i[o.name],e[o.name]);i[o.name]=n.newValue,t=t||n.didChange}return t}};function O2i(a){let i=Xi(a);return A2i(i),i}var vx;(O=>{let a={total:0,min:Number.MAX_VALUE,max:0},i={...a},e={...a},t={...a},o=0,n;($=>($[$.Before=0]="Before",$[$.InProgress=1]="InProgress",$[$.Finished=2]="Finished"))(n||={});let r={keydown:0,input:0,render:0};function s(){S(),performance.mark("inputlatency/start"),performance.mark("keydown/start"),r.keydown=1,queueMicrotask(l)}O.onKeyDown=s;function l(){r.keydown===1&&(performance.mark("keydown/end"),r.keydown=2)}function c(){performance.mark("input/start"),r.input=1,b()}O.onBeforeInput=c;function u(){r.input===0&&c(),queueMicrotask(p)}O.onInput=u;function p(){r.input===1&&(performance.mark("input/end"),r.input=2)}function h(){S()}O.onKeyUp=h;function g(){S()}O.onSelectionChange=g;function f(){r.keydown===2&&r.input===2&&r.render===0&&(performance.mark("render/start"),r.render=1,queueMicrotask(v),b())}O.onRenderStart=f;function v(){r.render===1&&(performance.mark("render/end"),r.render=2)}function b(){setTimeout(S)}function S(){r.keydown===2&&r.input===2&&r.render===2&&(performance.mark("inputlatency/end"),performance.measure("keydown","keydown/start","keydown/end"),performance.measure("input","input/start","input/end"),performance.measure("render","render/start","render/end"),performance.measure("inputlatency","inputlatency/start","inputlatency/end"),y("keydown",a),y("input",i),y("render",e),y("inputlatency",t),o++,w())}function y(V,U){let G=performance.getEntriesByName(V)[0].duration;U.total+=G,U.min=Math.min(U.min,G),U.max=Math.max(U.max,G)}function w(){performance.clearMarks("keydown/start"),performance.clearMarks("keydown/end"),performance.clearMarks("input/start"),performance.clearMarks("input/end"),performance.clearMarks("render/start"),performance.clearMarks("render/end"),performance.clearMarks("inputlatency/start"),performance.clearMarks("inputlatency/end"),performance.clearMeasures("keydown"),performance.clearMeasures("input"),performance.clearMeasures("render"),performance.clearMeasures("inputlatency"),r.keydown=0,r.input=0,r.render=0}function k(){if(o===0)return;let V={keydown:T(a),input:T(i),render:T(e),total:T(t),sampleCount:o};return N(a),N(i),N(e),N(t),o=0,V}O.getAndClearMeasurements=k;function T(V){return{average:V.total/o,max:V.max,min:V.min}}function N(V){V.total=0,V.min=Number.MAX_VALUE,V.max=0}})(vx||={});function pn(a){return a&&typeof a.getEditorType=="function"?a.getEditorType()===P$.ICodeEditor:!1}function Ec(a){return a&&typeof a.getEditorType=="function"?a.getEditorType()===P$.IDiffEditor:!1}function MU(a){return!!a&&typeof a=="object"&&typeof a.onDidChangeActiveEditor=="function"}function ca(a){return pn(a)?a:Ec(a)?a.getModifiedEditor():MU(a)&&pn(a.activeCodeEditor)?a.activeCodeEditor:null}function F2i(a){return pn(a)||Ec(a)?a:null}var KSe=new Map;function W2i(a){return KSe.has(a)}var NXt=class extends C{constructor(){super(...arguments);this._currentCssStyle="";this._styleSheet=void 0}setStyle(e){e!==this._currentCssStyle&&(this._currentCssStyle=e,this._styleSheet?this._styleSheet.textContent=e:this._styleSheet=hr(It.document.head,t=>t.textContent=e,this._store))}dispose(){super.dispose(),this._styleSheet=void 0}};function hr(a=It.document.head,i,e){let t=document.createElement("style");if(t.type="text/css",t.media="screen",i?.(t),a.appendChild(t),e&&e.add(Z(()=>t.remove())),a===It.document.head){let o=new Set;KSe.set(t,o),e&&e.add(Z(()=>KSe.delete(t)));for(let{window:n,disposables:r}of Gw()){if(n===It)continue;let s=r.add(B2i(t,o,n));e?.add(s)}}return t}function V2i(a){let i=new P;for(let[e,t]of KSe)i.add(B2i(e,t,a));return i}function B2i(a,i,e){let t=new P,o=a.cloneNode(!0);e.document.head.appendChild(o),t.add(Z(()=>o.remove()));for(let n of U2i(a))o.sheet?.insertRule(n.cssText,o.sheet?.cssRules.length);return t.add(MGe.observe(a,t,{childList:!0,subtree:yc,characterData:yc})(()=>{o.textContent=a.textContent})),i.add(o),t.add(Z(()=>i.delete(o))),t}var AXt=null;function H2i(){return AXt||(AXt=hr()),AXt}function U2i(a){return a?.sheet?.rules?a.sheet.rules:a?.sheet?.cssRules?a.sheet.cssRules:[]}function Vh(a,i,e=H2i()){if(!(!e||!i)){e.sheet?.insertRule(`${a} {${i}}`,0);for(let t of KSe.get(e)??[])Vh(a,i,t)}}function EN(a,i=H2i()){if(!i)return;let e=U2i(i),t=[];for(let o=0;o<e.length;o++){let n=e[o];dPo(n)&&n.selectorText.indexOf(a)!==-1&&t.push(o)}for(let o=t.length-1;o>=0;o--)i.sheet?.deleteRule(t[o]);for(let o of KSe.get(i)??[])EN(a,o)}function dPo(a){return typeof a.selectorText=="string"}function z2i(a){let i=new P,e=i.add(new NXt);return i.add(he(t=>{e.setStyle(a.read(t))})),i}var cL=class{constructor(){this._hooks=new P;this._pointerMoveCallback=null;this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(i,e){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let t=this._onStopCallback;this._onStopCallback=null,i&&t&&t(e)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(i,e,t,o,n){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=o,this._onStopCallback=n;let r=i;try{i.setPointerCapture(e),this._hooks.add(Z(()=>{try{i.releasePointerCapture(e)}catch{}}))}catch{r=Me(i)}this._hooks.add(j(r,re.POINTER_MOVE,s=>{if(s.buttons!==t){this.stopMonitoring(!0);return}s.preventDefault(),this._pointerMoveCallback(s)})),this._hooks.add(j(r,re.POINTER_UP,s=>this.stopMonitoring(!0)))}};function TN(a){return`--vscode-${a.replace(/\./g,"-")}`}function wt(a){return`var(${TN(a)})`}function Ese(a,i){return`var(${TN(a)}, ${i})`}function uPo(a){return a!==null&&typeof a=="object"&&"light"in a&&"dark"in a}var Tse={ColorContribution:"base.contributions.colors"},M$e="default",OXt=class extends C{constructor(){super();this._onDidChangeSchema=this._register(new E);this.onDidChangeSchema=this._onDidChangeSchema.event;this.colorSchema={type:"object",properties:{}};this.colorReferenceSchema={type:"string",enum:[],enumDescriptions:[]};this.colorsById={}}notifyThemeUpdate(e){for(let t of Object.keys(this.colorsById)){let o=e.getColor(t);o&&(this.colorSchema.properties[t].oneOf[0].defaultSnippets[0].body=`\${1:${Oe.Format.CSS.formatHexA(o,!0)}}`)}this._onDidChangeSchema.fire()}registerColor(e,t,o,n=!1,r){let s={id:e,description:o,defaults:t,needsTransparency:n,deprecationMessage:r};this.colorsById[e]=s;let l={type:"string",format:"color-hex",defaultSnippets:[{body:"${1:#ff0000}"}]};return r&&(l.deprecationMessage=r),n&&(l.pattern="^#(?:(?<rgba>[0-9a-fA-f]{3}[0-9a-eA-E])|(?:[0-9a-fA-F]{6}(?:(?![fF]{2})(?:[0-9a-fA-F]{2}))))?$",l.patternErrorMessage=d(2592,null)),this.colorSchema.properties[e]={description:o,oneOf:[l,{type:"string",const:M$e,description:d(2593,null)}]},this.colorReferenceSchema.enum.push(e),this.colorReferenceSchema.enumDescriptions.push(o),this._onDidChangeSchema.fire(),e}deregisterColor(e){delete this.colorsById[e],delete this.colorSchema.properties[e];let t=this.colorReferenceSchema.enum.indexOf(e);t!==-1&&(this.colorReferenceSchema.enum.splice(t,1),this.colorReferenceSchema.enumDescriptions.splice(t,1)),this._onDidChangeSchema.fire()}getColors(){return Object.keys(this.colorsById).map(e=>this.colorsById[e])}resolveDefaultColor(e,t){let o=this.colorsById[e];if(o?.defaults){let n=uPo(o.defaults)?o.defaults[t.type]:o.defaults;return $T(n,t)}}getColorSchema(){return this.colorSchema}getColorReferenceSchema(){return this.colorReferenceSchema}toString(){let e=(t,o)=>{let n=t.indexOf(".")===-1?0:1,r=o.indexOf(".")===-1?0:1;return n!==r?n-r:t.localeCompare(o)};return Object.keys(this.colorsById).sort(e).map(t=>`- \`${t}\`: ${this.colorsById[t].description}`).join(`
`)}},P$e=new OXt;oe.add(Tse.ColorContribution,P$e);function J(a,i,e,t,o){return P$e.registerColor(a,i,e,t,o)}function GSe(){return P$e}function pPo(a,i){switch(a.op){case 0:return $T(a.value,i)?.darken(a.factor);case 1:return $T(a.value,i)?.lighten(a.factor);case 2:return $T(a.value,i)?.transparent(a.factor);case 7:{let e=$T(a.color,i)||Oe.transparent,t=$T(a.with,i)||Oe.transparent;return e.mix(t,a.ratio)}case 3:{let e=$T(a.background,i);return e?$T(a.value,i)?.makeOpaque(e):$T(a.value,i)}case 4:for(let e of a.values){let t=$T(e,i);if(t)return t}return;case 6:return $T(i.defines(a.if)?a.then:a.else,i);case 5:{let e=$T(a.value,i);if(!e)return;let t=$T(a.background,i);return t?e.isDarkerThan(t)?Oe.getLighterColor(e,t,a.factor).transparent(a.transparency):Oe.getDarkerColor(e,t,a.factor).transparent(a.transparency):e.transparent(a.factor*a.transparency)}default:throw Hr(a)}}function Sp(a,i){return{op:0,value:a,factor:i}}function RS(a,i){return{op:1,value:a,factor:i}}function ei(a,i){return{op:2,value:a,factor:i}}function W$(a,i){return{op:3,value:a,background:i}}function _se(...a){return{op:4,values:a}}function Dse(a,i,e){return{op:6,if:a,then:i,else:e}}function FXt(a,i,e,t){return{op:5,value:a,background:i,factor:e,transparency:t}}function $T(a,i){if(a!==null){if(typeof a=="string")return a[0]==="#"?Oe.fromHex(a):i.getColor(a);if(a instanceof Oe)return a;if(typeof a=="object")return pPo(a,i)}}var Lse="vscode://schemas/workbench-colors",G2i=oe.as(ea.JSONContribution);G2i.registerSchema(Lse,P$e.getColorSchema());var K2i=new Dt(()=>G2i.notifySchemaChanged(Lse),200);P$e.onDidChangeSchema(()=>{K2i.isScheduled()||K2i.schedule()});var ko=J("foreground",{dark:"#CCCCCC",light:"#616161",hcDark:"#FFFFFF",hcLight:"#292929"},d(2348,null)),WXt=J("disabledForeground",{dark:"#CCCCCC80",light:"#61616180",hcDark:"#A5A5A5",hcLight:"#7F7F7F"},d(2345,null)),Rse=J("errorForeground",{dark:"#F48771",light:"#A1260D",hcDark:"#F48771",hcLight:"#B5200D"},d(2346,null)),A$e=J("descriptionForeground",{light:"#717171",dark:ei(ko,.7),hcDark:ei(ko,.7),hcLight:ei(ko,.7)},d(2344,null)),_N=J("icon.foreground",{dark:"#C5C5C5",light:"#424242",hcDark:"#FFFFFF",hcLight:"#292929"},d(2349,null)),Ad=J("focusBorder",{dark:"#007FD4",light:"#0090F1",hcDark:"#F38518",hcLight:"#006BBD"},d(2347,null)),gi=J("contrastBorder",{light:null,dark:null,hcDark:"#6FC3DF",hcLight:"#0F4A85"},d(2343,null)),qs=J("contrastActiveBorder",{light:null,dark:null,hcDark:Ad,hcLight:Ad},d(2342,null)),tgt=J("selection.background",null,d(2350,null)),WI=J("textLink.foreground",{light:"#006AB1",dark:"#3794FF",hcDark:"#21A6FF",hcLight:"#0F4A85"},d(2355,null)),igt=J("textLink.activeForeground",{light:"#006AB1",dark:"#3794FF",hcDark:"#21A6FF",hcLight:"#0F4A85"},d(2354,null)),pFn=J("textSeparator.foreground",{light:"#0000002e",dark:"#ffffff2e",hcDark:Oe.black,hcLight:"#292929"},d(2359,null)),mFn=J("textPreformat.foreground",{light:"#A31515",dark:"#D7BA7D",hcDark:"#FFFFFF",hcLight:"#FFFFFF"},d(2358,null)),hFn=J("textPreformat.background",{light:"#0000001A",dark:"#FFFFFF1A",hcDark:null,hcLight:"#09345f"},d(2356,null)),gFn=J("textPreformat.border",{light:null,dark:null,hcDark:gi,hcLight:null},d(2357,null)),fFn=J("textBlockQuote.background",{light:"#f2f2f2",dark:"#222222",hcDark:null,hcLight:"#F2F2F2"},d(2351,null)),vFn=J("textBlockQuote.border",{light:"#007acc80",dark:"#007acc80",hcDark:Oe.white,hcLight:"#292929"},d(2352,null)),bFn=J("textCodeBlock.background",{light:"#dcdcdc66",dark:"#0a0a0a66",hcDark:Oe.black,hcLight:"#F2F2F2"},d(2353,null));var CFn=J("sash.hoverBorder",Ad,d(2574,null)),rv=J("badge.background",{dark:"#4D4D4D",light:"#C4C4C4",hcDark:Oe.black,hcLight:"#0F4A85"},d(2568,null)),Yw=J("badge.foreground",{dark:Oe.white,light:"#333",hcDark:Oe.white,hcLight:Oe.white},d(2569,null)),$2i=J("activityWarningBadge.foreground",{dark:Oe.white,light:Oe.white,hcDark:Oe.white,hcLight:Oe.white},d(2567,null)),q2i=J("activityWarningBadge.background",{dark:"#B27C00",light:"#B27C00",hcDark:null,hcLight:"#B27C00"},d(2566,null)),VXt=J("activityErrorBadge.foreground",{dark:Oe.black.lighten(.2),light:Oe.white,hcDark:null,hcLight:Oe.black.lighten(.2)},d(2565,null)),BXt=J("activityErrorBadge.background",{dark:"#F14C4C",light:"#E51400",hcDark:null,hcLight:"#F14C4C"},d(2564,null)),PU=J("scrollbar.shadow",{dark:"#000000",light:"#DDDDDD",hcDark:null,hcLight:null},d(2576,null)),o9=J("scrollbarSlider.background",{dark:Oe.fromHex("#797979").transparent(.4),light:Oe.fromHex("#646464").transparent(.4),hcDark:ei(gi,.6),hcLight:ei(gi,.4)},d(2578,null)),AU=J("scrollbarSlider.hoverBackground",{dark:Oe.fromHex("#646464").transparent(.7),light:Oe.fromHex("#646464").transparent(.7),hcDark:ei(gi,.8),hcLight:ei(gi,.8)},d(2579,null)),NU=J("scrollbarSlider.activeBackground",{dark:Oe.fromHex("#BFBFBF").transparent(.4),light:Oe.fromHex("#000000").transparent(.6),hcDark:gi,hcLight:gi},d(2577,null)),xFn=J("scrollbar.background",null,d(2575,null)),j2i=J("progressBar.background",{dark:Oe.fromHex("#0E70C0"),light:Oe.fromHex("#0E70C0"),hcDark:gi,hcLight:gi},d(2573,null)),Q2i=J("chart.line",{dark:"#236B8E",light:"#236B8E",hcDark:"#236B8E",hcLight:"#236B8E"},d(2572,null)),HXt=J("chart.axis",{dark:Oe.fromHex("#BFBFBF").transparent(.4),light:Oe.fromHex("#000000").transparent(.6),hcDark:gi,hcLight:gi},d(2570,null)),Y2i=J("chart.guide",{dark:Oe.fromHex("#BFBFBF").transparent(.2),light:Oe.fromHex("#000000").transparent(.2),hcDark:gi,hcLight:gi},d(2571,null));var qo=J("editor.background",{light:"#ffffff",dark:"#1E1E1E",hcDark:Oe.black,hcLight:Oe.white},d(2388,null)),od=J("editor.foreground",{light:"#333333",dark:"#BBBBBB",hcDark:Oe.white,hcLight:ko},d(2395,null)),LFn=J("editorStickyScroll.background",qo,d(2413,null)),RFn=J("editorStickyScrollGutter.background",qo,d(2415,null)),MFn=J("editorStickyScrollHover.background",{dark:"#2A2D2E",light:"#F0F0F0",hcDark:null,hcLight:Oe.fromHex("#0F4A85").transparent(.1)},d(2416,null)),PFn=J("editorStickyScroll.border",{dark:null,light:null,hcDark:gi,hcLight:gi},d(2414,null)),AFn=J("editorStickyScroll.shadow",PU,d(2417,null)),gm=J("editorWidget.background",{dark:"#252526",light:"#F3F3F3",hcDark:"#0C141F",hcLight:Oe.white},d(2420,null)),dL=J("editorWidget.foreground",ko,d(2422,null)),DN=J("editorWidget.border",{dark:"#454545",light:"#C8C8C8",hcDark:gi,hcLight:gi},d(2421,null)),NFn=J("editorWidget.resizeBorder",null,d(2423,null)),OFn=J("editorError.background",null,d(2390,null),!0),av=J("editorError.foreground",{dark:"#F14C4C",light:"#E51400",hcDark:"#F48771",hcLight:"#B5200D"},d(2391,null)),eGi=J("editorError.border",{dark:null,light:null,hcDark:Oe.fromHex("#E47777").transparent(.8),hcLight:"#B5200D"},d(2424,null)),tGi=J("editorWarning.background",null,d(2418,null),!0),Bh=J("editorWarning.foreground",{dark:"#CCA700",light:"#BF8803",hcDark:"#FFD370",hcLight:"#895503"},d(2419,null)),n9=J("editorWarning.border",{dark:null,light:null,hcDark:Oe.fromHex("#FFCC00").transparent(.8),hcLight:Oe.fromHex("#FFCC00").transparent(.8)},d(2459,null)),FFn=J("editorInfo.background",null,d(2398,null),!0),fm=J("editorInfo.foreground",{dark:"#59a4f9",light:"#0063d3",hcDark:"#59a4f9",hcLight:"#0063d3"},d(2399,null)),r9=J("editorInfo.border",{dark:null,light:null,hcDark:Oe.fromHex("#59a4f9").transparent(.8),hcLight:"#292929"},d(2435,null)),iGi=J("editorHint.foreground",{dark:Oe.fromHex("#eeeeee").transparent(.7),light:"#6c6c6c",hcDark:null,hcLight:null},d(2396,null)),WFn=J("editorHint.border",{dark:null,light:null,hcDark:Oe.fromHex("#eeeeee").transparent(.8),hcLight:"#292929"},d(2430,null)),oGi=J("editorLink.activeForeground",{dark:"#4E94CE",light:Oe.blue,hcDark:Oe.cyan,hcLight:"#292929"},d(2368,null)),sv=J("editor.selectionBackground",{light:"#ADD6FF",dark:"#264F78",hcDark:"#f3f518",hcLight:"#0F4A85"},d(2409,null)),nGi=J("editor.selectionForeground",{light:null,dark:null,hcDark:"#000000",hcLight:Oe.white},d(2410,null)),rGi=J("editor.inactiveSelectionBackground",{light:ei(sv,.5),dark:ei(sv,.5),hcDark:ei(sv,.7),hcLight:ei(sv,.5)},d(2397,null),!0),YSe=J("editor.selectionHighlightBackground",{light:FXt(sv,qo,.3,.6),dark:FXt(sv,qo,.3,.6),hcDark:null,hcLight:null},d(2411,null),!0),VFn=J("editor.selectionHighlightBorder",{light:null,dark:null,hcDark:qs,hcLight:qs},d(2412,null)),BFn=J("editor.compositionBorder",{light:"#000000",dark:"#ffffff",hcLight:"#000000",hcDark:"#ffffff"},d(2389,null)),Pse=J("editor.findMatchBackground",{light:"#A8AC94",dark:"#515C6A",hcDark:null,hcLight:null},d(2392,null)),sGi=J("editor.findMatchForeground",null,d(2394,null)),Kb=J("editor.findMatchHighlightBackground",{light:"#EA5C0055",dark:"#EA5C0055",hcDark:null,hcLight:null},d(2425,null),!0),aGi=J("editor.findMatchHighlightForeground",null,d(2427,null),!0),lGi=J("editor.findRangeHighlightBackground",{dark:"#3a3d4166",light:"#b4b4b44d",hcDark:null,hcLight:null},d(2428,null),!0),HFn=J("editor.findMatchBorder",{light:null,dark:null,hcDark:qs,hcLight:qs},d(2393,null)),LN=J("editor.findMatchHighlightBorder",{light:null,dark:null,hcDark:qs,hcLight:qs},d(2426,null)),cGi=J("editor.findRangeHighlightBorder",{dark:null,light:null,hcDark:ei(qs,.4),hcLight:ei(qs,.4)},d(2429,null),!0),ogt=J("editor.hoverHighlightBackground",{light:"#ADD6FF26",dark:"#264f7840",hcDark:"#ADD6FF26",hcLight:null},d(2434,null),!0),qT=J("editorHoverWidget.background",gm,d(2431,null)),s9=J("editorHoverWidget.foreground",dL,d(2433,null)),OU=J("editorHoverWidget.border",DN,d(2432,null)),UFn=J("editorHoverWidget.statusBarBackground",{dark:RS(qT,.2),light:Sp(qT,.05),hcDark:gm,hcLight:gm},d(2455,null)),ngt=J("editorInlayHint.foreground",{dark:"#969696",light:"#969696",hcDark:Oe.white,hcLight:Oe.black},d(2403,null)),rgt=J("editorInlayHint.background",{dark:ei(rv,.1),light:ei(rv,.1),hcDark:ei(Oe.white,.1),hcLight:ei(rv,.1)},d(2400,null)),dGi=J("editorInlayHint.typeForeground",ngt,d(2405,null)),uGi=J("editorInlayHint.typeBackground",rgt,d(2402,null)),pGi=J("editorInlayHint.parameterForeground",ngt,d(2404,null)),mGi=J("editorInlayHint.parameterBackground",rgt,d(2401,null)),mPo=J("editorLightBulb.foreground",{dark:"#FFCC00",light:"#DDB100",hcDark:"#FFCC00",hcLight:"#007ACC"},d(2408,null)),zFn=J("editorLightBulbAutoFix.foreground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(2407,null)),KFn=J("editorLightBulbAi.foreground",mPo,d(2406,null)),GFn=J("editor.snippetTabstopHighlightBackground",{dark:new Oe(new Bt(124,124,124,.3)),light:new Oe(new Bt(10,50,100,.2)),hcDark:new Oe(new Bt(124,124,124,.3)),hcLight:new Oe(new Bt(10,50,100,.2))},d(2453,null)),$Fn=J("editor.snippetTabstopHighlightBorder",null,d(2454,null)),qFn=J("editor.snippetFinalTabstopHighlightBackground",null,d(2451,null)),jFn=J("editor.snippetFinalTabstopHighlightBorder",{dark:"#525252",light:new Oe(new Bt(10,50,100,.5)),hcDark:"#525252",hcLight:"#292929"},d(2452,null)),$Se=new Oe(new Bt(155,185,85,.2)),qSe=new Oe(new Bt(255,0,0,.2)),Hg=J("diffEditor.insertedTextBackground",{dark:"#9ccc2c33",light:"#9ccc2c40",hcDark:null,hcLight:null},d(2378,null),!0),Cf=J("diffEditor.removedTextBackground",{dark:"#ff000033",light:"#ff000033",hcDark:null,hcLight:null},d(2384,null),!0),F$e=J("diffEditor.insertedLineBackground",{dark:$Se,light:$Se,hcDark:null,hcLight:null},d(2380,null),!0),QFn=J("diffEditor.removedLineBackground",{dark:qSe,light:qSe,hcDark:null,hcLight:null},d(2386,null),!0),YFn=J("diffEditorGutter.insertedLineBackground",null,d(2379,null)),XFn=J("diffEditorGutter.removedLineBackground",null,d(2385,null)),sgt=J("diffEditorOverview.insertedForeground",null,d(2382,null)),agt=J("diffEditorOverview.removedForeground",null,d(2383,null)),JFn=J("diffEditor.insertedTextBorder",{dark:null,light:null,hcDark:"#33ff2eff",hcLight:"#374E06"},d(2381,null)),ZFn=J("diffEditor.removedTextBorder",{dark:null,light:null,hcDark:"#FF008F",hcLight:"#AD0707"},d(2387,null)),e0n=J("diffEditor.border",{dark:null,light:null,hcDark:gi,hcLight:gi},d(2377,null)),hGi=J("diffEditor.diagonalFill",{dark:"#cccccc33",light:"#22222233",hcDark:null,hcLight:null},d(2373,null)),t0n=J("diffEditor.unchangedRegionBackground","sideBar.background",d(2375,null)),i0n=J("diffEditor.unchangedRegionForeground","foreground",d(2376,null)),o0n=J("diffEditor.unchangedCodeBackground",{dark:"#74747429",light:"#b8b8b829",hcDark:null,hcLight:null},d(2374,null)),RN=J("widget.shadow",{dark:ei(Oe.black,.36),light:ei(Oe.black,.16),hcDark:null,hcLight:null},d(2461,null)),jT=J("widget.border",{dark:null,light:null,hcDark:gi,hcLight:gi},d(2460,null)),Mse=J("toolbar.hoverBackground",{dark:"#5a5d5e50",light:"#b8b8b850",hcDark:null,hcLight:null},d(2457,null)),n0n=J("toolbar.hoverOutline",{dark:null,light:null,hcDark:qs,hcLight:qs},d(2458,null)),r0n=J("toolbar.activeBackground",{dark:RS(Mse,.1),light:Sp(Mse,.1),hcDark:null,hcLight:null},d(2456,null)),gGi=J("breadcrumb.foreground",ei(ko,.8),d(2370,null)),fGi=J("breadcrumb.background",qo,d(2369,null)),zXt=J("breadcrumb.focusForeground",{light:Sp(ko,.2),dark:RS(ko,.1),hcDark:RS(ko,.1),hcLight:RS(ko,.1)},d(2370,null)),vGi=J("breadcrumb.activeSelectionForeground",{light:Sp(ko,.2),dark:RS(ko,.1),hcDark:RS(ko,.1),hcLight:RS(ko,.1)},d(2372,null)),KXt=J("breadcrumbPicker.background",gm,d(2371,null)),bGi=.5,X2i=Oe.fromHex("#40C8AE").transparent(bGi),J2i=Oe.fromHex("#40A6FF").transparent(bGi),Z2i=Oe.fromHex("#606060").transparent(.4),GXt=.4,jSe=1,N$e=J("merge.currentHeaderBackground",{dark:X2i,light:X2i,hcDark:null,hcLight:null},d(2440,null),!0),s0n=J("merge.currentContentBackground",ei(N$e,GXt),d(2439,null),!0),O$e=J("merge.incomingHeaderBackground",{dark:J2i,light:J2i,hcDark:null,hcLight:null},d(2442,null),!0),a0n=J("merge.incomingContentBackground",ei(O$e,GXt),d(2441,null),!0),UXt=J("merge.commonHeaderBackground",{dark:Z2i,light:Z2i,hcDark:null,hcLight:null},d(2438,null),!0),l0n=J("merge.commonContentBackground",ei(UXt,GXt),d(2437,null),!0),QSe=J("merge.border",{dark:null,light:null,hcDark:"#C3DF6F",hcLight:"#007ACC"},d(2436,null)),c0n=J("editorOverviewRuler.currentContentForeground",{dark:ei(N$e,jSe),light:ei(N$e,jSe),hcDark:QSe,hcLight:QSe},d(2444,null)),d0n=J("editorOverviewRuler.incomingContentForeground",{dark:ei(O$e,jSe),light:ei(O$e,jSe),hcDark:QSe,hcLight:QSe},d(2446,null)),u0n=J("editorOverviewRuler.commonContentForeground",{dark:ei(UXt,jSe),light:ei(UXt,jSe),hcDark:QSe,hcLight:QSe},d(2443,null)),MN=J("editorOverviewRuler.findMatchForeground",{dark:"#d186167e",light:"#d186167e",hcDark:"#AB5A00",hcLight:"#AB5A00"},d(2445,null),!0),XSe=J("editorOverviewRuler.selectionHighlightForeground","#A0A0A0CC",d(2447,null),!0),SGi=J("problemsErrorIcon.foreground",av,d(2448,null)),IGi=J("problemsWarningIcon.foreground",Bh,d(2450,null)),yGi=J("problemsInfoIcon.foreground",fm,d(2449,null));var a9=J("minimap.findMatchHighlight",Kb,d(2555,null),!0),W$e=J("minimap.selectionOccurrenceHighlight",YSe,d(2559,null),!0),$Xt=J("minimap.selectionHighlight",sv,d(2558,null),!0),wGi=J("minimap.infoHighlight",{dark:fm,light:fm,hcDark:r9,hcLight:r9},d(2557,null)),CGi=J("minimap.warningHighlight",{dark:Bh,light:Bh,hcDark:n9,hcLight:n9},d(2563,null)),xGi=J("minimap.errorHighlight",{dark:new Oe(new Bt(255,18,18,.7)),light:new Oe(new Bt(255,18,18,.7)),hcDark:new Oe(new Bt(255,50,50,1)),hcLight:"#B5200D"},d(2554,null)),kGi=J("minimap.background",null,d(2553,null)),EGi=J("minimap.foregroundOpacity",Oe.fromHex("#000f"),d(2556,null)),v0n=J("minimapSlider.background",ei(o9,.5),d(2561,null)),b0n=J("minimapSlider.hoverBackground",ei(AU,.5),d(2562,null)),S0n=J("minimapSlider.activeBackground",ei(NU,.5),d(2560,null));var JSe=J("charts.foreground",ko,d(2361,null)),lgt=J("charts.lines",ei(ko,.5),d(2363,null)),V$e=J("charts.red",av,d(2366,null)),B$e=J("charts.blue",fm,d(2360,null)),TGi=J("charts.yellow",Bh,d(2367,null)),k0n=J("charts.orange",a9,d(2364,null)),Ase=J("charts.green",{dark:"#89D185",light:"#388A34",hcDark:"#89D185",hcLight:"#374e06"},d(2362,null)),cgt=J("charts.purple",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},d(2365,null));var c9=J("list.focusBackground",null,d(2530,null)),ZSe=J("list.focusForeground",null,d(2531,null)),H$e=J("list.focusOutline",{dark:Ad,light:Ad,hcDark:qs,hcLight:qs},d(2533,null)),_Gi=J("list.focusAndSelectionOutline",null,d(2529,null)),Wy=J("list.activeSelectionBackground",{dark:"#04395E",light:"#0060C0",hcDark:null,hcLight:Oe.fromHex("#0F4A85").transparent(.1)},d(2516,null)),QT=J("list.activeSelectionForeground",{dark:Oe.white,light:Oe.white,hcDark:null,hcLight:null},d(2517,null)),dgt=J("list.activeSelectionIconForeground",null,d(2518,null)),xf=J("list.inactiveSelectionBackground",{dark:"#37373D",light:"#E4E6F1",hcDark:null,hcLight:Oe.fromHex("#0F4A85").transparent(.1)},d(2538,null)),ugt=J("list.inactiveSelectionForeground",null,d(2539,null)),DGi=J("list.inactiveSelectionIconForeground",null,d(2540,null)),pgt=J("list.inactiveFocusBackground",null,d(2536,null)),LGi=J("list.inactiveFocusOutline",null,d(2537,null)),Xk=J("list.hoverBackground",{dark:"#2A2D2E",light:"#F0F0F0",hcDark:Oe.white.transparent(.1),hcLight:Oe.fromHex("#0F4A85").transparent(.1)},d(2534,null)),eIe=J("list.hoverForeground",null,d(2535,null)),mgt=J("list.dropBackground",{dark:"#062F4A",light:"#D6EBFF",hcDark:null,hcLight:null},d(2520,null)),RGi=J("list.dropBetweenBackground",{dark:_N,light:_N,hcDark:null,hcLight:null},d(2521,null)),l9=J("list.highlightForeground",{dark:"#2AAAFF",light:"#0066BF",hcDark:Ad,hcLight:Ad},d(2514,null)),MGi=J("list.focusHighlightForeground",{dark:l9,light:Dse(Wy,l9,"#BBE7FF"),hcDark:l9,hcLight:l9},d(2532,null)),PGi=J("list.invalidItemForeground",{dark:"#B89500",light:"#B89500",hcDark:"#B89500",hcLight:"#B5200D"},d(2515,null)),uL=J("list.errorForeground",{dark:"#F88070",light:"#B01011",hcDark:null,hcLight:null},d(2522,null)),d9=J("list.warningForeground",{dark:"#CCA700",light:"#855F00",hcDark:null,hcLight:null},d(2541,null)),AGi=J("listFilterWidget.background",{light:Sp(gm,0),dark:RS(gm,0),hcDark:gm,hcLight:gm},d(2525,null)),NGi=J("listFilterWidget.outline",{dark:Oe.transparent,light:Oe.transparent,hcDark:"#f38518",hcLight:"#007ACC"},d(2527,null)),OGi=J("listFilterWidget.noMatchesOutline",{dark:"#BE1100",light:"#BE1100",hcDark:gi,hcLight:gi},d(2526,null)),FGi=J("listFilterWidget.shadow",RN,d(2528,null)),WGi=J("list.filterMatchBackground",{dark:Kb,light:Kb,hcDark:null,hcLight:null},d(2523,null)),VGi=J("list.filterMatchBorder",{dark:LN,light:LN,hcDark:gi,hcLight:qs},d(2524,null)),hgt=J("list.deemphasizedForeground",{dark:"#8C8C8C",light:"#8E8E90",hcDark:"#A7A8A9",hcLight:"#666666"},d(2519,null)),tIe=J("tree.indentGuidesStroke",{dark:"#585858",light:"#a9a9a9",hcDark:"#a9a9a9",hcLight:"#a5a5a5"},d(2545,null)),BGi=J("tree.inactiveIndentGuidesStroke",ei(tIe,.4),d(2544,null)),HGi=J("tree.tableColumnsBorder",{dark:"#CCCCCC20",light:"#61616120",hcDark:null,hcLight:null},d(2542,null)),U$e=J("tree.tableOddRowsBackground",{dark:ei(ko,.04),light:ei(ko,.04),hcDark:null,hcLight:null},d(2543,null)),R0n=J("editorActionList.background",gm,d(2510,null)),UGi=J("editorActionList.foreground",dL,d(2513,null)),M0n=J("editorActionList.focusForeground",QT,d(2512,null)),P0n=J("editorActionList.focusBackground",Wy,d(2511,null));var Gb=J("input.background",{dark:"#3C3C3C",light:Oe.white,hcDark:Oe.black,hcLight:Oe.white},d(2483,null)),pL=J("input.foreground",ko,d(2485,null)),Vy=J("input.border",{dark:null,light:null,hcDark:gi,hcLight:gi},d(2484,null)),cW=J("inputOption.activeBorder",{dark:"#007ACC",light:"#007ACC",hcDark:gi,hcLight:gi},d(2482,null)),hPo=J("inputOption.hoverBackground",{dark:"#5a5d5e80",light:"#b8b8b850",hcDark:null,hcLight:null},d(2488,null)),dW=J("inputOption.activeBackground",{dark:ei(Ad,.4),light:ei(Ad,.2),hcDark:Oe.transparent,hcLight:Oe.transparent},d(2486,null)),V$=J("inputOption.activeForeground",{dark:Oe.white,light:Oe.black,hcDark:ko,hcLight:ko},d(2487,null)),u9=J("input.placeholderForeground",{light:ei(ko,.5),dark:ei(ko,.5),hcDark:ei(ko,.7),hcLight:ei(ko,.7)},d(2489,null)),zGi=J("inputValidation.infoBackground",{dark:"#063B49",light:"#D6ECF2",hcDark:Oe.black,hcLight:Oe.white},d(2493,null)),KGi=J("inputValidation.infoForeground",{dark:null,light:null,hcDark:null,hcLight:ko},d(2495,null)),z$e=J("inputValidation.infoBorder",{dark:"#007acc",light:"#007acc",hcDark:gi,hcLight:gi},d(2494,null)),GGi=J("inputValidation.warningBackground",{dark:"#352A05",light:"#F6F5D2",hcDark:Oe.black,hcLight:Oe.white},d(2496,null)),$Gi=J("inputValidation.warningForeground",{dark:null,light:null,hcDark:null,hcLight:ko},d(2498,null)),K$e=J("inputValidation.warningBorder",{dark:"#B89500",light:"#B89500",hcDark:gi,hcLight:gi},d(2497,null)),ggt=J("inputValidation.errorBackground",{dark:"#5A1D1D",light:"#F2DEDE",hcDark:Oe.black,hcLight:Oe.white},d(2490,null)),fgt=J("inputValidation.errorForeground",{dark:null,light:null,hcDark:null,hcLight:ko},d(2492,null)),Nse=J("inputValidation.errorBorder",{dark:"#BE1100",light:"#BE1100",hcDark:gi,hcLight:gi},d(2491,null)),FU=J("dropdown.background",{dark:"#3C3C3C",light:Oe.white,hcDark:Oe.black,hcLight:Oe.white},d(2478,null)),qGi=J("dropdown.listBackground",{dark:null,light:null,hcDark:Oe.black,hcLight:Oe.white},d(2481,null)),Ose=J("dropdown.foreground",{dark:"#F0F0F0",light:ko,hcDark:Oe.white,hcLight:ko},d(2480,null)),PN=J("dropdown.border",{dark:FU,light:"#CECECE",hcDark:gi,hcLight:gi},d(2479,null)),YT=J("button.foreground",Oe.white,d(2464,null)),vgt=J("button.separator",ei(YT,.4),d(2470,null)),MS=J("button.background",{dark:"#0E639C",light:"#007ACC",hcDark:Oe.black,hcLight:"#0F4A85"},d(2462,null)),B$=J("button.hoverBackground",{dark:RS(MS,.2),light:Sp(MS,.2),hcDark:MS,hcLight:MS},d(2465,null)),oIe=J("button.border",gi,d(2463,null)),Fse=J("button.secondaryForeground",{dark:ko,light:ko,hcDark:Oe.white,hcLight:ko},d(2468,null)),H$=J("button.secondaryBackground",{dark:Xk,light:Xk,hcDark:null,hcLight:Oe.white},d(2466,null)),H0n=J("button.secondaryBorder",gi,d(2467,null)),Wse=J("button.secondaryHoverBackground",{dark:RS(Xk,.2),light:RS(Xk,.2),hcDark:null,hcLight:null},d(2469,null)),iIe=J("radio.activeForeground",V$,d(2504,null)),jGi=J("radio.activeBackground",dW,d(2505,null)),QGi=J("radio.activeBorder",cW,d(2503,null)),YGi=J("radio.inactiveForeground",null,d(2509,null)),XGi=J("radio.inactiveBackground",null,d(2507,null)),JGi=J("radio.inactiveBorder",{light:ei(iIe,.2),dark:ei(iIe,.2),hcDark:ei(iIe,.4),hcLight:ei(iIe,.2)},d(2508,null)),ZGi=J("radio.inactiveHoverBackground",hPo,d(2506,null)),nIe=J("checkbox.background",FU,d(2471,null)),U0n=J("checkbox.selectBackground",gm,d(2476,null)),rIe=J("checkbox.foreground",Ose,d(2475,null)),bgt=J("checkbox.border",PN,d(2472,null)),z0n=J("checkbox.selectBorder",_N,d(2477,null)),e$i=J("checkbox.disabled.background",{op:7,color:nIe,with:rIe,ratio:.33},d(2473,null)),t$i=J("checkbox.disabled.foreground",{op:7,color:rIe,with:nIe,ratio:.33},d(2474,null)),i$i=J("keybindingLabel.background",{dark:new Oe(new Bt(128,128,128,.17)),light:new Oe(new Bt(221,221,221,.4)),hcDark:Oe.transparent,hcLight:Oe.transparent},d(2499,null)),o$i=J("keybindingLabel.foreground",{dark:Oe.fromHex("#CCCCCC"),light:Oe.fromHex("#555555"),hcDark:Oe.white,hcLight:ko},d(2502,null)),n$i=J("keybindingLabel.border",{dark:new Oe(new Bt(51,51,51,.6)),light:new Oe(new Bt(204,204,204,.4)),hcDark:new Oe(new Bt(111,195,223)),hcLight:gi},d(2500,null)),r$i=J("keybindingLabel.bottomBorder",{dark:new Oe(new Bt(68,68,68,.6)),light:new Oe(new Bt(187,187,187,.4)),hcDark:new Oe(new Bt(111,195,223)),hcLight:ko},d(2501,null));var s$i=J("menu.border",{dark:null,light:null,hcDark:gi,hcLight:gi},d(2547,null)),a$i=J("menu.foreground",Ose,d(2548,null)),l$i=J("menu.background",FU,d(2546,null)),Q0n=J("menu.selectionForeground",QT,d(2551,null)),Y0n=J("menu.selectionBackground",Wy,d(2549,null)),c$i=J("menu.selectionBorder",{dark:null,light:null,hcDark:qs,hcLight:qs},d(2550,null)),d$i=J("menu.separatorBackground",{dark:"#606060",light:"#D4D4D4",hcDark:gi,hcLight:gi},d(2552,null));var sIe=J("quickInput.background",gm,d(2580,null)),Sgt=J("quickInput.foreground",dL,d(2581,null)),p$i=J("quickInputTitle.background",{dark:new Oe(new Bt(255,255,255,.105)),light:new Oe(new Bt(0,0,0,.06)),hcDark:"#000000",hcLight:Oe.white},d(2584,null)),Igt=J("pickerGroup.foreground",{dark:"#3794FF",light:"#0066BF",hcDark:Oe.white,hcLight:"#0F4A85"},d(2583,null)),m$i=J("pickerGroup.border",{dark:"#3F3F46",light:"#CCCEDB",hcDark:Oe.white,hcLight:"#0F4A85"},d(2582,null)),u$i=J("quickInput.list.focusBackground",null,"",void 0,d(2585,null)),WU=J("quickInputList.focusForeground",QT,d(2587,null)),aIe=J("quickInputList.focusIconForeground",dgt,d(2588,null)),VU=J("quickInputList.focusBackground",{dark:_se(u$i,Wy),light:_se(u$i,Wy),hcDark:null,hcLight:null},d(2586,null));var sWn=J("search.resultsInfoForeground",{light:ko,dark:ei(ko,.65),hcDark:ko,hcLight:ko},d(2589,null)),aWn=J("searchEditor.findMatchBackground",{light:ei(Kb,.66),dark:ei(Kb,.66),hcDark:Kb,hcLight:Kb},d(2591,null)),lWn=J("searchEditor.findMatchBorder",{light:ei(LN,.66),dark:ei(LN,.66),hcDark:LN,hcLight:LN},d(2590,null));var U$=class{constructor(i,e){this.x=i;this.y=e;this._pageCoordinatesBrand=void 0}toClientCoordinates(i){return new G$e(this.x-i.scrollX,this.y-i.scrollY)}},G$e=class{constructor(i,e){this.clientX=i;this.clientY=e;this._clientCoordinatesBrand=void 0}toPageCoordinates(i){return new U$(this.clientX+i.scrollX,this.clientY+i.scrollY)}},jXt=class{constructor(i,e,t,o){this.x=i;this.y=e;this.width=t;this.height=o;this._editorPagePositionBrand=void 0}},QXt=class{constructor(i,e){this.x=i;this.y=e;this._positionRelativeToEditorBrand=void 0}};function lIe(a){let i=Yn(a);return new jXt(i.left,i.top,i.width,i.height)}function cIe(a,i,e){let t=i.width/a.offsetWidth,o=i.height/a.offsetHeight,n=(e.x-i.x)/t,r=(e.y-i.y)/o;return new QXt(n,r)}var mL=class extends yn{constructor(e,t,o){super(Me(o),e);this._editorMouseEventBrand=void 0;this.isFromPointerCapture=t,this.pos=new U$(this.posx,this.posy),this.editorPos=lIe(o),this.relativePos=cIe(o,this.editorPos,this.pos)}},ygt=class{constructor(i){this._editorViewDomNode=i}_create(i){return new mL(i,!1,this._editorViewDomNode)}onContextMenu(i,e){return j(i,re.CONTEXT_MENU,t=>{e(this._create(t))})}onMouseUp(i,e){return j(i,re.MOUSE_UP,t=>{e(this._create(t))})}onMouseDown(i,e){return j(i,re.MOUSE_DOWN,t=>{e(this._create(t))})}onPointerDown(i,e){return j(i,re.POINTER_DOWN,t=>{e(this._create(t),t.pointerId)})}onMouseLeave(i,e){return j(i,re.MOUSE_LEAVE,t=>{e(this._create(t))})}onMouseMove(i,e){return j(i,re.MOUSE_MOVE,t=>e(this._create(t)))}},wgt=class{constructor(i){this._editorViewDomNode=i}_create(i){return new mL(i,!1,this._editorViewDomNode)}onPointerUp(i,e){return j(i,"pointerup",t=>{e(this._create(t))})}onPointerDown(i,e){return j(i,re.POINTER_DOWN,t=>{e(this._create(t),t.pointerId)})}onPointerLeave(i,e){return j(i,re.POINTER_LEAVE,t=>{e(this._create(t))})}onPointerMove(i,e){return j(i,"pointermove",t=>e(this._create(t)))}},Cgt=class extends C{constructor(i){super(),this._editorViewDomNode=i,this._globalPointerMoveMonitor=this._register(new cL),this._keydownListener=null}startMonitoring(i,e,t,o,n){this._keydownListener=Vo(i.ownerDocument,"keydown",r=>{r.toKeyCodeChord().isModifierKey()||this._globalPointerMoveMonitor.stopMonitoring(!0,r.browserEvent)},!0),this._globalPointerMoveMonitor.startMonitoring(i,e,t,r=>{o(new mL(r,!0,this._editorViewDomNode))},r=>{this._keydownListener.dispose(),n(r)})}stopMonitoring(){this._globalPointerMoveMonitor.stopMonitoring(!0)}},p9=class a{constructor(i){this._editor=i;this._instanceId=++a._idPool;this._counter=0;this._rules=new jt;this._garbageCollectionScheduler=new Dt(()=>this.garbageCollect(),1e3)}static{this._idPool=0}dispose(){this._rules.dispose(),this._garbageCollectionScheduler.dispose()}createClassNameRef(i){let e=this.getOrCreateRule(i);return e.increaseRefCount(),{className:e.className,dispose:()=>{e.decreaseRefCount(),this._garbageCollectionScheduler.schedule()}}}getOrCreateRule(i){let e=this.computeUniqueKey(i),t=this._rules.get(e);if(!t){let o=this._counter++;t=new YXt(e,`dyn-rule-${this._instanceId}-${o}`,x$(this._editor.getContainerDomNode())?this._editor.getContainerDomNode():void 0,i),this._rules.set(e,t)}return t}computeUniqueKey(i){return JSON.stringify(i)}garbageCollect(){for(let i of this._rules.values())i.hasReferences()||this._rules.deleteAndDispose(i.key)}},YXt=class{constructor(i,e,t,o){this.key=i;this.className=e;this.properties=o;this._referenceCount=0;this._styleElementDisposables=new P,this._styleElement=hr(t,void 0,this._styleElementDisposables),this._styleElement.textContent=this.getCssText(this.className,this.properties)}getCssText(i,e){let t=`.${i} {`;for(let o in e){let n=e[o],r;typeof n=="object"?r=wt(n.id):r=n;let s=gPo(o);t+=`
${s}: ${r};`}return t+=`
}`,t}dispose(){this._styleElementDisposables.dispose(),this._styleElement=void 0}increaseRefCount(){this._referenceCount++}decreaseRefCount(){this._referenceCount--}hasReferences(){return this._referenceCount>0}};function gPo(a){return a.replace(/(^[A-Z])/,([i])=>i.toLowerCase()).replace(/([A-Z])/g,([i])=>`-${i.toLowerCase()}`)}var Jk=class extends C{constructor(){super(),this._shouldRender=!0}shouldRender(){return this._shouldRender}forceShouldRender(){this._shouldRender=!0}setShouldRender(){this._shouldRender=!0}onDidRender(){this._shouldRender=!1}onCompositionStart(i){return!1}onCompositionEnd(i){return!1}onConfigurationChanged(i){return!1}onCursorStateChanged(i){return!1}onDecorationsChanged(i){return!1}onFlushed(i){return!1}onFocusChanged(i){return!1}onLanguageConfigurationChanged(i){return!1}onLineMappingChanged(i){return!1}onLinesChanged(i){return!1}onLinesDeleted(i){return!1}onLinesInserted(i){return!1}onRevealRangeRequest(i){return!1}onScrollChanged(i){return!1}onThemeChanged(i){return!1}onTokensChanged(i){return!1}onTokensColorsChanged(i){return!1}onZonesChanged(i){return!1}handleEvents(i){let e=!1;for(let t=0,o=i.length;t<o;t++){let n=i[t];switch(n.type){case 0:this.onCompositionStart(n)&&(e=!0);break;case 1:this.onCompositionEnd(n)&&(e=!0);break;case 2:this.onConfigurationChanged(n)&&(e=!0);break;case 3:this.onCursorStateChanged(n)&&(e=!0);break;case 4:this.onDecorationsChanged(n)&&(e=!0);break;case 5:this.onFlushed(n)&&(e=!0);break;case 6:this.onFocusChanged(n)&&(e=!0);break;case 7:this.onLanguageConfigurationChanged(n)&&(e=!0);break;case 8:this.onLineMappingChanged(n)&&(e=!0);break;case 9:this.onLinesChanged(n)&&(e=!0);break;case 10:this.onLinesDeleted(n)&&(e=!0);break;case 11:this.onLinesInserted(n)&&(e=!0);break;case 12:this.onRevealRangeRequest(n)&&(e=!0);break;case 13:this.onScrollChanged(n)&&(e=!0);break;case 15:this.onTokensChanged(n)&&(e=!0);break;case 14:this.onThemeChanged(n)&&(e=!0);break;case 16:this.onTokensColorsChanged(n)&&(e=!0);break;case 17:this.onZonesChanged(n)&&(e=!0);break;default:console.info("View received unknown event: "),console.info(n)}}e&&(this._shouldRender=!0)}};var mu=class extends Jk{constructor(i){super(),this._context=i,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),super.dispose()}onBeforeRender(i){}};var PS=class{static write(i,e){i.setAttribute("data-mprt",String(e))}static read(i){let e=i.getAttribute("data-mprt");return e===null?0:parseInt(e,10)}static collect(i,e){let t=[],o=0;for(;i&&i!==i.ownerDocument.body&&i!==e;)i.nodeType===i.ELEMENT_NODE&&(t[o++]=this.read(i)),i=i.parentElement;let n=new Uint8Array(o);for(let r=0;r<o;r++)n[r]=t[o-r-1];return n}};var XXt=class{constructor(i,e){this._restrictedRenderingContextBrand=void 0;this._viewLayout=i,this.viewportData=e,this.scrollWidth=this._viewLayout.getScrollWidth(),this.scrollHeight=this._viewLayout.getScrollHeight(),this.visibleRange=this.viewportData.visibleRange,this.bigNumbersDelta=this.viewportData.bigNumbersDelta;let t=this._viewLayout.getCurrentViewport();this.scrollTop=t.top,this.scrollLeft=t.left,this.viewportWidth=t.width,this.viewportHeight=t.height}getScrolledTopFromAbsoluteTop(i){return i-this.scrollTop}getVerticalOffsetForLineNumber(i,e){return this._viewLayout.getVerticalOffsetForLineNumber(i,e)}getVerticalOffsetAfterLineNumber(i,e){return this._viewLayout.getVerticalOffsetAfterLineNumber(i,e)}getLineHeightForLineNumber(i){return this._viewLayout.getLineHeightForLineNumber(i)}getDecorationsInViewport(){return this.viewportData.getDecorationsInViewport()}},xgt=class extends XXt{constructor(e,t,o,n){super(e,t);this._renderingContextBrand=void 0;this._viewLines=o,this._viewLinesGpu=n}linesVisibleRangesForRange(e,t){let o=this._viewLines.linesVisibleRangesForRange(e,t);if(!this._viewLinesGpu)return o;let n=this._viewLinesGpu.linesVisibleRangesForRange(e,t);return o?n?o.concat(n).sort((r,s)=>r.lineNumber-s.lineNumber):o:n}visibleRangeForPosition(e){return this._viewLines.visibleRangeForPosition(e)??this._viewLinesGpu?.visibleRangeForPosition(e)??null}},dIe=class{constructor(i,e,t,o){this.outsideRenderedLine=i;this.lineNumber=e;this.ranges=t;this.continuesOnNextLine=o}static firstLine(i){if(!i)return null;let e=null;for(let t of i)(!e||t.lineNumber<e.lineNumber)&&(e=t);return e}static lastLine(i){if(!i)return null;let e=null;for(let t of i)(!e||t.lineNumber>e.lineNumber)&&(e=t);return e}},m9=class a{constructor(i,e){this._horizontalRangeBrand=void 0;this.left=Math.round(i),this.width=Math.round(e)}static from(i){let e=new Array(i.length);for(let t=0,o=i.length;t<o;t++){let n=i[t];e[t]=new a(n.left,n.width)}return e}toString(){return`[${this.left},${this.width}]`}},NM=class{constructor(i,e){this._floatHorizontalRangeBrand=void 0;this.left=i,this.width=e}toString(){return`[${this.left},${this.width}]`}static compare(i,e){return i.left-e.left}},uIe=class{constructor(i,e){this.outsideRenderedLine=i,this.originalLeft=e,this.left=Math.round(this.originalLeft)}},Vse=class{constructor(i,e){this.outsideRenderedLine=i;this.ranges=e}};var Bse=class{static _createRange(){return this._handyReadyRange||(this._handyReadyRange=document.createRange()),this._handyReadyRange}static _detachRange(i,e){i.selectNodeContents(e)}static _readClientRects(i,e,t,o,n){let r=this._createRange();try{return r.setStart(i,e),r.setEnd(t,o),r.getClientRects()}catch{return null}finally{this._detachRange(r,n)}}static _mergeAdjacentRanges(i){if(i.length===1)return i;i.sort(NM.compare);let e=[],t=0,o=i[0];for(let n=1,r=i.length;n<r;n++){let s=i[n];o.left+o.width+.9>=s.left?o.width=Math.max(o.width,s.left+s.width-o.left):(e[t++]=o,o=s)}return e[t++]=o,e}static _createHorizontalRangesFromClientRects(i,e,t){if(!i||i.length===0)return null;let o=[];for(let n=0,r=i.length;n<r;n++){let s=i[n];o[n]=new NM(Math.max(0,(s.left-e)/t),s.width/t)}return this._mergeAdjacentRanges(o)}static readHorizontalRanges(i,e,t,o,n,r){let l=i.children.length-1;if(0>l)return null;if(e=Math.min(l,Math.max(0,e)),o=Math.min(l,Math.max(0,o)),e===o&&t===n&&t===0&&!i.children[e].firstChild){let h=i.children[e].getClientRects();return r.markDidDomLayout(),this._createHorizontalRangesFromClientRects(h,r.clientRectDeltaLeft,r.clientRectScale)}e!==o&&o>0&&n===0&&(o--,n=1073741824);let c=i.children[e].firstChild,u=i.children[o].firstChild;if((!c||!u)&&(!c&&t===0&&e>0&&(c=i.children[e-1].firstChild,t=1073741824),!u&&n===0&&o>0&&(u=i.children[o-1].firstChild,n=1073741824)),!c||!u)return null;t=Math.min(c.textContent.length,Math.max(0,t)),n=Math.min(u.textContent.length,Math.max(0,n));let p=this._readClientRects(c,t,u,n,r.endNode);return r.markDidDomLayout(),this._createHorizontalRangesFromClientRects(p,r.clientRectDeltaLeft,r.clientRectScale)}};var pIe=class{constructor(i,e){this._viewModelDecorationBrand=void 0;this.range=i,this.options=e}};function $$e(a,i){return!(i.options.hideInCommentTokens&&kgt(a,i)||i.options.hideInStringTokens&&Egt(a,i))}function kgt(a,i){return h$i(a,i.range,e=>e===1)}function Egt(a,i){return h$i(a,i.range,e=>e===2)}function h$i(a,i,e){for(let t=i.startLineNumber;t<=i.endLineNumber;t++){let o=a.tokenization.getLineTokens(t),n=t===i.startLineNumber,r=t===i.endLineNumber,s=n?o.findTokenIndexAtOffset(i.startColumn-1):0;for(;s<o.getCount()&&!(r&&o.getStartOffset(s)>i.endColumn-1);){if(!e(o.getStandardTokenType(s)))return!1;s++}}return!0}var Zk=class{constructor(i,e,t){this.range=i;this.inlineClassName=e;this.type=t}},Tgt=class{constructor(i,e,t){this.context=i;this.model=e;this.coordinatesConverter=t;this._decorationsCache=Object.create(null)}getInlineDecorations(i){let e=new z(i,1,i,this.model.getLineMaxColumn(i)),t=this.coordinatesConverter.convertModelRangeToViewRange(e);return this.getDecorations(t,!1,!1).inlineDecorations}getDecorations(i,e,t){let o=this.context.getModelDecorations(i,e,t),n=i.startLineNumber,r=i.endLineNumber,s=[],l=0,c=[],u=[];for(let p=n;p<=r;p++)c[p-n]=[],u[p-n]=!1;for(let p=0,h=o.length;p<h;p++){let g=o[p],f=g.options;if(!$$e(this.model,g))continue;let v=this._getOrCreateViewModelDecoration(g),b=v.range;if(s[l++]=v,f.inlineClassName){let S=new Zk(b,f.inlineClassName,f.inlineClassNameAffectsLetterSpacing?3:0),y=Math.max(n,b.startLineNumber),w=Math.min(r,b.endLineNumber);for(let k=y;k<=w;k++)c[k-n].push(S),f.affectsFont&&(u[k-n]=!0)}if(f.beforeContentClassName&&n<=b.startLineNumber&&b.startLineNumber<=r){let S=new Zk(new z(b.startLineNumber,b.startColumn,b.startLineNumber,b.startColumn),f.beforeContentClassName,1);c[b.startLineNumber-n].push(S),f.affectsFont&&(u[b.startLineNumber-n]=!0)}if(f.afterContentClassName&&n<=b.endLineNumber&&b.endLineNumber<=r){let S=new Zk(new z(b.endLineNumber,b.endColumn,b.endLineNumber,b.endColumn),f.afterContentClassName,2);c[b.endLineNumber-n].push(S),f.affectsFont&&(u[b.endLineNumber-n]=!0)}}return{decorations:s,inlineDecorations:c,hasVariableFonts:u}}reset(){this._decorationsCache=Object.create(null)}onModelDecorationsChanged(){this.reset()}onLineMappingChanged(){this.reset()}_getOrCreateViewModelDecoration(i){let e=i.id,t=this._decorationsCache[e];if(!t){let o=i.range,n=i.options,r;if(n.isWholeLine){let s=this.coordinatesConverter.convertModelPositionToViewPosition(new Ie(o.startLineNumber,1),0,!1,!0),l=this.coordinatesConverter.convertModelPositionToViewPosition(new Ie(o.endLineNumber,this.model.getLineMaxColumn(o.endLineNumber)),1);r=new z(s.lineNumber,s.column,l.lineNumber,l.column)}else r=this.coordinatesConverter.convertModelRangeToViewRange(o,1);t=new pIe(r,n),this._decorationsCache[e]=t}return t}},_gt=class{constructor(i){this.context=i}getInlineDecorations(i){let e=this.context.getInjectionOffsets(i);if(!e)return[];let t=[],o=0,n=0,r=this.context.getInjectionOptions(i),s=this.context.getBreakOffsets(i);for(let l=0;l<s.length;l++){let c=new Array;t[l]=c;let u=l>0?s[l-1]:0,p=s[l];for(;n<e.length;){let h=r[n].content.length,g=e[n]+o,f=g+h;if(g>p)break;if(u<f){let v=r[n];if(v.inlineClassName){let b=this.context.getWrappedTextIndentLength(i),S=l>0?b:0,y=S+Math.max(g-u,0),w=S+Math.min(f-u,p-u);if(y!==w){let k=this.context.getBaseViewLineNumber(i)+l,T=new z(k,y+1,k,w+1),N=v.inlineClassNameAffectsLetterSpacing?3:0;c.push(new Zk(T,v.inlineClassName,N))}}}if(f<=p)o+=h,n++;else break}}return t}};var ug=class{constructor(i,e,t,o){this.endIndex=i;this.type=e;this.metadata=t;this.containsRTL=o;this._linePartBrand=void 0}isWhitespace(){return!!(this.metadata&1)}isPseudoAfter(){return!!(this.metadata&4)}};var Jv=class a{constructor(i,e,t,o){this.startColumn=i;this.endColumn=e;this.className=t;this.type=o;this._lineDecorationBrand=void 0}static _equals(i,e){return i.startColumn===e.startColumn&&i.endColumn===e.endColumn&&i.className===e.className&&i.type===e.type}static equalsArr(i,e){let t=i.length,o=e.length;if(t!==o)return!1;for(let n=0;n<t;n++)if(!a._equals(i[n],e[n]))return!1;return!0}static extractWrapped(i,e,t){if(i.length===0)return i;let o=e+1,n=t+1,r=t-e,s=[],l=0;for(let c of i)c.endColumn<=o||c.startColumn>=n||(s[l++]=new a(Math.max(1,c.startColumn-o+1),Math.min(r+1,c.endColumn-o+1),c.className,c.type));return s}static filter(i,e,t,o){if(i.length===0)return[];let n=[],r=0;for(let s=0,l=i.length;s<l;s++){let c=i[s],u=c.range;if(u.endLineNumber<e||u.startLineNumber>e||u.isEmpty()&&(c.type===0||c.type===3))continue;let p=u.startLineNumber===e?u.startColumn:t,h=u.endLineNumber===e?u.endColumn:o;n[r++]=new a(p,h,c.inlineClassName,c.type)}return n}static _typeCompare(i,e){let t=[2,0,1,3];return t[i]-t[e]}static compare(i,e){if(i.startColumn!==e.startColumn)return i.startColumn-e.startColumn;if(i.endColumn!==e.endColumn)return i.endColumn-e.endColumn;let t=a._typeCompare(i.type,e.type);return t!==0?t:i.className!==e.className?i.className<e.className?-1:1:0}},Dgt=class{constructor(i,e,t,o){this.startOffset=i,this.endOffset=e,this.className=t,this.metadata=o}},JXt=class a{constructor(){this.stopOffsets=[],this.classNames=[],this.metadata=[],this.count=0}static _metadata(i){let e=0;for(let t=0,o=i.length;t<o;t++)e|=i[t];return e}consumeLowerThan(i,e,t){for(;this.count>0&&this.stopOffsets[0]<i;){let o=0;for(;o+1<this.count&&this.stopOffsets[o]===this.stopOffsets[o+1];)o++;t.push(new Dgt(e,this.stopOffsets[o],this.classNames.join(" "),a._metadata(this.metadata))),e=this.stopOffsets[o]+1,this.stopOffsets.splice(0,o+1),this.classNames.splice(0,o+1),this.metadata.splice(0,o+1),this.count-=o+1}return this.count>0&&e<i&&(t.push(new Dgt(e,i-1,this.classNames.join(" "),a._metadata(this.metadata))),e=i),e}insert(i,e,t){if(this.count===0||this.stopOffsets[this.count-1]<=i)this.stopOffsets.push(i),this.classNames.push(e),this.metadata.push(t);else for(let o=0;o<this.count;o++)if(this.stopOffsets[o]>=i){this.stopOffsets.splice(o,0,i),this.classNames.splice(o,0,e),this.metadata.splice(o,0,t);break}this.count++}},Lgt=class{static normalize(i,e){if(e.length===0)return[];let t=[],o=new JXt,n=0;for(let r=0,s=e.length;r<s;r++){let l=e[r],c=l.startColumn,u=l.endColumn,p=l.className,h=l.type===1?2:l.type===2?4:0;if(c>1){let v=i.charCodeAt(c-2);Ru(v)&&c--}if(u>1){let v=i.charCodeAt(u-2);Ru(v)&&u--}let g=c-1,f=u-2;n=o.consumeLowerThan(g,n,t),o.count===0&&(n=g),o.insert(f,p,h)}return o.consumeLowerThan(1073741824,n,t),t}};var hL=class{get isLTR(){return!this.containsRTL&&this.textDirection!==1}constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N=!1){this.useMonospaceOptimizations=i,this.canUseHalfwidthRightwardsArrow=e,this.lineContent=t,this.continuesWithWrappedLine=o,this.isBasicASCII=n,this.containsRTL=r,this.fauxIndentLength=s,this.lineTokens=l,this.lineDecorations=c.sort(Jv.compare),this.tabSize=u,this.startVisibleColumn=p,this.spaceWidth=h,this.stopRenderingLineAfter=v,this.renderWhitespace=b==="all"?4:b==="boundary"?1:b==="selection"?2:b==="trailing"?3:0,this.renderControlCharacters=S,this.fontLigatures=y,this.selectionsOnLine=w&&w.sort((U,G)=>U.start<G.start?-1:1),this.renderNewLineWhenEmpty=N,this.textDirection=k,this.verticalScrollbarSize=T;let O=Math.abs(f-h),V=Math.abs(g-h);O<V?(this.renderSpaceWidth=f,this.renderSpaceCharCode=11825):(this.renderSpaceWidth=g,this.renderSpaceCharCode=183)}sameSelection(i){if(this.selectionsOnLine===null)return i===null;if(i===null||i.length!==this.selectionsOnLine.length)return!1;for(let e=0;e<this.selectionsOnLine.length;e++)if(!this.selectionsOnLine[e].equals(i[e]))return!1;return!0}equals(i){return this.useMonospaceOptimizations===i.useMonospaceOptimizations&&this.canUseHalfwidthRightwardsArrow===i.canUseHalfwidthRightwardsArrow&&this.lineContent===i.lineContent&&this.continuesWithWrappedLine===i.continuesWithWrappedLine&&this.isBasicASCII===i.isBasicASCII&&this.containsRTL===i.containsRTL&&this.fauxIndentLength===i.fauxIndentLength&&this.tabSize===i.tabSize&&this.startVisibleColumn===i.startVisibleColumn&&this.spaceWidth===i.spaceWidth&&this.renderSpaceWidth===i.renderSpaceWidth&&this.renderSpaceCharCode===i.renderSpaceCharCode&&this.stopRenderingLineAfter===i.stopRenderingLineAfter&&this.renderWhitespace===i.renderWhitespace&&this.renderControlCharacters===i.renderControlCharacters&&this.fontLigatures===i.fontLigatures&&Jv.equalsArr(this.lineDecorations,i.lineDecorations)&&this.lineTokens.equals(i.lineTokens)&&this.sameSelection(i.selectionsOnLine)&&this.textDirection===i.textDirection&&this.verticalScrollbarSize===i.verticalScrollbarSize&&this.renderNewLineWhenEmpty===i.renderNewLineWhenEmpty}};var q$e=class{constructor(i,e){this.partIndex=i;this.charIndex=e}},j$e=class a{static getPartIndex(i){return(i&4294901760)>>>16}static getCharIndex(i){return(i&65535)>>>0}constructor(i,e){this.length=i,this._data=new Uint32Array(this.length),this._horizontalOffset=new Uint32Array(this.length)}setColumnInfo(i,e,t,o){let n=(e<<16|t<<0)>>>0;this._data[i-1]=n,this._horizontalOffset[i-1]=o}getHorizontalOffset(i){return this._horizontalOffset.length===0?0:this._horizontalOffset[i-1]}charOffsetToPartData(i){return this.length===0?0:i<0?this._data[0]:i>=this.length?this._data[this.length-1]:this._data[i]}getDomPosition(i){let e=this.charOffsetToPartData(i-1),t=a.getPartIndex(e),o=a.getCharIndex(e);return new q$e(t,o)}getColumn(i,e){return this.partDataToCharOffset(i.partIndex,e,i.charIndex)+1}partDataToCharOffset(i,e,t){if(this.length===0)return 0;let o=(i<<16|t<<0)>>>0,n=0,r=this.length-1;for(;n+1<r;){let v=n+r>>>1,b=this._data[v];if(b===o)return v;b>o?r=v:n=v}if(n===r)return n;let s=this._data[n],l=this._data[r];if(s===o)return n;if(l===o)return r;let c=a.getPartIndex(s),u=a.getCharIndex(s),p=a.getPartIndex(l),h;c!==p?h=e:h=a.getCharIndex(l);let g=t-u,f=h-t;return g<=f?n:r}inflate(){let i=[];for(let e=0;e<this.length;e++){let t=this._data[e],o=a.getPartIndex(t),n=a.getCharIndex(t),r=this._horizontalOffset[e];i.push([o,n,r])}return i}};var Hse=class{constructor(i,e){this._renderLineOutputBrand=void 0;this.characterMapping=i,this.containsForeignElements=e}};function uW(a,i){if(a.lineContent.length===0){if(a.lineDecorations.length>0){i.appendString("<span>");let e=0,t=0,o=0;for(let r of a.lineDecorations)(r.type===1||r.type===2)&&(i.appendString('<span class="'),i.appendString(r.className),i.appendString('"></span>'),r.type===1&&(o|=1,e++),r.type===2&&(o|=2,t++));i.appendString("</span>");let n=new j$e(1,e+t);return n.setColumnInfo(1,e,0,0),new Hse(n,o)}return a.renderNewLineWhenEmpty?i.appendString(`<span><span>
</span></span>`):i.appendString("<span><span></span></span>"),new Hse(new j$e(0,0),0)}return kPo(bPo(a),i)}var ZXt=class{constructor(i,e,t){this.characterMapping=i;this.html=e;this.containsForeignElements=t}};function g$i(a){let i=new ES(1e4),e=uW(a,i);return new ZXt(e.characterMapping,i.build(),e.containsForeignElements)}var eJt=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v){this.fontIsMonospace=i;this.canUseHalfwidthRightwardsArrow=e;this.lineContent=t;this.len=o;this.isOverflowing=n;this.overflowingCharCount=r;this.parts=s;this.containsForeignElements=l;this.fauxIndentLength=c;this.tabSize=u;this.startVisibleColumn=p;this.spaceWidth=h;this.renderSpaceCharCode=g;this.renderWhitespace=f;this.renderControlCharacters=v}};function bPo(a){let i=a.lineContent,e,t,o;a.stopRenderingLineAfter!==-1&&a.stopRenderingLineAfter<i.length?(e=!0,t=i.length-a.stopRenderingLineAfter,o=a.stopRenderingLineAfter):(e=!1,t=0,o=i.length);let n=SPo(i,a.containsRTL,a.lineTokens,a.fauxIndentLength,o);a.renderControlCharacters&&!a.isBasicASCII&&(n=wPo(i,n)),(a.renderWhitespace===4||a.renderWhitespace===1||a.renderWhitespace===2&&a.selectionsOnLine||a.renderWhitespace===3&&!a.continuesWithWrappedLine)&&(n=CPo(a,i,o,n));let r=0;if(a.lineDecorations.length>0){for(let s=0,l=a.lineDecorations.length;s<l;s++){let c=a.lineDecorations[s];c.type===3||c.type===1?r|=1:c.type===2&&(r|=2)}n=xPo(i,o,n,a.lineDecorations)}return a.containsRTL?n=yPo(i,n):n=IPo(i,n,!a.isBasicASCII||a.fontLigatures),new eJt(a.useMonospaceOptimizations,a.canUseHalfwidthRightwardsArrow,i,o,e,t,n,r,a.fauxIndentLength,a.tabSize,a.startVisibleColumn,a.spaceWidth,a.renderSpaceCharCode,a.renderWhitespace,a.renderControlCharacters)}function SPo(a,i,e,t,o){let n=[],r=0;t>0&&(n[r++]=new ug(t,"",0,!1));let s=t;for(let l=0,c=e.getCount();l<c;l++){let u=e.getEndOffset(l);if(u<=t)continue;let p=e.getClassName(l);if(u>=o){let g=i?yM(a.substring(s,o)):!1;n[r++]=new ug(o,p,0,g);break}let h=i?yM(a.substring(s,u)):!1;n[r++]=new ug(u,p,0,h),s=u}return n}function IPo(a,i,e){let t=0,o=[],n=0;if(e)for(let r=0,s=i.length;r<s;r++){let l=i[r],c=l.endIndex;if(t+50<c){let u=l.type,p=l.metadata,h=l.containsRTL,g=-1,f=t;for(let v=t;v<c;v++)a.charCodeAt(v)===32&&(g=v),g!==-1&&v-f>=50&&(o[n++]=new ug(g+1,u,p,h),f=g+1,g=-1);f!==c&&(o[n++]=new ug(c,u,p,h))}else o[n++]=l;t=c}else for(let r=0,s=i.length;r<s;r++){let l=i[r],c=l.endIndex,u=c-t;if(u>50){let p=l.type,h=l.metadata,g=l.containsRTL,f=Math.ceil(u/50);for(let v=1;v<f;v++){let b=t+v*50;o[n++]=new ug(b,p,h,g)}o[n++]=new ug(c,p,h,g)}else o[n++]=l;t=c}return o}function yPo(a,i){if(i.length===0)return i;let e=i[0];if(!e.containsRTL)return i;let t=e.endIndex,o=0;for(let r=0;r<t;r++){let s=a.charCodeAt(r);if(s!==32&&s!==9){o=r;break}}if(o===0)return i;let n=[];n.push(new ug(o,e.type,e.metadata,!1)),n.push(new ug(t,e.type,e.metadata,e.containsRTL));for(let r=1;r<i.length;r++)n.push(i[r]);return n}function f$i(a){return a<32?a!==9:a===127||a>=8234&&a<=8238||a>=8294&&a<=8297||a>=8206&&a<=8207||a===1564}function wPo(a,i){let e=[],t=new ug(0,"",0,!1),o=0;for(let n of i){let r=n.endIndex;for(;o<r;o++){let s=a.charCodeAt(o);f$i(s)&&(o>t.endIndex&&(t=new ug(o,n.type,n.metadata,n.containsRTL),e.push(t)),t=new ug(o+1,"mtkcontrol",n.metadata,!1),e.push(t))}o>t.endIndex&&(t=new ug(r,n.type,n.metadata,n.containsRTL),e.push(t))}return e}function CPo(a,i,e,t){let o=a.continuesWithWrappedLine,n=a.fauxIndentLength,r=a.tabSize,s=a.startVisibleColumn,l=a.useMonospaceOptimizations,c=a.selectionsOnLine,u=a.renderWhitespace===1,p=a.renderWhitespace===3,h=a.renderSpaceWidth!==a.spaceWidth,g=[],f=0,v=0,b=t[v].type,S=t[v].containsRTL,y=t[v].endIndex,w=t.length,k=!1,T=Ap(i),N;T===-1?(k=!0,T=e,N=e):N=tv(i);let O=!1,V=0,U=c&&c[V],G=s%r;for(let te=n;te<e;te++){let pe=i.charCodeAt(te);U&&U.endExclusive<=te&&(V++,U=c&&c[V]);let de;if(te<T||te>N)de=!0;else if(pe===9)de=!0;else if(pe===32)if(u)if(O)de=!0;else{let se=te+1<e?i.charCodeAt(te+1):0;de=se===32||se===9}else de=!0;else de=!1;if(de&&c&&(de=!!U&&U.start<=te&&te<U.endExclusive),de&&p&&(de=k||te>N),de&&S&&te>=T&&te<=N&&(de=!1),O){if(!de||!l&&G>=r){if(h){let se=f>0?g[f-1].endIndex:n;for(let Se=se+1;Se<=te;Se++)g[f++]=new ug(Se,"mtkw",1,!1)}else g[f++]=new ug(te,"mtkw",1,!1);G=G%r}}else(te===y||de&&te>n)&&(g[f++]=new ug(te,b,0,S),G=G%r);for(pe===9?G=r:AT(pe)?G+=2:G++,O=de;te===y&&(v++,v<w);)b=t[v].type,S=t[v].containsRTL,y=t[v].endIndex}let $=!1;if(O)if(o&&u){let te=e>0?i.charCodeAt(e-1):0,pe=e>1?i.charCodeAt(e-2):0;te===32&&pe!==32&&pe!==9||($=!0)}else $=!0;if($)if(h){let te=f>0?g[f-1].endIndex:n;for(let pe=te+1;pe<=e;pe++)g[f++]=new ug(pe,"mtkw",1,!1)}else g[f++]=new ug(e,"mtkw",1,!1);else g[f++]=new ug(e,b,0,S);return g}function xPo(a,i,e,t){t.sort(Jv.compare);let o=Lgt.normalize(a,t),n=o.length,r=0,s=[],l=0,c=0;for(let p=0,h=e.length;p<h;p++){let g=e[p],f=g.endIndex,v=g.type,b=g.metadata,S=g.containsRTL;for(;r<n&&o[r].startOffset<f;){let y=o[r];if(y.startOffset>c&&(c=y.startOffset,s[l++]=new ug(c,v,b,S)),y.endOffset+1<=f)c=y.endOffset+1,s[l++]=new ug(c,v+" "+y.className,b|y.metadata,S),r++;else{c=f,s[l++]=new ug(c,v+" "+y.className,b|y.metadata,S);break}}f>c&&(c=f,s[l++]=new ug(c,v,b,S))}let u=e[e.length-1].endIndex;if(r<n&&o[r].startOffset===u)for(;r<n&&o[r].startOffset===u;){let p=o[r];s[l++]=new ug(c,p.className,p.metadata,!1),r++}return s}function kPo(a,i){let e=a.fontIsMonospace,t=a.canUseHalfwidthRightwardsArrow,o=a.containsForeignElements,n=a.lineContent,r=a.len,s=a.isOverflowing,l=a.overflowingCharCount,c=a.parts,u=a.fauxIndentLength,p=a.tabSize,h=a.startVisibleColumn,g=a.spaceWidth,f=a.renderSpaceCharCode,v=a.renderWhitespace,b=a.renderControlCharacters,S=new j$e(r+1,c.length),y=!1,w=0,k=h,T=0,N=0,O=0;i.appendString("<span>");for(let V=0,U=c.length;V<U;V++){let G=c[V],$=G.endIndex,te=G.type,pe=G.containsRTL,de=v!==0&&G.isWhitespace(),se=de&&!e&&(te==="mtkw"||!o),Se=w===$&&G.isPseudoAfter();if(T=0,i.appendString("<span "),pe&&i.appendString('style="unicode-bidi:isolate" '),i.appendString('class="'),i.appendString(se?"mtkz":te),i.appendASCIICharCode(34),de){let ke=0;{let Ee=w,He=k;for(;Ee<$;Ee++){let Fe=(n.charCodeAt(Ee)===9?p-He%p:1)|0;ke+=Fe,Ee>=u&&(He+=Fe)}}for(se&&(i.appendString(' style="width:'),i.appendString(String(g*ke)),i.appendString('px"')),i.appendASCIICharCode(62);w<$;w++){S.setColumnInfo(w+1,V-O,T,N),O=0;let Ee=n.charCodeAt(w),He,Ve;if(Ee===9){He=p-k%p|0,Ve=He,!t||Ve>1?i.appendCharCode(8594):i.appendCharCode(65515);for(let Fe=2;Fe<=Ve;Fe++)i.appendCharCode(160)}else He=2,Ve=1,i.appendCharCode(f),i.appendCharCode(8204);T+=He,N+=Ve,w>=u&&(k+=Ve)}}else for(i.appendASCIICharCode(62);w<$;w++){S.setColumnInfo(w+1,V-O,T,N),O=0;let ke=n.charCodeAt(w),Ee=1,He=1;switch(ke){case 9:Ee=p-k%p,He=Ee;for(let Ve=1;Ve<=Ee;Ve++)i.appendCharCode(160);break;case 32:i.appendCharCode(160);break;case 60:i.appendString("<");break;case 62:i.appendString(">");break;case 38:i.appendString("&");break;case 0:b?i.appendCharCode(9216):i.appendString("�");break;case 65279:case 8232:case 8233:case 133:i.appendCharCode(65533);break;default:AT(ke)&&He++,b&&ke<32?i.appendCharCode(9216+ke):b&&ke===127?i.appendCharCode(9249):b&&f$i(ke)?(i.appendString("[U+"),i.appendString(EPo(ke)),i.appendString("]"),Ee=8,He=Ee):i.appendCharCode(ke)}T+=Ee,N+=He,w>=u&&(k+=He)}Se?O++:O=0,w>=r&&!y&&G.isPseudoAfter()&&(y=!0,S.setColumnInfo(w+1,V,T,N)),i.appendString("</span>")}return y||S.setColumnInfo(r+1,c.length-1,T,N),s&&(i.appendString('<span class="mtkoverflow">'),i.appendString(d(960,null,TPo(l))),i.appendString("</span>")),i.appendString("</span>"),new Hse(S,o)}function EPo(a){return a.toString(16).toUpperCase().padStart(4,"0")}function TPo(a){return a<1024?d(959,null,a):a<1024*1024?`${(a/1024).toFixed(1)} KB`:`${(a/1024/1024).toFixed(1)} MB`}function Ug(a){return a==="hcDark"||a==="hcLight"}function Ip(a){return a==="dark"||a==="hcDark"}var _Po=(function(){return kr?!0:!(Wn||yc||Vb)})(),hIe=!0,pW=class a{constructor(i,e){this._viewGpuContext=i;this._options=e,this._isMaybeInvalid=!0,this._renderedViewLine=null}static{this.CLASS_NAME="view-line"}getDomNode(){return this._renderedViewLine&&this._renderedViewLine.domNode?this._renderedViewLine.domNode.domNode:null}setDomNode(i){if(this._renderedViewLine)this._renderedViewLine.domNode=or(i);else throw new Error("I have no rendered view line to set the dom node to...")}onContentChanged(){this._isMaybeInvalid=!0}onTokensChanged(){this._isMaybeInvalid=!0}onDecorationsChanged(){this._isMaybeInvalid=!0}onOptionsChanged(i){this._isMaybeInvalid=!0,this._options=i}onSelectionChanged(){return Ug(this._options.themeType)||this._renderedViewLine?.input.renderWhitespace===2?(this._isMaybeInvalid=!0,!0):!1}renderLine(i,e,t,o,n){if(this._options.useGpu&&this._viewGpuContext?.canRender(this._options,o,i))return this._renderedViewLine?.domNode?.domNode.remove(),this._renderedViewLine=null,!1;if(this._isMaybeInvalid===!1)return!1;this._isMaybeInvalid=!1;let r=o.getViewLineRenderingData(i),s=this._options,l=Jv.filter(r.inlineDecorations,i,r.minColumn,r.maxColumn),c=s.experimentalWhitespaceRendering==="off"?s.renderWhitespace:"none",u=!r.hasVariableFonts,p=null;if(Ug(s.themeType)||c==="selection"){let v=o.selections;for(let b of v){if(b.endLineNumber<i||b.startLineNumber>i)continue;let S=b.startLineNumber===i?b.startColumn:r.minColumn,y=b.endLineNumber===i?b.endColumn:r.maxColumn;S<y&&(Ug(s.themeType)&&l.push(new Jv(S,y,"inline-selected-text",0)),c==="selection"&&(p||(p=[]),p.push(new di(S-1,y-1))))}}let h=new hL(s.useMonospaceOptimizations,s.canUseHalfwidthRightwardsArrow,r.content,r.continuesWithWrappedLine,r.isBasicASCII,r.containsRTL,r.minColumn-1,r.tokens,l,r.tabSize,r.startVisibleColumn,s.spaceWidth,s.middotWidth,s.wsmiddotWidth,s.stopRenderingLineAfter,c,s.renderControlCharacters,s.fontLigatures!==mx.OFF,p,r.textDirection,s.verticalScrollbarSize);if(this._renderedViewLine&&this._renderedViewLine.input.equals(h))return!1;n.appendString("<div "),r.textDirection===1?n.appendString('dir="rtl" '):r.containsRTL&&n.appendString('dir="ltr" '),n.appendString('style="top:'),n.appendString(String(e)),n.appendString("px;height:"),n.appendString(String(t)),n.appendString("px;line-height:"),n.appendString(String(t)),r.textDirection===1&&(n.appendString("px;padding-right:"),n.appendString(String(s.verticalScrollbarSize))),n.appendString('px;" class="'),n.appendString(a.CLASS_NAME),n.appendString('">');let g=uW(h,n);n.appendString("</div>");let f=null;return u&&hIe&&_Po&&r.isBasicASCII&&h.isLTR&&s.useMonospaceOptimizations&&g.containsForeignElements===0&&(f=new mIe(this._renderedViewLine?this._renderedViewLine.domNode:null,h,g.characterMapping)),f||(f=v$i(this._renderedViewLine?this._renderedViewLine.domNode:null,h,g.characterMapping,g.containsForeignElements)),this._renderedViewLine=f,!0}layoutLine(i,e,t){this._renderedViewLine&&this._renderedViewLine.domNode&&(this._renderedViewLine.domNode.setTop(e),this._renderedViewLine.domNode.setHeight(t),this._renderedViewLine.domNode.setLineHeight(t))}isRenderedRTL(){return this._renderedViewLine?this._renderedViewLine.input.textDirection===1:!1}getWidth(i){return this._renderedViewLine?this._renderedViewLine.getWidth(i):0}getWidthIsFast(){return this._renderedViewLine?this._renderedViewLine.getWidthIsFast():!0}needsMonospaceFontCheck(){return this._renderedViewLine?this._renderedViewLine instanceof mIe:!1}monospaceAssumptionsAreValid(){return this._renderedViewLine&&this._renderedViewLine instanceof mIe?this._renderedViewLine.monospaceAssumptionsAreValid():hIe}onMonospaceAssumptionsInvalidated(){this._renderedViewLine&&this._renderedViewLine instanceof mIe&&(this._renderedViewLine=this._renderedViewLine.toSlowRenderedLine())}getVisibleRangesForRange(i,e,t,o){if(!this._renderedViewLine)return null;e=Math.min(this._renderedViewLine.input.lineContent.length+1,Math.max(1,e)),t=Math.min(this._renderedViewLine.input.lineContent.length+1,Math.max(1,t));let n=this._renderedViewLine.input.stopRenderingLineAfter;if(n!==-1&&e>n+1&&t>n+1)return new Vse(!0,[new NM(this.getWidth(o),0)]);n!==-1&&e>n+1&&(e=n+1),n!==-1&&t>n+1&&(t=n+1);let r=this._renderedViewLine.getVisibleRangesForRange(i,e,t,o);return r&&r.length>0?new Vse(!1,r):null}getColumnOfNodeOffset(i,e){return this._renderedViewLine?this._renderedViewLine.getColumnOfNodeOffset(i,e):1}resetCachedWidth(){this._renderedViewLine?.resetCachedWidth()}};var mIe=class{constructor(i,e,t){this._cachedWidth=-1;this.domNode=i,this.input=e;let o=Math.floor(e.lineContent.length/300);if(o>0){this._keyColumnPixelOffsetCache=new Float32Array(o);for(let n=0;n<o;n++)this._keyColumnPixelOffsetCache[n]=-1}else this._keyColumnPixelOffsetCache=null;this._characterMapping=t,this._charWidth=e.spaceWidth}getWidth(i){if(!this.domNode||this.input.lineContent.length<300){let e=this._characterMapping.getHorizontalOffset(this._characterMapping.length);return Math.round(this._charWidth*e)}return this._cachedWidth===-1&&(this._cachedWidth=this._getReadingTarget(this.domNode).offsetWidth,i?.markDidDomLayout()),this._cachedWidth}getWidthIsFast(){return this.input.lineContent.length<300||this._cachedWidth!==-1}resetCachedWidth(){this._cachedWidth=-1}monospaceAssumptionsAreValid(){if(!this.domNode)return hIe;if(this.input.lineContent.length<300){let i=this.getWidth(null),e=this.domNode.domNode.firstChild.offsetWidth;Math.abs(i-e)>=2&&(console.warn("monospace assumptions have been violated, therefore disabling monospace optimizations!"),hIe=!1)}return hIe}toSlowRenderedLine(){return v$i(this.domNode,this.input,this._characterMapping,0)}getVisibleRangesForRange(i,e,t,o){let n=this._getColumnPixelOffset(i,e,o),r=this._getColumnPixelOffset(i,t,o);return[new NM(n,r-n)]}_getColumnPixelOffset(i,e,t){if(e<=300){let c=this._characterMapping.getHorizontalOffset(e);return this._charWidth*c}let o=Math.floor((e-1)/300)-1,n=(o+1)*300+1,r=-1;if(this._keyColumnPixelOffsetCache&&(r=this._keyColumnPixelOffsetCache[o],r===-1&&(r=this._actualReadPixelOffset(i,n,t),this._keyColumnPixelOffsetCache[o]=r)),r===-1){let c=this._characterMapping.getHorizontalOffset(e);return this._charWidth*c}let s=this._characterMapping.getHorizontalOffset(n),l=this._characterMapping.getHorizontalOffset(e);return r+this._charWidth*(l-s)}_getReadingTarget(i){return i.domNode.firstChild}_actualReadPixelOffset(i,e,t){if(!this.domNode)return-1;let o=this._characterMapping.getDomPosition(e),n=Bse.readHorizontalRanges(this._getReadingTarget(this.domNode),o.partIndex,o.charIndex,o.partIndex,o.charIndex,t);return!n||n.length===0?-1:n[0].left}getColumnOfNodeOffset(i,e){return K$(this._characterMapping,i,e)}},Rgt=class{constructor(i,e,t,o){if(this.domNode=i,this.input=e,this._characterMapping=t,this._isWhitespaceOnly=/^\s*$/.test(e.lineContent),this._containsForeignElements=o,this._cachedWidth=-1,this._pixelOffsetCache=null,e.isLTR){this._pixelOffsetCache=new Float32Array(Math.max(2,this._characterMapping.length+1));for(let n=0,r=this._characterMapping.length;n<=r;n++)this._pixelOffsetCache[n]=-1}}_getReadingTarget(i){return i.domNode.firstChild}getWidth(i){return this.domNode?(this._cachedWidth===-1&&(this._cachedWidth=this._getReadingTarget(this.domNode).offsetWidth,i?.markDidDomLayout()),this._cachedWidth):0}getWidthIsFast(){return this._cachedWidth!==-1}resetCachedWidth(){if(this._cachedWidth=-1,this._pixelOffsetCache!==null)for(let i=0,e=this._pixelOffsetCache.length;i<e;i++)this._pixelOffsetCache[i]=-1}getVisibleRangesForRange(i,e,t,o){if(!this.domNode)return null;if(this._pixelOffsetCache!==null){let n=this._readPixelOffset(this.domNode,i,e,o);if(n===-1)return null;let r=this._readPixelOffset(this.domNode,i,t,o);return r===-1?null:[new NM(n,r-n)]}return this._readVisibleRangesForRange(this.domNode,i,e,t,o)}_readVisibleRangesForRange(i,e,t,o,n){if(t===o){let r=this._readPixelOffset(i,e,t,n);return r===-1?null:[new NM(r,0)]}else return this._readRawVisibleRangesForRange(i,t,o,n)}_readPixelOffset(i,e,t,o){if(this.input.isLTR&&this._characterMapping.length===0){if(this._containsForeignElements===0||this._containsForeignElements===2)return 0;if(this._containsForeignElements===1)return this.getWidth(o);let n=this._getReadingTarget(i);return n.firstChild?(o.markDidDomLayout(),n.firstChild.offsetWidth):0}if(this._pixelOffsetCache!==null){let n=this._pixelOffsetCache[t];if(n!==-1)return n;let r=this._actualReadPixelOffset(i,e,t,o);return this._pixelOffsetCache[t]=r,r}return this._actualReadPixelOffset(i,e,t,o)}_actualReadPixelOffset(i,e,t,o){if(this._characterMapping.length===0){let l=Bse.readHorizontalRanges(this._getReadingTarget(i),0,0,0,0,o);return!l||l.length===0?-1:l[0].left}if(this.input.isLTR&&t===this._characterMapping.length&&this._isWhitespaceOnly&&this._containsForeignElements===0)return this.getWidth(o);let n=this._characterMapping.getDomPosition(t),r=Bse.readHorizontalRanges(this._getReadingTarget(i),n.partIndex,n.charIndex,n.partIndex,n.charIndex,o);if(!r||r.length===0)return-1;let s=r[0].left;if(this.input.isBasicASCII){let l=this._characterMapping.getHorizontalOffset(t),c=Math.round(this.input.spaceWidth*l);if(Math.abs(c-s)<=1)return c}return s}_readRawVisibleRangesForRange(i,e,t,o){if(this.input.isLTR&&e===1&&t===this._characterMapping.length)return[new NM(0,this.getWidth(o))];let n=this._characterMapping.getDomPosition(e),r=this._characterMapping.getDomPosition(t);return Bse.readHorizontalRanges(this._getReadingTarget(i),n.partIndex,n.charIndex,r.partIndex,r.charIndex,o)}getColumnOfNodeOffset(i,e){return K$(this._characterMapping,i,e)}},tJt=class extends Rgt{_readVisibleRangesForRange(i,e,t,o,n){let r=super._readVisibleRangesForRange(i,e,t,o,n);if(!r||r.length===0||t===o||t===1&&o===this._characterMapping.length)return r;if(this.input.isLTR){let s=this._readPixelOffset(i,e,o,n);if(s!==-1){let l=r[r.length-1];l.left<s&&(l.width=s-l.left)}}return r}},v$i=(function(){return H0?DPo:LPo})();function DPo(a,i,e,t){return new tJt(a,i,e,t)}function LPo(a,i,e,t){return new Rgt(a,i,e,t)}function K$(a,i,e){let t=i.textContent.length,o=-1;for(;i;)i=i.previousSibling,o++;return a.getColumn(new q$e(o,e),t)}var BU=class{constructor(i=null){this.hitTarget=i;this.type=0}},Mgt=class{constructor(i,e,t){this.position=i;this.spanNode=e;this.injectedText=t;this.type=1}get hitTarget(){return this.spanNode}},gIe;(i=>{function a(e,t,o){let n=e.getPositionFromDOMInfo(t,o);return n?new Mgt(n,t,null):new BU(t)}i.createFromDOMInfo=a})(gIe||={});var Pgt=class{constructor(i,e){this.lastViewCursorsRenderData=i;this.lastTextareaPosition=e}},lv=class{static _deduceRage(i,e=null){return!e&&i?new z(i.lineNumber,i.column,i.lineNumber,i.column):e??null}static createUnknown(i,e,t){return{type:0,element:i,mouseColumn:e,position:t,range:this._deduceRage(t)}}static createTextarea(i,e){return{type:1,element:i,mouseColumn:e,position:null,range:null}}static createMargin(i,e,t,o,n,r){return{type:i,element:e,mouseColumn:t,position:o,range:n,detail:r}}static createViewZone(i,e,t,o,n){return{type:i,element:e,mouseColumn:t,position:o,range:this._deduceRage(o),detail:n}}static createContentText(i,e,t,o,n){return{type:6,element:i,mouseColumn:e,position:t,range:this._deduceRage(t,o),detail:n}}static createContentEmpty(i,e,t,o){return{type:7,element:i,mouseColumn:e,position:t,range:this._deduceRage(t),detail:o}}static createContentWidget(i,e,t){return{type:9,element:i,mouseColumn:e,position:null,range:null,detail:t}}static createScrollbar(i,e,t){return{type:11,element:i,mouseColumn:e,position:t,range:this._deduceRage(t)}}static createOverlayWidget(i,e,t){return{type:12,element:i,mouseColumn:e,position:null,range:null,detail:t}}static createOutsideEditor(i,e,t,o){return{type:13,element:null,mouseColumn:i,position:e,range:this._deduceRage(e),outsidePosition:t,outsideDistance:o}}static _typeToString(i){return i===1?"TEXTAREA":i===2?"GUTTER_GLYPH_MARGIN":i===3?"GUTTER_LINE_NUMBERS":i===4?"GUTTER_LINE_DECORATIONS":i===5?"GUTTER_VIEW_ZONE":i===6?"CONTENT_TEXT":i===7?"CONTENT_EMPTY":i===8?"CONTENT_VIEW_ZONE":i===9?"CONTENT_WIDGET":i===10?"OVERVIEW_RULER":i===11?"SCROLLBAR":i===12?"OVERLAY_WIDGET":"UNKNOWN"}static toString(i){return this._typeToString(i.type)+": "+i.position+" - "+i.range+" - "+JSON.stringify(i.detail)}},By=class{static isTextArea(i){return i.length===2&&i[0]===3&&i[1]===7}static isChildOfViewLines(i){return i.length>=4&&i[0]===3&&i[3]===8}static isStrictChildOfViewLines(i){return i.length>4&&i[0]===3&&i[3]===8}static isChildOfScrollableElement(i){return i.length>=2&&i[0]===3&&i[1]===6}static isChildOfMinimap(i){return i.length>=2&&i[0]===3&&i[1]===9}static isChildOfContentWidgets(i){return i.length>=4&&i[0]===3&&i[3]===1}static isChildOfOverflowGuard(i){return i.length>=1&&i[0]===3}static isChildOfOverflowingContentWidgets(i){return i.length>=1&&i[0]===2}static isChildOfOverlayWidgets(i){return i.length>=2&&i[0]===3&&i[1]===4}static isChildOfOverflowingOverlayWidgets(i){return i.length>=1&&i[0]===5}},fIe=class a{constructor(i,e,t){this.viewModel=i.viewModel;let o=i.configuration.options;this.layoutInfo=o.get(165),this.viewDomNode=e.viewDomNode,this.viewLinesGpu=e.viewLinesGpu,this.lineHeight=o.get(75),this.stickyTabStops=o.get(132),this.typicalHalfwidthCharacterWidth=o.get(59).typicalHalfwidthCharacterWidth,this.lastRenderData=t,this._context=i,this._viewHelper=e}getZoneAtCoord(i){return a.getZoneAtCoord(this._context,i)}static getZoneAtCoord(i,e){let t=i.viewLayout.getWhitespaceAtVerticalOffset(e);if(t){let o=t.verticalOffset+t.height/2,n=i.viewModel.getLineCount(),r=null,s,l=null;return t.afterLineNumber!==n&&(l=new Ie(t.afterLineNumber+1,1)),t.afterLineNumber>0&&(r=new Ie(t.afterLineNumber,i.viewModel.getLineMaxColumn(t.afterLineNumber))),l===null?s=r:r===null?s=l:e<o?s=r:s=l,{viewZoneId:t.id,afterLineNumber:t.afterLineNumber,positionBefore:r,positionAfter:l,position:s}}return null}getFullLineRangeAtCoord(i){if(this._context.viewLayout.isAfterLines(i)){let o=this._context.viewModel.getLineCount(),n=this._context.viewModel.getLineMaxColumn(o);return{range:new z(o,n,o,n),isAfterLines:!0}}let e=this._context.viewLayout.getLineNumberAtVerticalOffset(i),t=this._context.viewModel.getLineMaxColumn(e);return{range:new z(e,1,e,t),isAfterLines:!1}}getLineNumberAtVerticalOffset(i){return this._context.viewLayout.getLineNumberAtVerticalOffset(i)}isAfterLines(i){return this._context.viewLayout.isAfterLines(i)}isInTopPadding(i){return this._context.viewLayout.isInTopPadding(i)}isInBottomPadding(i){return this._context.viewLayout.isInBottomPadding(i)}getVerticalOffsetForLineNumber(i){return this._context.viewLayout.getVerticalOffsetForLineNumber(i)}findAttribute(i,e){return a._findAttribute(i,e,this._viewHelper.viewDomNode)}static _findAttribute(i,e,t){for(;i&&i!==i.ownerDocument.body;){if(i.hasAttribute&&i.hasAttribute(e))return i.getAttribute(e);if(i===t)return null;i=i.parentNode}return null}getLineWidth(i){return this._viewHelper.getLineWidth(i)}isRtl(i){return this.viewModel.getTextDirection(i)===1}visibleRangeForPosition(i,e){return this._viewHelper.visibleRangeForPosition(i,e)}getPositionFromDOMInfo(i,e){return this._viewHelper.getPositionFromDOMInfo(i,e)}getCurrentScrollTop(){return this._context.viewLayout.getCurrentScrollTop()}getCurrentScrollLeft(){return this._context.viewLayout.getCurrentScrollLeft()}},iJt=class{constructor(i,e,t,o){this.editorPos=e,this.pos=t,this.relativePos=o,this.mouseVerticalOffset=Math.max(0,i.getCurrentScrollTop()+this.relativePos.y),this.mouseContentHorizontalOffset=i.getCurrentScrollLeft()+this.relativePos.x-i.layoutInfo.contentLeft,this.isInMarginArea=this.relativePos.x<i.layoutInfo.contentLeft&&this.relativePos.x>=i.layoutInfo.glyphMarginLeft,this.isInContentArea=!this.isInMarginArea,this.mouseColumn=Math.max(0,vIe._getMouseColumn(this.mouseContentHorizontalOffset,i.typicalHalfwidthCharacterWidth))}},oJt=class extends iJt{constructor(e,t,o,n,r){super(e,t,o,n);this.hitTestResult=new co(()=>vIe.doHitTest(this._ctx,this));this._targetPathCacheElement=null;this._targetPathCacheValue=new Uint8Array(0);this._ctx=e,this._eventTarget=r;let s=!!this._eventTarget;this._useHitTestTarget=!s}get target(){return this._useHitTestTarget?this.hitTestResult.value.hitTarget:this._eventTarget}get targetPath(){return this._targetPathCacheElement!==this.target&&(this._targetPathCacheElement=this.target,this._targetPathCacheValue=PS.collect(this.target,this._ctx.viewDomNode)),this._targetPathCacheValue}toString(){return`pos(${this.pos.x},${this.pos.y}), editorPos(${this.editorPos.x},${this.editorPos.y}), relativePos(${this.relativePos.x},${this.relativePos.y}), mouseVerticalOffset: ${this.mouseVerticalOffset}, mouseContentHorizontalOffset: ${this.mouseContentHorizontalOffset}
target: ${this.target?this.target.outerHTML:null}`}get wouldBenefitFromHitTestTargetSwitch(){return!this._useHitTestTarget&&this.hitTestResult.value.hitTarget!==null&&this.target!==this.hitTestResult.value.hitTarget}switchToHitTestTarget(){this._useHitTestTarget=!0}_getMouseColumn(e=null){return e&&e.column<this._ctx.viewModel.getLineMaxColumn(e.lineNumber)?al.visibleColumnFromColumn(this._ctx.viewModel.getLineContent(e.lineNumber),e.column,this._ctx.viewModel.model.getOptions().tabSize)+1:this.mouseColumn}fulfillUnknown(e=null){return lv.createUnknown(this.target,this._getMouseColumn(e),e)}fulfillTextarea(){return lv.createTextarea(this.target,this._getMouseColumn())}fulfillMargin(e,t,o,n){return lv.createMargin(e,this.target,this._getMouseColumn(t),t,o,n)}fulfillViewZone(e,t,o){return lv.createViewZone(e,this.target,this._getMouseColumn(),t,o)}fulfillContentText(e,t,o){return lv.createContentText(this.target,this._getMouseColumn(e),e,t,o)}fulfillContentEmpty(e,t){return lv.createContentEmpty(this.target,this._getMouseColumn(e),e,t)}fulfillContentWidget(e){return lv.createContentWidget(this.target,this._getMouseColumn(),e)}fulfillScrollbar(e){return lv.createScrollbar(this.target,this._getMouseColumn(e),e)}fulfillOverlayWidget(e){return lv.createOverlayWidget(this.target,this._getMouseColumn(),e)}},b$i={isAfterLines:!0};function Use(a){return{isAfterLines:!1,horizontalDistanceToText:a}}var vIe=class a{constructor(i,e){this._context=i,this._viewHelper=e}mouseTargetIsWidget(i){let e=i.target,t=PS.collect(e,this._viewHelper.viewDomNode);return!!(By.isChildOfContentWidgets(t)||By.isChildOfOverflowingContentWidgets(t)||By.isChildOfOverlayWidgets(t)||By.isChildOfOverflowingOverlayWidgets(t))}createMouseTarget(i,e,t,o,n){let r=new fIe(this._context,this._viewHelper,i),s=new oJt(r,e,t,o,n);try{let l=a._createMouseTarget(r,s);if(l.type===6&&r.stickyTabStops&&l.position!==null){let c=a._snapToSoftTabBoundary(l.position,r.viewModel),u=z.fromPositions(c,c).plusRange(l.range);return s.fulfillContentText(c,u,l.detail)}return l}catch{return s.fulfillUnknown()}}static _createMouseTarget(i,e){if(e.target===null)return e.fulfillUnknown();let t=e,o=null;return!By.isChildOfOverflowGuard(e.targetPath)&&!By.isChildOfOverflowingContentWidgets(e.targetPath)&&!By.isChildOfOverflowingOverlayWidgets(e.targetPath)&&(o=o||e.fulfillUnknown()),o=o||a._hitTestContentWidget(i,t),o=o||a._hitTestOverlayWidget(i,t),o=o||a._hitTestMinimap(i,t),o=o||a._hitTestScrollbarSlider(i,t),o=o||a._hitTestViewZone(i,t),o=o||a._hitTestMargin(i,t),o=o||a._hitTestViewCursor(i,t),o=o||a._hitTestTextArea(i,t),o=o||a._hitTestViewLines(i,t),o=o||a._hitTestScrollbar(i,t),o||e.fulfillUnknown()}static _hitTestContentWidget(i,e){if(By.isChildOfContentWidgets(e.targetPath)||By.isChildOfOverflowingContentWidgets(e.targetPath)){let t=i.findAttribute(e.target,"widgetId");return t?e.fulfillContentWidget(t):e.fulfillUnknown()}return null}static _hitTestOverlayWidget(i,e){if(By.isChildOfOverlayWidgets(e.targetPath)||By.isChildOfOverflowingOverlayWidgets(e.targetPath)){let t=i.findAttribute(e.target,"widgetId");return t?e.fulfillOverlayWidget(t):e.fulfillUnknown()}return null}static _hitTestViewCursor(i,e){if(e.target){let t=i.lastRenderData.lastViewCursorsRenderData;for(let o of t)if(e.target===o.domNode)return e.fulfillContentText(o.position,null,{mightBeForeignElement:!1,injectedText:null})}if(e.isInContentArea){let t=i.lastRenderData.lastViewCursorsRenderData,o=e.mouseContentHorizontalOffset,n=e.mouseVerticalOffset;for(let r of t){if(o<r.contentLeft||o>r.contentLeft+r.width)continue;let s=i.getVerticalOffsetForLineNumber(r.position.lineNumber);if(s<=n&&n<=s+r.height)return e.fulfillContentText(r.position,null,{mightBeForeignElement:!1,injectedText:null})}}return null}static _hitTestViewZone(i,e){let t=i.getZoneAtCoord(e.mouseVerticalOffset);if(t){let o=e.isInContentArea?8:5;return e.fulfillViewZone(o,t.position,t)}return null}static _hitTestTextArea(i,e){return By.isTextArea(e.targetPath)?i.lastRenderData.lastTextareaPosition?e.fulfillContentText(i.lastRenderData.lastTextareaPosition,null,{mightBeForeignElement:!1,injectedText:null}):e.fulfillTextarea():null}static _hitTestMargin(i,e){if(e.isInMarginArea){let t=i.getFullLineRangeAtCoord(e.mouseVerticalOffset),o=t.range.getStartPosition(),n=Math.abs(e.relativePos.x),r={isAfterLines:t.isAfterLines,glyphMarginLeft:i.layoutInfo.glyphMarginLeft,glyphMarginWidth:i.layoutInfo.glyphMarginWidth,lineNumbersWidth:i.layoutInfo.lineNumbersWidth,offsetX:n};if(n-=i.layoutInfo.glyphMarginLeft,n<=i.layoutInfo.glyphMarginWidth){let s=i.viewModel.coordinatesConverter.convertViewPositionToModelPosition(t.range.getStartPosition()),l=i.viewModel.glyphLanes.getLanesAtLine(s.lineNumber);return r.glyphMarginLane=l[Math.floor(n/i.lineHeight)],e.fulfillMargin(2,o,t.range,r)}return n-=i.layoutInfo.glyphMarginWidth,n<=i.layoutInfo.lineNumbersWidth?e.fulfillMargin(3,o,t.range,r):(n-=i.layoutInfo.lineNumbersWidth,e.fulfillMargin(4,o,t.range,r))}return null}static _hitTestViewLines(i,e){if(!By.isChildOfViewLines(e.targetPath))return null;if(i.isInTopPadding(e.mouseVerticalOffset))return e.fulfillContentEmpty(new Ie(1,1),b$i);if(i.isAfterLines(e.mouseVerticalOffset)||i.isInBottomPadding(e.mouseVerticalOffset)){let o=i.viewModel.getLineCount(),n=i.viewModel.getLineMaxColumn(o);return e.fulfillContentEmpty(new Ie(o,n),b$i)}if(By.isStrictChildOfViewLines(e.targetPath)){let o=i.getLineNumberAtVerticalOffset(e.mouseVerticalOffset),n=i.viewModel.getLineLength(o),r=i.getLineWidth(o);if(n===0){let l=Use(e.mouseContentHorizontalOffset-r);return e.fulfillContentEmpty(new Ie(o,1),l)}if(i.isRtl(o)){if(e.mouseContentHorizontalOffset+r<=i.layoutInfo.contentWidth-i.layoutInfo.verticalScrollbarWidth){let l=Use(e.mouseContentHorizontalOffset-r),c=new Ie(o,i.viewModel.getLineMaxColumn(o));return e.fulfillContentEmpty(c,l)}}else if(e.mouseContentHorizontalOffset>=r){let l=Use(e.mouseContentHorizontalOffset-r),c=new Ie(o,i.viewModel.getLineMaxColumn(o));return e.fulfillContentEmpty(c,l)}}else if(i.viewLinesGpu){let o=i.getLineNumberAtVerticalOffset(e.mouseVerticalOffset);if(i.viewModel.getLineLength(o)===0){let l=i.getLineWidth(o),c=Use(e.mouseContentHorizontalOffset-l);return e.fulfillContentEmpty(new Ie(o,1),c)}let n=i.getLineWidth(o);if(i.isRtl(o)){if(e.mouseContentHorizontalOffset+n<=i.layoutInfo.contentWidth-i.layoutInfo.verticalScrollbarWidth){let l=Use(e.mouseContentHorizontalOffset-n),c=new Ie(o,i.viewModel.getLineMaxColumn(o));return e.fulfillContentEmpty(c,l)}}else if(e.mouseContentHorizontalOffset>=n){let l=Use(e.mouseContentHorizontalOffset-n),c=new Ie(o,i.viewModel.getLineMaxColumn(o));return e.fulfillContentEmpty(c,l)}let s=i.viewLinesGpu.getPositionAtCoordinate(o,e.mouseContentHorizontalOffset);if(s){let l={injectedText:null,mightBeForeignElement:!1};return e.fulfillContentText(s,z.fromPositions(s,s),l)}}let t=e.hitTestResult.value;return t.type===1?a.createMouseTargetFromHitTestPosition(i,e,t.spanNode,t.position,t.injectedText):e.wouldBenefitFromHitTestTargetSwitch?(e.switchToHitTestTarget(),this._createMouseTarget(i,e)):e.fulfillUnknown()}static _hitTestMinimap(i,e){if(By.isChildOfMinimap(e.targetPath)){let t=i.getLineNumberAtVerticalOffset(e.mouseVerticalOffset),o=i.viewModel.getLineMaxColumn(t);return e.fulfillScrollbar(new Ie(t,o))}return null}static _hitTestScrollbarSlider(i,e){if(By.isChildOfScrollableElement(e.targetPath)&&e.target&&e.target.nodeType===1){let t=e.target.className;if(t&&/\b(slider|scrollbar)\b/.test(t)){let o=i.getLineNumberAtVerticalOffset(e.mouseVerticalOffset),n=i.viewModel.getLineMaxColumn(o);return e.fulfillScrollbar(new Ie(o,n))}}return null}static _hitTestScrollbar(i,e){if(By.isChildOfScrollableElement(e.targetPath)){let t=i.getLineNumberAtVerticalOffset(e.mouseVerticalOffset),o=i.viewModel.getLineMaxColumn(t);return e.fulfillScrollbar(new Ie(t,o))}return null}getMouseColumn(i){let e=this._context.configuration.options,t=e.get(165),o=this._context.viewLayout.getCurrentScrollLeft()+i.x-t.contentLeft;return a._getMouseColumn(o,e.get(59).typicalHalfwidthCharacterWidth)}static _getMouseColumn(i,e){return i<0?1:Math.round(i/e)+1}static createMouseTargetFromHitTestPosition(i,e,t,o,n){let r=o.lineNumber,s=o.column,l=i.getLineWidth(r);if(e.mouseContentHorizontalOffset>l){let S=Use(e.mouseContentHorizontalOffset-l);return e.fulfillContentEmpty(o,S)}let c=i.visibleRangeForPosition(r,s);if(!c)return e.fulfillUnknown(o);let u=c.left;if(Math.abs(e.mouseContentHorizontalOffset-u)<1)return e.fulfillContentText(o,null,{mightBeForeignElement:!!n,injectedText:n});let p=[];if(p.push({offset:c.left,column:s}),s>1){let S=i.visibleRangeForPosition(r,s-1);S&&p.push({offset:S.left,column:s-1})}let h=i.viewModel.getLineMaxColumn(r);if(s<h){let S=i.visibleRangeForPosition(r,s+1);S&&p.push({offset:S.left,column:s+1})}p.sort((S,y)=>S.offset-y.offset);let g=e.pos.toClientCoordinates(Me(i.viewDomNode)),f=t.getBoundingClientRect(),v=f.left<=g.clientX&&g.clientX<=f.right,b=null;for(let S=1;S<p.length;S++){let y=p[S-1],w=p[S];if(y.offset<=e.mouseContentHorizontalOffset&&e.mouseContentHorizontalOffset<=w.offset){b=new z(r,y.column,r,w.column);let k=Math.abs(y.offset-e.mouseContentHorizontalOffset),T=Math.abs(w.offset-e.mouseContentHorizontalOffset);o=k<T?new Ie(r,y.column):new Ie(r,w.column);break}}return e.fulfillContentText(o,b,{mightBeForeignElement:!v||!!n,injectedText:n})}static _doHitTestWithCaretRangeFromPoint(i,e){let t=i.getLineNumberAtVerticalOffset(e.mouseVerticalOffset),o=i.getVerticalOffsetForLineNumber(t),n=o+i.lineHeight;if(!(t===i.viewModel.getLineCount()&&e.mouseVerticalOffset>n)){let s=Math.floor((o+n)/2),l=e.pos.y+(s-e.mouseVerticalOffset);l<=e.editorPos.y&&(l=e.editorPos.y+1),l>=e.editorPos.y+e.editorPos.height&&(l=e.editorPos.y+e.editorPos.height-1);let c=new U$(e.pos.x,l),u=this._actualDoHitTestWithCaretRangeFromPoint(i,c.toClientCoordinates(Me(i.viewDomNode)));if(u.type===1)return u}return this._actualDoHitTestWithCaretRangeFromPoint(i,e.pos.toClientCoordinates(Me(i.viewDomNode)))}static _actualDoHitTestWithCaretRangeFromPoint(i,e){let t=_M(i.viewDomNode),o;if(t?typeof t.caretRangeFromPoint>"u"?o=RPo(t,e.clientX,e.clientY):o=t.caretRangeFromPoint(e.clientX,e.clientY):o=i.viewDomNode.ownerDocument.caretRangeFromPoint(e.clientX,e.clientY),!o||!o.startContainer)return new BU;let n=o.startContainer;if(n.nodeType===n.TEXT_NODE){let r=n.parentNode,s=r?r.parentNode:null,l=s?s.parentNode:null;return(l&&l.nodeType===l.ELEMENT_NODE?l.className:null)===pW.CLASS_NAME?gIe.createFromDOMInfo(i,r,o.startOffset):new BU(n.parentNode)}else if(n.nodeType===n.ELEMENT_NODE){let r=n.parentNode,s=r?r.parentNode:null;return(s&&s.nodeType===s.ELEMENT_NODE?s.className:null)===pW.CLASS_NAME?gIe.createFromDOMInfo(i,n,n.textContent.length):new BU(n)}return new BU}static _doHitTestWithCaretPositionFromPoint(i,e){let t=i.viewDomNode.ownerDocument.caretPositionFromPoint(e.clientX,e.clientY);if(t.offsetNode.nodeType===t.offsetNode.TEXT_NODE){let o=t.offsetNode.parentNode,n=o?o.parentNode:null,r=n?n.parentNode:null;return(r&&r.nodeType===r.ELEMENT_NODE?r.className:null)===pW.CLASS_NAME?gIe.createFromDOMInfo(i,t.offsetNode.parentNode,t.offset):new BU(t.offsetNode.parentNode)}if(t.offsetNode.nodeType===t.offsetNode.ELEMENT_NODE){let o=t.offsetNode.parentNode,n=o&&o.nodeType===o.ELEMENT_NODE?o.className:null,r=o?o.parentNode:null,s=r&&r.nodeType===r.ELEMENT_NODE?r.className:null;if(n===pW.CLASS_NAME){let l=t.offsetNode.childNodes[Math.min(t.offset,t.offsetNode.childNodes.length-1)];if(l)return gIe.createFromDOMInfo(i,l,0)}else if(s===pW.CLASS_NAME)return gIe.createFromDOMInfo(i,t.offsetNode,0)}return new BU(t.offsetNode)}static _snapToSoftTabBoundary(i,e){let t=e.getLineContent(i.lineNumber),{tabSize:o}=e.model.getOptions(),n=Zre.atomicPosition(t,i.column-1,o,2);return n!==-1?new Ie(i.lineNumber,n+1):i}static doHitTest(i,e){let t=new BU;if(typeof i.viewDomNode.ownerDocument.caretRangeFromPoint=="function"?t=this._doHitTestWithCaretRangeFromPoint(i,e):i.viewDomNode.ownerDocument.caretPositionFromPoint&&(t=this._doHitTestWithCaretPositionFromPoint(i,e.pos.toClientCoordinates(Me(i.viewDomNode)))),t.type===1){let o=i.viewModel.getInjectedTextAt(t.position),n=i.viewModel.normalizePosition(t.position,2);(o||!n.equals(t.position))&&(t=new Mgt(n,t.spanNode,o))}return t}};function RPo(a,i,e){let t=document.createRange(),o=a.elementFromPoint(i,e);if(o?.hasChildNodes()){for(;o&&o.firstChild&&o.firstChild.nodeType!==o.firstChild.TEXT_NODE&&o.lastChild&&o.lastChild.firstChild;)o=o.lastChild;let n=o.getBoundingClientRect(),r=Me(o),s=r.getComputedStyle(o,null).getPropertyValue("font-style"),l=r.getComputedStyle(o,null).getPropertyValue("font-variant"),c=r.getComputedStyle(o,null).getPropertyValue("font-weight"),u=r.getComputedStyle(o,null).getPropertyValue("font-size"),p=r.getComputedStyle(o,null).getPropertyValue("line-height"),h=r.getComputedStyle(o,null).getPropertyValue("font-family"),g=`${s} ${l} ${c} ${u}/${p} ${h}`,f=o.innerText,v=n.left,b=0,S;if(i>n.left+n.width)b=f.length;else{let y=nJt.getInstance();for(let w=0;w<f.length+1;w++){if(S=y.getCharWidth(f.charAt(w),g)/2,v+=S,i<v){b=w;break}v+=S}}t.setStart(o.firstChild,b),t.setEnd(o.firstChild,b)}return t}var nJt=class a{static{this._INSTANCE=null}static getInstance(){return a._INSTANCE||(a._INSTANCE=new a),a._INSTANCE}constructor(){this._cache={},this._canvas=document.createElement("canvas")}getCharWidth(i,e){let t=i+e;if(this._cache[t])return this._cache[t];let o=this._canvas.getContext("2d");o.font=e;let r=o.measureText(i).width;return this._cache[t]=r,r}};function S$i(a){return(i,e,t)=>{let o=null,n=null;if(typeof t.value=="function"?(o="value",n=t.value):typeof t.get=="function"&&(o="get",n=t.get),!n||typeof e=="symbol")throw new Error("not supported");t[o]=a(n,e)}}function mi(a,i,e){let t=null,o=null;if(typeof e.value=="function"?(t="value",o=e.value,o.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof e.get=="function"&&(t="get",o=e.get),!o)throw new Error("not supported");let n=`$memoize$${i}`;e[t]=function(...r){return this.hasOwnProperty(n)||Object.defineProperty(this,n,{configurable:!1,enumerable:!1,writable:!1,value:o.apply(this,r)}),this[n]}}function Nd(a,i,e){return S$i((t,o)=>{let n=`$debounce$${o}`,r=`$debounce$result$${o}`;return function(...s){this[r]||(this[r]=e?e():void 0),clearTimeout(this[n]),i&&(this[r]=i(this[r],...s),s=[this[r]]),this[n]=setTimeout(()=>{t.apply(this,s),this[r]=e?e():void 0},a)}})}function OM(a,i,e){return S$i((t,o)=>{let n=`$throttle$timer$${o}`,r=`$throttle$result$${o}`,s=`$throttle$lastRun$${o}`,l=`$throttle$pending$${o}`;return function(...c){if(this[r]||(this[r]=e?e():void 0),(this[s]===null||this[s]===void 0)&&(this[s]=-Number.MAX_VALUE),i&&(this[r]=i(this[r],...c)),this[l])return;let u=this[s]+a;u<=Date.now()?(this[s]=Date.now(),t.apply(this,[this[r]]),this[r]=e?e():void 0):(this[l]=!0,this[n]=setTimeout(()=>{this[l]=!1,this[s]=Date.now(),t.apply(this,[this[r]]),this[r]=e?e():void 0},u-Date.now()))}})}var Gn;(n=>(n.Tap="-monaco-gesturetap",n.Change="-monaco-gesturechange",n.Start="-monaco-gesturestart",n.End="-monaco-gesturesend",n.Contextmenu="-monaco-gesturecontextmenu"))(Gn||={});var Hy=class Hy extends C{constructor(){super();this.dispatched=!1;this.targets=new Vs;this.ignoreTargets=new Vs;this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(H.runAndSubscribe(Fg,({window:e,disposables:t})=>{t.add(j(e.document,"touchstart",o=>this.onTouchStart(o),{passive:!1})),t.add(j(e.document,"touchend",o=>this.onTouchEnd(e,o))),t.add(j(e.document,"touchmove",o=>this.onTouchMove(o),{passive:!1}))},{window:It,disposables:this._store}))}static{this.SCROLL_FRICTION=-.005}static{this.HOLD_DELAY=700}static{this.CLEAR_TAP_COUNT_TIME=400}static addTarget(e){if(!Hy.isTouchDevice())return C.None;Hy.INSTANCE||(Hy.INSTANCE=Mp(new Hy));let t=Hy.INSTANCE.targets.push(e);return Z(t)}static ignoreTarget(e){if(!Hy.isTouchDevice())return C.None;Hy.INSTANCE||(Hy.INSTANCE=Mp(new Hy));let t=Hy.INSTANCE.ignoreTargets.push(e);return Z(t)}static isTouchDevice(){return"ontouchstart"in It||navigator.maxTouchPoints>0}static isHoverDevice(){return It.matchMedia("(hover: hover)").matches}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(e){let t=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let o=0,n=e.targetTouches.length;o<n;o++){let r=e.targetTouches.item(o);this.activeTouches[r.identifier]={id:r.identifier,initialTarget:r.target,initialTimeStamp:t,initialPageX:r.pageX,initialPageY:r.pageY,rollingTimestamps:[t],rollingPageX:[r.pageX],rollingPageY:[r.pageY]};let s=this.newGestureEvent(Gn.Start,r.target);s.pageX=r.pageX,s.pageY=r.pageY,this.dispatchEvent(s)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}onTouchEnd(e,t){let o=Date.now(),n=Object.keys(this.activeTouches).length;for(let r=0,s=t.changedTouches.length;r<s;r++){let l=t.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("move of an UNKNOWN touch",l);continue}let c=this.activeTouches[l.identifier],u=Date.now()-c.initialTimeStamp;if(u<Hy.HOLD_DELAY&&Math.abs(c.initialPageX-c.rollingPageX.at(-1))<30&&Math.abs(c.initialPageY-c.rollingPageY.at(-1))<30){let p=this.newGestureEvent(Gn.Tap,c.initialTarget);p.pageX=c.rollingPageX.at(-1),p.pageY=c.rollingPageY.at(-1),this.dispatchEvent(p)}else if(u>=Hy.HOLD_DELAY&&Math.abs(c.initialPageX-c.rollingPageX.at(-1))<30&&Math.abs(c.initialPageY-c.rollingPageY.at(-1))<30){let p=this.newGestureEvent(Gn.Contextmenu,c.initialTarget);p.pageX=c.rollingPageX.at(-1),p.pageY=c.rollingPageY.at(-1),this.dispatchEvent(p)}else if(n===1){let p=c.rollingPageX.at(-1),h=c.rollingPageY.at(-1),g=c.rollingTimestamps.at(-1)-c.rollingTimestamps[0],f=p-c.rollingPageX[0],v=h-c.rollingPageY[0],b=[...this.targets].filter(S=>c.initialTarget instanceof Node&&S.contains(c.initialTarget));this.inertia(e,b,o,Math.abs(f)/g,f>0?1:-1,p,Math.abs(v)/g,v>0?1:-1,h)}this.dispatchEvent(this.newGestureEvent(Gn.End,c.initialTarget)),delete this.activeTouches[l.identifier]}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}newGestureEvent(e,t){let o=document.createEvent("CustomEvent");return o.initEvent(e,!1,!0),o.initialTarget=t,o.tapCount=0,o}dispatchEvent(e){if(e.type===Gn.Tap){let t=new Date().getTime(),o=0;t-this._lastSetTapCountTime>Hy.CLEAR_TAP_COUNT_TIME?o=1:o=2,this._lastSetTapCountTime=t,e.tapCount=o}else(e.type===Gn.Change||e.type===Gn.Contextmenu)&&(this._lastSetTapCountTime=0);if(e.initialTarget instanceof Node){for(let o of this.ignoreTargets)if(o.contains(e.initialTarget))return;let t=[];for(let o of this.targets)if(o.contains(e.initialTarget)){let n=0,r=e.initialTarget;for(;r&&r!==o;)n++,r=r.parentElement;t.push([n,o])}t.sort((o,n)=>o[0]-n[0]);for(let[o,n]of t)n.dispatchEvent(e),this.dispatched=!0}}inertia(e,t,o,n,r,s,l,c,u){this.handle=$r(e,()=>{let p=Date.now(),h=p-o,g=0,f=0,v=!0;n+=Hy.SCROLL_FRICTION*h,l+=Hy.SCROLL_FRICTION*h,n>0&&(v=!1,g=r*n*h),l>0&&(v=!1,f=c*l*h);let b=this.newGestureEvent(Gn.Change);b.translationX=g,b.translationY=f,t.forEach(S=>S.dispatchEvent(b)),v||this.inertia(e,t,p,n,r,s+g,l,c,u+f)})}onTouchMove(e){let t=Date.now();for(let o=0,n=e.changedTouches.length;o<n;o++){let r=e.changedTouches.item(o);if(!this.activeTouches.hasOwnProperty(String(r.identifier))){console.warn("end of an UNKNOWN touch",r);continue}let s=this.activeTouches[r.identifier],l=this.newGestureEvent(Gn.Change,s.initialTarget);l.translationX=r.pageX-s.rollingPageX.at(-1),l.translationY=r.pageY-s.rollingPageY.at(-1),l.pageX=r.pageX,l.pageY=r.pageY,this.dispatchEvent(l),s.rollingPageX.length>3&&(s.rollingPageX.shift(),s.rollingPageY.shift(),s.rollingTimestamps.shift()),s.rollingPageX.push(r.pageX),s.rollingPageY.push(r.pageY),s.rollingTimestamps.push(t)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}};I([mi],Hy,"isTouchDevice",1),I([mi],Hy,"isHoverDevice",1);var ws=Hy;var Ma=class extends C{onclick(i,e){this._register(j(i,re.CLICK,t=>e(new yn(Me(i),t))))}onmousedown(i,e){this._register(j(i,re.MOUSE_DOWN,t=>e(new yn(Me(i),t))))}onmouseover(i,e){this._register(j(i,re.MOUSE_OVER,t=>e(new yn(Me(i),t))))}onmouseleave(i,e){this._register(j(i,re.MOUSE_LEAVE,t=>e(new yn(Me(i),t))))}onkeydown(i,e){this._register(j(i,re.KEY_DOWN,t=>e(new Ii(t))))}onkeyup(i,e){this._register(j(i,re.KEY_UP,t=>e(new Ii(t))))}oninput(i,e){this._register(j(i,re.INPUT,e))}onblur(i,e){this._register(j(i,re.BLUR,e))}onfocus(i,e){this._register(j(i,re.FOCUS,e))}onchange(i,e){this._register(j(i,re.CHANGE,e))}ignoreGesture(i){return ws.ignoreTarget(i)}};var h9=11,Agt=class extends Ma{constructor(i){super(),this._onActivate=i.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=i.bgWidth+"px",this.bgDomNode.style.height=i.bgHeight+"px",typeof i.top<"u"&&(this.bgDomNode.style.top="0px"),typeof i.left<"u"&&(this.bgDomNode.style.left="0px"),typeof i.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof i.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=i.className,this.domNode.classList.add(...q.asClassNameArray(i.icon)),this.domNode.style.position="absolute",this.domNode.style.width=h9+"px",this.domNode.style.height=h9+"px",typeof i.top<"u"&&(this.domNode.style.top=i.top+"px"),typeof i.left<"u"&&(this.domNode.style.left=i.left+"px"),typeof i.bottom<"u"&&(this.domNode.style.bottom=i.bottom+"px"),typeof i.right<"u"&&(this.domNode.style.right=i.right+"px"),this._pointerMoveMonitor=this._register(new cL),this._register(Vo(this.bgDomNode,re.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(Vo(this.domNode,re.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new ZD),this._pointerdownScheduleRepeatTimer=this._register(new Nl)}_arrowPointerDown(i){if(!i.target||!(i.target instanceof Element))return;let e=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Me(i))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(e,200),this._pointerMoveMonitor.startMonitoring(i.target,i.pointerId,i.buttons,t=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),i.preventDefault()}};var Ngt=class extends C{constructor(i,e,t){super(),this._visibility=i,this._visibleClassName=e,this._invisibleClassName=t,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Nl)}setVisibility(i){this._visibility!==i&&(this._visibility=i,this._updateShouldBeVisible())}setShouldBeVisible(i){this._rawShouldBeVisible=i,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let i=this._applyVisibilitySetting();this._shouldBeVisible!==i&&(this._shouldBeVisible=i,this.ensureVisibility())}setIsNeeded(i){this._isNeeded!==i&&(this._isNeeded=i,this.ensureVisibility())}setDomNode(i){this._domNode=i,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(i){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(i?" fade":"")))}};var MPo=140,bIe=class extends Ma{constructor(i){super(),this._lazyRender=i.lazyRender,this._host=i.host,this._scrollable=i.scrollable,this._scrollByPage=i.scrollByPage,this._scrollbarState=i.scrollbarState,this._visibilityController=this._register(new Ngt(i.visibility,"visible scrollbar "+i.extraScrollbarClassName,"invisible scrollbar "+i.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new cL),this._shouldRender=!0,this.domNode=or(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(j(this.domNode.domNode,re.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(i){let e=this._register(new Agt(i));this.domNode.domNode.appendChild(e.bgDomNode),this.domNode.domNode.appendChild(e.domNode)}_createSlider(i,e,t,o){this.slider=or(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(i),this.slider.setLeft(e),typeof t=="number"&&this.slider.setWidth(t),typeof o=="number"&&this.slider.setHeight(o),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(j(this.slider.domNode,re.POINTER_DOWN,n=>{n.button===0&&(n.preventDefault(),this._sliderPointerDown(n))})),this.onclick(this.slider.domNode,n=>{n.leftButton&&n.stopPropagation()})}_onElementSize(i){return this._scrollbarState.setVisibleSize(i)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(i){return this._scrollbarState.setScrollSize(i)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(i){return this._scrollbarState.setScrollPosition(i)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(i){i.target===this.domNode.domNode&&this._onPointerDown(i)}delegatePointerDown(i){let e=this.domNode.domNode.getClientRects()[0].top,t=e+this._scrollbarState.getSliderPosition(),o=e+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),n=this._sliderPointerPosition(i);t<=n&&n<=o?i.button===0&&(i.preventDefault(),this._sliderPointerDown(i)):this._onPointerDown(i)}_onPointerDown(i){let e,t;if(i.target===this.domNode.domNode&&typeof i.offsetX=="number"&&typeof i.offsetY=="number")e=i.offsetX,t=i.offsetY;else{let r=Yn(this.domNode.domNode);e=i.pageX-r.left,t=i.pageY-r.top}let o=i.pointerType==="mouse",n=i.button===0;if(n||!o){let r=this._pointerDownRelativePosition(e,t);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r))}n&&(i.preventDefault(),this._sliderPointerDown(i))}_sliderPointerDown(i){if(!i.target||!(i.target instanceof Element))return;let e=this._sliderPointerPosition(i),t=this._sliderOrthogonalPointerPosition(i),o=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(i.target,i.pointerId,i.buttons,n=>{let r=this._sliderOrthogonalPointerPosition(n),s=Math.abs(r-t);if(ri&&s>MPo){this._setDesiredScrollPositionNow(o.getScrollPosition());return}let c=this._sliderPointerPosition(n)-e;this._setDesiredScrollPositionNow(o.getDesiredScrollPositionFromDelta(c))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(i){let e={};this.writeScrollPosition(e,i),this._scrollable.setScrollPositionNow(e)}updateScrollbarSize(i){this._updateScrollbarSize(i),this._scrollbarState.setScrollbarSize(i),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}};var g9=class a{constructor(i,e,t,o,n,r){this._scrollbarSize=Math.round(e),this._oppositeScrollbarSize=Math.round(t),this._arrowSize=Math.round(i),this._visibleSize=o,this._scrollSize=n,this._scrollPosition=r,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new a(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(i){let e=Math.round(i);return this._visibleSize!==e?(this._visibleSize=e,this._refreshComputedValues(),!0):!1}setScrollSize(i){let e=Math.round(i);return this._scrollSize!==e?(this._scrollSize=e,this._refreshComputedValues(),!0):!1}setScrollPosition(i){let e=Math.round(i);return this._scrollPosition!==e?(this._scrollPosition=e,this._refreshComputedValues(),!0):!1}setScrollbarSize(i){this._scrollbarSize=Math.round(i)}setOppositeScrollbarSize(i){this._oppositeScrollbarSize=Math.round(i)}static _computeValues(i,e,t,o,n){let r=Math.max(0,t-i),s=Math.max(0,r-2*e),l=o>0&&o>t;if(!l)return{computedAvailableSize:Math.round(r),computedIsNeeded:l,computedSliderSize:Math.round(s),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(t*s/o))),u=(s-c)/(o-t),p=n*u;return{computedAvailableSize:Math.round(r),computedIsNeeded:l,computedSliderSize:Math.round(c),computedSliderRatio:u,computedSliderPosition:Math.round(p)}}_refreshComputedValues(){let i=a._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=i.computedAvailableSize,this._computedIsNeeded=i.computedIsNeeded,this._computedSliderSize=i.computedSliderSize,this._computedSliderRatio=i.computedSliderRatio,this._computedSliderPosition=i.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(i){if(!this._computedIsNeeded)return 0;let e=i-this._arrowSize-this._computedSliderSize/2;return Math.round(e/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(i){if(!this._computedIsNeeded)return 0;let e=i-this._arrowSize,t=this._scrollPosition;return e<this._computedSliderPosition?t-=this._visibleSize:t+=this._visibleSize,t}getDesiredScrollPositionFromDelta(i){if(!this._computedIsNeeded)return 0;let e=this._computedSliderPosition+i;return Math.round(e/this._computedSliderRatio)}};var Ogt=class extends bIe{constructor(i,e,t){let o=i.getScrollDimensions(),n=i.getCurrentScrollPosition();if(super({lazyRender:e.lazyRender,host:t,scrollbarState:new g9(e.horizontalHasArrows?e.arrowSize:0,e.horizontal===2?0:e.horizontalScrollbarSize,e.vertical===2?0:e.verticalScrollbarSize,o.width,o.scrollWidth,n.scrollLeft),visibility:e.horizontal,extraScrollbarClassName:"horizontal",scrollable:i,scrollByPage:e.scrollByPage}),e.horizontalHasArrows){let r=(e.arrowSize-h9)/2,s=(e.horizontalScrollbarSize-h9)/2;this._createArrow({className:"scra",icon:M.scrollbarButtonLeft,top:s,left:r,bottom:void 0,right:void 0,bgWidth:e.arrowSize,bgHeight:e.horizontalScrollbarSize,onActivate:()=>this._host.onMouseWheel(new MT(null,1,0))}),this._createArrow({className:"scra",icon:M.scrollbarButtonRight,top:s,left:void 0,bottom:void 0,right:r,bgWidth:e.arrowSize,bgHeight:e.horizontalScrollbarSize,onActivate:()=>this._host.onMouseWheel(new MT(null,-1,0))})}this._createSlider(Math.floor((e.horizontalScrollbarSize-e.horizontalSliderSize)/2),0,void 0,e.horizontalSliderSize)}_updateSlider(i,e){this.slider.setWidth(i),this.slider.setLeft(e)}_renderDomNode(i,e){this.domNode.setWidth(i),this.domNode.setHeight(e),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(i){return this._shouldRender=this._onElementScrollSize(i.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(i.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(i.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(i,e){return i}_sliderPointerPosition(i){return i.pageX}_sliderOrthogonalPointerPosition(i){return i.pageY}_updateScrollbarSize(i){this.slider.setHeight(i)}writeScrollPosition(i,e){i.scrollLeft=e}updateOptions(i){this.updateScrollbarSize(i.horizontal===2?0:i.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(i.vertical===2?0:i.verticalScrollbarSize),this._visibilityController.setVisibility(i.horizontal),this._scrollByPage=i.scrollByPage}};var Fgt=class extends bIe{constructor(i,e,t){let o=i.getScrollDimensions(),n=i.getCurrentScrollPosition();if(super({lazyRender:e.lazyRender,host:t,scrollbarState:new g9(e.verticalHasArrows?e.arrowSize:0,e.vertical===2?0:e.verticalScrollbarSize,0,o.height,o.scrollHeight,n.scrollTop),visibility:e.vertical,extraScrollbarClassName:"vertical",scrollable:i,scrollByPage:e.scrollByPage}),e.verticalHasArrows){let r=(e.arrowSize-h9)/2,s=(e.verticalScrollbarSize-h9)/2;this._createArrow({className:"scra",icon:M.scrollbarButtonUp,top:r,left:s,bottom:void 0,right:void 0,bgWidth:e.verticalScrollbarSize,bgHeight:e.arrowSize,onActivate:()=>this._host.onMouseWheel(new MT(null,0,1))}),this._createArrow({className:"scra",icon:M.scrollbarButtonDown,top:void 0,left:s,bottom:r,right:void 0,bgWidth:e.verticalScrollbarSize,bgHeight:e.arrowSize,onActivate:()=>this._host.onMouseWheel(new MT(null,0,-1))})}this._createSlider(0,Math.floor((e.verticalScrollbarSize-e.verticalSliderSize)/2),e.verticalSliderSize,void 0)}_updateSlider(i,e){this.slider.setHeight(i),this.slider.setTop(e)}_renderDomNode(i,e){this.domNode.setWidth(e),this.domNode.setHeight(i),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(i){return this._shouldRender=this._onElementScrollSize(i.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(i.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(i.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(i,e){return e}_sliderPointerPosition(i){return i.pageY}_sliderOrthogonalPointerPosition(i){return i.pageX}_updateScrollbarSize(i){this.slider.setWidth(i)}writeScrollPosition(i,e){i.scrollTop=e}updateOptions(i){this.updateScrollbarSize(i.vertical===2?0:i.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(i.vertical),this._scrollByPage=i.scrollByPage}};var PPo=500,I$i=50,y$i=!0,rJt=class{constructor(i,e,t){this.timestamp=i,this.deltaX=e,this.deltaY=t,this.score=0}},HU=class a{static{this.INSTANCE=new a}constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let i=1,e=0,t=1,o=this._rear;do{let n=o===this._front?i:Math.pow(2,-t);if(i-=n,e+=this._memory[o].score*n,o===this._front)break;o=(this._capacity+o-1)%this._capacity,t++}while(!0);return e<=.5}acceptStandardWheelEvent(i){if(eU){let e=Me(i.browserEvent),t=yS(e);this.accept(Date.now(),i.deltaX*t,i.deltaY*t)}else this.accept(Date.now(),i.deltaX,i.deltaY)}accept(i,e,t){let o=null,n=new rJt(i,e,t);this._front===-1&&this._rear===-1?(this._memory[0]=n,this._front=0,this._rear=0):(o=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=n),n.score=this._computeScore(n,o)}_computeScore(i,e){if(Math.abs(i.deltaX)>0&&Math.abs(i.deltaY)>0)return 1;let t=.5;if((!this._isAlmostInt(i.deltaX)||!this._isAlmostInt(i.deltaY))&&(t+=.25),e){let o=Math.abs(i.deltaX),n=Math.abs(i.deltaY),r=Math.abs(e.deltaX),s=Math.abs(e.deltaY),l=Math.max(Math.min(o,r),1),c=Math.max(Math.min(n,s),1),u=Math.max(o,r),p=Math.max(n,s);u%l===0&&p%c===0&&(t-=.5)}return Math.min(Math.max(t,0),1)}_isAlmostInt(i){let e=Number.EPSILON*100;return Math.abs(Math.round(i)-i)<.01+e}},Q$e=class extends Ma{constructor(e,t,o){super();this._inertialTimeout=null;this._inertialSpeed={X:0,Y:0};this._onScroll=this._register(new E);this._onWillScroll=this._register(new E);e.style.overflow="hidden",this._options=APo(t),this._scrollable=o,this._register(this._scrollable.onScroll(r=>{this._onWillScroll.fire(r),this._onDidScroll(r),this._onScroll.fire(r)}));let n={onMouseWheel:r=>this._onMouseWheel(r),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new Fgt(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new Ogt(this._scrollable,this._options,n)),this._domNode=document.createElement("div"),this._domNode.className="monaco-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.style.overflow="hidden",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=or(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=or(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=or(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,r=>this._onMouseOver(r)),this.onmouseleave(this._listenOnDomNode,r=>this._onMouseLeave(r)),this._hideTimeout=this._register(new Nl),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get onScroll(){return this._onScroll.event}get onWillScroll(){return this._onWillScroll.event}get options(){return this._options}dispose(){this._mouseWheelToDispose=Ue(this._mouseWheelToDispose),this._inertialTimeout&&(this._inertialTimeout.dispose(),this._inertialTimeout=null),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,it&&(this._options.className+=" mac"),this._domNode.className="monaco-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new MT(e))}async _periodicSync(){let e=!1;(this._inertialSpeed.X!==0||this._inertialSpeed.Y!==0)&&(this._scrollable.setScrollPositionNow({scrollTop:this._scrollable.getCurrentScrollPosition().scrollTop-this._inertialSpeed.Y*100,scrollLeft:this._scrollable.getCurrentScrollPosition().scrollLeft-this._inertialSpeed.X*100}),this._inertialSpeed.X*=.9,this._inertialSpeed.Y*=.9,Math.abs(this._inertialSpeed.X)<.01&&(this._inertialSpeed.X=0),Math.abs(this._inertialSpeed.Y)<.01&&(this._inertialSpeed.Y=0),e=this._inertialSpeed.X!==0||this._inertialSpeed.Y!==0),e?(this._inertialTimeout||(this._inertialTimeout=new Nl),this._inertialTimeout.cancelAndSet(()=>this._periodicSync(),1e3/60)):(this._inertialTimeout?.dispose(),this._inertialTimeout=null)}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Ue(this._mouseWheelToDispose),e)){let o=n=>{this._onMouseWheel(new MT(n))};this._mouseWheelToDispose.push(j(this._listenOnDomNode,re.MOUSE_WHEEL,o,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=HU.INSTANCE;y$i&&t.acceptStandardWheelEvent(e);let o=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,s=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&s+r===0?s=r=0:Math.abs(r)>=Math.abs(s)?s=0:r=0),this._options.flipAxes&&([r,s]=[s,r]);let l=!it&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||l)&&!s&&(s=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(s=s*this._options.fastScrollSensitivity,r=r*this._options.fastScrollSensitivity);let c=this._scrollable.getFutureScrollPosition(),u={};if(r){let p=I$i*r,h=c.scrollTop-(p<0?Math.floor(p):Math.ceil(p));this._verticalScrollbar.writeScrollPosition(u,h)}if(s){let p=I$i*s,h=c.scrollLeft-(p<0?Math.floor(p):Math.ceil(p));this._horizontalScrollbar.writeScrollPosition(u,h)}if(u=this._scrollable.validateScrollPosition(u),this._options.inertialScroll&&(s||r)&&!t.isPhysicalMouseWheel()){let p=!1;this._inertialSpeed.X===0&&this._inertialSpeed.Y===0&&(p=!0),this._inertialSpeed.Y=(r<0?-1:1)*Math.abs(r)**1.02,this._inertialSpeed.X=(s<0?-1:1)*Math.abs(s)**1.02,p&&this._periodicSync()}(c.scrollLeft!==u.scrollLeft||c.scrollTop!==u.scrollTop)&&(y$i&&this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(u):this._scrollable.setScrollPositionNow(u),o=!0)}let n=o;!n&&this._options.alwaysConsumeMouseWheel&&(n=!0),!n&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(n=!0),n&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,o=e.scrollLeft>0,n=o?" left":"",r=t?" top":"",s=o||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${n}`),this._topShadowDomNode.setClassName(`shadow${r}`),this._topLeftShadowDomNode.setClassName(`shadow${s}${r}${n}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),PPo)}},f9=class extends Q$e{constructor(i,e){e=e||{},e.mouseWheelSmoothScroll=!1;let t=new UT({forceIntegerValues:!0,smoothScrollDuration:0,scheduleAtNextAnimationFrame:o=>$r(Me(i),o)});super(i,e,t),this._register(t)}setScrollPosition(i){this._scrollable.setScrollPositionNow(i)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}},AN=class extends Q$e{constructor(i,e,t){super(i,e,t)}setScrollPosition(i){i.reuseAnimation?this._scrollable.setScrollPositionSmooth(i,i.reuseAnimation):this._scrollable.setScrollPositionNow(i)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}},Pa=class extends Q$e{constructor(i,e){e=e||{},e.mouseWheelSmoothScroll=!1;let t=new UT({forceIntegerValues:!1,smoothScrollDuration:0,scheduleAtNextAnimationFrame:o=>$r(Me(i),o)});super(i,e,t),this._register(t),this._element=i,this._register(this.onScroll(o=>{o.scrollTopChanged&&(this._element.scrollTop=o.scrollTop),o.scrollLeftChanged&&(this._element.scrollLeft=o.scrollLeft)})),this.scanDomNode()}setScrollPosition(i){this._scrollable.setScrollPositionNow(i)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}scanDomNode(){this.setScrollDimensions({width:this._element.clientWidth,scrollWidth:this._element.scrollWidth,height:this._element.clientHeight,scrollHeight:this._element.scrollHeight}),this.setScrollPosition({scrollLeft:this._element.scrollLeft,scrollTop:this._element.scrollTop})}};function APo(a){let i={lazyRender:typeof a.lazyRender<"u"?a.lazyRender:!1,className:typeof a.className<"u"?a.className:"",useShadows:typeof a.useShadows<"u"?a.useShadows:!0,handleMouseWheel:typeof a.handleMouseWheel<"u"?a.handleMouseWheel:!0,flipAxes:typeof a.flipAxes<"u"?a.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof a.consumeMouseWheelIfScrollbarIsNeeded<"u"?a.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof a.alwaysConsumeMouseWheel<"u"?a.alwaysConsumeMouseWheel:!1,scrollYToX:typeof a.scrollYToX<"u"?a.scrollYToX:!1,mouseWheelScrollSensitivity:typeof a.mouseWheelScrollSensitivity<"u"?a.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof a.fastScrollSensitivity<"u"?a.fastScrollSensitivity:5,scrollPredominantAxis:typeof a.scrollPredominantAxis<"u"?a.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof a.mouseWheelSmoothScroll<"u"?a.mouseWheelSmoothScroll:!0,inertialScroll:typeof a.inertialScroll<"u"?a.inertialScroll:!1,arrowSize:typeof a.arrowSize<"u"?a.arrowSize:11,listenOnDomNode:typeof a.listenOnDomNode<"u"?a.listenOnDomNode:null,horizontal:typeof a.horizontal<"u"?a.horizontal:1,horizontalScrollbarSize:typeof a.horizontalScrollbarSize<"u"?a.horizontalScrollbarSize:10,horizontalSliderSize:typeof a.horizontalSliderSize<"u"?a.horizontalSliderSize:0,horizontalHasArrows:typeof a.horizontalHasArrows<"u"?a.horizontalHasArrows:!1,vertical:typeof a.vertical<"u"?a.vertical:1,verticalScrollbarSize:typeof a.verticalScrollbarSize<"u"?a.verticalScrollbarSize:10,verticalHasArrows:typeof a.verticalHasArrows<"u"?a.verticalHasArrows:!1,verticalSliderSize:typeof a.verticalSliderSize<"u"?a.verticalSliderSize:0,scrollByPage:typeof a.scrollByPage<"u"?a.scrollByPage:!1};return i.horizontalSliderSize=typeof a.horizontalSliderSize<"u"?a.horizontalSliderSize:i.horizontalScrollbarSize,i.verticalSliderSize=typeof a.verticalSliderSize<"u"?a.verticalSliderSize:i.verticalScrollbarSize,it&&(i.className+=" mac"),i}var Wgt=class extends C{constructor(e,t,o,n){super();this._context=e;this._viewHelper=t;this._mouseTargetFactory=o;this._dispatchMouse=n;this._operation=null}dispose(){super.dispose(),this.stop()}start(e,t){this._operation?this._operation.setPosition(e,t):this._operation=this._createDragScrollingOperation(e,t)}stop(){this._operation&&(this._operation.dispose(),this._operation=null)}},Vgt=class extends C{constructor(e,t,o,n,r,s){super();this._context=e;this._viewHelper=t;this._mouseTargetFactory=o;this._dispatchMouse=n;this._position=r,this._mouseEvent=s,this._lastTime=Date.now(),this._animationFrameDisposable=$r(Me(s.browserEvent),()=>this._execute())}dispose(){this._animationFrameDisposable.dispose(),super.dispose()}setPosition(e,t){this._position=e,this._mouseEvent=t}_tick(){let e=Date.now(),t=e-this._lastTime;return this._lastTime=e,t}},Bgt=class extends Wgt{_createDragScrollingOperation(i,e){return new sJt(this._context,this._viewHelper,this._mouseTargetFactory,this._dispatchMouse,i,e)}},sJt=class extends Vgt{_getScrollSpeed(){let i=this._context.configuration.options.get(75),e=this._context.configuration.options.get(165).height/i,t=this._position.outsideDistance/i;return t<=1.5?Math.max(30,e*(1+t)):t<=3?Math.max(60,e*(2+t)):Math.max(200,e*(7+t))}_execute(){let i=this._context.configuration.options.get(75),e=this._getScrollSpeed(),t=this._tick(),o=e*(t/1e3)*i,n=this._position.outsidePosition==="above"?-o:o;this._context.viewModel.viewLayout.deltaScrollNow(0,n),this._viewHelper.renderNow();let r=this._context.viewLayout.getLinesViewportData(),s=this._position.outsidePosition==="above"?r.startLineNumber:r.endLineNumber,l=this._position.outsidePosition==="above"?r.startLineNumber===1:r.endLineNumber===this._context.viewModel.getLineCount(),c;{let u=lIe(this._viewHelper.viewDomNode),p=this._context.configuration.options.get(165).horizontalScrollbarHeight,h=new U$(this._mouseEvent.pos.x,u.y+u.height-p-.1),g=cIe(this._viewHelper.viewDomNode,u,h);c=this._mouseTargetFactory.createMouseTarget(this._viewHelper.getLastRenderData(),u,h,g,null)}(!c.position||c.position.lineNumber!==s||l)&&(this._position.outsidePosition==="above"?c=lv.createOutsideEditor(this._position.mouseColumn,new Ie(s,1),"above",this._position.outsideDistance):c=lv.createOutsideEditor(this._position.mouseColumn,new Ie(s,this._context.viewModel.getLineMaxColumn(s)),"below",this._position.outsideDistance)),this._dispatchMouse(c,!0,2),this._animationFrameDisposable=$r(Me(c.element),()=>this._execute())}},Hgt=class extends Wgt{_createDragScrollingOperation(i,e){return new aJt(this._context,this._viewHelper,this._mouseTargetFactory,this._dispatchMouse,i,e)}},aJt=class extends Vgt{_getScrollSpeed(){let i=this._context.configuration.options.get(59).typicalFullwidthCharacterWidth,e=this._context.configuration.options.get(165).contentWidth/i,t=this._position.outsideDistance/i;return t<=1.5?Math.max(30,e*(1+t)):t<=3?Math.max(60,e*(2+t)):Math.max(200,e*(7+t))}_execute(){let i=this._context.configuration.options.get(59).typicalFullwidthCharacterWidth,e=this._getScrollSpeed(),t=this._tick(),o=e*(t/1e3)*i*.5,n=this._position.outsidePosition==="left"?-o:o;if(this._context.viewModel.viewLayout.deltaScrollNow(n,0),this._viewHelper.renderNow(),!this._position.position)return;let r=this._position.position.lineNumber,s;{let l=lIe(this._viewHelper.viewDomNode),c=this._context.configuration.options.get(165).horizontalScrollbarHeight,u=new U$(this._mouseEvent.pos.x,l.y+l.height-c-.1),p=cIe(this._viewHelper.viewDomNode,l,u);s=this._mouseTargetFactory.createMouseTarget(this._viewHelper.getLastRenderData(),l,u,p,null)}this._position.outsidePosition==="left"?s=lv.createOutsideEditor(s.mouseColumn,new Ie(r,s.mouseColumn),"left",this._position.outsideDistance):s=lv.createOutsideEditor(s.mouseColumn,new Ie(r,s.mouseColumn),"right",this._position.outsideDistance),this._dispatchMouse(s,!0,2),this._animationFrameDisposable=$r(Me(s.element),()=>this._execute())}};var SIe=class extends Jk{constructor(e,t,o){super();this._mouseLeaveMonitor=null;this._context=e,this.viewController=t,this.viewHelper=o,this.mouseTargetFactory=new vIe(this._context,o),this._mouseDownOperation=this._register(new lJt(this._context,this.viewController,this.viewHelper,this.mouseTargetFactory,(s,l)=>this._createMouseTarget(s,l),s=>this._getMouseColumn(s))),this.lastMouseLeaveTime=-1,this._height=this._context.configuration.options.get(165).height;let n=new ygt(this.viewHelper.viewDomNode);this._register(n.onContextMenu(this.viewHelper.viewDomNode,s=>this._onContextMenu(s,!0))),this._register(n.onMouseMove(this.viewHelper.viewDomNode,s=>{this._onMouseMove(s),this._mouseLeaveMonitor||(this._mouseLeaveMonitor=j(this.viewHelper.viewDomNode.ownerDocument,"mousemove",l=>{this.viewHelper.viewDomNode.contains(l.target)||this._onMouseLeave(new mL(l,!1,this.viewHelper.viewDomNode))}))})),this._register(n.onMouseUp(this.viewHelper.viewDomNode,s=>this._onMouseUp(s))),this._register(n.onMouseLeave(this.viewHelper.viewDomNode,s=>this._onMouseLeave(s)));let r=0;this._register(n.onPointerDown(this.viewHelper.viewDomNode,(s,l)=>{r=l})),this._register(j(this.viewHelper.viewDomNode,re.POINTER_UP,s=>{this._mouseDownOperation.onPointerUp()})),this._register(n.onMouseDown(this.viewHelper.viewDomNode,s=>this._onMouseDown(s,r))),this._setupMouseWheelZoomListener(),this._context.addEventHandler(this)}_setupMouseWheelZoomListener(){let e=HU.INSTANCE,t=0,o=$k.getZoomLevel(),n=!1,r=0,s=c=>{if(this.viewController.emitMouseWheel(c),!this._context.configuration.options.get(84))return;let u=new MT(c);if(e.acceptStandardWheelEvent(u),e.isPhysicalMouseWheel()){if(l(c)){let p=$k.getZoomLevel(),h=u.deltaY>0?1:-1;$k.setZoomLevel(p+h),u.preventDefault(),u.stopPropagation()}}else Date.now()-t>50&&(o=$k.getZoomLevel(),n=l(c),r=0),t=Date.now(),r+=u.deltaY,n&&($k.setZoomLevel(o+r/5),u.preventDefault(),u.stopPropagation())};this._register(j(this.viewHelper.viewDomNode,re.MOUSE_WHEEL,s,{capture:!0,passive:!1}));function l(c){return it?(c.metaKey||c.ctrlKey)&&!c.shiftKey&&!c.altKey:c.ctrlKey&&!c.metaKey&&!c.shiftKey&&!c.altKey}}dispose(){this._context.removeEventHandler(this),this._mouseLeaveMonitor&&(this._mouseLeaveMonitor.dispose(),this._mouseLeaveMonitor=null),super.dispose()}onConfigurationChanged(e){if(e.hasChanged(165)){let t=this._context.configuration.options.get(165).height;this._height!==t&&(this._height=t,this._mouseDownOperation.onHeightChanged())}return!1}onCursorStateChanged(e){return this._mouseDownOperation.onCursorStateChanged(e),!1}onFocusChanged(e){return!1}getTargetAtClientPoint(e,t){let n=new G$e(e,t).toPageCoordinates(Me(this.viewHelper.viewDomNode)),r=lIe(this.viewHelper.viewDomNode);if(n.y<r.y||n.y>r.y+r.height||n.x<r.x||n.x>r.x+r.width)return null;let s=cIe(this.viewHelper.viewDomNode,r,n);return this.mouseTargetFactory.createMouseTarget(this.viewHelper.getLastRenderData(),r,n,s,null)}_createMouseTarget(e,t){let o=e.target;if(!this.viewHelper.viewDomNode.contains(o)){let n=_M(this.viewHelper.viewDomNode);n&&(o=n.elementsFromPoint(e.posx,e.posy).find(s=>this.viewHelper.viewDomNode.contains(s))??null)}return this.mouseTargetFactory.createMouseTarget(this.viewHelper.getLastRenderData(),e.editorPos,e.pos,e.relativePos,t?o:null)}_getMouseColumn(e){return this.mouseTargetFactory.getMouseColumn(e.relativePos)}_onContextMenu(e,t){this.viewController.emitContextMenu({event:e,target:this._createMouseTarget(e,t)})}_onMouseMove(e){this.mouseTargetFactory.mouseTargetIsWidget(e)||e.preventDefault(),!(this._mouseDownOperation.isActive()||e.timestamp<this.lastMouseLeaveTime)&&this.viewController.emitMouseMove({event:e,target:this._createMouseTarget(e,!0)})}_onMouseLeave(e){this._mouseLeaveMonitor&&(this._mouseLeaveMonitor.dispose(),this._mouseLeaveMonitor=null),this.lastMouseLeaveTime=new Date().getTime(),this.viewController.emitMouseLeave({event:e,target:null})}_onMouseUp(e){this.viewController.emitMouseUp({event:e,target:this._createMouseTarget(e,!0)})}_onMouseDown(e,t){let o=this._createMouseTarget(e,!0),n=o.type===6||o.type===7,r=o.type===2||o.type===3||o.type===4,s=o.type===3,l=this._context.configuration.options.get(125),c=o.type===8||o.type===5,u=o.type===9,p=e.leftButton||e.middleButton;it&&e.leftButton&&e.ctrlKey&&(p=!1);let h=()=>{e.preventDefault(),this.viewHelper.focusTextArea()};if(p&&(n||s&&l))h(),this._mouseDownOperation.start(o.type,e,t);else if(r)e.preventDefault();else if(c){let g=o.detail;p&&this.viewHelper.shouldSuppressMouseDownOnViewZone(g.viewZoneId)&&(h(),this._mouseDownOperation.start(o.type,e,t),e.preventDefault())}else u&&this.viewHelper.shouldSuppressMouseDownOnWidget(o.detail)&&(h(),e.preventDefault());this.viewController.emitMouseDown({event:e,target:o})}_onMouseWheel(e){this.viewController.emitMouseWheel(e)}},lJt=class extends C{constructor(e,t,o,n,r,s){super();this._context=e;this._viewController=t;this._viewHelper=o;this._mouseTargetFactory=n;this._createMouseTarget=r,this._getMouseColumn=s,this._mouseMoveMonitor=this._register(new Cgt(this._viewHelper.viewDomNode)),this._topBottomDragScrolling=this._register(new Bgt(this._context,this._viewHelper,this._mouseTargetFactory,(l,c,u)=>this._dispatchMouse(l,c,u))),this._leftRightDragScrolling=this._register(new Hgt(this._context,this._viewHelper,this._mouseTargetFactory,(l,c,u)=>this._dispatchMouse(l,c,u))),this._mouseState=new cJt,this._currentSelection=new Yt(1,1,1,1),this._isActive=!1,this._lastMouseEvent=null}dispose(){super.dispose()}isActive(){return this._isActive}_onMouseDownThenMove(e){this._lastMouseEvent=e,this._mouseState.setModifiers(e);let t=this._findMousePosition(e,!1);t&&(this._mouseState.isDragAndDrop?this._viewController.emitMouseDrag({event:e,target:t}):t.type===13?t.outsidePosition==="above"||t.outsidePosition==="below"?(this._topBottomDragScrolling.start(t,e),this._leftRightDragScrolling.stop()):(this._leftRightDragScrolling.start(t,e),this._topBottomDragScrolling.stop()):(this._topBottomDragScrolling.stop(),this._leftRightDragScrolling.stop(),this._dispatchMouse(t,!0,1)))}start(e,t,o){this._lastMouseEvent=t,this._mouseState.setStartedOnLineNumbers(e===3),this._mouseState.setStartButtons(t),this._mouseState.setModifiers(t);let n=this._findMousePosition(t,!0);if(!n||!n.position)return;this._mouseState.trySetCount(t.detail,n.position),t.detail=this._mouseState.count;let r=this._context.configuration.options;if(!r.get(104)&&r.get(42)&&!r.get(28)&&!this._mouseState.altKey&&t.detail<2&&!this._isActive&&!this._currentSelection.isEmpty()&&n.type===6&&n.position&&this._currentSelection.containsPosition(n.position)){this._mouseState.isDragAndDrop=!0,this._isActive=!0,this._mouseMoveMonitor.startMonitoring(this._viewHelper.viewLinesDomNode,o,t.buttons,s=>this._onMouseDownThenMove(s),s=>{let l=this._findMousePosition(this._lastMouseEvent,!1);ag(s)?this._viewController.emitMouseDropCanceled():this._viewController.emitMouseDrop({event:this._lastMouseEvent,target:l?this._createMouseTarget(this._lastMouseEvent,!0):null}),this._stop()});return}this._mouseState.isDragAndDrop=!1,this._dispatchMouse(n,t.shiftKey,1),this._isActive||(this._isActive=!0,this._mouseMoveMonitor.startMonitoring(this._viewHelper.viewLinesDomNode,o,t.buttons,s=>this._onMouseDownThenMove(s),()=>this._stop()))}_stop(){this._isActive=!1,this._topBottomDragScrolling.stop(),this._leftRightDragScrolling.stop()}onHeightChanged(){this._mouseMoveMonitor.stopMonitoring()}onPointerUp(){this._mouseMoveMonitor.stopMonitoring()}onCursorStateChanged(e){this._currentSelection=e.selections[0]}_getPositionOutsideEditor(e){let t=e.editorPos,o=this._context.viewModel,n=this._context.viewLayout,r=this._getMouseColumn(e);if(e.posy<t.y){let h=t.y-e.posy,g=Math.max(n.getCurrentScrollTop()-h,0),f=fIe.getZoneAtCoord(this._context,g);if(f){let b=this._helpPositionJumpOverViewZone(f);if(b)return lv.createOutsideEditor(r,b,"above",h)}let v=n.getLineNumberAtVerticalOffset(g);return lv.createOutsideEditor(r,new Ie(v,1),"above",h)}if(e.posy>t.y+t.height){let h=e.posy-t.y-t.height,g=n.getCurrentScrollTop()+e.relativePos.y,f=fIe.getZoneAtCoord(this._context,g);if(f){let b=this._helpPositionJumpOverViewZone(f);if(b)return lv.createOutsideEditor(r,b,"below",h)}let v=n.getLineNumberAtVerticalOffset(g);return lv.createOutsideEditor(r,new Ie(v,o.getLineMaxColumn(v)),"below",h)}let s=n.getLineNumberAtVerticalOffset(n.getCurrentScrollTop()+e.relativePos.y),l=this._context.configuration.options.get(165),c=l.contentLeft;if(e.relativePos.x<=c){let h=c-e.relativePos.x,g=o.getTextDirection(s)===1;return lv.createOutsideEditor(r,new Ie(s,g?o.getLineMaxColumn(s):1),"left",h)}let p=l.minimap.minimapLeft===0?l.width-l.verticalScrollbarWidth:l.minimap.minimapLeft;if(e.relativePos.x>=p){let h=e.relativePos.x-p,g=o.getTextDirection(s)===1;return lv.createOutsideEditor(r,new Ie(s,g?1:o.getLineMaxColumn(s)),"right",h)}return null}_findMousePosition(e,t){let o=this._getPositionOutsideEditor(e);if(o)return o;let n=this._createMouseTarget(e,t);if(!n.position)return null;if(n.type===8||n.type===5){let s=this._helpPositionJumpOverViewZone(n.detail);if(s)return lv.createViewZone(n.type,n.element,n.mouseColumn,s,n.detail)}return n}_helpPositionJumpOverViewZone(e){let t=new Ie(this._currentSelection.selectionStartLineNumber,this._currentSelection.selectionStartColumn),o=e.positionBefore,n=e.positionAfter;return o&&n?o.isBefore(t)?o:n:null}_dispatchMouse(e,t,o){e.position&&this._viewController.dispatchMouse({position:e.position,mouseColumn:e.mouseColumn,startedOnLineNumbers:this._mouseState.startedOnLineNumbers,revealType:o,inSelectionMode:t,mouseDownCount:this._mouseState.count,altKey:this._mouseState.altKey,ctrlKey:this._mouseState.ctrlKey,metaKey:this._mouseState.metaKey,shiftKey:this._mouseState.shiftKey,leftButton:this._mouseState.leftButton,middleButton:this._mouseState.middleButton,onInjectedText:e.type===6&&e.detail.injectedText!==null})}},cJt=class a{static{this.CLEAR_MOUSE_DOWN_COUNT_TIME=400}get altKey(){return this._altKey}get ctrlKey(){return this._ctrlKey}get metaKey(){return this._metaKey}get shiftKey(){return this._shiftKey}get leftButton(){return this._leftButton}get middleButton(){return this._middleButton}get startedOnLineNumbers(){return this._startedOnLineNumbers}constructor(){this._altKey=!1,this._ctrlKey=!1,this._metaKey=!1,this._shiftKey=!1,this._leftButton=!1,this._middleButton=!1,this._startedOnLineNumbers=!1,this._lastMouseDownPosition=null,this._lastMouseDownPositionEqualCount=0,this._lastMouseDownCount=0,this._lastSetMouseDownCountTime=0,this.isDragAndDrop=!1}get count(){return this._lastMouseDownCount}setModifiers(i){this._altKey=i.altKey,this._ctrlKey=i.ctrlKey,this._metaKey=i.metaKey,this._shiftKey=i.shiftKey}setStartButtons(i){this._leftButton=i.leftButton,this._middleButton=i.middleButton}setStartedOnLineNumbers(i){this._startedOnLineNumbers=i}trySetCount(i,e){let t=new Date().getTime();t-this._lastSetMouseDownCountTime>a.CLEAR_MOUSE_DOWN_COUNT_TIME&&(i=1),this._lastSetMouseDownCountTime=t,i>this._lastMouseDownCount+1&&(i=this._lastMouseDownCount+1),this._lastMouseDownPosition&&this._lastMouseDownPosition.equals(e)?this._lastMouseDownPositionEqualCount++:this._lastMouseDownPositionEqualCount=1,this._lastMouseDownPosition=e,this._lastMouseDownCount=Math.min(i,this._lastMouseDownPositionEqualCount)}};var On=class{get event(){return this.emitter.event}constructor(i,e,t){let o=n=>this.emitter.fire(n);this.emitter=new E({onWillAddFirstListener:()=>i.addEventListener(e,o,t),onDidRemoveLastListener:()=>i.removeEventListener(e,o,t)})}dispose(){this.emitter.dispose()}};var NPo=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Ugt(a){return NPo.test(a)}var _t=(function(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID.bind(crypto);let a=new Uint8Array(16),i=[];for(let e=0;e<256;e++)i.push(e.toString(16).padStart(2,"0"));return function(){crypto.getRandomValues(a),a[6]=a[6]&15|64,a[8]=a[8]&63|128;let t=0,o="";return o+=i[a[t++]],o+=i[a[t++]],o+=i[a[t++]],o+=i[a[t++]],o+="-",o+=i[a[t++]],o+=i[a[t++]],o+="-",o+=i[a[t++]],o+=i[a[t++]],o+="-",o+=i[a[t++]],o+=i[a[t++]],o+="-",o+=i[a[t++]],o+=i[a[t++]],o+=i[a[t++]],o+=i[a[t++]],o+=i[a[t++]],o+=i[a[t++]],o}})();function zgt(a){return`${a}-${_t()}`}var IIe=class extends C{constructor(e,t){super();this.timeout=void 0;this._register(j(e,"dragover",o=>{o.preventDefault(),this.timeout||(this.timeout=setTimeout(()=>{t(),this.timeout=void 0},800))})),["dragleave","drop","dragend"].forEach(o=>{this._register(j(e,o,()=>{this.clearDragTimeout()}))})}clearDragTimeout(){this.timeout&&(clearTimeout(this.timeout),this.timeout=void 0)}dispose(){super.dispose(),this.clearDragTimeout()}},Aa={RESOURCES:"ResourceURLs",DOWNLOAD_URL:"DownloadURL",FILES:"Files",TEXT:Zn.text,INTERNAL_URI_LIST:"application/vnd.code.uri-list"};function NN(a,i){return{id:i,asString:async()=>a,asFile:()=>{},value:typeof a=="string"?a:void 0}}function C$i(a,i,e,t){let o={id:_t(),name:a,uri:i,data:e};return{id:t,asString:async()=>"",asFile:()=>o,value:void 0}}var bx=class{constructor(){this._entries=new Map}get size(){let i=0;for(let e of this._entries)i++;return i}has(i){return this._entries.has(this.toKey(i))}matches(i){let e=[...this._entries.keys()];return ht.some(this,([t,o])=>o.asFile())&&e.push("files"),x$i(Kgt(i),e)}get(i){return this._entries.get(this.toKey(i))?.[0]}append(i,e){let t=this._entries.get(i);t?t.push(e):this._entries.set(this.toKey(i),[e])}replace(i,e){this._entries.set(this.toKey(i),[e])}delete(i){this._entries.delete(this.toKey(i))}*[Symbol.iterator](){for(let[i,e]of this._entries)for(let t of e)yield[i,t]}toKey(i){return Kgt(i)}};function Kgt(a){return a.toLowerCase()}function Y$e(a,i){return x$i(Kgt(a),i.map(Kgt))}function x$i(a,i){if(a==="*/*")return i.length>0;if(i.includes(a))return!0;let e=a.match(/^([a-z]+)\/([a-z]+|\*)$/i);if(!e)return!1;let[t,o,n]=e;return n==="*"?i.some(r=>r.startsWith(o+"/")):!1}var Uy=Object.freeze({create:a=>Uo(a.map(i=>i.toString())).join(`\r
`),split:a=>a.split(`\r
`),parse:a=>Uy.split(a).filter(i=>!i.startsWith("#"))});function yIe(a){return JSON.stringify(a,OPo)}function zg(a){let i=JSON.parse(a);return i=Xn(i),i}function OPo(a,i){return i instanceof RegExp?{$mid:2,source:i.source,flags:i.flags}:i}function Xn(a,i=0){if(!a||i>200)return a;if(typeof a=="object"){switch(a.$mid){case 1:return A.revive(a);case 2:return new RegExp(a.source,a.flags);case 17:return new Date(a.source)}if(a instanceof Je||a instanceof Uint8Array)return a;if(Array.isArray(a))for(let e=0;e<a.length;++e)a[e]=Xn(a[e],i+1);else for(let e in a)Object.hasOwnProperty.call(a,e)&&(a[e]=Xn(a[e],i+1))}return a}var Ggt=(o=>(o[o.Ignore=0]="Ignore",o[o.Info=1]="Info",o[o.Warning=2]="Warning",o[o.Error=3]="Error",o))(Ggt||{});(s=>{let a="error",i="warning",e="warn",t="info",o="ignore";function n(l){return l?mr(a,l)?3:mr(i,l)||mr(e,l)?2:mr(t,l)?1:0:0}s.fromValue=n;function r(l){switch(l){case 3:return a;case 2:return i;case 1:return t;default:return o}}s.toString=r})(Ggt||={});var gt=Ggt;function T$i(a,i){let{os:e,tildify:t,relative:o}=i;if(o){let s=FPo(a,o,e);if(typeof s=="string")return s}let n=a.fsPath;if(e===1&&!ri?n=n.replace(/\//g,"\\"):e!==1&&ri&&(n=n.replace(/\\/g,"/")),e!==1&&t?.userHome){let s=t.userHome.fsPath,l;a.scheme!==t.userHome.scheme&&a.path[0]===Lo.sep&&a.path[1]!==Lo.sep?l=t.userHome.with({path:a.path}).fsPath:l=n,n=Z$e(l,s,e)}return(e===1?Ms:Lo).normalize(Hp(n,e===1))}function FPo(a,i,e){let t=e===1?Ms:Lo,o=e===3?ar:dx,n=i.getWorkspace(),r=n.folders.at(0);if(!r)return;a.scheme!==r.uri.scheme&&a.path[0]===Lo.sep&&a.path[1]!==Lo.sep&&(a=r.uri.with({path:a.path}));let s=i.getWorkspaceFolder(a);if(!s)return;let l;if(o.isEqual(s.uri,a)?l="":l=o.relativePath(s.uri,a)??"",l&&(l=t.normalize(l)),n.folders.length>1&&!i.noPrefix){let c=s.name?s.name:o.basenameOrAuthority(s.uri);l=l?`${c} \u2022 ${l}`:c}return l}function Hp(a,i=ri){return f6(a,i)?a.charAt(0).toUpperCase()+a.slice(1):a}var dJt=Object.create(null);function Z$e(a,i,e=zo){if(e===1||!a||!i)return a;let t=dJt.original===i?dJt.normalized:void 0;t||(t=i,ri&&(t=p$(t)),t=`${ih(t,Lo.sep)}${Lo.sep}`,dJt={original:i,normalized:t});let o=a;return ri&&(o=p$(o)),(e===3?o.startsWith(t):Uk(o,t))?`~/${o.substr(t.length)}`:a}function v9(a,i){return a.replace(/^~($|\/|\\)/,`${i}$1`)}var k$i="\u2026",X$e="\\\\",J$e="~";function wIe(a,i=Rd){let e=new Array(a.length),t=!1;for(let o=0;o<a.length;o++){let n=a[o];if(n===""){e[o]=`.${i}`;continue}if(!n){e[o]=n;continue}t=!0;let r="",s=n;s.indexOf(X$e)===0?(r=s.substr(0,s.indexOf(X$e)+X$e.length),s=s.substr(s.indexOf(X$e)+X$e.length)):s.indexOf(i)===0?(r=s.substr(0,s.indexOf(i)+i.length),s=s.substr(s.indexOf(i)+i.length)):s.indexOf(J$e)===0&&(r=s.substr(0,s.indexOf(J$e)+J$e.length),s=s.substr(s.indexOf(J$e)+J$e.length));let l=s.split(i);for(let c=1;t&&c<=l.length;c++)for(let u=l.length-c;t&&u>=0;u--){t=!1;let p=l.slice(u,u+c).join(i);for(let h=0;!t&&h<a.length;h++)if(h!==o&&a[h]&&a[h].indexOf(p)>-1){let g=u+c===l.length,f=u>0&&a[h].indexOf(i)>-1?i+p:p,v=a[h].endsWith(f);t=!g||v}if(!t){let h="";(l[0].endsWith(":")||r!=="")&&(u===1&&(u=0,c++,p=l[0]+i+p),u>0&&(h=l[0]+i),h=r+h),u>0&&(h=h+k$i+i),h=h+p,u+c<l.length&&(h=h+i+k$i),e[o]=h}}t&&(e[o]=n)}return e}function $gt(a,i=Object.create(null)){let e=[],t=!1,o="";for(let n of a)if(n==="$"||t&&n==="{")o&&e.push({value:o,type:0}),o="",t=!0;else if(n==="}"&&t){let r=i[o];if(typeof r=="string")r.length&&e.push({value:r,type:1});else if(r){let s=e[e.length-1];(!s||s.type!==2)&&e.push({value:r.label,type:2})}o="",t=!1}else o+=n;return o&&!t&&e.push({value:o,type:0}),e.filter((n,r)=>{if(n.type===2){let s=e[r-1],l=e[r+1];return[s,l].every(c=>c&&(c.type===1||c.type===0)&&c.value.length>0)}return!0}).map(n=>n.value).join("")}function G$(a,i){return it||i?a.replace(/\(&&\w\)|&&/g,"").replace(/&/g,it?"&":"&&"):a.replace(/&&|&/g,e=>e==="&"?"&&":"&")}function $$(a,i){let e=a.replace(/\(&&\w\)|&&/g,"");if(i)return e;if(it)return{withMnemonic:e,withoutMnemonic:e};let t;return ri?t=a.replace(/&&|&/g,o=>o==="&"?"&&":"&"):t=a.replace(/&&/g,"_"),{withMnemonic:t,withoutMnemonic:e}}function eqe(a){return a.replace(/&/g,"&&")}function _$i(a){if(a.endsWith("]")){let i=a.lastIndexOf(" [",a.length-2);if(i!==-1){let e=E$i(a.substring(0,i)),t=a.substring(i);return{name:e.name+t,parentPath:e.parentPath}}}return E$i(a)}function E$i(a){let i=a.indexOf("/")!==-1?Lo:Ms,e=i.basename(a),t=i.dirname(a);return e.length?{name:e,parentPath:t}:{name:t,parentPath:""}}var ct=ae("dialogService");var CIe=class{getConfirmationButtons(i){return this.getButtons(i,1)}getPromptButtons(i){return this.getButtons(i,2)}getInputButtons(i){return this.getButtons(i,3)}getButtons(i,e){let t=[];switch(e){case 1:{let o=i;o.primaryButton?t.push(o.primaryButton):t.push(d(1869,null)),o.cancelButton?t.push(o.cancelButton):t.push(d(1865,null));break}case 2:{let o=i;Array.isArray(o.buttons)&&o.buttons.length>0&&t.push(...o.buttons.map(n=>n.label)),o.cancelButton&&(o.cancelButton===!0?t.push(d(1865,null)):typeof o.cancelButton=="string"?t.push(o.cancelButton):o.cancelButton.label?t.push(o.cancelButton.label):t.push(d(1865,null))),t.length===0&&t.push(d(1868,null));break}case 3:{let o=i;o.primaryButton?t.push(o.primaryButton):t.push(d(1868,null)),o.cancelButton?t.push(o.cancelButton):t.push(d(1865,null));break}}return t}getDialogType(i){if(typeof i=="string")return i;if(typeof i=="number")return i===gt.Info?"info":i===gt.Error?"error":i===gt.Warning?"warning":"none"}getPromptResult(i,e,t){let o=[...i.buttons??[]];i.cancelButton&&typeof i.cancelButton!="string"&&typeof i.cancelButton!="boolean"&&o.push(i.cancelButton);let n=o[e]?.run({checkboxChecked:t});return n instanceof Promise||(n=Promise.resolve(n)),{result:n,checkboxChecked:t}}},dn=ae("fileDialogService");var qgt=10;function Xw(a){let i=[];return i.push(...a.slice(0,qgt).map(e=>typeof e=="string"?e:Ye(e))),a.length>qgt&&(a.length-qgt===1?i.push(d(1866,null)):i.push(d(1867,null,a.length-qgt))),i.push(""),i.join(`
`)}var uJt=class{constructor(){this._value="";this._pos=0}reset(i){return this._value=i,this._pos=0,this}next(){return this._pos+=1,this}hasNext(){return this._pos<this._value.length-1}cmp(i){let e=i.charCodeAt(0),t=this._value.charCodeAt(this._pos);return e-t}value(){return this._value[this._pos]}},pJt=class{constructor(i=!0){this._caseSensitive=i}reset(i){return this._value=i,this._from=0,this._to=0,this.next()}hasNext(){return this._to<this._value.length}next(){this._from=this._to;let i=!0;for(;this._to<this._value.length;this._to++)if(this._value.charCodeAt(this._to)===46)if(i)this._from++;else break;else i=!1;return this}cmp(i){return this._caseSensitive?kbe(i,this._value,0,i.length,this._from,this._to):wre(i,this._value,0,i.length,this._from,this._to)}value(){return this._value.substring(this._from,this._to)}},b9=class{constructor(i=!0,e=!0){this._splitOnBackslash=i;this._caseSensitive=e}reset(i){this._from=0,this._to=0,this._value=i,this._valueLen=i.length;for(let e=i.length-1;e>=0;e--,this._valueLen--){let t=this._value.charCodeAt(e);if(!(t===47||this._splitOnBackslash&&t===92))break}return this.next()}hasNext(){return this._to<this._valueLen}next(){this._from=this._to;let i=!0;for(;this._to<this._valueLen;this._to++){let e=this._value.charCodeAt(this._to);if(e===47||this._splitOnBackslash&&e===92)if(i)this._from++;else break;else i=!1}return this}cmp(i){return this._caseSensitive?kbe(i,this._value,0,i.length,this._from,this._to):wre(i,this._value,0,i.length,this._from,this._to)}value(){return this._value.substring(this._from,this._to)}};var mJt=class{constructor(i,e){this._ignorePathCasing=i;this._ignoreQueryAndFragment=e;this._states=[];this._stateIdx=0}reset(i){return this._value=i,this._states=[],this._value.scheme&&this._states.push(1),this._value.authority&&this._states.push(2),this._value.path&&(this._pathIterator=new b9(!1,!this._ignorePathCasing(i)),this._pathIterator.reset(i.path),this._pathIterator.value()&&this._states.push(3)),this._ignoreQueryAndFragment(i)||(this._value.query&&this._states.push(4),this._value.fragment&&this._states.push(5)),this._stateIdx=0,this}next(){return this._states[this._stateIdx]===3&&this._pathIterator.hasNext()?this._pathIterator.next():this._stateIdx+=1,this}hasNext(){return this._states[this._stateIdx]===3&&this._pathIterator.hasNext()||this._stateIdx<this._states.length-1}cmp(i){if(this._states[this._stateIdx]===1)return Uw(i,this._value.scheme);if(this._states[this._stateIdx]===2)return Uw(i,this._value.authority);if(this._states[this._stateIdx]===3)return this._pathIterator.cmp(i);if(this._states[this._stateIdx]===4)return Al(i,this._value.query);if(this._states[this._stateIdx]===5)return Al(i,this._value.fragment);throw new Error}value(){if(this._states[this._stateIdx]===1)return this._value.scheme;if(this._states[this._stateIdx]===2)return this._value.authority;if(this._states[this._stateIdx]===3)return this._pathIterator.value();if(this._states[this._stateIdx]===4)return this._value.query;if(this._states[this._stateIdx]===5)return this._value.fragment;throw new Error}},q$=class a{static{this.Val=Symbol("undefined_placeholder")}static wrap(i){return i===void 0?a.Val:i}static unwrap(i){return i===a.Val?void 0:i}},xIe=class{constructor(){this.height=1;this.value=void 0;this.key=void 0;this.left=void 0;this.mid=void 0;this.right=void 0}isEmpty(){return!this.left&&!this.mid&&!this.right&&this.value===void 0}rotateLeft(){let i=this.right;return this.right=i.left,i.left=this,this.updateHeight(),i.updateHeight(),i}rotateRight(){let i=this.left;return this.left=i.right,i.right=this,this.updateHeight(),i.updateHeight(),i}updateHeight(){this.height=1+Math.max(this.heightLeft,this.heightRight)}balanceFactor(){return this.heightRight-this.heightLeft}get heightLeft(){return this.left?.height??0}get heightRight(){return this.right?.height??0}};var Yu=class a{static forUris(i=()=>!1,e=()=>!1){return new a(new mJt(i,e))}static forPaths(i=!1){return new a(new b9(void 0,!i))}static forStrings(){return new a(new uJt)}static forConfigKeys(){return new a(new pJt)}constructor(i){this._iter=i}clear(){this._root=void 0}fill(i,e){if(e){let t=e.slice(0);l6(t);for(let o of t)this.set(o,i)}else{let t=i.slice(0);l6(t);for(let o of t)this.set(o[0],o[1])}}set(i,e){let t=this._iter.reset(i),o;this._root||(this._root=new xIe,this._root.segment=t.value());let n=[];for(o=this._root;;){let s=t.cmp(o.segment);if(s>0)o.left||(o.left=new xIe,o.left.segment=t.value()),n.push([-1,o]),o=o.left;else if(s<0)o.right||(o.right=new xIe,o.right.segment=t.value()),n.push([1,o]),o=o.right;else if(t.hasNext())t.next(),o.mid||(o.mid=new xIe,o.mid.segment=t.value()),n.push([0,o]),o=o.mid;else break}let r=q$.unwrap(o.value);o.value=q$.wrap(e),o.key=i;for(let s=n.length-1;s>=0;s--){let l=n[s][1];l.updateHeight();let c=l.balanceFactor();if(c<-1||c>1){let u=n[s][0],p=n[s+1][0];if(u===1&&p===1)n[s][1]=l.rotateLeft();else if(u===-1&&p===-1)n[s][1]=l.rotateRight();else if(u===1&&p===-1)l.right=n[s+1][1]=n[s+1][1].rotateRight(),n[s][1]=l.rotateLeft();else if(u===-1&&p===1)l.left=n[s+1][1]=n[s+1][1].rotateLeft(),n[s][1]=l.rotateRight();else throw new Error;if(s>0)switch(n[s-1][0]){case-1:n[s-1][1].left=n[s][1];break;case 1:n[s-1][1].right=n[s][1];break;case 0:n[s-1][1].mid=n[s][1];break}else this._root=n[0][1]}}return r}get(i){return q$.unwrap(this._getNode(i)?.value)}_getNode(i){let e=this._iter.reset(i),t=this._root;for(;t;){let o=e.cmp(t.segment);if(o>0)t=t.left;else if(o<0)t=t.right;else if(e.hasNext())e.next(),t=t.mid;else break}return t}has(i){let e=this._getNode(i);return!(e?.value===void 0&&e?.mid===void 0)}delete(i){return this._delete(i,!1)}deleteSuperstr(i){return this._delete(i,!0)}_delete(i,e){let t=this._iter.reset(i),o=[],n=this._root;for(;n;){let r=t.cmp(n.segment);if(r>0)o.push([-1,n]),n=n.left;else if(r<0)o.push([1,n]),n=n.right;else if(t.hasNext())t.next(),o.push([0,n]),n=n.mid;else break}if(n){if(e?(n.left=void 0,n.mid=void 0,n.right=void 0,n.height=1):(n.key=void 0,n.value=void 0),!n.mid&&!n.value)if(n.left&&n.right){let r=[[1,n]],s=this._min(n.right,r);if(s.key){n.key=s.key,n.value=s.value,n.segment=s.segment;let l=s.right;if(r.length>1){let[u,p]=r[r.length-1];switch(u){case-1:p.left=l;break;case 0:Ey(!1);case 1:Ey(!1)}}else n.right=l;let c=this._balanceByStack(r);if(o.length>0){let[u,p]=o[o.length-1];switch(u){case-1:p.left=c;break;case 0:p.mid=c;break;case 1:p.right=c;break}}else this._root=c}}else{let r=n.left??n.right;if(o.length>0){let[s,l]=o[o.length-1];switch(s){case-1:l.left=r;break;case 0:l.mid=r;break;case 1:l.right=r;break}}else this._root=r}this._root=this._balanceByStack(o)??this._root}}_min(i,e){for(;i.left;)e.push([-1,i]),i=i.left;return i}_balanceByStack(i){for(let e=i.length-1;e>=0;e--){let t=i[e][1];t.updateHeight();let o=t.balanceFactor();if(o>1?(t.right.balanceFactor()>=0||(t.right=t.right.rotateRight()),i[e][1]=t.rotateLeft()):o<-1&&(t.left.balanceFactor()<=0||(t.left=t.left.rotateLeft()),i[e][1]=t.rotateRight()),e>0)switch(i[e-1][0]){case-1:i[e-1][1].left=i[e][1];break;case 1:i[e-1][1].right=i[e][1];break;case 0:i[e-1][1].mid=i[e][1];break}else return i[0][1]}}findSubstr(i){let e=this._iter.reset(i),t=this._root,o;for(;t;){let n=e.cmp(t.segment);if(n>0)t=t.left;else if(n<0)t=t.right;else if(e.hasNext())e.next(),o=q$.unwrap(t.value)||o,t=t.mid;else break}return t&&q$.unwrap(t.value)||o}findSuperstr(i){return this._findSuperstrOrElement(i,!1)}_findSuperstrOrElement(i,e){let t=this._iter.reset(i),o=this._root;for(;o;){let n=t.cmp(o.segment);if(n>0)o=o.left;else if(n<0)o=o.right;else if(t.hasNext())t.next(),o=o.mid;else return o.mid?this._entries(o.mid):e?q$.unwrap(o.value):void 0}}hasElementOrSubtree(i){return this._findSuperstrOrElement(i,!0)!==void 0}forEach(i){for(let[e,t]of this)i(t,e)}*[Symbol.iterator](){yield*this._entries(this._root)}_entries(i){let e=[];return this._dfsEntries(i,e),e[Symbol.iterator]()}_dfsEntries(i,e){i&&(i.left&&this._dfsEntries(i.left,e),i.value!==void 0&&e.push([i.key,q$.unwrap(i.value)]),i.mid&&this._dfsEntries(i.mid,e),i.right&&this._dfsEntries(i.right,e))}_isBalanced(){let i=e=>{if(!e)return!0;let t=e.balanceFactor();return t<-1||t>1?!1:i(e.left)&&i(e.right)};return i(this._root)}};var be=ae("fileService");function D$i(a){return a.create===!0}function XT(a){return!!(a.capabilities&2)}function L$i(a){return!!(a.capabilities&524288)}function tqe(a){return!!(a.capabilities&8)}function jgt(a){return!!(a.capabilities&131072)}function R$i(a){return!!(a.capabilities&262144)}function j$(a){return!!(a.capabilities&4)}function Qgt(a){return!!(a.capabilities&16)}function Ygt(a){return XT(a)?!!(a.capabilities&16384):!1}function hJt(a){return XT(a)?!!(a.capabilities&32768):!1}function M$i(a){return!!(a.capabilities&65536)}function P$i(a){return!!(a.capabilities&2048)}var kIe=class a extends Error{constructor(e,t){super(e);this.code=t}static create(e,t){let o=new a(e.toString(),t);return gJt(o,t),o}};function Jr(a,i){return kIe.create(a,i)}function Q$(a){return a||Jr(d(2061,null),"Unknown")}function gJt(a,i){return a.name=i?`${i} (FileSystemError)`:"FileSystemError",a}function Gse(a){if(!a)return"Unknown";if(a instanceof kIe)return a.code;let i=/^(.+) \(FileSystemError\)$/.exec(a.name);if(!i)return"Unknown";switch(i[1]){case"EntryExists":return"EntryExists";case"EntryIsADirectory":return"EntryIsADirectory";case"EntryNotADirectory":return"EntryNotADirectory";case"EntryNotFound":return"EntryNotFound";case"EntryTooLarge":return"EntryTooLarge";case"EntryWriteLocked":return"EntryWriteLocked";case"NoPermissions":return"NoPermissions";case"Unavailable":return"Unavailable"}return"Unknown"}function hu(a){if(a instanceof As)return a.fileOperationResult;switch(Gse(a)){case"EntryNotFound":return 1;case"EntryIsADirectory":return 0;case"EntryNotADirectory":return 9;case"EntryWriteLocked":return 5;case"NoPermissions":return 6;case"EntryExists":return 4;case"EntryTooLarge":return 7;default:return 10}}var ON=class{constructor(i,e,t){this.resource=i;this.operation=e;this.target=t}isOperation(i){return this.operation===i}};var FN=class a{constructor(i,e){this.ignorePathCasing=e;this.correlationId=void 0;this.added=new co(()=>{let i=Yu.forUris(()=>this.ignorePathCasing);return i.fill(this.rawAdded.map(e=>[e,!0])),i});this.updated=new co(()=>{let i=Yu.forUris(()=>this.ignorePathCasing);return i.fill(this.rawUpdated.map(e=>[e,!0])),i});this.deleted=new co(()=>{let i=Yu.forUris(()=>this.ignorePathCasing);return i.fill(this.rawDeleted.map(e=>[e,!0])),i});this.rawAdded=[];this.rawUpdated=[];this.rawDeleted=[];for(let t of i){switch(t.type){case 1:this.rawAdded.push(t.resource);break;case 0:this.rawUpdated.push(t.resource);break;case 2:this.rawDeleted.push(t.resource);break}this.correlationId!==a.MIXED_CORRELATION&&(typeof t.cId=="number"?this.correlationId===void 0?this.correlationId=t.cId:this.correlationId!==t.cId&&(this.correlationId=a.MIXED_CORRELATION):this.correlationId!==void 0&&(this.correlationId=a.MIXED_CORRELATION))}}static{this.MIXED_CORRELATION=null}contains(i,...e){return this.doContains(i,{includeChildren:!1},...e)}affects(i,...e){return this.doContains(i,{includeChildren:!0},...e)}doContains(i,e,...t){if(!i)return!1;let o=t.length>0;return!!((!o||t.includes(1))&&(this.added.value.get(i)||e.includeChildren&&this.added.value.findSuperstr(i))||(!o||t.includes(0))&&(this.updated.value.get(i)||e.includeChildren&&this.updated.value.findSuperstr(i))||(!o||t.includes(2))&&(this.deleted.value.findSubstr(i)||e.includeChildren&&this.deleted.value.findSuperstr(i)))}gotAdded(){return this.rawAdded.length>0}gotDeleted(){return this.rawDeleted.length>0}gotUpdated(){return this.rawUpdated.length>0}correlates(i){return this.correlationId===i}hasCorrelation(){return typeof this.correlationId=="number"}};var As=class extends Error{constructor(e,t,o){super(e);this.fileOperationResult=t;this.options=o}},WN=class extends As{constructor(e,t,o,n){super(e,t,n);this.fileOperationResult=t;this.size=o}},UU=class extends As{constructor(e,t,o){super(e,2,o);this.stat=t}};var cv={OFF:"off",AFTER_DELAY:"afterDelay",ON_FOCUS_CHANGE:"onFocusChange",ON_WINDOW_CHANGE:"onWindowChange"},AS={OFF:"off",ON_EXIT:"onExit",ON_EXIT_AND_WINDOW_CLOSE:"onExitAndWindowClose"},Y$="files.associations",Xgt="files.exclude",Jgt="files.readonlyInclude",Zgt="files.readonlyExclude",A$i="files.readonlyFromPermissions",Cd=(t=>(t[t.FILE=0]="FILE",t[t.FOLDER=1]="FOLDER",t[t.ROOT_FOLDER=2]="ROOT_FOLDER",t))(Cd||{}),gL="";function fJt(a){if(!(typeof a.size!="number"||typeof a.mtime!="number"))return a.mtime.toString(29)+a.size.toString(31)}async function N$i(a,i){if(!i.hasProvider(A.from({scheme:a.scheme})))return new Promise(e=>{let t=i.onDidChangeFileSystemProviderRegistrations(o=>{o.scheme===a.scheme&&o.added&&(t.dispose(),e())})})}var ll=class a{static{this.KB=1024}static{this.MB=a.KB*a.KB}static{this.GB=a.MB*a.KB}static{this.TB=a.GB*a.KB}static formatSize(i){return Xo(i)||(i=0),i<a.KB?d(2056,null,i.toFixed(0)):i<a.MB?d(2058,null,(i/a.KB).toFixed(2)):i<a.GB?d(2059,null,(i/a.MB).toFixed(2)):i<a.TB?d(2057,null,(i/a.GB).toFixed(2)):d(2060,null,(i/a.TB).toFixed(2))}};function eft(a){let i=typeof a=="string"||a?.scheme===Y.vscodeRemote;return typeof a!="string"&&a?.scheme===Y.file?1024*ll.MB:i?10*ll.MB:Gt?50*ll.MB:1024*ll.MB}var Sx;(o=>{function a(n){return typeof n?.showDirectoryPicker=="function"}o.supported=a;function i(n){let r=n;return r?typeof r.kind=="string"&&typeof r.queryPermission=="function"&&typeof r.requestPermission=="function":!1}o.isFileSystemHandle=i;function e(n){return n.kind==="file"}o.isFileSystemFileHandle=e;function t(n){return n.kind==="directory"}o.isFileSystemDirectoryHandle=t})(Sx||={});var vJt;(i=>{function a(e){return typeof e?.FileSystemObserver=="function"}i.supported=a})(vJt||={});var tft=class extends C{constructor(e,t,o){super();this.indexedDB=e;this.store=t;this.logService=o;this.onDidChangeCapabilities=H.None;this.extUri=Wn?ar:dx;this._onDidChangeFileEmitter=this._register(new E);this.onDidChangeFile=this._onDidChangeFileEmitter.event;this._files=new Map;this._directories=new Map}get capabilities(){return this._capabilities||(this._capabilities=18,Wn&&(this._capabilities|=1024)),this._capabilities}async stat(e){try{let t=await this.getHandle(e);if(!t)throw this.createFileSystemProviderError(e,"No such file or directory, stat","EntryNotFound");if(Sx.isFileSystemFileHandle(t)){let o=await t.getFile();return{type:1,mtime:o.lastModified,ctime:0,size:o.size}}return{type:2,mtime:0,ctime:0,size:0}}catch(t){throw this.toFileSystemProviderError(t)}}async readdir(e){try{let t=await this.getDirectoryHandle(e);if(!t)throw this.createFileSystemProviderError(e,"No such file or directory, readdir","EntryNotFound");let o=[];for await(let[n,r]of t)o.push([n,Sx.isFileSystemFileHandle(r)?1:2]);return o}catch(t){throw this.toFileSystemProviderError(t)}}readFileStream(e,t,o){let n=_I(r=>Je.concat(r.map(s=>Je.wrap(s))).buffer,{highWaterMark:10});return(async()=>{try{let r=await this.getFileHandle(e);if(!r)throw this.createFileSystemProviderError(e,"No such file or directory, readFile","EntryNotFound");let s=await r.getFile();if(typeof t.length=="number"||typeof t.position=="number"){let l=new Uint8Array(await s.arrayBuffer());typeof t?.position=="number"&&(l=l.slice(t.position)),typeof t?.length=="number"&&(l=l.slice(0,t.length)),n.end(l)}else{let l=s.stream().getReader(),c=await l.read();for(;!c.done&&!(o.isCancellationRequested||(await n.write(c.value),o.isCancellationRequested));)c=await l.read();n.end(void 0)}}catch(r){n.error(this.toFileSystemProviderError(r)),n.end()}})(),n}async readFile(e){try{let t=await this.getFileHandle(e);if(!t)throw this.createFileSystemProviderError(e,"No such file or directory, readFile","EntryNotFound");let o=await t.getFile();return new Uint8Array(await o.arrayBuffer())}catch(t){throw this.toFileSystemProviderError(t)}}async writeFile(e,t,o){try{let n=await this.getFileHandle(e);if(!o.create||!o.overwrite){if(n){if(!o.overwrite)throw this.createFileSystemProviderError(e,"File already exists, writeFile","EntryExists")}else if(!o.create)throw this.createFileSystemProviderError(e,"No such file, writeFile","EntryNotFound")}if(!n){let s=await this.getDirectoryHandle(this.extUri.dirname(e));if(!s)throw this.createFileSystemProviderError(e,"No such parent directory, writeFile","EntryNotFound");if(n=await s.getFileHandle(this.extUri.basename(e),{create:!0}),!n)throw this.createFileSystemProviderError(e,"Unable to create file , writeFile","Unknown")}let r=await n.createWritable();await r.write(t),await r.close()}catch(n){throw this.toFileSystemProviderError(n)}}async mkdir(e){try{let t=await this.getDirectoryHandle(this.extUri.dirname(e));if(!t)throw this.createFileSystemProviderError(e,"No such parent directory, mkdir","EntryNotFound");await t.getDirectoryHandle(this.extUri.basename(e),{create:!0})}catch(t){throw this.toFileSystemProviderError(t)}}async delete(e,t){try{let o=await this.getDirectoryHandle(this.extUri.dirname(e));if(!o)throw this.createFileSystemProviderError(e,"No such parent directory, delete","EntryNotFound");return o.removeEntry(this.extUri.basename(e),{recursive:t.recursive})}catch(o){throw this.toFileSystemProviderError(o)}}async rename(e,t,o){try{if(this.extUri.isEqual(e,t))return;let n=await this.getFileHandle(e);if(n){let r=await n.getFile(),s=new Uint8Array(await r.arrayBuffer());await this.writeFile(t,s,{create:!0,overwrite:o.overwrite,unlock:!1,atomic:!1}),await this.delete(e,{recursive:!1,useTrash:!1,atomic:!1})}else throw this.createFileSystemProviderError(e,d(2055,null),"Unavailable")}catch(n){throw this.toFileSystemProviderError(n)}}watch(e,t){let o=new P;return this.doWatch(e,t,o).catch(n=>this.logService.error(`[File Watcher ('FileSystemObserver')] Error: ${n} (${e})`)),o}async doWatch(e,t,o){if(!vJt.supported(globalThis))return;let n=await this.getHandle(e);if(!n||o.isDisposed)return;let r=new globalThis.FileSystemObserver(s=>{if(o.isDisposed)return;let l=[];for(let c of s)switch(this.logService.getLevel()===1&&this.logService.trace(`[File Watcher ('FileSystemObserver')] [${c.type}] ${je(e,...c.relativePathComponents)}`),c.type){case"appeared":l.push({resource:je(e,...c.relativePathComponents),type:1});break;case"disappeared":l.push({resource:je(e,...c.relativePathComponents),type:2});break;case"modified":l.push({resource:je(e,...c.relativePathComponents),type:0});break;case"errored":this.logService.trace(`[File Watcher ('FileSystemObserver')] errored, disposing observer (${e})`),o.dispose()}l.length&&this._onDidChangeFileEmitter.fire(l)});try{await r.observe(n,t.recursive?{recursive:!0}:void 0)}finally{o.isDisposed?r.disconnect():o.add(Z(()=>r.disconnect()))}}registerFileHandle(e){return this.registerHandle(e,this._files)}registerDirectoryHandle(e){return this.registerHandle(e,this._directories)}get directories(){return this._directories.values()}async registerHandle(e,t){let o=`/${e.name}`;if(t.has(o)&&!await t.get(o)?.isSameEntry(e)){let n=Am(e.name),r=No(e.name,n),s=1;do o=`/${r}-${s++}${n}`;while(t.has(o)&&!await t.get(o)?.isSameEntry(e))}t.set(o,e);try{await this.indexedDB?.runInTransaction(this.store,"readwrite",n=>n.put(e,o))}catch(n){this.logService.error(n)}return A.from({scheme:Y.file,path:o})}async getHandle(e){let t=await this.doGetHandle(e);if(!t){let o=await this.getDirectoryHandle(this.extUri.dirname(e));if(o){let n=ar.basename(e);try{t=await o.getFileHandle(n)}catch{try{t=await o.getDirectoryHandle(n)}catch{}}}}return t}async getFileHandle(e){let t=await this.doGetHandle(e);if(t instanceof FileSystemFileHandle)return t;let o=await this.getDirectoryHandle(this.extUri.dirname(e));try{return await o?.getFileHandle(ar.basename(e))}catch{return}}async getDirectoryHandle(e){let t=await this.doGetHandle(e);if(t instanceof FileSystemDirectoryHandle)return t;let o=this.extUri.dirname(e);if(this.extUri.isEqual(o,e))return;let n=await this.getDirectoryHandle(o);try{return await n?.getDirectoryHandle(ar.basename(e))}catch{return}}async doGetHandle(e){if(this.extUri.dirname(e).path!=="/")return;let t=e.path.replace(/\/$/,""),o=this._files.get(t)??this._directories.get(t);if(o)return o;let n=await this.indexedDB?.runInTransaction(this.store,"readonly",r=>r.get(t));if(Sx.isFileSystemHandle(n)){let r=await n.queryPermission()==="granted";try{r||(r=await n.requestPermission()==="granted")}catch(s){this.logService.error(s)}if(r)return Sx.isFileSystemFileHandle(n)?this._files.set(t,n):Sx.isFileSystemDirectoryHandle(n)&&this._directories.set(t,n),n}throw this.createFileSystemProviderError(e,"No file system handle registered","Unavailable")}toFileSystemProviderError(e){if(e instanceof kIe)return e;let t="Unknown";return e.name==="NotAllowedError"&&(e=new Error(d(2054,null)),t="Unavailable"),Jr(e,t)}createFileSystemProviderError(e,t,o){return Jr(new Error(`${t} (${th(e.path)})`),o)}};var Qe=ae("openerService");function fL(a,i){return a.with({fragment:`${i.startLineNumber},${i.startColumn}${i.endLineNumber?`-${i.endLineNumber}${i.endColumn?`,${i.endColumn}`:""}`:""}`})}function EIe(a){let i,e=/^L?(\d+)(?:,(\d+))?(-L?(\d+)(?:,(\d+))?)?/.exec(a.fragment);return e&&(i={startLineNumber:parseInt(e[1]),startColumn:e[2]?parseInt(e[2]):1,endLineNumber:e[4]?parseInt(e[4]):void 0,endColumn:e[4]?e[5]?parseInt(e[5]):1:void 0},a=a.with({fragment:""})),{selection:i,uri:a}}var Ll={EDITORS:"CodeEditors",FILES:"CodeFiles",SYMBOLS:"application/vnd.code.symbols",MARKERS:"application/vnd.code.diagnostics",NOTEBOOK_CELL_OUTPUT:"notebook-cell-output",SCM_HISTORY_ITEM:"scm-history-item"};function iqe(a){let i=[];if(a.dataTransfer&&a.dataTransfer.types.length>0){let o=a.dataTransfer.getData(Ll.EDITORS);if(o)try{i.push(...zg(o))}catch{}else try{let s=a.dataTransfer.getData(Aa.RESOURCES);i.push(...SJt(s))}catch{}if(a.dataTransfer?.files)for(let s=0;s<a.dataTransfer.files.length;s++){let l=a.dataTransfer.files[s];if(l&&Ix(l))try{i.push({resource:A.file(Ix(l)),isExternal:!0,allowWorkspaceOpen:!0})}catch{}}let n=a.dataTransfer.getData(Ll.FILES);if(n)try{let s=JSON.parse(n);for(let l of s)i.push({resource:A.file(l),isExternal:!0,allowWorkspaceOpen:!0})}catch{}let r=oe.as(mW.DragAndDropContribution).getAll();for(let s of r){let l=a.dataTransfer.getData(s.dataFormatKey);if(l)try{i.push(...s.getEditorInputs(l))}catch{}}}let e=[],t=new vt;for(let o of i)o.resource?t.has(o.resource)||(e.push(o),t.set(o.resource,!0)):e.push(o);return e}async function TIe(a,i){let e=iqe(i);if(i.dataTransfer&&Gt&&gu(i,Aa.FILES)&&i.dataTransfer.items){let n=await a.get(F).invokeFunction(r=>WPo(r,i));for(let r of n)e.push({resource:r.resource,contents:r.contents?.toString(),isExternal:!0,allowWorkspaceOpen:r.isDirectory})}return e}function SJt(a){let i=[];if(a){let e=JSON.parse(a);for(let t of e)if(t.indexOf(":")>0){let{selection:o,uri:n}=EIe(A.parse(t));i.push({resource:n,options:{selection:o}})}}return i}async function WPo(a,i){if(Sx.supported(It)){let t=i.dataTransfer?.items;if(t)return VPo(a,t)}let e=i.dataTransfer?.files;return e?BPo(a,e):[]}async function VPo(a,i){let e=a.get(be).getProvider(Y.file);if(!(e instanceof tft))return[];let t=[];for(let o=0;o<i.length;o++){let n=i[o];if(n){let r=new Go;t.push(r),(async()=>{try{let s=await n.getAsFileSystemHandle();if(!s){r.complete(void 0);return}Sx.isFileSystemFileHandle(s)?r.complete({resource:await e.registerFileHandle(s),isDirectory:!1}):Sx.isFileSystemDirectoryHandle(s)?r.complete({resource:await e.registerDirectoryHandle(s),isDirectory:!0}):r.complete(void 0)}catch{r.complete(void 0)}})()}}return si(await Promise.all(t.map(o=>o.p)))}async function BPo(a,i){let e=a.get(ct),t=[];for(let o=0;o<i.length;o++){let n=i.item(o);if(n){if(n.size>100*ll.MB){e.warn(d(1877,null));continue}let r=new Go;t.push(r);let s=new FileReader;s.onerror=()=>r.complete(void 0),s.onabort=()=>r.complete(void 0),s.onload=async l=>{let c=n.name,u=l.target?.result??void 0;if(typeof c!="string"||typeof u>"u"){r.complete(void 0);return}r.complete({resource:A.from({scheme:Y.untitled,path:c}),contents:typeof u=="string"?Je.fromString(u):Je.wrap(new Uint8Array(u))})},s.readAsArrayBuffer(n)}}return si(await Promise.all(t.map(o=>o.p)))}function gu(a,...i){if(!a.dataTransfer)return!1;let e=a.dataTransfer.types,t=[];for(let o=0;o<e.length;o++)t.push(e[o].toLowerCase());for(let o of i)if(t.indexOf(o.toLowerCase())>=0)return!0;return!1}var bJt=class{constructor(){this._contributions=new Map;this._dropHandlers=new Set}register(i){if(this._contributions.has(i.dataFormatKey))throw new Error(`A drag and drop contributiont with key '${i.dataFormatKey}' was already registered.`);this._contributions.set(i.dataFormatKey,i)}getAll(){return this._contributions.values()}registerDropHandler(i){return this._dropHandlers.add(i),Z(()=>this._dropHandlers.delete(i))}async handleResourceDrop(i,e){for(let t of this._dropHandlers)if(await t.handleDrop(i,e))return!0;return!1}},mW={DragAndDropContribution:"workbench.contributions.dragAndDrop"};oe.add(mW.DragAndDropContribution,new bJt);var VI=class a{static{this.INSTANCE=new a}constructor(){}static getInstance(){return a.INSTANCE}hasData(i){return i&&i===this.proto}clearData(i){this.hasData(i)&&(this.proto=void 0,this.data=void 0)}getData(i){if(this.hasData(i))return this.data}setData(i,e){e&&(this.data=i,this.proto=e)}};function O$i(a,i,e){a.dataTransfer?.setData(i,JSON.stringify(e))}function IJt(a,i,e){let t=a.dataTransfer?.getData(i);if(t)try{return JSON.parse(t)}catch{}return e}function F$i(a){return IJt(a,Ll.SYMBOLS,[])}function _Ie(a,i){O$i(i,Ll.SYMBOLS,a)}function W$i(a){return IJt(a,Ll.MARKERS,void 0)}function V$i(a,i){O$i(i,Ll.MARKERS,a)}function B$i(a){return IJt(a,Ll.NOTEBOOK_CELL_OUTPUT,void 0)}function Ix(a){if(kr&&typeof globalThis.vscode?.webUtils?.getPathForFile=="function")return globalThis.vscode?.webUtils?.getPathForFile(a)}function HPo(a){let i=new bx;for(let e of a.items){let t=e.type;if(e.kind==="string"){let o=new Promise(n=>e.getAsString(n));i.append(t,NN(o))}else if(e.kind==="file"){let o=e.getAsFile();o&&i.append(t,UPo(o))}}return i}function UPo(a){let i=Ix(a),e=i?A.parse(i):void 0;return C$i(a.name,e,async()=>new Uint8Array(await a.arrayBuffer()))}var zPo=Object.freeze([Ll.EDITORS,Ll.FILES,Aa.RESOURCES,Aa.INTERNAL_URI_LIST]);function $se(a,i=!1){let e=HPo(a),t=e.get(Aa.INTERNAL_URI_LIST);if(t)e.replace(Zn.uriList,t);else if(i||!e.has(Zn.uriList)){let o=[];for(let n of a.items){let r=n.getAsFile();if(r){let s=Ix(r);try{s?o.push(A.file(s).toString()):o.push(A.parse(r.name,!0).toString())}catch{}}}o.length&&e.replace(Zn.uriList,NN(Uy.create(o)))}for(let o of zPo)e.delete(o);return e}function H$i(a,i,e){let{dataToCopy:t,metadata:o}=z$i(a);return U$i(t.text,o,e),{dataToCopy:t,metadata:o}}function U$i(a,i,e){S9.INSTANCE.set(e?a.replace(/\r\n/g,`
`):a,i)}function z$i(a){let i=a.getEditorOption(45),e=a.getEditorOption(31),t=a.getCursorStates().map(r=>r.modelState.selection),o=KPo(a,t,i,e),n={version:1,id:_t(),isFromEmptySelection:o.isFromEmptySelection,multicursorText:o.multicursorText,mode:o.mode};return{dataToCopy:o,metadata:n}}function KPo(a,i,e,t){let{sourceRanges:o,sourceText:n}=a.getPlainTextToCopy(i,e,ri),r=a.model.getEOL(),s=e&&i.length===1&&i[0].isEmpty(),l=Array.isArray(n)?n:null,c=Array.isArray(n)?n.join(r):n,u,p=null;if(zU.forceCopyWithSyntaxHighlighting||t&&n.length<65536){let g=a.getRichTextToCopy(i,e);g&&(u=g.html,p=g.mode)}return{isFromEmptySelection:s,sourceRanges:o,multicursorText:l,text:c,html:u,mode:p}}var S9=class a{static{this.INSTANCE=new a}constructor(){this._lastState=null}set(i,e){this._lastState={lastCopiedValue:i,data:e}}get(i){return this._lastState&&this._lastState.lastCopiedValue===i?this._lastState.data:(this._lastState=null,null)}},zU={forceCopyWithSyntaxHighlighting:!1,electronBugWorkaroundCopyEventHasFired:!1},K$i={getTextData(a){let i=a.getData(Zn.text),e=null,t=a.getData("vscode-editor-data");if(typeof t=="string")try{e=JSON.parse(t),e.version!==1&&(e=null)}catch{}return i.length===0&&e===null&&a.files.length>0?[Array.prototype.slice.call(a.files,0).map(n=>n.name).join(`
`),null]:[i,e]},setTextData(a,i,e,t){a.setData(Zn.text,i),typeof e=="string"&&a.setData("text/html",e),a.setData("vscode-editor-data",JSON.stringify(t))}};function DIe(a,i,e,t,o){let{dataToCopy:n,metadata:r}=z$i(e.viewModel),s=!1;return{isCut:i,clipboardData:{setData:(l,c)=>{a.clipboardData?.setData(l,c)}},dataToCopy:n,ensureClipboardGetsEditorData:()=>{a.preventDefault(),a.clipboardData&&K$i.setTextData(a.clipboardData,n.text,n.html,r),U$i(n.text,r,o),t.trace("ensureClipboardGetsEditorSelection with id : ",r.id," with text.length: ",n.text.length)},setHandled:()=>{s=!0,a.preventDefault(),a.stopImmediatePropagation()},get isHandled(){return s}}}function ift(a){let i=!1,[e,t]=a.clipboardData?K$i.getTextData(a.clipboardData):["",null];return t=t||S9.INSTANCE.get(e),{clipboardData:GPo(a.clipboardData),metadata:t,text:e,toExternalVSDataTransfer:()=>a.clipboardData?$se(a.clipboardData):void 0,browserEvent:a,setHandled:()=>{i=!0,a.preventDefault(),a.stopImmediatePropagation()},get isHandled(){return i}}}function GPo(a){return{types:Array.from(a?.types??[]),files:Array.prototype.slice.call(a?.files??[],0),getData:i=>a?.getData(i)??""}}var JT=!1,NS=class a{constructor(i,e,t,o,n){this.value=i;this.selectionStart=e;this.selectionEnd=t;this.selection=o;this.newlineCountBeforeSelection=n}static{this.EMPTY=new a("",0,0,null,void 0)}toString(){return`[ <${this.value}>, selectionStart: ${this.selectionStart}, selectionEnd: ${this.selectionEnd}]`}static readFromTextArea(i,e){let t=i.getValue(),o=i.getSelectionStart(),n=i.getSelectionEnd(),r;if(e){let s=t.substring(0,o),l=e.value.substring(0,e.selectionStart);s===l&&(r=e.newlineCountBeforeSelection)}return new a(t,o,n,null,r)}collapseSelection(){return this.selectionStart===this.value.length?this:new a(this.value,this.value.length,this.value.length,null,void 0)}isWrittenToTextArea(i,e){let t=this.value===i.getValue();return e?this.selectionStart===i.getSelectionStart()&&this.selectionEnd===i.getSelectionEnd()&&t:t}writeToTextArea(i,e,t){JT&&console.log(`writeToTextArea ${i}: ${this.toString()}`),e.setValue(i,this.value),t&&e.setSelectionRange(i,this.selectionStart,this.selectionEnd)}deduceEditorPosition(i){if(i<=this.selectionStart){let o=this.value.substring(i,this.selectionStart);return this._finishDeduceEditorPosition(this.selection?.getStartPosition()??null,o,-1)}if(i>=this.selectionEnd){let o=this.value.substring(this.selectionEnd,i);return this._finishDeduceEditorPosition(this.selection?.getEndPosition()??null,o,1)}let e=this.value.substring(this.selectionStart,i);if(e.indexOf("\u2026")===-1)return this._finishDeduceEditorPosition(this.selection?.getStartPosition()??null,e,1);let t=this.value.substring(i,this.selectionEnd);return this._finishDeduceEditorPosition(this.selection?.getEndPosition()??null,t,-1)}_finishDeduceEditorPosition(i,e,t){let o=0,n=-1;for(;(n=e.indexOf(`
`,n+1))!==-1;)o++;return[i,t*e.length,o]}static deduceInput(i,e,t){if(!i)return{text:"",replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:0};JT&&(console.log("------------------------deduceInput"),console.log(`PREVIOUS STATE: ${i.toString()}`),console.log(`CURRENT STATE: ${e.toString()}`));let o=Math.min(Ng(i.value,e.value),i.selectionStart,e.selectionStart),n=Math.min(zw(i.value,e.value),i.value.length-i.selectionEnd,e.value.length-e.selectionEnd),r=i.value.substring(o,i.value.length-n),s=e.value.substring(o,e.value.length-n),l=i.selectionStart-o,c=i.selectionEnd-o,u=e.selectionStart-o,p=e.selectionEnd-o;if(JT&&(console.log(`AFTER DIFFING PREVIOUS STATE: <${r}>, selectionStart: ${l}, selectionEnd: ${c}`),console.log(`AFTER DIFFING CURRENT STATE: <${s}>, selectionStart: ${u}, selectionEnd: ${p}`)),u===p){let g=i.selectionStart-o;return JT&&console.log(`REMOVE PREVIOUS: ${g} chars`),{text:s,replacePrevCharCnt:g,replaceNextCharCnt:0,positionDelta:0}}let h=c-l;return{text:s,replacePrevCharCnt:h,replaceNextCharCnt:0,positionDelta:0}}static deduceAndroidCompositionInput(i,e){if(!i)return{text:"",replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:0};if(JT&&(console.log("------------------------deduceAndroidCompositionInput"),console.log(`PREVIOUS STATE: ${i.toString()}`),console.log(`CURRENT STATE: ${e.toString()}`)),i.value===e.value)return{text:"",replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:e.selectionEnd-i.selectionEnd};let t=Math.min(Ng(i.value,e.value),i.selectionEnd),o=Math.min(zw(i.value,e.value),i.value.length-i.selectionEnd),n=i.value.substring(t,i.value.length-o),r=e.value.substring(t,e.value.length-o),s=i.selectionStart-t,l=i.selectionEnd-t,c=e.selectionStart-t,u=e.selectionEnd-t;return JT&&(console.log(`AFTER DIFFING PREVIOUS STATE: <${n}>, selectionStart: ${s}, selectionEnd: ${l}`),console.log(`AFTER DIFFING CURRENT STATE: <${r}>, selectionStart: ${c}, selectionEnd: ${u}`)),{text:r,replacePrevCharCnt:l,replaceNextCharCnt:n.length-l,positionDelta:u-r.length}}static fromScreenReaderContentState(i){let e,t;switch(i.selection.getDirection()){case 0:e=i.selectionStart,t=i.selectionEnd;break;case 1:e=i.selectionEnd,t=i.selectionStart;break}return new a(i.value,e,t,i.selection,i.newlineCountBeforeSelection)}};var nft;(i=>i.Tap="-monaco-textarea-synthetic-tap")(nft||={});var yJt=class{constructor(){this._lastTypeTextLength=0}handleCompositionUpdate(i){i=i||"";let e={text:i,replacePrevCharCnt:this._lastTypeTextLength,replaceNextCharCnt:0,positionDelta:0};return this._lastTypeTextLength=i.length,e}},LIe=class extends C{constructor(e,t,o,n,r,s){super();this._host=e;this._textArea=t;this._OS=o;this._browser=n;this._accessibilityService=r;this._logService=s;this._onFocus=this._register(new E);this.onFocus=this._onFocus.event;this._onBlur=this._register(new E);this.onBlur=this._onBlur.event;this._onKeyDown=this._register(new E);this.onKeyDown=this._onKeyDown.event;this._onKeyUp=this._register(new E);this.onKeyUp=this._onKeyUp.event;this._onCut=this._register(new E);this.onCut=this._onCut.event;this._onPaste=this._register(new E);this.onPaste=this._onPaste.event;this._onWillCopy=this._register(new E);this.onWillCopy=this._onWillCopy.event;this._onWillCut=this._register(new E);this.onWillCut=this._onWillCut.event;this._onWillPaste=this._register(new E);this.onWillPaste=this._onWillPaste.event;this._onType=this._register(new E);this.onType=this._onType.event;this._onCompositionStart=this._register(new E);this.onCompositionStart=this._onCompositionStart.event;this._onCompositionUpdate=this._register(new E);this.onCompositionUpdate=this._onCompositionUpdate.event;this._onCompositionEnd=this._register(new E);this.onCompositionEnd=this._onCompositionEnd.event;this._onSelectionChangeRequest=this._register(new E);this.onSelectionChangeRequest=this._onSelectionChangeRequest.event;this._asyncFocusGainWriteScreenReaderContent=this._register(new me);this._asyncTriggerCut=this._register(new Dt(()=>this._onCut.fire(),0)),this._textAreaState=NS.EMPTY,this._selectionChangeListener=null,this._accessibilityService.isScreenReaderOptimized()&&this.writeNativeTextAreaContent("ctor"),this._register(H.runAndSubscribe(this._accessibilityService.onDidChangeScreenReaderOptimized,()=>{this._accessibilityService.isScreenReaderOptimized()&&!this._asyncFocusGainWriteScreenReaderContent.value?this._asyncFocusGainWriteScreenReaderContent.value=new Dt(()=>this.writeNativeTextAreaContent("asyncFocusGain"),0):this._asyncFocusGainWriteScreenReaderContent.clear()})),this._hasFocus=!1,this._currentComposition=null;let l=null;this._register(this._textArea.onKeyDown(c=>{let u=new Ii(c);(u.keyCode===114||this._currentComposition&&u.keyCode===1)&&u.stopPropagation(),u.equals(9)&&u.preventDefault(),l=u,this._onKeyDown.fire(u)})),this._register(this._textArea.onKeyUp(c=>{let u=new Ii(c);this._onKeyUp.fire(u)})),this._register(this._textArea.onCompositionStart(c=>{JT&&console.log("[compositionstart]",c);let u=new yJt;if(this._currentComposition){this._currentComposition=u;return}if(this._currentComposition=u,this._OS===2&&l&&l.equals(114)&&this._textAreaState.selectionStart===this._textAreaState.selectionEnd&&this._textAreaState.selectionStart>0&&this._textAreaState.value.substr(this._textAreaState.selectionStart-1,1)===c.data&&(l.code==="ArrowRight"||l.code==="ArrowLeft")){JT&&console.log("[compositionstart] Handling long press case on macOS + arrow key",c),u.handleCompositionUpdate("x"),this._onCompositionStart.fire({data:c.data});return}if(this._browser.isAndroid){this._onCompositionStart.fire({data:c.data});return}this._onCompositionStart.fire({data:c.data})})),this._register(this._textArea.onCompositionUpdate(c=>{JT&&console.log("[compositionupdate]",c);let u=this._currentComposition;if(!u)return;if(this._browser.isAndroid){let h=NS.readFromTextArea(this._textArea,this._textAreaState),g=NS.deduceAndroidCompositionInput(this._textAreaState,h);this._textAreaState=h,this._onType.fire(g),this._onCompositionUpdate.fire(c);return}let p=u.handleCompositionUpdate(c.data);this._textAreaState=NS.readFromTextArea(this._textArea,this._textAreaState),this._onType.fire(p),this._onCompositionUpdate.fire(c)})),this._register(this._textArea.onCompositionEnd(c=>{JT&&console.log("[compositionend]",c);let u=this._currentComposition;if(!u)return;if(this._currentComposition=null,this._browser.isAndroid){let h=NS.readFromTextArea(this._textArea,this._textAreaState),g=NS.deduceAndroidCompositionInput(this._textAreaState,h);this._textAreaState=h,this._onType.fire(g),this._onCompositionEnd.fire();return}let p=u.handleCompositionUpdate(c.data);this._textAreaState=NS.readFromTextArea(this._textArea,this._textAreaState),this._onType.fire(p),this._onCompositionEnd.fire()})),this._register(this._textArea.onInput(c=>{if(JT&&console.log("[input]",c),this._textArea.setIgnoreSelectionChangeTime("received input event"),this._currentComposition)return;let u=NS.readFromTextArea(this._textArea,this._textAreaState),p=NS.deduceInput(this._textAreaState,u,this._OS===2);p.replacePrevCharCnt===0&&p.text.length===1&&(Ru(p.text.charCodeAt(0))||p.text.charCodeAt(0)===127)||(this._textAreaState=u,(p.text!==""||p.replacePrevCharCnt!==0||p.replaceNextCharCnt!==0||p.positionDelta!==0)&&(c.inputType==="insertFromPaste"?this._onPaste.fire({text:p.text,metadata:S9.INSTANCE.get(p.text)}):this._onType.fire(p)))})),this._register(this._textArea.onCut(c=>{this._logService.trace("TextAreaInput#onCut",c);let u=DIe(c,!0,this._host.context,this._logService,this._browser.isFirefox);this._onWillCut.fire(u),!u.isHandled&&(this._textArea.setIgnoreSelectionChangeTime("received cut event"),u.ensureClipboardGetsEditorData(),this._asyncTriggerCut.schedule())})),this._register(this._textArea.onCopy(c=>{this._logService.trace("TextAreaInput#onCopy",c),zU.electronBugWorkaroundCopyEventHasFired=!0;let u=DIe(c,!1,this._host.context,this._logService,this._browser.isFirefox);this._onWillCopy.fire(u),!u.isHandled&&u.ensureClipboardGetsEditorData()})),this._register(this._textArea.onPaste(c=>{this._logService.trace("TextAreaInput#onPaste",c);let u=ift(c);this._onWillPaste.fire(u),!u.isHandled&&(this._textArea.setIgnoreSelectionChangeTime("received paste event"),c.preventDefault(),this._logService.trace("TextAreaInput#onPaste with id : ",u.metadata?.id," with text.length: ",u.text.length),u.text&&(this._logService.trace("TextAreaInput#onPaste (before onPaste)"),this._onPaste.fire({text:u.text,metadata:u.metadata})))})),this._register(this._textArea.onFocus(()=>{let c=this._hasFocus;this._setHasFocus(!0),this._accessibilityService.isScreenReaderOptimized()&&this._browser.isSafari&&!c&&this._hasFocus&&(this._asyncFocusGainWriteScreenReaderContent.value||(this._asyncFocusGainWriteScreenReaderContent.value=new Dt(()=>this.writeNativeTextAreaContent("asyncFocusGain"),0)),this._asyncFocusGainWriteScreenReaderContent.value.schedule())})),this._register(this._textArea.onBlur(()=>{this._currentComposition&&(this._currentComposition=null,this.writeNativeTextAreaContent("blurWithoutCompositionEnd"),this._onCompositionEnd.fire()),this._setHasFocus(!1)})),this._register(this._textArea.onSyntheticTap(()=>{this._browser.isAndroid&&this._currentComposition&&(this._currentComposition=null,this.writeNativeTextAreaContent("tapWithoutCompositionEnd"),this._onCompositionEnd.fire())}))}get textAreaState(){return this._textAreaState}_initializeFromTest(){this._hasFocus=!0,this._textAreaState=NS.readFromTextArea(this._textArea,null)}_installSelectionChangeListener(){let e=0;return j(this._textArea.ownerDocument,"selectionchange",t=>{if(vx.onSelectionChange(),!this._hasFocus||this._currentComposition||!this._browser.isChrome)return;let o=Date.now(),n=o-e;if(e=o,n<5)return;let r=o-this._textArea.getIgnoreSelectionChangeTime();if(this._textArea.resetSelectionChangeTime(),r<100||!this._textAreaState.selection)return;let s=this._textArea.getValue();if(this._textAreaState.value!==s)return;let l=this._textArea.getSelectionStart(),c=this._textArea.getSelectionEnd();if(this._textAreaState.selectionStart===l&&this._textAreaState.selectionEnd===c)return;let u=this._textAreaState.deduceEditorPosition(l),p=this._host.deduceModelPosition(u[0],u[1],u[2]),h=this._textAreaState.deduceEditorPosition(c),g=this._host.deduceModelPosition(h[0],h[1],h[2]),f=new Yt(p.lineNumber,p.column,g.lineNumber,g.column);this._onSelectionChangeRequest.fire(f)})}dispose(){super.dispose(),this._selectionChangeListener&&(this._selectionChangeListener.dispose(),this._selectionChangeListener=null)}focusTextArea(){this._setHasFocus(!0),this.refreshFocusState()}isFocused(){return this._hasFocus}refreshFocusState(){this._setHasFocus(this._textArea.hasFocus())}_setHasFocus(e){this._hasFocus!==e&&(this._hasFocus=e,this._selectionChangeListener&&(this._selectionChangeListener.dispose(),this._selectionChangeListener=null),this._hasFocus&&(this._selectionChangeListener=this._installSelectionChangeListener()),this._hasFocus&&this.writeNativeTextAreaContent("focusgain"),this._hasFocus?this._onFocus.fire():this._onBlur.fire())}_setAndWriteTextAreaState(e,t){this._hasFocus||(t=t.collapseSelection()),t.isWrittenToTextArea(this._textArea,this._hasFocus)||this._logService.trace(`writeTextAreaState(reason: ${e})`),t.writeToTextArea(e,this._textArea,this._hasFocus),this._textAreaState=t}writeNativeTextAreaContent(e){!this._accessibilityService.isScreenReaderOptimized()&&e==="render"||this._currentComposition||this._setAndWriteTextAreaState(e,this._host.getScreenReaderContent())}};LIe=I([m(4,Bi),m(5,ne)],LIe);var oft=class extends C{constructor(e){super();this._actual=e;this._onSyntheticTap=this._register(new E);this.onSyntheticTap=this._onSyntheticTap.event;this._ignoreSelectionChangeTime=0,this.onKeyDown=this._register(new On(this._actual,"keydown")).event,this.onKeyPress=this._register(new On(this._actual,"keypress")).event,this.onKeyUp=this._register(new On(this._actual,"keyup")).event,this.onCompositionStart=this._register(new On(this._actual,"compositionstart")).event,this.onCompositionUpdate=this._register(new On(this._actual,"compositionupdate")).event,this.onCompositionEnd=this._register(new On(this._actual,"compositionend")).event,this.onBeforeInput=this._register(new On(this._actual,"beforeinput")).event,this.onInput=this._register(new On(this._actual,"input")).event,this.onCut=this._register(new On(this._actual,"cut")).event,this.onCopy=this._register(new On(this._actual,"copy")).event,this.onPaste=this._register(new On(this._actual,"paste")).event,this.onFocus=this._register(new On(this._actual,"focus")).event,this.onBlur=this._register(new On(this._actual,"blur")).event,this._register(this.onKeyDown(()=>vx.onKeyDown())),this._register(this.onBeforeInput(()=>vx.onBeforeInput())),this._register(this.onInput(()=>vx.onInput())),this._register(this.onKeyUp(()=>vx.onKeyUp())),this._register(j(this._actual,nft.Tap,()=>this._onSyntheticTap.fire()))}get ownerDocument(){return this._actual.ownerDocument}hasFocus(){let e=_M(this._actual);return e?e.activeElement===this._actual:this._actual.isConnected?Pn()===this._actual:!1}setIgnoreSelectionChangeTime(e){this._ignoreSelectionChangeTime=Date.now()}getIgnoreSelectionChangeTime(){return this._ignoreSelectionChangeTime}resetSelectionChangeTime(){this._ignoreSelectionChangeTime=0}getValue(){return this._actual.value}setValue(e,t){let o=this._actual;o.value!==t&&(this.setIgnoreSelectionChangeTime("setValue"),o.value=t)}getSelectionStart(){return this._actual.selectionDirection==="backward"?this._actual.selectionEnd:this._actual.selectionStart}getSelectionEnd(){return this._actual.selectionDirection==="backward"?this._actual.selectionStart:this._actual.selectionEnd}setSelectionRange(e,t,o){let n=this._actual,r=null,s=_M(n);s?r=s.activeElement:r=Pn();let l=Me(r),c=r===n,u=n.selectionStart,p=n.selectionEnd;if(c&&u===t&&p===o){yc&&l.parent!==l&&n.focus();return}if(c){this.setIgnoreSelectionChangeTime("setSelectionRange"),n.setSelectionRange(t,o),yc&&l.parent!==l&&n.focus();return}try{let h=Dzi(n);this.setIgnoreSelectionChangeTime("setSelectionRange"),n.focus(),n.setSelectionRange(t,o),Lzi(n,h)}catch{}}};var wJt=class extends SIe{constructor(i,e,t){super(i,e,t),this._register(ws.addTarget(this.viewHelper.linesContentDomNode)),this._register(j(this.viewHelper.linesContentDomNode,Gn.Tap,n=>this.onTap(n))),this._register(j(this.viewHelper.linesContentDomNode,Gn.Change,n=>this.onChange(n))),this._register(j(this.viewHelper.linesContentDomNode,Gn.Contextmenu,n=>this._onContextMenu(new mL(n,!1,this.viewHelper.viewDomNode),!1))),this._lastPointerType="mouse",this._register(j(this.viewHelper.linesContentDomNode,"pointerdown",n=>{let r=n.pointerType;if(r==="mouse"){this._lastPointerType="mouse";return}else r==="touch"?this._lastPointerType="touch":this._lastPointerType="pen"}));let o=new wgt(this.viewHelper.viewDomNode);this._register(o.onPointerMove(this.viewHelper.viewDomNode,n=>this._onMouseMove(n))),this._register(o.onPointerUp(this.viewHelper.viewDomNode,n=>this._onMouseUp(n))),this._register(o.onPointerLeave(this.viewHelper.viewDomNode,n=>this._onMouseLeave(n))),this._register(o.onPointerDown(this.viewHelper.viewDomNode,(n,r)=>this._onMouseDown(n,r)))}onTap(i){!i.initialTarget||!this.viewHelper.linesContentDomNode.contains(i.initialTarget)||(i.preventDefault(),this.viewHelper.focusTextArea(),this._dispatchGesture(i,!1))}onChange(i){this._lastPointerType==="touch"&&this._context.viewModel.viewLayout.deltaScrollNow(-i.translationX,-i.translationY),this._lastPointerType==="pen"&&this._dispatchGesture(i,!0)}_dispatchGesture(i,e){let t=this._createMouseTarget(new mL(i,!1,this.viewHelper.viewDomNode),!1);t.position&&this.viewController.dispatchMouse({position:t.position,mouseColumn:t.position.column,startedOnLineNumbers:!1,revealType:1,mouseDownCount:i.tapCount,inSelectionMode:e,altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,leftButton:!1,middleButton:!1,onInjectedText:t.type===6&&t.detail.injectedText!==null})}_onMouseDown(i,e){i.browserEvent.pointerType!=="touch"&&super._onMouseDown(i,e)}},CJt=class extends SIe{constructor(i,e,t){super(i,e,t),this._register(ws.addTarget(this.viewHelper.linesContentDomNode)),this._register(j(this.viewHelper.linesContentDomNode,Gn.Tap,o=>this.onTap(o))),this._register(j(this.viewHelper.linesContentDomNode,Gn.Change,o=>this.onChange(o))),this._register(j(this.viewHelper.linesContentDomNode,Gn.Contextmenu,o=>this._onContextMenu(new mL(o,!1,this.viewHelper.viewDomNode),!1)))}onTap(i){i.preventDefault(),this.viewHelper.focusTextArea();let e=this._createMouseTarget(new mL(i,!1,this.viewHelper.viewDomNode),!1);if(e.position){let t=document.createEvent("CustomEvent");t.initEvent(nft.Tap,!1,!0),this.viewHelper.dispatchTextAreaEvent(t),this.viewController.moveTo(e.position,1)}}onChange(i){this._context.viewModel.viewLayout.deltaScrollNow(-i.translationX,-i.translationY)}},rft=class extends C{constructor(i,e,t){super(),(Nc||Jut&&sbe)&&og.pointerEvents?this.handler=this._register(new wJt(i,e,t)):It.TouchEvent?this.handler=this._register(new CJt(i,e,t)):this.handler=this._register(new SIe(i,e,t))}getTargetAtClientPoint(i,e){return this.handler.getTargetAtClientPoint(i,e)}};var sft=class a{constructor(i,e,t,o){this.configuration=i,this.viewModel=e,this.userInputEvents=t,this.commandDelegate=o}paste(i,e,t,o){this.commandDelegate.paste(i,e,t,o)}type(i){this.commandDelegate.type(i)}compositionType(i,e,t,o){this.commandDelegate.compositionType(i,e,t,o)}compositionStart(){this.commandDelegate.startComposition()}compositionEnd(){this.commandDelegate.endComposition()}cut(){this.commandDelegate.cut()}setSelection(i){Vg.SetSelection.runCoreEditorCommand(this.viewModel,{source:"keyboard",selection:i})}_validateViewColumn(i){let e=this.viewModel.getLineMinColumn(i.lineNumber);return i.column<e?new Ie(i.lineNumber,e):i}_hasMulticursorModifier(i){switch(this.configuration.options.get(86)){case"altKey":return i.altKey;case"ctrlKey":return i.ctrlKey;case"metaKey":return i.metaKey;default:return!1}}_hasNonMulticursorModifier(i){switch(this.configuration.options.get(86)){case"altKey":return i.ctrlKey||i.metaKey;case"ctrlKey":return i.altKey||i.metaKey;case"metaKey":return i.ctrlKey||i.altKey;default:return!1}}static _trySelectBracketContent(i,e){if(e.column>1){let t=i.bracketPairs.matchBracket(e.with(void 0,e.column-1));if(t&&t[0].getEndPosition().equals(e))return Yt.fromPositions(t[0].getEndPosition(),t[1].getStartPosition())}if(e.column<=i.getLineMaxColumn(e.lineNumber)){let t=i.bracketPairs.matchBracket(e);if(t&&t[1].getStartPosition().equals(e))return Yt.fromPositions(t[0].getEndPosition(),t[1].getStartPosition())}}static _trySelectStringContent(i,e){let{lineNumber:t,column:o}=e,{tokenization:n}=i;if(!n.hasAccurateTokensForLine(t))if(n.isCheapToTokenize(t))n.forceTokenization(t);else return;let r=n.getLineTokens(t),s=r.findTokenIndexAtOffset(o-1),l=s;for(;s>0&&r.getStandardTokenType(s-1)===2;)s--;for(;l+1<r.getCount()&&r.getStandardTokenType(l+1)===2;)l++;let c=r.getStartOffset(s),u=r.getEndOffset(l);if(o!==c+2&&o!==u)return;let p=i.getLineContent(t),h=p.charAt(c);if(h!=='"'&&h!=="'"&&h!=="`"||p.charAt(u-1)!==h)return;let g=p.substring(c+1,u-1);if(!yM(g))return new Yt(t,c+2,t,u)}dispatchMouse(i){let e=this.configuration.options,t=Wn&&e.get(121),o=e.get(28),n=e.get(171);if(i.middleButton&&!t)n||this._columnSelect(i.position,i.mouseColumn,i.inSelectionMode);else if(i.startedOnLineNumbers)this._hasMulticursorModifier(i)?i.inSelectionMode?this._lastCursorLineSelect(i.position,i.revealType):this._createCursor(i.position,!0):i.inSelectionMode?this._lineSelectDrag(i.position,i.revealType):this._lineSelect(i.position,i.revealType);else if(i.mouseDownCount>=4)this._selectAll();else if(i.mouseDownCount===3)this._hasMulticursorModifier(i)?i.inSelectionMode?this._lastCursorLineSelectDrag(i.position,i.revealType):this._lastCursorLineSelect(i.position,i.revealType):i.inSelectionMode?this._lineSelectDrag(i.position,i.revealType):this._lineSelect(i.position,i.revealType);else if(i.mouseDownCount===2){if(!i.onInjectedText)if(this._hasMulticursorModifier(i))this._lastCursorWordSelect(i.position,i.revealType);else if(i.inSelectionMode)this._wordSelectDrag(i.position,i.revealType);else{let r;if(e.get(173)){let s=this.viewModel.model,l=this._convertViewToModelPosition(i.position);r=a._trySelectBracketContent(s,l)||a._trySelectStringContent(s,l)}r?this._select(r):this._wordSelect(i.position,i.revealType)}}else this._hasMulticursorModifier(i)?this._hasNonMulticursorModifier(i)||(i.shiftKey?this._columnSelect(i.position,i.mouseColumn,!0):i.inSelectionMode?this._lastCursorMoveToSelect(i.position,i.revealType):this._createCursor(i.position,!1)):i.inSelectionMode?i.altKey?this._columnSelect(i.position,i.mouseColumn,!0):o?this._columnSelect(i.position,i.mouseColumn,!0):this._moveToSelect(i.position,i.revealType):this.moveTo(i.position,i.revealType)}_usualArgs(i,e){return i=this._validateViewColumn(i),{source:"mouse",position:this._convertViewToModelPosition(i),viewPosition:i,revealType:e}}moveTo(i,e){Vg.MoveTo.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_moveToSelect(i,e){Vg.MoveToSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_columnSelect(i,e,t){i=this._validateViewColumn(i),Vg.ColumnSelect.runCoreEditorCommand(this.viewModel,{source:"mouse",position:this._convertViewToModelPosition(i),viewPosition:i,mouseColumn:e,doColumnSelect:t})}_createCursor(i,e){i=this._validateViewColumn(i),Vg.CreateCursor.runCoreEditorCommand(this.viewModel,{source:"mouse",position:this._convertViewToModelPosition(i),viewPosition:i,wholeLine:e})}_lastCursorMoveToSelect(i,e){Vg.LastCursorMoveToSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_wordSelect(i,e){Vg.WordSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_wordSelectDrag(i,e){Vg.WordSelectDrag.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_lastCursorWordSelect(i,e){Vg.LastCursorWordSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_lineSelect(i,e){Vg.LineSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_lineSelectDrag(i,e){Vg.LineSelectDrag.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_lastCursorLineSelect(i,e){Vg.LastCursorLineSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_lastCursorLineSelectDrag(i,e){Vg.LastCursorLineSelectDrag.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_select(i){Vg.SetSelection.runCoreEditorCommand(this.viewModel,{source:"mouse",selection:i})}_selectAll(){Vg.SelectAll.runCoreEditorCommand(this.viewModel,{source:"mouse"})}_convertViewToModelPosition(i){return this.viewModel.coordinatesConverter.convertViewPositionToModelPosition(i)}emitKeyDown(i){this.userInputEvents.emitKeyDown(i)}emitKeyUp(i){this.userInputEvents.emitKeyUp(i)}emitContextMenu(i){this.userInputEvents.emitContextMenu(i)}emitMouseMove(i){this.userInputEvents.emitMouseMove(i)}emitMouseLeave(i){this.userInputEvents.emitMouseLeave(i)}emitMouseUp(i){this.userInputEvents.emitMouseUp(i)}emitMouseDown(i){this.userInputEvents.emitMouseDown(i)}emitMouseDrag(i){this.userInputEvents.emitMouseDrag(i)}emitMouseDrop(i){this.userInputEvents.emitMouseDrop(i)}emitMouseDropCanceled(){this.userInputEvents.emitMouseDropCanceled()}emitMouseWheel(i){this.userInputEvents.emitMouseWheel(i)}};function Kg(a,i){let e=QUi();if(e?.createTrustedTypesPolicy)try{return e.createTrustedTypesPolicy(a,i)}catch(t){mt(t);return}try{return globalThis.trustedTypes?.createPolicy(a,i)}catch(t){mt(t);return}}var oqe=class{constructor(i){this._lineFactory=i;this._set(1,[])}flush(){this._set(1,[])}_set(i,e){this._lines=e,this._rendLineNumberStart=i}_get(){return{rendLineNumberStart:this._rendLineNumberStart,lines:this._lines}}getStartLineNumber(){return this._rendLineNumberStart}getEndLineNumber(){return this._rendLineNumberStart+this._lines.length-1}getCount(){return this._lines.length}getLine(i){let e=i-this._rendLineNumberStart;if(e<0||e>=this._lines.length)throw new ni("Illegal value for lineNumber");return this._lines[e]}onLinesDeleted(i,e){if(this.getCount()===0)return null;let t=this.getStartLineNumber(),o=this.getEndLineNumber();if(e<t){let l=e-i+1;return this._rendLineNumberStart-=l,null}if(i>o)return null;let n=0,r=0;for(let l=t;l<=o;l++){let c=l-this._rendLineNumberStart;i<=l&&l<=e&&(r===0?(n=c,r=1):r++)}if(i<t){let l=0;e<t?l=e-i+1:l=t-i,this._rendLineNumberStart-=l}return this._lines.splice(n,r)}onLinesChanged(i,e){let t=i+e-1;if(this.getCount()===0)return!1;let o=this.getStartLineNumber(),n=this.getEndLineNumber(),r=!1;for(let s=i;s<=t;s++)s>=o&&s<=n&&(this._lines[s-this._rendLineNumberStart].onContentChanged(),r=!0);return r}onLinesInserted(i,e){if(this.getCount()===0)return null;let t=e-i+1,o=this.getStartLineNumber(),n=this.getEndLineNumber();if(i<=o)return this._rendLineNumberStart+=t,null;if(i>n)return null;if(t+i>n)return this._lines.splice(i-this._rendLineNumberStart,n-i+1);let r=[];for(let p=0;p<t;p++)r[p]=this._lineFactory.createLine();let s=i-this._rendLineNumberStart,l=this._lines.slice(0,s),c=this._lines.slice(s,this._lines.length-t),u=this._lines.slice(this._lines.length-t,this._lines.length);return this._lines=l.concat(r).concat(c),u}onTokensChanged(i){if(this.getCount()===0)return!1;let e=this.getStartLineNumber(),t=this.getEndLineNumber(),o=!1;for(let n=0,r=i.length;n<r;n++){let s=i[n];if(s.toLineNumber<e||s.fromLineNumber>t)continue;let l=Math.max(e,s.fromLineNumber),c=Math.min(t,s.toLineNumber);for(let u=l;u<=c;u++){let p=u-this._rendLineNumberStart;this._lines[p].onTokensChanged(),o=!0}}return o}},RIe=class{constructor(i,e){this._viewContext=i;this._lineFactory=e;this.domNode=this._createDomNode(),this._linesCollection=new oqe(this._lineFactory)}_createDomNode(){let i=or(document.createElement("div"));return i.setClassName("view-layer"),i.setPosition("absolute"),i.domNode.setAttribute("role","presentation"),i.domNode.setAttribute("aria-hidden","true"),i}onConfigurationChanged(i){return!!i.hasChanged(165)}onFlushed(i,e){if(e){let t=this._linesCollection.getStartLineNumber(),o=this._linesCollection.getEndLineNumber();for(let n=t;n<=o;n++)this._linesCollection.getLine(n).getDomNode()?.remove()}return this._linesCollection.flush(),!0}onLinesChanged(i){return this._linesCollection.onLinesChanged(i.fromLineNumber,i.count)}onLinesDeleted(i){let e=this._linesCollection.onLinesDeleted(i.fromLineNumber,i.toLineNumber);if(e)for(let t=0,o=e.length;t<o;t++)e[t].getDomNode()?.remove();return!0}onLinesInserted(i){let e=this._linesCollection.onLinesInserted(i.fromLineNumber,i.toLineNumber);if(e)for(let t=0,o=e.length;t<o;t++)e[t].getDomNode()?.remove();return!0}onScrollChanged(i){return i.scrollTopChanged}onTokensChanged(i){return this._linesCollection.onTokensChanged(i.ranges)}onZonesChanged(i){return!0}getStartLineNumber(){return this._linesCollection.getStartLineNumber()}getEndLineNumber(){return this._linesCollection.getEndLineNumber()}getVisibleLine(i){return this._linesCollection.getLine(i)}renderLines(i){let e=this._linesCollection._get(),t=new xJt(this.domNode.domNode,this._lineFactory,i,this._viewContext),o={rendLineNumberStart:e.rendLineNumberStart,lines:e.lines,linesLength:e.lines.length},n=t.render(o,i.startLineNumber,i.endLineNumber,i.relativeVerticalOffset);this._linesCollection._set(n.rendLineNumberStart,n.lines)}},xJt=class a{constructor(i,e,t,o){this._domNode=i;this._lineFactory=e;this._viewportData=t;this._viewContext=o}static{this._ttPolicy=Kg("editorViewLayer",{createHTML:i=>i})}render(i,e,t,o){let n={rendLineNumberStart:i.rendLineNumberStart,lines:i.lines.slice(0),linesLength:i.linesLength};if(n.rendLineNumberStart+n.linesLength-1<e||t<n.rendLineNumberStart){n.rendLineNumberStart=e,n.linesLength=t-e+1,n.lines=[];for(let r=e;r<=t;r++)n.lines[r-e]=this._lineFactory.createLine();return this._finishRendering(n,!0,o),n}if(this._renderUntouchedLines(n,Math.max(e-n.rendLineNumberStart,0),Math.min(t-n.rendLineNumberStart,n.linesLength-1),o,e),n.rendLineNumberStart>e){let r=e,s=Math.min(t,n.rendLineNumberStart-1);r<=s&&(this._insertLinesBefore(n,r,s,o,e),n.linesLength+=s-r+1)}else if(n.rendLineNumberStart<e){let r=Math.min(n.linesLength,e-n.rendLineNumberStart);r>0&&(this._removeLinesBefore(n,r),n.linesLength-=r)}if(n.rendLineNumberStart=e,n.rendLineNumberStart+n.linesLength-1<t){let r=n.rendLineNumberStart+n.linesLength,s=t;r<=s&&(this._insertLinesAfter(n,r,s,o,e),n.linesLength+=s-r+1)}else if(n.rendLineNumberStart+n.linesLength-1>t){let r=Math.max(0,t-n.rendLineNumberStart+1),l=n.linesLength-1-r+1;l>0&&(this._removeLinesAfter(n,l),n.linesLength-=l)}return this._finishRendering(n,!1,o),n}_renderUntouchedLines(i,e,t,o,n){let r=i.rendLineNumberStart,s=i.lines;for(let l=e;l<=t;l++){let c=r+l;s[l].layoutLine(c,o[c-n],this._lineHeightForLineNumber(c))}}_insertLinesBefore(i,e,t,o,n){let r=[],s=0;for(let l=e;l<=t;l++)r[s++]=this._lineFactory.createLine();i.lines=r.concat(i.lines)}_removeLinesBefore(i,e){for(let t=0;t<e;t++)i.lines[t].getDomNode()?.remove();i.lines.splice(0,e)}_insertLinesAfter(i,e,t,o,n){let r=[],s=0;for(let l=e;l<=t;l++)r[s++]=this._lineFactory.createLine();i.lines=i.lines.concat(r)}_removeLinesAfter(i,e){let t=i.linesLength-e;for(let o=0;o<e;o++)i.lines[t+o].getDomNode()?.remove();i.lines.splice(t,e)}_finishRenderingNewLines(i,e,t,o){a._ttPolicy&&(t=a._ttPolicy.createHTML(t));let n=this._domNode.lastChild;e||!n?this._domNode.innerHTML=t:n.insertAdjacentHTML("afterend",t);let r=this._domNode.lastChild;for(let s=i.linesLength-1;s>=0;s--){let l=i.lines[s];o[s]&&(l.setDomNode(r),r=r.previousSibling)}}_finishRenderingInvalidLines(i,e,t){let o=document.createElement("div");a._ttPolicy&&(e=a._ttPolicy.createHTML(e)),o.innerHTML=e;for(let n=0;n<i.linesLength;n++){let r=i.lines[n];if(t[n]){let s=o.firstChild;r.getDomNode().replaceWith(s),r.setDomNode(s)}}}static{this._sb=new ES(1e5)}_finishRendering(i,e,t){let o=a._sb,n=i.linesLength,r=i.lines,s=i.rendLineNumberStart,l=[];{o.reset();let c=!1;for(let u=0;u<n;u++){let p=r[u];if(l[u]=!1,p.getDomNode())continue;let g=u+s;p.renderLine(g,t[u],this._lineHeightForLineNumber(g),this._viewportData,o)&&(l[u]=!0,c=!0)}c&&this._finishRenderingNewLines(i,e,o.build(),l)}{o.reset();let c=!1,u=[];for(let p=0;p<n;p++){let h=r[p];if(u[p]=!1,l[p])continue;let g=p+s;h.renderLine(g,t[p],this._lineHeightForLineNumber(g),this._viewportData,o)&&(u[p]=!0,c=!0)}c&&this._finishRenderingInvalidLines(i,o.build(),u)}}_lineHeightForLineNumber(i){return this._viewContext.viewLayout.getLineHeightForLineNumber(i)}};var aft=class extends mu{constructor(e){super(e);this._dynamicOverlays=[];this._isFocused=!1;this._visibleLines=new RIe(this._context,{createLine:()=>new kJt(this._dynamicOverlays)}),this.domNode=this._visibleLines.domNode;let o=this._context.configuration.options.get(59);Pd(this.domNode,o),this.domNode.setClassName("view-overlays")}shouldRender(){if(super.shouldRender())return!0;for(let e=0,t=this._dynamicOverlays.length;e<t;e++)if(this._dynamicOverlays[e].shouldRender())return!0;return!1}dispose(){super.dispose();for(let e=0,t=this._dynamicOverlays.length;e<t;e++)this._dynamicOverlays[e].dispose();this._dynamicOverlays=[]}getDomNode(){return this.domNode}addDynamicOverlay(e){this._dynamicOverlays.push(e)}onConfigurationChanged(e){this._visibleLines.onConfigurationChanged(e);let o=this._context.configuration.options.get(59);return Pd(this.domNode,o),!0}onFlushed(e){return this._visibleLines.onFlushed(e)}onFocusChanged(e){return this._isFocused=e.isFocused,!0}onLinesChanged(e){return this._visibleLines.onLinesChanged(e)}onLinesDeleted(e){return this._visibleLines.onLinesDeleted(e)}onLinesInserted(e){return this._visibleLines.onLinesInserted(e)}onScrollChanged(e){return this._visibleLines.onScrollChanged(e)||!0}onTokensChanged(e){return this._visibleLines.onTokensChanged(e)}onZonesChanged(e){return this._visibleLines.onZonesChanged(e)}prepareRender(e){let t=this._dynamicOverlays.filter(o=>o.shouldRender());for(let o=0,n=t.length;o<n;o++){let r=t[o];r.prepareRender(e),r.onDidRender()}}render(e){this._viewOverlaysRender(e),this.domNode.toggleClassName("focused",this._isFocused)}_viewOverlaysRender(e){this._visibleLines.renderLines(e.viewportData)}},kJt=class{constructor(i){this._dynamicOverlays=i,this._domNode=null,this._renderedContent=null}getDomNode(){return this._domNode?this._domNode.domNode:null}setDomNode(i){this._domNode=or(i)}onContentChanged(){}onTokensChanged(){}renderLine(i,e,t,o,n){let r="";for(let s=0,l=this._dynamicOverlays.length;s<l;s++){let c=this._dynamicOverlays[s];r+=c.render(o.startLineNumber,i)}return this._renderedContent===r?!1:(this._renderedContent=r,n.appendString('<div style="top:'),n.appendString(String(e)),n.appendString("px;height:"),n.appendString(String(t)),n.appendString("px;line-height:"),n.appendString(String(t)),n.appendString('px;">'),n.appendString(r),n.appendString("</div>"),!0)}layoutLine(i,e,t){this._domNode&&(this._domNode.setTop(e),this._domNode.setHeight(t),this._domNode.setLineHeight(t))}},lft=class extends aft{constructor(i){super(i);let t=this._context.configuration.options.get(165);this._contentWidth=t.contentWidth,this.domNode.setHeight(0)}onConfigurationChanged(i){let t=this._context.configuration.options.get(165);return this._contentWidth=t.contentWidth,super.onConfigurationChanged(i)||!0}onScrollChanged(i){return super.onScrollChanged(i)||i.scrollWidthChanged}_viewOverlaysRender(i){super._viewOverlaysRender(i),this.domNode.setWidth(Math.max(i.scrollWidth,this._contentWidth))}},cft=class extends aft{constructor(i){super(i);let e=this._context.configuration.options,t=e.get(165);this._contentLeft=t.contentLeft,this.domNode.setClassName("margin-view-overlays"),this.domNode.setWidth(1),Pd(this.domNode,e.get(59))}onConfigurationChanged(i){let e=this._context.configuration.options;Pd(this.domNode,e.get(59));let t=e.get(165);return this._contentLeft=t.contentLeft,super.onConfigurationChanged(i)||!0}onScrollChanged(i){return super.onScrollChanged(i)||i.scrollHeightChanged}_viewOverlaysRender(i){super._viewOverlaysRender(i);let e=Math.min(i.scrollHeight,1e6);this.domNode.setHeight(e),this.domNode.setWidth(this._contentLeft)}};var MIe=class a{constructor(i){this.onKeyDown=null;this.onKeyUp=null;this.onContextMenu=null;this.onMouseMove=null;this.onMouseLeave=null;this.onMouseDown=null;this.onMouseUp=null;this.onMouseDrag=null;this.onMouseDrop=null;this.onMouseDropCanceled=null;this.onMouseWheel=null;this._coordinatesConverter=i}emitKeyDown(i){this.onKeyDown?.(i)}emitKeyUp(i){this.onKeyUp?.(i)}emitContextMenu(i){this.onContextMenu?.(this._convertViewToModelMouseEvent(i))}emitMouseMove(i){this.onMouseMove?.(this._convertViewToModelMouseEvent(i))}emitMouseLeave(i){this.onMouseLeave?.(this._convertViewToModelMouseEvent(i))}emitMouseDown(i){this.onMouseDown?.(this._convertViewToModelMouseEvent(i))}emitMouseUp(i){this.onMouseUp?.(this._convertViewToModelMouseEvent(i))}emitMouseDrag(i){this.onMouseDrag?.(this._convertViewToModelMouseEvent(i))}emitMouseDrop(i){this.onMouseDrop?.(this._convertViewToModelMouseEvent(i))}emitMouseDropCanceled(){this.onMouseDropCanceled?.()}emitMouseWheel(i){this.onMouseWheel?.(i)}_convertViewToModelMouseEvent(i){return i.target?{event:i.event,target:this._convertViewToModelMouseTarget(i.target)}:i}_convertViewToModelMouseTarget(i){return a.convertViewToModelMouseTarget(i,this._coordinatesConverter)}static convertViewToModelMouseTarget(i,e){let t={...i};return t.position&&(t.position=e.convertViewPositionToModelPosition(t.position)),t.range&&(t.range=e.convertViewRangeToModelRange(t.range)),(t.type===5||t.type===8)&&(t.detail=this.convertViewToModelViewZoneData(t.detail,e)),t}static convertViewToModelViewZoneData(i,e){return{viewZoneId:i.viewZoneId,positionBefore:i.positionBefore?e.convertViewPositionToModelPosition(i.positionBefore):i.positionBefore,positionAfter:i.positionAfter?e.convertViewPositionToModelPosition(i.positionAfter):i.positionAfter,position:e.convertViewPositionToModelPosition(i.position),afterLineNumber:e.convertViewPositionToModelPosition(new Ie(i.afterLineNumber,1)).lineNumber}}};var dft=class extends mu{constructor(e){super(e);this.blocks=[];this.contentWidth=-1;this.contentLeft=0;this.domNode=or(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this.domNode.setClassName("blockDecorations-container"),this.update()}update(){let e=!1,o=this._context.configuration.options.get(165),n=o.contentWidth-o.verticalScrollbarWidth;this.contentWidth!==n&&(this.contentWidth=n,e=!0);let r=o.contentLeft;return this.contentLeft!==r&&(this.contentLeft=r,e=!0),e}dispose(){super.dispose()}onConfigurationChanged(e){return this.update()}onScrollChanged(e){return e.scrollTopChanged||e.scrollLeftChanged}onDecorationsChanged(e){return!0}onZonesChanged(e){return!0}prepareRender(e){}render(e){let t=0,o=e.getDecorationsInViewport();for(let n of o){if(!n.options.blockClassName)continue;let r=this.blocks[t];r||(r=this.blocks[t]=or(document.createElement("div")),this.domNode.appendChild(r));let s,l;n.options.blockIsAfterEnd?(s=e.getVerticalOffsetAfterLineNumber(n.range.endLineNumber,!1),l=e.getVerticalOffsetAfterLineNumber(n.range.endLineNumber,!0)):(s=e.getVerticalOffsetForLineNumber(n.range.startLineNumber,!0),l=n.range.isEmpty()&&!n.options.blockDoesNotCollapse?e.getVerticalOffsetForLineNumber(n.range.startLineNumber,!1):e.getVerticalOffsetAfterLineNumber(n.range.endLineNumber,!0));let[c,u,p,h]=n.options.blockPadding??[0,0,0,0];r.setClassName("blockDecorations-block "+n.options.blockClassName),r.setLeft(this.contentLeft-h),r.setWidth(this.contentWidth+h+u),r.setTop(s-e.scrollTop-c),r.setHeight(l-s+c+p),t++}for(let n=t;n<this.blocks.length;n++)this.blocks[n].domNode.remove();this.blocks.length=t}};var uft=class extends mu{constructor(i,e){super(i),this._viewDomNode=e,this._widgets={},this.domNode=or(document.createElement("div")),PS.write(this.domNode,1),this.domNode.setClassName("contentWidgets"),this.domNode.setPosition("absolute"),this.domNode.setTop(0),this.overflowingContentWidgetsDomNode=or(document.createElement("div")),PS.write(this.overflowingContentWidgetsDomNode,2),this.overflowingContentWidgetsDomNode.setClassName("overflowingContentWidgets")}dispose(){super.dispose(),this._widgets={}}onConfigurationChanged(i){let e=Object.keys(this._widgets);for(let t of e)this._widgets[t].onConfigurationChanged(i);return!0}onDecorationsChanged(i){return!0}onFlushed(i){return!0}onLineMappingChanged(i){return this._updateAnchorsViewPositions(),!0}onLinesChanged(i){return this._updateAnchorsViewPositions(),!0}onLinesDeleted(i){return this._updateAnchorsViewPositions(),!0}onLinesInserted(i){return this._updateAnchorsViewPositions(),!0}onScrollChanged(i){return!0}onZonesChanged(i){return!0}_updateAnchorsViewPositions(){let i=Object.keys(this._widgets);for(let e of i)this._widgets[e].updateAnchorViewPosition()}addWidget(i){let e=new TJt(this._context,this._viewDomNode,i);this._widgets[e.id]=e,e.allowEditorOverflow?this.overflowingContentWidgetsDomNode.appendChild(e.domNode):this.domNode.appendChild(e.domNode),this.setShouldRender()}setWidgetPosition(i,e,t,o,n){let r=this._widgets[i.getId()];r.setPosition(e,t,o,n),r.useDisplayNone||this.setShouldRender()}removeWidget(i){let e=i.getId();if(this._widgets.hasOwnProperty(e)){let t=this._widgets[e];delete this._widgets[e];let o=t.domNode.domNode;o.remove(),o.removeAttribute("monaco-visible-content-widget"),this.setShouldRender()}}shouldSuppressMouseDownOnWidget(i){return this._widgets.hasOwnProperty(i)?this._widgets[i].suppressMouseDown:!1}onBeforeRender(i){let e=Object.keys(this._widgets);for(let t of e)this._widgets[t].onBeforeRender(i)}prepareRender(i){let e=Object.keys(this._widgets);for(let t of e)this._widgets[t].prepareRender(i)}render(i){let e=Object.keys(this._widgets);for(let t of e)this._widgets[t].render(i)}},TJt=class{constructor(i,e,t){this._primaryAnchor=new qse(null,null);this._secondaryAnchor=new qse(null,null);this._context=i,this._viewDomNode=e,this._actual=t;let o=this._context.configuration.options,n=o.get(165),r=o.get(4);this.domNode=or(this._actual.getDomNode()),this.id=this._actual.getId(),this.allowEditorOverflow=(this._actual.allowEditorOverflow||!1)&&r,this.suppressMouseDown=this._actual.suppressMouseDown||!1,this.useDisplayNone=this._actual.useDisplayNone||!1,this._fixedOverflowWidgets=o.get(51),this._contentWidth=n.contentWidth,this._contentLeft=n.contentLeft,this._affinity=null,this._preference=[],this._cachedDomNodeOffsetWidth=-1,this._cachedDomNodeOffsetHeight=-1,this._maxWidth=this._getMaxWidth(),this._isVisible=!1,this._renderData=null,this.domNode.setPosition(this._fixedOverflowWidgets&&this.allowEditorOverflow?"fixed":"absolute"),this.domNode.setDisplay("none"),this.domNode.setVisibility("hidden"),this.domNode.setAttribute("widgetId",this.id),this.domNode.setMaxWidth(this._maxWidth)}onConfigurationChanged(i){let e=this._context.configuration.options;if(i.hasChanged(165)){let t=e.get(165);this._contentLeft=t.contentLeft,this._contentWidth=t.contentWidth,this._maxWidth=this._getMaxWidth()}}updateAnchorViewPosition(){this._setPosition(this._affinity,this._primaryAnchor.modelPosition,this._secondaryAnchor.modelPosition)}_setPosition(i,e,t){this._affinity=i,this._primaryAnchor=o(e,this._context.viewModel,this._affinity),this._secondaryAnchor=o(t,this._context.viewModel,this._affinity);function o(n,r,s){if(!n)return new qse(null,null);let l=r.model.validatePosition(n);if(r.coordinatesConverter.modelPositionIsVisible(l)){let c=r.coordinatesConverter.convertModelPositionToViewPosition(l,s??void 0);return new qse(n,c)}return new qse(n,null)}}_getMaxWidth(){let i=this.domNode.domNode.ownerDocument,e=i.defaultView;return this.allowEditorOverflow?e?.innerWidth||i.documentElement.offsetWidth||i.body.offsetWidth:this._contentWidth}setPosition(i,e,t,o){this._setPosition(o,i,e),this._preference=t,!this.useDisplayNone&&this._primaryAnchor.viewPosition&&this._preference&&this._preference.length>0?this.domNode.setDisplay("block"):this.domNode.setDisplay("none"),this._cachedDomNodeOffsetWidth=-1,this._cachedDomNodeOffsetHeight=-1}_layoutBoxInViewport(i,e,t,o){let n=i.top,r=n,s=i.top+i.height,l=o.viewportHeight-s,c=n-t,u=r>=t,p=s,h=l>=t,g=i.left;return g+e>o.scrollLeft+o.viewportWidth&&(g=o.scrollLeft+o.viewportWidth-e),g<o.scrollLeft&&(g=o.scrollLeft),{fitsAbove:u,aboveTop:c,fitsBelow:h,belowTop:p,left:g}}_layoutHorizontalSegmentInPage(i,e,t,o){let s=Math.max(15,e.left-o),l=Math.min(e.left+e.width+o,i.width-15),u=this._viewDomNode.domNode.ownerDocument.defaultView,p=e.left+t-(u?.scrollX??0);if(p+o>l){let h=p-(l-o);p-=h,t-=h}if(p<s){let h=p-s;p-=h,t-=h}return[t,p]}_layoutBoxInPage(i,e,t,o){let n=i.top-t,r=i.top+i.height,s=Yn(this._viewDomNode.domNode),l=this._viewDomNode.domNode.ownerDocument,c=l.defaultView,u=s.top+n-(c?.scrollY??0),p=s.top+r-(c?.scrollY??0),h=Fm(l.body),[g,f]=this._layoutHorizontalSegmentInPage(h,s,i.left-o.scrollLeft+this._contentLeft,e),v=22,b=22,S=u>=v,y=p+t<=h.height-b;return this._fixedOverflowWidgets?{fitsAbove:S,aboveTop:Math.max(u,v),fitsBelow:y,belowTop:p,left:f}:{fitsAbove:S,aboveTop:n,fitsBelow:y,belowTop:r,left:g}}_prepareRenderWidgetAtExactPositionOverflowing(i){return new jse(i.top,i.left+this._contentLeft)}_getAnchorsCoordinates(i){let e=n(this._primaryAnchor.viewPosition,this._affinity),t=this._secondaryAnchor.viewPosition?.lineNumber===this._primaryAnchor.viewPosition?.lineNumber?this._secondaryAnchor.viewPosition:null,o=n(t,this._affinity);return{primary:e,secondary:o};function n(r,s){if(!r)return null;let l=i.visibleRangeForPosition(r);if(!l)return null;let c=r.column===1&&s===3?0:l.left,u=i.getVerticalOffsetForLineNumber(r.lineNumber)-i.scrollTop,p=i.getLineHeightForLineNumber(r.lineNumber);return new pft(u,c,p)}}_reduceAnchorCoordinates(i,e,t){if(!e)return i;let o=this._context.configuration.options.get(59),n=e.left;return n<i.left?n=Math.max(n,i.left-t+o.typicalFullwidthCharacterWidth):n=Math.min(n,i.left+t-o.typicalFullwidthCharacterWidth),new pft(i.top,n,i.height)}_prepareRenderWidget(i){if(!this._preference||this._preference.length===0)return null;let{primary:e,secondary:t}=this._getAnchorsCoordinates(i);if(!e)return{kind:"offViewport",preserveFocus:this.domNode.domNode.contains(this.domNode.domNode.ownerDocument.activeElement)};if(this._cachedDomNodeOffsetWidth===-1||this._cachedDomNodeOffsetHeight===-1){let r=null;if(typeof this._actual.beforeRender=="function"&&(r=EJt(this._actual.beforeRender,this._actual)),r)this._cachedDomNodeOffsetWidth=r.width,this._cachedDomNodeOffsetHeight=r.height;else{let l=this.domNode.domNode.getBoundingClientRect();this._cachedDomNodeOffsetWidth=Math.round(l.width),this._cachedDomNodeOffsetHeight=Math.round(l.height)}}let o=this._reduceAnchorCoordinates(e,t,this._cachedDomNodeOffsetWidth),n;this.allowEditorOverflow?n=this._layoutBoxInPage(o,this._cachedDomNodeOffsetWidth,this._cachedDomNodeOffsetHeight,i):n=this._layoutBoxInViewport(o,this._cachedDomNodeOffsetWidth,this._cachedDomNodeOffsetHeight,i);for(let r=1;r<=2;r++)for(let s of this._preference)if(s===1){if(!n)return null;if(r===2||n.fitsAbove)return{kind:"inViewport",coordinate:new jse(n.aboveTop,n.left),position:1}}else if(s===2){if(!n)return null;if(r===2||n.fitsBelow)return{kind:"inViewport",coordinate:new jse(n.belowTop,n.left),position:2}}else return this.allowEditorOverflow?{kind:"inViewport",coordinate:this._prepareRenderWidgetAtExactPositionOverflowing(new jse(o.top,o.left)),position:0}:{kind:"inViewport",coordinate:new jse(o.top,o.left),position:0};return null}onBeforeRender(i){!this._primaryAnchor.viewPosition||!this._preference||this._primaryAnchor.viewPosition.lineNumber<i.startLineNumber||this._primaryAnchor.viewPosition.lineNumber>i.endLineNumber||this.domNode.setMaxWidth(this._maxWidth)}prepareRender(i){this._renderData=this._prepareRenderWidget(i)}render(i){if(!this._renderData||this._renderData.kind==="offViewport"){this._isVisible&&(this.domNode.removeAttribute("monaco-visible-content-widget"),this._isVisible=!1,this._renderData?.kind==="offViewport"&&this._renderData.preserveFocus?this.domNode.setTop(-1e3):this.domNode.setVisibility("hidden")),typeof this._actual.afterRender=="function"&&EJt(this._actual.afterRender,this._actual,null,null);return}this.allowEditorOverflow?(this.domNode.setTop(this._renderData.coordinate.top),this.domNode.setLeft(this._renderData.coordinate.left)):(this.domNode.setTop(this._renderData.coordinate.top+i.scrollTop-i.bigNumbersDelta),this.domNode.setLeft(this._renderData.coordinate.left)),this._isVisible||(this.domNode.setVisibility("inherit"),this.domNode.setAttribute("monaco-visible-content-widget","true"),this._isVisible=!0),typeof this._actual.afterRender=="function"&&EJt(this._actual.afterRender,this._actual,this._renderData.position,this._renderData.coordinate)}},qse=class{constructor(i,e){this.modelPosition=i;this.viewPosition=e}},jse=class{constructor(i,e){this.top=i;this.left=e;this._coordinateBrand=void 0}},pft=class{constructor(i,e,t){this.top=i;this.left=e;this.height=t;this._anchorCoordinateBrand=void 0}};function EJt(a,i,...e){try{return a.call(i,...e)}catch{return null}}var Jw=class extends Jk{};var De=ae("themeService");function Ss(a){return{id:a}}var G$i=M.file,X$=M.folder;function J$(a){switch(a){case"dark":return"vs-dark";case"hcDark":return"hc-black";case"hcLight":return"hc-light";default:return"vs"}}var LJt={ThemingContribution:"base.contributions.theming"},_Jt=class extends C{constructor(){super();this.themingParticipants=[];this.themingParticipants=[],this.onThemingParticipantAddedEmitter=this._register(new E)}onColorThemeChange(e){return this.themingParticipants.push(e),this.onThemingParticipantAddedEmitter.fire(e),Z(()=>{let t=this.themingParticipants.indexOf(e);this.themingParticipants.splice(t,1)})}get onThemingParticipantAdded(){return this.onThemingParticipantAddedEmitter.event}getThemingParticipants(){return this.themingParticipants}},$$i=new _Jt;oe.add(LJt.ThemingContribution,$$i);function is(a){return $$i.onColorThemeChange(a)}var Jd=class extends C{constructor(e){super();this.themeService=e;this.theme=e.getColorTheme(),this._register(this.themeService.onDidColorThemeChange(t=>this.onThemeChange(t)))}onThemeChange(e){this.theme=e,this.updateStyles()}updateStyles(){}getColor(e,t){let o=this.theme.getColor(e);return o&&t&&(o=t(o,this.theme)),o?o.toString():null}};var PIe=J("editor.lineHighlightBackground",null,d(790,null)),q$i=J("editor.inactiveLineHighlightBackground",PIe,d(789,null)),RJt=J("editor.lineHighlightBorder",{dark:"#282828",light:"#eeeeee",hcDark:"#f38518",hcLight:gi},d(791,null)),j$i=J("editor.rangeHighlightBackground",{dark:"#ffffff0b",light:"#fdff0033",hcDark:null,hcLight:null},d(796,null),!0),u2n=J("editor.rangeHighlightBorder",{dark:null,light:null,hcDark:qs,hcLight:qs},d(797,null)),p2n=J("editor.symbolHighlightBackground",{dark:Kb,light:Kb,hcDark:null,hcLight:null},d(798,null),!0),m2n=J("editor.symbolHighlightBorder",{dark:null,light:null,hcDark:qs,hcLight:qs},d(799,null)),I9=J("editorCursor.foreground",{dark:"#AEAFAD",light:Oe.black,hcDark:Oe.white,hcLight:"#0F4A85"},d(730,null)),mft=J("editorCursor.background",null,d(765,null)),hft=J("editorMultiCursor.primary.foreground",I9,d(780,null)),Q$i=J("editorMultiCursor.primary.background",mft,d(779,null)),gft=J("editorMultiCursor.secondary.foreground",I9,d(782,null)),Y$i=J("editorMultiCursor.secondary.background",mft,d(781,null)),AIe=J("editorWhitespace.foreground",{dark:"#e3e4e229",light:"#33333333",hcDark:"#e3e4e229",hcLight:"#CCCCCC"},d(788,null)),X$i=J("editorLineNumber.foreground",{dark:"#858585",light:"#237893",hcDark:Oe.white,hcLight:"#292929"},d(778,null)),$Po=J("editorIndentGuide.background",AIe,d(771,null),!1,d(733,null)),qPo=J("editorIndentGuide.activeBackground",AIe,d(734,null),!1,d(731,null)),fft=J("editorIndentGuide.background1",$Po,d(772,null)),J$i=J("editorIndentGuide.background2","#00000000",d(773,null)),Z$i=J("editorIndentGuide.background3","#00000000",d(774,null)),eqi=J("editorIndentGuide.background4","#00000000",d(775,null)),tqi=J("editorIndentGuide.background5","#00000000",d(776,null)),iqi=J("editorIndentGuide.background6","#00000000",d(777,null)),vft=J("editorIndentGuide.activeBackground1",qPo,d(735,null)),oqi=J("editorIndentGuide.activeBackground2","#00000000",d(736,null)),nqi=J("editorIndentGuide.activeBackground3","#00000000",d(737,null)),rqi=J("editorIndentGuide.activeBackground4","#00000000",d(738,null)),sqi=J("editorIndentGuide.activeBackground5","#00000000",d(739,null)),aqi=J("editorIndentGuide.activeBackground6","#00000000",d(740,null)),jPo=J("editorActiveLineNumber.foreground",{dark:"#c6c6c6",light:"#0B216F",hcDark:qs,hcLight:qs},d(741,null),!1,d(732,null)),h2n=J("editorLineNumber.activeForeground",jPo,d(741,null)),lqi=J("editorLineNumber.dimmedForeground",null,d(766,null)),cqi=J("editorRuler.foreground",{dark:"#5A5A5A",light:Oe.lightgrey,hcDark:Oe.white,hcLight:"#292929"},d(785,null)),g2n=J("editorCodeLens.foreground",{dark:"#999999",light:"#919191",hcDark:"#999999",hcLight:"#292929"},d(764,null)),f2n=J("editorBracketMatch.background",{dark:"#0064001a",light:"#0064001a",hcDark:"#0064001a",hcLight:"#0000"},d(749,null)),v2n=J("editorBracketMatch.border",{dark:"#888",light:"#B9B9B9",hcDark:gi,hcLight:gi},d(750,null)),dqi=J("editorBracketMatch.foreground",null,d(751,null)),bft=J("editorOverviewRuler.border",{dark:"#7f7f7f4d",light:"#7f7f7f4d",hcDark:"#7f7f7f4d",hcLight:"#666666"},d(784,null)),uqi=J("editorOverviewRuler.background",null,d(783,null)),b2n=J("editorGutter.background",qo,d(770,null)),S2n=J("editorUnnecessaryCode.border",{dark:null,light:null,hcDark:Oe.fromHex("#fff").transparent(.8),hcLight:gi},d(800,null)),pqi=J("editorUnnecessaryCode.opacity",{dark:Oe.fromHex("#000a"),light:Oe.fromHex("#0007"),hcDark:null,hcLight:null},d(801,null)),I2n=J("editorGhostText.border",{dark:null,light:null,hcDark:Oe.fromHex("#fff").transparent(.8),hcLight:Oe.fromHex("#292929").transparent(.8)},d(768,null)),mqi=J("editorGhostText.foreground",{dark:Oe.fromHex("#ffffff56"),light:Oe.fromHex("#0007"),hcDark:null,hcLight:null},d(769,null)),y2n=J("editorGhostText.background",null,d(767,null)),QPo=new Oe(new Bt(0,122,204,.6)),y9=J("editorOverviewRuler.rangeHighlightForeground",QPo,d(794,null),!0),NIe=J("editorOverviewRuler.errorForeground",{dark:new Oe(new Bt(255,18,18,.7)),light:new Oe(new Bt(255,18,18,.7)),hcDark:new Oe(new Bt(255,50,50,1)),hcLight:"#B5200D"},d(792,null)),hqi=J("editorOverviewRuler.warningForeground",{dark:Bh,light:Bh,hcDark:n9,hcLight:n9},d(795,null)),w9=J("editorOverviewRuler.infoForeground",{dark:fm,light:fm,hcDark:r9,hcLight:r9},d(793,null)),Sft=J("editorBracketHighlight.foreground1",{dark:"#FFD700",light:"#0431FAFF",hcDark:"#FFD700",hcLight:"#0431FAFF"},d(742,null)),Ift=J("editorBracketHighlight.foreground2",{dark:"#DA70D6",light:"#319331FF",hcDark:"#DA70D6",hcLight:"#319331FF"},d(743,null)),yft=J("editorBracketHighlight.foreground3",{dark:"#179FFF",light:"#7B3814FF",hcDark:"#87CEFA",hcLight:"#7B3814FF"},d(744,null)),wft=J("editorBracketHighlight.foreground4","#00000000",d(745,null)),Cft=J("editorBracketHighlight.foreground5","#00000000",d(746,null)),xft=J("editorBracketHighlight.foreground6","#00000000",d(747,null)),gqi=J("editorBracketHighlight.unexpectedBracket.foreground",{dark:new Oe(new Bt(255,18,18,.8)),light:new Oe(new Bt(255,18,18,.8)),hcDark:new Oe(new Bt(255,50,50,1)),hcLight:"#B5200D"},d(748,null)),fqi=J("editorBracketPairGuide.background1","#00000000",d(758,null)),vqi=J("editorBracketPairGuide.background2","#00000000",d(759,null)),bqi=J("editorBracketPairGuide.background3","#00000000",d(760,null)),Sqi=J("editorBracketPairGuide.background4","#00000000",d(761,null)),Iqi=J("editorBracketPairGuide.background5","#00000000",d(762,null)),yqi=J("editorBracketPairGuide.background6","#00000000",d(763,null)),wqi=J("editorBracketPairGuide.activeBackground1","#00000000",d(752,null)),Cqi=J("editorBracketPairGuide.activeBackground2","#00000000",d(753,null)),xqi=J("editorBracketPairGuide.activeBackground3","#00000000",d(754,null)),kqi=J("editorBracketPairGuide.activeBackground4","#00000000",d(755,null)),Eqi=J("editorBracketPairGuide.activeBackground5","#00000000",d(756,null)),Tqi=J("editorBracketPairGuide.activeBackground6","#00000000",d(757,null)),w2n=J("editorUnicodeHighlight.border",Bh,d(787,null)),C2n=J("editorUnicodeHighlight.background",tGi,d(786,null));is((a,i)=>{let e=a.getColor(qo),t=a.getColor(PIe),o=t&&!t.isTransparent()?t:e;o&&i.addRule(`.monaco-editor .inputarea.ime-input { background-color: ${o}; }`)});var kft=class extends Jw{constructor(i){super(),this._context=i;let e=this._context.configuration.options,t=e.get(165);this._renderLineHighlight=e.get(110),this._renderLineHighlightOnlyWhenFocus=e.get(111),this._wordWrap=t.isViewportWrapping,this._contentLeft=t.contentLeft,this._contentWidth=t.contentWidth,this._selectionIsEmpty=!0,this._focused=!1,this._cursorLineNumbers=[1],this._selections=[new Yt(1,1,1,1)],this._renderData=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),super.dispose()}_readFromSelections(){let i=!1,e=new Set;for(let n of this._selections)e.add(n.positionLineNumber);let t=Array.from(e);t.sort((n,r)=>n-r),$i(this._cursorLineNumbers,t)||(this._cursorLineNumbers=t,i=!0);let o=this._selections.every(n=>n.isEmpty());return this._selectionIsEmpty!==o&&(this._selectionIsEmpty=o,i=!0),i}onThemeChanged(i){return this._readFromSelections()}onConfigurationChanged(i){let e=this._context.configuration.options,t=e.get(165);return this._renderLineHighlight=e.get(110),this._renderLineHighlightOnlyWhenFocus=e.get(111),this._wordWrap=t.isViewportWrapping,this._contentLeft=t.contentLeft,this._contentWidth=t.contentWidth,!0}onCursorStateChanged(i){return this._selections=i.selections,this._readFromSelections()}onFlushed(i){return!0}onLinesDeleted(i){return!0}onLinesInserted(i){return!0}onScrollChanged(i){return i.scrollWidthChanged||i.scrollTopChanged}onZonesChanged(i){return!0}onFocusChanged(i){return this._renderLineHighlightOnlyWhenFocus?(this._focused=i.isFocused,!0):!1}prepareRender(i){if(!this._shouldRenderThis()){this._renderData=null;return}let e=i.visibleRange.startLineNumber,t=i.visibleRange.endLineNumber,o=[];for(let r=e;r<=t;r++){let s=r-e;o[s]=""}if(this._wordWrap){let r=this._renderOne(i,!1);for(let s of this._cursorLineNumbers){let l=this._context.viewModel.coordinatesConverter,c=l.convertViewPositionToModelPosition(new Ie(s,1)).lineNumber,u=l.convertModelPositionToViewPosition(new Ie(c,1)).lineNumber,p=l.convertModelPositionToViewPosition(new Ie(c,this._context.viewModel.model.getLineMaxColumn(c))).lineNumber,h=Math.max(u,e),g=Math.min(p,t);for(let f=h;f<=g;f++){let v=f-e;o[v]=r}}}let n=this._renderOne(i,!0);for(let r of this._cursorLineNumbers){if(r<e||r>t)continue;let s=r-e;o[s]=n}this._renderData=o}render(i,e){if(!this._renderData)return"";let t=e-i;return t>=this._renderData.length?"":this._renderData[t]}_shouldRenderInMargin(){return(this._renderLineHighlight==="gutter"||this._renderLineHighlight==="all")&&(!this._renderLineHighlightOnlyWhenFocus||this._focused)}_shouldRenderInContent(){return(this._renderLineHighlight==="line"||this._renderLineHighlight==="all")&&this._selectionIsEmpty&&(!this._renderLineHighlightOnlyWhenFocus||this._focused)}},Eft=class extends kft{_renderOne(i,e){return`<div class="${"current-line"+(this._shouldRenderInMargin()?" current-line-both":"")+(e?" current-line-exact":"")}" style="width:${Math.max(i.scrollWidth,this._contentWidth)}px;"></div>`}_shouldRenderThis(){return this._shouldRenderInContent()}_shouldRenderOther(){return this._shouldRenderInMargin()}},Tft=class extends kft{_renderOne(i,e){return`<div class="${"current-line"+(this._shouldRenderInMargin()?" current-line-margin":"")+(this._shouldRenderOther()?" current-line-margin-both":"")+(this._shouldRenderInMargin()&&e?" current-line-exact-margin":"")}" style="width:${this._contentLeft}px"></div>`}_shouldRenderThis(){return!0}_shouldRenderOther(){return this._shouldRenderInContent()}};is((a,i)=>{let e=a.getColor(PIe),t=a.getColor(q$i);if(e&&(i.addRule(`.monaco-editor.focused .view-overlays .current-line { background-color: ${e}; }`),i.addRule(`.monaco-editor.focused .margin-view-overlays .current-line-margin { background-color: ${e}; border: none; }`)),t&&(i.addRule(`.monaco-editor .view-overlays .current-line { background-color: ${t}; }`),i.addRule(`.monaco-editor .margin-view-overlays .current-line-margin { background-color: ${t}; border: none; }`)),!e||e.isTransparent()||a.defines(RJt)){let o=a.getColor(RJt);o&&(i.addRule(`.monaco-editor .view-overlays .current-line-exact { border: 2px solid ${o}; }`),i.addRule(`.monaco-editor .margin-view-overlays .current-line-exact-margin { border: 2px solid ${o}; }`),Ug(a.type)&&(i.addRule(".monaco-editor .view-overlays .current-line-exact { border-width: 1px; }"),i.addRule(".monaco-editor .margin-view-overlays .current-line-exact-margin { border-width: 1px; }")))}});var _ft=class extends Jw{constructor(i){super(),this._context=i;let e=this._context.configuration.options;this._typicalHalfwidthCharacterWidth=e.get(59).typicalHalfwidthCharacterWidth,this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(i){let e=this._context.configuration.options;return this._typicalHalfwidthCharacterWidth=e.get(59).typicalHalfwidthCharacterWidth,!0}onDecorationsChanged(i){return!0}onFlushed(i){return!0}onLinesChanged(i){return!0}onLinesDeleted(i){return!0}onLinesInserted(i){return!0}onScrollChanged(i){return i.scrollTopChanged||i.scrollWidthChanged}onZonesChanged(i){return!0}prepareRender(i){let e=i.getDecorationsInViewport(),t=[],o=0;for(let l=0,c=e.length;l<c;l++){let u=e[l];u.options.className&&(t[o++]=u)}t=t.sort((l,c)=>{if(l.options.zIndex<c.options.zIndex)return-1;if(l.options.zIndex>c.options.zIndex)return 1;let u=l.options.className,p=c.options.className;return u<p?-1:u>p?1:z.compareRangesUsingStarts(l.range,c.range)});let n=i.visibleRange.startLineNumber,r=i.visibleRange.endLineNumber,s=[];for(let l=n;l<=r;l++){let c=l-n;s[c]=""}this._renderWholeLineDecorations(i,t,s),this._renderNormalDecorations(i,t,s),this._renderResult=s}_renderWholeLineDecorations(i,e,t){let o=i.visibleRange.startLineNumber,n=i.visibleRange.endLineNumber;for(let r=0,s=e.length;r<s;r++){let l=e[r];if(!l.options.isWholeLine)continue;let c='<div class="cdr '+l.options.className+'" style="left:0;width:100%;"></div>',u=Math.max(l.range.startLineNumber,o),p=Math.min(l.range.endLineNumber,n);for(let h=u;h<=p;h++){let g=h-o;t[g]+=c}}}_renderNormalDecorations(i,e,t){let o=i.visibleRange.startLineNumber,n=null,r=!1,s=null,l=!1;for(let c=0,u=e.length;c<u;c++){let p=e[c];if(p.options.isWholeLine)continue;let h=p.options.className,g=!!p.options.showIfCollapsed,f=p.range;if(g&&f.endColumn===1&&f.endLineNumber!==f.startLineNumber&&(f=new z(f.startLineNumber,f.startColumn,f.endLineNumber-1,this._context.viewModel.getLineMaxColumn(f.endLineNumber-1))),n===h&&r===g&&z.areIntersectingOrTouching(s,f)){s=z.plusRange(s,f);continue}n!==null&&this._renderNormalDecoration(i,s,n,l,r,o,t),n=h,r=g,s=f,l=p.options.shouldFillLineOnLineBreak??!1}n!==null&&this._renderNormalDecoration(i,s,n,l,r,o,t)}_renderNormalDecoration(i,e,t,o,n,r,s){let l=i.linesVisibleRangesForRange(e,t==="findMatch");if(l)for(let c=0,u=l.length;c<u;c++){let p=l[c];if(p.outsideRenderedLine)continue;let h=p.lineNumber-r;if(n&&p.ranges.length===1){let g=p.ranges[0];if(g.width<this._typicalHalfwidthCharacterWidth){let f=Math.round(g.left+g.width/2),v=Math.max(0,Math.round(f-this._typicalHalfwidthCharacterWidth/2));p.ranges[0]=new m9(v,this._typicalHalfwidthCharacterWidth)}}for(let g=0,f=p.ranges.length;g<f;g++){let v=o&&p.continuesOnNextLine&&f===1,b=p.ranges[g],S='<div class="cdr '+t+'" style="left:'+String(b.left)+"px;width:"+(v?"100%;":String(b.width)+"px;")+'"></div>';s[h]+=S}}}render(i,e){if(!this._renderResult)return"";let t=e-i;return t<0||t>=this._renderResult.length?"":this._renderResult[t]}};var Dft=class extends mu{constructor(i,e,t,o){super(i);let n=this._context.configuration.options,r=n.get(117),s=n.get(83),l=n.get(49),c=n.get(120),u=n.get(158),p={listenOnDomNode:t.domNode,className:"editor-scrollable "+J$(i.theme.type),useShadows:!1,lazyRender:!0,vertical:r.vertical,horizontal:r.horizontal,verticalHasArrows:r.verticalHasArrows,horizontalHasArrows:r.horizontalHasArrows,verticalScrollbarSize:r.verticalScrollbarSize,verticalSliderSize:r.verticalSliderSize,horizontalScrollbarSize:r.horizontalScrollbarSize,horizontalSliderSize:r.horizontalSliderSize,handleMouseWheel:r.handleMouseWheel,alwaysConsumeMouseWheel:r.alwaysConsumeMouseWheel,arrowSize:r.arrowSize,mouseWheelScrollSensitivity:s,fastScrollSensitivity:l,scrollPredominantAxis:c,scrollByPage:r.scrollByPage,inertialScroll:u};this.scrollbar=this._register(new AN(e.domNode,p,this._context.viewLayout.getScrollable())),PS.write(this.scrollbar.getDomNode(),6),this.scrollbarDomNode=or(this.scrollbar.getDomNode()),this.scrollbarDomNode.setPosition("absolute"),this._setLayout();let h=(g,f,v)=>{let b={};if(f){let S=g.scrollTop;S&&(b.scrollTop=this._context.viewLayout.getCurrentScrollTop()+S,g.scrollTop=0)}if(v){let S=g.scrollLeft;S&&(b.scrollLeft=this._context.viewLayout.getCurrentScrollLeft()+S,g.scrollLeft=0)}this._context.viewModel.viewLayout.setScrollPosition(b,1)};this._register(j(t.domNode,"scroll",g=>h(t.domNode,!0,!0))),this._register(j(e.domNode,"scroll",g=>h(e.domNode,!0,!1))),this._register(j(o.domNode,"scroll",g=>h(o.domNode,!0,!1))),this._register(j(this.scrollbarDomNode.domNode,"scroll",g=>h(this.scrollbarDomNode.domNode,!0,!1)))}dispose(){super.dispose()}_setLayout(){let i=this._context.configuration.options,e=i.get(165);this.scrollbarDomNode.setLeft(e.contentLeft),i.get(81).side==="right"?this.scrollbarDomNode.setWidth(e.contentWidth+e.minimap.minimapWidth):this.scrollbarDomNode.setWidth(e.contentWidth),this.scrollbarDomNode.setHeight(e.height)}getOverviewRulerLayoutInfo(){return this.scrollbar.getOverviewRulerLayoutInfo()}getDomNode(){return this.scrollbarDomNode}delegateVerticalScrollbarPointerDown(i){this.scrollbar.delegateVerticalScrollbarPointerDown(i)}delegateScrollFromMouseWheelEvent(i){this.scrollbar.delegateScrollFromMouseWheelEvent(i)}onConfigurationChanged(i){if(i.hasChanged(117)||i.hasChanged(83)||i.hasChanged(49)){let e=this._context.configuration.options,t=e.get(117),o=e.get(83),n=e.get(49),r=e.get(120),s={vertical:t.vertical,horizontal:t.horizontal,verticalScrollbarSize:t.verticalScrollbarSize,horizontalScrollbarSize:t.horizontalScrollbarSize,scrollByPage:t.scrollByPage,handleMouseWheel:t.handleMouseWheel,mouseWheelScrollSensitivity:o,fastScrollSensitivity:n,scrollPredominantAxis:r};this.scrollbar.updateOptions(s)}return i.hasChanged(165)&&this._setLayout(),!0}onScrollChanged(i){return!0}onThemeChanged(i){return this.scrollbar.updateClassName("editor-scrollable "+J$(this._context.theme.type)),!0}prepareRender(i){}render(i){this.scrollbar.renderNow()}};var Yse=class{constructor(i,e,t,o,n){this.startLineNumber=i;this.endLineNumber=e;this.className=t;this.tooltip=o;this._decorationToRenderBrand=void 0;this.zIndex=n??0}},MJt=class{constructor(i,e,t){this.className=i;this.zIndex=e;this.tooltip=t}},PJt=class{constructor(){this.decorations=[]}add(i){this.decorations.push(i)}getDecorations(){return this.decorations}},OIe=class extends Jw{_render(i,e,t){let o=[];for(let s=i;s<=e;s++){let l=s-i;o[l]=new PJt}if(t.length===0)return o;t.sort((s,l)=>s.className===l.className?s.startLineNumber===l.startLineNumber?s.endLineNumber-l.endLineNumber:s.startLineNumber-l.startLineNumber:s.className<l.className?-1:1);let n=null,r=0;for(let s of t){let l=s.className,c=s.zIndex,u=Math.max(s.startLineNumber,i)-i,p=Math.min(s.endLineNumber,e)-i;n===l?(u=Math.max(r+1,u),r=Math.max(r,p)):(n=l,r=p);for(let h=u;h<=r;h++)o[h].add(new MJt(l,c,s.tooltip))}return o}},Lft=class extends mu{constructor(e){super(e);this._widgets={};this._context=e;let t=this._context.configuration.options,o=t.get(165);this.domNode=or(document.createElement("div")),this.domNode.setClassName("glyph-margin-widgets"),this.domNode.setPosition("absolute"),this.domNode.setTop(0),this._lineHeight=t.get(75),this._glyphMargin=t.get(66),this._glyphMarginLeft=o.glyphMarginLeft,this._glyphMarginWidth=o.glyphMarginWidth,this._glyphMarginDecorationLaneCount=o.glyphMarginDecorationLaneCount,this._managedDomNodes=[],this._decorationGlyphsToRender=[]}dispose(){this._managedDomNodes=[],this._decorationGlyphsToRender=[],this._widgets={},super.dispose()}getWidgets(){return Object.values(this._widgets)}onConfigurationChanged(e){let t=this._context.configuration.options,o=t.get(165);return this._lineHeight=t.get(75),this._glyphMargin=t.get(66),this._glyphMarginLeft=o.glyphMarginLeft,this._glyphMarginWidth=o.glyphMarginWidth,this._glyphMarginDecorationLaneCount=o.glyphMarginDecorationLaneCount,!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}addWidget(e){let t=or(e.getDomNode());this._widgets[e.getId()]={widget:e,preference:e.getPosition(),domNode:t,renderInfo:null},t.setPosition("absolute"),t.setDisplay("none"),t.setAttribute("widgetId",e.getId()),this.domNode.appendChild(t),this.setShouldRender()}setWidgetPosition(e,t){let o=this._widgets[e.getId()];return o.preference.lane===t.lane&&o.preference.zIndex===t.zIndex&&z.equalsRange(o.preference.range,t.range)?!1:(o.preference=t,this.setShouldRender(),!0)}removeWidget(e){let t=e.getId();if(this._widgets[t]){let n=this._widgets[t].domNode.domNode;delete this._widgets[t],n.remove(),this.setShouldRender()}}_collectDecorationBasedGlyphRenderRequest(e,t){let o=e.visibleRange.startLineNumber,n=e.visibleRange.endLineNumber,r=e.getDecorationsInViewport();for(let s of r){let l=s.options.glyphMarginClassName;if(!l)continue;let c=Math.max(s.range.startLineNumber,o),u=Math.min(s.range.endLineNumber,n),p=s.options.glyphMargin?.position??2,h=s.options.zIndex??0;for(let g=c;g<=u;g++){let f=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new Ie(g,0)),v=this._context.viewModel.glyphLanes.getLanesAtLine(f.lineNumber).indexOf(p);t.push(new AJt(g,v,h,l))}}}_collectWidgetBasedGlyphRenderRequest(e,t){let o=e.visibleRange.startLineNumber,n=e.visibleRange.endLineNumber;for(let r of Object.values(this._widgets)){let s=r.preference.range,{startLineNumber:l,endLineNumber:c}=this._context.viewModel.coordinatesConverter.convertModelRangeToViewRange(z.lift(s));if(!l||!c||c<o||l>n)continue;let u=Math.max(l,o),p=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new Ie(u,0)),h=this._context.viewModel.glyphLanes.getLanesAtLine(p.lineNumber).indexOf(r.preference.lane);t.push(new NJt(u,h,r.preference.zIndex,r))}}_collectSortedGlyphRenderRequests(e){let t=[];return this._collectDecorationBasedGlyphRenderRequest(e,t),this._collectWidgetBasedGlyphRenderRequest(e,t),t.sort((o,n)=>o.lineNumber===n.lineNumber?o.laneIndex===n.laneIndex?o.zIndex===n.zIndex?n.type===o.type?o.type===0&&n.type===0?o.className<n.className?-1:1:0:n.type-o.type:n.zIndex-o.zIndex:o.laneIndex-n.laneIndex:o.lineNumber-n.lineNumber),t}prepareRender(e){if(!this._glyphMargin){this._decorationGlyphsToRender=[];return}for(let n of Object.values(this._widgets))n.renderInfo=null;let t=new bS(this._collectSortedGlyphRenderRequests(e)),o=[];for(;t.length>0;){let n=t.peek();if(!n)break;let r=t.takeWhile(l=>l.lineNumber===n.lineNumber&&l.laneIndex===n.laneIndex);if(!r||r.length===0)break;let s=r[0];if(s.type===0){let l=[];for(let c of r){if(c.zIndex!==s.zIndex||c.type!==s.type)break;(l.length===0||l[l.length-1]!==c.className)&&l.push(c.className)}o.push(s.accept(l.join(" ")))}else s.widget.renderInfo={lineNumber:s.lineNumber,laneIndex:s.laneIndex}}this._decorationGlyphsToRender=o}render(e){if(!this._glyphMargin){for(let o of Object.values(this._widgets))o.domNode.setDisplay("none");for(;this._managedDomNodes.length>0;)this._managedDomNodes.pop()?.domNode.remove();return}let t=Math.round(this._glyphMarginWidth/this._glyphMarginDecorationLaneCount);for(let o of Object.values(this._widgets))if(!o.renderInfo)o.domNode.setDisplay("none");else{let n=e.viewportData.relativeVerticalOffset[o.renderInfo.lineNumber-e.viewportData.startLineNumber],r=this._glyphMarginLeft+o.renderInfo.laneIndex*this._lineHeight;o.domNode.setDisplay("block"),o.domNode.setTop(n),o.domNode.setLeft(r),o.domNode.setWidth(t),o.domNode.setHeight(this._lineHeight)}for(let o=0;o<this._decorationGlyphsToRender.length;o++){let n=this._decorationGlyphsToRender[o],r=n.lineNumber,s=e.viewportData.relativeVerticalOffset[r-e.viewportData.startLineNumber],l=this._glyphMarginLeft+n.laneIndex*this._lineHeight,c;o<this._managedDomNodes.length?c=this._managedDomNodes[o]:(c=or(document.createElement("div")),this._managedDomNodes.push(c),this.domNode.appendChild(c));let u=this._context.viewLayout.getLineHeightForLineNumber(r);c.setClassName("cgmr codicon "+n.combinedClassName),c.setPosition("absolute"),c.setTop(s),c.setLeft(l),c.setWidth(t),c.setHeight(u)}for(;this._managedDomNodes.length>this._decorationGlyphsToRender.length;)this._managedDomNodes.pop()?.domNode.remove()}};var AJt=class{constructor(i,e,t,o){this.lineNumber=i;this.laneIndex=e;this.zIndex=t;this.className=o;this.type=0}accept(i){return new OJt(this.lineNumber,this.laneIndex,i)}},NJt=class{constructor(i,e,t,o){this.lineNumber=i;this.laneIndex=e;this.zIndex=t;this.widget=o;this.type=1}},OJt=class{constructor(i,e,t){this.lineNumber=i;this.laneIndex=e;this.combinedClassName=t}};var FIe=class extends C{constructor(){super(...arguments);this._isDisposed=!1}dispose(){super.dispose(),this._isDisposed=!0}assertNotDisposed(){if(this._isDisposed)throw new Error("TextModelPart is disposed!")}};function eq(a,i){let e=0,t=0,o=a.length;for(;t<o;){let n=a.charCodeAt(t);if(n===32)e++;else if(n===9)e=e-e%i+i;else break;t++}return t===o?-1:e}var VN=class{constructor(i,e,t,o,n,r){this.visibleColumn=i;this.column=e;this.className=t;this.horizontalLine=o;this.forWrappedLinesAfterColumn=n;this.forWrappedLinesBeforeOrAtColumn=r;if(i!==-1==(e!==-1))throw new Error}},tq=class{constructor(i,e){this.top=i;this.endColumn=e}};var Rft=class extends FIe{constructor(e,t){super();this.textModel=e;this.languageConfigurationService=t}getLanguageConfiguration(e){return this.languageConfigurationService.getLanguageConfiguration(e)}_computeIndentLevel(e){return eq(this.textModel.getLineContent(e+1),this.textModel.getOptions().tabSize)}getActiveIndentGuide(e,t,o){this.assertNotDisposed();let n=this.textModel.getLineCount();if(e<1||e>n)throw new ni("Illegal value for lineNumber");let r=this.getLanguageConfiguration(this.textModel.getLanguageId()).foldingRules,s=!!(r&&r.offSide),l=-2,c=-1,u=-2,p=-1,h=V=>{if(l!==-1&&(l===-2||l>V-1)){l=-1,c=-1;for(let U=V-2;U>=0;U--){let G=this._computeIndentLevel(U);if(G>=0){l=U,c=G;break}}}if(u===-2){u=-1,p=-1;for(let U=V;U<n;U++){let G=this._computeIndentLevel(U);if(G>=0){u=U,p=G;break}}}},g=-2,f=-1,v=-2,b=-1,S=V=>{if(g===-2){g=-1,f=-1;for(let U=V-2;U>=0;U--){let G=this._computeIndentLevel(U);if(G>=0){g=U,f=G;break}}}if(v!==-1&&(v===-2||v<V-1)){v=-1,b=-1;for(let U=V;U<n;U++){let G=this._computeIndentLevel(U);if(G>=0){v=U,b=G;break}}}},y=0,w=!0,k=0,T=!0,N=0,O=0;for(let V=0;w||T;V++){let U=e-V,G=e+V;V>1&&(U<1||U<t)&&(w=!1),V>1&&(G>n||G>o)&&(T=!1),V>5e4&&(w=!1,T=!1);let $=-1;if(w&&U>=1){let pe=this._computeIndentLevel(U-1);pe>=0?(u=U-1,p=pe,$=Math.ceil(pe/this.textModel.getOptions().indentSize)):(h(U),$=this._getIndentLevelForWhitespaceLine(s,c,p))}let te=-1;if(T&&G<=n){let pe=this._computeIndentLevel(G-1);pe>=0?(g=G-1,f=pe,te=Math.ceil(pe/this.textModel.getOptions().indentSize)):(S(G),te=this._getIndentLevelForWhitespaceLine(s,f,b))}if(V===0){O=$;continue}if(V===1){if(G<=n&&te>=0&&O+1===te){w=!1,y=G,k=G,N=te;continue}if(U>=1&&$>=0&&$-1===O){T=!1,y=U,k=U,N=$;continue}if(y=e,k=e,N=O,N===0)return{startLineNumber:y,endLineNumber:k,indent:N}}w&&($>=N?y=U:w=!1),T&&(te>=N?k=G:T=!1)}return{startLineNumber:y,endLineNumber:k,indent:N}}getLinesBracketGuides(e,t,o,n){let r=[];for(let h=e;h<=t;h++)r.push([]);let s=!0,l=this.textModel.bracketPairs.getBracketPairsInRangeWithMinIndentation(new z(e,1,t,this.textModel.getLineMaxColumn(t))).toArray(),c;if(o&&l.length>0){let h=(e<=o.lineNumber&&o.lineNumber<=t?l:this.textModel.bracketPairs.getBracketPairsInRange(z.fromPositions(o)).toArray()).filter(g=>z.strictContainsPosition(g.range,o));c=ju(h,g=>s||g.range.startLineNumber!==g.range.endLineNumber)?.range}let u=this.textModel.getOptions().bracketPairColorizationOptions.independentColorPoolPerBracketType,p=new nqe;for(let h of l){if(!h.closingBracketRange)continue;let g=c&&h.range.equalsRange(c);if(!g&&!n.includeInactive)continue;let f=p.getInlineClassName(h.nestingLevel,h.nestingLevelOfEqualBracketType,u)+(n.highlightActive&&g?" "+p.activeClassName:""),v=h.openingBracketRange.getStartPosition(),b=h.closingBracketRange.getStartPosition(),S=n.horizontalGuides===2||n.horizontalGuides===1&&g;if(h.range.startLineNumber===h.range.endLineNumber){s&&S&&r[h.range.startLineNumber-e].push(new VN(-1,h.openingBracketRange.getEndPosition().column,f,new tq(!1,b.column),-1,-1));continue}let y=this.getVisibleColumnFromPosition(b),w=this.getVisibleColumnFromPosition(h.openingBracketRange.getStartPosition()),k=Math.min(w,y,h.minVisibleColumnIndentation+1),T=!1;Ap(this.textModel.getLineContent(h.closingBracketRange.startLineNumber))<h.closingBracketRange.startColumn-1&&(T=!0);let V=Math.max(v.lineNumber,e),U=Math.min(b.lineNumber,t),G=T?1:0;for(let $=V;$<U+G;$++)r[$-e].push(new VN(k,-1,f,null,$===v.lineNumber?v.column:-1,$===b.lineNumber?b.column:-1));S&&(v.lineNumber>=e&&w>k&&r[v.lineNumber-e].push(new VN(k,-1,f,new tq(!1,v.column),-1,-1)),b.lineNumber<=t&&y>k&&r[b.lineNumber-e].push(new VN(k,-1,f,new tq(!T,b.column),-1,-1)))}for(let h of r)h.sort((g,f)=>g.visibleColumn-f.visibleColumn);return r}getVisibleColumnFromPosition(e){return al.visibleColumnFromColumn(this.textModel.getLineContent(e.lineNumber),e.column,this.textModel.getOptions().tabSize)+1}getLinesIndentGuides(e,t){this.assertNotDisposed();let o=this.textModel.getLineCount();if(e<1||e>o)throw new Error("Illegal value for startLineNumber");if(t<1||t>o)throw new Error("Illegal value for endLineNumber");let n=this.textModel.getOptions(),r=this.getLanguageConfiguration(this.textModel.getLanguageId()).foldingRules,s=!!(r&&r.offSide),l=new Array(t-e+1),c=-2,u=-1,p=-2,h=-1;for(let g=e;g<=t;g++){let f=g-e,v=this._computeIndentLevel(g-1);if(v>=0){c=g-1,u=v,l[f]=Math.ceil(v/n.indentSize);continue}if(c===-2){c=-1,u=-1;for(let b=g-2;b>=0;b--){let S=this._computeIndentLevel(b);if(S>=0){c=b,u=S;break}}}if(p!==-1&&(p===-2||p<g-1)){p=-1,h=-1;for(let b=g;b<o;b++){let S=this._computeIndentLevel(b);if(S>=0){p=b,h=S;break}}}l[f]=this._getIndentLevelForWhitespaceLine(s,u,h)}return l}_getIndentLevelForWhitespaceLine(e,t,o){let n=this.textModel.getOptions();return t===-1||o===-1?0:t<o?1+Math.floor(t/n.indentSize):t===o||e?Math.ceil(o/n.indentSize):1+Math.floor(o/n.indentSize)}},nqe=class{constructor(){this.activeClassName="indent-active"}getInlineClassName(i,e,t){return this.getInlineClassNameOfLevel(t?e:i)}getInlineClassNameOfLevel(i){return`bracket-indent-guide lvl-${i%30}`}};var Mft=class extends Jw{constructor(i){super(),this._context=i,this._primaryPosition=null;let e=this._context.configuration.options,t=e.get(166),o=e.get(59);this._spaceWidth=o.spaceWidth,this._maxIndentLeft=t.wrappingColumn===-1?-1:t.wrappingColumn*o.typicalHalfwidthCharacterWidth,this._bracketPairGuideOptions=e.get(22),this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(i){let e=this._context.configuration.options,t=e.get(166),o=e.get(59);return this._spaceWidth=o.spaceWidth,this._maxIndentLeft=t.wrappingColumn===-1?-1:t.wrappingColumn*o.typicalHalfwidthCharacterWidth,this._bracketPairGuideOptions=e.get(22),!0}onCursorStateChanged(i){let t=i.selections[0].getPosition();return this._primaryPosition?.equals(t)?!1:(this._primaryPosition=t,!0)}onDecorationsChanged(i){return!0}onFlushed(i){return!0}onLinesChanged(i){return!0}onLinesDeleted(i){return!0}onLinesInserted(i){return!0}onScrollChanged(i){return i.scrollTopChanged}onZonesChanged(i){return!0}onLanguageConfigurationChanged(i){return!0}prepareRender(i){if(!this._bracketPairGuideOptions.indentation&&this._bracketPairGuideOptions.bracketPairs===!1){this._renderResult=null;return}let e=i.visibleRange.startLineNumber,t=i.visibleRange.endLineNumber,o=i.scrollWidth,n=this._primaryPosition,r=this.getGuidesByLine(e,Math.min(t+1,this._context.viewModel.getLineCount()),n),s=[];for(let l=e;l<=t;l++){let c=l-e,u=r[c],p="",h=i.visibleRangeForPosition(new Ie(l,1))?.left??0;for(let g of u){let f=g.column===-1?h+(g.visibleColumn-1)*this._spaceWidth:i.visibleRangeForPosition(new Ie(l,g.column)).left;if(f>o||this._maxIndentLeft>0&&f>this._maxIndentLeft)break;let v=g.horizontalLine?g.horizontalLine.top?"horizontal-top":"horizontal-bottom":"vertical",b=g.horizontalLine?(i.visibleRangeForPosition(new Ie(l,g.horizontalLine.endColumn))?.left??f+this._spaceWidth)-f:this._spaceWidth;p+=`<div class="core-guide ${g.className} ${v}" style="left:${f}px;width:${b}px"></div>`}s[c]=p}this._renderResult=s}getGuidesByLine(i,e,t){let o=this._bracketPairGuideOptions.bracketPairs!==!1?this._context.viewModel.getBracketGuidesInRangeByLine(i,e,t,{highlightActive:this._bracketPairGuideOptions.highlightActiveBracketPair,horizontalGuides:this._bracketPairGuideOptions.bracketPairsHorizontal===!0?2:this._bracketPairGuideOptions.bracketPairsHorizontal==="active"?1:0,includeInactive:this._bracketPairGuideOptions.bracketPairs===!0}):null,n=this._bracketPairGuideOptions.indentation?this._context.viewModel.getLinesIndentGuides(i,e):null,r=0,s=0,l=0;if(this._bracketPairGuideOptions.highlightActiveIndentation!==!1&&t){let p=this._context.viewModel.getActiveIndentGuide(t.lineNumber,i,e);r=p.startLineNumber,s=p.endLineNumber,l=p.indent}let{indentSize:c}=this._context.viewModel.model.getOptions(),u=[];for(let p=i;p<=e;p++){let h=new Array;u.push(h);let g=o?o[p-i]:[],f=new bS(g),v=n?n[p-i]:0;for(let b=1;b<=v;b++){let S=(b-1)*c+1,y=(this._bracketPairGuideOptions.highlightActiveIndentation==="always"||g.length===0)&&r<=p&&p<=s&&b===l;h.push(...f.takeWhile(k=>k.visibleColumn<S)||[]);let w=f.peek();(!w||w.visibleColumn!==S||w.horizontalLine)&&h.push(new VN(S,-1,`core-guide-indent lvl-${(b-1)%30}`+(y?" indent-active":""),null,-1,-1))}h.push(...f.takeWhile(b=>!0)||[])}return u}render(i,e){if(!this._renderResult)return"";let t=e-i;return t<0||t>=this._renderResult.length?"":this._renderResult[t]}};function WIe(a){if(!(a&&a.isTransparent()))return a}is((a,i)=>{let e=[{bracketColor:Sft,guideColor:fqi,guideColorActive:wqi},{bracketColor:Ift,guideColor:vqi,guideColorActive:Cqi},{bracketColor:yft,guideColor:bqi,guideColorActive:xqi},{bracketColor:wft,guideColor:Sqi,guideColorActive:kqi},{bracketColor:Cft,guideColor:Iqi,guideColorActive:Eqi},{bracketColor:xft,guideColor:yqi,guideColorActive:Tqi}],t=new nqe,o=[{indentColor:fft,indentColorActive:vft},{indentColor:J$i,indentColorActive:oqi},{indentColor:Z$i,indentColorActive:nqi},{indentColor:eqi,indentColorActive:rqi},{indentColor:tqi,indentColorActive:sqi},{indentColor:iqi,indentColorActive:aqi}],n=e.map(s=>{let l=a.getColor(s.bracketColor),c=a.getColor(s.guideColor),u=a.getColor(s.guideColorActive),p=WIe(WIe(c)??l?.transparent(.3)),h=WIe(WIe(u)??l);if(!(!p||!h))return{guideColor:p,guideColorActive:h}}).filter(mo),r=o.map(s=>{let l=a.getColor(s.indentColor),c=a.getColor(s.indentColorActive),u=WIe(l),p=WIe(c);if(!(!u||!p))return{indentColor:u,indentColorActive:p}}).filter(mo);if(n.length>0){for(let s=0;s<30;s++){let l=n[s%n.length];i.addRule(`.monaco-editor .${t.getInlineClassNameOfLevel(s).replace(/ /g,".")} { --guide-color: ${l.guideColor}; --guide-color-active: ${l.guideColorActive}; }`)}i.addRule(".monaco-editor .vertical { box-shadow: 1px 0 0 0 var(--guide-color) inset; }"),i.addRule(".monaco-editor .horizontal-top { border-top: 1px solid var(--guide-color); }"),i.addRule(".monaco-editor .horizontal-bottom { border-bottom: 1px solid var(--guide-color); }"),i.addRule(`.monaco-editor .vertical.${t.activeClassName} { box-shadow: 1px 0 0 0 var(--guide-color-active) inset; }`),i.addRule(`.monaco-editor .horizontal-top.${t.activeClassName} { border-top: 1px solid var(--guide-color-active); }`),i.addRule(`.monaco-editor .horizontal-bottom.${t.activeClassName} { border-bottom: 1px solid var(--guide-color-active); }`)}if(r.length>0){for(let s=0;s<30;s++){let l=r[s%r.length];i.addRule(`.monaco-editor .lines-content .core-guide-indent.lvl-${s} { --indent-color: ${l.indentColor}; --indent-color-active: ${l.indentColorActive}; }`)}i.addRule(".monaco-editor .lines-content .core-guide-indent { box-shadow: 1px 0 0 0 var(--indent-color) inset; }"),i.addRule(".monaco-editor .lines-content .core-guide-indent.indent-active { box-shadow: 1px 0 0 0 var(--indent-color-active) inset; }")}});var VIe=class a extends Jw{static{this.CLASS_NAME="line-numbers"}constructor(i){super(),this._context=i,this._readConfig(),this._lastCursorModelPosition=new Ie(1,1),this._renderResult=null,this._activeModelLineNumber=1,this._context.addEventHandler(this)}_readConfig(){let i=this._context.configuration.options;this._lineHeight=i.get(75);let e=i.get(76);this._renderLineNumbers=e.renderType,this._renderCustomLineNumbers=e.renderFn,this._renderFinalNewline=i.get(109);let t=i.get(165);this._lineNumbersLeft=t.lineNumbersLeft,this._lineNumbersWidth=t.lineNumbersWidth}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(i){return this._readConfig(),!0}onCursorStateChanged(i){let e=i.selections[0].getPosition();this._lastCursorModelPosition=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(e);let t=!1;return this._activeModelLineNumber!==this._lastCursorModelPosition.lineNumber&&(this._activeModelLineNumber=this._lastCursorModelPosition.lineNumber,t=!0),(this._renderLineNumbers===2||this._renderLineNumbers===3)&&(t=!0),t}onFlushed(i){return!0}onLinesChanged(i){return!0}onLinesDeleted(i){return!0}onLinesInserted(i){return!0}onScrollChanged(i){return i.scrollTopChanged}onZonesChanged(i){return!0}onDecorationsChanged(i){return i.affectsLineNumber}_getLineRenderLineNumber(i){let e=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new Ie(i,1));if(e.column!==1)return"";let t=e.lineNumber;if(this._renderCustomLineNumbers)return this._renderCustomLineNumbers(t);if(this._renderLineNumbers===2){let o=Math.abs(this._lastCursorModelPosition.lineNumber-t);return o===0?'<span class="relative-current-line-number">'+t+"</span>":String(o)}if(this._renderLineNumbers===3){if(this._lastCursorModelPosition.lineNumber===t||t%10===0)return String(t);let o=this._context.viewModel.getLineCount();return t===o?String(t):""}return String(t)}prepareRender(i){if(this._renderLineNumbers===0){this._renderResult=null;return}let e=Wn?this._lineHeight%2===0?" lh-even":" lh-odd":"",t=i.visibleRange.startLineNumber,o=i.visibleRange.endLineNumber,n=this._context.viewModel.getDecorationsInViewport(i.visibleRange).filter(c=>!!c.options.lineNumberClassName);n.sort((c,u)=>z.compareRangesUsingEnds(c.range,u.range));let r=0,s=this._context.viewModel.getLineCount(),l=[];for(let c=t;c<=o;c++){let u=c-t,p=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new Ie(c,1)).lineNumber,h=this._getLineRenderLineNumber(c),g="";for(;r<n.length&&n[r].range.endLineNumber<c;)r++;for(let f=r;f<n.length;f++){let{range:v,options:b}=n[f];v.startLineNumber<=c&&(g+=" "+b.lineNumberClassName)}if(!h&&!g){l[u]="";continue}c===s&&this._context.viewModel.getLineLength(c)===0&&(this._renderFinalNewline==="off"&&(h=""),this._renderFinalNewline==="dimmed"&&(g+=" dimmed-line-number")),p===this._activeModelLineNumber&&(g+=" active-line-number"),l[u]=`<div class="${a.CLASS_NAME}${e}${g}" style="left:${this._lineNumbersLeft}px;width:${this._lineNumbersWidth}px;">${h}</div>`}this._renderResult=l}render(i,e){if(!this._renderResult)return"";let t=e-i;return t<0||t>=this._renderResult.length?"":this._renderResult[t]}};is((a,i)=>{let e=a.getColor(X$i),t=a.getColor(lqi);t?i.addRule(`.monaco-editor .line-numbers.dimmed-line-number { color: ${t}; }`):e&&i.addRule(`.monaco-editor .line-numbers.dimmed-line-number { color: ${e.transparent(.4)}; }`)});var tE="monaco-mouse-cursor-text";var BIe=class{constructor(i,e){this._domNode=i;this.endNode=e;this._didDomLayout=!1;this._clientRectDeltaLeft=0;this._clientRectScale=1;this._clientRectRead=!1}get didDomLayout(){return this._didDomLayout}readClientRect(){if(!this._clientRectRead){this._clientRectRead=!0;let i=this._domNode.getBoundingClientRect();this.markDidDomLayout(),this._clientRectDeltaLeft=i.left;let e=this._domNode.offsetWidth;this._clientRectScale=e>0?i.width/e:1}}get clientRectDeltaLeft(){return this._clientRectRead||this.readClientRect(),this._clientRectDeltaLeft}get clientRectScale(){return this._clientRectRead||this.readClientRect(),this._clientRectScale}markDidDomLayout(){this._didDomLayout=!0}};var iq=class{constructor(i,e){this.themeType=e;let t=i.options,o=t.get(59);this.renderWhitespace=t.get(113),this.experimentalWhitespaceRendering=t.get(47),this.renderControlCharacters=t.get(108),this.spaceWidth=o.spaceWidth,this.middotWidth=o.middotWidth,this.wsmiddotWidth=o.wsmiddotWidth,this.useMonospaceOptimizations=o.isMonospace&&!t.get(40),this.canUseHalfwidthRightwardsArrow=o.canUseHalfwidthRightwardsArrow,this.lineHeight=t.get(75),this.stopRenderingLineAfter=t.get(133),this.fontLigatures=t.get(60),this.verticalScrollbarSize=t.get(117).verticalScrollbarSize,this.useGpu=t.get(46)==="on"}equals(i){return this.themeType===i.themeType&&this.renderWhitespace===i.renderWhitespace&&this.experimentalWhitespaceRendering===i.experimentalWhitespaceRendering&&this.renderControlCharacters===i.renderControlCharacters&&this.spaceWidth===i.spaceWidth&&this.middotWidth===i.middotWidth&&this.wsmiddotWidth===i.wsmiddotWidth&&this.useMonospaceOptimizations===i.useMonospaceOptimizations&&this.canUseHalfwidthRightwardsArrow===i.canUseHalfwidthRightwardsArrow&&this.lineHeight===i.lineHeight&&this.stopRenderingLineAfter===i.stopRenderingLineAfter&&this.fontLigatures===i.fontLigatures&&this.verticalScrollbarSize===i.verticalScrollbarSize&&this.useGpu===i.useGpu}};var FJt=class{constructor(){this._currentVisibleRange=new z(1,1,1,1)}getCurrentVisibleRange(){return this._currentVisibleRange}setCurrentVisibleRange(i){this._currentVisibleRange=i}},WJt=class{constructor(i,e,t,o,n,r,s){this.minimalReveal=i;this.lineNumber=e;this.startColumn=t;this.endColumn=o;this.startScrollTop=n;this.stopScrollTop=r;this.scrollType=s;this.type="range";this.minLineNumber=e,this.maxLineNumber=e}},VJt=class{constructor(i,e,t,o,n){this.minimalReveal=i;this.selections=e;this.startScrollTop=t;this.stopScrollTop=o;this.scrollType=n;this.type="selections";let r=e[0].startLineNumber,s=e[0].endLineNumber;for(let l=1,c=e.length;l<c;l++){let u=e[l];r=Math.min(r,u.startLineNumber),s=Math.max(s,u.endLineNumber)}this.minLineNumber=r,this.maxLineNumber=s}},Pft=class a extends mu{static{this.HORIZONTAL_EXTRA_PX=30}constructor(i,e,t){super(i);let o=this._context.configuration,n=this._context.configuration.options,r=n.get(59),s=n.get(166);this._lineHeight=n.get(75),this._typicalHalfwidthCharacterWidth=r.typicalHalfwidthCharacterWidth,this._isViewportWrapping=s.isViewportWrapping,this._revealHorizontalRightPadding=n.get(114),this._cursorSurroundingLines=n.get(35),this._cursorSurroundingLinesStyle=n.get(36),this._canUseLayerHinting=!n.get(39),this._viewLineOptions=new iq(o,this._context.theme.type),this._linesContent=t,this._textRangeRestingSpot=document.createElement("div"),this._visibleLines=new RIe(this._context,{createLine:()=>new pW(e,this._viewLineOptions)}),this.domNode=this._visibleLines.domNode,PS.write(this.domNode,8),this.domNode.setClassName(`view-lines ${tE}`),Pd(this.domNode,r),this._maxLineWidth=0,this._asyncUpdateLineWidths=new Dt(()=>{this._updateLineWidthsSlow()},200),this._asyncCheckMonospaceFontAssumptions=new Dt(()=>{this._checkMonospaceFontAssumptions()},2e3),this._lastRenderedData=new FJt,this._horizontalRevealRequest=null,this._stickyScrollEnabled=n.get(131).enabled,this._maxNumberStickyLines=n.get(131).maxLineCount}dispose(){this._asyncUpdateLineWidths.dispose(),this._asyncCheckMonospaceFontAssumptions.dispose(),super.dispose()}getDomNode(){return this.domNode}onConfigurationChanged(i){this._visibleLines.onConfigurationChanged(i),i.hasChanged(166)&&(this._maxLineWidth=0);let e=this._context.configuration.options,t=e.get(59),o=e.get(166);return this._lineHeight=e.get(75),this._typicalHalfwidthCharacterWidth=t.typicalHalfwidthCharacterWidth,this._isViewportWrapping=o.isViewportWrapping,this._revealHorizontalRightPadding=e.get(114),this._cursorSurroundingLines=e.get(35),this._cursorSurroundingLinesStyle=e.get(36),this._canUseLayerHinting=!e.get(39),this._stickyScrollEnabled=e.get(131).enabled,this._maxNumberStickyLines=e.get(131).maxLineCount,Pd(this.domNode,t),this._onOptionsMaybeChanged(),i.hasChanged(165)&&(this._maxLineWidth=0),!0}_onOptionsMaybeChanged(){let i=this._context.configuration,e=new iq(i,this._context.theme.type);if(!this._viewLineOptions.equals(e)){this._viewLineOptions=e;let t=this._visibleLines.getStartLineNumber(),o=this._visibleLines.getEndLineNumber();for(let n=t;n<=o;n++)this._visibleLines.getVisibleLine(n).onOptionsChanged(this._viewLineOptions);return!0}return!1}onCursorStateChanged(i){let e=this._visibleLines.getStartLineNumber(),t=this._visibleLines.getEndLineNumber(),o=!1;for(let n=e;n<=t;n++)o=this._visibleLines.getVisibleLine(n).onSelectionChanged()||o;return o}onDecorationsChanged(i){let e=this._visibleLines.getStartLineNumber(),t=this._visibleLines.getEndLineNumber();for(let o=e;o<=t;o++)this._visibleLines.getVisibleLine(o).onDecorationsChanged();return!0}onFlushed(i){let e=this._visibleLines.onFlushed(i,this._viewLineOptions.useGpu);return this._maxLineWidth=0,e}onLinesChanged(i){return this._visibleLines.onLinesChanged(i)}onLinesDeleted(i){return this._visibleLines.onLinesDeleted(i)}onLinesInserted(i){return this._visibleLines.onLinesInserted(i)}onRevealRangeRequest(i){let e=this._computeScrollTopToRevealRange(this._context.viewLayout.getFutureViewport(),i.source,i.minimalReveal,i.range,i.selections,i.verticalType);if(e===-1)return!1;let t=this._context.viewLayout.validateScrollPosition({scrollTop:e});i.revealHorizontal?i.range&&i.range.startLineNumber!==i.range.endLineNumber?t={scrollTop:t.scrollTop,scrollLeft:0}:i.range?this._horizontalRevealRequest=new WJt(i.minimalReveal,i.range.startLineNumber,i.range.startColumn,i.range.endColumn,this._context.viewLayout.getCurrentScrollTop(),t.scrollTop,i.scrollType):i.selections&&i.selections.length>0&&(this._horizontalRevealRequest=new VJt(i.minimalReveal,i.selections,this._context.viewLayout.getCurrentScrollTop(),t.scrollTop,i.scrollType)):this._horizontalRevealRequest=null;let n=Math.abs(this._context.viewLayout.getCurrentScrollTop()-t.scrollTop)<=this._lineHeight?1:i.scrollType;return this._context.viewModel.viewLayout.setScrollPosition(t,n),!0}onScrollChanged(i){if(this._horizontalRevealRequest&&i.scrollLeftChanged&&(this._horizontalRevealRequest=null),this._horizontalRevealRequest&&i.scrollTopChanged){let e=Math.min(this._horizontalRevealRequest.startScrollTop,this._horizontalRevealRequest.stopScrollTop),t=Math.max(this._horizontalRevealRequest.startScrollTop,this._horizontalRevealRequest.stopScrollTop);(i.scrollTop<e||i.scrollTop>t)&&(this._horizontalRevealRequest=null)}return this.domNode.setWidth(i.scrollWidth),this._visibleLines.onScrollChanged(i)||i.scrollTopChanged||i.scrollLeftChanged}onTokensChanged(i){return this._visibleLines.onTokensChanged(i)}onZonesChanged(i){return this._context.viewModel.viewLayout.setMaxLineWidth(this._maxLineWidth),this._visibleLines.onZonesChanged(i)}onThemeChanged(i){return this._onOptionsMaybeChanged()}getPositionFromDOMInfo(i,e){let t=this._getViewLineDomNode(i);if(t===null)return null;let o=this._getLineNumberFor(t);if(o===-1||o<1||o>this._context.viewModel.getLineCount())return null;if(this._context.viewModel.getLineMaxColumn(o)===1)return new Ie(o,1);let n=this._visibleLines.getStartLineNumber(),r=this._visibleLines.getEndLineNumber();if(o<n||o>r)return null;let s=this._visibleLines.getVisibleLine(o).getColumnOfNodeOffset(i,e),l=this._context.viewModel.getLineMinColumn(o);return s<l&&(s=l),new Ie(o,s)}_getViewLineDomNode(i){for(;i&&i.nodeType===1;){if(i.className===pW.CLASS_NAME)return i;i=i.parentElement}return null}_getLineNumberFor(i){let e=this._visibleLines.getStartLineNumber(),t=this._visibleLines.getEndLineNumber();for(let o=e;o<=t;o++){let n=this._visibleLines.getVisibleLine(o);if(i===n.getDomNode())return o}return-1}getLineWidth(i){let e=this._visibleLines.getStartLineNumber(),t=this._visibleLines.getEndLineNumber();if(i<e||i>t)return-1;let o=new BIe(this.domNode.domNode,this._textRangeRestingSpot),n=this._visibleLines.getVisibleLine(i).getWidth(o);return this._updateLineWidthsSlowIfDomDidLayout(o),n}resetLineWidthCaches(){let i=this._visibleLines.getStartLineNumber(),e=this._visibleLines.getEndLineNumber();for(let t=i;t<=e;t++)this._visibleLines.getVisibleLine(t).resetCachedWidth()}linesVisibleRangesForRange(i,e){let t=i.endLineNumber,o=z.intersectRanges(i,this._lastRenderedData.getCurrentVisibleRange());if(!o)return null;let n=[],r=0,s=new BIe(this.domNode.domNode,this._textRangeRestingSpot),l=0;e&&(l=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new Ie(o.startLineNumber,1)).lineNumber);let c=this._visibleLines.getStartLineNumber(),u=this._visibleLines.getEndLineNumber();for(let p=o.startLineNumber;p<=o.endLineNumber;p++){if(p<c||p>u)continue;let h=p===o.startLineNumber?o.startColumn:1,g=p!==t,f=g?this._context.viewModel.getLineMaxColumn(p):o.endColumn,b=this._visibleLines.getVisibleLine(p).getVisibleRangesForRange(p,h,f,s);if(b){if(e&&p<t){let S=l;if(l=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new Ie(p+1,1)).lineNumber,S!==l){let y=b.ranges[b.ranges.length-1];y.width+=this._typicalHalfwidthCharacterWidth,this._context.viewModel.getTextDirection(S)===1&&(y.left-=this._typicalHalfwidthCharacterWidth)}}n[r++]=new dIe(b.outsideRenderedLine,p,m9.from(b.ranges),g)}}return this._updateLineWidthsSlowIfDomDidLayout(s),r===0?null:n}_visibleRangesForLineRange(i,e,t){if(i<this._visibleLines.getStartLineNumber()||i>this._visibleLines.getEndLineNumber())return null;let o=new BIe(this.domNode.domNode,this._textRangeRestingSpot),n=this._visibleLines.getVisibleLine(i).getVisibleRangesForRange(i,e,t,o);return this._updateLineWidthsSlowIfDomDidLayout(o),n}_lineIsRenderedRTL(i){return i<this._visibleLines.getStartLineNumber()||i>this._visibleLines.getEndLineNumber()?!1:this._visibleLines.getVisibleLine(i).isRenderedRTL()}visibleRangeForPosition(i){let e=this._visibleRangesForLineRange(i.lineNumber,i.column,i.column);return e?new uIe(e.outsideRenderedLine,e.ranges[0].left):null}updateLineWidths(){this._updateLineWidths(!1)}_updateLineWidthsFast(){return this._updateLineWidths(!0)}_updateLineWidthsSlow(){this._updateLineWidths(!1)}_updateLineWidthsSlowIfDomDidLayout(i){i.didDomLayout&&this._asyncUpdateLineWidths.isScheduled()&&(this._asyncUpdateLineWidths.cancel(),this._updateLineWidthsSlow())}_updateLineWidths(i){let e=this._visibleLines.getStartLineNumber(),t=this._visibleLines.getEndLineNumber(),o=1,n=!0;for(let r=e;r<=t;r++){let s=this._visibleLines.getVisibleLine(r);if(i&&!s.getWidthIsFast()){n=!1;continue}o=Math.max(o,s.getWidth(null))}return n&&e===1&&t===this._context.viewModel.getLineCount()&&(this._maxLineWidth=0),this._ensureMaxLineWidth(o),n}_checkMonospaceFontAssumptions(){let i=-1,e=-1,t=this._visibleLines.getStartLineNumber(),o=this._visibleLines.getEndLineNumber();for(let n=t;n<=o;n++){let r=this._visibleLines.getVisibleLine(n);if(r.needsMonospaceFontCheck()){let s=r.getWidth(null);s>e&&(e=s,i=n)}}if(i!==-1&&!this._visibleLines.getVisibleLine(i).monospaceAssumptionsAreValid())for(let n=t;n<=o;n++)this._visibleLines.getVisibleLine(n).onMonospaceAssumptionsInvalidated()}prepareRender(){throw new Error("Not supported")}render(){throw new Error("Not supported")}renderText(i){if(this._visibleLines.renderLines(i),this._lastRenderedData.setCurrentVisibleRange(i.visibleRange),this.domNode.setWidth(this._context.viewLayout.getScrollWidth()),this.domNode.setHeight(Math.min(this._context.viewLayout.getScrollHeight(),1e6)),this._horizontalRevealRequest){let t=this._horizontalRevealRequest;if(i.startLineNumber<=t.minLineNumber&&t.maxLineNumber<=i.endLineNumber){this._horizontalRevealRequest=null,this.onDidRender();let o=this._computeScrollLeftToReveal(t);o&&(!this._isViewportWrapping&&!o.hasRTL&&this._ensureMaxLineWidth(o.maxHorizontalOffset),this._context.viewModel.viewLayout.setScrollPosition({scrollLeft:o.scrollLeft},t.scrollType))}}if(this._updateLineWidthsFast()?this._asyncUpdateLineWidths.cancel():this._asyncUpdateLineWidths.schedule(),Wn&&!this._asyncCheckMonospaceFontAssumptions.isScheduled()){let t=this._visibleLines.getStartLineNumber(),o=this._visibleLines.getEndLineNumber();for(let n=t;n<=o;n++)if(this._visibleLines.getVisibleLine(n).needsMonospaceFontCheck()){this._asyncCheckMonospaceFontAssumptions.schedule();break}}this._linesContent.setLayerHinting(this._canUseLayerHinting),this._linesContent.setContain("strict");let e=this._context.viewLayout.getCurrentScrollTop()-i.bigNumbersDelta;this._linesContent.setTop(-e),this._linesContent.setLeft(-this._context.viewLayout.getCurrentScrollLeft())}_ensureMaxLineWidth(i){if(this._viewLineOptions.useGpu)return;let e=Math.ceil(i);this._maxLineWidth<e&&(this._maxLineWidth=e,this._context.viewModel.viewLayout.setMaxLineWidth(this._maxLineWidth))}_computeScrollTopToRevealRange(i,e,t,o,n,r){let s=i.top,l=i.height,c=s+l,u,p,h;if(n&&n.length>0){let S=n[0].startLineNumber,y=n[0].endLineNumber;for(let w=1,k=n.length;w<k;w++){let T=n[w];S=Math.min(S,T.startLineNumber),y=Math.max(y,T.endLineNumber)}u=!1,p=this._context.viewLayout.getVerticalOffsetForLineNumber(S),h=this._context.viewLayout.getVerticalOffsetForLineNumber(y)+this._lineHeight}else if(o)u=!0,p=this._context.viewLayout.getVerticalOffsetForLineNumber(o.startLineNumber),h=this._context.viewLayout.getVerticalOffsetForLineNumber(o.endLineNumber)+this._lineHeight;else return-1;let g=(e==="mouse"||t)&&this._cursorSurroundingLinesStyle==="default",f=0,v=0;if(g)t||(f=this._lineHeight);else{let S=l/this._lineHeight,y=Math.max(this._cursorSurroundingLines,this._stickyScrollEnabled?this._maxNumberStickyLines:0),w=Math.min(S/2,y);f=w*this._lineHeight,v=Math.max(0,w-1)*this._lineHeight}t||(r===0||r===4)&&(v+=this._lineHeight),p-=f,h+=v;let b;if(h-p>l){if(!u)return-1;b=p}else if(r===5||r===6)if(r===6&&s<=p&&h<=c)b=s;else{let S=Math.max(5*this._lineHeight,l*.2),y=p-S,w=h-l;b=Math.max(w,y)}else if(r===1||r===2)if(r===2&&s<=p&&h<=c)b=s;else{let S=(p+h)/2;b=Math.max(0,S-l/2)}else b=this._computeMinimumScrolling(s,c,p,h,r===3,r===4);return b}_computeScrollLeftToReveal(i){let e=this._context.viewLayout.getCurrentViewport(),t=this._context.configuration.options.get(165),o=e.left,n=o+e.width-t.verticalScrollbarWidth,r=1073741824,s=0,l=!1;if(i.type==="range"){l=this._lineIsRenderedRTL(i.lineNumber);let u=this._visibleRangesForLineRange(i.lineNumber,i.startColumn,i.endColumn);if(!u)return null;for(let p of u.ranges)r=Math.min(r,Math.round(p.left)),s=Math.max(s,Math.round(p.left+p.width))}else for(let u of i.selections){if(u.startLineNumber!==u.endLineNumber)return null;let p=this._visibleRangesForLineRange(u.startLineNumber,u.startColumn,u.endColumn);if(l||=this._lineIsRenderedRTL(u.startLineNumber),!p)return null;for(let h of p.ranges)r=Math.min(r,Math.round(h.left)),s=Math.max(s,Math.round(h.left+h.width))}return i.minimalReveal||(r=Math.max(0,r-a.HORIZONTAL_EXTRA_PX),s+=this._revealHorizontalRightPadding),i.type==="selections"&&s-r>e.width?null:{scrollLeft:this._computeMinimumScrolling(o,n,r,s),maxHorizontalOffset:s,hasRTL:l}}_computeMinimumScrolling(i,e,t,o,n,r){i=i|0,e=e|0,t=t|0,o=o|0,n=!!n,r=!!r;let s=e-i;if(o-t<s){if(n)return t;if(r)return Math.max(0,o-s);if(t<i)return t;if(o>e)return Math.max(0,o-s)}else return t;return i}};var Aft=class extends OIe{constructor(i){super(),this._context=i;let t=this._context.configuration.options.get(165);this._decorationsLeft=t.decorationsLeft,this._decorationsWidth=t.decorationsWidth,this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(i){let t=this._context.configuration.options.get(165);return this._decorationsLeft=t.decorationsLeft,this._decorationsWidth=t.decorationsWidth,!0}onDecorationsChanged(i){return!0}onFlushed(i){return!0}onLinesChanged(i){return!0}onLinesDeleted(i){return!0}onLinesInserted(i){return!0}onScrollChanged(i){return i.scrollTopChanged}onZonesChanged(i){return!0}_getDecorations(i){let e=i.getDecorationsInViewport(),t=[],o=0;for(let n=0,r=e.length;n<r;n++){let s=e[n],l=s.options.linesDecorationsClassName,c=s.options.zIndex;l&&(t[o++]=new Yse(s.range.startLineNumber,s.range.endLineNumber,l,s.options.linesDecorationsTooltip??null,c));let u=s.options.firstLineDecorationClassName;u&&(t[o++]=new Yse(s.range.startLineNumber,s.range.startLineNumber,u,s.options.linesDecorationsTooltip??null,c))}return t}prepareRender(i){let e=i.visibleRange.startLineNumber,t=i.visibleRange.endLineNumber,o=this._render(e,t,this._getDecorations(i)),n=this._decorationsLeft.toString(),r=this._decorationsWidth.toString(),s='" style="left:'+n+"px;width:"+r+'px;"></div>',l=[];for(let c=e;c<=t;c++){let u=c-e,p=o[u].getDecorations(),h="";for(let g of p){let f='<div class="cldr '+g.className;g.tooltip!==null&&(f+='" title="'+g.tooltip),f+=s,h+=f}l[u]=h}this._renderResult=l}render(i,e){return this._renderResult?this._renderResult[e-i]:""}};var HIe=class a extends mu{static{this.CLASS_NAME="glyph-margin"}static{this.OUTER_CLASS_NAME="margin"}constructor(i){super(i);let e=this._context.configuration.options,t=e.get(165);this._canUseLayerHinting=!e.get(39),this._contentLeft=t.contentLeft,this._glyphMarginLeft=t.glyphMarginLeft,this._glyphMarginWidth=t.glyphMarginWidth,this._domNode=or(document.createElement("div")),this._domNode.setClassName(a.OUTER_CLASS_NAME),this._domNode.setPosition("absolute"),this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true"),this._glyphMarginBackgroundDomNode=or(document.createElement("div")),this._glyphMarginBackgroundDomNode.setClassName(a.CLASS_NAME),this._domNode.appendChild(this._glyphMarginBackgroundDomNode)}dispose(){super.dispose()}getDomNode(){return this._domNode}onConfigurationChanged(i){let e=this._context.configuration.options,t=e.get(165);return this._canUseLayerHinting=!e.get(39),this._contentLeft=t.contentLeft,this._glyphMarginLeft=t.glyphMarginLeft,this._glyphMarginWidth=t.glyphMarginWidth,!0}onScrollChanged(i){return super.onScrollChanged(i)||i.scrollTopChanged}prepareRender(i){}render(i){this._domNode.setLayerHinting(this._canUseLayerHinting),this._domNode.setContain("strict");let e=i.scrollTop-i.bigNumbersDelta;this._domNode.setTop(-e);let t=Math.min(i.scrollHeight,1e6);this._domNode.setHeight(t),this._domNode.setWidth(this._contentLeft),this._glyphMarginBackgroundDomNode.setLeft(this._glyphMarginLeft),this._glyphMarginBackgroundDomNode.setWidth(this._glyphMarginWidth),this._glyphMarginBackgroundDomNode.setHeight(t)}};var Nft=class extends OIe{constructor(i){super(),this._context=i,this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(i){return!0}onDecorationsChanged(i){return!0}onFlushed(i){return!0}onLinesChanged(i){return!0}onLinesDeleted(i){return!0}onLinesInserted(i){return!0}onScrollChanged(i){return i.scrollTopChanged}onZonesChanged(i){return!0}_getDecorations(i){let e=i.getDecorationsInViewport(),t=[],o=0;for(let n=0,r=e.length;n<r;n++){let s=e[n],l=s.options.marginClassName,c=s.options.zIndex;l&&(t[o++]=new Yse(s.range.startLineNumber,s.range.endLineNumber,l,null,c))}return t}prepareRender(i){let e=i.visibleRange.startLineNumber,t=i.visibleRange.endLineNumber,o=this._render(e,t,this._getDecorations(i)),n=[];for(let r=e;r<=t;r++){let s=r-e,l=o[s].getDecorations(),c="";for(let u of l)c+='<div class="cmdr '+u.className+'" style=""></div>';n[s]=c}this._renderResult=n}render(i,e){return this._renderResult?this._renderResult[e-i]:""}};var BN=class a{constructor(i,e,t,o){this._rgba8Brand=void 0;this.r=a._clamp(i),this.g=a._clamp(e),this.b=a._clamp(t),this.a=a._clamp(o)}static{this.Empty=new a(0,0,0,0)}equals(i){return this.r===i.r&&this.g===i.g&&this.b===i.b&&this.a===i.a}static _clamp(i){return i<0?0:i>255?255:i|0}};var _qi=(()=>{let a=[];for(let i=32;i<=126;i++)a.push(i);return a.push(65533),a})(),Dqi=(a,i)=>(a-=32,a<0||a>96?i<=2?(a+96)%96:95:a);var UIe=class a extends C{constructor(){super();this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._updateColorMap(),this._register(kc.onDidChange(e=>{e.changedColorMap&&this._updateColorMap()}))}static{this._INSTANCE=null}static getInstance(){return this._INSTANCE||(this._INSTANCE=Mp(new a)),this._INSTANCE}_updateColorMap(){let e=kc.getColorMap();if(!e){this._colors=[BN.Empty],this._backgroundIsLight=!0;return}this._colors=[BN.Empty];for(let o=1;o<e.length;o++){let n=e[o].rgba;this._colors[o]=new BN(n.r,n.g,n.b,Math.round(n.a*255))}let t=e[2].getRelativeLuminance();this._backgroundIsLight=t>=.5,this._onDidChange.fire(void 0)}getColor(e){(e<1||e>=this._colors.length)&&(e=2);let t=this._colors[e];return t||(mt(new ni(`Missing color for colorId ${e}`)),t=BN.Empty),t}backgroundIsLight(){return this._backgroundIsLight}};var rqe=class a{constructor(i,e){this.scale=e;this._minimapCharRendererBrand=void 0;this.charDataNormal=a.soften(i,12/15),this.charDataLight=a.soften(i,50/60)}static soften(i,e){let t=new Uint8ClampedArray(i.length);for(let o=0,n=i.length;o<n;o++)t[o]=Sre(i[o]*e);return t}renderChar(i,e,t,o,n,r,s,l,c,u,p){let h=1*this.scale,g=2*this.scale,f=p?1:g;if(e+h>i.width||t+f>i.height){console.warn("bad render request outside image data");return}let v=u?this.charDataLight:this.charDataNormal,b=Dqi(o,c),S=i.width*4,y=s.r,w=s.g,k=s.b,T=n.r-y,N=n.g-w,O=n.b-k,V=Math.max(r,l),U=i.data,G=b*h*g,$=t*S+e*4;for(let te=0;te<f;te++){let pe=$;for(let de=0;de<h;de++){let se=v[G++]/255*(r/255);U[pe++]=y+T*se,U[pe++]=w+N*se,U[pe++]=k+O*se,U[pe++]=V}$+=S}}blockRenderChar(i,e,t,o,n,r,s,l){let c=1*this.scale,u=2*this.scale,p=l?1:u;if(e+c>i.width||t+p>i.height){console.warn("bad render request outside image data");return}let h=i.width*4,g=.5*(n/255),f=r.r,v=r.g,b=r.b,S=o.r-f,y=o.g-v,w=o.b-b,k=f+S*g,T=v+y*g,N=b+w*g,O=Math.max(n,s),V=i.data,U=t*h+e*4;for(let G=0;G<p;G++){let $=U;for(let te=0;te<c;te++)V[$++]=k,V[$++]=T,V[$++]=N,V[$++]=O;U+=h}}};var Rqi={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15},Mqi=a=>{let i=new Uint8ClampedArray(a.length/2);for(let e=0;e<a.length;e+=2)i[e>>1]=Rqi[a[e]]<<4|Rqi[a[e+1]]&15;return i},BJt={1:wd(()=>Mqi("0000511D6300CF609C709645A78432005642574171487021003C451900274D35D762755E8B629C5BA856AF57BA649530C167D1512A272A3F6038604460398526BCA2A968DB6F8957C768BE5FBE2FB467CF5D8D5B795DC7625B5DFF50DE64C466DB2FC47CD860A65E9A2EB96CB54CE06DA763AB2EA26860524D3763536601005116008177A8705E53AB738E6A982F88BAA35B5F5B626D9C636B449B737E5B7B678598869A662F6B5B8542706C704C80736A607578685B70594A49715A4522E792")),2:wd(()=>Mqi("000000000000000055394F383D2800008B8B1F210002000081B1CBCBCC820000847AAF6B9AAF2119BE08B8881AD60000A44FD07DCCF107015338130C00000000385972265F390B406E2437634B4B48031B12B8A0847000001E15B29A402F0000000000004B33460B00007A752C2A0000000000004D3900000084394B82013400ABA5CFC7AD9C0302A45A3E5A98AB000089A43382D97900008BA54AA087A70A0248A6A7AE6DBE0000BF6F94987EA40A01A06DCFA7A7A9030496C32F77891D0000A99FB1A0AFA80603B29AB9CA75930D010C0948354D3900000C0948354F37460D0028BE673D8400000000AF9D7B6E00002B007AA8933400007AA642675C2700007984CFB9C3985B768772A8A6B7B20000CAAECAAFC4B700009F94A6009F840009D09F9BA4CA9C0000CC8FC76DC87F0000C991C472A2000000A894A48CA7B501079BA2C9C69BA20000B19A5D3FA89000005CA6009DA2960901B0A7F0669FB200009D009E00B7890000DAD0F5D092820000D294D4C48BD10000B5A7A4A3B1A50402CAB6CBA6A2000000B5A7A4A3B1A8044FCDADD19D9CB00000B7778F7B8AAE0803C9AB5D3F5D3F00009EA09EA0BAB006039EA0989A8C7900009B9EF4D6B7C00000A9A7816CACA80000ABAC84705D3F000096DA635CDC8C00006F486F266F263D4784006124097B00374F6D2D6D2D6D4A3A95872322000000030000000000008D8939130000000000002E22A5C9CBC70600AB25C0B5C9B400061A2DB04CA67001082AA6BEBEBFC606002321DACBC19E03087AA08B6768380000282FBAC0B8CA7A88AD25BBA5A29900004C396C5894A6000040485A6E356E9442A32CD17EADA70000B4237923628600003E2DE9C1D7B500002F25BBA5A2990000231DB6AFB4A804023025C0B5CAB588062B2CBDBEC0C706882435A75CA20000002326BD6A82A908048B4B9A5A668000002423A09CB4BB060025259C9D8A7900001C1FCAB2C7C700002A2A9387ABA200002626A4A47D6E9D14333163A0C87500004B6F9C2D643A257049364936493647358A34438355497F1A0000A24C1D590000D38DFFBDD4CD3126"))};var Oft=class a{static create(i,e){if(this.lastCreated&&i===this.lastCreated.scale&&e===this.lastFontFamily)return this.lastCreated;let t;return BJt[i]?t=new rqe(BJt[i](),i):t=a.createFromSampleData(a.createSampleData(e).data,i),this.lastFontFamily=e,this.lastCreated=t,t}static createSampleData(i){let e=document.createElement("canvas"),t=e.getContext("2d");e.style.height="16px",e.height=16,e.width=960,e.style.width=960+"px",t.fillStyle="#ffffff",t.font=`bold 16px ${i}`,t.textBaseline="middle";let o=0;for(let n of _qi)t.fillText(String.fromCharCode(n),o,16/2),o+=10;return t.getImageData(0,0,960,16)}static createFromSampleData(i,e){let t=640*96;if(i.length!==t)throw new Error("Unexpected source in MinimapCharRenderer");let o=a._downsample(i,e);return new rqe(o,e)}static _downsampleChar(i,e,t,o,n){let r=1*n,s=2*n,l=o,c=0;for(let u=0;u<s;u++){let p=u/s*16,h=(u+1)/s*16;for(let g=0;g<r;g++){let f=g/r*10,v=(g+1)/r*10,b=0,S=0;for(let w=p;w<h;w++){let k=e+Math.floor(w)*3840,T=1-(w-Math.floor(w));for(let N=f;N<v;N++){let O=1-(N-Math.floor(N)),V=k+Math.floor(N)*4,U=O*T;S+=U,b+=i[V]*i[V+3]/255*U}}let y=b/S;c=Math.max(c,y),t[l++]=Sre(y)}}return c}static _downsample(i,e){let t=2*e*1*e,o=t*96,n=new Uint8ClampedArray(o),r=0,s=0,l=0;for(let c=0;c<96;c++)l=Math.max(l,this._downsampleChar(i,s,n,r,e)),r+=t,s+=40;if(l>0){let c=255/l;for(let u=0;u<o;u++)n[u]*=c}return n}};var HN=ri?'"Segoe WPC", "Segoe UI", sans-serif':it?"-apple-system, BlinkMacSystemFont, sans-serif":'system-ui, "Ubuntu", "Droid Sans", sans-serif',JPo=async()=>{try{return[...await It.queryLocalFonts()].map(t=>t.family)}catch(a){return console.error(`Failed to query fonts: ${a}`),[]}},Fft=async()=>Xut?(await JPo()).map(e=>({body:`${e}`})):[];var tAo=140,iAo=2,Wft=class a{constructor(i,e,t){let o=i.options,n=o.get(163),r=o.get(165),s=r.minimap,l=o.get(59),c=o.get(81);this.renderMinimap=s.renderMinimap,this.size=c.size,this.minimapHeightIsEditorHeight=s.minimapHeightIsEditorHeight,this.scrollBeyondLastLine=o.get(119),this.paddingTop=o.get(96).top,this.paddingBottom=o.get(96).bottom,this.showSlider=c.showSlider,this.autohide=c.autohide,this.pixelRatio=n,this.typicalHalfwidthCharacterWidth=l.typicalHalfwidthCharacterWidth,this.lineHeight=o.get(75),this.minimapLeft=s.minimapLeft,this.minimapWidth=s.minimapWidth,this.minimapHeight=r.height,this.canvasInnerWidth=s.minimapCanvasInnerWidth,this.canvasInnerHeight=s.minimapCanvasInnerHeight,this.canvasOuterWidth=s.minimapCanvasOuterWidth,this.canvasOuterHeight=s.minimapCanvasOuterHeight,this.isSampling=s.minimapIsSampling,this.editorHeight=r.height,this.fontScale=s.minimapScale,this.minimapLineHeight=s.minimapLineHeight,this.minimapCharWidth=1*this.fontScale,this.sectionHeaderFontFamily=HN,this.sectionHeaderFontSize=c.sectionHeaderFontSize*n,this.sectionHeaderLetterSpacing=c.sectionHeaderLetterSpacing,this.sectionHeaderFontColor=a._getSectionHeaderColor(e,t.getColor(1)),this.charRenderer=wd(()=>Oft.create(this.fontScale,l.fontFamily)),this.defaultBackgroundColor=t.getColor(2),this.backgroundColor=a._getMinimapBackground(e,this.defaultBackgroundColor),this.foregroundAlpha=a._getMinimapForegroundOpacity(e)}static _getMinimapBackground(i,e){let t=i.getColor(kGi);return t?new BN(t.rgba.r,t.rgba.g,t.rgba.b,Math.round(255*t.rgba.a)):e}static _getMinimapForegroundOpacity(i){let e=i.getColor(EGi);return e?BN._clamp(Math.round(255*e.rgba.a)):255}static _getSectionHeaderColor(i,e){let t=i.getColor(od);return t?new BN(t.rgba.r,t.rgba.g,t.rgba.b,Math.round(255*t.rgba.a)):e}equals(i){return this.renderMinimap===i.renderMinimap&&this.size===i.size&&this.minimapHeightIsEditorHeight===i.minimapHeightIsEditorHeight&&this.scrollBeyondLastLine===i.scrollBeyondLastLine&&this.paddingTop===i.paddingTop&&this.paddingBottom===i.paddingBottom&&this.showSlider===i.showSlider&&this.autohide===i.autohide&&this.pixelRatio===i.pixelRatio&&this.typicalHalfwidthCharacterWidth===i.typicalHalfwidthCharacterWidth&&this.lineHeight===i.lineHeight&&this.minimapLeft===i.minimapLeft&&this.minimapWidth===i.minimapWidth&&this.minimapHeight===i.minimapHeight&&this.canvasInnerWidth===i.canvasInnerWidth&&this.canvasInnerHeight===i.canvasInnerHeight&&this.canvasOuterWidth===i.canvasOuterWidth&&this.canvasOuterHeight===i.canvasOuterHeight&&this.isSampling===i.isSampling&&this.editorHeight===i.editorHeight&&this.fontScale===i.fontScale&&this.minimapLineHeight===i.minimapLineHeight&&this.minimapCharWidth===i.minimapCharWidth&&this.sectionHeaderFontSize===i.sectionHeaderFontSize&&this.sectionHeaderLetterSpacing===i.sectionHeaderLetterSpacing&&this.defaultBackgroundColor&&this.defaultBackgroundColor.equals(i.defaultBackgroundColor)&&this.backgroundColor&&this.backgroundColor.equals(i.backgroundColor)&&this.foregroundAlpha===i.foregroundAlpha}},HJt=class a{constructor(i,e,t,o,n,r,s,l,c){this.scrollTop=i;this.scrollHeight=e;this.sliderNeeded=t;this._computedSliderRatio=o;this.sliderTop=n;this.sliderHeight=r;this.topPaddingLineCount=s;this.startLineNumber=l;this.endLineNumber=c}getDesiredScrollTopFromDelta(i){return Math.round(this.scrollTop+i/this._computedSliderRatio)}getDesiredScrollTopFromTouchLocation(i){return Math.round((i-this.sliderHeight/2)/this._computedSliderRatio)}intersectWithViewport(i){let e=Math.max(this.startLineNumber,i.startLineNumber),t=Math.min(this.endLineNumber,i.endLineNumber);return e>t?null:[e,t]}getYForLineNumber(i,e){return+(i-this.startLineNumber+this.topPaddingLineCount)*e}static create(i,e,t,o,n,r,s,l,c,u,p){let h=i.pixelRatio,g=i.minimapLineHeight,f=Math.floor(i.canvasInnerHeight/g),v=i.lineHeight;if(i.minimapHeightIsEditorHeight){let N=l*i.lineHeight+i.paddingTop+i.paddingBottom;i.scrollBeyondLastLine&&(N+=Math.max(0,n-i.lineHeight-i.paddingBottom));let O=Math.max(1,Math.floor(n*n/N)),V=Math.max(0,i.minimapHeight-O),U=V/(u-n),G=c*U,$=V>0,te=Math.floor(i.canvasInnerHeight/i.minimapLineHeight),pe=Math.floor(i.paddingTop/i.lineHeight);return new a(c,u,$,U,G,O,pe,1,Math.min(s,te))}let b;if(r&&t!==s){let N=t-e+1;b=Math.floor(N*g/h)}else{let N=n/v;b=Math.floor(N*g/h)}let S=Math.floor(i.paddingTop/v),y=Math.floor(i.paddingBottom/v);if(i.scrollBeyondLastLine){let N=n/v;y=Math.max(y,N-1)}let w;if(y>0){let N=n/v;w=(S+s+y-N-1)*g/h}else w=Math.max(0,(S+s)*g/h-b);w=Math.min(i.minimapHeight-b,w);let k=w/(u-n),T=c*k;if(f>=S+s+y){let N=w>0;return new a(c,u,N,k,T,b,S,1,s)}else{let N;e>1?N=e+S:N=Math.max(1,c/v);let O,V=Math.max(1,Math.floor(N-T*h/g));V<S?(O=S-V+1,V=1):(O=0,V=Math.max(1,V-S)),p&&p.scrollHeight===u&&(p.scrollTop>c&&(V=Math.min(V,p.startLineNumber),O=Math.max(O,p.topPaddingLineCount)),p.scrollTop<c&&(V=Math.max(V,p.startLineNumber),O=Math.min(O,p.topPaddingLineCount)));let U=Math.min(s,V-O+f-1),G=(c-o)/v,$;return c>=i.paddingTop?$=(e-V+O+G)*g/h:$=c/i.paddingTop*(O+G)*g/h,new a(c,u,!0,k,$,b,O,V,U)}}},Vft=class a{static{this.INVALID=new a(-1)}constructor(i){this.dy=i}onContentChanged(){this.dy=-1}onTokensChanged(){this.dy=-1}},Bft=class{constructor(i,e,t){this.renderedLayout=i,this._imageData=e,this._renderedLines=new oqe({createLine:()=>Vft.INVALID}),this._renderedLines._set(i.startLineNumber,t)}linesEquals(i){if(!this.scrollEquals(i))return!1;let t=this._renderedLines._get().lines;for(let o=0,n=t.length;o<n;o++)if(t[o].dy===-1)return!1;return!0}scrollEquals(i){return this.renderedLayout.startLineNumber===i.startLineNumber&&this.renderedLayout.endLineNumber===i.endLineNumber}_get(){let i=this._renderedLines._get();return{imageData:this._imageData,rendLineNumberStart:i.rendLineNumberStart,lines:i.lines}}onLinesChanged(i,e){return this._renderedLines.onLinesChanged(i,e)}onLinesDeleted(i,e){this._renderedLines.onLinesDeleted(i,e)}onLinesInserted(i,e){this._renderedLines.onLinesInserted(i,e)}onTokensChanged(i){return this._renderedLines.onTokensChanged(i)}},UJt=class a{constructor(i,e,t,o){this._backgroundFillData=a._createBackgroundFillData(e,t,o),this._buffers=[i.createImageData(e,t),i.createImageData(e,t)],this._lastUsedBuffer=0}getBuffer(){this._lastUsedBuffer=1-this._lastUsedBuffer;let i=this._buffers[this._lastUsedBuffer];return i.data.set(this._backgroundFillData),i}static _createBackgroundFillData(i,e,t){let o=t.r,n=t.g,r=t.b,s=t.a,l=new Uint8ClampedArray(i*e*4),c=0;for(let u=0;u<e;u++)for(let p=0;p<i;p++)l[c]=o,l[c+1]=n,l[c+2]=r,l[c+3]=s,c+=4;return l}},Hft=class a{constructor(i,e){this.samplingRatio=i;this.minimapLines=e}static compute(i,e,t){if(i.renderMinimap===0||!i.isSampling)return[null,[]];let{minimapLineCount:o}=QGe.computeContainedMinimapLineCount({viewLineCount:e,scrollBeyondLastLine:i.scrollBeyondLastLine,paddingTop:i.paddingTop,paddingBottom:i.paddingBottom,height:i.editorHeight,lineHeight:i.lineHeight,pixelRatio:i.pixelRatio}),n=e/o,r=n/2;if(!t||t.minimapLines.length===0){let b=[];if(b[0]=1,o>1){for(let S=0,y=o-1;S<y;S++)b[S]=Math.round(S*n+r);b[o-1]=e}return[new a(n,b),[]]}let s=t.minimapLines,l=s.length,c=[],u=0,p=0,h=1,g=10,f=[],v=null;for(let b=0;b<o;b++){let S=Math.max(h,Math.round(b*n)),y=Math.max(S,Math.round((b+1)*n));for(;u<l&&s[u]<S;){if(f.length<g){let k=u+1+p;v&&v.type==="deleted"&&v._oldIndex===u-1?v.deleteToLineNumber++:(v={type:"deleted",_oldIndex:u,deleteFromLineNumber:k,deleteToLineNumber:k},f.push(v)),p--}u++}let w;if(u<l&&s[u]<=y)w=s[u],u++;else if(b===0?w=1:b+1===o?w=e:w=Math.round(b*n+r),f.length<g){let k=u+1+p;v&&v.type==="inserted"&&v._i===b-1?v.insertToLineNumber++:(v={type:"inserted",_i:b,insertFromLineNumber:k,insertToLineNumber:k},f.push(v)),p++}c[b]=w,h=w}if(f.length<g)for(;u<l;){let b=u+1+p;v&&v.type==="deleted"&&v._oldIndex===u-1?v.deleteToLineNumber++:(v={type:"deleted",_oldIndex:u,deleteFromLineNumber:b,deleteToLineNumber:b},f.push(v)),p--,u++}else f=[{type:"flush"}];return[new a(n,c),f]}modelLineToMinimapLine(i){return Math.min(this.minimapLines.length,Math.max(1,Math.round(i/this.samplingRatio)))}modelLineRangeToMinimapLineRange(i,e){let t=this.modelLineToMinimapLine(i)-1;for(;t>0&&this.minimapLines[t-1]>=i;)t--;let o=this.modelLineToMinimapLine(e)-1;for(;o+1<this.minimapLines.length&&this.minimapLines[o+1]<=e;)o++;if(t===o){let n=this.minimapLines[t];if(n<i||n>e)return null}return[t+1,o+1]}decorationLineRangeToMinimapLineRange(i,e){let t=this.modelLineToMinimapLine(i),o=this.modelLineToMinimapLine(e);return i!==e&&o===t&&(o===this.minimapLines.length?t>1&&t--:o++),[t,o]}onLinesDeleted(i){let e=i.toLineNumber-i.fromLineNumber+1,t=this.minimapLines.length,o=0;for(let n=this.minimapLines.length-1;n>=0&&!(this.minimapLines[n]<i.fromLineNumber);n--)this.minimapLines[n]<=i.toLineNumber?(this.minimapLines[n]=Math.max(1,i.fromLineNumber-1),t=Math.min(t,n),o=Math.max(o,n)):this.minimapLines[n]-=e;return[t,o]}onLinesInserted(i){let e=i.toLineNumber-i.fromLineNumber+1;for(let t=this.minimapLines.length-1;t>=0&&!(this.minimapLines[t]<i.fromLineNumber);t--)this.minimapLines[t]+=e}},Uft=class extends mu{constructor(e){super(e);this._sectionHeaderCache=new il(10,1.5);this.tokensColorTracker=UIe.getInstance(),this._selections=[],this._minimapSelections=null,this.options=new Wft(this._context.configuration,this._context.theme,this.tokensColorTracker);let[t]=Hft.compute(this.options,this._context.viewModel.getLineCount(),null);this._samplingState=t,this._shouldCheckSampling=!1,this._actual=new zJt(e.theme,this)}dispose(){this._actual.dispose(),super.dispose()}getDomNode(){return this._actual.getDomNode()}_onOptionsMaybeChanged(){let e=new Wft(this._context.configuration,this._context.theme,this.tokensColorTracker);return this.options.equals(e)?!1:(this.options=e,this._recreateLineSampling(),this._actual.onDidChangeOptions(),!0)}onConfigurationChanged(e){return this._onOptionsMaybeChanged()}onCursorStateChanged(e){return this._selections=e.selections,this._minimapSelections=null,this._actual.onSelectionChanged()}onDecorationsChanged(e){return e.affectsMinimap?this._actual.onDecorationsChanged():!1}onFlushed(e){return this._samplingState&&(this._shouldCheckSampling=!0),this._actual.onFlushed()}onLinesChanged(e){if(this._samplingState){let t=this._samplingState.modelLineRangeToMinimapLineRange(e.fromLineNumber,e.fromLineNumber+e.count-1);return t?this._actual.onLinesChanged(t[0],t[1]-t[0]+1):!1}else return this._actual.onLinesChanged(e.fromLineNumber,e.count)}onLinesDeleted(e){if(this._samplingState){let[t,o]=this._samplingState.onLinesDeleted(e);return t<=o&&this._actual.onLinesChanged(t+1,o-t+1),this._shouldCheckSampling=!0,!0}else return this._actual.onLinesDeleted(e.fromLineNumber,e.toLineNumber)}onLinesInserted(e){return this._samplingState?(this._samplingState.onLinesInserted(e),this._shouldCheckSampling=!0,!0):this._actual.onLinesInserted(e.fromLineNumber,e.toLineNumber)}onScrollChanged(e){return this._actual.onScrollChanged(e)}onThemeChanged(e){return this._actual.onThemeChanged(),this._onOptionsMaybeChanged(),!0}onTokensChanged(e){if(this._samplingState){let t=[];for(let o of e.ranges){let n=this._samplingState.modelLineRangeToMinimapLineRange(o.fromLineNumber,o.toLineNumber);n&&t.push({fromLineNumber:n[0],toLineNumber:n[1]})}return t.length?this._actual.onTokensChanged(t):!1}else return this._actual.onTokensChanged(e.ranges)}onTokensColorsChanged(e){return this._onOptionsMaybeChanged(),this._actual.onTokensColorsChanged()}onZonesChanged(e){return this._actual.onZonesChanged()}prepareRender(e){this._shouldCheckSampling&&(this._shouldCheckSampling=!1,this._recreateLineSampling())}render(e){let t=e.visibleRange.startLineNumber,o=e.visibleRange.endLineNumber;this._samplingState&&(t=this._samplingState.modelLineToMinimapLine(t),o=this._samplingState.modelLineToMinimapLine(o));let n={viewportContainsWhitespaceGaps:e.viewportData.whitespaceViewportData.length>0,scrollWidth:e.scrollWidth,scrollHeight:e.scrollHeight,viewportStartLineNumber:t,viewportEndLineNumber:o,viewportStartLineNumberVerticalOffset:e.getVerticalOffsetForLineNumber(t),scrollTop:e.scrollTop,scrollLeft:e.scrollLeft,viewportWidth:e.viewportWidth,viewportHeight:e.viewportHeight};this._actual.render(n)}_recreateLineSampling(){this._minimapSelections=null;let e=!!this._samplingState,[t,o]=Hft.compute(this.options,this._context.viewModel.getLineCount(),this._samplingState);if(this._samplingState=t,e&&this._samplingState)for(let n of o)switch(n.type){case"deleted":this._actual.onLinesDeleted(n.deleteFromLineNumber,n.deleteToLineNumber);break;case"inserted":this._actual.onLinesInserted(n.insertFromLineNumber,n.insertToLineNumber);break;case"flush":this._actual.onFlushed();break}}getLineCount(){return this._samplingState?this._samplingState.minimapLines.length:this._context.viewModel.getLineCount()}getRealLineCount(){return this._context.viewModel.getLineCount()}getLineContent(e){return this._samplingState?this._context.viewModel.getLineContent(this._samplingState.minimapLines[e-1]):this._context.viewModel.getLineContent(e)}getLineMaxColumn(e){return this._samplingState?this._context.viewModel.getLineMaxColumn(this._samplingState.minimapLines[e-1]):this._context.viewModel.getLineMaxColumn(e)}getMinimapLinesRenderingData(e,t,o){if(this._samplingState){let n=[];for(let r=0,s=t-e+1;r<s;r++)o[r]?n[r]=this._context.viewModel.getViewLineData(this._samplingState.minimapLines[e+r-1]):n[r]=null;return n}return this._context.viewModel.getMinimapLinesRenderingData(e,t,o).data}getSelections(){if(this._minimapSelections===null)if(this._samplingState){this._minimapSelections=[];for(let e of this._selections){let[t,o]=this._samplingState.decorationLineRangeToMinimapLineRange(e.startLineNumber,e.endLineNumber);this._minimapSelections.push(new Yt(t,e.startColumn,o,e.endColumn))}}else this._minimapSelections=this._selections;return this._minimapSelections}getMinimapDecorationsInViewport(e,t){return this._getMinimapDecorationsInViewport(e,t).filter(o=>!o.options.minimap?.sectionHeaderStyle)}getSectionHeaderDecorationsInViewport(e,t){let o=this.options.sectionHeaderFontSize/this.options.minimapLineHeight;return e=Math.floor(Math.max(1,e-o)),this._getMinimapDecorationsInViewport(e,t).filter(n=>!!n.options.minimap?.sectionHeaderStyle)}_getMinimapDecorationsInViewport(e,t){let o;if(this._samplingState){let r=this._samplingState.minimapLines[e-1],s=this._samplingState.minimapLines[t-1];o=new z(r,1,s,this._context.viewModel.getLineMaxColumn(s))}else o=new z(e,1,t,this._context.viewModel.getLineMaxColumn(t));let n=this._context.viewModel.getMinimapDecorationsInRange(o);if(this._samplingState){let r=[];for(let s of n){if(!s.options.minimap)continue;let l=s.range,c=this._samplingState.modelLineToMinimapLine(l.startLineNumber),u=this._samplingState.modelLineToMinimapLine(l.endLineNumber);r.push(new pIe(new z(c,l.startColumn,u,l.endColumn),s.options))}return r}return n}getSectionHeaderText(e,t){let o=e.options.minimap?.sectionHeaderText;if(!o)return null;let n=this._sectionHeaderCache.get(o);if(n)return n;let r=t(o);return this._sectionHeaderCache.set(o,r),r}getOptions(){return this._context.viewModel.model.getOptions()}revealLineNumber(e){this._samplingState&&(e=this._samplingState.minimapLines[e-1]),this._context.viewModel.revealRange("mouse",!1,new z(e,1,e,1),1,0)}setScrollTop(e){this._context.viewModel.viewLayout.setScrollPosition({scrollTop:e},1)}},zJt=class a extends C{constructor(e,t){super();this._renderDecorations=!1;this._gestureInProgress=!1;this._isMouseOverMinimap=!1;this._theme=e,this._model=t,this._lastRenderData=null,this._buffers=null,this._selectionColor=this._theme.getColor($Xt),this._domNode=or(document.createElement("div")),PS.write(this._domNode,9),this._domNode.setClassName(this._getMinimapDomNodeClassName()),this._domNode.setPosition("absolute"),this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true"),this._shadow=or(document.createElement("div")),this._shadow.setClassName("minimap-shadow-hidden"),this._domNode.appendChild(this._shadow),this._canvas=or(document.createElement("canvas")),this._canvas.setPosition("absolute"),this._canvas.setLeft(0),this._domNode.appendChild(this._canvas),this._decorationsCanvas=or(document.createElement("canvas")),this._decorationsCanvas.setPosition("absolute"),this._decorationsCanvas.setClassName("minimap-decorations-layer"),this._decorationsCanvas.setLeft(0),this._domNode.appendChild(this._decorationsCanvas),this._slider=or(document.createElement("div")),this._slider.setPosition("absolute"),this._slider.setClassName("minimap-slider"),this._slider.setLayerHinting(!0),this._slider.setContain("strict"),this._domNode.appendChild(this._slider),this._sliderHorizontal=or(document.createElement("div")),this._sliderHorizontal.setPosition("absolute"),this._sliderHorizontal.setClassName("minimap-slider-horizontal"),this._slider.appendChild(this._sliderHorizontal),this._applyLayout(),this._hideDelayedScheduler=this._register(new Dt(()=>this._hideImmediatelyIfMouseIsOutside(),500)),this._register(Vo(this._domNode.domNode,re.MOUSE_OVER,()=>{this._isMouseOverMinimap=!0})),this._register(Vo(this._domNode.domNode,re.MOUSE_LEAVE,()=>{this._isMouseOverMinimap=!1})),this._pointerDownListener=Vo(this._domNode.domNode,re.POINTER_DOWN,o=>{o.preventDefault();let n=o.pointerType==="mouse",r=o.button===0;if(this._model.options.renderMinimap!==0&&this._lastRenderData){if(this._model.options.size!=="proportional"){if(r&&this._lastRenderData){let l=Yn(this._slider.domNode),c=l.top+l.height/2;this._startSliderDragging(o,c,this._lastRenderData.renderedLayout)}return}if(r||!n){let l=this._model.options.minimapLineHeight,c=this._model.options.canvasInnerHeight/this._model.options.canvasOuterHeight*o.offsetY,p=Math.floor(c/l)+this._lastRenderData.renderedLayout.startLineNumber-this._lastRenderData.renderedLayout.topPaddingLineCount;p=Math.min(p,this._model.getLineCount()),this._model.revealLineNumber(p)}}}),this._sliderPointerMoveMonitor=new cL,this._sliderPointerDownListener=Vo(this._slider.domNode,re.POINTER_DOWN,o=>{o.preventDefault(),o.stopPropagation(),o.button===0&&this._lastRenderData&&this._startSliderDragging(o,o.pageY,this._lastRenderData.renderedLayout)}),this._gestureDisposable=ws.addTarget(this._domNode.domNode),this._sliderTouchStartListener=j(this._domNode.domNode,Gn.Start,o=>{o.preventDefault(),o.stopPropagation(),this._lastRenderData&&(this._slider.toggleClassName("active",!0),this._gestureInProgress=!0,this.scrollDueToTouchEvent(o))},{passive:!1}),this._sliderTouchMoveListener=j(this._domNode.domNode,Gn.Change,o=>{o.preventDefault(),o.stopPropagation(),this._lastRenderData&&this._gestureInProgress&&this.scrollDueToTouchEvent(o)},{passive:!1}),this._sliderTouchEndListener=Vo(this._domNode.domNode,Gn.End,o=>{o.preventDefault(),o.stopPropagation(),this._gestureInProgress=!1,this._slider.toggleClassName("active",!1)})}_hideSoon(){this._hideDelayedScheduler.cancel(),this._hideDelayedScheduler.schedule()}_hideImmediatelyIfMouseIsOutside(){if(this._isMouseOverMinimap){this._hideSoon();return}this._domNode.toggleClassName("active",!1)}_startSliderDragging(e,t,o){if(!e.target||!(e.target instanceof Element))return;let n=e.pageX;this._slider.toggleClassName("active",!0);let r=(s,l)=>{let c=Yn(this._domNode.domNode),u=Math.min(Math.abs(l-n),Math.abs(l-c.left),Math.abs(l-c.left-c.width));if(ri&&u>tAo){this._model.setScrollTop(o.scrollTop);return}let p=s-t;this._model.setScrollTop(o.getDesiredScrollTopFromDelta(p))};e.pageY!==t&&r(e.pageY,n),this._sliderPointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,s=>r(s.pageY,s.pageX),()=>{this._slider.toggleClassName("active",!1)})}scrollDueToTouchEvent(e){let t=this._domNode.domNode.getBoundingClientRect().top,o=this._lastRenderData.renderedLayout.getDesiredScrollTopFromTouchLocation(e.pageY-t);this._model.setScrollTop(o)}dispose(){this._pointerDownListener.dispose(),this._sliderPointerMoveMonitor.dispose(),this._sliderPointerDownListener.dispose(),this._gestureDisposable.dispose(),this._sliderTouchStartListener.dispose(),this._sliderTouchMoveListener.dispose(),this._sliderTouchEndListener.dispose(),super.dispose()}_getMinimapDomNodeClassName(){let e=["minimap"];return this._model.options.showSlider==="always"?e.push("slider-always"):e.push("slider-mouseover"),this._model.options.autohide==="mouseover"?e.push("minimap-autohide-mouseover"):this._model.options.autohide==="scroll"&&e.push("minimap-autohide-scroll"),e.join(" ")}getDomNode(){return this._domNode}_applyLayout(){this._domNode.setLeft(this._model.options.minimapLeft),this._domNode.setWidth(this._model.options.minimapWidth),this._domNode.setHeight(this._model.options.minimapHeight),this._shadow.setHeight(this._model.options.minimapHeight),this._canvas.setWidth(this._model.options.canvasOuterWidth),this._canvas.setHeight(this._model.options.canvasOuterHeight),this._canvas.domNode.width=this._model.options.canvasInnerWidth,this._canvas.domNode.height=this._model.options.canvasInnerHeight,this._decorationsCanvas.setWidth(this._model.options.canvasOuterWidth),this._decorationsCanvas.setHeight(this._model.options.canvasOuterHeight),this._decorationsCanvas.domNode.width=this._model.options.canvasInnerWidth,this._decorationsCanvas.domNode.height=this._model.options.canvasInnerHeight,this._slider.setWidth(this._model.options.minimapWidth)}_getBuffer(){return this._buffers||this._model.options.canvasInnerWidth>0&&this._model.options.canvasInnerHeight>0&&(this._buffers=new UJt(this._canvas.domNode.getContext("2d"),this._model.options.canvasInnerWidth,this._model.options.canvasInnerHeight,this._model.options.backgroundColor)),this._buffers?this._buffers.getBuffer():null}onDidChangeOptions(){this._lastRenderData=null,this._buffers=null,this._applyLayout(),this._domNode.setClassName(this._getMinimapDomNodeClassName())}onSelectionChanged(){return this._renderDecorations=!0,!0}onDecorationsChanged(){return this._renderDecorations=!0,!0}onFlushed(){return this._lastRenderData=null,!0}onLinesChanged(e,t){return this._lastRenderData?this._lastRenderData.onLinesChanged(e,t):!1}onLinesDeleted(e,t){return this._lastRenderData?.onLinesDeleted(e,t),!0}onLinesInserted(e,t){return this._lastRenderData?.onLinesInserted(e,t),!0}onScrollChanged(e){return this._model.options.autohide==="scroll"&&(e.scrollTopChanged||e.scrollHeightChanged)&&(this._domNode.toggleClassName("active",!0),this._hideSoon()),this._renderDecorations=!0,!0}onThemeChanged(){return this._selectionColor=this._theme.getColor($Xt),this._renderDecorations=!0,!0}onTokensChanged(e){return this._lastRenderData?this._lastRenderData.onTokensChanged(e):!1}onTokensColorsChanged(){return this._lastRenderData=null,this._buffers=null,!0}onZonesChanged(){return this._lastRenderData=null,!0}render(e){if(this._model.options.renderMinimap===0){this._shadow.setClassName("minimap-shadow-hidden"),this._sliderHorizontal.setWidth(0),this._sliderHorizontal.setHeight(0);return}e.scrollLeft+e.viewportWidth>=e.scrollWidth?this._shadow.setClassName("minimap-shadow-hidden"):this._shadow.setClassName("minimap-shadow-visible");let o=HJt.create(this._model.options,e.viewportStartLineNumber,e.viewportEndLineNumber,e.viewportStartLineNumberVerticalOffset,e.viewportHeight,e.viewportContainsWhitespaceGaps,this._model.getLineCount(),this._model.getRealLineCount(),e.scrollTop,e.scrollHeight,this._lastRenderData?this._lastRenderData.renderedLayout:null);this._slider.setDisplay(o.sliderNeeded?"block":"none"),this._slider.setTop(o.sliderTop),this._slider.setHeight(o.sliderHeight),this._sliderHorizontal.setLeft(0),this._sliderHorizontal.setWidth(this._model.options.minimapWidth),this._sliderHorizontal.setTop(0),this._sliderHorizontal.setHeight(o.sliderHeight),this.renderDecorations(o),this._lastRenderData=this.renderLines(o)}renderDecorations(e){if(this._renderDecorations){this._renderDecorations=!1;let t=this._model.getSelections();t.sort(z.compareRangesUsingStarts);let o=this._model.getMinimapDecorationsInViewport(e.startLineNumber,e.endLineNumber);o.sort((g,f)=>(g.options.zIndex||0)-(f.options.zIndex||0));let{canvasInnerWidth:n,canvasInnerHeight:r}=this._model.options,s=this._model.options.minimapLineHeight,l=this._model.options.minimapCharWidth,c=this._model.getOptions().tabSize,u=this._decorationsCanvas.domNode.getContext("2d");u.clearRect(0,0,n,r);let p=new zft(e.startLineNumber,e.endLineNumber,!1);this._renderSelectionLineHighlights(u,t,p,e,s),this._renderDecorationsLineHighlights(u,o,p,e,s);let h=new zft(e.startLineNumber,e.endLineNumber,null);this._renderSelectionsHighlights(u,t,h,e,s,c,l,n),this._renderDecorationsHighlights(u,o,h,e,s,c,l,n),this._renderSectionHeaders(e)}}_renderSelectionLineHighlights(e,t,o,n,r){if(!this._selectionColor||this._selectionColor.isTransparent())return;e.fillStyle=this._selectionColor.transparent(.5).toString();let s=0,l=0;for(let c of t){let u=n.intersectWithViewport(c);if(!u)continue;let[p,h]=u;for(let v=p;v<=h;v++)o.set(v,!0);let g=n.getYForLineNumber(p,r),f=n.getYForLineNumber(h,r);l>=g||(l>s&&e.fillRect(iW,s,e.canvas.width,l-s),s=g),l=f}l>s&&e.fillRect(iW,s,e.canvas.width,l-s)}_renderDecorationsLineHighlights(e,t,o,n,r){let s=new Map;for(let l=t.length-1;l>=0;l--){let c=t[l],u=c.options.minimap;if(!u||u.position!==1)continue;let p=n.intersectWithViewport(c.range);if(!p)continue;let[h,g]=p,f=u.getColor(this._theme.value);if(!f||f.isTransparent())continue;let v=s.get(f.toString());v||(v=f.transparent(.5).toString(),s.set(f.toString(),v)),e.fillStyle=v;for(let b=h;b<=g;b++){if(o.has(b))continue;o.set(b,!0);let S=n.getYForLineNumber(b,r);e.fillRect(iW,S,e.canvas.width,r)}}}_renderSelectionsHighlights(e,t,o,n,r,s,l,c){if(!(!this._selectionColor||this._selectionColor.isTransparent()))for(let u of t){let p=n.intersectWithViewport(u);if(!p)continue;let[h,g]=p;for(let f=h;f<=g;f++)this.renderDecorationOnLine(e,o,u,this._selectionColor,n,f,r,r,s,l,c)}}_renderDecorationsHighlights(e,t,o,n,r,s,l,c){for(let u of t){let p=u.options.minimap;if(!p)continue;let h=n.intersectWithViewport(u.range);if(!h)continue;let[g,f]=h,v=p.getColor(this._theme.value);if(!(!v||v.isTransparent()))for(let b=g;b<=f;b++)switch(p.position){case 1:this.renderDecorationOnLine(e,o,u.range,v,n,b,r,r,s,l,c);continue;case 2:{let S=n.getYForLineNumber(b,r);this.renderDecoration(e,v,2,S,iAo,r);continue}}}}renderDecorationOnLine(e,t,o,n,r,s,l,c,u,p,h){let g=r.getYForLineNumber(s,c);if(g+l<0||g>this._model.options.canvasInnerHeight)return;let{startLineNumber:f,endLineNumber:v}=o,b=f===s?o.startColumn:1,S=v===s?o.endColumn:this._model.getLineMaxColumn(s),y=this.getXOffsetForPosition(t,s,b,u,p,h),w=this.getXOffsetForPosition(t,s,S,u,p,h);this.renderDecoration(e,n,y,g,w-y,l)}getXOffsetForPosition(e,t,o,n,r,s){if(o===1)return iW;if((o-1)*r>=s)return s;let c=e.get(t);if(!c){let u=this._model.getLineContent(t);c=[iW];let p=iW;for(let h=1;h<u.length+1;h++){let g=u.charCodeAt(h-1),f=g===9?n*r:AT(g)?2*r:r,v=p+f;if(v>=s){c[h]=s;break}c[h]=v,p=v}e.set(t,c)}return o-1<c.length?c[o-1]:s}renderDecoration(e,t,o,n,r,s){e.fillStyle=t&&t.toString()||"",e.fillRect(o,n,r,s)}_renderSectionHeaders(e){let t=this._model.options.minimapLineHeight,o=this._model.options.sectionHeaderFontSize,n=this._model.options.sectionHeaderLetterSpacing,r=o*1.5,{canvasInnerWidth:s}=this._model.options,l=this._model.options.backgroundColor,c=`rgb(${l.r} ${l.g} ${l.b} / .7)`,u=this._model.options.sectionHeaderFontColor,p=`rgb(${u.r} ${u.g} ${u.b})`,h=p,g=this._decorationsCanvas.domNode.getContext("2d");g.letterSpacing=n+"px",g.font="500 "+o+"px "+this._model.options.sectionHeaderFontFamily,g.strokeStyle=h,g.lineWidth=.4;let f=this._model.getSectionHeaderDecorationsInViewport(e.startLineNumber,e.endLineNumber);f.sort((b,S)=>b.range.startLineNumber-S.range.startLineNumber);let v=a._fitSectionHeader.bind(null,g,s-iW);for(let b of f){let S=e.getYForLineNumber(b.range.startLineNumber,t)+o,y=S-o,w=y+2,k=this._model.getSectionHeaderText(b,v);a._renderSectionLabel(g,k,b.options.minimap?.sectionHeaderStyle===2,c,p,s,y,r,S,w)}}static _fitSectionHeader(e,t,o){if(!o)return o;let n="\u2026",r=e.measureText(o).width,s=e.measureText(n).width;if(r<=t||r<=s)return o;let l=o.length,c=r/o.length,u=Math.floor((t-s)/c)-1,p=Math.ceil(u/2);for(;p>0&&/\s/.test(o[p-1]);)--p;return o.substring(0,p)+n+o.substring(l-(u-p))}static _renderSectionLabel(e,t,o,n,r,s,l,c,u,p){t&&(e.fillStyle=n,e.fillRect(0,l,s,c),e.fillStyle=r,e.fillText(t,iW,u)),o&&(e.beginPath(),e.moveTo(0,p),e.lineTo(s,p),e.closePath(),e.stroke())}renderLines(e){let t=e.startLineNumber,o=e.endLineNumber,n=this._model.options.minimapLineHeight;if(this._lastRenderData&&this._lastRenderData.linesEquals(e)){let Se=this._lastRenderData._get();return new Bft(e,Se.imageData,Se.lines)}let r=this._getBuffer();if(!r)return null;let[s,l,c]=a._renderUntouchedLines(r,e.topPaddingLineCount,t,o,n,this._lastRenderData),u=this._model.getMinimapLinesRenderingData(t,o,c),p=this._model.getOptions().tabSize,h=this._model.options.defaultBackgroundColor,g=this._model.options.backgroundColor,f=this._model.options.foregroundAlpha,v=this._model.tokensColorTracker,b=v.backgroundIsLight(),S=this._model.options.renderMinimap,y=this._model.options.charRenderer(),w=this._model.options.fontScale,k=this._model.options.minimapCharWidth,N=(S===1?2:3)*w,O=n>N?Math.floor((n-N)/2):0,V=g.a/255,U=new BN(Math.round((g.r-h.r)*V+h.r),Math.round((g.g-h.g)*V+h.g),Math.round((g.b-h.b)*V+h.b),255),G=e.topPaddingLineCount*n,$=[];for(let Se=0,ke=o-t+1;Se<ke;Se++)c[Se]&&a._renderLine(r,U,g.a,b,S,k,v,f,y,G,O,p,u[Se],w,n),$[Se]=new Vft(G),G+=n;let te=s===-1?0:s,de=(l===-1?r.height:l)-te;return this._canvas.domNode.getContext("2d").putImageData(r,0,0,0,te,r.width,de),new Bft(e,r,$)}static _renderUntouchedLines(e,t,o,n,r,s){let l=[];if(!s){for(let G=0,$=n-o+1;G<$;G++)l[G]=!0;return[-1,-1,l]}let c=s._get(),u=c.imageData.data,p=c.rendLineNumberStart,h=c.lines,g=h.length,f=e.width,v=e.data,b=(n-o+1)*r*f*4,S=-1,y=-1,w=-1,k=-1,T=-1,N=-1,O=t*r;for(let G=o;G<=n;G++){let $=G-o,te=G-p,pe=te>=0&&te<g?h[te].dy:-1;if(pe===-1){l[$]=!0,O+=r;continue}let de=pe*f*4,se=(pe+r)*f*4,Se=O*f*4,ke=(O+r)*f*4;k===de&&N===Se?(k=se,N=ke):(w!==-1&&(v.set(u.subarray(w,k),T),S===-1&&w===0&&w===T&&(S=k),y===-1&&k===b&&w===T&&(y=w)),w=de,k=se,T=Se,N=ke),l[$]=!1,O+=r}w!==-1&&(v.set(u.subarray(w,k),T),S===-1&&w===0&&w===T&&(S=k),y===-1&&k===b&&w===T&&(y=w));let V=S===-1?-1:S/(f*4),U=y===-1?-1:y/(f*4);return[V,U,l]}static _renderLine(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){let S=f.content,y=f.tokens,w=e.width-s,k=b===1,T=iW,N=0,O=0;for(let V=0,U=y.getCount();V<U;V++){let G=y.getEndOffset(V),$=y.getForeground(V),te=l.getColor($);for(;N<G;N++){if(T>w)return;let pe=S.charCodeAt(N);if(pe===9){let de=g-(N+O)%g;O+=de-1,T+=de*s}else if(pe===32)T+=s;else{let de=AT(pe)?2:1;for(let se=0;se<de;se++)if(r===2?u.blockRenderChar(e,T,p+h,te,c,t,o,k):u.renderChar(e,T,p+h,pe,te,c,t,o,v,n,k),T+=s,T>w)return}}}}},zft=class{constructor(i,e,t){this._startLineNumber=i,this._endLineNumber=e,this._defaultValue=t,this._values=[];for(let o=0,n=this._endLineNumber-this._startLineNumber+1;o<n;o++)this._values[o]=t}has(i){return this.get(i)!==this._defaultValue}set(i,e){i<this._startLineNumber||i>this._endLineNumber||(this._values[i-this._startLineNumber]=e)}get(i){return i<this._startLineNumber||i>this._endLineNumber?this._defaultValue:this._values[i-this._startLineNumber]}};var Kft=class extends mu{constructor(i,e){super(i),this._viewDomNode=e;let o=this._context.configuration.options.get(165);this._widgets={},this._verticalScrollbarWidth=o.verticalScrollbarWidth,this._minimapWidth=o.minimap.minimapWidth,this._horizontalScrollbarHeight=o.horizontalScrollbarHeight,this._editorHeight=o.height,this._editorWidth=o.width,this._viewDomNodeRect={top:0,left:0,width:0,height:0},this._domNode=or(document.createElement("div")),PS.write(this._domNode,4),this._domNode.setClassName("overlayWidgets"),this.overflowingOverlayWidgetsDomNode=or(document.createElement("div")),PS.write(this.overflowingOverlayWidgetsDomNode,5),this.overflowingOverlayWidgetsDomNode.setClassName("overflowingOverlayWidgets")}dispose(){super.dispose(),this._widgets={}}getDomNode(){return this._domNode}onConfigurationChanged(i){let t=this._context.configuration.options.get(165);return this._verticalScrollbarWidth=t.verticalScrollbarWidth,this._minimapWidth=t.minimap.minimapWidth,this._horizontalScrollbarHeight=t.horizontalScrollbarHeight,this._editorHeight=t.height,this._editorWidth=t.width,!0}_widgetCanOverflow(i){let t=this._context.configuration.options.get(4);return(i.allowEditorOverflow||!1)&&t}addWidget(i){let e=or(i.getDomNode());this._widgets[i.getId()]={widget:i,preference:null,domNode:e},e.setPosition("absolute"),e.setAttribute("widgetId",i.getId()),this._widgetCanOverflow(i)?this.overflowingOverlayWidgetsDomNode.appendChild(e):this._domNode.appendChild(e),this.setShouldRender(),this._updateMaxMinWidth()}setWidgetPosition(i,e){let t=this._widgets[i.getId()],o=e?e.preference:null,n=e?.stackOrdinal;return t.preference===o&&t.stack===n?(this._updateMaxMinWidth(),!1):(t.preference=o,t.stack=n,this.setShouldRender(),this._updateMaxMinWidth(),!0)}removeWidget(i){let e=i.getId();if(this._widgets.hasOwnProperty(e)){let o=this._widgets[e].domNode.domNode;delete this._widgets[e],o.remove(),this.setShouldRender(),this._updateMaxMinWidth()}}_updateMaxMinWidth(){let i=0,e=Object.keys(this._widgets);for(let t=0,o=e.length;t<o;t++){let n=e[t],s=this._widgets[n].widget.getMinContentWidthInPx?.();typeof s<"u"&&(i=Math.max(i,s))}this._context.viewLayout.setOverlayWidgetsMinWidth(i)}_renderWidget(i,e){let t=i.domNode;if(i.preference===null){t.setTop("");return}let o=2*this._verticalScrollbarWidth+this._minimapWidth;if(i.preference===0||i.preference===1){if(i.preference===1){let n=t.domNode.clientHeight;t.setTop(this._editorHeight-n-2*this._horizontalScrollbarHeight)}else t.setTop(0);i.stack!==void 0?(t.setTop(e[i.preference]),e[i.preference]+=t.domNode.clientWidth):t.setRight(o)}else if(i.preference===2)t.domNode.style.right="50%",i.stack!==void 0?(t.setTop(e[2]),e[2]+=t.domNode.clientHeight):t.setTop(0);else{let{top:n,left:r}=i.preference;if(this._context.configuration.options.get(51)&&this._widgetCanOverflow(i.widget)){let l=this._viewDomNodeRect;t.setTop(n+l.top),t.setLeft(r+l.left),t.setPosition("fixed")}else t.setTop(n),t.setLeft(r),t.setPosition("absolute")}}prepareRender(i){this._viewDomNodeRect=Yn(this._viewDomNode.domNode)}render(i){this._domNode.setWidth(this._editorWidth);let e=Object.keys(this._widgets),t=Array.from({length:3},()=>0);e.sort((o,n)=>(this._widgets[o].stack||0)-(this._widgets[n].stack||0));for(let o=0,n=e.length;o<n;o++){let r=e[o];this._renderWidget(this._widgets[r],t)}}};var sqe=class{constructor(i,e,t,o){this._viewportBrand=void 0;this.top=i|0,this.left=e|0,this.width=t|0,this.height=o|0}},Gft=class{constructor(i,e){this.tabSize=i,this.data=e}},Zse=class{constructor(i,e,t,o,n,r,s){this._viewLineDataBrand=void 0;this.content=i,this.continuesWithWrappedLine=e,this.minColumn=t,this.maxColumn=o,this.startVisibleColumn=n,this.tokens=r,this.inlineDecorations=s}},KU=class a{constructor(i,e,t,o,n,r,s,l,c,u,p,h){this.minColumn=i,this.maxColumn=e,this.content=t,this.continuesWithWrappedLine=o,this.isBasicASCII=a.isBasicASCII(t,r),this.containsRTL=a.containsRTL(t,this.isBasicASCII,n),this.tokens=s,this.inlineDecorations=l,this.tabSize=c,this.startVisibleColumn=u,this.textDirection=p,this.hasVariableFonts=h}static isBasicASCII(i,e){return e?oU(i):!0}static containsRTL(i,e,t){return!e&&t?yM(i):!1}};var eae=class a{constructor(i,e,t){this.color=i;this.zIndex=e;this.data=t}static compareByRenderingProps(i,e){return i.zIndex===e.zIndex?i.color<e.color?-1:i.color>e.color?1:0:i.zIndex-e.zIndex}static equals(i,e){return i.color===e.color&&i.zIndex===e.zIndex&&$i(i.data,e.data)}static equalsArr(i,e){return $i(i,e,a.equals)}};var KJt=class{constructor(i,e){let t=i.options;this.lineHeight=t.get(75),this.pixelRatio=t.get(163),this.overviewRulerLanes=t.get(95),this.renderBorder=t.get(94);let o=e.getColor(bft);this.borderColor=o?o.toString():null,this.hideCursor=t.get(68);let n=e.getColor(I9);this.cursorColorSingle=n?n.transparent(.7).toString():null;let r=e.getColor(hft);this.cursorColorPrimary=r?r.transparent(.7).toString():null;let s=e.getColor(gft);this.cursorColorSecondary=s?s.transparent(.7).toString():null,this.themeType=e.type;let l=t.get(81),c=l.enabled,u=l.side,p=e.getColor(uqi),h=kc.getDefaultBackground();p?this.backgroundColor=p:c&&u==="right"?this.backgroundColor=h:this.backgroundColor=null;let f=t.get(165).overviewRuler;this.top=f.top,this.right=f.right,this.domWidth=f.width,this.domHeight=f.height,this.overviewRulerLanes===0?(this.canvasWidth=0,this.canvasHeight=0):(this.canvasWidth=this.domWidth*this.pixelRatio|0,this.canvasHeight=this.domHeight*this.pixelRatio|0);let[v,b]=this._initLanes(1,this.canvasWidth,this.overviewRulerLanes);this.x=v,this.w=b}_initLanes(i,e,t){let o=e-i;if(t>=3){let n=Math.floor(o/3),r=Math.floor(o/3),s=o-n-r,l=i,c=l+n,u=l+n+s;return[[0,l,c,l,u,l,c,l],[0,n,s,n+s,r,n+s+r,s+r,n+s+r]]}else if(t===2){let n=Math.floor(o/2),r=o-n,s=i,l=s+n;return[[0,s,s,s,l,s,s,s],[0,n,n,n,r,n+r,n+r,n+r]]}else{let n=i,r=o;return[[0,n,n,n,n,n,n,n],[0,r,r,r,r,r,r,r]]}}equals(i){return this.lineHeight===i.lineHeight&&this.pixelRatio===i.pixelRatio&&this.overviewRulerLanes===i.overviewRulerLanes&&this.renderBorder===i.renderBorder&&this.borderColor===i.borderColor&&this.hideCursor===i.hideCursor&&this.cursorColorSingle===i.cursorColorSingle&&this.cursorColorPrimary===i.cursorColorPrimary&&this.cursorColorSecondary===i.cursorColorSecondary&&this.themeType===i.themeType&&Oe.equals(this.backgroundColor,i.backgroundColor)&&this.top===i.top&&this.right===i.right&&this.domWidth===i.domWidth&&this.domHeight===i.domHeight&&this.canvasWidth===i.canvasWidth&&this.canvasHeight===i.canvasHeight}};var $ft=class extends mu{constructor(e){super(e);this._actualShouldRender=0;this._renderedDecorations=[];this._renderedCursorPositions=[];this._domNode=or(document.createElement("canvas")),this._domNode.setClassName("decorationsOverviewRuler"),this._domNode.setPosition("absolute"),this._domNode.setLayerHinting(!0),this._domNode.setContain("strict"),this._domNode.setAttribute("aria-hidden","true"),this._updateSettings(!1),this._tokensColorTrackerListener=kc.onDidChange(t=>{t.changedColorMap&&this._updateSettings(!0)}),this._cursorPositions=[{position:new Ie(1,1),color:this._settings.cursorColorSingle}]}dispose(){super.dispose(),this._tokensColorTrackerListener.dispose()}_updateSettings(e){let t=new KJt(this._context.configuration,this._context.theme);return this._settings&&this._settings.equals(t)?!1:(this._settings=t,this._domNode.setTop(this._settings.top),this._domNode.setRight(this._settings.right),this._domNode.setWidth(this._settings.domWidth),this._domNode.setHeight(this._settings.domHeight),this._domNode.domNode.width=this._settings.canvasWidth,this._domNode.domNode.height=this._settings.canvasHeight,e&&this._render(),!0)}_markRenderingIsNeeded(){return this._actualShouldRender=2,!0}_markRenderingIsMaybeNeeded(){return this._actualShouldRender=1,!0}onConfigurationChanged(e){return this._updateSettings(!1)?this._markRenderingIsNeeded():!1}onCursorStateChanged(e){this._cursorPositions=[];for(let t=0,o=e.selections.length;t<o;t++){let n=this._settings.cursorColorSingle;o>1&&(n=t===0?this._settings.cursorColorPrimary:this._settings.cursorColorSecondary),this._cursorPositions.push({position:e.selections[t].getPosition(),color:n})}return this._cursorPositions.sort((t,o)=>Ie.compare(t.position,o.position)),this._markRenderingIsMaybeNeeded()}onDecorationsChanged(e){return e.affectsOverviewRuler?this._markRenderingIsMaybeNeeded():!1}onFlushed(e){return this._markRenderingIsNeeded()}onScrollChanged(e){return e.scrollHeightChanged?this._markRenderingIsNeeded():!1}onZonesChanged(e){return this._markRenderingIsNeeded()}onThemeChanged(e){return this._updateSettings(!1)?this._markRenderingIsNeeded():!1}getDomNode(){return this._domNode.domNode}prepareRender(e){}render(e){this._render(),this._actualShouldRender=0}_render(){let e=this._settings.backgroundColor;if(this._settings.overviewRulerLanes===0){this._domNode.setBackgroundColor(e?Oe.Format.CSS.formatHexA(e):""),this._domNode.setDisplay("none");return}let t=this._context.viewModel.getAllOverviewRulerDecorations(this._context.theme);if(t.sort(eae.compareByRenderingProps),this._actualShouldRender===1&&!eae.equalsArr(this._renderedDecorations,t)&&(this._actualShouldRender=2),this._actualShouldRender===1&&!$i(this._renderedCursorPositions,this._cursorPositions,(v,b)=>v.position.lineNumber===b.position.lineNumber&&v.color===b.color)&&(this._actualShouldRender=2),this._actualShouldRender===1)return;this._renderedDecorations=t,this._renderedCursorPositions=this._cursorPositions,this._domNode.setDisplay("block");let o=this._settings.canvasWidth,n=this._settings.canvasHeight,r=this._settings.lineHeight,s=this._context.viewLayout,l=this._context.viewLayout.getScrollHeight(),c=n/l,u=6*this._settings.pixelRatio|0,p=u/2|0,h=this._domNode.domNode.getContext("2d");e?e.isOpaque()?(h.fillStyle=Oe.Format.CSS.formatHexA(e),h.fillRect(0,0,o,n)):(h.clearRect(0,0,o,n),h.fillStyle=Oe.Format.CSS.formatHexA(e),h.fillRect(0,0,o,n)):h.clearRect(0,0,o,n);let g=this._settings.x,f=this._settings.w;for(let v of t){let b=v.color,S=v.data;h.fillStyle=b;let y=0,w=0,k=0;for(let T=0,N=S.length/3;T<N;T++){let O=S[3*T],V=S[3*T+1],U=S[3*T+2],G=s.getVerticalOffsetForLineNumber(V)*c|0,$=(s.getVerticalOffsetForLineNumber(U)+r)*c|0;if($-G<u){let pe=(G+$)/2|0;pe<p?pe=p:pe+p>n&&(pe=n-p),G=pe-p,$=pe+p}G>k+1||O!==y?(T!==0&&h.fillRect(g[y],w,f[y],k-w),y=O,w=G,k=$):$>k&&(k=$)}h.fillRect(g[y],w,f[y],k-w)}if(!this._settings.hideCursor){let v=2*this._settings.pixelRatio|0,b=v/2|0,S=this._settings.x[7],y=this._settings.w[7],w=-100,k=-100,T=null;for(let N=0,O=this._cursorPositions.length;N<O;N++){let V=this._cursorPositions[N].color;if(!V)continue;let U=this._cursorPositions[N].position,G=s.getVerticalOffsetForLineNumber(U.lineNumber)*c|0;G<b?G=b:G+b>n&&(G=n-b);let $=G-b,te=$+v;$>k+1||V!==T?(N!==0&&T&&h.fillRect(S,w,y,k-w),w=$,k=te):te>k&&(k=te),T=V,h.fillStyle=V}T&&h.fillRect(S,w,y,k-w)}this._settings.renderBorder&&this._settings.borderColor&&this._settings.overviewRulerLanes>0&&(h.beginPath(),h.lineWidth=1,h.strokeStyle=this._settings.borderColor,h.moveTo(0,0),h.lineTo(0,n),h.moveTo(1,0),h.lineTo(o,0),h.stroke())}};var qft=class{constructor(i,e,t){this._colorZoneBrand=void 0;this.from=i|0,this.to=e|0,this.colorId=t|0}static compare(i,e){return i.colorId===e.colorId?i.from===e.from?i.to-e.to:i.from-e.from:i.colorId-e.colorId}},aqe=class{constructor(i,e,t,o){this._overviewRulerZoneBrand=void 0;this.startLineNumber=i,this.endLineNumber=e,this.heightInLines=t,this.color=o,this._colorZone=null}static compare(i,e){return i.color===e.color?i.startLineNumber===e.startLineNumber?i.heightInLines===e.heightInLines?i.endLineNumber-e.endLineNumber:i.heightInLines-e.heightInLines:i.startLineNumber-e.startLineNumber:i.color<e.color?-1:1}setColorZone(i){this._colorZone=i}getColorZones(){return this._colorZone}},jft=class{constructor(i){this._getVerticalOffsetForLine=i,this._zones=[],this._colorZonesInvalid=!1,this._lineHeight=0,this._domWidth=0,this._domHeight=0,this._outerHeight=0,this._pixelRatio=1,this._lastAssignedId=0,this._color2Id=Object.create(null),this._id2Color=[]}getId2Color(){return this._id2Color}setZones(i){this._zones=i,this._zones.sort(aqe.compare)}setLineHeight(i){return this._lineHeight===i?!1:(this._lineHeight=i,this._colorZonesInvalid=!0,!0)}setPixelRatio(i){this._pixelRatio=i,this._colorZonesInvalid=!0}getDOMWidth(){return this._domWidth}getCanvasWidth(){return this._domWidth*this._pixelRatio}setDOMWidth(i){return this._domWidth===i?!1:(this._domWidth=i,this._colorZonesInvalid=!0,!0)}getDOMHeight(){return this._domHeight}getCanvasHeight(){return this._domHeight*this._pixelRatio}setDOMHeight(i){return this._domHeight===i?!1:(this._domHeight=i,this._colorZonesInvalid=!0,!0)}getOuterHeight(){return this._outerHeight}setOuterHeight(i){return this._outerHeight===i?!1:(this._outerHeight=i,this._colorZonesInvalid=!0,!0)}resolveColorZones(){let i=this._colorZonesInvalid,e=Math.floor(this._lineHeight),t=Math.floor(this.getCanvasHeight()),o=Math.floor(this._outerHeight),n=t/o,r=Math.floor(4*this._pixelRatio/2),s=[];for(let l=0,c=this._zones.length;l<c;l++){let u=this._zones[l];if(!i){let k=u.getColorZones();if(k){s.push(k);continue}}let p=this._getVerticalOffsetForLine(u.startLineNumber),h=u.heightInLines===0?this._getVerticalOffsetForLine(u.endLineNumber)+e:p+u.heightInLines*e,g=Math.floor(n*p),f=Math.floor(n*h),v=Math.floor((g+f)/2),b=f-v;b<r&&(b=r),v-b<0&&(v=b),v+b>t&&(v=t-b);let S=u.color,y=this._color2Id[S];y||(y=++this._lastAssignedId,this._color2Id[S]=y,this._id2Color[y]=S);let w=new qft(v-b,v+b,y);u.setColorZone(w),s.push(w)}return this._colorZonesInvalid=!1,s.sort(qft.compare),s}};var Qft=class extends Jk{constructor(i,e){super(),this._context=i;let t=this._context.configuration.options;this._domNode=or(document.createElement("canvas")),this._domNode.setClassName(e),this._domNode.setPosition("absolute"),this._domNode.setLayerHinting(!0),this._domNode.setContain("strict"),this._zoneManager=new jft(o=>this._context.viewLayout.getVerticalOffsetForLineNumber(o)),this._zoneManager.setDOMWidth(0),this._zoneManager.setDOMHeight(0),this._zoneManager.setOuterHeight(this._context.viewLayout.getScrollHeight()),this._zoneManager.setLineHeight(t.get(75)),this._zoneManager.setPixelRatio(t.get(163)),this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),super.dispose()}onConfigurationChanged(i){let e=this._context.configuration.options;return i.hasChanged(75)&&(this._zoneManager.setLineHeight(e.get(75)),this._render()),i.hasChanged(163)&&(this._zoneManager.setPixelRatio(e.get(163)),this._domNode.setWidth(this._zoneManager.getDOMWidth()),this._domNode.setHeight(this._zoneManager.getDOMHeight()),this._domNode.domNode.width=this._zoneManager.getCanvasWidth(),this._domNode.domNode.height=this._zoneManager.getCanvasHeight(),this._render()),!0}onFlushed(i){return this._render(),!0}onScrollChanged(i){return i.scrollHeightChanged&&(this._zoneManager.setOuterHeight(i.scrollHeight),this._render()),!0}onZonesChanged(i){return this._render(),!0}getDomNode(){return this._domNode.domNode}setLayout(i){this._domNode.setTop(i.top),this._domNode.setRight(i.right);let e=!1;e=this._zoneManager.setDOMWidth(i.width)||e,e=this._zoneManager.setDOMHeight(i.height)||e,e&&(this._domNode.setWidth(this._zoneManager.getDOMWidth()),this._domNode.setHeight(this._zoneManager.getDOMHeight()),this._domNode.domNode.width=this._zoneManager.getCanvasWidth(),this._domNode.domNode.height=this._zoneManager.getCanvasHeight(),this._render())}setZones(i){this._zoneManager.setZones(i),this._render()}_render(){if(this._zoneManager.getOuterHeight()===0)return!1;let i=this._zoneManager.getCanvasWidth(),e=this._zoneManager.getCanvasHeight(),t=this._zoneManager.resolveColorZones(),o=this._zoneManager.getId2Color(),n=this._domNode.domNode.getContext("2d");return n.clearRect(0,0,i,e),t.length>0&&this._renderOneLane(n,t,o,i),!0}_renderOneLane(i,e,t,o){let n=0,r=0,s=0;for(let l of e){let c=l.colorId,u=l.from,p=l.to;c!==n?(n!==0&&i.fillRect(0,r,o,s-r),n=c,i.fillStyle=t[n],r=u,s=p):s>=u?s=Math.max(s,p):(i.fillRect(0,r,o,s-r),r=u,s=p)}i.fillRect(0,r,o,s-r)}};var Yft=class extends mu{constructor(i){super(i),this.domNode=or(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this.domNode.setClassName("view-rulers"),this._renderedRulers=[];let e=this._context.configuration.options;this._rulers=e.get(116),this._typicalHalfwidthCharacterWidth=e.get(59).typicalHalfwidthCharacterWidth}dispose(){super.dispose()}onConfigurationChanged(i){let e=this._context.configuration.options;return this._rulers=e.get(116),this._typicalHalfwidthCharacterWidth=e.get(59).typicalHalfwidthCharacterWidth,!0}onScrollChanged(i){return i.scrollHeightChanged}prepareRender(i){}_ensureRulersCount(){let i=this._renderedRulers.length,e=this._rulers.length;if(i===e)return;if(i<e){let o=e-i;for(;o>0;){let n=or(document.createElement("div"));n.setClassName("view-ruler"),n.setWidth("1ch"),this.domNode.appendChild(n),this._renderedRulers.push(n),o--}return}let t=i-e;for(;t>0;){let o=this._renderedRulers.pop();this.domNode.removeChild(o),t--}}render(i){this._ensureRulersCount();for(let e=0,t=this._rulers.length;e<t;e++){let o=this._renderedRulers[e],n=this._rulers[e];o.setBoxShadow(n.color?`1px 0 0 0 ${n.color} inset`:""),o.setHeight(Math.min(i.scrollHeight,1e6)),o.setLeft(n.column*this._typicalHalfwidthCharacterWidth)}}};var Xft=class extends mu{constructor(i){super(i),this._scrollTop=0,this._width=0,this._updateWidth(),this._shouldShow=!1;let t=this._context.configuration.options.get(117);this._useShadows=t.useShadows,this._domNode=or(document.createElement("div")),this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true")}dispose(){super.dispose()}_updateShouldShow(){let i=this._useShadows&&this._scrollTop>0;return this._shouldShow!==i?(this._shouldShow=i,!0):!1}getDomNode(){return this._domNode}_updateWidth(){let e=this._context.configuration.options.get(165);e.minimap.renderMinimap===0||e.minimap.minimapWidth>0&&e.minimap.minimapLeft===0?this._width=e.width:this._width=e.width-e.verticalScrollbarWidth}onConfigurationChanged(i){let t=this._context.configuration.options.get(117);return this._useShadows=t.useShadows,this._updateWidth(),this._updateShouldShow(),!0}onScrollChanged(i){return this._scrollTop=i.scrollTop,this._updateShouldShow()}prepareRender(i){}render(i){this._domNode.setWidth(this._width),this._domNode.setClassName(this._shouldShow?"scroll-decoration":"")}};var GJt=class{constructor(i){this.left=i.left,this.width=i.width,this.startStyle=null,this.endStyle=null}},$Jt=class{constructor(i,e){this.lineNumber=i,this.ranges=e}};function oAo(a){return new GJt(a)}function nAo(a){return new $Jt(a.lineNumber,a.ranges.map(oAo))}var Zft=class a extends Jw{constructor(e){super();this._previousFrameVisibleRangesWithStyle=[];this._context=e;let t=this._context.configuration.options;this._roundedSelection=t.get(115),this._typicalHalfwidthCharacterWidth=t.get(59).typicalHalfwidthCharacterWidth,this._selections=[],this._renderResult=null,this._context.addEventHandler(this)}static{this.SELECTION_CLASS_NAME="selected-text"}static{this.SELECTION_TOP_LEFT="top-left-radius"}static{this.SELECTION_BOTTOM_LEFT="bottom-left-radius"}static{this.SELECTION_TOP_RIGHT="top-right-radius"}static{this.SELECTION_BOTTOM_RIGHT="bottom-right-radius"}static{this.EDITOR_BACKGROUND_CLASS_NAME="monaco-editor-background"}static{this.ROUNDED_PIECE_WIDTH=10}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){let t=this._context.configuration.options;return this._roundedSelection=t.get(115),this._typicalHalfwidthCharacterWidth=t.get(59).typicalHalfwidthCharacterWidth,!0}onCursorStateChanged(e){return this._selections=e.selections.slice(0),!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}_visibleRangesHaveGaps(e){for(let t=0,o=e.length;t<o;t++)if(e[t].ranges.length>1)return!0;return!1}_enrichVisibleRangesWithStyle(e,t,o){let n=this._typicalHalfwidthCharacterWidth/4,r=null,s=null;if(o&&o.length>0&&t.length>0){let l=t[0].lineNumber;if(l===e.startLineNumber)for(let u=0;!r&&u<o.length;u++)o[u].lineNumber===l&&(r=o[u].ranges[0]);let c=t[t.length-1].lineNumber;if(c===e.endLineNumber)for(let u=o.length-1;!s&&u>=0;u--)o[u].lineNumber===c&&(s=o[u].ranges[0]);r&&!r.startStyle&&(r=null),s&&!s.startStyle&&(s=null)}for(let l=0,c=t.length;l<c;l++){let u=t[l].ranges[0],p=u.left,h=u.left+u.width,g={top:0,bottom:0},f={top:0,bottom:0};if(l>0){let v=t[l-1].ranges[0].left,b=t[l-1].ranges[0].left+t[l-1].ranges[0].width;Jft(p-v)<n?g.top=2:p>v&&(g.top=1),Jft(h-b)<n?f.top=2:v<h&&h<b&&(f.top=1)}else r&&(g.top=r.startStyle.top,f.top=r.endStyle.top);if(l+1<c){let v=t[l+1].ranges[0].left,b=t[l+1].ranges[0].left+t[l+1].ranges[0].width;Jft(p-v)<n?g.bottom=2:v<p&&p<b&&(g.bottom=1),Jft(h-b)<n?f.bottom=2:h<b&&(f.bottom=1)}else s&&(g.bottom=s.startStyle.bottom,f.bottom=s.endStyle.bottom);u.startStyle=g,u.endStyle=f}}_getVisibleRangesWithStyle(e,t,o){let r=(t.linesVisibleRangesForRange(e,!0)||[]).map(nAo);return!this._visibleRangesHaveGaps(r)&&this._roundedSelection&&this._enrichVisibleRangesWithStyle(t.visibleRange,r,o),r}_createSelectionPiece(e,t,o,n,r){return'<div class="cslr '+o+'" style="top:'+e.toString()+"px;bottom:"+t.toString()+"px;left:"+n.toString()+"px;width:"+r.toString()+'px;"></div>'}_actualRenderOneSelection(e,t,o,n){if(n.length===0)return;let r=!!n[0].ranges[0].startStyle,s=n[0].lineNumber,l=n[n.length-1].lineNumber;for(let c=0,u=n.length;c<u;c++){let p=n[c],h=p.lineNumber,g=h-t,f=o&&h===s?1:0,v=o&&h!==s&&h===l?1:0,b="",S="";for(let y=0,w=p.ranges.length;y<w;y++){let k=p.ranges[y];if(r){let N=k.startStyle,O=k.endStyle;if(N.top===1||N.bottom===1){b+=this._createSelectionPiece(f,v,a.SELECTION_CLASS_NAME,k.left-a.ROUNDED_PIECE_WIDTH,a.ROUNDED_PIECE_WIDTH);let V=a.EDITOR_BACKGROUND_CLASS_NAME;N.top===1&&(V+=" "+a.SELECTION_TOP_RIGHT),N.bottom===1&&(V+=" "+a.SELECTION_BOTTOM_RIGHT),b+=this._createSelectionPiece(f,v,V,k.left-a.ROUNDED_PIECE_WIDTH,a.ROUNDED_PIECE_WIDTH)}if(O.top===1||O.bottom===1){b+=this._createSelectionPiece(f,v,a.SELECTION_CLASS_NAME,k.left+k.width,a.ROUNDED_PIECE_WIDTH);let V=a.EDITOR_BACKGROUND_CLASS_NAME;O.top===1&&(V+=" "+a.SELECTION_TOP_LEFT),O.bottom===1&&(V+=" "+a.SELECTION_BOTTOM_LEFT),b+=this._createSelectionPiece(f,v,V,k.left+k.width,a.ROUNDED_PIECE_WIDTH)}}let T=a.SELECTION_CLASS_NAME;if(r){let N=k.startStyle,O=k.endStyle;N.top===0&&(T+=" "+a.SELECTION_TOP_LEFT),N.bottom===0&&(T+=" "+a.SELECTION_BOTTOM_LEFT),O.top===0&&(T+=" "+a.SELECTION_TOP_RIGHT),O.bottom===0&&(T+=" "+a.SELECTION_BOTTOM_RIGHT)}S+=this._createSelectionPiece(f,v,T,k.left,k.width)}e[g][0]+=b,e[g][1]+=S}}prepareRender(e){let t=[],o=e.visibleRange.startLineNumber,n=e.visibleRange.endLineNumber;for(let s=o;s<=n;s++){let l=s-o;t[l]=["",""]}let r=[];for(let s=0,l=this._selections.length;s<l;s++){let c=this._selections[s];if(c.isEmpty()){r[s]=null;continue}let u=this._getVisibleRangesWithStyle(c,e,this._previousFrameVisibleRangesWithStyle[s]);r[s]=u,this._actualRenderOneSelection(t,o,this._selections.length>1,u)}this._previousFrameVisibleRangesWithStyle=r,this._renderResult=t.map(([s,l])=>s+l)}render(e,t){if(!this._renderResult)return"";let o=t-e;return o<0||o>=this._renderResult.length?"":this._renderResult[o]}};is((a,i)=>{let e=a.getColor(nGi);e&&!e.isTransparent()&&i.addRule(`.monaco-editor .view-line span.inline-selected-text { color: ${e}; }`)});function Jft(a){return a<0?-a:a}var evt=class{constructor(i,e,t,o,n,r,s){this.top=i;this.left=e;this.paddingLeft=t;this.width=o;this.height=n;this.textContent=r;this.textContentClassName=s}};var lqe=class{constructor(i,e){this._context=i;let t=this._context.configuration.options,o=t.get(59);this._cursorStyle=t.get(161),this._typicalHalfwidthCharacterWidth=o.typicalHalfwidthCharacterWidth,this._lineCursorWidth=Math.min(t.get(37),this._typicalHalfwidthCharacterWidth),this._lineCursorHeight=t.get(38),this._isVisible=!0,this._domNode=or(document.createElement("div")),this._domNode.setClassName(`cursor ${tE}`),this._domNode.setHeight(this._context.viewLayout.getLineHeightForLineNumber(1)),this._domNode.setTop(0),this._domNode.setLeft(0),Pd(this._domNode,o),this._domNode.setDisplay("none"),this._position=new Ie(1,1),this._pluralityClass="",this.setPlurality(e),this._lastRenderedContent="",this._renderData=null}getDomNode(){return this._domNode}getPosition(){return this._position}setPlurality(i){switch(i){default:case 0:this._pluralityClass="";break;case 1:this._pluralityClass="cursor-primary";break;case 2:this._pluralityClass="cursor-secondary";break}}show(){this._isVisible||(this._domNode.setVisibility("inherit"),this._isVisible=!0)}hide(){this._isVisible&&(this._domNode.setVisibility("hidden"),this._isVisible=!1)}onConfigurationChanged(i){let e=this._context.configuration.options,t=e.get(59);return this._cursorStyle=e.get(161),this._typicalHalfwidthCharacterWidth=t.typicalHalfwidthCharacterWidth,this._lineCursorWidth=Math.min(e.get(37),this._typicalHalfwidthCharacterWidth),this._lineCursorHeight=e.get(38),Pd(this._domNode,t),!0}onCursorPositionChanged(i,e){return e?this._domNode.domNode.style.transitionProperty="none":this._domNode.domNode.style.transitionProperty="",this._position=i,!0}_getGraphemeAwarePosition(){let{lineNumber:i,column:e}=this._position,t=this._context.viewModel.getLineContent(i),[o,n]=vpt(t,e-1);return[new Ie(i,o+1),t.substring(o,n)]}_prepareRender(i){let e="",t="",[o,n]=this._getGraphemeAwarePosition(),r=this._context.viewLayout.getLineHeightForLineNumber(o.lineNumber),s=this._lineCursorHeight===0?r:Math.min(r,this._lineCursorHeight),l=(r-s)/2;if(this._cursorStyle===1||this._cursorStyle===4){let v=i.visibleRangeForPosition(o);if(!v||v.outsideRenderedLine)return null;let b=Me(this._domNode.domNode),S;this._cursorStyle===1?(S=a7t(b,this._lineCursorWidth>0?this._lineCursorWidth:2),S>2&&(e=n,t=this._getTokenClassName(o))):S=a7t(b,1);let y=v.left,w=0;S>=2&&y>=1&&(w=1,y-=w);let k=i.getVerticalOffsetForLineNumber(o.lineNumber)-i.bigNumbersDelta+l;return new evt(k,y,w,S,s,e,t)}let c=i.linesVisibleRangesForRange(new z(o.lineNumber,o.column,o.lineNumber,o.column+n.length),!1);if(!c||c.length===0)return null;let u=c[0];if(u.outsideRenderedLine||u.ranges.length===0)return null;let p=u.ranges[0],h=n===" "?this._typicalHalfwidthCharacterWidth:p.width<1?this._typicalHalfwidthCharacterWidth:p.width;this._cursorStyle===2&&(e=n,t=this._getTokenClassName(o));let g=i.getVerticalOffsetForLineNumber(o.lineNumber)-i.bigNumbersDelta,f=r;return(this._cursorStyle===3||this._cursorStyle===6)&&(g+=r-2,f=2),new evt(g,p.left,0,h,f,e,t)}_getTokenClassName(i){let e=this._context.viewModel.getViewLineData(i.lineNumber),t=e.tokens.findTokenIndexAtOffset(i.column-1);return e.tokens.getClassName(t)}prepareRender(i){this._renderData=this._prepareRender(i)}render(i){return this._renderData?(this._lastRenderedContent!==this._renderData.textContent&&(this._lastRenderedContent=this._renderData.textContent,this._domNode.domNode.textContent=this._lastRenderedContent),this._domNode.setClassName(`cursor ${this._pluralityClass} ${tE} ${this._renderData.textContentClassName}`),this._domNode.setDisplay("block"),this._domNode.setTop(this._renderData.top),this._domNode.setLeft(this._renderData.left),this._domNode.setPaddingLeft(this._renderData.paddingLeft),this._domNode.setWidth(this._renderData.width),this._domNode.setLineHeight(this._renderData.height),this._domNode.setHeight(this._renderData.height),{domNode:this._domNode.domNode,position:this._position,contentLeft:this._renderData.left,height:this._renderData.height,width:2}):(this._domNode.setDisplay("none"),null)}};var tvt=class a extends mu{static{this.BLINK_INTERVAL=500}constructor(i){super(i);let e=this._context.configuration.options;this._readOnly=e.get(104),this._cursorBlinking=e.get(32),this._cursorStyle=e.get(161),this._cursorSmoothCaretAnimation=e.get(33),this._editContextEnabled=e.get(170),this._selectionIsEmpty=!0,this._isComposingInput=!1,this._isVisible=!1,this._primaryCursor=new lqe(this._context,0),this._secondaryCursors=[],this._renderData=[],this._domNode=or(document.createElement("div")),this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true"),this._updateDomClassName(),this._domNode.appendChild(this._primaryCursor.getDomNode()),this._startCursorBlinkAnimation=new Nl,this._cursorFlatBlinkInterval=new ZD,this._blinkingEnabled=!1,this._editorHasFocus=!1,this._updateBlinking()}dispose(){super.dispose(),this._startCursorBlinkAnimation.dispose(),this._cursorFlatBlinkInterval.dispose()}getDomNode(){return this._domNode}onCompositionStart(i){return this._isComposingInput=!0,this._updateBlinking(),!0}onCompositionEnd(i){return this._isComposingInput=!1,this._updateBlinking(),!0}onConfigurationChanged(i){let e=this._context.configuration.options;this._readOnly=e.get(104),this._cursorBlinking=e.get(32),this._cursorStyle=e.get(161),this._cursorSmoothCaretAnimation=e.get(33),this._editContextEnabled=e.get(170),this._updateBlinking(),this._updateDomClassName(),this._primaryCursor.onConfigurationChanged(i);for(let t=0,o=this._secondaryCursors.length;t<o;t++)this._secondaryCursors[t].onConfigurationChanged(i);return!0}_onCursorPositionChanged(i,e,t){let o=this._secondaryCursors.length!==e.length||this._cursorSmoothCaretAnimation==="explicit"&&t!==3;if(this._primaryCursor.setPlurality(e.length?1:0),this._primaryCursor.onCursorPositionChanged(i,o),this._updateBlinking(),this._secondaryCursors.length<e.length){let n=e.length-this._secondaryCursors.length;for(let r=0;r<n;r++){let s=new lqe(this._context,2);this._domNode.domNode.insertBefore(s.getDomNode().domNode,this._primaryCursor.getDomNode().domNode.nextSibling),this._secondaryCursors.push(s)}}else if(this._secondaryCursors.length>e.length){let n=this._secondaryCursors.length-e.length;for(let r=0;r<n;r++)this._domNode.removeChild(this._secondaryCursors[0].getDomNode()),this._secondaryCursors.splice(0,1)}for(let n=0;n<e.length;n++)this._secondaryCursors[n].onCursorPositionChanged(e[n],o)}onCursorStateChanged(i){let e=[];for(let o=0,n=i.selections.length;o<n;o++)e[o]=i.selections[o].getPosition();this._onCursorPositionChanged(e[0],e.slice(1),i.reason);let t=i.selections[0].isEmpty();return this._selectionIsEmpty!==t&&(this._selectionIsEmpty=t,this._updateDomClassName()),!0}onDecorationsChanged(i){return!0}onFlushed(i){return!0}onFocusChanged(i){return this._editorHasFocus=i.isFocused,this._updateBlinking(),!1}onLinesChanged(i){return!0}onLinesDeleted(i){return!0}onLinesInserted(i){return!0}onScrollChanged(i){return!0}onTokensChanged(i){let e=t=>{for(let o=0,n=i.ranges.length;o<n;o++)if(i.ranges[o].fromLineNumber<=t.lineNumber&&t.lineNumber<=i.ranges[o].toLineNumber)return!0;return!1};if(e(this._primaryCursor.getPosition()))return!0;for(let t of this._secondaryCursors)if(e(t.getPosition()))return!0;return!1}onZonesChanged(i){return!0}_getCursorBlinking(){return this._isComposingInput&&!this._editContextEnabled?0:this._editorHasFocus?this._readOnly?5:this._cursorBlinking:0}_updateBlinking(){this._startCursorBlinkAnimation.cancel(),this._cursorFlatBlinkInterval.cancel();let i=this._getCursorBlinking(),e=i===0,t=i===5;e?this._hide():this._show(),this._blinkingEnabled=!1,this._updateDomClassName(),!e&&!t&&(i===1?this._cursorFlatBlinkInterval.cancelAndSet(()=>{this._isVisible?this._hide():this._show()},a.BLINK_INTERVAL,Me(this._domNode.domNode)):this._startCursorBlinkAnimation.setIfNotSet(()=>{this._blinkingEnabled=!0,this._updateDomClassName()},a.BLINK_INTERVAL))}_updateDomClassName(){this._domNode.setClassName(this._getClassName())}_getClassName(){let i="cursors-layer";switch(this._selectionIsEmpty||(i+=" has-selection"),this._cursorStyle){case 1:i+=" cursor-line-style";break;case 2:i+=" cursor-block-style";break;case 3:i+=" cursor-underline-style";break;case 4:i+=" cursor-line-thin-style";break;case 5:i+=" cursor-block-outline-style";break;case 6:i+=" cursor-underline-thin-style";break;default:i+=" cursor-line-style"}if(this._blinkingEnabled)switch(this._getCursorBlinking()){case 1:i+=" cursor-blink";break;case 2:i+=" cursor-smooth";break;case 3:i+=" cursor-phase";break;case 4:i+=" cursor-expand";break;case 5:i+=" cursor-solid";break;default:i+=" cursor-solid"}else i+=" cursor-solid";return(this._cursorSmoothCaretAnimation==="on"||this._cursorSmoothCaretAnimation==="explicit")&&(i+=" cursor-smooth-caret-animation"),i}_show(){this._primaryCursor.show();for(let i=0,e=this._secondaryCursors.length;i<e;i++)this._secondaryCursors[i].show();this._isVisible=!0}_hide(){this._primaryCursor.hide();for(let i=0,e=this._secondaryCursors.length;i<e;i++)this._secondaryCursors[i].hide();this._isVisible=!1}prepareRender(i){this._primaryCursor.prepareRender(i);for(let e=0,t=this._secondaryCursors.length;e<t;e++)this._secondaryCursors[e].prepareRender(i)}render(i){let e=[],t=0,o=this._primaryCursor.render(i);o&&(e[t++]=o);for(let n=0,r=this._secondaryCursors.length;n<r;n++){let s=this._secondaryCursors[n].render(i);s&&(e[t++]=s)}this._renderData=e}getLastRenderData(){return this._renderData}};is((a,i)=>{let e=[{class:".cursor",foreground:I9,background:mft},{class:".cursor-primary",foreground:hft,background:Q$i},{class:".cursor-secondary",foreground:gft,background:Y$i}];for(let t of e){let o=a.getColor(t.foreground);if(o){let n=a.getColor(t.background);n||(n=o.opposite()),i.addRule(`.monaco-editor .cursors-layer ${t.class} { background-color: ${o}; border-color: ${o}; color: ${n}; }`),Ug(a.type)&&i.addRule(`.monaco-editor .cursors-layer.has-selection ${t.class} { border-left: 1px solid ${n}; border-right: 1px solid ${n}; }`)}}});var jJt=()=>{throw new Error("Invalid change accessor")},ivt=class extends mu{constructor(i){super(i);let e=this._context.configuration.options,t=e.get(165);this._lineHeight=e.get(75),this._contentWidth=t.contentWidth,this._contentLeft=t.contentLeft,this.domNode=or(document.createElement("div")),this.domNode.setClassName("view-zones"),this.domNode.setPosition("absolute"),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this.marginDomNode=or(document.createElement("div")),this.marginDomNode.setClassName("margin-view-zones"),this.marginDomNode.setPosition("absolute"),this.marginDomNode.setAttribute("role","presentation"),this.marginDomNode.setAttribute("aria-hidden","true"),this._zones={}}dispose(){super.dispose(),this._zones={}}_recomputeWhitespacesProps(){let i=this._context.viewLayout.getWhitespaces(),e=new Map;for(let o of i)e.set(o.id,o);let t=!1;return this._context.viewModel.changeWhitespace(o=>{let n=Object.keys(this._zones);for(let r=0,s=n.length;r<s;r++){let l=n[r],c=this._zones[l],u=this._computeWhitespaceProps(c.delegate);c.isInHiddenArea=u.isInHiddenArea;let p=e.get(l);p&&(p.afterLineNumber!==u.afterViewLineNumber||p.height!==u.heightInPx)&&(o.changeOneWhitespace(l,u.afterViewLineNumber,u.heightInPx),this._safeCallOnComputedHeight(c.delegate,u.heightInPx),t=!0)}}),t}onConfigurationChanged(i){let e=this._context.configuration.options,t=e.get(165);return this._lineHeight=e.get(75),this._contentWidth=t.contentWidth,this._contentLeft=t.contentLeft,i.hasChanged(75)&&this._recomputeWhitespacesProps(),!0}onLineMappingChanged(i){return this._recomputeWhitespacesProps()}onLinesDeleted(i){return!0}onScrollChanged(i){return i.scrollTopChanged||i.scrollWidthChanged}onZonesChanged(i){return!0}onLinesInserted(i){return!0}_getZoneOrdinal(i){return i.ordinal??i.afterColumn??1e4}_computeWhitespaceProps(i){if(i.afterLineNumber===0)return{isInHiddenArea:!1,afterViewLineNumber:0,heightInPx:this._heightInPixels(i),minWidthInPx:this._minWidthInPixels(i)};let e;if(typeof i.afterColumn<"u")e=this._context.viewModel.model.validatePosition({lineNumber:i.afterLineNumber,column:i.afterColumn});else{let r=this._context.viewModel.model.validatePosition({lineNumber:i.afterLineNumber,column:1}).lineNumber;e=new Ie(r,this._context.viewModel.model.getLineMaxColumn(r))}let t;e.column===this._context.viewModel.model.getLineMaxColumn(e.lineNumber)?t=this._context.viewModel.model.validatePosition({lineNumber:e.lineNumber+1,column:1}):t=this._context.viewModel.model.validatePosition({lineNumber:e.lineNumber,column:e.column+1});let o=this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(e,i.afterColumnAffinity,!0),n=i.showInHiddenAreas||this._context.viewModel.coordinatesConverter.modelPositionIsVisible(t);return{isInHiddenArea:!n,afterViewLineNumber:o.lineNumber,heightInPx:n?this._heightInPixels(i):0,minWidthInPx:this._minWidthInPixels(i)}}changeViewZones(i){let e=!1;return this._context.viewModel.changeWhitespace(t=>{let o={addZone:n=>(e=!0,this._addZone(t,n)),removeZone:n=>{n&&(e=this._removeZone(t,n)||e)},layoutZone:n=>{n&&(e=this._layoutZone(t,n)||e)}};sAo(i,o),o.addZone=jJt,o.removeZone=jJt,o.layoutZone=jJt}),e}_addZone(i,e){let t=this._computeWhitespaceProps(e),n={whitespaceId:i.insertWhitespace(t.afterViewLineNumber,this._getZoneOrdinal(e),t.heightInPx,t.minWidthInPx),delegate:e,isInHiddenArea:t.isInHiddenArea,isVisible:!1,domNode:or(e.domNode),marginDomNode:e.marginDomNode?or(e.marginDomNode):null};return this._safeCallOnComputedHeight(n.delegate,t.heightInPx),n.domNode.setPosition("absolute"),n.domNode.domNode.style.width="100%",n.domNode.setDisplay("none"),n.domNode.setAttribute("monaco-view-zone",n.whitespaceId),this.domNode.appendChild(n.domNode),n.marginDomNode&&(n.marginDomNode.setPosition("absolute"),n.marginDomNode.domNode.style.width="100%",n.marginDomNode.setDisplay("none"),n.marginDomNode.setAttribute("monaco-view-zone",n.whitespaceId),this.marginDomNode.appendChild(n.marginDomNode)),this._zones[n.whitespaceId]=n,this.setShouldRender(),n.whitespaceId}_removeZone(i,e){if(this._zones.hasOwnProperty(e)){let t=this._zones[e];return delete this._zones[e],i.removeWhitespace(t.whitespaceId),t.domNode.removeAttribute("monaco-visible-view-zone"),t.domNode.removeAttribute("monaco-view-zone"),t.domNode.domNode.remove(),t.marginDomNode&&(t.marginDomNode.removeAttribute("monaco-visible-view-zone"),t.marginDomNode.removeAttribute("monaco-view-zone"),t.marginDomNode.domNode.remove()),this.setShouldRender(),!0}return!1}_layoutZone(i,e){if(this._zones.hasOwnProperty(e)){let t=this._zones[e],o=this._computeWhitespaceProps(t.delegate);return t.isInHiddenArea=o.isInHiddenArea,i.changeOneWhitespace(t.whitespaceId,o.afterViewLineNumber,o.heightInPx),this._safeCallOnComputedHeight(t.delegate,o.heightInPx),this.setShouldRender(),!0}return!1}shouldSuppressMouseDownOnViewZone(i){return this._zones.hasOwnProperty(i)?!!this._zones[i].delegate.suppressMouseDown:!1}_heightInPixels(i){return typeof i.heightInPx=="number"?i.heightInPx:typeof i.heightInLines=="number"?this._lineHeight*i.heightInLines:this._lineHeight}_minWidthInPixels(i){return typeof i.minWidthInPx=="number"?i.minWidthInPx:0}_safeCallOnComputedHeight(i,e){if(typeof i.onComputedHeight=="function")try{i.onComputedHeight(e)}catch(t){mt(t)}}_safeCallOnDomNodeTop(i,e){if(typeof i.onDomNodeTop=="function")try{i.onDomNodeTop(e)}catch(t){mt(t)}}prepareRender(i){}render(i){let e=i.viewportData.whitespaceViewportData,t={},o=!1;for(let r of e)this._zones[r.id].isInHiddenArea||(t[r.id]=r,o=!0);let n=Object.keys(this._zones);for(let r=0,s=n.length;r<s;r++){let l=n[r],c=this._zones[l],u=0,p=0,h="none";t.hasOwnProperty(l)?(u=t[l].verticalOffset-i.bigNumbersDelta,p=t[l].height,h="block",c.isVisible||(c.domNode.setAttribute("monaco-visible-view-zone","true"),c.isVisible=!0),this._safeCallOnDomNodeTop(c.delegate,i.getScrolledTopFromAbsoluteTop(t[l].verticalOffset))):(c.isVisible&&(c.domNode.removeAttribute("monaco-visible-view-zone"),c.isVisible=!1),this._safeCallOnDomNodeTop(c.delegate,i.getScrolledTopFromAbsoluteTop(-1e6))),c.domNode.setTop(u),c.domNode.setHeight(p),c.domNode.setDisplay(h),c.marginDomNode&&(c.marginDomNode.setTop(u),c.marginDomNode.setHeight(p),c.marginDomNode.setDisplay(h))}o&&(this.domNode.setWidth(Math.max(i.scrollWidth,this._contentWidth)),this.marginDomNode.setWidth(this._contentLeft))}};function sAo(a,i){try{return a(i)}catch(e){mt(e);return}}var ovt=class extends Jw{constructor(i){super(),this._context=i,this._options=new nvt(this._context.configuration),this._selection=[],this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(i){let e=new nvt(this._context.configuration);return this._options.equals(e)?i.hasChanged(165):(this._options=e,!0)}onCursorStateChanged(i){return this._selection=i.selections,this._options.renderWhitespace==="selection"}onDecorationsChanged(i){return!0}onFlushed(i){return!0}onLinesChanged(i){return!0}onLinesDeleted(i){return!0}onLinesInserted(i){return!0}onScrollChanged(i){return i.scrollTopChanged}onZonesChanged(i){return!0}prepareRender(i){if(this._options.renderWhitespace==="none"){this._renderResult=null;return}this._renderResult=[];for(let e=i.viewportData.startLineNumber;e<=i.viewportData.endLineNumber;e++){let t=e-i.viewportData.startLineNumber,o=this._context.viewModel.getViewLineRenderingData(e),n=null;if(this._options.renderWhitespace==="selection"){let r=this._selection;for(let s of r){if(s.endLineNumber<e||s.startLineNumber>e)continue;let l=s.startLineNumber===e?s.startColumn:o.minColumn,c=s.endLineNumber===e?s.endColumn:o.maxColumn;l<c&&(n||(n=[]),n.push(new di(l-1,c-1)))}}this._renderResult[t]=this._applyRenderWhitespace(i,e,n,o)}}_applyRenderWhitespace(i,e,t,o){if(this._options.renderWhitespace==="selection"&&!t||this._options.renderWhitespace==="trailing"&&o.continuesWithWrappedLine)return"";let n=this._context.theme.getColor(AIe),r=this._options.renderWithSVG,s=o.content,l=this._options.stopRenderingLineAfter===-1?s.length:Math.min(this._options.stopRenderingLineAfter,s.length),c=o.continuesWithWrappedLine,u=o.minColumn-1,p=this._options.renderWhitespace==="boundary",h=this._options.renderWhitespace==="trailing",g=i.getLineHeightForLineNumber(e),f=this._options.middotWidth,v=this._options.wsmiddotWidth,b=this._options.spaceWidth,S=Math.abs(v-b),y=Math.abs(f-b),w=S<y?11825:183,k=this._options.canUseHalfwidthRightwardsArrow,T="",N=!1,O=Ap(s),V;O===-1?(N=!0,O=l,V=l):V=tv(s);let U=0,G=t&&t[U],$=0;for(let te=u;te<l;te++){let pe=s.charCodeAt(te);if(G&&G.endExclusive<=te&&(U++,G=t&&t[U]),pe!==9&&pe!==32||h&&!N&&te<=V)continue;if(p&&te>=O&&te<=V&&pe===32){let se=te-1>=0?s.charCodeAt(te-1):0,Se=te+1<l?s.charCodeAt(te+1):0;if(se!==32&&Se!==32)continue}if(p&&c&&te===l-1){let se=te-1>=0?s.charCodeAt(te-1):0;if(pe===32&&se!==32&&se!==9)continue}if(t&&!(G&&G.start<=te&&te<G.endExclusive))continue;let de=i.visibleRangeForPosition(new Ie(e,te+1));de&&(r?($=Math.max($,de.left),pe===9?T+=this._renderArrow(g,b,de.left):T+=`<circle cx="${(de.left+b/2).toFixed(2)}" cy="${(g/2).toFixed(2)}" r="${(b/7).toFixed(2)}" />`):pe===9?T+=`<div class="mwh" style="left:${de.left}px;height:${g}px;">${k?"\uFFEB":"\u2192"}</div>`:T+=`<div class="mwh" style="left:${de.left}px;height:${g}px;">${String.fromCharCode(w)}</div>`)}return r?($=Math.round($+b),`<svg style="bottom:0;position:absolute;width:${$}px;height:${g}px" viewBox="0 0 ${$} ${g}" xmlns="http://www.w3.org/2000/svg" fill="${n}">`+T+"</svg>"):T}_renderArrow(i,e,t){let o=e/7,n=e,r=i/2,s=t,l={x:0,y:o/2},c={x:100/125*n,y:l.y},u={x:c.x-.2*c.x,y:c.y+.2*c.x},p={x:u.x+.1*c.x,y:u.y+.1*c.x},h={x:p.x+.35*c.x,y:p.y-.35*c.x},g={x:h.x,y:-h.y},f={x:p.x,y:-p.y},v={x:u.x,y:-u.y},b={x:c.x,y:-c.y},S={x:l.x,y:-l.y};return`<path d="M ${[l,c,u,p,h,g,f,v,b,S].map(k=>`${(s+k.x).toFixed(2)} ${(r+k.y).toFixed(2)}`).join(" L ")}" />`}render(i,e){if(!this._renderResult)return"";let t=e-i;return t<0||t>=this._renderResult.length?"":this._renderResult[t]}},nvt=class{constructor(i){let e=i.options,t=e.get(59),o=e.get(47);o==="off"?(this.renderWhitespace="none",this.renderWithSVG=!1):o==="svg"?(this.renderWhitespace=e.get(113),this.renderWithSVG=!0):(this.renderWhitespace=e.get(113),this.renderWithSVG=!1),this.spaceWidth=t.spaceWidth,this.middotWidth=t.middotWidth,this.wsmiddotWidth=t.wsmiddotWidth,this.canUseHalfwidthRightwardsArrow=t.canUseHalfwidthRightwardsArrow,this.lineHeight=e.get(75),this.stopRenderingLineAfter=e.get(133)}equals(i){return this.renderWhitespace===i.renderWhitespace&&this.renderWithSVG===i.renderWithSVG&&this.spaceWidth===i.spaceWidth&&this.middotWidth===i.middotWidth&&this.wsmiddotWidth===i.wsmiddotWidth&&this.canUseHalfwidthRightwardsArrow===i.canUseHalfwidthRightwardsArrow&&this.lineHeight===i.lineHeight&&this.stopRenderingLineAfter===i.stopRenderingLineAfter}};var rvt=class{constructor(i,e,t,o){this.selections=i,this.startLineNumber=e.startLineNumber|0,this.endLineNumber=e.endLineNumber|0,this.relativeVerticalOffset=e.relativeVerticalOffset,this.bigNumbersDelta=e.bigNumbersDelta|0,this.lineHeight=e.lineHeight|0,this.whitespaceViewportData=t,this._model=o,this.visibleRange=new z(e.startLineNumber,this._model.getLineMinColumn(e.startLineNumber),e.endLineNumber,this._model.getLineMaxColumn(e.endLineNumber))}getViewLineRenderingData(i){return this._model.getViewportViewLineRenderingData(this.visibleRange,i)}getDecorationsInViewport(){return this._model.getDecorationsInViewport(this.visibleRange)}};var svt=class{get type(){return this._theme.type}get value(){return this._theme}constructor(i){this._theme=i}update(i){this._theme=i}getColor(i){return this._theme.getColor(i)}};var avt=class{constructor(i,e,t){this.configuration=i,this.theme=new svt(e),this.viewModel=t,this.viewLayout=t.viewLayout}addEventHandler(i){this.viewModel.addViewEventHandler(i)}removeEventHandler(i){this.viewModel.removeViewEventHandler(i)}};var hW=new Float32Array([1,0,1,1,0,1,0,0,0,1,1,0]);function UN(a){if(!a)throw new Error(`Value "${a}" cannot be null`);return a}function lvt(a,i,e){let t=new i.ResizeObserver(o=>{let n=o.find(l=>l.target===a);if(!n)return;if(!("devicePixelContentBoxSize"in n)){t?.disconnect(),t=void 0;return}let r=n.devicePixelContentBoxSize[0].inlineSize,s=n.devicePixelContentBoxSize[0].blockSize;r>0&&s>0&&e(r,s)});try{t.observe(a,{box:["device-pixel-content-box"]})}catch{throw t.disconnect(),t=void 0,new ni("Could not observe device pixel dimensions")}return Z(()=>t?.disconnect())}var aAo=0,GU=class extends C{constructor(e,t,o,n){super();this.fontSize=e;this.fontFamily=t;this.devicePixelRatio=o;this._decorationStyleCache=n;this.id=aAo++;this._workGlyph={source:null,boundingBox:{left:0,bottom:0,right:0,top:0},originOffset:{x:0,y:0},fontBoundingBoxAscent:0,fontBoundingBoxDescent:0};this._workGlyphConfig={chars:void 0,tokenMetadata:0,decorationStyleSetId:0};this._antiAliasing=it?"greyscale":"subpixel";let r=Math.ceil(this.fontSize*o);this._canvas=new OffscreenCanvas(r*3,r*3),this._ctx=UN(this._canvas.getContext("2d",{willReadFrequently:!0,alpha:this._antiAliasing==="greyscale"})),this._ctx.textBaseline="top",this._ctx.fillStyle="#FFFFFF",this._ctx.font=`${r}px ${this.fontFamily}`,this._textMetrics=this._ctx.measureText("A")}get cacheKey(){return`${this.fontFamily}_${this.fontSize}px`}rasterizeGlyph(e,t,o,n){return e===""?{source:this._canvas,boundingBox:{top:0,left:0,bottom:-1,right:-1},originOffset:{x:0,y:0},fontBoundingBoxAscent:0,fontBoundingBoxDescent:0}:this._workGlyphConfig.chars===e&&this._workGlyphConfig.tokenMetadata===t&&this._workGlyphConfig.decorationStyleSetId===o?this._workGlyph:(this._workGlyphConfig.chars=e,this._workGlyphConfig.tokenMetadata=t,this._workGlyphConfig.decorationStyleSetId=o,this._rasterizeGlyph(e,t,o,n))}_rasterizeGlyph(e,t,o,n){let r=Math.ceil(this.fontSize*this.devicePixelRatio),s=r*3;this._canvas.width!==s&&(this._canvas.width=s,this._canvas.height=s),this._ctx.save();let l=(t&15)/10,c=Qu.getBackground(t),u=n[c]??n[2],p=this._decorationStyleCache.getStyleSet(o);this._antiAliasing==="subpixel"?(this._ctx.fillStyle=u,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height)):this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height);let h=new ES(200),g=Qu.getFontStyle(t);g&1&&h.appendString("italic "),p?.bold!==void 0?p.bold&&h.appendString("bold "):g&2&&h.appendString("bold "),h.appendString(`${r}px ${this.fontFamily}`),this._ctx.font=h.build();let f=r,v=r;if(p?.color!==void 0?this._ctx.fillStyle=`#${p.color.toString(16).padStart(8,"0")}`:this._ctx.fillStyle=n[Qu.getForeground(t)],p?.opacity!==void 0&&(this._ctx.globalAlpha=p.opacity),this._ctx.textBaseline="top",this._ctx.fillText(e,f+l,v),p?.strikethrough){let S=Math.round(v-this._textMetrics.alphabeticBaseline*.65),y=p?.strikethroughThickness!==void 0?Math.round(p.strikethroughThickness*this.devicePixelRatio):Math.max(1,Math.floor(r/10));p?.strikethroughColor!==void 0&&(this._ctx.fillStyle=`#${p.strikethroughColor.toString(16).padStart(8,"0")}`),this._ctx.fillRect(f,S-Math.floor(y/2),Math.ceil(this._textMetrics.width),y)}this._ctx.restore();let b=this._ctx.getImageData(0,0,this._canvas.width,this._canvas.height);if(this._antiAliasing==="subpixel"){let S=parseInt(u.substring(1,3),16),y=parseInt(u.substring(3,5),16),w=parseInt(u.substring(5,7),16);this._clearColor(b,S,y,w),this._ctx.putImageData(b,0,0)}return this._findGlyphBoundingBox(b,this._workGlyph.boundingBox),this._workGlyph.source=this._canvas,this._workGlyph.originOffset.x=this._workGlyph.boundingBox.left-f,this._workGlyph.originOffset.y=this._workGlyph.boundingBox.top-v,this._workGlyph.fontBoundingBoxAscent=this._textMetrics.fontBoundingBoxAscent,this._workGlyph.fontBoundingBoxDescent=this._textMetrics.fontBoundingBoxDescent,this._workGlyph}_clearColor(e,t,o,n){for(let r=0;r<e.data.length;r+=4)e.data[r]===t&&e.data[r+1]===o&&e.data[r+2]===n&&(e.data[r+3]=0)}_findGlyphBoundingBox(e,t){let o=this._canvas.height,n=this._canvas.width,r=!1;for(let s=0;s<o;s++){for(let l=0;l<n;l++){let c=s*n*4+l*4+3;if(e.data[c]!==0){t.top=s,r=!0;break}}if(r)break}t.left=0,r=!1;for(let s=0;s<n;s++){for(let l=0;l<o;l++){let c=l*n*4+s*4+3;if(e.data[c]!==0){t.left=s,r=!0;break}}if(r)break}t.right=n,r=!1;for(let s=n-1;s>=t.left;s--){for(let l=0;l<o;l++){let c=l*n*4+s*4+3;if(e.data[c]!==0){t.right=s,r=!0;break}}if(r)break}t.bottom=t.top,r=!1;for(let s=o-1;s>=0;s--){for(let l=0;l<n;l++){let c=s*n*4+l*4+3;if(e.data[c]!==0){t.bottom=s,r=!0;break}}if(r)break}}getTextMetrics(e){return this._ctx.measureText(e)}};I([mi],GU.prototype,"cacheKey",1);var zIe=class extends C{constructor(e){super();this._logService=e;this._tasks=[];this._i=0;this._register(Z(()=>this.clear()))}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,o=0,n=e.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(t=Date.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,Date.now()-t),o=Math.max(t,o),r=e.timeRemaining(),o*1.5>r){n-t<-20&&this._logService.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-t))}ms`),this._start();return}n=r}this.clear()}};zIe=I([m(0,ne)],zIe);var QJt=class extends zIe{_requestCallback(i){return Ki().setTimeout(()=>i(this._createDeadline(16)))}_cancelCallback(i){Ki().clearTimeout(i)}_createDeadline(i){let e=Date.now()+i;return{timeRemaining:()=>Math.max(0,e-Date.now())}}},YJt=class extends zIe{_requestCallback(i){return Ki().requestIdleCallback(i)}_cancelCallback(i){Ki().cancelIdleCallback(i)}},XJt="requestIdleCallback"in Ki()?YJt:QJt,cvt=class{constructor(i){this._queue=i.createInstance(XJt)}set(i){this._queue.clear(),this._queue.enqueue(i)}flush(){this._queue.flush()}};cvt=I([m(0,F)],cvt);var dvt=class{constructor(i,e){this._canvas=i;this._textureIndex=e;this._currentRow={x:0,y:0,h:0};this._allocatedGlyphs=new Set;this._nextIndex=0;this._ctx=UN(this._canvas.getContext("2d",{willReadFrequently:!0}))}allocate(i){let e=i.boundingBox.right-i.boundingBox.left+1,t=i.boundingBox.bottom-i.boundingBox.top+1;if(e>this._canvas.width||t>this._canvas.height)throw new ni("Glyph is too large for the atlas page");if(i.boundingBox.right-i.boundingBox.left+1>this._canvas.width-this._currentRow.x&&(this._currentRow.x=0,this._currentRow.y+=this._currentRow.h,this._currentRow.h=1),this._currentRow.y+i.boundingBox.bottom-i.boundingBox.top+1>this._canvas.height)return;this._ctx.drawImage(i.source,i.boundingBox.left,i.boundingBox.top,e,t,this._currentRow.x,this._currentRow.y,e,t);let o={pageIndex:this._textureIndex,glyphIndex:this._nextIndex++,x:this._currentRow.x,y:this._currentRow.y,w:e,h:t,originOffsetX:i.originOffset.x,originOffsetY:i.originOffset.y,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent};return this._currentRow.x+=e,this._currentRow.h=Math.max(this._currentRow.h,t),this._allocatedGlyphs.add(o),o}getUsagePreview(){let i=this._canvas.width,e=this._canvas.height,t=new OffscreenCanvas(i,e),o=UN(t.getContext("2d"));o.fillStyle="#808080",o.fillRect(0,0,i,e);let n=new Map,r=new Map;for(let s of this._allocatedGlyphs)n.set(s.y,Math.max(n.get(s.y)??0,s.h)),r.set(s.y,Math.max(r.get(s.y)??0,s.x+s.w));for(let s of this._allocatedGlyphs)o.fillStyle="#4040FF",o.fillRect(s.x,s.y,s.w,s.h),o.fillStyle="#FF0000",o.fillRect(s.x,s.y+s.h,s.w,n.get(s.y)-s.h);for(let[s,l]of r.entries())s!==this._currentRow.y&&(o.fillStyle="#FF0000",o.fillRect(l,s,i-l,n.get(s)));return t.convertToBlob()}getStats(){let i=this._canvas.width,e=this._canvas.height,t=0,o=0,n=i*e,r=new Map,s=new Map;for(let l of this._allocatedGlyphs)r.set(l.y,Math.max(r.get(l.y)??0,l.h)),s.set(l.y,Math.max(s.get(l.y)??0,l.x+l.w));for(let l of this._allocatedGlyphs)t+=l.w*l.h,o+=l.w*(r.get(l.y)-l.h);for(let[l,c]of s.entries())l!==this._currentRow.y&&(o+=(i-c)*r.get(l));return[`page${this._textureIndex}:`,` Total: ${n} (${i}x${e})`,` Used: ${t} (${(t/n*100).toPrecision(2)}%)`,` Wasted: ${o} (${(o/n*100).toPrecision(2)}%)`,`Efficiency: ${(t/(t+o)*100).toPrecision(2)}%`].join(`
`)}};var uvt=class{constructor(i,e,t){this._canvas=i;this._textureIndex=e;this._slabs=[];this._activeSlabsByDims=new GH;this._unusedRects=[];this._openRegionsByHeight=new Map;this._openRegionsByWidth=new Map;this._allocatedGlyphs=new Set;this._nextIndex=0;this._ctx=UN(this._canvas.getContext("2d",{willReadFrequently:!0})),this._slabW=Math.min(t?.slabW??64<<Math.max(Math.floor(Ki().devicePixelRatio)-1,0),this._canvas.width),this._slabH=Math.min(t?.slabH??this._slabW,this._canvas.height),this._slabsPerRow=Math.floor(this._canvas.width/this._slabW),this._slabsPerColumn=Math.floor(this._canvas.height/this._slabH)}allocate(i){let e=i.boundingBox.right-i.boundingBox.left+1,t=i.boundingBox.bottom-i.boundingBox.top+1;if(e>this._canvas.width||t>this._canvas.height)throw new ni("Glyph is too large for the atlas page");if(e>this._slabW||t>this._slabH){if(this._allocatedGlyphs.size>0)return;let c=this._canvas.width;for(;e<c/2&&t<c/2;)c/=2;this._slabW=c,this._slabH=c,this._slabsPerRow=Math.floor(this._canvas.width/this._slabW),this._slabsPerColumn=Math.floor(this._canvas.height/this._slabH)}let o={w:e,h:t},n=this._activeSlabsByDims.get(o.w,o.h);if(n){let c=Math.floor(this._slabW/n.entryW)*Math.floor(this._slabH/n.entryH);n.count>=c&&(n=void 0)}let r,s;if(!n)if(e<t){let c=this._openRegionsByWidth.get(e);if(c?.length)for(let u=c.length-1;u>=0;u--){let p=c[u];if(p.w>=e&&p.h>=t){r=p.x,s=p.y,e<p.w&&this._unusedRects.push({x:p.x+e,y:p.y,w:p.w-e,h:t}),p.y+=t,p.h-=t,p.h===0&&(u===c.length-1?c.pop():this._unusedRects.splice(u,1));break}}}else{let c=this._openRegionsByHeight.get(t);if(c?.length)for(let u=c.length-1;u>=0;u--){let p=c[u];if(p.w>=e&&p.h>=t){r=p.x,s=p.y,t<p.h&&this._unusedRects.push({x:p.x,y:p.y+t,w:e,h:p.h-t}),p.x+=e,p.w-=e,p.h===0&&(u===c.length-1?c.pop():this._unusedRects.splice(u,1));break}}}if(r===void 0||s===void 0){if(!n){if(this._slabs.length>=this._slabsPerRow*this._slabsPerColumn)return;n={x:Math.floor(this._slabs.length%this._slabsPerRow)*this._slabW,y:Math.floor(this._slabs.length/this._slabsPerRow)*this._slabH,entryW:o.w,entryH:o.h,count:0};let u=this._slabW%n.entryW,p=this._slabH%n.entryH;u&&Pqi(this._openRegionsByWidth,u,{x:n.x+this._slabW-u,w:u,y:n.y,h:this._slabH-(p??0)}),p&&Pqi(this._openRegionsByHeight,p,{x:n.x,w:this._slabW,y:n.y+this._slabH-p,h:p}),this._slabs.push(n),this._activeSlabsByDims.set(n,o.w,o.h)}let c=Math.floor(this._slabW/n.entryW);r=n.x+Math.floor(n.count%c)*n.entryW,s=n.y+Math.floor(n.count/c)*n.entryH,n.count++}this._ctx.drawImage(i.source,i.boundingBox.left,i.boundingBox.top,e,t,r,s,e,t);let l={pageIndex:this._textureIndex,glyphIndex:this._nextIndex++,x:r,y:s,w:e,h:t,originOffsetX:i.originOffset.x,originOffsetY:i.originOffset.y,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent};return this._allocatedGlyphs.add(l),l}getUsagePreview(){let i=this._canvas.width,e=this._canvas.height,t=new OffscreenCanvas(i,e),o=UN(t.getContext("2d"));o.fillStyle="#808080",o.fillRect(0,0,i,e);let n=0,r=0,s=0,l=0,c=64<<Math.floor(Ki().devicePixelRatio)-1,u=c;for(let h of this._slabs){let g=0,f=0;for(let y=0;y<h.count;y++)g+h.entryW>c&&(g=0,f+=h.entryH),o.fillStyle="#FF0000",o.fillRect(h.x+g,h.y+f,h.entryW,h.entryH),n+=h.entryW*h.entryH,g+=h.entryW;let v=Math.floor(c/h.entryW),b=Math.floor(u/h.entryH),S=h.entryW*v*h.entryH*b;s+=c*u-S}for(let h of this._allocatedGlyphs)r+=h.w*h.h,o.fillStyle="#4040FF",o.fillRect(h.x,h.y,h.w,h.h);let p=Array.from(this._openRegionsByWidth.values()).flat().concat(Array.from(this._openRegionsByHeight.values()).flat());for(let h of p)o.fillStyle="#FF000088",o.fillRect(h.x,h.y,h.w,h.h),l+=h.w*h.h;return o.globalAlpha=.5,o.drawImage(this._canvas,0,0),o.globalAlpha=1,t.convertToBlob()}getStats(){let i=this._canvas.width,e=this._canvas.height,t=0,o=0,n=0,r=0,s=0,l=i*e,c=64<<Math.floor(Ki().devicePixelRatio)-1,u=c;for(let f of this._slabs){let v=0,b=0;for(let k=0;k<f.count;k++)v+f.entryW>c&&(v=0,b+=f.entryH),t+=f.entryW*f.entryH,v+=f.entryW;let S=Math.floor(c/f.entryW),y=Math.floor(u/f.entryH),w=f.entryW*S*f.entryH*y;n+=c*u-w}for(let f of this._allocatedGlyphs)o+=f.w*f.h;let p=Array.from(this._openRegionsByWidth.values()).flat().concat(Array.from(this._openRegionsByHeight.values()).flat());for(let f of p)s+=f.w*f.h;let h=n-s;r=t-(o-h);let g=o/(o+r+s);return[`page[${this._textureIndex}]:`,` Total: ${l}px (${i}x${e})`,` Used: ${o}px (${(o/l*100).toFixed(2)}%)`,` Wasted: ${r}px (${(r/l*100).toFixed(2)}%)`,`Restricted: ${s}px (${(s/l*100).toFixed(2)}%) (hard to allocate)`,`Efficiency: ${g===1?"100":(g*100).toFixed(2)}%`,` Slabs: ${this._slabs.length} of ${Math.floor(this._canvas.width/c)*Math.floor(this._canvas.height/u)}`].join(`
`)}};function Pqi(a,i,e){let t=a.get(i);t||(t=[],a.set(i,t)),t.push(e)}var Zw=class extends C{constructor(e,t,o,n,r){super();this._logService=n;this._version=0;this._usedArea={left:0,top:0,right:0,bottom:0};this._glyphMap=new GH;this._glyphInOrderSet=new Set;switch(this._canvas=new OffscreenCanvas(t,t),this._colorMap=r.getColorTheme().tokenColorMap,o){case"shelf":this._allocator=new dvt(this._canvas,e);break;case"slab":this._allocator=new uvt(this._canvas,e);break;default:this._allocator=o(this._canvas,e);break}this._register(Z(()=>{this._canvas.width=1,this._canvas.height=1}))}get version(){return this._version}static{this.maximumGlyphCount=5e3}get usedArea(){return this._usedArea}get source(){return this._canvas}get glyphs(){return this._glyphInOrderSet.values()}getGlyph(e,t,o,n){return this._glyphMap.get(t,o,n,e.cacheKey)??this._createGlyph(e,t,o,n)}_createGlyph(e,t,o,n){if(this._glyphInOrderSet.size>=Zw.maximumGlyphCount)return;let r=e.rasterizeGlyph(t,o,n,this._colorMap),s=this._allocator.allocate(r);if(s!==void 0)return this._glyphMap.set(s,t,o,n,e.cacheKey),this._glyphInOrderSet.add(s),this._version++,this._usedArea.right=Math.max(this._usedArea.right,s.x+s.w-1),this._usedArea.bottom=Math.max(this._usedArea.bottom,s.y+s.h-1),this._logService.getLevel()===1&&this._logService.trace("New glyph",{chars:t,tokenMetadata:o,decorationStyleSetId:n,rasterizedGlyph:r,glyph:s}),s}getUsagePreview(){return this._allocator.getUsagePreview()}getStats(){return this._allocator.getStats()}};Zw=I([m(3,ne),m(4,De)],Zw);var iE=class extends C{constructor(e,t,o,n,r){super();this._maxTextureSize=e;this._decorationStyleCache=o;this._themeService=n;this._instantiationService=r;this._warmUpTask=this._register(new me);this._warmedUpRasterizers=new Set;this._pages=[];this._glyphPageIndex=new GH;this._onDidDeleteGlyphs=this._register(new E);this.onDidDeleteGlyphs=this._onDidDeleteGlyphs.event;this._allocatorType=t?.allocatorType??"slab",this._register(H.runAndSubscribe(this._themeService.onDidColorThemeChange,()=>{this._colorMap&&this.clear(),this._colorMap=this._themeService.getColorTheme().tokenColorMap}));let s=Math.max(1,Math.floor(Ki().devicePixelRatio));this.pageSize=Math.min(1024*s,this._maxTextureSize),this._initFirstPage(),this._register(Z(()=>Ue(this._pages)))}static{this.maximumPageCount=16}get pages(){return this._pages}_initFirstPage(){let e=this._instantiationService.createInstance(Zw,0,this.pageSize,this._allocatorType);this._pages.push(e);let t=new GU(1,"",1,this._decorationStyleCache);e.getGlyph(t,"",0,0),t.dispose()}clear(){for(let e of this._pages)e.dispose();this._pages.length=0,this._glyphPageIndex.clear(),this._warmedUpRasterizers.clear(),this._warmUpTask.clear(),this._initFirstPage(),this._onDidDeleteGlyphs.fire()}getGlyph(e,t,o,n,r){return o&=-2048,o|=Math.floor(r%1*10),this._warmedUpRasterizers.has(e.id)||(this._warmUpAtlas(e),this._warmedUpRasterizers.add(e.id)),this._tryGetGlyph(this._glyphPageIndex.get(t,o,n,e.cacheKey)??0,e,t,o,n)}_tryGetGlyph(e,t,o,n,r){return this._glyphPageIndex.set(e,o,n,r,t.cacheKey),this._pages[e].getGlyph(t,o,n,r)??(e+1<this._pages.length?this._tryGetGlyph(e+1,t,o,n,r):void 0)??this._getGlyphFromNewPage(t,o,n,r)}_getGlyphFromNewPage(e,t,o,n){if(this._pages.length>=iE.maximumPageCount)throw new Error(`Attempt to create a texture atlas page past the limit ${iE.maximumPageCount}`);return this._pages.push(this._instantiationService.createInstance(Zw,this._pages.length,this.pageSize,this._allocatorType)),this._glyphPageIndex.set(this._pages.length-1,t,o,n,e.cacheKey),this._pages[this._pages.length-1].getGlyph(e,t,o,n)}getUsagePreview(){return Promise.all(this._pages.map(e=>e.getUsagePreview()))}getStats(){return this._pages.map(e=>e.getStats())}_warmUpAtlas(e){let t=this._colorMap;if(!t)throw new ni("Cannot warm atlas without color map");this._warmUpTask.value?.clear();let o=this._warmUpTask.value=this._instantiationService.createInstance(XJt);for(let n=65;n<=90;n++)for(let r of t.keys())o.enqueue(()=>{for(let s=0;s<1;s+=.1)this.getGlyph(e,String.fromCharCode(n),r<<15&16744448,0,s)});for(let n=97;n<=122;n++)for(let r of t.keys())o.enqueue(()=>{for(let s=0;s<1;s+=.1)this.getGlyph(e,String.fromCharCode(n),r<<15&16744448,0,s)});for(let n=33;n<=126;n++)for(let r of t.keys())o.enqueue(()=>{for(let s=0;s<1;s+=.1)this.getGlyph(e,String.fromCharCode(n),r<<15&16744448,0,s)})}};iE=I([m(3,De),m(4,F)],iE);var St=gt,Ne=ae("notificationService");function C9(a){if(a){let i=a;return typeof i.id=="string"&&typeof i.label=="string"}return!1}var tae=class{constructor(){this.progress=new JJt;this.onDidClose=H.None;this.onDidChangeVisibility=H.None}updateSeverity(i){}updateMessage(i){}updateActions(i){}close(){}},JJt=class{infinite(){}done(){}total(i){}worked(i){}};function x9(a,i){return i===St.Error?d(2214,null,a):i===St.Warning?d(2216,null,a):d(2215,null,a)}var BI;(t=>{async function a(o){try{if(!navigator.gpu)throw new Error("This browser does not support WebGPU");let n=await navigator.gpu.requestAdapter();if(!n)throw new Error("This browser supports WebGPU but it appears to be disabled");return ZJt(await n.requestDevice())}catch(n){throw o&&o(n.message),n}}t.requestDevice=a;function i(o,n,r){let s=o.createBuffer(n);return r&&o.queue.writeBuffer(s,0,HD(r)?r():r),ZJt(s)}t.createBuffer=i;function e(o,n){return ZJt(o.createTexture(n))}t.createTexture=e})(BI||={});function ZJt(a){return{object:a,dispose:()=>a.destroy()}}var pvt=class{get dataOffset(){return this._startIndex}get dirtySize(){if(!(this._startIndex===void 0||this._endIndex===void 0))return this._endIndex-this._startIndex+1}get isDirty(){return this._startIndex!==void 0}flag(i,e=1){return this._flag(i),e>1&&this._flag(i+e-1),i}_flag(i){(this._startIndex===void 0||i<this._startIndex)&&(this._startIndex=i),(this._endIndex===void 0||i>this._endIndex)&&(this._endIndex=i)}clear(){this._startIndex=void 0,this._endIndex=void 0}};function Aqi(a,i){return new eZt(a,i)}var eZt=class extends C{constructor(e,t){super();this.propertySpecs=e;this.capacity=t;this._dirtyTracker=new pvt;this._propertySpecsMap=new Map;this._entries=new Vs;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._onDidChangeBuffer=this._register(new E);this.onDidChangeBuffer=this._onDidChangeBuffer.event;this.view=new Float32Array(t*e.length),this.buffer=this.view.buffer,this._entrySize=e.length;for(let o=0;o<e.length;o++){let n={offset:o,...e[o]};this._propertySpecsMap.set(n.name,n)}this._register(Z(()=>Ue(this._entries)))}get bufferUsedSize(){return this.viewUsedSize*Float32Array.BYTES_PER_ELEMENT}get viewUsedSize(){return this._entries.size*this._entrySize}get entryCount(){return this._entries.size}get dirtyTracker(){return this._dirtyTracker}createEntry(e){this._entries.size===this.capacity&&(this._expandBuffer(),this._onDidChangeBuffer.fire());let t=new tZt(this.view,this._propertySpecsMap,this._dirtyTracker,this._entries.size,e),o=this._entries.push(t),n=[];return n.push(H.forward(t.onDidChange,this._onDidChange)),n.push(t.onWillDispose(()=>{let r=t.i;o(),this.view.set(this.view.subarray(r*this._entrySize+2,this._entries.size*this._entrySize+2),r*this._entrySize);for(let s of this._entries)s.i>r&&s.i--;this._dirtyTracker.flag(r,(this._entries.size-r)*this._entrySize),Ue(n)})),t}_expandBuffer(){this.capacity*=2;let e=new Float32Array(this.capacity*this._entrySize);e.set(this.view),this.view=e,this.buffer=this.view.buffer}},tZt=class extends C{constructor(e,t,o,n,r){super();this._view=e;this._propertySpecsMap=t;this._dirtyTracker=o;this.i=n;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._onWillDispose=this._register(new E);this.onWillDispose=this._onWillDispose.event;for(let s of this._propertySpecsMap.values())this._view[this.i*this._propertySpecsMap.size+s.offset]=r[s.name];this._dirtyTracker.flag(this.i*this._propertySpecsMap.size,this._propertySpecsMap.size)}dispose(){this._onWillDispose.fire(),super.dispose()}set(e,t){let o=this.i*this._propertySpecsMap.size+this._propertySpecsMap.get(e).offset;this._view[this._dirtyTracker.flag(o)]=t,this._onDidChange.fire()}get(e){return this._view[this.i*this._propertySpecsMap.size+this._propertySpecsMap.get(e).offset]}setRaw(e){if(e.length!==this._propertySpecsMap.size)throw new Error(`Data length ${e.length} does not match the number of properties in the collection (${this._propertySpecsMap.size})`);this._view.set(e,this.i*this._propertySpecsMap.size),this._dirtyTracker.flag(this.i*this._propertySpecsMap.size,this._propertySpecsMap.size)}};var Nqi=`
struct Vertex {
@location(0) position: vec2f,
};
struct LayoutInfo {
canvasDims: vec2f,
viewportOffset: vec2f,
viewportDims: vec2f,
}
struct ScrollOffset {
offset: vec2f,
}
struct Shape {
position: vec2f,
size: vec2f,
color: vec4f,
};
struct VSOutput {
@builtin(position) position: vec4f,
@location(1) color: vec4f,
};
// Uniforms
@group(0) @binding(1) var<uniform> layoutInfo: LayoutInfo;
// Storage buffers
@group(0) @binding(0) var<storage, read> shapes: array<Shape>;
@group(0) @binding(2) var<uniform> scrollOffset: ScrollOffset;
@vertex fn vs(
vert: Vertex,
@builtin(instance_index) instanceIndex: u32,
@builtin(vertex_index) vertexIndex : u32
) -> VSOutput {
let shape = shapes[instanceIndex];
var vsOut: VSOutput;
vsOut.position = vec4f(
(
// Top left corner
vec2f(-1, 1) +
// Convert pixel position to clipspace
vec2f( 2, -2) / layoutInfo.canvasDims *
// Shape position and size
(layoutInfo.viewportOffset - scrollOffset.offset + shape.position + vert.position * shape.size)
),
0.0,
1.0
);
vsOut.color = shape.color;
return vsOut;
}
@fragment fn fs(vsOut: VSOutput) -> @location(0) vec4f {
return vsOut.color;
}
`;var mvt=class extends Jk{constructor(e,t,o,n,r,s){super();this._context=e;this._contentLeft=t;this._devicePixelRatio=o;this._canvas=n;this._ctx=r;this._shapeBindBuffer=this._register(new me);this._initialized=!1;this._shapeCollection=this._register(Aqi([{name:"x"},{name:"y"},{name:"width"},{name:"height"},{name:"red"},{name:"green"},{name:"blue"},{name:"alpha"}],32));this._context.addEventHandler(this),this._initWebgpu(s)}async _initWebgpu(e){if(this._device=await e,this._store.isDisposed)return;let t=navigator.gpu.getPreferredCanvasFormat();this._ctx.configure({device:this._device,format:t,alphaMode:"premultiplied"}),this._renderPassColorAttachment={view:null,loadOp:"load",storeOp:"store"},this._renderPassDescriptor={label:"Monaco rectangle renderer render pass",colorAttachments:[this._renderPassColorAttachment]};let o;{let l;(w=>(w[w.FloatsPerEntry=6]="FloatsPerEntry",w[w.BytesPerEntry=24]="BytesPerEntry",w[w.Offset_CanvasWidth____=0]="Offset_CanvasWidth____",w[w.Offset_CanvasHeight___=1]="Offset_CanvasHeight___",w[w.Offset_ViewportOffsetX=2]="Offset_ViewportOffsetX",w[w.Offset_ViewportOffsetY=3]="Offset_ViewportOffsetY",w[w.Offset_ViewportWidth__=4]="Offset_ViewportWidth__",w[w.Offset_ViewportHeight_=5]="Offset_ViewportHeight_"))(l||={});let c=new Float32Array(6),u=(p=this._canvas.width,h=this._canvas.height)=>(c[0]=p,c[1]=h,c[2]=Math.ceil(this._context.configuration.options.get(165).contentLeft*Ki().devicePixelRatio),c[3]=0,c[4]=c[0]-c[2],c[5]=c[1]-c[3],c);o=this._register(BI.createBuffer(this._device,{label:"Monaco rectangle renderer uniform buffer",size:24,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST},()=>u())).object,this._register(lvt(this._canvas,Ki(),(p,h)=>{this._device.queue.writeBuffer(o,0,u(p,h))}))}let n=2;this._scrollOffsetBindBuffer=this._register(BI.createBuffer(this._device,{label:"Monaco rectangle renderer scroll offset buffer",size:n*Float32Array.BYTES_PER_ELEMENT,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST})).object,this._scrollOffsetValueBuffer=new Float32Array(n);let r=()=>BI.createBuffer(this._device,{label:"Monaco rectangle renderer shape buffer",size:this._shapeCollection.buffer.byteLength,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST});this._shapeBindBuffer.value=r(),this._register(H.runAndSubscribe(this._shapeCollection.onDidChangeBuffer,()=>{this._shapeBindBuffer.value=r(),this._pipeline&&this._updateBindGroup(this._pipeline,o)})),this._vertexBuffer=this._register(BI.createBuffer(this._device,{label:"Monaco rectangle renderer vertex buffer",size:hW.byteLength,usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST},hW)).object;let s=this._device.createShaderModule({label:"Monaco rectangle renderer shader module",code:Nqi});this._pipeline=this._device.createRenderPipeline({label:"Monaco rectangle renderer render pipeline",layout:"auto",vertex:{module:s,buffers:[{arrayStride:2*Float32Array.BYTES_PER_ELEMENT,attributes:[{shaderLocation:0,offset:0,format:"float32x2"}]}]},fragment:{module:s,targets:[{format:t,blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"}}}]}}),this._updateBindGroup(this._pipeline,o),this._initialized=!0}_updateBindGroup(e,t){this._bindGroup=this._device.createBindGroup({label:"Monaco rectangle renderer bind group",layout:e.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:this._shapeBindBuffer.value.object}},{binding:1,resource:{buffer:t}},{binding:2,resource:{buffer:this._scrollOffsetBindBuffer}}]})}register(e,t,o,n,r,s,l,c){return this._shapeCollection.createEntry({x:e,y:t,width:o,height:n,red:r,green:s,blue:l,alpha:c})}onScrollChanged(e){if(this._device){let t=Ki().devicePixelRatio;this._scrollOffsetValueBuffer[0]=this._context.viewLayout.getCurrentScrollLeft()*t,this._scrollOffsetValueBuffer[1]=this._context.viewLayout.getCurrentScrollTop()*t,this._device.queue.writeBuffer(this._scrollOffsetBindBuffer,0,this._scrollOffsetValueBuffer)}return!0}_update(){if(!this._device)return;let e=this._shapeCollection;e.dirtyTracker.isDirty&&(this._device.queue.writeBuffer(this._shapeBindBuffer.value.object,0,e.buffer,e.dirtyTracker.dataOffset,e.dirtyTracker.dirtySize*e.view.BYTES_PER_ELEMENT),e.dirtyTracker.clear())}draw(e){if(!this._initialized)return;this._update();let t=this._device.createCommandEncoder({label:"Monaco rectangle renderer command encoder"});this._renderPassColorAttachment.view=this._ctx.getCurrentTexture().createView();let o=t.beginRenderPass(this._renderPassDescriptor);o.setPipeline(this._pipeline),o.setVertexBuffer(0,this._vertexBuffer),o.setBindGroup(0,this._bindGroup);let n=Math.ceil(this._contentLeft.get()*this._devicePixelRatio.get());o.setScissorRect(n,0,this._canvas.width-n,this._canvas.height),o.draw(hW.length/2,this._shapeCollection.entryCount),o.end();let r=t.finish();this._device.queue.submit([r])}};var hvt=class extends C{constructor(){super();this._ruleCache=new Map;this._cssVariableCache=new Map;this._container=_("div.monaco-decoration-css-rule-extractor"),this._dummyElement=_("span"),this._container.appendChild(this._dummyElement),this._register(Z(()=>this._container.remove()))}getStyleRules(e,t){let o=this._ruleCache.get(t);if(o)return o;this._dummyElement.className=t,e.appendChild(this._container);let n=this._getStyleRules(t);return this._ruleCache.set(t,n),e.removeChild(this._container),n}_getStyleRules(e){let t=[],n=[...rh().styleSheets],r=e.split(" ").filter(s=>s.length>0);for(let s=0;s<n.length;s++){let l=n[s];this._collectMatchingRules(l.cssRules,r,t)}return t}_collectMatchingRules(e,t,o){for(let n of e)if(n instanceof CSSImportRule)n.styleSheet&&this._collectMatchingRules(n.styleSheet.cssRules,t,o);else if(n instanceof CSSStyleRule){for(let r of t){let s=`.${r}`,l=n.selectorText.indexOf(s);if(l!==-1){let c=l+s.length;if(n.selectorText.length===c||n.selectorText.substring(c,c+1).match(/[ :.]/)){o.push(n);break}}}n.cssRules?.length&&this._collectMatchingRules(n.cssRules,t,o)}}resolveCssVariable(e,t){let o=this._cssVariableCache.get(t);return o===void 0&&(e.appendChild(this._container),o=Ki().getComputedStyle(this._container).getPropertyValue(t).trim(),e.removeChild(this._container),this._cssVariableCache.set(t,o)),o}clear(){this._ruleCache.clear(),this._cssVariableCache.clear()}};var gvt=class{constructor(){this._nextId=1;this._cacheById=new Map;this._cacheByStyle=new GH}getOrCreateEntry(i,e,t,o,n,r){if(i===void 0&&e===void 0&&t===void 0&&o===void 0&&n===void 0&&r===void 0)return 0;let s=this._cacheByStyle.get(i??0,e?1:0,t===void 0?"":t.toFixed(2),o?1:0,n===void 0?"":n.toFixed(2),r??0);if(s)return s.id;let l=this._nextId++,c={id:l,color:i,bold:e,opacity:t,strikethrough:o,strikethroughThickness:n,strikethroughColor:r};return this._cacheById.set(l,c),this._cacheByStyle.set(c,i??0,e?1:0,t===void 0?"":t.toFixed(2),o?1:0,n===void 0?"":n.toFixed(2),r??0),l}getStyleSet(i){if(i!==0)return this._cacheById.get(i)}};var ec=class extends C{constructor(e,t,o,n,r){super();this._instantiationService=t;this._notificationService=o;this.configurationService=n;this._themeService=r;this.maxGpuCols=2e3;this.canvas=or(document.createElement("canvas")),this.canvas.setClassName("editorCanvas"),this._register(H.runAndSubscribe(n.onDidChangeConfiguration,u=>{if(!u||u.affectsConfiguration("editor.scrollbar.verticalScrollbarSize")){let p=n.getValue("editor").scrollbar?.verticalScrollbarSize??14;this.canvas.domNode.style.boxSizing="border-box",this.canvas.domNode.style.paddingRight=`${p}px`}})),this.ctx=UN(this.canvas.domNode.getContext("webgpu")),ec.device||(ec.device=BI.requestDevice(u=>{let p=[{label:d(189,null),run:()=>this.configurationService.updateValue("editor.experimentalGpuAcceleration","off")}];this._notificationService.prompt(St.Warning,u,p)}).then(u=>(ec.deviceSync=u.object,ec._atlas||(ec._atlas=this._instantiationService.createInstance(iE,u.object.limits.maxTextureDimension2D,void 0,ec.decorationStyleCache)),u.object)));let s=Le(this,Ki().devicePixelRatio);this._register(j(Ki(),"resize",()=>{s.set(Ki().devicePixelRatio,void 0)})),this.devicePixelRatio=s,this._register(_s(this.devicePixelRatio,()=>ec.atlas?.clear())),this._register(this._themeService.onDidColorThemeChange(()=>{ec.decorationCssRuleExtractor.clear(),ec.atlas?.clear()}));let l=Le(this,{width:this.canvas.domNode.width,height:this.canvas.domNode.height});this._register(lvt(this.canvas.domNode,Ki(),(u,p)=>{this.canvas.domNode.width=u,this.canvas.domNode.height=p,l.set({width:u,height:p},void 0)})),this.canvasDevicePixelDimensions=l;let c=Le(this,0);this._register(this.configurationService.onDidChangeConfiguration(u=>{c.set(e.configuration.options.get(165).contentLeft,void 0)})),this.contentLeft=c,this.rectangleRenderer=this._register(this._instantiationService.createInstance(mvt,e,this.contentLeft,this.devicePixelRatio,this.canvas.domNode,this.ctx,ec.device))}static{this._decorationCssRuleExtractor=new hvt}static get decorationCssRuleExtractor(){return ec._decorationCssRuleExtractor}static{this._decorationStyleCache=new gvt}static get decorationStyleCache(){return ec._decorationStyleCache}static get atlas(){if(!ec._atlas)throw new ni("Cannot call ViewGpuContext.textureAtlas before device is resolved");return ec._atlas}get atlas(){return ec.atlas}canRender(e,t,o){let n=t.getViewLineRenderingData(o);if(n.containsRTL||n.maxColumn>this.maxGpuCols)return!1;if(n.inlineDecorations.length>0){let r=!0;for(let s of n.inlineDecorations){if(s.type!==0){r=!1;break}let l=ec._decorationCssRuleExtractor.getStyleRules(this.canvas.domNode,s.inlineClassName);if(r&&=l.every(c=>{if(c.selectorText.includes(":"))return!1;for(let u of c.style)if(!Oqi(u,c.style))return!1;return!0}),!r)break}return r}return!0}canRenderDetailed(e,t,o){let n=t.getViewLineRenderingData(o),r=[];if(n.containsRTL&&r.push("containsRTL"),n.maxColumn>this.maxGpuCols&&r.push("maxColumn > maxGpuCols"),n.inlineDecorations.length>0){let s=!0,l=[],c=[],u=[];for(let p of n.inlineDecorations){if(p.type!==0){l.push(p.type),s=!1;continue}let h=ec._decorationCssRuleExtractor.getStyleRules(this.canvas.domNode,p.inlineClassName);s&&=h.every(g=>{if(g.selectorText.includes(":"))return c.push(g.selectorText),!1;for(let f of g.style)if(!Oqi(f,g.style))return u.push(`${f}: ${g.style[f]}`),!1;return!0})}l.length>0&&r.push(`inlineDecorations with unsupported types (${l.map(p=>`\`${p}\``).join(", ")})`),u.length>0&&r.push(`inlineDecorations with unsupported CSS rules (${u.map(p=>`\`${p}\``).join(", ")})`),c.length>0&&r.push(`inlineDecorations with unsupported CSS selectors (${c.map(p=>`\`${p}\``).join(", ")})`)}return r}};ec=I([m(1,F),m(2,Ne),m(3,B),m(4,De)],ec);var cAo=["color","font-weight","opacity","text-decoration","text-decoration-color","text-decoration-line","text-decoration-style","text-decoration-thickness"];function Oqi(a,i){if(!cAo.includes(a))return!1;switch(a){case"text-decoration":case"text-decoration-line":return i.getPropertyValue(a)==="line-through";case"text-decoration-color":{let e=i.getPropertyValue(a);return/^var\(--[^,]+,\s*(?:initial|inherit)\)$/.test(e)?!0:Oe.Format.CSS.parse(e)!==null}case"text-decoration-style":return i.getPropertyValue(a)==="initial";case"text-decoration-thickness":{let e=i.getPropertyValue(a);return e==="initial"||/^\d+(\.\d+)?px$/.test(e)}default:return!0}}function k9(a,i){return a.isBasicASCII&&i.useMonospaceOptimizations?new iZt(a):new oZt(a)}var iZt=class{constructor(i){this._content=i.content}getSegmentAtIndex(i){return this._content[i]}getSegmentData(i){}},oZt=class{constructor(i){this._segments=[];let e=i.content,t=Wu.Segmenter(void 0,{granularity:"grapheme"}).value,o=Array.from(t.segment(e)),n=0;for(let r=0;r<e.length;r++){let s=o[n];if(!s)break;if(s.index!==r){this._segments.push(void 0);continue}n++,this._segments.push(s)}}getSegmentAtIndex(i){return this._segments[i]?.segment}getSegmentData(i){return this._segments[i]}};var KIe=class extends Jk{constructor(e,t,o,n){super();this._context=e;this._viewGpuContext=t;this._device=o;this._glyphRasterizer=n;this._context.addEventHandler(this)}get glyphRasterizer(){return this._glyphRasterizer.value}};var fvt=`
struct GlyphInfo {
position: vec2f,
size: vec2f,
origin: vec2f,
};
struct Vertex {
@location(0) position: vec2f,
};
struct Cell {
position: vec2f,
unused1: vec2f,
glyphIndex: f32,
textureIndex: f32
};
struct LayoutInfo {
canvasDims: vec2f,
viewportOffset: vec2f,
viewportDims: vec2f,
}
struct ScrollOffset {
offset: vec2f
}
struct VSOutput {
@builtin(position) position: vec4f,
@location(1) layerIndex: f32,
@location(0) texcoord: vec2f,
};
// Uniforms
@group(0) @binding(4) var<uniform> layoutInfo: LayoutInfo;
@group(0) @binding(5) var<uniform> atlasDims: vec2f;
@group(0) @binding(6) var<uniform> scrollOffset: ScrollOffset;
// Storage buffers
@group(0) @binding(0) var<storage, read> glyphInfo: array<array<GlyphInfo, ${Zw.maximumGlyphCount}>, ${iE.maximumPageCount}>;
@group(0) @binding(1) var<storage, read> cells: array<Cell>;
@vertex fn vs(
vert: Vertex,
@builtin(instance_index) instanceIndex: u32,
@builtin(vertex_index) vertexIndex : u32
) -> VSOutput {
let cell = cells[instanceIndex];
var glyph = glyphInfo[u32(cell.textureIndex)][u32(cell.glyphIndex)];
var vsOut: VSOutput;
// Multiple vert.position by 2,-2 to get it into clipspace which ranged from -1 to 1
vsOut.position = vec4f(
// Make everything relative to top left instead of center
vec2f(-1, 1) +
((vert.position * vec2f(2, -2)) / layoutInfo.canvasDims) * glyph.size +
((cell.position * vec2f(2, -2)) / layoutInfo.canvasDims) +
((glyph.origin * vec2f(2, -2)) / layoutInfo.canvasDims) +
(((layoutInfo.viewportOffset - scrollOffset.offset * vec2(1, -1)) * 2) / layoutInfo.canvasDims),
0.0,
1.0
);
vsOut.layerIndex = cell.textureIndex;
// Textures are flipped from natural direction on the y-axis, so flip it back
vsOut.texcoord = vert.position;
vsOut.texcoord = (
// Glyph offset (0-1)
(glyph.position / atlasDims) +
// Glyph coordinate (0-1)
(vsOut.texcoord * (glyph.size / atlasDims))
);
return vsOut;
}
@group(0) @binding(2) var ourSampler: sampler;
@group(0) @binding(3) var ourTexture: texture_2d_array<f32>;
@fragment fn fs(vsOut: VSOutput) -> @location(0) vec4f {
return textureSample(ourTexture, ourSampler, vsOut.texcoord, u32(vsOut.layerIndex));
}
`;var vvt=class a extends KIe{constructor(e,t,o,n){super(e,t,o,n);this.type="viewport";this.wgsl=fvt;this._cellBindBufferLineCapacity=63;this._activeDoubleBufferIndex=0;this._visibleObjectCount=0;this._lastViewportLineCount=0;this._scrollInitialized=!1;this._onDidChangeBindGroupEntries=this._register(new E);this.onDidChangeBindGroupEntries=this._onDidChangeBindGroupEntries.event;this._rebuildCellBuffer(this._cellBindBufferLineCapacity);let r=2;this._scrollOffsetBindBuffer=this._register(BI.createBuffer(this._device,{label:"Monaco scroll offset buffer",size:r*Float32Array.BYTES_PER_ELEMENT,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST})).object,this._scrollOffsetValueBuffer=new Float32Array(r)}static{this.maxSupportedColumns=2e3}get bindGroupEntries(){return[{binding:1,resource:{buffer:this._cellBindBuffer}},{binding:6,resource:{buffer:this._scrollOffsetBindBuffer}}]}_rebuildCellBuffer(e){this._cellBindBuffer?.destroy();let t=(Math.floor(e/32)+1)*32,o=t*a.maxSupportedColumns*6*Float32Array.BYTES_PER_ELEMENT;this._cellBindBuffer=this._register(BI.createBuffer(this._device,{label:"Monaco full file cell buffer",size:o,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST})).object,this._cellValueBuffers=[new ArrayBuffer(o),new ArrayBuffer(o)],this._cellBindBufferLineCapacity=t,this._lastViewportLineCount=0,this._onDidChangeBindGroupEntries.fire()}onConfigurationChanged(e){return!0}onDecorationsChanged(e){return!0}onTokensChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onLinesChanged(e){return!0}onScrollChanged(e){if(this._store.isDisposed)return!1;let t=Ki().devicePixelRatio;return this._scrollOffsetValueBuffer[0]=(e?.scrollLeft??this._context.viewLayout.getCurrentScrollLeft())*t,this._scrollOffsetValueBuffer[1]=(e?.scrollTop??this._context.viewLayout.getCurrentScrollTop())*t,this._device.queue.writeBuffer(this._scrollOffsetBindBuffer,0,this._scrollOffsetValueBuffer),!0}onThemeChanged(e){return!0}onLineMappingChanged(e){return!0}onZonesChanged(e){return!0}reset(){for(let e of[0,1]){let t=new Float32Array(this._cellValueBuffers[e]);t.fill(0,0,t.length),this._device.queue.writeBuffer(this._cellBindBuffer,0,t.buffer,0,t.byteLength)}this._lastViewportLineCount=0}update(e,t){let o="",n,r=0,s=0,l=0,c=0,u=0,p=0,h,g=0,f=0,v=0,b=0,S,y,w,k,T,N,O,V,U=0,G=0,$,te=Ki().devicePixelRatio,pe;this._scrollInitialized||(this.onScrollChanged(),this._scrollInitialized=!0),this._cellBindBufferLineCapacity<e.endLineNumber-e.startLineNumber+1&&this._rebuildCellBuffer(e.endLineNumber-e.startLineNumber+1);let de=new Float32Array(this._cellValueBuffers[this._activeDoubleBufferIndex]);de.fill(0);let se=a.maxSupportedColumns*6;for(s=e.startLineNumber;s<=e.endLineNumber;s++)if(this._viewGpuContext.canRender(t,e,s)){O=e.getViewLineRenderingData(s),p=0,pe=k9(O,t),r=t.spaceWidth*te,c=(O.minColumn-1)*r,$=O.tokens,f=O.minColumn-1,v=0;for(let Ee=0,He=$.getCount();Ee<He;Ee++)if(v=$.getEndOffset(Ee),!(v<=f)){for(b=$.getMetadata(Ee),l=f;l<v&&!(l>a.maxSupportedColumns);l++){if(n=pe.getSegmentAtIndex(l),n===void 0)continue;o=n,O.isBasicASCII&&t.useMonospaceOptimizations||(r=this.glyphRasterizer.getTextMetrics(o).width),y=void 0,S=void 0,w=void 0,k=void 0,T=void 0,N=void 0;for(V of O.inlineDecorations){if(s<V.range.startLineNumber||s>V.range.endLineNumber||s===V.range.startLineNumber&&l<V.range.startColumn-1||s===V.range.endLineNumber&&l>=V.range.endColumn-1)continue;let Fe=ec.decorationCssRuleExtractor.getStyleRules(this._viewGpuContext.canvas.domNode,V.inlineClassName);for(let Qt of Fe)for(let Ze of Qt.style){let Ti=Qt.styleMap.get(Ze)?.toString()??"";switch(Ze){case"color":{let ti=Oe.Format.CSS.parse(Ti);if(!ti)throw new ni("Invalid color format "+Ti);y=ti.toNumber32Bit();break}case"font-weight":{dAo(Ti)>=400?S=!0:S=!1;break}case"opacity":{w=uAo(Ti);break}case"text-decoration":case"text-decoration-line":{Ti==="line-through"&&(k=!0);break}case"text-decoration-thickness":{let ti=Ti.match(/^(\d+(?:\.\d+)?)px$/);ti&&(T=parseFloat(ti[1]));break}case"text-decoration-color":{let ti=Ti,bo=Ti.match(/^var\((--[^,]+),\s*(?:initial|inherit)\)$/);bo&&(ti=ec.decorationCssRuleExtractor.resolveCssVariable(this._viewGpuContext.canvas.domNode,bo[1]));let Ro=Oe.Format.CSS.parse(ti);Ro&&(N=Ro.toNumber32Bit());break}case"text-decoration-style":break;default:throw new ni("Unexpected inline decoration style")}}}if(o===" "||o===" "){if(g=((s-1)*a.maxSupportedColumns+l)*6,de.fill(0,g,g+6),o===" "){let Fe=l+p;p=al.nextRenderTabStop(l+p,O.tabSize),c+=r*(p-Fe),p-=l+1}else c+=r;continue}let Ve=ec.decorationStyleCache.getOrCreateEntry(y,S,w,k,T,N);h=this._viewGpuContext.atlas.getGlyph(this.glyphRasterizer,o,b,Ve,c),u=Math.round(e.relativeVerticalOffset[s-e.startLineNumber]*te+Math.floor((e.lineHeight*te-(h.fontBoundingBoxAscent+h.fontBoundingBoxDescent))/2)+h.fontBoundingBoxAscent),g=((s-e.startLineNumber)*a.maxSupportedColumns+l)*6,de[g+0]=Math.floor(c),de[g+1]=u,de[g+4]=h.glyphIndex,de[g+5]=h.pageIndex,c+=r}f=v}U=((s-e.startLineNumber)*a.maxSupportedColumns+v)*6,G=(s-e.startLineNumber)*a.maxSupportedColumns*6,de.fill(0,U,G)}let Se=(e.endLineNumber-e.startLineNumber+1)*se,ke=e.endLineNumber-e.startLineNumber+1;if(this._device.queue.writeBuffer(this._cellBindBuffer,0,de.buffer,0,Se*Float32Array.BYTES_PER_ELEMENT),ke<this._lastViewportLineCount){let Ee=this._lastViewportLineCount-ke,He=Se*Float32Array.BYTES_PER_ELEMENT,Ve=Ee*se*Float32Array.BYTES_PER_ELEMENT;this._device.queue.writeBuffer(this._cellBindBuffer,He,de.buffer,Se*Float32Array.BYTES_PER_ELEMENT,Ve)}return this._lastViewportLineCount=ke,this._activeDoubleBufferIndex=this._activeDoubleBufferIndex?0:1,this._visibleObjectCount=Se,Se}draw(e,t){if(this._visibleObjectCount<=0)throw new ni("Attempt to draw 0 objects");e.draw(hW.length/2,this._visibleObjectCount)}};function dAo(a){switch(a){case"lighter":case"normal":return 400;case"bolder":case"bold":return 700}return parseInt(a)}function uAo(a){return a.endsWith("%")?parseFloat(a.substring(0,a.length-1))/100:a.match(/^\d+(?:\.\d*)/)?parseFloat(a):1}var E9=class a extends KIe{constructor(e,t,o,n){super(e,t,o,n);this.type="fullfile";this.wgsl=fvt;this._activeDoubleBufferIndex=0;this._upToDateLines=[new Set,new Set];this._visibleObjectCount=0;this._finalRenderedLine=0;this._scrollInitialized=!1;this._queuedBufferUpdates=[[],[]];let r=a.maxSupportedLines*a.maxSupportedColumns*6*Float32Array.BYTES_PER_ELEMENT;this._cellBindBuffer=this._register(BI.createBuffer(this._device,{label:"Monaco full file cell buffer",size:r,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST})).object,this._cellValueBuffers=[new ArrayBuffer(r),new ArrayBuffer(r)];let s=2;this._scrollOffsetBindBuffer=this._register(BI.createBuffer(this._device,{label:"Monaco scroll offset buffer",size:s*Float32Array.BYTES_PER_ELEMENT,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST})).object,this._scrollOffsetValueBuffer=new Float32Array(s)}static{this.maxSupportedLines=3e3}static{this.maxSupportedColumns=200}get bindGroupEntries(){return[{binding:1,resource:{buffer:this._cellBindBuffer}},{binding:6,resource:{buffer:this._scrollOffsetBindBuffer}}]}onConfigurationChanged(e){return this._invalidateAllLines(),this._queueBufferUpdate(e),!0}onDecorationsChanged(e){return this._invalidateAllLines(),!0}onTokensChanged(e){for(let t of e.ranges)this._invalidateLineRange(t.fromLineNumber,t.toLineNumber);return!0}onLinesDeleted(e){return this._invalidateLinesFrom(e.fromLineNumber),this._queueBufferUpdate(e),!0}onLinesInserted(e){return this._invalidateLinesFrom(e.fromLineNumber),!0}onLinesChanged(e){return this._invalidateLineRange(e.fromLineNumber,e.fromLineNumber+e.count),!0}onScrollChanged(e){if(this._store.isDisposed)return!1;let t=Ki().devicePixelRatio;return this._scrollOffsetValueBuffer[0]=(e?.scrollLeft??this._context.viewLayout.getCurrentScrollLeft())*t,this._scrollOffsetValueBuffer[1]=(e?.scrollTop??this._context.viewLayout.getCurrentScrollTop())*t,this._device.queue.writeBuffer(this._scrollOffsetBindBuffer,0,this._scrollOffsetValueBuffer),!0}onThemeChanged(e){return this._invalidateAllLines(),!0}onLineMappingChanged(e){return this._invalidateAllLines(),this._queueBufferUpdate(e),!0}onZonesChanged(e){return this._invalidateAllLines(),this._queueBufferUpdate(e),!0}_invalidateAllLines(){this._upToDateLines[0].clear(),this._upToDateLines[1].clear()}_invalidateLinesFrom(e){for(let t of[0,1]){let o=this._upToDateLines[t];for(let n of o)n>=e&&o.delete(n)}}_invalidateLineRange(e,t){for(let o=e;o<=t;o++)this._upToDateLines[0].delete(o),this._upToDateLines[1].delete(o)}reset(){this._invalidateAllLines();for(let e of[0,1]){let t=new Float32Array(this._cellValueBuffers[e]);t.fill(0,0,t.length),this._device.queue.writeBuffer(this._cellBindBuffer,0,t.buffer,0,t.byteLength)}this._finalRenderedLine=0}update(e,t){let o="",n,r=0,s=0,l=0,c=0,u=0,p=0,h,g=0,f=0,v=0,b=0,S,y,w,k,T,N,O,V,U=0,G=0,$,te=Ki().devicePixelRatio,pe;this._scrollInitialized||(this.onScrollChanged(),this._scrollInitialized=!0);let de=new Float32Array(this._cellValueBuffers[this._activeDoubleBufferIndex]),se=a.maxSupportedColumns*6,Se=this._upToDateLines[this._activeDoubleBufferIndex],ke=3e3,Ee=0,He=this._queuedBufferUpdates[this._activeDoubleBufferIndex];for(;He.length;){let Fe=He.shift();switch(Fe.type){case 2:case 8:case 17:{de.fill(0),ke=1,Ee=Math.max(Ee,this._finalRenderedLine),this._finalRenderedLine=0;break}case 10:{let Qt=(Fe.fromLineNumber-1)*a.maxSupportedColumns*6,Ze=Fe.toLineNumber*a.maxSupportedColumns*6,Ti=(this._finalRenderedLine-(Fe.toLineNumber-Fe.fromLineNumber+1))*a.maxSupportedColumns*6;de.set(de.subarray(Ze),Qt),de.fill(0,Ti),ke=Math.min(ke,Fe.fromLineNumber),Ee=Math.max(Ee,this._finalRenderedLine),this._finalRenderedLine-=Fe.toLineNumber-Fe.fromLineNumber+1;break}}}for(s=e.startLineNumber;s<=e.endLineNumber;s++){if(!this._viewGpuContext.canRender(t,e,s)){U=(s-1)*a.maxSupportedColumns*6,G=s*a.maxSupportedColumns*6,de.fill(0,U,G),ke=Math.min(ke,s),Ee=Math.max(Ee,s);continue}if(!Se.has(s)){ke=Math.min(ke,s),Ee=Math.max(Ee,s),O=e.getViewLineRenderingData(s),p=0,pe=k9(O,t),r=t.spaceWidth*te,c=(O.minColumn-1)*r,$=O.tokens,f=O.minColumn-1,v=0;for(let Fe=0,Qt=$.getCount();Fe<Qt;Fe++)if(v=$.getEndOffset(Fe),!(v<=f)){for(b=$.getMetadata(Fe),l=f;l<v&&!(l>a.maxSupportedColumns);l++){if(n=pe.getSegmentAtIndex(l),n===void 0)continue;o=n,O.isBasicASCII&&t.useMonospaceOptimizations||(r=this.glyphRasterizer.getTextMetrics(o).width),y=void 0,S=void 0,w=void 0,k=void 0,T=void 0,N=void 0;for(V of O.inlineDecorations){if(s<V.range.startLineNumber||s>V.range.endLineNumber||s===V.range.startLineNumber&&l<V.range.startColumn-1||s===V.range.endLineNumber&&l>=V.range.endColumn-1)continue;let Ti=ec.decorationCssRuleExtractor.getStyleRules(this._viewGpuContext.canvas.domNode,V.inlineClassName);for(let ti of Ti)for(let bo of ti.style){let Ro=ti.styleMap.get(bo)?.toString()??"";switch(bo){case"color":{let _o=Oe.Format.CSS.parse(Ro);if(!_o)throw new ni("Invalid color format "+Ro);y=_o.toNumber32Bit();break}case"font-weight":{pAo(Ro)>=400?S=!0:S=!1;break}case"opacity":{w=mAo(Ro);break}case"text-decoration":case"text-decoration-line":{Ro==="line-through"&&(k=!0);break}case"text-decoration-thickness":{let _o=Ro.match(/^(\d+(?:\.\d+)?)px$/);_o&&(T=parseFloat(_o[1]));break}case"text-decoration-color":{let _o=Ro,sr=Ro.match(/^var\((--[^,]+),\s*(?:initial|inherit)\)$/);sr&&(_o=ec.decorationCssRuleExtractor.resolveCssVariable(this._viewGpuContext.canvas.domNode,sr[1]));let ln=Oe.Format.CSS.parse(_o);ln&&(N=ln.toNumber32Bit());break}case"text-decoration-style":break;default:throw new ni("Unexpected inline decoration style")}}}if(o===" "||o===" "){if(g=((s-1)*a.maxSupportedColumns+l)*6,de.fill(0,g,g+6),o===" "){let Ti=l+p;p=al.nextRenderTabStop(l+p,O.tabSize),c+=r*(p-Ti),p-=l+1}else c+=r;continue}let Ze=ec.decorationStyleCache.getOrCreateEntry(y,S,w,k,T,N);h=this._viewGpuContext.atlas.getGlyph(this.glyphRasterizer,o,b,Ze,c),u=Math.round(e.relativeVerticalOffset[s-e.startLineNumber]*te+Math.floor((e.lineHeight*te-(h.fontBoundingBoxAscent+h.fontBoundingBoxDescent))/2)+h.fontBoundingBoxAscent),g=((s-1)*a.maxSupportedColumns+l)*6,de[g+0]=Math.floor(c),de[g+1]=u,de[g+4]=h.glyphIndex,de[g+5]=h.pageIndex,c+=r}f=v}U=((s-1)*a.maxSupportedColumns+v)*6,G=s*a.maxSupportedColumns*6,de.fill(0,U,G),Se.add(s)}}let Ve=(e.endLineNumber-e.startLineNumber+1)*se;return ke=Math.min(ke,a.maxSupportedLines),Ee=Math.min(Ee,a.maxSupportedLines),ke<=Ee&&this._device.queue.writeBuffer(this._cellBindBuffer,(ke-1)*se*Float32Array.BYTES_PER_ELEMENT,de.buffer,(ke-1)*se*Float32Array.BYTES_PER_ELEMENT,(Ee-ke+1)*se*Float32Array.BYTES_PER_ELEMENT),this._finalRenderedLine=Math.max(this._finalRenderedLine,Ee),this._activeDoubleBufferIndex=this._activeDoubleBufferIndex?0:1,this._visibleObjectCount=Ve,Ve}draw(e,t){if(this._visibleObjectCount<=0)throw new ni("Attempt to draw 0 objects");e.draw(hW.length/2,this._visibleObjectCount,void 0,(t.startLineNumber-1)*a.maxSupportedColumns)}_queueBufferUpdate(e){this._queuedBufferUpdates[0].push(e),this._queuedBufferUpdates[1].push(e)}};function pAo(a){switch(a){case"lighter":case"normal":return 400;case"bolder":case"bold":return 700}return parseInt(a)}function mAo(a){return a.endsWith("%")?parseFloat(a.substring(0,a.length-1))/100:a.match(/^\d+(?:\.\d*)/)?parseFloat(a):1}var GIe=class extends mu{constructor(e,t,o,n){super(e);this._viewGpuContext=t;this._instantiationService=o;this._logService=n;this._maxLineWidth=0;this._atlasGpuTextureVersions=[];this._initialized=!1;this._glyphRasterizer=this._register(new me);this._renderStrategy=this._register(new me);this.canvas=this._viewGpuContext.canvas.domNode,this._register(he(r=>{this._viewGpuContext.canvasDevicePixelDimensions.read(r);let s=this._lastViewportData;s&&setTimeout(()=>{s===this._lastViewportData&&this.renderText(s)})})),this.initWebgpu()}async initWebgpu(){if(this._device=ec.deviceSync||await ec.device,this._store.isDisposed)return;let e=ec.atlas;this._register(e.onDidDeleteGlyphs(()=>{this._atlasGpuTextureVersions.length=0,this._atlasGpuTextureVersions[0]=0,this._atlasGpuTextureVersions[1]=0,this._renderStrategy.value.reset()}));let t=navigator.gpu.getPreferredCanvasFormat();this._viewGpuContext.ctx.configure({device:this._device,format:t,alphaMode:"premultiplied"}),this._renderPassColorAttachment={view:null,loadOp:"load",storeOp:"store"},this._renderPassDescriptor={label:"Monaco render pass",colorAttachments:[this._renderPassColorAttachment]};let o;{let c;(k=>(k[k.FloatsPerEntry=6]="FloatsPerEntry",k[k.BytesPerEntry=24]="BytesPerEntry",k[k.Offset_CanvasWidth____=0]="Offset_CanvasWidth____",k[k.Offset_CanvasHeight___=1]="Offset_CanvasHeight___",k[k.Offset_ViewportOffsetX=2]="Offset_ViewportOffsetX",k[k.Offset_ViewportOffsetY=3]="Offset_ViewportOffsetY",k[k.Offset_ViewportWidth__=4]="Offset_ViewportWidth__",k[k.Offset_ViewportHeight_=5]="Offset_ViewportHeight_"))(c||={});let u=new Float32Array(6),p=(h=this.canvas.width,g=this.canvas.height)=>(u[0]=h,u[1]=g,u[2]=Math.ceil(this._context.configuration.options.get(165).contentLeft*Ki().devicePixelRatio),u[3]=0,u[4]=u[0]-u[2],u[5]=u[1]-u[3],u);o=this._register(BI.createBuffer(this._device,{label:"Monaco uniform buffer",size:24,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST},()=>p())).object,this._register(_s(this._viewGpuContext.canvasDevicePixelDimensions,({width:h,height:g})=>{this._device.queue.writeBuffer(o,0,p(h,g))})),this._register(_s(this._viewGpuContext.contentLeft,()=>{this._device.queue.writeBuffer(o,0,p())}))}let n;{let c;(f=>(f[f.FloatsPerEntry=2]="FloatsPerEntry",f[f.BytesPerEntry=8]="BytesPerEntry",f[f.Offset_Width_=0]="Offset_Width_",f[f.Offset_Height=1]="Offset_Height"))(c||={}),n=this._register(BI.createBuffer(this._device,{label:"Monaco atlas info uniform buffer",size:8,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST},()=>{let u=new Float32Array(2);return u[0]=e.pageSize,u[1]=e.pageSize,u})).object}let r=this._context.configuration.options.get(58),s=this._context.configuration.options.get(61);this._glyphRasterizer.value=this._register(new GU(s,r,this._viewGpuContext.devicePixelRatio.get(),ec.decorationStyleCache)),this._register(_s(this._viewGpuContext.devicePixelRatio,()=>{this._refreshGlyphRasterizer()})),this._renderStrategy.value=this._instantiationService.createInstance(E9,this._context,this._viewGpuContext,this._device,this._glyphRasterizer),this._glyphStorageBuffer=this._register(BI.createBuffer(this._device,{label:"Monaco glyph storage buffer",size:iE.maximumPageCount*(Zw.maximumGlyphCount*24),usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST})).object,this._atlasGpuTextureVersions[0]=0,this._atlasGpuTextureVersions[1]=0,this._atlasGpuTexture=this._register(BI.createTexture(this._device,{label:"Monaco atlas texture",format:"rgba8unorm",size:{width:e.pageSize,height:e.pageSize,depthOrArrayLayers:iE.maximumPageCount},dimension:"2d",usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT})).object,this._updateAtlasStorageBufferAndTexture(),this._vertexBuffer=this._register(BI.createBuffer(this._device,{label:"Monaco vertex buffer",size:hW.byteLength,usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST},hW)).object;let l=this._device.createShaderModule({label:"Monaco shader module",code:this._renderStrategy.value.wgsl});if(this._pipeline=this._device.createRenderPipeline({label:"Monaco render pipeline",layout:"auto",vertex:{module:l,buffers:[{arrayStride:2*Float32Array.BYTES_PER_ELEMENT,attributes:[{shaderLocation:0,offset:0,format:"float32x2"}]}]},fragment:{module:l,targets:[{format:t,blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"}}}]}}),this._rebuildBindGroup=()=>{this._bindGroup=this._device.createBindGroup({label:"Monaco bind group",layout:this._pipeline.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:this._glyphStorageBuffer}},{binding:2,resource:this._device.createSampler({label:"Monaco atlas sampler",magFilter:"nearest",minFilter:"nearest"})},{binding:3,resource:this._atlasGpuTexture.createView()},{binding:4,resource:{buffer:o}},{binding:5,resource:{buffer:n}},...this._renderStrategy.value.bindGroupEntries]})},this._rebuildBindGroup(),this._initialized=!0,this._initViewportData){for(let c of this._initViewportData)this.renderText(c);this._initViewportData=void 0}}_refreshRenderStrategy(e){if(this._renderStrategy.value?.type==="viewport"||e.endLineNumber<E9.maxSupportedLines&&this._viewportMaxColumn(e)<E9.maxSupportedColumns)return;this._logService.trace(`File is larger than ${E9.maxSupportedLines} lines or ${E9.maxSupportedColumns} columns, switching to viewport render strategy`);let t=this._instantiationService.createInstance(vvt,this._context,this._viewGpuContext,this._device,this._glyphRasterizer);this._renderStrategy.value=t,this._register(t.onDidChangeBindGroupEntries(()=>this._rebuildBindGroup?.())),this._rebuildBindGroup?.()}_viewportMaxColumn(e){let t=0,o;for(let n=e.startLineNumber;n<=e.endLineNumber;n++)o=e.getViewLineRenderingData(n),t=Math.max(t,o.maxColumn);return t}_updateAtlasStorageBufferAndTexture(){for(let[e,t]of ec.atlas.pages.entries()){if(e>=iE.maximumPageCount){console.log(`Attempt to upload atlas page [${e}], only ${iE.maximumPageCount} are supported currently`);continue}if(t.version===this._atlasGpuTextureVersions[e])continue;this._logService.trace("Updating atlas page[",e,"] from version ",this._atlasGpuTextureVersions[e]," to version ",t.version);let o=6*Zw.maximumGlyphCount,n=new Float32Array(o),r=0;for(let s of t.glyphs)n[r+0]=s.x,n[r+0+1]=s.y,n[r+2]=s.w,n[r+2+1]=s.h,n[r+4]=s.originOffsetX,n[r+4+1]=s.originOffsetY,r+=6;if(r/6>Zw.maximumGlyphCount)throw new Error(`Attempting to write more glyphs (${r/6}) than the GPUBuffer can hold (${Zw.maximumGlyphCount})`);this._device.queue.writeBuffer(this._glyphStorageBuffer,e*6*Zw.maximumGlyphCount*Float32Array.BYTES_PER_ELEMENT,n,0,6*Zw.maximumGlyphCount),t.usedArea.right-t.usedArea.left>0&&t.usedArea.bottom-t.usedArea.top>0&&this._device.queue.copyExternalImageToTexture({source:t.source},{texture:this._atlasGpuTexture,origin:{x:t.usedArea.left,y:t.usedArea.top,z:e}},{width:t.usedArea.right-t.usedArea.left+1,height:t.usedArea.bottom-t.usedArea.top+1}),this._atlasGpuTextureVersions[e]=t.version}}prepareRender(e){throw new ni("Should not be called")}render(e){throw new ni("Should not be called")}onConfigurationChanged(e){return this._refreshGlyphRasterizer(),this._maxLineWidth=0,!0}onCursorStateChanged(e){return!0}onDecorationsChanged(e){return!0}onFlushed(e){return this._maxLineWidth=0,!0}onLinesChanged(e){return!0}onLinesDeleted(e){return this._maxLineWidth=0,!0}onLinesInserted(e){return!0}onLineMappingChanged(e){return!0}onRevealRangeRequest(e){return!0}onScrollChanged(e){return!0}onThemeChanged(e){return!0}onZonesChanged(e){return!0}_refreshGlyphRasterizer(){let e=this._glyphRasterizer.value;if(!e)return;let t=this._context.configuration.options.get(58),o=this._context.configuration.options.get(61),n=this._viewGpuContext.devicePixelRatio.get();(e.fontFamily!==t||e.fontSize!==o||e.devicePixelRatio!==n)&&(this._glyphRasterizer.value=new GU(o,t,n,ec.decorationStyleCache))}renderText(e){if(this._initialized)return this._refreshRenderStrategy(e),this._renderText(e);this._initViewportData=this._initViewportData??[],this._initViewportData.push(e)}_renderText(e){this._viewGpuContext.rectangleRenderer.draw(e);let t=new iq(this._context.configuration,this._context.theme.type);this._renderStrategy.value.update(e,t),this._updateAtlasStorageBufferAndTexture();let o=this._device.createCommandEncoder({label:"Monaco command encoder"});this._renderPassColorAttachment.view=this._viewGpuContext.ctx.getCurrentTexture().createView({label:"Monaco canvas texture view"});let n=o.beginRenderPass(this._renderPassDescriptor);n.setPipeline(this._pipeline),n.setVertexBuffer(0,this._vertexBuffer);let r=Math.ceil(this._viewGpuContext.contentLeft.get()*this._viewGpuContext.devicePixelRatio.get());n.setScissorRect(r,0,this.canvas.width-r,this.canvas.height),n.setBindGroup(0,this._bindGroup),this._renderStrategy.value.draw(n,e),n.end();let s=o.finish();this._device.queue.submit([s]),this._lastViewportData=e,this._lastViewLineOptions=t,this._updateMaxLineWidth(e,t)}_updateMaxLineWidth(e,t){let o=Ki().devicePixelRatio,n=0;for(let s=e.startLineNumber;s<=e.endLineNumber;s++){if(!this._viewGpuContext.canRender(t,e,s))continue;let l=e.getViewLineRenderingData(s),c=this._computeLineWidth(l,t,o);n=Math.max(n,c)}let r=Math.ceil(n);r>this._maxLineWidth&&(this._maxLineWidth=r,this._context.viewModel.viewLayout.setMaxLineWidth(this._maxLineWidth))}_computeLineWidth(e,t,o){let n=e.content,r;e.isBasicASCII&&t.useMonospaceOptimizations||(r=k9(e,t));let s=0,l=0;for(let c=0;c<n.length;c++){let u;if(e.isBasicASCII&&t.useMonospaceOptimizations)u=n.charAt(c);else{let p=r.getSegmentAtIndex(c);if(p===void 0)continue;u=p}if(u===" "){let p=c+l;l=al.nextRenderTabStop(c+l,e.tabSize),s+=t.spaceWidth*(l-p),l-=c+1}else e.isBasicASCII&&t.useMonospaceOptimizations?s+=t.spaceWidth:s+=this._renderStrategy.value.glyphRasterizer.getTextMetrics(u).width/o}return s}linesVisibleRangesForRange(e,t){if(!this._lastViewportData)return null;let o=e.endLineNumber,n=z.intersectRanges(e,this._lastViewportData.visibleRange);if(!n)return null;let r=this._lastViewportData.startLineNumber,s=this._lastViewportData.endLineNumber,l=this._lastViewportData,c=this._lastViewLineOptions;if(!l||!c)return null;let u=[],p=0;t&&(p=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new Ie(n.startLineNumber,1)).lineNumber);for(let h=n.startLineNumber;h<=n.endLineNumber;h++){if(h<r||h>s)continue;let g=h===n.startLineNumber?n.startColumn:1,f=h!==o,v=f?this._context.viewModel.getLineMaxColumn(h):n.endColumn,b=this._visibleRangesForLineRange(h,g,v);if(b){if(t&&h<o){let S=p;p=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new Ie(h+1,1)).lineNumber,S!==p&&(b.ranges[b.ranges.length-1].width+=c.spaceWidth)}u.push(new dIe(b.outsideRenderedLine,h,m9.from(b.ranges),f))}}return u.length===0?null:u}_visibleRangesForLineRange(e,t,o){if(this.shouldRender())return null;let n=this._lastViewportData,r=this._lastViewLineOptions;if(!n||!r||e<n.startLineNumber||e>n.endLineNumber)return null;let s=n.getViewLineRenderingData(e),l=s.content,c;s.isBasicASCII&&r.useMonospaceOptimizations||(c=k9(s,r));let u="",p=0,h=0;for(let b=0;b<t-1;b++){if(s.isBasicASCII&&r.useMonospaceOptimizations)u=l.charAt(b);else{if(u=c.getSegmentAtIndex(b),u===void 0)continue;h+=this._renderStrategy.value.glyphRasterizer.getTextMetrics(u).width/Ki().devicePixelRatio-r.spaceWidth}u===" "?p=al.nextRenderTabStop(p,s.tabSize):p++}let g=p,f=0;for(let b=t-1;b<o-1;b++){if(s.isBasicASCII&&r.useMonospaceOptimizations)u=l.charAt(b);else{if(u=c.getSegmentAtIndex(b),u===void 0)continue;f+=this._renderStrategy.value.glyphRasterizer.getTextMetrics(u).width/Ki().devicePixelRatio-r.spaceWidth}u===" "?g=al.nextRenderTabStop(g,s.tabSize):g++}return new Vse(!1,[new NM(p*r.spaceWidth+h,(g-p)*r.spaceWidth+f)])}visibleRangeForPosition(e){let t=this._visibleRangesForLineRange(e.lineNumber,e.column,e.column);return t?new uIe(t.outsideRenderedLine,t.ranges[0].left):null}getLineWidth(e){if(!this._lastViewportData||!this._lastViewLineOptions||!this._viewGpuContext.canRender(this._lastViewLineOptions,this._lastViewportData,e))return;let t=this._lastViewportData.getViewLineRenderingData(e),n=this._visibleRangesForLineRange(e,1,t.maxColumn)?.ranges.at(-1);if(n)return n.left+n.width}getPositionAtCoordinate(e,t){if(!this._lastViewportData||!this._lastViewLineOptions||!this._viewGpuContext.canRender(this._lastViewLineOptions,this._lastViewportData,e))return;let o=this._lastViewportData.getViewLineRenderingData(e),n=o.content,r=Ki().devicePixelRatio,s=t*r,l=this._lastViewLineOptions.spaceWidth*r,c=k9(o,this._lastViewLineOptions),u=0,p=0,h=0,g=0;for(let f=0;f<n.length;f++){let v=c.getSegmentAtIndex(f);if(v===void 0){g++;continue}if(v===" "){let b=f+h;h=al.nextRenderTabStop(f+h,o.tabSize),p=l*(h-b),h-=f+1}else o.isBasicASCII&&this._lastViewLineOptions.useMonospaceOptimizations?p=l:p=this._renderStrategy.value.glyphRasterizer.getTextMetrics(v).width;if(s<u+p/2)break;u+=p,g++}return new Ie(e,g+1)}};GIe=I([m(2,F),m(3,ne)],GIe);var rZt=class{constructor(){this._onDidChange=new E;this.onDidChange=this._onDidChange.event;this._enabled=!0}get enabled(){return this._enabled}enable(){this._enabled=!0,this._onDidChange.fire()}disable(){this._enabled=!1,this._onDidChange.fire()}},ZT=new rZt;var _e=ae("keybindingService");var $Ie=class extends mu{constructor(){super(...arguments);this._onWillCopy=this._register(new E);this.onWillCopy=this._onWillCopy.event;this._onWillCut=this._register(new E);this.onWillCut=this._onWillCut.event;this._onWillPaste=this._register(new E);this.onWillPaste=this._onWillPaste.event}};var qIe=class{_getPageOfLine(i,e){return Math.floor((i-1)/e)}_getRangeForPage(i,e){let t=i*e,o=t+1,n=t+e;return new z(o,1,n+1,1)}fromEditorSelection(i,e,t,o){let r=this._getPageOfLine(e.startLineNumber,t),s=this._getRangeForPage(r,t),l=this._getPageOfLine(e.endLineNumber,t),c=this._getRangeForPage(l,t),u=s.intersectRanges(new z(1,1,e.startLineNumber,e.startColumn));if(o&&i.getValueLengthInRange(u,1)>500){let w=i.modifyPosition(u.getEndPosition(),-500);u=z.fromPositions(w,u.getEndPosition())}let p=i.getValueInRange(u,1),h=i.getLineCount(),g=i.getLineMaxColumn(h),f=c.intersectRanges(new z(e.endLineNumber,e.endColumn,h,g));if(o&&i.getValueLengthInRange(f,1)>500){let w=i.modifyPosition(f.getStartPosition(),500);f=z.fromPositions(f.getStartPosition(),w)}let v=i.getValueInRange(f,1),b;if(r===l||r+1===l)b=i.getValueInRange(e,1);else{let w=s.intersectRanges(e),k=c.intersectRanges(e);b=i.getValueInRange(w,1)+"\u2026"+i.getValueInRange(k,1)}o&&b.length>2*500&&(b=b.substring(0,500)+"\u2026"+b.substring(b.length-500,b.length));let S,y;return e.getDirection()===0?(S=p.length,y=p.length+b.length):(y=p.length,S=p.length+b.length),{value:p+b+v,selection:e,selectionStart:S,selectionEnd:y,startPositionWithinEditor:u.getStartPosition(),newlineCountBeforeSelection:u.endLineNumber-u.startLineNumber}}};function cqe(a,i){if(a.get(2)===1){let t=i.lookupKeybinding("editor.action.toggleScreenReaderAccessibilityMode")?.getAriaLabel(),o=i.lookupKeybinding("workbench.action.showCommands")?.getAriaLabel(),n=i.lookupKeybinding("workbench.action.openGlobalKeybindings")?.getAriaLabel(),r=d(176,null);return t?d(177,null,r,t):o?d(178,null,r,o):n?d(179,null,r,n):r}return a.get(8)}function sZt(a){let i=0,e=-1;do{if(e=a.indexOf(`
`,e+1),e===-1)break;i++}while(!0);return i}var aZt=class{constructor(){this._textAreaEditContextMapping=new Map}register(i,e){return this._textAreaEditContextMapping.set(i,e),{dispose:()=>{this._textAreaEditContextMapping.delete(i)}}}get(i){return this._textAreaEditContextMapping.get(i)}},bvt=new aZt;var cZt=class{constructor(i,e,t,o,n){this._context=i;this.modelLineNumber=e;this.distanceToModelLineStart=t;this.widthOfHiddenLineTextBefore=o;this.distanceToModelLineEnd=n;this._visibleTextAreaBrand=void 0;this.startPosition=null;this.endPosition=null;this.visibleTextareaStart=null;this.visibleTextareaEnd=null;this._previousPresentation=null}prepareRender(i){let e=new Ie(this.modelLineNumber,this.distanceToModelLineStart+1),t=new Ie(this.modelLineNumber,this._context.viewModel.model.getLineMaxColumn(this.modelLineNumber)-this.distanceToModelLineEnd);this.startPosition=this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(e),this.endPosition=this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(t),this.startPosition.lineNumber===this.endPosition.lineNumber?(this.visibleTextareaStart=i.visibleRangeForPosition(this.startPosition),this.visibleTextareaEnd=i.visibleRangeForPosition(this.endPosition)):(this.visibleTextareaStart=null,this.visibleTextareaEnd=null)}definePresentation(i){return this._previousPresentation||(i?this._previousPresentation=i:this._previousPresentation={foreground:1,italic:!1,bold:!1,underline:!1,strikethrough:!1}),this._previousPresentation}},lZt=yc,jIe=class extends $Ie{constructor(e,t,o,n,r,s,l){super(t);this._keybindingService=s;this._instantiationService=l;this._primaryCursorPosition=new Ie(1,1);this._primaryCursorVisibleRange=null;this._viewController=n,this._visibleRangeProvider=r,this._scrollLeft=0,this._scrollTop=0;let c=this._context.configuration.options,u=c.get(165);this._setAccessibilityOptions(c),this._contentLeft=u.contentLeft,this._contentWidth=u.contentWidth,this._contentHeight=u.height,this._fontInfo=c.get(59),this._emptySelectionClipboard=c.get(45),this._visibleTextArea=null,this._selections=[new Yt(1,1,1,1)],this._modelSelections=[new Yt(1,1,1,1)],this._lastRenderPosition=null,this.textArea=or(document.createElement("textarea")),PS.write(this.textArea,7),this.textArea.setClassName(`inputarea ${tE}`),this.textArea.setAttribute("wrap",this._textAreaWrapping&&!this._visibleTextArea?"on":"off");let{tabSize:p}=this._context.viewModel.model.getOptions();this.textArea.domNode.style.tabSize=`${p*this._fontInfo.spaceWidth}px`,this.textArea.setAttribute("autocorrect","off"),this.textArea.setAttribute("autocapitalize","off"),this.textArea.setAttribute("autocomplete","off"),this.textArea.setAttribute("spellcheck","false"),this.textArea.setAttribute("aria-label",cqe(c,this._keybindingService)),this.textArea.setAttribute("aria-required",c.get(9)?"true":"false"),this.textArea.setAttribute("tabindex",String(c.get(140))),this.textArea.setAttribute("role","textbox"),this.textArea.setAttribute("aria-roledescription",d(180,null)),this.textArea.setAttribute("aria-multiline","true"),this.textArea.setAttribute("aria-autocomplete",c.get(104)?"none":"both"),this._ensureReadOnlyAttribute(),this.textAreaCover=or(document.createElement("div")),this.textAreaCover.setPosition("absolute"),o.appendChild(this.textArea),o.appendChild(this.textAreaCover);let h=new qIe,g={context:this._context,getScreenReaderContent:()=>{if(this._accessibilitySupport===1){let b=this._selections[0];if(it&&b.isEmpty()){let y=b.getStartPosition(),w=this._getWordBeforePosition(y);if(w.length===0&&(w=this._getCharacterBeforePosition(y)),w.length>0)return new NS(w,w.length,w.length,z.fromPositions(y),0)}if(it&&!b.isEmpty()&&this._context.viewModel.getValueLengthInRange(b,0)<500){let y=this._context.viewModel.getValueInRange(b,0);return new NS(y,0,y.length,b,0)}if(Vb&&!b.isEmpty()){let y="vscode-placeholder";return new NS(y,0,y.length,null,void 0)}return NS.EMPTY}if(Q6t){let b=this._selections[0];if(b.isEmpty()){let S=b.getStartPosition(),[y,w]=this._getAndroidWordAtPosition(S);if(y.length>0)return new NS(y,w,w,z.fromPositions(S),0)}return NS.EMPTY}let v=h.fromEditorSelection(this._context.viewModel,this._selections[0],this._accessibilityPageSize,this._accessibilitySupport===0);return NS.fromScreenReaderContentState(v)},deduceModelPosition:(v,b,S)=>this._context.viewModel.deduceModelPositionRelativeToViewPosition(v,b,S)},f=this._register(new oft(this.textArea.domNode));this._textAreaInput=this._register(this._instantiationService.createInstance(LIe,g,f,zo,{isAndroid:Q6t,isChrome:eU,isFirefox:yc,isSafari:Vb})),this._register(this._textAreaInput.onWillCopy(v=>this._onWillCopy.fire(v))),this._register(this._textAreaInput.onWillCut(v=>this._onWillCut.fire(v))),this._register(this._textAreaInput.onWillPaste(v=>this._onWillPaste.fire(v))),this._register(this._textAreaInput.onKeyDown(v=>{this._viewController.emitKeyDown(v)})),this._register(this._textAreaInput.onKeyUp(v=>{this._viewController.emitKeyUp(v)})),this._register(this._textAreaInput.onPaste(v=>{let b=!1,S=null,y=null;v.metadata&&(b=this._emptySelectionClipboard&&!!v.metadata.isFromEmptySelection,S=typeof v.metadata.multicursorText<"u"?v.metadata.multicursorText:null,y=v.metadata.mode),this._viewController.paste(v.text,b,S,y)})),this._register(this._textAreaInput.onCut(()=>{this._viewController.cut()})),this._register(this._textAreaInput.onType(v=>{v.replacePrevCharCnt||v.replaceNextCharCnt||v.positionDelta?(JT&&console.log(` => compositionType: <<${v.text}>>, ${v.replacePrevCharCnt}, ${v.replaceNextCharCnt}, ${v.positionDelta}`),this._viewController.compositionType(v.text,v.replacePrevCharCnt,v.replaceNextCharCnt,v.positionDelta)):(JT&&console.log(` => type: <<${v.text}>>`),this._viewController.type(v.text))})),this._register(this._textAreaInput.onSelectionChangeRequest(v=>{this._viewController.setSelection(v)})),this._register(this._textAreaInput.onCompositionStart(v=>{let b=this.textArea.domNode,S=this._modelSelections[0],{distanceToModelLineStart:y,widthOfHiddenTextBefore:w}=(()=>{let T=b.value.substring(0,Math.min(b.selectionStart,b.selectionEnd)),N=T.lastIndexOf(`
`),O=T.substring(N+1),V=O.lastIndexOf(" "),U=O.length-V-1,G=S.getStartPosition(),$=Math.min(G.column-1,U),te=G.column-1-$,pe=O.substring(0,O.length-$),{tabSize:de}=this._context.viewModel.model.getOptions(),se=hAo(this.textArea.domNode.ownerDocument,pe,this._fontInfo,de);return{distanceToModelLineStart:te,widthOfHiddenTextBefore:se}})(),{distanceToModelLineEnd:k}=(()=>{let T=b.value.substring(Math.max(b.selectionStart,b.selectionEnd)),N=T.indexOf(`
`),O=N===-1?T:T.substring(0,N),V=O.indexOf(" "),U=V===-1?O.length:O.length-V-1,G=S.getEndPosition(),$=Math.min(this._context.viewModel.model.getLineMaxColumn(G.lineNumber)-G.column,U);return{distanceToModelLineEnd:this._context.viewModel.model.getLineMaxColumn(G.lineNumber)-G.column-$}})();this._context.viewModel.revealRange("keyboard",!0,z.fromPositions(this._selections[0].getStartPosition()),0,1),this._visibleTextArea=new cZt(this._context,S.startLineNumber,y,w,k),this.textArea.setAttribute("wrap",this._textAreaWrapping&&!this._visibleTextArea?"on":"off"),this._visibleTextArea.prepareRender(this._visibleRangeProvider),this._render(),this.textArea.setClassName(`inputarea ${tE} ime-input`),this._viewController.compositionStart(),this._context.viewModel.onCompositionStart()})),this._register(this._textAreaInput.onCompositionUpdate(v=>{this._visibleTextArea&&(this._visibleTextArea.prepareRender(this._visibleRangeProvider),this._render())})),this._register(this._textAreaInput.onCompositionEnd(()=>{this._visibleTextArea=null,this.textArea.setAttribute("wrap",this._textAreaWrapping&&!this._visibleTextArea?"on":"off"),this._render(),this.textArea.setClassName(`inputarea ${tE}`),this._viewController.compositionEnd(),this._context.viewModel.onCompositionEnd()})),this._register(this._textAreaInput.onFocus(()=>{this._context.viewModel.setHasFocus(!0)})),this._register(this._textAreaInput.onBlur(()=>{this._context.viewModel.setHasFocus(!1)})),this._register(ZT.onDidChange(()=>{this._ensureReadOnlyAttribute()})),this._register(bvt.register(e,this))}get domNode(){return this.textArea}writeScreenReaderContent(e){this._textAreaInput.writeNativeTextAreaContent(e)}getTextAreaDomNode(){return this.textArea.domNode}dispose(){super.dispose(),this.textArea.domNode.remove(),this.textAreaCover.domNode.remove()}_getAndroidWordAtPosition(e){let t='`~!@#$%^&*()-=+[{]}\\|;:",.<>/?',o=this._context.viewModel.getLineContent(e.lineNumber),n=jw(t,[]),r=!0,s=e.column,l=!0,c=e.column,u=0;for(;u<50&&(r||l);){if(r&&s<=1&&(r=!1),r){let p=o.charCodeAt(s-2);n.get(p)!==0?r=!1:s--}if(l&&c>o.length&&(l=!1),l){let p=o.charCodeAt(c-1);n.get(p)!==0?l=!1:c++}u++}return[o.substring(s-1,c-1),e.column-s]}_getWordBeforePosition(e){let t=this._context.viewModel.getLineContent(e.lineNumber),o=jw(this._context.configuration.options.get(148),[]),n=e.column,r=0;for(;n>1;){let s=t.charCodeAt(n-2);if(o.get(s)!==0||r>50)return t.substring(n-1,e.column-1);r++,n--}return t.substring(0,e.column-1)}_getCharacterBeforePosition(e){if(e.column>1){let o=this._context.viewModel.getLineContent(e.lineNumber).charAt(e.column-2);if(!Ru(o.charCodeAt(0)))return o}return""}_setAccessibilityOptions(e){this._accessibilitySupport=e.get(2);let t=e.get(3);this._accessibilitySupport===2&&t===zb.accessibilityPageSize.defaultValue?this._accessibilityPageSize=500:this._accessibilityPageSize=t;let n=e.get(165).wrappingColumn;if(n!==-1&&this._accessibilitySupport!==1){let r=e.get(59);this._textAreaWrapping=!0,this._textAreaWidth=Math.round(n*r.typicalHalfwidthCharacterWidth)}else this._textAreaWrapping=!1,this._textAreaWidth=lZt?0:1}onConfigurationChanged(e){let t=this._context.configuration.options,o=t.get(165);this._setAccessibilityOptions(t),this._contentLeft=o.contentLeft,this._contentWidth=o.contentWidth,this._contentHeight=o.height,this._fontInfo=t.get(59),this._emptySelectionClipboard=t.get(45),this.textArea.setAttribute("wrap",this._textAreaWrapping&&!this._visibleTextArea?"on":"off");let{tabSize:n}=this._context.viewModel.model.getOptions();return this.textArea.domNode.style.tabSize=`${n*this._fontInfo.spaceWidth}px`,this.textArea.setAttribute("aria-label",cqe(t,this._keybindingService)),this.textArea.setAttribute("aria-required",t.get(9)?"true":"false"),this.textArea.setAttribute("tabindex",String(t.get(140))),(e.hasChanged(41)||e.hasChanged(104))&&this._ensureReadOnlyAttribute(),e.hasChanged(2)&&this._textAreaInput.writeNativeTextAreaContent("strategy changed"),!0}onCursorStateChanged(e){return this._selections=e.selections.slice(0),this._modelSelections=e.modelSelections.slice(0),this._textAreaInput.writeNativeTextAreaContent("selection changed"),!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return this._scrollLeft=e.scrollLeft,this._scrollTop=e.scrollTop,!0}onZonesChanged(e){return!0}isFocused(){return this._textAreaInput.isFocused()}focus(){this._textAreaInput.focusTextArea()}refreshFocusState(){this._textAreaInput.refreshFocusState()}getLastRenderData(){return this._lastRenderPosition}setAriaOptions(e){e.activeDescendant?(this.textArea.setAttribute("aria-haspopup","true"),this.textArea.setAttribute("aria-autocomplete","list"),this.textArea.setAttribute("aria-activedescendant",e.activeDescendant)):(this.textArea.setAttribute("aria-haspopup","false"),this.textArea.setAttribute("aria-autocomplete","both"),this.textArea.removeAttribute("aria-activedescendant")),e.role&&this.textArea.setAttribute("role",e.role)}_ensureReadOnlyAttribute(){let e=this._context.configuration.options;!ZT.enabled||e.get(41)&&e.get(104)?this.textArea.setAttribute("readonly","true"):this.textArea.removeAttribute("readonly")}prepareRender(e){this._primaryCursorPosition=new Ie(this._selections[0].positionLineNumber,this._selections[0].positionColumn),this._primaryCursorVisibleRange=e.visibleRangeForPosition(this._primaryCursorPosition),this._visibleTextArea?.prepareRender(e)}render(e){this._textAreaInput.writeNativeTextAreaContent("render"),this._render()}_render(){if(this._visibleTextArea){let o=this._visibleTextArea.visibleTextareaStart,n=this._visibleTextArea.visibleTextareaEnd,r=this._visibleTextArea.startPosition,s=this._visibleTextArea.endPosition;if(r&&s&&o&&n&&n.left>=this._scrollLeft&&o.left<=this._scrollLeft+this._contentWidth){let l=this._context.viewLayout.getVerticalOffsetForLineNumber(this._primaryCursorPosition.lineNumber)-this._scrollTop,c=sZt(this.textArea.domNode.value.substr(0,this.textArea.domNode.selectionStart)),u=this._visibleTextArea.widthOfHiddenLineTextBefore,p=this._contentLeft+o.left-this._scrollLeft,h=n.left-o.left+1;if(p<this._contentLeft){let k=this._contentLeft-p;p+=k,u+=k,h-=k}h>this._contentWidth&&(h=this._contentWidth);let g=this._context.viewLayout.getLineHeightForLineNumber(r.lineNumber),f=this._context.viewModel.getFontSizeAtPosition(this._primaryCursorPosition),v=this._context.viewModel.getViewLineData(r.lineNumber),b=v.tokens.findTokenIndexAtOffset(r.column-1),S=v.tokens.findTokenIndexAtOffset(s.column-1),y=b===S,w=this._visibleTextArea.definePresentation(y?v.tokens.getPresentation(b):null);this.textArea.domNode.scrollTop=c*g,this.textArea.domNode.scrollLeft=u,this._doRender({lastRenderPosition:null,top:l,left:p,width:h,height:g,useCover:!1,color:(kc.getColorMap()||[])[w.foreground],italic:w.italic,bold:w.bold,underline:w.underline,strikethrough:w.strikethrough,fontSize:f})}return}if(!this._primaryCursorVisibleRange){this._renderAtTopLeft();return}let e=this._contentLeft+this._primaryCursorVisibleRange.left-this._scrollLeft;if(e<this._contentLeft||e>this._contentLeft+this._contentWidth){this._renderAtTopLeft();return}let t=this._context.viewLayout.getVerticalOffsetForLineNumber(this._selections[0].positionLineNumber)-this._scrollTop;if(t<0||t>this._contentHeight){this._renderAtTopLeft();return}if(it||this._accessibilitySupport===2){let o=this._primaryCursorPosition.lineNumber,n=this._context.viewLayout.getLineHeightForLineNumber(o);this._doRender({lastRenderPosition:this._primaryCursorPosition,top:t,left:this._textAreaWrapping?this._contentLeft:e,width:this._textAreaWidth,height:n,useCover:!1}),this.textArea.domNode.scrollLeft=this._primaryCursorVisibleRange.left;let r=this._textAreaInput.textAreaState.newlineCountBeforeSelection??sZt(this.textArea.domNode.value.substring(0,this.textArea.domNode.selectionStart));this.textArea.domNode.scrollTop=r*n;return}this._doRender({lastRenderPosition:this._primaryCursorPosition,top:t,left:this._textAreaWrapping?this._contentLeft:e,width:this._textAreaWidth,height:lZt?0:1,useCover:!1})}_renderAtTopLeft(){this._doRender({lastRenderPosition:null,top:0,left:0,width:this._textAreaWidth,height:lZt?0:1,useCover:!0})}_doRender(e){this._lastRenderPosition=e.lastRenderPosition;let t=this.textArea,o=this.textAreaCover;Pd(t,this._fontInfo),t.setTop(e.top),t.setLeft(e.left),t.setWidth(e.width),t.setHeight(e.height),t.setLineHeight(e.height),t.setFontSize(e.fontSize??this._fontInfo.fontSize),t.setColor(e.color?Oe.Format.CSS.formatHex(e.color):""),t.setFontStyle(e.italic?"italic":""),e.bold&&t.setFontWeight("bold"),t.setTextDecoration(`${e.underline?" underline":""}${e.strikethrough?" line-through":""}`),o.setTop(e.useCover?e.top:0),o.setLeft(e.useCover?e.left:0),o.setWidth(e.useCover?e.width:0),o.setHeight(e.useCover?e.height:0);let n=this._context.configuration.options;n.get(66)?o.setClassName("monaco-editor-background textAreaCover "+HIe.OUTER_CLASS_NAME):n.get(76).renderType!==0?o.setClassName("monaco-editor-background textAreaCover "+VIe.CLASS_NAME):o.setClassName("monaco-editor-background textAreaCover")}};jIe=I([m(5,_e),m(6,F)],jIe);function hAo(a,i,e,t){if(i.length===0)return 0;let o=a.createElement("div");o.style.position="absolute",o.style.top="-50000px",o.style.width="50000px";let n=a.createElement("span");Pd(n,e),n.style.whiteSpace="pre",n.style.tabSize=`${t*e.spaceWidth}px`,n.append(i),o.appendChild(n),a.body.appendChild(o);let r=n.offsetWidth;return o.remove(),r}var QIe=class extends C{constructor(e,t,o){super();this._domNode=t;this._onFocusChange=o;this._isFocused=!1;this._isPaused=!1;this._register(j(this._domNode,"focus",()=>{e.trace("NativeEditContext.focus"),!this._isPaused&&this.refreshFocusState()})),this._register(j(this._domNode,"blur",()=>{e.trace("NativeEditContext.blur"),!this._isPaused&&this._handleFocusedChanged(!1)}))}pause(){this._isPaused=!0}resume(){this._isPaused=!1,this.refreshFocusState()}_handleFocusedChanged(e){this._isFocused!==e&&(this._isFocused=e,this._onFocusChange(this._isFocused))}focus(){this._domNode.focus(),this.refreshFocusState()}refreshFocusState(){let e=_M(this._domNode),t=e?e.activeElement:Pn(),o=this._domNode===t;this._handleFocusedChanged(o)}get isFocused(){return this._isFocused}};QIe=I([m(0,ne)],QIe);function YIe(a,i,e,t){return a.addEventListener(i,e,t),{dispose(){a.removeEventListener(i,e)}}}var gAo=Kg("richScreenReaderContent",{createHTML:a=>a}),dZt="data-line-number",XIe=class extends C{constructor(e,t,o,n){super();this._domNode=e;this._context=t;this._viewController=o;this._accessibilityService=n;this._selectionChangeListener=this._register(new me);this._accessibilityPageSize=1;this._ignoreSelectionChangeTime=0;this._state=dqe.NULL;this._strategy=new mZt;this._renderedLines=new Map;this._renderedSelection=new Yt(1,1,1,1);this.onConfigurationChanged(this._context.configuration.options)}updateScreenReaderContent(e){let t=Ki().document.activeElement;if(!t||t!==this._domNode.domNode)return;if(this._accessibilityService.isScreenReaderOptimized()){let n=this._getScreenReaderContentLineIntervals(e);this._state.equals(n)||(this._state=n,this._renderedLines=this._renderScreenReaderContent(n)),this._renderedSelection.equalsSelection(e)||(this._renderedSelection=e,this._setSelectionOnScreenReaderContent(this._context,this._renderedLines,e))}else this._state=dqe.NULL,this._setIgnoreSelectionChangeTime("setValue"),this._domNode.domNode.textContent=""}updateScrollTop(e){let t=this._state.intervals;if(!t.length)return;let o=this._context.viewModel.viewLayout,n=t[0].startLine,r=o.getVerticalOffsetForLineNumber(n),s=o.getVerticalOffsetForLineNumber(e.positionLineNumber);this._domNode.domNode.scrollTop=s-r}onFocusChange(e){e?this._selectionChangeListener.value=this._setSelectionChangeListener():this._selectionChangeListener.value=void 0}onConfigurationChanged(e){this._accessibilityPageSize=e.get(3)}onWillCut(){this._setIgnoreSelectionChangeTime("onCut")}onWillPaste(){this._setIgnoreSelectionChangeTime("onWillPaste")}_setIgnoreSelectionChangeTime(e){this._ignoreSelectionChangeTime=Date.now()}_setSelectionChangeListener(){let e=0;return j(this._domNode.domNode.ownerDocument,"selectionchange",()=>{if(!(Ki().document.activeElement===this._domNode.domNode)||!this._accessibilityService.isScreenReaderOptimized()||!ZT.enabled)return;let r=Date.now(),s=r-e;if(e=r,s<5)return;let l=r-this._ignoreSelectionChangeTime;if(this._ignoreSelectionChangeTime=0,l<100)return;let c=this._getEditorSelectionFromDomRange();c&&this._viewController.setSelection(c)})}_renderScreenReaderContent(e){let t=[],o=new Map;for(let n of e.intervals)for(let r=n.startLine;r<=n.endLine;r++){let s=this._renderLine(r);o.set(r,s),t.push(s.domNode)}return this._setIgnoreSelectionChangeTime("setValue"),this._domNode.domNode.replaceChildren(...t),o}_renderLine(e){let t=this._context.viewModel,o=t.getViewLineRenderingData(e),n=this._context.configuration.options,r=n.get(59),s=n.get(133),l=n.get(108),c=n.get(60),u=n.get(40),p=Jv.filter(o.inlineDecorations,e,o.minColumn,o.maxColumn),h=r.isMonospace&&!u,g=c!==mx.OFF,f;n.get(47)==="off"?f=n.get(113):f="none";let b=new hL(h,r.canUseHalfwidthRightwardsArrow,o.content,o.continuesWithWrappedLine,o.isBasicASCII,o.containsRTL,o.minColumn-1,o.tokens,p,o.tabSize,o.startVisibleColumn,r.spaceWidth,r.middotWidth,r.wsmiddotWidth,s,f,l,g,null,null,0,!0),S=new ES(1e4),y=uW(b,S),w=S.build(),k=gAo?.createHTML(w)??w,T=t.viewLayout.getLineHeightForLineNumber(e)+"px",N=document.createElement("div");return N.innerHTML=k,N.style.lineHeight=T,N.style.height=T,N.setAttribute(dZt,e.toString()),new uZt(N,y.characterMapping)}_setSelectionOnScreenReaderContent(e,t,o){let r=Ki().document.getSelection();if(!r)return;let s=o.startLineNumber,l=o.endLineNumber,c=t.get(s),u=t.get(l);if(!c||!u)return;let p=e.viewModel,h=p.model,g=p.coordinatesConverter,f=new z(s,1,s,o.selectionStartColumn),v=g.convertViewRangeToModelRange(f),b=h.getCharacterCountInRange(v),S=new z(l,1,l,o.positionColumn),y=g.convertViewRangeToModelRange(S),w=h.getCharacterCountInRange(y),k=c.characterMapping.getDomPosition(b),T=u.characterMapping.getDomPosition(w),N=c.domNode.firstChild,O=u.domNode.firstChild,V=N.childNodes,U=O.childNodes,G=V.item(k.partIndex),$=U.item(T.partIndex);!G.firstChild||!$.firstChild||(this._setIgnoreSelectionChangeTime("setRange"),r.setBaseAndExtent(G.firstChild,o.startColumn===1?0:k.charIndex+1,$.firstChild,o.endColumn===1?0:T.charIndex+1))}_getScreenReaderContentLineIntervals(e){return this._strategy.fromEditorSelection(this._context.viewModel,e,this._accessibilityPageSize)}_getEditorSelectionFromDomRange(){if(!this._renderedLines)return;let e=Ki().document.getSelection();if(!e||e.rangeCount===0)return;let o=e.getRangeAt(0),n=o.startContainer,r=o.endContainer,s=n.parentElement,l=r.parentElement;if(!s||!Ao(s)||!l||!Ao(l))return;let c=s.parentElement?.parentElement,u=l.parentElement?.parentElement;if(!c||!u)return;let p=c.getAttribute(dZt),h=u.getAttribute(dZt);if(!p||!h)return;let g=parseInt(p),f=parseInt(h),v=this._renderedLines.get(g)?.characterMapping,b=this._renderedLines.get(f)?.characterMapping;if(!v||!b)return;let S=K$(v,s,o.startOffset),y=K$(b,l,o.endOffset);return e.direction==="forward"?new Yt(g,S,f,y):new Yt(f,y,g,S)}};XIe=I([m(3,Bi)],XIe);var uZt=class{constructor(i,e){this.domNode=i;this.characterMapping=e}},pZt=class{constructor(i,e){this.startLine=i;this.endLine=e}},dqe=class a{constructor(i,e){this.intervals=e;let t="";for(let o of e)for(let n=o.startLine;n<=o.endLine;n++)t+=i.getLineContent(n)+`
`;this.value=t}equals(i){return this.value===i.value}static get NULL(){let i={getLineContent:()=>"",getLineCount:()=>1,getLineMaxColumn:()=>1,getValueInRange:()=>"",getValueLengthInRange:()=>0,modifyPosition:(e,t)=>e};return new a(i,[])}},mZt=class{constructor(){}_getPageOfLine(i,e){return Math.floor((i-1)/e)}_getRangeForPage(i,e,t){let o=e*t,n=o+1,r=Math.min(o+t,i.getLineCount());return new pZt(n,r)}fromEditorSelection(i,e,t){let o=this._getPageOfLine(e.startLineNumber,t),n=this._getRangeForPage(i,o,t),r=this._getPageOfLine(e.endLineNumber,t),s=this._getRangeForPage(i,r,t),l=[{startLine:n.startLine,endLine:n.endLine}];return o+1<r&&l.push({startLine:s.startLine,endLine:s.endLine}),new dqe(i,l)}};var JIe=class extends C{constructor(e,t,o,n){super();this._domNode=e;this._context=t;this._viewController=o;this._accessibilityService=n;this._selectionChangeListener=this._register(new me);this._accessibilityPageSize=1;this._ignoreSelectionChangeTime=0;this._strategy=new qIe;this.onConfigurationChanged(this._context.configuration.options)}updateScreenReaderContent(e){let t=this._domNode.domNode,o=Ki().document.activeElement;if(!o||o!==t)return;if(this._accessibilityService.isScreenReaderOptimized()){this._state=this._getScreenReaderContentState(e),t.textContent!==this._state.value&&(this._setIgnoreSelectionChangeTime("setValue"),t.textContent=this._state.value);let r=Ki().document.getSelection();if(!r)return;let s=this._getScreenReaderRange(this._state.selectionStart,this._state.selectionEnd);if(!s)return;this._setIgnoreSelectionChangeTime("setRange"),r.setBaseAndExtent(s.anchorNode,s.anchorOffset,s.focusNode,s.focusOffset)}else this._state=void 0,this._setIgnoreSelectionChangeTime("setValue"),this._domNode.domNode.textContent=""}updateScrollTop(e){if(!this._state)return;let t=this._context.viewModel.viewLayout,o=this._state.startPositionWithinEditor.lineNumber,n=t.getVerticalOffsetForLineNumber(o),r=t.getVerticalOffsetForLineNumber(e.positionLineNumber);this._domNode.domNode.scrollTop=r-n}onFocusChange(e){e?this._selectionChangeListener.value=this._setSelectionChangeListener():this._selectionChangeListener.value=void 0}onConfigurationChanged(e){this._accessibilityPageSize=e.get(3)}onWillCut(){this._setIgnoreSelectionChangeTime("onCut")}onWillPaste(){this._setIgnoreSelectionChangeTime("onWillPaste")}_setIgnoreSelectionChangeTime(e){this._ignoreSelectionChangeTime=Date.now()}_setSelectionChangeListener(){let e=0;return j(this._domNode.domNode.ownerDocument,"selectionchange",()=>{let t=this._accessibilityService.isScreenReaderOptimized();if(!this._state||!t||!ZT.enabled||!(Ki().document.activeElement===this._domNode.domNode))return;let r=Ki().document.getSelection();if(!r||r.rangeCount===0)return;let l=r.getRangeAt(0),c=Date.now(),u=c-e;if(e=c,u<5)return;let p=c-this._ignoreSelectionChangeTime;this._ignoreSelectionChangeTime=0,!(p<100)&&this._viewController.setSelection(this._getEditorSelectionFromDomRange(this._context,this._state,r.direction,l))})}_getScreenReaderContentState(e){let t=this._strategy.fromEditorSelection(this._context.viewModel,e,this._accessibilityPageSize,this._accessibilityService.getAccessibilitySupport()===0),o=this._context.viewModel.model.getPositionAt(1/0),n=t.value;return o.column===1&&e.getEndPosition().equals(o)&&(n+=`
`),t.value=n,t}_getScreenReaderRange(e,t){let o=this._domNode.domNode.firstChild;if(!o)return;let n=new globalThis.Range;return n.setStart(o,e),n.setEnd(o,t),{anchorNode:o,anchorOffset:e,focusNode:o,focusOffset:t}}_getEditorSelectionFromDomRange(e,t,o,n){let r=e.viewModel,s=r.model,c=r.coordinatesConverter.convertViewPositionToModelPosition(t.startPositionWithinEditor),u=s.getOffsetAt(c),p=n.startOffset+u,h=n.endOffset+u;if(s.getEndOfLineSequence()===1){let y=t.value,w=new AM(y),k=w.getPosition(n.startOffset),T=w.getPosition(n.endOffset);p+=k.lineNumber-1,h+=T.lineNumber-1}let f=s.getPositionAt(p),v=s.getPositionAt(h),b=o==="forward"?f:v,S=o==="forward"?v:f;return Yt.fromPositions(b,S)}};JIe=I([m(3,Bi)],JIe);var eye=class extends C{constructor(e,t,o,n,r){super();this._domNode=e;this._context=t;this._viewController=o;this._keybindingService=n;this._accessibilityService=r;this._contentLeft=1;this._contentWidth=1;this._contentHeight=1;this._divWidth=1;this._primarySelection=new Yt(1,1,1,1);this._primaryCursorVisibleRange=null;this._state=this._register(new me),this._instantiateScreenReaderContent(),this._updateConfigurationSettings(),this._updateDomAttributes()}onWillPaste(){this._state.value?.onWillPaste()}onWillCut(){this._state.value?.onWillCut()}handleFocusChange(e){this._state.value?.onFocusChange(e),this.writeScreenReaderContent()}onConfigurationChanged(e){this._instantiateScreenReaderContent(),this._updateConfigurationSettings(),this._updateDomAttributes(),e.hasChanged(2)&&this.writeScreenReaderContent()}_instantiateScreenReaderContent(){let e=this._context.configuration.options.get(107);this._renderRichContent!==e&&(this._renderRichContent=e,this._state.value=this._createScreenReaderContent(e))}_createScreenReaderContent(e){return e?new XIe(this._domNode,this._context,this._viewController,this._accessibilityService):new JIe(this._domNode,this._context,this._viewController,this._accessibilityService)}_updateConfigurationSettings(){let e=this._context.configuration.options,t=e.get(165),o=t.wrappingColumn;this._contentLeft=t.contentLeft,this._contentWidth=t.contentWidth,this._contentHeight=t.height,this._fontInfo=e.get(59),this._divWidth=Math.round(o*this._fontInfo.typicalHalfwidthCharacterWidth),this._state.value?.onConfigurationChanged(e)}_updateDomAttributes(){let e=this._context.configuration.options;this._domNode.domNode.setAttribute("role","textbox"),this._domNode.domNode.setAttribute("aria-required",e.get(9)?"true":"false"),this._domNode.domNode.setAttribute("aria-multiline","true"),this._domNode.domNode.setAttribute("aria-autocomplete",e.get(104)?"none":"both"),this._domNode.domNode.setAttribute("aria-roledescription",d(175,null)),this._domNode.domNode.setAttribute("aria-label",cqe(e,this._keybindingService));let t=this._context.viewModel.model.getOptions().tabSize,o=e.get(59).spaceWidth;this._domNode.domNode.style.tabSize=`${t*o}px`;let n=e.get(154),r=n==="inherit"?e.get(153):n,s=r==="inherit"?e.get(149):r;this._domNode.domNode.style.textWrap=s==="off"?"nowrap":"wrap"}onCursorStateChanged(e){this._primarySelection=e.selections[0]??new Yt(1,1,1,1)}prepareRender(e){this.writeScreenReaderContent(),this._primaryCursorVisibleRange=e.visibleRangeForPosition(this._primarySelection.getPosition())}render(e){if(!this._primaryCursorVisibleRange){this._renderAtTopLeft();return}let t=this._context.viewLayout.getCurrentScrollLeft(),o=this._contentLeft+this._primaryCursorVisibleRange.left-t;if(o<this._contentLeft||o>this._contentLeft+this._contentWidth){this._renderAtTopLeft();return}let n=this._context.viewLayout.getCurrentScrollTop(),r=this._primarySelection.positionLineNumber,s=this._context.viewLayout.getVerticalOffsetForLineNumber(r)-n;if(s<0||s>this._contentHeight){this._renderAtTopLeft();return}let l=this._context.viewLayout.getLineHeightForLineNumber(r);this._doRender(s,this._contentLeft,this._divWidth,l),this._state.value?.updateScrollTop(this._primarySelection)}_renderAtTopLeft(){this._doRender(0,0,this._contentWidth,1)}_doRender(e,t,o,n){Pd(this._domNode,this._fontInfo),this._domNode.setTop(e),this._domNode.setLeft(t),this._domNode.setWidth(o),this._domNode.setHeight(n),this._domNode.setLineHeight(n)}setAriaOptions(e){e.activeDescendant?(this._domNode.setAttribute("aria-haspopup","true"),this._domNode.setAttribute("aria-autocomplete","list"),this._domNode.setAttribute("aria-activedescendant",e.activeDescendant)):(this._domNode.setAttribute("aria-haspopup","false"),this._domNode.setAttribute("aria-autocomplete","both"),this._domNode.removeAttribute("aria-activedescendant")),e.role&&this._domNode.setAttribute("role",e.role)}writeScreenReaderContent(){this._state.value?.updateScreenReaderContent(this._primarySelection)}};eye=I([m(3,_e),m(4,Bi)],eye);var hZt;(i=>{function a(e,t){return new e.EditContext(t)}i.create=a})(hZt||={});var gZt=class{constructor(){this._nativeEditContextMapping=new Map}register(i,e){return this._nativeEditContextMapping.set(i,e),{dispose:()=>{this._nativeEditContextMapping.delete(i)}}}get(i){return this._nativeEditContextMapping.get(i)}},iae=new gZt;var oae=class extends $Ie{constructor(e,t,o,n,r,s,l){super(t);this._viewController=n;this._visibleRangeProvider=r;this.logService=l;this._previousEditContextSelection=new di(0,0);this._previousEditContextText="";this._editContextPrimarySelection=new Yt(1,1,1,1);this._parentBounds=null;this._decorations=[];this._primarySelection=new Yt(1,1,1,1);this._targetWindowId=-1;this._scrollTop=0;this._scrollLeft=0;this._linesVisibleRanges=null;this.domNode=new Bg(document.createElement("div")),this.domNode.setClassName("native-edit-context"),this._imeTextArea=new Bg(document.createElement("textarea")),this._imeTextArea.setClassName("ime-text-area"),this._imeTextArea.setAttribute("readonly","true"),this._imeTextArea.setAttribute("tabindex","-1"),this._imeTextArea.setAttribute("aria-hidden","true"),this.domNode.setAttribute("autocorrect","off"),this.domNode.setAttribute("autocapitalize","off"),this.domNode.setAttribute("autocomplete","off"),this.domNode.setAttribute("spellcheck","false"),this._updateDomAttributes(),o.appendChild(this.domNode),o.appendChild(this._imeTextArea),this._parent=o.domNode,this._focusTracker=this._register(new QIe(l,this.domNode.domNode,h=>{l.trace("NativeEditContext#handleFocusChange : ",h),this._screenReaderSupport.handleFocusChange(h),this._context.viewModel.setHasFocus(h)}));let c=Me(this.domNode.domNode);this._editContext=hZt.create(c),this.setEditContextOnDomNode(),this._screenReaderSupport=this._register(s.createInstance(eye,this.domNode,t,this._viewController)),this._register(j(this.domNode.domNode,"copy",h=>{this.logService.trace("NativeEditContext#copy"),zU.electronBugWorkaroundCopyEventHasFired=!0;let g=DIe(h,!1,this._context,this.logService,yc);this._onWillCopy.fire(g),!g.isHandled&&g.ensureClipboardGetsEditorData()})),this._register(j(this.domNode.domNode,"cut",h=>{this.logService.trace("NativeEditContext#cut");let g=DIe(h,!0,this._context,this.logService,yc);this._onWillCut.fire(g),!g.isHandled&&(this._screenReaderSupport.onWillCut(),g.ensureClipboardGetsEditorData(),this.logService.trace("NativeEditContext#cut (before viewController.cut)"),this._viewController.cut())})),this._register(j(this.domNode.domNode,"selectionchange",()=>{vx.onSelectionChange()})),this._register(j(this.domNode.domNode,"keyup",h=>this._onKeyUp(h))),this._register(j(this.domNode.domNode,"keydown",async h=>this._onKeyDown(h))),this._register(j(this._imeTextArea.domNode,"keyup",h=>this._onKeyUp(h))),this._register(j(this._imeTextArea.domNode,"keydown",async h=>this._onKeyDown(h))),this._register(j(this.domNode.domNode,"beforeinput",async h=>{vx.onBeforeInput(),(h.inputType==="insertParagraph"||h.inputType==="insertLineBreak")&&this._onType(this._viewController,{text:`
`,replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:0})})),this._register(j(this.domNode.domNode,"paste",h=>{this.logService.trace("NativeEditContext#paste");let g=ift(h);if(this._onWillPaste.fire(g),g.isHandled){h.preventDefault();return}if(h.preventDefault(),!h.clipboardData||(this.logService.trace("NativeEditContext#paste with id : ",g.metadata?.id," with text.length: ",g.text.length),!g.text))return;let f=!1,v=null,b=null;g.metadata&&(f=this._context.configuration.options.get(45)&&!!g.metadata.isFromEmptySelection,v=typeof g.metadata.multicursorText<"u"?g.metadata.multicursorText:null,b=g.metadata.mode),this.logService.trace("NativeEditContext#paste (before viewController.paste)"),this._viewController.paste(g.text,f,v,b)})),this._register(YIe(this._editContext,"textformatupdate",h=>this._handleTextFormatUpdate(h))),this._register(YIe(this._editContext,"characterboundsupdate",h=>this._updateCharacterBounds(h)));let u;this._register(YIe(this._editContext,"textupdate",h=>{vx.onInput();let g=h.text;if(g.length===1){let f=g.charCodeAt(0);if(Ru(f)){u=g;return}if(nN(f)&&u){let v={text:u+g,selectionEnd:h.selectionEnd,selectionStart:h.selectionStart,updateRangeStart:h.updateRangeStart-1,updateRangeEnd:h.updateRangeEnd-1};u=void 0,this._emitTypeEvent(this._viewController,v);return}}this._emitTypeEvent(this._viewController,h)})),this._register(YIe(this._editContext,"compositionstart",h=>{this._updateEditContext(),this._viewController.compositionStart(),this._context.viewModel.onCompositionStart()})),this._register(YIe(this._editContext,"compositionend",h=>{this._updateEditContext(),this._viewController.compositionEnd(),this._context.viewModel.onCompositionEnd()}));let p=!1;this._register(ZT.onDidChange(()=>{ZT.enabled&&p&&(this._focusTracker.resume(),this.domNode.focus(),p=!1),!ZT.enabled&&this.isFocused()&&(this._focusTracker.pause(),this._imeTextArea.focus(),p=!0)})),this._register(iae.register(e,this)),this._register(t.viewModel.model.onDidChangeContent(h=>{let g=!1;for(let f of h.changes)if(f.range.startLineNumber<=this._editContextPrimarySelection.endLineNumber&&f.range.endLineNumber>=this._editContextPrimarySelection.startLineNumber){g=!0;break}g&&this._updateEditContext()}))}dispose(){this.domNode.domNode.editContext=void 0,this.domNode.domNode.blur(),this.domNode.domNode.remove(),this._imeTextArea.domNode.remove(),super.dispose()}setAriaOptions(e){this._screenReaderSupport.setAriaOptions(e)}getLastRenderData(){return this._primarySelection.getPosition()}onBeforeRender(e){this._parentBounds=this._parent.getBoundingClientRect()}prepareRender(e){this._screenReaderSupport.prepareRender(e),this._updateSelectionAndControlBoundsData(e)}render(e){this._screenReaderSupport.render(e),this._updateSelectionAndControlBounds()}onCursorStateChanged(e){return this._primarySelection=e.modelSelections[0]??new Yt(1,1,1,1),this._screenReaderSupport.onCursorStateChanged(e),this._updateEditContext(),!0}onConfigurationChanged(e){return this._screenReaderSupport.onConfigurationChanged(e),this._updateDomAttributes(),!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return this._scrollLeft=e.scrollLeft,this._scrollTop=e.scrollTop,!0}onZonesChanged(e){return!0}handleWillPaste(){this.logService.trace("NativeEditContext#handleWillPaste"),this._prepareScreenReaderForPaste()}_prepareScreenReaderForPaste(){this._screenReaderSupport.onWillPaste()}handleWillCopy(){this.logService.trace("NativeEditContext#handleWillCopy"),this.logService.trace("NativeEditContext#isFocused : ",this.domNode.domNode===Pn())}writeScreenReaderContent(){this._screenReaderSupport.writeScreenReaderContent()}isFocused(){return this._focusTracker.isFocused}focus(){this._focusTracker.focus(),this.refreshFocusState()}refreshFocusState(){this._focusTracker.refreshFocusState()}setEditContextOnDomNode(){let e=Me(this.domNode.domNode),t=sg(e);this._targetWindowId!==t&&(this.domNode.domNode.editContext=this._editContext,this._targetWindowId=t)}_onKeyUp(e){vx.onKeyUp(),this._viewController.emitKeyUp(new Ii(e))}_onKeyDown(e){vx.onKeyDown();let t=new Ii(e);t.keyCode===114&&t.stopPropagation(),this._viewController.emitKeyDown(t)}_updateDomAttributes(){let e=this._context.configuration.options;this.domNode.domNode.setAttribute("tabindex",String(e.get(140)))}_updateEditContext(){let e=this._getNewEditContextState();if(!e)return;let t=e.text??" ";t!==this._previousEditContextText&&(this._editContext.updateText(0,this._previousEditContextText.length,t),this._previousEditContextText=t),(e.selectionStartOffset!==this._previousEditContextSelection.start||e.selectionEndOffset!==this._previousEditContextSelection.endExclusive)&&this._editContext.updateSelection(e.selectionStartOffset,e.selectionEndOffset),this._editContextPrimarySelection=e.editContextPrimarySelection,this._previousEditContextSelection=new di(e.selectionStartOffset,e.selectionEndOffset)}_emitTypeEvent(e,t){if(!this._editContext)return;let o=this._previousEditContextSelection.endExclusive,n=this._previousEditContextSelection.start;this._previousEditContextSelection=new di(t.selectionStart,t.selectionEnd);let r=0,s=0;t.updateRangeEnd>o&&(r=t.updateRangeEnd-o),t.updateRangeStart<n&&(s=n-t.updateRangeStart);let l="";n<t.updateRangeStart&&(l+=this._editContext.text.substring(n,t.updateRangeStart)),l+=t.text,o>t.updateRangeEnd&&(l+=this._editContext.text.substring(t.updateRangeEnd,o));let c=0;t.selectionStart===t.selectionEnd&&n===o&&(c=t.selectionStart-(t.updateRangeStart+t.text.length));let u={text:l,replacePrevCharCnt:s,replaceNextCharCnt:r,positionDelta:c};this._onType(e,u)}_onType(e,t){t.replacePrevCharCnt||t.replaceNextCharCnt||t.positionDelta?e.compositionType(t.text,t.replacePrevCharCnt,t.replaceNextCharCnt,t.positionDelta):e.type(t.text)}_getNewEditContextState(){let e=this._primarySelection,t=this._context.viewModel.model;if(!t.isValidRange(e))return;let o=e.startLineNumber,n=e.endLineNumber,r=t.getLineMaxColumn(n),s=new z(o,1,n,r),l=t.getValueInRange(s,0),c=e.startColumn-1,u=l.length+e.endColumn-r;return{text:l,selectionStartOffset:c,selectionEndOffset:u,editContextPrimarySelection:e}}_editContextStartPosition(){return new Ie(this._editContextPrimarySelection.startLineNumber,1)}_handleTextFormatUpdate(e){if(!this._editContext)return;let t=e.getTextFormats(),o=this._editContextStartPosition(),n=[];t.forEach(r=>{let s=this._context.viewModel.model,l=s.getOffsetAt(o),c=s.getPositionAt(l+r.rangeStart),u=s.getPositionAt(l+r.rangeEnd),p=z.fromPositions(c,u),h=r.underlineThickness.toLowerCase(),g="edit-context-composition-none";switch(h){case"thin":g="edit-context-composition-secondary";break;case"thick":g="edit-context-composition-primary";break}n.push({range:p,options:{description:"textFormatDecoration",inlineClassName:g}})}),this._decorations=this._context.viewModel.model.deltaDecorations(this._decorations,n)}_updateSelectionAndControlBoundsData(e){let t=this._context.viewModel.coordinatesConverter.convertModelRangeToViewRange(this._primarySelection);if(this._primarySelection.isEmpty()){let o=e.visibleRangeForPosition(t.getStartPosition());this._linesVisibleRanges=o}else this._linesVisibleRanges=null}_updateSelectionAndControlBounds(){let t=this._context.configuration.options.get(165).contentLeft,o=this._context.viewModel.coordinatesConverter.convertModelRangeToViewRange(this._primarySelection),n=this._context.viewLayout.getVerticalOffsetForLineNumber(o.startLineNumber),r=this._context.viewLayout.getVerticalOffsetAfterLineNumber(o.endLineNumber),s=this._parentBounds,l=s.top+n-this._scrollTop,c=r-n,u=s.left+t-this._scrollLeft,p;this._primarySelection.isEmpty()?(this._linesVisibleRanges&&(u+=this._linesVisibleRanges.left),p=0):p=s.width-t;let h=new DOMRect(u,l,p,c);this._editContext.updateSelectionBounds(h),this._editContext.updateControlBounds(h)}_updateCharacterBounds(e){let t=this._context.configuration.options,o=t.get(59).typicalHalfwidthCharacterWidth,n=t.get(165).contentLeft,r=this._parentBounds,s=[],l=new AM(this._editContext.text);for(let c=e.rangeStart;c<e.rangeEnd;c++){let u=l.getPosition(c),p=this._editContextPrimarySelection.startLineNumber-1,h=new Ie(p+u.lineNumber,u.column),g=h.delta(0,1),f=z.fromPositions(h,g),v=this._context.viewModel.coordinatesConverter.convertModelRangeToViewRange(f),b=this._visibleRangeProvider.linesVisibleRangesForRange(v,!0)??[],S=v.startLineNumber,y=this._context.viewLayout.getVerticalOffsetForLineNumber(S),w=r.top+y-this._scrollTop,k=0,T=o;if(b.length>0)for(let O of b[0].ranges){k=O.left,T=O.width;break}let N=this._context.viewLayout.getLineHeightForLineNumber(S);s.push(new DOMRect(r.left+n+k-this._scrollLeft,w,T,N))}this._editContext.updateCharacterBounds(e.rangeStart,s)}};oae=I([m(5,F),m(6,ne)],oae);var Svt=class extends mu{constructor(e,t){super(e);this._viewGpuContext=t;this._gpuShapes=[];this._register(he(o=>this._updateEntries(o)))}onConfigurationChanged(e){return this._updateEntries(void 0),!0}prepareRender(e){}render(e){}_updateEntries(e){let t=this._context.configuration.options,o=t.get(116),n=t.get(59).typicalHalfwidthCharacterWidth,r=this._viewGpuContext.devicePixelRatio.read(e);for(let s=0,l=o.length;s<l;s++){let c=o[s],u=this._gpuShapes[s],p=c.color?Oe.fromHex(c.color):this._context.theme.getColor(cqi)??Oe.white,h=[c.column*n*r,0,Math.max(1,Math.ceil(r)),Number.MAX_SAFE_INTEGER,p.rgba.r/255,p.rgba.g/255,p.rgba.b/255,p.rgba.a];u?u.setRaw(h):this._gpuShapes[s]=this._viewGpuContext.rectangleRenderer.register(...h)}for(;this._gpuShapes.length>o.length;)this._gpuShapes.splice(-1,1)[0].dispose()}};var Ivt=class a extends Jw{constructor(e,t){super();this._viewGpuContext=t;this._context=e,this._renderResult=null,this._context.addEventHandler(this)}static{this.CLASS_NAME="gpu-mark"}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){return!0}onCursorStateChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}onDecorationsChanged(e){return!0}prepareRender(e){let t=e.visibleRange.startLineNumber,o=e.visibleRange.endLineNumber,n=e.viewportData,r=new iq(this._context.configuration,this._context.theme.type),s=[];for(let l=t;l<=o;l++){let c=l-t,u=this._viewGpuContext.canRenderDetailed(r,n,l);s[c]=u.length?`<div class="${a.CLASS_NAME}" title="Cannot render on GPU: ${u.join(", ")}"></div>`:""}this._renderResult=s}render(e,t){if(!this._renderResult)return"";let o=t-e;return o<0||o>=this._renderResult.length?"":this._renderResult[o]}};var eC=ae("userInteractionService");var tye=class extends Jk{constructor(e,t,o,n,r,s,l,c,u,p){super();this._instantiationService=u;this._userInteractionService=p;this._editContextClipboardListeners=new P;this._onWillCopy=this._register(new E);this.onWillCopy=this._onWillCopy.event;this._onWillCut=this._register(new E);this.onWillCut=this._onWillCut.event;this._onWillPaste=this._register(new E);this.onWillPaste=this._onWillPaste.event;this._shouldRecomputeGlyphMarginLanes=!1;this._ownerID=t,this._widgetFocusTracker=this._register(new vZt(e,c,this._userInteractionService)),this._register(this._widgetFocusTracker.onChange(()=>{this._context.viewModel.setHasWidgetFocus(this._widgetFocusTracker.hasFocus())})),this._selections=[new Yt(1,1,1,1)],this._renderAnimationFrame=null,this._overflowGuardContainer=or(document.createElement("div")),PS.write(this._overflowGuardContainer,3),this._overflowGuardContainer.setClassName("overflow-guard"),this._viewController=new sft(n,s,l,o),this._context=new avt(n,r,s),this._context.addEventHandler(this),this._viewParts=[],this._editContextEnabled=this._context.configuration.options.get(170),this._accessibilitySupport=this._context.configuration.options.get(2),this._editContext=this._instantiateEditContext(),this._connectEditContextClipboardEvents(),this._viewParts.push(this._editContext),this._linesContent=or(document.createElement("div")),this._linesContent.setClassName("lines-content monaco-editor-background"),this._linesContent.setPosition("absolute"),this.domNode=or(document.createElement("div")),this.domNode.setClassName(this._getEditorClassName()),this.domNode.setAttribute("role","code"),this._context.configuration.options.get(46)==="on"&&(this._viewGpuContext=this._instantiationService.createInstance(ec,this._context)),this._scrollbar=new Dft(this._context,this._linesContent,this.domNode,this._overflowGuardContainer),this._viewParts.push(this._scrollbar),this._viewLines=new Pft(this._context,this._viewGpuContext,this._linesContent),this._viewGpuContext&&(this._viewLinesGpu=this._instantiationService.createInstance(GIe,this._context,this._viewGpuContext)),this._viewZones=new ivt(this._context),this._viewParts.push(this._viewZones);let h=new $ft(this._context);this._viewParts.push(h);let g=new Xft(this._context);this._viewParts.push(g);let f=new lft(this._context);this._viewParts.push(f),f.addDynamicOverlay(new Eft(this._context)),f.addDynamicOverlay(new Zft(this._context)),f.addDynamicOverlay(new Mft(this._context)),f.addDynamicOverlay(new _ft(this._context)),f.addDynamicOverlay(new ovt(this._context));let v=new cft(this._context);this._viewParts.push(v),v.addDynamicOverlay(new Tft(this._context)),v.addDynamicOverlay(new Nft(this._context)),v.addDynamicOverlay(new Aft(this._context)),v.addDynamicOverlay(new VIe(this._context)),this._viewGpuContext&&v.addDynamicOverlay(new Ivt(this._context,this._viewGpuContext)),this._glyphMarginWidgets=new Lft(this._context),this._viewParts.push(this._glyphMarginWidgets);let b=new HIe(this._context);b.getDomNode().appendChild(this._viewZones.marginDomNode),b.getDomNode().appendChild(v.getDomNode()),b.getDomNode().appendChild(this._glyphMarginWidgets.domNode),this._viewParts.push(b),this._contentWidgets=new uft(this._context,this.domNode),this._viewParts.push(this._contentWidgets),this._viewCursors=new tvt(this._context),this._viewParts.push(this._viewCursors),this._overlayWidgets=new Kft(this._context,this.domNode),this._viewParts.push(this._overlayWidgets);let S=this._viewGpuContext?new Svt(this._context,this._viewGpuContext):new Yft(this._context);this._viewParts.push(S);let y=new dft(this._context);this._viewParts.push(y);let w=new Uft(this._context);if(this._viewParts.push(w),h){let k=this._scrollbar.getOverviewRulerLayoutInfo();k.parent.insertBefore(h.getDomNode(),k.insertBefore)}this._linesContent.appendChild(f.getDomNode()),"domNode"in S&&this._linesContent.appendChild(S.domNode),this._linesContent.appendChild(this._viewZones.domNode),this._linesContent.appendChild(this._viewLines.getDomNode()),this._linesContent.appendChild(this._contentWidgets.domNode),this._linesContent.appendChild(this._viewCursors.getDomNode()),this._overflowGuardContainer.appendChild(b.getDomNode()),this._overflowGuardContainer.appendChild(this._scrollbar.getDomNode()),this._viewGpuContext&&this._overflowGuardContainer.appendChild(this._viewGpuContext.canvas),this._overflowGuardContainer.appendChild(g.getDomNode()),this._overflowGuardContainer.appendChild(this._overlayWidgets.getDomNode()),this._overflowGuardContainer.appendChild(w.getDomNode()),this._overflowGuardContainer.appendChild(y.domNode),this.domNode.appendChild(this._overflowGuardContainer),c?(c.appendChild(this._contentWidgets.overflowingContentWidgetsDomNode.domNode),c.appendChild(this._overlayWidgets.overflowingOverlayWidgetsDomNode.domNode)):(this.domNode.appendChild(this._contentWidgets.overflowingContentWidgetsDomNode),this.domNode.appendChild(this._overlayWidgets.overflowingOverlayWidgetsDomNode)),this._applyLayout(),this._pointerHandler=this._register(new rft(this._context,this._viewController,this._createPointerHandlerHelper()))}_instantiateEditContext(){return this._context.configuration.options.get(170)?this._instantiationService.createInstance(oae,this._ownerID,this._context,this._overflowGuardContainer,this._viewController,this._createTextAreaHandlerHelper()):this._instantiationService.createInstance(jIe,this._ownerID,this._context,this._overflowGuardContainer,this._viewController,this._createTextAreaHandlerHelper())}_updateEditContext(){let e=this._context.configuration.options.get(170),t=this._context.configuration.options.get(2);if(this._editContextEnabled===e&&this._accessibilitySupport===t)return;this._editContextEnabled=e,this._accessibilitySupport=t;let o=this._editContext.isFocused(),n=this._viewParts.indexOf(this._editContext);this._editContext.dispose(),this._editContext=this._instantiateEditContext(),this._connectEditContextClipboardEvents(),o&&this._editContext.focus(),n!==-1&&this._viewParts.splice(n,1,this._editContext)}_connectEditContextClipboardEvents(){this._editContextClipboardListeners.clear(),this._editContextClipboardListeners.add(this._editContext.onWillCopy(e=>this._onWillCopy.fire(e))),this._editContextClipboardListeners.add(this._editContext.onWillCut(e=>this._onWillCut.fire(e))),this._editContextClipboardListeners.add(this._editContext.onWillPaste(e=>this._onWillPaste.fire(e)))}_computeGlyphMarginLanes(){let e=this._context.viewModel.model,t=this._context.viewModel.glyphLanes,o=[],n=0;o=o.concat(e.getAllMarginDecorations().map(r=>{let s=r.options.glyphMargin?.position??2;return n=Math.max(n,r.range.endLineNumber),{range:r.range,lane:s,persist:r.options.glyphMargin?.persistLane}})),o=o.concat(this._glyphMarginWidgets.getWidgets().map(r=>{let s=e.validateRange(r.preference.range);return n=Math.max(n,s.endLineNumber),{range:s,lane:r.preference.lane}})),o.sort((r,s)=>z.compareRangesUsingStarts(r.range,s.range)),t.reset(n);for(let r of o)t.push(r.lane,r.range,r.persist);return t}_createPointerHandlerHelper(){return{viewDomNode:this.domNode.domNode,linesContentDomNode:this._linesContent.domNode,viewLinesDomNode:this._viewLines.getDomNode().domNode,viewLinesGpu:this._viewLinesGpu,focusTextArea:()=>{this.focus()},dispatchTextAreaEvent:e=>{this._editContext.domNode.domNode.dispatchEvent(e)},getLastRenderData:()=>{let e=this._viewCursors.getLastRenderData()||[],t=this._editContext.getLastRenderData();return new Pgt(e,t)},renderNow:()=>{this.render(!0,!1)},shouldSuppressMouseDownOnViewZone:e=>this._viewZones.shouldSuppressMouseDownOnViewZone(e),shouldSuppressMouseDownOnWidget:e=>this._contentWidgets.shouldSuppressMouseDownOnWidget(e),getPositionFromDOMInfo:(e,t)=>(this._flushAccumulatedAndRenderNow(),this._viewLines.getPositionFromDOMInfo(e,t)),visibleRangeForPosition:(e,t)=>{this._flushAccumulatedAndRenderNow();let o=new Ie(e,t);return this._viewLines.visibleRangeForPosition(o)??this._viewLinesGpu?.visibleRangeForPosition(o)??null},getLineWidth:e=>{if(this._flushAccumulatedAndRenderNow(),this._viewLinesGpu){let t=this._viewLinesGpu.getLineWidth(e);if(t!==void 0)return t}return this._viewLines.getLineWidth(e)}}}_createTextAreaHandlerHelper(){return{visibleRangeForPosition:e=>(this._flushAccumulatedAndRenderNow(),this._viewLines.visibleRangeForPosition(e)),linesVisibleRangesForRange:(e,t)=>(this._flushAccumulatedAndRenderNow(),this._viewLines.linesVisibleRangesForRange(e,t))}}_applyLayout(){let t=this._context.configuration.options.get(165);this.domNode.setWidth(t.width),this.domNode.setHeight(t.height),this._overflowGuardContainer.setWidth(t.width),this._overflowGuardContainer.setHeight(t.height),this._linesContent.setWidth(16777216),this._linesContent.setHeight(16777216)}_getEditorClassName(){let e=this._editContext.isFocused()?" focused":"";return this._context.configuration.options.get(162)+" "+J$(this._context.theme.type)+e}handleEvents(e){super.handleEvents(e),this._scheduleRender()}onConfigurationChanged(e){return this.domNode.setClassName(this._getEditorClassName()),this._updateEditContext(),this._applyLayout(),!1}onCursorStateChanged(e){return this._selections=e.selections,!1}onDecorationsChanged(e){return e.affectsGlyphMargin&&(this._shouldRecomputeGlyphMarginLanes=!0),!1}onFocusChanged(e){return this.domNode.setClassName(this._getEditorClassName()),!1}onThemeChanged(e){return this._context.theme.update(e.theme),this.domNode.setClassName(this._getEditorClassName()),!1}dispose(){this._renderAnimationFrame!==null&&(this._renderAnimationFrame.dispose(),this._renderAnimationFrame=null),this._editContextClipboardListeners.dispose(),this._contentWidgets.overflowingContentWidgetsDomNode.domNode.remove(),this._overlayWidgets.overflowingOverlayWidgetsDomNode.domNode.remove(),this._context.removeEventHandler(this),this._viewGpuContext?.dispose(),this._viewLines.dispose(),this._viewLinesGpu?.dispose();for(let e of this._viewParts)e.dispose();super.dispose()}_scheduleRender(){if(this._store.isDisposed)throw new ni;if(this._renderAnimationFrame===null){this._editContext instanceof oae&&this._editContext.setEditContextOnDomNode();let e=this._createCoordinatedRendering();this._renderAnimationFrame=fZt.INSTANCE.scheduleCoordinatedRendering({window:Me(this.domNode?.domNode),prepareRenderText:()=>{if(this._store.isDisposed)throw new ni;try{return e.prepareRenderText()}finally{this._renderAnimationFrame=null}},renderText:t=>{if(this._store.isDisposed)throw new ni;return e.renderText(t)},prepareRender:(t,o)=>{if(this._store.isDisposed)throw new ni;return e.prepareRender(t,o)},render:(t,o)=>{if(this._store.isDisposed)throw new ni;return e.render(t,o)}})}}_flushAccumulatedAndRenderNow(){let e=this._createCoordinatedRendering(),t=T9(()=>e.prepareRenderText());if(!t)return;let o=T9(()=>e.renderText(t));if(!o)return;let[n,r]=o;T9(()=>e.prepareRender(n,r)),T9(()=>e.render(n,r))}_getViewPartsToRender(){let e=[],t=0;for(let o of this._viewParts)o.shouldRender()&&(e[t++]=o);return e}_createCoordinatedRendering(){return{prepareRenderText:()=>{if(this._shouldRecomputeGlyphMarginLanes){this._shouldRecomputeGlyphMarginLanes=!1;let n=this._computeGlyphMarginLanes();this._context.configuration.setGlyphMarginDecorationLaneCount(n.requiredLanes)}if(vx.onRenderStart(),!this.domNode.domNode.isConnected)return null;let e=this._getViewPartsToRender();if(!this._viewLines.shouldRender()&&e.length===0)return null;let t=this._context.viewLayout.getLinesViewportData();this._context.viewModel.setViewport(t.startLineNumber,t.endLineNumber,t.centeredLineNumber);let o=new rvt(this._selections,t,this._context.viewLayout.getWhitespaceViewportData(),this._context.viewModel);for(let n of this._viewParts)n.shouldRender()&&n.onBeforeRender(o);return o},renderText:e=>(this._viewLines.shouldRender()&&(this._viewLines.renderText(e),this._viewLines.onDidRender()),this._viewLinesGpu?.shouldRender()&&(this._viewLinesGpu.renderText(e),this._viewLinesGpu.onDidRender()),[this._getViewPartsToRender(),new xgt(this._context.viewLayout,e,this._viewLines,this._viewLinesGpu)]),prepareRender:(e,t)=>{for(let o of e)o.prepareRender(t)},render:(e,t)=>{for(let o of e)o.render(t),o.onDidRender()}}}delegateVerticalScrollbarPointerDown(e){this._scrollbar.delegateVerticalScrollbarPointerDown(e)}delegateScrollFromMouseWheelEvent(e){this._scrollbar.delegateScrollFromMouseWheelEvent(e)}restoreState(e){this._context.viewModel.viewLayout.setScrollPosition({scrollTop:e.scrollTop,scrollLeft:e.scrollLeft},1),this._context.viewModel.visibleLinesStabilized()}getOffsetForColumn(e,t){let o=this._context.viewModel.model.validatePosition({lineNumber:e,column:t}),n=this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(o);this._flushAccumulatedAndRenderNow();let r=this._viewLines.visibleRangeForPosition(new Ie(n.lineNumber,n.column));return r?r.left:-1}getLineWidth(e){let t=this._context.viewModel.model,o=this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(new Ie(e,t.getLineMaxColumn(e))).lineNumber;return this._flushAccumulatedAndRenderNow(),this._viewLines.getLineWidth(o)}resetLineWidthCaches(){this._viewLines.resetLineWidthCaches()}getTargetAtClientPoint(e,t){let o=this._pointerHandler.getTargetAtClientPoint(e,t);return o?MIe.convertViewToModelMouseTarget(o,this._context.viewModel.coordinatesConverter):null}createOverviewRuler(e){return new Qft(this._context,e)}change(e){this._viewZones.changeViewZones(e),this._scheduleRender()}render(e,t){if(t){this._viewLines.forceShouldRender();for(let o of this._viewParts)o.forceShouldRender()}e?this._flushAccumulatedAndRenderNow():this._scheduleRender()}writeScreenReaderContent(e){this._editContext.writeScreenReaderContent(e)}focus(){this._editContext.focus()}isFocused(){return this._editContext.isFocused()}isWidgetFocused(){return this._widgetFocusTracker.hasFocus()}refreshFocusState(){this._editContext.refreshFocusState(),this._widgetFocusTracker.refreshState()}setAriaOptions(e){this._editContext.setAriaOptions(e)}addContentWidget(e){this._contentWidgets.addWidget(e.widget),this.layoutContentWidget(e),this._scheduleRender()}layoutContentWidget(e){this._contentWidgets.setWidgetPosition(e.widget,e.position?.position??null,e.position?.secondaryPosition??null,e.position?.preference??null,e.position?.positionAffinity??null),this._contentWidgets.shouldRender()&&this._scheduleRender()}removeContentWidget(e){this._contentWidgets.removeWidget(e.widget),this._scheduleRender()}addOverlayWidget(e){this._overlayWidgets.addWidget(e.widget),this.layoutOverlayWidget(e),this._scheduleRender()}layoutOverlayWidget(e){this._overlayWidgets.setWidgetPosition(e.widget,e.position)&&this._scheduleRender()}removeOverlayWidget(e){this._overlayWidgets.removeWidget(e.widget),this._scheduleRender()}addGlyphMarginWidget(e){this._glyphMarginWidgets.addWidget(e.widget),this._shouldRecomputeGlyphMarginLanes=!0,this._scheduleRender()}layoutGlyphMarginWidget(e){let t=e.position;this._glyphMarginWidgets.setWidgetPosition(e.widget,t)&&(this._shouldRecomputeGlyphMarginLanes=!0,this._scheduleRender())}removeGlyphMarginWidget(e){this._glyphMarginWidgets.removeWidget(e.widget),this._shouldRecomputeGlyphMarginLanes=!0,this._scheduleRender()}};tye=I([m(8,F),m(9,eC)],tye);function T9(a){try{return a()}catch(i){return mt(i),null}}var fZt=class a{constructor(){this._coordinatedRenderings=[];this._animationFrameRunners=new Map}static{this.INSTANCE=new a}scheduleCoordinatedRendering(i){return this._coordinatedRenderings.push(i),this._scheduleRender(i.window),{dispose:()=>{let e=this._coordinatedRenderings.indexOf(i);if(e!==-1&&(this._coordinatedRenderings.splice(e,1),this._coordinatedRenderings.length===0)){for(let[t,o]of this._animationFrameRunners)o.dispose();this._animationFrameRunners.clear()}}}}_scheduleRender(i){if(!this._animationFrameRunners.has(i)){let e=()=>{this._animationFrameRunners.delete(i),this._onRenderScheduled()};this._animationFrameRunners.set(i,Ah(i,e,100))}}_onRenderScheduled(){let i=this._coordinatedRenderings.slice(0);this._coordinatedRenderings=[];let e=[];for(let o=0,n=i.length;o<n;o++){let r=i[o];e[o]=T9(()=>r.prepareRenderText())}let t=[];for(let o=0,n=i.length;o<n;o++){let r=i[o],s=e[o];if(!s){t[o]=null;continue}t[o]=T9(()=>r.renderText(s))}for(let o=0,n=i.length;o<n;o++){let r=i[o],s=t[o];if(!s)continue;let[l,c]=s;T9(()=>r.prepareRender(l,c))}for(let o=0,n=i.length;o<n;o++){let r=i[o],s=t[o];if(!s)continue;let[l,c]=s;T9(()=>r.render(l,c))}}},vZt=class extends C{constructor(e,t,o){super();this._onChange=this._register(new E);this.onChange=this._onChange.event;this._hadFocus=void 0;this._hasDomElementFocus=!1,this._domFocusTracker=this._register(o.createDomFocusTracker(e)),this._overflowWidgetsDomNodeHasFocus=!1,this._register(this._domFocusTracker.onDidFocus(()=>{this._hasDomElementFocus=!0,this._update()})),this._register(this._domFocusTracker.onDidBlur(()=>{this._hasDomElementFocus=!1,this._update()})),t&&(this._overflowWidgetsDomNode=this._register(o.createDomFocusTracker(t)),this._register(this._overflowWidgetsDomNode.onDidFocus(()=>{this._overflowWidgetsDomNodeHasFocus=!0,this._update()})),this._register(this._overflowWidgetsDomNode.onDidBlur(()=>{this._overflowWidgetsDomNodeHasFocus=!1,this._update()})))}_update(){let e=this._hasDomElementFocus||this._overflowWidgetsDomNodeHasFocus;this._hadFocus!==e&&(this._hadFocus=e,this._onChange.fire(void 0))}hasFocus(){return this._hadFocus??!1}refreshState(){this._domFocusTracker.refreshState(),this._overflowWidgetsDomNode?.refreshState?.()}};var oq=class{constructor(i,e,t,o,n){this.injectionOffsets=i;this.injectionOptions=e;this.breakOffsets=t;this.breakOffsetsVisibleColumn=o;this.wrappedTextIndentLength=n}getOutputLineCount(){return this.breakOffsets.length}getMinOutputOffset(i){return i>0?this.wrappedTextIndentLength:0}getLineLength(i){let e=i>0?this.breakOffsets[i-1]:0,o=this.breakOffsets[i]-e;return i>0&&(o+=this.wrappedTextIndentLength),o}getMaxOutputOffset(i){return this.getLineLength(i)}translateToInputOffset(i,e){i>0&&(e=Math.max(0,e-this.wrappedTextIndentLength));let o=i===0?e:this.breakOffsets[i-1]+e;if(this.injectionOffsets!==null)for(let n=0;n<this.injectionOffsets.length&&o>this.injectionOffsets[n];n++)o<this.injectionOffsets[n]+this.injectionOptions[n].content.length?o=this.injectionOffsets[n]:o-=this.injectionOptions[n].content.length;return o}translateToOutputPosition(i,e=2){let t=i;if(this.injectionOffsets!==null)for(let o=0;o<this.injectionOffsets.length&&!(i<this.injectionOffsets[o]||e!==1&&i===this.injectionOffsets[o]);o++)t+=this.injectionOptions[o].content.length;return this.offsetInInputWithInjectionsToOutputPosition(t,e)}offsetInInputWithInjectionsToOutputPosition(i,e=2){let t=0,o=this.breakOffsets.length-1,n=0,r=0;for(;t<=o;){n=t+(o-t)/2|0;let l=this.breakOffsets[n];if(r=n>0?this.breakOffsets[n-1]:0,e===0)if(i<=r)o=n-1;else if(i>l)t=n+1;else break;else if(i<r)o=n-1;else if(i>=l)t=n+1;else break}let s=i-r;return n>0&&(s+=this.wrappedTextIndentLength),new iye(n,s)}normalizeOutputPosition(i,e,t){if(this.injectionOffsets!==null){let o=this.outputPositionToOffsetInInputWithInjections(i,e),n=this.normalizeOffsetInInputWithInjectionsAroundInjections(o,t);if(n!==o)return this.offsetInInputWithInjectionsToOutputPosition(n,t)}if(t===0){if(i>0&&e===this.getMinOutputOffset(i))return new iye(i-1,this.getMaxOutputOffset(i-1))}else if(t===1){let o=this.getOutputLineCount()-1;if(i<o&&e===this.getMaxOutputOffset(i))return new iye(i+1,this.getMinOutputOffset(i+1))}return new iye(i,e)}outputPositionToOffsetInInputWithInjections(i,e){return i>0&&(e=Math.max(0,e-this.wrappedTextIndentLength)),(i>0?this.breakOffsets[i-1]:0)+e}normalizeOffsetInInputWithInjectionsAroundInjections(i,e){let t=this.getInjectedTextAtOffset(i);if(!t)return i;if(e===2){if(i===t.offsetInInputWithInjections+t.length&&Fqi(this.injectionOptions[t.injectedTextIndex].cursorStops))return t.offsetInInputWithInjections+t.length;{let o=t.offsetInInputWithInjections;if(Wqi(this.injectionOptions[t.injectedTextIndex].cursorStops))return o;let n=t.injectedTextIndex-1;for(;n>=0&&this.injectionOffsets[n]===this.injectionOffsets[t.injectedTextIndex]&&!(Fqi(this.injectionOptions[n].cursorStops)||(o-=this.injectionOptions[n].content.length,Wqi(this.injectionOptions[n].cursorStops)));)n--;return o}}else if(e===1||e===4){let o=t.offsetInInputWithInjections+t.length,n=t.injectedTextIndex;for(;n+1<this.injectionOffsets.length&&this.injectionOffsets[n+1]===this.injectionOffsets[n];)o+=this.injectionOptions[n+1].content.length,n++;return o}else if(e===0||e===3){let o=t.offsetInInputWithInjections,n=t.injectedTextIndex;for(;n-1>=0&&this.injectionOffsets[n-1]===this.injectionOffsets[n];)o-=this.injectionOptions[n-1].content.length,n--;return o}Hr(e)}getInjectedText(i,e){let t=this.outputPositionToOffsetInInputWithInjections(i,e),o=this.getInjectedTextAtOffset(t);return o?{options:this.injectionOptions[o.injectedTextIndex]}:null}getInjectedTextAtOffset(i){let e=this.injectionOffsets,t=this.injectionOptions;if(e!==null){let o=0;for(let n=0;n<e.length;n++){let r=t[n].content.length,s=e[n]+o,l=e[n]+o+r;if(s>i)break;if(i<=l)return{injectedTextIndex:n,offsetInInputWithInjections:s,length:r};o+=r}}}};function Fqi(a){return a==null?!0:a===1||a===0}function Wqi(a){return a==null?!0:a===2||a===0}var iye=class{constructor(i,e){this.outputLineIndex=i,this.outputOffset=e}toString(){return`${this.outputLineIndex}:${this.outputOffset}`}toPosition(i){return new Ie(i+this.outputLineIndex,this.outputOffset+1)}};function Vqi(){return a=>({fontFamily:a.fontFamily?String(a.fontFamily):void 0,fontSizeMultiplier:a.fontSizeMultiplier?Number(a.fontSizeMultiplier):void 0,lineHeightMultiplier:a.lineHeightMultiplier?Number(a.lineHeightMultiplier):void 0})}var yvt=class{constructor(){this.changeType=1}},e_=class a{constructor(i,e,t,o,n){this.ownerId=i;this.lineNumber=e;this.column=t;this.options=o;this.order=n}static applyInjectedText(i,e){if(!e||e.length===0)return i;let t="",o=0;for(let n of e)t+=i.substring(o,n.column-1),o=n.column-1,t+=n.options.content;return t+=i.substring(o),t}static fromDecorations(i){let e=[];for(let t of i)t.options.before&&t.options.before.content.length>0&&e.push(new a(t.ownerId,t.range.startLineNumber,t.range.startColumn,t.options.before,0)),t.options.after&&t.options.after.content.length>0&&e.push(new a(t.ownerId,t.range.endLineNumber,t.range.endColumn,t.options.after,1));return e.sort((t,o)=>t.lineNumber===o.lineNumber?t.column===o.column?t.order-o.order:t.column-o.column:t.lineNumber-o.lineNumber),e}withText(i){return new a(this.ownerId,this.lineNumber,this.column,{...this.options,content:i},this.order)}},pqe=class{constructor(i,e,t,o){this.changeType=2;this.lineNumber=i,this.lineNumberPostEdit=e,this.detail=t,this.injectedText=o}},wvt=class{constructor(i,e,t,o){this.ownerId=i,this.decorationId=e,this.lineNumber=t,this.lineHeightMultiplier=o}},Cvt=class{constructor(i,e){this.ownerId=i,this.lineNumber=e}},xvt=class{constructor(i,e,t){this.changeType=3;this.fromLineNumber=i,this.toLineNumber=e,this.lastUntouchedLinePostEdit=t}},kvt=class{constructor(i,e,t,o,n){this.changeType=4;this.injectedTexts=n,this.fromLineNumber=i,this.fromLineNumberPostEdit=e,this.count=t,this.detail=o}get toLineNumber(){return this.fromLineNumber+this.count-1}get toLineNumberPostEdit(){return this.fromLineNumberPostEdit+this.count-1}},Evt=class{constructor(){this.changeType=5}},nae=class a{constructor(i,e,t,o){this.changes=i,this.versionId=e,this.isUndoing=t,this.isRedoing=o,this.resultingSelection=null}containsEvent(i){for(let e=0,t=this.changes.length;e<t;e++)if(this.changes[e].changeType===i)return!0;return!1}static merge(i,e){let t=[].concat(i.changes).concat(e.changes),o=e.versionId,n=i.isUndoing||e.isUndoing,r=i.isRedoing||e.isRedoing;return new a(t,o,n,r)}},oye=class{constructor(i){this.changes=i}},nye=class{constructor(i){this.changes=i}affects(i){if(z.isIRange(i)){for(let e of this.changes)if(e.lineNumber>=i.startLineNumber&&e.lineNumber<=i.endLineNumber)return!0;return!1}else{for(let e of this.changes)if(e.lineNumber===i.lineNumber)return!0;return!1}}},rye=class{constructor(i){this.changes=i}},_9=class a{constructor(i,e){this.rawContentChangedEvent=i;this.contentChangedEvent=e}merge(i){let e=nae.merge(this.rawContentChangedEvent,i.rawContentChangedEvent),t=a._mergeChangeEvents(this.contentChangedEvent,i.contentChangedEvent);return new a(e,t)}static _mergeChangeEvents(i,e){let t=[].concat(i.changes).concat(e.changes),o=e.eol,n=e.versionId,r=i.isUndoing||e.isUndoing,s=i.isRedoing||e.isRedoing,l=i.isFlush||e.isFlush,c=i.isEolChange&&e.isEolChange;return{changes:t,eol:o,isEolChange:c,versionId:n,isUndoing:r,isRedoing:s,isFlush:l,detailedReasons:i.detailedReasons.concat(e.detailedReasons),detailedReasonsChangeLengths:i.detailedReasonsChangeLengths.concat(e.detailedReasonsChangeLengths)}}};var bAo=Kg("domLineBreaksComputer",{createHTML:a=>a}),Tvt=class a{constructor(i){this.targetWindow=i}static create(i){return new a(new WeakRef(i))}createLineBreaksComputer(i,e,t,o,n,r){let s=[],l=[];return{addRequest:(c,u,p)=>{s.push(c),l.push(u)},finalize:()=>SAo(Oi(this.targetWindow.deref()),s,i,e,t,o,n,l)}}};function SAo(a,i,e,t,o,n,r,s){function l(U){let G=s[U];if(G){let $=e_.applyInjectedText(i[U],G),te=G.map(de=>de.options),pe=G.map(de=>de.column-1);return new oq(pe,te,[$.length],[],0)}else return null}if(o===-1){let U=[];for(let G=0,$=i.length;G<$;G++)U[G]=l(G);return U}let c=Math.round(o*e.typicalHalfwidthCharacterWidth),u=n===3?2:n===2?1:0,p=Math.round(t*u),h=Math.ceil(e.spaceWidth*p),g=document.createElement("div");Pd(g,e);let f=new ES(1e4),v=[],b=[],S=[],y=[],w=[];for(let U=0;U<i.length;U++){let G=e_.applyInjectedText(i[U],s[U]),$=0,te=0,pe=c;if(n!==0)if($=Ap(G),$===-1)$=0;else{for(let ke=0;ke<$;ke++){let Ee=G.charCodeAt(ke)===9?t-te%t:1;te+=Ee}let Se=Math.ceil(e.spaceWidth*te);Se+e.typicalFullwidthCharacterWidth>c?($=0,te=0):pe=c-Se}let de=G.substr($),se=IAo(de,te,t,pe,f,h);v[U]=$,b[U]=te,S[U]=de,y[U]=se[0],w[U]=se[1]}let k=f.build(),T=bAo?.createHTML(k)??k;g.innerHTML=T,g.style.position="absolute",g.style.top="10000px",r==="keepAll"?(g.style.wordBreak="keep-all",g.style.overflowWrap="anywhere"):(g.style.wordBreak="inherit",g.style.overflowWrap="break-word"),a.document.body.appendChild(g);let N=document.createRange(),O=Array.prototype.slice.call(g.children,0),V=[];for(let U=0;U<i.length;U++){let G=O[U],$=yAo(N,G,S[U],y[U]);if($===null){V[U]=l(U);continue}let te=v[U],pe=b[U]+p,de=w[U],se=[];for(let He=0,Ve=$.length;He<Ve;He++)se[He]=de[$[He]];if(te!==0)for(let He=0,Ve=$.length;He<Ve;He++)$[He]+=te;let Se,ke,Ee=s[U];Ee?(Se=Ee.map(He=>He.options),ke=Ee.map(He=>He.column-1)):(Se=null,ke=null),V[U]=new oq(ke,Se,$,se,pe)}return g.remove(),V}function IAo(a,i,e,t,o,n){if(n!==0){let h=String(n);o.appendString('<div style="text-indent: -'),o.appendString(h),o.appendString("px; padding-left: "),o.appendString(h),o.appendString("px; box-sizing: border-box; width:")}else o.appendString('<div style="width:');o.appendString(String(t)),o.appendString('px;">');let r=a.length,s=i,l=0,c=[],u=[],p=0<r?a.charCodeAt(0):0;o.appendString("<span>");for(let h=0;h<r;h++){h!==0&&h%16384===0&&o.appendString("</span><span>"),c[h]=l,u[h]=s;let g=p;p=h+1<r?a.charCodeAt(h+1):0;let f=1,v=1;switch(g){case 9:f=e-s%e,v=f;for(let b=1;b<=f;b++)b<f?o.appendCharCode(160):o.appendASCIICharCode(32);break;case 32:p===32?o.appendCharCode(160):o.appendASCIICharCode(32);break;case 60:o.appendString("<");break;case 62:o.appendString(">");break;case 38:o.appendString("&");break;case 0:o.appendString("�");break;case 65279:case 8232:case 8233:case 133:o.appendCharCode(65533);break;default:AT(g)&&v++,g<32?o.appendCharCode(9216+g):o.appendCharCode(g)}l+=f,s+=v}return o.appendString("</span>"),c[a.length]=l,u[a.length]=s,o.appendString("</div>"),[c,u]}function yAo(a,i,e,t){if(e.length<=1)return null;let o=Array.prototype.slice.call(i.children,0),n=[];try{SZt(a,o,t,0,null,e.length-1,null,n)}catch(r){return console.log(r),null}return n.length===0?null:(n.push(e.length),n)}function SZt(a,i,e,t,o,n,r,s){if(t===n||(o=o||bZt(a,i,e[t],e[t+1]),r=r||bZt(a,i,e[n],e[n+1]),Math.abs(o[0].top-r[0].top)<=.1))return;if(t+1===n){s.push(n);return}let l=t+(n-t)/2|0,c=bZt(a,i,e[l],e[l+1]);SZt(a,i,e,t,o,l,c,s),SZt(a,i,e,l,c,n,r,s)}function bZt(a,i,e,t){return a.setStart(i[e/16384|0].firstChild,e%16384),a.setEnd(i[t/16384|0].firstChild,t%16384),a.getClientRects()}var _vt=class extends C{constructor(){super();this._editor=null;this._instantiationService=null;this._instances=this._register(new jt);this._pending=new Map;this._finishedInstantiation=[];this._finishedInstantiation[0]=!1,this._finishedInstantiation[1]=!1,this._finishedInstantiation[2]=!1,this._finishedInstantiation[3]=!1}initialize(e,t,o){this._editor=e,this._instantiationService=o;for(let n of t){if(this._pending.has(n.id)){mt(new Error(`Cannot have two contributions with the same id ${n.id}`));continue}this._pending.set(n.id,n)}this._instantiateSome(0),this._register(jv(Me(this._editor.getDomNode()),()=>{this._instantiateSome(1)})),this._register(jv(Me(this._editor.getDomNode()),()=>{this._instantiateSome(2)})),this._register(jv(Me(this._editor.getDomNode()),()=>{this._instantiateSome(3)},5e3))}saveViewState(){let e={};for(let[t,o]of this._instances)typeof o.saveViewState=="function"&&(e[t]=o.saveViewState());return e}restoreViewState(e){for(let[t,o]of this._instances)typeof o.restoreViewState=="function"&&o.restoreViewState(e[t])}get(e){return this._instantiateById(e),this._instances.get(e)||null}set(e,t){this._instances.set(e,t)}onBeforeInteractionEvent(){this._instantiateSome(2)}onAfterModelAttached(){return jv(Me(this._editor?.getDomNode()),()=>{this._instantiateSome(1)},50)}_instantiateSome(e){if(this._finishedInstantiation[e])return;this._finishedInstantiation[e]=!0;let t=this._findPendingContributionsByInstantiation(e);for(let o of t)this._instantiateById(o.id)}_findPendingContributionsByInstantiation(e){let t=[];for(let[,o]of this._pending)o.instantiation===e&&t.push(o);return t}_instantiateById(e){let t=this._pending.get(e);if(t){if(this._pending.delete(e),!this._instantiationService||!this._editor)throw new Error("Cannot instantiate contributions before being initialized!");try{let o=this._instantiationService.createInstance(t.ctor,this._editor);this._instances.set(t.id,o),typeof o.restoreViewState=="function"&&t.instantiation!==0&&console.warn(`Editor contribution '${t.id}' should be eager instantiated because it uses saveViewState / restoreViewState.`)}catch(o){mt(o)}}}};var Dvt=class{constructor(i,e,t,o,n,r,s){this.id=i;this.label=e;this.alias=t;this.metadata=o;this._precondition=n;this._run=r;this._contextKeyService=s}isSupported(){return this._contextKeyService.contextMatchesRules(this._precondition)}run(i){return this.isSupported()?this._run(i):Promise.resolve(void 0)}};function oE(a){return(a.metadata&1)>>>0}function Xu(a,i){a.metadata=a.metadata&254|i<<0}function HI(a){return(a.metadata&2)>>>1===1}function Vu(a,i){a.metadata=a.metadata&253|(i?1:0)<<1}function jqi(a){return(a.metadata&4)>>>2===1}function Bqi(a,i){a.metadata=a.metadata&251|(i?1:0)<<2}function Qqi(a){return(a.metadata&64)>>>6===1}function Hqi(a,i){a.metadata=a.metadata&191|(i?1:0)<<6}function Yqi(a){return(a.metadata&128)>>>7===1}function Uqi(a,i){a.metadata=a.metadata&127|(i?1:0)<<7}function wAo(a){return(a.metadata&24)>>>3}function zqi(a,i){a.metadata=a.metadata&231|i<<3}function CAo(a){return(a.metadata&32)>>>5===1}function Kqi(a,i){a.metadata=a.metadata&223|(i?1:0)<<5}var rae=class{constructor(i,e,t){this.metadata=0,this.parent=this,this.left=this,this.right=this,Xu(this,1),this.start=e,this.end=t,this.delta=0,this.maxEnd=t,this.id=i,this.ownerId=0,this.options=null,Bqi(this,!1),Hqi(this,!1),zqi(this,1),Kqi(this,!1),Uqi(this,!1),this.cachedVersionId=0,this.cachedAbsoluteStart=e,this.cachedAbsoluteEnd=t,this.range=null,Vu(this,!1)}reset(i,e,t,o){this.start=e,this.end=t,this.maxEnd=t,this.cachedVersionId=i,this.cachedAbsoluteStart=e,this.cachedAbsoluteEnd=t,this.range=o}setOptions(i){this.options=i;let e=this.options.className;Bqi(this,e==="squiggly-error"||e==="squiggly-warning"||e==="squiggly-info"),Hqi(this,this.options.glyphMarginClassName!==null),zqi(this,this.options.stickiness),Kqi(this,this.options.collapseOnReplaceEdit),Uqi(this,this.options.affectsFont??!1)}setCachedOffsets(i,e,t){this.cachedVersionId!==t&&(this.range=null),this.cachedVersionId=t,this.cachedAbsoluteStart=i,this.cachedAbsoluteEnd=e}detach(){this.parent=null,this.left=null,this.right=null}},da=new rae(null,0,0);da.parent=da;da.left=da;da.right=da;Xu(da,0);var L9=class{constructor(){this.root=da,this.requestNormalizeDelta=!1}intervalSearch(i,e,t,o,n,r,s){return this.root===da?[]:LAo(this,i,e,t,o,n,r,s)}search(i,e,t,o,n){return this.root===da?[]:Gqi(this,i,e,t,o,n)}collectNodesFromOwner(i){return _Ao(this,i)}collectNodesPostOrder(){return DAo(this)}insert(i){$qi(this,i),this._normalizeDeltaIfNecessary()}delete(i){qqi(this,i),this._normalizeDeltaIfNecessary()}resolveNode(i,e){let t=i,o=0;for(;i!==this.root;)i===i.parent.right&&(o+=i.parent.delta),i=i.parent;let n=t.start+o,r=t.end+o;t.setCachedOffsets(n,r,e)}acceptReplace(i,e,t,o){let n=EAo(this,i,i+e);for(let r=0,s=n.length;r<s;r++){let l=n[r];qqi(this,l)}this._normalizeDeltaIfNecessary(),TAo(this,i,i+e,t),this._normalizeDeltaIfNecessary();for(let r=0,s=n.length;r<s;r++){let l=n[r];l.start=l.cachedAbsoluteStart,l.end=l.cachedAbsoluteEnd,kAo(l,i,i+e,t,o),l.maxEnd=l.end,$qi(this,l)}this._normalizeDeltaIfNecessary()}getAllInOrder(){return Gqi(this,0,!1,!1,0,!1)}_normalizeDeltaIfNecessary(){this.requestNormalizeDelta&&(this.requestNormalizeDelta=!1,xAo(this))}};function xAo(a){let i=a.root,e=0;for(;i!==da;){if(i.left!==da&&!HI(i.left)){i=i.left;continue}if(i.right!==da&&!HI(i.right)){e+=i.delta,i=i.right;continue}i.start=e+i.start,i.end=e+i.end,i.delta=0,nq(i),Vu(i,!0),Vu(i.left,!1),Vu(i.right,!1),i===i.parent.right&&(e-=i.parent.delta),i=i.parent}Vu(a.root,!1)}function sye(a,i,e,t){return a<e?!0:a>e||t===1?!1:t===2?!0:i}function kAo(a,i,e,t,o){let n=wAo(a),r=n===0||n===2,s=n===1||n===2,l=e-i,c=t,u=Math.min(l,c),p=a.start,h=!1,g=a.end,f=!1;i<=p&&g<=e&&CAo(a)&&(a.start=i,h=!0,a.end=i,f=!0);{let b=o?1:l>0?2:0;!h&&sye(p,r,i,b)&&(h=!0),!f&&sye(g,s,i,b)&&(f=!0)}if(u>0&&!o){let b=l>c?2:0;!h&&sye(p,r,i+u,b)&&(h=!0),!f&&sye(g,s,i+u,b)&&(f=!0)}{let b=o?1:0;!h&&sye(p,r,e,b)&&(a.start=i+c,h=!0),!f&&sye(g,s,e,b)&&(a.end=i+c,f=!0)}let v=c-l;h||(a.start=Math.max(0,p+v)),f||(a.end=Math.max(0,g+v)),a.start>a.end&&(a.end=a.start)}function EAo(a,i,e){let t=a.root,o=0,n=0,r=0,s=0,l=[],c=0;for(;t!==da;){if(HI(t)){Vu(t.left,!1),Vu(t.right,!1),t===t.parent.right&&(o-=t.parent.delta),t=t.parent;continue}if(!HI(t.left)){if(n=o+t.maxEnd,n<i){Vu(t,!0);continue}if(t.left!==da){t=t.left;continue}}if(r=o+t.start,r>e){Vu(t,!0);continue}if(s=o+t.end,s>=i&&(t.setCachedOffsets(r,s,0),l[c++]=t),Vu(t,!0),t.right!==da&&!HI(t.right)){o+=t.delta,t=t.right;continue}}return Vu(a.root,!1),l}function TAo(a,i,e,t){let o=a.root,n=0,r=0,s=0,l=t-(e-i);for(;o!==da;){if(HI(o)){Vu(o.left,!1),Vu(o.right,!1),o===o.parent.right&&(n-=o.parent.delta),nq(o),o=o.parent;continue}if(!HI(o.left)){if(r=n+o.maxEnd,r<i){Vu(o,!0);continue}if(o.left!==da){o=o.left;continue}}if(s=n+o.start,s>e){o.start+=l,o.end+=l,o.delta+=l,(o.delta<-1073741824||o.delta>1073741824)&&(a.requestNormalizeDelta=!0),Vu(o,!0);continue}if(Vu(o,!0),o.right!==da&&!HI(o.right)){n+=o.delta,o=o.right;continue}}Vu(a.root,!1)}function _Ao(a,i){let e=a.root,t=[],o=0;for(;e!==da;){if(HI(e)){Vu(e.left,!1),Vu(e.right,!1),e=e.parent;continue}if(e.left!==da&&!HI(e.left)){e=e.left;continue}if(e.ownerId===i&&(t[o++]=e),Vu(e,!0),e.right!==da&&!HI(e.right)){e=e.right;continue}}return Vu(a.root,!1),t}function DAo(a){let i=a.root,e=[],t=0;for(;i!==da;){if(HI(i)){Vu(i.left,!1),Vu(i.right,!1),i=i.parent;continue}if(i.left!==da&&!HI(i.left)){i=i.left;continue}if(i.right!==da&&!HI(i.right)){i=i.right;continue}e[t++]=i,Vu(i,!0)}return Vu(a.root,!1),e}function Gqi(a,i,e,t,o,n){let r=a.root,s=0,l=0,c=0,u=[],p=0;for(;r!==da;){if(HI(r)){Vu(r.left,!1),Vu(r.right,!1),r===r.parent.right&&(s-=r.parent.delta),r=r.parent;continue}if(r.left!==da&&!HI(r.left)){r=r.left;continue}l=s+r.start,c=s+r.end,r.setCachedOffsets(l,c,o);let h=!0;if(i&&r.ownerId&&r.ownerId!==i&&(h=!1),e&&jqi(r)&&(h=!1),t&&Yqi(r)&&(h=!1),n&&!Qqi(r)&&(h=!1),h&&(u[p++]=r),Vu(r,!0),r.right!==da&&!HI(r.right)){s+=r.delta,r=r.right;continue}}return Vu(a.root,!1),u}function LAo(a,i,e,t,o,n,r,s){let l=a.root,c=0,u=0,p=0,h=0,g=[],f=0;for(;l!==da;){if(HI(l)){Vu(l.left,!1),Vu(l.right,!1),l===l.parent.right&&(c-=l.parent.delta),l=l.parent;continue}if(!HI(l.left)){if(u=c+l.maxEnd,u<i){Vu(l,!0);continue}if(l.left!==da){l=l.left;continue}}if(p=c+l.start,p>e){Vu(l,!0);continue}if(h=c+l.end,h>=i){l.setCachedOffsets(p,h,r);let v=!0;t&&l.ownerId&&l.ownerId!==t&&(v=!1),o&&jqi(l)&&(v=!1),n&&Yqi(l)&&(v=!1),s&&!Qqi(l)&&(v=!1),v&&(g[f++]=l)}if(Vu(l,!0),l.right!==da&&!HI(l.right)){c+=l.delta,l=l.right;continue}}return Vu(a.root,!1),g}function $qi(a,i){if(a.root===da)return i.parent=da,i.left=da,i.right=da,Xu(i,0),a.root=i,a.root;RAo(a,i),D9(i.parent);let e=i;for(;e!==a.root&&oE(e.parent)===1;)if(e.parent===e.parent.parent.left){let t=e.parent.parent.right;oE(t)===1?(Xu(e.parent,0),Xu(t,0),Xu(e.parent.parent,1),e=e.parent.parent):(e===e.parent.right&&(e=e.parent,mqe(a,e)),Xu(e.parent,0),Xu(e.parent.parent,1),hqe(a,e.parent.parent))}else{let t=e.parent.parent.left;oE(t)===1?(Xu(e.parent,0),Xu(t,0),Xu(e.parent.parent,1),e=e.parent.parent):(e===e.parent.left&&(e=e.parent,hqe(a,e)),Xu(e.parent,0),Xu(e.parent.parent,1),mqe(a,e.parent.parent))}return Xu(a.root,0),i}function RAo(a,i){let e=0,t=a.root,o=i.start,n=i.end;for(;;)if(PAo(o,n,t.start+e,t.end+e)<0)if(t.left===da){i.start-=e,i.end-=e,i.maxEnd-=e,t.left=i;break}else t=t.left;else if(t.right===da){i.start-=e+t.delta,i.end-=e+t.delta,i.maxEnd-=e+t.delta,t.right=i;break}else e+=t.delta,t=t.right;i.parent=t,i.left=da,i.right=da,Xu(i,1)}function qqi(a,i){let e,t;if(i.left===da?(e=i.right,t=i,e.delta+=i.delta,(e.delta<-1073741824||e.delta>1073741824)&&(a.requestNormalizeDelta=!0),e.start+=i.delta,e.end+=i.delta):i.right===da?(e=i.left,t=i):(t=MAo(i.right),e=t.right,e.start+=t.delta,e.end+=t.delta,e.delta+=t.delta,(e.delta<-1073741824||e.delta>1073741824)&&(a.requestNormalizeDelta=!0),t.start+=i.delta,t.end+=i.delta,t.delta=i.delta,(t.delta<-1073741824||t.delta>1073741824)&&(a.requestNormalizeDelta=!0)),t===a.root){a.root=e,Xu(e,0),i.detach(),IZt(),nq(e),a.root.parent=da;return}let o=oE(t)===1;if(t===t.parent.left?t.parent.left=e:t.parent.right=e,t===i?e.parent=t.parent:(t.parent===i?e.parent=t:e.parent=t.parent,t.left=i.left,t.right=i.right,t.parent=i.parent,Xu(t,oE(i)),i===a.root?a.root=t:i===i.parent.left?i.parent.left=t:i.parent.right=t,t.left!==da&&(t.left.parent=t),t.right!==da&&(t.right.parent=t)),i.detach(),o){D9(e.parent),t!==i&&(D9(t),D9(t.parent)),IZt();return}D9(e),D9(e.parent),t!==i&&(D9(t),D9(t.parent));let n;for(;e!==a.root&&oE(e)===0;)e===e.parent.left?(n=e.parent.right,oE(n)===1&&(Xu(n,0),Xu(e.parent,1),mqe(a,e.parent),n=e.parent.right),oE(n.left)===0&&oE(n.right)===0?(Xu(n,1),e=e.parent):(oE(n.right)===0&&(Xu(n.left,0),Xu(n,1),hqe(a,n),n=e.parent.right),Xu(n,oE(e.parent)),Xu(e.parent,0),Xu(n.right,0),mqe(a,e.parent),e=a.root)):(n=e.parent.left,oE(n)===1&&(Xu(n,0),Xu(e.parent,1),hqe(a,e.parent),n=e.parent.left),oE(n.left)===0&&oE(n.right)===0?(Xu(n,1),e=e.parent):(oE(n.left)===0&&(Xu(n.right,0),Xu(n,1),mqe(a,n),n=e.parent.left),Xu(n,oE(e.parent)),Xu(e.parent,0),Xu(n.left,0),hqe(a,e.parent),e=a.root));Xu(e,0),IZt()}function MAo(a){for(;a.left!==da;)a=a.left;return a}function IZt(){da.parent=da,da.delta=0,da.start=0,da.end=0}function mqe(a,i){let e=i.right;e.delta+=i.delta,(e.delta<-1073741824||e.delta>1073741824)&&(a.requestNormalizeDelta=!0),e.start+=i.delta,e.end+=i.delta,i.right=e.left,e.left!==da&&(e.left.parent=i),e.parent=i.parent,i.parent===da?a.root=e:i===i.parent.left?i.parent.left=e:i.parent.right=e,e.left=i,i.parent=e,nq(i),nq(e)}function hqe(a,i){let e=i.left;i.delta-=e.delta,(i.delta<-1073741824||i.delta>1073741824)&&(a.requestNormalizeDelta=!0),i.start-=e.delta,i.end-=e.delta,i.left=e.right,e.right!==da&&(e.right.parent=i),e.parent=i.parent,i.parent===da?a.root=e:i===i.parent.right?i.parent.right=e:i.parent.left=e,e.right=i,i.parent=e,nq(i),nq(e)}function Xqi(a){let i=a.end;if(a.left!==da){let e=a.left.maxEnd;e>i&&(i=e)}if(a.right!==da){let e=a.right.maxEnd+a.delta;e>i&&(i=e)}return i}function nq(a){a.maxEnd=Xqi(a)}function D9(a){for(;a!==da;){let i=Xqi(a);if(a.maxEnd===i)return;a.maxEnd=i,a=a.parent}}function PAo(a,i,e,t){return a===e?i-t:a-e}var Cl=ae("undoRedoService");var gqe=class{constructor(i,e){this.resource=i;this.elements=e}},R9=class a{static{this._ID=0}constructor(){this.id=a._ID++,this.order=1}nextOrder(){return this.id===0?0:this.order++}static{this.None=new a}},$U=class a{static{this._ID=0}constructor(){this.id=a._ID++,this.order=1}nextOrder(){return this.id===0?0:this.order++}static{this.None=new a}};function OS(a){let i=0,e=0,t=0,o=0;for(let n=0,r=a.length;n<r;n++){let s=a.charCodeAt(n);s===13?(i===0&&(e=n),i++,n+1<r&&a.charCodeAt(n+1)===10?(o|=2,n++):o|=3,t=n+1):s===10&&(o|=1,i===0&&(e=n),i++,t=n+1)}return i===0&&(e=a.length),[i,e,a.length-t,o]}var rq=class a{constructor(i){this.replacements=i;Ey(Ty(i,(e,t)=>e.lineRange.endLineNumberExclusive<=t.lineRange.startLineNumber))}static{this.empty=new a([])}static deserialize(i){return new a(i.map(e=>qU.deserialize(e)))}static fromStringEdit(i,e){let t=bp.fromStringEdit(i,e);return a.fromTextEdit(t,e)}static fromTextEdit(i,e){let t=i.replacements,o=[],n=[];for(let r=0;r<t.length;r++){let s=t[r],l=r+1<t.length?t[r+1]:void 0;if(n.push(s),l&&l.range.startLineNumber===s.range.endLineNumber)continue;let c=Xr.joinReplacements(n,e);n.length=0;let u=qU.fromSingleTextEdit(c,e);o.push(u)}return new a(o)}static createFromUnsorted(i){let e=i.slice();return e.sort(tl(t=>t.lineRange.startLineNumber,qd)),new a(e)}isEmpty(){return this.replacements.length===0}toEdit(i){let e=[];for(let t of this.replacements){let o=t.toSingleEdit(i);e.push(o)}return new Qc(e)}toString(){return this.replacements.map(i=>i.toString()).join(",")}serialize(){return this.replacements.map(i=>i.serialize())}getNewLineRanges(){let i=[],e=0;for(let t of this.replacements)i.push(ro.ofLength(t.lineRange.startLineNumber+e,t.newLines.length)),e+=t.newLines.length-t.lineRange.length;return i}mapLineNumber(i){let e=0;for(let t of this.replacements){if(t.lineRange.endLineNumberExclusive>i)break;e+=t.newLines.length-t.lineRange.length}return i+e}mapLineRange(i){return new ro(this.mapLineNumber(i.startLineNumber),this.mapLineNumber(i.endLineNumberExclusive))}mapBackLineRange(i,e){return this.inverse(e).mapLineRange(i)}touches(i){return this.replacements.some(e=>i.replacements.some(t=>e.lineRange.intersect(t.lineRange)))}rebase(i){return new a(this.replacements.map(e=>new qU(i.mapLineRange(e.lineRange),e.newLines)))}humanReadablePatch(i){let e=[];function t(s,l,c,u){let p=c==="unmodified"?" ":c==="deleted"?"-":"+";u===void 0&&(u="[[[[[ WARNING: LINE DOES NOT EXIST ]]]]]");let h=s===-1?" ":s.toString().padStart(3," "),g=l===-1?" ":l.toString().padStart(3," ");e.push(`${p} ${h} ${g} ${u}`)}function o(){e.push("---")}let n=0,r=!0;for(let s of s6(this.replacements,(l,c)=>l.lineRange.distanceToRange(c.lineRange)<=5)){r?r=!1:o();let l=s[0].lineRange.startLineNumber-2;for(let c of s){for(let h=Math.max(1,l);h<c.lineRange.startLineNumber;h++)t(h,h+n,"unmodified",i[h-1]);let u=c.lineRange,p=c.newLines;for(let h of u.mapToLineArray(g=>g)){let g=i[h-1];t(h,-1,"deleted",g)}for(let h=0;h<p.length;h++){let g=p[h];t(-1,u.startLineNumber+n+h,"added",g)}l=u.endLineNumberExclusive,n+=c.newLines.length-c.lineRange.length}for(let c=l;c<=Math.min(l+2,i.length);c++)t(c,c+n,"unmodified",i[c-1])}return e.join(`
`)}apply(i){let e=[],t=0;for(let o of this.replacements){for(;t<o.lineRange.startLineNumber-1;)e.push(i[t]),t++;for(let n of o.newLines)e.push(n);t=o.lineRange.endLineNumberExclusive-1}for(;t<i.length;)e.push(i[t]),t++;return e}inverse(i){let e=this.getNewLineRanges();return new a(this.replacements.map((t,o)=>new qU(e[o],i.slice(t.lineRange.startLineNumber-1,t.lineRange.endLineNumberExclusive-1))))}},qU=class a{constructor(i,e){this.lineRange=i;this.newLines=e}static deserialize(i){return new a(ro.ofLength(i[0],i[1]-i[0]),i[2])}static fromSingleTextEdit(i,e){let t=mc(i.text),o=i.range.startLineNumber,n=e.getValueOfRange(z.fromPositions(new Ie(i.range.startLineNumber,1),i.range.getStartPosition()));t[0]=n+t[0];let r=i.range.endLineNumber+1,s=e.getTransformer().getLineLength(i.range.endLineNumber)+1,l=e.getValueOfRange(z.fromPositions(i.range.getEndPosition(),new Ie(i.range.endLineNumber,s)));t[t.length-1]=t[t.length-1]+l;let c=i.range.startColumn===e.getTransformer().getLineLength(i.range.startLineNumber)+1,u=i.range.endColumn===1;return c&&t[0].length===n.length&&(o++,t.shift()),t.length>0&&o<r&&u&&t[t.length-1].length===l.length&&(r--,t.pop()),new a(new ro(o,r),t)}toSingleTextEdit(i){if(this.newLines.length===0){let e=i.getTransformer().textLength;if(this.lineRange.endLineNumberExclusive===e.lineCount+2){let t;if(this.lineRange.startLineNumber>1){let n=this.lineRange.startLineNumber-1,r=i.getTransformer().getLineLength(n)+1;t=new Ie(n,r)}else t=new Ie(1,1);let o=e.addToPosition(new Ie(1,1));return new Xr(z.fromPositions(t,o),"")}else return new Xr(new z(this.lineRange.startLineNumber,1,this.lineRange.endLineNumberExclusive,1),"")}else if(this.lineRange.isEmpty){let e,t,o,n=this.lineRange.startLineNumber;return n===i.getTransformer().textLength.lineCount+2?(e=n-1,t=i.getTransformer().getLineLength(e)+1,o=this.newLines.map(r=>`
`+r).join("")):(e=n,t=1,o=this.newLines.map(r=>r+`
`).join("")),new Xr(z.fromPositions(new Ie(e,t)),o)}else{let e=this.lineRange.endLineNumberExclusive-1,t=i.getTransformer().getLineLength(e)+1,o=new z(this.lineRange.startLineNumber,1,e,t),n=this.newLines.join(`
`);return new Xr(o,n)}}toSingleEdit(i){let e=this.toSingleTextEdit(i),t=i.getTransformer().getOffsetRange(e.range);return new Hc(t,e.text)}toString(){return`${this.lineRange}->${JSON.stringify(this.newLines)}`}serialize(){return[this.lineRange.startLineNumber,this.lineRange.endLineNumberExclusive,this.newLines]}removeCommonSuffixPrefixLines(i){let e=this.lineRange.startLineNumber,t=this.lineRange.endLineNumberExclusive,o=0;for(;e<t&&o<this.newLines.length&&this.newLines[o]===i.getLineAt(e);)e++,o++;let n=0;for(;e<t&&n+o<this.newLines.length&&this.newLines[this.newLines.length-1-n]===i.getLineAt(t-1);)t--,n++;return o===0&&n===0?this:new a(new ro(e,t),this.newLines.slice(o,this.newLines.length-n))}toLineEdit(){return new rq([this])}},AAo;(i=>{function a(e){return Array.isArray(e)&&e.length===3&&typeof e[0]=="number"&&typeof e[1]=="number"&&Array.isArray(e[2])&&e[2].every(t=>typeof t=="string")}i.is=a})(AAo||={});var NAo=Symbol("TextModelEditSource"),fqe=class{constructor(i,e){this.metadata=i}toString(){return`${this.metadata.source}`}getType(){let i=this.metadata;switch(i.source){case"cursor":return i.kind;case"inlineCompletionAccept":return i.source+(i.$nes?":nes":"");case"unknown":return i.name||"unknown";default:return i.source}}toKey(i,e={}){let t=this.metadata;return Object.entries(t).filter(([n,r])=>{let s=e[n];return s!==void 0?s:(n.match(/\$/g)||[]).length<=i&&r!==void 0&&r!==null&&r!==""}).map(([n,r])=>`${n}:${r}`).join("-")}get props(){return this.metadata}};function nE(a){return new fqe(a,NAo)}function Zqi(a){switch(a.metadata.source){case"inlineCompletionAccept":case"inlineCompletionPartialAccept":case"inlineChat.applyEdits":case"Chat.applyEdits":return!0}return!1}function eji(a){return a.metadata.source==="cursor"?a.metadata.kind==="type":!1}var _c={unknown(a){return nE({source:"unknown",name:a.name})},rename:(a,i)=>nE({source:"rename",$$$oldName:a,$$$newName:i}),chatApplyEdits(a){return nE({source:"Chat.applyEdits",$modelId:Jqi(a.modelId),$extensionId:a.extensionId?.extensionId,$extensionVersion:a.extensionId?.version,$$languageId:a.languageId,$$sessionId:a.sessionId,$$requestId:a.requestId,$$mode:a.mode,$$codeBlockSuggestionId:a.codeBlockSuggestionId})},chatUndoEdits:()=>nE({source:"Chat.undoEdits"}),chatReset:()=>nE({source:"Chat.reset"}),inlineCompletionAccept(a){return nE({source:"inlineCompletionAccept",$nes:a.nes,...Lvt(a.providerId),$$correlationId:a.correlationId,$$requestUuid:a.requestUuid,$$languageId:a.languageId})},inlineCompletionPartialAccept(a){return nE({source:"inlineCompletionPartialAccept",type:a.type,$nes:a.nes,...Lvt(a.providerId),$$correlationId:a.correlationId,$$requestUuid:a.requestUuid,$$languageId:a.languageId})},inlineChatApplyEdit(a){return nE({source:"inlineChat.applyEdits",$modelId:Jqi(a.modelId),$extensionId:a.extensionId?.extensionId,$extensionVersion:a.extensionId?.version,$$sessionId:a.sessionId,$$requestId:a.requestId,$$languageId:a.languageId})},reloadFromDisk:()=>nE({source:"reloadFromDisk"}),cursor(a){return nE({source:"cursor",kind:a.kind,detailedSource:a.detailedSource})},setValue:()=>nE({source:"setValue"}),eolChange:()=>nE({source:"eolChange"}),applyEdits:()=>nE({source:"applyEdits"}),snippet:()=>nE({source:"snippet"}),suggest:a=>nE({source:"suggest",...Lvt(a.providerId)}),codeAction:a=>nE({source:"codeAction",$kind:a.kind,...Lvt(a.providerId)})};function Lvt(a){return a?{$extensionId:a.extensionId,$extensionVersion:a.extensionVersion,$providerId:a.providerId}:{}}function Jqi(a){if(a!==void 0)return a.replaceAll("/","|")}var zy=class a{constructor(i,e,t,o){this.linesAdded=i;this.linesRemoved=e;this.charsAdded=t;this.charsRemoved=o}static fromText(i){let e=Zl.ofText(i).lineCount,t=i.length;return new a(e,0,t,0)}static fromEdit(i,e){let t=rq.fromStringEdit(i,e),o=ky(t.replacements,l=>l.newLines.length),n=ky(t.replacements,l=>l.lineRange.length),r=ky(i.replacements,l=>l.getNewLength()),s=ky(i.replacements,l=>l.replaceRange.length);return new a(o,n,r,s)}static tryCreate(i,e,t,o){if(!(i===void 0||e===void 0||t===void 0||o===void 0))return new a(i,e,t,o)}},yZt;(i=>{function a(e){let t=e?e("sgt"):zgt("sgt");return t}i.newId=a})(yZt||={});var vqe=class{constructor(i,e,t,o){this.range=i;this.nestingLevel=e;this.nestingLevelOfEqualBracketType=t;this.isInvalid=o}},wZt=class{constructor(i,e,t,o,n,r){this.range=i;this.openingBracketRange=e;this.closingBracketRange=t;this.nestingLevel=o;this.nestingLevelOfEqualBracketType=n;this.bracketPairNode=r}get openingBracketInfo(){return this.bracketPairNode.openingBracket.bracketInfo}get closingBracketInfo(){return this.bracketPairNode.closingBracket?.bracketInfo}},Rvt=class extends wZt{constructor(e,t,o,n,r,s,l){super(e,t,o,n,r,s);this.minVisibleColumnIndentation=l}};function tji(a,i,e,t){return a!==e?vm(e-a,t):vm(0,t-i)}var ib=0;function aye(a){return a===0}var vL=2**26;function vm(a,i){return a*vL+i}function yx(a){let i=a,e=Math.floor(i/vL),t=i-e*vL;return new Zl(e,t)}function iji(a){return Math.floor(a/vL)}function Od(a,i){let e=a+i;return i>=vL&&(e=e-a%vL),e}function oji(a,i){return a.reduce((e,t)=>Od(e,i(t)),ib)}function CZt(a,i){return a===i}function sae(a,i){let e=a,t=i;if(t-e<=0)return ib;let n=Math.floor(e/vL),r=Math.floor(t/vL),s=t-r*vL;if(n===r){let l=e-n*vL;return vm(0,s-l)}else return vm(r-n,s)}function sq(a,i){return a<i}function M9(a,i){return a<=i}function lye(a,i){return a>=i}function P9(a){return vm(a.lineNumber-1,a.column-1)}function A9(a,i){let e=a,t=Math.floor(e/vL),o=e-t*vL,n=i,r=Math.floor(n/vL),s=n-r*vL;return new z(t+1,o+1,r+1,s+1)}function nji(a){let i=mc(a);return vm(i.length-1,i[i.length-1].length)}var Mvt=[],Ky=class a{constructor(i,e){this.items=i;this.additionalItems=e}static{this.cache=new Array(129)}static create(i,e){if(i<=128&&e.length===0){let t=a.cache[i];return t||(t=new a(i,e),a.cache[i]=t),t}return new a(i,e)}static{this.empty=a.create(0,Mvt)}static getEmpty(){return this.empty}add(i,e){let t=e.getKey(i),o=t>>5;if(o===0){let r=1<<t|this.items;return r===this.items?this:a.create(r,this.additionalItems)}o--;let n=this.additionalItems.slice(0);for(;n.length<o;)n.push(0);return n[o]|=1<<(t&31),a.create(this.items,n)}has(i,e){let t=e.getKey(i),o=t>>5;return o===0?(this.items&1<<t)!==0:(o--,((this.additionalItems[o]||0)&1<<(t&31))!==0)}merge(i){let e=this.items|i.items;if(this.additionalItems===Mvt&&i.additionalItems===Mvt)return e===this.items?this:e===i.items?i:a.create(e,Mvt);let t=[];for(let o=0;o<Math.max(this.additionalItems.length,i.additionalItems.length);o++){let n=this.additionalItems[o]||0,r=i.additionalItems[o]||0;t.push(n|r)}return a.create(e,t)}intersects(i){if((this.items&i.items)!==0)return!0;for(let e=0;e<Math.min(this.additionalItems.length,i.additionalItems.length);e++)if((this.additionalItems[e]&i.additionalItems[e])!==0)return!0;return!1}equals(i){if(this.items!==i.items||this.additionalItems.length!==i.additionalItems.length)return!1;for(let e=0;e<this.additionalItems.length;e++)if(this.additionalItems[e]!==i.additionalItems[e])return!1;return!0}},xZt={getKey(a){return a}},cye=class{constructor(){this.items=new Map}getKey(i){let e=this.items.get(i);return e===void 0&&(e=this.items.size,this.items.set(i,e)),e}reverseLookup(i){return[...this.items].find(([e,t])=>t===i)?.[0]}reverseLookupSet(i){let e=[];for(let[t]of this.items)i.has(t,this)&&e.push(t);return e}keys(){return this.items.keys()}};var bqe=class{get length(){return this._length}constructor(i){this._length=i}},Sqe=class a extends bqe{constructor(e,t,o,n,r){super(e);this.openingBracket=t;this.child=o;this.closingBracket=n;this.missingOpeningBracketIds=r}static create(e,t,o){let n=e.length;return t&&(n=Od(n,t.length)),o&&(n=Od(n,o.length)),new a(n,e,t,o,t?t.missingOpeningBracketIds:Ky.getEmpty())}get kind(){return 2}get listHeight(){return 0}get childrenLength(){return 3}getChild(e){switch(e){case 0:return this.openingBracket;case 1:return this.child;case 2:return this.closingBracket}throw new Error("Invalid child index")}get children(){let e=[];return e.push(this.openingBracket),this.child&&e.push(this.child),this.closingBracket&&e.push(this.closingBracket),e}canBeReused(e){return!(this.closingBracket===null||e.intersects(this.missingOpeningBracketIds))}flattenLists(){return a.create(this.openingBracket.flattenLists(),this.child&&this.child.flattenLists(),this.closingBracket&&this.closingBracket.flattenLists())}deepClone(){return new a(this.length,this.openingBracket.deepClone(),this.child&&this.child.deepClone(),this.closingBracket&&this.closingBracket.deepClone(),this.missingOpeningBracketIds)}computeMinIndentation(e,t){return this.child?this.child.computeMinIndentation(Od(e,this.openingBracket.length),t):Number.MAX_SAFE_INTEGER}},bL=class a extends bqe{constructor(e,t,o){super(e);this.listHeight=t;this._missingOpeningBracketIds=o;this.cachedMinIndentation=-1}static create23(e,t,o,n=!1){let r=e.length,s=e.missingOpeningBracketIds;if(e.listHeight!==t.listHeight)throw new Error("Invalid list heights");if(r=Od(r,t.length),s=s.merge(t.missingOpeningBracketIds),o){if(e.listHeight!==o.listHeight)throw new Error("Invalid list heights");r=Od(r,o.length),s=s.merge(o.missingOpeningBracketIds)}return n?new kZt(r,e.listHeight+1,e,t,o,s):new Iqe(r,e.listHeight+1,e,t,o,s)}static create(e,t=!1){if(e.length===0)return this.getEmpty();{let o=e[0].length,n=e[0].missingOpeningBracketIds;for(let r=1;r<e.length;r++)o=Od(o,e[r].length),n=n.merge(e[r].missingOpeningBracketIds);return t?new Pvt(o,e[0].listHeight+1,e,n):new yqe(o,e[0].listHeight+1,e,n)}}static getEmpty(){return new Pvt(ib,0,[],Ky.getEmpty())}get kind(){return 4}get missingOpeningBracketIds(){return this._missingOpeningBracketIds}throwIfImmutable(){}makeLastElementMutable(){this.throwIfImmutable();let e=this.childrenLength;if(e===0)return;let t=this.getChild(e-1),o=t.kind===4?t.toMutable():t;return t!==o&&this.setChild(e-1,o),o}makeFirstElementMutable(){if(this.throwIfImmutable(),this.childrenLength===0)return;let t=this.getChild(0),o=t.kind===4?t.toMutable():t;return t!==o&&this.setChild(0,o),o}canBeReused(e){if(e.intersects(this.missingOpeningBracketIds)||this.childrenLength===0)return!1;let t=this;for(;t.kind===4;){let o=t.childrenLength;if(o===0)throw new ni;t=t.getChild(o-1)}return t.canBeReused(e)}handleChildrenChanged(){this.throwIfImmutable();let e=this.childrenLength,t=this.getChild(0).length,o=this.getChild(0).missingOpeningBracketIds;for(let n=1;n<e;n++){let r=this.getChild(n);t=Od(t,r.length),o=o.merge(r.missingOpeningBracketIds)}this._length=t,this._missingOpeningBracketIds=o,this.cachedMinIndentation=-1}flattenLists(){let e=[];for(let t of this.children){let o=t.flattenLists();o.kind===4?e.push(...o.children):e.push(o)}return a.create(e)}computeMinIndentation(e,t){if(this.cachedMinIndentation!==-1)return this.cachedMinIndentation;let o=Number.MAX_SAFE_INTEGER,n=e;for(let r=0;r<this.childrenLength;r++){let s=this.getChild(r);s&&(o=Math.min(o,s.computeMinIndentation(n,t)),n=Od(n,s.length))}return this.cachedMinIndentation=o,o}},Iqe=class a extends bL{constructor(e,t,o,n,r,s){super(e,t,s);this._item1=o;this._item2=n;this._item3=r}get childrenLength(){return this._item3!==null?3:2}getChild(e){switch(e){case 0:return this._item1;case 1:return this._item2;case 2:return this._item3}throw new Error("Invalid child index")}setChild(e,t){switch(e){case 0:this._item1=t;return;case 1:this._item2=t;return;case 2:this._item3=t;return}throw new Error("Invalid child index")}get children(){return this._item3?[this._item1,this._item2,this._item3]:[this._item1,this._item2]}get item1(){return this._item1}get item2(){return this._item2}get item3(){return this._item3}deepClone(){return new a(this.length,this.listHeight,this._item1.deepClone(),this._item2.deepClone(),this._item3?this._item3.deepClone():null,this.missingOpeningBracketIds)}appendChildOfSameHeight(e){if(this._item3)throw new Error("Cannot append to a full (2,3) tree node");this.throwIfImmutable(),this._item3=e,this.handleChildrenChanged()}unappendChild(){if(!this._item3)throw new Error("Cannot remove from a non-full (2,3) tree node");this.throwIfImmutable();let e=this._item3;return this._item3=null,this.handleChildrenChanged(),e}prependChildOfSameHeight(e){if(this._item3)throw new Error("Cannot prepend to a full (2,3) tree node");this.throwIfImmutable(),this._item3=this._item2,this._item2=this._item1,this._item1=e,this.handleChildrenChanged()}unprependChild(){if(!this._item3)throw new Error("Cannot remove from a non-full (2,3) tree node");this.throwIfImmutable();let e=this._item1;return this._item1=this._item2,this._item2=this._item3,this._item3=null,this.handleChildrenChanged(),e}toMutable(){return this}},kZt=class extends Iqe{toMutable(){return new Iqe(this.length,this.listHeight,this.item1,this.item2,this.item3,this.missingOpeningBracketIds)}throwIfImmutable(){throw new Error("this instance is immutable")}},yqe=class a extends bL{constructor(e,t,o,n){super(e,t,n);this._children=o}get childrenLength(){return this._children.length}getChild(e){return this._children[e]}setChild(e,t){this._children[e]=t}get children(){return this._children}deepClone(){let e=new Array(this._children.length);for(let t=0;t<this._children.length;t++)e[t]=this._children[t].deepClone();return new a(this.length,this.listHeight,e,this.missingOpeningBracketIds)}appendChildOfSameHeight(e){this.throwIfImmutable(),this._children.push(e),this.handleChildrenChanged()}unappendChild(){this.throwIfImmutable();let e=this._children.pop();return this.handleChildrenChanged(),e}prependChildOfSameHeight(e){this.throwIfImmutable(),this._children.unshift(e),this.handleChildrenChanged()}unprependChild(){this.throwIfImmutable();let e=this._children.shift();return this.handleChildrenChanged(),e}toMutable(){return this}},Pvt=class extends yqe{toMutable(){return new yqe(this.length,this.listHeight,[...this.children],this.missingOpeningBracketIds)}throwIfImmutable(){throw new Error("this instance is immutable")}},OAo=[],wqe=class extends bqe{get listHeight(){return 0}get childrenLength(){return 0}getChild(i){return null}get children(){return OAo}flattenLists(){return this}deepClone(){return this}},gW=class extends wqe{get kind(){return 0}get missingOpeningBracketIds(){return Ky.getEmpty()}canBeReused(i){return!0}computeMinIndentation(i,e){let t=yx(i),o=(t.columnCount===0?t.lineCount:t.lineCount+1)+1,n=iji(Od(i,this.length))+1,r=Number.MAX_SAFE_INTEGER;for(let s=o;s<=n;s++){let l=e.getLineFirstNonWhitespaceColumn(s),c=e.getLineContent(s);if(l===0)continue;let u=al.visibleColumnFromColumn(c,l,e.getOptions().tabSize);r=Math.min(r,u)}return r}},Cqe=class a extends wqe{constructor(e,t,o){super(e);this.bracketInfo=t;this.bracketIds=o}static create(e,t,o){return new a(e,t,o)}get kind(){return 1}get missingOpeningBracketIds(){return Ky.getEmpty()}get text(){return this.bracketInfo.bracketText}get languageId(){return this.bracketInfo.languageId}canBeReused(e){return!1}computeMinIndentation(e,t){return Number.MAX_SAFE_INTEGER}},Avt=class extends wqe{get kind(){return 3}constructor(i,e){super(e),this.missingOpeningBracketIds=i}canBeReused(i){return!i.intersects(this.missingOpeningBracketIds)}computeMinIndentation(i,e){return Number.MAX_SAFE_INTEGER}};var zN=class a{constructor(i,e,t){this.startOffset=i;this.endOffset=e;this.newLength=t}static fromModelContentChanges(i){return i.map(t=>{let o=z.lift(t.range);return new a(P9(o.getStartPosition()),P9(o.getEndPosition()),nji(t.text))}).reverse()}toString(){return`[${yx(this.startOffset)}...${yx(this.endOffset)}) -> ${yx(this.newLength)}`}},Nvt=class{constructor(i){this.nextEditIdx=0;this.deltaOldToNewLineCount=0;this.deltaOldToNewColumnCount=0;this.deltaLineIdxInOld=-1;this.edits=i.map(e=>EZt.from(e))}getOffsetBeforeChange(i){return this.adjustNextEdit(i),this.translateCurToOld(i)}getDistanceToNextChange(i){this.adjustNextEdit(i);let e=this.edits[this.nextEditIdx],t=e?this.translateOldToCur(e.offsetObj):null;return t===null?null:sae(i,t)}translateOldToCur(i){return i.lineCount===this.deltaLineIdxInOld?vm(i.lineCount+this.deltaOldToNewLineCount,i.columnCount+this.deltaOldToNewColumnCount):vm(i.lineCount+this.deltaOldToNewLineCount,i.columnCount)}translateCurToOld(i){let e=yx(i);return e.lineCount-this.deltaOldToNewLineCount===this.deltaLineIdxInOld?vm(e.lineCount-this.deltaOldToNewLineCount,e.columnCount-this.deltaOldToNewColumnCount):vm(e.lineCount-this.deltaOldToNewLineCount,e.columnCount)}adjustNextEdit(i){for(;this.nextEditIdx<this.edits.length;){let e=this.edits[this.nextEditIdx],t=this.translateOldToCur(e.endOffsetAfterObj);if(M9(t,i)){this.nextEditIdx++;let o=yx(t),n=yx(this.translateOldToCur(e.endOffsetBeforeObj)),r=o.lineCount-n.lineCount;this.deltaOldToNewLineCount+=r;let s=this.deltaLineIdxInOld===e.endOffsetBeforeObj.lineCount?this.deltaOldToNewColumnCount:0,l=o.columnCount-n.columnCount;this.deltaOldToNewColumnCount=s+l,this.deltaLineIdxInOld=e.endOffsetBeforeObj.lineCount}else break}}},EZt=class a{static from(i){return new a(i.startOffset,i.endOffset,i.newLength)}constructor(i,e,t){this.endOffsetBeforeObj=yx(e),this.endOffsetAfterObj=yx(Od(i,t)),this.offsetObj=yx(i)}};var fW=class{constructor(i,e,t,o,n){this.length=i;this.kind=e;this.bracketId=t;this.bracketIds=o;this.astNode=n}},dye=class{constructor(i,e){this.textModel=i;this.bracketTokens=e;this.reader=new TZt(this.textModel,this.bracketTokens),this._offset=ib,this.didPeek=!1,this.peeked=null,this.textBufferLineCount=i.getLineCount(),this.textBufferLastLineLength=i.getLineLength(this.textBufferLineCount)}get offset(){return this._offset}get length(){return vm(this.textBufferLineCount-1,this.textBufferLastLineLength)}getText(){return this.textModel.getValue()}skip(i){this.didPeek=!1,this._offset=Od(this._offset,i);let e=yx(this._offset);this.reader.setPosition(e.lineCount,e.columnCount)}read(){let i;return this.peeked?(this.didPeek=!1,i=this.peeked):i=this.reader.read(),i&&(this._offset=Od(this._offset,i.length)),i}peek(){return this.didPeek||(this.peeked=this.reader.read(),this.didPeek=!0),this.peeked}},TZt=class{constructor(i,e){this.textModel=i;this.bracketTokens=e;this.lineIdx=0;this.line=null;this.lineCharOffset=0;this.lineTokens=null;this.lineTokenOffset=0;this.peekedToken=null;this.textBufferLineCount=i.getLineCount(),this.textBufferLastLineLength=i.getLineLength(this.textBufferLineCount)}setPosition(i,e){i===this.lineIdx?(this.lineCharOffset=e,this.line!==null&&(this.lineTokenOffset=this.lineCharOffset===0?0:this.lineTokens.findTokenIndexAtOffset(this.lineCharOffset))):(this.lineIdx=i,this.lineCharOffset=e,this.line=null),this.peekedToken=null}read(){if(this.peekedToken){let n=this.peekedToken;return this.peekedToken=null,this.lineCharOffset+=n.length,n}if(this.lineIdx>this.textBufferLineCount-1||this.lineIdx===this.textBufferLineCount-1&&this.lineCharOffset>=this.textBufferLastLineLength)return null;this.line===null&&(this.lineTokens=this.textModel.tokenization.getLineTokens(this.lineIdx+1),this.line=this.lineTokens.getLineContent(),this.lineTokenOffset=this.lineCharOffset===0?0:this.lineTokens.findTokenIndexAtOffset(this.lineCharOffset));let i=this.lineIdx,e=this.lineCharOffset,t=0;for(;;){let n=this.lineTokens,r=n.getCount(),s=null;if(this.lineTokenOffset<r){let l=n.getMetadata(this.lineTokenOffset);for(;this.lineTokenOffset+1<r&&l===n.getMetadata(this.lineTokenOffset+1);)this.lineTokenOffset++;let c=Qu.getTokenType(l)===0,u=Qu.containsBalancedBrackets(l),p=n.getEndOffset(this.lineTokenOffset);if(u&&c&&this.lineCharOffset<p){let h=n.getLanguageId(this.lineTokenOffset),g=this.line.substring(this.lineCharOffset,p),f=this.bracketTokens.getSingleLanguageBracketTokens(h),v=f.regExpGlobal;if(v){v.lastIndex=0;let b=v.exec(g);b&&(s=f.getToken(b[0]),s&&(this.lineCharOffset+=b.index))}}if(t+=p-this.lineCharOffset,s)if(i!==this.lineIdx||e!==this.lineCharOffset){this.peekedToken=s;break}else return this.lineCharOffset+=s.length,s;else this.lineTokenOffset++,this.lineCharOffset=p}else if(this.lineIdx===this.textBufferLineCount-1||(this.lineIdx++,this.lineTokens=this.textModel.tokenization.getLineTokens(this.lineIdx+1),this.lineTokenOffset=0,this.line=this.lineTokens.getLineContent(),this.lineCharOffset=0,t+=33,t>1e3))break;if(t>1500)break}let o=tji(i,e,this.lineIdx,this.lineCharOffset);return new fW(o,0,-1,Ky.getEmpty(),new gW(o))}},Ovt=class{constructor(i,e){this.text=i;this._offset=ib;this.idx=0;let t=e.getRegExpStr(),o=t?new RegExp(t+`|
`,"gi"):null,n=[],r,s=0,l=0,c=0,u=0,p=[];for(let f=0;f<60;f++)p.push(new fW(vm(0,f),0,-1,Ky.getEmpty(),new gW(vm(0,f))));let h=[];for(let f=0;f<60;f++)h.push(new fW(vm(1,f),0,-1,Ky.getEmpty(),new gW(vm(1,f))));if(o)for(o.lastIndex=0;(r=o.exec(i))!==null;){let f=r.index,v=r[0];if(v===`
`)s++,l=f+1;else{if(c!==f){let b;if(u===s){let S=f-c;if(S<p.length)b=p[S];else{let y=vm(0,S);b=new fW(y,0,-1,Ky.getEmpty(),new gW(y))}}else{let S=s-u,y=f-l;if(S===1&&y<h.length)b=h[y];else{let w=vm(S,y);b=new fW(w,0,-1,Ky.getEmpty(),new gW(w))}}n.push(b)}n.push(e.getToken(v)),c=f+v.length,u=s}}let g=i.length;if(c!==g){let f=u===s?vm(0,g-c):vm(s-u,g-l);n.push(new fW(f,0,-1,Ky.getEmpty(),new gW(f)))}this.length=vm(s,g-l),this.tokens=n}get offset(){return this._offset}read(){return this.tokens[this.idx++]||null}peek(){return this.tokens[this.idx]||null}skip(i){throw new jG}getText(){return this.text}};var _Zt=class a{constructor(i){this.map=i;this.hasRegExp=!1;this._regExpGlobal=null}static createFromLanguage(i,e){function t(n){return e.getKey(`${n.languageId}:::${n.bracketText}`)}let o=new Map;for(let n of i.bracketsNew.openingBrackets){let r=vm(0,n.bracketText.length),s=t(n),l=Ky.getEmpty().add(s,xZt);o.set(n.bracketText,new fW(r,1,s,l,Cqe.create(r,n,l)))}for(let n of i.bracketsNew.closingBrackets){let r=vm(0,n.bracketText.length),s=Ky.getEmpty(),l=n.getOpeningBrackets();for(let c of l)s=s.add(t(c),xZt);o.set(n.bracketText,new fW(r,2,t(l[0]),s,Cqe.create(r,n,s)))}return new a(o)}getRegExpStr(){if(this.isEmpty)return null;{let i=[...this.map.keys()];return i.sort(),i.reverse(),i.map(e=>VAo(e)).join("|")}}get regExpGlobal(){if(!this.hasRegExp){let i=this.getRegExpStr();this._regExpGlobal=i?new RegExp(i,"gi"):null,this.hasRegExp=!0}return this._regExpGlobal}getToken(i){return this.map.get(i.toLowerCase())}findClosingTokenText(i){for(let[e,t]of this.map)if(t.kind===2&&t.bracketIds.intersects(i))return e}get isEmpty(){return this.map.size===0}};function VAo(a){let i=Yr(a);return/^[\w ]+/.test(a)&&(i=`\\b${i}`),/[\w ]+$/.test(a)&&(i=`${i}\\b`),i}var uye=class{constructor(i,e){this.denseKeyProvider=i;this.getLanguageConfiguration=e;this.languageIdToBracketTokens=new Map}didLanguageChange(i){return this.languageIdToBracketTokens.has(i)}getSingleLanguageBracketTokens(i){let e=this.languageIdToBracketTokens.get(i);return e||(e=_Zt.createFromLanguage(this.getLanguageConfiguration(i),this.denseKeyProvider),this.languageIdToBracketTokens.set(i,e)),e}getToken(i,e){return this.getSingleLanguageBracketTokens(e).getToken(i)}};function sji(a){if(a.length===0)return null;if(a.length===1)return a[0];let i=0;function e(){if(i>=a.length)return null;let r=i,s=a[r].listHeight;for(i++;i<a.length&&a[i].listHeight===s;)i++;return i-r>=2?RZt(r===0&&i===a.length?a:a.slice(r,i),!1):a[r]}let t=e(),o=e();if(!o)return t;for(let r=e();r;r=e())rji(t,o)<=rji(o,r)?(t=DZt(t,o),o=r):o=DZt(o,r);return DZt(t,o)}function RZt(a,i=!1){if(a.length===0)return null;if(a.length===1)return a[0];let e=a.length;for(;e>3;){let t=e>>1;for(let o=0;o<t;o++){let n=o<<1;a[o]=bL.create23(a[n],a[n+1],n+3===e?a[n+2]:null,i)}e=t}return bL.create23(a[0],a[1],e>=3?a[2]:null,i)}function rji(a,i){return Math.abs(a.listHeight-i.listHeight)}function DZt(a,i){return a.listHeight===i.listHeight?bL.create23(a,i,null,!1):a.listHeight>i.listHeight?BAo(a,i):HAo(i,a)}function BAo(a,i){a=a.toMutable();let e=a,t=[],o;for(;;){if(i.listHeight===e.listHeight){o=i;break}if(e.kind!==4)throw new Error("unexpected");t.push(e),e=e.makeLastElementMutable()}for(let n=t.length-1;n>=0;n--){let r=t[n];o?r.childrenLength>=3?o=bL.create23(r.unappendChild(),o,null,!1):(r.appendChildOfSameHeight(o),o=void 0):r.handleChildrenChanged()}return o?bL.create23(a,o,null,!1):a}function HAo(a,i){a=a.toMutable();let e=a,t=[];for(;i.listHeight!==e.listHeight;){if(e.kind!==4)throw new Error("unexpected");t.push(e),e=e.makeFirstElementMutable()}let o=i;for(let n=t.length-1;n>=0;n--){let r=t[n];o?r.childrenLength>=3?o=bL.create23(o,r.unprependChild(),null,!1):(r.prependChildOfSameHeight(o),o=void 0):r.handleChildrenChanged()}return o?bL.create23(o,a,null,!1):a}var Fvt=class{constructor(i){this.lastOffset=ib;this.nextNodes=[i],this.offsets=[ib],this.idxs=[]}readLongestNodeAt(i,e){if(sq(i,this.lastOffset))throw new Error("Invalid offset");for(this.lastOffset=i;;){let t=xqe(this.nextNodes);if(!t)return;let o=xqe(this.offsets);if(sq(i,o))return;if(sq(o,i))if(Od(o,t.length)<=i)this.nextNodeAfterCurrent();else{let n=MZt(t);n!==-1?(this.nextNodes.push(t.getChild(n)),this.offsets.push(o),this.idxs.push(n)):this.nextNodeAfterCurrent()}else{if(e(t))return this.nextNodeAfterCurrent(),t;{let n=MZt(t);if(n===-1){this.nextNodeAfterCurrent();return}else this.nextNodes.push(t.getChild(n)),this.offsets.push(o),this.idxs.push(n)}}}}nextNodeAfterCurrent(){for(;;){let i=xqe(this.offsets),e=xqe(this.nextNodes);if(this.nextNodes.pop(),this.offsets.pop(),this.idxs.length===0)break;let t=xqe(this.nextNodes),o=MZt(t,this.idxs[this.idxs.length-1]);if(o!==-1){this.nextNodes.push(t.getChild(o)),this.offsets.push(Od(i,e.length)),this.idxs[this.idxs.length-1]=o;break}else this.idxs.pop()}}};function MZt(a,i=-1){for(;;){if(i++,i>=a.childrenLength)return-1;if(a.getChild(i))return i}}function xqe(a){return a.length>0?a[a.length-1]:void 0}function kqe(a,i,e,t){return new PZt(a,i,e,t).parseDocument()}var PZt=class{constructor(i,e,t,o){this.tokenizer=i;this.createImmutableLists=o;this._itemsConstructed=0;this._itemsFromCache=0;if(t&&o)throw new Error("Not supported");this.oldNodeReader=t?new Fvt(t):void 0,this.positionMapper=new Nvt(e)}get nodesConstructed(){return this._itemsConstructed}get nodesReused(){return this._itemsFromCache}parseDocument(){this._itemsConstructed=0,this._itemsFromCache=0;let i=this.parseList(Ky.getEmpty(),0);return i||(i=bL.getEmpty()),i}parseList(i,e){let t=[];for(;;){let n=this.tryReadChildFromCache(i);if(!n){let r=this.tokenizer.peek();if(!r||r.kind===2&&r.bracketIds.intersects(i))break;n=this.parseChild(i,e+1)}n.kind===4&&n.childrenLength===0||t.push(n)}return this.oldNodeReader?sji(t):RZt(t,this.createImmutableLists)}tryReadChildFromCache(i){if(this.oldNodeReader){let e=this.positionMapper.getDistanceToNextChange(this.tokenizer.offset);if(e===null||!aye(e)){let t=this.oldNodeReader.readLongestNodeAt(this.positionMapper.getOffsetBeforeChange(this.tokenizer.offset),o=>e!==null&&!sq(o.length,e)?!1:o.canBeReused(i));if(t)return this._itemsFromCache++,this.tokenizer.skip(t.length),t}}}parseChild(i,e){this._itemsConstructed++;let t=this.tokenizer.read();switch(t.kind){case 2:return new Avt(t.bracketIds,t.length);case 0:return t.astNode;case 1:{if(e>300)return new gW(t.length);let o=i.merge(t.bracketIds),n=this.parseList(o,e+1),r=this.tokenizer.peek();return r&&r.kind===2&&(r.bracketId===t.bracketId||r.bracketIds.intersects(t.bracketIds))?(this.tokenizer.read(),Sqe.create(t.astNode,n,r.astNode)):Sqe.create(t.astNode,n,null)}default:throw new Error("unexpected")}}};function pye(a,i){if(a.length===0)return i;if(i.length===0)return a;let e=new bS(aji(a)),t=aji(i);t.push({modified:!1,lengthBefore:void 0,lengthAfter:void 0});let o=e.dequeue();function n(c){if(c===void 0){let p=e.takeWhile(h=>!0)||[];return o&&p.unshift(o),p}let u=[];for(;o&&!aye(c);){let[p,h]=o.splitAt(c);u.push(p),c=sae(p.lengthAfter,c),o=h??e.dequeue()}return aye(c)||u.push(new Eqe(!1,c,c)),u}let r=[];function s(c,u,p){if(r.length>0&&CZt(r[r.length-1].endOffset,c)){let h=r[r.length-1];r[r.length-1]=new zN(h.startOffset,u,Od(h.newLength,p))}else r.push({startOffset:c,endOffset:u,newLength:p})}let l=ib;for(let c of t){let u=n(c.lengthBefore);if(c.modified){let p=oji(u,g=>g.lengthBefore),h=Od(l,p);s(l,h,c.lengthAfter),l=h}else for(let p of u){let h=l;l=Od(l,p.lengthBefore),p.modified&&s(h,l,p.lengthAfter)}}return r}var Eqe=class a{constructor(i,e,t){this.modified=i;this.lengthBefore=e;this.lengthAfter=t}splitAt(i){let e=sae(i,this.lengthAfter);return CZt(e,ib)?[this,void 0]:this.modified?[new a(this.modified,this.lengthBefore,i),new a(this.modified,ib,e)]:[new a(this.modified,i,i),new a(this.modified,e,e)]}toString(){return`${this.modified?"M":"U"}:${yx(this.lengthBefore)} -> ${yx(this.lengthAfter)}`}};function aji(a){let i=[],e=ib;for(let t of a){let o=sae(e,t.startOffset);aye(o)||i.push(new Eqe(!1,o,o));let n=sae(t.startOffset,t.endOffset);i.push(new Eqe(!0,n,t.newLength)),e=t.endOffset}return i}var Wvt=class extends C{constructor(e,t){super();this.textModel=e;this.getLanguageConfiguration=t;if(this.didChangeEmitter=this._register(new E),this.denseKeyProvider=new cye,this.brackets=new uye(this.denseKeyProvider,this.getLanguageConfiguration),this.onDidChange=this.didChangeEmitter.event,this.queuedTextEditsForInitialAstWithoutTokens=[],this.queuedTextEdits=[],e.tokenization.hasTokens)e.tokenization.backgroundTokenizationState===2?(this.initialAstWithoutTokens=void 0,this.astWithTokens=this.parseDocumentFromTextBuffer([],void 0,!1)):(this.initialAstWithoutTokens=this.parseDocumentFromTextBuffer([],void 0,!0),this.astWithTokens=this.initialAstWithoutTokens);else{let o=this.brackets.getSingleLanguageBracketTokens(this.textModel.getLanguageId()),n=new Ovt(this.textModel.getValue(),o);this.initialAstWithoutTokens=kqe(n,[],void 0,!0),this.astWithTokens=this.initialAstWithoutTokens}}didLanguageChange(e){return this.brackets.didLanguageChange(e)}handleDidChangeBackgroundTokenizationState(){if(this.textModel.tokenization.backgroundTokenizationState===2){let e=this.initialAstWithoutTokens===void 0;this.initialAstWithoutTokens=void 0,e||this.didChangeEmitter.fire()}}handleDidChangeTokens({ranges:e}){let t=e.map(o=>new zN(vm(o.fromLineNumber-1,0),vm(o.toLineNumber,0),vm(o.toLineNumber-o.fromLineNumber+1,0)));this.handleEdits(t,!0),this.initialAstWithoutTokens||this.didChangeEmitter.fire()}handleContentChanged(e){let t=zN.fromModelContentChanges(e.changes);this.handleEdits(t,!1)}handleEdits(e,t){let o=pye(this.queuedTextEdits,e);this.queuedTextEdits=o,this.initialAstWithoutTokens&&!t&&(this.queuedTextEditsForInitialAstWithoutTokens=pye(this.queuedTextEditsForInitialAstWithoutTokens,e))}flushQueue(){this.queuedTextEdits.length>0&&(this.astWithTokens=this.parseDocumentFromTextBuffer(this.queuedTextEdits,this.astWithTokens,!1),this.queuedTextEdits=[]),this.queuedTextEditsForInitialAstWithoutTokens.length>0&&(this.initialAstWithoutTokens&&(this.initialAstWithoutTokens=this.parseDocumentFromTextBuffer(this.queuedTextEditsForInitialAstWithoutTokens,this.initialAstWithoutTokens,!1)),this.queuedTextEditsForInitialAstWithoutTokens=[])}parseDocumentFromTextBuffer(e,t,o){let r=t,s=new dye(this.textModel,this.brackets);return kqe(s,e,r,o)}getBracketsInRange(e,t){this.flushQueue();let o=vm(e.startLineNumber-1,e.startColumn-1),n=vm(e.endLineNumber-1,e.endColumn-1);return new JG(r=>{let s=this.initialAstWithoutTokens||this.astWithTokens;AZt(s,ib,s.length,o,n,r,0,0,new Map,t)})}getBracketPairsInRange(e,t){this.flushQueue();let o=P9(e.getStartPosition()),n=P9(e.getEndPosition());return new JG(r=>{let s=this.initialAstWithoutTokens||this.astWithTokens,l=new NZt(r,t,this.textModel);OZt(s,ib,s.length,o,n,l,0,new Map)})}getFirstBracketAfter(e){this.flushQueue();let t=this.initialAstWithoutTokens||this.astWithTokens;return cji(t,ib,t.length,P9(e))}getFirstBracketBefore(e){this.flushQueue();let t=this.initialAstWithoutTokens||this.astWithTokens;return lji(t,ib,t.length,P9(e))}};function lji(a,i,e,t){if(a.kind===4||a.kind===2){let o=[];for(let n of a.children)e=Od(i,n.length),o.push({nodeOffsetStart:i,nodeOffsetEnd:e}),i=e;for(let n=o.length-1;n>=0;n--){let{nodeOffsetStart:r,nodeOffsetEnd:s}=o[n];if(sq(r,t)){let l=lji(a.children[n],r,s,t);if(l)return l}}return null}else{if(a.kind===3)return null;if(a.kind===1){let o=A9(i,e);return{bracketInfo:a.bracketInfo,range:o}}}return null}function cji(a,i,e,t){if(a.kind===4||a.kind===2){for(let o of a.children){if(e=Od(i,o.length),sq(t,e)){let n=cji(o,i,e,t);if(n)return n}i=e}return null}else{if(a.kind===3)return null;if(a.kind===1){let o=A9(i,e);return{bracketInfo:a.bracketInfo,range:o}}}return null}function AZt(a,i,e,t,o,n,r,s,l,c,u=!1){if(r>200)return!0;e:for(;;)switch(a.kind){case 4:{let p=a.childrenLength;for(let h=0;h<p;h++){let g=a.getChild(h);if(g){if(e=Od(i,g.length),M9(i,o)&&lye(e,t)){if(lye(e,o)){a=g;continue e}if(!AZt(g,i,e,t,o,n,r,0,l,c))return!1}i=e}}return!0}case 2:{let p=!c||!a.closingBracket||a.closingBracket.bracketInfo.closesColorized(a.openingBracket.bracketInfo),h=0;if(l){let f=l.get(a.openingBracket.text);f===void 0&&(f=0),h=f,p&&(f++,l.set(a.openingBracket.text,f))}let g=a.childrenLength;for(let f=0;f<g;f++){let v=a.getChild(f);if(v){if(e=Od(i,v.length),M9(i,o)&&lye(e,t)){if(lye(e,o)&&v.kind!==1){a=v,p?(r++,s=h+1):s=h;continue e}if((p||v.kind!==1||!a.closingBracket)&&!AZt(v,i,e,t,o,n,p?r+1:r,p?h+1:h,l,c,!a.closingBracket))return!1}i=e}}return l?.set(a.openingBracket.text,h),!0}case 3:{let p=A9(i,e);return n(new vqe(p,r-1,0,!0))}case 1:{let p=A9(i,e);return n(new vqe(p,r-1,s-1,u))}case 0:return!0}}var NZt=class{constructor(i,e,t){this.push=i;this.includeMinIndentation=e;this.textModel=t}};function OZt(a,i,e,t,o,n,r,s){if(r>200)return!0;let l=!0;if(a.kind===2){let c=0;if(s){let h=s.get(a.openingBracket.text);h===void 0&&(h=0),c=h,h++,s.set(a.openingBracket.text,h)}let u=Od(i,a.openingBracket.length),p=-1;if(n.includeMinIndentation&&(p=a.computeMinIndentation(i,n.textModel)),l=n.push(new Rvt(A9(i,e),A9(i,u),a.closingBracket?A9(Od(u,a.child?.length||ib),e):void 0,r,c,a,p)),i=u,l&&a.child){let h=a.child;if(e=Od(i,h.length),M9(i,o)&&lye(e,t)&&(l=OZt(h,i,e,t,o,n,r+1,s),!l))return!1}s?.set(a.openingBracket.text,c)}else{let c=i;for(let u of a.children){let p=c;if(c=Od(c,u.length),M9(p,o)&&M9(t,c)&&(l=OZt(u,p,c,t,o,n,r,s),!l))return!1}}return l}var Bvt=class extends C{constructor(e,t){super();this.textModel=e;this.languageConfigurationService=t;this.bracketPairsTree=this._register(new me);this.onDidChangeEmitter=this._register(new E);this.onDidChange=this.onDidChangeEmitter.event;this.bracketsRequested=!1}get canBuildAST(){return this.textModel.getValueLength()<=5e6}handleLanguageConfigurationServiceChange(e){(!e.languageId||this.bracketPairsTree.value?.object.didLanguageChange(e.languageId))&&(this.bracketPairsTree.clear(),this.updateBracketPairsTree())}handleDidChangeOptions(e){this.bracketPairsTree.clear(),this.updateBracketPairsTree()}handleDidChangeLanguage(e){this.bracketPairsTree.clear(),this.updateBracketPairsTree()}handleDidChangeContent(e){this.bracketPairsTree.value?.object.handleContentChanged(e)}handleDidChangeBackgroundTokenizationState(){this.bracketPairsTree.value?.object.handleDidChangeBackgroundTokenizationState()}handleDidChangeTokens(e){this.bracketPairsTree.value?.object.handleDidChangeTokens(e)}updateBracketPairsTree(){if(this.bracketsRequested&&this.canBuildAST){if(!this.bracketPairsTree.value){let e=new P;this.bracketPairsTree.value=UAo(e.add(new Wvt(this.textModel,t=>this.languageConfigurationService.getLanguageConfiguration(t))),e),e.add(this.bracketPairsTree.value.object.onDidChange(t=>this.onDidChangeEmitter.fire(t))),this.onDidChangeEmitter.fire()}}else this.bracketPairsTree.value&&(this.bracketPairsTree.clear(),this.onDidChangeEmitter.fire())}getBracketPairsInRange(e){return this.bracketsRequested=!0,this.updateBracketPairsTree(),this.bracketPairsTree.value?.object.getBracketPairsInRange(e,!1)||JG.empty}getBracketPairsInRangeWithMinIndentation(e){return this.bracketsRequested=!0,this.updateBracketPairsTree(),this.bracketPairsTree.value?.object.getBracketPairsInRange(e,!0)||JG.empty}getBracketsInRange(e,t=!1){return this.bracketsRequested=!0,this.updateBracketPairsTree(),this.bracketPairsTree.value?.object.getBracketsInRange(e,t)||JG.empty}findMatchingBracketUp(e,t,o){let n=this.textModel.validatePosition(t),r=this.textModel.getLanguageIdAtPosition(n.lineNumber,n.column);if(this.canBuildAST){let s=this.languageConfigurationService.getLanguageConfiguration(r).bracketsNew.getClosingBracketInfo(e);if(!s)return null;let l=this.getBracketPairsInRange(z.fromPositions(t,t)).findLast(c=>s.closes(c.openingBracketInfo));return l?l.openingBracketRange:null}else{let s=e.toLowerCase(),l=this.languageConfigurationService.getLanguageConfiguration(r).brackets;if(!l)return null;let c=l.textIsBracket[s];return c?Vvt(this._findMatchingBracketUp(c,n,WZt(o))):null}}matchBracket(e,t){if(this.canBuildAST){let o=this.getBracketPairsInRange(z.fromPositions(e,e)).filter(n=>n.closingBracketRange!==void 0&&(n.openingBracketRange.containsPosition(e)||n.closingBracketRange.containsPosition(e))).findLastMaxBy(tl(n=>n.openingBracketRange.containsPosition(e)?n.openingBracketRange:n.closingBracketRange,z.compareRangesUsingStarts));return o?[o.openingBracketRange,o.closingBracketRange]:null}else{let o=WZt(t);return this._matchBracket(this.textModel.validatePosition(e),o)}}_establishBracketSearchOffsets(e,t,o,n){let r=t.getCount(),s=t.getLanguageId(n),l=Math.max(0,e.column-1-o.maxBracketLength);for(let u=n-1;u>=0;u--){let p=t.getEndOffset(u);if(p<=l)break;if(IN(t.getStandardTokenType(u))||t.getLanguageId(u)!==s){l=p;break}}let c=Math.min(t.getLineContent().length,e.column-1+o.maxBracketLength);for(let u=n+1;u<r;u++){let p=t.getStartOffset(u);if(p>=c)break;if(IN(t.getStandardTokenType(u))||t.getLanguageId(u)!==s){c=p;break}}return{searchStartOffset:l,searchEndOffset:c}}_matchBracket(e,t){let o=e.lineNumber,n=this.textModel.tokenization.getLineTokens(o),r=this.textModel.getLineContent(o),s=n.findTokenIndexAtOffset(e.column-1);if(s<0)return null;let l=this.languageConfigurationService.getLanguageConfiguration(n.getLanguageId(s)).brackets;if(l&&!IN(n.getStandardTokenType(s))){let{searchStartOffset:c,searchEndOffset:u}=this._establishBracketSearchOffsets(e,n,l,s),p=null;for(;;){let h=jk.findNextBracketInRange(l.forwardRegex,o,r,c,u);if(!h)break;if(h.startColumn<=e.column&&e.column<=h.endColumn){let g=r.substring(h.startColumn-1,h.endColumn-1).toLowerCase(),f=this._matchFoundBracket(h,l.textIsBracket[g],l.textIsOpenBracket[g],t);if(f){if(f instanceof aq)return null;p=f}}c=h.endColumn-1}if(p)return p}if(s>0&&n.getStartOffset(s)===e.column-1){let c=s-1,u=this.languageConfigurationService.getLanguageConfiguration(n.getLanguageId(c)).brackets;if(u&&!IN(n.getStandardTokenType(c))){let{searchStartOffset:p,searchEndOffset:h}=this._establishBracketSearchOffsets(e,n,u,c),g=jk.findPrevBracketInRange(u.reversedRegex,o,r,p,h);if(g&&g.startColumn<=e.column&&e.column<=g.endColumn){let f=r.substring(g.startColumn-1,g.endColumn-1).toLowerCase(),v=this._matchFoundBracket(g,u.textIsBracket[f],u.textIsOpenBracket[f],t);if(v)return v instanceof aq?null:v}}}return null}_matchFoundBracket(e,t,o,n){if(!t)return null;let r=o?this._findMatchingBracketDown(t,e.getEndPosition(),n):this._findMatchingBracketUp(t,e.getStartPosition(),n);return r?r instanceof aq?r:[e,r]:null}_findMatchingBracketUp(e,t,o){let n=e.languageId,r=e.reversedRegex,s=-1,l=0,c=(u,p,h,g)=>{for(;;){if(o&&++l%100===0&&!o())return aq.INSTANCE;let f=jk.findPrevBracketInRange(r,u,p,h,g);if(!f)break;let v=p.substring(f.startColumn-1,f.endColumn-1).toLowerCase();if(e.isOpen(v)?s++:e.isClose(v)&&s--,s===0)return f;g=f.startColumn-1}return null};for(let u=t.lineNumber;u>=1;u--){let p=this.textModel.tokenization.getLineTokens(u),h=p.getCount(),g=this.textModel.getLineContent(u),f=h-1,v=g.length,b=g.length;u===t.lineNumber&&(f=p.findTokenIndexAtOffset(t.column-1),v=t.column-1,b=t.column-1);let S=!0;for(;f>=0;f--){let y=p.getLanguageId(f)===n&&!IN(p.getStandardTokenType(f));if(y)S?v=p.getStartOffset(f):(v=p.getStartOffset(f),b=p.getEndOffset(f));else if(S&&v!==b){let w=c(u,g,v,b);if(w)return w}S=y}if(S&&v!==b){let y=c(u,g,v,b);if(y)return y}}return null}_findMatchingBracketDown(e,t,o){let n=e.languageId,r=e.forwardRegex,s=1,l=0,c=(p,h,g,f)=>{for(;;){if(o&&++l%100===0&&!o())return aq.INSTANCE;let v=jk.findNextBracketInRange(r,p,h,g,f);if(!v)break;let b=h.substring(v.startColumn-1,v.endColumn-1).toLowerCase();if(e.isOpen(b)?s++:e.isClose(b)&&s--,s===0)return v;g=v.endColumn-1}return null},u=this.textModel.getLineCount();for(let p=t.lineNumber;p<=u;p++){let h=this.textModel.tokenization.getLineTokens(p),g=h.getCount(),f=this.textModel.getLineContent(p),v=0,b=0,S=0;p===t.lineNumber&&(v=h.findTokenIndexAtOffset(t.column-1),b=t.column-1,S=t.column-1);let y=!0;for(;v<g;v++){let w=h.getLanguageId(v)===n&&!IN(h.getStandardTokenType(v));if(w)y||(b=h.getStartOffset(v)),S=h.getEndOffset(v);else if(y&&b!==S){let k=c(p,f,b,S);if(k)return k}y=w}if(y&&b!==S){let w=c(p,f,b,S);if(w)return w}}return null}findPrevBracket(e){let t=this.textModel.validatePosition(e);if(this.canBuildAST)return this.bracketsRequested=!0,this.updateBracketPairsTree(),this.bracketPairsTree.value?.object.getFirstBracketBefore(t)||null;let o=null,n=null,r=null;for(let s=t.lineNumber;s>=1;s--){let l=this.textModel.tokenization.getLineTokens(s),c=l.getCount(),u=this.textModel.getLineContent(s),p=c-1,h=u.length,g=u.length;if(s===t.lineNumber){p=l.findTokenIndexAtOffset(t.column-1),h=t.column-1,g=t.column-1;let v=l.getLanguageId(p);o!==v&&(o=v,n=this.languageConfigurationService.getLanguageConfiguration(o).brackets,r=this.languageConfigurationService.getLanguageConfiguration(o).bracketsNew)}let f=!0;for(;p>=0;p--){let v=l.getLanguageId(p);if(o!==v){if(n&&r&&f&&h!==g){let S=jk.findPrevBracketInRange(n.reversedRegex,s,u,h,g);if(S)return this._toFoundBracket(r,S);f=!1}o=v,n=this.languageConfigurationService.getLanguageConfiguration(o).brackets,r=this.languageConfigurationService.getLanguageConfiguration(o).bracketsNew}let b=!!n&&!IN(l.getStandardTokenType(p));if(b)f?h=l.getStartOffset(p):(h=l.getStartOffset(p),g=l.getEndOffset(p));else if(r&&n&&f&&h!==g){let S=jk.findPrevBracketInRange(n.reversedRegex,s,u,h,g);if(S)return this._toFoundBracket(r,S)}f=b}if(r&&n&&f&&h!==g){let v=jk.findPrevBracketInRange(n.reversedRegex,s,u,h,g);if(v)return this._toFoundBracket(r,v)}}return null}findNextBracket(e){let t=this.textModel.validatePosition(e);if(this.canBuildAST)return this.bracketsRequested=!0,this.updateBracketPairsTree(),this.bracketPairsTree.value?.object.getFirstBracketAfter(t)||null;let o=this.textModel.getLineCount(),n=null,r=null,s=null;for(let l=t.lineNumber;l<=o;l++){let c=this.textModel.tokenization.getLineTokens(l),u=c.getCount(),p=this.textModel.getLineContent(l),h=0,g=0,f=0;if(l===t.lineNumber){h=c.findTokenIndexAtOffset(t.column-1),g=t.column-1,f=t.column-1;let b=c.getLanguageId(h);n!==b&&(n=b,r=this.languageConfigurationService.getLanguageConfiguration(n).brackets,s=this.languageConfigurationService.getLanguageConfiguration(n).bracketsNew)}let v=!0;for(;h<u;h++){let b=c.getLanguageId(h);if(n!==b){if(s&&r&&v&&g!==f){let y=jk.findNextBracketInRange(r.forwardRegex,l,p,g,f);if(y)return this._toFoundBracket(s,y);v=!1}n=b,r=this.languageConfigurationService.getLanguageConfiguration(n).brackets,s=this.languageConfigurationService.getLanguageConfiguration(n).bracketsNew}let S=!!r&&!IN(c.getStandardTokenType(h));if(S)v||(g=c.getStartOffset(h)),f=c.getEndOffset(h);else if(s&&r&&v&&g!==f){let y=jk.findNextBracketInRange(r.forwardRegex,l,p,g,f);if(y)return this._toFoundBracket(s,y)}v=S}if(s&&r&&v&&g!==f){let b=jk.findNextBracketInRange(r.forwardRegex,l,p,g,f);if(b)return this._toFoundBracket(s,b)}}return null}findEnclosingBrackets(e,t){let o=this.textModel.validatePosition(e);if(this.canBuildAST){let f=z.fromPositions(o),v=this.getBracketPairsInRange(z.fromPositions(o,o)).findLast(b=>b.closingBracketRange!==void 0&&b.range.strictContainsRange(f));return v?[v.openingBracketRange,v.closingBracketRange]:null}let n=WZt(t),r=this.textModel.getLineCount(),s=new Map,l=[],c=(f,v)=>{if(!s.has(f)){let b=[];for(let S=0,y=v?v.brackets.length:0;S<y;S++)b[S]=0;s.set(f,b)}l=s.get(f)},u=0,p=(f,v,b,S,y)=>{for(;;){if(n&&++u%100===0&&!n())return aq.INSTANCE;let w=jk.findNextBracketInRange(f.forwardRegex,v,b,S,y);if(!w)break;let k=b.substring(w.startColumn-1,w.endColumn-1).toLowerCase(),T=f.textIsBracket[k];if(T&&(T.isOpen(k)?l[T.index]++:T.isClose(k)&&l[T.index]--,l[T.index]===-1))return this._matchFoundBracket(w,T,!1,n);S=w.endColumn-1}return null},h=null,g=null;for(let f=o.lineNumber;f<=r;f++){let v=this.textModel.tokenization.getLineTokens(f),b=v.getCount(),S=this.textModel.getLineContent(f),y=0,w=0,k=0;if(f===o.lineNumber){y=v.findTokenIndexAtOffset(o.column-1),w=o.column-1,k=o.column-1;let N=v.getLanguageId(y);h!==N&&(h=N,g=this.languageConfigurationService.getLanguageConfiguration(h).brackets,c(h,g))}let T=!0;for(;y<b;y++){let N=v.getLanguageId(y);if(h!==N){if(g&&T&&w!==k){let V=p(g,f,S,w,k);if(V)return Vvt(V);T=!1}h=N,g=this.languageConfigurationService.getLanguageConfiguration(h).brackets,c(h,g)}let O=!!g&&!IN(v.getStandardTokenType(y));if(O)T||(w=v.getStartOffset(y)),k=v.getEndOffset(y);else if(g&&T&&w!==k){let V=p(g,f,S,w,k);if(V)return Vvt(V)}T=O}if(g&&T&&w!==k){let N=p(g,f,S,w,k);if(N)return Vvt(N)}}return null}_toFoundBracket(e,t){if(!t)return null;let o=this.textModel.getValueInRange(t);o=o.toLowerCase();let n=e.getBracketInfo(o);return n?{range:t,bracketInfo:n}:null}};function UAo(a,i){return{object:a,dispose:()=>i?.dispose()}}function WZt(a){if(typeof a>"u")return()=>!0;{let i=Date.now();return()=>Date.now()-i<=a}}var aq=class a{constructor(){this._searchCanceledBrand=void 0}static{this.INSTANCE=new a}};function Vvt(a){return a instanceof aq?null:a}var Hvt=class extends C{constructor(e){super();this.textModel=e;this.colorProvider=new Uvt;this.onDidChangeEmitter=this._register(new E);this.onDidChange=this.onDidChangeEmitter.event;this.colorizationOptions=e.getOptions().bracketPairColorizationOptions,this._register(e.bracketPairs.onDidChange(t=>{this.onDidChangeEmitter.fire()}))}handleDidChangeOptions(e){this.colorizationOptions=this.textModel.getOptions().bracketPairColorizationOptions}getDecorationsInRange(e,t,o,n,r){return r?[]:t===void 0?[]:this.colorizationOptions.enabled?this.textModel.bracketPairs.getBracketsInRange(e,!0).map(l=>({id:`bracket${l.range.toString()}-${l.nestingLevel}`,options:{description:"BracketPairColorization",inlineClassName:this.colorProvider.getInlineClassName(l,this.colorizationOptions.independentColorPoolPerBracketType)},ownerId:0,range:l.range})).toArray():[]}getAllDecorations(e,t,o){return e===void 0?[]:this.colorizationOptions.enabled?this.getDecorationsInRange(new z(1,1,this.textModel.getLineCount(),1),e,t,o):[]}},Uvt=class{constructor(){this.unexpectedClosingBracketClassName="unexpected-closing-bracket"}getInlineClassName(i,e){return i.isInvalid?this.unexpectedClosingBracketClassName:this.getInlineClassNameOfLevel(e?i.nestingLevelOfEqualBracketType:i.nestingLevel)}getInlineClassNameOfLevel(i){return`bracket-highlighting-${i%30}`}};is((a,i)=>{let e=[Sft,Ift,yft,wft,Cft,xft],t=new Uvt;i.addRule(`.monaco-editor .${t.unexpectedClosingBracketClassName} { color: ${a.getColor(gqi)}; }`);let o=e.map(n=>a.getColor(n)).filter(n=>!!n).filter(n=>!n.isTransparent());for(let n=0;n<30;n++){let r=o[n%o.length];i.addRule(`.monaco-editor .${t.getInlineClassNameOfLevel(n)} { color: ${r}; }`)}});function zvt(a){return a.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}var SL=class a{constructor(i,e,t,o){this.oldPosition=i;this.oldText=e;this.newPosition=t;this.newText=o}get oldLength(){return this.oldText.length}get oldEnd(){return this.oldPosition+this.oldText.length}get newLength(){return this.newText.length}get newEnd(){return this.newPosition+this.newText.length}toString(){return this.oldText.length===0?`(insert@${this.oldPosition} "${zvt(this.newText)}")`:this.newText.length===0?`(delete@${this.oldPosition} "${zvt(this.oldText)}")`:`(replace@${this.oldPosition} "${zvt(this.oldText)}" with "${zvt(this.newText)}")`}static _writeStringSize(i){return 4+2*i.length}static _writeString(i,e,t){let o=e.length;LI(i,o,t),t+=4;for(let n=0;n<o;n++)z1i(i,e.charCodeAt(n),t),t+=2;return t}static _readString(i,e){let t=DI(i,e);return e+=4,xKi(i,e,t)}writeSize(){return 8+a._writeStringSize(this.oldText)+a._writeStringSize(this.newText)}write(i,e){return LI(i,this.oldPosition,e),e+=4,LI(i,this.newPosition,e),e+=4,e=a._writeString(i,this.oldText,e),e=a._writeString(i,this.newText,e),e}static read(i,e,t){let o=DI(i,e);e+=4;let n=DI(i,e);e+=4;let r=a._readString(i,e);e+=a._writeStringSize(r);let s=a._readString(i,e);return e+=a._writeStringSize(s),t.push(new a(o,r,n,s)),e}};function dji(a,i){return a===null||a.length===0?i:new VZt(a,i).compress()}var VZt=class a{constructor(i,e){this._prevEdits=i,this._currEdits=e,this._result=[],this._resultLen=0,this._prevLen=this._prevEdits.length,this._prevDeltaOffset=0,this._currLen=this._currEdits.length,this._currDeltaOffset=0}compress(){let i=0,e=0,t=this._getPrev(i),o=this._getCurr(e);for(;i<this._prevLen||e<this._currLen;){if(t===null){this._acceptCurr(o),o=this._getCurr(++e);continue}if(o===null){this._acceptPrev(t),t=this._getPrev(++i);continue}if(o.oldEnd<=t.newPosition){this._acceptCurr(o),o=this._getCurr(++e);continue}if(t.newEnd<=o.oldPosition){this._acceptPrev(t),t=this._getPrev(++i);continue}if(o.oldPosition<t.newPosition){let[c,u]=a._splitCurr(o,t.newPosition-o.oldPosition);this._acceptCurr(c),o=u;continue}if(t.newPosition<o.oldPosition){let[c,u]=a._splitPrev(t,o.oldPosition-t.newPosition);this._acceptPrev(c),t=u;continue}let s,l;if(o.oldEnd===t.newEnd)s=t,l=o,t=this._getPrev(++i),o=this._getCurr(++e);else if(o.oldEnd<t.newEnd){let[c,u]=a._splitPrev(t,o.oldLength);s=c,l=o,t=u,o=this._getCurr(++e)}else{let[c,u]=a._splitCurr(o,t.newLength);s=t,l=c,t=this._getPrev(++i),o=u}this._result[this._resultLen++]=new SL(s.oldPosition,s.oldText,l.newPosition,l.newText),this._prevDeltaOffset+=s.newLength-s.oldLength,this._currDeltaOffset+=l.newLength-l.oldLength}let n=a._merge(this._result);return a._removeNoOps(n)}_acceptCurr(i){this._result[this._resultLen++]=a._rebaseCurr(this._prevDeltaOffset,i),this._currDeltaOffset+=i.newLength-i.oldLength}_getCurr(i){return i<this._currLen?this._currEdits[i]:null}_acceptPrev(i){this._result[this._resultLen++]=a._rebasePrev(this._currDeltaOffset,i),this._prevDeltaOffset+=i.newLength-i.oldLength}_getPrev(i){return i<this._prevLen?this._prevEdits[i]:null}static _rebaseCurr(i,e){return new SL(e.oldPosition-i,e.oldText,e.newPosition,e.newText)}static _rebasePrev(i,e){return new SL(e.oldPosition,e.oldText,e.newPosition+i,e.newText)}static _splitPrev(i,e){let t=i.newText.substr(0,e),o=i.newText.substr(e);return[new SL(i.oldPosition,i.oldText,i.newPosition,t),new SL(i.oldEnd,"",i.newPosition+e,o)]}static _splitCurr(i,e){let t=i.oldText.substr(0,e),o=i.oldText.substr(e);return[new SL(i.oldPosition,t,i.newPosition,i.newText),new SL(i.oldPosition+e,o,i.newEnd,"")]}static _merge(i){if(i.length===0)return i;let e=[],t=0,o=i[0];for(let n=1;n<i.length;n++){let r=i[n];o.oldEnd===r.oldPosition?o=new SL(o.oldPosition,o.oldText+r.oldText,o.newPosition,o.newText+r.newText):(e[t++]=o,o=r)}return e[t++]=o,e}static _removeNoOps(i){if(i.length===0)return i;let e=[],t=0;for(let o=0;o<i.length;o++){let n=i[o];n.oldText!==n.newText&&(e[t++]=n)}return e}};function mye(a){return a.toString()}var t_=class a{constructor(i,e,t,o,n,r,s){this.beforeVersionId=i;this.afterVersionId=e;this.beforeEOL=t;this.afterEOL=o;this.beforeCursorState=n;this.afterCursorState=r;this.changes=s}static create(i,e){let t=i.getAlternativeVersionId(),o=BZt(i);return new a(t,t,o,o,e,e,[])}append(i,e,t,o,n){e.length>0&&(this.changes=dji(this.changes,e)),this.afterEOL=t,this.afterVersionId=o,this.afterCursorState=n}static _writeSelectionsSize(i){return 4+16*(i?i.length:0)}static _writeSelections(i,e,t){if(LI(i,e?e.length:0,t),t+=4,e)for(let o of e)LI(i,o.selectionStartLineNumber,t),t+=4,LI(i,o.selectionStartColumn,t),t+=4,LI(i,o.positionLineNumber,t),t+=4,LI(i,o.positionColumn,t),t+=4;return t}static _readSelections(i,e,t){let o=DI(i,e);e+=4;for(let n=0;n<o;n++){let r=DI(i,e);e+=4;let s=DI(i,e);e+=4;let l=DI(i,e);e+=4;let c=DI(i,e);e+=4,t.push(new Yt(r,s,l,c))}return e}serialize(){let i=10+a._writeSelectionsSize(this.beforeCursorState)+a._writeSelectionsSize(this.afterCursorState)+4;for(let o of this.changes)i+=o.writeSize();let e=new Uint8Array(i),t=0;LI(e,this.beforeVersionId,t),t+=4,LI(e,this.afterVersionId,t),t+=4,Rpt(e,this.beforeEOL,t),t+=1,Rpt(e,this.afterEOL,t),t+=1,t=a._writeSelections(e,this.beforeCursorState,t),t=a._writeSelections(e,this.afterCursorState,t),LI(e,this.changes.length,t),t+=4;for(let o of this.changes)t=o.write(e,t);return e.buffer}static deserialize(i){let e=new Uint8Array(i),t=0,o=DI(e,t);t+=4;let n=DI(e,t);t+=4;let r=Lpt(e,t);t+=1;let s=Lpt(e,t);t+=1;let l=[];t=a._readSelections(e,t,l);let c=[];t=a._readSelections(e,t,c);let u=DI(e,t);t+=4;let p=[];for(let h=0;h<u;h++)t=SL.read(e,t,p);return new a(o,n,r,s,l,c,p)}},IL=class{constructor(i,e,t,o){this.label=i;this.code=e;this.model=t,this._data=t_.create(t,o)}get type(){return 0}get resource(){return A.isUri(this.model)?this.model:this.model.uri}toString(){return(this._data instanceof t_?this._data:t_.deserialize(this._data)).changes.map(e=>e.toString()).join(", ")}matchesResource(i){return(A.isUri(this.model)?this.model:this.model.uri).toString()===i.toString()}setModel(i){this.model=i}canAppend(i){return this.model===i&&this._data instanceof t_}append(i,e,t,o,n){this._data instanceof t_&&this._data.append(i,e,t,o,n)}close(){this._data instanceof t_&&(this._data=this._data.serialize())}open(){this._data instanceof t_||(this._data=t_.deserialize(this._data))}undo(){if(A.isUri(this.model))throw new Error("Invalid SingleModelEditStackElement");this._data instanceof t_&&(this._data=this._data.serialize());let i=t_.deserialize(this._data);this.model._applyUndo(i.changes,i.beforeEOL,i.beforeVersionId,i.beforeCursorState)}redo(){if(A.isUri(this.model))throw new Error("Invalid SingleModelEditStackElement");this._data instanceof t_&&(this._data=this._data.serialize());let i=t_.deserialize(this._data);this.model._applyRedo(i.changes,i.afterEOL,i.afterVersionId,i.afterCursorState)}heapSize(){return this._data instanceof t_&&(this._data=this._data.serialize()),this._data.byteLength+168}},vW=class{constructor(i,e,t){this.label=i;this.code=e;this.type=1;this._isOpen=!0,this._editStackElementsArr=t.slice(0),this._editStackElementsMap=new Map;for(let o of this._editStackElementsArr){let n=mye(o.resource);this._editStackElementsMap.set(n,o)}this._delegate=null}get resources(){return this._editStackElementsArr.map(i=>i.resource)}setDelegate(i){this._delegate=i}prepareUndoRedo(){if(this._delegate)return this._delegate.prepareUndoRedo(this)}getMissingModels(){let i=[];for(let e of this._editStackElementsArr)A.isUri(e.model)&&i.push(e.model);return i}matchesResource(i){let e=mye(i);return this._editStackElementsMap.has(e)}setModel(i){let e=mye(A.isUri(i)?i:i.uri);this._editStackElementsMap.has(e)&&this._editStackElementsMap.get(e).setModel(i)}canAppend(i){if(!this._isOpen)return!1;let e=mye(i.uri);return this._editStackElementsMap.has(e)?this._editStackElementsMap.get(e).canAppend(i):!1}append(i,e,t,o,n){let r=mye(i.uri);this._editStackElementsMap.get(r).append(i,e,t,o,n)}close(){this._isOpen=!1}open(){}undo(){this._isOpen=!1;for(let i of this._editStackElementsArr)i.undo()}redo(){for(let i of this._editStackElementsArr)i.redo()}heapSize(i){let e=mye(i);return this._editStackElementsMap.has(e)?this._editStackElementsMap.get(e).heapSize():0}split(){return this._editStackElementsArr}toString(){let i=[];for(let e of this._editStackElementsArr)i.push(`${Ye(e.resource)}: ${e}`);return`{${i.join(", ")}}`}};function BZt(a){return a.getEOL()===`
`?0:1}function jU(a){return a?a instanceof IL||a instanceof vW:!1}var Kvt=class a{constructor(i,e){this._model=i,this._undoRedoService=e}pushStackElement(){let i=this._undoRedoService.getLastElement(this._model.uri);jU(i)&&i.close()}popStackElement(){let i=this._undoRedoService.getLastElement(this._model.uri);jU(i)&&i.open()}clear(){this._undoRedoService.removeElements(this._model.uri)}_getOrCreateEditStackElement(i,e){let t=this._undoRedoService.getLastElement(this._model.uri);if(jU(t)&&t.canAppend(this._model))return t;let o=new IL(d(908,null),"undoredo.textBufferEdit",this._model,i);return this._undoRedoService.pushElement(o,e),o}pushEOL(i){let e=this._getOrCreateEditStackElement(null,void 0);this._model.setEOL(i),e.append(this._model,[],BZt(this._model),this._model.getAlternativeVersionId(),null)}pushEditOperation(i,e,t,o,n=_c.unknown({name:"pushEditOperation"})){let r=this._getOrCreateEditStackElement(i,o),s=this._model.applyEdits(e,!0,n),l=a._computeCursorState(t,s),c=s.map((u,p)=>({index:p,textChange:u.textChange}));return c.sort((u,p)=>u.textChange.oldPosition===p.textChange.oldPosition?u.index-p.index:u.textChange.oldPosition-p.textChange.oldPosition),r.append(this._model,c.map(u=>u.textChange),BZt(this._model),this._model.getAlternativeVersionId(),l),l}static _computeCursorState(i,e){try{return i?i(e):null}catch(t){return mt(t),null}}};var HZt=class{constructor(){this.spacesDiff=0;this.looksLikeAlignment=!1}};function zAo(a,i,e,t,o){o.spacesDiff=0,o.looksLikeAlignment=!1;let n;for(n=0;n<i&&n<t;n++){let h=a.charCodeAt(n),g=e.charCodeAt(n);if(h!==g)break}let r=0,s=0;for(let h=n;h<i;h++)a.charCodeAt(h)===32?r++:s++;let l=0,c=0;for(let h=n;h<t;h++)e.charCodeAt(h)===32?l++:c++;if(r>0&&s>0||l>0&&c>0)return;let u=Math.abs(s-c),p=Math.abs(r-l);if(u===0){o.spacesDiff=p,p>0&&0<=l-1&&l-1<a.length&&l<e.length&&e.charCodeAt(l)!==32&&a.charCodeAt(l-1)===32&&a.charCodeAt(a.length-1)===44&&(o.looksLikeAlignment=!0);return}if(p%u===0){o.spacesDiff=p/u;return}}function UZt(a,i,e){let t=Math.min(a.getLineCount(),1e4),o=0,n=0,r="",s=0,l=[2,4,6,8,3,5,7],c=8,u=[0,0,0,0,0,0,0,0,0],p=new HZt;for(let f=1;f<=t;f++){let v=a.getLineLength(f),b=a.getLineContent(f),S=v<=65536,y=!1,w=0,k=0,T=0;for(let O=0,V=v;O<V;O++){let U=S?b.charCodeAt(O):a.getLineCharCode(f,O);if(U===9)T++;else if(U===32)k++;else{y=!0,w=O;break}}if(!y||(T>0?o++:k>1&&n++,zAo(r,s,b,w,p),p.looksLikeAlignment&&!(e&&i===p.spacesDiff)))continue;let N=p.spacesDiff;N<=c&&u[N]++,r=b,s=w}let h=e;o!==n&&(h=o<n);let g=i;if(h){let f=0;l.forEach(v=>{let b=u[v];b>f&&(f=b,g=v)}),g===4&&u[4]>0&&u[2]>0&&u[2]>=u[4]*2/3&&(g=2)}return{insertSpaces:h,tabSize:g}}var hye=class{constructor(i,e){this.piece=i,this.color=e,this.size_left=0,this.lf_left=0,this.parent=this,this.left=this,this.right=this}next(){if(this.right!==Zr)return Gvt(this.right);let i=this;for(;i.parent!==Zr&&i.parent.left!==i;)i=i.parent;return i.parent===Zr?Zr:i.parent}prev(){if(this.left!==Zr)return KZt(this.left);let i=this;for(;i.parent!==Zr&&i.parent.right!==i;)i=i.parent;return i.parent===Zr?Zr:i.parent}detach(){this.parent=null,this.left=null,this.right=null}};var Zr=new hye(null,0);Zr.parent=Zr;Zr.left=Zr;Zr.right=Zr;Zr.color=0;function Gvt(a){for(;a.left!==Zr;)a=a.left;return a}function KZt(a){for(;a.right!==Zr;)a=a.right;return a}function GZt(a){return a===Zr?0:a.size_left+a.piece.length+GZt(a.right)}function $Zt(a){return a===Zr?0:a.lf_left+a.piece.lineFeedCnt+$Zt(a.right)}function zZt(){Zr.parent=Zr}function _qe(a,i){let e=i.right;e.size_left+=i.size_left+(i.piece?i.piece.length:0),e.lf_left+=i.lf_left+(i.piece?i.piece.lineFeedCnt:0),i.right=e.left,e.left!==Zr&&(e.left.parent=i),e.parent=i.parent,i.parent===Zr?a.root=e:i.parent.left===i?i.parent.left=e:i.parent.right=e,e.left=i,i.parent=e}function Dqe(a,i){let e=i.left;i.left=e.right,e.right!==Zr&&(e.right.parent=i),e.parent=i.parent,i.size_left-=e.size_left+(e.piece?e.piece.length:0),i.lf_left-=e.lf_left+(e.piece?e.piece.lineFeedCnt:0),i.parent===Zr?a.root=e:i===i.parent.right?i.parent.right=e:i.parent.left=e,e.right=i,i.parent=e}function Lqe(a,i){let e,t;if(i.left===Zr?(t=i,e=t.right):i.right===Zr?(t=i,e=t.left):(t=Gvt(i.right),e=t.right),t===a.root){a.root=e,e.color=0,i.detach(),zZt(),a.root.parent=Zr;return}let o=t.color===1;if(t===t.parent.left?t.parent.left=e:t.parent.right=e,t===i?(e.parent=t.parent,Tqe(a,e)):(t.parent===i?e.parent=t:e.parent=t.parent,Tqe(a,e),t.left=i.left,t.right=i.right,t.parent=i.parent,t.color=i.color,i===a.root?a.root=t:i===i.parent.left?i.parent.left=t:i.parent.right=t,t.left!==Zr&&(t.left.parent=t),t.right!==Zr&&(t.right.parent=t),t.size_left=i.size_left,t.lf_left=i.lf_left,Tqe(a,t)),i.detach(),e.parent.left===e){let r=GZt(e),s=$Zt(e);if(r!==e.parent.size_left||s!==e.parent.lf_left){let l=r-e.parent.size_left,c=s-e.parent.lf_left;e.parent.size_left=r,e.parent.lf_left=s,YU(a,e.parent,l,c)}}if(Tqe(a,e.parent),o){zZt();return}let n;for(;e!==a.root&&e.color===0;)e===e.parent.left?(n=e.parent.right,n.color===1&&(n.color=0,e.parent.color=1,_qe(a,e.parent),n=e.parent.right),n.left.color===0&&n.right.color===0?(n.color=1,e=e.parent):(n.right.color===0&&(n.left.color=0,n.color=1,Dqe(a,n),n=e.parent.right),n.color=e.parent.color,e.parent.color=0,n.right.color=0,_qe(a,e.parent),e=a.root)):(n=e.parent.left,n.color===1&&(n.color=0,e.parent.color=1,Dqe(a,e.parent),n=e.parent.left),n.left.color===0&&n.right.color===0?(n.color=1,e=e.parent):(n.left.color===0&&(n.right.color=0,n.color=1,_qe(a,n),n=e.parent.left),n.color=e.parent.color,e.parent.color=0,n.left.color=0,Dqe(a,e.parent),e=a.root));e.color=0,zZt()}function qZt(a,i){for(Tqe(a,i);i!==a.root&&i.parent.color===1;)if(i.parent===i.parent.parent.left){let e=i.parent.parent.right;e.color===1?(i.parent.color=0,e.color=0,i.parent.parent.color=1,i=i.parent.parent):(i===i.parent.right&&(i=i.parent,_qe(a,i)),i.parent.color=0,i.parent.parent.color=1,Dqe(a,i.parent.parent))}else{let e=i.parent.parent.left;e.color===1?(i.parent.color=0,e.color=0,i.parent.parent.color=1,i=i.parent.parent):(i===i.parent.left&&(i=i.parent,Dqe(a,i)),i.parent.color=0,i.parent.parent.color=1,_qe(a,i.parent.parent))}a.root.color=0}function YU(a,i,e,t){for(;i!==a.root&&i!==Zr;)i.parent.left===i&&(i.parent.size_left+=e,i.parent.lf_left+=t),i=i.parent}function Tqe(a,i){let e=0,t=0;if(i!==a.root){for(;i!==a.root&&i===i.parent.right;)i=i.parent;if(i!==a.root)for(i=i.parent,e=GZt(i.left)-i.size_left,t=$Zt(i.left)-i.lf_left,i.size_left+=e,i.lf_left+=t;i!==a.root&&(e!==0||t!==0);)i.parent.left===i&&(i.parent.size_left+=e,i.parent.lf_left+=t),i=i.parent}}var lq=65535;function uji(a){let i;return a[a.length-1]<65536?i=new Uint16Array(a.length):i=new Uint32Array(a.length),i.set(a,0),i}var jZt=class{constructor(i,e,t,o,n){this.lineStarts=i;this.cr=e;this.lf=t;this.crlf=o;this.isBasicASCII=n}};function XU(a,i=!0){let e=[0],t=1;for(let o=0,n=a.length;o<n;o++){let r=a.charCodeAt(o);r===13?o+1<n&&a.charCodeAt(o+1)===10?(e[t++]=o+2,o++):e[t++]=o+1:r===10&&(e[t++]=o+1)}return i?uji(e):e}function pji(a,i){a.length=0,a[0]=0;let e=1,t=0,o=0,n=0,r=!0;for(let l=0,c=i.length;l<c;l++){let u=i.charCodeAt(l);u===13?l+1<c&&i.charCodeAt(l+1)===10?(n++,a[e++]=l+2,l++):(t++,a[e++]=l+1):u===10?(o++,a[e++]=l+1):r&&u!==9&&(u<32||u>126)&&(r=!1)}let s=new jZt(uji(a),t,o,n,r);return a.length=0,s}var wx=class{constructor(i,e,t,o,n){this.bufferIndex=i,this.start=e,this.end=t,this.lineFeedCnt=o,this.length=n}},JU=class{constructor(i,e){this.buffer=i,this.lineStarts=e}},QZt=class{constructor(i,e){this._pieces=[],this._tree=i,this._BOM=e,this._index=0,i.root!==Zr&&i.iterate(i.root,t=>(t!==Zr&&this._pieces.push(t.piece),!0))}read(){return this._pieces.length===0?this._index===0?(this._index++,this._BOM):null:this._index>this._pieces.length-1?null:this._index===0?this._BOM+this._tree.getPieceContent(this._pieces[this._index++]):this._tree.getPieceContent(this._pieces[this._index++])}},YZt=class{constructor(i){this._limit=i,this._cache=[]}get(i){for(let e=this._cache.length-1;e>=0;e--){let t=this._cache[e];if(t.nodeStartOffset<=i&&t.nodeStartOffset+t.node.piece.length>=i)return t}return null}get2(i){for(let e=this._cache.length-1;e>=0;e--){let t=this._cache[e];if(t.nodeStartLineNumber&&t.nodeStartLineNumber<i&&t.nodeStartLineNumber+t.node.piece.lineFeedCnt>=i)return t}return null}set(i){this._cache.length>=this._limit&&this._cache.shift(),this._cache.push(i)}validate(i){let e=!1,t=this._cache;for(let o=0;o<t.length;o++){let n=t[o];if(n.node.parent===null||n.nodeStartOffset>=i){t[o]=null,e=!0;continue}}if(e){let o=[];for(let n of t)n!==null&&o.push(n);this._cache=o}}},$vt=class{constructor(i,e,t){this.create(i,e,t)}create(i,e,t){this._buffers=[new JU("",[0])],this._lastChangeBufferPos={line:0,column:0},this.root=Zr,this._lineCnt=1,this._length=0,this._EOL=e,this._EOLLength=e.length,this._EOLNormalized=t;let o=null;for(let n=0,r=i.length;n<r;n++)if(i[n].buffer.length>0){i[n].lineStarts||(i[n].lineStarts=XU(i[n].buffer));let s=new wx(n+1,{line:0,column:0},{line:i[n].lineStarts.length-1,column:i[n].buffer.length-i[n].lineStarts[i[n].lineStarts.length-1]},i[n].lineStarts.length-1,i[n].buffer.length);this._buffers.push(i[n]),o=this.rbInsertRight(o,s)}this._searchCache=new YZt(1),this._lastVisitedLine={lineNumber:0,value:""},this.computeBufferMetadata()}normalizeEOL(i){let e=lq,t=e-Math.floor(e/3),o=t*2,n="",r=0,s=[];if(this.iterate(this.root,l=>{let c=this.getNodeContent(l),u=c.length;if(r<=t||r+u<o)return n+=c,r+=u,!0;let p=n.replace(/\r\n|\r|\n/g,i);return s.push(new JU(p,XU(p))),n=c,r=u,!0}),r>0){let l=n.replace(/\r\n|\r|\n/g,i);s.push(new JU(l,XU(l)))}this.create(s,i,!0)}getEOL(){return this._EOL}setEOL(i){this._EOL=i,this._EOLLength=this._EOL.length,this.normalizeEOL(i)}createSnapshot(i){return new QZt(this,i)}equal(i){if(this.getLength()!==i.getLength()||this.getLineCount()!==i.getLineCount())return!1;let e=0;return this.iterate(this.root,o=>{if(o===Zr)return!0;let n=this.getNodeContent(o),r=n.length,s=i.nodeAt(e),l=i.nodeAt(e+r),c=i.getValueInRange2(s,l);return e+=r,n===c})}getOffsetAt(i,e){let t=0,o=this.root;for(;o!==Zr;)if(o.left!==Zr&&o.lf_left+1>=i)o=o.left;else if(o.lf_left+o.piece.lineFeedCnt+1>=i){t+=o.size_left;let n=this.getAccumulatedValue(o,i-o.lf_left-2);return t+=n+e-1}else i-=o.lf_left+o.piece.lineFeedCnt,t+=o.size_left+o.piece.length,o=o.right;return t}getPositionAt(i){i=Math.floor(i),i=Math.max(0,i);let e=this.root,t=0,o=i;for(;e!==Zr;)if(e.size_left!==0&&e.size_left>=i)e=e.left;else if(e.size_left+e.piece.length>=i){let n=this.getIndexOf(e,i-e.size_left);if(t+=e.lf_left+n.index,n.index===0){let r=this.getOffsetAt(t+1,1),s=o-r;return new Ie(t+1,s+1)}return new Ie(t+1,n.remainder+1)}else if(i-=e.size_left+e.piece.length,t+=e.lf_left+e.piece.lineFeedCnt,e.right===Zr){let n=this.getOffsetAt(t+1,1),r=o-i-n;return new Ie(t+1,r+1)}else e=e.right;return new Ie(1,1)}getValueInRange(i,e){if(i.startLineNumber===i.endLineNumber&&i.startColumn===i.endColumn)return"";let t=this.nodeAt2(i.startLineNumber,i.startColumn),o=this.nodeAt2(i.endLineNumber,i.endColumn),n=this.getValueInRange2(t,o);return e?e!==this._EOL||!this._EOLNormalized?n.replace(/\r\n|\r|\n/g,e):e===this.getEOL()&&this._EOLNormalized?n:n.replace(/\r\n|\r|\n/g,e):n}getValueInRange2(i,e){if(i.node===e.node){let s=i.node,l=this._buffers[s.piece.bufferIndex].buffer,c=this.offsetInBuffer(s.piece.bufferIndex,s.piece.start);return l.substring(c+i.remainder,c+e.remainder)}let t=i.node,o=this._buffers[t.piece.bufferIndex].buffer,n=this.offsetInBuffer(t.piece.bufferIndex,t.piece.start),r=o.substring(n+i.remainder,n+t.piece.length);for(t=t.next();t!==Zr;){let s=this._buffers[t.piece.bufferIndex].buffer,l=this.offsetInBuffer(t.piece.bufferIndex,t.piece.start);if(t===e.node){r+=s.substring(l,l+e.remainder);break}else r+=s.substr(l,t.piece.length);t=t.next()}return r}getLinesContent(){let i=[],e=0,t="",o=!1;return this.iterate(this.root,n=>{if(n===Zr)return!0;let r=n.piece,s=r.length;if(s===0)return!0;let l=this._buffers[r.bufferIndex].buffer,c=this._buffers[r.bufferIndex].lineStarts,u=r.start.line,p=r.end.line,h=c[u]+r.start.column;if(o&&(l.charCodeAt(h)===10&&(h++,s--),i[e++]=t,t="",o=!1,s===0))return!0;if(u===p)return!this._EOLNormalized&&l.charCodeAt(h+s-1)===13?(o=!0,t+=l.substr(h,s-1)):t+=l.substr(h,s),!0;t+=this._EOLNormalized?l.substring(h,Math.max(h,c[u+1]-this._EOLLength)):l.substring(h,c[u+1]).replace(/(\r\n|\r|\n)$/,""),i[e++]=t;for(let g=u+1;g<p;g++)t=this._EOLNormalized?l.substring(c[g],c[g+1]-this._EOLLength):l.substring(c[g],c[g+1]).replace(/(\r\n|\r|\n)$/,""),i[e++]=t;return!this._EOLNormalized&&l.charCodeAt(c[p]+r.end.column-1)===13?(o=!0,r.end.column===0?e--:t=l.substr(c[p],r.end.column-1)):t=l.substr(c[p],r.end.column),!0}),o&&(i[e++]=t,t=""),i[e++]=t,i}getLength(){return this._length}getLineCount(){return this._lineCnt}getLineContent(i){return this._lastVisitedLine.lineNumber===i?this._lastVisitedLine.value:(this._lastVisitedLine.lineNumber=i,i===this._lineCnt?this._lastVisitedLine.value=this.getLineRawContent(i):this._EOLNormalized?this._lastVisitedLine.value=this.getLineRawContent(i,this._EOLLength):this._lastVisitedLine.value=this.getLineRawContent(i).replace(/(\r\n|\r|\n)$/,""),this._lastVisitedLine.value)}_getCharCode(i){if(i.remainder===i.node.piece.length){let e=i.node.next();if(!e)return 0;let t=this._buffers[e.piece.bufferIndex],o=this.offsetInBuffer(e.piece.bufferIndex,e.piece.start);return t.buffer.charCodeAt(o)}else{let e=this._buffers[i.node.piece.bufferIndex],o=this.offsetInBuffer(i.node.piece.bufferIndex,i.node.piece.start)+i.remainder;return e.buffer.charCodeAt(o)}}getLineCharCode(i,e){let t=this.nodeAt2(i,e+1);return this._getCharCode(t)}getLineLength(i){if(i===this.getLineCount()){let e=this.getOffsetAt(i,1);return this.getLength()-e}return this.getOffsetAt(i+1,1)-this.getOffsetAt(i,1)-this._EOLLength}getCharCode(i){let e=this.nodeAt(i);return this._getCharCode(e)}getNearestChunk(i){let e=this.nodeAt(i);if(e.remainder===e.node.piece.length){let t=e.node.next();if(!t||t===Zr)return"";let o=this._buffers[t.piece.bufferIndex],n=this.offsetInBuffer(t.piece.bufferIndex,t.piece.start);return o.buffer.substring(n,n+t.piece.length)}else{let t=this._buffers[e.node.piece.bufferIndex],o=this.offsetInBuffer(e.node.piece.bufferIndex,e.node.piece.start),n=o+e.remainder,r=o+e.node.piece.length;return t.buffer.substring(n,r)}}findMatchesInNode(i,e,t,o,n,r,s,l,c,u,p){let h=this._buffers[i.piece.bufferIndex],g=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start),f=this.offsetInBuffer(i.piece.bufferIndex,n),v=this.offsetInBuffer(i.piece.bufferIndex,r),b,S={line:0,column:0},y,w;e._wordSeparators?(y=h.buffer.substring(f,v),w=k=>k+f,e.reset(0)):(y=h.buffer,w=k=>k,e.reset(f));do if(b=e.next(y),b){if(w(b.index)>=v)return u;this.positionInBuffer(i,w(b.index)-g,S);let k=this.getLineFeedCnt(i.piece.bufferIndex,n,S),T=S.line===n.line?S.column-n.column+o:S.column+1,N=T+b[0].length;if(p[u++]=q6(new z(t+k,T,t+k,N),b,l),w(b.index)+b[0].length>=v||u>=c)return u}while(b);return u}findMatchesLineByLine(i,e,t,o){let n=[],r=0,s=new kU(e.wordSeparators,e.regex),l=this.nodeAt2(i.startLineNumber,i.startColumn);if(l===null)return[];let c=this.nodeAt2(i.endLineNumber,i.endColumn);if(c===null)return[];let u=this.positionInBuffer(l.node,l.remainder),p=this.positionInBuffer(c.node,c.remainder);if(l.node===c.node)return this.findMatchesInNode(l.node,s,i.startLineNumber,i.startColumn,u,p,e,t,o,r,n),n;let h=i.startLineNumber,g=l.node;for(;g!==c.node;){let v=this.getLineFeedCnt(g.piece.bufferIndex,u,g.piece.end);if(v>=1){let S=this._buffers[g.piece.bufferIndex].lineStarts,y=this.offsetInBuffer(g.piece.bufferIndex,g.piece.start),w=S[u.line+v],k=h===i.startLineNumber?i.startColumn:1;if(r=this.findMatchesInNode(g,s,h,k,u,this.positionInBuffer(g,w-y),e,t,o,r,n),r>=o)return n;h+=v}let b=h===i.startLineNumber?i.startColumn-1:0;if(h===i.endLineNumber){let S=this.getLineContent(h).substring(b,i.endColumn-1);return r=this._findMatchesInLine(e,s,S,i.endLineNumber,b,r,n,t,o),n}if(r=this._findMatchesInLine(e,s,this.getLineContent(h).substr(b),h,b,r,n,t,o),r>=o)return n;h++,l=this.nodeAt2(h,1),g=l.node,u=this.positionInBuffer(l.node,l.remainder)}if(h===i.endLineNumber){let v=h===i.startLineNumber?i.startColumn-1:0,b=this.getLineContent(h).substring(v,i.endColumn-1);return r=this._findMatchesInLine(e,s,b,i.endLineNumber,v,r,n,t,o),n}let f=h===i.startLineNumber?i.startColumn:1;return r=this.findMatchesInNode(c.node,s,h,f,u,p,e,t,o,r,n),n}_findMatchesInLine(i,e,t,o,n,r,s,l,c){let u=i.wordSeparators;if(!l&&i.simpleSearch){let h=i.simpleSearch,g=h.length,f=t.length,v=-g;for(;(v=t.indexOf(h,v+g))!==-1;)if((!u||Bht(u,t,f,v,g))&&(s[r++]=new vU(new z(o,v+1+n,o,v+1+g+n),null),r>=c))return r;return r}let p;e.reset(0);do if(p=e.next(t),p&&(s[r++]=q6(new z(o,p.index+1+n,o,p.index+1+p[0].length+n),p,l),r>=c))return r;while(p);return r}insert(i,e,t=!1){if(this._EOLNormalized=this._EOLNormalized&&t,this._lastVisitedLine.lineNumber=0,this._lastVisitedLine.value="",this.root!==Zr){let{node:o,remainder:n,nodeStartOffset:r}=this.nodeAt(i),s=o.piece,l=s.bufferIndex,c=this.positionInBuffer(o,n);if(o.piece.bufferIndex===0&&s.end.line===this._lastChangeBufferPos.line&&s.end.column===this._lastChangeBufferPos.column&&r+s.length===i&&e.length<lq){this.appendToNode(o,e),this.computeBufferMetadata();return}if(r===i)this.insertContentToNodeLeft(e,o),this._searchCache.validate(i);else if(r+o.piece.length>i){let u=[],p=new wx(s.bufferIndex,c,s.end,this.getLineFeedCnt(s.bufferIndex,c,s.end),this.offsetInBuffer(l,s.end)-this.offsetInBuffer(l,c));if(this.shouldCheckCRLF()&&this.endWithCR(e)&&this.nodeCharCodeAt(o,n)===10){let v={line:p.start.line+1,column:0};p=new wx(p.bufferIndex,v,p.end,this.getLineFeedCnt(p.bufferIndex,v,p.end),p.length-1),e+=`
`}if(this.shouldCheckCRLF()&&this.startWithLF(e))if(this.nodeCharCodeAt(o,n-1)===13){let v=this.positionInBuffer(o,n-1);this.deleteNodeTail(o,v),e="\r"+e,o.piece.length===0&&u.push(o)}else this.deleteNodeTail(o,c);else this.deleteNodeTail(o,c);let h=this.createNewPieces(e);p.length>0&&this.rbInsertRight(o,p);let g=o;for(let f=0;f<h.length;f++)g=this.rbInsertRight(g,h[f]);this.deleteNodes(u)}else this.insertContentToNodeRight(e,o)}else{let o=this.createNewPieces(e),n=this.rbInsertLeft(null,o[0]);for(let r=1;r<o.length;r++)n=this.rbInsertRight(n,o[r])}this.computeBufferMetadata()}delete(i,e){if(this._lastVisitedLine.lineNumber=0,this._lastVisitedLine.value="",e<=0||this.root===Zr)return;let t=this.nodeAt(i),o=this.nodeAt(i+e),n=t.node,r=o.node;if(n===r){let h=this.positionInBuffer(n,t.remainder),g=this.positionInBuffer(n,o.remainder);if(t.nodeStartOffset===i){if(e===n.piece.length){let f=n.next();Lqe(this,n),this.validateCRLFWithPrevNode(f),this.computeBufferMetadata();return}this.deleteNodeHead(n,g),this._searchCache.validate(i),this.validateCRLFWithPrevNode(n),this.computeBufferMetadata();return}if(t.nodeStartOffset+n.piece.length===i+e){this.deleteNodeTail(n,h),this.validateCRLFWithNextNode(n),this.computeBufferMetadata();return}this.shrinkNode(n,h,g),this.computeBufferMetadata();return}let s=[],l=this.positionInBuffer(n,t.remainder);this.deleteNodeTail(n,l),this._searchCache.validate(i),n.piece.length===0&&s.push(n);let c=this.positionInBuffer(r,o.remainder);this.deleteNodeHead(r,c),r.piece.length===0&&s.push(r);let u=n.next();for(let h=u;h!==Zr&&h!==r;h=h.next())s.push(h);let p=n.piece.length===0?n.prev():n;this.deleteNodes(s),this.validateCRLFWithNextNode(p),this.computeBufferMetadata()}insertContentToNodeLeft(i,e){let t=[];if(this.shouldCheckCRLF()&&this.endWithCR(i)&&this.startWithLF(e)){let r=e.piece,s={line:r.start.line+1,column:0},l=new wx(r.bufferIndex,s,r.end,this.getLineFeedCnt(r.bufferIndex,s,r.end),r.length-1);e.piece=l,i+=`
`,YU(this,e,-1,-1),e.piece.length===0&&t.push(e)}let o=this.createNewPieces(i),n=this.rbInsertLeft(e,o[o.length-1]);for(let r=o.length-2;r>=0;r--)n=this.rbInsertLeft(n,o[r]);this.validateCRLFWithPrevNode(n),this.deleteNodes(t)}insertContentToNodeRight(i,e){this.adjustCarriageReturnFromNext(i,e)&&(i+=`
`);let t=this.createNewPieces(i),o=this.rbInsertRight(e,t[0]),n=o;for(let r=1;r<t.length;r++)n=this.rbInsertRight(n,t[r]);this.validateCRLFWithPrevNode(o)}positionInBuffer(i,e,t){let o=i.piece,n=i.piece.bufferIndex,r=this._buffers[n].lineStarts,l=r[o.start.line]+o.start.column+e,c=o.start.line,u=o.end.line,p=0,h=0,g=0;for(;c<=u&&(p=c+(u-c)/2|0,g=r[p],p!==u);)if(h=r[p+1],l<g)u=p-1;else if(l>=h)c=p+1;else break;return t?(t.line=p,t.column=l-g,null):{line:p,column:l-g}}getLineFeedCnt(i,e,t){if(t.column===0)return t.line-e.line;let o=this._buffers[i].lineStarts;if(t.line===o.length-1)return t.line-e.line;let n=o[t.line+1],r=o[t.line]+t.column;if(n>r+1)return t.line-e.line;let s=r-1;return this._buffers[i].buffer.charCodeAt(s)===13?t.line-e.line+1:t.line-e.line}offsetInBuffer(i,e){return this._buffers[i].lineStarts[e.line]+e.column}deleteNodes(i){for(let e=0;e<i.length;e++)Lqe(this,i[e])}createNewPieces(i){if(i.length>lq){let u=[];for(;i.length>lq;){let h=i.charCodeAt(lq-1),g;h===13||h>=55296&&h<=56319?(g=i.substring(0,lq-1),i=i.substring(lq-1)):(g=i.substring(0,lq),i=i.substring(lq));let f=XU(g);u.push(new wx(this._buffers.length,{line:0,column:0},{line:f.length-1,column:g.length-f[f.length-1]},f.length-1,g.length)),this._buffers.push(new JU(g,f))}let p=XU(i);return u.push(new wx(this._buffers.length,{line:0,column:0},{line:p.length-1,column:i.length-p[p.length-1]},p.length-1,i.length)),this._buffers.push(new JU(i,p)),u}let e=this._buffers[0].buffer.length,t=XU(i,!1),o=this._lastChangeBufferPos;if(this._buffers[0].lineStarts[this._buffers[0].lineStarts.length-1]===e&&e!==0&&this.startWithLF(i)&&this.endWithCR(this._buffers[0].buffer)){this._lastChangeBufferPos={line:this._lastChangeBufferPos.line,column:this._lastChangeBufferPos.column+1},o=this._lastChangeBufferPos;for(let u=0;u<t.length;u++)t[u]+=e+1;this._buffers[0].lineStarts=this._buffers[0].lineStarts.concat(t.slice(1)),this._buffers[0].buffer+="_"+i,e+=1}else{if(e!==0)for(let u=0;u<t.length;u++)t[u]+=e;this._buffers[0].lineStarts=this._buffers[0].lineStarts.concat(t.slice(1)),this._buffers[0].buffer+=i}let n=this._buffers[0].buffer.length,r=this._buffers[0].lineStarts.length-1,s=n-this._buffers[0].lineStarts[r],l={line:r,column:s},c=new wx(0,o,l,this.getLineFeedCnt(0,o,l),n-e);return this._lastChangeBufferPos=l,[c]}getLinesRawContent(){return this.getContentOfSubTree(this.root)}getLineRawContent(i,e=0){let t=this.root,o="",n=this._searchCache.get2(i);if(n){t=n.node;let r=this.getAccumulatedValue(t,i-n.nodeStartLineNumber-1),s=this._buffers[t.piece.bufferIndex].buffer,l=this.offsetInBuffer(t.piece.bufferIndex,t.piece.start);if(n.nodeStartLineNumber+t.piece.lineFeedCnt===i)o=s.substring(l+r,l+t.piece.length);else{let c=this.getAccumulatedValue(t,i-n.nodeStartLineNumber);return s.substring(l+r,l+c-e)}}else{let r=0,s=i;for(;t!==Zr;)if(t.left!==Zr&&t.lf_left>=i-1)t=t.left;else if(t.lf_left+t.piece.lineFeedCnt>i-1){let l=this.getAccumulatedValue(t,i-t.lf_left-2),c=this.getAccumulatedValue(t,i-t.lf_left-1),u=this._buffers[t.piece.bufferIndex].buffer,p=this.offsetInBuffer(t.piece.bufferIndex,t.piece.start);return r+=t.size_left,this._searchCache.set({node:t,nodeStartOffset:r,nodeStartLineNumber:s-(i-1-t.lf_left)}),u.substring(p+l,p+c-e)}else if(t.lf_left+t.piece.lineFeedCnt===i-1){let l=this.getAccumulatedValue(t,i-t.lf_left-2),c=this._buffers[t.piece.bufferIndex].buffer,u=this.offsetInBuffer(t.piece.bufferIndex,t.piece.start);o=c.substring(u+l,u+t.piece.length);break}else i-=t.lf_left+t.piece.lineFeedCnt,r+=t.size_left+t.piece.length,t=t.right}for(t=t.next();t!==Zr;){let r=this._buffers[t.piece.bufferIndex].buffer;if(t.piece.lineFeedCnt>0){let s=this.getAccumulatedValue(t,0),l=this.offsetInBuffer(t.piece.bufferIndex,t.piece.start);return o+=r.substring(l,l+s-e),o}else{let s=this.offsetInBuffer(t.piece.bufferIndex,t.piece.start);o+=r.substr(s,t.piece.length)}t=t.next()}return o}computeBufferMetadata(){let i=this.root,e=1,t=0;for(;i!==Zr;)e+=i.lf_left+i.piece.lineFeedCnt,t+=i.size_left+i.piece.length,i=i.right;this._lineCnt=e,this._length=t,this._searchCache.validate(this._length)}getIndexOf(i,e){let t=i.piece,o=this.positionInBuffer(i,e),n=o.line-t.start.line;if(this.offsetInBuffer(t.bufferIndex,t.end)-this.offsetInBuffer(t.bufferIndex,t.start)===e){let r=this.getLineFeedCnt(i.piece.bufferIndex,t.start,o);if(r!==n)return{index:r,remainder:0}}return{index:n,remainder:o.column}}getAccumulatedValue(i,e){if(e<0)return 0;let t=i.piece,o=this._buffers[t.bufferIndex].lineStarts,n=t.start.line+e+1;return n>t.end.line?o[t.end.line]+t.end.column-o[t.start.line]-t.start.column:o[n]-o[t.start.line]-t.start.column}deleteNodeTail(i,e){let t=i.piece,o=t.lineFeedCnt,n=this.offsetInBuffer(t.bufferIndex,t.end),r=e,s=this.offsetInBuffer(t.bufferIndex,r),l=this.getLineFeedCnt(t.bufferIndex,t.start,r),c=l-o,u=s-n,p=t.length+u;i.piece=new wx(t.bufferIndex,t.start,r,l,p),YU(this,i,u,c)}deleteNodeHead(i,e){let t=i.piece,o=t.lineFeedCnt,n=this.offsetInBuffer(t.bufferIndex,t.start),r=e,s=this.getLineFeedCnt(t.bufferIndex,r,t.end),l=this.offsetInBuffer(t.bufferIndex,r),c=s-o,u=n-l,p=t.length+u;i.piece=new wx(t.bufferIndex,r,t.end,s,p),YU(this,i,u,c)}shrinkNode(i,e,t){let o=i.piece,n=o.start,r=o.end,s=o.length,l=o.lineFeedCnt,c=e,u=this.getLineFeedCnt(o.bufferIndex,o.start,c),p=this.offsetInBuffer(o.bufferIndex,e)-this.offsetInBuffer(o.bufferIndex,n);i.piece=new wx(o.bufferIndex,o.start,c,u,p),YU(this,i,p-s,u-l);let h=new wx(o.bufferIndex,t,r,this.getLineFeedCnt(o.bufferIndex,t,r),this.offsetInBuffer(o.bufferIndex,r)-this.offsetInBuffer(o.bufferIndex,t)),g=this.rbInsertRight(i,h);this.validateCRLFWithPrevNode(g)}appendToNode(i,e){this.adjustCarriageReturnFromNext(e,i)&&(e+=`
`);let t=this.shouldCheckCRLF()&&this.startWithLF(e)&&this.endWithCR(i),o=this._buffers[0].buffer.length;this._buffers[0].buffer+=e;let n=XU(e,!1);for(let g=0;g<n.length;g++)n[g]+=o;if(t){let g=this._buffers[0].lineStarts[this._buffers[0].lineStarts.length-2];this._buffers[0].lineStarts.pop(),this._lastChangeBufferPos={line:this._lastChangeBufferPos.line-1,column:o-g}}this._buffers[0].lineStarts=this._buffers[0].lineStarts.concat(n.slice(1));let r=this._buffers[0].lineStarts.length-1,s=this._buffers[0].buffer.length-this._buffers[0].lineStarts[r],l={line:r,column:s},c=i.piece.length+e.length,u=i.piece.lineFeedCnt,p=this.getLineFeedCnt(0,i.piece.start,l),h=p-u;i.piece=new wx(i.piece.bufferIndex,i.piece.start,l,p,c),this._lastChangeBufferPos=l,YU(this,i,e.length,h)}nodeAt(i){let e=this.root,t=this._searchCache.get(i);if(t)return{node:t.node,nodeStartOffset:t.nodeStartOffset,remainder:i-t.nodeStartOffset};let o=0;for(;e!==Zr;)if(e.size_left>i)e=e.left;else if(e.size_left+e.piece.length>=i){o+=e.size_left;let n={node:e,remainder:i-e.size_left,nodeStartOffset:o};return this._searchCache.set(n),n}else i-=e.size_left+e.piece.length,o+=e.size_left+e.piece.length,e=e.right;return null}nodeAt2(i,e){let t=this.root,o=0;for(;t!==Zr;)if(t.left!==Zr&&t.lf_left>=i-1)t=t.left;else if(t.lf_left+t.piece.lineFeedCnt>i-1){let n=this.getAccumulatedValue(t,i-t.lf_left-2),r=this.getAccumulatedValue(t,i-t.lf_left-1);return o+=t.size_left,{node:t,remainder:Math.min(n+e-1,r),nodeStartOffset:o}}else if(t.lf_left+t.piece.lineFeedCnt===i-1){let n=this.getAccumulatedValue(t,i-t.lf_left-2);if(n+e-1<=t.piece.length)return{node:t,remainder:n+e-1,nodeStartOffset:o};e-=t.piece.length-n;break}else i-=t.lf_left+t.piece.lineFeedCnt,o+=t.size_left+t.piece.length,t=t.right;for(t=t.next();t!==Zr;){if(t.piece.lineFeedCnt>0){let n=this.getAccumulatedValue(t,0),r=this.offsetOfNode(t);return{node:t,remainder:Math.min(e-1,n),nodeStartOffset:r}}else if(t.piece.length>=e-1){let n=this.offsetOfNode(t);return{node:t,remainder:e-1,nodeStartOffset:n}}else e-=t.piece.length;t=t.next()}return null}nodeCharCodeAt(i,e){if(i.piece.lineFeedCnt<1)return-1;let t=this._buffers[i.piece.bufferIndex],o=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start)+e;return t.buffer.charCodeAt(o)}offsetOfNode(i){if(!i)return 0;let e=i.size_left;for(;i!==this.root;)i.parent.right===i&&(e+=i.parent.size_left+i.parent.piece.length),i=i.parent;return e}shouldCheckCRLF(){return!(this._EOLNormalized&&this._EOL===`
`)}startWithLF(i){if(typeof i=="string")return i.charCodeAt(0)===10;if(i===Zr||i.piece.lineFeedCnt===0)return!1;let e=i.piece,t=this._buffers[e.bufferIndex].lineStarts,o=e.start.line,n=t[o]+e.start.column;return o===t.length-1||t[o+1]>n+1?!1:this._buffers[e.bufferIndex].buffer.charCodeAt(n)===10}endWithCR(i){return typeof i=="string"?i.charCodeAt(i.length-1)===13:i===Zr||i.piece.lineFeedCnt===0?!1:this.nodeCharCodeAt(i,i.piece.length-1)===13}validateCRLFWithPrevNode(i){if(this.shouldCheckCRLF()&&this.startWithLF(i)){let e=i.prev();this.endWithCR(e)&&this.fixCRLF(e,i)}}validateCRLFWithNextNode(i){if(this.shouldCheckCRLF()&&this.endWithCR(i)){let e=i.next();this.startWithLF(e)&&this.fixCRLF(i,e)}}fixCRLF(i,e){let t=[],o=this._buffers[i.piece.bufferIndex].lineStarts,n;i.piece.end.column===0?n={line:i.piece.end.line-1,column:o[i.piece.end.line]-o[i.piece.end.line-1]-1}:n={line:i.piece.end.line,column:i.piece.end.column-1};let r=i.piece.length-1,s=i.piece.lineFeedCnt-1;i.piece=new wx(i.piece.bufferIndex,i.piece.start,n,s,r),YU(this,i,-1,-1),i.piece.length===0&&t.push(i);let l={line:e.piece.start.line+1,column:0},c=e.piece.length-1,u=this.getLineFeedCnt(e.piece.bufferIndex,l,e.piece.end);e.piece=new wx(e.piece.bufferIndex,l,e.piece.end,u,c),YU(this,e,-1,-1),e.piece.length===0&&t.push(e);let p=this.createNewPieces(`\r
`);this.rbInsertRight(i,p[0]);for(let h=0;h<t.length;h++)Lqe(this,t[h])}adjustCarriageReturnFromNext(i,e){if(this.shouldCheckCRLF()&&this.endWithCR(i)){let t=e.next();if(this.startWithLF(t)){if(i+=`
`,t.piece.length===1)Lqe(this,t);else{let o=t.piece,n={line:o.start.line+1,column:0},r=o.length-1,s=this.getLineFeedCnt(o.bufferIndex,n,o.end);t.piece=new wx(o.bufferIndex,n,o.end,s,r),YU(this,t,-1,-1)}return!0}}return!1}iterate(i,e){if(i===Zr)return e(Zr);let t=this.iterate(i.left,e);return t&&e(i)&&this.iterate(i.right,e)}getNodeContent(i){if(i===Zr)return"";let e=this._buffers[i.piece.bufferIndex],t=i.piece,o=this.offsetInBuffer(t.bufferIndex,t.start),n=this.offsetInBuffer(t.bufferIndex,t.end);return e.buffer.substring(o,n)}getPieceContent(i){let e=this._buffers[i.bufferIndex],t=this.offsetInBuffer(i.bufferIndex,i.start),o=this.offsetInBuffer(i.bufferIndex,i.end);return e.buffer.substring(t,o)}rbInsertRight(i,e){let t=new hye(e,1);if(t.left=Zr,t.right=Zr,t.parent=Zr,t.size_left=0,t.lf_left=0,this.root===Zr)this.root=t,t.color=0;else if(i.right===Zr)i.right=t,t.parent=i;else{let n=Gvt(i.right);n.left=t,t.parent=n}return qZt(this,t),t}rbInsertLeft(i,e){let t=new hye(e,1);if(t.left=Zr,t.right=Zr,t.parent=Zr,t.size_left=0,t.lf_left=0,this.root===Zr)this.root=t,t.color=0;else if(i.left===Zr)i.left=t,t.parent=i;else{let o=KZt(i.left);o.right=t,t.parent=o}return qZt(this,t),t}getContentOfSubTree(i){let e="";return this.iterate(i,t=>(e+=this.getNodeContent(t),!0)),e}};var N9=class a extends C{constructor(e,t,o,n,r,s,l){super();this._onDidChangeContent=this._register(new E);this._BOM=t,this._mightContainNonBasicASCII=!s,this._mightContainRTL=n,this._mightContainUnusualLineTerminators=r,this._pieceTree=new $vt(e,o,l)}get onDidChangeContent(){return this._onDidChangeContent.event}equals(e){return!(e instanceof a)||this._BOM!==e._BOM||this.getEOL()!==e.getEOL()?!1:this._pieceTree.equal(e._pieceTree)}mightContainRTL(){return this._mightContainRTL}mightContainUnusualLineTerminators(){return this._mightContainUnusualLineTerminators}resetMightContainUnusualLineTerminators(){this._mightContainUnusualLineTerminators=!1}mightContainNonBasicASCII(){return this._mightContainNonBasicASCII}getBOM(){return this._BOM}getEOL(){return this._pieceTree.getEOL()}createSnapshot(e){return this._pieceTree.createSnapshot(e?this._BOM:"")}getOffsetAt(e,t){return this._pieceTree.getOffsetAt(e,t)}getPositionAt(e){return this._pieceTree.getPositionAt(e)}getRangeAt(e,t){let o=e+t,n=this.getPositionAt(e),r=this.getPositionAt(o);return new z(n.lineNumber,n.column,r.lineNumber,r.column)}getValueInRange(e,t=0){if(e.isEmpty())return"";let o=this._getEndOfLine(t);return this._pieceTree.getValueInRange(e,o)}getValueLengthInRange(e,t=0){if(e.isEmpty())return 0;if(e.startLineNumber===e.endLineNumber)return e.endColumn-e.startColumn;let o=this.getOffsetAt(e.startLineNumber,e.startColumn),n=this.getOffsetAt(e.endLineNumber,e.endColumn),r=0,s=this._getEndOfLine(t),l=this.getEOL();if(s.length!==l.length){let c=s.length-l.length,u=e.endLineNumber-e.startLineNumber;r=c*u}return n-o+r}getCharacterCountInRange(e,t=0){if(this._mightContainNonBasicASCII){let o=0,n=e.startLineNumber,r=e.endLineNumber;for(let s=n;s<=r;s++){let l=this.getLineContent(s),c=s===n?e.startColumn-1:0,u=s===r?e.endColumn-1:l.length;for(let p=c;p<u;p++)Ru(l.charCodeAt(p))?(o=o+1,p=p+1):o=o+1}return o+=this._getEndOfLine(t).length*(r-n),o}return this.getValueLengthInRange(e,t)}getNearestChunk(e){return this._pieceTree.getNearestChunk(e)}getLength(){return this._pieceTree.getLength()}getLineCount(){return this._pieceTree.getLineCount()}getLinesContent(){return this._pieceTree.getLinesContent()}getLineContent(e){return this._pieceTree.getLineContent(e)}getLineCharCode(e,t){return this._pieceTree.getLineCharCode(e,t)}getCharCode(e){return this._pieceTree.getCharCode(e)}getLineLength(e){return this._pieceTree.getLineLength(e)}getLineMinColumn(e){return 1}getLineMaxColumn(e){return this.getLineLength(e)+1}getLineFirstNonWhitespaceColumn(e){let t=Ap(this.getLineContent(e));return t===-1?0:t+1}getLineLastNonWhitespaceColumn(e){let t=tv(this.getLineContent(e));return t===-1?0:t+2}_getEndOfLine(e){switch(e){case 1:return`
`;case 2:return`\r
`;case 0:return this.getEOL();default:throw new Error("Unknown EOL preference")}}setEOL(e){this._pieceTree.setEOL(e)}applyEdits(e,t,o){let n=this._mightContainRTL,r=this._mightContainUnusualLineTerminators,s=this._mightContainNonBasicASCII,l=!0,c=[];for(let b=0;b<e.length;b++){let S=e[b];l&&S._isTracked&&(l=!1);let y=S.range;if(S.text){let O=!0;s||(O=!oU(S.text),s=O),!n&&O&&(n=yM(S.text)),!r&&O&&(r=bpt(S.text))}let w="",k=0,T=0,N=0;if(S.text){let O;[k,T,N,O]=OS(S.text);let V=this.getEOL(),U=V===`\r
`?2:1;O===0||O===U?w=S.text:w=S.text.replace(/\r\n|\r|\n/g,V)}c[b]={sortIndex:b,identifier:S.identifier||null,range:y,rangeOffset:this.getOffsetAt(y.startLineNumber,y.startColumn),rangeLength:this.getValueLengthInRange(y),text:w,eolCount:k,firstLineLength:T,lastLineLength:N,forceMoveMarkers:!!S.forceMoveMarkers,isAutoWhitespaceEdit:S.isAutoWhitespaceEdit||!1}}c.sort(a._sortOpsAscending);let u=!1;for(let b=0,S=c.length-1;b<S;b++){let y=c[b].range.getEndPosition(),w=c[b+1].range.getStartPosition();if(w.isBeforeOrEqual(y)){if(w.isBefore(y))throw new Error("Overlapping ranges are not allowed!");u=!0}}l&&(c=this._reduceOperations(c));let p=o||t?a._getInverseEditRanges(c):[],h=[];if(t)for(let b=0;b<c.length;b++){let S=c[b],y=p[b];if(S.isAutoWhitespaceEdit&&S.range.isEmpty())for(let w=y.startLineNumber;w<=y.endLineNumber;w++){let k="";w===y.startLineNumber&&(k=this.getLineContent(S.range.startLineNumber),Ap(k)!==-1)||h.push({lineNumber:w,oldContent:k})}}let g=null;if(o){let b=0;g=[];for(let S=0;S<c.length;S++){let y=c[S],w=p[S],k=this.getValueInRange(y.range),T=y.rangeOffset+b;b+=y.text.length-k.length,g[S]={sortIndex:y.sortIndex,identifier:y.identifier,range:w,text:k,textChange:new SL(y.rangeOffset,k,T,y.text)}}u||g.sort((S,y)=>S.sortIndex-y.sortIndex)}this._mightContainRTL=n,this._mightContainUnusualLineTerminators=r,this._mightContainNonBasicASCII=s;let f=this._doApplyEdits(c),v=null;if(t&&h.length>0){h.sort((b,S)=>S.lineNumber-b.lineNumber),v=[];for(let b=0,S=h.length;b<S;b++){let y=h[b].lineNumber;if(b>0&&h[b-1].lineNumber===y)continue;let w=h[b].oldContent,k=this.getLineContent(y);k.length===0||k===w||Ap(k)!==-1||v.push(y)}}return this._onDidChangeContent.fire(),new Rmt(g,f,v)}_reduceOperations(e){return e.length<1e3?e:[this._toSingleEditOperation(e)]}_toSingleEditOperation(e){let t=!1,o=e[0].range,n=e[e.length-1].range,r=new z(o.startLineNumber,o.startColumn,n.endLineNumber,n.endColumn),s=o.startLineNumber,l=o.startColumn,c=[];for(let f=0,v=e.length;f<v;f++){let b=e[f],S=b.range;t=t||b.forceMoveMarkers,c.push(this.getValueInRange(new z(s,l,S.startLineNumber,S.startColumn))),b.text.length>0&&c.push(b.text),s=S.endLineNumber,l=S.endColumn}let u=c.join(""),[p,h,g]=OS(u);return{sortIndex:0,identifier:e[0].identifier,range:r,rangeOffset:this.getOffsetAt(r.startLineNumber,r.startColumn),rangeLength:this.getValueLengthInRange(r,0),text:u,eolCount:p,firstLineLength:h,lastLineLength:g,forceMoveMarkers:t,isAutoWhitespaceEdit:!1}}_doApplyEdits(e){e.sort(a._sortOpsDescending);let t=[];for(let o=0;o<e.length;o++){let n=e[o],r=n.range.startLineNumber,s=n.range.startColumn,l=n.range.endLineNumber,c=n.range.endColumn;if(r===l&&s===c&&n.text.length===0)continue;n.text?(this._pieceTree.delete(n.rangeOffset,n.rangeLength),this._pieceTree.insert(n.rangeOffset,n.text,!0)):this._pieceTree.delete(n.rangeOffset,n.rangeLength);let u=new z(r,s,l,c);t.push({range:u,rangeLength:n.rangeLength,text:n.text,rangeOffset:n.rangeOffset,forceMoveMarkers:n.forceMoveMarkers})}return t}findMatchesLineByLine(e,t,o,n){return this._pieceTree.findMatchesLineByLine(e,t,o,n)}getPieceTree(){return this._pieceTree}static _getInverseEditRange(e,t){let o=e.startLineNumber,n=e.startColumn,[r,s,l]=OS(t),c;if(t.length>0){let u=r+1;u===1?c=new z(o,n,o,n+s):c=new z(o,n,o+u-1,l+1)}else c=new z(o,n,o,n);return c}static _getInverseEditRanges(e){let t=[],o=0,n=0,r=null;for(let s=0,l=e.length;s<l;s++){let c=e[s],u,p;r?r.range.endLineNumber===c.range.startLineNumber?(u=o,p=n+(c.range.startColumn-r.range.endColumn)):(u=o+(c.range.startLineNumber-r.range.endLineNumber),p=c.range.startColumn):(u=c.range.startLineNumber,p=c.range.startColumn);let h;if(c.text.length>0){let g=c.eolCount+1;g===1?h=new z(u,p,u,p+c.firstLineLength):h=new z(u,p,u+g-1,c.lastLineLength+1)}else h=new z(u,p,u,p);o=h.endLineNumber,n=h.endColumn,t.push(h),r=c}return t}static _sortOpsAscending(e,t){let o=z.compareRangesUsingEnds(e.range,t.range);return o===0?e.sortIndex-t.sortIndex:o}static _sortOpsDescending(e,t){let o=z.compareRangesUsingEnds(e.range,t.range);return o===0?t.sortIndex-e.sortIndex:-o}};var XZt=class{constructor(i,e,t,o,n,r,s,l,c){this._chunks=i;this._bom=e;this._cr=t;this._lf=o;this._crlf=n;this._containsRTL=r;this._containsUnusualLineTerminators=s;this._isBasicASCII=l;this._normalizeEOL=c}_getEOL(i){let e=this._cr+this._lf+this._crlf,t=this._cr+this._crlf;return e===0?i===1?`
`:`\r
`:t>e/2?`\r
`:`
`}create(i){let e=this._getEOL(i),t=this._chunks;if(this._normalizeEOL&&(e===`\r
`&&(this._cr>0||this._lf>0)||e===`
`&&(this._cr>0||this._crlf>0)))for(let n=0,r=t.length;n<r;n++){let s=t[n].buffer.replace(/\r\n|\r|\n/g,e),l=XU(s);t[n]=new JU(s,l)}let o=new N9(t,this._bom,e,this._containsRTL,this._containsUnusualLineTerminators,this._isBasicASCII,this._normalizeEOL);return{textBuffer:o,disposable:o}}getFirstLineText(i){return this._chunks[0].buffer.substr(0,i).split(/\r\n|\r|\n/)[0]}},cq=class{constructor(){this.chunks=[],this.BOM="",this._hasPreviousChar=!1,this._previousChar=0,this._tmpLineStarts=[],this.cr=0,this.lf=0,this.crlf=0,this.containsRTL=!1,this.containsUnusualLineTerminators=!1,this.isBasicASCII=!0}acceptChunk(i){if(i.length===0)return;this.chunks.length===0&&Spt(i)&&(this.BOM=m1i,i=i.substr(1));let e=i.charCodeAt(i.length-1);e===13||e>=55296&&e<=56319?(this._acceptChunk1(i.substr(0,i.length-1),!1),this._hasPreviousChar=!0,this._previousChar=e):(this._acceptChunk1(i,!1),this._hasPreviousChar=!1,this._previousChar=e)}_acceptChunk1(i,e){!e&&i.length===0||(this._hasPreviousChar?this._acceptChunk2(String.fromCharCode(this._previousChar)+i):this._acceptChunk2(i))}_acceptChunk2(i){let e=pji(this._tmpLineStarts,i);this.chunks.push(new JU(i,e.lineStarts)),this.cr+=e.cr,this.lf+=e.lf,this.crlf+=e.crlf,e.isBasicASCII||(this.isBasicASCII=!1,this.containsRTL||(this.containsRTL=yM(i)),this.containsUnusualLineTerminators||(this.containsUnusualLineTerminators=bpt(i)))}finish(i=!0){return this._finish(),new XZt(this.chunks,this.BOM,this.cr,this.lf,this.crlf,this.containsRTL,this.containsUnusualLineTerminators,this.isBasicASCII,i)}_finish(){if(this.chunks.length===0&&this._acceptChunk1("",!0),this._hasPreviousChar){this._hasPreviousChar=!1;let i=this.chunks[this.chunks.length-1];i.buffer+=String.fromCharCode(this._previousChar);let e=XU(i.buffer);i.lineStarts=e,this._previousChar===13&&this.cr++}}};var qvt=class{constructor(){this._onDidChangeVisibleRanges=new E;this.onDidChangeVisibleRanges=this._onDidChangeVisibleRanges.event;this._views=new Set;this._viewsChanged=Wc(this);this.visibleLineRanges=hs({owner:this,equalsFn:lN(C6())},i=>(this._viewsChanged.read(i),ro.joinMany([...this._views].map(t=>t.state.read(i)?.visibleLineRanges??[]))))}attachView(){let i=new ZZt(e=>{this._onDidChangeVisibleRanges.fire({view:i,state:e})});return this._views.add(i),this._viewsChanged.trigger(void 0),i}detachView(i){this._views.delete(i),this._onDidChangeVisibleRanges.fire({view:i,state:void 0}),this._viewsChanged.trigger(void 0)}dispose(){this._onDidChangeVisibleRanges.dispose()}},JZt=class{constructor(i,e){this.visibleLineRanges=i;this.stabilized=e}equals(i){return this===i?!0:!(!$i(this.visibleLineRanges,i.visibleLineRanges,(e,t)=>e.equals(t))||this.stabilized!==i.stabilized)}},ZZt=class{constructor(i){this.handleStateChange=i;this._state=rg({owner:this,equalsFn:aU((e,t)=>e.equals(t))},void 0)}get state(){return this._state}setVisibleLines(i,e){let t=i.map(n=>new ro(n.startLineNumber,n.endLineNumber+1)),o=new JZt(t,e);this._state.set(o,void 0,void 0),this.handleStateChange(o)}},jvt=class extends C{constructor(e){super();this._refreshTokens=e;this.runner=this._register(new Dt(()=>this.update(),50));this._computedLineRanges=[];this._lineRanges=[]}get lineRanges(){return this._lineRanges}update(){$i(this._computedLineRanges,this._lineRanges,(e,t)=>e.equals(t))||(this._computedLineRanges=this._lineRanges,this._refreshTokens())}handleStateChange(e){this._lineRanges=e.visibleLineRanges,e.stabilized?(this.runner.cancel(),this.update()):this.runner.schedule()}},gye=class extends C{constructor(e,t){super();this._languageIdCodec=e;this._textModel=t;this._onDidChangeTokens=this._register(new E);this.onDidChangeTokens=this._onDidChangeTokens.event;this._onDidChangeFontTokens=this._register(new E);this.onDidChangeFontTokens=this._onDidChangeFontTokens.event}get backgroundTokenizationState(){return this._backgroundTokenizationState}tokenizeIfCheap(e){this.isCheapToTokenize(e)&&this.forceTokenization(e)}};var dq=class{constructor(i,e,t,o){this.ownerId=i;this.decorationId=e;this.lineNumber=t;this.lineHeight=o}static toKey(i){return`${i.ownerId};${i.decorationId};${i.lineNumber}`}},uq=class{constructor(i,e,t){this.ownerId=i;this.decorationId=e;this.lineNumber=t}static toKey(i){return`${i.ownerId};${i.decorationId};${i.lineNumber}`}};var KAo=/\b(comment|string|regex|regexp)\b/;function mji(a){let i=a.match(KAo);if(!i)return 0;switch(i[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"regexp":return 3}throw new Error("Unexpected match for standard token type!")}function KN(a){let i=[];for(let e=1,t=a.length;e<t;e++){let o=a[e];i[e]=`.mtk${e} { color: ${o}; }`}return i.push(".mtki { font-style: italic; }"),i.push(".mtkb { font-weight: bold; }"),i.push(".mtku { text-decoration: underline; text-underline-position: under; }"),i.push(".mtks { text-decoration: line-through; }"),i.push(".mtks.mtku { text-decoration: underline line-through; text-underline-position: under; }"),i.join(`
`)}function hji(a){let i=[],e=new Set;for(let t=1,o=a.length;t<o;t++){let n=a[t];if(!n.fontFamily&&!n.fontSizeMultiplier)continue;let r=eei(n.fontFamily??"",n.fontSizeMultiplier??0);if(e.has(r))continue;e.add(r);let s=`.${r} {`;n.fontFamily&&(s+=`font-family: ${n.fontFamily};`),n.fontSizeMultiplier&&(s+=`font-size: calc(var(--editor-font-size)*${n.fontSizeMultiplier});`),s+="}",i.push(s)}return i.join(`
`)}function eei(a,i){let e=GAo(a);return gji(`font-decoration-${e}-${i}`)}function GAo(a){let i=a.toLowerCase().trim();return i?gji(i):"default"}function gji(a){return a.replace(/[^a-z0-9_-]/gi,"-")}var Mqe=class a{constructor(i=[]){this._annotations=[];this._annotations=i}setAnnotations(i){for(let e of i.annotations){let t=this._getStartIndexOfIntersectingAnnotation(e.range.start),o=this._getEndIndexOfIntersectingAnnotation(e.range.endExclusive);e.annotation!==void 0?this._annotations.splice(t,o-t,{range:e.range,annotation:e.annotation}):this._annotations.splice(t,o-t)}}getAnnotationsIntersecting(i){let e=this._getStartIndexOfIntersectingAnnotation(i.start),t=this._getEndIndexOfIntersectingAnnotation(i.endExclusive);return this._annotations.slice(e,t)}_getStartIndexOfIntersectingAnnotation(i){let e=bM(this._annotations.length,o=>this._annotations[o].range.start-i),t;if(e>=0){t=e;let o=this._annotations[t]?.range;o&&o.endExclusive===i&&t--}else{let o=this._annotations[-(e+2)]?.range;o&&i>=o.start&&i<o.endExclusive?t=-(e+2):t=-(e+1)}return t}_getEndIndexOfIntersectingAnnotation(i){let e=bM(this._annotations.length,o=>this._annotations[o].range.endExclusive-i),t;if(e>=0){t=e+1;let o=this._annotations[t]?.range;o&&o.start===i&&t++}else{let o=this._annotations[-(e+1)]?.range;o&&i>=o.start&&i<=o.endExclusive?t=-e:t=-(e+1)}return t}getAllAnnotations(){return this._annotations.slice()}applyEdit(i){let e=this._annotations.slice(),t=[],o=[],n=0;for(let r of i.replacements){for(;;){let l=e[0];if(!l)break;let c=l.range;if(c.endExclusive>=r.replaceRange.start)break;e.shift();let u={range:c.delta(n),annotation:l.annotation};u.range.isEmpty?o.push(u):t.push(u)}let s=[];for(;;){let l=e[0];if(!l||!l.range.intersectsOrTouches(r.replaceRange))break;e.shift(),s.push(l)}for(let l=s.length-1;l>=0;l--){let c=s[l],u=c.range,p=l===0&&r.replaceRange.endExclusive>u.start&&r.replaceRange.start<u.endExclusive,h=u.intersect(r.replaceRange).length;u=u.deltaEnd(-h+(p?r.newText.length:0));let g=u.start-r.replaceRange.start;g>0&&(u=u.delta(-g)),!p&&g>=0&&(u=u.delta(r.newText.length)),u=u.delta(-(r.newText.length-r.replaceRange.length)),e.unshift({annotation:c.annotation,range:u})}n+=r.newText.length-r.replaceRange.length}for(;;){let r=e[0];if(!r)break;e.shift();let s={annotation:r.annotation,range:r.range.delta(n)};s.range.isEmpty?o.push(s):t.push(s)}return this._annotations=t,o}clone(){return new a(this._annotations.slice())}},fye=class a{static create(i){return new a(i)}constructor(i){this._annotations=i}get annotations(){return this._annotations}rebase(i){let e=new Mqe(this._annotations);e.applyEdit(i),this._annotations=e.getAllAnnotations()}serialize(i){return this._annotations.map(e=>{let t={start:e.range.start,endExclusive:e.range.endExclusive};return e.annotation?{range:t,annotation:i(e.annotation)}:{range:t,annotation:void 0}})}static deserialize(i,e){let t=i.map(o=>{let n=new di(o.range.start,o.range.endExclusive);return o.annotation?{range:n,annotation:e(o.annotation)}:{range:n,annotation:void 0}});return new a(t)}};var Pqe=class a extends wse{static{this.empty=new a([])}static fromEdit(i){return new a(i.replacements.map(e=>new aae(e.replaceRange,e.getNewLength())))}static create(i){return new a(i)}static single(i){return new a([i])}static replace(i,e){return new a([new aae(i,e)])}static insert(i,e){return new a([new aae(di.emptyAt(i),e)])}static delete(i){return new a([new aae(i,0)])}static compose(i){let e=a.empty;for(let t of i)e=e.compose(t);return e}inverse(){let i=[],e=0;for(let t of this.replacements)i.push(new aae(di.ofStartAndLength(t.replaceRange.start+e,t.newLength),t.replaceRange.length)),e+=t.newLength-t.replaceRange.length;return new a(i)}_createNew(i){return new a(i)}applyArray(i,e){let t=new Array(this.getNewDataLength(i.length)),o=0,n=0;for(let r of this.replacements){for(let s=o;s<r.replaceRange.start;s++)t[n++]=i[s];o=r.replaceRange.endExclusive;for(let s=0;s<r.newLength;s++)t[n++]=e}for(;o<i.length;)t[n++]=i[o++];return t}},aae=class a extends BSe{constructor(e,t){super(e);this.newLength=t}static create(e,t,o){return new a(new di(e,t),o)}equals(e){return this.replaceRange.equals(e.replaceRange)&&this.newLength===e.newLength}getNewLength(){return this.newLength}tryJoinTouching(e){return new a(this.replaceRange.joinRightTouching(e.replaceRange),this.newLength+e.newLength)}slice(e,t){return new a(e,t.length)}toString(){return`[${this.replaceRange.start}, +${this.replaceRange.length}) -> +${this.newLength}}`}};function fji(a,i){let e=[];for(let t of a.replacements){let o=z.fromPositions(i.getPositionAt(t.replaceRange.start),i.getPositionAt(t.replaceRange.start+t.replaceRange.length));e.push(An.replace(o,t.newText))}return e}function O9(a){let i=a.map(t=>new Hc(di.ofStartAndLength(t.rangeOffset,t.rangeLength),t.text));return i.reverse(),new Qc(i)}function vji(a,i,e){let t=[];for(let o of e)for(let n of o.innerChanges??[]){let r=i.getValueInRange(n.modifiedRange),s=a.getOffsetAt(n.originalRange.getStartPosition()),l=a.getOffsetAt(n.originalRange.getEndPosition()),c=new di(s,l);t.push(new Hc(c,r))}return new Qc(t)}function tei(a){let e=a.slice().reverse().map(o=>Pqe.replace(new di(o.range.startLineNumber-1,o.range.endLineNumber),OS(o.text)[0]+1));return Pqe.compose(e)}var Qvt=class a extends C{constructor(e,t){super();this.textModel=e;this.tokenizationTextModelPart=t;this._onDidChangeLineHeight=this._register(new E);this.onDidChangeLineHeight=this._onDidChangeLineHeight.event;this._onDidChangeFont=this._register(new E);this.onDidChangeFont=this._onDidChangeFont.event;this._fontAnnotatedString=new Mqe;this._register(this.tokenizationTextModelPart.onDidChangeFontTokens(o=>{let n=new Set,r=[],s=new Set,l=new Set;for(let c of o.changes.annotations){let p=this.textModel.getPositionAt(c.range.start).lineNumber,h;if(c.annotation===void 0)h={range:c.range,annotation:void 0};else{let g=`tokenization-font-decoration-${a.DECORATION_COUNT}`,f={fontToken:c.annotation,decorationId:g};h={range:c.range,annotation:f},a.DECORATION_COUNT++,c.annotation.lineHeightMultiplier&&s.add(new dq(0,g,p,c.annotation.lineHeightMultiplier)),l.add(new uq(0,g,p))}if(r.push(h),!n.has(p)){let g=this.textModel.getOffsetAt(new Ie(p,1)),f=this.textModel.getOffsetAt(new Ie(p,this.textModel.getLineMaxColumn(p))),v=new di(g,f),b=this._fontAnnotatedString.getAnnotationsIntersecting(v);for(let S of b){let y=S.annotation.decorationId;s.add(new dq(0,y,p,null)),l.add(new uq(0,y,p))}n.add(p)}}this._fontAnnotatedString.setAnnotations(fye.create(r)),this._onDidChangeLineHeight.fire(s),this._onDidChangeFont.fire(l)}))}static{this.DECORATION_COUNT=0}handleDidChangeContent(e){let t=O9(e.changes),o=this._fontAnnotatedString.applyEdit(t);if(o.length===0)return;let n=new Set,r=new Set;for(let s of o){let c=this.textModel.getPositionAt(s.range.start).lineNumber,u=s.annotation.decorationId;n.add(new dq(0,u,c,null)),r.add(new uq(0,u,c))}this._onDidChangeLineHeight.fire(n),this._onDidChangeFont.fire(r)}getDecorationsInRange(e,t,o,n,r){let s=this.textModel.getOffsetAt(e.getStartPosition()),l=this.textModel.getOffsetAt(e.getEndPosition()),c=this._fontAnnotatedString.getAnnotationsIntersecting(new di(s,l)),u=[];for(let p of c){let h=p.annotation,g=!!(h.fontToken.fontFamily||h.fontToken.fontSizeMultiplier);if(!(g&&n)){let f=this.textModel.getPositionAt(p.range.start),v=this.textModel.getPositionAt(p.range.endExclusive),b=z.fromPositions(f,v),S=p.annotation,y=eei(S.fontToken.fontFamily??"",S.fontToken.fontSizeMultiplier??0),w=S.decorationId;u.push({id:w,options:{description:"FontOptionDecoration",inlineClassName:y,lineHeight:S.fontToken.lineHeightMultiplier,affectsFont:g},ownerId:0,range:b})}}return u}getAllDecorations(e,t){return this.getDecorationsInRange(new z(1,1,this.textModel.getLineCount(),this.textModel.getLineMaxColumn(this.textModel.getLineCount())),e,t)}};function $Ao(a,i){let e=a.gotoNextSibling(),t=i.gotoNextSibling();if(e!==t)throw new Error("Trees are out of sync");return e&&t}function iei(a,i){let e=a.gotoParent(),t=i.gotoParent();if(e!==t)throw new Error("Trees are out of sync");return e&&t}function bji(a,i,e){let t=a.gotoFirstChild(),o=i.gotoFirstChild();if(t!==o)throw new Error("Trees are out of sync");if(e===0)return t&&o;for(let n=1;n<=e;n++){let r=a.gotoNextSibling(),s=i.gotoNextSibling();if(r!==s)throw new Error("Trees are out of sync");if(!r||!s)return!1}return t&&o}function oei(a,i){do{if(a.currentNode.nextSibling)return $Ao(a,i);a.currentNode.parent&&iei(a,i)}while(a.currentNode.nextSibling||a.currentNode.parent);return!1}function Sji(a,i){let e=i.walk();e.resetTo(a);let t=a.currentNode;do if(e.currentNode.previousSibling&&e.currentNode.endIndex-e.currentNode.startIndex!==0)e.gotoPreviousSibling();else{for(;!e.currentNode.previousSibling&&e.currentNode.parent;)e.gotoParent();e.gotoPreviousSibling()}while(e.currentNode.endIndex>t.startIndex&&(e.currentNode.parent||e.currentNode.previousSibling)&&e.currentNode.id!==t.id);if(e.currentNode.id!==t.id&&e.currentNode.endIndex<=t.startIndex)return e.currentNode}var vye=class extends C{constructor(e,t,o,n,r,s,l){super();this.languageId=e;this._ranges=t;this._parser=o;this._parserClass=n;this.textModel=r;this._logService=s;this._telemetryService=l;this._tree=Le(this,void 0);this.tree=this._tree;this._treeLastParsedVersion=Le(this,-1);this.treeLastParsedVersion=this._treeLastParsedVersion;this._onDidChangeContentQueue=new Pbe;this._tree=Le(this,void 0),this.tree=this._tree,this._register(Z(()=>{this._tree.get()?.delete(),this._lastFullyParsed?.delete(),this._lastFullyParsedWithEdits?.delete(),this._parser.delete()})),this.handleContentChange(void 0,this._ranges)}handleContentChange(e,t){let o=this.textModel.getVersionId(),n=[];t&&(n=this._setRanges(t)),e&&this._applyEdits(e.changes),this._onDidChangeContentQueue.clearPending(),this._onDidChangeContentQueue.schedule(async()=>{if(this._store.isDisposed)return;let r=this._lastFullyParsed,s;this._lastFullyParsedWithEdits&&this._lastFullyParsed&&(s=this._findChangedNodes(this._lastFullyParsedWithEdits,this._lastFullyParsed));let l=await this._parseAndUpdateTree(o);if(l){let c;s?r&&s&&(c=this._findTreeChanges(l,s,n)):this._ranges&&(c=this._ranges.map(p=>({newRange:new z(p.startPosition.row+1,p.startPosition.column+1,p.endPosition.row+1,p.endPosition.column+1),oldRangeLength:p.endIndex-p.startIndex,newRangeStartOffset:p.startIndex,newRangeEndOffset:p.endIndex}))),c||(c=[{newRange:this.textModel.getFullModelRange(),newRangeStartOffset:0,newRangeEndOffset:this.textModel.getValueLength()}]);let u=this._tree.get();Ui(p=>{this._tree.set(l,p,{ranges:c,versionId:o}),this._treeLastParsedVersion.set(o,p)}),u?.delete()}})}get ranges(){return this._ranges}getInjectionTrees(e,t){}_applyEdits(e){for(let t of e){let o=Zl.ofRange(z.lift(t.range)),n=Zl.ofText(t.text),r=t.text.length===0?n:o.add(n),s={startIndex:t.rangeOffset,oldEndIndex:t.rangeOffset+t.rangeLength,newEndIndex:t.rangeOffset+t.text.length,startPosition:{row:t.range.startLineNumber-1,column:t.range.startColumn-1},oldEndPosition:{row:t.range.endLineNumber-1,column:t.range.endColumn-1},newEndPosition:{row:t.range.startLineNumber+r.lineCount-1,column:r.lineCount?r.columnCount:t.range.endColumn+r.columnCount}};this._tree.get()?.edit(s),this._lastFullyParsedWithEdits?.edit(s)}}_findChangedNodes(e,t){if(this._ranges&&this._ranges.every(l=>l.startPosition.row!==e.rootNode.startPosition.row)||e.rootNode.startPosition.row!==0)return[];let o=e.walk(),n=t.walk(),r=[],s=!0;do if(o.currentNode.hasChanges){let l=o.currentNode.children,c=[],u=l.filter((p,h)=>p?.hasChanges||n.currentNode.children.length<=h?(c.push(h),!0):!1);if(u.length===0||o.currentNode.hasError!==n.currentNode.hasError){for(;o.currentNode.parent&&s&&!o.currentNode.isNamed;)s=iei(o,n);let p=o.currentNode,h=Sji(o,e)??p;r.push({startIndex:h.startIndex,endIndex:p.endIndex,startPosition:h.startPosition,endPosition:p.endPosition}),s=oei(o,n)}else u.length>=1&&(s=bji(o,n,c[0]))}else s=oei(o,n);while(s);return o.delete(),n.delete(),r}_findTreeChanges(e,t,o){let n=0,r=[];for(let s=0;s<t.length;s++){let l=t[s];if(r.length>0&&l.startIndex>=r[r.length-1].newRangeStartOffset&&l.endIndex<=r[r.length-1].newRangeEndOffset)continue;let c=e.walk(),u=()=>c.startIndex<l.startIndex&&c.endIndex>l.endIndex;for(;u();){let b=c.gotoFirstChild(),S=!1;for(;b;)if(u()&&c.currentNode.isNamed){S=!0;break}else b=c.gotoNextSibling();if(!S){c.gotoParent();break}if(c.currentNode.childCount===0)break}let p=c.currentNode.startPosition,h=c.currentNode.endPosition,g=c.currentNode.startIndex,f=c.currentNode.endIndex,v={newRange:new z(p.row+1,p.column+1,h.row+1,h.column+1),newRangeStartOffset:g,newRangeEndOffset:f};n<o.length&&Iji(o[n],{startIndex:g,endIndex:f,startPosition:p,endPosition:h})?(o[n].startIndex<v.newRangeStartOffset&&(v.newRange=v.newRange.setStartPosition(o[n].startPosition.row+1,o[n].startPosition.column+1),v.newRangeStartOffset=o[n].startIndex),o[n].endIndex>v.newRangeEndOffset&&(v.newRange=v.newRange.setEndPosition(o[n].endPosition.row+1,o[n].endPosition.column+1),v.newRangeEndOffset=o[n].endIndex),n++):n<o.length&&o[n].endIndex<v.newRangeStartOffset&&r.push({newRange:new z(o[n].startPosition.row+1,o[n].startPosition.column+1,o[n].endPosition.row+1,o[n].endPosition.column+1),newRangeStartOffset:o[n].startIndex,newRangeEndOffset:o[n].endIndex}),r.length>0&&r[r.length-1].newRangeEndOffset>=v.newRangeStartOffset?(r[r.length-1].newRange=z.fromPositions(r[r.length-1].newRange.getStartPosition(),v.newRange.getEndPosition()),r[r.length-1].newRangeEndOffset=v.newRangeEndOffset):r.push(v)}return this._constrainRanges(r)}_constrainRanges(e){if(!this._ranges)return e;let t=[],o=0,n=0;for(;o<e.length&&n<this._ranges.length;){let r=e[o],s=this._ranges[n];if(r.newRangeEndOffset<s.startIndex)o++;else if(r.newRangeStartOffset>s.endIndex)n++;else{let l=Math.max(r.newRangeStartOffset,s.startIndex),c=Math.min(r.newRangeEndOffset,s.endIndex),u=r.newRange.intersectRanges(new z(s.startPosition.row+1,s.startPosition.column+1,s.endPosition.row+1,s.endPosition.column+1));t.push({newRange:u,newRangeEndOffset:c,newRangeStartOffset:l}),c<r.newRangeEndOffset?(r.newRange=z.fromPositions(u.getEndPosition(),r.newRange.getEndPosition()),r.newRangeStartOffset=c+1):o++}}return t}async _parseAndUpdateTree(e){let t=await this._parse();if(t)return this._lastFullyParsed?.delete(),this._lastFullyParsed=t.copy(),this._lastFullyParsedWithEdits?.delete(),this._lastFullyParsedWithEdits=t.copy(),t;this._tree.get()||this._parser.reset()}_parse(){let e="fullParse";return this._tree.get()&&(e="incrementalParse"),this._parseAndYield(e)}async _parseAndYield(e){let t=0,o=0,n=this.textModel.getVersionId(),r,s=qAo();do{let l=performance.now();r=this._parser.parse((c,u)=>this._parseCallback(c),this._tree.get(),{progressCallback:s,includedRanges:this._ranges}),t+=performance.now()-l,o++,await new Promise(c=>Vw(c))}while(!this._store.isDisposed&&!r&&n===this.textModel.getVersionId());return this._sendParseTimeTelemetry(e,t,o),r&&n===this.textModel.getVersionId()?r:void 0}_parseCallback(e){try{return this.textModel.getTextBuffer().getNearestChunk(e)}catch(t){this._logService.debug("Error getting chunk for tree-sitter parsing",t)}}_setRanges(e){let t=[];if(this._ranges)for(let o of e){let n=!1;for(let r=0;r<this._ranges.length;r++){let s=this._ranges[r];if(jAo(s,o)||Iji(s,o)){n=!0;break}}n||t.push(o)}else t.push(...e);return this._ranges=e,t}_sendParseTimeTelemetry(e,t,o){this._logService.debug(`Tree parsing (${e}) took ${t} ms and ${o} passes.`),e==="fullParse"?this._telemetryService.publicLog2("treeSitter.fullParse",{languageId:this.languageId,time:t,passes:o}):this._telemetryService.publicLog2("treeSitter.incrementalParse",{languageId:this.languageId,time:t,passes:o})}createParsedTreeSync(e){let t=new this._parserClass;t.setLanguage(this._parser.language);let o=t.parse(e);return t.delete(),o??void 0}};vye=I([m(5,ne),m(6,Te)],vye);function qAo(){let a=performance.now();return function(e){let t=performance.now();return t-a>50?(a=t,!0):!1}}function jAo(a,i){return a.startPosition.row===i.startPosition.row&&a.startPosition.column===i.startPosition.column&&a.endPosition.row===i.endPosition.row&&a.endPosition.column===i.endPosition.column&&a.startIndex===i.startIndex&&a.endIndex===i.endIndex}function Iji(a,i){return a.startIndex<=i.startIndex&&a.endIndex>=i.startIndex||i.startIndex<=a.startIndex&&i.endIndex>=a.startIndex}var nei=new class{clone(){return this}equals(a){return this===a}};function bye(a,i){let e=new Uint32Array(2);return e[0]=0,e[1]=(a<<0|0|0|32768|2<<24)>>>0,new fse(e,[],i===null?nei:i)}var Yvt=class{constructor(i){this._default=i;this._store=[]}get(i){return i<this._store.length?this._store[i]:this._default}set(i,e){for(;i>=this._store.length;)this._store[this._store.length]=this._default;this._store[i]=e}replace(i,e,t){if(i>=this._store.length)return;if(e===0){this.insert(i,t);return}else if(t===0){this.delete(i,e);return}let o=this._store.slice(0,i),n=this._store.slice(i+e),r=QAo(t,this._default);this._store=o.concat(r,n)}delete(i,e){e===0||i>=this._store.length||this._store.splice(i,e)}insert(i,e){if(e===0||i>=this._store.length)return;let t=[];for(let o=0;o<e;o++)t[o]=this._default;this._store=UH(this._store,i,t)}};function QAo(a,i){let e=[];for(let t=0;t<a;t++)e[t]=i;return e}var ZU=new Uint32Array(0).buffer,UI=class a{static deleteBeginning(i,e){return i===null||i===ZU?i:a.delete(i,0,e)}static deleteEnding(i,e){if(i===null||i===ZU)return i;let t=e1(i),o=t[t.length-2];return a.delete(i,e,o)}static delete(i,e,t){if(i===null||i===ZU||e===t)return i;let o=e1(i),n=o.length>>>1;if(e===0&&o[o.length-2]===t)return ZU;let r=Bc.findIndexInTokensArray(o,e),s=r>0?o[r-1<<1]:0,l=o[r<<1];if(t<l){let g=t-e;for(let f=r;f<n;f++)o[f<<1]-=g;return i}let c,u;s!==e?(o[r<<1]=e,c=r+1<<1,u=e):(c=r<<1,u=s);let p=t-e;for(let g=r+1;g<n;g++){let f=o[g<<1]-p;f>u&&(o[c++]=f,o[c++]=o[(g<<1)+1],u=f)}if(c===o.length)return i;let h=new Uint32Array(c);return h.set(o.subarray(0,c),0),h.buffer}static append(i,e){if(e===ZU)return i;if(i===ZU)return e;if(i===null)return i;if(e===null)return null;let t=e1(i),o=e1(e),n=o.length>>>1,r=new Uint32Array(t.length+o.length);r.set(t,0);let s=t.length,l=t[t.length-2];for(let c=0;c<n;c++)r[s++]=o[c<<1]+l,r[s++]=o[(c<<1)+1];return r.buffer}static insert(i,e,t){if(i===null||i===ZU)return i;let o=e1(i),n=o.length>>>1,r=Bc.findIndexInTokensArray(o,e);r>0&&o[r-1<<1]===e&&r--;for(let s=r;s<n;s++)o[s<<1]+=t;return i}};function e1(a){return a instanceof Uint32Array?a:new Uint32Array(a)}var Aqe=class a{static deserialize(i,e,t){let o=new Uint32Array(i.buffer),n=DI(i,e);e+=4;let r=DI(i,e);e+=4;let s=[];for(let l=0;l<r;l++){let c=DI(i,e);e+=4,s.push(o.subarray(e/4,e/4+c/4)),e+=c}return t.push(new a(n,s)),e}get startLineNumber(){return this._startLineNumber}get endLineNumber(){return this._startLineNumber+this._tokens.length-1}constructor(i,e){this._startLineNumber=i,this._tokens=e}getLineRange(){return new ro(this._startLineNumber,this._startLineNumber+this._tokens.length)}getLineTokens(i){return this._tokens[i-this._startLineNumber]}appendLineTokens(i){this._tokens.push(i)}serializeSize(){let i=0;i+=4,i+=4;for(let e=0;e<this._tokens.length;e++){let t=this._tokens[e];if(!(t instanceof Uint32Array))throw new Error("Not supported!");i+=4,i+=t.byteLength}return i}serialize(i,e){LI(i,this._startLineNumber,e),e+=4,LI(i,this._tokens.length,e),e+=4;for(let t=0;t<this._tokens.length;t++){let o=this._tokens[t];if(!(o instanceof Uint32Array))throw new Error("Not supported!");LI(i,o.byteLength,e),e+=4,i.set(new Uint8Array(o.buffer),e),e+=o.byteLength}return e}applyEdit(i,e){let[t,o]=OS(e);this._acceptDeleteRange(i),this._acceptInsertText(new Ie(i.startLineNumber,i.startColumn),t,o)}_acceptDeleteRange(i){if(i.startLineNumber===i.endLineNumber&&i.startColumn===i.endColumn)return;let e=i.startLineNumber-this._startLineNumber,t=i.endLineNumber-this._startLineNumber;if(t<0){let o=t-e;this._startLineNumber-=o;return}if(!(e>=this._tokens.length)){if(e<0&&t>=this._tokens.length){this._startLineNumber=0,this._tokens=[];return}if(e===t){this._tokens[e]=UI.delete(this._tokens[e],i.startColumn-1,i.endColumn-1);return}if(e>=0)if(this._tokens[e]=UI.deleteEnding(this._tokens[e],i.startColumn-1),t<this._tokens.length){let o=UI.deleteBeginning(this._tokens[t],i.endColumn-1);this._tokens[e]=UI.append(this._tokens[e],o),this._tokens.splice(e+1,t-e)}else this._tokens[e]=UI.append(this._tokens[e],null),this._tokens=this._tokens.slice(0,e+1);else{let o=-e;this._startLineNumber-=o,this._tokens[t]=UI.deleteBeginning(this._tokens[t],i.endColumn-1),this._tokens=this._tokens.slice(t)}}}_acceptInsertText(i,e,t){if(e===0&&t===0)return;let o=i.lineNumber-this._startLineNumber;if(o<0){this._startLineNumber+=e;return}if(!(o>=this._tokens.length)){if(e===0){this._tokens[o]=UI.insert(this._tokens[o],i.column-1,t);return}this._tokens[o]=UI.deleteEnding(this._tokens[o],i.column-1),this._tokens[o]=UI.insert(this._tokens[o],i.column-1,t),this._insertLines(i.lineNumber,e)}}_insertLines(i,e){if(e===0)return;let t=[];for(let o=0;o<e;o++)t[o]=null;this._tokens=UH(this._tokens,i,t)}};var t1=class{static deserialize(i){let e=0,t=DI(i,e);e+=4;let o=[];for(let n=0;n<t;n++)e=Aqe.deserialize(i,e,o);return o}constructor(){this._tokens=[]}add(i,e){if(this._tokens.length>0){let t=this._tokens[this._tokens.length-1];if(t.endLineNumber+1===i){t.appendLineTokens(e);return}}this._tokens.push(new Aqe(i,[e]))}finalize(){return this._tokens}serialize(){let i=this._serializeSize(),e=new Uint8Array(i);return this._serialize(e),e}_serializeSize(){let i=0;i+=4;for(let e=0;e<this._tokens.length;e++)i+=this._tokens[e].serializeSize();return i}_serialize(i){let e=0;LI(i,this._tokens.length,e),e+=4;for(let t=0;t<this._tokens.length;t++)e=this._tokens[t].serialize(i,e)}};var rei=class{constructor(i,e){this.tokenizationSupport=e;this.initialState=this.tokenizationSupport.getInitialState(),this.store=new Sye(i)}getStartState(i){return this.store.getStartState(i,this.initialState)}getFirstInvalidLine(){return this.store.getFirstInvalidLine(this.initialState)}},Xvt=class extends rei{constructor(e,t,o,n){super(e,t);this._textModel=o;this._languageIdCodec=n}updateTokensUntilLine(e,t){let o=this._textModel.getLanguageId();for(;;){let n=this.getFirstInvalidLine();if(!n||n.lineNumber>t)break;let r=this._textModel.getLineContent(n.lineNumber),s=Nqe(this._languageIdCodec,o,this.tokenizationSupport,r,!0,n.startState);e.add(n.lineNumber,s.tokens),this.store.setEndState(n.lineNumber,s.endState)}}getTokenTypeIfInsertingCharacter(e,t){let o=this.getStartState(e.lineNumber);if(!o)return 0;let n=this._textModel.getLanguageId(),r=this._textModel.getLineContent(e.lineNumber),s=r.substring(0,e.column-1)+t+r.substring(e.column-1),l=Nqe(this._languageIdCodec,n,this.tokenizationSupport,s,!0,o),c=new Bc(l.tokens,s,this._languageIdCodec);if(c.getCount()===0)return 0;let u=c.findTokenIndexAtOffset(e.column-1);return c.getStandardTokenType(u)}tokenizeLinesAt(e,t){let o=this.getStartState(e);if(!o)return null;let n=this._textModel.getLanguageId(),r=[],s=o;for(let l of t){let c=Nqe(this._languageIdCodec,n,this.tokenizationSupport,l,!0,s);r.push(new Bc(c.tokens,l,this._languageIdCodec)),s=c.endState}return r}hasAccurateTokensForLine(e){let t=this.store.getFirstInvalidEndStateLineNumberOrMax();return e<t}isCheapToTokenize(e){let t=this.store.getFirstInvalidEndStateLineNumberOrMax();return e<t||e===t&&this._textModel.getLineLength(e)<2048}tokenizeHeuristically(e,t,o){if(o<=this.store.getFirstInvalidEndStateLineNumberOrMax())return{heuristicTokens:!1};if(t<=this.store.getFirstInvalidEndStateLineNumberOrMax())return this.updateTokensUntilLine(e,o),{heuristicTokens:!1};let n=this.guessStartState(t),r=this._textModel.getLanguageId();for(let s=t;s<=o;s++){let l=this._textModel.getLineContent(s),c=Nqe(this._languageIdCodec,r,this.tokenizationSupport,l,!0,n);e.add(s,c.tokens),n=c.endState}return{heuristicTokens:!0}}guessStartState(e){let{likelyRelevantLines:t,initialState:o}=aei(this._textModel,e,this);o||(o=this.tokenizationSupport.getInitialState());let n=this._textModel.getLanguageId(),r=o;for(let s of t)r=Nqe(this._languageIdCodec,n,this.tokenizationSupport,s,!1,r).endState;return r}};function aei(a,i,e){let t=a.getLineFirstNonWhitespaceColumn(i),o=[],n=null;for(let r=i-1;t>1&&r>=1;r--){let s=a.getLineFirstNonWhitespaceColumn(r);if(s!==0&&s<t&&(o.push(a.getLineContent(r)),t=s,n=e?.getStartState(r),n))break}return o.reverse(),{likelyRelevantLines:o,initialState:n??void 0}}var Sye=class{constructor(i){this.lineCount=i;this._tokenizationStateStore=new Oqe;this._invalidEndStatesLineNumbers=new sei;this._invalidEndStatesLineNumbers.addRange(new di(1,i+1))}getEndState(i){return this._tokenizationStateStore.getEndState(i)}setEndState(i,e){if(!e)throw new ni("Cannot set null/undefined state");this._invalidEndStatesLineNumbers.delete(i);let t=this._tokenizationStateStore.setEndState(i,e);return t&&i<this.lineCount&&this._invalidEndStatesLineNumbers.addRange(new di(i+1,i+2)),t}acceptChange(i,e){this.lineCount+=e-i.length,this._tokenizationStateStore.acceptChange(i,e),this._invalidEndStatesLineNumbers.addRangeAndResize(new di(i.startLineNumber,i.endLineNumberExclusive),e)}acceptChanges(i){for(let e of i){let[t]=OS(e.text);this.acceptChange(new ro(e.range.startLineNumber,e.range.endLineNumber+1),t+1)}}invalidateEndStateRange(i){this._invalidEndStatesLineNumbers.addRange(new di(i.startLineNumber,i.endLineNumberExclusive))}getFirstInvalidEndStateLineNumber(){return this._invalidEndStatesLineNumbers.min}getFirstInvalidEndStateLineNumberOrMax(){return this.getFirstInvalidEndStateLineNumber()||Number.MAX_SAFE_INTEGER}allStatesValid(){return this._invalidEndStatesLineNumbers.min===null}getStartState(i,e){return i===1?e:this.getEndState(i-1)}getFirstInvalidLine(i){let e=this.getFirstInvalidEndStateLineNumber();if(e===null)return null;let t=this.getStartState(e,i);if(!t)throw new ni("Start state must be defined");return{lineNumber:e,startState:t}}},Oqe=class{constructor(){this._lineEndStates=new Yvt(null)}getEndState(i){return this._lineEndStates.get(i)}setEndState(i,e){let t=this._lineEndStates.get(i);return t&&t.equals(e)?!1:(this._lineEndStates.set(i,e),!0)}acceptChange(i,e){let t=i.length;e>0&&t>0&&(t--,e--),this._lineEndStates.replace(i.startLineNumber,t,e)}acceptChanges(i){for(let e of i){let[t]=OS(e.text);this.acceptChange(new ro(e.range.startLineNumber,e.range.endLineNumber+1),t+1)}}},sei=class{constructor(){this._ranges=[]}getRanges(){return this._ranges}get min(){return this._ranges.length===0?null:this._ranges[0].start}removeMin(){if(this._ranges.length===0)return null;let i=this._ranges[0];return i.start+1===i.endExclusive?this._ranges.shift():this._ranges[0]=new di(i.start+1,i.endExclusive),i.start}delete(i){let e=this._ranges.findIndex(t=>t.contains(i));if(e!==-1){let t=this._ranges[e];t.start===i?t.endExclusive===i+1?this._ranges.splice(e,1):this._ranges[e]=new di(i+1,t.endExclusive):t.endExclusive===i+1?this._ranges[e]=new di(t.start,i):this._ranges.splice(e,1,new di(t.start,i),new di(i+1,t.endExclusive))}}addRange(i){di.addRange(i,this._ranges)}addRangeAndResize(i,e){let t=0;for(;!(t>=this._ranges.length||i.start<=this._ranges[t].endExclusive);)t++;let o=t;for(;!(o>=this._ranges.length||i.endExclusive<this._ranges[o].start);)o++;let n=e-i.length;for(let r=o;r<this._ranges.length;r++)this._ranges[r]=this._ranges[r].delta(n);if(t===o){let r=new di(i.start,i.start+e);r.isEmpty||this._ranges.splice(t,0,r)}else{let r=Math.min(i.start,this._ranges[t].start),s=Math.max(i.endExclusive,this._ranges[o-1].endExclusive),l=new di(r,s+n);l.isEmpty?this._ranges.splice(t,o-t):this._ranges.splice(t,o-t,l)}}toString(){return this._ranges.map(i=>i.toString()).join(" + ")}};function Nqe(a,i,e,t,o,n){let r=null;if(e)try{r=e.tokenizeEncoded(t,o,n.clone())}catch(s){mt(s)}return r||(r=bye(a.encodeLanguageId(i),n)),Bc.convertToEndOffset(r.tokens,t.length),r}var Jvt=class{constructor(i,e){this._tokenizerWithStateStore=i;this._backgroundTokenStore=e;this._isDisposed=!1;this._isScheduled=!1}dispose(){this._isDisposed=!0}handleChanges(){this._beginBackgroundTokenization()}_beginBackgroundTokenization(){this._isScheduled||!this._tokenizerWithStateStore._textModel.isAttachedToEditor()||!this._hasLinesToTokenize()||(this._isScheduled=!0,aN(i=>{this._isScheduled=!1,this._backgroundTokenizeWithDeadline(i)}))}_backgroundTokenizeWithDeadline(i){let e=Date.now()+i.timeRemaining(),t=()=>{this._isDisposed||!this._tokenizerWithStateStore._textModel.isAttachedToEditor()||!this._hasLinesToTokenize()||(this._backgroundTokenizeForAtLeast1ms(),Date.now()<e?Vw(t):this._beginBackgroundTokenization())};t()}_backgroundTokenizeForAtLeast1ms(){let i=this._tokenizerWithStateStore._textModel.getLineCount(),e=new t1,t=En.create(!1);do if(t.elapsed()>1||this._tokenizeOneInvalidLine(e)>=i)break;while(this._hasLinesToTokenize());this._backgroundTokenStore.setTokens(e.finalize()),this.checkFinished()}_hasLinesToTokenize(){return this._tokenizerWithStateStore?!this._tokenizerWithStateStore.store.allStatesValid():!1}_tokenizeOneInvalidLine(i){let e=this._tokenizerWithStateStore?.getFirstInvalidLine();return e?(this._tokenizerWithStateStore.updateTokensUntilLine(i,e.lineNumber),e.lineNumber):this._tokenizerWithStateStore._textModel.getLineCount()+1}checkFinished(){this._isDisposed||this._tokenizerWithStateStore.store.allStatesValid()&&this._backgroundTokenStore.backgroundTokenizationFinished()}requestTokens(i,e){this._tokenizerWithStateStore.store.invalidateEndStateRange(new ro(i,e))}};var pq=class a{constructor(i){this.height=i;this._children=[];this._length=0}get children(){return this._children}get length(){return this._length}static create(i,e){let t=new a(i.height+1);return t.appendChild(i),t.appendChild(e),t}canAppendChild(){return this._children.length<3}appendChild(i){if(!this.canAppendChild())throw new Error("Cannot insert more than 3 children in a ListNode");this._children.push(i),this._length+=i.length,this._updateParentLength(i.length),FS(i)||(i.parent=this)}_updateParentLength(i){let e=this.parent;for(;e;)e._length+=i,e=e.parent}unappendChild(){let i=this._children.pop();return this._length-=i.length,this._updateParentLength(-i.length),i}prependChild(i){if(this._children.length>=3)throw new Error("Cannot prepend more than 3 children in a ListNode");this._children.unshift(i),this._length+=i.length,this._updateParentLength(i.length),FS(i)||(i.parent=this)}unprependChild(){let i=this._children.shift();return this._length-=i.length,this._updateParentLength(-i.length),i}lastChild(){return this._children[this._children.length-1]}dispose(){this._children.splice(0,this._children.length)}};function FS(a){return a.token!==void 0}function yji(a,i){let e=a,t=[],o;for(;;){if(i.height===e.height){o=i;break}if(FS(e))throw new Error("unexpected");t.push(e),e=e.lastChild()}for(let n=t.length-1;n>=0;n--){let r=t[n];o&&(r.children.length>=3?o=pq.create(r.unappendChild(),o):(r.appendChild(o),o=void 0))}if(o){let n=new pq(o.height+1);return n.appendChild(a),n.appendChild(o),n}else return a}function YAo(a,i){let e=a,t=[];for(;i.height!==e.height;){if(FS(e))throw new Error("unexpected");t.push(e),e=e.children[0]}let o=i;for(let n=t.length-1;n>=0;n--){let r=t[n];o&&(r.children.length>=3?o=pq.create(o,r.unprependChild()):(r.prependChild(o),o=void 0))}return o?pq.create(o,a):a}function XAo(a,i){return a.height===i.height?pq.create(a,i):a.height>i.height?yji(a,i):YAo(i,a)}var Zvt=class a{constructor(i){this._textModel=i;this._root=this.createEmptyRoot()}get root(){return this._root}createEmptyRoot(){return{length:this._textModel.getValueLength(),token:0,height:0,tokenQuality:0}}buildStore(i,e){this._root=this.createFromUpdates(i,e)}createFromUpdates(i,e){if(i.length===0)return this.createEmptyRoot();let t={length:i[0].length,token:i[0].token,height:0,tokenQuality:e};for(let o=1;o<i.length;o++)t=yji(t,{length:i[o].length,token:i[o].token,height:0,tokenQuality:e});return t}update(i,e,t){e.length!==0&&this.replace(i,e[0].startOffsetInclusive,e,t)}delete(i,e){this.replace(i,e,[],2)}replace(i,e,t,o){let n=e+i,r=[],s=[],l=[{node:this._root,offset:0}];for(;l.length>0;){let p=l.pop(),h=p.offset;if(h<e&&h+p.node.length<=e){FS(p.node)||(p.node.parent=void 0),r.push(p.node);continue}else FS(p.node)&&h<e&&r.push({length:e-h,token:p.node.token,height:0,tokenQuality:p.node.tokenQuality});if(!(e<=h&&h+p.node.length<=n)){if(h>=n){FS(p.node)||(p.node.parent=void 0),s.push(p.node);continue}else if(FS(p.node)&&h+p.node.length>n){s.push({length:h+p.node.length-n,token:p.node.token,height:0,tokenQuality:p.node.tokenQuality});continue}if(!FS(p.node)){let g=h+p.node.length;for(let f=p.node.children.length-1;f>=0;f--)g-=p.node.children[f].length,l.push({node:p.node.children[f],offset:g})}}}let c;t.length>0?c=r.concat(this.createFromUpdates(t,o),s):c=r.concat(s);let u=c[0];for(let p=1;p<c.length;p++)u=XAo(u,c[p]);this._root=u??this.createEmptyRoot()}traverseInOrderInRange(i,e,t){let o=[{node:this._root,offset:0}];for(;o.length>0;){let{node:n,offset:r}=o.pop();if(!(r+n.length<=i||r>=e)){if(t(n,r))return;if(!FS(n)){let l=r+n.length;for(let c=n.children.length-1;c>=0;c--)l-=n.children[c].length,o.push({node:n.children[c],offset:l})}}}}getTokenAt(i){let e;return this.traverseInOrderInRange(i,this._root.length,(t,o)=>FS(t)?(e={token:t.token,startOffsetInclusive:o,length:t.length},!0):!1),e}getTokensInRange(i,e){let t=[];return this.traverseInOrderInRange(i,e,(o,n)=>{if(FS(o)){let r=o.length,s=n;n<i&&n+o.length>e?(s=i,r=e-i):n<i?(r-=i-n,s=i):n+o.length>e&&(r-=n+o.length-e),t.push({token:o.token,startOffsetInclusive:s,length:r})}return!1}),t}markForRefresh(i,e){this.traverseInOrderInRange(i,e,t=>(FS(t)&&(t.tokenQuality=0),!1))}rangeHasTokens(i,e,t){let o=!0;return this.traverseInOrderInRange(i,e,n=>(FS(n)&&n.tokenQuality<t&&(o=!1),!1)),o}rangeNeedsRefresh(i,e){let t=!1;return this.traverseInOrderInRange(i,e,o=>(FS(o)&&o.tokenQuality!==3&&(t=!0),!1)),t}getNeedsRefresh(){let i=[];return this.traverseInOrderInRange(0,this._textModel.getValueLength(),(e,t)=>(FS(e)&&e.tokenQuality!==3&&(i.length>0&&i[i.length-1].endOffset===t?i[i.length-1].endOffset+=e.length:i.push({startOffset:t,endOffset:t+e.length})),!1)),i}deepCopy(){let i=new a(this._textModel);return i._root=this._copyNodeIterative(this._root),i}_copyNodeIterative(i){let e=FS(i)?{length:i.length,token:i.token,tokenQuality:i.tokenQuality,height:i.height}:new pq(i.height),t=[[i,e]];for(;t.length>0;){let[o,n]=t.pop();if(!FS(o))for(let r of o.children){let s=FS(r)?{length:r.length,token:r.token,tokenQuality:r.tokenQuality,height:r.height}:new pq(r.height);n.appendChild(s),t.push([r,s])}}return e}printTree(i=this._root){let e=[],t=[[i,0]];for(;t.length>0;){let[o,n]=t.pop(),r=" ".repeat(n);if(FS(o))e.push(`${r}Leaf(length: ${o.length}, token: ${o.token}, refresh: ${o.tokenQuality})
`);else{e.push(`${r}List(length: ${o.length})
`);for(let s=o.children.length-1;s>=0;s--)t.push([o.children[s],n+1])}}return e.join("")}dispose(){let i=[[this._root,!1]];for(;i.length>0;){let[e,t]=i.pop();if(!FS(e))if(t)e.dispose(),e.parent=void 0;else{i.push([e,!0]);for(let o=e.children.length-1;o>=0;o--)i.push([e.children[o],!1])}}this._root=void 0}};var ebt=ae("treeSitterThemeService");var Iye=class extends C{constructor(e,t,o,n,r){super();this._tree=e;this._highlightingQueries=t;this._languageIdCodec=o;this._visibleLineRanges=n;this._treeSitterThemeService=r;this._onDidChangeTokens=this._register(new E);this.onDidChangeTokens=this._onDidChangeTokens.event;this._onDidCompleteBackgroundTokenization=this._register(new E);this.onDidChangeBackgroundTokenization=this._onDidCompleteBackgroundTokenization.event;this._encodedLanguageId=this._languageIdCodec.encodeLanguageId(this._tree.languageId),this._register(_s(this._treeSitterThemeService.onChange,()=>{this._updateTheme()})),this._tokenStore=this._register(new Zvt(this._textModel)),this._accurateVersion=this._textModel.getVersionId(),this._guessVersion=this._textModel.getVersionId(),this._tokenStore.buildStore(this._createEmptyTokens(),0),this._register(he(s=>{let l=this._visibleLineRanges.read(s);this._parseAndTokenizeViewPort(l)})),this._register(xM({owner:this,changeTracker:U9t({tree:this._tree.tree})},(s,l)=>{let c=l.changes.at(0)?.change;if(l.changes.length>1)throw new ni("The tree changed twice in one transaction. This is currently not supported and should not happen.");if(!c)l.tree&&this._firstTreeUpdate(this._tree.treeLastParsedVersion.read(s));else{if(this.hasTokens())for(let u of c.ranges)this._markForRefresh(u.newRange);this.hasTokens()?this._handleTreeUpdate(c.ranges,c.versionId):this._firstTreeUpdate(c.versionId)}}))}get _textModel(){return this._tree.textModel}handleContentChanged(e){this._guessVersion=e.versionId;for(let t of e.changes)if(t.text.length>t.rangeLength){let o=t.rangeOffset>0?t.rangeOffset-1:t.rangeOffset,n=this._tokenStore.getTokenAt(o),r;n?(r={startOffsetInclusive:n.startOffsetInclusive,length:n.length+t.text.length-t.rangeLength,token:n.token},this._tokenStore.markForRefresh(o,t.rangeOffset+(t.text.length>t.rangeLength?t.text.length:t.rangeLength))):r={startOffsetInclusive:o,length:t.text.length,token:0},this._tokenStore.update(n?.length??0,[r],2)}else if(t.text.length<t.rangeLength){let o=t.rangeLength-t.text.length;this._tokenStore.delete(o,t.rangeOffset)}}getLineTokens(e){let t=this._textModel.getLineContent(e),o=this.getTokens(e);return new Bc(o,t,this._languageIdCodec)}_createEmptyTokens(){let e=this._emptyToken(),t=this._textModel.getValueLength();return[this._emptyTokensForOffsetAndLength(0,t,e)]}_emptyToken(){return this._treeSitterThemeService.findMetadata([],this._encodedLanguageId,!1,void 0)}_emptyTokensForOffsetAndLength(e,t,o){return{token:o,length:e+t,startOffsetInclusive:0}}hasAccurateTokensForLine(e){return this.hasTokens(new z(e,1,e,this._textModel.getLineMaxColumn(e)))}tokenizeLinesAt(e,t){let o=this._guessTokensForLinesContent(e,t),n=[];if(!o)return null;for(let r=0;r<o.length;r++)n.push(new Bc(o[r],t[r],this._languageIdCodec));return n}_rangeHasTokens(e,t){return this._tokenStore.rangeHasTokens(this._textModel.getOffsetAt(e.getStartPosition()),this._textModel.getOffsetAt(e.getEndPosition()),t)}hasTokens(e){return!e||this._guessVersion===this._accurateVersion?!0:!this._tokenStore.rangeNeedsRefresh(this._textModel.getOffsetAt(e.getStartPosition()),this._textModel.getOffsetAt(e.getEndPosition()))}getTokens(e){let t=this._textModel.getOffsetAt({lineNumber:e,column:1}),o=this._textModel.getOffsetAt({lineNumber:e,column:this._textModel.getLineLength(e)+1}),n=this._tokenStore.getTokensInRange(t,o),r=new Uint32Array(n.length*2);for(let s=0;s<n.length;s++)r[s*2]=n[s].startOffsetInclusive-t+n[s].length,r[s*2+1]=n[s].token;return r}getTokensInRange(e,t,o,n){let r=n?this._tokenizeCapturesWithMetadata(n,t,o):this._tokenize(e,t,o);if(r?.endOffsetsAndMetadata)return this._rangeTokensAsUpdates(t,r.endOffsetsAndMetadata)}_updateTokensInStore(e,t,o){this._accurateVersion=e;for(let n of t){let r=n.newTokens.length>0?n.newTokens[n.newTokens.length-1]:void 0,s;r&&this._guessVersion>=e?s=r.startOffsetInclusive+r.length-n.newTokens[0].startOffsetInclusive:n.oldRangeLength?s=n.oldRangeLength:s=0,this._tokenStore.update(s,n.newTokens,o)}}_markForRefresh(e){this._tokenStore.markForRefresh(this._textModel.getOffsetAt(e.getStartPosition()),this._textModel.getOffsetAt(e.getEndPosition()))}_getNeedsRefresh(){let e=this._tokenStore.getNeedsRefresh();return e?e.map(t=>({range:z.fromPositions(this._textModel.getPositionAt(t.startOffset),this._textModel.getPositionAt(t.endOffset)),startOffset:t.startOffset,endOffset:t.endOffset})):[]}_parseAndTokenizeViewPort(e){let t=e.map(o=>o.toInclusiveRange()).filter(mo);for(let o of t){let n=this._textModel.getOffsetAt(o.getStartPosition()),r=this._textModel.getOffsetAt(o.getEndPosition()),s=this._textModel.getVersionId();if(this._rangeHasTokens(o,1))continue;let l=this._textModel.getValueInRange(o),c=this._forceParseAndTokenizeContent(o,n,r,l,!0);if(!c||this._rangeHasTokens(o,1)||c.length===0)continue;let u=c[c.length-1],p=u.startOffsetInclusive+u.length-c[0].startOffsetInclusive;this._updateTokensInStore(s,[{newTokens:c,oldRangeLength:p}],1),this._onDidChangeTokens.fire({changes:{semanticTokensApplied:!1,ranges:[{fromLineNumber:o.startLineNumber,toLineNumber:o.endLineNumber}]}})}}_guessTokensForLinesContent(e,t){if(t.length===0)return;let o=t.join(this._textModel.getEOL()),n=new z(1,1,e+t.length,t[t.length-1].length+1),r=this._textModel.getOffsetAt({lineNumber:e,column:1}),s=this._forceParseAndTokenizeContent(n,r,r+o.length,o,!1);if(!s)return;let l=new Array(t.length),c=0,u=0,p=0;for(let h=0;h<t.length;h++){let g=[],f=!1;for(let v=c;!f&&v<s.length;v++){let b=s[v],S=b.endOffset-p,y=u-p;if(S<=t[h].length)g.push({endOffset:S,metadata:b.metadata}),c++;else if(y<t[h].length){let w={endOffset:t[h].length,metadata:b.metadata};g.push(w),f=!0}else f=!0;u=b.endOffset}l[h]=this._endOffsetTokensToUint32Array(g),p+=t[h].length+this._textModel.getEOL().length}return l}_forceParseAndTokenizeContent(e,t,o,n,r){let s=aei(this._textModel,e.startLineNumber).likelyRelevantLines,l=s.join(this._textModel.getEOL()),c=this._tree.createParsedTreeSync(`${l}${n}`);if(!c)return;let u=new z(1,1,e.endLineNumber-e.startLineNumber+1+s.length,e.endColumn),p=this.captureAtRange(u),h=this._tokenizeCapturesWithMetadata(p,l.length,o-t+l.length);if(c.delete(),!!h)return r?this._rangeTokensAsUpdates(t,h.endOffsetsAndMetadata,l.length):h.endOffsetsAndMetadata}_firstTreeUpdate(e){return this._setViewPortTokens(e)}_setViewPortTokens(e){let t=this._visibleLineRanges.get().map(o=>{let n=o.toInclusiveRange();if(!n)return;let r=this._textModel.getOffsetAt(n.getStartPosition()),s=this._textModel.getOffsetAt(n.getEndPosition());return{newRange:n,newRangeEndOffset:s,newRangeStartOffset:r}}).filter(mo);return this._handleTreeUpdate(t,e)}_handleTreeUpdate(e,t){let o=[];for(let s=0;s<e.length;s++)if(e[s].newRange.endLineNumber-e[s].newRange.startLineNumber>1e3){let c=e[s].newRange.endLineNumber,u=e[s].newRange.startLineNumber,p=e[s].newRange.startColumn,h=u+1e3;do{let g=new Ie(u,p),f=h===e[s].newRange.endLineNumber?e[s].newRange.endColumn:this._textModel.getLineMaxColumn(h),v=new Ie(h,f),b=z.fromPositions(g,v);o.push({range:b,startOffset:this._textModel.getOffsetAt(b.getStartPosition()),endOffset:this._textModel.getOffsetAt(b.getEndPosition())}),u=h+1,p=1,h<c&&h+1e3>c?h=c:h=h+1e3}while(h<=c)}else if(s===0||o[s-1].endOffset<e[s].newRangeStartOffset)o.push({range:e[s].newRange,startOffset:e[s].newRangeStartOffset,endOffset:e[s].newRangeEndOffset});else if(o[s-1].endOffset<e[s].newRangeEndOffset){let c=this._textModel.getPositionAt(o[s-1].endOffset+1),u=new z(c.lineNumber,c.column,e[s].newRange.endLineNumber,e[s].newRange.endColumn);o.push({range:u,startOffset:o[s-1].endOffset+1,endOffset:e[s].newRangeEndOffset})}let r=o.map(s=>this._getCaptures(s.range));return this._updateTreeForRanges(o,t,r).then(()=>{!this._textModel.isDisposed()&&this._tree.treeLastParsedVersion.get()===this._textModel.getVersionId()&&this._refreshNeedsRefresh(t)})}async _updateTreeForRanges(e,t,o){let n;for(let r=0;r<e.length&&!(!this._textModel.isDisposed()&&t!==this._textModel.getVersionId());r++){let s=o[r],l=e[r],c=this.getTokensInRange(l.range,l.startOffset,l.endOffset,s);c?n={newTokens:c}:n={newTokens:[]},this._updateTokensInStore(t,[n],3),this._onDidChangeTokens.fire({changes:{semanticTokensApplied:!1,ranges:[{fromLineNumber:l.range.getStartPosition().lineNumber,toLineNumber:l.range.getEndPosition().lineNumber}]}}),await new Promise(u=>Vw(u))}this._onDidCompleteBackgroundTokenization.fire()}_refreshNeedsRefresh(e){let t=this._getNeedsRefresh();if(t.length===0)return;let o=new Array(t.length);for(let n=0;n<t.length;n++){let r=t[n];o[n]={newRange:r.range,newRangeStartOffset:r.startOffset,newRangeEndOffset:r.endOffset}}this._handleTreeUpdate(o,e)}_rangeTokensAsUpdates(e,t,o){let n=[],r=0;for(let s of t){if(s.endOffset<=r||o&&s.endOffset<o)continue;let l;o&&r<o?l={startOffsetInclusive:e+o,length:s.endOffset-o,token:s.metadata}:l={startOffsetInclusive:e+r,length:s.endOffset-r,token:s.metadata},n.push(l),r=s.endOffset}return n}_updateTheme(){let e=this._textModel.getFullModelRange();this._markForRefresh(e),this._parseAndTokenizeViewPort(this._visibleLineRanges.get())}captureAtPosition(e,t){return this.captureAtRangeWithInjections(new z(e,t,e,t+1))}captureAtRangeTree(e){return this.captureAtRangeWithInjections(e)}captureAtRange(e){let t=this._tree.tree.get();return t?this._highlightingQueries.captures(t.rootNode,{startPosition:{row:e.startLineNumber-1,column:e.startColumn-1},endPosition:{row:e.endLineNumber-1,column:e.endColumn-1}}).map(o=>({name:o.name,text:o.node.text,node:{startIndex:o.node.startIndex,endIndex:o.node.endIndex,startPosition:{lineNumber:o.node.startPosition.row+1,column:o.node.startPosition.column+1},endPosition:{lineNumber:o.node.endPosition.row+1,column:o.node.endPosition.column+1}},encodedLanguageId:this._encodedLanguageId})):[]}captureAtRangeWithInjections(e){let t=this.captureAtRange(e);for(let o=0;o<t.length;o++){let n=t[o],r=n.node.startPosition.lineNumber,s=n.node.endPosition.lineNumber,l=n.node.startPosition.column,c=n.node.endPosition.column,u=r>e.startLineNumber&&r<e.endLineNumber?r:e.startLineNumber,p=s>e.startLineNumber&&s<e.endLineNumber?s:e.endLineNumber,h=r===e.startLineNumber?l<e.startColumn?e.startColumn:l:r<e.startLineNumber?e.startColumn:l,g=s===e.endLineNumber?c>e.endColumn?e.endColumn:c:s>e.endLineNumber?e.endColumn:c,f=new z(u,h,p,g),v=this._getInjectionCaptures(n,f);v&&v.length>0&&(t.splice(o+1,0,...v),o+=v.length)}return t}tokenizeEncoded(e){let t=this._tokenizeEncoded(e);if(!t)return;let o=this._rangeTokensAsUpdates(this._textModel.getOffsetAt({lineNumber:e,column:1}),t.result);t.versionId===this._textModel.getVersionId()&&this._updateTokensInStore(t.versionId,[{newTokens:o,oldRangeLength:this._textModel.getLineLength(e)}],3)}tokenizeEncodedInstrumented(e){let t=this._tokenizeEncoded(e);if(t)return{result:this._endOffsetTokensToUint32Array(t.result),captureTime:t.captureTime,metadataTime:t.metadataTime}}_getCaptures(e){return this.captureAtRangeWithInjections(e)}_tokenize(e,t,o){let n=this._getCaptures(e),r=this._tokenizeCapturesWithMetadata(n,t,o);if(r)return{...r,versionId:this._tree.treeLastParsedVersion.get()}}_createTokensFromCaptures(e,t,o){let n=this._tree.tree.get(),r=En.create(),s=o-t,l=this._languageIdCodec.encodeLanguageId(this._tree.languageId),c=JAo[this._tree.languageId]||"source";if(e.length===0)return n?(r.stop(),{endOffsets:[{endOffset:s,scopes:[],encodedLanguageId:l}],captureTime:r.elapsed()}):void 0;let u=Array(e.length);u.fill({endOffset:0,scopes:[c],encodedLanguageId:l});let p=0,h=()=>{u.push({endOffset:0,scopes:[c],encodedLanguageId:l})},g=(b,S)=>b.name.includes("punctuation")&&b.text?Array.from(b.text.matchAll(ZAo)).map(y=>S+y.index):void 0,f=(b,S,y,w)=>{if(w!==void 0){let k=u[w].scopes,T=u[w].bracket;if((w>0?u[w-1].endOffset:0)!==S){let O;if(T&&T.length>0){O=[];let V=[];for(let U=0;U<T.length;U++){let G=T[U];G<S?O.push(G):G>y&&V.push(G)}O.length===0&&(O=void 0),V.length===0?T=void 0:T=V}u.splice(w,0,{endOffset:S,scopes:[...k],bracket:O,encodedLanguageId:b.encodedLanguageId}),w++,h(),p++}u.splice(w,0,{endOffset:y,scopes:[...k,b.name],bracket:g(b,S),encodedLanguageId:b.encodedLanguageId}),u[p].bracket=T}else u[p]={endOffset:y,scopes:[c,b.name],bracket:g(b,S),encodedLanguageId:b.encodedLanguageId};p++};for(let b=0;b<e.length;b++){let S=e[b],y=S.node.endIndex<o?S.node.endIndex<t?t:S.node.endIndex:o,w=S.node.startIndex<t?t:S.node.startIndex,k=y-t,T,N=y-w;b>0?T=u[p-1].endOffset:T=w-t-1;let O=k-N;if(T>=0&&T<O&&(u[p]={endOffset:O,scopes:[c],encodedLanguageId:this._encodedLanguageId},p++,h()),!(N<0))if(T>=k){let V=p-1,U=u[V].endOffset,G=V>=2?u[V-1].endOffset:0;do{if(G+N===U){if(G===O){u[V].scopes.push(S.name);let $=u[V].bracket;u[V].bracket=$&&$.length>0?$:g(S,O)}}else if(G<=O){f(S,O,k,V);break}V--,G=V>=1?u[V-1].endOffset:0,U=V>=0?u[V].endOffset:0}while(U>O)}else f(S,O,k)}u[p-1].endOffset<s&&s-u[p-1].endOffset>0&&(h(),u[p]={endOffset:s,scopes:u[p].scopes,encodedLanguageId:this._encodedLanguageId},p++);for(let b=0;b<u.length;b++)if(u[b].endOffset===0&&b!==0){u.splice(b,u.length-b);break}let v=r.elapsed();return{endOffsets:u,captureTime:v}}_getInjectionCaptures(e,t){return[]}_tokenizeCapturesWithMetadata(e,t,o){let n=En.create(),r=this._createTokensFromCaptures(e,t,o);if(!r)return;let s=r.endOffsets;for(let c=0;c<s.length;c++){let u=s[c];u.metadata=this._treeSitterThemeService.findMetadata(u.scopes,u.encodedLanguageId,!!u.bracket&&u.bracket.length>0,void 0)}let l=n.elapsed();return{endOffsetsAndMetadata:s,captureTime:r.captureTime,metadataTime:l}}_tokenizeEncoded(e){let t=this._textModel.getOffsetAt({lineNumber:e,column:1}),o=this._textModel.getLineCount(),n=e+1<=o?this._textModel.getOffsetAt({lineNumber:e+1,column:1}):this._textModel.getValueLength(),r=n-t,s=this._tokenize(new z(e,1,e,r+1),t,n);if(s)return{result:s.endOffsetsAndMetadata,captureTime:s.captureTime,metadataTime:s.metadataTime,versionId:s.versionId}}_endOffsetTokensToUint32Array(e){let t=new Uint32Array(e.length*2);for(let o=0;o<e.length;o++)t[o*2]=e[o].endOffset,t[o*2+1]=e[o].metadata;return t}};Iye=I([m(4,ebt)],Iye);var JAo={css:"source.css",typescript:"source.ts",ini:"source.ini",regex:"source.regex"},ZAo=/[\{\}\[\]\<\>\(\)]/g;var F9=ae("treeSitterLibraryService");var i1=class extends gye{constructor(e,t,o,n,r,s){super(t,o);this._languageIdObs=e;this._treeSitterLibraryService=r;this._instantiationService=s;this._backgroundTokenizationState=1;this._onDidChangeBackgroundTokenizationState=this._register(new E);this.onDidChangeBackgroundTokenizationState=this._onDidChangeBackgroundTokenizationState.event;let l=new Au(this._treeSitterLibraryService.getParserClass()),c=Ce(this,u=>l.promiseResult?.read(u)?.getDataOrThrow());this._tree=Ce(this,u=>{let p=c.read(u);if(!p)return;let h=this._languageIdObs.read(u),g=this._treeSitterLibraryService.getLanguage(h,!1,u);if(!g)return;let f=new p;if(u.store.add(Z(()=>{f.delete()})),f.setLanguage(g),this._treeSitterLibraryService.getInjectionQueries(h,u)!==void 0)return u.store.add(this._instantiationService.createInstance(vye,h,void 0,f,p,this._textModel))}),this._tokenizationImpl=Ce(this,u=>{let p=this._tree.read(u);if(!p)return;let h=this._treeSitterLibraryService.getHighlightingQueries(p.languageId,u);if(h)return u.store.add(this._instantiationService.createInstance(Iye,p,h,this._languageIdCodec,n))}),this._register(he(u=>{let p=this._tokenizationImpl.read(u);p&&(u.store.add(p.onDidChangeTokens(h=>{this._onDidChangeTokens.fire(h.changes)})),u.store.add(p.onDidChangeBackgroundTokenization(h=>{this._backgroundTokenizationState=2,this._onDidChangeBackgroundTokenizationState.fire()})))}))}get tree(){return this._tree}get tokenizationImpl(){return this._tokenizationImpl}getLineTokens(e){let t=this._tokenizationImpl.get();if(!t){let o=this._textModel.getLineContent(e);return Bc.createEmpty(o,this._languageIdCodec)}return t.getLineTokens(e)}todo_resetTokenization(e=!0){e&&this._onDidChangeTokens.fire({semanticTokensApplied:!1,ranges:[{fromLineNumber:1,toLineNumber:this._textModel.getLineCount()}]})}handleDidChangeAttached(){}handleDidChangeContent(e){e.isFlush?this.todo_resetTokenization(!1):this._tokenizationImpl.get()?.handleContentChanged(e),this._tree.get()?.handleContentChange(e)}forceTokenization(e){let t=this._tokenizationImpl.get();t&&(t.hasAccurateTokensForLine(e)||t.tokenizeEncoded(e))}hasAccurateTokensForLine(e){let t=this._tokenizationImpl.get();return t?t.hasAccurateTokensForLine(e):!1}isCheapToTokenize(e){return!0}getTokenTypeIfInsertingCharacter(e,t,o){return 0}tokenizeLinesAt(e,t){let o=this._tokenizationImpl.get();return o?o.tokenizeLinesAt(e,t):null}get hasTokens(){let e=this._tokenizationImpl.get();return e?e.hasTokens():!1}};i1=I([m(4,F9),m(5,F)],i1);var tbt=class a{constructor(i){this._pieces=[],this._isComplete=!1,this._languageIdCodec=i}flush(){this._pieces=[],this._isComplete=!1}isEmpty(){return this._pieces.length===0}set(i,e,t=void 0){if(this._pieces=i||[],this._isComplete=e,t)for(let o of this._pieces)o.reportIfInvalid(t)}setPartial(i,e){let t=i;if(e.length>0){let n=e[0].getRange(),r=e[e.length-1].getRange();if(!n||!r)return i;t=i.plusRange(n).plusRange(r)}let o=null;for(let n=0,r=this._pieces.length;n<r;n++){let s=this._pieces[n];if(s.endLineNumber<t.startLineNumber)continue;if(s.startLineNumber>t.endLineNumber){o=o||{index:n};break}if(s.removeTokens(t),s.isEmpty()){this._pieces.splice(n,1),n--,r--;continue}if(s.endLineNumber<t.startLineNumber)continue;if(s.startLineNumber>t.endLineNumber){o=o||{index:n};continue}let[l,c]=s.split(t);if(l.isEmpty()){o=o||{index:n};continue}c.isEmpty()||(this._pieces.splice(n,1,l,c),n++,r++,o=o||{index:n})}return o=o||{index:this._pieces.length},e.length>0&&(this._pieces=UH(this._pieces,o.index,e)),t}isComplete(){return this._isComplete}addSparseTokens(i,e){if(e.getTextLength()===0)return e;let t=this._pieces;if(t.length===0)return e;let o=a._findFirstPieceWithLine(t,i),n=t[o].getLineTokens(i);if(!n)return e;let r=e.getCount(),s=n.getCount(),l=0,c=[],u=0,p=0,h=(g,f)=>{g!==p&&(p=g,c[u++]=g,c[u++]=f)};for(let g=0;g<s;g++){let f=Math.min(n.getStartCharacter(g),e.getTextLength()),v=Math.min(n.getEndCharacter(g),e.getTextLength()),b=n.getMetadata(g),S=((b&1?2048:0)|(b&2?4096:0)|(b&4?8192:0)|(b&8?16384:0)|(b&16?16744448:0)|(b&32?4278190080:0))>>>0,y=~S>>>0;for(;l<r&&e.getEndOffset(l)<=f;)h(e.getEndOffset(l),e.getMetadata(l)),l++;for(l<r&&e.getStartOffset(l)<f&&h(f,e.getMetadata(l));l<r&&e.getEndOffset(l)<v;)h(e.getEndOffset(l),e.getMetadata(l)&y|b&S),l++;if(l<r)h(v,e.getMetadata(l)&y|b&S),e.getEndOffset(l)===v&&l++;else{let w=Math.min(Math.max(0,l-1),r-1);h(v,e.getMetadata(w)&y|b&S)}}for(;l<r;)h(e.getEndOffset(l),e.getMetadata(l)),l++;return new Bc(new Uint32Array(c),e.getLineContent(),this._languageIdCodec)}static _findFirstPieceWithLine(i,e){let t=0,o=i.length-1;for(;t<o;){let n=t+Math.floor((o-t)/2);if(i[n].endLineNumber<e)t=n+1;else if(i[n].startLineNumber>e)o=n-1;else{for(;n>t&&i[n-1].startLineNumber<=e&&e<=i[n-1].endLineNumber;)n--;return n}}return t}acceptEdit(i,e,t,o,n){for(let r=0;r<this._pieces.length;r++){let s=this._pieces[r];s.acceptEdit(i,e,t,o,n),s.isEmpty()&&(this._pieces.splice(r,1),r--)}}};var Fqe=class a{constructor(i){this._lineTokens=[],this._len=0,this._languageIdCodec=i}flush(){this._lineTokens=[],this._len=0}get hasTokens(){return this._lineTokens.length>0}getTokens(i,e,t){let o=null;if(e<this._len&&(o=this._lineTokens[e]),o!==null&&o!==ZU)return new Bc(e1(o),t,this._languageIdCodec);let n=new Uint32Array(2);return n[0]=t.length,n[1]=wji(this._languageIdCodec.encodeLanguageId(i)),new Bc(n,t,this._languageIdCodec)}static _massageTokens(i,e,t){let o=t?e1(t):null;if(e===0){let n=!1;if(o&&o.length>1&&(n=Qu.getLanguageId(o[1])!==i),!n)return ZU}if(!o||o.length===0){let n=new Uint32Array(2);return n[0]=e,n[1]=wji(i),n.buffer}return o[o.length-2]=e,o.byteOffset===0&&o.byteLength===o.buffer.byteLength?o.buffer:o}_ensureLine(i){for(;i>=this._len;)this._lineTokens[this._len]=null,this._len++}_deleteLines(i,e){e!==0&&(i+e>this._len&&(e=this._len-i),this._lineTokens.splice(i,e),this._len-=e)}_insertLines(i,e){if(e===0)return;let t=[];for(let o=0;o<e;o++)t[o]=null;this._lineTokens=UH(this._lineTokens,i,t),this._len+=e}setTokens(i,e,t,o,n){let r=a._massageTokens(this._languageIdCodec.encodeLanguageId(i),t,o);this._ensureLine(e);let s=this._lineTokens[e];return this._lineTokens[e]=r,n?!a._equals(s,r):!1}static _equals(i,e){if(!i||!e)return!i&&!e;let t=e1(i),o=e1(e);if(t.length!==o.length)return!1;for(let n=0,r=t.length;n<r;n++)if(t[n]!==o[n])return!1;return!0}acceptEdit(i,e,t){this._acceptDeleteRange(i),this._acceptInsertText(new Ie(i.startLineNumber,i.startColumn),e,t)}_acceptDeleteRange(i){let e=i.startLineNumber-1;if(e>=this._len)return;if(i.startLineNumber===i.endLineNumber){if(i.startColumn===i.endColumn)return;this._lineTokens[e]=UI.delete(this._lineTokens[e],i.startColumn-1,i.endColumn-1);return}this._lineTokens[e]=UI.deleteEnding(this._lineTokens[e],i.startColumn-1);let t=i.endLineNumber-1,o=null;t<this._len&&(o=UI.deleteBeginning(this._lineTokens[t],i.endColumn-1)),this._lineTokens[e]=UI.append(this._lineTokens[e],o),this._deleteLines(i.startLineNumber,i.endLineNumber-i.startLineNumber)}_acceptInsertText(i,e,t){if(e===0&&t===0)return;let o=i.lineNumber-1;if(!(o>=this._len)){if(e===0){this._lineTokens[o]=UI.insert(this._lineTokens[o],i.column-1,t);return}this._lineTokens[o]=UI.deleteEnding(this._lineTokens[o],i.column-1),this._lineTokens[o]=UI.insert(this._lineTokens[o],i.column-1,t),this._insertLines(i.lineNumber,e)}}setMultilineTokens(i,e){if(i.length===0)return{changes:[]};let t=[];for(let o=0,n=i.length;o<n;o++){let r=i[o],s=0,l=0,c=!1;for(let u=r.startLineNumber;u<=r.endLineNumber;u++)c?(this.setTokens(e.getLanguageId(),u-1,e.getLineLength(u),r.getLineTokens(u),!1),l=u):this.setTokens(e.getLanguageId(),u-1,e.getLineLength(u),r.getLineTokens(u),!0)&&(c=!0,s=u,l=u);c&&t.push({fromLineNumber:s,toLineNumber:l})}return{changes:t}}};function wji(a){return(a<<0|0|0|32768|2<<24|1024)>>>0}var ibt=class extends gye{constructor(e,t,o,n){super(e,t);this.getLanguageId=o;this._tokenizer=null;this._backgroundTokenizationState=1;this._onDidChangeBackgroundTokenizationState=this._register(new E);this.onDidChangeBackgroundTokenizationState=this._onDidChangeBackgroundTokenizationState.event;this._defaultBackgroundTokenizer=null;this._backgroundTokenizer=this._register(new me);this._tokens=new Fqe(this._languageIdCodec);this._debugBackgroundTokenizer=this._register(new me);this._attachedViewStates=this._register(new jt);this._register(kc.onDidChange(r=>{let s=this.getLanguageId();r.changedLanguages.indexOf(s)!==-1&&this.todo_resetTokenization()})),this.todo_resetTokenization(),this._register(n.onDidChangeVisibleRanges(({view:r,state:s})=>{if(s){let l=this._attachedViewStates.get(r);l||(l=new jvt(()=>this.refreshRanges(l.lineRanges)),this._attachedViewStates.set(r,l)),l.handleStateChange(s)}else this._attachedViewStates.deleteAndDispose(r)}))}todo_resetTokenization(e=!0){this._tokens.flush(),this._debugBackgroundTokens?.flush(),this._debugBackgroundStates&&(this._debugBackgroundStates=new Sye(this._textModel.getLineCount())),e&&this._onDidChangeTokens.fire({semanticTokensApplied:!1,ranges:[{fromLineNumber:1,toLineNumber:this._textModel.getLineCount()}]});let t=()=>{if(this._textModel.isTooLargeForTokenization())return[null,null];let r=kc.get(this.getLanguageId());if(!r)return[null,null];let s;try{s=r.getInitialState()}catch(l){return mt(l),[null,null]}return[r,s]},[o,n]=t();if(o&&n?this._tokenizer=new Xvt(this._textModel.getLineCount(),o,this._textModel,this._languageIdCodec):this._tokenizer=null,this._backgroundTokenizer.clear(),this._defaultBackgroundTokenizer=null,this._tokenizer){let r={setTokens:s=>{this.setTokens(s)},setFontInfo:s=>{this.setFontInfo(s)},backgroundTokenizationFinished:()=>{if(this._backgroundTokenizationState===2)return;let s=2;this._backgroundTokenizationState=s,this._onDidChangeBackgroundTokenizationState.fire()},setEndState:(s,l)=>{if(!this._tokenizer)return;let c=this._tokenizer.store.getFirstInvalidEndStateLineNumber();c!==null&&s>=c&&this._tokenizer?.store.setEndState(s,l)}};o&&o.createBackgroundTokenizer&&!o.backgroundTokenizerShouldOnlyVerifyTokens&&(this._backgroundTokenizer.value=o.createBackgroundTokenizer(this._textModel,r)),!this._backgroundTokenizer.value&&!this._textModel.isTooLargeForTokenization()&&(this._backgroundTokenizer.value=this._defaultBackgroundTokenizer=new Jvt(this._tokenizer,r),this._defaultBackgroundTokenizer.handleChanges()),o?.backgroundTokenizerShouldOnlyVerifyTokens&&o.createBackgroundTokenizer?(this._debugBackgroundTokens=new Fqe(this._languageIdCodec),this._debugBackgroundStates=new Sye(this._textModel.getLineCount()),this._debugBackgroundTokenizer.clear(),this._debugBackgroundTokenizer.value=o.createBackgroundTokenizer(this._textModel,{setTokens:s=>{this._debugBackgroundTokens?.setMultilineTokens(s,this._textModel)},setFontInfo:s=>{this.setFontInfo(s)},backgroundTokenizationFinished(){},setEndState:(s,l)=>{this._debugBackgroundStates?.setEndState(s,l)}})):(this._debugBackgroundTokens=void 0,this._debugBackgroundStates=void 0,this._debugBackgroundTokenizer.value=void 0)}this.refreshAllVisibleLineTokens()}handleDidChangeAttached(){this._defaultBackgroundTokenizer?.handleChanges()}handleDidChangeContent(e){if(e.isFlush)this.todo_resetTokenization(!1);else if(!e.isEolChange){for(let t of e.changes){let[o,n]=OS(t.text);this._tokens.acceptEdit(t.range,o,n),this._debugBackgroundTokens?.acceptEdit(t.range,o,n)}this._debugBackgroundStates?.acceptChanges(e.changes),this._tokenizer&&this._tokenizer.store.acceptChanges(e.changes),this._defaultBackgroundTokenizer?.handleChanges()}}setTokens(e){let{changes:t}=this._tokens.setMultilineTokens(e,this._textModel);return t.length>0&&this._onDidChangeTokens.fire({semanticTokensApplied:!1,ranges:t}),{changes:t}}setFontInfo(e){this._onDidChangeFontTokens.fire({changes:e})}refreshAllVisibleLineTokens(){let e=ro.joinMany([...this._attachedViewStates].map(([t,o])=>o.lineRanges));this.refreshRanges(e)}refreshRanges(e){for(let t of e)this.refreshRange(t.startLineNumber,t.endLineNumberExclusive-1)}refreshRange(e,t){if(!this._tokenizer)return;e=Math.max(1,Math.min(this._textModel.getLineCount(),e)),t=Math.min(this._textModel.getLineCount(),t);let o=new t1,{heuristicTokens:n}=this._tokenizer.tokenizeHeuristically(o,e,t),r=this.setTokens(o.finalize());if(n)for(let s of r.changes)this._backgroundTokenizer.value?.requestTokens(s.fromLineNumber,s.toLineNumber+1);this._defaultBackgroundTokenizer?.checkFinished()}forceTokenization(e){let t=new t1;this._tokenizer?.updateTokensUntilLine(t,e),this.setTokens(t.finalize()),this._defaultBackgroundTokenizer?.checkFinished()}hasAccurateTokensForLine(e){return this._tokenizer?this._tokenizer.hasAccurateTokensForLine(e):!0}isCheapToTokenize(e){return this._tokenizer?this._tokenizer.isCheapToTokenize(e):!0}getLineTokens(e){let t=this._textModel.getLineContent(e),o=this._tokens.getTokens(this._textModel.getLanguageId(),e-1,t);if(this._debugBackgroundTokens&&this._debugBackgroundStates&&this._tokenizer&&this._debugBackgroundStates.getFirstInvalidEndStateLineNumberOrMax()>e&&this._tokenizer.store.getFirstInvalidEndStateLineNumberOrMax()>e){let n=this._debugBackgroundTokens.getTokens(this._textModel.getLanguageId(),e-1,t);!o.equals(n)&&this._debugBackgroundTokenizer.value?.reportMismatchingTokens&&this._debugBackgroundTokenizer.value.reportMismatchingTokens(e)}return o}getTokenTypeIfInsertingCharacter(e,t,o){if(!this._tokenizer)return 0;let n=this._textModel.validatePosition(new Ie(e,t));return this.forceTokenization(n.lineNumber),this._tokenizer.getTokenTypeIfInsertingCharacter(n,o)}tokenizeLinesAt(e,t){return this._tokenizer?(this.forceTokenization(e),this._tokenizer.tokenizeLinesAt(e,t)):null}get hasTokens(){return this._tokens.hasTokens}};var mq=class extends FIe{constructor(e,t,o,n,r,s,l,c){super();this._textModel=e;this._bracketPairsTextModelPart=t;this._languageId=o;this._attachedViews=n;this._languageService=r;this._languageConfigurationService=s;this._instantiationService=l;this._treeSitterLibraryService=c;this._onDidChangeFontTokens=this._register(new E);this.onDidChangeFontTokens=this._onDidChangeFontTokens.event;this._languageIdObs=Le(this,this._languageId),this._useTreeSitter=Ce(this,p=>{let h=this._languageIdObs.read(p);return this._treeSitterLibraryService.supportsLanguage(h,p)}),this.tokens=Ce(this,p=>{let h;return this._useTreeSitter.read(p)?h=p.store.add(this._instantiationService.createInstance(i1,this._languageIdObs,this._languageService.languageIdCodec,this._textModel,this._attachedViews.visibleLineRanges)):h=p.store.add(new ibt(this._languageService.languageIdCodec,this._textModel,()=>this._languageId,this._attachedViews)),p.store.add(h.onDidChangeTokens(g=>{this._emitModelTokensChangedEvent(g)})),p.store.add(h.onDidChangeFontTokens(g=>{this._textModel._isDisposing()||this._onDidChangeFontTokens.fire(g)})),p.store.add(h.onDidChangeBackgroundTokenizationState(g=>{this._bracketPairsTextModelPart.handleDidChangeBackgroundTokenizationState()})),h});let u=!1;this.tokens.recomputeInitiallyAndOnChange(this._store,p=>{u&&p.todo_resetTokenization(),u=!0}),this._semanticTokens=new tbt(this._languageService.languageIdCodec),this._onDidChangeLanguage=this._register(new E),this.onDidChangeLanguage=this._onDidChangeLanguage.event,this._onDidChangeLanguageConfiguration=this._register(new E),this.onDidChangeLanguageConfiguration=this._onDidChangeLanguageConfiguration.event,this._onDidChangeTokens=this._register(new E),this.onDidChangeTokens=this._onDidChangeTokens.event,this._onDidChangeFontTokens=this._register(new E),this.onDidChangeFontTokens=this._onDidChangeFontTokens.event}_hasListeners(){return this._onDidChangeLanguage.hasListeners()||this._onDidChangeLanguageConfiguration.hasListeners()||this._onDidChangeTokens.hasListeners()}handleLanguageConfigurationServiceChange(e){e.affects(this._languageId)&&this._onDidChangeLanguageConfiguration.fire({})}handleDidChangeContent(e){if(e.isFlush)this._semanticTokens.flush();else if(!e.isEolChange)for(let t of e.changes){let[o,n,r]=OS(t.text);this._semanticTokens.acceptEdit(t.range,o,n,r,t.text.length>0?t.text.charCodeAt(0):0)}this.tokens.get().handleDidChangeContent(e)}handleDidChangeAttached(){this.tokens.get().handleDidChangeAttached()}getLineTokens(e){this.validateLineNumber(e);let t=this.tokens.get().getLineTokens(e);return this._semanticTokens.addSparseTokens(e,t)}_emitModelTokensChangedEvent(e){this._textModel._isDisposing()||(this._bracketPairsTextModelPart.handleDidChangeTokens(e),this._onDidChangeTokens.fire(e))}validateLineNumber(e){if(e<1||e>this._textModel.getLineCount())throw new ni("Illegal value for lineNumber")}get hasTokens(){return this.tokens.get().hasTokens}resetTokenization(){this.tokens.get().todo_resetTokenization()}get backgroundTokenizationState(){return this.tokens.get().backgroundTokenizationState}forceTokenization(e){this.validateLineNumber(e),this.tokens.get().forceTokenization(e)}hasAccurateTokensForLine(e){return this.validateLineNumber(e),this.tokens.get().hasAccurateTokensForLine(e)}isCheapToTokenize(e){return this.validateLineNumber(e),this.tokens.get().isCheapToTokenize(e)}tokenizeIfCheap(e){this.validateLineNumber(e),this.tokens.get().tokenizeIfCheap(e)}getTokenTypeIfInsertingCharacter(e,t,o){return this.tokens.get().getTokenTypeIfInsertingCharacter(e,t,o)}tokenizeLinesAt(e,t){return this.tokens.get().tokenizeLinesAt(e,t)}setSemanticTokens(e,t){this._semanticTokens.set(e,t,this._textModel),this._emitModelTokensChangedEvent({semanticTokensApplied:e!==null,ranges:[{fromLineNumber:1,toLineNumber:this._textModel.getLineCount()}]})}hasCompleteSemanticTokens(){return this._semanticTokens.isComplete()}hasSomeSemanticTokens(){return!this._semanticTokens.isEmpty()}setPartialSemanticTokens(e,t){if(this.hasCompleteSemanticTokens())return;let o=this._textModel.validateRange(this._semanticTokens.setPartial(e,t));this._emitModelTokensChangedEvent({semanticTokensApplied:!0,ranges:[{fromLineNumber:o.startLineNumber,toLineNumber:o.endLineNumber}]})}getWordAtPosition(e){this.assertNotDisposed();let t=this._textModel.validatePosition(e),o=this._textModel.getLineContent(t.lineNumber),n=this.getLineTokens(t.lineNumber),r=n.findTokenIndexAtOffset(t.column-1),[s,l]=mq._findLanguageBoundaries(n,r),c=My(t.column,this.getLanguageConfiguration(n.getLanguageId(r)).getWordDefinition(),o.substring(s,l),s);if(c&&c.startColumn<=e.column&&e.column<=c.endColumn)return c;if(r>0&&s===t.column-1){let[u,p]=mq._findLanguageBoundaries(n,r-1),h=My(t.column,this.getLanguageConfiguration(n.getLanguageId(r-1)).getWordDefinition(),o.substring(u,p),u);if(h&&h.startColumn<=e.column&&e.column<=h.endColumn)return h}return null}getLanguageConfiguration(e){return this._languageConfigurationService.getLanguageConfiguration(e)}static _findLanguageBoundaries(e,t){let o=e.getLanguageId(t),n=0;for(let s=t;s>=0&&e.getLanguageId(s)===o;s--)n=e.getStartOffset(s);let r=e.getLineContent().length;for(let s=t,l=e.getCount();s<l&&e.getLanguageId(s)===o;s++)r=e.getEndOffset(s);return[n,r]}getWordUntilPosition(e){let t=this.getWordAtPosition(e);return t?{word:t.word.substr(0,e.column-t.startColumn),startColumn:t.startColumn,endColumn:e.column}:{word:"",startColumn:e.column,endColumn:e.column}}getLanguageId(){return this._languageId}getLanguageIdAtPosition(e,t){let o=this._textModel.validatePosition(new Ie(e,t)),n=this.getLineTokens(o.lineNumber);return n.getLanguageId(n.findTokenIndexAtOffset(o.column-1))}setLanguageId(e,t="api"){if(this._languageId===e)return;let o={oldLanguage:this._languageId,newLanguage:e,source:t};this._languageId=e,this._languageIdObs.set(e,void 0),this._bracketPairsTextModelPart.handleDidChangeLanguage(o),this._onDidChangeLanguage.fire(o),this._onDidChangeLanguageConfiguration.fire({})}};mq=I([m(4,kt),m(5,bs),m(6,F),m(7,F9)],mq);function lae(a){let i=new cq;return i.acceptChunk(a),i.finish()}function W9(a){return new Promise((i,e)=>{let t=new cq,o=!1;j0(a,{onData:n=>{t.acceptChunk(typeof n=="string"?n:n.toString())},onError:n=>{o||(o=!0,e(n))},onEnd:()=>{o||(o=!0,i(t.finish()))}})})}function i_(a){let i=new cq,e;for(;typeof(e=a.read())=="string";)i.acceptChunk(e);return i.finish()}function n1(a,i){let e;return typeof a=="string"?e=lae(a):vKi(a)?e=i_(a):e=a,e.create(i)}var obt=0,eNo=999,tNo=1e4,iNo=300,cei=class{constructor(i){this._source=i,this._eos=!1}read(){if(this._eos)return null;let i=[],e=0,t=0;do{let o=this._source.read();if(o===null)return this._eos=!0,e===0?null:i.join("");if(o.length>0&&(i[e++]=o,t+=o.length),t>=64*1024)return i.join("")}while(!0)}},Wqe=()=>{throw new Error("Invalid change accessor")};var Bu=class extends C{constructor(e,t,o,n=null,r,s,l,c){super();this._undoRedoService=r;this._languageService=s;this._languageConfigurationService=l;this.instantiationService=c;this._onWillDispose=this._register(new E);this.onWillDispose=this._onWillDispose.event;this._onDidChangeDecorations=this._register(new mei((e,t,o)=>this.handleBeforeFireDecorationsChangedEvent(e,t,o)));this.onDidChangeDecorations=this._onDidChangeDecorations.event;this._onDidChangeOptions=this._register(new E);this._onDidChangeAttached=this._register(new E);this._onDidChangeLineHeight=this._register(new E);this._onDidChangeFont=this._register(new E);this._eventEmitter=this._register(new hei);this._languageSelectionListener=this._register(new me);this._deltaDecorationCallCnt=0;this._attachedViews=this._register(new qvt);this._viewModels=new Set;obt++,this.id="$model"+obt,this.isForSimpleWidget=o.isForSimpleWidget,typeof n>"u"||n===null?this._associatedResource=A.parse("inmemory://model/"+obt):this._associatedResource=n,this._attachedEditorCount=0;let{textBuffer:u,disposable:p}=n1(e,o.defaultEOL);this._buffer=u,this._bufferDisposable=p;let h=this._buffer.getLineCount(),g=this._buffer.getValueLengthInRange(new z(1,1,h,this._buffer.getLineLength(h)+1),0);o.largeFileOptimizations?(this._isTooLargeForTokenization=g>Bu.LARGE_FILE_SIZE_THRESHOLD||h>Bu.LARGE_FILE_LINE_COUNT_THRESHOLD,this._isTooLargeForHeapOperation=g>Bu.LARGE_FILE_HEAP_OPERATION_THRESHOLD):(this._isTooLargeForTokenization=!1,this._isTooLargeForHeapOperation=!1),this._options=Bu.resolveOptions(this._buffer,o);let f=typeof t=="string"?t:t.languageId;typeof t!="string"&&(this._languageSelectionListener.value=t.onDidChange(()=>this._setLanguage(t.languageId))),this._bracketPairs=this._register(new Bvt(this,this._languageConfigurationService)),this._guidesTextModelPart=this._register(new Rft(this,this._languageConfigurationService)),this._decorationProvider=this._register(new Hvt(this)),this._tokenizationTextModelPart=this.instantiationService.createInstance(mq,this,this._bracketPairs,f,this._attachedViews),this._fontTokenDecorationsProvider=this._register(new Qvt(this,this._tokenizationTextModelPart)),this._isTooLargeForSyncing=g>Bu._MODEL_SYNC_LIMIT,this._versionId=1,this._alternativeVersionId=1,this._initialUndoRedoSnapshot=null,this._isDisposed=!1,this.__isDisposing=!1,this._instanceId=_be(obt),this._lastDecorationId=0,this._decorations=Object.create(null),this._decorationsTree=new rbt,this._commandManager=new Kvt(this,this._undoRedoService),this._isUndoing=!1,this._isRedoing=!1,this._trimAutoWhitespaceLines=null,this._register(this._decorationProvider.onDidChange(()=>{this._onDidChangeDecorations.beginDeferredEmit(),this._onDidChangeDecorations.fire(),this._onDidChangeDecorations.endDeferredEmit()})),this._register(this._fontTokenDecorationsProvider.onDidChangeLineHeight(v=>{this._onDidChangeDecorations.beginDeferredEmit(),this._onDidChangeDecorations.fire(),this._fireOnDidChangeLineHeight(v),this._onDidChangeDecorations.endDeferredEmit()})),this._register(this._fontTokenDecorationsProvider.onDidChangeFont(v=>{this._onDidChangeDecorations.beginDeferredEmit(),this._onDidChangeDecorations.fire(),this._fireOnDidChangeFont(v),this._onDidChangeDecorations.endDeferredEmit()})),this._languageService.requestRichLanguageFeatures(f),this._register(this._languageConfigurationService.onDidChange(v=>{this._bracketPairs.handleLanguageConfigurationServiceChange(v),this._tokenizationTextModelPart.handleLanguageConfigurationServiceChange(v)}))}static{this._MODEL_SYNC_LIMIT=50*1024*1024}static{this.LARGE_FILE_SIZE_THRESHOLD=20*1024*1024}static{this.LARGE_FILE_LINE_COUNT_THRESHOLD=300*1e3}static{this.LARGE_FILE_HEAP_OPERATION_THRESHOLD=256*1024*1024}static{this.DEFAULT_CREATION_OPTIONS={isForSimpleWidget:!1,tabSize:iv.tabSize,indentSize:iv.indentSize,insertSpaces:iv.insertSpaces,detectIndentation:!1,defaultEOL:1,trimAutoWhitespace:iv.trimAutoWhitespace,largeFileOptimizations:iv.largeFileOptimizations,bracketPairColorizationOptions:iv.bracketPairColorizationOptions}}static resolveOptions(e,t){if(t.detectIndentation){let o=UZt(e,t.tabSize,t.insertSpaces);return new lSe({tabSize:o.tabSize,indentSize:"tabSize",insertSpaces:o.insertSpaces,trimAutoWhitespace:t.trimAutoWhitespace,defaultEOL:t.defaultEOL,bracketPairColorizationOptions:t.bracketPairColorizationOptions})}return new lSe(t)}get onDidChangeLanguage(){return this._tokenizationTextModelPart.onDidChangeLanguage}get onDidChangeLanguageConfiguration(){return this._tokenizationTextModelPart.onDidChangeLanguageConfiguration}get onDidChangeTokens(){return this._tokenizationTextModelPart.onDidChangeTokens}get onDidChangeOptions(){return this._onDidChangeOptions.event}get onDidChangeAttached(){return this._onDidChangeAttached.event}get onDidChangeLineHeight(){return this._onDidChangeLineHeight.event}get onDidChangeFont(){return this._onDidChangeFont.event}onDidChangeContent(e){return this._eventEmitter.event(t=>e(t.contentChangedEvent))}_isDisposing(){return this.__isDisposing}get tokenization(){return this._tokenizationTextModelPart}get bracketPairs(){return this._bracketPairs}get guides(){return this._guidesTextModelPart}dispose(){this.__isDisposing=!0,this._onWillDispose.fire(),this._tokenizationTextModelPart.dispose(),this._isDisposed=!0,super.dispose(),this._bufferDisposable.dispose(),this.__isDisposing=!1;let e=new N9([],"",`
`,!1,!1,!0,!0);e.dispose(),this._buffer=e,this._bufferDisposable=C.None}_hasListeners(){return this._onWillDispose.hasListeners()||this._onDidChangeDecorations.hasListeners()||this._tokenizationTextModelPart._hasListeners()||this._onDidChangeOptions.hasListeners()||this._onDidChangeAttached.hasListeners()||this._onDidChangeLineHeight.hasListeners()||this._onDidChangeFont.hasListeners()||this._eventEmitter.hasListeners()}_assertNotDisposed(){if(this._isDisposed)throw new ni("Model is disposed!")}registerViewModel(e){this._viewModels.add(e)}unregisterViewModel(e){this._viewModels.delete(e)}equalsTextBuffer(e){return this._assertNotDisposed(),this._buffer.equals(e)}getTextBuffer(){return this._assertNotDisposed(),this._buffer}_emitContentChangedEvent(e,t,o=null){if(this.__isDisposing)return;this._tokenizationTextModelPart.handleDidChangeContent(t),this._bracketPairs.handleDidChangeContent(t),this._fontTokenDecorationsProvider.handleDidChangeContent(t);let n=new _9(e,t);o&&(n.rawContentChangedEvent.resultingSelection=o),this._onDidChangeContentOrInjectedText(n),this._eventEmitter.fire(n)}setValue(e,t=_c.setValue()){if(this._assertNotDisposed(),e==null)throw Br();let{textBuffer:o,disposable:n}=n1(e,this._options.defaultEOL);this._setValueFromTextBuffer(o,n,t)}_createContentChanged2(e,t,o,n,r,s,l,c,u,p){return{changes:[{range:e,rangeOffset:t,rangeLength:o,text:r}],eol:this._buffer.getEOL(),isEolChange:u,versionId:this.getVersionId(),isUndoing:s,isRedoing:l,isFlush:c,detailedReasons:[p],detailedReasonsChangeLengths:[1]}}_setValueFromTextBuffer(e,t,o){this._assertNotDisposed();let n=this.getFullModelRange(),r=this.getValueLengthInRange(n),s=this.getLineCount(),l=this.getLineMaxColumn(s);this._buffer=e,this._bufferDisposable.dispose(),this._bufferDisposable=t,this._increaseVersionId(),this._decorations=Object.create(null),this._decorationsTree=new rbt,this._commandManager.clear(),this._trimAutoWhitespaceLines=null,this._emitContentChangedEvent(new nae([new yvt],this._versionId,!1,!1),this._createContentChanged2(new z(1,1,s,l),0,r,new Ie(s,l),this.getValue(),!1,!1,!0,!1,o))}setEOL(e){this._assertNotDisposed();let t=e===1?`\r
`:`
`;if(this._buffer.getEOL()===t)return;let o=this.getFullModelRange(),n=this.getValueLengthInRange(o),r=this.getLineCount(),s=this.getLineMaxColumn(r);this._onBeforeEOLChange(),this._buffer.setEOL(t),this._increaseVersionId(),this._onAfterEOLChange(),this._emitContentChangedEvent(new nae([new Evt],this._versionId,!1,!1),this._createContentChanged2(new z(1,1,r,s),0,n,new Ie(r,s),this.getValue(),!1,!1,!1,!0,_c.eolChange()))}_onBeforeEOLChange(){this._decorationsTree.ensureAllNodesHaveRanges(this)}_onAfterEOLChange(){let e=this.getVersionId(),t=this._decorationsTree.collectNodesPostOrder();for(let o=0,n=t.length;o<n;o++){let r=t[o],s=r.range,l=r.cachedAbsoluteStart-r.start,c=this._buffer.getOffsetAt(s.startLineNumber,s.startColumn),u=this._buffer.getOffsetAt(s.endLineNumber,s.endColumn);r.cachedAbsoluteStart=c,r.cachedAbsoluteEnd=u,r.cachedVersionId=e,r.start=c-l,r.end=u-l,nq(r)}}onBeforeAttached(){return this._attachedEditorCount++,this._attachedEditorCount===1&&(this._tokenizationTextModelPart.handleDidChangeAttached(),this._onDidChangeAttached.fire(void 0)),this._attachedViews.attachView()}onBeforeDetached(e){this._attachedEditorCount--,this._attachedEditorCount===0&&(this._tokenizationTextModelPart.handleDidChangeAttached(),this._onDidChangeAttached.fire(void 0)),this._attachedViews.detachView(e)}isAttachedToEditor(){return this._attachedEditorCount>0}getAttachedEditorCount(){return this._attachedEditorCount}isTooLargeForSyncing(){return this._isTooLargeForSyncing}isTooLargeForTokenization(){return this._isTooLargeForTokenization}isTooLargeForHeapOperation(){return this._isTooLargeForHeapOperation}isDisposed(){return this._isDisposed}isDominatedByLongLines(){if(this._assertNotDisposed(),this.isTooLargeForTokenization())return!1;let e=0,t=0,o=this._buffer.getLineCount();for(let n=1;n<=o;n++){let r=this._buffer.getLineLength(n);r>=tNo?t+=r:e+=r}return t>e}get uri(){return this._associatedResource}getOptions(){return this._assertNotDisposed(),this._options}getFormattingOptions(){return{tabSize:this._options.indentSize,insertSpaces:this._options.insertSpaces}}updateOptions(e){this._assertNotDisposed();let t=typeof e.tabSize<"u"?e.tabSize:this._options.tabSize,o=typeof e.indentSize<"u"?e.indentSize:this._options.originalIndentSize,n=typeof e.insertSpaces<"u"?e.insertSpaces:this._options.insertSpaces,r=typeof e.trimAutoWhitespace<"u"?e.trimAutoWhitespace:this._options.trimAutoWhitespace,s=typeof e.bracketColorizationOptions<"u"?e.bracketColorizationOptions:this._options.bracketPairColorizationOptions,l=new lSe({tabSize:t,indentSize:o,insertSpaces:n,defaultEOL:this._options.defaultEOL,trimAutoWhitespace:r,bracketPairColorizationOptions:s});if(this._options.equals(l))return;let c=this._options.createChangeEvent(l);this._options=l,this._bracketPairs.handleDidChangeOptions(c),this._decorationProvider.handleDidChangeOptions(c),this._onDidChangeOptions.fire(c)}detectIndentation(e,t){this._assertNotDisposed();let o=UZt(this._buffer,t,e);this.updateOptions({insertSpaces:o.insertSpaces,tabSize:o.tabSize,indentSize:o.tabSize})}normalizeIndentation(e){return this._assertNotDisposed(),sSe(e,this._options.indentSize,this._options.insertSpaces)}getVersionId(){return this._assertNotDisposed(),this._versionId}mightContainRTL(){return this._buffer.mightContainRTL()}mightContainUnusualLineTerminators(){return this._buffer.mightContainUnusualLineTerminators()}removeUnusualLineTerminators(e=null){let t=this.findMatches(r9t.source,!1,!0,!1,null,!1,1073741824);this._buffer.resetMightContainUnusualLineTerminators(),this.pushEditOperations(e,t.map(o=>({range:o.range,text:null})),()=>null)}mightContainNonBasicASCII(){return this._buffer.mightContainNonBasicASCII()}getAlternativeVersionId(){return this._assertNotDisposed(),this._alternativeVersionId}getInitialUndoRedoSnapshot(){return this._assertNotDisposed(),this._initialUndoRedoSnapshot}getOffsetAt(e){this._assertNotDisposed();let t=this._validatePosition(e.lineNumber,e.column,0);return this._buffer.getOffsetAt(t.lineNumber,t.column)}getPositionAt(e){this._assertNotDisposed();let t=Math.min(this._buffer.getLength(),Math.max(0,e));return this._buffer.getPositionAt(t)}_increaseVersionId(){this._versionId=this._versionId+1,this._alternativeVersionId=this._versionId}_overwriteVersionId(e){this._versionId=e}_overwriteAlternativeVersionId(e){this._alternativeVersionId=e}_overwriteInitialUndoRedoSnapshot(e){this._initialUndoRedoSnapshot=e}getValue(e,t=!1){if(this._assertNotDisposed(),this.isTooLargeForHeapOperation())throw new ni("Operation would exceed heap memory limits");let o=this.getFullModelRange(),n=this.getValueInRange(o,e);return t?this._buffer.getBOM()+n:n}createSnapshot(e=!1){return new cei(this._buffer.createSnapshot(e))}getValueLength(e,t=!1){this._assertNotDisposed();let o=this.getFullModelRange(),n=this.getValueLengthInRange(o,e);return t?this._buffer.getBOM().length+n:n}getValueInRange(e,t=0){return this._assertNotDisposed(),this._buffer.getValueInRange(this.validateRange(e),t)}getValueLengthInRange(e,t=0){return this._assertNotDisposed(),this._buffer.getValueLengthInRange(this.validateRange(e),t)}getCharacterCountInRange(e,t=0){return this._assertNotDisposed(),this._buffer.getCharacterCountInRange(this.validateRange(e),t)}getLineCount(){return this._assertNotDisposed(),this._buffer.getLineCount()}getLineContent(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new ni("Illegal value for lineNumber");return this._buffer.getLineContent(e)}getLineLength(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new ni("Illegal value for lineNumber");return this._buffer.getLineLength(e)}getLinesContent(){if(this._assertNotDisposed(),this.isTooLargeForHeapOperation())throw new ni("Operation would exceed heap memory limits");return this._buffer.getLinesContent()}getEOL(){return this._assertNotDisposed(),this._buffer.getEOL()}getEndOfLineSequence(){return this._assertNotDisposed(),this._buffer.getEOL()===`
`?0:1}getLineMinColumn(e){return this._assertNotDisposed(),1}getLineMaxColumn(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new ni("Illegal value for lineNumber");return this._buffer.getLineLength(e)+1}getLineFirstNonWhitespaceColumn(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new ni("Illegal value for lineNumber");return this._buffer.getLineFirstNonWhitespaceColumn(e)}getLineLastNonWhitespaceColumn(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new ni("Illegal value for lineNumber");return this._buffer.getLineLastNonWhitespaceColumn(e)}_validateRangeRelaxedNoAllocations(e){let t=this._buffer.getLineCount(),o=e.startLineNumber,n=e.startColumn,r=Math.floor(typeof o=="number"&&!isNaN(o)?o:1),s=Math.floor(typeof n=="number"&&!isNaN(n)?n:1);if(r<1)r=1,s=1;else if(r>t)r=t,s=this.getLineMaxColumn(r);else if(s<=1)s=1;else{let h=this.getLineMaxColumn(r);s>=h&&(s=h)}let l=e.endLineNumber,c=e.endColumn,u=Math.floor(typeof l=="number"&&!isNaN(l)?l:1),p=Math.floor(typeof c=="number"&&!isNaN(c)?c:1);if(u<1)u=1,p=1;else if(u>t)u=t,p=this.getLineMaxColumn(u);else if(p<=1)p=1;else{let h=this.getLineMaxColumn(u);p>=h&&(p=h)}return o===r&&n===s&&l===u&&c===p&&e instanceof z&&!(e instanceof Yt)?e:new z(r,s,u,p)}_isValidPosition(e,t,o){if(typeof e!="number"||typeof t!="number"||isNaN(e)||isNaN(t)||e<1||t<1||(e|0)!==e||(t|0)!==t)return!1;let n=this._buffer.getLineCount();if(e>n)return!1;if(t===1)return!0;let r=this.getLineMaxColumn(e);if(t>r)return!1;if(o===1){let s=this._buffer.getLineCharCode(e,t-2);if(Ru(s))return!1}return!0}_validatePosition(e,t,o){let n=Math.floor(typeof e=="number"&&!isNaN(e)?e:1),r=Math.floor(typeof t=="number"&&!isNaN(t)?t:1),s=this._buffer.getLineCount();if(n<1)return new Ie(1,1);if(n>s)return new Ie(s,this.getLineMaxColumn(s));if(r<=1)return new Ie(n,1);let l=this.getLineMaxColumn(n);if(r>=l)return new Ie(n,l);if(o===1){let c=this._buffer.getLineCharCode(n,r-2);if(Ru(c))return new Ie(n,r-1)}return new Ie(n,r)}validatePosition(e){let t=1;return this._assertNotDisposed(),e instanceof Ie&&this._isValidPosition(e.lineNumber,e.column,t)?e:this._validatePosition(e.lineNumber,e.column,t)}isValidRange(e){return this._isValidRange(e,1)}_isValidRange(e,t){let o=e.startLineNumber,n=e.startColumn,r=e.endLineNumber,s=e.endColumn;if(!this._isValidPosition(o,n,0)||!this._isValidPosition(r,s,0))return!1;if(t===1){let l=n>1?this._buffer.getLineCharCode(o,n-2):0,c=s>1&&s<=this._buffer.getLineLength(r)?this._buffer.getLineCharCode(r,s-2):0,u=Ru(l),p=Ru(c);return!u&&!p}return!0}validateRange(e){let t=1;if(this._assertNotDisposed(),e instanceof z&&!(e instanceof Yt)&&this._isValidRange(e,t))return e;let o=this._validatePosition(e.startLineNumber,e.startColumn,0),n=this._validatePosition(e.endLineNumber,e.endColumn,0),r=o.lineNumber,s=o.column,l=n.lineNumber,c=n.column;if(t===1){let u=s>1?this._buffer.getLineCharCode(r,s-2):0,p=c>1&&c<=this._buffer.getLineLength(l)?this._buffer.getLineCharCode(l,c-2):0,h=Ru(u),g=Ru(p);return!h&&!g?new z(r,s,l,c):r===l&&s===c?new z(r,s-1,l,c-1):h&&g?new z(r,s-1,l,c+1):h?new z(r,s-1,l,c):new z(r,s,l,c+1)}return new z(r,s,l,c)}modifyPosition(e,t){this._assertNotDisposed();let o=this.getOffsetAt(e)+t;return this.getPositionAt(Math.min(this._buffer.getLength(),Math.max(0,o)))}getFullModelRange(){this._assertNotDisposed();let e=this.getLineCount();return new z(1,1,e,this.getLineMaxColumn(e))}findMatchesLineByLine(e,t,o,n){return this._buffer.findMatchesLineByLine(e,t,o,n)}findMatches(e,t,o,n,r,s,l=eNo){this._assertNotDisposed();let c=null;t!==null&&typeof t!="boolean"&&(Array.isArray(t)||(t=[t]),t.every(h=>z.isIRange(h))&&(c=t.map(h=>this.validateRange(h)))),c===null&&(c=[this.getFullModelRange()]),c=c.sort((h,g)=>h.startLineNumber-g.startLineNumber||h.startColumn-g.startColumn);let u=[];u.push(c.reduce((h,g)=>z.areIntersecting(h,g)?h.plusRange(g):(u.push(h),g)));let p;if(!o&&e.indexOf(`
`)<0){let g=new Oy(e,o,n,r).parseSearchRequest();if(!g)return[];p=f=>this.findMatchesLineByLine(f,g,s,l)}else p=h=>Sse.findMatches(this,new Oy(e,o,n,r),h,s,l);return u.map(p).reduce((h,g)=>h.concat(g),[])}findNextMatch(e,t,o,n,r,s){this._assertNotDisposed();let l=this.validatePosition(t);if(!o&&e.indexOf(`
`)<0){let u=new Oy(e,o,n,r).parseSearchRequest();if(!u)return null;let p=this.getLineCount(),h=new z(l.lineNumber,l.column,p,this.getLineMaxColumn(p)),g=this.findMatchesLineByLine(h,u,s,1);return Sse.findNextMatch(this,new Oy(e,o,n,r),l,s),g.length>0||(h=new z(1,1,l.lineNumber,this.getLineMaxColumn(l.lineNumber)),g=this.findMatchesLineByLine(h,u,s,1),g.length>0)?g[0]:null}return Sse.findNextMatch(this,new Oy(e,o,n,r),l,s)}findPreviousMatch(e,t,o,n,r,s){this._assertNotDisposed();let l=this.validatePosition(t);return Sse.findPreviousMatch(this,new Oy(e,o,n,r),l,s)}pushStackElement(){this._commandManager.pushStackElement()}popStackElement(){this._commandManager.popStackElement()}pushEOL(e){if((this.getEOL()===`
`?0:1)!==e)try{this._onDidChangeDecorations.beginDeferredEmit(),this._eventEmitter.beginDeferredEmit(),this._initialUndoRedoSnapshot===null&&(this._initialUndoRedoSnapshot=this._undoRedoService.createSnapshot(this.uri)),this._commandManager.pushEOL(e)}finally{this._eventEmitter.endDeferredEmit(),this._onDidChangeDecorations.endDeferredEmit()}}_validateEditOperation(e){if(e instanceof H6)return e;let t=this.validateRange(e.range),o=e.text;if(o){let n=o.length>0&&o.charCodeAt(o.length-1)===13;this.getEOL()===`\r
`&&n&&t.endColumn===this.getLineMaxColumn(t.endLineNumber)&&(o=o.substring(0,o.length-1))}return new H6(e.identifier||null,t,o,e.forceMoveMarkers||!1,e.isAutoWhitespaceEdit||!1,e._isTracked||!1)}_validateEditOperations(e){let t=[];for(let o=0,n=e.length;o<n;o++)t[o]=this._validateEditOperation(e[o]);return t}edit(e,t){this.pushEditOperations(null,e.replacements.map(o=>({range:o.range,text:o.text})),null)}pushEditOperations(e,t,o,n,r){try{return this._onDidChangeDecorations.beginDeferredEmit(),this._eventEmitter.beginDeferredEmit(),this._pushEditOperations(e,this._validateEditOperations(t),o,n,r)}finally{this._eventEmitter.endDeferredEmit(),this._onDidChangeDecorations.endDeferredEmit()}}_pushEditOperations(e,t,o,n,r){if(this._options.trimAutoWhitespace&&this._trimAutoWhitespaceLines){let s=t.map(c=>({range:this.validateRange(c.range),text:c.text})),l=!0;if(e)for(let c=0,u=e.length;c<u;c++){let p=e[c],h=!1;for(let g=0,f=s.length;g<f;g++){let v=s[g].range,b=v.startLineNumber>p.endLineNumber,S=p.startLineNumber>v.endLineNumber;if(!b&&!S){h=!0;break}}if(!h){l=!1;break}}if(l)for(let c=0,u=this._trimAutoWhitespaceLines.length;c<u;c++){let p=this._trimAutoWhitespaceLines[c],h=this.getLineMaxColumn(p),g=!0;for(let f=0,v=s.length;f<v;f++){let b=s[f].range,S=s[f].text;if(!(p<b.startLineNumber||p>b.endLineNumber)&&!(p===b.startLineNumber&&b.startColumn===h&&b.isEmpty()&&S&&S.length>0&&S.charAt(0)===`
`)&&!(p===b.startLineNumber&&b.startColumn===1&&b.isEmpty()&&S&&S.length>0&&S.charAt(S.length-1)===`
`)){g=!1;break}}if(g){let f=new z(p,1,p,h);t.push(new H6(null,f,null,!1,!1,!1))}}this._trimAutoWhitespaceLines=null}return this._initialUndoRedoSnapshot===null&&(this._initialUndoRedoSnapshot=this._undoRedoService.createSnapshot(this.uri)),this._commandManager.pushEditOperation(e,t,o,n,r)}_applyUndo(e,t,o,n){let r=e.map(s=>{let l=this.getPositionAt(s.newPosition),c=this.getPositionAt(s.newEnd);return{range:new z(l.lineNumber,l.column,c.lineNumber,c.column),text:s.oldText}});this._applyUndoRedoEdits(r,t,!0,!1,o,n)}_applyRedo(e,t,o,n){let r=e.map(s=>{let l=this.getPositionAt(s.oldPosition),c=this.getPositionAt(s.oldEnd);return{range:new z(l.lineNumber,l.column,c.lineNumber,c.column),text:s.newText}});this._applyUndoRedoEdits(r,t,!1,!0,o,n)}_applyUndoRedoEdits(e,t,o,n,r,s){try{this._onDidChangeDecorations.beginDeferredEmit(),this._eventEmitter.beginDeferredEmit(),this._isUndoing=o,this._isRedoing=n;let l=this._validateEditOperations(e);this._doApplyEdits(l,!1,_c.applyEdits(),s),this.setEOL(t),this._overwriteAlternativeVersionId(r)}finally{this._isUndoing=!1,this._isRedoing=!1,this._eventEmitter.endDeferredEmit(s),this._onDidChangeDecorations.endDeferredEmit()}}applyEdits(e,t,o){try{this._onDidChangeDecorations.beginDeferredEmit(),this._eventEmitter.beginDeferredEmit();let n=this._validateEditOperations(e);return this._doApplyEdits(n,t??!1,o??_c.applyEdits())}finally{this._eventEmitter.endDeferredEmit(),this._onDidChangeDecorations.endDeferredEmit()}}_doApplyEdits(e,t,o,n=null){let r=this._buffer.getLineCount(),s=this._buffer.applyEdits(e,this._options.trimAutoWhitespace,t),l=this._buffer.getLineCount(),c=s.changes;if(this._trimAutoWhitespaceLines=s.trimAutoWhitespaceLineNumbers,c.length!==0){for(let h=0,g=c.length;h<g;h++){let f=c[h];this._decorationsTree.acceptReplace(f.rangeOffset,f.rangeLength,f.text.length,f.forceMoveMarkers)}let u=[];this._increaseVersionId();let p=r;for(let h=0,g=c.length;h<g;h++){let f=c[h],[v]=OS(f.text);this._onDidChangeDecorations.fire();let b=f.range.startLineNumber,S=f.range.endLineNumber,y=S-b,w=v,k=Math.min(y,w),T=w-y,N=l-p-T+b,O=N,V=N+w,U=this._decorationsTree.getInjectedTextInInterval(this,this.getOffsetAt(new Ie(O,1)),this.getOffsetAt(new Ie(V,this.getLineMaxColumn(V))),0),G=e_.fromDecorations(U),$=new bS(G);for(let te=k;te>=0;te--){let pe=b+te,de=N+te;$.takeFromEndWhile(Se=>Se.lineNumber>de);let se=$.takeFromEndWhile(Se=>Se.lineNumber===de);u.push(new pqe(pe,de,this.getLineContent(de),se))}if(k<y){let te=b+k,pe=w-y,de=l-p-pe+te;u.push(new xvt(te+1,S,de))}if(k<w){let te=new bS(G),pe=b+k,de=w-k,se=l-p-de+pe+1,Se=[],ke=[];for(let Ee=0;Ee<de;Ee++){let He=se+Ee;ke[Ee]=this.getLineContent(He),te.takeWhile(Ve=>Ve.lineNumber<He),Se[Ee]=te.takeWhile(Ve=>Ve.lineNumber===He)}u.push(new kvt(pe+1,se,de,ke,Se))}p+=T}this._emitContentChangedEvent(new nae(u,this.getVersionId(),this._isUndoing,this._isRedoing),{changes:c,eol:this._buffer.getEOL(),isEolChange:!1,versionId:this.getVersionId(),isUndoing:this._isUndoing,isRedoing:this._isRedoing,isFlush:!1,detailedReasons:[o],detailedReasonsChangeLengths:[c.length]},n)}return s.reverseEdits===null?void 0:s.reverseEdits}undo(){return this._undoRedoService.undo(this.uri)}canUndo(){return this._undoRedoService.canUndo(this.uri)}redo(){return this._undoRedoService.redo(this.uri)}canRedo(){return this._undoRedoService.canRedo(this.uri)}handleBeforeFireDecorationsChangedEvent(e,t,o){if(e&&e.size>0){let r=Array.from(e).map(s=>new pqe(s,s,this.getLineContent(s),this._getInjectedTextInLine(s)));this._onDidChangeContentOrInjectedText(new oye(r))}this._fireOnDidChangeLineHeight(t),this._fireOnDidChangeFont(o)}_fireOnDidChangeLineHeight(e){if(e&&e.size>0){let o=Array.from(e).map(n=>new wvt(n.ownerId,n.decorationId,n.lineNumber,n.lineHeight));this._onDidChangeLineHeight.fire(new nye(o))}}_fireOnDidChangeFont(e){if(e&&e.size>0){let o=Array.from(e).map(n=>new Cvt(n.ownerId,n.lineNumber));this._onDidChangeFont.fire(new rye(o))}}_onDidChangeContentOrInjectedText(e){for(let t of this._viewModels)try{t.onDidChangeContentOrInjectedText(e)}catch(o){mt(o)}for(let t of this._viewModels)try{t.emitContentChangeEvent(e)}catch(o){mt(o)}}changeDecorations(e,t=0){this._assertNotDisposed();try{return this._onDidChangeDecorations.beginDeferredEmit(),this._changeDecorations(t,e)}finally{this._onDidChangeDecorations.endDeferredEmit()}}_changeDecorations(e,t){let o={addDecoration:(r,s)=>this._deltaDecorationsImpl(e,[],[{range:r,options:s}])[0],changeDecoration:(r,s)=>{this._changeDecorationImpl(e,r,s)},changeDecorationOptions:(r,s)=>{this._changeDecorationOptionsImpl(e,r,xji(s))},removeDecoration:r=>{this._deltaDecorationsImpl(e,[r],[])},deltaDecorations:(r,s)=>r.length===0&&s.length===0?[]:this._deltaDecorationsImpl(e,r,s)},n=null;try{n=t(o)}catch(r){mt(r)}return o.addDecoration=Wqe,o.changeDecoration=Wqe,o.changeDecorationOptions=Wqe,o.removeDecoration=Wqe,o.deltaDecorations=Wqe,n}deltaDecorations(e,t,o=0){if(this._assertNotDisposed(),e||(e=[]),e.length===0&&t.length===0)return[];try{return this._deltaDecorationCallCnt++,this._deltaDecorationCallCnt>1&&(console.warn("Invoking deltaDecorations recursively could lead to leaking decorations."),mt(new Error("Invoking deltaDecorations recursively could lead to leaking decorations."))),this._onDidChangeDecorations.beginDeferredEmit(),this._deltaDecorationsImpl(o,e,t)}finally{this._onDidChangeDecorations.endDeferredEmit(),this._deltaDecorationCallCnt--}}_getTrackedRange(e){return this.getDecorationRange(e)}_setTrackedRange(e,t,o){let n=e?this._decorations[e]:null;if(!n)return t?this._deltaDecorationsImpl(0,[],[{range:t,options:Cji[o]}],!0)[0]:null;if(!t)return this._decorationsTree.delete(n),delete this._decorations[n.id],null;let r=this._validateRangeRelaxedNoAllocations(t),s=this._buffer.getOffsetAt(r.startLineNumber,r.startColumn),l=this._buffer.getOffsetAt(r.endLineNumber,r.endColumn);return this._decorationsTree.delete(n),n.reset(this.getVersionId(),s,l,r),n.setOptions(Cji[o]),this._decorationsTree.insert(n),n.id}removeAllDecorationsWithOwnerId(e){if(this._isDisposed)return;let t=this._decorationsTree.collectNodesFromOwner(e);for(let o=0,n=t.length;o<n;o++){let r=t[o];this._decorationsTree.delete(r),delete this._decorations[r.id]}}getDecorationOptions(e){let t=this._decorations[e];return t?t.options:null}getDecorationRange(e){let t=this._decorations[e];return t?this._decorationsTree.getNodeRange(this,t):null}getLineDecorations(e,t=0,o=!1,n=!1){return e<1||e>this.getLineCount()?[]:this.getLinesDecorations(e,e,t,o,n)}getLinesDecorations(e,t,o=0,n=!1,r=!1,s=!1){let l=this.getLineCount(),c=Math.min(l,Math.max(1,e)),u=Math.min(l,Math.max(1,t)),p=this.getLineMaxColumn(u),h=new z(c,1,u,p),g=this._getDecorationsInRange(h,o,n,r,s);return e$(g,this._decorationProvider.getDecorationsInRange(h,o,n,r)),e$(g,this._fontTokenDecorationsProvider.getDecorationsInRange(h,o,n,r)),g}getDecorationsInRange(e,t=0,o=!1,n=!1,r=!1,s=!1){let l=this.validateRange(e),c=this._getDecorationsInRange(l,t,o,n,s);return e$(c,this._decorationProvider.getDecorationsInRange(l,t,o,n,r)),e$(c,this._fontTokenDecorationsProvider.getDecorationsInRange(l,t,o,n,r)),c}getOverviewRulerDecorations(e=0,t=!1,o=!1){return this._decorationsTree.getAll(this,e,t,o,!0,!1)}getInjectedTextDecorations(e=0){return this._decorationsTree.getAllInjectedText(this,e)}getCustomLineHeightsDecorations(e=0){let t=this._decorationsTree.getAllCustomLineHeights(this,e);return e$(t,this._fontTokenDecorationsProvider.getAllDecorations(e)),t}getCustomLineHeightsDecorationsInRange(e,t=0){let o=this._decorationsTree.getCustomLineHeightsInInterval(this,this.getOffsetAt(e.getStartPosition()),this.getOffsetAt(e.getEndPosition()),t);return e$(o,this._fontTokenDecorationsProvider.getDecorationsInRange(e,t)),o}_getInjectedTextInLine(e){let t=this._buffer.getOffsetAt(e,1),o=t+this._buffer.getLineLength(e),n=this._decorationsTree.getInjectedTextInInterval(this,t,o,0);return e_.fromDecorations(n).filter(r=>r.lineNumber===e)}getFontDecorationsInRange(e,t=0){let o=this._buffer.getOffsetAt(e.startLineNumber,e.startColumn),n=this._buffer.getOffsetAt(e.endLineNumber,e.endColumn);return this._decorationsTree.getFontDecorationsInInterval(this,o,n,t)}getAllDecorations(e=0,t=!1,o=!1){let n=this._decorationsTree.getAll(this,e,t,o,!1,!1);return n=n.concat(this._decorationProvider.getAllDecorations(e,t)),n=n.concat(this._fontTokenDecorationsProvider.getAllDecorations(e,t)),n}getAllMarginDecorations(e=0){return this._decorationsTree.getAll(this,e,!1,!1,!1,!0)}_getDecorationsInRange(e,t,o,n,r){let s=this._buffer.getOffsetAt(e.startLineNumber,e.startColumn),l=this._buffer.getOffsetAt(e.endLineNumber,e.endColumn);return this._decorationsTree.getAllInInterval(this,s,l,t,o,n,r)}getRangeAt(e,t){return this._buffer.getRangeAt(e,t-e)}_changeDecorationImpl(e,t,o){let n=this._decorations[t];if(!n)return;if(n.options.after){let c=this.getDecorationRange(t);this._onDidChangeDecorations.recordLineAffectedByInjectedText(c.endLineNumber)}if(n.options.before){let c=this.getDecorationRange(t);this._onDidChangeDecorations.recordLineAffectedByInjectedText(c.startLineNumber)}if(n.options.lineHeight!==null){let c=this.getDecorationRange(t);this._onDidChangeDecorations.recordLineAffectedByLineHeightChange(e,t,c.startLineNumber,null)}if(n.options.affectsFont){let c=this.getDecorationRange(t);this._onDidChangeDecorations.recordLineAffectedByFontChange(e,n.id,c.startLineNumber)}let r=this._validateRangeRelaxedNoAllocations(o),s=this._buffer.getOffsetAt(r.startLineNumber,r.startColumn),l=this._buffer.getOffsetAt(r.endLineNumber,r.endColumn);this._decorationsTree.delete(n),n.reset(this.getVersionId(),s,l,r),this._decorationsTree.insert(n),this._onDidChangeDecorations.checkAffectedAndFire(n.options),n.options.after&&this._onDidChangeDecorations.recordLineAffectedByInjectedText(r.endLineNumber),n.options.before&&this._onDidChangeDecorations.recordLineAffectedByInjectedText(r.startLineNumber),n.options.lineHeight!==null&&this._onDidChangeDecorations.recordLineAffectedByLineHeightChange(e,t,r.startLineNumber,n.options.lineHeight),n.options.affectsFont&&this._onDidChangeDecorations.recordLineAffectedByFontChange(e,n.id,r.startLineNumber)}_changeDecorationOptionsImpl(e,t,o){let n=this._decorations[t];if(!n)return;let r=!!(n.options.overviewRuler&&n.options.overviewRuler.color),s=!!(o.overviewRuler&&o.overviewRuler.color);if(this._onDidChangeDecorations.checkAffectedAndFire(n.options),this._onDidChangeDecorations.checkAffectedAndFire(o),n.options.after||o.after){let u=this._decorationsTree.getNodeRange(this,n);this._onDidChangeDecorations.recordLineAffectedByInjectedText(u.endLineNumber)}if(n.options.before||o.before){let u=this._decorationsTree.getNodeRange(this,n);this._onDidChangeDecorations.recordLineAffectedByInjectedText(u.startLineNumber)}if(n.options.lineHeight!==null||o.lineHeight!==null){let u=this._decorationsTree.getNodeRange(this,n);this._onDidChangeDecorations.recordLineAffectedByLineHeightChange(e,t,u.startLineNumber,o.lineHeight)}if(n.options.affectsFont||o.affectsFont){let u=this._decorationsTree.getNodeRange(this,n);this._onDidChangeDecorations.recordLineAffectedByFontChange(e,t,u.startLineNumber)}let l=r!==s,c=oNo(o)!==nbt(n);l||c?(this._decorationsTree.delete(n),n.setOptions(o),this._decorationsTree.insert(n)):n.setOptions(o)}_deltaDecorationsImpl(e,t,o,n=!1){let r=this.getVersionId(),s=t.length,l=0,c=o.length,u=0;this._onDidChangeDecorations.beginDeferredEmit();try{let p=new Array(c);for(;l<s||u<c;){let h=null;if(l<s){let g;do g=t[l++],h=this._decorations[g];while(!h&&l<s);if(h){if(h.options.after){let f=this._decorationsTree.getNodeRange(this,h);this._onDidChangeDecorations.recordLineAffectedByInjectedText(f.endLineNumber)}if(h.options.before){let f=this._decorationsTree.getNodeRange(this,h);this._onDidChangeDecorations.recordLineAffectedByInjectedText(f.startLineNumber)}if(h.options.lineHeight!==null){let f=this._decorationsTree.getNodeRange(this,h);this._onDidChangeDecorations.recordLineAffectedByLineHeightChange(e,g,f.startLineNumber,null)}if(h.options.affectsFont){let f=this._decorationsTree.getNodeRange(this,h);this._onDidChangeDecorations.recordLineAffectedByFontChange(e,g,f.startLineNumber)}this._decorationsTree.delete(h),n||this._onDidChangeDecorations.checkAffectedAndFire(h.options)}}if(u<c){if(!h){let y=++this._lastDecorationId,w=`${this._instanceId};${y}`;h=new rae(w,0,0),this._decorations[w]=h}let g=o[u],f=this._validateRangeRelaxedNoAllocations(g.range),v=xji(g.options),b=this._buffer.getOffsetAt(f.startLineNumber,f.startColumn),S=this._buffer.getOffsetAt(f.endLineNumber,f.endColumn);h.ownerId=e,h.reset(r,b,S,f),h.setOptions(v),h.options.after&&this._onDidChangeDecorations.recordLineAffectedByInjectedText(f.endLineNumber),h.options.before&&this._onDidChangeDecorations.recordLineAffectedByInjectedText(f.startLineNumber),h.options.lineHeight!==null&&this._onDidChangeDecorations.recordLineAffectedByLineHeightChange(e,h.id,f.startLineNumber,h.options.lineHeight),h.options.affectsFont&&this._onDidChangeDecorations.recordLineAffectedByFontChange(e,h.id,f.startLineNumber),n||this._onDidChangeDecorations.checkAffectedAndFire(v),this._decorationsTree.insert(h),p[u]=h.id,u++}else h&&delete this._decorations[h.id]}return p}finally{this._onDidChangeDecorations.endDeferredEmit()}}getLanguageId(){return this.tokenization.getLanguageId()}setLanguage(e,t){typeof e=="string"?(this._languageSelectionListener.clear(),this._setLanguage(e,t)):(this._languageSelectionListener.value=e.onDidChange(()=>this._setLanguage(e.languageId,t)),this._setLanguage(e.languageId,t))}_setLanguage(e,t){this.tokenization.setLanguageId(e,t),this._languageService.requestRichLanguageFeatures(e)}getLanguageIdAtPosition(e,t){return this.tokenization.getLanguageIdAtPosition(e,t)}getWordAtPosition(e){return this._tokenizationTextModelPart.getWordAtPosition(e)}getWordUntilPosition(e){return this._tokenizationTextModelPart.getWordUntilPosition(e)}normalizePosition(e,t){return e}getLineIndentColumn(e){return yye(this.getLineContent(e))+1}toString(){return`TextModel(${this.uri.toString()})`}};Bu=I([m(4,Cl),m(5,kt),m(6,bs),m(7,F)],Bu);function kji(a,i,e){let t;if(e){let o=[];for(let n=0;n<e.length;n++){let r=e[n],s=i[n].tokens;s?s.forEach((l,c)=>{o.push({offset:r,text:l.substring(i[n].content),tokenMetadata:c.metadata})}):o.push({offset:r,text:i[n].content,tokenMetadata:Bc.defaultTokenMetadata})}t=a.withInserted(o)}else t=a;return t}function yye(a){let i=0;for(let e of a)if(e===" "||e===" ")i++;else break;return i}function lei(a){return!!(a.options.overviewRuler&&a.options.overviewRuler.color)}function oNo(a){return!!a.after||!!a.before}function nbt(a){return!!a.options.after||!!a.options.before}var rbt=class{constructor(){this._decorationsTree0=new L9,this._decorationsTree1=new L9,this._injectedTextDecorationsTree=new L9}ensureAllNodesHaveRanges(i){this.getAll(i,0,!1,!1,!1,!1)}_ensureNodesHaveRanges(i,e){for(let t of e)t.range===null&&(t.range=i.getRangeAt(t.cachedAbsoluteStart,t.cachedAbsoluteEnd));return e}getAllInInterval(i,e,t,o,n,r,s){let l=i.getVersionId(),c=this._intervalSearch(e,t,o,n,r,l,s);return this._ensureNodesHaveRanges(i,c)}_intervalSearch(i,e,t,o,n,r,s){let l=this._decorationsTree0.intervalSearch(i,e,t,o,n,r,s),c=this._decorationsTree1.intervalSearch(i,e,t,o,n,r,s),u=this._injectedTextDecorationsTree.intervalSearch(i,e,t,o,n,r,s);return l.concat(c).concat(u)}getInjectedTextInInterval(i,e,t,o){let n=i.getVersionId(),r=this._injectedTextDecorationsTree.intervalSearch(e,t,o,!1,!1,n,!1);return this._ensureNodesHaveRanges(i,r).filter(s=>s.options.showIfCollapsed||!s.range.isEmpty())}getFontDecorationsInInterval(i,e,t,o){let n=i.getVersionId(),r=this._decorationsTree0.intervalSearch(e,t,o,!1,!1,n,!1);return this._ensureNodesHaveRanges(i,r).filter(s=>s.options.affectsFont)}getAllInjectedText(i,e){let t=i.getVersionId(),o=this._injectedTextDecorationsTree.search(e,!1,!1,t,!1);return this._ensureNodesHaveRanges(i,o).filter(n=>n.options.showIfCollapsed||!n.range.isEmpty())}getAllCustomLineHeights(i,e){let t=i.getVersionId(),o=this._search(e,!1,!1,!1,t,!1);return this._ensureNodesHaveRanges(i,o).filter(n=>typeof n.options.lineHeight=="number")}getCustomLineHeightsInInterval(i,e,t,o){let n=i.getVersionId(),r=this._intervalSearch(e,t,o,!1,!1,n,!1);return this._ensureNodesHaveRanges(i,r).filter(s=>typeof s.options.lineHeight=="number")}getAll(i,e,t,o,n,r){let s=i.getVersionId(),l=this._search(e,t,o,n,s,r);return this._ensureNodesHaveRanges(i,l)}_search(i,e,t,o,n,r){if(o)return this._decorationsTree1.search(i,e,t,n,r);{let s=this._decorationsTree0.search(i,e,t,n,r),l=this._decorationsTree1.search(i,e,t,n,r),c=this._injectedTextDecorationsTree.search(i,e,t,n,r);return s.concat(l).concat(c)}}collectNodesFromOwner(i){let e=this._decorationsTree0.collectNodesFromOwner(i),t=this._decorationsTree1.collectNodesFromOwner(i),o=this._injectedTextDecorationsTree.collectNodesFromOwner(i);return e.concat(t).concat(o)}collectNodesPostOrder(){let i=this._decorationsTree0.collectNodesPostOrder(),e=this._decorationsTree1.collectNodesPostOrder(),t=this._injectedTextDecorationsTree.collectNodesPostOrder();return i.concat(e).concat(t)}insert(i){nbt(i)?this._injectedTextDecorationsTree.insert(i):lei(i)?this._decorationsTree1.insert(i):this._decorationsTree0.insert(i)}delete(i){nbt(i)?this._injectedTextDecorationsTree.delete(i):lei(i)?this._decorationsTree1.delete(i):this._decorationsTree0.delete(i)}getNodeRange(i,e){let t=i.getVersionId();return e.cachedVersionId!==t&&this._resolveNode(e,t),e.range===null&&(e.range=i.getRangeAt(e.cachedAbsoluteStart,e.cachedAbsoluteEnd)),e.range}_resolveNode(i,e){nbt(i)?this._injectedTextDecorationsTree.resolveNode(i,e):lei(i)?this._decorationsTree1.resolveNode(i,e):this._decorationsTree0.resolveNode(i,e)}acceptReplace(i,e,t,o){this._decorationsTree0.acceptReplace(i,e,t,o),this._decorationsTree1.acceptReplace(i,e,t,o),this._injectedTextDecorationsTree.acceptReplace(i,e,t,o)}};function o1(a){return a.replace(/[^a-z0-9\-_]/gi," ")}var sbt=class{constructor(i){this.color=i.color||"",this.darkColor=i.darkColor||""}},dei=class extends sbt{constructor(i){super(i),this._resolvedColor=null,this.position=typeof i.position=="number"?i.position:2}getColor(i){return this._resolvedColor||(Ip(i.type)&&this.darkColor?this._resolvedColor=this._resolveColor(this.darkColor,i):this._resolvedColor=this._resolveColor(this.color,i)),this._resolvedColor}invalidateCachedColor(){this._resolvedColor=null}_resolveColor(i,e){if(typeof i=="string")return i;let t=i?e.getColor(i.id):null;return t?t.toString():""}},uei=class{constructor(i){this.position=i?.position??2,this.persistLane=i?.persistLane}},pei=class extends sbt{constructor(i){super(i),this.position=i.position,this.sectionHeaderStyle=i.sectionHeaderStyle??null,this.sectionHeaderText=i.sectionHeaderText??null}getColor(i){return this._resolvedColor||(Ip(i.type)&&this.darkColor?this._resolvedColor=this._resolveColor(this.darkColor,i):this._resolvedColor=this._resolveColor(this.color,i)),this._resolvedColor}invalidateCachedColor(){this._resolvedColor=void 0}_resolveColor(i,e){return typeof i=="string"?Oe.fromHex(i):e.getColor(i.id)}},r1=class a{static from(i){return i instanceof a?i:new a(i)}constructor(i){this.content=i.content||"",this.tokens=i.tokens??null,this.inlineClassName=i.inlineClassName||null,this.inlineClassNameAffectsLetterSpacing=i.inlineClassNameAffectsLetterSpacing||!1,this.attachedData=i.attachedData||null,this.cursorStops=i.cursorStops||null}},po=class a{static register(i){return new a(i)}static createDynamic(i){return new a(i)}constructor(i){this.description=i.description,this.blockClassName=i.blockClassName?o1(i.blockClassName):null,this.blockDoesNotCollapse=i.blockDoesNotCollapse??null,this.blockIsAfterEnd=i.blockIsAfterEnd??null,this.blockPadding=i.blockPadding??null,this.stickiness=i.stickiness||0,this.zIndex=i.zIndex||0,this.className=i.className?o1(i.className):null,this.shouldFillLineOnLineBreak=i.shouldFillLineOnLineBreak??null,this.hoverMessage=i.hoverMessage||null,this.glyphMarginHoverMessage=i.glyphMarginHoverMessage||null,this.lineNumberHoverMessage=i.lineNumberHoverMessage||null,this.isWholeLine=i.isWholeLine||!1,this.lineHeight=i.lineHeight?Math.min(i.lineHeight,iNo):null,this.fontSize=i.fontSize||null,this.affectsFont=!!i.fontSize||!!i.fontFamily||!!i.fontWeight||!!i.fontStyle,this.showIfCollapsed=i.showIfCollapsed||!1,this.collapseOnReplaceEdit=i.collapseOnReplaceEdit||!1,this.overviewRuler=i.overviewRuler?new dei(i.overviewRuler):null,this.minimap=i.minimap?new pei(i.minimap):null,this.glyphMargin=i.glyphMarginClassName?new uei(i.glyphMargin):null,this.glyphMarginClassName=i.glyphMarginClassName?o1(i.glyphMarginClassName):null,this.linesDecorationsClassName=i.linesDecorationsClassName?o1(i.linesDecorationsClassName):null,this.lineNumberClassName=i.lineNumberClassName?o1(i.lineNumberClassName):null,this.linesDecorationsTooltip=i.linesDecorationsTooltip?hpt(i.linesDecorationsTooltip):null,this.firstLineDecorationClassName=i.firstLineDecorationClassName?o1(i.firstLineDecorationClassName):null,this.marginClassName=i.marginClassName?o1(i.marginClassName):null,this.inlineClassName=i.inlineClassName?o1(i.inlineClassName):null,this.inlineClassNameAffectsLetterSpacing=i.inlineClassNameAffectsLetterSpacing||!1,this.beforeContentClassName=i.beforeContentClassName?o1(i.beforeContentClassName):null,this.afterContentClassName=i.afterContentClassName?o1(i.afterContentClassName):null,this.after=i.after?r1.from(i.after):null,this.before=i.before?r1.from(i.before):null,this.hideInCommentTokens=i.hideInCommentTokens??!1,this.hideInStringTokens=i.hideInStringTokens??!1,this.textDirection=i.textDirection??null}};po.EMPTY=po.register({description:"empty"});var Cji=[po.register({description:"tracked-range-always-grows-when-typing-at-edges",stickiness:0}),po.register({description:"tracked-range-never-grows-when-typing-at-edges",stickiness:1}),po.register({description:"tracked-range-grows-only-when-typing-before",stickiness:2}),po.register({description:"tracked-range-grows-only-when-typing-after",stickiness:3})];function xji(a){return a instanceof po?a:po.createDynamic(a)}var mei=class extends C{constructor(e){super();this.handleBeforeFire=e;this._actual=this._register(new E);this.event=this._actual.event;this._affectedInjectedTextLines=null;this._affectedLineHeights=null;this._affectedFontLines=null;this._deferredCnt=0,this._shouldFireDeferred=!1,this._affectsMinimap=!1,this._affectsOverviewRuler=!1,this._affectsGlyphMargin=!1,this._affectsLineNumber=!1}hasListeners(){return this._actual.hasListeners()}beginDeferredEmit(){this._deferredCnt++}endDeferredEmit(){this._deferredCnt--,this._deferredCnt===0&&(this._shouldFireDeferred&&this.doFire(),this._affectedInjectedTextLines?.clear(),this._affectedInjectedTextLines=null,this._affectedLineHeights?.clear(),this._affectedLineHeights=null,this._affectedFontLines?.clear(),this._affectedFontLines=null)}recordLineAffectedByInjectedText(e){this._affectedInjectedTextLines||(this._affectedInjectedTextLines=new Set),this._affectedInjectedTextLines.add(e)}recordLineAffectedByLineHeightChange(e,t,o,n){this._affectedLineHeights||(this._affectedLineHeights=new lre([],dq.toKey)),this._affectedLineHeights.add(new dq(e,t,o,n))}recordLineAffectedByFontChange(e,t,o){this._affectedFontLines||(this._affectedFontLines=new lre([],uq.toKey)),this._affectedFontLines.add(new uq(e,t,o))}checkAffectedAndFire(e){this._affectsMinimap||=!!e.minimap?.position,this._affectsOverviewRuler||=!!e.overviewRuler?.color,this._affectsGlyphMargin||=!!e.glyphMarginClassName,this._affectsLineNumber||=!!e.lineNumberClassName,this.tryFire()}fire(){this._affectsMinimap=!0,this._affectsOverviewRuler=!0,this._affectsGlyphMargin=!0,this.tryFire()}tryFire(){this._deferredCnt===0?this.doFire():this._shouldFireDeferred=!0}doFire(){this.handleBeforeFire(this._affectedInjectedTextLines,this._affectedLineHeights,this._affectedFontLines);let e={affectsMinimap:this._affectsMinimap,affectsOverviewRuler:this._affectsOverviewRuler,affectsGlyphMargin:this._affectsGlyphMargin,affectsLineNumber:this._affectsLineNumber};this._shouldFireDeferred=!1,this._affectsMinimap=!1,this._affectsOverviewRuler=!1,this._affectsGlyphMargin=!1,this._actual.fire(e)}},hei=class extends C{constructor(){super();this._emitter=this._register(new E);this.event=this._emitter.event;this._deferredCnt=0,this._deferredEvent=null}hasListeners(){return this._emitter.hasListeners()}beginDeferredEmit(){this._deferredCnt++}endDeferredEmit(e=null){if(this._deferredCnt--,this._deferredCnt===0&&this._deferredEvent!==null){this._deferredEvent.rawContentChangedEvent.resultingSelection=e;let t=this._deferredEvent;this._deferredEvent=null,this._emitter.fire(t)}}fire(e){if(this._deferredCnt>0){this._deferredEvent?this._deferredEvent=this._deferredEvent.merge(e):this._deferredEvent=e;return}this._emitter.fire(e)}};var abt=class a{static create(i){return new a(i.get(151),i.get(150))}constructor(i,e){this.classifier=new gei(i,e)}createLineBreaksComputer(i,e,t,o,n,r){let s=[],l=[],c=[];return{addRequest:(u,p,h)=>{s.push(u),l.push(p),c.push(h)},finalize:()=>{let u=i.typicalFullwidthCharacterWidth/i.typicalHalfwidthCharacterWidth,p=[];for(let h=0,g=s.length;h<g;h++){let f=l[h],v=c[h],b=s[h],S=r&&b.includes('"')&&b.includes("\\n");v&&!v.injectionOptions&&!f&&!S?p[h]=nNo(this.classifier,v,b,e,t,u,o,n):p[h]=rNo(this.classifier,b,f,e,t,u,o,n,S)}return fei.length=0,vei.length=0,p}}}};var gei=class extends _${constructor(i,e){super(0);for(let t=0;t<i.length;t++)this.set(i.charCodeAt(t),1);for(let t=0;t<e.length;t++)this.set(e.charCodeAt(t),2)}get(i){return i>=0&&i<256?this._asciiMap[i]:i>=12352&&i<=12543||i>=13312&&i<=19903||i>=19968&&i<=40959?3:this._map.get(i)||this._defaultValue}},fei=[],vei=[];function nNo(a,i,e,t,o,n,r,s){if(o===-1)return null;let l=e.length;if(l<=1)return null;let c=s==="keepAll",u=i.breakOffsets,p=i.breakOffsetsVisibleColumn,h=Tji(e,t,o,n,r),g=o-h,f=fei,v=vei,b=0,S=0,y=0,w=o,k=u.length,T=0;if(T>=0){let N=Math.abs(p[T]-w);for(;T+1<k;){let O=Math.abs(p[T+1]-w);if(O>=N)break;N=O,T++}}for(;T<k;){let N=T<0?0:u[T],O=T<0?0:p[T];S>N&&(N=S,O=y);let V=0,U=0,G=0,$=0;if(O<=w){let pe=O,de=N===0?0:e.charCodeAt(N-1),se=N===0?0:a.get(de),Se=!0;for(let ke=N;ke<l;ke++){let Ee=ke,He=e.charCodeAt(ke),Ve,Fe;if(Ru(He)?(ke++,Ve=0,Fe=2):(Ve=a.get(He),Fe=Vqe(He,pe,t,n)),Ee>S&&bei(de,se,He,Ve,c)&&(V=Ee,U=pe),pe+=Fe,pe>w){Ee>S?(G=Ee,$=pe-Fe):(G=ke+1,$=pe),pe-U>g&&(V=0),Se=!1;break}de=He,se=Ve}if(Se){b>0&&(f[b]=u[u.length-1],v[b]=p[u.length-1],b++);break}}if(V===0){let pe=O,de=e.charCodeAt(N),se=a.get(de),Se=!1;for(let ke=N-1;ke>=S;ke--){let Ee=ke+1,He=e.charCodeAt(ke);if(He===9){Se=!0;break}let Ve,Fe;if(nN(He)?(ke--,Ve=0,Fe=2):(Ve=a.get(He),Fe=AT(He)?n:1),pe<=w){if(G===0&&(G=Ee,$=pe),pe<=w-g)break;if(bei(He,Ve,de,se,c)){V=Ee,U=pe;break}}pe-=Fe,de=He,se=Ve}if(V!==0){let ke=g-($-U);if(ke<=t){let Ee=e.charCodeAt(G),He;Ru(Ee)?He=2:He=Vqe(Ee,$,t,n),ke-He<0&&(V=0)}}if(Se){T--;continue}}if(V===0&&(V=G,U=$),V<=S){let pe=e.charCodeAt(S);Ru(pe)?(V=S+2,U=y+2):(V=S+1,U=y+Vqe(pe,y,t,n))}for(S=V,f[b]=V,y=U,v[b]=U,b++,w=U+g;T<0||T<k&&p[T]<U;)T++;let te=Math.abs(p[T]-w);for(;T+1<k;){let pe=Math.abs(p[T+1]-w);if(pe>=te)break;te=pe,T++}}return b===0?null:(f.length=b,v.length=b,fei=i.breakOffsets,vei=i.breakOffsetsVisibleColumn,i.breakOffsets=f,i.breakOffsetsVisibleColumn=v,i.wrappedTextIndentLength=h,i)}function rNo(a,i,e,t,o,n,r,s,l){let c=e_.applyInjectedText(i,e),u,p;if(e&&e.length>0?(u=e.map(G=>G.options),p=e.map(G=>G.column-1)):(u=null,p=null),o===-1)return u?new oq(p,u,[c.length],[],0):null;let h=c.length;if(h<=1)return u?new oq(p,u,[c.length],[],0):null;let g=s==="keepAll",f=Tji(c,t,o,n,r),v=o-f,b=[],S=[],y=0,w=0,k=0,T=o,N=c.charCodeAt(0),O=a.get(N),V=Vqe(N,0,t,n),U=1;Ru(N)&&(V+=1,N=c.charCodeAt(1),O=a.get(N),U++);for(let G=U;G<h;G++){let $=G,te=c.charCodeAt(G),pe,de,se=!1;Ru(te)?(G++,pe=0,de=2):(pe=a.get(te),de=Vqe(te,V,t,n)),l&&sNo(c,G)?(w=$,k=V,se=!0):bei(N,O,te,pe,g)&&(w=$,k=V),V+=de,(V>T||se)&&((w===0||V-k>v)&&(w=$,k=V-de),b[y]=w,S[y]=k,y++,T=k+v,w=0),N=te,O=pe}return y===0&&(!e||e.length===0)?null:(b[y]=h,S[y]=V,new oq(p,u,b,S,f))}function Vqe(a,i,e,t){return a===9?e-i%e:AT(a)||a<32?t:1}function Eji(a,i){return i-a%i}function sNo(a,i){if(i>=2&&a.charAt(i-1)==="n"){let e=0;for(let t=i-2;t>=0;t--)if(a.charAt(t)==="\\")e++;else return e%2===1}return!1}function bei(a,i,e,t,o){return e!==32&&(i===2&&t!==2||i!==1&&t===1||!o&&i===3&&t!==2||!o&&t===3&&i!==1)}function Tji(a,i,e,t,o){let n=0;if(o!==0){let r=Ap(a);if(r!==-1){for(let l=0;l<r;l++){let c=a.charCodeAt(l)===9?Eji(n,i):1;n+=c}let s=o===3?2:o===2?1:0;for(let l=0;l<s;l++){let c=Eji(n,i);n+=c}n+t>e&&(n=0)}}return n}var Bqe=class a{constructor(i){this._selTrackedRange=null,this._trackSelection=!0,this._setState(i,new ov(new z(1,1,1,1),0,0,new Ie(1,1),0),new ov(new z(1,1,1,1),0,0,new Ie(1,1),0))}dispose(i){this._removeTrackedRange(i)}startTrackingSelection(i){this._trackSelection=!0,this._updateTrackedRange(i)}stopTrackingSelection(i){this._trackSelection=!1,this._removeTrackedRange(i)}_updateTrackedRange(i){this._trackSelection&&(this._selTrackedRange=i.model._setTrackedRange(this._selTrackedRange,this.modelState.selection,0))}_removeTrackedRange(i){this._selTrackedRange=i.model._setTrackedRange(this._selTrackedRange,null,0)}asCursorState(){return new Ps(this.modelState,this.viewState)}readSelectionFromMarkers(i){let e=i.model._getTrackedRange(this._selTrackedRange);return this.modelState.selection.isEmpty()&&!e.isEmpty()?Yt.fromRange(e.collapseToEnd(),this.modelState.selection.getDirection()):Yt.fromRange(e,this.modelState.selection.getDirection())}ensureValidState(i){this._setState(i,this.modelState,this.viewState)}setState(i,e,t){this._setState(i,e,t)}static _validatePositionWithCache(i,e,t,o){return e.equals(t)?o:i.normalizePosition(e,2)}static _validateViewState(i,e){let t=e.position,o=e.selectionStart.getStartPosition(),n=e.selectionStart.getEndPosition(),r=i.normalizePosition(t,2),s=this._validatePositionWithCache(i,o,t,r),l=this._validatePositionWithCache(i,n,o,s);return t.equals(r)&&o.equals(s)&&n.equals(l)?e:new ov(z.fromPositions(s,l),e.selectionStartKind,e.selectionStartLeftoverVisibleColumns+o.column-s.column,r,e.leftoverVisibleColumns+t.column-r.column)}_setState(i,e,t){if(t&&(t=a._validateViewState(i.viewModel,t)),e){let o=i.model.validateRange(e.selectionStart),n=e.selectionStart.equalsRange(o)?e.selectionStartLeftoverVisibleColumns:0,r=i.model.validatePosition(e.position),s=e.position.equals(r)?e.leftoverVisibleColumns:0;e=new ov(o,e.selectionStartKind,n,r,s)}else{if(!t)return;let o=i.model.validateRange(i.coordinatesConverter.convertViewRangeToModelRange(t.selectionStart)),n=i.model.validatePosition(i.coordinatesConverter.convertViewPositionToModelPosition(t.position));e=new ov(o,t.selectionStartKind,t.selectionStartLeftoverVisibleColumns,n,t.leftoverVisibleColumns)}if(t){let o=i.coordinatesConverter.validateViewRange(t.selectionStart,e.selectionStart),n=i.coordinatesConverter.validateViewPosition(t.position,e.position);t=new ov(o,e.selectionStartKind,e.selectionStartLeftoverVisibleColumns,n,e.leftoverVisibleColumns)}else{let o=i.coordinatesConverter.convertModelPositionToViewPosition(new Ie(e.selectionStart.startLineNumber,e.selectionStart.startColumn)),n=i.coordinatesConverter.convertModelPositionToViewPosition(new Ie(e.selectionStart.endLineNumber,e.selectionStart.endColumn)),r=new z(o.lineNumber,o.column,n.lineNumber,n.column),s=i.coordinatesConverter.convertModelPositionToViewPosition(e.position);t=new ov(r,e.selectionStartKind,e.selectionStartLeftoverVisibleColumns,s,e.leftoverVisibleColumns)}this.modelState=e,this.viewState=t,this._updateTrackedRange(i)}};var Hqe=class{constructor(i){this.context=i,this.cursors=[new Bqe(i)],this.lastAddedCursorIndex=0}dispose(){for(let i of this.cursors)i.dispose(this.context)}startTrackingSelections(){for(let i of this.cursors)i.startTrackingSelection(this.context)}stopTrackingSelections(){for(let i of this.cursors)i.stopTrackingSelection(this.context)}updateContext(i){this.context=i}ensureValidState(){for(let i of this.cursors)i.ensureValidState(this.context)}readSelectionFromMarkers(){return this.cursors.map(i=>i.readSelectionFromMarkers(this.context))}getAll(){return this.cursors.map(i=>i.asCursorState())}getViewPositions(){return this.cursors.map(i=>i.viewState.position)}getTopMostViewPosition(){return Put(this.cursors,tl(i=>i.viewState.position,Ie.compare)).viewState.position}getBottomMostViewPosition(){return Mut(this.cursors,tl(i=>i.viewState.position,Ie.compare)).viewState.position}getSelections(){return this.cursors.map(i=>i.modelState.selection)}getViewSelections(){return this.cursors.map(i=>i.viewState.selection)}setSelections(i){this.setStates(Ps.fromModelSelections(i))}getPrimaryCursor(){return this.cursors[0].asCursorState()}setStates(i){i!==null&&(this.cursors[0].setState(this.context,i[0].modelState,i[0].viewState),this._setSecondaryStates(i.slice(1)))}_setSecondaryStates(i){let e=this.cursors.length-1,t=i.length;if(e<t){let o=t-e;for(let n=0;n<o;n++)this._addSecondaryCursor()}else if(e>t){let o=e-t;for(let n=0;n<o;n++)this._removeSecondaryCursor(this.cursors.length-2)}for(let o=0;o<t;o++)this.cursors[o+1].setState(this.context,i[o].modelState,i[o].viewState)}killSecondaryCursors(){this._setSecondaryStates([])}_addSecondaryCursor(){this.cursors.push(new Bqe(this.context)),this.lastAddedCursorIndex=this.cursors.length-1}getLastAddedCursorIndex(){return this.cursors.length===1||this.lastAddedCursorIndex===0?0:this.lastAddedCursorIndex}_removeSecondaryCursor(i){this.lastAddedCursorIndex>=i+1&&this.lastAddedCursorIndex--,this.cursors[i+1].dispose(this.context),this.cursors.splice(i+1,1)}normalize(){if(this.cursors.length===1)return;let i=this.cursors.slice(0),e=[];for(let t=0,o=i.length;t<o;t++)e.push({index:t,selection:i[t].modelState.selection});e.sort(tl(t=>t.selection,z.compareRangesUsingStarts));for(let t=0;t<e.length-1;t++){let o=e[t],n=e[t+1],r=o.selection,s=n.selection;if(!this.context.cursorConfig.multiCursorMergeOverlapping)continue;let l;if(s.isEmpty()||r.isEmpty()?l=s.getStartPosition().isBeforeOrEqual(r.getEndPosition()):l=s.getStartPosition().isBefore(r.getEndPosition()),l){let c=o.index<n.index?t:t+1,u=o.index<n.index?t+1:t,p=e[u].index,h=e[c].index,g=e[u].selection,f=e[c].selection;if(!g.equalsSelection(f)){let v=g.plusRange(f),b=g.selectionStartLineNumber===g.startLineNumber&&g.selectionStartColumn===g.startColumn,S=f.selectionStartLineNumber===f.startLineNumber&&f.selectionStartColumn===f.startColumn,y;p===this.lastAddedCursorIndex?(y=b,this.lastAddedCursorIndex=h):y=S;let w;y?w=new Yt(v.startLineNumber,v.startColumn,v.endLineNumber,v.endColumn):w=new Yt(v.endLineNumber,v.endColumn,v.startLineNumber,v.startColumn),e[c].selection=w;let k=Ps.fromModelSelection(w);i[h].setState(this.context,k.modelState,k.viewState)}for(let v of e)v.index>p&&v.index--;i.splice(p,1),e.splice(u,1),this._removeSecondaryCursor(p-1),t--}}}};var Uqe=class{constructor(i,e,t,o){this._cursorContextBrand=void 0;this.model=i,this.viewModel=e,this.coordinatesConverter=t,this.cursorConfig=o}};var lbt=class extends C{constructor(){super();this._onEvent=this._register(new E);this.onEvent=this._onEvent.event;this._eventHandlers=[],this._viewEventQueue=null,this._isConsumingViewEventQueue=!1,this._collector=null,this._collectorCnt=0,this._outgoingEvents=[]}emitOutgoingEvent(e){this._addOutgoingEvent(e),this._emitOutgoingEvents()}_addOutgoingEvent(e){for(let t=0,o=this._outgoingEvents.length;t<o;t++){let n=this._outgoingEvents[t].kind===e.kind?this._outgoingEvents[t].attemptToMerge(e):null;if(n){this._outgoingEvents[t]=n;return}}this._outgoingEvents.push(e)}_emitOutgoingEvents(){for(;this._outgoingEvents.length>0;){if(this._collector||this._isConsumingViewEventQueue)return;let e=this._outgoingEvents.shift();e.isNoOp()||this._onEvent.fire(e)}}addViewEventHandler(e){for(let t=0,o=this._eventHandlers.length;t<o;t++)this._eventHandlers[t]===e&&console.warn("Detected duplicate listener in ViewEventDispatcher",e);this._eventHandlers.push(e)}removeViewEventHandler(e){for(let t=0;t<this._eventHandlers.length;t++)if(this._eventHandlers[t]===e){this._eventHandlers.splice(t,1);break}}beginEmitViewEvents(){return this._collectorCnt++,this._collectorCnt===1&&(this._collector=new VM),this._collector}endEmitViewEvents(){if(this._collectorCnt--,this._collectorCnt===0){let e=this._collector.outgoingEvents,t=this._collector.viewEvents;this._collector=null;for(let o of e)this._addOutgoingEvent(o);t.length>0&&this._emitMany(t)}this._emitOutgoingEvents()}emitSingleViewEvent(e){try{this.beginEmitViewEvents().emitViewEvent(e)}finally{this.endEmitViewEvents()}}_emitMany(e){this._viewEventQueue?this._viewEventQueue=this._viewEventQueue.concat(e):this._viewEventQueue=e,this._isConsumingViewEventQueue||this._consumeViewEventQueue()}_consumeViewEventQueue(){try{this._isConsumingViewEventQueue=!0,this._doConsumeQueue()}finally{this._isConsumingViewEventQueue=!1}}_doConsumeQueue(){for(;this._viewEventQueue;){let e=this._viewEventQueue;this._viewEventQueue=null;let t=this._eventHandlers.slice(0);for(let o of t)o.handleEvents(e)}}},VM=class{constructor(){this.viewEvents=[],this.outgoingEvents=[]}emitViewEvent(i){this.viewEvents.push(i)}emitOutgoingEvent(i){this.outgoingEvents.push(i)}};var cbt=class a{constructor(i,e,t,o){this.kind=0;this._oldContentWidth=i,this._oldContentHeight=e,this.contentWidth=t,this.contentHeight=o,this.contentWidthChanged=this._oldContentWidth!==this.contentWidth,this.contentHeightChanged=this._oldContentHeight!==this.contentHeight}isNoOp(){return!this.contentWidthChanged&&!this.contentHeightChanged}attemptToMerge(i){return i.kind!==this.kind?null:new a(this._oldContentWidth,this._oldContentHeight,i.contentWidth,i.contentHeight)}},zqe=class a{constructor(i,e){this.kind=1;this.oldHasFocus=i,this.hasFocus=e}isNoOp(){return this.oldHasFocus===this.hasFocus}attemptToMerge(i){return i.kind!==this.kind?null:new a(this.oldHasFocus,i.hasFocus)}},dbt=class{constructor(i,e){this.kind=2;this.oldHasFocus=i,this.hasFocus=e}isNoOp(){return this.oldHasFocus===this.hasFocus}attemptToMerge(i){return i.kind!==this.kind?null:new zqe(this.oldHasFocus,i.hasFocus)}},ubt=class a{constructor(i,e,t,o,n,r,s,l){this.kind=3;this._oldScrollWidth=i,this._oldScrollLeft=e,this._oldScrollHeight=t,this._oldScrollTop=o,this.scrollWidth=n,this.scrollLeft=r,this.scrollHeight=s,this.scrollTop=l,this.scrollWidthChanged=this._oldScrollWidth!==this.scrollWidth,this.scrollLeftChanged=this._oldScrollLeft!==this.scrollLeft,this.scrollHeightChanged=this._oldScrollHeight!==this.scrollHeight,this.scrollTopChanged=this._oldScrollTop!==this.scrollTop}isNoOp(){return!this.scrollWidthChanged&&!this.scrollLeftChanged&&!this.scrollHeightChanged&&!this.scrollTopChanged}attemptToMerge(i){return i.kind!==this.kind?null:new a(this._oldScrollWidth,this._oldScrollLeft,this._oldScrollHeight,this._oldScrollTop,i.scrollWidth,i.scrollLeft,i.scrollHeight,i.scrollTop)}},pbt=class{constructor(){this.kind=4}isNoOp(){return!1}attemptToMerge(i){return i.kind!==this.kind?null:this}},mbt=class{constructor(){this.kind=5}isNoOp(){return!1}attemptToMerge(i){return i.kind!==this.kind?null:this}},hbt=class a{constructor(i,e,t,o,n,r,s){this.kind=7;this.oldSelections=i,this.selections=e,this.oldModelVersionId=t,this.modelVersionId=o,this.source=n,this.reason=r,this.reachedMaxCursorCount=s}static _selectionsAreEqual(i,e){if(!i&&!e)return!0;if(!i||!e)return!1;let t=i.length,o=e.length;if(t!==o)return!1;for(let n=0;n<t;n++)if(!i[n].equalsSelection(e[n]))return!1;return!0}isNoOp(){return a._selectionsAreEqual(this.oldSelections,this.selections)&&this.oldModelVersionId===this.modelVersionId}attemptToMerge(i){return i.kind!==this.kind?null:new a(this.oldSelections,i.selections,this.oldModelVersionId,i.modelVersionId,i.source,i.reason,this.reachedMaxCursorCount||i.reachedMaxCursorCount)}},gbt=class{constructor(){this.kind=6}isNoOp(){return!1}attemptToMerge(i){return i.kind!==this.kind?null:this}},fbt=class{constructor(i){this.event=i;this.kind=8}isNoOp(){return!1}attemptToMerge(i){return null}},vbt=class{constructor(i){this.event=i;this.kind=9}isNoOp(){return!1}attemptToMerge(i){return null}},bbt=class{constructor(i){this.event=i;this.kind=10}isNoOp(){return!1}attemptToMerge(i){return null}},Sbt=class{constructor(i){this.event=i;this.kind=11}isNoOp(){return!1}attemptToMerge(i){return null}},Ibt=class{constructor(i){this.event=i;this.kind=12}isNoOp(){return!1}attemptToMerge(i){return null}},ybt=class{constructor(i){this.event=i;this.kind=13}isNoOp(){return!1}attemptToMerge(i){return null}},wbt=class{constructor(i){this.event=i;this.kind=14}isNoOp(){return!1}attemptToMerge(i){return null}},Cbt=class{constructor(i){this.event=i;this.kind=15}isNoOp(){return!1}attemptToMerge(i){return null}};var wye=class extends C{constructor(i,e,t,o){super(),this._model=i,this._knownModelVersionId=this._model.getVersionId(),this._viewModel=e,this._coordinatesConverter=t,this.context=new Uqe(this._model,this._viewModel,this._coordinatesConverter,o),this._cursors=new Hqe(this.context),this._hasFocus=!1,this._isHandling=!1,this._compositionState=null,this._columnSelectData=null,this._autoClosedActions=[],this._prevEditOperationType=0}dispose(){this._cursors.dispose(),this._autoClosedActions=Ue(this._autoClosedActions),super.dispose()}updateConfiguration(i){this.context=new Uqe(this._model,this._viewModel,this._coordinatesConverter,i),this._cursors.updateContext(this.context)}onLineMappingChanged(i){this._knownModelVersionId===this._model.getVersionId()&&this.setStates(i,"viewModel",0,this.getCursorStates())}setHasFocus(i){this._hasFocus=i}_validateAutoClosedActions(){if(this._autoClosedActions.length>0){let i=this._cursors.getSelections();for(let e=0;e<this._autoClosedActions.length;e++){let t=this._autoClosedActions[e];t.isValid(i)||(t.dispose(),this._autoClosedActions.splice(e,1),e--)}}}getPrimaryCursorState(){return this._cursors.getPrimaryCursor()}getLastAddedCursorIndex(){return this._cursors.getLastAddedCursorIndex()}getCursorStates(){return this._cursors.getAll()}setStates(i,e,t,o){let n=!1,r=this.context.cursorConfig.multiCursorLimit;o!==null&&o.length>r&&(o=o.slice(0,r),n=!0);let s=Kqe.from(this._model,this);return this._cursors.setStates(o),this._cursors.normalize(),this._columnSelectData=null,this._validateAutoClosedActions(),this._emitStateChangedIfNecessary(i,e,t,s,n)}setCursorColumnSelectData(i){this._columnSelectData=i}revealAll(i,e,t,o,n,r){let s=this._cursors.getViewPositions(),l=null,c=null;s.length>1?c=this._cursors.getViewSelections():l=z.fromPositions(s[0],s[0]),i.emitViewEvent(new A$(e,t,l,c,o,n,r))}revealPrimary(i,e,t,o,n,r){let l=[this._cursors.getPrimaryCursor().viewState.selection];i.emitViewEvent(new A$(e,t,null,l,o,n,r))}saveState(){let i=[],e=this._cursors.getSelections();for(let t=0,o=e.length;t<o;t++){let n=e[t];i.push({inSelectionMode:!n.isEmpty(),selectionStart:{lineNumber:n.selectionStartLineNumber,column:n.selectionStartColumn},position:{lineNumber:n.positionLineNumber,column:n.positionColumn}})}return i}restoreState(i,e){let t=[];for(let o=0,n=e.length;o<n;o++){let r=e[o],s=1,l=1;r.position&&r.position.lineNumber&&(s=r.position.lineNumber),r.position&&r.position.column&&(l=r.position.column);let c=s,u=l;r.selectionStart&&r.selectionStart.lineNumber&&(c=r.selectionStart.lineNumber),r.selectionStart&&r.selectionStart.column&&(u=r.selectionStart.column),t.push({selectionStartLineNumber:c,selectionStartColumn:u,positionLineNumber:s,positionColumn:l})}this.setStates(i,"restoreState",0,Ps.fromModelSelections(t)),this.revealAll(i,"restoreState",!1,0,!0,1)}onModelContentChanged(i,e){if(e instanceof oye){if(this._isHandling)return;this._isHandling=!0;try{this.setStates(i,"modelChange",0,this.getCursorStates())}finally{this._isHandling=!1}}else{let t=e.rawContentChangedEvent;if(this._knownModelVersionId=t.versionId,this._isHandling)return;let o=t.containsEvent(1);if(this._prevEditOperationType=0,o)this._cursors.dispose(),this._cursors=new Hqe(this.context),this._validateAutoClosedActions(),this._emitStateChangedIfNecessary(i,"model",1,null,!1);else if(this._hasFocus&&t.resultingSelection&&t.resultingSelection.length>0){let n=Ps.fromModelSelections(t.resultingSelection);this.setStates(i,"modelChange",t.isUndoing?5:t.isRedoing?6:2,n)&&this.revealAll(i,"modelChange",!1,0,!0,0)}else{let n=this._cursors.readSelectionFromMarkers();this.setStates(i,"modelChange",2,Ps.fromModelSelections(n))}}}getSelection(){return this._cursors.getPrimaryCursor().modelState.selection}getTopMostViewPosition(){return this._cursors.getTopMostViewPosition()}getBottomMostViewPosition(){return this._cursors.getBottomMostViewPosition()}getCursorColumnSelectData(){if(this._columnSelectData)return this._columnSelectData;let i=this._cursors.getPrimaryCursor(),e=i.viewState.selectionStart.getStartPosition(),t=i.viewState.position;return{isReal:!1,fromViewLineNumber:e.lineNumber,fromViewVisualColumn:this.context.cursorConfig.visibleColumnFromColumn(this._viewModel,e),toViewLineNumber:t.lineNumber,toViewVisualColumn:this.context.cursorConfig.visibleColumnFromColumn(this._viewModel,t)}}getSelections(){return this._cursors.getSelections()}getPosition(){return this._cursors.getPrimaryCursor().modelState.position}setSelections(i,e,t,o){this.setStates(i,e,o,Ps.fromModelSelections(t))}getPrevEditOperationType(){return this._prevEditOperationType}setPrevEditOperationType(i){this._prevEditOperationType=i}_pushAutoClosedAction(i,e){let t=[],o=[];for(let s=0,l=i.length;s<l;s++)t.push({range:i[s],options:{description:"auto-closed-character",inlineClassName:"auto-closed-character",stickiness:1}}),o.push({range:e[s],options:{description:"auto-closed-enclosing",stickiness:1}});let n=this._model.deltaDecorations([],t),r=this._model.deltaDecorations([],o);this._autoClosedActions.push(new xbt(this._model,n,r))}_executeEditOperation(i,e){if(!i)return;i.shouldPushStackElementBefore&&this._model.pushStackElement();let t=V9.executeCommands(this._model,this._cursors.getSelections(),i.commands,e);if(t){this._interpretCommandResult(t);let o=[],n=[];for(let r=0;r<i.commands.length;r++){let s=i.commands[r];s instanceof wSe&&s.enclosingRange&&s.closeCharacterRange&&(o.push(s.closeCharacterRange),n.push(s.enclosingRange))}o.length>0&&this._pushAutoClosedAction(o,n),this._prevEditOperationType=i.type}i.shouldPushStackElementAfter&&this._model.pushStackElement()}_interpretCommandResult(i){(!i||i.length===0)&&(i=this._cursors.readSelectionFromMarkers()),this._columnSelectData=null,this._cursors.setSelections(i),this._cursors.normalize()}_emitStateChangedIfNecessary(i,e,t,o,n){let r=Kqe.from(this._model,this);if(r.equals(o))return!1;let s=this._cursors.getSelections(),l=this._cursors.getViewSelections();if(i.emitViewEvent(new Iht(l,s,t)),!o||o.cursorState.length!==r.cursorState.length||r.cursorState.some((c,u)=>!c.modelState.equals(o.cursorState[u].modelState))){let c=o?o.cursorState.map(p=>p.modelState.selection):null,u=o?o.modelVersionId:0;i.emitOutgoingEvent(new hbt(c,s,u,r.modelVersionId,e||"keyboard",t,n))}return!0}_findAutoClosingPairs(i){if(!i.length)return null;let e=[];for(let t=0,o=i.length;t<o;t++){let n=i[t];if(!n.text||n.text.indexOf(`
`)>=0)return null;let r=n.text.match(/([)\]}>'"`])([^)\]}>'"`]*)$/);if(!r)return null;let s=r[1],l=this.context.cursorConfig.autoClosingPairs.autoClosingPairsCloseSingleChar.get(s);if(!l||l.length!==1)return null;let c=l[0].open,u=n.text.length-r[2].length-1,p=n.text.lastIndexOf(c,u-1);if(p===-1)return null;e.push([p,u])}return e}executeEdits(i,e,t,o,n){let r=null;e==="snippet"&&(r=this._findAutoClosingPairs(t)),r&&(t[0]._isTracked=!0);let s=[],l=[],c=this._model.pushEditOperations(this.getSelections(),t,u=>{if(r)for(let h=0,g=r.length;h<g;h++){let[f,v]=r[h],b=u[h],S=b.range.startLineNumber,y=b.range.startColumn-1+f,w=b.range.startColumn-1+v;s.push(new z(S,w+1,S,w+2)),l.push(new z(S,y+1,S,w+2))}let p=o(u);return p&&(this._isHandling=!0),p},void 0,n);c&&(this._isHandling=!1,this.setSelections(i,e,c,0)),s.length>0&&this._pushAutoClosedAction(s,l)}_executeEdit(i,e,t,o=0){if(this.context.cursorConfig.readOnly)return;let n=Kqe.from(this._model,this);this._cursors.stopTrackingSelections(),this._isHandling=!0;try{this._cursors.ensureValidState(),i()}catch(r){mt(r)}this._isHandling=!1,this._cursors.startTrackingSelections(),this._validateAutoClosedActions(),this._emitStateChangedIfNecessary(e,t,o,n,!1)&&this.revealAll(e,t,!1,0,!0,0)}getAutoClosedCharacters(){return xbt.getAllAutoClosedCharacters(this._autoClosedActions)}startComposition(i){this._compositionState=new Iei(this._model,this.getSelections())}endComposition(i,e){let t=_c.cursor({kind:"compositionEnd",detailedSource:e}),o=this._compositionState?this._compositionState.deduceOutcome(this._model,this.getSelections()):null;this._compositionState=null,this._executeEdit(()=>{e==="keyboard"&&this._executeEditOperation(RM.compositionEndWithInterceptors(this._prevEditOperationType,this.context.cursorConfig,this._model,o,this.getSelections(),this.getAutoClosedCharacters()),t)},i,e)}type(i,e,t){let o=_c.cursor({kind:"type",detailedSource:t});this._executeEdit(()=>{if(t==="keyboard"){let n=e.length,r=0;for(;r<n;){let s=Tbe(e,r),l=e.substr(r,s);this._executeEditOperation(RM.typeWithInterceptors(!!this._compositionState,this._prevEditOperationType,this.context.cursorConfig,this._model,this.getSelections(),this.getAutoClosedCharacters(),l),o),r+=s}}else this._executeEditOperation(RM.typeWithoutInterceptors(this._prevEditOperationType,this.context.cursorConfig,this._model,this.getSelections(),e),o)},i,t)}compositionType(i,e,t,o,n,r){let s=_c.cursor({kind:"compositionType",detailedSource:r});if(e.length===0&&t===0&&o===0){if(n!==0){let l=this.getSelections().map(c=>{let u=c.getPosition();return new Yt(u.lineNumber,u.column+n,u.lineNumber,u.column+n)});this.setSelections(i,r,l,0)}return}this._executeEdit(()=>{this._executeEditOperation(RM.compositionType(this._prevEditOperationType,this.context.cursorConfig,this._model,this.getSelections(),e,t,o,n),s)},i,r)}paste(i,e,t,o,n){let r=_c.cursor({kind:"paste",detailedSource:n});this._executeEdit(()=>{this._executeEditOperation(RM.paste(this.context.cursorConfig,this._model,this.getSelections(),e,t,o||[]),r)},i,n,4)}cut(i,e){let t=_c.cursor({kind:"cut",detailedSource:e});this._executeEdit(()=>{this._executeEditOperation(wN.cut(this.context.cursorConfig,this._model,this.getSelections()),t)},i,e)}executeCommand(i,e,t){let o=_c.cursor({kind:"executeCommand",detailedSource:t});this._executeEdit(()=>{this._cursors.killSecondaryCursors(),this._executeEditOperation(new Yv(0,[e],{shouldPushStackElementBefore:!1,shouldPushStackElementAfter:!1}),o)},i,t)}executeCommands(i,e,t){let o=_c.cursor({kind:"executeCommands",detailedSource:t});this._executeEdit(()=>{this._executeEditOperation(new Yv(0,e,{shouldPushStackElementBefore:!1,shouldPushStackElementAfter:!1}),o)},i,t)}},Kqe=class a{constructor(i,e){this.modelVersionId=i;this.cursorState=e}static from(i,e){return new a(i.getVersionId(),e.getCursorStates())}equals(i){if(!i||this.modelVersionId!==i.modelVersionId||this.cursorState.length!==i.cursorState.length)return!1;for(let e=0,t=this.cursorState.length;e<t;e++)if(!this.cursorState[e].equals(i.cursorState[e]))return!1;return!0}},xbt=class{static getAllAutoClosedCharacters(i){let e=[];for(let t of i)e=e.concat(t.getAutoClosedCharactersRanges());return e}constructor(i,e,t){this._model=i,this._autoClosedCharactersDecorations=e,this._autoClosedEnclosingDecorations=t}dispose(){this._autoClosedCharactersDecorations=this._model.deltaDecorations(this._autoClosedCharactersDecorations,[]),this._autoClosedEnclosingDecorations=this._model.deltaDecorations(this._autoClosedEnclosingDecorations,[])}getAutoClosedCharactersRanges(){let i=[];for(let e=0;e<this._autoClosedCharactersDecorations.length;e++){let t=this._model.getDecorationRange(this._autoClosedCharactersDecorations[e]);t&&i.push(t)}return i}isValid(i){let e=[];for(let t=0;t<this._autoClosedEnclosingDecorations.length;t++){let o=this._model.getDecorationRange(this._autoClosedEnclosingDecorations[t]);if(o&&(e.push(o),o.startLineNumber!==o.endLineNumber))return!1}e.sort(z.compareRangesUsingStarts),i.sort(z.compareRangesUsingStarts);for(let t=0;t<i.length;t++)if(t>=e.length||!e[t].strictContainsRange(i[t]))return!1;return!0}},V9=class{static executeCommands(i,e,t,o=_c.unknown({name:"executeCommands"})){let n={model:i,selectionsBefore:e,trackedRanges:[],trackedRangesDirection:[]},r=this._innerExecuteCommands(n,t,o);for(let s=0,l=n.trackedRanges.length;s<l;s++)n.model._setTrackedRange(n.trackedRanges[s],null,0);return r}static _innerExecuteCommands(i,e,t){if(this._arrayIsEmpty(e))return null;let o=this._getEditOperations(i,e);if(o.operations.length===0)return null;let n=o.operations,r=this._getLoserCursorMap(n);if(r.hasOwnProperty("0"))return console.warn("Ignoring commands"),null;let s=[];for(let u=0,p=n.length;u<p;u++)r.hasOwnProperty(n[u].identifier.major.toString())||s.push(n[u]);o.hadTrackedEditOperation&&s.length>0&&(s[0]._isTracked=!0);let l=i.model.pushEditOperations(i.selectionsBefore,s,u=>{let p=[];for(let f=0;f<i.selectionsBefore.length;f++)p[f]=[];for(let f of u)f.identifier&&p[f.identifier.major].push(f);let h=(f,v)=>f.identifier.minor-v.identifier.minor,g=[];for(let f=0;f<i.selectionsBefore.length;f++)p[f].length>0?(p[f].sort(h),g[f]=e[f].computeCursorState(i.model,{getInverseEditOperations:()=>p[f],getTrackedSelection:v=>{let b=parseInt(v,10),S=i.model._getTrackedRange(i.trackedRanges[b]);return i.trackedRangesDirection[b]===0?new Yt(S.startLineNumber,S.startColumn,S.endLineNumber,S.endColumn):new Yt(S.endLineNumber,S.endColumn,S.startLineNumber,S.startColumn)}})):g[f]=i.selectionsBefore[f];return g},void 0,t);l||(l=i.selectionsBefore);let c=[];for(let u in r)r.hasOwnProperty(u)&&c.push(parseInt(u,10));c.sort((u,p)=>p-u);for(let u of c)l.splice(u,1);return l}static _arrayIsEmpty(i){for(let e=0,t=i.length;e<t;e++)if(i[e])return!1;return!0}static _getEditOperations(i,e){let t=[],o=!1;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s){let l=this._getEditOperationsFromCommand(i,n,s);t=t.concat(l.operations),o=o||l.hadTrackedEditOperation}}return{operations:t,hadTrackedEditOperation:o}}static _getEditOperationsFromCommand(i,e,t){let o=[],n=0,r=(p,h,g=!1)=>{z.isEmpty(p)&&h===""||o.push({identifier:{major:e,minor:n++},range:p,text:h,forceMoveMarkers:g,isAutoWhitespaceEdit:t.insertsAutoWhitespace})},s=!1,u={addEditOperation:r,addTrackedEditOperation:(p,h,g)=>{s=!0,r(p,h,g)},trackSelection:(p,h)=>{let g=Yt.liftSelection(p),f;if(g.isEmpty())if(typeof h=="boolean")h?f=2:f=3;else{let S=i.model.getLineMaxColumn(g.startLineNumber);g.startColumn===S?f=2:f=3}else f=1;let v=i.trackedRanges.length,b=i.model._setTrackedRange(null,g,f);return i.trackedRanges[v]=b,i.trackedRangesDirection[v]=g.getDirection(),v.toString()}};try{t.getEditOperations(i.model,u)}catch(p){return mt(p),{operations:[],hadTrackedEditOperation:!1}}return{operations:o,hadTrackedEditOperation:s}}static _getLoserCursorMap(i){i=i.slice(0),i.sort((t,o)=>-z.compareRangesUsingEnds(t.range,o.range));let e={};for(let t=1;t<i.length;t++){let o=i[t-1],n=i[t];if(z.getStartPosition(o.range).isBefore(z.getEndPosition(n.range))){let r;o.identifier.major>n.identifier.major?r=o.identifier.major:r=n.identifier.major,e[r.toString()]=!0;for(let s=0;s<i.length;s++)i[s].identifier.major===r&&(i.splice(s,1),s<t&&t--,s--);t>0&&t--}}return e}},Sei=class{constructor(i,e,t,o){this.text=i;this.lineNumber=e;this.startSelectionOffset=t;this.endSelectionOffset=o}},Iei=class a{static _capture(i,e){let t=[];for(let o of e){if(o.startLineNumber!==o.endLineNumber)return null;let n=o.startLineNumber;t.push(new Sei(i.getLineContent(n),n,o.startColumn-1,o.endColumn-1))}return t}constructor(i,e){this._original=a._capture(i,e)}deduceOutcome(i,e){if(!this._original)return null;let t=a._capture(i,e);if(!t||this._original.length!==t.length)return null;let o=[];for(let n=0,r=this._original.length;n<r;n++)o.push(a._deduceOutcome(this._original[n],t[n]));return o}static _deduceOutcome(i,e){let t=Math.min(i.startSelectionOffset,e.startSelectionOffset,Ng(i.text,e.text)),o=Math.min(i.text.length-i.endSelectionOffset,e.text.length-e.endSelectionOffset,zw(i.text,e.text)),n=i.text.substring(t,i.text.length-o),r=t,s=e.text.length-o,l=e.text.substring(r,s),c=new z(e.lineNumber,r+1,e.lineNumber,s+1);return new fht(n,i.startSelectionOffset-t,i.endSelectionOffset-t,l,e.startSelectionOffset-t,e.endSelectionOffset-t,c)}};var yei={getInitialState:()=>nei,tokenizeEncoded:(a,i,e)=>bye(0,e)};function kbt(a,i,e){return wei(i,a.languageIdCodec,kc.get(e)||yei)}async function bW(a,i,e){if(!e)return wei(i,a.languageIdCodec,yei);let t=await kc.getOrCreate(e);return wei(i,a.languageIdCodec,t||yei)}function Ebt(a,i,e,t,o,n,r){let s="<div>",l=0,c=0,u=!0;for(let p=0,h=i.getCount();p<h;p++){let g=i.getEndOffset(p),f="";for(;l<g&&l<o;l++){let v=a.charCodeAt(l),b=v===9;if(c+=AT(v)?2:b?0:1,l<t){if(b){let S=c%n;c+=S===0?n:n-S}continue}switch(v){case 9:{let S=c%n,y=S===0?n:n-S;c+=y;let w=y;for(;w>0;)r&&u?(f+=" ",u=!1):(f+=" ",u=!0),w--;break}case 60:f+="<",u=!1;break;case 62:f+=">",u=!1;break;case 38:f+="&",u=!1;break;case 0:f+="�",u=!1;break;case 65279:case 8232:case 8233:case 133:f+="\uFFFD",u=!1;break;case 13:f+="​",u=!1;break;case 32:r&&u?(f+=" ",u=!1):(f+=" ",u=!0);break;default:f+=String.fromCharCode(v),u=!1}}if(!(g<=t)&&(s+=`<span style="${i.getInlineStyle(p,e)}">${f}</span>`,g>o||l>=o||t>=o))break}return s+="</div>",s}function wei(a,i,e){let t='<div class="monaco-tokenized-source">',o=mc(a),n=e.getInitialState();for(let r=0,s=o.length;r<s;r++){let l=o[r];r>0&&(t+="<br/>");let c=e.tokenizeEncoded(l,!0,n);Bc.convertToEndOffset(c.tokens,l.length);let p=new Bc(c.tokens,l,i).inflate(),h=0;for(let g=0,f=p.getCount();g<f;g++){let v=p.getClassName(g),b=p.getEndOffset(g);t+=`<span class="${v}">${ur(l.substring(h,b))}</span>`,h=b}n=c.endState}return t+="</div>",t}var Cei=class{constructor(i,e,t,o,n){this.decorationId=i,this.index=e,this.lineNumber=t,this.specialHeight=o,this.prefixSum=n,this.maximumSpecialHeight=o,this.deleted=!1}},$qe=class{constructor(i,e){this._decorationIDToCustomLine=new Gqe;this._orderedCustomLines=[];this._pendingChanges=[];this._invalidIndex=1/0;this._hasPending=!1;this._defaultLineHeight=i;for(let t of e)this.insertOrChangeCustomLineHeight(t.decorationId,t.startLineNumber,t.endLineNumber,t.lineHeight)}set defaultLineHeight(i){this._defaultLineHeight=i}get defaultLineHeight(){return this._defaultLineHeight}removeCustomLineHeight(i){this._pendingChanges.push({kind:1,decorationId:i}),this._hasPending=!0}insertOrChangeCustomLineHeight(i,e,t,o){this._pendingChanges.push({kind:0,decorationId:i,startLineNumber:e,endLineNumber:t,lineHeight:o}),this._hasPending=!0}heightForLineNumber(i){this._commit();let e=this._binarySearchOverOrderedCustomLinesArray(i);return e>=0?this._orderedCustomLines[e].maximumSpecialHeight:this._defaultLineHeight}getAccumulatedLineHeightsIncludingLineNumber(i){this._commit();let e=this._binarySearchOverOrderedCustomLinesArray(i);if(e>=0)return this._orderedCustomLines[e].prefixSum+this._orderedCustomLines[e].maximumSpecialHeight;if(e===-1)return this._defaultLineHeight*i;let t=-(e+1),o=this._orderedCustomLines[t-1];return o.prefixSum+o.maximumSpecialHeight+this._defaultLineHeight*(i-o.lineNumber)}onLinesDeleted(i,e){this._pendingChanges.push({kind:2,fromLineNumber:i,toLineNumber:e}),this._hasPending=!0}onLinesInserted(i,e){this._pendingChanges.push({kind:3,fromLineNumber:i,toLineNumber:e}),this._hasPending=!0}_commit(){if(!this._hasPending)return;let i=this._pendingChanges;this._pendingChanges=[],this._hasPending=!1;let e=[];for(let t of i)switch(t.kind){case 1:this._doRemoveCustomLineHeight(t.decorationId,e);break;case 0:this._doInsertOrChangeCustomLineHeight(t.decorationId,t.startLineNumber,t.endLineNumber,t.lineHeight,e);break;case 2:this._flushStagedDecorationChanges(e),this._doLinesDeleted(t.fromLineNumber,t.toLineNumber);break;case 3:this._flushStagedDecorationChanges(e),this._doLinesInserted(t.fromLineNumber,t.toLineNumber,e);break}this._flushStagedDecorationChanges(e)}_doRemoveCustomLineHeight(i,e){let t=this._decorationIDToCustomLine.get(i);if(t){this._decorationIDToCustomLine.delete(i);for(let o of t)o.deleted=!0,this._invalidIndex=Math.min(this._invalidIndex,o.index)}for(let o=e.length-1;o>=0;o--)e[o].decorationId===i&&e.splice(o,1)}_doInsertOrChangeCustomLineHeight(i,e,t,o,n){this._doRemoveCustomLineHeight(i,n);for(let r=e;r<=t;r++){let s=new Cei(i,-1,r,o,0);n.push(s)}}_flushStagedDecorationChanges(i){if(i.length===0&&this._invalidIndex===1/0)return;for(let r of i){let s=this._binarySearchOverOrderedCustomLinesArray(r.lineNumber),l=s>=0?s:-(s+1);this._orderedCustomLines.splice(l,0,r),this._invalidIndex=Math.min(this._invalidIndex,l)}i.length=0;let e=new Gqe,t=[];for(let r=0;r<this._invalidIndex;r++){let s=this._orderedCustomLines[r];t.push(s),e.add(s.decorationId,s)}let o=0,n=this._invalidIndex>0?t[this._invalidIndex-1]:void 0;for(let r=this._invalidIndex;r<this._orderedCustomLines.length;r++){let s=this._orderedCustomLines[r];if(s.deleted){o++;continue}if(s.index=r-o,n&&n.lineNumber===s.lineNumber)s.maximumSpecialHeight=n.maximumSpecialHeight,s.prefixSum=n.prefixSum;else{let l=s.specialHeight;for(let u=r;u<this._orderedCustomLines.length;u++){let p=this._orderedCustomLines[u];if(!p.deleted){if(p.lineNumber!==s.lineNumber)break;l=Math.max(l,p.specialHeight)}}s.maximumSpecialHeight=l;let c;n?c=n.prefixSum+n.maximumSpecialHeight+this._defaultLineHeight*(s.lineNumber-n.lineNumber-1):c=this._defaultLineHeight*(s.lineNumber-1),s.prefixSum=c}n=s,t.push(s),e.add(s.decorationId,s)}this._orderedCustomLines=t,this._decorationIDToCustomLine=e,this._invalidIndex=1/0}_doLinesDeleted(i,e){let t=e-i+1,o=this._orderedCustomLines.length,n=this._binarySearchOverOrderedCustomLinesArray(i),r;if(n>=0){r=n;for(let p=n-1;p>=0&&this._orderedCustomLines[p].lineNumber===i;p--)r--}else r=n===-(o+1)&&n!==-1?o-1:-(n+1);let s=this._binarySearchOverOrderedCustomLinesArray(e),l;if(s>=0){l=s;for(let p=s+1;p<o&&this._orderedCustomLines[p].lineNumber===e;p++)l++}else l=s===-(o+1)&&s!==-1?o-1:-(s+1);let c=l>r,u=l===r&&this._orderedCustomLines[r]&&this._orderedCustomLines[r].lineNumber>=i&&this._orderedCustomLines[r].lineNumber<=e;if(c||u){let p=0;for(let N=r;N<=l;N++)p=Math.max(p,this._orderedCustomLines[N].maximumSpecialHeight);let h=0;if(r>0){let N=this._orderedCustomLines[r-1];h=N.prefixSum+N.maximumSpecialHeight+this._defaultLineHeight*(i-N.lineNumber-1)}else h=i>0?(i-1)*this._defaultLineHeight:0;let g=this._orderedCustomLines[r],f=this._orderedCustomLines[l],v=this._orderedCustomLines[l+1],b=v&&v.lineNumber===e+1?v.maximumSpecialHeight:this._defaultLineHeight,S=f.prefixSum+f.maximumSpecialHeight-g.prefixSum+this._defaultLineHeight*(e-f.lineNumber)+this._defaultLineHeight*(g.lineNumber-i)+b-p,y=new Set,w=[],k=new Gqe,T=0;for(let N=0;N<this._orderedCustomLines.length;N++){let O=this._orderedCustomLines[N];if(N<r)w.push(O),k.add(O.decorationId,O);else if(N>=r&&N<=l){let V=O.decorationId;y.has(V)?T++:(O.index-=T,O.lineNumber=i,O.prefixSum=h,O.maximumSpecialHeight=p,w.push(O),k.add(O.decorationId,O))}else N>l&&(O.index-=T,O.lineNumber-=t,O.prefixSum-=S,w.push(O),k.add(O.decorationId,O));y.add(O.decorationId)}this._orderedCustomLines=w,this._decorationIDToCustomLine=k}else{let p=t*this._defaultLineHeight;for(let h=l;h<this._orderedCustomLines.length;h++){let g=this._orderedCustomLines[h];g.lineNumber>e&&(g.lineNumber-=t,g.prefixSum-=p)}}}_doLinesInserted(i,e,t){let o=e-i+1,n=this._binarySearchOverOrderedCustomLinesArray(i),r;if(n>=0){r=n;for(let h=n-1;h>=0&&this._orderedCustomLines[h].lineNumber===i;h--)r--}else r=-(n+1);let s=[],l=new Set;for(let h=r;h<this._orderedCustomLines.length;h++)this._orderedCustomLines[h].lineNumber===i&&l.add(this._orderedCustomLines[h].decorationId);let c=new Set;for(let h=r-1;h>=0;h--)this._orderedCustomLines[h].lineNumber===i-1&&c.add(this._orderedCustomLines[h].decorationId);let u=Dut(c,l),p=o*this._defaultLineHeight;for(let h=r;h<this._orderedCustomLines.length;h++)this._orderedCustomLines[h].lineNumber+=o,this._orderedCustomLines[h].prefixSum+=p;if(u.size>0){for(let h of u){let g=this._decorationIDToCustomLine.get(h);if(g){let f=g.reduce((S,y)=>Math.min(S,y.lineNumber),i),v=g.reduce((S,y)=>Math.max(S,y.lineNumber),i),b=g.reduce((S,y)=>Math.max(S,y.specialHeight),0);s.push({decorationId:h,startLineNumber:f,endLineNumber:v,lineHeight:b})}}for(let h of s)this._doInsertOrChangeCustomLineHeight(h.decorationId,h.startLineNumber,h.endLineNumber,h.lineHeight,t)}}_binarySearchOverOrderedCustomLinesArray(i){return bM(this._orderedCustomLines.length,e=>{let t=this._orderedCustomLines[e];return t.lineNumber===i?0:t.lineNumber<i?-1:1})}},qqe=class a{constructor(i,e,t,o){this.decorationId=i;this.startLineNumber=e;this.endLineNumber=t;this.lineHeight=o}static fromDecorations(i,e,t){let o=t.options.get(75);return i.map(n=>{let r=e.convertModelRangeToViewRange(n.range);return new a(n.id,r.startLineNumber,r.endLineNumber,n.options.lineHeight?n.options.lineHeight*o:0)})}},Gqe=class{constructor(){this._map=new Map}add(i,e){let t=this._map.get(i);t?t.push(e):this._map.set(i,[e])}get(i){return this._map.get(i)}delete(i){this._map.delete(i)}};var xei=class{constructor(){this._hasPending=!1,this._inserts=[],this._changes=[],this._removes=[]}insert(i){this._hasPending=!0,this._inserts.push(i)}change(i){this._hasPending=!0,this._changes.push(i)}remove(i){this._hasPending=!0,this._removes.push(i)}commit(i){if(!this._hasPending)return;let e=this._inserts,t=this._changes,o=this._removes;this._hasPending=!1,this._inserts=[],this._changes=[],this._removes=[],i._commitPendingChanges(e,t,o)}},kei=class{constructor(i,e,t,o,n){this.id=i,this.afterLineNumber=e,this.ordinal=t,this.height=o,this.minWidth=n,this.prefixSum=0}},Tbt=class a{static{this.INSTANCE_COUNT=0}constructor(i,e,t,o,n){this._instanceId=_be(++a.INSTANCE_COUNT),this._pendingChanges=new xei,this._lastWhitespaceId=0,this._arr=[],this._prefixSumValidIndex=-1,this._minWidth=-1,this._lineCount=i,this._paddingTop=t,this._paddingBottom=o,this._lineHeightsManager=new $qe(e,n)}static findInsertionIndex(i,e,t){let o=0,n=i.length;for(;o<n;){let r=o+n>>>1;e===i[r].afterLineNumber?t<i[r].ordinal?n=r:o=r+1:e<i[r].afterLineNumber?n=r:o=r+1}return o}setDefaultLineHeight(i){this._lineHeightsManager.defaultLineHeight=i}setPadding(i,e){this._paddingTop=i,this._paddingBottom=e}onFlushed(i,e){this._lineCount=i,this._lineHeightsManager=new $qe(this._lineHeightsManager.defaultLineHeight,e)}changeLineHeights(i){let e=!1;return i({insertOrChangeCustomLineHeight:(o,n,r,s)=>{e=!0,this._lineHeightsManager.insertOrChangeCustomLineHeight(o,n,r,s)},removeCustomLineHeight:o=>{e=!0,this._lineHeightsManager.removeCustomLineHeight(o)}}),e}changeWhitespace(i){let e=!1;try{i({insertWhitespace:(o,n,r,s)=>{e=!0,o=o|0,n=n|0,r=r|0,s=s|0;let l=this._instanceId+ ++this._lastWhitespaceId;return this._pendingChanges.insert(new kei(l,o,n,r,s)),l},changeOneWhitespace:(o,n,r)=>{e=!0,n=n|0,r=r|0,this._pendingChanges.change({id:o,newAfterLineNumber:n,newHeight:r})},removeWhitespace:o=>{e=!0,this._pendingChanges.remove({id:o})}})}finally{this._pendingChanges.commit(this)}return e}_commitPendingChanges(i,e,t){if((i.length>0||t.length>0)&&(this._minWidth=-1),i.length+e.length+t.length<=1){for(let l of i)this._insertWhitespace(l);for(let l of e)this._changeOneWhitespace(l.id,l.newAfterLineNumber,l.newHeight);for(let l of t){let c=this._findWhitespaceIndex(l.id);c!==-1&&this._removeWhitespace(c)}return}let o=new Set;for(let l of t)o.add(l.id);let n=new Map;for(let l of e)n.set(l.id,l);let r=l=>{let c=[];for(let u of l)if(!o.has(u.id)){if(n.has(u.id)){let p=n.get(u.id);u.afterLineNumber=p.newAfterLineNumber,u.height=p.newHeight}c.push(u)}return c},s=r(this._arr).concat(r(i));s.sort((l,c)=>l.afterLineNumber===c.afterLineNumber?l.ordinal-c.ordinal:l.afterLineNumber-c.afterLineNumber),this._arr=s,this._prefixSumValidIndex=-1}_insertWhitespace(i){let e=a.findInsertionIndex(this._arr,i.afterLineNumber,i.ordinal);this._arr.splice(e,0,i),this._prefixSumValidIndex=Math.min(this._prefixSumValidIndex,e-1)}_findWhitespaceIndex(i){let e=this._arr;for(let t=0,o=e.length;t<o;t++)if(e[t].id===i)return t;return-1}_changeOneWhitespace(i,e,t){let o=this._findWhitespaceIndex(i);if(o!==-1&&(this._arr[o].height!==t&&(this._arr[o].height=t,this._prefixSumValidIndex=Math.min(this._prefixSumValidIndex,o-1)),this._arr[o].afterLineNumber!==e)){let n=this._arr[o];this._removeWhitespace(o),n.afterLineNumber=e,this._insertWhitespace(n)}}_removeWhitespace(i){this._arr.splice(i,1),this._prefixSumValidIndex=Math.min(this._prefixSumValidIndex,i-1)}onLinesDeleted(i,e){i=i|0,e=e|0,this._lineCount-=e-i+1;for(let t=0,o=this._arr.length;t<o;t++){let n=this._arr[t].afterLineNumber;i<=n&&n<=e?this._arr[t].afterLineNumber=i-1:n>e&&(this._arr[t].afterLineNumber-=e-i+1)}this._lineHeightsManager.onLinesDeleted(i,e)}onLinesInserted(i,e){i=i|0,e=e|0,this._lineCount+=e-i+1;for(let t=0,o=this._arr.length;t<o;t++){let n=this._arr[t].afterLineNumber;i<=n&&(this._arr[t].afterLineNumber+=e-i+1)}this._lineHeightsManager.onLinesInserted(i,e)}getWhitespacesTotalHeight(){return this._arr.length===0?0:this.getWhitespacesAccumulatedHeight(this._arr.length-1)}getWhitespacesAccumulatedHeight(i){i=i|0;let e=Math.max(0,this._prefixSumValidIndex+1);e===0&&(this._arr[0].prefixSum=this._arr[0].height,e++);for(let t=e;t<=i;t++)this._arr[t].prefixSum=this._arr[t-1].prefixSum+this._arr[t].height;return this._prefixSumValidIndex=Math.max(this._prefixSumValidIndex,i),this._arr[i].prefixSum}getLinesTotalHeight(){let i=this._lineHeightsManager.getAccumulatedLineHeightsIncludingLineNumber(this._lineCount),e=this.getWhitespacesTotalHeight();return i+e+this._paddingTop+this._paddingBottom}getWhitespaceAccumulatedHeightBeforeLineNumber(i){i=i|0;let e=this._findLastWhitespaceBeforeLineNumber(i);return e===-1?0:this.getWhitespacesAccumulatedHeight(e)}_findLastWhitespaceBeforeLineNumber(i){i=i|0;let e=this._arr,t=0,o=e.length-1;for(;t<=o;){let r=(o-t|0)/2|0,s=t+r|0;if(e[s].afterLineNumber<i){if(s+1>=e.length||e[s+1].afterLineNumber>=i)return s;t=s+1|0}else o=s-1|0}return-1}_findFirstWhitespaceAfterLineNumber(i){i=i|0;let t=this._findLastWhitespaceBeforeLineNumber(i)+1;return t<this._arr.length?t:-1}getFirstWhitespaceIndexAfterLineNumber(i){return i=i|0,this._findFirstWhitespaceAfterLineNumber(i)}getVerticalOffsetForLineNumber(i,e=!1){i=i|0;let t;i>1?t=this._lineHeightsManager.getAccumulatedLineHeightsIncludingLineNumber(i-1):t=0;let o=this.getWhitespaceAccumulatedHeightBeforeLineNumber(i-(e?1:0));return t+o+this._paddingTop}getLineHeightForLineNumber(i){return this._lineHeightsManager.heightForLineNumber(i)}getVerticalOffsetAfterLineNumber(i,e=!1){i=i|0;let t=this._lineHeightsManager.getAccumulatedLineHeightsIncludingLineNumber(i),o=this.getWhitespaceAccumulatedHeightBeforeLineNumber(i+(e?1:0));return t+o+this._paddingTop}hasWhitespace(){return this.getWhitespacesCount()>0}getWhitespaceMinWidth(){if(this._minWidth===-1){let i=0;for(let e=0,t=this._arr.length;e<t;e++)i=Math.max(i,this._arr[e].minWidth);this._minWidth=i}return this._minWidth}isAfterLines(i){let e=this.getLinesTotalHeight();return i>e}isInTopPadding(i){return this._paddingTop===0?!1:i<this._paddingTop}isInBottomPadding(i){if(this._paddingBottom===0)return!1;let e=this.getLinesTotalHeight();return i>=e-this._paddingBottom}getLineNumberAtOrAfterVerticalOffset(i){if(i=i|0,i<0)return 1;let e=this._lineCount|0,t=1,o=e;for(;t<o;){let n=(t+o)/2|0,r=this.getLineHeightForLineNumber(n),s=this.getVerticalOffsetForLineNumber(n)|0;if(i>=s+r)t=n+1;else{if(i>=s)return n;o=n}}return t>e?e:t}getLinesViewportData(i,e){i=i|0,e=e|0;let t=this.getLineNumberAtOrAfterVerticalOffset(i)|0,o=this.getVerticalOffsetForLineNumber(t)|0,n=this._lineCount|0,r=this.getFirstWhitespaceIndexAfterLineNumber(t)|0,s=this.getWhitespacesCount()|0,l,c;r===-1?(r=s,c=n+1,l=0):(c=this.getAfterLineNumberForWhitespaceIndex(r)|0,l=this.getHeightForWhitespaceIndex(r)|0);let u=o,p=u,h=5e5,g=0;o>=h&&(g=Math.floor(o/h)*h,g=Math.floor(g/this._lineHeightsManager.defaultLineHeight)*this._lineHeightsManager.defaultLineHeight,p-=g);let f=[],v=i+(e-i)/2,b=-1;for(let k=t;k<=n;k++){let T=this.getLineHeightForLineNumber(k);if(b===-1){let N=u,O=u+T;(N<=v&&v<O||N>v)&&(b=k)}for(u+=T,f[k-t]=p,p+=T;c===k;)p+=l,u+=l,r++,r>=s?c=n+1:(c=this.getAfterLineNumberForWhitespaceIndex(r)|0,l=this.getHeightForWhitespaceIndex(r)|0);if(u>=e){n=k;break}}b===-1&&(b=n);let S=this.getVerticalOffsetForLineNumber(n)|0,y=t,w=n;if(y<w&&o<i&&y++,y<w){let k=this.getLineHeightForLineNumber(n);S+k>e&&w--}return{bigNumbersDelta:g,startLineNumber:t,endLineNumber:n,relativeVerticalOffset:f,centeredLineNumber:b,completelyVisibleStartLineNumber:y,completelyVisibleEndLineNumber:w,lineHeight:this._lineHeightsManager.defaultLineHeight}}getVerticalOffsetForWhitespaceIndex(i){i=i|0;let e=this.getAfterLineNumberForWhitespaceIndex(i),t;e>=1?t=this._lineHeightsManager.getAccumulatedLineHeightsIncludingLineNumber(e):t=0;let o;return i>0?o=this.getWhitespacesAccumulatedHeight(i-1):o=0,t+o+this._paddingTop}getWhitespaceIndexAtOrAfterVerticallOffset(i){i=i|0;let e=0,t=this.getWhitespacesCount()-1;if(t<0)return-1;let o=this.getVerticalOffsetForWhitespaceIndex(t),n=this.getHeightForWhitespaceIndex(t);if(i>=o+n)return-1;for(;e<t;){let r=Math.floor((e+t)/2),s=this.getVerticalOffsetForWhitespaceIndex(r),l=this.getHeightForWhitespaceIndex(r);if(i>=s+l)e=r+1;else{if(i>=s)return r;t=r}}return e}getWhitespaceAtVerticalOffset(i){i=i|0;let e=this.getWhitespaceIndexAtOrAfterVerticallOffset(i);if(e<0||e>=this.getWhitespacesCount())return null;let t=this.getVerticalOffsetForWhitespaceIndex(e);if(t>i)return null;let o=this.getHeightForWhitespaceIndex(e),n=this.getIdForWhitespaceIndex(e),r=this.getAfterLineNumberForWhitespaceIndex(e);return{id:n,afterLineNumber:r,verticalOffset:t,height:o}}getWhitespaceViewportData(i,e){i=i|0,e=e|0;let t=this.getWhitespaceIndexAtOrAfterVerticallOffset(i),o=this.getWhitespacesCount()-1;if(t<0)return[];let n=[];for(let r=t;r<=o;r++){let s=this.getVerticalOffsetForWhitespaceIndex(r),l=this.getHeightForWhitespaceIndex(r);if(s>=e)break;n.push({id:this.getIdForWhitespaceIndex(r),afterLineNumber:this.getAfterLineNumberForWhitespaceIndex(r),verticalOffset:s,height:l})}return n}getWhitespaces(){return this._arr.slice(0)}getWhitespacesCount(){return this._arr.length}getIdForWhitespaceIndex(i){return i=i|0,this._arr[i].id}getAfterLineNumberForWhitespaceIndex(i){return i=i|0,this._arr[i].afterLineNumber}getHeightForWhitespaceIndex(i){return i=i|0,this._arr[i].height}};var cNo=125,cae=class{constructor(i,e,t,o){i=i|0,e=e|0,t=t|0,o=o|0,i<0&&(i=0),e<0&&(e=0),t<0&&(t=0),o<0&&(o=0),this.width=i,this.contentWidth=e,this.scrollWidth=Math.max(i,e),this.height=t,this.contentHeight=o,this.scrollHeight=Math.max(t,o)}equals(i){return this.width===i.width&&this.contentWidth===i.contentWidth&&this.height===i.height&&this.contentHeight===i.contentHeight}},Eei=class extends C{constructor(e,t){super();this._onDidContentSizeChange=this._register(new E);this.onDidContentSizeChange=this._onDidContentSizeChange.event;this._dimensions=new cae(0,0,0,0),this._scrollable=this._register(new UT({forceIntegerValues:!0,smoothScrollDuration:e,scheduleAtNextAnimationFrame:t})),this.onDidScroll=this._scrollable.onScroll}getScrollable(){return this._scrollable}setSmoothScrollDuration(e){this._scrollable.setSmoothScrollDuration(e)}validateScrollPosition(e){return this._scrollable.validateScrollPosition(e)}getScrollDimensions(){return this._dimensions}setScrollDimensions(e){if(this._dimensions.equals(e))return;let t=this._dimensions;this._dimensions=e,this._scrollable.setScrollDimensions({width:e.width,scrollWidth:e.scrollWidth,height:e.height,scrollHeight:e.scrollHeight},!0);let o=t.contentWidth!==e.contentWidth,n=t.contentHeight!==e.contentHeight;(o||n)&&this._onDidContentSizeChange.fire(new cbt(t.contentWidth,t.contentHeight,e.contentWidth,e.contentHeight))}getFutureScrollPosition(){return this._scrollable.getFutureScrollPosition()}getCurrentScrollPosition(){return this._scrollable.getCurrentScrollPosition()}setScrollPositionNow(e){this._scrollable.setScrollPositionNow(e)}setScrollPositionSmooth(e){this._scrollable.setScrollPositionSmooth(e)}hasPendingScrollAnimation(){return this._scrollable.hasPendingScrollAnimation()}},_bt=class extends C{constructor(i,e,t,o){super(),this._configuration=i;let n=this._configuration.options,r=n.get(165),s=n.get(96);this._linesLayout=new Tbt(e,n.get(75),s.top,s.bottom,t),this._maxLineWidth=0,this._overlayWidgetsMinWidth=0,this._scrollable=this._register(new Eei(0,o)),this._configureSmoothScrollDuration(),this._scrollable.setScrollDimensions(new cae(r.contentWidth,0,r.height,0)),this.onDidScroll=this._scrollable.onDidScroll,this.onDidContentSizeChange=this._scrollable.onDidContentSizeChange,this._updateHeight()}dispose(){super.dispose()}getScrollable(){return this._scrollable.getScrollable()}onHeightMaybeChanged(){this._updateHeight()}_configureSmoothScrollDuration(){this._scrollable.setSmoothScrollDuration(this._configuration.options.get(130)?cNo:0)}onConfigurationChanged(i){let e=this._configuration.options;if(i.hasChanged(75)&&this._linesLayout.setDefaultLineHeight(e.get(75)),i.hasChanged(96)){let t=e.get(96);this._linesLayout.setPadding(t.top,t.bottom)}if(i.hasChanged(165)){let t=e.get(165),o=t.contentWidth,n=t.height,r=this._scrollable.getScrollDimensions(),s=r.contentWidth;this._scrollable.setScrollDimensions(new cae(o,r.contentWidth,n,this._getContentHeight(o,n,s)))}else this._updateHeight();i.hasChanged(130)&&this._configureSmoothScrollDuration()}onFlushed(i,e){this._linesLayout.onFlushed(i,e)}onLinesDeleted(i,e){this._linesLayout.onLinesDeleted(i,e)}onLinesInserted(i,e){this._linesLayout.onLinesInserted(i,e)}_getHorizontalScrollbarHeight(i,e){let o=this._configuration.options.get(117);return o.horizontal===2||i>=e?0:o.horizontalScrollbarSize}_getContentHeight(i,e,t){let o=this._configuration.options,n=this._linesLayout.getLinesTotalHeight();return o.get(119)?n+=Math.max(0,e-o.get(75)-o.get(96).bottom):o.get(117).ignoreHorizontalScrollbarInContentHeight||(n+=this._getHorizontalScrollbarHeight(i,t)),n}_updateHeight(){let i=this._scrollable.getScrollDimensions(),e=i.width,t=i.height,o=i.contentWidth;this._scrollable.setScrollDimensions(new cae(e,i.contentWidth,t,this._getContentHeight(e,t,o)))}getCurrentViewport(){let i=this._scrollable.getScrollDimensions(),e=this._scrollable.getCurrentScrollPosition();return new sqe(e.scrollTop,e.scrollLeft,i.width,i.height)}getFutureViewport(){let i=this._scrollable.getScrollDimensions(),e=this._scrollable.getFutureScrollPosition();return new sqe(e.scrollTop,e.scrollLeft,i.width,i.height)}_computeContentWidth(){let i=this._configuration.options,e=this._maxLineWidth,t=i.get(166),o=i.get(59),n=i.get(165);if(t.isViewportWrapping){let r=i.get(81);return e>n.contentWidth+o.typicalHalfwidthCharacterWidth&&r.enabled&&r.side==="right"?e+n.verticalScrollbarWidth:e}else{let r=i.get(118)*o.typicalHalfwidthCharacterWidth,s=this._linesLayout.getWhitespaceMinWidth();return Math.max(e+r+n.verticalScrollbarWidth,s,this._overlayWidgetsMinWidth)}}setMaxLineWidth(i){this._maxLineWidth=i,this._updateContentWidth()}setOverlayWidgetsMinWidth(i){this._overlayWidgetsMinWidth=i,this._updateContentWidth()}_updateContentWidth(){let i=this._scrollable.getScrollDimensions();this._scrollable.setScrollDimensions(new cae(i.width,this._computeContentWidth(),i.height,i.contentHeight)),this._updateHeight()}saveState(){let i=this._scrollable.getFutureScrollPosition(),e=i.scrollTop,t=this._linesLayout.getLineNumberAtOrAfterVerticalOffset(e),o=this._linesLayout.getWhitespaceAccumulatedHeightBeforeLineNumber(t);return{scrollTop:e,scrollTopWithoutViewZones:e-o,scrollLeft:i.scrollLeft}}changeWhitespace(i){let e=this._linesLayout.changeWhitespace(i);return e&&this.onHeightMaybeChanged(),e}changeSpecialLineHeights(i){let e=this._linesLayout.changeLineHeights(i);return e&&this.onHeightMaybeChanged(),e}getVerticalOffsetForLineNumber(i,e=!1){return this._linesLayout.getVerticalOffsetForLineNumber(i,e)}getVerticalOffsetAfterLineNumber(i,e=!1){return this._linesLayout.getVerticalOffsetAfterLineNumber(i,e)}getLineHeightForLineNumber(i){return this._linesLayout.getLineHeightForLineNumber(i)}isAfterLines(i){return this._linesLayout.isAfterLines(i)}isInTopPadding(i){return this._linesLayout.isInTopPadding(i)}isInBottomPadding(i){return this._linesLayout.isInBottomPadding(i)}getLineNumberAtVerticalOffset(i){return this._linesLayout.getLineNumberAtOrAfterVerticalOffset(i)}getWhitespaceAtVerticalOffset(i){return this._linesLayout.getWhitespaceAtVerticalOffset(i)}getLinesViewportData(){let i=this.getCurrentViewport();return this._linesLayout.getLinesViewportData(i.top,i.top+i.height)}getLinesViewportDataAtScrollTop(i){let e=this._scrollable.getScrollDimensions();return i+e.height>e.scrollHeight&&(i=e.scrollHeight-e.height),i<0&&(i=0),this._linesLayout.getLinesViewportData(i,i+e.height)}getWhitespaceViewportData(){let i=this.getCurrentViewport();return this._linesLayout.getWhitespaceViewportData(i.top,i.top+i.height)}getWhitespaces(){return this._linesLayout.getWhitespaces()}getContentWidth(){return this._scrollable.getScrollDimensions().contentWidth}getScrollWidth(){return this._scrollable.getScrollDimensions().scrollWidth}getContentHeight(){return this._scrollable.getScrollDimensions().contentHeight}getScrollHeight(){return this._scrollable.getScrollDimensions().scrollHeight}getCurrentScrollLeft(){return this._scrollable.getCurrentScrollPosition().scrollLeft}getCurrentScrollTop(){return this._scrollable.getCurrentScrollPosition().scrollTop}validateScrollPosition(i){return this._scrollable.validateScrollPosition(i)}setScrollPosition(i,e){e===1?this._scrollable.setScrollPositionNow(i):this._scrollable.setScrollPositionSmooth(i)}hasPendingScrollAnimation(){return this._scrollable.hasPendingScrollAnimation()}deltaScrollNow(i,e){let t=this._scrollable.getCurrentScrollPosition();this._scrollable.setScrollPositionNow({scrollLeft:t.scrollLeft+i,scrollTop:t.scrollTop+e})}};var Dbt=class{constructor(i,e,t,o,n){this.editorId=i,this.configuration=t,this._linesCollection=o;let r={getModelDecorations:(s,l,c)=>this._linesCollection.getDecorationsInRange(s,this.editorId,Qre(this.configuration.options),Yre(this.configuration.options),l,c)};this._inlineDecorationsComputer=new Tgt(r,e,n),this._cachedModelDecorationsResolver=null,this._cachedModelDecorationsResolverViewRange=null}_clearCachedModelDecorationsResolver(){this._cachedModelDecorationsResolver=null,this._cachedModelDecorationsResolverViewRange=null}dispose(){this._inlineDecorationsComputer.reset(),this._clearCachedModelDecorationsResolver()}reset(){this._inlineDecorationsComputer.reset(),this._clearCachedModelDecorationsResolver()}onModelDecorationsChanged(){this._inlineDecorationsComputer.onModelDecorationsChanged(),this._clearCachedModelDecorationsResolver()}onLineMappingChanged(){this._inlineDecorationsComputer.onLineMappingChanged(),this._clearCachedModelDecorationsResolver()}getMinimapDecorationsInRange(i){return this._inlineDecorationsComputer.getDecorations(i,!0,!1).decorations}getDecorationsViewportData(i){let e=this._cachedModelDecorationsResolver!==null;return e=e&&i.equalsRange(this._cachedModelDecorationsResolverViewRange),e||(this._cachedModelDecorationsResolver=this._inlineDecorationsComputer.getDecorations(i,!1,!1),this._cachedModelDecorationsResolverViewRange=i),this._cachedModelDecorationsResolver}getDecorationsOnLine(i,e=!1,t=!1){let o=new z(i,this._linesCollection.getViewLineMinColumn(i),i,this._linesCollection.getViewLineMaxColumn(i));return this._inlineDecorationsComputer.getDecorations(o,e,t)}};function Mbt(a,i){return a===null?i?Lbt.INSTANCE:Rbt.INSTANCE:new _ei(a,i)}var _ei=class{constructor(i,e){this._projectionData=i,this._isVisible=e}isVisible(){return this._isVisible}setVisible(i){return this._isVisible=i,this}getProjectionData(){return this._projectionData}getViewLineCount(){return this._isVisible?this._projectionData.getOutputLineCount():0}getViewLineContent(i,e,t){this._assertVisible();let o=t>0?this._projectionData.breakOffsets[t-1]:0,n=this._projectionData.breakOffsets[t],r;if(this._projectionData.injectionOffsets!==null){let s=this._projectionData.injectionOffsets.map((c,u)=>new e_(0,0,c+1,this._projectionData.injectionOptions[u],0));r=e_.applyInjectedText(i.getLineContent(e),s).substring(o,n)}else r=i.getValueInRange({startLineNumber:e,startColumn:o+1,endLineNumber:e,endColumn:n+1});return t>0&&(r=_ji(this._projectionData.wrappedTextIndentLength)+r),r}getViewLineLength(i,e,t){return this._assertVisible(),this._projectionData.getLineLength(t)}getViewLineMinColumn(i,e,t){return this._assertVisible(),this._projectionData.getMinOutputOffset(t)+1}getViewLineMaxColumn(i,e,t){return this._assertVisible(),this._projectionData.getMaxOutputOffset(t)+1}getViewLineData(i,e,t,o){let n=new Array;return this.getViewLinesData(i,e,t,1,o,0,[!0],n),n[0]}getViewLinesData(i,e,t,o,n,r,s,l){this._assertVisible();let c=this._projectionData,u=c.injectionOffsets,p=c.injectionOptions,h={getInjectionOptions:()=>p,getInjectionOffsets:()=>u,getBreakOffsets:()=>c.breakOffsets,getWrappedTextIndentLength:()=>c.wrappedTextIndentLength,getBaseViewLineNumber:()=>n},f=new _gt(h).getInlineDecorations(e),v=i.tokenization.getLineTokens(e),b=kji(v,p,u);for(let S=t;S<t+o;S++){let y=r+S-t;if(!s[y]){l[y]=null;continue}l[y]=this._getViewLineData(b,f?f[S]:null,S)}}_getViewLineData(i,e,t){this._assertVisible();let o=this._projectionData,n=t>0?o.wrappedTextIndentLength:0,r=t>0?o.breakOffsets[t-1]:0,s=o.breakOffsets[t],l=i.sliceAndInflate(r,s,n),c=l.getLineContent();t>0&&(c=_ji(o.wrappedTextIndentLength)+c);let u=this._projectionData.getMinOutputOffset(t)+1,p=c.length+1,h=t+1<this.getViewLineCount(),g=t===0?0:o.breakOffsetsVisibleColumn[t-1];return new Zse(c,h,u,p,g,l,e)}getModelColumnOfViewPosition(i,e){return this._assertVisible(),this._projectionData.translateToInputOffset(i,e-1)+1}getViewPositionOfModelPosition(i,e,t=2){return this._assertVisible(),this._projectionData.translateToOutputPosition(e-1,t).toPosition(i)}getViewLineNumberOfModelPosition(i,e){this._assertVisible();let t=this._projectionData.translateToOutputPosition(e-1);return i+t.outputLineIndex}normalizePosition(i,e,t){let o=e.lineNumber-i;return this._projectionData.normalizeOutputPosition(i,e.column-1,t).toPosition(o)}getInjectedTextAt(i,e){return this._projectionData.getInjectedText(i,e-1)}_assertVisible(){if(!this._isVisible)throw new Error("Not supported")}},Lbt=class a{static{this.INSTANCE=new a}constructor(){}isVisible(){return!0}setVisible(i){return i?this:Rbt.INSTANCE}getProjectionData(){return null}getViewLineCount(){return 1}getViewLineContent(i,e,t){return i.getLineContent(e)}getViewLineLength(i,e,t){return i.getLineLength(e)}getViewLineMinColumn(i,e,t){return i.getLineMinColumn(e)}getViewLineMaxColumn(i,e,t){return i.getLineMaxColumn(e)}getViewLineData(i,e,t,o){let n=i.tokenization.getLineTokens(e),r=n.getLineContent();return new Zse(r,!1,1,r.length+1,0,n.inflate(),null)}getViewLinesData(i,e,t,o,n,r,s,l){if(!s[r]){l[r]=null;return}l[r]=this.getViewLineData(i,e,0,n)}getModelColumnOfViewPosition(i,e){return e}getViewPositionOfModelPosition(i,e){return new Ie(i,e)}getViewLineNumberOfModelPosition(i,e){return i}normalizePosition(i,e,t){return e}getInjectedTextAt(i,e){return null}},Rbt=class a{static{this.INSTANCE=new a}constructor(){}isVisible(){return!1}setVisible(i){return i?Lbt.INSTANCE:this}getProjectionData(){return null}getViewLineCount(){return 0}getViewLineContent(i,e,t){throw new Error("Not supported")}getViewLineLength(i,e,t){throw new Error("Not supported")}getViewLineMinColumn(i,e,t){throw new Error("Not supported")}getViewLineMaxColumn(i,e,t){throw new Error("Not supported")}getViewLineData(i,e,t,o){throw new Error("Not supported")}getViewLinesData(i,e,t,o,n,r,s,l){throw new Error("Not supported")}getModelColumnOfViewPosition(i,e){throw new Error("Not supported")}getViewPositionOfModelPosition(i,e){throw new Error("Not supported")}getViewLineNumberOfModelPosition(i,e){throw new Error("Not supported")}normalizePosition(i,e,t){throw new Error("Not supported")}getInjectedTextAt(i,e){throw new Error("Not supported")}},Tei=[""];function _ji(a){if(a>=Tei.length)for(let i=1;i<=a;i++)Tei[i]=dNo(i);return Tei[a]}function dNo(a){return new Array(a+1).join(" ")}var Pbt=class{constructor(i){this._model=i}_validPosition(i){return this._model.validatePosition(i)}_validRange(i){return this._model.validateRange(i)}convertViewPositionToModelPosition(i){return this._validPosition(i)}convertViewRangeToModelRange(i){return this._validRange(i)}validateViewPosition(i,e){return this._validPosition(e)}validateViewRange(i,e){return this._validRange(e)}convertModelPositionToViewPosition(i){return this._validPosition(i)}convertModelRangeToViewRange(i){return this._validRange(i)}modelPositionIsVisible(i){let e=this._model.getLineCount();return!(i.lineNumber<1||i.lineNumber>e)}modelRangeIsVisible(i){let e=this._model.getLineCount();return!(i.startLineNumber<1||i.startLineNumber>e||i.endLineNumber<1||i.endLineNumber>e)}getModelLineViewLineCount(i){return 1}getViewLineNumberOfModelPosition(i,e){return i}};var Abt=class{constructor(i,e,t,o,n,r,s,l,c,u,p){this._editorId=i,this.model=e,this._validModelVersionId=-1,this._domLineBreaksComputerFactory=t,this._monospaceLineBreaksComputerFactory=o,this.fontInfo=n,this.tabSize=r,this.wrappingStrategy=s,this.wrappingColumn=l,this.wrappingIndent=c,this.wordBreak=u,this.wrapOnEscapedLineFeeds=p,this._constructLines(!0,null)}dispose(){this.hiddenAreasDecorationIds=this.model.deltaDecorations(this.hiddenAreasDecorationIds,[])}createCoordinatesConverter(){return new Dei(this)}_constructLines(i,e){this.modelLineProjections=[],i&&(this.hiddenAreasDecorationIds=this.model.deltaDecorations(this.hiddenAreasDecorationIds,[]));let t=this.model.getLinesContent(),o=this.model.getInjectedTextDecorations(this._editorId),n=t.length,r=this.createLineBreaksComputer(),s=new bS(e_.fromDecorations(o));for(let v=0;v<n;v++){let b=s.takeWhile(S=>S.lineNumber===v+1);r.addRequest(t[v],b,e?e[v]:null)}let l=r.finalize(),c=[],u=this.hiddenAreasDecorationIds.map(v=>this.model.getDecorationRange(v)).sort(z.compareRangesUsingStarts),p=1,h=0,g=-1,f=g+1<u.length?h+1:n+2;for(let v=0;v<n;v++){let b=v+1;b===f&&(g++,p=u[g].startLineNumber,h=u[g].endLineNumber,f=g+1<u.length?h+1:n+2);let S=b>=p&&b<=h,y=Mbt(l[v],!S);c[v]=y.getViewLineCount(),this.modelLineProjections[v]=y}this._validModelVersionId=this.model.getVersionId(),this.projectedModelLineLineCounts=new VSe(c),this._ensureAtLeastOneVisibleLine()}getHiddenAreas(){return this.hiddenAreasDecorationIds.map(i=>this.model.getDecorationRange(i))}setHiddenAreas(i){let e=i.map(h=>this.model.validateRange(h)),t=uNo(e),o=this.hiddenAreasDecorationIds.map(h=>this.model.getDecorationRange(h)).sort(z.compareRangesUsingStarts);if(t.length===o.length){let h=!1;for(let g=0;g<t.length;g++)if(!t[g].equalsRange(o[g])){h=!0;break}if(!h)return!1}let n=t.map(h=>({range:h,options:po.EMPTY}));this.hiddenAreasDecorationIds=this.model.deltaDecorations(this.hiddenAreasDecorationIds,n);let r=t,s=1,l=0,c=-1,u=c+1<r.length?l+1:this.modelLineProjections.length+2,p=!1;for(let h=0;h<this.modelLineProjections.length;h++){let g=h+1;g===u&&(c++,s=r[c].startLineNumber,l=r[c].endLineNumber,u=c+1<r.length?l+1:this.modelLineProjections.length+2);let f=!1;if(g>=s&&g<=l?this.modelLineProjections[h].isVisible()&&(this.modelLineProjections[h]=this.modelLineProjections[h].setVisible(!1),f=!0):(p=!0,this.modelLineProjections[h].isVisible()||(this.modelLineProjections[h]=this.modelLineProjections[h].setVisible(!0),f=!0)),f){let v=this.modelLineProjections[h].getViewLineCount();this.projectedModelLineLineCounts.setValue(h,v)}}return p||this.setHiddenAreas([]),!0}modelPositionIsVisible(i,e){return i<1||i>this.modelLineProjections.length?!1:this.modelLineProjections[i-1].isVisible()}getModelLineViewLineCount(i){return i<1||i>this.modelLineProjections.length?1:this.modelLineProjections[i-1].getViewLineCount()}setTabSize(i){return this.tabSize===i?!1:(this.tabSize=i,this._constructLines(!1,null),!0)}setWrappingSettings(i,e,t,o,n){let r=this.fontInfo.equals(i),s=this.wrappingStrategy===e,l=this.wrappingColumn===t,c=this.wrappingIndent===o,u=this.wordBreak===n;if(r&&s&&l&&c&&u)return!1;let p=r&&s&&!l&&c&&u;this.fontInfo=i,this.wrappingStrategy=e,this.wrappingColumn=t,this.wrappingIndent=o,this.wordBreak=n;let h=null;if(p){h=[];for(let g=0,f=this.modelLineProjections.length;g<f;g++)h[g]=this.modelLineProjections[g].getProjectionData()}return this._constructLines(!1,h),!0}createLineBreaksComputer(){return(this.wrappingStrategy==="advanced"?this._domLineBreaksComputerFactory:this._monospaceLineBreaksComputerFactory).createLineBreaksComputer(this.fontInfo,this.tabSize,this.wrappingColumn,this.wrappingIndent,this.wordBreak,this.wrapOnEscapedLineFeeds)}onModelFlushed(){this._constructLines(!0,null)}onModelLinesDeleted(i,e,t){if(!i||i<=this._validModelVersionId)return null;let o=e===1?1:this.projectedModelLineLineCounts.getPrefixSum(e-1)+1,n=this.projectedModelLineLineCounts.getPrefixSum(t);return this.modelLineProjections.splice(e-1,t-e+1),this.projectedModelLineLineCounts.removeValues(e-1,t-e+1),new kSe(o,n)}onModelLinesInserted(i,e,t,o){if(!i||i<=this._validModelVersionId)return null;let n=e>2&&!this.modelLineProjections[e-2].isVisible(),r=e===1?1:this.projectedModelLineLineCounts.getPrefixSum(e-1)+1,s=0,l=[],c=[];for(let u=0,p=o.length;u<p;u++){let h=Mbt(o[u],!n);l.push(h);let g=h.getViewLineCount();s+=g,c[u]=g}return this.modelLineProjections=this.modelLineProjections.slice(0,e-1).concat(l).concat(this.modelLineProjections.slice(e-1)),this.projectedModelLineLineCounts.insertValues(e-1,c),new ESe(r,r+s-1)}onModelLineChanged(i,e,t){if(i!==null&&i<=this._validModelVersionId)return[!1,null,null,null];let o=e-1,n=this.modelLineProjections[o].getViewLineCount(),r=this.modelLineProjections[o].isVisible(),s=Mbt(t,r);this.modelLineProjections[o]=s;let l=this.modelLineProjections[o].getViewLineCount(),c=!1,u=0,p=-1,h=0,g=-1,f=0,v=-1;n>l?(u=this.projectedModelLineLineCounts.getPrefixSum(e-1)+1,p=u+l-1,f=p+1,v=f+(n-l)-1,c=!0):n<l?(u=this.projectedModelLineLineCounts.getPrefixSum(e-1)+1,p=u+n-1,h=p+1,g=h+(l-n)-1,c=!0):(u=this.projectedModelLineLineCounts.getPrefixSum(e-1)+1,p=u+l-1),this.projectedModelLineLineCounts.setValue(o,l);let b=u<=p?new m$e(u,p-u+1):null,S=h<=g?new ESe(h,g):null,y=f<=v?new kSe(f,v):null;return[c,b,S,y]}acceptVersionId(i){this._validModelVersionId=i,this._ensureAtLeastOneVisibleLine()}_ensureAtLeastOneVisibleLine(){this.getViewLineCount()===0&&this.modelLineProjections.length>0&&(this.modelLineProjections[0]=this.modelLineProjections[0].setVisible(!0),this.projectedModelLineLineCounts.setValue(0,this.modelLineProjections[0].getViewLineCount()))}getViewLineCount(){return this.projectedModelLineLineCounts.getTotalSum()}_toValidViewLineNumber(i){if(i<1)return 1;let e=this.getViewLineCount();return i>e?e:i|0}getActiveIndentGuide(i,e,t){i=this._toValidViewLineNumber(i),e=this._toValidViewLineNumber(e),t=this._toValidViewLineNumber(t);let o=this.convertViewPositionToModelPosition(i,this.getViewLineMinColumn(i)),n=this.convertViewPositionToModelPosition(e,this.getViewLineMinColumn(e)),r=this.convertViewPositionToModelPosition(t,this.getViewLineMinColumn(t)),s=this.model.guides.getActiveIndentGuide(o.lineNumber,n.lineNumber,r.lineNumber),l=this.convertModelPositionToViewPosition(s.startLineNumber,1),c=this.convertModelPositionToViewPosition(s.endLineNumber,this.model.getLineMaxColumn(s.endLineNumber));return{startLineNumber:l.lineNumber,endLineNumber:c.lineNumber,indent:s.indent}}getViewLineInfo(i){i=this._toValidViewLineNumber(i);let e=this.projectedModelLineLineCounts.getIndexOf(i-1),t=e.index,o=e.remainder;return new Nbt(t+1,o)}getMinColumnOfViewLine(i){return this.modelLineProjections[i.modelLineNumber-1].getViewLineMinColumn(this.model,i.modelLineNumber,i.modelLineWrappedLineIdx)}getMaxColumnOfViewLine(i){return this.modelLineProjections[i.modelLineNumber-1].getViewLineMaxColumn(this.model,i.modelLineNumber,i.modelLineWrappedLineIdx)}getModelStartPositionOfViewLine(i){let e=this.modelLineProjections[i.modelLineNumber-1],t=e.getViewLineMinColumn(this.model,i.modelLineNumber,i.modelLineWrappedLineIdx),o=e.getModelColumnOfViewPosition(i.modelLineWrappedLineIdx,t);return new Ie(i.modelLineNumber,o)}getModelEndPositionOfViewLine(i){let e=this.modelLineProjections[i.modelLineNumber-1],t=e.getViewLineMaxColumn(this.model,i.modelLineNumber,i.modelLineWrappedLineIdx),o=e.getModelColumnOfViewPosition(i.modelLineWrappedLineIdx,t);return new Ie(i.modelLineNumber,o)}getViewLineInfosGroupedByModelRanges(i,e){let t=this.getViewLineInfo(i),o=this.getViewLineInfo(e),n=new Array,r=this.getModelStartPositionOfViewLine(t),s=new Array;for(let l=t.modelLineNumber;l<=o.modelLineNumber;l++){let c=this.modelLineProjections[l-1];if(c.isVisible()){let u=l===t.modelLineNumber?t.modelLineWrappedLineIdx:0,p=l===o.modelLineNumber?o.modelLineWrappedLineIdx+1:c.getViewLineCount();for(let h=u;h<p;h++)s.push(new Nbt(l,h))}if(!c.isVisible()&&r){let u=new Ie(l-1,this.model.getLineMaxColumn(l-1)+1),p=z.fromPositions(r,u);n.push(new Obt(p,s)),s=[],r=null}else c.isVisible()&&!r&&(r=new Ie(l,1))}if(r){let l=z.fromPositions(r,this.getModelEndPositionOfViewLine(o));n.push(new Obt(l,s))}return n}getViewLinesBracketGuides(i,e,t,o){let n=t?this.convertViewPositionToModelPosition(t.lineNumber,t.column):null,r=[];for(let s of this.getViewLineInfosGroupedByModelRanges(i,e)){let l=s.modelRange.startLineNumber,c=this.model.guides.getLinesBracketGuides(l,s.modelRange.endLineNumber,n,o);for(let u of s.viewLines){let h=c[u.modelLineNumber-l].map(g=>{if(g.forWrappedLinesAfterColumn!==-1&&this.modelLineProjections[u.modelLineNumber-1].getViewPositionOfModelPosition(0,g.forWrappedLinesAfterColumn).lineNumber>=u.modelLineWrappedLineIdx||g.forWrappedLinesBeforeOrAtColumn!==-1&&this.modelLineProjections[u.modelLineNumber-1].getViewPositionOfModelPosition(0,g.forWrappedLinesBeforeOrAtColumn).lineNumber<u.modelLineWrappedLineIdx)return;if(!g.horizontalLine)return g;let f=-1;if(g.column!==-1){let S=this.modelLineProjections[u.modelLineNumber-1].getViewPositionOfModelPosition(0,g.column);if(S.lineNumber===u.modelLineWrappedLineIdx)f=S.column;else if(S.lineNumber<u.modelLineWrappedLineIdx)f=this.getMinColumnOfViewLine(u);else if(S.lineNumber>u.modelLineWrappedLineIdx)return}let v=this.convertModelPositionToViewPosition(u.modelLineNumber,g.horizontalLine.endColumn),b=this.modelLineProjections[u.modelLineNumber-1].getViewPositionOfModelPosition(0,g.horizontalLine.endColumn);return b.lineNumber===u.modelLineWrappedLineIdx?new VN(g.visibleColumn,f,g.className,new tq(g.horizontalLine.top,v.column),-1,-1):b.lineNumber<u.modelLineWrappedLineIdx||g.visibleColumn!==-1?void 0:new VN(g.visibleColumn,f,g.className,new tq(g.horizontalLine.top,this.getMaxColumnOfViewLine(u)),-1,-1)});r.push(h.filter(g=>!!g))}}return r}getViewLinesIndentGuides(i,e){i=this._toValidViewLineNumber(i),e=this._toValidViewLineNumber(e);let t=this.convertViewPositionToModelPosition(i,this.getViewLineMinColumn(i)),o=this.convertViewPositionToModelPosition(e,this.getViewLineMaxColumn(e)),n=[],r=[],s=[],l=t.lineNumber-1,c=o.lineNumber-1,u=null;for(let f=l;f<=c;f++){let v=this.modelLineProjections[f];if(v.isVisible()){let b=v.getViewLineNumberOfModelPosition(0,f===l?t.column:1),S=v.getViewLineNumberOfModelPosition(0,this.model.getLineMaxColumn(f+1)),y=S-b+1,w=0;y>1&&v.getViewLineMinColumn(this.model,f+1,S)===1&&(w=b===0?1:2),r.push(y),s.push(w),u===null&&(u=new Ie(f+1,0))}else u!==null&&(n=n.concat(this.model.guides.getLinesIndentGuides(u.lineNumber,f)),u=null)}u!==null&&(n=n.concat(this.model.guides.getLinesIndentGuides(u.lineNumber,o.lineNumber)),u=null);let p=e-i+1,h=new Array(p),g=0;for(let f=0,v=n.length;f<v;f++){let b=n[f],S=Math.min(p-g,r[f]),y=s[f],w;y===2?w=0:y===1?w=1:w=S;for(let k=0;k<S;k++)k===w&&(b=0),h[g++]=b}return h}getViewLineContent(i){let e=this.getViewLineInfo(i);return this.modelLineProjections[e.modelLineNumber-1].getViewLineContent(this.model,e.modelLineNumber,e.modelLineWrappedLineIdx)}getViewLineLength(i){let e=this.getViewLineInfo(i);return this.modelLineProjections[e.modelLineNumber-1].getViewLineLength(this.model,e.modelLineNumber,e.modelLineWrappedLineIdx)}getViewLineMinColumn(i){let e=this.getViewLineInfo(i);return this.modelLineProjections[e.modelLineNumber-1].getViewLineMinColumn(this.model,e.modelLineNumber,e.modelLineWrappedLineIdx)}getViewLineMaxColumn(i){let e=this.getViewLineInfo(i);return this.modelLineProjections[e.modelLineNumber-1].getViewLineMaxColumn(this.model,e.modelLineNumber,e.modelLineWrappedLineIdx)}getViewLineData(i){let e=this.getViewLineInfo(i),t=this.projectedModelLineLineCounts.getPrefixSum(e.modelLineNumber-1)+1;return this.modelLineProjections[e.modelLineNumber-1].getViewLineData(this.model,e.modelLineNumber,e.modelLineWrappedLineIdx,t)}getViewLinesData(i,e,t){i=this._toValidViewLineNumber(i),e=this._toValidViewLineNumber(e);let o=this.projectedModelLineLineCounts.getIndexOf(i-1),n=i,r=o.index,s=o.remainder,l=[];for(let c=r,u=this.model.getLineCount();c<u;c++){let p=this.modelLineProjections[c];if(!p.isVisible())continue;let h=c===r?s:0,g=p.getViewLineCount()-h,f=!1;n+g>e&&(f=!0,g=e-n+1);let v=this.projectedModelLineLineCounts.getPrefixSum(c)+1;if(p.getViewLinesData(this.model,c+1,h,g,v,n-i,t,l),n+=g,f)break}return l}validateViewPosition(i,e,t){i=this._toValidViewLineNumber(i);let o=this.projectedModelLineLineCounts.getIndexOf(i-1),n=o.index,r=o.remainder,s=this.modelLineProjections[n],l=s.getViewLineMinColumn(this.model,n+1,r),c=s.getViewLineMaxColumn(this.model,n+1,r);e<l&&(e=l),e>c&&(e=c);let u=s.getModelColumnOfViewPosition(r,e);return this.model.validatePosition(new Ie(n+1,u)).equals(t)?new Ie(i,e):this.convertModelPositionToViewPosition(t.lineNumber,t.column)}validateViewRange(i,e){let t=this.validateViewPosition(i.startLineNumber,i.startColumn,e.getStartPosition()),o=this.validateViewPosition(i.endLineNumber,i.endColumn,e.getEndPosition());return new z(t.lineNumber,t.column,o.lineNumber,o.column)}convertViewPositionToModelPosition(i,e){let t=this.getViewLineInfo(i),o=this.modelLineProjections[t.modelLineNumber-1].getModelColumnOfViewPosition(t.modelLineWrappedLineIdx,e);return this.model.validatePosition(new Ie(t.modelLineNumber,o))}convertViewRangeToModelRange(i){let e=this.convertViewPositionToModelPosition(i.startLineNumber,i.startColumn),t=this.convertViewPositionToModelPosition(i.endLineNumber,i.endColumn);return new z(e.lineNumber,e.column,t.lineNumber,t.column)}convertModelPositionToViewPosition(i,e,t=2,o=!1,n=!1){let r=this.model.validatePosition(new Ie(i,e)),s=r.lineNumber,l=r.column,c=s-1,u=!1;if(n)for(;c<this.modelLineProjections.length&&!this.modelLineProjections[c].isVisible();)c++,u=!0;else for(;c>0&&!this.modelLineProjections[c].isVisible();)c--,u=!0;if(c===0&&!this.modelLineProjections[c].isVisible())return new Ie(o?0:1,1);let p=1+this.projectedModelLineLineCounts.getPrefixSum(c),h;return u?n?h=this.modelLineProjections[c].getViewPositionOfModelPosition(p,1,t):h=this.modelLineProjections[c].getViewPositionOfModelPosition(p,this.model.getLineMaxColumn(c+1),t):h=this.modelLineProjections[s-1].getViewPositionOfModelPosition(p,l,t),h}convertModelRangeToViewRange(i,e=0){if(i.isEmpty()){let t=this.convertModelPositionToViewPosition(i.startLineNumber,i.startColumn,e);return z.fromPositions(t)}else{let t=this.convertModelPositionToViewPosition(i.startLineNumber,i.startColumn,1),o=this.convertModelPositionToViewPosition(i.endLineNumber,i.endColumn,0);return new z(t.lineNumber,t.column,o.lineNumber,o.column)}}getViewLineNumberOfModelPosition(i,e){let t=i-1;if(this.modelLineProjections[t].isVisible()){let n=1+this.projectedModelLineLineCounts.getPrefixSum(t);return this.modelLineProjections[t].getViewLineNumberOfModelPosition(n,e)}for(;t>0&&!this.modelLineProjections[t].isVisible();)t--;if(t===0&&!this.modelLineProjections[t].isVisible())return 1;let o=1+this.projectedModelLineLineCounts.getPrefixSum(t);return this.modelLineProjections[t].getViewLineNumberOfModelPosition(o,this.model.getLineMaxColumn(t+1))}getDecorationsInRange(i,e,t,o,n,r){let s=this.convertViewPositionToModelPosition(i.startLineNumber,i.startColumn),l=this.convertViewPositionToModelPosition(i.endLineNumber,i.endColumn);if(l.lineNumber-s.lineNumber<=i.endLineNumber-i.startLineNumber)return this.model.getDecorationsInRange(new z(s.lineNumber,1,l.lineNumber,l.column),e,t,o,n,r);let c=[],u=s.lineNumber-1,p=l.lineNumber-1,h=null;for(let b=u;b<=p;b++)if(this.modelLineProjections[b].isVisible())h===null&&(h=new Ie(b+1,b===u?s.column:1));else if(h!==null){let y=this.model.getLineMaxColumn(b);c=c.concat(this.model.getDecorationsInRange(new z(h.lineNumber,h.column,b,y),e,t,o,n)),h=null}h!==null&&(c=c.concat(this.model.getDecorationsInRange(new z(h.lineNumber,h.column,l.lineNumber,l.column),e,t,o,n)),h=null),c.sort((b,S)=>{let y=z.compareRangesUsingStarts(b.range,S.range);return y===0?b.id<S.id?-1:b.id>S.id?1:0:y});let g=[],f=0,v=null;for(let b of c){let S=b.id;v!==S&&(v=S,g[f++]=b)}return g}getInjectedTextAt(i){let e=this.getViewLineInfo(i.lineNumber);return this.modelLineProjections[e.modelLineNumber-1].getInjectedTextAt(e.modelLineWrappedLineIdx,i.column)}normalizePosition(i,e){let t=this.getViewLineInfo(i.lineNumber);return this.modelLineProjections[t.modelLineNumber-1].normalizePosition(t.modelLineWrappedLineIdx,i,e)}getLineIndentColumn(i){let e=this.getViewLineInfo(i);return e.modelLineWrappedLineIdx===0?this.model.getLineIndentColumn(e.modelLineNumber):0}};function uNo(a){if(a.length===0)return[];let i=a.slice();i.sort(z.compareRangesUsingStarts);let e=[],t=i[0].startLineNumber,o=i[0].endLineNumber;for(let n=1,r=i.length;n<r;n++){let s=i[n];s.startLineNumber>o+1?(e.push(new z(t,1,o,1)),t=s.startLineNumber,o=s.endLineNumber):s.endLineNumber>o&&(o=s.endLineNumber)}return e.push(new z(t,1,o,1)),e}var Nbt=class{constructor(i,e){this.modelLineNumber=i;this.modelLineWrappedLineIdx=e}get isWrappedLineContinuation(){return this.modelLineWrappedLineIdx>0}},Obt=class{constructor(i,e){this.modelRange=i;this.viewLines=e}},Dei=class{constructor(i){this._lines=i}convertViewPositionToModelPosition(i){return this._lines.convertViewPositionToModelPosition(i.lineNumber,i.column)}convertViewRangeToModelRange(i){return this._lines.convertViewRangeToModelRange(i)}validateViewPosition(i,e){return this._lines.validateViewPosition(i.lineNumber,i.column,e)}validateViewRange(i,e){return this._lines.validateViewRange(i,e)}convertModelPositionToViewPosition(i,e,t,o){return this._lines.convertModelPositionToViewPosition(i.lineNumber,i.column,e,t,o)}convertModelRangeToViewRange(i,e){return this._lines.convertModelRangeToViewRange(i,e)}modelPositionIsVisible(i){return this._lines.modelPositionIsVisible(i.lineNumber,i.column)}getModelLineViewLineCount(i){return this._lines.getModelLineViewLineCount(i)}getViewLineNumberOfModelPosition(i,e){return this._lines.getViewLineNumberOfModelPosition(i,e)}};var Fbt=class{constructor(i){this.model=i}dispose(){}createCoordinatesConverter(){return new Pbt(this.model)}getHiddenAreas(){return[]}setHiddenAreas(i){return!1}setTabSize(i){return!1}setWrappingSettings(i,e,t,o){return!1}createLineBreaksComputer(){let i=[];return{addRequest:(e,t,o)=>{i.push(null)},finalize:()=>i}}onModelFlushed(){}onModelLinesDeleted(i,e,t){return new kSe(e,t)}onModelLinesInserted(i,e,t,o){return new ESe(e,t)}onModelLineChanged(i,e,t){return[!1,new m$e(e,1),null,null]}acceptVersionId(i){}getViewLineCount(){return this.model.getLineCount()}getActiveIndentGuide(i,e,t){return{startLineNumber:i,endLineNumber:i,indent:0}}getViewLinesBracketGuides(i,e,t){return new Array(e-i+1).fill([])}getViewLinesIndentGuides(i,e){let t=e-i+1,o=new Array(t);for(let n=0;n<t;n++)o[n]=0;return o}getViewLineContent(i){return this.model.getLineContent(i)}getViewLineLength(i){return this.model.getLineLength(i)}getViewLineMinColumn(i){return this.model.getLineMinColumn(i)}getViewLineMaxColumn(i){return this.model.getLineMaxColumn(i)}getViewLineData(i){let e=this.model.tokenization.getLineTokens(i),t=e.getLineContent();return new Zse(t,!1,1,t.length+1,0,e.inflate(),null)}getViewLinesData(i,e,t){let o=this.model.getLineCount();i=Math.min(Math.max(1,i),o),e=Math.min(Math.max(1,e),o);let n=[];for(let r=i;r<=e;r++){let s=r-i;n[s]=t[s]?this.getViewLineData(r):null}return n}getDecorationsInRange(i,e,t,o,n,r){return this.model.getDecorationsInRange(i,e,t,o,n,r)}normalizePosition(i,e){return this.model.normalizePosition(i,e)}getLineIndentColumn(i){return this.model.getLineIndentColumn(i)}getInjectedTextAt(i){return null}};var dae=3,Wbt=class{constructor(i){this.persist=0;this._requiredLanes=1;this.lanes=new Uint8Array(Math.ceil((i+1)*dae/8))}reset(i){let e=Math.ceil((i+1)*dae/8);this.lanes.length<e?this.lanes=new Uint8Array(e):this.lanes.fill(0),this._requiredLanes=1}get requiredLanes(){return this._requiredLanes}push(i,e,t){t&&(this.persist|=1<<i-1);for(let o=e.startLineNumber;o<=e.endLineNumber;o++){let n=dae*o+(i-1);this.lanes[n>>>3]|=1<<n%8,this._requiredLanes=Math.max(this._requiredLanes,this.countAtLine(o))}}getLanesAtLine(i){let e=[],t=dae*i;for(let o=0;o<dae;o++)(this.persist&1<<o||this.lanes[t>>>3]&1<<t%8)&&e.push(o+1),t++;return e.length?e:[2]}countAtLine(i){let e=dae*i,t=0;for(let o=0;o<dae;o++)(this.persist&1<<o||this.lanes[e>>>3]&1<<e%8)&&t++,e++;return t}};var pNo=!0,Vbt=class extends C{constructor(e,t,o,n,r,s,l,c,u,p){super();this.languageConfigurationService=l;this._themeService=c;this._attachedView=u;this._transactionalTarget=p;this.hiddenAreasModel=new Mei;this.previousHiddenAreas=[];if(this._editorId=e,this._configuration=t,this.model=o,this._eventDispatcher=new lbt,this.onEvent=this._eventDispatcher.onEvent,this.cursorConfig=new rW(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._updateConfigurationViewLineCount=this._register(new Dt(()=>this._updateConfigurationViewLineCountNow(),0)),this._hasFocus=!1,this._viewportStart=Lei.create(this.model),this.glyphLanes=new Wbt(0),pNo&&this.model.isTooLargeForTokenization())this._lines=new Fbt(this.model);else{let h=this._configuration.options,g=h.get(59),f=h.get(156),v=h.get(166),b=h.get(155),S=h.get(146),y=h.get(160);this._lines=new Abt(this._editorId,this.model,n,r,g,this.model.getOptions().tabSize,f,v.wrappingColumn,b,S,y)}this.coordinatesConverter=this._lines.createCoordinatesConverter(),this._cursor=this._register(new wye(o,this,this.coordinatesConverter,this.cursorConfig)),this.viewLayout=this._register(new _bt(this._configuration,this.getLineCount(),this._getCustomLineHeights(),s)),this._register(this.viewLayout.onDidScroll(h=>{h.scrollTopChanged&&this._handleVisibleLinesChanged(),h.scrollTopChanged&&this._viewportStart.invalidate(),this._eventDispatcher.emitSingleViewEvent(new Cht(h)),this._eventDispatcher.emitOutgoingEvent(new ubt(h.oldScrollWidth,h.oldScrollLeft,h.oldScrollHeight,h.oldScrollTop,h.scrollWidth,h.scrollLeft,h.scrollHeight,h.scrollTop))})),this._register(this.viewLayout.onDidContentSizeChange(h=>{this._eventDispatcher.emitOutgoingEvent(h)})),this._decorations=new Dbt(this._editorId,this.model,this._configuration,this._lines,this.coordinatesConverter),this._registerModelEvents(),this._register(this._configuration.onDidChangeFast(h=>{try{let g=this._eventDispatcher.beginEmitViewEvents();this._onConfigurationChanged(g,h)}finally{this._eventDispatcher.endEmitViewEvents()}})),this._register(UIe.getInstance().onDidChange(()=>{this._eventDispatcher.emitSingleViewEvent(new Eht)})),this._register(this._themeService.onDidColorThemeChange(h=>{this._invalidateDecorationsColorCache(),this._eventDispatcher.emitSingleViewEvent(new xht(h))})),this._updateConfigurationViewLineCountNow(),this.model.registerViewModel(this)}dispose(){super.dispose(),this._decorations.dispose(),this._lines.dispose(),this._viewportStart.dispose(),this._eventDispatcher.dispose(),this.model.unregisterViewModel(this)}getEditorOption(e){return this._configuration.options.get(e)}createLineBreaksComputer(){return this._lines.createLineBreaksComputer()}addViewEventHandler(e){this._eventDispatcher.addViewEventHandler(e)}removeViewEventHandler(e){this._eventDispatcher.removeViewEventHandler(e)}_getCustomLineHeights(){if(!this._configuration.options.get(5))return[];let t=this.model.getCustomLineHeightsDecorations(this._editorId);return qqe.fromDecorations(t,this.coordinatesConverter,this._configuration)}_getCustomLineHeightsForLines(e,t){if(!this._configuration.options.get(5))return[];let n=new z(e,1,t,this.model.getLineMaxColumn(t)),r=this.model.getCustomLineHeightsDecorationsInRange(n,this._editorId);return qqe.fromDecorations(r,this.coordinatesConverter,this._configuration)}_updateConfigurationViewLineCountNow(){this._configuration.setViewLineCount(this._lines.getViewLineCount())}getModelVisibleRanges(){let e=this.viewLayout.getLinesViewportData(),t=new z(e.startLineNumber,this.getLineMinColumn(e.startLineNumber),e.endLineNumber,this.getLineMaxColumn(e.endLineNumber));return this._toModelVisibleRanges(t)}visibleLinesStabilized(){let e=this.getModelVisibleRanges();this._attachedView.setVisibleLines(e,!0)}_handleVisibleLinesChanged(){let e=this.getModelVisibleRanges();this._attachedView.setVisibleLines(e,!1)}setHasFocus(e){this._hasFocus=e,this._cursor.setHasFocus(e),this._eventDispatcher.emitSingleViewEvent(new yht(e)),this._eventDispatcher.emitOutgoingEvent(new zqe(!e,e))}setHasWidgetFocus(e){this._eventDispatcher.emitOutgoingEvent(new dbt(!e,e))}onCompositionStart(){this._eventDispatcher.emitSingleViewEvent(new vht)}onCompositionEnd(){this._eventDispatcher.emitSingleViewEvent(new bht)}_captureStableViewport(){if(this._viewportStart.isValid&&this.viewLayout.getCurrentScrollTop()>0){let e=new Ie(this._viewportStart.viewLineNumber,this.getLineMinColumn(this._viewportStart.viewLineNumber)),t=this.coordinatesConverter.convertViewPositionToModelPosition(e);return new Bbt(t,this._viewportStart.startLineDelta)}return new Bbt(null,0)}_onConfigurationChanged(e,t){let o=this._captureStableViewport(),n=this._configuration.options,r=n.get(59),s=n.get(156),l=n.get(166),c=n.get(155),u=n.get(146);this._lines.setWrappingSettings(r,s,l.wrappingColumn,c,u)&&(e.emitViewEvent(new mse),e.emitViewEvent(new hse),e.emitViewEvent(new wU(null)),this._cursor.onLineMappingChanged(e),this._decorations.onLineMappingChanged(),this.viewLayout.onFlushed(this.getLineCount(),this._getCustomLineHeights()),this._updateConfigurationViewLineCount.schedule()),t.hasChanged(104)&&(this._decorations.reset(),e.emitViewEvent(new wU(null))),t.hasChanged(112)&&(this._decorations.reset(),e.emitViewEvent(new wU(null))),e.emitViewEvent(new Sht(t)),this.viewLayout.onConfigurationChanged(t),o.recoverViewportStart(this.coordinatesConverter,this.viewLayout),rW.shouldRecreate(t)&&(this.cursorConfig=new rW(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._cursor.updateConfiguration(this.cursorConfig))}onDidChangeContentOrInjectedText(e){try{let o=this._eventDispatcher.beginEmitViewEvents(),n=!1,r=!1,s=e instanceof _9?e.rawContentChangedEvent.changes:e.changes,l=e instanceof _9?e.rawContentChangedEvent.versionId:null,c=this._lines.createLineBreaksComputer();for(let g of s)switch(g.changeType){case 4:{for(let f=0;f<g.detail.length;f++){let v=g.detail[f],b=g.injectedTexts[f];b&&(b=b.filter(S=>!S.ownerId||S.ownerId===this._editorId)),c.addRequest(v,b,null)}break}case 2:{let f=null;g.injectedText&&(f=g.injectedText.filter(v=>!v.ownerId||v.ownerId===this._editorId)),c.addRequest(g.detail,f,null);break}}let u=c.finalize(),p=new bS(u),h=[];for(let g of s)switch(g.changeType){case 1:{this._lines.onModelFlushed(),o.emitViewEvent(new mse),this._decorations.reset(),this.viewLayout.onFlushed(this.getLineCount(),this._getCustomLineHeights()),n=!0;break}case 3:{let f=this._lines.onModelLinesDeleted(l,g.fromLineNumber,g.toLineNumber);f!==null&&(o.emitViewEvent(f),this.viewLayout.onLinesDeleted(f.fromLineNumber,f.toLineNumber),h.push({fromLineNumber:g.lastUntouchedLinePostEdit,toLineNumber:g.lastUntouchedLinePostEdit})),n=!0;break}case 4:{let f=p.takeCount(g.detail.length),v=this._lines.onModelLinesInserted(l,g.fromLineNumber,g.toLineNumber,f);v!==null&&(o.emitViewEvent(v),this.viewLayout.onLinesInserted(v.fromLineNumber,v.toLineNumber),h.push({fromLineNumber:g.fromLineNumberPostEdit,toLineNumber:g.toLineNumberPostEdit})),n=!0;break}case 2:{let f=p.dequeue(),[v,b,S,y]=this._lines.onModelLineChanged(l,g.lineNumber,f);r=v,b&&o.emitViewEvent(b),S&&(o.emitViewEvent(S),this.viewLayout.onLinesInserted(S.fromLineNumber,S.toLineNumber),h.push({fromLineNumber:g.lineNumberPostEdit,toLineNumber:g.lineNumberPostEdit})),y&&(o.emitViewEvent(y),this.viewLayout.onLinesDeleted(y.fromLineNumber,y.toLineNumber),h.push({fromLineNumber:g.lineNumberPostEdit,toLineNumber:g.lineNumberPostEdit}));break}case 5:break}l!==null&&this._lines.acceptVersionId(l),h.length>0&&this.viewLayout.changeSpecialLineHeights(g=>{for(let f of h){let v=this._getCustomLineHeightsForLines(f.fromLineNumber,f.toLineNumber);for(let b of v)g.insertOrChangeCustomLineHeight(b.decorationId,b.startLineNumber,b.endLineNumber,b.lineHeight)}}),this.viewLayout.onHeightMaybeChanged(),!n&&r&&(o.emitViewEvent(new hse),o.emitViewEvent(new wU(null)),this._cursor.onLineMappingChanged(o),this._decorations.onLineMappingChanged())}finally{this._eventDispatcher.endEmitViewEvents()}let t=this._viewportStart.isValid;if(this._viewportStart.invalidate(),this._configuration.setModelLineCount(this.model.getLineCount()),this._updateConfigurationViewLineCountNow(),!this._hasFocus&&this.model.getAttachedEditorCount()>=2&&t){let o=this.model._getTrackedRange(this._viewportStart.modelTrackedRange);if(o){let n=this.coordinatesConverter.convertModelPositionToViewPosition(o.getStartPosition()),r=this.viewLayout.getVerticalOffsetForLineNumber(n.lineNumber);this.viewLayout.setScrollPosition({scrollTop:r+this._viewportStart.startLineDelta},1)}}this._handleVisibleLinesChanged()}emitContentChangeEvent(e){this._emitViewEvent(t=>{e instanceof _9&&t.emitOutgoingEvent(new Sbt(e.contentChangedEvent)),this._cursor.onModelContentChanged(t,e)})}_registerModelEvents(){this._configuration.options.get(5)&&this._register(this.model.onDidChangeLineHeight(o=>{let n=o.changes.filter(r=>r.ownerId===this._editorId||r.ownerId===0);if(this.viewLayout.changeSpecialLineHeights(r=>{for(let s of n){let{decorationId:l,lineNumber:c,lineHeightMultiplier:u}=s,p=this.coordinatesConverter.convertModelRangeToViewRange(new z(c,1,c,this.model.getLineMaxColumn(c)));u!==null?r.insertOrChangeCustomLineHeight(l,p.startLineNumber,p.endLineNumber,u*this._configuration.options.get(75)):r.removeCustomLineHeight(l)}}),n.length>0){let r=new nye(n);this._eventDispatcher.emitOutgoingEvent(new wbt(r))}})),this._configuration.options.get(172)&&this._register(this.model.onDidChangeFont(o=>{let n=o.changes.filter(r=>r.ownerId===this._editorId||r.ownerId===0);if(n.length>0){let r=new rye(n);this._eventDispatcher.emitOutgoingEvent(new Cbt(r))}})),this._register(this.model.onDidChangeTokens(o=>{let n=[];for(let r=0,s=o.ranges.length;r<s;r++){let l=o.ranges[r],c=this.coordinatesConverter.convertModelPositionToViewPosition(new Ie(l.fromLineNumber,1)).lineNumber,u=this.coordinatesConverter.convertModelPositionToViewPosition(new Ie(l.toLineNumber,this.model.getLineMaxColumn(l.toLineNumber))).lineNumber;n[r]={fromLineNumber:c,toLineNumber:u}}this._eventDispatcher.emitSingleViewEvent(new kht(n)),this._eventDispatcher.emitOutgoingEvent(new ybt(o))})),this._register(this.model.onDidChangeLanguageConfiguration(o=>{this._eventDispatcher.emitSingleViewEvent(new wht),this.cursorConfig=new rW(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._cursor.updateConfiguration(this.cursorConfig),this._eventDispatcher.emitOutgoingEvent(new bbt(o))})),this._register(this.model.onDidChangeLanguage(o=>{this.cursorConfig=new rW(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._cursor.updateConfiguration(this.cursorConfig),this._eventDispatcher.emitOutgoingEvent(new vbt(o))})),this._register(this.model.onDidChangeOptions(o=>{if(this._lines.setTabSize(this.model.getOptions().tabSize)){try{let n=this._eventDispatcher.beginEmitViewEvents();n.emitViewEvent(new mse),n.emitViewEvent(new hse),n.emitViewEvent(new wU(null)),this._cursor.onLineMappingChanged(n),this._decorations.onLineMappingChanged(),this.viewLayout.onFlushed(this.getLineCount(),this._getCustomLineHeights())}finally{this._eventDispatcher.endEmitViewEvents()}this._updateConfigurationViewLineCount.schedule()}this.cursorConfig=new rW(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._cursor.updateConfiguration(this.cursorConfig),this._eventDispatcher.emitOutgoingEvent(new Ibt(o))})),this._register(this.model.onDidChangeDecorations(o=>{this._decorations.onModelDecorationsChanged(),this._eventDispatcher.emitSingleViewEvent(new wU(o)),this._eventDispatcher.emitOutgoingEvent(new fbt(o))}))}getFontSizeAtPosition(e){if(!this._configuration.options.get(172))return null;let o=this.model.getFontDecorationsInRange(z.fromPositions(e),this._editorId),n=this._configuration.options.get(59).fontSize+"px";for(let r of o)if(r.options.fontSize){n=r.options.fontSize;break}return n}setHiddenAreas(e,t,o){this.hiddenAreasModel.setHiddenAreas(t,e);let n=this.hiddenAreasModel.getMergedRanges();if(n===this.previousHiddenAreas&&!o)return;this.previousHiddenAreas=n;let r=this._captureStableViewport(),s=!1;try{let l=this._eventDispatcher.beginEmitViewEvents();s=this._lines.setHiddenAreas(n),s&&(l.emitViewEvent(new mse),l.emitViewEvent(new hse),l.emitViewEvent(new wU(null)),this._cursor.onLineMappingChanged(l),this._decorations.onLineMappingChanged(),this.viewLayout.onFlushed(this.getLineCount(),this._getCustomLineHeights()),this.viewLayout.onHeightMaybeChanged());let c=r.viewportStartModelPosition?.lineNumber;c&&n.some(p=>p.startLineNumber<=c&&c<=p.endLineNumber)||r.recoverViewportStart(this.coordinatesConverter,this.viewLayout)}finally{this._eventDispatcher.endEmitViewEvents()}this._updateConfigurationViewLineCount.schedule(),s&&this._eventDispatcher.emitOutgoingEvent(new mbt)}getVisibleRangesPlusViewportAboveBelow(){let e=this._configuration.options.get(165),t=this._configuration.options.get(75),o=Math.max(20,Math.round(e.height/t)),n=this.viewLayout.getLinesViewportData(),r=Math.max(1,n.completelyVisibleStartLineNumber-o),s=Math.min(this.getLineCount(),n.completelyVisibleEndLineNumber+o);return this._toModelVisibleRanges(new z(r,this.getLineMinColumn(r),s,this.getLineMaxColumn(s)))}getVisibleRanges(){let e=this.getCompletelyVisibleViewRange();return this._toModelVisibleRanges(e)}getHiddenAreas(){return this._lines.getHiddenAreas()}_toModelVisibleRanges(e){let t=this.coordinatesConverter.convertViewRangeToModelRange(e),o=this._lines.getHiddenAreas();if(o.length===0)return[t];let n=[],r=0,s=t.startLineNumber,l=t.startColumn,c=t.endLineNumber,u=t.endColumn;for(let p=0,h=o.length;p<h;p++){let g=o[p].startLineNumber,f=o[p].endLineNumber;f<s||g>c||(s<g&&(n[r++]=new z(s,l,g-1,this.model.getLineMaxColumn(g-1))),s=f+1,l=1)}return(s<c||s===c&&l<u)&&(n[r++]=new z(s,l,c,u)),n}getCompletelyVisibleViewRange(){let e=this.viewLayout.getLinesViewportData(),t=e.completelyVisibleStartLineNumber,o=e.completelyVisibleEndLineNumber;return new z(t,this.getLineMinColumn(t),o,this.getLineMaxColumn(o))}getCompletelyVisibleViewRangeAtScrollTop(e){let t=this.viewLayout.getLinesViewportDataAtScrollTop(e),o=t.completelyVisibleStartLineNumber,n=t.completelyVisibleEndLineNumber;return new z(o,this.getLineMinColumn(o),n,this.getLineMaxColumn(n))}getViewRangeWithCursorPadding(e){let t=this._configuration.options,o=t.get(35),n=t.get(131),{startLineNumber:r,endLineNumber:s}=e,l=Math.min(Math.max(o,n.enabled?n.maxLineCount:0),Math.floor((s-r+1)/2));return r+=l,s-=Math.max(0,l-1),l===0||r>s?e:new z(r,this.getLineMinColumn(r),s,this.getLineMaxColumn(s))}saveState(){let e=this.viewLayout.saveState(),t=e.scrollTop,o=this.viewLayout.getLineNumberAtVerticalOffset(t),n=this.coordinatesConverter.convertViewPositionToModelPosition(new Ie(o,this.getLineMinColumn(o))),r=this.viewLayout.getVerticalOffsetForLineNumber(o)-t;return{scrollLeft:e.scrollLeft,firstPosition:n,firstPositionDeltaTop:r}}reduceRestoreState(e){if(typeof e.firstPosition>"u")return this._reduceRestoreStateCompatibility(e);let t=this.model.validatePosition(e.firstPosition),o=this.coordinatesConverter.convertModelPositionToViewPosition(t),n=this.viewLayout.getVerticalOffsetForLineNumber(o.lineNumber)-e.firstPositionDeltaTop;return{scrollLeft:e.scrollLeft,scrollTop:n}}_reduceRestoreStateCompatibility(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTopWithoutViewZones}}getTabSize(){return this.model.getOptions().tabSize}getLineCount(){return this._lines.getViewLineCount()}setViewport(e,t,o){this._viewportStart.update(this,e)}getActiveIndentGuide(e,t,o){return this._lines.getActiveIndentGuide(e,t,o)}getLinesIndentGuides(e,t){return this._lines.getViewLinesIndentGuides(e,t)}getBracketGuidesInRangeByLine(e,t,o,n){return this._lines.getViewLinesBracketGuides(e,t,o,n)}getLineContent(e){return this._lines.getViewLineContent(e)}getLineLength(e){return this._lines.getViewLineLength(e)}getLineMinColumn(e){return this._lines.getViewLineMinColumn(e)}getLineMaxColumn(e){return this._lines.getViewLineMaxColumn(e)}getLineFirstNonWhitespaceColumn(e){let t=Ap(this.getLineContent(e));return t===-1?0:t+1}getLineLastNonWhitespaceColumn(e){let t=tv(this.getLineContent(e));return t===-1?0:t+2}getMinimapDecorationsInRange(e){return this._decorations.getMinimapDecorationsInRange(e)}getDecorationsInViewport(e){return this._decorations.getDecorationsViewportData(e).decorations}getInjectedTextAt(e){return this._lines.getInjectedTextAt(e)}_getTextDirection(e,t){let o=0;for(let n of t){let r=n.range;if(r.startLineNumber>e||r.endLineNumber<e)continue;let s=n.options.textDirection;s===1?o++:s===0&&o--}return o>0?1:0}getTextDirection(e){let t=this._decorations.getDecorationsOnLine(e);return this._getTextDirection(e,t.decorations)}getViewportViewLineRenderingData(e,t){let o=this._decorations.getDecorationsViewportData(e),n=t-e.startLineNumber,r=o.inlineDecorations[n],s=o.hasVariableFonts[n];return this._getViewLineRenderingData(t,r,s,o.decorations)}getViewLineRenderingData(e){let t=this._decorations.getDecorationsOnLine(e);return this._getViewLineRenderingData(e,t.inlineDecorations[0],t.hasVariableFonts[0],t.decorations)}_getViewLineRenderingData(e,t,o,n){let r=this.model.mightContainRTL(),s=this.model.mightContainNonBasicASCII(),l=this.getTabSize(),c=this._lines.getViewLineData(e);return c.inlineDecorations&&(t=[...t,...c.inlineDecorations]),new KU(c.minColumn,c.maxColumn,c.content,c.continuesWithWrappedLine,r,s,c.tokens,t,l,c.startVisibleColumn,this._getTextDirection(e,n),o)}getViewLineData(e){return this._lines.getViewLineData(e)}getMinimapLinesRenderingData(e,t,o){let n=this._lines.getViewLinesData(e,t,o);return new Gft(this.getTabSize(),n)}getAllOverviewRulerDecorations(e){let t=this.model.getOverviewRulerDecorations(this._editorId,Qre(this._configuration.options),Yre(this._configuration.options)),o=new Rei;for(let n of t){let r=n.options,s=r.overviewRuler;if(!s)continue;let l=s.position;if(l===0)continue;let c=s.getColor(e.value),u=this.coordinatesConverter.getViewLineNumberOfModelPosition(n.range.startLineNumber,n.range.startColumn),p=this.coordinatesConverter.getViewLineNumberOfModelPosition(n.range.endLineNumber,n.range.endColumn);o.accept(c,r.zIndex,u,p,l)}return o.asArray}_invalidateDecorationsColorCache(){let e=this.model.getOverviewRulerDecorations();for(let t of e)t.options.overviewRuler?.invalidateCachedColor(),t.options.minimap?.invalidateCachedColor()}getValueInRange(e,t){let o=this.coordinatesConverter.convertViewRangeToModelRange(e);return this.model.getValueInRange(o,t)}getValueLengthInRange(e,t){let o=this.coordinatesConverter.convertViewRangeToModelRange(e);return this.model.getValueLengthInRange(o,t)}modifyPosition(e,t){let o=this.coordinatesConverter.convertViewPositionToModelPosition(e),n=this.model.modifyPosition(o,t);return this.coordinatesConverter.convertModelPositionToViewPosition(n)}deduceModelPositionRelativeToViewPosition(e,t,o){let n=this.coordinatesConverter.convertViewPositionToModelPosition(e);this.model.getEOL().length===2&&(t<0?t-=o:t+=o);let s=this.model.getOffsetAt(n)+t;return this.model.getPositionAt(s)}getPlainTextToCopy(e,t,o){let n=o?`\r
`:this.model.getEOL();e=e.slice(0),e.sort(z.compareRangesUsingStarts);let r=!1,s=!1;for(let p of e)p.isEmpty()?r=!0:s=!0;if(!s&&!t)return{sourceRanges:[],sourceText:""};let l=[],c=[],u=(p,h="")=>{l.push(p),c.push(this.model.getValueInRange(p,o?2:0)+h)};if(r&&t){let p=0;for(let h of e){let g=h.startLineNumber;h.isEmpty()?g!==p&&u(new z(g,this.model.getLineMinColumn(g),g,this.model.getLineMaxColumn(g)),n):u(h),p=g}}else for(let p of e)p.isEmpty()||u(p);return{sourceRanges:l,sourceText:c.length===1?c[0]:c}}getRichTextToCopy(e,t){let o=this.model.getLanguageId();if(o===Fr||e.length!==1)return null;let n=e[0];if(n.isEmpty()){if(!t)return null;let p=n.startLineNumber;n=new z(p,this.model.getLineMinColumn(p),p,this.model.getLineMaxColumn(p))}let r=this._configuration.options.get(59),s=this._getColorMap(),c=/[:;\\\/<>]/.test(r.fontFamily)||r.fontFamily===Yd.fontFamily,u;return c?u=Yd.fontFamily:(u=r.fontFamily,u=u.replace(/"/g,"'"),/[,']/.test(u)||/[+ ]/.test(u)&&(u=`'${u}'`),u=`${u}, ${Yd.fontFamily}`),{mode:o,html:`<div style="color: ${s[1]};background-color: ${s[2]};font-family: ${u};font-weight: ${r.fontWeight};font-size: ${r.fontSize}px;line-height: ${r.lineHeight}px;white-space: pre;">`+this._getHTMLToCopy(n,s)+"</div>"}}_getHTMLToCopy(e,t){let o=e.startLineNumber,n=e.startColumn,r=e.endLineNumber,s=e.endColumn,l=this.getTabSize(),c="";for(let u=o;u<=r;u++){let p=this.model.tokenization.getLineTokens(u),h=p.getLineContent(),g=u===o?n-1:0,f=u===r?s-1:h.length;h===""?c+="<br>":c+=Ebt(h,p.inflate(),t,g,f,l,ri)}return c}_getColorMap(){let e=kc.getColorMap(),t=["#000000"];if(e)for(let o=1,n=e.length;o<n;o++)t[o]=Oe.Format.CSS.formatHex(e[o]);return t}getPrimaryCursorState(){return this._cursor.getPrimaryCursorState()}getLastAddedCursorIndex(){return this._cursor.getLastAddedCursorIndex()}getCursorStates(){return this._cursor.getCursorStates()}setCursorStates(e,t,o){return this._withViewEventsCollector(n=>this._cursor.setStates(n,e,t,o))}getCursorColumnSelectData(){return this._cursor.getCursorColumnSelectData()}getCursorAutoClosedCharacters(){return this._cursor.getAutoClosedCharacters()}setCursorColumnSelectData(e){this._cursor.setCursorColumnSelectData(e)}getPrevEditOperationType(){return this._cursor.getPrevEditOperationType()}setPrevEditOperationType(e){this._cursor.setPrevEditOperationType(e)}getSelection(){return this._cursor.getSelection()}getSelections(){return this._cursor.getSelections()}getPosition(){return this._cursor.getPrimaryCursorState().modelState.position}setSelections(e,t,o=0){this._withViewEventsCollector(n=>this._cursor.setSelections(n,e,t,o))}saveCursorState(){return this._cursor.saveState()}restoreCursorState(e){this._withViewEventsCollector(t=>this._cursor.restoreState(t,e))}_executeCursorEdit(e){if(this._cursor.context.cursorConfig.readOnly){this._eventDispatcher.emitOutgoingEvent(new gbt);return}this._withViewEventsCollector(e)}executeEdits(e,t,o,n){this._executeCursorEdit(r=>this._cursor.executeEdits(r,e,t,o,n))}startComposition(){this._executeCursorEdit(e=>this._cursor.startComposition(e))}endComposition(e){this._executeCursorEdit(t=>this._cursor.endComposition(t,e))}type(e,t){this._executeCursorEdit(o=>this._cursor.type(o,e,t))}compositionType(e,t,o,n,r){this._executeCursorEdit(s=>this._cursor.compositionType(s,e,t,o,n,r))}paste(e,t,o,n){this._executeCursorEdit(r=>this._cursor.paste(r,e,t,o,n))}cut(e){this._executeCursorEdit(t=>this._cursor.cut(t,e))}executeCommand(e,t){this._executeCursorEdit(o=>this._cursor.executeCommand(o,e,t))}executeCommands(e,t){this._executeCursorEdit(o=>this._cursor.executeCommands(o,e,t))}revealAllCursors(e,t,o=!1){this._withViewEventsCollector(n=>this._cursor.revealAll(n,e,o,0,t,0))}revealPrimaryCursor(e,t,o=!1){this._withViewEventsCollector(n=>this._cursor.revealPrimary(n,e,o,0,t,0))}revealTopMostCursor(e){let t=this._cursor.getTopMostViewPosition(),o=new z(t.lineNumber,t.column,t.lineNumber,t.column);this._withViewEventsCollector(n=>n.emitViewEvent(new A$(e,!1,o,null,0,!0,0)))}revealBottomMostCursor(e){let t=this._cursor.getBottomMostViewPosition(),o=new z(t.lineNumber,t.column,t.lineNumber,t.column);this._withViewEventsCollector(n=>n.emitViewEvent(new A$(e,!1,o,null,0,!0,0)))}revealRange(e,t,o,n,r){this._withViewEventsCollector(s=>s.emitViewEvent(new A$(e,!1,o,null,n,t,r)))}changeWhitespace(e){this.viewLayout.changeWhitespace(e)&&(this._eventDispatcher.emitSingleViewEvent(new Tht),this._eventDispatcher.emitOutgoingEvent(new pbt))}_withViewEventsCollector(e){return this._transactionalTarget.batchChanges(()=>this._emitViewEvent(e))}_emitViewEvent(e){try{let t=this._eventDispatcher.beginEmitViewEvents();return e(t)}finally{this._eventDispatcher.endEmitViewEvents()}}batchEvents(e){this._withViewEventsCollector(()=>{e()})}normalizePosition(e,t){return this._lines.normalizePosition(e,t)}getLineIndentColumn(e){return this._lines.getLineIndentColumn(e)}},Lei=class a{constructor(i,e,t,o,n){this._model=i;this._viewLineNumber=e;this._isValid=t;this._modelTrackedRange=o;this._startLineDelta=n}static create(i){let e=i._setTrackedRange(null,new z(1,1,1,1),1);return new a(i,1,!1,e,0)}get viewLineNumber(){return this._viewLineNumber}get isValid(){return this._isValid}get modelTrackedRange(){return this._modelTrackedRange}get startLineDelta(){return this._startLineDelta}dispose(){this._model._setTrackedRange(this._modelTrackedRange,null,1)}update(i,e){let t=i.coordinatesConverter.convertViewPositionToModelPosition(new Ie(e,i.getLineMinColumn(e))),o=i.model._setTrackedRange(this._modelTrackedRange,new z(t.lineNumber,t.column,t.lineNumber,t.column),1),n=i.viewLayout.getVerticalOffsetForLineNumber(e),r=i.viewLayout.getCurrentScrollTop();this._viewLineNumber=e,this._isValid=!0,this._modelTrackedRange=o,this._startLineDelta=r-n}invalidate(){this._isValid=!1}},Rei=class{constructor(){this._asMap=Object.create(null);this.asArray=[]}accept(i,e,t,o,n){let r=this._asMap[i];if(r){let s=r.data,l=s[s.length-3],c=s[s.length-1];if(l===n&&c+1>=t){o>c&&(s[s.length-1]=o);return}s.push(n,t,o)}else{let s=new eae(i,e,[n,t,o]);this._asMap[i]=s,this.asArray.push(s)}}},Mei=class{constructor(){this.hiddenAreas=new Map;this.shouldRecompute=!1;this.ranges=[]}setHiddenAreas(i,e){let t=this.hiddenAreas.get(i);t&&Dji(t,e)||(this.hiddenAreas.set(i,e),this.shouldRecompute=!0)}getMergedRanges(){if(!this.shouldRecompute)return this.ranges;this.shouldRecompute=!1;let i=Array.from(this.hiddenAreas.values()).reduce((e,t)=>mNo(e,t),[]);return Dji(this.ranges,i)?this.ranges:(this.ranges=i,this.ranges)}};function mNo(a,i){let e=[],t=0,o=0;for(;t<a.length&&o<i.length;){let n=a[t],r=i[o];if(n.endLineNumber<r.startLineNumber-1)e.push(a[t++]);else if(r.endLineNumber<n.startLineNumber-1)e.push(i[o++]);else{let s=Math.min(n.startLineNumber,r.startLineNumber),l=Math.max(n.endLineNumber,r.endLineNumber);e.push(new z(s,1,l,1)),t++,o++}}for(;t<a.length;)e.push(a[t++]);for(;o<i.length;)e.push(i[o++]);return e}function Dji(a,i){if(a.length!==i.length)return!1;for(let e=0;e<a.length;e++)if(!a[e].equalsRange(i[e]))return!1;return!0}var Bbt=class{constructor(i,e){this.viewportStartModelPosition=i;this.startLineDelta=e}recoverViewportStart(i,e){if(!this.viewportStartModelPosition)return;let t=i.convertModelPositionToViewPosition(this.viewportStartModelPosition),o=e.getVerticalOffsetForLineNumber(t.lineNumber);e.setScrollPosition({scrollTop:o+this.startLineDelta},1)}};var Io=class{constructor(...i){this._entries=new Map;for(let[e,t]of i)this.set(e,t)}set(i,e){let t=this._entries.get(i);return this._entries.set(i,e),t}has(i){return this._entries.has(i)}get(i){return this._entries.get(i)}};var jr=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.languageConfigurationService=h;this._deliveryQueue=zUi();this._contributions=this._register(new _vt);this._onDidDispose=this._register(new E);this.onDidDispose=this._onDidDispose.event;this._onDidChangeModelContent=this._register(new E({deliveryQueue:this._deliveryQueue}));this.onDidChangeModelContent=this._onDidChangeModelContent.event;this._onDidChangeModelLanguage=this._register(new E({deliveryQueue:this._deliveryQueue}));this.onDidChangeModelLanguage=this._onDidChangeModelLanguage.event;this._onDidChangeModelLanguageConfiguration=this._register(new E({deliveryQueue:this._deliveryQueue}));this.onDidChangeModelLanguageConfiguration=this._onDidChangeModelLanguageConfiguration.event;this._onDidChangeModelOptions=this._register(new E({deliveryQueue:this._deliveryQueue}));this.onDidChangeModelOptions=this._onDidChangeModelOptions.event;this._onDidChangeModelDecorations=this._register(new E({deliveryQueue:this._deliveryQueue}));this.onDidChangeModelDecorations=this._onDidChangeModelDecorations.event;this._onDidChangeLineHeight=this._register(new E({deliveryQueue:this._deliveryQueue}));this.onDidChangeLineHeight=this._onDidChangeLineHeight.event;this._onDidChangeFont=this._register(new E({deliveryQueue:this._deliveryQueue}));this.onDidChangeFont=this._onDidChangeFont.event;this._onDidChangeModelTokens=this._register(new E({deliveryQueue:this._deliveryQueue}));this.onDidChangeModelTokens=this._onDidChangeModelTokens.event;this._onDidChangeConfiguration=this._register(new E({deliveryQueue:this._deliveryQueue}));this.onDidChangeConfiguration=this._onDidChangeConfiguration.event;this._onWillChangeModel=this._register(new E({deliveryQueue:this._deliveryQueue}));this.onWillChangeModel=this._onWillChangeModel.event;this._onDidChangeModel=this._register(new E({deliveryQueue:this._deliveryQueue}));this.onDidChangeModel=this._onDidChangeModel.event;this._onDidChangeCursorPosition=this._register(new E({deliveryQueue:this._deliveryQueue}));this.onDidChangeCursorPosition=this._onDidChangeCursorPosition.event;this._onDidChangeCursorSelection=this._register(new E({deliveryQueue:this._deliveryQueue}));this.onDidChangeCursorSelection=this._onDidChangeCursorSelection.event;this._onDidAttemptReadOnlyEdit=this._register(new ob(this._contributions,this._deliveryQueue));this.onDidAttemptReadOnlyEdit=this._onDidAttemptReadOnlyEdit.event;this._onDidLayoutChange=this._register(new E({deliveryQueue:this._deliveryQueue}));this.onDidLayoutChange=this._onDidLayoutChange.event;this._editorTextFocus=this._register(new Hbt({deliveryQueue:this._deliveryQueue}));this.onDidFocusEditorText=this._editorTextFocus.onDidChangeToTrue;this.onDidBlurEditorText=this._editorTextFocus.onDidChangeToFalse;this._editorWidgetFocus=this._register(new Hbt({deliveryQueue:this._deliveryQueue}));this.onDidFocusEditorWidget=this._editorWidgetFocus.onDidChangeToTrue;this.onDidBlurEditorWidget=this._editorWidgetFocus.onDidChangeToFalse;this._onWillType=this._register(new ob(this._contributions,this._deliveryQueue));this.onWillType=this._onWillType.event;this._onDidType=this._register(new ob(this._contributions,this._deliveryQueue));this.onDidType=this._onDidType.event;this._onDidCompositionStart=this._register(new ob(this._contributions,this._deliveryQueue));this.onDidCompositionStart=this._onDidCompositionStart.event;this._onDidCompositionEnd=this._register(new ob(this._contributions,this._deliveryQueue));this.onDidCompositionEnd=this._onDidCompositionEnd.event;this._onDidPaste=this._register(new ob(this._contributions,this._deliveryQueue));this.onDidPaste=this._onDidPaste.event;this._onWillCopy=this._register(new ob(this._contributions,this._deliveryQueue));this.onWillCopy=this._onWillCopy.event;this._onWillCut=this._register(new ob(this._contributions,this._deliveryQueue));this.onWillCut=this._onWillCut.event;this._onWillPaste=this._register(new ob(this._contributions,this._deliveryQueue));this.onWillPaste=this._onWillPaste.event;this._onMouseUp=this._register(new ob(this._contributions,this._deliveryQueue));this.onMouseUp=this._onMouseUp.event;this._onMouseDown=this._register(new ob(this._contributions,this._deliveryQueue));this.onMouseDown=this._onMouseDown.event;this._onMouseDrag=this._register(new ob(this._contributions,this._deliveryQueue));this.onMouseDrag=this._onMouseDrag.event;this._onMouseDrop=this._register(new ob(this._contributions,this._deliveryQueue));this.onMouseDrop=this._onMouseDrop.event;this._onMouseDropCanceled=this._register(new ob(this._contributions,this._deliveryQueue));this.onMouseDropCanceled=this._onMouseDropCanceled.event;this._onDropIntoEditor=this._register(new ob(this._contributions,this._deliveryQueue));this.onDropIntoEditor=this._onDropIntoEditor.event;this._onContextMenu=this._register(new ob(this._contributions,this._deliveryQueue));this.onContextMenu=this._onContextMenu.event;this._onMouseMove=this._register(new ob(this._contributions,this._deliveryQueue));this.onMouseMove=this._onMouseMove.event;this._onMouseLeave=this._register(new ob(this._contributions,this._deliveryQueue));this.onMouseLeave=this._onMouseLeave.event;this._onMouseWheel=this._register(new ob(this._contributions,this._deliveryQueue));this.onMouseWheel=this._onMouseWheel.event;this._onKeyUp=this._register(new ob(this._contributions,this._deliveryQueue));this.onKeyUp=this._onKeyUp.event;this._onKeyDown=this._register(new ob(this._contributions,this._deliveryQueue));this.onKeyDown=this._onKeyDown.event;this._onDidContentSizeChange=this._register(new E({deliveryQueue:this._deliveryQueue}));this.onDidContentSizeChange=this._onDidContentSizeChange.event;this._onDidScrollChange=this._register(new E({deliveryQueue:this._deliveryQueue}));this.onDidScrollChange=this._onDidScrollChange.event;this._onDidChangeViewZones=this._register(new E({deliveryQueue:this._deliveryQueue}));this.onDidChangeViewZones=this._onDidChangeViewZones.event;this._onDidChangeHiddenAreas=this._register(new E({deliveryQueue:this._deliveryQueue}));this.onDidChangeHiddenAreas=this._onDidChangeHiddenAreas.event;this._updateCounter=0;this._onWillTriggerEditorOperationEvent=this._register(new E);this.onWillTriggerEditorOperationEvent=this._onWillTriggerEditorOperationEvent.event;this._onBeginUpdate=this._register(new E);this.onBeginUpdate=this._onBeginUpdate.event;this._onEndUpdate=this._register(new E);this.onEndUpdate=this._onEndUpdate.event;this._onBeforeExecuteEdit=this._register(new E);this.onBeforeExecuteEdit=this._onBeforeExecuteEdit.event;this._actions=new Map;this._bannerDomNode=null;this._dropIntoEditorDecorations=this.createDecorationsCollection();this.inComposition=!1;r.willCreateCodeEditor();let v={...t};if(this._domElement=e,this._userInteractionService=f,this._overflowWidgetsDomNode=v.overflowWidgetsDomNode,delete v.overflowWidgetsDomNode,this._id=++gNo,this._decorationTypeKeysToIds={},this._decorationTypeSubtypes={},this._telemetryData=o.telemetryData,this._configuration=this._register(this._createConfiguration(o.isSimpleWidget||!1,o.contextMenuId??(o.isSimpleWidget?D.SimpleEditorContext:D.EditorContext),v,p)),this._domElement.style?.setProperty("--editor-font-size",this._configuration.options.get(61)+"px"),this._register(this._configuration.onDidChange(y=>{this._onDidChangeConfiguration.fire(y);let w=this._configuration.options;if(y.hasChanged(165)){let k=w.get(165);this._onDidLayoutChange.fire(k)}y.hasChanged(61)&&this._domElement.style.setProperty("--editor-font-size",w.get(61)+"px")})),this._contextKeyService=this._register(l.createScoped(this._domElement)),o.contextKeyValues)for(let[y,w]of Object.entries(o.contextKeyValues))this._contextKeyService.createKey(y,w);this._notificationService=u,this._codeEditorService=r,this._commandService=s,this._themeService=c,this._register(new Aei(this,this._contextKeyService)),this._register(new Nei(this,this._contextKeyService,g)),this._instantiationService=this._register(n.createChild(new Io([X,this._contextKeyService]))),this._modelData=null,this._contentWidgets={},this._overlayWidgets={},this._glyphMarginWidgets={};let b;Array.isArray(o.contributions)?b=o.contributions:b=aa.getEditorContributions(),this._contributions.initialize(this,b,this._instantiationService);for(let y of aa.getEditorActions()){if(this._actions.has(y.id)){mt(new Error(`Cannot have two actions with the same id ${y.id}`));continue}let w=new Dvt(y.id,y.label,y.alias,y.metadata,y.precondition??void 0,k=>this._instantiationService.invokeFunction(T=>Promise.resolve(y.runEditorCommand(T,this,k))),this._contextKeyService);this._actions.set(w.id,w)}let S=()=>!this._configuration.options.get(104)&&this._configuration.options.get(43).enabled;this._register(new Om(this._domElement,{onDragOver:y=>{if(!S())return;let w=this.getTargetAtClientPoint(y.clientX,y.clientY);w?.position&&this.showDropIndicatorAt(w.position)},onDrop:async y=>{if(!S()||(this.removeDropIndicator(),!y.dataTransfer))return;let w=this.getTargetAtClientPoint(y.clientX,y.clientY);w?.position&&this._onDropIntoEditor.fire({position:w.position,event:y})},onDragLeave:()=>{this.removeDropIndicator()},onDragEnd:()=>{this.removeDropIndicator()}})),this._codeEditorService.addCodeEditor(this)}static{this.dropIntoEditorDecorationOptions=po.register({description:"workbench-dnd-target",className:"dnd-target"})}get isSimpleWidget(){return this._configuration.isSimpleWidget}get contextMenuId(){return this._configuration.contextMenuId}get contextKeyService(){return this._contextKeyService}writeScreenReaderContent(e){this._modelData?.view.writeScreenReaderContent(e)}_createConfiguration(e,t,o,n){return new i9(e,t,o,this._domElement,n)}getId(){return this.getEditorType()+":"+this._id}getEditorType(){return P$.ICodeEditor}dispose(){this._codeEditorService.removeCodeEditor(this),this._actions.clear(),this._contentWidgets={},this._overlayWidgets={},this._removeDecorationTypes(),this._postDetachModelCleanup(this._detachModel()),this._onDidDispose.fire(),super.dispose()}invokeWithinContext(e){return this._instantiationService.invokeFunction(e)}updateOptions(e){this._configuration.updateOptions(e||{})}getOptions(){return this._configuration.options}getOption(e){return this._configuration.options.get(e)}getRawOptions(){return this._configuration.getRawOptions()}getOverflowWidgetsDomNode(){return this._overflowWidgetsDomNode}getConfiguredWordAtPosition(e){return this._modelData?yf.getWordAtPosition(this._modelData.model,this._configuration.options.get(148),this._configuration.options.get(147),e):null}getValue(e=null){if(!this._modelData)return"";let t=!!(e&&e.preserveBOM),o=0;return e&&e.lineEnding&&e.lineEnding===`
`?o=1:e&&e.lineEnding&&e.lineEnding===`\r
`&&(o=2),this._modelData.model.getValue(o,t)}setValue(e){try{if(this._beginUpdate(),!this._modelData)return;this._modelData.model.setValue(e)}finally{this._endUpdate()}}getModel(){return this._modelData?this._modelData.model:null}setModel(e=null){try{this._beginUpdate();let t=e;if(this._modelData===null&&t===null||this._modelData&&this._modelData.model===t)return;let o={oldModelUrl:this._modelData?.model.uri||null,newModelUrl:t?.uri||null};this._onWillChangeModel.fire(o);let n=this.hasTextFocus(),r=this._detachModel();this._attachModel(t),this.hasModel()?n&&this.focus():(this._editorTextFocus.setValue(!1),this._editorWidgetFocus.setValue(!1)),this._removeDecorationTypes(),this._onDidChangeModel.fire(o),this._postDetachModelCleanup(r),this._contributionsDisposable=this._contributions.onAfterModelAttached()}finally{this._endUpdate()}}_removeDecorationTypes(){if(this._decorationTypeKeysToIds={},this._decorationTypeSubtypes){for(let e in this._decorationTypeSubtypes){let t=this._decorationTypeSubtypes[e];for(let o in t)this._removeDecorationType(e+"-"+o)}this._decorationTypeSubtypes={}}}getVisibleRanges(){return this._modelData?this._modelData.viewModel.getVisibleRanges():[]}getVisibleRangesPlusViewportAboveBelow(){return this._modelData?this._modelData.viewModel.getVisibleRangesPlusViewportAboveBelow():[]}getWhitespaces(){return this._modelData?this._modelData.viewModel.viewLayout.getWhitespaces():[]}static _getVerticalOffsetAfterPosition(e,t,o,n){let r=e.model.validatePosition({lineNumber:t,column:o}),s=e.viewModel.coordinatesConverter.convertModelPositionToViewPosition(r);return e.viewModel.viewLayout.getVerticalOffsetAfterLineNumber(s.lineNumber,n)}getTopForLineNumber(e,t=!1){return this._modelData?jr._getVerticalOffsetForPosition(this._modelData,e,1,t):-1}getTopForPosition(e,t){return this._modelData?jr._getVerticalOffsetForPosition(this._modelData,e,t,!1):-1}static _getVerticalOffsetForPosition(e,t,o,n=!1){let r=e.model.validatePosition({lineNumber:t,column:o}),s=e.viewModel.coordinatesConverter.convertModelPositionToViewPosition(r);return e.viewModel.viewLayout.getVerticalOffsetForLineNumber(s.lineNumber,n)}getBottomForLineNumber(e,t=!1){return this._modelData?jr._getVerticalOffsetAfterPosition(this._modelData,e,Number.MAX_SAFE_INTEGER,t):-1}getLineHeightForPosition(e){if(!this._modelData)return-1;let t=this._modelData.viewModel,o=t.coordinatesConverter,n=Ie.lift(e);if(o.modelPositionIsVisible(n)){let r=o.convertModelPositionToViewPosition(n);return t.viewLayout.getLineHeightForLineNumber(r.lineNumber)}return 0}setHiddenAreas(e,t,o){this._modelData?.viewModel.setHiddenAreas(e.map(n=>z.lift(n)),t,o)}getVisibleColumnFromPosition(e){if(!this._modelData)return e.column;let t=this._modelData.model.validatePosition(e),o=this._modelData.model.getOptions().tabSize;return al.visibleColumnFromColumn(this._modelData.model.getLineContent(t.lineNumber),t.column,o)+1}getStatusbarColumn(e){if(!this._modelData)return e.column;let t=this._modelData.model.validatePosition(e),o=this._modelData.model.getOptions().tabSize;return al.toStatusbarColumn(this._modelData.model.getLineContent(t.lineNumber),t.column,o)}getPosition(){return this._modelData?this._modelData.viewModel.getPosition():null}setPosition(e,t="api"){if(this._modelData){if(!Ie.isIPosition(e))throw new Error("Invalid arguments");this._modelData.viewModel.setSelections(t,[{selectionStartLineNumber:e.lineNumber,selectionStartColumn:e.column,positionLineNumber:e.lineNumber,positionColumn:e.column}])}}_sendRevealRange(e,t,o,n){if(!this._modelData)return;if(!z.isIRange(e))throw new Error("Invalid arguments");let r=this._modelData.model.validateRange(e),s=this._modelData.viewModel.coordinatesConverter.convertModelRangeToViewRange(r);this._modelData.viewModel.revealRange("api",o,s,t,n)}revealAllCursors(e,t){this._modelData&&this._modelData.viewModel.revealAllCursors("api",e,t)}revealLine(e,t=0){this._revealLine(e,0,t)}revealLineInCenter(e,t=0){this._revealLine(e,1,t)}revealLineInCenterIfOutsideViewport(e,t=0){this._revealLine(e,2,t)}revealLineNearTop(e,t=0){this._revealLine(e,5,t)}_revealLine(e,t,o){if(typeof e!="number")throw new Error("Invalid arguments");this._sendRevealRange(new z(e,1,e,1),t,!1,o)}revealPosition(e,t=0){this._revealPosition(e,0,!0,t)}revealPositionInCenter(e,t=0){this._revealPosition(e,1,!0,t)}revealPositionInCenterIfOutsideViewport(e,t=0){this._revealPosition(e,2,!0,t)}revealPositionNearTop(e,t=0){this._revealPosition(e,5,!0,t)}_revealPosition(e,t,o,n){if(!Ie.isIPosition(e))throw new Error("Invalid arguments");this._sendRevealRange(new z(e.lineNumber,e.column,e.lineNumber,e.column),t,o,n)}getSelection(){return this._modelData?this._modelData.viewModel.getSelection():null}getSelections(){return this._modelData?this._modelData.viewModel.getSelections():null}setSelection(e,t="api"){let o=Yt.isISelection(e),n=z.isIRange(e);if(!o&&!n)throw new Error("Invalid arguments");if(o)this._setSelectionImpl(e,t);else if(n){let r={selectionStartLineNumber:e.startLineNumber,selectionStartColumn:e.startColumn,positionLineNumber:e.endLineNumber,positionColumn:e.endColumn};this._setSelectionImpl(r,t)}}_setSelectionImpl(e,t){if(!this._modelData)return;let o=new Yt(e.selectionStartLineNumber,e.selectionStartColumn,e.positionLineNumber,e.positionColumn);this._modelData.viewModel.setSelections(t,[o])}revealLines(e,t,o=0){this._revealLines(e,t,0,o)}revealLinesInCenter(e,t,o=0){this._revealLines(e,t,1,o)}revealLinesInCenterIfOutsideViewport(e,t,o=0){this._revealLines(e,t,2,o)}revealLinesNearTop(e,t,o=0){this._revealLines(e,t,5,o)}_revealLines(e,t,o,n){if(typeof e!="number"||typeof t!="number")throw new Error("Invalid arguments");this._sendRevealRange(new z(e,1,t,1),o,!1,n)}revealRange(e,t=0,o=!1,n=!0){this._revealRange(e,o?1:0,n,t)}revealRangeInCenter(e,t=0){this._revealRange(e,1,!0,t)}revealRangeInCenterIfOutsideViewport(e,t=0){this._revealRange(e,2,!0,t)}revealRangeNearTop(e,t=0){this._revealRange(e,5,!0,t)}revealRangeNearTopIfOutsideViewport(e,t=0){this._revealRange(e,6,!0,t)}revealRangeAtTop(e,t=0){this._revealRange(e,3,!0,t)}_revealRange(e,t,o,n){if(!z.isIRange(e))throw new Error("Invalid arguments");this._sendRevealRange(z.lift(e),t,o,n)}setSelections(e,t="api",o=0){if(this._modelData){if(!e||e.length===0)throw new Error("Invalid arguments");for(let n=0,r=e.length;n<r;n++)if(!Yt.isISelection(e[n]))throw new Error("Invalid arguments");this._modelData.viewModel.setSelections(t,e,o)}}getContentWidth(){return this._modelData?this._modelData.viewModel.viewLayout.getContentWidth():-1}getScrollWidth(){return this._modelData?this._modelData.viewModel.viewLayout.getScrollWidth():-1}getScrollLeft(){return this._modelData?this._modelData.viewModel.viewLayout.getCurrentScrollLeft():-1}getContentHeight(){return this._modelData?this._modelData.viewModel.viewLayout.getContentHeight():-1}getScrollHeight(){return this._modelData?this._modelData.viewModel.viewLayout.getScrollHeight():-1}getScrollTop(){return this._modelData?this._modelData.viewModel.viewLayout.getCurrentScrollTop():-1}setScrollLeft(e,t=1){if(this._modelData){if(typeof e!="number")throw new Error("Invalid arguments");this._modelData.viewModel.viewLayout.setScrollPosition({scrollLeft:e},t)}}setScrollTop(e,t=1){if(this._modelData){if(typeof e!="number")throw new Error("Invalid arguments");this._modelData.viewModel.viewLayout.setScrollPosition({scrollTop:e},t)}}setScrollPosition(e,t=1){this._modelData&&this._modelData.viewModel.viewLayout.setScrollPosition(e,t)}hasPendingScrollAnimation(){return this._modelData?this._modelData.viewModel.viewLayout.hasPendingScrollAnimation():!1}saveViewState(){if(!this._modelData)return null;let e=this._contributions.saveViewState(),t=this._modelData.viewModel.saveCursorState(),o=this._modelData.viewModel.saveState();return{cursorState:t,viewState:o,contributionsState:e}}restoreViewState(e){if(!this._modelData||!this._modelData.hasRealView)return;let t=e;if(t&&t.cursorState&&t.viewState){let o=t.cursorState;Array.isArray(o)?o.length>0&&this._modelData.viewModel.restoreCursorState(o):this._modelData.viewModel.restoreCursorState([o]),this._contributions.restoreViewState(t.contributionsState||{});let n=this._modelData.viewModel.reduceRestoreState(t.viewState);this._modelData.view.restoreState(n)}}handleInitialized(){this._getViewModel()?.visibleLinesStabilized()}onVisible(){this._modelData?.view.refreshFocusState()}onHide(){this._modelData?.view.refreshFocusState()}getContribution(e){return this._contributions.get(e)}getActions(){return Array.from(this._actions.values())}getSupportedActions(){let e=this.getActions();return e=e.filter(t=>t.isSupported()),e}getAction(e){return this._actions.get(e)||null}trigger(e,t,o){o=o||{};try{switch(this._onWillTriggerEditorOperationEvent.fire({source:e,handlerId:t,payload:o}),this._beginUpdate(),t){case"compositionStart":this._startComposition();return;case"compositionEnd":this._endComposition(e);return;case"type":{let r=o;this._type(e,r.text||"");return}case"replacePreviousChar":{let r=o;this._compositionType(e,r.text||"",r.replaceCharCnt||0,0,0);return}case"compositionType":{let r=o;this._compositionType(e,r.text||"",r.replacePrevCharCnt||0,r.replaceNextCharCnt||0,r.positionDelta||0);return}case"paste":{let r=o;this._paste(e,r.text||"",r.pasteOnNewLine||!1,r.multicursorText||null,r.mode||null,r.clipboardEvent);return}case"cut":this._cut(e);return}let n=this.getAction(t);if(n){Promise.resolve(n.run(o)).then(void 0,mt);return}if(!this._modelData||this._triggerEditorCommand(e,t,o))return;this._triggerCommand(t,o)}finally{this._endUpdate()}}_triggerCommand(e,t){this._commandService.executeCommand(e,t)}_startComposition(){this._modelData&&(this.inComposition=!0,this._modelData.viewModel.startComposition(),this._onDidCompositionStart.fire())}_endComposition(e){this._modelData&&(this.inComposition=!1,this._modelData.viewModel.endComposition(e),this._onDidCompositionEnd.fire())}_type(e,t){!this._modelData||t.length===0||(e==="keyboard"&&this._onWillType.fire(t),this._modelData.viewModel.type(t,e),e==="keyboard"&&this._onDidType.fire(t))}_compositionType(e,t,o,n,r){this._modelData&&this._modelData.viewModel.compositionType(t,o,n,r,e)}_paste(e,t,o,n,r,s){if(!this._modelData)return;let l=this._modelData.viewModel,c=l.getSelection().getStartPosition();l.paste(t,o,n,e);let u=l.getSelection().getStartPosition();e==="keyboard"&&this._onDidPaste.fire({clipboardEvent:s,range:new z(c.lineNumber,c.column,u.lineNumber,u.column),languageId:r})}_cut(e){this._modelData&&this._modelData.viewModel.cut(e)}_triggerEditorCommand(e,t,o){let n=aa.getEditorCommand(t);return n?(o=o||{},yi(o)&&(o.source=e),this._instantiationService.invokeFunction(r=>{Promise.resolve(n.runEditorCommand(r,this,o)).then(void 0,mt)}),!0):!1}_getViewModel(){return this._modelData?this._modelData.viewModel:null}pushUndoStop(){return!this._modelData||this._configuration.options.get(104)?!1:(this._modelData.model.pushStackElement(),!0)}popUndoStop(){return!this._modelData||this._configuration.options.get(104)?!1:(this._modelData.model.popStackElement(),!0)}edit(e,t){return this.executeEdits(t,e.replacements.map(o=>({range:o.range,text:o.text})),void 0)}executeEdits(e,t,o){if(!this._modelData||this._configuration.options.get(104))return!1;let n;o?Array.isArray(o)?n=()=>o:n=o:n=()=>null;let r,s;return e instanceof fqe?(s=e,r=e.metadata.source):(s=_c.unknown({name:e}),r=e),this._onBeforeExecuteEdit.fire({source:r??void 0}),this._modelData.viewModel.executeEdits(r,t,n,s),!0}executeCommand(e,t){this._modelData&&this._modelData.viewModel.executeCommand(t,e)}executeCommands(e,t){this._modelData&&this._modelData.viewModel.executeCommands(t,e)}createDecorationsCollection(e){return new Oei(this,e)}changeDecorations(e){return this._modelData?this._modelData.model.changeDecorations(e,this._id):null}getLineDecorations(e){if(!this._modelData)return null;let t=this._configuration.options;return this._modelData.model.getLineDecorations(e,this._id,Qre(t),Yre(t))}getDecorationsInRange(e){if(!this._modelData)return null;let t=this._configuration.options;return this._modelData.model.getDecorationsInRange(e,this._id,Qre(t),Yre(t))}getFontSizeAtPosition(e){return this._modelData?this._modelData.viewModel.getFontSizeAtPosition(e):null}deltaDecorations(e,t){return this._modelData?e.length===0&&t.length===0?e:this._modelData.model.deltaDecorations(e,t,this._id):[]}removeDecorations(e){!this._modelData||e.length===0||this._modelData.model.changeDecorations(t=>{t.deltaDecorations(e,[])})}setDecorationsByType(e,t,o){let n={},r=this._decorationTypeSubtypes[t]||{};this._decorationTypeSubtypes[t]=n;let s=[];for(let c of o){let u=t;if(c.renderOptions){let h=Ir(c.renderOptions).toString(16);u=t+"-"+h,!r[h]&&!n[h]&&this._registerDecorationType(e,u,c.renderOptions,t),n[h]=!0}let p=this._resolveDecorationOptions(u,!!c.hoverMessage);c.hoverMessage&&(p.hoverMessage=c.hoverMessage),s.push({range:c.range,options:p})}for(let c in r)n[c]||this._removeDecorationType(t+"-"+c);let l=this._decorationTypeKeysToIds[t]||[];return this.changeDecorations(c=>this._decorationTypeKeysToIds[t]=c.deltaDecorations(l,s)),this._decorationTypeKeysToIds[t]||[]}setDecorationsByTypeFast(e,t){let o=this._decorationTypeSubtypes[e]||{};for(let l in o)this._removeDecorationType(e+"-"+l);this._decorationTypeSubtypes[e]={};let n=po.createDynamic(this._resolveDecorationOptions(e,!1)),r=new Array(t.length);for(let l=0,c=t.length;l<c;l++)r[l]={range:t[l],options:n};let s=this._decorationTypeKeysToIds[e]||[];this.changeDecorations(l=>this._decorationTypeKeysToIds[e]=l.deltaDecorations(s,r))}removeDecorationsByType(e){let t=this._decorationTypeKeysToIds[e];if(t&&this.changeDecorations(o=>o.deltaDecorations(t,[])),this._decorationTypeKeysToIds.hasOwnProperty(e)&&delete this._decorationTypeKeysToIds[e],this._decorationTypeSubtypes.hasOwnProperty(e)){let o=this._decorationTypeSubtypes[e];for(let n of Object.keys(o))this._removeDecorationType(e+"-"+n);delete this._decorationTypeSubtypes[e]}}getLayoutInfo(){return this._configuration.options.get(165)}createOverviewRuler(e){return!this._modelData||!this._modelData.hasRealView?null:this._modelData.view.createOverviewRuler(e)}getContainerDomNode(){return this._domElement}getDomNode(){return!this._modelData||!this._modelData.hasRealView?null:this._modelData.view.domNode.domNode}delegateVerticalScrollbarPointerDown(e){!this._modelData||!this._modelData.hasRealView||this._modelData.view.delegateVerticalScrollbarPointerDown(e)}delegateScrollFromMouseWheelEvent(e){!this._modelData||!this._modelData.hasRealView||this._modelData.view.delegateScrollFromMouseWheelEvent(e)}layout(e,t=!1){this._configuration.observeContainer(e),t||this.render()}focus(){!this._modelData||!this._modelData.hasRealView||this._modelData.view.focus()}hasTextFocus(){return!this._modelData||!this._modelData.hasRealView?!1:this._modelData.view.isFocused()}hasWidgetFocus(){return!this._modelData||!this._modelData.hasRealView?!1:this._modelData.view.isWidgetFocused()}addContentWidget(e){let t={widget:e,position:e.getPosition()};this._contentWidgets.hasOwnProperty(e.getId())&&console.warn("Overwriting a content widget with the same id:"+e.getId()),this._contentWidgets[e.getId()]=t,this._modelData&&this._modelData.hasRealView&&this._modelData.view.addContentWidget(t)}layoutContentWidget(e){let t=e.getId();if(this._contentWidgets.hasOwnProperty(t)){let o=this._contentWidgets[t];o.position=e.getPosition(),this._modelData&&this._modelData.hasRealView&&this._modelData.view.layoutContentWidget(o)}}removeContentWidget(e){let t=e.getId();if(this._contentWidgets.hasOwnProperty(t)){let o=this._contentWidgets[t];delete this._contentWidgets[t],this._modelData&&this._modelData.hasRealView&&this._modelData.view.removeContentWidget(o)}}addOverlayWidget(e){let t={widget:e,position:e.getPosition()};this._overlayWidgets.hasOwnProperty(e.getId())&&console.warn("Overwriting an overlay widget with the same id."),this._overlayWidgets[e.getId()]=t,this._modelData&&this._modelData.hasRealView&&this._modelData.view.addOverlayWidget(t)}layoutOverlayWidget(e){let t=e.getId();if(this._overlayWidgets.hasOwnProperty(t)){let o=this._overlayWidgets[t];o.position=e.getPosition(),this._modelData&&this._modelData.hasRealView&&this._modelData.view.layoutOverlayWidget(o)}}removeOverlayWidget(e){let t=e.getId();if(this._overlayWidgets.hasOwnProperty(t)){let o=this._overlayWidgets[t];delete this._overlayWidgets[t],this._modelData&&this._modelData.hasRealView&&this._modelData.view.removeOverlayWidget(o)}}addGlyphMarginWidget(e){let t={widget:e,position:e.getPosition()};this._glyphMarginWidgets.hasOwnProperty(e.getId())&&console.warn("Overwriting a glyph margin widget with the same id."),this._glyphMarginWidgets[e.getId()]=t,this._modelData&&this._modelData.hasRealView&&this._modelData.view.addGlyphMarginWidget(t)}layoutGlyphMarginWidget(e){let t=e.getId();if(this._glyphMarginWidgets.hasOwnProperty(t)){let o=this._glyphMarginWidgets[t];o.position=e.getPosition(),this._modelData&&this._modelData.hasRealView&&this._modelData.view.layoutGlyphMarginWidget(o)}}removeGlyphMarginWidget(e){let t=e.getId();if(this._glyphMarginWidgets.hasOwnProperty(t)){let o=this._glyphMarginWidgets[t];delete this._glyphMarginWidgets[t],this._modelData&&this._modelData.hasRealView&&this._modelData.view.removeGlyphMarginWidget(o)}}changeViewZones(e){!this._modelData||!this._modelData.hasRealView||this._modelData.view.change(e)}getTargetAtClientPoint(e,t){return!this._modelData||!this._modelData.hasRealView?null:this._modelData.view.getTargetAtClientPoint(e,t)}getScrolledVisiblePosition(e){if(!this._modelData||!this._modelData.hasRealView)return null;let t=this._modelData.model.validatePosition(e),n=this._configuration.options.get(165),r=jr._getVerticalOffsetForPosition(this._modelData,t.lineNumber,t.column)-this.getScrollTop(),s=this._modelData.view.getOffsetForColumn(t.lineNumber,t.column)+n.glyphMarginWidth+n.lineNumbersWidth+n.decorationsWidth-this.getScrollLeft(),l=this.getLineHeightForPosition(t);return{top:r,left:s,height:l}}getOffsetForColumn(e,t){return!this._modelData||!this._modelData.hasRealView?-1:this._modelData.view.getOffsetForColumn(e,t)}getWidthOfLine(e){return!this._modelData||!this._modelData.hasRealView?-1:this._modelData.view.getLineWidth(e)}resetLineWidthCaches(){!this._modelData||!this._modelData.hasRealView||this._modelData.view.resetLineWidthCaches()}render(e=!1){!this._modelData||!this._modelData.hasRealView||this._modelData.viewModel.batchEvents(()=>{this._modelData.view.render(!0,e)})}renderAsync(e=!1){!this._modelData||!this._modelData.hasRealView||this._modelData.viewModel.batchEvents(()=>{this._modelData.view.render(!1,e)})}setAriaOptions(e){!this._modelData||!this._modelData.hasRealView||this._modelData.view.setAriaOptions(e)}applyFontInfo(e){Pd(e,this._configuration.options.get(59))}setBanner(e,t){this._bannerDomNode&&this._domElement.contains(this._bannerDomNode)&&this._bannerDomNode.remove(),this._bannerDomNode=e,this._configuration.setReservedHeight(e?t:0),this._bannerDomNode&&this._domElement.prepend(this._bannerDomNode)}_attachModel(e){if(!e){this._modelData=null;return}let t=[];this._domElement.setAttribute("data-mode-id",e.getLanguageId()),this._configuration.setIsDominatedByLongLines(e.isDominatedByLongLines()),this._configuration.setModelLineCount(e.getLineCount());let o=e.onBeforeAttached(),n=new Vbt(this._id,this._configuration,e,Tvt.create(Me(this._domElement)),abt.create(this._configuration.options),l=>$r(Me(this._domElement),l),this.languageConfigurationService,this._themeService,o,{batchChanges:l=>{try{return this._beginUpdate(),l()}finally{this._endUpdate()}}});t.push(e.onWillDispose(()=>this.setModel(null))),t.push(n.onEvent(l=>{switch(l.kind){case 0:this._onDidContentSizeChange.fire(l);break;case 1:this._editorTextFocus.setValue(l.hasFocus);break;case 2:this._editorWidgetFocus.setValue(l.hasFocus);break;case 3:this._onDidScrollChange.fire(l);break;case 4:this._onDidChangeViewZones.fire();break;case 5:this._onDidChangeHiddenAreas.fire();break;case 6:this._onDidAttemptReadOnlyEdit.fire();break;case 7:{if(l.reachedMaxCursorCount){let h=this.getOption(89),g=d(194,null,h);this._notificationService.prompt(St.Warning,g,[{label:"Find and Replace",run:()=>{this._commandService.executeCommand("editor.action.startFindReplaceAction")}},{label:d(195,null),run:()=>{this._commandService.executeCommand("workbench.action.openSettings2",{query:"editor.multiCursorLimit"})}}])}let c=[];for(let h=0,g=l.selections.length;h<g;h++)c[h]=l.selections[h].getPosition();let u={position:c[0],secondaryPositions:c.slice(1),reason:l.reason,source:l.source};this._onDidChangeCursorPosition.fire(u);let p={selection:l.selections[0],secondarySelections:l.selections.slice(1),modelVersionId:l.modelVersionId,oldSelections:l.oldSelections,oldModelVersionId:l.oldModelVersionId,source:l.source,reason:l.reason};this._onDidChangeCursorSelection.fire(p);break}case 8:this._onDidChangeModelDecorations.fire(l.event);break;case 9:this._domElement.setAttribute("data-mode-id",e.getLanguageId()),this._onDidChangeModelLanguage.fire(l.event);break;case 10:this._onDidChangeModelLanguageConfiguration.fire(l.event);break;case 11:this._onDidChangeModelContent.fire(l.event);break;case 12:this._onDidChangeModelOptions.fire(l.event);break;case 13:this._onDidChangeModelTokens.fire(l.event);break;case 14:this._onDidChangeLineHeight.fire(l.event);break;case 15:this._onDidChangeFont.fire(l.event);break}}));let[r,s]=this._createView(n);if(s){this._domElement.appendChild(r.domNode.domNode);let l=Object.keys(this._contentWidgets);for(let c=0,u=l.length;c<u;c++){let p=l[c];r.addContentWidget(this._contentWidgets[p])}l=Object.keys(this._overlayWidgets);for(let c=0,u=l.length;c<u;c++){let p=l[c];r.addOverlayWidget(this._overlayWidgets[p])}l=Object.keys(this._glyphMarginWidgets);for(let c=0,u=l.length;c<u;c++){let p=l[c];r.addGlyphMarginWidget(this._glyphMarginWidgets[p])}r.render(!1,!0),r.domNode.domNode.setAttribute("data-uri",e.uri.toString()),t.push(r.onWillCopy(c=>this._onWillCopy.fire(c))),t.push(r.onWillCut(c=>this._onWillCut.fire(c))),t.push(r.onWillPaste(c=>this._onWillPaste.fire(c)))}this._modelData=new Pei(e,n,r,s,t,o)}_createView(e){let t;this.isSimpleWidget?t={paste:(r,s,l,c)=>{this._paste("keyboard",r,s,l,c)},type:r=>{this._type("keyboard",r)},compositionType:(r,s,l,c)=>{this._compositionType("keyboard",r,s,l,c)},startComposition:()=>{this._startComposition()},endComposition:()=>{this._endComposition("keyboard")},cut:()=>{this._cut("keyboard")}}:t={paste:(r,s,l,c)=>{let u={text:r,pasteOnNewLine:s,multicursorText:l,mode:c};this._commandService.executeCommand("paste",u)},type:r=>{let s={text:r};this._commandService.executeCommand("type",s)},compositionType:(r,s,l,c)=>{if(l||c){let u={text:r,replacePrevCharCnt:s,replaceNextCharCnt:l,positionDelta:c};this._commandService.executeCommand("compositionType",u)}else{let u={text:r,replaceCharCnt:s};this._commandService.executeCommand("replacePreviousChar",u)}},startComposition:()=>{this._commandService.executeCommand("compositionStart",{})},endComposition:()=>{this._commandService.executeCommand("compositionEnd",{})},cut:()=>{this._commandService.executeCommand("cut",{})}};let o=new MIe(e.coordinatesConverter);return o.onKeyDown=r=>this._onKeyDown.fire(r),o.onKeyUp=r=>this._onKeyUp.fire(r),o.onContextMenu=r=>this._onContextMenu.fire(r),o.onMouseMove=r=>this._onMouseMove.fire(r),o.onMouseLeave=r=>this._onMouseLeave.fire(r),o.onMouseDown=r=>this._onMouseDown.fire(r),o.onMouseUp=r=>this._onMouseUp.fire(r),o.onMouseDrag=r=>this._onMouseDrag.fire(r),o.onMouseDrop=r=>this._onMouseDrop.fire(r),o.onMouseDropCanceled=r=>this._onMouseDropCanceled.fire(r),o.onMouseWheel=r=>this._onMouseWheel.fire(r),[new tye(this._domElement,this.getId(),t,this._configuration,this._themeService.getColorTheme(),e,o,this._overflowWidgetsDomNode,this._instantiationService,this._userInteractionService),!0]}_postDetachModelCleanup(e){e?.removeAllDecorationsWithOwnerId(this._id)}_detachModel(){if(this._contributionsDisposable?.dispose(),this._contributionsDisposable=void 0,!this._modelData)return null;let e=this._modelData.model,t=this._modelData.hasRealView?this._modelData.view.domNode.domNode:null;return this._modelData.dispose(),this._modelData=null,this._domElement.removeAttribute("data-mode-id"),t&&this._domElement.contains(t)&&t.remove(),this._bannerDomNode&&this._domElement.contains(this._bannerDomNode)&&this._bannerDomNode.remove(),e}_registerDecorationType(e,t,o,n){this._codeEditorService.registerDecorationType(e,t,o,n,this)}_removeDecorationType(e){this._codeEditorService.removeDecorationType(e)}_resolveDecorationOptions(e,t){return this._codeEditorService.resolveDecorationOptions(e,t)}getTelemetryData(){return this._telemetryData}hasModel(){return this._modelData!==null}showDropIndicatorAt(e){let t=[{range:new z(e.lineNumber,e.column,e.lineNumber,e.column),options:jr.dropIntoEditorDecorationOptions}];this._dropIntoEditorDecorations.set(t),this.revealPosition(e,1)}removeDropIndicator(){this._dropIntoEditorDecorations.clear()}setContextValue(e,t){this._contextKeyService.createKey(e,t)}_beginUpdate(){this._updateCounter++,this._updateCounter===1&&this._onBeginUpdate.fire()}_endUpdate(){this._updateCounter--,this._updateCounter===0&&this._onEndUpdate.fire()}};jr=I([m(3,F),m(4,Kt),m(5,ge),m(6,X),m(7,De),m(8,Ne),m(9,Bi),m(10,bs),m(11,zt),m(12,eC)],jr);var gNo=0,Pei=class{constructor(i,e,t,o,n,r){this.model=i;this.viewModel=e;this.view=t;this.hasRealView=o;this.listenersToRemove=n;this.attachedView=r}dispose(){Ue(this.listenersToRemove),this.model.onBeforeDetached(this.attachedView),this.hasRealView&&this.view.dispose(),this.viewModel.dispose()}};var Hbt=class extends C{constructor(e){super();this._emitterOptions=e;this._onDidChangeToTrue=this._register(new E(this._emitterOptions)),this.onDidChangeToTrue=this._onDidChangeToTrue.event,this._onDidChangeToFalse=this._register(new E(this._emitterOptions)),this.onDidChangeToFalse=this._onDidChangeToFalse.event,this._value=0}setValue(e){let t=e?2:1;this._value!==t&&(this._value=t,this._value===2?this._onDidChangeToTrue.fire():this._value===1&&this._onDidChangeToFalse.fire())}},ob=class extends E{constructor(e,t){super({deliveryQueue:t});this._contributions=e}fire(e){this._contributions.onBeforeInteractionEvent(),super.fire(e)}},Aei=class extends C{constructor(i,e){super(),this._editor=i,e.createKey("editorId",i.getId()),this._editorSimpleInput=ue.editorSimpleInput.bindTo(e),this._editorFocus=ue.focus.bindTo(e),this._textInputFocus=ue.textInputFocus.bindTo(e),this._editorTextFocus=ue.editorTextFocus.bindTo(e),this._tabMovesFocus=ue.tabMovesFocus.bindTo(e),this._editorReadonly=ue.readOnly.bindTo(e),this._inDiffEditor=ue.inDiffEditor.bindTo(e),this._editorColumnSelection=ue.columnSelection.bindTo(e),this._hasMultipleSelections=ue.hasMultipleSelections.bindTo(e),this._hasNonEmptySelection=ue.hasNonEmptySelection.bindTo(e),this._canUndo=ue.canUndo.bindTo(e),this._canRedo=ue.canRedo.bindTo(e),this._register(this._editor.onDidChangeConfiguration(()=>this._updateFromConfig())),this._register(this._editor.onDidChangeCursorSelection(()=>this._updateFromSelection())),this._register(this._editor.onDidFocusEditorWidget(()=>this._updateFromFocus())),this._register(this._editor.onDidBlurEditorWidget(()=>this._updateFromFocus())),this._register(this._editor.onDidFocusEditorText(()=>this._updateFromFocus())),this._register(this._editor.onDidBlurEditorText(()=>this._updateFromFocus())),this._register(this._editor.onDidChangeModel(()=>this._updateFromModel())),this._register(this._editor.onDidChangeConfiguration(()=>this._updateFromModel())),this._register(GT.onDidChangeTabFocus(t=>this._tabMovesFocus.set(t))),this._updateFromConfig(),this._updateFromSelection(),this._updateFromFocus(),this._updateFromModel(),this._editorSimpleInput.set(this._editor.isSimpleWidget)}_updateFromConfig(){let i=this._editor.getOptions();this._tabMovesFocus.set(i.get(164)||GT.getTabFocusMode()),this._editorReadonly.set(i.get(104)),this._inDiffEditor.set(i.get(70)),this._editorColumnSelection.set(i.get(28))}_updateFromSelection(){let i=this._editor.getSelections();i?(this._hasMultipleSelections.set(i.length>1),this._hasNonEmptySelection.set(i.some(e=>!e.isEmpty()))):(this._hasMultipleSelections.reset(),this._hasNonEmptySelection.reset())}_updateFromFocus(){this._editorFocus.set(this._editor.hasWidgetFocus()&&!this._editor.isSimpleWidget),this._editorTextFocus.set(this._editor.hasTextFocus()&&!this._editor.isSimpleWidget),this._textInputFocus.set(this._editor.hasTextFocus())}_updateFromModel(){let i=this._editor.getModel();this._canUndo.set(!!(i&&i.canUndo())),this._canRedo.set(!!(i&&i.canRedo()))}},Nei=class extends C{constructor(e,t,o){super();this._editor=e;this._contextKeyService=t;this._languageFeaturesService=o;this._langId=ue.languageId.bindTo(t),this._hasCompletionItemProvider=ue.hasCompletionItemProvider.bindTo(t),this._hasCodeActionsProvider=ue.hasCodeActionsProvider.bindTo(t),this._hasCodeLensProvider=ue.hasCodeLensProvider.bindTo(t),this._hasDefinitionProvider=ue.hasDefinitionProvider.bindTo(t),this._hasDeclarationProvider=ue.hasDeclarationProvider.bindTo(t),this._hasImplementationProvider=ue.hasImplementationProvider.bindTo(t),this._hasTypeDefinitionProvider=ue.hasTypeDefinitionProvider.bindTo(t),this._hasHoverProvider=ue.hasHoverProvider.bindTo(t),this._hasDocumentHighlightProvider=ue.hasDocumentHighlightProvider.bindTo(t),this._hasDocumentSymbolProvider=ue.hasDocumentSymbolProvider.bindTo(t),this._hasReferenceProvider=ue.hasReferenceProvider.bindTo(t),this._hasRenameProvider=ue.hasRenameProvider.bindTo(t),this._hasSignatureHelpProvider=ue.hasSignatureHelpProvider.bindTo(t),this._hasInlayHintsProvider=ue.hasInlayHintsProvider.bindTo(t),this._hasDocumentFormattingProvider=ue.hasDocumentFormattingProvider.bindTo(t),this._hasDocumentSelectionFormattingProvider=ue.hasDocumentSelectionFormattingProvider.bindTo(t),this._hasMultipleDocumentFormattingProvider=ue.hasMultipleDocumentFormattingProvider.bindTo(t),this._hasMultipleDocumentSelectionFormattingProvider=ue.hasMultipleDocumentSelectionFormattingProvider.bindTo(t),this._isInEmbeddedEditor=ue.isInEmbeddedEditor.bindTo(t);let n=()=>this._update();this._register(e.onDidChangeModel(n)),this._register(e.onDidChangeModelLanguage(n)),this._register(o.completionProvider.onDidChange(n)),this._register(o.codeActionProvider.onDidChange(n)),this._register(o.codeLensProvider.onDidChange(n)),this._register(o.definitionProvider.onDidChange(n)),this._register(o.declarationProvider.onDidChange(n)),this._register(o.implementationProvider.onDidChange(n)),this._register(o.typeDefinitionProvider.onDidChange(n)),this._register(o.hoverProvider.onDidChange(n)),this._register(o.documentHighlightProvider.onDidChange(n)),this._register(o.documentSymbolProvider.onDidChange(n)),this._register(o.referenceProvider.onDidChange(n)),this._register(o.renameProvider.onDidChange(n)),this._register(o.documentFormattingEditProvider.onDidChange(n)),this._register(o.documentRangeFormattingEditProvider.onDidChange(n)),this._register(o.signatureHelpProvider.onDidChange(n)),this._register(o.inlayHintsProvider.onDidChange(n)),n()}dispose(){super.dispose()}reset(){this._contextKeyService.bufferChangeEvents(()=>{this._langId.reset(),this._hasCompletionItemProvider.reset(),this._hasCodeActionsProvider.reset(),this._hasCodeLensProvider.reset(),this._hasDefinitionProvider.reset(),this._hasDeclarationProvider.reset(),this._hasImplementationProvider.reset(),this._hasTypeDefinitionProvider.reset(),this._hasHoverProvider.reset(),this._hasDocumentHighlightProvider.reset(),this._hasDocumentSymbolProvider.reset(),this._hasReferenceProvider.reset(),this._hasRenameProvider.reset(),this._hasDocumentFormattingProvider.reset(),this._hasDocumentSelectionFormattingProvider.reset(),this._hasSignatureHelpProvider.reset(),this._isInEmbeddedEditor.reset()})}_update(){let e=this._editor.getModel();if(!e){this.reset();return}this._contextKeyService.bufferChangeEvents(()=>{this._langId.set(e.getLanguageId()),this._hasCompletionItemProvider.set(this._languageFeaturesService.completionProvider.has(e)),this._hasCodeActionsProvider.set(this._languageFeaturesService.codeActionProvider.has(e)),this._hasCodeLensProvider.set(this._languageFeaturesService.codeLensProvider.has(e)),this._hasDefinitionProvider.set(this._languageFeaturesService.definitionProvider.has(e)),this._hasDeclarationProvider.set(this._languageFeaturesService.declarationProvider.has(e)),this._hasImplementationProvider.set(this._languageFeaturesService.implementationProvider.has(e)),this._hasTypeDefinitionProvider.set(this._languageFeaturesService.typeDefinitionProvider.has(e)),this._hasHoverProvider.set(this._languageFeaturesService.hoverProvider.has(e)),this._hasDocumentHighlightProvider.set(this._languageFeaturesService.documentHighlightProvider.has(e)),this._hasDocumentSymbolProvider.set(this._languageFeaturesService.documentSymbolProvider.has(e)),this._hasReferenceProvider.set(this._languageFeaturesService.referenceProvider.has(e)),this._hasRenameProvider.set(this._languageFeaturesService.renameProvider.has(e)),this._hasSignatureHelpProvider.set(this._languageFeaturesService.signatureHelpProvider.has(e)),this._hasInlayHintsProvider.set(this._languageFeaturesService.inlayHintsProvider.has(e)),this._hasDocumentFormattingProvider.set(this._languageFeaturesService.documentFormattingEditProvider.has(e)||this._languageFeaturesService.documentRangeFormattingEditProvider.has(e)),this._hasDocumentSelectionFormattingProvider.set(this._languageFeaturesService.documentRangeFormattingEditProvider.has(e)),this._hasMultipleDocumentFormattingProvider.set(this._languageFeaturesService.documentFormattingEditProvider.all(e).length+this._languageFeaturesService.documentRangeFormattingEditProvider.all(e).length>1),this._hasMultipleDocumentSelectionFormattingProvider.set(this._languageFeaturesService.documentRangeFormattingEditProvider.all(e).length>1),this._isInEmbeddedEditor.set(e.uri.scheme===Y.walkThroughSnippet||e.uri.scheme===Y.vscodeChatCodeBlock)})}},Oei=class{constructor(i,e){this._editor=i;this._decorationIds=[];this._isChangingDecorations=!1;Array.isArray(e)&&e.length>0&&this.set(e)}get length(){return this._decorationIds.length}onDidChange(i,e,t){return this._editor.onDidChangeModelDecorations(o=>{this._isChangingDecorations||i.call(e,o)},t)}getRange(i){return!this._editor.hasModel()||i>=this._decorationIds.length?null:this._editor.getModel().getDecorationRange(this._decorationIds[i])}getRanges(){if(!this._editor.hasModel())return[];let i=this._editor.getModel(),e=[];for(let t of this._decorationIds){let o=i.getDecorationRange(t);o&&e.push(o)}return e}has(i){return this._decorationIds.includes(i.id)}clear(){this._decorationIds.length!==0&&this.set([])}set(i){try{this._isChangingDecorations=!0,this._editor.changeDecorations(e=>{this._decorationIds=e.deltaDecorations(this._decorationIds,i)})}finally{this._isChangingDecorations=!1}return this._decorationIds}append(i){let e=[];try{this._isChangingDecorations=!0,this._editor.changeDecorations(t=>{e=t.deltaDecorations([],i),this._decorationIds=this._decorationIds.concat(e)})}finally{this._isChangingDecorations=!1}return e}},fNo=encodeURIComponent("<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 6 3' enable-background='new 0 0 6 3' height='3' width='6'><g fill='"),vNo=encodeURIComponent("'><polygon points='5.5,0 2.5,3 1.1,3 4.1,0'/><polygon points='4,0 6,2 6,0.6 5.4,0'/><polygon points='0,2 1,3 2.4,3 0,0.6'/></g></svg>");function Cye(a){return fNo+encodeURIComponent(a.toString())+vNo}var bNo=encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" height="3" width="12"><g fill="'),SNo=encodeURIComponent('"><circle cx="1" cy="1" r="1"/><circle cx="5" cy="1" r="1"/><circle cx="9" cy="1" r="1"/></g></svg>');function Lji(a){return bNo+encodeURIComponent(a.toString())+SNo}is((a,i)=>{let e=a.getColor(av);e&&(i.addRule(`.monaco-editor .squiggly-error { background: url("data:image/svg+xml,${Cye(e)}") repeat-x bottom left; }`),i.addRule(`:root { --monaco-editor-error-decoration: url("data:image/svg+xml,${Cye(e)}"); }`));let t=a.getColor(Bh);t&&(i.addRule(`.monaco-editor .squiggly-warning { background: url("data:image/svg+xml,${Cye(t)}") repeat-x bottom left; }`),i.addRule(`:root { --monaco-editor-warning-decoration: url("data:image/svg+xml,${Cye(t)}"); }`));let o=a.getColor(fm);o&&(i.addRule(`.monaco-editor .squiggly-info { background: url("data:image/svg+xml,${Cye(o)}") repeat-x bottom left; }`),i.addRule(`:root { --monaco-editor-info-decoration: url("data:image/svg+xml,${Cye(o)}"); }`));let n=a.getColor(iGi);n&&(i.addRule(`.monaco-editor .squiggly-hint { background: url("data:image/svg+xml,${Lji(n)}") no-repeat bottom left; }`),i.addRule(`:root { --monaco-editor-hint-decoration: url("data:image/svg+xml,${Lji(n)}"); }`));let r=a.getColor(pqi);r&&(i.addRule(`.monaco-editor.showUnused .squiggly-inline-unnecessary { opacity: ${r.rgba.a}; }`),i.addRule(`:root { --monaco-editor-unnecessary-decoration-opacity: ${r.rgba.a}; }`))});var INo=!1;function rE(){return INo}function Fei(a){if(rE()){let i=yNo();return i.add(a),{dispose(){i.delete(a)}}}else return{dispose(){}}}function yNo(){Ubt||(Ubt=new Set);let a=globalThis;return a.$hotReload_applyNewExports||(a.$hotReload_applyNewExports=i=>{let e={config:{mode:void 0},...i},t=[];for(let o of Ubt){let n=o(e);n&&t.push(n)}if(t.length>0)return o=>{let n=!1;for(let r of t)r(o)&&(n=!0);return n}}),Ubt}var Ubt;rE()&&Fei(({oldExports:a,newSrc:i,config:e})=>{if(e.mode==="patch-prototype")return t=>{for(let o in t){let n=t[o];if(console.log(`[hot-reload] Patching prototype methods of '${o}'`,{exportedItem:n}),typeof n=="function"&&n.prototype){let r=a[o];if(r){for(let s of Object.getOwnPropertyNames(n.prototype)){let l=Object.getOwnPropertyDescriptor(n.prototype,s),c=Object.getOwnPropertyDescriptor(r.prototype,s);l?.value?.toString()!==c?.value?.toString()&&console.log(`[hot-reload] Patching prototype method '${o}.${s}'`),Object.defineProperty(r.prototype,s,l)}t[o]=r}}}return!0}});function Cx(a,i){return wNo([a],i),a}function wNo(a,i){rE()&&Nr("reload",t=>Fei(({oldExports:o})=>{if([...Object.values(o)].some(n=>a.includes(n)))return n=>(t(void 0),!0)})).read(i)}var Rji=new Map;function s1(a){if(!rE())return Oo(a);let i=a.name,e=Rji.get(i);return e?setTimeout(()=>{e.set(a,void 0)},0):(e=Le(i,a),Rji.set(i,e)),e}function pr(a,i,e,t=Il.ofCaller()){return ff({debugName:()=>`Configuration Key "${a}"`},o=>e.onDidChangeConfiguration(n=>{n.affectsConfiguration(a)&&o(n)}),()=>e.getValue(a)??i,t)}function tc(a,i,e,t=Il.ofCaller()){let o=a.bindTo(i),n=new P;return hs({debugName:()=>`Set Context Key "${a.key}"`},r=>{let s=e(r);return o.set(s),s},t).recomputeInitiallyAndOnChange(n),n}function Mji(a,i,e=Il.ofCaller()){return ui(void 0,i.onDidChangeContext,()=>i.getContextKeyValue(a),e)}var tr=ae("accessibilitySignalService"),Aji=Symbol("AcknowledgeDocCommentsToken"),xye=class extends C{constructor(e,t,o){super();this.configurationService=e;this.accessibilityService=t;this.telemetryService=o;this.sounds=new Map,this.screenReaderAttached=ui(this,this.accessibilityService.onDidChangeScreenReaderOptimized,()=>this.accessibilityService.isScreenReaderOptimized()),this.sentTelemetry=new Set,this.playingSounds=new Set,this._signalConfigValue=new kI(n=>pr(n.settingsKey,{sound:"off",announcement:"off"},this.configurationService)),this._signalEnabledState=new kI({getCacheKey:J1i},n=>Ce(r=>{let s=this._signalConfigValue.get(n.signal).read(r);return!!((n.modality==="sound"||n.modality===void 0)&&(n.signal.managesOwnEnablement||Pji(s.sound,()=>this.screenReaderAttached.read(r),n.userGesture))||(n.modality==="announcement"||n.modality===void 0)&&Pji(s.announcement,()=>this.screenReaderAttached.read(r),n.userGesture))}).recomputeInitiallyAndOnChange(this._store))}getEnabledState(e,t,o){return new pN(this._signalEnabledState.get({signal:e,userGesture:t,modality:o}))}async playSignal(e,t={}){let o=t.modality==="announcement"||t.modality===void 0,n=t.customAlertMessage??e.announcementMessage;o&&this.isAnnouncementEnabled(e,t.userGesture)&&n&&this.accessibilityService.status(n),(t.modality==="sound"||t.modality===void 0)&&this.isSoundEnabled(e,t.userGesture)&&(this.sendSignalTelemetry(e,t.source),await this.playSound(e.sound.getSound(),t.allowManyInParallel))}async playSignals(e){for(let r of e)this.sendSignalTelemetry("signal"in r?r.signal:r,"source"in r?r.source:void 0);let t=e.map(r=>"signal"in r?r.signal:r),o=t.filter(r=>this.isAnnouncementEnabled(r)).map(r=>r.announcementMessage);o.length&&this.accessibilityService.status(o.join(", "));let n=new Set(t.filter(r=>this.isSoundEnabled(r)).map(r=>r.sound.getSound()));await Promise.all(Array.from(n).map(r=>this.playSound(r,!0)))}sendSignalTelemetry(e,t){let o=this.accessibilityService.isScreenReaderOptimized(),n=e.name+(t?`::${t}`:"")+(o?"{screenReaderOptimized}":"");this.sentTelemetry.has(n)||this.getVolumeInPercent()===0||(this.sentTelemetry.add(n),this.telemetryService.publicLog2("signal.played",{signal:e.name,source:t??"",isScreenReaderOptimized:o}))}getVolumeInPercent(){let e=this.configurationService.getValue("accessibility.signalOptions.volume");return typeof e!="number"?50:Math.max(Math.min(e,100),0)}async playSound(e,t=!1){if(!t&&this.playingSounds.has(e))return;this.playingSounds.add(e);let o=gn.asBrowserUri(`vs/platform/accessibilitySignal/browser/media/${e.fileName}`).toString(!0);try{let n=this.sounds.get(o);if(n)n.volume=this.getVolumeInPercent()/100,n.currentTime=0,await n.play();else{let r=await CNo(o,this.getVolumeInPercent()/100);this.sounds.set(o,r)}}catch(n){n.message.includes("play() can only be initiated by a user gesture")||console.error("Error while playing sound",n)}finally{this.playingSounds.delete(e)}}playSignalLoop(e,t){let o=!0,n=()=>{o&&this.playSignal(e,{allowManyInParallel:!0}).finally(()=>{setTimeout(()=>{o&&n()},t)})};return n(),Z(()=>o=!1)}isAnnouncementEnabled(e,t){return e.announcementMessage?this._signalEnabledState.get({signal:e,userGesture:!!t,modality:"announcement"}).get():!1}isSoundEnabled(e,t){return this._signalEnabledState.get({signal:e,userGesture:!!t,modality:"sound"}).get()}onSoundEnabledChanged(e){return this.getEnabledState(e,!1).onDidChange}getDelayMs(e,t,o){if(!this.configurationService.getValue("accessibility.signalOptions.debouncePositionChanges"))return 0;let n;return e.name===$o.errorAtPosition.name&&o==="positional"?n=this.configurationService.getValue("accessibility.signalOptions.experimental.delays.errorAtPosition"):e.name===$o.warningAtPosition.name&&o==="positional"?n=this.configurationService.getValue("accessibility.signalOptions.experimental.delays.warningAtPosition"):n=this.configurationService.getValue("accessibility.signalOptions.experimental.delays.general"),t==="sound"?n.sound:n.announcement}};xye=I([m(0,B),m(1,Bi),m(2,Te)],xye);function Pji(a,i,e){return a==="on"||a==="always"||a==="auto"&&i()||a==="userGesture"&&e}async function CNo(a,i){let e=new P;try{return await xNo(a,i,e)}finally{e.dispose()}}function xNo(a,i,e){return new Promise((t,o)=>{let n=new Audio(a);n.volume=i,e.add(j(n,"ended",()=>{t(n)})),e.add(j(n,"error",r=>{o(r.error)})),n.play().catch(r=>{o(r)})})}var nd=class a{constructor(i){this.fileName=i}static register(i){return new a(i.fileName)}static{this.error=a.register({fileName:"error.mp3"})}static{this.warning=a.register({fileName:"warning.mp3"})}static{this.success=a.register({fileName:"success.mp3"})}static{this.foldedArea=a.register({fileName:"foldedAreas.mp3"})}static{this.break=a.register({fileName:"break.mp3"})}static{this.quickFixes=a.register({fileName:"quickFixes.mp3"})}static{this.taskCompleted=a.register({fileName:"taskCompleted.mp3"})}static{this.taskFailed=a.register({fileName:"taskFailed.mp3"})}static{this.terminalBell=a.register({fileName:"terminalBell.mp3"})}static{this.diffLineInserted=a.register({fileName:"diffLineInserted.mp3"})}static{this.diffLineDeleted=a.register({fileName:"diffLineDeleted.mp3"})}static{this.diffLineModified=a.register({fileName:"diffLineModified.mp3"})}static{this.requestSent=a.register({fileName:"requestSent.mp3"})}static{this.responseReceived1=a.register({fileName:"responseReceived1.mp3"})}static{this.responseReceived2=a.register({fileName:"responseReceived2.mp3"})}static{this.responseReceived3=a.register({fileName:"responseReceived3.mp3"})}static{this.responseReceived4=a.register({fileName:"responseReceived4.mp3"})}static{this.clear=a.register({fileName:"clear.mp3"})}static{this.save=a.register({fileName:"save.mp3"})}static{this.format=a.register({fileName:"format.mp3"})}static{this.voiceRecordingStarted=a.register({fileName:"voiceRecordingStarted.mp3"})}static{this.voiceRecordingStopped=a.register({fileName:"voiceRecordingStopped.mp3"})}static{this.progress=a.register({fileName:"progress.mp3"})}static{this.chatEditModifiedFile=a.register({fileName:"chatEditModifiedFile.mp3"})}static{this.editsKept=a.register({fileName:"editsKept.mp3"})}static{this.editsUndone=a.register({fileName:"editsUndone.mp3"})}static{this.nextEditSuggestion=a.register({fileName:"nextEditSuggestion.mp3"})}static{this.terminalCommandSucceeded=a.register({fileName:"terminalCommandSucceeded.mp3"})}static{this.chatUserActionRequired=a.register({fileName:"chatUserActionRequired.mp3"})}static{this.codeActionTriggered=a.register({fileName:"codeActionTriggered.mp3"})}static{this.codeActionApplied=a.register({fileName:"codeActionApplied.mp3"})}},Wei=class{constructor(i){this.randomOneOf=i}getSound(i=!1){if(i||this.randomOneOf.length===1)return this.randomOneOf[0];{let e=Math.floor(Math.random()*this.randomOneOf.length);return this.randomOneOf[e]}}},$o=class a{constructor(i,e,t,o,n,r,s=!1){this.sound=i;this.name=e;this.legacySoundSettingsKey=t;this.settingsKey=o;this.legacyAnnouncementSettingsKey=n;this.announcementMessage=r;this.managesOwnEnablement=s}static{this._signals=new Set}static register(i){let e=new Wei("randomOneOf"in i.sound?i.sound.randomOneOf:[i.sound]),t=new a(e,i.name,i.legacySoundSettingsKey,i.settingsKey,i.legacyAnnouncementSettingsKey,i.announcementMessage,i.managesOwnEnablement);return a._signals.add(t),t}static get allAccessibilitySignals(){return[...this._signals]}static{this.errorAtPosition=a.register({name:d(1785,null),sound:nd.error,announcementMessage:d(1752,null),settingsKey:"accessibility.signals.positionHasError",delaySettingsKey:"accessibility.signalOptions.delays.errorAtPosition"})}static{this.warningAtPosition=a.register({name:d(1786,null),sound:nd.warning,announcementMessage:d(1753,null),settingsKey:"accessibility.signals.positionHasWarning",delaySettingsKey:"accessibility.signalOptions.delays.warningAtPosition"})}static{this.errorOnLine=a.register({name:d(1776,null),sound:nd.error,legacySoundSettingsKey:"audioCues.lineHasError",legacyAnnouncementSettingsKey:"accessibility.alert.error",announcementMessage:d(1744,null),settingsKey:"accessibility.signals.lineHasError"})}static{this.warningOnLine=a.register({name:d(1779,null),sound:nd.warning,legacySoundSettingsKey:"audioCues.lineHasWarning",legacyAnnouncementSettingsKey:"accessibility.alert.warning",announcementMessage:d(1746,null),settingsKey:"accessibility.signals.lineHasWarning"})}static{this.foldedArea=a.register({name:d(1777,null),sound:nd.foldedArea,legacySoundSettingsKey:"audioCues.lineHasFoldedArea",legacyAnnouncementSettingsKey:"accessibility.alert.foldedArea",announcementMessage:d(1745,null),settingsKey:"accessibility.signals.lineHasFoldedArea"})}static{this.break=a.register({name:d(1775,null),sound:nd.break,legacySoundSettingsKey:"audioCues.lineHasBreakpoint",legacyAnnouncementSettingsKey:"accessibility.alert.breakpoint",announcementMessage:d(1743,null),settingsKey:"accessibility.signals.lineHasBreakpoint"})}static{this.inlineSuggestion=a.register({name:d(1778,null),sound:nd.quickFixes,legacySoundSettingsKey:"audioCues.lineHasInlineSuggestion",settingsKey:"accessibility.signals.lineHasInlineSuggestion"})}static{this.nextEditSuggestion=a.register({name:d(1780,null),sound:nd.nextEditSuggestion,legacySoundSettingsKey:"audioCues.nextEditSuggestion",settingsKey:"accessibility.signals.nextEditSuggestion",announcementMessage:d(1747,null)})}static{this.terminalQuickFix=a.register({name:d(1794,null),sound:nd.quickFixes,legacySoundSettingsKey:"audioCues.terminalQuickFix",legacyAnnouncementSettingsKey:"accessibility.alert.terminalQuickFix",announcementMessage:d(1761,null),settingsKey:"accessibility.signals.terminalQuickFix"})}static{this.onDebugBreak=a.register({name:d(1784,null),sound:nd.break,legacySoundSettingsKey:"audioCues.onDebugBreak",legacyAnnouncementSettingsKey:"accessibility.alert.onDebugBreak",announcementMessage:d(1751,null),settingsKey:"accessibility.signals.onDebugBreak"})}static{this.noInlayHints=a.register({name:d(1781,null),sound:nd.error,legacySoundSettingsKey:"audioCues.noInlayHints",legacyAnnouncementSettingsKey:"accessibility.alert.noInlayHints",announcementMessage:d(1748,null),settingsKey:"accessibility.signals.noInlayHints"})}static{this.taskCompleted=a.register({name:d(1789,null),sound:nd.taskCompleted,legacySoundSettingsKey:"audioCues.taskCompleted",legacyAnnouncementSettingsKey:"accessibility.alert.taskCompleted",announcementMessage:d(1756,null),settingsKey:"accessibility.signals.taskCompleted"})}static{this.taskFailed=a.register({name:d(1790,null),sound:nd.taskFailed,legacySoundSettingsKey:"audioCues.taskFailed",legacyAnnouncementSettingsKey:"accessibility.alert.taskFailed",announcementMessage:d(1757,null),settingsKey:"accessibility.signals.taskFailed"})}static{this.terminalCommandFailed=a.register({name:d(1792,null),sound:nd.error,legacySoundSettingsKey:"audioCues.terminalCommandFailed",legacyAnnouncementSettingsKey:"accessibility.alert.terminalCommandFailed",announcementMessage:d(1759,null),settingsKey:"accessibility.signals.terminalCommandFailed"})}static{this.terminalCommandSucceeded=a.register({name:d(1793,null),sound:nd.terminalCommandSucceeded,announcementMessage:d(1760,null),settingsKey:"accessibility.signals.terminalCommandSucceeded"})}static{this.terminalBell=a.register({name:d(1791,null),sound:nd.terminalBell,legacySoundSettingsKey:"audioCues.terminalBell",legacyAnnouncementSettingsKey:"accessibility.alert.terminalBell",announcementMessage:d(1758,null),settingsKey:"accessibility.signals.terminalBell"})}static{this.notebookCellCompleted=a.register({name:d(1782,null),sound:nd.taskCompleted,legacySoundSettingsKey:"audioCues.notebookCellCompleted",legacyAnnouncementSettingsKey:"accessibility.alert.notebookCellCompleted",announcementMessage:d(1749,null),settingsKey:"accessibility.signals.notebookCellCompleted"})}static{this.notebookCellFailed=a.register({name:d(1783,null),sound:nd.taskFailed,legacySoundSettingsKey:"audioCues.notebookCellFailed",legacyAnnouncementSettingsKey:"accessibility.alert.notebookCellFailed",announcementMessage:d(1750,null),settingsKey:"accessibility.signals.notebookCellFailed"})}static{this.diffLineInserted=a.register({name:d(1770,null),sound:nd.diffLineInserted,legacySoundSettingsKey:"audioCues.diffLineInserted",settingsKey:"accessibility.signals.diffLineInserted"})}static{this.diffLineDeleted=a.register({name:d(1769,null),sound:nd.diffLineDeleted,legacySoundSettingsKey:"audioCues.diffLineDeleted",settingsKey:"accessibility.signals.diffLineDeleted"})}static{this.diffLineModified=a.register({name:d(1771,null),sound:nd.diffLineModified,legacySoundSettingsKey:"audioCues.diffLineModified",settingsKey:"accessibility.signals.diffLineModified"})}static{this.chatEditModifiedFile=a.register({name:d(1762,null),sound:nd.chatEditModifiedFile,announcementMessage:d(1735,null),settingsKey:"accessibility.signals.chatEditModifiedFile"})}static{this.chatRequestSent=a.register({name:d(1763,null),sound:nd.requestSent,legacySoundSettingsKey:"audioCues.chatRequestSent",legacyAnnouncementSettingsKey:"accessibility.alert.chatRequestSent",announcementMessage:d(1736,null),settingsKey:"accessibility.signals.chatRequestSent"})}static{this.chatResponseReceived=a.register({name:d(1764,null),legacySoundSettingsKey:"audioCues.chatResponseReceived",sound:{randomOneOf:[nd.responseReceived1,nd.responseReceived2,nd.responseReceived3,nd.responseReceived4]},settingsKey:"accessibility.signals.chatResponseReceived"})}static{this.codeActionTriggered=a.register({name:d(1768,null),sound:nd.codeActionTriggered,legacySoundSettingsKey:"audioCues.codeActionRequestTriggered",legacyAnnouncementSettingsKey:"accessibility.alert.codeActionRequestTriggered",announcementMessage:d(1739,null),settingsKey:"accessibility.signals.codeActionTriggered"})}static{this.codeActionApplied=a.register({name:d(1767,null),legacySoundSettingsKey:"audioCues.codeActionApplied",sound:nd.codeActionApplied,settingsKey:"accessibility.signals.codeActionApplied"})}static{this.progress=a.register({name:d(1787,null),sound:nd.progress,legacySoundSettingsKey:"audioCues.chatResponsePending",legacyAnnouncementSettingsKey:"accessibility.alert.progress",announcementMessage:d(1754,null),settingsKey:"accessibility.signals.progress"})}static{this.clear=a.register({name:d(1766,null),sound:nd.clear,legacySoundSettingsKey:"audioCues.clear",legacyAnnouncementSettingsKey:"accessibility.alert.clear",announcementMessage:d(1738,null),settingsKey:"accessibility.signals.clear"})}static{this.save=a.register({name:d(1788,null),sound:nd.save,legacySoundSettingsKey:"audioCues.save",legacyAnnouncementSettingsKey:"accessibility.alert.save",announcementMessage:d(1755,null),settingsKey:"accessibility.signals.save"})}static{this.format=a.register({name:d(1774,null),sound:nd.format,legacySoundSettingsKey:"audioCues.format",legacyAnnouncementSettingsKey:"accessibility.alert.format",announcementMessage:d(1742,null),settingsKey:"accessibility.signals.format"})}static{this.voiceRecordingStarted=a.register({name:d(1795,null),sound:nd.voiceRecordingStarted,legacySoundSettingsKey:"audioCues.voiceRecordingStarted",settingsKey:"accessibility.signals.voiceRecordingStarted"})}static{this.voiceRecordingStopped=a.register({name:d(1796,null),sound:nd.voiceRecordingStopped,legacySoundSettingsKey:"audioCues.voiceRecordingStopped",settingsKey:"accessibility.signals.voiceRecordingStopped"})}static{this.editsKept=a.register({name:d(1772,null),sound:nd.editsKept,announcementMessage:d(1740,null),settingsKey:"accessibility.signals.editsKept"})}static{this.editsUndone=a.register({name:d(1773,null),sound:nd.editsUndone,announcementMessage:d(1741,null),settingsKey:"accessibility.signals.editsUndone"})}static{this.chatUserActionRequired=a.register({name:d(1765,null),sound:nd.chatUserActionRequired,announcementMessage:d(1737,null),settingsKey:"accessibility.signals.chatUserActionRequired"})}};var Bo=ae("progressService");var zbt=Object.freeze({total(){},worked(){},done(){}}),bm=class{constructor(i){this.callback=i}static{this.None=Object.freeze({report(){}})}get value(){return this._value}report(i){this._value=i,this.callback(this._value)}},kye=class extends C{constructor(e,t){super();this.deferred=new Go;t.withProgress(e,o=>(this.reporter=o,this.lastStep&&o.report(this.lastStep),this.deferred.p)),this._register(Z(()=>this.deferred.complete()))}report(e){this.reporter?this.reporter.report(e):this.lastStep=e}};kye=I([m(1,Bo)],kye);var Eye=class extends C{constructor(e){super();this.progressIndicator=e;this.currentOperationId=0;this.currentOperationDisposables=this._register(new P);this.currentProgressTimeout=void 0}start(e){this.stop();let t=++this.currentOperationId,o=new $e;return this.currentProgressTimeout=setTimeout(()=>{t===this.currentOperationId&&(this.currentProgressRunner=this.progressIndicator.show(!0))},e),this.currentOperationDisposables.add(Z(()=>clearTimeout(this.currentProgressTimeout))),this.currentOperationDisposables.add(Z(()=>o.cancel())),this.currentOperationDisposables.add(Z(()=>this.currentProgressRunner?this.currentProgressRunner.done():void 0)),{id:t,token:o.token,stop:()=>this.doStop(t),isCurrent:()=>this.currentOperationId===t}}stop(){this.doStop(this.currentOperationId)}doStop(e){this.currentOperationId===e&&this.currentOperationDisposables.clear()}},rd=ae("editorProgressService");var tC=class a{constructor(i,e,t,o,n){this._initialScrollTop=i;this._initialContentHeight=e;this._visiblePosition=t;this._visiblePositionScrollDelta=o;this._cursorPosition=n}static capture(i){if(i.getScrollTop()===0||i.hasPendingScrollAnimation())return new a(i.getScrollTop(),i.getContentHeight(),null,0,null);let e=null,t=0,o=i.getVisibleRanges();if(o.length>0){e=o[0].getStartPosition();let n=i.getTopForPosition(e.lineNumber,e.column);t=i.getScrollTop()-n}return new a(i.getScrollTop(),i.getContentHeight(),e,t,i.getPosition())}restore(i){if(!(this._initialContentHeight===i.getContentHeight()&&this._initialScrollTop===i.getScrollTop())&&this._visiblePosition){let e=i.getTopForPosition(this._visiblePosition.lineNumber,this._visiblePosition.column);i.setScrollTop(e+this._visiblePositionScrollDelta)}}restoreRelativeVerticalPositionOfCursor(i){if(this._initialContentHeight===i.getContentHeight()&&this._initialScrollTop===i.getScrollTop())return;let e=i.getPosition();if(!this._cursorPosition||!e)return;let t=i.getTopForLineNumber(e.lineNumber)-i.getTopForLineNumber(this._cursorPosition.lineNumber);i.setScrollTop(i.getScrollTop()+t,1)}},jqe=class a{constructor(i,e,t,o){this._initialScrollTop=i;this._initialContentHeight=e;this._visiblePosition=t;this._visiblePositionScrollDelta=o}static capture(i){if(i.hasPendingScrollAnimation())return new a(i.getScrollTop(),i.getContentHeight(),null,0);let e=null,t=0,o=i.getVisibleRanges();return o.length>0&&(e=o.at(-1).getEndPosition(),t=i.getBottomForLineNumber(e.lineNumber)-i.getScrollTop()),new a(i.getScrollTop(),i.getContentHeight(),e,t)}restore(i){if(!(this._initialContentHeight===i.getContentHeight()&&this._initialScrollTop===i.getScrollTop())&&this._visiblePosition){let e=i.getBottomForLineNumber(this._visiblePosition.lineNumber);i.setScrollTop(e-this._visiblePositionScrollDelta,1)}}};var kNo=()=>({get delay(){return-1},dispose:()=>{},showHover:()=>{}}),Kbt=kNo,ENo=new co(()=>Kbt("mouse",!1)),TNo=new co(()=>Kbt("element",!1));function Nji(a){Kbt=a}function Ni(a){return a==="element"?TNo.value:ENo.value}function Gg(){return Kbt("element",!0)}function n_(a,i){if(a!==void 0){let e=a.match(/^\s*var\((.+)\)$/);if(e){let t=e[1].split(",",2);return t.length===2&&(i=n_(t[1].trim(),i)),`var(${t[0]}, ${i})`}return a}return i}function Vei(a){let i=a.replaceAll(/[^\w.%+-]/gi,"");return i!==a&&console.warn(`CSS size ${a} modified to ${i} to be safe for CSS`),i}function Oji(a){let i=a.replaceAll(/[^[0-9a-fA-F#]]/gi,"");return i!==a&&console.warn(`CSS hex color ${a} modified to ${i} to be safe for CSS`),i}function Tye(a){let i=a.replaceAll(/[^_\-a-z0-9]/gi,"");return i!==a&&console.warn(`CSS ident value ${a} modified to ${i} to be safe for CSS`),i}function WS(a){return`'${a.replaceAll(/'/g,"\\000027")}'`}function Na(a){return a?Hs`url('${CSS.escape(gn.uriToBrowserUri(a).toString(!0))}')`:"url('')"}function a1(a,i=!1){let e=CSS.escape(a);return!i&&e!==a&&console.warn(`CSS class name ${a} modified to ${e} to be safe for CSS`),e}function Hs(a,...i){return a.reduce((e,t,o)=>{let n=i[o]||"";return e+t+n},"")}var o_=class{constructor(){this._parts=[]}push(...i){this._parts.push(...i)}join(i=`
`){return this._parts.join(i)}};var Gbt=class{constructor(i){this.spliceables=i}splice(i,e,t){this.spliceables.forEach(o=>o.splice(i,e,t))}};function Fji(a){let i=_No(a);if(i&&i.length>0)return new Uint32Array(i)}var yL=0,B9=new Uint32Array(10);function _No(a){if(yL=0,l1(a,Bei,4352),yL>0||(l1(a,Hei,4449),yL>0)||(l1(a,Uei,4520),yL>0)||(l1(a,uae,12593),yL))return B9.subarray(0,yL);if(a>=44032&&a<=55203){let i=a-44032,e=i%588,t=Math.floor(i/588),o=Math.floor(e/28),n=e%28-1;if(t<Bei.length?l1(t,Bei,0):4352+t-12593<uae.length&&l1(4352+t,uae,12593),o<Hei.length?l1(o,Hei,0):4449+o-12593<uae.length&&l1(4449+o-12593,uae,12593),n>=0&&(n<Uei.length?l1(n,Uei,0):4520+n-12593<uae.length&&l1(4520+n-12593,uae,12593)),yL>0)return B9.subarray(0,yL)}}function l1(a,i,e){a>=e&&a<e+i.length&&DNo(i[a-e])}function DNo(a){a!==0&&(B9[yL++]=a&255,a>>8&&(B9[yL++]=a>>8&255),a>>16&&(B9[yL++]=a>>16&255))}var Bei=new Uint8Array([114,82,115,101,69,102,97,113,81,116,84,100,119,87,99,122,120,118,103]),Hei=new Uint16Array([107,111,105,79,106,112,117,80,104,27496,28520,27752,121,110,27246,28782,27758,98,109,27757,108]),Uei=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]),uae=new Uint16Array([114,82,29810,115,30579,26483,101,69,102,29286,24934,29030,29798,30822,30310,26470,97,113,81,29809,116,84,100,119,87,99,122,120,118,103,107,111,105,79,106,112,117,80,104,27496,28520,27752,121,110,27246,28782,27758,98,109,27757,108]);var edr=new il(1e4);var LNo=new il(1e4);function RNo(a){return PNo(a,"NFD",LNo)}var MNo=/[^\u0000-\u0080]/;function PNo(a,i,e){if(!a)return a;let t=e.get(a);if(t)return t;let o;return MNo.test(a)?o=a.normalize(i):o=a,e.set(a,o),o}var Qqe=(function(){let a=new il(1e4),i=/[\u0300-\u036f]/g;return function(e){let t=a.get(e);if(t)return t;let o=RNo(e).replace(i,""),n=(o.length===e.length?o:e).toLowerCase();return a.set(e,n),n}})();function GN(...a){return function(i,e){for(let t=0,o=a.length;t<o;t++){let n=a[t](i,e);if(n)return n}return null}}var sdr=Uji.bind(void 0,!1),pae=Uji.bind(void 0,!0);function Uji(a,i,e){if(!e||e.length<i.length)return null;let t;return a?t=Uk(e,i):t=e.indexOf(i)===0,t?i.length>0?[{start:0,end:i.length}]:[]:null}function SW(a,i){if(a.length>i.length)return null;let e=i.toLowerCase().indexOf(a.toLowerCase());return e===-1?null:[{start:e,end:e+a.length}]}function z9(a,i){if(a.length>i.length)return null;a=Qqe(a),i=Qqe(i);let e=i.indexOf(a);return e===-1?null:[{start:e,end:e+a.length}]}function Xqe(a,i){return a.length>i.length?null:Gei(a.toLowerCase(),i.toLowerCase(),0,0)}function Gei(a,i,e,t){if(e===a.length)return[];if(t===i.length)return null;if(a[e]===i[t]){let o=null;return(o=Gei(a,i,e+1,t+1))?Xei({start:t,end:t+1},o):null}return Gei(a,i,e,t+1)}function Qei(a){return 97<=a&&a<=122}function _ye(a){return 65<=a&&a<=90}function Yei(a){return 48<=a&&a<=57}function zji(a){return a===32||a===9||a===10||a===13}var Kji=new Set;"()[]{}<>`'\"-/;:,.?!".split("").forEach(a=>Kji.add(a.charCodeAt(0)));function jbt(a){return zji(a)||Kji.has(a)}function Wji(a,i){return a===i||jbt(a)&&jbt(i)}var zei=new Map;function Vji(a){if(zei.has(a))return zei.get(a);let i,e=Fji(a);return e&&(i=e),zei.set(a,i),i}function Gji(a){return Qei(a)||_ye(a)||Yei(a)}function Xei(a,i){return i.length===0?i=[a]:a.end===i[0].start?i[0].start=a.start:i.unshift(a),i}function $ji(a,i){for(let e=i;e<a.length;e++){let t=a.charCodeAt(e);if(_ye(t)||Yei(t)||e>0&&!Gji(a.charCodeAt(e-1)))return e}return a.length}function $ei(a,i,e,t){if(e===a.length)return[];if(t===i.length)return null;if(a[e]!==i[t].toLowerCase())return null;{let o=null,n=t+1;for(o=$ei(a,i,e+1,t+1);!o&&(n=$ji(i,n))<i.length;)o=$ei(a,i,e+1,n),n++;return o===null?null:Xei({start:t,end:t+1},o)}}function ANo(a){let i=0,e=0,t=0,o=0,n=0;for(let u=0;u<a.length;u++)n=a.charCodeAt(u),_ye(n)&&i++,Qei(n)&&e++,Gji(n)&&t++,Yei(n)&&o++;let r=i/a.length,s=e/a.length,l=t/a.length,c=o/a.length;return{upperPercent:r,lowerPercent:s,alphaPercent:l,numericPercent:c}}function NNo(a){let{upperPercent:i,lowerPercent:e}=a;return e===0&&i>.6}function ONo(a){let{upperPercent:i,lowerPercent:e,alphaPercent:t,numericPercent:o}=a;return e>.2&&i<.8&&t>.6&&o<.2}function FNo(a){let i=0,e=0,t=0,o=0;for(let n=0;n<a.length;n++)t=a.charCodeAt(n),_ye(t)&&i++,Qei(t)&&e++,zji(t)&&o++;return(i===0||e===0)&&o===0?a.length<=30:i<=5}function K9(a,i){if(!i||(i=i.trim(),i.length===0)||!FNo(a))return null;i.length>60&&(i=i.substring(0,60));let e=ANo(i);if(!ONo(e)){if(!NNo(e))return null;i=i.toLowerCase()}let t=null,o=0;for(a=a.toLowerCase();o<i.length&&(t=$ei(a,i,0,o))===null;)o=$ji(i,o+1);return t}function Gy(a,i,e=!1){if(!i||i.length===0)return null;let t=null,o=0;for(a=Qqe(a),i=Qqe(i);o<i.length&&(t=qei(a,i,0,o,e),t===null);)o=qji(i,o+1);return t}function qei(a,i,e,t,o){let n=0;if(e===a.length)return[];if(t===i.length)return null;if(!Wji(a.charCodeAt(e),i.charCodeAt(t))){let l=Vji(a.charCodeAt(e));if(!l)return null;for(let c=0;c<l.length;c++)if(!Wji(l[c],i.charCodeAt(t+c)))return null;n+=l.length-1}let r=null,s=t+n+1;if(r=qei(a,i,e+1,s,o),!o)for(;!r&&(s=qji(i,s))<i.length;)r=qei(a,i,e+1,s,o),s++;if(!r)return null;if(a.charCodeAt(e)!==i.charCodeAt(t)){let l=Vji(a.charCodeAt(e));if(!l)return r;for(let c=0;c<l.length;c++)if(l[c]!==i.charCodeAt(t+c))return r}return Xei({start:t,end:t+n+1},r)}function qji(a,i){for(let e=i;e<a.length;e++)if(jbt(a.charCodeAt(e))||e>0&&jbt(a.charCodeAt(e-1)))return e;return a.length}var WNo=GN(pae,K9,SW),VNo=GN(pae,K9,Xqe),Bji=new il(1e4);function Up(a,i,e=!1){if(typeof a!="string"||typeof i!="string")return null;let t=Bji.get(a);t||(t=new RegExp(r1i(a),"i"),Bji.set(a,t));let o=t.exec(i);return o?[{start:o.index,end:o.index+o[0].length}]:e?VNo(a,i):WNo(a,i)}function Dye(a,i){let e=wL(a,a.toLowerCase(),0,i,i.toLowerCase(),0,{firstMatchCanBeWeak:!0,boostFullMatch:!0});return e?ua(e):null}function jji(a,i,e,t,o,n){let r=Math.min(13,a.length);for(;e<r;e++){let s=wL(a,i,e,t,o,n,{firstMatchCanBeWeak:!0,boostFullMatch:!0});if(s)return s}return[0,n]}function ua(a){if(typeof a>"u")return[];let i=[],e=a[1];for(let t=a.length-1;t>1;t--){let o=a[t]+e,n=i[i.length-1];n&&n.end===o?n.end=o+1:i.push({start:o,end:o+1})}return i}var U9=128;function Jei(){let a=[],i=[];for(let e=0;e<=U9;e++)i[e]=0;for(let e=0;e<=U9;e++)a.push(i.slice(0));return a}function Qji(a){let i=[];for(let e=0;e<=a;e++)i[e]=0;return i}var Yji=Qji(2*U9),jei=Qji(2*U9),c1=Jei(),H9=Jei(),Yqe=Jei(),BNo=!1;function Kei(a,i,e,t,o){function n(s,l,c=" "){for(;s.length<l;)s=c+s;return s}let r=` | |${t.split("").map(s=>n(s,3)).join("|")}
`;for(let s=0;s<=e;s++)s===0?r+=" |":r+=`${i[s-1]}|`,r+=a[s].slice(0,o+1).map(l=>n(l.toString(),3)).join("|")+`
`;return r}function HNo(a,i,e,t){a=a.substr(i),e=e.substr(t),console.log(Kei(H9,a,a.length,e,e.length)),console.log(Kei(Yqe,a,a.length,e,e.length)),console.log(Kei(c1,a,a.length,e,e.length))}function $bt(a,i){if(i<0||i>=a.length)return!1;let e=a.codePointAt(i);switch(e){case 95:case 45:case 46:case 32:case 47:case 92:case 39:case 34:case 58:case 36:case 60:case 62:case 40:case 41:case 91:case 93:case 123:case 125:return!0;case void 0:return!1;default:return!!mGe(e)}}function Hji(a,i){if(i<0||i>=a.length)return!1;switch(a.charCodeAt(i)){case 32:case 9:return!0;default:return!1}}function qbt(a,i,e){return i[a]!==e[a]}function Jqe(a,i,e,t,o,n,r=!1){for(;i<e&&o<n;)a[i]===t[o]&&(r&&(Yji[i]=o),i+=1),o+=1;return i===e}var uv;(e=>{e.Default=[-100,0];function i(t){return!t||t.length===2&&t[0]===-100&&t[1]===0}e.isDefault=i})(uv||={});var hq=class{constructor(i,e){this.firstMatchCanBeWeak=i;this.boostFullMatch=e}static{this.default={boostFullMatch:!0,firstMatchCanBeWeak:!1}}};function wL(a,i,e,t,o,n,r=hq.default){let s=a.length>U9?U9:a.length,l=t.length>U9?U9:t.length;if(e>=s||n>=l||s-e>l-n||!Jqe(i,e,s,o,n,l,!0))return;UNo(s,l,e,n,i,o);let c=1,u=1,p=e,h=n,g=[!1];for(c=1,p=e;p<s;c++,p++){let y=Yji[p],w=jei[p],k=p+1<s?jei[p+1]:l;for(u=y-n+1,h=y;h<k;u++,h++){let T=Number.MIN_SAFE_INTEGER,N=!1;h<=w&&(T=zNo(a,i,p,e,t,o,h,l,n,c1[c-1][u-1]===0,g));let O=0;T!==Number.MIN_SAFE_INTEGER&&(N=!0,O=T+H9[c-1][u-1]);let V=h>y,U=V?H9[c][u-1]+(c1[c][u-1]>0?-5:0):0,G=h>y+1&&c1[c][u-1]>0,$=G?H9[c][u-2]+(c1[c][u-2]>0?-5:0):0;if(G&&(!V||$>=U)&&(!N||$>=O))H9[c][u]=$,Yqe[c][u]=3,c1[c][u]=0;else if(V&&(!N||U>=O))H9[c][u]=U,Yqe[c][u]=2,c1[c][u]=0;else if(N)H9[c][u]=O,Yqe[c][u]=1,c1[c][u]=c1[c-1][u-1]+1;else throw new Error("not possible")}}if(BNo&&HNo(a,e,t,n),!g[0]&&!r.firstMatchCanBeWeak)return;c--,u--;let f=[H9[c][u],n],v=0,b=0;for(;c>=1;){let y=u;do{let w=Yqe[c][y];if(w===3)y=y-2;else if(w===2)y=y-1;else break}while(y>=1);v>1&&i[e+c-1]===o[n+u-1]&&!qbt(y+n-1,t,o)&&v+1>c1[c][y]&&(y=u),y===u?v++:v=1,b||(b=y),c--,u=y-1,f.push(u)}l-n===s&&r.boostFullMatch&&(f[0]+=2);let S=b-s;return f[0]-=S,f}function UNo(a,i,e,t,o,n){let r=a-1,s=i-1;for(;r>=e&&s>=t;)o[r]===n[s]&&(jei[r]=s,r--),s--}function zNo(a,i,e,t,o,n,r,s,l,c,u){if(i[e]!==n[r])return Number.MIN_SAFE_INTEGER;let p=1,h=!1;return r===e-t?p=a[e]===o[r]?7:5:qbt(r,o,n)&&(r===0||!qbt(r-1,o,n))?(p=a[e]===o[r]?7:5,h=!0):$bt(n,r)&&(r===0||!$bt(n,r-1))?p=5:($bt(n,r-1)||Hji(n,r-1))&&(p=5,h=!0),p>1&&e===t&&(u[0]=!0),h||(h=qbt(r,o,n)||$bt(n,r-1)||Hji(n,r-1)),e===t?r>l&&(p-=h?3:5):c?p+=h?2:0:p+=h?0:1,r+1===s&&(p-=h?3:5),p}function Qbt(a,i,e,t,o,n,r){return KNo(a,i,e,t,o,n,!0,r)}function KNo(a,i,e,t,o,n,r,s){let l=wL(a,i,e,t,o,n,s);if(l&&!r)return l;if(a.length>=3){let c=Math.min(7,a.length-1);for(let u=e+1;u<c;u++){let p=GNo(a,u);if(p){let h=wL(p,p.toLowerCase(),e,t,o,n,s);h&&(h[0]-=3,(!l||h[0]>l[0])&&(l=h))}}}return l}function GNo(a,i){if(i+1>=a.length)return;let e=a[i],t=a[i+1];if(e!==t)return a.slice(0,i)+t+e+a.slice(i+2)}var mae="notSelectable";var CL=class extends Error{constructor(i,e){super(`ListError [${i}] ${e}`)}},d1=class{constructor(){this.cache=new WeakMap}getHeight(i){return this.cache.get(i)??this.estimateHeight(i)}setDynamicHeight(i,e){e>0&&this.cache.set(i,e)}};var qb;(o=>{function a(n,r){if(n.start>=r.end||r.start>=n.end)return{start:0,end:0};let s=Math.max(n.start,r.start),l=Math.min(n.end,r.end);return l-s<=0?{start:0,end:0}:{start:s,end:l}}o.intersect=a;function i(n){return n.end-n.start<=0}o.isEmpty=i;function e(n,r){return!i(a(n,r))}o.intersects=e;function t(n,r){let s=[],l={start:n.start,end:Math.min(r.start,n.end)},c={start:Math.max(r.end,n.start),end:n.end};return i(l)||s.push(l),i(c)||s.push(c),s}o.relativeComplement=t})(qb||={});function Xji(a,i){let e=[];for(let t of i){if(a.start>=t.range.end)continue;if(a.end<t.range.start)break;let o=qb.intersect(a,t.range);qb.isEmpty(o)||e.push({range:o,size:t.size})}return e}function Xbt({start:a,end:i},e){return{start:a+e,end:i+e}}function $No(a){let i=[],e=null;for(let t of a){let o=t.range.start,n=t.range.end,r=t.size;if(e&&r===e.size){e.range.end=n;continue}e={range:{start:o,end:n},size:r},i.push(e)}return i}function qNo(...a){return $No(a.reduce((i,e)=>i.concat(e),[]))}var Ybt=class{constructor(i){this.groups=[];this._size=0;this._paddingTop=0;this._paddingTop=i??0,this._size=this._paddingTop}get paddingTop(){return this._paddingTop}set paddingTop(i){this._size=this._size+i-this._paddingTop,this._paddingTop=i}splice(i,e,t=[]){let o=t.length-e,n=Xji({start:0,end:i},this.groups),r=Xji({start:i+e,end:Number.POSITIVE_INFINITY},this.groups).map(l=>({range:Xbt(l.range,o),size:l.size})),s=t.map((l,c)=>({range:{start:i+c,end:i+c+1},size:l.size}));this.groups=qNo(n,s,r),this._size=this._paddingTop+this.groups.reduce((l,c)=>l+c.size*(c.range.end-c.range.start),0)}get count(){let i=this.groups.length;return i?this.groups[i-1].range.end:0}get size(){return this._size}indexAt(i){if(i<0)return-1;if(i<this._paddingTop)return 0;let e=0,t=this._paddingTop;for(let o of this.groups){let n=o.range.end-o.range.start,r=t+n*o.size;if(i<r)return e+Math.floor((i-t)/o.size);e+=n,t=r}return e}indexAfter(i){return Math.min(this.indexAt(i)+1,this.count)}positionAt(i){if(i<0)return-1;let e=0,t=0;for(let o of this.groups){let n=o.range.end-o.range.start,r=t+n;if(i<r)return this._paddingTop+e+(i-t)*o.size;e+=n*o.size,t=r}return-1}};var Jbt=class{constructor(i){this.renderers=i;this.cache=new Map;this.transactionNodesPendingRemoval=new Set;this.inTransaction=!1}alloc(i){let e=this.getTemplateCache(i).pop(),t=!1;if(e)t=this.transactionNodesPendingRemoval.delete(e.domNode);else{let o=_(".monaco-list-row"),r=this.getRenderer(i).renderTemplate(o);e={domNode:o,templateId:i,templateData:r}}return{row:e,isReusingConnectedDomNode:t}}release(i){i&&this.releaseRow(i)}transact(i){if(this.inTransaction)throw new Error("Already in transaction");this.inTransaction=!0;try{i()}finally{for(let e of this.transactionNodesPendingRemoval)this.doRemoveNode(e);this.transactionNodesPendingRemoval.clear(),this.inTransaction=!1}}releaseRow(i){let{domNode:e,templateId:t}=i;e&&(this.inTransaction?this.transactionNodesPendingRemoval.add(e):this.doRemoveNode(e)),this.getTemplateCache(t).push(i)}doRemoveNode(i){i.classList.remove("scrolling"),i.remove()}getTemplateCache(i){let e=this.cache.get(i);return e||(e=[],this.cache.set(i,e)),e}dispose(){this.cache.forEach((i,e)=>{for(let t of i)this.getRenderer(e).disposeTemplate(t.templateData),t.templateData=null}),this.cache.clear(),this.transactionNodesPendingRemoval.clear()}getRenderer(i){let e=this.renderers.get(i);if(!e)throw new Error(`No renderer found for ${i}`);return e}};function $N(a,i,e,t=[]){if(!a.dataTransfer)return;let o=_(".monaco-drag-image");o.textContent=e,o.classList.add(...t),(s=>{for(;s&&!s.classList.contains("monaco-workbench");)s=s.parentElement;return s||i.ownerDocument.body})(i).appendChild(o),a.dataTransfer.setDragImage(o,-10,-10),setTimeout(()=>o.remove(),0)}var hae={CurrentDragAndDropData:void 0};var u1={useShadows:!0,verticalScrollMode:1,setRowLineHeight:!0,setRowHeight:!0,supportDynamicHeights:!1,dnd:{getDragElements(a){return[a]},getDragURI(){return null},onDragStart(){},onDragOver(){return!1},drop(){},dispose(){}},horizontalScrolling:!1,transformOptimization:!0,alwaysConsumeMouseWheel:!0},$y=class{get context(){return this._context}set context(i){this._context=i}constructor(i){this.elements=i}update(){}getData(){return this.elements}},Zqe=class{constructor(i){this.elements=i}update(){}getData(){return this.elements}},p1=class{constructor(){this.types=[],this.files=[]}update(i){if(i.types&&this.types.splice(0,this.types.length,...i.types),i.files){this.files.splice(0,this.files.length);for(let e=0;e<i.files.length;e++){let t=i.files.item(e);t&&(t.size||t.type)&&this.files.push(t)}}}getData(){return{types:this.types,files:this.files}}};function jNo(a,i){return Array.isArray(a)&&Array.isArray(i)?$i(a,i):a===i}var Zei=class{constructor(i){i?.getSetSize?this.getSetSize=i.getSetSize.bind(i):this.getSetSize=(e,t,o)=>o,i?.getPosInSet?this.getPosInSet=i.getPosInSet.bind(i):this.getPosInSet=(e,t)=>t+1,i?.getRole?this.getRole=i.getRole.bind(i):this.getRole=e=>"listitem",i?.isChecked?this.isChecked=i.isChecked.bind(i):this.isChecked=e=>{}}},xL=class xL{constructor(i,e,t,o=u1){this.virtualDelegate=e;this.domId=`list_id_${++xL.InstanceCount}`;this.renderers=new Map;this.renderWidth=0;this._scrollHeight=0;this.scrollableElementUpdateDisposable=null;this.scrollableElementWidthDelayer=new jo(50);this.splicing=!1;this.dragOverAnimationStopDisposable=C.None;this.dragOverMouseY=0;this.canDrop=!1;this.currentDragFeedbackDisposable=C.None;this.onDragLeaveTimeout=C.None;this.currentSelectionDisposable=C.None;this.disposables=new P;this._onDidChangeContentHeight=this.disposables.add(new E);this._onDidChangeContentWidth=this.disposables.add(new E);this.onDidChangeContentHeight=H.latch(this._onDidChangeContentHeight.event,void 0,this.disposables);this.onDidChangeContentWidth=H.latch(this._onDidChangeContentWidth.event,void 0,this.disposables);this._horizontalScrolling=!1;if(o.horizontalScrolling&&o.supportDynamicHeights)throw new Error("Horizontal scrolling and dynamic heights not supported simultaneously");this.items=[],this.itemId=0,this.rangeMap=this.createRangeMap(o.paddingTop??0);for(let r of t)this.renderers.set(r.templateId,r);if(this.cache=this.disposables.add(new Jbt(this.renderers)),this.lastRenderTop=0,this.lastRenderHeight=0,this.domNode=document.createElement("div"),this.domNode.className="monaco-list",this.domNode.classList.add(this.domId),this.domNode.tabIndex=0,this.domNode.classList.toggle("mouse-support",typeof o.mouseSupport=="boolean"?o.mouseSupport:!0),this._horizontalScrolling=o.horizontalScrolling??u1.horizontalScrolling,this.domNode.classList.toggle("horizontal-scrolling",this._horizontalScrolling),this.paddingBottom=typeof o.paddingBottom>"u"?0:o.paddingBottom,this.accessibilityProvider=new Zei(o.accessibilityProvider),this.rowsContainer=document.createElement("div"),this.rowsContainer.className="monaco-list-rows",(o.transformOptimization??u1.transformOptimization)&&(this.rowsContainer.style.transform="translate3d(0px, 0px, 0px)",this.rowsContainer.style.overflow="hidden",this.rowsContainer.style.contain="strict"),this.disposables.add(ws.addTarget(this.rowsContainer)),this.scrollable=this.disposables.add(new UT({forceIntegerValues:!0,smoothScrollDuration:o.smoothScrolling??!1?125:0,scheduleAtNextAnimationFrame:r=>$r(Me(this.domNode),r)})),this.scrollableElement=this.disposables.add(new AN(this.rowsContainer,{alwaysConsumeMouseWheel:o.alwaysConsumeMouseWheel??u1.alwaysConsumeMouseWheel,horizontal:1,vertical:o.verticalScrollMode??u1.verticalScrollMode,useShadows:o.useShadows??u1.useShadows,mouseWheelScrollSensitivity:o.mouseWheelScrollSensitivity,fastScrollSensitivity:o.fastScrollSensitivity,scrollByPage:o.scrollByPage},this.scrollable)),this.domNode.appendChild(this.scrollableElement.getDomNode()),i.appendChild(this.domNode),this.scrollableElement.onScroll(this.onScroll,this,this.disposables),this.disposables.add(j(this.rowsContainer,Gn.Change,r=>this.onTouchChange(r))),this.disposables.add(j(this.scrollableElement.getDomNode(),"scroll",r=>{let s=r.target,l=s.scrollTop;s.scrollTop=0,o.scrollToActiveElement&&this.setScrollTop(this.scrollTop+l)})),this.disposables.add(j(this.domNode,"dragover",r=>this.onDragOver(this.toDragEvent(r)))),this.disposables.add(j(this.domNode,"drop",r=>this.onDrop(this.toDragEvent(r)))),this.disposables.add(j(this.domNode,"dragleave",r=>this.onDragLeave(this.toDragEvent(r)))),this.disposables.add(j(this.domNode,"dragend",r=>this.onDragEnd(r))),o.userSelection){if(o.dnd)throw new Error("DND and user selection cannot be used simultaneously");this.disposables.add(j(this.domNode,"mousedown",r=>this.onPotentialSelectionStart(r)))}this.setRowLineHeight=o.setRowLineHeight??u1.setRowLineHeight,this.setRowHeight=o.setRowHeight??u1.setRowHeight,this.supportDynamicHeights=o.supportDynamicHeights??u1.supportDynamicHeights,this.dnd=o.dnd??this.disposables.add(u1.dnd),this.layout(o.initialSize?.height,o.initialSize?.width),o.scrollToActiveElement&&this._setupFocusObserver(i)}static{this.InstanceCount=0}get contentHeight(){return this.rangeMap.size}get contentWidth(){return this.scrollWidth??0}get onDidScroll(){return this.scrollableElement.onScroll}get onWillScroll(){return this.scrollableElement.onWillScroll}get containerDomNode(){return this.rowsContainer}get scrollableElementDomNode(){return this.scrollableElement.getDomNode()}get horizontalScrolling(){return this._horizontalScrolling}set horizontalScrolling(i){if(i!==this._horizontalScrolling){if(i&&this.supportDynamicHeights)throw new Error("Horizontal scrolling and dynamic heights not supported simultaneously");if(this._horizontalScrolling=i,this.domNode.classList.toggle("horizontal-scrolling",this._horizontalScrolling),this._horizontalScrolling){for(let e of this.items)this.measureItemWidth(e);this.updateScrollWidth(),this.scrollableElement.setScrollDimensions({width:D6(this.domNode)}),this.rowsContainer.style.width=`${Math.max(this.scrollWidth||0,this.renderWidth)}px`}else this.scrollableElementWidthDelayer.cancel(),this.scrollableElement.setScrollDimensions({width:this.renderWidth,scrollWidth:this.renderWidth}),this.rowsContainer.style.width="",this.domNode.style.removeProperty("--list-scroll-right-offset")}}_setupFocusObserver(i){this.disposables.add(j(i,"focus",()=>{let e=Pn();this.activeElement!==e&&e!==null&&(this.activeElement=e,this._scrollToActiveElement(this.activeElement,i))},!0))}_scrollToActiveElement(i,e){let t=e.getBoundingClientRect(),n=i.getBoundingClientRect().top-t.top;n<0&&this.setScrollTop(this.scrollTop+n)}updateOptions(i){i.paddingBottom!==void 0&&(this.paddingBottom=i.paddingBottom,this.scrollableElement.setScrollDimensions({scrollHeight:this.scrollHeight})),i.smoothScrolling!==void 0&&this.scrollable.setSmoothScrollDuration(i.smoothScrolling?125:0),i.horizontalScrolling!==void 0&&(this.horizontalScrolling=i.horizontalScrolling);let e;if(i.scrollByPage!==void 0&&(e={...e??{},scrollByPage:i.scrollByPage}),i.mouseWheelScrollSensitivity!==void 0&&(e={...e??{},mouseWheelScrollSensitivity:i.mouseWheelScrollSensitivity}),i.fastScrollSensitivity!==void 0&&(e={...e??{},fastScrollSensitivity:i.fastScrollSensitivity}),e&&this.scrollableElement.updateOptions(e),i.paddingTop!==void 0&&i.paddingTop!==this.rangeMap.paddingTop){let t=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),o=i.paddingTop-this.rangeMap.paddingTop;this.rangeMap.paddingTop=i.paddingTop,this.render(t,Math.max(0,this.lastRenderTop+o),this.lastRenderHeight,void 0,void 0,!0),this.setScrollTop(this.lastRenderTop),this.eventuallyUpdateScrollDimensions(),this.supportDynamicHeights&&this._rerender(this.lastRenderTop,this.lastRenderHeight)}}delegateScrollFromMouseWheelEvent(i){this.scrollableElement.delegateScrollFromMouseWheelEvent(i)}delegateVerticalScrollbarPointerDown(i){this.scrollableElement.delegateVerticalScrollbarPointerDown(i)}updateElementHeight(i,e,t){if(i<0||i>=this.items.length)return;let o=this.items[i].size;if(typeof e>"u"){if(!this.supportDynamicHeights){console.warn("Dynamic heights not supported",new Error().stack);return}this.items[i].lastDynamicHeightWidth=void 0,e=o+this.probeDynamicHeight(i)}if(o===e)return;let n=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),r=0;i<n.start||t!==null&&t>i&&t<n.end?r=e-o:r=0,this.rangeMap.splice(i,1,[{size:e}]),this.items[i].size=e,this.render(n,Math.max(0,this.lastRenderTop+r),this.lastRenderHeight,void 0,void 0,!0),this.setScrollTop(this.lastRenderTop),this.eventuallyUpdateScrollDimensions(),this.supportDynamicHeights?this._rerender(this.lastRenderTop,this.lastRenderHeight):this._onDidChangeContentHeight.fire(this.contentHeight)}createRangeMap(i){return new Ybt(i)}splice(i,e,t=[]){if(this.splicing)throw new Error("Can't run recursive splices.");this.splicing=!0;try{return this._splice(i,e,t)}finally{this.splicing=!1,this._onDidChangeContentHeight.fire(this.contentHeight)}}_splice(i,e,t=[]){let o=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),n={start:i,end:i+e},r=qb.intersect(o,n),s=new Map;for(let T=r.end-1;T>=r.start;T--){let N=this.items[T];if(N.dragStartDisposable.dispose(),N.checkedDisposable.dispose(),N.row){let O=s.get(N.templateId);O||(O=[],s.set(N.templateId,O));let V=this.renderers.get(N.templateId);V&&V.disposeElement&&V.disposeElement(N.element,T,N.row.templateData,{height:N.size}),O.unshift(N.row)}N.row=null,N.stale=!0}let l={start:i+e,end:this.items.length},c=qb.intersect(l,o),u=qb.relativeComplement(l,o),p=t.map(T=>({id:String(this.itemId++),element:T,templateId:this.virtualDelegate.getTemplateId(T),size:this.virtualDelegate.getHeight(T),width:void 0,hasDynamicHeight:!!this.virtualDelegate.hasDynamicHeight&&this.virtualDelegate.hasDynamicHeight(T),lastDynamicHeightWidth:void 0,row:null,uri:void 0,dropTarget:!1,dragStartDisposable:C.None,checkedDisposable:C.None,stale:!1})),h;i===0&&e>=this.items.length?(this.rangeMap=this.createRangeMap(this.rangeMap.paddingTop),this.rangeMap.splice(0,0,p),h=this.items,this.items=p):(this.rangeMap.splice(i,e,p),h=ure(this.items,i,e,p));let g=t.length-e,f=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),v=Xbt(c,g),b=qb.intersect(f,v);for(let T=b.start;T<b.end;T++)this.updateItemInDOM(this.items[T],T);let S=qb.relativeComplement(v,f);for(let T of S)for(let N=T.start;N<T.end;N++)this.removeItemFromDOM(N);let y=u.map(T=>Xbt(T,g)),k=[{start:i,end:i+t.length},...y].map(T=>qb.intersect(f,T)).reverse();for(let T of k)for(let N=T.end-1;N>=T.start;N--){let O=this.items[N],U=s.get(O.templateId)?.pop();this.insertItemInDOM(N,U)}for(let T of s.values())for(let N of T)this.cache.release(N);return this.eventuallyUpdateScrollDimensions(),this.supportDynamicHeights&&this._rerender(this.scrollTop,this.renderHeight),h.map(T=>T.element)}eventuallyUpdateScrollDimensions(){this._scrollHeight=this.contentHeight,this.rowsContainer.style.height=`${this._scrollHeight}px`,this.scrollableElementUpdateDisposable||(this.scrollableElementUpdateDisposable=$r(Me(this.domNode),()=>{this.scrollableElement.setScrollDimensions({scrollHeight:this.scrollHeight}),this.updateScrollWidth(),this.scrollableElementUpdateDisposable=null}))}eventuallyUpdateScrollWidth(){if(!this.horizontalScrolling){this.scrollableElementWidthDelayer.cancel();return}this.scrollableElementWidthDelayer.trigger(()=>this.updateScrollWidth())}updateScrollWidth(){if(!this.horizontalScrolling)return;let i=0;for(let e of this.items)typeof e.width<"u"&&(i=Math.max(i,e.width));this.scrollWidth=i,this.scrollableElement.setScrollDimensions({scrollWidth:i===0?0:i+10}),this._onDidChangeContentWidth.fire(this.scrollWidth)}updateWidth(i){if(!this.horizontalScrolling||typeof this.scrollWidth>"u")return;let e=this.items[i];this.measureItemWidth(e),typeof e.width<"u"&&e.width>this.scrollWidth&&(this.scrollWidth=e.width,this.scrollableElement.setScrollDimensions({scrollWidth:this.scrollWidth+10}),this._onDidChangeContentWidth.fire(this.scrollWidth))}rerender(){if(this.supportDynamicHeights){for(let i of this.items)i.lastDynamicHeightWidth=void 0;this._rerender(this.lastRenderTop,this.lastRenderHeight)}}get length(){return this.items.length}get renderHeight(){return this.scrollableElement.getScrollDimensions().height}get firstVisibleIndex(){return this.getVisibleRange(this.lastRenderTop,this.lastRenderHeight).start}get firstMostlyVisibleIndex(){let i=this.firstVisibleIndex,e=this.rangeMap.positionAt(i),t=this.rangeMap.positionAt(i+1);return t!==-1&&(t-e)/2+e<this.scrollTop?i+1:i}get lastVisibleIndex(){return this.getRenderRange(this.lastRenderTop,this.lastRenderHeight).end-1}element(i){return this.items[i].element}indexOf(i){return this.items.findIndex(e=>e.element===i)}domElement(i){let e=this.items[i].row;return e&&e.domNode}elementHeight(i){return this.items[i].size}elementTop(i){return this.rangeMap.positionAt(i)}indexAt(i){return this.rangeMap.indexAt(i)}indexAfter(i){return this.rangeMap.indexAfter(i)}layout(i,e){let t={height:typeof i=="number"?i:qbe(this.domNode)};if(this.scrollableElementUpdateDisposable&&(this.scrollableElementUpdateDisposable.dispose(),this.scrollableElementUpdateDisposable=null,t.scrollHeight=this.scrollHeight),this.scrollableElement.setScrollDimensions(t),typeof e<"u"&&(this.renderWidth=e,this.supportDynamicHeights&&this._rerender(this.scrollTop,this.renderHeight)),this.horizontalScrolling){this.scrollableElement.setScrollDimensions({width:typeof e=="number"?e:D6(this.domNode)});let o=this.scrollableElement.getScrollPosition(),n=this.scrollableElement.getScrollDimensions(),r=Math.max(0,n.scrollWidth-o.scrollLeft-this.renderWidth);this.domNode.style.setProperty("--list-scroll-right-offset",`${Math.max(r-12,0)}px`)}}render(i,e,t,o,n,r=!1,s=!1){let l=this.getRenderRange(e,t),c=qb.relativeComplement(l,i).reverse(),u=qb.relativeComplement(i,l);if(r){let p=qb.intersect(i,l);for(let h=p.start;h<p.end;h++)this.updateItemInDOM(this.items[h],h)}if(this.cache.transact(()=>{for(let p of u)for(let h=p.start;h<p.end;h++)this.removeItemFromDOM(h,s);for(let p of c)for(let h=p.end-1;h>=p.start;h--)this.insertItemInDOM(h)}),o!==void 0&&(this.rowsContainer.style.left=`-${o}px`),this.rowsContainer.style.top=`-${e}px`,this.horizontalScrolling&&n!==void 0){this.rowsContainer.style.width=`${Math.max(n,this.renderWidth)}px`;let p=Math.max(0,n-(o??0)-this.renderWidth);this.domNode.style.setProperty("--list-scroll-right-offset",`${Math.max(p-12,0)}px`)}this.lastRenderTop=e,this.lastRenderHeight=t}insertItemInDOM(i,e){let t=this.items[i];if(!t.row)if(e)t.row=e,t.stale=!0;else{let c=this.cache.alloc(t.templateId);t.row=c.row,t.stale||=c.isReusingConnectedDomNode}let o=this.accessibilityProvider.getRole(t.element)||"listitem";t.row.domNode.setAttribute("role",o);let n=this.accessibilityProvider.isChecked(t.element),r=c=>c==="mixed"?"mixed":String(!!c);if(typeof n=="boolean"||n==="mixed")t.row.domNode.setAttribute("aria-checked",r(n));else if(n){let c=u=>t.row.domNode.setAttribute("aria-checked",r(u));c(n.value),t.checkedDisposable=n.onDidChange(()=>c(n.value))}if(t.stale||!t.row.domNode.parentElement){let c=this.items.at(i+1)?.row?.domNode??null;(t.row.domNode.parentElement!==this.rowsContainer||t.row.domNode.nextElementSibling!==c)&&this.rowsContainer.insertBefore(t.row.domNode,c),t.stale=!1}this.updateItemInDOM(t,i);let s=this.renderers.get(t.templateId);if(!s)throw new Error(`No renderer found for template id ${t.templateId}`);s?.renderElement(t.element,i,t.row.templateData,{height:t.size});let l=this.dnd.getDragURI(t.element);t.dragStartDisposable.dispose(),t.row.domNode.draggable=!!l,l&&(t.dragStartDisposable=j(t.row.domNode,"dragstart",c=>this.onDragStart(t.element,l,c))),this.horizontalScrolling&&(this.measureItemWidth(t),this.eventuallyUpdateScrollWidth())}measureItemWidth(i){if(!i.row||!i.row.domNode)return;i.row.domNode.style.width="fit-content",i.width=D6(i.row.domNode);let e=Me(i.row.domNode).getComputedStyle(i.row.domNode);e.paddingLeft&&(i.width+=parseFloat(e.paddingLeft)),e.paddingRight&&(i.width+=parseFloat(e.paddingRight)),i.row.domNode.style.width=""}updateItemInDOM(i,e){i.row.domNode.style.top=`${this.elementTop(e)}px`,this.setRowHeight&&(i.row.domNode.style.height=`${i.size}px`),this.setRowLineHeight&&(i.row.domNode.style.lineHeight=`${i.size}px`),i.row.domNode.setAttribute("data-index",`${e}`),i.row.domNode.setAttribute("data-last-element",e===this.length-1?"true":"false"),i.row.domNode.setAttribute("data-parity",e%2===0?"even":"odd"),i.row.domNode.setAttribute("aria-setsize",String(this.accessibilityProvider.getSetSize(i.element,e,this.length))),i.row.domNode.setAttribute("aria-posinset",String(this.accessibilityProvider.getPosInSet(i.element,e))),i.row.domNode.setAttribute("id",this.getElementDomId(e)),i.row.domNode.classList.toggle("drop-target",i.dropTarget)}removeItemFromDOM(i,e){let t=this.items[i];if(t.dragStartDisposable.dispose(),t.checkedDisposable.dispose(),t.row){let o=this.renderers.get(t.templateId);o&&o.disposeElement&&o.disposeElement(t.element,i,t.row.templateData,{height:t.size,onScroll:e}),this.cache.release(t.row),t.row=null}this.horizontalScrolling&&this.eventuallyUpdateScrollWidth()}getScrollTop(){return this.scrollableElement.getScrollPosition().scrollTop}setScrollTop(i,e){this.scrollableElementUpdateDisposable&&(this.scrollableElementUpdateDisposable.dispose(),this.scrollableElementUpdateDisposable=null,this.scrollableElement.setScrollDimensions({scrollHeight:this.scrollHeight})),this.scrollableElement.setScrollPosition({scrollTop:i,reuseAnimation:e})}getScrollLeft(){return this.scrollableElement.getScrollPosition().scrollLeft}setScrollLeft(i){this.scrollableElementUpdateDisposable&&(this.scrollableElementUpdateDisposable.dispose(),this.scrollableElementUpdateDisposable=null,this.scrollableElement.setScrollDimensions({scrollWidth:this.scrollWidth})),this.scrollableElement.setScrollPosition({scrollLeft:i})}get scrollTop(){return this.getScrollTop()}set scrollTop(i){this.setScrollTop(i)}get scrollHeight(){return this._scrollHeight+(this.horizontalScrolling?10:0)+this.paddingBottom}get onMouseClick(){return H.map(this.disposables.add(new On(this.domNode,"click")).event,i=>this.toMouseEvent(i),this.disposables)}get onMouseDblClick(){return H.map(this.disposables.add(new On(this.domNode,"dblclick")).event,i=>this.toMouseEvent(i),this.disposables)}get onMouseMiddleClick(){return H.filter(H.map(this.disposables.add(new On(this.domNode,"auxclick")).event,i=>this.toMouseEvent(i),this.disposables),i=>i.browserEvent.button===1,this.disposables)}get onMouseUp(){return H.map(this.disposables.add(new On(this.domNode,"mouseup")).event,i=>this.toMouseEvent(i),this.disposables)}get onMouseDown(){return H.map(this.disposables.add(new On(this.domNode,"mousedown")).event,i=>this.toMouseEvent(i),this.disposables)}get onMouseOver(){return H.map(this.disposables.add(new On(this.domNode,"mouseover")).event,i=>this.toMouseEvent(i),this.disposables)}get onMouseMove(){return H.map(this.disposables.add(new On(this.domNode,"mousemove")).event,i=>this.toMouseEvent(i),this.disposables)}get onMouseOut(){return H.map(this.disposables.add(new On(this.domNode,"mouseout")).event,i=>this.toMouseEvent(i),this.disposables)}get onContextMenu(){return H.any(H.map(this.disposables.add(new On(this.domNode,"contextmenu")).event,i=>this.toMouseEvent(i),this.disposables),H.map(this.disposables.add(new On(this.domNode,Gn.Contextmenu)).event,i=>this.toGestureEvent(i),this.disposables))}get onTouchStart(){return H.map(this.disposables.add(new On(this.domNode,"touchstart")).event,i=>this.toTouchEvent(i),this.disposables)}get onTap(){return H.map(this.disposables.add(new On(this.rowsContainer,Gn.Tap)).event,i=>this.toGestureEvent(i),this.disposables)}toMouseEvent(i){let e=this.getItemIndexFromEventTarget(i.target||null),t=typeof e>"u"?void 0:this.items[e],o=t&&t.element;return{browserEvent:i,index:e,element:o}}toTouchEvent(i){let e=this.getItemIndexFromEventTarget(i.target||null),t=typeof e>"u"?void 0:this.items[e],o=t&&t.element;return{browserEvent:i,index:e,element:o}}toGestureEvent(i){let e=this.getItemIndexFromEventTarget(i.initialTarget||null),t=typeof e>"u"?void 0:this.items[e],o=t&&t.element;return{browserEvent:i,index:e,element:o}}toDragEvent(i){let e=this.getItemIndexFromEventTarget(i.target||null),t=typeof e>"u"?void 0:this.items[e],o=t&&t.element,n=this.getTargetSector(i,e);return{browserEvent:i,index:e,element:o,sector:n}}onScroll(i){try{let e=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight);this.render(e,i.scrollTop,i.height,i.scrollLeft,i.scrollWidth,void 0,!0),this.supportDynamicHeights&&this._rerender(i.scrollTop,i.height,i.inSmoothScrolling)}catch(e){throw console.error("Got bad scroll event:",i),e}}onTouchChange(i){i.preventDefault(),i.stopPropagation(),this.scrollTop-=i.translationY}onDragStart(i,e,t){if(!t.dataTransfer)return;let o=this.dnd.getDragElements(i);t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setData(Aa.TEXT,e);let n;this.dnd.getDragLabel&&(n=this.dnd.getDragLabel(o,t)),typeof n>"u"&&(n=String(o.length)),$N(t,this.domNode,n,[this.domId]),this.domNode.classList.add("dragging"),this.currentDragData=new $y(o),hae.CurrentDragAndDropData=new Zqe(o),this.dnd.onDragStart?.(this.currentDragData,t)}onPotentialSelectionStart(i){this.currentSelectionDisposable.dispose();let e=Ore(this.domNode),t=this.currentSelectionDisposable=new P,o=t.add(new P);o.add(j(this.domNode,"selectstart",()=>{o.add(j(e,"mousemove",n=>{e.getSelection()?.isCollapsed===!1&&this.setupDragAndDropScrollTopAnimation(n)})),t.add(Z(()=>{let n=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight);this.currentSelectionBounds=void 0,this.render(n,this.lastRenderTop,this.lastRenderHeight,void 0,void 0)})),t.add(j(e,"selectionchange",()=>{let n=e.getSelection();if(!n||n.isCollapsed){o.isDisposed&&t.dispose();return}let r=this.getIndexOfListElement(n.anchorNode),s=this.getIndexOfListElement(n.focusNode);r!==void 0&&s!==void 0&&(s<r&&([r,s]=[s,r]),this.currentSelectionBounds={start:r,end:s})}))})),o.add(j(e,"mouseup",()=>{o.dispose(),this.teardownDragAndDropScrollTopAnimation(),e.getSelection()?.isCollapsed!==!1&&t.dispose()}))}getIndexOfListElement(i){if(!(!i||!this.domNode.contains(i)))for(;i&&i!==this.domNode;){if(i.dataset?.index)return Number(i.dataset.index);i=i.parentElement}}onDragOver(i){if(i.browserEvent.preventDefault(),this.onDragLeaveTimeout.dispose(),hae.CurrentDragAndDropData&&hae.CurrentDragAndDropData.getData()==="vscode-ui"||(this.setupDragAndDropScrollTopAnimation(i.browserEvent),!i.browserEvent.dataTransfer))return!1;if(!this.currentDragData)if(hae.CurrentDragAndDropData)this.currentDragData=hae.CurrentDragAndDropData;else{if(!i.browserEvent.dataTransfer.types)return!1;this.currentDragData=new p1}let e=this.dnd.onDragOver(this.currentDragData,i.element,i.index,i.sector,i.browserEvent);if(this.canDrop=typeof e=="boolean"?e:e.accept,!this.canDrop)return this.currentDragFeedback=void 0,this.currentDragFeedbackDisposable.dispose(),!1;i.browserEvent.dataTransfer.dropEffect=typeof e!="boolean"&&e.effect?.type===0?"copy":"move";let t;typeof e!="boolean"&&e.feedback?t=e.feedback:typeof i.index>"u"?t=[-1]:t=[i.index],t=Uo(t).filter(n=>n>=-1&&n<this.length).sort((n,r)=>n-r),t=t[0]===-1?[-1]:t;let o=typeof e!="boolean"&&e.effect&&e.effect.position?e.effect.position:"drop-target";if(jNo(this.currentDragFeedback,t)&&this.currentDragFeedbackPosition===o)return!0;if(this.currentDragFeedback=t,this.currentDragFeedbackPosition=o,this.currentDragFeedbackDisposable.dispose(),t[0]===-1)this.domNode.classList.add(o),this.rowsContainer.classList.add(o),this.currentDragFeedbackDisposable=Z(()=>{this.domNode.classList.remove(o),this.rowsContainer.classList.remove(o)});else{if(t.length>1&&o!=="drop-target")throw new Error("Can't use multiple feedbacks with position different than 'over'");o==="drop-target-after"&&t[0]<this.length-1&&(t[0]+=1,o="drop-target-before");for(let n of t){let r=this.items[n];r.dropTarget=!0,r.row?.domNode.classList.add(o)}this.currentDragFeedbackDisposable=Z(()=>{for(let n of t){let r=this.items[n];r.dropTarget=!1,r.row?.domNode.classList.remove(o)}})}return!0}onDragLeave(i){this.onDragLeaveTimeout.dispose(),this.onDragLeaveTimeout=nn(()=>this.clearDragOverFeedback(),100,this.disposables),this.currentDragData&&this.dnd.onDragLeave?.(this.currentDragData,i.element,i.index,i.browserEvent)}onDrop(i){if(!this.canDrop)return;let e=this.currentDragData;this.teardownDragAndDropScrollTopAnimation(),this.clearDragOverFeedback(),this.domNode.classList.remove("dragging"),this.currentDragData=void 0,hae.CurrentDragAndDropData=void 0,!(!e||!i.browserEvent.dataTransfer)&&(i.browserEvent.preventDefault(),e.update(i.browserEvent.dataTransfer),this.dnd.drop(e,i.element,i.index,i.sector,i.browserEvent))}onDragEnd(i){this.canDrop=!1,this.teardownDragAndDropScrollTopAnimation(),this.clearDragOverFeedback(),this.domNode.classList.remove("dragging"),this.currentDragData=void 0,hae.CurrentDragAndDropData=void 0,this.dnd.onDragEnd?.(i)}clearDragOverFeedback(){this.currentDragFeedback=void 0,this.currentDragFeedbackPosition=void 0,this.currentDragFeedbackDisposable.dispose(),this.currentDragFeedbackDisposable=C.None}setupDragAndDropScrollTopAnimation(i){if(!this.dragOverAnimationDisposable){let e=gN(this.domNode).top;this.dragOverAnimationDisposable=Azi(Me(this.domNode),this.animateDragAndDropScrollTop.bind(this,e))}this.dragOverAnimationStopDisposable.dispose(),this.dragOverAnimationStopDisposable=nn(()=>{this.dragOverAnimationDisposable&&(this.dragOverAnimationDisposable.dispose(),this.dragOverAnimationDisposable=void 0)},1e3,this.disposables),this.dragOverMouseY=i.pageY}animateDragAndDropScrollTop(i){if(this.dragOverMouseY===void 0)return;let e=this.dragOverMouseY-i,t=this.renderHeight-35;e<35?this.scrollTop+=Math.max(-14,Math.floor(.3*(e-35))):e>t&&(this.scrollTop+=Math.min(14,Math.floor(.3*(e-t))))}teardownDragAndDropScrollTopAnimation(){this.dragOverAnimationStopDisposable.dispose(),this.dragOverAnimationDisposable&&(this.dragOverAnimationDisposable.dispose(),this.dragOverAnimationDisposable=void 0)}getTargetSector(i,e){if(e===void 0)return;let t=i.offsetY/this.items[e].size,o=Math.floor(t/.25);return Kn(o,0,3)}getItemIndexFromEventTarget(i){let e=this.scrollableElement.getDomNode(),t=i;for(;(Ao(t)||s7t(t))&&t!==this.rowsContainer&&e.contains(t);){let o=t.getAttribute("data-index");if(o){let n=Number(o);if(!isNaN(n))return n}t=t.parentElement}}getVisibleRange(i,e){return{start:this.rangeMap.indexAt(i),end:this.rangeMap.indexAfter(i+e-1)}}getRenderRange(i,e){let t=this.getVisibleRange(i,e);if(this.currentSelectionBounds){let o=this.rangeMap.count;t.start=Math.min(t.start,this.currentSelectionBounds.start,o),t.end=Math.min(Math.max(t.end,this.currentSelectionBounds.end+1),o)}return t}_rerender(i,e,t){let o=this.getRenderRange(i,e),n,r;i===this.elementTop(o.start)?(n=o.start,r=0):o.end-o.start>1&&(n=o.start+1,r=this.elementTop(n)-i);let s=0;for(;;){let l=this.getRenderRange(i,e),c=!1;for(let u=l.start;u<l.end;u++){let p=this.probeDynamicHeight(u);p!==0&&this.rangeMap.splice(u,1,[this.items[u]]),s+=p,c=c||p!==0}if(!c){s!==0&&this.eventuallyUpdateScrollDimensions();let u=qb.relativeComplement(o,l);for(let h of u)for(let g=h.start;g<h.end;g++)this.items[g].row&&this.removeItemFromDOM(g);let p=qb.relativeComplement(l,o).reverse();for(let h of p)for(let g=h.end-1;g>=h.start;g--)this.insertItemInDOM(g);for(let h=l.start;h<l.end;h++)this.items[h].row&&this.updateItemInDOM(this.items[h],h);if(typeof n=="number"){let h=this.scrollable.getFutureScrollPosition().scrollTop-i,g=this.elementTop(n)-r+h;this.setScrollTop(g,t)}this._onDidChangeContentHeight.fire(this.contentHeight);return}}}probeDynamicHeight(i){let e=this.items[i],t=this.probeDynamicHeightForItem(e,i);return t>0&&this.virtualDelegate.setDynamicHeight?.(e.element,e.size),t}probeDynamicHeightForItem(i,e){if(this.virtualDelegate.getDynamicHeight){let r=this.virtualDelegate.getDynamicHeight(i.element);if(r!==null){let s=i.size;return i.size=r,i.lastDynamicHeightWidth=this.renderWidth,r-s}}if(!i.hasDynamicHeight||i.lastDynamicHeightWidth===this.renderWidth||this.virtualDelegate.hasDynamicHeight&&!this.virtualDelegate.hasDynamicHeight(i.element))return 0;let t=i.size;if(i.row)return i.row.domNode.style.height="",i.size=i.row.domNode.offsetHeight,i.size===0&&(gs(i.row.domNode,Me(i.row.domNode).document.body)?console.warn("Measured item node at 0px- ensure that ListView is not display:none before measuring row height!",new Error().stack):console.warn("Measuring item node that is not in DOM! Add ListView to the DOM before measuring row height!",new Error().stack)),i.lastDynamicHeightWidth=this.renderWidth,i.size-t;let{row:o}=this.cache.alloc(i.templateId);o.domNode.style.height="",this.rowsContainer.appendChild(o.domNode);let n=this.renderers.get(i.templateId);if(!n)throw new ni("Missing renderer for templateId: "+i.templateId);return n.renderElement(i.element,e,o.templateData),i.size=o.domNode.offsetHeight,n.disposeElement?.(i.element,e,o.templateData),i.lastDynamicHeightWidth=this.renderWidth,o.domNode.remove(),this.cache.release(o),i.size-t}getElementDomId(i){return`${this.domId}_${i}`}dispose(){for(let i of this.items)if(i.dragStartDisposable.dispose(),i.checkedDisposable.dispose(),i.row){let e=this.renderers.get(i.row.templateId);e&&(e.disposeElement?.(i.element,-1,i.row.templateData,void 0),e.disposeTemplate(i.row.templateData))}this.items=[],this.domNode?.remove(),this.dragOverAnimationDisposable?.dispose(),this.disposables.dispose()}};I([mi],xL.prototype,"onMouseClick",1),I([mi],xL.prototype,"onMouseDblClick",1),I([mi],xL.prototype,"onMouseMiddleClick",1),I([mi],xL.prototype,"onMouseUp",1),I([mi],xL.prototype,"onMouseDown",1),I([mi],xL.prototype,"onMouseOver",1),I([mi],xL.prototype,"onMouseMove",1),I([mi],xL.prototype,"onMouseOut",1),I([mi],xL.prototype,"onContextMenu",1),I([mi],xL.prototype,"onTouchStart",1),I([mi],xL.prototype,"onTap",1);var Lye=xL;var eti=class{constructor(i){this.trait=i;this.renderedElements=[]}get templateId(){return`template:${this.trait.name}`}renderTemplate(i){return i}renderElement(i,e,t){let o=this.renderedElements.findIndex(n=>n.templateData===t);if(o>=0){let n=this.renderedElements[o];this.trait.unrender(t),n.index=e}else{let n={index:e,templateData:t};this.renderedElements.push(n)}this.trait.renderIndex(e,t)}splice(i,e,t){let o=[];for(let n of this.renderedElements)n.index<i?o.push(n):n.index>=i+e&&o.push({index:n.index+t-e,templateData:n.templateData});this.renderedElements=o}renderIndexes(i){for(let{index:e,templateData:t}of this.renderedElements)i.indexOf(e)>-1&&this.trait.renderIndex(e,t)}disposeTemplate(i){let e=this.renderedElements.findIndex(t=>t.templateData===i);e<0||this.renderedElements.splice(e,1)}},Rye=class{constructor(i){this._trait=i;this.indexes=[];this.sortedIndexes=[];this._onChange=new E}get onChange(){return this._onChange.event}get name(){return this._trait}get renderer(){return new eti(this)}splice(i,e,t){let o=t.length-e,n=i+e,r=[],s=0;for(;s<this.sortedIndexes.length&&this.sortedIndexes[s]<i;)r.push(this.sortedIndexes[s++]);for(let l=0;l<t.length;l++)t[l]&&r.push(l+i);for(;s<this.sortedIndexes.length&&this.sortedIndexes[s]>=n;)r.push(this.sortedIndexes[s++]+o);this.renderer.splice(i,e,t.length),this._set(r,r)}renderIndex(i,e){e.classList.toggle(this._trait,this.contains(i))}unrender(i){i.classList.remove(this._trait)}set(i,e){return this._set(i,[...i].sort(Zji),e)}_set(i,e,t){let o=this.indexes,n=this.sortedIndexes;this.indexes=i,this.sortedIndexes=e;let r=nti(n,i);return this.renderer.renderIndexes(r),this._onChange.fire({indexes:i,browserEvent:t}),o}get(){return this.indexes}contains(i){return cx(this.sortedIndexes,i,Zji)>=0}dispose(){Ue(this._onChange)}};I([mi],Rye.prototype,"renderer",1);var tti=class extends Rye{constructor(e){super("selected");this.setAriaSelected=e}renderIndex(e,t){super.renderIndex(e,t),this.setAriaSelected&&(this.contains(e)?t.setAttribute("aria-selected","true"):t.setAttribute("aria-selected","false"))}},ije=class{constructor(i,e,t){this.trait=i;this.view=e;this.identityProvider=t}splice(i,e,t){if(!this.identityProvider)return this.trait.splice(i,e,new Array(t.length).fill(!1));let o=this.trait.get().map(s=>this.identityProvider.getId(this.view.element(s)).toString());if(o.length===0)return this.trait.splice(i,e,new Array(t.length).fill(!1));let n=new Set(o),r=t.map(s=>n.has(this.identityProvider.getId(s).toString()));this.trait.splice(i,e,r)}};function oje(a,i){return a.classList.contains(i)?!0:a.classList.contains("monaco-list")||!a.parentElement?!1:oje(a.parentElement,i)}function G9(a){return oje(a,"monaco-editor")}function e5i(a){return oje(a,"monaco-custom-toggle")}function t5i(a){return oje(a,"action-item")}function Mye(a){return oje(a,"monaco-tree-sticky-row")}function Pye(a){return a.classList.contains("monaco-tree-sticky-container")}function lti(a){return a.tagName==="A"&&a.classList.contains("monaco-button")||a.tagName==="DIV"&&a.classList.contains("monaco-button-dropdown")?!0:a.classList.contains("monaco-list")||!a.parentElement?!1:lti(a.parentElement)}var Zbt=class{constructor(i,e,t){this.list=i;this.view=e;this.disposables=new P;this.multipleSelectionDisposables=new P;this.multipleSelectionSupport=t.multipleSelectionSupport,this.disposables.add(this.onKeyDown(o=>{switch(o.keyCode){case 3:return this.onEnter(o);case 16:return this.onUpArrow(o);case 18:return this.onDownArrow(o);case 11:return this.onPageUpArrow(o);case 12:return this.onPageDownArrow(o);case 9:return this.onEscape(o);case 31:this.multipleSelectionSupport&&(it?o.metaKey:o.ctrlKey)&&this.onCtrlA(o)}}))}get onKeyDown(){return H.chain(this.disposables.add(new On(this.view.domNode,"keydown")).event,i=>i.filter(e=>!Oh(e.target)).map(e=>new Ii(e)))}updateOptions(i){i.multipleSelectionSupport!==void 0&&(this.multipleSelectionSupport=i.multipleSelectionSupport)}onEnter(i){i.preventDefault(),i.stopPropagation(),this.list.setSelection(this.list.getFocus(),i.browserEvent)}onUpArrow(i){i.preventDefault(),i.stopPropagation(),this.list.focusPrevious(1,!1,i.browserEvent);let e=this.list.getFocus()[0];this.list.setAnchor(e),this.list.reveal(e),this.view.domNode.focus()}onDownArrow(i){i.preventDefault(),i.stopPropagation(),this.list.focusNext(1,!1,i.browserEvent);let e=this.list.getFocus()[0];this.list.setAnchor(e),this.list.reveal(e),this.view.domNode.focus()}onPageUpArrow(i){i.preventDefault(),i.stopPropagation(),this.list.focusPreviousPage(i.browserEvent);let e=this.list.getFocus()[0];this.list.setAnchor(e),this.list.reveal(e),this.view.domNode.focus()}onPageDownArrow(i){i.preventDefault(),i.stopPropagation(),this.list.focusNextPage(i.browserEvent);let e=this.list.getFocus()[0];this.list.setAnchor(e),this.list.reveal(e),this.view.domNode.focus()}onCtrlA(i){i.preventDefault(),i.stopPropagation();let e=ig(this.list.length),t=this.list.getFocus(),o=t.length>0?this.list.getElementGroupId(t[0]):void 0;o!==void 0&&(e=this.list.filterIndicesByGroup(e,o)),this.list.setSelection(e,i.browserEvent),this.list.setAnchor(void 0),this.view.domNode.focus()}onEscape(i){this.list.getSelection().length&&(i.preventDefault(),i.stopPropagation(),this.list.setSelection([],i.browserEvent),this.list.setAnchor(void 0),this.view.domNode.focus())}dispose(){this.disposables.dispose(),this.multipleSelectionDisposables.dispose()}};I([mi],Zbt.prototype,"onKeyDown",1);var cti=new class{mightProducePrintableCharacter(a){return a.ctrlKey||a.metaKey||a.altKey?!1:a.keyCode>=31&&a.keyCode<=56||a.keyCode>=21&&a.keyCode<=30||a.keyCode>=98&&a.keyCode<=107||a.keyCode>=85&&a.keyCode<=95}},iti=class{constructor(i,e,t,o,n){this.list=i;this.view=e;this.keyboardNavigationLabelProvider=t;this.keyboardNavigationEventFilter=o;this.delegate=n;this.enabled=!1;this.state=0;this.mode=0;this.triggered=!1;this.previouslyFocused=-1;this.enabledDisposables=new P;this.disposables=new P;this.updateOptions(i.options)}updateOptions(i){i.typeNavigationEnabled??!0?this.enable():this.disable(),this.mode=i.typeNavigationMode??0}trigger(){this.triggered=!this.triggered}enable(){if(this.enabled)return;let i=!1,e=H.chain(this.enabledDisposables.add(new On(this.view.domNode,"keydown")).event,n=>n.filter(r=>!Oh(r.target)).filter(()=>this.mode===0||this.triggered).map(r=>new Ii(r)).filter(r=>i||this.keyboardNavigationEventFilter(r)).filter(r=>this.delegate.mightProducePrintableCharacter(r)).forEach(r=>$t.stop(r,!0)).map(r=>r.browserEvent.key)),t=H.debounce(e,()=>null,800,void 0,void 0,void 0,this.enabledDisposables);H.reduce(H.any(e,t),(n,r)=>r===null?null:(n||"")+r,void 0,this.enabledDisposables)(this.onInput,this,this.enabledDisposables),t(this.onClear,this,this.enabledDisposables),e(()=>i=!0,void 0,this.enabledDisposables),t(()=>i=!1,void 0,this.enabledDisposables),this.enabled=!0,this.triggered=!1}disable(){this.enabled&&(this.enabledDisposables.clear(),this.enabled=!1,this.triggered=!1)}onClear(){let i=this.list.getFocus();if(i.length>0&&i[0]===this.previouslyFocused){let e=this.list.options.accessibilityProvider?.getAriaLabel(this.list.element(i[0]));typeof e=="string"?Jo(e):e&&Jo(e.get())}this.previouslyFocused=-1}onInput(i){if(!i){this.state=0,this.triggered=!1;return}let e=this.list.getFocus(),t=e.length>0?e[0]:0,o=this.state===0?1:0;this.state=1;for(let n=0;n<this.list.length;n++){let r=(t+n+o)%this.list.length,s=this.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(this.view.element(r)),l=s&&s.toString();if(this.list.options.typeNavigationEnabled){if(typeof l<"u"){if(pae(i,l)){this.previouslyFocused=t,this.list.setFocus([r]),this.list.reveal(r);return}let c=Dye(i,l);if(c&&c[0].end-c[0].start>1&&c.length===1){this.previouslyFocused=t,this.list.setFocus([r]),this.list.reveal(r);return}}}else if(typeof l>"u"||pae(i,l)){this.previouslyFocused=t,this.list.setFocus([r]),this.list.reveal(r);return}}}dispose(){this.disable(),this.enabledDisposables.dispose(),this.disposables.dispose()}},oti=class{constructor(i,e){this.list=i;this.view=e;this.disposables=new P;let t=H.chain(this.disposables.add(new On(e.domNode,"keydown")).event,n=>n.filter(r=>!Oh(r.target)).map(r=>new Ii(r)));H.chain(t,n=>n.filter(r=>r.keyCode===2&&!r.ctrlKey&&!r.metaKey&&!r.shiftKey&&!r.altKey))(this.onTab,this,this.disposables)}onTab(i){if(i.target!==this.view.domNode)return;let e=this.list.getFocus();if(e.length===0)return;let t=this.view.domElement(e[0]);if(!t)return;let o=t.querySelector("[tabIndex]");if(!o||!Ao(o)||o.tabIndex===-1)return;let n=Me(o).getComputedStyle(o);n.visibility==="hidden"||n.display==="none"||(i.preventDefault(),i.stopPropagation(),o.focus())}dispose(){this.disposables.dispose()}};function dti(a){return it?a.browserEvent.metaKey:a.browserEvent.ctrlKey}function uti(a){return a.browserEvent.shiftKey}function QNo(a){return Vp(a)&&a.button===2}var Jji={isSelectionSingleChangeEvent:dti,isSelectionRangeChangeEvent:uti},gae=class{constructor(i){this.list=i;this.disposables=new P;this._onPointer=this.disposables.add(new E);i.options.multipleSelectionSupport!==!1&&(this.multipleSelectionController=this.list.options.multipleSelectionController||Jji),this.mouseSupport=typeof i.options.mouseSupport>"u"||!!i.options.mouseSupport,this.mouseSupport&&(i.onMouseDown(this.onMouseDown,this,this.disposables),i.onContextMenu(this.onContextMenu,this,this.disposables),i.onMouseDblClick(this.onDoubleClick,this,this.disposables),i.onTouchStart(this.onMouseDown,this,this.disposables),this.disposables.add(ws.addTarget(i.getHTMLElement()))),H.any(i.onMouseClick,i.onMouseMiddleClick,i.onTap)(this.onViewPointer,this,this.disposables)}get onPointer(){return this._onPointer.event}updateOptions(i){i.multipleSelectionSupport!==void 0&&(this.multipleSelectionController=void 0,i.multipleSelectionSupport&&(this.multipleSelectionController=this.list.options.multipleSelectionController||Jji))}isSelectionSingleChangeEvent(i){return this.multipleSelectionController?this.multipleSelectionController.isSelectionSingleChangeEvent(i):!1}isSelectionRangeChangeEvent(i){return this.multipleSelectionController?this.multipleSelectionController.isSelectionRangeChangeEvent(i):!1}isSelectionChangeEvent(i){return this.isSelectionSingleChangeEvent(i)||this.isSelectionRangeChangeEvent(i)}onMouseDown(i){G9(i.browserEvent.target)||Pn()!==i.browserEvent.target&&this.list.domFocus()}onContextMenu(i){if(Oh(i.browserEvent.target)||G9(i.browserEvent.target))return;let e=typeof i.index>"u"?[]:[i.index];this.list.setFocus(e,i.browserEvent)}onViewPointer(i){if(!this.mouseSupport||Oh(i.browserEvent.target)||G9(i.browserEvent.target)||i.browserEvent.isHandledByList)return;i.browserEvent.isHandledByList=!0;let e=i.index;if(typeof e>"u"){this.list.setFocus([],i.browserEvent),this.list.setSelection([],i.browserEvent),this.list.setAnchor(void 0);return}if(this.isSelectionChangeEvent(i))return this.changeSelection(i);this.list.setFocus([e],i.browserEvent),this.list.setAnchor(e),QNo(i.browserEvent)||this.list.getElementGroupId(e)!==mae&&this.list.setSelection([e],i.browserEvent),this._onPointer.fire(i)}onDoubleClick(i){if(Oh(i.browserEvent.target)||G9(i.browserEvent.target)||this.isSelectionChangeEvent(i)||i.browserEvent.isHandledByList)return;i.browserEvent.isHandledByList=!0;let e=this.list.getFocus();this.list.setSelection(e,i.browserEvent)}changeSelection(i){let e=i.index,t=this.list.getAnchor();if(this.isSelectionRangeChangeEvent(i)){typeof t>"u"&&(t=this.list.getFocus()[0]??e,this.list.setAnchor(t));let o=Math.min(t,e),n=Math.max(t,e),r=ig(o,n+1),s=this.list.getSelection()[0];if(s!==void 0){let p=this.list.getElementGroupId(s);p!==void 0&&(r=this.list.filterIndicesByGroup(r,p))}let l=this.list.getSelection(),c=XNo(nti(l,[t]),t);if(c.length===0)return;let u=nti(r,JNo(l,c));this.list.setSelection(u,i.browserEvent),this.list.setFocus([e],i.browserEvent)}else if(this.isSelectionSingleChangeEvent(i)){let o=this.list.getSelection(),n=o.filter(s=>s!==e);this.list.setFocus([e]),this.list.setAnchor(e);let r=this.list.getElementGroupId(e);if(r===mae)return;if(o.length===n.length){let s=r!==void 0?this.list.filterIndicesByGroup([...n,e],r):[...n,e];this.list.setSelection(s,i.browserEvent)}else this.list.setSelection(n,i.browserEvent)}}dispose(){this.disposables.dispose()}},fae=class{constructor(i,e){this.styleElement=i;this.selectorSuffix=e}style(i){let e=this.selectorSuffix&&`.${this.selectorSuffix}`,t=[];i.listBackground&&t.push(`.monaco-list${e} .monaco-list-rows { background: ${i.listBackground}; }`),i.listFocusBackground&&(t.push(`.monaco-list${e}:focus .monaco-list-row.focused { background-color: ${i.listFocusBackground}; }`),t.push(`.monaco-list${e}:focus .monaco-list-row.focused:hover { background-color: ${i.listFocusBackground}; }`)),i.listFocusForeground&&t.push(`.monaco-list${e}:focus .monaco-list-row.focused { color: ${i.listFocusForeground}; }`),i.listActiveSelectionBackground&&(t.push(`.monaco-list${e}:focus .monaco-list-row.selected { background-color: ${i.listActiveSelectionBackground}; }`),t.push(`.monaco-list${e}:focus .monaco-list-row.selected:hover { background-color: ${i.listActiveSelectionBackground}; }`)),i.listActiveSelectionForeground&&t.push(`.monaco-list${e}:focus .monaco-list-row.selected { color: ${i.listActiveSelectionForeground}; }`),i.listActiveSelectionIconForeground&&t.push(`.monaco-list${e}:focus .monaco-list-row.selected .codicon { color: ${i.listActiveSelectionIconForeground}; }`),i.listFocusAndSelectionBackground&&t.push(`
.monaco-drag-image${e},
.monaco-list${e}:focus .monaco-list-row.selected.focused { background-color: ${i.listFocusAndSelectionBackground}; }
`),i.listFocusAndSelectionForeground&&t.push(`
.monaco-drag-image${e},
.monaco-list${e}:focus .monaco-list-row.selected.focused { color: ${i.listFocusAndSelectionForeground}; }
`),i.listInactiveFocusForeground&&(t.push(`.monaco-list${e} .monaco-list-row.focused { color: ${i.listInactiveFocusForeground}; }`),t.push(`.monaco-list${e} .monaco-list-row.focused:hover { color: ${i.listInactiveFocusForeground}; }`)),i.listInactiveSelectionIconForeground&&t.push(`.monaco-list${e} .monaco-list-row.focused .codicon { color: ${i.listInactiveSelectionIconForeground}; }`),i.listInactiveFocusBackground&&(t.push(`.monaco-list${e} .monaco-list-row.focused { background-color: ${i.listInactiveFocusBackground}; }`),t.push(`.monaco-list${e} .monaco-list-row.focused:hover { background-color: ${i.listInactiveFocusBackground}; }`)),i.listInactiveSelectionBackground&&(t.push(`.monaco-list${e} .monaco-list-row.selected { background-color: ${i.listInactiveSelectionBackground}; }`),t.push(`.monaco-list${e} .monaco-list-row.selected:hover { background-color: ${i.listInactiveSelectionBackground}; }`)),i.listInactiveSelectionForeground&&t.push(`.monaco-list${e} .monaco-list-row.selected { color: ${i.listInactiveSelectionForeground}; }`),i.listHoverBackground&&t.push(`.monaco-list${e}:not(.drop-target):not(.dragging) .monaco-list-row:hover:not(.selected):not(.focused) { background-color: ${i.listHoverBackground}; }`),i.listHoverForeground&&t.push(`.monaco-list${e}:not(.drop-target):not(.dragging) .monaco-list-row:hover:not(.selected):not(.focused) { color: ${i.listHoverForeground}; }`);let o=n_(i.listFocusAndSelectionOutline,n_(i.listSelectionOutline,i.listFocusOutline??""));o&&t.push(`.monaco-list${e}:focus .monaco-list-row.focused.selected { outline: 1px solid ${o}; outline-offset: -1px;}`),i.listFocusOutline&&t.push(`
.monaco-drag-image${e},
.monaco-list${e}:focus .monaco-list-row.focused,
.context-menu-visible .monaco-list${e}.last-focused .monaco-list-row.focused { outline: 1px solid ${i.listFocusOutline}; outline-offset: -1px; }
`);let n=n_(i.listSelectionOutline,i.listInactiveFocusOutline??"");n&&t.push(`.monaco-list${e} .monaco-list-row.focused.selected { outline: 1px dotted ${n}; outline-offset: -1px; }`),i.listSelectionOutline&&t.push(`.monaco-list${e} .monaco-list-row.selected { outline: 1px dotted ${i.listSelectionOutline}; outline-offset: -1px; }`),i.listInactiveFocusOutline&&t.push(`.monaco-list${e} .monaco-list-row.focused { outline: 1px dotted ${i.listInactiveFocusOutline}; outline-offset: -1px; }`),i.listHoverOutline&&t.push(`.monaco-list${e} .monaco-list-row:hover { outline: 1px dashed ${i.listHoverOutline}; outline-offset: -1px; }`),i.listDropOverBackground&&t.push(`
.monaco-list${e}.drop-target,
.monaco-list${e} .monaco-list-rows.drop-target,
.monaco-list${e} .monaco-list-row.drop-target { background-color: ${i.listDropOverBackground} !important; color: inherit !important; }
`),i.listDropBetweenBackground&&(t.push(`
.monaco-list${e} .monaco-list-rows.drop-target-before .monaco-list-row:first-child::before,
.monaco-list${e} .monaco-list-row.drop-target-before::before {
content: ""; position: absolute; top: 0px; left: 0px; width: 100%; height: 1px;
background-color: ${i.listDropBetweenBackground};
}`),t.push(`
.monaco-list${e} .monaco-list-rows.drop-target-after .monaco-list-row:last-child::after,
.monaco-list${e} .monaco-list-row.drop-target-after::after {
content: ""; position: absolute; bottom: 0px; left: 0px; width: 100%; height: 1px;
background-color: ${i.listDropBetweenBackground};
}`)),i.tableColumnsBorder&&t.push(`
.monaco-table > .monaco-split-view2,
.monaco-table > .monaco-split-view2 .monaco-sash.vertical::before,
.monaco-enable-motion .monaco-table:hover > .monaco-split-view2,
.monaco-enable-motion .monaco-table:hover > .monaco-split-view2 .monaco-sash.vertical::before {
border-color: ${i.tableColumnsBorder};
}
.monaco-enable-motion .monaco-table > .monaco-split-view2,
.monaco-enable-motion .monaco-table > .monaco-split-view2 .monaco-sash.vertical::before {
border-color: transparent;
}
`),i.tableOddRowsBackgroundColor&&t.push(`
.monaco-table .monaco-list-row[data-parity=odd]:not(.focused):not(.selected):not(:hover) .monaco-table-tr,
.monaco-table .monaco-list:not(:focus) .monaco-list-row[data-parity=odd].focused:not(.selected):not(:hover) .monaco-table-tr,
.monaco-table .monaco-list:not(.focused) .monaco-list-row[data-parity=odd].focused:not(.selected):not(:hover) .monaco-table-tr {
background-color: ${i.tableOddRowsBackgroundColor};
}
`),this.styleElement.textContent=t.join(`
`)}},eSt={listFocusBackground:"#7FB0D0",listActiveSelectionBackground:"#0E639C",listActiveSelectionForeground:"#FFFFFF",listActiveSelectionIconForeground:"#FFFFFF",listFocusAndSelectionOutline:"#90C2F9",listFocusAndSelectionBackground:"#094771",listFocusAndSelectionForeground:"#FFFFFF",listInactiveSelectionBackground:"#3F3F46",listInactiveSelectionIconForeground:"#FFFFFF",listHoverBackground:"#2A2D2E",listDropOverBackground:"#383B3D",listDropBetweenBackground:"#EEEEEE",treeIndentGuidesStroke:"#a9a9a9",treeInactiveIndentGuidesStroke:Oe.fromHex("#a9a9a9").transparent(.4).toString(),tableColumnsBorder:Oe.fromHex("#cccccc").transparent(.2).toString(),tableOddRowsBackgroundColor:Oe.fromHex("#cccccc").transparent(.04).toString(),listBackground:void 0,listFocusForeground:void 0,listInactiveSelectionForeground:void 0,listInactiveFocusForeground:void 0,listInactiveFocusBackground:void 0,listHoverForeground:void 0,listFocusOutline:void 0,listInactiveFocusOutline:void 0,listSelectionOutline:void 0,listHoverOutline:void 0,treeStickyScrollBackground:void 0,treeStickyScrollBorder:void 0,treeStickyScrollShadow:void 0},YNo={keyboardSupport:!0,mouseSupport:!0,multipleSelectionSupport:!0,dnd:{getDragURI(){return null},onDragStart(){},onDragOver(){return!1},drop(){},dispose(){}}};function XNo(a,i){let e=a.indexOf(i);if(e===-1)return[];let t=[],o=e-1;for(;o>=0&&a[o]===i-(e-o);)t.push(a[o--]);for(t.reverse(),o=e;o<a.length&&a[o]===i+(o-e);)t.push(a[o++]);return t}function nti(a,i){let e=[],t=0,o=0;for(;t<a.length||o<i.length;)if(t>=a.length)e.push(i[o++]);else if(o>=i.length)e.push(a[t++]);else if(a[t]===i[o]){e.push(a[t]),t++,o++;continue}else a[t]<i[o]?e.push(a[t++]):e.push(i[o++]);return e}function JNo(a,i){let e=[],t=0,o=0;for(;t<a.length||o<i.length;)if(t>=a.length)e.push(i[o++]);else if(o>=i.length)e.push(a[t++]);else if(a[t]===i[o]){t++,o++;continue}else a[t]<i[o]?e.push(a[t++]):o++;return e}var Zji=(a,i)=>a-i,rti=class{constructor(i,e){this._templateId=i;this.renderers=e}get templateId(){return this._templateId}renderTemplate(i){return this.renderers.map(e=>e.renderTemplate(i))}renderElement(i,e,t,o){let n=0;for(let r of this.renderers)r.renderElement(i,e,t[n++],o)}disposeElement(i,e,t,o){let n=0;for(let r of this.renderers)r.disposeElement?.(i,e,t[n],o),n+=1}disposeTemplate(i){let e=0;for(let t of this.renderers)t.disposeTemplate(i[e++])}},sti=class{constructor(i){this.accessibilityProvider=i;this.templateId="a18n"}renderTemplate(i){return{container:i,disposables:new P}}renderElement(i,e,t){let o=this.accessibilityProvider.getAriaLabel(i),n=o&&typeof o!="string"?o:Oo(o);t.disposables.add(he(s=>{this.setAriaLabel(s.readObservable(n),t.container)}));let r=this.accessibilityProvider.getAriaLevel&&this.accessibilityProvider.getAriaLevel(i);typeof r=="number"?t.container.setAttribute("aria-level",`${r}`):t.container.removeAttribute("aria-level")}setAriaLabel(i,e){i?e.setAttribute("aria-label",i):e.removeAttribute("aria-label")}disposeElement(i,e,t){t.disposables.clear()}disposeTemplate(i){i.disposables.dispose()}},ati=class{constructor(i,e){this.list=i;this.dnd=e}getDragElements(i){let e=this.list.getSelectedElements();return e.indexOf(i)>-1?e:[i]}getDragURI(i){return this.dnd.getDragURI(i)}getDragLabel(i,e){if(this.dnd.getDragLabel)return this.dnd.getDragLabel(i,e)}onDragStart(i,e){this.dnd.onDragStart?.(i,e)}onDragOver(i,e,t,o,n){return this.dnd.onDragOver(i,e,t,o,n)}onDragLeave(i,e,t,o){this.dnd.onDragLeave?.(i,e,t,o)}onDragEnd(i){this.dnd.onDragEnd?.(i)}drop(i,e,t,o,n){this.dnd.drop(i,e,t,o,n)}dispose(){this.dnd.dispose()}},hc=class{constructor(i,e,t,o,n=YNo){this.user=i;this._options=n;this.focus=new Rye("focused");this.anchor=new Rye("anchor");this.eventBufferer=new eN;this._ariaLabel="";this.disposables=new P;this._onDidDispose=new E;this.onDidDispose=this._onDidDispose.event;let r=this._options.accessibilityProvider&&this._options.accessibilityProvider.getWidgetRole?this._options.accessibilityProvider?.getWidgetRole():"list";this.selection=new tti(r!=="listbox");let s=[this.focus.renderer,this.selection.renderer];this.accessibilityProvider=n.accessibilityProvider,this.accessibilityProvider&&(s.push(new sti(this.accessibilityProvider)),this.accessibilityProvider.onDidChangeActiveDescendant?.(this.onDidChangeActiveDescendant,this,this.disposables)),o=o.map(c=>new rti(c.templateId,[...s,c]));let l={...n,dnd:n.dnd&&new ati(this,n.dnd)};if(this.view=this.createListView(e,t,o,l),this.view.domNode.setAttribute("role",r),n.styleController)this.styleController=n.styleController(this.view.domId);else{let c=hr(this.view.domNode);this.styleController=new fae(c,this.view.domId)}if(this.spliceable=new Gbt([new ije(this.focus,this.view,n.identityProvider),new ije(this.selection,this.view,n.identityProvider),new ije(this.anchor,this.view,n.identityProvider),this.view]),this.disposables.add(this.focus),this.disposables.add(this.selection),this.disposables.add(this.anchor),this.disposables.add(this.view),this.disposables.add(this._onDidDispose),this.disposables.add(new oti(this,this.view)),(typeof n.keyboardSupport!="boolean"||n.keyboardSupport)&&(this.keyboardController=new Zbt(this,this.view,n),this.disposables.add(this.keyboardController)),n.keyboardNavigationLabelProvider){let c=n.keyboardNavigationDelegate||cti;this.typeNavigationController=new iti(this,this.view,n.keyboardNavigationLabelProvider,n.keyboardNavigationEventFilter??(()=>!0),c),this.disposables.add(this.typeNavigationController)}if(this.mouseController=this.createMouseController(n),this.disposables.add(this.mouseController),this.onDidChangeFocus(this._onFocusChange,this,this.disposables),this.onDidChangeSelection(this._onSelectionChange,this,this.disposables),this.accessibilityProvider){let c=this.accessibilityProvider.getWidgetAriaLabel(),u=c&&typeof c!="string"?c:Oo(c);this.disposables.add(he(p=>{this.ariaLabel=p.readObservable(u)}))}this._options.multipleSelectionSupport!==!1&&this.view.domNode.setAttribute("aria-multiselectable","true")}get onDidChangeFocus(){return H.map(this.eventBufferer.wrapEvent(this.focus.onChange),i=>this.toListEvent(i),this.disposables)}get onDidChangeSelection(){return H.map(this.eventBufferer.wrapEvent(this.selection.onChange),i=>this.toListEvent(i),this.disposables)}get domId(){return this.view.domId}get onDidScroll(){return this.view.onDidScroll}get onMouseClick(){return this.view.onMouseClick}get onMouseDblClick(){return this.view.onMouseDblClick}get onMouseMiddleClick(){return this.view.onMouseMiddleClick}get onPointer(){return this.mouseController.onPointer}get onMouseUp(){return this.view.onMouseUp}get onMouseDown(){return this.view.onMouseDown}get onMouseOver(){return this.view.onMouseOver}get onMouseMove(){return this.view.onMouseMove}get onMouseOut(){return this.view.onMouseOut}get onTouchStart(){return this.view.onTouchStart}get onTap(){return this.view.onTap}get onContextMenu(){let i=!1,e=H.chain(this.disposables.add(new On(this.view.domNode,"keydown")).event,n=>n.map(r=>new Ii(r)).filter(r=>i=r.keyCode===58||r.shiftKey&&r.keyCode===68).map(r=>$t.stop(r,!0)).filter(()=>!1)),t=H.chain(this.disposables.add(new On(this.view.domNode,"keyup")).event,n=>n.forEach(()=>i=!1).map(r=>new Ii(r)).filter(r=>r.keyCode===58||r.shiftKey&&r.keyCode===68).map(r=>$t.stop(r,!0)).map(({browserEvent:r})=>{let s=this.getFocus(),l=s.length?s[0]:void 0,c=typeof l<"u"?this.view.element(l):void 0,u=typeof l<"u"?this.view.domElement(l):this.view.domNode;return{index:l,element:c,anchor:u,browserEvent:r}})),o=H.chain(this.view.onContextMenu,n=>n.filter(r=>!i).map(({element:r,index:s,browserEvent:l})=>({element:r,index:s,anchor:new yn(Me(this.view.domNode),l),browserEvent:l})));return H.any(e,t,o)}get onKeyDown(){return this.disposables.add(new On(this.view.domNode,"keydown")).event}get onKeyUp(){return this.disposables.add(new On(this.view.domNode,"keyup")).event}get onKeyPress(){return this.disposables.add(new On(this.view.domNode,"keypress")).event}get onDidFocus(){return H.signal(this.disposables.add(new On(this.view.domNode,"focus",!0)).event)}get onDidBlur(){return H.signal(this.disposables.add(new On(this.view.domNode,"blur",!0)).event)}createListView(i,e,t,o){return new Lye(i,e,t,o)}createMouseController(i){return new gae(this)}updateOptions(i={}){this._options={...this._options,...i},this.typeNavigationController?.updateOptions(this._options),this._options.multipleSelectionController!==void 0&&(this._options.multipleSelectionSupport?this.view.domNode.setAttribute("aria-multiselectable","true"):this.view.domNode.removeAttribute("aria-multiselectable")),this.mouseController.updateOptions(i),this.keyboardController?.updateOptions(i),this.view.updateOptions(i)}get options(){return this._options}splice(i,e,t=[]){if(i<0||i>this.view.length)throw new CL(this.user,`Invalid start index: ${i}`);if(e<0)throw new CL(this.user,`Invalid delete count: ${e}`);e===0&&t.length===0||this.eventBufferer.bufferEvents(()=>this.spliceable.splice(i,e,t))}updateWidth(i){this.view.updateWidth(i)}updateElementHeight(i,e){this.view.updateElementHeight(i,e,null)}rerender(){this.view.rerender()}element(i){return this.view.element(i)}indexOf(i){return this.view.indexOf(i)}indexAt(i){return this.view.indexAt(i)}get length(){return this.view.length}get contentHeight(){return this.view.contentHeight}get contentWidth(){return this.view.contentWidth}get onDidChangeContentHeight(){return this.view.onDidChangeContentHeight}get onDidChangeContentWidth(){return this.view.onDidChangeContentWidth}get scrollTop(){return this.view.getScrollTop()}set scrollTop(i){this.view.setScrollTop(i)}get scrollLeft(){return this.view.getScrollLeft()}set scrollLeft(i){this.view.setScrollLeft(i)}get scrollHeight(){return this.view.scrollHeight}get renderHeight(){return this.view.renderHeight}get firstVisibleIndex(){return this.view.firstVisibleIndex}get firstMostlyVisibleIndex(){return this.view.firstMostlyVisibleIndex}get lastVisibleIndex(){return this.view.lastVisibleIndex}get ariaLabel(){return this._ariaLabel}set ariaLabel(i){this._ariaLabel=i,this.view.domNode.setAttribute("aria-label",i)}domFocus(){this.view.domNode.focus({preventScroll:!0})}layout(i,e){this.view.layout(i,e)}triggerTypeNavigation(){this.typeNavigationController?.trigger()}setSelection(i,e){for(let t of i)if(t<0||t>=this.length)throw new CL(this.user,`Invalid index ${t}`);i=i.filter(t=>this.getElementGroupId(t)!==mae),this.selection.set(i,e)}getSelection(){return this.selection.get()}getSelectedElements(){return this.getSelection().map(i=>this.view.element(i))}setAnchor(i){if(typeof i>"u"){this.anchor.set([]);return}if(i<0||i>=this.length)throw new CL(this.user,`Invalid index ${i}`);this.anchor.set([i])}getAnchor(){return this.anchor.get().at(0)}getAnchorElement(){let i=this.getAnchor();return typeof i>"u"?void 0:this.element(i)}getElementGroupId(i){let e=this.options.identityProvider;if(!e?.getGroupId)return;let t=this.element(i);return e.getGroupId(t)}filterIndicesByGroup(i,e){let t=this.options.identityProvider;return t?.getGroupId?e===mae?[]:i.filter(o=>{let n=this.element(o);return t.getGroupId(n)===e}):i}setFocus(i,e){for(let t of i)if(t<0||t>=this.length)throw new CL(this.user,`Invalid index ${t}`);this.focus.set(i,e)}focusNext(i=1,e=!1,t,o){if(this.length===0)return;let n=this.focus.get(),r=this.findNextIndex(n.length>0?n[0]+i:0,e,o);r>-1&&this.setFocus([r],t)}focusPrevious(i=1,e=!1,t,o){if(this.length===0)return;let n=this.focus.get(),r=this.findPreviousIndex(n.length>0?n[0]-i:0,e,o);r>-1&&this.setFocus([r],t)}async focusNextPage(i,e){let t=this.view.indexAt(this.view.getScrollTop()+this.view.renderHeight);t=t===0?0:t-1;let o=this.getFocus()[0];if(o!==t&&(o===void 0||t>o)){let n=this.findPreviousIndex(t,!1,e);n>-1&&o!==n?this.setFocus([n],i):this.setFocus([t],i)}else{let n=this.view.getScrollTop(),r=n+this.view.renderHeight;t>o&&(r-=this.view.elementHeight(t)),this.view.setScrollTop(r),this.view.getScrollTop()!==n&&(this.setFocus([]),await Pi(0),await this.focusNextPage(i,e))}}async focusPreviousPage(i,e,t=()=>0){let o,n=t(),r=this.view.getScrollTop()+n;r===0?o=this.view.indexAt(r):o=this.view.indexAfter(r-1);let s=this.getFocus()[0];if(s!==o&&(s===void 0||s>=o)){let l=this.findNextIndex(o,!1,e);l>-1&&s!==l?this.setFocus([l],i):this.setFocus([o],i)}else{let l=r;this.view.setScrollTop(r-this.view.renderHeight-n),this.view.getScrollTop()+t()!==l&&(this.setFocus([]),await Pi(0),await this.focusPreviousPage(i,e,t))}}focusLast(i,e){if(this.length===0)return;let t=this.findPreviousIndex(this.length-1,!1,e);t>-1&&this.setFocus([t],i)}focusFirst(i,e){this.focusNth(0,i,e)}focusNth(i,e,t){if(this.length===0)return;let o=this.findNextIndex(i,!1,t);o>-1&&this.setFocus([o],e)}findNextIndex(i,e=!1,t){for(let o=0;o<this.length;o++){if(i>=this.length&&!e)return-1;if(i=i%this.length,!t||t(this.element(i)))return i;i++}return-1}findPreviousIndex(i,e=!1,t){for(let o=0;o<this.length;o++){if(i<0&&!e)return-1;if(i=(this.length+i%this.length)%this.length,!t||t(this.element(i)))return i;i--}return-1}getFocus(){return this.focus.get()}getFocusedElements(){return this.getFocus().map(i=>this.view.element(i))}reveal(i,e,t=0){if(i<0||i>=this.length)throw new CL(this.user,`Invalid index ${i}`);let o=this.view.getScrollTop(),n=this.view.elementTop(i),r=this.view.elementHeight(i);if(Xo(e)){let s=r-this.view.renderHeight+t;this.view.setScrollTop(s*Kn(e,0,1)+n-t)}else{let s=n+r,l=o+this.view.renderHeight;n<o+t&&s>=l||(n<o+t||s>=l&&r>=this.view.renderHeight?this.view.setScrollTop(n-t):s>=l&&this.view.setScrollTop(s-this.view.renderHeight))}}getRelativeTop(i,e=0){if(i<0||i>=this.length)throw new CL(this.user,`Invalid index ${i}`);let t=this.view.getScrollTop(),o=this.view.elementTop(i),n=this.view.elementHeight(i);if(o<t+e||o+n>t+this.view.renderHeight)return null;let r=n-this.view.renderHeight+e;return Math.abs((t+e-o)/r)}isDOMFocused(){return sa(this.view.domNode)}getHTMLElement(){return this.view.domNode}getScrollableElement(){return this.view.scrollableElementDomNode}getElementID(i){return this.view.getElementDomId(i)}getElementTop(i){return this.view.elementTop(i)}style(i){this.styleController.style(i)}delegateScrollFromMouseWheelEvent(i){this.view.delegateScrollFromMouseWheelEvent(i)}toListEvent({indexes:i,browserEvent:e}){return{indexes:i,elements:i.map(t=>this.view.element(t)),browserEvent:e}}_onFocusChange(){let i=this.focus.get();this.view.domNode.classList.toggle("element-focused",i.length>0),this.onDidChangeActiveDescendant()}onDidChangeActiveDescendant(){let i=this.focus.get();if(i.length>0){let e;this.accessibilityProvider?.getActiveDescendantId&&(e=this.accessibilityProvider.getActiveDescendantId(this.view.element(i[0]))),this.view.domNode.setAttribute("aria-activedescendant",e||this.view.getElementDomId(i[0]))}else this.view.domNode.removeAttribute("aria-activedescendant")}_onSelectionChange(){let i=this.selection.get();this.view.domNode.classList.toggle("selection-none",i.length===0),this.view.domNode.classList.toggle("selection-single",i.length===1),this.view.domNode.classList.toggle("selection-multiple",i.length>1)}dispose(){this._onDidDispose.fire(),this.disposables.dispose(),this._onDidDispose.dispose()}};I([mi],hc.prototype,"onDidChangeFocus",1),I([mi],hc.prototype,"onDidChangeSelection",1),I([mi],hc.prototype,"onContextMenu",1),I([mi],hc.prototype,"onKeyDown",1),I([mi],hc.prototype,"onKeyUp",1),I([mi],hc.prototype,"onKeyPress",1),I([mi],hc.prototype,"onDidFocus",1),I([mi],hc.prototype,"onDidBlur",1);var ZNo="$(",mti=new RegExp(`\\$\\(${q.iconNameExpression}(?:${q.iconModifierExpression})?\\)`,"g"),eOo=new RegExp(`(\\\\)?${mti.source}`,"g");function i5i(a){return a.replace(eOo,(i,e)=>e?i:`\\${i}`)}var tOo=new RegExp(`\\\\${mti.source}`,"g");function o5i(a){return a.replace(tOo,i=>`\\${i}`)}var iOo=new RegExp(`(\\s)?(\\\\)?${mti.source}(\\s)?`,"g");function fu(a){return a.indexOf(ZNo)===-1?a:a.replace(iOo,(i,e,t,o)=>t?i:e||o||"")}function m1(a){return a?a.replace(/\$\((.*?)\)/g,(i,e)=>` ${e} `).trim():""}var pti=new RegExp(`\\$\\(${q.iconNameCharacter}+\\)`,"g");function IW(a){pti.lastIndex=0;let i="",e=[],t=0;for(;;){let o=pti.lastIndex,n=pti.exec(a),r=a.substring(o,n?.index);if(r.length>0){i+=r;for(let s=0;s<r.length;s++)e.push(t)}if(!n)break;t+=n[0].length}return{text:i,iconOffsets:e}}function gq(a,i,e=!1){let{text:t,iconOffsets:o}=i;if(!o||o.length===0)return Up(a,t,e);let n=Hw(t," "),r=t.length-n.length,s=Up(a,n,e);if(s)for(let l of s){let c=o[l.start+r]+r;l.start+=c,l.end+=c}return s}var xe=class a{static lift(i){let e=new a(i.value,i);return e.uris=i.uris,e.baseUri=i.baseUri?A.revive(i.baseUri):void 0,e}constructor(i="",e=!1){if(this.value=i,typeof this.value!="string")throw Br("value");typeof e=="boolean"?(this.isTrusted=e,this.supportThemeIcons=!1,this.supportHtml=!1,this.supportAlertSyntax=!1):(this.isTrusted=e.isTrusted??void 0,this.supportThemeIcons=e.supportThemeIcons??!1,this.supportHtml=e.supportHtml??!1,this.supportAlertSyntax=e.supportAlertSyntax??!1)}appendText(i,e=0){return this.value+=BM(this.supportThemeIcons?i5i(i):i).replace(/([ \t]+)/g,(t,o)=>" ".repeat(o.length)).replace(/\>/gm,"\\>").replace(/\n/g,e===1?`\\
`:`
`),this}appendMarkdown(i){return this.value+=i,this}appendCodeblock(i,e){return this.value+=`
${oOo(e,i)}
`,this}appendLink(i,e,t){return this.value+="[",this.value+=this._escape(e,"]"),this.value+="](",this.value+=this._escape(String(i),")"),t&&(this.value+=` "${this._escape(this._escape(t,'"'),")")}"`),this.value+=")",this}_escape(i,e){let t=new RegExp(Yr(e),"g");return i.replace(t,(o,n)=>i.charAt(n-1)!=="\\"?`\\${o}`:o)}};function yW(a){return Mr(a)?!a.value:Array.isArray(a)?a.every(yW):!0}function Mr(a){return a instanceof xe?!0:a&&typeof a=="object"?typeof a.value=="string"&&(typeof a.isTrusted=="boolean"||typeof a.isTrusted=="object"||a.isTrusted===void 0)&&(typeof a.supportThemeIcons=="boolean"||a.supportThemeIcons===void 0)&&(typeof a.supportAlertSyntax=="boolean"||a.supportAlertSyntax===void 0):!1}function nje(a,i){return a===i?!0:!a||!i?!1:a.value===i.value&&a.isTrusted===i.isTrusted&&a.supportThemeIcons===i.supportThemeIcons&&a.supportHtml===i.supportHtml&&a.supportAlertSyntax===i.supportAlertSyntax&&(a.baseUri===i.baseUri||!!a.baseUri&&!!i.baseUri&&Xe(A.from(a.baseUri),A.from(i.baseUri)))}function BM(a){return a.replace(/[\\`*_{}[\]()#+\-!~]/g,"\\$&")}function oOo(a,i){let e=a.match(/^`+/gm)?.reduce((o,n)=>o.length>n.length?o:n).length??0,t=e>=3?e+1:3;return[`${"`".repeat(t)}${i}`,a,`${"`".repeat(t)}`].join(`
`)}function rje(a){return a.replace(/"/g,""")}function tSt(a){return a&&a.replace(/\\([\\`*_{}[\]()#+\-.!~])/g,"$1")}function iSt(a){let i=[],e=a.split("|").map(o=>o.trim());a=e[0];let t=e[1];if(t){let o=/height=(\d+)/.exec(t),n=/width=(\d+)/.exec(t),r=o?o[1]:"",s=n?n[1]:"",l=isFinite(parseInt(s)),c=isFinite(parseInt(r));l&&i.push(`width="${s}"`),c&&i.push(`height="${r}"`)}return{href:a,dimensions:i}}function oSt(a,i,e,t=!0){return`[${t?BM(a):a}](${i}${e?` "${BM(e)}"`:""})`}function qy(a,i=!0){let e=ic(a.id,...a.arguments||[]).toString();return oSt(a.title,e,a.tooltip,i)}function ic(a,...i){return A.from({scheme:Y.command,path:a,query:i.length?encodeURIComponent(JSON.stringify(i)):void 0})}var vae=class{constructor(i){this._prefix=i,this._lastId=0}nextId(){return this._prefix+ ++this._lastId}},fq=new vae("id#");function gti(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Iae=gti();function c5i(a){Iae=a}var d5i=/[&<>"']/,rOo=new RegExp(d5i.source,"g"),u5i=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,sOo=new RegExp(u5i.source,"g"),aOo={"&":"&","<":"<",">":">",'"':""","'":"'"},n5i=a=>aOo[a];function HM(a,i){if(i){if(d5i.test(a))return a.replace(rOo,n5i)}else if(u5i.test(a))return a.replace(sOo,n5i);return a}var lOo=/(^|[^\[])\^/g;function Hh(a,i){let e=typeof a=="string"?a:a.source;i=i||"";let t={replace:(o,n)=>{let r=typeof n=="string"?n:n.source;return r=r.replace(lOo,"$1"),e=e.replace(o,r),t},getRegex:()=>new RegExp(e,i)};return t}function r5i(a){try{a=encodeURI(a).replace(/%25/g,"%")}catch{return null}return a}var lje={exec:()=>null};function s5i(a,i){let e=a.replace(/\|/g,(n,r,s)=>{let l=!1,c=r;for(;--c>=0&&s[c]==="\\";)l=!l;return l?"|":" |"}),t=e.split(/ \|/),o=0;if(t[0].trim()||t.shift(),t.length>0&&!t[t.length-1].trim()&&t.pop(),i)if(t.length>i)t.splice(i);else for(;t.length<i;)t.push("");for(;o<t.length;o++)t[o]=t[o].trim().replace(/\\\|/g,"|");return t}function sje(a,i,e){let t=a.length;if(t===0)return"";let o=0;for(;o<t;){let n=a.charAt(t-o-1);if(n===i&&!e)o++;else if(n!==i&&e)o++;else break}return a.slice(0,t-o)}function cOo(a,i){if(a.indexOf(i[1])===-1)return-1;let e=0;for(let t=0;t<a.length;t++)if(a[t]==="\\")t++;else if(a[t]===i[0])e++;else if(a[t]===i[1]&&(e--,e<0))return t;return-1}function a5i(a,i,e,t){let o=i.href,n=i.title?HM(i.title):null,r=a[1].replace(/\\([\[\]])/g,"$1");if(a[0].charAt(0)!=="!"){t.state.inLink=!0;let s={type:"link",raw:e,href:o,title:n,text:r,tokens:t.inlineTokens(r)};return t.state.inLink=!1,s}return{type:"image",raw:e,href:o,title:n,text:HM(r)}}function dOo(a,i){let e=a.match(/^(\s+)(?:```)/);if(e===null)return i;let t=e[1];return i.split(`
`).map(o=>{let n=o.match(/^\s+/);if(n===null)return o;let[r]=n;return r.length>=t.length?o.slice(t.length):o}).join(`
`)}var Nye=class{options;rules;lexer;constructor(i){this.options=i||Iae}space(i){let e=this.rules.block.newline.exec(i);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(i){let e=this.rules.block.code.exec(i);if(e){let t=e[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:sje(t,`
`)}}}fences(i){let e=this.rules.block.fences.exec(i);if(e){let t=e[0],o=dOo(t,e[3]||"");return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:o}}}heading(i){let e=this.rules.block.heading.exec(i);if(e){let t=e[2].trim();if(/#$/.test(t)){let o=sje(t,"#");(this.options.pedantic||!o||/ $/.test(o))&&(t=o.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(i){let e=this.rules.block.hr.exec(i);if(e)return{type:"hr",raw:sje(e[0],`
`)}}blockquote(i){let e=this.rules.block.blockquote.exec(i);if(e){let t=sje(e[0],`
`).split(`
`),o="",n="",r=[];for(;t.length>0;){let s=!1,l=[],c;for(c=0;c<t.length;c++)if(/^ {0,3}>/.test(t[c]))l.push(t[c]),s=!0;else if(!s)l.push(t[c]);else break;t=t.slice(c);let u=l.join(`
`),p=u.replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,`
$1`).replace(/^ {0,3}>[ \t]?/gm,"");o=o?`${o}
${u}`:u,n=n?`${n}
${p}`:p;let h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,r,!0),this.lexer.state.top=h,t.length===0)break;let g=r[r.length-1];if(g?.type==="code")break;if(g?.type==="blockquote"){let f=g,v=f.raw+`
`+t.join(`
`),b=this.blockquote(v);r[r.length-1]=b,o=o.substring(0,o.length-f.raw.length)+b.raw,n=n.substring(0,n.length-f.text.length)+b.text;break}else if(g?.type==="list"){let f=g,v=f.raw+`
`+t.join(`
`),b=this.list(v);r[r.length-1]=b,o=o.substring(0,o.length-g.raw.length)+b.raw,n=n.substring(0,n.length-f.raw.length)+b.raw,t=v.substring(r[r.length-1].raw.length).split(`
`);continue}}return{type:"blockquote",raw:o,tokens:r,text:n}}}list(i){let e=this.rules.block.list.exec(i);if(e){let t=e[1].trim(),o=t.length>1,n={type:"list",raw:"",ordered:o,start:o?+t.slice(0,-1):"",loose:!1,items:[]};t=o?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=o?t:"[*+-]");let r=new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),s=!1;for(;i;){let l=!1,c="",u="";if(!(e=r.exec(i))||this.rules.block.hr.test(i))break;c=e[0],i=i.substring(c.length);let p=e[2].split(`
`,1)[0].replace(/^\t+/,S=>" ".repeat(3*S.length)),h=i.split(`
`,1)[0],g=!p.trim(),f=0;if(this.options.pedantic?(f=2,u=p.trimStart()):g?f=e[1].length+1:(f=e[2].search(/[^ ]/),f=f>4?1:f,u=p.slice(f),f+=e[1].length),g&&/^ *$/.test(h)&&(c+=h+`
`,i=i.substring(h.length+1),l=!0),!l){let S=new RegExp(`^ {0,${Math.min(3,f-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),y=new RegExp(`^ {0,${Math.min(3,f-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),w=new RegExp(`^ {0,${Math.min(3,f-1)}}(?:\`\`\`|~~~)`),k=new RegExp(`^ {0,${Math.min(3,f-1)}}#`);for(;i;){let T=i.split(`
`,1)[0];if(h=T,this.options.pedantic&&(h=h.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),w.test(h)||k.test(h)||S.test(h)||y.test(i))break;if(h.search(/[^ ]/)>=f||!h.trim())u+=`
`+h.slice(f);else{if(g||p.search(/[^ ]/)>=4||w.test(p)||k.test(p)||y.test(p))break;u+=`
`+h}!g&&!h.trim()&&(g=!0),c+=T+`
`,i=i.substring(T.length+1),p=h.slice(f)}}n.loose||(s?n.loose=!0:/\n *\n *$/.test(c)&&(s=!0));let v=null,b;this.options.gfm&&(v=/^\[[ xX]\] /.exec(u),v&&(b=v[0]!=="[ ] ",u=u.replace(/^\[[ xX]\] +/,""))),n.items.push({type:"list_item",raw:c,task:!!v,checked:b,loose:!1,text:u,tokens:[]}),n.raw+=c}n.items[n.items.length-1].raw=n.items[n.items.length-1].raw.trimEnd(),n.items[n.items.length-1].text=n.items[n.items.length-1].text.trimEnd(),n.raw=n.raw.trimEnd();for(let l=0;l<n.items.length;l++)if(this.lexer.state.top=!1,n.items[l].tokens=this.lexer.blockTokens(n.items[l].text,[]),!n.loose){let c=n.items[l].tokens.filter(p=>p.type==="space"),u=c.length>0&&c.some(p=>/\n.*\n/.test(p.raw));n.loose=u}if(n.loose)for(let l=0;l<n.items.length;l++)n.items[l].loose=!0;return n}}html(i){let e=this.rules.block.html.exec(i);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(i){let e=this.rules.block.def.exec(i);if(e){let t=e[1].toLowerCase().replace(/\s+/g," "),o=e[2]?e[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",n=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:o,title:n}}}table(i){let e=this.rules.block.table.exec(i);if(!e||!/[:|]/.test(e[2]))return;let t=s5i(e[1]),o=e[2].replace(/^\||\| *$/g,"").split("|"),n=e[3]&&e[3].trim()?e[3].replace(/\n[ \t]*$/,"").split(`
`):[],r={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===o.length){for(let s of o)/^ *-+: *$/.test(s)?r.align.push("right"):/^ *:-+: *$/.test(s)?r.align.push("center"):/^ *:-+ *$/.test(s)?r.align.push("left"):r.align.push(null);for(let s=0;s<t.length;s++)r.header.push({text:t[s],tokens:this.lexer.inline(t[s]),header:!0,align:r.align[s]});for(let s of n)r.rows.push(s5i(s,r.header.length).map((l,c)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:r.align[c]})));return r}}lheading(i){let e=this.rules.block.lheading.exec(i);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(i){let e=this.rules.block.paragraph.exec(i);if(e){let t=e[1].charAt(e[1].length-1)===`
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(i){let e=this.rules.block.text.exec(i);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(i){let e=this.rules.inline.escape.exec(i);if(e)return{type:"escape",raw:e[0],text:HM(e[1])}}tag(i){let e=this.rules.inline.tag.exec(i);if(e)return!this.lexer.state.inLink&&/^<a /i.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(i){let e=this.rules.inline.link.exec(i);if(e){let t=e[2].trim();if(!this.options.pedantic&&/^</.test(t)){if(!/>$/.test(t))return;let r=sje(t.slice(0,-1),"\\");if((t.length-r.length)%2===0)return}else{let r=cOo(e[2],"()");if(r>-1){let l=(e[0].indexOf("!")===0?5:4)+e[1].length+r;e[2]=e[2].substring(0,r),e[0]=e[0].substring(0,l).trim(),e[3]=""}}let o=e[2],n="";if(this.options.pedantic){let r=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(o);r&&(o=r[1],n=r[3])}else n=e[3]?e[3].slice(1,-1):"";return o=o.trim(),/^</.test(o)&&(this.options.pedantic&&!/>$/.test(t)?o=o.slice(1):o=o.slice(1,-1)),a5i(e,{href:o&&o.replace(this.rules.inline.anyPunctuation,"$1"),title:n&&n.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer)}}reflink(i,e){let t;if((t=this.rules.inline.reflink.exec(i))||(t=this.rules.inline.nolink.exec(i))){let o=(t[2]||t[1]).replace(/\s+/g," "),n=e[o.toLowerCase()];if(!n){let r=t[0].charAt(0);return{type:"text",raw:r,text:r}}return a5i(t,n,t[0],this.lexer)}}emStrong(i,e,t=""){let o=this.rules.inline.emStrongLDelim.exec(i);if(!o||o[3]&&t.match(/[\p{L}\p{N}]/u))return;if(!(o[1]||o[2]||"")||!t||this.rules.inline.punctuation.exec(t)){let r=[...o[0]].length-1,s,l,c=r,u=0,p=o[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(p.lastIndex=0,e=e.slice(-1*i.length+r);(o=p.exec(e))!=null;){if(s=o[1]||o[2]||o[3]||o[4]||o[5]||o[6],!s)continue;if(l=[...s].length,o[3]||o[4]){c+=l;continue}else if((o[5]||o[6])&&r%3&&!((r+l)%3)){u+=l;continue}if(c-=l,c>0)continue;l=Math.min(l,l+c+u);let h=[...o[0]][0].length,g=i.slice(0,r+o.index+h+l);if(Math.min(r,l)%2){let v=g.slice(1,-1);return{type:"em",raw:g,text:v,tokens:this.lexer.inlineTokens(v)}}let f=g.slice(2,-2);return{type:"strong",raw:g,text:f,tokens:this.lexer.inlineTokens(f)}}}}codespan(i){let e=this.rules.inline.code.exec(i);if(e){let t=e[2].replace(/\n/g," "),o=/[^ ]/.test(t),n=/^ /.test(t)&&/ $/.test(t);return o&&n&&(t=t.substring(1,t.length-1)),t=HM(t,!0),{type:"codespan",raw:e[0],text:t}}}br(i){let e=this.rules.inline.br.exec(i);if(e)return{type:"br",raw:e[0]}}del(i){let e=this.rules.inline.del.exec(i);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(i){let e=this.rules.inline.autolink.exec(i);if(e){let t,o;return e[2]==="@"?(t=HM(e[1]),o="mailto:"+t):(t=HM(e[1]),o=t),{type:"link",raw:e[0],text:t,href:o,tokens:[{type:"text",raw:t,text:t}]}}}url(i){let e;if(e=this.rules.inline.url.exec(i)){let t,o;if(e[2]==="@")t=HM(e[0]),o="mailto:"+t;else{let n;do n=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(n!==e[0]);t=HM(e[0]),e[1]==="www."?o="http://"+e[0]:o=e[0]}return{type:"link",raw:e[0],text:t,href:o,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(i){let e=this.rules.inline.text.exec(i);if(e){let t;return this.lexer.state.inRawBlock?t=e[0]:t=HM(e[0]),{type:"text",raw:e[0],text:t}}}},uOo=/^(?: *(?:\n|$))+/,pOo=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,mOo=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,dje=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,hOo=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,p5i=/(?:[*+-]|\d{1,9}[.)])/,m5i=Hh(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,p5i).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(),fti=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,gOo=/^[^\n]+/,vti=/(?!\s*\])(?:\\.|[^\[\]\\])+/,fOo=Hh(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",vti).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),vOo=Hh(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,p5i).getRegex(),sSt="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",bti=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,bOo=Hh("^ {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",bti).replace("tag",sSt).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),h5i=Hh(fti).replace("hr",dje).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",sSt).getRegex(),SOo=Hh(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",h5i).getRegex(),Sti={blockquote:SOo,code:pOo,def:fOo,fences:mOo,heading:hOo,hr:dje,html:bOo,lheading:m5i,list:vOo,newline:uOo,paragraph:h5i,table:lje,text:gOo},l5i=Hh("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",dje).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",sSt).getRegex(),IOo={...Sti,table:l5i,paragraph:Hh(fti).replace("hr",dje).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",l5i).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",sSt).getRegex()},yOo={...Sti,html:Hh(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",bti).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:lje,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Hh(fti).replace("hr",dje).replace("heading",` *#{1,6} *[^
]`).replace("lheading",m5i).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},g5i=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,wOo=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,f5i=/^( {2,}|\\)\n(?!\s*$)/,COo=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,uje="\\p{P}\\p{S}",xOo=Hh(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,uje).getRegex(),kOo=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,EOo=Hh(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,uje).getRegex(),TOo=Hh("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,uje).getRegex(),_Oo=Hh("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,uje).getRegex(),DOo=Hh(/\\([punct])/,"gu").replace(/punct/g,uje).getRegex(),LOo=Hh(/^<(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(),ROo=Hh(bti).replace("(?:-->|$)","-->").getRegex(),MOo=Hh("^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",ROo).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),rSt=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,POo=Hh(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",rSt).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),v5i=Hh(/^!?\[(label)\]\[(ref)\]/).replace("label",rSt).replace("ref",vti).getRegex(),b5i=Hh(/^!?\[(ref)\](?:\[\])?/).replace("ref",vti).getRegex(),AOo=Hh("reflink|nolink(?!\\()","g").replace("reflink",v5i).replace("nolink",b5i).getRegex(),Iti={_backpedal:lje,anyPunctuation:DOo,autolink:LOo,blockSkip:kOo,br:f5i,code:wOo,del:lje,emStrongLDelim:EOo,emStrongRDelimAst:TOo,emStrongRDelimUnd:_Oo,escape:g5i,link:POo,nolink:b5i,punctuation:xOo,reflink:v5i,reflinkSearch:AOo,tag:MOo,text:COo,url:lje},NOo={...Iti,link:Hh(/^!?\[(label)\]\((.*?)\)/).replace("label",rSt).getRegex(),reflink:Hh(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",rSt).getRegex()},hti={...Iti,escape:Hh(g5i).replace("])","~|])").getRegex(),url:Hh(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},OOo={...hti,br:Hh(f5i).replace("{2,}","*").getRegex(),text:Hh(hti.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},nSt={normal:Sti,gfm:IOo,pedantic:yOo},aje={normal:Iti,gfm:hti,breaks:OOo,pedantic:NOo},vq=class a{tokens;options;state;tokenizer;inlineQueue;constructor(i){this.tokens=[],this.tokens.links=Object.create(null),this.options=i||Iae,this.options.tokenizer=this.options.tokenizer||new Nye,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let e={block:nSt.normal,inline:aje.normal};this.options.pedantic?(e.block=nSt.pedantic,e.inline=aje.pedantic):this.options.gfm&&(e.block=nSt.gfm,this.options.breaks?e.inline=aje.breaks:e.inline=aje.gfm),this.tokenizer.rules=e}static get rules(){return{block:nSt,inline:aje}}static lex(i,e){return new a(e).lex(i)}static lexInline(i,e){return new a(e).inlineTokens(i)}lex(i){i=i.replace(/\r\n|\r/g,`
`),this.blockTokens(i,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(i,e=[],t=!1){this.options.pedantic?i=i.replace(/\t/g," ").replace(/^ +$/gm,""):i=i.replace(/^( *)(\t+)/gm,(s,l,c)=>l+" ".repeat(c.length));let o,n,r;for(;i;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(s=>(o=s.call({lexer:this},i,e))?(i=i.substring(o.raw.length),e.push(o),!0):!1))){if(o=this.tokenizer.space(i)){i=i.substring(o.raw.length),o.raw.length===1&&e.length>0?e[e.length-1].raw+=`
`:e.push(o);continue}if(o=this.tokenizer.code(i)){i=i.substring(o.raw.length),n=e[e.length-1],n&&(n.type==="paragraph"||n.type==="text")?(n.raw+=`
`+o.raw,n.text+=`
`+o.text,this.inlineQueue[this.inlineQueue.length-1].src=n.text):e.push(o);continue}if(o=this.tokenizer.fences(i)){i=i.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.heading(i)){i=i.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.hr(i)){i=i.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.blockquote(i)){i=i.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.list(i)){i=i.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.html(i)){i=i.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.def(i)){i=i.substring(o.raw.length),n=e[e.length-1],n&&(n.type==="paragraph"||n.type==="text")?(n.raw+=`
`+o.raw,n.text+=`
`+o.raw,this.inlineQueue[this.inlineQueue.length-1].src=n.text):this.tokens.links[o.tag]||(this.tokens.links[o.tag]={href:o.href,title:o.title});continue}if(o=this.tokenizer.table(i)){i=i.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.lheading(i)){i=i.substring(o.raw.length),e.push(o);continue}if(r=i,this.options.extensions&&this.options.extensions.startBlock){let s=1/0,l=i.slice(1),c;this.options.extensions.startBlock.forEach(u=>{c=u.call({lexer:this},l),typeof c=="number"&&c>=0&&(s=Math.min(s,c))}),s<1/0&&s>=0&&(r=i.substring(0,s+1))}if(this.state.top&&(o=this.tokenizer.paragraph(r))){n=e[e.length-1],t&&n?.type==="paragraph"?(n.raw+=`
`+o.raw,n.text+=`
`+o.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=n.text):e.push(o),t=r.length!==i.length,i=i.substring(o.raw.length);continue}if(o=this.tokenizer.text(i)){i=i.substring(o.raw.length),n=e[e.length-1],n&&n.type==="text"?(n.raw+=`
`+o.raw,n.text+=`
`+o.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=n.text):e.push(o);continue}if(i){let s="Infinite loop on byte: "+i.charCodeAt(0);if(this.options.silent){console.error(s);break}else throw new Error(s)}}return this.state.top=!0,e}inline(i,e=[]){return this.inlineQueue.push({src:i,tokens:e}),e}inlineTokens(i,e=[]){let t,o,n,r=i,s,l,c;if(this.tokens.links){let u=Object.keys(this.tokens.links);if(u.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)u.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,s.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;i;)if(l||(c=""),l=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(u=>(t=u.call({lexer:this},i,e))?(i=i.substring(t.raw.length),e.push(t),!0):!1))){if(t=this.tokenizer.escape(i)){i=i.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.tag(i)){i=i.substring(t.raw.length),o=e[e.length-1],o&&t.type==="text"&&o.type==="text"?(o.raw+=t.raw,o.text+=t.text):e.push(t);continue}if(t=this.tokenizer.link(i)){i=i.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.reflink(i,this.tokens.links)){i=i.substring(t.raw.length),o=e[e.length-1],o&&t.type==="text"&&o.type==="text"?(o.raw+=t.raw,o.text+=t.text):e.push(t);continue}if(t=this.tokenizer.emStrong(i,r,c)){i=i.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.codespan(i)){i=i.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.br(i)){i=i.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.del(i)){i=i.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.autolink(i)){i=i.substring(t.raw.length),e.push(t);continue}if(!this.state.inLink&&(t=this.tokenizer.url(i))){i=i.substring(t.raw.length),e.push(t);continue}if(n=i,this.options.extensions&&this.options.extensions.startInline){let u=1/0,p=i.slice(1),h;this.options.extensions.startInline.forEach(g=>{h=g.call({lexer:this},p),typeof h=="number"&&h>=0&&(u=Math.min(u,h))}),u<1/0&&u>=0&&(n=i.substring(0,u+1))}if(t=this.tokenizer.inlineText(n)){i=i.substring(t.raw.length),t.raw.slice(-1)!=="_"&&(c=t.raw.slice(-1)),l=!0,o=e[e.length-1],o&&o.type==="text"?(o.raw+=t.raw,o.text+=t.text):e.push(t);continue}if(i){let u="Infinite loop on byte: "+i.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return e}},$9=class{options;parser;constructor(i){this.options=i||Iae}space(i){return""}code({text:i,lang:e,escaped:t}){let o=(e||"").match(/^\S*/)?.[0],n=i.replace(/\n$/,"")+`
`;return o?'<pre><code class="language-'+HM(o)+'">'+(t?n:HM(n,!0))+`</code></pre>
`:"<pre><code>"+(t?n:HM(n,!0))+`</code></pre>
`}blockquote({tokens:i}){return`<blockquote>
${this.parser.parse(i)}</blockquote>
`}html({text:i}){return i}heading({tokens:i,depth:e}){return`<h${e}>${this.parser.parseInline(i)}</h${e}>
`}hr(i){return`<hr>
`}list(i){let e=i.ordered,t=i.start,o="";for(let s=0;s<i.items.length;s++){let l=i.items[s];o+=this.listitem(l)}let n=e?"ol":"ul",r=e&&t!==1?' start="'+t+'"':"";return"<"+n+r+`>
`+o+"</"+n+`>
`}listitem(i){let e="";if(i.task){let t=this.checkbox({checked:!!i.checked});i.loose?i.tokens.length>0&&i.tokens[0].type==="paragraph"?(i.tokens[0].text=t+" "+i.tokens[0].text,i.tokens[0].tokens&&i.tokens[0].tokens.length>0&&i.tokens[0].tokens[0].type==="text"&&(i.tokens[0].tokens[0].text=t+" "+i.tokens[0].tokens[0].text)):i.tokens.unshift({type:"text",raw:t+" ",text:t+" "}):e+=t+" "}return e+=this.parser.parse(i.tokens,!!i.loose),`<li>${e}</li>
`}checkbox({checked:i}){return"<input "+(i?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:i}){return`<p>${this.parser.parseInline(i)}</p>
`}table(i){let e="",t="";for(let n=0;n<i.header.length;n++)t+=this.tablecell(i.header[n]);e+=this.tablerow({text:t});let o="";for(let n=0;n<i.rows.length;n++){let r=i.rows[n];t="";for(let s=0;s<r.length;s++)t+=this.tablecell(r[s]);o+=this.tablerow({text:t})}return o&&(o=`<tbody>${o}</tbody>`),`<table>
<thead>
`+e+`</thead>
`+o+`</table>
`}tablerow({text:i}){return`<tr>
${i}</tr>
`}tablecell(i){let e=this.parser.parseInline(i.tokens),t=i.header?"th":"td";return(i.align?`<${t} align="${i.align}">`:`<${t}>`)+e+`</${t}>
`}strong({tokens:i}){return`<strong>${this.parser.parseInline(i)}</strong>`}em({tokens:i}){return`<em>${this.parser.parseInline(i)}</em>`}codespan({text:i}){return`<code>${i}</code>`}br(i){return"<br>"}del({tokens:i}){return`<del>${this.parser.parseInline(i)}</del>`}link({href:i,title:e,tokens:t}){let o=this.parser.parseInline(t),n=r5i(i);if(n===null)return o;i=n;let r='<a href="'+i+'"';return e&&(r+=' title="'+e+'"'),r+=">"+o+"</a>",r}image({href:i,title:e,text:t}){let o=r5i(i);if(o===null)return t;i=o;let n=`<img src="${i}" alt="${t}"`;return e&&(n+=` title="${e}"`),n+=">",n}text(i){return"tokens"in i&&i.tokens?this.parser.parseInline(i.tokens):i.text}},cje=class{strong({text:i}){return i}em({text:i}){return i}codespan({text:i}){return i}del({text:i}){return i}html({text:i}){return i}text({text:i}){return i}link({text:i}){return""+i}image({text:i}){return""+i}br(){return""}},bq=class a{options;renderer;textRenderer;constructor(i){this.options=i||Iae,this.options.renderer=this.options.renderer||new $9,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new cje}static parse(i,e){return new a(e).parse(i)}static parseInline(i,e){return new a(e).parseInline(i)}parse(i,e=!0){let t="";for(let o=0;o<i.length;o++){let n=i[o];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[n.type]){let s=n,l=this.options.extensions.renderers[s.type].call({parser:this},s);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(s.type)){t+=l||"";continue}}let r=n;switch(r.type){case"space":{t+=this.renderer.space(r);continue}case"hr":{t+=this.renderer.hr(r);continue}case"heading":{t+=this.renderer.heading(r);continue}case"code":{t+=this.renderer.code(r);continue}case"table":{t+=this.renderer.table(r);continue}case"blockquote":{t+=this.renderer.blockquote(r);continue}case"list":{t+=this.renderer.list(r);continue}case"html":{t+=this.renderer.html(r);continue}case"paragraph":{t+=this.renderer.paragraph(r);continue}case"text":{let s=r,l=this.renderer.text(s);for(;o+1<i.length&&i[o+1].type==="text";)s=i[++o],l+=`
`+this.renderer.text(s);e?t+=this.renderer.paragraph({type:"paragraph",raw:l,text:l,tokens:[{type:"text",raw:l,text:l}]}):t+=l;continue}default:{let s='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return t}parseInline(i,e){e=e||this.renderer;let t="";for(let o=0;o<i.length;o++){let n=i[o];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[n.type]){let s=this.options.extensions.renderers[n.type].call({parser:this},n);if(s!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(n.type)){t+=s||"";continue}}let r=n;switch(r.type){case"escape":{t+=e.text(r);break}case"html":{t+=e.html(r);break}case"link":{t+=e.link(r);break}case"image":{t+=e.image(r);break}case"strong":{t+=e.strong(r);break}case"em":{t+=e.em(r);break}case"codespan":{t+=e.codespan(r);break}case"br":{t+=e.br(r);break}case"del":{t+=e.del(r);break}case"text":{t+=e.text(r);break}default:{let s='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return t}},Aye=class{options;constructor(i){this.options=i||Iae}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(i){return i}postprocess(i){return i}processAllTokens(i){return i}},bae=class{defaults=gti();options=this.setOptions;parse=this.parseMarkdown(vq.lex,bq.parse);parseInline=this.parseMarkdown(vq.lexInline,bq.parseInline);Parser=bq;Renderer=$9;TextRenderer=cje;Lexer=vq;Tokenizer=Nye;Hooks=Aye;constructor(...i){this.use(...i)}walkTokens(i,e){let t=[];for(let o of i)switch(t=t.concat(e.call(this,o)),o.type){case"table":{let n=o;for(let r of n.header)t=t.concat(this.walkTokens(r.tokens,e));for(let r of n.rows)for(let s of r)t=t.concat(this.walkTokens(s.tokens,e));break}case"list":{let n=o;t=t.concat(this.walkTokens(n.items,e));break}default:{let n=o;this.defaults.extensions?.childTokens?.[n.type]?this.defaults.extensions.childTokens[n.type].forEach(r=>{let s=n[r].flat(1/0);t=t.concat(this.walkTokens(s,e))}):n.tokens&&(t=t.concat(this.walkTokens(n.tokens,e)))}}return t}use(...i){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return i.forEach(t=>{let o={...t};if(o.async=this.defaults.async||o.async||!1,t.extensions&&(t.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){let r=e.renderers[n.name];r?e.renderers[n.name]=function(...s){let l=n.renderer.apply(this,s);return l===!1&&(l=r.apply(this,s)),l}:e.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||n.level!=="block"&&n.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let r=e[n.level];r?r.unshift(n.tokenizer):e[n.level]=[n.tokenizer],n.start&&(n.level==="block"?e.startBlock?e.startBlock.push(n.start):e.startBlock=[n.start]:n.level==="inline"&&(e.startInline?e.startInline.push(n.start):e.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(e.childTokens[n.name]=n.childTokens)}),o.extensions=e),t.renderer){let n=this.defaults.renderer||new $9(this.defaults);for(let r in t.renderer){if(!(r in n))throw new Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;let s=r,l=t.renderer[s],c=n[s];n[s]=(...u)=>{let p=l.apply(n,u);return p===!1&&(p=c.apply(n,u)),p||""}}o.renderer=n}if(t.tokenizer){let n=this.defaults.tokenizer||new Nye(this.defaults);for(let r in t.tokenizer){if(!(r in n))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;let s=r,l=t.tokenizer[s],c=n[s];n[s]=(...u)=>{let p=l.apply(n,u);return p===!1&&(p=c.apply(n,u)),p}}o.tokenizer=n}if(t.hooks){let n=this.defaults.hooks||new Aye;for(let r in t.hooks){if(!(r in n))throw new Error(`hook '${r}' does not exist`);if(r==="options")continue;let s=r,l=t.hooks[s],c=n[s];Aye.passThroughHooks.has(r)?n[s]=u=>{if(this.defaults.async)return Promise.resolve(l.call(n,u)).then(h=>c.call(n,h));let p=l.call(n,u);return c.call(n,p)}:n[s]=(...u)=>{let p=l.apply(n,u);return p===!1&&(p=c.apply(n,u)),p}}o.hooks=n}if(t.walkTokens){let n=this.defaults.walkTokens,r=t.walkTokens;o.walkTokens=function(s){let l=[];return l.push(r.call(this,s)),n&&(l=l.concat(n.call(this,s))),l}}this.defaults={...this.defaults,...o}}),this}setOptions(i){return this.defaults={...this.defaults,...i},this}lexer(i,e){return vq.lex(i,e??this.defaults)}parser(i,e){return bq.parse(i,e??this.defaults)}parseMarkdown(i,e){return(o,n)=>{let r={...n},s={...this.defaults,...r},l=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&r.async===!1)return l(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof o>"u"||o===null)return l(new Error("marked(): input parameter is undefined or null"));if(typeof o!="string")return l(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(o)+", string expected"));if(s.hooks&&(s.hooks.options=s),s.async)return Promise.resolve(s.hooks?s.hooks.preprocess(o):o).then(c=>i(c,s)).then(c=>s.hooks?s.hooks.processAllTokens(c):c).then(c=>s.walkTokens?Promise.all(this.walkTokens(c,s.walkTokens)).then(()=>c):c).then(c=>e(c,s)).then(c=>s.hooks?s.hooks.postprocess(c):c).catch(l);try{s.hooks&&(o=s.hooks.preprocess(o));let c=i(o,s);s.hooks&&(c=s.hooks.processAllTokens(c)),s.walkTokens&&this.walkTokens(c,s.walkTokens);let u=e(c,s);return s.hooks&&(u=s.hooks.postprocess(u)),u}catch(c){return l(c)}}}onError(i,e){return t=>{if(t.message+=`
Please report this to https://github.com/markedjs/marked.`,i){let o="<p>An error occurred:</p><pre>"+HM(t.message+"",!0)+"</pre>";return e?Promise.resolve(o):o}if(e)return Promise.reject(t);throw t}}},Sae=new bae;function Yc(a,i){return Sae.parse(a,i)}Yc.options=Yc.setOptions=function(a){return Sae.setOptions(a),Yc.defaults=Sae.defaults,c5i(Yc.defaults),Yc};Yc.getDefaults=gti;Yc.defaults=Iae;Yc.use=function(...a){return Sae.use(...a),Yc.defaults=Sae.defaults,c5i(Yc.defaults),Yc};Yc.walkTokens=function(a,i){return Sae.walkTokens(a,i)};Yc.parseInline=Sae.parseInline;Yc.Parser=bq;Yc.parser=bq.parse;Yc.Renderer=$9;Yc.TextRenderer=cje;Yc.Lexer=vq;Yc.lexer=vq.lex;Yc.Tokenizer=Nye;Yc.Hooks=Aye;Yc.parse=Yc;var bpr=Yc.options,Spr=Yc.setOptions,Ipr=Yc.use,S5i=Yc.walkTokens,ypr=Yc.parseInline,I5i=Yc,wpr=bq.parse,q9=vq.lex;var{entries:D5i,setPrototypeOf:y5i,isFrozen:FOo,getPrototypeOf:WOo,getOwnPropertyDescriptor:VOo}=Object,{freeze:s_,seal:qN,create:L5i}=Object,{apply:Tti,construct:_ti}=typeof Reflect<"u"&&Reflect;s_||(s_=function(i){return i});qN||(qN=function(i){return i});Tti||(Tti=function(i,e){for(var t=arguments.length,o=new Array(t>2?t-2:0),n=2;n<t;n++)o[n-2]=arguments[n];return i.apply(e,o)});_ti||(_ti=function(i){for(var e=arguments.length,t=new Array(e>1?e-1:0),o=1;o<e;o++)t[o-1]=arguments[o];return new i(...t)});var aSt=a_(Array.prototype.forEach),BOo=a_(Array.prototype.lastIndexOf),w5i=a_(Array.prototype.pop),mje=a_(Array.prototype.push),HOo=a_(Array.prototype.splice),cSt=a_(String.prototype.toLowerCase),yti=a_(String.prototype.toString),wti=a_(String.prototype.match),hje=a_(String.prototype.replace),UOo=a_(String.prototype.indexOf),zOo=a_(String.prototype.trim),wW=a_(Object.prototype.hasOwnProperty),r_=a_(RegExp.prototype.test),gje=KOo(TypeError);function a_(a){return function(i){i instanceof RegExp&&(i.lastIndex=0);for(var e=arguments.length,t=new Array(e>1?e-1:0),o=1;o<e;o++)t[o-1]=arguments[o];return Tti(a,i,t)}}function KOo(a){return function(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return _ti(a,e)}}function Zd(a,i){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:cSt;y5i&&y5i(a,null);let t=i.length;for(;t--;){let o=i[t];if(typeof o=="string"){let n=e(o);n!==o&&(FOo(i)||(i[t]=n),o=n)}a[o]=!0}return a}function GOo(a){for(let i=0;i<a.length;i++)wW(a,i)||(a[i]=null);return a}function Sq(a){let i=L5i(null);for(let[e,t]of D5i(a))wW(a,e)&&(Array.isArray(t)?i[e]=GOo(t):t&&typeof t=="object"&&t.constructor===Object?i[e]=Sq(t):i[e]=t);return i}function fje(a,i){for(;a!==null;){let t=VOo(a,i);if(t){if(t.get)return a_(t.get);if(typeof t.value=="function")return a_(t.value)}a=WOo(a)}function e(){return null}return e}var C5i=s_(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Cti=s_(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","slot","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),xti=s_(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),$Oo=s_(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),kti=s_(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),qOo=s_(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),x5i=s_(["#text"]),k5i=s_(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Eti=s_(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),E5i=s_(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),lSt=s_(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),jOo=qN(/\{\{[\w\W]*|[\w\W]*\}\}/gm),QOo=qN(/<%[\w\W]*|[\w\W]*%>/gm),YOo=qN(/\$\{[\w\W]*/gm),XOo=qN(/^data-[\-\w.\u00B7-\uFFFF]+$/),JOo=qN(/^aria-[\-\w]+$/),R5i=qN(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ZOo=qN(/^(?:\w+script|data):/i),eFo=qN(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),M5i=qN(/^html$/i),tFo=qN(/^[a-z][.\w]*(-[.\w]+)+$/i),T5i=Object.freeze({__proto__:null,ARIA_ATTR:JOo,ATTR_WHITESPACE:eFo,CUSTOM_ELEMENT:tFo,DATA_ATTR:XOo,DOCTYPE_NAME:M5i,ERB_EXPR:QOo,IS_ALLOWED_URI:R5i,IS_SCRIPT_OR_DATA:ZOo,MUSTACHE_EXPR:jOo,TMPLIT_EXPR:YOo}),vje={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},iFo=function(){return typeof window>"u"?null:window},oFo=function(i,e){if(typeof i!="object"||typeof i.createPolicy!="function")return null;let t=null,o="data-tt-policy-suffix";e&&e.hasAttribute(o)&&(t=e.getAttribute(o));let n="dompurify"+(t?"#"+t:"");try{return i.createPolicy(n,{createHTML(r){return r},createScriptURL(r){return r}})}catch{return console.warn("TrustedTypes policy "+n+" could not be created."),null}},_5i=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function P5i(){let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:iFo(),i=Ia=>P5i(Ia);if(i.version="3.2.7",i.removed=[],!a||!a.document||a.document.nodeType!==vje.document||!a.Element)return i.isSupported=!1,i;let{document:e}=a,t=e,o=t.currentScript,{DocumentFragment:n,HTMLTemplateElement:r,Node:s,Element:l,NodeFilter:c,NamedNodeMap:u=a.NamedNodeMap||a.MozNamedAttrMap,HTMLFormElement:p,DOMParser:h,trustedTypes:g}=a,f=l.prototype,v=fje(f,"cloneNode"),b=fje(f,"remove"),S=fje(f,"nextSibling"),y=fje(f,"childNodes"),w=fje(f,"parentNode");if(typeof r=="function"){let Ia=e.createElement("template");Ia.content&&Ia.content.ownerDocument&&(e=Ia.content.ownerDocument)}let k,T="",{implementation:N,createNodeIterator:O,createDocumentFragment:V,getElementsByTagName:U}=e,{importNode:G}=t,$=_5i();i.isSupported=typeof D5i=="function"&&typeof w=="function"&&N&&N.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:te,ERB_EXPR:pe,TMPLIT_EXPR:de,DATA_ATTR:se,ARIA_ATTR:Se,IS_SCRIPT_OR_DATA:ke,ATTR_WHITESPACE:Ee,CUSTOM_ELEMENT:He}=T5i,{IS_ALLOWED_URI:Ve}=T5i,Fe=null,Qt=Zd({},[...C5i,...Cti,...xti,...kti,...x5i]),Ze=null,Ti=Zd({},[...k5i,...Eti,...E5i,...lSt]),ti=Object.seal(L5i(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),bo=null,Ro=null,_o=!0,sr=!0,ln=!1,en=!0,Ws=!1,ba=!0,Id=!1,Dg=!1,yd=!1,uu=!1,Jm=!1,Dh=!1,Rp=!0,Uv=!1,Cr="user-content-",sx=!0,Lg=!1,Nw={},gp=null,uf=Zd({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),KG=null,e6=Zd({},["audio","video","img","source","image","track"]),ax=null,II=Zd({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ut="http://www.w3.org/1998/Math/MathML",_i="http://www.w3.org/2000/svg",eo="http://www.w3.org/1999/xhtml",Ar=eo,na=!1,Rg=null,wo=Zd({},[Ut,_i,eo],yti),tn=Zd({},["mi","mo","mn","ms","mtext"]),Pt=Zd({},["annotation-xml"]),Ke=Zd({},["title","style","font","a","script"]),ye=null,Be=["application/xhtml+xml","text/html"],Tt="text/html",Ht=null,Do=null,io=e.createElement("form"),xr=function(hi){return hi instanceof RegExp||hi instanceof Function},oo=function(){let hi=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Do&&Do===hi)){if((!hi||typeof hi!="object")&&(hi={}),hi=Sq(hi),ye=Be.indexOf(hi.PARSER_MEDIA_TYPE)===-1?Tt:hi.PARSER_MEDIA_TYPE,Ht=ye==="application/xhtml+xml"?yti:cSt,Fe=wW(hi,"ALLOWED_TAGS")?Zd({},hi.ALLOWED_TAGS,Ht):Qt,Ze=wW(hi,"ALLOWED_ATTR")?Zd({},hi.ALLOWED_ATTR,Ht):Ti,Rg=wW(hi,"ALLOWED_NAMESPACES")?Zd({},hi.ALLOWED_NAMESPACES,yti):wo,ax=wW(hi,"ADD_URI_SAFE_ATTR")?Zd(Sq(II),hi.ADD_URI_SAFE_ATTR,Ht):II,KG=wW(hi,"ADD_DATA_URI_TAGS")?Zd(Sq(e6),hi.ADD_DATA_URI_TAGS,Ht):e6,gp=wW(hi,"FORBID_CONTENTS")?Zd({},hi.FORBID_CONTENTS,Ht):uf,bo=wW(hi,"FORBID_TAGS")?Zd({},hi.FORBID_TAGS,Ht):Sq({}),Ro=wW(hi,"FORBID_ATTR")?Zd({},hi.FORBID_ATTR,Ht):Sq({}),Nw=wW(hi,"USE_PROFILES")?hi.USE_PROFILES:!1,_o=hi.ALLOW_ARIA_ATTR!==!1,sr=hi.ALLOW_DATA_ATTR!==!1,ln=hi.ALLOW_UNKNOWN_PROTOCOLS||!1,en=hi.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ws=hi.SAFE_FOR_TEMPLATES||!1,ba=hi.SAFE_FOR_XML!==!1,Id=hi.WHOLE_DOCUMENT||!1,uu=hi.RETURN_DOM||!1,Jm=hi.RETURN_DOM_FRAGMENT||!1,Dh=hi.RETURN_TRUSTED_TYPE||!1,yd=hi.FORCE_BODY||!1,Rp=hi.SANITIZE_DOM!==!1,Uv=hi.SANITIZE_NAMED_PROPS||!1,sx=hi.KEEP_CONTENT!==!1,Lg=hi.IN_PLACE||!1,Ve=hi.ALLOWED_URI_REGEXP||R5i,Ar=hi.NAMESPACE||eo,tn=hi.MATHML_TEXT_INTEGRATION_POINTS||tn,Pt=hi.HTML_INTEGRATION_POINTS||Pt,ti=hi.CUSTOM_ELEMENT_HANDLING||{},hi.CUSTOM_ELEMENT_HANDLING&&xr(hi.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ti.tagNameCheck=hi.CUSTOM_ELEMENT_HANDLING.tagNameCheck),hi.CUSTOM_ELEMENT_HANDLING&&xr(hi.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ti.attributeNameCheck=hi.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),hi.CUSTOM_ELEMENT_HANDLING&&typeof hi.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ti.allowCustomizedBuiltInElements=hi.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ws&&(sr=!1),Jm&&(uu=!0),Nw&&(Fe=Zd({},x5i),Ze=[],Nw.html===!0&&(Zd(Fe,C5i),Zd(Ze,k5i)),Nw.svg===!0&&(Zd(Fe,Cti),Zd(Ze,Eti),Zd(Ze,lSt)),Nw.svgFilters===!0&&(Zd(Fe,xti),Zd(Ze,Eti),Zd(Ze,lSt)),Nw.mathMl===!0&&(Zd(Fe,kti),Zd(Ze,E5i),Zd(Ze,lSt))),hi.ADD_TAGS&&(Fe===Qt&&(Fe=Sq(Fe)),Zd(Fe,hi.ADD_TAGS,Ht)),hi.ADD_ATTR&&(Ze===Ti&&(Ze=Sq(Ze)),Zd(Ze,hi.ADD_ATTR,Ht)),hi.ADD_URI_SAFE_ATTR&&Zd(ax,hi.ADD_URI_SAFE_ATTR,Ht),hi.FORBID_CONTENTS&&(gp===uf&&(gp=Sq(gp)),Zd(gp,hi.FORBID_CONTENTS,Ht)),sx&&(Fe["#text"]=!0),Id&&Zd(Fe,["html","head","body"]),Fe.table&&(Zd(Fe,["tbody"]),delete bo.tbody),hi.TRUSTED_TYPES_POLICY){if(typeof hi.TRUSTED_TYPES_POLICY.createHTML!="function")throw gje('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof hi.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw gje('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');k=hi.TRUSTED_TYPES_POLICY,T=k.createHTML("")}else k===void 0&&(k=oFo(g,o)),k!==null&&typeof T=="string"&&(T=k.createHTML(""));s_&&s_(hi),Do=hi}},Gr=Zd({},[...Cti,...xti,...$Oo]),Sa=Zd({},[...kti,...qOo]),_r=function(hi){let zn=w(hi);(!zn||!zn.tagName)&&(zn={namespaceURI:Ar,tagName:"template"});let Ks=cSt(hi.tagName),Jf=cSt(zn.tagName);return Rg[hi.namespaceURI]?hi.namespaceURI===_i?zn.namespaceURI===eo?Ks==="svg":zn.namespaceURI===Ut?Ks==="svg"&&(Jf==="annotation-xml"||tn[Jf]):!!Gr[Ks]:hi.namespaceURI===Ut?zn.namespaceURI===eo?Ks==="math":zn.namespaceURI===_i?Ks==="math"&&Pt[Jf]:!!Sa[Ks]:hi.namespaceURI===eo?zn.namespaceURI===_i&&!Pt[Jf]||zn.namespaceURI===Ut&&!tn[Jf]?!1:!Sa[Ks]&&(Ke[Ks]||!Gr[Ks]):!!(ye==="application/xhtml+xml"&&Rg[hi.namespaceURI]):!1},sl=function(hi){mje(i.removed,{element:hi});try{w(hi).removeChild(hi)}catch{b(hi)}},Dd=function(hi,zn){try{mje(i.removed,{attribute:zn.getAttributeNode(hi),from:zn})}catch{mje(i.removed,{attribute:null,from:zn})}if(zn.removeAttribute(hi),hi==="is")if(uu||Jm)try{sl(zn)}catch{}else try{zn.setAttribute(hi,"")}catch{}},Ow=function(hi){let zn=null,Ks=null;if(yd)hi="<remove></remove>"+hi;else{let yI=wti(hi,/^[\r\n\t ]+/);Ks=yI&&yI[0]}ye==="application/xhtml+xml"&&Ar===eo&&(hi='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+hi+"</body></html>");let Jf=k?k.createHTML(hi):hi;if(Ar===eo)try{zn=new h().parseFromString(Jf,ye)}catch{}if(!zn||!zn.documentElement){zn=N.createDocument(Ar,"template",null);try{zn.documentElement.innerHTML=na?T:Jf}catch{}}let Vk=zn.body||zn.documentElement;return hi&&Ks&&Vk.insertBefore(e.createTextNode(Ks),Vk.childNodes[0]||null),Ar===eo?U.call(zn,Id?"html":"body")[0]:Id?zn.documentElement:Vk},sre=function(hi){return O.call(hi.ownerDocument||hi,hi,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},GG=function(hi){return hi instanceof p&&(typeof hi.nodeName!="string"||typeof hi.textContent!="string"||typeof hi.removeChild!="function"||!(hi.attributes instanceof u)||typeof hi.removeAttribute!="function"||typeof hi.setAttribute!="function"||typeof hi.namespaceURI!="string"||typeof hi.insertBefore!="function"||typeof hi.hasChildNodes!="function")},KHi=function(hi){return typeof s=="function"&&hi instanceof s};function $G(Ia,hi,zn){aSt(Ia,Ks=>{Ks.call(i,hi,zn,Do)})}let GHi=function(hi){let zn=null;if($G($.beforeSanitizeElements,hi,null),GG(hi))return sl(hi),!0;let Ks=Ht(hi.nodeName);if($G($.uponSanitizeElement,hi,{tagName:Ks,allowedTags:Fe}),ba&&hi.hasChildNodes()&&!KHi(hi.firstElementChild)&&r_(/<[/\w!]/g,hi.innerHTML)&&r_(/<[/\w!]/g,hi.textContent)||hi.nodeType===vje.progressingInstruction||ba&&hi.nodeType===vje.comment&&r_(/<[/\w]/g,hi.data))return sl(hi),!0;if(!Fe[Ks]||bo[Ks]){if(!bo[Ks]&&qHi(Ks)&&(ti.tagNameCheck instanceof RegExp&&r_(ti.tagNameCheck,Ks)||ti.tagNameCheck instanceof Function&&ti.tagNameCheck(Ks)))return!1;if(sx&&!gp[Ks]){let Jf=w(hi)||hi.parentNode,Vk=y(hi)||hi.childNodes;if(Vk&&Jf){let yI=Vk.length;for(let BD=yI-1;BD>=0;--BD){let qG=v(Vk[BD],!0);qG.__removalCount=(hi.__removalCount||0)+1,Jf.insertBefore(qG,S(hi))}}}return sl(hi),!0}return hi instanceof l&&!_r(hi)||(Ks==="noscript"||Ks==="noembed"||Ks==="noframes")&&r_(/<\/no(script|embed|frames)/i,hi.innerHTML)?(sl(hi),!0):(Ws&&hi.nodeType===vje.text&&(zn=hi.textContent,aSt([te,pe,de],Jf=>{zn=hje(zn,Jf," ")}),hi.textContent!==zn&&(mje(i.removed,{element:hi.cloneNode()}),hi.textContent=zn)),$G($.afterSanitizeElements,hi,null),!1)},$Hi=function(hi,zn,Ks){if(Rp&&(zn==="id"||zn==="name")&&(Ks in e||Ks in io))return!1;if(!(sr&&!Ro[zn]&&r_(se,zn))){if(!(_o&&r_(Se,zn))){if(!Ze[zn]||Ro[zn]){if(!(qHi(hi)&&(ti.tagNameCheck instanceof RegExp&&r_(ti.tagNameCheck,hi)||ti.tagNameCheck instanceof Function&&ti.tagNameCheck(hi))&&(ti.attributeNameCheck instanceof RegExp&&r_(ti.attributeNameCheck,zn)||ti.attributeNameCheck instanceof Function&&ti.attributeNameCheck(zn,hi))||zn==="is"&&ti.allowCustomizedBuiltInElements&&(ti.tagNameCheck instanceof RegExp&&r_(ti.tagNameCheck,Ks)||ti.tagNameCheck instanceof Function&&ti.tagNameCheck(Ks))))return!1}else if(!ax[zn]){if(!r_(Ve,hje(Ks,Ee,""))){if(!((zn==="src"||zn==="xlink:href"||zn==="href")&&hi!=="script"&&UOo(Ks,"data:")===0&&KG[hi])){if(!(ln&&!r_(ke,hje(Ks,Ee,"")))){if(Ks)return!1}}}}}}return!0},qHi=function(hi){return hi!=="annotation-xml"&&wti(hi,He)},jHi=function(hi){$G($.beforeSanitizeAttributes,hi,null);let{attributes:zn}=hi;if(!zn||GG(hi))return;let Ks={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ze,forceKeepAttr:void 0},Jf=zn.length;for(;Jf--;){let Vk=zn[Jf],{name:yI,namespaceURI:BD,value:qG}=Vk,Qve=Ht(yI),L6t=qG,lx=yI==="value"?L6t:zOo(L6t);if(Ks.attrName=Qve,Ks.attrValue=lx,Ks.keepAttr=!0,Ks.forceKeepAttr=void 0,$G($.uponSanitizeAttribute,hi,Ks),lx=Ks.attrValue,Uv&&(Qve==="id"||Qve==="name")&&(Dd(yI,hi),lx=Cr+lx),ba&&r_(/((--!?|])>)|<\/(style|title|textarea)/i,lx)){Dd(yI,hi);continue}if(Qve==="attributename"&&wti(lx,"href")){Dd(yI,hi);continue}if(Ks.forceKeepAttr)continue;if(!Ks.keepAttr){Dd(yI,hi);continue}if(!en&&r_(/\/>/i,lx)){Dd(yI,hi);continue}Ws&&aSt([te,pe,de],YHi=>{lx=hje(lx,YHi," ")});let QHi=Ht(hi.nodeName);if(!$Hi(QHi,Qve,lx)){Dd(yI,hi);continue}if(k&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!BD)switch(g.getAttributeType(QHi,Qve)){case"TrustedHTML":{lx=k.createHTML(lx);break}case"TrustedScriptURL":{lx=k.createScriptURL(lx);break}}if(lx!==L6t)try{BD?hi.setAttributeNS(BD,yI,lx):hi.setAttribute(yI,lx),GG(hi)?sl(hi):w5i(i.removed)}catch{Dd(yI,hi)}}$G($.afterSanitizeAttributes,hi,null)},ADo=function Ia(hi){let zn=null,Ks=sre(hi);for($G($.beforeSanitizeShadowDOM,hi,null);zn=Ks.nextNode();)$G($.uponSanitizeShadowNode,zn,null),GHi(zn),jHi(zn),zn.content instanceof n&&Ia(zn.content);$G($.afterSanitizeShadowDOM,hi,null)};return i.sanitize=function(Ia){let hi=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},zn=null,Ks=null,Jf=null,Vk=null;if(na=!Ia,na&&(Ia="<!-->"),typeof Ia!="string"&&!KHi(Ia))if(typeof Ia.toString=="function"){if(Ia=Ia.toString(),typeof Ia!="string")throw gje("dirty is not a string, aborting")}else throw gje("toString is not a function");if(!i.isSupported)return Ia;if(Dg||oo(hi),i.removed=[],typeof Ia=="string"&&(Lg=!1),Lg){if(Ia.nodeName){let qG=Ht(Ia.nodeName);if(!Fe[qG]||bo[qG])throw gje("root node is forbidden and cannot be sanitized in-place")}}else if(Ia instanceof s)zn=Ow("<!---->"),Ks=zn.ownerDocument.importNode(Ia,!0),Ks.nodeType===vje.element&&Ks.nodeName==="BODY"||Ks.nodeName==="HTML"?zn=Ks:zn.appendChild(Ks);else{if(!uu&&!Ws&&!Id&&Ia.indexOf("<")===-1)return k&&Dh?k.createHTML(Ia):Ia;if(zn=Ow(Ia),!zn)return uu?null:Dh?T:""}zn&&yd&&sl(zn.firstChild);let yI=sre(Lg?Ia:zn);for(;Jf=yI.nextNode();)GHi(Jf),jHi(Jf),Jf.content instanceof n&&ADo(Jf.content);if(Lg)return Ia;if(uu){if(Jm)for(Vk=V.call(zn.ownerDocument);zn.firstChild;)Vk.appendChild(zn.firstChild);else Vk=zn;return(Ze.shadowroot||Ze.shadowrootmode)&&(Vk=G.call(t,Vk,!0)),Vk}let BD=Id?zn.outerHTML:zn.innerHTML;return Id&&Fe["!doctype"]&&zn.ownerDocument&&zn.ownerDocument.doctype&&zn.ownerDocument.doctype.name&&r_(M5i,zn.ownerDocument.doctype.name)&&(BD="<!DOCTYPE "+zn.ownerDocument.doctype.name+`>
`+BD),Ws&&aSt([te,pe,de],qG=>{BD=hje(BD,qG," ")}),k&&Dh?k.createHTML(BD):BD},i.setConfig=function(){let Ia=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};oo(Ia),Dg=!0},i.clearConfig=function(){Do=null,Dg=!1},i.isValidAttribute=function(Ia,hi,zn){Do||oo({});let Ks=Ht(Ia),Jf=Ht(hi);return $Hi(Ks,Jf,zn)},i.addHook=function(Ia,hi){typeof hi=="function"&&mje($[Ia],hi)},i.removeHook=function(Ia,hi){if(hi!==void 0){let zn=BOo($[Ia],hi);return zn===-1?void 0:HOo($[Ia],zn,1)[0]}return w5i($[Ia])},i.removeHooks=function(Ia){$[Ia]=[]},i.removeAllHooks=function(){$=_5i()},i}var yae=P5i();var Lti=Object.freeze(["a","abbr","b","bdo","blockquote","br","caption","cite","code","col","colgroup","dd","del","details","dfn","div","dl","dt","em","figcaption","figure","h1","h2","h3","h4","h5","h6","hr","i","img","ins","kbd","label","li","mark","ol","p","pre","q","rp","rt","ruby","s","samp","small","small","source","span","strike","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","time","tr","tt","u","ul","var","video","wbr"]),N5i=Object.freeze(["href","target","src","alt","title","for","name","role","tabindex","x-dispatch","required","checked","placeholder","type","start","width","height","align"]),Dti="vscode-relative-path";function A5i(a,i){if(i.override==="*")return!0;try{let e=new URL(a,Dti+"://");return!!(i.override.includes(e.protocol.replace(/:$/,""))||i.allowRelativePaths&&e.protocol===Dti+":"&&!a.trim().toLowerCase().startsWith(Dti))}catch{return!1}}function nFo(a,i){yae.addHook("afterSanitizeAttributes",e=>{for(let t of["href","src"])if(e.hasAttribute(t)){let o=e.getAttribute(t);t==="href"?!o.startsWith("#")&&!A5i(o,a)&&e.removeAttribute(t):A5i(o,i)||e.removeAttribute(t)}})}var rFo=Object.freeze({ALLOWED_TAGS:[...Lti],ALLOWED_ATTR:[...N5i],ALLOW_UNKNOWN_PROTOCOLS:!0});function dSt(a,i){return O5i(a,i,"trusted")}function O5i(a,i,e){try{let t={...rFo};i?.allowedTags&&(i.allowedTags.override&&(t.ALLOWED_TAGS=[...i.allowedTags.override]),i.allowedTags.augment&&(t.ALLOWED_TAGS=[...t.ALLOWED_TAGS??[],...i.allowedTags.augment]));let o=[...N5i];i?.allowedAttributes&&(i.allowedAttributes.override&&(o=[...i.allowedAttributes.override]),i.allowedAttributes.augment&&(o=[...o,...i.allowedAttributes.augment])),o=o.map(s=>typeof s=="string"?s.toLowerCase():{attributeName:s.attributeName.toLowerCase(),shouldKeep:s.shouldKeep});let n=new Set(o.map(s=>typeof s=="string"?s:s.attributeName)),r=new Map;for(let s of o)typeof s=="string"?r.delete(s):r.set(s.attributeName,s);return t.ALLOWED_ATTR=Array.from(n),nFo({override:i?.allowedLinkProtocols?.override??[Y.http,Y.https],allowRelativePaths:i?.allowRelativeLinkPaths??!1},{override:i?.allowedMediaProtocols?.override??[Y.http,Y.https],allowRelativePaths:i?.allowRelativeMediaPaths??!1}),i?.replaceWithPlaintext&&yae.addHook("uponSanitizeElement",aFo),r.size&&yae.addHook("uponSanitizeAttribute",(s,l)=>{let c=r.get(l.attrName);if(c){let u=c.shouldKeep(s,l);typeof u=="string"?(l.keepAttr=!0,l.attrValue=u):l.keepAttr=u}else l.keepAttr=n.has(l.attrName)}),e==="dom"?yae.sanitize(a,{...t,RETURN_DOM_FRAGMENT:!0}):yae.sanitize(a,{...t,RETURN_TRUSTED_TYPE:!0})}finally{yae.removeAllHooks()}}var sFo=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],aFo=(a,i,e)=>{if(!i.allowedTags[i.tagName]&&i.tagName!=="body"){let t=Rti(a);t&&(a.nodeType===Node.COMMENT_NODE?a.parentElement?.insertBefore(t,a):a.parentElement?.replaceChild(t,a))}};function Rti(a){if(!a.ownerDocument)return;let i,e;if(a.nodeType===Node.COMMENT_NODE)i=`<!--${a.textContent}-->`;else if(a instanceof Element){let r=a.tagName.toLowerCase(),s=sFo.includes(r),l=a.attributes.length?" "+Array.from(a.attributes).map(c=>`${c.name}="${c.value}"`).join(" "):"";i=`<${r}${l}>`,s||(e=`</${r}>`)}else return;let t=document.createDocumentFragment(),o=a.ownerDocument.createTextNode(i);for(t.appendChild(o);a.firstChild;)t.appendChild(a.firstChild);let n=e?a.ownerDocument.createTextNode(e):void 0;return n&&t.appendChild(n),t}function Iq(a,i,e){let t=O5i(i,e,"dom");Fi(a,t)}var lFo=new RegExp(`(\\\\)?\\$\\((${q.iconNameExpression}(?:${q.iconModifierExpression})?)\\)`,"g");function Bn(a){let i=new Array,e,t=0,o=0;for(;(e=lFo.exec(a))!==null;){o=e.index||0,t<o&&i.push(a.substring(t,o)),t=(e.index||0)+e[0].length;let[,n,r]=e;i.push(n?`$(${r})`:Qo({id:r}))}return t<a.length&&i.push(a.substring(t)),i}function Qo(a){let i=_("span");return i.classList.add(...q.asClassNameArray(a)),i}var Mti=Object.freeze({image:({href:a,title:i,text:e})=>{let t=[],o=[];return a&&({href:a,dimensions:t}=iSt(a),o.push(`src="${rje(a)}"`)),e&&o.push(`alt="${rje(e)}"`),i&&o.push(`title="${rje(i)}"`),t.length&&(o=o.concat(t)),"<img "+o.join(" ")+">"},paragraph({tokens:a}){return`<p>${this.parser.parseInline(a)}</p>`},link({href:a,title:i,tokens:e}){let t=this.parser.parseInline(e);return typeof a!="string"?"":(a===t&&(t=tSt(t)),i=typeof i=="string"?rje(tSt(i)):"",a=tSt(a),a=a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),`<a href="${a}" title="${i||a}" draggable="false">${t}</a>`)}});function cFo(a){return function(i){let{tokens:e}=i,t=e[0];if(t?.type!=="paragraph")return a.call(this,i);let o=t.tokens;if(!o||o.length===0)return a.call(this,i);let n=o[0];if(n?.type!=="text")return a.call(this,i);let r=/^\s*\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]\s*?\n*/i,s=n.raw.match(r);if(!s)return a.call(this,i);n.raw=n.raw.replace(r,""),n.text=n.text.replace(r,"");let l={note:"info",tip:"light-bulb",important:"comment",warning:"alert",caution:"stop"},c=s[1],u=c.charAt(0).toUpperCase()+c.slice(1).toLowerCase(),p=c.toLowerCase(),h=Qo({id:l[p]}).outerHTML,g=this.parser.parse(e);return`<blockquote data-severity="${p}"><p><span>${h}${u}</span>${g.substring(3)}</blockquote>
`}}function nb(a,i={},e){let t=new P,o=!1,n=new bae(...i.markedExtensions??[]),{renderer:r,codeBlocks:s,syncCodeBlocks:l}=uFo(n,i,a),c=pFo(a),u;if(i.fillInIncompleteTokens){let f={...n.defaults,...i.markedOptions,renderer:r},v=n.lexer(c,f),b=xFo(v);u=n.parser(b,f)}else u=n.parse(c,{...i?.markedOptions,renderer:r,async:!1});a.supportThemeIcons&&(u=Bn(u).map(v=>typeof v=="string"?v:v.outerHTML).join(""));let p=document.createElement("div"),h=H5i(a,i.sanitizerConfig??{});Iq(p,u,h),dFo(a,i,p);let g;if(e?(g=e,Fi(e,...p.childNodes)):g=p,s.length>0)Promise.all(s).then(f=>{if(o)return;let v=new Map(f),b=g.querySelectorAll("div[data-code]");for(let S of b){let y=v.get(S.dataset.code??"");y&&Fi(S,y)}i.asyncRenderCallback?.()});else if(l.length>0){let f=new Map(l),v=g.querySelectorAll("div[data-code]");for(let b of v){let S=f.get(b.dataset.code??"");S&&Fi(b,S)}}if(i.asyncRenderCallback)for(let f of g.getElementsByTagName("img")){let v=t.add(j(f,"load",()=>{v.dispose(),i.asyncRenderCallback()}))}if(i.actionHandler){let f=v=>{let b=new yn(Me(g),v);!b.leftButton&&!b.middleButton||W5i(a,i,b)};t.add(j(g,"click",f)),t.add(j(g,"auxclick",f)),t.add(j(g,"keydown",v=>{let b=new Ii(v);!b.equals(10)&&!b.equals(3)||W5i(a,i,b)}))}for(let f of[...g.getElementsByTagName("input")])if(f.attributes.getNamedItem("type")?.value==="checkbox")f.setAttribute("disabled","");else if(i.sanitizerConfig?.replaceWithPlaintext){let v=Rti(f);v?f.parentElement?.replaceChild(v,f):f.remove()}else f.remove();return{element:g,dispose:()=>{o=!0,t.dispose()}}}function dFo(a,i,e){for(let t of e.querySelectorAll("img, audio, video, source")){let o=t.getAttribute("src");if(o){let n=o;try{a.baseUri&&(n=Pti(A.from(a.baseUri),n))}catch{}if(t.setAttribute("src",V5i(a,n,!0)),i.sanitizerConfig?.remoteImageIsAllowed){let r=A.parse(n);r.scheme!==Y.file&&r.scheme!==Y.data&&!i.sanitizerConfig.remoteImageIsAllowed(r)&&t.replaceWith(_("",void 0,t.outerHTML))}}}for(let t of e.querySelectorAll("a")){let o=t.getAttribute("href");if(t.setAttribute("href",""),!o||/^data:|javascript:/i.test(o)||/^command:/i.test(o)&&!a.isTrusted||/^command:(\/\/\/)?_workbench\.downloadResource/i.test(o))t.replaceWith(...t.childNodes);else{let n=V5i(a,o,!1);a.baseUri&&(n=Pti(A.from(a.baseUri),o)),t.dataset.href=n}}}function uFo(a,i,e){let t=new a.Renderer(i.markedOptions);t.image=Mti.image,t.link=Mti.link,t.paragraph=Mti.paragraph,e.supportAlertSyntax&&(t.blockquote=cFo(t.blockquote));let o=[],n=[];return i.codeBlockRendererSync?t.code=({text:r,lang:s,raw:l})=>{let c=fq.nextId(),u=i.codeBlockRendererSync(B5i(s),r,l);return n.push([c,u]),`<div class="code" data-code="${c}">${ur(r)}</div>`}:i.codeBlockRenderer&&(t.code=({text:r,lang:s})=>{let l=fq.nextId(),c=i.codeBlockRenderer(B5i(s),r);return o.push(c.then(u=>[l,u])),`<div class="code" data-code="${l}">${ur(r)}</div>`}),e.supportHtml||(t.html=({text:r})=>i.sanitizerConfig?.replaceWithPlaintext?ur(r):(e.isTrusted?r.match(/^(<span[^>]+>)|(<\/\s*span>)$/):void 0)?r:""),{renderer:t,codeBlocks:o,syncCodeBlocks:n}}function pFo(a){let i=a.value;return i.length>1e5&&(i=`${i.substr(0,1e5)}\u2026`),a.supportThemeIcons&&(i=o5i(i)),i}function W5i(a,i,e){let t=e.target.closest("a[data-href]");if(Ao(t))try{let o=t.dataset.href;o&&(a.baseUri&&(o=Pti(A.from(a.baseUri),o)),i.actionHandler?.(o,a))}catch(o){mt(o)}finally{e.preventDefault(),e.stopPropagation()}}function mFo(a,i){let e;try{e=zg(decodeURIComponent(i))}catch{}return e?(e=Gk(e,t=>{if(a.uris&&a.uris[t])return A.revive(a.uris[t])}),encodeURIComponent(JSON.stringify(e))):i}function V5i(a,i,e){let t=a.uris&&a.uris[i],o=A.revive(t);return e?i.startsWith(Y.data+":")?i:(o||(o=A.parse(i)),gn.uriToBrowserUri(o).toString(!0)):!o||A.parse(i).toString()===o.toString()?i:(o.query&&(o=o.with({query:mFo(a,o.query)})),o.toString())}function B5i(a){if(!a)return"";let i=a.split(/[\s+|:|,|\{|\?]/,1);return i.length?i[0]:a}function Pti(a,i){return/^\w[\w\d+.-]*:/.test(i)?i:a.path.endsWith("/")?m9t(a,i).toString():m9t(ci(a),i).toString()}function hFo(a,i,e={}){let t=H5i(i,e);return dSt(a,t)}var Ati=Object.freeze([...Lti,"input"]),Sje=Object.freeze(["align","autoplay","alt","colspan","controls","draggable","height","href","loop","muted","playsinline","poster","rowspan","src","target","title","type","width","start","checked","disabled","value","data-code","data-href","data-severity",{attributeName:"style",shouldKeep:(a,i)=>a.tagName==="SPAN"&&i.attrName==="style"?/^(color\:(#[0-9a-fA-F]+|var\(--vscode(-[a-zA-Z0-9]+)+\));)?(background-color\:(#[0-9a-fA-F]+|var\(--vscode(-[a-zA-Z0-9]+)+\));)?(border-radius:[0-9]+px;)?$/.test(i.attrValue):!1},{attributeName:"class",shouldKeep:(a,i)=>a.tagName==="SPAN"&&i.attrName==="class"?/^codicon codicon-[a-z\-]+( codicon-modifier-[a-z\-]+)?$/.test(i.attrValue):!1}]);function H5i(a,i){let e=a.isTrusted??!1,t=[Y.http,Y.https,Y.mailto,Y.file,Y.vscodeFileResource,Y.vscodeRemote,Y.vscodeRemoteResource,Y.vscodeNotebookCell,Y.internal];return e&&t.push(Y.command),i.allowedLinkSchemes?.augment&&t.push(...i.allowedLinkSchemes.augment),{allowedTags:{override:i.allowedTags?.override??Ati},allowedAttributes:{override:i.allowedAttributes?.override??Sje},allowedLinkProtocols:{override:t},allowRelativeLinkPaths:!!a.baseUri,allowedMediaProtocols:{override:[Y.http,Y.https,Y.data,Y.file,Y.vscodeFileResource,Y.vscodeRemote,Y.vscodeRemoteResource]},allowRelativeMediaPaths:!!a.baseUri,replaceWithPlaintext:i.replaceWithPlaintext}}function qa(a,i){if(typeof a=="string")return a;let e=a.value??"";e.length>1e5&&(e=`${e.substr(0,1e5)}\u2026`);let t=fFo();i?.includeCodeBlocksFences&&(t.code=vFo),i?.useLinkFormatter&&(t.link=bFo);let o=I5i(e,{async:!1,renderer:t});return hFo(o,{isTrusted:!1},{}).toString().replace(/&(#\d+|[a-zA-Z]+);/g,n=>gFo.get(n)??n).trim()}var gFo=new Map([[""",'"'],[" "," "],["&","&"],["'","'"],["<","<"],[">",">"]]);function fFo(){let a=new $9;return a.code=({text:i})=>ur(i),a.blockquote=({text:i})=>i+`
`,a.html=i=>"",a.heading=function({tokens:i}){return this.parser.parseInline(i)+`
`},a.hr=()=>"",a.list=function({items:i}){return i.map(e=>this.listitem(e)).join(`
`)+`
`},a.listitem=({text:i})=>i+`
`,a.paragraph=function({tokens:i}){return this.parser.parseInline(i)+`
`},a.table=function({header:i,rows:e}){return i.map(t=>this.tablecell(t)).join(" ")+`
`+e.map(t=>t.map(o=>this.tablecell(o)).join(" ")).join(`
`)+`
`},a.tablerow=({text:i})=>i,a.tablecell=function({tokens:i}){return this.parser.parseInline(i)},a.strong=({text:i})=>i,a.em=({text:i})=>i,a.codespan=({text:i})=>ur(i),a.br=i=>`
`,a.del=({text:i})=>i,a.image=i=>"",a.text=({text:i})=>i,a.link=({text:i})=>i,a}var vFo=({text:a})=>`
\`\`\`
${ur(a)}
\`\`\`
`,bFo=({text:a,href:i})=>{try{if(i){let e=A.parse(i);return a.trim()||Ye(e)}}catch{return a.trim()||No(i)}return a};function bje(a){let i="";return a.forEach(e=>{i+=e.raw}),i}function U5i(a){if(a.tokens)for(let i=a.tokens.length-1;i>=0;i--){let e=a.tokens[i];if(e.type==="text"){let t=e.raw.split(`
`),o=t[t.length-1];if(o.includes("`"))return EFo(a);if(o.includes("**"))return MFo(a);if(o.match(/\*\w/))return TFo(a);if(o.match(/(^|\s)__\w/))return PFo(a);if(o.match(/(^|\s)_\w/))return _Fo(a);if(SFo(o)||IFo(o)&&a.tokens.slice(0,i).some(n=>n.type==="text"&&n.raw.match(/\[[^\]]*$/))){let n=a.tokens.slice(i+1);return n[0]?.type==="link"&&n[1]?.type==="text"&&n[1].raw.match(/^ *"[^"]*$/)||o.match(/^[^"]* +"[^"]*$/)?LFo(a):DFo(a)}else if(o.match(/(^|\s)\[\w*[^\]]*$/))return RFo(a)}}}function SFo(a){return!!a.match(/(^|\s)\[.*\]\(\w*/)}function IFo(a){return!!a.match(/^[^\[]*\]\([^\)]*$/)}function yFo(a){let i=a.items[a.items.length-1],e=i.tokens?i.tokens[i.tokens.length-1]:void 0,t=c=>{let p=c.items.at(-1)?.tokens.at(-1);return p?.type==="heading"||p?.type==="list"&&t(p)},o;if(e?.type==="text"&&!("inRawBlock"in i))o=U5i(e);else if(t(a)){let c=q9(a.raw.trim()+" ")[0];return c.type!=="list"?void 0:c}if(!o||o.type!=="paragraph")return;let n=bje(a.items.slice(0,-1)),r=i.raw.match(/^(\s*(-|\d+\.|\*) +)/)?.[0];if(!r)return;let s=r+bje(i.tokens.slice(0,-1))+o.raw,l=q9(n+s)[0];if(l.type==="list")return l}function wFo(a,i){if(a.raw.match(/-\s*$/))return q9(i+" ")}var CFo=3;function xFo(a){for(let i=0;i<CFo;i++){let e=kFo(a);if(e)a=e;else break}return a}function kFo(a){let i,e;for(i=0;i<a.length;i++){let o=a[i];if(o.type==="paragraph"&&o.raw.match(/(\n|^)\|/)){e=AFo(a.slice(i));break}}let t=a.at(-1);if(!e&&t?.type==="list"){let o=yFo(t);o&&(e=[o],i=a.length-1)}if(!e&&t?.type==="paragraph"){let o=U5i(t);o&&(e=[o],i=a.length-1)}if(e){let o=[...a.slice(0,i),...e];return o.links=a.links,o}if(t?.type==="heading"){let o=wFo(t,bje(a));if(o)return o}return null}function EFo(a){return j9(a,"`")}function TFo(a){return j9(a,"*")}function _Fo(a){return j9(a,"_")}function DFo(a){return j9(a,")",!1)}function LFo(a){return j9(a,'")',!1)}function RFo(a){return j9(a,"](https://microsoft.com)",!1)}function MFo(a){return j9(a,"**")}function PFo(a){return j9(a,"__")}function j9(a,i,e=!0){let t=bje(Array.isArray(a)?a:[a]),o=e?t.trimEnd():t;return q9(o+i)[0]}function AFo(a){let i=bje(a),e=i.split(`
`),t,o=!1;for(let n=0;n<e.length;n++){let r=e[n].trim();if(typeof t>"u"&&r.match(/^\s*\|/)){let s=r.match(/(\|[^\|]+)(?=\||$)/g);s&&(t=s.length)}else if(typeof t=="number")if(r.match(/^\s*\|/)){if(n!==e.length-1)return;o=!0}else return}if(typeof t=="number"&&t>0){let n=o?e.slice(0,-1).join(`
`):i,r=!!n.match(/\|\s*$/),s=n+(r?"":"|")+`
|${" --- |".repeat(t)}`;return q9(s)}}function wae(a,i,e){let t=e.mode===1?e.offset:e.offset+e.size,o=e.mode===1?e.offset+e.size:e.offset;return e.position===0?i<=a-t?{position:t,result:"ok"}:i<=o?{position:o-i,result:"flipped"}:{position:Math.max(a-i,0),result:"overlap"}:i<=o?{position:o-i,result:"ok"}:i<=a-t&&o<i/2?{position:t,result:"flipped"}:{position:0,result:"overlap"}}function uSt(a,i,e,t){let o=t?.anchorAlignment??0,n=t?.anchorPosition??0,r=t?.anchorAxisAlignment??0,s,l;if(r===0){let p={offset:e.top-a.top,size:e.height,position:n===0?0:1},h={offset:e.left,size:e.width,position:o===0?0:1,mode:1},g=wae(a.height,i.height,p);s=g.position+a.top,g.result==="flipped"&&(n=n===0?1:0),qb.intersects({start:s,end:s+i.height},{start:p.offset,end:p.offset+p.size})&&(h.mode=0);let f=wae(a.width,i.width,h);l=f.position,f.result==="flipped"&&(o=o===0?1:0)}else{let p={offset:e.left,size:e.width,position:o===0?0:1},h={offset:e.top,size:e.height,position:n===0?0:1,mode:1},g=wae(a.width,i.width,p);l=g.position,g.result==="flipped"&&(o=o===0?1:0),qb.intersects({start:l,end:l+i.width},{start:p.offset,end:p.offset+p.size})&&(h.mode=0);let f=wae(a.height,i.height,h);s=f.position+a.top,f.result==="flipped"&&(n=n===0?1:0)}let c=a.width-(l+i.width),u=a.height-(s+i.height);return{top:s,left:l,bottom:u,right:c,anchorAlignment:o,anchorPosition:n}}function Nti(a){let i=a;return!!i&&typeof i.x=="number"&&typeof i.y=="number"}function yje(a){if(Ao(a)){let i=Yn(a),e=_6(a);return{top:i.top*e,left:i.left*e,width:i.width*e,height:i.height*e}}else return Nti(a)?{top:a.y,left:a.x,width:a.width||1,height:a.height||2}:{top:a.posy,left:a.posx,width:2,height:2}}var Oye=class a extends C{constructor(e,t){super();this.container=null;this.useFixedPosition=!1;this.useShadowDOM=!1;this.delegate=null;this.toDisposeOnClean=C.None;this.toDisposeOnSetContainer=C.None;this.shadowRoot=null;this.shadowRootHostElement=null;this.view=_(".context-view"),xo(this.view),this.setContainer(e,t),this._register(Z(()=>this.setContainer(null,1)))}static{this.BUBBLE_UP_EVENTS=["click","keydown","focus","blur"]}static{this.BUBBLE_DOWN_EVENTS=["click"]}setContainer(e,t){this.useFixedPosition=t!==1;let o=this.useShadowDOM;if(this.useShadowDOM=t===3,!(e===this.container&&o===this.useShadowDOM)&&(this.container&&(this.toDisposeOnSetContainer.dispose(),this.view.remove(),this.shadowRoot&&(this.shadowRoot=null,this.shadowRootHostElement?.remove(),this.shadowRootHostElement=null),this.container=null),e)){if(this.container=e,this.useShadowDOM){this.shadowRootHostElement=_(".shadow-root-host"),this.container.appendChild(this.shadowRootHostElement),this.shadowRoot=this.shadowRootHostElement.attachShadow({mode:"open"});let r=document.createElement("style");r.textContent=OFo,this.shadowRoot.appendChild(r),this.shadowRoot.appendChild(this.view),this.shadowRoot.appendChild(_("slot"))}else this.container.appendChild(this.view);let n=new P;a.BUBBLE_UP_EVENTS.forEach(r=>{n.add(Vo(this.container,r,s=>{this.onDOMEvent(s,!1)}))}),a.BUBBLE_DOWN_EVENTS.forEach(r=>{n.add(Vo(this.container,r,s=>{this.onDOMEvent(s,!0)},!0))}),this.toDisposeOnSetContainer=n}}show(e){this.isVisible()&&this.hide(),Rt(this.view),this.view.className="context-view monaco-component",this.view.style.top="0px",this.view.style.left="0px",this.view.style.zIndex=`${2575+(e.layer??0)}`,this.view.style.position=this.useFixedPosition?"fixed":"absolute",bn(this.view),this.toDisposeOnClean=e.render(this.view)||C.None,this.delegate=e,this.doLayout(),this.delegate.focus?.()}getViewElement(){return this.view}layout(){if(this.isVisible()){if(this.delegate.canRelayout===!1&&!(Nc&&og.pointerEvents)){this.hide();return}this.delegate?.layout?.(),this.doLayout()}}doLayout(){if(!this.isVisible())return;let e=yje(this.delegate.getAnchor()),t=Ki(),o={top:t.pageYOffset,left:t.pageXOffset,width:t.innerWidth,height:t.innerHeight},n={width:yl(this.view),height:nh(this.view)},r=this.delegate.anchorPosition,s=this.delegate.anchorAlignment,l=this.delegate.anchorAxisAlignment,{top:c,left:u}=uSt(o,n,e,{anchorAlignment:s,anchorPosition:r,anchorAxisAlignment:l});this.view.classList.remove("top","bottom","left","right"),this.view.classList.add(r===0?"bottom":"top"),this.view.classList.add(s===0?"left":"right"),this.view.classList.toggle("fixed",this.useFixedPosition);let p=Yn(this.container),h=this.container.scrollTop||0,g=this.container.scrollLeft||0;this.view.style.top=`${c-(this.useFixedPosition?Yn(this.view).top:p.top)+h}px`,this.view.style.left=`${u-(this.useFixedPosition?Yn(this.view).left:p.left)+g}px`,this.view.style.width="initial"}hide(e){let t=this.delegate;this.delegate=null,t?.onHide&&t.onHide(e),this.toDisposeOnClean.dispose(),xo(this.view)}isVisible(){return!!this.delegate}onDOMEvent(e,t){this.delegate&&(this.delegate.onDOMEvent?this.delegate.onDOMEvent(e,Me(e).document.activeElement):t&&!gs(e.target,this.container)&&this.hide())}dispose(){this.hide(),super.dispose()}},OFo=`
:host {
all: initial; /* 1st rule so subsequent properties are reset. */
}
.codicon[class*='codicon-'] {
font: normal normal normal 16px/1 codicon;
display: inline-block;
text-decoration: none;
text-rendering: auto;
text-align: center;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
}
:host {
font-family: -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", "HelveticaNeue-Light", system-ui, "Ubuntu", "Droid Sans", sans-serif;
}
:host-context(.mac) { font-family: -apple-system, BlinkMacSystemFont, sans-serif; }
:host-context(.mac:lang(zh-Hans)) { font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", sans-serif; }
:host-context(.mac:lang(zh-Hant)) { font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", sans-serif; }
:host-context(.mac:lang(ja)) { font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic Pro", sans-serif; }
:host-context(.mac:lang(ko)) { font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Nanum Gothic", "AppleGothic", sans-serif; }
:host-context(.windows) { font-family: "Segoe WPC", "Segoe UI", sans-serif; }
:host-context(.windows:lang(zh-Hans)) { font-family: "Segoe WPC", "Segoe UI", "Microsoft YaHei", sans-serif; }
:host-context(.windows:lang(zh-Hant)) { font-family: "Segoe WPC", "Segoe UI", "Microsoft Jhenghei", sans-serif; }
:host-context(.windows:lang(ja)) { font-family: "Segoe WPC", "Segoe UI", "Yu Gothic UI", "Meiryo UI", sans-serif; }
:host-context(.windows:lang(ko)) { font-family: "Segoe WPC", "Segoe UI", "Malgun Gothic", "Dotom", sans-serif; }
:host-context(.linux) { font-family: system-ui, "Ubuntu", "Droid Sans", sans-serif; }
:host-context(.linux:lang(zh-Hans)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans SC", "Source Han Sans CN", "Source Han Sans", sans-serif; }
:host-context(.linux:lang(zh-Hant)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans TC", "Source Han Sans TW", "Source Han Sans", sans-serif; }
:host-context(.linux:lang(ja)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans J", "Source Han Sans JP", "Source Han Sans", sans-serif; }
:host-context(.linux:lang(ko)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans K", "Source Han Sans JR", "Source Han Sans", "UnDotum", "FBaekmuk Gulim", sans-serif; }
`;var z5i={showInstantHover:()=>{},showDelayedHover:()=>{},setupDelayedHover:()=>C.None,setupDelayedHoverAtMouse:()=>C.None,hideHover:()=>{},showAndFocusLastHover:()=>{},setupManagedHover:()=>({dispose:()=>{},show:()=>{},hide:()=>{},update:()=>{}}),showManagedHover:()=>{}};function K5i(a){z5i=a}function yp(){return z5i}var Cae=_,G5i="selectOption.entry.template",Oti=class{get templateId(){return G5i}renderTemplate(i){let e=Object.create(null);return e.root=i,e.text=R(i,Cae(".option-text")),e.detail=R(i,Cae(".option-detail")),e.decoratorRight=R(i,Cae(".option-decorator-right")),e}renderElement(i,e,t){let o=t,n=i.text,r=i.detail,s=i.decoratorRight,l=i.isDisabled;o.text.textContent=n,o.detail.textContent=r||"",o.decoratorRight.textContent=s||"",l?o.root.classList.add("option-disabled"):o.root.classList.remove("option-disabled"),i.isSeparator?(o.root.classList.add("option-separator"),o.root.classList.add("option-disabled")):o.root.classList.remove("option-separator")}disposeTemplate(i){}},pSt=class a extends C{constructor(e,t,o,n,r){super();this.options=[];this._currentSelection=0;this._hasDetails=!1;this._selectionDetailsDisposables=this._register(new P);this._skipLayout=!1;this._sticky=!1;this._isVisible=!1,this.styles=n,this.selectBoxOptions=r||Object.create(null),typeof this.selectBoxOptions.minBottomMargin!="number"?this.selectBoxOptions.minBottomMargin=a.DEFAULT_DROPDOWN_MINIMUM_BOTTOM_MARGIN:this.selectBoxOptions.minBottomMargin<0&&(this.selectBoxOptions.minBottomMargin=0),this.selectElement=document.createElement("select"),this.selectElement.className="monaco-select-box",typeof this.selectBoxOptions.ariaLabel=="string"&&this.selectElement.setAttribute("aria-label",this.selectBoxOptions.ariaLabel),typeof this.selectBoxOptions.ariaDescription=="string"&&this.selectElement.setAttribute("aria-description",this.selectBoxOptions.ariaDescription),this._onDidSelect=new E,this._register(this._onDidSelect),this.registerListeners(),this.constructSelectDropDown(o),this.selected=t||0,e&&this.setOptions(e,t),this.initStyleSheet()}static{this.DEFAULT_DROPDOWN_MINIMUM_BOTTOM_MARGIN=32}static{this.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN=2}static{this.DEFAULT_MINIMUM_VISIBLE_OPTIONS=3}setTitle(e){!this._hover&&e?this._hover=this._register(yp().setupManagedHover(Ni("mouse"),this.selectElement,e)):this._hover&&this._hover.update(e)}getHeight(){return 22}getTemplateId(){return G5i}constructSelectDropDown(e){this.contextViewProvider=e,this.selectDropDownContainer=_(".monaco-select-box-dropdown-container"),this.selectionDetailsPane=R(this.selectDropDownContainer,Cae(".select-box-details-pane"));let t=R(this.selectDropDownContainer,Cae(".select-box-dropdown-container-width-control")),o=R(t,Cae(".width-control-div"));this.widthControlElement=document.createElement("span"),this.widthControlElement.className="option-text-width-control",R(o,this.widthControlElement),this._dropDownPosition=0,this.styleElement=hr(this.selectDropDownContainer),this.selectDropDownContainer.setAttribute("draggable","true"),this._register(j(this.selectDropDownContainer,re.DRAG_START,n=>{$t.stop(n,!0)}))}registerListeners(){this._register(Vo(this.selectElement,"change",t=>{this.selected=t.target.selectedIndex,this._onDidSelect.fire({index:t.target.selectedIndex,selected:t.target.value}),this.options[this.selected]&&this.options[this.selected].text&&this.setTitle(this.options[this.selected].text)})),this._register(j(this.selectElement,re.CLICK,t=>{$t.stop(t),this._isVisible?this.hideSelectDropDown(!0):this.showSelectDropDown()})),this._register(j(this.selectElement,re.MOUSE_DOWN,t=>{$t.stop(t)}));let e;this._register(j(this.selectElement,"touchstart",t=>{e=this._isVisible})),this._register(j(this.selectElement,"touchend",t=>{$t.stop(t),e?this.hideSelectDropDown(!0):this.showSelectDropDown()})),this._register(j(this.selectElement,re.KEY_DOWN,t=>{let o=new Ii(t),n=!1;it?(o.keyCode===18||o.keyCode===16||o.keyCode===10||o.keyCode===3)&&(n=!0):(o.keyCode===18&&o.altKey||o.keyCode===16&&o.altKey||o.keyCode===10||o.keyCode===3)&&(n=!0),n&&(this.showSelectDropDown(),$t.stop(t,!0))}))}get onDidSelect(){return this._onDidSelect.event}setOptions(e,t){$i(this.options,e)||(this.options=e,this.selectElement.options.length=0,this._hasDetails=!1,this._cachedMaxDetailsHeight=void 0,this.options.forEach((o,n)=>{this.selectElement.add(this.createOption(o.text,n,o.isDisabled)),typeof o.description=="string"&&(this._hasDetails=!0)})),t!==void 0&&(this.select(t),this._currentSelection=this.selected)}setEnabled(e){this.selectElement.disabled=!e}setOptionsList(){this.selectList?.splice(0,this.selectList.length,this.options)}select(e){e>=0&&e<this.options.length?this.selected=e:e>this.options.length-1?this.select(this.options.length-1):this.selected<0&&(this.selected=0),this.selectElement.selectedIndex=this.selected,this.options[this.selected]&&this.options[this.selected].text&&this.setTitle(this.options[this.selected].text)}setAriaLabel(e){this.selectBoxOptions.ariaLabel=e,this.selectElement.setAttribute("aria-label",this.selectBoxOptions.ariaLabel)}focus(){this.selectElement&&(this.selectElement.tabIndex=0,this.selectElement.focus())}blur(){this.selectElement&&(this.selectElement.tabIndex=-1,this.selectElement.blur())}setFocusable(e){this.selectElement.tabIndex=e?0:-1}render(e){this.container=e,e.classList.add("select-container"),e.appendChild(this.selectElement),this.styleSelectElement()}initStyleSheet(){let e=[];this.styles.listFocusBackground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.focused { background-color: ${this.styles.listFocusBackground} !important; }`),this.styles.listFocusForeground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.focused { color: ${this.styles.listFocusForeground} !important; }`),this.styles.decoratorRightForeground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.focused) .option-decorator-right { color: ${this.styles.decoratorRightForeground}; }`),this.styles.selectBackground&&this.styles.selectBorder&&this.styles.selectBorder!==this.styles.selectBackground?(e.push(`.monaco-select-box-dropdown-container { border: 1px solid ${this.styles.selectBorder} } `),e.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-top { border-top: 1px solid ${this.styles.selectBorder} } `),e.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-bottom { border-bottom: 1px solid ${this.styles.selectBorder} } `)):this.styles.selectListBorder&&(e.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-top { border-top: 1px solid ${this.styles.selectListBorder} } `),e.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-bottom { border-bottom: 1px solid ${this.styles.selectListBorder} } `)),this.styles.listHoverForeground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.option-disabled):not(.focused):hover { color: ${this.styles.listHoverForeground} !important; }`),this.styles.listHoverBackground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.option-disabled):not(.focused):hover { background-color: ${this.styles.listHoverBackground} !important; }`),this.styles.listFocusOutline&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.focused { outline: 1px solid ${this.styles.listFocusOutline} !important; outline-offset: -1px !important; }`),this.styles.listHoverOutline&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.option-disabled):not(.focused):hover { outline: 1px solid ${this.styles.listHoverOutline} !important; outline-offset: -1px !important; }`),e.push(".monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.option-disabled.focused { background-color: transparent !important; color: inherit !important; outline: none !important; }"),e.push(".monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.option-disabled:hover { background-color: transparent !important; color: inherit !important; outline: none !important; }"),this.styleElement.textContent=e.join(`
`)}styleSelectElement(){let e=this.styles.selectBackground??"",t=this.styles.selectForeground??"",o=this.styles.selectBorder??"";this.selectElement.style.backgroundColor=e,this.selectElement.style.color=t,this.selectElement.style.borderColor=o}styleList(){let e=this.styles.selectBackground??"",t=n_(this.styles.selectListBackground,e);this.selectDropDownContainer.style.backgroundColor=t,this.selectDropDownListContainer.style.backgroundColor=t,this.selectionDetailsPane.style.backgroundColor=t,this.selectList.style(this.styles)}createOption(e,t,o){let n=document.createElement("option");return n.value=e,n.text=e,n.disabled=!!o,n}showSelectDropDown(){this.selectionDetailsPane.textContent="",!(!this.contextViewProvider||this._isVisible)&&(this.createSelectList(this.selectDropDownContainer),this.setOptionsList(),this.contextViewProvider.showContextView({getAnchor:()=>this.selectElement,render:e=>this.renderSelectDropDown(e,!0),layout:()=>{this.layoutSelectDropDown()},onHide:()=>{this.selectDropDownContainer.classList.remove("visible")},anchorPosition:this._dropDownPosition},this.selectBoxOptions.optionsAsChildren?this.container:void 0),this._isVisible=!0,this.hideSelectDropDown(!1),this.contextViewProvider.showContextView({getAnchor:()=>this.selectElement,render:e=>this.renderSelectDropDown(e),layout:()=>this.layoutSelectDropDown(),onHide:()=>{this.selectDropDownContainer.classList.remove("visible")},anchorPosition:this._dropDownPosition},this.selectBoxOptions.optionsAsChildren?this.container:void 0),this._currentSelection=this.selected,this._isVisible=!0,this.selectElement.setAttribute("aria-expanded","true"))}hideSelectDropDown(e){!this.contextViewProvider||!this._isVisible||(this._isVisible=!1,this.selectElement.setAttribute("aria-expanded","false"),e&&this.selectElement.focus(),this.contextViewProvider.hideContextView())}renderSelectDropDown(e,t){e.appendChild(this.selectDropDownContainer);let o=Me(this.selectElement).getComputedStyle(this.selectElement).fontSize;return o&&(this.selectDropDownContainer.style.fontSize=o),this.layoutSelectDropDown(t),{dispose:()=>{this.selectDropDownContainer.remove()}}}measureMaxDetailsHeight(){let e=0;return this.options.forEach((t,o)=>{this.updateDetail(o),this.selectionDetailsPane.offsetHeight>e&&(e=this.selectionDetailsPane.offsetHeight)}),e}layoutSelectDropDown(e){if(this._skipLayout)return!1;if(this.selectList){this.selectDropDownContainer.classList.add("visible");let t=Me(this.selectElement),o=Yn(this.selectElement),n=t.innerHeight-o.top-o.height-(this.selectBoxOptions.minBottomMargin||0),r=o.top-a.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN,s=this.selectElement.offsetWidth,l=this.setWidthControlElement(this.widthControlElement),c=`${Math.max(l,Math.round(s))}px`;this.selectDropDownContainer.style.width=c,this.selectList.getHTMLElement().style.height="",this.selectList.layout();let u=this.selectList.contentHeight;this._hasDetails&&this._cachedMaxDetailsHeight===void 0&&(this._cachedMaxDetailsHeight=this.measureMaxDetailsHeight());let p=this._hasDetails?this._cachedMaxDetailsHeight:0,h=u+p,g=Math.floor((n-p)/this.getHeight()),f=Math.floor((r-p)/this.getHeight());if(e)return o.top+o.height>t.innerHeight-22||o.top<a.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN||g<1&&f<1?!1:(g<a.DEFAULT_MINIMUM_VISIBLE_OPTIONS&&f>g&&this.options.length>g?(this._dropDownPosition=1,this.selectDropDownListContainer.remove(),this.selectionDetailsPane.remove(),this.selectDropDownContainer.appendChild(this.selectionDetailsPane),this.selectDropDownContainer.appendChild(this.selectDropDownListContainer),this.selectionDetailsPane.classList.remove("border-top"),this.selectionDetailsPane.classList.add("border-bottom")):(this._dropDownPosition=0,this.selectDropDownListContainer.remove(),this.selectionDetailsPane.remove(),this.selectDropDownContainer.appendChild(this.selectDropDownListContainer),this.selectDropDownContainer.appendChild(this.selectionDetailsPane),this.selectionDetailsPane.classList.remove("border-bottom"),this.selectionDetailsPane.classList.add("border-top")),!0);if(o.top+o.height>t.innerHeight-22||o.top<a.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN||this._dropDownPosition===0&&g<1||this._dropDownPosition===1&&f<1)return this.hideSelectDropDown(!0),!1;if(this._dropDownPosition===0){if(this._isVisible&&g+f<1)return this.hideSelectDropDown(!0),!1;h>n&&(u=g*this.getHeight())}else h>r&&(u=f*this.getHeight());return this.selectList.layout(u),this.selectList.domFocus(),this.selectList.length>0&&(this.selectList.setFocus([this.selected||0]),this.selectList.reveal(this.selectList.getFocus()[0]||0)),this._hasDetails?(this.selectList.getHTMLElement().style.height=`${u}px`,this.selectDropDownContainer.style.height=""):this.selectDropDownContainer.style.height=`${u}px`,this.updateDetail(this.selected),this.selectDropDownContainer.style.width=c,this.selectDropDownListContainer.setAttribute("tabindex","0"),!0}else return!1}setWidthControlElement(e){let t=0;if(e){let o=0,n=0;this.options.forEach((r,s)=>{let l=r.detail?r.detail.length:0,c=r.decoratorRight?r.decoratorRight.length:0,u=r.text.length+l+c;u>n&&(o=s,n=u)}),e.textContent=this.options[o].text+(this.options[o].decoratorRight?`${this.options[o].decoratorRight} `:""),t=yl(e)}return t}createSelectList(e){if(this.selectList)return;this.selectDropDownListContainer=R(e,Cae(".select-box-dropdown-list-container")),this.listRenderer=new Oti,this.selectList=this._register(new hc("SelectBoxCustom",this.selectDropDownListContainer,this,[this.listRenderer],{useShadows:!1,verticalScrollMode:3,keyboardSupport:!1,mouseSupport:!1,accessibilityProvider:{getAriaLabel:n=>{if(n.isSeparator)return d(30,null);let r=n.text;return n.detail&&(r+=`. ${n.detail}`),n.decoratorRight&&(r+=`. ${n.decoratorRight}`),n.description&&(r+=`. ${n.description}`),r},getWidgetAriaLabel:()=>d(29,null),getRole:()=>it?"":"option",getWidgetRole:()=>"listbox"}})),this.selectBoxOptions.ariaLabel&&(this.selectList.ariaLabel=this.selectBoxOptions.ariaLabel);let t=this._register(new On(this.selectDropDownListContainer,"keydown")),o=H.chain(t.event,n=>n.filter(()=>this.selectList.length>0).map(r=>new Ii(r)));this._register(H.chain(o,n=>n.filter(r=>r.keyCode===3))(this.onEnter,this)),this._register(H.chain(o,n=>n.filter(r=>r.keyCode===2))(this.onEnter,this)),this._register(H.chain(o,n=>n.filter(r=>r.keyCode===9))(this.onEscape,this)),this._register(H.chain(o,n=>n.filter(r=>r.keyCode===16))(this.onUpArrow,this)),this._register(H.chain(o,n=>n.filter(r=>r.keyCode===18))(this.onDownArrow,this)),this._register(H.chain(o,n=>n.filter(r=>r.keyCode===12))(this.onPageDown,this)),this._register(H.chain(o,n=>n.filter(r=>r.keyCode===11))(this.onPageUp,this)),this._register(H.chain(o,n=>n.filter(r=>r.keyCode===14))(this.onHome,this)),this._register(H.chain(o,n=>n.filter(r=>r.keyCode===13))(this.onEnd,this)),this._register(H.chain(o,n=>n.filter(r=>r.keyCode>=21&&r.keyCode<=56||r.keyCode>=85&&r.keyCode<=113))(this.onCharacter,this)),this._register(j(this.selectList.getHTMLElement(),re.POINTER_UP,n=>this.onPointerUp(n))),this._register(this.selectList.onMouseOver(n=>typeof n.index<"u"&&!this.options[n.index]?.isDisabled&&this.selectList.setFocus([n.index]))),this._register(this.selectList.onDidChangeFocus(n=>this.onListFocus(n))),this._register(j(this.selectDropDownContainer,re.FOCUS_OUT,n=>{!this._isVisible||gs(n.relatedTarget,this.selectDropDownContainer)||this.onListBlur()})),this.selectList.getHTMLElement().setAttribute("aria-label",this.selectBoxOptions.ariaLabel||""),this.selectList.getHTMLElement().setAttribute("aria-expanded","true"),this.styleList()}onPointerUp(e){if(!this.selectList.length)return;$t.stop(e);let t=e.target;if(!t||t.classList.contains("slider"))return;let o=t.closest(".monaco-list-row");if(!o)return;let n=Number(o.getAttribute("data-index")),r=o.classList.contains("option-disabled");n>=0&&n<this.options.length&&!r&&(this.selected=n,this.select(this.selected),this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selectList.getFocus()[0]),this.selected!==this._currentSelection&&(this._currentSelection=this.selected,this._onDidSelect.fire({index:this.selectElement.selectedIndex,selected:this.options[this.selected].text}),this.options[this.selected]&&this.options[this.selected].text&&this.setTitle(this.options[this.selected].text)),this.hideSelectDropDown(!0))}onListBlur(){this._sticky||(this.selected!==this._currentSelection&&this.select(this._currentSelection),this.hideSelectDropDown(!1))}renderDescriptionMarkdown(e,t){let o=r=>{for(let s=0;s<r.childNodes.length;s++){let l=r.childNodes.item(s);(l.tagName&&l.tagName.toLowerCase())==="img"?l.remove():o(l)}},n=nb({value:e,supportThemeIcons:!0},{actionHandler:t});return n.element.classList.add("select-box-description-markdown"),o(n.element),n}onListFocus(e){!this._isVisible||!this._hasDetails||this.updateDetail(e.indexes[0])}updateDetail(e){this._selectionDetailsDisposables.clear(),this.selectionDetailsPane.textContent="";let t=this.options[e],o=t?.description??"",n=t?.descriptionIsMarkdown??!1;if(o){if(n){let r=t.descriptionMarkdownActionHandler,s=this._selectionDetailsDisposables.add(this.renderDescriptionMarkdown(o,r));this.selectionDetailsPane.appendChild(s.element)}else this.selectionDetailsPane.textContent=o;this.selectionDetailsPane.style.display="block"}else this.selectionDetailsPane.style.display="none";this._skipLayout=!0,this.contextViewProvider.layout(),this._skipLayout=!1}onEscape(e){$t.stop(e),this.select(this._currentSelection),this.hideSelectDropDown(!0)}onEnter(e){if($t.stop(e),this.options[this.selected]?.isDisabled){this.hideSelectDropDown(!0);return}this.selected!==this._currentSelection&&(this._currentSelection=this.selected,this._onDidSelect.fire({index:this.selectElement.selectedIndex,selected:this.options[this.selected].text}),this.options[this.selected]&&this.options[this.selected].text&&this.setTitle(this.options[this.selected].text)),this.hideSelectDropDown(!0)}onDownArrow(e){if(this.selected<this.options.length-1){$t.stop(e,!0);let t=this.selected+1;for(;t<this.options.length&&this.options[t].isDisabled;)t++;if(t>=this.options.length)return;this.selected=t,this.select(this.selected),this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selectList.getFocus()[0])}}onUpArrow(e){if(this.selected>0){$t.stop(e,!0);let t=this.selected-1;for(;t>=0&&this.options[t].isDisabled;)t--;if(t<0)return;this.selected=t,this.select(this.selected),this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selectList.getFocus()[0])}}onPageUp(e){$t.stop(e),this.selectList.focusPreviousPage(),setTimeout(()=>{let t=this.selectList.getFocus()[0];for(;t>0&&this.options[t].isDisabled;)t--;this.options[t].isDisabled||(this.selected=t,this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selected),this.select(this.selected))},1)}onPageDown(e){$t.stop(e),this.selectList.focusNextPage(),setTimeout(()=>{let t=this.selectList.getFocus()[0];for(;t<this.options.length-1&&this.options[t].isDisabled;)t++;this.options[t].isDisabled||(this.selected=t,this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selected),this.select(this.selected))},1)}onHome(e){if($t.stop(e),this.options.length<2)return;let t=0;for(;t<this.options.length-1&&this.options[t].isDisabled;)t++;this.options[t].isDisabled||(this.selected=t,this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selected),this.select(this.selected))}onEnd(e){if($t.stop(e),this.options.length<2)return;let t=this.options.length-1;for(;t>0&&this.options[t].isDisabled;)t--;this.options[t].isDisabled||(this.selected=t,this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selected),this.select(this.selected))}onCharacter(e){let t=vp.toString(e.keyCode),o=-1;for(let n=0;n<this.options.length-1;n++)if(o=(n+this.selected+1)%this.options.length,this.options[o].text.charAt(0).toUpperCase()===t&&!this.options[o].isDisabled){this.select(o),this.selectList.setFocus([o]),this.selectList.reveal(this.selectList.getFocus()[0]),$t.stop(e);break}}dispose(){this.hideSelectDropDown(!1),super.dispose()}};var mSt=class extends C{constructor(e,t,o,n){super();this.selected=0;this.selectBoxOptions=n||Object.create(null),this.options=[],this.selectElement=document.createElement("select"),this.selectElement.className="monaco-select-box",typeof this.selectBoxOptions.ariaLabel=="string"&&this.selectElement.setAttribute("aria-label",this.selectBoxOptions.ariaLabel),typeof this.selectBoxOptions.ariaDescription=="string"&&this.selectElement.setAttribute("aria-description",this.selectBoxOptions.ariaDescription),this._onDidSelect=this._register(new E),this.styles=o,this.registerListeners(),this.setOptions(e,t)}registerListeners(){this._register(ws.addTarget(this.selectElement)),[Gn.Tap].forEach(e=>{this._register(j(this.selectElement,e,t=>{this.selectElement.focus()}))}),this._register(Vo(this.selectElement,"click",e=>{$t.stop(e,!0)})),this._register(Vo(this.selectElement,"change",e=>{this.selectElement.title=e.target.value,this._onDidSelect.fire({index:e.target.selectedIndex,selected:e.target.value})})),this._register(Vo(this.selectElement,"keydown",e=>{let t=!1;it?(e.keyCode===18||e.keyCode===16||e.keyCode===10)&&(t=!0):(e.keyCode===18&&e.altKey||e.keyCode===10||e.keyCode===3)&&(t=!0),t&&e.stopPropagation()}))}get onDidSelect(){return this._onDidSelect.event}setOptions(e,t){(!this.options||!$i(this.options,e))&&(this.options=e,this.selectElement.options.length=0,this.options.forEach((o,n)=>{this.selectElement.add(this.createOption(o.text,n,o.isDisabled,o.isSeparator))})),t!==void 0&&this.select(t)}select(e){this.options.length===0?this.selected=0:e>=0&&e<this.options.length?this.selected=e:e>this.options.length-1?this.select(this.options.length-1):this.selected<0&&(this.selected=0),this.selectElement.selectedIndex=this.selected,this.selected<this.options.length&&typeof this.options[this.selected].text=="string"?this.selectElement.title=this.options[this.selected].text:this.selectElement.title=""}setAriaLabel(e){this.selectBoxOptions.ariaLabel=e,this.selectElement.setAttribute("aria-label",e)}focus(){this.selectElement&&(this.selectElement.tabIndex=0,this.selectElement.focus())}blur(){this.selectElement&&(this.selectElement.tabIndex=-1,this.selectElement.blur())}setEnabled(e){this.selectElement.disabled=!e}setFocusable(e){this.selectElement.tabIndex=e?0:-1}render(e){e.classList.add("select-container"),e.appendChild(this.selectElement),this.setOptions(this.options,this.selected),this.applyStyles()}style(e){this.styles=e,this.applyStyles()}applyStyles(){this.selectElement&&(this.selectElement.style.backgroundColor=this.styles.selectBackground??"",this.selectElement.style.color=this.styles.selectForeground??"",this.selectElement.style.borderColor=this.styles.selectBorder??"")}createOption(e,t,o,n){let r=document.createElement("option");return r.value=e,r.text=e,r.disabled=!!o||!!n,n&&r.setAttribute("role","separator"),r}};var jN=Object.freeze({text:"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500",isDisabled:!0,isSeparator:!0}),qmr={...eSt,selectBackground:"#3C3C3C",selectForeground:"#F0F0F0",selectBorder:"#3C3C3C",decoratorRightForeground:void 0,selectListBackground:void 0,selectListBorder:void 0,focusBorder:void 0},aE=class extends Ma{constructor(i,e,t,o,n){super(),it&&!n?.useCustomDrawn?this.selectBoxDelegate=new mSt(i,e,o,n):this.selectBoxDelegate=new pSt(i,e,t,o,n),this._register(this.selectBoxDelegate)}get onDidSelect(){return this.selectBoxDelegate.onDidSelect}setOptions(i,e){this.selectBoxDelegate.setOptions(i,e)}select(i){this.selectBoxDelegate.select(i)}setAriaLabel(i){this.selectBoxDelegate.setAriaLabel(i)}focus(){this.selectBoxDelegate.focus()}blur(){this.selectBoxDelegate.blur()}setFocusable(i){this.selectBoxDelegate.setFocusable(i)}setEnabled(i){this.selectBoxDelegate.setEnabled(i)}render(i){this.selectBoxDelegate.render(i)}};var oc=class extends C{constructor(e,t,o={}){super();this.options=o;this._context=e||this,this._action=t,t instanceof st&&this._register(t.onDidChange(n=>{this.element&&this.handleActionChangeEvent(n)}))}get action(){return this._action}handleActionChangeEvent(e){e.enabled!==void 0&&this.updateEnabled(),e.checked!==void 0&&this.updateChecked(),e.class!==void 0&&this.updateClass(),e.label!==void 0&&(this.updateLabel(),this.updateTooltip()),e.tooltip!==void 0&&this.updateTooltip()}get actionRunner(){return this._actionRunner||(this._actionRunner=this._register(new as)),this._actionRunner}set actionRunner(e){this._actionRunner=e}isEnabled(){return this._action.enabled}setActionContext(e){this._context=e}render(e){let t=this.element=e;this._register(ws.addTarget(e));let o=this.options&&this.options.draggable;o&&(e.draggable=!0,yc&&this._register(j(e,re.DRAG_START,n=>n.dataTransfer?.setData(Aa.TEXT,this._action.label)))),this._register(j(t,Gn.Tap,n=>this.onClick(n,!0))),this._register(j(t,re.MOUSE_DOWN,n=>{o||$t.stop(n,!0),this._action.enabled&&n.button===0&&t.classList.add("active")})),it&&this._register(j(t,re.CONTEXT_MENU,n=>{n.button===0&&n.ctrlKey===!0&&this.onClick(n)})),this._register(j(t,re.CLICK,n=>{$t.stop(n,!0),this.options&&this.options.isMenu||this.onClick(n)})),this._register(j(t,re.DBLCLICK,n=>{$t.stop(n,!0)})),[re.MOUSE_UP,re.MOUSE_OUT].forEach(n=>{this._register(j(t,n,r=>{$t.stop(r),t.classList.remove("active")}))})}onClick(e,t=!1){$t.stop(e,!0);let o=Jn(this._context)?this.options?.useEventAsContext?e:{preserveFocus:t}:this._context;this.actionRunner.run(this._action,o)}focus(){this.element&&(this.element.tabIndex=0,this.element.focus(),this.element.classList.add("focused"))}isFocused(){return!!this.element?.classList.contains("focused")}blur(){this.element&&(this.element.blur(),this.element.tabIndex=-1,this.element.classList.remove("focused"))}setFocusable(e){this.element&&(this.element.tabIndex=e?0:-1)}get trapsArrowNavigation(){return!1}updateEnabled(){}updateLabel(){}getClass(){return this.action.class}getTooltip(){return this.action.tooltip}getHoverContents(){return this.getTooltip()}updateTooltip(){if(!this.element)return;let e=this.getHoverContents()??"";if(this.updateAriaLabel(),!this.customHover&&e!==""){let t=this.options.hoverDelegate??Ni("element");this.customHover=this._store.add(yp().setupManagedHover(t,this.element,e))}else this.customHover&&this.customHover.update(e)}updateAriaLabel(){if(this.element){let e=this.getTooltip()??"";this.element.setAttribute("aria-label",e)}}updateClass(){}updateChecked(){}dispose(){this.element&&(this.element.remove(),this.element=void 0),this._context=void 0,super.dispose()}},Lr=class extends oc{constructor(i,e,t){t={...t,icon:t.icon!==void 0?t.icon:!1,label:t.label!==void 0?t.label:!0},super(i,e,t),this.options=t,this.cssClass=""}render(i){super.render(i),So(this.element);let e=document.createElement("a");if(e.classList.add("action-label"),e.setAttribute("role",this.getDefaultAriaRole()),this.label=e,this.element.appendChild(e),this.options.label&&this.options.keybinding&&!this.options.keybindingNotRenderedWithLabel){let t=document.createElement("span");t.classList.add("keybinding"),t.textContent=this.options.keybinding,this.element.appendChild(t)}this.updateClass(),this.updateLabel(),this.updateTooltip(),this.updateEnabled(),this.updateChecked()}getDefaultAriaRole(){return this._action.id===li.ID?"presentation":this.options.isMenu?"menuitem":this.options.isTabList?"tab":"button"}focus(){this.label&&(this.label.tabIndex=0,this.label.focus())}isFocused(){return!!this.label&&this.label?.tabIndex===0}blur(){this.label&&(this.label.tabIndex=-1)}setFocusable(i){this.label&&(this.label.tabIndex=i?0:-1)}updateLabel(){this.options.label&&this.label&&(this.label.textContent=this.action.label)}getTooltip(){let i=null;return this.action.tooltip?i=this.action.tooltip:this.action.label&&(i=this.action.label,this.options.keybinding&&(i=d(0,null,i,this.options.keybinding))),i??void 0}updateClass(){this.cssClass&&this.label&&this.label.classList.remove(...this.cssClass.split(" ")),this.action.id===li.ID&&this.action.class?this.label?.classList.add(this.action.class):this.options.icon?(this.cssClass=this.getClass(),this.label&&(this.label.classList.add("codicon"),this.cssClass&&this.label.classList.add(...this.cssClass.split(" "))),this.updateEnabled()):this.label?.classList.remove("codicon")}updateEnabled(){this.action.enabled?(this.label&&(this.label.removeAttribute("aria-disabled"),this.label.classList.remove("disabled")),this.element?.classList.remove("disabled")):(this.label&&(this.label.setAttribute("aria-disabled","true"),this.label.classList.add("disabled")),this.element?.classList.add("disabled"))}updateAriaLabel(){if(this.label){let i=this.getTooltip()??"";this.label.setAttribute("aria-label",i)}}updateChecked(){this.label&&(this.action.checked!==void 0?(this.label.classList.toggle("checked",this.action.checked),this.options.isTabList?this.label.setAttribute("aria-selected",this.action.checked?"true":"false"):(this.label.setAttribute("aria-pressed",this.action.checked?"true":"false"),this.label.setAttribute("role","button"))):(this.label.classList.remove("checked"),this.label.removeAttribute(this.options.isTabList?"aria-selected":"aria-pressed"),this.label.setAttribute("role",this.getDefaultAriaRole())))}},h1=class extends oc{constructor(i,e,t,o,n,r,s){super(i,e),this.selectBox=new aE(t,o,n,r,s),this.selectBox.setFocusable(!1),this._register(this.selectBox),this.registerListeners()}setOptions(i,e){this.selectBox.setOptions(i,e)}select(i){this.selectBox.select(i)}registerListeners(){this._register(this.selectBox.onDidSelect(i=>this.runAction(i.selected,i.index)))}runAction(i,e){this.actionRunner.run(this._action,this.getActionContext(i,e))}getActionContext(i,e){return i}setFocusable(i){this.selectBox.setFocusable(i)}focus(){this.selectBox?.focus()}blur(){this.selectBox?.blur()}render(i){this.selectBox.render(i)}};var ji=class extends C{constructor(e,t={}){super();this._actionRunnerDisposables=this._register(new P);this.viewItemDisposables=this._register(new jt);this.triggerKeyDown=!1;this.focusable=!0;this._onDidBlur=this._register(new E);this._onDidCancel=this._register(new E({onWillAddFirstListener:()=>this.cancelHasListener=!0}));this.cancelHasListener=!1;this._onDidRun=this._register(new E);this._onWillRun=this._register(new E);this.options=t,this._context=t.context??null,this._orientation=this.options.orientation??0,this._triggerKeys={keyDown:this.options.triggerKeys?.keyDown??!1,keys:this.options.triggerKeys?.keys??[3,10]},this._hoverDelegate=t.hoverDelegate??this._register(Gg()),this.options.actionRunner?this._actionRunner=this.options.actionRunner:(this._actionRunner=new as,this._actionRunnerDisposables.add(this._actionRunner)),this._actionRunnerDisposables.add(this._actionRunner.onDidRun(r=>this._onDidRun.fire(r))),this._actionRunnerDisposables.add(this._actionRunner.onWillRun(r=>this._onWillRun.fire(r))),this.viewItems=[],this.focusedItem=void 0,this.domNode=document.createElement("div"),this.domNode.className="monaco-action-bar";let o,n;switch(this._orientation){case 0:o=[15],n=[17];break;case 1:o=[16],n=[18],this.domNode.className+=" vertical";break}this._register(j(this.domNode,re.KEY_DOWN,r=>{let s=new Ii(r),l=!0,c=typeof this.focusedItem=="number"?this.viewItems[this.focusedItem]:void 0;o&&(s.equals(o[0])||s.equals(o[1]))?l=this.focusPrevious():n&&(s.equals(n[0])||s.equals(n[1]))?l=this.focusNext():s.equals(9)&&this.cancelHasListener?this._onDidCancel.fire():s.equals(14)?l=this.focusFirst():s.equals(13)?l=this.focusLast():s.equals(2)&&c instanceof oc&&c.trapsArrowNavigation?l=this.focusNext(void 0,!0):this.isTriggerKeyEvent(s)?this._triggerKeys.keyDown?this.doTrigger(s):this.triggerKeyDown=!0:l=!1,l&&(s.preventDefault(),s.stopPropagation())})),this._register(j(this.domNode,re.KEY_UP,r=>{let s=new Ii(r);this.isTriggerKeyEvent(s)?(!this._triggerKeys.keyDown&&this.triggerKeyDown&&(this.triggerKeyDown=!1,this.doTrigger(s)),s.preventDefault(),s.stopPropagation()):(s.equals(2)||s.equals(1026)||s.equals(16)||s.equals(18)||s.equals(15)||s.equals(17))&&this.updateFocusedItem()})),this.focusTracker=this._register(Vn(this.domNode)),this._register(this.focusTracker.onDidBlur(()=>{(Pn()===this.domNode||!gs(Pn(),this.domNode))&&(this._onDidBlur.fire(),this.previouslyFocusedItem=this.focusedItem,this.focusedItem=void 0,this.triggerKeyDown=!1)})),this._register(this.focusTracker.onDidFocus(()=>this.updateFocusedItem())),this.actionsList=document.createElement("ul"),this.actionsList.className="actions-container",this.options.highlightToggledItems&&this.actionsList.classList.add("highlight-toggled"),this.actionsList.setAttribute("role",this.options.ariaRole||"toolbar"),this.options.ariaLabel&&this.actionsList.setAttribute("aria-label",this.options.ariaLabel),this.domNode.appendChild(this.actionsList),e.appendChild(this.domNode)}get onDidBlur(){return this._onDidBlur.event}get onDidCancel(){return this._onDidCancel.event}get onDidRun(){return this._onDidRun.event}get onWillRun(){return this._onWillRun.event}refreshRole(){this.length()>=1?this.actionsList.setAttribute("role",this.options.ariaRole||"toolbar"):this.actionsList.setAttribute("role","presentation")}setAriaLabel(e){e?this.actionsList.setAttribute("aria-label",e):this.actionsList.removeAttribute("aria-label")}setFocusable(e){if(this.focusable=e,this.focusable){let t=this.viewItems.find(o=>o instanceof oc&&o.isEnabled());t instanceof oc&&t.setFocusable(!0)}else this.viewItems.forEach(t=>{t instanceof oc&&t.setFocusable(!1)})}isTriggerKeyEvent(e){let t=!1;return this._triggerKeys.keys.forEach(o=>{t=t||e.equals(o)}),t}updateFocusedItem(){for(let e=0;e<this.actionsList.children.length;e++){let t=this.actionsList.children[e];if(gs(Pn(),t)){this.focusedItem=e,this.viewItems[this.focusedItem]?.showHover?.();break}}}get context(){return this._context}set context(e){this._context=e,this.viewItems.forEach(t=>t.setActionContext(e))}get actionRunner(){return this._actionRunner}set actionRunner(e){this._actionRunner=e,this._actionRunnerDisposables.clear(),this._actionRunnerDisposables.add(this._actionRunner.onDidRun(t=>this._onDidRun.fire(t))),this._actionRunnerDisposables.add(this._actionRunner.onWillRun(t=>this._onWillRun.fire(t))),this.viewItems.forEach(t=>t.actionRunner=e)}getContainer(){return this.domNode}hasAction(e){return this.viewItems.findIndex(t=>t.action.id===e.id)!==-1}getAction(e){if(typeof e=="number")return this.viewItems[e]?.action;if(Ao(e)){for(;e.parentElement!==this.actionsList;){if(!e.parentElement)return;e=e.parentElement}for(let t=0;t<this.actionsList.childNodes.length;t++)if(this.actionsList.childNodes[t]===e)return this.viewItems[t].action}}push(e,t={}){let o=Array.isArray(e)?e:[e],n=Xo(t.index)?t.index:null;if(o.forEach(r=>{let s=document.createElement("li");s.className="action-item",s.setAttribute("role","presentation");let l,c={hoverDelegate:this._hoverDelegate,...t,isTabList:this.options.ariaRole==="tablist"};this.options.actionViewItemProvider&&(l=this.options.actionViewItemProvider(r,c)),l||(l=new Lr(this.context,r,c)),this.options.allowContextMenu||this.viewItemDisposables.set(l,j(s,re.CONTEXT_MENU,u=>{$t.stop(u,!0)})),l.actionRunner=this._actionRunner,l.setActionContext(this.context),l.render(s),n===null||n<0||n>=this.actionsList.children.length?(this.actionsList.appendChild(s),this.viewItems.push(l)):(this.actionsList.insertBefore(s,this.actionsList.children[n]),this.viewItems.splice(n,0,l),n++)}),this.focusable){let r=!1;for(let s of this.viewItems){if(!(s instanceof oc))continue;let l;r||s.action.id===li.ID||!s.isEnabled()&&this.options.focusOnlyEnabledItems?l=!1:l=!0,l?(s.setFocusable(!0),r=!0):s.setFocusable(!1)}}typeof this.focusedItem=="number"&&this.focus(this.focusedItem),this.refreshRole()}getWidth(e){if(e>=0&&e<this.actionsList.children.length){let t=this.actionsList.children.item(e);if(t)return t.clientWidth}return 0}getHeight(e){if(e>=0&&e<this.actionsList.children.length){let t=this.actionsList.children.item(e);if(t)return t.clientHeight}return 0}pull(e){e>=0&&e<this.viewItems.length&&(this.actionsList.childNodes[e].remove(),this.viewItemDisposables.deleteAndDispose(this.viewItems[e]),Ue(this.viewItems.splice(e,1)),this.refreshRole())}clear(){this.isEmpty()||(this.viewItems=Ue(this.viewItems),this.viewItemDisposables.clearAndDisposeAll(),Rt(this.actionsList),this.refreshRole())}length(){return this.viewItems.length}isEmpty(){return this.viewItems.length===0}isFocused(e){return e===void 0?gs(Pn(),this.domNode):gs(Pn(),this.actionsList.children[e])}focus(e){let t=!1,o;if(e===void 0?t=!0:typeof e=="number"?o=e:typeof e=="boolean"&&(t=e),t&&typeof this.focusedItem>"u"){let n=this.viewItems.findIndex(r=>r.isEnabled());this.focusedItem=n===-1?void 0:n,this.updateFocus(void 0,void 0,!0)}else o!==void 0&&(this.focusedItem=o),this.updateFocus(void 0,void 0,!0)}focusFirst(){return this.focusedItem=this.length()-1,this.focusNext(!0)}focusLast(){return this.focusedItem=0,this.focusPrevious(!0)}focusNext(e,t){if(typeof this.focusedItem>"u")this.focusedItem=this.viewItems.length-1;else if(this.viewItems.length<=1)return!1;let o=this.focusedItem,n;do{if(!e&&this.options.preventLoopNavigation&&this.focusedItem+1>=this.viewItems.length)return this.focusedItem=o,!1;this.focusedItem=(this.focusedItem+1)%this.viewItems.length,n=this.viewItems[this.focusedItem]}while(this.focusedItem!==o&&(this.options.focusOnlyEnabledItems&&!n.isEnabled()||n.action.id===li.ID));return this.updateFocus(void 0,void 0,t),!0}focusPrevious(e){if(typeof this.focusedItem>"u")this.focusedItem=0;else if(this.viewItems.length<=1)return!1;let t=this.focusedItem,o;do{if(this.focusedItem=this.focusedItem-1,this.focusedItem<0){if(!e&&this.options.preventLoopNavigation)return this.focusedItem=t,!1;this.focusedItem=this.viewItems.length-1}o=this.viewItems[this.focusedItem]}while(this.focusedItem!==t&&(this.options.focusOnlyEnabledItems&&!o.isEnabled()||o.action.id===li.ID));return this.updateFocus(!0),!0}updateFocus(e,t,o=!1){typeof this.focusedItem>"u"&&this.actionsList.focus({preventScroll:t}),this.previouslyFocusedItem!==void 0&&this.previouslyFocusedItem!==this.focusedItem&&this.viewItems[this.previouslyFocusedItem]?.blur();let n=this.focusedItem!==void 0?this.viewItems[this.focusedItem]:void 0;if(n){let r=!0;HD(n.focus)||(r=!1),this.options.focusOnlyEnabledItems&&HD(n.isEnabled)&&!n.isEnabled()&&(r=!1),n.action.id===li.ID&&(r=!1),r?(o||this.previouslyFocusedItem!==this.focusedItem)&&(n.focus(e),this.previouslyFocusedItem=this.focusedItem):(this.actionsList.focus({preventScroll:t}),this.previouslyFocusedItem=void 0),r&&n.showHover?.()}}doTrigger(e){if(typeof this.focusedItem>"u")return;let t=this.viewItems[this.focusedItem];if(t instanceof oc){let o=t._context===null||t._context===void 0?e:t._context;this.run(t._action,o)}}async run(e,t){await this._actionRunner.run(e,t)}dispose(){this._context=void 0,this.viewItems=Ue(this.viewItems),this.getContainer().remove(),super.dispose()}};function yq(a){if(!a.length)return a;let i=-1;for(let t=0;t<a.length;t++)if(a[t].id!==li.ID){i=t;break}if(i===-1)return[];a=a.slice(i);for(let t=a.length-1;t>=0&&a[t].id===li.ID;t--)a.splice(t,1);let e=!1;for(let t=a.length-1;t>=0;t--){let o=a[t].id===li.ID;o&&!e?a.splice(t,1):o?o&&(e=!1):e=!0}return a}function $5i(a,i,e,t){if(a.length===0)return i;if(i.length===0)return a;let o=[],n=0,r=0;for(;n<a.length&&r<i.length;){let s=a[n],l=i[r],c=e(s),u=e(l);c<u?(o.push(s),n++):c>u?(o.push(l),r++):(o.push(t(s,l)),n++,r++)}for(;n<a.length;)o.push(a[n]),n++;for(;r<i.length;)o.push(i[r]),r++;return o}function Wye(a,i){let e=new P,t=a.createDecorationsCollection();return e.add(XD({debugName:()=>`Apply decorations from ${i.debugName}`},o=>{let n=i.read(o);t.set(n)})),e.add({dispose:()=>{t.clear()}}),e}function wq(a,i){return a.appendChild(i),Z(()=>{i.remove()})}function q5i(a,i){return a.prepend(i),Z(()=>{i.remove()})}var Fye=class extends C{constructor(e,t){super();this._automaticLayout=!1;this.elementSizeObserver=this._register(new t9(e,t)),this._width=Le(this,this.elementSizeObserver.getWidth()),this._height=Le(this,this.elementSizeObserver.getHeight()),this._register(this.elementSizeObserver.onDidChange(o=>Ui(n=>{this._width.set(this.elementSizeObserver.getWidth(),n),this._height.set(this.elementSizeObserver.getHeight(),n)})))}get width(){return this._width}get height(){return this._height}get automaticLayout(){return this._automaticLayout}observe(e){this.elementSizeObserver.observe(e)}setAutomaticLayout(e){this._automaticLayout=e,e?this.elementSizeObserver.startObserving():this.elementSizeObserver.stopObserving()}};function Vti(a,i,e){let t=i.get(),o=t,n=t,r=Le("animatedValue",t),s=-1,l=300,c;e.add(xM({changeTracker:{createChangeSummary:()=>({animate:!1}),handleChange:(p,h)=>(p.didChange(i)&&(h.animate=h.animate||p.change),!0)}},(p,h)=>{c!==void 0&&(a.cancelAnimationFrame(c),c=void 0),o=n,t=i.read(p),s=Date.now()-(h.animate?0:l),u()}));function u(){let p=Date.now()-s;n=Math.floor(FFo(p,o,t-o,l)),p<l?c=a.requestAnimationFrame(u):n=t,r.set(n,void 0)}return r}function FFo(a,i,e,t){return a===t?i+e:e*(-Math.pow(2,-10*a/t)+1)+i}var xae=class extends C{constructor(i,e,t){super(),this._register(new Fti(i,t)),this._register(UM(t,{height:e.actualHeight,top:e.actualTop}))}},g1=class{constructor(i,e){this._afterLineNumber=i;this.heightInPx=e;this.domNode=document.createElement("div"),this._actualTop=Le(this,void 0),this._actualHeight=Le(this,void 0),this.actualTop=this._actualTop,this.actualHeight=this._actualHeight,this.showInHiddenAreas=!0,this.onChange=this._afterLineNumber,this.onDomNodeTop=t=>{this._actualTop.set(t,void 0)},this.onComputedHeight=t=>{this._actualHeight.set(t,void 0)}}get afterLineNumber(){return this._afterLineNumber.get()}},Fti=class a{constructor(i,e){this._editor=i;this._domElement=e;this._overlayWidgetId=`managedOverlayWidget-${a._counter++}`;this._overlayWidget={getId:()=>this._overlayWidgetId,getDomNode:()=>this._domElement,getPosition:()=>null};this._editor.addOverlayWidget(this._overlayWidget)}static{this._counter=0}dispose(){this._editor.removeOverlayWidget(this._overlayWidget)}};function UM(a,i){return he(e=>{for(let[t,o]of Object.entries(i))o&&typeof o=="object"&&"read"in o&&(o=o.read(e)),typeof o=="number"&&(o=`${o}px`),t=t.replace(/[A-Z]/g,n=>"-"+n.toLowerCase()),a.style[t]=o})}function Vye(a,i,e,t){let o=new P,n=[];return o.add(Ga((r,s)=>{let l=i.read(r),c=new Map,u=new Map;e&&e(!0),a.changeViewZones(p=>{for(let h of n)p.removeZone(h),t?.delete(h);n.length=0;for(let h of l){let g=p.addZone(h);h.setZoneId&&h.setZoneId(g),n.push(g),t?.add(g),c.set(h,g)}}),e&&e(!1),s.add(xM({changeTracker:{createChangeSummary(){return{zoneIds:[]}},handleChange(p,h){let g=u.get(p.changedObservable);return g!==void 0&&h.zoneIds.push(g),!0}}},(p,h)=>{for(let g of l)g.onChange&&(u.set(g.onChange,c.get(g)),g.onChange.read(p));e&&e(!0),a.changeViewZones(g=>{for(let f of h.zoneIds)g.layoutZone(f)}),e&&e(!1)}))})),o.add({dispose(){e&&e(!0),a.changeViewZones(r=>{for(let s of n)r.removeZone(s)}),t?.clear(),e&&e(!1)}}),o}var hSt=class extends $e{dispose(){super.dispose(!0)}};function Bti(a,i){let e=ju(i,o=>o.original.startLineNumber<=a.lineNumber);if(!e)return z.fromPositions(a);if(e.original.endLineNumberExclusive<=a.lineNumber){let o=a.lineNumber-e.original.endLineNumberExclusive+e.modified.endLineNumberExclusive;return z.fromPositions(new Ie(o,a.column))}if(!e.innerChanges)return z.fromPositions(new Ie(e.modified.startLineNumber,1));let t=ju(e.innerChanges,o=>o.originalRange.getStartPosition().isBeforeOrEqual(a));if(!t){let o=a.lineNumber-e.original.startLineNumber+e.modified.startLineNumber;return z.fromPositions(new Ie(o,a.column))}if(t.originalRange.containsPosition(a))return t.modifiedRange;{let o=WFo(t.originalRange.getEndPosition(),a);return z.fromPositions(o.addToPosition(t.modifiedRange.getEndPosition()))}}function WFo(a,i){return a.lineNumber===i.lineNumber?new Zl(0,i.column-a.column):new Zl(i.lineNumber-a.lineNumber,i.column-1)}function j5i(a,i){let e;return a.filter(t=>{let o=i(t,e);return e=t,o})}var CW=class{static create(i,e=void 0){return new wje(i,i,e)}static createWithDisposable(i,e,t=void 0){let o=new P;return o.add(e),o.add(i),new wje(i,o,t)}static createOfNonDisposable(i,e,t=void 0){return new wje(i,e,t)}},wje=class extends CW{constructor(e,t,o){super();this.object=e;this._disposable=t;this._debugOwner=o;this._refCount=1;this._isDisposed=!1;this._owners=[];o&&this._addOwner(o)}_addOwner(e){e&&this._owners.push(e)}createNewRef(e){return this._refCount++,e&&this._addOwner(e),new Wti(this,e)}dispose(){this._isDisposed||(this._isDisposed=!0,this._decreaseRefCount(this._debugOwner))}_decreaseRefCount(e){if(this._refCount--,this._refCount===0&&this._disposable.dispose(),e){let t=this._owners.indexOf(e);t!==-1&&this._owners.splice(t,1)}}},Wti=class extends CW{constructor(e,t){super();this._base=e;this._debugOwner=t;this._isDisposed=!1}get object(){return this._base.object}createNewRef(e){return this._base.createNewRef(e)}dispose(){this._isDisposed||(this._isDisposed=!0,this._base._decreaseRefCount(this._debugOwner))}};var Uti={IconContribution:"base.contributions.icons"},VFo;(i=>{function a(e,t){let o=e.defaults;for(;q.isThemeIcon(o);){let n=kae.getIcon(o.id);if(!n)return;o=n.defaults}return o}i.getDefinition=a})(VFo||={});var gSt;(e=>{function a(t){return{weight:t.weight,style:t.style,src:t.src.map(o=>({format:o.format,location:o.location.toString()}))}}e.toJSONObject=a;function i(t){let o=n=>Ae(n)?n:void 0;if(t&&Array.isArray(t.src)&&t.src.every(n=>Ae(n.format)&&Ae(n.location)))return{weight:o(t.weight),style:o(t.style),src:t.src.map(n=>({format:n.format,location:A.parse(n.location)}))}}e.fromJSONObject=i})(gSt||={});var Q9=/^([\w_-]+)$/,Bye=/^(normal|italic|(oblique[ \w\s-]+))$/,Hye=/^(normal|bold|lighter|bolder|(\d{0-1000}))$/,Cje=/^([\w_.%+-]+)$/,Y5i=/^woff|woff2|truetype|opentype|embedded-opentype|svg$/,fSt=/^#[0-9a-fA-F]{0,6}$/,Uye=d(2598,null),Hti=class extends C{constructor(){super();this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this.iconSchema={definitions:{icons:{type:"object",properties:{fontId:{type:"string",description:d(2595,null),pattern:Q9.source,patternErrorMessage:Uye},fontCharacter:{type:"string",description:d(2594,null)}},additionalProperties:!1,defaultSnippets:[{body:{fontCharacter:"\\\\e030"}}]}},type:"object",properties:{}};this.iconReferenceSchema={type:"string",pattern:`^${q.iconNameExpression}$`,enum:[],enumDescriptions:[]};this.iconsById={},this.iconFontsById={}}registerIcon(e,t,o,n){let r=this.iconsById[e];if(r){if(o&&!r.description){r.description=o,this.iconSchema.properties[e].markdownDescription=`${o} $(${e})`;let c=this.iconReferenceSchema.enum.indexOf(e);c!==-1&&(this.iconReferenceSchema.enumDescriptions[c]=o),this._onDidChange.fire()}return r}let s={id:e,description:o,defaults:t,deprecationMessage:n};this.iconsById[e]=s;let l={$ref:"#/definitions/icons"};return n&&(l.deprecationMessage=n),o&&(l.markdownDescription=`${o}: $(${e})`),this.iconSchema.properties[e]=l,this.iconReferenceSchema.enum.push(e),this.iconReferenceSchema.enumDescriptions.push(o||""),this._onDidChange.fire(),{id:e}}deregisterIcon(e){delete this.iconsById[e],delete this.iconSchema.properties[e];let t=this.iconReferenceSchema.enum.indexOf(e);t!==-1&&(this.iconReferenceSchema.enum.splice(t,1),this.iconReferenceSchema.enumDescriptions.splice(t,1)),this._onDidChange.fire()}getIcons(){return Object.keys(this.iconsById).map(e=>this.iconsById[e])}getIcon(e){return this.iconsById[e]}getIconSchema(){return this.iconSchema}getIconReferenceSchema(){return this.iconReferenceSchema}registerIconFont(e,t){let o=this.iconFontsById[e];return o||(this.iconFontsById[e]=t,this._onDidChange.fire(),t)}deregisterIconFont(e){delete this.iconFontsById[e]}getIconFont(e){return this.iconFontsById[e]}toString(){let e=(r,s)=>r.id.localeCompare(s.id),t=r=>{for(;q.isThemeIcon(r.defaults);)r=this.iconsById[r.defaults.id];return`codicon codicon-${r?r.id:""}`},o=[];o.push("| preview | identifier | default codicon ID | description"),o.push("| ----------- | --------------------------------- | --------------------------------- | --------------------------------- |");let n=Object.keys(this.iconsById).map(r=>this.iconsById[r]);for(let r of n.filter(s=>!!s.description).sort(e))o.push(`|<i class="${t(r)}"></i>|${r.id}|${q.isThemeIcon(r.defaults)?r.defaults.id:r.id}|${r.description||""}|`);o.push("| preview | identifier "),o.push("| ----------- | --------------------------------- |");for(let r of n.filter(s=>!q.isThemeIcon(s.defaults)).sort(e))o.push(`|<i class="${t(r)}"></i>|${r.id}|`);return o.join(`
`)}},kae=new Hti;oe.add(Uti.IconContribution,kae);function Re(a,i,e,t){return kae.registerIcon(a,i,e,t)}function jy(){return kae}function BFo(){let a=amt();for(let i in a){let e="\\"+a[i].toString(16);kae.registerIcon(i,{fontCharacter:e})}}BFo();var vSt="vscode://schemas/icons",X5i=oe.as(ea.JSONContribution);X5i.registerSchema(vSt,kae.getIconSchema());var Q5i=new Dt(()=>X5i.notifySchemaChanged(vSt),200);kae.onDidChange(()=>{Q5i.isScheduled()||Q5i.schedule()});var lE=Re("widget-close",M.close,d(2599,null)),J5i=Re("goto-previous-location",M.arrowUp,d(2597,null)),Z5i=Re("goto-next-location",M.arrowDown,d(2596,null)),xje=q.modify(M.sync,"spin"),cE=q.modify(M.loading,"spin");var HFo=Re("diff-review-insert",M.add,d(209,null)),UFo=Re("diff-review-remove",M.remove,d(210,null)),zFo=Re("diff-review-close",M.close,d(208,null)),QN=class extends C{constructor(e,t,o,n,r,s,l,c,u){super();this._parentNode=e;this._visible=t;this._setVisible=o;this._canClose=n;this._width=r;this._height=s;this._diffs=l;this._models=c;this._instantiationService=u;this._state=Ce(this,e=>{let t=this._visible.read(e);if(this._parentNode.style.visibility=t?"visible":"hidden",!t)return null;let o=e.store.add(this._instantiationService.createInstance(Eje,this._diffs,this._models,this._setVisible,this._canClose)),n=e.store.add(this._instantiationService.createInstance(Tje,this._parentNode,o,this._width,this._height,this._models));return{model:o,view:n}}).recomputeInitiallyAndOnChange(this._store)}static{this._ttPolicy=Kg("diffReview",{createHTML:e=>e})}next(){Ui(e=>{let t=this._visible.get();this._setVisible(!0,e),t&&this._state.get().model.nextGroup(e)})}prev(){Ui(e=>{this._setVisible(!0,e),this._state.get().model.previousGroup(e)})}close(){Ui(e=>{this._setVisible(!1,e)})}};QN=I([m(8,F)],QN);var Eje=class extends C{constructor(e,t,o,n,r){super();this._diffs=e;this._models=t;this._setVisible=o;this.canClose=n;this._accessibilitySignalService=r;this._groups=Le(this,[]);this._currentGroupIdx=Le(this,0);this._currentElementIdx=Le(this,0);this.groups=this._groups;this.currentGroup=this._currentGroupIdx.map((e,t)=>this._groups.read(t)[e]);this.currentGroupIndex=this._currentGroupIdx;this.currentElement=this._currentElementIdx.map((e,t)=>this.currentGroup.read(t)?.lines[e]);this._register(he(s=>{let l=this._diffs.read(s);if(!l){this._groups.set([],void 0);return}let c=KFo(l,this._models.getOriginalModel().getLineCount(),this._models.getModifiedModel().getLineCount());Ui(u=>{let p=this._models.getModifiedPosition();if(p){let h=c.findIndex(g=>p?.lineNumber<g.range.modified.endLineNumberExclusive);h!==-1&&this._currentGroupIdx.set(h,u)}this._groups.set(c,u)})})),this._register(he(s=>{let l=this.currentElement.read(s);l?.type===2?this._accessibilitySignalService.playSignal($o.diffLineDeleted,{source:"accessibleDiffViewer.currentElementChanged"}):l?.type===3&&this._accessibilitySignalService.playSignal($o.diffLineInserted,{source:"accessibleDiffViewer.currentElementChanged"})})),this._register(he(s=>{let l=this.currentElement.read(s);if(l&&l.type!==0){let c=l.modifiedLineNumber??l.diff.modified.startLineNumber;this._models.modifiedSetSelection(z.fromPositions(new Ie(c,1)))}}))}_goToGroupDelta(e,t){let o=this.groups.get();!o||o.length<=1||dN(t,n=>{this._currentGroupIdx.set(di.ofLength(o.length).clipCyclic(this._currentGroupIdx.get()+e),n),this._currentElementIdx.set(0,n)})}nextGroup(e){this._goToGroupDelta(1,e)}previousGroup(e){this._goToGroupDelta(-1,e)}_goToLineDelta(e){let t=this.currentGroup.get();!t||t.lines.length<=1||Ui(o=>{this._currentElementIdx.set(di.ofLength(t.lines.length).clip(this._currentElementIdx.get()+e),o)})}goToNextLine(){this._goToLineDelta(1)}goToPreviousLine(){this._goToLineDelta(-1)}goToLine(e){let t=this.currentGroup.get();if(!t)return;let o=t.lines.indexOf(e);o!==-1&&Ui(n=>{this._currentElementIdx.set(o,n)})}revealCurrentElementInEditor(){if(!this.canClose.get())return;this._setVisible(!1,void 0);let e=this.currentElement.get();e&&(e.type===2?this._models.originalReveal(z.fromPositions(new Ie(e.originalLineNumber,1))):this._models.modifiedReveal(e.type!==0?z.fromPositions(new Ie(e.modifiedLineNumber,1)):void 0))}close(){this.canClose.get()&&(this._setVisible(!1,void 0),this._models.modifiedFocus())}};Eje=I([m(4,tr)],Eje);var kje=3;function KFo(a,i,e){let t=[];for(let o of s6(a,(n,r)=>r.modified.startLineNumber-n.modified.endLineNumberExclusive<2*kje)){let n=[];n.push(new Kti);let r=new ro(Math.max(1,o[0].original.startLineNumber-kje),Math.min(o[o.length-1].original.endLineNumberExclusive+kje,i+1)),s=new ro(Math.max(1,o[0].modified.startLineNumber-kje),Math.min(o[o.length-1].modified.endLineNumberExclusive+kje,e+1));Nut(o,(u,p)=>{let h=new ro(u?u.original.endLineNumberExclusive:r.startLineNumber,p?p.original.startLineNumber:r.endLineNumberExclusive),g=new ro(u?u.modified.endLineNumberExclusive:s.startLineNumber,p?p.modified.startLineNumber:s.endLineNumberExclusive);h.forEach(f=>{n.push(new qti(f,g.startLineNumber+(f-h.startLineNumber)))}),p&&(p.original.forEach(f=>{n.push(new Gti(p,f))}),p.modified.forEach(f=>{n.push(new $ti(p,f))}))});let l=o[0].modified.join(o[o.length-1].modified),c=o[0].original.join(o[o.length-1].original);t.push(new zti(new NI(l,c),n))}return t}var zti=class{constructor(i,e){this.range=i;this.lines=e}},Kti=class{constructor(){this.type=0}},Gti=class{constructor(i,e){this.diff=i;this.originalLineNumber=e;this.type=2;this.modifiedLineNumber=void 0}},$ti=class{constructor(i,e){this.diff=i;this.modifiedLineNumber=e;this.type=3;this.originalLineNumber=void 0}},qti=class{constructor(i,e){this.originalLineNumber=i;this.modifiedLineNumber=e;this.type=1}},Tje=class extends C{constructor(e,t,o,n,r,s){super();this._element=e;this._model=t;this._width=o;this._height=n;this._models=r;this._languageService=s;this.domNode=this._element,this.domNode.className="monaco-component diff-review monaco-editor-background";let l=document.createElement("div");l.className="diff-review-actions",this._actionBar=this._register(new ji(l)),this._register(he(c=>{this._actionBar.clear(),this._model.canClose.read(c)&&this._actionBar.push(pi({id:"diffreview.close",label:d(217,null),class:"close-diff-review "+q.asClassName(zFo),enabled:!0,run:async()=>t.close()}),{label:!1,icon:!0})})),this._content=document.createElement("div"),this._content.className="diff-review-content",this._content.setAttribute("role","code"),this._scrollbar=this._register(new Pa(this._content,{})),Fi(this.domNode,this._scrollbar.getDomNode(),l),this._register(he(c=>{this._height.read(c),this._width.read(c),this._scrollbar.scanDomNode()})),this._register(Z(()=>{Fi(this.domNode)})),this._register(UM(this.domNode,{width:this._width,height:this._height})),this._register(UM(this._content,{width:this._width,height:this._height})),this._register(Ga((c,u)=>{this._model.currentGroup.read(c),this._render(u)})),this._register(Vo(this.domNode,"keydown",c=>{(c.equals(18)||c.equals(2066)||c.equals(530))&&(c.preventDefault(),this._model.goToNextLine()),(c.equals(16)||c.equals(2064)||c.equals(528))&&(c.preventDefault(),this._model.goToPreviousLine()),(c.equals(9)||c.equals(2057)||c.equals(521)||c.equals(1033))&&(c.preventDefault(),this._model.close()),(c.equals(10)||c.equals(3))&&(c.preventDefault(),this._model.revealCurrentElementInEditor())}))}_render(e){let t=this._models.getOriginalOptions(),o=this._models.getModifiedOptions(),n=document.createElement("div");n.className="diff-review-table",n.setAttribute("role","list"),n.setAttribute("aria-label",d(211,null)),Pd(n,o.get(59)),Fi(this._content,n);let r=this._models.getOriginalModel(),s=this._models.getModifiedModel();if(!r||!s)return;let l=r.getOptions(),c=s.getOptions(),u=o.get(75),p=this._model.currentGroup.get();for(let h of p?.lines||[]){if(!p)break;let g;if(h.type===0){let v=document.createElement("div");v.className="diff-review-row",v.setAttribute("role","listitem");let b=p.range,S=this._model.currentGroupIndex.get(),y=this._model.groups.get().length,w=O=>O===0?d(219,null):O===1?d(220,null):d(218,null,O),k=w(b.original.length),T=w(b.modified.length);v.setAttribute("aria-label",d(215,null,S+1,y,b.original.startLineNumber,k,b.modified.startLineNumber,T));let N=document.createElement("div");N.className="diff-review-cell diff-review-summary",N.appendChild(document.createTextNode(`${S+1}/${y}: @@ -${b.original.startLineNumber},${b.original.length} +${b.modified.startLineNumber},${b.modified.length} @@`)),v.appendChild(N),g=v}else g=this._createRow(h,u,this._width.get(),t,r,l,o,s,c);n.appendChild(g);let f=Ce(v=>this._model.currentElement.read(v)===h);e.add(he(v=>{let b=f.read(v);g.tabIndex=b?0:-1,b&&g.focus()})),e.add(j(g,"focus",()=>{this._model.goToLine(h)}))}this._scrollbar.scanDomNode()}_createRow(e,t,o,n,r,s,l,c,u){let p=n.get(165),h=p.glyphMarginWidth+p.lineNumbersWidth,g=l.get(165),f=10+g.glyphMarginWidth+g.lineNumbersWidth,v="diff-review-row",b="",S="diff-review-spacer",y=null;switch(e.type){case 3:v="diff-review-row line-insert",b=" char-insert",y=HFo;break;case 2:v="diff-review-row line-delete",b=" char-delete",y=UFo;break}let w=document.createElement("div");w.style.minWidth=o+"px",w.className=v,w.setAttribute("role","listitem"),w.ariaLevel="";let k=document.createElement("div");k.className="diff-review-cell",k.style.height=`${t}px`,w.appendChild(k);let T=document.createElement("span");T.style.width=h+"px",T.style.minWidth=h+"px",T.className="diff-review-line-number"+b,e.originalLineNumber!==void 0?T.appendChild(document.createTextNode(String(e.originalLineNumber))):T.innerText="\xA0",k.appendChild(T);let N=document.createElement("span");N.style.width=f+"px",N.style.minWidth=f+"px",N.style.paddingRight="10px",N.className="diff-review-line-number"+b,e.modifiedLineNumber!==void 0?N.appendChild(document.createTextNode(String(e.modifiedLineNumber))):N.innerText="\xA0",k.appendChild(N);let O=document.createElement("span");if(O.className=S,y){let G=document.createElement("span");G.className=q.asClassName(y),G.innerText="\xA0\xA0",O.appendChild(G)}else O.innerText="\xA0\xA0";k.appendChild(O);let V;if(e.modifiedLineNumber!==void 0){let G=this._getLineHtml(c,l,u.tabSize,e.modifiedLineNumber,this._languageService.languageIdCodec);QN._ttPolicy&&(G=QN._ttPolicy.createHTML(G)),k.insertAdjacentHTML("beforeend",G),V=c.getLineContent(e.modifiedLineNumber)}else{let G=this._getLineHtml(r,n,s.tabSize,e.originalLineNumber,this._languageService.languageIdCodec);QN._ttPolicy&&(G=QN._ttPolicy.createHTML(G)),k.insertAdjacentHTML("beforeend",G),V=r.getLineContent(e.originalLineNumber)}V.length===0&&(V=d(212,null));let U="";switch(e.type){case 1:e.originalLineNumber===e.modifiedLineNumber?U=d(221,null,V,e.originalLineNumber):U=d(214,null,V,e.originalLineNumber,e.modifiedLineNumber);break;case 3:U=d(216,null,V,e.modifiedLineNumber);break;case 2:U=d(213,null,V,e.originalLineNumber);break}return w.setAttribute("aria-label",U),w}_getLineHtml(e,t,o,n,r){let s=e.getLineContent(n),l=t.get(59),c=t.get(117).verticalScrollbarSize,u=Bc.createEmpty(s,r),p=KU.isBasicASCII(s,e.mightContainNonBasicASCII()),h=KU.containsRTL(s,p,e.mightContainRTL());return g$i(new hL(l.isMonospace&&!t.get(40),l.canUseHalfwidthRightwardsArrow,s,!1,p,h,0,u,[],o,0,l.spaceWidth,l.middotWidth,l.wsmiddotWidth,t.get(133),t.get(113),t.get(108),t.get(60)!==mx.OFF,null,null,c)).html}};Tje=I([m(5,kt)],Tje);var bSt=class{constructor(i){this.editors=i}getOriginalModel(){return this.editors.original.getModel()}getOriginalOptions(){return this.editors.original.getOptions()}originalReveal(i){this.editors.original.revealRange(i),this.editors.original.setSelection(i),this.editors.original.focus()}getModifiedModel(){return this.editors.modified.getModel()}getModifiedOptions(){return this.editors.modified.getOptions()}modifiedReveal(i){i&&(this.editors.modified.revealRange(i),this.editors.modified.setSelection(i)),this.editors.modified.focus()}modifiedSetSelection(i){this.editors.modified.setSelection(i)}modifiedFocus(){this.editors.modified.focus()}getModifiedPosition(){return this.editors.modified.getPosition()??void 0}};var $gr=J("diffEditor.move.border","#8b8b8b9c",d(247,null)),qgr=J("diffEditor.moveActive.border","#FFA500",d(248,null)),jgr=J("diffEditor.unchangedRegionShadow",{dark:"#000000",light:"#737373BF",hcDark:"#000000",hcLight:"#737373BF"},d(249,null)),GFo=Re("diff-insert",M.add,d(250,null)),jti=Re("diff-remove",M.remove,d(251,null)),Qti=po.register({className:"line-insert",description:"line-insert",isWholeLine:!0,linesDecorationsClassName:"insert-sign "+q.asClassName(GFo),marginClassName:"gutter-insert"}),Yti=po.register({className:"line-delete",description:"line-delete",isWholeLine:!0,linesDecorationsClassName:"delete-sign "+q.asClassName(jti),marginClassName:"gutter-delete"}),Xti=po.register({className:"line-insert",description:"line-insert",isWholeLine:!0,marginClassName:"gutter-insert"}),Jti=po.register({className:"line-delete",description:"line-delete",isWholeLine:!0,marginClassName:"gutter-delete"}),Eae=po.register({className:"char-insert",description:"char-insert",shouldFillLineOnLineBreak:!0}),zye=po.register({className:"char-insert",description:"char-insert",isWholeLine:!0}),e4i=po.register({className:"char-insert diff-range-empty",description:"char-insert diff-range-empty"}),Cq=po.register({className:"char-delete",description:"char-delete",shouldFillLineOnLineBreak:!0}),t4i=po.register({className:"char-delete",description:"char-delete",isWholeLine:!0}),i4i=po.register({className:"char-delete diff-range-empty",description:"char-delete diff-range-empty"});var Zti=ae("diffProviderFactoryService"),_je=class{constructor(i){this.instantiationService=i}createDiffProvider(i){return this.instantiationService.createInstance(xW,i)}};_je=I([m(0,F)],_je);we(Zti,_je,1);var xW=class{constructor(i,e,t){this.editorWorkerService=e;this.telemetryService=t;this.onDidChangeEventEmitter=new E;this.onDidChange=this.onDidChangeEventEmitter.event;this.diffAlgorithm="advanced";this.diffAlgorithmOnDidChangeSubscription=void 0;this.setOptions(i)}static{this.diffCache=new Map}dispose(){this.diffAlgorithmOnDidChangeSubscription?.dispose(),this.onDidChangeEventEmitter.dispose()}async computeDiff(i,e,t,o){if(typeof this.diffAlgorithm!="string")return this.diffAlgorithm.computeDiff(i,e,t,o);if(i.isDisposed()||e.isDisposed())return{changes:[],identical:!0,quitEarly:!1,moves:[]};if(i.getLineCount()===1&&i.getLineMaxColumn(1)===1)return e.getLineCount()===1&&e.getLineMaxColumn(1)===1?{changes:[],identical:!0,quitEarly:!1,moves:[]}:{changes:[new wf(new ro(1,2),new ro(1,e.getLineCount()+1),[new cg(i.getFullModelRange(),e.getFullModelRange())])],identical:!1,quitEarly:!1,moves:[]};let n=JSON.stringify([i.uri.toString(),e.uri.toString()]),r=JSON.stringify([i.id,e.id,i.getAlternativeVersionId(),e.getAlternativeVersionId(),JSON.stringify(t)]),s=xW.diffCache.get(n);if(s&&s.context===r)return s.result;let l=En.create(),c=await this.editorWorkerService.computeDiff(i.uri,e.uri,t,this.diffAlgorithm),u=l.elapsed();if(this.telemetryService.publicLog2("diffEditor.computeDiff",{timeMs:u,timedOut:c?.quitEarly??!0,detectedMoves:t.computeMoves?c?.moves.length??0:-1}),o.isCancellationRequested)return{changes:[],identical:!1,quitEarly:!0,moves:[]};if(!c)throw new Error("no diff result available");return xW.diffCache.size>10&&xW.diffCache.delete(xW.diffCache.keys().next().value),xW.diffCache.set(n,{result:c,context:r}),c}setOptions(i){let e=!1;i.diffAlgorithm&&this.diffAlgorithm!==i.diffAlgorithm&&(this.diffAlgorithmOnDidChangeSubscription?.dispose(),this.diffAlgorithmOnDidChangeSubscription=void 0,this.diffAlgorithm=i.diffAlgorithm,typeof i.diffAlgorithm!="string"&&(this.diffAlgorithmOnDidChangeSubscription=i.diffAlgorithm.onDidChange(()=>this.onDidChangeEventEmitter.fire())),e=!0),e&&this.onDidChangeEventEmitter.fire()}};xW=I([m(1,$s),m(2,Te)],xW);var Y9=class extends C{constructor(e,t,o){super();this.model=e;this._options=t;this._diffProviderFactoryService=o;this._isDiffUpToDate=Le(this,!1);this.isDiffUpToDate=this._isDiffUpToDate;this._diff=Le(this,void 0);this.diff=this._diff;this._unchangedRegions=Le(this,void 0);this.unchangedRegions=Ce(this,e=>this._options.hideUnchangedRegions.read(e)?this._unchangedRegions.read(e)?.regions??[]:(Ui(t=>{for(let o of this._unchangedRegions.read(void 0)?.regions||[])o.collapseAll(t)}),[]));this.movedTextToCompare=Le(this,void 0);this._activeMovedText=Le(this,void 0);this._hoveredMovedText=Le(this,void 0);this.activeMovedText=Ce(this,e=>this.movedTextToCompare.read(e)??this._hoveredMovedText.read(e)??this._activeMovedText.read(e));this._cancellationTokenSource=new $e;this._diffProvider=Ce(this,e=>{let t=this._diffProviderFactoryService.createDiffProvider({diffAlgorithm:this._options.diffAlgorithm.read(e)}),o=Nr("onDidChange",t.onDidChange);return{diffProvider:t,onChangeSignal:o}});this._register(Z(()=>this._cancellationTokenSource.cancel()));let n=Wc("contentChangedSignal"),r=this._register(new Dt(()=>n.trigger(void 0),200));this._register(he(l=>{let c=this._unchangedRegions.read(l);if(!c||c.regions.some(v=>v.isDragged.read(l)))return;let u=c.originalDecorationIds.map(v=>e.original.getDecorationRange(v)).map(v=>v?ro.fromRangeInclusive(v):void 0),p=c.modifiedDecorationIds.map(v=>e.modified.getDecorationRange(v)).map(v=>v?ro.fromRangeInclusive(v):void 0),h=c.regions.map((v,b)=>!u[b]||!p[b]?void 0:new X9(u[b].startLineNumber,p[b].startLineNumber,u[b].length,v.visibleLineCountTop.read(l),v.visibleLineCountBottom.read(l))).filter(mo),g=[],f=!1;for(let v of s6(h,(b,S)=>b.getHiddenModifiedRange(l).endLineNumberExclusive===S.getHiddenModifiedRange(l).startLineNumber))if(v.length>1){f=!0;let b=v.reduce((y,w)=>y+w.lineCount,0),S=new X9(v[0].originalLineNumber,v[0].modifiedLineNumber,b,v[0].visibleLineCountTop.read(void 0),v[v.length-1].visibleLineCountBottom.read(void 0));g.push(S)}else g.push(v[0]);if(f){let v=e.original.deltaDecorations(c.originalDecorationIds,g.map(S=>({range:S.originalUnchangedRange.toInclusiveRange(),options:{description:"unchanged"}}))),b=e.modified.deltaDecorations(c.modifiedDecorationIds,g.map(S=>({range:S.modifiedUnchangedRange.toInclusiveRange(),options:{description:"unchanged"}})));Ui(S=>{this._unchangedRegions.set({regions:g,originalDecorationIds:v,modifiedDecorationIds:b},S)})}}));let s=(l,c,u)=>{let p=X9.fromDiffs(l.changes,e.original.getLineCount(),e.modified.getLineCount(),this._options.hideUnchangedRegionsMinimumLineCount.read(u),this._options.hideUnchangedRegionsContextLineCount.read(u)),h,g=this._unchangedRegions.get();if(g){let S=g.originalDecorationIds.map(T=>e.original.getDecorationRange(T)).map(T=>T?ro.fromRangeInclusive(T):void 0),y=g.modifiedDecorationIds.map(T=>e.modified.getDecorationRange(T)).map(T=>T?ro.fromRangeInclusive(T):void 0),k=j5i(g.regions.map((T,N)=>{if(!S[N]||!y[N])return;let O=S[N].length;return new X9(S[N].startLineNumber,y[N].startLineNumber,O,Math.min(T.visibleLineCountTop.get(),O),Math.min(T.visibleLineCountBottom.get(),O-T.visibleLineCountTop.get()))}).filter(mo),(T,N)=>!N||T.modifiedLineNumber>=N.modifiedLineNumber+N.lineCount&&T.originalLineNumber>=N.originalLineNumber+N.lineCount).map(T=>new NI(T.getHiddenOriginalRange(u),T.getHiddenModifiedRange(u)));k=NI.clip(k,ro.ofLength(1,e.original.getLineCount()),ro.ofLength(1,e.modified.getLineCount())),h=NI.inverse(k,e.original.getLineCount(),e.modified.getLineCount())}let f=[];if(h)for(let S of p){let y=h.filter(w=>w.original.intersectsStrict(S.originalUnchangedRange)&&w.modified.intersectsStrict(S.modifiedUnchangedRange));f.push(...S.setVisibleRanges(y,c))}else f.push(...p);let v=e.original.deltaDecorations(g?.originalDecorationIds||[],f.map(S=>({range:S.originalUnchangedRange.toInclusiveRange(),options:{description:"unchanged"}}))),b=e.modified.deltaDecorations(g?.modifiedDecorationIds||[],f.map(S=>({range:S.modifiedUnchangedRange.toInclusiveRange(),options:{description:"unchanged"}})));this._unchangedRegions.set({regions:f,originalDecorationIds:v,modifiedDecorationIds:b},c)};this._register(e.modified.onDidChangeContent(l=>{if(this._diff.get()){let u=zN.fromModelContentChanges(l.changes),p=(this._lastDiff,e.original,e.modified,void 0);p&&(this._lastDiff=p,Ui(h=>{this._diff.set(Tae.fromDiffResult(this._lastDiff),h),s(p,h);let g=this.movedTextToCompare.get();this.movedTextToCompare.set(g?this._lastDiff.moves.find(f=>f.lineRangeMapping.modified.intersect(g.lineRangeMapping.modified)):void 0,h)}))}this._isDiffUpToDate.set(!1,void 0),r.schedule()})),this._register(e.original.onDidChangeContent(l=>{if(this._diff.get()){let u=zN.fromModelContentChanges(l.changes),p=(this._lastDiff,e.original,e.modified,void 0);p&&(this._lastDiff=p,Ui(h=>{this._diff.set(Tae.fromDiffResult(this._lastDiff),h),s(p,h);let g=this.movedTextToCompare.get();this.movedTextToCompare.set(g?this._lastDiff.moves.find(f=>f.lineRangeMapping.modified.intersect(g.lineRangeMapping.modified)):void 0,h)}))}this._isDiffUpToDate.set(!1,void 0),r.schedule()})),this._register(Ga(async(l,c)=>{this._options.hideUnchangedRegionsMinimumLineCount.read(l),this._options.hideUnchangedRegionsContextLineCount.read(l),r.cancel(),n.read(l);let u=this._diffProvider.read(l);u.onChangeSignal.read(l),Cx(WSe,l),Cx(k$e,l),this._isDiffUpToDate.set(!1,void 0);let p=[];c.add(e.original.onDidChangeContent(f=>{let v=zN.fromModelContentChanges(f.changes);p=pye(p,v)}));let h=[];c.add(e.modified.onDidChangeContent(f=>{let v=zN.fromModelContentChanges(f.changes);h=pye(h,v)}));let g=await u.diffProvider.computeDiff(e.original,e.modified,{ignoreTrimWhitespace:this._options.ignoreTrimWhitespace.read(l),maxComputationTimeMs:this._options.maxComputationTimeMs.read(l),computeMoves:this._options.showMoves.read(l)},this._cancellationTokenSource.token);this._cancellationTokenSource.token.isCancellationRequested||e.original.isDisposed()||e.modified.isDisposed()||(g=$Fo(g,e.original,e.modified),g=(e.original,e.modified,void 0)??g,g=(e.original,e.modified,void 0)??g,Ui(f=>{s(g,f),this._lastDiff=g;let v=Tae.fromDiffResult(g);this._diff.set(v,f),this._isDiffUpToDate.set(!0,f);let b=this.movedTextToCompare.read(void 0);this.movedTextToCompare.set(b?this._lastDiff.moves.find(S=>S.lineRangeMapping.modified.intersect(b.lineRangeMapping.modified)):void 0,f)}))}))}setActiveMovedText(e){this._activeMovedText.set(e,void 0)}setHoveredMovedText(e){this._hoveredMovedText.set(e,void 0)}ensureModifiedLineIsVisible(e,t,o){if(this.diff.get()?.mappings.length===0)return;let n=this._unchangedRegions.get()?.regions||[];for(let r of n)if(r.getHiddenModifiedRange(void 0).contains(e)){r.showModifiedLine(e,t,o);return}}ensureOriginalLineIsVisible(e,t,o){if(this.diff.get()?.mappings.length===0)return;let n=this._unchangedRegions.get()?.regions||[];for(let r of n)if(r.getHiddenOriginalRange(void 0).contains(e)){r.showOriginalLine(e,t,o);return}}async waitForDiff(){await gf(this.isDiffUpToDate,e=>e)}serializeState(){return{collapsedRegions:this._unchangedRegions.get()?.regions.map(t=>({range:t.getHiddenModifiedRange(void 0).serialize()}))}}restoreSerializedState(e){let t=e.collapsedRegions?.map(n=>ro.deserialize(n.range)),o=this._unchangedRegions.get();!o||!t||Ui(n=>{for(let r of o.regions)for(let s of t)if(r.modifiedUnchangedRange.intersect(s)){r.setHiddenModifiedRange(s,n);break}})}};Y9=I([m(2,Zti)],Y9);function $Fo(a,i,e){return{changes:a.changes.map(t=>new wf(t.original,t.modified,t.innerChanges?t.innerChanges.map(o=>qFo(o,i,e)):void 0)),moves:a.moves,identical:a.identical,quitEarly:a.quitEarly}}function qFo(a,i,e){let t=a.originalRange,o=a.modifiedRange;return t.startColumn===1&&o.startColumn===1&&(t.endColumn!==1||o.endColumn!==1)&&t.endColumn===i.getLineMaxColumn(t.endLineNumber)&&o.endColumn===e.getLineMaxColumn(o.endLineNumber)&&t.endLineNumber<i.getLineCount()&&o.endLineNumber<e.getLineCount()&&(t=t.setEndPosition(t.endLineNumber+1,1),o=o.setEndPosition(o.endLineNumber+1,1)),new cg(t,o)}var Tae=class a{constructor(i,e,t,o){this.mappings=i;this.movedTexts=e;this.identical=t;this.quitEarly=o}static fromDiffResult(i){return new a(i.changes.map(e=>new Dje(e)),i.moves||[],i.identical,i.quitEarly)}},Dje=class{constructor(i){this.lineRangeMapping=i}},X9=class a{constructor(i,e,t,o,n){this.originalLineNumber=i;this.modifiedLineNumber=e;this.lineCount=t;this._visibleLineCountTop=Le(this,0);this.visibleLineCountTop=this._visibleLineCountTop;this._visibleLineCountBottom=Le(this,0);this.visibleLineCountBottom=this._visibleLineCountBottom;this._shouldHideControls=Ce(this,i=>this.visibleLineCountTop.read(i)+this.visibleLineCountBottom.read(i)===this.lineCount&&!this.isDragged.read(i));this.isDragged=Le(this,void 0);let r=Math.max(Math.min(o,this.lineCount),0),s=Math.max(Math.min(n,this.lineCount-o),0);A6t(o===r),A6t(n===s),this._visibleLineCountTop.set(r,void 0),this._visibleLineCountBottom.set(s,void 0)}static fromDiffs(i,e,t,o,n){let r=wf.inverse(i,e,t),s=[];for(let l of r){let c=l.original.startLineNumber,u=l.modified.startLineNumber,p=l.original.length,h=c===1&&u===1,g=c+p===e+1&&u+p===t+1;(h||g)&&p>=n+o?(h&&!g&&(p-=n),g&&!h&&(c+=n,u+=n,p-=n),s.push(new a(c,u,p,0,0))):p>=n*2+o&&(c+=n,u+=n,p-=n*2,s.push(new a(c,u,p,0,0)))}return s}get originalUnchangedRange(){return ro.ofLength(this.originalLineNumber,this.lineCount)}get modifiedUnchangedRange(){return ro.ofLength(this.modifiedLineNumber,this.lineCount)}setVisibleRanges(i,e){let t=[],o=new PM(i.map(l=>l.modified)).subtractFrom(this.modifiedUnchangedRange),n=this.originalLineNumber,r=this.modifiedLineNumber,s=this.modifiedLineNumber+this.lineCount;if(o.ranges.length===0)this.showAll(e),t.push(this);else{let l=0;for(let c of o.ranges){let u=l===o.ranges.length-1;l++;let p=(u?s:c.endLineNumberExclusive)-r,h=new a(n,r,p,0,0);h.setHiddenModifiedRange(c,e),t.push(h),n=h.originalUnchangedRange.endLineNumberExclusive,r=h.modifiedUnchangedRange.endLineNumberExclusive}}return t}shouldHideControls(i){return this._shouldHideControls.read(i)}getHiddenOriginalRange(i){return ro.ofLength(this.originalLineNumber+this._visibleLineCountTop.read(i),this.lineCount-this._visibleLineCountTop.read(i)-this._visibleLineCountBottom.read(i))}getHiddenModifiedRange(i){return ro.ofLength(this.modifiedLineNumber+this._visibleLineCountTop.read(i),this.lineCount-this._visibleLineCountTop.read(i)-this._visibleLineCountBottom.read(i))}setHiddenModifiedRange(i,e){let t=i.startLineNumber-this.modifiedLineNumber,o=this.modifiedLineNumber+this.lineCount-i.endLineNumberExclusive;this.setState(t,o,e)}getMaxVisibleLineCountTop(){return this.lineCount-this._visibleLineCountBottom.get()}getMaxVisibleLineCountBottom(){return this.lineCount-this._visibleLineCountTop.get()}showMoreAbove(i=10,e){let t=this.getMaxVisibleLineCountTop();this._visibleLineCountTop.set(Math.min(this._visibleLineCountTop.get()+i,t),e)}showMoreBelow(i=10,e){let t=this.lineCount-this._visibleLineCountTop.get();this._visibleLineCountBottom.set(Math.min(this._visibleLineCountBottom.get()+i,t),e)}showAll(i){this._visibleLineCountBottom.set(this.lineCount-this._visibleLineCountTop.get(),i)}showModifiedLine(i,e,t){let o=i+1-(this.modifiedLineNumber+this._visibleLineCountTop.get()),n=this.modifiedLineNumber-this._visibleLineCountBottom.get()+this.lineCount-i;e===0&&o<n||e===1?this._visibleLineCountTop.set(this._visibleLineCountTop.get()+o,t):this._visibleLineCountBottom.set(this._visibleLineCountBottom.get()+n,t)}showOriginalLine(i,e,t){let o=i-this.originalLineNumber,n=this.originalLineNumber+this.lineCount-i;e===0&&o<n||e===1?this._visibleLineCountTop.set(Math.min(this._visibleLineCountTop.get()+n-o,this.getMaxVisibleLineCountTop()),t):this._visibleLineCountBottom.set(Math.min(this._visibleLineCountBottom.get()+o-n,this.getMaxVisibleLineCountBottom()),t)}collapseAll(i){this._visibleLineCountTop.set(0,i),this._visibleLineCountBottom.set(0,i)}setState(i,e,t){i=Math.max(Math.min(i,this.lineCount),0),e=Math.max(Math.min(e,this.lineCount-i),0),this._visibleLineCountTop.set(i,t),this._visibleLineCountBottom.set(e,t)}};function o4i(a){let{domNode:i,renderLinesResult:e,diffEntry:t,originalModel:o,clipboardService:n}=a,r=new P;return r.add(j(i,"copy",s=>{s.preventDefault();let l=i.ownerDocument.getSelection();if(!l||l.rangeCount===0)return;let c=l.getRangeAt(0);if(!c||c.collapsed)return;let u=c.startContainer.nodeType===Node.TEXT_NODE?c.startContainer.parentElement:c.startContainer,p=c.endContainer.nodeType===Node.TEXT_NODE?c.endContainer.parentElement:c.endContainer;if(!u||!p)return;let h=e.getModelPositionAt(u,c.startOffset),g=e.getModelPositionAt(p,c.endOffset);if(!h||!g)return;let f=h.delta(t.original.startLineNumber-1),v=g.delta(t.original.startLineNumber-1),b=v.isBefore(f)?z.fromPositions(v,f):z.fromPositions(f,v),S=o.getValueInRange(b);n.writeText(S)})),r}var SSt=class extends C{constructor(e,t,o,n,r,s,l,c,u,p){super();this._getViewZoneId=e;this._marginDomNode=t;this._deletedCodeDomNode=o;this._modifiedEditor=n;this._diff=r;this._editor=s;this._renderLinesResult=l;this._originalTextModel=c;this._contextMenuService=u;this._clipboardService=p;this._visibility=!1;this._marginDomNode.style.zIndex="10",this._diffActions=document.createElement("div"),this._diffActions.className=q.asClassName(M.lightBulb)+" lightbulb-glyph",this._diffActions.style.position="absolute";let h=this._modifiedEditor.getOption(75);this._diffActions.style.right="0px",this._diffActions.style.visibility="hidden",this._diffActions.style.height=`${h}px`,this._diffActions.style.lineHeight=`${h}px`,this._marginDomNode.appendChild(this._diffActions);let g=0,f=n.getOption(144)&&!Nc,v=(b,S,y)=>{this._contextMenuService.showContextMenu({domForShadowRoot:f?n.getDomNode()??void 0:void 0,getAnchor:()=>b,onHide:y,getActions:()=>{let w=S??[],k=r.modified.isEmpty;return w.push(new st("diff.clipboard.copyDeletedContent",k?r.original.length>1?d(227,null):d(228,null):r.original.length>1?d(224,null):d(225,null),void 0,!0,async()=>{let N=this._originalTextModel.getValueInRange(r.original.toExclusiveRange());await this._clipboardService.writeText(N)})),r.original.length>1&&w.push(new st("diff.clipboard.copyDeletedLineContent",k?d(226,null,r.original.startLineNumber+g):d(223,null,r.original.startLineNumber+g),void 0,!0,async()=>{let N=this._originalTextModel.getLineContent(r.original.startLineNumber+g);N===""&&(N=this._originalTextModel.getEndOfLineSequence()===0?`
`:`\r
`),await this._clipboardService.writeText(N)})),n.getOption(104)||w.push(new st("diff.inline.revertChange",d(229,null),void 0,!0,async()=>{this._editor.revert(this._diff)})),w},autoSelectFirstItem:!0})};this._register(Vo(this._diffActions,"mousedown",b=>{if(!b.leftButton)return;let{top:S,height:y}=Yn(this._diffActions),w=Math.floor(h/3);b.preventDefault(),v({x:b.posx,y:S+y+w})})),this._register(n.onMouseMove(b=>{(b.target.type===8||b.target.type===5)&&b.target.detail.viewZoneId===this._getViewZoneId()?(g=this._updateLightBulbPosition(this._marginDomNode,b.event.browserEvent.y,h),this.visibility=!0):this.visibility=!1})),this._register(o4i({domNode:this._deletedCodeDomNode,diffEntry:r,originalModel:this._originalTextModel,renderLinesResult:this._renderLinesResult,clipboardService:p}))}get visibility(){return this._visibility}set visibility(e){this._visibility!==e&&(this._visibility=e,this._diffActions.style.visibility=e?"visible":"hidden")}_updateLightBulbPosition(e,t,o){let{top:n}=Yn(e),r=t-n,s=Math.floor(r/o),l=s*o;if(this._diffActions.style.top=`${l}px`,this._renderLinesResult.viewLineCounts){let c=0;for(let u=0;u<this._renderLinesResult.viewLineCounts.length;u++)if(c+=this._renderLinesResult.viewLineCounts[u],s<c)return u}return s}};var n4i=Kg("diffEditorWidget",{createHTML:a=>a});function EL(a,i,e,t,o=!1){Pd(t,i.fontInfo);let n=e.length>0,r=new ES(1e4),s=0,l=0,c=[],u=[];for(let f=0;f<a.lineTokens.length;f++){let v=f+1,b=a.lineTokens[f],S=a.lineBreakData[f],y=Jv.filter(e,v,1,Number.MAX_SAFE_INTEGER);if(S){let w=0;for(let k of S.breakOffsets){let T=b.sliceAndInflate(w,k,0),N=r4i(l,T,Jv.extractWrapped(y,w,k),n,a.mightContainNonBasicASCII,a.mightContainRTL,i,r,o);s=Math.max(s,N.maxCharWidth),u.push(new ISt(N.output.characterMapping,N.output.containsForeignElements,w)),l++,w=k}c.push(S.breakOffsets.length)}else{c.push(1);let w=r4i(l,b,y,n,a.mightContainNonBasicASCII,a.mightContainRTL,i,r,o);s=Math.max(s,w.maxCharWidth),u.push(new ISt(w.output.characterMapping,w.output.containsForeignElements,0)),l++}}s+=i.scrollBeyondLastColumn;let p=r.build(),h=n4i?n4i.createHTML(p):p;t.innerHTML=h;let g=s*i.typicalHalfwidthCharacterWidth;return new eii(l,g,c,u,a)}var dE=class{constructor(i,e=i.map(n=>null),t=!0,o=!0){this.lineTokens=i;this.lineBreakData=e;this.mightContainNonBasicASCII=t;this.mightContainRTL=o}},uE=class a{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g=!0){this.tabSize=i;this.fontInfo=e;this.disableMonospaceOptimizations=t;this.typicalHalfwidthCharacterWidth=o;this.scrollBeyondLastColumn=n;this.lineHeight=r;this.lineDecorationsWidth=s;this.stopRenderingLineAfter=l;this.renderWhitespace=c;this.renderControlCharacters=u;this.fontLigatures=p;this.verticalScrollbarSize=h;this.setWidth=g}static fromEditor(i){let e=i.getOptions(),t=e.get(59),o=e.get(165);return new a(i.getModel()?.getOptions().tabSize||0,t,e.get(40),t.typicalHalfwidthCharacterWidth,e.get(118),e.get(75),o.decorationsWidth,e.get(133),e.get(113),e.get(108),e.get(60),e.get(117).verticalScrollbarSize)}withSetWidth(i){return new a(this.tabSize,this.fontInfo,this.disableMonospaceOptimizations,this.typicalHalfwidthCharacterWidth,this.scrollBeyondLastColumn,this.lineHeight,this.lineDecorationsWidth,this.stopRenderingLineAfter,this.renderWhitespace,this.renderControlCharacters,this.fontLigatures,this.verticalScrollbarSize,i)}withScrollBeyondLastColumn(i){return new a(this.tabSize,this.fontInfo,this.disableMonospaceOptimizations,this.typicalHalfwidthCharacterWidth,i,this.lineHeight,this.lineDecorationsWidth,this.stopRenderingLineAfter,this.renderWhitespace,this.renderControlCharacters,this.fontLigatures,this.verticalScrollbarSize,this.setWidth)}},eii=class{constructor(i,e,t,o,n){this.heightInLines=i;this.minWidthInPx=e;this.viewLineCounts=t;this._renderOutputs=o;this._source=n}getModelPositionAt(i,e){let t=i;for(;t&&!t.classList.contains("view-line");)t=t.parentElement;if(!t)return;let o=t.parentElement;if(!o)return;let n=o.querySelectorAll(".view-line"),r=-1;for(let p=0;p<n.length;p++)if(n[p]===t){r=p;break}if(r===-1||r>=this._renderOutputs.length)return;let s=1,l=r;for(let p=0;p<this.viewLineCounts.length;p++){if(l<this.viewLineCounts[p]){s=p+1;break}l-=this.viewLineCounts[p]}if(s>this._source.lineTokens.length)return;let c=this._renderOutputs[r];if(!c)return;let u=K$(c.characterMapping,i,e)+c.offset;return new Ie(s,u)}},ISt=class extends Hse{constructor(e,t,o){super(e,t);this.offset=o}};function r4i(a,i,e,t,o,n,r,s,l){s.appendString('<div class="view-line'),!l&&!t&&s.appendString(" char-delete"),s.appendString('" style="top:'),s.appendString(String(a*r.lineHeight)),r.setWidth?s.appendString('px;width:1000000px;">'):s.appendString('px;">');let c=i.getLineContent(),u=KU.isBasicASCII(c,o),p=KU.containsRTL(c,u,n),h=uW(new hL(r.fontInfo.isMonospace&&!r.disableMonospaceOptimizations,r.fontInfo.canUseHalfwidthRightwardsArrow,c,!1,u,p,0,i,e,r.tabSize,0,r.fontInfo.spaceWidth,r.fontInfo.middotWidth,r.fontInfo.wsmiddotWidth,r.stopRenderingLineAfter,r.renderWhitespace,r.renderControlCharacters,r.fontLigatures!==mx.OFF,null,null,r.verticalScrollbarSize),s);s.appendString("</div>");let g=h.characterMapping.getHorizontalOffset(h.characterMapping.length);return{output:h,maxCharWidth:g}}var Wi=ae("clipboardService");var _n=ae("contextViewService"),ze=ae("contextMenuService");var Kye=class extends C{constructor(e,t,o,n,r,s,l,c,u,p){super();this._targetWindow=e;this._editors=t;this._diffModel=o;this._options=n;this._diffEditorWidget=r;this._canIgnoreViewZoneUpdateEvent=s;this._origViewZonesToIgnore=l;this._modViewZonesToIgnore=c;this._clipboardService=u;this._contextMenuService=p;this._originalTopPadding=Le(this,0),this._originalScrollOffset=Le(this,0),this._originalScrollOffsetAnimated=Vti(this._targetWindow,this._originalScrollOffset,this._store),this._modifiedTopPadding=Le(this,0),this._modifiedScrollOffset=Le(this,0),this._modifiedScrollOffsetAnimated=Vti(this._targetWindow,this._modifiedScrollOffset,this._store);let h=Le("invalidateAlignmentsState",0),g=this._register(new Dt(()=>{h.set(h.get()+1,void 0)},0));this._register(this._editors.original.onDidChangeViewZones(k=>{this._canIgnoreViewZoneUpdateEvent()||g.schedule()})),this._register(this._editors.modified.onDidChangeViewZones(k=>{this._canIgnoreViewZoneUpdateEvent()||g.schedule()})),this._register(this._editors.original.onDidChangeConfiguration(k=>{(k.hasChanged(166)||k.hasChanged(75))&&g.schedule()})),this._register(this._editors.modified.onDidChangeConfiguration(k=>{(k.hasChanged(166)||k.hasChanged(75))&&g.schedule()}));let f=this._diffModel.map(k=>k?ui(this,k.model.original.onDidChangeTokens,()=>k.model.original.tokenization.backgroundTokenizationState===2):void 0).map((k,T)=>k?.read(T)),v=Ce(k=>{let T=this._diffModel.read(k),N=T?.diff.read(k);if(!T||!N)return null;h.read(k);let V=this._options.renderSideBySide.read(k);return s4i(this._editors.original,this._editors.modified,N.mappings,this._origViewZonesToIgnore,this._modViewZonesToIgnore,V)}),b=Ce(k=>{let T=this._diffModel.read(k)?.movedTextToCompare.read(k);if(!T)return null;h.read(k);let N=T.changes.map(O=>new Dje(O));return s4i(this._editors.original,this._editors.modified,N,this._origViewZonesToIgnore,this._modViewZonesToIgnore,!0)});function S(){let k=document.createElement("div");return k.className="diagonal-fill",k}let y=this._register(new P);this.viewZones=Ce(this,k=>{y.clear();let T=v.read(k)||[],N=[],O=[],V=this._modifiedTopPadding.read(k);V>0&&O.push({afterLineNumber:0,domNode:document.createElement("div"),heightInPx:V,showInHiddenAreas:!0,suppressMouseDown:!0});let U=this._originalTopPadding.read(k);U>0&&N.push({afterLineNumber:0,domNode:document.createElement("div"),heightInPx:U,showInHiddenAreas:!0,suppressMouseDown:!0});let G=this._options.renderSideBySide.read(k),$=G?void 0:this._editors.modified._getViewModel()?.createLineBreaksComputer();if($){let He=this._editors.original.getModel();for(let Ve of T)if(Ve.diff)for(let Fe=Ve.originalRange.startLineNumber;Fe<Ve.originalRange.endLineNumberExclusive;Fe++){if(Fe>He.getLineCount())return{orig:N,mod:O};$?.addRequest(He.getLineContent(Fe),null,null)}}let te=$?.finalize()??[],pe=0,de=this._editors.modified.getOption(75),se=this._diffModel.read(k)?.movedTextToCompare.read(k),Se=this._editors.original.getModel()?.mightContainNonBasicASCII()??!1,ke=this._editors.original.getModel()?.mightContainRTL()??!1,Ee=uE.fromEditor(this._editors.modified);for(let He of T)if(He.diff&&!G&&(!this._options.useTrueInlineDiffRendering.read(k)||!Rje(He.diff))){if(!He.originalRange.isEmpty){f.read(k);let Fe=document.createElement("div");Fe.classList.add("view-lines","line-delete","line-delete-selectable","monaco-mouse-cursor-text");let Qt=this._editors.original.getModel();if(He.originalRange.endLineNumberExclusive-1>Qt.getLineCount())return{orig:N,mod:O};let Ze=new dE(He.originalRange.mapToLineArray(_o=>Qt.tokenization.getLineTokens(_o)),He.originalRange.mapToLineArray(_o=>te[pe++]),Se,ke),Ti=[];for(let _o of He.diff.innerChanges||[])Ti.push(new Zk(_o.originalRange.delta(-(He.diff.original.startLineNumber-1)),Cq.className,0));let ti=EL(Ze,Ee,Ti,Fe),bo=document.createElement("div");if(bo.className="inline-deleted-margin-view-zone",Pd(bo,Ee.fontInfo),this._options.renderIndicators.read(k))for(let _o=0;_o<ti.heightInLines;_o++){let sr=document.createElement("div");sr.className=`delete-sign ${q.asClassName(jti)}`,sr.setAttribute("style",`position:absolute;top:${_o*de}px;width:${Ee.lineDecorationsWidth}px;height:${de}px;right:0;`),bo.appendChild(sr)}let Ro;y.add(new SSt(()=>Oi(Ro),bo,Fe,this._editors.modified,He.diff,this._diffEditorWidget,ti,this._editors.original.getModel(),this._contextMenuService,this._clipboardService));for(let _o=0;_o<ti.viewLineCounts.length;_o++){let sr=ti.viewLineCounts[_o];sr>1&&N.push({afterLineNumber:He.originalRange.startLineNumber+_o,domNode:S(),heightInPx:(sr-1)*de,showInHiddenAreas:!0,suppressMouseDown:!0})}O.push({afterLineNumber:He.modifiedRange.startLineNumber-1,domNode:Fe,heightInPx:ti.heightInLines*de,minWidthInPx:ti.minWidthInPx,marginDomNode:bo,setZoneId(_o){Ro=_o},showInHiddenAreas:!0,suppressMouseDown:!1})}let Ve=document.createElement("div");Ve.className="gutter-delete",N.push({afterLineNumber:He.originalRange.endLineNumberExclusive-1,domNode:S(),heightInPx:He.modifiedHeightInPx,marginDomNode:Ve,showInHiddenAreas:!0,suppressMouseDown:!0})}else{let Ve=He.modifiedHeightInPx-He.originalHeightInPx;if(Ve>0){if(se?.lineRangeMapping.original.delta(-1).deltaLength(2).contains(He.originalRange.endLineNumberExclusive-1))continue;N.push({afterLineNumber:He.originalRange.endLineNumberExclusive-1,domNode:S(),heightInPx:Ve,showInHiddenAreas:!0,suppressMouseDown:!0})}else{let Fe=function(){let Ze=document.createElement("div");return Ze.className="arrow-revert-change "+q.asClassName(M.arrowRight),k.store.add(j(Ze,"mousedown",Ti=>Ti.stopPropagation())),k.store.add(j(Ze,"click",Ti=>{Ti.stopPropagation(),r.revert(He.diff)})),_("div",{},Ze)};if(se?.lineRangeMapping.modified.delta(-1).deltaLength(2).contains(He.modifiedRange.endLineNumberExclusive-1))continue;let Qt;He.diff&&He.diff.modified.isEmpty&&this._options.shouldRenderOldRevertArrows.read(k)&&(Qt=Fe()),O.push({afterLineNumber:He.modifiedRange.endLineNumberExclusive-1,domNode:S(),heightInPx:-Ve,marginDomNode:Qt,showInHiddenAreas:!0,suppressMouseDown:!0})}}for(let He of b.read(k)??[]){if(!se?.lineRangeMapping.original.intersect(He.originalRange)||!se?.lineRangeMapping.modified.intersect(He.modifiedRange))continue;let Ve=He.modifiedHeightInPx-He.originalHeightInPx;Ve>0?N.push({afterLineNumber:He.originalRange.endLineNumberExclusive-1,domNode:S(),heightInPx:Ve,showInHiddenAreas:!0,suppressMouseDown:!0}):O.push({afterLineNumber:He.modifiedRange.endLineNumberExclusive-1,domNode:S(),heightInPx:-Ve,showInHiddenAreas:!0,suppressMouseDown:!0})}return{orig:N,mod:O}});let w=!1;this._register(this._editors.original.onDidScrollChange(k=>{k.scrollLeftChanged&&!w&&(w=!0,this._editors.modified.setScrollLeft(k.scrollLeft),w=!1)})),this._register(this._editors.modified.onDidScrollChange(k=>{k.scrollLeftChanged&&!w&&(w=!0,this._editors.original.setScrollLeft(k.scrollLeft),w=!1)})),this._originalScrollTop=ui(this._editors.original.onDidScrollChange,()=>this._editors.original.getScrollTop()),this._modifiedScrollTop=ui(this._editors.modified.onDidScrollChange,()=>this._editors.modified.getScrollTop()),this._register(he(k=>{let T=this._originalScrollTop.read(k)-(this._originalScrollOffsetAnimated.read(void 0)-this._modifiedScrollOffsetAnimated.read(k))-(this._originalTopPadding.read(void 0)-this._modifiedTopPadding.read(k));T!==this._editors.modified.getScrollTop()&&this._editors.modified.setScrollTop(T,1)})),this._register(he(k=>{let T=this._modifiedScrollTop.read(k)-(this._modifiedScrollOffsetAnimated.read(void 0)-this._originalScrollOffsetAnimated.read(k))-(this._modifiedTopPadding.read(void 0)-this._originalTopPadding.read(k));T!==this._editors.original.getScrollTop()&&this._editors.original.setScrollTop(T,1)})),this._register(he(k=>{let T=this._diffModel.read(k)?.movedTextToCompare.read(k),N=0;if(T){let O=this._editors.original.getTopForLineNumber(T.lineRangeMapping.original.startLineNumber,!0)-this._originalTopPadding.read(void 0);N=this._editors.modified.getTopForLineNumber(T.lineRangeMapping.modified.startLineNumber,!0)-this._modifiedTopPadding.read(void 0)-O}N>0?(this._modifiedTopPadding.set(0,void 0),this._originalTopPadding.set(N,void 0)):N<0?(this._modifiedTopPadding.set(-N,void 0),this._originalTopPadding.set(0,void 0)):setTimeout(()=>{this._modifiedTopPadding.set(0,void 0),this._originalTopPadding.set(0,void 0)},400),this._editors.modified.hasTextFocus()?this._originalScrollOffset.set(this._modifiedScrollOffset.read(void 0)-N,void 0,!0):this._modifiedScrollOffset.set(this._originalScrollOffset.read(void 0)+N,void 0,!0)}))}};Kye=I([m(8,Wi),m(9,ze)],Kye);function s4i(a,i,e,t,o,n){let r=new bS(a4i(a,t)),s=new bS(a4i(i,o)),l=a.getOption(75),c=i.getOption(75),u=[],p=0,h=0;function g(f,v){for(;;){let b=r.peek(),S=s.peek();if(b&&b.lineNumber>=f&&(b=void 0),S&&S.lineNumber>=v&&(S=void 0),!b&&!S)break;let y=b?b.lineNumber-p:Number.MAX_VALUE,w=S?S.lineNumber-h:Number.MAX_VALUE;y<w?(r.dequeue(),S={lineNumber:b.lineNumber-p+h,heightInPx:0}):y>w?(s.dequeue(),b={lineNumber:S.lineNumber-h+p,heightInPx:0}):(r.dequeue(),s.dequeue()),u.push({originalRange:ro.ofLength(b.lineNumber,1),modifiedRange:ro.ofLength(S.lineNumber,1),originalHeightInPx:l+b.heightInPx,modifiedHeightInPx:c+S.heightInPx,diff:void 0})}}for(let f of e){let w=function(k,T,N=!1){if(k<y||T<S)return;if(b)b=!1;else if(!N&&(k===y||T===S))return;let O=new ro(y,k),V=new ro(S,T);if(O.isEmpty&&V.isEmpty)return;let U=r.takeWhile($=>$.lineNumber<k)?.reduce(($,te)=>$+te.heightInPx,0)??0,G=s.takeWhile($=>$.lineNumber<T)?.reduce(($,te)=>$+te.heightInPx,0)??0;u.push({originalRange:O,modifiedRange:V,originalHeightInPx:O.length*l+U,modifiedHeightInPx:V.length*c+G,diff:f.lineRangeMapping}),y=k,S=T},v=f.lineRangeMapping;g(v.original.startLineNumber,v.modified.startLineNumber);let b=!0,S=v.modified.startLineNumber,y=v.original.startLineNumber;if(n)for(let k of v.innerChanges||[]){k.originalRange.startColumn>1&&k.modifiedRange.startColumn>1&&w(k.originalRange.startLineNumber,k.modifiedRange.startLineNumber);let T=a.getModel(),N=k.originalRange.endLineNumber<=T.getLineCount()?T.getLineMaxColumn(k.originalRange.endLineNumber):Number.MAX_SAFE_INTEGER;k.originalRange.endColumn<N&&w(k.originalRange.endLineNumber,k.modifiedRange.endLineNumber)}w(v.original.endLineNumberExclusive,v.modified.endLineNumberExclusive,!0),p=v.original.endLineNumberExclusive,h=v.modified.endLineNumberExclusive}return g(Number.MAX_VALUE,Number.MAX_VALUE),u}function a4i(a,i){let e=[],t=[],o=a.getOption(166).wrappingColumn!==-1,n=a._getViewModel().coordinatesConverter,r=a.getOption(75);if(o)for(let l=1;l<=a.getModel().getLineCount();l++){let c=n.getModelLineViewLineCount(l);c>1&&t.push({lineNumber:l,heightInPx:r*(c-1)})}for(let l of a.getWhitespaces()){if(i.has(l.id))continue;let c=l.afterLineNumber===0?0:n.convertViewPositionToModelPosition(new Ie(l.afterLineNumber,1)).lineNumber;e.push({lineNumber:c,heightInPx:l.height})}return $5i(e,t,l=>l.lineNumber,(l,c)=>({lineNumber:l.lineNumber,heightInPx:l.heightInPx+c.heightInPx}))}function Rje(a){return a.innerChanges?a.innerChanges.every(i=>Lje(i.modifiedRange)&&Lje(i.originalRange)||i.originalRange.equalsRange(new z(1,1,1,1))):!1}function Lje(a){return a.startLineNumber===a.endLineNumber}var J9=class a extends C{constructor(e,t,o,n,r){super();this._rootElement=e;this._diffModel=t;this._originalEditorLayoutInfo=o;this._modifiedEditorLayoutInfo=n;this._editors=r;this._originalScrollTop=ui(this,this._editors.original.onDidScrollChange,()=>this._editors.original.getScrollTop()),this._modifiedScrollTop=ui(this,this._editors.modified.onDidScrollChange,()=>this._editors.modified.getScrollTop()),this._viewZonesChanged=Nr("onDidChangeViewZones",this._editors.modified.onDidChangeViewZones),this.width=Le(this,0),this._modifiedViewZonesChangedSignal=Nr("modified.onDidChangeViewZones",this._editors.modified.onDidChangeViewZones),this._originalViewZonesChangedSignal=Nr("original.onDidChangeViewZones",this._editors.original.onDidChangeViewZones),this._state=Ce(this,p=>{this._element.replaceChildren();let h=this._diffModel.read(p),g=h?.diff.read(p)?.movedTexts;if(!g||g.length===0){this.width.set(0,void 0);return}this._viewZonesChanged.read(p);let f=this._originalEditorLayoutInfo.read(p),v=this._modifiedEditorLayoutInfo.read(p);if(!f||!v){this.width.set(0,void 0);return}this._modifiedViewZonesChangedSignal.read(p),this._originalViewZonesChangedSignal.read(p);let b=g.map(O=>{function V(ke,Ee){let He=Ee.getTopForLineNumber(ke.startLineNumber,!0),Ve=Ee.getTopForLineNumber(ke.endLineNumberExclusive,!0);return(He+Ve)/2}let U=V(O.lineRangeMapping.original,this._editors.original),G=this._originalScrollTop.read(p),$=V(O.lineRangeMapping.modified,this._editors.modified),te=this._modifiedScrollTop.read(p),pe=U-G,de=$-te,se=Math.min(U,$),Se=Math.max(U,$);return{range:new di(se,Se),from:pe,to:de,fromWithoutScroll:U,toWithoutScroll:$,move:O}});b.sort(Wut(tl(O=>O.fromWithoutScroll>O.toWithoutScroll,Vut),tl(O=>O.fromWithoutScroll>O.toWithoutScroll?O.fromWithoutScroll:-O.toWithoutScroll,qd)));let S=tii.compute(b.map(O=>O.range)),y=10,w=f.verticalScrollbarWidth,k=(S.getTrackCount()-1)*10+y*2,T=w+k+(v.contentLeft-a.movedCodeBlockPadding),N=0;for(let O of b){let V=S.getTrack(N),U=w+y+V*10,G=15,$=15,te=T,pe=v.glyphMarginWidth+v.lineNumbersWidth,de=18,se=document.createElementNS("http://www.w3.org/2000/svg","rect");se.classList.add("arrow-rectangle"),se.setAttribute("x",`${te-pe}`),se.setAttribute("y",`${O.to-de/2}`),se.setAttribute("width",`${pe}`),se.setAttribute("height",`${de}`),this._element.appendChild(se);let Se=document.createElementNS("http://www.w3.org/2000/svg","g"),ke=document.createElementNS("http://www.w3.org/2000/svg","path");ke.setAttribute("d",`M 0 ${O.from} L ${U} ${O.from} L ${U} ${O.to} L ${te-$} ${O.to}`),ke.setAttribute("fill","none"),Se.appendChild(ke);let Ee=document.createElementNS("http://www.w3.org/2000/svg","polygon");Ee.classList.add("arrow"),p.store.add(he(He=>{ke.classList.toggle("currentMove",O.move===h.activeMovedText.read(He)),Ee.classList.toggle("currentMove",O.move===h.activeMovedText.read(He))})),Ee.setAttribute("points",`${te-$},${O.to-G/2} ${te},${O.to} ${te-$},${O.to+G/2}`),Se.appendChild(Ee),this._element.appendChild(Se),N++}this.width.set(k,void 0)}),this._element=document.createElementNS("http://www.w3.org/2000/svg","svg"),this._element.setAttribute("class","moved-blocks-lines"),this._rootElement.appendChild(this._element),this._register(Z(()=>this._element.remove())),this._register(he(p=>{let h=this._originalEditorLayoutInfo.read(p),g=this._modifiedEditorLayoutInfo.read(p);!h||!g||(this._element.style.left=`${h.width-h.verticalScrollbarWidth}px`,this._element.style.height=`${h.height}px`,this._element.style.width=`${h.verticalScrollbarWidth+h.contentLeft-a.movedCodeBlockPadding+this.width.read(p)}px`)})),this._register(EM(this._state));let s=Ce(p=>{let g=this._diffModel.read(p)?.diff.read(p);return g?g.movedTexts.map(f=>({move:f,original:new g1(Oo(f.lineRangeMapping.original.startLineNumber-1),18),modified:new g1(Oo(f.lineRangeMapping.modified.startLineNumber-1),18)})):[]});this._register(Vye(this._editors.original,s.map(p=>p.map(h=>h.original)))),this._register(Vye(this._editors.modified,s.map(p=>p.map(h=>h.modified)))),this._register(Ga((p,h)=>{let g=s.read(p);for(let f of g)h.add(new ySt(this._editors.original,f.original,f.move,"original",this._diffModel.get())),h.add(new ySt(this._editors.modified,f.modified,f.move,"modified",this._diffModel.get()))}));let l=Nr("original.onDidFocusEditorWidget",p=>this._editors.original.onDidFocusEditorWidget(()=>setTimeout(()=>p(void 0),0))),c=Nr("modified.onDidFocusEditorWidget",p=>this._editors.modified.onDidFocusEditorWidget(()=>setTimeout(()=>p(void 0),0))),u="modified";this._register(xM({changeTracker:{createChangeSummary:()=>{},handleChange:(p,h)=>(p.didChange(l)&&(u="original"),p.didChange(c)&&(u="modified"),!0)}},p=>{l.read(p),c.read(p);let h=this._diffModel.read(p);if(!h)return;let g=h.diff.read(p),f;if(g&&u==="original"){let v=this._editors.originalCursor.read(p);v&&(f=g.movedTexts.find(b=>b.lineRangeMapping.original.contains(v.lineNumber)))}if(g&&u==="modified"){let v=this._editors.modifiedCursor.read(p);v&&(f=g.movedTexts.find(b=>b.lineRangeMapping.modified.contains(v.lineNumber)))}f!==h.movedTextToCompare.read(void 0)&&h.movedTextToCompare.set(void 0,void 0),h.setActiveMovedText(f)}))}static{this.movedCodeBlockPadding=4}},tii=class a{constructor(i,e){this._trackCount=i;this.trackPerLineIdx=e}static compute(i){let e=[],t=[];for(let o of i){let n=e.findIndex(r=>!r.intersectsStrict(o));n===-1&&(e.length>=6?n=nUi(e,tl(s=>s.intersectWithRangeLength(o),qd)):(n=e.length,e.push(new Zmt))),e[n].addRange(o),t.push(n)}return new a(e.length,t)}getTrack(i){return this.trackPerLineIdx[i]}getTrackCount(){return this._trackCount}},ySt=class extends xae{constructor(e,t,o,n,r){let s=bt("div.diff-hidden-lines-widget");super(e,t,s.root);this._editor=e;this._move=o;this._kind=n;this._diffModel=r;this._nodes=bt("div.diff-moved-code-block",{style:{marginRight:"4px"}},[bt("div.text-content@textContent"),bt("div.action-bar@actionBar")]);s.root.appendChild(this._nodes.root);let l=ui(this._editor.onDidLayoutChange,()=>this._editor.getLayoutInfo());this._register(UM(this._nodes.root,{paddingRight:l.map(g=>g.verticalScrollbarWidth)}));let c;o.changes.length>0?c=this._kind==="original"?d(244,null,this._move.lineRangeMapping.modified.startLineNumber,this._move.lineRangeMapping.modified.endLineNumberExclusive-1):d(242,null,this._move.lineRangeMapping.original.startLineNumber,this._move.lineRangeMapping.original.endLineNumberExclusive-1):c=this._kind==="original"?d(243,null,this._move.lineRangeMapping.modified.startLineNumber,this._move.lineRangeMapping.modified.endLineNumberExclusive-1):d(241,null,this._move.lineRangeMapping.original.startLineNumber,this._move.lineRangeMapping.original.endLineNumberExclusive-1);let u=this._register(new ji(this._nodes.actionBar,{highlightToggledItems:!0})),p=new st("",c,"",!1);u.push(p,{icon:!1,label:!0});let h=new st("","Compare",q.asClassName(M.compareChanges),!0,()=>{this._editor.focus(),this._diffModel.movedTextToCompare.set(this._diffModel.movedTextToCompare.get()===o?void 0:this._move,void 0)});this._register(he(g=>{let f=this._diffModel.movedTextToCompare.read(g)===o;h.checked=f})),u.push(h,{icon:!1,label:!0})}};var wSt=class extends C{constructor(e,t,o,n){super();this._editors=e;this._diffModel=t;this._options=o;this._decorations=Ce(this,e=>{let t=this._diffModel.read(e),o=t?.diff.read(e);if(!o)return null;let n=this._diffModel.read(e).movedTextToCompare.read(e),r=this._options.renderIndicators.read(e),s=this._options.showEmptyDecorations.read(e),l=[],c=[];if(!n)for(let p of o.mappings)if(p.lineRangeMapping.original.isEmpty||l.push({range:p.lineRangeMapping.original.toInclusiveRange(),options:r?Yti:Jti}),p.lineRangeMapping.modified.isEmpty||c.push({range:p.lineRangeMapping.modified.toInclusiveRange(),options:r?Qti:Xti}),p.lineRangeMapping.modified.isEmpty||p.lineRangeMapping.original.isEmpty)p.lineRangeMapping.original.isEmpty||l.push({range:p.lineRangeMapping.original.toInclusiveRange(),options:t4i}),p.lineRangeMapping.modified.isEmpty||c.push({range:p.lineRangeMapping.modified.toInclusiveRange(),options:zye});else{let h=this._options.useTrueInlineDiffRendering.read(e)&&Rje(p.lineRangeMapping);for(let g of p.lineRangeMapping.innerChanges||[])if(p.lineRangeMapping.original.contains(g.originalRange.startLineNumber)&&l.push({range:g.originalRange,options:g.originalRange.isEmpty()&&s?i4i:Cq}),p.lineRangeMapping.modified.contains(g.modifiedRange.startLineNumber)&&c.push({range:g.modifiedRange,options:g.modifiedRange.isEmpty()&&s&&!h?e4i:Eae}),h){let f=t.model.original.getValueInRange(g.originalRange);c.push({range:g.modifiedRange,options:{description:"deleted-text",before:{content:f,inlineClassName:"inline-deleted-text"},zIndex:1e5,showIfCollapsed:!0}})}}if(n)for(let p of n.changes){let h=p.original.toInclusiveRange();h&&l.push({range:h,options:r?Yti:Jti});let g=p.modified.toInclusiveRange();g&&c.push({range:g,options:r?Qti:Xti});for(let f of p.innerChanges||[])l.push({range:f.originalRange,options:Cq}),c.push({range:f.modifiedRange,options:Eae})}let u=this._diffModel.read(e).activeMovedText.read(e);for(let p of o.movedTexts)l.push({range:p.lineRangeMapping.original.toInclusiveRange(),options:{description:"moved",blockClassName:"movedOriginal"+(p===u?" currentMove":""),blockPadding:[J9.movedCodeBlockPadding,0,J9.movedCodeBlockPadding,J9.movedCodeBlockPadding]}}),c.push({range:p.lineRangeMapping.modified.toInclusiveRange(),options:{description:"moved",blockClassName:"movedModified"+(p===u?" currentMove":""),blockPadding:[4,0,4,4]}});return{originalDecorations:l,modifiedDecorations:c}});this._register(Wye(this._editors.original,this._decorations.map(r=>r?.originalDecorations||[]))),this._register(Wye(this._editors.modified,this._decorations.map(r=>r?.modifiedDecorations||[])))}};var Uh=class a{constructor(i,e){this.x=i;this.y=e}static equals(i,e){return i.x===e.x&&i.y===e.y}add(i){return new a(this.x+i.x,this.y+i.y)}deltaX(i){return new a(this.x+i,this.y)}deltaY(i){return new a(this.x,this.y+i)}toString(){return`(${this.x},${this.y})`}subtract(i){return new a(this.x-i.x,this.y-i.y)}scale(i){return new a(this.x*i,this.y*i)}mapComponents(i){return new a(i(this.x),i(this.y))}isZero(){return this.x===0&&this.y===0}withThreshold(i){return this.mapComponents(e=>e>i?e-i:e<-i?e+i:0)}};function os(a){return iii.get(a)}var iii=class a extends C{constructor(e){super();this.editor=e;this._sawZeroLineWidth=!1;this._onDidContainerResize=ff({owner:this,getTransaction:()=>this._currentTransaction},e=>{let t=this.editor.getContainerDomNode(),o=new ResizeObserver(()=>{this._sawZeroLineWidth&&(this._sawZeroLineWidth=!1,this.editor.resetLineWidthCaches()),e(void 0)});return o.observe(t),{dispose:()=>o.disconnect()}},()=>({}));this._updateCounter=0,this._currentTransaction=void 0,this._model=Le(this,this.editor.getModel()),this.model=this._model,this.isReadonly=ff({owner:this,getTransaction:()=>this._currentTransaction},this.editor.onDidChangeConfiguration,()=>this.editor.getOption(104)),this._versionId=rg({owner:this,lazy:!0},this.editor.getModel()?.getVersionId()??null),this.versionId=this._versionId,this._selections=rg({owner:this,equalsFn:aU(lN(Yt.selectionsEqual)),lazy:!0},this.editor.getSelections()??null),this.selections=this._selections,this.positions=hs({owner:this,equalsFn:aU(lN(Ie.equals))},t=>this.selections.read(t)?.map(o=>o.getStartPosition())??null),this.isFocused=ff({owner:this,getTransaction:()=>this._currentTransaction},t=>{let o=this.editor.onDidFocusEditorWidget(t),n=this.editor.onDidBlurEditorWidget(t);return{dispose(){o.dispose(),n.dispose()}}},()=>this.editor.hasWidgetFocus()),this.isTextFocused=ff({owner:this,getTransaction:()=>this._currentTransaction},t=>{let o=this.editor.onDidFocusEditorText(t),n=this.editor.onDidBlurEditorText(t);return{dispose(){o.dispose(),n.dispose()}}},()=>this.editor.hasTextFocus()),this.inComposition=ff({owner:this,getTransaction:()=>this._currentTransaction},t=>{let o=this.editor.onDidCompositionStart(()=>{t(void 0)}),n=this.editor.onDidCompositionEnd(()=>{t(void 0)});return{dispose(){o.dispose(),n.dispose()}}},()=>this.editor.inComposition),this.value=y$(this,t=>(this.versionId.read(t),this.model.read(t)?.getValue()??""),(t,o)=>{let n=this.model.get();n!==null&&t!==n.getValue()&&n.setValue(t)}),this.valueIsEmpty=Ce(this,t=>(this.versionId.read(t),this.editor.getModel()?.getValueLength()===0)),this.cursorSelection=hs({owner:this,equalsFn:aU(Yt.selectionsEqual)},t=>this.selections.read(t)?.[0]??null),this.cursorPosition=hs({owner:this,equalsFn:Ie.equals},t=>this.selections.read(t)?.[0]?.getPosition()??null),this.cursorLineNumber=Ce(this,t=>this.cursorPosition.read(t)?.lineNumber??null),this.onDidType=Wc(this),this.onDidPaste=Wc(this),this.scrollTop=ff({owner:this,getTransaction:()=>this._currentTransaction},this.editor.onDidScrollChange,()=>this.editor.getScrollTop()),this.scrollLeft=ff({owner:this,getTransaction:()=>this._currentTransaction},this.editor.onDidScrollChange,()=>this.editor.getScrollLeft()),this.layoutInfo=ff({owner:this,getTransaction:()=>this._currentTransaction},this.editor.onDidLayoutChange,()=>this.editor.getLayoutInfo()),this.layoutInfoContentLeft=this.layoutInfo.map(t=>t.contentLeft),this.layoutInfoDecorationsLeft=this.layoutInfo.map(t=>t.decorationsLeft),this.layoutInfoWidth=this.layoutInfo.map(t=>t.width),this.layoutInfoHeight=this.layoutInfo.map(t=>t.height),this.layoutInfoMinimap=this.layoutInfo.map(t=>t.minimap),this.layoutInfoVerticalScrollbarWidth=this.layoutInfo.map(t=>t.verticalScrollbarWidth),this.contentWidth=ff({owner:this,getTransaction:()=>this._currentTransaction},this.editor.onDidContentSizeChange,()=>this.editor.getContentWidth()),this.contentHeight=ff({owner:this,getTransaction:()=>this._currentTransaction},this.editor.onDidContentSizeChange,()=>this.editor.getContentHeight()),this._onDidChangeViewZones=Nr(this,this.editor.onDidChangeViewZones),this._onDidHiddenAreasChanged=Nr(this,this.editor.onDidChangeHiddenAreas),this._onDidLineHeightChanged=Nr(this,this.editor.onDidChangeLineHeight),this._widgetCounter=0,this.openedPeekWidgets=Le(this,0),this._register(this.editor.onBeginUpdate(()=>this._beginUpdate())),this._register(this.editor.onEndUpdate(()=>this._endUpdate())),this._register(this.editor.onDidChangeModel(()=>{this._beginUpdate();try{this._model.set(this.editor.getModel(),this._currentTransaction),this._forceUpdate()}finally{this._endUpdate()}})),this._register(this.editor.onDidType(t=>{this._beginUpdate();try{this._forceUpdate(),this.onDidType.trigger(this._currentTransaction,t)}finally{this._endUpdate()}})),this._register(this.editor.onDidPaste(t=>{this._beginUpdate();try{this._forceUpdate(),this.onDidPaste.trigger(this._currentTransaction,t)}finally{this._endUpdate()}})),this._register(this.editor.onDidChangeModelContent(t=>{this._beginUpdate();try{this._versionId.set(this.editor.getModel()?.getVersionId()??null,this._currentTransaction,t),this._forceUpdate()}finally{this._endUpdate()}})),this._register(this.editor.onDidChangeCursorSelection(t=>{this._beginUpdate();try{this._selections.set(this.editor.getSelections(),this._currentTransaction,t),this._forceUpdate()}finally{this._endUpdate()}})),this.domNode=Ce(t=>(this.model.read(t),this.editor.getDomNode()))}static{this._map=new Map}static get(e){let t=a._map.get(e);if(!t){t=new a(e),a._map.set(e,t);let o=e.onDidDispose(()=>{let n=a._map.get(e);n&&(a._map.delete(e),n.dispose(),o.dispose())})}return t}_beginUpdate(){this._updateCounter++,this._updateCounter===1&&(this._currentTransaction=new cN(()=>{}))}_endUpdate(){if(this._updateCounter--,this._updateCounter===0){let e=this._currentTransaction;this._currentTransaction=void 0,e.finish()}}transaction(e){this._beginUpdate();try{return e(this._currentTransaction)}finally{this._endUpdate()}}forceUpdate(e){this._beginUpdate();try{return this._forceUpdate(),e?e(this._currentTransaction):void 0}finally{this._endUpdate()}}_forceUpdate(){this._beginUpdate();try{this._model.set(this.editor.getModel(),this._currentTransaction),this._versionId.set(this.editor.getModel()?.getVersionId()??null,this._currentTransaction,void 0),this._selections.set(this.editor.getSelections(),this._currentTransaction,void 0)}finally{this._endUpdate()}}getOption(e,t=Il.ofCaller()){return ui(this,o=>this.editor.onDidChangeConfiguration(n=>{n.hasChanged(e)&&o(void 0)}),()=>this.editor.getOption(e),t)}setDecorations(e){let t=new P,o=this.editor.createDecorationsCollection();return t.add(XD({owner:this,debugName:()=>`Apply decorations from ${e.debugName}`},n=>{let r=e.read(n);o.set(r)})),t.add({dispose:()=>{o.clear()}}),t}createOverlayWidget(e){let t="observableOverlayWidget"+this._widgetCounter++,o={getDomNode:()=>e.domNode,getPosition:()=>e.position.get(),getId:()=>t,allowEditorOverflow:e.allowEditorOverflow,getMinContentWidthInPx:()=>e.minContentWidthInPx.get()};this.editor.addOverlayWidget(o);let n=he(r=>{e.position.read(r),e.minContentWidthInPx.read(r),this.editor.layoutOverlayWidget(o)});return Z(()=>{n.dispose(),this.editor.removeOverlayWidget(o)})}createContentWidget(e){let t="observableContentWidget"+this._widgetCounter++,o={getDomNode:()=>e.domNode,getPosition:()=>e.position.get(),getId:()=>t,allowEditorOverflow:e.allowEditorOverflow};this.editor.addContentWidget(o);let n=he(r=>{e.position.read(r),this.editor.layoutContentWidget(o)});return Z(()=>{n.dispose(),this.editor.removeContentWidget(o)})}observeLineOffsetRange(e,t){let o=this.observePosition(e.map(r=>new Ie(r.startLineNumber,1)),t),n=this.observePosition(e.map(r=>new Ie(r.endLineNumberExclusive+1,1)),t);return Ce(r=>{o.read(r),n.read(r);let s=e.read(r),l=this.model.read(r)?.getLineCount(),c=(typeof l<"u"&&s.startLineNumber>l?this.editor.getBottomForLineNumber(l):this.editor.getTopForLineNumber(s.startLineNumber))-this.scrollTop.read(r),u=s.isEmpty?c:this.editor.getBottomForLineNumber(s.endLineNumberExclusive-1)-this.scrollTop.read(r);return new di(c,u)})}getLeftOfPosition(e,t){this.layoutInfo.read(t),this.value.read(t);let o=this.editor.getOffsetForColumn(e.lineNumber,e.column);if(o===-1){let n=this.editor.getOption(59).typicalHalfwidthCharacterWidth;o=e.column*n}return o}observePosition(e,t){let o=e.get(),n=rg({owner:this,debugName:()=>`topLeftOfPosition${o?.toString()}`,equalsFn:aU(Uh.equals)},new Uh(0,0)),r="observablePositionWidget"+this._widgetCounter++,s=document.createElement("div"),l={getDomNode:()=>s,getPosition:()=>o?{preference:[0],position:e.get()}:null,getId:()=>r,allowEditorOverflow:!1,useDisplayNone:!0,afterRender:(c,u)=>{let p=this._model.get();p&&o&&o.lineNumber>p.getLineCount()?n.set(new Uh(0,this.editor.getBottomForLineNumber(p.getLineCount())-this.scrollTop.get()),void 0):n.set(u?new Uh(u.left,u.top):null,void 0)}};return this.editor.addContentWidget(l),t.add(he(c=>{o=e.read(c),this.editor.layoutContentWidget(l)})),t.add(Z(()=>{this.editor.removeContentWidget(l)})),n}isTargetHovered(e,t){let o=Le("isInjectedTextHovered",!1);return t.add(this.editor.onMouseMove(n=>{let r=e(n);o.set(r,void 0)})),t.add(this.editor.onMouseLeave(n=>{o.set(!1,void 0)})),o}observeLineHeightForPosition(e){return Ce(t=>{let o=e instanceof Ie?e:e.read(t);return o===null?null:(this.getOption(75).read(t),this.editor.getLineHeightForPosition(o))})}observeLineHeightForLine(e){return typeof e=="number"?this.observeLineHeightForPosition(new Ie(e,1)):Ce(t=>{let o=e.read(t);return o===null?null:this.observeLineHeightForPosition(new Ie(o,1)).read(t)})}observeLineHeightsForLineRange(e){return Ce(t=>{let o=e instanceof ro?e:e.read(t),n=[];for(let r=o.startLineNumber;r<o.endLineNumberExclusive;r++)n.push(this.observeLineHeightForLine(r).read(t));return n})}getWidthOfLine(e,t){this.layoutInfo.read(t),this.value.read(t),this.scrollTop.read(t);let o=this.editor.getWidthOfLine(e);return this._onDidContainerResize.read(t),o===0&&(this._sawZeroLineWidth=!0),o}observeTopForLineNumber(e){return Ce(t=>(this.layoutInfo.read(t),this._onDidChangeViewZones.read(t),this._onDidHiddenAreasChanged.read(t),this._onDidLineHeightChanged.read(t),this._versionId.read(t),this.editor.getTopForLineNumber(e)))}observeBottomForLineNumber(e){return Ce(t=>(this.layoutInfo.read(t),this._onDidChangeViewZones.read(t),this._onDidHiddenAreasChanged.read(t),this._onDidLineHeightChanged.read(t),this._versionId.read(t),this.editor.getBottomForLineNumber(e)))}};var zI=class extends C{constructor(e,t,o,n,r,s,l){super();this._editors=e;this._rootElement=t;this._diffModel=o;this._rootWidth=n;this._rootHeight=r;this._modifiedEditorLayoutInfo=s;this._themeService=l;this.width=zI.ENTIRE_DIFF_OVERVIEW_WIDTH;let c=ui(this._themeService.onDidColorThemeChange,()=>this._themeService.getColorTheme()),u=Ce(g=>{let f=c.read(g),v=f.getColor(sgt)||(f.getColor(Hg)||$Se).transparent(2),b=f.getColor(agt)||(f.getColor(Cf)||qSe).transparent(2);return{insertColor:v,removeColor:b}}),p=or(document.createElement("div"));p.setClassName("diffViewport"),p.setPosition("absolute");let h=bt("div.diffOverview",{style:{position:"absolute",top:"0px",width:zI.ENTIRE_DIFF_OVERVIEW_WIDTH+"px"}}).root;this._register(wq(h,p.domNode)),this._register(Vo(h,re.POINTER_DOWN,g=>{this._editors.modified.delegateVerticalScrollbarPointerDown(g)})),this._register(j(h,re.MOUSE_WHEEL,g=>{this._editors.modified.delegateScrollFromMouseWheelEvent(g)},{passive:!1})),this._register(wq(this._rootElement,h)),this._register(Ga((g,f)=>{let v=this._diffModel.read(g),b=this._editors.original.createOverviewRuler("original diffOverviewRuler");b&&(f.add(b),f.add(wq(h,b.getDomNode())));let S=this._editors.modified.createOverviewRuler("modified diffOverviewRuler");if(S&&(f.add(S),f.add(wq(h,S.getDomNode()))),!b||!S)return;let y=Nr("viewZoneChanged",this._editors.original.onDidChangeViewZones),w=Nr("viewZoneChanged",this._editors.modified.onDidChangeViewZones),k=Nr("hiddenRangesChanged",this._editors.original.onDidChangeHiddenAreas),T=Nr("hiddenRangesChanged",this._editors.modified.onDidChangeHiddenAreas);f.add(he(N=>{y.read(N),w.read(N),k.read(N),T.read(N);let O=u.read(N),V=v?.diff.read(N)?.mappings;function U(te,pe,de){let se=de._getViewModel();return se?te.filter(Se=>Se.length>0).map(Se=>{let ke=se.coordinatesConverter.convertModelPositionToViewPosition(new Ie(Se.startLineNumber,1)),Ee=se.coordinatesConverter.convertModelPositionToViewPosition(new Ie(Se.endLineNumberExclusive,1)),He=Ee.lineNumber-ke.lineNumber;return new aqe(ke.lineNumber,Ee.lineNumber,He,pe.toString())}):[]}let G=U((V||[]).map(te=>te.lineRangeMapping.original),O.removeColor,this._editors.original),$=U((V||[]).map(te=>te.lineRangeMapping.modified),O.insertColor,this._editors.modified);b?.setZones(G),S?.setZones($)})),f.add(he(N=>{let O=this._rootHeight.read(N),V=this._rootWidth.read(N),U=this._modifiedEditorLayoutInfo.read(N);if(U){let G=zI.ENTIRE_DIFF_OVERVIEW_WIDTH-2*zI.ONE_OVERVIEW_WIDTH;b.setLayout({top:0,height:O,right:G+zI.ONE_OVERVIEW_WIDTH,width:zI.ONE_OVERVIEW_WIDTH}),S.setLayout({top:0,height:O,right:0,width:zI.ONE_OVERVIEW_WIDTH});let $=this._editors.modifiedScrollTop.read(N),te=this._editors.modifiedScrollHeight.read(N),pe=this._editors.modified.getOption(117),de=new g9(pe.verticalHasArrows?pe.arrowSize:0,pe.verticalScrollbarSize,0,U.height,te,$);p.setTop(de.getSliderPosition()),p.setHeight(de.getSliderSize())}else p.setTop(0),p.setHeight(0);h.style.height=O+"px",h.style.left=V-zI.ENTIRE_DIFF_OVERVIEW_WIDTH+"px",p.setWidth(zI.ENTIRE_DIFF_OVERVIEW_WIDTH)}))}))}static{this.ONE_OVERVIEW_WIDTH=15}static{this.ENTIRE_DIFF_OVERVIEW_WIDTH=this.ONE_OVERVIEW_WIDTH*2}};zI=I([m(6,De)],zI);var Gye=class extends C{constructor(e,t,o,n,r,s,l,c){super();this.originalEditorElement=e;this.modifiedEditorElement=t;this._options=o;this._argCodeEditorWidgetOptions=n;this._createInnerEditor=r;this._contextKeyService=s;this._instantiationService=l;this._keybindingService=c;this.original=this._register(this._createLeftHandSideEditor(this._options.editorOptions.get(),this._argCodeEditorWidgetOptions.originalEditor||{})),this.modified=this._register(this._createRightHandSideEditor(this._options.editorOptions.get(),this._argCodeEditorWidgetOptions.modifiedEditor||{})),this._onDidContentSizeChange=this._register(new E),this.modifiedScrollTop=ui(this,this.modified.onDidScrollChange,()=>this.modified.getScrollTop()),this.modifiedScrollHeight=ui(this,this.modified.onDidScrollChange,()=>this.modified.getScrollHeight()),this.modifiedObs=os(this.modified),this.originalObs=os(this.original),this.modifiedModel=this.modifiedObs.model,this.modifiedSelections=ui(this,this.modified.onDidChangeCursorSelection,()=>this.modified.getSelections()??[]),this.modifiedCursor=hs({owner:this,equalsFn:Ie.equals},u=>this.modifiedSelections.read(u)[0]?.getPosition()??new Ie(1,1)),this.originalCursor=ui(this,this.original.onDidChangeCursorPosition,()=>this.original.getPosition()??new Ie(1,1)),this.isOriginalFocused=os(this.original).isFocused,this.isModifiedFocused=os(this.modified).isFocused,this.isFocused=Ce(this,u=>this.isOriginalFocused.read(u)||this.isModifiedFocused.read(u)),this._argCodeEditorWidgetOptions=null,this._register(xM({changeTracker:{createChangeSummary:()=>({}),handleChange:(u,p)=>(u.didChange(o.editorOptions)&&Object.assign(p,u.change.changedOptions),!0)}},(u,p)=>{o.editorOptions.read(u),this._options.renderSideBySide.read(u),this.modified.updateOptions(this._adjustOptionsForRightHandSide(u,p)),this.original.updateOptions(this._adjustOptionsForLeftHandSide(u,p))}))}get onDidContentSizeChange(){return this._onDidContentSizeChange.event}_createLeftHandSideEditor(e,t){let o=this._adjustOptionsForLeftHandSide(void 0,e),n=this._constructInnerEditor(this._instantiationService,this.originalEditorElement,o,t),r=this._contextKeyService.createKey("isInDiffLeftEditor",n.hasWidgetFocus());return this._register(n.onDidFocusEditorWidget(()=>r.set(!0))),this._register(n.onDidBlurEditorWidget(()=>r.set(!1))),n}_createRightHandSideEditor(e,t){let o=this._adjustOptionsForRightHandSide(void 0,e),n=this._constructInnerEditor(this._instantiationService,this.modifiedEditorElement,o,t),r=this._contextKeyService.createKey("isInDiffRightEditor",n.hasWidgetFocus());return this._register(n.onDidFocusEditorWidget(()=>r.set(!0))),this._register(n.onDidBlurEditorWidget(()=>r.set(!1))),n}_constructInnerEditor(e,t,o,n){let r=this._createInnerEditor(e,t,o,n);return this._register(r.onDidContentSizeChange(s=>{let l=this.original.getContentWidth()+this.modified.getContentWidth()+zI.ENTIRE_DIFF_OVERVIEW_WIDTH,c=Math.max(this.modified.getContentHeight(),this.original.getContentHeight());this._onDidContentSizeChange.fire({contentHeight:c,contentWidth:l,contentHeightChanged:s.contentHeightChanged,contentWidthChanged:s.contentWidthChanged})})),r}_adjustOptionsForLeftHandSide(e,t){let o=this._adjustOptionsForSubEditor(t);return this._options.renderSideBySide.get()?(o.unicodeHighlight=this._options.editorOptions.get().unicodeHighlight||{},o.wordWrapOverride1=this._options.diffWordWrap.get()):(o.wordWrapOverride1="off",o.wordWrapOverride2="off",o.stickyScroll={enabled:!1},o.unicodeHighlight={nonBasicASCII:!1,ambiguousCharacters:!1,invisibleCharacters:!1}),o.glyphMargin=this._options.renderSideBySide.get(),t.originalAriaLabel&&(o.ariaLabel=t.originalAriaLabel),o.ariaLabel=this._updateAriaLabel(o.ariaLabel),o.readOnly=!this._options.originalEditable.get(),o.dropIntoEditor={enabled:!o.readOnly},o.extraEditorClassName="original-in-monaco-diff-editor",o}_adjustOptionsForRightHandSide(e,t){let o=this._adjustOptionsForSubEditor(t);return t.modifiedAriaLabel&&(o.ariaLabel=t.modifiedAriaLabel),o.ariaLabel=this._updateAriaLabel(o.ariaLabel),o.wordWrapOverride1=this._options.diffWordWrap.get(),o.revealHorizontalRightPadding=zb.revealHorizontalRightPadding.defaultValue+zI.ENTIRE_DIFF_OVERVIEW_WIDTH,o.scrollbar.verticalHasArrows=!1,o.extraEditorClassName="modified-in-monaco-diff-editor",o}_adjustOptionsForSubEditor(e){let t={...e,dimension:{height:0,width:0}};return t.inDiffEditor=!0,t.automaticLayout=!1,t.allowVariableLineHeights=!1,t.allowVariableFonts=!1,t.allowVariableFontsInAccessibilityMode=!1,t.scrollbar={...t.scrollbar||{}},t.folding=!1,t.codeLens=this._options.diffCodeLens.get(),t.fixedOverflowWidgets=!0,t.minimap={...t.minimap||{}},t.minimap.enabled=!1,this._options.hideUnchangedRegions.get()?t.stickyScroll={enabled:!1}:t.stickyScroll=this._options.editorOptions.get().stickyScroll,t}_updateAriaLabel(e){e||(e="");let t=d(222,null,this._keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getAriaLabel());return this._options.accessibilityVerbose.get()?e+t:e?e.replaceAll(t,""):""}};Gye=I([m(5,X),m(6,F),m(7,_e)],Gye);var jFo=!1;var c4i=4,d4i=new E;function u4i(a){c4i=a,d4i.fire(a)}var p4i=300,m4i=new E;function h4i(a){p4i=a,m4i.fire(a)}var Mje=class{constructor(i){this.el=i;this.disposables=new P}get onPointerMove(){return this.disposables.add(new On(Me(this.el),"mousemove")).event}get onPointerUp(){return this.disposables.add(new On(Me(this.el),"mouseup")).event}dispose(){this.disposables.dispose()}};I([mi],Mje.prototype,"onPointerMove",1),I([mi],Mje.prototype,"onPointerUp",1);var Pje=class{constructor(i){this.el=i;this.disposables=new P}get onPointerMove(){return this.disposables.add(new On(this.el,Gn.Change)).event}get onPointerUp(){return this.disposables.add(new On(this.el,Gn.End)).event}dispose(){this.disposables.dispose()}};I([mi],Pje.prototype,"onPointerMove",1),I([mi],Pje.prototype,"onPointerUp",1);var $ye=class{constructor(i){this.factory=i}get onPointerMove(){return this.factory.onPointerMove}get onPointerUp(){return this.factory.onPointerUp}dispose(){}};I([mi],$ye.prototype,"onPointerMove",1),I([mi],$ye.prototype,"onPointerUp",1);var l4i="pointer-events-disabled",pv=class a extends C{constructor(e,t,o){super();this.hoverDelay=p4i;this.hoverDelayer=this._register(new jo(this.hoverDelay));this._state=3;this.onDidEnablementChange=this._register(new E);this._onDidStart=this._register(new E);this._onDidChange=this._register(new E);this._onDidReset=this._register(new E);this._onDidEnd=this._register(new E);this.orthogonalStartSashDisposables=this._register(new P);this.orthogonalStartDragHandleDisposables=this._register(new P);this.orthogonalEndSashDisposables=this._register(new P);this.orthogonalEndDragHandleDisposables=this._register(new P);this.linkedSash=void 0;this.el=R(e,_(".monaco-sash")),o.orthogonalEdge&&this.el.classList.add(`orthogonal-edge-${o.orthogonalEdge}`),it&&this.el.classList.add("mac"),this._register(j(this.el,"mousedown",r=>this.onPointerStart(r,new Mje(e)))),this._register(j(this.el,"dblclick",r=>this.onPointerDoublePress(r))),this._register(j(this.el,"mouseenter",()=>a.onMouseEnter(this))),this._register(j(this.el,"mouseleave",()=>a.onMouseLeave(this))),this._register(ws.addTarget(this.el)),this._register(j(this.el,Gn.Start,r=>this.onPointerStart(r,new Pje(this.el))));let n;this._register(j(this.el,Gn.Tap,r=>{if(n){clearTimeout(n),n=void 0,this.onPointerDoublePress(r);return}clearTimeout(n),n=setTimeout(()=>n=void 0,250)})),typeof o.size=="number"?(this.size=o.size,o.orientation===0?this.el.style.width=`${this.size}px`:this.el.style.height=`${this.size}px`):(this.size=c4i,this._register(d4i.event(r=>{this.size=r,this.layout()}))),this._register(m4i.event(r=>this.hoverDelay=r)),this.layoutProvider=t,this.orthogonalStartSash=o.orthogonalStartSash,this.orthogonalEndSash=o.orthogonalEndSash,this.orientation=o.orientation||0,this.orientation===1?(this.el.classList.add("horizontal"),this.el.classList.remove("vertical")):(this.el.classList.remove("horizontal"),this.el.classList.add("vertical")),this.el.classList.toggle("debug",jFo),this.layout()}get state(){return this._state}get orthogonalStartSash(){return this._orthogonalStartSash}get orthogonalEndSash(){return this._orthogonalEndSash}set state(e){this._state!==e&&(this.el.classList.toggle("disabled",e===0),this.el.classList.toggle("minimum",e===1),this.el.classList.toggle("maximum",e===2),this._state=e,this.onDidEnablementChange.fire(e))}get onDidStart(){return this._onDidStart.event}get onDidChange(){return this._onDidChange.event}get onDidReset(){return this._onDidReset.event}get onDidEnd(){return this._onDidEnd.event}set orthogonalStartSash(e){if(this._orthogonalStartSash!==e){if(this.orthogonalStartDragHandleDisposables.clear(),this.orthogonalStartSashDisposables.clear(),e){let t=o=>{this.orthogonalStartDragHandleDisposables.clear(),o!==0&&(this._orthogonalStartDragHandle=R(this.el,_(".orthogonal-drag-handle.start")),this.orthogonalStartDragHandleDisposables.add(Z(()=>this._orthogonalStartDragHandle.remove())),this.orthogonalStartDragHandleDisposables.add(j(this._orthogonalStartDragHandle,"mouseenter",()=>a.onMouseEnter(e))),this.orthogonalStartDragHandleDisposables.add(j(this._orthogonalStartDragHandle,"mouseleave",()=>a.onMouseLeave(e))))};this.orthogonalStartSashDisposables.add(e.onDidEnablementChange.event(t,this)),t(e.state)}this._orthogonalStartSash=e}}set orthogonalEndSash(e){if(this._orthogonalEndSash!==e){if(this.orthogonalEndDragHandleDisposables.clear(),this.orthogonalEndSashDisposables.clear(),e){let t=o=>{this.orthogonalEndDragHandleDisposables.clear(),o!==0&&(this._orthogonalEndDragHandle=R(this.el,_(".orthogonal-drag-handle.end")),this.orthogonalEndDragHandleDisposables.add(Z(()=>this._orthogonalEndDragHandle.remove())),this.orthogonalEndDragHandleDisposables.add(j(this._orthogonalEndDragHandle,"mouseenter",()=>a.onMouseEnter(e))),this.orthogonalEndDragHandleDisposables.add(j(this._orthogonalEndDragHandle,"mouseleave",()=>a.onMouseLeave(e))))};this.orthogonalEndSashDisposables.add(e.onDidEnablementChange.event(t,this)),t(e.state)}this._orthogonalEndSash=e}}onPointerStart(e,t){$t.stop(e);let o=!1;if(!e.__orthogonalSashEvent){let v=this.getOrthogonalSash(e);v&&(o=!0,e.__orthogonalSashEvent=!0,v.onPointerStart(e,new $ye(t)))}if(this.linkedSash&&!e.__linkedSashEvent&&(e.__linkedSashEvent=!0,this.linkedSash.onPointerStart(e,new $ye(t))),!this.state)return;let n=this.el.ownerDocument.getElementsByTagName("iframe");for(let v of n)v.classList.add(l4i);let r=e.pageX,s=e.pageY,l=e.altKey,c={startX:r,currentX:r,startY:s,currentY:s,altKey:l};this.el.classList.add("active"),this._onDidStart.fire(c);let u=hr(this.el),p=()=>{let v="";o?v="all-scroll":this.orientation===1?this.state===1?v="s-resize":this.state===2?v="n-resize":v=it?"row-resize":"ns-resize":this.state===1?v="e-resize":this.state===2?v="w-resize":v=it?"col-resize":"ew-resize",u.textContent=`* { cursor: ${v} !important; }`},h=new P;p(),o||this.onDidEnablementChange.event(p,null,h);let g=v=>{$t.stop(v,!1);let b={startX:r,currentX:v.pageX,startY:s,currentY:v.pageY,altKey:l};this._onDidChange.fire(b)},f=v=>{$t.stop(v,!1),u.remove(),this.el.classList.remove("active"),this._onDidEnd.fire(),h.dispose();for(let b of n)b.classList.remove(l4i)};t.onPointerMove(g,null,h),t.onPointerUp(f,null,h),h.add(t)}onPointerDoublePress(e){let t=this.getOrthogonalSash(e);t&&t._onDidReset.fire(),this.linkedSash&&this.linkedSash._onDidReset.fire(),this._onDidReset.fire()}static onMouseEnter(e,t=!1){e.el.classList.contains("active")?(e.hoverDelayer.cancel(),e.el.classList.add("hover")):e.hoverDelayer.trigger(()=>e.el.classList.add("hover"),e.hoverDelay).then(void 0,()=>{}),!t&&e.linkedSash&&a.onMouseEnter(e.linkedSash,!0)}static onMouseLeave(e,t=!1){e.hoverDelayer.cancel(),e.el.classList.remove("hover"),!t&&e.linkedSash&&a.onMouseLeave(e.linkedSash,!0)}clearSashHoverState(){a.onMouseLeave(this)}layout(){if(this.orientation===0){let e=this.layoutProvider;this.el.style.left=e.getVerticalSashLeft(this)-this.size/2+"px",e.getVerticalSashTop&&(this.el.style.top=e.getVerticalSashTop(this)+"px"),e.getVerticalSashHeight&&(this.el.style.height=e.getVerticalSashHeight(this)+"px")}else{let e=this.layoutProvider;this.el.style.top=e.getHorizontalSashTop(this)-this.size/2+"px",e.getHorizontalSashLeft&&(this.el.style.left=e.getHorizontalSashLeft(this)+"px"),e.getHorizontalSashWidth&&(this.el.style.width=e.getHorizontalSashWidth(this)+"px")}}getOrthogonalSash(e){let t=e.initialTarget??e.target;if(!(!t||!Ao(t))&&t.classList.contains("orthogonal-drag-handle"))return t.classList.contains("start")?this.orthogonalStartSash:this.orthogonalEndSash}dispose(){super.dispose(),this.el.remove()}};var CSt=class{constructor(i,e){this._options=i;this.dimensions=e;this.sashLeft=y$(this,i=>{let e=this._sashRatio.read(i)??this._options.splitViewDefaultRatio.read(i);return this._computeSashLeft(e,i)},(i,e)=>{let t=this.dimensions.width.get();this._sashRatio.set(i/t,e)});this._sashRatio=Le(this,void 0)}resetSash(){this._sashRatio.set(void 0,void 0)}_computeSashLeft(i,e){let t=this.dimensions.width.read(e),o=Math.floor(this._options.splitViewDefaultRatio.read(e)*t),n=this._options.enableSplitViewResizing.read(e)?Math.floor(i*t):o,r=100;return t<=r*2?o:n<r?r:n>t-r?t-r:n}},qye=class extends C{constructor(e,t,o,n,r,s){super();this._domNode=e;this._dimensions=t;this._enabled=o;this._boundarySashes=n;this.sashLeft=r;this._resetSash=s;this._sash=this._register(new pv(this._domNode,{getVerticalSashTop:l=>0,getVerticalSashLeft:l=>this.sashLeft.get(),getVerticalSashHeight:l=>this._dimensions.height.get()},{orientation:0})),this._startSashPosition=void 0,this._register(this._sash.onDidStart(()=>{this._startSashPosition=this.sashLeft.get()})),this._register(this._sash.onDidChange(l=>{this.sashLeft.set(this._startSashPosition+(l.currentX-l.startX),void 0)})),this._register(this._sash.onDidEnd(()=>this._sash.layout())),this._register(this._sash.onDidReset(()=>this._resetSash())),this._register(he(l=>{let c=this._boundarySashes.read(l);c&&(this._sash.orthogonalEndSash=c.bottom)})),this._register(he(l=>{let c=this._enabled.read(l);this._sash.state=c?3:0,this.sashLeft.read(l),this._dimensions.height.read(l),this._sash.layout()}))}};var xSt=class a extends C{constructor(){super(...arguments);this._id=++a.idCounter;this._onDidDispose=this._register(new E);this.onDidDispose=this._onDidDispose.event}static{this.idCounter=0}getId(){return this.getEditorType()+":v2:"+this._id}getVisibleColumnFromPosition(e){return this._targetEditor.getVisibleColumnFromPosition(e)}getStatusbarColumn(e){return this._targetEditor.getStatusbarColumn(e)}getPosition(){return this._targetEditor.getPosition()}setPosition(e,t="api"){this._targetEditor.setPosition(e,t)}revealLine(e,t=0){this._targetEditor.revealLine(e,t)}revealLineInCenter(e,t=0){this._targetEditor.revealLineInCenter(e,t)}revealLineInCenterIfOutsideViewport(e,t=0){this._targetEditor.revealLineInCenterIfOutsideViewport(e,t)}revealLineNearTop(e,t=0){this._targetEditor.revealLineNearTop(e,t)}revealPosition(e,t=0){this._targetEditor.revealPosition(e,t)}revealPositionInCenter(e,t=0){this._targetEditor.revealPositionInCenter(e,t)}revealPositionInCenterIfOutsideViewport(e,t=0){this._targetEditor.revealPositionInCenterIfOutsideViewport(e,t)}revealPositionNearTop(e,t=0){this._targetEditor.revealPositionNearTop(e,t)}getSelection(){return this._targetEditor.getSelection()}getSelections(){return this._targetEditor.getSelections()}setSelection(e,t="api"){this._targetEditor.setSelection(e,t)}setSelections(e,t="api"){this._targetEditor.setSelections(e,t)}revealLines(e,t,o=0){this._targetEditor.revealLines(e,t,o)}revealLinesInCenter(e,t,o=0){this._targetEditor.revealLinesInCenter(e,t,o)}revealLinesInCenterIfOutsideViewport(e,t,o=0){this._targetEditor.revealLinesInCenterIfOutsideViewport(e,t,o)}revealLinesNearTop(e,t,o=0){this._targetEditor.revealLinesNearTop(e,t,o)}revealRange(e,t=0,o=!1,n=!0){this._targetEditor.revealRange(e,t,o,n)}revealRangeInCenter(e,t=0){this._targetEditor.revealRangeInCenter(e,t)}revealRangeInCenterIfOutsideViewport(e,t=0){this._targetEditor.revealRangeInCenterIfOutsideViewport(e,t)}revealRangeNearTop(e,t=0){this._targetEditor.revealRangeNearTop(e,t)}revealRangeNearTopIfOutsideViewport(e,t=0){this._targetEditor.revealRangeNearTopIfOutsideViewport(e,t)}revealRangeAtTop(e,t=0){this._targetEditor.revealRangeAtTop(e,t)}getSupportedActions(){return this._targetEditor.getSupportedActions()}focus(){this._targetEditor.focus()}trigger(e,t,o){this._targetEditor.trigger(e,t,o)}createDecorationsCollection(e){return this._targetEditor.createDecorationsCollection(e)}changeDecorations(e){return this._targetEditor.changeDecorations(e)}};var jb={enableSplitViewResizing:!0,splitViewDefaultRatio:.5,renderSideBySide:!0,renderMarginRevertIcon:!0,renderGutterMenu:!0,maxComputationTime:5e3,maxFileSize:50,ignoreTrimWhitespace:!0,renderIndicators:!0,originalEditable:!1,diffCodeLens:!1,renderOverviewRuler:!0,diffWordWrap:"inherit",diffAlgorithm:"advanced",accessibilityVerbose:!1,experimental:{showMoves:!1,showEmptyDecorations:!0,useTrueInlineView:!1},hideUnchangedRegions:{enabled:!1,contextLineCount:3,minimumLineCount:3,revealLineCount:20},isInEmbeddedEditor:!1,onlyShowAccessibleDiffViewer:!1,renderSideBySideInlineBreakpoint:900,useInlineViewWhenSpaceIsLimited:!0,compactMode:!1};var Z9=class{constructor(i,e){this._accessibilityService=e;this._diffEditorWidth=Le(this,0),this._screenReaderMode=ui(this,this._accessibilityService.onDidChangeScreenReaderOptimized,()=>this._accessibilityService.isScreenReaderOptimized()),this.couldShowInlineViewBecauseOfSize=Ce(this,o=>this._options.read(o).renderSideBySide&&this._diffEditorWidth.read(o)<=this._options.read(o).renderSideBySideInlineBreakpoint),this.renderOverviewRuler=Ce(this,o=>this._options.read(o).renderOverviewRuler),this.renderSideBySide=Ce(this,o=>this.compactMode.read(o)&&this.shouldRenderInlineViewInSmartMode.read(o)?!1:this._options.read(o).renderSideBySide&&!(this._options.read(o).useInlineViewWhenSpaceIsLimited&&this.couldShowInlineViewBecauseOfSize.read(o)&&!this._screenReaderMode.read(o))),this.readOnly=Ce(this,o=>this._options.read(o).readOnly),this.shouldRenderOldRevertArrows=Ce(this,o=>!(!this._options.read(o).renderMarginRevertIcon||!this.renderSideBySide.read(o)||this.readOnly.read(o)||this.shouldRenderGutterMenu.read(o))),this.shouldRenderGutterMenu=Ce(this,o=>this._options.read(o).renderGutterMenu),this.renderIndicators=Ce(this,o=>this._options.read(o).renderIndicators),this.enableSplitViewResizing=Ce(this,o=>this._options.read(o).enableSplitViewResizing),this.splitViewDefaultRatio=Ce(this,o=>this._options.read(o).splitViewDefaultRatio),this.ignoreTrimWhitespace=Ce(this,o=>this._options.read(o).ignoreTrimWhitespace),this.maxComputationTimeMs=Ce(this,o=>this._options.read(o).maxComputationTime),this.showMoves=Ce(this,o=>this._options.read(o).experimental.showMoves&&this.renderSideBySide.read(o)),this.isInEmbeddedEditor=Ce(this,o=>this._options.read(o).isInEmbeddedEditor),this.diffWordWrap=Ce(this,o=>this._options.read(o).diffWordWrap),this.originalEditable=Ce(this,o=>this._options.read(o).originalEditable),this.diffCodeLens=Ce(this,o=>this._options.read(o).diffCodeLens),this.accessibilityVerbose=Ce(this,o=>this._options.read(o).accessibilityVerbose),this.diffAlgorithm=Ce(this,o=>this._options.read(o).diffAlgorithm),this.showEmptyDecorations=Ce(this,o=>this._options.read(o).experimental.showEmptyDecorations),this.onlyShowAccessibleDiffViewer=Ce(this,o=>this._options.read(o).onlyShowAccessibleDiffViewer),this.compactMode=Ce(this,o=>this._options.read(o).compactMode),this.trueInlineDiffRenderingEnabled=Ce(this,o=>this._options.read(o).experimental.useTrueInlineView),this.useTrueInlineDiffRendering=Ce(this,o=>!this.renderSideBySide.read(o)&&this.trueInlineDiffRenderingEnabled.read(o)),this.hideUnchangedRegions=Ce(this,o=>this._options.read(o).hideUnchangedRegions.enabled),this.hideUnchangedRegionsRevealLineCount=Ce(this,o=>this._options.read(o).hideUnchangedRegions.revealLineCount),this.hideUnchangedRegionsContextLineCount=Ce(this,o=>this._options.read(o).hideUnchangedRegions.contextLineCount),this.hideUnchangedRegionsMinimumLineCount=Ce(this,o=>this._options.read(o).hideUnchangedRegions.minimumLineCount),this._model=Le(this,void 0),this.shouldRenderInlineViewInSmartMode=this._model.map(this,o=>q9t(this,n=>{let r=o?.diff.read(n);return r?QFo(r,this.trueInlineDiffRenderingEnabled.read(n)):void 0})).flatten().map(this,o=>!!o),this.inlineViewHideOriginalLineNumbers=this.compactMode;let t={...i,...g4i(i,jb)};this._options=Le(this,t)}get editorOptions(){return this._options}updateOptions(i){let e=g4i(i,this._options.get()),t={...this._options.get(),...i,...e};this._options.set(t,void 0,{changedOptions:i})}setWidth(i){this._diffEditorWidth.set(i,void 0)}setModel(i){this._model.set(i,void 0)}};Z9=I([m(1,Bi)],Z9);function QFo(a,i){return a.mappings.every(e=>YFo(e.lineRangeMapping)||XFo(e.lineRangeMapping)||i&&Rje(e.lineRangeMapping))}function YFo(a){return a.original.length===0}function XFo(a){return a.modified.length===0}function g4i(a,i){return{enableSplitViewResizing:Sn(a.enableSplitViewResizing,i.enableSplitViewResizing),splitViewDefaultRatio:mKi(a.splitViewDefaultRatio,.5,.1,.9),renderSideBySide:Sn(a.renderSideBySide,i.renderSideBySide),renderMarginRevertIcon:Sn(a.renderMarginRevertIcon,i.renderMarginRevertIcon),maxComputationTime:oW(a.maxComputationTime,i.maxComputationTime,0,1073741824),maxFileSize:oW(a.maxFileSize,i.maxFileSize,0,1073741824),ignoreTrimWhitespace:Sn(a.ignoreTrimWhitespace,i.ignoreTrimWhitespace),renderIndicators:Sn(a.renderIndicators,i.renderIndicators),originalEditable:Sn(a.originalEditable,i.originalEditable),diffCodeLens:Sn(a.diffCodeLens,i.diffCodeLens),renderOverviewRuler:Sn(a.renderOverviewRuler,i.renderOverviewRuler),diffWordWrap:Md(a.diffWordWrap,i.diffWordWrap,["off","on","inherit"]),diffAlgorithm:Md(a.diffAlgorithm,i.diffAlgorithm,["legacy","advanced"],{smart:"legacy",experimental:"advanced"}),accessibilityVerbose:Sn(a.accessibilityVerbose,i.accessibilityVerbose),experimental:{showMoves:Sn(a.experimental?.showMoves,i.experimental.showMoves),showEmptyDecorations:Sn(a.experimental?.showEmptyDecorations,i.experimental.showEmptyDecorations),useTrueInlineView:Sn(a.experimental?.useTrueInlineView,i.experimental.useTrueInlineView)},hideUnchangedRegions:{enabled:Sn(a.hideUnchangedRegions?.enabled??a.experimental?.collapseUnchangedRegions,i.hideUnchangedRegions.enabled),contextLineCount:oW(a.hideUnchangedRegions?.contextLineCount,i.hideUnchangedRegions.contextLineCount,0,1073741824),minimumLineCount:oW(a.hideUnchangedRegions?.minimumLineCount,i.hideUnchangedRegions.minimumLineCount,0,1073741824),revealLineCount:oW(a.hideUnchangedRegions?.revealLineCount,i.hideUnchangedRegions.revealLineCount,0,1073741824)},isInEmbeddedEditor:Sn(a.isInEmbeddedEditor,i.isInEmbeddedEditor),onlyShowAccessibleDiffViewer:Sn(a.onlyShowAccessibleDiffViewer,i.onlyShowAccessibleDiffViewer),renderSideBySideInlineBreakpoint:oW(a.renderSideBySideInlineBreakpoint,i.renderSideBySideInlineBreakpoint,0,1073741824),useInlineViewWhenSpaceIsLimited:Sn(a.useInlineViewWhenSpaceIsLimited,i.useInlineViewWhenSpaceIsLimited),renderGutterMenu:Sn(a.renderGutterMenu,i.renderGutterMenu),compactMode:Sn(a.compactMode,i.compactMode)}}var kSt=_;var e7=class extends C{constructor(i){super(),this.containerDomNode=document.createElement("div"),this.containerDomNode.className="monaco-hover",this.containerDomNode.classList.toggle("fade-in",!!i),this.containerDomNode.tabIndex=0,this.containerDomNode.setAttribute("role","tooltip"),this.contentsDomNode=document.createElement("div"),this.contentsDomNode.className="monaco-hover-content",this.scrollbar=this._register(new Pa(this.contentsDomNode,{consumeMouseWheelIfScrollbarIsNeeded:!0})),this.containerDomNode.appendChild(this.scrollbar.getDomNode())}onContentsChanged(){this.scrollbar.scanDomNode()}},t7=class a extends C{static render(i,e,t){return new a(i,e,t)}constructor(i,e,t){super(),this.actionLabel=e.label,this.actionKeybindingLabel=t,this.actionContainer=R(i,kSt("div.action-container")),this.actionContainer.setAttribute("tabindex","0"),this.action=R(this.actionContainer,kSt("a.action")),this.action.setAttribute("role","button"),e.iconClass&&R(this.action,kSt("span.icon")).classList.add(...e.iconClass.split(" ")),this.actionRenderedLabel=t?`${e.label} (${t})`:e.label;let o=R(this.action,kSt("span"));o.textContent=this.actionRenderedLabel,this._store.add(new Aje(this.actionContainer,e.run)),this._store.add(new Nje(this.actionContainer,e.run,[3,10])),this.setEnabled(!0)}setEnabled(i){i?(this.actionContainer.classList.remove("disabled"),this.actionContainer.removeAttribute("aria-disabled")):(this.actionContainer.classList.add("disabled"),this.actionContainer.setAttribute("aria-disabled","true"))}};function ESt(a,i){return a&&i?d(15,null,i):a?d(16,null):""}var Aje=class extends C{constructor(i,e){super(),this._register(j(i,re.CLICK,t=>{t.stopPropagation(),t.preventDefault(),e(i)}))}},Nje=class extends C{constructor(i,e,t){super(),this._register(j(i,re.KEY_DOWN,o=>{let n=new Ii(o);t.some(r=>n.equals(r))&&(o.stopPropagation(),o.preventDefault(),e(i))}))}};var Oje=class extends as{constructor(e,t){super();this._onDidChangeVisibility=this._register(new E);this.onDidChangeVisibility=this._onDidChangeVisibility.event;this._element=R(e,_(".monaco-dropdown")),this._label=R(this._element,_(".dropdown-label"));let o=t.labelRenderer;o||(o=r=>(r.textContent=t.label||"",null));for(let r of[re.CLICK,re.MOUSE_DOWN,Gn.Tap])this._register(j(this.element,r,s=>$t.stop(s,!0)));for(let r of[re.MOUSE_DOWN,Gn.Tap])this._register(j(this._label,r,s=>{Vp(s)&&s.button!==0||(this.visible?this.hide():this.show())}));this._register(j(this._label,re.KEY_DOWN,r=>{let s=new Ii(r);(s.equals(3)||s.equals(10))&&($t.stop(r,!0),this.visible?this.hide():this.show())}));let n=o(this._label);n&&this._register(n),this._register(ws.addTarget(this._label))}get element(){return this._element}get label(){return this._label}set tooltip(e){this._label&&(!this.hover&&e!==""?this.hover=this._register(yp().setupManagedHover(Ni("mouse"),this._label,e)):this.hover&&this.hover.update(e))}show(){this.visible||(this.visible=!0,this._onDidChangeVisibility.fire(!0))}hide(){this.visible&&(this.visible=!1,this._onDidChangeVisibility.fire(!1))}isVisible(){return!!this.visible}onEvent(e,t){this.hide()}dispose(){super.dispose(),this.hide(),this.boxContainer&&(this.boxContainer.remove(),this.boxContainer=void 0),this.contents&&(this.contents.remove(),this.contents=void 0),this._label&&(this._label.remove(),this._label=void 0)}};function f4i(a){return typeof a?.getActions=="function"}var TSt=class extends Oje{constructor(e,t){super(e,t);this._options=t;this._actions=[];this.actions=t.actions||[]}set menuOptions(e){this._menuOptions=e}get menuOptions(){return this._menuOptions}get actions(){return this._options.actionProvider?this._options.actionProvider.getActions():this._actions}set actions(e){this._actions=e}show(){super.show(),this.element.classList.add("active"),this._options.contextMenuProvider.showContextMenu({getAnchor:()=>this.element,getActions:()=>this.actions,getActionsContext:()=>this.menuOptions?this.menuOptions.context:null,getActionViewItem:(e,t)=>this.menuOptions&&this.menuOptions.actionViewItemProvider?this.menuOptions.actionViewItemProvider(e,t):void 0,getKeyBinding:e=>this.menuOptions&&this.menuOptions.getKeyBinding?this.menuOptions.getKeyBinding(e):void 0,getMenuClassName:()=>this._options.menuClassName||"",onHide:()=>this.onHide(),actionRunner:this.menuOptions?this.menuOptions.actionRunner:void 0,anchorAlignment:this.menuOptions?this.menuOptions.anchorAlignment:0,domForShadowRoot:this._options.menuAsChild?this.element:void 0,skipTelemetry:this._options.skipTelemetry})}hide(){super.hide()}onHide(){this.hide(),this.element.classList.remove("active")}};var wp=class extends oc{constructor(e,t,o,n=Object.create(null)){super(null,e,n);this.actionItem=null;this._onDidChangeVisibility=this._register(new E);this.menuActionsOrProvider=t,this.contextMenuProvider=o,this.options=n,this.options.actionRunner&&(this.actionRunner=this.options.actionRunner)}get onDidChangeVisibility(){return this._onDidChangeVisibility.event}render(e){this.actionItem=e;let t=r=>(this.element=R(r,_("a.action-label")),this.setAriaLabelAttributes(this.element),this.renderLabel(this.element)),o=Array.isArray(this.menuActionsOrProvider),n={contextMenuProvider:this.contextMenuProvider,labelRenderer:t,menuAsChild:this.options.menuAsChild,actions:o?this.menuActionsOrProvider:void 0,actionProvider:o?void 0:this.menuActionsOrProvider,skipTelemetry:this.options.skipTelemetry};if(this.dropdownMenu=this._register(new TSt(e,n)),this._register(this.dropdownMenu.onDidChangeVisibility(r=>{this.element?.setAttribute("aria-expanded",`${r}`),this._onDidChangeVisibility.fire(r)})),this.dropdownMenu.menuOptions={actionViewItemProvider:this.options.actionViewItemProvider,actionRunner:this.actionRunner,getKeyBinding:this.options.keybindingProvider,context:this._context},this.options.anchorAlignmentProvider){let r=this;this.dropdownMenu.menuOptions={...this.dropdownMenu.menuOptions,get anchorAlignment(){return r.options.anchorAlignmentProvider()}}}this.updateTooltip(),this.updateEnabled()}renderLabel(e){let t=[];return typeof this.options.classNames=="string"?t=this.options.classNames.split(/\s+/g).filter(o=>!!o):this.options.classNames&&(t=this.options.classNames),t.find(o=>o==="icon")||t.push("codicon"),e.classList.add(...t),this._action.label&&this._register(yp().setupManagedHover(this.options.hoverDelegate??Ni("mouse"),e,this._action.label)),null}setAriaLabelAttributes(e){e.setAttribute("role","button"),e.setAttribute("aria-haspopup","true"),e.setAttribute("aria-expanded","false"),e.ariaLabel=this._action.label||""}getTooltip(){let e=null;return this.action.tooltip?e=this.action.tooltip:this.action.label&&(e=this.action.label),e??void 0}setActionContext(e){super.setActionContext(e),this.dropdownMenu&&(this.dropdownMenu.menuOptions?this.dropdownMenu.menuOptions.context=e:this.dropdownMenu.menuOptions={context:e})}show(){this.dropdownMenu?.show()}updateEnabled(){let e=!this.action.enabled;this.actionItem?.classList.toggle("disabled",e),this.element?.classList.toggle("disabled",e)}},jye=class extends Lr{constructor(e,t,o,n){super(e,t,o);this.contextMenuProvider=n}render(e){if(super.render(e),this.element){this.element.classList.add("action-dropdown-item");let t={getActions:()=>{let r=this.options.menuActionsOrProvider;return Array.isArray(r)?r:r.getActions()}},o=this.options.menuActionClassNames||[],n=bt("div.action-dropdown-item-separator",[bt("div",{})]).root;n.classList.toggle("prominent",o.includes("prominent")),R(this.element,n),this.dropdownMenuActionViewItem=this._register(new wp(this._register(new st("dropdownAction",d(8,null))),t,this.contextMenuProvider,{classNames:["dropdown",...q.asClassNameArray(M.dropDownButton),...o],hoverDelegate:this.options.hoverDelegate})),this.dropdownMenuActionViewItem.render(this.element),this._register(j(this.element,re.KEY_DOWN,r=>{if(t.getActions().length===0)return;let s=new Ii(r),l=!1;this.dropdownMenuActionViewItem?.isFocused()&&s.equals(15)?(l=!0,this.dropdownMenuActionViewItem?.blur(),this.focus()):this.isFocused()&&s.equals(17)&&(l=!0,this.blur(),this.dropdownMenuActionViewItem?.focus()),l&&(s.preventDefault(),s.stopPropagation())}))}}blur(){super.blur(),this.dropdownMenuActionViewItem?.blur()}setFocusable(e){super.setFocusable(e),this.dropdownMenuActionViewItem?.setFocusable(e)}};var Fje=20,_ae=4,JFo="--vscode-toolbar-action-min-width",Ju=class extends C{constructor(e,t,o={orientation:0}){super();this.container=e;this.submenuActionViewItems=[];this.hasSecondaryActions=!1;this._onDidChangeDropdownVisibility=this._register(new xI);this.originalPrimaryActions=[];this.originalSecondaryActions=[];this.hiddenActions=[];this.disposables=this._register(new P);if(o.hoverDelegate=o.hoverDelegate??this._register(Gg()),this.options=o,this.toggleMenuAction=this._register(new Qye(()=>this.toggleMenuActionViewItem?.show(),o.toggleMenuTitle)),this.element=document.createElement("div"),this.element.className="monaco-toolbar",e.appendChild(this.element),this.actionBar=this._register(new ji(this.element,{orientation:o.orientation,ariaLabel:o.ariaLabel,actionRunner:o.actionRunner,allowContextMenu:o.allowContextMenu,highlightToggledItems:o.highlightToggledItems,hoverDelegate:o.hoverDelegate,actionViewItemProvider:(n,r)=>{if(n.id===Qye.ID)return this.toggleMenuActionViewItem=new wp(n,{getActions:()=>this.toggleMenuAction.menuActions},t,{actionViewItemProvider:this.options.actionViewItemProvider,actionRunner:this.actionRunner,keybindingProvider:this.options.getKeyBinding,classNames:q.asClassNameArray(o.moreIcon??M.toolBarMore),anchorAlignmentProvider:this.options.anchorAlignmentProvider,menuAsChild:!!this.options.renderDropdownAsChildElement,skipTelemetry:this.options.skipTelemetry,isMenu:!0,hoverDelegate:this.options.hoverDelegate}),this.toggleMenuActionViewItem.setActionContext(this.actionBar.context),this.disposables.add(this._onDidChangeDropdownVisibility.add(this.toggleMenuActionViewItem.onDidChangeVisibility)),this.toggleMenuActionViewItem;if(o.actionViewItemProvider){let s=o.actionViewItemProvider(n,r);if(s)return s}if(n instanceof $l){let s=new wp(n,n.actions,t,{actionViewItemProvider:this.options.actionViewItemProvider,actionRunner:this.actionRunner,keybindingProvider:this.options.getKeyBinding,classNames:n.class,anchorAlignmentProvider:this.options.anchorAlignmentProvider,menuAsChild:!!this.options.renderDropdownAsChildElement,skipTelemetry:this.options.skipTelemetry,hoverDelegate:this.options.hoverDelegate});return s.setActionContext(this.actionBar.context),this.submenuActionViewItems.push(s),this.disposables.add(this._onDidChangeDropdownVisibility.add(s.onDidChangeVisibility)),s}}})),this.actionMinWidth=(o.responsiveBehavior?.actionMinWidth??Fje)+_ae,this.options.responsiveBehavior?.enabled){this.element.classList.toggle("responsive",!0),this.element.classList.toggle("responsive-all",this.options.responsiveBehavior.kind==="all"),this.element.classList.toggle("responsive-last",this.options.responsiveBehavior.kind==="last"),this.element.style.setProperty(JFo,`${this.actionMinWidth-_ae}px`);let n=new ResizeObserver(()=>{this.updateActions(this.element.getBoundingClientRect().width)});n.observe(this.element),this._store.add(Z(()=>n.disconnect()))}}get onDidChangeDropdownVisibility(){return this._onDidChangeDropdownVisibility.event}set actionRunner(e){this.actionBar.actionRunner=e}get actionRunner(){return this.actionBar.actionRunner}set context(e){this.actionBar.context=e,this.toggleMenuActionViewItem?.setActionContext(e);for(let t of this.submenuActionViewItems)t.setActionContext(e)}getElement(){return this.element}focus(){this.actionBar.focus()}getItemsWidth(){let e=0;for(let t=0;t<this.actionBar.length();t++)e+=this.actionBar.getWidth(t);return e}getItemAction(e){return this.actionBar.getAction(e)}getItemWidth(e){return this.actionBar.getWidth(e)}getItemsLength(){return this.actionBar.length()}setAriaLabel(e){this.actionBar.setAriaLabel(e)}setActions(e,t){this.clear(),this.originalPrimaryActions=e?e.slice(0):[],this.originalSecondaryActions=t?t.slice(0):[];let o=e?e.slice(0):[];if(this.hasSecondaryActions=!!(t&&t.length>0),this.hasSecondaryActions&&t&&(this.toggleMenuAction.menuActions=t.slice(0),o.push(this.toggleMenuAction)),o.length>0&&this.options.trailingSeparator&&o.push(new li),o.forEach(n=>{this.actionBar.push(n,{icon:this.options.icon??!0,label:this.options.label??!1,keybinding:this.getKeybindingLabel(n)})}),this.actionBar.domNode.classList.toggle("has-overflow",this.actionBar.hasAction(this.toggleMenuAction)),this.options.responsiveBehavior?.enabled){if(this.hiddenActions.length=0,this.options.responsiveBehavior?.minItems!==void 0){let n=this.options.responsiveBehavior.minItems,r=0;(this.originalSecondaryActions.length>0||n<this.originalPrimaryActions.length)&&(r=Fje+_ae),this.container.style.minWidth=`${n*this.actionMinWidth+r}px`,this.element.style.minWidth=`${n*this.actionMinWidth+r}px`}else this.container.style.minWidth=`${Fje+_ae}px`,this.element.style.minWidth=`${Fje+_ae}px`;this.updateActions(this.element.getBoundingClientRect().width)}}isEmpty(){return this.actionBar.isEmpty()}getKeybindingLabel(e){return this.options.getKeyBinding?.(e)?.getLabel()??void 0}updateActions(e){if(this.actionBar.isEmpty())return;e=Math.max(e,parseInt(this.element.style.minWidth));let t=n=>{if(this.options.responsiveBehavior?.kind==="last"){let r=this.actionBar.hasAction(this.toggleMenuAction),s=r?this.actionBar.length()-1:this.actionBar.length(),l=0;for(let c=0;c<s-1;c++)l+=this.actionBar.getWidth(c)+_ae;return l+=n?this.actionBar.getWidth(s-1):this.actionMinWidth,l+=r?Fje+_ae:0,l}else return this.actionBar.length()*this.actionMinWidth};if(t(!1)<=e&&this.hiddenActions.length===0)return;if(t(!1)>e){if(this.options.responsiveBehavior?.minItems!==void 0&&(this.actionBar.hasAction(this.toggleMenuAction)?this.actionBar.length()-1:this.actionBar.length())<=this.options.responsiveBehavior.minItems)return;for(;t(!0)>e&&this.actionBar.length()>0;){let n=this.originalPrimaryActions.length-this.hiddenActions.length-1;if(n<0)break;let r=Math.min(this.actionMinWidth,this.getItemWidth(n)),s=this.originalPrimaryActions[n];this.hiddenActions.unshift({action:s,size:r}),this.actionBar.pull(n),this.originalSecondaryActions.length===0&&this.hiddenActions.length===1&&this.actionBar.push(this.toggleMenuAction,{icon:this.options.icon??!0,label:this.options.label??!1,keybinding:this.getKeybindingLabel(this.toggleMenuAction)})}}else for(;this.hiddenActions.length>0;){let n=this.hiddenActions.shift();if(t(!0)+n.size>e){this.hiddenActions.unshift(n);break}this.actionBar.push(n.action,{icon:this.options.icon??!0,label:this.options.label??!1,keybinding:this.getKeybindingLabel(n.action),index:this.originalPrimaryActions.length-this.hiddenActions.length-1}),this.originalSecondaryActions.length===0&&this.hiddenActions.length===0&&(this.toggleMenuAction.menuActions=[],this.actionBar.pull(this.actionBar.length()-1))}let o=this.hiddenActions.map(n=>n.action);if(this.originalSecondaryActions.length>0||o.length>0){let n=this.originalSecondaryActions.slice(0);this.toggleMenuAction.menuActions=li.join(o,n)}this.actionBar.domNode.classList.toggle("has-overflow",this.actionBar.hasAction(this.toggleMenuAction))}clear(){this.submenuActionViewItems=[],this.disposables.clear(),this.actionBar.clear()}dispose(){this.clear(),this.disposables.dispose(),this.element.remove(),super.dispose()}},Qye=class a extends st{static{this.ID="toolbar.toggle.more"}constructor(i,e){e=e||d(32,null),super(a.ID,e,void 0,!0),this._menuActions=[],this.toggleDropdownMenu=i}async run(){this.toggleDropdownMenu()}get menuActions(){return this._menuActions}set menuActions(i){this._menuActions=i}};var Yye=class{constructor(i,e,t=e){this.modifierLabels=[null],this.modifierLabels[2]=i,this.modifierLabels[1]=e,this.modifierLabels[3]=t}toLabel(i,e,t){if(e.length===0)return null;let o=[];for(let n=0,r=e.length;n<r;n++){let s=e[n],l=t(s);if(l===null)return null;o[n]=ZFo(s,l,this.modifierLabels[i])}return o.join(" ")}},YN=new Yye({ctrlKey:"\u2303",shiftKey:"\u21E7",altKey:"\u2325",metaKey:"\u2318",separator:""},{ctrlKey:d(129,null),shiftKey:d(132,null),altKey:d(126,null),metaKey:d(136,null),separator:"+"},{ctrlKey:d(129,null),shiftKey:d(132,null),altKey:d(126,null),metaKey:d(134,null),separator:"+"}),_St=new Yye({ctrlKey:d(130,null),shiftKey:d(133,null),altKey:d(131,null),metaKey:d(128,null),separator:"+"},{ctrlKey:d(130,null),shiftKey:d(133,null),altKey:d(127,null),metaKey:d(137,null),separator:"+"},{ctrlKey:d(130,null),shiftKey:d(133,null),altKey:d(127,null),metaKey:d(135,null),separator:"+"}),v4i=new Yye({ctrlKey:"Ctrl",shiftKey:"Shift",altKey:"Alt",metaKey:"Cmd",separator:"+"},{ctrlKey:"Ctrl",shiftKey:"Shift",altKey:"Alt",metaKey:"Super",separator:"+"}),Xye=new Yye({ctrlKey:"ctrl",shiftKey:"shift",altKey:"alt",metaKey:"cmd",separator:"+"},{ctrlKey:"ctrl",shiftKey:"shift",altKey:"alt",metaKey:"win",separator:"+"},{ctrlKey:"ctrl",shiftKey:"shift",altKey:"alt",metaKey:"meta",separator:"+"});function ZFo(a,i,e){if(i===null)return"";let t=[];return a.ctrlKey&&t.push(e.ctrlKey),a.shiftKey&&t.push(e.shiftKey),a.altKey&&t.push(e.altKey),a.metaKey&&t.push(e.metaKey),i!==""&&t.push(i),t.join(e.separator)}function xq(a){return!!a&&typeof a=="object"&&typeof a.original=="string"&&typeof a.value=="string"}function Jye(a){return a?a.condition!==void 0:!1}function nii(a){let i=[];typeof a=="number"&&i.push("code/timeOrigin",a);function e(o,n){i.push(o,n?.startTime??Date.now())}function t(){let o=[];for(let n=0;n<i.length;n+=2)o.push({name:i[n],startTime:i[n+1]});return o}return{mark:e,getMarks:t}}function e0o(){if(typeof performance=="object"&&typeof performance.mark=="function"&&!performance.nodeTiming)return typeof performance.timeOrigin!="number"&&!performance.timing?nii():{mark(a,i){performance.mark(a,i)},getMarks(){let a=performance.timeOrigin;typeof a!="number"&&(a=(performance.timing.navigationStart||performance.timing.redirectStart||performance.timing.fetchStart)??0);let i=[{name:"code/timeOrigin",startTime:Math.round(a)}];for(let e of performance.getEntriesByType("mark"))i.push({name:e.name,startTime:Math.round(a+e.startTime)});return i}};if(typeof process=="object"){let a=performance?.timeOrigin;return nii(a)}else return console.trace("perf-util loaded in UNKNOWN environment"),nii()}function t0o(a){return a.MonacoPerformanceMarks||(a.MonacoPerformanceMarks=e0o()),a.MonacoPerformanceMarks}var b4i=t0o(globalThis),sn=b4i.mark,S4i=b4i.getMarks;var XN=class a extends C{constructor(e,t=Object.create(null)){super();this.database=e;this.options=t;this._onDidChangeStorage=this._register(new Pm);this.onDidChangeStorage=this._onDidChangeStorage.event;this.state=0;this.cache=new Map;this.flushDelayer=this._register(new ya(a.DEFAULT_FLUSH_DELAY));this.pendingDeletes=new Set;this.pendingInserts=new Map;this.pendingClose=void 0;this.whenFlushedCallbacks=[];this.registerListeners()}static{this.DEFAULT_FLUSH_DELAY=100}registerListeners(){this._register(this.database.onDidChangeItemsExternal(e=>this.onDidChangeItemsExternal(e)))}onDidChangeItemsExternal(e){this._onDidChangeStorage.pause();try{e.changed?.forEach((t,o)=>this.acceptExternal(o,t)),e.deleted?.forEach(t=>this.acceptExternal(t,void 0))}finally{this._onDidChangeStorage.resume()}}acceptExternal(e,t){if(this.state===2)return;let o=!1;Jn(t)?o=this.cache.delete(e):this.cache.get(e)!==t&&(this.cache.set(e,t),o=!0),o&&this._onDidChangeStorage.fire({key:e,external:!0})}get items(){return this.cache}get size(){return this.cache.size}async init(){this.state===0&&(this.state=1,this.options.hint!==0&&(this.cache=await this.database.getItems()))}get(e,t){let o=this.cache.get(e);return Jn(o)?t:o}getBoolean(e,t){let o=this.get(e);return Jn(o)?t:o==="true"}getNumber(e,t){let o=this.get(e);return Jn(o)?t:parseInt(o,10)}getObject(e,t){let o=this.get(e);return Jn(o)?t:zg(o)}async set(e,t,o=!1){if(this.state===2)return;if(Jn(t))return this.delete(e,o);let n=yi(t)||Array.isArray(t)?yIe(t):String(t);if(this.cache.get(e)!==n)return this.cache.set(e,n),this.pendingInserts.set(e,n),this.pendingDeletes.delete(e),this._onDidChangeStorage.fire({key:e,external:o}),this.doFlush()}async delete(e,t=!1){if(!(this.state===2||!this.cache.delete(e)))return this.pendingDeletes.has(e)||this.pendingDeletes.add(e),this.pendingInserts.delete(e),this._onDidChangeStorage.fire({key:e,external:t}),this.doFlush()}async optimize(){if(this.state!==2)return await this.flush(0),this.database.optimize()}async close(){return this.pendingClose||(this.pendingClose=this.doClose()),this.pendingClose}async doClose(){this.state=2;try{await this.doFlush(0)}catch{}await this.database.close(()=>this.cache)}get hasPending(){return this.pendingInserts.size>0||this.pendingDeletes.size>0}async flushPending(){if(!this.hasPending)return;let e={insert:this.pendingInserts,delete:this.pendingDeletes};return this.pendingDeletes=new Set,this.pendingInserts=new Map,this.database.updateItems(e).finally(()=>{if(!this.hasPending)for(;this.whenFlushedCallbacks.length;)this.whenFlushedCallbacks.pop()?.()})}async flush(e){if(!(this.state===2||this.pendingClose))return this.doFlush(e)}async doFlush(e){return this.options.hint===1?this.flushPending():this.flushDelayer.trigger(()=>this.flushPending(),e)}async whenFlushed(){if(this.hasPending)return new Promise(e=>this.whenFlushedCallbacks.push(e))}isInMemory(){return this.options.hint===1}},ewe=class{constructor(){this.onDidChangeItemsExternal=H.None;this.items=new Map}async getItems(){return this.items}async updateItems(i){i.insert?.forEach((e,t)=>this.items.set(t,e)),i.delete?.forEach(e=>this.items.delete(e))}async optimize(){}async close(){}};var Co=ae("environmentService"),iC=Co;var Pe=ae("contextService");function $g(a){let i=a;return typeof i?.id=="string"&&A.isUri(i.uri)}function Eq(a){return typeof a?.id=="string"&&!$g(a)&&!TL(a)}var i0o={id:"ext-dev"},o0o={id:"empty-window"};function VS(a,i){if(typeof a=="string"||typeof a>"u")return typeof a=="string"?{id:No(a)}:i?i0o:o0o;let e=a;return e.configuration?{id:e.id,configPath:e.configuration}:e.folders.length===1?{id:e.id,uri:e.folders[0].uri}:{id:e.id}}function TL(a){let i=a;return typeof i?.id=="string"&&A.isUri(i.configPath)}function I4i(a){let i=a;if(i?.uri)return{id:i.id,uri:A.revive(i.uri)};let e=a;if(e?.configPath)return{id:e.id,configPath:A.revive(e.configPath)};if(a?.id)return{id:a.id}}function Tq(a){let i=a;return!!(i&&typeof i=="object"&&typeof i.id=="string"&&Array.isArray(i.folders))}function oC(a){let i=a;return!!(i&&typeof i=="object"&&A.isUri(i.uri)&&typeof i.name=="string"&&typeof i.toResource=="function")}var twe=class{constructor(i,e,t,o,n){this._id=i;this._transient=t;this._configuration=o;this.ignorePathCasing=n;this.foldersMap=Yu.forUris(this.ignorePathCasing,()=>!0),this.folders=e}get folders(){return this._folders}set folders(i){this._folders=i,this.updateFoldersMap()}update(i){this._id=i.id,this._configuration=i.configuration,this._transient=i.transient,this.ignorePathCasing=i.ignorePathCasing,this.folders=i.folders}get id(){return this._id}get transient(){return this._transient}get configuration(){return this._configuration}set configuration(i){this._configuration=i}getFolder(i){return i&&this.foldersMap.findSubstr(i)||null}updateFoldersMap(){this.foldersMap=Yu.forUris(this.ignorePathCasing,()=>!0);for(let i of this.folders)this.foldersMap.set(i.uri,i)}toJSON(){return{id:this.id,folders:this.folders,transient:this.transient,configuration:this.configuration}}},kq=class{constructor(i,e){this.raw=e;this.uri=i.uri,this.index=i.index,this.name=i.name}toResource(i){return je(this.uri,i)}toJSON(){return{uri:this.uri,name:this.name,index:this.index}}};function Dae(a){return new kq({uri:a,index:0,name:Ra(a)},{uri:a.toString()})}var JN="code-workspace",Wje=`.${JN}`,Lyr=[{name:d(2726,null),extensions:[JN]}],y4i="workspace.json";function _q(a,i){return m$.isEqualOrParent(a,i.untitledWorkspacesHome)}function xx(a){let i;return A.isUri(a)?i=a:i=a.configuration,i?.scheme===Y.tmp}var n0o="4064f6ec-cb38-4ad0-af64-ee6467e63c82";function w4i(a){return a.id===n0o}function Vje(a,i){return!_q(a,i)&&!xx(a)}function o7(a){return(typeof a=="string"?Am(a):ms(a))===Wje}var dt=ae("IUriIdentityService");function ZN(a){let i=a;return!!(i&&typeof i=="object"&&typeof i.id=="string"&&typeof i.isDefault=="boolean"&&typeof i.name=="string"&&A.isUri(i.location)&&A.isUri(i.globalStorageHome)&&A.isUri(i.settingsResource)&&A.isUri(i.keybindingsResource)&&A.isUri(i.tasksResource)&&A.isUri(i.snippetsHome)&&A.isUri(i.promptsHome)&&A.isUri(i.extensionsResource)&&A.isUri(i.mcpResource))}var an=ae("IUserDataProfilesService");function Qy(a,i){return{id:a.id,isDefault:a.isDefault,name:a.name,icon:a.icon,location:A.revive(a.location).with({scheme:i}),globalStorageHome:A.revive(a.globalStorageHome).with({scheme:i}),settingsResource:A.revive(a.settingsResource).with({scheme:i}),keybindingsResource:A.revive(a.keybindingsResource).with({scheme:i}),tasksResource:A.revive(a.tasksResource).with({scheme:i}),snippetsHome:A.revive(a.snippetsHome).with({scheme:i}),promptsHome:A.revive(a.promptsHome).with({scheme:i}),extensionsResource:A.revive(a.extensionsResource).with({scheme:i}),mcpResource:A.revive(a.mcpResource).with({scheme:i}),cacheHome:A.revive(a.cacheHome).with({scheme:i}),useDefaultFlags:a.useDefaultFlags,isTransient:a.isTransient,workspaces:a.workspaces?.map(e=>A.revive(e))}}function Lae(a,i,e,t,o,n){return{id:a,name:i,location:e,isDefault:!1,icon:o?.icon,globalStorageHome:n&&o?.useDefaultFlags?.globalState?n.globalStorageHome:je(e,"globalStorage"),settingsResource:n&&o?.useDefaultFlags?.settings?n.settingsResource:je(e,"settings.json"),keybindingsResource:n&&o?.useDefaultFlags?.keybindings?n.keybindingsResource:je(e,"keybindings.json"),tasksResource:n&&o?.useDefaultFlags?.tasks?n.tasksResource:je(e,"tasks.json"),snippetsHome:n&&o?.useDefaultFlags?.snippets?n.snippetsHome:je(e,"snippets"),promptsHome:n&&o?.useDefaultFlags?.prompts?n.promptsHome:je(e,"prompts"),extensionsResource:n&&o?.useDefaultFlags?.extensions?n.extensionsResource:je(e,"extensions.json"),mcpResource:n&&o?.useDefaultFlags?.mcp?n.mcpResource:je(e,"mcp.json"),cacheHome:je(t,a),useDefaultFlags:o?.useDefaultFlags,isTransient:o?.transient,workspaces:o?.workspaces}}var DSt=class extends C{constructor(e,t,o,n){super();this.environmentService=e;this.fileService=t;this.uriIdentityService=o;this.logService=n;this._onDidChangeProfiles=this._register(new E);this.onDidChangeProfiles=this._onDidChangeProfiles.event;this._onWillCreateProfile=this._register(new E);this.onWillCreateProfile=this._onWillCreateProfile.event;this._onWillRemoveProfile=this._register(new E);this.onWillRemoveProfile=this._onWillRemoveProfile.event;this._onDidResetWorkspaces=this._register(new E);this.onDidResetWorkspaces=this._onDidResetWorkspaces.event;this.profileCreationPromises=new Map;this.transientProfilesObject={profiles:[],emptyWindows:new Map};this.profilesHome=je(this.environmentService.userRoamingDataHome,"profiles"),this.profilesCacheHome=je(this.environmentService.cacheHome,"CachedProfilesData")}static{this.PROFILES_KEY="userDataProfiles"}static{this.PROFILE_ASSOCIATIONS_KEY="profileAssociations"}get defaultProfile(){return this.profiles[0]}get profiles(){return[...this.profilesObject.profiles,...this.transientProfilesObject.profiles]}init(){this._profilesObject=void 0}get profilesObject(){if(!this._profilesObject){let e=this.createDefaultProfile(),t=[e];try{for(let n of this.getStoredProfiles()){if(this.isInvalidProfile(n)){this.logService.warn("Skipping the invalid stored profile",n.location||n.name);continue}let r=Ye(n.location);t.push(Lae(r,n.name,n.location,this.profilesCacheHome,{icon:n.icon,useDefaultFlags:n.useDefaultFlags},e))}}catch(n){this.logService.error(n)}let o=new Map;if(t.length)try{let n=this.getStoredProfileAssociations();if(n.workspaces)for(let[r,s]of Object.entries(n.workspaces)){let l=A.parse(r),c=t.find(u=>u.id===s);if(c){let u=c.workspaces?c.workspaces.slice(0):[];u.push(l),c.workspaces=u}}if(n.emptyWindows)for(let[r,s]of Object.entries(n.emptyWindows)){let l=t.find(c=>c.id===s);l&&o.set(r,l)}}catch(n){this.logService.error(n)}this._profilesObject={profiles:t,emptyWindows:o}}return this._profilesObject}isInvalidProfile(e){return!!(!e.name||!Ae(e.name)||!e.location||e.isSystem||this.uriIdentityService.extUri.basename(this.uriIdentityService.extUri.dirname(e.location))==="builtin")}createDefaultProfile(){let e=Lae("__default__profile__",d(2685,null),this.environmentService.userRoamingDataHome,this.profilesCacheHome);return{...e,extensionsResource:this.getDefaultProfileExtensionsLocation()??e.extensionsResource,isDefault:!0}}async createTransientProfile(e){let t="Temp",o=new RegExp(`${Yr(t)}\\s(\\d+)`),n=0;for(let s of this.profiles){let l=o.exec(s.name),c=l?parseInt(l[1]):0;n=c>n?c:n}let r=`${t} ${n+1}`;return this.createProfile(Ir(_t()).toString(16),r,{transient:!0},e)}async createNamedProfile(e,t,o){return this.createProfile(Ir(_t()).toString(16),e,t,o)}async createProfile(e,t,o,n){return await this.doCreateProfile(e,t,o,n)}async doCreateProfile(e,t,o,n){if(!Ae(t)||!t)throw new Error("Name of the profile is mandatory and must be of type `string`");let r=this.profileCreationPromises.get(t);return r||(r=(async()=>{try{if(this.profiles.find(p=>p.id===e||!p.isTransient&&!o?.transient&&p.name===t))throw new Error(`Profile with ${t} name already exists`);let l=n?this.getWorkspace(n):void 0;A.isUri(l)&&(o={...o,workspaces:[l]});let c=Lae(e,t,this.uriIdentityService.extUri.joinPath(this.profilesHome,e),this.profilesCacheHome,o,this.defaultProfile);await this.fileService.createFolder(c.location);let u=[];return this._onWillCreateProfile.fire({profile:c,join(p){u.push(p)}}),await fn.settled(u),l&&!A.isUri(l)&&this.updateEmptyWindowAssociation(l,c,!!c.isTransient),this.updateProfiles([c],[],[]),c}finally{this.profileCreationPromises.delete(t)}})(),this.profileCreationPromises.set(t,r)),r}async updateProfile(e,t){let o=[];for(let r of this.profiles){let s;if(e.id===r.id)r.isDefault?t.workspaces&&(s=r,s.workspaces=t.workspaces):s=Lae(r.id,t.name??r.name,r.location,this.profilesCacheHome,{icon:t.icon===null?void 0:t.icon??r.icon,transient:t.transient??r.isTransient,useDefaultFlags:t.useDefaultFlags??r.useDefaultFlags,workspaces:t.workspaces??r.workspaces},this.defaultProfile);else if(t.workspaces){let l=r.workspaces?.filter(c=>!t.workspaces?.some(u=>this.uriIdentityService.extUri.isEqual(c,u)));r.workspaces?.length!==l?.length&&(s=r,s.workspaces=l)}s&&o.push(s)}if(!o.length)throw e.isDefault?new Error("Cannot update default profile"):new Error(`Profile '${e.name}' does not exist`);this.updateProfiles([],[],o);let n=this.profiles.find(r=>r.id===e.id);if(!n)throw new Error(`Profile '${e.name}' was not updated`);return n}async removeProfile(e){if(e.isDefault)throw new Error("Cannot remove default profile");let t=this.profiles.find(n=>n.id===e.id);if(!t)throw new Error(`Profile '${e.name}' does not exist`);let o=[];this._onWillRemoveProfile.fire({profile:t,join(n){o.push(n)}});try{await Promise.allSettled(o)}catch(n){this.logService.error(n)}this.updateProfiles([],[t],[]);try{await this.fileService.del(t.cacheHome,{recursive:!0})}catch(n){hu(n)!==1&&this.logService.error(n)}}async setProfileForWorkspace(e,t){let o=this.profiles.find(r=>r.id===t.id);if(!o)throw new Error(`Profile '${t.name}' does not exist`);let n=this.getWorkspace(e);if(A.isUri(n)){let r=o.workspaces?[...o.workspaces]:[];r.some(s=>this.uriIdentityService.extUri.isEqual(s,n))||(r.push(n),await this.updateProfile(o,{workspaces:r}))}else this.updateEmptyWindowAssociation(n,o,!1),this.updateStoredProfiles(this.profiles)}unsetWorkspace(e,t=!1){let o=this.getWorkspace(e);if(A.isUri(o)){let n=this.getProfileForWorkspace(e);n&&this.updateProfile(n,{workspaces:n.workspaces?.filter(r=>!this.uriIdentityService.extUri.isEqual(r,o))})}else this.updateEmptyWindowAssociation(o,void 0,t),this.updateStoredProfiles(this.profiles)}async resetWorkspaces(){this.transientProfilesObject.emptyWindows.clear(),this.profilesObject.emptyWindows.clear();for(let e of this.profiles)e.workspaces=void 0;this.updateProfiles([],[],this.profiles),this._onDidResetWorkspaces.fire()}async cleanUp(){try{if(await this.fileService.exists(this.profilesHome)){let e=this.uriIdentityService.extUri.joinPath(this.profilesHome,"builtin");if(await this.fileService.exists(e))try{await this.fileService.del(e,{recursive:!0})}catch(o){this.logService.error(o)}let t=await this.fileService.resolve(this.profilesHome);await Promise.all((t.children||[]).filter(o=>o.isDirectory&&this.profiles.every(n=>!this.uriIdentityService.extUri.isEqual(n.location,o.resource))).map(o=>this.fileService.del(o.resource,{recursive:!0})))}}catch(e){this.logService.error("Error deleting redundant profile folders",e)}try{let e=this.getStoredProfiles(),t=[];for(let o of this.getStoredProfiles())this.isInvalidProfile(o)?this.logService.warn(`Invalid user data profile found: ${o.name}`):t.push(o);e.length!==t.length&&this.saveStoredProfiles(t)}catch(e){this.logService.error("Error removing invalid stored profiles",e)}}async cleanUpTransientProfiles(){let e=this.transientProfilesObject.profiles.filter(t=>!this.isProfileAssociatedToWorkspace(t));await Promise.allSettled(e.map(t=>this.removeProfile(t)))}getProfileForWorkspace(e){let t=this.getWorkspace(e);return A.isUri(t)?this.profiles.find(o=>o.workspaces?.some(n=>this.uriIdentityService.extUri.isEqual(n,t))):this.profilesObject.emptyWindows.get(t)??this.transientProfilesObject.emptyWindows.get(t)}getWorkspace(e){return $g(e)?e.uri:TL(e)?e.configPath:e.id}isProfileAssociatedToWorkspace(e){return!!(e.workspaces?.length||[...this.profilesObject.emptyWindows.values()].some(t=>this.uriIdentityService.extUri.isEqual(t.location,e.location))||[...this.transientProfilesObject.emptyWindows.values()].some(t=>this.uriIdentityService.extUri.isEqual(t.location,e.location)))}updateProfiles(e,t,o,n=!1){let r=[...this.profiles,...e],s=this.transientProfilesObject.profiles;this.transientProfilesObject.profiles=[];let l=[];for(let c of r){if(t.some(u=>c.id===u.id)){for(let u of[...this.profilesObject.emptyWindows.keys()])c.id===this.profilesObject.emptyWindows.get(u)?.id&&this.profilesObject.emptyWindows.delete(u);continue}if(!c.isDefault){c=o.find(p=>c.id===p.id)??c;let u=s.find(p=>c.id===p.id);if(c.isTransient)this.transientProfilesObject.profiles.push(c);else if(u){for(let[p,h]of this.transientProfilesObject.emptyWindows.entries())if(c.id===h.id){this.transientProfilesObject.emptyWindows.delete(p),this.profilesObject.emptyWindows.set(p,c);break}}}c.workspaces?.length===0&&(c.workspaces=void 0),l.push(c)}this.updateStoredProfiles(l),n||this.triggerProfilesChanges(e,t,o)}triggerProfilesChanges(e,t,o){this._onDidChangeProfiles.fire({added:e,removed:t,updated:o,all:this.profiles})}updateEmptyWindowAssociation(e,t,o){o=t?.isTransient?!0:o,o?t?this.transientProfilesObject.emptyWindows.set(e,t):this.transientProfilesObject.emptyWindows.delete(e):(this.transientProfilesObject.emptyWindows.delete(e),t?this.profilesObject.emptyWindows.set(e,t):this.profilesObject.emptyWindows.delete(e))}updateStoredProfiles(e){let t=[],o={},n={};for(let r of e)if(!r.isTransient&&(r.isDefault||t.push({location:r.location,name:r.name,icon:r.icon,useDefaultFlags:r.useDefaultFlags}),r.workspaces))for(let s of r.workspaces)o[s.toString()]=r.id;for(let[r,s]of this.profilesObject.emptyWindows.entries())n[r.toString()]=s.id;this.saveStoredProfileAssociations({workspaces:o,emptyWindows:n}),this.saveStoredProfiles(t),this._profilesObject=void 0}getStoredProfiles(){return[]}saveStoredProfiles(e){throw new Error("not implemented")}getStoredProfileAssociations(){return{}}saveStoredProfileAssociations(e){throw new Error("not implemented")}getDefaultProfileExtensionsLocation(){}};DSt=I([m(0,Co),m(1,be),m(2,dt),m(3,ne)],DSt);var rii="__$__isNewStorageMarker",LSt="__$__targetStorageMarker",le=ae("storageService");function r0o(a){let i=a.get(LSt);if(i)try{return JSON.parse(i)}catch{}return Object.create(null)}var Rae=class a extends C{constructor(e={flushInterval:a.DEFAULT_FLUSH_INTERVAL}){super();this._onDidChangeValue=this._register(new Pm);this._onDidChangeTarget=this._register(new Pm);this.onDidChangeTarget=this._onDidChangeTarget.event;this._onWillSaveState=this._register(new E);this.onWillSaveState=this._onWillSaveState.event;this.runFlushWhenIdle=this._register(new me);this._workspaceKeyTargets=void 0;this._profileKeyTargets=void 0;this._applicationKeyTargets=void 0;this.flushWhenIdleScheduler=this._register(new Dt(()=>this.doFlushWhenIdle(),e.flushInterval))}static{this.DEFAULT_FLUSH_INTERVAL=60*1e3}onDidChangeValue(e,t,o){return H.filter(this._onDidChangeValue.event,n=>n.scope===e&&(t===void 0||n.key===t),o)}doFlushWhenIdle(){this.runFlushWhenIdle.value=aN(()=>{this.shouldFlushWhenIdle()&&this.flush(),this.flushWhenIdleScheduler.schedule()})}shouldFlushWhenIdle(){return!0}stopFlushWhenIdle(){Ue([this.runFlushWhenIdle,this.flushWhenIdleScheduler])}initialize(){return this.initializationPromise||(this.initializationPromise=(async()=>{sn("code/willInitStorage");try{await this.doInitialize()}finally{sn("code/didInitStorage")}this.flushWhenIdleScheduler.schedule()})()),this.initializationPromise}emitDidChangeValue(e,t){let{key:o,external:n}=t;if(o===LSt){switch(e){case-1:this._applicationKeyTargets=void 0;break;case 0:this._profileKeyTargets=void 0;break;case 1:this._workspaceKeyTargets=void 0;break}this._onDidChangeTarget.fire({scope:e})}else this._onDidChangeValue.fire({scope:e,key:o,target:this.getKeyTargets(e)[o],external:n})}emitWillSaveState(e){this._onWillSaveState.fire({reason:e})}get(e,t,o){return this.getStorage(t)?.get(e,o)}getBoolean(e,t,o){return this.getStorage(t)?.getBoolean(e,o)}getNumber(e,t,o){return this.getStorage(t)?.getNumber(e,o)}getObject(e,t,o){return this.getStorage(t)?.getObject(e,o)}storeAll(e,t){this.withPausedEmitters(()=>{for(let o of e)this.store(o.key,o.value,o.scope,o.target,t)})}store(e,t,o,n,r=!1){if(Jn(t)){this.remove(e,o,r);return}this.withPausedEmitters(()=>{this.updateKeyTarget(e,o,n),this.getStorage(o)?.set(e,t,r)})}remove(e,t,o=!1){this.withPausedEmitters(()=>{this.updateKeyTarget(e,t,void 0),this.getStorage(t)?.delete(e,o)})}withPausedEmitters(e){this._onDidChangeValue.pause(),this._onDidChangeTarget.pause();try{e()}finally{this._onDidChangeValue.resume(),this._onDidChangeTarget.resume()}}keys(e,t){let o=[],n=this.getKeyTargets(e);for(let r of Object.keys(n))n[r]===t&&o.push(r);return o}updateKeyTarget(e,t,o,n=!1){let r=this.getKeyTargets(t);typeof o=="number"?r[e]!==o&&(r[e]=o,this.getStorage(t)?.set(LSt,JSON.stringify(r),n)):typeof r[e]=="number"&&(delete r[e],this.getStorage(t)?.set(LSt,JSON.stringify(r),n))}get workspaceKeyTargets(){return this._workspaceKeyTargets||(this._workspaceKeyTargets=this.loadKeyTargets(1)),this._workspaceKeyTargets}get profileKeyTargets(){return this._profileKeyTargets||(this._profileKeyTargets=this.loadKeyTargets(0)),this._profileKeyTargets}get applicationKeyTargets(){return this._applicationKeyTargets||(this._applicationKeyTargets=this.loadKeyTargets(-1)),this._applicationKeyTargets}getKeyTargets(e){switch(e){case-1:return this.applicationKeyTargets;case 0:return this.profileKeyTargets;default:return this.workspaceKeyTargets}}loadKeyTargets(e){let t=this.getStorage(e);return t?r0o(t):Object.create(null)}isNew(e){return this.getBoolean(rii,e)===!0}async flush(e=0){this._onWillSaveState.fire({reason:e});let t=this.getStorage(-1),o=this.getStorage(0),n=this.getStorage(1);switch(e){case 0:await fn.settled([t?.whenFlushed()??Promise.resolve(),o?.whenFlushed()??Promise.resolve(),n?.whenFlushed()??Promise.resolve()]);break;case 1:await fn.settled([t?.flush(0)??Promise.resolve(),o?.flush(0)??Promise.resolve(),n?.flush(0)??Promise.resolve()]);break}}async log(){let e=this.getStorage(-1)?.items??new Map,t=this.getStorage(0)?.items??new Map,o=this.getStorage(1)?.items??new Map;return s0o(e,t,o,this.getLogDetails(-1)??"",this.getLogDetails(0)??"",this.getLogDetails(1)??"")}async optimize(e){return await this.flush(),this.getStorage(e)?.optimize()}async switch(e,t){return this.emitWillSaveState(0),ZN(e)?this.switchToProfile(e,t):this.switchToWorkspace(e,t)}canSwitchProfile(e,t){return!(e.id===t.id||iwe(t)&&iwe(e))}switchData(e,t,o){this.withPausedEmitters(()=>{let n=new Set;for(let[r,s]of e)n.add(r),t.get(r)!==s&&this.emitDidChangeValue(o,{key:r,external:!0});for(let[r]of t.items)n.has(r)||this.emitDidChangeValue(o,{key:r,external:!0})})}};function iwe(a){return a.isDefault||!!a.useDefaultFlags?.globalState}var RSt=class extends Rae{constructor(){super();this.applicationStorage=this._register(new XN(new ewe,{hint:1}));this.profileStorage=this._register(new XN(new ewe,{hint:1}));this.workspaceStorage=this._register(new XN(new ewe,{hint:1}));this._register(this.workspaceStorage.onDidChangeStorage(e=>this.emitDidChangeValue(1,e))),this._register(this.profileStorage.onDidChangeStorage(e=>this.emitDidChangeValue(0,e))),this._register(this.applicationStorage.onDidChangeStorage(e=>this.emitDidChangeValue(-1,e)))}getStorage(e){switch(e){case-1:return this.applicationStorage;case 0:return this.profileStorage;default:return this.workspaceStorage}}getLogDetails(e){switch(e){case-1:return"inMemory (application)";case 0:return"inMemory (profile)";default:return"inMemory (workspace)"}}async doInitialize(){}async switchToProfile(){}async switchToWorkspace(){}shouldFlushWhenIdle(){return!1}hasScope(e){return!1}};async function s0o(a,i,e,t,o,n){let r=v=>{try{return JSON.parse(v)}catch{return v}},s=new Map,l=new Map;a.forEach((v,b)=>{s.set(b,v),l.set(b,r(v))});let c=new Map,u=new Map;i.forEach((v,b)=>{c.set(b,v),u.set(b,r(v))});let p=new Map,h=new Map;e.forEach((v,b)=>{p.set(b,v),h.set(b,r(v))}),console.group(t!==o?`Storage: Application (path: ${t})`:`Storage: Application & Profile (path: ${t}, default profile)`);let g=[];if(s.forEach((v,b)=>{g.push({key:b,value:v})}),console.table(g),console.groupEnd(),console.log(l),t!==o){console.group(`Storage: Profile (path: ${o}, profile specific)`);let v=[];c.forEach((b,S)=>{v.push({key:S,value:b})}),console.table(v),console.groupEnd(),console.log(u)}console.group(`Storage: Workspace (path: ${n})`);let f=[];p.forEach((v,b)=>{f.push({key:b,value:v})}),console.table(f),console.groupEnd(),console.log(h)}function sii(a,i){let e={...i};for(let t in a){let o=a[t];e[t]=o!==void 0?wt(o):void 0}return e}var l_={keybindingLabelBackground:wt(i$i),keybindingLabelForeground:wt(o$i),keybindingLabelBorder:wt(n$i),keybindingLabelBottomBorder:wt(r$i),keybindingLabelShadow:wt(RN)};var Ko={buttonForeground:wt(YT),buttonSeparator:wt(vgt),buttonBackground:wt(MS),buttonHoverBackground:wt(B$),buttonSecondaryForeground:wt(Fse),buttonSecondaryBackground:wt(H$),buttonSecondaryHoverBackground:wt(Wse),buttonSecondaryBorder:wt(oIe),buttonBorder:wt(oIe)};var kx={progressBarBackground:wt(j2i)};var qg={inputActiveOptionBorder:wt(cW),inputActiveOptionForeground:wt(V$),inputActiveOptionBackground:wt(dW)},Iwr={activeForeground:wt(iIe),activeBackground:wt(jGi),activeBorder:wt(QGi),inactiveForeground:wt(YGi),inactiveBackground:wt(XGi),inactiveBorder:wt(JGi),inactiveHoverBackground:wt(ZGi)};var kf={checkboxBackground:wt(nIe),checkboxBorder:wt(bgt),checkboxForeground:wt(rIe),checkboxDisabledBackground:wt(e$i),checkboxDisabledForeground:wt(t$i)},C4i={dialogBackground:wt(gm),dialogForeground:wt(dL),dialogShadow:wt(RN),dialogBorder:wt(jT),errorIconForeground:wt(SGi),warningIconForeground:wt(IGi),infoIconForeground:wt(yGi),textLinkForeground:wt(WI)};var pl={inputBackground:wt(Gb),inputForeground:wt(pL),inputBorder:wt(Vy),inputValidationInfoBorder:wt(z$e),inputValidationInfoBackground:wt(zGi),inputValidationInfoForeground:wt(KGi),inputValidationWarningBorder:wt(K$e),inputValidationWarningBackground:wt(GGi),inputValidationWarningForeground:wt($Gi),inputValidationErrorBorder:wt(Nse),inputValidationErrorBackground:wt(ggt),inputValidationErrorForeground:wt(fgt)};function c_(a){return sii(a,pl)}var x4i={listFilterWidgetBackground:wt(AGi),listFilterWidgetOutline:wt(NGi),listFilterWidgetNoMatchesOutline:wt(OGi),listFilterWidgetShadow:wt(FGi),inputBoxStyles:pl,toggleStyles:qg},BS={badgeBackground:wt(rv),badgeForeground:wt(Yw),badgeBorder:wt(gi)};var f1={breadcrumbsBackground:wt(fGi),breadcrumbsForeground:wt(gGi),breadcrumbsHoverForeground:wt(zXt),breadcrumbsFocusForeground:wt(zXt),breadcrumbsFocusAndSelectionForeground:wt(vGi)};var n7={listBackground:void 0,listInactiveFocusForeground:void 0,listFocusBackground:wt(c9),listFocusForeground:wt(ZSe),listFocusOutline:wt(H$e),listActiveSelectionBackground:wt(Wy),listActiveSelectionForeground:wt(QT),listActiveSelectionIconForeground:wt(dgt),listFocusAndSelectionOutline:wt(_Gi),listFocusAndSelectionBackground:wt(Wy),listFocusAndSelectionForeground:wt(QT),listInactiveSelectionBackground:wt(xf),listInactiveSelectionIconForeground:wt(DGi),listInactiveSelectionForeground:wt(ugt),listInactiveFocusBackground:wt(pgt),listInactiveFocusOutline:wt(LGi),listHoverBackground:wt(Xk),listHoverForeground:wt(eIe),listDropOverBackground:wt(mgt),listDropBetweenBackground:wt(RGi),listSelectionOutline:wt(qs),listHoverOutline:wt(qs),treeIndentGuidesStroke:wt(tIe),treeInactiveIndentGuidesStroke:wt(BGi),treeStickyScrollBackground:void 0,treeStickyScrollBorder:void 0,treeStickyScrollShadow:wt(PU),tableColumnsBorder:wt(HGi),tableOddRowsBackgroundColor:wt(U$e)};function GI(a){return sii(a,n7)}var pE={selectBackground:wt(FU),selectListBackground:wt(qGi),selectForeground:wt(Ose),decoratorRightForeground:wt(Igt),selectBorder:wt(PN),focusBorder:wt(Ad),listFocusBackground:wt(VU),listInactiveSelectionIconForeground:wt(aIe),listFocusForeground:wt(WU),listFocusOutline:Ese(qs,Oe.transparent.toString()),listHoverBackground:wt(Xk),listHoverForeground:wt(eIe),listHoverOutline:wt(qs),selectListBorder:wt(DN),listBackground:void 0,listActiveSelectionBackground:void 0,listActiveSelectionForeground:void 0,listActiveSelectionIconForeground:void 0,listFocusAndSelectionBackground:void 0,listDropOverBackground:void 0,listDropBetweenBackground:void 0,listInactiveSelectionBackground:void 0,listInactiveSelectionForeground:void 0,listInactiveFocusBackground:void 0,listInactiveFocusOutline:void 0,listSelectionOutline:void 0,listFocusAndSelectionForeground:void 0,listFocusAndSelectionOutline:void 0,listInactiveFocusForeground:void 0,tableColumnsBorder:void 0,tableOddRowsBackgroundColor:void 0,treeIndentGuidesStroke:void 0,treeInactiveIndentGuidesStroke:void 0,treeStickyScrollBackground:void 0,treeStickyScrollBorder:void 0,treeStickyScrollShadow:void 0};function MSt(a){return sii(a,pE)}var PSt={shadowColor:wt(RN),borderColor:wt(s$i),foregroundColor:wt(a$i),backgroundColor:wt(l$i),selectionForegroundColor:wt(eIe),selectionBackgroundColor:wt(Xk),selectionBorderColor:wt(c$i),separatorColor:wt(d$i),scrollbarShadow:wt(PU),scrollbarSliderBackground:wt(o9),scrollbarSliderHoverBackground:wt(AU),scrollbarSliderActiveBackground:wt(NU)};var k4i=["#007acc","#005a9e","#0098ff","#4fc3f7","#64b5f6","#42a5f5"],Bje;function ASt(a){if(Bje)return;let i=a.getBoundingClientRect(),e=Me(a).document,t=_(".animation-overlay");return t.style.position="fixed",t.style.left=`${i.left}px`,t.style.top=`${i.top}px`,t.style.width=`${i.width}px`,t.style.height=`${i.height}px`,t.style.pointerEvents="none",t.style.overflow="visible",t.style.zIndex="10000",e.body.appendChild(t),Bje=t,{overlay:t,cx:i.width/2,cy:i.height/2}}function NSt(a){setTimeout(()=>{Bje&&(Bje.remove(),Bje=void 0)},a)}function OSt(a,i){let e=[],t=Math.max(i.scale?.length??0,i.rotate?.length??0,i.translateY?.length??0);if(t!==0){for(let o=0;o<t;o++){let n={offset:t===1?1:o/(t-1)},r="",s=i.scale?.[o];s!==void 0&&(r+=`scale(${s})`);let l=i.rotate?.[o];l!==void 0&&(r+=` rotate(${l}deg)`);let c=i.translateY?.[o];c!==void 0&&(r+=` translateY(${c}px)`),r&&(n.transform=r.trim()),e.push(n)}a.animate(e,{duration:i.duration??350,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"})}}function a0o(a){let i=ASt(a);if(!i)return;let{overlay:e,cx:t,cy:o}=i,n=a.getBoundingClientRect();OSt(a,{scale:[1,1.3,1],rotate:[0,-10,10,0],duration:350});let r=10;for(let l=0;l<r;l++){let c=3+l%3*1.5,u=l*36*Math.PI/180,p=35,h=.6+l%4*.1,g=_(".animation-particle");g.style.position="absolute",g.style.width=`${c}px`,g.style.height=`${c}px`,g.style.borderRadius="50%",g.style.backgroundColor=k4i[l%k4i.length],g.style.left=`${t-c/2}px`,g.style.top=`${o-c/2}px`,e.appendChild(g);let f=Math.cos(u)*p,v=Math.sin(u)*p;g.animate([{opacity:0,transform:"scale(0) translate(0, 0)"},{opacity:h,transform:`scale(1) translate(${f*.5}px, ${v*.5}px)`,offset:.3},{opacity:h,transform:`scale(1) translate(${f}px, ${v}px)`,offset:.7},{opacity:0,transform:`scale(0) translate(${f}px, ${v}px)`}],{duration:1100,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"})}let s=_(".animation-particle");s.style.position="absolute",s.style.left="0",s.style.top="0",s.style.width=`${n.width}px`,s.style.height=`${n.height}px`,s.style.borderRadius="50%",s.style.border="2px solid var(--vscode-focusBorder, #007acc)",s.style.boxSizing="border-box",e.appendChild(s),s.animate([{transform:"scale(1)",opacity:1},{transform:"scale(2)",opacity:0}],{duration:800,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"}),NSt(2e3)}function l0o(a,i){let e=ASt(a);if(!e)return;let{overlay:t,cx:o,cy:n}=e,r=a.getBoundingClientRect();OSt(a,{translateY:[0,-6,0],duration:350});let s=6;for(let c=0;c<s;c++){let u=12+c%3*2,p=_(".animation-particle");p.style.position="absolute",p.style.left=`${o}px`,p.style.top=`${n}px`,p.style.fontSize=`${u}px`,p.style.lineHeight="1",p.style.color="var(--vscode-focusBorder, #007acc)",p.classList.add(...q.asClassNameArray(i)),t.appendChild(p);let h=(Math.random()-.5)*50,g=-50-c%3*10,f=(Math.random()-.5)*20,v=(Math.random()-.5)*40;p.animate([{opacity:0,transform:`translate(-50%, -50%) scale(0) rotate(${f}deg)`},{opacity:1,transform:`translate(calc(-50% + ${h*.3}px), calc(-50% + ${g*.3}px)) scale(1) rotate(${(f+v)*.3}deg)`,offset:.3},{opacity:1,transform:`translate(calc(-50% + ${h*.7}px), calc(-50% + ${g*.7}px)) scale(1) rotate(${(f+v)*.7}deg)`,offset:.7},{opacity:0,transform:`translate(calc(-50% + ${h}px), calc(-50% + ${g}px)) scale(0.8) rotate(${v}deg)`}],{duration:800+c%3*200,delay:c*80,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"})}let l=_(".animation-particle");l.style.position="absolute",l.style.left="0",l.style.top="0",l.style.width=`${r.width}px`,l.style.height=`${r.height}px`,l.style.borderRadius="50%",l.style.border="2px solid var(--vscode-focusBorder, #007acc)",l.style.boxSizing="border-box",t.appendChild(l),l.animate([{transform:"scale(1)",opacity:1},{transform:"scale(2)",opacity:0}],{duration:500,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"}),NSt(2e3)}function c0o(a){let i=ASt(a);if(!i)return;let{overlay:e,cx:t,cy:o}=i,n=a.getBoundingClientRect();OSt(a,{scale:[1,1.1,1],rotate:[0,-12,0],duration:400});for(let s=0;s<2;s++){let l=_(".animation-particle");l.style.position="absolute",l.style.left="0",l.style.top="0",l.style.width=`${n.width}px`,l.style.height=`${n.height}px`,l.style.borderRadius="50%",l.style.border="2px solid var(--vscode-focusBorder, #007acc)",l.style.boxSizing="border-box",e.appendChild(l),l.animate([{transform:"scale(0.8)",opacity:0},{transform:"scale(0.8)",opacity:.6,offset:.01},{transform:"scale(2.5)",opacity:0}],{duration:800,delay:s*150,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"})}for(let s=0;s<6;s++){let l=s*60*Math.PI/180,c=30+s%2*10,u=3.5,p=_(".animation-particle");p.style.position="absolute",p.style.width=`${u}px`,p.style.height=`${u}px`,p.style.borderRadius="50%",p.style.backgroundColor="#0098ff",p.style.left=`${t-u/2}px`,p.style.top=`${o-u/2}px`,e.appendChild(p);let h=Math.cos(l)*c,g=Math.sin(l)*c;p.animate([{opacity:0,transform:"scale(0) translate(0, 0)"},{opacity:1,transform:`scale(1) translate(${h}px, ${g}px)`,offset:.5},{opacity:0,transform:`scale(0) translate(${h}px, ${g}px)`}],{duration:600,delay:100+s*50,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"})}let r=_(".animation-particle");r.style.position="absolute",r.style.left="0",r.style.top="0",r.style.width=`${n.width}px`,r.style.height=`${n.height}px`,r.style.borderRadius="50%",r.style.backgroundColor="var(--vscode-focusBorder, #007acc)",e.appendChild(r),r.animate([{transform:"scale(0.9)",opacity:0},{transform:"scale(0.9)",opacity:.5,offset:.01},{transform:"scale(1.5)",opacity:0}],{duration:500,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"}),NSt(2e3)}function d0o(a){let i=ASt(a);if(!i)return;let{overlay:e,cx:t,cy:o}=i;OSt(a,{scale:[1,1.15,1],duration:350});for(let n=0;n<8;n++){let l=(n*45+22.5)*Math.PI/180,c=14,u=30,p=_(".animation-particle");p.style.position="absolute",p.style.width="3px",p.style.height="3px",p.style.borderRadius="50%",p.style.backgroundColor="var(--vscode-editor-foreground, #ffffff)",p.style.left=`${t-3/2}px`,p.style.top=`${o-3/2}px`,e.appendChild(p);let h=Math.cos(l)*c,g=Math.sin(l)*c,f=Math.cos(l)*u,v=Math.sin(l)*u;p.animate([{opacity:0,transform:`scale(0) translate(${h}px, ${g}px)`},{opacity:.7,transform:`scale(1.2) translate(${(h+f)/2}px, ${(g+v)/2}px)`,offset:.25},{opacity:.7,transform:`scale(1) translate(${f*.8}px, ${v*.8}px)`,offset:.5},{opacity:.7*.5,transform:`scale(1) translate(${f}px, ${v}px)`,offset:.75},{opacity:0,transform:`scale(0.5) translate(${f}px, ${v}px)`}],{duration:1100,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"})}for(let n=0;n<8;n++){let r=n*45,s=_(".animation-particle");s.style.position="absolute",s.style.left=`${t}px`,s.style.top=`${o}px`,s.style.width="0",s.style.height="0",s.style.transform=`rotate(${r}deg)`,e.appendChild(s);let l=_(".animation-particle");l.style.position="absolute",l.style.width="2px",l.style.height="10px",l.style.backgroundColor="var(--vscode-focusBorder, #007acc)",l.style.left="-1px",l.style.top="-22px",l.style.transformOrigin="bottom center",s.appendChild(l),l.animate([{transform:"scale(1, 0)",opacity:.6},{transform:"scale(1, 1)",opacity:.6,offset:.2},{transform:"scale(1, 1)",opacity:.6,offset:.6},{transform:"scale(1, 1)",opacity:.6,offset:.8},{transform:"scale(0, 0.3)",opacity:0}],{duration:1200,delay:150,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"})}NSt(2e3)}function E4i(a,i,e){switch(i){case 1:a0o(a);break;case 2:e&&l0o(a,e);break;case 3:c0o(a);break;case 4:d0o(a);break}}var owe={WIDTH:400,WIDTH_WITH_VERTICAL_PANEL:600,HEIGHT:270};function T4i(a){return typeof a.parentId=="number"}function nwe(a){return!!a.workspaceUri}function _4i(a){return!!a.folderUri}function D4i(a){return!!a.fileUri}function HS(a,i){if(Gt)return!1;let e=eO(a,i),t=a.getValue("window");return t?.menuStyle==="native"?!(!it&&!e):t?.menuStyle==="custom"?!1:e}function Mae(a,i){return Gt?!1:it?!0:HS(a,i)}function Hje(a){let i=a.getValue("window.menuBarVisibility");return i==="default"||i==="compact"&&Mae(a)||it&&kr?"classic":i}function rwe(a,i){return!0}function eO(a,i){return i||(i=v1(a)),i==="native"}function v1(a){if(Gt)return"custom";let i=a.getValue("window");if(i){if(it&&i.nativeTabs===!0||it&&i.nativeFullScreen===!1)return"native";let o=i.titleBarStyle;if(o==="native"||o==="custom")return o}return"custom"}function Uje(a){if(Gt||it||v1(a)==="native")return"native";let e=a.getValue("window")?.controlsStyle;return e==="custom"||e==="hidden"?e:"native"}var swe=35;function aii(a){if(Gt||eO(a))return!1;if(!it){let i=Uje(a);if(i==="custom"||i==="hidden")return!1}return!0}function L4i(a=0){return 1.2**a}var FSt={width:1024,height:768};function Ef(a,i){let e={primary:[],secondary:[]};return R4i(a,e,i),e}function Uc(a,i){let e=[];return R4i(a,e,i),e}function R4i(a,i,e){let t=bf.getInstance(),o=t.keyStatus.altKey||(ri||Wn)&&t.keyStatus.shiftKey;M4i(a,i,o,e?n=>n===e:n=>n==="navigation")}function hl(a,i,e,t){let o={primary:[],secondary:[]};return Dq(a,o,i,e,t),o}function Vm(a,i,e,t){let o=[];return Dq(a,o,i,e,t),o}function Dq(a,i,e,t,o){M4i(a,i,!1,typeof e=="string"?r=>r===e:e,t,o)}function M4i(a,i,e,t=r=>r==="navigation",o=()=>!1,n=!1){let r,s;Array.isArray(i)?(r=i,s=i):(r=i.primary,s=i.secondary);let l=new Set;for(let[c,u]of a){let p;t(c)?(p=r,p.length>0&&n&&p.push(new li)):(p=s,p.length>0&&p.push(new li));for(let h of u){e&&(h=h instanceof Eo&&h.alt?h.alt:h);let g=p.push(h);h instanceof $l&&l.add({group:c,action:h,index:g-1})}}for(let{group:c,action:u,index:p}of l){let h=t(c)?r:s,g=u.actions;o(u,c,h.length)&&h.splice(p,1,...g)}}var ml=class extends Lr{constructor(e,t,o,n,r,s,l,c){super(void 0,e,{icon:!!(e.class||e.item.icon),label:!e.class&&!e.item.icon,draggable:t?.draggable,keybinding:t?.keybinding,hoverDelegate:t?.hoverDelegate,keybindingNotRenderedWithLabel:t?.keybindingNotRenderedWithLabel});this._options=t;this._keybindingService=o;this._notificationService=n;this._contextKeyService=r;this._themeService=s;this._contextMenuService=l;this._accessibilityService=c;this._wantsAltCommand=!1;this._itemClassDispose=this._register(new me);this._altKey=bf.getInstance()}get _menuItemAction(){return this._action}get _commandAction(){return this._wantsAltCommand&&this._menuItemAction.alt||this._menuItemAction}async onClick(e){if(e.preventDefault(),e.stopPropagation(),this._options?.onClickAnimation&&this.element&&!this._accessibilityService.isMotionReduced()){let t=this._menuItemAction.item.icon;E4i(this.element,this._options.onClickAnimation,q.isThemeIcon(t)?t:void 0)}try{await this.actionRunner.run(this._commandAction,this._context)}catch(t){this._notificationService.error(t)}}render(e){if(super.render(e),e.classList.add("menu-entry"),this.options.icon&&this._updateItemClass(this._menuItemAction.item),this._menuItemAction.alt){let t=!1,o=()=>{let n=!!this._menuItemAction.alt?.enabled&&(!this._accessibilityService.isMotionReduced()||t)&&(this._altKey.keyStatus.altKey||this._altKey.keyStatus.shiftKey&&t);n!==this._wantsAltCommand&&(this._wantsAltCommand=n,this.updateLabel(),this.updateTooltip(),this.updateClass())};this._register(this._altKey.event(o)),this._register(j(e,"mouseleave",n=>{t=!1,o()})),this._register(j(e,"mouseenter",n=>{t=!0,o()})),o()}}updateLabel(){this.options.label&&this.label&&(this.label.textContent=this._commandAction.label)}getTooltip(){let e=this._commandAction.tooltip||this._commandAction.label,t=this._keybindingService.appendKeybinding(e,this._commandAction.id,this._contextKeyService);if(!this._wantsAltCommand&&this._menuItemAction.alt?.enabled){let o=this._menuItemAction.alt.tooltip||this._menuItemAction.alt.label,n=this._keybindingService.appendKeybinding(o,this._menuItemAction.alt.id,this._contextKeyService);t=d(1806,null,t,YN.modifierLabels[zo].altKey,n)}return t}updateClass(){this.options.icon&&(this._commandAction!==this._menuItemAction?this._menuItemAction.alt&&this._updateItemClass(this._menuItemAction.alt.item):this._updateItemClass(this._menuItemAction.item))}_updateItemClass(e){this._itemClassDispose.value=void 0;let{element:t,label:o}=this;if(!t||!o)return;let n=this._commandAction.checked&&Jye(e.toggled)&&e.toggled.icon?e.toggled.icon:e.icon;if(n)if(q.isThemeIcon(n)){let r=q.asClassNameArray(n);o.classList.add(...r),this._itemClassDispose.value=Z(()=>{o.classList.remove(...r)})}else o.style.backgroundImage=Ip(this._themeService.getColorTheme().type)?Na(n.dark):Na(n.light),o.classList.add("icon"),this._itemClassDispose.value=hn(Z(()=>{o.style.backgroundImage="",o.classList.remove("icon")}),this._themeService.onDidColorThemeChange(()=>{this.updateClass()}))}};ml=I([m(2,_e),m(3,Ne),m(4,X),m(5,De),m(6,ze),m(7,Bi)],ml);var WSt=class a extends ml{render(i){this.options.label=!0,this.options.icon=!1,super.render(i),i.classList.add("text-only"),i.classList.toggle("use-comma",this._options?.useComma??!1)}updateLabel(){let i=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!i)return super.updateLabel();if(this.label){let e=a._symbolPrintEnter(i);this._options?.conversational?this.label.textContent=d(1805,null,this._action.label,e):this.label.textContent=d(1804,null,this._action.label,e)}}static _symbolPrintEnter(i){return i.getLabel()?.replace(/\benter\b/gi,"\u23CE").replace(/\bEscape\b/gi,"Esc")}},mE=class extends wp{constructor(e,t,o,n,r){let s={...t,menuAsChild:t?.menuAsChild??!1,classNames:t?.classNames??(q.isThemeIcon(e.item.icon)?q.asClassName(e.item.icon):void 0),keybindingProvider:t?.keybindingProvider??(l=>o.lookupKeybinding(l.id))};super(e,{getActions:()=>e.actions},n,s);this._keybindingService=o;this._contextMenuService=n;this._themeService=r}render(e){super.render(e),So(this.element),e.classList.add("menu-entry");let t=this._action,{icon:o}=t.item;if(o&&!q.isThemeIcon(o)){this.element.classList.add("icon");let n=()=>{this.element&&(this.element.style.backgroundImage=Ip(this._themeService.getColorTheme().type)?Na(o.dark):Na(o.light))};n(),this._register(this._themeService.onDidColorThemeChange(()=>{n()}))}}};mE=I([m(2,_e),m(3,ze),m(4,De)],mE);var zje=class extends oc{constructor(e,t,o,n,r,s,l,c){super(null,e);this._keybindingService=o;this._notificationService=n;this._contextMenuService=r;this._menuService=s;this._instaService=l;this._storageService=c;this._defaultActionDisposables=this._register(new P);this._container=null;this._primaryActionListener=this._register(new me);this._options=t,this._storageKey=`${e.item.submenu.id}_lastActionId`;let u,p=t?.togglePrimaryAction?c.get(this._storageKey,1):void 0;p&&(u=e.actions.find(g=>p===g.id)),u||(u=e.actions[0]),this._defaultAction=this._defaultActionDisposables.add(this._instaService.createInstance(ml,u,{keybinding:this._getDefaultActionKeybindingLabel(u)}));let h={keybindingProvider:g=>this._keybindingService.lookupKeybinding(g.id),...t,menuAsChild:t?.menuAsChild??!0,classNames:t?.classNames??["codicon","codicon-chevron-down"],actionRunner:t?.actionRunner??this._register(new as)};this._dropdown=this._register(new wp(e,e.actions,this._contextMenuService,h)),t?.togglePrimaryAction&&this.registerTogglePrimaryActionListener()}get onDidChangeDropdownVisibility(){return this._dropdown.onDidChangeVisibility}registerTogglePrimaryActionListener(){this._primaryActionListener.value=this._dropdown.actionRunner.onDidRun(e=>{e.action instanceof Eo&&this.update(e.action)})}update(e){this._options?.togglePrimaryAction&&this._storageService.store(this._storageKey,e.id,1,1),this._defaultActionDisposables.clear(),this._defaultAction=this._defaultActionDisposables.add(this._instaService.createInstance(ml,e,{keybinding:this._getDefaultActionKeybindingLabel(e)})),this._defaultAction.actionRunner=this._defaultActionDisposables.add(new class extends as{async runAction(t,o){await t.run(void 0)}}),this._container&&this._defaultAction.render(Sf(this._container,_(".action-container")))}_getDefaultActionKeybindingLabel(e){let t;if(this._options?.renderKeybindingWithDefaultActionLabel){let o=this._keybindingService.lookupKeybinding(e.id);o&&(t=`(${o.getLabel()})`)}return t}setActionContext(e){super.setActionContext(e),this._defaultAction.setActionContext(e),this._dropdown.setActionContext(e)}set actionRunner(e){super.actionRunner=e,this._defaultAction.actionRunner=e,this._options?.togglePrimaryAction||(this._dropdown.actionRunner=e),this._primaryActionListener.value&&this.registerTogglePrimaryActionListener()}get actionRunner(){return super.actionRunner}render(e){this._container=e,super.render(this._container),this._container.classList.add("monaco-dropdown-with-default");let t=_(".action-container");this._defaultAction.render(R(this._container,t)),this._register(j(t,re.KEY_DOWN,n=>{let r=new Ii(n);r.equals(17)&&(this._defaultAction.element.tabIndex=-1,this._dropdown.focus(),r.stopPropagation())}));let o=_(".dropdown-action-container");this._dropdown.render(R(this._container,o)),this._register(j(o,re.KEY_DOWN,n=>{let r=new Ii(n);r.equals(15)&&(this._defaultAction.element.tabIndex=0,this._dropdown.setFocusable(!1),this._defaultAction.element?.focus(),r.stopPropagation())}))}focus(e){e?this._dropdown.focus():(this._defaultAction.element.tabIndex=0,this._defaultAction.element.focus())}blur(){this._defaultAction.element.tabIndex=-1,this._dropdown.blur(),this._container.blur()}setFocusable(e){e?this._defaultAction.element.tabIndex=0:(this._defaultAction.element.tabIndex=-1,this._dropdown.setFocusable(!1))}};zje=I([m(2,_e),m(3,Ne),m(4,ze),m(5,qt),m(6,F),m(7,le)],zje);var Kje=class extends h1{constructor(i,e,t){super(null,i,i.actions.map(o=>o.id===li.ID?jN:{text:o.label,isDisabled:!o.enabled}),0,e,pE,{ariaLabel:i.tooltip||i.label,optionsAsChildren:!0,useCustomDrawn:!HS(t)}),this.select(Math.max(0,i.actions.findIndex(o=>o.checked)))}render(i){super.render(i),i.style.borderColor=wt(PN)}runAction(i,e){let t=this.action.actions[e];t&&this.actionRunner.run(t)}};Kje=I([m(1,_n),m(2,B)],Kje);function Ca(a,i,e){return i instanceof Eo?a.createInstance(ml,i,e):i instanceof Cc?i.item.isSelection?a.createInstance(Kje,i):i.item.isSplitButton?a.createInstance(zje,i,{...e,togglePrimaryAction:typeof i.item.isSplitButton!="boolean"?i.item.isSplitButton.togglePrimaryAction:!1}):a.createInstance(mE,i,e):void 0}var awe=class{constructor(i,e,t){this._commandService=i;this._keybindingService=e;this._hiddenStates=new b1(t)}createMenu(i,e,t){return new lwe(i,this._hiddenStates,{emitEventsForSubmenuChanges:!1,eventDebounceDelay:50,...t},this._commandService,this._keybindingService,e)}getMenuActions(i,e,t){let o=new lwe(i,this._hiddenStates,{emitEventsForSubmenuChanges:!1,eventDebounceDelay:50,...t},this._commandService,this._keybindingService,e),n=o.getActions(t);return o.dispose(),n}getMenuContexts(i){let e=new VSt(i,!1);return new Set([...e.structureContextKeys,...e.preconditionContextKeys,...e.toggledContextKeys])}resetHiddenStates(i){this._hiddenStates.reset(i)}};awe=I([m(0,ge),m(1,_e),m(2,le)],awe);var b1=class{constructor(i){this._storageService=i;this._disposables=new P;this._onDidChange=new E;this.onDidChange=this._onDidChange.event;this._ignoreChangeEvent=!1;this._hiddenByDefaultCache=new Map;try{let e=i.get(b1._key,0,"{}");this._data=JSON.parse(e)}catch{this._data=Object.create(null)}this._disposables.add(i.onDidChangeValue(0,b1._key,this._disposables)(()=>{if(!this._ignoreChangeEvent)try{let e=i.get(b1._key,0,"{}");this._data=JSON.parse(e)}catch(e){console.log("FAILED to read storage after UPDATE",e)}this._onDidChange.fire()}))}static{this._key="menu.hiddenCommands"}dispose(){this._onDidChange.dispose(),this._disposables.dispose()}_isHiddenByDefault(i,e){return this._hiddenByDefaultCache.get(`${i.id}/${e}`)??!1}setDefaultState(i,e,t){this._hiddenByDefaultCache.set(`${i.id}/${e}`,t)}isHidden(i,e){let t=this._isHiddenByDefault(i,e),o=this._data[i.id]?.includes(e)??!1;return t?!o:o}updateHidden(i,e,t){this._isHiddenByDefault(i,e)&&(t=!t);let n=this._data[i.id];if(t)n?n.indexOf(e)<0&&n.push(e):this._data[i.id]=[e];else if(n){let r=n.indexOf(e);r>=0&&rUi(n,r),n.length===0&&delete this._data[i.id]}this._persist()}reset(i){if(i===void 0)this._data=Object.create(null),this._persist();else{for(let{id:e}of i)this._data[e]&&delete this._data[e];this._persist()}}_persist(){try{this._ignoreChangeEvent=!0;let i=JSON.stringify(this._data);this._storageService.store(b1._key,i,0,0)}finally{this._ignoreChangeEvent=!1}}};b1=I([m(0,le)],b1);var VSt=class a{constructor(i,e){this._id=i;this._collectContextKeysForSubmenus=e;this._menuGroups=[];this._allMenuIds=new Set;this._structureContextKeys=new Set;this._preconditionContextKeys=new Set;this._toggledContextKeys=new Set;this.refresh()}get allMenuIds(){return this._allMenuIds}get structureContextKeys(){return this._structureContextKeys}get preconditionContextKeys(){return this._preconditionContextKeys}get toggledContextKeys(){return this._toggledContextKeys}refresh(){this._menuGroups.length=0,this._allMenuIds.clear(),this._structureContextKeys.clear(),this._preconditionContextKeys.clear(),this._toggledContextKeys.clear();let i=this._sort(fe.getMenuItems(this._id)),e;for(let t of i){let o=t.group||"";(!e||e[0]!==o)&&(e=[o,[]],this._menuGroups.push(e)),e[1].push(t),this._collectContextKeysAndSubmenuIds(t)}this._allMenuIds.add(this._id)}_sort(i){return i}_collectContextKeysAndSubmenuIds(i){if(a._fillInKbExprKeys(i.when,this._structureContextKeys),Kk(i)){if(i.command.precondition&&a._fillInKbExprKeys(i.command.precondition,this._preconditionContextKeys),i.command.toggled){let e=i.command.toggled.condition||i.command.toggled;a._fillInKbExprKeys(e,this._toggledContextKeys)}}else this._collectContextKeysForSubmenus&&(fe.getMenuItems(i.submenu).forEach(this._collectContextKeysAndSubmenuIds,this),this._allMenuIds.add(i.submenu))}static _fillInKbExprKeys(i,e){if(i)for(let t of i.keys())e.add(t)}},Lq=class extends VSt{constructor(e,t,o,n,r,s){super(e,o);this._hiddenStates=t;this._commandService=n;this._keybindingService=r;this._contextKeyService=s;this.refresh()}createActionGroups(e){let t=[];for(let o of this._menuGroups){let[n,r]=o,s;for(let l of r)if(this._contextKeyService.contextMatchesRules(l.when)){let c=Kk(l);c&&this._hiddenStates.setDefaultState(this._id,l.command.id,!!l.isHiddenByDefault);let u=u0o(this._id,c?l.command:l,this._hiddenStates);if(c){let p=Gje(this._commandService,this._keybindingService,l.command.id,l.when);(s??=[]).push(new Eo(l.command,l.alt,e,u,p,this._contextKeyService,this._commandService))}else{let p=new Lq(l.submenu,this._hiddenStates,this._collectContextKeysForSubmenus,this._commandService,this._keybindingService,this._contextKeyService).createActionGroups(e),h=li.join(...p.map(g=>g[1]));h.length>0&&(s??=[]).push(new Cc(l,u,h))}}s&&s.length>0&&t.push([n,s])}return t}_sort(e){return e.sort(Lq._compareMenuItems)}static _compareMenuItems(e,t){let o=e.group,n=t.group;if(o!==n){if(o){if(!n)return-1}else return 1;if(o==="navigation")return-1;if(n==="navigation")return 1;let l=o.localeCompare(n);if(l!==0)return l}let r=e.order||0,s=t.order||0;return r<s?-1:r>s?1:Lq._compareTitles(Kk(e)?e.command.title:e.title,Kk(t)?t.command.title:t.title)}static _compareTitles(e,t){let o=typeof e=="string"?e:e.original,n=typeof t=="string"?t:t.original;return o.localeCompare(n)}};Lq=I([m(3,ge),m(4,_e),m(5,X)],Lq);var lwe=class{constructor(i,e,t,o,n,r){this._disposables=new P;this._menuInfo=new Lq(i,e,t.emitEventsForSubmenuChanges,o,n,r);let s=new Dt(()=>{this._menuInfo.refresh(),this._onDidChange.fire({menu:this,isStructuralChange:!0,isEnablementChange:!0,isToggleChange:!0})},t.eventDebounceDelay);this._disposables.add(s),this._disposables.add(fe.onDidChangeMenu(p=>{for(let h of this._menuInfo.allMenuIds)if(p.has(h)){s.schedule();break}}));let l=this._disposables.add(new P),c=p=>{let h=!1,g=!1,f=!1;for(let v of p)if(h=h||v.isStructuralChange,g=g||v.isEnablementChange,f=f||v.isToggleChange,h&&g&&f)break;return{menu:this,isStructuralChange:h,isEnablementChange:g,isToggleChange:f}},u=()=>{l.add(r.onDidChangeContext(p=>{let h=p.affectsSome(this._menuInfo.structureContextKeys),g=p.affectsSome(this._menuInfo.preconditionContextKeys),f=p.affectsSome(this._menuInfo.toggledContextKeys);(h||g||f)&&this._onDidChange.fire({menu:this,isStructuralChange:h,isEnablementChange:g,isToggleChange:f})})),l.add(e.onDidChange(p=>{this._onDidChange.fire({menu:this,isStructuralChange:!0,isEnablementChange:!1,isToggleChange:!1})}))};this._onDidChange=new gbe({onWillAddFirstListener:u,onDidRemoveLastListener:l.clear.bind(l),delay:t.eventDebounceDelay,merge:c}),this.onDidChange=this._onDidChange.event}getActions(i){return this._menuInfo.createActionGroups(i)}dispose(){this._disposables.dispose(),this._onDidChange.dispose()}};lwe=I([m(3,ge),m(4,_e),m(5,X)],lwe);function u0o(a,i,e){let t=Zzi(i)?i.submenu.id:i.id,o=typeof i.title=="string"?i.title:i.title.value,n=pi({id:`hide/${a.id}/${t}`,label:d(1811,null,o),run(){e.updateHidden(a,t,!0)}}),r=pi({id:`toggle/${a.id}/${t}`,label:o,get checked(){return!e.isHidden(a,t)},run(){e.updateHidden(a,t,!!this.checked)}});return{hide:n,toggle:r,get isHidden(){return!r.checked}}}function Gje(a,i,e,t=void 0,o=!0){return pi({id:`configureKeybinding/${e}`,label:d(1810,null),enabled:o,run(){let r=!!!i.lookupKeybinding(e)&&t?t.serialize():void 0;a.executeCommand("workbench.action.openGlobalKeybindings",`@command:${e}`+(r?` +when:${r}`:""))}})}var Yy=ae("IActionViewItemService");var lii=class{constructor(){this._providers=new Map;this._onDidChange=new E;this.onDidChange=this._onDidChange.event}dispose(){this._onDidChange.dispose()}register(i,e,t,o){let n=this._makeKey(i,e);if(this._providers.has(n))throw new Error(`A provider for the command ${e} and menu ${i} is already registered.`);this._providers.set(n,t);let r=o?.(()=>{this._onDidChange.fire(i)});return Z(()=>{r?.dispose(),this._providers.delete(n)})}lookUp(i,e){return this._providers.get(this._makeKey(i,e))}_makeKey(i,e){return`${i.id}/${e instanceof D?e.id:e}`}};we(Yy,lii,1);var Ol=class extends Ju{constructor(e,t,o,n,r,s,l,c){super(e,r,{getKeyBinding:p=>s.lookupKeybinding(p.id)??void 0,...t,allowContextMenu:!0,skipTelemetry:typeof t?.telemetrySource=="string"});this._options=t;this._menuService=o;this._contextKeyService=n;this._contextMenuService=r;this._keybindingService=s;this._commandService=l;this._sessionDisposables=this._store.add(new P);let u=t?.telemetrySource;u&&this._store.add(this.actionBar.onDidRun(p=>c.publicLog2("workbenchActionExecuted",{id:p.action.id,from:u})))}setActions(e,t=[],o){this._sessionDisposables.clear();let n=e.slice(),r=t.slice(),s=[],l=0,c=[],u=!1;if(this._options?.hiddenItemStrategy!==-1)for(let p=0;p<n.length;p++){let h=n[p];!(h instanceof Eo)&&!(h instanceof Cc)||h.hideActions&&(s.push(h.hideActions.toggle),h.hideActions.toggle.checked&&l++,h.hideActions.isHidden&&(u=!0,n[p]=void 0,this._options?.hiddenItemStrategy!==0&&(c[p]=h)))}if(this._options?.overflowBehavior!==void 0){let p=Dut(new Set(this._options.overflowBehavior.exempted),ht.map(n,f=>f?.id)),h=this._options.overflowBehavior.maxItems-p.size,g=0;for(let f=0;f<n.length;f++){let v=n[f];v&&(g++,!p.has(v.id)&&g>=h&&(n[f]=void 0,c[f]=v))}}ZG(n),ZG(c),super.setActions(li.clean(n),li.join(c,r)),(s.length>0||n.length>0)&&this._sessionDisposables.add(j(this.getElement(),"contextmenu",p=>{let h=new yn(Me(this.getElement()),p),g=this.getItemAction(h.target);if(!g)return;h.preventDefault(),h.stopPropagation();let f=[];if(g instanceof Eo&&g.menuKeybinding)f.push(g.menuKeybinding);else if(!(g instanceof Cc||g instanceof Qye)){let b=!!this._keybindingService.lookupKeybinding(g.id);f.push(Gje(this._commandService,this._keybindingService,g.id,void 0,b))}if(s.length>0){let b=!1;if(l===1&&this._options?.hiddenItemStrategy===0){b=!0;for(let S=0;S<s.length;S++)if(s[S].checked){s[S]=pi({id:g.id,label:g.label,checked:!0,enabled:!1,run(){}});break}}if(!b&&(g instanceof Eo||g instanceof Cc)){if(!g.hideActions)return;f.push(g.hideActions.hide)}else f.push(pi({id:"label",label:d(1807,null),enabled:!1,run(){}}))}let v=li.join(f,s);this._options?.resetMenu&&!o&&(o=[this._options.resetMenu]),u&&o&&(v.push(new li),v.push(pi({id:"resetThisMenu",label:d(1808,null),run:()=>this._menuService.resetHiddenStates(o)}))),v.length!==0&&this._contextMenuService.showContextMenu({getAnchor:()=>h,getActions:()=>v,menuId:this._options?.contextMenu,menuActionOptions:{renderShortTitle:!0,...this._options?.menuOptions},skipTelemetry:typeof this._options?.telemetrySource=="string",contextKeyService:this._contextKeyService})}))}};Ol=I([m(2,qt),m(3,X),m(4,ze),m(5,_e),m(6,ge),m(7,Te)],Ol);var Ln=class extends Ol{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,{resetMenu:t,...o,actionViewItemProvider:(g,f)=>{let v=p.lookUp(t,g instanceof Cc?g.item.submenu.id:g.id);v||(v=o?.actionViewItemProvider);let b=v?.(g,f,h,Me(e).vscodeWindowId);return b||Ca(h,g,f)}},n,r,s,l,c,u);this._onDidChangeMenuItems=this._store.add(new E);this._container=e,this._menuOptions=o?.menuOptions,this._toolbarOptions=o?.toolbarOptions,this._menu=this._store.add(n.createMenu(t,r,{emitEventsForSubmenuChanges:!0,eventDebounceDelay:o?.eventDebounceDelay})),this._store.add(this._menu.onDidChange(()=>{this._updateToolbar(),this._onDidChangeMenuItems.fire(this)})),this._store.add(p.onDidChange(g=>{g===t&&this._updateToolbar()})),this._updateToolbar()}get onDidChangeMenuItems(){return this._onDidChangeMenuItems.event}_updateToolbar(){let{primary:e,secondary:t}=hl(this._menu.getActions(this._menuOptions),this._toolbarOptions?.primaryGroup,this._toolbarOptions?.shouldInlineSubmenu,this._toolbarOptions?.useSeparatorsInPrimaryActions);this._container.classList.toggle("has-no-actions",e.length===0&&t.length===0),super.setActions(e,t)}refresh(){this._updateToolbar()}setActions(){throw new ni("This toolbar is populated from a menu.")}};Ln=I([m(3,qt),m(4,X),m(5,ze),m(6,_e),m(7,ge),m(8,Te),m(9,Yy),m(10,F)],Ln);var tt=ae("hoverService"),mv=class extends C{constructor(e,t,o={},n,r){super();this.placement=e;this.hoverOptions=t;this.overrideOptions=o;this.configurationService=n;this.hoverService=r;this.lastHoverHideTime=0;this.timeLimit=200;this.hoverDisposables=this._register(new P);this._delay=this.configurationService.getValue("workbench.hover.delay"),this._register(this.configurationService.onDidChangeConfiguration(s=>{s.affectsConfiguration("workbench.hover.delay")&&(this._delay=this.configurationService.getValue("workbench.hover.delay"))}))}get delay(){return this.isInstantlyHovering()?0:this.hoverOptions?.dynamicDelay?e=>this.hoverOptions?.dynamicDelay?.(e)??this._delay:this._delay}showHover(e,t){let o=typeof this.overrideOptions=="function"?this.overrideOptions(e,t):this.overrideOptions;this.hoverDisposables.clear();let n=Ao(e.target)?[e.target]:e.target.targetElements;for(let s of n)this.hoverDisposables.add(Vo(s,"keydown",l=>{l.equals(9)&&this.hoverService.hideHover()}));let r=Ao(e.content)?void 0:typeof e.content=="string"?e.content.toString():e.content.value;return this.hoverService.showInstantHover({...e,...o,persistence:{hideOnKeyDown:!0,...o.persistence},id:r,appearance:{...e.appearance,compact:!0,skipFadeInAnimation:this.isInstantlyHovering(),...o.appearance}},t)}isInstantlyHovering(){return!!this.hoverOptions?.instantHover&&Date.now()-this.lastHoverHideTime<this.timeLimit}setInstantHoverTimeLimit(e){if(!this.hoverOptions?.instantHover)throw new Error("Instant hover is not enabled");this.timeLimit=e}onDidHideHover(){this.hoverDisposables.clear(),this.hoverOptions?.instantHover&&(this.lastHoverHideTime=Date.now())}};mv=I([m(3,B),m(4,tt)],mv);var US={showHover:function(){throw new Error("Native hover function not implemented.")},delay:0,showNativeHover:!0};var _L=class extends Q6{constructor(e){super();this._textModel=e}getValueOfRange(e){return this._textModel.getValueInRange(e)}getLineLength(e){return this._textModel.getLineLength(e)}get length(){let e=this._textModel.getLineCount(),t=this._textModel.getLineLength(e);return new Zl(e-1,t)}};var cwe=class extends as{constructor(e){super();this._getContext=e}runAction(e,t){let o=this._getContext();return super.runAction(e,o)}};var BSt=class extends C{constructor(e,t,o){super();this._editor=e;this._domNode=t;this.itemProvider=o;this.scrollTop=ui(this,this._editor.onDidScrollChange,s=>this._editor.getScrollTop()),this.isScrollTopZero=this.scrollTop.map(s=>s===0),this.modelAttached=ui(this,this._editor.onDidChangeModel,s=>this._editor.hasModel()),this.editorOnDidChangeViewZones=Nr("onDidChangeViewZones",this._editor.onDidChangeViewZones),this.editorOnDidContentSizeChange=Nr("onDidContentSizeChange",this._editor.onDidContentSizeChange),this.domNodeSizeChanged=Wc("domNodeSizeChanged"),this.views=this._register(new jt),this._domNode.className="gutter monaco-editor";let n=this._domNode.appendChild(bt("div.scroll-decoration",{role:"presentation",ariaHidden:"true",style:{width:"100%"}}).root),r=new ResizeObserver(()=>{Ui(s=>{this.domNodeSizeChanged.trigger(s)})});r.observe(this._domNode),this._register(Z(()=>r.disconnect())),this._register(he(s=>{n.className=this.isScrollTopZero.read(s)?"":"scroll-decoration"})),this._register(he(s=>this.render(s)))}dispose(){super.dispose(),Fi(this._domNode)}render(e){if(!this.modelAttached.read(e))return;this.domNodeSizeChanged.read(e),this.editorOnDidChangeViewZones.read(e),this.editorOnDidContentSizeChange.read(e);let t=this.scrollTop.read(e),o=this._editor.getVisibleRanges(),n=new Set(this.views.keys()),r=di.ofStartAndLength(0,this._domNode.clientHeight);if(!r.isEmpty)for(let s of o){let l=new ro(s.startLineNumber,s.endLineNumber+1),c=this.itemProvider.getIntersectingGutterItems(l,e);Ui(u=>{for(let p of c){if(!p.range.intersect(l))continue;n.delete(p.id);let h=this.views.get(p.id);if(h)h.item.set(p,u);else{let b=document.createElement("div");this._domNode.appendChild(b);let S=Le("item",p),y=this.itemProvider.createView(S,b);h=new cii(S,y,b),this.views.set(p.id,h)}let g=p.range.startLineNumber<=this._editor.getModel().getLineCount()?this._editor.getTopForLineNumber(p.range.startLineNumber,!0)-t:p.range.startLineNumber>1?this._editor.getBottomForLineNumber(p.range.startLineNumber-1,!1)-t:0,v=(p.range.endLineNumberExclusive===1?Math.max(g,this._editor.getTopForLineNumber(p.range.startLineNumber,!1)-t):Math.max(g,this._editor.getBottomForLineNumber(p.range.endLineNumberExclusive-1,!0)-t))-g;h.domNode.style.top=`${g}px`,h.domNode.style.height=`${v}px`,h.gutterItemView.layout(di.ofStartAndLength(g,v),r)}})}for(let s of n)this.views.deleteAndDispose(s)}},cii=class{constructor(i,e,t){this.item=i;this.gutterItemView=e;this.domNode=t}dispose(){this.gutterItemView.dispose(),this.domNode.remove()}};var dii=[],HSt=35,dwe=class extends C{constructor(e,t,o,n,r,s,l,c,u){super();this._diffModel=t;this._editors=o;this._options=n;this._sashLayout=r;this._boundarySashes=s;this._instantiationService=l;this._contextKeyService=c;this._menuService=u;this._menu=this._register(this._menuService.createMenu(D.DiffEditorHunkToolbar,this._contextKeyService)),this._actions=ui(this,this._menu.onDidChange,()=>this._menu.getActions()),this._hasActions=this._actions.map(h=>h.length>0),this._showSash=Ce(this,h=>this._options.renderSideBySide.read(h)&&this._hasActions.read(h)),this.width=Ce(this,h=>this._hasActions.read(h)?HSt:0),this.elements=bt("div.gutter@gutter",{style:{position:"absolute",height:"100%",width:HSt+"px"}},[]),this._currentDiff=Ce(this,h=>{let g=this._diffModel.read(h);if(!g)return;let f=g.diff.read(h)?.mappings,v=this._editors.modifiedCursor.read(h);if(v)return f?.find(b=>b.lineRangeMapping.modified.contains(v.lineNumber))}),this._selectedDiffs=Ce(this,h=>{let f=this._diffModel.read(h)?.diff.read(h);if(!f)return dii;let v=this._editors.modifiedSelections.read(h);if(v.every(w=>w.isEmpty()))return dii;let b=new PM(v.map(w=>ro.fromRangeInclusive(w))),y=f.mappings.filter(w=>w.lineRangeMapping.innerChanges&&b.intersects(w.lineRangeMapping.modified)).map(w=>({mapping:w,rangeMappings:w.lineRangeMapping.innerChanges.filter(k=>v.some(T=>z.areIntersecting(k.modifiedRange,T)))}));return y.length===0||y.every(w=>w.rangeMappings.length===0)?dii:y}),this._register(q5i(e,this.elements.root)),this._register(j(this.elements.root,"click",()=>{this._editors.modified.focus()})),this._register(UM(this.elements.root,{display:this._hasActions.map(h=>h?"block":"none")})),RI(this,h=>this._showSash.read(h)?new qye(e,this._sashLayout.dimensions,this._options.enableSplitViewResizing,this._boundarySashes,y$(this,f=>this._sashLayout.sashLeft.read(f)-HSt,(f,v)=>this._sashLayout.sashLeft.set(f+HSt,v)),()=>this._sashLayout.resetSash()):void 0).recomputeInitiallyAndOnChange(this._store);let p=Ce(this,h=>{let g=this._diffModel.read(h);if(!g)return[];let f=g.diff.read(h);if(!f)return[];let v=this._selectedDiffs.read(h);if(v.length>0){let S=wf.fromRangeMappings(v.flatMap(y=>y.rangeMappings));return[new USt(S,!0,D.DiffEditorSelectionToolbar,void 0,g.model.original.uri,g.model.modified.uri)]}let b=this._currentDiff.read(h);return f.mappings.map(S=>new USt(S.lineRangeMapping.withInnerChangesFromLineRanges(),S.lineRangeMapping===b?.lineRangeMapping,D.DiffEditorHunkToolbar,void 0,g.model.original.uri,g.model.modified.uri))});this._register(new BSt(this._editors.modified,this.elements.root,{getIntersectingGutterItems:(h,g)=>p.read(g),createView:(h,g)=>this._instantiationService.createInstance($je,h,g,this)})),this._register(j(this.elements.gutter,re.MOUSE_WHEEL,h=>{this._editors.modified.getOption(117).handleMouseWheel&&this._editors.modified.delegateScrollFromMouseWheelEvent(h)},{passive:!1}))}computeStagedValue(e){let t=e.innerChanges??[],o=new _L(this._editors.modifiedModel.get()),n=new _L(this._editors.original.getModel());return new bp(t.map(l=>l.toTextEdit(o))).apply(n)}layout(e){this.elements.gutter.style.left=e+"px"}};dwe=I([m(6,F),m(7,X),m(8,qt)],dwe);var USt=class{constructor(i,e,t,o,n,r){this.mapping=i;this.showAlways=e;this.menuId=t;this.rangeOverride=o;this.originalUri=n;this.modifiedUri=r}get id(){return this.mapping.modified.toString()}get range(){return this.rangeOverride??this.mapping.modified}},$je=class extends C{constructor(e,t,o,n){super();this._item=e;this._elements=bt("div.gutterItem",{style:{height:"20px",width:"34px"}},[bt("div.background@background",{},[]),bt("div.buttons@buttons",{},[])]),this._showAlways=this._item.map(this,s=>s.showAlways),this._menuId=this._item.map(this,s=>s.menuId),this._isSmall=Le(this,!1),this._lastItemRange=void 0,this._lastViewRange=void 0;let r=this._register(n.createInstance(mv,"element",{instantHover:!0},{position:{hoverPosition:1}}));this._register(wq(t,this._elements.root)),this._register(he(s=>{let l=this._showAlways.read(s);this._elements.root.classList.toggle("noTransition",!0),this._elements.root.classList.toggle("showAlways",l),setTimeout(()=>{this._elements.root.classList.toggle("noTransition",!1)},0)})),this._register(Ga((s,l)=>{this._elements.buttons.replaceChildren();let c=l.add(n.createInstance(Ln,this._elements.buttons,this._menuId.read(s),{orientation:1,hoverDelegate:r,toolbarOptions:{primaryGroup:u=>u.startsWith("primary")},overflowBehavior:{maxItems:this._isSmall.read(s)?1:3},hiddenItemStrategy:0,actionRunner:l.add(new cwe(()=>{let u=this._item.read(void 0),p=u.mapping;return{mapping:p,originalWithModifiedChanges:o.computeStagedValue(p),originalUri:u.originalUri,modifiedUri:u.modifiedUri}})),menuOptions:{shouldForwardArgs:!0}}));l.add(c.onDidChangeMenuItems(()=>{this._lastItemRange&&this.layout(this._lastItemRange,this._lastViewRange)}))}))}layout(e,t){this._lastItemRange=e,this._lastViewRange=t;let o=this._elements.buttons.clientHeight;this._isSmall.set(this._item.get().mapping.original.startLineNumber===1&&e.length<30,void 0),o=this._elements.buttons.clientHeight;let n=e.length/2-o/2,r=o,s=e.start+n,l=di.tryCreate(r,t.endExclusive-r-o),c=di.tryCreate(e.start+r,e.endExclusive-o-r);c&&l&&c.start<c.endExclusive&&(s=l.clip(s),s=c.clip(s)),this._elements.buttons.style.top=`${s-e.start}px`}};$je=I([m(3,F)],$je);var tO=class extends C{constructor(e,t,o,n){super();this._editors=e;this._diffModel=t;this._options=o;this._instantiationService=n;this._modifiedOutlineSource=RI(this,e=>{let t=this._editors.modifiedModel.read(e),o=tO._breadcrumbsSourceFactory.read(e);return!t||!o?void 0:o(t,this._instantiationService)});this._isUpdatingHiddenAreas=!1;this._register(this._editors.original.onDidChangeCursorPosition(c=>{if(c.reason===1)return;let u=this._diffModel.get();Ui(p=>{for(let h of this._editors.original.getSelections()||[])u?.ensureOriginalLineIsVisible(h.getStartPosition().lineNumber,0,p),u?.ensureOriginalLineIsVisible(h.getEndPosition().lineNumber,0,p)})})),this._register(this._editors.modified.onDidChangeCursorPosition(c=>{if(c.reason===1)return;let u=this._diffModel.get();Ui(p=>{for(let h of this._editors.modified.getSelections()||[])u?.ensureModifiedLineIsVisible(h.getStartPosition().lineNumber,0,p),u?.ensureModifiedLineIsVisible(h.getEndPosition().lineNumber,0,p)})}));let r=this._diffModel.map((c,u)=>{let p=c?.unchangedRegions.read(u)??[];return p.length===1&&p[0].modifiedLineNumber===1&&p[0].lineCount===this._editors.modifiedModel.read(u)?.getLineCount()?[]:p});this.viewZones=Ce(this,c=>{let u=this._modifiedOutlineSource.read(c);if(!u)return{origViewZones:[],modViewZones:[]};let p=[],h=[],g=this._options.renderSideBySide.read(c),f=this._options.compactMode.read(c),v=r.read(c);for(let b=0;b<v.length;b++){let S=v[b];if(!S.shouldHideControls(c)&&!(f&&(b===0||b===v.length-1)))if(f){{let y=Ce(this,k=>S.getHiddenOriginalRange(k).startLineNumber-1),w=new g1(y,12);p.push(w),c.store.add(new zSt(this._editors.original,w,S,!g))}{let y=Ce(this,k=>S.getHiddenModifiedRange(k).startLineNumber-1),w=new g1(y,12);h.push(w),c.store.add(new zSt(this._editors.modified,w,S))}}else{{let y=Ce(this,k=>S.getHiddenOriginalRange(k).startLineNumber-1),w=new g1(y,24);p.push(w),c.store.add(new KSt(this._editors.original,w,S,S.originalUnchangedRange,!g,u,k=>this._diffModel.get().ensureModifiedLineIsVisible(k,2,void 0),this._options))}{let y=Ce(this,k=>S.getHiddenModifiedRange(k).startLineNumber-1),w=new g1(y,24);h.push(w),c.store.add(new KSt(this._editors.modified,w,S,S.modifiedUnchangedRange,!1,u,k=>this._diffModel.get().ensureModifiedLineIsVisible(k,2,void 0),this._options))}}}return{origViewZones:p,modViewZones:h}});let s={description:"unchanged lines",className:"diff-unchanged-lines",isWholeLine:!0},l={description:"Fold Unchanged",glyphMarginHoverMessage:new xe(void 0,{isTrusted:!0,supportThemeIcons:!0}).appendMarkdown(d(238,null)),glyphMarginClassName:"fold-unchanged "+q.asClassName(M.fold),zIndex:10001};this._register(Wye(this._editors.original,Ce(this,c=>{let u=r.read(c),p=u.map(h=>({range:h.originalUnchangedRange.toInclusiveRange(),options:s}));for(let h of u)h.shouldHideControls(c)&&p.push({range:z.fromPositions(new Ie(h.originalLineNumber,1)),options:l});return p}))),this._register(Wye(this._editors.modified,Ce(this,c=>{let u=r.read(c),p=u.map(h=>({range:h.modifiedUnchangedRange.toInclusiveRange(),options:s}));for(let h of u)h.shouldHideControls(c)&&p.push({range:ro.ofLength(h.modifiedLineNumber,1).toInclusiveRange(),options:l});return p}))),this._register(he(c=>{let u=r.read(c);this._isUpdatingHiddenAreas=!0;try{this._editors.original.setHiddenAreas(u.map(p=>p.getHiddenOriginalRange(c).toInclusiveRange()).filter(mo)),this._editors.modified.setHiddenAreas(u.map(p=>p.getHiddenModifiedRange(c).toInclusiveRange()).filter(mo))}finally{this._isUpdatingHiddenAreas=!1}})),this._register(this._editors.modified.onMouseUp(c=>{if(!c.event.rightButton&&c.target.position&&c.target.element?.className.includes("fold-unchanged")){let u=c.target.position.lineNumber,p=this._diffModel.get();if(!p)return;let h=p.unchangedRegions.get().find(g=>g.modifiedUnchangedRange.contains(u));if(!h)return;h.collapseAll(void 0),c.event.stopPropagation(),c.event.preventDefault()}})),this._register(this._editors.original.onMouseUp(c=>{if(!c.event.rightButton&&c.target.position&&c.target.element?.className.includes("fold-unchanged")){let u=c.target.position.lineNumber,p=this._diffModel.get();if(!p)return;let h=p.unchangedRegions.get().find(g=>g.originalUnchangedRange.contains(u));if(!h)return;h.collapseAll(void 0),c.event.stopPropagation(),c.event.preventDefault()}}))}static{this._breadcrumbsSourceFactory=Le(this,()=>({dispose(){},getBreadcrumbItems(e,t){return[]},getAt:()=>[]}))}static setBreadcrumbsSourceFactory(e){this._breadcrumbsSourceFactory.set(e,void 0)}get isUpdatingHiddenAreas(){return this._isUpdatingHiddenAreas}};tO=I([m(3,F)],tO);var zSt=class extends xae{constructor(e,t,o,n=!1){let r=bt("div.diff-hidden-lines-widget");super(e,t,r.root);this._unchangedRegion=o;this._hide=n;this._nodes=bt("div.diff-hidden-lines-compact",[bt("div.line-left",[]),bt("div.text@text",[]),bt("div.line-right",[])]);r.root.appendChild(this._nodes.root),this._hide&&this._nodes.root.replaceChildren(),this._register(he(s=>{if(!this._hide){let l=this._unchangedRegion.getHiddenModifiedRange(s).length,c=d(239,null,l);this._nodes.text.innerText=c}}))}},KSt=class extends xae{constructor(e,t,o,n,r,s,l,c){let u=bt("div.diff-hidden-lines-widget");super(e,t,u.root);this._editor=e;this._unchangedRegion=o;this._unchangedRegionRange=n;this._hide=r;this._modifiedOutlineSource=s;this._revealModifiedHiddenLine=l;this._options=c;this._nodes=bt("div.diff-hidden-lines",[bt("div.top@top",{title:d(237,null)}),bt("div.center@content",{style:{display:"flex"}},[bt("div@first",{style:{display:"flex",justifyContent:"center",alignItems:"center",flexShrink:"0"}},[_("a",{title:d(240,null),role:"button",onclick:()=>{this._unchangedRegion.showAll(void 0)}},...Bn("$(unfold)"))]),bt("div@others",{style:{display:"flex",justifyContent:"center",alignItems:"center"}})]),bt("div.bottom@bottom",{title:d(235,null),role:"button"})]);u.root.appendChild(this._nodes.root),this._hide?Fi(this._nodes.first):this._register(UM(this._nodes.first,{width:os(this._editor).layoutInfoContentLeft})),this._register(he(h=>{let g=this._unchangedRegion.visibleLineCountTop.read(h)+this._unchangedRegion.visibleLineCountBottom.read(h)===this._unchangedRegion.lineCount;this._nodes.bottom.classList.toggle("canMoveTop",!g),this._nodes.bottom.classList.toggle("canMoveBottom",this._unchangedRegion.visibleLineCountBottom.read(h)>0),this._nodes.top.classList.toggle("canMoveTop",this._unchangedRegion.visibleLineCountTop.read(h)>0),this._nodes.top.classList.toggle("canMoveBottom",!g);let f=this._unchangedRegion.isDragged.read(h),v=this._editor.getDomNode();v&&(v.classList.toggle("draggingUnchangedRegion",!!f),f==="top"?(v.classList.toggle("canMoveTop",this._unchangedRegion.visibleLineCountTop.read(h)>0),v.classList.toggle("canMoveBottom",!g)):f==="bottom"?(v.classList.toggle("canMoveTop",!g),v.classList.toggle("canMoveBottom",this._unchangedRegion.visibleLineCountBottom.read(h)>0)):(v.classList.toggle("canMoveTop",!1),v.classList.toggle("canMoveBottom",!1)))}));let p=this._editor;this._register(j(this._nodes.top,"mousedown",h=>{if(h.button!==0)return;this._nodes.top.classList.toggle("dragging",!0),this._nodes.root.classList.toggle("dragging",!0),h.preventDefault();let g=h.clientY,f=!1,v=this._unchangedRegion.visibleLineCountTop.get();this._unchangedRegion.isDragged.set("top",void 0);let b=Me(this._nodes.top),S=j(b,"mousemove",w=>{let T=w.clientY-g;f=f||Math.abs(T)>2;let N=Math.round(T/p.getOption(75)),O=Math.max(0,Math.min(v+N,this._unchangedRegion.getMaxVisibleLineCountTop()));this._unchangedRegion.visibleLineCountTop.set(O,void 0)}),y=j(b,"mouseup",w=>{f||this._unchangedRegion.showMoreAbove(this._options.hideUnchangedRegionsRevealLineCount.get(),void 0),this._nodes.top.classList.toggle("dragging",!1),this._nodes.root.classList.toggle("dragging",!1),this._unchangedRegion.isDragged.set(void 0,void 0),S.dispose(),y.dispose()})})),this._register(j(this._nodes.bottom,"mousedown",h=>{if(h.button!==0)return;this._nodes.bottom.classList.toggle("dragging",!0),this._nodes.root.classList.toggle("dragging",!0),h.preventDefault();let g=h.clientY,f=!1,v=this._unchangedRegion.visibleLineCountBottom.get();this._unchangedRegion.isDragged.set("bottom",void 0);let b=Me(this._nodes.bottom),S=j(b,"mousemove",w=>{let T=w.clientY-g;f=f||Math.abs(T)>2;let N=Math.round(T/p.getOption(75)),O=Math.max(0,Math.min(v-N,this._unchangedRegion.getMaxVisibleLineCountBottom())),V=this._unchangedRegionRange.endLineNumberExclusive>p.getModel().getLineCount()?p.getContentHeight():p.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);this._unchangedRegion.visibleLineCountBottom.set(O,void 0);let U=this._unchangedRegionRange.endLineNumberExclusive>p.getModel().getLineCount()?p.getContentHeight():p.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);p.setScrollTop(p.getScrollTop()+(U-V))}),y=j(b,"mouseup",w=>{if(this._unchangedRegion.isDragged.set(void 0,void 0),!f){let k=p.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);this._unchangedRegion.showMoreBelow(this._options.hideUnchangedRegionsRevealLineCount.get(),void 0);let T=p.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);p.setScrollTop(p.getScrollTop()+(T-k))}this._nodes.bottom.classList.toggle("dragging",!1),this._nodes.root.classList.toggle("dragging",!1),S.dispose(),y.dispose()})})),this._register(he(h=>{let g=[];if(!this._hide){let f=o.getHiddenModifiedRange(h).length,v=d(239,null,f),b=_("span",{title:d(236,null)},v);b.addEventListener("dblclick",w=>{w.button===0&&(w.preventDefault(),this._unchangedRegion.showAll(void 0))}),g.push(b);let S=this._unchangedRegion.getHiddenModifiedRange(h),y=this._modifiedOutlineSource.getBreadcrumbItems(S,h);if(y.length>0){g.push(_("span",void 0,"\xA0\xA0|\xA0\xA0"));for(let w=0;w<y.length;w++){let k=y[w],T=sh.toIcon(k.kind),N=bt("div.breadcrumb-item",{style:{display:"flex",alignItems:"center"}},[Qo(T),"\xA0",k.name,...w===y.length-1?[]:[Qo(M.chevronRight)]]).root;g.push(N),N.onclick=()=>{this._revealModifiedHiddenLine(k.startLineNumber)}}}}Fi(this._nodes.others,...g)}))}};var uii=[],GSt=class extends C{constructor(e,t,o,n){super();this._editors=e;this._diffModel=t;this._options=o;this._widget=n;this._selectedDiffs=Ce(this,e=>{let o=this._diffModel.read(e)?.diff.read(e);if(!o)return uii;let n=this._editors.modifiedSelections.read(e);if(n.every(c=>c.isEmpty()))return uii;let r=new PM(n.map(c=>ro.fromRangeInclusive(c))),l=o.mappings.filter(c=>c.lineRangeMapping.innerChanges&&r.intersects(c.lineRangeMapping.modified)).map(c=>({mapping:c,rangeMappings:c.lineRangeMapping.innerChanges.filter(u=>n.some(p=>z.areIntersecting(u.modifiedRange,p)))}));return l.length===0||l.every(c=>c.rangeMappings.length===0)?uii:l});this._register(Ga((r,s)=>{if(!this._options.shouldRenderOldRevertArrows.read(r))return;let l=this._diffModel.read(r),c=l?.diff.read(r);if(!l||!c||l.movedTextToCompare.read(r))return;let u=[],p=this._selectedDiffs.read(r),h=new Set(p.map(g=>g.mapping));if(p.length>0){let g=this._editors.modifiedSelections.read(r),f=s.add(new $St(g[g.length-1].positionLineNumber,this._widget,p.flatMap(v=>v.rangeMappings),!0));this._editors.modified.addGlyphMarginWidget(f),u.push(f)}for(let g of c.mappings)if(!h.has(g)&&!g.lineRangeMapping.modified.isEmpty&&g.lineRangeMapping.innerChanges){let f=s.add(new $St(g.lineRangeMapping.modified.startLineNumber,this._widget,g.lineRangeMapping,!1));this._editors.modified.addGlyphMarginWidget(f),u.push(f)}s.add(Z(()=>{for(let g of u)this._editors.modified.removeGlyphMarginWidget(g)}))}))}},$St=class a extends C{constructor(e,t,o,n){super();this._lineNumber=e;this._widget=t;this._diffs=o;this._revertSelection=n;this._id=`revertButton${a.counter++}`,this._domNode=bt("div.revertButton",{title:this._revertSelection?d(246,null):d(245,null)},[Qo(M.arrowRight)]).root,this._register(j(this._domNode,re.MOUSE_DOWN,r=>{r.button!==2&&(r.stopPropagation(),r.preventDefault())})),this._register(j(this._domNode,re.MOUSE_UP,r=>{r.stopPropagation(),r.preventDefault()})),this._register(j(this._domNode,re.CLICK,r=>{this._diffs instanceof NI?this._widget.revert(this._diffs):this._widget.revertRangeMappings(this._diffs),r.stopPropagation(),r.preventDefault()}))}static{this.counter=0}getId(){return this._id}getDomNode(){return this._domNode}getPosition(){return{lane:3,range:{startColumn:1,startLineNumber:this._lineNumber,endColumn:1,endLineNumber:this._lineNumber},zIndex:10001}}};var Hu=class extends xSt{constructor(e,t,o,n,r,s,l,c){super();this._domElement=e;this._parentContextKeyService=n;this._parentInstantiationService=r;this._codeEditorService=s;this._accessibilitySignalService=l;this._editorProgressService=c;this.elements=bt("div.monaco-diff-editor.side-by-side",{style:{position:"relative",height:"100%"}},[bt("div.editor.original@original",{style:{position:"absolute",height:"100%"}}),bt("div.editor.modified@modified",{style:{position:"absolute",height:"100%"}}),bt("div.accessibleDiffViewer@accessibleDiffViewer",{style:{position:"absolute",height:"100%"}})]),this._diffModelSrc=this._register(X0(this,void 0)),this._diffModel=Ce(this,T=>this._diffModelSrc.read(T)?.object),this.onDidChangeModel=H.fromObservableLight(this._diffModel),this._contextKeyService=this._register(this._parentContextKeyService.createScoped(this._domElement)),this._instantiationService=this._register(this._parentInstantiationService.createChild(new Io([X,this._contextKeyService]))),this._boundarySashes=Le(this,void 0),this._accessibleDiffViewerShouldBeVisible=Le(this,!1),this._accessibleDiffViewerVisible=Ce(this,T=>this._options.onlyShowAccessibleDiffViewer.read(T)?!0:this._accessibleDiffViewerShouldBeVisible.read(T)),this._movedBlocksLinesPart=Le(this,void 0),this._layoutInfo=Ce(this,T=>{let N=this._rootSizeObserver.width.read(T),O=this._rootSizeObserver.height.read(T);this._rootSizeObserver.automaticLayout?this.elements.root.style.height="100%":this.elements.root.style.height=O+"px";let V=this._sash.read(T),U=this._gutter.read(T),G=U?.width.read(T)??0,$=this._overviewRulerPart.read(T)?.width??0,te,pe,de,se,Se;if(!!V){let Ee=V.sashLeft.read(T),He=this._movedBlocksLinesPart.read(T)?.width.read(T)??0;te=0,pe=Ee-G-He,Se=Ee-G,de=Ee,se=N-de-$}else{Se=0;let Ee=this._options.inlineViewHideOriginalLineNumbers.read(T);te=G,Ee?pe=0:pe=Math.max(5,this._editors.originalObs.layoutInfoDecorationsLeft.read(T)),de=G+pe,se=N-de-$}return this.elements.original.style.left=te+"px",this.elements.original.style.width=pe+"px",this._editors.original.layout({width:pe,height:O},!0),U?.layout(Se),this.elements.modified.style.left=de+"px",this.elements.modified.style.width=se+"px",this._editors.modified.layout({width:se,height:O},!0),{modifiedEditor:this._editors.modified.getLayoutInfo(),originalEditor:this._editors.original.getLayoutInfo()}}),this._diffValue=this._diffModel.map((T,N)=>T?.diff.read(N)),this.onDidUpdateDiff=H.fromObservableLight(this._diffValue),this._codeEditorService.willCreateDiffEditor(),this._contextKeyService.createKey("isInDiffEditor",!0),this._domElement.appendChild(this.elements.root),this._register(Z(()=>this.elements.root.remove())),this._rootSizeObserver=this._register(new Fye(this.elements.root,t.dimension)),this._rootSizeObserver.setAutomaticLayout(t.automaticLayout??!1),this._options=this._instantiationService.createInstance(Z9,t),this._register(he(T=>{this._options.setWidth(this._rootSizeObserver.width.read(T))})),this._contextKeyService.createKey(ue.isEmbeddedDiffEditor.key,!1),this._register(tc(ue.isEmbeddedDiffEditor,this._contextKeyService,T=>this._options.isInEmbeddedEditor.read(T))),this._register(tc(ue.comparingMovedCode,this._contextKeyService,T=>!!this._diffModel.read(T)?.movedTextToCompare.read(T))),this._register(tc(ue.diffEditorRenderSideBySideInlineBreakpointReached,this._contextKeyService,T=>this._options.couldShowInlineViewBecauseOfSize.read(T))),this._register(tc(ue.diffEditorInlineMode,this._contextKeyService,T=>!this._options.renderSideBySide.read(T))),this._register(tc(ue.hasChanges,this._contextKeyService,T=>(this._diffModel.read(T)?.diff.read(T)?.mappings.length??0)>0)),this._editors=this._register(this._instantiationService.createInstance(Gye,this.elements.original,this.elements.modified,this._options,o,(T,N,O,V)=>this._createInnerEditor(T,N,O,V))),this._register(tc(ue.diffEditorOriginalWritable,this._contextKeyService,T=>this._options.originalEditable.read(T))),this._register(tc(ue.diffEditorModifiedWritable,this._contextKeyService,T=>!this._options.readOnly.read(T))),this._register(tc(ue.diffEditorOriginalUri,this._contextKeyService,T=>this._diffModel.read(T)?.model.original.uri.toString()??"")),this._register(tc(ue.diffEditorModifiedUri,this._contextKeyService,T=>this._diffModel.read(T)?.model.modified.uri.toString()??"")),this._overviewRulerPart=RI(this,T=>this._options.renderOverviewRuler.read(T)?this._instantiationService.createInstance(Cx(zI,T),this._editors,this.elements.root,this._diffModel,this._rootSizeObserver.width,this._rootSizeObserver.height,this._layoutInfo.map(N=>N.modifiedEditor)):void 0).recomputeInitiallyAndOnChange(this._store);let u={height:this._rootSizeObserver.height,width:this._rootSizeObserver.width.map((T,N)=>T-(this._overviewRulerPart.read(N)?.width??0))};this._sashLayout=new CSt(this._options,u),this._sash=RI(this,T=>{let N=this._options.renderSideBySide.read(T);return this.elements.root.classList.toggle("side-by-side",N),N?new qye(this.elements.root,u,this._options.enableSplitViewResizing,this._boundarySashes,this._sashLayout.sashLeft,()=>this._sashLayout.resetSash()):void 0}).recomputeInitiallyAndOnChange(this._store);let p=RI(this,T=>this._instantiationService.createInstance(Cx(tO,T),this._editors,this._diffModel,this._options)).recomputeInitiallyAndOnChange(this._store);RI(this,T=>this._instantiationService.createInstance(Cx(wSt,T),this._editors,this._diffModel,this._options,this)).recomputeInitiallyAndOnChange(this._store);let h=new Set,g=new Set,f=!1,v=RI(this,T=>this._instantiationService.createInstance(Cx(Kye,T),Me(this._domElement),this._editors,this._diffModel,this._options,this,()=>f||p.read(void 0).isUpdatingHiddenAreas,h,g)).recomputeInitiallyAndOnChange(this._store),b=Ce(this,T=>{let N=v.read(T).viewZones.read(T).orig,O=p.read(T).viewZones.read(T).origViewZones;return N.concat(O)}),S=Ce(this,T=>{let N=v.read(T).viewZones.read(T).mod,O=p.read(T).viewZones.read(T).modViewZones;return N.concat(O)});this._register(Vye(this._editors.original,b,T=>{f=T},h));let y;this._register(Vye(this._editors.modified,S,T=>{f=T,f?y=tC.capture(this._editors.modified):(y?.restore(this._editors.modified),y=void 0)},g)),this._accessibleDiffViewer=RI(this,T=>this._instantiationService.createInstance(Cx(QN,T),this.elements.accessibleDiffViewer,this._accessibleDiffViewerVisible,(N,O)=>this._accessibleDiffViewerShouldBeVisible.set(N,O),this._options.onlyShowAccessibleDiffViewer.map(N=>!N),this._rootSizeObserver.width,this._rootSizeObserver.height,this._diffModel.map((N,O)=>N?.diff.read(O)?.mappings.map(V=>V.lineRangeMapping)),new bSt(this._editors))).recomputeInitiallyAndOnChange(this._store);let w=this._accessibleDiffViewerVisible.map(T=>T?"hidden":"visible");this._register(UM(this.elements.modified,{visibility:w})),this._register(UM(this.elements.original,{visibility:w})),this._createDiffEditorContributions(),this._codeEditorService.addDiffEditor(this),this._register(Z(()=>{this._codeEditorService.removeDiffEditor(this)})),this._gutter=RI(this,T=>this._options.shouldRenderGutterMenu.read(T)?this._instantiationService.createInstance(Cx(dwe,T),this.elements.root,this._diffModel,this._editors,this._options,this._sashLayout,this._boundarySashes):void 0),this._register(EM(this._layoutInfo)),RI(this,T=>new(Cx(J9,T))(this.elements.root,this._diffModel,this._layoutInfo.map(N=>N.originalEditor),this._layoutInfo.map(N=>N.modifiedEditor),this._editors)).recomputeInitiallyAndOnChange(this._store,T=>{this._movedBlocksLinesPart.set(T,void 0)}),this._register(H.runAndSubscribe(this._editors.modified.onDidChangeCursorPosition,T=>this._handleCursorPositionChange(T,!0))),this._register(H.runAndSubscribe(this._editors.original.onDidChangeCursorPosition,T=>this._handleCursorPositionChange(T,!1)));let k=this._diffModel.map(this,(T,N)=>{if(T)return T.diff.read(N)===void 0&&!T.isDiffUpToDate.read(N)});this._register(Ga((T,N)=>{if(k.read(T)===!0){let O=this._editorProgressService.show(!0,1e3);N.add(Z(()=>O.done()))}})),this._register(Ga((T,N)=>{N.add(new(Cx(GSt,T))(this._editors,this._diffModel,this._options,this))})),this._register(Ga((T,N)=>{let O=this._diffModel.read(T);if(O)for(let V of[O.model.original,O.model.modified])N.add(V.onWillDispose(U=>{mt(new ni("TextModel got disposed before DiffEditorWidget model got reset")),this.setModel(null)}))})),this._register(he(T=>{this._options.setModel(this._diffModel.read(T))}))}static{this.ENTIRE_DIFF_OVERVIEW_WIDTH=zI.ENTIRE_DIFF_OVERVIEW_WIDTH}get onDidContentSizeChange(){return this._editors.onDidContentSizeChange}get collapseUnchangedRegions(){return this._options.hideUnchangedRegions.get()}getViewWidth(){return this._rootSizeObserver.width.get()}getContentHeight(){return this._editors.modified.getContentHeight()}_createInnerEditor(e,t,o,n){return e.createInstance(jr,t,o,n)}_createDiffEditorContributions(){let e=aa.getDiffEditorContributions();for(let t of e)try{this._register(this._instantiationService.createInstance(t.ctor,this))}catch(o){mt(o)}}get _targetEditor(){return this._editors.modified}getEditorType(){return P$.IDiffEditor}onVisible(){this._editors.original.onVisible(),this._editors.modified.onVisible()}onHide(){this._editors.original.onHide(),this._editors.modified.onHide()}layout(e){this._rootSizeObserver.observe(e)}hasTextFocus(){return this._editors.original.hasTextFocus()||this._editors.modified.hasTextFocus()}saveViewState(){let e=this._editors.original.saveViewState(),t=this._editors.modified.saveViewState();return{original:e,modified:t,modelState:this._diffModel.get()?.serializeState()}}restoreViewState(e){if(e&&e.original&&e.modified){let t=e;this._editors.original.restoreViewState(t.original),this._editors.modified.restoreViewState(t.modified),t.modelState&&this._diffModel.get()?.restoreSerializedState(t.modelState)}}handleInitialized(){this._editors.original.handleInitialized(),this._editors.modified.handleInitialized()}createViewModel(e){return this._instantiationService.createInstance(Y9,e,this._options)}getModel(){return this._diffModel.get()?.model??null}setModel(e){let t=e?"model"in e?CW.create(e).createNewRef(this):CW.create(this.createViewModel(e),this):null;this.setDiffModel(t)}setDiffModel(e,t){let o=this._diffModel.get();!e&&o&&this._accessibleDiffViewer.get().close(),this._diffModel.get()!==e?.object&&dN(t,n=>{let r=e?.object;ui.batchEventsGlobally(n,()=>{this._editors.original.setModel(r?r.model.original:null),this._editors.modified.setModel(r?r.model.modified:null)});let s=this._diffModelSrc.get()?.createNewRef(this);this._diffModelSrc.set(e?.createNewRef(this),n),setTimeout(()=>{s?.dispose()},0)})}updateOptions(e){this._options.updateOptions(e)}getDomNode(){return this.elements.root}getContainerDomNode(){return this._domElement}getOriginalEditor(){return this._editors.original}getModifiedEditor(){return this._editors.modified}setBoundarySashes(e){this._boundarySashes.set(e,void 0)}get ignoreTrimWhitespace(){return this._options.ignoreTrimWhitespace.get()}get maxComputationTime(){return this._options.maxComputationTimeMs.get()}get renderSideBySide(){return this._options.renderSideBySide.get()}getLineChanges(){let e=this._diffModel.get()?.diff.get();return e?pii(e):null}getDiffComputationResult(){let e=this._diffModel.get()?.diff.get();return e?{changes:this.getLineChanges(),changes2:e.mappings.map(t=>t.lineRangeMapping),identical:e.identical,quitEarly:e.quitEarly}:null}revert(e){let t=this._diffModel.get();!t||!t.isDiffUpToDate.get()||(this._editors.modified.pushUndoStop(),this._editors.modified.executeEdits("diffEditor",[{range:e.modified.toExclusiveRange(),text:t.model.original.getValueInRange(e.original.toExclusiveRange())}]),this._editors.modified.pushUndoStop())}revertRangeMappings(e){let t=this._diffModel.get();if(!t||!t.isDiffUpToDate.get())return;let o=e.map(n=>({range:n.modifiedRange,text:t.model.original.getValueInRange(n.originalRange)}));this._editors.modified.pushUndoStop(),this._editors.modified.executeEdits("diffEditor",o),this._editors.modified.pushUndoStop()}revertFocusedRangeMappings(){let e=this._diffModel.get();if(!e||!e.isDiffUpToDate.get())return;let t=this._diffModel.get()?.diff.get()?.mappings;if(!t||t.length===0)return;let o=this._editors.modified;if(!o.hasTextFocus())return;let n=o.getPosition().lineNumber,r=o.getSelection(),s=ro.fromRange(r||new z(n,0,n,0)),l=t.filter(c=>c.lineRangeMapping.modified.intersect(s));o.pushUndoStop(),o.executeEdits("diffEditor",l.map(c=>({range:c.lineRangeMapping.modified.toExclusiveRange(),text:e.model.original.getValueInRange(c.lineRangeMapping.original.toExclusiveRange())}))),o.pushUndoStop()}_goTo(e){this._editors.modified.setPosition(new Ie(e.lineRangeMapping.modified.startLineNumber,1)),this._editors.modified.revealRangeInCenter(e.lineRangeMapping.modified.toExclusiveRange())}goToDiff(e){let t=this._diffModel.get()?.diff.get()?.mappings;if(!t||t.length===0)return;let o=this._editors.modified.getPosition().lineNumber,n;e==="next"?this._editors.modified.getModel().getLineCount()===o?n=t[0]:n=t.find(s=>s.lineRangeMapping.modified.startLineNumber>o)??t[0]:n=ju(t,r=>r.lineRangeMapping.modified.startLineNumber<o)??t[t.length-1],this._goTo(n),n.lineRangeMapping.modified.isEmpty?this._accessibilitySignalService.playSignal($o.diffLineDeleted,{source:"diffEditor.goToDiff"}):n.lineRangeMapping.original.isEmpty?this._accessibilitySignalService.playSignal($o.diffLineInserted,{source:"diffEditor.goToDiff"}):n&&this._accessibilitySignalService.playSignal($o.diffLineModified,{source:"diffEditor.goToDiff"})}revealFirstDiff(){let e=this._diffModel.get();e&&this.waitForDiff().then(()=>{let t=e.diff.get()?.mappings;!t||t.length===0||this._goTo(t[0])})}accessibleDiffViewerNext(){this._accessibleDiffViewer.get().next()}accessibleDiffViewerPrev(){this._accessibleDiffViewer.get().prev()}async waitForDiff(){let e=this._diffModel.get();e&&await e.waitForDiff()}mapToOtherSide(){let e=this._editors.modified.hasWidgetFocus(),t=e?this._editors.modified:this._editors.original,o=e?this._editors.original:this._editors.modified,n,r=t.getSelection();if(r){let s=this._diffModel.get()?.diff.get()?.mappings.map(l=>e?l.lineRangeMapping.flip():l.lineRangeMapping);if(s){let l=Bti(r.getStartPosition(),s),c=Bti(r.getEndPosition(),s);n=z.plusRange(l,c)}}return{destination:o,destinationSelection:n}}switchSide(){let{destination:e,destinationSelection:t}=this.mapToOtherSide();e.focus(),t&&e.setSelection(t)}exitCompareMove(){let e=this._diffModel.get();e&&e.movedTextToCompare.set(void 0,void 0)}collapseAllUnchangedRegions(){let e=this._diffModel.get()?.unchangedRegions.get();e&&Ui(t=>{for(let o of e)o.collapseAll(t)})}showAllUnchangedRegions(){let e=this._diffModel.get()?.unchangedRegions.get();e&&Ui(t=>{for(let o of e)o.showAll(t)})}_handleCursorPositionChange(e,t){if(e?.reason===3){let o=this._diffModel.get()?.diff.get()?.mappings.find(n=>t?n.lineRangeMapping.modified.contains(e.position.lineNumber):n.lineRangeMapping.original.contains(e.position.lineNumber));o?.lineRangeMapping.modified.isEmpty?this._accessibilitySignalService.playSignal($o.diffLineDeleted,{source:"diffEditor.cursorPositionChanged"}):o?.lineRangeMapping.original.isEmpty?this._accessibilitySignalService.playSignal($o.diffLineInserted,{source:"diffEditor.cursorPositionChanged"}):o&&this._accessibilitySignalService.playSignal($o.diffLineModified,{source:"diffEditor.cursorPositionChanged"})}}};Hu=I([m(3,X),m(4,F),m(5,Kt),m(6,tr),m(7,rd)],Hu);function pii(a){return a.mappings.map(i=>{let e=i.lineRangeMapping,t,o,n,r,s=e.innerChanges;return e.original.isEmpty?(t=e.original.startLineNumber-1,o=0,s=void 0):(t=e.original.startLineNumber,o=e.original.endLineNumberExclusive-1),e.modified.isEmpty?(n=e.modified.startLineNumber-1,r=0,s=void 0):(n=e.modified.startLineNumber,r=e.modified.endLineNumberExclusive-1),{originalStartLineNumber:t,originalEndLineNumber:o,modifiedStartLineNumber:n,modifiedEndLineNumber:r,charChanges:s?.map(l=>({originalStartLineNumber:l.originalRange.startLineNumber,originalStartColumn:l.originalRange.startColumn,originalEndLineNumber:l.originalRange.endLineNumber,originalEndColumn:l.originalRange.endColumn,modifiedStartLineNumber:l.modifiedRange.startLineNumber,modifiedStartColumn:l.modifiedRange.startColumn,modifiedEndLineNumber:l.modifiedRange.endLineNumber,modifiedEndColumn:l.modifiedRange.endColumn}))}})}var qSt=class extends K{constructor(){super({id:"diffEditor.toggleCollapseUnchangedRegions",title:L(205,"Toggle Collapse Unchanged Regions"),icon:M.map,toggled:x.has("config.diffEditor.hideUnchangedRegions.enabled"),precondition:x.has("isInDiffEditor"),menu:{when:x.has("isInDiffEditor"),id:D.EditorTitle,order:22,group:"navigation"}})}run(i,...e){let t=i.get(B),o=!t.getValue("diffEditor.hideUnchangedRegions.enabled");t.updateValue("diffEditor.hideUnchangedRegions.enabled",o)}},qje=class extends K{constructor(){super({id:"diffEditor.toggleShowMovedCodeBlocks",title:L(206,"Toggle Show Moved Code Blocks"),precondition:x.has("isInDiffEditor")})}run(i,...e){let t=i.get(B),o=!t.getValue("diffEditor.experimental.showMoves");t.updateValue("diffEditor.experimental.showMoves",o)}},jje=class extends K{constructor(){super({id:"diffEditor.toggleUseInlineViewWhenSpaceIsLimited",title:L(207,"Toggle Use Inline View When Space Is Limited"),precondition:x.has("isInDiffEditor")})}run(i,...e){let t=i.get(B),o=!t.getValue("diffEditor.useInlineViewWhenSpaceIsLimited");t.updateValue("diffEditor.useInlineViewWhenSpaceIsLimited",o)}},Qje=L(198,"Diff Editor"),jSt=class extends wl{constructor(){super({id:"diffEditor.switchSide",title:L(204,"Switch Side"),icon:M.arrowSwap,precondition:x.has("isInDiffEditor"),f1:!0,category:Qje})}runEditorCommand(i,e,t){let o=Aae(i);if(o instanceof Hu){if(t&&t.dryRun)return{destinationSelection:o.mapToOtherSide().destinationSelection};o.switchSide()}}},QSt=class extends wl{constructor(){super({id:"diffEditor.exitCompareMove",title:L(201,"Exit Compare Move"),icon:M.close,precondition:ue.comparingMovedCode,f1:!1,category:Qje,keybinding:{weight:1e4,primary:9}})}runEditorCommand(i,e,...t){let o=Aae(i);o instanceof Hu&&o.exitCompareMove()}},YSt=class extends wl{constructor(){super({id:"diffEditor.collapseAllUnchangedRegions",title:L(197,"Collapse All Unchanged Regions"),icon:M.fold,precondition:x.has("isInDiffEditor"),f1:!0,category:Qje})}runEditorCommand(i,e,...t){let o=Aae(i);o instanceof Hu&&o.collapseAllUnchangedRegions()}},XSt=class extends wl{constructor(){super({id:"diffEditor.showAllUnchangedRegions",title:L(203,"Show All Unchanged Regions"),icon:M.unfold,precondition:x.has("isInDiffEditor"),f1:!0,category:Qje})}runEditorCommand(i,e,...t){let o=Aae(i);o instanceof Hu&&o.showAllUnchangedRegions()}},uwe=class extends K{constructor(){super({id:"diffEditor.revert",title:L(202,"Revert"),f1:!0,category:Qje,precondition:x.has("isInDiffEditor")})}run(i,e){return e?this.runViaToolbarContext(i,e):this.runViaCursorOrSelection(i)}runViaCursorOrSelection(i){let e=Aae(i);e instanceof Hu&&e.revertFocusedRangeMappings()}runViaToolbarContext(i,e){let t=p0o(i,e.originalUri,e.modifiedUri);t instanceof Hu&&t.revertRangeMappings(e.mapping.innerChanges??[])}},P4i=L(196,"Accessible Diff Viewer"),S1=class a extends K{static{this.id="editor.action.accessibleDiffViewer.next"}constructor(){super({id:a.id,title:L(199,"Go to Next Difference"),category:P4i,precondition:x.has("isInDiffEditor"),keybinding:{primary:65,weight:100},f1:!0})}run(i){Aae(i)?.accessibleDiffViewerNext()}},Pae=class a extends K{static{this.id="editor.action.accessibleDiffViewer.prev"}constructor(){super({id:a.id,title:L(200,"Go to Previous Difference"),category:P4i,precondition:x.has("isInDiffEditor"),keybinding:{primary:1089,weight:100},f1:!0})}run(i){Aae(i)?.accessibleDiffViewerPrev()}};function p0o(a,i,e){return a.get(Kt).listDiffEditors().find(n=>{let r=n.getModifiedEditor(),s=n.getOriginalEditor();return r&&r.getModel()?.uri.toString()===e.toString()&&s&&s.getModel()?.uri.toString()===i.toString()})||null}function Aae(a){let e=a.get(Kt).listDiffEditors(),t=Pn();if(t){for(let o of e)if(o.getContainerDomNode().contains(t))return o}return null}function JSt(a,i){if(!i.getOption(70))return null;let e=a.get(Kt);for(let t of e.listDiffEditors()){let o=t.getOriginalEditor(),n=t.getModifiedEditor();if(o===i||n===i)return t}return null}W(qSt);W(qje);W(jje);fe.appendMenuItem(D.EditorTitle,{command:{id:new jje().desc.id,title:d(234,null),toggled:x.has("config.diffEditor.useInlineViewWhenSpaceIsLimited"),precondition:x.has("isInDiffEditor")},order:11,group:"1_diff",when:x.and(ue.diffEditorRenderSideBySideInlineBreakpointReached,x.has("isInDiffEditor"))});fe.appendMenuItem(D.EditorTitle,{command:{id:new qje().desc.id,title:d(233,null),icon:M.move,toggled:eW.create("config.diffEditor.experimental.showMoves",!0),precondition:x.has("isInDiffEditor")},order:10,group:"1_diff",when:x.has("isInDiffEditor")});W(uwe);for(let a of[{icon:M.arrowRight,key:ue.diffEditorInlineMode.toNegated()},{icon:M.discard,key:ue.diffEditorInlineMode}])fe.appendMenuItem(D.DiffEditorHunkToolbar,{command:{id:new uwe().desc.id,title:d(231,null),icon:a.icon},when:x.and(ue.diffEditorModifiedWritable,a.key),order:5,group:"primary"}),fe.appendMenuItem(D.DiffEditorSelectionToolbar,{command:{id:new uwe().desc.id,title:d(232,null),icon:a.icon},when:x.and(ue.diffEditorModifiedWritable,a.key),order:5,group:"primary"});W(jSt);W(QSt);W(YSt);W(XSt);fe.appendMenuItem(D.EditorTitle,{command:{id:S1.id,title:d(230,null),precondition:x.has("isInDiffEditor")},order:10,group:"2_diff",when:x.and(ue.accessibleDiffViewerVisible.negate(),x.has("isInDiffEditor"))});qe.registerCommandAlias("editor.action.diffReview.next",S1.id);W(S1);qe.registerCommandAlias("editor.action.diffReview.prev",Pae.id);W(Pae);var ZSt=new Q("selectionAnchorSet",!1),iO=class{constructor(i,e){this.editor=i;this.selectionAnchorSetContextKey=ZSt.bindTo(e),this.modelChangeListener=i.onDidChangeModel(()=>this.selectionAnchorSetContextKey.reset())}static{this.ID="editor.contrib.selectionAnchorController"}static get(i){return i.getContribution(iO.ID)}setSelectionAnchor(){if(this.editor.hasModel()){let i=this.editor.getPosition();this.editor.changeDecorations(e=>{this.decorationId&&e.removeDecoration(this.decorationId),this.decorationId=e.addDecoration(Yt.fromPositions(i,i),{description:"selection-anchor",stickiness:1,hoverMessage:new xe().appendText(d(965,null)),className:"selection-anchor"})}),this.selectionAnchorSetContextKey.set(!!this.decorationId),Jo(d(961,null,i.lineNumber,i.column))}}goToSelectionAnchor(){if(this.editor.hasModel()&&this.decorationId){let i=this.editor.getModel().getDecorationRange(this.decorationId);i&&this.editor.setPosition(i.getStartPosition())}}selectFromAnchorToCursor(){if(this.editor.hasModel()&&this.decorationId){let i=this.editor.getModel().getDecorationRange(this.decorationId);if(i){let e=this.editor.getPosition();this.editor.setSelection(Yt.fromPositions(i.getStartPosition(),e)),this.cancelSelectionAnchor()}}}cancelSelectionAnchor(){if(this.decorationId){let i=this.decorationId;this.editor.changeDecorations(e=>{e.removeDecoration(i),this.decorationId=void 0}),this.selectionAnchorSetContextKey.set(!1)}}dispose(){this.cancelSelectionAnchor(),this.modelChangeListener.dispose()}};iO=I([m(1,X)],iO);var mii=class extends xi{constructor(){super({id:"editor.action.setSelectionAnchor",label:L(966,"Set Selection Anchor"),precondition:void 0,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2080),weight:100}})}async run(i,e){iO.get(e)?.setSelectionAnchor()}},hii=class extends xi{constructor(){super({id:"editor.action.goToSelectionAnchor",label:L(963,"Go to Selection Anchor"),precondition:ZSt})}async run(i,e){iO.get(e)?.goToSelectionAnchor()}},gii=class extends xi{constructor(){super({id:"editor.action.selectFromAnchorToCursor",label:L(964,"Select from Anchor to Cursor"),precondition:ZSt,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2089),weight:100}})}async run(i,e){iO.get(e)?.selectFromAnchorToCursor()}},fii=class extends xi{constructor(){super({id:"editor.action.cancelSelectionAnchor",label:L(962,"Cancel Selection Anchor"),precondition:ZSt,kbOpts:{kbExpr:ue.editorTextFocus,primary:9,weight:100}})}async run(i,e){iO.get(e)?.cancelSelectionAnchor()}};go(iO.ID,iO,4);Jt(mii);Jt(hii);Jt(gii);Jt(fii);var m0o=J("editorOverviewRuler.bracketMatchForeground","#A0A0A0",d(968,null)),vii=class extends xi{constructor(){super({id:"editor.action.jumpToBracket",label:L(969,"Go to Bracket"),precondition:void 0,kbOpts:{kbExpr:ue.editorTextFocus,primary:3165,weight:100}})}run(i,e){I1.get(e)?.jumpToBracket()}},bii=class extends xi{constructor(){super({id:"editor.action.selectToBracket",label:L(971,"Select to Bracket"),precondition:void 0,metadata:{description:L(972,"Select the text inside and including the brackets or curly braces"),args:[{name:"args",schema:{type:"object",properties:{selectBrackets:{type:"boolean",default:!0}}}}]}})}run(i,e,t){let o=!0;t&&t.selectBrackets===!1&&(o=!1),I1.get(e)?.selectToBracket(o)}},Sii=class extends xi{constructor(){super({id:"editor.action.removeBrackets",label:L(970,"Remove Brackets"),precondition:void 0,kbOpts:{kbExpr:ue.editorTextFocus,primary:2561,weight:100},canTriggerInlineEdits:!0})}run(i,e){I1.get(e)?.removeBrackets(this.id)}},Iii=class{constructor(i,e,t){this.position=i,this.brackets=e,this.options=t}},I1=class a extends C{static{this.ID="editor.contrib.bracketMatchingController"}static get(i){return i.getContribution(a.ID)}constructor(i){super(),this._editor=i,this._lastBracketsData=[],this._lastVersionId=0,this._decorations=this._editor.createDecorationsCollection(),this._updateBracketsSoon=this._register(new Dt(()=>this._updateBrackets(),50)),this._matchBrackets=this._editor.getOption(80),this._updateBracketsSoon.schedule(),this._register(i.onDidChangeCursorPosition(e=>{this._matchBrackets!=="never"&&this._updateBracketsSoon.schedule()})),this._register(i.onDidChangeModelContent(e=>{this._updateBracketsSoon.schedule()})),this._register(i.onDidChangeModel(e=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()})),this._register(i.onDidChangeModelLanguageConfiguration(e=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()})),this._register(i.onDidChangeConfiguration(e=>{e.hasChanged(80)&&(this._matchBrackets=this._editor.getOption(80),this._decorations.clear(),this._lastBracketsData=[],this._lastVersionId=0,this._updateBracketsSoon.schedule())})),this._register(i.onDidBlurEditorWidget(()=>{this._updateBracketsSoon.schedule()})),this._register(i.onDidFocusEditorWidget(()=>{this._updateBracketsSoon.schedule()}))}jumpToBracket(){if(!this._editor.hasModel())return;let i=this._editor.getModel(),e=this._editor.getSelections().map(t=>{let o=t.getStartPosition(),n=i.bracketPairs.matchBracket(o),r=null;if(n)n[0].containsPosition(o)&&!n[1].containsPosition(o)?r=n[1].getStartPosition():n[1].containsPosition(o)&&(r=n[0].getStartPosition());else{let s=i.bracketPairs.findEnclosingBrackets(o);if(s)r=s[1].getStartPosition();else{let l=i.bracketPairs.findNextBracket(o);l&&l.range&&(r=l.range.getStartPosition())}}return r?new Yt(r.lineNumber,r.column,r.lineNumber,r.column):new Yt(o.lineNumber,o.column,o.lineNumber,o.column)});this._editor.setSelections(e),this._editor.revealRange(e[0])}selectToBracket(i){if(!this._editor.hasModel())return;let e=this._editor.getModel(),t=[];this._editor.getSelections().forEach(o=>{let n=o.getStartPosition(),r=e.bracketPairs.matchBracket(n);if(!r&&(r=e.bracketPairs.findEnclosingBrackets(n),!r)){let c=e.bracketPairs.findNextBracket(n);c&&c.range&&(r=e.bracketPairs.matchBracket(c.range.getStartPosition()))}let s=null,l=null;if(r){r.sort(z.compareRangesUsingStarts);let[c,u]=r;if(s=i?c.getStartPosition():c.getEndPosition(),l=i?u.getEndPosition():u.getStartPosition(),u.containsPosition(n)){let p=s;s=l,l=p}}s&&l&&t.push(new Yt(s.lineNumber,s.column,l.lineNumber,l.column))}),t.length>0&&(this._editor.setSelections(t),this._editor.revealRange(t[0]))}removeBrackets(i){if(!this._editor.hasModel())return;let e=this._editor.getModel();this._editor.getSelections().forEach(t=>{let o=t.getPosition(),n=e.bracketPairs.matchBracket(o);n||(n=e.bracketPairs.findEnclosingBrackets(o)),n&&(this._editor.pushUndoStop(),this._editor.executeEdits(i,[{range:n[0],text:""},{range:n[1],text:""}]),this._editor.pushUndoStop())})}static{this._DECORATION_OPTIONS_WITH_OVERVIEW_RULER=po.register({description:"bracket-match-overview",stickiness:1,className:"bracket-match",inlineClassName:"bracket-match-inline",overviewRuler:{color:Ss(m0o),position:2}})}static{this._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER=po.register({description:"bracket-match-no-overview",stickiness:1,className:"bracket-match",inlineClassName:"bracket-match-inline"})}_updateBrackets(){if(this._matchBrackets==="never")return;this._recomputeBrackets();let i=[],e=0;for(let t of this._lastBracketsData){let o=t.brackets;o&&(i[e++]={range:o[0],options:t.options},i[e++]={range:o[1],options:t.options})}this._decorations.set(i)}_recomputeBrackets(){if(!this._editor.hasModel()||!this._editor.hasWidgetFocus()){this._lastBracketsData=[],this._lastVersionId=0;return}let i=this._editor.getSelections();if(i.length>100){this._lastBracketsData=[],this._lastVersionId=0;return}let e=this._editor.getModel(),t=e.getVersionId(),o=[];this._lastVersionId===t&&(o=this._lastBracketsData);let n=[],r=0;for(let p=0,h=i.length;p<h;p++){let g=i[p];g.isEmpty()&&(n[r++]=g.getStartPosition())}n.length>1&&n.sort(Ie.compare);let s=[],l=0,c=0,u=o.length;for(let p=0,h=n.length;p<h;p++){let g=n[p];for(;c<u&&o[c].position.isBefore(g);)c++;if(c<u&&o[c].position.equals(g))s[l++]=o[c];else{let f=e.bracketPairs.matchBracket(g,20),v=a._DECORATION_OPTIONS_WITH_OVERVIEW_RULER;!f&&this._matchBrackets==="always"&&(f=e.bracketPairs.findEnclosingBrackets(g,20),v=a._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER),s[l++]=new Iii(g,f,v)}}this._lastBracketsData=s,this._lastVersionId=t}};go(I1.ID,I1,1);Jt(bii);Jt(vii);Jt(Sii);fe.appendMenuItem(D.MenubarGoMenu,{group:"5_infile_nav",command:{id:"editor.action.jumpToBracket",title:d(967,null)},order:2});is((a,i)=>{let e=a.getColor(dqi);e&&i.addRule(`.monaco-editor .bracket-match-inline { color: ${e} !important; }`)});var eIt=class{constructor(i,e){this._selection=i,this._isMovingLeft=e}getEditOperations(i,e){if(this._selection.startLineNumber!==this._selection.endLineNumber||this._selection.isEmpty())return;let t=this._selection.startLineNumber,o=this._selection.startColumn,n=this._selection.endColumn;if(!(this._isMovingLeft&&o===1)&&!(!this._isMovingLeft&&n===i.getLineMaxColumn(t)))if(this._isMovingLeft){let r=new z(t,o-1,t,o),s=i.getValueInRange(r);e.addEditOperation(r,null),e.addEditOperation(new z(t,n,t,n),s)}else{let r=new z(t,n,t,n+1),s=i.getValueInRange(r);e.addEditOperation(r,null),e.addEditOperation(new z(t,o,t,o),s)}}computeCursorState(i,e){return this._isMovingLeft?new Yt(this._selection.startLineNumber,this._selection.startColumn-1,this._selection.endLineNumber,this._selection.endColumn-1):new Yt(this._selection.startLineNumber,this._selection.startColumn+1,this._selection.endLineNumber,this._selection.endColumn+1)}};var tIt=class extends xi{constructor(i,e){super(e),this.left=i}run(i,e){if(!e.hasModel())return;let t=[],o=e.getSelections();for(let n of o)t.push(new eIt(n,this.left));e.pushUndoStop(),e.executeCommands(this.id,t),e.pushUndoStop()}},yii=class extends tIt{constructor(){super(!0,{id:"editor.action.moveCarretLeftAction",label:L(973,"Move Selected Text Left"),precondition:ue.writable})}},wii=class extends tIt{constructor(){super(!1,{id:"editor.action.moveCarretRightAction",label:L(974,"Move Selected Text Right"),precondition:ue.writable})}};Jt(yii);Jt(wii);var Cii=class extends xi{constructor(){super({id:"editor.action.transposeLetters",label:L(975,"Transpose Letters"),precondition:ue.writable,kbOpts:{kbExpr:ue.textInputFocus,primary:0,mac:{primary:306},weight:100}})}run(i,e){if(!e.hasModel())return;let t=e.getModel(),o=[],n=e.getSelections();for(let r of n){if(!r.isEmpty())continue;let s=r.startLineNumber,l=r.startColumn,c=t.getLineMaxColumn(s);if(s===1&&(l===1||l===2&&c===2))continue;let u=l===c?r.getPosition():pu.rightPosition(t,r.getPosition().lineNumber,r.getPosition().column),p=pu.leftPosition(t,u),h=pu.leftPosition(t,p),g=t.getValueInRange(z.fromPositions(h,p)),f=t.getValueInRange(z.fromPositions(p,u)),v=z.fromPositions(h,u);o.push(new Wh(v,f+g))}o.length>0&&(e.pushUndoStop(),e.executeCommands(this.id,o),e.pushUndoStop())}};Jt(Cii);var Is=class a{constructor(i){this.value=i}static{this.sep="."}static{this.None=new a("@@none@@")}static{this.Empty=new a("")}equals(i){return this.value===i.value}contains(i){return this.equals(i)||this.value===""||i.value.startsWith(this.value+a.sep)}intersects(i){return this.contains(i)||i.contains(this)}append(...i){return new a((this.value?[this.value,...i]:i).join(a.sep))}};var A4i={ctrlCmd:!1,alt:!1};var Yje=class{constructor(i){this.options=i}getItemLabel(i){return i.label}getItemDescription(i){if(!this.options?.skipDescription)return i.description}getItemPath(i){if(!this.options?.skipPath)return i.resource?.scheme===Y.file?i.resource.fsPath:i.resource?.path}},r7=new Yje,Ge=ae("quickInputService");var ma=ae("IWorkspaceEditService"),s7=class{constructor(i){this.metadata=i}static convert(i){return i.edits.map(e=>{if(ja.is(e))return ja.lift(e);if(tu.is(e))return tu.lift(e);throw new Error("Unsupported edit")})}},ja=class a extends s7{constructor(e,t,o=void 0,n){super(n);this.resource=e;this.textEdit=t;this.versionId=o}static is(e){return e instanceof a?!0:yi(e)&&A.isUri(e.resource)&&yi(e.textEdit)}static lift(e){return e instanceof a?e:new a(e.resource,e.textEdit,e.versionId,e.metadata)}},tu=class a extends s7{constructor(e,t,o={},n){super(n);this.oldResource=e;this.newResource=t;this.options=o}static is(e){return e instanceof a?!0:yi(e)&&(!!e.newResource||!!e.oldResource)}static lift(e){return e instanceof a?e:new a(e.oldResource,e.newResource,e.options,e.metadata)}};var xii=ae("IEditorCancelService"),N4i=new Q("cancellableOperation",!1,d(1094,null));we(xii,class{constructor(){this._tokens=new WeakMap}add(a,i){let e=this._tokens.get(a);e||(e=a.invokeWithinContext(o=>{let n=N4i.bindTo(o.get(X)),r=new Vs;return{key:n,tokens:r}}),this._tokens.set(a,e));let t;return e.key.set(!0),t=e.tokens.push(i),()=>{t&&(t(),e.key.set(!e.tokens.isEmpty()),t=void 0)}}cancel(a){let i=this._tokens.get(a);if(!i)return;let e=i.tokens.pop();e&&(e.cancel(),i.key.set(!i.tokens.isEmpty()))}},1);var iIt=class extends $e{constructor(e,t){super(t);this.editor=e;this._unregister=e.invokeWithinContext(o=>o.get(xii).add(e,this))}dispose(){this._unregister(),super.dispose()}};qi(new class extends xc{constructor(){super({id:"editor.cancelOperation",kbOpts:{weight:100,primary:9},precondition:N4i})}runEditorCommand(a,i){a.get(xii).cancel(i)}});var y1=class a{constructor(i,e){if(this.flags=e,(this.flags&1)!==0){let t=i.getModel();this.modelVersionId=t?id("{0}#{1}",t.uri.toString(),t.getVersionId()):null}else this.modelVersionId=null;(this.flags&4)!==0?this.position=i.getPosition():this.position=null,(this.flags&2)!==0?this.selection=i.getSelection():this.selection=null,(this.flags&8)!==0?(this.scrollLeft=i.getScrollLeft(),this.scrollTop=i.getScrollTop()):(this.scrollLeft=-1,this.scrollTop=-1)}_equals(i){if(!(i instanceof a))return!1;let e=i;return!(this.modelVersionId!==e.modelVersionId||this.scrollLeft!==e.scrollLeft||this.scrollTop!==e.scrollTop||!this.position&&e.position||this.position&&!e.position||this.position&&e.position&&!this.position.equals(e.position)||!this.selection&&e.selection||this.selection&&!e.selection||this.selection&&e.selection&&!this.selection.equalsRange(e.selection))}validate(i){return this._equals(new a(i,this.flags))}},Ex=class extends iIt{constructor(e,t,o,n){super(e,n);this._listener=new P;t&4&&this._listener.add(e.onDidChangeCursorPosition(r=>{(!o||!z.containsPosition(o,r.position))&&this.cancel()})),t&2&&this._listener.add(e.onDidChangeCursorSelection(r=>{(!o||!z.containsRange(o,r.selection))&&this.cancel()})),t&8&&this._listener.add(e.onDidScrollChange(r=>this.cancel())),t&1&&(this._listener.add(e.onDidChangeModel(r=>this.cancel())),this._listener.add(e.onDidChangeModelContent(r=>this.cancel())))}dispose(){this._listener.dispose(),super.dispose()}},Nae=class extends $e{constructor(i,e){super(e),this._listener=i.onDidChangeContent(()=>this.cancel())}dispose(){this._listener.dispose(),super.dispose()}};var h0o=po.register({description:"inline-progress-widget",stickiness:1,showIfCollapsed:!0,after:{content:rN,inlineClassName:"inline-editor-progress-decoration",inlineClassNameAffectsLetterSpacing:!0}}),kii=class a extends C{constructor(e,t,o,n,r){super();this.typeId=e;this.editor=t;this.range=o;this.delegate=r;this.allowEditorOverflow=!1;this.suppressMouseDown=!0;this.create(n),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this)}static{this.baseId="editor.widget.inlineProgressWidget"}create(e){this.domNode=_(".inline-progress-widget"),this.domNode.role="button",this.domNode.title=e;let t=_("span.icon");this.domNode.append(t),t.classList.add(...q.asClassNameArray(M.loading),"codicon-modifier-spin");let o=()=>{let n=this.editor.getOption(75);this.domNode.style.height=`${n}px`,this.domNode.style.width=`${Math.ceil(.8*n)}px`};o(),this._register(this.editor.onDidChangeConfiguration(n=>{(n.hasChanged(61)||n.hasChanged(75))&&o()})),this._register(j(this.domNode,re.CLICK,n=>{this.delegate.cancel()}))}getId(){return a.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:{lineNumber:this.range.startLineNumber,column:this.range.startColumn},preference:[0]}}dispose(){super.dispose(),this.editor.removeContentWidget(this)}},a7=class extends C{constructor(e,t,o){super();this.id=e;this._editor=t;this._instantiationService=o;this._showDelay=500;this._showPromise=this._register(new me);this._currentWidget=this._register(new me);this._operationIdPool=0;this._currentDecorations=t.createDecorationsCollection()}dispose(){super.dispose(),this._currentDecorations.clear()}async showWhile(e,t,o,n,r){let s=this._operationIdPool++;this._currentOperation=s,this.clear(),this._showPromise.value=nn(()=>{let l=z.fromPositions(e);this._currentDecorations.set([{range:l,options:h0o}]).length>0&&(this._currentWidget.value=this._instantiationService.createInstance(kii,this.id,this._editor,l,t,n))},r??this._showDelay);try{return await o}finally{this._currentOperation===s&&(this.clear(),this._currentOperation=void 0)}}clear(){this._showPromise.clear(),this._currentDecorations.clear(),this._currentWidget.clear()}};a7=I([m(2,F)],a7);var Qn=ae("markdownRendererService"),Xje=class{constructor(i){this._openerService=i}render(i,e,t){let o={...e};o.actionHandler||(o.actionHandler=(r,s)=>zM(this._openerService,r,s.isTrusted)),o.codeBlockRenderer||(o.codeBlockRenderer=(r,s)=>this._defaultCodeBlockRenderer?.renderCodeBlock(r,s,o??{})??Promise.resolve(document.createElement("span")));let n=nb(i,o,t);return n.element.classList.add("rendered-markdown"),n}setDefaultCodeBlockRenderer(i){this._defaultCodeBlockRenderer=i}};Xje=I([m(0,Qe)],Xje);async function zM(a,i,e,t){try{return await a.open(i,{fromUserGesture:!0,allowContributedOpeners:!0,allowCommands:g0o(e),skipValidation:t})}catch(o){return mt(o),!1}}function g0o(a){return a===!0?!0:a&&Array.isArray(a.enabledCommands)?a.enabledCommands:!1}we(Qn,Xje,1);var iu=class{constructor(i,e,t){this._openerService=t;this._messageWidget=new me;this._messageListeners=new P;this._mouseOverMessage=!1;this._editor=i,this._visible=iu.MESSAGE_VISIBLE.bindTo(e)}static{this.ID="editor.contrib.messageController"}static{this.MESSAGE_VISIBLE=new Q("messageVisible",!1,d(1445,null))}static get(i){return i.getContribution(iu.ID)}dispose(){this._messageListeners.dispose(),this._messageWidget.dispose(),this._visible.reset()}isVisible(){return this._visible.get()}showMessage(i,e){if(Jo(Mr(i)?i.value:i),this._visible.set(!0),this._messageWidget.clear(),this._messageListeners.clear(),Mr(i)){let o=this._messageListeners.add(nb(i,{actionHandler:(n,r)=>{this.closeMessage(),zM(this._openerService,n,r.isTrusted)}}));this._messageWidget.value=new Jje(this._editor,e,o.element)}else this._messageWidget.value=new Jje(this._editor,e,i);this._messageListeners.add(H.debounce(this._editor.onDidBlurEditorText,(o,n)=>n,0)(()=>{this._mouseOverMessage||this._messageWidget.value&&gs(Pn(),this._messageWidget.value.getDomNode())||this.closeMessage()})),this._messageListeners.add(this._editor.onDidChangeCursorPosition(()=>this.closeMessage())),this._messageListeners.add(this._editor.onDidDispose(()=>this.closeMessage())),this._messageListeners.add(this._editor.onDidChangeModel(()=>this.closeMessage())),this._messageListeners.add(j(this._messageWidget.value.getDomNode(),re.MOUSE_ENTER,()=>this._mouseOverMessage=!0,!0)),this._messageListeners.add(j(this._messageWidget.value.getDomNode(),re.MOUSE_LEAVE,()=>this._mouseOverMessage=!1,!0));let t;this._messageListeners.add(this._editor.onMouseMove(o=>{o.target.position&&(t?t.containsPosition(o.target.position)||this.closeMessage():t=new z(e.lineNumber-3,1,o.target.position.lineNumber+3,1))}))}closeMessage(){this._visible.reset(),this._messageListeners.clear(),this._messageWidget.value&&this._messageListeners.add(Jje.fadeOut(this._messageWidget.value))}};iu=I([m(1,X),m(2,Qe)],iu);var f0o=xc.bindToContribution(iu.get);qi(new f0o({id:"leaveEditorMessage",precondition:iu.MESSAGE_VISIBLE,handler:a=>a.closeMessage(),kbOpts:{weight:130,primary:9}}));var Jje=class{constructor(i,{lineNumber:e,column:t},o){this.allowEditorOverflow=!0;this.suppressMouseDown=!1;this._editor=i,this._editor.revealLinesInCenterIfOutsideViewport(e,e,0),this._position={lineNumber:e,column:t},this._domNode=document.createElement("div"),this._domNode.classList.add("monaco-editor-overlaymessage"),this._domNode.style.marginLeft="-6px";let n=document.createElement("div");n.classList.add("anchor","top"),this._domNode.appendChild(n);let r=document.createElement("div");typeof o=="string"?(r.classList.add("message"),r.textContent=o):(o.classList.add("message"),r.appendChild(o)),this._domNode.appendChild(r);let s=document.createElement("div");s.classList.add("anchor","below"),this._domNode.appendChild(s),this._editor.addContentWidget(this),this._domNode.classList.add("fadeIn")}static fadeOut(i){let e=()=>{i.dispose(),clearTimeout(t),i.getDomNode().removeEventListener("animationend",e)},t=setTimeout(e,110);return i.getDomNode().addEventListener("animationend",e),i.getDomNode().classList.add("fadeOut"),{dispose:e}}dispose(){this._editor.removeContentWidget(this)}getId(){return"messageoverlay"}getDomNode(){return this._domNode}getPosition(){return{position:this._position,preference:[1,2],positionAffinity:1}}afterRender(i){this._domNode.classList.toggle("below",i===2)}};go(iu.ID,iu,4);var Zje=class{constructor(i){this.copyMimeTypes=[];this.kind=i,this.providedDropEditKinds=[this.kind],this.providedPasteEditKinds=[this.kind]}async provideDocumentPasteEdits(i,e,t,o,n){let r=await this.getEdit(t,n);if(r)return{edits:[{insertText:r.insertText,title:r.title,kind:r.kind,handledMimeType:r.handledMimeType,yieldTo:r.yieldTo}],dispose(){}}}async provideDocumentDropEdits(i,e,t,o){let n=await this.getEdit(t,o);if(n)return{edits:[{insertText:n.insertText,title:n.title,kind:n.kind,handledMimeType:n.handledMimeType,yieldTo:n.yieldTo}],dispose(){}}}},Rq=class a extends Zje{constructor(){super(Is.Empty.append("text","plain"));this.id=a.id;this.dropMimeTypes=[Zn.text];this.pasteMimeTypes=[Zn.text]}static{this.id="text"}async getEdit(e,t){let o=e.get(Zn.text);if(!o||e.has(Zn.uriList))return;let n=await o.asString();return{handledMimeType:Zn.text,title:d(1088,null),insertText:n,kind:this.kind}}},oIt=class extends Zje{constructor(){super(Is.Empty.append("uri","path","absolute"));this.dropMimeTypes=[Zn.uriList];this.pasteMimeTypes=[Zn.uriList]}async getEdit(e,t){let o=await O4i(e);if(!o.length||t.isCancellationRequested)return;let n=0,r=o.map(({uri:l,originalText:c})=>l.scheme===Y.file?l.fsPath:(n++,c)).join(" "),s;return n>0?s=o.length>1?d(1086,null):d(1085,null):s=o.length>1?d(1082,null):d(1081,null),{handledMimeType:Zn.uriList,insertText:r,title:s,kind:this.kind}}},pwe=class extends Zje{constructor(e){super(Is.Empty.append("uri","path","relative"));this._workspaceContextService=e;this.dropMimeTypes=[Zn.uriList];this.pasteMimeTypes=[Zn.uriList]}async getEdit(e,t){let o=await O4i(e);if(!o.length||t.isCancellationRequested)return;let n=si(o.map(({uri:r})=>{let s=this._workspaceContextService.getWorkspaceFolder(r);return s?Fc(s.uri,r):void 0}));if(n.length)return{handledMimeType:Zn.uriList,insertText:n.join(" "),title:o.length>1?d(1084,null):d(1083,null),kind:this.kind}}};pwe=I([m(0,Pe)],pwe);var Eii=class{constructor(){this.kind=new Is("html");this.providedPasteEditKinds=[this.kind];this.copyMimeTypes=[];this.pasteMimeTypes=["text/html"];this._yieldTo=[{mimeType:Zn.text}]}async provideDocumentPasteEdits(i,e,t,o,n){if(o.triggerKind!==1&&!o.only?.contains(this.kind))return;let s=await t.get("text/html")?.asString();if(!(!s||n.isCancellationRequested))return{dispose(){},edits:[{insertText:s,yieldTo:this._yieldTo,title:d(1087,null),kind:this.kind}]}}};async function O4i(a){let i=a.get(Zn.uriList);if(!i)return[];let e=await i.asString(),t=[];for(let o of Uy.parse(e))try{t.push({uri:A.parse(o),originalText:o})}catch{}return t}var Oae={scheme:"*",hasAccessToAllModels:!0},mwe=class extends C{constructor(i,e){super(),this._register(i.documentDropEditProvider.register(Oae,new Rq)),this._register(i.documentDropEditProvider.register(Oae,new oIt)),this._register(i.documentDropEditProvider.register(Oae,new pwe(e)))}};mwe=I([m(0,zt),m(1,Pe)],mwe);var hwe=class extends C{constructor(i,e){super(),this._register(i.documentPasteEditProvider.register(Oae,new Rq)),this._register(i.documentPasteEditProvider.register(Oae,new oIt)),this._register(i.documentPasteEditProvider.register(Oae,new pwe(e))),this._register(i.documentPasteEditProvider.register(Oae,new Eii))}};hwe=I([m(0,zt),m(1,Pe)],hwe);var Tii=class a{constructor(){this.value="";this.pos=0}static{this._table={36:0,58:1,44:2,123:3,125:4,92:5,47:6,124:7,43:11,45:12,63:13}}static isDigitCharacter(i){return i>=48&&i<=57}static isVariableCharacter(i){return i===95||i>=97&&i<=122||i>=65&&i<=90}text(i){this.value=i,this.pos=0}tokenText(i){return this.value.substr(i.pos,i.len)}next(){if(this.pos>=this.value.length)return{type:14,pos:this.pos,len:0};let i=this.pos,e=0,t=this.value.charCodeAt(i),o;if(o=a._table[t],typeof o=="number")return this.pos+=1,{type:o,pos:i,len:1};if(a.isDigitCharacter(t)){o=8;do e+=1,t=this.value.charCodeAt(i+e);while(a.isDigitCharacter(t));return this.pos+=e,{type:o,pos:i,len:e}}if(a.isVariableCharacter(t)){o=9;do t=this.value.charCodeAt(i+ ++e);while(a.isVariableCharacter(t)||a.isDigitCharacter(t));return this.pos+=e,{type:o,pos:i,len:e}}o=10;do e+=1,t=this.value.charCodeAt(i+e);while(!isNaN(t)&&typeof a._table[t]>"u"&&!a.isDigitCharacter(t)&&!a.isVariableCharacter(t));return this.pos+=e,{type:o,pos:i,len:e}}},l7=class{constructor(){this._children=[]}appendChild(i){return i instanceof Qb&&this._children[this._children.length-1]instanceof Qb?this._children[this._children.length-1].value+=i.value:(i.parent=this,this._children.push(i)),this}replace(i,e){let{parent:t}=i,o=t.children.indexOf(i),n=t.children.slice(0);n.splice(o,1,...e),t._children=n,(function r(s,l){for(let c of s)c.parent=l,r(c.children,c)})(e,t)}get children(){return this._children}get rightMostDescendant(){return this._children.length>0?this._children[this._children.length-1].rightMostDescendant:this}get snippet(){let i=this;for(;;){if(!i)return;if(i instanceof gwe)return i;i=i.parent}}toString(){return this.children.reduce((i,e)=>i+e.toString(),"")}len(){return 0}},Qb=class a extends l7{constructor(e){super();this.value=e}static escape(e){return e.replace(/\$|}|\\/g,"\\$&")}toString(){return this.value}toTextmateString(){return a.escape(this.value)}len(){return this.value.length}clone(){return new a(this.value)}},nIt=class extends l7{},Tx=class a extends nIt{constructor(e){super();this.index=e}static compareByIndex(e,t){return e.index===t.index?0:e.isFinalTabstop?1:t.isFinalTabstop||e.index<t.index?-1:e.index>t.index?1:0}get isFinalTabstop(){return this.index===0}get choice(){return this._children.length===1&&this._children[0]instanceof Fae?this._children[0]:void 0}toTextmateString(){let e="";return this.transform&&(e=this.transform.toTextmateString()),this.children.length===0&&!this.transform?`$${this.index}`:this.children.length===0?`\${${this.index}${e}}`:this.choice?`\${${this.index}|${this.choice.toTextmateString()}|${e}}`:`\${${this.index}:${this.children.map(t=>t.toTextmateString()).join("")}${e}}`}clone(){let e=new a(this.index);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}},Fae=class a extends l7{constructor(){super(...arguments);this.options=[]}appendChild(e){return e instanceof Qb&&(e.parent=this,this.options.push(e)),this}toString(){return this.options[0].value}toTextmateString(){return this.options.map(e=>e.value.replace(/\||,|\\/g,"\\$&")).join(",")}len(){return this.options[0].len()}clone(){let e=new a;return this.options.forEach(e.appendChild,e),e}},_ii=class a extends l7{constructor(){super(...arguments);this.regexp=new RegExp("")}resolve(e){let t=this,o=!1,n=e.replace(this.regexp,function(){return o=!0,t._replace(Array.prototype.slice.call(arguments,0,-2))});return!o&&this._children.some(r=>r instanceof kW&&!!r.elseValue)&&(n=this._replace([])),n}_replace(e){let t="";for(let o of this._children)if(o instanceof kW){let n=e[o.index]||"";n=o.resolve(n),t+=n}else t+=o.toString();return t}toString(){return""}toTextmateString(){return`/${this.regexp.source}/${this.children.map(e=>e.toTextmateString())}/${(this.regexp.ignoreCase?"i":"")+(this.regexp.global?"g":"")}`}clone(){let e=new a;return e.regexp=new RegExp(this.regexp.source,(this.regexp.ignoreCase?"i":"")+(this.regexp.global?"g":"")),e._children=this.children.map(t=>t.clone()),e}},kW=class a extends l7{constructor(e,t,o,n){super();this.index=e;this.shorthandName=t;this.ifValue=o;this.elseValue=n}resolve(e){return this.shorthandName==="upcase"?e?e.toLocaleUpperCase():"":this.shorthandName==="downcase"?e?e.toLocaleLowerCase():"":this.shorthandName==="capitalize"?e?e[0].toLocaleUpperCase()+e.substr(1):"":this.shorthandName==="pascalcase"?e?this._toPascalCase(e):"":this.shorthandName==="camelcase"?e?this._toCamelCase(e):"":this.shorthandName==="kebabcase"?e?this._toKebabCase(e):"":this.shorthandName==="snakecase"?e?this._toSnakeCase(e):"":e&&typeof this.ifValue=="string"?this.ifValue:!e&&typeof this.elseValue=="string"?this.elseValue:e||""}_toKebabCase(e){if(!e.match(/[\p{L}0-9]+/gu))return e;if(!e.match(/[\p{L}0-9]/u))return e.trim().toLowerCase().replace(/^_+|_+$/g,"").replace(/[\s_]+/g,"-");let o=e.trim().replace(/^_+|_+$/g,""),n=o.match(/\p{Lu}{2,}(?=\p{Lu}\p{Ll}+[0-9]*|[\s_-]|$)|\p{Lu}?\p{Ll}+[0-9]*|\p{Lu}(?=\p{Lu}\p{Ll})|\p{Lu}(?=[\s_-]|$)|[0-9]+/gu);return n?n.map(r=>r.toLowerCase()).join("-"):o.split(/[\s_-]+/).filter(r=>r.length>0).map(r=>r.toLowerCase()).join("-")}_toPascalCase(e){let t=e.match(/[\p{L}0-9]+/gu);return t?t.map(o=>o.charAt(0).toUpperCase()+o.substr(1)).join(""):e}_toCamelCase(e){let t=e.match(/[\p{L}0-9]+/gu);return t?t.map((o,n)=>n===0?o.charAt(0).toLowerCase()+o.substr(1):o.charAt(0).toUpperCase()+o.substr(1)).join(""):e}_toSnakeCase(e){return e.replace(/(\p{Ll})(\p{Lu})/gu,"$1_$2").replace(/[\s\-]+/g,"_").toLowerCase()}toTextmateString(){let e="${";return e+=this.index,this.shorthandName?e+=`:/${this.shorthandName}`:this.ifValue&&this.elseValue?e+=`:?${this.ifValue}:${this.elseValue}`:this.ifValue?e+=`:+${this.ifValue}`:this.elseValue&&(e+=`:-${this.elseValue}`),e+="}",e}clone(){return new a(this.index,this.shorthandName,this.ifValue,this.elseValue)}},Wae=class a extends nIt{constructor(e){super();this.name=e}resolve(e){let t=e.resolve(this);return this.transform&&(t=this.transform.resolve(t||"")),t!==void 0?(this._children=[new Qb(t)],!0):!1}toTextmateString(){let e="";return this.transform&&(e=this.transform.toTextmateString()),this.children.length===0?`\${${this.name}${e}}`:`\${${this.name}:${this.children.map(t=>t.toTextmateString()).join("")}${e}}`}clone(){let e=new a(this.name);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}};function F4i(a,i){let e=[...a];for(;e.length>0;){let t=e.shift();if(!i(t))break;e.unshift(...t.children)}}var gwe=class a extends l7{get placeholderInfo(){if(!this._placeholders){let i=[],e;this.walk(function(t){return t instanceof Tx&&(i.push(t),e=!e||e.index<t.index?t:e),!0}),this._placeholders={all:i,last:e}}return this._placeholders}get placeholders(){let{all:i}=this.placeholderInfo;return i}offset(i){let e=0,t=!1;return this.walk(o=>o===i?(t=!0,!1):(e+=o.len(),!0)),t?e:-1}fullLen(i){let e=0;return F4i([i],t=>(e+=t.len(),!0)),e}enclosingPlaceholders(i){let e=[],{parent:t}=i;for(;t;)t instanceof Tx&&e.push(t),t=t.parent;return e}resolveVariables(i){return this.walk(e=>(e instanceof Wae&&e.resolve(i)&&(this._placeholders=void 0),!0)),this}appendChild(i){return this._placeholders=void 0,super.appendChild(i)}replace(i,e){return this._placeholders=void 0,super.replace(i,e)}toTextmateString(){return this.children.reduce((i,e)=>i+e.toTextmateString(),"")}clone(){let i=new a;return this._children=this.children.map(e=>e.clone()),i}walk(i){F4i(this.children,i)}},zh=class a{constructor(){this._scanner=new Tii;this._token={type:14,pos:0,len:0}}static escape(i){return i.replace(/\$|}|\\/g,"\\$&")}static asInsertText(i){return new a().parse(i).toString()}static guessNeedsClipboard(i){return/\${?CLIPBOARD/.test(i)}parse(i,e,t){let o=new gwe;return this.parseFragment(i,o),this.ensureFinalTabstop(o,t??!1,e??!1),o}parseFragment(i,e){let t=e.children.length;for(this._scanner.text(i),this._token=this._scanner.next();this._parse(e););let o=new Map,n=[];e.walk(l=>(l instanceof Tx&&(l.isFinalTabstop?o.set(0,void 0):!o.has(l.index)&&l.children.length>0?o.set(l.index,l.children):n.push(l)),!0));let r=(l,c)=>{let u=o.get(l.index);if(!u)return;let p=new Tx(l.index);p.transform=l.transform;for(let h of u){let g=h.clone();p.appendChild(g),g instanceof Tx&&o.has(g.index)&&!c.has(g.index)&&(c.add(g.index),r(g,c),c.delete(g.index))}e.replace(l,[p])},s=new Set;for(let l of n)r(l,s);return e.children.slice(t)}ensureFinalTabstop(i,e,t){(e||t&&i.placeholders.length>0)&&(i.placeholders.find(n=>n.index===0)||i.appendChild(new Tx(0)))}_accept(i,e){if(i===void 0||this._token.type===i){let t=e?this._scanner.tokenText(this._token):!0;return this._token=this._scanner.next(),t}return!1}_backTo(i){return this._scanner.pos=i.pos+i.len,this._token=i,!1}_until(i){let e=this._token;for(;this._token.type!==i;){if(this._token.type===14)return!1;if(this._token.type===5){let o=this._scanner.next();if(o.type!==0&&o.type!==4&&o.type!==5)return!1}this._token=this._scanner.next()}let t=this._scanner.value.substring(e.pos,this._token.pos).replace(/\\(\$|}|\\)/g,"$1");return this._token=this._scanner.next(),t}_parse(i){return this._parseEscaped(i)||this._parseTabstopOrVariableName(i)||this._parseComplexPlaceholder(i)||this._parseComplexVariable(i)||this._parseAnything(i)}_parseEscaped(i){let e;return(e=this._accept(5,!0))?(e=this._accept(0,!0)||this._accept(4,!0)||this._accept(5,!0)||e,i.appendChild(new Qb(e)),!0):!1}_parseTabstopOrVariableName(i){let e,t=this._token;return this._accept(0)&&(e=this._accept(9,!0)||this._accept(8,!0))?(i.appendChild(/^\d+$/.test(e)?new Tx(Number(e)):new Wae(e)),!0):this._backTo(t)}_parseComplexPlaceholder(i){let e,t=this._token;if(!(this._accept(0)&&this._accept(3)&&(e=this._accept(8,!0))))return this._backTo(t);let n=new Tx(Number(e));if(this._accept(1))for(;;){if(this._accept(4))return i.appendChild(n),!0;if(!this._parse(n))return i.appendChild(new Qb("${"+e+":")),n.children.forEach(i.appendChild,i),!0}else if(n.index>0&&this._accept(7)){let r=new Fae;for(;;){if(this._parseChoiceElement(r)){if(this._accept(2))continue;if(this._accept(7)&&(n.appendChild(r),this._accept(4)))return i.appendChild(n),!0}return this._backTo(t),!1}}else return this._accept(6)?this._parseTransform(n)?(i.appendChild(n),!0):(this._backTo(t),!1):this._accept(4)?(i.appendChild(n),!0):this._backTo(t)}_parseChoiceElement(i){let e=this._token,t=[];for(;!(this._token.type===2||this._token.type===7);){let o;if((o=this._accept(5,!0))?o=this._accept(2,!0)||this._accept(7,!0)||this._accept(5,!0)||o:o=this._accept(void 0,!0),!o)return this._backTo(e),!1;t.push(o)}return t.length===0?(this._backTo(e),!1):(i.appendChild(new Qb(t.join(""))),!0)}_parseComplexVariable(i){let e,t=this._token;if(!(this._accept(0)&&this._accept(3)&&(e=this._accept(9,!0))))return this._backTo(t);let n=new Wae(e);if(this._accept(1))for(;;){if(this._accept(4))return i.appendChild(n),!0;if(!this._parse(n))return i.appendChild(new Qb("${"+e+":")),n.children.forEach(i.appendChild,i),!0}else return this._accept(6)?this._parseTransform(n)?(i.appendChild(n),!0):(this._backTo(t),!1):this._accept(4)?(i.appendChild(n),!0):this._backTo(t)}_parseTransform(i){let e=new _ii,t="",o="";for(;!this._accept(6);){let n;if(n=this._accept(5,!0)){n=this._accept(6,!0)||n,t+=n;continue}if(this._token.type!==14){t+=this._accept(void 0,!0);continue}return!1}for(;!this._accept(6);){let n;if(n=this._accept(5,!0)){n=this._accept(5,!0)||this._accept(6,!0)||n,e.appendChild(new Qb(n));continue}if(!(this._parseFormatString(e)||this._parseAnything(e)))return!1}for(;!this._accept(4);){if(this._token.type!==14){o+=this._accept(void 0,!0);continue}return!1}try{e.regexp=new RegExp(t,o)}catch{return!1}return i.transform=e,!0}_parseFormatString(i){let e=this._token;if(!this._accept(0))return!1;let t=!1;this._accept(3)&&(t=!0);let o=this._accept(8,!0);if(o)if(t){if(this._accept(4))return i.appendChild(new kW(Number(o))),!0;if(!this._accept(1))return this._backTo(e),!1}else return i.appendChild(new kW(Number(o))),!0;else return this._backTo(e),!1;if(this._accept(6)){let n=this._accept(9,!0);return!n||!this._accept(4)?(this._backTo(e),!1):(i.appendChild(new kW(Number(o),n)),!0)}else if(this._accept(11)){let n=this._until(4);if(n)return i.appendChild(new kW(Number(o),void 0,n,void 0)),!0}else if(this._accept(12)){let n=this._until(4);if(n)return i.appendChild(new kW(Number(o),void 0,void 0,n)),!0}else if(this._accept(13)){let n=this._until(1);if(n){let r=this._until(4);if(r)return i.appendChild(new kW(Number(o),void 0,n,r)),!0}}else{let n=this._until(4);if(n)return i.appendChild(new kW(Number(o),void 0,void 0,n)),!0}return this._backTo(e),!1}_parseAnything(i){return this._token.type!==14?(i.appendChild(new Qb(this._scanner.tokenText(this._token))),this._accept(void 0),!0):!1}};function rIt(a,i,e){return(typeof e.insertText=="string"?e.insertText==="":e.insertText.snippet==="")?{edits:e.additionalEdit?.edits??[]}:{edits:[...i.map(t=>new ja(a,{range:t,text:typeof e.insertText=="string"?zh.escape(e.insertText)+"$0":e.insertText.snippet,insertAsSnippet:!0})),...e.additionalEdit?.edits??[]]}}function sIt(a){function i(r,s){return"mimeType"in r?r.mimeType===s.handledMimeType:!!s.kind&&r.kind.contains(s.kind)}let e=new Map;for(let r of a)for(let s of r.yieldTo??[])for(let l of a)if(l!==r&&i(s,l)){let c=e.get(r);c||(c=[],e.set(r,c)),c.push(l)}if(!e.size)return Array.from(a);let t=new Set,o=[];function n(r){if(!r.length)return[];let s=r[0];if(o.includes(s))return console.warn("Yield to cycle detected",s),r;if(t.has(s))return n(r.slice(1));let l=[],c=e.get(s);return c&&(o.push(s),l=n(c),o.pop()),t.add(s),[...l,s,...n(r.slice(1))]}return n(Array.from(a))}var fwe={buttonBackground:"#0E639C",buttonHoverBackground:"#006BB3",buttonSeparator:Oe.white.toString(),buttonForeground:Oe.white.toString(),buttonBorder:void 0,buttonSecondaryBackground:void 0,buttonSecondaryForeground:void 0,buttonSecondaryHoverBackground:void 0,buttonSecondaryBorder:void 0},W4i=Object.freeze({allowedTags:{override:["b","i","u","code","span"]},allowedAttributes:{override:["class"]}}),V4i=Object.freeze({sanitizerConfig:{allowedAttributes:{override:["class"]}}}),Mi=class extends C{constructor(e,t){super();this._label="";this._onDidClick=this._register(new E);this._onDidEscape=this._register(new E);this.options=t,this._element=document.createElement("a"),this._element.classList.add("monaco-button"),this._element.tabIndex=0,this._element.setAttribute("role","button"),this._element.classList.toggle("secondary",!!t.secondary),this._element.classList.toggle("small",!!t.small);let o=t.secondary?t.buttonSecondaryBackground:t.buttonBackground,n=t.secondary?t.buttonSecondaryForeground:t.buttonForeground,r=t.secondary?t.buttonSecondaryBorder:t.buttonBorder;this._element.style.color=n||"",this._element.style.backgroundColor=o||"",r&&(this._element.style.border=`1px solid ${r}`),t.supportShortLabel&&(this._labelShortElement=document.createElement("div"),this._labelShortElement.classList.add("monaco-button-label-short"),this._element.appendChild(this._labelShortElement),this._labelElement=document.createElement("div"),this._labelElement.classList.add("monaco-button-label"),this._element.appendChild(this._labelElement),this._element.classList.add("monaco-text-button-with-short-label")),typeof t.title=="string"&&this.setTitle(t.title),typeof t.ariaLabel=="string"&&this._element.setAttribute("aria-label",t.ariaLabel),e.appendChild(this._element),this.enabled=!t.disabled,this._register(ws.addTarget(this._element)),[re.CLICK,Gn.Tap].forEach(s=>{this._register(j(this._element,s,l=>{if(!this.enabled){$t.stop(l);return}this._onDidClick.fire(l)}))}),this._register(j(this._element,re.KEY_DOWN,s=>{let l=new Ii(s),c=!1;this.enabled&&(l.equals(3)||l.equals(10))?(this._onDidClick.fire(s),c=!0):l.equals(9)&&(this._onDidEscape.fire(s),this._element.blur(),c=!0),c&&$t.stop(l,!0)})),this._register(j(this._element,re.MOUSE_OVER,s=>{this._element.classList.contains("disabled")||this.updateStyles(!0)})),this._register(j(this._element,re.MOUSE_OUT,s=>{this.updateStyles(!1)})),this.focusTracker=this._register(Vn(this._element)),this._register(this.focusTracker.onDidFocus(()=>{this.enabled&&this.updateStyles(!0)})),this._register(this.focusTracker.onDidBlur(()=>{this.enabled&&this.updateStyles(!1)}))}get onDidClick(){return this._onDidClick.event}get onDidEscape(){return this._onDidEscape.event}dispose(){super.dispose(),this._element.remove()}getContentElements(e){let t=[];for(let o of Bn(e))if(typeof o=="string"){if(o=o.trim(),o==="")continue;let n=document.createElement("span");n.textContent=o,t.push(n)}else t.push(o);return t}updateStyles(e){let t,o,n;this.options.secondary?(t=e?this.options.buttonSecondaryHoverBackground:this.options.buttonSecondaryBackground,o=this.options.buttonSecondaryForeground,n=this.options.buttonSecondaryBorder):(t=e?this.options.buttonHoverBackground:this.options.buttonBackground,o=this.options.buttonForeground,n=this.options.buttonBorder),this._element.style.backgroundColor=t||"",this._element.style.color=o||"",this._element.style.border=n?`1px solid ${n}`:""}get element(){return this._element}set label(e){if(this._label===e||Mr(this._label)&&Mr(e)&&nje(this._label,e))return;this._element.classList.add("monaco-text-button");let t=this.options.supportShortLabel?this._labelElement:this._element;if(Mr(e)){let n=nb(e,V4i,document.createElement("span"));n.dispose();let r=n.element.querySelector("p")?.innerHTML;r?Iq(t,r,W4i):Fi(t)}else this.options.supportIcons?Fi(t,...this.getContentElements(e)):t.textContent=e;let o="";typeof this.options.title=="string"?o=this.options.title:this.options.title&&(o=qa(e)),this.setTitle(o),this._setAriaLabel(),this._label=e}get label(){return this._label}set labelShort(e){!this.options.supportShortLabel||!this._labelShortElement||(this.options.supportIcons?Fi(this._labelShortElement,...this.getContentElements(e)):this._labelShortElement.textContent=e)}_setAriaLabel(){typeof this.options.ariaLabel=="string"?this._element.setAttribute("aria-label",this.options.ariaLabel):typeof this.options.title=="string"&&this._element.setAttribute("aria-label",this.options.title)}set icon(e){this._setAriaLabel();let t=Array.from(this._element.classList).filter(o=>o.startsWith("codicon-"));this._element.classList.remove(...t),this._element.classList.add(...q.asClassNameArray(e))}set enabled(e){e?(this._element.classList.remove("disabled"),this._element.setAttribute("aria-disabled",String(!1)),this._element.tabIndex=0):(this._element.classList.add("disabled"),this._element.setAttribute("aria-disabled",String(!0)))}get enabled(){return!this._element.classList.contains("disabled")}set secondary(e){this._element.classList.toggle("secondary",e),this.options.secondary=e,this.updateStyles(!1)}set checked(e){e?(this._element.classList.add("checked"),this._element.setAttribute("aria-pressed","true")):(this._element.classList.remove("checked"),this._element.setAttribute("aria-pressed","false"))}get checked(){return this._element.classList.contains("checked")}setTitle(e){!this._hover&&e!==""?this._hover=this._register(yp().setupManagedHover(this.options.hoverDelegate??Ni("element"),this._element,e)):this._hover&&this._hover.update(e)}focus(){this._element.focus()}hasFocus(){return sa(this._element)}},$I=class extends C{constructor(e,t){super();this._onDidClick=this._register(new E);this.onDidClick=this._onDidClick.event;this.element=document.createElement("div"),this.element.classList.add("monaco-button-dropdown"),e.appendChild(this.element),t.hoverDelegate||(t={...t,hoverDelegate:this._register(Gg())}),this.primaryButton=this._register(new Mi(this.element,t)),this._register(this.primaryButton.onDidClick(r=>this._onDidClick.fire(r))),this.action=pi({id:"primaryAction",label:qa(this.primaryButton.label),run:async()=>this._onDidClick.fire(void 0)}),this.separatorContainer=document.createElement("div"),this.separatorContainer.classList.add("monaco-button-dropdown-separator"),this.separator=document.createElement("div"),this.separatorContainer.appendChild(this.separator),this.element.appendChild(this.separatorContainer);let o=t.buttonBorder;o&&(this.separatorContainer.style.borderTop="1px solid "+o,this.separatorContainer.style.borderBottom="1px solid "+o);let n=t.secondary?t.buttonSecondaryBackground:t.buttonBackground;this.separatorContainer.style.backgroundColor=n??"",this.separator.style.backgroundColor=t.buttonSeparator??"",this.dropdownButton=this._register(new Mi(this.element,{...t,title:d(1,null),supportIcons:!0})),this.dropdownButton.element.setAttribute("aria-haspopup","true"),this.dropdownButton.element.setAttribute("aria-expanded","false"),this.dropdownButton.element.classList.add("monaco-dropdown-button"),this.dropdownButton.icon=M.dropDownButton,this._register(this.dropdownButton.onDidClick(r=>{let s=Array.isArray(t.actions)?t.actions:t.actions.getActions();t.contextMenuProvider.showContextMenu({getAnchor:()=>this.dropdownButton.element,getActions:()=>t.addPrimaryActionToDropdown===!1?[...s]:[this.action,...s],actionRunner:t.actionRunner,onHide:()=>this.dropdownButton.element.setAttribute("aria-expanded","false"),layer:t.dropdownLayer}),this.dropdownButton.element.setAttribute("aria-expanded","true")}))}dispose(){super.dispose(),this.element.remove()}set label(e){this.primaryButton.label=e,this.action.label=e}set icon(e){this.primaryButton.icon=e}set enabled(e){this.primaryButton.enabled=e,this.dropdownButton.enabled=e,this.element.classList.toggle("disabled",!e)}get enabled(){return this.primaryButton.enabled}set checked(e){this.primaryButton.checked=e}get checked(){return this.primaryButton.checked}focus(){this.primaryButton.focus()}hasFocus(){return this.primaryButton.hasFocus()||this.dropdownButton.hasFocus()}},e5e=class{constructor(i,e){this.options=e;this._element=document.createElement("div"),this._element.classList.add("monaco-description-button"),this._button=new Mi(this._element,e),this._descriptionElement=document.createElement("div"),this._descriptionElement.classList.add("monaco-button-description"),this._element.appendChild(this._descriptionElement),i.appendChild(this._element)}get onDidClick(){return this._button.onDidClick}get element(){return this._element}set label(i){this._button.label=i}set icon(i){this._button.icon=i}get enabled(){return this._button.enabled}set enabled(i){this._button.enabled=i}set checked(i){this._button.checked=i}get checked(){return this._button.checked}focus(){this._button.focus()}hasFocus(){return this._button.hasFocus()}dispose(){this._button.dispose()}set description(i){this.options.supportIcons?Fi(this._descriptionElement,...Bn(i)):this._descriptionElement.textContent=i}};var _x=class{constructor(i,e){this.container=i;this.options=e;this._buttons=[];this._buttonStore=new P}dispose(){this._buttonStore.dispose()}get buttons(){return this._buttons}clear(){this._buttonStore.clear(),this._buttons.length=0}addButton(i){let e=this._buttonStore.add(new Mi(this.container,i));return this.pushButton(e),e}addButtonWithDescription(i){let e=this._buttonStore.add(new e5e(this.container,i));return this.pushButton(e),e}addButtonWithDropdown(i){let e=this._buttonStore.add(new $I(this.container,i));return this.pushButton(e),e}pushButton(i){this._buttons.push(i);let e=this._buttons.length-1;this._buttonStore.add(j(i.element,re.KEY_DOWN,t=>{let o=new Ii(t),n=!0,r;o.equals(this.options?.alignment===1?16:15)?r=e>0?e-1:this._buttons.length-1:o.equals(this.options?.alignment===1?18:17)?r=e===this._buttons.length-1?0:e+1:n=!1,n&&typeof r=="number"&&(this._buttons[r].focus(),$t.stop(t,!0))}))}},oO=class extends Mi{get labelElement(){return this._mdlabelElement}get iconElement(){return this._iconElement}constructor(i,e){if(super(i,e),e.supportShortLabel)throw new Error("ButtonWithIcon does not support short labels");this._element.classList.add("monaco-icon-button"),this._iconElement=_(""),this._mdlabelElement=_(".monaco-button-mdlabel"),this._element.append(this._iconElement,this._mdlabelElement)}get label(){return super.label}set label(i){if(this._label===i||Mr(this._label)&&Mr(i)&&nje(this._label,i))return;if(this._element.classList.add("monaco-text-button"),Mr(i)){let t=nb(i,V4i,document.createElement("span"));t.dispose();let o=t.element.querySelector("p")?.innerHTML;o?Iq(this._mdlabelElement,o,W4i):Fi(this._mdlabelElement)}else this.options.supportIcons?Fi(this._mdlabelElement,...this.getContentElements(i)):this._mdlabelElement.textContent=i;let e="";typeof this.options.title=="string"?e=this.options.title:this.options.title&&(e=qa(i)),this.setTitle(e),this._setAriaLabel(),this._label=i}get icon(){return super.icon}set icon(i){this._iconElement.classList.value="",this._iconElement.classList.add(...q.asClassNameArray(i)),this._setAriaLabel()}};var aIt=_,t5e={keybindingLabelBackground:void 0,keybindingLabelForeground:void 0,keybindingLabelBorder:void 0,keybindingLabelBottomBorder:void 0,keybindingLabelShadow:void 0},ah=class a extends C{constructor(e,t,o){super();this.os=t;this.keyElements=new Set;this.options=o||Object.create(null);let n=this.options.keybindingLabelForeground;this.domNode=R(e,aIt(".monaco-keybinding")),n&&(this.domNode.style.color=n),this.hover=this._register(yp().setupManagedHover(Ni("mouse"),this.domNode,"")),this.didEverRender=!1,e.appendChild(this.domNode)}get element(){return this.domNode}set(e,t){this.didEverRender&&this.keybinding===e&&a.areSame(this.matches,t)||(this.keybinding=e,this.matches=t,this.render())}render(){if(this.clear(),this.keybinding){let e=this.keybinding.getChords();e[0]&&this.renderChord(this.domNode,e[0],this.matches?this.matches.firstPart:null);for(let o=1;o<e.length;o++)R(this.domNode,aIt("span.monaco-keybinding-key-chord-separator",void 0," ")),this.renderChord(this.domNode,e[o],this.matches?this.matches.chordPart:null);let t=this.options.disableTitle??!1?void 0:this.keybinding.getAriaLabel()||void 0;this.hover.update(t),this.domNode.setAttribute("aria-label",t||"")}else this.options&&this.options.renderUnboundKeybindings&&this.renderUnbound(this.domNode);this.didEverRender=!0}clear(){Rt(this.domNode),this.keyElements.clear()}renderChord(e,t,o){let n=YN.modifierLabels[this.os];t.ctrlKey&&this.renderKey(e,n.ctrlKey,!!o?.ctrlKey,n.separator),t.shiftKey&&this.renderKey(e,n.shiftKey,!!o?.shiftKey,n.separator),t.altKey&&this.renderKey(e,n.altKey,!!o?.altKey,n.separator),t.metaKey&&this.renderKey(e,n.metaKey,!!o?.metaKey,n.separator);let r=t.keyLabel;r&&this.renderKey(e,r,!!o?.keyCode,"")}renderKey(e,t,o,n){R(e,this.createKeyElement(t,o?".highlight":"")),n&&R(e,aIt("span.monaco-keybinding-key-separator",void 0,n))}renderUnbound(e){R(e,this.createKeyElement(d(25,null)))}createKeyElement(e,t=""){let o=aIt("span.monaco-keybinding-key"+t,void 0,e);return this.keyElements.add(o),this.options.keybindingLabelBackground&&(o.style.backgroundColor=this.options.keybindingLabelBackground),this.options.keybindingLabelBorder&&(o.style.borderColor=this.options.keybindingLabelBorder),this.options.keybindingLabelBottomBorder&&(o.style.borderBottomColor=this.options.keybindingLabelBottomBorder),this.options.keybindingLabelShadow&&(o.style.boxShadow=`inset 0 -1px 0 ${this.options.keybindingLabelShadow}`),o}static areSame(e,t){return e===t||!e&&!t?!0:!!e&&!!t&&uo(e.firstPart,t.firstPart)&&uo(e.chordPart,t.chordPart)}};var nc=ae("layoutService");var Mii="acceptSelectedCodeAction",Pii="previewSelectedCodeAction";var Dii=class{get templateId(){return"header"}renderTemplate(i){i.classList.add("group-header");let e=document.createElement("span");return i.append(e),{container:i,text:e}}renderElement(i,e,t){t.text.textContent=i.group?.title??i.label??""}disposeTemplate(i){}},Lii=class{get templateId(){return"separator"}renderTemplate(i){i.classList.add("separator");let e=document.createElement("span");return i.append(e),{container:i,text:e}}renderElement(i,e,t){t.text.textContent=i.label??""}disposeTemplate(i){}},i5e=class{constructor(i,e,t,o){this._supportsPreview=i;this._onRemoveItem=e;this._keybindingService=t;this._openerService=o}get templateId(){return"action"}renderTemplate(i){i.classList.add(this.templateId);let e=document.createElement("div");e.className="icon",i.append(e);let t=document.createElement("span");t.className="title",i.append(t);let o=document.createElement("span");o.className="action-item-badge",i.append(o);let n=document.createElement("span");n.className="description",i.append(n);let r=new ah(i,zo),s=document.createElement("div");s.className="action-list-item-toolbar",i.append(s);let l=new P;return{container:i,icon:e,text:t,badge:o,description:n,keybinding:r,toolbar:s,elementDisposables:l}}renderElement(i,e,t){if(t.elementDisposables.clear(),i.group?.icon?(t.icon.className=q.asClassName(i.group.icon),i.group.icon.color&&(t.icon.style.color=wt(i.group.icon.color.id))):(t.icon.className=q.asClassName(M.lightBulb),t.icon.style.color="var(--vscode-editorLightBulb-foreground)"),!i.item||!i.label)return;if(mm(!i.hideIcon,t.icon),t.previousClassName&&t.container.classList.remove(t.previousClassName),t.container.classList.toggle("action-list-custom",!!i.className),i.className&&t.container.classList.add(i.className),t.previousClassName=i.className,t.text.textContent=cIt(i.label),i.badge?(t.badge.textContent=i.badge,t.badge.style.display=""):(t.badge.textContent="",t.badge.style.display="none"),i.keybinding)t.description.textContent=i.keybinding.getLabel(),t.description.style.display="inline",t.description.style.letterSpacing="0.5px";else if(i.description){if(Rt(t.description),typeof i.description=="string")t.description.textContent=cIt(i.description);else{let s=nb(i.description,{actionHandler:l=>{this._openerService.open(A.parse(l),{allowCommands:!0})}});t.elementDisposables.add(s),t.description.appendChild(s.element)}t.description.style.display="inline"}else t.description.textContent="",t.description.style.display="none";let o=this._keybindingService.lookupKeybinding(Mii)?.getLabel(),n=this._keybindingService.lookupKeybinding(Pii)?.getLabel();t.container.classList.toggle("option-disabled",!!i.disabled),i.hover!==void 0?t.container.title="":i.tooltip?t.container.title=i.tooltip:i.disabled?t.container.title=i.label:o&&n?this._supportsPreview&&i.canPreview?t.container.title=d(1818,null,o,n):t.container.title=d(1817,null,o):t.container.title="",Rt(t.toolbar);let r=[...i.toolbarActions??[]];if(i.onRemove&&r.push(pi({id:"actionList.remove",label:d(1814,null),class:q.asClassName(M.close),run:()=>{i.onRemove(),this._onRemoveItem?.(i)}})),t.container.classList.toggle("has-toolbar",r.length>0),r.length>0){let s=new ji(t.toolbar);t.elementDisposables.add(s),s.push(r,{icon:!0,label:!1})}}disposeTemplate(i){i.keybinding.dispose(),i.elementDisposables.dispose()}};i5e=I([m(2,_e),m(3,Qe)],i5e);var Rii=class extends UIEvent{constructor(){super("acceptSelectedAction")}},lIt=class extends UIEvent{constructor(){super("previewSelectedAction")}};function b0o(a){if(a.kind==="action")return a.label}var vwe=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this._delegate=n;this._options=s;this._anchor=l;this._contextViewService=c;this._keybindingService=u;this._layoutService=p;this._hoverService=h;this._openerService=g;this._headerLineHeight=24;this._separatorLineHeight=8;this.cts=this._register(new $e);this._hover=this._register(new me);this._collapsedSections=new Set;this._filterText="";this._suppressHover=!1;this._lastMinWidth=0;this._hasLaidOut=!1;if(this.domNode=document.createElement("div"),this.domNode.classList.add("actionList"),this._options?.descriptionBelow&&this.domNode.classList.add("description-below"),this._actionLineHeight=this._options?.descriptionBelow?48:24,this._options?.collapsedByDefault)for(let v of this._options.collapsedByDefault)this._collapsedSections.add(v);let f={getHeight:v=>{switch(v.kind){case"header":return this._headerLineHeight;case"separator":return this._separatorLineHeight;default:return this._actionLineHeight}},getTemplateId:v=>v.kind};this._list=this._register(new hc(e,this.domNode,f,[new i5e(t,v=>this._removeItem(v),this._keybindingService,this._openerService),new Dii,new Lii],{keyboardSupport:!1,typeNavigationEnabled:!this._options?.showFilter,keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:b0o},accessibilityProvider:{getAriaLabel:v=>{if(v.kind==="action"){let b=v.label?cIt(v?.label):"";if(v.description){let S=typeof v.description=="string"?v.description:v.description.value;b=b+", "+cIt(S)}return v.disabled&&(b=d(1816,null,b,v.disabled)),b}return null},getWidgetAriaLabel:()=>d(1815,null),getRole:v=>{switch(v.kind){case"action":return"option";case"separator":return"separator";default:return"separator"}},getWidgetRole:()=>"listbox",...r}})),this._list.style(n7),this._register(this._list.onMouseClick(v=>this.onListClick(v))),this._register(this._list.onMouseOver(v=>this.onListHover(v))),this._register(this._list.onDidChangeFocus(()=>this.onFocus())),this._register(this._list.onDidChangeSelection(v=>this.onListSelection(v))),this._allMenuItems=[...o],this._options?.showFilter&&(this._filterContainer=document.createElement("div"),this._filterContainer.className="action-list-filter",this._filterInput=document.createElement("input"),this._filterInput.type="text",this._filterInput.className="action-list-filter-input",this._filterInput.placeholder=this._options?.filterPlaceholder??d(1813,null),this._filterInput.setAttribute("aria-label",d(1812,null)),this._filterContainer.appendChild(this._filterInput),this._register(j(this._filterInput,"input",()=>{this._filterText=this._filterInput.value,this._applyFilter()}))),this._applyFilter(),this._list.length&&this._focusCheckedOrFirst(),this._filterInput&&this._register(j(this.domNode,"keydown",v=>{this._filterInput&&!sa(this._filterInput)&&v.key.length===1&&v.key!==" "&&!v.ctrlKey&&!v.metaKey&&!v.altKey&&(this._filterInput.focus(),this._filterInput.value=v.key,this._filterText=v.key,this._applyFilter(),v.preventDefault(),v.stopPropagation())}))}get anchorPosition(){if(this._showAbove!==void 0)return this._showAbove?1:0}_toggleSection(e){this._collapsedSections.has(e)?this._collapsedSections.delete(e):this._collapsedSections.add(e),this._applyFilter()}_applyFilter(){let e=this._filterText.toLowerCase(),t=e.length>0,o=[],n=this._list.getFocus(),r;n.length>0&&(r=this._list.element(n[0]));for(let l of this._allMenuItems){if(l.kind==="header"){if(t)continue;o.push(l);continue}if(l.kind==="separator"){if(t||l.section&&this._collapsedSections.has(l.section))continue;o.push(l);continue}if(t){if(l.showAlways){o.push(l);continue}if(l.isSectionToggle)continue;let c=(l.label??"").toLowerCase(),p=(typeof l.description=="string"?l.description:l.description?.value??"").toLowerCase();(c.includes(e)||p.includes(e))&&o.push(l)}else{if(l.isSectionToggle&&l.section){let c=this._collapsedSections.has(l.section);o.push({...l,group:{...l.group,icon:c?M.chevronRight:M.chevronDown}});continue}if(l.section&&this._collapsedSections.has(l.section))continue;o.push(l)}}let s=this._filterInput&&sa(this._filterInput);if(this._list.splice(0,this._list.length,o),this._hasLaidOut){if(this.layout(this._lastMinWidth),s)this._filterInput?.focus(),this._focusCheckedOrFirst();else if(this._list.domFocus(),r){let l=r.item?.id;if(l){for(let c=0;c<this._list.length;c++)if(this._list.element(c).item?.id===l){this._list.setFocus([c]),this._list.reveal(c);break}}}this._contextViewService.layout()}}get filterContainer(){return this._filterContainer}get filterInput(){return this._filterInput}focusCondition(e){return!e.disabled&&e.kind==="action"}focus(){if(this._filterInput&&this._options?.focusFilterOnOpen){this._filterInput.focus(),this._focusCheckedOrFirst();return}this._list.domFocus(),this._focusCheckedOrFirst()}_focusCheckedOrFirst(){this._suppressHover=!0;try{for(let t=0;t<this._list.length;t++){let o=this._list.element(t);if(o.kind==="action"&&o.item?.checked){this._list.setFocus([t]),this._list.reveal(t);return}}this._list.focusFirst(void 0,this.focusCondition);let e=this._list.getFocus();e.length>0&&this._list.reveal(e[0])}finally{this._suppressHover=!1}}hide(e){this._delegate.onHide(e),this.cts.cancel(),this._hover.clear(),this._contextViewService.hideContextView()}clearFilter(){return this._filterInput&&this._filterText?(this._filterInput.value="",this._filterText="",this._applyFilter(),!0):!1}hasDynamicHeight(){return this._options?.showFilter?!0:this._allMenuItems.some(e=>e.isSectionToggle)}computeHeight(){let e=this._list.length,t=0;for(let p=0;p<e;p++)switch(this._list.element(p).kind){case"header":t+=this._headerLineHeight;break;case"separator":t+=this._separatorLineHeight;break;default:t+=this._actionLineHeight;break}let o=this._filterContainer?36:0,n=10,r=Me(this.domNode),s;if(this.hasDynamicHeight()){let p=r.innerHeight,h=yje(this._anchor),g=h.top-r.pageYOffset,f=p-g-h.height-n,v=g-n;if(this._showAbove===void 0){let b=o;for(let S of this._allMenuItems)switch(S.kind){case"header":b+=this._headerLineHeight;break;case"separator":b+=this._separatorLineHeight;break;default:b+=this._actionLineHeight;break}this._showAbove=b>f&&v>f}s=this._showAbove?v:f}else{let p=this._layoutService.getContainer(r).clientHeight,h=this.domNode.getBoundingClientRect().top;s=h>0?p-h-n:p*.7}let l=Math.floor(r.innerHeight*.4),c=Math.min(Math.max(s,this._actionLineHeight*3+o),l);return Math.min(t+o,c)-o}computeMaxWidth(e){let t=this._list.length,o=Math.max(e,this._options?.minWidth??0),n=o,r=this._allMenuItems.length;if(r>=50)return Math.max(380,o);if(this._cachedMaxWidth!==void 0)return this._cachedMaxWidth;if(r>t){let l=[];for(let h=0;h<t;h++)l.push(this._list.element(h));let c=[...this._allMenuItems];this._list.splice(0,t,c);let u=0;for(let h of c)switch(h.kind){case"header":u+=this._headerLineHeight;break;case"separator":u+=this._separatorLineHeight;break;default:u+=this._actionLineHeight;break}this._list.layout(u);let p=[];for(let h=0;h<c.length;h++){let g=this._getRowElement(h);if(g){g.style.width="auto";let f=g.getBoundingClientRect().width;g.style.width="",p.push(f+this._computeToolbarWidth(c[h]))}}return n=Math.max(...p,o),this._list.splice(0,c.length,l),n}let s=[];for(let l=0;l<t;l++){let c=this._getRowElement(l);if(c){c.style.width="auto";let u=c.getBoundingClientRect().width;c.style.width="",s.push(u+this._computeToolbarWidth(this._list.element(l)))}}return Math.max(...s,o)}layout(e){this._hasLaidOut=!0,this._lastMinWidth=e;let t=this.computeHeight();return this._list.layout(t),this._cachedMaxWidth=this.computeMaxWidth(e),this._list.layout(t,this._cachedMaxWidth),this.domNode.style.height=`${t}px`,this._filterContainer&&this._filterContainer.parentElement&&this._filterContainer.parentElement.insertBefore(this._filterContainer,this.domNode),this._cachedMaxWidth}focusPrevious(){if(this._filterInput&&sa(this._filterInput)){this._list.domFocus();let o=this._list.getFocus();if(o.length>0){this._list.focusPrevious(1,!1,void 0,this.focusCondition);let n=this._list.getFocus();n.length>0&&n[0]>=o[0]?this._filterInput.focus():n.length>0&&this._list.reveal(n[0])}else{this._list.focusLast(void 0,this.focusCondition);let n=this._list.getFocus();n.length>0&&this._list.reveal(n[0])}return}let e=this._list.getFocus();this._list.focusPrevious(1,!0,void 0,this.focusCondition);let t=this._list.getFocus();if(t.length>0){if(this._filterInput&&e.length>0&&t[0]>e[0]){this._list.setFocus([]),this._filterInput.focus();return}this._list.reveal(t[0])}}focusNext(){if(this._filterInput&&sa(this._filterInput)){if(this._list.domFocus(),this._list.getFocus().length>0){this._list.focusNext(1,!1,void 0,this.focusCondition);let n=this._list.getFocus();n.length>0&&this._list.reveal(n[0])}else{this._list.focusFirst(void 0,this.focusCondition);let n=this._list.getFocus();n.length>0&&this._list.reveal(n[0])}return}let e=this._list.getFocus();this._list.focusNext(1,!0,void 0,this.focusCondition);let t=this._list.getFocus();if(t.length>0){if(this._filterInput&&e.length>0&&t[0]<e[0]){this._list.setFocus([]),this._filterInput.focus();return}this._list.reveal(t[0])}}collapseFocusedSection(){let e=this._getFocusedSection();e&&!this._collapsedSections.has(e)&&this._toggleSection(e)}expandFocusedSection(){let e=this._getFocusedSection();e&&this._collapsedSections.has(e)&&this._toggleSection(e)}toggleFocusedSection(){let e=this._list.getFocus();if(e.length===0)return!1;let t=this._list.element(e[0]);return t.isSectionToggle&&t.section?(this._toggleSection(t.section),!0):!1}_getFocusedSection(){let e=this._list.getFocus();if(e.length===0)return;let t=this._list.element(e[0]);return t.isSectionToggle&&t.section,t.section}acceptSelected(e){let t=this._list.getFocus();if(t.length===0)return;let o=t[0],n=this._list.element(o);if(!this.focusCondition(n))return;let r=e?new lIt:new Rii;this._list.setSelection([o],r)}onListSelection(e){if(!e.elements.length)return;let t=e.elements[0];if(t.isSectionToggle){this._list.setSelection([]);return}t.item&&this.focusCondition(t)?this._delegate.onSelect(t.item,e.browserEvent instanceof lIt):this._list.setSelection([])}onFocus(){let e=this._list.getFocus();if(e.length===0)return;let t=e[0],o=this._list.element(t);this._delegate.onFocus?.(o.item),this._suppressHover||this._showHoverForElement(o,t)}_removeItem(e){let t=this._allMenuItems.indexOf(e);t>=0&&(this._allMenuItems.splice(t,1),this._applyFilter())}_computeToolbarWidth(e){let t=e.toolbarActions?.length??0;return e.onRemove&&t++,t===0?0:t*22+6}_getRowElement(e){return this.domNode.ownerDocument.getElementById(this._list.getElementID(e))}_showHoverForElement(e,t){let o;if(e.hover?.content){let n=this._getRowElement(t);if(n){let r=typeof e.hover.content=="string"?new xe(e.hover.content):e.hover.content;o=this._hoverService.showDelayedHover({content:r??"",target:n,additionalClasses:["action-widget-hover"],position:{hoverPosition:0,forcePosition:!1,...e.hover.position},appearance:{showPointer:!0}},{groupId:"actionListHover"})}}this._hover.value=o}async onListHover(e){let t=e.element;if(t&&t.item&&this.focusCondition(t)){if(Ao(e.browserEvent.target)&&e.browserEvent.target.closest(".action-list-item-toolbar")!==null){this._list.setFocus([]);return}if(this._list.setFocus(typeof e.index=="number"?[e.index]:[]),this._delegate.onHover&&!t.disabled&&t.kind==="action"){let n=await this._delegate.onHover(t.item,this.cts.token),r=n?n.canPreview:void 0;r!==t.canPreview&&(t.canPreview=r,typeof e.index=="number"&&(this._list.splice(e.index,1,[t]),this._list.setFocus([e.index])))}}else t&&t.hover?.content&&typeof e.index=="number"&&this._showHoverForElement(t,e.index)}onListClick(e){if(e.element&&e.element.isSectionToggle&&e.element.section){let t=e.element.section;queueMicrotask(()=>this._toggleSection(t));return}e.element&&this.focusCondition(e.element)&&this._list.setFocus([])}};vwe=I([m(7,_n),m(8,_e),m(9,nc),m(10,tt),m(11,Qe)],vwe);function cIt(a){return a.replace(/\r\n|\r|\n/g," ")}J("actionBar.toggledBackground",dW,d(1820,null));var hE={Visible:new Q("codeActionMenuVisible",!1,d(1823,null)),FilterFocused:new Q("codeActionMenuFilterFocused",!1,d(1822,null))},nl=ae("actionWidgetService"),KM=class extends C{constructor(e,t,o){super();this._contextViewService=e;this._contextKeyService=t;this._instantiationService=o;this._list=this._register(new me)}get isVisible(){return hE.Visible.getValue(this._contextKeyService)||!1}show(e,t,o,n,r,s,l,c,u){let p=hE.Visible.bindTo(this._contextKeyService),h=this._instantiationService.createInstance(vwe,e,t,o,n,c,u,r);this._contextViewService.showContextView({getAnchor:()=>r,render:g=>(p.set(!0),this._renderWidget(g,h,l??[])),onHide:g=>{p.reset(),this._onWidgetClosed(g)},get anchorPosition(){return h.anchorPosition}},s,!1)}acceptSelected(e){this._list.value?.acceptSelected(e)}focusPrevious(){this._list?.value?.focusPrevious()}focusNext(){this._list?.value?.focusNext()}collapseSection(){this._list?.value?.collapseFocusedSection()}expandSection(){this._list?.value?.expandFocusedSection()}toggleSection(){return this._list?.value?.toggleFocusedSection()??!1}clearFilter(){return this._list?.value?.clearFilter()??!1}hide(e){this._list.value?.hide(e),this._list.clear()}clear(){this._list.clear()}_renderWidget(e,t,o){let n=document.createElement("div");if(n.classList.add("action-widget"),e.appendChild(n),this._list.value=t,this._list.value)this._list.value.filterContainer&&n.appendChild(this._list.value.filterContainer),n.appendChild(this._list.value.domNode);else throw new Error("List has no value");let r=new P,s=document.createElement("div"),l=e.appendChild(s);l.classList.add("context-view-block"),r.add(j(l,re.MOUSE_DOWN,v=>v.stopPropagation()));let c=document.createElement("div"),u=e.appendChild(c);u.classList.add("context-view-pointerBlock"),r.add(j(u,re.POINTER_MOVE,()=>u.remove())),r.add(j(u,re.MOUSE_DOWN,()=>u.remove()));let p=0;if(o.length){let v=this._createActionBar(".action-widget-action-bar",o);v&&(n.appendChild(v.getContainer().parentElement),r.add(v),p=v.getContainer().offsetWidth)}let h=this._list.value?.layout(p);n.style.width=`${h}px`,this._list.value?.focus();let g=hE.FilterFocused.bindTo(this._contextKeyService);if(r.add({dispose:()=>g.reset()}),this._list.value?.filterInput){let v=this._list.value.filterInput;r.add(j(v,"focus",()=>g.set(!0))),r.add(j(v,"blur",()=>g.set(!1)))}let f=r.add(Vn(e));return r.add(f.onDidBlur(()=>{Pn()?.closest(".action-widget-hover")||this.hide(!0)})),r}_createActionBar(e,t){if(!t.length)return;let o=_(e),n=new ji(o);return n.push(t,{icon:!1,label:!0}),n}_onWidgetClosed(e){this._list.value?.hide(e)}};KM=I([m(0,_n),m(1,X),m(2,F)],KM);we(nl,KM,1);var Mq=1100;W(class extends K{constructor(){super({id:"hideCodeActionWidget",title:L(1826,"Hide action widget"),precondition:hE.Visible,keybinding:{weight:Mq,primary:9,secondary:[1033]}})}run(a){a.get(nl).hide(!0)}});W(class extends K{constructor(){super({id:"clearFilterCodeActionWidget",title:L(1821,"Clear action widget filter"),precondition:x.and(hE.Visible,hE.FilterFocused),keybinding:{weight:Mq+1,primary:9}})}run(a){let i=a.get(nl);i instanceof KM&&(i.clearFilter()||i.hide(!0))}});W(class extends K{constructor(){super({id:"selectPrevCodeAction",title:L(1829,"Select previous action"),precondition:hE.Visible,keybinding:{weight:Mq,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})}run(a){let i=a.get(nl);i instanceof KM&&i.focusPrevious()}});W(class extends K{constructor(){super({id:"selectNextCodeAction",title:L(1828,"Select next action"),precondition:hE.Visible,keybinding:{weight:Mq,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})}run(a){let i=a.get(nl);i instanceof KM&&i.focusNext()}});W(class extends K{constructor(){super({id:"collapseSectionCodeAction",title:L(1824,"Collapse section"),precondition:x.and(hE.Visible,hE.FilterFocused.negate()),keybinding:{weight:Mq,primary:15}})}run(a){let i=a.get(nl);i instanceof KM&&i.collapseSection()}});W(class extends K{constructor(){super({id:"expandSectionCodeAction",title:L(1825,"Expand section"),precondition:x.and(hE.Visible,hE.FilterFocused.negate()),keybinding:{weight:Mq,primary:17}})}run(a){let i=a.get(nl);i instanceof KM&&i.expandSection()}});W(class extends K{constructor(){super({id:"toggleSectionCodeAction",title:L(1830,"Toggle section"),precondition:x.and(hE.Visible,hE.FilterFocused.negate()),keybinding:{weight:Mq,primary:10}})}run(a){let i=a.get(nl);i instanceof KM&&(i.toggleSection()||i.acceptSelected())}});W(class extends K{constructor(){super({id:Mii,title:L(1819,"Accept selected action"),precondition:hE.Visible,keybinding:{weight:Mq,primary:3,secondary:[2137]}})}run(a){let i=a.get(nl);i instanceof KM&&i.acceptSelected()}});W(class extends K{constructor(){super({id:Pii,title:L(1827,"Preview selected action"),precondition:hE.Visible,keybinding:{weight:Mq,primary:2051}})}run(a){let i=a.get(nl);i instanceof KM&&i.acceptSelected(!0)}});var Vae=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.typeId=e;this.editor=t;this.showCommand=n;this.range=r;this.edits=s;this.onSelectNewEdit=l;this.additionalActions=c;this._keybindingService=p;this._actionWidgetService=h;this.allowEditorOverflow=!0;this.suppressMouseDown=!0;this.create(),this.visibleContext=o.bindTo(u),this.visibleContext.set(!0),this._register(Z(()=>this.visibleContext.reset())),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this),this._register(Z((()=>this.editor.removeContentWidget(this)))),this._register(this.editor.onDidChangeCursorPosition(g=>{this.dispose()})),this._register(H.runAndSubscribe(p.onDidUpdateKeybindings,()=>{this._updateButtonTitle()}))}static{this.baseId="editor.widget.postEditWidget"}_updateButtonTitle(){this.button.element.title=this._keybindingService.appendKeybinding(this.showCommand.label,this.showCommand.id)}create(){this.domNode=_(".post-edit-widget"),this.button=this._register(new Mi(this.domNode,{supportIcons:!0})),this.button.label="$(insert)",this._register(j(this.domNode,re.CLICK,()=>this.showSelector()))}getId(){return Vae.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:this.range.getEndPosition(),preference:[2]}}showSelector(){let e=Yn(this.button.element),t={x:e.left+e.width,y:e.top+e.height};this._actionWidgetService.show("postEditWidget",!1,this.edits.allEdits.map((o,n)=>({kind:"action",item:o,label:o.title,disabled:!1,canPreview:!1,group:{title:"",icon:q.fromId(n===this.edits.activeEditIndex?M.check.id:M.blank.id)}})),{onHide:()=>{this.editor.focus()},onSelect:o=>{this._actionWidgetService.hide(!1);let n=this.edits.allEdits.findIndex(r=>r===o);if(n!==this.edits.activeEditIndex)return this.onSelectNewEdit(n)}},t,this.editor.getDomNode()??void 0,this.additionalActions)}};Vae=I([m(8,X),m(9,_e),m(10,nl)],Vae);var c7=class extends C{constructor(e,t,o,n,r,s,l,c){super();this._id=e;this._editor=t;this._visibleContext=o;this._showCommand=n;this._getAdditionalActions=r;this._instantiationService=s;this._bulkEditService=l;this._notificationService=c;this._currentWidget=this._register(new me);this._register(H.any(t.onDidChangeModel,t.onDidChangeModelContent)(()=>this.clear()))}async applyEditAndShowIfNeeded(e,t,o,n,r){if(!e.length||!this._editor.hasModel())return;let s=this._editor.getModel(),l=t.allEdits.at(t.activeEditIndex);if(!l)return;let c=async y=>{let w=this._editor.getModel();w&&(await w.undo(),this.applyEditAndShowIfNeeded(e,{activeEditIndex:y,allEdits:t.allEdits},o,n,r))},u=(y,w)=>{so(y)||(this._notificationService.error(w),o&&this.show(e[0],t,c))},p=new Ex(this._editor,3,void 0,r),h;try{h=await pm(n(l,p.token),p.token)}catch(y){return u(y,d(1093,null,l.title,In(y)))}finally{p.dispose()}if(r.isCancellationRequested)return;let g=rIt(s.uri,e,h),f=e[0],v=s.deltaDecorations([],[{range:f,options:{description:"paste-line-suffix",stickiness:0}}]);this._editor.focus();let b,S;try{b=await this._bulkEditService.apply(g,{editor:this._editor,token:r}),S=s.getDecorationRange(v[0])}catch(y){return u(y,d(1092,null,l.title,In(y)))}finally{s.deltaDecorations(v,[])}r.isCancellationRequested||o&&b.isApplied&&t.allEdits.length>1&&this.show(S??f,t,c)}show(e,t,o){this.clear(),this._editor.hasModel()&&(this._currentWidget.value=this._instantiationService.createInstance(Vae,this._id,this._editor,this._visibleContext,this._showCommand,e,t,o,this._getAdditionalActions()))}clear(){this._currentWidget.clear()}tryShowSelector(){this._currentWidget.value?.showSelector()}};c7=I([m(5,F),m(6,ma),m(7,Ne)],c7);var Nii="editor.changePasteType",o5e="editor.pasteAs.preferences",dIt=new Q("pasteWidgetVisible",!1,d(1078,null)),Aii="application/vnd.code.copymetadata",ou=class extends C{constructor(e,t,o,n,r,s,l,c,u,p){super();this._logService=o;this._bulkEditService=n;this._clipboardService=r;this._commandService=s;this._configService=l;this._languageFeaturesService=c;this._quickInputService=u;this._progressService=p;this._editor=e,this._register(e.onWillCopy(h=>this.handleCopy(h))),this._register(e.onWillCut(h=>this.handleCopy(h))),this._register(e.onWillPaste(h=>this.handlePaste(h))),this._pasteProgressManager=this._register(new a7("pasteIntoEditor",e,t)),this._postPasteWidgetManager=this._register(t.createInstance(c7,"pasteIntoEditor",e,dIt,{id:Nii,label:d(1079,null)},()=>ou._configureDefaultAction?[ou._configureDefaultAction]:[]))}static{this.ID="editor.contrib.copyPasteActionController"}static get(e){return e.getContribution(ou.ID)}static setConfigureDefaultAction(e){ou._configureDefaultAction=e}changePasteType(){this._postPasteWidgetManager.tryShowSelector()}async pasteAs(e){this._logService.trace("CopyPasteController.pasteAs"),this._editor.focus();try{this._logService.trace("Before calling editor.action.clipboardPasteAction"),this._pasteAsActionContext={preferred:e},await this._commandService.executeCommand("editor.action.clipboardPasteAction")}finally{this._pasteAsActionContext=void 0}}clearWidgets(){this._postPasteWidgetManager.clear()}isPasteAsEnabled(){return this._editor.getOption(97).enabled}async finishedPaste(){await this._currentPasteOperation}handleCopy(e){if(this._logService.trace("CopyPasteController#handleCopy"),!this._editor.hasTextFocus()||(this._clipboardService.clearInternalState?.(),!this.isPasteAsEnabled()))return;let t=this._editor.getModel(),o=this._editor._getViewModel(),n=this._editor.getSelections();if(!t||!o||!n?.length)return;let r={multicursorText:e.dataToCopy.multicursorText??null,pasteOnNewLine:e.dataToCopy.isFromEmptySelection,mode:null},s=this._languageFeaturesService.documentPasteEditProvider.ordered(t).filter(h=>!!h.prepareDocumentPaste);if(!s.length){this.setCopyMetadata(e.clipboardData,{defaultPastePayload:r});return}let l=new bx,c=s.flatMap(h=>h.copyMimeTypes??[]),u=_t();this.setCopyMetadata(e.clipboardData,{id:u,providerCopyMimeTypes:c,defaultPastePayload:r});let p=s.map(h=>({providerMimeTypes:h.copyMimeTypes,operation:xn(g=>h.prepareDocumentPaste(t,e.dataToCopy.sourceRanges,l,g).catch(f=>{console.error(f)}))}));ou._currentCopyOperation?.operations.forEach(h=>h.operation.cancel()),ou._currentCopyOperation={handle:u,operations:p}}async handlePaste(e){if(this._logService.trace("CopyPasteController#handlePaste for id : ",e.metadata?.id),!this._editor.hasTextFocus())return;let t=e.toExternalVSDataTransfer();if(!t)return;t.delete(Aii),iu.get(this._editor)?.closeMessage(),this._currentPasteOperation?.cancel(),this._currentPasteOperation=void 0;let o=this._editor.getModel(),n=this._editor.getSelections();if(!n?.length||!o||this._editor.getOption(104)||!this.isPasteAsEnabled()&&!this._pasteAsActionContext)return;let r=this.fetchCopyMetadata(e);this._logService.trace("CopyPasteController#handlePaste with metadata : ",r?.id," and text.length : ",e.clipboardData.getData("text/plain").length);let s=Array.from(e.clipboardData.files).map(u=>u.type),l=[...e.clipboardData.types,...s,...r?.providerCopyMimeTypes??[],Zn.uriList],c=this._languageFeaturesService.documentPasteEditProvider.ordered(o).filter(u=>{let p=this._pasteAsActionContext?.preferred;return p&&!this.providerMatchesPreference(u,p)?!1:u.pasteMimeTypes?.some(h=>Y$e(h,l))});if(!c.length){this._pasteAsActionContext?.preferred&&(this.showPasteAsNoEditMessage(n,this._pasteAsActionContext.preferred),e.setHandled());return}e.setHandled(),this._pasteAsActionContext?this.showPasteAsPick(this._pasteAsActionContext.preferred,c,n,t,r):this.doPasteInline(c,n,t,r,e.browserEvent)}showPasteAsNoEditMessage(e,t){let o="only"in t?t.only.value:"preferences"in t?t.preferences.length?t.preferences.map(n=>n.value).join(", "):d(1072,null):t.providerId;iu.get(this._editor)?.showMessage(d(1074,null,o),e[0].getStartPosition())}doPasteInline(e,t,o,n,r){this._logService.trace("CopyPasteController#doPasteInline");let s=this._editor;if(!s.hasModel())return;let l=new Ex(s,3,void 0),c=xn(async u=>{let p=this._editor;if(!p.hasModel())return;let h=p.getModel(),g=new P,f=g.add(new $e(u));g.add(l.token.onCancellationRequested(()=>f.cancel()));let v=f.token;try{if(await this.mergeInDataFromCopy(e,o,n,v),v.isCancellationRequested)return;let b=e.filter(w=>this.isSupportedPasteProvider(w,o));if(!b.length||b.length===1&&b[0]instanceof Rq)return this.applyDefaultPasteHandler(o,n,v,r);let S={triggerKind:0},y=await this.getPasteEdits(b,o,h,t,S,v);if(g.add(y),v.isCancellationRequested)return;if(y.edits.length===1&&y.edits[0].provider instanceof Rq)return this.applyDefaultPasteHandler(o,n,v,r);if(y.edits.length){let w=p.getOption(97).showPasteSelector==="afterPaste";return this._postPasteWidgetManager.applyEditAndShowIfNeeded(t,{activeEditIndex:this.getInitialActiveEditIndex(h,y.edits),allEdits:y.edits},w,async(k,T)=>{if(!k.provider.resolveDocumentPasteEdit)return k;let N=k.provider.resolveDocumentPasteEdit(k,T),O=new Go,V=await this._pasteProgressManager.showWhile(t[0].getEndPosition(),d(1080,null,k.title),wa(Promise.race([O.p,N]),T),{cancel:()=>O.cancel()},0);return V&&(k.insertText=V.insertText,k.additionalEdit=V.additionalEdit),k},v)}await this.applyDefaultPasteHandler(o,n,v,r)}finally{g.dispose(),this._currentPasteOperation===c&&(this._currentPasteOperation=void 0)}});this._pasteProgressManager.showWhile(t[0].getEndPosition(),d(1077,null),c,{cancel:async()=>{c.cancel(),!l.token.isCancellationRequested&&await this.applyDefaultPasteHandler(o,n,l.token,r)}}).finally(()=>{l.dispose()}),this._currentPasteOperation=c}showPasteAsPick(e,t,o,n,r){this._logService.trace("CopyPasteController#showPasteAsPick");let s=xn(async l=>{let c=this._editor;if(!c.hasModel())return;let u=c.getModel(),p=new P,h=p.add(new Ex(c,3,void 0,l));try{if(await this.mergeInDataFromCopy(t,n,r,h.token),h.token.isCancellationRequested)return;let g=t.filter(y=>this.isSupportedPasteProvider(y,n,e));e&&(g=g.filter(y=>this.providerMatchesPreference(y,e)));let f={triggerKind:1,only:e&&"only"in e?e.only:void 0},v=p.add(await this.getPasteEdits(g,n,u,o,f,h.token));if(h.token.isCancellationRequested)return;if(e&&(v={edits:v.edits.filter(y=>"only"in e?e.only.contains(y.kind):"preferences"in e?e.preferences.some(w=>w.contains(y.kind)):e.providerId===y.provider.id),dispose:v.dispose}),!v.edits.length){e&&this.showPasteAsNoEditMessage(o,e);return}let b;if(e)b=v.edits.at(0);else{let y={id:"editor.pasteAs.default",label:d(1073,null),edit:void 0},w=await this._quickInputService.pick([...v.edits.map(k=>({label:k.title,description:k.kind?.value,edit:k})),...ou._configureDefaultAction?[{type:"separator"},{label:ou._configureDefaultAction.label,edit:void 0}]:[]],{placeHolder:d(1075,null)});if(w===y){ou._configureDefaultAction?.run();return}b=w?.edit}if(!b)return;let S=rIt(u.uri,o,b);await this._bulkEditService.apply(S,{editor:this._editor})}finally{p.dispose(),this._currentPasteOperation===s&&(this._currentPasteOperation=void 0)}});this._progressService.withProgress({location:10,title:d(1076,null)},()=>s)}setCopyMetadata(e,t){this._logService.trace("CopyPasteController#setCopyMetadata new id : ",t.id),e.setData(Aii,JSON.stringify(t))}fetchCopyMetadata(e){this._logService.trace("CopyPasteController#fetchCopyMetadata");let t=e.clipboardData.getData(Aii);if(t)try{return JSON.parse(t)}catch{return}if(e.metadata)return{defaultPastePayload:{mode:e.metadata.mode,multicursorText:e.metadata.multicursorText??null,pasteOnNewLine:!!e.metadata.isFromEmptySelection}}}async mergeInDataFromCopy(e,t,o,n){if(this._logService.trace("CopyPasteController#mergeInDataFromCopy with metadata : ",o?.id),o?.id&&ou._currentCopyOperation?.handle===o.id){let r=ou._currentCopyOperation.operations.filter(l=>e.some(c=>c.pasteMimeTypes.some(u=>Y$e(u,l.providerMimeTypes)))).map(l=>l.operation),s=await Promise.all(r);if(n.isCancellationRequested)return;for(let l of s.reverse())if(l)for(let[c,u]of l)t.replace(c,u)}if(!t.has(Zn.uriList)){let r=await this._clipboardService.readResources();if(n.isCancellationRequested)return;r.length&&t.append(Zn.uriList,NN(Uy.create(r)))}}async getPasteEdits(e,t,o,n,r,s){let l=new P,c=await wa(Promise.all(e.map(async p=>{try{let h=await p.provideDocumentPasteEdits?.(o,n,t,r,s);return h&&l.add(h),h?.edits?.map(g=>({...g,provider:p}))}catch(h){so(h)||console.error(h);return}})),s),u=si(c??[]).flat().filter(p=>!r.only||r.only.contains(p.kind));return{edits:sIt(u),dispose:()=>l.dispose()}}async applyDefaultPasteHandler(e,t,o,n){let s=await(e.get(Zn.text)??e.get("text"))?.asString()??"";if(o.isCancellationRequested)return;let l={clipboardEvent:n,text:s,pasteOnNewLine:t?.defaultPastePayload.pasteOnNewLine??!1,multicursorText:t?.defaultPastePayload.multicursorText??null,mode:null};this._logService.trace("CopyPasteController#applyDefaultPasteHandler for id : ",t?.id),this._editor.trigger("keyboard","paste",l)}isSupportedPasteProvider(e,t,o){return e.pasteMimeTypes?.some(n=>t.matches(n))?!o||this.providerMatchesPreference(e,o):!1}providerMatchesPreference(e,t){return"only"in t?e.providedPasteEditKinds.some(o=>t.only.contains(o)):"preferences"in t?t.preferences.some(o=>t.preferences.some(n=>n.contains(o))):e.id===t.providerId}getInitialActiveEditIndex(e,t){let o=this._configService.getValue(o5e,{resource:e.uri});for(let n of Array.isArray(o)?o:[]){let r=new Is(n),s=t.findIndex(l=>r.contains(l.kind));if(s>=0)return s}return 0}};ou=I([m(1,F),m(2,ne),m(3,ma),m(4,Wi),m(5,ge),m(6,B),m(7,zt),m(8,Ge),m(9,Bo)],ou);var Bae="9_cutcopypaste",I0o=kr||document.queryCommandSupported("cut"),H4i=kr||document.queryCommandSupported("copy"),y0o=typeof navigator.clipboard>"u"||yc?document.queryCommandSupported("paste"):!0;function Wii(a){return a.register(),a}var EW=I0o?Wii(new SN({id:"editor.action.clipboardCutAction",precondition:void 0,kbOpts:kr?{primary:2102,win:{primary:2102,secondary:[1044]},weight:100}:void 0,menuOpts:[{menuId:D.MenubarEditMenu,group:"2_ccp",title:d(982,null),order:1},{menuId:D.EditorContext,group:Bae,title:d(978,null),when:ue.writable,order:1},{menuId:D.CommandPalette,group:"",title:d(978,null),order:1},{menuId:D.SimpleEditorContext,group:Bae,title:d(978,null),when:ue.writable,order:1}]})):void 0,$M=H4i?Wii(new SN({id:"editor.action.clipboardCopyAction",precondition:void 0,kbOpts:kr?{primary:2081,win:{primary:2081,secondary:[2067]},weight:100}:void 0,menuOpts:[{menuId:D.MenubarEditMenu,group:"2_ccp",title:d(981,null),order:2},{menuId:D.EditorContext,group:Bae,title:d(976,null),order:2},{menuId:D.CommandPalette,group:"",title:d(976,null),order:1},{menuId:D.SimpleEditorContext,group:Bae,title:d(976,null),order:2}]})):void 0;fe.appendMenuItem(D.MenubarEditMenu,{submenu:D.MenubarCopy,title:L(980,"Copy As"),group:"2_ccp",order:3});fe.appendMenuItem(D.EditorContext,{submenu:D.EditorContextCopy,title:L(980,"Copy As"),group:Bae,order:3});fe.appendMenuItem(D.EditorContext,{submenu:D.EditorContextShare,title:L(984,"Share"),group:"11_share",order:-1,when:x.and(x.notEquals("resourceScheme","output"),ue.editorTextFocus)});fe.appendMenuItem(D.ExplorerContext,{submenu:D.ExplorerContextShare,title:L(984,"Share"),group:"11_share",order:-1});var GM=y0o?Wii(new SN({id:"editor.action.clipboardPasteAction",precondition:void 0,kbOpts:kr?{primary:2100,win:{primary:2100,secondary:[1043]},linux:{primary:2100,secondary:[1043]},weight:100}:void 0,menuOpts:[{menuId:D.MenubarEditMenu,group:"2_ccp",title:d(983,null),order:4},{menuId:D.EditorContext,group:Bae,title:d(979,null),when:ue.writable,order:4},{menuId:D.CommandPalette,group:"",title:d(979,null),order:1},{menuId:D.SimpleEditorContext,group:Bae,title:d(979,null),when:ue.writable,order:4}]})):void 0,Oii=class extends xi{constructor(){super({id:"editor.action.clipboardCopyWithSyntaxHighlightingAction",label:L(977,"Copy with Syntax Highlighting"),precondition:void 0,kbOpts:{kbExpr:ue.textInputFocus,primary:0,weight:100}})}run(i,e){let t=i.get(ne),o=i.get(Wi);t.trace("ExecCommandCopyWithSyntaxHighlightingAction#run"),!(!e.hasModel()||!e.getOption(45)&&e.getSelection().isEmpty())&&(zU.forceCopyWithSyntaxHighlighting=!0,e.focus(),t.trace("ExecCommandCopyWithSyntaxHighlightingAction (before execCommand copy)"),Fii(e,o),t.trace("ExecCommandCopyWithSyntaxHighlightingAction (after execCommand copy)"),zU.forceCopyWithSyntaxHighlighting=!1)}};function Fii(a,i){if(zU.electronBugWorkaroundCopyEventHasFired=!1,a.getContainerDomNode().ownerDocument.execCommand("copy"),kr&&zU.electronBugWorkaroundCopyEventHasFired===!1){let{dataToCopy:e}=H$i(a._getViewModel(),void 0,yc);i.writeText(e.text)}}function U4i(a,i){a&&(a.addImplementation(1e4,"code-editor",(e,t)=>{let o=e.get(ne),n=e.get(Wi);o.trace("registerExecCommandImpl (addImplementation code-editor for : ",i,")");let r=e.get(Kt).getFocusedCodeEditor();if(r&&r.hasTextFocus()&&r.hasModel()){let s=r.getOption(45),l=r.getSelection();return l&&l.isEmpty()&&!s||(r.getOption(170)&&i==="cut"?(B4i(r),o.trace("registerExecCommandImpl (before execCommand copy)"),Fii(r,n),r.trigger(void 0,"cut",void 0),o.trace("registerExecCommandImpl (after execCommand copy)")):(B4i(r),o.trace("registerExecCommandImpl (before execCommand "+i+")"),i==="copy"?Fii(r,n):r.getContainerDomNode().ownerDocument.execCommand(i),o.trace("registerExecCommandImpl (after execCommand "+i+")"))),!0}return!1}),a.addImplementation(0,"generic-dom",(e,t)=>{let o=e.get(ne);return o.trace("registerExecCommandImpl (addImplementation generic-dom for : ",i,")"),o.trace("registerExecCommandImpl (before execCommand "+i+")"),rh().execCommand(i),o.trace("registerExecCommandImpl (after execCommand "+i+")"),!0}))}function B4i(a){if(a.getOption(170)){let e=iae.get(a.getId());e&&e.handleWillCopy()}}U4i(EW,"cut");U4i($M,"copy");GM&&(GM.addImplementation(1e4,"code-editor",(a,i)=>{let e=a.get(ne);e.trace("registerExecCommandImpl (addImplementation code-editor for : paste)");let t=a.get(Kt),o=a.get(Wi),n=t.getFocusedCodeEditor();if(n&&n.hasModel()&&n.hasTextFocus()){if(n.getOption(170)){let l=iae.get(n.getId());l&&l.handleWillPaste()}e.trace("registerExecCommandImpl (before triggerPaste)");let s=o.triggerPaste(Ki().vscodeWindowId);return s?(e.trace("registerExecCommandImpl (triggerPaste defined)"),s.then(async()=>(e.trace("registerExecCommandImpl (after triggerPaste)"),ou.get(n)?.finishedPaste()??Promise.resolve()))):(e.trace("registerExecCommandImpl (triggerPaste undefined)"),Gt?(e.trace("registerExecCommandImpl (Paste handling on web)"),(async()=>{let l=await o.readText();if(l!==""){let c=S9.INSTANCE.get(l),u=!1,p=null,h=null;c&&(u=n.getOption(45)&&!!c.isFromEmptySelection,p=typeof c.multicursorText<"u"?c.multicursorText:null,h=c.mode),e.trace("registerExecCommandImpl (clipboardText.length : ",l.length," id : ",c?.id,")"),n.trigger("keyboard","paste",{text:l,pasteOnNewLine:u,multicursorText:p,mode:h})}})()):!0)}return!1}),GM.addImplementation(0,"generic-dom",(a,i)=>(a.get(ne).trace("registerExecCommandImpl (addImplementation generic-dom for : paste)"),a.get(Wi).triggerPaste(Ki().vscodeWindowId)??!1)));H4i&&Jt(Oii);var nC=Object.freeze({id:"editor",order:5,type:"object",title:d(269,null),scope:6}),bwe={...nC,properties:{"editor.tabSize":{type:"number",default:iv.tabSize,minimum:1,maximum:100,markdownDescription:d(297,null,"`#editor.detectIndentation#`")},"editor.indentSize":{anyOf:[{type:"string",enum:["tabSize"]},{type:"number",minimum:1}],default:"tabSize",markdownDescription:d(275,null)},"editor.insertSpaces":{type:"boolean",default:iv.insertSpaces,markdownDescription:d(276,null,"`#editor.detectIndentation#`")},"editor.detectIndentation":{type:"boolean",default:iv.detectIndentation,markdownDescription:d(258,null,"`#editor.tabSize#`","`#editor.insertSpaces#`")},"editor.trimAutoWhitespace":{type:"boolean",default:iv.trimAutoWhitespace,description:d(298,null)},"editor.largeFileOptimizations":{type:"boolean",default:iv.largeFileOptimizations,description:d(277,null)},"editor.wordBasedSuggestions":{enum:["off","offWithInlineSuggestions","currentDocument","matchingDocuments","allDocuments"],default:"offWithInlineSuggestions",enumDescriptions:[d(305,null),d(306,null),d(303,null),d(304,null),d(302,null)],description:d(301,null),experiment:{mode:"auto"}},"editor.semanticHighlighting.enabled":{enum:[!0,!1,"configuredByTheme"],enumDescriptions:[d(292,null),d(291,null),d(289,null)],default:"configuredByTheme",description:d(290,null)},"editor.stablePeek":{type:"boolean",default:!1,markdownDescription:d(296,null)},"editor.maxTokenizationLineLength":{type:"integer",default:2e4,description:d(280,null)},"editor.experimental.asyncTokenization":{type:"boolean",default:!0,description:d(261,null),tags:["experimental"]},"editor.experimental.asyncTokenizationLogging":{type:"boolean",default:!1,description:d(262,null)},"editor.experimental.asyncTokenizationVerification":{type:"boolean",default:!1,description:d(263,null),tags:["experimental"]},"editor.experimental.treeSitterTelemetry":{type:"boolean",default:!1,markdownDescription:d(268,null),tags:["experimental"],experiment:{mode:"auto"}},"editor.experimental.preferTreeSitter.css":{type:"boolean",default:!1,markdownDescription:d(264,null),tags:["experimental"],experiment:{mode:"auto"}},"editor.experimental.preferTreeSitter.typescript":{type:"boolean",default:!1,markdownDescription:d(267,null),tags:["experimental"],experiment:{mode:"auto"}},"editor.experimental.preferTreeSitter.ini":{type:"boolean",default:!1,markdownDescription:d(265,null),tags:["experimental"],experiment:{mode:"auto"}},"editor.experimental.preferTreeSitter.regex":{type:"boolean",default:!1,markdownDescription:d(266,null),tags:["experimental"],experiment:{mode:"auto"}},"editor.language.brackets":{type:["array","null"],default:null,description:d(285,null),items:{type:"array",items:[{type:"string",description:d(288,null)},{type:"string",description:d(286,null)}]}},"editor.language.colorizedBracketPairs":{type:["array","null"],default:null,description:d(287,null),items:{type:"array",items:[{type:"string",description:d(288,null)},{type:"string",description:d(286,null)}]}},"diffEditor.maxComputationTime":{type:"number",default:jb.maxComputationTime,description:d(278,null)},"diffEditor.maxFileSize":{type:"number",default:jb.maxFileSize,description:d(279,null)},"diffEditor.renderSideBySide":{type:"boolean",default:jb.renderSideBySide,description:d(295,null)},"diffEditor.renderSideBySideInlineBreakpoint":{type:"number",default:jb.renderSideBySideInlineBreakpoint,description:d(284,null)},"diffEditor.useInlineViewWhenSpaceIsLimited":{type:"boolean",default:jb.useInlineViewWhenSpaceIsLimited,description:d(299,null)},"diffEditor.renderMarginRevertIcon":{type:"boolean",default:jb.renderMarginRevertIcon,description:d(283,null)},"diffEditor.renderGutterMenu":{type:"boolean",default:jb.renderGutterMenu,description:d(281,null)},"diffEditor.ignoreTrimWhitespace":{type:"boolean",default:jb.ignoreTrimWhitespace,description:d(274,null)},"diffEditor.renderIndicators":{type:"boolean",default:jb.renderIndicators,description:d(282,null)},"diffEditor.codeLens":{type:"boolean",default:jb.diffCodeLens,description:d(257,null)},"diffEditor.wordWrap":{type:"string",enum:["off","on","inherit"],default:jb.diffWordWrap,markdownEnumDescriptions:[d(308,null),d(309,null),d(307,null,"`#editor.wordWrap#`")]},"diffEditor.diffAlgorithm":{type:"string",enum:["legacy","advanced"],default:jb.diffAlgorithm,markdownEnumDescriptions:[d(260,null),d(259,null)]},"diffEditor.hideUnchangedRegions.enabled":{type:"boolean",default:jb.hideUnchangedRegions.enabled,markdownDescription:d(271,null)},"diffEditor.hideUnchangedRegions.revealLineCount":{type:"integer",default:jb.hideUnchangedRegions.revealLineCount,markdownDescription:d(273,null),minimum:1},"diffEditor.hideUnchangedRegions.minimumLineCount":{type:"integer",default:jb.hideUnchangedRegions.minimumLineCount,markdownDescription:d(272,null),minimum:1},"diffEditor.hideUnchangedRegions.contextLineCount":{type:"integer",default:jb.hideUnchangedRegions.contextLineCount,markdownDescription:d(270,null),minimum:1},"diffEditor.experimental.showMoves":{type:"boolean",default:jb.experimental.showMoves,markdownDescription:d(294,null)},"diffEditor.experimental.showEmptyDecorations":{type:"boolean",default:jb.experimental.showEmptyDecorations,description:d(293,null)},"diffEditor.experimental.useTrueInlineView":{type:"boolean",default:jb.experimental.useTrueInlineView,description:d(300,null)}}};function w0o(a){return typeof a.type<"u"||typeof a.anyOf<"u"}for(let a of hU){let i=a.schema;if(typeof i<"u")if(w0o(i))bwe.properties[`editor.${a.name}`]=i;else for(let e in i)Object.hasOwnProperty.call(i,e)&&(bwe.properties[e]=i[e])}var C0o=oe.as(ii.Configuration);C0o.registerConfiguration(bwe);async function z4i(a){let i=["editor.fontFamily"],e=await a();for(let t of i)bwe.properties&&bwe.properties[t]&&(bwe.properties[t].defaultSnippets=e)}var gr=new class{constructor(){this.QuickFix=new Is("quickfix");this.Refactor=new Is("refactor");this.RefactorExtract=this.Refactor.append("extract");this.RefactorInline=this.Refactor.append("inline");this.RefactorMove=this.Refactor.append("move");this.RefactorRewrite=this.Refactor.append("rewrite");this.Notebook=new Is("notebook");this.Source=new Is("source");this.SourceOrganizeImports=this.Source.append("organizeImports");this.SourceFixAll=this.Source.append("fixAll");this.SurroundWith=this.Refactor.append("surround")}};function K4i(a,i){return!(a.include&&!a.include.intersects(i)||a.excludes&&a.excludes.some(e=>$4i(i,e,a.include))||!a.includeSourceActions&&gr.Source.contains(i))}function G4i(a,i){let e=i.kind?new Is(i.kind):void 0;return!(a.include&&(!e||!a.include.contains(e))||a.excludes&&e&&a.excludes.some(t=>$4i(e,t,a.include))||!a.includeSourceActions&&e&&gr.Source.contains(e)||a.onlyIncludePreferredActions&&!i.isPreferred)}function $4i(a,i,e){return!(!i.contains(a)||e&&i.contains(e))}var d7=class a{constructor(i,e,t){this.kind=i;this.apply=e;this.preferred=t}static fromUser(i,e){return!i||typeof i!="object"?new a(e.kind,e.apply,!1):new a(a.getKindFromUser(i,e.kind),a.getApplyFromUser(i,e.apply),a.getPreferredUser(i))}static getApplyFromUser(i,e){switch(typeof i.apply=="string"?i.apply.toLowerCase():""){case"first":return"first";case"never":return"never";case"ifsingle":return"ifSingle";default:return e}}static getKindFromUser(i,e){return typeof i.kind=="string"?new Is(i.kind):e}static getPreferredUser(i){return typeof i.preferred=="boolean"?i.preferred:!1}},uIt=class{constructor(i,e,t){this.action=i;this.provider=e;this.highlightRange=t}async resolve(i){if(this.provider?.resolveCodeAction&&!this.action.edit){let e;try{e=await this.provider.resolveCodeAction(this.action,i)}catch(t){ss(t)}e&&(this.action.edit=e.edit)}return this}};var Swe="editor.action.codeAction",w1="editor.action.quickFix",Iwe="editor.action.autoFix",ywe="editor.action.refactor";var wwe="editor.action.sourceAction",n5e="editor.action.organizeImports",r5e="editor.action.fixAll",x0o=1e3,Vii=class a extends C{constructor(e,t,o){super();this.documentation=t;this._register(o),this.allActions=[...e].sort(a.codeActionsComparator),this.validActions=this.allActions.filter(({action:n})=>!n.disabled)}static codeActionsPreferredComparator(e,t){return e.isPreferred&&!t.isPreferred?-1:!e.isPreferred&&t.isPreferred?1:0}static codeActionsComparator({action:e},{action:t}){return e.isAI&&!t.isAI?1:!e.isAI&&t.isAI?-1:dr(e.diagnostics)?dr(t.diagnostics)?a.codeActionsPreferredComparator(e,t):-1:dr(t.diagnostics)?1:a.codeActionsPreferredComparator(e,t)}get hasAutoFix(){return this.validActions.some(({action:e})=>!!e.kind&&gr.QuickFix.contains(new Is(e.kind))&&!!e.isPreferred)}get hasAIFix(){return this.validActions.some(({action:e})=>!!e.isAI)}get allAIFixes(){return this.validActions.every(({action:e})=>!!e.isAI)}},q4i={actions:[],documentation:void 0};async function DL(a,i,e,t,o,n){let r=t.filter||{},s={...r,excludes:[...r.excludes||[],gr.Notebook]},l={only:r.include?.value,trigger:t.type},c=new Nae(i,n),u=t.type===2,p=k0o(a,i,u?s:r),h=new P,g=p.map(async v=>{let b=setTimeout(()=>o.report(v),1250);try{let S=await v.provideCodeActions(i,e,l,c.token);if(c.token.isCancellationRequested)return S?.dispose(),q4i;S&&h.add(S);let y=(S?.actions||[]).filter(k=>k&&G4i(r,k)),w=T0o(v,y,r.include);return{actions:y.map(k=>new uIt(k,v)),documentation:w}}catch(S){if(so(S))throw S;return ss(S),q4i}finally{clearTimeout(b)}}),f=a.onDidChange(()=>{let v=a.all(i);$i(v,p)||c.cancel()});try{let v=await Promise.all(g),b=v.map(w=>w.actions).flat(),S=[...si(v.map(w=>w.documentation)),...E0o(a,i,t,b)],y=new Vii(b,S,h);return h.add(y),y}catch(v){throw h.dispose(),v}finally{f.dispose(),c.dispose()}}function k0o(a,i,e){return a.all(i).filter(t=>t.providedCodeActionKinds?t.providedCodeActionKinds.some(o=>K4i(e,new Is(o))):!0)}function*E0o(a,i,e,t){if(i&&t.length)for(let o of a.all(i))o._getAdditionalMenuItems&&(yield*o._getAdditionalMenuItems?.({trigger:e.type,only:e.filter?.include?.value},t.map(n=>n.action)))}function T0o(a,i,e){if(!a.documentation)return;let t=a.documentation.map(o=>({kind:new Is(o.kind),command:o.command}));if(e){let o;for(let n of t)n.kind.contains(e)&&(o?o.kind.contains(n.kind)&&(o=n):o=n);if(o)return o?.command}for(let o of i)if(o.kind){for(let n of t)if(n.kind.contains(new Is(o.kind)))return n.command}}async function Nq(a,i,e,t,o=ve.None){let n=a.get(ma),r=a.get(ge),s=a.get(Te),l=a.get(Ne),c=a.get(tr);if(s.publicLog2("codeAction.applyCodeAction",{codeActionTitle:i.action.title,codeActionKind:i.action.kind,codeActionIsPreferred:!!i.action.isPreferred,reason:e}),c.playSignal($o.codeActionTriggered),await i.resolve(o),!o.isCancellationRequested&&!(i.action.edit?.edits.length&&!(await n.apply(i.action.edit,{editor:t?.editor,label:i.action.title,quotableLabel:i.action.title,code:"undoredo.codeAction",respectAutoSaveConfig:e!=="onSave",showPreview:t?.preview,reason:_c.codeAction({kind:i.action.kind,providerId:CU.fromExtensionId(i.provider?.extensionId)})})).isApplied)){if(i.action.command)try{await r.executeCommand(i.action.command.id,...i.action.command.arguments||[])}catch(u){let p=_0o(u);l.error(typeof p=="string"?p:d(985,null))}setTimeout(()=>c.playSignal($o.codeActionApplied),x0o)}}function _0o(a){return typeof a=="string"?a:a instanceof Error&&typeof a.message=="string"?a.message:void 0}qe.registerCommand("_executeCodeActionProvider",async function(a,i,e,t,o){if(!(i instanceof A))throw Br();let{codeActionProvider:n}=a.get(zt),r=a.get(Ct).getModel(i);if(!r)throw Br();let s=Yt.isISelection(e)?Yt.liftSelection(e):z.isIRange(e)?r.validateRange(e):void 0;if(!s)throw Br();let l=typeof t=="string"?new Is(t):void 0,c=await DL(n,r,s,{type:1,triggerAction:"other (default)",filter:{includeSourceActions:!0,include:l}},bm.None,ve.None),u=[],p=Math.min(c.validActions.length,typeof o=="number"?o:0);for(let h=0;h<p;h++)u.push(c.validActions[h].resolve(ve.None));try{return await Promise.all(u),c.validActions.map(h=>h.action)}finally{setTimeout(()=>c.dispose(),100)}});var cl=(o=>(o[o.Hint=1]="Hint",o[o.Info=2]="Info",o[o.Warning=4]="Warning",o[o.Error=8]="Error",o))(cl||{});(s=>{function a(l,c){return c-l}s.compare=a;let i=Object.create(null);i[8]=d(2146,null),i[4]=d(2150,null),i[2]=d(2148,null);function e(l){return i[l]||""}s.toString=e;let t=Object.create(null);t[8]=d(2147,null),t[4]=d(2151,null),t[2]=d(2149,null);function o(l){return t[l]||""}s.toStringPlural=o;function n(l){switch(l){case gt.Error:return 8;case gt.Warning:return 4;case gt.Info:return 2;case gt.Ignore:return 1}}s.fromSeverity=n;function r(l){switch(l){case 8:return gt.Error;case 4:return gt.Warning;case 2:return gt.Info;case 1:return gt.Ignore}}s.toSeverity=r})(cl||={});var TW;(t=>{function i(o){return e(o,!0)}t.makeKey=i;function e(o,n){let r=[""];return o.source?r.push(o.source.replace("\xA6","\\\xA6")):r.push(""),o.code?typeof o.code=="string"?r.push(o.code.replace("\xA6","\\\xA6")):r.push(o.code.value.replace("\xA6","\\\xA6")):r.push(""),o.severity!==void 0&&o.severity!==null?r.push(cl.toString(o.severity)):r.push(""),o.message&&n?r.push(o.message.replace("\xA6","\\\xA6")):r.push(""),o.startLineNumber!==void 0&&o.startLineNumber!==null?r.push(o.startLineNumber.toString()):r.push(""),o.startColumn!==void 0&&o.startColumn!==null?r.push(o.startColumn.toString()):r.push(""),o.endLineNumber!==void 0&&o.endLineNumber!==null?r.push(o.endLineNumber.toString()):r.push(""),o.endColumn!==void 0&&o.endColumn!==null?r.push(o.endColumn.toString()):r.push(""),r.push(""),r.join("\xA6")}t.makeKeyOptionalMessage=e})(TW||={});var Ns=ae("markerService");var p7=class{constructor(i){this.keybindingService=i}static{this.codeActionCommands=[ywe,Swe,wwe,n5e,r5e]}getResolver(){let i=new co(()=>this.keybindingService.getKeybindings().filter(e=>p7.codeActionCommands.indexOf(e.command)>=0).filter(e=>e.resolvedKeybinding).map(e=>{let t=e.commandArgs;return e.command===n5e?t={kind:gr.SourceOrganizeImports.value}:e.command===r5e&&(t={kind:gr.SourceFixAll.value}),{resolvedKeybinding:e.resolvedKeybinding,...d7.fromUser(t,{kind:Is.None,apply:"never"})}}));return e=>{if(e.kind)return this.bestKeybindingForCodeAction(e,i.value)?.resolvedKeybinding}}bestKeybindingForCodeAction(i,e){if(!i.kind)return;let t=new Is(i.kind);return e.filter(o=>o.kind.contains(t)).filter(o=>o.preferred?i.isPreferred:!0).reduceRight((o,n)=>o?o.kind.contains(n.kind)?n:o:n,void 0)}};p7=I([m(0,_e)],p7);var vNr=J("symbolIcon.arrayForeground",ko,d(1652,null)),bNr=J("symbolIcon.booleanForeground",ko,d(1653,null)),SNr=J("symbolIcon.classForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},d(1654,null)),INr=J("symbolIcon.colorForeground",ko,d(1655,null)),yNr=J("symbolIcon.constantForeground",ko,d(1656,null)),wNr=J("symbolIcon.constructorForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},d(1657,null)),Bii=J("symbolIcon.enumeratorForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},d(1658,null)),Q4i=J("symbolIcon.enumeratorMemberForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(1659,null)),CNr=J("symbolIcon.eventForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},d(1660,null)),xNr=J("symbolIcon.fieldForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(1661,null)),_W=J("symbolIcon.fileForeground",ko,d(1662,null)),Hii=J("symbolIcon.folderForeground",ko,d(1663,null)),kNr=J("symbolIcon.functionForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},d(1664,null)),ENr=J("symbolIcon.interfaceForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(1665,null)),TNr=J("symbolIcon.keyForeground",ko,d(1666,null)),_Nr=J("symbolIcon.keywordForeground",ko,d(1667,null)),Uii=J("symbolIcon.methodForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},d(1668,null)),DNr=J("symbolIcon.moduleForeground",ko,d(1669,null)),LNr=J("symbolIcon.namespaceForeground",ko,d(1670,null)),RNr=J("symbolIcon.nullForeground",ko,d(1671,null)),MNr=J("symbolIcon.numberForeground",ko,d(1672,null)),PNr=J("symbolIcon.objectForeground",ko,d(1673,null)),ANr=J("symbolIcon.operatorForeground",ko,d(1674,null)),NNr=J("symbolIcon.packageForeground",ko,d(1675,null)),ONr=J("symbolIcon.propertyForeground",ko,d(1676,null)),FNr=J("symbolIcon.referenceForeground",ko,d(1677,null)),WNr=J("symbolIcon.snippetForeground",ko,d(1678,null)),VNr=J("symbolIcon.stringForeground",ko,d(1679,null)),BNr=J("symbolIcon.structForeground",ko,d(1680,null)),HNr=J("symbolIcon.textForeground",ko,d(1681,null)),UNr=J("symbolIcon.typeParameterForeground",ko,d(1682,null)),zNr=J("symbolIcon.unitForeground",ko,d(1683,null)),Y4i=J("symbolIcon.variableForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(1684,null));var X4i=Object.freeze({kind:Is.Empty,title:d(1024,null)}),D0o=Object.freeze([{kind:gr.QuickFix,title:d(1026,null)},{kind:gr.RefactorExtract,title:d(1022,null),icon:M.wrench},{kind:gr.RefactorInline,title:d(1023,null),icon:M.wrench},{kind:gr.RefactorRewrite,title:d(1021,null),icon:M.wrench},{kind:gr.RefactorMove,title:d(1025,null),icon:M.wrench},{kind:gr.SurroundWith,title:d(1028,null),icon:M.surroundWith},{kind:gr.Source,title:d(1027,null),icon:M.symbolFile},X4i]);function J4i(a,i,e){if(!i)return a.map(n=>({kind:"action",item:n,group:X4i,disabled:!!n.action.disabled,label:n.action.disabled||n.action.title,canPreview:!!n.action.edit?.edits.length}));let t=D0o.map(n=>({group:n,actions:[]}));for(let n of a){let r=n.action.kind?new Is(n.action.kind):Is.None;for(let s of t)if(s.group.kind.contains(r)){s.actions.push(n);break}}let o=[];for(let n of t)if(n.actions.length){o.push({kind:"header",group:n.group});for(let r of n.actions){let s=n.group;o.push({kind:"action",item:r,group:r.action.isAI?{title:s.title,kind:s.kind,icon:M.sparkle}:s,label:r.action.title,disabled:!!r.action.disabled,keybinding:e(r.action)})}}return o}var Gii=new Q("supportedCodeAction",""),Z4i="_typescript.applyFixAllCodeAction",zii=class extends C{constructor(e,t,o,n=250){super();this._editor=e;this._markerService=t;this._signalChange=o;this._delay=n;this._autoTriggerTimer=this._register(new Nl);this.ignoreLightbulbOff=!1;this._register(this._markerService.onMarkerChanged(r=>this._onMarkerChanges(r))),this._register(this._editor.onDidChangeCursorPosition(()=>this._tryAutoTrigger()))}trigger(e){let t=this._getRangeOfSelectionUnlessWhitespaceEnclosed(e);this._signalChange(t?{trigger:e,selection:t}:void 0)}_onMarkerChanges(e){let t=this._editor.getModel();t&&e.some(o=>Xe(o,t.uri))&&this._tryAutoTrigger()}_tryAutoTrigger(){this._autoTriggerTimer.cancelAndSet(()=>{this.trigger({type:2,triggerAction:"other (default)"})},this._delay)}_getRangeOfSelectionUnlessWhitespaceEnclosed(e){if(!this._editor.hasModel())return;let t=this._editor.getSelection();if(e.type===1)return t;let o=this._editor.getOption(73).enabled;if(!(o==="off"&&!this.ignoreLightbulbOff)){{if(o==="off"||o==="on")return t;if(o==="onCode"){if(!t.isEmpty())return t;let r=this._editor.getModel(),{lineNumber:s,column:l}=t.getPosition(),c=r.getLineContent(s);if(c.length===0)return;if(l===1){if(/\s/.test(c[0]))return}else if(l===r.getLineMaxColumn(s)){if(/\s/.test(c[c.length-1]))return}else if(/\s/.test(c[l-2])&&/\s/.test(c[l-1]))return}}return t}}},m7;(t=>{let a;(r=>(r[r.Empty=0]="Empty",r[r.Triggered=1]="Triggered"))(a=t.Type||={}),t.Empty={type:0};class e{constructor(n,r,s){this.trigger=n;this.position=r;this._cancellablePromise=s;this.type=1;this.actions=s.catch(l=>{if(so(l))return Kii;throw l})}cancel(){this._cancellablePromise.cancel()}}t.Triggered=e})(m7||={});var Kii=Object.freeze({allActions:[],validActions:[],dispose:()=>{},documentation:[],hasAutoFix:!1,hasAIFix:!1,allAIFixes:!1}),pIt=class extends C{constructor(e,t,o,n,r,s){super();this._editor=e;this._registry=t;this._markerService=o;this._progressService=r;this._configurationService=s;this._codeActionOracle=this._register(new me);this._state=m7.Empty;this._onDidChangeState=this._register(new E);this.onDidChangeState=this._onDidChangeState.event;this.codeActionsDisposable=this._register(new me);this._disposed=!1;this._ignoreLightbulbOff=!1;this._supportedCodeActions=Gii.bindTo(n),this._register(this._editor.onDidChangeModel(()=>this._update())),this._register(this._editor.onDidChangeModelLanguage(()=>this._update())),this._register(this._registry.onDidChange(()=>this._update())),this._register(this._editor.onDidChangeConfiguration(l=>{l.hasChanged(73)&&this._update()})),this._update()}set ignoreLightbulbOff(e){if(this._ignoreLightbulbOff===e)return;this._ignoreLightbulbOff=e;let t=this._codeActionOracle.value;t&&(t.ignoreLightbulbOff=e,e&&t.trigger({type:2,triggerAction:"other (default)"}))}dispose(){this._disposed||(this._disposed=!0,super.dispose(),this.setState(m7.Empty,!0))}_settingEnabledNearbyQuickfixes(){let e=this._editor?.getModel();return this._configurationService?this._configurationService.getValue("editor.codeActionWidget.includeNearbyQuickFixes",{resource:e?.uri}):!1}_update(){if(this._disposed)return;this._codeActionOracle.value=void 0,this.setState(m7.Empty);let e=this._editor.getModel();if(e&&this._registry.has(e)&&!this._editor.getOption(104)){let t=this._registry.all(e).flatMap(n=>n.providedCodeActionKinds??[]);this._supportedCodeActions.set(t.join(" "));let o=new zii(this._editor,this._markerService,n=>{if(!n){this.setState(m7.Empty);return}let r=n.selection.getStartPosition(),s=xn(async u=>{if(this._settingEnabledNearbyQuickfixes()&&n.trigger.type===1&&(n.trigger.triggerAction==="quick fix action"||n.trigger.filter?.include?.contains(gr.QuickFix))){let h=await DL(this._registry,e,n.selection,n.trigger,bm.None,u);this.codeActionsDisposable.value=h;let g=[...h.allActions];if(u.isCancellationRequested)return h.dispose(),Kii;let f=h.validActions?.some(b=>b.action.kind&&gr.QuickFix.contains(new Is(b.action.kind))&&!b.action.isAI),v=this._markerService.read({resource:e.uri});if(f){for(let b of h.validActions)b.action.command?.arguments?.some(S=>typeof S=="string"&&S.includes(Z4i))&&(b.action.diagnostics=[...v.filter(S=>S.relatedInformation)]);return{validActions:h.validActions,allActions:g,documentation:h.documentation,hasAutoFix:h.hasAutoFix,hasAIFix:h.hasAIFix,allAIFixes:h.allAIFixes,dispose:()=>{this.codeActionsDisposable.value=h}}}else if(!f&&v.length>0){let b=n.selection.getPosition(),S=b,y=Number.MAX_VALUE,w=[...h.validActions];for(let T of v){let N=T.endColumn,O=T.endLineNumber,V=T.startLineNumber;if(O===b.lineNumber||V===b.lineNumber){S=new Ie(O,N);let U={type:n.trigger.type,triggerAction:n.trigger.triggerAction,filter:{include:n.trigger.filter?.include?n.trigger.filter?.include:gr.QuickFix},autoApply:n.trigger.autoApply,context:{notAvailableMessage:n.trigger.context?.notAvailableMessage||"",position:S}},G=new Yt(S.lineNumber,S.column,S.lineNumber,S.column),$=await DL(this._registry,e,G,U,bm.None,u);if(u.isCancellationRequested)return $.dispose(),Kii;if($.validActions.length!==0){for(let te of $.validActions)te.action.command?.arguments?.some(pe=>typeof pe=="string"&&pe.includes(Z4i))&&(te.action.diagnostics=[...v.filter(pe=>pe.relatedInformation)]);h.allActions.length===0&&g.push(...$.allActions),Math.abs(b.column-N)<y?w.unshift(...$.validActions):w.push(...$.validActions)}y=Math.abs(b.column-N)}}let k=w.filter((T,N,O)=>O.findIndex(V=>V.action.title===T.action.title)===N);return k.sort((T,N)=>T.action.isPreferred&&!N.action.isPreferred?-1:!T.action.isPreferred&&N.action.isPreferred||T.action.isAI&&!N.action.isAI?1:!T.action.isAI&&N.action.isAI?-1:0),{validActions:k,allActions:g,documentation:h.documentation,hasAutoFix:h.hasAutoFix,hasAIFix:h.hasAIFix,allAIFixes:h.allAIFixes,dispose:()=>{this.codeActionsDisposable.value=h}}}}if(n.trigger.type===1){let h=await DL(this._registry,e,n.selection,n.trigger,bm.None,u);return this.codeActionsDisposable.value=h,h}let p=await DL(this._registry,e,n.selection,n.trigger,bm.None,u);return this.codeActionsDisposable.value=p,p});n.trigger.type===1&&this._progressService?.showWhile(s,250);let l=new m7.Triggered(n.trigger,r,s),c=!1;this._state.type===1&&(c=this._state.trigger.type===1&&l.type===1&&l.trigger.type===2&&this._state.position!==l.position),c?setTimeout(()=>{this.setState(l)},500):this.setState(l)},void 0);o.ignoreLightbulbOff=this._ignoreLightbulbOff,this._codeActionOracle.value=o,this._codeActionOracle.value.trigger({type:2,triggerAction:"other (default)"})}else this._supportedCodeActions.reset()}trigger(e){this._codeActionOracle.value?.trigger(e),this.codeActionsDisposable.dispose()}setState(e,t){e!==this._state&&(this._state.type===1&&this._state.cancel(),this._state=e,!t&&!this._disposed&&this._onDidChangeState.fire(e))}};var e3i=Re("gutter-lightbulb",M.lightBulb,d(1036,null)),t3i=Re("gutter-lightbulb-auto-fix",M.lightbulbAutofix,d(1034,null)),i3i=Re("gutter-lightbulb-sparkle",M.lightbulbSparkle,d(1033,null)),o3i=Re("gutter-lightbulb-aifix-auto-fix",M.lightbulbSparkleAutofix,d(1032,null)),n3i=Re("gutter-lightbulb-sparkle-filled",M.sparkleFilled,d(1035,null)),C1;(t=>{let a;(r=>(r[r.Hidden=0]="Hidden",r[r.Showing=1]="Showing"))(a=t.Type||={}),t.Hidden={type:0};class e{constructor(n,r,s,l){this.actions=n;this.trigger=r;this.editorPosition=s;this.widgetPosition=l;this.type=1}}t.Showing=e})(C1||={});function $ii(a,i,e,t,o=!1){if(a.validActions.length<=0)return;let n,r=!1;a.allAIFixes?(n=o?n3i:M.sparkleFilled,a.validActions.length===1&&(r=!0)):a.hasAutoFix?a.hasAIFix?n=o?o3i:M.lightbulbSparkleAutofix:n=o?t3i:M.lightbulbAutofix:a.hasAIFix?n=o?i3i:M.lightbulbSparkle:n=o?e3i:M.lightBulb;let s;return r?s=d(1030,null,a.validActions[0].action.title):a.hasAutoFix&&e?s=d(1037,null,e):!a.hasAutoFix&&t?s=d(1031,null,t):s=d(1029,null),{actions:a,trigger:i,icon:n,autoRun:r,title:s,isGutter:o}}var gE=class extends C{constructor(e,t){super();this._editor=e;this._keybindingService=t;this.onlyWithEmptySelection=!1;this._onClick=this._register(new E);this.onClick=this._onClick.event;this._state=Le(this,C1.Hidden);this._gutterState=Le(this,C1.Hidden);this._combinedInfo=Ce(this,e=>{let t=this._gutterState.read(e);if(t.type===1)return gE._computeLightBulbInfo(t,!0,this._preferredKbLabel.read(e),this._quickFixKbLabel.read(e));let o=this._state.read(e);if(o.type===1)return gE._computeLightBulbInfo(o,!1,this._preferredKbLabel.read(e),this._quickFixKbLabel.read(e))});this.lightBulbInfo=this._combinedInfo;this._iconClasses=[];this.lightbulbClasses=["codicon-"+e3i.id,"codicon-"+o3i.id,"codicon-"+t3i.id,"codicon-"+i3i.id,"codicon-"+n3i.id];this._preferredKbLabel=Le(this,void 0);this._quickFixKbLabel=Le(this,void 0);this.gutterDecoration=gE.GUTTER_DECORATION;this._domNode=_("div.lightBulbWidget"),this._domNode.role="listbox",this._register(ws.ignoreTarget(this._domNode)),this._editor.addContentWidget(this),this._register(this._editor.onDidChangeModelContent(o=>{let n=this._editor.getModel(),r=this._state.get();(r.type!==1||!n||r.editorPosition.lineNumber>=n.getLineCount())&&this.hide();let s=this._gutterState.get();(s.type!==1||!n||s.editorPosition.lineNumber>=n.getLineCount())&&this.gutterHide()})),this._register(Gbe(this._domNode,o=>{let n=this._state.get();if(n.type!==1)return;this._editor.focus(),o.preventDefault();let{top:r,height:s}=Yn(this._domNode),l=this._editor.getOption(75),c=Math.floor(l/3);n.widgetPosition.position!==null&&n.widgetPosition.position.lineNumber<n.editorPosition.lineNumber&&(c+=l),this._onClick.fire({x:o.posx,y:r+s+c,actions:n.actions,trigger:n.trigger})})),this._register(j(this._domNode,"mouseenter",o=>{(o.buttons&1)===1&&this.hide()})),this._register(H.runAndSubscribe(this._keybindingService.onDidUpdateKeybindings,()=>{this._preferredKbLabel.set(this._keybindingService.lookupKeybinding(Iwe)?.getLabel()??void 0,void 0),this._quickFixKbLabel.set(this._keybindingService.lookupKeybinding(w1)?.getLabel()??void 0,void 0)})),this._register(he(o=>{let n=this._combinedInfo.read(o);this._updateLightBulbTitleAndIcon(n),this._updateGutterDecorationOptions(n)})),this._register(this._editor.onMouseDown(async o=>{if(!o.target.element||!this.lightbulbClasses.some(u=>o.target.element&&o.target.element.classList.contains(u)))return;let n=this._gutterState.get();if(n.type!==1)return;this._editor.focus();let{top:r,height:s}=Yn(o.target.element),l=this._editor.getOption(75),c=Math.floor(l/3);n.widgetPosition.position!==null&&n.widgetPosition.position.lineNumber<n.editorPosition.lineNumber&&(c+=l),this._onClick.fire({x:o.event.posx,y:r+s+c,actions:n.actions,trigger:n.trigger})}))}static{this.GUTTER_DECORATION=po.register({description:"codicon-gutter-lightbulb-decoration",glyphMarginClassName:q.asClassName(M.lightBulb),glyphMargin:{position:1},stickiness:1})}static{this.ID="editor.contrib.lightbulbWidget"}static{this._posPref=[0]}static _computeLightBulbInfo(e,t,o,n){if(e.type===1)return $ii(e.actions,e.trigger,o,n,t)}dispose(){super.dispose(),this._editor.removeContentWidget(this),this._gutterDecorationID&&this._removeGutterDecoration(this._gutterDecorationID)}getId(){return"LightBulbWidget"}getDomNode(){return this._domNode}getPosition(){let e=this._state.get();return e.type===1?e.widgetPosition:null}update(e,t,o){if(e.validActions.length<=0)return this.gutterHide(),this.hide();if(this.onlyWithEmptySelection&&!this._editor.getSelection()?.isEmpty())return this.gutterHide(),this.hide();if(!this._editor.hasTextFocus())return this.gutterHide(),this.hide();if(this._editor.getOptions().get(73).enabled==="off")return this.gutterHide(),this.hide();let s=this._editor.getModel();if(!s)return this.gutterHide(),this.hide();let{lineNumber:l,column:c}=s.validatePosition(o),u=s.getOptions().tabSize,p=this._editor.getOptions().get(59),h=s.getLineContent(l),g=eq(h,u),f=p.spaceWidth*g>22,v=N=>N>2&&this._editor.getTopForLineNumber(N)===this._editor.getTopForLineNumber(N-1),b=this._editor.getLineDecorations(l),S=!1;if(b)for(let N of b){let O=N.options.glyphMarginClassName;if(O&&!this.lightbulbClasses.some(V=>O.includes(V))){S=!0;break}}let y=l,w=1;if(!f){let N=O=>{let V=s.getLineContent(O);return/^\s*$|^\s+/.test(V)||V.length<=w};if(l>1&&!v(l-1)){let O=s.getLineCount(),V=l===O,U=l>1&&N(l-1),G=!V&&N(l+1),$=N(l),te=!G&&!U;if(!G&&!U&&!S)return this._gutterState.set(new C1.Showing(e,t,o,{position:{lineNumber:y,column:w},preference:gE._posPref}),void 0),this.renderGutterLightbub(),this.hide();U||V||U&&!$?y-=1:(G||te&&$)&&(y+=1)}else if(l===1&&(l===s.getLineCount()||!N(l+1)&&!N(l)))if(this._gutterState.set(new C1.Showing(e,t,o,{position:{lineNumber:y,column:w},preference:gE._posPref}),void 0),S)this.gutterHide();else return this.renderGutterLightbub(),this.hide();else if(l<s.getLineCount()&&!v(l+1))y+=1;else if(c*p.spaceWidth<22)return this.hide();w=/^\S\s*$/.test(s.getLineContent(y))?2:1}this._state.set(new C1.Showing(e,t,o,{position:{lineNumber:y,column:w},preference:gE._posPref}),void 0),this._gutterDecorationID&&(this._removeGutterDecoration(this._gutterDecorationID),this.gutterHide());let k=e.validActions,T=e.validActions[0].action.kind;if(k.length!==1||!T){this._editor.layoutContentWidget(this);return}this._editor.layoutContentWidget(this)}hide(){this._state.get()!==C1.Hidden&&(this._state.set(C1.Hidden,void 0),this._editor.layoutContentWidget(this))}gutterHide(){this._gutterState.get()!==C1.Hidden&&(this._gutterDecorationID&&this._removeGutterDecoration(this._gutterDecorationID),this._gutterState.set(C1.Hidden,void 0))}_updateLightBulbTitleAndIcon(e){this._domNode.classList.remove(...this._iconClasses),this._iconClasses=[],!(!e||e.isGutter)&&(this._domNode.title=e.title,this._iconClasses=q.asClassNameArray(e.icon),this._domNode.classList.add(...this._iconClasses))}_updateGutterDecorationOptions(e){!e||!e.isGutter||(this.gutterDecoration=po.register({description:"codicon-gutter-lightbulb-decoration",glyphMarginClassName:q.asClassName(e.icon),glyphMargin:{position:1},stickiness:1}))}renderGutterLightbub(){let e=this._editor.getSelection();e&&(this._gutterDecorationID===void 0?this._addGutterDecoration(e.startLineNumber):this._updateGutterDecoration(this._gutterDecorationID,e.startLineNumber))}_addGutterDecoration(e){this._editor.changeDecorations(t=>{this._gutterDecorationID=t.addDecoration(new z(e,0,e,0),this.gutterDecoration)})}_removeGutterDecoration(e){this._editor.changeDecorations(t=>{t.removeDecoration(e),this._gutterDecorationID=void 0})}_updateGutterDecoration(e,t){this._editor.changeDecorations(o=>{o.changeDecoration(e,new z(t,0,t,0)),o.changeDecorationOptions(e,this.gutterDecoration)})}};gE=I([m(1,_e)],gE);var R0o="quickfix-edit-highlight",Zu=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this._commandService=l;this._configurationService=c;this._actionWidgetService=u;this._instantiationService=p;this._progressService=h;this._keybindingService=g;this._activeCodeActions=this._register(new me);this._showDisabled=!1;this._disposed=!1;this._onlyLightBulbWithEmptySelection=!1;this._lightBulbInfoObs=Le(this,void 0);this._preferredKbLabel=Le(this,void 0);this._quickFixKbLabel=Le(this,void 0);this._hasLightBulbStateObservers=!1;this.lightBulbState=hs({owner:this,onLastObserverRemoved:()=>{this._hasLightBulbStateObservers=!1,this._model.ignoreLightbulbOff=!1}},e=>(this._hasLightBulbStateObservers||(this._hasLightBulbStateObservers=!0,this._model.ignoreLightbulbOff=!0),this._lightBulbInfoObs.read(e)));this._editor=e,this._model=this._register(new pIt(this._editor,r.codeActionProvider,t,o,s,c)),this._register(this._model.onDidChangeState(f=>this.update(f))),this._register(H.runAndSubscribe(this._keybindingService.onDidUpdateKeybindings,()=>{this._preferredKbLabel.set(this._keybindingService.lookupKeybinding(Iwe)?.getLabel()??void 0,void 0),this._quickFixKbLabel.set(this._keybindingService.lookupKeybinding(w1)?.getLabel()??void 0,void 0)})),this._lightBulbWidget=new co(()=>{let f=this._editor.getContribution(gE.ID);return f&&(this._register(f.onClick(v=>this.showCodeActionsFromLightbulb(v.actions,v))),f.onlyWithEmptySelection=this._onlyLightBulbWithEmptySelection),f}),this._resolver=n.createInstance(p7),this._register(this._editor.onDidLayoutChange(()=>this._actionWidgetService.hide()))}static{this.ID="editor.contrib.codeActionController"}static get(e){return e.getContribution(Zu.ID)}set onlyLightBulbWithEmptySelection(e){let t=this._lightBulbWidget.rawValue;t&&(t.onlyWithEmptySelection=e),this._onlyLightBulbWithEmptySelection=e}dispose(){this._disposed=!0,super.dispose()}async showCodeActionsFromLightbulb(e,t){if(e.allAIFixes&&e.validActions.length===1){let o=e.validActions[0],n=o.action.command;n&&n.id==="inlineChat.start"&&n.arguments&&n.arguments.length>=1&&n.arguments[0]&&(n.arguments[0]={...n.arguments[0],autoSend:!1}),await this.applyCodeAction(o,!1,!1,"fromAILightbulb");return}await this.showCodeActionList(e,t,{includeDisabledActions:!1,fromLightbulb:!0})}showCodeActions(e,t,o){return this.showCodeActionList(t,o,{includeDisabledActions:!1,fromLightbulb:!1})}hideCodeActions(){this._actionWidgetService.hide()}manualTriggerAtCurrentPosition(e,t,o,n){if(!this._editor.hasModel())return;iu.get(this._editor)?.closeMessage();let r=this._editor.getPosition();this._trigger({type:1,triggerAction:t,filter:o,autoApply:n,context:{notAvailableMessage:e,position:r}})}_trigger(e){return this._model.trigger(e)}async applyCodeAction(e,t,o,n){let r=this._progressService.show(!0,500);try{await this._instantiationService.invokeFunction(Nq,e,n,{preview:o,editor:this._editor})}finally{t&&this._trigger({type:2,triggerAction:"quick fix action",filter:{}}),r.done()}}hideLightBulbWidget(){this._lightBulbWidget.rawValue?.hide(),this._lightBulbWidget.rawValue?.gutterHide()}async update(e){if(e.type!==m7.Type.Triggered){this.hideLightBulbWidget(),this._lightBulbInfoObs.set(void 0,void 0);return}let t;try{t=await e.actions}catch(n){mt(n);return}if(!(this._disposed||this._editor.getSelection()?.startLineNumber!==e.position.lineNumber))if(this._lightBulbWidget.value?.update(t,e.trigger,e.position),this._lightBulbInfoObs.set($ii(t,e.trigger,this._preferredKbLabel.get(),this._quickFixKbLabel.get()),void 0),e.trigger.type===1){if(e.trigger.filter?.include){let r=this.tryGetValidActionToApply(e.trigger,t);if(r){try{this.hideLightBulbWidget(),await this.applyCodeAction(r,!1,!1,"fromCodeActions")}finally{t.dispose()}return}if(e.trigger.context){let s=this.getInvalidActionThatWouldHaveBeenApplied(e.trigger,t);if(s&&s.action.disabled){iu.get(this._editor)?.showMessage(s.action.disabled,e.trigger.context.position),t.dispose();return}}}let n=!!e.trigger.filter?.include;if(e.trigger.context&&(!t.allActions.length||!n&&!t.validActions.length)){iu.get(this._editor)?.showMessage(e.trigger.context.notAvailableMessage,e.trigger.context.position),this._activeCodeActions.value=t,t.dispose();return}this._activeCodeActions.value=t,this.showCodeActionList(t,this.toCoords(e.position),{includeDisabledActions:n,fromLightbulb:!1})}else this._actionWidgetService.isVisible?t.dispose():this._activeCodeActions.value=t}getInvalidActionThatWouldHaveBeenApplied(e,t){if(t.allActions.length&&(e.autoApply==="first"&&t.validActions.length===0||e.autoApply==="ifSingle"&&t.allActions.length===1))return t.allActions.find(({action:o})=>o.disabled)}tryGetValidActionToApply(e,t){if(t.validActions.length&&(e.autoApply==="first"&&t.validActions.length>0||e.autoApply==="ifSingle"&&t.validActions.length===1))return t.validActions[0]}static{this.DECORATION=po.register({description:"quickfix-highlight",className:R0o})}async showCodeActionList(e,t,o){let n=this._editor.createDecorationsCollection(),r=this._editor.getDomNode();if(!r)return;let s=o.includeDisabledActions&&(this._showDisabled||e.validActions.length===0)?e.allActions:e.validActions;if(!s.length)return;let l=Ie.isIPosition(t)?this.toCoords(t):t,c={onSelect:async(u,p)=>{this.applyCodeAction(u,!0,!!p,o.fromLightbulb?"fromAILightbulb":"fromCodeActions"),this._actionWidgetService.hide(!1),n.clear()},onHide:u=>{this._editor?.focus(),n.clear()},onHover:async(u,p)=>{if(p.isCancellationRequested)return;let h=!1,g=u.action.kind;if(g){let f=new Is(g);h=[gr.RefactorExtract,gr.RefactorInline,gr.RefactorRewrite,gr.RefactorMove,gr.Source].some(b=>b.contains(f))}return{canPreview:h||!!u.action.edit?.edits.length}},onFocus:u=>{if(u&&u.action){let p=u.action.ranges,h=u.action.diagnostics;if(n.clear(),p&&p.length>0){let g=h&&h?.length>1?h.map(f=>({range:f,options:Zu.DECORATION})):p.map(f=>({range:f,options:Zu.DECORATION}));n.set(g)}else if(h&&h.length>0){let g=h.map(v=>({range:v,options:Zu.DECORATION}));n.set(g);let f=h[0];if(f.startLineNumber&&f.startColumn){let v=this._editor.getModel()?.getWordAtPosition({lineNumber:f.startLineNumber,column:f.startColumn})?.word;Or(d(1018,null,v,f.startLineNumber,f.startColumn))}}}else n.clear()}};this._actionWidgetService.show("codeActionWidget",!0,J4i(s,this._shouldShowHeaders(),this._resolver.getResolver()),c,l,r,this._getActionBarActions(e,t,o))}toCoords(e){if(!this._editor.hasModel())return{x:0,y:0};this._editor.revealPosition(e,1),this._editor.render();let t=this._editor.getScrolledVisiblePosition(e),o=Yn(this._editor.getDomNode()),n=o.left+t.left,r=o.top+t.top+t.height;return{x:n,y:r}}_shouldShowHeaders(){let e=this._editor?.getModel();return this._configurationService.getValue("editor.codeActionWidget.showHeaders",{resource:e?.uri})}_getActionBarActions(e,t,o){if(o.fromLightbulb)return[];let n=e.documentation.map(r=>({id:r.id,label:r.title,tooltip:r.tooltip??"",class:void 0,enabled:!0,run:()=>this._commandService.executeCommand(r.id,...r.arguments??[])}));return o.includeDisabledActions&&e.validActions.length>0&&e.allActions.length!==e.validActions.length&&n.push(this._showDisabled?{id:"hideMoreActions",label:d(1019,null),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!1,this.showCodeActionList(e,t,o))}:{id:"showMoreActions",label:d(1020,null),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!0,this.showCodeActionList(e,t,o))}),n}};Zu=I([m(1,Ns),m(2,X),m(3,F),m(4,zt),m(5,rd),m(6,ge),m(7,B),m(8,nl),m(9,F),m(10,rd),m(11,_e)],Zu);is((a,i)=>{((o,n)=>{n&&i.addRule(`.monaco-editor ${o} { background-color: ${n}; }`)})(".quickfix-edit-highlight",a.getColor(Kb));let t=a.getColor(LN);t&&i.addRule(`.monaco-editor .quickfix-edit-highlight { border: 1px ${Ug(a.type)?"dotted":"solid"} ${t}; box-sizing: border-box; }`)});function s5e(a){return x.regex(Gii.keys()[0],new RegExp("(\\s|^)"+Yr(a.value)+"\\b"))}var qii={type:"object",defaultSnippets:[{body:{kind:""}}],properties:{kind:{type:"string",description:d(990,null)},apply:{type:"string",description:d(986,null),default:"ifSingle",enum:["first","ifSingle","never"],enumDescriptions:[d(987,null),d(988,null),d(989,null)]},preferred:{type:"boolean",default:!1,description:d(991,null)}}};function Uae(a,i,e,t,o="other (default)"){a.hasModel()&&Zu.get(a)?.manualTriggerAtCurrentPosition(i,o,e,t)}var hIt=class extends wl{constructor(){super({id:w1,title:L(1012,"Quick Fix..."),precondition:x.and(ue.writable,ue.hasCodeActionsProvider),icon:M.lightBulb,f1:!0,keybinding:{when:ue.textInputFocus,primary:2137,weight:100},menu:{id:D.InlineChatEditorAffordance,group:"1_quickfix",order:0,when:x.and(ue.writable,ue.hasCodeActionsProvider)}})}runEditorCommand(i,e){return Uae(e,d(999,null),void 0,void 0,"quick fix action")}},gIt=class extends xc{constructor(){super({id:Swe,precondition:x.and(ue.writable,ue.hasCodeActionsProvider),metadata:{description:"Trigger a code action",args:[{name:"args",schema:qii}]}})}runEditorCommand(i,e,t){let o=d7.fromUser(t,{kind:Is.Empty,apply:"ifSingle"});return Uae(e,typeof t?.kind=="string"?o.preferred?d(997,null,t.kind):d(995,null,t.kind):o.preferred?d(996,null):d(994,null),{include:o.kind,includeSourceActions:!0,onlyIncludePreferredActions:o.preferred},o.apply)}},fIt=class extends xi{constructor(){super({id:ywe,label:L(1013,"Refactor..."),precondition:x.and(ue.writable,ue.hasCodeActionsProvider),kbOpts:{kbExpr:ue.textInputFocus,primary:3120,mac:{primary:1328},weight:100},contextMenuOpts:{group:"1_modification",order:2,when:x.and(ue.writable,s5e(gr.Refactor))},metadata:{description:"Refactor...",args:[{name:"args",schema:qii}]}})}run(i,e,t){let o=d7.fromUser(t,{kind:gr.Refactor,apply:"never"});return Uae(e,typeof t?.kind=="string"?o.preferred?d(1003,null,t.kind):d(1001,null,t.kind):o.preferred?d(1002,null):d(1000,null),{include:gr.Refactor.contains(o.kind)?o.kind:Is.None,onlyIncludePreferredActions:o.preferred},o.apply,"refactor")}},vIt=class extends xi{constructor(){super({id:wwe,label:L(1014,"Source Action..."),precondition:x.and(ue.writable,ue.hasCodeActionsProvider),contextMenuOpts:{group:"1_modification",order:2.1,when:x.and(ue.writable,s5e(gr.Source))},metadata:{description:"Source Action...",args:[{name:"args",schema:qii}]}})}run(i,e,t){let o=d7.fromUser(t,{kind:gr.Source,apply:"never"});return Uae(e,typeof t?.kind=="string"?o.preferred?d(1007,null,t.kind):d(1005,null,t.kind):o.preferred?d(1006,null):d(1004,null),{include:gr.Source.contains(o.kind)?o.kind:Is.None,includeSourceActions:!0,onlyIncludePreferredActions:o.preferred},o.apply,"source action")}},bIt=class extends xi{constructor(){super({id:n5e,label:L(1011,"Organize Imports"),precondition:x.and(ue.writable,s5e(gr.SourceOrganizeImports)),kbOpts:{kbExpr:ue.textInputFocus,primary:1581,weight:100},metadata:{description:L(1010,"Organize imports in the current file. Also called 'Optimize Imports' by some tools")}})}run(i,e){return Uae(e,d(998,null),{include:gr.SourceOrganizeImports,includeSourceActions:!0},"ifSingle","organize imports")}},SIt=class extends xi{constructor(){super({id:r5e,label:L(1008,"Fix All"),precondition:x.and(ue.writable,s5e(gr.SourceFixAll))})}run(i,e){return Uae(e,d(1009,null),{include:gr.SourceFixAll,includeSourceActions:!0},"ifSingle","fix all")}},IIt=class extends xi{constructor(){super({id:Iwe,label:L(992,"Auto Fix..."),precondition:x.and(ue.writable,s5e(gr.QuickFix)),kbOpts:{kbExpr:ue.textInputFocus,primary:1625,mac:{primary:2649},weight:100}})}run(i,e){return Uae(e,d(993,null),{include:gr.QuickFix,onlyIncludePreferredActions:!0},"ifSingle","auto fix")}};go(Zu.ID,Zu,3);go(gE.ID,gE,4);W(hIt);Jt(fIt);Jt(vIt);Jt(bIt);Jt(IIt);Jt(SIt);qi(new gIt);oe.as(ii.Configuration).registerConfiguration({...nC,properties:{"editor.codeActionWidget.showHeaders":{type:"boolean",scope:6,description:d(1016,null),default:!0}}});oe.as(ii.Configuration).registerConfiguration({...nC,properties:{"editor.codeActionWidget.includeNearbyQuickFixes":{type:"boolean",scope:6,description:d(1015,null),default:!0}}});oe.as(ii.Configuration).registerConfiguration({...nC,properties:{"editor.codeActions.triggerOnFocusChange":{type:"boolean",scope:6,markdownDescription:d(1017,null,"`#editor.codeActionsOnSave#`","`#files.autoSave#`","`afterDelay`","`always`"),default:!1}}});var zae=class a{constructor(){this.lenses=[]}static{this.Empty=new a}dispose(){this._store?.dispose()}get isDisposed(){return this._store?.isDisposed??!1}add(i,e){Ac(i)&&(this._store??=new P,this._store.add(i));for(let t of i.lenses)this.lenses.push({symbol:t,provider:e})}};async function jii(a,i,e){let t=a.ordered(i),o=new Map,n=new zae,r=t.map(async(s,l)=>{o.set(s,l);try{let c=await Promise.resolve(s.provideCodeLenses(i,e));c&&n.add(c,s)}catch(c){ss(c)}});return await Promise.all(r),e.isCancellationRequested?(n.dispose(),zae.Empty):(n.lenses=n.lenses.sort((s,l)=>s.symbol.range.startLineNumber<l.symbol.range.startLineNumber?-1:s.symbol.range.startLineNumber>l.symbol.range.startLineNumber?1:o.get(s.provider)<o.get(l.provider)?-1:o.get(s.provider)>o.get(l.provider)?1:s.symbol.range.startColumn<l.symbol.range.startColumn?-1:s.symbol.range.startColumn>l.symbol.range.startColumn?1:0),n)}qe.registerCommand("_executeCodeLensProvider",function(a,...i){let[e,t]=i;So(A.isUri(e)),So(typeof t=="number"||!t);let{codeLensProvider:o}=a.get(zt),n=a.get(Ct).getModel(e);if(!n)throw Br();let r=[],s=new P;return jii(o,n,ve.None).then(l=>{s.add(l);let c=[];for(let u of l.lenses)t==null||u.symbol.command?r.push(u.symbol):t-- >0&&u.provider.resolveCodeLens&&c.push(Promise.resolve(u.provider.resolveCodeLens(n,u.symbol,ve.None)).then(p=>r.push(p||u.symbol)));return Promise.all(c)}).then(()=>r).finally(()=>{setTimeout(()=>s.dispose(),100)})});var Qii=ae("ICodeLensCache"),yIt=class{constructor(i,e){this.lineCount=i;this.data=e}},a5e=class{constructor(i){this._fakeProvider=new class{provideCodeLenses(){throw new Error("not supported")}};this._cache=new il(20,.75);let e="codelens/cache";jv(It,()=>i.remove(e,1));let t="codelens/cache2",o=i.get(t,1,"{}");this._deserialize(o);let n=H.filter(i.onWillSaveState,r=>r.reason===1);H.once(n)(r=>{i.store(t,this._serialize(),1,1)})}put(i,e){let t=e.lenses.map(r=>({range:r.symbol.range,command:r.symbol.command&&{id:"",title:r.symbol.command?.title}})),o=new zae;o.add({lenses:t},this._fakeProvider);let n=new yIt(i.getLineCount(),o);this._cache.set(i.uri.toString(),n)}get(i){let e=this._cache.get(i.uri.toString());return e&&e.lineCount===i.getLineCount()?e.data:void 0}delete(i){this._cache.delete(i.uri.toString())}_serialize(){let i=Object.create(null);for(let[e,t]of this._cache){let o=new Set;for(let n of t.data.lenses)o.add(n.symbol.range.startLineNumber);i[e]={lineCount:t.lineCount,lines:[...o.values()]}}return JSON.stringify(i)}_deserialize(i){try{let e=JSON.parse(i);for(let t in e){let o=e[t],n=[];for(let s of o.lines)n.push({range:new z(s,1,s,11)});let r=new zae;r.add({lenses:n},this._fakeProvider),this._cache.set(t,new yIt(o.lineCount,r))}}catch{}}};a5e=I([m(0,le)],a5e);we(Qii,a5e,1);var Yii=class{constructor(i,e,t){this.afterColumn=1073741824;this.afterLineNumber=i,this.heightInPx=e,this._onHeight=t,this.suppressMouseDown=!0,this.domNode=document.createElement("div")}onComputedHeight(i){this._lastHeight===void 0?this._lastHeight=i:this._lastHeight!==i&&(this._lastHeight=i,this._onHeight())}isVisible(){return this._lastHeight!==0&&this.domNode.hasAttribute("monaco-visible-view-zone")}},Xii=class a{constructor(i,e){this.allowEditorOverflow=!1;this.suppressMouseDown=!0;this._commands=new Map;this._isEmpty=!0;this._editor=i,this._id=`codelens.widget-${a._idPool++}`,this.updatePosition(e),this._domNode=document.createElement("span"),this._domNode.className="codelens-decoration"}static{this._idPool=0}withCommands(i,e){this._commands.clear();let t=[],o=!1;for(let n=0;n<i.length;n++){let r=i[n];if(r&&(o=!0,r.command)){let s=Bn(r.command.title.trim());if(r.command.id){let l=`c${a._idPool++}`;t.push(_("a",{id:l,title:r.command.tooltip,role:"button"},...s)),this._commands.set(l,r.command)}else t.push(_("span",{title:r.command.tooltip},...s));n+1<i.length&&t.push(_("span",void 0,"\xA0|\xA0"))}}o?(Fi(this._domNode,...t),this._isEmpty&&e&&this._domNode.classList.add("fadein"),this._isEmpty=!1):Fi(this._domNode,_("span",void 0,"no commands"))}getCommand(i){return i.parentElement===this._domNode?this._commands.get(i.id):void 0}getId(){return this._id}getDomNode(){return this._domNode}updatePosition(i){let e=this._editor.getModel().getLineFirstNonWhitespaceColumn(i);this._widgetPosition={position:{lineNumber:i,column:e},preference:[1]}}getPosition(){return this._widgetPosition||null}},Cwe=class{constructor(){this._removeDecorations=[],this._addDecorations=[],this._addDecorationsCallbacks=[]}addDecoration(i,e){this._addDecorations.push(i),this._addDecorationsCallbacks.push(e)}removeDecoration(i){this._removeDecorations.push(i)}commit(i){let e=i.deltaDecorations(this._removeDecorations,this._addDecorations);for(let t=0,o=e.length;t<o;t++)this._addDecorationsCallbacks[t](e[t])}},r3i=po.register({collapseOnReplaceEdit:!0,description:"codelens"}),l5e=class{constructor(i,e,t,o,n,r){this._isDisposed=!1;this._editor=e,this._data=i,this._decorationIds=[];let s,l=[];this._data.forEach((c,u)=>{c.symbol.command&&l.push(c.symbol),t.addDecoration({range:c.symbol.range,options:r3i},p=>this._decorationIds[u]=p),s?s=z.plusRange(s,c.symbol.range):s=z.lift(c.symbol.range)}),this._viewZone=new Yii(s.startLineNumber-1,n,r),this._viewZoneId=o.addZone(this._viewZone),l.length>0&&(this._createContentWidgetIfNecessary(),this._contentWidget.withCommands(l,!1))}_createContentWidgetIfNecessary(){this._contentWidget?this._editor.layoutContentWidget(this._contentWidget):(this._contentWidget=new Xii(this._editor,this._viewZone.afterLineNumber+1),this._editor.addContentWidget(this._contentWidget))}dispose(i,e){this._decorationIds.forEach(i.removeDecoration,i),this._decorationIds=[],e?.removeZone(this._viewZoneId),this._contentWidget&&(this._editor.removeContentWidget(this._contentWidget),this._contentWidget=void 0),this._isDisposed=!0}isDisposed(){return this._isDisposed}isValid(){return this._decorationIds.some((i,e)=>{let t=this._editor.getModel().getDecorationRange(i),o=this._data[e].symbol;return!!(t&&z.isEmpty(o.range)===t.isEmpty())})}updateCodeLensSymbols(i,e){this._decorationIds.forEach(e.removeDecoration,e),this._decorationIds=[],this._data=i,this._data.forEach((t,o)=>{e.addDecoration({range:t.symbol.range,options:r3i},n=>this._decorationIds[o]=n)})}updateHeight(i,e){this._viewZone.heightInPx=i,e.layoutZone(this._viewZoneId),this._contentWidget&&this._editor.layoutContentWidget(this._contentWidget)}computeIfNecessary(i){if(!this._viewZone.isVisible())return null;for(let e=0;e<this._decorationIds.length;e++){let t=i.getDecorationRange(this._decorationIds[e]);t&&(this._data[e].symbol.range=t)}return this._data}updateCommands(i){this._createContentWidgetIfNecessary(),this._contentWidget.withCommands(i,!0);for(let e=0;e<this._data.length;e++){let t=i[e];if(t){let{symbol:o}=this._data[e];o.command=t.command||o.command}}}getCommand(i){return this._contentWidget?.getCommand(i)}getLineNumber(){let i=this._editor.getModel().getDecorationRange(this._decorationIds[0]);return i?i.startLineNumber:-1}update(i){if(this.isValid()){let e=this._editor.getModel().getDecorationRange(this._decorationIds[0]);e&&(this._viewZone.afterLineNumber=e.startLineNumber-1,i.layoutZone(this._viewZoneId),this._contentWidget&&(this._contentWidget.updatePosition(e.startLineNumber),this._editor.layoutContentWidget(this._contentWidget)))}}getItems(){return this._data}};var jg=ae("ILanguageFeatureDebounceService"),eoi;(t=>{let a=new WeakMap,i=0;function e(o){let n=a.get(o);return n===void 0&&(n=++i,a.set(o,n)),n}t.of=e})(eoi||={});var Jii=class{constructor(i){this._default=i}get(i){return this._default}update(i,e){return this._default}default(){return this._default}},Zii=class{constructor(i,e,t,o,n,r){this._logService=i;this._name=e;this._registry=t;this._default=o;this._min=n;this._max=r;this._cache=new il(50,.7)}_key(i){return i.id+this._registry.all(i).reduce((e,t)=>SGe(eoi.of(t),e),0)}get(i){let e=this._key(i),t=this._cache.get(e);return t?Kn(t.value,this._min,this._max):this.default()}update(i,e){let t=this._key(i),o=this._cache.get(t);o||(o=new Ppt(6),this._cache.set(t,o));let n=Kn(o.update(e),this._min,this._max);return jd(i.uri,"output")||this._logService.trace(`[DEBOUNCE: ${this._name}] for ${i.uri.toString()} is ${n}ms`),n}_overall(){let i=new IGe;for(let[,e]of this._cache)i.update(e.value);return i.value}default(){let i=this._overall()|0||this._default;return Kn(i,this._min,this._max)}},c5e=class{constructor(i,e){this._logService=i;this._data=new Map;this._isDev=e.isExtensionDevelopment||!e.isBuilt}for(i,e,t){let o=t?.min??50,n=t?.max??o**2,r=t?.key??void 0,s=`${eoi.of(i)},${o}${r?","+r:""}`,l=this._data.get(s);return l||(this._isDev?(this._logService.debug(`[DEBOUNCE: ${e}] is disabled in developed mode`),l=new Jii(o*1.5)):l=new Zii(this._logService,e,i,this._overallAverage()|0||o*1.5,o,n),this._data.set(s,l)),l}_overallAverage(){let i=new IGe;for(let e of this._data.values())i.update(e.default());return i.value}};c5e=I([m(0,ne),m(1,Co)],c5e);we(jg,c5e,1);var Oq=class{constructor(i,e,t,o,n,r){this._editor=i;this._languageFeaturesService=e;this._commandService=o;this._notificationService=n;this._codeLensCache=r;this._disposables=new P;this._localToDispose=new P;this._lenses=[];this._oldCodeLensModels=new P;this._provideCodeLensDebounce=t.for(e.codeLensProvider,"CodeLensProvide",{min:250}),this._resolveCodeLensesDebounce=t.for(e.codeLensProvider,"CodeLensResolve",{min:250,salt:"resolve"}),this._resolveCodeLensesScheduler=new Dt(()=>this._resolveCodeLensesInViewport(),this._resolveCodeLensesDebounce.default()),this._disposables.add(this._editor.onDidChangeModel(()=>this._onModelChange())),this._disposables.add(this._editor.onDidChangeModelLanguage(()=>this._onModelChange())),this._disposables.add(this._editor.onDidChangeConfiguration(s=>{(s.hasChanged(59)||s.hasChanged(25)||s.hasChanged(24))&&this._updateLensStyle(),s.hasChanged(23)&&this._onModelChange()})),this._disposables.add(e.codeLensProvider.onDidChange(this._onModelChange,this)),this._onModelChange(),this._updateLensStyle()}static{this.ID="css.editor.codeLens"}dispose(){this._localDispose(),this._localToDispose.dispose(),this._disposables.dispose(),this._resolveCodeLensesScheduler.dispose(),this._oldCodeLensModels.dispose(),this._currentCodeLensModel?.dispose()}_getLayoutInfo(){let i=Math.max(1.3,this._editor.getOption(75)/this._editor.getOption(61)),e=this._editor.getOption(25);return(!e||e<5)&&(e=this._editor.getOption(61)*.9|0),{fontSize:e,codeLensHeight:e*i|0}}_updateLensStyle(){let{codeLensHeight:i,fontSize:e}=this._getLayoutInfo(),t=this._editor.getOption(24),o=this._editor.getOption(59),{style:n}=this._editor.getContainerDomNode();n.setProperty("--vscode-editorCodeLens-lineHeight",`${i}px`),n.setProperty("--vscode-editorCodeLens-fontSize",`${e}px`),n.setProperty("--vscode-editorCodeLens-fontFeatureSettings",o.fontFeatureSettings),t&&(n.setProperty("--vscode-editorCodeLens-fontFamily",t),n.setProperty("--vscode-editorCodeLens-fontFamilyDefault",Yd.fontFamily)),this._editor.changeViewZones(r=>{for(let s of this._lenses)s.updateHeight(i,r)})}_localDispose(){this._getCodeLensModelPromise?.cancel(),this._getCodeLensModelPromise=void 0,this._resolveCodeLensesPromise?.cancel(),this._resolveCodeLensesPromise=void 0,this._localToDispose.clear(),this._oldCodeLensModels.clear(),this._currentCodeLensModel?.dispose()}_onModelChange(){this._localDispose();let i=this._editor.getModel();if(!i||!this._editor.getOption(23)||i.isTooLargeForTokenization())return;let e=this._codeLensCache.get(i);if(e&&this._renderCodeLensSymbols(e),!this._languageFeaturesService.codeLensProvider.has(i)){e&&nn(()=>{let o=this._codeLensCache.get(i);e===o&&(this._codeLensCache.delete(i),this._onModelChange())},30*1e3,this._localToDispose);return}for(let o of this._languageFeaturesService.codeLensProvider.all(i))if(typeof o.onDidChange=="function"){let n=o.onDidChange(()=>t.schedule());this._localToDispose.add(n)}let t=new Dt(()=>{let o=Date.now();this._getCodeLensModelPromise?.cancel(),this._getCodeLensModelPromise=xn(n=>jii(this._languageFeaturesService.codeLensProvider,i,n)),this._getCodeLensModelPromise.then(n=>{this._currentCodeLensModel&&this._oldCodeLensModels.add(this._currentCodeLensModel),this._currentCodeLensModel=n,this._codeLensCache.put(i,n);let r=this._provideCodeLensDebounce.update(i,Date.now()-o);t.delay=r,this._renderCodeLensSymbols(n),this._resolveCodeLensesInViewportSoon()},mt)},this._provideCodeLensDebounce.get(i));this._localToDispose.add(t),this._localToDispose.add(Z(()=>this._resolveCodeLensesScheduler.cancel())),this._localToDispose.add(this._editor.onDidChangeModelContent(()=>{this._editor.changeDecorations(o=>{this._editor.changeViewZones(n=>{let r=[],s=-1;this._lenses.forEach(c=>{!c.isValid()||s===c.getLineNumber()?r.push(c):(c.update(n),s=c.getLineNumber())});let l=new Cwe;r.forEach(c=>{c.dispose(l,n),this._lenses.splice(this._lenses.indexOf(c),1)}),l.commit(o)})}),t.schedule(),this._resolveCodeLensesScheduler.cancel(),this._resolveCodeLensesPromise?.cancel(),this._resolveCodeLensesPromise=void 0})),this._localToDispose.add(this._editor.onDidFocusEditorText(()=>{t.schedule()})),this._localToDispose.add(this._editor.onDidBlurEditorText(()=>{t.cancel()})),this._localToDispose.add(this._editor.onDidScrollChange(o=>{o.scrollTopChanged&&this._lenses.length>0&&this._resolveCodeLensesInViewportSoon()})),this._localToDispose.add(this._editor.onDidLayoutChange(()=>{this._resolveCodeLensesInViewportSoon()})),this._localToDispose.add(Z(()=>{if(this._editor.getModel()){let o=tC.capture(this._editor);this._editor.changeDecorations(n=>{this._editor.changeViewZones(r=>{this._disposeAllLenses(n,r)})}),o.restore(this._editor)}else this._disposeAllLenses(void 0,void 0)})),this._localToDispose.add(this._editor.onMouseDown(o=>{if(o.target.type!==9)return;let n=o.target.element;if(n?.tagName==="SPAN"&&(n=n.parentElement),n?.tagName==="A")for(let r of this._lenses){let s=r.getCommand(n);if(s){this._commandService.executeCommand(s.id,...s.arguments||[]).catch(l=>this._notificationService.error(l));break}}})),t.schedule()}_disposeAllLenses(i,e){let t=new Cwe;for(let o of this._lenses)o.dispose(t,e);i&&t.commit(i),this._lenses.length=0}_renderCodeLensSymbols(i){if(!this._editor.hasModel())return;let e=this._editor.getModel().getLineCount(),t=[],o;for(let s of i.lenses){let l=s.symbol.range.startLineNumber;l<1||l>e||(o&&o[o.length-1].symbol.range.startLineNumber===l?o.push(s):(o=[s],t.push(o)))}if(!t.length&&!this._lenses.length)return;let n=tC.capture(this._editor),r=this._getLayoutInfo();this._editor.changeDecorations(s=>{this._editor.changeViewZones(l=>{let c=new Cwe,u=0,p=0;for(;p<t.length&&u<this._lenses.length;){let h=t[p][0].symbol.range.startLineNumber,g=this._lenses[u].getLineNumber();g<h?(this._lenses[u].dispose(c,l),this._lenses.splice(u,1)):g===h?(this._lenses[u].updateCodeLensSymbols(t[p],c),p++,u++):(this._lenses.splice(u,0,new l5e(t[p],this._editor,c,l,r.codeLensHeight,()=>this._resolveCodeLensesInViewportSoon())),u++,p++)}for(;u<this._lenses.length;)this._lenses[u].dispose(c,l),this._lenses.splice(u,1);for(;p<t.length;)this._lenses.push(new l5e(t[p],this._editor,c,l,r.codeLensHeight,()=>this._resolveCodeLensesInViewportSoon())),p++;c.commit(s)})}),n.restore(this._editor)}_resolveCodeLensesInViewportSoon(){this._editor.getModel()&&this._resolveCodeLensesScheduler.schedule()}_resolveCodeLensesInViewport(){this._resolveCodeLensesPromise?.cancel(),this._resolveCodeLensesPromise=void 0;let i=this._editor.getModel();if(!i)return;let e=[],t=[];if(this._lenses.forEach(r=>{let s=r.computeIfNecessary(i);s&&(e.push(s),t.push(r))}),e.length===0){this._oldCodeLensModels.clear();return}let o=Date.now(),n=xn(r=>{let s=e.map((l,c)=>{let u=new Array(l.length),p=l.map((h,g)=>!h.symbol.command&&typeof h.provider.resolveCodeLens=="function"?Promise.resolve(h.provider.resolveCodeLens(i,h.symbol,r)).then(f=>{u[g]=f},ss):(u[g]=h.symbol,Promise.resolve(void 0)));return Promise.all(p).then(()=>{!r.isCancellationRequested&&!t[c].isDisposed()&&t[c].updateCommands(u)})});return Promise.all(s)});this._resolveCodeLensesPromise=n,this._resolveCodeLensesPromise.then(()=>{let r=this._resolveCodeLensesDebounce.update(i,Date.now()-o);this._resolveCodeLensesScheduler.delay=r,this._currentCodeLensModel&&this._codeLensCache.put(i,this._currentCodeLensModel),this._oldCodeLensModels.clear(),n===this._resolveCodeLensesPromise&&(this._resolveCodeLensesPromise=void 0)},r=>{mt(r),n===this._resolveCodeLensesPromise&&(this._resolveCodeLensesPromise=void 0)})}async getModel(){return await this._getCodeLensModelPromise,await this._resolveCodeLensesPromise,this._currentCodeLensModel?.isDisposed?void 0:this._currentCodeLensModel}};Oq=I([m(1,zt),m(2,jg),m(3,ge),m(4,Ne),m(5,Qii)],Oq);go(Oq.ID,Oq,1);Jt(class extends xi{constructor(){super({id:"codelens.showLensesInCurrentLine",precondition:ue.hasCodeLensProvider,label:L(1039,"Show CodeLens Commands for Current Line")})}async run(i,e){if(!e.hasModel())return;let t=i.get(Ge),o=i.get(ge),n=i.get(Ne),r=e.getSelection().positionLineNumber,s=e.getContribution(Oq.ID);if(!s)return;let l=await s.getModel();if(!l)return;let c=[];for(let h of l.lenses)h.symbol.command&&h.symbol.range.startLineNumber===r&&c.push({label:h.symbol.command.title,command:h.symbol.command});if(c.length===0)return;let u=await t.pick(c,{canPickMany:!1,placeHolder:d(1038,null)});if(!u)return;let p=u.command;if(l.isDisposed){let g=(await s.getModel())?.lenses.find(f=>f.symbol.range.startLineNumber===r&&f.symbol.command?.title===p.title);if(!g||!g.symbol.command)return;p=g.symbol.command}try{await o.executeCommand(p.id,...p.arguments||[])}catch(h){n.error(h)}}});var s3i=[];function Dx(a){s3i.push(a)}function a3i(){return s3i.slice(0)}var xwe=class{constructor(i,e,t,o){this.priority=i;this.range=e;this.initialMousePosX=t;this.initialMousePosY=o;this.type=1}equals(i){return i.type===1&&this.range.equalsRange(i.range)}canAdoptVisibleHover(i,e){return i.type===1&&e.lineNumber===this.range.startLineNumber}},Fq=class{constructor(i,e,t,o,n,r){this.priority=i;this.owner=e;this.range=t;this.initialMousePosX=o;this.initialMousePosY=n;this.supportsMarkerHover=r;this.type=2}equals(i){return i.type===2&&this.owner===i.owner}canAdoptVisibleHover(i,e){return i.type===2&&this.owner===i.owner}},Lx=class{constructor(i,e){this.renderedHoverParts=i;this.disposables=e}dispose(){for(let i of this.renderedHoverParts)i.dispose();this.disposables?.dispose()}},d_=new class{constructor(){this._participants=[]}register(i){this._participants.push(i)}getAll(){return this._participants}};var Wq=class{constructor(i){this._editorWorkerService=i}async provideDocumentColors(i,e){return this._editorWorkerService.computeDefaultDocumentColors(i.uri)}provideColorPresentations(i,e,t){let o=e.range,n=e.color,r=new Oe(new Bt(Math.round(255*n.red),Math.round(255*n.green),Math.round(255*n.blue),n.alpha)),s=Oe.Format.CSS.formatRGB(r),l=Oe.Format.CSS.formatHSL(r),c=Oe.Format.CSS.formatHexA(r,!0),u=[];return u.push({label:s,textEdit:{range:o,text:s}}),u.push({label:l,textEdit:{range:o,text:l}}),u.push({label:c,textEdit:{range:o,text:c}}),u}};Wq=I([m(0,$s)],Wq);var kwe=class extends C{constructor(i,e){super(),this._register(i.colorProvider.register("*",new Wq(e)))}};kwe=I([m(0,zt),m(1,$s)],kwe);async function xIt(a,i,e,t="auto"){return kIt(new toi,a,i,e,t)}function ioi(a,i,e,t){return Promise.resolve(e.provideColorPresentations(a,i,t))}var toi=class{constructor(){}async compute(i,e,t,o){let n=await i.provideDocumentColors(e,t);if(Array.isArray(n))for(let r of n)o.push({colorInfo:r,provider:i});return Array.isArray(n)}},wIt=class{constructor(){}async compute(i,e,t,o){let n=await i.provideDocumentColors(e,t);if(Array.isArray(n))for(let r of n)o.push({range:r.range,color:[r.color.red,r.color.green,r.color.blue,r.color.alpha]});return Array.isArray(n)}},CIt=class{constructor(i){this.colorInfo=i}async compute(i,e,t,o){let n=await i.provideColorPresentations(e,this.colorInfo,ve.None);return Array.isArray(n)&&o.push(...n),Array.isArray(n)}};async function kIt(a,i,e,t,o){let n=!1,r,s=[],l=i.ordered(e);for(let c=l.length-1;c>=0;c--){let u=l[c];if(o!=="always"&&u instanceof Wq)r=u;else try{await a.compute(u,e,t,s)&&(n=!0)}catch(p){ss(p)}}return n?s:r&&o!=="never"?(await a.compute(r,e,t,s),s):[]}function ooi(a,i){let{colorProvider:e}=a.get(zt),t=a.get(Ct).getModel(i);if(!t)throw Br();let o=a.get(B).getValue("editor.defaultColorDecorators",{resource:i});return{model:t,colorProviderRegistry:e,defaultColorDecoratorsEnablement:o}}var roi=Object.create({}),Xy=class extends C{constructor(e,t,o,n){super();this._editor=e;this._configurationService=t;this._languageFeaturesService=o;this._localToDispose=this._register(new P);this._decorationsIds=[];this._colorDatas=new Map;this._decoratorLimitReporter=this._register(new noi);this._colorDecorationClassRefs=this._register(new P);this._colorDecoratorIds=this._editor.createDecorationsCollection(),this._ruleFactory=this._register(new p9(this._editor)),this._debounceInformation=n.for(o.colorProvider,"Document Colors",{min:Xy.RECOMPUTE_TIME}),this._register(e.onDidChangeModel(()=>{this._isColorDecoratorsEnabled=this.isEnabled(),this.updateColors()})),this._register(e.onDidChangeModelLanguage(()=>this.updateColors())),this._register(o.colorProvider.onDidChange(()=>this.updateColors())),this._register(e.onDidChangeConfiguration(r=>{let s=this._isColorDecoratorsEnabled;this._isColorDecoratorsEnabled=this.isEnabled(),this._defaultColorDecoratorsEnablement=this._editor.getOption(167);let l=s!==this._isColorDecoratorsEnabled||r.hasChanged(27),c=r.hasChanged(167);(l||c)&&(this._isColorDecoratorsEnabled?this.updateColors():this.removeAllDecorations())})),this._timeoutTimer=null,this._computePromise=null,this._isColorDecoratorsEnabled=this.isEnabled(),this._defaultColorDecoratorsEnablement=this._editor.getOption(167),this.updateColors()}static{this.ID="editor.contrib.colorDetector"}static{this.RECOMPUTE_TIME=1e3}isEnabled(){let e=this._editor.getModel();if(!e)return!1;let t=e.getLanguageId(),o=this._configurationService.getValue(t);if(o&&typeof o=="object"){let n=o.colorDecorators;if(n&&n.enable!==void 0&&!n.enable)return n.enable}return this._editor.getOption(26)}get limitReporter(){return this._decoratorLimitReporter}static get(e){return e.getContribution(this.ID)}dispose(){this.stop(),this.removeAllDecorations(),super.dispose()}updateColors(){if(this.stop(),!this._isColorDecoratorsEnabled)return;let e=this._editor.getModel();!e||!this._languageFeaturesService.colorProvider.has(e)||(this._localToDispose.add(this._editor.onDidChangeModelContent(()=>{this._timeoutTimer||(this._timeoutTimer=new Nl,this._timeoutTimer.cancelAndSet(()=>{this._timeoutTimer=null,this.beginCompute()},this._debounceInformation.get(e)))})),this.beginCompute())}async beginCompute(){this._computePromise=xn(async e=>{let t=this._editor.getModel();if(!t)return[];let o=new En(!1),n=await xIt(this._languageFeaturesService.colorProvider,t,e,this._defaultColorDecoratorsEnablement);return this._debounceInformation.update(t,o.elapsed()),n});try{let e=await this._computePromise;this.updateDecorations(e),this.updateColorDecorators(e),this._computePromise=null}catch(e){mt(e)}}stop(){this._timeoutTimer&&(this._timeoutTimer.cancel(),this._timeoutTimer=null),this._computePromise&&(this._computePromise.cancel(),this._computePromise=null),this._localToDispose.clear()}updateDecorations(e){let t=e.map(o=>({range:{startLineNumber:o.colorInfo.range.startLineNumber,startColumn:o.colorInfo.range.startColumn,endLineNumber:o.colorInfo.range.endLineNumber,endColumn:o.colorInfo.range.endColumn},options:po.EMPTY}));this._editor.changeDecorations(o=>{this._decorationsIds=o.deltaDecorations(this._decorationsIds,t),this._colorDatas=new Map,this._decorationsIds.forEach((n,r)=>this._colorDatas.set(n,e[r]))})}updateColorDecorators(e){this._colorDecorationClassRefs.clear();let t=[],o=this._editor.getOption(27);for(let r=0;r<e.length&&t.length<o;r++){let{red:s,green:l,blue:c,alpha:u}=e[r].colorInfo.color,p=new Bt(Math.round(s*255),Math.round(l*255),Math.round(c*255),u),h=`rgba(${p.r}, ${p.g}, ${p.b}, ${p.a})`,g=this._colorDecorationClassRefs.add(this._ruleFactory.createClassNameRef({backgroundColor:h}));t.push({range:{startLineNumber:e[r].colorInfo.range.startLineNumber,startColumn:e[r].colorInfo.range.startColumn,endLineNumber:e[r].colorInfo.range.endLineNumber,endColumn:e[r].colorInfo.range.endColumn},options:{description:"colorDetector",before:{content:rN,inlineClassName:`${g.className} colorpicker-color-decoration`,inlineClassNameAffectsLetterSpacing:!0,attachedData:roi}}})}let n=o<e.length?o:!1;this._decoratorLimitReporter.update(e.length,n),this._colorDecoratorIds.set(t)}removeAllDecorations(){this._editor.removeDecorations(this._decorationsIds),this._decorationsIds=[],this._colorDecoratorIds.clear(),this._colorDecorationClassRefs.clear()}getColorData(e){let t=this._editor.getModel();if(!t)return null;let o=t.getDecorationsInRange(z.fromPositions(e,e)).filter(n=>this._colorDatas.has(n.id));return o.length===0?null:this._colorDatas.get(o[0].id)}isColorDecoration(e){return this._colorDecoratorIds.has(e)}};Xy=I([m(1,B),m(2,zt),m(3,jg)],Xy);var noi=class extends C{constructor(){super(...arguments);this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._computed=0;this._limited=!1}get computed(){return this._computed}get limited(){return this._limited}update(e,t){(e!==this._computed||t!==this._limited)&&(this._computed=e,this._limited=t,this._onDidChange.fire())}};var EIt="editor.action.showHover",l3i="editor.action.showDefinitionPreviewHover",c3i="editor.action.hideHover",d3i="editor.action.scrollUpHover",u3i="editor.action.scrollDownHover",p3i="editor.action.scrollLeftHover",m3i="editor.action.scrollRightHover",h3i="editor.action.pageUpHover",g3i="editor.action.pageDownHover",f3i="editor.action.goToTopHover",v3i="editor.action.goToBottomHover",x1="editor.action.increaseHoverVerbosityLevel",b3i="editor.action.increaseHoverVerbosityLevelFromAccessibleView",S3i=d(1261,null),k1="editor.action.decreaseHoverVerbosityLevel",I3i="editor.action.decreaseHoverVerbosityLevelFromAccessibleView",y3i=d(1260,null),d5e="editor.action.hideLongLineWarningHover";var E1="editor.action.inlineSuggest.commit",Kae="editor.action.inlineSuggest.commitAlternativeAction",TIt="editor.action.inlineSuggest.showPrevious",_It="editor.action.inlineSuggest.showNext",DIt="editor.action.inlineSuggest.jump",LIt="editor.action.inlineSuggest.hide",u5e="editor.action.inlineSuggest.toggleShowCollapsed",soi="editor.action.inlineSuggest.renameSymbol";var Ewe=class extends C{constructor(e,t,o){super();this.editor=e;this.model=t;this.instantiationService=o;this.alwaysShowToolbar=ui(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(71).showToolbar==="always"),this.sessionPosition=void 0,this.position=Ce(this,n=>{let r=this.model.read(n)?.primaryGhostText.read(n);if(!this.alwaysShowToolbar.read(n)||!r||r.parts.length===0)return this.sessionPosition=void 0,null;let s=r.parts[0].column;this.sessionPosition&&this.sessionPosition.lineNumber!==r.lineNumber&&(this.sessionPosition=void 0);let l=new Ie(r.lineNumber,Math.min(s,this.sessionPosition?.column??Number.MAX_SAFE_INTEGER));return this.sessionPosition=l,l}),this._register(Ga((n,r)=>{let s=this.model.read(n);if(!s||!this.alwaysShowToolbar.read(n))return;let l=Ce(u=>{let p=u.store.add(this.instantiationService.createInstance(LL.hot.read(u),this.editor,!0,this.position,s.selectedInlineCompletionIndex,s.inlineCompletionsCount,s.activeCommands,s.warning,()=>{}));return e.addContentWidget(p),u.store.add(Z(()=>e.removeContentWidget(p))),u.store.add(he(h=>{this.position.read(h)&&s.lastTriggerKind.read(h)!==1&&s.triggerExplicitly()})),p}),c=vf(this,(u,p)=>!!this.position.read(u)||!!p);r.add(he(u=>{c.read(u)&&l.read(u)}))}))}};Ewe=I([m(2,F)],Ewe);var M0o=Re("inline-suggestion-hints-next",M.chevronRight,d(1364,null)),P0o=Re("inline-suggestion-hints-previous",M.chevronLeft,d(1365,null)),LL=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.editor=e;this.withBorder=t;this._position=o;this._currentSuggestionIdx=n;this._suggestionCount=r;this._extraCommands=s;this._warning=l;this._relayout=c;this._commandService=u;this.keybindingService=h;this._contextKeyService=g;this._menuService=f;this.id=`InlineSuggestionHintsContentWidget${LL.id++}`,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._warningMessageContentNode=Ce(v=>{let b=this._warning.read(v);return b?typeof b.message=="string"?b.message:v.store.add(nb(b.message)).element:void 0}),this._warningMessageNode=Mo.div({class:"warningMessage",style:{maxWidth:400,margin:4,marginBottom:4,display:Ce(v=>this._warning.read(v)?"block":"none")}},[this._warningMessageContentNode]).keepUpdated(this._store),this.nodes=bt("div.inlineSuggestionsHints",{className:this.withBorder?"monaco-hover monaco-hover-content":""},[this._warningMessageNode.element,bt("div@toolBar")]),this.previousAction=this._register(this.createCommandAction(TIt,d(1366,null),q.asClassName(P0o))),this.availableSuggestionCountAction=this._register(new st("inlineSuggestionHints.availableSuggestionCount","",void 0,!1)),this.nextAction=this._register(this.createCommandAction(_It,d(1363,null),q.asClassName(M0o))),this.inlineCompletionsActionsMenus=this._register(this._menuService.createMenu(D.InlineCompletionsActions,this._contextKeyService)),this.clearAvailableSuggestionCountLabelDebounced=this._register(new Dt(()=>{this.availableSuggestionCountAction.label=""},100)),this.disableButtonsDebounced=this._register(new Dt(()=>{this.previousAction.enabled=this.nextAction.enabled=!1},100)),this._register(he(v=>{this._warningMessageContentNode.read(v),this._warningMessageNode.readEffect(v),this._relayout()})),this.toolBar=this._register(p.createInstance(p5e,this.nodes.toolBar,D.InlineSuggestionToolbar,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:v=>v.startsWith("primary")},actionViewItemProvider:(v,b)=>{if(v instanceof Eo)return p.createInstance(loi,v,void 0);if(v===this.availableSuggestionCountAction){let S=new aoi(void 0,v,{label:!0,icon:!1});return S.setClass("availableSuggestionCount"),S}},telemetrySource:"InlineSuggestionToolbar"})),this.toolBar.setPrependedPrimaryActions([this.previousAction,this.availableSuggestionCountAction,this.nextAction]),this._register(this.toolBar.onDidChangeDropdownVisibility(v=>{LL._dropDownVisible=v})),this._register(he(v=>{this._position.read(v),this.editor.layoutContentWidget(this)})),this._register(he(v=>{let b=this._suggestionCount.read(v),S=this._currentSuggestionIdx.read(v);b!==void 0?(this.clearAvailableSuggestionCountLabelDebounced.cancel(),this.availableSuggestionCountAction.label=`${S+1}/${b}`):this.clearAvailableSuggestionCountLabelDebounced.schedule(),b!==void 0&&b>1?(this.disableButtonsDebounced.cancel(),this.previousAction.enabled=this.nextAction.enabled=!0):this.disableButtonsDebounced.schedule()})),this._register(he(v=>{let S=this._extraCommands.read(v).map(y=>({class:void 0,id:y.command.id,enabled:!0,tooltip:y.command.tooltip||"",label:y.command.title,run:w=>this._commandService.executeCommand(y.command.id)}));for(let[y,w]of this.inlineCompletionsActionsMenus.getActions())for(let k of w)k instanceof Eo&&S.push(k);S.length>0&&S.unshift(new li),this.toolBar.setAdditionalSecondaryActions(S)}))}static{this.hot=s1(this)}static{this._dropDownVisible=!1}static get dropDownVisible(){return this._dropDownVisible}static{this.id=0}createCommandAction(e,t,o){let n=new st(e,t,o,!0,()=>this._commandService.executeCommand(e));return n.tooltip=this.keybindingService.appendKeybinding(t,e,this._contextKeyService),n}getId(){return this.id}getDomNode(){return this.nodes.root}getPosition(){return{position:this._position.get(),preference:[1,2],positionAffinity:3}}};LL=I([m(8,ge),m(9,F),m(10,_e),m(11,X),m(12,qt)],LL);var aoi=class extends Lr{constructor(){super(...arguments);this._className=void 0}setClass(e){this._className=e}render(e){super.render(e),this._className&&e.classList.add(this._className)}updateTooltip(){}},loi=class extends ml{updateLabel(){let i=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService,!0);if(!i)return super.updateLabel();if(this.label){let e=bt("div.keybinding").root;this._register(new ah(e,zo,{disableTitle:!0,...t5e})).set(i),this.label.textContent=this._action.label,this.label.appendChild(e),this.label.classList.add("inlineSuggestionStatusBarItemLabel")}}updateTooltip(){}},p5e=class extends Ol{constructor(e,t,o,n,r,s,l,c,u){super(e,{resetMenu:t,...o},n,r,s,l,c,u);this.menuId=t;this.options2=o;this.menuService=n;this.contextKeyService=r;this.menu=this._store.add(this.menuService.createMenu(this.menuId,this.contextKeyService,{emitEventsForSubmenuChanges:!0})),this.additionalActions=[],this.prependedPrimaryActions=[],this.additionalPrimaryActions=[],this._store.add(this.menu.onDidChange(()=>this.updateToolbar())),this.updateToolbar()}updateToolbar(){let{primary:e,secondary:t}=hl(this.menu.getActions(this.options2?.menuOptions),this.options2?.toolbarOptions?.primaryGroup,this.options2?.toolbarOptions?.shouldInlineSubmenu,this.options2?.toolbarOptions?.useSeparatorsInPrimaryActions);t.push(...this.additionalActions),e.unshift(...this.prependedPrimaryActions),e.push(...this.additionalPrimaryActions),this.setActions(e,t)}setPrependedPrimaryActions(e){$i(this.prependedPrimaryActions,e,(t,o)=>t===o)||(this.prependedPrimaryActions=e,this.updateToolbar())}setAdditionalPrimaryActions(e){$i(this.additionalPrimaryActions,e,(t,o)=>t===o)||(this.additionalPrimaryActions=e,this.updateToolbar())}setAdditionalSecondaryActions(e){$i(this.additionalActions,e,(t,o)=>t===o)||(this.additionalActions=e,this.updateToolbar())}};p5e=I([m(3,qt),m(4,X),m(5,ze),m(6,_e),m(7,ge),m(8,Te)],p5e);var m5e={kind:0},A0o={kind:1};function N0o(a,i,e){return{kind:2,commandId:a,commandArgs:i,isBubble:e}}var MIt=class a{constructor(i,e,t){this._log=t,this._defaultKeybindings=i,this._defaultBoundCommands=new Map;for(let o of i){let n=o.command;n&&n.charAt(0)!=="-"&&this._defaultBoundCommands.set(n,!0)}this._map=new Map,this._lookupMap=new Map,this._keybindings=a.handleRemovals([].concat(i).concat(e));for(let o=0,n=this._keybindings.length;o<n;o++){let r=this._keybindings[o];if(r.chords.length===0)continue;let s=r.when?.substituteConstants();s&&s.type===0||this._addKeyPress(r.chords[0],r)}}static _isTargetedForRemoval(i,e,t){if(e){for(let o=0;o<e.length;o++)if(e[o]!==i.chords[o])return!1}return!(t&&t.type!==1&&(!i.when||!Yzi(t,i.when)))}static handleRemovals(i){let e=new Map;for(let o=0,n=i.length;o<n;o++){let r=i[o];if(r.command&&r.command.charAt(0)==="-"){let s=r.command.substring(1);e.has(s)?e.get(s).push(r):e.set(s,[r])}}if(e.size===0)return i;let t=[];for(let o=0,n=i.length;o<n;o++){let r=i[o];if(!r.command||r.command.length===0){t.push(r);continue}if(r.command.charAt(0)==="-")continue;let s=e.get(r.command);if(!s||!r.isDefault){t.push(r);continue}let l=!1;for(let c of s){let u=c.when;if(this._isTargetedForRemoval(r,c.chords,u)){l=!0;break}}if(!l){t.push(r);continue}}return t}_addKeyPress(i,e){let t=this._map.get(i);if(typeof t>"u"){this._map.set(i,[e]),this._addToLookupMap(e);return}for(let o=t.length-1;o>=0;o--){let n=t[o];if(n.command===e.command)continue;let r=!0;for(let s=1;s<n.chords.length&&s<e.chords.length;s++)if(n.chords[s]!==e.chords[s]){r=!1;break}r&&a.whenIsEntirelyIncluded(n.when,e.when)&&this._removeFromLookupMap(n)}t.push(e),this._addToLookupMap(e)}_addToLookupMap(i){if(!i.command)return;let e=this._lookupMap.get(i.command);typeof e>"u"?(e=[i],this._lookupMap.set(i.command,e)):e.push(i)}_removeFromLookupMap(i){if(!i.command)return;let e=this._lookupMap.get(i.command);if(!(typeof e>"u")){for(let t=0,o=e.length;t<o;t++)if(e[t]===i){e.splice(t,1);return}}}static whenIsEntirelyIncluded(i,e){return!e||e.type===1?!0:!i||i.type===1?!1:umt(i,e)}getDefaultBoundCommands(){return this._defaultBoundCommands}getDefaultKeybindings(){return this._defaultKeybindings}getKeybindings(){return this._keybindings}lookupKeybindings(i){let e=this._lookupMap.get(i);if(typeof e>"u"||e.length===0)return[];let t=[],o=0;for(let n=e.length-1;n>=0;n--)t[o++]=e[n];return t}lookupPrimaryKeybinding(i,e,t=!1){let o=this._lookupMap.get(i);if(typeof o>"u"||o.length===0)return null;if(o.length===1&&!t)return o[0];for(let n=o.length-1;n>=0;n--){let r=o[n];if(e.contextMatchesRules(r.when))return r}return t?null:o[o.length-1]}resolve(i,e,t){let o=[...e,t];this._log(`| Resolving ${o}`);let n=this._map.get(o[0]);if(n===void 0)return this._log("\\ No keybinding entries."),m5e;let r=null;if(o.length<2)r=n;else{r=[];for(let l=0,c=n.length;l<c;l++){let u=n[l];if(o.length>u.chords.length)continue;let p=!0;for(let h=1;h<o.length;h++)if(u.chords[h]!==o[h]){p=!1;break}p&&r.push(u)}}let s=this._findCommand(i,r);return s?o.length<s.chords.length?(this._log(`\\ From ${r.length} keybinding entries, awaiting ${s.chords.length-o.length} more chord(s), when: ${w3i(s.when)}, source: ${C3i(s)}.`),A0o):(this._log(`\\ From ${r.length} keybinding entries, matched ${s.command}, when: ${w3i(s.when)}, source: ${C3i(s)}.`),N0o(s.command,s.commandArgs,s.bubble)):(this._log(`\\ From ${r.length} keybinding entries, no when clauses matched the context.`),m5e)}_findCommand(i,e){for(let t=e.length-1;t>=0;t--){let o=e[t];if(a._contextMatchesRules(i,o.when))return o}return null}static _contextMatchesRules(i,e){return e?e.evaluate(i):!0}};function w3i(a){return a?`${a.serialize()}`:"no when condition"}function C3i(a){return a.extensionId?a.isBuiltinExtension?`built-in extension ${a.extensionId}`:`user extension ${a.extensionId}`:a.isDefault?"built-in":"user"}function g7(a,i,e){let t=Yn(a);return!(i<t.left+3||i>t.left+t.width-3||e<t.top+3||e>t.top+t.height-3)}function PIt(a,i,e){return a==="on"?!0:a==="off"?!1:h5e(i,e.event)}function h5e(a,i){return a==="altKey"?i.ctrlKey||i.metaKey:i.altKey}var coi=class{constructor(i,e,t,o){this.value=i;this.isComplete=e;this.hasLoadingMessage=t;this.options=o}},Twe=class extends C{constructor(e,t){super();this._editor=e;this._computer=t;this._onResult=this._register(new E);this.onResult=this._onResult.event;this._asyncComputationScheduler=this._register(new g5e(e=>this._triggerAsyncComputation(e),0));this._syncComputationScheduler=this._register(new g5e(e=>this._triggerSyncComputation(e),0));this._loadingMessageScheduler=this._register(new g5e(e=>this._triggerLoadingMessage(e),0));this._state=0;this._asyncIterable=null;this._asyncIterableDone=!1;this._result=[]}dispose(){this._asyncIterable&&(this._asyncIterable.cancel(),this._asyncIterable=null),this._options=void 0,super.dispose()}get _hoverTime(){return this._editor.getOption(69).delay}get _firstWaitTime(){return this._hoverTime/2}get _secondWaitTime(){return this._hoverTime-this._firstWaitTime}get _loadingMessageTime(){return 3*this._hoverTime}_setState(e,t){this._options=t,this._state=e,this._fireResult(t)}_triggerAsyncComputation(e){this._setState(2,e),this._syncComputationScheduler.schedule(e,this._secondWaitTime),this._computer.computeAsync?(this._asyncIterableDone=!1,this._asyncIterable=M1i(t=>this._computer.computeAsync(e,t)),(async()=>{try{for await(let t of this._asyncIterable)t&&(this._result.push(t),this._fireResult(e));this._asyncIterableDone=!0,(this._state===3||this._state===4)&&this._setState(0,e)}catch(t){mt(t)}})()):this._asyncIterableDone=!0}_triggerSyncComputation(e){this._computer.computeSync&&(this._result=this._result.concat(this._computer.computeSync(e))),this._setState(this._asyncIterableDone?0:3,e)}_triggerLoadingMessage(e){this._state===3&&this._setState(4,e)}_fireResult(e){if(this._state===1||this._state===2)return;let t=this._state===0,o=this._state===4;this._onResult.fire(new coi(this._result.slice(0),t,o,e))}start(e,t){if(e===0)this._state===0&&(this._setState(1,t),this._asyncComputationScheduler.schedule(t,this._firstWaitTime),this._loadingMessageScheduler.schedule(t,this._loadingMessageTime));else switch(this._state){case 0:this._triggerAsyncComputation(t),this._syncComputationScheduler.cancel(),this._triggerSyncComputation(t);break;case 2:this._syncComputationScheduler.cancel(),this._triggerSyncComputation(t);break}}cancel(){this._asyncComputationScheduler.cancel(),this._syncComputationScheduler.cancel(),this._loadingMessageScheduler.cancel(),this._asyncIterable&&(this._asyncIterable.cancel(),this._asyncIterable=null),this._result=[],this._options=void 0,this._state=0}get options(){return this._options}},g5e=class extends C{constructor(i,e){super(),this._scheduler=this._register(new Dt(()=>i(this._options),e))}schedule(i,e){this._options=i,this._scheduler.schedule(e)}cancel(){this._scheduler.cancel()}};var nO=class{constructor(){this._onDidWillResize=new E;this._onDidResize=new E;this._sashListener=new P;this._size=new ai(0,0);this._minSize=new ai(0,0);this._maxSize=new ai(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER);this.domNode=document.createElement("div"),this._eastSash=new pv(this.domNode,{getVerticalSashLeft:()=>this._size.width},{orientation:0}),this._westSash=new pv(this.domNode,{getVerticalSashLeft:()=>0},{orientation:0}),this._northSash=new pv(this.domNode,{getHorizontalSashTop:()=>0},{orientation:1,orthogonalEdge:"north"}),this._southSash=new pv(this.domNode,{getHorizontalSashTop:()=>this._size.height},{orientation:1,orthogonalEdge:"south"}),this._northSash.orthogonalStartSash=this._westSash,this._northSash.orthogonalEndSash=this._eastSash,this._southSash.orthogonalStartSash=this._westSash,this._southSash.orthogonalEndSash=this._eastSash;let i,e=0,t=0;this._sashListener.add(H.any(this._northSash.onDidStart,this._eastSash.onDidStart,this._southSash.onDidStart,this._westSash.onDidStart)(()=>{i===void 0&&(this._onDidWillResize.fire(),i=this._size,e=0,t=0)})),this._sashListener.add(H.any(this._northSash.onDidEnd,this._eastSash.onDidEnd,this._southSash.onDidEnd,this._westSash.onDidEnd)(()=>{i!==void 0&&(i=void 0,e=0,t=0,this._onDidResize.fire({dimension:this._size,done:!0}))})),this._sashListener.add(this._eastSash.onDidChange(o=>{i&&(t=o.currentX-o.startX,this.layout(i.height+e,i.width+t),this._onDidResize.fire({dimension:this._size,done:!1,east:!0}))})),this._sashListener.add(this._westSash.onDidChange(o=>{i&&(t=-(o.currentX-o.startX),this.layout(i.height+e,i.width+t),this._onDidResize.fire({dimension:this._size,done:!1,west:!0}))})),this._sashListener.add(this._northSash.onDidChange(o=>{i&&(e=-(o.currentY-o.startY),this.layout(i.height+e,i.width+t),this._onDidResize.fire({dimension:this._size,done:!1,north:!0}))})),this._sashListener.add(this._southSash.onDidChange(o=>{i&&(e=o.currentY-o.startY,this.layout(i.height+e,i.width+t),this._onDidResize.fire({dimension:this._size,done:!1,south:!0}))})),this._sashListener.add(H.any(this._eastSash.onDidReset,this._westSash.onDidReset)(o=>{this._preferredSize&&(this.layout(this._size.height,this._preferredSize.width),this._onDidResize.fire({dimension:this._size,done:!0}))})),this._sashListener.add(H.any(this._northSash.onDidReset,this._southSash.onDidReset)(o=>{this._preferredSize&&(this.layout(this._preferredSize.height,this._size.width),this._onDidResize.fire({dimension:this._size,done:!0}))}))}get onDidWillResize(){return this._onDidWillResize.event}get onDidResize(){return this._onDidResize.event}dispose(){this._northSash.dispose(),this._southSash.dispose(),this._eastSash.dispose(),this._westSash.dispose(),this._sashListener.dispose(),this._onDidResize.dispose(),this._onDidWillResize.dispose(),this.domNode.remove()}enableSashes(i,e,t,o){this._northSash.state=i?3:0,this._eastSash.state=e?3:0,this._southSash.state=t?3:0,this._westSash.state=o?3:0}layout(i=this.size.height,e=this.size.width){let{height:t,width:o}=this._minSize,{height:n,width:r}=this._maxSize;i=Math.max(t,Math.min(n,i)),e=Math.max(o,Math.min(r,e));let s=new ai(e,i);ai.equals(s,this._size)||(this.domNode.style.height=i+"px",this.domNode.style.width=e+"px",this._size=s,this._northSash.layout(),this._eastSash.layout(),this._southSash.layout(),this._westSash.layout())}clearSashHoverState(){this._eastSash.clearSashHoverState(),this._westSash.clearSashHoverState(),this._northSash.clearSashHoverState(),this._southSash.clearSashHoverState()}get size(){return this._size}set maxSize(i){this._maxSize=i}get maxSize(){return this._maxSize}set minSize(i){this._minSize=i}get minSize(){return this._minSize}set preferredSize(i){this._preferredSize=i}get preferredSize(){return this._preferredSize}};var O0o=30,F0o=24,AIt=class extends C{constructor(e,t=new ai(10,10)){super();this._editor=e;this.allowEditorOverflow=!0;this.suppressMouseDown=!1;this._resizableNode=this._register(new nO);this._contentPosition=null;this._isResizing=!1;this._resizableNode.domNode.style.position="absolute",this._resizableNode.minSize=ai.lift(t),this._resizableNode.layout(t.height,t.width),this._resizableNode.enableSashes(!0,!0,!0,!0),this._register(this._resizableNode.onDidResize(o=>{this._resize(new ai(o.dimension.width,o.dimension.height)),o.done&&(this._isResizing=!1)})),this._register(this._resizableNode.onDidWillResize(()=>{this._isResizing=!0}))}get isResizing(){return this._isResizing}getDomNode(){return this._resizableNode.domNode}getPosition(){return this._contentPosition}get position(){return this._contentPosition?.position?Ie.lift(this._contentPosition.position):void 0}_availableVerticalSpaceAbove(e){let t=this._editor.getDomNode(),o=this._editor.getScrolledVisiblePosition(e);return!t||!o?void 0:Yn(t).top+o.top-O0o}_availableVerticalSpaceBelow(e){let t=this._editor.getDomNode(),o=this._editor.getScrolledVisiblePosition(e);if(!t||!o)return;let n=Yn(t),r=Fm(t.ownerDocument.body),s=n.top+o.top+o.height;return r.height-s-F0o}_findPositionPreference(e,t){let o=Math.min(this._availableVerticalSpaceBelow(t)??1/0,e),n=Math.min(this._availableVerticalSpaceAbove(t)??1/0,e),r=Math.min(Math.max(n,o),e),s=Math.min(e,r),l;return this._editor.getOption(69).above?l=s<=n?1:2:l=s<=o?2:1,l===1?this._resizableNode.enableSashes(!0,!0,!1,!1):this._resizableNode.enableSashes(!1,!0,!0,!1),l}_resize(e){this._resizableNode.layout(e.height,e.width)}};var x3i=30,Rx=class extends AIt{constructor(e,t,o,n,r){let s=e.getOption(75)+8,l=150,c=new ai(l,s);super(e,c);this._configurationService=o;this._accessibilityService=n;this._keybindingService=r;this._hover=this._register(new e7(!0));this._onDidResize=this._register(new E);this.onDidResize=this._onDidResize.event;this._onDidScroll=this._register(new E);this.onDidScroll=this._onDidScroll.event;this._onContentsChanged=this._register(new E);this.onContentsChanged=this._onContentsChanged.event;this._minimumSize=c,this._hoverVisibleKey=ue.hoverVisible.bindTo(t),this._hoverFocusedKey=ue.hoverFocused.bindTo(t),R(this._resizableNode.domNode,this._hover.containerDomNode),this._resizableNode.domNode.style.zIndex="50",this._resizableNode.domNode.className="monaco-resizable-hover",this._register(this._editor.onDidLayoutChange(()=>{this.isVisible&&this._updateMaxDimensions()})),this._register(this._editor.onDidChangeConfiguration(p=>{p.hasChanged(59)&&this._updateFont()}));let u=this._register(Vn(this._resizableNode.domNode));this._register(u.onDidFocus(()=>{this._hoverFocusedKey.set(!0)})),this._register(u.onDidBlur(()=>{this._hoverFocusedKey.set(!1)})),this._register(this._hover.scrollbar.onScroll(p=>{this._onDidScroll.fire(p)})),this._setRenderedHover(void 0),this._editor.addContentWidget(this)}static{this.ID="editor.contrib.resizableContentHoverWidget"}static{this._lastDimensions=new ai(0,0)}get isVisibleFromKeyboard(){return this._renderedHover?.source===2}get isVisible(){return this._hoverVisibleKey.get()??!1}get isFocused(){return this._hoverFocusedKey.get()??!1}dispose(){super.dispose(),this._renderedHover?.dispose(),this._editor.removeContentWidget(this)}getId(){return Rx.ID}static _applyDimensions(e,t,o){let n=typeof t=="number"?`${t}px`:t,r=typeof o=="number"?`${o}px`:o;e.style.width=n,e.style.height=r}_setContentsDomNodeDimensions(e,t){let o=this._hover.contentsDomNode;return Rx._applyDimensions(o,e,t)}_setContainerDomNodeDimensions(e,t){let o=this._hover.containerDomNode;return Rx._applyDimensions(o,e,t)}_setScrollableElementDimensions(e,t){let o=this._hover.scrollbar.getDomNode();return Rx._applyDimensions(o,e,t)}_setHoverWidgetDimensions(e,t){this._setContainerDomNodeDimensions(e,t),this._setScrollableElementDimensions(e,t),this._setContentsDomNodeDimensions(e,t),this._layoutContentWidget()}static _applyMaxDimensions(e,t,o){let n=typeof t=="number"?`${t}px`:t,r=typeof o=="number"?`${o}px`:o;e.style.maxWidth=n,e.style.maxHeight=r}_setHoverWidgetMaxDimensions(e,t){Rx._applyMaxDimensions(this._hover.contentsDomNode,e,t),Rx._applyMaxDimensions(this._hover.scrollbar.getDomNode(),e,t),Rx._applyMaxDimensions(this._hover.containerDomNode,e,t),this._hover.containerDomNode.style.setProperty("--vscode-hover-maxWidth",typeof e=="number"?`${e}px`:e),this._layoutContentWidget()}_setAdjustedHoverWidgetDimensions(e){this._setHoverWidgetMaxDimensions("none","none"),this._setHoverWidgetDimensions(e.width,e.height)}_updateResizableNodeMaxDimensions(){let e=this._findMaximumRenderingWidth()??1/0,t=this._findMaximumRenderingHeight()??1/0;this._resizableNode.maxSize=new ai(e,t),this._setHoverWidgetMaxDimensions(e,t)}_resize(e){Rx._lastDimensions=new ai(e.width,e.height),this._setAdjustedHoverWidgetDimensions(e),this._resizableNode.layout(e.height,e.width),this._updateResizableNodeMaxDimensions(),this._hover.scrollbar.scanDomNode(),this._editor.layoutContentWidget(this),this._onDidResize.fire()}_findAvailableSpaceVertically(){let e=this._renderedHover?.showAtPosition;if(e)return this._positionPreference===1?this._availableVerticalSpaceAbove(e):this._availableVerticalSpaceBelow(e)}_findMaximumRenderingHeight(){let e=this._findAvailableSpaceVertically();if(!e)return;let o=this._hover.contentsDomNode.children.length-1;return Array.from(this._hover.contentsDomNode.children).forEach(n=>{o+=n.clientHeight}),Math.min(e,o)}_isHoverTextOverflowing(){this._hover.containerDomNode.style.setProperty("--vscode-hover-whiteSpace","nowrap"),this._hover.containerDomNode.style.setProperty("--vscode-hover-sourceWhiteSpace","nowrap");let e=Array.from(this._hover.contentsDomNode.children).some(t=>t.scrollWidth>t.clientWidth);return this._hover.containerDomNode.style.removeProperty("--vscode-hover-whiteSpace"),this._hover.containerDomNode.style.removeProperty("--vscode-hover-sourceWhiteSpace"),e}_findMaximumRenderingWidth(){if(!this._editor||!this._editor.hasModel())return;let e=this._isHoverTextOverflowing(),t=typeof this._contentWidth>"u"?0:this._contentWidth;return e||this._hover.containerDomNode.clientWidth<t?Fm(this._hover.containerDomNode.ownerDocument.body).width-14:this._hover.containerDomNode.clientWidth}isMouseGettingCloser(e,t){if(!this._renderedHover)return!1;if(this._renderedHover.initialMousePosX===void 0||this._renderedHover.initialMousePosY===void 0)return this._renderedHover.initialMousePosX=e,this._renderedHover.initialMousePosY=t,!1;let o=Yn(this.getDomNode());this._renderedHover.closestMouseDistance===void 0&&(this._renderedHover.closestMouseDistance=k3i(this._renderedHover.initialMousePosX,this._renderedHover.initialMousePosY,o.left,o.top,o.width,o.height));let n=k3i(e,t,o.left,o.top,o.width,o.height);return n>this._renderedHover.closestMouseDistance+4?!1:(this._renderedHover.closestMouseDistance=Math.min(this._renderedHover.closestMouseDistance,n),!0)}_setRenderedHover(e){this._renderedHover?.dispose(),this._renderedHover=e,this._hoverVisibleKey.set(!!e),this._hover.containerDomNode.classList.toggle("hidden",!e)}_updateFont(){let{fontSize:e,lineHeight:t}=this._editor.getOption(59),o=this._hover.contentsDomNode;o.style.fontSize=`${e}px`,o.style.lineHeight=`${t/e}`,Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach(r=>this._editor.applyFontInfo(r))}_updateContent(e){let t=this._hover.contentsDomNode;t.style.paddingBottom="",t.textContent="",t.appendChild(e)}_layoutContentWidget(){this._editor.layoutContentWidget(this),this._hover.onContentsChanged()}_updateMaxDimensions(){let e=Math.max(this._editor.getLayoutInfo().height/4,250,Rx._lastDimensions.height),t=Math.max(this._editor.getLayoutInfo().width*.66,750,Rx._lastDimensions.width);this._resizableNode.maxSize=new ai(t,e),this._setHoverWidgetMaxDimensions(t,e)}_render(e){this._setRenderedHover(e),this._updateFont(),this._updateContent(e.domNode),this.handleContentsChanged(),this._editor.render()}getPosition(){return this._renderedHover?{position:this._renderedHover.showAtPosition,secondaryPosition:this._renderedHover.showAtSecondaryPosition,positionAffinity:this._renderedHover.shouldAppearBeforeContent?3:void 0,preference:[this._positionPreference??1]}:null}show(e){if(!this._editor||!this._editor.hasModel())return;this._render(e);let t=nh(this._hover.containerDomNode),o=e.showAtPosition;this._positionPreference=this._findPositionPreference(t,o)??1,this.handleContentsChanged(),e.shouldFocus&&this._hover.containerDomNode.focus(),this._onDidResize.fire();let r=this._hover.containerDomNode.ownerDocument.activeElement===this._hover.containerDomNode&&ESt(this._configurationService.getValue("accessibility.verbosity.hover")===!0&&this._accessibilityService.isScreenReaderOptimized(),this._keybindingService.lookupKeybinding("editor.action.accessibleView")?.getAriaLabel()??"");r&&(this._hover.contentsDomNode.ariaLabel=this._hover.contentsDomNode.textContent+", "+r)}hide(){if(!this._renderedHover)return;let e=this._renderedHover.shouldFocus||this._hoverFocusedKey.get();this._setRenderedHover(void 0),this._resizableNode.maxSize=new ai(1/0,1/0),this._resizableNode.clearSashHoverState(),this._hoverFocusedKey.set(!1),this._editor.layoutContentWidget(this),e&&this._editor.focus()}_removeConstraintsRenderNormally(){let e=this._editor.getLayoutInfo();this._resizableNode.layout(e.height,e.width),this._setHoverWidgetDimensions("auto","auto"),this._updateMaxDimensions()}setMinimumDimensions(e){this._minimumSize=new ai(Math.max(this._minimumSize.width,e.width),Math.max(this._minimumSize.height,e.height)),this._updateMinimumWidth()}_updateMinimumWidth(){let e=typeof this._contentWidth>"u"?this._minimumSize.width:Math.min(this._contentWidth,this._minimumSize.width);this._resizableNode.minSize=new ai(e,this._minimumSize.height)}handleContentsChanged(){this._removeConstraintsRenderNormally();let e=this._hover.contentsDomNode,t=nh(e),o=yl(e)+2;if(this._resizableNode.layout(t,o),this._setHoverWidgetDimensions(o,t),t=nh(e),o=yl(e),this._contentWidth=o,this._updateMinimumWidth(),this._resizableNode.layout(t,o),this._renderedHover?.showAtPosition){let n=nh(this._hover.containerDomNode);this._positionPreference=this._findPositionPreference(n,this._renderedHover.showAtPosition)}this._layoutContentWidget(),this._onContentsChanged.fire()}focus(){this._hover.containerDomNode.focus()}scrollUp(){let e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._editor.getOption(59);this._hover.scrollbar.setScrollPosition({scrollTop:e-t.lineHeight})}scrollDown(){let e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._editor.getOption(59);this._hover.scrollbar.setScrollPosition({scrollTop:e+t.lineHeight})}scrollLeft(){let e=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:e-x3i})}scrollRight(){let e=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:e+x3i})}pageUp(){let e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._hover.scrollbar.getScrollDimensions().height;this._hover.scrollbar.setScrollPosition({scrollTop:e-t})}pageDown(){let e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._hover.scrollbar.getScrollDimensions().height;this._hover.scrollbar.setScrollPosition({scrollTop:e+t})}goToTop(){this._hover.scrollbar.setScrollPosition({scrollTop:0})}goToBottom(){this._hover.scrollbar.setScrollPosition({scrollTop:this._hover.scrollbar.getScrollDimensions().scrollHeight})}};Rx=I([m(1,X),m(2,B),m(3,Bi),m(4,_e)],Rx);function k3i(a,i,e,t,o,n){let r=e+o/2,s=t+n/2,l=Math.max(Math.abs(a-r)-o/2,0),c=Math.max(Math.abs(i-s)-n/2,0);return Math.sqrt(l*l+c*c)}var NIt=class a{constructor(i,e){this._editor=i;this._participants=e}static _getLineDecorations(i,e){if(e.type!==1&&!e.supportsMarkerHover)return[];let t=i.getModel(),o=e.range.startLineNumber;if(o>t.getLineCount())return[];let n=t.getLineMaxColumn(o);return i.getLineDecorations(o).filter(r=>{if(r.options.isWholeLine)return!0;let s=r.range.startLineNumber===o?r.range.startColumn:1,l=r.range.endLineNumber===o?r.range.endColumn:n;if(r.options.showIfCollapsed){if(s>e.range.startColumn+1||e.range.endColumn-1>l)return!1}else if(s>e.range.startColumn||e.range.endColumn>l)return!1;return!0})}computeAsync(i,e){let t=i.anchor;if(!this._editor.hasModel()||!t)return Fp.EMPTY;let o=a._getLineDecorations(this._editor,t);return Fp.merge(this._participants.map(n=>n.computeAsync?n.computeAsync(t,o,i.source,e):Fp.EMPTY))}computeSync(i){if(!this._editor.hasModel())return[];let e=i.anchor,t=a._getLineDecorations(this._editor,e),o=[];for(let n of this._participants)o=o.concat(n.computeSync(e,t,i.source));return si(o)}};var v5e=class{constructor(i,e,t){this.hoverParts=i;this.isComplete=e;this.options=t}filter(i){let e=this.hoverParts.filter(t=>t.isValidForHoverAnchor(i));return e.length===this.hoverParts.length?this:new doi(this,e,this.isComplete,this.options)}},doi=class extends v5e{constructor(e,t,o,n){super(t,o,n);this.original=e}filter(e){return this.original.filter(e)}};var E3i=_,f7=class extends C{constructor(e,t){super();this._keybindingService=e;this._hoverService=t;this.actions=[];this._hasContent=!1;this.hoverElement=E3i("div.hover-row.status-bar"),this.hoverElement.tabIndex=0,this.actionsElement=R(this.hoverElement,E3i("div.actions"))}get hasContent(){return this._hasContent}addAction(e){let t=this._keybindingService.lookupKeybinding(e.commandId),o=t?t.getLabel():null;this._hasContent=!0;let n=this._register(t7.render(this.actionsElement,e,o));return this._register(this._hoverService.setupManagedHover(Ni("element"),n.actionContainer,n.actionRenderedLabel)),this.actions.push(n),n}append(e){let t=R(this.actionsElement,e);return this._hasContent=!0,t}};f7=I([m(0,_e),m(1,tt)],f7);function Dwe(a){let i=a;return typeof i=="object"&&"markdown"in i&&"markdownNotSupportedFallback"in i}function T3i(a){let i=a;return typeof i=="object"&&"element"in i}var b7={inputActiveOptionBorder:"#007ACC00",inputActiveOptionForeground:"#FFFFFF",inputActiveOptionBackground:"#0E639C50"},Gae=class extends oc{constructor(i,e,t){super(i,e,t);let o=this.options.keybinding?`${this._action.label} (${this.options.keybinding})`:this._action.label;this.toggle=this._register(new Kh({actionClassName:this._action.class,isChecked:!!this._action.checked,title:o,notFocusable:!0,inputActiveOptionBackground:t.toggleStyles?.inputActiveOptionBackground,inputActiveOptionBorder:t.toggleStyles?.inputActiveOptionBorder,inputActiveOptionForeground:t.toggleStyles?.inputActiveOptionForeground})),this._register(this.toggle.onChange(()=>{this._action.checked=!!this.toggle&&this.toggle.checked}))}render(i){this.element=i,this.element.appendChild(this.toggle.domNode),this.updateChecked(),this.updateEnabled()}updateEnabled(){this.toggle&&(this.isEnabled()?(this.toggle.enable(),this.element?.classList.remove("disabled")):(this.toggle.disable(),this.element?.classList.add("disabled")))}updateChecked(){this.toggle.checked=!!this._action.checked}updateLabel(){let i=this.options.keybinding?`${this._action.label} (${this.options.keybinding})`:this._action.label;this.toggle.setTitle(i)}focus(){this.toggle.domNode.tabIndex=0,this.toggle.focus()}blur(){this.toggle.domNode.tabIndex=-1,this.toggle.domNode.blur()}setFocusable(i){this.toggle.domNode.tabIndex=i?0:-1}},Kh=class extends Ma{constructor(e){super();this._onChange=this._register(new E);this._onKeyDown=this._register(new E);this._opts=e,this._title=this._opts.title,this._checked=this._opts.isChecked;let t=["monaco-custom-toggle"];this._opts.icon&&(this._icon=this._opts.icon,t.push(...q.asClassNameArray(this._icon))),this._opts.actionClassName&&t.push(...this._opts.actionClassName.split(" ")),this._checked&&t.push("checked"),this.domNode=document.createElement("div"),this._register(yp().setupDelayedHover(this.domNode,()=>({content:!Mr(this._title)&&!Ao(this._title)?fu(this._title):this._title,style:1}),this._opts.hoverLifecycleOptions)),this.domNode.classList.add(...t),this._opts.notFocusable||(this.domNode.tabIndex=0),this.domNode.setAttribute("role","checkbox"),this.domNode.setAttribute("aria-checked",String(this._checked)),this.setTitle(this._opts.title),this.applyStyles(),this.onclick(this.domNode,o=>{this.enabled&&(this.checked=!this._checked,this._onChange.fire(!1),o.preventDefault(),o.stopPropagation())}),this._register(this.ignoreGesture(this.domNode)),this.onkeydown(this.domNode,o=>{if(this.enabled){if(o.keyCode===10||o.keyCode===3){this.checked=!this._checked,this._onChange.fire(!0),o.preventDefault(),o.stopPropagation();return}this._onKeyDown.fire(o)}})}get onChange(){return this._onChange.event}get onKeyDown(){return this._onKeyDown.event}get enabled(){return this.domNode.getAttribute("aria-disabled")!=="true"}focus(){this.domNode.focus()}get checked(){return this._checked}set checked(e){this._checked=e,this.domNode.setAttribute("aria-checked",String(this._checked)),this.domNode.classList.toggle("checked",this._checked),this.applyStyles()}setIcon(e){this._icon&&this.domNode.classList.remove(...q.asClassNameArray(this._icon)),this._icon=e,this._icon&&this.domNode.classList.add(...q.asClassNameArray(this._icon))}width(){return 22}applyStyles(){this.domNode&&(this.domNode.style.borderColor=this._checked&&this._opts.inputActiveOptionBorder||"",this.domNode.style.color=this._checked&&this._opts.inputActiveOptionForeground||"inherit",this.domNode.style.backgroundColor=this._checked&&this._opts.inputActiveOptionBackground||"")}enable(){this.domNode.setAttribute("aria-disabled",String(!1)),this.domNode.classList.remove("disabled")}disable(){this.domNode.setAttribute("aria-disabled",String(!0)),this.domNode.classList.add("disabled")}setTitle(e){this._title=e;let t=typeof e=="string"?e:Mr(e)?e.value:e.textContent;this.domNode.setAttribute("aria-label",m1(t))}set visible(e){this.domNode.style.display=e?"":"none"}get visible(){return this.domNode.style.display!=="none"}},b5e=class extends Ma{constructor(e,t,o){super();this.checkbox=e;this.domNode=t;this.styles=o;this._onChange=this._register(new E);this.onChange=this._onChange.event;this.applyStyles()}static{this.CLASS_NAME="monaco-checkbox"}get enabled(){return this.checkbox.enabled}focus(){this.domNode.focus()}hasFocus(){return sa(this.domNode)}enable(){this.checkbox.enable(),this.applyStyles(!0)}disable(){this.checkbox.disable(),this.applyStyles(!1)}setTitle(e){this.checkbox.setTitle(e)}applyStyles(e=this.enabled){this.domNode.style.color=(e?this.styles.checkboxForeground:this.styles.checkboxDisabledForeground)||"",this.domNode.style.backgroundColor=(e?this.styles.checkboxBackground:this.styles.checkboxDisabledBackground)||"",this.domNode.style.borderColor=(e?this.styles.checkboxBorder:this.styles.checkboxDisabledBackground)||"";let t=this.styles.size||18;this.domNode.style.width=this.domNode.style.height=this.domNode.style.fontSize=`${t}px`,this.domNode.style.fontSize=`${t-2}px`}},hv=class extends b5e{constructor(i,e,t){let o=new Kh({title:i,isChecked:e,icon:M.check,actionClassName:b5e.CLASS_NAME,hoverLifecycleOptions:t.hoverLifecycleOptions,...b7});super(o,o.domNode,t),this._register(o),this._register(this.checkbox.onChange(n=>{this.applyStyles(),this._onChange.fire(n)}))}get checked(){return this.checkbox.checked}set checked(i){this.checkbox.checked=i,this.applyStyles()}applyStyles(i){this.checkbox.checked?this.checkbox.setIcon(M.check):this.checkbox.setIcon(void 0),super.applyStyles(i)}},v7=class extends b5e{constructor(e,t,o){let n;switch(t){case!0:n=M.check;break;case"mixed":n=M.dash;break;case!1:n=void 0;break}let r=new Kh({title:e,isChecked:t===!0,icon:n,actionClassName:hv.CLASS_NAME,hoverLifecycleOptions:o.hoverLifecycleOptions,...b7});super(r,r.domNode,o);this._state=t;this._register(r),this._register(this.checkbox.onChange(s=>{this._state=this.checkbox.checked,this.applyStyles(),this._onChange.fire(s)}))}get checked(){return this._state}set checked(e){this._state!==e&&(this._state=e,this.checkbox.checked=e===!0,this.applyStyles())}applyStyles(e){switch(this._state){case!0:this.checkbox.setIcon(M.check);break;case"mixed":this.checkbox.setIcon(M.dash);break;case!1:this.checkbox.setIcon(void 0);break}super.applyStyles(e)}},OIt=class extends oc{constructor(i,e,t){super(i,e,t),this.toggle=this._register(new hv(this._action.label,!!this._action.checked,t.checkboxStyles)),this._register(this.toggle.onChange(()=>this.onChange()))}render(i){if(this.element=i,this.element.classList.add("checkbox-action-item"),this.element.appendChild(this.toggle.domNode),this.options.label&&this._action.label){let e=this.element.appendChild(_("span.checkbox-label",void 0,this._action.label));this._register(j(e,re.CLICK,t=>{this.toggle.checked=!this.toggle.checked,t.stopPropagation(),t.preventDefault(),this.onChange()}))}this.updateEnabled(),this.updateClass(),this.updateChecked()}onChange(){this._action.checked=!!this.toggle&&this.toggle.checked,this.actionRunner.run(this._action,this._context)}updateEnabled(){this.isEnabled()?this.toggle.enable():this.toggle.disable(),this.action.enabled?this.element?.classList.remove("disabled"):this.element?.classList.add("disabled")}updateChecked(){this.toggle.checked=!!this._action.checked}updateClass(){this.cssClass&&this.toggle.domNode.classList.remove(...this.cssClass.split(" ")),this.cssClass=this.getClass(),this.cssClass&&this.toggle.domNode.classList.add(...this.cssClass.split(" "))}focus(){this.toggle.domNode.tabIndex=0,this.toggle.focus()}blur(){this.toggle.domNode.tabIndex=-1,this.toggle.domNode.blur()}setFocusable(i){this.toggle.domNode.tabIndex=i?0:-1}};function T1(a){return(i,e)=>{if(i.checked!==void 0)return new Gae(null,i,{...e,toggleStyles:a})}}var Vq=class a{constructor(i){this._editor=i,this._decorations=[],this._overviewRulerApproximateDecorations=[],this._findScopeDecorationIds=[],this._rangeHighlightDecorationId=null,this._highlightedDecorationId=null,this._startPosition=this._editor.getPosition()}dispose(){this._editor.removeDecorations(this._allDecorations()),this._decorations=[],this._overviewRulerApproximateDecorations=[],this._findScopeDecorationIds=[],this._rangeHighlightDecorationId=null,this._highlightedDecorationId=null}reset(){this._decorations=[],this._overviewRulerApproximateDecorations=[],this._findScopeDecorationIds=[],this._rangeHighlightDecorationId=null,this._highlightedDecorationId=null}getCount(){return this._decorations.length}getFindScope(){return this._findScopeDecorationIds[0]?this._editor.getModel().getDecorationRange(this._findScopeDecorationIds[0]):null}getFindScopes(){if(this._findScopeDecorationIds.length){let i=this._findScopeDecorationIds.map(e=>this._editor.getModel().getDecorationRange(e)).filter(e=>!!e);if(i.length)return i}return null}getStartPosition(){return this._startPosition}setStartPosition(i){this._startPosition=i,this.setCurrentFindMatch(null)}_getDecorationIndex(i){let e=this._decorations.indexOf(i);return e>=0?e+1:1}getDecorationRangeAt(i){let e=i<this._decorations.length?this._decorations[i]:null;return e?this._editor.getModel().getDecorationRange(e):null}getCurrentMatchesPosition(i){let e=this._editor.getModel().getDecorationsInRange(i);for(let t of e){let o=t.options;if(o===a._FIND_MATCH_DECORATION||o===a._FIND_MATCH_NO_OVERVIEW_DECORATION||o===a._CURRENT_FIND_MATCH_DECORATION)return this._getDecorationIndex(t.id)}return 0}setCurrentFindMatch(i){let e=null,t=0;if(i)for(let o=0,n=this._decorations.length;o<n;o++){let r=this._editor.getModel().getDecorationRange(this._decorations[o]);if(i.equalsRange(r)){e=this._decorations[o],t=o+1;break}}return(this._highlightedDecorationId!==null||e!==null)&&this._editor.changeDecorations(o=>{if(this._highlightedDecorationId!==null&&(o.changeDecorationOptions(this._highlightedDecorationId,a._FIND_MATCH_DECORATION),this._highlightedDecorationId=null),e!==null&&(this._highlightedDecorationId=e,o.changeDecorationOptions(this._highlightedDecorationId,a._CURRENT_FIND_MATCH_DECORATION)),this._rangeHighlightDecorationId!==null&&(o.removeDecoration(this._rangeHighlightDecorationId),this._rangeHighlightDecorationId=null),e!==null){let n=this._editor.getModel().getDecorationRange(e);if(n.startLineNumber!==n.endLineNumber&&n.endColumn===1){let r=n.endLineNumber-1,s=this._editor.getModel().getLineMaxColumn(r);n=new z(n.startLineNumber,n.startColumn,r,s)}this._rangeHighlightDecorationId=o.addDecoration(n,a._RANGE_HIGHLIGHT_DECORATION)}}),t}set(i,e){this._editor.changeDecorations(t=>{let o=a._FIND_MATCH_DECORATION,n=[];if(i.length>1e3){o=a._FIND_MATCH_NO_OVERVIEW_DECORATION;let s=this._editor.getModel().getLineCount(),c=this._editor.getLayoutInfo().height/s,u=Math.max(2,Math.ceil(3/c)),p=i[0].range.startLineNumber,h=i[0].range.endLineNumber;for(let g=1,f=i.length;g<f;g++){let v=i[g].range;h+u>=v.startLineNumber?v.endLineNumber>h&&(h=v.endLineNumber):(n.push({range:new z(p,1,h,1),options:a._FIND_MATCH_ONLY_OVERVIEW_DECORATION}),p=v.startLineNumber,h=v.endLineNumber)}n.push({range:new z(p,1,h,1),options:a._FIND_MATCH_ONLY_OVERVIEW_DECORATION})}let r=new Array(i.length);for(let s=0,l=i.length;s<l;s++)r[s]={range:i[s].range,options:o};this._decorations=t.deltaDecorations(this._decorations,r),this._overviewRulerApproximateDecorations=t.deltaDecorations(this._overviewRulerApproximateDecorations,n),this._rangeHighlightDecorationId&&(t.removeDecoration(this._rangeHighlightDecorationId),this._rangeHighlightDecorationId=null),this._findScopeDecorationIds.length&&(this._findScopeDecorationIds.forEach(s=>t.removeDecoration(s)),this._findScopeDecorationIds=[]),e?.length&&(this._findScopeDecorationIds=e.map(s=>t.addDecoration(s,a._FIND_SCOPE_DECORATION)))})}matchBeforePosition(i){if(this._decorations.length===0)return null;for(let e=this._decorations.length-1;e>=0;e--){let t=this._decorations[e],o=this._editor.getModel().getDecorationRange(t);if(!(!o||o.endLineNumber>i.lineNumber)){if(o.endLineNumber<i.lineNumber)return o;if(!(o.endColumn>i.column))return o}}return this._editor.getModel().getDecorationRange(this._decorations[this._decorations.length-1])}matchAfterPosition(i){if(this._decorations.length===0)return null;for(let e=0,t=this._decorations.length;e<t;e++){let o=this._decorations[e],n=this._editor.getModel().getDecorationRange(o);if(!(!n||n.startLineNumber<i.lineNumber)){if(n.startLineNumber>i.lineNumber)return n;if(!(n.startColumn<i.column))return n}}return this._editor.getModel().getDecorationRange(this._decorations[0])}_allDecorations(){let i=[];return i=i.concat(this._decorations),i=i.concat(this._overviewRulerApproximateDecorations),this._findScopeDecorationIds.length&&i.push(...this._findScopeDecorationIds),this._rangeHighlightDecorationId&&i.push(this._rangeHighlightDecorationId),i}static{this._CURRENT_FIND_MATCH_DECORATION=po.register({description:"current-find-match",stickiness:1,zIndex:13,className:"currentFindMatch",inlineClassName:"currentFindMatchInline",showIfCollapsed:!0,overviewRuler:{color:Ss(MN),position:2},minimap:{color:Ss(a9),position:1}})}static{this._FIND_MATCH_DECORATION=po.register({description:"find-match",stickiness:1,zIndex:10,className:"findMatch",inlineClassName:"findMatchInline",showIfCollapsed:!0,overviewRuler:{color:Ss(MN),position:2},minimap:{color:Ss(a9),position:1}})}static{this._FIND_MATCH_NO_OVERVIEW_DECORATION=po.register({description:"find-match-no-overview",stickiness:1,className:"findMatch",showIfCollapsed:!0})}static{this._FIND_MATCH_ONLY_OVERVIEW_DECORATION=po.register({description:"find-match-only-overview",stickiness:1,overviewRuler:{color:Ss(MN),position:2}})}static{this._RANGE_HIGHLIGHT_DECORATION=po.register({description:"find-range-highlight",stickiness:1,className:"rangeHighlight",isWholeLine:!0})}static{this._FIND_SCOPE_DECORATION=po.register({description:"find-scope",className:"findScope",isWholeLine:!0})}};var FIt=class{constructor(i,e,t){this._editorSelection=i,this._ranges=e,this._replaceStrings=t,this._trackedEditorSelectionId=null}getEditOperations(i,e){if(this._ranges.length>0){let t=[];for(let r=0;r<this._ranges.length;r++)t.push({range:this._ranges[r],text:this._replaceStrings[r]});t.sort((r,s)=>z.compareRangesUsingStarts(r.range,s.range));let o=[],n=t[0];for(let r=1;r<t.length;r++)n.range.endLineNumber===t[r].range.startLineNumber&&n.range.endColumn===t[r].range.startColumn?(n.range=n.range.plusRange(t[r].range),n.text=n.text+t[r].text):(o.push(n),n=t[r]);o.push(n);for(let r of o)e.addEditOperation(r.range,r.text)}this._trackedEditorSelectionId=e.trackSelection(this._editorSelection)}computeCursorState(i,e){return e.getTrackedSelection(this._trackedEditorSelectionId)}};function S5e(a,i){if(a&&a[0]!==""){let e=_3i(a,i,"-"),t=_3i(a,i,"_");return e&&!t?D3i(a,i,"-"):!e&&t?D3i(a,i,"_"):a[0].toUpperCase()===a[0]?i.toUpperCase():a[0].toLowerCase()===a[0]?i.toLowerCase():gGe(a[0][0])&&i.length>0?i[0].toUpperCase()+i.substr(1):a[0][0].toUpperCase()!==a[0][0]&&i.length>0?i[0].toLowerCase()+i.substr(1):i}else return i}function _3i(a,i,e){return a[0].indexOf(e)!==-1&&i.indexOf(e)!==-1&&a[0].split(e).length===i.split(e).length}function D3i(a,i,e){let t=i.split(e),o=a[0].split(e),n="";return t.forEach((r,s)=>{n+=S5e([o[s]],r)+e}),n.slice(0,-1)}var WIt=class{constructor(i){this.staticValue=i;this.kind=0}},uoi=class{constructor(i){this.pieces=i;this.kind=1}},S7=class a{static fromStaticValue(i){return new a([Lwe.staticValue(i)])}get hasReplacementPatterns(){return this._state.kind===1}constructor(i){!i||i.length===0?this._state=new WIt(""):i.length===1&&i[0].staticValue!==null?this._state=new WIt(i[0].staticValue):this._state=new uoi(i)}buildReplaceString(i,e){if(this._state.kind===0)return e?S5e(i,this._state.staticValue):this._state.staticValue;let t="";for(let o=0,n=this._state.pieces.length;o<n;o++){let r=this._state.pieces[o];if(r.staticValue!==null){t+=r.staticValue;continue}let s=a._substitute(r.matchIndex,i);if(r.caseOps!==null&&r.caseOps.length>0){let l=[],c=r.caseOps.length,u=0;for(let p=0,h=s.length;p<h;p++){if(u>=c){l.push(s.slice(p));break}switch(r.caseOps[u]){case"U":l.push(s[p].toUpperCase());break;case"u":l.push(s[p].toUpperCase()),u++;break;case"L":l.push(s[p].toLowerCase());break;case"l":l.push(s[p].toLowerCase()),u++;break;default:l.push(s[p])}}s=l.join("")}t+=s}return t}static _substitute(i,e){if(e===null)return"";if(i===0)return e[0];let t="";for(;i>0;){if(i<e.length)return(e[i]||"")+t;t=String(i%10)+t,i=Math.floor(i/10)}return"$"+t}},Lwe=class a{static staticValue(i){return new a(i,-1,null)}static matchIndex(i){return new a(null,i,null)}static caseOps(i,e){return new a(null,i,e)}constructor(i,e,t){this.staticValue=i,this.matchIndex=e,!t||t.length===0?this.caseOps=null:this.caseOps=t.slice(0)}},poi=class{constructor(i){this._source=i,this._lastCharIndex=0,this._result=[],this._resultLen=0,this._currentStaticPiece=""}emitUnchanged(i){this._emitStatic(this._source.substring(this._lastCharIndex,i)),this._lastCharIndex=i}emitStatic(i,e){this._emitStatic(i),this._lastCharIndex=e}_emitStatic(i){i.length!==0&&(this._currentStaticPiece+=i)}emitMatchIndex(i,e,t){this._currentStaticPiece.length!==0&&(this._result[this._resultLen++]=Lwe.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),this._result[this._resultLen++]=Lwe.caseOps(i,t),this._lastCharIndex=e}finalize(){return this.emitUnchanged(this._source.length),this._currentStaticPiece.length!==0&&(this._result[this._resultLen++]=Lwe.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),new S7(this._result)}};function VIt(a){if(!a||a.length===0)return new S7(null);let i=[],e=new poi(a);for(let t=0,o=a.length;t<o;t++){let n=a.charCodeAt(t);if(n===92){if(t++,t>=o)break;let r=a.charCodeAt(t);switch(r){case 92:e.emitUnchanged(t-1),e.emitStatic("\\",t+1);break;case 110:e.emitUnchanged(t-1),e.emitStatic(`
`,t+1);break;case 116:e.emitUnchanged(t-1),e.emitStatic(" ",t+1);break;case 117:case 85:case 108:case 76:e.emitUnchanged(t-1),e.emitStatic("",t+1),i.push(String.fromCharCode(r));break}continue}if(n===36){if(t++,t>=o)break;let r=a.charCodeAt(t);if(r===36){e.emitUnchanged(t-1),e.emitStatic("$",t+1);continue}if(r===48||r===38){e.emitUnchanged(t-1),e.emitMatchIndex(0,t+1,i),i.length=0;continue}if(49<=r&&r<=57){let s=r-48;if(t+1<o){let l=a.charCodeAt(t+1);if(48<=l&&l<=57){t++,s=s*10+(l-48),e.emitUnchanged(t-2),e.emitMatchIndex(s,t+1,i),i.length=0;continue}}e.emitUnchanged(t-1),e.emitMatchIndex(s,t+1,i),i.length=0;continue}}}return e.finalize()}var fE=new Q("findWidgetVisible",!1),L3i=fE.toNegated(),Rwe=new Q("findInputFocussed",!1),I5e=new Q("replaceInputFocussed",!1),HIt=new Q("findWidgetFocused",!1),Bq={primary:545,mac:{primary:2593}},Hq={primary:565,mac:{primary:2613}},Uq={primary:560,mac:{primary:2608}},y5e={primary:554,mac:{primary:2602}},$ae={primary:558,mac:{primary:2606}},ad={StartFindAction:"actions.find",StartFindWithSelection:"actions.findWithSelection",StartFindWithArgs:"editor.actions.findWithArgs",NextMatchFindAction:"editor.action.nextMatchFindAction",PreviousMatchFindAction:"editor.action.previousMatchFindAction",GoToMatchFindAction:"editor.action.goToMatchFindAction",NextSelectionMatchFindAction:"editor.action.nextSelectionMatchFindAction",PreviousSelectionMatchFindAction:"editor.action.previousSelectionMatchFindAction",StartFindReplaceAction:"editor.action.startFindReplaceAction",CloseFindWidgetCommand:"closeFindWidget",ToggleCaseSensitiveCommand:"toggleFindCaseSensitive",ToggleWholeWordCommand:"toggleFindWholeWord",ToggleRegexCommand:"toggleFindRegex",ToggleSearchScopeCommand:"toggleFindInSelection",TogglePreserveCaseCommand:"togglePreserveCase",ReplaceOneAction:"editor.action.replaceOne",ReplaceAllAction:"editor.action.replaceAll",SelectAllMatchesAction:"editor.action.selectAllMatches"},rO=19999,W0o=240,BIt=class a{constructor(i,e){this._toDispose=new P;this._editor=i,this._state=e,this._isDisposed=!1,this._startSearchingTimer=new Nl,this._decorations=new Vq(i),this._toDispose.add(this._decorations),this._updateDecorationsScheduler=new Dt(()=>{if(this._editor.hasModel())return this.research(!1)},100),this._toDispose.add(this._updateDecorationsScheduler),this._toDispose.add(this._editor.onDidChangeCursorPosition(t=>{(t.reason===3||t.reason===5||t.reason===6)&&this._decorations.setStartPosition(this._editor.getPosition())})),this._ignoreModelContentChanged=!1,this._toDispose.add(this._editor.onDidChangeModelContent(t=>{this._ignoreModelContentChanged||(t.isFlush&&this._decorations.reset(),this._decorations.setStartPosition(this._editor.getPosition()),this._updateDecorationsScheduler.schedule())})),this._toDispose.add(this._state.onFindReplaceStateChange(t=>this._onStateChanged(t))),this.research(!1,this._state.searchScope)}dispose(){this._isDisposed=!0,Ue(this._startSearchingTimer),this._toDispose.dispose()}_onStateChanged(i){this._isDisposed||this._editor.hasModel()&&(i.searchString||i.isReplaceRevealed||i.isRegex||i.wholeWord||i.matchCase||i.searchScope)&&(this._editor.getModel().isTooLargeForSyncing()?(this._startSearchingTimer.cancel(),this._startSearchingTimer.setIfNotSet(()=>{i.searchScope?this.research(i.moveCursor,this._state.searchScope):this.research(i.moveCursor)},W0o)):i.searchScope?this.research(i.moveCursor,this._state.searchScope):this.research(i.moveCursor))}static _getSearchRange(i,e){return e||i.getFullModelRange()}research(i,e){let t=null;typeof e<"u"?e!==null&&(Array.isArray(e)?t=e:t=[e]):t=this._decorations.getFindScopes(),t!==null&&(t=t.map(s=>{if(s.startLineNumber!==s.endLineNumber){let l=s.endLineNumber;return s.endColumn===1&&(l=l-1),new z(s.startLineNumber,1,l,this._editor.getModel().getLineMaxColumn(l))}return s}));let o=this._findMatches(t,!1,rO);this._decorations.set(o,t);let n=this._editor.getSelection(),r=this._decorations.getCurrentMatchesPosition(n);if(r===0&&o.length>0){let s=xy(o.map(l=>l.range),l=>z.compareRangesUsingStarts(l,n)>=0);r=s>0?s-1+1:r}this._state.changeMatchInfo(r,this._decorations.getCount(),void 0),i&&this._editor.getOption(50).cursorMoveOnType&&this._moveToNextMatch(this._decorations.getStartPosition())}_hasMatches(){return this._state.matchesCount>0}_cannotFind(){if(!this._hasMatches()){let i=this._decorations.getFindScope();return i&&this._editor.revealRangeInCenterIfOutsideViewport(i,0),!0}return!1}_setCurrentFindMatch(i){let e=this._decorations.setCurrentFindMatch(i);this._state.changeMatchInfo(e,this._decorations.getCount(),i),this._editor.setSelection(i),this._editor.revealRangeInCenterIfOutsideViewport(i,0)}_prevSearchPosition(i){let e=this._state.isRegex&&(this._state.searchString.indexOf("^")>=0||this._state.searchString.indexOf("$")>=0),{lineNumber:t,column:o}=i,n=this._editor.getModel();return e||o===1?(t===1?t=n.getLineCount():t--,o=n.getLineMaxColumn(t)):o--,new Ie(t,o)}_moveToPrevMatch(i,e=!1){if(!this._state.canNavigateBack()){let u=this._decorations.matchAfterPosition(i);u&&this._setCurrentFindMatch(u);return}if(this._decorations.getCount()<rO){let u=this._decorations.matchBeforePosition(i);u&&u.isEmpty()&&u.getStartPosition().equals(i)&&(i=this._prevSearchPosition(i),u=this._decorations.matchBeforePosition(i)),u&&this._setCurrentFindMatch(u);return}if(this._cannotFind())return;let t=this._decorations.getFindScope(),o=a._getSearchRange(this._editor.getModel(),t);o.getEndPosition().isBefore(i)&&(i=o.getEndPosition()),i.isBefore(o.getStartPosition())&&(i=o.getEndPosition());let{lineNumber:n,column:r}=i,s=this._editor.getModel(),l=new Ie(n,r),c=s.findPreviousMatch(this._state.searchString,l,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null,!1);if(c&&c.range.isEmpty()&&c.range.getStartPosition().equals(l)&&(l=this._prevSearchPosition(l),c=s.findPreviousMatch(this._state.searchString,l,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null,!1)),!!c){if(!e&&!o.containsRange(c.range))return this._moveToPrevMatch(c.range.getStartPosition(),!0);this._setCurrentFindMatch(c.range)}}moveToPrevMatch(){this._moveToPrevMatch(this._editor.getSelection().getStartPosition())}_nextSearchPosition(i){let e=this._state.isRegex&&(this._state.searchString.indexOf("^")>=0||this._state.searchString.indexOf("$")>=0),{lineNumber:t,column:o}=i,n=this._editor.getModel();return e||o===n.getLineMaxColumn(t)?(t===n.getLineCount()?t=1:t++,o=1):o++,new Ie(t,o)}_moveToNextMatch(i){if(!this._state.canNavigateForward()){let t=this._decorations.matchBeforePosition(i);t&&this._setCurrentFindMatch(t);return}if(this._decorations.getCount()<rO){let t=this._decorations.matchAfterPosition(i);t&&t.isEmpty()&&t.getStartPosition().equals(i)&&(i=this._nextSearchPosition(i),t=this._decorations.matchAfterPosition(i)),t&&this._setCurrentFindMatch(t);return}let e=this._getNextMatch(i,!1,!0);e&&this._setCurrentFindMatch(e.range)}_getNextMatch(i,e,t,o=!1){if(this._cannotFind())return null;let n=this._decorations.getFindScope(),r=a._getSearchRange(this._editor.getModel(),n);r.getEndPosition().isBefore(i)&&(i=r.getStartPosition()),i.isBefore(r.getStartPosition())&&(i=r.getStartPosition());let{lineNumber:s,column:l}=i,c=this._editor.getModel(),u=new Ie(s,l),p=c.findNextMatch(this._state.searchString,u,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null,e);return t&&p&&p.range.isEmpty()&&p.range.getStartPosition().equals(u)&&(u=this._nextSearchPosition(u),p=c.findNextMatch(this._state.searchString,u,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null,e)),p?!o&&!r.containsRange(p.range)?this._getNextMatch(p.range.getEndPosition(),e,t,!0):p:null}moveToNextMatch(){this._moveToNextMatch(this._editor.getSelection().getEndPosition())}_moveToMatch(i){let e=this._decorations.getDecorationRangeAt(i);e&&this._setCurrentFindMatch(e)}moveToMatch(i){this._moveToMatch(i)}_getReplacePattern(){return this._state.isRegex?VIt(this._state.replaceString):S7.fromStaticValue(this._state.replaceString)}replace(){if(!this._hasMatches())return;let i=this._getReplacePattern(),e=this._editor.getSelection(),t=this._getNextMatch(e.getStartPosition(),!0,!1);if(t)if(e.equalsRange(t.range)){let o=i.buildReplaceString(t.matches,this._state.preserveCase),n=new Wh(e,o);this._executeEditorCommand("replace",n),this._decorations.setStartPosition(new Ie(e.startLineNumber,e.startColumn+o.length)),this.research(!0)}else this._decorations.setStartPosition(this._editor.getPosition()),this._setCurrentFindMatch(t.range)}_findMatches(i,e,t){let o=(i||[null]).map(n=>a._getSearchRange(this._editor.getModel(),n));return this._editor.getModel().findMatches(this._state.searchString,o,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null,e,t)}replaceAll(){if(!this._hasMatches())return;let i=this._decorations.getFindScopes();i===null&&this._state.matchesCount>=rO?this._largeReplaceAll():this._regularReplaceAll(i),this.research(!1)}_largeReplaceAll(){let e=new Oy(this._state.searchString,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null).parseSearchRequest();if(!e)return;let t=e.regex;if(!t.multiline){let p="mu";t.ignoreCase&&(p+="i"),t.global&&(p+="g"),t=new RegExp(t.source,p)}let o=this._editor.getModel(),n=o.getValue(1),r=o.getFullModelRange(),s=this._getReplacePattern(),l,c=this._state.preserveCase;s.hasReplacementPatterns||c?l=n.replace(t,function(){return s.buildReplaceString(arguments,c)}):l=n.replace(t,s.buildReplaceString(null,c));let u=new B6(r,l,this._editor.getSelection());this._executeEditorCommand("replaceAll",u)}_regularReplaceAll(i){let e=this._getReplacePattern(),t=this._findMatches(i,e.hasReplacementPatterns||this._state.preserveCase,1073741824),o=[];for(let r=0,s=t.length;r<s;r++)o[r]=e.buildReplaceString(t[r].matches,this._state.preserveCase);let n=new FIt(this._editor.getSelection(),t.map(r=>r.range),o);this._executeEditorCommand("replaceAll",n)}selectAllMatches(){if(!this._hasMatches())return;let i=this._decorations.getFindScopes(),t=this._findMatches(i,!1,1073741824).map(n=>new Yt(n.range.startLineNumber,n.range.startColumn,n.range.endLineNumber,n.range.endColumn)),o=this._editor.getSelection();for(let n=0,r=t.length;n<r;n++)if(t[n].equalsRange(o)){t=[o].concat(t.slice(0,n)).concat(t.slice(n+1));break}this._editor.setSelections(t)}_executeEditorCommand(i,e){try{this._ignoreModelContentChanged=!0,this._editor.pushUndoStop(),this._editor.executeCommand(i,e),this._editor.pushUndoStop()}finally{this._ignoreModelContentChanged=!1}}};var V0o=d(10,null),B0o=d(12,null),H0o=d(11,null),Mwe=class extends Kh{constructor(i){super({icon:M.caseSensitive,title:V0o+i.appendTitle,isChecked:i.isChecked,hoverLifecycleOptions:i.hoverLifecycleOptions,inputActiveOptionBorder:i.inputActiveOptionBorder,inputActiveOptionForeground:i.inputActiveOptionForeground,inputActiveOptionBackground:i.inputActiveOptionBackground})}},Pwe=class extends Kh{constructor(i){super({icon:M.wholeWord,title:B0o+i.appendTitle,isChecked:i.isChecked,hoverLifecycleOptions:i.hoverLifecycleOptions,inputActiveOptionBorder:i.inputActiveOptionBorder,inputActiveOptionForeground:i.inputActiveOptionForeground,inputActiveOptionBackground:i.inputActiveOptionBackground})}},Awe=class extends Kh{constructor(i){super({icon:M.regex,title:H0o+i.appendTitle,isChecked:i.isChecked,hoverLifecycleOptions:i.hoverLifecycleOptions,inputActiveOptionBorder:i.inputActiveOptionBorder,inputActiveOptionForeground:i.inputActiveOptionForeground,inputActiveOptionBackground:i.inputActiveOptionBackground})}};function R3i(a,i,e){let t=e??document.createElement("div");return t.textContent=a,t}function RL(a,i,e){let t=e??document.createElement("div");return t.textContent="",M3i(t,U0o(a,!!i?.renderCodeSegments),i?.actionHandler,i?.renderCodeSegments),t}var moi=class{constructor(i){this.source=i,this.index=0}eos(){return this.index>=this.source.length}next(){let i=this.peek();return this.advance(),i}peek(){return this.source[this.index]}advance(){this.index++}};function M3i(a,i,e,t){let o;if(i.type===2)o=document.createTextNode(i.content||"");else if(i.type===3)o=document.createElement("b");else if(i.type===4)o=document.createElement("i");else if(i.type===7&&t)o=document.createElement("code");else if(i.type===5&&e){let n=document.createElement("a");e.disposables.add(Vo(n,"click",r=>{e.callback(String(i.index),r)})),o=n}else i.type===8?o=document.createElement("br"):i.type===1&&(o=a);o&&a!==o&&a.appendChild(o),o&&Array.isArray(i.children)&&i.children.forEach(n=>{M3i(o,n,e,t)})}function U0o(a,i){let e={type:1,children:[]},t=0,o=e,n=[],r=new moi(a);for(;!r.eos();){let s=r.next(),l=s==="\\"&&hoi(r.peek(),i)!==0;if(l&&(s=r.next()),!l&&z0o(s,i)&&s===r.peek()){r.advance(),o.type===2&&(o=n.pop());let c=hoi(s,i);if(o.type===c||o.type===5&&c===6)o=n.pop();else{let u={type:c,children:[]};c===5&&(u.index=t,t++),o.children.push(u),n.push(o),o=u}}else if(s===`
`)o.type===2&&(o=n.pop()),o.children.push({type:8});else if(o.type!==2){let c={type:2,content:s};o.children.push(c),n.push(o),o=c}else o.content+=s}return o.type===2&&(o=n.pop()),n.length,e}function z0o(a,i){return hoi(a,i)!==0}function hoi(a,i){switch(a){case"*":return 3;case"_":return 4;case"[":return 5;case"]":return 6;case"`":return i?7:0;default:return 0}}var UIt=class{constructor(i,e=0,t=i.length,o=e-1){this.items=i;this.start=e;this.end=t;this.index=o}current(){return this.index===this.start-1||this.index===this.end?null:this.items[this.index]}next(){return this.index=Math.min(this.index+1,this.end),this.current()}previous(){return this.index=Math.max(this.index-1,this.start-1),this.current()}first(){return this.index=this.start,this.current()}last(){return this.index=this.end-1,this.current()}};var I7=class{constructor(i=new Set,e=10){this._history=i;this._limit=e,this._onChange(),this._history.onDidChange&&(this._disposable=this._history.onDidChange(()=>this._onChange()))}getHistory(){return this._elements}add(i){this._history.delete(i),this._history.add(i),this._onChange()}next(){return this._navigator.next()}previous(){return this._currentPosition()!==0?this._navigator.previous():null}current(){return this._navigator.current()}first(){return this._navigator.first()}last(){return this._navigator.last()}isFirst(){return this._currentPosition()===0}isLast(){return this._currentPosition()>=this._elements.length-1}isNowhere(){return this._navigator.current()===null}has(i){return this._history.has(i)}clear(){this._history.clear(),this._onChange()}_onChange(){this._reduceToLimit();let i=this._elements;this._navigator=new UIt(i,0,i.length,i.length)}_reduceToLimit(){let i=this._elements;if(i.length>this._limit){let e=i.slice(i.length-this._limit);this._history.replace?this._history.replace(e):this._history=new Set(e)}}_currentPosition(){let i=this._navigator.current();return i?this._elements.indexOf(i):-1}get _elements(){let i=[];return this._history.forEach(e=>i.push(e)),i}dispose(){this._disposable&&(this._disposable.dispose(),this._disposable=void 0)}},zq=class{constructor(i,e=10,t=o=>o){this.capacity=e;this.identityFn=t;if(i.length<1)throw new Error("not supported");this._size=1,this.head=this.tail=this.cursor={value:i[0],previous:void 0,next:void 0},this.valueSet=new lre([i[0]],t);for(let o=1;o<i.length;o++)this.add(i[o])}get size(){return this._size}add(i){let e={value:i,previous:this.tail,next:void 0};for(this.tail.next=e,this.tail=e,this.cursor=this.tail,this._size++,this.valueSet.has(i)?this._deleteFromList(i):this.valueSet.add(i);this._size>this.capacity;)this.valueSet.delete(this.head.value),this.head=this.head.next,this.head.previous=void 0,this._size--}replaceLast(i){if(this.identityFn(this.tail.value)===this.identityFn(i))return i;let e=this.tail.value;return this.valueSet.delete(e),this.tail.value=i,this.valueSet.has(i)?this._deleteFromList(i):this.valueSet.add(i),e}prepend(i){if(this._size===this.capacity||this.valueSet.has(i))return;let e={value:i,previous:void 0,next:this.head};this.head.previous=e,this.head=e,this._size++,this.valueSet.add(i)}isAtEnd(){return this.cursor===this.tail}current(){return this.cursor.value}previous(){return this.cursor.previous&&(this.cursor=this.cursor.previous),this.cursor.value}next(){return this.cursor.next&&(this.cursor=this.cursor.next),this.cursor.value}has(i){return this.valueSet.has(i)}resetCursor(){return this.cursor=this.tail,this.cursor.value}*[Symbol.iterator](){let i=this.head;for(;i;)yield i.value,i=i.next}_deleteFromList(i){let e=this.head,t=this.identityFn(i);for(;e!==this.tail;)this.identityFn(e.value)===t&&(e===this.head?(this.head=this.head.next,this.head.previous=void 0):(e.previous.next=e.next,e.next.previous=e.previous),this._size--),e=e.next}};var Nwe=_;var P3i={inputBackground:"#3C3C3C",inputForeground:"#CCCCCC",inputValidationInfoBorder:"#55AAFF",inputValidationInfoBackground:"#063B49",inputValidationWarningBorder:"#B89500",inputValidationWarningBackground:"#352A05",inputValidationErrorBorder:"#BE1100",inputValidationErrorBackground:"#5A1D1D",inputBorder:void 0,inputValidationErrorForeground:void 0,inputValidationInfoForeground:void 0,inputValidationWarningForeground:void 0},Dc=class extends Ma{constructor(e,t,o){super();this.state="idle";this.maxHeight=Number.POSITIVE_INFINITY;this.hover=this._register(new me);this._onDidChange=this._register(new E);this._onDidHeightChange=this._register(new E);this.contextViewProvider=t,this.options=o,this.message=null,this.placeholder=this.options.placeholder||"",this.tooltip=this.options.tooltip??(this.placeholder||""),this.ariaLabel=this.options.ariaLabel||"",this.options.validationOptions&&(this.validation=this.options.validationOptions.validation),this.element=R(e,Nwe(".monaco-inputbox.idle"));let n=this.options.flexibleHeight?"textarea":"input",r=R(this.element,Nwe(".ibwrapper"));if(this.input=R(r,Nwe(n+".input.empty")),this.input.setAttribute("autocorrect","off"),this.input.setAttribute("autocapitalize","off"),this.input.setAttribute("spellcheck","false"),this.onfocus(this.input,()=>this.element.classList.add("synthetic-focus")),this.onblur(this.input,()=>this.element.classList.remove("synthetic-focus")),this.options.flexibleHeight){this.maxHeight=typeof this.options.flexibleMaxHeight=="number"?this.options.flexibleMaxHeight:Number.POSITIVE_INFINITY,this.mirror=R(r,Nwe("div.mirror")),this.mirror.innerText="\xA0",this.scrollableElement=new f9(this.element,{vertical:1}),this.options.flexibleWidth&&(this.input.setAttribute("wrap","off"),this.mirror.style.whiteSpace="pre",this.mirror.style.wordWrap="initial"),R(e,this.scrollableElement.getDomNode()),this._register(this.scrollableElement),this._register(this.scrollableElement.onScroll(c=>this.input.scrollTop=c.scrollTop));let s=this._register(new On(e.ownerDocument,"selectionchange")),l=H.filter(s.event,()=>e.ownerDocument.getSelection()?.anchorNode===r);this._register(l(this.updateScrollDimensions,this)),this._register(this.onDidHeightChange(this.updateScrollDimensions,this))}else this.input.type=this.options.type||"text",this.input.setAttribute("wrap","off");this.ariaLabel&&this.input.setAttribute("aria-label",this.ariaLabel),this.placeholder&&!this.options.showPlaceholderOnFocus&&this.setPlaceHolder(this.placeholder),this.tooltip&&this.setTooltip(this.tooltip),this.oninput(this.input,()=>this.onValueChange()),this.onblur(this.input,()=>this.onBlur()),this.onfocus(this.input,()=>this.onFocus()),this._register(this.ignoreGesture(this.input)),setTimeout(()=>this.updateMirror(),0),this.options.actions&&(this.actionbar=this._register(new ji(this.element,{actionViewItemProvider:this.options.actionViewItemProvider})),this.actionbar.push(this.options.actions,{icon:!0,label:!1})),this.applyStyles()}get onDidChange(){return this._onDidChange.event}get onDidHeightChange(){return this._onDidHeightChange.event}setActions(e,t){this.actionbar?(this.actionbar.clear(),e&&this.actionbar.push(e,{icon:!0,label:!1})):e&&(this.actionbar=this._register(new ji(this.element,{actionViewItemProvider:t??this.options.actionViewItemProvider})),this.actionbar.push(e,{icon:!0,label:!1}))}onBlur(){this._hideMessage(),this.options.showPlaceholderOnFocus&&this.input.setAttribute("placeholder","")}onFocus(){this._showMessage(),this.options.showPlaceholderOnFocus&&this.input.setAttribute("placeholder",this.placeholder||"")}setPlaceHolder(e){this.placeholder=e,this.input.setAttribute("placeholder",e)}setTooltip(e){this.tooltip=e,this.hover.value||(this.hover.value=this._register(yp().setupDelayedHoverAtMouse(this.input,()=>({content:this.tooltip,appearance:{compact:!0}}))))}setAriaLabel(e){this.ariaLabel=e,e?this.input.setAttribute("aria-label",this.ariaLabel):this.input.removeAttribute("aria-label")}getAriaLabel(){return this.ariaLabel}get mirrorElement(){return this.mirror}get inputElement(){return this.input}get value(){return this.input.value}set value(e){this.input.value!==e&&(this.input.value=e,this.onValueChange())}get step(){return this.input.step}set step(e){this.input.step=e}get height(){return typeof this.cachedHeight=="number"?this.cachedHeight:nh(this.element)}focus(){this.input.focus()}blur(){this.input.blur()}hasFocus(){return sa(this.input)}select(e=null){this.input.select(),e&&(this.input.setSelectionRange(e.start,e.end),e.end===this.input.value.length&&(this.input.scrollLeft=this.input.scrollWidth))}isSelectionAtEnd(){return this.input.selectionEnd===this.input.value.length&&this.input.selectionStart===this.input.selectionEnd}getSelection(){let e=this.input.selectionStart;if(e===null)return null;let t=this.input.selectionEnd??e;return{start:e,end:t}}enable(){this.input.removeAttribute("disabled")}disable(){this.blur(),this.input.disabled=!0,this._hideMessage()}setEnabled(e){e?this.enable():this.disable()}get width(){return yl(this.input)}set width(e){if(this.options.flexibleHeight&&this.options.flexibleWidth){let t=0;if(this.mirror){let o=parseFloat(this.mirror.style.paddingLeft||"")||0,n=parseFloat(this.mirror.style.paddingRight||"")||0;t=o+n}this.input.style.width=e-t+"px"}else this.input.style.width=e+"px";this.mirror&&(this.mirror.style.width=e+"px")}set paddingRight(e){this.input.style.width=`calc(100% - ${e}px)`,this.mirror&&(this.mirror.style.paddingRight=e+"px")}updateScrollDimensions(){if(typeof this.cachedContentHeight!="number"||typeof this.cachedHeight!="number"||!this.scrollableElement)return;let e=this.cachedContentHeight,t=this.cachedHeight,o=this.input.scrollTop;this.scrollableElement.setScrollDimensions({scrollHeight:e,height:t}),this.scrollableElement.setScrollPosition({scrollTop:o})}showMessage(e,t){if(this.state==="open"&&uo(this.message,e))return;this.message=e,this.element.classList.remove("idle"),this.element.classList.remove("info"),this.element.classList.remove("warning"),this.element.classList.remove("error"),this.element.classList.add(this.classForType(e.type));let o=this.stylesForType(this.message.type);this.element.style.border=`1px solid ${n_(o.border,"transparent")}`,this.message.content&&(this.hasFocus()||t)&&this._showMessage()}hideMessage(){this.message=null,this.element.classList.remove("info"),this.element.classList.remove("warning"),this.element.classList.remove("error"),this.element.classList.add("idle"),this._hideMessage(),this.applyStyles()}isInputValid(){return!!this.validation&&!this.validation(this.value)}validate(){let e=null;return this.validation&&(e=this.validation(this.value),e?(this.inputElement.setAttribute("aria-invalid","true"),this.showMessage(e)):this.inputElement.hasAttribute("aria-invalid")&&(this.inputElement.removeAttribute("aria-invalid"),this.hideMessage())),e?.type}stylesForType(e){let t=this.options.inputBoxStyles;switch(e){case 1:return{border:t.inputValidationInfoBorder,background:t.inputValidationInfoBackground,foreground:t.inputValidationInfoForeground};case 2:return{border:t.inputValidationWarningBorder,background:t.inputValidationWarningBackground,foreground:t.inputValidationWarningForeground};default:return{border:t.inputValidationErrorBorder,background:t.inputValidationErrorBackground,foreground:t.inputValidationErrorForeground}}}classForType(e){switch(e){case 1:return"info";case 2:return"warning";default:return"error"}}_showMessage(){if(!this.contextViewProvider||!this.message)return;let e,t=()=>e.style.width=yl(this.element)+"px";this.contextViewProvider.showContextView({getAnchor:()=>this.element,anchorAlignment:1,render:n=>{if(!this.message)return null;e=R(n,Nwe(".monaco-inputbox-container")),t();let r=Nwe("span.monaco-inputbox-message");this.message.formatContent?RL(this.message.content,void 0,r):R3i(this.message.content,void 0,r),r.classList.add(this.classForType(this.message.type));let s=this.stylesForType(this.message.type);return r.style.backgroundColor=s.background??"",r.style.color=s.foreground??"",r.style.border=s.border?`1px solid ${s.border}`:"",R(e,r),null},onHide:()=>{this.state="closed"},layout:t});let o;this.message.type===3?o=d(19,null,this.message.content):this.message.type===2?o=d(21,null,this.message.content):o=d(20,null,this.message.content),Jo(o),this.state="open"}_hideMessage(){this.contextViewProvider&&(this.state==="open"&&this.contextViewProvider.hideContextView(),this.state="idle")}layoutMessage(){this.state==="open"&&this.contextViewProvider&&this.contextViewProvider.layout()}onValueChange(){this._onDidChange.fire(this.value),this.validate(),this.updateMirror(),this.input.classList.toggle("empty",!this.value),this.state==="open"&&this.contextViewProvider&&this.contextViewProvider.layout(),this.options.hideHoverOnValueChange&&yp().hideHover()}updateMirror(){if(!this.mirror)return;let e=this.value,o=e.charCodeAt(e.length-1)===10?" ":"";(e+o).replace(/\u000c/g,"")?this.mirror.textContent=e+o:this.mirror.innerText="\xA0",this.layout()}applyStyles(){let e=this.options.inputBoxStyles,t=e.inputBackground??"",o=e.inputForeground??"",n=e.inputBorder??"";this.element.style.backgroundColor=t,this.element.style.color=o,this.input.style.backgroundColor="inherit",this.input.style.color=o,this.element.style.border=`1px solid ${n_(n,"transparent")}`}layout(){if(!this.mirror){this.layoutMessage();return}let e=this.cachedContentHeight;this.cachedContentHeight=nh(this.mirror),e!==this.cachedContentHeight&&(this.cachedHeight=Math.min(this.cachedContentHeight,this.maxHeight),this.input.style.height=this.cachedHeight+"px",this._onDidHeightChange.fire(this.cachedContentHeight)),this.layoutMessage()}insertAtCursor(e){let t=this.inputElement,o=t.selectionStart,n=t.selectionEnd,r=t.value;o!==null&&n!==null&&(this.value=r.substr(0,o)+e+r.substr(n),t.setSelectionRange(o+1,o+1),this.layout())}dispose(){this._hideMessage(),this.message=null,this.actionbar?.dispose(),super.dispose()}},y7=class extends Dc{constructor(e,t,o){let n=d(24,null,"\u21C5"),r=d(23,null,"\u21C5");super(e,t,o);this._onDidFocus=this._register(new E);this.onDidFocus=this._onDidFocus.event;this._onDidBlur=this._register(new E);this.onDidBlur=this._onDidBlur.event;this.history=this._register(new I7(o.history,100));let s=()=>{if(o.showHistoryHint&&o.showHistoryHint()&&!this.placeholder.endsWith(n)&&!this.placeholder.endsWith(r)&&this.history.getHistory().length){let l=this.placeholder.endsWith(")")?n:r,c=this.placeholder+l;o.showPlaceholderOnFocus&&!sa(this.input)?this.placeholder=c:this.setPlaceHolder(c)}};this.observer=new MutationObserver((l,c)=>{l.forEach(u=>{u.target.textContent||s()})}),this.observer.observe(this.input,{attributeFilter:["class"]}),this.onfocus(this.input,()=>s()),this.onblur(this.input,()=>{let l=c=>{if(this.placeholder.endsWith(c)){let u=this.placeholder.slice(0,this.placeholder.length-c.length);return o.showPlaceholderOnFocus?this.placeholder=u:this.setPlaceHolder(u),!0}else return!1};l(r)||l(n)})}dispose(){super.dispose(),this.observer&&(this.observer.disconnect(),this.observer=void 0)}addToHistory(e){this.value&&(e||this.value!==this.getCurrentValue())&&this.history.add(this.value)}prependHistory(e){let t=this.getHistory();this.clearHistory(),e.forEach(o=>{this.history.add(o)}),t.forEach(o=>{this.history.add(o)})}getHistory(){return this.history.getHistory()}isAtFirstInHistory(){return this.history.isFirst()}isAtLastInHistory(){return this.history.isLast()}isNowhereInHistory(){return this.history.isNowhere()}showNextValue(){this.history.has(this.value)||this.addToHistory();let e=this.getNextValue();e&&(e=e===this.value?this.getNextValue():e),this.value=e??"",Or(this.value?this.value:d(22,null))}showPreviousValue(){this.history.has(this.value)||this.addToHistory();let e=this.getPreviousValue();e&&(e=e===this.value?this.getPreviousValue():e),e&&(this.value=e,Or(this.value))}clearHistory(){this.history.clear()}setPlaceHolder(e){super.setPlaceHolder(e),this.setTooltip(e)}onBlur(){super.onBlur(),this._onDidBlur.fire()}onFocus(){super.onFocus(),this._onDidFocus.fire()}getCurrentValue(){let e=this.history.current();return e||(e=this.history.last(),this.history.next()),e}getPreviousValue(){return this.history.previous()||this.history.first()}getNextValue(){return this.history.next()}};var K0o=d(9,null),_1=class extends Ma{constructor(e,t,o){super();this.fixFocusOnOptionClickEnabled=!0;this.imeSessionInProgress=!1;this.additionalTogglesDisposables=this._register(new me);this.additionalToggles=[];this._onDidOptionChange=this._register(new E);this._onKeyDown=this._register(new E);this._onMouseDown=this._register(new E);this._onInput=this._register(new E);this._onKeyUp=this._register(new E);this._onCaseSensitiveKeyDown=this._register(new E);this._onRegexKeyDown=this._register(new E);this._lastHighlightFindOptions=0;this.placeholder=o.placeholder||"",this.validation=o.validation,this.label=o.label||K0o,this.showCommonFindToggles=!!o.showCommonFindToggles;let n=o.appendCaseSensitiveLabel||"",r=o.appendWholeWordsLabel||"",s=o.appendRegexLabel||"",l=!!o.flexibleHeight,c=!!o.flexibleWidth,u=o.flexibleMaxHeight;if(this.domNode=document.createElement("div"),this.domNode.classList.add("monaco-findInput"),this.inputBox=this._register(new y7(this.domNode,t,{placeholder:this.placeholder||"",ariaLabel:this.label||"",validationOptions:{validation:this.validation},showHistoryHint:o.showHistoryHint,flexibleHeight:l,flexibleWidth:c,flexibleMaxHeight:u,inputBoxStyles:o.inputBoxStyles,history:o.history,actions:o.actions,actionViewItemProvider:o.actionViewItemProvider,hideHoverOnValueChange:o.hideHoverOnValueChange})),this.showCommonFindToggles){let p=o?.hoverLifecycleOptions||{groupId:"find-input"};this.regex=this._register(new Awe({appendTitle:s,isChecked:!1,hoverLifecycleOptions:p,...o.toggleStyles})),this._register(this.regex.onChange(g=>{this._onDidOptionChange.fire(g),!g&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()})),this._register(this.regex.onKeyDown(g=>{this._onRegexKeyDown.fire(g)})),this.wholeWords=this._register(new Pwe({appendTitle:r,isChecked:!1,hoverLifecycleOptions:p,...o.toggleStyles})),this._register(this.wholeWords.onChange(g=>{this._onDidOptionChange.fire(g),!g&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()})),this.caseSensitive=this._register(new Mwe({appendTitle:n,isChecked:!1,hoverLifecycleOptions:p,...o.toggleStyles})),this._register(this.caseSensitive.onChange(g=>{this._onDidOptionChange.fire(g),!g&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()})),this._register(this.caseSensitive.onKeyDown(g=>{this._onCaseSensitiveKeyDown.fire(g)}));let h=[this.caseSensitive.domNode,this.wholeWords.domNode,this.regex.domNode];this.onkeydown(this.domNode,g=>{if(g.equals(15)||g.equals(17)||g.equals(9)){let f=h.indexOf(this.domNode.ownerDocument.activeElement);if(f>=0){let v=-1;g.equals(17)?v=(f+1)%h.length:g.equals(15)&&(f===0?v=h.length-1:v=f-1),g.equals(9)?(h[f].blur(),this.inputBox.focus()):v>=0&&h[v].focus(),$t.stop(g,!0)}}})}this.controls=document.createElement("div"),this.controls.className="controls",this.controls.style.display=this.showCommonFindToggles?"":"none",this.caseSensitive&&this.controls.append(this.caseSensitive.domNode),this.wholeWords&&this.controls.appendChild(this.wholeWords.domNode),this.regex&&this.controls.appendChild(this.regex.domNode),this.setAdditionalToggles(o?.additionalToggles),this.controls&&this.domNode.appendChild(this.controls),e?.appendChild(this.domNode),this._register(j(this.inputBox.inputElement,"compositionstart",p=>{this.imeSessionInProgress=!0})),this._register(j(this.inputBox.inputElement,"compositionend",p=>{this.imeSessionInProgress=!1,this._onInput.fire()})),this.onkeydown(this.inputBox.inputElement,p=>this._onKeyDown.fire(p)),this.onkeyup(this.inputBox.inputElement,p=>this._onKeyUp.fire(p)),this.oninput(this.inputBox.inputElement,p=>this._onInput.fire()),this.onmousedown(this.inputBox.inputElement,p=>this._onMouseDown.fire(p))}static{this.OPTION_CHANGE="optionChange"}get onDidOptionChange(){return this._onDidOptionChange.event}get onKeyDown(){return this._onKeyDown.event}get onMouseDown(){return this._onMouseDown.event}get onInput(){return this._onInput.event}get onKeyUp(){return this._onKeyUp.event}get onCaseSensitiveKeyDown(){return this._onCaseSensitiveKeyDown.event}get onRegexKeyDown(){return this._onRegexKeyDown.event}get isImeSessionInProgress(){return this.imeSessionInProgress}get onDidChange(){return this.inputBox.onDidChange}layout(e){this.inputBox.layout(),this.updateInputBoxPadding(e.collapsedFindWidget)}enable(){this.domNode.classList.remove("disabled"),this.inputBox.enable(),this.regex?.enable(),this.wholeWords?.enable(),this.caseSensitive?.enable();for(let e of this.additionalToggles)e.enable()}disable(){this.domNode.classList.add("disabled"),this.inputBox.disable(),this.regex?.disable(),this.wholeWords?.disable(),this.caseSensitive?.disable();for(let e of this.additionalToggles)e.disable()}setFocusInputOnOptionClick(e){this.fixFocusOnOptionClickEnabled=e}setEnabled(e){e?this.enable():this.disable()}setAdditionalToggles(e){for(let t of this.additionalToggles)t.domNode.remove();this.additionalToggles=[],this.additionalTogglesDisposables.value=new P;for(let t of e??[])this.additionalTogglesDisposables.value.add(t),this.controls.appendChild(t.domNode),this.additionalTogglesDisposables.value.add(t.onChange(o=>{this._onDidOptionChange.fire(o),!o&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus()})),this.additionalToggles.push(t);this.additionalToggles.length>0&&(this.controls.style.display=""),this.updateInputBoxPadding()}setActions(e,t){this.inputBox.setActions(e,t)}updateInputBoxPadding(e=!1){e?this.inputBox.paddingRight=0:this.inputBox.paddingRight=(this.caseSensitive?.width()??0)+(this.wholeWords?.width()??0)+(this.regex?.width()??0)+this.additionalToggles.reduce((t,o)=>t+o.width(),0)}clear(){this.clearValidation(),this.setValue(""),this.focus()}getValue(){return this.inputBox.value}setValue(e){this.inputBox.value!==e&&(this.inputBox.value=e)}onSearchSubmit(){this.inputBox.addToHistory()}select(){this.inputBox.select()}focus(){this.inputBox.focus()}getCaseSensitive(){return this.caseSensitive?.checked??!1}setCaseSensitive(e){this.caseSensitive&&(this.caseSensitive.checked=e)}getWholeWords(){return this.wholeWords?.checked??!1}setWholeWords(e){this.wholeWords&&(this.wholeWords.checked=e)}getRegex(){return this.regex?.checked??!1}setRegex(e){this.regex&&(this.regex.checked=e,this.validate())}focusOnCaseSensitive(){this.caseSensitive?.focus()}focusOnRegex(){this.regex?.focus()}highlightFindOptions(){this.domNode.classList.remove("highlight-"+this._lastHighlightFindOptions),this._lastHighlightFindOptions=1-this._lastHighlightFindOptions,this.domNode.classList.add("highlight-"+this._lastHighlightFindOptions)}validate(){this.inputBox.validate()}showMessage(e){this.inputBox.showMessage(e)}clearMessage(){this.inputBox.hideMessage()}clearValidation(){this.inputBox.hideMessage()}};var G0o=d(13,null),$0o=d(14,null),goi=class extends Kh{constructor(i){super({icon:M.preserveCase,title:$0o+i.appendTitle,isChecked:i.isChecked,hoverLifecycleOptions:i.hoverLifecycleOptions,inputActiveOptionBorder:i.inputActiveOptionBorder,inputActiveOptionForeground:i.inputActiveOptionForeground,inputActiveOptionBackground:i.inputActiveOptionBackground})}},zIt=class extends Ma{constructor(e,t,o,n){super();this._showOptionButtons=o;this.fixFocusOnOptionClickEnabled=!0;this.cachedOptionsWidth=0;this._onDidOptionChange=this._register(new E);this._onKeyDown=this._register(new E);this._onMouseDown=this._register(new E);this._onInput=this._register(new E);this._onKeyUp=this._register(new E);this._onPreserveCaseKeyDown=this._register(new E);this._lastHighlightFindOptions=0;this.contextViewProvider=t,this.placeholder=n.placeholder||"",this.validation=n.validation,this.label=n.label||G0o;let r=n.appendPreserveCaseLabel||"",s=n.history||new Set([]),l=!!n.flexibleHeight,c=!!n.flexibleWidth,u=n.flexibleMaxHeight;this.domNode=document.createElement("div"),this.domNode.classList.add("monaco-findInput"),this.inputBox=this._register(new y7(this.domNode,this.contextViewProvider,{ariaLabel:this.label||"",placeholder:this.placeholder||"",validationOptions:{validation:this.validation},history:s,showHistoryHint:n.showHistoryHint,flexibleHeight:l,flexibleWidth:c,flexibleMaxHeight:u,inputBoxStyles:n.inputBoxStyles})),this.preserveCase=this._register(new goi({appendTitle:r,isChecked:!1,hoverLifecycleOptions:n.hoverLifecycleOptions,...n.toggleStyles})),this._register(this.preserveCase.onChange(g=>{this._onDidOptionChange.fire(g),!g&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()})),this._register(this.preserveCase.onKeyDown(g=>{this._onPreserveCaseKeyDown.fire(g)})),this._showOptionButtons?this.cachedOptionsWidth=this.preserveCase.width():this.cachedOptionsWidth=0;let p=[this.preserveCase.domNode];this.onkeydown(this.domNode,g=>{if(g.equals(15)||g.equals(17)||g.equals(9)){let f=p.indexOf(this.domNode.ownerDocument.activeElement);if(f>=0){let v=-1;g.equals(17)?v=(f+1)%p.length:g.equals(15)&&(f===0?v=p.length-1:v=f-1),g.equals(9)?(p[f].blur(),this.inputBox.focus()):v>=0&&p[v].focus(),$t.stop(g,!0)}}});let h=document.createElement("div");h.className="controls",h.style.display=this._showOptionButtons?"block":"none",h.appendChild(this.preserveCase.domNode),this.domNode.appendChild(h),e?.appendChild(this.domNode),this.onkeydown(this.inputBox.inputElement,g=>this._onKeyDown.fire(g)),this.onkeyup(this.inputBox.inputElement,g=>this._onKeyUp.fire(g)),this.oninput(this.inputBox.inputElement,g=>this._onInput.fire()),this.onmousedown(this.inputBox.inputElement,g=>this._onMouseDown.fire(g))}static{this.OPTION_CHANGE="optionChange"}get onDidOptionChange(){return this._onDidOptionChange.event}get onKeyDown(){return this._onKeyDown.event}get onMouseDown(){return this._onMouseDown.event}get onInput(){return this._onInput.event}get onKeyUp(){return this._onKeyUp.event}get onPreserveCaseKeyDown(){return this._onPreserveCaseKeyDown.event}enable(){this.domNode.classList.remove("disabled"),this.inputBox.enable(),this.preserveCase.enable()}disable(){this.domNode.classList.add("disabled"),this.inputBox.disable(),this.preserveCase.disable()}setFocusInputOnOptionClick(e){this.fixFocusOnOptionClickEnabled=e}setEnabled(e){e?this.enable():this.disable()}clear(){this.clearValidation(),this.setValue(""),this.focus()}getValue(){return this.inputBox.value}setValue(e){this.inputBox.value!==e&&(this.inputBox.value=e)}onSearchSubmit(){this.inputBox.addToHistory()}applyStyles(){}select(){this.inputBox.select()}focus(){this.inputBox.focus()}getPreserveCase(){return this.preserveCase.checked}setPreserveCase(e){this.preserveCase.checked=e}focusOnPreserve(){this.preserveCase.focus()}highlightFindOptions(){this.domNode.classList.remove("highlight-"+this._lastHighlightFindOptions),this._lastHighlightFindOptions=1-this._lastHighlightFindOptions,this.domNode.classList.add("highlight-"+this._lastHighlightFindOptions)}validate(){this.inputBox?.validate()}showMessage(e){this.inputBox?.showMessage(e)}clearMessage(){this.inputBox?.hideMessage()}clearValidation(){this.inputBox?.hideMessage()}set width(e){this.inputBox.paddingRight=this.cachedOptionsWidth,this.domNode.style.width=e+"px"}dispose(){super.dispose()}};var GIt=new Q("suggestWidgetVisible",!1,d(2099,null)),foi="historyNavigationWidgetFocus",A3i="historyNavigationForwardsEnabled",N3i="historyNavigationBackwardsEnabled",w5e,KIt=[];function qM(a,i){if(KIt.includes(i))throw new Error("Cannot register the same widget multiple times");KIt.push(i);let e=new P,t=new Q(foi,!1).bindTo(a),o=new Q(A3i,!0).bindTo(a),n=new Q(N3i,!0).bindTo(a),r=()=>{t.set(!0),w5e=i},s=()=>{t.set(!1),w5e===i&&(w5e=void 0)};return sa(i.element)&&r(),e.add(i.onDidFocus(()=>r())),e.add(i.onDidBlur(()=>s())),e.add(Z(()=>{KIt.splice(KIt.indexOf(i),1),s()})),{historyNavigationForwardsEnablement:o,historyNavigationBackwardsEnablement:n,dispose(){e.dispose()}}}var D1=class extends y7{constructor(i,e,t,o){super(i,e,t);let n=this._register(o.createScoped(this.element));this._register(qM(n,this))}};D1=I([m(3,X)],D1);var L1=class extends _1{constructor(i,e,t,o){super(i,e,t);let n=this._register(o.createScoped(this.inputBox.element));this._register(qM(n,this.inputBox))}};L1=I([m(3,X)],L1);var R1=class extends zIt{constructor(i,e,t,o,n=!1){super(i,e,n,t);let r=this._register(o.createScoped(this.inputBox.element));this._register(qM(r,this.inputBox))}};R1=I([m(3,X)],R1);yt.registerCommandAndKeybindingRule({id:"history.showPrevious",weight:200,when:x.and(x.has(foi),x.equals(N3i,!0),x.not("isComposing"),GIt.isEqualTo(!1)),primary:16,secondary:[528],handler:a=>{w5e?.showPreviousValue()}});yt.registerCommandAndKeybindingRule({id:"history.showNext",weight:200,when:x.and(x.has(foi),x.equals(A3i,!0),x.not("isComposing"),GIt.isEqualTo(!1)),primary:18,secondary:[530],handler:a=>{w5e?.showNextValue()}});function ML(a){return a.lookupKeybinding("history.showPrevious")?.getElectronAccelerator()==="Up"&&a.lookupKeybinding("history.showNext")?.getElectronAccelerator()==="Down"}var O3i=Re("find-collapsed",M.chevronRight,d(1115,null)),F3i=Re("find-expanded",M.chevronDown,d(1116,null)),Soi=Re("find-selection",M.selection,d(1122,null)),Ioi=Re("find-replace",M.replace,d(1121,null)),yoi=Re("find-replace-all",M.replaceAll,d(1120,null)),k5e=Re("find-previous-match",M.arrowUp,d(1119,null)),E5e=Re("find-next-match",M.arrowDown,d(1118,null)),q0o=d(1125,null),voi=d(1124,null),j0o=d(1135,null),Q0o=d(1129,null),Y0o=d(1127,null),X0o=d(1134,null),J0o=d(1123,null),boi=d(1130,null),Z0o=d(1136,null),eWo=d(1132,null),tWo=d(1131,null),iWo=d(1133,null),oWo=d(1138,null,rO),T5e=d(1126,null),w7=d(1128,null),M1=419,nWo=275,rWo=nWo-54,C5e=69,sWo=33,W3i=it?256:2048,x5e=class{constructor(i){this.afterLineNumber=i,this.heightInPx=sWo,this.suppressMouseDown=!1,this.domNode=document.createElement("div"),this.domNode.className="dock-find-viewzone"}};function V3i(a,i,e){let t=!!i.match(/\n/);if(e&&t&&e.selectionStart>0){a.stopPropagation();return}}function B3i(a,i,e){let t=!!i.match(/\n/);if(e&&t&&e.selectionEnd<e.value.length){a.stopPropagation();return}}var $It=class a extends Ma{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this._hoverService=l;this._findWidgetSearchHistory=c;this._replaceWidgetHistory=u;this._configurationService=p;this._accessibilityService=h;this._cachedHeight=null;this._lastFocusedInputWasReplace=!1;this._lastFocusedElement=null;this._revealTimeouts=[];this._codeEditor=e,this._controller=t,this._state=o,this._contextViewProvider=n,this._keybindingService=r,this._contextKeyService=s,this._isVisible=!1,this._isReplaceVisible=!1,this._ignoreChangeEvent=!1,this._accessibilityHelpHintAnnounced=!1,this._updateHistoryDelayer=new jo(500),this._register(Z(()=>this._updateHistoryDelayer.cancel())),this._register(this._state.onFindReplaceStateChange(g=>this._onStateChanged(g))),this._buildDomNode(),this._updateButtons(),this._tryUpdateWidgetWidth(),this._findInput.inputBox.layout(),this._register(this._codeEditor.onDidChangeConfiguration(g=>{if(g.hasChanged(104)&&(this._codeEditor.getOption(104)&&this._state.change({isReplaceRevealed:!1},!1),this._updateButtons()),g.hasChanged(165)&&this._tryUpdateWidgetWidth(),g.hasChanged(2)&&this.updateAccessibilitySupport(),g.hasChanged(50)){let f=this._codeEditor.getOption(50).loop;this._state.change({loop:f},!1);let v=this._codeEditor.getOption(50).addExtraSpaceOnTop;v&&!this._viewZone&&(this._viewZone=new x5e(0),this._showViewZone()),!v&&this._viewZone&&this._removeViewZone()}})),this.updateAccessibilitySupport(),this._register(this._codeEditor.onDidChangeCursorSelection(()=>{this._isVisible&&this._updateToggleSelectionFindButton()})),this._register(this._codeEditor.onDidFocusEditorWidget(async()=>{if(this._isVisible){let g=await this._controller.getGlobalBufferTerm();g&&g!==this._state.searchString&&(this._state.change({searchString:g},!1),this._findInput.select())}})),this._findInputFocused=Rwe.bindTo(s),this._findFocusTracker=this._register(Vn(this._findInput.inputBox.inputElement)),this._register(this._findFocusTracker.onDidFocus(()=>{this._findInputFocused.set(!0),this._lastFocusedInputWasReplace=!1,this._updateSearchScope()})),this._register(this._findFocusTracker.onDidBlur(()=>{this._findInputFocused.set(!1)})),this._replaceInputFocused=I5e.bindTo(s),this._replaceFocusTracker=this._register(Vn(this._replaceInput.inputBox.inputElement)),this._register(this._replaceFocusTracker.onDidFocus(()=>{this._replaceInputFocused.set(!0),this._lastFocusedInputWasReplace=!0,this._updateSearchScope()})),this._register(this._replaceFocusTracker.onDidBlur(()=>{this._replaceInputFocused.set(!1)})),this._findWidgetFocused=HIt.bindTo(s),this._widgetFocusTracker=this._register(Vn(this._domNode)),this._register(this._widgetFocusTracker.onDidFocus(()=>{this._findWidgetFocused.set(!0)})),this._register(this._widgetFocusTracker.onDidBlur(()=>{this._findWidgetFocused.set(!1)})),this._register(j(this._domNode,"focusin",g=>{Ao(g.target)&&(this._lastFocusedElement=g.target)})),this._codeEditor.addOverlayWidget(this),this._codeEditor.getOption(50).addExtraSpaceOnTop&&(this._viewZone=new x5e(0)),this._register(this._codeEditor.onDidChangeModel(()=>{this._isVisible&&(this._viewZoneId=void 0)})),this._register(this._codeEditor.onDidScrollChange(g=>{if(g.scrollTopChanged){this._layoutViewZone();return}setTimeout(()=>{this._layoutViewZone()},0)}))}static{this.ID="editor.contrib.findWidget"}getId(){return a.ID}getDomNode(){return this._domNode}get lastFocusedInputWasReplace(){return this._lastFocusedInputWasReplace}get lastFocusedElement(){return this._lastFocusedElement}focusLastElement(){this._isVisible&&(this._lastFocusedElement&&this._domNode.contains(this._lastFocusedElement)&&Me(this._lastFocusedElement).document.body.contains(this._lastFocusedElement)?this._lastFocusedElement.focus():this._lastFocusedInputWasReplace?this.focusReplaceInput():this.focusFindInput())}getPosition(){return this._isVisible?{preference:0}:null}_onStateChanged(e){if(e.searchString){try{this._ignoreChangeEvent=!0,this._findInput.setValue(this._state.searchString)}finally{this._ignoreChangeEvent=!1}this._updateButtons()}if(e.replaceString&&(this._replaceInput.inputBox.value=this._state.replaceString),e.isRevealed&&(this._state.isRevealed?this._reveal():this._hide(!0)),e.isReplaceRevealed&&(this._state.isReplaceRevealed?!this._codeEditor.getOption(104)&&!this._isReplaceVisible&&(this._isReplaceVisible=!0,this._replaceInput.width=yl(this._findInput.domNode),this._updateButtons(),this._replaceInput.inputBox.layout()):this._isReplaceVisible&&(this._isReplaceVisible=!1,this._updateButtons())),(e.isRevealed||e.isReplaceRevealed)&&(this._state.isRevealed||this._state.isReplaceRevealed)&&this._tryUpdateHeight()&&this._showViewZone(),e.isRegex&&this._findInput.setRegex(this._state.isRegex),e.wholeWord&&this._findInput.setWholeWords(this._state.wholeWord),e.matchCase&&this._findInput.setCaseSensitive(this._state.matchCase),e.preserveCase&&this._replaceInput.setPreserveCase(this._state.preserveCase),e.searchScope&&(this._state.searchScope?this._toggleSelectionFind.checked=!0:this._toggleSelectionFind.checked=!1,this._updateToggleSelectionFindButton()),e.searchString||e.matchesCount||e.matchesPosition){let t=this._state.searchString.length>0&&this._state.matchesCount===0;this._domNode.classList.toggle("no-results",t),this._updateMatchesCount(),this._updateButtons()}(e.searchString||e.currentMatch)&&this._layoutViewZone(),e.updateHistory&&this._delayedUpdateHistory(),e.loop&&this._updateButtons()}_delayedUpdateHistory(){this._updateHistoryDelayer.trigger(this._updateHistory.bind(this)).then(void 0,mt)}_updateHistory(){this._state.searchString&&this._findInput.inputBox.addToHistory(),this._state.replaceString&&this._replaceInput.inputBox.addToHistory()}_updateMatchesCount(){this._matchesCount.style.minWidth=C5e+"px",this._state.matchesCount>=rO?this._matchesCount.title=oWo:this._matchesCount.title="",this._matchesCount.firstChild?.remove();let e;if(this._state.matchesCount>0){let t=String(this._state.matchesCount);this._state.matchesCount>=rO&&(t+="+");let o=String(this._state.matchesPosition);o==="0"&&(o="?"),e=id(T5e,o,t)}else e=w7;this._matchesCount.appendChild(document.createTextNode(e)),Jo(this._getAriaLabel(e,this._state.currentMatch,this._state.searchString)),C5e=Math.max(C5e,this._matchesCount.clientWidth)}_getAriaLabel(e,t,o){let n;if(e===w7)n=o===""?d(1112,null,e):d(1111,null,e,o);else if(t){let r=d(1113,null,e,o,t.startLineNumber+":"+t.startColumn),s=this._codeEditor.getModel();s&&t.startLineNumber<=s.getLineCount()&&t.startLineNumber>=1?n=`${s.getLineContent(t.startLineNumber)}, ${r}`:n=r}else n=d(1114,null,e,o);return n}_updateToggleSelectionFindButton(){let e=this._codeEditor.getSelection(),t=e?e.startLineNumber!==e.endLineNumber||e.startColumn!==e.endColumn:!1,o=this._toggleSelectionFind.checked;this._isVisible&&(o||t)?this._toggleSelectionFind.enable():this._toggleSelectionFind.disable()}_updateButtons(){this._findInput.setEnabled(this._isVisible),this._replaceInput.setEnabled(this._isVisible&&this._isReplaceVisible),this._updateToggleSelectionFindButton(),this._closeBtn.setEnabled(this._isVisible);let e=this._state.searchString.length>0,t=!!this._state.matchesCount;this._prevBtn.setEnabled(this._isVisible&&e&&t&&this._state.canNavigateBack()),this._nextBtn.setEnabled(this._isVisible&&e&&t&&this._state.canNavigateForward()),this._replaceBtn.setEnabled(this._isVisible&&this._isReplaceVisible&&e),this._replaceAllBtn.setEnabled(this._isVisible&&this._isReplaceVisible&&e),this._domNode.classList.toggle("replaceToggled",this._isReplaceVisible),this._toggleReplaceBtn.setExpanded(this._isReplaceVisible);let o=!this._codeEditor.getOption(104);this._toggleReplaceBtn.setEnabled(this._isVisible&&o)}_reveal(){if(this._revealTimeouts.forEach(e=>{clearTimeout(e)}),this._revealTimeouts=[],!this._isVisible){this._isVisible=!0;let e=this._codeEditor.getSelection();switch(this._codeEditor.getOption(50).autoFindInSelection){case"always":this._toggleSelectionFind.checked=!0;break;case"never":this._toggleSelectionFind.checked=!1;break;case"multiline":{let o=!!e&&e.startLineNumber!==e.endLineNumber;this._toggleSelectionFind.checked=o;break}default:break}this._tryUpdateWidgetWidth(),this._updateButtons(),this._revealTimeouts.push(setTimeout(()=>{this._domNode.classList.add("visible"),this._domNode.setAttribute("aria-hidden","false"),this._updateFindInputAriaLabel()},0)),this._revealTimeouts.push(setTimeout(()=>{this._findInput.validate()},200)),this._codeEditor.layoutOverlayWidget(this);let t=!0;if(this._codeEditor.getOption(50).seedSearchStringFromSelection&&e){let o=this._codeEditor.getDomNode();if(o){let n=Yn(o),r=this._codeEditor.getScrolledVisiblePosition(e.getStartPosition()),s=n.left+(r?r.left:0),l=r?r.top:0;if(this._viewZone&&l<this._viewZone.heightInPx){e.endLineNumber>e.startLineNumber&&(t=!1);let c=gN(this._domNode).left;s>c&&(t=!1);let u=this._codeEditor.getScrolledVisiblePosition(e.getEndPosition());n.left+(u?u.left:0)>c&&(t=!1)}}}this._showViewZone(t)}}_hide(e){this._revealTimeouts.forEach(t=>{clearTimeout(t)}),this._revealTimeouts=[],this._isVisible&&(this._isVisible=!1,this._accessibilityHelpHintAnnounced=!1,this._updateButtons(),this._domNode.classList.remove("visible"),this._domNode.setAttribute("aria-hidden","true"),this._findInput.clearMessage(),e&&this._codeEditor.focus(),this._codeEditor.layoutOverlayWidget(this),this._removeViewZone())}_layoutViewZone(e){if(!this._codeEditor.getOption(50).addExtraSpaceOnTop){this._removeViewZone();return}if(!this._isVisible)return;let o=this._viewZone;this._viewZoneId!==void 0||!o||this._codeEditor.changeViewZones(n=>{o.heightInPx=this._getHeight(),this._viewZoneId=n.addZone(o),this._codeEditor.setScrollTop(e||this._codeEditor.getScrollTop()+o.heightInPx)})}_showViewZone(e=!0){if(!this._isVisible||!this._codeEditor.getOption(50).addExtraSpaceOnTop)return;this._viewZone===void 0&&(this._viewZone=new x5e(0));let o=this._viewZone;this._codeEditor.changeViewZones(n=>{if(this._viewZoneId!==void 0){let r=this._getHeight();if(r===o.heightInPx)return;let s=r-o.heightInPx;o.heightInPx=r,n.layoutZone(this._viewZoneId),e&&this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()+s);return}else{let r=this._getHeight();if(r-=this._codeEditor.getOption(96).top,r<=0)return;o.heightInPx=r,this._viewZoneId=n.addZone(o),e&&this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()+r)}})}_removeViewZone(){this._codeEditor.changeViewZones(e=>{this._viewZoneId!==void 0&&(e.removeZone(this._viewZoneId),this._viewZoneId=void 0,this._viewZone&&(this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()-this._viewZone.heightInPx),this._viewZone=void 0))})}_tryUpdateWidgetWidth(){if(!this._isVisible||!this._domNode.isConnected)return;let e=this._codeEditor.getLayoutInfo();if(e.contentWidth<=0){this._domNode.classList.add("hiddenEditor");return}else this._domNode.classList.contains("hiddenEditor")&&this._domNode.classList.remove("hiddenEditor");let o=e.width,n=e.minimap.minimapWidth,r=!1,s=!1,l=!1;if(this._resized&&yl(this._domNode)>M1){this._domNode.style.maxWidth=`${o-28-n-15}px`,this._replaceInput.width=yl(this._findInput.domNode);return}if(M1+28+n>=o&&(s=!0),M1+28+n-C5e>=o&&(l=!0),M1+28+n-C5e>=o+50&&(r=!0),this._domNode.classList.toggle("collapsed-find-widget",r),this._domNode.classList.toggle("narrow-find-widget",l),this._domNode.classList.toggle("reduced-find-widget",s),!l&&!r&&(this._domNode.style.maxWidth=`${o-28-n-15}px`),this._findInput.layout({collapsedFindWidget:r,narrowFindWidget:l,reducedFindWidget:s}),this._resized){let c=this._findInput.inputBox.element.clientWidth;c>0&&(this._replaceInput.width=c)}else this._isReplaceVisible&&(this._replaceInput.width=yl(this._findInput.domNode))}_getHeight(){let e=0;return e+=4,e+=this._findInput.inputBox.height+2,this._isReplaceVisible&&(e+=4,e+=this._replaceInput.inputBox.height+2),e+=4,e}_tryUpdateHeight(){let e=this._getHeight();return this._cachedHeight!==null&&this._cachedHeight===e?!1:(this._cachedHeight=e,this._domNode.style.height=`${e}px`,!0)}focusFindInput(){this._findInput.select(),this._findInput.focus()}focusReplaceInput(){this._replaceInput.select(),this._replaceInput.focus()}highlightFindOptions(){this._findInput.highlightFindOptions()}_updateSearchScope(){if(this._codeEditor.hasModel()&&this._toggleSelectionFind.checked){let e=this._codeEditor.getSelections();e.map(t=>{t.endColumn===1&&t.endLineNumber>t.startLineNumber&&(t=t.setEndPosition(t.endLineNumber-1,this._codeEditor.getModel().getLineMaxColumn(t.endLineNumber-1)));let o=this._state.currentMatch;return t.startLineNumber!==t.endLineNumber&&!z.equalsRange(t,o)?t:null}).filter(t=>!!t),e.length&&this._state.change({searchScope:e},!0)}}_onFindInputMouseDown(e){e.middleButton&&e.stopPropagation()}_onFindInputKeyDown(e){if(e.equals(W3i|3))if(this._keybindingService.dispatchEvent(e,e.target)){e.preventDefault();return}else{this._findInput.inputBox.insertAtCursor(`
`),e.preventDefault();return}if(e.equals(2)){this._isReplaceVisible?this._replaceInput.focus():this._findInput.focusOnCaseSensitive(),e.preventDefault();return}if(e.equals(2066)){this._codeEditor.focus(),e.preventDefault();return}if(e.equals(16))return V3i(e,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea"));if(e.equals(18))return B3i(e,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea"))}_onReplaceInputKeyDown(e){if(e.equals(W3i|3))if(this._keybindingService.dispatchEvent(e,e.target)){e.preventDefault();return}else{this._replaceInput.inputBox.insertAtCursor(`
`),e.preventDefault();return}if(e.equals(2)){this._findInput.focusOnCaseSensitive(),e.preventDefault();return}if(e.equals(1026)){this._findInput.focus(),e.preventDefault();return}if(e.equals(2066)){this._codeEditor.focus(),e.preventDefault();return}if(e.equals(16))return V3i(e,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea"));if(e.equals(18))return B3i(e,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea"))}getVerticalSashLeft(e){return 0}_keybindingLabelFor(e){return this._keybindingService.appendKeybinding("",e)}_buildDomNode(){let o=this._codeEditor.getOption(50).history,n=this._codeEditor.getOption(50).replaceHistory;this._findInput=this._register(new L1(null,this._contextViewProvider,{width:rWo,label:voi,placeholder:j0o,appendCaseSensitiveLabel:this._keybindingLabelFor(ad.ToggleCaseSensitiveCommand),appendWholeWordsLabel:this._keybindingLabelFor(ad.ToggleWholeWordCommand),appendRegexLabel:this._keybindingLabelFor(ad.ToggleRegexCommand),validation:h=>{if(h.length===0||!this._findInput.getRegex())return null;try{return new RegExp(h,"gu"),null}catch(g){return{content:g.message}}},flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showCommonFindToggles:!0,showHistoryHint:()=>ML(this._keybindingService),inputBoxStyles:pl,toggleStyles:qg,history:o==="workspace"?this._findWidgetSearchHistory:new Set([])},this._contextKeyService)),this._findInput.setRegex(!!this._state.isRegex),this._findInput.setCaseSensitive(!!this._state.matchCase),this._findInput.setWholeWords(!!this._state.wholeWord),this._register(this._findInput.onKeyDown(h=>{h.equals(3)&&!this._codeEditor.getOption(50).findOnType&&this._state.change({searchString:this._findInput.getValue()},!0),this._onFindInputKeyDown(h)})),this._register(this._findInput.inputBox.onDidChange(()=>{this._ignoreChangeEvent||!this._codeEditor.getOption(50).findOnType||this._state.change({searchString:this._findInput.getValue()},!0)})),this._register(this._findInput.onDidOptionChange(()=>{this._state.change({isRegex:this._findInput.getRegex(),wholeWord:this._findInput.getWholeWords(),matchCase:this._findInput.getCaseSensitive()},!0)})),this._register(this._findInput.onCaseSensitiveKeyDown(h=>{h.equals(1026)&&this._isReplaceVisible&&(this._replaceInput.focus(),h.preventDefault())})),this._register(this._findInput.onRegexKeyDown(h=>{h.equals(2)&&this._isReplaceVisible&&(this._replaceInput.focusOnPreserve(),h.preventDefault())})),this._register(this._findInput.inputBox.onDidHeightChange(h=>{this._tryUpdateHeight()&&this._showViewZone()})),Wn&&this._register(this._findInput.onMouseDown(h=>this._onFindInputMouseDown(h))),this._matchesCount=document.createElement("div"),this._matchesCount.className="matchesCount",this._updateMatchesCount();let r={groupId:"find-widget"};this._prevBtn=this._register(new KS({label:Q0o+this._keybindingLabelFor(ad.PreviousMatchFindAction),icon:k5e,hoverLifecycleOptions:r,onTrigger:()=>{Oi(this._codeEditor.getAction(ad.PreviousMatchFindAction)).run().then(void 0,mt)}},this._hoverService)),this._nextBtn=this._register(new KS({label:Y0o+this._keybindingLabelFor(ad.NextMatchFindAction),icon:E5e,hoverLifecycleOptions:r,onTrigger:()=>{Oi(this._codeEditor.getAction(ad.NextMatchFindAction)).run().then(void 0,mt)}},this._hoverService));let s=document.createElement("div");s.className="find-part",s.appendChild(this._findInput.domNode);let l=document.createElement("div");l.className="find-actions",s.appendChild(l),l.appendChild(this._matchesCount),l.appendChild(this._prevBtn.domNode),l.appendChild(this._nextBtn.domNode),this._toggleSelectionFind=this._register(new Kh({icon:Soi,title:X0o+this._keybindingLabelFor(ad.ToggleSearchScopeCommand),isChecked:!1,hoverLifecycleOptions:r,inputActiveOptionBackground:wt(dW),inputActiveOptionBorder:wt(cW),inputActiveOptionForeground:wt(V$)})),this._register(this._toggleSelectionFind.onChange(()=>{if(this._toggleSelectionFind.checked){if(this._codeEditor.hasModel()){let h=this._codeEditor.getSelections();h=h.map(g=>(g.endColumn===1&&g.endLineNumber>g.startLineNumber&&(g=g.setEndPosition(g.endLineNumber-1,this._codeEditor.getModel().getLineMaxColumn(g.endLineNumber-1))),g.isEmpty()?null:g)).filter(g=>!!g),h.length&&this._state.change({searchScope:h},!0)}}else this._state.change({searchScope:null},!0)})),l.appendChild(this._toggleSelectionFind.domNode),this._closeBtn=this._register(new KS({label:J0o+this._keybindingLabelFor(ad.CloseFindWidgetCommand),icon:lE,hoverLifecycleOptions:r,onTrigger:()=>{this._state.change({isRevealed:!1,searchScope:null},!1)},onKeyDown:h=>{h.equals(2)&&this._isReplaceVisible&&(this._replaceBtn.isEnabled()?this._replaceBtn.focus():this._codeEditor.focus(),h.preventDefault())}},this._hoverService)),this._replaceInput=this._register(new R1(null,void 0,{label:boi,placeholder:Z0o,appendPreserveCaseLabel:this._keybindingLabelFor(ad.TogglePreserveCaseCommand),history:n==="workspace"?this._replaceWidgetHistory:new Set([]),flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showHistoryHint:()=>ML(this._keybindingService),inputBoxStyles:pl,toggleStyles:qg,hoverLifecycleOptions:r},this._contextKeyService,!0)),this._replaceInput.setPreserveCase(!!this._state.preserveCase),this._register(this._replaceInput.onKeyDown(h=>this._onReplaceInputKeyDown(h))),this._register(this._replaceInput.inputBox.onDidChange(()=>{this._state.change({replaceString:this._replaceInput.inputBox.value},!1)})),this._register(this._replaceInput.inputBox.onDidHeightChange(h=>{this._isReplaceVisible&&this._tryUpdateHeight()&&this._showViewZone()})),this._register(this._replaceInput.onDidOptionChange(()=>{this._state.change({preserveCase:this._replaceInput.getPreserveCase()},!0)})),this._register(this._replaceInput.onPreserveCaseKeyDown(h=>{h.equals(2)&&(this._prevBtn.isEnabled()?this._prevBtn.focus():this._nextBtn.isEnabled()?this._nextBtn.focus():this._toggleSelectionFind.enabled?this._toggleSelectionFind.focus():this._closeBtn.isEnabled()&&this._closeBtn.focus(),h.preventDefault())})),this._replaceBtn=this._register(new KS({label:eWo+this._keybindingLabelFor(ad.ReplaceOneAction),icon:Ioi,hoverLifecycleOptions:r,onTrigger:()=>{this._controller.replace()},onKeyDown:h=>{h.equals(1026)&&(this._closeBtn.focus(),h.preventDefault())}},this._hoverService)),this._replaceAllBtn=this._register(new KS({label:tWo+this._keybindingLabelFor(ad.ReplaceAllAction),icon:yoi,hoverLifecycleOptions:r,onTrigger:()=>{this._controller.replaceAll()}},this._hoverService));let c=document.createElement("div");c.className="replace-part",c.appendChild(this._replaceInput.domNode);let u=document.createElement("div");u.className="replace-actions",c.appendChild(u),u.appendChild(this._replaceBtn.domNode),u.appendChild(this._replaceAllBtn.domNode),this._toggleReplaceBtn=this._register(new KS({label:iWo,className:"codicon toggle left",onTrigger:()=>{this._state.change({isReplaceRevealed:!this._isReplaceVisible},!1),this._isReplaceVisible&&(this._replaceInput.width=yl(this._findInput.domNode),this._replaceInput.inputBox.layout()),this._showViewZone()}},this._hoverService)),this._toggleReplaceBtn.setExpanded(this._isReplaceVisible),this._domNode=document.createElement("div"),this._domNode.className="editor-widget find-widget",this._domNode.setAttribute("aria-hidden","true"),this._domNode.ariaLabel=q0o,this._domNode.role="dialog",this._domNode.style.width=`${M1}px`,this._domNode.appendChild(this._toggleReplaceBtn.domNode),this._domNode.appendChild(s),this._domNode.appendChild(this._closeBtn.domNode),this._domNode.appendChild(c),this._resizeSash=this._register(new pv(this._domNode,this,{orientation:0,size:2})),this._resized=!1;let p=M1;this._register(this._resizeSash.onDidStart(()=>{p=yl(this._domNode)})),this._register(this._resizeSash.onDidChange(h=>{this._resized=!0;let g=p+h.startX-h.currentX;if(g<M1)return;let f=parseFloat(cU(this._domNode).maxWidth)||0;g>f||(this._domNode.style.width=`${g}px`,this._isReplaceVisible&&(this._replaceInput.width=yl(this._findInput.domNode)),this._findInput.inputBox.layout(),this._tryUpdateHeight())})),this._register(this._resizeSash.onDidReset(()=>{let h=yl(this._domNode);if(h<M1)return;let g=M1;if(!this._resized||h===M1){let f=this._codeEditor.getLayoutInfo();g=f.width-28-f.minimap.minimapWidth-15,this._resized=!0}this._domNode.style.width=`${g}px`,this._isReplaceVisible&&(this._replaceInput.width=yl(this._findInput.domNode)),this._findInput.inputBox.layout()}))}updateAccessibilitySupport(){let e=this._codeEditor.getOption(2);this._findInput.setFocusInputOnOptionClick(e!==2),this._updateFindInputAriaLabel()}_updateFindInputAriaLabel(){let e=voi,t=boi;if(!this._accessibilityHelpHintAnnounced&&this._configurationService.getValue("accessibility.verbosity.find")&&this._accessibilityService.isScreenReaderOptimized()){let o=this._keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getAriaLabel();if(o){let n=d(1110,null,o);e=d(1117,null,e,n),t=d(1137,null,t,n)}this._accessibilityHelpHintAnnounced=!0,this._labelResetTimeout?.dispose(),this._labelResetTimeout=nn(()=>{this._isVisible&&(this._findInput.inputBox.setAriaLabel(voi),this._replaceInput.inputBox.setAriaLabel(boi))},1e3)}this._findInput.inputBox.setAriaLabel(e),this._replaceInput.inputBox.setAriaLabel(t)}getViewState(){let e=!1;return this._viewZone&&this._viewZoneId&&(e=this._viewZone.heightInPx>this._codeEditor.getScrollTop()),{widgetViewZoneVisible:e,scrollTop:this._codeEditor.getScrollTop()}}setViewState(e){e&&e.widgetViewZoneVisible&&this._layoutViewZone(e.scrollTop)}},KS=class extends Ma{constructor(i,e){super(),this._opts=i;let t="button";this._opts.className&&(t=t+" "+this._opts.className),this._opts.icon&&(t=t+" "+q.asClassName(this._opts.icon)),this._domNode=document.createElement("div"),this._domNode.tabIndex=0,this._domNode.className=t,this._domNode.setAttribute("role","button"),this._domNode.setAttribute("aria-label",this._opts.label),this._register(e.setupDelayedHover(this._domNode,{content:this._opts.label,style:1},i.hoverLifecycleOptions)),this.onclick(this._domNode,o=>{this._opts.onTrigger(),o.preventDefault()}),this.onkeydown(this._domNode,o=>{if(o.equals(10)||o.equals(3)){this._opts.onTrigger(),o.preventDefault();return}this._opts.onKeyDown?.(o)})}get domNode(){return this._domNode}isEnabled(){return this._domNode.tabIndex>=0}focus(){this._domNode.focus()}setEnabled(i){this._domNode.classList.toggle("disabled",!i),this._domNode.setAttribute("aria-disabled",String(!i)),this._domNode.tabIndex=i?0:-1}setExpanded(i){this._domNode.setAttribute("aria-expanded",String(!!i)),i?(this._domNode.classList.remove(...q.asClassNameArray(O3i)),this._domNode.classList.add(...q.asClassNameArray(F3i))):(this._domNode.classList.remove(...q.asClassNameArray(F3i)),this._domNode.classList.add(...q.asClassNameArray(O3i)))}};is((a,i)=>{let e=a.getColor(LN);e&&i.addRule(`.monaco-editor .findMatch { border: 1px ${Ug(a.type)?"dotted":"solid"} ${e}; box-sizing: border-box; }`);let t=a.getColor(cGi);t&&i.addRule(`.monaco-editor .findScope { border: 1px ${Ug(a.type)?"dashed":"solid"} ${t}; }`);let o=a.getColor(gi);o&&i.addRule(`.monaco-editor .find-widget { border: 1px solid ${o}; }`);let n=a.getColor(sGi);n&&i.addRule(`.monaco-editor .findMatchInline { color: ${n}; }`);let r=a.getColor(aGi);r&&i.addRule(`.monaco-editor .currentFindMatchInline { color: ${r}; }`)});var Owe=class extends C{constructor(e,t,o,n){super();this._container=e;this._getContent=t;this._clipboardService=o;this._hoverService=n;this._container.classList.add("hover-row-with-copy"),this._button=this._register(new KS({label:d(1287,null),icon:M.copy,onTrigger:()=>this._copyContent(),className:"hover-copy-button"},this._hoverService)),this._container.appendChild(this._button.domNode)}async _copyContent(){let e=this._getContent();e&&(await this._clipboardService.writeText(e),Or(d(1286,null)))}};Owe=I([m(2,Wi),m(3,tt)],Owe);var woi=class{constructor(i,e,t){this.provider=i;this.hover=e;this.ordinal=t}};async function aWo(a,i,e,t,o){let n=await Promise.resolve(a.provideHover(e,t,o)).catch(ss);if(!(!n||!lWo(n)))return new woi(a,n,i)}function _5e(a,i,e,t,o=!1){let r=a.ordered(i,o).map((s,l)=>aWo(s,l,i,e,t));return Fp.fromPromisesResolveOrder(r).coalesce()}async function H3i(a,i,e,t,o=!1){let n=[];for await(let r of _5e(a,i,e,t,o))n.push(r.hover);return n}kS("_executeHoverProvider",(a,i,e)=>{let t=a.get(zt);return H3i(t.hoverProvider,i,e,ve.None)});kS("_executeHoverProvider_recursive",(a,i,e)=>{let t=a.get(zt);return H3i(t.hoverProvider,i,e,ve.None,!0)});function lWo(a){let i=typeof a.range<"u",e=typeof a.contents<"u"&&a.contents&&a.contents.length>0;return i&&e}var qae=_,cWo=Re("hover-increase-verbosity",M.addSmall,d(1290,null)),dWo=Re("hover-decrease-verbosity",M.removeSmall,d(1288,null)),vE=class{constructor(i,e,t,o,n,r=void 0){this.owner=i;this.range=e;this.contents=t;this.isBeforeContent=o;this.ordinal=n;this.source=r}isValidForHoverAnchor(i){return i.type===1&&this.range.startColumn<=i.range.startColumn&&this.range.endColumn>=i.range.endColumn}},qIt=class{constructor(i,e,t){this.hover=i;this.hoverProvider=e;this.hoverPosition=t}supportsVerbosityAction(i){switch(i){case 0:return this.hover.canIncreaseVerbosity??!1;case 1:return this.hover.canDecreaseVerbosity??!1}}},P1=class{constructor(i,e,t,o,n,r,s){this._editor=i;this._markdownRendererService=e;this._configurationService=t;this._languageFeaturesService=o;this._keybindingService=n;this._hoverService=r;this._commandService=s;this.hoverOrdinal=3}createLoadingMessage(i){return new vE(this,i.range,[new xe().appendText(d(1292,null))],!1,2e3)}computeSync(i,e){if(!this._editor.hasModel()||i.type!==1)return[];let t=this._editor.getModel(),o=i.range.startLineNumber,n=t.getLineMaxColumn(o),r=[],s=1e3,l=t.getLineLength(o),c=t.getLanguageIdAtPosition(i.range.startLineNumber,i.range.startColumn),u=this._editor.getOption(133),p=this._configurationService.getValue("editor.maxTokenizationLineLength",{overrideIdentifier:c}),h=this._editor.getOption(69).showLongLineWarning,g=!1;u>=0&&l>u&&i.range.startColumn>=u&&(g=!0,h&&r.push(new vE(this,i.range,[{value:d(1293,null,d5e),isTrusted:!0}],!1,s++))),!g&&typeof p=="number"&&l>=p&&h&&r.push(new vE(this,i.range,[{value:d(1294,null,d5e),isTrusted:!0}],!1,s++));let f=!1;for(let v of e){let b=v.range.startLineNumber===o?v.range.startColumn:1,S=v.range.endLineNumber===o?v.range.endColumn:n,y=v.options.hoverMessage;if(!y||yW(y))continue;v.options.beforeContentClassName&&(f=!0);let w=new z(i.range.startLineNumber,b,i.range.startLineNumber,S);r.push(new vE(this,w,Yl(y),f,s++))}return r}computeAsync(i,e,t,o){if(!this._editor.hasModel()||i.type!==1)return Fp.EMPTY;let n=this._editor.getModel(),r=this._languageFeaturesService.hoverProvider;return r.has(n)?this._getMarkdownHovers(r,n,i,o):Fp.EMPTY}async*_getMarkdownHovers(i,e,t,o){let n=t.range.getStartPosition(),r=_5e(i,e,n,o);for await(let s of r)if(!yW(s.hover.contents)){let l=s.hover.range?z.lift(s.hover.range):t.range,c=new qIt(s.hover,s.provider,n);yield new vE(this,l,s.hover.contents,!1,s.ordinal,c)}}renderHoverParts(i,e){return this._renderedHoverParts=new Coi(e,i.fragment,this,this._editor,this._commandService,this._keybindingService,this._hoverService,this._configurationService,this._markdownRendererService,i.onContentsChanged),this._renderedHoverParts}handleScroll(i){this._renderedHoverParts?.handleScroll(i)}getAccessibleContent(i){return this._renderedHoverParts?.getAccessibleContent(i)??""}doesMarkdownHoverAtIndexSupportVerbosityAction(i,e){return this._renderedHoverParts?.doesMarkdownHoverAtIndexSupportVerbosityAction(i,e)??!1}updateMarkdownHoverVerbosityLevel(i,e){return Promise.resolve(this._renderedHoverParts?.updateMarkdownHoverPartVerbosityLevel(i,e))}};P1=I([m(1,Qn),m(2,B),m(3,zt),m(4,_e),m(5,tt),m(6,ge)],P1);var Fwe=class{constructor(i,e,t,o){this.hoverPart=i;this.hoverElement=e;this.disposables=t;this.actionsContainer=o}get hoverAccessibleContent(){return this.hoverElement.innerText.trim()}dispose(){this.disposables.dispose()}},Coi=class{constructor(i,e,t,o,n,r,s,l,c,u){this._hoverParticipant=t;this._editor=o;this._commandService=n;this._keybindingService=r;this._hoverService=s;this._configurationService=l;this._markdownRendererService=c;this._onFinishedRendering=u;this._ongoingHoverOperations=new Map;this._disposables=new P;this.renderedHoverParts=this._renderHoverParts(i,e,this._onFinishedRendering),this._disposables.add(Z(()=>{this.renderedHoverParts.forEach(p=>{p.dispose()}),this._ongoingHoverOperations.forEach(p=>{p.tokenSource.dispose(!0)})}))}_renderHoverParts(i,e,t){return i.sort(tl(o=>o.ordinal,qd)),i.map(o=>{let n=this._renderHoverPart(o,t);return e.appendChild(n.hoverElement),n})}_renderHoverPart(i,e){let t=this._renderMarkdownHover(i,e),o=t.hoverElement,n=i.source,r=new P;if(r.add(t),!n)return new Fwe(i,o,r);let s=n.supportsVerbosityAction(0),l=n.supportsVerbosityAction(1);if(!s&&!l)return new Fwe(i,o,r);let c=qae("div.verbosity-actions");o.prepend(c);let u=qae("div.verbosity-actions-inner");return c.append(u),r.add(this._renderHoverExpansionAction(u,0,s)),r.add(this._renderHoverExpansionAction(u,1,l)),new Fwe(i,o,r,u)}_renderMarkdownHover(i,e){return K3i(this._editor,i,this._markdownRendererService,e)}_renderHoverExpansionAction(i,e,t){let o=new P,n=e===0,r=R(i,qae(q.asCSSSelector(n?cWo:dWo)));r.tabIndex=0;let s=o.add(new mv("mouse",void 0,{target:i,position:{hoverPosition:0}},this._configurationService,this._hoverService));if(o.add(this._hoverService.setupManagedHover(s,r,xoi(this._keybindingService,e))),!t)return r.classList.add("disabled"),o;r.classList.add("enabled");let l=()=>this._commandService.executeCommand(e===0?x1:k1,{focus:!0});return o.add(new Aje(r,l)),o.add(new Nje(r,l,[3,10])),o}handleScroll(i){this.renderedHoverParts.forEach(e=>{let t=e.actionsContainer;if(!t)return;let o=e.hoverElement,r=i.scrollTop+i.height,s=o.offsetTop,l=o.clientHeight,c=s+l,u=22,p;c<=r||s>=r?p=l-u:p=r-s-u,t.style.top=`${p}px`})}async updateMarkdownHoverPartVerbosityLevel(i,e){let t=this._editor.getModel();if(!t)return;let o=this._getRenderedHoverPartAtIndex(e),n=o?.hoverPart.source;if(!o||!n?.supportsVerbosityAction(i))return;let r=await this._fetchHover(n,t,i);if(!r)return;let s=new qIt(r,n.hoverProvider,n.hoverPosition),l=o.hoverPart,c=new vE(this._hoverParticipant,l.range,r.contents,l.isBeforeContent,l.ordinal,s),u=this._updateRenderedHoverPart(e,c);if(u)return{hoverPart:c,hoverElement:u.hoverElement}}getAccessibleContent(i){let e=this.renderedHoverParts.findIndex(r=>r.hoverPart===i);if(e===-1)return;let t=this._getRenderedHoverPartAtIndex(e);return t?t.hoverElement.innerText.replace(/[^\S\n\r]+/gu," "):void 0}doesMarkdownHoverAtIndexSupportVerbosityAction(i,e){let t=this._getRenderedHoverPartAtIndex(i),o=t?.hoverPart.source;return!(!t||!o?.supportsVerbosityAction(e))}async _fetchHover(i,e,t){let o=t===0?1:-1,n=i.hoverProvider,r=this._ongoingHoverOperations.get(n);r&&(r.tokenSource.cancel(),o+=r.verbosityDelta);let s=new $e;this._ongoingHoverOperations.set(n,{verbosityDelta:o,tokenSource:s});let l={verbosityRequest:{verbosityDelta:o,previousHover:i.hover}},c;try{c=await Promise.resolve(n.provideHover(e,i.hoverPosition,s.token,l))}catch(u){ss(u)}return s.dispose(),this._ongoingHoverOperations.delete(n),c}_updateRenderedHoverPart(i,e){if(i>=this.renderedHoverParts.length||i<0)return;let t=this._renderHoverPart(e,this._onFinishedRendering),o=this.renderedHoverParts[i],n=o.hoverElement,r=t.hoverElement,s=Array.from(r.children);n.replaceChildren(...s);let l=new Fwe(e,n,t.disposables,t.actionsContainer);return o.dispose(),this.renderedHoverParts[i]=l,l}_getRenderedHoverPartAtIndex(i){return this.renderedHoverParts[i]}dispose(){this._disposables.dispose()}};function z3i(a,i,e,t){i.sort(tl(n=>n.ordinal,qd));let o=[];for(let n of i){let r=K3i(e,n,t,a.onContentsChanged);a.fragment.appendChild(r.hoverElement),o.push(r)}return new Lx(o)}function K3i(a,i,e,t){let o=new P,n=qae("div.hover-row"),r=qae("div.hover-row-contents");n.appendChild(r);let s=i.contents;for(let c of s){if(yW(c))continue;let u=qae("div.markdown-hover"),p=R(u,qae("div.hover-contents")),h=o.add(e.render(c,{context:a,asyncRenderCallback:()=>{p.className="hover-contents code-hover-contents",t()}}));p.appendChild(h.element),r.appendChild(u)}return{hoverPart:i,hoverElement:n,dispose(){o.dispose()}}}function xoi(a,i){switch(i){case 0:return a.appendKeybinding(d(1291,null),x1);case 1:return a.appendKeybinding(d(1289,null),k1)}}var G3i=_,jIt=class extends C{constructor(e,t,o){super();this.model=t;this.pixelRatio=o;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._onColorFlushed=this._register(new E);this.onColorFlushed=this._onColorFlushed.event;this._domNode=G3i(".saturation-wrap"),R(e,this._domNode),this._canvas=document.createElement("canvas"),this._canvas.className="saturation-box",R(this._domNode,this._canvas),this.selection=G3i(".saturation-selection"),R(this._domNode,this.selection),this.layout(),this._register(j(this._domNode,re.POINTER_DOWN,n=>this.onPointerDown(n))),this._register(this.model.onDidChangeColor(this.onDidChangeColor,this)),this.monitor=null}get domNode(){return this._domNode}onPointerDown(e){if(!e.target||!(e.target instanceof Element))return;this.monitor=this._register(new cL);let t=Yn(this._domNode);e.target!==this.selection&&this.onDidChangePosition(e.offsetX,e.offsetY),this.monitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>this.onDidChangePosition(n.pageX-t.left,n.pageY-t.top),()=>null);let o=j(e.target.ownerDocument,re.POINTER_UP,()=>{this._onColorFlushed.fire(),o.dispose(),this.monitor&&(this.monitor.stopMonitoring(!0),this.monitor=null)},!0)}onDidChangePosition(e,t){let o=Math.max(0,Math.min(1,e/this.width)),n=Math.max(0,Math.min(1,1-t/this.height));this.paintSelection(o,n),this._onDidChange.fire({s:o,v:n})}layout(){this.width=this._domNode.offsetWidth,this.height=this._domNode.offsetHeight,this._canvas.width=this.width*this.pixelRatio,this._canvas.height=this.height*this.pixelRatio,this.paint();let e=this.model.color.hsva;this.paintSelection(e.s,e.v)}paint(){let e=this.model.color.hsva,t=new Oe(new kN(e.h,1,1,1)),o=this._canvas.getContext("2d"),n=o.createLinearGradient(0,0,this._canvas.width,0);n.addColorStop(0,"rgba(255, 255, 255, 1)"),n.addColorStop(.5,"rgba(255, 255, 255, 0.5)"),n.addColorStop(1,"rgba(255, 255, 255, 0)");let r=o.createLinearGradient(0,0,0,this._canvas.height);r.addColorStop(0,"rgba(0, 0, 0, 0)"),r.addColorStop(1,"rgba(0, 0, 0, 1)"),o.rect(0,0,this._canvas.width,this._canvas.height),o.fillStyle=Oe.Format.CSS.format(t),o.fill(),o.fillStyle=n,o.fill(),o.fillStyle=r,o.fill()}paintSelection(e,t){this.selection.style.left=`${e*this.width}px`,this.selection.style.top=`${this.height-t*this.height}px`}onDidChangeColor(e){if(this.monitor&&this.monitor.isMonitoring())return;this.paint();let t=e.hsva;this.paintSelection(t.s,t.v)}};var QIt=class extends C{constructor(e){super();this._onClicked=this._register(new E);this.onClicked=this._onClicked.event;this._button=R(e,document.createElement("button")),this._button.classList.add("insert-button"),this._button.textContent="Insert",this._register(j(this._button,re.CLICK,()=>{this._onClicked.fire()}))}get button(){return this._button}};var YIt=class extends C{constructor(e,t,o){super();this.presentationIndex=o;this._onColorFlushed=this._register(new E);this.onColorFlushed=this._onColorFlushed.event;this._onDidChangeColor=this._register(new E);this.onDidChangeColor=this._onDidChangeColor.event;this._onDidChangePresentation=this._register(new E);this.onDidChangePresentation=this._onDidChangePresentation.event;this.originalColor=e,this._color=e,this._colorPresentations=t}get color(){return this._color}set color(e){this._color.equals(e)||(this._color=e,this._onDidChangeColor.fire(e))}get presentation(){return this.colorPresentations[this.presentationIndex]}get colorPresentations(){return this._colorPresentations}set colorPresentations(e){this._colorPresentations=e,this.presentationIndex>e.length-1&&(this.presentationIndex=0),this._onDidChangePresentation.fire(this.presentation)}selectNextColorPresentation(){this.presentationIndex=(this.presentationIndex+1)%this.colorPresentations.length,this.flushColor(),this._onDidChangePresentation.fire(this.presentation)}guessColorPresentation(e,t){let o=-1;for(let n=0;n<this.colorPresentations.length;n++)if(t.toLowerCase()===this.colorPresentations[n].label){o=n;break}if(o===-1){let n=t.split("(")[0].toLowerCase();for(let r=0;r<this.colorPresentations.length;r++)if(this.colorPresentations[r].label.toLowerCase().startsWith(n)){o=r;break}}o!==-1&&o!==this.presentationIndex&&(this.presentationIndex=o,this._onDidChangePresentation.fire(this.presentation))}flushColor(){this._onColorFlushed.fire(this._color)}};async function XIt(a,i,e){let t=a.getValueInRange(i.range),{red:o,green:n,blue:r,alpha:s}=i.color,l=new Bt(Math.round(o*255),Math.round(n*255),Math.round(r*255),s),c=new Oe(l),u=await ioi(a,i,e,ve.None),p=new YIt(c,[],0);return p.colorPresentations=u||[],p.guessColorPresentation(c,t),{range:z.lift(i.range),model:p,provider:e}}function JIt(a,i,e){let t=[],o=e.presentation.textEdit??{range:i,text:e.presentation.label,forceMoveMarkers:!1};t.push(o),e.presentation.additionalTextEdits&&t.push(...e.presentation.additionalTextEdits);let n=z.lift(o.range),r=a.getModel()._setTrackedRange(null,n,3);return a.executeEdits("colorpicker",t),a.pushUndoStop(),a.getModel()._getTrackedRange(r)??n}async function jae(a,i,e,t,o){let n=await ioi(a,{range:t,color:{red:e.rgba.r/255,green:e.rgba.g/255,blue:e.rgba.b/255,alpha:e.rgba.a}},o.provider,ve.None);i.colorPresentations=n||[]}var D5e=_,ZIt=class extends C{constructor(e,t,o){super();this.model=t;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._onColorFlushed=this._register(new E);this.onColorFlushed=this._onColorFlushed.event;o==="standalone"?(this.domNode=R(e,D5e(".standalone-strip")),this.overlay=R(this.domNode,D5e(".standalone-overlay"))):(this.domNode=R(e,D5e(".strip")),this.overlay=R(this.domNode,D5e(".overlay"))),this.slider=R(this.domNode,D5e(".slider")),this.slider.style.top="0px",this._register(j(this.domNode,re.POINTER_DOWN,n=>this.onPointerDown(n))),this._register(t.onDidChangeColor(this.onDidChangeColor,this)),this.layout()}layout(){this.height=this.domNode.offsetHeight-this.slider.offsetHeight;let e=this.getValue(this.model.color);this.updateSliderPosition(e)}onDidChangeColor(e){let t=this.getValue(e);this.updateSliderPosition(t)}onPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._register(new cL),o=Yn(this.domNode);this.domNode.classList.add("grabbing"),e.target!==this.slider&&this.onDidChangeTop(e.offsetY),t.startMonitoring(e.target,e.pointerId,e.buttons,r=>this.onDidChangeTop(r.pageY-o.top),()=>null);let n=j(e.target.ownerDocument,re.POINTER_UP,()=>{this._onColorFlushed.fire(),n.dispose(),t.stopMonitoring(!0),this.domNode.classList.remove("grabbing")},!0)}onDidChangeTop(e){let t=Math.max(0,Math.min(1,1-e/this.height));this.updateSliderPosition(t),this._onDidChange.fire(t)}updateSliderPosition(e){this.slider.style.top=`${(1-e)*this.height}px`}},eyt=class extends ZIt{constructor(i,e,t){super(i,e,t),this.domNode.classList.add("opacity-strip"),this.onDidChangeColor(this.model.color)}onDidChangeColor(i){super.onDidChangeColor(i);let{r:e,g:t,b:o}=i.rgba,n=new Oe(new Bt(e,t,o,1)),r=new Oe(new Bt(e,t,o,0));this.overlay.style.background=`linear-gradient(to bottom, ${n} 0%, ${r} 100%)`}getValue(i){return i.hsva.a}},tyt=class extends ZIt{constructor(i,e,t){super(i,e,t),this.domNode.classList.add("hue-strip")}getValue(i){return 1-i.hsva.h/360}};var uWo=_,oyt=class extends C{constructor(e,t,o,n){super();this.model=t;this.pixelRatio=o;this._insertButton=null;this._domNode=uWo(".colorpicker-body"),R(e,this._domNode),this._saturationBox=new jIt(this._domNode,this.model,this.pixelRatio),this._register(this._saturationBox),this._register(this._saturationBox.onDidChange(this.onDidSaturationValueChange,this)),this._register(this._saturationBox.onColorFlushed(this.flushColor,this)),this._opacityStrip=new eyt(this._domNode,this.model,n),this._register(this._opacityStrip),this._register(this._opacityStrip.onDidChange(this.onDidOpacityChange,this)),this._register(this._opacityStrip.onColorFlushed(this.flushColor,this)),this._hueStrip=new tyt(this._domNode,this.model,n),this._register(this._hueStrip),this._register(this._hueStrip.onDidChange(this.onDidHueChange,this)),this._register(this._hueStrip.onColorFlushed(this.flushColor,this)),n==="standalone"&&(this._insertButton=this._register(new QIt(this._domNode)),this._domNode.classList.add("standalone-colorpicker"))}flushColor(){this.model.flushColor()}onDidSaturationValueChange({s:e,v:t}){let o=this.model.color.hsva;this.model.color=new Oe(new kN(o.h,e,t,o.a))}onDidOpacityChange(e){let t=this.model.color.hsva;this.model.color=new Oe(new kN(t.h,t.s,t.v,e))}onDidHueChange(e){let t=this.model.color.hsva,o=(1-e)*360;this.model.color=new Oe(new kN(o===360?0:o,t.s,t.v,t.a))}get domNode(){return this._domNode}get saturationBox(){return this._saturationBox}get opacityStrip(){return this._opacityStrip}get hueStrip(){return this._hueStrip}get enterButton(){return this._insertButton}layout(){this._saturationBox.layout(),this._opacityStrip.layout(),this._hueStrip.layout()}};var pWo=_,nyt=class extends C{constructor(e){super();this._onClicked=this._register(new E);this.onClicked=this._onClicked.event;this._button=document.createElement("div"),this._button.classList.add("close-button"),R(e,this._button);let t=document.createElement("div");t.classList.add("close-button-inner-div"),R(this._button,t),R(t,pWo(".button"+q.asCSSSelector(Re("color-picker-close",M.close,d(1040,null))))).classList.add("close-icon"),this._register(j(this._button,re.CLICK,()=>{this._onClicked.fire()}))}};var ryt=_,syt=class extends C{constructor(e,t,o,n){super();this.model=t;this.type=n;this._closeButton=null;this._domNode=ryt(".colorpicker-header"),R(e,this._domNode),this._pickedColorNode=R(this._domNode,ryt(".picked-color")),R(this._pickedColorNode,ryt("span.codicon.codicon-color-mode")),this._pickedColorPresentation=R(this._pickedColorNode,document.createElement("span")),this._pickedColorPresentation.classList.add("picked-color-presentation");let r=d(1041,null);this._pickedColorNode.setAttribute("title",r),this._originalColorNode=R(this._domNode,ryt(".original-color")),this._originalColorNode.style.backgroundColor=Oe.Format.CSS.format(this.model.originalColor)||"",this.backgroundColor=o.getColorTheme().getColor(qT)||Oe.white,this._register(o.onDidColorThemeChange(s=>{this.backgroundColor=s.getColor(qT)||Oe.white})),this._register(j(this._pickedColorNode,re.CLICK,()=>this.model.selectNextColorPresentation())),this._register(j(this._originalColorNode,re.CLICK,()=>{this.model.color=this.model.originalColor,this.model.flushColor()})),this._register(t.onDidChangeColor(this.onDidChangeColor,this)),this._register(t.onDidChangePresentation(this.onDidChangePresentation,this)),this._pickedColorNode.style.backgroundColor=Oe.Format.CSS.format(t.color)||"",this._pickedColorNode.classList.toggle("light",t.color.rgba.a<.5?this.backgroundColor.isLighter():t.color.isLighter()),this.onDidChangeColor(this.model.color),this.type==="standalone"&&(this._domNode.classList.add("standalone-colorpicker"),this._closeButton=this._register(new nyt(this._domNode)))}get domNode(){return this._domNode}get closeButton(){return this._closeButton}get pickedColorNode(){return this._pickedColorNode}get originalColorNode(){return this._originalColorNode}onDidChangeColor(e){this._pickedColorNode.style.backgroundColor=Oe.Format.CSS.format(e)||"",this._pickedColorNode.classList.toggle("light",e.rgba.a<.5?this.backgroundColor.isLighter():e.isLighter()),this.onDidChangePresentation()}onDidChangePresentation(){this._pickedColorPresentation.textContent=this.model.presentation?this.model.presentation.label:""}};var mWo=_,Wwe=class a extends Ma{constructor(e,t,o,n,r){super();this.model=t;this.pixelRatio=o;this._register(Xd.getInstance(Me(e)).onDidChange(()=>this.layout())),this._domNode=mWo(".colorpicker-widget"),e.appendChild(this._domNode),this.header=this._register(new syt(this._domNode,this.model,n,r)),this.body=this._register(new oyt(this._domNode,this.model,this.pixelRatio,r))}static{this.ID="editor.contrib.colorPickerWidget"}getId(){return a.ID}layout(){this.body.layout()}get domNode(){return this._domNode}};var ayt=class a{constructor(i,e,t,o){this.owner=i;this.range=e;this.model=t;this.provider=o;this.forceShowAtRange=!0}isValidForHoverAnchor(i){return i.type===1&&this.range.startColumn<=i.range.startColumn&&this.range.endColumn>=i.range.endColumn}static fromBaseColor(i,e){return new a(i,e.range,e.model,e.provider)}},C7=class{constructor(i,e){this._editor=i;this._themeService=e;this.hoverOrdinal=2}computeSync(i,e,t){return[]}computeAsync(i,e,t,o){return Fp.fromPromise(this._computeAsync(i,e,t))}async _computeAsync(i,e,t){if(!this._editor.hasModel())return[];if(!this._isValidRequest(t))return[];let o=Xy.get(this._editor);if(!o)return[];for(let n of e){if(!o.isColorDecoration(n))continue;let r=o.getColorData(n.range.getStartPosition());if(r)return[ayt.fromBaseColor(this,await XIt(this._editor.getModel(),r.colorInfo,r.provider))]}return[]}_isValidRequest(i){let e=this._editor.getOption(168);switch(i){case 0:return e==="hover"||e==="clickAndHover";case 1:return e==="click"||e==="clickAndHover";case 2:return!0}}renderHoverParts(i,e){let t=this._editor;if(e.length===0||!t.hasModel())return new Lx([]);let o=t.getOption(75)+8;i.setMinimumDimensions(new ai(302,o));let n=new P,r=e[0],s=t.getModel(),l=r.model;this._colorPicker=n.add(new Wwe(i.fragment,l,t.getOption(163),this._themeService,"hover"));let c=!1,u=new z(r.range.startLineNumber,r.range.startColumn,r.range.endLineNumber,r.range.endColumn);n.add(l.onColorFlushed(async h=>{await jae(s,l,h,u,r),c=!0,u=JIt(t,u,l)})),n.add(l.onDidChangeColor(h=>{jae(s,l,h,u,r)})),n.add(t.onDidChangeModelContent(h=>{c?c=!1:(i.hide(),t.focus())}));let p={hoverPart:ayt.fromBaseColor(this,r),hoverElement:this._colorPicker.domNode,dispose(){n.dispose()}};return new Lx([p])}getAccessibleContent(i){return d(1042,null)}handleResize(){this._colorPicker?.layout()}handleContentsChanged(){this._colorPicker?.layout()}handleHide(){this._colorPicker?.dispose(),this._colorPicker=void 0}isColorPickerVisible(){return!!this._colorPicker}};C7=I([m(1,De)],C7);function koi(a,i){return!!a[i]}var L5e=class{constructor(i,e){this.target=i.target,this.isLeftClick=i.event.leftButton,this.isMiddleClick=i.event.middleButton,this.isRightClick=i.event.rightButton,this.mouseMiddleClickAction=e.mouseMiddleClickAction,this.hasTriggerModifier=koi(i.event,e.triggerModifier),this.isMiddleClick&&e.mouseMiddleClickAction==="ctrlLeftClick"&&(this.isMiddleClick=!1,this.isLeftClick=!0,this.hasTriggerModifier=!0),this.hasSideBySideModifier=koi(i.event,e.triggerSideBySideModifier),this.isNoneOrSingleMouseDown=i.event.detail<=1}},lyt=class{constructor(i,e){this.keyCodeIsTriggerKey=i.keyCode===e.triggerKey,this.keyCodeIsSideBySideKey=i.keyCode===e.triggerSideBySideKey,this.hasTriggerModifier=koi(i,e.triggerModifier)}},Vwe=class{constructor(i,e,t,o,n){this.mouseMiddleClickAction=n;this.triggerKey=i,this.triggerModifier=e,this.triggerSideBySideKey=t,this.triggerSideBySideModifier=o}equals(i){return this.triggerKey===i.triggerKey&&this.triggerModifier===i.triggerModifier&&this.triggerSideBySideKey===i.triggerSideBySideKey&&this.triggerSideBySideModifier===i.triggerSideBySideModifier&&this.mouseMiddleClickAction===i.mouseMiddleClickAction}};function $3i(a,i){return a==="altKey"?it?new Vwe(57,"metaKey",6,"altKey",i):new Vwe(5,"ctrlKey",6,"altKey",i):it?new Vwe(6,"altKey",57,"metaKey",i):new Vwe(6,"altKey",5,"ctrlKey",i)}var sO=class extends C{constructor(e,t){super();this._onMouseMoveOrRelevantKeyDown=this._register(new E);this.onMouseMoveOrRelevantKeyDown=this._onMouseMoveOrRelevantKeyDown.event;this._onExecute=this._register(new E);this.onExecute=this._onExecute.event;this._onCancel=this._register(new E);this.onCancel=this._onCancel.event;this._editor=e,this._extractLineNumberFromMouseEvent=t?.extractLineNumberFromMouseEvent??(o=>o.target.position?o.target.position.lineNumber:0),this._opts=$3i(this._editor.getOption(86),this._editor.getOption(87)),this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._register(this._editor.onDidChangeConfiguration(o=>{if(o.hasChanged(86)||o.hasChanged(87)){let n=$3i(this._editor.getOption(86),this._editor.getOption(87));if(this._opts.equals(n))return;this._opts=n,this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._onCancel.fire()}})),this._register(this._editor.onMouseMove(o=>this._onEditorMouseMove(new L5e(o,this._opts)))),this._register(this._editor.onMouseDown(o=>this._onEditorMouseDown(new L5e(o,this._opts)))),this._register(this._editor.onMouseUp(o=>this._onEditorMouseUp(new L5e(o,this._opts)))),this._register(this._editor.onKeyDown(o=>this._onEditorKeyDown(new lyt(o,this._opts)))),this._register(this._editor.onKeyUp(o=>this._onEditorKeyUp(new lyt(o,this._opts)))),this._register(this._editor.onMouseDrag(()=>this._resetHandler())),this._register(this._editor.onDidChangeCursorSelection(o=>this._onDidChangeCursorSelection(o))),this._register(this._editor.onDidChangeModel(o=>this._resetHandler())),this._register(this._editor.onDidChangeModelContent(()=>this._resetHandler())),this._register(this._editor.onDidScrollChange(o=>{(o.scrollTopChanged||o.scrollLeftChanged)&&this._resetHandler()}))}_onDidChangeCursorSelection(e){e.selection&&e.selection.startColumn!==e.selection.endColumn&&this._resetHandler()}_onEditorMouseMove(e){this._lastMouseMoveEvent=e,this._onMouseMoveOrRelevantKeyDown.fire([e,null])}_onEditorMouseDown(e){this._hasTriggerKeyOnMouseDown=e.hasTriggerModifier,this._lineNumberOnMouseDown=this._extractLineNumberFromMouseEvent(e)}_onEditorMouseUp(e){let t=this._extractLineNumberFromMouseEvent(e);this._lineNumberOnMouseDown&&this._lineNumberOnMouseDown===t&&(this._hasTriggerKeyOnMouseDown||e.isMiddleClick&&e.mouseMiddleClickAction==="openLink")&&this._onExecute.fire(e)}_onEditorKeyDown(e){this._lastMouseMoveEvent&&(e.keyCodeIsTriggerKey||e.keyCodeIsSideBySideKey&&e.hasTriggerModifier)?this._onMouseMoveOrRelevantKeyDown.fire([this._lastMouseMoveEvent,e]):e.hasTriggerModifier&&this._onCancel.fire()}_onEditorKeyUp(e){e.keyCodeIsTriggerKey&&this._onCancel.fire()}_resetHandler(){this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._onCancel.fire()}};var R5e=class{constructor(i,e){this.range=i;this.direction=e}},Eoi=class a{constructor(i,e,t){this.hint=i;this.anchor=e;this.provider=t;this._isResolved=!1}with(i){let e=new a(this.hint,i.anchor,this.provider);return e._isResolved=this._isResolved,e._currentResolve=this._currentResolve,e}async resolve(i){if(typeof this.provider.resolveInlayHint=="function"){if(this._currentResolve)return await this._currentResolve,i.isCancellationRequested?void 0:this.resolve(i);this._isResolved||(this._currentResolve=this._doResolve(i).finally(()=>this._currentResolve=void 0)),await this._currentResolve}}async _doResolve(i){try{let e=await Promise.resolve(this.provider.resolveInlayHint(this.hint,i));this.hint.tooltip=e?.tooltip??this.hint.tooltip,this.hint.label=e?.label??this.hint.label,this.hint.textEdits=e?.textEdits??this.hint.textEdits,this._isResolved=!0}catch(e){ss(e),this._isResolved=!1}}},M5e=class a{constructor(i,e,t){this._disposables=new P;this.ranges=i,this.provider=new Set;let o=[];for(let[n,r]of e){this._disposables.add(n),this.provider.add(r);for(let s of n.hints){let l=t.validatePosition(s.position),c="before",u=a._getRangeAtPosition(t,l),p;u.getStartPosition().isBefore(l)?(p=z.fromPositions(u.getStartPosition(),l),c="after"):(p=z.fromPositions(l,u.getEndPosition()),c="before"),o.push(new Eoi(s,new R5e(p,c),r))}}this.items=o.sort((n,r)=>Ie.compare(n.hint.position,r.hint.position))}static{this._emptyInlayHintList=Object.freeze({dispose(){},hints:[]})}static async create(i,e,t,o){let n=[],r=i.ordered(e).reverse().map(s=>t.map(async l=>{try{let c=await s.provideInlayHints(e,l,o);(c?.hints.length||s.onDidChangeInlayHints)&&n.push([c??a._emptyInlayHintList,s])}catch(c){ss(c)}}));if(await Promise.all(r.flat()),o.isCancellationRequested||e.isDisposed())throw new ho;return new a(t,n,e)}dispose(){this._disposables.dispose()}static _getRangeAtPosition(i,e){let t=e.lineNumber,o=i.getWordAtPosition(e);if(o)return new z(t,o.startColumn,t,o.endColumn);i.tokenization.tokenizeIfCheap(t);let n=i.tokenization.getLineTokens(t),r=e.column-1,s=n.findTokenIndexAtOffset(r),l=n.getStartOffset(s),c=n.getEndOffset(s);return c-l===1&&(l===r&&s>1?(l=n.getStartOffset(s-1),c=n.getEndOffset(s-1)):c===r&&s<n.getCount()-1&&(l=n.getStartOffset(s+1),c=n.getEndOffset(s+1))),new z(t,l+1,t,c+1)}};function cyt(a){return ic(a.id,...a.arguments??[]).toString()}var zc=class extends jr{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f){super(i,{...o.getRawOptions(),overflowWidgetsDomNode:o.getOverflowWidgetsDomNode()},t,n,r,s,l,c,u,p,h,g,f),this._parentEditor=o,this._overwriteOptions=e,super.updateOptions(this._overwriteOptions),this._register(o.onDidChangeConfiguration(v=>this._onParentConfigurationChanged(v)))}getParentEditor(){return this._parentEditor}_onParentConfigurationChanged(i){super.updateOptions(this._parentEditor.getRawOptions()),super.updateOptions(this._overwriteOptions)}updateOptions(i){Nu(this._overwriteOptions,i,!0),super.updateOptions(this._overwriteOptions)}};zc=I([m(4,F),m(5,Kt),m(6,ge),m(7,X),m(8,De),m(9,Ne),m(10,Bi),m(11,bs),m(12,zt),m(13,eC)],zc);function Bwe(a){let i=a.get(Kt).getFocusedCodeEditor();return i instanceof zc?i.getParentEditor():i}var q3i=new Oe(new Bt(0,122,204)),hWo={showArrow:!0,showFrame:!0,className:"",frameColor:q3i,arrowColor:q3i,keepEditorSelection:!1},gWo="vs.editor.contrib.zoneWidget",Toi=class{constructor(i,e,t,o,n,r,s,l){this.id="";this.domNode=i,this.afterLineNumber=e,this.afterColumn=t,this.heightInLines=o,this.showInHiddenAreas=s,this.ordinal=l,this._onDomNodeTop=n,this._onComputedHeight=r}onDomNodeTop(i){this._onDomNodeTop(i)}onComputedHeight(i){this._onComputedHeight(i)}},_oi=class{constructor(i,e){this._id=i,this._domNode=e}getId(){return this._id}getDomNode(){return this._domNode}getPosition(){return null}},Doi=class a{constructor(i){this._editor=i;this._ruleName=a._IdGenerator.nextId();this._color=null;this._height=-1;this._decorations=this._editor.createDecorationsCollection()}static{this._IdGenerator=new vae(".arrow-decoration-")}dispose(){this.hide(),EN(this._ruleName)}set color(i){this._color!==i&&(this._color=i,this._updateStyle())}set height(i){this._height!==i&&(this._height=i,this._updateStyle())}_updateStyle(){EN(this._ruleName),Vh(`.monaco-editor ${this._ruleName}`,`border-style: solid; border-color: transparent; border-bottom-color: ${this._color}; border-width: ${this._height}px; bottom: -${this._height}px !important; margin-left: -${this._height}px; `)}show(i){i.column===1&&(i={lineNumber:i.lineNumber,column:2}),this._decorations.set([{range:z.fromPositions(i),options:{description:"zone-widget-arrow",className:this._ruleName,stickiness:1}}])}hide(){this._decorations.clear()}},aO=class{constructor(i,e={}){this._arrow=null;this._overlayWidget=null;this._resizeSash=null;this._isSashResizeHeight=!1;this._viewZone=null;this._disposables=new P;this.container=null;this._isShowing=!1;this.editor=i,this._positionMarkerId=this.editor.createDecorationsCollection(),this.options=Xi(e),Nu(this.options,hWo,!1),this.domNode=document.createElement("div"),this.options.isAccessible||(this.domNode.setAttribute("aria-hidden","true"),this.domNode.setAttribute("role","presentation")),this._disposables.add(this.editor.onDidLayoutChange(t=>{let o=this._getWidth(t);this.domNode.style.width=o+"px",this.domNode.style.left=this._getLeft(t)+"px",this._onWidth(o)}))}dispose(){this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this._viewZone&&this.editor.changeViewZones(i=>{this._viewZone&&i.removeZone(this._viewZone.id),this._viewZone=null}),this._positionMarkerId.clear(),this._disposables.dispose()}create(){this.domNode.classList.add("zone-widget"),this.options.className&&this.domNode.classList.add(this.options.className),this.container=document.createElement("div"),this.container.classList.add("zone-widget-container"),this.domNode.appendChild(this.container),this.options.showArrow&&(this._arrow=new Doi(this.editor),this._disposables.add(this._arrow)),this._fillContainer(this.container),this._initSash(),this._applyStyles()}style(i){i.frameColor&&(this.options.frameColor=i.frameColor),i.arrowColor&&(this.options.arrowColor=i.arrowColor),this._applyStyles()}_applyStyles(){if(this.container&&this.options.frameColor){let i=this.options.frameColor.toString();this.container.style.borderTopColor=i,this.container.style.borderBottomColor=i}if(this._arrow&&this.options.arrowColor){let i=this.options.arrowColor.toString();this._arrow.color=i}}_getWidth(i){return i.width-i.minimap.minimapWidth-i.verticalScrollbarWidth}_getLeft(i){return i.minimap.minimapWidth>0&&i.minimap.minimapLeft===0?i.minimap.minimapWidth:0}_onViewZoneTop(i){this.domNode.style.top=i+"px"}_onViewZoneHeight(i){if(this.domNode.style.height=`${i}px`,this.container){let e=i-this._decoratingElementsHeight();this.container.style.height=`${e}px`;let t=this.editor.getLayoutInfo();this._doLayout(e,this._getWidth(t))}this._resizeSash?.layout()}get position(){let i=this._positionMarkerId.getRange(0);if(i)return i.getStartPosition()}hasFocus(){return this.domNode.contains(Pn())}show(i,e){let t=z.isIRange(i)?z.lift(i):z.fromPositions(i);this._isShowing=!0,this._showImpl(t,e),this._isShowing=!1,this._positionMarkerId.set([{range:t,options:po.EMPTY}])}updatePositionAndHeight(i,e){this._viewZone&&(i=z.isIRange(i)?z.getStartPosition(i):i,this._viewZone.afterLineNumber=i.lineNumber,this._viewZone.afterColumn=i.column,this._viewZone.heightInLines=e??this._viewZone.heightInLines,this.editor.changeViewZones(t=>{t.layoutZone(this._viewZone.id)}),this._positionMarkerId.set([{range:z.isIRange(i)?i:z.fromPositions(i),options:po.EMPTY}]),this._updateSashEnablement())}hide(){this._viewZone&&(this.editor.changeViewZones(i=>{this._viewZone&&i.removeZone(this._viewZone.id)}),this._viewZone=null),this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this._arrow?.hide(),this._positionMarkerId.clear(),this._isSashResizeHeight=!1}_decoratingElementsHeight(){let i=this.editor.getOption(75),e=0;if(this.options.showArrow){let t=Math.round(i/3);e+=2*t}if(this.options.showFrame){let t=this.options.frameWidth??Math.round(i/9);e+=2*t}return e}_getMaximumHeightInLines(){return Math.max(12,this.editor.getLayoutInfo().height/this.editor.getOption(75)*.8)}_showImpl(i,e){let t=i.getStartPosition(),o=this.editor.getLayoutInfo(),n=this._getWidth(o);this.domNode.style.width=`${n}px`,this.domNode.style.left=this._getLeft(o)+"px";let r=document.createElement("div");r.style.overflow="hidden";let s=this.editor.getOption(75),l=this._getMaximumHeightInLines();l!==void 0&&(e=Math.min(e,l));let c=0,u=0;if(this._arrow&&this.options.showArrow&&(c=Math.round(s/3),this._arrow.height=c,this._arrow.show(t)),this.options.showFrame&&(u=Math.round(s/9)),this.editor.changeViewZones(g=>{this._viewZone&&g.removeZone(this._viewZone.id),this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this.domNode.style.top="-1000px",this._viewZone=new Toi(r,t.lineNumber,t.column,e,f=>this._onViewZoneTop(f),f=>this._onViewZoneHeight(f),this.options.showInHiddenAreas,this.options.ordinal),this._viewZone.id=g.addZone(this._viewZone),this._overlayWidget=new _oi(gWo+this._viewZone.id,this.domNode),this.editor.addOverlayWidget(this._overlayWidget)}),this._updateSashEnablement(),this.container&&this.options.showFrame){let g=this.options.frameWidth?this.options.frameWidth:u;this.container.style.borderTopWidth=g+"px",this.container.style.borderBottomWidth=g+"px"}let p=e*s-this._decoratingElementsHeight();this.container&&(this.container.style.top=c+"px",this.container.style.height=p+"px",this.container.style.overflow="hidden"),this._doLayout(p,n),this.options.keepEditorSelection||this.editor.setSelection(i);let h=this.editor.getModel();if(h){let g=h.validateRange(new z(i.startLineNumber,1,i.endLineNumber+1,1));this.revealRange(g,g.startLineNumber===h.getLineCount())}}revealRange(i,e){e?this.editor.revealLineNearTop(i.endLineNumber,0):this.editor.revealRange(i,0)}setCssClass(i,e){this.container&&(e&&this.container.classList.remove(e),this.container.classList.add(i))}_onWidth(i){}_doLayout(i,e){}_relayout(i,e){let t=this._getMaximumHeightInLines(),o=e&&t!==void 0?Math.min(t,i):i;this._viewZone&&this._viewZone.heightInLines!==o&&(this.editor.changeViewZones(n=>{this._viewZone&&(this._viewZone.heightInLines=o,n.layoutZone(this._viewZone.id))}),this._updateSashEnablement())}_initSash(){if(this._resizeSash)return;this._resizeSash=this._disposables.add(new pv(this.domNode,this,{orientation:1})),this.options.isResizeable||(this._resizeSash.state=0);let i;this._disposables.add(this._resizeSash.onDidStart(e=>{this._viewZone&&(i={startY:e.startY,heightInLines:this._viewZone.heightInLines,...this._getResizeBounds()})})),this._disposables.add(this._resizeSash.onDidEnd(()=>{i=void 0})),this._disposables.add(this._resizeSash.onDidChange(e=>{if(i){let t=(e.currentY-i.startY)/this.editor.getOption(75),o=t<0?Math.ceil(t):Math.floor(t),n=i.heightInLines+o;n>i.minLines&&n<i.maxLines&&(this._isSashResizeHeight=!0,this._relayout(n))}}))}_updateSashEnablement(){if(this._resizeSash){let{minLines:i,maxLines:e}=this._getResizeBounds();this._resizeSash.state=i===e?0:3}}get _usesResizeHeight(){return this._isSashResizeHeight}_getResizeBounds(){return{minLines:5,maxLines:35}}getHorizontalSashLeft(){return 0}getHorizontalSashTop(){return(this.domNode.style.height===null?0:parseInt(this.domNode.style.height))-this._decoratingElementsHeight()/2}getHorizontalSashWidth(){let i=this.editor.getLayoutInfo();return i.width-i.minimap.minimapWidth}};var Kq=ae("IPeekViewService");we(Kq,class{constructor(){this._widgets=new Map}addExclusiveWidget(a,i){let e=this._widgets.get(a);e&&(e.listener.dispose(),e.widget.dispose());let t=()=>{let o=this._widgets.get(a);o&&o.widget===i&&(o.listener.dispose(),this._widgets.delete(a))};this._widgets.set(a,{widget:i,listener:i.onDidClose(t)})}},1);var Gh;(e=>(e.inPeekEditor=new Q("inReferenceSearchEditor",!0,d(1474,null)),e.notInPeekEditor=e.inPeekEditor.toNegated()))(Gh||={});var Hwe=class{static{this.ID="editor.contrib.referenceController"}constructor(i,e){i instanceof zc&&Gh.inPeekEditor.bindTo(e)}dispose(){}};Hwe=I([m(1,X)],Hwe);go(Hwe.ID,Hwe,0);var fWo={headerBackgroundColor:Oe.white,primaryHeadingColor:Oe.fromHex("#333333"),secondaryHeadingColor:Oe.fromHex("#6c6c6cb3")},bE=class extends aO{constructor(e,t,o){super(e,t);this.instantiationService=o;this._onDidClose=new E;this.onDidClose=this._onDidClose.event;Nu(this.options,fWo,!1);let n=os(this.editor);n.openedPeekWidgets.set(n.openedPeekWidgets.get()+1,void 0)}dispose(){if(!this.disposed){this.disposed=!0,super.dispose(),this._onDidClose.fire(this),this._onDidClose.dispose();let e=os(this.editor);e.openedPeekWidgets.set(e.openedPeekWidgets.get()-1,void 0)}}style(e){let t=this.options;e.headerBackgroundColor&&(t.headerBackgroundColor=e.headerBackgroundColor),e.primaryHeadingColor&&(t.primaryHeadingColor=e.primaryHeadingColor),e.secondaryHeadingColor&&(t.secondaryHeadingColor=e.secondaryHeadingColor),super.style(e)}_applyStyles(){super._applyStyles();let e=this.options;this._headElement&&e.headerBackgroundColor&&(this._headElement.style.backgroundColor=e.headerBackgroundColor.toString()),this._primaryHeading&&e.primaryHeadingColor&&(this._primaryHeading.style.color=e.primaryHeadingColor.toString()),this._secondaryHeading&&e.secondaryHeadingColor&&(this._secondaryHeading.style.color=e.secondaryHeadingColor.toString()),this._bodyElement&&e.frameColor&&(this._bodyElement.style.borderColor=e.frameColor.toString())}_fillContainer(e){this.setCssClass("peekview-widget"),this._headElement=_(".head"),this._bodyElement=_(".body"),this._fillHead(this._headElement),this._fillBody(this._bodyElement),e.appendChild(this._headElement),e.appendChild(this._bodyElement)}_fillHead(e,t){this._titleElement=_(".peekview-title"),this.options.supportOnTitleClick&&(this._titleElement.classList.add("clickable"),Vo(this._titleElement,"click",r=>this._onTitleClick(r))),R(this._headElement,this._titleElement),this._fillTitleIcon(this._titleElement),this._primaryHeading=_("span.filename"),this._secondaryHeading=_("span.dirname"),this._metaHeading=_("span.meta"),R(this._titleElement,this._primaryHeading,this._secondaryHeading,this._metaHeading);let o=_(".peekview-actions");R(this._headElement,o);let n=this._getActionBarOptions();this._actionbarWidget=new ji(o,n),this._disposables.add(this._actionbarWidget),t||this._actionbarWidget.push(this._disposables.add(new st("peekview.close",d(1475,null),q.asClassName(M.close),!0,()=>(this.dispose(),Promise.resolve()))),{label:!1,icon:!0})}_fillTitleIcon(e){}_getActionBarOptions(){return{actionViewItemProvider:Ca.bind(void 0,this.instantiationService),orientation:0}}_onTitleClick(e){}setTitle(e,t){this._primaryHeading&&this._secondaryHeading&&(this._primaryHeading.innerText=e,this._primaryHeading.setAttribute("title",e),t?this._secondaryHeading.innerText=t:Rt(this._secondaryHeading))}setMetaTitle(e){this._metaHeading&&(e?(this._metaHeading.innerText=e,bn(this._metaHeading)):xo(this._metaHeading))}_doLayout(e,t){if(!this._isShowing&&e<0){this.dispose();return}let o=Math.ceil(this.editor.getOption(75)*1.2),n=Math.round(e-(o+1));this._doLayoutHead(o,t),this._doLayoutBody(n,t)}_doLayoutHead(e,t){this._headElement&&(this._headElement.style.height=`${e}px`,this._headElement.style.lineHeight=this._headElement.style.height)}_doLayoutBody(e,t){this._bodyElement&&(this._bodyElement.style.height=`${e}px`)}};bE=I([m(2,F)],bE);var DW=J("peekViewTitle.background",{dark:"#252526",light:"#F3F3F3",hcDark:Oe.black,hcLight:Oe.white},d(1489,null)),lO=J("peekViewTitleLabel.foreground",{dark:Oe.white,light:Oe.black,hcDark:Oe.white,hcLight:od},d(1490,null)),cO=J("peekViewTitleDescription.foreground",{dark:"#ccccccb3",light:"#616161",hcDark:"#FFFFFF99",hcLight:"#292929"},d(1491,null)),p_=J("peekView.border",{dark:fm,light:fm,hcDark:gi,hcLight:gi},d(1476,null)),x7=J("peekViewResult.background",{dark:"#252526",light:"#F3F3F3",hcDark:Oe.black,hcLight:Oe.white},d(1483,null)),s$r=J("peekViewResult.lineForeground",{dark:"#bbbbbb",light:"#646465",hcDark:Oe.white,hcLight:od},d(1485,null)),a$r=J("peekViewResult.fileForeground",{dark:Oe.white,light:"#1E1E1E",hcDark:Oe.white,hcLight:od},d(1484,null)),l$r=J("peekViewResult.selectionBackground",{dark:"#3399ff33",light:"#3399ff33",hcDark:null,hcLight:null},d(1487,null)),c$r=J("peekViewResult.selectionForeground",{dark:Oe.white,light:"#6C6C6C",hcDark:Oe.white,hcLight:od},d(1488,null)),Loi=J("peekViewEditor.background",{dark:"#001F33",light:"#F2F8FC",hcDark:Oe.black,hcLight:Oe.white},d(1477,null)),d$r=J("peekViewEditorGutter.background",Loi,d(1478,null)),u$r=J("peekViewEditorStickyScroll.background",Loi,d(1481,null)),p$r=J("peekViewEditorStickyScrollGutter.background",Loi,d(1482,null)),m$r=J("peekViewResult.matchHighlightBackground",{dark:"#ea5c004d",light:"#ea5c004d",hcDark:null,hcLight:null},d(1486,null)),dyt=J("peekViewEditor.matchHighlightBackground",{dark:"#ff8f0099",light:"#f5d802de",hcDark:null,hcLight:null},d(1479,null)),h$r=J("peekViewEditor.matchHighlightBorder",{dark:null,light:null,hcDark:qs,hcLight:qs},d(1480,null));var Moi=class{constructor(i,e){this.renderer=i;this.modelProvider=e}get templateId(){return this.renderer.templateId}renderTemplate(i){return{data:this.renderer.renderTemplate(i),disposable:C.None}}renderElement(i,e,t,o){if(t.disposable?.dispose(),!t.data)return;let n=this.modelProvider();if(n.isResolved(i))return this.renderer.renderElement(n.get(i),i,t.data,o);let r=new $e,s=n.resolve(i,r.token);t.disposable={dispose:()=>r.cancel()},this.renderer.renderPlaceholder(i,t.data),s.then(l=>this.renderer.renderElement(l,i,t.data,o))}disposeTemplate(i){i.disposable&&(i.disposable.dispose(),i.disposable=void 0),i.data&&(this.renderer.disposeTemplate(i.data),i.data=void 0)}},Poi=class{constructor(i,e){this.modelProvider=i;this.accessibilityProvider=e}getWidgetAriaLabel(){return this.accessibilityProvider.getWidgetAriaLabel()}getAriaLabel(i){let e=this.modelProvider();return e.isResolved(i)?this.accessibilityProvider.getAriaLabel(e.get(i)):null}};function vWo(a,i){return{...i,accessibilityProvider:i.accessibilityProvider&&new Poi(a,i.accessibilityProvider)}}var A1=class{constructor(i,e,t,o,n={}){this.modelDisposables=new P;let r=()=>this.model,s=o.map(l=>new Moi(l,r));this.list=new hc(i,e,t,s,vWo(r,n))}updateOptions(i){this.list.updateOptions(i)}getHTMLElement(){return this.list.getHTMLElement()}isDOMFocused(){return sa(this.getHTMLElement())}domFocus(){this.list.domFocus()}get onDidFocus(){return this.list.onDidFocus}get onDidBlur(){return this.list.onDidBlur}get widget(){return this.list}get onDidDispose(){return this.list.onDidDispose}get onMouseClick(){return H.map(this.list.onMouseClick,({element:i,index:e,browserEvent:t})=>({element:i===void 0?void 0:this._model.get(i),index:e,browserEvent:t}))}get onMouseDblClick(){return H.map(this.list.onMouseDblClick,({element:i,index:e,browserEvent:t})=>({element:i===void 0?void 0:this._model.get(i),index:e,browserEvent:t}))}get onTap(){return H.map(this.list.onTap,({element:i,index:e,browserEvent:t})=>({element:i===void 0?void 0:this._model.get(i),index:e,browserEvent:t}))}get onPointer(){return H.map(this.list.onPointer,({element:i,index:e,browserEvent:t})=>({element:i===void 0?void 0:this._model.get(i),index:e,browserEvent:t}))}get onDidChangeFocus(){return H.map(this.list.onDidChangeFocus,({elements:i,indexes:e,browserEvent:t})=>({elements:i.map(o=>this._model.get(o)),indexes:e,browserEvent:t}))}get onDidChangeSelection(){return H.map(this.list.onDidChangeSelection,({elements:i,indexes:e,browserEvent:t})=>({elements:i.map(o=>this._model.get(o)),indexes:e,browserEvent:t}))}get onContextMenu(){return H.map(this.list.onContextMenu,({element:i,index:e,anchor:t,browserEvent:o})=>typeof i>"u"?{element:i,index:e,anchor:t,browserEvent:o}:{element:this._model.get(i),index:e,anchor:t,browserEvent:o})}get model(){return this._model}set model(i){this.modelDisposables.clear(),this._model=i,this.list.splice(0,this.list.length,ig(i.length)),this.modelDisposables.add(i.onDidIncrementLength(e=>this.list.splice(this.list.length,0,ig(this.list.length,e))))}get length(){return this.list.length}get scrollTop(){return this.list.scrollTop}set scrollTop(i){this.list.scrollTop=i}get scrollLeft(){return this.list.scrollLeft}set scrollLeft(i){this.list.scrollLeft=i}setAnchor(i){this.list.setAnchor(i)}getAnchor(){return this.list.getAnchor()}setFocus(i){this.list.setFocus(i)}focusNext(i,e){this.list.focusNext(i,e)}focusPrevious(i,e){this.list.focusPrevious(i,e)}focusNextPage(){return this.list.focusNextPage()}focusPreviousPage(){return this.list.focusPreviousPage()}focusLast(){this.list.focusLast()}focusFirst(){this.list.focusFirst()}getFocus(){return this.list.getFocus()}setSelection(i,e){this.list.setSelection(i,e)}getSelection(){return this.list.getSelection()}getSelectedElements(){return this.getSelection().map(i=>this.model.get(i))}layout(i,e){this.list.layout(i,e)}triggerTypeNavigation(){this.list.triggerTypeNavigation()}reveal(i,e){this.list.reveal(i,e)}style(i){this.list.style(i)}dispose(){this.list.dispose(),this.modelDisposables.dispose()}};var bWo={separatorBorder:Oe.transparent};var uyt=class{constructor(i,e,t,o){this.container=i;this.view=e;this.disposable=o;this._cachedVisibleSize=void 0;typeof t=="number"?(this._size=t,this._cachedVisibleSize=void 0,i.classList.add("visible")):(this._size=0,this._cachedVisibleSize=t.cachedVisibleSize)}set size(i){this._size=i}get size(){return this._size}get cachedVisibleSize(){return this._cachedVisibleSize}get visible(){return typeof this._cachedVisibleSize>"u"}setVisible(i,e){if(i!==this.visible){i?(this.size=Kn(this._cachedVisibleSize,this.viewMinimumSize,this.viewMaximumSize),this._cachedVisibleSize=void 0):(this._cachedVisibleSize=typeof e=="number"?e:this.size,this.size=0),this.container.classList.toggle("visible",i);try{this.view.setVisible?.(i)}catch(t){console.error("Splitview: Failed to set visible view"),console.error(t)}}}get minimumSize(){return this.visible?this.view.minimumSize:0}get viewMinimumSize(){return this.view.minimumSize}get maximumSize(){return this.visible?this.view.maximumSize:0}get viewMaximumSize(){return this.view.maximumSize}get priority(){return this.view.priority}get proportionalLayout(){return this.view.proportionalLayout??!0}get snap(){return!!this.view.snap}set enabled(i){this.container.style.pointerEvents=i?"":"none"}layout(i,e){this.layoutContainer(i);try{this.view.layout(this.size,i,e)}catch(t){console.error("Splitview: Failed to layout view"),console.error(t)}}dispose(){this.disposable.dispose()}},Aoi=class extends uyt{layoutContainer(i){this.container.style.top=`${i}px`,this.container.style.height=`${this.size}px`}},Noi=class extends uyt{layoutContainer(i){this.container.style.left=`${i}px`,this.container.style.width=`${this.size}px`}};var Wl;(o=>{o.Distribute={type:"distribute"};function i(n){return{type:"split",index:n}}o.Split=i;function e(n){return{type:"auto",index:n}}o.Auto=e;function t(n){return{type:"invisible",cachedVisibleSize:n}}o.Invisible=t})(Wl||={});var vu=class extends C{constructor(e,t={}){super();this.size=0;this._contentSize=0;this.proportions=void 0;this.viewItems=[];this.sashItems=[];this.state=0;this._onDidSashChange=this._register(new E);this._onDidSashReset=this._register(new E);this._startSnappingEnabled=!0;this._endSnappingEnabled=!0;this.onDidSashChange=this._onDidSashChange.event;this.onDidSashReset=this._onDidSashReset.event;this.orientation=t.orientation??0,this.inverseAltBehavior=t.inverseAltBehavior??!1,this.proportionalLayout=t.proportionalLayout??!0,this.getSashOrthogonalSize=t.getSashOrthogonalSize,this.el=document.createElement("div"),this.el.classList.add("monaco-split-view2"),this.el.classList.add(this.orientation===0?"vertical":"horizontal"),e.appendChild(this.el),this.sashContainer=R(this.el,_(".sash-container")),this.viewContainer=_(".split-view-container"),this.scrollable=this._register(new UT({forceIntegerValues:!0,smoothScrollDuration:125,scheduleAtNextAnimationFrame:n=>$r(Me(this.el),n)})),this.scrollableElement=this._register(new AN(this.viewContainer,{vertical:this.orientation===0?t.scrollbarVisibility??1:2,horizontal:this.orientation===1?t.scrollbarVisibility??1:2},this.scrollable));let o=this._register(new On(this.viewContainer,"scroll")).event;this._register(o(n=>{let r=this.scrollableElement.getScrollPosition(),s=Math.abs(this.viewContainer.scrollLeft-r.scrollLeft)<=1?void 0:this.viewContainer.scrollLeft,l=Math.abs(this.viewContainer.scrollTop-r.scrollTop)<=1?void 0:this.viewContainer.scrollTop;(s!==void 0||l!==void 0)&&this.scrollableElement.setScrollPosition({scrollLeft:s,scrollTop:l})})),this.onDidScroll=this.scrollableElement.onScroll,this._register(this.onDidScroll(n=>{n.scrollTopChanged&&(this.viewContainer.scrollTop=n.scrollTop),n.scrollLeftChanged&&(this.viewContainer.scrollLeft=n.scrollLeft)})),R(this.el,this.scrollableElement.getDomNode()),this.style(t.styles||bWo),t.descriptor&&(this.size=t.descriptor.size,t.descriptor.views.forEach((n,r)=>{let s=cn(n.visible)||n.visible?n.size:{type:"invisible",cachedVisibleSize:n.size},l=n.view;this.doAddView(l,s,r,!0)}),this._contentSize=this.viewItems.reduce((n,r)=>n+r.size,0),this.saveProportions())}get contentSize(){return this._contentSize}get length(){return this.viewItems.length}get minimumSize(){return this.viewItems.reduce((e,t)=>e+t.minimumSize,0)}get maximumSize(){return this.length===0?Number.POSITIVE_INFINITY:this.viewItems.reduce((e,t)=>e+t.maximumSize,0)}get orthogonalStartSash(){return this._orthogonalStartSash}get orthogonalEndSash(){return this._orthogonalEndSash}get startSnappingEnabled(){return this._startSnappingEnabled}get endSnappingEnabled(){return this._endSnappingEnabled}set orthogonalStartSash(e){for(let t of this.sashItems)t.sash.orthogonalStartSash=e;this._orthogonalStartSash=e}set orthogonalEndSash(e){for(let t of this.sashItems)t.sash.orthogonalEndSash=e;this._orthogonalEndSash=e}get sashes(){return this.sashItems.map(e=>e.sash)}set startSnappingEnabled(e){this._startSnappingEnabled!==e&&(this._startSnappingEnabled=e,this.updateSashEnablement())}set endSnappingEnabled(e){this._endSnappingEnabled!==e&&(this._endSnappingEnabled=e,this.updateSashEnablement())}style(e){e.separatorBorder.isTransparent()?(this.el.classList.remove("separator-border"),this.el.style.removeProperty("--separator-border")):(this.el.classList.add("separator-border"),this.el.style.setProperty("--separator-border",e.separatorBorder.toString()))}addView(e,t,o=this.viewItems.length,n){this.doAddView(e,t,o,n)}removeView(e,t){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");if(this.state!==0)throw new Error("Cant modify splitview");this.state=1;try{t?.type==="auto"&&(this.areViewsDistributed()?t={type:"distribute"}:t={type:"split",index:t.index});let o=t?.type==="split"?this.viewItems[t.index]:void 0,n=this.viewItems.splice(e,1)[0];if(o&&(o.size+=n.size),this.viewItems.length>=1){let s=Math.max(e-1,0);this.sashItems.splice(s,1)[0].disposable.dispose()}this.relayout(),t?.type==="distribute"&&this.distributeViewSizes();let r=n.view;return n.dispose(),r}finally{this.state=0}}removeAllViews(){if(this.state!==0)throw new Error("Cant modify splitview");this.state=1;try{let e=this.viewItems.splice(0,this.viewItems.length);for(let o of e)o.dispose();let t=this.sashItems.splice(0,this.sashItems.length);for(let o of t)o.disposable.dispose();return this.relayout(),e.map(o=>o.view)}finally{this.state=0}}moveView(e,t){if(this.state!==0)throw new Error("Cant modify splitview");let o=this.getViewCachedVisibleSize(e),n=typeof o>"u"?this.getViewSize(e):Wl.Invisible(o),r=this.removeView(e);this.addView(r,n,t)}swapViews(e,t){if(this.state!==0)throw new Error("Cant modify splitview");if(e>t)return this.swapViews(t,e);let o=this.getViewSize(e),n=this.getViewSize(t),r=this.removeView(t),s=this.removeView(e);this.addView(r,o,e),this.addView(s,n,t)}isViewVisible(e){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");return this.viewItems[e].visible}setViewVisible(e,t){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");this.viewItems[e].setVisible(t),this.distributeEmptySpace(e),this.layoutViews(),this.saveProportions()}getViewCachedVisibleSize(e){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");return this.viewItems[e].cachedVisibleSize}layout(e,t){let o=Math.max(this.size,this._contentSize);if(this.size=e,this.layoutContext=t,this.proportions){let n=0;for(let r=0;r<this.viewItems.length;r++){let s=this.viewItems[r],l=this.proportions[r];typeof l=="number"?n+=l:e-=s.size}for(let r=0;r<this.viewItems.length;r++){let s=this.viewItems[r],l=this.proportions[r];typeof l=="number"&&n>0&&(s.size=Kn(Math.round(l*e/n),s.minimumSize,s.maximumSize))}}else{let n=ig(this.viewItems.length),r=n.filter(l=>this.viewItems[l].priority===1),s=n.filter(l=>this.viewItems[l].priority===2);this.resize(this.viewItems.length-1,e-o,void 0,r,s)}this.distributeEmptySpace(),this.layoutViews()}saveProportions(){this.proportionalLayout&&this._contentSize>0&&(this.proportions=this.viewItems.map(e=>e.proportionalLayout&&e.visible?e.size/this._contentSize:void 0))}onSashStart({sash:e,start:t,alt:o}){for(let l of this.viewItems)l.enabled=!1;let n=this.sashItems.findIndex(l=>l.sash===e),r=hn(j(this.el.ownerDocument.body,"keydown",l=>s(this.sashDragState.current,l.altKey)),j(this.el.ownerDocument.body,"keyup",()=>s(this.sashDragState.current,!1))),s=(l,c)=>{let u=this.viewItems.map(v=>v.size),p=Number.NEGATIVE_INFINITY,h=Number.POSITIVE_INFINITY;if(this.inverseAltBehavior&&(c=!c),c)if(n===this.sashItems.length-1){let b=this.viewItems[n];p=(b.minimumSize-b.size)/2,h=(b.maximumSize-b.size)/2}else{let b=this.viewItems[n+1];p=(b.size-b.maximumSize)/2,h=(b.size-b.minimumSize)/2}let g,f;if(!c){let v=ig(n,-1),b=ig(n+1,this.viewItems.length),S=v.reduce((U,G)=>U+(this.viewItems[G].minimumSize-u[G]),0),y=v.reduce((U,G)=>U+(this.viewItems[G].viewMaximumSize-u[G]),0),w=b.length===0?Number.POSITIVE_INFINITY:b.reduce((U,G)=>U+(u[G]-this.viewItems[G].minimumSize),0),k=b.length===0?Number.NEGATIVE_INFINITY:b.reduce((U,G)=>U+(u[G]-this.viewItems[G].viewMaximumSize),0),T=Math.max(S,k),N=Math.min(w,y),O=this.findFirstSnapIndex(v),V=this.findFirstSnapIndex(b);if(typeof O=="number"){let U=this.viewItems[O],G=Math.floor(U.viewMinimumSize/2);g={index:O,limitDelta:U.visible?T-G:T+G,size:U.size}}if(typeof V=="number"){let U=this.viewItems[V],G=Math.floor(U.viewMinimumSize/2);f={index:V,limitDelta:U.visible?N+G:N-G,size:U.size}}}this.sashDragState={start:l,current:l,index:n,sizes:u,minDelta:p,maxDelta:h,alt:c,snapBefore:g,snapAfter:f,disposable:r}};s(t,o)}onSashChange({current:e}){let{index:t,start:o,sizes:n,alt:r,minDelta:s,maxDelta:l,snapBefore:c,snapAfter:u}=this.sashDragState;this.sashDragState.current=e;let p=e-o,h=this.resize(t,p,n,void 0,void 0,s,l,c,u);if(r){let g=t===this.sashItems.length-1,f=this.viewItems.map(k=>k.size),v=g?t:t+1,b=this.viewItems[v],S=b.size-b.maximumSize,y=b.size-b.minimumSize,w=g?t-1:t+1;this.resize(w,-h,f,void 0,void 0,S,y)}this.distributeEmptySpace(),this.layoutViews()}onSashEnd(e){this._onDidSashChange.fire(e),this.sashDragState.disposable.dispose(),this.saveProportions();for(let t of this.viewItems)t.enabled=!0}onViewChange(e,t){let o=this.viewItems.indexOf(e);o<0||o>=this.viewItems.length||(t=typeof t=="number"?t:e.size,t=Kn(t,e.minimumSize,e.maximumSize),this.inverseAltBehavior&&o>0?(this.resize(o-1,Math.floor((e.size-t)/2)),this.distributeEmptySpace(),this.layoutViews()):(e.size=t,this.relayout([o],void 0)))}resizeView(e,t){if(!(e<0||e>=this.viewItems.length)){if(this.state!==0)throw new Error("Cant modify splitview");this.state=1;try{let o=ig(this.viewItems.length).filter(l=>l!==e),n=[...o.filter(l=>this.viewItems[l].priority===1),e],r=o.filter(l=>this.viewItems[l].priority===2),s=this.viewItems[e];t=Math.round(t),t=Kn(t,s.minimumSize,Math.min(s.maximumSize,this.size)),s.size=t,this.relayout(n,r)}finally{this.state=0}}}isViewExpanded(e){if(e<0||e>=this.viewItems.length)return!1;for(let t of this.viewItems)if(t!==this.viewItems[e]&&t.size>t.minimumSize)return!1;return!0}distributeViewSizes(){let e=[],t=0;for(let l of this.viewItems)l.maximumSize-l.minimumSize>0&&(e.push(l),t+=l.size);let o=Math.floor(t/e.length);for(let l of e)l.size=Kn(o,l.minimumSize,l.maximumSize);let n=ig(this.viewItems.length),r=n.filter(l=>this.viewItems[l].priority===1),s=n.filter(l=>this.viewItems[l].priority===2);this.relayout(r,s)}getViewSize(e){return e<0||e>=this.viewItems.length?-1:this.viewItems[e].size}doAddView(e,t,o=this.viewItems.length,n){if(this.state!==0)throw new Error("Cant modify splitview");this.state=1;try{let r=_(".split-view-view");o===this.viewItems.length?this.viewContainer.appendChild(r):this.viewContainer.insertBefore(r,this.viewContainer.children.item(o));let s=e.onDidChange(g=>this.onViewChange(p,g)),l=Z(()=>r.remove()),c=hn(s,l),u;typeof t=="number"?u=t:(t.type==="auto"&&(this.areViewsDistributed()?t={type:"distribute"}:t={type:"split",index:t.index}),t.type==="split"?u=this.getViewSize(t.index)/2:t.type==="invisible"?u={cachedVisibleSize:t.cachedVisibleSize}:u=e.minimumSize);let p=this.orientation===0?new Aoi(r,e,u,c):new Noi(r,e,u,c);if(this.viewItems.splice(o,0,p),this.viewItems.length>1){let g={orthogonalStartSash:this.orthogonalStartSash,orthogonalEndSash:this.orthogonalEndSash},f=this.orientation===0?new pv(this.sashContainer,{getHorizontalSashTop:U=>this.getSashPosition(U),getHorizontalSashWidth:this.getSashOrthogonalSize},{...g,orientation:1}):new pv(this.sashContainer,{getVerticalSashLeft:U=>this.getSashPosition(U),getVerticalSashHeight:this.getSashOrthogonalSize},{...g,orientation:0}),v=this.orientation===0?U=>({sash:f,start:U.startY,current:U.currentY,alt:U.altKey}):U=>({sash:f,start:U.startX,current:U.currentX,alt:U.altKey}),S=H.map(f.onDidStart,v)(this.onSashStart,this),w=H.map(f.onDidChange,v)(this.onSashChange,this),T=H.map(f.onDidEnd,()=>this.sashItems.findIndex(U=>U.sash===f))(this.onSashEnd,this),N=f.onDidReset(()=>{let U=this.sashItems.findIndex(de=>de.sash===f),G=ig(U,-1),$=ig(U+1,this.viewItems.length),te=this.findFirstSnapIndex(G),pe=this.findFirstSnapIndex($);typeof te=="number"&&!this.viewItems[te].visible||typeof pe=="number"&&!this.viewItems[pe].visible||this._onDidSashReset.fire(U)}),O=hn(S,w,T,N,f),V={sash:f,disposable:O};this.sashItems.splice(o-1,0,V)}r.appendChild(e.element);let h;typeof t!="number"&&t.type==="split"&&(h=[t.index]),n||this.relayout([o],h),!n&&typeof t!="number"&&t.type==="distribute"&&this.distributeViewSizes()}finally{this.state=0}}relayout(e,t){let o=this.viewItems.reduce((n,r)=>n+r.size,0);this.resize(this.viewItems.length-1,this.size-o,void 0,e,t),this.distributeEmptySpace(),this.layoutViews(),this.saveProportions()}resize(e,t,o=this.viewItems.map(p=>p.size),n,r,s=Number.NEGATIVE_INFINITY,l=Number.POSITIVE_INFINITY,c,u){if(e<0||e>=this.viewItems.length)return 0;let p=ig(e,-1),h=ig(e+1,this.viewItems.length);if(r)for(let V of r)Fut(p,V),Fut(h,V);if(n)for(let V of n)iGe(p,V),iGe(h,V);let g=p.map(V=>this.viewItems[V]),f=p.map(V=>o[V]),v=h.map(V=>this.viewItems[V]),b=h.map(V=>o[V]),S=p.reduce((V,U)=>V+(this.viewItems[U].minimumSize-o[U]),0),y=p.reduce((V,U)=>V+(this.viewItems[U].maximumSize-o[U]),0),w=h.length===0?Number.POSITIVE_INFINITY:h.reduce((V,U)=>V+(o[U]-this.viewItems[U].minimumSize),0),k=h.length===0?Number.NEGATIVE_INFINITY:h.reduce((V,U)=>V+(o[U]-this.viewItems[U].maximumSize),0),T=Math.max(S,k,s),N=Math.min(w,y,l),O=!1;if(c){let V=this.viewItems[c.index],U=t>=c.limitDelta;O=U!==V.visible,V.setVisible(U,c.size)}if(!O&&u){let V=this.viewItems[u.index],U=t<u.limitDelta;O=U!==V.visible,V.setVisible(U,u.size)}if(O)return this.resize(e,t,o,n,r,s,l);t=Kn(t,T,N);for(let V=0,U=t;V<g.length;V++){let G=g[V],$=Kn(f[V]+U,G.minimumSize,G.maximumSize),te=$-f[V];U-=te,G.size=$}for(let V=0,U=t;V<v.length;V++){let G=v[V],$=Kn(b[V]-U,G.minimumSize,G.maximumSize),te=$-b[V];U+=te,G.size=$}return t}distributeEmptySpace(e){let t=this.viewItems.reduce((l,c)=>l+c.size,0),o=this.size-t,n=ig(this.viewItems.length-1,-1),r=n.filter(l=>this.viewItems[l].priority===1),s=n.filter(l=>this.viewItems[l].priority===2);for(let l of s)Fut(n,l);for(let l of r)iGe(n,l);typeof e=="number"&&iGe(n,e);for(let l=0;o!==0&&l<n.length;l++){let c=this.viewItems[n[l]],u=Kn(c.size+o,c.minimumSize,c.maximumSize),p=u-c.size;o-=p,c.size=u}}layoutViews(){this._contentSize=this.viewItems.reduce((t,o)=>t+o.size,0);let e=0;for(let t of this.viewItems)t.layout(e,this.layoutContext),e+=t.size;this.sashItems.forEach(t=>t.sash.layout()),this.updateSashEnablement(),this.updateScrollableElement()}updateScrollableElement(){this.orientation===0?this.scrollableElement.setScrollDimensions({height:this.size,scrollHeight:this._contentSize}):this.scrollableElement.setScrollDimensions({width:this.size,scrollWidth:this._contentSize})}updateSashEnablement(){let e=!1,t=this.viewItems.map(c=>e=c.size-c.minimumSize>0||e);e=!1;let o=this.viewItems.map(c=>e=c.maximumSize-c.size>0||e),n=[...this.viewItems].reverse();e=!1;let r=n.map(c=>e=c.size-c.minimumSize>0||e).reverse();e=!1;let s=n.map(c=>e=c.maximumSize-c.size>0||e).reverse(),l=0;for(let c=0;c<this.sashItems.length;c++){let{sash:u}=this.sashItems[c],p=this.viewItems[c];l+=p.size;let h=!(t[c]&&s[c+1]),g=!(o[c]&&r[c+1]);if(h&&g){let f=ig(c,-1),v=ig(c+1,this.viewItems.length),b=this.findFirstSnapIndex(f),S=this.findFirstSnapIndex(v),y=typeof b=="number"&&!this.viewItems[b].visible,w=typeof S=="number"&&!this.viewItems[S].visible;y&&r[c]&&(l>0||this.startSnappingEnabled)?u.state=1:w&&t[c]&&(l<this._contentSize||this.endSnappingEnabled)?u.state=2:u.state=0}else h&&!g?u.state=1:!h&&g?u.state=2:u.state=3}}getSashPosition(e){let t=0;for(let o=0;o<this.sashItems.length;o++)if(t+=this.viewItems[o].size,this.sashItems[o].sash===e)return t;return 0}findFirstSnapIndex(e){for(let t of e){let o=this.viewItems[t];if(o.visible&&o.snap)return t}for(let t of e){let o=this.viewItems[t];if(o.visible&&o.maximumSize-o.minimumSize>0)return;if(!o.visible&&o.snap)return t}}areViewsDistributed(){let e,t;for(let o of this.viewItems)if(e=e===void 0?o.size:Math.min(e,o.size),t=t===void 0?o.size:Math.max(t,o.size),t-e>2)return!1;return!0}dispose(){this.sashDragState?.disposable.dispose(),Ue(this.viewItems),this.viewItems=[],this.sashItems.forEach(e=>e.disposable.dispose()),this.sashItems=[],super.dispose()}};var pyt=class a{constructor(i,e,t){this.columns=i;this.getColumnSize=t;this.templateId=a.TemplateId;this.renderedTemplates=new Set;let o=new Map(e.map(n=>[n.templateId,n]));this.renderers=[];for(let n of i){let r=o.get(n.templateId);if(!r)throw new Error(`Table cell renderer for template id ${n.templateId} not found.`);this.renderers.push(r)}}static{this.TemplateId="row"}renderTemplate(i){let e=R(i,_(".monaco-table-tr")),t=[],o=[];for(let r=0;r<this.columns.length;r++){let s=this.renderers[r],l=R(e,_(".monaco-table-td",{"data-col-index":r}));l.style.width=`${this.getColumnSize(r)}px`,t.push(l),o.push(s.renderTemplate(l))}let n={container:i,cellContainers:t,cellTemplateData:o};return this.renderedTemplates.add(n),n}renderElement(i,e,t,o){for(let n=0;n<this.columns.length;n++){let s=this.columns[n].project(i);this.renderers[n].renderElement(s,e,t.cellTemplateData[n],o)}}disposeElement(i,e,t,o){for(let n=0;n<this.columns.length;n++){let r=this.renderers[n];if(r.disposeElement){let l=this.columns[n].project(i);r.disposeElement(l,e,t.cellTemplateData[n],o)}}}disposeTemplate(i){for(let e=0;e<this.columns.length;e++)this.renderers[e].disposeTemplate(i.cellTemplateData[e]);Rt(i.container),this.renderedTemplates.delete(i)}layoutColumn(i,e){for(let{cellContainers:t}of this.renderedTemplates)t[i].style.width=`${e}px`}};function SWo(a){return{getHeight(i){return a.getHeight(i)},getTemplateId(){return pyt.TemplateId}}}var Ooi=class extends C{constructor(e,t){super();this.column=e;this.index=t;this._onDidLayout=this._register(new E);this.onDidLayout=this._onDidLayout.event;this.element=_(".monaco-table-th",{"data-col-index":t},e.label),e.tooltip&&this._register(yp().setupManagedHover(Ni("mouse"),this.element,e.tooltip))}get minimumSize(){return this.column.minimumWidth??120}get maximumSize(){return this.column.maximumWidth??Number.POSITIVE_INFINITY}get onDidChange(){return this.column.onDidChangeWidthConstraints??H.None}layout(e){this._onDidLayout.fire([this.index,e])}},dO=class a{constructor(i,e,t,o,n,r){this.virtualDelegate=t;this.columns=o;this.domId=`table_id_${++a.InstanceCount}`;this.disposables=new P;this.cachedWidth=0;this.cachedHeight=0;this.domNode=R(e,_(`.monaco-table.${this.domId}`));let s=o.map((u,p)=>this.disposables.add(new Ooi(u,p))),l={size:s.reduce((u,p)=>u+p.column.weight,0),views:s.map(u=>({size:u.column.weight,view:u}))};this.splitview=this.disposables.add(new vu(this.domNode,{orientation:1,scrollbarVisibility:2,getSashOrthogonalSize:()=>this.cachedHeight,descriptor:l})),this.splitview.el.style.height=`${t.headerRowHeight}px`,this.splitview.el.style.lineHeight=`${t.headerRowHeight}px`;let c=new pyt(o,n,u=>this.splitview.getViewSize(u));this.list=this.disposables.add(new hc(i,this.domNode,SWo(t),[c],r)),H.any(...s.map(u=>u.onDidLayout))(([u,p])=>c.layoutColumn(u,p),null,this.disposables),this.splitview.onDidSashReset(u=>{let p=o.reduce((g,f)=>g+f.weight,0),h=o[u].weight/p*this.cachedWidth;this.splitview.resizeView(u,h)},null,this.disposables),this.styleElement=hr(this.domNode),this.style(eSt)}static{this.InstanceCount=0}get onDidChangeFocus(){return this.list.onDidChangeFocus}get onDidChangeSelection(){return this.list.onDidChangeSelection}get onDidScroll(){return this.list.onDidScroll}get onMouseClick(){return this.list.onMouseClick}get onMouseDblClick(){return this.list.onMouseDblClick}get onMouseMiddleClick(){return this.list.onMouseMiddleClick}get onPointer(){return this.list.onPointer}get onMouseUp(){return this.list.onMouseUp}get onMouseDown(){return this.list.onMouseDown}get onMouseOver(){return this.list.onMouseOver}get onMouseMove(){return this.list.onMouseMove}get onMouseOut(){return this.list.onMouseOut}get onTouchStart(){return this.list.onTouchStart}get onTap(){return this.list.onTap}get onContextMenu(){return this.list.onContextMenu}get onDidFocus(){return this.list.onDidFocus}get onDidBlur(){return this.list.onDidBlur}get scrollTop(){return this.list.scrollTop}set scrollTop(i){this.list.scrollTop=i}get scrollLeft(){return this.list.scrollLeft}set scrollLeft(i){this.list.scrollLeft=i}get scrollHeight(){return this.list.scrollHeight}get renderHeight(){return this.list.renderHeight}get onDidDispose(){return this.list.onDidDispose}getColumnLabels(){return this.columns.map(i=>i.label)}resizeColumn(i,e){let t=Math.round(e/100*this.cachedWidth);this.splitview.resizeView(i,t)}updateOptions(i){this.list.updateOptions(i)}splice(i,e,t=[]){this.list.splice(i,e,t)}rerender(){this.list.rerender()}row(i){return this.list.element(i)}indexOf(i){return this.list.indexOf(i)}get length(){return this.list.length}getHTMLElement(){return this.domNode}layout(i,e){i=i??qbe(this.domNode),e=e??D6(this.domNode),this.cachedWidth=e,this.cachedHeight=i,this.splitview.layout(e);let t=i-this.virtualDelegate.headerRowHeight;this.list.getHTMLElement().style.height=`${t}px`,this.list.layout(t,e)}triggerTypeNavigation(){this.list.triggerTypeNavigation()}style(i){let e=[];e.push(`.monaco-table.${this.domId} > .monaco-split-view2 .monaco-sash.vertical::before {
top: ${this.virtualDelegate.headerRowHeight+1}px;
height: calc(100% - ${this.virtualDelegate.headerRowHeight}px);
}`),this.styleElement.textContent=e.join(`
`),this.list.style(i)}domFocus(){this.list.domFocus()}setAnchor(i){this.list.setAnchor(i)}getAnchor(){return this.list.getAnchor()}getSelectedElements(){return this.list.getSelectedElements()}setSelection(i,e){this.list.setSelection(i,e)}getSelection(){return this.list.getSelection()}setFocus(i,e){this.list.setFocus(i,e)}focusNext(i=1,e=!1,t){this.list.focusNext(i,e,t)}focusPrevious(i=1,e=!1,t){this.list.focusPrevious(i,e,t)}focusNextPage(i){return this.list.focusNextPage(i)}focusPreviousPage(i){return this.list.focusPreviousPage(i)}focusFirst(i){this.list.focusFirst(i)}focusLast(i){this.list.focusLast(i)}getFocus(){return this.list.getFocus()}getFocusedElements(){return this.list.getFocusedElements()}getRelativeTop(i){return this.list.getRelativeTop(i)}reveal(i,e){this.list.reveal(i,e)}dispose(){this.disposables.dispose()}};var pg=class extends Error{constructor(i,e){super(`TreeError [${i}] ${e}`)}},Qae=class{constructor(i){this.fn=i;this._map=new WeakMap}map(i){let e=this._map.get(i);return e||(e=this.fn(i),this._map.set(i,e)),e}};function k7(a){return!!a&&a.visibility!==void 0}function N1(a){switch(a){case!0:return 1;case!1:return 0;default:return a}}function Foi(a){return"collapsible"in a}var myt=class{constructor(i,e,t={}){this.user=i;this.rootRef=[];this.eventBufferer=new eN;this._onDidSpliceModel=new E;this.onDidSpliceModel=this._onDidSpliceModel.event;this._onDidSpliceRenderedNodes=new E;this.onDidSpliceRenderedNodes=this._onDidSpliceRenderedNodes.event;this._onDidChangeCollapseState=new E;this.onDidChangeCollapseState=this.eventBufferer.wrapEvent(this._onDidChangeCollapseState.event);this._onDidChangeRenderNodeCount=new E;this.onDidChangeRenderNodeCount=this.eventBufferer.wrapEvent(this._onDidChangeRenderNodeCount.event);this.refilterDelayer=new jo(QD);this.collapseByDefault=typeof t.collapseByDefault>"u"?!1:t.collapseByDefault,this.allowNonCollapsibleParents=t.allowNonCollapsibleParents??!1,this.filter=t.filter,this.autoExpandSingleChildren=typeof t.autoExpandSingleChildren>"u"?!1:t.autoExpandSingleChildren,this.root={parent:void 0,element:e,children:[],depth:0,visibleChildrenCount:0,visibleChildIndex:-1,collapsible:!1,collapsed:!1,renderNodeCount:0,visibility:1,visible:!0,filterData:void 0}}splice(i,e,t=ht.empty(),o={}){if(i.length===0)throw new pg(this.user,"Invalid tree location");o.diffIdentityProvider?this.spliceSmart(o.diffIdentityProvider,i,e,t,o):this.spliceSimple(i,e,t,o)}spliceSmart(i,e,t,o=ht.empty(),n,r=n.diffDepth??0){let{parentNode:s}=this.getParentNodeWithListIndex(e);if(!s.lastDiffIds)return this.spliceSimple(e,t,o,n);let l=[...o],c=e[e.length-1],u=new MM({getElements:()=>s.lastDiffIds},{getElements:()=>[...s.children.slice(0,c),...l,...s.children.slice(c+t)].map(v=>i.getId(v.element).toString())}).ComputeDiff(!1);if(u.quitEarly)return s.lastDiffIds=void 0,this.spliceSimple(e,t,l,n);let p=e.slice(0,-1),h=(v,b,S)=>{if(r>0)for(let y=0;y<S;y++)v--,b--,this.spliceSmart(i,[...p,v,0],Number.MAX_SAFE_INTEGER,l[b].children,n,r-1)},g=Math.min(s.children.length,c+t),f=l.length;for(let v of u.changes.sort((b,S)=>S.originalStart-b.originalStart))h(g,f,g-(v.originalStart+v.originalLength)),g=v.originalStart,f=v.modifiedStart-c,this.spliceSimple([...p,g],v.originalLength,ht.slice(l,f,f+v.modifiedLength),n);h(g,f,g)}spliceSimple(i,e,t=ht.empty(),{onDidCreateNode:o,onDidDeleteNode:n,diffIdentityProvider:r}){let{parentNode:s,listIndex:l,revealed:c,visible:u}=this.getParentNodeWithListIndex(i),p=[],h=ht.map(t,T=>this.createTreeNode(T,s,s.visible?1:0,c,p,o)),g=i[i.length-1],f=0;for(let T=g;T>=0&&T<s.children.length;T--){let N=s.children[T];if(N.visible){f=N.visibleChildIndex;break}}let v=[],b=0,S=0;for(let T of h)v.push(T),S+=T.renderNodeCount,T.visible&&(T.visibleChildIndex=f+b++);let y=ure(s.children,g,e,v);r?s.lastDiffIds?ure(s.lastDiffIds,g,e,v.map(T=>r.getId(T.element).toString())):s.lastDiffIds=s.children.map(T=>r.getId(T.element).toString()):s.lastDiffIds=void 0;let w=0;for(let T of y)T.visible&&w++;if(w!==0)for(let T=g+v.length;T<s.children.length;T++){let N=s.children[T];N.visible&&(N.visibleChildIndex-=w)}if(s.visibleChildrenCount+=b-w,y.length>0&&n){let T=N=>{n(N),N.children.forEach(T)};y.forEach(T)}if(c&&u){let T=y.reduce((N,O)=>N+(O.visible?O.renderNodeCount:0),0);this._updateAncestorsRenderNodeCount(s,S-T),this._onDidSpliceRenderedNodes.fire({start:l,deleteCount:T,elements:p})}this._onDidSpliceModel.fire({insertedNodes:v,deletedNodes:y});let k=s;for(;k;){if(k.visibility===2){this.refilterDelayer.trigger(()=>this.refilter());break}k=k.parent}}rerender(i){if(i.length===0)throw new pg(this.user,"Invalid tree location");let{node:e,listIndex:t,revealed:o}=this.getTreeNodeWithListIndex(i);e.visible&&o&&this._onDidSpliceRenderedNodes.fire({start:t,deleteCount:1,elements:[e]})}has(i){return this.hasTreeNode(i)}getListIndex(i){let{listIndex:e,visible:t,revealed:o}=this.getTreeNodeWithListIndex(i);return t&&o?e:-1}getListRenderCount(i){return this.getTreeNode(i).renderNodeCount}isCollapsible(i){return this.getTreeNode(i).collapsible}setCollapsible(i,e){let t=this.getTreeNode(i);typeof e>"u"&&(e=!t.collapsible);let o={collapsible:e};return this.eventBufferer.bufferEvents(()=>this._setCollapseState(i,o))}isCollapsed(i){return this.getTreeNode(i).collapsed}setCollapsed(i,e,t){let o=this.getTreeNode(i);typeof e>"u"&&(e=!o.collapsed);let n={collapsed:e,recursive:t||!1};return this.eventBufferer.bufferEvents(()=>this._setCollapseState(i,n))}_setCollapseState(i,e){let{node:t,listIndex:o,revealed:n}=this.getTreeNodeWithListIndex(i),r=this._setListNodeCollapseState(t,o,n,e);if(t!==this.root&&this.autoExpandSingleChildren&&r&&!Foi(e)&&t.collapsible&&!t.collapsed&&!e.recursive){let s=-1;for(let l=0;l<t.children.length;l++)if(t.children[l].visible)if(s>-1){s=-1;break}else s=l;s>-1&&this._setCollapseState([...i,s],e)}return r}_setListNodeCollapseState(i,e,t,o){let n=this._setNodeCollapseState(i,o,!1);if(!t||!i.visible||!n)return n;let r=i.renderNodeCount,s=this.updateNodeAfterCollapseChange(i),l=r-(e===-1?0:1);return this._onDidSpliceRenderedNodes.fire({start:e+1,deleteCount:l,elements:s.slice(1)}),n}_setNodeCollapseState(i,e,t){let o;if(i===this.root?o=!1:(Foi(e)?(o=i.collapsible!==e.collapsible,i.collapsible=e.collapsible):i.collapsible?(o=i.collapsed!==e.collapsed,i.collapsed=e.collapsed):o=!1,o&&this._onDidChangeCollapseState.fire({node:i,deep:t})),!Foi(e)&&e.recursive)for(let n of i.children)o=this._setNodeCollapseState(n,e,!0)||o;return o}expandTo(i){this.eventBufferer.bufferEvents(()=>{let e=this.getTreeNode(i);for(;e.parent;)e=e.parent,i=i.slice(0,i.length-1),e.collapsed&&this._setCollapseState(i,{collapsed:!1,recursive:!1})})}refilter(){let i=this.root.renderNodeCount,e=this.updateNodeAfterFilterChange(this.root);this._onDidSpliceRenderedNodes.fire({start:0,deleteCount:i,elements:e}),this.refilterDelayer.cancel()}createTreeNode(i,e,t,o,n,r){let s={parent:e,element:i.element,children:[],depth:e.depth+1,visibleChildrenCount:0,visibleChildIndex:-1,collapsible:typeof i.collapsible=="boolean"?i.collapsible:typeof i.collapsed<"u",collapsed:typeof i.collapsed>"u"?this.collapseByDefault:i.collapsed,renderNodeCount:1,visibility:1,visible:!0,filterData:void 0},l=this._filterNode(s,t);s.visibility=l,o&&n.push(s);let c=i.children||ht.empty(),u=o&&l!==0&&!s.collapsed,p=0,h=1;for(let g of c){let f=this.createTreeNode(g,s,l,u,n,r);s.children.push(f),h+=f.renderNodeCount,f.visible&&(f.visibleChildIndex=p++)}return this.allowNonCollapsibleParents||(s.collapsible=s.collapsible||s.children.length>0),s.visibleChildrenCount=p,s.visible=l===2?p>0:l===1,s.visible?s.collapsed||(s.renderNodeCount=h):(s.renderNodeCount=0,o&&n.pop()),r?.(s),s}updateNodeAfterCollapseChange(i){let e=i.renderNodeCount,t=[];return this._updateNodeAfterCollapseChange(i,t),this._updateAncestorsRenderNodeCount(i.parent,t.length-e),t}_updateNodeAfterCollapseChange(i,e){if(i.visible===!1)return 0;if(e.push(i),i.renderNodeCount=1,!i.collapsed)for(let t of i.children)i.renderNodeCount+=this._updateNodeAfterCollapseChange(t,e);return this._onDidChangeRenderNodeCount.fire(i),i.renderNodeCount}updateNodeAfterFilterChange(i){let e=i.renderNodeCount,t=[];return this._updateNodeAfterFilterChange(i,i.visible?1:0,t),this._updateAncestorsRenderNodeCount(i.parent,t.length-e),t}_updateNodeAfterFilterChange(i,e,t,o=!0){let n;if(i!==this.root){if(n=this._filterNode(i,e),n===0)return i.visible=!1,i.renderNodeCount=0,!1;o&&t.push(i)}let r=t.length;i.renderNodeCount=i===this.root?0:1;let s=!1;if(!i.collapsed||n!==0){let l=0;for(let c of i.children)s=this._updateNodeAfterFilterChange(c,n,t,o&&!i.collapsed)||s,c.visible&&(c.visibleChildIndex=l++);i.visibleChildrenCount=l}else i.visibleChildrenCount=0;return i!==this.root&&(i.visible=n===2?s:n===1,i.visibility=n),i.visible?i.collapsed||(i.renderNodeCount+=t.length-r):(i.renderNodeCount=0,o&&t.pop()),this._onDidChangeRenderNodeCount.fire(i),i.visible}_updateAncestorsRenderNodeCount(i,e){if(e!==0)for(;i;)i.renderNodeCount+=e,this._onDidChangeRenderNodeCount.fire(i),i=i.parent}_filterNode(i,e){let t=this.filter?this.filter.filter(i.element,e):1;return typeof t=="boolean"?(i.filterData=void 0,t?1:0):k7(t)?(i.filterData=t.data,N1(t.visibility)):(i.filterData=void 0,N1(t))}hasTreeNode(i,e=this.root){if(!i||i.length===0)return!0;let[t,...o]=i;return t<0||t>e.children.length?!1:this.hasTreeNode(o,e.children[t])}getTreeNode(i,e=this.root){if(!i||i.length===0)return e;let[t,...o]=i;if(t<0||t>e.children.length)throw new pg(this.user,"Invalid tree location");return this.getTreeNode(o,e.children[t])}getTreeNodeWithListIndex(i){if(i.length===0)return{node:this.root,listIndex:-1,revealed:!0,visible:!1};let{parentNode:e,listIndex:t,revealed:o,visible:n}=this.getParentNodeWithListIndex(i),r=i[i.length-1];if(r<0||r>e.children.length)throw new pg(this.user,"Invalid tree location");let s=e.children[r];return{node:s,listIndex:t,revealed:o,visible:n&&s.visible}}getParentNodeWithListIndex(i,e=this.root,t=0,o=!0,n=!0){let[r,...s]=i;if(r<0||r>e.children.length)throw new pg(this.user,"Invalid tree location");for(let l=0;l<r;l++)t+=e.children[l].renderNodeCount;return o=o&&!e.collapsed,n=n&&e.visible,s.length===0?{parentNode:e,listIndex:t,revealed:o,visible:n}:this.getParentNodeWithListIndex(s,e.children[r],t+1,o,n)}getNode(i=[]){return this.getTreeNode(i)}getNodeLocation(i){let e=[],t=i;for(;t.parent;)e.push(t.parent.children.indexOf(t)),t=t.parent;return e.reverse()}getParentNodeLocation(i){if(i.length!==0)return i.length===1?[]:Mg(i)[0]}getFirstElementChild(i){let e=this.getTreeNode(i);if(e.children.length!==0)return e.children[0].element}getLastElementAncestor(i=[]){let e=this.getTreeNode(i);if(e.children.length!==0)return this._getLastElementAncestor(e)}_getLastElementAncestor(i){return i.children.length===0?i.element:this._getLastElementAncestor(i.children[i.children.length-1])}};var Voi=class extends $y{constructor(e){super(e.elements.map(t=>t.element));this.data=e}set context(e){this.data.context=e}get context(){return this.data.context}};function Woi(a){return a instanceof $y?new Voi(a):a}var Boi=class{constructor(i,e){this.modelProvider=i;this.dnd=e;this.autoExpandDisposable=C.None;this.disposables=new P}getDragURI(i){return this.dnd.getDragURI(i.element)}getDragLabel(i,e){if(this.dnd.getDragLabel)return this.dnd.getDragLabel(i.map(t=>t.element),e)}onDragStart(i,e){this.dnd.onDragStart?.(Woi(i),e)}onDragOver(i,e,t,o,n,r=!0){let s=this.dnd.onDragOver(Woi(i),e&&e.element,t,o,n),l=this.autoExpandNode!==e;if(l&&(this.autoExpandDisposable.dispose(),this.autoExpandNode=e),typeof e>"u")return s;if(l&&typeof s!="boolean"&&s.autoExpand&&(this.autoExpandDisposable=nn(()=>{let g=this.modelProvider(),f=g.getNodeLocation(e);g.isCollapsed(f)&&g.setCollapsed(f,!1),this.autoExpandNode=void 0},500,this.disposables)),typeof s=="boolean"||!s.accept||typeof s.bubble>"u"||s.feedback){if(!r){let g=typeof s=="boolean"?s:s.accept,f=typeof s=="boolean"?void 0:s.effect;return{accept:g,effect:f,feedback:[t]}}return s}if(s.bubble===1){let g=this.modelProvider(),f=g.getNodeLocation(e),v=g.getParentNodeLocation(f),b=g.getNode(v),S=v&&g.getListIndex(v);return this.onDragOver(i,b,S,o,n,!1)}let c=this.modelProvider(),u=c.getNodeLocation(e),p=c.getListIndex(u),h=c.getListRenderCount(u);return{...s,feedback:ig(p,p+h)}}drop(i,e,t,o,n){this.autoExpandDisposable.dispose(),this.autoExpandNode=void 0,this.dnd.drop(Woi(i),e&&e.element,t,o,n)}onDragEnd(i){this.dnd.onDragEnd?.(i)}dispose(){this.disposables.dispose(),this.dnd.dispose()}};function IWo(a,i,e){return e&&{...e,identityProvider:e.identityProvider&&{getId(t){return e.identityProvider.getId(t.element)},getGroupId:e.identityProvider.getGroupId?t=>e.identityProvider.getGroupId(t.element):void 0},dnd:e.dnd&&i.add(new Boi(a,e.dnd)),multipleSelectionController:e.multipleSelectionController&&{isSelectionSingleChangeEvent(t){return e.multipleSelectionController.isSelectionSingleChangeEvent({...t,element:t.element})},isSelectionRangeChangeEvent(t){return e.multipleSelectionController.isSelectionRangeChangeEvent({...t,element:t.element})}},accessibilityProvider:e.accessibilityProvider&&{...e.accessibilityProvider,getSetSize(t){let o=a(),n=o.getNodeLocation(t),r=o.getParentNodeLocation(n);return o.getNode(r).visibleChildrenCount},getPosInSet(t){return t.visibleChildIndex+1},isChecked:e.accessibilityProvider&&e.accessibilityProvider.isChecked?t=>e.accessibilityProvider.isChecked(t.element):void 0,getRole:e.accessibilityProvider&&e.accessibilityProvider.getRole?t=>e.accessibilityProvider.getRole(t.element):()=>"treeitem",getAriaLabel(t){return e.accessibilityProvider.getAriaLabel(t.element)},getWidgetAriaLabel(){return e.accessibilityProvider.getWidgetAriaLabel()},getWidgetRole:e.accessibilityProvider&&e.accessibilityProvider.getWidgetRole?()=>e.accessibilityProvider.getWidgetRole():()=>"tree",getAriaLevel:e.accessibilityProvider&&e.accessibilityProvider.getAriaLevel?t=>e.accessibilityProvider.getAriaLevel(t.element):t=>t.depth,getActiveDescendantId:e.accessibilityProvider.getActiveDescendantId&&(t=>e.accessibilityProvider.getActiveDescendantId(t.element))},keyboardNavigationLabelProvider:e.keyboardNavigationLabelProvider&&{...e.keyboardNavigationLabelProvider,getKeyboardNavigationLabel(t){return e.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(t.element)}}}}var Uwe=class{constructor(i){this.delegate=i}getHeight(i){return this.delegate.getHeight(i.element)}getTemplateId(i){return this.delegate.getTemplateId(i.element)}hasDynamicHeight(i){return!!this.delegate.hasDynamicHeight&&this.delegate.hasDynamicHeight(i.element)}setDynamicHeight(i,e){this.delegate.setDynamicHeight?.(i.element,e)}},A5e=class a{static lift(i){return i instanceof a?i:new a(i)}static empty(i=0){return new a({focus:[],selection:[],expanded:Object.create(null),scrollTop:i})}constructor(i){if(this.focus=new Set(i.focus),this.selection=new Set(i.selection),i.expanded instanceof Array){this.expanded=Object.create(null);for(let e of i.expanded)this.expanded[e]=1}else this.expanded=i.expanded;this.expanded=i.expanded,this.scrollTop=i.scrollTop}toJSON(){return{focus:Array.from(this.focus),selection:Array.from(this.selection),expanded:this.expanded,scrollTop:this.scrollTop}}};var Hoi=class{constructor(i,e=[]){this._elements=e;this.disposables=new P;this.onDidChange=H.forEach(i,t=>this._elements=t,this.disposables)}get elements(){return this._elements}dispose(){this.disposables.dispose()}},Uoi=class a{constructor(i,e,t,o,n,r={}){this.renderer=i;this.model=e;this.activeNodes=o;this.renderedIndentGuides=n;this.renderedElements=new Map;this.renderedNodes=new Map;this.indent=a.DefaultIndent;this.defaultIndent=a.DefaultIndent;this.hideTwistiesOfChildlessElements=!1;this.shouldRenderIndentGuides=!1;this.activeIndentNodes=new Set;this.indentGuidesDisposable=C.None;this.disposables=new P;this.templateId=i.templateId,this.updateOptions(r),H.map(t,s=>s.node)(this.onDidChangeNodeTwistieState,this,this.disposables),i.onDidChangeTwistieState?.(this.onDidChangeTwistieState,this,this.disposables)}static{this.DefaultIndent=8}updateOptions(i={}){if(typeof i.defaultIndent<"u"&&(this.defaultIndent=i.defaultIndent),typeof i.indent<"u"||typeof i.defaultIndent<"u"){let e=typeof i.indent<"u"?Kn(i.indent,0,40):this.indent;if(e!==this.indent||typeof i.defaultIndent<"u"){this.indent=e;for(let[o,n]of this.renderedNodes)n.indentSize=this.defaultIndent+(o.depth-1)*this.indent,this.renderTreeElement(o,n)}}if(typeof i.renderIndentGuides<"u"){let e=i.renderIndentGuides!=="none";if(e!==this.shouldRenderIndentGuides){this.shouldRenderIndentGuides=e;for(let[t,o]of this.renderedNodes)this._renderIndentGuides(t,o);if(this.indentGuidesDisposable.dispose(),e){let t=new P;this.activeNodes.onDidChange(this._onDidChangeActiveNodes,this,t),this.indentGuidesDisposable=t,this._onDidChangeActiveNodes(this.activeNodes.elements)}}}typeof i.hideTwistiesOfChildlessElements<"u"&&(this.hideTwistiesOfChildlessElements=i.hideTwistiesOfChildlessElements),typeof i.twistieAdditionalCssClass<"u"&&(this.twistieAdditionalCssClass=i.twistieAdditionalCssClass)}renderTemplate(i){let e=R(i,_(".monaco-tl-row")),t=R(e,_(".monaco-tl-indent")),o=R(e,_(".monaco-tl-twistie")),n=R(e,_(".monaco-tl-contents")),r=this.renderer.renderTemplate(n);return{container:i,indent:t,twistie:o,indentGuidesDisposable:C.None,indentSize:0,templateData:r}}renderElement(i,e,t,o){t.indentSize=this.defaultIndent+(i.depth-1)*this.indent,this.renderedNodes.set(i,t),this.renderedElements.set(i.element,i),this.renderTreeElement(i,t),this.renderer.renderElement(i,e,t.templateData,{...o,indent:t.indentSize})}disposeElement(i,e,t,o){t.indentGuidesDisposable.dispose(),this.renderer.disposeElement?.(i,e,t.templateData,{...o,indent:t.indentSize}),typeof o?.height=="number"&&(this.renderedNodes.delete(i),this.renderedElements.delete(i.element))}disposeTemplate(i){this.renderer.disposeTemplate(i.templateData)}onDidChangeTwistieState(i){let e=this.renderedElements.get(i);e&&this.onDidChangeNodeTwistieState(e)}onDidChangeNodeTwistieState(i){let e=this.renderedNodes.get(i);e&&(this._onDidChangeActiveNodes(this.activeNodes.elements),this.renderTreeElement(i,e))}renderTreeElement(i,e){e.twistie.className=e.twistie.classList.item(0),e.twistie.style.paddingLeft=`${e.indentSize}px`,e.indent.style.width=`${e.indentSize+this.indent-16}px`,i.collapsible?e.container.setAttribute("aria-expanded",String(!i.collapsed)):e.container.removeAttribute("aria-expanded"),e.twistie.classList.remove(...q.asClassNameArray(M.treeItemExpanded));let t=!1;if(this.renderer.renderTwistie&&(t=this.renderer.renderTwistie(i.element,e.twistie)),i.collapsible&&(!this.hideTwistiesOfChildlessElements||i.visibleChildrenCount>0)?(t||e.twistie.classList.add(...q.asClassNameArray(M.treeItemExpanded)),e.twistie.classList.add("collapsible"),e.twistie.classList.toggle("collapsed",i.collapsed)):e.twistie.classList.remove("collapsible","collapsed"),this.twistieAdditionalCssClass){let o=this.twistieAdditionalCssClass(i.element);o&&e.twistie.classList.add(o)}this._renderIndentGuides(i,e)}_renderIndentGuides(i,e){if(Rt(e.indent),e.indentGuidesDisposable.dispose(),!this.shouldRenderIndentGuides)return;let t=new P;for(;;){let o=this.model.getNodeLocation(i),n=this.model.getParentNodeLocation(o);if(!n)break;let r=this.model.getNode(n),s=_(".indent-guide",{style:`width: ${this.indent}px`});this.activeIndentNodes.has(r)&&s.classList.add("active"),e.indent.childElementCount===0?e.indent.appendChild(s):e.indent.insertBefore(s,e.indent.firstElementChild),this.renderedIndentGuides.add(r,s),t.add(Z(()=>this.renderedIndentGuides.delete(r,s))),i=r}e.indentGuidesDisposable=t}_onDidChangeActiveNodes(i){if(!this.shouldRenderIndentGuides)return;let e=new Set;i.forEach(t=>{let o=this.model.getNodeLocation(t);try{let n=this.model.getParentNodeLocation(o);t.collapsible&&t.children.length>0&&!t.collapsed?e.add(t):n&&e.add(this.model.getNode(n))}catch{}}),this.activeIndentNodes.forEach(t=>{e.has(t)||this.renderedIndentGuides.forEach(t,o=>o.classList.remove("active"))}),e.forEach(t=>{this.activeIndentNodes.has(t)||this.renderedIndentGuides.forEach(t,o=>o.classList.add("active"))}),this.activeIndentNodes=e}dispose(){this.renderedNodes.clear(),this.renderedElements.clear(),this.indentGuidesDisposable.dispose(),Ue(this.disposables)}};function yWo(a,i){let e=i.toLowerCase().indexOf(a),t;if(e>-1){t=[Number.MAX_SAFE_INTEGER,0];for(let o=a.length;o>0;o--)t.push(e+o-1)}return t}var N5e=class{constructor(i,e,t){this._keyboardNavigationLabelProvider=i;this._filter=e;this._defaultFindVisibility=t;this._totalCount=0;this._matchCount=0;this._findMatchType=0;this._findMode=0;this._pattern="";this._lowercasePattern="";this.disposables=new P}get totalCount(){return this._totalCount}get matchCount(){return this._matchCount}set findMatchType(i){this._findMatchType=i}get findMatchType(){return this._findMatchType}set findMode(i){this._findMode=i}get findMode(){return this._findMode}set pattern(i){this._pattern=i,this._lowercasePattern=i.toLowerCase()}filter(i,e){let t=1;if(this._filter){let r=this._filter.filter(i,e);if(typeof r=="boolean"?t=r?1:0:k7(r)?t=N1(r.visibility):t=r,t===0)return!1}if(this._totalCount++,!this._pattern)return this._matchCount++,{data:uv.Default,visibility:t};let o=this._keyboardNavigationLabelProvider.getKeyboardNavigationLabel(i),n=Array.isArray(o)?o:[o];for(let r of n){let s=r&&r.toString();if(typeof s>"u")return{data:uv.Default,visibility:t};let l;if(this._findMatchType===1?l=yWo(this._lowercasePattern,s.toLowerCase()):l=wL(this._pattern,this._lowercasePattern,0,s,s.toLowerCase(),0,{firstMatchCanBeWeak:!0,boostFullMatch:!0}),l)return this._matchCount++,n.length===1?{data:l,visibility:t}:{data:{label:s,score:l},visibility:t}}return this._findMode===1?typeof this._defaultFindVisibility=="number"?this._defaultFindVisibility:this._defaultFindVisibility?this._defaultFindVisibility(i):2:{data:uv.Default,visibility:t}}reset(){this._totalCount=0,this._matchCount=0}dispose(){Ue(this.disposables)}},zoi=class extends Kh{constructor(i,e,t){super({icon:i.icon,title:i.title,isChecked:i.isChecked,inputActiveOptionBorder:e.inputActiveOptionBorder,inputActiveOptionForeground:e.inputActiveOptionForeground,inputActiveOptionBackground:e.inputActiveOptionBackground,hoverLifecycleOptions:t}),this.id=i.id}},Koi=class{constructor(i){this.stateMap=new Map(i.map(e=>[e.id,{...e}]))}states(){return Array.from(this.stateMap.values())}get(i){let e=this.stateMap.get(i);if(e===void 0)throw new Error(`No state found for toggle id ${i}`);return e.isChecked}set(i,e){let t=this.stateMap.get(i);if(t===void 0)throw new Error(`No state found for toggle id ${i}`);return t.isChecked===e?!1:(t.isChecked=e,!0)}},wWo={inputBoxStyles:P3i,toggleStyles:b7,listFilterWidgetBackground:void 0,listFilterWidgetNoMatchesOutline:void 0,listFilterWidgetOutline:void 0,listFilterWidgetShadow:void 0};var Goi=class extends C{constructor(e,t,o,n,r=[],s){super();this.tree=t;this.elements=bt(".monaco-tree-type-filter",[bt(".monaco-tree-type-filter-input@findInput"),bt(".monaco-tree-type-filter-actionbar@actionbar")]);this.toggles=[];this._onDidDisable=this._register(new E);this.onDidDisable=this._onDidDisable.event;e.appendChild(this.elements.root),this._register(Z(()=>this.elements.root.remove()));let l=s?.styles??wWo;l.listFilterWidgetBackground&&(this.elements.root.style.backgroundColor=l.listFilterWidgetBackground),l.listFilterWidgetShadow&&(this.elements.root.style.boxShadow=`0 0 8px 2px ${l.listFilterWidgetShadow}`);let c={groupId:"abstract-tree"};this.toggles=r.map(f=>this._register(new zoi(f,l.toggleStyles,c))),this.onDidToggleChange=H.any(...this.toggles.map(f=>H.map(f.onChange,()=>({id:f.id,isChecked:f.checked}))));let u=s?.history||[];this.findInput=this._register(new _1(this.elements.findInput,o,{label:d(42,null),placeholder:n,additionalToggles:this.toggles,showCommonFindToggles:!1,inputBoxStyles:l.inputBoxStyles,toggleStyles:l.toggleStyles,history:new Set(u),hoverLifecycleOptions:c})),this.actionbar=this._register(new ji(this.elements.actionbar));let p=this._register(new On(this.findInput.inputBox.inputElement,"keydown")),h=H.chain(p.event,f=>f.map(v=>new Ii(v)));this._register(h(f=>{if(f.equals(3)){f.preventDefault(),f.stopPropagation(),this.findInput.inputBox.addToHistory(),this.tree.domFocus();return}if(f.equals(18)){f.preventDefault(),f.stopPropagation(),this.findInput.inputBox.isAtLastInHistory()||this.findInput.inputBox.isNowhereInHistory()?(this.findInput.inputBox.addToHistory(),this.tree.domFocus()):this.findInput.inputBox.showNextValue();return}if(f.equals(16)){f.preventDefault(),f.stopPropagation(),this.findInput.inputBox.showPreviousValue();return}}));let g=this._register(new st("close",d(33,null),"codicon codicon-close",!0,()=>this.dispose()));this.actionbar.push(g,{icon:!0,label:!1}),this.onDidChangeValue=this.findInput.onDidChange}get value(){return this.findInput.inputBox.value}set value(e){this.findInput.inputBox.value=e}setToggleState(e,t){let o=this.toggles.find(n=>n.id===e);o&&(o.checked=t)}setPlaceHolder(e){this.findInput.inputBox.setPlaceHolder(e)}getHistory(){return this.findInput.inputBox.getHistory()}focus(){this.findInput.focus()}select(){this.findInput.select(),this.findInput.inputBox.addToHistory(!0)}showMessage(e){this.findInput.showMessage(e)}clearMessage(){this.findInput.clearMessage()}async dispose(){this._onDidDisable.fire(),this.elements.root.classList.add("disabled"),await Pi(300),super.dispose()}};var $oi=class{constructor(i,e,t,o={}){this.tree=i;this.filter=e;this.contextViewProvider=t;this.options=o;this._pattern="";this.previousPattern="";this._onDidChangePattern=new E;this.onDidChangePattern=this._onDidChangePattern.event;this._onDidChangeOpenState=new E;this.onDidChangeOpenState=this._onDidChangeOpenState.event;this.enabledDisposables=new P;this.disposables=new P;this.toggles=new Koi(o.toggles??[]),this._placeholder=o.placeholder??d(42,null)}get pattern(){return this._pattern}get placeholder(){return this._placeholder}set placeholder(i){this._placeholder=i,this.widget?.setPlaceHolder(i)}isOpened(){return!!this.widget}open(){if(this.widget){this.widget.focus(),this.widget.select();return}this.tree.updateOptions({paddingTop:30}),this.widget=new Goi(this.tree.getHTMLElement(),this.tree,this.contextViewProvider,this.placeholder,this.toggles.states(),{...this.options,history:this._history}),this.enabledDisposables.add(this.widget),this.widget.onDidChangeValue(this.onDidChangeValue,this,this.enabledDisposables),this.widget.onDidDisable(this.close,this,this.enabledDisposables),this.widget.onDidToggleChange(this.onDidToggleChange,this,this.enabledDisposables),this.widget.focus(),this.widget.value=this.previousPattern,this.widget.select(),this._onDidChangeOpenState.fire(!0)}close(){this.widget&&(this.tree.updateOptions({paddingTop:0}),this._history=this.widget.getHistory(),this.widget=void 0,this.enabledDisposables.clear(),this.previousPattern=this.pattern,this.onDidChangeValue(""),this.tree.domFocus(),this._onDidChangeOpenState.fire(!1))}onDidChangeValue(i){this._pattern=i,this._onDidChangePattern.fire(i),this.filter.pattern=i,this.applyPattern(i)}onDidToggleChange(i){this.toggles.set(i.id,i.isChecked)}updateToggleState(i,e){this.toggles.set(i,e),this.widget?.setToggleState(i,e)}renderMessage(i,e){i?this.tree.options.showNotFoundMessage??!0?this.widget?.showMessage({type:2,content:e??d(37,null)}):this.widget?.showMessage({type:2}):this.widget?.clearMessage()}alertResults(i){i?Jo(d(35,null,i)):Jo(d(38,null))}dispose(){this._history=void 0,this._onDidChangePattern.dispose(),this.enabledDisposables.dispose(),this.disposables.dispose()}},O5e=class extends $oi{constructor(e,t,o,n={}){let r=n.defaultFindMode??0,s=n.defaultFindMatchType??0,l=[{id:"mode",icon:M.listFilter,title:d(34,null),isChecked:r===1},{id:"matchType",icon:M.searchFuzzy,title:d(36,null),isChecked:s===0}];t.findMatchType=s,t.findMode=r;super(e,t,o,{...n,toggles:l});this.filter=t;this._onDidChangeMode=new E;this.onDidChangeMode=this._onDidChangeMode.event;this._onDidChangeMatchType=new E;this.onDidChangeMatchType=this._onDidChangeMatchType.event;this.disposables.add(this.tree.onDidChangeModel(()=>{this.isOpened()&&(this.pattern.length!==0&&this.tree.refilter(),this.render())})),this.disposables.add(this.tree.onWillRefilter(()=>this.filter.reset()))}get mode(){return this.toggles.get("mode")?1:0}set mode(e){if(e===this.mode)return;let t=e===1;this.updateToggleState("mode",t),this.placeholder=t?d(41,null):d(42,null),this.filter.findMode=e,this.tree.refilter(),this.render(),this._onDidChangeMode.fire(e)}get matchType(){return this.toggles.get("matchType")?0:1}set matchType(e){e!==this.matchType&&(this.updateToggleState("matchType",e===0),this.filter.findMatchType=e,this.tree.refilter(),this.render(),this._onDidChangeMatchType.fire(e))}updateOptions(e={}){e.defaultFindMode!==void 0&&(this.mode=e.defaultFindMode),e.defaultFindMatchType!==void 0&&(this.matchType=e.defaultFindMatchType)}applyPattern(e){this.tree.refilter(),e&&this.tree.focusNext(0,!0,void 0,o=>!uv.isDefault(o.filterData));let t=this.tree.getFocus();if(t.length>0){let o=t[0];this.tree.getRelativeTop(o)===null&&this.tree.reveal(o,.5)}this.render()}shouldAllowFocus(e){return!this.isOpened()||!this.pattern||this.filter.totalCount>0&&this.filter.matchCount<=1?!0:!uv.isDefault(e.filterData)}onDidToggleChange(e){e.id==="mode"?this.mode=e.isChecked?1:0:e.id==="matchType"&&(this.matchType=e.isChecked?0:1)}render(){let t=this.filter.matchCount===0&&this.filter.totalCount>0&&this.pattern.length>0;this.renderMessage(t),this.pattern.length&&this.alertResults(this.filter.matchCount)}};function CWo(a,i){return a.position===i.position&&Y3i(a,i)}function Y3i(a,i){return a.node.element===i.node.element&&a.startIndex===i.startIndex&&a.height===i.height&&a.endIndex===i.endIndex}var qoi=class{constructor(i=[]){this.stickyNodes=i}get count(){return this.stickyNodes.length}equal(i){return $i(this.stickyNodes,i.stickyNodes,CWo)}contains(i){return this.stickyNodes.some(e=>e.node.element===i.element)}lastNodePartiallyVisible(){if(this.count===0)return!1;let i=this.stickyNodes[this.count-1];if(this.count===1)return i.position!==0;let e=this.stickyNodes[this.count-2];return e.position+e.height!==i.position}animationStateChanged(i){if(!$i(this.stickyNodes,i.stickyNodes,Y3i)||this.count===0)return!1;let e=this.stickyNodes[this.count-1],t=i.stickyNodes[i.count-1];return e.position!==t.position}},joi=class{constrainStickyScrollNodes(i,e,t){for(let o=0;o<i.length;o++){let n=i[o];if(n.position+n.height>t||o>=e)return i.slice(0,o)}return i}},gyt=class extends C{constructor(e,t,o,n,r,s={}){super();this.tree=e;this.model=t;this.view=o;this.treeDelegate=r;this.maxWidgetViewRatio=.4;let l=this.validateStickySettings(s);this.stickyScrollMaxItemCount=l.stickyScrollMaxItemCount,this.stickyScrollDelegate=s.stickyScrollDelegate??new joi,this.paddingTop=s.paddingTop??0,this._widget=this._register(new Qoi(o.getScrollableElement(),o,e,n,r,s.accessibilityProvider)),this.onDidChangeHasFocus=this._widget.onDidChangeHasFocus,this.onContextMenu=this._widget.onContextMenu,this._register(o.onDidScroll(()=>this.update())),this._register(o.onDidChangeContentHeight(()=>this.update())),this._register(e.onDidChangeCollapseState(()=>this.update())),this._register(t.onDidSpliceRenderedNodes(c=>{let u=this._widget.state;if(!u)return;if(c.deleteCount>0&&u.stickyNodes.some(g=>!this.model.has(this.model.getNodeLocation(g.node)))){this.update();return}u.stickyNodes.some(g=>{let f=this.model.getListIndex(this.model.getNodeLocation(g.node));return f>=c.start&&f<c.start+c.deleteCount&&u.contains(g.node)})&&this._widget.rerender()})),this.update()}get height(){return this._widget.height}get count(){return this._widget.count}getNode(e){return this._widget.getNode(e)}getNodeAtHeight(e){let t;if(e===0?t=this.view.firstVisibleIndex:t=this.view.indexAt(e+this.view.scrollTop),!(t<0||t>=this.view.length))return this.view.element(t)}update(){let e=this.getNodeAtHeight(this.paddingTop);if(!e||this.tree.scrollTop<=this.paddingTop||this.view.renderHeight===0){this._widget.setState(void 0);return}let t=this.findStickyState(e);this._widget.setState(t)}findStickyState(e){let t=[],o=e,n=0,r=this.getNextStickyNode(o,void 0,n);for(;r&&(t.push(r),n+=r.height,!(t.length<=this.stickyScrollMaxItemCount&&(o=this.getNextVisibleNode(r),!o)));)r=this.getNextStickyNode(o,r.node,n);let s=this.constrainStickyNodes(t);return s.length?new qoi(s):void 0}getNextVisibleNode(e){return this.getNodeAtHeight(e.position+e.height)}getNextStickyNode(e,t,o){let n=this.getAncestorUnderPrevious(e,t);if(n&&!(n===e&&(!this.nodeIsUncollapsedParent(e)||this.nodeTopAlignsWithStickyNodesBottom(e,o))))return this.createStickyScrollNode(n,o)}nodeTopAlignsWithStickyNodesBottom(e,t){let o=this.getNodeIndex(e),n=this.view.getElementTop(o),r=t;return this.view.scrollTop===n-r}createStickyScrollNode(e,t){let o=this.treeDelegate.getHeight(e),{startIndex:n,endIndex:r}=this.getNodeRange(e),s=this.calculateStickyNodePosition(r,t,o);return{node:e,position:s,height:o,startIndex:n,endIndex:r}}getAncestorUnderPrevious(e,t=void 0){let o=e,n=this.getParentNode(o);for(;n;){if(n===t)return o;o=n,n=this.getParentNode(o)}if(t===void 0)return o}calculateStickyNodePosition(e,t,o){let n=this.view.getRelativeTop(e);if(n===null&&this.view.firstVisibleIndex===e&&e+1<this.view.length){let u=this.treeDelegate.getHeight(this.view.element(e)),p=this.view.getRelativeTop(e+1);n=p?p-u/this.view.renderHeight:null}if(n===null)return t;let r=this.view.element(e),s=this.treeDelegate.getHeight(r),c=n*this.view.renderHeight+s;return t+o>c&&t<=c?c-o:t}constrainStickyNodes(e){if(e.length===0)return[];let t=this.view.renderHeight*this.maxWidgetViewRatio,o=e[e.length-1];if(e.length<=this.stickyScrollMaxItemCount&&o.position+o.height<=t)return e;let n=this.stickyScrollDelegate.constrainStickyScrollNodes(e,this.stickyScrollMaxItemCount,t);if(!n.length)return[];let r=n[n.length-1];if(n.length>this.stickyScrollMaxItemCount||r.position+r.height>t)throw new Error("stickyScrollDelegate violates constraints");return n}getParentNode(e){let t=this.model.getNodeLocation(e),o=this.model.getParentNodeLocation(t);return o?this.model.getNode(o):void 0}nodeIsUncollapsedParent(e){let t=this.model.getNodeLocation(e);return this.model.getListRenderCount(t)>1}getNodeIndex(e){let t=this.model.getNodeLocation(e);return this.model.getListIndex(t)}getNodeRange(e){let t=this.model.getNodeLocation(e),o=this.model.getListIndex(t);if(o<0)throw new Error("Node not found in tree");let n=this.model.getListRenderCount(t),r=o+n-1;return{startIndex:o,endIndex:r}}nodePositionTopBelowWidget(e){let t=[],o=this.getParentNode(e);for(;o;)t.push(o),o=this.getParentNode(o);let n=0;for(let r=0;r<t.length&&r<this.stickyScrollMaxItemCount;r++)n+=this.treeDelegate.getHeight(t[r]);return n}getFocus(){return this._widget.getFocus()}domFocus(){this._widget.domFocus()}focusedLast(){return this._widget.focusedLast()}updateOptions(e={}){if(e.paddingTop!==void 0&&(this.paddingTop=e.paddingTop),e.stickyScrollMaxItemCount!==void 0){let t=this.validateStickySettings(e);this.stickyScrollMaxItemCount!==t.stickyScrollMaxItemCount&&(this.stickyScrollMaxItemCount=t.stickyScrollMaxItemCount,this.update())}}validateStickySettings(e){let t=7;return typeof e.stickyScrollMaxItemCount=="number"&&(t=Math.max(e.stickyScrollMaxItemCount,1)),{stickyScrollMaxItemCount:t}}},Qoi=class{constructor(i,e,t,o,n,r){this.view=e;this.tree=t;this.treeRenderers=o;this.treeDelegate=n;this.accessibilityProvider=r;this._previousElements=[];this._previousStateDisposables=new P;this._rootDomNode=_(".monaco-tree-sticky-container.empty"),i.appendChild(this._rootDomNode);let s=_(".monaco-tree-sticky-container-shadow");this._rootDomNode.appendChild(s),this.stickyScrollFocus=new Yoi(this._rootDomNode,e),this.onDidChangeHasFocus=this.stickyScrollFocus.onDidChangeHasFocus,this.onContextMenu=this.stickyScrollFocus.onContextMenu}get state(){return this._previousState}get height(){if(!this._previousState)return 0;let i=this._previousState.stickyNodes[this._previousState.count-1];return i.position+i.height}get count(){return this._previousState?.count??0}getNode(i){return this._previousState?.stickyNodes.find(e=>e.node===i)}setState(i){let e=!!this._previousState&&this._previousState.count>0,t=!!i&&i.count>0;if(!e&&!t||e&&t&&this._previousState.equal(i))return;if(e!==t&&this.setVisible(t),!t){this._previousState=void 0,this._previousElements=[],this._previousStateDisposables.clear();return}let o=i.stickyNodes[i.count-1];this._previousState&&i.animationStateChanged(this._previousState)?this._previousElements[this._previousState.count-1].style.top=`${o.position}px`:this.renderState(i),this._previousState=i,this._rootDomNode.style.height=`${o.position+o.height}px`}renderState(i){this._previousStateDisposables.clear();let e=Array(i.count);for(let t=i.count-1;t>=0;t--){let o=i.stickyNodes[t],{element:n,disposable:r}=this.createElement(o,t,i.count);e[t]=n,this._rootDomNode.appendChild(n),this._previousStateDisposables.add(r)}this.stickyScrollFocus.updateElements(e,i),this._previousElements=e}rerender(){this._previousState&&this.renderState(this._previousState)}createElement(i,e,t){let o=i.startIndex,n=document.createElement("div");n.style.top=`${i.position}px`,this.tree.options.setRowHeight!==!1&&(n.style.height=`${i.height}px`),this.tree.options.setRowLineHeight!==!1&&(n.style.lineHeight=`${i.height}px`),n.classList.add("monaco-tree-sticky-row"),n.classList.add("monaco-list-row"),n.setAttribute("data-index",`${o}`),n.setAttribute("data-parity",o%2===0?"even":"odd"),n.setAttribute("id",this.view.getElementID(o));let r=this.setAccessibilityAttributes(n,i.node.element,e,t),s=this.treeDelegate.getTemplateId(i.node),l=this.treeRenderers.find(h=>h.templateId===s);if(!l)throw new Error(`No renderer found for template id ${s}`);let c=i.node;c===this.tree.getNode(this.tree.getNodeLocation(i.node))&&(c=new Proxy(i.node,{}));let u=l.renderTemplate(n);l.renderElement(c,i.startIndex,u,{height:i.height});let p=Z(()=>{r.dispose(),l.disposeElement(c,i.startIndex,u,{height:i.height}),l.disposeTemplate(u),n.remove()});return{element:n,disposable:p}}setAccessibilityAttributes(i,e,t,o){if(!this.accessibilityProvider)return C.None;this.accessibilityProvider.getSetSize&&i.setAttribute("aria-setsize",String(this.accessibilityProvider.getSetSize(e,t,o))),this.accessibilityProvider.getPosInSet&&i.setAttribute("aria-posinset",String(this.accessibilityProvider.getPosInSet(e,t))),this.accessibilityProvider.getRole&&i.setAttribute("role",this.accessibilityProvider.getRole(e)??"treeitem");let n=this.accessibilityProvider.getAriaLabel(e),r=n&&typeof n!="string"?n:Oo(n),s=he(c=>{let u=c.readObservable(r);u?i.setAttribute("aria-label",u):i.removeAttribute("aria-label")});typeof n=="string"||n&&i.setAttribute("aria-label",n.get());let l=this.accessibilityProvider.getAriaLevel&&this.accessibilityProvider.getAriaLevel(e);return typeof l=="number"&&i.setAttribute("aria-level",`${l}`),i.setAttribute("aria-selected",String(!1)),s}setVisible(i){this._rootDomNode.classList.toggle("empty",!i),i||this.stickyScrollFocus.updateElements([],void 0)}getFocus(){return this.stickyScrollFocus.getFocus()}domFocus(){this.stickyScrollFocus.domFocus()}focusedLast(){return this.stickyScrollFocus.focusedLast()}dispose(){this.stickyScrollFocus.dispose(),this._previousStateDisposables.dispose(),this._rootDomNode.remove()}},Yoi=class extends C{constructor(e,t){super();this.container=e;this.view=t;this.focusedIndex=-1;this.elements=[];this._onDidChangeHasFocus=this._register(new E);this.onDidChangeHasFocus=this._onDidChangeHasFocus.event;this._onContextMenu=this._register(new E);this.onContextMenu=this._onContextMenu.event;this._domHasFocus=!1;this._register(j(this.container,"focus",()=>this.onFocus())),this._register(j(this.container,"blur",()=>this.onBlur())),this._register(this.view.onDidFocus(()=>this.toggleStickyScrollFocused(!1))),this._register(this.view.onKeyDown(o=>this.onKeyDown(o))),this._register(this.view.onMouseDown(o=>this.onMouseDown(o))),this._register(this.view.onContextMenu(o=>this.handleContextMenu(o)))}get domHasFocus(){return this._domHasFocus}set domHasFocus(e){e!==this._domHasFocus&&(this._onDidChangeHasFocus.fire(e),this._domHasFocus=e)}handleContextMenu(e){let t=e.browserEvent.target;if(!Pye(t)&&!Mye(t)){this.focusedLast()&&this.view.domFocus();return}if(!ag(e.browserEvent)){if(!this.state)throw new Error("Context menu should not be triggered when state is undefined");let s=this.state.stickyNodes.findIndex(l=>l.node.element===e.element?.element);if(s===-1)throw new Error("Context menu should not be triggered when element is not in sticky scroll widget");this.container.focus(),this.setFocus(s);return}if(!this.state||this.focusedIndex<0)throw new Error("Context menu key should not be triggered when focus is not in sticky scroll widget");let n=this.state.stickyNodes[this.focusedIndex].node.element,r=this.elements[this.focusedIndex];this._onContextMenu.fire({element:n,anchor:r,browserEvent:e.browserEvent,isStickyScroll:!0})}onKeyDown(e){if(this.domHasFocus&&this.state){if(e.key==="ArrowUp")this.setFocusedElement(Math.max(0,this.focusedIndex-1)),e.preventDefault(),e.stopPropagation();else if(e.key==="ArrowDown"||e.key==="ArrowRight"){if(this.focusedIndex>=this.state.count-1){let t=this.state.stickyNodes[this.state.count-1].startIndex+1;this.view.domFocus(),this.view.setFocus([t]),this.scrollNodeUnderWidget(t,this.state)}else this.setFocusedElement(this.focusedIndex+1);e.preventDefault(),e.stopPropagation()}}}onMouseDown(e){let t=e.browserEvent.target;!Pye(t)&&!Mye(t)||(e.browserEvent.preventDefault(),e.browserEvent.stopPropagation())}updateElements(e,t){if(t&&t.count===0)throw new Error("Sticky scroll state must be undefined when there are no sticky nodes");if(t&&t.count!==e.length)throw new Error("Sticky scroll focus received illigel state");let o=this.focusedIndex;if(this.removeFocus(),this.elements=e,this.state=t,t){let n=Kn(o,0,t.count-1);this.setFocus(n)}else this.domHasFocus&&this.view.domFocus();this.container.tabIndex=t?0:-1}setFocusedElement(e){let t=this.state;if(!t)throw new Error("Cannot set focus when state is undefined");if(this.setFocus(e),!(e<t.count-1)&&t.lastNodePartiallyVisible()){let o=t.stickyNodes[e];this.scrollNodeUnderWidget(o.endIndex+1,t)}}scrollNodeUnderWidget(e,t){let o=t.stickyNodes[t.count-1],n=t.count>1?t.stickyNodes[t.count-2]:void 0,r=this.view.getElementTop(e),s=n?n.position+n.height+o.height:o.height;this.view.scrollTop=r-s}getFocus(){if(!(!this.state||this.focusedIndex===-1))return this.state.stickyNodes[this.focusedIndex].node.element}domFocus(){if(!this.state)throw new Error("Cannot focus when state is undefined");this.container.focus()}focusedLast(){return this.state?this.view.getHTMLElement().classList.contains("sticky-scroll-focused"):!1}removeFocus(){this.focusedIndex!==-1&&(this.toggleElementFocus(this.elements[this.focusedIndex],!1),this.focusedIndex=-1)}setFocus(e){if(0>e)throw new Error("addFocus() can not remove focus");if(!this.state&&e>=0)throw new Error("Cannot set focus index when state is undefined");if(this.state&&e>=this.state.count)throw new Error("Cannot set focus index to an index that does not exist");let t=this.focusedIndex;t>=0&&this.toggleElementFocus(this.elements[t],!1),e>=0&&this.toggleElementFocus(this.elements[e],!0),this.focusedIndex=e}toggleElementFocus(e,t){this.toggleElementActiveFocus(e,t&&this.domHasFocus),this.toggleElementPassiveFocus(e,t)}toggleCurrentElementActiveFocus(e){this.focusedIndex!==-1&&this.toggleElementActiveFocus(this.elements[this.focusedIndex],e)}toggleElementActiveFocus(e,t){e.classList.toggle("focused",t)}toggleElementPassiveFocus(e,t){e.classList.toggle("passive-focused",t)}toggleStickyScrollFocused(e){this.view.getHTMLElement().classList.toggle("sticky-scroll-focused",e)}onFocus(){if(!this.state||this.elements.length===0)throw new Error("Cannot focus when state is undefined or elements are empty");this.domHasFocus=!0,this.toggleStickyScrollFocused(!0),this.toggleCurrentElementActiveFocus(!0),this.focusedIndex===-1&&this.setFocus(0)}onBlur(){this.domHasFocus=!1,this.toggleCurrentElementActiveFocus(!1)}dispose(){this.toggleStickyScrollFocused(!1),this._onDidChangeHasFocus.fire(!1),super.dispose()}};function Yae(a){let i=0;return Qbe(a.browserEvent.target,"monaco-tl-twistie","monaco-tl-row")?i=1:Qbe(a.browserEvent.target,"monaco-tl-contents","monaco-tl-row")?i=2:Qbe(a.browserEvent.target,"monaco-tree-type-filter","monaco-list")&&(i=3),{browserEvent:a.browserEvent,element:a.element?a.element.element:null,target:i}}function xWo(a){let i=Pye(a.browserEvent.target);return{element:a.element?a.element.element:null,browserEvent:a.browserEvent,anchor:a.anchor,isStickyScroll:i}}function hyt(a,i){i(a),a.children.forEach(e=>hyt(e,i))}var P5e=class{constructor(i,e){this.getFirstViewElementWithTrait=i;this.identityProvider=e;this.nodes=[];this._onDidChange=new E;this.onDidChange=this._onDidChange.event}get nodeSet(){return this._nodeSet||(this._nodeSet=this.createNodeSet()),this._nodeSet}set(i,e){!e?.__forceEvent&&$i(this.nodes,i)||this._set(i,!1,e)}_set(i,e,t){if(this.nodes=[...i],this.elements=void 0,this._nodeSet=void 0,!e){let o=this;this._onDidChange.fire({get elements(){return o.get()},browserEvent:t})}}get(){return this.elements||(this.elements=this.nodes.map(i=>i.element)),[...this.elements]}getNodes(){return this.nodes}has(i){return this.nodeSet.has(i)}onDidModelSplice({insertedNodes:i,deletedNodes:e}){if(!this.identityProvider){let l=this.createNodeSet(),c=u=>l.delete(u);e.forEach(u=>hyt(u,c)),this.set([...l.values()]);return}let t=new Set,o=l=>t.add(this.identityProvider.getId(l.element).toString());e.forEach(l=>hyt(l,o));let n=new Map,r=l=>n.set(this.identityProvider.getId(l.element).toString(),l);i.forEach(l=>hyt(l,r));let s=[];for(let l of this.nodes){let c=this.identityProvider.getId(l.element).toString();if(!t.has(c))s.push(l);else{let p=n.get(c);p&&p.visible&&s.push(p)}}if(this.nodes.length>0&&s.length===0){let l=this.getFirstViewElementWithTrait();l&&s.push(l)}this._set(s,!0)}createNodeSet(){let i=new Set;for(let e of this.nodes)i.add(e);return i}},Xoi=class extends gae{constructor(e,t,o){super(e);this.tree=t;this.stickyScrollProvider=o}onViewPointer(e){if(lti(e.browserEvent.target)||Oh(e.browserEvent.target)||G9(e.browserEvent.target)||e.browserEvent.isHandledByList)return;let t=e.element;if(!t)return super.onViewPointer(e);if(this.isSelectionRangeChangeEvent(e)||this.isSelectionSingleChangeEvent(e))return super.onViewPointer(e);let o=e.browserEvent.target,n=o.classList.contains("monaco-tl-twistie")||o.classList.contains("monaco-icon-label")&&o.classList.contains("folder-icon")&&e.browserEvent.offsetX<16,r=Mye(e.browserEvent.target),s=!1;if(r?s=!0:typeof this.tree.expandOnlyOnTwistieClick=="function"?s=this.tree.expandOnlyOnTwistieClick(t.element):s=!!this.tree.expandOnlyOnTwistieClick,r)this.handleStickyScrollMouseEvent(e,t);else{if(s&&!n&&e.browserEvent.detail!==2)return super.onViewPointer(e);if(!this.tree.expandOnDoubleClick&&e.browserEvent.detail===2)return super.onViewPointer(e)}if(t.collapsible&&(!r||n)){let l=this.tree.getNodeLocation(t),c=e.browserEvent.altKey;if(this.tree.setFocus([l]),this.tree.toggleCollapsed(l,c),n){e.browserEvent.isHandledByList=!0;return}}r||super.onViewPointer(e)}handleStickyScrollMouseEvent(e,t){if(e5i(e.browserEvent.target)||t5i(e.browserEvent.target))return;let o=this.stickyScrollProvider();if(!o)throw new Error("Sticky scroll controller not found");let n=this.list.indexOf(t),r=this.list.getElementTop(n),s=o.nodePositionTopBelowWidget(t);this.tree.scrollTop=r-s,this.list.domFocus(),this.list.setFocus([n]),this.list.setSelection([n])}onDoubleClick(e){e.browserEvent.target.classList.contains("monaco-tl-twistie")||!this.tree.expandOnDoubleClick||e.browserEvent.isHandledByList||super.onDoubleClick(e)}onMouseDown(e){let t=e.browserEvent.target;if(!Pye(t)&&!Mye(t)){super.onMouseDown(e);return}}onContextMenu(e){let t=e.browserEvent.target;if(!Pye(t)&&!Mye(t)){super.onContextMenu(e);return}}},Joi=class extends hc{constructor(e,t,o,n,r,s,l,c){super(e,t,o,n,c);this.focusTrait=r;this.selectionTrait=s;this.anchorTrait=l}createMouseController(e){return new Xoi(this,e.tree,e.stickyScrollProvider)}splice(e,t,o=[]){if(super.splice(e,t,o),o.length===0)return;let n=[],r=[],s;o.forEach((l,c)=>{this.focusTrait.has(l)&&n.push(e+c),this.selectionTrait.has(l)&&r.push(e+c),this.anchorTrait.has(l)&&(s=e+c)}),n.length>0&&super.setFocus(Uo([...super.getFocus(),...n])),r.length>0&&super.setSelection(Uo([...super.getSelection(),...r])),typeof s=="number"&&super.setAnchor(s)}setFocus(e,t,o=!1){super.setFocus(e,t),o||this.focusTrait.set(e.map(n=>this.element(n)),t)}setSelection(e,t,o=!1){super.setSelection(e,t),o||this.selectionTrait.set(e.map(n=>this.element(n)),t)}setAnchor(e,t=!1){super.setAnchor(e),t||(typeof e>"u"?this.anchorTrait.set([]):this.anchorTrait.set([this.element(e)]))}};var LW=class{constructor(i,e,t,o,n={}){this._user=i;this._options=n;this.eventBufferer=new eN;this.onDidChangeFindOpenState=H.None;this.onDidChangeStickyScrollFocused=H.None;this.disposables=new P;this.onDidSwapModel=this.disposables.add(new E);this.onDidChangeModelRelay=this.disposables.add(new Mh);this.onDidSpliceModelRelay=this.disposables.add(new Mh);this.onDidChangeCollapseStateRelay=this.disposables.add(new Mh);this.onDidChangeRenderNodeCountRelay=this.disposables.add(new Mh);this.onDidChangeActiveNodesRelay=this.disposables.add(new Mh);this._onWillRefilter=new E;this.onWillRefilter=this._onWillRefilter.event;this._onDidUpdateOptions=new E;this.onDidUpdateOptions=this._onDidUpdateOptions.event;this.modelDisposables=new P;n.keyboardNavigationLabelProvider&&(n.findWidgetEnabled??!0)&&(this.findFilter=new N5e(n.keyboardNavigationLabelProvider,n.filter,n.defaultFindVisibility),n={...n,filter:this.findFilter},this.disposables.add(this.findFilter)),this.model=this.createModel(i,n),this.treeDelegate=new Uwe(t);let r=this.disposables.add(new Hoi(this.onDidChangeActiveNodesRelay.event)),s=new KH;this.renderers=o.map(l=>new Uoi(l,this.model,this.onDidChangeCollapseStateRelay.event,r,s,n));for(let l of this.renderers)this.disposables.add(l);if(this.focus=new P5e(()=>this.view.getFocusedElements()[0],n.identityProvider),this.selection=new P5e(()=>this.view.getSelectedElements()[0],n.identityProvider),this.anchor=new P5e(()=>this.view.getAnchorElement(),n.identityProvider),this.view=new Joi(i,e,this.treeDelegate,this.renderers,this.focus,this.selection,this.anchor,{...IWo(()=>this.model,this.disposables,n),tree:this,stickyScrollProvider:()=>this.stickyScrollController}),this.setupModel(this.model),n.keyboardSupport!==!1){let l=H.chain(this.view.onKeyDown,c=>c.filter(u=>!Oh(u.target)).map(u=>new Ii(u)));H.chain(l,c=>c.filter(u=>u.keyCode===15))(this.onLeftArrow,this,this.disposables),H.chain(l,c=>c.filter(u=>u.keyCode===17))(this.onRightArrow,this,this.disposables),H.chain(l,c=>c.filter(u=>u.keyCode===10))(this.onSpace,this,this.disposables)}if((n.findWidgetEnabled??!0)&&n.keyboardNavigationLabelProvider&&n.contextViewProvider){let l={styles:n.findWidgetStyles,defaultFindMode:n.defaultFindMode,defaultFindMatchType:n.defaultFindMatchType,showNotFoundMessage:n.showNotFoundMessage};this.findController=this.disposables.add(new O5e(this,this.findFilter,n.contextViewProvider,l)),this.focusNavigationFilter=c=>this.findController.shouldAllowFocus(c),this.onDidChangeFindOpenState=this.findController.onDidChangeOpenState,this.onDidChangeFindMode=this.findController.onDidChangeMode,this.onDidChangeFindMatchType=this.findController.onDidChangeMatchType}else this.onDidChangeFindMode=H.None,this.onDidChangeFindMatchType=H.None;n.enableStickyScroll&&(this.stickyScrollController=new gyt(this,this.model,this.view,this.renderers,this.treeDelegate,n),this.onDidChangeStickyScrollFocused=this.stickyScrollController.onDidChangeHasFocus),this.styleElement=hr(this.view.getHTMLElement()),this.getHTMLElement().classList.toggle("always",this._options.renderIndentGuides==="always")}get onDidScroll(){return this.view.onDidScroll}get onDidChangeFocus(){return this.eventBufferer.wrapEvent(this.focus.onDidChange)}get onDidChangeSelection(){return this.eventBufferer.wrapEvent(this.selection.onDidChange)}get onMouseClick(){return H.map(this.view.onMouseClick,Yae)}get onMouseDblClick(){return H.filter(H.map(this.view.onMouseDblClick,Yae),i=>i.target!==3)}get onMouseMiddleClick(){return H.filter(H.map(this.view.onMouseMiddleClick,Yae),i=>i.target!==3)}get onMouseOver(){return H.map(this.view.onMouseOver,Yae)}get onMouseOut(){return H.map(this.view.onMouseOut,Yae)}get onContextMenu(){return H.any(H.filter(H.map(this.view.onContextMenu,xWo),i=>!i.isStickyScroll),this.stickyScrollController?.onContextMenu??H.None)}get onTap(){return H.map(this.view.onTap,Yae)}get onPointer(){return H.map(this.view.onPointer,Yae)}get onKeyDown(){return this.view.onKeyDown}get onKeyUp(){return this.view.onKeyUp}get onKeyPress(){return this.view.onKeyPress}get onDidFocus(){return this.view.onDidFocus}get onDidBlur(){return this.view.onDidBlur}get onDidChangeModel(){return H.any(this.onDidChangeModelRelay.event,this.onDidSwapModel.event)}get onDidChangeCollapseState(){return this.onDidChangeCollapseStateRelay.event}get onDidChangeRenderNodeCount(){return this.onDidChangeRenderNodeCountRelay.event}get findMode(){return this.findController?.mode??0}set findMode(i){this.findController&&(this.findController.mode=i)}get findMatchType(){return this.findController?.matchType??0}set findMatchType(i){this.findController&&(this.findController.matchType=i)}get onDidChangeFindPattern(){return this.findController?this.findController.onDidChangePattern:H.None}get expandOnDoubleClick(){return typeof this._options.expandOnDoubleClick>"u"?!0:this._options.expandOnDoubleClick}get expandOnlyOnTwistieClick(){return typeof this._options.expandOnlyOnTwistieClick>"u"?!0:this._options.expandOnlyOnTwistieClick}get onDidDispose(){return this.view.onDidDispose}updateOptions(i={}){this._options={...this._options,...i};for(let e of this.renderers)e.updateOptions(i);this.view.updateOptions(this._options),this.findController?.updateOptions(i),this.updateStickyScroll(i),this._onDidUpdateOptions.fire(this._options),this.getHTMLElement().classList.toggle("always",this._options.renderIndentGuides==="always")}get options(){return this._options}updateStickyScroll(i){!this.stickyScrollController&&this._options.enableStickyScroll?(this.stickyScrollController=new gyt(this,this.model,this.view,this.renderers,this.treeDelegate,this._options),this.onDidChangeStickyScrollFocused=this.stickyScrollController.onDidChangeHasFocus):this.stickyScrollController&&!this._options.enableStickyScroll&&(this.onDidChangeStickyScrollFocused=H.None,this.stickyScrollController.dispose(),this.stickyScrollController=void 0),this.stickyScrollController?.updateOptions(i)}updateWidth(i){let e=this.model.getListIndex(i);e!==-1&&this.view.updateWidth(e)}getHTMLElement(){return this.view.getHTMLElement()}get contentHeight(){return this.view.contentHeight}get contentWidth(){return this.view.contentWidth}get onDidChangeContentHeight(){return this.view.onDidChangeContentHeight}get onDidChangeContentWidth(){return this.view.onDidChangeContentWidth}get scrollTop(){return this.view.scrollTop}set scrollTop(i){this.view.scrollTop=i}get scrollLeft(){return this.view.scrollLeft}set scrollLeft(i){this.view.scrollLeft=i}get scrollHeight(){return this.view.scrollHeight}get renderHeight(){return this.view.renderHeight}get firstVisibleElement(){let i=this.view.firstVisibleIndex;return this.stickyScrollController&&(i+=this.stickyScrollController.count),i<0||i>=this.view.length?void 0:this.view.element(i).element}get lastVisibleElement(){let i=this.view.lastVisibleIndex;return this.view.element(i).element}get ariaLabel(){return this.view.ariaLabel}set ariaLabel(i){this.view.ariaLabel=i}get selectionSize(){return this.selection.getNodes().length}domFocus(){this.stickyScrollController?.focusedLast()?this.stickyScrollController.domFocus():this.view.domFocus()}isDOMFocused(){return sa(this.getHTMLElement())}layout(i,e){this.view.layout(i,e)}style(i){let e=`.${this.view.domId}`,t=[];i.treeIndentGuidesStroke&&(t.push(`.monaco-list${e}:hover .monaco-tl-indent > .indent-guide, .monaco-list${e}.always .monaco-tl-indent > .indent-guide { opacity: 1; border-color: ${i.treeInactiveIndentGuidesStroke}; }`),t.push(`.monaco-list${e} .monaco-tl-indent > .indent-guide.active { opacity: 1; border-color: ${i.treeIndentGuidesStroke}; }`));let o=i.treeStickyScrollBackground??i.listBackground;o&&(t.push(`.monaco-list${e} .monaco-scrollable-element .monaco-tree-sticky-container { background-color: ${o}; }`),t.push(`.monaco-list${e} .monaco-scrollable-element .monaco-tree-sticky-container .monaco-tree-sticky-row { background-color: ${o}; }`)),i.treeStickyScrollBorder&&t.push(`.monaco-list${e} .monaco-scrollable-element .monaco-tree-sticky-container { border-bottom: 1px solid ${i.treeStickyScrollBorder}; }`),i.treeStickyScrollShadow&&t.push(`.monaco-list${e} .monaco-scrollable-element .monaco-tree-sticky-container .monaco-tree-sticky-container-shadow { box-shadow: ${i.treeStickyScrollShadow} 0 6px 6px -6px inset; height: 3px; }`),i.listFocusForeground&&(t.push(`.monaco-list${e}.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container:focus .monaco-list-row.focused { color: ${i.listFocusForeground}; }`),t.push(`.monaco-list${e}:not(.sticky-scroll-focused) .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.focused { color: inherit; }`));let n=n_(i.listFocusAndSelectionOutline,n_(i.listSelectionOutline,i.listFocusOutline??""));n&&(t.push(`.monaco-list${e}.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container:focus .monaco-list-row.focused.selected { outline: 1px solid ${n}; outline-offset: -1px;}`),t.push(`.monaco-list${e}:not(.sticky-scroll-focused) .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.focused.selected { outline: inherit;}`)),i.listFocusOutline&&(t.push(`.monaco-list${e}.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container:focus .monaco-list-row.focused { outline: 1px solid ${i.listFocusOutline}; outline-offset: -1px; }`),t.push(`.monaco-list${e}:not(.sticky-scroll-focused) .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.focused { outline: inherit; }`),t.push(`.context-menu-visible .monaco-list${e}.last-focused.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.passive-focused { outline: 1px solid ${i.listFocusOutline}; outline-offset: -1px; }`),t.push(`.context-menu-visible .monaco-list${e}.last-focused.sticky-scroll-focused .monaco-list-rows .monaco-list-row.focused { outline: inherit; }`),t.push(`.context-menu-visible .monaco-list${e}.last-focused:not(.sticky-scroll-focused) .monaco-tree-sticky-container .monaco-list-rows .monaco-list-row.focused { outline: inherit; }`)),this.styleElement.textContent=t.join(`
`),this.view.style(i)}getParentElement(i){let e=this.model.getParentNodeLocation(i);return this.model.getNode(e).element}getFirstElementChild(i){return this.model.getFirstElementChild(i)}getNode(i){return this.model.getNode(i)}getNodeLocation(i){return this.model.getNodeLocation(i)}collapse(i,e=!1){return this.model.setCollapsed(i,!0,e)}expand(i,e=!1){return this.model.setCollapsed(i,!1,e)}toggleCollapsed(i,e=!1){return this.model.setCollapsed(i,void 0,e)}expandAll(){this.model.setCollapsed(this.model.rootRef,!1,!0)}collapseAll(){this.model.setCollapsed(this.model.rootRef,!0,!0)}isCollapsible(i){return this.model.isCollapsible(i)}setCollapsible(i,e){return this.model.setCollapsible(i,e)}isCollapsed(i){return this.model.isCollapsed(i)}expandTo(i){this.model.expandTo(i)}triggerTypeNavigation(){this.view.triggerTypeNavigation()}openFind(){this.findController?.open()}closeFind(){this.findController?.close()}refilter(){this._onWillRefilter.fire(void 0),this.model.refilter()}setAnchor(i){if(typeof i>"u")return this.view.setAnchor(void 0);this.eventBufferer.bufferEvents(()=>{let e=this.model.getNode(i);this.anchor.set([e]);let t=this.model.getListIndex(i);t>-1&&this.view.setAnchor(t,!0)})}getAnchor(){return this.anchor.get().at(0)}setSelection(i,e){this.eventBufferer.bufferEvents(()=>{let t=i.map(n=>this.model.getNode(n));this.selection.set(t,e);let o=i.map(n=>this.model.getListIndex(n)).filter(n=>n>-1);this.view.setSelection(o,e,!0)})}getSelection(){return this.selection.get()}setFocus(i,e){this.eventBufferer.bufferEvents(()=>{let t=i.map(n=>this.model.getNode(n));this.focus.set(t,e);let o=i.map(n=>this.model.getListIndex(n)).filter(n=>n>-1);this.view.setFocus(o,e,!0)})}focusNext(i=1,e=!1,t,o=ag(t)&&t.altKey?void 0:this.focusNavigationFilter){this.view.focusNext(i,e,t,o)}focusPrevious(i=1,e=!1,t,o=ag(t)&&t.altKey?void 0:this.focusNavigationFilter){this.view.focusPrevious(i,e,t,o)}focusNextPage(i,e=ag(i)&&i.altKey?void 0:this.focusNavigationFilter){return this.view.focusNextPage(i,e)}focusPreviousPage(i,e=ag(i)&&i.altKey?void 0:this.focusNavigationFilter){return this.view.focusPreviousPage(i,e,()=>this.stickyScrollController?.height??0)}focusLast(i,e=ag(i)&&i.altKey?void 0:this.focusNavigationFilter){this.view.focusLast(i,e)}focusFirst(i,e=ag(i)&&i.altKey?void 0:this.focusNavigationFilter){this.view.focusFirst(i,e)}getFocus(){return this.focus.get()}getStickyScrollFocus(){let i=this.stickyScrollController?.getFocus();return i!==void 0?[i]:[]}getFocusedPart(){return this.stickyScrollController?.focusedLast()?1:0}reveal(i,e){this.model.expandTo(i);let t=this.model.getListIndex(i);if(t!==-1)if(!this.stickyScrollController)this.view.reveal(t,e);else{let o=this.stickyScrollController.nodePositionTopBelowWidget(this.getNode(i));this.view.reveal(t,e,o)}}getRelativeTop(i){let e=this.model.getListIndex(i);if(e===-1)return null;let t=this.stickyScrollController?.getNode(this.getNode(i));return this.view.getRelativeTop(e,t?.position??this.stickyScrollController?.height)}getViewState(i=this.options.identityProvider){if(!i)throw new pg(this._user,"Can't get tree view state without an identity provider");let e=r=>i.getId(r).toString(),t=A5e.empty(this.scrollTop);for(let r of this.getFocus())t.focus.add(e(r));for(let r of this.getSelection())t.selection.add(e(r));let o=this.model.getNode(),n=[o];for(;n.length>0;){let r=n.pop();r!==o&&r.collapsible&&(t.expanded[e(r.element)]=r.collapsed?0:1),dre(n,n.length,r.children)}return t}onLeftArrow(i){i.preventDefault(),i.stopPropagation();let e=this.view.getFocusedElements();if(e.length===0)return;let t=e[0],o=this.model.getNodeLocation(t);if(!this.model.setCollapsed(o,!0)){let r=this.model.getParentNodeLocation(o);if(!r)return;let s=this.model.getListIndex(r);this.view.reveal(s),this.view.setFocus([s])}}onRightArrow(i){i.preventDefault(),i.stopPropagation();let e=this.view.getFocusedElements();if(e.length===0)return;let t=e[0],o=this.model.getNodeLocation(t);if(!this.model.setCollapsed(o,!1)){if(!t.children.some(l=>l.visible))return;let[r]=this.view.getFocus(),s=r+1;this.view.reveal(s),this.view.setFocus([s])}}onSpace(i){i.preventDefault(),i.stopPropagation();let e=this.view.getFocusedElements();if(e.length===0)return;let t=e[0],o=this.model.getNodeLocation(t),n=i.browserEvent.altKey;this.model.setCollapsed(o,void 0,n)}setupModel(i){this.modelDisposables.clear(),this.modelDisposables.add(i.onDidSpliceRenderedNodes(({start:n,deleteCount:r,elements:s})=>this.view.splice(n,r,s)));let e=H.forEach(i.onDidSpliceModel,n=>{this.eventBufferer.bufferEvents(()=>{this.focus.onDidModelSplice(n),this.selection.onDidModelSplice(n)})},this.modelDisposables);e(()=>null,null,this.modelDisposables);let t=this.modelDisposables.add(new E),o=this.modelDisposables.add(new jo(0));this.modelDisposables.add(H.any(e,this.focus.onDidChange,this.selection.onDidChange)(()=>{o.trigger(()=>{let n=new Set;for(let r of this.focus.getNodes())n.add(r);for(let r of this.selection.getNodes())n.add(r);t.fire([...n.values()])})})),this.onDidChangeActiveNodesRelay.input=t.event,this.onDidChangeModelRelay.input=H.signal(i.onDidSpliceModel),this.onDidChangeCollapseStateRelay.input=i.onDidChangeCollapseState,this.onDidChangeRenderNodeCountRelay.input=i.onDidChangeRenderNodeCount,this.onDidSpliceModelRelay.input=i.onDidSpliceModel,it&&this.modelDisposables.add(i.onDidChangeCollapseState(n=>{let{node:r,deep:s}=n;r.collapsible&&!s&&this.isDOMFocused()&&Jo(r.collapsed?d(39,null):d(40,null))}))}navigate(i){return new Zoi(this.view,this.model,i)}delegateScrollFromMouseWheelEvent(i){this.view.delegateScrollFromMouseWheelEvent(i)}dispose(){Ue(this.disposables),this.stickyScrollController?.dispose(),this.view.dispose(),this.modelDisposables.dispose()}},Zoi=class{constructor(i,e,t){this.view=i;this.model=e;t?this.index=this.model.getListIndex(t):this.index=-1}current(){return this.index<0||this.index>=this.view.length?null:this.view.element(this.index).element}previous(){return this.index--,this.current()}next(){return this.index++,this.current()}first(){return this.index=0,this.current()}last(){return this.index=this.view.length-1,this.current()}};var O1=class{constructor(i,e={}){this.user=i;this.rootRef=null;this.nodes=new Map;this.nodesByIdentity=new Map;this.model=new myt(i,null,e),this.onDidSpliceModel=this.model.onDidSpliceModel,this.onDidSpliceRenderedNodes=this.model.onDidSpliceRenderedNodes,this.onDidChangeCollapseState=this.model.onDidChangeCollapseState,this.onDidChangeRenderNodeCount=this.model.onDidChangeRenderNodeCount,e.sorter&&(this.sorter={compare(t,o){return e.sorter.compare(t.element,o.element)}}),this.identityProvider=e.identityProvider}get size(){return this.nodes.size}setChildren(i,e=ht.empty(),t={}){let o=this.getElementLocation(i);this._setChildren(o,this.preserveCollapseState(e),t)}_setChildren(i,e=ht.empty(),t){let o=new Set,n=new Set,r=l=>{if(l.element===null)return;let c=l;if(o.add(c.element),this.nodes.set(c.element,c),this.identityProvider){let u=this.identityProvider.getId(c.element).toString();n.add(u),this.nodesByIdentity.set(u,c)}t.onDidCreateNode?.(c)},s=l=>{if(l.element===null)return;let c=l;if(o.has(c.element)||this.nodes.delete(c.element),this.identityProvider){let u=this.identityProvider.getId(c.element).toString();n.has(u)||this.nodesByIdentity.delete(u)}t.onDidDeleteNode?.(c)};this.model.splice([...i,0],Number.MAX_VALUE,e,{...t,onDidCreateNode:r,onDidDeleteNode:s})}preserveCollapseState(i=ht.empty()){return this.sorter&&(i=[...i].sort(this.sorter.compare.bind(this.sorter))),ht.map(i,e=>{let t=this.nodes.get(e.element);if(!t&&this.identityProvider){let r=this.identityProvider.getId(e.element).toString();t=this.nodesByIdentity.get(r)}if(!t){let r;return typeof e.collapsed>"u"?r=void 0:e.collapsed===1||e.collapsed===3?r=!0:e.collapsed===0||e.collapsed===2?r=!1:r=!!e.collapsed,{...e,children:this.preserveCollapseState(e.children),collapsed:r}}let o=typeof e.collapsible=="boolean"?e.collapsible:t.collapsible,n;return typeof e.collapsed>"u"||e.collapsed===3||e.collapsed===2?n=t.collapsed:e.collapsed===1?n=!0:e.collapsed===0?n=!1:n=!!e.collapsed,{...e,collapsible:o,collapsed:n,children:this.preserveCollapseState(e.children)}})}rerender(i){let e=this.getElementLocation(i);this.model.rerender(e)}resort(i=null,e=!0){if(!this.sorter)return;let t=this.getElementLocation(i),o=this.model.getNode(t);this._setChildren(t,this.resortChildren(o,e),{})}resortChildren(i,e,t=!0){let o=[...i.children];return(e||t)&&(o=o.sort(this.sorter.compare.bind(this.sorter))),ht.map(o,n=>({element:n.element,collapsible:n.collapsible,collapsed:n.collapsed,children:this.resortChildren(n,e,!1)}))}getFirstElementChild(i=null){let e=this.getElementLocation(i);return this.model.getFirstElementChild(e)}getLastElementAncestor(i=null){let e=this.getElementLocation(i);return this.model.getLastElementAncestor(e)}has(i){return this.nodes.has(i)}getListIndex(i){let e=this.getElementLocation(i);return this.model.getListIndex(e)}getListRenderCount(i){let e=this.getElementLocation(i);return this.model.getListRenderCount(e)}isCollapsible(i){let e=this.getElementLocation(i);return this.model.isCollapsible(e)}setCollapsible(i,e){let t=this.getElementLocation(i);return this.model.setCollapsible(t,e)}isCollapsed(i){let e=this.getElementLocation(i);return this.model.isCollapsed(e)}setCollapsed(i,e,t){let o=this.getElementLocation(i);return this.model.setCollapsed(o,e,t)}expandTo(i){let e=this.getElementLocation(i);this.model.expandTo(e)}refilter(){this.model.refilter()}getNode(i=null){if(i===null)return this.model.getNode(this.model.rootRef);let e=this.nodes.get(i);if(!e)throw new pg(this.user,`Tree element not found: ${i}`);return e}getNodeLocation(i){return i.element}getParentNodeLocation(i){if(i===null)throw new pg(this.user,"Invalid getParentNodeLocation call");let e=this.nodes.get(i);if(!e)throw new pg(this.user,`Tree element not found: ${i}`);let t=this.model.getNodeLocation(e),o=this.model.getParentNodeLocation(t);return this.model.getNode(o).element}getElementLocation(i){if(i===null)return[];let e=this.nodes.get(i);if(!e)throw new pg(this.user,`Tree element not found: ${i}`);return this.model.getNodeLocation(e)}};function vyt(a){let i=[a.element],e=a.incompressible||!1;return{element:{elements:i,incompressible:e},children:ht.map(ht.from(a.children),vyt),collapsible:a.collapsible,collapsed:a.collapsed}}function byt(a){let i=[a.element],e=a.incompressible||!1,t,o;for(;[o,t]=ht.consume(ht.from(a.children),2),!(o.length!==1||o[0].incompressible);)a=o[0],i.push(a.element);return{element:{elements:i,incompressible:e},children:ht.map(ht.concat(o,t),byt),collapsible:a.collapsible,collapsed:a.collapsed}}function eni(a,i=0){let e;return i<a.element.elements.length-1?e=[eni(a,i+1)]:e=ht.map(ht.from(a.children),t=>eni(t,0)),i===0&&a.element.incompressible?{element:a.element.elements[i],children:e,incompressible:!0,collapsible:a.collapsible,collapsed:a.collapsed}:{element:a.element.elements[i],children:e,collapsible:a.collapsible,collapsed:a.collapsed}}function X3i(a){return eni(a,0)}function J3i(a,i,e){return a.element===i?{...a,children:e}:{...a,children:ht.map(ht.from(a.children),t=>J3i(t,i,e))}}var kWo=a=>({getId(i){return i.elements.map(e=>a.getId(e).toString()).join("\0")}}),tni=class{constructor(i,e={}){this.user=i;this.rootRef=null;this.nodes=new Map;this.model=new O1(i,e),this.enabled=typeof e.compressionEnabled>"u"?!0:e.compressionEnabled,this.identityProvider=e.identityProvider}get onDidSpliceRenderedNodes(){return this.model.onDidSpliceRenderedNodes}get onDidSpliceModel(){return this.model.onDidSpliceModel}get onDidChangeCollapseState(){return this.model.onDidChangeCollapseState}get onDidChangeRenderNodeCount(){return this.model.onDidChangeRenderNodeCount}get size(){return this.nodes.size}setChildren(i,e=ht.empty(),t){let o=t.diffIdentityProvider&&kWo(t.diffIdentityProvider);if(i===null){let f=ht.map(e,this.enabled?byt:vyt);this._setChildren(null,f,{diffIdentityProvider:o,diffDepth:1/0});return}let n=this.nodes.get(i);if(!n)throw new pg(this.user,"Unknown compressed tree node");let r=this.model.getNode(n),s=this.model.getParentNodeLocation(n),l=this.model.getNode(s),c=X3i(r),u=J3i(c,i,e),p=(this.enabled?byt:vyt)(u),h=t.diffIdentityProvider?((f,v)=>t.diffIdentityProvider.getId(f)===t.diffIdentityProvider.getId(v)):void 0;if($i(p.element.elements,r.element.elements,h)){this._setChildren(n,p.children||ht.empty(),{diffIdentityProvider:o,diffDepth:1});return}let g=l.children.map(f=>f===r?p:f);this._setChildren(l.element,g,{diffIdentityProvider:o,diffDepth:r.depth-l.depth})}isCompressionEnabled(){return this.enabled}setCompressionEnabled(i){if(i===this.enabled)return;this.enabled=i;let t=this.model.getNode().children,o=ht.map(t,X3i),n=ht.map(o,i?byt:vyt);this._setChildren(null,n,{diffIdentityProvider:this.identityProvider,diffDepth:1/0})}_setChildren(i,e,t){let o=new Set,n=s=>{for(let l of s.element.elements)o.add(l),this.nodes.set(l,s.element)},r=s=>{for(let l of s.element.elements)o.has(l)||this.nodes.delete(l)};this.model.setChildren(i,e,{...t,onDidCreateNode:n,onDidDeleteNode:r})}has(i){return this.nodes.has(i)}getListIndex(i){let e=this.getCompressedNode(i);return this.model.getListIndex(e)}getListRenderCount(i){let e=this.getCompressedNode(i);return this.model.getListRenderCount(e)}getNode(i){if(typeof i>"u")return this.model.getNode();let e=this.getCompressedNode(i);return this.model.getNode(e)}getNodeLocation(i){let e=this.model.getNodeLocation(i);return e===null?null:e.elements[e.elements.length-1]}getParentNodeLocation(i){let e=this.getCompressedNode(i),t=this.model.getParentNodeLocation(e);return t===null?null:t.elements[t.elements.length-1]}getFirstElementChild(i){let e=this.getCompressedNode(i);return this.model.getFirstElementChild(e)}getLastElementAncestor(i){let e=typeof i>"u"?void 0:this.getCompressedNode(i);return this.model.getLastElementAncestor(e)}isCollapsible(i){let e=this.getCompressedNode(i);return this.model.isCollapsible(e)}setCollapsible(i,e){let t=this.getCompressedNode(i);return this.model.setCollapsible(t,e)}isCollapsed(i){let e=this.getCompressedNode(i);return this.model.isCollapsed(e)}setCollapsed(i,e,t){let o=this.getCompressedNode(i);return this.model.setCollapsed(o,e,t)}expandTo(i){let e=this.getCompressedNode(i);this.model.expandTo(e)}rerender(i){let e=this.getCompressedNode(i);this.model.rerender(e)}refilter(){this.model.refilter()}resort(i=null,e=!0){let t=this.getCompressedNode(i);this.model.resort(t,e)}getCompressedNode(i){if(i===null)return null;let e=this.nodes.get(i);if(!e)throw new pg(this.user,`Tree element not found: ${i}`);return e}},EWo=a=>a[a.length-1],ini=class a{constructor(i,e){this.unwrapper=i;this.node=e}get element(){return this.node.element===null?null:this.unwrapper(this.node.element)}get children(){return this.node.children.map(i=>new a(this.unwrapper,i))}get depth(){return this.node.depth}get visibleChildrenCount(){return this.node.visibleChildrenCount}get visibleChildIndex(){return this.node.visibleChildIndex}get collapsible(){return this.node.collapsible}get collapsed(){return this.node.collapsed}get visible(){return this.node.visible}get filterData(){return this.node.filterData}};function TWo(a,i){return{...i,identityProvider:i.identityProvider&&{getId(e){return i.identityProvider.getId(a(e))}},sorter:i.sorter&&{compare(e,t){return i.sorter.compare(e.elements[0],t.elements[0])}},filter:i.filter&&{filter(e,t){let o=e.elements;for(let n=0;n<o.length-1;n++){let r=i.filter.filter(o[n],t);t=N1(k7(r)?r.visibility:r)}return i.filter.filter(o[o.length-1],t)}}}}var Syt=class{constructor(i,e={}){this.rootRef=null;this.elementMapper=e.elementMapper||EWo;let t=o=>this.elementMapper(o.elements);this.nodeMapper=new Qae(o=>new ini(t,o)),this.model=new tni(i,TWo(t,e))}get onDidSpliceModel(){return H.map(this.model.onDidSpliceModel,({insertedNodes:i,deletedNodes:e})=>({insertedNodes:i.map(t=>this.nodeMapper.map(t)),deletedNodes:e.map(t=>this.nodeMapper.map(t))}))}get onDidSpliceRenderedNodes(){return H.map(this.model.onDidSpliceRenderedNodes,({start:i,deleteCount:e,elements:t})=>({start:i,deleteCount:e,elements:t.map(o=>this.nodeMapper.map(o))}))}get onDidChangeCollapseState(){return H.map(this.model.onDidChangeCollapseState,({node:i,deep:e})=>({node:this.nodeMapper.map(i),deep:e}))}get onDidChangeRenderNodeCount(){return H.map(this.model.onDidChangeRenderNodeCount,i=>this.nodeMapper.map(i))}setChildren(i,e=ht.empty(),t={}){this.model.setChildren(i,e,t)}isCompressionEnabled(){return this.model.isCompressionEnabled()}setCompressionEnabled(i){this.model.setCompressionEnabled(i)}has(i){return this.model.has(i)}getListIndex(i){return this.model.getListIndex(i)}getListRenderCount(i){return this.model.getListRenderCount(i)}getNode(i){return this.nodeMapper.map(this.model.getNode(i))}getNodeLocation(i){return i.element}getParentNodeLocation(i){return this.model.getParentNodeLocation(i)}getFirstElementChild(i){let e=this.model.getFirstElementChild(i);return e===null||typeof e>"u"?e:this.elementMapper(e.elements)}getLastElementAncestor(i){let e=this.model.getLastElementAncestor(i);return e===null||typeof e>"u"?e:this.elementMapper(e.elements)}isCollapsible(i){return this.model.isCollapsible(i)}setCollapsible(i,e){return this.model.setCollapsible(i,e)}isCollapsed(i){return this.model.isCollapsed(i)}setCollapsed(i,e,t){return this.model.setCollapsed(i,e,t)}expandTo(i){return this.model.expandTo(i)}rerender(i){return this.model.rerender(i)}refilter(){return this.model.refilter()}resort(i=null,e=!0){return this.model.resort(i,e)}getCompressedTreeNode(i=null){return this.model.getNode(i)}};var Jy=class extends LW{constructor(e,t,o,n,r={}){super(e,t,o,n,r);this.user=e}get onDidChangeCollapseState(){return this.model.onDidChangeCollapseState}setChildren(e,t=ht.empty(),o){this.model.setChildren(e,t,o)}rerender(e){if(e===void 0){this.view.rerender();return}this.model.rerender(e)}updateElementHeight(e,t){let o=this.model.getListIndex(e);o!==-1&&this.view.updateElementHeight(o,t)}resort(e,t=!0){this.model.resort(e,t)}hasElement(e){return this.model.has(e)}createModel(e,t){return new O1(e,t)}},Iyt=class{constructor(i,e,t){this._compressedTreeNodeProvider=i;this.stickyScrollDelegate=e;this.renderer=t;this.templateId=t.templateId,t.onDidChangeTwistieState&&(this.onDidChangeTwistieState=t.onDidChangeTwistieState)}get compressedTreeNodeProvider(){return this._compressedTreeNodeProvider()}renderTemplate(i){return{compressedTreeNode:void 0,data:this.renderer.renderTemplate(i)}}renderElement(i,e,t,o){let n=this.stickyScrollDelegate.getCompressedNode(i);n||(n=this.compressedTreeNodeProvider.getCompressedTreeNode(i.element)),n.element.elements.length===1?(t.compressedTreeNode=void 0,this.renderer.renderElement(i,e,t.data,o)):(t.compressedTreeNode=n,this.renderer.renderCompressedElements(n,e,t.data,o))}disposeElement(i,e,t,o){t.compressedTreeNode?this.renderer.disposeCompressedElements?.(t.compressedTreeNode,e,t.data,o):this.renderer.disposeElement?.(i,e,t.data,o)}disposeTemplate(i){this.renderer.disposeTemplate(i.data)}renderTwistie(i,e){return this.renderer.renderTwistie?.(i,e)??!1}};I([mi],Iyt.prototype,"compressedTreeNodeProvider",1);var oni=class{constructor(i){this.modelProvider=i;this.compressedStickyNodes=new Map}getCompressedNode(i){return this.compressedStickyNodes.get(i)}constrainStickyScrollNodes(i,e,t){if(this.compressedStickyNodes.clear(),i.length===0)return[];for(let o=0;o<i.length;o++){let n=i[o],r=n.position+n.height;if(o+1<i.length&&r+i[o+1].height>t||o>=e-1&&e<i.length){let l=i.slice(0,o),c=i.slice(o),u=this.compressStickyNodes(c);return[...l,u]}}return i}compressStickyNodes(i){if(i.length===0)throw new Error("Can't compress empty sticky nodes");let e=this.modelProvider();if(!e.isCompressionEnabled())return i[0];let t=[];for(let c=0;c<i.length;c++){let u=i[c],p=e.getCompressedTreeNode(u.node.element);if(p.element){if(c!==0&&p.element.incompressible)break;t.push(...p.element.elements)}}if(t.length<2)return i[0];let o=i[i.length-1],n={elements:t,incompressible:!1},r={...o.node,children:[],element:n},s=new Proxy(i[0].node,{}),l={node:s,startIndex:i[0].startIndex,endIndex:o.endIndex,position:i[0].position,height:i[0].height};return this.compressedStickyNodes.set(s,r),l}};function _Wo(a,i){return i&&{...i,keyboardNavigationLabelProvider:i.keyboardNavigationLabelProvider&&{getKeyboardNavigationLabel(e){let t;try{t=a().getCompressedTreeNode(e)}catch{return i.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(e)}return t.element.elements.length===1?i.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(e):i.keyboardNavigationLabelProvider.getCompressedNodeKeyboardNavigationLabel(t.element.elements)}}}}var zwe=class extends Jy{constructor(i,e,t,o,n={}){let r=()=>this,s=new oni(()=>this.model),l=o.map(c=>new Iyt(r,s,c));super(i,e,t,l,{..._Wo(r,n),stickyScrollDelegate:s})}setChildren(i,e=ht.empty(),t){this.model.setChildren(i,e,t)}createModel(i,e){return new Syt(i,e)}updateOptions(i={}){super.updateOptions(i),typeof i.compressionEnabled<"u"&&this.model.setCompressionEnabled(i.compressionEnabled)}getCompressedTreeNode(i=null){return this.model.getCompressedTreeNode(i)}};function nni(a){return{...a,children:[],refreshPromise:void 0,stale:!0,slow:!1,forceExpanded:!1}}function sni(a,i){return i.parent?i.parent===a?!0:sni(a,i.parent):!1}function DWo(a,i){return a===i||sni(a,i)||sni(i,a)}var ani=class a{constructor(i){this.node=i}get element(){return this.node.element.element}get children(){return this.node.children.map(i=>new a(i))}get depth(){return this.node.depth}get visibleChildrenCount(){return this.node.visibleChildrenCount}get visibleChildIndex(){return this.node.visibleChildIndex}get collapsible(){return this.node.collapsible}get collapsed(){return this.node.collapsed}get visible(){return this.node.visible}get filterData(){return this.node.filterData}},lni=class{constructor(i,e,t){this.renderer=i;this.nodeMapper=e;this.onDidChangeTwistieState=t;this.renderedNodes=new Map;this.templateId=i.templateId}renderTemplate(i){return{templateData:this.renderer.renderTemplate(i)}}renderElement(i,e,t,o){this.renderer.renderElement(this.nodeMapper.map(i),e,t.templateData,o)}renderTwistie(i,e){return i.slow?(e.classList.add(...q.asClassNameArray(M.treeItemLoading)),!0):(e.classList.remove(...q.asClassNameArray(M.treeItemLoading)),!1)}disposeElement(i,e,t,o){this.renderer.disposeElement?.(this.nodeMapper.map(i),e,t.templateData,o)}disposeTemplate(i){this.renderer.disposeTemplate(i.templateData)}dispose(){this.renderedNodes.clear()}};function Z3i(a){return{browserEvent:a.browserEvent,elements:a.elements.map(i=>i.element)}}function yyt(a){return{browserEvent:a.browserEvent,element:a.element&&a.element.element,target:a.target}}function LWo(a){return{browserEvent:a.browserEvent,element:a.element&&a.element.element,anchor:a.anchor,isStickyScroll:a.isStickyScroll}}var cni=class extends $y{constructor(e){super(e.elements.map(t=>t.element));this.data=e}set context(e){this.data.context=e}get context(){return this.data.context}};function rni(a){return a instanceof $y?new cni(a):a}var dni=class{constructor(i){this.dnd=i}getDragURI(i){return this.dnd.getDragURI(i.element)}getDragLabel(i,e){if(this.dnd.getDragLabel)return this.dnd.getDragLabel(i.map(t=>t.element),e)}onDragStart(i,e){this.dnd.onDragStart?.(rni(i),e)}onDragOver(i,e,t,o,n,r=!0){return this.dnd.onDragOver(rni(i),e&&e.element,t,o,n)}drop(i,e,t,o,n){this.dnd.drop(rni(i),e&&e.element,t,o,n)}onDragEnd(i){this.dnd.onDragEnd?.(i)}dispose(){this.dnd.dispose()}},uni=class extends N5e{constructor(e,t,o){super(t,o);this.findProvider=e;this.isFindSessionActive=!1}filter(e,t){let o=super.filter(e,t);if(!this.isFindSessionActive||this.findMode===0||!this.findProvider.isVisible)return o;let n=k7(o)?o.visibility:o;return N1(n)===0?0:this.findProvider.isVisible(e)?o:0}},pni=class extends O5e{constructor(e,t,o,n,r){super(e,o,n,r);this.findProvider=t;this.filter=o;this.activeSession=!1;this.asyncWorkInProgress=!1;this.taskQueue=new ya(250);this.disposables.add(Z(async()=>{this.activeSession&&await this.findProvider.endSession?.()}))}applyPattern(e){this.renderMessage(!1),this.activeTokenSource?.cancel(),this.activeTokenSource=new $e,this.taskQueue.trigger(()=>this.applyPatternAsync())}async applyPatternAsync(){let e=this.activeTokenSource?.token;if(!e||e.isCancellationRequested)return;let t=this.pattern;if(t===""){this.activeSession&&(this.asyncWorkInProgress=!0,await this.deactivateFindSession(),this.asyncWorkInProgress=!1,e.isCancellationRequested||(this.filter.reset(),super.applyPattern("")));return}this.activeSession||this.activateFindSession(),this.asyncWorkInProgress=!0,this.activeFindMetadata=void 0;let o=await this.findProvider.find(t,{matchType:this.matchType,findMode:this.mode},e);e.isCancellationRequested||o===void 0||(this.asyncWorkInProgress=!1,this.activeFindMetadata=o,this.filter.reset(),super.applyPattern(t),o.warningMessage&&this.renderMessage(!0,o.warningMessage))}activateFindSession(){this.activeSession=!0,this.filter.isFindSessionActive=!0,this.findProvider.startSession?.()}async deactivateFindSession(){this.activeSession=!1,this.filter.isFindSessionActive=!1,await this.findProvider.endSession?.()}render(){if(this.asyncWorkInProgress||!this.activeFindMetadata)return;let e=this.activeFindMetadata.matchCount===0&&this.pattern.length>0;this.renderMessage(e),this.pattern.length&&this.alertResults(this.activeFindMetadata.matchCount)}onDidToggleChange(e){this.toggles.set(e.id,e.isChecked),this.filter.findMode=this.mode,this.filter.findMatchType=this.matchType,this.placeholder=this.mode===1?d(43,null):d(44,null),this.applyPattern(this.pattern)}shouldAllowFocus(e){return this.shouldFocusWhenNavigating(e)}shouldFocusWhenNavigating(e){if(!this.activeSession||!this.activeFindMetadata)return!0;let t=e.element?.element;return t&&this.activeFindMetadata.isMatch(t)?!0:!uv.isDefault(e.filterData)}};function e8i(a){return a&&{...a,collapseByDefault:!0,identityProvider:a.identityProvider&&{getId(i){return a.identityProvider.getId(i.element)},getGroupId:a.identityProvider.getGroupId?i=>a.identityProvider.getGroupId(i.element):void 0},dnd:a.dnd&&new dni(a.dnd),multipleSelectionController:a.multipleSelectionController&&{isSelectionSingleChangeEvent(i){return a.multipleSelectionController.isSelectionSingleChangeEvent({...i,element:i.element})},isSelectionRangeChangeEvent(i){return a.multipleSelectionController.isSelectionRangeChangeEvent({...i,element:i.element})}},accessibilityProvider:a.accessibilityProvider&&{...a.accessibilityProvider,getPosInSet:void 0,getSetSize:void 0,getRole:a.accessibilityProvider.getRole?i=>a.accessibilityProvider.getRole(i.element):()=>"treeitem",isChecked:a.accessibilityProvider.isChecked?i=>!!a.accessibilityProvider?.isChecked(i.element):void 0,getAriaLabel(i){return a.accessibilityProvider.getAriaLabel(i.element)},getWidgetAriaLabel(){return a.accessibilityProvider.getWidgetAriaLabel()},getWidgetRole:a.accessibilityProvider.getWidgetRole?()=>a.accessibilityProvider.getWidgetRole():()=>"tree",getAriaLevel:a.accessibilityProvider.getAriaLevel&&(i=>a.accessibilityProvider.getAriaLevel(i.element)),getActiveDescendantId:a.accessibilityProvider.getActiveDescendantId&&(i=>a.accessibilityProvider.getActiveDescendantId(i.element))},filter:a.filter&&{filter(i,e){return a.filter.filter(i.element,e)}},keyboardNavigationLabelProvider:a.keyboardNavigationLabelProvider&&{...a.keyboardNavigationLabelProvider,getKeyboardNavigationLabel(i){return a.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(i.element)}},sorter:void 0,expandOnlyOnTwistieClick:typeof a.expandOnlyOnTwistieClick>"u"?void 0:typeof a.expandOnlyOnTwistieClick!="function"?a.expandOnlyOnTwistieClick:(i=>a.expandOnlyOnTwistieClick(i.element)),twistieAdditionalCssClass:typeof a.twistieAdditionalCssClass>"u"?void 0:(i=>a.twistieAdditionalCssClass(i.element)),defaultFindVisibility:i=>i.hasChildren&&i.stale?1:typeof a.defaultFindVisibility=="number"?a.defaultFindVisibility:typeof a.defaultFindVisibility>"u"?2:a.defaultFindVisibility(i.element),stickyScrollDelegate:a.stickyScrollDelegate}}function mni(a,i){i(a),a.children.forEach(e=>mni(e,i))}var gv=class{constructor(i,e,t,o,n,r={}){this.user=i;this.dataSource=n;this.nodes=new Map;this.subTreeRefreshPromises=new Map;this.refreshPromises=new Map;this._onDidRender=new E;this._onDidChangeNodeSlowState=new E;this.nodeMapper=new Qae(i=>new ani(i));this.disposables=new P;this.identityProvider=r.identityProvider,this.autoExpandSingleChildren=typeof r.autoExpandSingleChildren>"u"?!1:r.autoExpandSingleChildren,this.sorter=r.sorter,this.getDefaultCollapseState=c=>r.collapseByDefault?r.collapseByDefault(c)?3:2:void 0;let s=!1,l;if(r.findProvider&&(r.findWidgetEnabled??!0)&&r.keyboardNavigationLabelProvider&&r.contextViewProvider&&(s=!0,l=new uni(r.findProvider,r.keyboardNavigationLabelProvider,r.filter)),this.tree=this.createTree(i,e,t,o,{...r,findWidgetEnabled:!s,filter:l??r.filter}),this.root=nni({element:void 0,parent:null,hasChildren:!0,defaultCollapseState:void 0}),this.identityProvider&&(this.root={...this.root,id:null}),this.nodes.set(null,this.root),this.tree.onDidChangeCollapseState(this._onDidChangeCollapseState,this,this.disposables),s){let c={styles:r.findWidgetStyles,showNotFoundMessage:r.showNotFoundMessage,defaultFindMatchType:r.defaultFindMatchType,defaultFindMode:r.defaultFindMode};this.findController=this.disposables.add(new pni(this.tree,r.findProvider,l,this.tree.options.contextViewProvider,c)),this.focusNavigationFilter=u=>this.findController.shouldFocusWhenNavigating(u),this.onDidChangeFindOpenState=this.findController.onDidChangeOpenState,this.onDidChangeFindMode=this.findController.onDidChangeMode,this.onDidChangeFindMatchType=this.findController.onDidChangeMatchType}else this.onDidChangeFindOpenState=this.tree.onDidChangeFindOpenState,this.onDidChangeFindMode=this.tree.onDidChangeFindMode,this.onDidChangeFindMatchType=this.tree.onDidChangeFindMatchType}get onDidScroll(){return this.tree.onDidScroll}get onDidChangeFocus(){return H.map(this.tree.onDidChangeFocus,Z3i)}get onDidChangeSelection(){return H.map(this.tree.onDidChangeSelection,Z3i)}get onKeyDown(){return this.tree.onKeyDown}get onMouseClick(){return H.map(this.tree.onMouseClick,yyt)}get onMouseDblClick(){return H.map(this.tree.onMouseDblClick,yyt)}get onContextMenu(){return H.map(this.tree.onContextMenu,LWo)}get onTap(){return H.map(this.tree.onTap,yyt)}get onPointer(){return H.map(this.tree.onPointer,yyt)}get onDidFocus(){return this.tree.onDidFocus}get onDidBlur(){return this.tree.onDidBlur}get onDidChangeModel(){return this.tree.onDidChangeModel}get onDidChangeCollapseState(){return this.tree.onDidChangeCollapseState}get onDidUpdateOptions(){return this.tree.onDidUpdateOptions}get onDidChangeStickyScrollFocused(){return this.tree.onDidChangeStickyScrollFocused}get findMode(){return this.findController?this.findController.mode:this.tree.findMode}set findMode(i){this.findController?this.findController.mode=i:this.tree.findMode=i}get findMatchType(){return this.findController?this.findController.matchType:this.tree.findMatchType}set findMatchType(i){this.findController?this.findController.matchType=i:this.tree.findMatchType=i}get expandOnlyOnTwistieClick(){if(typeof this.tree.expandOnlyOnTwistieClick=="boolean")return this.tree.expandOnlyOnTwistieClick;let i=this.tree.expandOnlyOnTwistieClick;return e=>i(this.nodes.get(e===this.root.element?null:e)||null)}get onDidDispose(){return this.tree.onDidDispose}createTree(i,e,t,o,n){let r=new Uwe(t),s=o.map(c=>new lni(c,this.nodeMapper,this._onDidChangeNodeSlowState.event)),l=e8i(n)||{};return new Jy(i,e,r,s,l)}updateOptions(i={}){this.findController&&(i.defaultFindMode!==void 0&&(this.findController.mode=i.defaultFindMode),i.defaultFindMatchType!==void 0&&(this.findController.matchType=i.defaultFindMatchType)),this.tree.updateOptions(i)}get options(){return this.tree.options}getHTMLElement(){return this.tree.getHTMLElement()}get contentHeight(){return this.tree.contentHeight}get contentWidth(){return this.tree.contentWidth}get onDidChangeContentHeight(){return this.tree.onDidChangeContentHeight}get onDidChangeContentWidth(){return this.tree.onDidChangeContentWidth}get scrollTop(){return this.tree.scrollTop}set scrollTop(i){this.tree.scrollTop=i}get scrollLeft(){return this.tree.scrollLeft}set scrollLeft(i){this.tree.scrollLeft=i}get scrollHeight(){return this.tree.scrollHeight}get renderHeight(){return this.tree.renderHeight}get lastVisibleElement(){return this.tree.lastVisibleElement.element}get ariaLabel(){return this.tree.ariaLabel}set ariaLabel(i){this.tree.ariaLabel=i}domFocus(){this.tree.domFocus()}isDOMFocused(){return this.tree.isDOMFocused()}navigate(i){let e;return i&&(e=this.getDataNode(i)),new fni(this.tree.navigate(e))}layout(i,e){this.tree.layout(i,e)}style(i){this.tree.style(i)}getInput(){return this.root.element}async setInput(i,e){this.cancelAllRefreshPromises(),this.root.element=i;let t=e&&{viewState:e,focus:[],selection:[]};await this._updateChildren(i,!0,!1,t),t&&(this.tree.setFocus(t.focus),this.tree.setSelection(t.selection)),e&&typeof e.scrollTop=="number"&&(this.scrollTop=e.scrollTop)}async updateChildren(i=this.root.element,e=!0,t=!1,o){await this._updateChildren(i,e,t,void 0,o)}cancelAllRefreshPromises(i=!1){this.refreshPromises.forEach(e=>e.cancel()),this.refreshPromises.clear(),i&&(this.subTreeRefreshPromises.forEach(e=>e.cancel()),this.subTreeRefreshPromises.clear())}async _updateChildren(i=this.root.element,e=!0,t=!1,o,n){if(typeof this.root.element>"u")throw new pg(this.user,"Tree input not set");this.root.refreshPromise&&(await this.root.refreshPromise,await H.toPromise(this._onDidRender.event));let r=this.getDataNode(i);if(await this.refreshAndRenderNode(r,e,o,n),t)try{this.tree.rerender(r)}catch{}}resort(i=this.root.element,e=!0){this.tree.resort(this.getDataNode(i),e)}hasNode(i){return i===this.root.element||this.nodes.has(i)}rerender(i){if(i===void 0||i===this.root.element){this.tree.rerender();return}let e=this.getDataNode(i);this.tree.rerender(e)}updateElementHeight(i,e){let t=this.getDataNode(i);this.tree.updateElementHeight(t,e)}updateWidth(i){let e=this.getDataNode(i);this.tree.updateWidth(e)}getNode(i=this.root.element){let e=this.getDataNode(i),t=this.tree.getNode(e===this.root?null:e);return this.nodeMapper.map(t)}collapse(i,e=!1){let t=this.getDataNode(i);return this.tree.collapse(t===this.root?null:t,e)}async expand(i,e=!1){if(typeof this.root.element>"u")throw new pg(this.user,"Tree input not set");this.root.refreshPromise&&(await this.root.refreshPromise,await H.toPromise(this._onDidRender.event));let t=this.getDataNode(i);if(this.tree.hasElement(t)&&!this.tree.isCollapsible(t)||(t.refreshPromise&&(await t.refreshPromise,await H.toPromise(this._onDidRender.event)),t!==this.root&&!t.refreshPromise&&!this.tree.isCollapsed(t)))return!1;let o=this.tree.expand(t===this.root?null:t,e);return t.refreshPromise&&(await t.refreshPromise,await H.toPromise(this._onDidRender.event)),o}toggleCollapsed(i,e=!1){return this.tree.toggleCollapsed(this.getDataNode(i),e)}expandAll(){this.tree.expandAll()}async expandTo(i){if(!this.dataSource.getParent)throw new Error("Can't expand to element without getParent method");let e=[];for(;!this.hasNode(i);)i=this.dataSource.getParent(i),i!==this.root.element&&e.push(i);for(let t of ht.reverse(e))await this.expand(t);this.tree.expandTo(this.getDataNode(i))}collapseAll(){this.tree.collapseAll()}isCollapsible(i){return this.tree.isCollapsible(this.getDataNode(i))}isCollapsed(i){return this.tree.isCollapsed(this.getDataNode(i))}triggerTypeNavigation(){this.tree.triggerTypeNavigation()}openFind(){this.findController?this.findController.open():this.tree.openFind()}closeFind(){this.findController?this.findController.close():this.tree.closeFind()}refilter(){this.tree.refilter()}setAnchor(i){this.tree.setAnchor(typeof i>"u"?void 0:this.getDataNode(i))}getAnchor(){return this.tree.getAnchor()?.element}setSelection(i,e){let t=i.map(o=>this.getDataNode(o));this.tree.setSelection(t,e)}getSelection(){return this.tree.getSelection().map(e=>e.element)}setFocus(i,e){let t=i.map(o=>this.getDataNode(o));this.tree.setFocus(t,e)}focusNext(i=1,e=!1,t){this.tree.focusNext(i,e,t,this.focusNavigationFilter)}focusPrevious(i=1,e=!1,t){this.tree.focusPrevious(i,e,t,this.focusNavigationFilter)}focusNextPage(i){return this.tree.focusNextPage(i,this.focusNavigationFilter)}focusPreviousPage(i){return this.tree.focusPreviousPage(i,this.focusNavigationFilter)}focusLast(i){this.tree.focusLast(i,this.focusNavigationFilter)}focusFirst(i){this.tree.focusFirst(i,this.focusNavigationFilter)}getFocus(){return this.tree.getFocus().map(e=>e.element)}getStickyScrollFocus(){return this.tree.getStickyScrollFocus().map(e=>e.element)}getFocusedPart(){return this.tree.getFocusedPart()}reveal(i,e){this.tree.reveal(this.getDataNode(i),e)}getRelativeTop(i){return this.tree.getRelativeTop(this.getDataNode(i))}getParentElement(i){let e=this.tree.getParentElement(this.getDataNode(i));return e&&e.element}getFirstElementChild(i=this.root.element){let e=this.getDataNode(i),t=this.tree.getFirstElementChild(e===this.root?null:e);return t&&t.element}getDataNode(i){let e=this.nodes.get(i===this.root.element?null:i);if(!e){let t=this.identityProvider?.getId(i).toString();throw new pg(this.user,`Data tree node not found${t?`: ${t}`:""}`)}return e}async refreshAndRenderNode(i,e,t,o){this.disposables.isDisposed||(await this.refreshNode(i,e,t),!this.disposables.isDisposed&&this.render(i,t,o))}async refreshNode(i,e,t){let o;if(this.subTreeRefreshPromises.forEach((n,r)=>{!o&&DWo(r,i)&&(o=n.then(()=>this.refreshNode(i,e,t)))}),o)return o;if(i!==this.root&&this.tree.getNode(i).collapsed){i.hasChildren=!!this.dataSource.hasChildren(i.element),i.stale=!0,this.setChildren(i,[],e,t);return}return this.doRefreshSubTree(i,e,t)}async doRefreshSubTree(i,e,t){let o=xn(async()=>{let n=await this.doRefreshNode(i,e,t);i.stale=!1,await fn.settled(n.map(r=>this.doRefreshSubTree(r,e,t)))});return i.refreshPromise=o,this.subTreeRefreshPromises.set(i,o),o.finally(()=>{i.refreshPromise=void 0,this.subTreeRefreshPromises.delete(i)}),o}async doRefreshNode(i,e,t){i.hasChildren=!!this.dataSource.hasChildren(i.element);let o;if(!i.hasChildren)o=Promise.resolve(ht.empty());else{let n=this.doGetChildren(i);if(oGe(n))o=Promise.resolve(n);else{let r=Pi(800);r.then(()=>{i.slow=!0,this._onDidChangeNodeSlowState.fire(i)},s=>null),o=n.finally(()=>r.cancel())}}try{let n=await o;return this.setChildren(i,n,e,t)}catch(n){if(i!==this.root&&this.tree.hasElement(i)&&this.tree.collapse(i),so(n))return[];throw n}finally{i.slow&&(i.slow=!1,this._onDidChangeNodeSlowState.fire(i))}}doGetChildren(i){let e=this.refreshPromises.get(i);if(e)return e;let t=this.dataSource.getChildren(i.element);return oGe(t)?this.processChildren(t):(e=xn(async()=>this.processChildren(await t)),this.refreshPromises.set(i,e),e.finally(()=>{this.refreshPromises.delete(i)}))}_onDidChangeCollapseState({node:i,deep:e}){i.element!==null&&!i.collapsed&&i.element.stale&&(e?this.collapse(i.element.element):this.refreshAndRenderNode(i.element,!1).catch(mt))}setChildren(i,e,t,o){let n=[...e];if(i.children.length===0&&n.length===0)return[];let r=new Map,s=new Map;for(let u of i.children)r.set(u.element,u),this.identityProvider&&s.set(u.id,{node:u,collapsed:this.tree.hasElement(u)&&this.tree.isCollapsed(u)});let l=[],c=n.map(u=>{let p=!!this.dataSource.hasChildren(u);if(!this.identityProvider){let v=nni({element:u,parent:i,hasChildren:p,defaultCollapseState:this.getDefaultCollapseState(u)});return p&&v.defaultCollapseState===2&&l.push(v),v}let h=this.identityProvider.getId(u).toString(),g=s.get(h);if(g){let v=g.node;return r.delete(v.element),this.nodes.delete(v.element),this.nodes.set(u,v),v.element=u,v.hasChildren=p,t?g.collapsed?(v.children.forEach(b=>mni(b,S=>this.nodes.delete(S.element))),v.children.splice(0,v.children.length),v.stale=!0):l.push(v):p&&!g.collapsed&&l.push(v),v}let f=nni({element:u,parent:i,id:h,hasChildren:p,defaultCollapseState:this.getDefaultCollapseState(u)});return o&&o.viewState.focus&&o.viewState.focus.indexOf(h)>-1&&o.focus.push(f),o&&o.viewState.selection&&o.viewState.selection.indexOf(h)>-1&&o.selection.push(f),(o&&o.viewState.expanded&&o.viewState.expanded.indexOf(h)>-1||p&&f.defaultCollapseState===2)&&l.push(f),f});for(let u of r.values())mni(u,p=>this.nodes.delete(p.element));for(let u of c)this.nodes.set(u.element,u);return ure(i.children,0,i.children.length,c),i!==this.root&&this.autoExpandSingleChildren&&c.length===1&&l.length===0&&(c[0].forceExpanded=!0,l.push(c[0])),l}render(i,e,t){let o=i.children.map(r=>this.asTreeElement(r,e)),n=t&&{...t,diffIdentityProvider:t.diffIdentityProvider&&{getId(r){return t.diffIdentityProvider.getId(r.element)}}};this.tree.setChildren(i===this.root?null:i,o,n),i!==this.root&&this.tree.setCollapsible(i,i.hasChildren),this._onDidRender.fire()}asTreeElement(i,e){if(i.stale)return{element:i,collapsible:i.hasChildren,collapsed:!0};let t;return e&&e.viewState.expanded&&i.id&&e.viewState.expanded.indexOf(i.id)>-1?t=!1:i.forceExpanded?(t=!1,i.forceExpanded=!1):t=i.defaultCollapseState,{element:i,children:i.hasChildren?ht.map(i.children,o=>this.asTreeElement(o,e)):[],collapsible:i.hasChildren,collapsed:t}}processChildren(i){return this.sorter&&(i=[...i].sort(this.sorter.compare.bind(this.sorter))),i}getViewState(){if(!this.identityProvider)throw new pg(this.user,"Can't get tree view state without an identity provider");let i=s=>this.identityProvider.getId(s).toString(),e=this.getFocus().map(i),t=this.getSelection().map(i),o=[],n=this.tree.getNode(),r=[n];for(;r.length>0;){let s=r.pop();s!==n&&s.collapsible&&!s.collapsed&&o.push(i(s.element.element)),dre(r,r.length,s.children)}return{focus:e,selection:t,expanded:o,scrollTop:this.scrollTop}}dispose(){this._onDidRender.dispose(),this._onDidChangeNodeSlowState.dispose(),this.disposables.dispose(),this.tree.dispose()}},hni=class a{constructor(i){this.node=i}get element(){return{elements:this.node.element.elements.map(i=>i.element),incompressible:this.node.element.incompressible}}get children(){return this.node.children.map(i=>new a(i))}get depth(){return this.node.depth}get visibleChildrenCount(){return this.node.visibleChildrenCount}get visibleChildIndex(){return this.node.visibleChildIndex}get collapsible(){return this.node.collapsible}get collapsed(){return this.node.collapsed}get visible(){return this.node.visible}get filterData(){return this.node.filterData}},gni=class{constructor(i,e,t,o){this.renderer=i;this.nodeMapper=e;this.compressibleNodeMapperProvider=t;this.onDidChangeTwistieState=o;this.renderedNodes=new Map;this.disposables=[];this.templateId=i.templateId}renderTemplate(i){return{templateData:this.renderer.renderTemplate(i)}}renderElement(i,e,t,o){this.renderer.renderElement(this.nodeMapper.map(i),e,t.templateData,o)}renderCompressedElements(i,e,t,o){this.renderer.renderCompressedElements(this.compressibleNodeMapperProvider().map(i),e,t.templateData,o)}renderTwistie(i,e){return i.slow?(e.classList.add(...q.asClassNameArray(M.treeItemLoading)),!0):(e.classList.remove(...q.asClassNameArray(M.treeItemLoading)),!1)}disposeElement(i,e,t,o){this.renderer.disposeElement?.(this.nodeMapper.map(i),e,t.templateData,o)}disposeCompressedElements(i,e,t,o){this.renderer.disposeCompressedElements?.(this.compressibleNodeMapperProvider().map(i),e,t.templateData,o)}disposeTemplate(i){this.renderer.disposeTemplate(i.templateData)}dispose(){this.renderedNodes.clear(),this.disposables=Ue(this.disposables)}};function RWo(a){let i=a&&e8i(a);return i&&{...i,keyboardNavigationLabelProvider:i.keyboardNavigationLabelProvider&&{...i.keyboardNavigationLabelProvider,getCompressedNodeKeyboardNavigationLabel(e){return a.keyboardNavigationLabelProvider.getCompressedNodeKeyboardNavigationLabel(e.map(t=>t.element))}},stickyScrollDelegate:i.stickyScrollDelegate}}var wyt=class extends gv{constructor(e,t,o,n,r,s,l={}){super(e,t,o,r,s,l);this.compressionDelegate=n;this.compressibleNodeMapper=new Qae(e=>new hni(e));this.filter=l.filter}getCompressedTreeNode(e){let t=this.getDataNode(e);return this.tree.getCompressedTreeNode(t).element}createTree(e,t,o,n,r){let s=new Uwe(o),l=n.map(u=>new gni(u,this.nodeMapper,()=>this.compressibleNodeMapper,this._onDidChangeNodeSlowState.event)),c=RWo(r)||{};return new zwe(e,t,s,l,c)}asTreeElement(e,t){return{incompressible:this.compressionDelegate.isIncompressible(e.element),...super.asTreeElement(e,t)}}getViewState(){if(!this.identityProvider)throw new pg(this.user,"Can't get tree view state without an identity provider");let e=l=>this.identityProvider.getId(l).toString(),t=this.getFocus().map(e),o=this.getSelection().map(e),n=[],r=this.tree.getCompressedTreeNode(),s=[r];for(;s.length>0;){let l=s.pop();if(l!==r&&l.collapsible&&!l.collapsed)for(let c of l.element.elements)n.push(e(c.element));s.push(...l.children)}return{focus:t,selection:o,expanded:n,scrollTop:this.scrollTop}}render(e,t,o){if(!this.identityProvider)return super.render(e,t);let n=f=>this.identityProvider.getId(f).toString(),r=f=>{let v=new Set;for(let b of f){let S=this.tree.getCompressedTreeNode(b===this.root?null:b);if(S.element)for(let y of S.element.elements)v.add(n(y.element))}return v},s=r(this.tree.getSelection()),l=r(this.tree.getFocus());super.render(e,t,o);let c=this.getSelection(),u=!1,p=this.getFocus(),h=!1,g=f=>{let v=f.element;if(v)for(let b=0;b<v.elements.length;b++){let S=n(v.elements[b].element),y=v.elements[v.elements.length-1].element;s.has(S)&&c.indexOf(y)===-1&&(c.push(y),u=!0),l.has(S)&&p.indexOf(y)===-1&&(p.push(y),h=!0)}f.children.forEach(g)};g(this.tree.getCompressedTreeNode(e===this.root?null:e)),u&&this.setSelection(c),h&&this.setFocus(p)}processChildren(e){return this.filter&&(e=ht.filter(e,t=>{let o=this.filter.filter(t,1),n=MWo(o);if(n===2)throw new Error("Recursive tree visibility not supported in async data compressed trees");return n===1})),super.processChildren(e)}navigate(e){return super.navigate(e)}};function MWo(a){return typeof a=="boolean"?a?1:0:k7(a)?N1(a.visibility):N1(a)}var fni=class{constructor(i){this.navigator=i}current(){let i=this.navigator.current();return i===null?null:i.element}previous(){return this.navigator.previous(),this.current()}first(){return this.navigator.first(),this.current()}last(){return this.navigator.last(),this.current()}next(){return this.navigator.next(),this.current()}};var SE=class extends LW{constructor(e,t,o,n,r,s={}){super(e,t,o,n,s);this.user=e;this.dataSource=r;this.nodesByIdentity=new Map;this.identityProvider=s.identityProvider}getInput(){return this.input}setInput(e,t){if(t&&!this.identityProvider)throw new pg(this.user,"Can't restore tree view state without an identity provider");if(this.input=e,!e){this.nodesByIdentity.clear(),this.model.setChildren(null,ht.empty());return}if(!t){this._refresh(e);return}let o=[],n=[],r=l=>{let c=this.identityProvider.getId(l).toString();return!t.expanded[c]},s=l=>{let c=this.identityProvider.getId(l.element).toString();t.focus.has(c)&&o.push(l.element),t.selection.has(c)&&n.push(l.element)};this._refresh(e,r,s),this.setFocus(o),this.setSelection(n),t&&typeof t.scrollTop=="number"&&(this.scrollTop=t.scrollTop)}updateChildren(e=this.input){if(typeof this.input>"u")throw new pg(this.user,"Tree input not set");let t;this.identityProvider&&(t=o=>{let n=this.identityProvider.getId(o).toString(),r=this.nodesByIdentity.get(n);if(r)return r.collapsed}),this._refresh(e,t)}resort(e=this.input,t=!0){this.model.resort(e===this.input?null:e,t)}refresh(e){if(e===void 0){this.view.rerender();return}this.model.rerender(e)}_refresh(e,t,o){let n;if(this.identityProvider){let r=new Set,s=o;o=l=>{let c=this.identityProvider.getId(l.element).toString();r.add(c),this.nodesByIdentity.set(c,l),s?.(l)},n=l=>{let c=this.identityProvider.getId(l.element).toString();r.has(c)||this.nodesByIdentity.delete(c)}}this.model.setChildren(e===this.input?null:e,this.iterate(e,t).elements,{onDidCreateNode:o,onDidDeleteNode:n})}iterate(e,t){let o=[...this.dataSource.getChildren(e)];return{elements:ht.map(o,r=>{let{elements:s,size:l}=this.iterate(r,t),c=this.dataSource.hasChildren?this.dataSource.hasChildren(r):void 0,u=l===0?void 0:t&&t(r);return{element:r,children:s,collapsible:c,collapsed:u}}),size:o.length}}createModel(e,t){return new O1(e,t)}};var Cyt=new Q("isMac",it,d(1854,null)),Jae=new Q("isLinux",Wn,d(1853,null)),Zy=new Q("isWindows",ri,d(1858,null)),ep=new Q("isWeb",Gt,d(1857,null)),Mx=new Q("isMacNative",it&&!Gt,d(1855,null)),xyt=new Q("isIOS",Nc,d(1852,null)),t8i=new Q("isMobile",sbe,d(1856,null)),Gq=new Q("isDevelopment",!1,!0),RW=new Q("productQualityType","",d(1859,null)),Uu="inputFocus",$h=new Q(Uu,!1,d(1851,null));var fo=ae("listService"),Eyt=class{constructor(){this.disposables=new P;this.lists=[];this._lastFocusedWidget=void 0}get lastFocusedList(){return this._lastFocusedWidget}setLastFocusedList(i){i!==this._lastFocusedWidget&&(this._lastFocusedWidget?.getHTMLElement().classList.remove("last-focused"),this._lastFocusedWidget=i,this._lastFocusedWidget?.getHTMLElement().classList.add("last-focused"))}register(i,e){if(this.lists.some(o=>o.widget===i))throw new Error("Cannot register the same widget multiple times");let t={widget:i,extraContextKeys:e};return this.lists.push(t),sa(i.getHTMLElement())&&this.setLastFocusedList(i),hn(i.onDidFocus(()=>this.setLastFocusedList(i)),Z(()=>this.lists.splice(this.lists.indexOf(t),1)),i.onDidDispose(()=>{this.lists=this.lists.filter(o=>o!==t),this._lastFocusedWidget===i&&this.setLastFocusedList(void 0)}))}dispose(){this.disposables.dispose()}},F5e=new Q("listScrollAtBoundary","none"),Pyt=x.or(F5e.isEqualTo("top"),F5e.isEqualTo("both")),Ayt=x.or(F5e.isEqualTo("bottom"),F5e.isEqualTo("both")),B5e=new Q("listFocus",!0),Gwe=new Q("treestickyScrollFocused",!1),E7=new Q("listSupportsMultiselect",!0),rc=x.and(B5e,x.not(Uu),Gwe.negate()),H5e=new Q("listHasSelectionOrFocus",!1),AW=new Q("listDoubleSelection",!1),Ini=new Q("listMultiSelection",!1),Zae=new Q("listSelectionNavigation",!1),yni=new Q("listSupportsFind",!0),$we=new Q("treeElementCanCollapse",!1),wni=new Q("treeElementHasParent",!1),qwe=new Q("treeElementCanExpand",!1),Cni=new Q("treeElementHasChild",!1),xni=new Q("treeFindOpen",!1),o8i="listTypeNavigationMode",n8i="listAutomaticKeyboardNavigation";function Nyt(a,i){let e=a.createScoped(i.getHTMLElement());return B5e.bindTo(e),e}function Oyt(a,i){let e=F5e.bindTo(a),t=()=>{let o=i.scrollTop===0,n=i.scrollHeight-i.renderHeight-i.scrollTop<1;o&&n?e.set("both"):o?e.set("top"):n?e.set("bottom"):e.set("none")};return t(),i.onDidScroll(t)}var ele="workbench.list.multiSelectModifier",kyt="workbench.list.openMode",jM="workbench.list.horizontalScrolling",kni="workbench.list.defaultFindMode",Eni="workbench.list.typeNavigationMode",Tyt="workbench.list.keyboardNavigation",MW="workbench.list.scrollByPage",Tni="workbench.list.defaultFindMatchType",W5e="workbench.tree.indent",_yt="workbench.tree.renderIndentGuides",PW="workbench.list.smoothScrolling",W1="workbench.list.mouseWheelScrollSensitivity",V1="workbench.list.fastScrollSensitivity",Dyt="workbench.tree.expandMode",Lyt="workbench.tree.enableStickyScroll",Ryt="workbench.tree.stickyScrollMaxItemCount";function B1(a){return a.getValue(ele)==="alt"}var vni=class extends C{constructor(e){super();this.configurationService=e;this.useAltAsMultipleSelectionModifier=B1(e),this.registerListeners()}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration(ele)&&(this.useAltAsMultipleSelectionModifier=B1(this.configurationService))}))}isSelectionSingleChangeEvent(e){return this.useAltAsMultipleSelectionModifier?e.browserEvent.altKey:dti(e)}isSelectionRangeChangeEvent(e){return uti(e)}};function Fyt(a,i){let e=a.get(B),t=a.get(_e),o=new P;return[{...i,keyboardNavigationDelegate:{mightProducePrintableCharacter(r){return t.mightProducePrintableCharacter(r)}},smoothScrolling:!!e.getValue(PW),mouseWheelScrollSensitivity:e.getValue(W1),fastScrollSensitivity:e.getValue(V1),multipleSelectionController:i.multipleSelectionController??o.add(new vni(e)),keyboardNavigationEventFilter:PWo(t),scrollByPage:!!e.getValue(MW)},o]}var Rl=class extends hc{get onDidOpen(){return this.navigator.onDidOpen}constructor(i,e,t,o,n,r,s,l,c){let u=typeof n.horizontalScrolling<"u"?n.horizontalScrolling:!!l.getValue(jM),[p,h]=c.invokeFunction(Fyt,n);super(i,e,t,o,{keyboardSupport:!1,...p,horizontalScrolling:u}),this.disposables.add(h),this.contextKeyService=Nyt(r,this),this.disposables.add(Oyt(this.contextKeyService,this)),this.listSupportsMultiSelect=E7.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(n.multipleSelectionSupport!==!1),Zae.bindTo(this.contextKeyService).set(!!n.selectionNavigation),this.listHasSelectionOrFocus=H5e.bindTo(this.contextKeyService),this.listDoubleSelection=AW.bindTo(this.contextKeyService),this.listMultiSelection=Ini.bindTo(this.contextKeyService),this.horizontalScrolling=n.horizontalScrolling,this._useAltAsMultipleSelectionModifier=B1(l),this.disposables.add(this.contextKeyService),this.disposables.add(s.register(this)),this.updateStyles(n.overrideStyles),this.disposables.add(this.onDidChangeSelection(()=>{let f=this.getSelection(),v=this.getFocus();this.contextKeyService.bufferChangeEvents(()=>{this.listHasSelectionOrFocus.set(f.length>0||v.length>0),this.listMultiSelection.set(f.length>1),this.listDoubleSelection.set(f.length===2)})})),this.disposables.add(this.onDidChangeFocus(()=>{let f=this.getSelection(),v=this.getFocus();this.listHasSelectionOrFocus.set(f.length>0||v.length>0)})),this.disposables.add(l.onDidChangeConfiguration(f=>{f.affectsConfiguration(ele)&&(this._useAltAsMultipleSelectionModifier=B1(l));let v={};if(f.affectsConfiguration(jM)&&this.horizontalScrolling===void 0){let b=!!l.getValue(jM);v={...v,horizontalScrolling:b}}if(f.affectsConfiguration(MW)){let b=!!l.getValue(MW);v={...v,scrollByPage:b}}if(f.affectsConfiguration(PW)){let b=!!l.getValue(PW);v={...v,smoothScrolling:b}}if(f.affectsConfiguration(W1)){let b=l.getValue(W1);v={...v,mouseWheelScrollSensitivity:b}}if(f.affectsConfiguration(V1)){let b=l.getValue(V1);v={...v,fastScrollSensitivity:b}}Object.keys(v).length>0&&this.updateOptions(v)})),this.navigator=new Myt(this,{configurationService:l,...n}),this.disposables.add(this.navigator)}updateOptions(i){super.updateOptions(i),i.overrideStyles!==void 0&&this.updateStyles(i.overrideStyles),i.multipleSelectionSupport!==void 0&&this.listSupportsMultiSelect.set(!!i.multipleSelectionSupport)}updateStyles(i){this.style(i?GI(i):n7)}get useAltAsMultipleSelectionModifier(){return this._useAltAsMultipleSelectionModifier}};Rl=I([m(5,X),m(6,fo),m(7,B),m(8,F)],Rl);var F1=class extends A1{get onDidOpen(){return this.navigator.onDidOpen}constructor(i,e,t,o,n,r,s,l,c){let u=typeof n.horizontalScrolling<"u"?n.horizontalScrolling:!!l.getValue(jM),[p,h]=c.invokeFunction(Fyt,n);super(i,e,t,o,{keyboardSupport:!1,...p,horizontalScrolling:u}),this.disposables=new P,this.disposables.add(h),this.contextKeyService=Nyt(r,this),this.disposables.add(Oyt(this.contextKeyService,this.widget)),this.horizontalScrolling=n.horizontalScrolling,this.listSupportsMultiSelect=E7.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(n.multipleSelectionSupport!==!1),Zae.bindTo(this.contextKeyService).set(!!n.selectionNavigation),this._useAltAsMultipleSelectionModifier=B1(l),this.disposables.add(this.contextKeyService),this.disposables.add(s.register(this)),this.updateStyles(n.overrideStyles),this.disposables.add(l.onDidChangeConfiguration(f=>{f.affectsConfiguration(ele)&&(this._useAltAsMultipleSelectionModifier=B1(l));let v={};if(f.affectsConfiguration(jM)&&this.horizontalScrolling===void 0){let b=!!l.getValue(jM);v={...v,horizontalScrolling:b}}if(f.affectsConfiguration(MW)){let b=!!l.getValue(MW);v={...v,scrollByPage:b}}if(f.affectsConfiguration(PW)){let b=!!l.getValue(PW);v={...v,smoothScrolling:b}}if(f.affectsConfiguration(W1)){let b=l.getValue(W1);v={...v,mouseWheelScrollSensitivity:b}}if(f.affectsConfiguration(V1)){let b=l.getValue(V1);v={...v,fastScrollSensitivity:b}}Object.keys(v).length>0&&this.updateOptions(v)})),this.navigator=new Myt(this,{configurationService:l,...n}),this.disposables.add(this.navigator)}updateOptions(i){super.updateOptions(i),i.overrideStyles!==void 0&&this.updateStyles(i.overrideStyles),i.multipleSelectionSupport!==void 0&&this.listSupportsMultiSelect.set(!!i.multipleSelectionSupport)}updateStyles(i){this.style(i?GI(i):n7)}get useAltAsMultipleSelectionModifier(){return this._useAltAsMultipleSelectionModifier}dispose(){this.disposables.dispose(),super.dispose()}};F1=I([m(5,X),m(6,fo),m(7,B),m(8,F)],F1);var rC=class extends dO{get onDidOpen(){return this.navigator.onDidOpen}constructor(i,e,t,o,n,r,s,l,c,u){let p=typeof r.horizontalScrolling<"u"?r.horizontalScrolling:!!c.getValue(jM),[h,g]=u.invokeFunction(Fyt,r);super(i,e,t,o,n,{keyboardSupport:!1,...h,horizontalScrolling:p}),this.disposables.add(g),this.contextKeyService=Nyt(s,this),this.disposables.add(Oyt(this.contextKeyService,this)),this.listSupportsMultiSelect=E7.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(r.multipleSelectionSupport!==!1),Zae.bindTo(this.contextKeyService).set(!!r.selectionNavigation),this.listHasSelectionOrFocus=H5e.bindTo(this.contextKeyService),this.listDoubleSelection=AW.bindTo(this.contextKeyService),this.listMultiSelection=Ini.bindTo(this.contextKeyService),this.horizontalScrolling=r.horizontalScrolling,this._useAltAsMultipleSelectionModifier=B1(c),this.disposables.add(this.contextKeyService),this.disposables.add(l.register(this)),this.updateStyles(r.overrideStyles),this.disposables.add(this.onDidChangeSelection(()=>{let v=this.getSelection(),b=this.getFocus();this.contextKeyService.bufferChangeEvents(()=>{this.listHasSelectionOrFocus.set(v.length>0||b.length>0),this.listMultiSelection.set(v.length>1),this.listDoubleSelection.set(v.length===2)})})),this.disposables.add(this.onDidChangeFocus(()=>{let v=this.getSelection(),b=this.getFocus();this.listHasSelectionOrFocus.set(v.length>0||b.length>0)})),this.disposables.add(c.onDidChangeConfiguration(v=>{v.affectsConfiguration(ele)&&(this._useAltAsMultipleSelectionModifier=B1(c));let b={};if(v.affectsConfiguration(jM)&&this.horizontalScrolling===void 0){let S=!!c.getValue(jM);b={...b,horizontalScrolling:S}}if(v.affectsConfiguration(MW)){let S=!!c.getValue(MW);b={...b,scrollByPage:S}}if(v.affectsConfiguration(PW)){let S=!!c.getValue(PW);b={...b,smoothScrolling:S}}if(v.affectsConfiguration(W1)){let S=c.getValue(W1);b={...b,mouseWheelScrollSensitivity:S}}if(v.affectsConfiguration(V1)){let S=c.getValue(V1);b={...b,fastScrollSensitivity:S}}Object.keys(b).length>0&&this.updateOptions(b)})),this.navigator=new bni(this,{configurationService:c,...r}),this.disposables.add(this.navigator)}updateOptions(i){super.updateOptions(i),i.overrideStyles!==void 0&&this.updateStyles(i.overrideStyles),i.multipleSelectionSupport!==void 0&&this.listSupportsMultiSelect.set(!!i.multipleSelectionSupport)}updateStyles(i){this.style(i?GI(i):n7)}get useAltAsMultipleSelectionModifier(){return this._useAltAsMultipleSelectionModifier}dispose(){this.disposables.dispose(),super.dispose()}};rC=I([m(6,X),m(7,fo),m(8,B),m(9,F)],rC);function IE(a="keydown",i,e){let t=new KeyboardEvent(a);return t.preserveFocus=i,t.pinned=e,t.__forceEvent=!0,t}var V5e=class extends C{constructor(e,t){super();this.widget=e;this._onDidOpen=this._register(new E);this.onDidOpen=this._onDidOpen.event;this._register(H.filter(this.widget.onDidChangeSelection,o=>ag(o.browserEvent))(o=>this.onSelectionFromKeyboard(o))),this._register(this.widget.onPointer(o=>this.onPointer(o.element,o.browserEvent))),this._register(this.widget.onMouseDblClick(o=>this.onMouseDblClick(o.element,o.browserEvent))),typeof t?.openOnSingleClick!="boolean"&&t?.configurationService?(this.openOnSingleClick=t?.configurationService.getValue(kyt)!=="doubleClick",this._register(t?.configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration(kyt)&&(this.openOnSingleClick=t?.configurationService.getValue(kyt)!=="doubleClick")}))):this.openOnSingleClick=t?.openOnSingleClick??!0}onSelectionFromKeyboard(e){if(e.elements.length!==1)return;let t=e.browserEvent,o=typeof t.preserveFocus=="boolean"?t.preserveFocus:!0,n=typeof t.pinned=="boolean"?t.pinned:!o;this._open(this.getSelectedElement(),o,n,!1,e.browserEvent)}onPointer(e,t){if(!this.openOnSingleClick||t.detail===2)return;let n=t.button===1,r=!0,s=n,l=t.ctrlKey||t.metaKey||t.altKey;this._open(e,r,s,l,t)}onMouseDblClick(e,t){if(!t)return;let o=t.target;if(o.classList.contains("monaco-tl-twistie")||o.classList.contains("monaco-icon-label")&&o.classList.contains("folder-icon")&&t.offsetX<16)return;let r=!1,s=!0,l=t.ctrlKey||t.metaKey||t.altKey;this._open(e,r,s,l,t)}_open(e,t,o,n,r){e&&this._onDidOpen.fire({editorOptions:{preserveFocus:t,pinned:o,revealIfVisible:!0},sideBySide:n,element:e,browserEvent:r})}},Myt=class extends V5e{constructor(i,e){super(i,e),this.widget=i}getSelectedElement(){return this.widget.getSelectedElements()[0]}},bni=class extends V5e{constructor(i,e){super(i,e)}getSelectedElement(){return this.widget.getSelectedElements()[0]}},Sni=class extends V5e{constructor(i,e){super(i,e)}getSelectedElement(){return this.widget.getSelection()[0]??void 0}};function PWo(a){let i=!1;return e=>{if(e.toKeyCodeChord().isModifierKey())return!1;if(i)return i=!1,!1;let t=a.softDispatch(e,e.target);return t.kind===1?(i=!0,!1):(i=!1,t.kind===0)}}var mg=class extends Jy{get contextKeyService(){return this.internals.contextKeyService}get useAltAsMultipleSelectionModifier(){return this.internals.useAltAsMultipleSelectionModifier}get onDidOpen(){return this.internals.onDidOpen}constructor(i,e,t,o,n,r,s,l,c){let{options:u,getTypeNavigationMode:p,disposable:h}=r.invokeFunction(U5e,n);super(i,e,t,o,u),this.disposables.add(h),this.internals=new $q(this,n,p,n.overrideStyles,s,l,c),this.disposables.add(this.internals)}updateOptions(i){super.updateOptions(i),this.internals.updateOptions(i)}};mg=I([m(5,F),m(6,X),m(7,fo),m(8,B)],mg);var PL=class extends zwe{get contextKeyService(){return this.internals.contextKeyService}get useAltAsMultipleSelectionModifier(){return this.internals.useAltAsMultipleSelectionModifier}get onDidOpen(){return this.internals.onDidOpen}constructor(i,e,t,o,n,r,s,l,c){let{options:u,getTypeNavigationMode:p,disposable:h}=r.invokeFunction(U5e,n);super(i,e,t,o,u),this.disposables.add(h),this.internals=new $q(this,n,p,n.overrideStyles,s,l,c),this.disposables.add(this.internals)}updateOptions(i={}){super.updateOptions(i),i.overrideStyles&&this.internals.updateStyleOverrides(i.overrideStyles),this.internals.updateOptions(i)}};PL=I([m(5,F),m(6,X),m(7,fo),m(8,B)],PL);var pO=class extends SE{get contextKeyService(){return this.internals.contextKeyService}get useAltAsMultipleSelectionModifier(){return this.internals.useAltAsMultipleSelectionModifier}get onDidOpen(){return this.internals.onDidOpen}constructor(i,e,t,o,n,r,s,l,c,u){let{options:p,getTypeNavigationMode:h,disposable:g}=s.invokeFunction(U5e,r);super(i,e,t,o,n,p),this.disposables.add(g),this.internals=new $q(this,r,h,r.overrideStyles,l,c,u),this.disposables.add(this.internals)}updateOptions(i={}){super.updateOptions(i),i.overrideStyles!==void 0&&this.internals.updateStyleOverrides(i.overrideStyles),this.internals.updateOptions(i)}};pO=I([m(6,F),m(7,X),m(8,fo),m(9,B)],pO);var nu=class extends gv{get contextKeyService(){return this.internals.contextKeyService}get useAltAsMultipleSelectionModifier(){return this.internals.useAltAsMultipleSelectionModifier}get onDidOpen(){return this.internals.onDidOpen}constructor(i,e,t,o,n,r,s,l,c,u){let{options:p,getTypeNavigationMode:h,disposable:g}=s.invokeFunction(U5e,r);super(i,e,t,o,n,p),this.disposables.add(g),this.internals=new $q(this,r,h,r.overrideStyles,l,c,u),this.disposables.add(this.internals)}updateOptions(i={}){super.updateOptions(i),i.overrideStyles&&this.internals.updateStyleOverrides(i.overrideStyles),this.internals.updateOptions(i)}};nu=I([m(6,F),m(7,X),m(8,fo),m(9,B)],nu);var qI=class extends wyt{get contextKeyService(){return this.internals.contextKeyService}get useAltAsMultipleSelectionModifier(){return this.internals.useAltAsMultipleSelectionModifier}get onDidOpen(){return this.internals.onDidOpen}constructor(i,e,t,o,n,r,s,l,c,u,p){let{options:h,getTypeNavigationMode:g,disposable:f}=l.invokeFunction(U5e,s);super(i,e,t,o,n,r,h),this.disposables.add(f),this.internals=new $q(this,s,g,s.overrideStyles,c,u,p),this.disposables.add(this.internals)}updateOptions(i){super.updateOptions(i),this.internals.updateOptions(i)}};qI=I([m(7,F),m(8,X),m(9,fo),m(10,B)],qI);function r8i(a){let i=a.getValue(kni);if(i==="highlight")return 0;if(i==="filter")return 1;let e=a.getValue(Tyt);if(e==="simple"||e==="highlight")return 0;if(e==="filter")return 1}function s8i(a){let i=a.getValue(Tni);if(i==="fuzzy")return 0;if(i==="contiguous")return 1}function U5e(a,i){let e=a.get(B),t=a.get(_n),o=a.get(X),n=a.get(F),r=()=>{let h=o.getContextKeyValue(o8i);if(h==="automatic")return 0;if(h==="trigger")return 1;if(o.getContextKeyValue(n8i)===!1)return 1;let f=e.getValue(Eni);if(f==="automatic")return 0;if(f==="trigger")return 1},s=i.horizontalScrolling!==void 0?i.horizontalScrolling:!!e.getValue(jM),[l,c]=n.invokeFunction(Fyt,i),u=i.paddingBottom,p=i.renderIndentGuides!==void 0?i.renderIndentGuides:e.getValue(_yt);return{getTypeNavigationMode:r,disposable:c,options:{keyboardSupport:!1,...l,indent:typeof e.getValue(W5e)=="number"?e.getValue(W5e):void 0,renderIndentGuides:p,smoothScrolling:!!e.getValue(PW),defaultFindMode:i.defaultFindMode??r8i(e),defaultFindMatchType:i.defaultFindMatchType??s8i(e),horizontalScrolling:s,scrollByPage:!!e.getValue(MW),paddingBottom:u,hideTwistiesOfChildlessElements:i.hideTwistiesOfChildlessElements,expandOnlyOnTwistieClick:i.expandOnlyOnTwistieClick??e.getValue(Dyt)==="doubleClick",contextViewProvider:t,findWidgetStyles:x4i,enableStickyScroll:!!e.getValue(Lyt),stickyScrollMaxItemCount:Number(e.getValue(Ryt))}}}var $q=class{constructor(i,e,t,o,n,r,s){this.tree=i;this.disposables=[];this.contextKeyService=Nyt(n,i),this.disposables.push(Oyt(this.contextKeyService,i)),this.listSupportsMultiSelect=E7.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(e.multipleSelectionSupport!==!1),Zae.bindTo(this.contextKeyService).set(!!e.selectionNavigation),this.listSupportFindWidget=yni.bindTo(this.contextKeyService),this.listSupportFindWidget.set(e.findWidgetEnabled??!0),this.hasSelectionOrFocus=H5e.bindTo(this.contextKeyService),this.hasDoubleSelection=AW.bindTo(this.contextKeyService),this.hasMultiSelection=Ini.bindTo(this.contextKeyService),this.treeElementCanCollapse=$we.bindTo(this.contextKeyService),this.treeElementHasParent=wni.bindTo(this.contextKeyService),this.treeElementCanExpand=qwe.bindTo(this.contextKeyService),this.treeElementHasChild=Cni.bindTo(this.contextKeyService),this.treeFindOpen=xni.bindTo(this.contextKeyService),this.treeStickyScrollFocused=Gwe.bindTo(this.contextKeyService),this._useAltAsMultipleSelectionModifier=B1(s),this.updateStyleOverrides(o);let c=()=>{let p=i.getFocus()[0];if(!p)return;let h=i.getNode(p);this.treeElementCanCollapse.set(h.collapsible&&!h.collapsed),this.treeElementHasParent.set(!!i.getParentElement(p)),this.treeElementCanExpand.set(h.collapsible&&h.collapsed),this.treeElementHasChild.set(!!i.getFirstElementChild(p))},u=new Set;u.add(o8i),u.add(n8i),this.disposables.push(this.contextKeyService,r.register(i),i.onDidChangeSelection(()=>{let p=i.getSelection(),h=i.getFocus();this.contextKeyService.bufferChangeEvents(()=>{this.hasSelectionOrFocus.set(p.length>0||h.length>0),this.hasMultiSelection.set(p.length>1),this.hasDoubleSelection.set(p.length===2)})}),i.onDidChangeFocus(()=>{let p=i.getSelection(),h=i.getFocus();this.hasSelectionOrFocus.set(p.length>0||h.length>0),c()}),i.onDidChangeCollapseState(c),i.onDidChangeModel(c),i.onDidChangeFindOpenState(p=>this.treeFindOpen.set(p)),i.onDidChangeStickyScrollFocused(p=>this.treeStickyScrollFocused.set(p)),s.onDidChangeConfiguration(p=>{let h={};if(p.affectsConfiguration(ele)&&(this._useAltAsMultipleSelectionModifier=B1(s)),p.affectsConfiguration(W5e)){let g=s.getValue(W5e);h={...h,indent:g}}if(p.affectsConfiguration(_yt)&&e.renderIndentGuides===void 0){let g=s.getValue(_yt);h={...h,renderIndentGuides:g}}if(p.affectsConfiguration(PW)){let g=!!s.getValue(PW);h={...h,smoothScrolling:g}}if(p.affectsConfiguration(kni)||p.affectsConfiguration(Tyt)){let g=r8i(s);h={...h,defaultFindMode:g}}if(p.affectsConfiguration(Eni)||p.affectsConfiguration(Tyt)){let g=t();h={...h,typeNavigationMode:g}}if(p.affectsConfiguration(Tni)){let g=s8i(s);h={...h,defaultFindMatchType:g}}if(p.affectsConfiguration(jM)&&e.horizontalScrolling===void 0){let g=!!s.getValue(jM);h={...h,horizontalScrolling:g}}if(p.affectsConfiguration(MW)){let g=!!s.getValue(MW);h={...h,scrollByPage:g}}if(p.affectsConfiguration(Dyt)&&e.expandOnlyOnTwistieClick===void 0&&(h={...h,expandOnlyOnTwistieClick:s.getValue(Dyt)==="doubleClick"}),p.affectsConfiguration(Lyt)){let g=s.getValue(Lyt);h={...h,enableStickyScroll:g}}if(p.affectsConfiguration(Ryt)){let g=Math.max(1,s.getValue(Ryt));h={...h,stickyScrollMaxItemCount:g}}if(p.affectsConfiguration(W1)){let g=s.getValue(W1);h={...h,mouseWheelScrollSensitivity:g}}if(p.affectsConfiguration(V1)){let g=s.getValue(V1);h={...h,fastScrollSensitivity:g}}Object.keys(h).length>0&&i.updateOptions(h)}),this.contextKeyService.onDidChangeContext(p=>{p.affectsSome(u)&&i.updateOptions({typeNavigationMode:t()})})),this.navigator=new Sni(i,{configurationService:s,...e}),this.disposables.push(this.navigator)}get onDidOpen(){return this.navigator.onDidOpen}get useAltAsMultipleSelectionModifier(){return this._useAltAsMultipleSelectionModifier}updateOptions(i){i.multipleSelectionSupport!==void 0&&this.listSupportsMultiSelect.set(!!i.multipleSelectionSupport)}updateStyleOverrides(i){this.tree.style(i?GI(i):n7)}dispose(){this.disposables=Ue(this.disposables)}};$q=I([m(4,X),m(5,fo),m(6,B)],$q);var AWo=oe.as(ii.Configuration);AWo.registerConfiguration({id:"workbench",order:7,title:d(2139,null),type:"object",properties:{[ele]:{type:"string",enum:["ctrlCmd","alt"],markdownEnumDescriptions:[d(2132,null),d(2131,null)],default:"ctrlCmd",description:d(2130,null)},[kyt]:{type:"string",enum:["singleClick","doubleClick"],default:"singleClick",description:d(2133,null)},[jM]:{type:"boolean",default:!1,description:d(2121,null)},[MW]:{type:"boolean",default:!1,description:d(2128,null)},[W5e]:{type:"number",default:8,minimum:4,maximum:40,description:d(2137,null)},[_yt]:{type:"string",enum:["none","onHover","always"],default:"onHover",description:d(2134,null)},[PW]:{type:"boolean",default:!1,description:d(2127,null)},[W1]:{type:"number",default:1,markdownDescription:d(2129,null)},[V1]:{type:"number",default:5,markdownDescription:d(2120,null)},[kni]:{type:"string",enum:["highlight","filter"],enumDescriptions:[d(2118,null),d(2117,null)],default:"highlight",description:d(2116,null)},[Tyt]:{type:"string",enum:["simple","highlight","filter"],enumDescriptions:[d(2125,null),d(2124,null),d(2123,null)],default:"highlight",description:d(2122,null),deprecated:!0,deprecationMessage:d(2126,null)},[Tni]:{type:"string",enum:["fuzzy","contiguous"],enumDescriptions:[d(2115,null),d(2114,null)],default:"fuzzy",description:d(2113,null)},[Dyt]:{type:"string",enum:["singleClick","doubleClick"],default:"singleClick",description:d(2119,null)},[Lyt]:{type:"boolean",default:!0,description:d(2135,null)},[Ryt]:{type:"number",minimum:1,default:7,markdownDescription:d(2136,null,"`#workbench.tree.enableStickyScroll#`")},[Eni]:{type:"string",enum:["automatic","trigger"],default:"automatic",markdownDescription:d(2138,null)}}});var AL=class{constructor(i,e,t,o){this.isProviderFirst=i;this.parent=e;this.link=t;this._rangeCallback=o;this.id=fq.nextId()}get uri(){return this.link.uri}get range(){return this._range??this.link.targetSelectionRange??this.link.range}set range(i){this._range=i,this._rangeCallback(this)}get ariaMessage(){let i=this.parent.getPreview(this)?.preview(this.range);return i?d(1243,null,i.value,Ye(this.uri),this.range.startLineNumber,this.range.startColumn):d(1242,null,Ye(this.uri),this.range.startLineNumber,this.range.startColumn)}},_ni=class{constructor(i){this._modelReference=i}dispose(){this._modelReference.dispose()}preview(i,e=8){let t=this._modelReference.object.textEditorModel;if(!t)return;let{startLineNumber:o,startColumn:n,endLineNumber:r,endColumn:s}=i,l=t.getWordUntilPosition({lineNumber:o,column:n-e}),c=new z(o,l.startColumn,o,n),u=new z(r,s,r,1073741824),p=t.getValueInRange(c).replace(/^\s+/,""),h=t.getValueInRange(i),g=t.getValueInRange(u).replace(/\s+$/,"");return{value:p+h+g,highlight:{start:p.length,end:p.length+h.length}}}},H1=class{constructor(i,e){this.parent=i;this.uri=e;this.children=[];this._previews=new vt}dispose(){Ue(this._previews.values()),this._previews.clear()}getPreview(i){return this._previews.get(i.uri)}get ariaMessage(){let i=this.children.length;return i===1?d(1240,null,Ye(this.uri),this.uri.fsPath):d(1241,null,i,Ye(this.uri),this.uri.fsPath)}async resolve(i){if(this._previews.size!==0)return this;for(let e of this.children)if(!this._previews.has(e.uri))try{let t=await i.createModelReference(e.uri);this._previews.set(e.uri,new _ni(t))}catch(t){mt(t)}return this}},ew=class a{constructor(i,e){this.groups=[];this.references=[];this._onDidChangeReferenceRange=new E;this.onDidChangeReferenceRange=this._onDidChangeReferenceRange.event;this._links=i,this._title=e;let[t]=i;i.sort(a._compareReferences);let o;for(let n of i)if((!o||!ar.isEqual(o.uri,n.uri,!0))&&(o=new H1(this,n.uri),this.groups.push(o)),o.children.length===0||a._compareReferences(n,o.children[o.children.length-1])!==0){let r=new AL(t===n,o,n,s=>this._onDidChangeReferenceRange.fire(s));this.references.push(r),o.children.push(r)}}dispose(){Ue(this.groups),this._onDidChangeReferenceRange.dispose(),this.groups.length=0}clone(){return new a(this._links,this._title)}get title(){return this._title}get isEmpty(){return this.groups.length===0}get ariaMessage(){return this.isEmpty?d(1244,null):this.references.length===1?d(1245,null,this.references[0].uri.fsPath):this.groups.length===1?d(1246,null,this.references.length,this.groups[0].uri.fsPath):d(1247,null,this.references.length,this.groups.length)}nextOrPreviousReference(i,e){let{parent:t}=i,o=t.children.indexOf(i),n=t.children.length,r=t.parent.groups.length;return r===1||e&&o+1<n||!e&&o>0?(e?o=(o+1)%n:o=(o+n-1)%n,t.children[o]):(o=t.parent.groups.indexOf(t),e?(o=(o+1)%r,t.parent.groups[o].children[0]):(o=(o+r-1)%r,t.parent.groups[o].children[t.parent.groups[o].children.length-1]))}nearestReference(i,e){let t=this.references.map((o,n)=>({idx:n,prefixLen:Ng(o.uri.toString(),i.toString()),offsetDist:Math.abs(o.range.startLineNumber-e.lineNumber)*100+Math.abs(o.range.startColumn-e.column)})).sort((o,n)=>o.prefixLen>n.prefixLen?-1:o.prefixLen<n.prefixLen?1:o.offsetDist<n.offsetDist?-1:o.offsetDist>n.offsetDist?1:0)[0];if(t)return this.references[t.idx]}referenceAt(i,e){for(let t of this.references)if(t.uri.toString()===i.toString()&&z.containsPosition(t.range,e))return t}firstReference(){for(let i of this.references)if(i.isProviderFirst)return i;return this.references[0]}static _compareReferences(i,e){return ar.compare(i.uri,e.uri)||z.compareRangesUsingStarts(i.range,e.range)}};var fv=class extends C{constructor(e,t,o){super();this.options=t;this.styles=o;this.count=0;this.hover=this._register(new me);this.element=R(e,_(".monaco-count-badge")),this._register(Z(()=>e.removeChild(this.element))),this.countFormat=this.options.countFormat||"{0}",this.titleFormat=this.options.titleFormat||"",this.setCount(this.options.count||0),this.updateHover()}setCount(e){this.count=e,this.render()}setCountFormat(e){this.countFormat=e,this.render()}setTitleFormat(e){this.titleFormat=e,this.updateHover(),this.render()}updateHover(){this.titleFormat!==""&&!this.hover.value?this.hover.value=yp().setupDelayedHoverAtMouse(this.element,()=>({content:id(this.titleFormat,this.count),appearance:{compact:!0}})):this.titleFormat===""&&this.hover.value&&(this.hover.value=void 0)}render(){this.element.textContent=id(this.countFormat,this.count),this.element.style.backgroundColor=this.styles.badgeBackground??"",this.element.style.color=this.styles.badgeForeground??"",this.styles.badgeBorder&&(this.element.style.border=`1px solid ${this.styles.badgeBorder}`)}};var Oa=class a extends C{constructor(e,t){super();this.options=t;this.text="";this.title="";this.highlights=[];this.didEverRender=!1;this.domNode=R(e,_("span.monaco-highlighted-label"))}get element(){return this.domNode}set(e,t=[],o="",n,r){e||(e=""),n&&(e=a.escapeNewLines(e,t)),!(this.didEverRender&&this.text===e&&this.title===o&&uo(this.highlights,t))&&(this.text=e,this.title=o,this.highlights=t,this.render(r))}render(e){let t=[],o=0;for(let n of this.highlights){if(n.end===n.start)continue;if(o<n.start){let l=this.text.substring(o,n.start);e?t.push(...Bn(l)):t.push(l),o=n.start}let r=this.text.substring(o,n.end),s=_("span.highlight",void 0,...e?Bn(r):[r]);n.extraClasses&&s.classList.add(...n.extraClasses),t.push(s),o=n.end}if(o<this.text.length){let n=this.text.substring(o);e?t.push(...Bn(n)):t.push(n)}if(Fi(this.domNode,...t),!this.customHover&&this.title!==""){let n=this.options?.hoverDelegate??Ni("mouse");this.customHover=this._register(yp().setupManagedHover(n,this.domNode,this.title))}else this.customHover&&this.customHover.update(this.title);this.didEverRender=!0}static escapeNewLines(e,t){let o=0,n=0;return e.replace(/\r\n|\r|\n/g,(r,s)=>{n=r===`\r
`?-1:0,s+=o;for(let l of t)l.end<=s||(l.start>=s&&(l.start+=n),l.end>=s&&(l.end+=n));return o+=n,"\u23CE"})}};var tle=class{constructor(i){this._element=i}get element(){return this._element}set textContent(i){this.disposed||i===this._textContent||(this._textContent=i,this._element.textContent=i)}set classNames(i){this.disposed||uo(i,this._classNames)||(this._classNames=i,this._element.classList.value="",this._element.classList.add(...i))}set empty(i){this.disposed||i===this._empty||(this._empty=i,this._element.style.marginLeft=i?"0":"")}dispose(){this.disposed=!0}},Lc=class extends C{constructor(e,t){super();this.customHovers=new Map;this.creationOptions=t,this.domNode=this._register(new tle(R(e,_(".monaco-icon-label")))),this.labelContainer=R(this.domNode.element,_(".monaco-icon-label-container")),this.nameContainer=R(this.labelContainer,_("span.monaco-icon-name-container")),t?.supportHighlights||t?.supportIcons?this.nameNode=this._register(new Lni(this.nameContainer,!!t.supportIcons)):this.nameNode=new Dni(this.nameContainer),this.hoverDelegate=t?.hoverDelegate??Ni("mouse")}get element(){return this.domNode.element}setLabel(e,t,o){let n=["monaco-icon-label"],r=["monaco-icon-label-container"],s="";o&&(o.extraClasses&&n.push(...o.extraClasses),o.bold&&n.push("bold"),o.italic&&n.push("italic"),o.strikethrough&&n.push("strikethrough"),o.disabledCommand&&r.push("disabled"),o.title&&(typeof o.title=="string"?s+=o.title:s+=e));let l=this.domNode.element.querySelector(".monaco-icon-label-iconpath");if(o?.iconPath){let c;if(!l||!Ao(l)?(c=_(".monaco-icon-label-iconpath"),this.domNode.element.prepend(c)):c=l,q.isThemeIcon(o.iconPath)){let u=q.asClassName(o.iconPath);c.className=`monaco-icon-label-iconpath ${u}`,c.style.backgroundImage=""}else c.style.backgroundImage=Na(o?.iconPath);c.style.backgroundRepeat="no-repeat",c.style.backgroundPosition="center",c.style.backgroundSize="contain"}else l&&l.remove();if(this.domNode.classNames=n,this.domNode.element.setAttribute("aria-label",s),this.labelContainer.classList.value="",this.labelContainer.classList.add(...r),this.setupHover(o?.descriptionTitle?this.labelContainer:this.element,o?.title),this.nameNode.setLabel(e,o),t||this.descriptionNode){let c=this.getOrCreateDescriptionNode();if(c instanceof Oa){let u=o?.supportIcons??this.creationOptions?.supportIcons;c.set(t||"",o?o.descriptionMatches:void 0,void 0,o?.labelEscapeNewLines,u),this.setupHover(c.element,o?.descriptionTitle)}else c.textContent=t&&o?.labelEscapeNewLines?Oa.escapeNewLines(t,[]):t||"",this.setupHover(c.element,o?.descriptionTitle||""),c.empty=!t}if(o?.suffix||this.suffixNode){let c=this.getOrCreateSuffixNode();c.textContent=o?.suffix??""}}setupHover(e,t){let o=this.customHovers.get(e);if(o&&(o.dispose(),this.customHovers.delete(e)),!t){e.removeAttribute("title");return}let n=e;if(this.creationOptions?.hoverTargetOverride){if(!gs(e,this.creationOptions.hoverTargetOverride))throw new Error("hoverTargetOverrride must be an ancestor of the htmlElement");n=this.creationOptions.hoverTargetOverride}let r=yp().setupManagedHover(this.hoverDelegate,n,t);r&&this.customHovers.set(e,r)}dispose(){super.dispose();for(let e of this.customHovers.values())e.dispose();this.customHovers.clear()}getOrCreateSuffixNode(){if(!this.suffixNode){let e=this._register(new tle(emt(this.nameContainer,_("span.monaco-icon-suffix-container"))));this.suffixNode=this._register(new tle(R(e.element,_("span.label-suffix"))))}return this.suffixNode}getOrCreateDescriptionNode(){if(!this.descriptionNode){let e=this._register(new tle(R(this.labelContainer,_("span.monaco-icon-description-container"))));this.creationOptions?.supportDescriptionHighlights?this.descriptionNode=this._register(new Oa(R(e.element,_("span.label-description")))):this.descriptionNode=this._register(new tle(R(e.element,_("span.label-description"))))}return this.descriptionNode}},Dni=class{constructor(i){this.container=i;this.label=void 0;this.singleLabel=void 0}setLabel(i,e){if(!(this.label===i&&uo(this.options,e)))if(this.label=i,this.options=e,typeof i=="string")this.singleLabel||(this.container.textContent="",this.container.classList.remove("multiple"),this.singleLabel=R(this.container,_("a.label-name",{id:e?.domId}))),this.singleLabel.textContent=i;else{this.container.textContent="",this.container.classList.add("multiple"),this.singleLabel=void 0;for(let t=0;t<i.length;t++){let o=i[t],n=e?.domId&&`${e?.domId}_${t}`;R(this.container,_("a.label-name",{id:n,"data-icon-label-count":i.length,"data-icon-label-index":t,role:"treeitem"},o)),t<i.length-1&&R(this.container,_("span.label-separator",void 0,e?.separator||"/"))}}}};function NWo(a,i,e){if(!e)return;let t=0;return a.map(o=>{let n={start:t,end:t+o.length},r=e.map(s=>qb.intersect(n,s)).filter(s=>!qb.isEmpty(s)).map(({start:s,end:l})=>({start:s-t,end:l-t}));return t=n.end+i.length,r})}var Lni=class extends C{constructor(e,t){super();this.container=e;this.supportIcons=t;this.label=void 0;this.singleLabel=void 0}setLabel(e,t){if(this.label===e&&uo(this.options,t))return;this.label=e,this.options=t;let o=t?.supportIcons??this.supportIcons;if(typeof e=="string")this.singleLabel||(this.container.textContent="",this.container.classList.remove("multiple"),this.singleLabel=this._register(new Oa(R(this.container,_("a.label-name",{id:t?.domId}))))),this.singleLabel.set(e,t?.matches,void 0,t?.labelEscapeNewLines,o);else{this.container.textContent="",this.container.classList.add("multiple"),this.singleLabel=void 0;let n=t?.separator||"/",r=NWo(e,n,t?.matches);for(let s=0;s<e.length;s++){let l=e[s],c=r?r[s]:void 0,u=t?.domId&&`${t?.domId}_${s}`,p=_("a.label-name",{id:u,"data-icon-label-count":e.length,"data-icon-label-index":s,role:"treeitem"});this._register(new Oa(R(this.container,p))).set(l,c,void 0,t?.labelEscapeNewLines,o),s<e.length-1&&R(p,_("span.label-separator",void 0,n))}}}};var ot=ae("labelService");var jwe=class{constructor(i){this._resolverService=i}hasChildren(i){return i instanceof ew||i instanceof H1}getChildren(i){if(i instanceof ew)return i.groups;if(i instanceof H1)return i.resolve(this._resolverService).then(e=>e.children);throw new Error("bad tree")}};jwe=I([m(0,Nt)],jwe);var Wyt=class{getHeight(){return 23}getTemplateId(i){return i instanceof H1?jq.id:K5e.id}},Qwe=class{constructor(i){this._keybindingService=i}getKeyboardNavigationLabel(i){if(i instanceof AL){let e=i.parent.getPreview(i)?.preview(i.range);if(e)return e.value}return Ye(i.uri)}mightProducePrintableCharacter(i){return this._keybindingService.mightProducePrintableCharacter(i)}};Qwe=I([m(0,_e)],Qwe);var Vyt=class{getId(i){return i instanceof AL?i.id:i.uri}},z5e=class extends C{constructor(e,t){super();this._labelService=t;let o=document.createElement("div");o.classList.add("reference-file"),this.file=this._register(new Lc(o,{supportHighlights:!0})),this.badge=this._register(new fv(R(o,_(".count")),{},BS)),e.appendChild(o)}set(e,t){let o=ci(e.uri);this.file.setLabel(this._labelService.getUriBasenameLabel(e.uri),this._labelService.getUriLabel(o,{relative:!0}),{title:this._labelService.getUriLabel(e.uri),matches:t});let n=e.children.length;this.badge.setCount(n),n>1?this.badge.setTitleFormat(d(1235,null,n)):this.badge.setTitleFormat(d(1234,null,n))}};z5e=I([m(1,ot)],z5e);var jq=class{constructor(i){this._instantiationService=i;this.templateId=jq.id}static{this.id="FileReferencesRenderer"}renderTemplate(i){return this._instantiationService.createInstance(z5e,i)}renderElement(i,e,t){t.set(i.element,ua(i.filterData))}disposeTemplate(i){i.dispose()}};jq=I([m(0,F)],jq);var Rni=class extends C{constructor(i){super(),this.label=this._register(new Oa(i))}set(i,e){let t=i.parent.getPreview(i)?.preview(i.range);if(!t||!t.value)this.label.set(`${Ye(i.uri)}:${i.range.startLineNumber+1}:${i.range.startColumn+1}`);else{let{value:o,highlight:n}=t;e&&!uv.isDefault(e)?(this.label.element.classList.toggle("referenceMatch",!1),this.label.set(o,ua(e))):(this.label.element.classList.toggle("referenceMatch",!0),this.label.set(o,[n]))}}},K5e=class a{constructor(){this.templateId=a.id}static{this.id="OneReferenceRenderer"}renderTemplate(i){return new Rni(i)}renderElement(i,e,t){t.set(i.element,i.filterData)}disposeTemplate(i){i.dispose()}},Byt=class{getWidgetAriaLabel(){return d(1236,null)}getAriaLabel(i){return i.ariaMessage}};var Mni=class a{constructor(i,e){this._editor=i;this._model=e;this._decorations=new Map;this._decorationIgnoreSet=new Set;this._callOnDispose=new P;this._callOnModelChange=new P;this._callOnDispose.add(this._editor.onDidChangeModel(()=>this._onModelChanged())),this._onModelChanged()}static{this.DecorationOptions=po.register({description:"reference-decoration",stickiness:1,className:"reference-decoration"})}dispose(){this._callOnModelChange.dispose(),this._callOnDispose.dispose(),this.removeDecorations()}_onModelChanged(){this._callOnModelChange.clear();let i=this._editor.getModel();if(i){for(let e of this._model.references)if(e.uri.toString()===i.uri.toString()){this._addDecorations(e.parent);return}}}_addDecorations(i){if(!this._editor.hasModel())return;this._callOnModelChange.add(this._editor.getModel().onDidChangeDecorations(()=>this._onDecorationChanged()));let e=[],t=[];for(let o=0,n=i.children.length;o<n;o++){let r=i.children[o];this._decorationIgnoreSet.has(r.id)||r.uri.toString()===this._editor.getModel().uri.toString()&&(e.push({range:r.range,options:a.DecorationOptions}),t.push(o))}this._editor.changeDecorations(o=>{let n=o.deltaDecorations([],e);for(let r=0;r<n.length;r++)this._decorations.set(n[r],i.children[t[r]])})}_onDecorationChanged(){let i=[],e=this._editor.getModel();if(e){for(let[t,o]of this._decorations){let n=e.getDecorationRange(t);if(!n)continue;let r=!1;if(!z.equalsRange(n,o.range)){if(z.spansMultipleLines(n))r=!0;else{let s=o.range.endColumn-o.range.startColumn,l=n.endColumn-n.startColumn;s!==l&&(r=!0)}r?(this._decorationIgnoreSet.add(o.id),i.push(t)):o.range=n}}for(let t=0,o=i.length;t<o;t++)this._decorations.delete(i[t]);this._editor.removeDecorations(i)}}removeDecorations(){this._editor.removeDecorations([...this._decorations.keys()]),this._decorations.clear()}},Hyt=class{constructor(){this.ratio=.7;this.heightInLines=18}static fromJSON(i){let e,t;try{let o=JSON.parse(i);e=o.ratio,t=o.heightInLines}catch{}return{ratio:e||.7,heightInLines:t||18}}},Pni=class extends nu{},G5e=class{constructor(i){this.labelService=i;this.disposables=new P}getDragURI(i){return i instanceof H1?i.uri.toString():i instanceof AL?fL(i.uri,i.range).toString():null}getDragLabel(i){return i.length===0?void 0:i.map(t=>this.labelService.getUriBasenameLabel(t.uri)).join(", ")}onDragStart(i,e){if(!e.dataTransfer)return;let o=i.elements.map(n=>this.getDragURI(n)).filter(Boolean);o.length&&(e.dataTransfer.setData(Aa.RESOURCES,JSON.stringify(o)),e.dataTransfer.setData(Aa.TEXT,o.join(`
`)))}onDragOver(){return!1}drop(){}dispose(){this.disposables.dispose()}};G5e=I([m(0,ot)],G5e);var Ywe=class extends bE{constructor(e,t,o,n,r,s,l,c,u){super(e,{showFrame:!1,showArrow:!0,isResizeable:!0,isAccessible:!0,supportOnTitleClick:!0},s);this._defaultTreeKeyboardSupport=t;this.layoutData=o;this._textModelResolverService=r;this._instantiationService=s;this._peekViewService=l;this._uriLabel=c;this._keybindingService=u;this._disposeOnNewModel=new P;this._callOnDispose=new P;this._onDidSelectReference=this._callOnDispose.add(new E);this.onDidSelectReference=this._onDidSelectReference.event;this._dim=new ai(0,0);this._isClosing=!1;this._applyTheme(n.getColorTheme()),this._callOnDispose.add(n.onDidColorThemeChange(this._applyTheme.bind(this))),this._peekViewService.addExclusiveWidget(e,this),this.create()}get isClosing(){return this._isClosing}dispose(){this._isClosing=!0,this.setModel(void 0),this._callOnDispose.dispose(),this._disposeOnNewModel.dispose(),Ue(this._preview),Ue(this._previewNotAvailableMessage),Ue(this._tree),Ue(this._previewModelReference),this._splitView.dispose(),super.dispose()}_applyTheme(e){let t=e.getColor(p_)||Oe.transparent;this.style({arrowColor:t,frameColor:t,headerBackgroundColor:e.getColor(DW)||Oe.transparent,primaryHeadingColor:e.getColor(lO),secondaryHeadingColor:e.getColor(cO)})}show(e){super.show(e,this.layoutData.heightInLines||18)}focusOnReferenceTree(){this._tree.domFocus()}focusOnPreviewEditor(){this._preview.focus()}isPreviewEditorFocused(){return this._preview.hasTextFocus()}_onTitleClick(e){this._preview&&this._preview.getModel()&&this._onDidSelectReference.fire({element:this._getFocusedReference(),kind:e.ctrlKey||e.metaKey||e.altKey?"side":"open",source:"title"})}_fillBody(e){this.setCssClass("reference-zone-widget"),this._messageContainer=R(e,_("div.messages")),xo(this._messageContainer),this._splitView=new vu(e,{orientation:1}),this._previewContainer=R(e,_("div.preview.inline"));let t={scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:14,horizontal:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,alwaysConsumeMouseWheel:!0},overviewRulerLanes:2,fixedOverflowWidgets:!0,minimap:{enabled:!1}};this._preview=this._instantiationService.createInstance(zc,this._previewContainer,t,{},this.editor),xo(this._previewContainer),this._previewNotAvailableMessage=this._instantiationService.createInstance(Bu,d(1237,null),Fr,Bu.DEFAULT_CREATION_OPTIONS,null),this._treeContainer=R(e,_("div.ref-tree.inline"));let o={keyboardSupport:this._defaultTreeKeyboardSupport,accessibilityProvider:new Byt,keyboardNavigationLabelProvider:this._instantiationService.createInstance(Qwe),identityProvider:new Vyt,openOnSingleClick:!0,selectionNavigation:!0,overrideStyles:{listBackground:x7},dnd:this._instantiationService.createInstance(G5e)};this._defaultTreeKeyboardSupport&&this._callOnDispose.add(Vo(this._treeContainer,"keydown",r=>{r.equals(9)&&(this._keybindingService.dispatchEvent(r,r.target),r.stopPropagation())},!0)),this._tree=this._instantiationService.createInstance(Pni,"ReferencesWidget",this._treeContainer,new Wyt,[this._instantiationService.createInstance(jq),this._instantiationService.createInstance(K5e)],this._instantiationService.createInstance(jwe),o),this._splitView.addView({onDidChange:H.None,element:this._previewContainer,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:r=>{this._preview.layout({height:this._dim.height,width:r})}},Wl.Distribute),this._splitView.addView({onDidChange:H.None,element:this._treeContainer,minimumSize:100,maximumSize:Number.MAX_VALUE,layout:r=>{this._treeContainer.style.height=`${this._dim.height}px`,this._treeContainer.style.width=`${r}px`,this._tree.layout(this._dim.height,r)}},Wl.Distribute),this._disposables.add(this._splitView.onDidSashChange(()=>{this._dim.width&&(this.layoutData.ratio=this._splitView.getViewSize(0)/this._dim.width)},void 0));let n=(r,s)=>{r instanceof AL&&(s==="show"&&this._revealReference(r,!1),this._onDidSelectReference.fire({element:r,kind:s,source:"tree"}))};this._disposables.add(this._tree.onDidOpen(r=>{r.sideBySide?n(r.element,"side"):r.editorOptions.pinned?n(r.element,"goto"):n(r.element,"show")})),xo(this._treeContainer)}_onWidth(e){this._dim&&this._doLayoutBody(this._dim.height,e)}_doLayoutBody(e,t){super._doLayoutBody(e,t),this._dim=new ai(t,e),this.layoutData.heightInLines=this._viewZone?this._viewZone.heightInLines:this.layoutData.heightInLines,this._splitView.layout(t),this._splitView.resizeView(0,t*this.layoutData.ratio)}setSelection(e){return this._revealReference(e,!0).then(()=>{this._model&&(this._tree.setSelection([e]),this._tree.setFocus([e]))})}setModel(e){return this._disposeOnNewModel.clear(),this._model=e,this._model?this._onNewModel():Promise.resolve()}_onNewModel(){return this._model?this._model.isEmpty?(this.setTitle(""),this._messageContainer.innerText=d(1238,null),bn(this._messageContainer),Promise.resolve(void 0)):(xo(this._messageContainer),this._decorationsManager=new Mni(this._preview,this._model),this._disposeOnNewModel.add(this._decorationsManager),this._disposeOnNewModel.add(this._model.onDidChangeReferenceRange(e=>this._tree.rerender(e))),this._disposeOnNewModel.add(this._preview.onMouseDown(e=>{let{event:t,target:o}=e;if(t.detail!==2)return;let n=this._getFocusedReference();n&&this._onDidSelectReference.fire({element:{uri:n.uri,range:o.range},kind:t.ctrlKey||t.metaKey||t.altKey?"side":"open",source:"editor"})})),this.container.classList.add("results-loaded"),bn(this._treeContainer),bn(this._previewContainer),this._splitView.layout(this._dim.width),this.focusOnReferenceTree(),this._tree.setInput(this._model.groups.length===1?this._model.groups[0]:this._model)):Promise.resolve(void 0)}_getFocusedReference(){let[e]=this._tree.getFocus();if(e instanceof AL)return e;if(e instanceof H1&&e.children.length>0)return e.children[0]}async revealReference(e){await this._revealReference(e,!1),this._onDidSelectReference.fire({element:e,kind:"goto",source:"tree"})}async _revealReference(e,t){if(this._revealedReference===e)return;this._revealedReference=e,e.uri.scheme!==Y.inMemory?this.setTitle(Ra(e.uri),this._uriLabel.getUriLabel(ci(e.uri))):this.setTitle(d(1239,null));let o=this._textModelResolverService.createModelReference(e.uri);this._tree.getInput()===e.parent?this._tree.reveal(e):(t&&this._tree.reveal(e.parent),await this._tree.expand(e.parent),this._tree.reveal(e));let n=await o;if(!this._model){n.dispose();return}Ue(this._previewModelReference);let r=n.object;if(r){let s=this._preview.getModel()===r.textEditorModel?0:1,l=z.lift(e.range).collapseToStart();this._previewModelReference=n,this._preview.setModel(r.textEditorModel),this._preview.setSelection(l),this._preview.revealRangeInCenter(l,s)}else this._preview.setModel(this._previewNotAvailableMessage),n.dispose()}};Ywe=I([m(3,De),m(4,Nt),m(5,F),m(6,Kq),m(7,ot),m(8,_e)],Ywe);var ile=new Q("referenceSearchVisible",!1,d(1233,null)),yE=class{constructor(i,e,t,o,n,r,s,l){this._defaultTreeKeyboardSupport=i;this._editor=e;this._editorService=o;this._notificationService=n;this._instantiationService=r;this._storageService=s;this._configurationService=l;this._disposables=new P;this._requestIdPool=0;this._ignoreModelChangeEvent=!1;this._referenceSearchVisible=ile.bindTo(t)}static{this.ID="editor.contrib.referencesController"}static get(i){return i.getContribution(yE.ID)}dispose(){this._referenceSearchVisible.reset(),this._disposables.dispose(),this._widget?.dispose(),this._model?.dispose(),this._widget=void 0,this._model=void 0}toggleWidget(i,e,t){let o;if(this._widget&&(o=this._widget.position),this.closeWidget(),o&&i.containsPosition(o))return;this._peekMode=t,this._referenceSearchVisible.set(!0),this._disposables.add(this._editor.onDidChangeModelLanguage(()=>{this.closeWidget()})),this._disposables.add(this._editor.onDidChangeModel(()=>{this._ignoreModelChangeEvent||this.closeWidget()}));let n="peekViewLayout",r=Hyt.fromJSON(this._storageService.get(n,0,"{}"));this._widget=this._instantiationService.createInstance(Ywe,this._editor,this._defaultTreeKeyboardSupport,r),this._widget.setTitle(d(1231,null)),this._widget.show(i),this._disposables.add(this._widget.onDidClose(()=>{e.cancel(),this._widget?(this._storageService.store(n,JSON.stringify(this._widget.layoutData),0,1),this._widget.isClosing||this.closeWidget(),this._widget=void 0):this.closeWidget()})),this._disposables.add(this._widget.onDidSelectReference(l=>{let{element:c,kind:u}=l;if(c)switch(u){case"open":(l.source!=="editor"||!this._configurationService.getValue("editor.stablePeek"))&&this.openReference(c,!1,!1);break;case"side":this.openReference(c,!0,!1);break;case"goto":t?this._gotoReference(c,!0):this.openReference(c,!1,!0);break}}));let s=++this._requestIdPool;e.then(l=>{if(s!==this._requestIdPool||!this._widget){l.dispose();return}return this._model?.dispose(),this._model=l,this._widget.setModel(this._model).then(()=>{if(this._widget&&this._model&&this._editor.hasModel()){this._model.isEmpty?this._widget.setMetaTitle(""):this._widget.setMetaTitle(d(1232,null,this._model.title,this._model.references.length));let c=this._editor.getModel().uri,u=new Ie(i.startLineNumber,i.startColumn),p=this._model.nearestReference(c,u);if(p)return this._widget.setSelection(p).then(()=>{this._widget&&this._editor.getOption(99)==="editor"&&this._widget.focusOnPreviewEditor()})}})},l=>{this._notificationService.error(l)})}changeFocusBetweenPreviewAndReferences(){this._widget&&(this._widget.isPreviewEditorFocused()?this._widget.focusOnReferenceTree():this._widget.focusOnPreviewEditor())}async goToNextOrPreviousReference(i){if(!this._editor.hasModel()||!this._model||!this._widget)return;let e=this._widget.position;if(!e)return;let t=this._model.nearestReference(this._editor.getModel().uri,e);if(!t)return;let o=this._model.nextOrPreviousReference(t,i),n=this._editor.hasTextFocus(),r=this._widget.isPreviewEditorFocused();await this._widget.setSelection(o),await this._gotoReference(o,!1),n?this._editor.focus():this._widget&&r&&this._widget.focusOnPreviewEditor()}async revealReference(i){!this._editor.hasModel()||!this._model||!this._widget||await this._widget.revealReference(i)}closeWidget(i=!0){this._widget?.dispose(),this._model?.dispose(),this._referenceSearchVisible.reset(),this._disposables.clear(),this._widget=void 0,this._model=void 0,i&&this._editor.focus(),this._requestIdPool+=1}_gotoReference(i,e){this._widget?.hide(),this._ignoreModelChangeEvent=!0;let t=z.lift(i.range).collapseToStart();return this._editorService.openCodeEditor({resource:i.uri,options:{selection:t,selectionSource:"code.jump",pinned:e}},this._editor).then(o=>{if(this._ignoreModelChangeEvent=!1,!o||!this._widget){this.closeWidget();return}if(this._editor===o)this._widget.show(t),this._widget.focusOnReferenceTree();else{let n=yE.get(o),r=this._model.clone();this.closeWidget(),o.focus(),n?.toggleWidget(t,xn(s=>Promise.resolve(r)),this._peekMode??!1)}},o=>{this._ignoreModelChangeEvent=!1,mt(o)})}openReference(i,e,t){e||this.closeWidget();let{uri:o,range:n}=i;this._editorService.openCodeEditor({resource:o,options:{selection:n,selectionSource:"code.jump",pinned:t}},this._editor,e)}};yE=I([m(2,X),m(3,Kt),m(4,Ne),m(5,F),m(6,le),m(7,B)],yE);function ole(a,i){let e=Bwe(a);if(!e)return;let t=yE.get(e);t&&i(t)}yt.registerCommandAndKeybindingRule({id:"togglePeekWidgetFocus",weight:100,primary:Ai(2089,60),when:x.or(ile,Gh.inPeekEditor),handler(a){ole(a,i=>{i.changeFocusBetweenPreviewAndReferences()})}});yt.registerCommandAndKeybindingRule({id:"goToNextReference",weight:90,primary:62,secondary:[70],when:x.or(ile,Gh.inPeekEditor),handler(a){ole(a,i=>{i.goToNextOrPreviousReference(!0)})}});yt.registerCommandAndKeybindingRule({id:"goToPreviousReference",weight:90,primary:1086,secondary:[1094],when:x.or(ile,Gh.inPeekEditor),handler(a){ole(a,i=>{i.goToNextOrPreviousReference(!1)})}});qe.registerCommandAlias("goToNextReferenceFromEmbeddedEditor","goToNextReference");qe.registerCommandAlias("goToPreviousReferenceFromEmbeddedEditor","goToPreviousReference");qe.registerCommandAlias("closeReferenceSearchEditor","closeReferenceSearch");qe.registerCommand("closeReferenceSearch",a=>ole(a,i=>i.closeWidget()));yt.registerKeybindingRule({id:"closeReferenceSearch",weight:-1,primary:9,secondary:[1033],when:x.and(Gh.inPeekEditor,x.not("config.editor.stablePeek"))});yt.registerKeybindingRule({id:"closeReferenceSearch",weight:250,primary:9,secondary:[1033],when:x.and(ile,x.not("config.editor.stablePeek"),x.or(ue.editorTextFocus,$h.negate()))});yt.registerCommandAndKeybindingRule({id:"revealReference",weight:200,primary:3,mac:{primary:3,secondary:[2066]},when:x.and(ile,rc,$we.negate(),qwe.negate()),handler(a){let e=a.get(fo).lastFocusedList?.getFocus();Array.isArray(e)&&e[0]instanceof AL&&ole(a,t=>t.revealReference(e[0]))}});yt.registerCommandAndKeybindingRule({id:"openReferenceToSide",weight:100,primary:2051,mac:{primary:259},when:x.and(ile,rc,$we.negate(),qwe.negate()),handler(a){let e=a.get(fo).lastFocusedList?.getFocus();Array.isArray(e)&&e[0]instanceof AL&&ole(a,t=>t.openReference(e[0],!0,!0))}});qe.registerCommand("openReference",a=>{let e=a.get(fo).lastFocusedList?.getFocus();Array.isArray(e)&&e[0]instanceof AL&&ole(a,t=>t.openReference(e[0],!1,!0))});var Ani=new Q("hasSymbols",!1,d(1248,null)),j5e=ae("ISymbolNavigationService"),$5e=class{constructor(i,e,t,o){this._editorService=e;this._notificationService=t;this._keybindingService=o;this._currentModel=void 0;this._currentIdx=-1;this._ignoreEditorChange=!1;this._ctxHasSymbols=Ani.bindTo(i)}reset(){this._ctxHasSymbols.reset(),this._currentState?.dispose(),this._currentMessage?.close(),this._currentModel=void 0,this._currentIdx=-1}put(i){let e=i.parent.parent;if(e.references.length<=1){this.reset();return}this._currentModel=e,this._currentIdx=e.references.indexOf(i),this._ctxHasSymbols.set(!0),this._showMessage();let t=new q5e(this._editorService),o=t.onDidChange(n=>{if(this._ignoreEditorChange)return;let r=this._editorService.getActiveCodeEditor();if(!r)return;let s=r.getModel(),l=r.getPosition();if(!s||!l)return;let c=!1,u=!1;for(let p of e.references)if(Xe(p.uri,s.uri))c=!0,u=u||z.containsPosition(p.range,l);else if(c)break;(!c||!u)&&this.reset()});this._currentState=hn(t,o)}revealNext(i){if(!this._currentModel)return Promise.resolve();this._currentIdx+=1,this._currentIdx%=this._currentModel.references.length;let e=this._currentModel.references[this._currentIdx];return this._showMessage(),this._ignoreEditorChange=!0,this._editorService.openCodeEditor({resource:e.uri,options:{selection:z.collapseToStart(e.range),selectionRevealType:3}},i).finally(()=>{this._ignoreEditorChange=!1})}_showMessage(){this._currentMessage?.close();let i=this._keybindingService.lookupKeybinding("editor.gotoNextSymbolFromResult"),e=i?d(1250,null,this._currentIdx+1,this._currentModel.references.length,i.getLabel()):d(1249,null,this._currentIdx+1,this._currentModel.references.length);this._currentMessage=this._notificationService.status(e)}};$5e=I([m(0,X),m(1,Kt),m(2,Ne),m(3,_e)],$5e);we(j5e,$5e,1);qi(new class extends xc{constructor(){super({id:"editor.gotoNextSymbolFromResult",precondition:Ani,kbOpts:{weight:100,primary:70}})}runEditorCommand(a,i){return a.get(j5e).revealNext(i)}});yt.registerCommandAndKeybindingRule({id:"editor.gotoNextSymbolFromResult.cancel",weight:100,when:Ani,primary:9,handler(a){a.get(j5e).reset()}});var q5e=class{constructor(i){this._listener=new Map;this._disposables=new P;this._onDidChange=new E;this.onDidChange=this._onDidChange.event;this._disposables.add(i.onCodeEditorRemove(this._onDidRemoveEditor,this)),this._disposables.add(i.onCodeEditorAdd(this._onDidAddEditor,this)),i.listCodeEditors().forEach(this._onDidAddEditor,this)}dispose(){this._disposables.dispose(),this._onDidChange.dispose(),Ue(this._listener.values())}_onDidAddEditor(i){this._listener.set(i,hn(i.onDidChangeCursorPosition(e=>this._onDidChange.fire({editor:i})),i.onDidChangeModelContent(e=>this._onDidChange.fire({editor:i}))))}_onDidRemoveEditor(i){this._listener.get(i)?.dispose(),this._listener.delete(i)}};q5e=I([m(0,Kt)],q5e);function Nni(a,i){return i.uri.scheme===a.uri.scheme?!0:!$0(i.uri,Y.walkThroughSnippet,Y.vscodeChatCodeBlock,Y.vscodeChatCodeCompareBlock)}async function Q5e(a,i,e,t,o){let r=e.ordered(a,t).map(l=>Promise.resolve(o(l,a,i)).then(void 0,c=>{ss(c)})),s=await Promise.all(r);return si(s.flat()).filter(l=>Nni(a,l))}function U1(a,i,e,t,o){return Q5e(i,e,a,t,(n,r,s)=>n.provideDefinition(r,s,o))}function Uyt(a,i,e,t,o){return Q5e(i,e,a,t,(n,r,s)=>n.provideDeclaration(r,s,o))}function Xwe(a,i,e,t,o){return Q5e(i,e,a,t,(n,r,s)=>n.provideImplementation(r,s,o))}function zyt(a,i,e,t,o){return Q5e(i,e,a,t,(n,r,s)=>n.provideTypeDefinition(r,s,o))}function T7(a,i,e,t,o,n){return Q5e(i,e,a,o,async(r,s,l)=>{let c=(await r.provideReferences(s,l,{includeDeclaration:!0},n))?.filter(p=>Nni(s,p));if(!t||!c||c.length!==2)return c;let u=(await r.provideReferences(s,l,{includeDeclaration:!1},n))?.filter(p=>Nni(s,p));return u&&u.length===1?u:c})}async function z1(a){let i=await a(),e=new ew(i,""),t=e.references.map(o=>o.link);return e.dispose(),t}kS("_executeDefinitionProvider",(a,i,e)=>{let t=a.get(zt),o=U1(t.definitionProvider,i,e,!1,ve.None);return z1(()=>o)});kS("_executeDefinitionProvider_recursive",(a,i,e)=>{let t=a.get(zt),o=U1(t.definitionProvider,i,e,!0,ve.None);return z1(()=>o)});kS("_executeTypeDefinitionProvider",(a,i,e)=>{let t=a.get(zt),o=zyt(t.typeDefinitionProvider,i,e,!1,ve.None);return z1(()=>o)});kS("_executeTypeDefinitionProvider_recursive",(a,i,e)=>{let t=a.get(zt),o=zyt(t.typeDefinitionProvider,i,e,!0,ve.None);return z1(()=>o)});kS("_executeDeclarationProvider",(a,i,e)=>{let t=a.get(zt),o=Uyt(t.declarationProvider,i,e,!1,ve.None);return z1(()=>o)});kS("_executeDeclarationProvider_recursive",(a,i,e)=>{let t=a.get(zt),o=Uyt(t.declarationProvider,i,e,!0,ve.None);return z1(()=>o)});kS("_executeReferenceProvider",(a,i,e)=>{let t=a.get(zt),o=T7(t.referenceProvider,i,e,!1,!1,ve.None);return z1(()=>o)});kS("_executeReferenceProvider_recursive",(a,i,e)=>{let t=a.get(zt),o=T7(t.referenceProvider,i,e,!1,!0,ve.None);return z1(()=>o)});kS("_executeImplementationProvider",(a,i,e)=>{let t=a.get(zt),o=Xwe(t.implementationProvider,i,e,!1,ve.None);return z1(()=>o)});kS("_executeImplementationProvider_recursive",(a,i,e)=>{let t=a.get(zt),o=Xwe(t.implementationProvider,i,e,!0,ve.None);return z1(()=>o)});fe.appendMenuItem(D.EditorContext,{submenu:D.EditorContextPeek,title:d(1224,null),group:"navigation",order:100});var nle=class a{constructor(i,e){this.model=i;this.position=e}static is(i){return!i||typeof i!="object"?!1:!!(i instanceof a||Ie.isIPosition(i.position)&&i.model)}},mO=class a extends wl{static{this._allSymbolNavigationCommands=new Map}static{this._activeAlternativeCommands=new Set}static all(){return a._allSymbolNavigationCommands.values()}static _patchConfig(i){let e={...i,f1:!0};if(e.menu)for(let t of ht.wrap(e.menu))(t.id===D.EditorContext||t.id===D.EditorContextPeek)&&(t.when=x.and(i.precondition,t.when));return e}constructor(i,e){super(a._patchConfig(e)),this.configuration=i,a._allSymbolNavigationCommands.set(e.id,this)}runEditorCommand(i,e,t,o){if(!e.hasModel())return Promise.resolve(void 0);let n=i.get(Ne),r=i.get(Kt),s=i.get(rd),l=i.get(j5e),c=i.get(zt),u=i.get(F),p=e.getModel(),h=e.getPosition(),g=nle.is(t)?t:new nle(p,h),f=new Ex(e,5),v=wa(this._getLocationModel(c,g.model,g.position,f.token),f.token).then(async b=>{if(!b||f.token.isCancellationRequested)return;Jo(b.ariaMessage);let S;if(b.referenceAt(p.uri,h)){let w=this._getAlternativeCommand(e);w!==void 0&&!a._activeAlternativeCommands.has(w)&&a._allSymbolNavigationCommands.has(w)&&(S=a._allSymbolNavigationCommands.get(w))}let y=b.references.length;if(y===0){if(!this.configuration.muteMessage){let w=p.getWordAtPosition(h);iu.get(e)?.showMessage(this._getNoResultFoundMessage(w),h)}}else if(y===1&&S)a._activeAlternativeCommands.add(this.desc.id),u.invokeFunction(w=>S.runEditorCommand(w,e,t,o).finally(()=>{a._activeAlternativeCommands.delete(this.desc.id)}));else return this._onResult(r,l,e,b,o)},b=>{n.error(b)}).finally(()=>{f.dispose()});return s.showWhile(v,250),v}async _onResult(i,e,t,o,n){let r=this._getGoToPreference(t);if(!(t instanceof zc)&&(this.configuration.openInPeek||r==="peek"&&o.references.length>1))this._openInPeek(t,o,n);else{let s=o.firstReference(),l=o.references.length>1&&r==="gotoAndPeek",c=await this._openReference(t,i,s,this.configuration.openToSide,!l);l&&c?this._openInPeek(c,o,n):o.dispose(),r==="goto"&&e.put(s)}}async _openReference(i,e,t,o,n){let r;if(ZKi(t)&&(r=t.targetSelectionRange),r||(r=t.range),!r)return;let s=await e.openCodeEditor({resource:t.uri,options:{selection:z.collapseToStart(r),selectionRevealType:3,selectionSource:"code.jump"}},i,o);if(s){if(n){let l=s.getModel(),c=s.createDecorationsCollection([{range:r,options:{description:"symbol-navigate-action-highlight",className:"symbolHighlight"}}]);setTimeout(()=>{s.getModel()===l&&c.clear()},350)}return s}}_openInPeek(i,e,t){let o=yE.get(i);o&&i.hasModel()?o.toggleWidget(t??i.getSelection(),xn(n=>Promise.resolve(e)),this.configuration.openInPeek):e.dispose()}},NW=class extends mO{async _getLocationModel(i,e,t,o){return new ew(await U1(i.definitionProvider,e,t,!1,o),d(1207,null))}_getNoResultFoundMessage(i){return i&&i.word?d(1223,null,i.word):d(1209,null)}_getAlternativeCommand(i){return i.getOption(67).alternativeDefinitionCommand}_getGoToPreference(i){return i.getOption(67).multipleDefinitions}};W(class Oni extends NW{static{this.id="editor.action.revealDefinition"}constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:Oni.id,title:{...L(1195,"Go to Definition"),mnemonicTitle:d(1219,null)},precondition:ue.hasDefinitionProvider,keybinding:[{when:ue.editorTextFocus,primary:70,weight:100},{when:x.and(ue.editorTextFocus,ep),primary:2118,weight:100}],menu:[{id:D.EditorContext,group:"navigation",order:1.1},{id:D.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:2}]}),qe.registerCommandAlias("editor.action.goToDeclaration",Oni.id)}});W(class Fni extends NW{static{this.id="editor.action.revealDefinitionAside"}constructor(){super({openToSide:!0,openInPeek:!1,muteMessage:!1},{id:Fni.id,title:L(1197,"Open Definition to the Side"),precondition:x.and(ue.hasDefinitionProvider,ue.isInEmbeddedEditor.toNegated()),keybinding:[{when:ue.editorTextFocus,primary:Ai(2089,70),weight:100},{when:x.and(ue.editorTextFocus,ep),primary:Ai(2089,2118),weight:100}]}),qe.registerCommandAlias("editor.action.openDeclarationToTheSide",Fni.id)}});W(class Wni extends NW{static{this.id="editor.action.peekDefinition"}constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:Wni.id,title:L(1203,"Peek Definition"),precondition:x.and(ue.hasDefinitionProvider,Gh.notInPeekEditor,ue.isInEmbeddedEditor.toNegated()),keybinding:{when:ue.editorTextFocus,primary:582,linux:{primary:3140},weight:100},menu:{id:D.EditorContextPeek,group:"peek",order:2}}),qe.registerCommandAlias("editor.action.previewDeclaration",Wni.id)}});var Kyt=class extends mO{async _getLocationModel(i,e,t,o){return new ew(await Uyt(i.declarationProvider,e,t,!1,o),d(1206,null))}_getNoResultFoundMessage(i){return i&&i.word?d(1205,null,i.word):d(1204,null)}_getAlternativeCommand(i){return i.getOption(67).alternativeDeclarationCommand}_getGoToPreference(i){return i.getOption(67).multipleDeclarations}};W(class a8i extends Kyt{static{this.id="editor.action.revealDeclaration"}constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:a8i.id,title:{...L(1196,"Go to Declaration"),mnemonicTitle:d(1218,null)},precondition:x.and(ue.hasDeclarationProvider,ue.isInEmbeddedEditor.toNegated()),menu:[{id:D.EditorContext,group:"navigation",order:1.3},{id:D.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}_getNoResultFoundMessage(i){return i&&i.word?d(1205,null,i.word):d(1204,null)}});W(class extends Kyt{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.peekDeclaration",title:L(1200,"Peek Declaration"),precondition:x.and(ue.hasDeclarationProvider,Gh.notInPeekEditor,ue.isInEmbeddedEditor.toNegated()),menu:{id:D.EditorContextPeek,group:"peek",order:3}})}});var Gyt=class extends mO{async _getLocationModel(i,e,t,o){return new ew(await zyt(i.typeDefinitionProvider,e,t,!1,o),d(1229,null))}_getNoResultFoundMessage(i){return i&&i.word?d(1215,null,i.word):d(1214,null)}_getAlternativeCommand(i){return i.getOption(67).alternativeTypeDefinitionCommand}_getGoToPreference(i){return i.getOption(67).multipleTypeDefinitions}};W(class l8i extends Gyt{static{this.ID="editor.action.goToTypeDefinition"}constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:l8i.ID,title:{...L(1199,"Go to Type Definition"),mnemonicTitle:d(1222,null)},precondition:ue.hasTypeDefinitionProvider,keybinding:{when:ue.editorTextFocus,primary:0,weight:100},menu:[{id:D.EditorContext,group:"navigation",order:1.4},{id:D.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}});W(class c8i extends Gyt{static{this.ID="editor.action.peekTypeDefinition"}constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:c8i.ID,title:L(1202,"Peek Type Definition"),precondition:x.and(ue.hasTypeDefinitionProvider,Gh.notInPeekEditor,ue.isInEmbeddedEditor.toNegated()),menu:{id:D.EditorContextPeek,group:"peek",order:4}})}});var $yt=class extends mO{async _getLocationModel(i,e,t,o){return new ew(await Xwe(i.implementationProvider,e,t,!1,o),d(1216,null))}_getNoResultFoundMessage(i){return i&&i.word?d(1212,null,i.word):d(1211,null)}_getAlternativeCommand(i){return i.getOption(67).alternativeImplementationCommand}_getGoToPreference(i){return i.getOption(67).multipleImplementations}};W(class d8i extends $yt{static{this.ID="editor.action.goToImplementation"}constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:d8i.ID,title:{...L(1198,"Go to Implementations"),mnemonicTitle:d(1220,null)},precondition:ue.hasImplementationProvider,keybinding:{when:ue.editorTextFocus,primary:2118,weight:100},menu:[{id:D.EditorContext,group:"navigation",order:1.45},{id:D.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:4}]})}});W(class u8i extends $yt{static{this.ID="editor.action.peekImplementation"}constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:u8i.ID,title:L(1201,"Peek Implementations"),precondition:x.and(ue.hasImplementationProvider,Gh.notInPeekEditor,ue.isInEmbeddedEditor.toNegated()),keybinding:{when:ue.editorTextFocus,primary:3142,weight:100},menu:{id:D.EditorContextPeek,group:"peek",order:5}})}});var qyt=class extends mO{_getNoResultFoundMessage(i){return i?d(1227,null,i.word):d(1228,null)}_getAlternativeCommand(i){return i.getOption(67).alternativeReferenceCommand}_getGoToPreference(i){return i.getOption(67).multipleReferences}};W(class extends qyt{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:"editor.action.goToReferences",title:{...L(1213,"Go to References"),mnemonicTitle:d(1221,null)},precondition:x.and(ue.hasReferenceProvider,Gh.notInPeekEditor,ue.isInEmbeddedEditor.toNegated()),keybinding:{when:ue.editorTextFocus,primary:1094,weight:100},menu:[{id:D.EditorContext,group:"navigation",order:1.45},{id:D.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:5}]})}async _getLocationModel(i,e,t,o){return new ew(await T7(i.referenceProvider,e,t,!0,!1,o),d(1225,null))}});W(class extends qyt{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.referenceSearch.trigger",title:L(1226,"Peek References"),precondition:x.and(ue.hasReferenceProvider,Gh.notInPeekEditor,ue.isInEmbeddedEditor.toNegated()),menu:{id:D.EditorContextPeek,group:"peek",order:6}})}async _getLocationModel(i,e,t,o){return new ew(await T7(i.referenceProvider,e,t,!1,!1,o),d(1225,null))}});var Vni=class extends mO{constructor(e,t,o){super(e,{id:"editor.action.goToLocation",title:L(1217,"Go to Any Symbol"),precondition:x.and(Gh.notInPeekEditor,ue.isInEmbeddedEditor.toNegated())});this._references=t;this._gotoMultipleBehaviour=o}async _getLocationModel(e,t,o,n){return new ew(this._references,d(1210,null))}_getNoResultFoundMessage(e){return e&&d(1208,null,e.word)||""}_getGoToPreference(e){return this._gotoMultipleBehaviour??e.getOption(67).multipleReferences}_getAlternativeCommand(){}};qe.registerCommand({id:"editor.action.goToLocations",metadata:{description:"Go to locations from a position in a file",args:[{name:"uri",description:"The text document in which to start",constraint:A},{name:"position",description:"The position at which to start",constraint:Ie.isIPosition},{name:"locations",description:"An array of locations.",constraint:Array},{name:"multiple",description:"Define what to do when having multiple results, either `peek`, `gotoAndPeek`, or `goto`"},{name:"noResultsMessage",description:"Human readable message that shows when locations is empty."}]},handler:async(a,i,e,t,o,n,r)=>{So(A.isUri(i)),So(Ie.isIPosition(e)),So(Array.isArray(t)),So(typeof o>"u"||typeof o=="string"),So(typeof r>"u"||typeof r=="boolean");let s=a.get(Kt),l=await s.openCodeEditor({resource:i},s.getFocusedCodeEditor());if(pn(l))return l.setPosition(e),l.revealPositionInCenterIfOutsideViewport(e,0),l.invokeWithinContext(c=>{let u=new class extends Vni{_getNoResultFoundMessage(p){return n||super._getNoResultFoundMessage(p)}}({muteMessage:!n,openInPeek:!!r,openToSide:!1},t,o);c.get(F).invokeFunction(u.run.bind(u),l)})}});qe.registerCommand({id:"editor.action.peekLocations",metadata:{description:"Peek locations from a position in a file",args:[{name:"uri",description:"The text document in which to start",constraint:A},{name:"position",description:"The position at which to start",constraint:Ie.isIPosition},{name:"locations",description:"An array of locations.",constraint:Array},{name:"multiple",description:"Define what to do when having multiple results, either `peek`, `gotoAndPeek`, or `goto`"}]},handler:async(a,i,e,t,o)=>{a.get(ge).executeCommand("editor.action.goToLocations",i,e,t,o,void 0,!0)}});qe.registerCommand({id:"editor.action.findReferences",handler:(a,i,e)=>{So(A.isUri(i)),So(Ie.isIPosition(e));let t=a.get(zt),o=a.get(Kt);return o.openCodeEditor({resource:i},o.getFocusedCodeEditor()).then(n=>{if(!pn(n)||!n.hasModel())return;let r=yE.get(n);if(!r)return;let s=xn(c=>T7(t.referenceProvider,n.getModel(),Ie.lift(e),!1,!1,c).then(u=>new ew(u,d(1225,null)))),l=new z(e.lineNumber,e.column,e.lineNumber,e.column);return Promise.resolve(r.toggleWidget(l,s,!1))})}});qe.registerCommandAlias("editor.action.showReferences","editor.action.peekLocations");async function p8i(a,i,e,t){let o=a.get(Nt),n=a.get(ze),r=a.get(ge),s=a.get(F),l=a.get(Ne);if(await t.item.resolve(ve.None),!t.part.location)return;let c=t.part.location,u=[],p=new Set(fe.getMenuItems(D.EditorContext).map(g=>Kk(g)?g.command.id:_t()));for(let g of mO.all())p.has(g.desc.id)&&u.push(new st(g.desc.id,Eo.label(g.desc,{renderShortTitle:!0}),void 0,!0,async()=>{let f=await o.createModelReference(c.uri);try{let v=new nle(f.object.textEditorModel,z.getStartPosition(c.range)),b=t.item.anchor.range;await s.invokeFunction(g.runEditorCommand.bind(g),i,v,b)}finally{f.dispose()}}));if(t.part.command){let{command:g}=t.part;u.push(new li),u.push(new st(g.id,g.title,void 0,!0,async()=>{try{await r.executeCommand(g.id,...g.arguments??[])}catch(f){l.notify({severity:St.Error,source:t.item.provider.displayName,message:f})}}))}let h=i.getOption(144);n.showContextMenu({domForShadowRoot:h?i.getDomNode()??void 0:void 0,getAnchor:()=>{let g=Yn(e);return{x:g.left,y:g.top+g.height+8}},getActions:()=>u,onHide:()=>{i.focus()},autoSelectFirstItem:!0})}async function jyt(a,i,e,t){let n=await a.get(Nt).createModelReference(t.uri);await e.invokeWithinContext(async r=>{let s=i.hasSideBySideModifier,l=r.get(X),c=Gh.inPeekEditor.getValue(l),u=!s&&e.getOption(101)&&!c;return new NW({openToSide:s,openInPeek:u,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(r,new nle(n.object.textEditorModel,z.getStartPosition(t.range)),z.lift(t.range))}),n.dispose()}var Bni=class a{constructor(){this._entries=new il(50)}get(i){let e=a._key(i);return this._entries.get(e)}set(i,e){let t=a._key(i);this._entries.set(t,e)}static _key(i){return`${i.uri.toString()}/${i.getVersionId()}`}},m8i=ae("IInlayHintsCache");we(m8i,Bni,1);var Jwe=class{constructor(i,e){this.item=i;this.index=e}get part(){let i=this.item.hint.label;return typeof i=="string"?{label:i}:i[this.index]}},Hni=class{constructor(i,e){this.part=i;this.hasTriggerModifier=e}};var Uni=class{constructor(){this._store=new me;this._tokenSource=new $e}dispose(){this._store.dispose(),this._tokenSource.dispose(!0)}reset(){return this._tokenSource.dispose(!0),this._tokenSource=new $e,this._store.value=new P,{store:this._store.value,token:this._tokenSource.token}}},wE=class{constructor(i,e,t,o,n,r,s){this._editor=i;this._languageFeaturesService=e;this._inlayHintsCache=o;this._commandService=n;this._notificationService=r;this._instaService=s;this._disposables=new P;this._sessionDisposables=new P;this._decorationsMetadata=new Map;this._activeRenderMode=0;this._ruleFactory=this._disposables.add(new p9(this._editor)),this._debounceInfo=t.for(e.inlayHintsProvider,"InlayHint",{min:25}),this._disposables.add(e.inlayHintsProvider.onDidChange(()=>this._update())),this._disposables.add(i.onDidChangeModel(()=>this._update())),this._disposables.add(i.onDidChangeModelLanguage(()=>this._update())),this._disposables.add(i.onDidChangeConfiguration(l=>{l.hasChanged(159)&&this._update()})),this._update()}static{this.ID="editor.contrib.InlayHints"}static{this._MAX_DECORATORS=1500}static{this._whitespaceData={}}static get(i){return i.getContribution(wE.ID)??void 0}dispose(){this._sessionDisposables.dispose(),this._removeAllDecorations(),this._disposables.dispose()}_update(){this._sessionDisposables.clear(),this._removeAllDecorations();let i=this._editor.getOption(159);if(i.enabled==="off")return;let e=this._editor.getModel();if(!e||!this._languageFeaturesService.inlayHintsProvider.has(e))return;if(i.enabled==="on")this._activeRenderMode=0;else{let c,u;i.enabled==="onUnlessPressed"?(c=0,u=1):(c=1,u=0),this._activeRenderMode=c,this._sessionDisposables.add(bf.getInstance().event(p=>{if(!this._editor.hasModel())return;let h=p.altKey&&p.ctrlKey&&!(p.shiftKey||p.metaKey)?u:c;if(h!==this._activeRenderMode){this._activeRenderMode=h;let g=this._editor.getModel(),f=this._copyInlayHintsWithCurrentAnchor(g);this._updateHintsDecorators([g.getFullModelRange()],f),s.schedule(0)}}))}let t=this._inlayHintsCache.get(e);t&&this._updateHintsDecorators([e.getFullModelRange()],t),this._sessionDisposables.add(Z(()=>{e.isDisposed()||this._cacheHintsForFastRestore(e)}));let o,n=new Set;this._sessionDisposables.add(e.onWillDispose(()=>o?.cancel()));let r=this._sessionDisposables.add(new Uni),s=new Dt(async()=>{let c=Date.now(),{store:u,token:p}=r.reset();try{let h=await M5e.create(this._languageFeaturesService.inlayHintsProvider,e,this._getHintsRanges(),p);if(s.delay=this._debounceInfo.update(e,Date.now()-c),p.isCancellationRequested){h.dispose();return}for(let g of h.provider)typeof g.onDidChangeInlayHints=="function"&&!n.has(g)&&(n.add(g),u.add(g.onDidChangeInlayHints(()=>{s.isScheduled()||s.schedule()})));u.add(h),u.add(Z(()=>n.clear())),this._updateHintsDecorators(h.ranges,h.items),this._cacheHintsForFastRestore(e)}catch(h){mt(h)}},this._debounceInfo.get(e));this._sessionDisposables.add(s),s.schedule(0),this._sessionDisposables.add(this._editor.onDidScrollChange(c=>{(c.scrollTopChanged||!s.isScheduled())&&s.schedule()}));let l=this._sessionDisposables.add(new me);this._sessionDisposables.add(this._editor.onDidChangeModelContent(c=>{o?.cancel();let u=Math.max(s.delay,800);this._cursorInfo={position:this._editor.getPosition(),notEarlierThan:Date.now()+u},l.value=nn(()=>s.schedule(0),u),s.schedule()})),this._sessionDisposables.add(this._editor.onDidChangeConfiguration(c=>{c.hasChanged(159)&&s.schedule()})),this._sessionDisposables.add(this._installDblClickGesture(()=>s.schedule(0))),this._sessionDisposables.add(this._installLinkGesture()),this._sessionDisposables.add(this._installContextMenu())}_installLinkGesture(){let i=new P,e=i.add(new sO(this._editor)),t=new P;return i.add(t),i.add(e.onMouseMoveOrRelevantKeyDown(o=>{let[n]=o,r=this._getInlayHintLabelPart(n),s=this._editor.getModel();if(!r||!s){t.clear();return}let l=new $e;t.add(Z(()=>l.dispose(!0))),r.item.resolve(l.token),this._activeInlayHintPart=r.part.command||r.part.location?new Hni(r,n.hasTriggerModifier):void 0;let c=s.validatePosition(r.item.hint.position).lineNumber,u=new z(c,1,c,s.getLineMaxColumn(c)),p=this._getInlineHintsForRange(u);this._updateHintsDecorators([u],p),t.add(Z(()=>{this._activeInlayHintPart=void 0,this._updateHintsDecorators([u],p)}))})),i.add(e.onCancel(()=>t.clear())),i.add(e.onExecute(async o=>{let n=this._getInlayHintLabelPart(o);if(n){let r=n.part;r.location?this._instaService.invokeFunction(jyt,o,this._editor,r.location):vse.is(r.command)&&await this._invokeCommand(r.command,n.item)}})),i}_getInlineHintsForRange(i){let e=new Set;for(let t of this._decorationsMetadata.values())i.containsRange(t.item.anchor.range)&&e.add(t.item);return Array.from(e)}_installDblClickGesture(i){return this._editor.onMouseUp(async e=>{if(e.event.detail!==2)return;let t=this._getInlayHintLabelPart(e);if(t&&(e.event.preventDefault(),await t.item.resolve(ve.None),dr(t.item.hint.textEdits))){let o=t.item.hint.textEdits.map(n=>An.replace(z.lift(n.range),n.text));this._editor.executeEdits("inlayHint.default",o),i()}})}_installContextMenu(){return this._editor.onContextMenu(async i=>{if(!Ao(i.event.target))return;let e=this._getInlayHintLabelPart(i);e&&await this._instaService.invokeFunction(p8i,this._editor,i.event.target,e)})}_getInlayHintLabelPart(i){if(i.target.type!==6)return;let e=i.target.detail.injectedText?.options;if(e instanceof r1&&e?.attachedData instanceof Jwe)return e.attachedData}async _invokeCommand(i,e){try{await this._commandService.executeCommand(i.id,...i.arguments??[])}catch(t){this._notificationService.notify({severity:St.Error,source:e.provider.displayName,message:t})}}_cacheHintsForFastRestore(i){let e=this._copyInlayHintsWithCurrentAnchor(i);this._inlayHintsCache.set(i,e)}_copyInlayHintsWithCurrentAnchor(i){let e=new Map;for(let[t,o]of this._decorationsMetadata){if(e.has(o.item))continue;let n=i.getDecorationRange(t);if(n){let r=new R5e(n,o.item.anchor.direction),s=o.item.with({anchor:r});e.set(o.item,s)}}return Array.from(e.values())}_getHintsRanges(){let e=this._editor.getModel(),t=this._editor.getVisibleRangesPlusViewportAboveBelow(),o=[];for(let n of t.sort(z.compareRangesUsingStarts)){let r=e.validateRange(new z(n.startLineNumber-30,n.startColumn,n.endLineNumber+30,n.endColumn));o.length===0||!z.areIntersectingOrTouching(o[o.length-1],r)?o.push(r):o[o.length-1]=z.plusRange(o[o.length-1],r)}return o}_updateHintsDecorators(i,e){let t=new Map;if(this._cursorInfo&&this._cursorInfo.notEarlierThan>Date.now()&&i.some(b=>b.containsPosition(this._cursorInfo.position))){let{position:b}=this._cursorInfo;this._cursorInfo=void 0;let S=new Map;for(let T of this._editor.getLineDecorations(b.lineNumber)??[]){let N=this._decorationsMetadata.get(T.id);if(T.range.startColumn>b.column)continue;let O=N?.decoration.options[N.item.anchor.direction];if(O&&O.attachedData!==wE._whitespaceData){let V=S.get(N.item)??0;S.set(N.item,V+O.content.length)}}let y=e.filter(T=>T.anchor.range.startLineNumber===b.lineNumber&&T.anchor.range.endColumn<=b.column),w=Array.from(S.values()),k;for(;;){let T=y.shift(),N=w.shift();if(!N&&!T)break;if(T)t.set(T,N??0),k=T;else if(k&&N){let O=t.get(k);O+=N,O+=w.reduce((V,U)=>V+U,0),w.length=0;break}}}let o=[],n=(b,S,y,w,k)=>{let T={content:y,inlineClassNameAffectsLetterSpacing:!0,inlineClassName:S.className,cursorStops:w,attachedData:k};o.push({item:b,classNameRef:S,decoration:{range:b.anchor.range,options:{description:"InlayHint",showIfCollapsed:b.anchor.range.isEmpty(),collapseOnReplaceEdit:!b.anchor.range.isEmpty(),stickiness:0,[b.anchor.direction]:this._activeRenderMode===0?T:void 0}}})},r=(b,S)=>{let y=this._ruleFactory.createClassNameRef({width:`${s/3|0}px`,display:"inline-block"});n(b,y,"\u200A",S?1:3,wE._whitespaceData)},{fontSize:s,fontFamily:l,padding:c,isUniform:u}=this._getLayoutInfo(),p=this._editor.getOption(159).maximumLength,h="--code-editorInlayHintsFontFamily";this._editor.getContainerDomNode().style.setProperty(h,l);let g={line:0,totalLen:0};for(let b=0;b<e.length;b++){let S=e[b];if(g.line!==S.anchor.range.startLineNumber&&(g={line:S.anchor.range.startLineNumber,totalLen:0}),p&&g.totalLen>p)continue;S.hint.paddingLeft&&r(S,!1);let y=typeof S.hint.label=="string"?[{label:S.hint.label}]:S.hint.label,w=t.get(S),k=0;for(let T=0;T<y.length;T++){let N=y[T],O=T===0,V=T===y.length-1,U={fontSize:`${s}px`,fontFamily:`var(${h}), ${Yd.fontFamily}`,verticalAlign:u?"baseline":"middle",unicodeBidi:"isolate"};dr(S.hint.textEdits)&&(U.cursor="default"),this._fillInColors(U,S.hint),(N.command||N.location)&&this._activeInlayHintPart?.part.item===S&&this._activeInlayHintPart.part.index===T&&(U.textDecoration="underline",this._activeInlayHintPart.hasTriggerModifier&&(U.color=Ss(oGi),U.cursor="pointer"));let G=N.label;g.totalLen+=G.length;let $=!1,te=p!==0?g.totalLen-p:0;if(te>0&&(G=G.slice(0,-te)+"\u2026",$=!0),k+=G.length,w!==void 0){let pe=k-w;pe>=0&&(k-=pe,G=G.slice(0,-(1+pe))+"\u2026",$=!0)}if(c&&(O&&(V||$)?(U.padding=`1px ${Math.max(1,s/4)|0}px`,U.borderRadius=`${s/4|0}px`):O?(U.padding=`1px 0 1px ${Math.max(1,s/4)|0}px`,U.borderRadius=`${s/4|0}px 0 0 ${s/4|0}px`):V||$?(U.padding=`1px ${Math.max(1,s/4)|0}px 1px 0`,U.borderRadius=`0 ${s/4|0}px ${s/4|0}px 0`):U.padding="1px 0 1px 0"),n(S,this._ruleFactory.createClassNameRef(U),OWo(G),V&&!S.hint.paddingRight?1:3,new Jwe(S,T)),$)break}if(w!==void 0&&k<w){let T=w-k;n(S,this._ruleFactory.createClassNameRef({}),"\u200A".repeat(T),3)}if(S.hint.paddingRight&&r(S,!0),o.length>wE._MAX_DECORATORS)break}let f=[];for(let[b,S]of this._decorationsMetadata){let y=this._editor.getModel()?.getDecorationRange(b);y&&i.some(w=>w.containsRange(y))&&(f.push(b),S.classNameRef.dispose(),this._decorationsMetadata.delete(b))}let v=tC.capture(this._editor);this._editor.changeDecorations(b=>{let S=b.deltaDecorations(f,o.map(y=>y.decoration));for(let y=0;y<S.length;y++){let w=o[y];this._decorationsMetadata.set(S[y],w)}}),v.restore(this._editor)}_fillInColors(i,e){e.kind===2?(i.backgroundColor=Ss(mGi),i.color=Ss(pGi)):e.kind===1?(i.backgroundColor=Ss(uGi),i.color=Ss(dGi)):(i.backgroundColor=Ss(rgt),i.color=Ss(ngt))}_getLayoutInfo(){let i=this._editor.getOption(159),e=i.padding,t=this._editor.getOption(61),o=this._editor.getOption(58),n=i.fontSize;(!n||n<5||n>t)&&(n=t);let r=i.fontFamily||o;return{fontSize:n,fontFamily:r,padding:e,isUniform:!e&&r===o&&n===t}}_removeAllDecorations(){this._editor.removeDecorations(Array.from(this._decorationsMetadata.keys()));for(let i of this._decorationsMetadata.values())i.classNameRef.dispose();this._decorationsMetadata.clear()}getInlayHintsForLine(i){if(!this._editor.hasModel())return[];let e=new Set,t=[];for(let o of this._editor.getLineDecorations(i)){let n=this._decorationsMetadata.get(o.id);n&&!e.has(n.item.hint)&&(e.add(n.item.hint),t.push(n.item))}return t}};wE=I([m(1,zt),m(2,jg),m(3,m8i),m(4,ge),m(5,Ne),m(6,F)],wE);function OWo(a){return a.replace(/[ \t]/g,"\xA0")}qe.registerCommand("_executeInlayHintProvider",async(a,...i)=>{let[e,t]=i;So(A.isUri(e)),So(z.isIRange(t));let{inlayHintsProvider:o}=a.get(zt),n=await a.get(Nt).createModelReference(e);try{let r=await M5e.create(o,n.object.textEditorModel,[z.lift(t)],ve.None),s=r.items.map(l=>l.hint);return setTimeout(()=>r.dispose(),0),s}finally{n.dispose()}});var Qyt=class extends Fq{constructor(e,t,o,n){super(10,t,e.item.anchor.range,o,n,!0);this.part=e}},_7=class extends P1{constructor(e,t,o,n,r,s,l,c){super(e,t,r,l,o,n,c);this._resolverService=s;this.hoverOrdinal=6}suggestHoverAnchor(e){if(!wE.get(this._editor)||e.target.type!==6)return null;let o=e.target.detail.injectedText?.options;return o instanceof r1&&o.attachedData instanceof Jwe?new Qyt(o.attachedData,this,e.event.posx,e.event.posy):null}computeSync(){return[]}computeAsync(e,t,o,n){return e instanceof Qyt?new Fp(async r=>{let{part:s}=e;if(await s.item.resolve(n),n.isCancellationRequested)return;let l;typeof s.item.hint.tooltip=="string"?l=new xe().appendText(s.item.hint.tooltip):s.item.hint.tooltip&&(l=s.item.hint.tooltip),l&&r.emitOne(new vE(this,e.range,[l],!1,0)),dr(s.item.hint.textEdits)&&r.emitOne(new vE(this,e.range,[new xe().appendText(d(1320,null))],!1,10001));let c;if(typeof s.part.tooltip=="string"?c=new xe().appendText(s.part.tooltip):s.part.tooltip&&(c=s.part.tooltip),c&&r.emitOne(new vE(this,e.range,[c],!1,1)),s.part.location||s.part.command){let p,g=this._editor.getOption(86)==="altKey"?it?d(1326,null):d(1325,null):it?d(1324,null):d(1323,null);s.part.location&&s.part.command?p=new xe().appendText(d(1322,null,g)):s.part.location?p=new xe().appendText(d(1321,null,g)):s.part.command&&(p=new xe(`[${d(1319,null)}](${cyt(s.part.command)} "${s.part.command.title}") (${g})`,{isTrusted:!0})),p&&r.emitOne(new vE(this,e.range,[p],!1,1e4))}let u=this._resolveInlayHintLabelPartHover(s,n);for await(let p of u)r.emitOne(p)}):Fp.EMPTY}async*_resolveInlayHintLabelPartHover(e,t){if(!e.part.location)return;let{uri:o,range:n}=e.part.location,r=await this._resolverService.createModelReference(o);try{let s=r.object.textEditorModel;if(!this._languageFeaturesService.hoverProvider.has(s))return;for await(let l of _5e(this._languageFeaturesService.hoverProvider,s,new Ie(n.startLineNumber,n.startColumn),t))yW(l.hover.contents)||(yield new vE(this,e.item.anchor.range,l.hover.contents,!1,2+l.ordinal))}finally{r.dispose()}}};_7=I([m(1,Qn),m(2,_e),m(3,tt),m(4,B),m(5,Nt),m(6,zt),m(7,ge)],_7);var Yyt=class{constructor(i,e,t){this.marker=i;this.index=e;this.total=t}},rle=class{constructor(i,e,t){this._markerService=e;this._configService=t;this._onDidChange=new E;this.onDidChange=this._onDidChange.event;this._dispoables=new P;this._markers=[];this._nextIdx=-1;A.isUri(i)?this._resourceFilter=s=>s.toString()===i.toString():i&&(this._resourceFilter=i);let o=this._configService.getValue("problems.sortOrder"),n=(s,l)=>{let c=Al(s.resource.toString(),l.resource.toString());return c===0&&(o==="position"?c=z.compareRangesUsingStarts(s,l)||cl.compare(s.severity,l.severity):c=cl.compare(s.severity,l.severity)||z.compareRangesUsingStarts(s,l)),c},r=()=>{let s=this._markerService.read({resource:A.isUri(i)?i:void 0,severities:14});return typeof i=="function"&&(s=s.filter(l=>this._resourceFilter(l.resource))),s.sort(n),$i(s,this._markers,(l,c)=>l.resource.toString()===c.resource.toString()&&l.startLineNumber===c.startLineNumber&&l.startColumn===c.startColumn&&l.endLineNumber===c.endLineNumber&&l.endColumn===c.endColumn&&l.severity===c.severity&&l.message===c.message)?!1:(this._markers=s,!0)};r(),this._dispoables.add(e.onMarkerChanged(s=>{(!this._resourceFilter||s.some(l=>this._resourceFilter(l)))&&r()&&(this._nextIdx=-1,this._onDidChange.fire())}))}dispose(){this._dispoables.dispose(),this._onDidChange.dispose()}matches(i){return!this._resourceFilter&&!i?!0:!this._resourceFilter||!i?!1:this._resourceFilter(i)}get selected(){let i=this._markers[this._nextIdx];return i&&new Yyt(i,this._nextIdx+1,this._markers.length)}_initIdx(i,e,t){let o=this._markers.findIndex(n=>Xe(n.resource,i.uri));if(o<0)o=bM(this._markers.length,n=>Al(this._markers[n].resource.toString(),i.uri.toString())),o<0&&(o=~o),t?this._nextIdx=o:this._nextIdx=(this._markers.length+o-1)%this._markers.length;else{let n=!1,r=!1;for(let s=o;s<this._markers.length;s++){let l=z.lift(this._markers[s]);if(l.isEmpty()){let c=i.getWordAtPosition(l.getStartPosition());c&&(l=new z(l.startLineNumber,c.startColumn,l.startLineNumber,c.endColumn))}if(e&&(l.containsPosition(e)||e.isBeforeOrEqual(l.getStartPosition()))){this._nextIdx=s,n=!0,r=!l.containsPosition(e);break}if(this._markers[s].resource.toString()!==i.uri.toString())break}n?r&&!t&&(this._nextIdx-=1):this._nextIdx=t?0:this._markers.length-1}this._nextIdx<0&&(this._nextIdx=this._markers.length-1)}resetIndex(){this._nextIdx=-1}move(i,e,t){if(this._markers.length===0)return!1;let o=this._nextIdx;return this._nextIdx===-1?this._initIdx(e,t,i):i?this._nextIdx=(this._nextIdx+1)%this._markers.length:i||(this._nextIdx=(this._nextIdx-1+this._markers.length)%this._markers.length),o!==this._nextIdx}find(i,e){let t=this._markers.findIndex(o=>o.resource.toString()===i.toString());if(!(t<0)){for(;t<this._markers.length;t++)if(z.containsPosition(this._markers[t],e))return new Yyt(this._markers[t],t+1,this._markers.length)}}};rle=I([m(1,Ns),m(2,B)],rle);var X5e=ae("IMarkerNavigationService"),Y5e=class{constructor(i,e){this._markerService=i;this._configService=e;this._provider=new Vs}registerProvider(i){let e=this._provider.unshift(i);return Z(()=>e())}getMarkerList(i){for(let e of this._provider){let t=e.getMarkerList(i);if(t)return t}return new rle(i,this._markerService,this._configService)}};Y5e=I([m(0,Ns),m(1,B)],Y5e);we(X5e,Y5e,1);var Px;(i=>{function a(e){switch(e){case gt.Ignore:return"severity-ignore "+q.asClassName(M.info);case gt.Info:return q.asClassName(M.info);case gt.Warning:return q.asClassName(M.warning);case gt.Error:return q.asClassName(M.error);default:return""}}i.className=a})(Px||={});var zni=class{constructor(i,e,t,o,n){this._openerService=o;this._labelService=n;this._lines=0;this._longestLineLength=0;this._relatedDiagnostics=new WeakMap;this._disposables=new P;this._editor=e;let r=document.createElement("div");r.className="descriptioncontainer",this._messageBlock=document.createElement("div"),this._messageBlock.classList.add("message"),this._messageBlock.setAttribute("aria-live","assertive"),this._messageBlock.setAttribute("role","alert"),r.appendChild(this._messageBlock),this._relatedBlock=document.createElement("div"),r.appendChild(this._relatedBlock),this._disposables.add(Vo(this._relatedBlock,"click",s=>{s.preventDefault();let l=this._relatedDiagnostics.get(s.target);l&&t(l)})),this._scrollable=new f9(r,{horizontal:1,vertical:1,useShadows:!1,horizontalScrollbarSize:6,verticalScrollbarSize:6}),i.appendChild(this._scrollable.getDomNode()),this._disposables.add(this._scrollable.onScroll(s=>{r.style.left=`-${s.scrollLeft}px`,r.style.top=`-${s.scrollTop}px`})),this._disposables.add(this._scrollable)}dispose(){Ue(this._disposables)}update(i){let{source:e,message:t,relatedInformation:o,code:n}=i,r=(e?.length||0)+2;n&&(typeof n=="string"?r+=n.length:r+=n.value.length);let s=mc(t);this._lines=s.length,this._longestLineLength=0;for(let h of s)this._longestLineLength=Math.max(h.length+r,this._longestLineLength);Rt(this._messageBlock),this._messageBlock.setAttribute("aria-label",this.getAriaLabel(i)),this._editor.applyFontInfo(this._messageBlock);let l=this._messageBlock;for(let h of s)l=document.createElement("div"),l.innerText=h,h===""&&(l.style.height=this._messageBlock.style.lineHeight),this._messageBlock.appendChild(l);if(e||n){let h=document.createElement("span");if(h.classList.add("details"),l.appendChild(h),e){let g=document.createElement("span");g.innerText=e,g.classList.add("source"),h.appendChild(g)}if(n)if(typeof n=="string"){let g=document.createElement("span");g.innerText=`(${n})`,g.classList.add("code"),h.appendChild(g)}else{this._codeLink=_("a.code-link"),this._codeLink.setAttribute("href",`${n.target.toString()}`),this._codeLink.onclick=f=>{this._openerService.open(n.target,{allowCommands:!0}),f.preventDefault(),f.stopPropagation()};let g=R(this._codeLink,_("span"));g.innerText=n.value,h.appendChild(this._codeLink)}}if(Rt(this._relatedBlock),this._editor.applyFontInfo(this._relatedBlock),dr(o)){let h=this._relatedBlock.appendChild(document.createElement("div"));h.style.paddingTop=`${Math.floor(this._editor.getOption(75)*.66)}px`,this._lines+=1;for(let g of o){let f=document.createElement("div"),v=document.createElement("a");v.classList.add("filename"),v.innerText=`${this._labelService.getUriBasenameLabel(g.resource)}(${g.startLineNumber}, ${g.startColumn}): `,v.title=this._labelService.getUriLabel(g.resource),this._relatedDiagnostics.set(v,g);let b=document.createElement("span");b.innerText=g.message,f.appendChild(v),f.appendChild(b),this._lines+=1,h.appendChild(f)}}let c=this._editor.getOption(59),u=Math.ceil(c.typicalFullwidthCharacterWidth*this._longestLineLength*.75),p=c.lineHeight*this._lines;this._scrollable.setScrollDimensions({scrollWidth:u,scrollHeight:p})}layout(i,e){this._scrollable.getDomNode().style.height=`${i}px`,this._scrollable.getDomNode().style.width=`${e}px`,this._scrollable.setScrollDimensions({width:e,height:i})}getHeightInLines(){return Math.min(17,this._lines)}getAriaLabel(i){let e="";switch(i.severity){case 8:e=d(1189,null);break;case 4:e=d(1194,null);break;case 2:e=d(1191,null);break;case 1:e=d(1190,null);break}let t=d(1192,null,e,i.startLineNumber+":"+i.startColumn),o=this._editor.getModel();return o&&i.startLineNumber<=o.getLineCount()&&i.startLineNumber>=1&&(t=`${o.getLineContent(i.startLineNumber)}, ${t}`),t}},K1=class extends bE{constructor(e,t,o,n,r,s,l){super(e,{showArrow:!0,showFrame:!0,isAccessible:!0,frameWidth:1},r);this._themeService=t;this._openerService=o;this._menuService=n;this._contextKeyService=s;this._labelService=l;this._callOnDispose=new P;this._onDidSelectRelatedInformation=new E;this.onDidSelectRelatedInformation=this._onDidSelectRelatedInformation.event;this._severity=4,this._backgroundColor=Oe.white,this._applyTheme(t.getColorTheme()),this._callOnDispose.add(t.onDidColorThemeChange(this._applyTheme.bind(this))),this.create()}static{this.TitleMenu=new D("gotoErrorTitleMenu")}_applyTheme(e){this._backgroundColor=e.getColor(BWo);let t=Kni,o=FWo;this._severity===4?(t=Xyt,o=WWo):this._severity===2&&(t=Gni,o=VWo);let n=e.getColor(t),r=e.getColor(o);this.style({arrowColor:n,frameColor:n,headerBackgroundColor:r,primaryHeadingColor:e.getColor(lO),secondaryHeadingColor:e.getColor(cO)})}_applyStyles(){this._parentContainer&&(this._parentContainer.style.backgroundColor=this._backgroundColor?this._backgroundColor.toString():""),super._applyStyles()}dispose(){this._callOnDispose.dispose(),this._onDidSelectRelatedInformation.dispose(),super.dispose()}focus(){this._parentContainer.focus()}_fillHead(e){super._fillHead(e),this._disposables.add(this._actionbarWidget.actionRunner.onWillRun(n=>this.editor.focus()));let t=this._menuService.getMenuActions(K1.TitleMenu,this._contextKeyService),o=Vm(t);this._actionbarWidget.push(o,{label:!1,icon:!0,index:0})}_fillTitleIcon(e){this._icon=R(e,_(""))}_fillBody(e){this._parentContainer=e,e.classList.add("marker-widget"),this._parentContainer.tabIndex=0,this._parentContainer.setAttribute("role","tooltip"),this._container=document.createElement("div"),e.appendChild(this._container),this._message=new zni(this._container,this.editor,t=>this._onDidSelectRelatedInformation.fire(t),this._openerService,this._labelService),this._disposables.add(this._message)}show(){throw new Error("call showAtMarker")}showAtMarker(e,t,o){this._container.classList.remove("stale"),this._message.update(e),this._severity=e.severity,this._applyTheme(this._themeService.getColorTheme());let n=z.lift(e),r=this.editor.getPosition(),s=r&&n.containsPosition(r)?r:n.getStartPosition();super.show(s,this.computeRequiredHeight());let l=this.editor.getModel();if(l){let c=o>1?d(1193,null,t,o):d(1181,null,t,o);this.setTitle(Ye(l.uri),c)}this._icon.className=`codicon ${Px.className(cl.toSeverity(this._severity))}`,this.editor.revealPositionInCenterIfOutsideViewport(s,0),this.editor.focus()}updateMarker(e){this._container.classList.remove("stale"),this._message.update(e)}showStale(){this._container.classList.add("stale"),this._relayout()}_doLayoutBody(e,t){super._doLayoutBody(e,t),this._heightInPixel=e,this._message.layout(e,t),this._container.style.height=`${e}px`}_onWidth(e){this._message.layout(this._heightInPixel,e)}_relayout(){super._relayout(this.computeRequiredHeight())}computeRequiredHeight(){return 3+this._message.getHeightInLines()}};K1=I([m(1,De),m(2,Qe),m(3,qt),m(4,F),m(5,X),m(6,ot)],K1);var h8i=_se(av,eGi),g8i=_se(Bh,n9),f8i=_se(fm,r9),Kni=J("editorMarkerNavigationError.background",{dark:h8i,light:h8i,hcDark:gi,hcLight:gi},d(1183,null)),FWo=J("editorMarkerNavigationError.headerBackground",{dark:ei(Kni,.1),light:ei(Kni,.1),hcDark:null,hcLight:null},d(1184,null)),Xyt=J("editorMarkerNavigationWarning.background",{dark:g8i,light:g8i,hcDark:gi,hcLight:gi},d(1187,null)),WWo=J("editorMarkerNavigationWarning.headerBackground",{dark:ei(Xyt,.1),light:ei(Xyt,.1),hcDark:"#0C141F",hcLight:ei(Xyt,.2)},d(1188,null)),Gni=J("editorMarkerNavigationInfo.background",{dark:f8i,light:f8i,hcDark:gi,hcLight:gi},d(1185,null)),VWo=J("editorMarkerNavigationInfo.headerBackground",{dark:ei(Gni,.1),light:ei(Gni,.1),hcDark:null,hcLight:null},d(1186,null)),BWo=J("editorMarkerNavigation.background",qo,d(1182,null));var tw=class{constructor(i,e,t,o,n){this._markerNavigationService=e;this._contextKeyService=t;this._editorService=o;this._instantiationService=n;this._sessionDispoables=new P;this._editor=i,this._widgetVisible=v8i.bindTo(this._contextKeyService)}static{this.ID="editor.contrib.markerController"}static get(i){return i.getContribution(tw.ID)}dispose(){this._cleanUp(),this._sessionDispoables.dispose()}_cleanUp(){this._widgetVisible.reset(),this._sessionDispoables.clear(),this._widget=void 0,this._model=void 0}_getOrCreateModel(i){if(this._model&&this._model.matches(i))return this._model;let e=!1;return this._model&&(e=!0,this._cleanUp()),this._model=this._markerNavigationService.getMarkerList(i),e&&this._model.move(!0,this._editor.getModel(),this._editor.getPosition()),this._widget=this._instantiationService.createInstance(K1,this._editor),this._widget.onDidClose(()=>this.close(),this,this._sessionDispoables),this._widgetVisible.set(!0),this._sessionDispoables.add(this._model),this._sessionDispoables.add(this._widget),this._sessionDispoables.add(this._editor.onDidChangeCursorPosition(t=>{(!this._model?.selected||!z.containsPosition(this._model?.selected.marker,t.position))&&this._model?.resetIndex()})),this._sessionDispoables.add(this._model.onDidChange(()=>{if(!this._widget||!this._widget.position||!this._model)return;let t=this._model.find(this._editor.getModel().uri,this._widget.position);t?this._widget.updateMarker(t.marker):this._widget.showStale()})),this._sessionDispoables.add(this._widget.onDidSelectRelatedInformation(t=>{this._editorService.openCodeEditor({resource:t.resource,options:{pinned:!0,revealIfOpened:!0,selection:z.lift(t).collapseToStart()}},this._editor),this.close(!1)})),this._sessionDispoables.add(this._editor.onDidChangeModel(()=>this._cleanUp())),this._model}close(i=!0){this._cleanUp(),i&&this._editor.focus()}showAtMarker(i){if(!this._editor.hasModel())return;let e=this._editor.getModel(),t=this._getOrCreateModel(e.uri);t.resetIndex(),t.move(!0,e,new Ie(i.startLineNumber,i.startColumn)),t.selected&&this._widget.showAtMarker(t.selected.marker,t.selected.index,t.selected.total)}async navigate(i,e){if(!this._editor.hasModel())return;let t=this._editor.getModel(),o=this._getOrCreateModel(e?void 0:t.uri);if(o.move(i,t,this._editor.getPosition()),!!o.selected)if(o.selected.marker.resource.toString()!==t.uri.toString()){this._cleanUp();let n=await this._editorService.openCodeEditor({resource:o.selected.marker.resource,options:{pinned:!1,revealIfOpened:!0,selectionRevealType:2,selection:o.selected.marker}},this._editor);n&&(tw.get(n)?.close(),tw.get(n)?.navigate(i,e))}else this._widget.showAtMarker(o.selected.marker,o.selected.index,o.selected.total)}};tw=I([m(1,X5e),m(2,X),m(3,Kt),m(4,F)],tw);var Zwe=class extends xi{constructor(e,t,o){super(o);this._next=e;this._multiFile=t}async run(e,t){t.hasModel()&&await tw.get(t)?.navigate(this._next,this._multiFile)}},sle=class a extends Zwe{static{this.ID="editor.action.marker.next"}static{this.LABEL=L(1173,"Go to Next Problem (Error, Warning, Info)")}constructor(){super(!0,!1,{id:a.ID,label:a.LABEL,precondition:void 0,kbOpts:{kbExpr:ue.focus,primary:578,weight:100},menuOpts:{menuId:K1.TitleMenu,title:a.LABEL.value,icon:Re("marker-navigation-next",M.arrowDown,d(1179,null)),group:"navigation",order:1}})}},J5e=class a extends Zwe{static{this.ID="editor.action.marker.prev"}static{this.LABEL=L(1175,"Go to Previous Problem (Error, Warning, Info)")}constructor(){super(!1,!1,{id:a.ID,label:a.LABEL,precondition:void 0,kbOpts:{kbExpr:ue.focus,primary:1602,weight:100},menuOpts:{menuId:K1.TitleMenu,title:a.LABEL.value,icon:Re("marker-navigation-previous",M.arrowUp,d(1180,null)),group:"navigation",order:2}})}},Z5e=class a extends Zwe{static{this.ID="editor.action.marker.nextInFiles"}constructor(){super(!0,!0,{id:a.ID,label:L(1174,"Go to Next Problem in Files (Error, Warning, Info)"),precondition:void 0,kbOpts:{kbExpr:ue.focus,primary:66,weight:100},menuOpts:{menuId:D.MenubarGoMenu,title:d(1177,null),group:"6_problem_nav",order:1}})}},e4e=class a extends Zwe{static{this.ID="editor.action.marker.prevInFiles"}constructor(){super(!1,!0,{id:a.ID,label:L(1176,"Go to Previous Problem in Files (Error, Warning, Info)"),precondition:void 0,kbOpts:{kbExpr:ue.focus,primary:1090,weight:100},menuOpts:{menuId:D.MenubarGoMenu,title:d(1178,null),group:"6_problem_nav",order:2}})}};go(tw.ID,tw,4);Jt(sle);Jt(J5e);Jt(Z5e);Jt(e4e);var v8i=new Q("markersNavigationVisible",!1),HWo=xc.bindToContribution(tw.get);qi(new HWo({id:"closeMarkersNavigation",precondition:v8i,handler:a=>a.close(),kbOpts:{weight:150,kbExpr:ue.focus,primary:9,secondary:[1033]}}));var hO=_,t4e=class{constructor(i,e,t){this.owner=i;this.range=e;this.marker=t}isValidForHoverAnchor(i){return i.type===1&&this.range.startColumn<=i.range.startColumn&&this.range.endColumn>=i.range.endColumn}},b8i={type:1,filter:{include:gr.QuickFix},triggerAction:"quick fix hover window"},eCe=class{constructor(i,e,t,o){this._editor=i;this._markerDecorationsService=e;this._openerService=t;this._languageFeaturesService=o;this.hoverOrdinal=1;this.recentMarkerCodeActionsInfo=void 0}computeSync(i,e){if(!this._editor.hasModel()||i.type!==1&&!i.supportsMarkerHover)return[];let t=this._editor.getModel(),o=i.range;if(!t.isValidRange(i.range))return[];let n=o.startLineNumber,r=t.getLineMaxColumn(n),s=[];for(let l of e){let c=l.range.startLineNumber===n?l.range.startColumn:1,u=l.range.endLineNumber===n?l.range.endColumn:r,p=this._markerDecorationsService.getMarker(t.uri,l);if(!p)continue;let h=new z(i.range.startLineNumber,c,i.range.startLineNumber,u);s.push(new t4e(this,h,p))}return s}renderHoverParts(i,e){if(!e.length)return new Lx([]);let t=[];e.forEach(r=>{let s=this._renderMarkerHover(r);i.fragment.appendChild(s.hoverElement),t.push(s)});let o=e.length===1?e[0]:e.sort((r,s)=>cl.compare(r.marker.severity,s.marker.severity))[0],n=this._renderMarkerStatusbar(i,o);return new Lx(t,n)}getAccessibleContent(i){return i.marker.message}_renderMarkerHover(i){let e=new P,t=hO("div.hover-row"),o=R(t,hO("div.marker.hover-contents")),{source:n,message:r,code:s,relatedInformation:l}=i.marker;this._editor.applyFontInfo(o);let c=R(o,hO("span"));if(c.style.whiteSpace="pre-wrap",c.innerText=r,n||s)if(s&&typeof s!="string"){let p=hO("span");if(n){let v=R(p,hO("span"));v.innerText=n}let h=R(p,hO("a.code-link"));h.setAttribute("href",s.target.toString(!0)),e.add(j(h,"click",v=>{this._openerService.open(s.target,{allowCommands:!0}),v.preventDefault(),v.stopPropagation()}));let g=R(h,hO("span"));g.innerText=s.value;let f=R(o,p);f.style.opacity="0.6",f.style.paddingLeft="6px"}else{let p=R(o,hO("span"));p.style.opacity="0.6",p.style.paddingLeft="6px",p.innerText=n&&s?`${n}(${s})`:n||`(${s})`}if(dr(l))for(let{message:p,resource:h,startLineNumber:g,startColumn:f}of l){let v=R(o,hO("div"));v.style.marginTop="8px";let b=R(v,hO("a"));b.innerText=`${Ye(h)}(${g}, ${f}): `,b.style.cursor="pointer",e.add(j(b,"click",y=>{if(y.stopPropagation(),y.preventDefault(),this._openerService){let w={selection:{startLineNumber:g,startColumn:f}};this._openerService.open(h,{fromUserGesture:!0,editorOptions:w}).catch(mt)}}));let S=R(v,hO("span"));S.innerText=p,this._editor.applyFontInfo(S)}return{hoverPart:i,hoverElement:t,dispose:()=>e.dispose()}}_renderMarkerStatusbar(i,e){let t=new P;if(e.marker.severity===8||e.marker.severity===4||e.marker.severity===2){let o=tw.get(this._editor);o&&i.statusBar.addAction({label:d(1298,null),commandId:sle.ID,run:()=>{i.hide(),o.showAtMarker(e.marker),this._editor.focus()}})}if(!this._editor.getOption(104)){let o=i.statusBar.append(hO("div"));this.recentMarkerCodeActionsInfo&&(TW.makeKey(this.recentMarkerCodeActionsInfo.marker)===TW.makeKey(e.marker)?this.recentMarkerCodeActionsInfo.hasCodeActions||(o.textContent=d(1296,null)):this.recentMarkerCodeActionsInfo=void 0);let n=this.recentMarkerCodeActionsInfo&&!this.recentMarkerCodeActionsInfo.hasCodeActions?C.None:nn(()=>o.textContent=d(1295,null),200,t);o.textContent||(o.textContent="\xA0");let r=this.getCodeActions(e.marker);t.add(Z(()=>r.cancel())),r.then(s=>{if(n.dispose(),this.recentMarkerCodeActionsInfo={marker:e.marker,hasCodeActions:s.validActions.length>0},!this.recentMarkerCodeActionsInfo.hasCodeActions){s.dispose(),o.textContent=d(1296,null);return}o.style.display="none";let l=!1;t.add(Z(()=>{l||s.dispose()})),i.statusBar.addAction({label:d(1297,null),commandId:w1,run:u=>{l=!0;let p=Zu.get(this._editor),h=Yn(u);i.hide(),p?.showCodeActions(b8i,s,{x:h.left,y:h.top,width:h.width,height:h.height})}});let c=s.validActions.find(u=>u.action.isAI);c&&i.statusBar.addAction({label:c.action.title,commandId:c.action.command?.id??"",iconClass:q.asClassName(M.sparkle),run:()=>{Zu.get(this._editor)?.applyCodeAction(c,!1,!1,"fromProblemsHover")}}),i.onContentsChanged()},mt)}return t}getCodeActions(i){return xn(e=>DL(this._languageFeaturesService.codeActionProvider,this._editor.getModel(),new z(i.startLineNumber,i.startColumn,i.endLineNumber,i.endColumn),b8i,bm.None,e))}};eCe=I([m(1,RU),m(2,Qe),m(3,zt)],eCe);var D7=class extends C{constructor(i,e,t,o,n,r,s){super();let l=e.hoverParts;this._renderedHoverParts=this._register(new ale(i,t,l,o,n,r,s));let c=e.options,u=c.anchor,{showAtPosition:p,showAtSecondaryPosition:h}=D7.computeHoverPositions(i,u.range,l);this.shouldAppearBeforeContent=l.some(g=>g.isBeforeContent),this.showAtPosition=p,this.showAtSecondaryPosition=h,this.initialMousePosX=u.initialMousePosX,this.initialMousePosY=u.initialMousePosY,this.shouldFocus=c.shouldFocus,this.source=c.source}get domNode(){return this._renderedHoverParts.domNode}get domNodeHasChildren(){return this._renderedHoverParts.domNodeHasChildren}get focusedHoverPartIndex(){return this._renderedHoverParts.focusedHoverPartIndex}get hoverPartsCount(){return this._renderedHoverParts.hoverPartsCount}focusHoverPartWithIndex(i){this._renderedHoverParts.focusHoverPartWithIndex(i)}getAccessibleWidgetContent(){return this._renderedHoverParts.getAccessibleContent()}getAccessibleWidgetContentAtIndex(i){return this._renderedHoverParts.getAccessibleHoverContentAtIndex(i)}async updateHoverVerbosityLevel(i,e,t){this._renderedHoverParts.updateHoverVerbosityLevel(i,e,t)}doesHoverAtIndexSupportVerbosityAction(i,e){return this._renderedHoverParts.doesHoverAtIndexSupportVerbosityAction(i,e)}isColorPickerVisible(){return this._renderedHoverParts.isColorPickerVisible()}static computeHoverPositions(i,e,t){let o=1;if(i.hasModel()){let u=i._getViewModel(),p=u.coordinatesConverter,h=p.convertModelRangeToViewRange(e),g=u.getLineMinColumn(h.startLineNumber),f=new Ie(h.startLineNumber,g);o=p.convertViewPositionToModelPosition(f).column}let n=e.startLineNumber,r=e.startColumn,s;for(let u of t){let p=u.range,h=p.startLineNumber===n,g=p.endLineNumber===n;if(h&&g){let v=p.startColumn,b=Math.min(r,v);r=Math.max(b,o)}u.forceShowAtRange&&(s=p)}let l,c;if(s){let u=s.getStartPosition();l=u,c=u}else l=e.getStartPosition(),c=new Ie(n,r);return{showAtPosition:l,showAtSecondaryPosition:c}}};D7=I([m(4,_e),m(5,tt),m(6,Wi)],D7);var $ni=class{constructor(i,e){this._statusBar=e;i.appendChild(this._statusBar.hoverElement)}get hoverElement(){return this._statusBar.hoverElement}get actions(){return this._statusBar.actions}dispose(){this._statusBar.dispose()}},ale=class extends C{constructor(e,t,o,n,r,s,l){super();this._hoverService=s;this._clipboardService=l;this._renderedParts=[];this._focusedHoverPartIndex=-1;this._context=n,this._fragment=document.createDocumentFragment(),this._register(this._renderParts(t,o,n,r,this._hoverService)),this._register(this._registerListenersOnRenderedParts()),this._register(this._createEditorDecorations(e,o)),this._updateMarkdownAndColorParticipantInfo(t)}static{this._DECORATION_OPTIONS=po.register({description:"content-hover-highlight",className:"hoverHighlight"})}_createEditorDecorations(e,t){if(t.length===0)return C.None;let o=t[0].range;for(let r of t){let s=r.range;o=z.plusRange(o,s)}let n=e.createDecorationsCollection();return n.set([{range:o,options:ale._DECORATION_OPTIONS}]),Z(()=>{n.clear()})}_renderParts(e,t,o,n,r){let s=new f7(n,r),l={fragment:this._fragment,statusBar:s,...o},c=new P;c.add(s);for(let p of e){let h=this._renderHoverPartsForParticipant(t,p,l);c.add(h);for(let g of h.renderedHoverParts)this._renderedParts.push({type:"hoverPart",participant:p,hoverPart:g.hoverPart,hoverElement:g.hoverElement})}let u=this._renderStatusBar(this._fragment,s);return u&&(c.add(u),this._renderedParts.push({type:"statusBar",hoverElement:u.hoverElement,actions:u.actions})),c}_renderHoverPartsForParticipant(e,t,o){let n=e.filter(s=>s.owner===t);return n.length>0?t.renderHoverParts(o,n):new Lx([])}_renderStatusBar(e,t){if(t.hasContent)return new $ni(e,t)}_registerListenersOnRenderedParts(){let e=new P;return this._renderedParts.forEach((t,o)=>{let n=t.hoverElement;n.tabIndex=0,e.add(j(n,re.FOCUS_IN,r=>{r.stopPropagation(),this._focusedHoverPartIndex=o})),e.add(j(n,re.FOCUS_OUT,r=>{r.stopPropagation(),this._focusedHoverPartIndex=-1})),t.type==="hoverPart"&&t.hoverPart instanceof t4e&&e.add(new Owe(n,()=>t.participant.getAccessibleContent(t.hoverPart),this._clipboardService,this._hoverService))}),e}_updateMarkdownAndColorParticipantInfo(e){let t=e.find(o=>o instanceof P1&&!(o instanceof _7));t&&(this._markdownHoverParticipant=t),this._colorHoverParticipant=e.find(o=>o instanceof C7)}focusHoverPartWithIndex(e){e<0||e>=this._renderedParts.length||this._renderedParts[e].hoverElement.focus()}getAccessibleContent(){let e=[];for(let t=0;t<this._renderedParts.length;t++)e.push(this.getAccessibleHoverContentAtIndex(t));return e.join(`
`)}getAccessibleHoverContentAtIndex(e){let t=this._renderedParts[e];if(!t)return"";if(t.type==="statusBar"){let o=[d(1255,null)];for(let n of t.actions){let r=n.actionKeybindingLabel;r?o.push(d(1256,null,n.actionLabel,r)):o.push(d(1257,null,n.actionLabel))}return o.join(`
`)}return t.participant.getAccessibleContent(t.hoverPart)}async updateHoverVerbosityLevel(e,t,o){if(!this._markdownHoverParticipant)return;let n;t>=0?n={start:t,endExclusive:t+1}:n=this._findRangeOfMarkdownHoverParts(this._markdownHoverParticipant);for(let r=n.start;r<n.endExclusive;r++){let s=this._normalizedIndexToMarkdownHoverIndexRange(this._markdownHoverParticipant,r);if(s===void 0)continue;let l=await this._markdownHoverParticipant.updateMarkdownHoverVerbosityLevel(e,s);l&&(this._renderedParts[r]={type:"hoverPart",participant:this._markdownHoverParticipant,hoverPart:l.hoverPart,hoverElement:l.hoverElement})}o&&(t>=0?this.focusHoverPartWithIndex(t):this._context.focus()),this._context.onContentsChanged()}doesHoverAtIndexSupportVerbosityAction(e,t){if(!this._markdownHoverParticipant)return!1;let o=this._normalizedIndexToMarkdownHoverIndexRange(this._markdownHoverParticipant,e);return o===void 0?!1:this._markdownHoverParticipant.doesMarkdownHoverAtIndexSupportVerbosityAction(o,t)}isColorPickerVisible(){return this._colorHoverParticipant?.isColorPickerVisible()??!1}_normalizedIndexToMarkdownHoverIndexRange(e,t){let o=this._renderedParts[t];if(!o||o.type!=="hoverPart"||!(o.participant===e))return;let r=this._renderedParts.findIndex(s=>s.type==="hoverPart"&&s.participant===e);if(r===-1)throw new ni;return t-r}_findRangeOfMarkdownHoverParts(e){let t=this._renderedParts.slice(),o=t.findIndex(s=>s.type==="hoverPart"&&s.participant===e),n=t.reverse().findIndex(s=>s.type==="hoverPart"&&s.participant===e),r=n>=0?t.length-n:n;return{start:o,endExclusive:r+1}}get domNode(){return this._fragment}get domNodeHasChildren(){return this._fragment.hasChildNodes()}get focusedHoverPartIndex(){return this._focusedHoverPartIndex}get hoverPartsCount(){return this._renderedParts.length}};ale=I([m(4,_e),m(5,tt),m(6,Wi)],ale);var tCe=class extends C{constructor(e,t,o,n,r){super();this._editor=e;this._instantiationService=t;this._keybindingService=o;this._hoverService=n;this._clipboardService=r;this._currentResult=null;this._renderedContentHover=this._register(new me);this._onContentsChanged=this._register(new E);this.onContentsChanged=this._onContentsChanged.event;this._contentHoverWidget=this._register(this._instantiationService.createInstance(Rx,this._editor)),this._participants=this._initializeHoverParticipants(),this._hoverOperation=this._register(new Twe(this._editor,new NIt(this._editor,this._participants))),this._registerListeners()}_initializeHoverParticipants(){let e=[];for(let t of d_.getAll()){let o=this._instantiationService.createInstance(t,this._editor);e.push(o)}return e.sort((t,o)=>t.hoverOrdinal-o.hoverOrdinal),this._register(this._contentHoverWidget.onDidResize(()=>{this._participants.forEach(t=>t.handleResize?.())})),this._register(this._contentHoverWidget.onDidScroll(t=>{this._participants.forEach(o=>o.handleScroll?.(t))})),this._register(this._contentHoverWidget.onContentsChanged(()=>{this._participants.forEach(t=>t.handleContentsChanged?.())})),e}_registerListeners(){this._register(this._hoverOperation.onResult(t=>{let o=t.hasLoadingMessage?this._addLoadingMessage(t):t.value;this._withResult(new v5e(o,t.isComplete,t.options))}));let e=this._contentHoverWidget.getDomNode();this._register(Vo(e,"keydown",t=>{t.equals(9)&&this.hide()})),this._register(Vo(e,"mouseleave",t=>{this._onMouseLeave(t)})),this._register(kc.onDidChange(()=>{this._contentHoverWidget.position&&this._currentResult&&this._setCurrentResult(this._currentResult)})),this._register(this._contentHoverWidget.onContentsChanged(()=>{this._onContentsChanged.fire()}))}_startShowingOrUpdateHover(e,t,o,n,r){if(!(this._contentHoverWidget.position&&this._currentResult))return e?(this._startHoverOperationIfNecessary(e,t,o,n,!1),!0):!1;let l=this._editor.getOption(69).sticky,c=r&&this._contentHoverWidget.isMouseGettingCloser(r.event.posx,r.event.posy);return l&&c?(e&&this._startHoverOperationIfNecessary(e,t,o,n,!0),!0):e?this._currentResult&&this._currentResult.options.anchor.equals(e)?!0:this._currentResult&&e.canAdoptVisibleHover(this._currentResult.options.anchor,this._contentHoverWidget.position)?(this._currentResult&&this._setCurrentResult(this._currentResult.filter(e)),this._startHoverOperationIfNecessary(e,t,o,n,!1),!0):(this._setCurrentResult(null),this._startHoverOperationIfNecessary(e,t,o,n,!1),!0):(this._setCurrentResult(null),!1)}_startHoverOperationIfNecessary(e,t,o,n,r){if(this._hoverOperation.options&&this._hoverOperation.options.anchor.equals(e))return;this._hoverOperation.cancel();let l={anchor:e,source:o,shouldFocus:n,insistOnKeepingHoverVisible:r};this._hoverOperation.start(t,l)}_setCurrentResult(e){let t=e;if(this._currentResult===t)return;t&&t.hoverParts.length===0&&(t=null),this._currentResult=t,this._currentResult?this._showHover(this._currentResult):this._hideHover()}_addLoadingMessage(e){for(let t of this._participants){if(!t.createLoadingMessage)continue;let o=t.createLoadingMessage(e.options.anchor);if(o)return e.value.slice(0).concat([o])}return e.value}_withResult(e){if(this._contentHoverWidget.position&&this._currentResult&&this._currentResult.isComplete||this._setCurrentResult(e),!e.isComplete)return;let n=e.hoverParts.length===0,r=e.options.insistOnKeepingHoverVisible;n&&r||this._setCurrentResult(e)}_showHover(e){let t=this._getHoverContext();this._renderedContentHover.value=new D7(this._editor,e,this._participants,t,this._keybindingService,this._hoverService,this._clipboardService),this._renderedContentHover.value.domNodeHasChildren?this._contentHoverWidget.show(this._renderedContentHover.value):this._renderedContentHover.clear()}_hideHover(){this._contentHoverWidget.hide(),this._participants.forEach(e=>e.handleHide?.())}_getHoverContext(){return{hide:()=>{this.hide()},onContentsChanged:()=>{this._contentHoverWidget.handleContentsChanged()},setMinimumDimensions:r=>{this._contentHoverWidget.setMinimumDimensions(r)},focus:()=>this.focus()}}showsOrWillShow(e){if(this._contentHoverWidget.isResizing)return!0;let o=this._findHoverAnchorCandidates(e);if(!(o.length>0))return this._startShowingOrUpdateHover(null,0,0,!1,e);let r=o[0];return this._startShowingOrUpdateHover(r,0,0,!1,e)}_findHoverAnchorCandidates(e){let t=[];for(let n of this._participants){if(!n.suggestHoverAnchor)continue;let r=n.suggestHoverAnchor(e);r&&t.push(r)}let o=e.target;switch(o.type){case 6:{t.push(new xwe(0,o.range,e.event.posx,e.event.posy));break}case 7:{let n=this._editor.getOption(59).typicalHalfwidthCharacterWidth/2;if(!(!o.detail.isAfterLines&&typeof o.detail.horizontalDistanceToText=="number"&&o.detail.horizontalDistanceToText<n))break;t.push(new xwe(0,o.range,e.event.posx,e.event.posy));break}}return t.sort((n,r)=>r.priority-n.priority),t}_onMouseLeave(e){let t=this._editor.getDomNode();(!t||!g7(t,e.x,e.y))&&this.hide()}startShowingAtRange(e,t,o,n){this._startShowingOrUpdateHover(new xwe(0,e,void 0,void 0),t,o,n,null)}getWidgetContent(){let e=this._contentHoverWidget.getDomNode();if(e.textContent)return e.textContent}async updateHoverVerbosityLevel(e,t,o){this._renderedContentHover.value?.updateHoverVerbosityLevel(e,t,o)}doesHoverAtIndexSupportVerbosityAction(e,t){return this._renderedContentHover.value?.doesHoverAtIndexSupportVerbosityAction(e,t)??!1}getAccessibleWidgetContent(){return this._renderedContentHover.value?.getAccessibleWidgetContent()}getAccessibleWidgetContentAtIndex(e){return this._renderedContentHover.value?.getAccessibleWidgetContentAtIndex(e)}focusedHoverPartIndex(){return this._renderedContentHover.value?.focusedHoverPartIndex??-1}containsNode(e){return e?this._contentHoverWidget.getDomNode().contains(e):!1}focus(){if(this._renderedContentHover.value?.hoverPartsCount===1){this.focusHoverPartWithIndex(0);return}this._contentHoverWidget.focus()}focusHoverPartWithIndex(e){this._renderedContentHover.value?.focusHoverPartWithIndex(e)}scrollUp(){this._contentHoverWidget.scrollUp()}scrollDown(){this._contentHoverWidget.scrollDown()}scrollLeft(){this._contentHoverWidget.scrollLeft()}scrollRight(){this._contentHoverWidget.scrollRight()}pageUp(){this._contentHoverWidget.pageUp()}pageDown(){this._contentHoverWidget.pageDown()}goToTop(){this._contentHoverWidget.goToTop()}goToBottom(){this._contentHoverWidget.goToBottom()}hide(){this._hoverOperation.cancel(),this._setCurrentResult(null)}getDomNode(){return this._contentHoverWidget.getDomNode()}get isColorPickerVisible(){return this._renderedContentHover.value?.isColorPickerVisible()??!1}get isVisibleFromKeyboard(){return this._contentHoverWidget.isVisibleFromKeyboard}get isVisible(){return this._contentHoverWidget.isVisible}get isFocused(){return this._contentHoverWidget.isFocused}get isResizing(){return this._contentHoverWidget.isResizing}get widget(){return this._contentHoverWidget}};tCe=I([m(1,F),m(2,_e),m(3,tt),m(4,Wi)],tCe);function Zyt(a){let i=a.target;return!!i&&i.type===6&&i.detail.injectedText?.options.attachedData===roi}var qni=!1,kl=class extends C{constructor(e,t,o,n){super();this._editor=e;this._instantiationService=o;this._keybindingService=n;this._onHoverContentsChanged=this._register(new E);this.onHoverContentsChanged=this._onHoverContentsChanged.event;this.shouldKeepOpenOnEditorMouseMoveOrLeave=!1;this._listenersStore=new P;this._isMouseDown=!1;this._ignoreMouseEvents=!1;this._reactToEditorMouseMoveRunner=this._register(new Dt(()=>{this._mouseMoveEvent&&this._reactToEditorMouseMove(this._mouseMoveEvent)},0)),this._register(t.onDidShowContextMenu(()=>{this.hideContentHover(),this._ignoreMouseEvents=!0})),this._register(t.onDidHideContextMenu(()=>{this._ignoreMouseEvents=!1})),this._hookListeners(),this._register(this._editor.onDidChangeConfiguration(r=>{r.hasChanged(69)&&(this._unhookListeners(),this._hookListeners())}))}static{this.ID="editor.contrib.contentHover"}static get(e){return e.getContribution(kl.ID)}_hookListeners(){let e=this._editor.getOption(69);this._hoverSettings={enabled:e.enabled,sticky:e.sticky,hidingDelay:e.hidingDelay},e.enabled==="off"&&this._cancelSchedulerAndHide(),this._listenersStore.add(this._editor.onMouseDown(t=>this._onEditorMouseDown(t))),this._listenersStore.add(this._editor.onMouseUp(()=>this._onEditorMouseUp())),this._listenersStore.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._listenersStore.add(this._editor.onKeyDown(t=>this._onKeyDown(t))),this._listenersStore.add(this._editor.onMouseLeave(t=>this._onEditorMouseLeave(t))),this._listenersStore.add(this._editor.onDidChangeModel(()=>this._cancelSchedulerAndHide())),this._listenersStore.add(this._editor.onDidChangeModelContent(()=>this._cancelScheduler())),this._listenersStore.add(this._editor.onDidScrollChange(t=>this._onEditorScrollChanged(t)))}_unhookListeners(){this._listenersStore.clear()}_cancelSchedulerAndHide(){this._cancelScheduler(),this.hideContentHover()}_cancelScheduler(){this._mouseMoveEvent=void 0,this._reactToEditorMouseMoveRunner.cancel()}_onEditorScrollChanged(e){this._ignoreMouseEvents||(e.scrollTopChanged||e.scrollLeftChanged)&&this.hideContentHover()}_onEditorMouseDown(e){this._ignoreMouseEvents||(this._isMouseDown=!0,this._shouldKeepHoverWidgetVisible(e))||this.hideContentHover()}_shouldKeepHoverWidgetVisible(e){return this._isMouseOnContentHoverWidget(e)||this._isContentWidgetResizing()||Zyt(e)}_isMouseOnContentHoverWidget(e){return this._contentWidget?g7(this._contentWidget.getDomNode(),e.event.posx,e.event.posy):!1}_onEditorMouseUp(){this._ignoreMouseEvents||(this._isMouseDown=!1)}_onEditorMouseLeave(e){this._ignoreMouseEvents||this.shouldKeepOpenOnEditorMouseMoveOrLeave||(this._cancelScheduler(),this._shouldKeepHoverWidgetVisible(e))||qni||this.hideContentHover()}_shouldKeepCurrentHover(e){let t=this._contentWidget;if(!t)return!1;let o=this._hoverSettings.sticky,n=(p,h)=>{let g=this._isMouseOnContentHoverWidget(p);return h&&g},r=p=>{let h=t.isColorPickerVisible,g=this._isMouseOnContentHoverWidget(p),f=h&&g,v=h&&this._isMouseDown;return f||v},s=(p,h)=>{let g=p.event.browserEvent.view;return g?h&&t.containsNode(g.document.activeElement)&&!g.getSelection()?.isCollapsed:!1},l=t.isFocused,c=t.isResizing,u=this._hoverSettings.sticky&&t.isVisibleFromKeyboard;return this.shouldKeepOpenOnEditorMouseMoveOrLeave||l||c||u||n(e,o)||r(e)||s(e,o)}_onEditorMouseMove(e){if(this._ignoreMouseEvents)return;if(this._mouseMoveEvent=e,this._shouldKeepCurrentHover(e)){this._reactToEditorMouseMoveRunner.cancel();return}if(this._shouldRescheduleHoverComputation()){this._reactToEditorMouseMoveRunner.isScheduled()||this._reactToEditorMouseMoveRunner.schedule(this._hoverSettings.hidingDelay);return}this._reactToEditorMouseMove(e)}_shouldRescheduleHoverComputation(){let e=this._hoverSettings.hidingDelay;return(this._contentWidget?.isVisible??!1)&&this._hoverSettings.sticky&&e>0}_reactToEditorMouseMove(e){PIt(this._hoverSettings.enabled,this._editor.getOption(86),e)&&this._getOrCreateContentWidget().showsOrWillShow(e)||qni||this.hideContentHover()}_onKeyDown(e){if(this._ignoreMouseEvents||!this._contentWidget)return;if(this._hoverSettings.enabled==="onKeyboardModifier"&&h5e(this._editor.getOption(86),e)&&this._mouseMoveEvent){this._contentWidget.isVisible||this._contentWidget.showsOrWillShow(this._mouseMoveEvent);return}let t=this._isPotentialKeyboardShortcut(e),o=tN(e.keyCode);t||o||this._contentWidget.isFocused&&e.keyCode===2||this.hideContentHover()}_isPotentialKeyboardShortcut(e){if(!this._editor.hasModel()||!this._contentWidget)return!1;let t=this._keybindingService.softDispatch(e,this._editor.getDomNode()),o=t.kind===1,n=t.kind===2&&(t.commandId===EIt||t.commandId===x1||t.commandId===k1)&&this._contentWidget.isVisible;return o||n}hideContentHover(){qni||LL.dropDownVisible||this._contentWidget?.hide()}_getOrCreateContentWidget(){return this._contentWidget||(this._contentWidget=this._instantiationService.createInstance(tCe,this._editor),this._listenersStore.add(this._contentWidget.onContentsChanged(()=>this._onHoverContentsChanged.fire()))),this._contentWidget}showContentHover(e,t,o,n){this._getOrCreateContentWidget().startShowingAtRange(e,t,o,n)}_isContentWidgetResizing(){return this._contentWidget?.widget.isResizing||!1}focusedHoverPartIndex(){return this._getOrCreateContentWidget().focusedHoverPartIndex()}doesHoverAtIndexSupportVerbosityAction(e,t){return this._getOrCreateContentWidget().doesHoverAtIndexSupportVerbosityAction(e,t)}updateHoverVerbosityLevel(e,t,o){this._getOrCreateContentWidget().updateHoverVerbosityLevel(e,t,o)}focus(){this._contentWidget?.focus()}focusHoverPartWithIndex(e){this._contentWidget?.focusHoverPartWithIndex(e)}scrollUp(){this._contentWidget?.scrollUp()}scrollDown(){this._contentWidget?.scrollDown()}scrollLeft(){this._contentWidget?.scrollLeft()}scrollRight(){this._contentWidget?.scrollRight()}pageUp(){this._contentWidget?.pageUp()}pageDown(){this._contentWidget?.pageDown()}goToTop(){this._contentWidget?.goToTop()}goToBottom(){this._contentWidget?.goToBottom()}getWidgetContent(){return this._contentWidget?.getWidgetContent()}getAccessibleWidgetContent(){return this._contentWidget?.getAccessibleWidgetContent()}getAccessibleWidgetContentAtIndex(e){return this._contentWidget?.getAccessibleWidgetContentAtIndex(e)}get isColorPickerVisible(){return this._contentWidget?.isColorPickerVisible}get isHoverVisible(){return this._contentWidget?.isVisible}dispose(){super.dispose(),this._unhookListeners(),this._listenersStore.dispose(),this._contentWidget?.dispose()}};kl=I([m(1,ze),m(2,F),m(3,_e)],kl);var i4e=class extends C{constructor(e){super();this._editor=e;this._register(e.onMouseDown(t=>this.onMouseDown(t)))}static{this.ID="editor.contrib.colorContribution"}static{this.RECOMPUTE_TIME=1e3}dispose(){super.dispose()}onMouseDown(e){let t=this._editor.getOption(168);if(t!=="click"&&t!=="clickAndHover"||!Zyt(e))return;let o=this._editor.getContribution(kl.ID);if(!o||o.isColorPickerVisible)return;let n=e.target.range;if(!n)return;let r=new z(n.startLineNumber,n.startColumn+1,n.endLineNumber,n.endColumn+1);o.showContentHover(r,1,1,!1)}};var jni=class a{constructor(i,e,t,o){this.owner=i;this.range=e;this.model=t;this.provider=o}static fromBaseColor(i,e){return new a(i,e.range,e.model,e.provider)}},Qni=class extends C{constructor(i,e,t,o){super();let n=i.getModel(),r=t.model;this.color=t.model.color,this.colorPicker=this._register(new Wwe(e.fragment,r,i.getOption(163),o,"standalone")),this._register(r.onColorFlushed(l=>{this.color=l})),this._register(r.onDidChangeColor(l=>{jae(n,r,l,t.range,t)}));let s=!1;this._register(i.onDidChangeModelContent(l=>{s?s=!1:(e.hide(),i.focus())})),jae(n,r,this.color,t.range,t)}},iCe=class{constructor(i,e){this._editor=i;this._themeService=e;this.hoverOrdinal=2}async createColorHover(i,e,t){if(!this._editor.hasModel()||!Xy.get(this._editor))return null;let n=await xIt(t,this._editor.getModel(),ve.None),r=null,s=null;for(let h of n){let g=h.colorInfo;z.containsRange(g.range,i.range)&&(r=g,s=h.provider)}let l=r??i,c=s??e,u=!!r;return{colorHover:jni.fromBaseColor(this,await XIt(this._editor.getModel(),l,c)),foundInEditor:u}}async updateEditorModel(i){if(!this._editor.hasModel())return;let e=i.model,t=new z(i.range.startLineNumber,i.range.startColumn,i.range.endLineNumber,i.range.endColumn);this._color&&(await jae(this._editor.getModel(),e,this._color,t,i),t=JIt(this._editor,t,e))}renderHoverParts(i,e){if(!(e.length===0||!this._editor.hasModel()))return this._setMinimumDimensions(i),this._renderedParts=new Qni(this._editor,i,e[0],this._themeService),this._renderedParts}_setMinimumDimensions(i){let e=this._editor.getOption(75)+8;i.setMinimumDimensions(new ai(302,e))}get _color(){return this._renderedParts?.color}};iCe=I([m(1,De)],iCe);var Yni=class{constructor(i,e){this.value=i;this.foundInEditor=e}},S8i=8,UWo=22,L7=class extends C{constructor(e,t,o,n,r,s,l,c){super();this._editor=e;this._standaloneColorPickerVisible=t;this._standaloneColorPickerFocused=o;this._keybindingService=r;this._languageFeaturesService=s;this._editorWorkerService=l;this._hoverService=c;this.allowEditorOverflow=!0;this._position=void 0;this._body=document.createElement("div");this._colorHover=null;this._selectionSetInEditor=!1;this._onResult=this._register(new E);this.onResult=this._onResult.event;this._renderedHoverParts=this._register(new me);this._renderedStatusBar=this._register(new me);this._standaloneColorPickerVisible.set(!0),this._standaloneColorPickerParticipant=n.createInstance(iCe,this._editor),this._position=this._editor._getViewModel()?.getPrimaryCursorState().modelState.position;let u=this._editor.getSelection(),p=u?{startLineNumber:u.startLineNumber,startColumn:u.startColumn,endLineNumber:u.endLineNumber,endColumn:u.endColumn}:{startLineNumber:0,endLineNumber:0,endColumn:0,startColumn:0},h=this._register(Vn(this._body));this._register(h.onDidBlur(g=>{this.hide()})),this._register(h.onDidFocus(g=>{this.focus()})),this._register(this._editor.onDidChangeCursorPosition(()=>{this._selectionSetInEditor?this._selectionSetInEditor=!1:this.hide()})),this._register(this._editor.onMouseMove(g=>{let f=g.target.element?.classList;f&&f.contains("colorpicker-color-decoration")&&this.hide()})),this._register(this.onResult(g=>{this._render(g.value,g.foundInEditor)})),this._start(p),this._body.style.zIndex="50",this._editor.addContentWidget(this)}static{this.ID="editor.contrib.standaloneColorPickerWidget"}updateEditor(){this._colorHover&&this._standaloneColorPickerParticipant.updateEditorModel(this._colorHover)}getId(){return L7.ID}getDomNode(){return this._body}getPosition(){if(!this._position)return null;let e=this._editor.getOption(69).above;return{position:this._position,secondaryPosition:this._position,preference:e?[1,2]:[2,1],positionAffinity:2}}hide(){this.dispose(),this._standaloneColorPickerVisible.set(!1),this._standaloneColorPickerFocused.set(!1),this._editor.removeContentWidget(this),this._editor.focus()}focus(){this._standaloneColorPickerFocused.set(!0),this._body.focus()}async _start(e){let t=await this._computeAsync(e);t&&this._onResult.fire(new Yni(t.result,t.foundInEditor))}async _computeAsync(e){if(!this._editor.hasModel())return null;let t={range:e,color:{red:0,green:0,blue:0,alpha:1}},o=await this._standaloneColorPickerParticipant.createColorHover(t,new Wq(this._editorWorkerService),this._languageFeaturesService.colorProvider);return o?{result:o.colorHover,foundInEditor:o.foundInEditor}:null}_render(e,t){let o=document.createDocumentFragment();this._renderedStatusBar.value=this._register(new f7(this._keybindingService,this._hoverService));let n={fragment:o,statusBar:this._renderedStatusBar.value,onContentsChanged:()=>{},setMinimumDimensions:()=>{},hide:()=>this.hide(),focus:()=>this.focus()};if(this._colorHover=e,this._renderedHoverParts.value=this._standaloneColorPickerParticipant.renderHoverParts(n,[e]),!this._renderedHoverParts.value){this._renderedStatusBar.clear(),this._renderedHoverParts.clear();return}let r=this._renderedHoverParts.value.colorPicker;this._body.classList.add("standalone-colorpicker-body"),this._body.style.maxHeight=Math.max(this._editor.getLayoutInfo().height/4,250)+"px",this._body.style.maxWidth=Math.max(this._editor.getLayoutInfo().width*.66,500)+"px",this._body.tabIndex=0,this._body.appendChild(o),r.layout();let s=r.body,l=s.saturationBox.domNode.clientWidth,c=s.domNode.clientWidth-l-UWo-S8i,u=r.body.enterButton;u?.onClicked(()=>{this.updateEditor(),this.hide()});let p=r.header,h=p.pickedColorNode;h.style.width=l+S8i+"px";let g=p.originalColorNode;g.style.width=c+"px",r.header.closeButton?.onClicked(()=>{this.hide()}),t&&(u&&(u.button.textContent="Replace"),this._selectionSetInEditor=!0,this._editor.setSelection(e.range)),this._editor.layoutContentWidget(this)}};L7=I([m(3,F),m(4,_e),m(5,zt),m(6,$s),m(7,tt)],L7);var QM=class extends C{constructor(e,t,o){super();this._editor=e;this._instantiationService=o;this._standaloneColorPickerWidget=null;this._standaloneColorPickerVisible=ue.standaloneColorPickerVisible.bindTo(t),this._standaloneColorPickerFocused=ue.standaloneColorPickerFocused.bindTo(t)}static{this.ID="editor.contrib.standaloneColorPickerController"}showOrFocus(){this._editor.hasModel()&&(this._standaloneColorPickerVisible.get()?this._standaloneColorPickerFocused.get()||this._standaloneColorPickerWidget?.focus():this._standaloneColorPickerWidget=this._instantiationService.createInstance(L7,this._editor,this._standaloneColorPickerVisible,this._standaloneColorPickerFocused))}hide(){this._standaloneColorPickerFocused.set(!1),this._standaloneColorPickerVisible.set(!1),this._standaloneColorPickerWidget?.hide(),this._editor.focus()}insertColor(){this._standaloneColorPickerWidget?.updateEditor(),this.hide()}static get(e){return e.getContribution(QM.ID)}};QM=I([m(1,X),m(2,F)],QM);var ewt=class extends wl{constructor(){super({id:"editor.action.showOrFocusStandaloneColorPicker",title:{...L(1048,"Show or Focus Standalone Color Picker"),mnemonicTitle:d(1047,null)},precondition:void 0,menu:[{id:D.CommandPalette}],metadata:{description:L(1049,"Show or focus a standalone color picker which uses the default color provider. It displays hex/rgb/hsl colors.")}})}runEditorCommand(i,e){QM.get(e)?.showOrFocus()}},twt=class extends xi{constructor(){super({id:"editor.action.hideColorPicker",label:L(1043,"Hide the Color Picker"),precondition:ue.standaloneColorPickerVisible.isEqualTo(!0),kbOpts:{primary:9,weight:100},metadata:{description:L(1044,"Hide the standalone color picker.")}})}run(i,e){QM.get(e)?.hide()}},iwt=class extends xi{constructor(){super({id:"editor.action.insertColorWithStandaloneColorPicker",label:L(1045,"Insert Color with Standalone Color Picker"),precondition:ue.standaloneColorPickerFocused.isEqualTo(!0),kbOpts:{primary:3,weight:100},metadata:{description:L(1046,"Insert hex/rgb/hsl colors with the focused standalone color picker.")}})}run(i,e){QM.get(e)?.insertColor()}};Jt(twt);Jt(iwt);W(ewt);go(i4e.ID,i4e,2);go(QM.ID,QM,1);go(Xy.ID,Xy,1);Dx(kwe);d_.register(C7);qe.registerCommand("_executeDocumentColorProvider",function(a,...i){let[e]=i;if(!(e instanceof A))throw Br();let{model:t,colorProviderRegistry:o,defaultColorDecoratorsEnablement:n}=ooi(a,e);return kIt(new wIt,o,t,ve.None,n)});qe.registerCommand("_executeColorPresentationProvider",function(a,...i){let[e,t]=i;if(!t)return;let{uri:o,range:n}=t;if(!(o instanceof A)||!Array.isArray(e)||e.length!==4||!z.isIRange(n))throw Br();let{model:r,colorProviderRegistry:s,defaultColorDecoratorsEnablement:l}=ooi(a,o),[c,u,p,h]=e;return kIt(new CIt({range:n,color:{red:c,green:u,blue:p,alpha:h}}),s,r,ve.None,l)});var Qq=class a{constructor(i,e,t){this.languageConfigurationService=t;this._selection=i,this._insertSpace=e,this._usedEndToken=null}static _haystackHasNeedleAtOffset(i,e,t){if(t<0)return!1;let o=e.length,n=i.length;if(t+o>n)return!1;for(let r=0;r<o;r++){let s=i.charCodeAt(t+r),l=e.charCodeAt(r);if(s!==l&&!(s>=65&&s<=90&&s+32===l)&&!(l>=65&&l<=90&&l+32===s))return!1}return!0}_createOperationsForBlockComment(i,e,t,o,n,r){let s=i.startLineNumber,l=i.startColumn,c=i.endLineNumber,u=i.endColumn,p=n.getLineContent(s),h=n.getLineContent(c),g=p.lastIndexOf(e,l-1+e.length),f=h.indexOf(t,u-1-t.length);if(g!==-1&&f!==-1)if(s===c)p.substring(g+e.length,f).indexOf(t)>=0&&(g=-1,f=-1);else{let b=p.substring(g+e.length),S=h.substring(0,f);(b.indexOf(t)>=0||S.indexOf(t)>=0)&&(g=-1,f=-1)}let v;g!==-1&&f!==-1?(o&&g+e.length<p.length&&p.charCodeAt(g+e.length)===32&&(e=e+" "),o&&f>0&&h.charCodeAt(f-1)===32&&(t=" "+t,f-=1),v=a._createRemoveBlockCommentOperations(new z(s,g+e.length+1,c,f+1),e,t)):(v=a._createAddBlockCommentOperations(i,e,t,this._insertSpace),this._usedEndToken=v.length===1?t:null);for(let b of v)r.addTrackedEditOperation(b.range,b.text)}static _createRemoveBlockCommentOperations(i,e,t){let o=[];return z.isEmpty(i)?o.push(An.delete(new z(i.startLineNumber,i.startColumn-e.length,i.endLineNumber,i.endColumn+t.length))):(o.push(An.delete(new z(i.startLineNumber,i.startColumn-e.length,i.startLineNumber,i.startColumn))),o.push(An.delete(new z(i.endLineNumber,i.endColumn,i.endLineNumber,i.endColumn+t.length)))),o}static _createAddBlockCommentOperations(i,e,t,o){let n=[];return z.isEmpty(i)?n.push(An.replace(new z(i.startLineNumber,i.startColumn,i.endLineNumber,i.endColumn),e+" "+t)):(n.push(An.insert(new Ie(i.startLineNumber,i.startColumn),e+(o?" ":""))),n.push(An.insert(new Ie(i.endLineNumber,i.endColumn),(o?" ":"")+t))),n}getEditOperations(i,e){let t=this._selection.startLineNumber,o=this._selection.startColumn;i.tokenization.tokenizeIfCheap(t);let n=i.getLanguageIdAtPosition(t,o),r=this.languageConfigurationService.getLanguageConfiguration(n).comments;!r||!r.blockCommentStartToken||!r.blockCommentEndToken||this._createOperationsForBlockComment(this._selection,r.blockCommentStartToken,r.blockCommentEndToken,this._insertSpace,i,e)}computeCursorState(i,e){let t=e.getInverseEditOperations();if(t.length===2){let o=t[0],n=t[1];return new Yt(o.range.endLineNumber,o.range.endColumn,n.range.startLineNumber,n.range.startColumn)}else{let o=t[0].range,n=this._usedEndToken?-this._usedEndToken.length-1:0;return new Yt(o.endLineNumber,o.endColumn+n,o.endLineNumber,o.endColumn+n)}}};var oCe=class a{constructor(i,e,t,o,n,r,s){this.languageConfigurationService=i;this._selection=e,this._indentSize=t,this._type=o,this._insertSpace=n,this._selectionId=null,this._deltaColumn=0,this._moveEndPositionDown=!1,this._ignoreEmptyLines=r,this._ignoreFirstLine=s||!1}static _gatherPreflightCommentStrings(i,e,t,o){i.tokenization.tokenizeIfCheap(e);let n=i.getLanguageIdAtPosition(e,1),r=o.getLanguageConfiguration(n).comments,s=r?r.lineCommentToken:null;if(!s)return null;let l=[];for(let c=0,u=t-e+1;c<u;c++)l[c]={ignore:!1,commentStr:s,commentStrOffset:0,commentStrLength:s.length};return l}static _analyzeLines(i,e,t,o,n,r,s,l,c){let u=!0,h=l.getLanguageConfiguration(c).comments?.lineCommentNoIndent??!1,g;i===0?g=!0:i===1?g=!1:g=!0;for(let f=0,v=o.length;f<v;f++){let b=o[f],S=n+f;if(S===n&&s){b.ignore=!0;continue}let y=t.getLineContent(S),w=Ap(y);if(w===-1){b.ignore=r,b.commentStrOffset=h?0:y.length;continue}u=!1;let k=h?0:w;if(b.ignore=!1,b.commentStrOffset=k,g&&!Qq._haystackHasNeedleAtOffset(y,b.commentStr,k)&&(i===0?g=!1:i===1||(b.ignore=!0)),g&&e){let T=w+b.commentStrLength;T<y.length&&y.charCodeAt(T)===32&&(b.commentStrLength+=1)}}if(i===0&&u){g=!1;for(let f=0,v=o.length;f<v;f++)o[f].ignore=!1}return{supported:!0,shouldRemoveComments:g,lines:o}}static _gatherPreflightData(i,e,t,o,n,r,s,l){let c=a._gatherPreflightCommentStrings(t,o,n,l),u=t.getLanguageIdAtPosition(o,1);return c===null?{supported:!1}:a._analyzeLines(i,e,t,c,o,r,s,l,u)}_executeLineComments(i,e,t,o){let n;t.shouldRemoveComments?n=a._createRemoveLineCommentsOperations(t.lines,o.startLineNumber):(a._normalizeInsertionPoint(i,t.lines,o.startLineNumber,this._indentSize),n=this._createAddLineCommentsOperations(t.lines,o.startLineNumber));let r=new Ie(o.positionLineNumber,o.positionColumn);for(let s=0,l=n.length;s<l;s++)e.addEditOperation(n[s].range,n[s].text),z.isEmpty(n[s].range)&&z.getStartPosition(n[s].range).equals(r)&&i.getLineContent(r.lineNumber).length+1===r.column&&(this._deltaColumn=(n[s].text||"").length);this._selectionId=e.trackSelection(o)}_attemptRemoveBlockComment(i,e,t,o){let n=e.startLineNumber,r=e.endLineNumber,s=o.length+Math.max(i.getLineFirstNonWhitespaceColumn(e.startLineNumber),e.startColumn),l=i.getLineContent(n).lastIndexOf(t,s-1),c=i.getLineContent(r).indexOf(o,e.endColumn-1-t.length);return l!==-1&&c===-1&&(c=i.getLineContent(n).indexOf(o,l+t.length),r=n),l===-1&&c!==-1&&(l=i.getLineContent(r).lastIndexOf(t,c),n=r),e.isEmpty()&&(l===-1||c===-1)&&(l=i.getLineContent(n).indexOf(t),l!==-1&&(c=i.getLineContent(n).indexOf(o,l+t.length))),l!==-1&&i.getLineContent(n).charCodeAt(l+t.length)===32&&(t+=" "),c!==-1&&i.getLineContent(r).charCodeAt(c-1)===32&&(o=" "+o,c-=1),l!==-1&&c!==-1?Qq._createRemoveBlockCommentOperations(new z(n,l+t.length+1,r,c+1),t,o):null}_executeBlockComment(i,e,t){i.tokenization.tokenizeIfCheap(t.startLineNumber);let o=i.getLanguageIdAtPosition(t.startLineNumber,1),n=this.languageConfigurationService.getLanguageConfiguration(o).comments;if(!n||!n.blockCommentStartToken||!n.blockCommentEndToken)return;let r=n.blockCommentStartToken,s=n.blockCommentEndToken,l=this._attemptRemoveBlockComment(i,t,r,s);if(!l){if(t.isEmpty()){let c=i.getLineContent(t.startLineNumber),u=Ap(c);u===-1&&(u=c.length),l=Qq._createAddBlockCommentOperations(new z(t.startLineNumber,u+1,t.startLineNumber,c.length+1),r,s,this._insertSpace)}else l=Qq._createAddBlockCommentOperations(new z(t.startLineNumber,i.getLineFirstNonWhitespaceColumn(t.startLineNumber),t.endLineNumber,i.getLineMaxColumn(t.endLineNumber)),r,s,this._insertSpace);l.length===1&&(this._deltaColumn=r.length+1)}this._selectionId=e.trackSelection(t);for(let c of l)e.addEditOperation(c.range,c.text)}getEditOperations(i,e){let t=this._selection;if(this._moveEndPositionDown=!1,t.startLineNumber===t.endLineNumber&&this._ignoreFirstLine){e.addEditOperation(new z(t.startLineNumber,i.getLineMaxColumn(t.startLineNumber),t.startLineNumber+1,1),t.startLineNumber===i.getLineCount()?"":`
`),this._selectionId=e.trackSelection(t);return}t.startLineNumber<t.endLineNumber&&t.endColumn===1&&(this._moveEndPositionDown=!0,t=t.setEndPosition(t.endLineNumber-1,i.getLineMaxColumn(t.endLineNumber-1)));let o=a._gatherPreflightData(this._type,this._insertSpace,i,t.startLineNumber,t.endLineNumber,this._ignoreEmptyLines,this._ignoreFirstLine,this.languageConfigurationService);return o.supported?this._executeLineComments(i,e,o,t):this._executeBlockComment(i,e,t)}computeCursorState(i,e){let t=e.getTrackedSelection(this._selectionId);return this._moveEndPositionDown&&(t=t.setEndPosition(t.endLineNumber+1,1)),new Yt(t.selectionStartLineNumber,t.selectionStartColumn+this._deltaColumn,t.positionLineNumber,t.positionColumn+this._deltaColumn)}static _createRemoveLineCommentsOperations(i,e){let t=[];for(let o=0,n=i.length;o<n;o++){let r=i[o];r.ignore||t.push(An.delete(new z(e+o,r.commentStrOffset+1,e+o,r.commentStrOffset+r.commentStrLength+1)))}return t}_createAddLineCommentsOperations(i,e){let t=[],o=this._insertSpace?" ":"";for(let n=0,r=i.length;n<r;n++){let s=i[n];s.ignore||t.push(An.insert(new Ie(e+n,s.commentStrOffset+1),s.commentStr+o))}return t}static nextVisibleColumn(i,e,t,o){return t?i+(e-i%e):i+o}static _normalizeInsertionPoint(i,e,t,o){let n=1073741824,r,s;for(let l=0,c=e.length;l<c;l++){if(e[l].ignore)continue;let u=i.getLineContent(t+l),p=0;for(let h=0,g=e[l].commentStrOffset;p<n&&h<g;h++)p=a.nextVisibleColumn(p,o,u.charCodeAt(h)===9,1);p<n&&(n=p)}n=Math.floor(n/o)*o;for(let l=0,c=e.length;l<c;l++){if(e[l].ignore)continue;let u=i.getLineContent(t+l),p=0;for(r=0,s=e[l].commentStrOffset;p<n&&r<s;r++)p=a.nextVisibleColumn(p,o,u.charCodeAt(r)===9,1);p>n?e[l].commentStrOffset=r-1:e[l].commentStrOffset=r}}};var o4e=class extends xi{constructor(i,e){super(e),this._type=i}run(i,e){let t=i.get(bs);if(!e.hasModel())return;let o=e.getModel(),n=[],r=o.getOptions(),s=e.getOption(29),l=e.getSelections().map((u,p)=>({selection:u,index:p,ignoreFirstLine:!1}));l.sort((u,p)=>z.compareRangesUsingStarts(u.selection,p.selection));let c=l[0];for(let u=1;u<l.length;u++){let p=l[u];c.selection.endLineNumber===p.selection.startLineNumber&&(c.index<p.index?p.ignoreFirstLine=!0:(c.ignoreFirstLine=!0,c=p))}for(let u of l)n.push(new oCe(t,u.selection,r.indentSize,this._type,s.insertSpace,s.ignoreEmptyLines,u.ignoreFirstLine));e.pushUndoStop(),e.executeCommands(this.id,n),e.pushUndoStop()}},Xni=class extends o4e{constructor(){super(0,{id:"editor.action.commentLine",label:L(1051,"Toggle Line Comment"),precondition:ue.writable,kbOpts:{kbExpr:ue.editorTextFocus,primary:2138,weight:100},menuOpts:{menuId:D.MenubarEditMenu,group:"5_insert",title:d(1055,null),order:1},canTriggerInlineEdits:!0})}},Jni=class extends o4e{constructor(){super(1,{id:"editor.action.addCommentLine",label:L(1052,"Add Line Comment"),precondition:ue.writable,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2081),weight:100},canTriggerInlineEdits:!0})}},Zni=class extends o4e{constructor(){super(2,{id:"editor.action.removeCommentLine",label:L(1053,"Remove Line Comment"),precondition:ue.writable,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2099),weight:100},canTriggerInlineEdits:!0})}},eri=class extends xi{constructor(){super({id:"editor.action.blockComment",label:L(1050,"Toggle Block Comment"),precondition:ue.writable,kbOpts:{kbExpr:ue.editorTextFocus,primary:1567,linux:{primary:3103},weight:100},menuOpts:{menuId:D.MenubarEditMenu,group:"5_insert",title:d(1054,null),order:2},canTriggerInlineEdits:!0})}run(i,e){let t=i.get(bs);if(!e.hasModel())return;let o=e.getOption(29),n=[],r=e.getSelections();for(let s of r)n.push(new Qq(s,o.insertSpace,t));e.pushUndoStop(),e.executeCommands(this.id,n),e.pushUndoStop()}};Jt(Xni);Jt(Jni);Jt(Zni);Jt(eri);var Hm=class{constructor(i,e,t,o,n,r,s,l){this._contextMenuService=e;this._contextViewService=t;this._contextKeyService=o;this._keybindingService=n;this._menuService=r;this._configurationService=s;this._workspaceContextService=l;this._toDispose=new P;this._contextMenuIsBeingShownCount=0;this._editor=i,this._toDispose.add(this._editor.onContextMenu(c=>this._onContextMenu(c))),this._toDispose.add(this._editor.onMouseWheel(c=>{if(this._contextMenuIsBeingShownCount>0){let u=this._contextViewService.getContextViewElement(),p=c.srcElement;p.shadowRoot&&_M(u)===p.shadowRoot||this._contextViewService.hideContextView()}})),this._toDispose.add(this._editor.onKeyDown(c=>{this._editor.getOption(30)&&c.keyCode===58&&(c.preventDefault(),c.stopPropagation(),this.showContextMenu())}))}static{this.ID="editor.contrib.contextmenu"}static get(i){return i.getContribution(Hm.ID)}_onContextMenu(i){if(!this._editor.hasModel())return;if(!this._editor.getOption(30)){this._editor.focus(),i.target.position&&!this._editor.getSelection().containsPosition(i.target.position)&&this._editor.setPosition(i.target.position);return}if(i.target.type===12||i.target.type===6&&i.target.detail.injectedText)return;if(i.event.preventDefault(),i.event.stopPropagation(),i.target.type===11)return this._showScrollbarContextMenu(i.event);if(i.target.type!==6&&i.target.type!==7&&i.target.type!==1)return;if(this._editor.focus(),i.target.position){let t=!1;for(let o of this._editor.getSelections())if(o.containsPosition(i.target.position)){t=!0;break}t||this._editor.setPosition(i.target.position)}let e=null;i.target.type!==1&&(e=i.event),this.showContextMenu(e)}showContextMenu(i){if(!this._editor.getOption(30)||!this._editor.hasModel())return;let e=this._getMenuActions(this._editor.getModel(),this._editor.contextMenuId);e.length>0&&this._doShowContextMenu(e,i)}_getMenuActions(i,e){let t=[],o=this._menuService.getMenuActions(e,this._contextKeyService,{arg:i.uri});for(let n of o){let[,r]=n,s=0;for(let l of r)if(l instanceof Cc){let c=this._getMenuActions(i,l.item.submenu);c.length>0&&(t.push(new $l(l.id,l.label,c)),s++)}else t.push(l),s++;s&&t.push(new li)}return t.length&&t.pop(),t}_doShowContextMenu(i,e=null){if(!this._editor.hasModel())return;let t=e;if(!t){this._editor.revealPosition(this._editor.getPosition(),1),this._editor.render();let n=this._editor.getScrolledVisiblePosition(this._editor.getPosition()),r=Yn(this._editor.getDomNode()),s=r.left+n.left,l=r.top+n.top+n.height;t={x:s,y:l}}let o=this._editor.getOption(144)&&!Nc;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:o?this._editor.getOverflowWidgetsDomNode()??this._editor.getDomNode():void 0,getAnchor:()=>t,getActions:()=>i,getActionViewItem:n=>{let r=this._keybindingFor(n);if(r)return new Lr(n,n,{label:!0,keybinding:r.getLabel(),isMenu:!0});let s=n;return typeof s.getActionViewItem=="function"?s.getActionViewItem():new Lr(n,n,{icon:!0,label:!0,isMenu:!0})},getKeyBinding:n=>this._keybindingFor(n),onHide:n=>{this._contextMenuIsBeingShownCount--}})}_showScrollbarContextMenu(i){if(!this._editor.hasModel()||w4i(this._workspaceContextService.getWorkspace()))return;let e=this._editor.getOption(81),t=0,o=c=>({id:`menu-action-${++t}`,label:c.label,tooltip:"",class:void 0,enabled:typeof c.enabled>"u"?!0:c.enabled,checked:c.checked,run:c.run}),n=(c,u)=>new $l(`menu-action-${++t}`,c,u,void 0),r=(c,u,p,h,g)=>{if(!u)return o({label:c,enabled:u,run:()=>{}});let f=b=>()=>{this._configurationService.updateValue(p,b)},v=[];for(let b of g)v.push(o({label:b.label,checked:h===b.value,run:f(b.value)}));return n(c,v)},s=[];s.push(o({label:d(1057,null),checked:e.enabled,run:()=>{this._configurationService.updateValue("editor.minimap.enabled",!e.enabled)}})),s.push(new li),s.push(o({label:d(1058,null),enabled:e.enabled,checked:e.renderCharacters,run:()=>{this._configurationService.updateValue("editor.minimap.renderCharacters",!e.renderCharacters)}})),s.push(r(d(1059,null),e.enabled,"editor.minimap.size",e.size,[{label:d(1062,null),value:"proportional"},{label:d(1060,null),value:"fill"},{label:d(1061,null),value:"fit"}])),s.push(r(d(1063,null),e.enabled,"editor.minimap.showSlider",e.showSlider,[{label:d(1065,null),value:"mouseover"},{label:d(1064,null),value:"always"}]));let l=this._editor.getOption(144)&&!Nc;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:l?this._editor.getDomNode():void 0,getAnchor:()=>i,getActions:()=>s,onHide:c=>{this._contextMenuIsBeingShownCount--,this._editor.focus()}})}_keybindingFor(i){return this._keybindingService.lookupKeybinding(i.id)}dispose(){this._contextMenuIsBeingShownCount>0&&this._contextViewService.hideContextView(),this._toDispose.dispose()}};Hm=I([m(1,ze),m(2,_n),m(3,X),m(4,_e),m(5,qt),m(6,B),m(7,Pe)],Hm);var tri=class extends xi{constructor(){super({id:"editor.action.showContextMenu",label:L(1056,"Show Editor Context Menu"),precondition:void 0,kbOpts:{kbExpr:ue.textInputFocus,primary:1092,weight:100}})}run(i,e){Hm.get(e)?.showContextMenu()}};go(Hm.ID,Hm,2);Jt(tri);var n4e=class{constructor(i){this.selections=i}equals(i){let e=this.selections.length,t=i.selections.length;if(e!==t)return!1;for(let o=0;o<e;o++)if(!this.selections[o].equalsSelection(i.selections[o]))return!1;return!0}},r4e=class{constructor(i,e,t){this.cursorState=i;this.scrollTop=e;this.scrollLeft=t}},nCe=class a extends C{static{this.ID="editor.contrib.cursorUndoRedoController"}static get(i){return i.getContribution(a.ID)}constructor(i){super(),this._editor=i,this._isCursorUndoRedo=!1,this._undoStack=[],this._redoStack=[],this._register(i.onDidChangeModel(e=>{this._undoStack=[],this._redoStack=[]})),this._register(i.onDidChangeModelContent(e=>{this._undoStack=[],this._redoStack=[]})),this._register(i.onDidChangeCursorSelection(e=>{if(this._isCursorUndoRedo||!e.oldSelections||e.oldModelVersionId!==e.modelVersionId)return;let t=new n4e(e.oldSelections);this._undoStack.length>0&&this._undoStack[this._undoStack.length-1].cursorState.equals(t)||(this._undoStack.push(new r4e(t,i.getScrollTop(),i.getScrollLeft())),this._redoStack=[],this._undoStack.length>50&&this._undoStack.shift())}))}cursorUndo(){!this._editor.hasModel()||this._undoStack.length===0||(this._redoStack.push(new r4e(new n4e(this._editor.getSelections()),this._editor.getScrollTop(),this._editor.getScrollLeft())),this._applyState(this._undoStack.pop()))}cursorRedo(){!this._editor.hasModel()||this._redoStack.length===0||(this._undoStack.push(new r4e(new n4e(this._editor.getSelections()),this._editor.getScrollTop(),this._editor.getScrollLeft())),this._applyState(this._redoStack.pop()))}_applyState(i){this._isCursorUndoRedo=!0,this._editor.setSelections(i.cursorState.selections),this._editor.setScrollPosition({scrollTop:i.scrollTop,scrollLeft:i.scrollLeft}),this._isCursorUndoRedo=!1}},iri=class extends xi{constructor(){super({id:"cursorUndo",label:L(1067,"Cursor Undo"),precondition:void 0,kbOpts:{kbExpr:ue.textInputFocus,primary:2099,weight:100}})}run(i,e,t){nCe.get(e)?.cursorUndo()}},ori=class extends xi{constructor(){super({id:"cursorRedo",label:L(1066,"Cursor Redo"),precondition:void 0})}run(i,e,t){nCe.get(e)?.cursorRedo()}};go(nCe.ID,nCe,0);Jt(iri);Jt(ori);var owt=class{constructor(i,e,t){this.selection=i,this.targetPosition=e,this.copy=t,this.targetSelection=null}getEditOperations(i,e){let t=i.getValueInRange(this.selection);if(this.copy||e.addEditOperation(this.selection,null),e.addEditOperation(new z(this.targetPosition.lineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.targetPosition.column),t),this.selection.containsPosition(this.targetPosition)&&!(this.copy&&(this.selection.getEndPosition().equals(this.targetPosition)||this.selection.getStartPosition().equals(this.targetPosition)))){this.targetSelection=this.selection;return}if(this.copy){this.targetSelection=new Yt(this.targetPosition.lineNumber,this.targetPosition.column,this.selection.endLineNumber-this.selection.startLineNumber+this.targetPosition.lineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column+this.selection.endColumn-this.selection.startColumn:this.selection.endColumn);return}if(this.targetPosition.lineNumber>this.selection.endLineNumber){this.targetSelection=new Yt(this.targetPosition.lineNumber-this.selection.endLineNumber+this.selection.startLineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column+this.selection.endColumn-this.selection.startColumn:this.selection.endColumn);return}if(this.targetPosition.lineNumber<this.selection.endLineNumber){this.targetSelection=new Yt(this.targetPosition.lineNumber,this.targetPosition.column,this.targetPosition.lineNumber+this.selection.endLineNumber-this.selection.startLineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column+this.selection.endColumn-this.selection.startColumn:this.selection.endColumn);return}this.selection.endColumn<=this.targetPosition.column?this.targetSelection=new Yt(this.targetPosition.lineNumber-this.selection.endLineNumber+this.selection.startLineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column-this.selection.endColumn+this.selection.startColumn:this.targetPosition.column-this.selection.endColumn+this.selection.startColumn,this.targetPosition.lineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column:this.selection.endColumn):this.targetSelection=new Yt(this.targetPosition.lineNumber-this.selection.endLineNumber+this.selection.startLineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.targetPosition.column+this.selection.endColumn-this.selection.startColumn)}computeCursorState(i,e){return this.targetSelection}};function rCe(a){return it?a.altKey:a.ctrlKey}var sCe=class a extends C{static{this.ID="editor.contrib.dragAndDrop"}static{this.TRIGGER_KEY_VALUE=it?6:5}static get(i){return i.getContribution(a.ID)}constructor(i){super(),this._editor=i,this._dndDecorationIds=this._editor.createDecorationsCollection(),this._register(this._editor.onMouseDown(e=>this._onEditorMouseDown(e))),this._register(this._editor.onMouseUp(e=>this._onEditorMouseUp(e))),this._register(this._editor.onMouseDrag(e=>this._onEditorMouseDrag(e))),this._register(this._editor.onMouseDrop(e=>this._onEditorMouseDrop(e))),this._register(this._editor.onMouseDropCanceled(()=>this._onEditorMouseDropCanceled())),this._register(this._editor.onKeyDown(e=>this.onEditorKeyDown(e))),this._register(this._editor.onKeyUp(e=>this.onEditorKeyUp(e))),this._register(this._editor.onDidBlurEditorWidget(()=>this.onEditorBlur())),this._register(this._editor.onDidBlurEditorText(()=>this.onEditorBlur())),this._mouseDown=!1,this._modifierPressed=!1,this._dragSelection=null}onEditorBlur(){this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1,this._modifierPressed=!1}onEditorKeyDown(i){!this._editor.getOption(42)||this._editor.getOption(28)||(rCe(i)&&(this._modifierPressed=!0),this._mouseDown&&rCe(i)&&this._editor.updateOptions({mouseStyle:"copy"}))}onEditorKeyUp(i){!this._editor.getOption(42)||this._editor.getOption(28)||(rCe(i)&&(this._modifierPressed=!1),this._mouseDown&&i.keyCode===a.TRIGGER_KEY_VALUE&&this._editor.updateOptions({mouseStyle:"default"}))}_onEditorMouseDown(i){this._mouseDown=!0}_onEditorMouseUp(i){this._mouseDown=!1,this._editor.updateOptions({mouseStyle:"text"})}_onEditorMouseDrag(i){let e=i.target;if(this._dragSelection===null){let o=(this._editor.getSelections()||[]).filter(n=>e.position&&n.containsPosition(e.position));if(o.length===1)this._dragSelection=o[0];else return}rCe(i.event)?this._editor.updateOptions({mouseStyle:"copy"}):this._editor.updateOptions({mouseStyle:"default"}),e.position&&(this._dragSelection.containsPosition(e.position)?this._removeDecoration():this.showAt(e.position))}_onEditorMouseDropCanceled(){this._editor.updateOptions({mouseStyle:"text"}),this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1}_onEditorMouseDrop(i){if(i.target&&(this._hitContent(i.target)||this._hitMargin(i.target))&&i.target.position){let e=new Ie(i.target.position.lineNumber,i.target.position.column);if(this._dragSelection===null){let t=null;if(i.event.shiftKey){let o=this._editor.getSelection();if(o){let{selectionStartLineNumber:n,selectionStartColumn:r}=o;t=[new Yt(n,r,e.lineNumber,e.column)]}}else t=(this._editor.getSelections()||[]).map(o=>o.containsPosition(e)?new Yt(e.lineNumber,e.column,e.lineNumber,e.column):o);this._editor.setSelections(t||[],"mouse",3)}else(!this._dragSelection.containsPosition(e)||(rCe(i.event)||this._modifierPressed)&&(this._dragSelection.getEndPosition().equals(e)||this._dragSelection.getStartPosition().equals(e)))&&(this._editor.pushUndoStop(),this._editor.executeCommand(a.ID,new owt(this._dragSelection,e,rCe(i.event)||this._modifierPressed)),this._editor.pushUndoStop())}this._editor.updateOptions({mouseStyle:"text"}),this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1}static{this._DECORATION_OPTIONS=po.register({description:"dnd-target",className:"dnd-target"})}showAt(i){this._dndDecorationIds.set([{range:new z(i.lineNumber,i.column,i.lineNumber,i.column),options:a._DECORATION_OPTIONS}]),this._editor.revealPosition(i,1)}_removeDecoration(){this._dndDecorationIds.clear()}_hitContent(i){return i.type===6||i.type===7}_hitMargin(i){return i.type===2||i.type===3||i.type===4}dispose(){this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1,this._modifierPressed=!1,super.dispose()}};go(sCe.ID,sCe,2);var nri="editor.action.pasteAs";go(ou.ID,ou,0);Dx(hwe);qi(new class extends xc{constructor(){super({id:Nii,precondition:dIt,kbOpts:{weight:100,primary:2137}})}runEditorCommand(a,i){return ou.get(i)?.changePasteType()}});qi(new class extends xc{constructor(){super({id:"editor.hidePasteWidget",precondition:dIt,kbOpts:{weight:100,primary:9}})}runEditorCommand(a,i){ou.get(i)?.clearWidgets()}});Jt(class I8i extends xi{static{this.argsSchema={oneOf:[{type:"object",required:["kind"],properties:{kind:{type:"string",description:d(1069,null)}}},{type:"object",required:["preferences"],properties:{preferences:{type:"array",description:d(1070,null),items:{type:"string"}}}}]}}constructor(){super({id:nri,label:L(1068,"Paste As..."),precondition:ue.writable,metadata:{description:"Paste as",args:[{name:"args",schema:I8i.argsSchema}]},canTriggerInlineEdits:!0})}run(i,e,t){let o;return t&&("kind"in t?o={only:new Is(t.kind)}:"preferences"in t&&(o={preferences:t.preferences.map(n=>new Is(n))})),ou.get(e)?.pasteAs(o)}});Jt(class extends xi{constructor(){super({id:"editor.action.pasteAsText",label:L(1071,"Paste as Text"),precondition:ue.writable,canTriggerInlineEdits:!0})}run(a,i){return ou.get(i)?.pasteAs({providerId:Rq.id})}});var nwt=class{constructor(){this._dragOperations=new Map}removeDragOperationTransfer(i){if(i&&this._dragOperations.has(i)){let e=this._dragOperations.get(i);return this._dragOperations.delete(i),e}}addDragOperationTransfer(i,e){this._dragOperations.set(i,e)}},sC=class{constructor(i){this.identifier=i}};var Yq=ae("treeViewsDndService");we(Yq,nwt,1);var s4e="editor.dropIntoEditor.preferences",rri="editor.changeDropType",rwt=new Q("dropWidgetVisible",!1,d(1090,null)),lh=class extends C{constructor(e,t,o,n,r){super();this._configService=o;this._languageFeaturesService=n;this._treeViewsDragAndDropService=r;this.treeItemsTransfer=VI.getInstance();this._dropProgressManager=this._register(t.createInstance(a7,"dropIntoEditor",e)),this._postDropWidgetManager=this._register(t.createInstance(c7,"dropIntoEditor",e,rwt,{id:rri,label:d(1091,null)},()=>lh._configureDefaultAction?[lh._configureDefaultAction]:[])),this._register(e.onDropIntoEditor(s=>this.onDropIntoEditor(e,s.position,s.event)))}static{this.ID="editor.contrib.dropIntoEditorController"}static get(e){return e.getContribution(lh.ID)}static setConfigureDefaultAction(e){this._configureDefaultAction=e}clearWidgets(){this._postDropWidgetManager.clear()}changeDropType(){this._postDropWidgetManager.tryShowSelector()}async onDropIntoEditor(e,t,o){if(!o.dataTransfer||!e.hasModel())return;lh._currentDropOperation?.cancel(),e.focus(),e.setPosition(t);let n=xn(async r=>{let s=new P,l=s.add(new Ex(e,1,void 0,r));try{let c=await this.extractDataTransferData(o);if(c.size===0||l.token.isCancellationRequested)return;let u=e.getModel();if(!u)return;let p=this._languageFeaturesService.documentDropEditProvider.ordered(u).filter(g=>g.dropMimeTypes?g.dropMimeTypes.some(f=>c.matches(f)):!0),h=s.add(await this.getDropEdits(p,u,t,c,l.token));if(l.token.isCancellationRequested)return;if(h.edits.length){let g=this.getInitialActiveEditIndex(u,h.edits),f=e.getOption(43).showDropSelector==="afterDrop";await this._postDropWidgetManager.applyEditAndShowIfNeeded([z.fromPositions(t)],{activeEditIndex:g,allEdits:h.edits},f,async v=>v,r)}}finally{s.dispose(),lh._currentDropOperation===n&&(lh._currentDropOperation=void 0)}});this._dropProgressManager.showWhile(t,d(1089,null),n,{cancel:()=>n.cancel()}),lh._currentDropOperation=n}async getDropEdits(e,t,o,n,r){let s=new P,l=await wa(Promise.all(e.map(async u=>{try{let p=await u.provideDocumentDropEdits(t,o,n,r);return p&&s.add(p),p?.edits.map(h=>({...h,providerId:u.id}))}catch(p){so(p)||console.error(p),console.error(p)}})),r),c=si(l??[]).flat();return{edits:sIt(c),dispose:()=>s.dispose()}}getInitialActiveEditIndex(e,t){let o=this._configService.getValue(s4e,{resource:e.uri});for(let n of Array.isArray(o)?o:[]){let r=new Is(n),s=t.findIndex(l=>l.kind&&r.contains(l.kind));if(s>=0)return s}return 0}async extractDataTransferData(e){if(!e.dataTransfer)return new bx;let t=$se(e.dataTransfer);if(this.treeItemsTransfer.hasData(sC.prototype)){let o=this.treeItemsTransfer.getData(sC.prototype);if(Array.isArray(o))for(let n of o){let r=await this._treeViewsDragAndDropService.removeDragOperationTransfer(n.identifier);if(r)for(let[s,l]of r)t.replace(s,l)}}return t}};lh=I([m(1,F),m(2,B),m(3,zt),m(4,Yq)],lh);go(lh.ID,lh,2);Dx(mwe);qi(new class extends xc{constructor(){super({id:rri,precondition:rwt,kbOpts:{weight:100,primary:2137}})}runEditorCommand(a,i,e){lh.get(i)?.changeDropType()}});qi(new class extends xc{constructor(){super({id:"editor.hideDropWidget",precondition:rwt,kbOpts:{weight:100,primary:9}})}runEditorCommand(a,i,e){lh.get(i)?.clearWidgets()}});var swt=class a extends Ma{constructor(e,t,o){super();this._hideSoon=this._register(new Dt(()=>this._hide(),2e3));this._isVisible=!1;this._editor=e,this._state=t,this._keybindingService=o,this._domNode=document.createElement("div"),this._domNode.className="findOptionsWidget",this._domNode.style.display="none",this._domNode.style.top="10px",this._domNode.style.zIndex="12",this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true");let n={inputActiveOptionBorder:wt(cW),inputActiveOptionForeground:wt(V$),inputActiveOptionBackground:wt(dW)},r={groupId:"find-options-widget"};this.caseSensitive=this._register(new Mwe({appendTitle:this._keybindingLabelFor(ad.ToggleCaseSensitiveCommand),isChecked:this._state.matchCase,hoverLifecycleOptions:r,...n})),this._domNode.appendChild(this.caseSensitive.domNode),this._register(this.caseSensitive.onChange(()=>{this._state.change({matchCase:this.caseSensitive.checked},!1)})),this.wholeWords=this._register(new Pwe({appendTitle:this._keybindingLabelFor(ad.ToggleWholeWordCommand),isChecked:this._state.wholeWord,hoverLifecycleOptions:r,...n})),this._domNode.appendChild(this.wholeWords.domNode),this._register(this.wholeWords.onChange(()=>{this._state.change({wholeWord:this.wholeWords.checked},!1)})),this.regex=this._register(new Awe({appendTitle:this._keybindingLabelFor(ad.ToggleRegexCommand),isChecked:this._state.isRegex,hoverLifecycleOptions:r,...n})),this._domNode.appendChild(this.regex.domNode),this._register(this.regex.onChange(()=>{this._state.change({isRegex:this.regex.checked},!1)})),this._editor.addOverlayWidget(this),this._register(this._state.onFindReplaceStateChange(s=>{let l=!1;s.isRegex&&(this.regex.checked=this._state.isRegex,l=!0),s.wholeWord&&(this.wholeWords.checked=this._state.wholeWord,l=!0),s.matchCase&&(this.caseSensitive.checked=this._state.matchCase,l=!0),!this._state.isRevealed&&l&&this._revealTemporarily()})),this._register(j(this._domNode,re.MOUSE_LEAVE,s=>this._onMouseLeave())),this._register(j(this._domNode,"mouseover",s=>this._onMouseOver()))}static{this.ID="editor.contrib.findOptionsWidget"}_keybindingLabelFor(e){return this._keybindingService.appendKeybinding("",e)}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}getId(){return a.ID}getDomNode(){return this._domNode}getPosition(){return{preference:0}}highlightFindOptions(){this._revealTemporarily()}_revealTemporarily(){this._show(),this._hideSoon.schedule()}_onMouseLeave(){this._hideSoon.schedule()}_onMouseOver(){this._hideSoon.cancel()}_show(){this._isVisible||(this._isVisible=!0,this._domNode.style.display="block")}_hide(){this._isVisible&&(this._isVisible=!1,this._domNode.style.display="none")}};function awt(a,i){return a===1?!0:a===2?!1:i}var G1=class extends C{constructor(){super();this._onFindReplaceStateChange=this._register(new E);this.onFindReplaceStateChange=this._onFindReplaceStateChange.event;this._searchString="",this._replaceString="",this._isRevealed=!1,this._isReplaceRevealed=!1,this._isRegex=!1,this._isRegexOverride=0,this._wholeWord=!1,this._wholeWordOverride=0,this._matchCase=!1,this._matchCaseOverride=0,this._preserveCase=!1,this._preserveCaseOverride=0,this._searchScope=null,this._matchesPosition=0,this._matchesCount=0,this._currentMatch=null,this._loop=!0,this._isSearching=!1,this._filters=null}get searchString(){return this._searchString}get replaceString(){return this._replaceString}get isRevealed(){return this._isRevealed}get isReplaceRevealed(){return this._isReplaceRevealed}get isRegex(){return awt(this._isRegexOverride,this._isRegex)}get wholeWord(){return awt(this._wholeWordOverride,this._wholeWord)}get matchCase(){return awt(this._matchCaseOverride,this._matchCase)}get preserveCase(){return awt(this._preserveCaseOverride,this._preserveCase)}get actualIsRegex(){return this._isRegex}get actualWholeWord(){return this._wholeWord}get actualMatchCase(){return this._matchCase}get actualPreserveCase(){return this._preserveCase}get searchScope(){return this._searchScope}get matchesPosition(){return this._matchesPosition}get matchesCount(){return this._matchesCount}get currentMatch(){return this._currentMatch}get isSearching(){return this._isSearching}get filters(){return this._filters}changeMatchInfo(e,t,o){let n={moveCursor:!1,updateHistory:!1,searchString:!1,replaceString:!1,isRevealed:!1,isReplaceRevealed:!1,isRegex:!1,wholeWord:!1,matchCase:!1,preserveCase:!1,searchScope:!1,matchesPosition:!1,matchesCount:!1,currentMatch:!1,loop:!1,isSearching:!1,filters:!1},r=!1;t===0&&(e=0),e>t&&(e=t),this._matchesPosition!==e&&(this._matchesPosition=e,n.matchesPosition=!0,r=!0),this._matchesCount!==t&&(this._matchesCount=t,n.matchesCount=!0,r=!0),typeof o<"u"&&(z.equalsRange(this._currentMatch,o)||(this._currentMatch=o,n.currentMatch=!0,r=!0)),r&&this._onFindReplaceStateChange.fire(n)}change(e,t,o=!0){let n={moveCursor:t,updateHistory:o,searchString:!1,replaceString:!1,isRevealed:!1,isReplaceRevealed:!1,isRegex:!1,wholeWord:!1,matchCase:!1,preserveCase:!1,searchScope:!1,matchesPosition:!1,matchesCount:!1,currentMatch:!1,loop:!1,isSearching:!1,filters:!1},r=!1,s=this.isRegex,l=this.wholeWord,c=this.matchCase,u=this.preserveCase;typeof e.searchString<"u"&&this._searchString!==e.searchString&&(this._searchString=e.searchString,n.searchString=!0,r=!0),typeof e.replaceString<"u"&&this._replaceString!==e.replaceString&&(this._replaceString=e.replaceString,n.replaceString=!0,r=!0),typeof e.isRevealed<"u"&&this._isRevealed!==e.isRevealed&&(this._isRevealed=e.isRevealed,n.isRevealed=!0,r=!0),typeof e.isReplaceRevealed<"u"&&this._isReplaceRevealed!==e.isReplaceRevealed&&(this._isReplaceRevealed=e.isReplaceRevealed,n.isReplaceRevealed=!0,r=!0),typeof e.isRegex<"u"&&(this._isRegex=e.isRegex),typeof e.wholeWord<"u"&&(this._wholeWord=e.wholeWord),typeof e.matchCase<"u"&&(this._matchCase=e.matchCase),typeof e.preserveCase<"u"&&(this._preserveCase=e.preserveCase),typeof e.searchScope<"u"&&(e.searchScope?.every(p=>this._searchScope?.some(h=>!z.equalsRange(h,p)))||(this._searchScope=e.searchScope,n.searchScope=!0,r=!0)),typeof e.loop<"u"&&this._loop!==e.loop&&(this._loop=e.loop,n.loop=!0,r=!0),typeof e.isSearching<"u"&&this._isSearching!==e.isSearching&&(this._isSearching=e.isSearching,n.isSearching=!0,r=!0),typeof e.filters<"u"&&(this._filters?this._filters.update(e.filters):this._filters=e.filters,n.filters=!0,r=!0),this._isRegexOverride=typeof e.isRegexOverride<"u"?e.isRegexOverride:0,this._wholeWordOverride=typeof e.wholeWordOverride<"u"?e.wholeWordOverride:0,this._matchCaseOverride=typeof e.matchCaseOverride<"u"?e.matchCaseOverride:0,this._preserveCaseOverride=typeof e.preserveCaseOverride<"u"?e.preserveCaseOverride:0,s!==this.isRegex&&(r=!0,n.isRegex=!0),l!==this.wholeWord&&(r=!0,n.wholeWord=!0),c!==this.matchCase&&(r=!0,n.matchCase=!0),u!==this.preserveCase&&(r=!0,n.preserveCase=!0),r&&this._onFindReplaceStateChange.fire(n)}canNavigateBack(){return this.canNavigateInLoop()||this.matchesPosition!==1}canNavigateForward(){return this.canNavigateInLoop()||this.matchesPosition<this.matchesCount}canNavigateInLoop(){return this._loop||this.matchesCount>=rO}};var h_=class{constructor(i){this.storageService=i;this.inMemoryValues=new Set;this._onDidChangeEmitter=new E,this.onDidChange=this._onDidChangeEmitter.event,this.load()}static{this.FIND_HISTORY_KEY="workbench.find.history"}static{this._instance=null}static getOrCreate(i){return h_._instance||(h_._instance=new h_(i)),h_._instance}delete(i){let e=this.inMemoryValues.delete(i);return this.save(),e}add(i){return this.inMemoryValues.add(i),this.save(),this}has(i){return this.inMemoryValues.has(i)}clear(){this.inMemoryValues.clear(),this.save()}forEach(i,e){return this.load(),this.inMemoryValues.forEach(i)}replace(i){this.inMemoryValues=new Set(i),this.save()}load(){let i,e=this.storageService.get(h_.FIND_HISTORY_KEY,1);if(e)try{i=JSON.parse(e)}catch{}this.inMemoryValues=new Set(i||[])}save(){let i=[];return this.inMemoryValues.forEach(e=>i.push(e)),new Promise(e=>{this.storageService.store(h_.FIND_HISTORY_KEY,JSON.stringify(i),1,0),this._onDidChangeEmitter.fire(i),e()})}};h_=I([m(0,le)],h_);var g_=class{constructor(i){this.storageService=i;this.inMemoryValues=new Set;this._onDidChangeEmitter=new E,this.onDidChange=this._onDidChangeEmitter.event,this.load()}static{this.FIND_HISTORY_KEY="workbench.replace.history"}static{this._instance=null}static getOrCreate(i){return g_._instance||(g_._instance=new g_(i)),g_._instance}delete(i){let e=this.inMemoryValues.delete(i);return this.save(),e}add(i){return this.inMemoryValues.add(i),this.save(),this}has(i){return this.inMemoryValues.has(i)}clear(){this.inMemoryValues.clear(),this.save()}forEach(i,e){return this.load(),this.inMemoryValues.forEach(i)}replace(i){this.inMemoryValues=new Set(i),this.save()}load(){let i,e=this.storageService.get(g_.FIND_HISTORY_KEY,1);if(e)try{i=JSON.parse(e)}catch{}this.inMemoryValues=new Set(i||[])}save(){let i=[];return this.inMemoryValues.forEach(e=>i.push(e)),new Promise(e=>{this.storageService.store(g_.FIND_HISTORY_KEY,JSON.stringify(i),1,0),this._onDidChangeEmitter.fire(i),e()})}};g_=I([m(0,le)],g_);var KWo=524288;function R7(a,i="single",e=!1){if(!a.hasModel())return null;let t=a.getSelection();if(i==="single"&&t.startLineNumber===t.endLineNumber||i==="multiple"){if(t.isEmpty()){let o=a.getConfiguredWordAtPosition(t.getStartPosition());if(o&&e===!1)return o.word}else if(a.getModel().getValueLengthInRange(t)<KWo)return a.getModel().getValueInRange(t)}return null}var Tf=class extends C{static{this.ID="editor.contrib.findController"}get editor(){return this._editor}static get(i){return i.getContribution(Tf.ID)}constructor(i,e,t,o,n,r){super(),this._editor=i,this._findWidgetVisible=fE.bindTo(e),this._contextKeyService=e,this._storageService=t,this._clipboardService=o,this._notificationService=n,this._hoverService=r,this._updateHistoryDelayer=this._register(new jo(500)),this._state=this._register(new G1),this.loadQueryState(),this._register(this._state.onFindReplaceStateChange(s=>this._onStateChanged(s))),this._model=null,this._register(this._editor.onDidChangeModel(()=>{let s=this._editor.getModel()&&this._state.isRevealed;this.disposeModel(),this._state.change({searchScope:null,matchCase:this._storageService.getBoolean("editor.matchCase",1,!1),wholeWord:this._storageService.getBoolean("editor.wholeWord",1,!1),isRegex:this._storageService.getBoolean("editor.isRegex",1,!1),preserveCase:this._storageService.getBoolean("editor.preserveCase",1,!1)},!1),s&&this._start({forceRevealReplace:!1,seedSearchStringFromSelection:"none",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!1,updateSearchScope:!1,loop:this._editor.getOption(50).loop})}))}dispose(){this.disposeModel(),super.dispose()}disposeModel(){this._model&&(this._model.dispose(),this._model=null)}_onStateChanged(i){this.saveQueryState(i),i.isRevealed&&(this._state.isRevealed?this._findWidgetVisible.set(!0):(this._findWidgetVisible.reset(),this.disposeModel())),i.searchString&&this.setGlobalBufferTerm(this._state.searchString)}saveQueryState(i){i.isRegex&&this._storageService.store("editor.isRegex",this._state.actualIsRegex,1,1),i.wholeWord&&this._storageService.store("editor.wholeWord",this._state.actualWholeWord,1,1),i.matchCase&&this._storageService.store("editor.matchCase",this._state.actualMatchCase,1,1),i.preserveCase&&this._storageService.store("editor.preserveCase",this._state.actualPreserveCase,1,1)}loadQueryState(){this._state.change({matchCase:this._storageService.getBoolean("editor.matchCase",1,this._state.matchCase),wholeWord:this._storageService.getBoolean("editor.wholeWord",1,this._state.wholeWord),isRegex:this._storageService.getBoolean("editor.isRegex",1,this._state.isRegex),preserveCase:this._storageService.getBoolean("editor.preserveCase",1,this._state.preserveCase)},!1)}isFindInputFocused(){return!!Rwe.getValue(this._contextKeyService)}wasReplaceInputLastFocused(){return!1}focusLastElement(){}getState(){return this._state}closeFindWidget(){this._state.change({isRevealed:!1,searchScope:null},!1),this._editor.focus()}toggleCaseSensitive(){this._state.change({matchCase:!this._state.matchCase},!1),this._state.isRevealed||this.highlightFindOptions()}toggleWholeWords(){this._state.change({wholeWord:!this._state.wholeWord},!1),this._state.isRevealed||this.highlightFindOptions()}toggleRegex(){this._state.change({isRegex:!this._state.isRegex},!1),this._state.isRevealed||this.highlightFindOptions()}togglePreserveCase(){this._state.change({preserveCase:!this._state.preserveCase},!1),this._state.isRevealed||this.highlightFindOptions()}toggleSearchScope(){if(this._state.searchScope)this._state.change({searchScope:null},!0);else if(this._editor.hasModel()){let i=this._editor.getSelections();i=i.map(e=>(e.endColumn===1&&e.endLineNumber>e.startLineNumber&&(e=e.setEndPosition(e.endLineNumber-1,this._editor.getModel().getLineMaxColumn(e.endLineNumber-1))),e.isEmpty()?null:e)).filter(e=>!!e),i.length&&this._state.change({searchScope:i},!0)}}setSearchString(i){this._state.isRegex&&(i=Yr(i)),this._state.change({searchString:i},!1)}highlightFindOptions(i=!1){}async _start(i,e){if(this.disposeModel(),!this._editor.hasModel())return;let t={...e,isRevealed:!0};if(i.seedSearchStringFromSelection==="single"){let o=R7(this._editor,i.seedSearchStringFromSelection,i.seedSearchStringFromNonEmptySelection);o&&(this._state.isRegex?t.searchString=Yr(o):t.searchString=o)}else if(i.seedSearchStringFromSelection==="multiple"&&!i.updateSearchScope){let o=R7(this._editor,i.seedSearchStringFromSelection);o&&(t.searchString=o)}if(!t.searchString&&i.seedSearchStringFromGlobalClipboard){let o=await this.getGlobalBufferTerm();if(!this._editor.hasModel())return;o&&(t.searchString=o)}if(i.forceRevealReplace||t.isReplaceRevealed?t.isReplaceRevealed=!0:this._findWidgetVisible.get()||(t.isReplaceRevealed=!1),i.updateSearchScope){let o=this._editor.getSelections();o.some(n=>!n.isEmpty())&&(t.searchScope=o)}t.loop=i.loop,this._state.change(t,!1),this._model||(this._model=new BIt(this._editor,this._state))}start(i,e){return this._start(i,e)}moveToNextMatch(){return this._model?(this._model.moveToNextMatch(),!0):!1}moveToPrevMatch(){return this._model?(this._model.moveToPrevMatch(),!0):!1}goToMatch(i){return this._model?(this._model.moveToMatch(i),!0):!1}replace(){return this._model?(this._model.replace(),!0):!1}replaceAll(){return this._model?this._editor.getModel()?.isTooLargeForHeapOperation()?(this._notificationService.warn(d(1109,null)),!1):(this._model.replaceAll(),!0):!1}selectAllMatches(){return this._model?(this._model.selectAllMatches(),this._editor.focus(),!0):!1}async getGlobalBufferTerm(){return this._editor.getOption(50).globalFindClipboard&&this._editor.hasModel()&&!this._editor.getModel().isTooLargeForSyncing()?this._clipboardService.readFindText():""}setGlobalBufferTerm(i){this._editor.getOption(50).globalFindClipboard&&this._editor.hasModel()&&!this._editor.getModel().isTooLargeForSyncing()&&this._clipboardService.writeFindText(i)}};Tf=I([m(1,X),m(2,le),m(3,Wi),m(4,Ne),m(5,tt)],Tf);var a4e=class extends Tf{constructor(e,t,o,n,r,s,l,c,u,p){super(e,o,s,l,r,c);this._contextViewService=t;this._keybindingService=n;this._configurationService=u;this._accessibilityService=p;this._widget=null,this._findOptionsWidget=null,this._findWidgetSearchHistory=h_.getOrCreate(s),this._replaceWidgetHistory=g_.getOrCreate(s)}async _start(e,t){this._widget||this._createFindWidget();let o=this._editor.getSelection(),n=!1;switch(this._editor.getOption(50).autoFindInSelection){case"always":n=!0;break;case"never":n=!1;break;case"multiline":{n=!!o&&o.startLineNumber!==o.endLineNumber;break}default:break}e.updateSearchScope=e.updateSearchScope||n,await super._start(e,t),this._widget&&(e.shouldFocus===2?this._widget.focusReplaceInput():e.shouldFocus===1&&this._widget.focusFindInput())}highlightFindOptions(e=!1){this._widget||this._createFindWidget(),this._state.isRevealed&&!e?this._widget.highlightFindOptions():this._findOptionsWidget.highlightFindOptions()}_createFindWidget(){this._widget=this._register(new $It(this._editor,this,this._state,this._contextViewService,this._keybindingService,this._contextKeyService,this._hoverService,this._findWidgetSearchHistory,this._replaceWidgetHistory,this._configurationService,this._accessibilityService)),this._findOptionsWidget=this._register(new swt(this._editor,this._state,this._keybindingService))}wasReplaceInputLastFocused(){return this._widget?.lastFocusedInputWasReplace??!1}focusLastElement(){this._widget?.focusLastElement()}saveViewState(){return this._widget?.getViewState()}restoreViewState(e){this._widget?.setViewState(e)}};a4e=I([m(1,_n),m(2,X),m(3,_e),m(4,Ne),m(5,le),m(6,Wi),m(7,tt),m(8,B),m(9,Bi)],a4e);var uri=KGe(new qre({id:ad.StartFindAction,label:L(1105,"Find"),precondition:x.or(ue.focus,x.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2084,weight:100},menuOpts:{menuId:D.MenubarEditMenu,group:"3_find",title:d(1101,null),order:1}}));uri.addImplementation(0,(a,i,e)=>{let t=Tf.get(i);return t?t.start({forceRevealReplace:!1,seedSearchStringFromSelection:i.getOption(50).seedSearchStringFromSelection!=="never"?"single":"none",seedSearchStringFromNonEmptySelection:i.getOption(50).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:i.getOption(50).globalFindClipboard,shouldFocus:1,shouldAnimate:!0,updateSearchScope:!1,loop:i.getOption(50).loop}):!1});var GWo={description:"Open a new In-Editor Find Widget.",args:[{name:"Open a new In-Editor Find Widget args",schema:{properties:{searchString:{type:"string"},replaceString:{type:"string"},isRegex:{type:"boolean"},matchWholeWord:{type:"boolean"},isCaseSensitive:{type:"boolean"},preserveCase:{type:"boolean"},findInSelection:{type:"boolean"}}}}]},sri=class extends xi{constructor(){super({id:ad.StartFindWithArgs,label:L(1106,"Find with Arguments"),precondition:void 0,kbOpts:{kbExpr:null,primary:0,weight:100},metadata:GWo})}async run(i,e,t){let o=Tf.get(e);if(o){let n=t?{searchString:t.searchString,replaceString:t.replaceString,isReplaceRevealed:t.replaceString!==void 0,isRegex:t.isRegex,wholeWord:t.matchWholeWord,matchCase:t.isCaseSensitive,preserveCase:t.preserveCase}:{};await o.start({forceRevealReplace:!1,seedSearchStringFromSelection:o.getState().searchString.length===0&&e.getOption(50).seedSearchStringFromSelection!=="never"?"single":"none",seedSearchStringFromNonEmptySelection:e.getOption(50).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:!0,shouldFocus:1,shouldAnimate:!0,updateSearchScope:t?.findInSelection||!1,loop:e.getOption(50).loop},n),o.setGlobalBufferTerm(o.getState().searchString)}}},ari=class extends xi{constructor(){super({id:ad.StartFindWithSelection,label:L(1107,"Find with Selection"),precondition:void 0,kbOpts:{kbExpr:null,primary:0,mac:{primary:2083},weight:100}})}async run(i,e){let t=Tf.get(e);t&&(await t.start({forceRevealReplace:!1,seedSearchStringFromSelection:"multiple",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:e.getOption(50).loop}),t.setGlobalBufferTerm(t.getState().searchString))}};async function y8i(a,i){let e=Tf.get(a);if(!e)return;let t=()=>(i?e.moveToNextMatch():e.moveToPrevMatch())?(e.editor.pushUndoStop(),!0):!1;t()||(await e.start({forceRevealReplace:!1,seedSearchStringFromSelection:e.getState().searchString.length===0&&a.getOption(50).seedSearchStringFromSelection!=="never"?"single":"none",seedSearchStringFromNonEmptySelection:a.getOption(50).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:!0,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:a.getOption(50).loop}),t())}var pri=KGe(new qre({id:ad.NextMatchFindAction,label:L(1099,"Find Next"),precondition:void 0,kbOpts:[{kbExpr:ue.focus,primary:61,mac:{primary:2085,secondary:[61]},weight:100},{kbExpr:x.and(ue.focus,Rwe),primary:3,weight:100}]}));pri.addImplementation(0,async(a,i,e)=>y8i(i,!0));var mri=KGe(new qre({id:ad.PreviousMatchFindAction,label:L(1100,"Find Previous"),precondition:void 0,kbOpts:[{kbExpr:ue.focus,primary:1085,mac:{primary:3109,secondary:[1085]},weight:100},{kbExpr:x.and(ue.focus,Rwe),primary:1027,weight:100}]}));mri.addImplementation(0,async(a,i,e)=>y8i(i,!1));var lri=class extends xi{constructor(){super({id:ad.GoToMatchFindAction,label:L(1095,"Go to Match..."),precondition:fE});this._highlightDecorations=[]}run(e,t){let o=Tf.get(t);if(!o)return;let n=o.getState().matchesCount;if(n<1){e.get(Ne).notify({severity:St.Warning,message:d(1098,null)});return}let r=e.get(Ge),s=new P,l=s.add(r.createInputBox());l.placeholder=d(1096,null,n);let c=p=>{let h=parseInt(p);if(isNaN(h))return;let g=o.getState().matchesCount;if(h>0&&h<=g)return h-1;if(h<0&&h>=-g)return g+h},u=p=>{let h=c(p);if(typeof h=="number"){l.validationMessage=void 0,o.goToMatch(h);let g=o.getState().currentMatch;g&&this.addDecorations(t,g)}else l.validationMessage=d(1097,null,o.getState().matchesCount),this.clearDecorations(t)};s.add(l.onDidChangeValue(p=>{u(p)})),s.add(l.onDidAccept(()=>{let p=c(l.value);typeof p=="number"?(o.goToMatch(p),l.hide()):l.validationMessage=d(1097,null,o.getState().matchesCount)})),s.add(l.onDidHide(()=>{this.clearDecorations(t),s.dispose()})),l.show()}clearDecorations(e){e.changeDecorations(t=>{this._highlightDecorations=t.deltaDecorations(this._highlightDecorations,[])})}addDecorations(e,t){e.changeDecorations(o=>{this._highlightDecorations=o.deltaDecorations(this._highlightDecorations,[{range:t,options:{description:"find-match-quick-access-range-highlight",className:"rangeHighlight",isWholeLine:!0}},{range:t,options:{description:"find-match-quick-access-range-highlight-overview",overviewRuler:{color:Ss(y9),position:7}}}])})}},lwt=class extends xi{async run(i,e){let t=Tf.get(e);if(!t)return;let o=R7(e,"single",!1);o&&t.setSearchString(o),this._run(t)||(await t.start({forceRevealReplace:!1,seedSearchStringFromSelection:"none",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:e.getOption(50).loop}),this._run(t))}},cri=class extends lwt{constructor(){super({id:ad.NextSelectionMatchFindAction,label:L(1103,"Find Next Selection"),precondition:void 0,kbOpts:{kbExpr:ue.focus,primary:2109,weight:100}})}_run(i){return i.moveToNextMatch()}},dri=class extends lwt{constructor(){super({id:ad.PreviousSelectionMatchFindAction,label:L(1104,"Find Previous Selection"),precondition:void 0,kbOpts:{kbExpr:ue.focus,primary:3133,weight:100}})}_run(i){return i.moveToPrevMatch()}},hri=KGe(new qre({id:ad.StartFindReplaceAction,label:L(1108,"Replace"),precondition:x.or(ue.focus,x.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2086,mac:{primary:2596},weight:100},menuOpts:{menuId:D.MenubarEditMenu,group:"3_find",title:d(1102,null),order:2}}));hri.addImplementation(0,(a,i,e)=>{if(!i.hasModel()||i.getOption(104))return!1;let t=Tf.get(i);if(!t)return!1;let o=i.getSelection(),n=t.isFindInputFocused(),r=!o.isEmpty()&&o.startLineNumber===o.endLineNumber&&i.getOption(50).seedSearchStringFromSelection!=="never"&&!n,s=n||r?2:1;return t.start({forceRevealReplace:!0,seedSearchStringFromSelection:r?"single":"none",seedSearchStringFromNonEmptySelection:i.getOption(50).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:i.getOption(50).seedSearchStringFromSelection!=="never",shouldFocus:s,shouldAnimate:!0,updateSearchScope:!1,loop:i.getOption(50).loop})});go(Tf.ID,a4e,0);Jt(sri);Jt(ari);Jt(lri);Jt(cri);Jt(dri);var OW=xc.bindToContribution(Tf.get);qi(new OW({id:ad.CloseFindWidgetCommand,precondition:fE,handler:a=>a.closeFindWidget(),kbOpts:{weight:105,kbExpr:x.and(ue.focus,x.not("isComposing")),primary:9,secondary:[1033]}}));qi(new OW({id:ad.ToggleCaseSensitiveCommand,precondition:void 0,handler:a=>a.toggleCaseSensitive(),kbOpts:{weight:105,kbExpr:ue.focus,primary:Bq.primary,mac:Bq.mac,win:Bq.win,linux:Bq.linux}}));qi(new OW({id:ad.ToggleWholeWordCommand,precondition:void 0,handler:a=>a.toggleWholeWords(),kbOpts:{weight:105,kbExpr:ue.focus,primary:Hq.primary,mac:Hq.mac,win:Hq.win,linux:Hq.linux}}));qi(new OW({id:ad.ToggleRegexCommand,precondition:void 0,handler:a=>a.toggleRegex(),kbOpts:{weight:105,kbExpr:ue.focus,primary:Uq.primary,mac:Uq.mac,win:Uq.win,linux:Uq.linux}}));qi(new OW({id:ad.ToggleSearchScopeCommand,precondition:void 0,handler:a=>a.toggleSearchScope(),kbOpts:{weight:105,kbExpr:ue.focus,primary:y5e.primary,mac:y5e.mac,win:y5e.win,linux:y5e.linux}}));qi(new OW({id:ad.TogglePreserveCaseCommand,precondition:void 0,handler:a=>a.togglePreserveCase(),kbOpts:{weight:105,kbExpr:ue.focus,primary:$ae.primary,mac:$ae.mac,win:$ae.win,linux:$ae.linux}}));qi(new OW({id:ad.ReplaceOneAction,precondition:fE,handler:a=>a.replace(),kbOpts:{weight:105,kbExpr:ue.focus,primary:3094}}));qi(new OW({id:ad.ReplaceOneAction,precondition:fE,handler:a=>a.replace(),kbOpts:{weight:105,kbExpr:x.and(ue.focus,I5e,ue.isComposing.negate()),primary:3}}));qi(new OW({id:ad.ReplaceAllAction,precondition:fE,handler:a=>a.replaceAll(),kbOpts:{weight:105,kbExpr:ue.focus,primary:2563}}));qi(new OW({id:ad.ReplaceAllAction,precondition:fE,handler:a=>a.replaceAll(),kbOpts:{weight:105,kbExpr:x.and(ue.focus,I5e),primary:void 0,mac:{primary:2051}}}));qi(new OW({id:ad.SelectAllMatchesAction,precondition:fE,handler:a=>a.selectAllMatches(),kbOpts:{weight:105,kbExpr:ue.focus,primary:515}}));var $Wo={0:" ",1:"u",2:"r"},w8i=65535,YM=16777215,C8i=4278190080,l4e=class{constructor(i){let e=Math.ceil(i/32);this._states=new Uint32Array(e)}get(i){let e=i/32|0,t=i%32;return(this._states[e]&1<<t)!==0}set(i,e){let t=i/32|0,o=i%32,n=this._states[t];e?this._states[t]=n|1<<o:this._states[t]=n&~(1<<o)}},jI=class a{constructor(i,e,t){if(i.length!==e.length||i.length>w8i)throw new Error("invalid startIndexes or endIndexes size");this._startIndexes=i,this._endIndexes=e,this._collapseStates=new l4e(i.length),this._userDefinedStates=new l4e(i.length),this._recoveredStates=new l4e(i.length),this._types=t,this._parentsComputed=!1}ensureParentIndices(){if(!this._parentsComputed){this._parentsComputed=!0;let i=[],e=(t,o)=>{let n=i[i.length-1];return this.getStartLineNumber(n)<=t&&this.getEndLineNumber(n)>=o};for(let t=0,o=this._startIndexes.length;t<o;t++){let n=this._startIndexes[t],r=this._endIndexes[t];if(n>YM||r>YM)throw new Error("startLineNumber or endLineNumber must not exceed "+YM);for(;i.length>0&&!e(n,r);)i.pop();let s=i.length>0?i[i.length-1]:-1;i.push(t),this._startIndexes[t]=n+((s&255)<<24),this._endIndexes[t]=r+((s&65280)<<16)}}}get length(){return this._startIndexes.length}getStartLineNumber(i){return this._startIndexes[i]&YM}getEndLineNumber(i){return this._endIndexes[i]&YM}getType(i){return this._types?this._types[i]:void 0}hasTypes(){return!!this._types}isCollapsed(i){return this._collapseStates.get(i)}setCollapsed(i,e){this._collapseStates.set(i,e)}isUserDefined(i){return this._userDefinedStates.get(i)}setUserDefined(i,e){return this._userDefinedStates.set(i,e)}isRecovered(i){return this._recoveredStates.get(i)}setRecovered(i,e){return this._recoveredStates.set(i,e)}getSource(i){return this.isUserDefined(i)?1:this.isRecovered(i)?2:0}setSource(i,e){e===1?(this.setUserDefined(i,!0),this.setRecovered(i,!1)):e===2?(this.setUserDefined(i,!1),this.setRecovered(i,!0)):(this.setUserDefined(i,!1),this.setRecovered(i,!1))}setCollapsedAllOfType(i,e){let t=!1;if(this._types)for(let o=0;o<this._types.length;o++)this._types[o]===i&&(this.setCollapsed(o,e),t=!0);return t}toRegion(i){return new gri(this,i)}getParentIndex(i){this.ensureParentIndices();let e=((this._startIndexes[i]&C8i)>>>24)+((this._endIndexes[i]&C8i)>>>16);return e===w8i?-1:e}contains(i,e){return this.getStartLineNumber(i)<=e&&this.getEndLineNumber(i)>=e}findIndex(i){let e=0,t=this._startIndexes.length;if(t===0)return-1;for(;e<t;){let o=Math.floor((e+t)/2);i<this.getStartLineNumber(o)?t=o:e=o+1}return e-1}findRange(i){let e=this.findIndex(i);if(e>=0){if(this.getEndLineNumber(e)>=i)return e;for(e=this.getParentIndex(e);e!==-1;){if(this.contains(e,i))return e;e=this.getParentIndex(e)}}return-1}toString(){let i=[];for(let e=0;e<this.length;e++)i[e]=`[${$Wo[this.getSource(e)]}${this.isCollapsed(e)?"+":"-"}] ${this.getStartLineNumber(e)}/${this.getEndLineNumber(e)}`;return i.join(", ")}toFoldRange(i){return{startLineNumber:this._startIndexes[i]&YM,endLineNumber:this._endIndexes[i]&YM,type:this._types?this._types[i]:void 0,isCollapsed:this.isCollapsed(i),source:this.getSource(i)}}static fromFoldRanges(i){let e=i.length,t=new Uint32Array(e),o=new Uint32Array(e),n=[],r=!1;for(let l=0;l<e;l++){let c=i[l];t[l]=c.startLineNumber,o[l]=c.endLineNumber,n.push(c.type),c.type&&(r=!0)}r||(n=void 0);let s=new a(t,o,n);for(let l=0;l<e;l++)i[l].isCollapsed&&s.setCollapsed(l,!0),s.setSource(l,i[l].source);return s}static sanitizeAndMerge(i,e,t,o){t=t??Number.MAX_VALUE;let n=(b,S)=>Array.isArray(b)?(y=>y<S?b[y]:void 0):(y=>y<S?b.toFoldRange(y):void 0),r=n(i,i.length),s=n(e,e.length),l=0,c=0,u=r(0),p=s(0),h=[],g,f=0,v=[];for(;u||p;){let b;if(p&&(!u||u.startLineNumber>=p.startLineNumber))u&&u.startLineNumber===p.startLineNumber?(p.source===1?b=p:(b=u,b.isCollapsed=p.isCollapsed&&(u.endLineNumber===p.endLineNumber||!o?.startsInside(u.startLineNumber+1,u.endLineNumber+1)),b.source=0),u=r(++l)):(b=p,p.isCollapsed&&p.source===0&&(b.source=2)),p=s(++c);else{let S=c,y=p;for(;;){if(!y||y.startLineNumber>u.endLineNumber){b=u;break}if(y.source===1&&y.endLineNumber>u.endLineNumber)break;y=s(++S)}u=r(++l)}if(b){for(;g&&g.endLineNumber<b.startLineNumber;)g=h.pop();b.endLineNumber>b.startLineNumber&&b.startLineNumber>f&&b.endLineNumber<=t&&(!g||g.endLineNumber>=b.endLineNumber)&&(v.push(b),f=b.startLineNumber,g&&h.push(g),g=b)}}return v}},gri=class{constructor(i,e){this.ranges=i;this.index=e}get startLineNumber(){return this.ranges.getStartLineNumber(this.index)}get endLineNumber(){return this.ranges.getEndLineNumber(this.index)}get regionIndex(){return this.index}get parentIndex(){return this.ranges.getParentIndex(this.index)}get isCollapsed(){return this.ranges.isCollapsed(this.index)}containedBy(i){return i.startLineNumber<=this.startLineNumber&&i.endLineNumber>=this.endLineNumber}containsLine(i){return this.startLineNumber<=i&&i<=this.endLineNumber}hidesLine(i){return this.startLineNumber<i&&i<=this.endLineNumber}};var cwt=class{constructor(i,e){this._updateEventEmitter=new E;this.onDidChange=this._updateEventEmitter.event;this._textModel=i,this._decorationProvider=e,this._regions=new jI(new Uint32Array(0),new Uint32Array(0)),this._editorDecorationIds=[]}get regions(){return this._regions}get textModel(){return this._textModel}get decorationProvider(){return this._decorationProvider}toggleCollapseState(i){if(!i.length)return;i=i.sort((t,o)=>t.regionIndex-o.regionIndex);let e={};this._decorationProvider.changeDecorations(t=>{let o=0,n=-1,r=-1,s=l=>{for(;o<l;){let c=this._regions.getEndLineNumber(o),u=this._regions.isCollapsed(o);if(c<=n){let p=this.regions.getSource(o)!==0;t.changeDecorationOptions(this._editorDecorationIds[o],this._decorationProvider.getDecorationOption(u,c<=r,p))}u&&c>r&&(r=c),o++}};for(let l of i){let c=l.regionIndex,u=this._editorDecorationIds[c];if(u&&!e[u]){e[u]=!0,s(c);let p=!this._regions.isCollapsed(c);this._regions.setCollapsed(c,p),n=Math.max(n,this._regions.getEndLineNumber(c))}}s(this._regions.length)}),this._updateEventEmitter.fire({model:this,collapseStateChanged:i})}removeManualRanges(i){let e=new Array,t=o=>{for(let n of i)if(!(n.startLineNumber>o.endLineNumber||o.startLineNumber>n.endLineNumber))return!0;return!1};for(let o=0;o<this._regions.length;o++){let n=this._regions.toFoldRange(o);(n.source===0||!t(n))&&e.push(n)}this.updatePost(jI.fromFoldRanges(e))}update(i,e){let t=this._currentFoldedOrManualRanges(e),o=jI.sanitizeAndMerge(i,t,this._textModel.getLineCount(),e);this.updatePost(jI.fromFoldRanges(o))}updatePost(i){let e=[],t=-1;for(let o=0,n=i.length;o<n;o++){let r=i.getStartLineNumber(o),s=i.getEndLineNumber(o),l=i.isCollapsed(o),c=i.getSource(o)!==0,u={startLineNumber:r,startColumn:this._textModel.getLineMaxColumn(r),endLineNumber:s,endColumn:this._textModel.getLineMaxColumn(s)+1};e.push({range:u,options:this._decorationProvider.getDecorationOption(l,s<=t,c)}),l&&s>t&&(t=s)}this._decorationProvider.changeDecorations(o=>this._editorDecorationIds=o.deltaDecorations(this._editorDecorationIds,e)),this._regions=i,this._updateEventEmitter.fire({model:this})}_currentFoldedOrManualRanges(i){let e=[];for(let t=0,o=this._regions.length;t<o;t++){let n=this.regions.isCollapsed(t),r=this.regions.getSource(t);if(n||r!==0){let s=this._regions.toFoldRange(t),l=this._textModel.getDecorationRange(this._editorDecorationIds[t]);l&&(n&&i?.startsInside(l.startLineNumber+1,l.endLineNumber)&&(n=!1),e.push({startLineNumber:l.startLineNumber,endLineNumber:l.endLineNumber,type:s.type,isCollapsed:n,source:r}))}}return e}getMemento(){let i=this._currentFoldedOrManualRanges(),e=[],t=this._textModel.getLineCount();for(let o=0,n=i.length;o<n;o++){let r=i[o];if(r.startLineNumber>=r.endLineNumber||r.startLineNumber<1||r.endLineNumber>t)continue;let s=this._getLinesChecksum(r.startLineNumber+1,r.endLineNumber);e.push({startLineNumber:r.startLineNumber,endLineNumber:r.endLineNumber,isCollapsed:r.isCollapsed,source:r.source,checksum:s})}return e.length>0?e:void 0}applyMemento(i){if(!Array.isArray(i))return;let e=[],t=this._textModel.getLineCount();for(let n of i){if(n.startLineNumber>=n.endLineNumber||n.startLineNumber<1||n.endLineNumber>t)continue;let r=this._getLinesChecksum(n.startLineNumber+1,n.endLineNumber);(!n.checksum||r===n.checksum)&&e.push({startLineNumber:n.startLineNumber,endLineNumber:n.endLineNumber,type:void 0,isCollapsed:n.isCollapsed??!0,source:n.source??0})}let o=jI.sanitizeAndMerge(this._regions,e,t);this.updatePost(jI.fromFoldRanges(o))}_getLinesChecksum(i,e){return Ir(this._textModel.getLineContent(i)+this._textModel.getLineContent(e))%1e6}dispose(){this._decorationProvider.removeDecorations(this._editorDecorationIds),this._updateEventEmitter.dispose()}getAllRegionsAtLine(i,e){let t=[];if(this._regions){let o=this._regions.findRange(i),n=1;for(;o>=0;){let r=this._regions.toRegion(o);(!e||e(r,n))&&t.push(r),n++,o=r.parentIndex}}return t}getRegionAtLine(i){if(this._regions){let e=this._regions.findRange(i);if(e>=0)return this._regions.toRegion(e)}return null}getRegionsInside(i,e){let t=[],o=i?i.regionIndex+1:0,n=i?i.endLineNumber:Number.MAX_VALUE;if(e&&e.length===2){let r=[];for(let s=o,l=this._regions.length;s<l;s++){let c=this._regions.toRegion(s);if(this._regions.getStartLineNumber(s)<n){for(;r.length>0&&!c.containedBy(r[r.length-1]);)r.pop();r.push(c),e(c,r.length)&&t.push(c)}else break}}else for(let r=o,s=this._regions.length;r<s;r++){let l=this._regions.toRegion(r);if(this._regions.getStartLineNumber(r)<n)(!e||e(l))&&t.push(l);else break}return t}};function c4e(a,i,e){let t=[];for(let o of e){let n=a.getRegionAtLine(o);if(n){let r=!n.isCollapsed;if(t.push(n),i>1){let s=a.getRegionsInside(n,(l,c)=>l.isCollapsed!==r&&c<i);t.push(...s)}}}a.toggleCollapseState(t)}function lle(a,i,e=Number.MAX_VALUE,t){let o=[];if(t&&t.length>0)for(let n of t){let r=a.getRegionAtLine(n);if(r&&(r.isCollapsed!==i&&o.push(r),e>1)){let s=a.getRegionsInside(r,(l,c)=>l.isCollapsed!==i&&c<e);o.push(...s)}}else{let n=a.getRegionsInside(null,(r,s)=>r.isCollapsed!==i&&s<e);o.push(...n)}a.toggleCollapseState(o)}function fri(a,i,e,t){let o=[];for(let n of t){let r=a.getAllRegionsAtLine(n,(s,l)=>s.isCollapsed!==i&&l<=e);o.push(...r)}a.toggleCollapseState(o)}function x8i(a,i,e){let t=[];for(let o of e){let n=a.getAllRegionsAtLine(o,r=>r.isCollapsed!==i);n.length>0&&t.push(n[0])}a.toggleCollapseState(t)}function k8i(a,i,e,t){let o=(r,s)=>s===i&&r.isCollapsed!==e&&!t.some(l=>r.containsLine(l)),n=a.getRegionsInside(null,o);a.toggleCollapseState(n)}function vri(a,i,e){let t=[];for(let r of e){let s=a.getAllRegionsAtLine(r,void 0);s.length>0&&t.push(s[0])}let o=r=>t.every(s=>!s.containedBy(r)&&!r.containedBy(s))&&r.isCollapsed!==i,n=a.getRegionsInside(null,o);a.toggleCollapseState(n)}function dwt(a,i,e){let t=a.textModel,o=a.regions,n=[];for(let r=o.length-1;r>=0;r--)if(e!==o.isCollapsed(r)){let s=o.getStartLineNumber(r);i.test(t.getLineContent(s))&&n.push(o.toRegion(r))}a.toggleCollapseState(n)}function uwt(a,i,e){let t=a.regions,o=[];for(let n=t.length-1;n>=0;n--)e!==t.isCollapsed(n)&&i===t.getType(n)&&o.push(t.toRegion(n));a.toggleCollapseState(o)}function E8i(a,i){let e=null,t=i.getRegionAtLine(a);if(t!==null&&(e=t.startLineNumber,a===e)){let o=t.parentIndex;o!==-1?e=i.regions.getStartLineNumber(o):e=null}return e}function T8i(a,i){let e=i.getRegionAtLine(a);if(e!==null&&e.startLineNumber===a){if(a!==e.startLineNumber)return e.startLineNumber;{let t=e.parentIndex,o=0;for(t!==-1&&(o=i.regions.getStartLineNumber(e.parentIndex));e!==null;)if(e.regionIndex>0){if(e=i.regions.toRegion(e.regionIndex-1),e.startLineNumber<=o)return null;if(e.parentIndex===t)return e.startLineNumber}else return null}}else if(i.regions.length>0)for(e=i.regions.toRegion(i.regions.length-1);e!==null;){if(e.startLineNumber<a)return e.startLineNumber;e.regionIndex>0?e=i.regions.toRegion(e.regionIndex-1):e=null}return null}function _8i(a,i){let e=i.getRegionAtLine(a);if(e!==null&&e.startLineNumber===a){let t=e.parentIndex,o=0;if(t!==-1)o=i.regions.getEndLineNumber(e.parentIndex);else{if(i.regions.length===0)return null;o=i.regions.getEndLineNumber(i.regions.length-1)}for(;e!==null;)if(e.regionIndex<i.regions.length){if(e=i.regions.toRegion(e.regionIndex+1),e.startLineNumber>=o)return null;if(e.parentIndex===t)return e.startLineNumber}else return null}else if(i.regions.length>0)for(e=i.regions.toRegion(0);e!==null;){if(e.startLineNumber>a)return e.startLineNumber;e.regionIndex<i.regions.length?e=i.regions.toRegion(e.regionIndex+1):e=null}return null}var pwt=class{constructor(i){this._updateEventEmitter=new E;this._hasLineChanges=!1;this._foldingModel=i,this._foldingModelListener=i.onDidChange(e=>this.updateHiddenRanges()),this._hiddenRanges=[],i.regions.length&&this.updateHiddenRanges()}get onDidChange(){return this._updateEventEmitter.event}get hiddenRanges(){return this._hiddenRanges}notifyChangeModelContent(i){this._hiddenRanges.length&&!this._hasLineChanges&&(this._hasLineChanges=i.changes.some(e=>e.range.endLineNumber!==e.range.startLineNumber||OS(e.text)[0]!==0))}updateHiddenRanges(){let i=!1,e=[],t=0,o=0,n=Number.MAX_VALUE,r=-1,s=this._foldingModel.regions;for(;t<s.length;t++){if(!s.isCollapsed(t))continue;let l=s.getStartLineNumber(t)+1,c=s.getEndLineNumber(t);n<=l&&c<=r||(!i&&o<this._hiddenRanges.length&&this._hiddenRanges[o].startLineNumber===l&&this._hiddenRanges[o].endLineNumber===c?(e.push(this._hiddenRanges[o]),o++):(i=!0,e.push(new z(l,1,c,1))),n=l,r=c)}(this._hasLineChanges||i||o<this._hiddenRanges.length)&&this.applyHiddenRanges(e)}applyHiddenRanges(i){this._hiddenRanges=i,this._hasLineChanges=!1,this._updateEventEmitter.fire(i)}hasRanges(){return this._hiddenRanges.length>0}isHidden(i){return D8i(this._hiddenRanges,i)!==null}adjustSelections(i){let e=!1,t=this._foldingModel.textModel,o=null,n=r=>((!o||!jWo(r,o))&&(o=D8i(this._hiddenRanges,r)),o?o.startLineNumber-1:null);for(let r=0,s=i.length;r<s;r++){let l=i[r],c=n(l.startLineNumber);c&&(l=l.setStartPosition(c,t.getLineMaxColumn(c)),e=!0);let u=n(l.endLineNumber);u&&(l=l.setEndPosition(u,t.getLineMaxColumn(u)),e=!0),i[r]=l}return e}dispose(){this.hiddenRanges.length>0&&(this._hiddenRanges=[],this._updateEventEmitter.fire(this._hiddenRanges)),this._foldingModelListener&&(this._foldingModelListener.dispose(),this._foldingModelListener=null),this._updateEventEmitter.dispose()}};function jWo(a,i){return a>=i.startLineNumber&&a<=i.endLineNumber}function D8i(a,i){let e=xy(a,t=>i<t.startLineNumber)-1;return e>=0&&a[e].endLineNumber>=i?a[e]:null}var QWo=5e3,YWo="indent",cle=class{constructor(i,e,t){this.editorModel=i;this.languageConfigurationService=e;this.foldingRangesLimit=t;this.id=YWo}dispose(){}compute(i){let e=this.languageConfigurationService.getLanguageConfiguration(this.editorModel.getLanguageId()).foldingRules,t=e&&!!e.offSide,o=e&&e.markers;return Promise.resolve(JWo(this.editorModel,t,o,this.foldingRangesLimit))}},bri=class{constructor(i){this._startIndexes=[],this._endIndexes=[],this._indentOccurrences=[],this._length=0,this._foldingRangesLimit=i}insertFirst(i,e,t){if(i>YM||e>YM)return;let o=this._length;this._startIndexes[o]=i,this._endIndexes[o]=e,this._length++,t<1e3&&(this._indentOccurrences[t]=(this._indentOccurrences[t]||0)+1)}toIndentRanges(i){let e=this._foldingRangesLimit.limit;if(this._length<=e){this._foldingRangesLimit.update(this._length,!1);let t=new Uint32Array(this._length),o=new Uint32Array(this._length);for(let n=this._length-1,r=0;n>=0;n--,r++)t[r]=this._startIndexes[n],o[r]=this._endIndexes[n];return new jI(t,o)}else{this._foldingRangesLimit.update(this._length,e);let t=0,o=this._indentOccurrences.length;for(let l=0;l<this._indentOccurrences.length;l++){let c=this._indentOccurrences[l];if(c){if(c+t>e){o=l;break}t+=c}}let n=i.getOptions().tabSize,r=new Uint32Array(e),s=new Uint32Array(e);for(let l=this._length-1,c=0;l>=0;l--){let u=this._startIndexes[l],p=i.getLineContent(u),h=eq(p,n);(h<o||h===o&&t++<e)&&(r[c]=u,s[c]=this._endIndexes[l],c++)}return new jI(r,s)}}},XWo={limit:QWo,update:()=>{}};function JWo(a,i,e,t=XWo){let o=a.getOptions().tabSize,n=new bri(t),r;e&&(r=new RegExp(`(${e.start.source})|(?:${e.end.source})`));let s=[],l=a.getLineCount()+1;s.push({indent:-1,endAbove:l,line:l});for(let c=a.getLineCount();c>0;c--){let u=a.getLineContent(c),p=eq(u,o),h=s[s.length-1];if(p===-1){i&&(h.endAbove=c);continue}let g;if(r&&(g=u.match(r)))if(g[1]){let f=s.length-1;for(;f>0&&s[f].indent!==-2;)f--;if(f>0){s.length=f+1,h=s[f],n.insertFirst(c,h.line,p),h.line=c,h.indent=p,h.endAbove=c;continue}}else{s.push({indent:-2,endAbove:c,line:c});continue}if(h.indent>p){do s.pop(),h=s[s.length-1];while(h.indent>p);let f=h.endAbove-1;f-c>=1&&n.insertFirst(c,f,p)}h.indent===p?h.endAbove=c:s.push({indent:p,endAbove:c,line:c})}return n.toIndentRanges(a)}var ZWo=J("editor.foldBackground",{light:ei(sv,.3),dark:ei(sv,.3),hcDark:null,hcLight:null},d(1161,null),!0);J("editor.foldPlaceholderForeground",{light:"#808080",dark:"#808080",hcDark:null,hcLight:null},d(1159,null));J("editorGutter.foldingControlForeground",_N,d(1160,null));var dle=Re("folding-expanded",M.chevronDown,d(1163,null)),ule=Re("folding-collapsed",M.chevronRight,d(1162,null)),L8i=Re("folding-manual-collapsed",ule,d(1164,null)),R8i=Re("folding-manual-expanded",dle,d(1165,null)),Sri={color:Ss(ZWo),position:1},aCe=d(1166,null),mwt=d(1167,null),hwt=class a{constructor(i){this.editor=i;this.showFoldingControls="mouseover";this.showFoldingHighlights=!0}static{this.COLLAPSED_VISUAL_DECORATION=po.register({description:"folding-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:aCe,firstLineDecorationClassName:q.asClassName(ule)})}static{this.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=po.register({description:"folding-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:Sri,isWholeLine:!0,linesDecorationsTooltip:aCe,firstLineDecorationClassName:q.asClassName(ule)})}static{this.MANUALLY_COLLAPSED_VISUAL_DECORATION=po.register({description:"folding-manually-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:aCe,firstLineDecorationClassName:q.asClassName(L8i)})}static{this.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=po.register({description:"folding-manually-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:Sri,isWholeLine:!0,linesDecorationsTooltip:aCe,firstLineDecorationClassName:q.asClassName(L8i)})}static{this.NO_CONTROLS_COLLAPSED_RANGE_DECORATION=po.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:aCe})}static{this.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION=po.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:Sri,isWholeLine:!0,linesDecorationsTooltip:aCe})}static{this.EXPANDED_VISUAL_DECORATION=po.register({description:"folding-expanded-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+q.asClassName(dle),linesDecorationsTooltip:mwt})}static{this.EXPANDED_AUTO_HIDE_VISUAL_DECORATION=po.register({description:"folding-expanded-auto-hide-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:q.asClassName(dle),linesDecorationsTooltip:mwt})}static{this.MANUALLY_EXPANDED_VISUAL_DECORATION=po.register({description:"folding-manually-expanded-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+q.asClassName(R8i),linesDecorationsTooltip:mwt})}static{this.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION=po.register({description:"folding-manually-expanded-auto-hide-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:q.asClassName(R8i),linesDecorationsTooltip:mwt})}static{this.NO_CONTROLS_EXPANDED_RANGE_DECORATION=po.register({description:"folding-no-controls-range-decoration",stickiness:0,isWholeLine:!0})}static{this.HIDDEN_RANGE_DECORATION=po.register({description:"folding-hidden-range-decoration",stickiness:1})}getDecorationOption(i,e,t){return e?a.HIDDEN_RANGE_DECORATION:this.showFoldingControls==="never"?i?this.showFoldingHighlights?a.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION:a.NO_CONTROLS_COLLAPSED_RANGE_DECORATION:a.NO_CONTROLS_EXPANDED_RANGE_DECORATION:i?t?this.showFoldingHighlights?a.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:a.MANUALLY_COLLAPSED_VISUAL_DECORATION:this.showFoldingHighlights?a.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:a.COLLAPSED_VISUAL_DECORATION:this.showFoldingControls==="mouseover"?t?a.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION:a.EXPANDED_AUTO_HIDE_VISUAL_DECORATION:t?a.MANUALLY_EXPANDED_VISUAL_DECORATION:a.EXPANDED_VISUAL_DECORATION}changeDecorations(i){return this.editor.changeDecorations(i)}removeDecorations(i){this.editor.removeDecorations(i)}};var eVo={},tVo="syntax",ple=class{constructor(i,e,t,o,n){this.editorModel=i;this.providers=e;this.handleFoldingRangesChange=t;this.foldingRangesLimit=o;this.fallbackRangeProvider=n;this.id=tVo;this.disposables=new P,n&&this.disposables.add(n);for(let r of e)typeof r.onDidChange=="function"&&this.disposables.add(r.onDidChange(t))}compute(i){return iVo(this.providers,this.editorModel,i).then(e=>this.editorModel.isDisposed()?null:e?yri(e,this.foldingRangesLimit):this.fallbackRangeProvider?.compute(i)??null)}dispose(){this.disposables.dispose()}};function iVo(a,i,e){let t=null,o=a.map((n,r)=>Promise.resolve(n.provideFoldingRanges(i,eVo,e)).then(s=>{if(!e.isCancellationRequested&&Array.isArray(s)){Array.isArray(t)||(t=[]);let l=i.getLineCount();for(let c of s)c.start>0&&c.end>c.start&&c.end<=l&&t.push({start:c.start,end:c.end,rank:r,kind:c.kind})}},ss));return Promise.all(o).then(n=>t)}var Iri=class{constructor(i){this._startIndexes=[],this._endIndexes=[],this._nestingLevels=[],this._nestingLevelCounts=[],this._types=[],this._length=0,this._foldingRangesLimit=i}add(i,e,t,o){if(i>YM||e>YM)return;let n=this._length;this._startIndexes[n]=i,this._endIndexes[n]=e,this._nestingLevels[n]=o,this._types[n]=t,this._length++,o<30&&(this._nestingLevelCounts[o]=(this._nestingLevelCounts[o]||0)+1)}toIndentRanges(){let i=this._foldingRangesLimit.limit;if(this._length<=i){this._foldingRangesLimit.update(this._length,!1);let e=new Uint32Array(this._length),t=new Uint32Array(this._length);for(let o=0;o<this._length;o++)e[o]=this._startIndexes[o],t[o]=this._endIndexes[o];return new jI(e,t,this._types)}else{this._foldingRangesLimit.update(this._length,i);let e=0,t=this._nestingLevelCounts.length;for(let s=0;s<this._nestingLevelCounts.length;s++){let l=this._nestingLevelCounts[s];if(l){if(l+e>i){t=s;break}e+=l}}let o=new Uint32Array(i),n=new Uint32Array(i),r=[];for(let s=0,l=0;s<this._length;s++){let c=this._nestingLevels[s];(c<t||c===t&&e++<i)&&(o[l]=this._startIndexes[s],n[l]=this._endIndexes[s],r[l]=this._types[s],l++)}return new jI(o,n,r)}}};function yri(a,i){let e=a.sort((r,s)=>{let l=r.start-s.start;return l===0&&(l=r.rank-s.rank),l}),t=new Iri(i),o,n=[];for(let r of e)if(!o)o=r,t.add(r.start,r.end,r.kind&&r.kind.value,n.length);else if(r.start>o.start)if(r.end<=o.end)n.push(o),o=r,t.add(r.start,r.end,r.kind&&r.kind.value,n.length);else{if(r.start>o.end){do o=n.pop();while(o&&r.start>o.end);o&&n.push(o),o=r}t.add(r.start,r.end,r.kind&&r.kind.value,n.length)}return t.toIndentRanges()}var GS=new Q("foldingEnabled",!1),Qg=class extends C{constructor(e,t,o,n,r,s){super();this.contextKeyService=t;this.languageConfigurationService=o;this.languageFeaturesService=s;this.localToDispose=this._register(new P);this.editor=e,this._foldingLimitReporter=this._register(new d4e(e));let l=this.editor.getOptions();this._isEnabled=l.get(52),this._useFoldingProviders=l.get(53)!=="indentation",this._unfoldOnClickAfterEndOfLine=l.get(57),this._restoringViewState=!1,this._currentModelHasFoldedImports=!1,this._foldingImportsByDefault=l.get(55),this.updateDebounceInfo=r.for(s.foldingRangeProvider,"Folding",{min:200}),this.foldingModel=null,this.hiddenRangeModel=null,this.rangeProvider=null,this.foldingRegionPromise=null,this.foldingModelPromise=null,this.updateScheduler=null,this.cursorChangedScheduler=null,this.mouseDownInfo=null,this.foldingDecorationProvider=new hwt(e),this.foldingDecorationProvider.showFoldingControls=l.get(126),this.foldingDecorationProvider.showFoldingHighlights=l.get(54),this.foldingEnabled=GS.bindTo(this.contextKeyService),this.foldingEnabled.set(this._isEnabled),this._register(this.editor.onDidChangeModel(()=>this.onModelChanged())),this._register(this.editor.onDidChangeConfiguration(c=>{if(c.hasChanged(52)&&(this._isEnabled=this.editor.getOptions().get(52),this.foldingEnabled.set(this._isEnabled),this.onModelChanged()),c.hasChanged(56)&&this.onModelChanged(),c.hasChanged(126)||c.hasChanged(54)){let u=this.editor.getOptions();this.foldingDecorationProvider.showFoldingControls=u.get(126),this.foldingDecorationProvider.showFoldingHighlights=u.get(54),this.triggerFoldingModelChanged()}c.hasChanged(53)&&(this._useFoldingProviders=this.editor.getOptions().get(53)!=="indentation",this.onFoldingStrategyChanged()),c.hasChanged(57)&&(this._unfoldOnClickAfterEndOfLine=this.editor.getOptions().get(57)),c.hasChanged(55)&&(this._foldingImportsByDefault=this.editor.getOptions().get(55))})),this.onModelChanged()}static{this.ID="editor.contrib.folding"}static get(e){return e.getContribution(Qg.ID)}static getFoldingRangeProviders(e,t){let o=e.foldingRangeProvider.ordered(t);return Qg._foldingRangeSelector?.(o,t)??o}static setFoldingRangeProviderSelector(e){return Qg._foldingRangeSelector=e,{dispose:()=>{Qg._foldingRangeSelector=void 0}}}get limitReporter(){return this._foldingLimitReporter}saveViewState(){let e=this.editor.getModel();if(!e||!this._isEnabled||e.isTooLargeForTokenization())return{};if(this.foldingModel){let t=this.foldingModel.getMemento(),o=this.rangeProvider?this.rangeProvider.id:void 0;return{collapsedRegions:t,lineCount:e.getLineCount(),provider:o,foldedImports:this._currentModelHasFoldedImports}}}restoreViewState(e){let t=this.editor.getModel();if(!(!t||!this._isEnabled||t.isTooLargeForTokenization()||!this.hiddenRangeModel)&&e&&(this._currentModelHasFoldedImports=!!e.foldedImports,e.collapsedRegions&&e.collapsedRegions.length>0&&this.foldingModel)){this._restoringViewState=!0;try{this.foldingModel.applyMemento(e.collapsedRegions)}finally{this._restoringViewState=!1}}}onModelChanged(){this.localToDispose.clear();let e=this.editor.getModel();!this._isEnabled||!e||e.isTooLargeForTokenization()||(this._currentModelHasFoldedImports=!1,this.foldingModel=new cwt(e,this.foldingDecorationProvider),this.localToDispose.add(this.foldingModel),this.hiddenRangeModel=new pwt(this.foldingModel),this.localToDispose.add(this.hiddenRangeModel),this.localToDispose.add(this.hiddenRangeModel.onDidChange(t=>this.onHiddenRangesChanges(t))),this.updateScheduler=new jo(this.updateDebounceInfo.get(e)),this.localToDispose.add(this.updateScheduler),this.cursorChangedScheduler=new Dt(()=>this.revealCursor(),200),this.localToDispose.add(this.cursorChangedScheduler),this.localToDispose.add(this.languageFeaturesService.foldingRangeProvider.onDidChange(()=>this.onFoldingStrategyChanged())),this.localToDispose.add(this.editor.onDidChangeModelLanguageConfiguration(()=>this.onFoldingStrategyChanged())),this.localToDispose.add(this.editor.onDidChangeModelContent(t=>this.onDidChangeModelContent(t))),this.localToDispose.add(this.editor.onDidChangeCursorPosition(()=>this.onCursorPositionChanged())),this.localToDispose.add(this.editor.onMouseDown(t=>this.onEditorMouseDown(t))),this.localToDispose.add(this.editor.onMouseUp(t=>this.onEditorMouseUp(t))),this.localToDispose.add({dispose:()=>{this.foldingRegionPromise&&(this.foldingRegionPromise.cancel(),this.foldingRegionPromise=null),this.updateScheduler?.cancel(),this.updateScheduler=null,this.foldingModel=null,this.foldingModelPromise=null,this.hiddenRangeModel=null,this.cursorChangedScheduler=null,this.rangeProvider?.dispose(),this.rangeProvider=null}}),this.triggerFoldingModelChanged())}onFoldingStrategyChanged(){this.rangeProvider?.dispose(),this.rangeProvider=null,this.triggerFoldingModelChanged()}getRangeProvider(e){if(this.rangeProvider)return this.rangeProvider;let t=new cle(e,this.languageConfigurationService,this._foldingLimitReporter);if(this.rangeProvider=t,this._useFoldingProviders&&this.foldingModel){let o=Qg.getFoldingRangeProviders(this.languageFeaturesService,e);o.length>0&&(this.rangeProvider=new ple(e,o,()=>this.triggerFoldingModelChanged(),this._foldingLimitReporter,t))}return this.rangeProvider}getFoldingModel(){return this.foldingModelPromise}onDidChangeModelContent(e){this.hiddenRangeModel?.notifyChangeModelContent(e),this.triggerFoldingModelChanged()}triggerFoldingModelChanged(){this.updateScheduler&&(this.foldingRegionPromise&&(this.foldingRegionPromise.cancel(),this.foldingRegionPromise=null),this.foldingModelPromise=this.updateScheduler.trigger(()=>{let e=this.foldingModel;if(!e)return null;let t=new En,o=this.getRangeProvider(e.textModel),n=this.foldingRegionPromise=xn(r=>o.compute(r));return n.then(r=>{if(r&&n===this.foldingRegionPromise){let s;if(this._foldingImportsByDefault&&!this._currentModelHasFoldedImports){let u=r.setCollapsedAllOfType(Yk.Imports.value,!0);u&&(s=tC.capture(this.editor),this._currentModelHasFoldedImports=u)}let l=this.editor.getSelections();e.update(r,oVo(l)),s?.restore(this.editor);let c=this.updateDebounceInfo.update(e.textModel,t.elapsed());this.updateScheduler&&(this.updateScheduler.defaultDelay=c)}return e})}).then(void 0,e=>(mt(e),null)))}onHiddenRangesChanges(e){if(this.hiddenRangeModel&&e.length&&!this._restoringViewState){let t=this.editor.getSelections();t&&this.hiddenRangeModel.adjustSelections(t)&&this.editor.setSelections(t)}this.editor.setHiddenAreas(e,this)}onCursorPositionChanged(){this.hiddenRangeModel&&this.hiddenRangeModel.hasRanges()&&this.cursorChangedScheduler.schedule()}revealCursor(){let e=this.getFoldingModel();e&&e.then(t=>{if(t){let o=this.editor.getSelections();if(o&&o.length>0){let n=[];for(let r of o){let s=r.selectionStartLineNumber;this.hiddenRangeModel&&this.hiddenRangeModel.isHidden(s)&&n.push(...t.getAllRegionsAtLine(s,l=>l.isCollapsed&&s>l.startLineNumber))}n.length&&(t.toggleCollapseState(n),this.reveal(o[0].getPosition()))}}}).then(void 0,mt)}onEditorMouseDown(e){if(this.mouseDownInfo=null,!this.hiddenRangeModel||!e.target||!e.target.range||!e.event.leftButton&&!e.event.middleButton)return;let t=e.target.range,o=!1;switch(e.target.type){case 4:{let n=e.target.detail,r=e.target.element.offsetLeft;if(n.offsetX-r<4)return;o=!0;break}case 7:{if(this._unfoldOnClickAfterEndOfLine&&this.hiddenRangeModel.hasRanges()&&!e.target.detail.isAfterLines)break;return}case 6:{if(this.hiddenRangeModel.hasRanges()){let n=this.editor.getModel();if(n&&t.startColumn===n.getLineMaxColumn(t.startLineNumber))break}return}default:return}this.mouseDownInfo={lineNumber:t.startLineNumber,iconClicked:o}}onEditorMouseUp(e){let t=this.foldingModel;if(!t||!this.mouseDownInfo||!e.target)return;let o=this.mouseDownInfo.lineNumber,n=this.mouseDownInfo.iconClicked,r=e.target.range;if(!r||r.startLineNumber!==o)return;if(n){if(e.target.type!==4)return}else{let l=this.editor.getModel();if(!l||r.startColumn!==l.getLineMaxColumn(o))return}let s=t.getRegionAtLine(o);if(s&&s.startLineNumber===o){let l=s.isCollapsed;if(n||l){let c=e.event.altKey,u=[];if(c){let p=g=>!g.containedBy(s)&&!s.containedBy(g),h=t.getRegionsInside(null,p);for(let g of h)g.isCollapsed&&u.push(g);u.length===0&&(u=h)}else{let p=e.event.middleButton||e.event.shiftKey;if(p)for(let h of t.getRegionsInside(s))h.isCollapsed===l&&u.push(h);(l||!p||u.length===0)&&u.push(s)}t.toggleCollapseState(u),this.reveal({lineNumber:o,column:1})}}}reveal(e){this.editor.revealPositionInCenterIfOutsideViewport(e,0)}};Qg=I([m(1,X),m(2,bs),m(3,Ne),m(4,jg),m(5,zt)],Qg);var d4e=class extends C{constructor(e){super();this.editor=e;this._onDidChange=this._register(new E);this._computed=0;this._limited=!1}get limit(){return this.editor.getOptions().get(56)}get onDidChange(){return this._onDidChange.event}get computed(){return this._computed}get limited(){return this._limited}update(e,t){(e!==this._computed||t!==this._limited)&&(this._computed=e,this._limited=t,this._onDidChange.fire())}},Yb=class extends xi{runEditorCommand(i,e,t){let o=i.get(bs),n=Qg.get(e);if(!n)return;let r=n.getFoldingModel();if(r)return this.reportTelemetry(i,e),r.then(s=>{if(s){this.invoke(n,s,e,t,o);let l=e.getSelection();l&&n.reveal(l.getStartPosition())}})}getSelectedLines(i){let e=i.getSelections();return e?e.map(t=>t.startLineNumber):[]}getLineNumbers(i,e){return i&&i.selectionLines?i.selectionLines.map(t=>t+1):this.getSelectedLines(e)}run(i,e){}};function oVo(a){return!a||a.length===0?{startsInside:()=>!1}:{startsInside(i,e){for(let t of a){let o=t.startLineNumber;if(o>=i&&o<=e)return!0}return!1}}}function M8i(a){if(!cn(a)){if(!yi(a))return!1;let i=a;if(!cn(i.levels)&&!Xo(i.levels)||!cn(i.direction)&&!Ae(i.direction)||!cn(i.selectionLines)&&(!Array.isArray(i.selectionLines)||!i.selectionLines.every(Xo)))return!1}return!0}var wri=class extends Yb{constructor(){super({id:"editor.unfold",label:L(1154,"Unfold"),precondition:GS,kbOpts:{kbExpr:ue.editorTextFocus,primary:3166,mac:{primary:2654},weight:100},metadata:{description:"Unfold the content in the editor",args:[{name:"Unfold editor argument",description:`Property-value pairs that can be passed through this argument:
* 'levels': Number of levels to unfold. If not set, defaults to 1.
* 'direction': If 'up', unfold given number of levels up otherwise unfolds down.
* 'selectionLines': Array of the start lines (0-based) of the editor selections to apply the unfold action to. If not set, the active selection(s) will be used.
`,constraint:M8i,schema:{type:"object",properties:{levels:{type:"number",default:1},direction:{type:"string",enum:["up","down"],default:"down"},selectionLines:{type:"array",items:{type:"number"}}}}}]}})}invoke(i,e,t,o){let n=o&&o.levels||1,r=this.getLineNumbers(o,t);o&&o.direction==="up"?fri(e,!1,n,r):lle(e,!1,n,r)}},Cri=class extends Yb{constructor(){super({id:"editor.unfoldRecursively",label:L(1158,"Unfold Recursively"),precondition:GS,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2142),weight:100}})}invoke(i,e,t,o){lle(e,!1,Number.MAX_VALUE,this.getSelectedLines(t))}},xri=class extends Yb{constructor(){super({id:"editor.fold",label:L(1140,"Fold"),precondition:GS,kbOpts:{kbExpr:ue.editorTextFocus,primary:3164,mac:{primary:2652},weight:100},metadata:{description:"Fold the content in the editor",args:[{name:"Fold editor argument",description:`Property-value pairs that can be passed through this argument:
* 'levels': Number of levels to fold.
* 'direction': If 'up', folds given number of levels up otherwise folds down.
* 'selectionLines': Array of the start lines (0-based) of the editor selections to apply the fold action to. If not set, the active selection(s) will be used.
If no levels or direction is set, folds the region at the locations or if already collapsed, the first uncollapsed parent instead.
`,constraint:M8i,schema:{type:"object",properties:{levels:{type:"number"},direction:{type:"string",enum:["up","down"]},selectionLines:{type:"array",items:{type:"number"}}}}}]}})}invoke(i,e,t,o){let n=this.getLineNumbers(o,t),r=o&&o.levels,s=o&&o.direction;typeof r!="number"&&typeof s!="string"?x8i(e,!0,n):s==="up"?fri(e,!0,r||1,n):lle(e,!0,r||1,n)}},kri=class extends Yb{constructor(){super({id:"editor.toggleFold",label:L(1151,"Toggle Fold"),precondition:GS,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2090),weight:100}})}invoke(i,e,t){let o=this.getSelectedLines(t);c4e(e,1,o)}},Eri=class extends Yb{constructor(){super({id:"editor.foldRecursively",label:L(1146,"Fold Recursively"),precondition:GS,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2140),weight:100}})}invoke(i,e,t){let o=this.getSelectedLines(t);lle(e,!0,Number.MAX_VALUE,o)}},Tri=class extends Yb{constructor(){super({id:"editor.toggleFoldRecursively",label:L(1152,"Toggle Fold Recursively"),precondition:GS,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,3114),weight:100}})}invoke(i,e,t){let o=this.getSelectedLines(t);c4e(e,Number.MAX_VALUE,o)}},_ri=class extends Yb{constructor(){super({id:"editor.foldAllBlockComments",label:L(1142,"Fold All Block Comments"),precondition:GS,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2138),weight:100}})}invoke(i,e,t,o,n){if(e.regions.hasTypes())uwt(e,Yk.Comment.value,!0);else{let r=t.getModel();if(!r)return;let s=n.getLanguageConfiguration(r.getLanguageId()).comments;if(s&&s.blockCommentStartToken){let l=new RegExp("^\\s*"+Yr(s.blockCommentStartToken));dwt(e,l,!0)}}}},Dri=class extends Yb{constructor(){super({id:"editor.foldAllMarkerRegions",label:L(1144,"Fold All Regions"),precondition:GS,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2077),weight:100}})}invoke(i,e,t,o,n){if(e.regions.hasTypes())uwt(e,Yk.Region.value,!0);else{let r=t.getModel();if(!r)return;let s=n.getLanguageConfiguration(r.getLanguageId()).foldingRules;if(s&&s.markers&&s.markers.start){let l=new RegExp(s.markers.start);dwt(e,l,!0)}}}},Lri=class extends Yb{constructor(){super({id:"editor.unfoldAllMarkerRegions",label:L(1157,"Unfold All Regions"),precondition:GS,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2078),weight:100}})}invoke(i,e,t,o,n){if(e.regions.hasTypes())uwt(e,Yk.Region.value,!1);else{let r=t.getModel();if(!r)return;let s=n.getLanguageConfiguration(r.getLanguageId()).foldingRules;if(s&&s.markers&&s.markers.start){let l=new RegExp(s.markers.start);dwt(e,l,!1)}}}},Rri=class extends Yb{constructor(){super({id:"editor.foldAllExcept",label:L(1143,"Fold All Except Selected"),precondition:GS,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2136),weight:100}})}invoke(i,e,t){let o=this.getSelectedLines(t);vri(e,!0,o)}},Mri=class extends Yb{constructor(){super({id:"editor.unfoldAllExcept",label:L(1156,"Unfold All Except Selected"),precondition:GS,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2134),weight:100}})}invoke(i,e,t){let o=this.getSelectedLines(t);vri(e,!1,o)}},Pri=class extends Yb{constructor(){super({id:"editor.foldAll",label:L(1141,"Fold All"),precondition:GS,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2069),weight:100}})}invoke(i,e,t){lle(e,!0)}},Ari=class extends Yb{constructor(){super({id:"editor.unfoldAll",label:L(1155,"Unfold All"),precondition:GS,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2088),weight:100}})}invoke(i,e,t){lle(e,!1)}},gwt=class a extends Yb{static{this.ID_PREFIX="editor.foldLevel"}static{this.ID=i=>a.ID_PREFIX+i}getFoldingLevel(){return parseInt(this.id.substr(a.ID_PREFIX.length))}invoke(i,e,t){k8i(e,this.getFoldingLevel(),!0,this.getSelectedLines(t))}},Nri=class extends Yb{constructor(){super({id:"editor.gotoParentFold",label:L(1148,"Go to Parent Fold"),precondition:GS,kbOpts:{kbExpr:ue.editorTextFocus,weight:100}})}invoke(i,e,t){let o=this.getSelectedLines(t);if(o.length>0){let n=E8i(o[0],e);n!==null&&t.setSelection({startLineNumber:n,startColumn:1,endLineNumber:n,endColumn:1})}}},Ori=class extends Yb{constructor(){super({id:"editor.gotoPreviousFold",label:L(1149,"Go to Previous Folding Range"),precondition:GS,kbOpts:{kbExpr:ue.editorTextFocus,weight:100}})}invoke(i,e,t){let o=this.getSelectedLines(t);if(o.length>0){let n=T8i(o[0],e);n!==null&&t.setSelection({startLineNumber:n,startColumn:1,endLineNumber:n,endColumn:1})}}},Fri=class extends Yb{constructor(){super({id:"editor.gotoNextFold",label:L(1147,"Go to Next Folding Range"),precondition:GS,kbOpts:{kbExpr:ue.editorTextFocus,weight:100}})}invoke(i,e,t){let o=this.getSelectedLines(t);if(o.length>0){let n=_8i(o[0],e);n!==null&&t.setSelection({startLineNumber:n,startColumn:1,endLineNumber:n,endColumn:1})}}},Wri=class extends Yb{constructor(){super({id:"editor.createFoldingRangeFromSelection",label:L(1139,"Create Folding Range from Selection"),precondition:GS,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2135),weight:100}})}invoke(i,e,t){let o=[],n=t.getSelections();if(n){for(let r of n){let s=r.endLineNumber;r.endColumn===1&&--s,s>r.startLineNumber&&(o.push({startLineNumber:r.startLineNumber,endLineNumber:s,type:void 0,isCollapsed:!0,source:1}),t.setSelection({startLineNumber:r.startLineNumber,startColumn:1,endLineNumber:r.startLineNumber,endColumn:1}))}if(o.length>0){o.sort((s,l)=>s.startLineNumber-l.startLineNumber);let r=jI.sanitizeAndMerge(e.regions,o,t.getModel()?.getLineCount());e.updatePost(jI.fromFoldRanges(r))}}}},Vri=class extends Yb{constructor(){super({id:"editor.removeManualFoldingRanges",label:L(1150,"Remove Manual Folding Ranges"),precondition:GS,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2137),weight:100}})}invoke(i,e,t){let o=t.getSelections();if(o){let n=[];for(let r of o){let{startLineNumber:s,endLineNumber:l}=r;n.push(l>=s?{startLineNumber:s,endLineNumber:l}:{endLineNumber:l,startLineNumber:s})}e.removeManualRanges(n),i.triggerFoldingModelChanged()}}},Bri=class extends Yb{constructor(){super({id:"editor.toggleImportFold",label:L(1153,"Toggle Import Fold"),precondition:GS,kbOpts:{kbExpr:ue.editorTextFocus,weight:100}})}async invoke(i,e){let t=[],o=e.regions;for(let n=o.length-1;n>=0;n--)o.getType(n)===Yk.Imports.value&&t.push(o.toRegion(n));e.toggleCollapseState(t),i.triggerFoldingModelChanged()}};go(Qg.ID,Qg,0);Jt(wri);Jt(Cri);Jt(xri);Jt(Eri);Jt(Tri);Jt(Pri);Jt(Ari);Jt(_ri);Jt(Dri);Jt(Lri);Jt(Rri);Jt(Mri);Jt(kri);Jt(Nri);Jt(Ori);Jt(Fri);Jt(Wri);Jt(Vri);Jt(Bri);for(let a=1;a<=7;a++)aKi(new gwt({id:gwt.ID(a),label:L(1145,"Fold Level {0}",a),precondition:GS,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2048|21+a),weight:100}}));qe.registerCommand("_executeFoldingRangeProvider",async function(a,...i){let[e]=i;if(!(e instanceof A))throw Br();let t=a.get(zt),o=a.get(Ct).getModel(e);if(!o)throw Br();let n=a.get(B);if(!n.getValue("editor.folding",{resource:e}))return[];let r=a.get(bs),s=n.getValue("editor.foldingStrategy",{resource:e}),l={get limit(){return n.getValue("editor.foldingMaximumRegions",{resource:e})},update:(g,f)=>{}},c=new cle(o,r,l),u=c;if(s!=="indentation"){let g=Qg.getFoldingRangeProviders(t,o);g.length&&(u=new ple(o,g,()=>{},l,c))}let p=await u.compute(ve.None),h=[];try{if(p)for(let g=0;g<p.length;g++){let f=p.getType(g);h.push({start:p.getStartLineNumber(g),end:p.getEndLineNumber(g),kind:f?Yk.fromValue(f):void 0})}return h}finally{u.dispose()}});var Hri=class extends xi{constructor(){super({id:"editor.action.fontZoomIn",label:L(1168,"Increase Editor Font Size"),precondition:void 0})}run(i,e){$k.setZoomLevel($k.getZoomLevel()+1)}},Uri=class extends xi{constructor(){super({id:"editor.action.fontZoomOut",label:L(1169,"Decrease Editor Font Size"),precondition:void 0})}run(i,e){$k.setZoomLevel($k.getZoomLevel()-1)}},zri=class extends xi{constructor(){super({id:"editor.action.fontZoomReset",label:L(1170,"Reset Editor Font Size"),precondition:void 0})}run(i,e){$k.setZoomLevel(0)}};Jt(Hri);Jt(Uri);Jt(zri);var mle=class a{static _handleEolEdits(i,e){let t,o=[];for(let n of e)typeof n.eol=="number"&&(t=n.eol),n.range&&typeof n.text=="string"&&o.push(n);return typeof t=="number"&&i.hasModel()&&i.getModel().pushEOL(t),o}static _isFullModelReplaceEdit(i,e){if(!i.hasModel())return!1;let t=i.getModel(),o=t.validateRange(e.range);return t.getFullModelRange().equalsRange(o)}static execute(i,e,t){t&&i.pushUndoStop();let o=tC.capture(i),n=a._handleEolEdits(i,e);n.length===1&&a._isFullModelReplaceEdit(i,n[0])?i.executeEdits("formatEditsCommand",n.map(r=>An.replace(z.lift(r.range),r.text))):i.executeEdits("formatEditsCommand",n.map(r=>An.replaceMove(z.lift(r.range),r.text))),t&&i.pushUndoStop(),o.restoreRelativeVerticalPositionOfCursor(i)}};function M7(a){return a.scheme===Y.vscodeRemote?a.authority:void 0}function $S(a){if(!a)return;let i=a.indexOf("+");return i<0?a:a.substr(0,i)}function P8i(a){if(!a)return;let i=a.indexOf("+");if(!(i<0))return a.substring(i+1)}function A8i(a){let{host:i,port:e}=nVo(a);if(typeof e>"u")throw new Error(`Invalid remote authority: ${a}. It must either be a remote of form <remoteName>+<arg> or a remote host of form <host>:<port>.`);return{host:i,port:e}}function nVo(a){let i=a.match(/^(\[[0-9a-z:]+\]):(\d+)$/);if(i)return{host:i[1],port:parseInt(i[2],10)};let e=a.match(/^(\[[0-9a-z:]+\])$/);if(e)return{host:e[1],port:void 0};let t=a.match(/(.*):(\d+)$/);return t?{host:t[1],port:parseInt(t[2],10)}:{host:a,port:void 0}}var N8i="extensions.user.cache",O8i="extensions.builtin.cache",fwt="undefined_publisher",F8i=["ui","workspace","web"];function hle(a){if(typeof a=="object"&&a!==null&&a.supported!==!0)return a.description}var gO=["AI","Azure","Chat","Data Science","Debuggers","Extension Packs","Education","Formatters","Keymaps","Language Packs","Linters","Machine Learning","Notebooks","Programming Languages","SCM Providers","Snippets","Testing","Themes","Visualization","Other"];var Ei=class{constructor(i){this.value=i,this._lower=i.toLowerCase()}static equals(i,e){if(typeof i>"u"||i===null)return typeof e>"u"||e===null;if(typeof e>"u"||e===null)return!1;if(typeof i=="string"||typeof e=="string"){let t=typeof i=="string"?i:i.value,o=typeof e=="string"?e:e.value;return mr(t,o)}return i._lower===e._lower}static toKey(i){return typeof i=="string"?i.toLowerCase():i._lower}},QI=class{constructor(i){this._set=new Set;if(i)for(let e of i)this.add(e)}get size(){return this._set.size}add(i){this._set.add(Ei.toKey(i))}delete(i){return this._set.delete(Ei.toKey(i))}has(i){return this._set.has(Ei.toKey(i))}},Fd=class{constructor(){this._map=new Map}clear(){this._map.clear()}delete(i){this._map.delete(Ei.toKey(i))}get(i){return this._map.get(Ei.toKey(i))}has(i){return this._map.has(Ei.toKey(i))}set(i,e){this._map.set(Ei.toKey(i),e)}values(){return this._map.values()}forEach(i){this._map.forEach(i)}[Symbol.iterator](){return this._map[Symbol.iterator]()}};function Xq(a){return NL(a)}function NL(a){return a.contributes&&a.contributes.localizations?a.contributes.localizations.length>0:!1}function Kri(a){return a.contributes&&a.contributes.authentication?a.contributes.authentication.length>0:!1}function lCe(a,i){if(i){let e=`onResolveRemoteAuthority:${$S(i)}`;return!!a.activationEvents?.includes(e)}return!1}function W8i(a){return a.map(i=>{let[e,t]=i.split("@");return{proposalName:e,version:t?parseInt(t):void 0}})}function V8i(a){return a.map(i=>i.split("@")[0])}var B8i=ae("IBuiltinExtensionsScannerService");function cCe(a,i,e){let t=[],o=new QI,n=a.ordered(e);for(let s of n)t.push(s),s.extensionId&&o.add(s.extensionId);let r=i.ordered(e);for(let s of r){if(s.extensionId){if(o.has(s.extensionId))continue;o.add(s.extensionId)}t.push({displayName:s.displayName,extensionId:s.extensionId,provideDocumentFormattingEdits(l,c,u){return s.provideDocumentRangeFormattingEdits(l,l.getFullModelRange(),c,u)}})}return t}var gle=class a{static{this._selectors=new Vs}static setFormatterSelector(i){return{dispose:a._selectors.unshift(i)}}static async select(i,e,t,o){if(i.length===0)return;let n=ht.first(a._selectors);if(n)return await n(i,e,t,o)}};async function fle(a,i,e,t,o,n,r){let s=a.get(F),{documentRangeFormattingEditProvider:l}=a.get(zt),c=pn(i)?i.getModel():i,u=l.ordered(c),p=await gle.select(u,c,t,2);p&&(o.report(p),await s.invokeFunction(Gri,p,i,e,n,r))}async function Gri(a,i,e,t,o,n){let r=a.get($s),s=a.get(ne),l=a.get(tr),c,u;pn(e)?(c=e.getModel(),u=new Ex(e,5,void 0,o)):(c=e,u=new Nae(e,o));let p=[],h=0;for(let S of Yl(t).sort(z.compareRangesUsingStarts))h>0&&z.areIntersectingOrTouching(p[h-1],S)?p[h-1]=z.fromPositions(p[h-1].getStartPosition(),S.getEndPosition()):h=p.push(S);let g=async S=>{s.trace("[format][provideDocumentRangeFormattingEdits] (request)",i.extensionId?.value,S);let y=await i.provideDocumentRangeFormattingEdits(c,S,c.getFormattingOptions(),u.token)||[];return s.trace("[format][provideDocumentRangeFormattingEdits] (response)",i.extensionId?.value,y),y},f=(S,y)=>{if(!S.length||!y.length)return!1;let w=S.reduce((k,T)=>z.plusRange(k,T.range),S[0].range);if(!y.some(k=>z.intersectRanges(w,k.range)))return!1;for(let k of S)for(let T of y)if(z.intersectRanges(k.range,T.range))return!0;return!1},v=[],b=[];try{if(typeof i.provideDocumentRangesFormattingEdits=="function"){s.trace("[format][provideDocumentRangeFormattingEdits] (request)",i.extensionId?.value,p);let S=await i.provideDocumentRangesFormattingEdits(c,p,c.getFormattingOptions(),u.token)||[];s.trace("[format][provideDocumentRangeFormattingEdits] (response)",i.extensionId?.value,S),b.push(S)}else{for(let S of p){if(u.token.isCancellationRequested)return!0;b.push(await g(S))}for(let S=0;S<p.length;++S)for(let y=S+1;y<p.length;++y){if(u.token.isCancellationRequested)return!0;if(f(b[S],b[y])){let w=z.plusRange(p[S],p[y]),k=await g(w);p.splice(y,1),p.splice(S,1),p.push(w),b.splice(y,1),b.splice(S,1),b.push(k),S=0,y=0}}}for(let S of b){if(u.token.isCancellationRequested)return!0;let y=await r.computeMoreMinimalEdits(c.uri,S);y&&v.push(...y)}if(u.token.isCancellationRequested)return!0}finally{u.dispose()}if(v.length===0)return!1;if(pn(e))mle.execute(e,v,!0),e.revealPositionInCenterIfOutsideViewport(e.getPosition(),1);else{let[{range:S}]=v,y=new Yt(S.startLineNumber,S.startColumn,S.endLineNumber,S.endColumn);c.pushEditOperations([y],v.map(w=>({text:w.text,range:z.lift(w.range),forceMoveMarkers:!0})),w=>{for(let{range:k}of w)if(z.areIntersectingOrTouching(k,y))return[new Yt(k.startLineNumber,k.startColumn,k.endLineNumber,k.endColumn)];return null})}return l.playSignal($o.format,{userGesture:n}),!0}async function vle(a,i,e,t,o,n){let r=a.get(F),s=a.get(zt),l=pn(i)?i.getModel():i,c=cCe(s.documentFormattingEditProvider,s.documentRangeFormattingEditProvider,l),u=await gle.select(c,l,e,1);u&&(t.report(u),await r.invokeFunction($ri,u,i,e,o,n))}async function $ri(a,i,e,t,o,n){let r=a.get($s),s=a.get(tr),l,c;pn(e)?(l=e.getModel(),c=new Ex(e,5,void 0,o)):(l=e,c=new Nae(e,o));let u;try{let p=await i.provideDocumentFormattingEdits(l,l.getFormattingOptions(),c.token);if(u=await r.computeMoreMinimalEdits(l.uri,p),c.token.isCancellationRequested)return!0}finally{c.dispose()}if(!u||u.length===0)return!1;if(pn(e))mle.execute(e,u,t!==2),t!==2&&e.revealPositionInCenterIfOutsideViewport(e.getPosition(),1);else{let[{range:p}]=u,h=new Yt(p.startLineNumber,p.startColumn,p.endLineNumber,p.endColumn);l.pushEditOperations([h],u.map(g=>({text:g.text,range:z.lift(g.range),forceMoveMarkers:!0})),g=>{for(let{range:f}of g)if(z.areIntersectingOrTouching(f,h))return[new Yt(f.startLineNumber,f.startColumn,f.endLineNumber,f.endColumn)];return null})}return s.playSignal($o.format,{userGesture:n}),!0}async function rVo(a,i,e,t,o,n){let r=i.documentRangeFormattingEditProvider.ordered(e);for(let s of r){let l=await Promise.resolve(s.provideDocumentRangeFormattingEdits(e,t,o,n)).catch(ss);if(dr(l))return await a.computeMoreMinimalEdits(e.uri,l)}}async function sVo(a,i,e,t,o){let n=cCe(i.documentFormattingEditProvider,i.documentRangeFormattingEditProvider,e);for(let r of n){let s=await Promise.resolve(r.provideDocumentFormattingEdits(e,t,o)).catch(ss);if(dr(s))return await a.computeMoreMinimalEdits(e.uri,s)}}async function u4e(a,i,e,t,o){let n=pn(e)?e.getModel():e,r=cCe(i.documentFormattingEditProvider,i.documentRangeFormattingEditProvider,n),s=await gle.select(r,n,t,1);if(s){let l=await Promise.resolve(s.provideDocumentFormattingEdits(n,n.getOptions(),o)).catch(ss);return await a.computeMoreMinimalEdits(n.uri,l)}}function qri(a,i,e,t,o,n,r){let s=i.onTypeFormattingEditProvider.ordered(e);return s.length===0||s[0].autoFormatTriggerCharacters.indexOf(o)<0?Promise.resolve(void 0):Promise.resolve(s[0].provideOnTypeFormattingEdits(e,t,o,n,r)).catch(ss).then(l=>a.computeMoreMinimalEdits(e.uri,l))}function aVo(a){let i=a;return!!i&&typeof i=="object"&&typeof i.tabSize=="number"&&typeof i.insertSpaces=="boolean"}qe.registerCommand("_executeFormatRangeProvider",async function(a,...i){let[e,t,o]=i;So(A.isUri(e)),So(z.isIRange(t));let n=a.get(Nt),r=a.get($s),s=a.get(zt),l=await n.createModelReference(e);try{return rVo(r,s,l.object.textEditorModel,z.lift(t),jri(o,l),ve.None)}finally{l.dispose()}});qe.registerCommand("_executeFormatDocumentProvider",async function(a,...i){let[e,t]=i;So(A.isUri(e));let o=a.get(Nt),n=a.get($s),r=a.get(zt),s=await o.createModelReference(e);try{return sVo(n,r,s.object.textEditorModel,jri(t,s),ve.None)}finally{s.dispose()}});qe.registerCommand("_executeFormatOnTypeProvider",async function(a,...i){let[e,t,o,n]=i;So(A.isUri(e)),So(Ie.isIPosition(t)),So(typeof o=="string");let r=a.get(Nt),s=a.get($s),l=a.get(zt),c=await r.createModelReference(e);try{return qri(s,l,c.object.textEditorModel,Ie.lift(t),o,jri(n,c),ve.None)}finally{c.dispose()}});function jri(a,i){let e;if(aVo(a))e=a;else{let t=i.object.textEditorModel.getOptions();e={tabSize:t.tabSize,insertSpaces:t.insertSpaces}}return e}var P7=class{constructor(i,e,t,o){this._editor=i;this._languageFeaturesService=e;this._workerService=t;this._accessibilitySignalService=o;this._disposables=new P;this._sessionDisposables=new P;this._disposables.add(e.onTypeFormattingEditProvider.onDidChange(this._update,this)),this._disposables.add(i.onDidChangeModel(()=>this._update())),this._disposables.add(i.onDidChangeModelLanguage(()=>this._update())),this._disposables.add(i.onDidChangeConfiguration(n=>{n.hasChanged(65)&&this._update()})),this._update()}static{this.ID="editor.contrib.autoFormat"}dispose(){this._disposables.dispose(),this._sessionDisposables.dispose()}_update(){if(this._sessionDisposables.clear(),!this._editor.getOption(65)||!this._editor.hasModel())return;let i=this._editor.getModel(),[e]=this._languageFeaturesService.onTypeFormattingEditProvider.ordered(i);if(!e||!e.autoFormatTriggerCharacters)return;let t=new D$;for(let o of e.autoFormatTriggerCharacters)t.add(o.charCodeAt(0));this._sessionDisposables.add(this._editor.onDidType(o=>{let n=o.charCodeAt(o.length-1);t.has(n)&&this._trigger(String.fromCharCode(n))}))}_trigger(i){if(!this._editor.hasModel()||this._editor.getSelections().length>1||!this._editor.getSelection().isEmpty())return;let e=this._editor.getModel(),t=this._editor.getPosition(),o=new $e,n=this._editor.onDidChangeModelContent(r=>{if(r.isFlush){o.cancel(),n.dispose();return}for(let s=0,l=r.changes.length;s<l;s++)if(r.changes[s].range.endLineNumber<=t.lineNumber){o.cancel(),n.dispose();return}});qri(this._workerService,this._languageFeaturesService,e,t,i,e.getFormattingOptions(),o.token).then(r=>{o.token.isCancellationRequested||dr(r)&&(this._accessibilitySignalService.playSignal($o.format,{userGesture:!1}),mle.execute(this._editor,r,!0))}).finally(()=>{n.dispose()})}};P7=I([m(1,zt),m(2,$s),m(3,tr)],P7);var dCe=class{constructor(i,e,t){this.editor=i;this._languageFeaturesService=e;this._instantiationService=t;this._callOnDispose=new P;this._callOnModel=new P;this._callOnDispose.add(i.onDidChangeConfiguration(()=>this._update())),this._callOnDispose.add(i.onDidChangeModel(()=>this._update())),this._callOnDispose.add(i.onDidChangeModelLanguage(()=>this._update())),this._callOnDispose.add(e.documentRangeFormattingEditProvider.onDidChange(this._update,this))}static{this.ID="editor.contrib.formatOnPaste"}dispose(){this._callOnDispose.dispose(),this._callOnModel.dispose()}_update(){this._callOnModel.clear(),this.editor.getOption(64)&&this.editor.hasModel()&&this._languageFeaturesService.documentRangeFormattingEditProvider.has(this.editor.getModel())&&this._callOnModel.add(this.editor.onDidPaste(({range:i})=>this._trigger(i)))}_trigger(i){this.editor.hasModel()&&(this.editor.getSelections().length>1||this._instantiationService.invokeFunction(fle,this.editor,i,2,bm.None,ve.None,!1).catch(mt))}};dCe=I([m(1,zt),m(2,F)],dCe);var Qri=class extends xi{constructor(){super({id:"editor.action.formatDocument",label:L(1171,"Format Document"),precondition:x.and(ue.notInCompositeEditor,ue.writable,ue.hasDocumentFormattingProvider),kbOpts:{kbExpr:ue.editorTextFocus,primary:1572,linux:{primary:3111},weight:100},contextMenuOpts:{group:"1_modification",order:1.3}})}async run(i,e){if(e.hasModel()){let t=i.get(F);await i.get(rd).showWhile(t.invokeFunction(vle,e,1,bm.None,ve.None,!0),250)}}},Yri=class extends xi{constructor(){super({id:"editor.action.formatSelection",label:L(1172,"Format Selection"),precondition:x.and(ue.writable,ue.hasDocumentSelectionFormattingProvider),kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2084),weight:100},contextMenuOpts:{when:ue.hasNonEmptySelection,group:"1_modification",order:1.31}})}async run(i,e){if(!e.hasModel())return;let t=i.get(F),o=e.getModel(),n=e.getSelections().map(s=>s.isEmpty()?new z(s.startLineNumber,1,s.startLineNumber,o.getLineMaxColumn(s.startLineNumber)):s);await i.get(rd).showWhile(t.invokeFunction(fle,e,n,1,bm.None,ve.None,!0),250)}};go(P7.ID,P7,2);go(dCe.ID,dCe,2);Jt(Qri);Jt(Yri);qe.registerCommand("editor.action.format",async a=>{let i=a.get(Kt).getFocusedCodeEditor();if(!i||!i.hasModel())return;let e=a.get(ge);i.getSelection().isEmpty()?await e.executeCommand("editor.action.formatDocument"):await e.executeCommand("editor.action.formatSelection")});var OL=class a{remove(){this.parent?.children.delete(this.id)}static findId(i,e){let t;typeof i=="string"?t=`${e.id}/${i}`:(t=`${e.id}/${i.name}`,e.children.get(t)!==void 0&&(t=`${e.id}/${i.name}_${i.range.startLineNumber}_${i.range.startColumn}`));let o=t;for(let n=0;e.children.get(o)!==void 0;n++)o=`${t}_${n}`;return o}static getElementById(i,e){if(!i)return;let t=Ng(i,e.id);if(t===i.length)return e;if(!(t<e.id.length))for(let[,o]of e.children){let n=a.getElementById(i,o);if(n)return n}}static size(i){let e=1;for(let[,t]of i.children)e+=a.size(t);return e}static empty(i){return i.children.size===0}},_f=class extends OL{constructor(e,t,o){super();this.id=e;this.parent=t;this.symbol=o;this.children=new Map}},iw=class extends OL{constructor(e,t,o,n){super();this.id=e;this.parent=t;this.label=o;this.order=n;this.children=new Map}getItemEnclosingPosition(e){return e?this._getItemEnclosingPosition(e,this.children):void 0}_getItemEnclosingPosition(e,t){for(let[,o]of t)if(!(!o.symbol.range||!z.containsPosition(o.symbol.range,e)))return this._getItemEnclosingPosition(e,o.children)||o}updateMarker(e){for(let[,t]of this.children)this._updateMarker(e,t)}_updateMarker(e,t){t.marker=void 0;let o=cx(e,t.symbol.range,z.compareRangesUsingStarts),n;o<0?(n=~o,n>0&&z.areIntersecting(e[n-1],t.symbol.range)&&(n-=1)):n=o;let r=[],s;for(;n<e.length&&z.areIntersecting(t.symbol.range,e[n]);n++){let l=e[n];r.push(l),e[n]=void 0,(!s||l.severity>s)&&(s=l.severity)}for(let[,l]of t.children)this._updateMarker(r,l);s&&(t.marker={count:r.length,topSev:s}),ZG(e)}},fO=class a extends OL{constructor(e){super();this.uri=e;this.id="root";this.parent=void 0;this._groups=new Map;this.children=new Map;this.id="root",this.parent=void 0}static create(e,t,o){let n=new $e(o),r=new a(t.uri),s=e.ordered(t),l=s.map((u,p)=>{let h=OL.findId(`provider_${p}`,r),g=new iw(h,r,u.displayName??"Unknown Outline Provider",p);return Promise.resolve(u.provideDocumentSymbols(t,n.token)).then(f=>{for(let v of f||[])a._makeOutlineElement(v,g);return g},f=>(ss(f),g)).then(f=>{OL.empty(f)?f.remove():r._groups.set(h,f)})}),c=e.onDidChange(()=>{let u=e.ordered(t);$i(u,s)||n.cancel()});return Promise.all(l).then(()=>n.token.isCancellationRequested&&!o.isCancellationRequested?a.create(e,t,o):r._compact()).finally(()=>{n.dispose(),c.dispose(),n.dispose()})}static _makeOutlineElement(e,t){let o=OL.findId(e,t),n=new _f(o,t,e);if(e.children)for(let r of e.children)a._makeOutlineElement(r,n);t.children.set(n.id,n)}static get(e){for(;e;){if(e instanceof a)return e;e=e.parent}}_compact(){let e=0;for(let[t,o]of this._groups)o.children.size===0?this._groups.delete(t):e+=1;if(e!==1)this.children=this._groups;else{let t=ht.first(this._groups.values());for(let[,o]of t.children)o.parent=this,this.children.set(o.id,o)}return this}merge(e){return this.uri.toString()!==e.uri.toString()||this._groups.size!==e._groups.size?!1:(this._groups=e._groups,this.children=e.children,!0)}getItemEnclosingPosition(e,t){let o;if(t){let r=t.parent;for(;r&&!o;)r instanceof iw&&(o=r),r=r.parent}let n;for(let[,r]of this._groups)if(n=r.getItemEnclosingPosition(e),n&&(!o||o===r))break;return n}getItemById(e){return OL.getElementById(e,this)}updateMarker(e){e.sort(z.compareRangesUsingStarts);for(let[,t]of this._groups)t.updateMarker(e.slice(0))}getTopLevelSymbols(){let e=[];for(let t of this.children.values())t instanceof _f?e.push(t.symbol):e.push(...ht.map(t.children.values(),o=>o.symbol));return e.sort((t,o)=>z.compareRangesUsingStarts(t.range,o.range))}asListOfDocumentSymbols(){let e=this.getTopLevelSymbols(),t=[];return a._flattenDocumentSymbols(t,e,""),t.sort((o,n)=>Ie.compare(z.getStartPosition(o.range),z.getStartPosition(n.range))||Ie.compare(z.getEndPosition(n.range),z.getEndPosition(o.range)))}static _flattenDocumentSymbols(e,t,o){for(let n of t)e.push({kind:n.kind,tags:n.tags,name:n.name,detail:n.detail,containerName:n.containerName||o,range:n.range,selectionRange:n.selectionRange,children:void 0}),n.children&&a._flattenDocumentSymbols(e,n.children,n.name)}},f_=ae("IOutlineModelService"),m4e=class{constructor(i,e,t){this._languageFeaturesService=i;this._disposables=new P;this._cache=new il(15,.7);this._debounceInformation=e.for(i.documentSymbolProvider,"DocumentSymbols",{min:350}),this._disposables.add(t.onModelRemoved(o=>{this._cache.delete(o.id)}))}dispose(){this._disposables.dispose()}async getOrCreate(i,e){let t=this._languageFeaturesService.documentSymbolProvider,o=t.ordered(i),n=this._cache.get(i.id);if(!n||n.versionId!==i.getVersionId()||!$i(n.provider,o)){let s=new $e;n={versionId:i.getVersionId(),provider:o,promiseCnt:0,source:s,promise:fO.create(t,i,s.token),model:void 0},this._cache.set(i.id,n);let l=Date.now();n.promise.then(c=>{n.model=c,this._debounceInformation.update(i,Date.now()-l)}).catch(c=>{this._cache.delete(i.id)})}if(n.model)return n.model;n.promiseCnt+=1;let r=e.onCancellationRequested(()=>{--n.promiseCnt===0&&(n.source.cancel(),this._cache.delete(i.id))});try{return await n.promise}finally{r.dispose()}}getDebounceValue(i){return this._debounceInformation.get(i)}getCachedModels(){return ht.filter(ht.map(this._cache.values(),i=>i.model),i=>i!==void 0)}};m4e=I([m(0,zt),m(1,jg),m(2,Ct)],m4e);we(f_,m4e,1);qe.registerCommand("_executeDocumentSymbolProvider",async function(a,...i){let[e]=i;So(A.isUri(e));let t=a.get(f_),n=await a.get(Nt).createModelReference(e);try{return(await t.getOrCreate(n.object.textEditorModel,ve.None)).getTopLevelSymbols()}finally{n.dispose()}});var xa=new class{constructor(){this._implementations=[]}register(i){return this._implementations.push(i),{dispose:()=>{let e=this._implementations.indexOf(i);e!==-1&&this._implementations.splice(e,1)}}}getImplementations(){return this._implementations}};function H8i(a){return a instanceof g4e?a._instance:a}var g4e=class{constructor(i){this.instantiationService=i}init(...i){}};function lVo(a,i){return class extends i{constructor(){super(...arguments);this._autorun=void 0}init(...o){this._autorun=Ga((n,r)=>{let s=a.read(n);this._instance=r.add(this.instantiationService.createInstance(s,...o))})}dispose(){this._autorun?.dispose()}}}var vwt=class extends g4e{constructor(i){super(i),this.init()}};vwt=I([m(0,F)],vwt);function bwt(a){return rE()?lVo(a,h4e):a.get()}var h4e=class extends g4e{constructor(i,e){super(e),this.init(i)}};h4e=I([m(1,F)],h4e);var A7=class{validateOrThrow(i){let e=this.validate(i);if(e.error)throw new Error(e.error.message);return e.content}},uCe=class extends A7{constructor(e){super();this.type=e}validate(e){return typeof e!==this.type?{content:void 0,error:{message:`Expected ${this.type}, but got ${typeof e}`}}:{content:e,error:void 0}}getJSONSchema(){return{type:this.type}}},cVo=new uCe("string");function U8i(){return cVo}var hls=new uCe("number");var dVo=new uCe("boolean");function tsi(){return dVo}var gls=new uCe("object");var Xri=class extends A7{validate(i){return{content:i,error:void 0}}getJSONSchema(){return{}}};function z8i(){return new Xri}var Swt=class extends A7{validate(i){return i!==void 0?{content:void 0,error:{message:`Expected undefined, but got ${typeof i}`}}:{content:void 0,error:void 0}}getJSONSchema(){return{}}};function K8i(){return new Swt}var f4e=class{constructor(i){this.validator=i}};function v4e(a){return new f4e(a)}var Jri=class extends A7{constructor(e){super();this.properties=e}validate(e){if(typeof e!="object"||e===null)return{content:void 0,error:{message:"Expected object"}};let t={};for(let o in this.properties){let n=this.properties[o],r=e[o],s=n instanceof f4e,l=s?n.validator:n;if(s&&r===void 0)continue;let{content:c,error:u}=l.validate(r);if(u)return{content:void 0,error:{message:`Error in property '${o}': ${u.message}`}};t[o]=c}return{content:t,error:void 0}}getJSONSchema(){let e=[],t={};for(let[n,r]of Object.entries(this.properties)){let s=r instanceof f4e,l=s?r.validator:r;t[n]=l.getJSONSchema(),s||e.push(n)}return{type:"object",properties:t,...e.length>0?{required:e}:{}}}};function G8i(a){return new Jri(a)}var Zri=class extends A7{constructor(e){super();this.validators=e}validate(e){let t;for(let o of this.validators){let{content:n,error:r}=o.validate(e);if(!r)return{content:n,error:void 0};t=r}return{content:void 0,error:t}}getJSONSchema(){return{oneOf:pUi(this.validators,e=>{if(!(e instanceof Swt))return e.getJSONSchema()})}}};function $8i(...a){return new Zri(a)}var esi=class extends A7{constructor(e,t){super();this._ref=e;this._validator=t}validate(e){return this._validator.validate(e)}getJSONSchema(){return{$ref:this._ref}}};function q8i(a,i){return new esi(a,i)}var $n={Visible:GIt,HasFocusedSuggestion:new Q("suggestWidgetHasFocusedSuggestion",!1,d(1620,null)),DetailsVisible:new Q("suggestWidgetDetailsVisible",!1,d(1619,null)),DetailsFocused:new Q("suggestWidgetDetailsFocused",!1,d(1618,null)),MultipleSuggestions:new Q("suggestWidgetMultipleSuggestions",!1,d(1621,null)),MakesTextEdit:new Q("suggestionMakesTextEdit",!0,d(1617,null)),AcceptSuggestionsOnEnter:new Q("acceptSuggestionOnEnter",!0,d(1613,null)),HasInsertAndReplaceRange:new Q("suggestionHasInsertAndReplaceRange",!1,d(1615,null)),InsertMode:new Q("suggestionInsertMode",void 0,{type:"string",description:d(1616,null)}),CanResolve:new Q("suggestionCanResolve",!1,d(1614,null))},WW=new D("suggestWidgetStatusBar"),isi=class{constructor(i,e,t,o){this.position=i;this.completion=e;this.container=t;this.provider=o;this.isInvalid=!1;this.score=uv.Default;this.distance=0;this.textLabel=typeof e.label=="string"?e.label:e.label?.label,this.labelLow=this.textLabel.toLowerCase(),this.isInvalid=!this.textLabel,this.sortTextLow=e.sortText&&e.sortText.toLowerCase(),this.filterTextLow=e.filterText&&e.filterText.toLowerCase(),this.extensionId=e.extensionId,z.isIRange(e.range)?(this.editStart=new Ie(e.range.startLineNumber,e.range.startColumn),this.editInsertEnd=new Ie(e.range.endLineNumber,e.range.endColumn),this.editReplaceEnd=new Ie(e.range.endLineNumber,e.range.endColumn),this.isInvalid=this.isInvalid||z.spansMultipleLines(e.range)||e.range.startLineNumber!==i.lineNumber):(this.editStart=new Ie(e.range.insert.startLineNumber,e.range.insert.startColumn),this.editInsertEnd=new Ie(e.range.insert.endLineNumber,e.range.insert.endColumn),this.editReplaceEnd=new Ie(e.range.replace.endLineNumber,e.range.replace.endColumn),this.isInvalid=this.isInvalid||z.spansMultipleLines(e.range.insert)||z.spansMultipleLines(e.range.replace)||e.range.insert.startLineNumber!==i.lineNumber||e.range.replace.startLineNumber!==i.lineNumber||e.range.insert.startColumn!==e.range.replace.startColumn),typeof o.resolveCompletionItem!="function"&&(this._resolveCache=Promise.resolve(),this._resolveDuration=0)}get isResolved(){return this._resolveDuration!==void 0}get resolveDuration(){return this._resolveDuration!==void 0?this._resolveDuration:-1}async resolve(i){if(!this._resolveCache){let e=i.onCancellationRequested(()=>{this._resolveCache=void 0,this._resolveDuration=void 0}),t=new En(!0);this._resolveCache=Promise.resolve(this.provider.resolveCompletionItem(this.completion,i)).then(o=>{Object.assign(this.completion,o),this._resolveDuration=t.elapsed()},o=>{so(o)&&(this._resolveCache=void 0,this._resolveDuration=void 0)}).finally(()=>{e.dispose()})}return this._resolveCache}};var Jq=class a{constructor(i=2,e=new Set,t=new Set,o=new Map,n=!0){this.snippetSortOrder=i;this.kindFilter=e;this.providerFilter=t;this.providerItemsToReuse=o;this.showDeprecated=n}static{this.default=new a}},N7;function Q8i(){return N7}function Y8i(a){let i=N7;return N7=a,i}var osi=class{constructor(i,e,t,o){this.items=i;this.needsClipboard=e;this.durations=t;this.disposable=o}};async function Sle(a,i,e,t=Jq.default,o={triggerKind:0},n=ve.None){let r=new En;e=e.clone();let s=i.getWordAtPosition(e),l=s?new z(e.lineNumber,s.startColumn,e.lineNumber,s.endColumn):z.fromPositions(e),c={replace:l,insert:l.setEndPosition(e.lineNumber,e.column)},u=[],p=new P,h=[],g=!1,f=(b,S,y)=>{let w=!1;if(!S)return w;for(let k of S.suggestions)if(!t.kindFilter.has(k.kind)){if(!t.showDeprecated&&k?.tags?.includes(1))continue;k.range||(k.range=c),k.sortText||(k.sortText=typeof k.label=="string"?k.label:k.label.label),!g&&k.insertTextRules&&k.insertTextRules&4&&(g=zh.guessNeedsClipboard(k.insertText)),u.push(new isi(e,k,S,b)),w=!0}return Ac(S)&&p.add(S),h.push({providerName:b._debugDisplayName??"unknown_provider",elapsedProvider:S.duration??-1,elapsedOverall:y.elapsed()}),w},v=(async()=>{if(!N7||t.kindFilter.has(28))return;let b=t.providerItemsToReuse.get(N7);if(b){b.forEach(w=>u.push(w));return}if(t.providerFilter.size>0&&!t.providerFilter.has(N7))return;let S=new En,y=await N7.provideCompletionItems(i,e,o,n);f(N7,y,S)})();for(let b of a.orderedGroups(i)){let S=!1;if(await Promise.all(b.map(async y=>{if(t.providerItemsToReuse.has(y)){let w=t.providerItemsToReuse.get(y);w.forEach(k=>u.push(k)),S=S||w.length>0;return}if(!(t.providerFilter.size>0&&!t.providerFilter.has(y)))try{let w=new En,k=await y.provideCompletionItems(i,e,o,n);S=f(y,k,w)||S}catch(w){ss(w)}})),S||n.isCancellationRequested)break}return await v,n.isCancellationRequested?(p.dispose(),Promise.reject(new ho)):new osi(u.sort(mVo(t.snippetSortOrder)),g,{entries:h,elapsed:r.elapsed()},p)}function nsi(a,i){if(a.sortTextLow&&i.sortTextLow){if(a.sortTextLow<i.sortTextLow)return-1;if(a.sortTextLow>i.sortTextLow)return 1}return a.textLabel<i.textLabel?-1:a.textLabel>i.textLabel?1:a.completion.kind-i.completion.kind}function uVo(a,i){if(a.completion.kind!==i.completion.kind){if(a.completion.kind===28)return-1;if(i.completion.kind===28)return 1}return nsi(a,i)}function pVo(a,i){if(a.completion.kind!==i.completion.kind){if(a.completion.kind===28)return 1;if(i.completion.kind===28)return-1}return nsi(a,i)}var Iwt=new Map;Iwt.set(0,uVo);Iwt.set(2,pVo);Iwt.set(1,nsi);function mVo(a){return Iwt.get(a)}qe.registerCommand("_executeCompletionItemProvider",async(a,...i)=>{let[e,t,o,n]=i;So(A.isUri(e)),So(Ie.isIPosition(t)),So(typeof o=="string"||!o),So(typeof n=="number"||!n);let{completionProvider:r}=a.get(zt),s=await a.get(Nt).createModelReference(e);try{let l={incomplete:!1,suggestions:[]},c=[],u=s.object.textEditorModel.validatePosition(t),p=await Sle(r,s.object.textEditorModel,u,void 0,{triggerCharacter:o??void 0,triggerKind:o?1:0});for(let h of p.items)c.length<(n??0)&&c.push(h.resolve(ve.None)),l.incomplete=l.incomplete||h.container.incomplete,l.suggestions.push(h.completion);try{return await Promise.all(c),l}finally{setTimeout(()=>p.disposable.dispose(),100)}}finally{s.dispose()}});function ywt(a,i){a.getContribution("editor.contrib.suggestController")?.triggerSuggest(new Set().add(i),void 0,!0)}var FW=class{static isAllOff(i){return i.other==="off"&&i.comments==="off"&&i.strings==="off"}static isAllOn(i){return i.other==="on"&&i.comments==="on"&&i.strings==="on"}static valueFor(i,e){switch(e){case 1:return i.comments;case 2:return i.strings;default:return i.other}}};var ka=class{static{this.inlineSuggestionVisible=new Q("inlineSuggestionVisible",!1,d(1356,null))}static{this.inlineSuggestionAlternativeActionVisible=new Q("inlineSuggestionAlternativeActionVisible",!1,d(1353,null))}static{this.inlineSuggestionHasIndentation=new Q("inlineSuggestionHasIndentation",!1,d(1354,null))}static{this.inlineSuggestionHasIndentationLessThanTabSize=new Q("inlineSuggestionHasIndentationLessThanTabSize",!0,d(1355,null))}static{this.suppressSuggestions=new Q("inlineSuggestionSuppressSuggestions",void 0,d(1357,null))}static{this.cursorBeforeGhostText=new Q("cursorBeforeGhostText",!1,d(1348,null))}static{this.cursorInIndentation=new Q("cursorInIndentation",!1,d(1349,null))}static{this.hasSelection=new Q("editor.hasSelection",!1,d(1350,null))}static{this.cursorAtInlineEdit=new Q("cursorAtInlineEdit",!1,d(1347,null))}static{this.inlineEditVisible=new Q("inlineEditIsVisible",!1,d(1352,null))}static{this.tabShouldJumpToInlineEdit=new Q("tabShouldJumpToInlineEdit",!1,d(1359,null))}static{this.tabShouldAcceptInlineEdit=new Q("tabShouldAcceptInlineEdit",!1,d(1358,null))}static{this.inInlineEditsPreviewEditor=new Q("inInlineEditsPreviewEditor",!0,d(1351,null))}};var wwt=class{constructor(i,e,t){this._selection=i,this._cursors=e,this._selectionId=null,this._trimInRegexesAndStrings=t}getEditOperations(i,e){let t=b4e(i,this._cursors,this._trimInRegexesAndStrings);for(let o=0,n=t.length;o<n;o++){let r=t[o];e.addEditOperation(r.range,r.text)}this._selectionId=e.trackSelection(this._selection)}computeCursorState(i,e){return e.getTrackedSelection(this._selectionId)}};function b4e(a,i,e){i.sort((s,l)=>s.lineNumber===l.lineNumber?s.column-l.column:s.lineNumber-l.lineNumber);for(let s=i.length-2;s>=0;s--)i[s].lineNumber===i[s+1].lineNumber&&i.splice(s,1);let t=[],o=0,n=0,r=i.length;for(let s=1,l=a.getLineCount();s<=l;s++){let c=a.getLineContent(s),u=c.length+1,p=0;if(n<r&&i[n].lineNumber===s&&(p=i[n].column,n++,p===u)||c.length===0)continue;let h=tv(c),g=0;if(h===-1)g=1;else if(h!==c.length-1)g=h+2;else continue;if(!e){if(!a.tokenization.hasAccurateTokensForLine(s))continue;let f=a.tokenization.getLineTokens(s),v=f.getStandardTokenType(f.findTokenIndexAtOffset(g));if(v===2||v===3)continue}g=Math.max(p,g),t[o++]=An.delete(new z(s,g,s,u))}return t}var S4e=class{constructor(i,e,t){this._selection=i,this._isCopyingDown=e,this._noop=t||!1,this._selectionDirection=0,this._selectionId=null,this._startLineNumberDelta=0,this._endLineNumberDelta=0}getEditOperations(i,e){let t=this._selection;this._startLineNumberDelta=0,this._endLineNumberDelta=0,t.startLineNumber<t.endLineNumber&&t.endColumn===1&&(this._endLineNumberDelta=1,t=t.setEndPosition(t.endLineNumber-1,i.getLineMaxColumn(t.endLineNumber-1)));let o=[];for(let r=t.startLineNumber;r<=t.endLineNumber;r++)o.push(i.getLineContent(r));let n=o.join(`
`);n===""&&this._isCopyingDown&&(this._startLineNumberDelta++,this._endLineNumberDelta++),this._noop?e.addEditOperation(new z(t.endLineNumber,i.getLineMaxColumn(t.endLineNumber),t.endLineNumber+1,1),t.endLineNumber===i.getLineCount()?"":`
`):this._isCopyingDown?e.addEditOperation(new z(t.startLineNumber,1,t.startLineNumber,1),n+`
`):e.addEditOperation(new z(t.endLineNumber,i.getLineMaxColumn(t.endLineNumber),t.endLineNumber,i.getLineMaxColumn(t.endLineNumber)),`
`+n),this._selectionId=e.trackSelection(t),this._selectionDirection=this._selection.getDirection()}computeCursorState(i,e){let t=e.getTrackedSelection(this._selectionId);if(this._startLineNumberDelta!==0||this._endLineNumberDelta!==0){let o=t.startLineNumber,n=t.startColumn,r=t.endLineNumber,s=t.endColumn;this._startLineNumberDelta!==0&&(o=o+this._startLineNumberDelta,n=1),this._endLineNumberDelta!==0&&(r=r+this._endLineNumberDelta,s=1),t=Yt.createWithDirection(o,n,r,s,this._selectionDirection)}return t}};function Ax(a,i){let e=0;for(let t=0;t<a.length;t++)a.charAt(t)===" "?e+=i:e++;return e}function Ile(a,i,e){a=a<0?0:a;let t="";if(!e){let o=Math.floor(a/i);a=a%i;for(let n=0;n<o;n++)t+=" "}for(let o=0;o<a;o++)t+=" ";return t}var mCe=class{constructor(i,e,t,o){this._languageConfigurationService=o;this._selection=i,this._isMovingDown=e,this._autoIndent=t,this._selectionId=null,this._moveEndLineSelectionShrink=!1}createVirtualModel(i,e,t){return{tokenization:{getLineTokens:o=>i.tokenization.getLineTokens(e(o)),getLanguageId:()=>i.getLanguageId(),getLanguageIdAtPosition:(o,n)=>i.getLanguageIdAtPosition(o,n)},getLineContent:o=>{let n=t?.(o);return n!==void 0?n:i.getLineContent(e(o))}}}getEditOperations(i,e){let t=i.getLineCount();if(this._isMovingDown&&this._selection.endLineNumber===t){this._selectionId=e.trackSelection(this._selection);return}if(!this._isMovingDown&&this._selection.startLineNumber===1){this._selectionId=e.trackSelection(this._selection);return}this._moveEndPositionDown=!1;let o=this._selection;o.startLineNumber<o.endLineNumber&&o.endColumn===1&&(this._moveEndPositionDown=!0,o=o.setEndPosition(o.endLineNumber-1,i.getLineMaxColumn(o.endLineNumber-1)));let{tabSize:n,indentSize:r,insertSpaces:s}=i.getOptions(),l=this.buildIndentConverter(n,r,s);if(o.startLineNumber===o.endLineNumber&&i.getLineMaxColumn(o.startLineNumber)===1){let c=o.startLineNumber,u=this._isMovingDown?c+1:c-1;i.getLineMaxColumn(u)===1?e.addEditOperation(new z(1,1,1,1),null):(e.addEditOperation(new z(c,1,c,1),i.getLineContent(u)),e.addEditOperation(new z(u,1,u,i.getLineMaxColumn(u)),null)),o=new Yt(u,1,u,1)}else{let c,u;if(this._isMovingDown){c=o.endLineNumber+1,u=i.getLineContent(c),e.addEditOperation(new z(c-1,i.getLineMaxColumn(c-1),c,i.getLineMaxColumn(c)),null);let p=u;if(this.shouldAutoIndent(i,o)){let h=this.matchEnterRule(i,l,n,c,o.startLineNumber-1);if(h!==null){let f=bl(i.getLineContent(c)),v=h+Ax(f,n);p=Ile(v,n,s)+this.trimStart(u)}else{let f=this.createVirtualModel(i,b=>b===o.startLineNumber?c:b),v=use(this._autoIndent,f,i.getLanguageIdAtPosition(c,1),o.startLineNumber,l,this._languageConfigurationService);if(v!==null){let b=bl(i.getLineContent(c)),S=Ax(v,n),y=Ax(b,n);S!==y&&(p=Ile(S,n,s)+this.trimStart(u))}}e.addEditOperation(new z(o.startLineNumber,1,o.startLineNumber,1),p+`
`);let g=this.matchEnterRuleMovingDown(i,l,n,o.startLineNumber,c,p);if(g!==null)g!==0&&this.getIndentEditsOfMovingBlock(i,e,o,n,s,g);else{let f=this.createVirtualModel(i,b=>b===o.startLineNumber?c:b>=o.startLineNumber+1&&b<=o.endLineNumber+1?b-1:b,b=>b===o.startLineNumber?p:void 0),v=use(this._autoIndent,f,i.getLanguageIdAtPosition(c,1),o.startLineNumber+1,l,this._languageConfigurationService);if(v!==null){let b=bl(i.getLineContent(o.startLineNumber)),S=Ax(v,n),y=Ax(b,n);if(S!==y){let w=S-y;this.getIndentEditsOfMovingBlock(i,e,o,n,s,w)}}}}else e.addEditOperation(new z(o.startLineNumber,1,o.startLineNumber,1),p+`
`)}else if(c=o.startLineNumber-1,u=i.getLineContent(c),e.addEditOperation(new z(c,1,c+1,1),null),e.addEditOperation(new z(o.endLineNumber,i.getLineMaxColumn(o.endLineNumber),o.endLineNumber,i.getLineMaxColumn(o.endLineNumber)),`
`+u),this.shouldAutoIndent(i,o)){let p=this.createVirtualModel(i,g=>g===c?o.startLineNumber:g),h=this.matchEnterRule(i,l,n,o.startLineNumber,o.startLineNumber-2);if(h!==null)h!==0&&this.getIndentEditsOfMovingBlock(i,e,o,n,s,h);else{let g=use(this._autoIndent,p,i.getLanguageIdAtPosition(o.startLineNumber,1),c,l,this._languageConfigurationService);if(g!==null){let f=bl(i.getLineContent(o.startLineNumber)),v=Ax(g,n),b=Ax(f,n);if(v!==b){let S=v-b;this.getIndentEditsOfMovingBlock(i,e,o,n,s,S)}}}}}this._selectionId=e.trackSelection(o)}buildIndentConverter(i,e,t){return{shiftIndent:o=>Xv.shiftIndent(o,o.length+1,i,e,t),unshiftIndent:o=>Xv.unshiftIndent(o,o.length+1,i,e,t)}}parseEnterResult(i,e,t,o,n){if(n){let r=n.indentation;n.indentAction===0||n.indentAction===1?r=n.indentation+n.appendText:n.indentAction===2?r=n.indentation:n.indentAction===3&&(r=e.unshiftIndent(n.indentation)+n.appendText);let s=i.getLineContent(o);if(this.trimStart(s).indexOf(this.trimStart(r))>=0){let l=bl(i.getLineContent(o)),c=bl(r),u=nht(i,o,this._languageConfigurationService);u!==null&&u&2&&(c=e.unshiftIndent(c));let p=Ax(c,t),h=Ax(l,t);return p-h}}return null}matchEnterRuleMovingDown(i,e,t,o,n,r){if(tv(r)>=0){let s=i.getLineMaxColumn(n),l=R$(this._autoIndent,i,new z(n,s,n,s),this._languageConfigurationService);return this.parseEnterResult(i,e,t,o,l)}else{let s=o-1;for(;s>=1;){let u=i.getLineContent(s);if(tv(u)>=0)break;s--}if(s<1||o>i.getLineCount())return null;let l=i.getLineMaxColumn(s),c=R$(this._autoIndent,i,new z(s,l,s,l),this._languageConfigurationService);return this.parseEnterResult(i,e,t,o,c)}}matchEnterRule(i,e,t,o,n,r){let s=n;for(;s>=1;){let u;if(s===n&&r!==void 0?u=r:u=i.getLineContent(s),tv(u)>=0)break;s--}if(s<1||o>i.getLineCount())return null;let l=i.getLineMaxColumn(s),c=R$(this._autoIndent,i,new z(s,l,s,l),this._languageConfigurationService);return this.parseEnterResult(i,e,t,o,c)}trimStart(i){return i.replace(/^\s+/,"")}shouldAutoIndent(i,e){if(this._autoIndent<4||!i.tokenization.isCheapToTokenize(e.startLineNumber))return!1;let t=i.getLanguageIdAtPosition(e.startLineNumber,1),o=i.getLanguageIdAtPosition(e.endLineNumber,1);return!(t!==o||this._languageConfigurationService.getLanguageConfiguration(t).indentRulesSupport===null)}getIndentEditsOfMovingBlock(i,e,t,o,n,r){for(let s=t.startLineNumber;s<=t.endLineNumber;s++){let l=i.getLineContent(s),c=bl(l),p=Ax(c,o)+r,h=Ile(p,o,n);h!==c&&(e.addEditOperation(new z(s,1,s,c.length+1),h),s===t.endLineNumber&&t.endColumn<=c.length+1&&h===""&&(this._moveEndLineSelectionShrink=!0))}}computeCursorState(i,e){let t=e.getTrackedSelection(this._selectionId);return this._moveEndPositionDown&&(t=t.setEndPosition(t.endLineNumber+1,1)),this._moveEndLineSelectionShrink&&t.startLineNumber<t.endLineNumber&&(t=t.setEndPosition(t.endLineNumber,2)),t}};mCe=I([m(3,bs)],mCe);var hCe=class{static{this._COLLATOR=Wu.Collator()}constructor(i,e){this.selection=i,this.descending=e,this.selectionId=null}getEditOperations(i,e){let t=hVo(i,this.selection,this.descending);t&&e.addEditOperation(t.range,t.text),this.selectionId=e.trackSelection(this.selection)}computeCursorState(i,e){return e.getTrackedSelection(this.selectionId)}static canRun(i,e,t){if(i===null)return!1;let o=J8i(i,e,t);if(!o)return!1;for(let n=0,r=o.before.length;n<r;n++)if(o.before[n]!==o.after[n])return!0;return!1}};function J8i(a,i,e){let t=i.startLineNumber,o=i.endLineNumber;if(i.endColumn===1&&o--,t>=o)return null;let n=[];for(let s=t;s<=o;s++)n.push(a.getLineContent(s));let r=n.slice(0);return r.sort(hCe._COLLATOR.value.compare),e===!0&&(r=r.reverse()),{startLineNumber:t,endLineNumber:o,before:n,after:r}}function hVo(a,i,e){let t=J8i(a,i,e);return t?An.replace(new z(t.startLineNumber,1,t.endLineNumber,a.getLineMaxColumn(t.endLineNumber)),t.after.join(`
`)):null}var Cwt=class extends xi{constructor(i,e){super(e),this.down=i}run(i,e){if(!e.hasModel())return;let t=e.getSelections().map((r,s)=>({selection:r,index:s,ignore:!1}));t.sort((r,s)=>z.compareRangesUsingStarts(r.selection,s.selection));let o=t[0];for(let r=1;r<t.length;r++){let s=t[r];o.selection.endLineNumber===s.selection.startLineNumber&&(o.index<s.index?s.ignore=!0:(o.ignore=!0,o=s))}let n=[];for(let r of t)n.push(new S4e(r.selection,this.down,r.ignore));e.pushUndoStop(),e.executeCommands(this.id,n),e.pushUndoStop()}},rsi=class extends Cwt{constructor(){super(!1,{id:"editor.action.copyLinesUpAction",label:L(1412,"Copy Line Up"),precondition:ue.writable,kbOpts:{kbExpr:ue.editorTextFocus,primary:1552,linux:{primary:3600},weight:100},menuOpts:{menuId:D.MenubarSelectionMenu,group:"2_line",title:d(1429,null),order:1},canTriggerInlineEdits:!0})}},ssi=class extends Cwt{constructor(){super(!0,{id:"editor.action.copyLinesDownAction",label:L(1411,"Copy Line Down"),precondition:ue.writable,kbOpts:{kbExpr:ue.editorTextFocus,primary:1554,linux:{primary:3602},weight:100},menuOpts:{menuId:D.MenubarSelectionMenu,group:"2_line",title:d(1428,null),order:2},canTriggerInlineEdits:!0})}},asi=class extends xi{constructor(){super({id:"editor.action.duplicateSelection",label:L(1402,"Duplicate Selection"),precondition:ue.writable,menuOpts:{menuId:D.MenubarSelectionMenu,group:"2_line",title:d(1430,null),order:5},canTriggerInlineEdits:!0})}run(i,e,t){if(!e.hasModel())return;let o=[],n=e.getSelections(),r=e.getModel();for(let s of n)if(s.isEmpty())o.push(new S4e(s,!0));else{let l=new Yt(s.endLineNumber,s.endColumn,s.endLineNumber,s.endColumn);o.push(new _mt(l,r.getValueInRange(s)))}e.pushUndoStop(),e.executeCommands(this.id,o),e.pushUndoStop()}},xwt=class extends xi{constructor(i,e){super(e),this.down=i}run(i,e){let t=i.get(bs),o=[],n=e.getSelections()||[],r=e.getOption(16);for(let s of n)o.push(new mCe(s,this.down,r,t));e.pushUndoStop(),e.executeCommands(this.id,o),e.pushUndoStop()}},lsi=class extends xwt{constructor(){super(!1,{id:"editor.action.moveLinesUpAction",label:L(1422,"Move Line Up"),precondition:ue.writable,kbOpts:{kbExpr:ue.editorTextFocus,primary:528,linux:{primary:528},weight:100},menuOpts:{menuId:D.MenubarSelectionMenu,group:"2_line",title:d(1432,null),order:3},canTriggerInlineEdits:!0})}},csi=class extends xwt{constructor(){super(!0,{id:"editor.action.moveLinesDownAction",label:L(1421,"Move Line Down"),precondition:ue.writable,kbOpts:{kbExpr:ue.editorTextFocus,primary:530,linux:{primary:530},weight:100},menuOpts:{menuId:D.MenubarSelectionMenu,group:"2_line",title:d(1431,null),order:4},canTriggerInlineEdits:!0})}},kwt=class extends xi{constructor(i,e){super(e),this.descending=i}run(i,e){if(!e.hasModel())return;let t=e.getModel(),o=e.getSelections();o.length===1&&o[0].isSingleLine()&&(o=[new Yt(1,1,t.getLineCount(),t.getLineMaxColumn(t.getLineCount()))]);for(let r of o)if(!hCe.canRun(e.getModel(),r,this.descending))return;let n=[];for(let r=0,s=o.length;r<s;r++)n[r]=new hCe(o[r],this.descending);e.pushUndoStop(),e.executeCommands(this.id,n),e.pushUndoStop()}},dsi=class extends kwt{constructor(){super(!1,{id:"editor.action.sortLinesAscending",label:L(1425,"Sort Lines Ascending"),precondition:ue.writable,canTriggerInlineEdits:!0})}},usi=class extends kwt{constructor(){super(!0,{id:"editor.action.sortLinesDescending",label:L(1426,"Sort Lines Descending"),precondition:ue.writable,canTriggerInlineEdits:!0})}},psi=class extends xi{constructor(){super({id:"editor.action.removeDuplicateLines",label:L(1416,"Delete Duplicate Lines"),precondition:ue.writable,canTriggerInlineEdits:!0})}run(i,e){if(!e.hasModel())return;let t=e.getModel();if(t.getLineCount()===1&&t.getLineMaxColumn(1)===1)return;let o=[],n=[],r=0,s=!0,l=e.getSelections();l.length===1&&l[0].isSingleLine()&&(l=[new Yt(1,1,t.getLineCount(),t.getLineMaxColumn(t.getLineCount()))],s=!1);for(let c of l){let u=new Set,p=[];for(let v=c.startLineNumber;v<=c.endLineNumber;v++){let b=t.getLineContent(v);u.has(b)||(p.push(b),u.add(b))}let h=new Yt(c.startLineNumber,1,c.endLineNumber,t.getLineMaxColumn(c.endLineNumber)),g=c.startLineNumber-r,f=new Yt(g,1,g+p.length-1,p[p.length-1].length+1);o.push(An.replace(h,p.join(`
`))),n.push(f),r+=c.endLineNumber-c.startLineNumber+1-p.length}e.pushUndoStop(),e.executeEdits(this.id,o,s?n:void 0),e.pushUndoStop()}},msi=class extends xi{constructor(){super({id:"editor.action.reverseLines",label:L(1424,"Reverse lines"),precondition:ue.writable,canTriggerInlineEdits:!0})}run(i,e){if(!e.hasModel())return;let t=e.getModel(),o=e.getSelections(),n=o;n.length===1&&n[0].isSingleLine()&&(n=[new Yt(1,1,t.getLineCount(),t.getLineMaxColumn(t.getLineCount()))]);let r=[],s=[];for(let l=0;l<n.length;l++){let c=n[l],u=o[l],p=c.endLineNumber;c.startLineNumber<c.endLineNumber&&c.endColumn===1&&p--;let h=new z(c.startLineNumber,1,p,t.getLineMaxColumn(p));p===t.getLineCount()&&t.getLineContent(h.endLineNumber)===""&&(h=h.setEndPosition(h.endLineNumber-1,t.getLineMaxColumn(h.endLineNumber-1)));let g=[];for(let S=h.endLineNumber;S>=h.startLineNumber;S--)g.push(t.getLineContent(S));let f=An.replace(h,g.join(`
`));r.push(f);let v=function(S){return S<=h.endLineNumber?h.endLineNumber-S+h.startLineNumber:S},b=function(S){if(S.isEmpty())return new Yt(v(S.positionLineNumber),S.positionColumn,v(S.positionLineNumber),S.positionColumn);{let y=v(S.selectionStartLineNumber),w=v(S.positionLineNumber),k=S.selectionStartColumn,T=S.positionColumn;return new Yt(y,k,w,T)}};s.push(b(u))}e.pushUndoStop(),e.executeEdits(this.id,r,s),e.pushUndoStop()}},w4e=class a extends xi{static{this.ID="editor.action.trimTrailingWhitespace"}constructor(){super({id:a.ID,label:L(1427,"Trim Trailing Whitespace"),precondition:ue.writable,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2102),weight:100}})}run(i,e,t){let o=[];t.reason==="auto-save"&&(o=(e.getSelections()||[]).map(u=>new Ie(u.positionLineNumber,u.positionColumn)));let n=e.getSelection();if(n===null)return;let r=i.get(B),s=e.getModel(),l=r.getValue("files.trimTrailingWhitespaceInRegexAndStrings",{overrideIdentifier:s?.getLanguageId(),resource:s?.uri}),c=new wwt(n,o,l);e.pushUndoStop(),e.executeCommands(this.id,[c]),e.pushUndoStop()}},hsi=class extends xi{constructor(){super({id:"editor.action.deleteLines",label:L(1413,"Delete Line"),precondition:ue.writable,kbOpts:{kbExpr:ue.textInputFocus,primary:3113,weight:100},canTriggerInlineEdits:!0})}run(i,e){if(!e.hasModel())return;let t=this._getLinesToRemove(e),o=e.getModel();if(o.getLineCount()===1&&o.getLineMaxColumn(1)===1)return;let n=0,r=[],s=[];for(let l=0,c=t.length;l<c;l++){let u=t[l],p=u.startLineNumber,h=u.endLineNumber,g=1,f=o.getLineMaxColumn(h);h<o.getLineCount()?(h+=1,f=1):p>1&&(p-=1,g=o.getLineMaxColumn(p)),r.push(An.replace(new Yt(p,g,h,f),"")),s.push(new Yt(p-n,u.positionColumn,p-n,u.positionColumn)),n+=u.endLineNumber-u.startLineNumber+1}e.pushUndoStop(),e.executeEdits(this.id,r,s),e.revealAllCursors(!0),e.pushUndoStop()}_getLinesToRemove(i){let e=i.getSelections().map(n=>{let r=n.endLineNumber;return n.startLineNumber<n.endLineNumber&&n.endColumn===1&&(r-=1),{startLineNumber:n.startLineNumber,selectionStartColumn:n.selectionStartColumn,endLineNumber:r,positionColumn:n.positionColumn}});e.sort((n,r)=>n.startLineNumber===r.startLineNumber?n.endLineNumber-r.endLineNumber:n.startLineNumber-r.startLineNumber);let t=[],o=e[0];for(let n=1;n<e.length;n++)o.endLineNumber+1>=e[n].startLineNumber?o.endLineNumber=e[n].endLineNumber:(t.push(o),o=e[n]);return t.push(o),t}},gsi=class extends xi{constructor(){super({id:"editor.action.indentLines",label:L(1417,"Indent Line"),precondition:ue.writable,kbOpts:{kbExpr:ue.editorTextFocus,primary:2142,weight:100},canTriggerInlineEdits:!0})}run(i,e){let t=e._getViewModel();t&&(e.pushUndoStop(),e.executeCommands(this.id,RM.indent(t.cursorConfig,e.getModel(),e.getSelections())),e.pushUndoStop())}},fsi=class extends xi{constructor(){super({id:"editor.action.outdentLines",label:L(1423,"Outdent Line"),precondition:ue.writable,kbOpts:{kbExpr:ue.editorTextFocus,primary:2140,weight:100},canTriggerInlineEdits:!0})}run(i,e){rL.Outdent.runEditorCommand(i,e,null)}},C4e=class a extends xi{static{this.ID="editor.action.insertLineBefore"}constructor(){super({id:a.ID,label:L(1419,"Insert Line Above"),precondition:ue.writable,kbOpts:{kbExpr:ue.editorTextFocus,primary:3075,weight:100},canTriggerInlineEdits:!0})}run(i,e){let t=e._getViewModel();t&&(e.pushUndoStop(),e.executeCommands(this.id,M$.lineInsertBefore(t.cursorConfig,e.getModel(),e.getSelections())))}},yle=class a extends xi{static{this.ID="editor.action.insertLineAfter"}constructor(){super({id:a.ID,label:L(1418,"Insert Line Below"),precondition:ue.writable,kbOpts:{kbExpr:ue.editorTextFocus,primary:2051,weight:100},canTriggerInlineEdits:!0})}run(i,e){let t=e._getViewModel();t&&(e.pushUndoStop(),e.executeCommands(this.id,M$.lineInsertAfter(t.cursorConfig,e.getModel(),e.getSelections())))}},Ewt=class extends xi{run(i,e){if(!e.hasModel())return;let t=e.getSelection(),o=this._getRangesToDelete(e),n=[];for(let l=0,c=o.length-1;l<c;l++){let u=o[l],p=o[l+1];z.intersectRanges(u,p)===null?n.push(u):o[l+1]=z.plusRange(u,p)}n.push(o[o.length-1]);let r=this._getEndCursorState(t,n),s=n.map(l=>An.replace(l,""));e.pushUndoStop(),e.executeEdits(this.id,s,r),e.pushUndoStop()}},vsi=class extends Ewt{constructor(){super({id:"deleteAllLeft",label:L(1414,"Delete All Left"),precondition:ue.writable,kbOpts:{kbExpr:ue.textInputFocus,primary:0,mac:{primary:2049},weight:100},canTriggerInlineEdits:!0})}_getEndCursorState(i,e){let t=null,o=[],n=0;return e.forEach(r=>{let s;if(r.endColumn===1&&n>0){let l=r.startLineNumber-n;s=new Yt(l,r.startColumn,l,r.startColumn)}else s=new Yt(r.startLineNumber,r.startColumn,r.startLineNumber,r.startColumn);n+=r.endLineNumber-r.startLineNumber,r.intersectRanges(i)?t=s:o.push(s)}),t&&o.unshift(t),o}_getRangesToDelete(i){let e=i.getSelections();if(e===null)return[];let t=e,o=i.getModel();return o===null?[]:(t.sort(z.compareRangesUsingStarts),t=t.map(n=>{if(n.isEmpty())if(n.startColumn===1){let r=Math.max(1,n.startLineNumber-1),s=n.startLineNumber===1?1:o.getLineLength(r)+1;return new z(r,s,n.startLineNumber,1)}else return new z(n.startLineNumber,1,n.startLineNumber,n.startColumn);else return new z(n.startLineNumber,1,n.endLineNumber,n.endColumn)}),t)}},bsi=class extends Ewt{constructor(){super({id:"deleteAllRight",label:L(1415,"Delete All Right"),precondition:ue.writable,kbOpts:{kbExpr:ue.textInputFocus,primary:0,mac:{primary:297,secondary:[2068]},weight:100},canTriggerInlineEdits:!0})}_getEndCursorState(i,e){let t=null,o=[];for(let n=0,r=e.length,s=0;n<r;n++){let l=e[n],c=new Yt(l.startLineNumber-s,l.startColumn,l.startLineNumber-s,l.startColumn);l.intersectRanges(i)?t=c:o.push(c)}return t&&o.unshift(t),o}_getRangesToDelete(i){let e=i.getModel();if(e===null)return[];let t=i.getSelections();if(t===null)return[];let o=t.map(n=>{if(n.isEmpty()){let r=e.getLineMaxColumn(n.startLineNumber);return n.startColumn===r?new z(n.startLineNumber,n.startColumn,n.startLineNumber+1,1):new z(n.startLineNumber,n.startColumn,n.startLineNumber,r)}return n});return o.sort(z.compareRangesUsingStarts),o}},Ssi=class extends xi{constructor(){super({id:"editor.action.joinLines",label:L(1420,"Join Lines"),precondition:ue.writable,kbOpts:{kbExpr:ue.editorTextFocus,primary:0,mac:{primary:296},weight:100},canTriggerInlineEdits:!0})}run(i,e){let t=e.getSelections();if(t===null)return;let o=e.getSelection();if(o===null)return;t.sort(z.compareRangesUsingStarts);let n=[],r=t.reduce((h,g)=>h.isEmpty()?h.endLineNumber===g.startLineNumber?(o.equalsSelection(h)&&(o=g),g):g.startLineNumber>h.endLineNumber+1?(n.push(h),g):new Yt(h.startLineNumber,h.startColumn,g.endLineNumber,g.endColumn):g.startLineNumber>h.endLineNumber?(n.push(h),g):new Yt(h.startLineNumber,h.startColumn,g.endLineNumber,g.endColumn));n.push(r);let s=e.getModel();if(s===null)return;let l=[],c=[],u=o,p=0;for(let h=0,g=n.length;h<g;h++){let f=n[h],v=f.startLineNumber,b=1,S=0,y,w,k=s.getLineLength(f.endLineNumber)-f.endColumn;if(f.isEmpty()||f.startLineNumber===f.endLineNumber){let O=f.getStartPosition();O.lineNumber<s.getLineCount()?(y=v+1,w=s.getLineMaxColumn(y)):(y=O.lineNumber,w=s.getLineMaxColumn(O.lineNumber))}else y=f.endLineNumber,w=s.getLineMaxColumn(y);let T=s.getLineContent(v);for(let O=v+1;O<=y;O++){let V=s.getLineContent(O),U=s.getLineFirstNonWhitespaceColumn(O);if(U>=1){let G=!0;T===""&&(G=!1),G&&(T.charAt(T.length-1)===" "||T.charAt(T.length-1)===" ")&&(G=!1,T=T.replace(/[\s\uFEFF\xA0]+$/g," "));let $=V.substr(U-1);T+=(G?" ":"")+$,G?S=$.length+1:S=$.length}else S=0}let N=new z(v,b,y,w);if(!N.isEmpty()){let O;f.isEmpty()?(l.push(An.replace(N,T)),O=new Yt(N.startLineNumber-p,T.length-S+1,v-p,T.length-S+1)):f.startLineNumber===f.endLineNumber?(l.push(An.replace(N,T)),O=new Yt(f.startLineNumber-p,f.startColumn,f.endLineNumber-p,f.endColumn)):(l.push(An.replace(N,T)),O=new Yt(f.startLineNumber-p,f.startColumn,f.startLineNumber-p,T.length-k)),z.intersectRanges(N,o)!==null?u=O:c.push(O)}p+=N.endLineNumber-N.startLineNumber}c.unshift(u),e.pushUndoStop(),e.executeEdits(this.id,l,c),e.pushUndoStop()}},Isi=class extends xi{constructor(){super({id:"editor.action.transpose",label:L(1410,"Transpose Characters around the Cursor"),precondition:ue.writable,canTriggerInlineEdits:!0})}run(i,e){let t=e.getSelections();if(t===null)return;let o=e.getModel();if(o===null)return;let n=[];for(let r=0,s=t.length;r<s;r++){let l=t[r];if(!l.isEmpty())continue;let c=l.getStartPosition(),u=o.getLineMaxColumn(c.lineNumber);if(c.column>=u){if(c.lineNumber===o.getLineCount())continue;let p=new z(c.lineNumber,Math.max(1,c.column-1),c.lineNumber+1,1),h=o.getValueInRange(p).split("").reverse().join("");n.push(new Wh(new Yt(c.lineNumber,Math.max(1,c.column-1),c.lineNumber+1,1),h))}else{let p=new z(c.lineNumber,Math.max(1,c.column-1),c.lineNumber,c.column+1),h=o.getValueInRange(p).split("").reverse().join("");n.push(new B6(p,h,new Yt(c.lineNumber,c.column+1,c.lineNumber,c.column+1)))}}e.pushUndoStop(),e.executeCommands(this.id,n),e.pushUndoStop()}},Zq=class extends xi{run(i,e){let t=e.getSelections();if(t===null)return;let o=e.getModel();if(o===null)return;let n=e.getOption(148),r=[];for(let s of t)if(s.isEmpty()){let l=s.getStartPosition(),c=e.getConfiguredWordAtPosition(l);if(!c)continue;let u=new z(l.lineNumber,c.startColumn,l.lineNumber,c.endColumn),p=o.getValueInRange(u);r.push(An.replace(u,this._modifyText(p,n)))}else{let l=o.getValueInRange(s);r.push(An.replace(s,this._modifyText(l,n)))}e.pushUndoStop(),e.executeEdits(this.id,r),e.pushUndoStop()}},ysi=class extends Zq{constructor(){super({id:"editor.action.transformToUppercase",label:L(1409,"Transform to Uppercase"),precondition:ue.writable,canTriggerInlineEdits:!0})}_modifyText(i,e){return i.toLocaleUpperCase()}},wsi=class extends Zq{constructor(){super({id:"editor.action.transformToLowercase",label:L(1405,"Transform to Lowercase"),precondition:ue.writable,canTriggerInlineEdits:!0})}_modifyText(i,e){return i.toLocaleLowerCase()}},FL=class{constructor(i,e){this._pattern=i;this._flags=e;this._actual=null,this._evaluated=!1}get(){if(!this._evaluated){this._evaluated=!0;try{this._actual=new RegExp(this._pattern,this._flags)}catch{}}return this._actual}isSupported(){return this.get()!==null}},Twt=class a extends Zq{static{this.titleBoundary=new FL("(^|[^\\p{L}\\p{N}']|((^|\\P{L})'))\\p{L}","gmu")}constructor(){super({id:"editor.action.transformToTitlecase",label:L(1408,"Transform to Title Case"),precondition:ue.writable,canTriggerInlineEdits:!0})}_modifyText(i,e){let t=a.titleBoundary.get();return t?i.toLocaleLowerCase().replace(t,o=>o.toLocaleUpperCase()):i}},I4e=class a extends Zq{static{this.caseBoundary=new FL("(\\p{Ll})(\\p{Lu})","gmu")}static{this.singleLetters=new FL("(\\p{Lu}|\\p{N})(\\p{Lu})(\\p{Ll})","gmu")}constructor(){super({id:"editor.action.transformToSnakecase",label:L(1407,"Transform to Snake Case"),precondition:ue.writable,canTriggerInlineEdits:!0})}_modifyText(i,e){let t=a.caseBoundary.get(),o=a.singleLetters.get();return!t||!o?i:i.replace(t,"$1_$2").replace(o,"$1_$2$3").toLocaleLowerCase()}},y4e=class a extends Zq{static{this.singleLineWordBoundary=new FL("[_\\s-]+","gm")}static{this.multiLineWordBoundary=new FL("[_-]+","gm")}static{this.validWordStart=new FL("^(\\p{Lu}[^\\p{Lu}])","gmu")}constructor(){super({id:"editor.action.transformToCamelcase",label:L(1403,"Transform to Camel Case"),precondition:ue.writable,canTriggerInlineEdits:!0})}_modifyText(i,e){let t=/\r\n|\r|\n/.test(i)?a.multiLineWordBoundary.get():a.singleLineWordBoundary.get(),o=a.validWordStart.get();if(!t||!o)return i;let n=i.split(t);return n.shift()?.replace(o,s=>s.toLocaleLowerCase())+n.map(s=>s.substring(0,1).toLocaleUpperCase()+s.substring(1)).join("")}},_wt=class a extends Zq{static{this.wordBoundary=new FL("[_ \\t-]","gm")}static{this.wordBoundaryToMaintain=new FL("(?<=\\.)","gm")}static{this.upperCaseWordMatcher=new FL("^\\p{Lu}+$","mu")}constructor(){super({id:"editor.action.transformToPascalcase",label:L(1406,"Transform to Pascal Case"),precondition:ue.writable,canTriggerInlineEdits:!0})}_modifyText(i,e){let t=a.wordBoundary.get(),o=a.wordBoundaryToMaintain.get(),n=a.upperCaseWordMatcher.get();return!t||!o||!n?i:i.split(o).map(l=>l.split(t)).flat().map(l=>{let c=l.charAt(0).toLocaleUpperCase()+l.slice(1);return c.length>1&&n.test(c)?c.charAt(0)+c.slice(1).toLocaleLowerCase():c}).join("")}},Dwt=class a extends Zq{static isSupported(){return[this.caseBoundary,this.singleLetters,this.underscoreBoundary].every(e=>e.isSupported())}static{this.caseBoundary=new FL("(\\p{Ll})(\\p{Lu})","gmu")}static{this.singleLetters=new FL("(\\p{Lu}|\\p{N})(\\p{Lu}\\p{Ll})","gmu")}static{this.underscoreBoundary=new FL("(\\S)(_)(\\S)","gm")}constructor(){super({id:"editor.action.transformToKebabcase",label:L(1404,"Transform to Kebab Case"),precondition:ue.writable,canTriggerInlineEdits:!0})}_modifyText(i,e){let t=a.caseBoundary.get(),o=a.singleLetters.get(),n=a.underscoreBoundary.get();return!t||!o||!n?i:i.replace(n,"$1-$3").replace(t,"$1-$2").replace(o,"$1-$2").toLocaleLowerCase()}};Jt(rsi);Jt(ssi);Jt(asi);Jt(lsi);Jt(csi);Jt(dsi);Jt(usi);Jt(psi);Jt(w4e);Jt(hsi);Jt(gsi);Jt(fsi);Jt(C4e);Jt(yle);Jt(vsi);Jt(bsi);Jt(Ssi);Jt(Isi);Jt(ysi);Jt(wsi);Jt(msi);I4e.caseBoundary.isSupported()&&I4e.singleLetters.isSupported()&&Jt(I4e);y4e.singleLineWordBoundary.isSupported()&&y4e.multiLineWordBoundary.isSupported()&&Jt(y4e);_wt.wordBoundary.isSupported()&&Jt(_wt);Twt.titleBoundary.isSupported()&&Jt(Twt);Dwt.isSupported()&&Jt(Dwt);var O7=ae("dataChannelService");function Z8i(a){return a.sourceId+" @@ "+JSON.stringify({...a,modelUri:a.modelUri?.toString(),sourceId:void 0})}var F7=class extends C{constructor(e,t,o){super();this._key=e;this._contextKeyService=t;this._dataChannelService=o;this._isEnabledContextKeyValue=gVo("structuredLogger.enabled:"+this._key,this._contextKeyService).recomputeInitiallyAndOnChange(this._store),this.isEnabled=this._isEnabledContextKeyValue.map(n=>n!==void 0)}static cast(){return this}log(e){return this._isEnabledContextKeyValue.get()?(this._dataChannelService.getDataChannel("structuredLogger:"+this._key).sendData(e),!0):!1}};F7=I([m(1,X),m(2,O7)],F7);function gVo(a,i){return ui(i.onDidChangeContext,()=>i.getContextKeyValue(a))}var gCe=class extends C{constructor(e,t,o){super();this._editor=e;this._instantiationService=t;this._loggerService=o;this._structuredLogger=this._register(this._instantiationService.createInstance(F7.cast(),"editor.inlineSuggest.logChangeReason.commandId"));let n=this._loggerService?.createLogger("textModelChanges",{hidden:!1,name:"Text Model Changes Reason"}),r=ui(this,n.onDidChangeLogLevel,()=>n.getLevel());this._register(he(s=>{eSe(r.read(s),1)&&s.store.add(this._editor.onDidChangeModelContent(l=>{this._editor.getModel()?.uri.scheme!=="output"&&n.trace("onDidChangeModelContent: "+l.detailedReasons.map(c=>c.toKey(Number.MAX_VALUE)).join(", "))}))})),this._register(he(s=>{this._editor instanceof jr&&this._structuredLogger.isEnabled.read(s)&&s.store.add(this._editor.onDidChangeModelContent(l=>{let c=this._editor.getModel();if(!c)return;let u=l.detailedReasons[0],p={...u.metadata,sourceId:"TextModel.setChangeReason",source:u.metadata.source,time:Date.now(),modelUri:c.uri,modelVersion:c.getVersionId()};setTimeout(()=>{this._structuredLogger.log(p)},0)}))}))}};gCe=I([m(1,F),m(2,ol)],gCe);var eQi=Object.freeze({CURRENT_YEAR:!0,CURRENT_YEAR_SHORT:!0,CURRENT_MONTH:!0,CURRENT_DATE:!0,CURRENT_HOUR:!0,CURRENT_MINUTE:!0,CURRENT_SECOND:!0,CURRENT_DAY_NAME:!0,CURRENT_DAY_NAME_SHORT:!0,CURRENT_MONTH_NAME:!0,CURRENT_MONTH_NAME_SHORT:!0,CURRENT_SECONDS_UNIX:!0,CURRENT_TIMEZONE_OFFSET:!0,SELECTION:!0,CLIPBOARD:!0,TM_SELECTED_TEXT:!0,TM_CURRENT_LINE:!0,TM_CURRENT_WORD:!0,TM_LINE_INDEX:!0,TM_LINE_NUMBER:!0,TM_FILENAME:!0,TM_FILENAME_BASE:!0,TM_DIRECTORY:!0,TM_DIRECTORY_BASE:!0,TM_FILEPATH:!0,CURSOR_INDEX:!0,CURSOR_NUMBER:!0,RELATIVE_FILEPATH:!0,BLOCK_COMMENT_START:!0,BLOCK_COMMENT_END:!0,LINE_COMMENT:!0,WORKSPACE_NAME:!0,WORKSPACE_FOLDER:!0,RANDOM:!0,RANDOM_HEX:!0,UUID:!0}),x4e=class{constructor(i){this._delegates=i}resolve(i){for(let e of this._delegates){let t=e.resolve(i);if(t!==void 0)return t}}},k4e=class{constructor(i,e,t,o){this._model=i;this._selection=e;this._selectionIdx=t;this._overtypingCapturer=o}resolve(i){let{name:e}=i;if(e==="SELECTION"||e==="TM_SELECTED_TEXT"){let t=this._model.getValueInRange(this._selection)||void 0,o=this._selection.startLineNumber!==this._selection.endLineNumber;if(!t&&this._overtypingCapturer){let n=this._overtypingCapturer.getLastOvertypedInfo(this._selectionIdx);n&&(t=n.value,o=n.multiline)}if(t&&o&&i.snippet){let n=this._model.getLineContent(this._selection.startLineNumber),r=bl(n,0,this._selection.startColumn-1),s=r;i.snippet.walk(c=>c===i?!1:(c instanceof Qb&&(s=bl(mc(c.value).pop())),!0));let l=Ng(s,r);t=t.replace(/(\r\n|\r|\n)(.*)/g,(c,u,p)=>`${u}${s.substr(l)}${p}`)}return t}else{if(e==="TM_CURRENT_LINE")return this._model.getLineContent(this._selection.positionLineNumber);if(e==="TM_CURRENT_WORD"){let t=this._model.getWordAtPosition({lineNumber:this._selection.positionLineNumber,column:this._selection.positionColumn});return t&&t.word||void 0}else{if(e==="TM_LINE_INDEX")return String(this._selection.positionLineNumber-1);if(e==="TM_LINE_NUMBER")return String(this._selection.positionLineNumber);if(e==="CURSOR_INDEX")return String(this._selectionIdx);if(e==="CURSOR_NUMBER")return String(this._selectionIdx+1)}}}},E4e=class{constructor(i,e){this._labelService=i;this._model=e}resolve(i){let{name:e}=i;if(e==="TM_FILENAME")return No(this._model.uri.fsPath);if(e==="TM_FILENAME_BASE"){let t=No(this._model.uri.fsPath),o=t.lastIndexOf(".");return o<=0?t:t.slice(0,o)}else{if(e==="TM_DIRECTORY")return wc(this._model.uri.fsPath)==="."?"":this._labelService.getUriLabel(ci(this._model.uri));if(e==="TM_DIRECTORY_BASE")return wc(this._model.uri.fsPath)==="."?"":No(wc(this._model.uri.fsPath));if(e==="TM_FILEPATH")return this._labelService.getUriLabel(this._model.uri);if(e==="RELATIVE_FILEPATH")return this._labelService.getUriLabel(this._model.uri,{relative:!0,noPrefix:!0})}}},T4e=class{constructor(i,e,t,o){this._readClipboardText=i;this._selectionIdx=e;this._selectionCount=t;this._spread=o}resolve(i){if(i.name!=="CLIPBOARD")return;let e=this._readClipboardText();if(e){if(this._spread){let t=e.split(/\r\n|\n|\r/).filter(o=>!Jl(o));if(t.length===this._selectionCount)return t[this._selectionIdx]}return e}}},wle=class{constructor(i,e,t){this._model=i;this._selection=e;this._languageConfigurationService=t}resolve(i){let{name:e}=i,t=this._model.getLanguageIdAtPosition(this._selection.selectionStartLineNumber,this._selection.selectionStartColumn),o=this._languageConfigurationService.getLanguageConfiguration(t).comments;if(o){if(e==="LINE_COMMENT")return o.lineCommentToken||void 0;if(e==="BLOCK_COMMENT_START")return o.blockCommentStartToken||void 0;if(e==="BLOCK_COMMENT_END")return o.blockCommentEndToken||void 0}}};wle=I([m(2,bs)],wle);var _4e=class a{constructor(){this._date=new Date}static{this.dayNames=[d(1594,null),d(1584,null),d(1598,null),d(1600,null),d(1596,null),d(1572,null),d(1590,null)]}static{this.dayNamesShort=[d(1595,null),d(1585,null),d(1599,null),d(1601,null),d(1597,null),d(1573,null),d(1591,null)]}static{this.monthNames=[d(1574,null),d(1570,null),d(1580,null),d(1564,null),d(1582,null),d(1578,null),d(1576,null),d(1566,null),d(1592,null),d(1588,null),d(1586,null),d(1568,null)]}static{this.monthNamesShort=[d(1575,null),d(1571,null),d(1581,null),d(1565,null),d(1583,null),d(1579,null),d(1577,null),d(1567,null),d(1593,null),d(1589,null),d(1587,null),d(1569,null)]}resolve(i){let{name:e}=i;if(e==="CURRENT_YEAR")return String(this._date.getFullYear());if(e==="CURRENT_YEAR_SHORT")return String(this._date.getFullYear()).slice(-2);if(e==="CURRENT_MONTH")return String(this._date.getMonth().valueOf()+1).padStart(2,"0");if(e==="CURRENT_DATE")return String(this._date.getDate().valueOf()).padStart(2,"0");if(e==="CURRENT_HOUR")return String(this._date.getHours().valueOf()).padStart(2,"0");if(e==="CURRENT_MINUTE")return String(this._date.getMinutes().valueOf()).padStart(2,"0");if(e==="CURRENT_SECOND")return String(this._date.getSeconds().valueOf()).padStart(2,"0");if(e==="CURRENT_DAY_NAME")return a.dayNames[this._date.getDay()];if(e==="CURRENT_DAY_NAME_SHORT")return a.dayNamesShort[this._date.getDay()];if(e==="CURRENT_MONTH_NAME")return a.monthNames[this._date.getMonth()];if(e==="CURRENT_MONTH_NAME_SHORT")return a.monthNamesShort[this._date.getMonth()];if(e==="CURRENT_SECONDS_UNIX")return String(Math.floor(this._date.getTime()/1e3));if(e==="CURRENT_TIMEZONE_OFFSET"){let t=this._date.getTimezoneOffset(),o=t>0?"-":"+",n=Math.trunc(Math.abs(t/60)),r=n<10?"0"+n:n,s=Math.abs(t)-n*60,l=s<10?"0"+s:s;return o+r+":"+l}}},D4e=class{constructor(i){this._workspaceService=i}resolve(i){if(!this._workspaceService)return;let e=VS(this._workspaceService.getWorkspace());if(!Eq(e)){if(i.name==="WORKSPACE_NAME")return this._resolveWorkspaceName(e);if(i.name==="WORKSPACE_FOLDER")return this._resoveWorkspacePath(e)}}_resolveWorkspaceName(i){if($g(i))return No(i.uri.path);let e=No(i.configPath.path);return e.endsWith(JN)&&(e=e.substr(0,e.length-JN.length-1)),e}_resoveWorkspacePath(i){if($g(i))return Hp(i.uri.fsPath);let e=No(i.configPath.path),t=i.configPath.fsPath;return t.endsWith(e)&&(t=t.substr(0,t.length-e.length-1)),t?Hp(t):"/"}},L4e=class{resolve(i){let{name:e}=i;if(e==="RANDOM")return Math.random().toString().slice(-6);if(e==="RANDOM_HEX")return Math.random().toString(16).slice(-6);if(e==="UUID")return _t()}};var Lwt=class a{constructor(i,e,t){this._editor=i;this._snippet=e;this._snippetLineLeadingWhitespace=t;this._offset=-1;this._nestingLevel=1;this._placeholderGroups=Pg(e.placeholders,Tx.compareByIndex),this._placeholderGroupsIdx=-1}static{this._decor={active:po.register({description:"snippet-placeholder-1",stickiness:0,className:"snippet-placeholder"}),inactive:po.register({description:"snippet-placeholder-2",stickiness:1,className:"snippet-placeholder"}),activeFinal:po.register({description:"snippet-placeholder-3",stickiness:1,className:"finish-snippet-placeholder"}),inactiveFinal:po.register({description:"snippet-placeholder-4",stickiness:1,className:"finish-snippet-placeholder"})}}initialize(i){this._offset=i.newPosition}dispose(){this._placeholderDecorations&&this._editor.removeDecorations([...this._placeholderDecorations.values()]),this._placeholderGroups.length=0}_initDecorations(){if(this._offset===-1)throw new Error("Snippet not initialized!");if(this._placeholderDecorations)return;this._placeholderDecorations=new Map;let i=this._editor.getModel();this._editor.changeDecorations(e=>{for(let t of this._snippet.placeholders){let o=this._snippet.offset(t),n=this._snippet.fullLen(t),r=z.fromPositions(i.getPositionAt(this._offset+o),i.getPositionAt(this._offset+o+n)),s=t.isFinalTabstop?a._decor.inactiveFinal:a._decor.inactive,l=e.addDecoration(r,s);this._placeholderDecorations.set(t,l)}})}move(i){if(!this._editor.hasModel())return[];if(this._initDecorations(),this._placeholderGroupsIdx>=0){let o=[];for(let n of this._placeholderGroups[this._placeholderGroupsIdx])if(n.transform){let r=this._placeholderDecorations.get(n),s=this._editor.getModel().getDecorationRange(r),l=this._editor.getModel().getValueInRange(s),c=n.transform.resolve(l).split(/\r\n|\r|\n/);for(let u=1;u<c.length;u++)c[u]=this._editor.getModel().normalizeIndentation(this._snippetLineLeadingWhitespace+c[u]);o.push(An.replace(s,c.join(this._editor.getModel().getEOL())))}o.length>0&&this._editor.executeEdits("snippet.placeholderTransform",o)}let e=!1;i===!0&&this._placeholderGroupsIdx<this._placeholderGroups.length-1?(this._placeholderGroupsIdx+=1,e=!0):i===!1&&this._placeholderGroupsIdx>0&&(this._placeholderGroupsIdx-=1,e=!0);let t=this._editor.getModel().changeDecorations(o=>{let n=new Set,r=[];for(let s of this._placeholderGroups[this._placeholderGroupsIdx]){let l=this._placeholderDecorations.get(s),c=this._editor.getModel().getDecorationRange(l);r.push(new Yt(c.startLineNumber,c.startColumn,c.endLineNumber,c.endColumn)),e=e&&this._hasPlaceholderBeenCollapsed(s),o.changeDecorationOptions(l,s.isFinalTabstop?a._decor.activeFinal:a._decor.active),n.add(s);for(let u of this._snippet.enclosingPlaceholders(s)){let p=this._placeholderDecorations.get(u);o.changeDecorationOptions(p,u.isFinalTabstop?a._decor.activeFinal:a._decor.active),n.add(u)}}for(let[s,l]of this._placeholderDecorations)n.has(s)||o.changeDecorationOptions(l,s.isFinalTabstop?a._decor.inactiveFinal:a._decor.inactive);return r});return e?this.move(i):t??[]}_hasPlaceholderBeenCollapsed(i){let e=i;for(;e;){if(e instanceof Tx){let t=this._placeholderDecorations.get(e);if(this._editor.getModel().getDecorationRange(t).isEmpty()&&e.toString().length>0)return!0}e=e.parent}return!1}get isAtFirstPlaceholder(){return this._placeholderGroupsIdx<=0||this._placeholderGroups.length===0}get isAtLastPlaceholder(){return this._placeholderGroupsIdx===this._placeholderGroups.length-1}get hasPlaceholder(){return this._snippet.placeholders.length>0}get isTrivialSnippet(){if(this._snippet.placeholders.length===0)return!0;if(this._snippet.placeholders.length===1){let[i]=this._snippet.placeholders;if(i.isFinalTabstop&&this._snippet.rightMostDescendant===i)return!0}return!1}computePossibleSelections(){let i=new Map;for(let e of this._placeholderGroups){let t;for(let o of e){if(o.isFinalTabstop)break;t||(t=[],i.set(o.index,t));let n=this._placeholderDecorations.get(o),r=this._editor.getModel().getDecorationRange(n);if(!r){i.delete(o.index);break}t.push(r)}}return i}get activeChoice(){if(!this._placeholderDecorations)return;let i=this._placeholderGroups[this._placeholderGroupsIdx][0];if(!i?.choice)return;let e=this._placeholderDecorations.get(i);if(!e)return;let t=this._editor.getModel().getDecorationRange(e);if(t)return{range:t,choice:i.choice}}get hasChoice(){let i=!1;return this._snippet.walk(e=>(i=e instanceof Fae,!i)),i}merge(i){let e=this._editor.getModel();this._nestingLevel*=10,this._editor.changeDecorations(t=>{for(let o of this._placeholderGroups[this._placeholderGroupsIdx]){let n=i.shift();console.assert(n._offset!==-1),console.assert(!n._placeholderDecorations);let r=n._snippet.placeholderInfo.last.index;for(let l of n._snippet.placeholderInfo.all)l.isFinalTabstop?l.index=o.index+(r+1)/this._nestingLevel:l.index=o.index+l.index/this._nestingLevel;this._snippet.replace(o,n._snippet.children);let s=this._placeholderDecorations.get(o);t.removeDecoration(s),this._placeholderDecorations.delete(o);for(let l of n._snippet.placeholders){let c=n._snippet.offset(l),u=n._snippet.fullLen(l),p=z.fromPositions(e.getPositionAt(n._offset+c),e.getPositionAt(n._offset+c+u)),h=t.addDecoration(p,a._decor.inactive);this._placeholderDecorations.set(l,h)}}this._placeholderGroups=Pg(this._snippet.placeholders,Tx.compareByIndex)})}getEnclosingRange(){let i,e=this._editor.getModel();for(let t of this._placeholderDecorations.values()){let o=e.getDecorationRange(t)??void 0;i?i=i.plusRange(o):i=o}return i}},tQi={overwriteBefore:0,overwriteAfter:0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0},aC=class{constructor(i,e,t=tQi,o){this._editor=i;this._template=e;this._options=t;this._languageConfigurationService=o;this._templateMerges=[];this._snippets=[]}static adjustWhitespace(i,e,t,o,n){let r=i.getLineContent(e.lineNumber),s=bl(r,0,e.column-1),l;return o.walk(c=>{if(!(c instanceof Qb)||c.parent instanceof Fae||n&&!n.has(c))return!0;let u=c.value.split(/\r\n|\r|\n/);if(t){let h=o.offset(c);if(h===0)u[0]=i.normalizeIndentation(u[0]);else{l=l??o.toString();let g=l.charCodeAt(h-1);(g===10||g===13)&&(u[0]=i.normalizeIndentation(s+u[0]))}for(let g=1;g<u.length;g++)u[g]=i.normalizeIndentation(s+u[g])}let p=u.join(i.getEOL());return p!==c.value&&(c.parent.replace(c,[new Qb(p)]),l=void 0),!0}),s}static adjustSelection(i,e,t,o){if(t!==0||o!==0){let{positionLineNumber:n,positionColumn:r}=e,s=r-t,l=r+o,c=i.validateRange({startLineNumber:n,startColumn:s,endLineNumber:n,endColumn:l});e=Yt.createWithDirection(c.startLineNumber,c.startColumn,c.endLineNumber,c.endColumn,e.getDirection())}return e}static createEditsAndSnippetsFromSelections(i,e,t,o,n,r,s,l,c){let u=[],p=[];if(!i.hasModel())return{edits:u,snippets:p};let h=i.getModel(),g=i.invokeWithinContext(k=>k.get(Pe)),f=i.invokeWithinContext(k=>new E4e(k.get(ot),h)),v=()=>s,b=h.getValueInRange(aC.adjustSelection(h,i.getSelection(),t,0)),S=h.getValueInRange(aC.adjustSelection(h,i.getSelection(),0,o)),y=h.getLineFirstNonWhitespaceColumn(i.getSelection().positionLineNumber),w=i.getSelections().map((k,T)=>({selection:k,idx:T})).sort((k,T)=>z.compareRangesUsingStarts(k.selection,T.selection));for(let{selection:k,idx:T}of w){let N=aC.adjustSelection(h,k,t,0),O=aC.adjustSelection(h,k,0,o);b!==h.getValueInRange(N)&&(N=k),S!==h.getValueInRange(O)&&(O=k);let V=k.setStartPosition(N.startLineNumber,N.startColumn).setEndPosition(O.endLineNumber,O.endColumn),U=new zh().parse(e,!0,n),G=V.getStartPosition(),$=aC.adjustWhitespace(h,G,r||T>0&&y!==h.getLineFirstNonWhitespaceColumn(k.positionLineNumber),U);U.resolveVariables(new x4e([f,new T4e(v,T,w.length,i.getOption(88)==="spread"),new k4e(h,k,T,l),new wle(h,k,c),new _4e,new D4e(g),new L4e])),u[T]=An.replace(V,U.toString()),u[T].identifier={major:T,minor:0},u[T]._isTracked=!0,p[T]=new Lwt(i,U,$)}return{edits:u,snippets:p}}static createEditsAndSnippetsFromEdits(i,e,t,o,n,r,s){if(!i.hasModel()||e.length===0)return{edits:[],snippets:[]};let l=[],c=i.getModel(),u=new zh,p=new gwe,h=new x4e([i.invokeWithinContext(f=>new E4e(f.get(ot),c)),new T4e(()=>n,0,i.getSelections().length,i.getOption(88)==="spread"),new k4e(c,i.getSelection(),0,r),new wle(c,i.getSelection(),s),new _4e,new D4e(i.invokeWithinContext(f=>f.get(Pe))),new L4e]);e=e.sort((f,v)=>z.compareRangesUsingStarts(f.range,v.range));let g=0;for(let f=0;f<e.length;f++){let{range:v,template:b,keepWhitespace:S}=e[f];if(f>0){let N=e[f-1].range,O=z.fromPositions(N.getEndPosition(),v.getStartPosition()),V=new Qb(c.getValueInRange(O));p.appendChild(V),g+=V.value.length}let y=u.parseFragment(b,p);aC.adjustWhitespace(c,v.getStartPosition(),S!==void 0?!S:o,p,new Set(y)),p.resolveVariables(h);let w=p.toString(),k=w.slice(g);g=w.length;let T=An.replace(v,k);T.identifier={major:f,minor:0},T._isTracked=!0,l.push(T)}return u.ensureFinalTabstop(p,t,!0),{edits:l,snippets:[new Lwt(i,p,"")]}}dispose(){Ue(this._snippets)}_logInfo(){return`template="${this._template}", merged_templates="${this._templateMerges.join(" -> ")}"`}insert(i){if(!this._editor.hasModel())return;let{edits:e,snippets:t}=typeof this._template=="string"?aC.createEditsAndSnippetsFromSelections(this._editor,this._template,this._options.overwriteBefore,this._options.overwriteAfter,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService):aC.createEditsAndSnippetsFromEdits(this._editor,this._template,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService);this._snippets=t,this._editor.executeEdits(i??_c.snippet(),e,o=>{let n=o.filter(r=>!!r.identifier);for(let r=0;r<t.length;r++)t[r].initialize(n[r].textChange);return this._snippets[0].hasPlaceholder?this._move(!0):n.map(r=>Yt.fromPositions(r.range.getEndPosition()))}),this._editor.revealRange(this._editor.getSelections()[0])}merge(i,e=tQi){if(!this._editor.hasModel())return;this._templateMerges.push([this._snippets[0]._nestingLevel,this._snippets[0]._placeholderGroupsIdx,i]);let{edits:t,snippets:o}=aC.createEditsAndSnippetsFromSelections(this._editor,i,e.overwriteBefore,e.overwriteAfter,!0,e.adjustWhitespace,e.clipboardText,e.overtypingCapturer,this._languageConfigurationService);this._editor.executeEdits("snippet",t,n=>{let r=n.filter(l=>!!l.identifier);for(let l=0;l<o.length;l++)o[l].initialize(r[l].textChange);let s=o[0].isTrivialSnippet;if(!s){for(let l of this._snippets)l.merge(o);console.assert(o.length===0)}return this._snippets[0].hasPlaceholder&&!s?this._move(void 0):r.map(l=>Yt.fromPositions(l.range.getEndPosition()))})}next(){let i=this._move(!0);this._editor.setSelections(i),this._editor.revealPositionInCenterIfOutsideViewport(i[0].getPosition())}prev(){let i=this._move(!1);this._editor.setSelections(i),this._editor.revealPositionInCenterIfOutsideViewport(i[0].getPosition())}_move(i){let e=[];for(let t of this._snippets){let o=t.move(i);e.push(...o)}return e}get isAtFirstPlaceholder(){return this._snippets[0].isAtFirstPlaceholder}get isAtLastPlaceholder(){return this._snippets[0].isAtLastPlaceholder}get hasPlaceholder(){return this._snippets[0].hasPlaceholder}get hasChoice(){return this._snippets[0].hasChoice}get activeChoice(){return this._snippets[0].activeChoice}isSelectionWithinPlaceholders(){if(!this.hasPlaceholder)return!1;let i=this._editor.getSelections();if(i.length<this._snippets.length)return!1;let e=new Map;for(let t of this._snippets){let o=t.computePossibleSelections();if(e.size===0)for(let[n,r]of o){r.sort(z.compareRangesUsingStarts);for(let s of i)if(r[0].containsRange(s)){e.set(n,[]);break}}if(e.size===0)return!1;e.forEach((n,r)=>{n.push(...o.get(r))})}i.sort(z.compareRangesUsingStarts);for(let[t,o]of e){if(o.length!==i.length){e.delete(t);continue}o.sort(z.compareRangesUsingStarts);for(let n=0;n<o.length;n++)if(!o[n].containsRange(i[n])){e.delete(t);continue}}return e.size>0}getEnclosingRange(){let i;for(let e of this._snippets){let t=e.getEnclosingRange();i?i=i.plusRange(t):i=t}return i}};aC=I([m(3,bs)],aC);var Rwt={overwriteBefore:0,overwriteAfter:0,undoStopBefore:!0,undoStopAfter:!0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0},Qr=class{constructor(i,e,t,o,n){this._editor=i;this._logService=e;this._languageFeaturesService=t;this._languageConfigurationService=n;this._inSnippetObservable=Le(this,!1);this._snippetListener=new P;this._modelVersionId=-1;this._inSnippet=Qr.InSnippetMode.bindTo(o),this._hasNextTabstop=Qr.HasNextTabstop.bindTo(o),this._hasPrevTabstop=Qr.HasPrevTabstop.bindTo(o)}static{this.ID="snippetController2"}static get(i){return i.getContribution(Qr.ID)}static{this.InSnippetMode=new Q("inSnippetMode",!1,d(1562,null))}static{this.HasNextTabstop=new Q("hasNextTabstop",!1,d(1560,null))}static{this.HasPrevTabstop=new Q("hasPrevTabstop",!1,d(1561,null))}dispose(){this._inSnippet.reset(),this._inSnippetObservable.set(!1,void 0),this._hasPrevTabstop.reset(),this._hasNextTabstop.reset(),this._session?.dispose(),this._snippetListener.dispose()}apply(i,e){try{this._doInsert(i,typeof e>"u"?Rwt:{...Rwt,...e})}catch(t){this.cancel(),this._logService.error(t),this._logService.error("snippet_error"),this._logService.error("insert_edits=",i),this._logService.error("existing_template=",this._session?this._session._logInfo():"<no_session>")}}insert(i,e){try{this._doInsert(i,typeof e>"u"?Rwt:{...Rwt,...e})}catch(t){this.cancel(),this._logService.error(t),this._logService.error("snippet_error"),this._logService.error("insert_template=",i),this._logService.error("existing_template=",this._session?this._session._logInfo():"<no_session>")}}_doInsert(i,e){if(this._editor.hasModel()){if(this._snippetListener.clear(),e.undoStopBefore&&this._editor.getModel().pushStackElement(),this._session&&typeof i!="string"&&this.cancel(),this._session?(So(typeof i=="string"),this._session.merge(i,e)):(this._modelVersionId=this._editor.getModel().getAlternativeVersionId(),this._session=new aC(this._editor,i,e,this._languageConfigurationService),this._session.insert(e.reason)),e.undoStopAfter&&this._editor.getModel().pushStackElement(),this._session?.hasChoice){let t={_debugDisplayName:"snippetChoiceCompletions",provideCompletionItems:(c,u)=>{if(!this._session||c!==this._editor.getModel()||!Ie.equals(this._editor.getPosition(),u))return;let{activeChoice:p}=this._session;if(!p||p.choice.options.length===0)return;let h=c.getValueInRange(p.range),g=!!p.choice.options.find(v=>v.value===h),f=[];for(let v=0;v<p.choice.options.length;v++){let b=p.choice.options[v];f.push({kind:13,label:b.value,insertText:b.value,sortText:"a".repeat(v+1),range:p.range,filterText:g?`${h}_${b.value}`:void 0,command:{id:"jumpToNextSnippetPlaceholder",title:d(1563,null)}})}return{suggestions:f}}},o=this._editor.getModel(),n,r=!1,s=()=>{n?.dispose(),r=!1},l=()=>{r||(n=this._languageFeaturesService.completionProvider.register({language:o.getLanguageId(),pattern:o.uri.fsPath,scheme:o.uri.scheme,exclusive:!0},t),this._snippetListener.add(n),r=!0)};this._choiceCompletions={provider:t,enable:l,disable:s}}this._updateState(),this._snippetListener.add(this._editor.onDidChangeModelContent(t=>t.isFlush&&this.cancel())),this._snippetListener.add(this._editor.onDidChangeModel(()=>this.cancel())),this._snippetListener.add(this._editor.onDidChangeCursorSelection(()=>this._updateState()))}}_updateState(){if(!(!this._session||!this._editor.hasModel())){if(this._modelVersionId===this._editor.getModel().getAlternativeVersionId())return this.cancel();if(!this._session.hasPlaceholder)return this.cancel();if(this._session.isAtLastPlaceholder||!this._session.isSelectionWithinPlaceholders())return this._editor.getModel().pushStackElement(),this.cancel();this._inSnippet.set(!0),this._inSnippetObservable.set(!0,void 0),this._hasPrevTabstop.set(!this._session.isAtFirstPlaceholder),this._hasNextTabstop.set(!this._session.isAtLastPlaceholder),this._handleChoice()}}_handleChoice(){if(!this._session||!this._editor.hasModel()){this._currentChoice=void 0;return}let{activeChoice:i}=this._session;if(!i||!this._choiceCompletions){this._choiceCompletions?.disable(),this._currentChoice=void 0;return}this._currentChoice!==i.choice&&(this._currentChoice=i.choice,this._choiceCompletions.enable(),queueMicrotask(()=>{ywt(this._editor,this._choiceCompletions.provider)}))}finish(){for(;this._inSnippet.get();)this.next()}cancel(i=!1){this._inSnippet.reset(),this._inSnippetObservable.set(!1,void 0),this._hasPrevTabstop.reset(),this._hasNextTabstop.reset(),this._snippetListener.clear(),this._currentChoice=void 0,this._session?.dispose(),this._session=void 0,this._modelVersionId=-1,i&&this._editor.setSelections([this._editor.getSelection()])}prev(){this._session?.prev(),this._updateState()}next(){this._session?.next(),this._updateState()}isInSnippet(){return!!this._inSnippet.get()}get isInSnippetObservable(){return this._inSnippetObservable}getSessionEnclosingRange(){if(this._session)return this._session.getEnclosingRange()}};Qr=I([m(1,ne),m(2,zt),m(3,X),m(4,bs)],Qr);go(Qr.ID,Qr,4);var Mwt=xc.bindToContribution(Qr.get);qi(new Mwt({id:"jumpToNextSnippetPlaceholder",precondition:x.and(Qr.InSnippetMode,Qr.HasNextTabstop),handler:a=>a.next(),kbOpts:{weight:130,kbExpr:ue.textInputFocus,primary:2}}));qi(new Mwt({id:"jumpToPrevSnippetPlaceholder",precondition:x.and(Qr.InSnippetMode,Qr.HasPrevTabstop),handler:a=>a.prev(),kbOpts:{weight:130,kbExpr:ue.textInputFocus,primary:1026}}));qi(new Mwt({id:"leaveSnippet",precondition:Qr.InSnippetMode,handler:a=>a.cancel(!0),kbOpts:{weight:130,kbExpr:ue.textInputFocus,primary:9,secondary:[1033]}}));qi(new Mwt({id:"acceptSnippet",precondition:Qr.InSnippetMode,handler:a=>a.finish()}));function Cle(a){return new Csi(a)}var Csi=class extends RSe{constructor(e){super();this._textModel=e}getOffset(e){return this._textModel.getOffsetAt(e)}getPosition(e){return this._textModel.getPositionAt(e)}};var fVo=[];function iQi(){return fVo}function xsi(a){return vVo(a).map(e=>e.getEndPosition())}function vVo(a){let i=Aut.createSortPermutation(a,tl(o=>o.range,z.compareRangesUsingStarts)),t=new bp(i.apply(a)).getNewRanges();return i.inverse().apply(t)}function oQi(a,i){let e=Cle(i),t=i.getValue();return a.map(r=>e.getStringReplacement(r)).map(r=>r.removeCommonSuffixPrefix(t)).map(r=>e.getTextReplacement(r))}function nQi(a,i){let e=Le("result",[]),t=[];return i.add(he(o=>{let n=a.read(o);Ui(r=>{if(n.length!==t.length){t.length=n.length;for(let s=0;s<t.length;s++)t[s]||(t[s]=Le("item",n[s]));e.set([...t],r)}t.forEach((s,l)=>s.set(n[l],r))})})),e}var Pwt=class{constructor(i){this._contextKeyService=i}bind(i,e){return tc(i,this._contextKeyService,e instanceof Function?e:t=>e.read(t))}};function ksi(a,i){return new Promise(e=>{let t,o=setTimeout(()=>{t&&t.dispose(),e()},a);i&&(t=i.onCancellationRequested(()=>{clearTimeout(o),t&&t.dispose(),e()}))})}var R4e=class a{constructor(i,e=void 0){this.error=i;this.message=e}static message(i){return new a(void 0,i)}static is(i){return i instanceof a}logError(){this.message?console.error(`ErrorResult: ${this.message}`,this.error):console.error("ErrorResult: An unexpected error-case occurred, usually caused by invalid input.",this.error)}};var M4e=class a{constructor(i,e,t,o=bVo){this.startValue=i;this.endValue=e;this.durationMs=t;this._interpolationFunction=o;this.startTimeMs=Date.now();i===e&&(this.durationMs=0)}static const(i){return new a(i,i,0)}isFinished(){return Date.now()>=this.startTimeMs+this.durationMs}getValue(){let i=Date.now()-this.startTimeMs;return i>=this.durationMs?this.endValue:this._interpolationFunction(i,this.startValue,this.endValue-this.startValue,this.durationMs)}};function bVo(a,i,e,t){return a===t?i+e:e*(-Math.pow(2,-10*a/t)+1)+i}function rQi(a,i,e,t){return e*((a=a/t-1)*a*a+1)+i}var Awt=class a{static const(i){return new a(M4e.const(i))}constructor(i){this._value=Le(this,i)}setAnimation(i,e){this._value.set(i,e)}changeAnimation(i,e){let t=i(this._value.get());this._value.set(t,e)}getValue(i){let e=this._value.read(i);return e.isFinished()||P4e.instance.invalidateOnNextAnimationFrame(i),e.getValue()}},P4e=class a{constructor(){this._counter=Wc(this);this._isScheduled=!1}static{this.instance=new a}invalidateOnNextAnimationFrame(i){this._counter.read(i),this._isScheduled||(this._isScheduled=!0,Ki().requestAnimationFrame(()=>{this._isScheduled=!1,this._update()}))}_update(){this._counter.trigger(void 0)}};var $1=class{constructor(i,e){this.lineNumber=i;this.parts=e;eh(()=>Ty(e,(t,o)=>t.column<=o.column))}equals(i){return this.lineNumber===i.lineNumber&&this.parts.length===i.parts.length&&this.parts.every((e,t)=>e.equals(i.parts[t]))}render(i,e=!1){return new bp([...this.parts.map(t=>new Xr(z.fromPositions(new Ie(this.lineNumber,t.column)),e?`[${t.lines.map(o=>o.line).join(`
`)}]`:t.lines.map(o=>o.line).join(`
`)))]).applyToString(i)}renderForScreenReader(i){if(this.parts.length===0)return"";let e=this.parts[this.parts.length-1],t=i.substr(0,e.column-1);return new bp([...this.parts.map(n=>new Xr(z.fromPositions(new Ie(1,n.column)),n.lines.map(r=>r.line).join(`
`)))]).applyToString(t).substring(this.parts[0].column-1)}isEmpty(){return this.parts.every(i=>i.lines.length===0)}get lineCount(){return 1+this.parts.reduce((i,e)=>i+e.lines.length-1,0)}},W7=class{constructor(i,e,t,o=[]){this.column=i;this.text=e;this.preview=t;this._inlineDecorations=o;this.lines=mc(this.text).map((n,r)=>({line:n,lineDecorations:Jv.filter(this._inlineDecorations,r+1,1,n.length+1)}))}equals(i){return this.column===i.column&&this.lines.length===i.lines.length&&this.lines.every((e,t)=>e.line===i.lines[t].line&&Jv.equalsArr(e.lineDecorations,i.lines[t].lineDecorations))}},fCe=class{constructor(i,e,t,o=0){this.lineNumber=i;this.columnRange=e;this.text=t;this.additionalReservedLineCount=o;this.parts=[new W7(this.columnRange.endColumnExclusive,this.text,!1)],this.newLines=mc(this.text)}renderForScreenReader(i){return this.newLines.join(`
`)}render(i,e=!1){let t=this.columnRange.toRange(this.lineNumber);return e?new bp([new Xr(z.fromPositions(t.getStartPosition()),"("),new Xr(z.fromPositions(t.getEndPosition()),`)[${this.newLines.join(`
`)}]`)]).applyToString(i):new bp([new Xr(t,this.newLines.join(`
`))]).applyToString(i)}get lineCount(){return this.newLines.length}isEmpty(){return this.parts.every(i=>i.lines.length===0)}equals(i){return this.lineNumber===i.lineNumber&&this.columnRange.equals(i.columnRange)&&this.newLines.length===i.newLines.length&&this.newLines.every((e,t)=>e===i.newLines[t])&&this.additionalReservedLineCount===i.additionalReservedLineCount}};function Esi(a,i){return $i(a,i,Tsi)}function Tsi(a,i){return a===i?!0:!a||!i?!1:a instanceof $1&&i instanceof $1||a instanceof fCe&&i instanceof fCe?a.equals(i):!1}function XM(a,i,e){let t=e?a.range.intersectRanges(e):a.range;if(!t)return a;let o=a.text.replaceAll(`\r
`,`
`),n=i.getValueInRange(t,1),r=Ng(n,o),s=Zl.ofText(n.substring(0,r)).addToPosition(a.range.getStartPosition()),l=o.substring(r),c=z.fromPositions(s,a.range.getEndPosition());return new Xr(c,l)}function Nwt(a,i){return a.text.startsWith(i.text)&&SVo(a.range,i.range)}function SVo(a,i){return i.getStartPosition().equals(a.getStartPosition())&&i.getEndPosition().isBeforeOrEqual(a.getEndPosition())}function _si(a,i,e,t,o=0){let n=XM(a,i);if(n.range.endLineNumber!==n.range.startLineNumber)return;let r=i.getLineContent(n.range.startLineNumber),s=bl(r).length;if(n.range.startColumn-1<=s){let f=bl(n.text).length,v=r.substring(n.range.startColumn-1,s),[b,S]=[n.range.getStartPosition(),n.range.getEndPosition()],y=b.column+v.length<=S.column?b.delta(0,v.length):S,w=z.fromPositions(y,S),k=n.text.startsWith(v)?n.text.substring(v.length):n.text.substring(f);n=new Xr(w,k)}let c=i.getValueInRange(n.range),u=IVo(c,n.text);if(!u)return;let p=n.range.startLineNumber,h=new Array;if(e==="prefix"){let f=u.filter(v=>v.originalLength===0);if(f.length>1||f.length===1&&f[0].originalStart!==c.length)return}let g=n.text.length-o;for(let f of u){let v=n.range.startColumn+f.originalStart+f.originalLength;if(e==="subwordSmart"&&t&&t.lineNumber===n.range.startLineNumber&&v<t.column||f.originalLength>0)return;if(f.modifiedLength===0)continue;let b=f.modifiedStart+f.modifiedLength,S=Math.max(f.modifiedStart,Math.min(b,g)),y=n.text.substring(f.modifiedStart,S),w=n.text.substring(S,Math.max(f.modifiedStart,b));y.length>0&&h.push(new W7(v,y,!1)),w.length>0&&h.push(new W7(v,w,!0))}return new $1(p,h)}var Owt;function IVo(a,i){if(Owt?.originalValue===a&&Owt?.newValue===i)return Owt?.changes;{let e=aQi(a,i,!0);if(e){let t=sQi(e);if(t>0){let o=aQi(a,i,!1);o&&sQi(o)<t&&(e=o)}}return Owt={originalValue:a,newValue:i,changes:e},e}}function sQi(a){let i=0;for(let e of a)i+=e.originalLength;return i}function aQi(a,i,e){if(a.length>5e3||i.length>5e3)return;function t(c){let u=0;for(let p=0,h=c.length;p<h;p++){let g=c.charCodeAt(p);g>u&&(u=g)}return u}let o=Math.max(t(a),t(i));function n(c){if(c<0)throw new Error("unexpected");return o+c+1}function r(c){let u=0,p=0,h=new Int32Array(c.length);for(let g=0,f=c.length;g<f;g++)if(e&&c[g]==="("){let v=p*100+u;h[g]=n(2*v),u++}else if(e&&c[g]===")"){u=Math.max(u-1,0);let v=p*100+u;h[g]=n(2*v+1),u===0&&p++}else h[g]=c.charCodeAt(g);return h}let s=r(a),l=r(i);return new MM({getElements:()=>s},{getElements:()=>l}).ComputeDiff(!1).changes}function lQi(a,i){let e,t=!1,o=new Bbe(new Pu(a,void 0,i.update),(n,r)=>{t||(e=i.initial instanceof Function?i.initial():i.initial,t=!0);let s=i.update(n,e,r);return e=s,s},i.changeTracker,()=>{t&&(i.disposeFinal?.(e),t=!1)},i.equalityComparer??hf,(n,r,s)=>{if(!t)throw new ni("Can only set when there is a listener! This is to prevent leaks.");dN(r,l=>{e=n,o.setValue(n,l,s)})},Il.ofCaller());return o}var Dsi=class{constructor(i,e){this._baseService=i;this._intercept=e}get telemetryLevel(){return this._baseService.telemetryLevel}get sessionId(){return this._baseService.sessionId}get machineId(){return this._baseService.machineId}get sqmId(){return this._baseService.sqmId}get devDeviceId(){return this._baseService.devDeviceId}get firstSessionDate(){return this._baseService.firstSessionDate}get msftInternal(){return this._baseService.msftInternal}get sendErrorTelemetry(){return this._baseService.sendErrorTelemetry}publicLog(i,e){this._intercept(i,e),this._baseService.publicLog(i,e)}publicLog2(i,e){this._intercept(i,e),this._baseService.publicLog2(i,e)}publicLogError(i,e){this._intercept(i,e),this._baseService.publicLogError(i,e)}publicLogError2(i,e){this._intercept(i,e),this._baseService.publicLogError2(i,e)}setExperimentProperty(i,e){this._baseService.setExperimentProperty(i,e)}},vO=class extends Dsi{constructor(i,e){super(i,(t,o)=>{let n=!0;o&&Lsi in o&&(n=!!o[Lsi]),n&&e.getDataChannel("editTelemetry").sendData({eventName:t,data:o??{}})})}};vO=I([m(0,Te),m(1,O7)],vO);var Lsi=Symbol("shouldForwardToChannel");function q1(a){return{[Lsi]:a}}function VW(a){if(!a)return!1;let i=a.toLowerCase();return i==="github.copilot"||i==="github.copilot-chat"}function Fwt(a,i){a.publicLog2("inlineCompletion.endOfLife",i)}var yVo=new Set([";",",","=","+","-","*","/","{","}","(",")","[","]","<",">",":",".","!","?","&","|","^","%","@","#","~","`","\\","'",'"',"$"]);function wVo(a){return yVo.has(a)}function CVo(a){return/[a-zA-Z0-9_]/.test(a)}function xVo(a){return a===" "||a===" "}function Wwt(a){let i=a.split(/\r\n|\r|\n/);if(i.length>1)return{kind:"multiLine",lineCount:i.length};let e=a.length===1,t;e&&(wVo(a)?t="syntactical":CVo(a)?t="identifier":xVo(a)&&(t="whitespace"));let o=a.match(/[ \t]+/g)||[],n=o.some(u=>u.length>1),r=o.some(u=>u.includes(" ")||u.includes(" ")),s=a.split(/\s+/).filter(u=>u.length>0),l=s.length===1&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s[0]),c=s.length>1;return{kind:"singleLine",isSingleCharacter:e,singleCharacterKind:t,isWord:l,isMultipleWords:c,isMultipleWhitespace:n,hasDuplicatedWhitespace:r}}var Msi=class{constructor(i){this.edits=i}toString(){return JSON.stringify({edits:this.edits})}};function Psi(a,i,e){if(a.replacements.length!==0)return new Msi(a.replacements.map(t=>kVo(t,i,e)))}function Rsi(a){return a.length===0?0:a.split(/\r\n|\r|\n/).length-1}function kVo(a,i,e){let t=a.replaceRange,o=a.newText,n=t.length,r=o.length,s=Rsi(o);switch(t.isEmpty?"insert":o.length===0?"delete":"replace"){case"insert":return{operation:"insert",properties:EVo(t.start,o,i,e),charactersInserted:r,charactersDeleted:0,linesInserted:s,linesDeleted:0};case"delete":{let c=i.getValue().substring(t.start,t.endExclusive);return{operation:"delete",properties:TVo(t.start,t.endExclusive,i),charactersInserted:0,charactersDeleted:n,linesInserted:0,linesDeleted:Rsi(c)}}case"replace":{let c=i.getValue().substring(t.start,t.endExclusive);return{operation:"replace",properties:_Vo(c,o),charactersInserted:r,charactersDeleted:n,linesInserted:s,linesDeleted:Rsi(c)}}}}function EVo(a,i,e,t){let o=Wwt(i),n=e.getPositionAt(a),r=e.getLineContent(n.lineNumber),s=r.length,l,c=r.trim().length===0,u=n.column>s,p=n.column===1;c?l="emptyLine":u?l="endOfLine":p?l="startOfLine":l="middleOfLine";let h;if(t){let g=t.lineNumber,f=n.lineNumber,v=t.column,b=n.column,S=g===f&&v===b,y=g===f&&b<v,w=g===f&&b>v,k=f<g?g-f:void 0,T=f>g?f-g:void 0;h={atCursor:S,beforeCursorOnSameLine:y,afterCursorOnSameLine:w,linesAbove:k,linesBelow:T}}return{textShape:o,locationShape:l,relativeToCursor:h}}function TVo(a,i,e){let t=e.getValue().substring(a,i),o=Wwt(t),n=e.getPositionAt(a),r=e.getPositionAt(i),s=e.getLineContent(r.lineNumber),l=r.column>s.length,c=n.lineNumber===r.lineNumber&&n.column===1&&r.column>s.length;return{textShape:o,isAtEndOfLine:l,deletesEntireLineContent:c}}function _Vo(a,i){let e=Wwt(a),t=Wwt(i),o=e.kind==="singleLine"&&e.isWord,n=t.kind==="singleLine"&&t.isWord,r=o&&n,s=i.length>a.length,l=i.length<a.length,c=e.kind==="singleLine"&&t.kind==="singleLine",u=e.kind==="singleLine"&&t.kind==="multiLine",p=e.kind==="multiLine"&&t.kind==="singleLine";return{isWordToWordReplacement:r,isAdditive:s,isSubtractive:l,isSingleLineToSingleLine:c,isSingleLineToMultiLine:u,isMultiLineToSingleLine:p}}function Vwt(a,i,e,t){let o=XM(a,e),n=a.range;if(!n||i&&!i.getStartPosition().equals(n.getStartPosition())||t.lineNumber!==o.range.startLineNumber||o.isEmpty)return!1;let r=e.getValueInRange(o.range,1),s=o.text,l=Math.max(0,t.column-o.range.startColumn),c=s.substring(0,l),u=s.substring(l),p=r.substring(0,l),h=r.substring(l),g=e.getLineIndentColumn(o.range.startLineNumber);return o.range.startColumn<=g&&(p=p.trimStart(),p.length===0&&(h=h.trimStart()),c=c.trimStart(),c.length===0&&(u=u.trimStart())),c.startsWith(p)&&!!Xqe(h,u)}function cQi(a,i){let e=new cye,t=new uye(e,c=>i.getLanguageConfiguration(c)),o=new dye(new Asi([a]),t),n=kqe(o,[],void 0,!0),r="",s=a.getLineContent();function l(c,u){if(c.kind===2)if(l(c.openingBracket,u),u=Od(u,c.openingBracket.length),c.child&&(l(c.child,u),u=Od(u,c.child.length)),c.closingBracket)l(c.closingBracket,u),u=Od(u,c.closingBracket.length);else{let h=t.getSingleLanguageBracketTokens(c.openingBracket.languageId).findClosingTokenText(c.openingBracket.bracketIds);r+=h}else if(c.kind!==3){if(c.kind===0||c.kind===1)r+=s.substring(u,Od(u,c.length));else if(c.kind===4)for(let p of c.children)l(p,u),u=Od(u,p.length)}}return l(n,ib),r}var Asi=class{constructor(i){this.lines=i;this.tokenization={getLineTokens:i=>this.lines[i-1]}}getValue(){return this.lines.map(i=>i.getLineContent()).join(`
`)}getLineCount(){return this.lines.length}getLineLength(i){return this.lines[i-1].getLineContent().length}};var Bwt=class a{constructor(){this._nodes=new Set;this._outgoingEdges=new Map}static from(i,e){let t=new a;for(let o of i)t._nodes.add(o);for(let o of i){let n=e(o);if(n.length>0){let r=new Set;for(let s of n)r.add(s);t._outgoingEdges.set(o,r)}}return t}removeCycles(){let i=[],e=new Set,t=new Set,o=[],n=r=>{e.add(r),t.add(r);let s=this._outgoingEdges.get(r);if(s)for(let l of s)e.has(l)?t.has(l)&&(i.push(l),o.push({from:r,to:l})):n(l);t.delete(r)};for(let r of this._nodes)e.has(r)||n(r);for(let{from:r,to:s}of o){let l=this._outgoingEdges.get(r);l&&l.delete(s)}return{foundCycles:i}}getOutgoing(i){let e=this._outgoingEdges.get(i);return e?Array.from(e):[]}};var WL=class a{constructor(i,e=!1){this.event=i;this.alternativeAction=e}static create(i,e=!1){return new a(new yn(Me(i),i),e)}};var xle=class{constructor(i,e,t,o,n,r,s,l){this.cursorColumnDistance=i;this.cursorLineDistance=e;this.lineCountOriginal=t;this.lineCountModified=o;this.characterCountOriginal=n;this.characterCountModified=r;this.disjointReplacements=s;this.sameShapeReplacements=l;this.longDistanceHintVisible=void 0;this.longDistanceHintDistance=void 0}setLongDistanceViewData(i,e){this.longDistanceHintVisible=!0,this.longDistanceHintDistance=Math.abs(e-i)}getData(){return{cursorColumnDistance:this.cursorColumnDistance,cursorLineDistance:this.cursorLineDistance,lineCountOriginal:this.lineCountOriginal,lineCountModified:this.lineCountModified,characterCountOriginal:this.characterCountOriginal,characterCountModified:this.characterCountModified,disjointReplacements:this.disjointReplacements,sameShapeReplacements:this.sameShapeReplacements,longDistanceHintVisible:this.longDistanceHintVisible,longDistanceHintDistance:this.longDistanceHintDistance}}};function pQi(a,i,e,t,o,n){let r=zgt("icr"),s=new $e,l,c={...t,requestUuid:r},u=LVo(i,e),p=tUi(a,S=>S.groupId),h=Bwt.from(a,S=>S.yieldsToGroupIds?.flatMap(y=>p.get(y)??[])??[]),{foundCycles:g}=h.removeCycles();g.length>0&&ss(new Error(`Inline completions: cyclic yield-to dependency detected. Path: ${g.map(S=>S.toString?S.toString():""+S).join(" -> ")}`));let f=0,v=new kI(async S=>{try{if(f++,s.token.isCancellationRequested)return;let y=h.getOutgoing(S);for(let V of y){let U=await v.get(V);if(U)for(let G of U.inlineSuggestions.items){if(G.isInlineEdit||typeof G.insertText!="string"&&G.insertText!==void 0)return;if(G.insertText!==void 0){let $=new Xr(z.lift(G.range)??u,G.insertText);if(Vwt($,void 0,e,i))return}}}let w,k=Date.now();try{w=await S.provideInlineCompletions(e,i,c,s.token)}catch(V){ss(V);return}let T=Date.now();if(!w)return;let N=[],O=new Hwt(w,N,S);if(O.addRef(),Osi(s.token,()=>O.removeRef(l)),s.token.isCancellationRequested)return;for(let V of w.items){let U=DVo(V,O,u,e,n,c,o,{startTime:k,endTime:T});if(R4e.is(U)){U.logError();continue}N.push(U)}return O}finally{f--}}),b=Fp.fromPromisesResolveOrder(a.map(S=>v.get(S))).filter(mo);return{contextWithUuid:c,get didAllProvidersReturn(){return f===0},lists:b,cancelAndDispose:S=>{l===void 0&&(l=S,s.dispose(!0))}}}function Osi(a,i){if(a.isCancellationRequested)return i(),C.None;{let e=a.onCancellationRequested(()=>{e.dispose(),i()});return{dispose:()=>e.dispose()}}}function DVo(a,i,e,t,o,n,r,s){let l,c=a.uri?A.revive(a.uri):void 0;if(a.jumpToPosition!==void 0)l={kind:"jumpTo",position:Ie.lift(a.jumpToPosition),uri:c};else if(a.insertText!==void 0){let u,p,h=a.range?z.lift(a.range):e;if(typeof a.insertText=="string"){if(u=a.insertText,o&&a.completeBracketPairs){u=dQi(u,h.getStartPosition(),t,o);let g=u.length-a.insertText.length;g!==0&&(h=new z(h.startLineNumber,h.startColumn,h.endLineNumber,h.endColumn+g))}p=void 0}else if("snippet"in a.insertText){let g=a.insertText.snippet.length;if(o&&a.completeBracketPairs){a.insertText.snippet=dQi(a.insertText.snippet,h.getStartPosition(),t,o);let v=a.insertText.snippet.length-g;v!==0&&(h=new z(h.startLineNumber,h.startColumn,h.endLineNumber,h.endColumn+v))}let f=new zh().parse(a.insertText.snippet);f.children.length===1&&f.children[0]instanceof Qb?(u=f.children[0].value,p=void 0):(u=f.toString(),p={snippet:a.insertText.snippet,range:h})}else Hr(a.insertText);l={kind:"edit",range:h,insertText:u,snippetInfo:p,uri:c,alternativeAction:void 0}}else if(l=void 0,!a.hint)return R4e.message("Inline completion has no insertText, jumpToPosition nor hint.");return new A4e(l,a.hint,a.additionalTextEdits||iQi(),a,i,n,a.isInlineEdit??!1,a.supportsRename??!1,r,s,a.correlationId)}var A4e=class a{constructor(i,e,t,o,n,r,s,l,c,u,p){this._action=i;this.hint=e;this.additionalTextEdits=t;this.sourceInlineCompletion=o;this.source=n;this.context=r;this.isInlineEdit=s;this.supportsRename=l;this._requestInfo=c;this._providerRequestInfo=u;this._correlationId=p;this._didShow=!1;this._timeUntilShown=void 0;this._timeUntilActuallyShown=void 0;this._showStartTime=void 0;this._shownDuration=0;this._showUncollapsedStartTime=void 0;this._showUncollapsedDuration=0;this._notShownReason=void 0;this._didReportEndOfLife=!1;this._lastSetEndOfLifeReason=void 0;this._isPreceeded=!1;this._partiallyAcceptedCount=0;this._partiallyAcceptedSinceOriginal={characters:0,ratio:0,count:0};this._renameInfo=void 0;this._editKind=void 0;this.performance=new Nsi;this._viewData={editorType:c.editorType}}static createForTest(i,e){let t={insertText:i?.kind==="edit"?i.insertText:"",range:i?.kind==="edit"?i.range:void 0,isInlineEdit:!0},o={provideInlineCompletions:()=>({items:[]}),disposeInlineCompletions:()=>{}},n=new Hwt({items:[t]},[],o),r={triggerKind:1,selectedSuggestionInfo:void 0,requestUuid:"test-"+Date.now(),earliestShownDateTime:0,includeInlineCompletions:!0,includeInlineEdits:!1,requestIssuedDateTime:Date.now()},s={startTime:Date.now(),sku:void 0,editorType:"textEditor",languageId:"plaintext",availableProviders:[],reason:"",typingInterval:0,typingIntervalCharacterCount:0},l={startTime:Date.now(),endTime:Date.now()};return new a(i,void 0,[],t,n,r,!0,!1,s,l,void 0)}get action(){return this._action}get showInlineEditMenu(){return this.sourceInlineCompletion.showInlineEditMenu??!1}get partialAccepts(){return this._partiallyAcceptedSinceOriginal}async reportInlineEditShown(i,e,t,o,n,r){if(this.updateShownDuration(t),this._didShow||this._didReportEndOfLife)return;this.addPerformanceMarker("shown"),this._didShow=!0,this._editKind=n,this._viewData.viewKind=t,this._viewData.renderData=o,this._timeUntilShown=r-this._requestInfo.startTime,this._timeUntilActuallyShown=Date.now()-this._requestInfo.startTime;let s=new zy(o.lineCountModified,o.lineCountOriginal,o.characterCountModified,o.characterCountOriginal);this.source.provider.handleItemDidShow?.(this.source.inlineSuggestions,this.sourceInlineCompletion,e,s),this.sourceInlineCompletion.shownCommand&&await i.executeCommand(this.sourceInlineCompletion.shownCommand.id,...this.sourceInlineCompletion.shownCommand.arguments||[])}reportPartialAccept(i,e,t){this._partiallyAcceptedCount++,this._partiallyAcceptedSinceOriginal.characters+=t.characters,this._partiallyAcceptedSinceOriginal.ratio=Math.min(this._partiallyAcceptedSinceOriginal.ratio+(1-this._partiallyAcceptedSinceOriginal.ratio)*t.ratio,1),this._partiallyAcceptedSinceOriginal.count+=t.count,this.source.provider.handlePartialAccept?.(this.source.inlineSuggestions,this.sourceInlineCompletion,i,e)}reportEndOfLife(i){if(!this._didReportEndOfLife&&(this._didReportEndOfLife=!0,this.reportInlineEditHidden(),i||(i=this._lastSetEndOfLifeReason??{kind:2,userTypingDisagreed:!1,supersededBy:void 0}),i.kind===1&&!this._didShow&&(i={kind:2,userTypingDisagreed:!1,supersededBy:void 0}),i.kind===1&&this.source.provider.handleRejection&&this.source.provider.handleRejection(this.source.inlineSuggestions,this.sourceInlineCompletion),this.source.provider.handleEndOfLifetime)){let e={requestUuid:this.context.requestUuid,correlationId:this._correlationId,selectedSuggestionInfo:!!this.context.selectedSuggestionInfo,partiallyAccepted:this._partiallyAcceptedCount,partiallyAcceptedCountSinceOriginal:this._partiallyAcceptedSinceOriginal.count,partiallyAcceptedRatioSinceOriginal:this._partiallyAcceptedSinceOriginal.ratio,partiallyAcceptedCharactersSinceOriginal:this._partiallyAcceptedSinceOriginal.characters,shown:this._didShow,shownDuration:this._shownDuration,shownDurationUncollapsed:this._showUncollapsedDuration,editKind:this._editKind?.toString(),preceeded:this._isPreceeded,timeUntilShown:this._timeUntilShown,timeUntilActuallyShown:this._timeUntilActuallyShown,timeUntilProviderRequest:this._providerRequestInfo.startTime-this._requestInfo.startTime,timeUntilProviderResponse:this._providerRequestInfo.endTime-this._requestInfo.startTime,editorType:this._viewData.editorType,languageId:this._requestInfo.languageId,requestReason:this._requestInfo.reason,viewKind:this._viewData.viewKind,notShownReason:this._notShownReason,performanceMarkers:this.performance.toString(),renameCreated:this._renameInfo?.createdRename,renameDuration:this._renameInfo?.duration,renameTimedOut:this._renameInfo?.timedOut,renameDroppedOtherEdits:this._renameInfo?.droppedOtherEdits,renameDroppedRenameEdits:this._renameInfo?.droppedRenameEdits,typingInterval:this._requestInfo.typingInterval,typingIntervalCharacterCount:this._requestInfo.typingIntervalCharacterCount,skuPlan:this._requestInfo.sku?.plan,skuType:this._requestInfo.sku?.type,availableProviders:this._requestInfo.availableProviders.map(t=>t.toString()).join(","),...this._viewData.renderData?.getData()};this.source.provider.handleEndOfLifetime(this.source.inlineSuggestions,this.sourceInlineCompletion,i,e)}}setIsPreceeded(i){this._isPreceeded=!0,(this._partiallyAcceptedSinceOriginal.characters!==0||this._partiallyAcceptedSinceOriginal.ratio!==0||this._partiallyAcceptedSinceOriginal.count!==0)&&console.warn("Expected partiallyAcceptedCountSinceOriginal to be { characters: 0, rate: 0, partialAcceptances: 0 } before setIsPreceeded."),this._partiallyAcceptedSinceOriginal=i}setNotShownReason(i){this._notShownReason??=i}setEndOfLifeReason(i){this.reportInlineEditHidden(),this._lastSetEndOfLifeReason=i}updateShownDuration(i){let e=Date.now();this._showStartTime||(this._showStartTime=e);let t=i==="collapsed";!t&&this._showUncollapsedStartTime===void 0&&(this._showUncollapsedStartTime=e),t&&this._showUncollapsedStartTime!==void 0&&(this._showUncollapsedDuration+=e-this._showUncollapsedStartTime)}reportInlineEditHidden(){if(this._showStartTime===void 0)return;let i=Date.now();this._shownDuration+=i-this._showStartTime,this._showStartTime=void 0,this._showUncollapsedStartTime!==void 0&&(this._showUncollapsedDuration+=i-this._showUncollapsedStartTime,this._showUncollapsedStartTime=void 0)}setRenameProcessingInfo(i){if(this._renameInfo)throw new ni("Rename info has already been set.");this._renameInfo=i}withAction(i){return this._action=i,this}addPerformanceMarker(i){this.performance.mark(i)}},Nsi=class{constructor(){this.markers=[];this.markers.push({name:"start",timeStamp:Date.now()})}mark(i){this.markers.push({name:i,timeStamp:Date.now()})}toString(){let i=[];for(let e=1;e<this.markers.length;e++){let t=this.markers[e].timeStamp-this.markers[e-1].timeStamp;i.push({[this.markers[e].name]:t})}return JSON.stringify(i)}};var Hwt=class{constructor(i,e,t){this.inlineSuggestions=i;this.inlineSuggestionsData=e;this.provider=t;this.refCount=0}addRef(){this.refCount++}removeRef(i={kind:"other"}){if(this.refCount--,this.refCount===0){for(let e of this.inlineSuggestionsData)e.reportEndOfLife();this.provider.disposeInlineCompletions(this.inlineSuggestions,i)}}};function LVo(a,i){let e=i.getWordAtPosition(a),t=i.getLineMaxColumn(a.lineNumber);return e?new z(a.lineNumber,e.startColumn,a.lineNumber,t):z.fromPositions(a,a.with(void 0,t))}function dQi(a,i,e,t){let o=e.getLineContent(i.lineNumber),n=Hc.replace(new di(i.column-1,o.length),a),s=e.tokenization.tokenizeLinesAt(i.lineNumber,[n.replace(o)])?.[0].sliceZeroCopy(n.getRangeAfterReplace());return s?cQi(s,t):a}var Fsi;(i=>{function a(e){return e?.command.id??void 0}i.toString=a})(Fsi||={});var j1=class a extends Q6{constructor(e){super();this._textModel=e;this._version=e.getVersionId()}static snapshot(e){return new a(e)}get uri(){return this._textModel.uri}get version(){return this._version}_assertValid(){this._textModel.getVersionId()!==this._version&&mt(new Error(`TextModel has changed: expected version ${this._version}, got ${this._textModel.getVersionId()}`))}targets(e){return this._textModel.uri.toString()===e.uri.toString()}getValueOfRange(e){return this._assertValid(),this._textModel.getValueInRange(e)}getLineLength(e){return this._assertValid(),this._textModel.getLineLength(e)}get length(){this._assertValid();let e=this._textModel.getLineCount(),t=this._textModel.getLineLength(e);return new Zl(e-1,t)}getEOL(){return this._assertValid(),this._textModel.getEOL()}getPositionAt(e){return this._assertValid(),this._textModel.getPositionAt(e)}getValueInRange(e){return this._assertValid(),this._textModel.getValueInRange(e)}getVersionId(){return this._version}dangerouslyGetUnderlyingModel(){return this._textModel}};var N4e;(i=>{function a(e,t,o=!0){return!e.isInlineEdit&&!e.action?.uri&&e.action?.kind==="edit"?Wsi.create(e,t,e.action):Vsi.create(e,t,o)}i.create=a})(N4e||={});function RVo(a){let i=a?.kind==="edit"?{...a,alternativeAction:Fsi.toString(a.alternativeAction),target:a?.target.uri.toString()}:{...a,target:a?.target.uri.toString()};return JSON.stringify(i)}var zwt=class{constructor(i,e,t,o){this._data=i;this.identity=e;this.hint=t;this.originalTextRef=o}get source(){return this._data.source}get isFromExplicitRequest(){return this._data.context.triggerKind===1}get forwardStable(){return this.source.inlineSuggestions.enableForwardStability??!1}get targetRange(){if(this.hint)return this.hint.range;if(this.action?.kind==="edit")return this.action.textReplacement.range;if(this.action?.kind==="jumpTo")return z.fromPositions(this.action.position);throw new ni("InlineSuggestionItem: Either hint or action must be set")}get semanticId(){return this.hash}get gutterMenuLinkAction(){return this._sourceInlineCompletion.gutterMenuLinkAction}get command(){return this._sourceInlineCompletion.command}get supportsRename(){return this._data.supportsRename}get warning(){return this._sourceInlineCompletion.warning}get showInlineEditMenu(){return!!this._sourceInlineCompletion.showInlineEditMenu}get hash(){return RVo(this.action)}get shownCommand(){return this._sourceInlineCompletion.shownCommand}get requestUuid(){return this._data.context.requestUuid}get partialAccepts(){return this._data.partialAccepts}get _sourceInlineCompletion(){return this._data.sourceInlineCompletion}addRef(){this.identity.addRef(),this.source.addRef()}removeRef(){this.identity.removeRef(),this.source.removeRef()}reportInlineEditShown(i,e,t,o,n){let r=this.action?.kind==="edit"?this.action.textReplacement.text:"";this._data.reportInlineEditShown(i,r,e,t,this.computeEditKind(o),n)}reportPartialAccept(i,e,t){this._data.reportPartialAccept(i,e,t)}reportEndOfLife(i){this._data.reportEndOfLife(i)}setEndOfLifeReason(i){this._data.setEndOfLifeReason(i)}setIsPreceeded(i){this._data.setIsPreceeded(i.partialAccepts)}setNotShownReasonIfNotSet(i){this._data.setNotShownReason(i)}getSourceCompletion(){return this._sourceInlineCompletion}setRenameProcessingInfo(i){this._data.setRenameProcessingInfo(i)}withAction(i){return this._data.withAction(i)}addPerformanceMarker(i){this._data.addPerformanceMarker(i)}},Kwt=class a{constructor(){this._onDispose=Wc(this);this.onDispose=this._onDispose;this._jumpedTo=Le(this,!1);this._refCount=0;this.id="InlineCompletionIdentity"+a.idCounter++}static{this.idCounter=0}get jumpedTo(){return this._jumpedTo}addRef(){this._refCount++}removeRef(){this._refCount--,this._refCount===0&&this._onDispose.trigger(void 0)}setJumpTo(i){this._jumpedTo.set(!0,i)}},Gwt=class a{constructor(i,e,t){this.range=i;this.content=e;this.style=t}static create(i){return new a(z.lift(i.range),i.content,i.style)}withEdit(i,e){let t=new di(e.getOffset(this.range.getStartPosition()),e.getOffset(this.range.getEndPosition())),o=wXt([t],i)[0];if(!o)return;let n=e.getRange(o);return new a(n,this.content,this.style)}},Wsi=class a extends zwt{constructor(e,t,o,n,r,s,l,c,u,p){super(l,c,u,p);this._edit=e;this._trimmedEdit=t;this._textEdit=o;this._originalRange=n;this.snippetInfo=r;this.additionalTextEdits=s;this.isInlineEdit=!1}static create(e,t,o){let n=new Kwt,r=t.getTransformer(),s=o.insertText.replace(/\r\n|\r|\n/g,t.getEOL()),l=AVo(new Hc(r.getOffsetRange(o.range),s),t),c=l.removeCommonSuffixAndPrefix(t.getValue()),u=r.getTextReplacement(l),p=e.hint?Gwt.create(e.hint):void 0;return new a(l,c,u,u.range,o.snippetInfo,e.additionalTextEdits,e,n,p,t)}get action(){return{kind:"edit",textReplacement:this.getSingleTextEdit(),snippetInfo:this.snippetInfo,stringEdit:new Qc([this._trimmedEdit]),alternativeAction:void 0,target:this.originalTextRef}}get hash(){return JSON.stringify(this._trimmedEdit.toJson())}getSingleTextEdit(){return this._textEdit}withIdentity(e){return new a(this._edit,this._trimmedEdit,this._textEdit,this._originalRange,this.snippetInfo,this.additionalTextEdits,this._data,e,this.hint,this.originalTextRef)}withEdit(e,t){if(!this.originalTextRef.targets(t))return this;let o=wXt([this._edit.replaceRange],e);if(o.length===0)return;let n=new Hc(o[0],this._textEdit.text),r=Cle(t),s=r.getTextReplacement(n),l=this.hint;if(l&&(l=l.withEdit(e,r),!l))return;let c=n.removeCommonSuffixAndPrefix(t.getValue());return new a(n,c,s,this._originalRange,this.snippetInfo,this.additionalTextEdits,this._data,this.identity,l,this.originalTextRef)}canBeReused(e,t){let o=this._textEdit.range;return!!o&&o.containsPosition(t)&&this.isVisible(e,t)&&Zl.ofRange(o).isGreaterThanOrEqualTo(Zl.ofRange(this._originalRange))}isVisible(e,t){let o=this.getSingleTextEdit();return Vwt(o,this._originalRange,e,t)}computeEditKind(e){return Psi(new Qc([this._edit]),e)}get editRange(){return this.getSingleTextEdit().range}get insertText(){return this.getSingleTextEdit().text}},Vsi=class a extends zwt{constructor(e,t,o,n,r,s=!1,l,c){super(t,o,r,c);this._action=e;this._edits=n;this._lastChangePartOfInlineEdit=s;this._inlineEditModelVersion=l;this.snippetInfo=void 0;this.additionalTextEdits=[];this.isInlineEdit=!0}static createForTest(e,t,o){let n={kind:"edit",snippetInfo:void 0,insertText:o,range:t,uri:e.uri,alternativeAction:void 0};return a.create(A4e.createForTest(n,e.uri),e)}static create(e,t,o=!0){let n,r=[];if(e.action?.kind==="edit"){let c=o?MVo(t,e.action.range,e.action.insertText):PVo(t,e.action.range,e.action.insertText),u=bp.fromStringEdit(c,t),p=c.isEmpty()?new Xr(new z(1,1,1,1),""):u.toReplacement(t);r=c.replacements.map(h=>{let g=z.fromPositions(t.getPositionAt(h.replaceRange.start),t.getTransformer().getPosition(h.replaceRange.endExclusive)),f=t.getValueInRange(g);return Bsi.create(h,f)}),n={kind:"edit",snippetInfo:e.action.snippetInfo,stringEdit:c,textReplacement:p,alternativeAction:e.action.alternativeAction,target:t}}else if(e.action?.kind==="jumpTo")n={kind:"jumpTo",position:e.action.position,offset:t.getTransformer().getOffset(e.action.position),target:t};else if(n=void 0,!e.hint)throw new ni("InlineEditItem: action is undefined and no hint is provided");let s=new Kwt,l=e.hint?Gwt.create(e.hint):void 0;return new a(n,e,s,r,l,!1,t.getVersionId(),t)}get updatedEditModelVersion(){return this._inlineEditModelVersion}get action(){return this._action}withIdentity(e){return new a(this._action,this._data,e,this._edits,this.hint,this._lastChangePartOfInlineEdit,this._inlineEditModelVersion,this.originalTextRef)}canBeReused(e,t){return this._lastChangePartOfInlineEdit&&this.updatedEditModelVersion===e.getVersionId()}withEdit(e,t){return this.originalTextRef.targets(t)?this._applyTextModelChanges(e,this._edits,t):this}_applyTextModelChanges(e,t,o){let n=Cle(o),r=!1,s=this._inlineEditModelVersion,l,c=j1.snapshot(o);if(this.action?.kind==="edit"){if(t=t.map(f=>f.applyTextModelChanges(e)),t.some(f=>f.edit===void 0))return;let p=o.getVersionId();if(r=t.some(f=>f.lastChangeUpdatedEdit),r&&(s=p??-1),p===null||s+20<p||(t=t.filter(f=>!f.edit.isEmpty),t.length===0))return;let h=new Qc(t.map(f=>f.edit));l={kind:"edit",textReplacement:n.getTextEdit(h).toReplacement(new _L(o)),snippetInfo:this.snippetInfo,stringEdit:h,alternativeAction:this.action.alternativeAction,target:c}}else if(this.action?.kind==="jumpTo"){let p=this.action.offset,h=e.applyToOffsetOrUndefined(p);if(h===void 0)return;l={kind:"jumpTo",position:n.getPosition(h),offset:h,target:c}}else l=void 0;let u=this.hint;if(!(u&&(u=u.withEdit(e,n),!u)))return new a(l,this._data,this.identity,t,u,r,s,c)}computeEditKind(e){let t=this.action?.kind==="edit"?this.action.stringEdit:void 0;if(t)return Psi(t,e)}};function MVo(a,i,e){let t=a.getEOL(),o=a.getValueOfRange(i),n=e.replace(/\r\n|\r|\n/g,t),l=_U.getDefault().computeDiff(mc(o),mc(n),{ignoreTrimWhitespace:!1,computeMoves:!1,extendToSubwords:!0,maxComputationTimeMs:50}).changes.flatMap(h=>h.innerChanges??[]);function c(h,g){let f=Zl.fromPosition(g.getStartPosition());return Zl.ofRange(g).createRange(f.addToPosition(h))}let u=new _S(n);return new Qc(l.map(h=>{let g=c(i.getStartPosition(),h.originalRange),f=a.getTransformer().getOffsetRange(g),v=u.getValueOfRange(h.modifiedRange),b=new Hc(f,v),S=a.getValueOfRange(g);return NVo(b,S,l.length,a)}))}function PVo(a,i,e){return new Qc([new Hc(a.getTransformer().getOffsetRange(i),e)])}var Bsi=class a{constructor(i,e,t,o,n=!1){this._edit=i;this._trimmedNewText=e;this._prefixLength=t;this._suffixLength=o;this._lastChangeUpdatedEdit=n}static create(i,e){let t=Ng(i.newText,e),o=zw(i.newText,e),n=i.newText.substring(t,i.newText.length-o);return new a(i,n,t,o)}get edit(){return this._edit}get lastChangeUpdatedEdit(){return this._lastChangeUpdatedEdit}applyTextModelChanges(i){let e=this._clone();return e._applyTextModelChanges(i),e}_clone(){return new a(this._edit,this._trimmedNewText,this._prefixLength,this._suffixLength,this._lastChangeUpdatedEdit)}_applyTextModelChanges(i){if(this._lastChangeUpdatedEdit=!1,!this._edit)throw new ni("UpdatedInnerEdits: No edit to apply changes to");let e=this._applyChanges(this._edit,i);if(!e){this._edit=void 0;return}this._edit=e.edit,this._lastChangeUpdatedEdit=e.editHasChanged}_applyChanges(i,e){let t=i.replaceRange.start,o=i.replaceRange.endExclusive,n=i.newText,r=!1,s=this._prefixLength>0||this._suffixLength>0;for(let l=e.replacements.length-1;l>=0;l--){let c=e.replacements[l],u=c.newText.length>0&&c.replaceRange.isEmpty;if(u&&!s&&c.replaceRange.start===t&&n.startsWith(c.newText)){t+=c.newText.length,n=n.substring(c.newText.length),o+=c.newText.length,r=!0;continue}if(u&&s&&c.replaceRange.start===t+this._prefixLength&&this._trimmedNewText.startsWith(c.newText)){o+=c.newText.length,r=!0,this._prefixLength+=c.newText.length,this._trimmedNewText=this._trimmedNewText.substring(c.newText.length);continue}if(c.newText.length===0&&c.replaceRange.length>0&&c.replaceRange.start>=t+this._prefixLength&&c.replaceRange.endExclusive<=o-this._suffixLength){o-=c.replaceRange.length,r=!0;continue}if(c.equals(i)){r=!0,t=c.replaceRange.endExclusive,n="";continue}if(!(c.replaceRange.start>o)){if(c.replaceRange.endExclusive<t){t+=c.newText.length-c.replaceRange.length,o+=c.newText.length-c.replaceRange.length;continue}return}}return this._trimmedNewText.length===0&&t+this._prefixLength===o-this._suffixLength?{edit:new Hc(new di(t+this._prefixLength,t+this._prefixLength),""),editHasChanged:!0}:{edit:new Hc(new di(t,o),n),editHasChanged:r}}};function AVo(a,i){let e=i.getEOL();return a.replaceRange.isEmpty&&a.newText.includes(e)&&(a=mQi(a,i)),a}function NVo(a,i,e,t){let o=t.getEOL();if(a.newText.endsWith(o)&&i.endsWith(o)&&(a=new Hc(a.replaceRange.deltaEnd(-o.length),a.newText.slice(0,-o.length))),e===1&&a.replaceRange.isEmpty&&a.newText.includes(o)){let n=t.getTransformer().getPosition(a.replaceRange.start);t.getLineLength(n.lineNumber)!==0&&(a=mQi(a,t))}if(e===1){let n=Ng(i,a.newText),r=zw(i.slice(n),a.newText.slice(n));if(n+r===i.length)return new Hc(a.replaceRange.deltaStart(n).deltaEnd(-r),a.newText.substring(n,a.newText.length-r));if(n+r===a.newText.length)return new Hc(a.replaceRange.deltaStart(n).deltaEnd(-r),"")}return a}function mQi(a,i){if(!a.replaceRange.isEmpty)throw new ni("Unexpected original range");if(a.replaceRange.start===0)return a;let e=i.getEOL(),t=i.getTransformer().getPosition(a.replaceRange.start),o=t.column,n=t.lineNumber;return o===1&&n>1&&a.newText.endsWith(e)&&!a.newText.startsWith(e)?new Hc(a.replaceRange.delta(-1),e+a.newText.slice(0,-e.length)):a}var FVo=!1,kle=new Q("renameInputVisible",!1,d(1554,null)),Qhs=new Q("renameInputFocused",!1,d(1553,null)),vCe=class{constructor(i,e,t,o,n,r){this._editor=i;this._acceptKeybindings=e;this._themeService=t;this._keybindingService=o;this._logService=r;this.allowEditorOverflow=!0;this._disposables=new P;this._visibleContextKey=kle.bindTo(n),this._isEditingRenameCandidate=!1,this._nRenameSuggestionsInvocations=0,this._hadAutomaticRenameSuggestionsInvocation=!1,this._candidates=new Set,this._beforeFirstInputFieldEditSW=new En,this._inputWithButton=new Usi,this._disposables.add(this._inputWithButton),this._editor.addContentWidget(this),this._disposables.add(this._editor.onDidChangeConfiguration(s=>{s.hasChanged(59)&&this._updateFont()})),this._disposables.add(t.onDidColorThemeChange(this._updateStyles,this))}dispose(){this._disposables.dispose(),this._editor.removeContentWidget(this)}getId(){return"__renameInputWidget"}getDomNode(){return this._domNode||(this._domNode=document.createElement("div"),this._domNode.className="monaco-editor rename-box",this._domNode.appendChild(this._inputWithButton.domNode),this._renameCandidateListView=this._disposables.add(new Hsi(this._domNode,{fontInfo:this._editor.getOption(59),onFocusChange:i=>{this._inputWithButton.input.value=i,this._isEditingRenameCandidate=!1},onSelectionChange:()=>{this._isEditingRenameCandidate=!1,this.acceptInput(!1)}})),this._disposables.add(this._inputWithButton.onDidInputChange(()=>{this._renameCandidateListView?.focusedCandidate!==void 0&&(this._isEditingRenameCandidate=!0),this._timeBeforeFirstInputFieldEdit??=this._beforeFirstInputFieldEditSW.elapsed(),this._renameCandidateProvidersCts?.token.isCancellationRequested===!1&&this._renameCandidateProvidersCts.cancel(),this._renameCandidateListView?.clearFocus()})),this._label=document.createElement("div"),this._label.className="rename-label",this._domNode.appendChild(this._label),this._updateFont(),this._updateStyles(this._themeService.getColorTheme())),this._domNode}_updateStyles(i){if(!this._domNode)return;let e=i.getColor(RN),t=i.getColor(jT);this._domNode.style.backgroundColor=String(i.getColor(gm)??""),this._domNode.style.boxShadow=e?` 0 0 8px 2px ${e}`:"",this._domNode.style.border=t?`1px solid ${t}`:"",this._domNode.style.color=String(i.getColor(pL)??"");let o=i.getColor(Vy);this._inputWithButton.domNode.style.backgroundColor=String(i.getColor(Gb)??""),this._inputWithButton.input.style.backgroundColor=String(i.getColor(Gb)??""),this._inputWithButton.domNode.style.borderWidth=o?"1px":"0px",this._inputWithButton.domNode.style.borderStyle=o?"solid":"none",this._inputWithButton.domNode.style.borderColor=o?.toString()??"none"}_updateFont(){if(this._domNode===void 0)return;So(this._label!==void 0,"RenameWidget#_updateFont: _label must not be undefined given _domNode is defined"),this._editor.applyFontInfo(this._inputWithButton.input);let i=this._editor.getOption(59);this._label.style.fontSize=`${this._computeLabelFontSize(i.fontSize)}px`}_computeLabelFontSize(i){return i*.8}getPosition(){if(!this._visible||!this._editor.hasModel()||!this._editor.getDomNode())return null;let i=Fm(this.getDomNode().ownerDocument.body),e=Yn(this._editor.getDomNode()),t=this._getTopForPosition();this._nPxAvailableAbove=t+e.top,this._nPxAvailableBelow=i.height-this._nPxAvailableAbove;let o=this._editor.getOption(75),{totalHeight:n}=O4e.getLayoutInfo({lineHeight:o}),r=this._nPxAvailableBelow>n*6?[2,1]:[1,2];return{position:this._position,preference:r}}beforeRender(){let[i,e]=this._acceptKeybindings;return this._label.innerText=d(1551,null,this._keybindingService.lookupKeybinding(i)?.getLabel(),this._keybindingService.lookupKeybinding(e)?.getLabel()),this._domNode.style.minWidth="200px",null}afterRender(i){if(i===null){this.cancelInput(!0,"afterRender (because position is null)");return}if(!this._editor.hasModel()||!this._editor.getDomNode())return;So(this._renameCandidateListView),So(this._nPxAvailableAbove!==void 0),So(this._nPxAvailableBelow!==void 0);let e=nh(this._inputWithButton.domNode),t=nh(this._label),o;i===2?o=this._nPxAvailableBelow:o=this._nPxAvailableAbove,this._renameCandidateListView.layout({height:o-t-e,width:yl(this._inputWithButton.domNode)})}acceptInput(i){this._trace("invoking acceptInput"),this._currentAcceptInput?.(i)}cancelInput(i,e){this._currentCancelInput?.(i)}focusNextRenameSuggestion(){this._renameCandidateListView?.focusNext()||(this._inputWithButton.input.value=this._currentName)}focusPreviousRenameSuggestion(){this._renameCandidateListView?.focusPrevious()||(this._inputWithButton.input.value=this._currentName)}getInput(i,e,t,o,n){let{start:r,end:s}=this._getSelection(i,e);this._renameCts=n;let l=new P;this._nRenameSuggestionsInvocations=0,this._hadAutomaticRenameSuggestionsInvocation=!1,o===void 0?this._inputWithButton.button.style.display="none":(this._inputWithButton.button.style.display="flex",this._requestRenameCandidatesOnce=o,this._requestRenameCandidates(e,!1),l.add(j(this._inputWithButton.button,"click",()=>this._requestRenameCandidates(e,!0))),l.add(j(this._inputWithButton.button,re.KEY_DOWN,u=>{let p=new Ii(u);(p.equals(3)||p.equals(10))&&(p.stopPropagation(),p.preventDefault(),this._requestRenameCandidates(e,!0))}))),this._isEditingRenameCandidate=!1,this._domNode.classList.toggle("preview",t),this._position=new Ie(i.startLineNumber,i.startColumn),this._currentName=e,this._inputWithButton.input.value=e,this._inputWithButton.input.setAttribute("selectionStart",r.toString()),this._inputWithButton.input.setAttribute("selectionEnd",s.toString()),this._inputWithButton.input.size=Math.max((i.endColumn-i.startColumn)*1.1,20),this._beforeFirstInputFieldEditSW.reset(),l.add(Z(()=>{this._renameCts=void 0,n.dispose(!0)})),l.add(Z(()=>{this._renameCandidateProvidersCts!==void 0&&(this._renameCandidateProvidersCts.dispose(!0),this._renameCandidateProvidersCts=void 0)})),l.add(Z(()=>this._candidates.clear()));let c=new Go;return c.p.finally(()=>{l.dispose(),this._hide()}),this._currentCancelInput=u=>(this._trace("invoking _currentCancelInput"),this._currentAcceptInput=void 0,this._currentCancelInput=void 0,this._renameCandidateListView?.clearCandidates(),c.complete(u),!0),this._currentAcceptInput=u=>{this._trace("invoking _currentAcceptInput"),So(this._renameCandidateListView!==void 0);let p=this._renameCandidateListView.nCandidates,h,g,f=this._renameCandidateListView.focusedCandidate;if(f!==void 0?(this._trace("using new name from renameSuggestion"),h=f,g={k:"renameSuggestion"}):(this._trace("using new name from inputField"),h=this._inputWithButton.input.value,g=this._isEditingRenameCandidate?{k:"userEditedRenameSuggestion"}:{k:"inputField"}),h===e||h.trim().length===0){this.cancelInput(!0,"_currentAcceptInput (because newName === value || newName.trim().length === 0)");return}this._currentAcceptInput=void 0,this._currentCancelInput=void 0,this._renameCandidateListView.clearCandidates(),c.complete({newName:h,wantsPreview:t&&u,stats:{source:g,nRenameSuggestions:p,timeBeforeFirstInputFieldEdit:this._timeBeforeFirstInputFieldEdit,nRenameSuggestionsInvocations:this._nRenameSuggestionsInvocations,hadAutomaticRenameSuggestionsInvocation:this._hadAutomaticRenameSuggestionsInvocation}})},l.add(n.token.onCancellationRequested(()=>this.cancelInput(!0,"cts.token.onCancellationRequested"))),FVo||l.add(this._editor.onDidBlurEditorWidget(()=>this.cancelInput(!this._domNode?.ownerDocument.hasFocus(),"editor.onDidBlurEditorWidget"))),this._show(),c.p}_requestRenameCandidates(i,e){if(this._requestRenameCandidatesOnce!==void 0&&(this._renameCandidateProvidersCts!==void 0&&this._renameCandidateProvidersCts.dispose(!0),So(this._renameCts),this._inputWithButton.buttonState!=="stop")){this._renameCandidateProvidersCts=new $e;let t=e?0:1,o=this._requestRenameCandidatesOnce(t,this._renameCandidateProvidersCts.token);if(o.length===0){this._inputWithButton.setSparkleButton();return}e||(this._hadAutomaticRenameSuggestionsInvocation=!0),this._nRenameSuggestionsInvocations+=1,this._inputWithButton.setStopButton(),this._updateRenameCandidates(o,i,this._renameCts.token)}}_getSelection(i,e){So(this._editor.hasModel());let t=this._editor.getSelection(),o=0,n=e.length;return!z.isEmpty(t)&&!z.spansMultipleLines(t)&&z.containsRange(i,t)&&(o=Math.max(0,t.startColumn-i.startColumn),n=Math.min(i.endColumn,t.endColumn)-i.startColumn),{start:o,end:n}}_show(){this._trace("invoking _show"),this._editor.revealLineInCenterIfOutsideViewport(this._position.lineNumber,0),this._visible=!0,this._visibleContextKey.set(!0),this._editor.layoutContentWidget(this),setTimeout(()=>{this._inputWithButton.input.focus(),this._inputWithButton.input.setSelectionRange(parseInt(this._inputWithButton.input.getAttribute("selectionStart")),parseInt(this._inputWithButton.input.getAttribute("selectionEnd")))},100)}async _updateRenameCandidates(i,e,t){let o=(...c)=>this._trace("_updateRenameCandidates",...c);o("start");let n=await wa(Promise.allSettled(i),t);if(this._inputWithButton.setSparkleButton(),n===void 0){o("returning early - received updateRenameCandidates results - undefined");return}let r=n.flatMap(c=>c.status==="fulfilled"&&mo(c.value)?c.value:[]);o(`received updateRenameCandidates results - total (unfiltered) ${r.length} candidates.`);let s=Uo(r,c=>c.newSymbolName);o(`distinct candidates - ${s.length} candidates.`);let l=s.filter(({newSymbolName:c})=>c.trim().length>0&&c!==this._inputWithButton.input.value&&c!==e&&!this._candidates.has(c));if(o(`valid distinct candidates - ${r.length} candidates.`),l.forEach(c=>this._candidates.add(c.newSymbolName)),l.length<1){o("returning early - no valid distinct candidates");return}o("setting candidates"),this._renameCandidateListView.setCandidates(l),o("asking editor to re-layout"),this._editor.layoutContentWidget(this)}_hide(){this._trace("invoked _hide"),this._visible=!1,this._visibleContextKey.reset(),this._editor.layoutContentWidget(this)}_getTopForPosition(){let i=this._editor.getVisibleRanges(),e;return i.length>0?e=i[0].startLineNumber:(this._logService.warn("RenameWidget#_getTopForPosition: this should not happen - visibleRanges is empty"),e=Math.max(1,this._position.lineNumber-5)),this._editor.getTopForLineNumber(this._position.lineNumber)-this._editor.getTopForLineNumber(e)}_trace(...i){this._logService.trace("RenameWidget",...i)}};vCe=I([m(2,De),m(3,_e),m(4,X),m(5,ne)],vCe);var Hsi=class a{constructor(i,e){this._disposables=new P,this._availableHeight=0,this._minimumWidth=0,this._lineHeight=e.fontInfo.lineHeight,this._typicalHalfwidthCharacterWidth=e.fontInfo.typicalHalfwidthCharacterWidth,this._listContainer=document.createElement("div"),this._listContainer.className="rename-box rename-candidate-list-container",i.appendChild(this._listContainer),this._listWidget=a._createListWidget(this._listContainer,this._candidateViewHeight,e.fontInfo),this._disposables.add(this._listWidget.onDidChangeFocus(t=>{t.elements.length===1&&e.onFocusChange(t.elements[0].newSymbolName)},this._disposables)),this._disposables.add(this._listWidget.onDidChangeSelection(t=>{t.elements.length===1&&e.onSelectionChange()},this._disposables)),this._disposables.add(this._listWidget.onDidBlur(t=>{this._listWidget.setFocus([])})),this._listWidget.style(GI({listInactiveFocusForeground:WU,listInactiveFocusBackground:VU}))}dispose(){this._listWidget.dispose(),this._disposables.dispose()}layout({height:i,width:e}){this._availableHeight=i,this._minimumWidth=e}setCandidates(i){this._listWidget.splice(0,0,i);let e=this._pickListHeight(this._listWidget.length),t=this._pickListWidth(i);this._listWidget.layout(e,t),this._listContainer.style.height=`${e}px`,this._listContainer.style.width=`${t}px`,Or(d(1555,null,i.length))}clearCandidates(){this._listContainer.style.height="0px",this._listContainer.style.width="0px",this._listWidget.splice(0,this._listWidget.length,[])}get nCandidates(){return this._listWidget.length}get focusedCandidate(){if(this._listWidget.length===0)return;let i=this._listWidget.getSelectedElements()[0];if(i!==void 0)return i.newSymbolName;let e=this._listWidget.getFocusedElements()[0];if(e!==void 0)return e.newSymbolName}focusNext(){if(this._listWidget.length===0)return!1;let i=this._listWidget.getFocus();if(i.length===0)return this._listWidget.focusFirst(),this._listWidget.reveal(0),!0;if(i[0]===this._listWidget.length-1)return this._listWidget.setFocus([]),this._listWidget.reveal(0),!1;{this._listWidget.focusNext();let e=this._listWidget.getFocus()[0];return this._listWidget.reveal(e),!0}}focusPrevious(){if(this._listWidget.length===0)return!1;let i=this._listWidget.getFocus();if(i.length===0){this._listWidget.focusLast();let e=this._listWidget.getFocus()[0];return this._listWidget.reveal(e),!0}else{if(i[0]===0)return this._listWidget.setFocus([]),!1;{this._listWidget.focusPrevious();let e=this._listWidget.getFocus()[0];return this._listWidget.reveal(e),!0}}}clearFocus(){this._listWidget.setFocus([])}get _candidateViewHeight(){let{totalHeight:i}=O4e.getLayoutInfo({lineHeight:this._lineHeight});return i}_pickListHeight(i){let e=this._candidateViewHeight*i;return Math.min(e,this._availableHeight,this._candidateViewHeight*7)}_pickListWidth(i){let e=Math.ceil(Math.max(...i.map(o=>o.newSymbolName.length))*this._typicalHalfwidthCharacterWidth);return Math.max(this._minimumWidth,25+e+10)}static _createListWidget(i,e,t){let o=new class{getTemplateId(r){return"candidate"}getHeight(r){return e}},n=new class{constructor(){this.templateId="candidate"}renderTemplate(r){return new O4e(r,t)}renderElement(r,s,l){l.populate(r)}disposeTemplate(r){r.dispose()}};return new hc("NewSymbolNameCandidates",i,o,[n],{keyboardSupport:!1,mouseSupport:!0,multipleSelectionSupport:!1})}},Usi=class{constructor(){this._buttonHoverContent="";this._disposables=new P;this._onDidInputChange=this._disposables.add(new E);this.onDidInputChange=this._onDidInputChange.event}get domNode(){return this._domNode||(this._domNode=document.createElement("div"),this._domNode.className="rename-input-with-button",this._domNode.style.display="flex",this._domNode.style.flexDirection="row",this._domNode.style.alignItems="center",this._inputNode=document.createElement("input"),this._inputNode.className="rename-input",this._inputNode.type="text",this._inputNode.style.border="none",this._inputNode.setAttribute("aria-label",d(1552,null)),this._domNode.appendChild(this._inputNode),this._buttonNode=document.createElement("div"),this._buttonNode.className="rename-suggestions-button",this._buttonNode.setAttribute("tabindex","0"),this._buttonGenHoverText=d(1550,null),this._buttonCancelHoverText=d(1549,null),this._buttonHoverContent=this._buttonGenHoverText,this._disposables.add(yp().setupDelayedHover(this._buttonNode,()=>({content:this._buttonHoverContent,style:1}))),this._domNode.appendChild(this._buttonNode),this._disposables.add(j(this.input,re.INPUT,()=>this._onDidInputChange.fire())),this._disposables.add(j(this.input,re.KEY_DOWN,i=>{let e=new Ii(i);(e.keyCode===15||e.keyCode===17)&&this._onDidInputChange.fire()})),this._disposables.add(j(this.input,re.CLICK,()=>this._onDidInputChange.fire())),this._disposables.add(j(this.input,re.FOCUS,()=>{this.domNode.style.outlineWidth="1px",this.domNode.style.outlineStyle="solid",this.domNode.style.outlineOffset="-1px",this.domNode.style.outlineColor="var(--vscode-focusBorder)"})),this._disposables.add(j(this.input,re.BLUR,()=>{this.domNode.style.outline="none"}))),this._domNode}get input(){return So(this._inputNode),this._inputNode}get button(){return So(this._buttonNode),this._buttonNode}get buttonState(){return this._buttonState}setSparkleButton(){this._buttonState="sparkle",this._sparkleIcon??=Qo(M.sparkle),Rt(this.button),this.button.appendChild(this._sparkleIcon),this.button.setAttribute("aria-label","Generating new name suggestions"),this._buttonHoverContent=this._buttonGenHoverText,this.input.focus()}setStopButton(){this._buttonState="stop",this._stopIcon??=Qo(M.stopCircle),Rt(this.button),this.button.appendChild(this._stopIcon),this.button.setAttribute("aria-label","Cancel generating new name suggestions"),this._buttonHoverContent=this._buttonCancelHoverText,this.input.focus()}dispose(){this._disposables.dispose()}},O4e=class a{static{this._PADDING=2}constructor(i,e){this._domNode=document.createElement("div"),this._domNode.className="rename-box rename-candidate",this._domNode.style.display="flex",this._domNode.style.columnGap="5px",this._domNode.style.alignItems="center",this._domNode.style.height=`${e.lineHeight}px`,this._domNode.style.padding=`${a._PADDING}px`;let t=document.createElement("div");t.style.display="flex",t.style.alignItems="center",t.style.width=t.style.height=`${e.lineHeight*.8}px`,this._domNode.appendChild(t),this._icon=Qo(M.sparkle),this._icon.style.display="none",t.appendChild(this._icon),this._label=document.createElement("div"),Pd(this._label,e),this._domNode.appendChild(this._label),i.appendChild(this._domNode)}populate(i){this._updateIcon(i),this._updateLabel(i)}_updateIcon(i){let e=!!i.tags?.includes(1);this._icon.style.display=e?"inherit":"none"}_updateLabel(i){this._label.innerText=i.newSymbolName}static getLayoutInfo({lineHeight:i}){return{totalHeight:i+a._PADDING*2}}dispose(){}};var bCe=class{constructor(i,e,t){this.model=i;this.position=e;this._providerRenameIdx=0;this._providers=t.ordered(i)}hasProvider(){return this._providers.length>0}async resolveRenameLocation(i){let e=[];for(this._providerRenameIdx=0;this._providerRenameIdx<this._providers.length;this._providerRenameIdx++){let o=this._providers[this._providerRenameIdx];if(!o.resolveRenameLocation)break;let n=await o.resolveRenameLocation(this.model,this.position,i);if(n){if(n.rejectReason){e.push(n.rejectReason);continue}return n}}this._providerRenameIdx=0;let t=this.model.getWordAtPosition(this.position);return t?{range:new z(this.position.lineNumber,t.startColumn,this.position.lineNumber,t.endColumn),text:t.word,rejectReason:e.length>0?e.join(`
`):void 0}:{range:z.fromPositions(this.position),text:"",rejectReason:e.length>0?e.join(`
`):void 0}}async provideRenameEdits(i,e){return this._provideRenameEdits(i,this._providerRenameIdx,[],e)}async _provideRenameEdits(i,e,t,o){let n=this._providers[e];if(!n)return{edits:[],rejectReason:t.join(`
`)};let r=await n.provideRenameEdits(this.model,this.position,i,o);if(r){if(r.rejectReason)return this._provideRenameEdits(i,e+1,t.concat(r.rejectReason),o)}else return this._provideRenameEdits(i,e+1,t.concat(d(1543,null)),o);return r}};function hQi(a,i){return a.ordered(i).length>0}async function gQi(a,i,e,t,o){return new bCe(i,e,a).provideRenameEdits(t,o??ve.None)}async function Ksi(a,i,e,t){let o=new bCe(i,e,a),n=await o.resolveRenameLocation(ve.None);return n?.rejectReason?{edits:[],rejectReason:n.rejectReason}:o.provideRenameEdits(t,ve.None)}var bO=class{constructor(i,e,t,o,n,r,s,l){this.editor=i;this._instaService=e;this._notificationService=t;this._bulkEditService=o;this._progressService=n;this._logService=r;this._configService=s;this._languageFeaturesService=l;this._disposableStore=new P;this._cts=new $e;this._renameWidget=this._disposableStore.add(this._instaService.createInstance(vCe,this.editor,["acceptRenameInput","acceptRenameInputWithPreview"]))}static{this.ID="editor.contrib.renameController"}static get(i){return i.getContribution(bO.ID)}dispose(){this._disposableStore.dispose(),this._cts.dispose(!0)}async run(){let i=this._logService.trace.bind(this._logService,"[rename]");if(this._cts.dispose(!0),this._cts=new $e,!this.editor.hasModel()){i("editor has no model");return}let e=this.editor.getPosition(),t=new bCe(this.editor.getModel(),e,this._languageFeaturesService.renameProvider);if(!t.hasProvider()){i("skeleton has no provider");return}let o=new Ex(this.editor,5,void 0,this._cts.token),n;try{i("resolving rename location");let f=t.resolveRenameLocation(o.token);this._progressService.showWhile(f,250),n=await f,i("resolved rename location")}catch(f){f instanceof ho?i("resolve rename location cancelled",JSON.stringify(f,null," ")):(i("resolve rename location failed",f instanceof Error?f:JSON.stringify(f,null," ")),(typeof f=="string"||Mr(f))&&iu.get(this.editor)?.showMessage(f||d(1548,null),e));return}finally{o.dispose()}if(!n){i("returning early - no loc");return}if(n.rejectReason){i(`returning early - rejected with reason: ${n.rejectReason}`,n.rejectReason),iu.get(this.editor)?.showMessage(n.rejectReason,e);return}if(o.token.isCancellationRequested){i("returning early - cts1 cancelled");return}let r=new Ex(this.editor,5,n.range,this._cts.token),s=this.editor.getModel(),l=this._languageFeaturesService.newSymbolNamesProvider.all(s),c=await Promise.all(l.map(async f=>[f,await f.supportsAutomaticNewSymbolNamesTriggerKind??!1])),u=(f,v)=>{let b=c.slice();return f===1&&(b=b.filter(([S,y])=>y)),b.map(([S])=>S.provideNewSymbolNames(s,n.range,f,v))};i("creating rename input field and awaiting its result");let p=this._bulkEditService.hasPreviewHandler()&&this._configService.getValue(this.editor.getModel().uri,"editor.rename.enablePreview"),h=await this._renameWidget.getInput(n.range,n.text,p,l.length>0?u:void 0,r);if(i("received response from rename input field"),typeof h=="boolean"){i(`returning early - rename input field response - ${h}`),h&&this.editor.focus(),r.dispose();return}this.editor.focus(),i("requesting rename edits");let g=wa(t.provideRenameEdits(h.newName,r.token),r.token).then(async f=>{if(!f){i("returning early - no rename edits result");return}if(!this.editor.hasModel()){i("returning early - no model after rename edits are provided");return}if(f.rejectReason){i(`returning early - rejected with reason: ${f.rejectReason}`),this._notificationService.info(f.rejectReason);return}this.editor.setSelection(z.fromPositions(this.editor.getSelection().getPosition())),i("applying edits"),this._bulkEditService.apply(f,{editor:this.editor,showPreview:h.wantsPreview,label:d(1542,null,n?.text,h.newName),code:"undoredo.rename",quotableLabel:d(1544,null,n?.text,h.newName),respectAutoSaveConfig:!0,reason:_c.rename(n?.text,h.newName)}).then(v=>{i("edits applied"),v.ariaSummary&&Jo(d(1538,null,n.text,h.newName,v.ariaSummary))}).catch(v=>{i(`error when applying edits ${JSON.stringify(v,null," ")}`),this._notificationService.error(d(1546,null)),this._logService.error(v)})},f=>{i("error when providing rename edits",JSON.stringify(f,null," ")),this._notificationService.error(d(1545,null)),this._logService.error(f)}).finally(()=>{r.dispose()});return i("returning rename operation"),this._progressService.showWhile(g,250),g}acceptRenameInput(i){this._renameWidget.acceptInput(i)}cancelRenameInput(){this._renameWidget.cancelInput(!0,"cancelRenameInput command")}focusNextRenameSuggestion(){this._renameWidget.focusNextRenameSuggestion()}focusPreviousRenameSuggestion(){this._renameWidget.focusPreviousRenameSuggestion()}};bO=I([m(1,F),m(2,Ne),m(3,ma),m(4,rd),m(5,ne),m(6,Nn),m(7,zt)],bO);var zsi=class extends xi{constructor(){super({id:"editor.action.rename",label:L(1547,"Rename Symbol"),precondition:x.and(ue.writable,ue.hasRenameProvider),kbOpts:{kbExpr:ue.editorTextFocus,primary:60,weight:100},contextMenuOpts:{group:"1_modification",order:1.1},canTriggerInlineEdits:!0})}runCommand(i,e){let t=i.get(Kt),[o,n]=Array.isArray(e)&&e||[void 0,void 0];return A.isUri(o)&&Ie.isIPosition(n)?t.openCodeEditor({resource:o},t.getActiveCodeEditor()).then(r=>{r&&(r.setPosition(n),r.invokeWithinContext(s=>(this.reportTelemetry(s,r),this.run(s,r))))},mt):super.runCommand(i,e)}run(i,e){let t=i.get(ne),o=bO.get(e);return o?(t.trace("[RenameAction] got controller, running..."),o.run()):(t.trace("[RenameAction] returning early - controller missing"),Promise.resolve())}};go(bO.ID,bO,4);Jt(zsi);var Gsi=xc.bindToContribution(bO.get);qi(new Gsi({id:"acceptRenameInput",precondition:kle,handler:a=>a.acceptRenameInput(!1),kbOpts:{weight:199,kbExpr:x.and(ue.focus,x.not("isComposing")),primary:3}}));qi(new Gsi({id:"acceptRenameInputWithPreview",precondition:x.and(kle,x.has("config.editor.rename.enablePreview")),handler:a=>a.acceptRenameInput(!0),kbOpts:{weight:199,kbExpr:x.and(ue.focus,x.not("isComposing")),primary:2051}}));qi(new Gsi({id:"cancelRenameInput",precondition:kle,handler:a=>a.cancelRenameInput(),kbOpts:{weight:199,kbExpr:ue.focus,primary:9,secondary:[1033]}}));W(class extends K{constructor(){super({id:"focusNextRenameSuggestion",title:{...L(1540,"Focus Next Rename Suggestion")},precondition:kle,keybinding:[{primary:18,weight:199}]})}run(i){let e=i.get(Kt).getFocusedCodeEditor();if(!e)return;let t=bO.get(e);t&&t.focusNextRenameSuggestion()}});W(class extends K{constructor(){super({id:"focusPreviousRenameSuggestion",title:{...L(1541,"Focus Previous Rename Suggestion")},precondition:kle,keybinding:[{primary:16,weight:199}]})}run(i){let e=i.get(Kt).getFocusedCodeEditor();if(!e)return;let t=bO.get(e);t&&t.focusPreviousRenameSuggestion()}});kS("_executeDocumentRenameProvider",function(a,i,e,...t){let[o]=t;So(typeof o=="string");let{renameProvider:n}=a.get(zt);return Ksi(n,i,e,o)});kS("_executePrepareRename",async function(a,i,e){let{renameProvider:t}=a.get(zt),n=await new bCe(i,e,t).resolveRenameLocation(ve.None);if(n?.rejectReason)throw new Error(n.rejectReason);return n});oe.as(ii.Configuration).registerConfiguration({id:"editor",properties:{"editor.rename.enablePreview":{scope:6,description:d(1539,null),default:!0,type:"boolean"}}});var $wt=ae("renameSymbolTrackerService");var qwt=(t=>(t.no="no",t.yes="yes",t.maybe="maybe",t))(qwt||{});(i=>{function a(e){switch(e){case"no":return"no";case"yes":return"yes";case"maybe":return"maybe";default:return"no"}}i.fromString=a})(qwt||={});var $si=class{constructor(){}inferRename(i,e,t,o){let n=new z(e.startLineNumber,1,e.endLineNumber,i.getLineMaxColumn(e.endLineNumber)),r=e.startColumn-n.startColumn,s=n.endColumn-e.endColumn,l=i.getValueInRange(n),c=i.getValueInRange(new z(n.startLineNumber,n.startColumn,n.startLineNumber,n.startColumn+r))+t+i.getValueInRange(new z(n.endLineNumber,n.endColumn-s,n.endLineNumber,n.endColumn)),u=[],p=[],h,g,f,v=i.getOffsetAt(n.getStartPosition()),{changes:b}=new MM(new bse(l),new bse(c)).ComputeDiff(!0);if(b.length===0)return;let S=[];for(let k of b){if(S.length===0){S.push(k);continue}let T=S[S.length-1],N=k.originalStart-(T.originalStart+T.originalLength);if(N>0){let O=v+T.originalStart+T.originalLength,V=i.getPositionAt(O),U=i.getWordAtPosition(V);if(U){let G=i.getOffsetAt(new Ie(V.lineNumber,U.startColumn)),$=i.getOffsetAt(new Ie(V.lineNumber,U.endColumn)),te=O+N;if(G<=O&&te<=$&&G<=te&&te<=$){T.originalLength=k.originalStart+k.originalLength-T.originalStart,T.modifiedLength=k.modifiedStart+k.modifiedLength-T.modifiedStart;continue}}}S.push(k)}let y=0;for(let k of S){let T=l.substring(k.originalStart,k.originalStart+k.originalLength),N=c.substring(k.modifiedStart,k.modifiedStart+k.modifiedLength),O=v+k.originalStart,V=i.getPositionAt(O),U=O+k.originalLength,G=i.getPositionAt(U),$=z.fromPositions(V,G),te=N.length-k.originalLength;if(/\s/.test(T)){u.push(new Xr($,N)),y+=te;continue}if(T.length>0){o.lastIndex=0;let ke=o.exec(T);if(ke===null||ke.index!==0||ke[0].length!==T.length){u.push(new Xr($,N)),y+=te;continue}}if(/\s/.test(N)){u.push(new Xr($,N)),y+=te;continue}if(N.length>0){o.lastIndex=0;let ke=o.exec(N);if(ke===null||ke.index!==0||ke[0].length!==N.length){u.push(new Xr($,N)),y+=te;continue}}let pe=i.getWordAtPosition(V);if(pe===null){u.push(new Xr($,N)),y+=te;continue}let de=k.originalStart+1,se=k.originalLength===0&&k.modifiedLength>0,Se;if(se&&de===pe.endColumn&&pe.endColumn>pe.startColumn?Se=this.getTokenAtPosition(i,new Ie(V.lineNumber,pe.startColumn)):Se=this.getTokenAtPosition(i,V),pe.startColumn!==Se.range.startColumn||pe.endColumn!==Se.range.endColumn){u.push(new Xr($,N)),y+=te;continue}if(Se.type===0){let ke=i.getValueInRange(Se.range);if(ke.length===0){u.push(new Xr($,N)),y+=te;continue}if(h===void 0)h=ke;else if(h!==ke){u.push(new Xr($,N)),y+=te;continue}let Ee=i.getOffsetAt(Se.range.getStartPosition())-v+y,He=i.getOffsetAt(Se.range.getEndPosition())-v+y;if(ke=c.substring(Ee,He+te),ke.length===0){u.push(new Xr($,N)),y+=te;continue}if(g===void 0)g=ke;else if(g!==ke){u.push(new Xr($,N)),y+=te;continue}f===void 0&&(f=Se.range.getStartPosition()),h!==void 0&&g!==void 0&&h.length>0&&g.length>0&&h!==g?p.push(new Xr(Se.range,g)):p.push(new Xr($,N)),y+=te}else u.push(new Xr($,N)),y+=N.length-k.originalLength}if(h===void 0||g===void 0||f===void 0||h.length===0||g.length===0||h===g)return;o.lastIndex=0;let w=o.exec(h);if(!(w===null||w.index!==0||w[0].length!==h.length)&&(o.lastIndex=0,w=o.exec(g),!(w===null||w.index!==0||w[0].length!==g.length)))return{renames:{edits:p,position:f,oldName:h,newName:g},others:{edits:u}}}getTokenAtPosition(i,e){i.tokenization.tokenizeIfCheap(e.lineNumber);let t=i.tokenization.getLineTokens(e.lineNumber),o=t.findTokenIndexAtOffset(e.column-1);return{type:t.getStandardTokenType(o),range:new z(e.lineNumber,1+t.getStartOffset(o),e.lineNumber,1+t.getEndOffset(o))}}},F4e=class a{constructor(i,e){this.editor=i;this.versionId=e}static create(i,e){let t=i.getFocusedCodeEditor();if(t!==null&&t.getModel()===e)return new a(t,e.getVersionId())}equals(i){return i===void 0?!1:this.editor===i.editor&&this.versionId===i.versionId}},qsi=class{constructor(i,e,t,o,n,r,s,l,c){this._result=void 0;if(this._commandService=e,this._textModel=o,this._state=n,this._requestUuid=t,this._cancellationTokenSource=new $e,l===void 0||c===void 0){this._promise=gQi(i.renameProvider,o,r,s,this._cancellationTokenSource.token);return}else this._promise=this.sendNesRenameRequest(o,r,c,s,l)}get requestUuid(){return this._requestUuid}isValid(i){return this._state.equals(F4e.create(i,this._textModel))}cancel(){this._cancellationTokenSource.cancel()}async getCount(){if(this._cancellationTokenSource.token.isCancellationRequested)return 0;let i=await this.getResult();return i===void 0||this._cancellationTokenSource.token.isCancellationRequested?0:i.edits.length}async getWorkspaceEdit(){return this.getResult()}async getResult(){if(!this._cancellationTokenSource.token.isCancellationRequested&&(this._result===void 0&&(this._result=await this._promise),!(this._result.rejectReason||this._cancellationTokenSource.token.isCancellationRequested)))return this._result}async sendNesRenameRequest(i,e,t,o,n){try{let r=await this._commandService.executeCommand("github.copilot.nes.postRename",i.uri,e,t,o,n);if(r===void 0)return{rejectReason:"Rename failed",edits:[]};let s=[];for(let l of r)for(let c of l.changes){let u=new z(c.range.start.line+1,c.range.start.character+1,c.range.end.line+1,c.range.end.character+1),p=new ja(l.file,new Xr(u,c.newText??o));s.push(p)}return{edits:s}}catch{return{rejectReason:"Rename failed",edits:[]}}}},SCe=class extends C{constructor(e,t,o,n,r,s){super();this._commandService=e;this._languageFeaturesService=t;this._languageConfigurationService=o;this._renameSymbolTrackerService=r;this._codeEditorService=s;this._renameInferenceEngine=new $si;this._renameRunnable=void 0;this._register(qe.registerCommand(soi,async(l,c,u)=>{if(!(u===void 0||!u.isValid(this._codeEditorService)))try{let p=await u.getWorkspaceEdit();if(p===void 0)return;n.apply(p,{reason:c})}finally{this._renameRunnable===u&&(this._renameRunnable=void 0)}}))}async proposeRenameRefactoring(e,t,o){if(!t.supportsRename||t.action?.kind!=="edit"||o.selectedSuggestionInfo||!hQi(this._languageFeaturesService.renameProvider,e))return t;let n=F4e.create(this._codeEditorService,e);if(n===void 0)return t;let r=Date.now(),s=t.action.textReplacement,l=this._languageConfigurationService.getLanguageConfiguration(e.getLanguageId()),c=this._renameInferenceEngine.inferRename(e,s.range,s.text,l.wordDefinition);if(c===void 0||c.renames.edits.length===0)return t;let{oldName:u,newName:p,position:h,edits:g}=c.renames,f=this._renameSymbolTrackerService.trackedWord.get(),v;f!==void 0&&f.model===e&&f.originalWord===u&&f.currentWord===p&&(v=f.currentRange);let b=!1,S=await Wp(this.checkRenamePrecondition(t,e,h,u,p,v),100,()=>{b=!0}),y=this.isRenamePossible(t,S,n,e);if(t.setRenameProcessingInfo({createdRename:y,duration:Date.now()-r,timedOut:b,droppedOtherEdits:y?c.others.edits.length:void 0,droppedRenameEdits:y?g.length-1:void 0}),!y)return t;this._renameRunnable===void 0&&(this._renameRunnable=new qsi(this._languageFeaturesService,this._commandService,t.requestUuid,e,n,h,p,v,v!==void 0?u:void 0));let w=_c.inlineCompletionAccept({nes:t.isInlineEdit,requestUuid:t.requestUuid,providerId:t.source.provider.providerId,languageId:e.getLanguageId(),correlationId:t.getSourceCompletion().correlationId}),k={id:soi,title:d(1367,null),arguments:[w,this._renameRunnable]},T={label:d(1367,null),icon:M.replaceAll,command:k,count:this._renameRunnable.getCount()},N={kind:"edit",range:g[0].range,insertText:g[0].text,snippetInfo:t.snippetInfo,alternativeAction:T,uri:e.uri},O=j1.snapshot(e);return N4e.create(t.withAction(N),O,!1)}async checkRenamePrecondition(e,t,o,n,r,s){let l={canRename:"no",timedOut:!1};try{let c=await this._commandService.executeCommand("github.copilot.nes.prepareRename",t.uri,o,n,r,e.requestUuid,s);if(c===void 0)return l;if(typeof c=="string"){let u=qwt.fromString(c);return u==="yes"||u==="maybe"?{canRename:u,oldName:n,onOldState:!1}:{canRename:u,timedOut:!1}}else return c}catch{return l}}isRenamePossible(e,t,o,n){return t===void 0||t.canRename==="no"||!o.equals(F4e.create(this._codeEditorService,n))?!1:this._renameRunnable===void 0?!0:this._renameRunnable.requestUuid===e.requestUuid?!1:(this._renameRunnable.cancel(),this._renameRunnable=void 0,!0)}};SCe=I([m(0,ge),m(1,zt),m(2,bs),m(3,ma),m(4,$wt),m(5,Kt)],SCe);var V7=class extends C{constructor(e,t,o,n,r,s,l,c,u,p){super();this._textModel=e;this._versionId=t;this._debounceValue=o;this._cursorPosition=n;this._languageConfigurationService=r;this._logService=s;this._configurationService=l;this._instantiationService=c;this._contextKeyService=u;this._textModelService=p;this._updateOperation=this._register(new me);this._state=lQi(this,{initial:()=>({inlineCompletions:BW.createEmpty(),suggestWidgetInlineCompletions:BW.createEmpty()}),disposeFinal:e=>{e.inlineCompletions.dispose(),e.suggestWidgetInlineCompletions.dispose()},changeTracker:z9t(()=>({versionId:this._versionId})),update:(e,t,o)=>{let n=Qc.compose(o.changes.map(r=>r.change?O9(r.change.changes):Qc.empty).filter(mo));if(n.isEmpty())return t;try{return{inlineCompletions:t.inlineCompletions.createStateWithAppliedEdit(n,this._textModel),suggestWidgetInlineCompletions:t.suggestWidgetInlineCompletions.createStateWithAppliedEdit(n,this._textModel)}}finally{t.inlineCompletions.dispose(),t.suggestWidgetInlineCompletions.dispose()}}});this.inlineCompletions=this._state.map(this,e=>e.inlineCompletions);this.suggestWidgetInlineCompletions=this._state.map(this,e=>e.suggestWidgetInlineCompletions);this._completionsEnabled=void 0;this.clearOperationOnTextModelChange=Ce(this,e=>{this._versionId.read(e),this._updateOperation.clear()});this._loadingCount=Le(this,0);this.loading=this._loadingCount.map(this,e=>e>0);this._loggingEnabled=pr("editor.inlineSuggest.logFetch",!1,this._configurationService).recomputeInitiallyAndOnChange(this._store),this._sendRequestData=pr("editor.inlineSuggest.emptyResponseInformation",!0,this._configurationService).recomputeInitiallyAndOnChange(this._store),this._structuredFetchLogger=this._register(this._instantiationService.createInstance(F7.cast(),"editor.inlineSuggest.logFetch.commandId")),this._renameProcessor=this._store.add(this._instantiationService.createInstance(SCe)),this.clearOperationOnTextModelChange.recomputeInitiallyAndOnChange(this._store);let h=to.defaultChatAgent?.completionsEnablementSetting??void 0;h&&(this._updateCompletionsEnablement(h),this._register(this._configurationService.onDidChangeConfiguration(g=>{g.affectsConfiguration(h)&&this._updateCompletionsEnablement(h)}))),this._state.recomputeInitiallyAndOnChange(this._store)}static{this._requestId=0}_updateCompletionsEnablement(e){let t=this._configurationService.getValue(e);yi(t)?this._completionsEnabled=t:this._completionsEnabled=void 0}_log(e){this._loggingEnabled.get()&&this._logService.info(Z8i(e)),this._structuredFetchLogger.log(e)}fetch(e,t,o,n,r,s,l){let c=this._cursorPosition.get(),u=new jsi(c,o,this._textModel.getVersionId(),new Set(e)),p=o.selectedSuggestionInfo?this.suggestWidgetInlineCompletions.get():this.inlineCompletions.get();if(this._updateOperation.value?.request.satisfies(u))return this._updateOperation.value.promise;if(p?.request?.satisfies(u))return Promise.resolve(!0);let h=!!this._updateOperation.value;this._updateOperation.clear();let g=new $e,f=(async()=>{let b=new P;this._loadingCount.set(this._loadingCount.get()+1,void 0);let S=!1,y=()=>{S||(S=!0,this._loadingCount.set(this._loadingCount.get()-1,void 0))};b.add(new Dt(()=>y(),10*1e3)).schedule();let k=e.filter(N=>N.providerId),T=new Qsi(o,l,k);try{let N=this._debounceValue.get(this._textModel),O=Mut(e.map(He=>He.debounceDelayMs),gUi(qd))??N;if((h||r&&o.triggerKind===0)&&await ksi(O,g.token),g.token.isCancellationRequested||this._store.isDisposed||this._textModel.getVersionId()!==u.versionId)return T.setNoSuggestionReasonIfNotSet("canceled:beforeFetch"),!1;let U=V7._requestId++;(this._loggingEnabled.get()||this._structuredFetchLogger.isEnabled.get())&&this._log({sourceId:"InlineCompletions.fetch",kind:"start",requestId:U,modelUri:this._textModel.uri,modelVersion:this._textModel.getVersionId(),context:{triggerKind:o.triggerKind,suggestInfo:o.selectedSuggestionInfo?!0:void 0},time:Date.now(),provider:t});let G=new Date,$=pQi(e,this._cursorPosition.get(),this._textModel,o,l,this._languageConfigurationService);Osi(g.token,()=>$.cancelAndDispose({kind:"tokenCancellation"}));let te=!1,pe=!1,de=[];for await(let He of $.lists)if(He){He.addRef(),b.add(Z(()=>He.removeRef(He.inlineSuggestionsData.length===0?{kind:"empty"}:{kind:"notTaken"})));for(let Ve of He.inlineSuggestionsData){if(pe=!0,!o.includeInlineEdits&&(Ve.isInlineEdit||Ve.showInlineEditMenu)){Ve.setNotShownReason("notInlineEditRequested");continue}if(!o.includeInlineCompletions&&!(Ve.isInlineEdit||Ve.showInlineEditMenu)){Ve.setNotShownReason("notInlineCompletionRequested");continue}Ve.addPerformanceMarker("providerReturned");let Fe=Ve.action?.uri,Qt,Ze;if(Fe&&Fe.toString()!==this._textModel.uri.toString()){let bo=await this._textModelService.createModelReference(Fe);Qt=bo.object.textEditorModel,Ze=bo}else Qt=this._textModel,Ze=void 0;let Ti=j1.snapshot(Qt),ti=N4e.create(Ve,Ti);if(Ze){let bo=_s(ti.identity.onDispose,()=>{Ze?.dispose(),bo.dispose()})}Ve.addPerformanceMarker("itemCreated"),de.push(ti),!ti.isInlineEdit&&!ti.showInlineEditMenu&&o.triggerKind===0&&ti.isVisible(this._textModel,this._cursorPosition.get())&&(te=!0)}if(te)break}de.forEach(He=>He.addPerformanceMarker("providersResolved"));let se=await Promise.all(de.map(async He=>this._renameProcessor.proposeRenameRefactoring(this._textModel,He,o)));if(se.forEach(He=>He.addPerformanceMarker("renameProcessed")),$.cancelAndDispose({kind:"lostRace"}),this._loggingEnabled.get()||this._structuredFetchLogger.isEnabled.get()){let He=$.didAllProvidersReturn,Ve;(g.token.isCancellationRequested||this._store.isDisposed||this._textModel.getVersionId()!==u.versionId)&&(Ve="canceled");let Fe=se.map(Qt=>{let Ze=Qt.getSourceCompletion();if(Ze.doNotLog)return;let Ti={insertText:Ze.insertText,range:Ze.range,additionalTextEdits:Ze.additionalTextEdits,uri:Ze.uri,command:Ze.command,gutterMenuLinkAction:Ze.gutterMenuLinkAction,shownCommand:Ze.shownCommand,completeBracketPairs:Ze.completeBracketPairs,isInlineEdit:Ze.isInlineEdit,showInlineEditMenu:Ze.showInlineEditMenu,showRange:Ze.showRange,warning:Ze.warning,hint:Ze.hint,supportsRename:Ze.supportsRename,correlationId:Ze.correlationId,jumpToPosition:Ze.jumpToPosition};return{...Gk(Ti,ti=>z.isIRange(ti)?z.lift(ti).toString():Ie.isIPosition(ti)?Ie.lift(ti).toString():vse.is(ti)?{$commandId:ti.id}:ti),$providerId:Qt.source.provider.providerId?.toString()}}).filter(Qt=>Qt!==void 0);this._log({sourceId:"InlineCompletions.fetch",kind:"end",requestId:U,durationMs:Date.now()-G.getTime(),error:Ve,result:Fe,time:Date.now(),didAllProvidersReturn:He})}if(T.setRequestUuid($.contextWithUuid.requestUuid),pe)T.setHasProducedSuggestion(),se.length>0&&g.token.isCancellationRequested&&se.forEach(He=>He.setNotShownReasonIfNotSet("canceled:whileAwaitingOtherProviders"));else if(g.token.isCancellationRequested)T.setNoSuggestionReasonIfNotSet("canceled:whileFetching");else{let He=this._contextKeyService.getContextKeyValue("completionsQuotaExceeded");T.setNoSuggestionReasonIfNotSet(He?"completionsQuotaExceeded":"noSuggestion")}let Se=o.earliestShownDateTime-Date.now();if(Se>0&&await ksi(Se,g.token),se.forEach(He=>He.addPerformanceMarker("minShowDelayPassed")),g.token.isCancellationRequested||this._store.isDisposed||this._textModel.getVersionId()!==u.versionId||s.get()){let He=g.token.isCancellationRequested?"canceled:afterMinShowDelay":this._store.isDisposed?"canceled:disposed":this._textModel.getVersionId()!==u.versionId?"canceled:documentChanged":s.get()?"canceled:userJumped":"unknown";return se.forEach(Ve=>Ve.setNotShownReasonIfNotSet(He)),!1}let ke=new Date;this._debounceValue.update(this._textModel,ke.getTime()-G.getTime());let Ee=this._cursorPosition.get();this._updateOperation.clear(),Ui(He=>{let Ve=this._state.get();o.selectedSuggestionInfo?this._state.set({inlineCompletions:BW.createEmpty(),suggestWidgetInlineCompletions:Ve.suggestWidgetInlineCompletions.createStateWithAppliedResults(se,u,this._textModel,Ee,n)},He):this._state.set({inlineCompletions:Ve.inlineCompletions.createStateWithAppliedResults(se,u,this._textModel,Ee,n),suggestWidgetInlineCompletions:BW.createEmpty()},He),Ve.inlineCompletions.dispose(),Ve.suggestWidgetInlineCompletions.dispose()})}finally{b.dispose(),y(),this._sendInlineCompletionsRequestTelemetry(T)}return!0})(),v=new Ysi(u,g,f);return this._updateOperation.value=v,f}clear(e){if(this._store.isDisposed)return;this._updateOperation.clear();let t=this._state.get();this._state.set({inlineCompletions:BW.createEmpty(),suggestWidgetInlineCompletions:BW.createEmpty()},e),t.inlineCompletions.dispose(),t.suggestWidgetInlineCompletions.dispose()}seedInlineCompletionsWithSuggestWidget(){let e=this.inlineCompletions.get(),t=this.suggestWidgetInlineCompletions.get();t&&Ui(o=>{if(!e||(t.request?.versionId??-1)>(e.request?.versionId??-1)){e?.dispose();let n=this._state.get();this._state.set({inlineCompletions:t.clone(),suggestWidgetInlineCompletions:BW.createEmpty()},o),n.inlineCompletions.dispose(),n.suggestWidgetInlineCompletions.dispose()}this.clearSuggestWidgetInlineCompletions(o)})}seedWithCompletion(e,t){let o=this._state.get();this._state.set({inlineCompletions:new BW([e],void 0),suggestWidgetInlineCompletions:BW.createEmpty()},t),o.inlineCompletions.dispose(),o.suggestWidgetInlineCompletions.dispose()}_sendInlineCompletionsRequestTelemetry(e){if(!this._sendRequestData.get()&&!this._contextKeyService.getContextKeyValue("isRunningUnificationExperiment")||e.requestUuid===void 0||e.hasProducedSuggestion||!Zht(this._completionsEnabled,this._textModel.getLanguageId())||!e.providers.some(n=>VW(n.providerId?.extensionId)))return;let t={opportunityId:e.requestUuid,noSuggestionReason:e.noSuggestionReason??"unknown",extensionId:"vscode-core",extensionVersion:"0.0.0",groupId:"empty",shown:!1,skuPlan:e.requestInfo.sku?.plan,skuType:e.requestInfo.sku?.type,editorType:e.requestInfo.editorType,requestReason:e.requestInfo.reason,typingInterval:e.requestInfo.typingInterval,typingIntervalCharacterCount:e.requestInfo.typingIntervalCharacterCount,languageId:e.requestInfo.languageId,selectedSuggestionInfo:!!e.context.selectedSuggestionInfo,availableProviders:e.providers.map(n=>n.providerId?.toString()).filter(mo).join(","),...q1(e.providers.some(n=>VW(n.providerId?.extensionId))),timeUntilProviderRequest:void 0,timeUntilProviderResponse:void 0,viewKind:void 0,preceeded:void 0,superseded:void 0,reason:void 0,acceptedAlternativeAction:void 0,correlationId:void 0,shownDuration:void 0,shownDurationUncollapsed:void 0,timeUntilShown:void 0,partiallyAccepted:void 0,partiallyAcceptedCountSinceOriginal:void 0,partiallyAcceptedRatioSinceOriginal:void 0,partiallyAcceptedCharactersSinceOriginal:void 0,cursorColumnDistance:void 0,cursorLineDistance:void 0,lineCountOriginal:void 0,lineCountModified:void 0,characterCountOriginal:void 0,characterCountModified:void 0,disjointReplacements:void 0,sameShapeReplacements:void 0,longDistanceHintVisible:void 0,longDistanceHintDistance:void 0,notShownReason:void 0,renameCreated:!1,renameDuration:void 0,renameTimedOut:!1,renameDroppedOtherEdits:void 0,renameDroppedRenameEdits:void 0,performanceMarkers:void 0,editKind:void 0},o=this._instantiationService.createInstance(vO);Fwt(o,t)}clearSuggestWidgetInlineCompletions(e){this._updateOperation.value?.request.context.selectedSuggestionInfo&&this._updateOperation.clear()}cancelUpdate(){this._updateOperation.clear()}};V7=I([m(4,bs),m(5,ne),m(6,B),m(7,F),m(8,X),m(9,Nt)],V7);var jsi=class{constructor(i,e,t,o){this.position=i;this.context=e;this.versionId=t;this.providers=o}satisfies(i){return this.position.equals(i.position)&&L9t(this.context.selectedSuggestionInfo,i.context.selectedSuggestionInfo,C6())&&(i.context.triggerKind===0||this.context.triggerKind===1)&&this.versionId===i.versionId&&WVo(i.providers,this.providers)}get isExplicitRequest(){return this.context.triggerKind===1}},Qsi=class{constructor(i,e,t){this.context=i;this.requestInfo=e;this.providers=t;this.hasProducedSuggestion=!1}setRequestUuid(i){this.requestUuid=i}setNoSuggestionReasonIfNotSet(i){this.noSuggestionReason??=i}setHasProducedSuggestion(){this.hasProducedSuggestion=!0}};function WVo(a,i){return[...a].every(e=>i.has(e))}var Ysi=class{constructor(i,e,t){this.request=i;this.cancellationTokenSource=e;this.promise=t}dispose(){this.cancellationTokenSource.cancel()}},BW=class a extends C{constructor(e,t){super();this.inlineCompletions=e;this.request=t;for(let o of this.inlineCompletions)o.addRef();this._register({dispose:()=>{for(let o of this.inlineCompletions)o.removeRef()}})}static createEmpty(){return new a([],void 0)}_findById(e){return this.inlineCompletions.find(t=>t.identity===e)}_findByHash(e){return this.inlineCompletions.find(t=>t.hash===e)}createStateWithAppliedEdit(e,t){let o=this.inlineCompletions.map(n=>n.withEdit(e,t)).filter(mo);return new a(o,this.request)}createStateWithAppliedResults(e,t,o,n,r){let s;if(r){let u=this._findById(r);if(u&&u.canBeReused(o,t.position)){s=u;let p=e.find(h=>h.hash===u.hash);p?e=BVo(p,e):e=[u,...e]}}let l=s?!s.isInlineEdit:e.some(u=>!u.isInlineEdit&&u.isVisible(o,n)),c=[];for(let u of e){let p=this._findByHash(u.hash),h;p&&p!==u?(h=u.withIdentity(p.identity),u.setIsPreceeded(p),p.setEndOfLifeReason({kind:2,userTypingDisagreed:!1,supersededBy:u.getSourceCompletion()})):h=u,l!==h.isInlineEdit&&c.push(h)}return c.sort(tl(u=>u.showInlineEditMenu,Vut)),c=VVo(c,u=>u.semanticId),new a(c,t)}clone(){return new a(this.inlineCompletions,this.request)}};function VVo(a,i){let e=new Set;return a.filter(t=>{let o=i(t);return e.has(o)?!1:(e.add(o),!0)})}function BVo(a,i){let e=i.indexOf(a);return e>-1?[a,...i.slice(0,e),...i.slice(e+1)]:i}var ej=ae("IInlineCompletionsService"),vQi=new Q("inlineCompletions.snoozed",!1,d(192,null)),Ele=class extends C{constructor(e,t){super();this._contextKeyService=e;this._telemetryService=t;this._onDidChangeIsSnoozing=this._register(new E);this.onDidChangeIsSnoozing=this._onDidChangeIsSnoozing.event;this._snoozeTimeEnd=void 0;this._recentCompletionIds=[];this._timer=this._register(new Nl);let o=vQi.bindTo(this._contextKeyService);this._register(this.onDidChangeIsSnoozing(()=>o.set(this.isSnoozing())))}static{this.SNOOZE_DURATION=3e5}get snoozeTimeLeft(){return this._snoozeTimeEnd===void 0?0:Math.max(0,this._snoozeTimeEnd-Date.now())}snooze(e=Ele.SNOOZE_DURATION){this.setSnoozeDuration(e+this.snoozeTimeLeft)}setSnoozeDuration(e){if(e<0)throw new ni(`Invalid snooze duration: ${e}. Duration must be non-negative.`);if(e===0){this.cancelSnooze();return}let t=this.isSnoozing(),o=this.snoozeTimeLeft;this._snoozeTimeEnd=Date.now()+e,t||this._onDidChangeIsSnoozing.fire(!0),this._timer.cancelAndSet(()=>{if(!this.isSnoozing())this._onDidChangeIsSnoozing.fire(!1);else throw new ni("Snooze timer did not fire as expected")},this.snoozeTimeLeft+1),this._reportSnooze(e-o,e)}isSnoozing(){return this.snoozeTimeLeft>0}cancelSnooze(){this.isSnoozing()&&(this._reportSnooze(-this.snoozeTimeLeft,0),this._snoozeTimeEnd=void 0,this._timer.cancel(),this._onDidChangeIsSnoozing.fire(!1))}reportNewCompletion(e){this._lastCompletionId=e,this._recentCompletionIds.unshift(e),this._recentCompletionIds.length>5&&this._recentCompletionIds.pop()}_reportSnooze(e,t){let o=Math.round(e/1e3),n=Math.round(t/1e3);this._telemetryService.publicLog2("inlineCompletions.snooze",{deltaSeconds:o,totalSeconds:n,lastCompletionId:this._lastCompletionId,recentCompletionIds:this._recentCompletionIds})}};Ele=I([m(0,X),m(1,Te)],Ele);we(ej,Ele,1);var HVo="editor.action.inlineSuggest.snooze",UVo="editor.action.inlineSuggest.cancelSnooze",fQi="inlineCompletions.lastSnoozeDuration",jwt=class a extends K{static{this.ID=HVo}constructor(){super({id:a.ID,title:L(191,"Snooze Inline Suggestions"),precondition:x.true(),f1:!0})}async run(i,...e){let t=i.get(Ge),o=i.get(ej),n=i.get(le),r;e.length>0&&typeof e[0]=="number"&&(r=e[0]*6e4),r||(r=await this.getDurationFromUser(t,n)),r&&o.setSnoozeDuration(r)}async getDurationFromUser(i,e){let t=e.getNumber(fQi,0,3e5),o=[{label:"1 minute",id:"1",value:6e4},{label:"5 minutes",id:"5",value:3e5},{label:"10 minutes",id:"10",value:6e5},{label:"15 minutes",id:"15",value:9e5},{label:"30 minutes",id:"30",value:18e5},{label:"60 minutes",id:"60",value:36e5}],n=await i.pick(o,{placeHolder:d(193,null),activeItem:o.find(r=>r.value===t)});if(n)return e.store(fQi,n.value,0,0),n.value}},Qwt=class a extends K{static{this.ID=UVo}constructor(){super({id:a.ID,title:L(190,"Cancel Snooze Inline Suggestions"),precondition:vQi,f1:!0})}async run(i){i.get(ej).cancelSnooze()}};var Ywt=class a extends C{constructor(e){super();this._textModel=e;this._typingSessions=[];this._currentSession=null;this._lastChangeTime=0;this._cachedTypingIntervalResult=null;this._cacheInvalidated=!0;this._register(this._textModel.onDidChangeContent(t=>this._updateTypingSpeed(t)))}static{this.MAX_SESSION_GAP_MS=3e3}static{this.MIN_SESSION_DURATION_MS=1e3}static{this.SESSION_HISTORY_LIMIT=50}static{this.TYPING_SPEED_WINDOW_MS=3e5}static{this.MIN_CHARS_FOR_RELIABLE_SPEED=20}getTypingInterval(){return(this._cacheInvalidated||this._cachedTypingIntervalResult===null)&&(this._cachedTypingIntervalResult=this._calculateTypingInterval(),this._cacheInvalidated=!1),this._cachedTypingIntervalResult}_updateTypingSpeed(e){let t=Date.now();if(!this._isUserTyping(e)){this._finalizeCurrentSession();return}this._currentSession&&t-this._lastChangeTime>a.MAX_SESSION_GAP_MS&&this._finalizeCurrentSession(),this._currentSession||(this._currentSession={startTime:t,endTime:t,characterCount:0}),this._currentSession.endTime=t,this._currentSession.characterCount+=this._getActualCharacterCount(e),this._lastChangeTime=t,this._cacheInvalidated=!0}_getActualCharacterCount(e){let t=0;for(let o of e.changes)t+=Math.max(o.text.length,o.rangeLength);return t}_isUserTyping(e){if(!e.detailedReasons||e.detailedReasons.length===0)return!1;for(let t of e.detailedReasons)if(this._isUserTypingReason(t))return!0;return!1}_isUserTypingReason(e){if(e.metadata.isUndoing||e.metadata.isRedoing)return!1;if(e.metadata.source==="cursor"){let t=e.metadata.kind;return t==="type"||t==="compositionType"||t==="compositionEnd"}else return!1}_finalizeCurrentSession(){if(!this._currentSession)return;this._currentSession.endTime-this._currentSession.startTime>=a.MIN_SESSION_DURATION_MS&&this._currentSession.characterCount>0&&(this._typingSessions.push(this._currentSession),this._typingSessions.length>a.SESSION_HISTORY_LIMIT&&this._typingSessions.shift()),this._currentSession=null}_calculateTypingInterval(){if(this._currentSession){let e={...this._currentSession};if(e.endTime-e.startTime>=a.MIN_SESSION_DURATION_MS&&e.characterCount>0){let o=[...this._typingSessions,e];return this._calculateSpeedFromSessions(o)}}return this._calculateSpeedFromSessions(this._typingSessions)}_calculateSpeedFromSessions(e){if(e.length===0)return{averageInterval:0,characterCount:0};let t=[...e].sort((p,h)=>h.endTime-p.endTime),o=Date.now()-a.TYPING_SPEED_WINDOW_MS,n=t.filter(p=>p.endTime>o),r=t.splice(n.length),s=Zve(n.map(p=>p.characterCount));for(let p=0;p<r.length&&s<a.MIN_CHARS_FOR_RELIABLE_SPEED;p++)n.push(r[p]),s+=r[p].characterCount;let l=Zve(n.map(p=>p.endTime-p.startTime));if(l===0||s<=1)return{averageInterval:0,characterCount:s};let c=Math.max(1,s-1),u=l/c;return{averageInterval:Math.round(u),characterCount:s}}reset(){this._typingSessions.length=0,this._currentSession=null,this._lastChangeTime=0,this._cachedTypingIntervalResult=null,this._cacheInvalidated=!0}dispose(){this._finalizeCurrentSession(),super.dispose()}};var Um=ae("defaultAccountService");var bQi;function SQi(a){return bQi?.(a)??null}function IQi(a){bQi=a}var ICe=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super();this.textModel=e;this._selectedSuggestItem=t;this._textModelVersionId=o;this._positions=n;this._debounceValue=r;this._enabled=s;this._editor=l;this._instantiationService=c;this._commandService=u;this._languageConfigurationService=p;this._accessibilityService=h;this._languageFeaturesService=g;this._codeEditorService=f;this._inlineCompletionsService=v;this._isActive=Le(this,!1);this._onlyRequestInlineEditsSignal=Wc(this);this._forceUpdateExplicitlySignal=Wc(this);this._noDelaySignal=Wc(this);this._fetchSpecificProviderSignal=Wc(this);this._selectedInlineCompletionId=Le(this,void 0);this.primaryPosition=Ce(this,e=>this._positions.read(e)[0]??new Ie(1,1));this.allPositions=Ce(this,e=>this._positions.read(e));this.sku=Le(this,void 0);this._isAcceptingPartially=!1;this._appearedInsideViewport=Ce(this,e=>{let t=this.state.read(e);return!t||!t.inlineSuggestion?!1:eai(this._editor,t.inlineSuggestion)});this._onDidAccept=this._register(new E);this.onDidAccept=this._onDidAccept.event;this._lastShownInlineCompletionInfo=void 0;this._lastAcceptedInlineCompletionInfo=void 0;this._didUndoInlineEdits=Hbe({owner:this,changeTracker:{createChangeSummary:()=>({didUndo:!1}),handleChange:(e,t)=>(t.didUndo=e.didChange(this._textModelVersionId)&&!!e.change?.isUndoing,!0)}},(e,t)=>{let o=this._textModelVersionId.read(e);return o!==null&&this._lastAcceptedInlineCompletionInfo&&this._lastAcceptedInlineCompletionInfo.textModelVersionIdAfter===o-1&&this._lastAcceptedInlineCompletionInfo.inlineCompletion.isInlineEdit&&t.didUndo?(this._lastAcceptedInlineCompletionInfo=void 0,!0):!1});this._preserveCurrentCompletionReasons=new Set([1,0,2]);this.dontRefetchSignal=Wc(this);this._fetchInlineCompletionsPromise=Hbe({owner:this,changeTracker:{createChangeSummary:()=>({dontRefetch:!1,preserveCurrentCompletion:!1,inlineCompletionTriggerKind:0,onlyRequestInlineEdits:!1,shouldDebounce:!0,provider:void 0,changeHint:void 0,textChange:!1,changeReason:""}),handleChange:(e,t)=>{if(e.didChange(this._textModelVersionId)){this._preserveCurrentCompletionReasons.has(this._getReason(e.change))&&(t.preserveCurrentCompletion=!0);let o=e.change?.detailedReasons??[];t.changeReason=o.length>0?o[0].getType():"",t.textChange=!0}else e.didChange(this._forceUpdateExplicitlySignal)?(t.preserveCurrentCompletion=!0,t.inlineCompletionTriggerKind=1):e.didChange(this.dontRefetchSignal)?t.dontRefetch=!0:e.didChange(this._onlyRequestInlineEditsSignal)?t.onlyRequestInlineEdits=!0:e.didChange(this._fetchSpecificProviderSignal)&&(t.provider=e.change?.provider,t.changeHint=e.change?.changeHint);return!0}}},(e,t)=>{if(this._source.clearOperationOnTextModelChange.read(e),this._noDelaySignal.read(e),this.dontRefetchSignal.read(e),this._onlyRequestInlineEditsSignal.read(e),this._forceUpdateExplicitlySignal.read(e),this._fetchSpecificProviderSignal.read(e),!((this._enabled.read(e)&&this._selectedSuggestItem.read(e)||this._isActive.read(e))&&(!this._inlineCompletionsService.isSnoozing()||t.inlineCompletionTriggerKind===1))){this._source.cancelUpdate();return}this._textModelVersionId.read(e);let n=this._source.suggestWidgetInlineCompletions.read(void 0),r=this._selectedSuggestItem.read(e);if(this._shouldShowOnSuggestConflict.read(void 0)&&(r=void 0),n&&!r&&this._source.seedInlineCompletionsWithSuggestWidget(),t.dontRefetch)return Promise.resolve(!0);if(this._didUndoInlineEdits.read(e)&&t.inlineCompletionTriggerKind!==1){Ui(b=>{this._source.clear(b)});return}let s="";t.provider?s+="providerOnDidChange":t.inlineCompletionTriggerKind===1&&(s+="explicit"),t.changeReason&&(s+=s.length>0?`:${t.changeReason}`:t.changeReason);let l=this._typing.getTypingInterval(),c={editorType:this.editorType,startTime:Date.now(),languageId:this.textModel.getLanguageId(),reason:s,typingInterval:l.averageInterval,typingIntervalCharacterCount:l.characterCount,availableProviders:[],sku:this.sku.read(void 0)},u={triggerKind:t.inlineCompletionTriggerKind,selectedSuggestionInfo:r?.toSelectedSuggestionInfo(),includeInlineCompletions:!t.onlyRequestInlineEdits,includeInlineEdits:this._inlineEditsEnabled.read(e),requestIssuedDateTime:c.startTime,earliestShownDateTime:c.startTime+(t.inlineCompletionTriggerKind===1||this.inAcceptFlow.read(void 0)?0:this._minShowDelay.read(void 0)),changeHint:t.changeHint};u.triggerKind===0&&t.textChange&&this.textModel.getAlternativeVersionId()===this._lastShownInlineCompletionInfo?.alternateTextModelVersionId&&(u={...u,includeInlineCompletions:!this._lastShownInlineCompletionInfo.inlineCompletion.isInlineEdit,includeInlineEdits:this._lastShownInlineCompletionInfo.inlineCompletion.isInlineEdit});let p=this.selectedInlineCompletion.read(void 0)??this._inlineSuggestionItems.read(void 0)?.inlineEdit,h=t.preserveCurrentCompletion||p?.forwardStable?p:void 0,g=this._jumpedToId.map(b=>!!b&&b===this._inlineSuggestionItems.read(void 0)?.inlineEdit?.semanticId),f=t.provider?{providers:[t.provider],label:"single:"+t.provider.providerId?.toString()}:{providers:this._languageFeaturesService.inlineCompletionsProvider.all(this.textModel),label:void 0},v=this.getAvailableProviders(f.providers);return c.availableProviders=v.map(b=>b.providerId).filter(mo),this._source.fetch(v,f.label,u,h?.identity,t.shouldDebounce,g,c)});this._inlineSuggestionItems=hs({owner:this},e=>{let t=this._source.inlineCompletions.read(e);if(!t)return;let o=this.primaryPosition.read(e),n,r=[];for(let s of t.inlineCompletions)s.isInlineEdit?n=s:s.isVisible(this.textModel,o)&&r.push(s);return r.length!==0&&(n=void 0),{inlineCompletions:r,inlineEdit:n}});this._inlineCompletionItems=hs({owner:this,equalsFn:lN()},e=>this._inlineSuggestionItems.read(e)?.inlineCompletions??[]);this.selectedInlineCompletionIndex=Ce(this,e=>{let t=this._selectedInlineCompletionId.read(e),o=this._inlineCompletionItems.read(e),n=this._selectedInlineCompletionId===void 0?-1:o.findIndex(r=>r.semanticId===t);return n===-1?(this._selectedInlineCompletionId.set(void 0,void 0),0):n});this.selectedInlineCompletion=Ce(this,e=>{let t=this._inlineCompletionItems.read(e),o=this.selectedInlineCompletionIndex.read(e);return t[o]});this.activeCommands=hs({owner:this,equalsFn:lN()},e=>this.selectedInlineCompletion.read(e)?.source.inlineSuggestions.commands??[]);this.inlineCompletionsCount=Ce(this,e=>{if(this.lastTriggerKind.read(e)===1)return this._inlineCompletionItems.read(e).length});this._hasVisiblePeekWidgets=Ce(this,e=>this._editorObs.openedPeekWidgets.read(e)>0);this._shouldShowOnSuggestConflict=Ce(this,e=>{let t=this._showOnSuggestConflict.read(e);if(t!=="never"&&!!this.selectedInlineCompletion.read(e)){let n=this._selectedSuggestItem.read(e);return n?t==="whenSuggestListIsIncomplete"?n.listIncomplete:!0:!1}return!1});this.state=hs({owner:this,equalsFn:(e,t)=>!e||!t?e===t:e.kind==="ghostText"&&t.kind==="ghostText"?Esi(e.ghostTexts,t.ghostTexts)&&e.inlineSuggestion===t.inlineSuggestion&&e.suggestItem===t.suggestItem:e.kind==="inlineEdit"&&t.kind==="inlineEdit"?e.inlineSuggestion===t.inlineSuggestion:!1},e=>{let t=this.textModel;if(this._suppressInSnippetMode.read(e)&&this._isInSnippetMode.read(e))return;let o=this._inlineSuggestionItems.read(e),n=o?.inlineEdit;if(n){if(this._hasVisiblePeekWidgets.read(e))return;let s=this.primaryPosition.map(p=>ro.fromRangeInclusive(n.targetRange).addMargin(1,1).contains(p.lineNumber)),l=n.action?.kind==="edit"?n.action.stringEdit:void 0,c=l?bp.fromStringEdit(l,new _L(this.textModel)).replacements:[],u=(o.inlineEdit?.command?.id==="vscode.open"||o.inlineEdit?.command?.id==="_workbench.open")&&o.inlineEdit?.command.arguments?.length?A.from(o.inlineEdit?.command.arguments[0]):void 0;return n.originalTextRef.targets(this.textModel)||(u=n.originalTextRef.uri),{kind:"inlineEdit",inlineSuggestion:n,edits:c,cursorAtInlineEdit:s,nextEditUri:u}}let r=this._selectedSuggestItem.read(e);if(!this._shouldShowOnSuggestConflict.read(e)&&r){let s=XM(r.getSingleTextEdit(),t),l=this._computeAugmentation(s,e);if(!this._suggestPreviewEnabled.read(e)&&!l)return;let u=l?.edit??s,p=l?l.edit.text.length-s.text.length:0,h=this._suggestPreviewMode.read(e),g=this._positions.read(e),v=[u,...Xsi(this.textModel,g,u)].map((w,k)=>({edit:w,ghostText:w?_si(w,t,h,g[k],p):void 0})).filter(({edit:w,ghostText:k})=>w!==void 0&&k!==void 0),b=v.map(({edit:w})=>w),S=v.map(({ghostText:w})=>w),y=S[0]??new $1(u.range.endLineNumber,[]);return{kind:"ghostText",edits:b,primaryGhostText:y,ghostTexts:S,inlineSuggestion:l?.completion,suggestItem:r}}else{if(!this._isActive.read(e))return;let s=this.selectedInlineCompletion.read(e);if(!s)return;let l=s.getSingleTextEdit(),c=this._inlineSuggestMode.read(e),u=this._positions.read(e),h=[l,...Xsi(this.textModel,u,l)].map((v,b)=>({edit:v,ghostText:v?_si(v,t,c,u[b],0):void 0})).filter(({edit:v,ghostText:b})=>v!==void 0&&b!==void 0),g=h.map(({edit:v})=>v),f=h.map(({ghostText:v})=>v);return f[0]?{kind:"ghostText",edits:g,primaryGhostText:f[0],ghostTexts:f,inlineSuggestion:s,suggestItem:void 0}:void 0}});this.status=Ce(this,e=>{if(this._source.loading.read(e))return"loading";let t=this.state.read(e);return t?.kind==="ghostText"?"ghostText":t?.kind==="inlineEdit"?"inlineEdit":"noSuggestion"});this.inlineCompletionState=Ce(this,e=>{let t=this.state.read(e);if(!(!t||t.kind!=="ghostText")&&!this._editorObs.inComposition.read(e))return t});this.inlineEditState=Ce(this,e=>{let t=this.state.read(e);if(!(!t||t.kind!=="inlineEdit"))return t});this.inlineEditAvailable=Ce(this,e=>!!this.inlineEditState.read(e));this.warning=Ce(this,e=>this.inlineCompletionState.read(e)?.inlineSuggestion?.warning);this.ghostTexts=hs({owner:this,equalsFn:Esi},e=>{let t=this.inlineCompletionState.read(e);if(t)return t.ghostTexts});this.primaryGhostText=hs({owner:this,equalsFn:Tsi},e=>{let t=this.inlineCompletionState.read(e);if(t)return t?.primaryGhostText});this.showCollapsed=Ce(this,e=>{let t=this.state.read(e);if(!t||t.kind!=="inlineEdit"||t.inlineSuggestion.hint||t.inlineSuggestion.action?.kind==="jumpTo")return!1;let o=t.inlineSuggestion.updatedEditModelVersion===this._textModelVersionId.read(e);return(this._inlineEditsShowCollapsedEnabled.read(e)||!o)&&this._jumpedToId.read(e)!==t.inlineSuggestion.semanticId&&!this._inAcceptFlow.read(e)});this._tabShouldIndent=Ce(this,e=>{if(this._inAcceptFlow.read(e))return!1;function t(r){return r.startLineNumber!==r.endLineNumber}function o(r,s){let l=r.getLineIndentColumn(s),c=r.getLineLastNonWhitespaceColumn(s),u=Math.max(c,l);return new z(s,l,s,u)}return this._editorObs.selections.read(e)?.some(r=>r.isEmpty()?this.textModel.getLineLength(r.startLineNumber)===0:t(r)||r.containsRange(o(this.textModel,r.startLineNumber)))});this.tabShouldJumpToInlineEdit=Ce(this,e=>{if(this._tabShouldIndent.read(e))return!1;let t=this.inlineEditState.read(e);return t?t.inlineSuggestion.action?.kind==="jumpTo"||this.showCollapsed.read(e)?!0:this._inAcceptFlow.read(e)&&this._appearedInsideViewport.read(e)?!1:!t.cursorAtInlineEdit.read(e):!1});this.tabShouldAcceptInlineEdit=Ce(this,e=>{let t=this.inlineEditState.read(e);return!t||t.inlineSuggestion.action?.kind==="jumpTo"||this.showCollapsed.read(e)||this._tabShouldIndent.read(e)?!1:this._inAcceptFlow.read(e)&&this._appearedInsideViewport.read(e)||t.inlineSuggestion.targetRange.startLineNumber===this._editorObs.cursorLineNumber.read(e)||this._jumpedToId.read(e)===t.inlineSuggestion.semanticId?!0:t.cursorAtInlineEdit.read(e)});this._jumpedToId=Le(this,void 0);this._inAcceptFlow=Le(this,!1);this.inAcceptFlow=this._inAcceptFlow;this._source=this._register(this._instantiationService.createInstance(V7,this.textModel,this._textModelVersionId,this._debounceValue,this.primaryPosition)),this.lastTriggerKind=this._source.inlineCompletions.map(this,N=>N?.request?.context.triggerKind),this._editorObs=os(this._editor);let S=this._editorObs.getOption(134);this._suggestPreviewEnabled=S.map(N=>N.preview),this._suggestPreviewMode=S.map(N=>N.previewMode);let y=this._editorObs.getOption(71);this._inlineSuggestMode=y.map(N=>N.mode),this._suppressedInlineCompletionGroupIds=y.map(N=>new Set(N.experimental.suppressInlineSuggestions.split(","))),this._inlineEditsEnabled=y.map(N=>!!N.edits.enabled),this._inlineEditsShowCollapsedEnabled=y.map(N=>N.edits.showCollapsed),this._triggerCommandOnProviderChange=y.map(N=>N.triggerCommandOnProviderChange),this._minShowDelay=y.map(N=>N.minShowDelay),this._showOnSuggestConflict=y.map(N=>N.experimental.showOnSuggestConflict),this._suppressInSnippetMode=y.map(N=>N.suppressInSnippetMode);let w=Qr.get(this._editor);this._isInSnippetMode=w?.isInSnippetObservable??Oo(!1),b.getDefaultAccount().then(KVo(N=>this.sku.set(yQi(N),void 0),this._store)),this._register(b.onDidChangeDefaultAccount(N=>this.sku.set(yQi(N),void 0))),this._typing=this._register(new Ywt(this.textModel)),this._register(this._inlineCompletionsService.onDidChangeIsSnoozing(N=>{N&&this.stop()}));{let N=this.textModel.uri.scheme===Y.vscodeNotebookCell,[O]=this._codeEditorService.listDiffEditors().filter(V=>V.getOriginalEditor().getId()===this._editor.getId()||V.getModifiedEditor().getId()===this._editor.getId());this.isInDiffEditor=!!O,this.editorType=N?"notebook":this.isInDiffEditor?"diffEditor":"textEditor"}this._register(EM(this.state,N=>{N&&N.inlineSuggestion&&this._inlineCompletionsService.reportNewCompletion(N.inlineSuggestion.requestUuid)})),this._register(EM(this._fetchInlineCompletionsPromise)),this._register(he(N=>{this._editorObs.versionId.read(N),this._inAcceptFlow.set(!1,void 0)})),this._register(he(N=>{this.state.map((V,U)=>!V||V.kind==="inlineEdit"&&!V.cursorAtInlineEdit.read(U)).read(N)&&this._jumpedToId.set(void 0,void 0)})),this._register(he(N=>{let O=this.state.map(V=>V?.inlineSuggestion).read(N);O&&O.addPerformanceMarker("activeSuggestion")}));let k=this.inlineEditState.map(N=>N?.inlineSuggestion.semanticId);this._register(he(N=>{k.read(N)&&(this._editor.pushUndoStop(),this._lastShownInlineCompletionInfo={alternateTextModelVersionId:this.textModel.getAlternativeVersionId(),inlineCompletion:this.state.get().inlineSuggestion})}));let T=ui(this._languageFeaturesService.inlineCompletionsProvider.onDidChange,()=>this._languageFeaturesService.inlineCompletionsProvider.all(e));$v(this,T,(N,O)=>{N.onDidChangeInlineCompletions&&O.add(N.onDidChangeInlineCompletions(V=>{if(!this._enabled.get()||(this._codeEditorService.getFocusedCodeEditor()||this._codeEditorService.getActiveCodeEditor())!==this._editor)return;if(this._triggerCommandOnProviderChange.get()){this.trigger(void 0,{onlyFetchInlineEdits:!0});return}let G=this.state.get();G&&(G.inlineSuggestion||G.edits)&&G.inlineSuggestion?.source.provider!==N||Ui($=>{this._fetchSpecificProviderSignal.trigger($,{provider:N,changeHint:V??void 0}),this.trigger($)})}))}).recomputeInitiallyAndOnChange(this._store),this._didUndoInlineEdits.recomputeInitiallyAndOnChange(this._store)}get isAcceptingPartially(){return this._isAcceptingPartially}get editor(){return this._editor}debugGetSelectedSuggestItem(){return this._selectedSuggestItem}getIndentationInfo(e){let t=!1,o=!0,n=this?.primaryGhostText.read(e);if(this?._selectedSuggestItem&&n&&n.parts.length>0){let{column:r,lines:s}=n.parts[0],l=s[0].line,c=this.textModel.getLineIndentColumn(n.lineNumber);if(r<=c){let p=Ap(l);p===-1&&(p=l.length-1),t=p>0;let h=this.textModel.getOptions().tabSize;o=al.visibleColumnFromColumn(l,p+1,h)<h}}return{startsWithIndentation:t,startsWithIndentationLessThanTabSize:o}}_getReason(e){return e?.isUndoing?0:e?.isRedoing?1:this.isAcceptingPartially?2:3}getAvailableProviders(e){let t=this._suppressedInlineCompletionGroupIds.get(),o=e.filter(s=>!(s.groupId&&t.has(s.groupId))),n=new Set;for(let s of o)s.excludesGroupIds?.forEach(l=>n.add(l));let r=[];for(let s of o)s.groupId&&n.has(s.groupId)||r.push(s);return r}async trigger(e,t={}){dN(e,o=>{t.onlyFetchInlineEdits&&this._onlyRequestInlineEditsSignal.trigger(o),t.noDelay&&this._noDelaySignal.trigger(o),this._isActive.set(!0,o),t.explicit&&(this._inAcceptFlow.set(!0,o),this._forceUpdateExplicitlySignal.trigger(o)),t.provider&&this._fetchSpecificProviderSignal.trigger(o,{provider:t.provider,changeHint:t.changeHint})}),await this._fetchInlineCompletionsPromise.get()}async triggerExplicitly(e,t=!1){return this.trigger(e,{onlyFetchInlineEdits:t,explicit:!0})}stop(e="automatic",t){dN(t,o=>{if(e==="explicitCancel"){let n=this.state.get()?.inlineSuggestion;n&&n.reportEndOfLife({kind:1})}this._isActive.set(!1,o),this._source.clear(o)})}_computeAugmentation(e,t){let o=this.textModel,n=this._source.suggestWidgetInlineCompletions.read(t),r=n?n.inlineCompletions.filter(l=>!l.isInlineEdit):[this.selectedInlineCompletion.read(t)].filter(mo);return DT(r,l=>{let c=l.getSingleTextEdit();return c=XM(c,o,z.fromPositions(c.range.getStartPosition(),e.range.getEndPosition())),Nwt(c,e)?{completion:l,edit:c}:void 0})}async _deltaSelectedInlineCompletionIndex(e){await this.triggerExplicitly();let t=this._inlineCompletionItems.get()||[];if(t.length>0){let o=(this.selectedInlineCompletionIndex.get()+e+t.length)%t.length;this._selectedInlineCompletionId.set(t[o].semanticId,void 0)}else this._selectedInlineCompletionId.set(void 0,void 0)}async next(){await this._deltaSelectedInlineCompletionIndex(1)}async previous(){await this._deltaSelectedInlineCompletionIndex(-1)}_getMetadata(e,t,o=void 0){return o?_c.inlineCompletionPartialAccept({nes:e.isInlineEdit,requestUuid:e.requestUuid,providerId:e.source.provider.providerId,languageId:t,type:o,correlationId:e.getSourceCompletion().correlationId}):_c.inlineCompletionAccept({nes:e.isInlineEdit,requestUuid:e.requestUuid,correlationId:e.getSourceCompletion().correlationId,providerId:e.source.provider.providerId,languageId:t})}async accept(e=this._editor,t=!1){if(e.getModel()!==this.textModel)throw new ni;let o,n=!1,r=this.state.get();if(r?.kind==="ghostText"){if(!r||r.primaryGhostText.isEmpty()||!r.inlineSuggestion)return;o=r.inlineSuggestion}else if(r?.kind==="inlineEdit")o=r.inlineSuggestion,n=!!r.nextEditUri;else return;o.addRef();try{let s=!1;if(e.pushUndoStop(),o.originalTextRef.targets(this.textModel)){if(!n){if(o.action?.kind==="edit"){let l=o.action;if(t&&l.alternativeAction){s=!0;let c=l.alternativeAction.command;await this._commandService.executeCommand(c.id,...c.arguments||[]).then(void 0,ss)}else if(l.snippetInfo){let c=Xr.delete(l.textReplacement.range),u=o.additionalTextEdits.map(h=>new Xr(z.lift(h.range),h.text??"")),p=bp.fromParallelReplacementsUnsorted([c,...u]);e.edit(p,this._getMetadata(o,this.textModel.getLanguageId())),e.setPosition(l.snippetInfo.range.getStartPosition(),"inlineCompletionAccept"),Qr.get(e)?.insert(l.snippetInfo.snippet,{undoStopBefore:!1})}else{let c=r.edits,u=c;r.kind==="ghostText"&&(u=oQi(c,this.textModel));let p=xsi(u).map(f=>Yt.fromPositions(f)),h=o.additionalTextEdits.map(f=>new Xr(z.lift(f.range),f.text??"")),g=bp.fromParallelReplacementsUnsorted([...c,...h]);if(e.edit(g,this._getMetadata(o,this.textModel.getLanguageId())),o.hint===void 0&&e.setSelections(r.kind==="inlineEdit"?p.slice(-1):p,"inlineCompletionAccept"),r.kind==="inlineEdit"&&!this._accessibilityService.isMotionReduced()){let f=g.getNewRanges(),v=this._store.add(new Jsi(e,f,()=>{this._store.delete(v)}))}}}}}else{let l=await this._codeEditorService.openCodeEditor({resource:o.originalTextRef.uri},this._editor);if(l){let u=SQi(l)?.model.get();l.focus(),u?.transplantCompletion(o),l.revealLineInCenter(o.targetRange.startLineNumber)}}this._onDidAccept.fire(),this.stop(),o.command&&await this._commandService.executeCommand(o.command.id,...o.command.arguments||[]).then(void 0,ss),s&&this.trigger(void 0),o.reportEndOfLife({kind:0,alternativeAction:t})}finally{o.removeRef(),this._inAcceptFlow.set(!0,void 0),this._lastAcceptedInlineCompletionInfo={textModelVersionIdAfter:this.textModel.getVersionId(),inlineCompletion:o}}}async acceptNextWord(){await this._acceptNext(this._editor,"word",(e,t)=>{let o=this.textModel.getLanguageIdAtPosition(e.lineNumber,e.column),n=this._languageConfigurationService.getLanguageConfiguration(o),r=new RegExp(n.wordDefinition.source,n.wordDefinition.flags.replace("g","")),s=t.match(r),l=0;s&&s.index!==void 0?s.index===0?l=s[0].length:l=s.index:l=t.length;let u=/\s+/g.exec(t);return u&&u.index!==void 0&&u.index+u[0].length<l&&(l=u.index+u[0].length),l},0)}async acceptNextLine(){await this._acceptNext(this._editor,"line",(e,t)=>{let o=t.match(/\n/);return o&&o.index!==void 0?o.index+1:t.length},1)}async _acceptNext(e,t,o,n){if(e.getModel()!==this.textModel)throw new ni;let r=this.inlineCompletionState.get();if(!r||r.primaryGhostText.isEmpty()||!r.inlineSuggestion)return;let s=r.primaryGhostText,l=r.inlineSuggestion;if(l.snippetInfo){await this.accept(e);return}let c=s.parts[0],u=new Ie(s.lineNumber,c.column),p=c.text,h=o(u,p);if(h===p.length&&s.parts.length===1){this.accept(e);return}let g=p.substring(0,h),f=this._positions.get(),v=f[0];l.addRef();try{this._isAcceptingPartially=!0;try{e.pushUndoStop();let w=z.fromPositions(v,u),k=e.getModel().getValueInRange(w)+g,T=new Xr(w,k),N=[T,...Xsi(this.textModel,f,T)].filter(mo),O=xsi(N).map(V=>Yt.fromPositions(V));e.edit(bp.fromParallelReplacementsUnsorted(N),this._getMetadata(l,t)),e.setSelections(O,"inlineCompletionPartialAccept"),e.revealPositionInCenterIfOutsideViewport(e.getPosition(),0)}finally{this._isAcceptingPartially=!1}let b=z.fromPositions(l.editRange.getStartPosition(),Zl.ofText(g).addToPosition(u)),y=e.getModel().getValueInRange(b,1).length;l.reportPartialAccept(y,{kind:n,acceptedLength:y},{characters:h,ratio:h/p.length,count:1})}finally{l.removeRef()}}handleSuggestAccepted(e){let t=XM(e.getSingleTextEdit(),this.textModel),o=this._computeAugmentation(t,void 0);if(!o)return;let r=this.textModel.getValueInRange(o.completion.editRange,1).length+t.text.length;o.completion.reportPartialAccept(t.text.length,{kind:2,acceptedLength:r},{characters:t.text.length,count:1,ratio:1})}extractReproSample(){let e=this.textModel.getValue(),t=this.state.get()?.inlineSuggestion;return{documentValue:e,inlineCompletion:t?.getSourceCompletion()}}jump(){let e=this.inlineEditState.get();if(!e)return;let t=e.inlineSuggestion;if(!t.originalTextRef.targets(this.textModel)){this.accept(this._editor);return}t.addRef();try{Ui(o=>{t.action?.kind==="jumpTo"&&(this.stop(void 0,o),t.reportEndOfLife({kind:0,alternativeAction:!1})),this._jumpedToId.set(e.inlineSuggestion.semanticId,o),this.dontRefetchSignal.trigger(o);let n=e.inlineSuggestion.targetRange,r=n.getStartPosition();if(this._editor.setPosition(r,"inlineCompletions.jump"),n.isSingleLine()&&(e.inlineSuggestion.hint||e.inlineSuggestion.action?.kind==="edit"&&!e.inlineSuggestion.action.textReplacement.text.includes(`
`))||e.inlineSuggestion.action?.kind==="jumpTo")this._editor.revealPosition(r,0);else{let l=new z(n.startLineNumber-1,1,n.endLineNumber+1,1);this._editor.revealRange(l,0)}e.inlineSuggestion.identity.setJumpTo(o),this._editor.focus()})}finally{t.removeRef()}}async handleInlineSuggestionShown(e,t,o,n){await e.reportInlineEditShown(this._commandService,t,o,this.textModel,n)}transplantCompletion(e){e.addRef(),Ui(t=>{this._source.seedWithCompletion(e,t),this._isActive.set(!0,t),this._inAcceptFlow.set(!0,t),this.dontRefetchSignal.trigger(t)})}};ICe=I([m(7,F),m(8,ge),m(9,bs),m(10,Bi),m(11,zt),m(12,Kt),m(13,ej),m(14,Um)],ICe);function Xsi(a,i,e){if(i.length===1)return[];let t=new _L(a),o=t.getTransformer(),n=o.getOffset(i[0]),r=i.slice(1).map(h=>o.getOffset(h));e=e.removeCommonPrefixAndSuffix(t);let s=o.getStringReplacement(e),l=s.replaceRange.start-n,c=s.replaceRange.join(di.emptyAt(n)),u=t.getValueOfOffsetRange(c);return r.map(h=>{let g=h+l,f=g+s.replaceRange.length,v=new di(g,f),b=v.join(di.emptyAt(h));if(t.getValueOfOffsetRange(b)!==u)return;let y=new Hc(v,s.newText);return o.getTextReplacement(y)}).filter(mo)}var Jsi=class extends C{constructor(i,e,t){super(),t&&this._register({dispose:()=>t()}),this._register(os(i).setDecorations(Oo(e.map(r=>({range:r,options:{description:"animation",className:"edits-fadeout-decoration",zIndex:1}})))));let o=new M4e(1,0,1e3,rQi),n=new Awt(o);this._register(he(r=>{let s=n.getValue(r);i.getContainerDomNode().style.setProperty("--animation-opacity",s.toString()),o.isFinished()&&this.dispose()}))}};function eai(a,i,e=void 0){let t=i.targetRange;os(a).scrollTop.read(e);let o=a.getVisibleRanges();return o.length<1?!1:new z(o[0].startLineNumber,o[0].startColumn,o[o.length-1].endLineNumber,o[o.length-1].endColumn).containsRange(t)}function yQi(a){if(a?.entitlementsData?.access_type_sku&&a?.entitlementsData?.copilot_plan)return{type:a.entitlementsData.access_type_sku,plan:a.entitlementsData.copilot_plan}}var Zsi=class{constructor(i){this.handler=i=>this._cb?.(i);this._cb=i}dispose(){this._cb=void 0}};function KVo(a,i){let e=new Zsi(a);return i.add(e),e.handler}var W4e=class{constructor(i){this.name=i}select(i,e,t){if(t.length===0)return 0;let o=t[0].score[0];for(let n=0;n<t.length;n++){let{score:r,completion:s}=t[n];if(r[0]!==o)break;if(s.preselect)return n}return 0}},Xwt=class extends W4e{constructor(){super("first")}memorize(i,e,t){}toJSON(){}fromJSON(){}},tai=class extends W4e{constructor(){super("recentlyUsed");this._cache=new il(300,.66);this._seq=0}memorize(e,t,o){let n=`${e.getLanguageId()}/${o.textLabel}`;this._cache.set(n,{touch:this._seq++,type:o.completion.kind,insertText:o.completion.insertText})}select(e,t,o){if(o.length===0)return 0;let n=e.getLineContent(t.lineNumber).substr(t.column-10,t.column-1);if(/\s$/.test(n))return super.select(e,t,o);let r=o[0].score[0],s=-1,l=-1,c=-1;for(let u=0;u<o.length&&o[u].score[0]===r;u++){let p=`${e.getLanguageId()}/${o[u].textLabel}`,h=this._cache.peek(p);if(h&&h.touch>c&&h.type===o[u].completion.kind&&h.insertText===o[u].completion.insertText&&(c=h.touch,l=u),o[u].completion.preselect&&s===-1)return s=u}return l!==-1?l:s!==-1?s:0}toJSON(){return this._cache.toJSON()}fromJSON(e){this._cache.clear();let t=0;for(let[o,n]of e)n.touch=t,n.type=typeof n.type=="number"?n.type:xU.fromString(n.type),this._cache.set(o,n);this._seq=this._cache.size}},iai=class extends W4e{constructor(){super("recentlyUsedByPrefix");this._trie=Yu.forStrings();this._seq=0}memorize(e,t,o){let{word:n}=e.getWordUntilPosition(t),r=`${e.getLanguageId()}/${n}`;this._trie.set(r,{type:o.completion.kind,insertText:o.completion.insertText,touch:this._seq++})}select(e,t,o){let{word:n}=e.getWordUntilPosition(t);if(!n)return super.select(e,t,o);let r=`${e.getLanguageId()}/${n}`,s=this._trie.get(r);if(s||(s=this._trie.findSubstr(r)),s)for(let l=0;l<o.length;l++){let{kind:c,insertText:u}=o[l].completion;if(c===s.type&&u===s.insertText)return l}return super.select(e,t,o)}toJSON(){let e=[];return this._trie.forEach((t,o)=>e.push([o,t])),e.sort((t,o)=>-(t[1].touch-o[1].touch)).forEach((t,o)=>t[1].touch=o),e.slice(0,200)}fromJSON(e){if(this._trie.clear(),e.length>0){this._seq=e[0][1].touch+1;for(let[t,o]of e)o.type=typeof o.type=="number"?o.type:xU.fromString(o.type),this._trie.set(t,o)}}},tj=class{constructor(i,e){this._storageService=i;this._configService=e;this._disposables=new P;this._persistSoon=new Dt(()=>this._saveState(),500),this._disposables.add(i.onWillSaveState(t=>{t.reason===1&&this._saveState()}))}static{this._strategyCtors=new Map([["recentlyUsedByPrefix",iai],["recentlyUsed",tai],["first",Xwt]])}static{this._storagePrefix="suggest/memories"}dispose(){this._disposables.dispose(),this._persistSoon.dispose()}memorize(i,e,t){this._withStrategy(i,e).memorize(i,e,t),this._persistSoon.schedule()}select(i,e,t){return this._withStrategy(i,e).select(i,e,t)}_withStrategy(i,e){let t=this._configService.getValue("editor.suggestSelection",{overrideIdentifier:i.getLanguageIdAtPosition(e.lineNumber,e.column),resource:i.uri});if(this._strategy?.name!==t){this._saveState();let o=tj._strategyCtors.get(t)||Xwt;this._strategy=new o;try{let r=this._configService.getValue("editor.suggest.shareSuggestSelections")?0:1,s=this._storageService.get(`${tj._storagePrefix}/${t}`,r);s&&this._strategy.fromJSON(JSON.parse(s))}catch{}}return this._strategy}_saveState(){if(this._strategy){let e=this._configService.getValue("editor.suggest.shareSuggestSelections")?0:1,t=JSON.stringify(this._strategy);this._storageService.store(`${tj._storagePrefix}/${this._strategy.name}`,t,e,1)}}};tj=I([m(0,le),m(1,B)],tj);var yCe=ae("ISuggestMemories");we(yCe,tj,1);var ij=class{constructor(i,e){this._editor=i;this._enabled=!1;this._ckAtEnd=ij.AtEnd.bindTo(e),this._configListener=this._editor.onDidChangeConfiguration(t=>t.hasChanged(139)&&this._update()),this._update()}static{this.AtEnd=new Q("atEndOfWord",!1,{type:"boolean",description:d(1651,null)})}dispose(){this._configListener.dispose(),this._selectionListener?.dispose(),this._ckAtEnd.reset()}_update(){let i=this._editor.getOption(139)==="on";if(this._enabled!==i)if(this._enabled=i,this._enabled){let e=()=>{if(!this._editor.hasModel()){this._ckAtEnd.set(!1);return}let t=this._editor.getModel(),o=this._editor.getSelection(),n=t.getWordAtPosition(o.getStartPosition());if(!n){this._ckAtEnd.set(!1);return}this._ckAtEnd.set(n.endColumn===o.getStartPosition().column&&o.getStartPosition().lineNumber===o.getEndPosition().lineNumber)};this._selectionListener=this._editor.onDidChangeCursorSelection(e),e()}else this._selectionListener&&(this._ckAtEnd.reset(),this._selectionListener.dispose(),this._selectionListener=void 0)}};ij=I([m(1,X)],ij);var JM=class{constructor(i,e){this._editor=i;this._index=0;this._ckOtherSuggestions=JM.OtherSuggestions.bindTo(e)}static{this.OtherSuggestions=new Q("hasOtherSuggestions",!1)}dispose(){this.reset()}reset(){this._ckOtherSuggestions.reset(),this._listener?.dispose(),this._model=void 0,this._acceptNext=void 0,this._ignore=!1}set({model:i,index:e},t){if(i.items.length===0){this.reset();return}if(JM._moveIndex(!0,i,e)===e){this.reset();return}this._acceptNext=t,this._model=i,this._index=e,this._listener=this._editor.onDidChangeCursorPosition(()=>{this._ignore||this.reset()}),this._ckOtherSuggestions.set(!0)}static _moveIndex(i,e,t){let o=t;for(let n=e.items.length;n>0&&(o=(o+e.items.length+(i?1:-1))%e.items.length,!(o===t||!e.items[o].completion.additionalTextEdits));n--);return o}next(){this._move(!0)}prev(){this._move(!1)}_move(i){if(this._model)try{this._ignore=!0,this._index=JM._moveIndex(i,this._model,this._index),this._acceptNext({index:this._index,item:this._model.items[this._index],model:this._model})}finally{this._ignore=!1}}};JM=I([m(1,X)],JM);var wCe=class a{async provideSelectionRanges(i,e){let t=[];for(let o of e){let n=[];t.push(n);let r=new Map;await new Promise(s=>a._bracketsRightYield(s,0,i,o,r)),await new Promise(s=>a._bracketsLeftYield(s,0,i,o,r,n))}return t}static{this._maxDuration=30}static{this._maxRounds=2}static _bracketsRightYield(i,e,t,o,n){let r=new Map,s=Date.now();for(;;){if(e>=a._maxRounds){i();break}if(!o){i();break}let l=t.bracketPairs.findNextBracket(o);if(!l){i();break}if(Date.now()-s>a._maxDuration){setTimeout(()=>a._bracketsRightYield(i,e+1,t,o,n));break}if(l.bracketInfo.isOpeningBracket){let u=l.bracketInfo.bracketText,p=r.has(u)?r.get(u):0;r.set(u,p+1)}else{let u=l.bracketInfo.getOpeningBrackets()[0].bracketText,p=r.has(u)?r.get(u):0;if(p-=1,r.set(u,Math.max(0,p)),p<0){let h=n.get(u);h||(h=new Vs,n.set(u,h)),h.push(l.range)}}o=l.range.getEndPosition()}}static _bracketsLeftYield(i,e,t,o,n,r){let s=new Map,l=Date.now();for(;;){if(e>=a._maxRounds&&n.size===0){i();break}if(!o){i();break}let c=t.bracketPairs.findPrevBracket(o);if(!c){i();break}if(Date.now()-l>a._maxDuration){setTimeout(()=>a._bracketsLeftYield(i,e+1,t,o,n,r));break}if(c.bracketInfo.isOpeningBracket){let p=c.bracketInfo.bracketText,h=s.has(p)?s.get(p):0;if(h-=1,s.set(p,Math.max(0,h)),h<0){let g=n.get(p);if(g){let f=g.shift();g.size===0&&n.delete(p);let v=z.fromPositions(c.range.getEndPosition(),f.getStartPosition()),b=z.fromPositions(c.range.getStartPosition(),f.getEndPosition());r.push({range:v}),r.push({range:b}),a._addBracketLeading(t,b,r)}}}else{let p=c.bracketInfo.getOpeningBrackets()[0].bracketText,h=s.has(p)?s.get(p):0;s.set(p,h+1)}o=c.range.getStartPosition()}}static _addBracketLeading(i,e,t){if(e.startLineNumber===e.endLineNumber)return;let o=e.startLineNumber,n=i.getLineFirstNonWhitespaceColumn(o);n!==0&&n!==e.startColumn&&(t.push({range:z.fromPositions(new Ie(o,n),e.getEndPosition())}),t.push({range:z.fromPositions(new Ie(o,1),e.getEndPosition())}));let r=o-1;if(r>0){let s=i.getLineFirstNonWhitespaceColumn(r);s===e.startColumn&&s!==i.getLineLastNonWhitespaceColumn(r)&&(t.push({range:z.fromPositions(new Ie(r,s),e.getEndPosition())}),t.push({range:z.fromPositions(new Ie(r,1),e.getEndPosition())}))}}};var CCe=class a{static{this.None=new class extends a{distance(){return 0}}}static async create(i,e){if(!e.getOption(134).localityBonus||!e.hasModel())return a.None;let t=e.getModel(),o=e.getPosition();if(!i.canComputeWordRanges(t.uri))return a.None;let[n]=await new wCe().provideSelectionRanges(t,[o]);if(n.length===0)return a.None;let r=await i.computeWordRanges(t.uri,n[0].range);if(!r)return a.None;let s=t.getWordUntilPosition(o);return delete r[s.word],new class extends a{distance(l,c){if(!o.equals(e.getPosition()))return 0;if(c.kind===17)return 2<<20;let u=typeof c.label=="string"?c.label:c.label.label,p=r[u];if(JA(p))return 2<<20;let h=cx(p,z.fromPositions(l),z.compareRangesUsingStarts),g=h>=0?p[h]:p[Math.max(0,~h-1)],f=n.length;for(let v of n){if(!z.containsRange(v.range,g))break;f-=1}return f}}}};var V4e=class{constructor(i,e){this.leadingLineContent=i;this.characterCountDelta=e}};var xCe=class a{constructor(i,e,t,o,n,r,s=hq.default,l=void 0){this.clipboardText=l;this._snippetCompareFn=a._compareCompletionItems;this._items=i,this._column=e,this._wordDistance=o,this._options=n,this._refilterKind=1,this._lineContext=t,this._fuzzyScoreOptions=s,r==="top"?this._snippetCompareFn=a._compareCompletionItemsSnippetsUp:r==="bottom"&&(this._snippetCompareFn=a._compareCompletionItemsSnippetsDown)}get lineContext(){return this._lineContext}set lineContext(i){(this._lineContext.leadingLineContent!==i.leadingLineContent||this._lineContext.characterCountDelta!==i.characterCountDelta)&&(this._refilterKind=this._lineContext.characterCountDelta<i.characterCountDelta&&this._filteredItems?2:1,this._lineContext=i)}get items(){return this._ensureCachedState(),this._filteredItems}getItemsByProvider(){return this._ensureCachedState(),this._itemsByProvider}getIncompleteProvider(){this._ensureCachedState();let i=new Set;for(let[e,t]of this.getItemsByProvider())t.length>0&&t[0].container.incomplete&&i.add(e);return i}get stats(){return this._ensureCachedState(),this._stats}_ensureCachedState(){this._refilterKind!==0&&this._createCachedState()}_createCachedState(){this._itemsByProvider=new Map;let i=[],{leadingLineContent:e,characterCountDelta:t}=this._lineContext,o="",n="",r=this._refilterKind===1?this._items:this._filteredItems,s=[],l=!this._options.filterGraceful||r.length>2e3?wL:Qbt;for(let c=0;c<r.length;c++){let u=r[c];if(u.isInvalid)continue;let p=this._itemsByProvider.get(u.provider);p?p.push(u):this._itemsByProvider.set(u.provider,[u]);let h=u.position.column-u.editStart.column,g=h+t-(u.position.column-this._column);if(o.length!==g&&(o=g===0?"":e.slice(-g),n=o.toLowerCase()),u.word=o,g===0)u.score=uv.Default;else{let f=0;for(;f<h;){let v=o.charCodeAt(f);if(v===32||v===9)f+=1;else break}if(f>=g)u.score=uv.Default;else if(typeof u.completion.filterText=="string"){let v=l(o,n,f,u.completion.filterText,u.filterTextLow,0,this._fuzzyScoreOptions);if(!v)continue;Uw(u.completion.filterText,u.textLabel)===0?u.score=v:(u.score=jji(o,n,f,u.textLabel,u.labelLow,0),u.score[0]=v[0])}else{let v=l(o,n,f,u.textLabel,u.labelLow,0,this._fuzzyScoreOptions);if(!v)continue;u.score=v}}u.idx=c,u.distance=this._wordDistance.distance(u.position,u.completion),s.push(u),i.push(u.textLabel.length)}this._filteredItems=s.sort(this._snippetCompareFn),this._refilterKind=0,this._stats={pLabelLen:i.length?r6(i.length-.85,i,(c,u)=>c-u):0}}static _compareCompletionItems(i,e){return i.score[0]>e.score[0]?-1:i.score[0]<e.score[0]?1:i.distance<e.distance?-1:i.distance>e.distance?1:i.idx<e.idx?-1:i.idx>e.idx?1:0}static _compareCompletionItemsSnippetsDown(i,e){if(i.completion.kind!==e.completion.kind){if(i.completion.kind===28)return 1;if(e.completion.kind===28)return-1}return a._compareCompletionItems(i,e)}static _compareCompletionItemsSnippetsUp(i,e){if(i.completion.kind!==e.completion.kind){if(i.completion.kind===28)return-1;if(e.completion.kind===28)return 1}return a._compareCompletionItems(i,e)}};var oj=class{static shouldAutoTrigger(i){if(!i.hasModel())return!1;let e=i.getModel(),t=i.getPosition();e.tokenization.tokenizeIfCheap(t.lineNumber);let o=e.getWordAtPosition(t);return!(!o||o.endColumn!==t.column&&o.startColumn+1!==t.column||!isNaN(Number(o.word)))}constructor(i,e,t){this.leadingLineContent=i.getLineContent(e.lineNumber).substr(0,e.column-1),this.leadingWord=i.getWordUntilPosition(e),this.lineNumber=e.lineNumber,this.column=e.column,this.triggerOptions=t}};function GVo(a,i,e){if(!i.getContextKeyValue(ka.inlineSuggestionVisible.key))return!0;let t=i.getContextKeyValue(ka.suppressSuggestions.key);return t!==void 0?!t:!a.getOption(71).suppressSuggestions}function $Vo(a,i,e){if(!i.getContextKeyValue("inlineSuggestionVisible"))return!0;let t=i.getContextKeyValue(ka.suppressSuggestions.key);return t!==void 0?!t:!a.getOption(71).suppressSuggestions}var Q1=class{constructor(i,e,t,o,n,r,s,l,c){this._editor=i;this._editorWorkerService=e;this._clipboardService=t;this._telemetryService=o;this._logService=n;this._contextKeyService=r;this._configurationService=s;this._languageFeaturesService=l;this._envService=c;this._toDispose=new P;this._triggerCharacterListener=new P;this._triggerQuickSuggest=new Nl;this._triggerState=void 0;this._completionDisposables=new P;this._onDidCancel=new E;this._onDidTrigger=new E;this._onDidSuggest=new E;this.onDidCancel=this._onDidCancel.event;this.onDidTrigger=this._onDidTrigger.event;this.onDidSuggest=this._onDidSuggest.event;this._currentSelection=this._editor.getSelection()||new Yt(1,1,1,1),this._toDispose.add(this._editor.onDidChangeModel(()=>{this._updateTriggerCharacters(),this.cancel()})),this._toDispose.add(this._editor.onDidChangeModelLanguage(()=>{this._updateTriggerCharacters(),this.cancel()})),this._toDispose.add(this._editor.onDidChangeConfiguration(()=>{this._updateTriggerCharacters()})),this._toDispose.add(this._languageFeaturesService.completionProvider.onDidChange(()=>{this._updateTriggerCharacters(),this._updateActiveSuggestSession()}));let u=!1;this._toDispose.add(this._editor.onDidCompositionStart(()=>{u=!0})),this._toDispose.add(this._editor.onDidCompositionEnd(()=>{u=!1,this._onCompositionEnd()})),this._toDispose.add(this._editor.onDidChangeCursorSelection(p=>{u||this._onCursorChange(p)})),this._toDispose.add(this._editor.onDidChangeModelContent(()=>{!u&&this._triggerState!==void 0&&this._refilterCompletionItems()})),this._updateTriggerCharacters()}dispose(){Ue(this._triggerCharacterListener),Ue([this._onDidCancel,this._onDidSuggest,this._onDidTrigger,this._triggerQuickSuggest]),this._toDispose.dispose(),this._completionDisposables.dispose(),this.cancel()}_updateTriggerCharacters(){if(this._triggerCharacterListener.clear(),this._editor.getOption(104)||!this._editor.hasModel()||!this._editor.getOption(137))return;let i=new Map;for(let t of this._languageFeaturesService.completionProvider.all(this._editor.getModel()))for(let o of t.triggerCharacters||[]){let n=i.get(o);if(!n){n=new Set;let r=Q8i();r&&n.add(r),i.set(o,n)}n.add(t)}let e=t=>{if(!$Vo(this._editor,this._contextKeyService,this._configurationService)||oj.shouldAutoTrigger(this._editor))return;if(!t){let r=this._editor.getPosition();t=this._editor.getModel().getLineContent(r.lineNumber).substr(0,r.column-1)}let o="";nN(t.charCodeAt(t.length-1))?Ru(t.charCodeAt(t.length-2))&&(o=t.substr(t.length-2)):o=t.charAt(t.length-1);let n=i.get(o);if(n){let r=new Map;if(this._completionModel)for(let[s,l]of this._completionModel.getItemsByProvider())n.has(s)||r.set(s,l);this.trigger({auto:!0,triggerKind:1,triggerCharacter:o,retrigger:!!this._completionModel,clipboardText:this._completionModel?.clipboardText,completionOptions:{providerFilter:n,providerItemsToReuse:r}})}};this._triggerCharacterListener.add(this._editor.onDidType(e)),this._triggerCharacterListener.add(this._editor.onDidCompositionEnd(()=>e()))}get state(){return this._triggerState?this._triggerState.auto?2:1:0}cancel(i=!1){this._triggerState!==void 0&&(this._triggerQuickSuggest.cancel(),this._requestToken?.cancel(),this._requestToken=void 0,this._triggerState=void 0,this._completionModel=void 0,this._context=void 0,this._onDidCancel.fire({retrigger:i}))}clear(){this._completionDisposables.clear()}_updateActiveSuggestSession(){this._triggerState!==void 0&&(!this._editor.hasModel()||!this._languageFeaturesService.completionProvider.has(this._editor.getModel())?this.cancel():this.trigger({auto:this._triggerState.auto,retrigger:!0}))}_onCursorChange(i){if(!this._editor.hasModel())return;let e=this._currentSelection;if(this._currentSelection=this._editor.getSelection(),!i.selection.isEmpty()||i.reason!==0&&i.reason!==3||i.source!=="keyboard"&&i.source!=="deleteLeft"){this.cancel();return}this._triggerState===void 0&&i.reason===0?(e.containsRange(this._currentSelection)||e.getEndPosition().isBeforeOrEqual(this._currentSelection.getPosition()))&&this._doTriggerQuickSuggest():this._triggerState!==void 0&&i.reason===3&&this._refilterCompletionItems()}_onCompositionEnd(){this._triggerState===void 0?this._doTriggerQuickSuggest():this._refilterCompletionItems()}_doTriggerQuickSuggest(){FW.isAllOff(this._editor.getOption(102))||this._editor.getOption(134).snippetsPreventQuickSuggestions&&Qr.get(this._editor)?.isInSnippet()||(this.cancel(),this._triggerQuickSuggest.cancelAndSet(()=>{if(this._triggerState!==void 0||!oj.shouldAutoTrigger(this._editor)||!this._editor.hasModel()||!this._editor.hasWidgetFocus())return;let i=this._editor.getModel(),e=this._editor.getPosition(),t=this._editor.getOption(102);if(!FW.isAllOff(t)){if(!FW.isAllOn(t)){i.tokenization.tokenizeIfCheap(e.lineNumber);let o=i.tokenization.getLineTokens(e.lineNumber),n=o.getStandardTokenType(o.findTokenIndexAtOffset(Math.max(e.column-1-1,0)));if(FW.valueFor(t,n)!=="on"&&(FW.valueFor(t,n)!=="offWhenInlineCompletions"||this._languageFeaturesService.inlineCompletionsProvider.has(i)&&this._editor.getOption(71).enabled))return}GVo(this._editor,this._contextKeyService,this._configurationService)&&this._languageFeaturesService.completionProvider.has(i)&&this.trigger({auto:!0})}},this._editor.getOption(103)))}_refilterCompletionItems(){So(this._editor.hasModel()),So(this._triggerState!==void 0);let i=this._editor.getModel(),e=this._editor.getPosition(),t=new oj(i,e,{...this._triggerState,refilter:!0});this._onNewContext(t)}trigger(i){if(!this._editor.hasModel())return;let e=this._editor.getModel(),t=new oj(e,this._editor.getPosition(),i);this.cancel(i.retrigger),this._triggerState=i,this._onDidTrigger.fire({auto:i.auto,shy:i.shy??!1,position:this._editor.getPosition()}),this._context=t;let o={triggerKind:i.triggerKind??0};i.triggerCharacter&&(o={triggerKind:1,triggerCharacter:i.triggerCharacter}),this._requestToken=new $e;let n=this._editor.getOption(128),r=1;switch(n){case"top":r=0;break;case"bottom":r=2;break}let{itemKind:s,showDeprecated:l}=Q1.createSuggestFilter(this._editor),c=new Jq(r,i.completionOptions?.kindFilter??s,i.completionOptions?.providerFilter,i.completionOptions?.providerItemsToReuse,l),u=CCe.create(this._editorWorkerService,this._editor),p=Sle(this._languageFeaturesService.completionProvider,e,this._editor.getPosition(),c,o,this._requestToken.token);Promise.all([p,u]).then(async([h,g])=>{if(this._requestToken?.dispose(),!this._editor.hasModel()){h.disposable.dispose();return}let f=i?.clipboardText;if(!f&&h.needsClipboard&&(f=await this._clipboardService.readText()),this._triggerState===void 0){h.disposable.dispose();return}let v=this._editor.getModel(),b=new oj(v,this._editor.getPosition(),i),S={...hq.default,firstMatchCanBeWeak:!this._editor.getOption(134).matchOnWordStartOnly};if(this._completionModel=new xCe(h.items,this._context.column,{leadingLineContent:b.leadingLineContent,characterCountDelta:b.column-this._context.column},g,this._editor.getOption(134),this._editor.getOption(128),S,f),this._completionDisposables.add(h.disposable),this._onNewContext(b),this._reportDurationsTelemetry(h.durations),!this._envService.isBuilt||this._envService.isExtensionDevelopment)for(let y of h.items)y.isInvalid&&this._logService.warn(`[suggest] did IGNORE invalid completion item from ${y.provider._debugDisplayName}`,y.completion)}).catch(mt)}_reportDurationsTelemetry(i){Math.random()>1e-4||setTimeout(()=>{this._telemetryService.publicLog2("suggest.durations.json",{data:JSON.stringify(i)}),this._logService.debug("suggest.durations.json",i)})}static createSuggestFilter(i){let e=new Set;i.getOption(128)==="none"&&e.add(28);let o=i.getOption(134);return o.showMethods||e.add(0),o.showFunctions||e.add(1),o.showConstructors||e.add(2),o.showFields||e.add(3),o.showVariables||e.add(4),o.showClasses||e.add(5),o.showStructs||e.add(6),o.showInterfaces||e.add(7),o.showModules||e.add(8),o.showProperties||e.add(9),o.showEvents||e.add(10),o.showOperators||e.add(11),o.showUnits||e.add(12),o.showValues||e.add(13),o.showConstants||e.add(14),o.showEnums||e.add(15),o.showEnumMembers||e.add(16),o.showKeywords||e.add(17),o.showWords||e.add(18),o.showColors||e.add(19),o.showFiles||e.add(20),o.showReferences||e.add(21),o.showColors||e.add(22),o.showFolders||e.add(23),o.showTypeParameters||e.add(24),o.showSnippets||e.add(28),o.showUsers||e.add(25),o.showIssues||e.add(26),{itemKind:e,showDeprecated:o.showDeprecated}}_onNewContext(i){if(this._context){if(i.lineNumber!==this._context.lineNumber){this.cancel();return}if(bl(i.leadingLineContent)!==bl(this._context.leadingLineContent)){this.cancel();return}if(i.column<this._context.column){i.leadingWord.word?this.trigger({auto:this._context.triggerOptions.auto,retrigger:!0}):this.cancel();return}if(this._completionModel){if(i.leadingWord.word.length!==0&&i.leadingWord.startColumn>this._context.leadingWord.startColumn){if(oj.shouldAutoTrigger(this._editor)&&this._context){let t=this._completionModel.getItemsByProvider();this.trigger({auto:this._context.triggerOptions.auto,retrigger:!0,clipboardText:this._completionModel.clipboardText,completionOptions:{providerItemsToReuse:t}})}return}if(i.column>this._context.column&&this._completionModel.getIncompleteProvider().size>0&&i.leadingWord.word.length!==0){let e=new Map,t=new Set;for(let[o,n]of this._completionModel.getItemsByProvider())n.length>0&&n[0].container.incomplete?t.add(o):e.set(o,n);this.trigger({auto:this._context.triggerOptions.auto,triggerKind:2,retrigger:!0,clipboardText:this._completionModel.clipboardText,completionOptions:{providerFilter:t,providerItemsToReuse:e}})}else{let e=this._completionModel.lineContext,t=!1;if(this._completionModel.lineContext={leadingLineContent:i.leadingLineContent,characterCountDelta:i.column-this._context.column},this._completionModel.items.length===0){let o=oj.shouldAutoTrigger(this._editor);if(!this._context){this.cancel();return}if(o&&this._context.leadingWord.endColumn<i.leadingWord.startColumn){this.trigger({auto:this._context.triggerOptions.auto,retrigger:!0});return}if(this._context.triggerOptions.auto){this.cancel();return}else if(this._completionModel.lineContext=e,t=this._completionModel.items.length>0,t&&i.leadingWord.word.length===0){this.cancel();return}}this._onDidSuggest.fire({completionModel:this._completionModel,triggerOptions:i.triggerOptions,isFrozen:t})}}}}};Q1=I([m(1,$s),m(2,Wi),m(3,Te),m(4,ne),m(5,X),m(6,B),m(7,zt),m(8,Co)],Q1);var Jwt=class{constructor(i,e,t,o){this._disposables=new P;this._disposables.add(t.onDidSuggest(n=>{n.completionModel.items.length===0&&this.reset()})),this._disposables.add(t.onDidCancel(n=>{this.reset()})),this._disposables.add(e.onDidShow(()=>this._onItem(e.getFocusedItem()))),this._disposables.add(e.onDidFocus(this._onItem,this)),this._disposables.add(e.onDidHide(this.reset,this)),this._disposables.add(i.onWillType(n=>{if(this._active&&!e.isFrozen()&&t.state!==0){let r=n.charCodeAt(n.length-1);this._active.acceptCharacters.has(r)&&i.getOption(0)&&o(this._active.item)}}))}_onItem(i){if(!i||!dr(i.item.completion.commitCharacters)){this.reset();return}if(this._active&&this._active.item.item===i.item)return;let e=new D$;for(let t of i.item.completion.commitCharacters)t.length>0&&e.add(t.charCodeAt(0));this._active={acceptCharacters:e,item:i}}reset(){this._active=void 0}dispose(){this._disposables.dispose()}};var Zwt=class a{constructor(i,e){this._disposables=new P;this._lastOvertyped=[];this._locked=!1;this._disposables.add(i.onWillType(()=>{if(this._locked||!i.hasModel())return;let t=i.getSelections(),o=t.length,n=!1;for(let s=0;s<o;s++)if(!t[s].isEmpty()){n=!0;break}if(!n){this._lastOvertyped.length!==0&&(this._lastOvertyped.length=0);return}this._lastOvertyped=[];let r=i.getModel();for(let s=0;s<o;s++){let l=t[s];if(r.getValueLengthInRange(l)>a._maxSelectionLength)return;this._lastOvertyped[s]={value:r.getValueInRange(l),multiline:l.startLineNumber!==l.endLineNumber}}})),this._disposables.add(e.onDidTrigger(t=>{this._locked=!0})),this._disposables.add(e.onDidCancel(t=>{this._locked=!1}))}static{this._maxSelectionLength=51200}getLastOvertypedInfo(i){if(i>=0&&i<this._lastOvertyped.length)return this._lastOvertyped[i]}dispose(){this._disposables.dispose()}};var nj=class{constructor(i,e,t,o,n,r){this._menuId=e;this._menuService=n;this._contextKeyService=r;this._menuDisposables=new P;this.element=R(i,_(".suggest-status-bar"));let s=(l=>t?.showIconsNoKeybindings?l instanceof Eo?o.createInstance(ml,l,void 0):void 0:l instanceof Eo?o.createInstance(WSt,l,{useComma:!1}):void 0);this._leftActions=new ji(this.element,{actionViewItemProvider:s}),this._rightActions=new ji(this.element,{actionViewItemProvider:s}),this._leftActions.domNode.classList.add("left"),this._rightActions.domNode.classList.add("right")}dispose(){this._menuDisposables.dispose(),this._leftActions.dispose(),this._rightActions.dispose(),this.element.remove()}show(){let i=this._menuService.createMenu(this._menuId,this._contextKeyService),e=()=>{let t=[],o=[];for(let[n,r]of i.getActions())n==="left"?t.push(...r):o.push(...r);this._leftActions.clear(),this._leftActions.push(t),this._rightActions.clear(),this._rightActions.push(o)};this._menuDisposables.add(i.onDidChange(()=>e())),this._menuDisposables.add(i)}hide(){this._menuDisposables.clear()}};nj=I([m(3,F),m(4,qt),m(5,X)],nj);function B4e(a){return!!a&&!!(a.completion.documentation||a.completion.detail&&a.completion.detail!==a.completion.label)}var kCe=class{constructor(i,e,t){this._editor=i;this._themeService=e;this._markdownRendererService=t;this._onDidClose=new E;this.onDidClose=this._onDidClose.event;this._onDidChangeContents=new E;this.onDidChangeContents=this._onDidChangeContents.event;this._disposables=new P;this._renderDisposeable=new P;this._size=new ai(330,0);this.domNode=_(".suggest-details"),this.domNode.classList.add("no-docs"),this._body=_(".body"),this._scrollbar=new Pa(this._body,{alwaysConsumeMouseWheel:!0}),R(this.domNode,this._scrollbar.getDomNode()),this._disposables.add(this._scrollbar),this._header=R(this._body,_(".header")),this._close=R(this._header,_("span"+q.asCSSSelector(M.close))),this._close.title=d(1647,null),this._close.role="button",this._close.tabIndex=-1,this._type=R(this._header,_("p.type")),this._docs=R(this._body,_("p.docs")),this._configureFont(),this._disposables.add(this._editor.onDidChangeConfiguration(o=>{o.hasChanged(59)&&this._configureFont()}))}dispose(){this._disposables.dispose(),this._renderDisposeable.dispose(),this._onDidClose.dispose(),this._onDidChangeContents.dispose()}_configureFont(){let i=this._editor.getOptions(),e=i.get(59),t=e.getMassagedFontFamily(),o=i.get(135)||e.fontSize,n=i.get(136)||e.lineHeight,r=e.fontWeight,s=`${o}px`,l=`${n}px`;this.domNode.style.fontSize=s,this.domNode.style.lineHeight=`${n/o}`,this.domNode.style.fontWeight=r,this.domNode.style.fontFeatureSettings=e.fontFeatureSettings,this._type.style.fontFamily=t,this._close.style.height=l,this._close.style.width=l}getLayoutInfo(){let i=this._editor.getOption(136)||this._editor.getOption(59).lineHeight,e=Ug(this._themeService.getColorTheme().type)?2:1,t=e*2;return{lineHeight:i,borderWidth:e,borderHeight:t,verticalPadding:22,horizontalPadding:14}}renderLoading(){this._type.textContent=d(1648,null),this._docs.textContent="",this.domNode.classList.remove("no-docs","no-type"),this.layout(this.size.width,this.getLayoutInfo().lineHeight*2),this._onDidChangeContents.fire(this)}renderItem(i,e){this._renderDisposeable.clear();let{detail:t,documentation:o}=i.completion;if(e){let n="";n+=`score: ${i.score[0]}
`,n+=`prefix: ${i.word??"(no prefix)"}
`,n+=`word: ${i.completion.filterText?i.completion.filterText+" (filterText)":i.textLabel}
`,n+=`distance: ${i.distance} (localityBonus-setting)
`,n+=`index: ${i.idx}, based on ${i.completion.sortText&&`sortText: "${i.completion.sortText}"`||"label"}
`,n+=`commit_chars: ${i.completion.commitCharacters?.join("")}
`,o=new xe().appendCodeblock("empty",n),t=`Provider: ${i.provider._debugDisplayName}`}if(!e&&!B4e(i)){this.clearContents();return}if(this.domNode.classList.remove("no-docs","no-type"),t){let n=t.length>1e5?`${t.substr(0,1e5)}\u2026`:t;this._type.textContent=n,this._type.title=n,bn(this._type),this._type.classList.toggle("auto-wrap",!/\r?\n^\s+/gmi.test(n))}else Rt(this._type),this._type.title="",xo(this._type),this.domNode.classList.add("no-type");if(Rt(this._docs),typeof o=="string")this._docs.classList.remove("markdown-docs"),this._docs.textContent=o;else if(o){this._docs.classList.add("markdown-docs"),Rt(this._docs);let n=this._markdownRendererService.render(o,{context:this._editor,asyncRenderCallback:()=>{this.layout(this._size.width,this._type.clientHeight+this._docs.clientHeight),this._onDidChangeContents.fire(this)}});this._docs.appendChild(n.element),this._renderDisposeable.add(n)}this.domNode.classList.toggle("detail-and-doc",!!t&&!!o),this.domNode.style.userSelect="text",this.domNode.tabIndex=-1,this._close.onmousedown=n=>{n.preventDefault(),n.stopPropagation()},this._close.onclick=n=>{n.preventDefault(),n.stopPropagation(),this._onDidClose.fire()},this._body.scrollTop=0,this.layout(this._size.width,this._type.clientHeight+this._docs.clientHeight),this._onDidChangeContents.fire(this)}clearContents(){this.domNode.classList.add("no-docs"),this._type.textContent="",this._docs.textContent=""}get isEmpty(){return this.domNode.classList.contains("no-docs")}get size(){return this._size}layout(i,e){let t=new ai(i,e);ai.equals(t,this._size)||(this._size=t,fN(this.domNode,i,e)),this._scrollbar.scanDomNode()}scrollDown(i=8){this._body.scrollTop+=i}scrollUp(i=8){this._body.scrollTop-=i}scrollTop(){this._body.scrollTop=0}scrollBottom(){this._body.scrollTop=this._body.scrollHeight}pageDown(){this.scrollDown(80)}pageUp(){this.scrollUp(80)}focus(){this.domNode.focus()}};kCe=I([m(1,De),m(2,Qn)],kCe);var eCt=class{constructor(i,e){this.widget=i;this._editor=e;this.allowEditorOverflow=!0;this._disposables=new P;this._added=!1;this._preferAlignAtTop=!0;this._resizable=new nO,this._resizable.domNode.classList.add("suggest-details-container"),this._resizable.domNode.appendChild(i.domNode),this._resizable.enableSashes(!1,!0,!0,!1);let t,o,n=0,r=0;this._disposables.add(this._resizable.onDidWillResize(()=>{t=this._topLeft,o=this._resizable.size})),this._disposables.add(this._resizable.onDidResize(s=>{if(t&&o){this.widget.layout(s.dimension.width,s.dimension.height);let l=!1;s.west&&(r=o.width-s.dimension.width,l=!0),s.north&&(n=o.height-s.dimension.height,l=!0),l&&this._applyTopLeft({top:t.top+n,left:t.left+r})}s.done&&(t=void 0,o=void 0,n=0,r=0,this._userSize=s.dimension)})),this._disposables.add(this.widget.onDidChangeContents(()=>{this._anchorBox&&this._placeAtAnchor(this._anchorBox,this._userSize??this.widget.size,this._preferAlignAtTop)}))}dispose(){this._resizable.dispose(),this._disposables.dispose(),this.hide()}getId(){return"suggest.details"}getDomNode(){return this._resizable.domNode}getPosition(){return this._topLeft?{preference:this._topLeft}:null}show(){this._added||(this._editor.addOverlayWidget(this),this._added=!0)}hide(i=!1){this._resizable.clearSashHoverState(),this._added&&(this._editor.removeOverlayWidget(this),this._added=!1,this._anchorBox=void 0,this._topLeft=void 0),i&&(this._userSize=void 0,this.widget.clearContents())}placeAtAnchor(i,e){let t=i.getBoundingClientRect();this._anchorBox=t,this._preferAlignAtTop=e,this._placeAtAnchor(this._anchorBox,this._userSize??this.widget.size,e)}_placeAtAnchor(i,e,t){let o=Fm(this.getDomNode().ownerDocument.body),n=this.widget.getLayoutInfo(),r=new ai(220,2*n.lineHeight),s=i.top,l=(function(){let O=o.width-(i.left+i.width+n.borderWidth+n.horizontalPadding),V=-n.borderWidth+i.left+i.width,U=new ai(O,o.height-i.top-n.borderHeight-n.verticalPadding),G=U.with(void 0,i.top+i.height-n.borderHeight-n.verticalPadding);return{top:s,left:V,fit:O-e.width,maxSizeTop:U,maxSizeBottom:G,minSize:r.with(Math.min(O,r.width))}})(),c=(function(){let O=i.left-n.borderWidth-n.horizontalPadding,V=Math.max(n.horizontalPadding,i.left-e.width-n.borderWidth),U=new ai(O,o.height-i.top-n.borderHeight-n.verticalPadding),G=U.with(void 0,i.top+i.height-n.borderHeight-n.verticalPadding);return{top:s,left:V,fit:O-e.width,maxSizeTop:U,maxSizeBottom:G,minSize:r.with(Math.min(O,r.width))}})(),u=(function(){let O=i.left,V=-n.borderWidth+i.top+i.height,U=new ai(i.width-n.borderHeight,o.height-i.top-i.height-n.verticalPadding);return{top:V,left:O,fit:U.height-e.height,maxSizeBottom:U,maxSizeTop:U,minSize:r.with(U.width)}})(),p=(function(){let O=i.left,V=new ai(i.width-n.borderHeight,i.top-n.verticalPadding);return{top:Math.max(n.verticalPadding,i.top-e.height),left:O,fit:V.height-e.height,maxSizeTop:V,maxSizeBottom:V,minSize:r.with(V.width)}})(),g=[l,c,t?u:p],f=g.find(O=>O.fit>=0)??g.sort((O,V)=>V.fit-O.fit)[0],v=i.top+i.height-n.borderHeight,b,S=e.height,y=Math.max(f.maxSizeTop.height,f.maxSizeBottom.height);S>y&&(S=y);let w;t?S<=f.maxSizeTop.height?(b=!0,w=f.maxSizeTop):(b=!1,w=f.maxSizeBottom):S<=f.maxSizeBottom.height?(b=!1,w=f.maxSizeBottom):(b=!0,w=f.maxSizeTop);let{top:k,left:T}=f;f===p?k=i.top-S+n.borderWidth:!b&&S>i.height&&(k=v-S);let N=this._editor.getDomNode();if(N){let O=N.getBoundingClientRect();k-=O.top,T-=O.left}this._applyTopLeft({left:T,top:k}),f===p?this._resizable.enableSashes(!0,!1,!1,!0):this._resizable.enableSashes(!b,f===l,b,f!==l),this._resizable.minSize=f.minSize,this._resizable.maxSize=w,this._resizable.layout(S,Math.min(w.width,e.width)),this.widget.layout(this._resizable.size.width,this._resizable.size.height)}_applyTopLeft(i){this._topLeft=i,this._editor.layoutOverlayWidget(this)}};var jVo=/(?:\/|^)(?:([^\/]+)\/)?([^\/]+)$/;function js(a,i,e,t,o){if(q.isThemeIcon(o))return[`codicon-${o.id}`,"predefined-file-icon"];if(A.isUri(o))return[];let n=t===2?["rootfolder-icon"]:t===1?["folder-icon"]:["file-icon"];if(e){let r;if(e.scheme===Y.data)r=g$.parseMetaData(e).get(g$.META_DATA_LABEL);else{let s=e.path.match(jVo);s?(r=Tle(s[2].toLowerCase()),s[1]&&n.push(`${Tle(s[1].toLowerCase())}-name-dir-icon`)):r=Tle(e.authority.toLowerCase())}if(t===2)n.push(`${r}-root-name-folder-icon`);else if(t===1)n.push(`${r}-name-folder-icon`);else{if(r){if(n.push(`${r}-name-file-icon`),n.push("name-file-icon"),r.length<=255){let l=r.split(".");for(let c=1;c<l.length;c++)n.push(`${l.slice(c).join(".")}-ext-file-icon`)}n.push("ext-file-icon")}let s=QVo(a,i,e);s&&n.push(`${Tle(s)}-lang-file-icon`)}}return n}function Y1(a){return["file-icon",`${Tle(a)}-lang-file-icon`]}function QVo(a,i,e){if(!e)return null;let t=null;if(e.scheme===Y.data){let n=g$.parseMetaData(e).get(g$.META_DATA_MIME);n&&(t=i.getLanguageIdByMimeType(n))}else{let o=a.getModel(e);o&&(t=o.getLanguageId())}return t&&t!==Fr?t:i.guessLanguageIdByFilepathOrFirstLine(e)}function Tle(a){return a.replace(/[\s]/g,"/")}var YVo=Re("suggest-more-info",M.chevronRight,d(1650,null)),XVo=new class H4e{static{this._regexRelaxed=/(#([\da-fA-F]{3}){1,2}|(rgb|hsl)a\(\s*(\d{1,3}%?\s*,\s*){3}(1|0?\.\d+)\)|(rgb|hsl)\(\s*\d{1,3}%?(\s*,\s*\d{1,3}%?){2}\s*\))/}static{this._regexStrict=new RegExp(`^${H4e._regexRelaxed.source}$`,"i")}extract(i,e){if(i.textLabel.match(H4e._regexStrict))return e[0]=i.textLabel,!0;if(i.completion.detail&&i.completion.detail.match(H4e._regexStrict))return e[0]=i.completion.detail,!0;if(i.completion.documentation){let t=typeof i.completion.documentation=="string"?i.completion.documentation:i.completion.documentation.value,o=H4e._regexRelaxed.exec(t);if(o&&(o.index===0||o.index+o[0].length===t.length))return e[0]=o[0],!0}return!1}},ECe=class{constructor(i,e,t,o){this._editor=i;this._modelService=e;this._languageService=t;this._themeService=o;this._onDidToggleDetails=new E;this.onDidToggleDetails=this._onDidToggleDetails.event;this.templateId="suggestion"}dispose(){this._onDidToggleDetails.dispose()}renderTemplate(i){let e=new P,t=i;t.classList.add("show-file-icons");let o=R(i,_(".icon")),n=R(o,_("span.colorspan")),r=R(i,_(".contents")),s=R(r,_(".main")),l=R(s,_(".icon-label.codicon")),c=R(s,_("span.left")),u=R(s,_("span.right")),p=new Lc(c,{supportHighlights:!0,supportIcons:!0});e.add(p);let h=R(c,_("span.signature-label")),g=R(c,_("span.qualifier-label")),f=R(u,_("span.details-label")),v=R(u,_("span.readMore"+q.asCSSSelector(YVo)));return v.title=d(1649,null),{root:t,left:c,right:u,icon:o,colorspan:n,iconLabel:p,iconContainer:l,parametersLabel:h,qualifierLabel:g,detailsLabel:f,readMore:v,disposables:e,configureFont:()=>{let S=this._editor.getOptions(),y=S.get(59),w=y.getMassagedFontFamily(),k=y.fontFeatureSettings,T=y.fontVariationSettings,N=S.get(135)||y.fontSize,O=S.get(136)||y.lineHeight,V=y.fontWeight,U=y.letterSpacing,G=`${N}px`,$=`${O}px`,te=`${U}px`;t.style.fontSize=G,t.style.fontWeight=V,t.style.letterSpacing=te,s.style.fontFamily=w,s.style.fontFeatureSettings=k,s.style.fontVariationSettings=T,s.style.lineHeight=$,o.style.height=$,o.style.width=$,v.style.height=$,v.style.width=$}}}renderElement(i,e,t){t.configureFont();let{completion:o}=i;t.colorspan.style.backgroundColor="";let n={labelEscapeNewLines:!0,matches:ua(i.score)},r=[];if(o.kind===19&&XVo.extract(i,r))t.icon.className="icon customcolor",t.iconContainer.className="icon hide",t.colorspan.style.backgroundColor=r[0];else if(o.kind===20&&this._themeService.getFileIconTheme().hasFileIcons){t.icon.className="icon hide",t.iconContainer.className="icon hide";let s=js(this._modelService,this._languageService,A.from({scheme:"fake",path:i.textLabel}),0),l=js(this._modelService,this._languageService,A.from({scheme:"fake",path:o.detail}),0);n.extraClasses=s.length>l.length?s:l}else o.kind===23&&this._themeService.getFileIconTheme().hasFolderIcons?(t.icon.className="icon hide",t.iconContainer.className="icon hide",n.extraClasses=[js(this._modelService,this._languageService,A.from({scheme:"fake",path:i.textLabel}),1),js(this._modelService,this._languageService,A.from({scheme:"fake",path:o.detail}),1)].flat()):(t.icon.className="icon hide",t.iconContainer.className="",t.iconContainer.classList.add("suggest-icon",...q.asClassNameArray(xU.toIcon(o.kind))));o.tags&&o.tags.indexOf(1)>=0&&(n.extraClasses=(n.extraClasses||[]).concat(["deprecated"]),n.matches=[]),t.iconLabel.setLabel(i.textLabel,void 0,n),typeof o.label=="string"?(t.parametersLabel.textContent="",t.detailsLabel.textContent=oai(o.detail||""),t.root.classList.add("string-label")):(t.parametersLabel.textContent=oai(o.label.detail||""),t.detailsLabel.textContent=oai(o.label.description||""),t.root.classList.remove("string-label")),this._editor.getOption(134).showInlineDetails?bn(t.detailsLabel):xo(t.detailsLabel),B4e(i)?(t.right.classList.add("can-expand-details"),bn(t.readMore),t.readMore.onmousedown=s=>{s.stopPropagation(),s.preventDefault()},t.readMore.onclick=s=>{s.stopPropagation(),s.preventDefault(),this._onDidToggleDetails.fire()}):(t.right.classList.remove("can-expand-details"),xo(t.readMore),t.readMore.onmousedown=null,t.readMore.onclick=null)}disposeTemplate(i){i.disposables.dispose()}};ECe=I([m(1,Ct),m(2,kt),m(3,De)],ECe);function oai(a){return a.replace(/\r\n|\r|\n/g,"")}J("editorSuggestWidget.background",gm,d(1631,null));J("editorSuggestWidget.border",DN,d(1632,null));var sai=J("editorSuggestWidget.foreground",od,d(1634,null));J("editorSuggestWidget.selectedForeground",WU,d(1637,null));J("editorSuggestWidget.selectedIconForeground",aIe,d(1638,null));var aai=J("editorSuggestWidget.selectedBackground",VU,d(1636,null));J("editorSuggestWidget.highlightForeground",l9,d(1635,null));J("editorSuggestWidget.focusHighlightForeground",MGi,d(1633,null));J("editorSuggestWidgetStatus.foreground",ei(sai,.5),d(1639,null));var nai=class{constructor(i,e){this._service=i;this._key=`suggestWidget.size/${e.getEditorType()}/${e instanceof zc}`}restore(){let i=this._service.get(this._key,0)??"";try{let e=JSON.parse(i);if(ai.is(e))return ai.lift(e)}catch{}}store(i){this._service.store(this._key,JSON.stringify(i),0,1)}reset(){this._service.remove(this._key,0)}},HW=class{constructor(i,e,t,o,n){this.editor=i;this._storageService=e;this._state=0;this._isAuto=!1;this._pendingLayout=new me;this._pendingShowDetails=new me;this._ignoreFocusEvents=!1;this._forceRenderingAbove=!1;this._explainMode=!1;this._showTimeout=new Nl;this._disposables=new P;this._onDidSelect=new Pm;this._onDidFocus=new Pm;this._onDidHide=new E;this._onDidShow=new E;this.onDidSelect=this._onDidSelect.event;this.onDidFocus=this._onDidFocus.event;this.onDidHide=this._onDidHide.event;this.onDidShow=this._onDidShow.event;this._onDetailsKeydown=new E;this.onDetailsKeyDown=this._onDetailsKeydown.event;this.element=new nO,this.element.domNode.classList.add("editor-widget","suggest-widget"),this._contentWidget=new rai(this,i),this._persistedSize=new nai(e,i);class r{constructor(f,v,b=!1,S=!1){this.persistedSize=f;this.currentSize=v;this.persistHeight=b;this.persistWidth=S}}let s;this._disposables.add(this.element.onDidWillResize(()=>{this._contentWidget.lockPreference(),s=new r(this._persistedSize.restore(),this.element.size)})),this._disposables.add(this.element.onDidResize(g=>{if(this._resize(g.dimension.width,g.dimension.height),s&&(s.persistHeight=s.persistHeight||!!g.north||!!g.south,s.persistWidth=s.persistWidth||!!g.east||!!g.west),!!g.done){if(s){let{itemHeight:f,defaultSize:v}=this.getLayoutInfo(),b=Math.round(f/2),{width:S,height:y}=this.element.size;(!s.persistHeight||Math.abs(s.currentSize.height-y)<=b)&&(y=s.persistedSize?.height??v.height),(!s.persistWidth||Math.abs(s.currentSize.width-S)<=b)&&(S=s.persistedSize?.width??v.width),this._persistedSize.store(new ai(S,y))}this._contentWidget.unlockPreference(),s=void 0}})),this._messageElement=R(this.element.domNode,_(".message")),this._listElement=R(this.element.domNode,_(".tree"));let l=this._disposables.add(n.createInstance(kCe,this.editor));l.onDidClose(()=>this.toggleDetails(),this,this._disposables),this._details=new eCt(l,this.editor);let c=()=>this.element.domNode.classList.toggle("no-icons",!this.editor.getOption(134).showIcons);c();let u=n.createInstance(ECe,this.editor);this._disposables.add(u),this._disposables.add(u.onDidToggleDetails(()=>this.toggleDetails())),this._list=new hc("SuggestWidget",this._listElement,{getHeight:g=>this.getLayoutInfo().itemHeight,getTemplateId:g=>"suggestion"},[u],{alwaysConsumeMouseWheel:!0,useShadows:!1,mouseSupport:!1,multipleSelectionSupport:!1,accessibilityProvider:{getRole:()=>ri?"listitem":"option",getWidgetAriaLabel:()=>d(1644,null),getWidgetRole:()=>"listbox",getAriaLabel:g=>{let f=g.textLabel,v=xU.toLabel(g.completion.kind);if(typeof g.completion.label!="string"){let{detail:w,description:k}=g.completion.label;w&&k?f=d(1643,null,f,w,k,v):w?f=d(1642,null,f,w,v):k&&(f=d(1641,null,f,k,v))}else f=d(1640,null,f,v);if(!g.isResolved||!this._isDetailsVisible())return f;let{documentation:b,detail:S}=g.completion,y=id("{0}{1}",S||"",b?typeof b=="string"?b:b.value:"");return d(1630,null,f,y)}}}),this._list.style(GI({listInactiveFocusBackground:aai,listInactiveFocusOutline:qs})),this._status=n.createInstance(nj,this.element.domNode,WW,void 0);let p=()=>this.element.domNode.classList.toggle("with-status-bar",this.editor.getOption(134).showStatusBar);p(),this._disposables.add(this._list.onMouseDown(g=>this._onListMouseDownOrTap(g))),this._disposables.add(this._list.onTap(g=>this._onListMouseDownOrTap(g))),this._disposables.add(this._list.onDidChangeSelection(g=>this._onListSelection(g))),this._disposables.add(this._list.onDidChangeFocus(g=>this._onListFocus(g))),this._disposables.add(this.editor.onDidChangeCursorSelection(()=>this._onCursorSelectionChanged())),this._disposables.add(this.editor.onDidChangeConfiguration(g=>{g.hasChanged(134)&&(p(),c()),this._completionModel&&(g.hasChanged(59)||g.hasChanged(135)||g.hasChanged(136))&&this._list.splice(0,this._list.length,this._completionModel.items)})),this._ctxSuggestWidgetVisible=$n.Visible.bindTo(t),this._ctxSuggestWidgetDetailsVisible=$n.DetailsVisible.bindTo(t),this._ctxSuggestWidgetMultipleSuggestions=$n.MultipleSuggestions.bindTo(t),this._ctxSuggestWidgetHasFocusedSuggestion=$n.HasFocusedSuggestion.bindTo(t),this._ctxSuggestWidgetDetailsFocused=$n.DetailsFocused.bindTo(t);let h=Vn(this._details.widget.domNode);this._disposables.add(h),this._disposables.add(h.onDidFocus(()=>this._ctxSuggestWidgetDetailsFocused.set(!0))),this._disposables.add(h.onDidBlur(()=>this._ctxSuggestWidgetDetailsFocused.set(!1))),this._disposables.add(Vo(this._details.widget.domNode,"keydown",g=>{this._onDetailsKeydown.fire(g)})),this._disposables.add(this.editor.onMouseDown(g=>this._onEditorMouseDown(g)))}static{this.LOADING_MESSAGE=d(1645,null)}static{this.NO_SUGGESTIONS_MESSAGE=d(1646,null)}dispose(){this._details.widget.dispose(),this._details.dispose(),this._list.dispose(),this._status.dispose(),this._disposables.dispose(),this._loadingTimeout?.dispose(),this._pendingLayout.dispose(),this._pendingShowDetails.dispose(),this._showTimeout.dispose(),this._contentWidget.dispose(),this.element.dispose(),this._onDidSelect.dispose(),this._onDidFocus.dispose(),this._onDidHide.dispose(),this._onDidShow.dispose(),this._onDetailsKeydown.dispose()}_onEditorMouseDown(i){this._details.widget.domNode.contains(i.target.element)?this._details.widget.domNode.focus():this.element.domNode.contains(i.target.element)&&this.editor.focus()}_onCursorSelectionChanged(){this._state!==0&&this._contentWidget.layout()}_onListMouseDownOrTap(i){typeof i.element>"u"||typeof i.index>"u"||(i.browserEvent.preventDefault(),i.browserEvent.stopPropagation(),this._select(i.element,i.index))}_onListSelection(i){i.elements.length&&this._select(i.elements[0],i.indexes[0])}_select(i,e){let t=this._completionModel;t&&(this._onDidSelect.fire({item:i,index:e,model:t}),this.editor.focus())}_onListFocus(i){if(this._ignoreFocusEvents)return;if(this._state===5&&this._setState(3),!i.elements.length){this._currentSuggestionDetails&&(this._currentSuggestionDetails.cancel(),this._currentSuggestionDetails=void 0,this._focusedItem=void 0),this.editor.setAriaOptions({activeDescendant:void 0}),this._ctxSuggestWidgetHasFocusedSuggestion.set(!1);return}if(!this._completionModel)return;this._ctxSuggestWidgetHasFocusedSuggestion.set(!0);let e=i.elements[0],t=i.indexes[0];e!==this._focusedItem&&(this._currentSuggestionDetails?.cancel(),this._currentSuggestionDetails=void 0,this._focusedItem=e,this._list.reveal(t),this._currentSuggestionDetails=xn(async o=>{let n=nn(()=>{this._isDetailsVisible()&&this._showDetails(!0,!1)},250),r=o.onCancellationRequested(()=>n.dispose());try{return await e.resolve(o)}finally{n.dispose(),r.dispose()}}),this._currentSuggestionDetails.then(()=>{t>=this._list.length||e!==this._list.element(t)||(this._ignoreFocusEvents=!0,this._list.splice(t,1,[e]),this._list.setFocus([t]),this._ignoreFocusEvents=!1,this._isDetailsVisible()?this._showDetails(!1,!1):this.element.domNode.classList.remove("docs-side"),this.editor.setAriaOptions({activeDescendant:this._list.getElementID(t)}))}).catch(mt)),this._onDidFocus.fire({item:e,index:t,model:this._completionModel})}_setState(i){if(this._state!==i)switch(this._state=i,this.element.domNode.classList.toggle("frozen",i===4),this.element.domNode.classList.remove("message"),i){case 0:xo(this._messageElement,this._listElement,this._status.element),this._details.hide(!0),this._status.hide(),this._contentWidget.hide(),this._ctxSuggestWidgetVisible.reset(),this._ctxSuggestWidgetMultipleSuggestions.reset(),this._ctxSuggestWidgetHasFocusedSuggestion.reset(),this._showTimeout.cancel(),this.element.domNode.classList.remove("visible"),this._list.splice(0,this._list.length),this._focusedItem=void 0,this._cappedHeight=void 0,this._explainMode=!1;break;case 1:this.element.domNode.classList.add("message"),this._messageElement.textContent=HW.LOADING_MESSAGE,xo(this._listElement,this._status.element),bn(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,Or(HW.LOADING_MESSAGE);break;case 2:this.element.domNode.classList.add("message"),this._messageElement.textContent=HW.NO_SUGGESTIONS_MESSAGE,xo(this._listElement,this._status.element),bn(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,Or(HW.NO_SUGGESTIONS_MESSAGE);break;case 3:xo(this._messageElement),bn(this._listElement,this._status.element),this._show();break;case 4:xo(this._messageElement),bn(this._listElement,this._status.element),this._show();break;case 5:xo(this._messageElement),bn(this._listElement,this._status.element),this._details.show(),this._show(),this._details.widget.focus();break}}_show(){this._status.show(),this._contentWidget.show(),this._layout(this._persistedSize.restore()),this._ctxSuggestWidgetVisible.set(!0),this._showTimeout.cancelAndSet(()=>{this.element.domNode.classList.add("visible"),this._onDidShow.fire(this)},100)}showTriggered(i,e){this._state===0&&(this._contentWidget.setPosition(this.editor.getPosition()),this._isAuto=!!i,this._isAuto||(this._loadingTimeout=nn(()=>this._setState(1),e)))}showSuggestions(i,e,t,o,n){if(this._contentWidget.setPosition(this.editor.getPosition()),this._loadingTimeout?.dispose(),this._currentSuggestionDetails?.cancel(),this._currentSuggestionDetails=void 0,this._completionModel!==i&&(this._completionModel=i),t&&this._state!==2&&this._state!==0){this._setState(4);return}let r=this._completionModel.items.length,s=r===0;if(this._ctxSuggestWidgetMultipleSuggestions.set(r>1),s){this._setState(o?0:2),this._completionModel=void 0;return}this._focusedItem=void 0,this._onDidFocus.pause(),this._onDidSelect.pause();try{this._list.splice(0,this._list.length,this._completionModel.items),this._setState(t?4:3),this._list.reveal(e,0,e===0?0:this.getLayoutInfo().itemHeight*.33),this._list.setFocus(n?[]:[e])}finally{this._onDidFocus.resume(),this._onDidSelect.resume()}this._pendingLayout.value=Ah(Me(this.element.domNode),()=>{this._pendingLayout.clear(),this._layout(this.element.size),this._details.widget.domNode.classList.remove("focused")})}focusSelected(){this._list.length>0&&this._list.setFocus([0])}selectNextPage(){switch(this._state){case 0:return!1;case 5:return this._details.widget.pageDown(),!0;case 1:return!this._isAuto;default:return this._list.focusNextPage(),!0}}selectNext(){switch(this._state){case 0:return!1;case 1:return!this._isAuto;default:return this._list.focusNext(1,!0),!0}}selectLast(){switch(this._state){case 0:return!1;case 5:return this._details.widget.scrollBottom(),!0;case 1:return!this._isAuto;default:return this._list.focusLast(),!0}}selectPreviousPage(){switch(this._state){case 0:return!1;case 5:return this._details.widget.pageUp(),!0;case 1:return!this._isAuto;default:return this._list.focusPreviousPage(),!0}}selectPrevious(){switch(this._state){case 0:return!1;case 1:return!this._isAuto;default:return this._list.focusPrevious(1,!0),!1}}selectFirst(){switch(this._state){case 0:return!1;case 5:return this._details.widget.scrollTop(),!0;case 1:return!this._isAuto;default:return this._list.focusFirst(),!0}}getFocusedItem(){if(this._state!==0&&this._state!==2&&this._state!==1&&this._completionModel&&this._list.getFocus().length>0)return{item:this._list.getFocusedElements()[0],index:this._list.getFocus()[0],model:this._completionModel}}toggleDetailsFocus(){this._state===5?(this._list.setFocus(this._list.getFocus()),this._setState(3)):this._state===3&&(this._setState(5),this._isDetailsVisible()?this._details.widget.focus():this.toggleDetails(!0))}toggleDetails(i=!1){this._isDetailsVisible()?(this._pendingShowDetails.clear(),this._ctxSuggestWidgetDetailsVisible.set(!1),this._setDetailsVisible(!1),this._details.hide(),this.element.domNode.classList.remove("shows-details")):(B4e(this._list.getFocusedElements()[0])||this._explainMode)&&(this._state===3||this._state===5||this._state===4)&&(this._ctxSuggestWidgetDetailsVisible.set(!0),this._setDetailsVisible(!0),this._showDetails(!1,i))}_showDetails(i,e){this._pendingShowDetails.value=Ah(Me(this.element.domNode),()=>{this._pendingShowDetails.clear(),this._details.show();let t=!1;i?this._details.widget.renderLoading():this._details.widget.renderItem(this._list.getFocusedElements()[0],this._explainMode),this._details.widget.isEmpty?this._details.hide():(this._positionDetails(),this.element.domNode.classList.add("shows-details"),e&&(this._details.widget.focus(),t=!0)),t||this.editor.focus()})}toggleExplainMode(){this._list.getFocusedElements()[0]&&(this._explainMode=!this._explainMode,this._isDetailsVisible()?this._showDetails(!1,!1):this.toggleDetails())}resetPersistedSize(){this._persistedSize.reset()}hideWidget(){this._pendingLayout.clear(),this._pendingShowDetails.clear(),this._loadingTimeout?.dispose(),this._setState(0),this._onDidHide.fire(this),this.element.clearSashHoverState();let i=this._persistedSize.restore(),e=Math.ceil(this.getLayoutInfo().itemHeight*4.3);i&&i.height<e&&this._persistedSize.store(i.with(void 0,e))}isFrozen(){return this._state===4}_afterRender(i){if(i===null){this._isDetailsVisible()&&this._details.hide();return}this._state===2||this._state===1||(this._isDetailsVisible()&&!this._details.widget.isEmpty&&this._details.show(),this._positionDetails())}_layout(i){if(!this.editor.hasModel()||!this.editor.getDomNode())return;let e=Fm(this.element.domNode.ownerDocument.body),t=this.getLayoutInfo();i||(i=t.defaultSize);let o=i.height,n=i.width;if(this._status.element.style.height=`${t.itemHeight}px`,this._state===2||this._state===1)o=t.itemHeight+t.borderHeight,n=t.defaultSize.width/2,this.element.enableSashes(!1,!1,!1,!1),this.element.minSize=this.element.maxSize=new ai(n,o),this._contentWidget.setPreference(2);else{let r=e.width-t.borderHeight-2*t.horizontalPadding;n>r&&(n=r);let s=this._completionModel?this._completionModel.stats.pLabelLen*t.typicalHalfwidthCharacterWidth:n,l=t.statusBarHeight+this._list.contentHeight+t.borderHeight,c=t.itemHeight+t.statusBarHeight,u=Yn(this.editor.getDomNode()),p=this.editor.getScrolledVisiblePosition(this.editor.getPosition()),h=u.top+p.top+p.height,g=Math.min(e.height-h-t.verticalPadding,l),f=u.top+p.top-t.verticalPadding,v=Math.min(f,l),b=Math.min(Math.max(v,g)+t.borderHeight,l);o===this._cappedHeight?.capped&&(o=this._cappedHeight.wanted),o<c&&(o=c),o>b&&(o=b),o>g&&v>g||this._forceRenderingAbove&&f>150?(this._contentWidget.setPreference(1),this.element.enableSashes(!0,!0,!1,!1),b=v):(this._contentWidget.setPreference(2),this.element.enableSashes(!1,!0,!0,!1),b=g),this.element.preferredSize=new ai(s,t.defaultSize.height),this.element.maxSize=new ai(r,b),this.element.minSize=new ai(220,c),this._cappedHeight=o===l?{wanted:this._cappedHeight?.wanted??i.height,capped:o}:void 0}this._resize(n,o)}_resize(i,e){let{width:t,height:o}=this.element.maxSize;i=Math.min(t,i),e=Math.min(o,e);let{statusBarHeight:n}=this.getLayoutInfo();this._list.layout(e-n,i),this._listElement.style.height=`${e-n}px`,this.element.layout(e,i),this._contentWidget.layout(),this._positionDetails()}_positionDetails(){this._isDetailsVisible()&&this._details.placeAtAnchor(this.element.domNode,this._contentWidget.getPosition()?.preference[0]===2)}getLayoutInfo(){let i=this.editor.getOption(59),e=Kn(this.editor.getOption(136)||i.lineHeight,8,1e3),t=!this.editor.getOption(134).showStatusBar||this._state===2||this._state===1?0:e,o=this._details.widget.getLayoutInfo().borderWidth,n=2*o;return{itemHeight:e,statusBarHeight:t,borderWidth:o,borderHeight:n,typicalHalfwidthCharacterWidth:i.typicalHalfwidthCharacterWidth,verticalPadding:22,horizontalPadding:14,defaultSize:new ai(430,t+12*e)}}_isDetailsVisible(){return this._storageService.getBoolean("expandSuggestionDocs",0,!1)}_setDetailsVisible(i){this._storageService.store("expandSuggestionDocs",i,0,0)}forceRenderingAbove(){this._forceRenderingAbove||(this._forceRenderingAbove=!0,this._layout(this._persistedSize.restore()))}stopForceRenderingAbove(){this._forceRenderingAbove=!1}};HW=I([m(1,le),m(2,X),m(3,De),m(4,F)],HW);var rai=class{constructor(i,e){this._widget=i;this._editor=e;this.allowEditorOverflow=!0;this.suppressMouseDown=!1;this._preferenceLocked=!1;this._added=!1;this._hidden=!1}dispose(){this._added&&(this._added=!1,this._editor.removeContentWidget(this))}getId(){return"editor.widget.suggestWidget"}getDomNode(){return this._widget.element.domNode}show(){this._hidden=!1,this._added||(this._added=!0,this._editor.addContentWidget(this))}hide(){this._hidden||(this._hidden=!0,this.layout())}layout(){this._editor.layoutContentWidget(this)}getPosition(){return this._hidden||!this._position||!this._preference?null:{position:this._position,preference:[this._preference]}}beforeRender(){let{height:i,width:e}=this._widget.element.size,{borderWidth:t,horizontalPadding:o}=this._widget.getLayoutInfo();return new ai(e+2*t+o,i+2*t)}afterRender(i){this._widget._afterRender(i)}setPreference(i){this._preferenceLocked||(this._preference=i)}lockPreference(){this._preferenceLocked=!0}unlockPreference(){this._preferenceLocked=!1}setPosition(i){this._position=i}};var JVo=!1,lai=class{constructor(i,e){this._model=i;this._position=e;this._decorationOptions=po.register({description:"suggest-line-suffix",stickiness:1});if(i.getLineMaxColumn(e.lineNumber)!==e.column){let o=i.getOffsetAt(e),n=i.getPositionAt(o+1);i.changeDecorations(r=>{this._marker&&r.removeDecoration(this._marker),this._marker=r.addDecoration(z.fromPositions(e,n),this._decorationOptions)})}}dispose(){this._marker&&!this._model.isDisposed()&&this._model.changeDecorations(i=>{i.removeDecoration(this._marker),this._marker=void 0})}delta(i){if(this._model.isDisposed()||this._position.lineNumber!==i.lineNumber)return 0;if(this._marker){let e=this._model.getDecorationRange(this._marker);return this._model.getOffsetAt(e.getStartPosition())-this._model.getOffsetAt(i)}else return this._model.getLineMaxColumn(i.lineNumber)-i.column}};var El=class{constructor(i,e,t,o,n,r,s){this._memoryService=e;this._commandService=t;this._contextKeyService=o;this._instantiationService=n;this._logService=r;this._telemetryService=s;this._lineSuffix=new me;this._toDispose=new P;this._selectors=new cai(i=>i.priority);this._onWillInsertSuggestItem=new E;this._wantsForceRenderingAbove=!1;this.editor=i,this.model=n.createInstance(Q1,this.editor),this._selectors.register({priority:0,select:(p,h,g)=>this._memoryService.select(p,h,g)});let l=$n.InsertMode.bindTo(o);l.set(i.getOption(134).insertMode),this._toDispose.add(this.model.onDidTrigger(()=>l.set(i.getOption(134).insertMode))),this.widget=this._toDispose.add(new hN(Me(i.getDomNode()),()=>{let p=this._instantiationService.createInstance(HW,this.editor);this._toDispose.add(p),this._toDispose.add(p.onDidSelect(b=>this._insertSuggestion(b,0),this));let h=new Jwt(this.editor,p,this.model,b=>this._insertSuggestion(b,2));this._toDispose.add(h);let g=$n.MakesTextEdit.bindTo(this._contextKeyService),f=$n.HasInsertAndReplaceRange.bindTo(this._contextKeyService),v=$n.CanResolve.bindTo(this._contextKeyService);return this._toDispose.add(Z(()=>{g.reset(),f.reset(),v.reset()})),this._toDispose.add(p.onDidFocus(({item:b})=>{let S=this.editor.getPosition(),y=b.editStart.column,w=S.column,k=!0;this.editor.getOption(1)==="smart"&&this.model.state===2&&!b.completion.additionalTextEdits&&!(b.completion.insertTextRules&4)&&w-y===b.completion.insertText.length&&(k=this.editor.getModel().getValueInRange({startLineNumber:S.lineNumber,startColumn:y,endLineNumber:S.lineNumber,endColumn:w})!==b.completion.insertText),g.set(k),f.set(!Ie.equals(b.editInsertEnd,b.editReplaceEnd)),v.set(!!b.provider.resolveCompletionItem||!!b.completion.documentation||b.completion.detail!==b.completion.label)})),this._wantsForceRenderingAbove&&p.forceRenderingAbove(),p})),this._overtypingCapturer=this._toDispose.add(new hN(Me(i.getDomNode()),()=>this._toDispose.add(new Zwt(this.editor,this.model)))),this._alternatives=this._toDispose.add(new hN(Me(i.getDomNode()),()=>this._toDispose.add(new JM(this.editor,this._contextKeyService)))),this._toDispose.add(n.createInstance(ij,i)),this._toDispose.add(this.model.onDidTrigger(p=>{this.widget.value.showTriggered(p.auto,p.shy?250:50),this._lineSuffix.value=new lai(this.editor.getModel(),p.position)})),this._toDispose.add(this.model.onDidSuggest(p=>{if(p.triggerOptions.shy)return;let h=-1;for(let f of this._selectors.itemsOrderedByPriorityDesc)if(h=f.select(this.editor.getModel(),this.editor.getPosition(),p.completionModel.items),h!==-1)break;if(h===-1&&(h=0),this.model.state===0)return;let g=!1;if(p.triggerOptions.auto){let f=this.editor.getOption(134);f.selectionMode==="never"||f.selectionMode==="always"?g=f.selectionMode==="never":f.selectionMode==="whenTriggerCharacter"?g=p.triggerOptions.triggerKind!==1:f.selectionMode==="whenQuickSuggestion"&&(g=p.triggerOptions.triggerKind===1&&!p.triggerOptions.refilter)}this.widget.value.showSuggestions(p.completionModel,h,p.isFrozen,p.triggerOptions.auto,g)})),this._toDispose.add(this.model.onDidCancel(p=>{p.retrigger||this.widget.value.hideWidget()})),this._toDispose.add(this.editor.onDidBlurEditorWidget(()=>{JVo||(this.model.cancel(),this.model.clear())}));let c=$n.AcceptSuggestionsOnEnter.bindTo(o),u=()=>{let p=this.editor.getOption(1);c.set(p==="on"||p==="smart")};this._toDispose.add(this.editor.onDidChangeConfiguration(()=>u())),u()}static{this.ID="editor.contrib.suggestController"}static get(i){return i.getContribution(El.ID)}get onWillInsertSuggestItem(){return this._onWillInsertSuggestItem.event}dispose(){this._alternatives.dispose(),this._toDispose.dispose(),this.widget.dispose(),this.model.dispose(),this._lineSuffix.dispose(),this._onWillInsertSuggestItem.dispose()}_insertSuggestion(i,e){if(!i||!i.item){this._alternatives.value.reset(),this.model.cancel(),this.model.clear();return}if(!this.editor.hasModel())return;let t=Qr.get(this.editor);if(!t)return;this._onWillInsertSuggestItem.fire({item:i.item});let o=this.editor.getModel(),n=o.getAlternativeVersionId(),{item:r}=i,s=[],l=new $e;e&1||this.editor.pushUndoStop();let c=this.getOverwriteInfo(r,!!(e&8));this._memoryService.memorize(o,this.editor.getPosition(),r);let u=r.isResolved,p=-1,h=-1;if(Array.isArray(r.completion.additionalTextEdits)){this.model.cancel();let f=tC.capture(this.editor);this.editor.executeEdits("suggestController.additionalTextEdits.sync",r.completion.additionalTextEdits.map(v=>{let b=z.lift(v.range);if(b.startLineNumber===r.position.lineNumber&&b.startColumn>r.position.column){let S=this.editor.getPosition().column-r.position.column,y=S,w=z.spansMultipleLines(b)?0:S;b=new z(b.startLineNumber,b.startColumn+y,b.endLineNumber,b.endColumn+w)}return An.replaceMove(b,v.text)})),f.restoreRelativeVerticalPositionOfCursor(this.editor)}else if(!u){let f=new En,v,b=o.onDidChangeContent(k=>{if(k.isFlush){l.cancel(),b.dispose();return}for(let T of k.changes){let N=z.getEndPosition(T.range);(!v||Ie.isBefore(N,v))&&(v=N)}}),S=e;e|=2;let y=!1,w=this.editor.onWillType(()=>{w.dispose(),y=!0,S&2||this.editor.pushUndoStop()});s.push(r.resolve(l.token).then(()=>{if(!r.completion.additionalTextEdits||l.token.isCancellationRequested)return;if(v&&r.completion.additionalTextEdits.some(T=>Ie.isBefore(v,z.getStartPosition(T.range))))return!1;y&&this.editor.pushUndoStop();let k=tC.capture(this.editor);return this.editor.executeEdits("suggestController.additionalTextEdits.async",r.completion.additionalTextEdits.map(T=>An.replaceMove(z.lift(T.range),T.text))),k.restoreRelativeVerticalPositionOfCursor(this.editor),(y||!(S&2))&&this.editor.pushUndoStop(),!0}).then(k=>{this._logService.trace("[suggest] async resolving of edits DONE (ms, applied?)",f.elapsed(),k),h=k===!0?1:k===!1?0:-2}).finally(()=>{b.dispose(),w.dispose()}))}let{insertText:g}=r.completion;if(r.completion.insertTextRules&4||(g=zh.escape(g)),this.model.cancel(),t.insert(g,{overwriteBefore:c.overwriteBefore,overwriteAfter:c.overwriteAfter,undoStopBefore:!1,undoStopAfter:!1,adjustWhitespace:!(r.completion.insertTextRules&1),clipboardText:i.model.clipboardText,overtypingCapturer:this._overtypingCapturer.value,reason:_c.suggest({providerId:CU.fromExtensionId(r.extensionId?.value)})}),e&2||this.editor.pushUndoStop(),r.completion.command)if(r.completion.command.id===tCt.id)this.model.trigger({auto:!0,retrigger:!0});else{let f=new En;s.push(this._commandService.executeCommand(r.completion.command.id,...r.completion.command.arguments?[...r.completion.command.arguments]:[]).catch(v=>{r.completion.extensionId?ss(v):mt(v)}).finally(()=>{p=f.elapsed()}))}e&4&&this._alternatives.value.set(i,f=>{for(l.cancel();o.canUndo();){n!==o.getAlternativeVersionId()&&o.undo(),this._insertSuggestion(f,3|(e&8?8:0));break}}),this._alertCompletionItem(r),Promise.all(s).finally(()=>{this._reportSuggestionAcceptedTelemetry(r,o,u,p,h,i.index,i.model.items),this.model.clear(),l.dispose()})}_reportSuggestionAcceptedTelemetry(i,e,t,o,n,r,s){if(Math.random()>1e-4)return;let l=new Map;for(let h=0;h<Math.min(30,s.length);h++){let g=s[h].textLabel;l.has(g)?l.get(g).push(h):l.set(g,[h])}let c=l.get(i.textLabel),p=c&&c.length>1?c[0]:-1;this._telemetryService.publicLog2("suggest.acceptedSuggestion",{extensionId:i.extensionId?.value??"unknown",providerId:i.provider._debugDisplayName??"unknown",kind:i.completion.kind,basenameHash:Ir(Ye(e.uri)).toString(16),languageId:e.getLanguageId(),fileExtension:ms(e.uri),resolveInfo:i.provider.resolveCompletionItem?t?1:0:-1,resolveDuration:i.resolveDuration,commandDuration:o,additionalEditsAsync:n,index:r,firstIndex:p})}getOverwriteInfo(i,e){So(this.editor.hasModel());let t=this.editor.getOption(134).insertMode==="replace";e&&(t=!t);let o=i.position.column-i.editStart.column,n=(t?i.editReplaceEnd.column:i.editInsertEnd.column)-i.position.column,r=this.editor.getPosition().column-i.position.column,s=this._lineSuffix.value?this._lineSuffix.value.delta(this.editor.getPosition()):0;return{overwriteBefore:o+r,overwriteAfter:n+s}}_alertCompletionItem(i){if(dr(i.completion.additionalTextEdits)){let e=d(1624,null,i.textLabel,i.completion.additionalTextEdits.length);Jo(e)}}triggerSuggest(i,e,t){this.editor.hasModel()&&(this.model.trigger({auto:e??!1,completionOptions:{providerFilter:i,kindFilter:t?new Set:void 0}}),this.editor.revealPosition(this.editor.getPosition(),0),this.editor.focus())}triggerSuggestAndAcceptBest(i){if(!this.editor.hasModel())return;let e=this.editor.getPosition(),t=()=>{e.equals(this.editor.getPosition())&&this._commandService.executeCommand(i.fallback)},o=n=>{if(n.completion.insertTextRules&4||n.completion.additionalTextEdits)return!0;let r=this.editor.getPosition(),s=n.editStart.column,l=r.column;return l-s!==n.completion.insertText.length?!0:this.editor.getModel().getValueInRange({startLineNumber:r.lineNumber,startColumn:s,endLineNumber:r.lineNumber,endColumn:l})!==n.completion.insertText};H.once(this.model.onDidTrigger)(n=>{let r=[];H.any(this.model.onDidTrigger,this.model.onDidCancel)(()=>{Ue(r),t()},void 0,r),this.model.onDidSuggest(({completionModel:s})=>{if(Ue(r),s.items.length===0){t();return}let l=this._memoryService.select(this.editor.getModel(),this.editor.getPosition(),s.items),c=s.items[l];if(!o(c)){t();return}this.editor.pushUndoStop(),this._insertSuggestion({index:l,item:c,model:s},7)},void 0,r)}),this.model.trigger({auto:!1,shy:!0}),this.editor.revealPosition(e,0),this.editor.focus()}acceptSelectedSuggestion(i,e){let t=this.widget.value.getFocusedItem(),o=0;i&&(o|=4),e&&(o|=8),this._insertSuggestion(t,o)}acceptNextSuggestion(){this._alternatives.value.next()}acceptPrevSuggestion(){this._alternatives.value.prev()}cancelSuggestWidget(){this.model.cancel(),this.model.clear(),this.widget.value.hideWidget()}focusSuggestion(){this.widget.value.focusSelected()}selectNextSuggestion(){this.widget.value.selectNext()}selectNextPageSuggestion(){this.widget.value.selectNextPage()}selectLastSuggestion(){this.widget.value.selectLast()}selectPrevSuggestion(){this.widget.value.selectPrevious()}selectPrevPageSuggestion(){this.widget.value.selectPreviousPage()}selectFirstSuggestion(){this.widget.value.selectFirst()}toggleSuggestionDetails(){this.widget.value.toggleDetails()}toggleExplainMode(){this.widget.value.toggleExplainMode()}toggleSuggestionFocus(){this.widget.value.toggleDetailsFocus()}resetWidgetSize(){this.widget.value.resetPersistedSize()}forceRenderingAbove(){this.widget.isInitialized?this.widget.value.forceRenderingAbove():this._wantsForceRenderingAbove=!0}stopForceRenderingAbove(){this.widget.isInitialized?this.widget.value.stopForceRenderingAbove():this._wantsForceRenderingAbove=!1}registerSelector(i){return this._selectors.register(i)}};El=I([m(1,yCe),m(2,ge),m(3,X),m(4,F),m(5,ne),m(6,Te)],El);var cai=class{constructor(i){this.prioritySelector=i;this._items=new Array}register(i){if(this._items.indexOf(i)!==-1)throw new Error("Value is already registered");return this._items.push(i),this._items.sort((e,t)=>this.prioritySelector(t)-this.prioritySelector(e)),{dispose:()=>{let e=this._items.indexOf(i);e>=0&&this._items.splice(e,1)}}}get itemsOrderedByPriorityDesc(){return this._items}},tCt=class a extends xi{static{this.id="editor.action.triggerSuggest"}constructor(){super({id:a.id,label:L(1629,"Trigger Suggest"),precondition:x.and(ue.writable,ue.hasCompletionItemProvider,$n.Visible.toNegated()),kbOpts:{kbExpr:ue.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[521,2087]},weight:100}})}run(i,e,t){let o=El.get(e);if(!o)return;let n;t&&typeof t=="object"&&t.auto===!0&&(n=!0),o.triggerSuggest(void 0,n,void 0)}};go(El.ID,El,2);Jt(tCt);var v_=190,Nx=xc.bindToContribution(El.get);qi(new Nx({id:"acceptSelectedSuggestion",precondition:x.and($n.Visible,$n.HasFocusedSuggestion),handler(a){a.acceptSelectedSuggestion(!0,!1)},kbOpts:[{primary:2,kbExpr:x.and($n.Visible,ue.textInputFocus),weight:v_},{primary:3,kbExpr:x.and($n.Visible,ue.textInputFocus,$n.AcceptSuggestionsOnEnter,$n.MakesTextEdit),weight:v_}],menuOpts:[{menuId:WW,title:d(1622,null),group:"left",order:1,when:x.and($n.HasFocusedSuggestion,$n.HasInsertAndReplaceRange.toNegated())},{menuId:WW,title:d(1622,null),group:"left",order:1,when:x.and($n.HasFocusedSuggestion,$n.HasInsertAndReplaceRange,$n.InsertMode.isEqualTo("insert"))},{menuId:WW,title:d(1623,null),group:"left",order:1,when:x.and($n.HasFocusedSuggestion,$n.HasInsertAndReplaceRange,$n.InsertMode.isEqualTo("replace"))}]}));qi(new Nx({id:"acceptAlternativeSelectedSuggestion",precondition:x.and($n.Visible,ue.textInputFocus,$n.HasFocusedSuggestion),kbOpts:{weight:v_,kbExpr:ue.textInputFocus,primary:1027,secondary:[1026]},handler(a){a.acceptSelectedSuggestion(!1,!0)},menuOpts:[{menuId:WW,group:"left",order:2,when:x.and($n.HasFocusedSuggestion,$n.HasInsertAndReplaceRange,$n.InsertMode.isEqualTo("insert")),title:d(1623,null)},{menuId:WW,group:"left",order:2,when:x.and($n.HasFocusedSuggestion,$n.HasInsertAndReplaceRange,$n.InsertMode.isEqualTo("replace")),title:d(1622,null)}]}));qe.registerCommandAlias("acceptSelectedSuggestionOnEnter","acceptSelectedSuggestion");qi(new Nx({id:"hideSuggestWidget",precondition:$n.Visible,handler:a=>a.cancelSuggestWidget(),kbOpts:{weight:v_,kbExpr:ue.textInputFocus,primary:9,secondary:[1033]}}));qi(new Nx({id:"selectNextSuggestion",precondition:x.and($n.Visible,x.or($n.MultipleSuggestions,$n.HasFocusedSuggestion.negate())),handler:a=>a.selectNextSuggestion(),kbOpts:{weight:v_,kbExpr:ue.textInputFocus,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}},menuOpts:{menuId:WW,group:"left",order:0,when:$n.HasFocusedSuggestion.toNegated(),title:d(1627,null)}}));qi(new Nx({id:"selectNextPageSuggestion",precondition:x.and($n.Visible,x.or($n.MultipleSuggestions,$n.HasFocusedSuggestion.negate())),handler:a=>a.selectNextPageSuggestion(),kbOpts:{weight:v_,kbExpr:ue.textInputFocus,primary:12,secondary:[2060]}}));qi(new Nx({id:"selectLastSuggestion",precondition:x.and($n.Visible,x.or($n.MultipleSuggestions,$n.HasFocusedSuggestion.negate())),handler:a=>a.selectLastSuggestion()}));qi(new Nx({id:"selectPrevSuggestion",precondition:x.and($n.Visible,x.or($n.MultipleSuggestions,$n.HasFocusedSuggestion.negate())),handler:a=>a.selectPrevSuggestion(),kbOpts:{weight:v_,kbExpr:ue.textInputFocus,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}}));qi(new Nx({id:"selectPrevPageSuggestion",precondition:x.and($n.Visible,x.or($n.MultipleSuggestions,$n.HasFocusedSuggestion.negate())),handler:a=>a.selectPrevPageSuggestion(),kbOpts:{weight:v_,kbExpr:ue.textInputFocus,primary:11,secondary:[2059]}}));qi(new Nx({id:"selectFirstSuggestion",precondition:x.and($n.Visible,x.or($n.MultipleSuggestions,$n.HasFocusedSuggestion.negate())),handler:a=>a.selectFirstSuggestion()}));qi(new Nx({id:"focusSuggestion",precondition:x.and($n.Visible,$n.HasFocusedSuggestion.negate()),handler:a=>a.focusSuggestion(),kbOpts:{weight:v_,kbExpr:ue.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}}}));qi(new Nx({id:"focusAndAcceptSuggestion",precondition:x.and($n.Visible,$n.HasFocusedSuggestion.negate()),handler:a=>{a.focusSuggestion(),a.acceptSelectedSuggestion(!0,!1)}}));qi(new Nx({id:"toggleSuggestionDetails",precondition:x.and($n.Visible,$n.HasFocusedSuggestion),handler:a=>a.toggleSuggestionDetails(),kbOpts:{weight:v_,kbExpr:ue.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}},menuOpts:[{menuId:WW,group:"right",order:1,when:x.and($n.DetailsVisible,$n.CanResolve),title:d(1626,null)},{menuId:WW,group:"right",order:1,when:x.and($n.DetailsVisible.toNegated(),$n.CanResolve),title:d(1625,null)}]}));qi(new Nx({id:"toggleExplainMode",precondition:$n.Visible,handler:a=>a.toggleExplainMode(),kbOpts:{weight:100,primary:2138}}));qi(new Nx({id:"toggleSuggestionFocus",precondition:$n.Visible,handler:a=>a.toggleSuggestionFocus(),kbOpts:{weight:v_,kbExpr:ue.textInputFocus,primary:2570,mac:{primary:778}}}));qi(new Nx({id:"insertBestCompletion",precondition:x.and(ue.textInputFocus,x.equals("config.editor.tabCompletion","on"),ij.AtEnd,$n.Visible.toNegated(),JM.OtherSuggestions.toNegated(),Qr.InSnippetMode.toNegated()),handler:(a,i)=>{a.triggerSuggestAndAcceptBest(yi(i)?{fallback:"tab",...i}:{fallback:"tab"})},kbOpts:{weight:v_,primary:2}}));qi(new Nx({id:"insertNextSuggestion",precondition:x.and(ue.textInputFocus,x.equals("config.editor.tabCompletion","on"),JM.OtherSuggestions,$n.Visible.toNegated(),Qr.InSnippetMode.toNegated()),handler:a=>a.acceptNextSuggestion(),kbOpts:{weight:v_,kbExpr:ue.textInputFocus,primary:2}}));qi(new Nx({id:"insertPrevSuggestion",precondition:x.and(ue.textInputFocus,x.equals("config.editor.tabCompletion","on"),JM.OtherSuggestions,$n.Visible.toNegated(),Qr.InSnippetMode.toNegated()),handler:a=>a.acceptPrevSuggestion(),kbOpts:{weight:v_,kbExpr:ue.textInputFocus,primary:1026}}));qi(new class extends xc{constructor(){super({id:"suggestWidgetCopy",precondition:$n.DetailsFocused,kbOpts:{weight:v_+10,kbExpr:$n.DetailsFocused,primary:2081,win:{primary:2081,secondary:[2067]}}})}runEditorCommand(a,i){Me(i.getDomNode()).document.execCommand("copy")}});Jt(class extends xi{constructor(){super({id:"editor.action.resetSuggestSize",label:L(1628,"Reset Suggest Widget Size"),precondition:void 0})}run(a,i){El.get(i)?.resetWidgetSize()}});var dai=class extends C{constructor(e,t,o){super();this.editor=e;this.suggestControllerPreselector=t;this.onWillAccept=o;this.isSuggestWidgetVisible=!1;this.isShiftKeyPressed=!1;this._isActive=!1;this._currentSuggestItemInfo=void 0;this._onDidSelectedItemChange=this._register(new E);this.onDidSelectedItemChange=this._onDidSelectedItemChange.event;this._register(e.onKeyDown(r=>{r.shiftKey&&!this.isShiftKeyPressed&&(this.isShiftKeyPressed=!0,this.update(this._isActive))})),this._register(e.onKeyUp(r=>{r.shiftKey&&this.isShiftKeyPressed&&(this.isShiftKeyPressed=!1,this.update(this._isActive))}));let n=El.get(this.editor);if(n){this._register(n.registerSelector({priority:100,select:(l,c,u)=>{let p=this.editor.getModel();if(!p)return-1;let h=this.suggestControllerPreselector(),g=h?XM(h,p):void 0;if(!g)return-1;let f=Ie.lift(c),v=u.map((S,y)=>{let w=U4e.fromSuggestion(n,p,f,S,this.isShiftKeyPressed),k=XM(w.getSingleTextEdit(),p),T=Nwt(g,k);return{index:y,valid:T,prefixLength:k.text.length,suggestItem:S}}).filter(S=>S&&S.valid&&S.prefixLength>0),b=Z2e(v,tl(S=>S.prefixLength,qd));return b?b.index:-1}}));let r=!1,s=()=>{r||(r=!0,this._register(n.widget.value.onDidShow(()=>{this.isSuggestWidgetVisible=!0,this.update(!0)})),this._register(n.widget.value.onDidHide(()=>{this.isSuggestWidgetVisible=!1,this.update(!1)})),this._register(n.widget.value.onDidFocus(()=>{this.isSuggestWidgetVisible=!0,this.update(!0)})))};this._register(H.once(n.model.onDidTrigger)(l=>{s()})),this._register(n.onWillInsertSuggestItem(l=>{let c=this.editor.getPosition(),u=this.editor.getModel();if(!c||!u)return;let p=U4e.fromSuggestion(n,u,c,l.item,this.isShiftKeyPressed);this.onWillAccept(p)}))}this.update(this._isActive)}get selectedItem(){return this._currentSuggestItemInfo}update(e){let t=this.getSuggestItemInfo();(this._isActive!==e||!ZVo(this._currentSuggestItemInfo,t))&&(this._isActive=e,this._currentSuggestItemInfo=t,this._onDidSelectedItemChange.fire())}getSuggestItemInfo(){let e=El.get(this.editor);if(!e||!this.isSuggestWidgetVisible)return;let t=e.widget.value.getFocusedItem(),o=this.editor.getPosition(),n=this.editor.getModel();if(!(!t||!o||!n))return U4e.fromSuggestion(e,n,o,t.item,this.isShiftKeyPressed)}stopForceRenderingAbove(){El.get(this.editor)?.stopForceRenderingAbove()}forceRenderingAbove(){El.get(this.editor)?.forceRenderingAbove()}},U4e=class a{constructor(i,e,t,o,n){this.range=i;this.insertText=e;this.completionItemKind=t;this.isSnippetText=o;this.listIncomplete=n}static fromSuggestion(i,e,t,o,n){let{insertText:r}=o.completion,s=!1;if(o.completion.insertTextRules&4){let c=new zh().parse(r);c.children.length<100&&aC.adjustWhitespace(e,t,!0,c),r=c.toString(),s=!0}let l=i.getOverwriteInfo(o,n);return new a(z.fromPositions(t.delta(0,-l.overwriteBefore),t.delta(0,Math.max(l.overwriteAfter,0))),r,o.completion.kind,s,o.container.incomplete??!1)}equals(i){return this.range.equalsRange(i.range)&&this.insertText===i.insertText&&this.completionItemKind===i.completionItemKind&&this.isSnippetText===i.isSnippetText}toSelectedSuggestionInfo(){return new Pht(this.range,this.insertText,this.completionItemKind,this.isSnippetText)}getSingleTextEdit(){return new Xr(this.range,this.insertText)}};function ZVo(a,i){return a===i?!0:!a||!i?!1:a.equals(i)}var iCt=class extends C{constructor(e,t,o){super();this._editorObs=e;this._handleSuggestAccepted=t;this._suggestControllerPreselector=o;this._suggestWidgetAdaptor=this._register(new dai(this._editorObs.editor,()=>(this._editorObs.forceUpdate(),this._suggestControllerPreselector()),n=>this._editorObs.forceUpdate(r=>{this._handleSuggestAccepted(n)}))),this.selectedItem=ui(this,n=>this._suggestWidgetAdaptor.onDidSelectedItemChange(()=>{this._editorObs.forceUpdate(r=>n(void 0))}),()=>this._suggestWidgetAdaptor.selectedItem)}stopForceRenderingAbove(){this._suggestWidgetAdaptor.stopForceRenderingAbove()}forceRenderingAbove(){this._suggestWidgetAdaptor.forceRenderingAbove()}};var _le=class a{constructor(i,e){this.startColumn=i;this.endColumnExclusive=e;if(i>e)throw new ni(`startColumn ${i} cannot be after endColumnExclusive ${e}`)}static fromOffsetRange(i){return new a(i.start+1,i.endExclusive+1)}toRange(i){return new z(i,this.startColumn,i,this.endColumnExclusive)}equals(i){return this.startColumn===i.startColumn&&this.endColumnExclusive===i.endColumnExclusive}toZeroBasedOffsetRange(){return new di(this.startColumn-1,this.endColumnExclusive-1)}};var oCt=class a{constructor(i,e){this.lineNumber=i;this.columnRange=e}static fromRange(i){if(i.endLineNumber===i.startLineNumber)return new a(i.startLineNumber,new _le(i.startColumn,i.endColumn))}toRange(){return new z(this.lineNumber,this.columnRange.startColumn,this.lineNumber,this.columnRange.endColumnExclusive)}};var z4e=class a{constructor(i){this._tokenInfo=i}static fromLineTokens(i){let e=[];for(let t=0;t<i.getCount();t++)e.push(new nCt(i.getTokenText(t),i.getMetadata(t)));return a.create(e)}static create(i){return new a(i)}toLineTokens(i){return Bc.createFromTextAndMetadata(this.map((e,t)=>({text:t.text,metadata:t.metadata})),i)}forEach(i){let e=0;for(let t of this._tokenInfo){let o=new di(e,e+t.text.length);i(o,t),e+=t.text.length}}map(i){let e=[],t=0;for(let o of this._tokenInfo){let n=new di(t,t+o.text.length);e.push(i(n,o)),t+=o.text.length}return e}slice(i){let e=[],t=0;for(let o of this._tokenInfo){let n=t,r=n+o.text.length;if(r>i.start){if(n>=i.endExclusive)break;let s=Math.max(0,i.start-n),l=Math.max(0,r-i.endExclusive);e.push(new nCt(o.text.slice(s,o.text.length-l),o.metadata))}t+=o.text.length}return a.create(e)}append(i){let e=this._tokenInfo.concat(i._tokenInfo);return a.create(e)}},nCt=class{constructor(i,e){this.text=i;this.metadata=e}};var rCt=class a{constructor(i=M.warning){this.icon=i}static from(i){if(i)return new a(i.icon)}},wQi=!0,kQi="ghost-text",X1=class extends C{constructor(e,t,o,n){super();this._editor=e;this._data=t;this._languageService=n;this._isDisposed=Le(this,!1);this._warningState=Ce(e=>{let t=this._data.read(e),o=t?.warning;if(!t||!o)return;let n=t.ghostText;return{lineNumber:n.lineNumber,position:new Ie(n.lineNumber,n.parts[0].column),icon:o.icon}});this._onDidClick=this._register(new E);this.onDidClick=this._onDidClick.event;this._nonWhitespaceCount=Ce(this,e=>{let t=this._data.read(e);return t?t.ghostText.parts.map(r=>r.lines.map(s=>s.line).join("")).join("").replace(/\s/g,"").length:void 0});this._extraClassNames=Ce(this,e=>{let t=this._extraClasses.slice();wQi&&this._warningState.read(e)&&t.push("warning");let o=this._nonWhitespaceCount.read(e);return this._highlightShortText&&o&&o<3?t.push("short-text"):this._useSyntaxHighlighting.read(e)&&t.push("syntax-highlighted"),t.map(r=>` ${r}`).join("")});this._state=Ce(this,e=>{if(this._isDisposed.read(e))return;let t=this._data.read(e);if(!t)return;let o=this._editorObs.model.read(e);if(!o)return;let n=t.ghostText,r=n instanceof fCe?n.columnRange:void 0,s=this._useSyntaxHighlighting.read(e),l=this._extraClassNames.read(e),{inlineTexts:c,additionalLines:u,hiddenRange:p,additionalLinesOriginalSuffix:h}=eBo(n,o,kQi+l),g=o.getLineContent(n.lineNumber),f=new Qc(c.map(O=>Hc.insert(O.column-1,O.text))),v=s?o.tokenization.tokenizeLinesAt(n.lineNumber,[f.apply(g),...u.map(O=>O.content)]):void 0,b=f.getNewRanges(),S=c.map((O,V)=>({...O,tokens:v?.[0]?.getTokensInRange(b[V])})),y=u.map((O,V)=>{let U=v?.[V+1]??Bc.createEmpty(O.content,this._languageService.languageIdCodec);if(V===u.length-1&&h){let $=z4e.fromLineTokens(o.tokenization.getLineTokens(h.lineNumber)).slice(h.columnRange.toZeroBasedOffsetRange());U=z4e.fromLineTokens(U).append($).toLineTokens(U.languageIdCodec)}return new mai(U,O.decorations)}),w=this._editor.getSelection()?.getStartPosition().column,k=S.filter(O=>O.text!==""),T=k.length!==0,N=new xle((T?k[0].column:1)-w,T?0:u.findIndex(O=>O.content!=="")+1,T?1:0,u.length+(T?1:0),0,Zve(k.map(O=>O.text.length))+Zve(y.map(O=>O.content.getTextLength())),k.length+(u.length>0?1:0),k.length>1&&y.length===0?k.every(O=>O.text===k[0].text):void 0);return{replacedRange:r,inlineTexts:S,additionalLines:y,hiddenRange:p,lineNumber:n.lineNumber,additionalReservedLineCount:this._minReservedLineCount.read(e),targetTextModel:o,syntaxHighlightingEnabled:s,telemetryViewData:N,handleInlineCompletionShown:t.handleInlineCompletionShown}});this._decorations=Ce(this,e=>{let t=this._state.read(e);if(!t)return[];let o=[],n=this._extraClassNames.read(e);t.replacedRange&&o.push({range:t.replacedRange.toRange(t.lineNumber),options:{inlineClassName:"inline-completion-text-to-replace"+n,description:"GhostTextReplacement"}}),t.hiddenRange&&o.push({range:t.hiddenRange.toRange(t.lineNumber),options:{inlineClassName:"ghost-text-hidden",description:"ghost-text-hidden"}});for(let r of t.inlineTexts){let s="";this._highlightShortText&&r.text.length<5&&(s+=" short-text"),o.push({range:z.fromPositions(new Ie(t.lineNumber,r.column)),options:{description:"ghost-text-decoration",after:{content:r.text,tokens:r.tokens,inlineClassName:(r.preview?"ghost-text-decoration-preview":"ghost-text-decoration")+(this._isClickable?" clickable":"")+n+s+r.lineDecorations.map(l=>" "+l.className).join(" "),cursorStops:2,attachedData:new K4e(this)},showIfCollapsed:!0}})}return o});this.isHovered=Ce(this,e=>this._isDisposed.read(e)?!1:this._isInlineTextHovered.read(e)||this._additionalLinesWidget.isHovered.read(e));this.height=Ce(this,e=>this._editorObs.getOption(75).read(e)+(this._additionalLinesWidget.viewZoneHeight.read(e)??0));this._extraClasses=o.extraClasses??[],this._isClickable=o.isClickable??!1,this._shouldKeepCursorStable=o.shouldKeepCursorStable??!1,this._minReservedLineCount=o.minReservedLineCount??Oo(0),this._useSyntaxHighlighting=o.useSyntaxHighlighting??Oo(!0),this._highlightShortText=o.highlightShortSuggestions??!1,this._editorObs=os(this._editor),this._additionalLinesWidget=this._register(new pai(this._editor,hs({owner:this,equalsFn:aU(C6())},r=>{let s=this._state.read(r);return s?new uai(s.lineNumber,s.additionalLines,s.additionalReservedLineCount):void 0}),this._shouldKeepCursorStable,this._isClickable)),this._isInlineTextHovered=this._editorObs.isTargetHovered(r=>r.target.type===6&&r.target.detail.injectedText?.options.attachedData instanceof K4e&&r.target.detail.injectedText.options.attachedData.owner===this,this._store),this._register(Z(()=>{this._isDisposed.set(!0,void 0)})),this._register(this._editorObs.setDecorations(this._decorations)),this._isClickable&&(this._register(this._additionalLinesWidget.onDidClick(r=>this._onDidClick.fire(r))),this._register(this._editor.onMouseUp(r=>{if(r.target.type!==6)return;let s=r.target.detail.injectedText?.options.attachedData;s instanceof K4e&&s.owner===this&&this._onDidClick.fire(r.event)}))),this._register(he(r=>{let s=this._state.read(r);s?.handleInlineCompletionShown(s.telemetryViewData)})),this._register(Ga((r,s)=>{if(wQi)return;let l=this._warningState.read(r);if(!l)return;let c=this._editorObs.getOption(75);s.add(this._editorObs.createContentWidget({position:Oo({position:new Ie(l.lineNumber,Number.MAX_SAFE_INTEGER),preference:[0],positionAffinity:1}),allowEditorOverflow:!1,domNode:Mo.div({class:"ghost-text-view-warning-widget",style:{width:c,height:c,marginLeft:4,color:"orange"},ref:u=>{u.ghostTextViewWarningWidgetData={range:z.fromPositions(l.position)}}},[Mo.div({class:"ghost-text-view-warning-widget-icon",style:{width:"100%",height:"100%",display:"flex",alignContent:"center",alignItems:"center"}},[Qo(l.icon)])]).keepUpdated(s).element}))}))}static getWarningWidgetContext(e){let t=e.ghostTextViewWarningWidgetData;if(t)return t;if(e.parentElement)return this.getWarningWidgetContext(e.parentElement)}ownsViewZone(e){return this._additionalLinesWidget.viewZoneId===e}};X1=I([m(3,kt)],X1);var K4e=class{constructor(i){this.owner=i}};function eBo(a,i,e){let t=[],o=[];function n(p,h){if(o.length>0){let g=o[o.length-1];h&&g.decorations.push(new Jv(g.content.length+1,g.content.length+1+p[0].line.length,h,0)),g.content+=p[0].line,p=p.slice(1)}for(let g of p)o.push({content:g.line,decorations:h?[new Jv(1,g.line.length+1,h,0),...g.lineDecorations]:[...g.lineDecorations]})}let r=i.getLineContent(a.lineNumber),s,l=0;for(let p of a.parts){let h=p.lines;s===void 0?(t.push({column:p.column,text:h[0].line,preview:p.preview,lineDecorations:h[0].lineDecorations}),h=h.slice(1)):n([{line:r.substring(l,p.column-1),lineDecorations:[]}],void 0),h.length>0&&(n(h,e),s===void 0&&p.column<=r.length&&(s=p.column)),l=p.column-1}let c;s!==void 0&&(c=new oCt(a.lineNumber,new _le(l+1,r.length+1)));let u=s!==void 0?new _le(s,r.length+1):void 0;return{inlineTexts:t,additionalLines:o,hiddenRange:u,additionalLinesOriginalSuffix:c}}var uai=class{constructor(i,e,t){this.lineNumber=i;this.additionalLines=e;this.minReservedLineCount=t}equals(i){return this.lineNumber!==i.lineNumber||this.minReservedLineCount!==i.minReservedLineCount?!1:$i(this.additionalLines,i.additionalLines,C6())}},pai=class extends C{constructor(e,t,o,n){super();this._editor=e;this._lines=t;this._shouldKeepCursorStable=o;this._isClickable=n;this._viewZoneHeight=Le("viewZoneHeight",void 0),this.editorOptionsChanged=Nr("editorOptionChanged",H.filter(this._editor.onDidChangeConfiguration,r=>r.hasChanged(40)||r.hasChanged(133)||r.hasChanged(113)||r.hasChanged(108)||r.hasChanged(60)||r.hasChanged(59)||r.hasChanged(75))),this._onDidClick=this._register(new E),this.onDidClick=this._onDidClick.event,this._viewZoneListener=this._register(new me),this.isHovered=os(this._editor).isTargetHovered(r=>CQi(r.target.element),this._store),this.hasBeenAccepted=!1,this._editor instanceof jr&&this._shouldKeepCursorStable&&this._register(this._editor.onBeforeExecuteEdit(r=>this.hasBeenAccepted=r.source==="inlineSuggestion.accept")),this._register(he(r=>{let s=this._lines.read(r);this.editorOptionsChanged.read(r),s?(this.hasBeenAccepted=!1,this.updateLines(s.lineNumber,s.additionalLines,s.minReservedLineCount)):this.clear()}))}get viewZoneId(){return this._viewZoneInfo?.viewZoneId}get viewZoneHeight(){return this._viewZoneHeight}dispose(){super.dispose(),this.clear()}clear(){this._viewZoneListener.clear(),this._editor.changeViewZones(e=>{this.removeActiveViewZone(e)})}updateLines(e,t,o){let n=this._editor.getModel();if(!n)return;let{tabSize:r}=n.getOptions();os(this._editor).transaction(s=>{this._editor.changeViewZones(l=>{let c=new P;this.removeActiveViewZone(l);let u=Math.max(t.length,o);if(u>0){let p=document.createElement("div");tBo(p,r,t,this._editor.getOptions(),this._isClickable),this._isClickable&&(c.add(j(p,"mousedown",h=>{h.preventDefault()})),c.add(j(p,"click",h=>{CQi(h.target)&&this._onDidClick.fire(new yn(Me(h),h))}))),this.addViewZone(l,e,u,p)}this._viewZoneListener.value=c})})}addViewZone(e,t,o,n){let r=e.addZone({afterLineNumber:t,heightInLines:o,domNode:n,afterColumnAffinity:1,onComputedHeight:s=>{this._viewZoneHeight.set(s,void 0)}});this.keepCursorStable(t,o),this._viewZoneInfo={viewZoneId:r,heightInLines:o,lineNumber:t}}removeActiveViewZone(e){this._viewZoneInfo&&(e.removeZone(this._viewZoneInfo.viewZoneId),this.hasBeenAccepted||this.keepCursorStable(this._viewZoneInfo.lineNumber,-this._viewZoneInfo.heightInLines),this._viewZoneInfo=void 0,this._viewZoneHeight.set(void 0,void 0))}keepCursorStable(e,t){if(!this._shouldKeepCursorStable)return;let o=this._editor.getSelection()?.getStartPosition()?.lineNumber;o!==void 0&&e<o&&this._editor.setScrollTop(this._editor.getScrollTop()+t*this._editor.getOption(75))}};function CQi(a){return Ao(a)&&a.classList.contains(kQi)}var mai=class{constructor(i,e){this.content=i;this.decorations=e}equals(i){return this.content.equals(i.content)?Jv.equalsArr(this.decorations,i.decorations):!1}};function tBo(a,i,e,t,o){let n=t.get(40),r=t.get(133),s="none",l=t.get(108),c=t.get(60),u=t.get(59),p=t.get(75),h="suggest-preview-text";o&&(h+=" clickable");let g=new ES(1e4);g.appendString(`<div class="${h}">`);for(let b=0,S=e.length;b<S;b++){let y=e[b],w=y.content;g.appendString('<div class="view-line'),g.appendString('" style="top:'),g.appendString(String(b*p)),g.appendString('px;width:1000000px;">');let k=w.getLineContent(),T=oU(k),N=yM(k);uW(new hL(u.isMonospace&&!n,u.canUseHalfwidthRightwardsArrow,k,!1,T,N,0,w,y.decorations.slice(),i,0,u.spaceWidth,u.middotWidth,u.wsmiddotWidth,r,s,l,c!==mx.OFF,null,null,0),g),g.appendString("</div>")}g.appendString("</div>"),Pd(a,u);let f=g.build(),v=xQi?xQi.createHTML(f):f;a.innerHTML=v}var xQi=Kg("editorGhostText",{createHTML:a=>a});var H7=class a{constructor(i,e){this.width=i;this.height=e}static equals(i,e){return i.width===e.width&&i.height===e.height}add(i){return new a(this.width+i.width,this.height+i.height)}deltaX(i){return new a(this.width+i,this.height)}deltaY(i){return new a(this.width,this.height+i)}toString(){return`(${this.width},${this.height})`}subtract(i){return new a(this.width-i.width,this.height-i.height)}scale(i){return new a(this.width*i,this.height*i)}scaleWidth(i){return new a(this.width*i,this.height)}mapComponents(i){return new a(i(this.width),i(this.height))}isZero(){return this.width===0&&this.height===0}transpose(){return new a(this.height,this.width)}toDimension(){return{width:this.width,height:this.height}}};var bu=class a{constructor(i,e,t,o){this.left=i;this.top=e;this.right=t;this.bottom=o;if(i>t)throw new ni("Invalid arguments: Horizontally offset by "+(i-t));if(e>o)throw new ni("Invalid arguments: Vertically offset by "+(e-o))}static fromPoint(i){return new a(i.x,i.y,i.x,i.y)}static fromPoints(i,e){return new a(i.x,i.y,e.x,e.y)}static fromPointSize(i,e){return new a(i.x,i.y,i.x+e.x,i.y+e.y)}static fromLeftTopRightBottom(i,e,t,o){return new a(i,e,t,o)}static fromLeftTopWidthHeight(i,e,t,o){return new a(i,e,i+t,e+o)}static fromRanges(i,e){return new a(i.start,e.start,i.endExclusive,e.endExclusive)}static hull(i){let e=Number.MAX_SAFE_INTEGER,t=Number.MAX_SAFE_INTEGER,o=Number.MIN_SAFE_INTEGER,n=Number.MIN_SAFE_INTEGER;for(let r of i)e=Math.min(e,r.left),t=Math.min(t,r.top),o=Math.max(o,r.right),n=Math.max(n,r.bottom);return new a(e,t,o,n)}get width(){return this.right-this.left}get height(){return this.bottom-this.top}withMargin(i,e,t,o){let n,r,s,l;return e===void 0&&t===void 0&&o===void 0?n=r=s=l=i:t===void 0&&o===void 0?(n=r=e,s=l=i):(n=o,r=e,s=i,l=t),new a(this.left-n,this.top-s,this.right+r,this.bottom+l)}intersectVertical(i){let e=Math.max(this.top,i.start),t=Math.min(this.bottom,i.endExclusive);return new a(this.left,e,this.right,Math.max(e,t))}intersectHorizontal(i){let e=Math.max(this.left,i.start),t=Math.min(this.right,i.endExclusive);return new a(e,this.top,Math.max(e,t),this.bottom)}toString(){return`Rect{(${this.left},${this.top}), (${this.right},${this.bottom})}`}intersect(i){let e=Math.max(this.left,i.left),t=Math.min(this.right,i.right),o=Math.max(this.top,i.top),n=Math.min(this.bottom,i.bottom);if(!(e>t||o>n))return new a(e,o,t,n)}union(i){return new a(Math.min(this.left,i.left),Math.min(this.top,i.top),Math.max(this.right,i.right),Math.max(this.bottom,i.bottom))}containsRect(i){return this.left<=i.left&&this.top<=i.top&&this.right>=i.right&&this.bottom>=i.bottom}containsPoint(i){return this.left<=i.x&&this.top<=i.y&&this.right>=i.x&&this.bottom>=i.y}moveToBeContainedIn(i){let e=this.width,t=this.height,o=this.left,n=this.top;return o<i.left?o=i.left:o+e>i.right&&(o=i.right-e),n<i.top?n=i.top:n+t>i.bottom&&(n=i.bottom-t),new a(o,n,o+e,n+t)}withWidth(i){return new a(this.left,this.top,this.left+i,this.bottom)}withHeight(i){return new a(this.left,this.top,this.right,this.top+i)}withTop(i){return new a(this.left,i,this.right,this.bottom)}withLeft(i){return new a(i,this.top,this.right,this.bottom)}translateX(i){return new a(this.left+i,this.top,this.right+i,this.bottom)}translateY(i){return new a(this.left,this.top+i,this.right,this.bottom+i)}translate(i){return new a(this.left+i.x,this.top+i.y,this.right+i.x,this.bottom+i.y)}deltaRight(i){return new a(this.left,this.top,this.right+i,this.bottom)}deltaTop(i){return new a(this.left,this.top+i,this.right,this.bottom)}deltaLeft(i){return new a(this.left+i,this.top,this.right,this.bottom)}deltaBottom(i){return new a(this.left,this.top,this.right,this.bottom+i)}getLeftBottom(){return new Uh(this.left,this.bottom)}getRightBottom(){return new Uh(this.right,this.bottom)}getLeftTop(){return new Uh(this.left,this.top)}getRightTop(){return new Uh(this.right,this.top)}toStyles(){return{position:"absolute",left:`${this.left}px`,top:`${this.top}px`,width:`${this.width}px`,height:`${this.height}px`}}getHorizontalRange(){return new di(this.left,this.right)}getVerticalRange(){return new di(this.top,this.bottom)}withHorizontalRange(i){return new a(i.start,this.top,i.endExclusive,this.bottom)}withVerticalRange(i){return new a(this.left,i.start,this.right,i.endExclusive)}getSize(){return new H7(this.width,this.height)}};var TCe=class a{constructor(i,e,t,o=null){this.startLineNumbers=i;this.endLineNumbers=e;this.lastLineRelativePosition=t;this.showEndForLine=o}equals(i){return!!i&&this.lastLineRelativePosition===i.lastLineRelativePosition&&this.showEndForLine===i.showEndForLine&&$i(this.startLineNumbers,i.startLineNumbers)&&$i(this.endLineNumbers,i.endLineNumbers)}static get Empty(){return new a([],[],0)}},EQi=Kg("stickyScrollViewLayer",{createHTML:a=>a}),hai="data-sticky-line-index",TQi="data-sticky-is-line",iBo="data-sticky-is-line-number",_Qi="data-sticky-is-folding-icon",sCt=class extends C{constructor(e){super();this._foldingIconStore=this._register(new P);this._rootDomNode=document.createElement("div");this._lineNumbersDomNode=document.createElement("div");this._linesDomNodeScrollable=document.createElement("div");this._linesDomNode=document.createElement("div");this._renderedStickyLines=[];this._lineNumbers=[];this._lastLineRelativePosition=0;this._minContentWidthInPx=0;this._isOnGlyphMargin=!1;this._height=-1;this._onDidChangeStickyScrollHeight=this._register(new E);this.onDidChangeStickyScrollHeight=this._onDidChangeStickyScrollHeight.event;this._editor=e,this._lineNumbersDomNode.className="sticky-widget-line-numbers",this._lineNumbersDomNode.setAttribute("role","none"),this._linesDomNode.className="sticky-widget-lines",this._linesDomNode.setAttribute("role","list"),this._linesDomNodeScrollable.className="sticky-widget-lines-scrollable",this._linesDomNodeScrollable.appendChild(this._linesDomNode),this._rootDomNode.className="sticky-widget",this._rootDomNode.classList.toggle("peek",e instanceof zc),this._rootDomNode.appendChild(this._lineNumbersDomNode),this._rootDomNode.appendChild(this._linesDomNodeScrollable),this._setHeight(0);let t=()=>{this._linesDomNode.style.left=this._editor.getOption(131).scrollWithEditor?`-${this._editor.getScrollLeft()}px`:"0px"};this._register(this._editor.onDidChangeConfiguration(o=>{o.hasChanged(131)&&t()})),this._register(this._editor.onDidScrollChange(o=>{o.scrollLeftChanged&&t(),o.scrollWidthChanged&&this._updateWidgetWidth()})),this._register(this._editor.onDidChangeModel(()=>{t(),this._updateWidgetWidth()})),t(),this._register(this._editor.onDidLayoutChange(o=>{this._updateWidgetWidth()})),this._updateWidgetWidth()}get height(){return this._height}get lineNumbers(){return this._lineNumbers}get lineNumberCount(){return this._lineNumbers.length}getRenderedStickyLine(e){return this._renderedStickyLines.find(t=>t.lineNumber===e)}getCurrentLines(){return this._lineNumbers}setState(e,t,o){let n=!this._state&&!e,r=this._state&&this._state.equals(e);if(o===void 0&&(n||r))return;let s=this._findRenderingData(e),l=this._lineNumbers;this._lineNumbers=s.lineNumbers,this._lastLineRelativePosition=s.lastLineRelativePosition;let c=this._findIndexToRebuildFrom(l,this._lineNumbers,o);this._renderRootNode(this._lineNumbers,this._lastLineRelativePosition,t,c),this._state=e}_findRenderingData(e){if(!e)return{lineNumbers:[],lastLineRelativePosition:0};let t=[...e.startLineNumbers];e.showEndForLine!==null&&(t[e.showEndForLine]=e.endLineNumbers[e.showEndForLine]);let o=0;for(let n=0;n<t.length;n++)o+=this._editor.getLineHeightForPosition(new Ie(t[n],1));return o===0?{lineNumbers:[],lastLineRelativePosition:0}:{lineNumbers:t,lastLineRelativePosition:e.lastLineRelativePosition}}_findIndexToRebuildFrom(e,t,o){if(t.length===0)return 0;if(o!==void 0)return o;let n=t.findIndex(r=>!e.includes(r));return n===-1?0:n}_updateWidgetWidth(){let e=this._editor.getLayoutInfo(),t=e.contentLeft;this._lineNumbersDomNode.style.width=`${t}px`,this._linesDomNodeScrollable.style.setProperty("--vscode-editorStickyScroll-scrollableWidth",`${this._editor.getScrollWidth()-e.verticalScrollbarWidth}px`),this._rootDomNode.style.width=`${e.width-e.verticalScrollbarWidth}px`}_useFoldingOpacityTransition(e){this._lineNumbersDomNode.style.setProperty("--vscode-editorStickyScroll-foldingOpacityTransition",`opacity ${e?.5:0}s`)}_setFoldingIconsVisibility(e){for(let t of this._renderedStickyLines){let o=t.foldingIcon;o&&o.setVisible(e?!0:o.isCollapsed)}}async _renderRootNode(e,t,o,n){let r=this._editor._getViewModel();if(!r){this._clearWidget();return}if(e.length===0){this._clearWidget();return}let s=[],l=e[e.length-1],c=0;for(let p=0;p<this._renderedStickyLines.length;p++)if(p<n){let h=this._renderedStickyLines[p];s.push(this._updatePosition(h,c,h.lineNumber===l)),c+=h.height}else{let h=this._renderedStickyLines[p];h.lineNumberDomNode.remove(),h.lineDomNode.remove()}let u=this._editor.getLayoutInfo();for(let p=n;p<e.length;p++){let h=this._renderChildNode(r,p,e[p],c,l===e[p],o,u);c+=h.height,this._linesDomNode.appendChild(h.lineDomNode),this._lineNumbersDomNode.appendChild(h.lineNumberDomNode),s.push(h)}o&&(this._setFoldingHoverListeners(),this._useFoldingOpacityTransition(!this._isOnGlyphMargin)),this._minContentWidthInPx=Math.max(...this._renderedStickyLines.map(p=>p.scrollWidth))+u.verticalScrollbarWidth,this._renderedStickyLines=s,this._setHeight(c+t),this._editor.layoutOverlayWidget(this)}_clearWidget(){for(let e=0;e<this._renderedStickyLines.length;e++){let t=this._renderedStickyLines[e];t.lineNumberDomNode.remove(),t.lineDomNode.remove()}this._setHeight(0)}_setHeight(e){this._height!==e&&(this._height=e,this._height===0?this._rootDomNode.style.display="none":(this._rootDomNode.style.display="block",this._lineNumbersDomNode.style.height=`${this._height}px`,this._linesDomNodeScrollable.style.height=`${this._height}px`,this._rootDomNode.style.height=`${this._height}px`),this._onDidChangeStickyScrollHeight.fire({height:this._height}))}_setFoldingHoverListeners(){this._foldingIconStore.clear(),this._editor.getOption(126)==="mouseover"&&(this._foldingIconStore.clear(),this._foldingIconStore.add(j(this._lineNumbersDomNode,re.MOUSE_ENTER,()=>{this._isOnGlyphMargin=!0,this._setFoldingIconsVisibility(!0)})),this._foldingIconStore.add(j(this._lineNumbersDomNode,re.MOUSE_LEAVE,()=>{this._isOnGlyphMargin=!1,this._useFoldingOpacityTransition(!0),this._setFoldingIconsVisibility(!1)})))}_renderChildNode(e,t,o,n,r,s,l){let c=new gai(this._editor,e,l,s,this._isOnGlyphMargin,t,o);return this._updatePosition(c,n,r)}_updatePosition(e,t,o){let n=e.lineDomNode,r=e.lineNumberDomNode;if(o){n.style.zIndex="0",r.style.zIndex="0";let l=`${t+this._lastLineRelativePosition+(e.foldingIcon?.isCollapsed?1:0)}px`;n.style.top=l,r.style.top=l}else n.style.zIndex="1",r.style.zIndex="1",n.style.top=`${t}px`,r.style.top=`${t}px`;return e}getId(){return"editor.contrib.stickyScrollWidget"}getDomNode(){return this._rootDomNode}getPosition(){return{preference:2,stackOrdinal:10}}getMinContentWidthInPx(){return this._minContentWidthInPx}focusLineWithIndex(e){0<=e&&e<this._renderedStickyLines.length&&this._renderedStickyLines[e].lineDomNode.focus()}getEditorPositionFromNode(e){if(!e||e.children.length>0)return null;let t=this._getRenderedStickyLineFromChildDomNode(e);if(!t)return null;let o=K$(t.characterMapping,e,0);return new Ie(t.lineNumber,o)}getLineNumberFromChildDomNode(e){return this._getRenderedStickyLineFromChildDomNode(e)?.lineNumber??null}_getRenderedStickyLineFromChildDomNode(e){let t=this.getLineIndexFromChildDomNode(e);return t===null||t<0||t>=this._renderedStickyLines.length?null:this._renderedStickyLines[t]}getLineIndexFromChildDomNode(e){let t=this._getAttributeValue(e,hai);return t?parseInt(t,10):null}isInStickyLine(e){return this._getAttributeValue(e,TQi)!==void 0}isInFoldingIconDomNode(e){return this._getAttributeValue(e,_Qi)!==void 0}_getAttributeValue(e,t){for(;e&&e!==this._rootDomNode;){let o=e.getAttribute(t);if(o!==null)return o;e=e.parentElement}}},gai=class{constructor(i,e,t,o,n,r,s){this.index=r;this.lineNumber=s;let l=e.coordinatesConverter.convertModelPositionToViewPosition(new Ie(s,1)).lineNumber,c=e.getViewLineRenderingData(l),u=i.getOption(76),p=i.getOption(117).verticalScrollbarSize,h;try{h=Jv.filter(c.inlineDecorations,l,c.minColumn,c.maxColumn)}catch{h=[]}let g=i.getLineHeightForPosition(new Ie(s,1)),f=e.getTextDirection(s),v=new hL(!0,!0,c.content,c.continuesWithWrappedLine,c.isBasicASCII,c.containsRTL,0,c.tokens,h,c.tabSize,c.startVisibleColumn,1,1,1,500,"none",!0,!0,null,f,p),b=new ES(2e3),S=uW(v,b);this.characterMapping=S.characterMapping;let y;EQi?y=EQi.createHTML(b.build()):y=b.build();let w=document.createElement("span");w.setAttribute(hai,String(r)),w.setAttribute(TQi,""),w.setAttribute("role","listitem"),w.tabIndex=0,w.className="sticky-line-content",w.classList.add(`stickyLine${s}`),w.style.lineHeight=`${g}px`,w.innerHTML=y;let k=document.createElement("span");k.setAttribute(hai,String(r)),k.setAttribute(iBo,""),k.className="sticky-line-number",k.style.lineHeight=`${g}px`;let T=t.contentLeft;k.style.width=`${T}px`;let N=document.createElement("span");u.renderType===1||u.renderType===3&&s%10===0?N.innerText=s.toString():u.renderType===2&&(N.innerText=Math.abs(s-i.getPosition().lineNumber).toString()),N.className="sticky-line-number-inner",N.style.width=`${t.lineNumbersWidth}px`,N.style.paddingLeft=`${t.lineNumbersLeft}px`,k.appendChild(N),this.foldingIcon=this._renderFoldingIconForLine(i,o,s,g,n),this.foldingIcon&&(k.appendChild(this.foldingIcon.domNode),this.foldingIcon.domNode.style.left=`${t.lineNumbersWidth+t.lineNumbersLeft}px`,this.foldingIcon.domNode.style.lineHeight=`${g}px`),i.applyFontInfo(w),i.applyFontInfo(k),k.style.lineHeight=`${g}px`,w.style.lineHeight=`${g}px`,k.style.height=`${g}px`,w.style.height=`${g}px`,this.scrollWidth=w.scrollWidth,this.lineDomNode=w,this.lineNumberDomNode=k,this.height=g}_renderFoldingIconForLine(i,e,t,o,n){let r=i.getOption(126);if(!e||r==="never")return;let s=e.regions,l=s.findRange(t),c=s.getStartLineNumber(l);if(!(t===c))return;let p=s.isCollapsed(l),h=new fai(p,c,s.getEndLineNumber(l),o);return h.setVisible(n?!0:p||r==="always"),h.domNode.setAttribute(_Qi,""),h}},fai=class{constructor(i,e,t,o){this.isCollapsed=i;this.foldingStartLine=e;this.foldingEndLine=t;this.dimension=o;this.domNode=document.createElement("div"),this.domNode.style.width="26px",this.domNode.style.height=`${o}px`,this.domNode.style.lineHeight=`${o}px`,this.domNode.className=q.asClassName(i?ule:dle)}setVisible(i){this.domNode.style.cursor=i?"pointer":"default",this.domNode.style.opacity=i?"1":"0"}};var rj=class{constructor(i,e){this.startLineNumber=i;this.endLineNumber=e}},Dle=class{constructor(i,e,t){this.range=i;this.children=e;this.parent=t}},G4e=class{constructor(i,e,t,o){this.uri=i;this.version=e;this.element=t;this.outlineProviderId=o}};var _Ce=class extends C{constructor(e,t,o,n){super();this._editor=e;this._modelProviders=[];this._modelPromise=null;this._updateScheduler=this._register(new jo(300));this._updateOperation=this._register(new P);switch(this._editor.getOption(131).defaultModel){case"outlineModel":this._modelProviders.push(new $4e(this._editor,n));case"foldingProviderModel":this._modelProviders.push(new j4e(this._editor,t,n));case"indentationModel":this._modelProviders.push(new q4e(this._editor,o));break}}dispose(){this._modelProviders.forEach(e=>e.dispose()),this._updateOperation.clear(),this._cancelModelPromise(),super.dispose()}_cancelModelPromise(){this._modelPromise&&(this._modelPromise.cancel(),this._modelPromise=null)}async update(e){return this._updateOperation.clear(),this._updateOperation.add({dispose:()=>{this._cancelModelPromise(),this._updateScheduler.cancel()}}),this._cancelModelPromise(),await this._updateScheduler.trigger(async()=>{for(let t of this._modelProviders){let{statusPromise:o,modelPromise:n}=t.computeStickyModel(e);this._modelPromise=n;let r=await o;if(this._modelPromise!==n)return null;switch(r){case 2:return this._updateOperation.clear(),null;case 0:return t.stickyModel}}return null}).catch(t=>(mt(t),null))}};_Ce=I([m(2,F),m(3,zt)],_Ce);var aCt=class extends C{constructor(e){super();this._editor=e;this._stickyModel=null}get stickyModel(){return this._stickyModel}_invalid(){return this._stickyModel=null,1}computeStickyModel(e){if(e.isCancellationRequested||!this.isProviderValid())return{statusPromise:this._invalid(),modelPromise:null};let t=xn(o=>this.createModelFromProvider(o));return{statusPromise:t.then(o=>this.isModelValid(o)?e.isCancellationRequested?2:(this._stickyModel=this.createStickyModel(e,o),0):this._invalid()).then(void 0,o=>(mt(o),2)),modelPromise:t}}isModelValid(e){return!0}isProviderValid(){return!0}},$4e=class extends aCt{constructor(e,t){super(e);this._languageFeaturesService=t}createModelFromProvider(e){return fO.create(this._languageFeaturesService.documentSymbolProvider,this._editor.getModel(),e)}createStickyModel(e,t){let{stickyOutlineElement:o,providerID:n}=this._stickyModelFromOutlineModel(t,this._stickyModel?.outlineProviderId),r=this._editor.getModel();return new G4e(r.uri,r.getVersionId(),o,n)}isModelValid(e){return e&&e.children.size>0}_stickyModelFromOutlineModel(e,t){let o;if(ht.first(e.children.values())instanceof iw){let l=ht.find(e.children.values(),c=>c.id===t);if(l)o=l.children;else{let c="",u=-1,p;for(let[h,g]of e.children.entries()){let f=this._findSumOfRangesOfGroup(g);f>u&&(p=g,u=f,c=g.id)}t=c,o=p.children}}else o=e.children;let n=[],r=Array.from(o.values()).sort((l,c)=>{let u=new rj(l.symbol.range.startLineNumber,l.symbol.range.endLineNumber),p=new rj(c.symbol.range.startLineNumber,c.symbol.range.endLineNumber);return this._comparator(u,p)});for(let l of r)n.push(this._stickyModelFromOutlineElement(l,l.symbol.selectionRange.startLineNumber));return{stickyOutlineElement:new Dle(void 0,n,void 0),providerID:t}}_stickyModelFromOutlineElement(e,t){let o=[];for(let r of e.children.values())if(r.symbol.selectionRange.startLineNumber!==r.symbol.range.endLineNumber)if(r.symbol.selectionRange.startLineNumber!==t)o.push(this._stickyModelFromOutlineElement(r,r.symbol.selectionRange.startLineNumber));else for(let s of r.children.values())o.push(this._stickyModelFromOutlineElement(s,r.symbol.selectionRange.startLineNumber));o.sort((r,s)=>this._comparator(r.range,s.range));let n=new rj(e.symbol.selectionRange.startLineNumber,e.symbol.range.endLineNumber);return new Dle(n,o,void 0)}_comparator(e,t){return e.startLineNumber!==t.startLineNumber?e.startLineNumber-t.startLineNumber:t.endLineNumber-e.endLineNumber}_findSumOfRangesOfGroup(e){let t=0;for(let o of e.children.values())t+=this._findSumOfRangesOfGroup(o);return e instanceof _f?t+e.symbol.range.endLineNumber-e.symbol.selectionRange.startLineNumber:t}};$4e=I([m(1,zt)],$4e);var lCt=class extends aCt{constructor(i){super(i),this._foldingLimitReporter=this._register(new d4e(i))}createStickyModel(i,e){let t=this._fromFoldingRegions(e),o=this._editor.getModel();return new G4e(o.uri,o.getVersionId(),t,void 0)}isModelValid(i){return i!==null}_fromFoldingRegions(i){let e=i.length,t=[],o=new Dle(void 0,[],void 0);for(let n=0;n<e;n++){let r=i.getParentIndex(n),s;r!==-1?s=t[r]:s=o;let l=new Dle(new rj(i.getStartLineNumber(n),i.getEndLineNumber(n)+1),[],s);s.children.push(l),t.push(l)}return o}},q4e=class extends lCt{constructor(e,t){super(e);this._languageConfigurationService=t;this.provider=this._register(new cle(e.getModel(),this._languageConfigurationService,this._foldingLimitReporter))}async createModelFromProvider(e){return this.provider.compute(e)}};q4e=I([m(1,bs)],q4e);var j4e=class extends lCt{constructor(e,t,o){super(e);this._languageFeaturesService=o;this.provider=this._register(new me);this._register(this._languageFeaturesService.foldingRangeProvider.onDidChange(()=>{this._updateProvider(e,t)})),this._updateProvider(e,t)}_updateProvider(e,t){let o=Qg.getFoldingRangeProviders(this._languageFeaturesService,e.getModel());o.length!==0&&(this.provider.value=new ple(e.getModel(),o,t,this._foldingLimitReporter,void 0))}isProviderValid(){return this.provider!==void 0}async createModelFromProvider(e){return this.provider.value?.compute(e)??null}};j4e=I([m(2,zt)],j4e);var vai=class{constructor(i,e,t,o){this.startLineNumber=i;this.endLineNumber=e;this.top=t;this.height=o}},DCe=class extends C{constructor(e,t,o){super();this._languageFeaturesService=t;this._languageConfigurationService=o;this._onDidChangeStickyScroll=this._register(new E);this.onDidChangeStickyScroll=this._onDidChangeStickyScroll.event;this._model=null;this._cts=null;this._stickyModelProvider=null;this._editor=e,this._sessionStore=this._register(new P),this._updateSoon=this._register(new Dt(()=>this.update(),50)),this._register(this._editor.onDidChangeConfiguration(n=>{n.hasChanged(131)&&this.readConfiguration()})),this.readConfiguration()}static{this.ID="store.contrib.stickyScrollController"}readConfiguration(){this._sessionStore.clear(),this._editor.getOption(131).enabled&&(this._sessionStore.add(this._editor.onDidChangeModel(()=>{this._model=null,this.updateStickyModelProvider(),this._onDidChangeStickyScroll.fire(),this.update()})),this._sessionStore.add(this._editor.onDidChangeHiddenAreas(()=>this.update())),this._sessionStore.add(this._editor.onDidChangeModelContent(()=>this._updateSoon.schedule())),this._sessionStore.add(this._languageFeaturesService.documentSymbolProvider.onDidChange(()=>this.update())),this._sessionStore.add(Z(()=>{this._stickyModelProvider?.dispose(),this._stickyModelProvider=null})),this.updateStickyModelProvider(),this.update())}getVersionId(){return this._model?.version}updateStickyModelProvider(){this._stickyModelProvider?.dispose(),this._stickyModelProvider=null,this._editor.hasModel()&&(this._stickyModelProvider=new _Ce(this._editor,()=>this._updateSoon.schedule(),this._languageConfigurationService,this._languageFeaturesService))}async update(){this._cts?.dispose(!0),this._cts=new $e,await this.updateStickyModel(this._cts.token),this._onDidChangeStickyScroll.fire()}async updateStickyModel(e){if(!this._editor.hasModel()||!this._stickyModelProvider||this._editor.getModel().isTooLargeForTokenization()){this._model=null;return}let t=await this._stickyModelProvider.update(e);e.isCancellationRequested||(this._model=t)}getCandidateStickyLinesIntersecting(e){if(!this._model?.element)return[];let t=[];return this.getCandidateStickyLinesIntersectingFromStickyModel(e,this._model.element,t,0,0,-1),this.filterHiddenRanges(t)}getCandidateStickyLinesIntersectingFromStickyModel(e,t,o,n,r,s){let l=this._editor.getModel();if(!l||t.children.length===0)return;let c=s,u=[];for(let g=0;g<t.children.length;g++){let f=t.children[g];f.range&&u.push(f.range.startLineNumber)}let p=this.updateIndex(cx(u,e.startLineNumber,(g,f)=>g-f)),h=this.updateIndex(cx(u,e.endLineNumber,(g,f)=>g-f));for(let g=p;g<=h;g++){let f=t.children[g];if(!f||!f.range)continue;let{startLineNumber:v,endLineNumber:b}=f.range;if(b>v+1&&e.startLineNumber<=b+1&&v-1<=e.endLineNumber&&v!==c&&l.isValidRange(new z(v,1,b,1))){c=v;let S=this._editor.getLineHeightForPosition(new Ie(v,1));o.push(new vai(v,b-1,r,S)),this.getCandidateStickyLinesIntersectingFromStickyModel(e,f,o,n+1,r+S,v)}}}filterHiddenRanges(e){let t=this._editor._getViewModel()?.getHiddenAreas();return t?e.filter(o=>!t.some(n=>o.startLineNumber>=n.startLineNumber&&o.endLineNumber<=n.endLineNumber+1)):e}updateIndex(e){return e===-1?0:e<0?-e-2:e}};DCe=I([m(1,zt),m(2,bs)],DCe);var rb=class extends C{constructor(e,t,o,n,r,s,l){super();this._editor=e;this._contextMenuService=t;this._languageFeaturesService=o;this._instaService=n;this._contextKeyService=l;this._sessionStore=new P;this._maxStickyLines=Number.MAX_SAFE_INTEGER;this._candidateDefinitionsLength=-1;this._focusedStickyElementIndex=-1;this._enabled=!1;this._focused=!1;this._positionRevealed=!1;this._onMouseDown=!1;this._endLineNumbers=[];this._mouseTarget=null;this._onDidChangeStickyScrollHeight=this._register(new E);this.onDidChangeStickyScrollHeight=this._onDidChangeStickyScrollHeight.event;this._stickyScrollWidget=new sCt(this._editor),this._stickyLineCandidateProvider=new DCe(this._editor,o,r),this._register(this._stickyScrollWidget),this._register(this._stickyLineCandidateProvider),this._widgetState=TCe.Empty;let c=this._stickyScrollWidget.getDomNode();this._register(this._editor.onDidChangeLineHeight(p=>{p.changes.forEach(h=>{let g=h.lineNumber;this._widgetState.startLineNumbers.includes(g)&&this._renderStickyScroll(g)})})),this._register(this._editor.onDidChangeFont(p=>{p.changes.forEach(h=>{let g=h.lineNumber;this._widgetState.startLineNumbers.includes(g)&&this._renderStickyScroll(g)})})),this._register(this._editor.onDidChangeConfiguration(p=>{this._readConfigurationChange(p)})),this._register(j(c,re.CONTEXT_MENU,async p=>{this._onContextMenu(Me(c),p)})),this._stickyScrollFocusedContextKey=ue.stickyScrollFocused.bindTo(this._contextKeyService),this._stickyScrollVisibleContextKey=ue.stickyScrollVisible.bindTo(this._contextKeyService);let u=this._register(Vn(c));this._register(u.onDidBlur(p=>{this._positionRevealed===!1&&c.clientHeight===0?(this._focusedStickyElementIndex=-1,this.focus()):this._disposeFocusStickyScrollStore()})),this._register(u.onDidFocus(p=>{this.focus()})),this._registerMouseListeners(),this._register(j(c,re.MOUSE_DOWN,p=>{this._onMouseDown=!0})),this._register(this._stickyScrollWidget.onDidChangeStickyScrollHeight(p=>{this._onDidChangeStickyScrollHeight.fire(p)})),this._onDidResize(),this._readConfiguration()}static{this.ID="store.contrib.stickyScrollController"}get stickyScrollCandidateProvider(){return this._stickyLineCandidateProvider}get stickyScrollWidgetState(){return this._widgetState}get stickyScrollWidgetHeight(){return this._stickyScrollWidget.height}static get(e){return e.getContribution(rb.ID)}_disposeFocusStickyScrollStore(){this._stickyScrollFocusedContextKey.set(!1),this._focusDisposableStore?.dispose(),this._focused=!1,this._positionRevealed=!1,this._onMouseDown=!1}isFocused(){return this._focused}focus(){if(this._onMouseDown){this._onMouseDown=!1,this._editor.focus();return}this._stickyScrollFocusedContextKey.get()!==!0&&(this._focused=!0,this._focusDisposableStore=new P,this._stickyScrollFocusedContextKey.set(!0),this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumbers.length-1,this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex))}focusNext(){this._focusedStickyElementIndex<this._stickyScrollWidget.lineNumberCount-1&&this._focusNav(!0)}focusPrevious(){this._focusedStickyElementIndex>0&&this._focusNav(!1)}selectEditor(){this._editor.focus()}_focusNav(e){this._focusedStickyElementIndex=e?this._focusedStickyElementIndex+1:this._focusedStickyElementIndex-1,this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex)}goToFocused(){let e=this._stickyScrollWidget.lineNumbers;this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:e[this._focusedStickyElementIndex],column:1})}_revealPosition(e){this._reveaInEditor(e,()=>this._editor.revealPosition(e))}_revealLineInCenterIfOutsideViewport(e){this._reveaInEditor(e,()=>this._editor.revealLineInCenterIfOutsideViewport(e.lineNumber,0))}_reveaInEditor(e,t){this._focused&&this._disposeFocusStickyScrollStore(),this._positionRevealed=!0,t(),this._editor.setSelection(z.fromPositions(e)),this._editor.focus()}_registerMouseListeners(){let e=this._register(new P),t=this._register(new sO(this._editor,{extractLineNumberFromMouseEvent:r=>{let s=this._stickyScrollWidget.getEditorPositionFromNode(r.target.element);return s?s.lineNumber:0}})),o=r=>{if(!this._editor.hasModel()||r.target.type!==12||r.target.detail!==this._stickyScrollWidget.getId())return null;let s=r.target.element;if(!s||s.innerText!==s.innerHTML)return null;let l=this._stickyScrollWidget.getEditorPositionFromNode(s);return l?{range:new z(l.lineNumber,l.column,l.lineNumber,l.column+s.innerText.length),textElement:s}:null},n=this._stickyScrollWidget.getDomNode();this._register(Vo(n,re.CLICK,r=>{if(r.ctrlKey||r.altKey||r.metaKey||!r.leftButton)return;if(r.shiftKey){let u=this._stickyScrollWidget.getLineIndexFromChildDomNode(r.target);if(u===null)return;let p=new Ie(this._endLineNumbers[u],1);this._revealLineInCenterIfOutsideViewport(p);return}if(this._stickyScrollWidget.isInFoldingIconDomNode(r.target)){let u=this._stickyScrollWidget.getLineNumberFromChildDomNode(r.target);this._toggleFoldingRegionForLine(u);return}if(!this._stickyScrollWidget.isInStickyLine(r.target))return;let c=this._stickyScrollWidget.getEditorPositionFromNode(r.target);if(!c){let u=this._stickyScrollWidget.getLineNumberFromChildDomNode(r.target);if(u===null)return;c=new Ie(u,1)}this._revealPosition(c)})),this._register(j(It,re.MOUSE_MOVE,r=>{this._mouseTarget=r.target,this._onMouseMoveOrKeyDown(r)})),this._register(j(It,re.KEY_DOWN,r=>{this._onMouseMoveOrKeyDown(r)})),this._register(j(It,re.KEY_UP,()=>{this._showEndForLine!==void 0&&(this._showEndForLine=void 0,this._renderStickyScroll())})),this._register(t.onMouseMoveOrRelevantKeyDown(([r,s])=>{let l=o(r);if(!l||!r.hasTriggerModifier||!this._editor.hasModel()){e.clear();return}let{range:c,textElement:u}=l;if(!c.equalsRange(this._stickyRangeProjectedOnEditor))this._stickyRangeProjectedOnEditor=c,e.clear();else if(u.style.textDecoration==="underline")return;let p=new $e;e.add(Z(()=>p.dispose(!0)));let h;U1(this._languageFeaturesService.definitionProvider,this._editor.getModel(),new Ie(c.startLineNumber,c.startColumn+1),!1,p.token).then((g=>{if(!p.token.isCancellationRequested)if(g.length!==0){this._candidateDefinitionsLength=g.length;let f=u;h!==f?(e.clear(),h=f,h.style.textDecoration="underline",e.add(Z(()=>{h.style.textDecoration="none"}))):h||(h=f,h.style.textDecoration="underline",e.add(Z(()=>{h.style.textDecoration="none"})))}else e.clear()}))})),this._register(t.onCancel(()=>{e.clear()})),this._register(t.onExecute(async r=>{if(r.target.type!==12||r.target.detail!==this._stickyScrollWidget.getId())return;let s=this._stickyScrollWidget.getEditorPositionFromNode(r.target.element);s&&(!this._editor.hasModel()||!this._stickyRangeProjectedOnEditor||(this._candidateDefinitionsLength>1&&(this._focused&&this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:s.lineNumber,column:1})),this._instaService.invokeFunction(jyt,r,this._editor,{uri:this._editor.getModel().uri,range:this._stickyRangeProjectedOnEditor})))}))}_onContextMenu(e,t){let o=new yn(e,t);this._contextMenuService.showContextMenu({menuId:D.StickyScrollContext,getAnchor:()=>o,menuActionOptions:{renderShortTitle:!0}})}_onMouseMoveOrKeyDown(e){if(!e.shiftKey||!this._mouseTarget||!Ao(this._mouseTarget))return;let t=this._stickyScrollWidget.getLineIndexFromChildDomNode(this._mouseTarget);t===null||this._showEndForLine===t||(this._showEndForLine=t,this._renderStickyScroll())}_toggleFoldingRegionForLine(e){if(!this._foldingModel||e===null)return;let t=this._stickyScrollWidget.getRenderedStickyLine(e),o=t?.foldingIcon;if(!o)return;c4e(this._foldingModel,1,[e]),o.isCollapsed=!o.isCollapsed;let n=(o.isCollapsed?this._editor.getTopForLineNumber(o.foldingEndLine):this._editor.getTopForLineNumber(o.foldingStartLine))-this._editor.getOption(75)*t.index+1;this._editor.setScrollTop(n),this._renderStickyScroll(e)}_readConfiguration(){let e=this._editor.getOption(131);if(e.enabled===!1){this._editor.removeOverlayWidget(this._stickyScrollWidget),this._resetState(),this._sessionStore.clear(),this._enabled=!1;return}else e.enabled&&!this._enabled&&(this._editor.addOverlayWidget(this._stickyScrollWidget),this._sessionStore.add(this._editor.onDidScrollChange(o=>{o.scrollTopChanged&&(this._showEndForLine=void 0,this._renderStickyScroll())})),this._sessionStore.add(this._editor.onDidLayoutChange(()=>this._onDidResize())),this._sessionStore.add(this._editor.onDidChangeModelTokens(o=>this._onTokensChange(o))),this._sessionStore.add(this._stickyLineCandidateProvider.onDidChangeStickyScroll(()=>{this._showEndForLine=void 0,this._renderStickyScroll()})),this._enabled=!0);this._editor.getOption(76).renderType===2?this._cursorPositionListener||(this._cursorPositionListener=this._editor.onDidChangeCursorPosition(o=>{this._positionLineNumber!==o.position.lineNumber&&(this._positionLineNumber=o.position.lineNumber,this._showEndForLine=void 0,this._renderStickyScroll(0))}),this._sessionStore.add(this._cursorPositionListener)):this._cursorPositionListener&&(this._sessionStore.delete(this._cursorPositionListener),this._cursorPositionListener.dispose(),this._cursorPositionListener=void 0)}_readConfigurationChange(e){(e.hasChanged(131)||e.hasChanged(81)||e.hasChanged(75)||e.hasChanged(126)||e.hasChanged(76))&&this._readConfiguration(),(e.hasChanged(76)||e.hasChanged(52)||e.hasChanged(126))&&this._renderStickyScroll(0)}_needsUpdate(e){let t=this._stickyScrollWidget.getCurrentLines();for(let o of t)for(let n of e.ranges)if(o>=n.fromLineNumber&&o<=n.toLineNumber)return!0;return!1}_onTokensChange(e){this._needsUpdate(e)&&this._renderStickyScroll(0)}_onDidResize(){let t=this._editor.getLayoutInfo().height/this._editor.getOption(75);this._maxStickyLines=Math.round(t*.25),this._renderStickyScroll(0)}async _renderStickyScroll(e){let t=this._editor.getModel();if(!t||t.isTooLargeForTokenization()){this._resetState();return}let o=this._updateAndGetMinRebuildFromLine(e),n=this._stickyLineCandidateProvider.getVersionId();if(n===void 0||n===t.getVersionId())if(!this._focused)await this._updateState(o);else if(this._focusedStickyElementIndex===-1)await this._updateState(o),this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumberCount-1,this._focusedStickyElementIndex!==-1&&this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex);else{let s=this._stickyScrollWidget.lineNumbers[this._focusedStickyElementIndex];await this._updateState(o),this._stickyScrollWidget.lineNumberCount===0?this._focusedStickyElementIndex=-1:(this._stickyScrollWidget.lineNumbers.includes(s)||(this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumberCount-1),this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex))}}_updateAndGetMinRebuildFromLine(e){if(e!==void 0){let t=this._minRebuildFromLine!==void 0?this._minRebuildFromLine:1/0;this._minRebuildFromLine=Math.min(e,t)}return this._minRebuildFromLine}async _updateState(e){this._minRebuildFromLine=void 0,this._foldingModel=await Qg.get(this._editor)?.getFoldingModel()??void 0,this._widgetState=this.findScrollWidgetState();let t=this._widgetState.startLineNumbers.length>0;this._stickyScrollVisibleContextKey.set(t),this._stickyScrollWidget.setState(this._widgetState,this._foldingModel,e)}async _resetState(){this._minRebuildFromLine=void 0,this._foldingModel=void 0,this._widgetState=TCe.Empty,this._stickyScrollVisibleContextKey.set(!1),this._stickyScrollWidget.setState(void 0,void 0)}findScrollWidgetState(){let e=Math.min(this._maxStickyLines,this._editor.getOption(131).maxLineCount),t=this._editor.getScrollTop(),o=0,n=[],r=[],s=this._editor.getVisibleRanges();if(s.length!==0){let l=new rj(s[0].startLineNumber,s[s.length-1].endLineNumber),c=this._stickyLineCandidateProvider.getCandidateStickyLinesIntersecting(l);for(let u of c){let p=u.startLineNumber,h=u.endLineNumber,g=u.top,f=g+u.height,v=this._editor.getTopForLineNumber(p)-t,b=this._editor.getBottomForLineNumber(h)-t;if(g>v&&g<=b&&(n.push(p),r.push(h+1),f>b&&(o=b-f)),n.length===e)break}}return this._endLineNumbers=r,new TCe(n,r,o,this._showEndForLine)}dispose(){super.dispose(),this._sessionStore.dispose()}};rb=I([m(1,ze),m(2,zt),m(3,F),m(4,bs),m(5,jg),m(6,X)],rb);var z7=J("inlineEdit.originalBackground",ei(Cf,.2),d(1392,null),!0),cCt=J("inlineEdit.modifiedBackground",ei(Hg,.3),d(1388,null),!0),CEs=J("inlineEdit.originalChangedLineBackground",ei(Cf,.8),d(1394,null),!0),DQi=J("inlineEdit.originalChangedTextBackground",ei(Cf,.8),d(1395,null),!0),LQi=J("inlineEdit.modifiedChangedLineBackground",{light:ei(F$e,.7),dark:ei(F$e,.7),hcDark:F$e,hcLight:F$e},d(1390,null),!0),RQi=J("inlineEdit.modifiedChangedTextBackground",ei(Hg,.7),d(1391,null),!0),K7=J("inlineEdit.gutterIndicator.primaryForeground",YT,d(1381,null)),SO=J("inlineEdit.gutterIndicator.primaryBorder",MS,d(1380,null)),J1=J("inlineEdit.gutterIndicator.primaryBackground",{light:ei(SO,.5),dark:ei(SO,.4),hcDark:ei(SO,.4),hcLight:ei(SO,.5)},d(1379,null)),MQi=J("inlineEdit.gutterIndicator.secondaryForeground",s9,d(1384,null)),PQi=J("inlineEdit.gutterIndicator.secondaryBorder",OU,d(1383,null)),LCe=J("inlineEdit.gutterIndicator.secondaryBackground",qT,d(1382,null)),AQi=J("inlineEdit.gutterIndicator.successfulForeground",YT,d(1387,null)),bai=J("inlineEdit.gutterIndicator.successfulBorder",MS,d(1386,null)),RCe=J("inlineEdit.gutterIndicator.successfulBackground",bai,d(1385,null)),NQi=J("inlineEdit.gutterIndicator.background",{hcDark:ei("tab.inactiveBackground",.5),hcLight:ei("tab.inactiveBackground",.5),dark:ei("tab.inactiveBackground",.5),light:"#5f5f5f18"},d(1378,null)),Q4e=J("inlineEdit.originalBorder",{light:Cf,dark:Cf,hcDark:Cf,hcLight:Cf},d(1393,null)),Y4e=J("inlineEdit.modifiedBorder",{light:Sp(Hg,.6),dark:Hg,hcDark:Hg,hcLight:Hg},d(1389,null)),oBo=J("inlineEdit.tabWillAcceptModifiedBorder",{light:Sp(Y4e,0),dark:Sp(Y4e,0),hcDark:Sp(Y4e,0),hcLight:Sp(Y4e,0)},d(1396,null)),nBo=J("inlineEdit.tabWillAcceptOriginalBorder",{light:Sp(Q4e,0),dark:Sp(Q4e,0),hcDark:Sp(Q4e,0),hcLight:Sp(Q4e,0)},d(1397,null));function sj(a){return a.map(i=>i==="accept"?oBo:Y4e)}function G7(a){return a.map(i=>i==="accept"?nBo:Q4e)}function sb(a,i){let e;typeof a=="string"?e=U7(a,i):e=a.map((o,n)=>U7(o,i).read(n));let t=U7(qo,i);return e.map((o,n)=>o.makeOpaque(t.read(n)))}function b_(a){let i;switch(a){case"textEditor":i=qo;break;case"diffEditor":i=qo;break;case"notebook":i="notebook.cellEditorBackground";break;default:Hr(a,"Not supported editor type yet")}return wt(i)}function U7(a,i){return ff({owner:{observeColor:a},equalsFn:(e,t)=>e.equals(t),debugName:()=>`observeColor(${a})`},i.onDidColorThemeChange,()=>{let e=i.getColorTheme().getColor(a);if(!e)throw new ni(`Missing color: ${a}`);return e})}var ab=3;function ZM(a,i,e){let t=a.model.read(e);if(!t)return 0;let o=0;for(let r=i.startLineNumber;r<i.endLineNumberExclusive;r++){let s=a.getWidthOfLine(r,e);o=Math.max(o,s)}let n=i.mapToLineArray(r=>t.getLineContent(r));return o<5&&n.some(r=>r.length>0)&&t.uri.scheme!=="file"&&console.error("unexpected width"),o}function FQi(a,i,e){Nr(a,a.editor.onDidChangeLineHeight).read(e);let t=a.model.read(e);if(!t)throw new ni("Model is required");let o=[];for(let n=i.startLineNumber;n<i.endLineNumberExclusive;n++){let r=a.getWidthOfLine(n,e);if(r===-1){let l=t.getLineMaxColumn(n),c=a.editor.getOption(59).typicalHalfwidthCharacterWidth;r=l*c}let s=a.editor.getLineHeightForPosition(new Ie(n,1));o.push(new H7(r,s))}return o}function WQi(a,i,e){return a.layoutInfo.read(e),a.value.read(e),a.model.read(e)?(a.scrollTop.read(e),a.editor.getOffsetForColumn(i.lineNumber,i.column)):0}function MCe(a,i,e,t,o=void 0){let n=t.getModel();if(!n)return{prefixTrim:0,prefixLeftOffset:0};let r=a.map(h=>h.isSingleLine()?h.startColumn-1:0),s=i.mapToLineArray(h=>yye(n.getLineContent(h))),l=e.filter(h=>h!=="").map(h=>yye(h)),c=Math.min(...r,...s,...l),u;if(n.getLineIndentColumn(i.startLineNumber)>=c+1)os(t).scrollTop.read(o),u=t.getOffsetForColumn(i.startLineNumber,c+1);else if(e.length>0)u=X4e(e[0].slice(0,c),t,n);else return{prefixTrim:0,prefixLeftOffset:0};return{prefixTrim:c,prefixLeftOffset:u}}function X4e(a,i,e){let t=i.getOption(59).typicalHalfwidthCharacterWidth,o=e.getOptions().tabSize*t,n=a.split(" ").length-1;return(a.length-n)*t+n*o}function PCe(a){let i=a.layoutInfoContentLeft,e=Ce({name:"editor.validOverlay.width"},o=>{let n=a.layoutInfoMinimap.read(o).minimapLeft!==0,r=Math.max(0,a.layoutInfoWidth.read(o)-i.read(o));if(n){let s=a.layoutInfoMinimap.read(o).minimapWidth+a.layoutInfoVerticalScrollbarWidth.read(o);return Math.max(0,r-s)}return r}),t=Ce({name:"editor.validOverlay.height"},o=>a.layoutInfoHeight.read(o)+a.contentHeight.read(o));return Ce({name:"editor.validOverlay"},o=>bu.fromLeftTopWidthHeight(i.read(o),0,e.read(o),t.read(o)))}var OQi=class a{constructor(i){this.scheme=i}static{this._modelId=0}getUniqueUri(){return A.from({scheme:this.scheme,path:new Date().toString()+String(a._modelId++)})}};function VQi(a,i){let e=[];for(let t of a){let o=i.mapRange(t.modifiedRange);e.push(new cg(t.originalRange,o))}return e}function ACe(...a){return a.filter(i=>typeof i=="string").join(" ")}function rBo(a,i){return new z(i.lineNumber,i.column+a.start,i.lineNumber,i.column+a.endExclusive)}function sBo(a,i){let e=0;e:for(let t=0,o=a.length;t<o;t++)switch(a.charCodeAt(t)){case 9:e+=i;break;case 32:e++;break;default:break e}return e-e%i}function aBo(a,i,e){let t=i-i%e,o=0;for(;o<a.length&&t!==0;o++)switch(a.charCodeAt(o)){case 9:t-=e;break;case 32:t--;break;default:throw new ni("Unexpected character found while calculating indent length")}return o}function BQi(a,i,e){let t=mc(a),o=[],n=Put(i.mapToLineArray(r=>sBo(t[r-1],e)),qd);return i.forEach(r=>{let s=aBo(t[r-1],n,e);o.push(new Xr(rBo(new di(0,s),new Ie(r,1)),""))}),new bp(o)}var Rle=class{constructor(){this._data=""}moveTo(i){return this._data+=`M ${i.x} ${i.y} `,this}lineTo(i){return this._data+=`L ${i.x} ${i.y} `,this}curveTo(i,e){return this._data+=`Q ${i.x} ${i.y} ${e.x} ${e.y} `,this}curveTo2(i,e,t){return this._data+=`C ${i.x} ${i.y} ${e.x} ${e.y} ${t.x} ${t.y} `,this}build(){return this._data}};function CE(a){let i=vf(void 0,(e,t)=>a.read(e)||t);return hs({debugName:()=>`${a.debugName}.mapOutFalsy`},e=>{if(i.read(e),!!a.read(e))return i})}function lb(a,i=Il.ofCaller()){return{left:Ce({name:"editor.validOverlay.left"},e=>a(e)?.left,i),top:Ce({name:"editor.validOverlay.top"},e=>a(e)?.top,i),width:Ce({name:"editor.validOverlay.width"},e=>{let t=a(e);if(t)return t.width},i),height:Ce({name:"editor.validOverlay.height"},e=>{let t=a(e);if(t)return t.height},i)}}function HQi(a,i){let e=a.getContainerDomNode(),t=Le("domRect",e.getBoundingClientRect());return i.add(a.onDidLayoutChange(o=>{t.set(e.getBoundingClientRect(),void 0)})),t}var NCe=class{constructor(i,e,t,o,n,r){this._editorObs=i;this._data=e;this._close=t;this._contextKeyService=o;this._keybindingService=n;this._commandService=r;this._inlineEditsShowCollapsed=this._editorObs.getOption(71).map(s=>s.edits.showCollapsed)}toDisposableLiveElement(){return this._createHoverContent().toDisposableLiveElement()}_createHoverContent(){let i=Le("active",void 0),e=b=>({title:b.title,icon:b.icon,keybinding:typeof b.commandId=="string"?this._getKeybinding(b.commandArgs?void 0:b.commandId):Ce(this,S=>typeof b.commandId=="string"?void 0:this._getKeybinding(b.commandArgs?void 0:b.commandId.read(S)).read(S)),isActive:i.map(S=>S===b.id),onHoverChange:S=>i.set(S?b.id:void 0,void 0),onAction:()=>{let S=typeof b.commandId=="string"?b.commandId:b.commandId.get();return this._close(!0,S),this._commandService.executeCommand(S,...b.commandArgs??[])}}),t=this._data.extensionCommands.map(b=>b.map((S,y)=>aj(e({id:S.command.id+"_"+y,title:S.command.title,icon:S.icon??M.symbolEvent,commandId:S.command.id,commandArgs:S.command.arguments})))),o=[];for(let b of t)b.length>0&&(o.push(Sai()),o.push(...b));if(this._data.extensionCommandsOnly)return UQi(o.slice(1));let n=lBo(this._data.displayName),r=aj(e({id:"gotoAndAccept",title:d(1368,null),icon:M.check,commandId:E1})),s=aj(e({id:"reject",title:d(1369,null),icon:M.close,commandId:LIt})),l=this._data.alternativeAction?aj(e({id:"alternativeCommand",title:this._data.alternativeAction.command.title,icon:this._data.alternativeAction.icon,commandId:Kae})):void 0,u=!1?this._data.modelInfo?.models.map(b=>aj({title:b.name,icon:b.id===this._data.modelInfo?.currentModelId?M.check:M.circle,keybinding:Oo(void 0),isActive:i.map(S=>S==="model_"+b.id),onHoverChange:S=>i.set(S?"model_"+b.id:void 0,void 0),onAction:()=>{this._close(!0),this._data.setModelId?.(b.id)}}))??[]:[],p=this._inlineEditsShowCollapsed.map(b=>aj(e(b?{id:"showExpanded",title:d(1372,null),icon:M.expandAll,commandId:u5e}:{id:"showCollapsed",title:d(1371,null),icon:M.collapseAll,commandId:u5e}))),h=aj(e({id:"snooze",title:d(1373,null),icon:M.bellSlash,commandId:"editor.action.inlineSuggest.snooze"})),g=aj(e({id:"settings",title:d(1370,null),icon:M.gear,commandId:"workbench.action.openSettings",commandArgs:["@tag:nextEditSuggestions"]})),f=this._data.action?[this._data.action]:[],v=f.length>0?cBo(f.map(b=>({id:b.id,label:b.title+"...",enabled:!0,run:()=>this._commandService.executeCommand(b.id,...b.arguments??[]),class:void 0,tooltip:b.tooltip??b.title})),{hoverDelegate:US}):void 0;return UQi([n,r,l,s,p,u.length?Sai():void 0,...u,h,g,...o,v?Sai():void 0,v])}_getKeybinding(i){return i?ui(this._contextKeyService.onDidChangeContext,()=>this._keybindingService.lookupKeybinding(i)):Oo(void 0)}};NCe=I([m(3,X),m(4,_e),m(5,ge)],NCe);function UQi(a){return Mo.div({class:"content",style:{margin:4,minWidth:180}},a)}function lBo(a){return Mo.div({class:"header",style:{color:wt(A$e),fontSize:"13px",fontWeight:"600",padding:"0 4px",lineHeight:28}},[a])}function aj(a){return Ce({name:"inlineEdits.option"},i=>Mo.div({class:["monaco-menu-option",a.isActive?.map(e=>e&&"active")],onmouseenter:()=>a.onHoverChange?.(!0),onmouseleave:()=>a.onHoverChange?.(!1),onclick:a.onAction,onkeydown:e=>{e.key==="Enter"&&a.onAction?.()},tabIndex:0,style:{borderRadius:3}},[Mo.elem("span",{style:{fontSize:16,display:"flex"}},[q.isThemeIcon(a.icon)?Qo(a.icon):a.icon.map(e=>Qo(e))]),Mo.elem("span",{},[a.title]),Mo.div({style:{marginLeft:"auto"},ref:e=>{let t=i.store.add(new ah(e,zo,{disableTitle:!0,...l_,keybindingLabelShadow:void 0,keybindingLabelForeground:wt(A$e),keybindingLabelBackground:"transparent",keybindingLabelBorder:"transparent",keybindingLabelBottomBorder:void 0}));i.store.add(he(o=>{t.set(a.keybinding.read(o))}))}})]))}function cBo(a,i){return Ce({name:"inlineEdits.actionBar"},e=>Mo.div({class:["action-widget-action-bar"],style:{padding:"3px 24px"}},[Mo.div({ref:t=>{e.store.add(new ji(t,i)).push(a,{icon:!1,label:!0})}})]))}function Sai(){return Mo.div({id:"inline-edit-gutter-indicator-menu-separator",class:"menu-separator",style:{color:wt(UGi),padding:"2px 0"}},Mo.div({style:{borderBottom:`1px solid ${wt(OU)}`}}))}var $7=class{constructor(i,e,t,o,n){this.gutterMenuData=i;this.originalRange=e;this.model=t;this.altAction=o;this.customization=n}},q7=class a{constructor(i,e,t,o,n,r,s=!1){this.action=i;this.displayName=e;this.extensionCommands=t;this.alternativeAction=o;this.modelInfo=n;this.setModelId=r;this.extensionCommandsOnly=s}static fromInlineSuggestion(i){let e=i.action?.kind==="edit"?i.action.alternativeAction:void 0,t=i.source.inlineSuggestions.commands??[];return new a(i.gutterMenuLinkAction,i.source.provider.displayName??d(1374,null),t.length>0?[t]:[],e,i.source.provider.modelInfo,i.source.provider.setModelId?.bind(i.source.provider))}},j7=class a{constructor(i,e){this.accept=i;this.jump=e}static fromInlineCompletionModel(i){return new a(()=>i.accept(),()=>i.jump())}},Iai=16,zQi=2,Z1=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this._editorObs=e;this._data=t;this._tabAction=o;this._verticalOffset=n;this._isHoveringOverInlineEdit=r;this._focusIsInMenu=s;this._hoverService=l;this._instantiationService=c;this._accessibilityService=u;this._themeService=p;this._userInteractionService=h;this._onDidCloseWithCommand=this._register(new E);this.onDidCloseWithCommand=this._onDidCloseWithCommand.event;this._modifierPressed=Ce(this,e=>this._userInteractionService.readModifierKeyStatus(this._editorObs.editor.getDomNode(),e).shiftKey);this._gutterIndicatorStyles=Ce(this,e=>{let t=this._tabAction.read(e),o=this._data.read(e)?.altAction,n=this._modifierPressed.read(e);switch(o&&n&&(t="inactive"),t){case"inactive":return{background:sb(LCe,this._themeService).read(e).toString(),foreground:sb(MQi,this._themeService).read(e).toString(),border:sb(PQi,this._themeService).read(e).toString()};case"jump":return{background:sb(J1,this._themeService).read(e).toString(),foreground:sb(K7,this._themeService).read(e).toString(),border:sb(SO,this._themeService).read(e).toString()};case"accept":return{background:sb(RCe,this._themeService).read(e).toString(),foreground:sb(AQi,this._themeService).read(e).toString(),border:sb(bai,this._themeService).read(e).toString()};default:Hr(t)}});this._state=Ce(this,e=>{let t=this._originalRangeObs.read(e);if(t)return{range:t,lineOffsetRange:this._editorObs.observeLineOffsetRange(t,e.store)}});this._lineNumberToRender=Ce(this,e=>{if(this._verticalOffset.read(e)!==0)return"";let t=this._data.read(e)?.originalRange.startLineNumber,o=this._editorObs.getOption(76).read(e);if(t===void 0||o.renderType===0)return"";if(o.renderType===3){let n=this._editorObs.cursorPosition.read(e);return t%10===0||n&&n.lineNumber===t?t.toString():""}if(o.renderType===2){let n=this._editorObs.cursorPosition.read(e);if(!n)return"";let r=Math.abs(t-n.lineNumber);return r===0?t.toString():r.toString()}return o.renderType===4?o.renderFn?o.renderFn(t):"":t.toString()});this._availableWidthForIcon=Ce(this,e=>{let t=this._editorObs.editor.getModel(),o=this._editorObs.editor,n=this._editorObs.layoutInfo.read(e),r=n.decorationsLeft+n.decorationsWidth-n.glyphMarginLeft;if(!t||r<=0)return()=>0;if(n.lineNumbersLeft===0)return()=>r;let s=this._editorObs.getOption(76).read(e);if(s.renderType===2||s.renderType===0)return()=>r;let l=o.getOption(59).typicalHalfwidthCharacterWidth,c=n.lineNumbersLeft+n.lineNumbersWidth,p=(t.getLineCount()+1).toString().length,h=[];for(let g=1;g<=p;g++){let f=10**(g-1),v=o.getTopForLineNumber(f),b=g*l,S=Math.min(r,Math.max(0,c-b-n.glyphMarginLeft));h.push({firstLineNumberWithDigitCount:f,topOfLineNumber:v,usableWidthLeftOfLineNumber:S})}return g=>{for(let f=h.length-1;f>=0;f--)if(g>=h[f].topOfLineNumber)return h[f].usableWidthLeftOfLineNumber;throw new ni("Could not find avilable width for icon")}});this._layout=Ce(this,e=>{let t=this._state.read(e);if(!t)return;let o=this._editorObs.layoutInfo.read(e),n=this._editorObs.observeLineHeightForLine(t.range.map(de=>de.startLineNumber)).read(e),r=1,s=2,l=o.decorationsLeft+o.decorationsWidth-o.glyphMarginLeft-2*r,c=o.height-2*s,u=bu.fromLeftTopWidthHeight(r,s,l,c),p=u.withTop(this._stickyScrollHeight.read(e)),h=u.withTop(p.top+s),g=t.lineOffsetRange.read(e),f=bu.fromRanges(di.fromTo(h.left,h.right),g),v=n,b=this._verticalOffset.read(e),S=f.withHeight(v).translateY(b),y=p.containsRect(S),w=this._data.read(e)?.customization?.icon,k=w?Oo(w):this._tabAction.map(de=>de==="accept"?M.keyboardTab:M.arrowRight),T=w?Oo(w):Ce(this,de=>{if(this._isHoveredOverIconDebounced.read(de)||this._isHoveredOverInlineEditDebounced.read(de))return M.check;if(this._tabAction.read(de)==="accept")return M.keyboardTab;let se=this._editorObs.cursorLineNumber.read(de)??0,Se=t.range.read(de).startLineNumber;return se<=Se?M.keyboardTabAbove:M.keyboardTabBelow}),N=22,O=de=>{let se=this._availableWidthForIcon.read(void 0)(de.bottom+this._editorObs.editor.getScrollTop())-r;return Math.max(Math.min(se,N),Iai)};if(y){let de=S,se;o.lineNumbersWidth===0?se=Math.min(Math.max(o.lineNumbersLeft-u.left,0),de.width-N):se=Math.max(o.lineNumbersLeft+o.lineNumbersWidth-u.left,0);let Se=de.withWidth(se),ke=Iai+zQi,Ee=Math.min(de.width-se,N),He=de.withWidth(Math.max(Ee,ke)).translateX(se),Ve=Ee>=ke;return{gutterEditArea:f,icon:T,iconDirection:"right",iconRect:He,iconVisible:Ve,pillRect:de,lineNumberRect:Se}}let V=u.intersect(f);if(V&&V.height>=v){let de=S.moveToBeContainedIn(h).moveToBeContainedIn(V),se=de.withWidth(O(de));return{gutterEditArea:f,icon:T,iconDirection:"right",iconRect:se,pillRect:se,iconVisible:!0}}let G=S.moveToBeContainedIn(u),$=G.withWidth(O(G)),te=$,pe=$.top<S.top?"top":"bottom";return{gutterEditArea:f,icon:k,iconDirection:pe,iconRect:te,pillRect:$,iconVisible:!0}});this._iconRef=Mo.ref();this.isVisible=this._layout.map(e=>!!e);this._hoverVisible=Le(this,!1);this.isHoverVisible=this._hoverVisible;this._isHoveredOverIcon=Le(this,!1);this._isHoveredOverIconDebounced=kM(this._isHoveredOverIcon,100);this.isHoveredOverIcon=this._isHoveredOverIconDebounced;this._indicator=Mo.div({class:"inline-edits-view-gutter-indicator",style:{position:"absolute",overflow:"visible"}},CE(this._layout).map(e=>e?[Mo.div({style:{position:"absolute",background:wt(NQi),borderRadius:`${ab}px`,...lb(t=>e.read(t).gutterEditArea)}}),Mo.div({class:"icon",ref:this._iconRef,tabIndex:0,onclick:()=>{let o=this._layout.get()?.icon.get()===M.check,n=this._data.get();if(!n)throw new ni("Gutter indicator data not available");this._editorObs.editor.focus(),o?n.model.accept():n.model.jump()},onmouseenter:()=>{this._showHover()},style:{cursor:"pointer",zIndex:"20",position:"absolute",backgroundColor:this._gutterIndicatorStyles.map(t=>t.background),"--vscodeIconForeground":this._gutterIndicatorStyles.map(t=>t.foreground),border:this._gutterIndicatorStyles.map(t=>`1px solid ${t.border}`),boxSizing:"border-box",borderRadius:`${ab}px`,display:"flex",justifyContent:e.map(t=>t.iconDirection==="bottom"?"flex-start":"flex-end"),transition:this._modifierPressed.map(t=>t?"":"background-color 0.2s ease-in-out, width 0.2s ease-in-out"),...lb(t=>e.read(t).pillRect)}},[Mo.div({className:"line-number",style:{lineHeight:e.map(t=>t.lineNumberRect?t.lineNumberRect.height:0),display:e.map(t=>t.lineNumberRect?"flex":"none"),alignItems:"center",justifyContent:"flex-end",width:e.map(t=>t.lineNumberRect?t.lineNumberRect.width:0),height:"100%",color:this._gutterIndicatorStyles.map(t=>t.foreground)}},this._lineNumberToRender),Mo.div({style:{transform:e.map(t=>`rotate(${dBo(t.iconDirection)}deg)`),transition:"rotate 0.2s ease-in-out, opacity 0.2s ease-in-out",display:"flex",alignItems:"center",justifyContent:"center",height:"100%",opacity:e.map(t=>t.iconVisible?"1":"0"),marginRight:e.map(t=>t.pillRect.width-t.iconRect.width-(t.lineNumberRect?.width??0)),width:e.map(t=>t.iconRect.width),position:"relative",right:e.map(t=>t.iconDirection==="top"?"1px":"0"),color:this._data.map(t=>t?.customization?.icon?.color?wt(t.customization.icon.color.id):void 0)}},[e.map((t,o)=>uBo(Qo(t.icon.read(o)),{fontSize:pBo(Math.min(t.iconRect.width-zQi,Iai))}))])])]:[]));this._originalRangeObs=CE(this._data.map(f=>f?.originalRange)),this._stickyScrollController=rb.get(this._editorObs.editor),this._stickyScrollHeight=this._stickyScrollController?ui(this._stickyScrollController.onDidChangeStickyScrollHeight,()=>this._stickyScrollController.stickyScrollWidgetHeight):Oo(0);let g=this._indicator.keepUpdated(this._store);this._register(this._editorObs.createOverlayWidget({domNode:g.element,position:Oo(null),allowEditorOverflow:!1,minContentWidthInPx:Oo(0)})),this._register(this._editorObs.editor.onMouseMove(f=>{if(this._state.get()===void 0)return;let S=this._iconRef.element.getBoundingClientRect(),y=bu.fromLeftTopWidthHeight(S.left,S.top,S.width,S.height),w=new Uh(f.event.posx,f.event.posy);this._isHoveredOverIcon.set(y.containsPoint(w),void 0)})),this._register(this._editorObs.editor.onDidScrollChange(()=>{this._isHoveredOverIcon.set(!1,void 0)})),this._isHoveredOverInlineEditDebounced=kM(this._isHoveringOverInlineEdit,100),this._register(_s(this._isHoveredOverInlineEditDebounced,f=>{f&&this.triggerAnimation()})),this._register(he(f=>{g.readEffect(f),g.element&&this._editorObs.editor.applyFontInfo(g.element)}))}triggerAnimation(){return this._accessibilityService.isMotionReduced()?new Animation(null,null).finished:this._iconRef.element.animate([{outline:`2px solid ${this._gutterIndicatorStyles.map(t=>t.border).get()}`,outlineOffset:"-1px",offset:0},{outline:"2px solid transparent",outlineOffset:"10px",offset:1}],{duration:500}).finished}_showHover(){if(this._hoverVisible.get())return;let e=this._data.get();if(!e)throw new ni("Gutter indicator data not available");let t=new P,o=t.add(this._instantiationService.createInstance(NCe,this._editorObs,e.gutterMenuData,(s,l)=>{s&&this._editorObs.editor.focus(),l&&this._onDidCloseWithCommand.fire(l),r?.dispose()}).toDisposableLiveElement()),n=this._userInteractionService.createFocusTracker(o.element,t);t.add(he(s=>{this._focusIsInMenu.set(n.read(s),void 0)})),t.add(Z(()=>this._focusIsInMenu.set(!1,void 0)));let r=this._hoverService.showInstantHover({target:this._iconRef.element,content:o.element});r?(this._hoverVisible.set(!0,void 0),t.add(this._editorObs.editor.onDidScrollChange(()=>r.dispose())),t.add(r.onDispose(()=>{this._hoverVisible.set(!1,void 0),t.dispose()}))):t.dispose()}};Z1=I([m(6,tt),m(7,F),m(8,Bi),m(9,De),m(10,eC)],Z1);function dBo(a){switch(a){case"top":return 90;case"bottom":return-90;case"right":return 0}}function uBo(a,i){for(let e in i)a.style[e]=i[e];return a}function pBo(a){return`${a}px`}var OCe=class extends C{constructor(e,t,o,n,r){super();this._model=e;this._indicator=t;this._collapsedView=o;this._storageService=n;this._configurationService=r;this._disposables=this._register(new me);this._setupDone=Le({name:"setupDone"},!1);this._activeCompletionId=Ce(e=>{let t=this._model.read(e);if(!t||!this._setupDone.read(e))return;let o=this._indicator.read(e);if(!(!o||!o.isVisible.read(e)))return t.inlineEdit.inlineCompletion.identity.id});this._register(this._initializeDebugSetting()),this._disposables.value=this.setupNewUserExperience(),this._setupDone.set(!0,void 0)}setupNewUserExperience(){if(this.getNewUserType()==="active")return;let e=new P,t=!1,o=!1,n=0,r=0;return e.add($9t(this._activeCompletionId,async(s,l,c,u)=>{if(s===void 0)return;let p=this.getNewUserType();switch(p){case"firstTime":{(n++>=5||t)&&(p="secondTime",this.setNewUserType(p));break}case"secondTime":{r++>=3&&o&&(p="active",this.setNewUserType(p));break}}switch(p){case"firstTime":{for(let h=0;h<3&&!u.isCancellationRequested;h++)await this._indicator.get()?.triggerAnimation(),await Pi(500);break}case"secondTime":{this._indicator.get()?.triggerAnimation();break}}})),e.add(he(s=>{this._collapsedView.isVisible.read(s)&&this.getNewUserType()!=="active"&&this._collapsedView.triggerAnimation()})),e.add(he(s=>{let l=this._indicator.read(s);l&&s.store.add(_s(l.isHoveredOverIcon,async c=>{c&&(t=!0)}))})),e.add(he(s=>{let l=this._model.read(s);l&&s.store.add(l.onDidAccept(()=>{o=!0}))})),e}getNewUserType(){return this._storageService.get("inlineEditsGutterIndicatorUserKind",-1,"firstTime")}setNewUserType(e){switch(e){case"firstTime":throw new ni("UserKind should not be set to first time");case"secondTime":break;case"active":this._disposables.clear();break}this._storageService.store("inlineEditsGutterIndicatorUserKind",e,-1,0)}_initializeDebugSetting(){let e="editor.inlineSuggest.edits.resetNewUserExperience";return this._configurationService.getValue(e)&&this._storageService.remove("inlineEditsGutterIndicatorUserKind",-1),this._configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration(e)&&this._configurationService.getValue(e)&&(this._storageService.remove("inlineEditsGutterIndicatorUserKind",-1),this._disposables.value=this.setupNewUserExperience())})}};OCe=I([m(3,le),m(4,B)],OCe);var dCt=class{constructor(i,e,t,o,n,r,s){this.originalText=i;this.action=e;this.edit=t;this.cursorPosition=o;this.multiCursorPositions=n;this.commands=r;this.inlineCompletion=s}get lineEdit(){return this.action?.kind==="jumpTo"?new qU(ro.ofLength(this.action.position.lineNumber,0),[]):this.action?.kind==="edit"?qU.fromSingleTextEdit(this.edit.toReplacement(this.originalText),this.originalText):new qU(new ro(1,1),[])}get originalLineRange(){return this.lineEdit.lineRange}get modifiedLineRange(){return this.lineEdit.toLineEdit().getNewLineRanges()[0]}get displayRange(){return this.originalText.lineRange.intersect(this.originalLineRange.join(ro.ofLength(this.originalLineRange.startLineNumber,this.lineEdit.newLines.length)))}};var uCt=class{constructor(i,e,t){this._model=i;this.inlineEdit=e;this.tabAction=t;this.editorType=this._model.editorType,this.displayLocation=this.inlineEdit.inlineCompletion.hint,this.inViewPort=Ce(this,o=>eai(this._model.editor,this.inlineEdit.inlineCompletion,o)),this.onDidAccept=this._model.onDidAccept}accept(i){this._model.accept(void 0,i)}handleInlineEditShownNextFrame(i,e){let t=this.inlineEdit.inlineCompletion,o=Date.now();t.addRef(),Vw(()=>{this._model.handleInlineSuggestionShown(t,i,e,o),t.removeRef()})}};var FCe=class extends C{constructor(e,t,o){super();this._editor=e;this._edit=t;this._accessibilityService=o;this.onDidClick=H.None;this._iconRef=Mo.ref();this.isHovered=Oo(!1);this._editorObs=os(this._editor);let r=this._edit.map(u=>u?.edit?.replacements[0]??null).map(u=>u?XM(u,this._editor.getModel()).range.getStartPosition():null),s=this._editorObs.observePosition(r,this._store),l=Ce(u=>{let p=s.read(u);if(!p)return null;let h=this._editorObs.layoutInfoContentLeft.read(u),g=this._editorObs.scrollLeft.read(u);return new Uh(h+p.x-g,p.y)}),c=Mo.div({class:"inline-edits-collapsed-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:"block"}},[[this.getCollapsedIndicator(l)]]).keepUpdated(this._store).element;this._register(this._editorObs.createOverlayWidget({domNode:c,position:Oo(null),allowEditorOverflow:!1,minContentWidthInPx:Oo(0)})),this.isVisible=this._edit.map((u,p)=>!!u&&l.read(p)!==null)}triggerAnimation(){return this._accessibilityService.isMotionReduced()?new Animation(null,null).finished:this._iconRef.element.animate([{offset:0,transform:"translateY(-3px)"},{offset:.2,transform:"translateY(1px)"},{offset:.36,transform:"translateY(-1px)"},{offset:.52,transform:"translateY(1px)"},{offset:.68,transform:"translateY(-1px)"},{offset:.84,transform:"translateY(1px)"},{offset:1,transform:"translateY(0px)"}],{duration:2e3}).finished}getCollapsedIndicator(e){let t=this._editorObs.layoutInfoContentLeft,o=e.map((r,s)=>r?r.deltaX(-t.read(s)):null),n=this.createIconPath(o);return Mo.svg({class:"collapsedView",ref:this._iconRef,style:{position:"absolute",...lb(r=>PCe(this._editorObs).read(r)),overflow:"hidden",pointerEvents:"none"}},[Mo.svgElem("path",{class:"collapsedViewPath",d:n,fill:wt(SO)})])}createIconPath(e){return e.map(r=>{if(!r)return new Rle().build();let s=r.deltaX(-6/2).deltaY(-1),l=s.deltaX(6),c=s.deltaY(1),u=l.deltaY(1),p=c.deltaX(6/2).deltaY(3);return new Rle().moveTo(s).lineTo(l).lineTo(u).lineTo(p).lineTo(c).lineTo(s).build()})}};FCe=I([m(2,Bi)],FCe);var pCt=14,yai=0,lj=4,mCt=4,KQi=2,WCe=class extends C{constructor(e,t,o,n,r,s){super();this._editor=e;this._languageService=s;this._onDidClick=this._register(new E);this.onDidClick=this._onDidClick.event;this._isHovered=Le(this,!1);this.isHovered=this._isHovered;this._viewRef=Mo.ref();this._editorObs=os(this._editor);let l=o.map((h,g)=>{let f;switch(h){case"inactive":f=LCe;break;case"jump":f=J1;break;case"accept":f=RCe;break}return{border:sb(f,r).read(g).toString(),background:b_(n.read(g))}}),c=t.map(h=>h?this.getState(h):void 0),u=c.map(h=>h?this.getRendering(h,l):void 0);this.minEditorScrollHeight=Ce(this,h=>{let g=c.read(h);return g?g.rect.read(h).bottom+this._editor.getScrollTop():0});let p=Mo.div({class:"inline-edits-custom-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:"block"}},[u]).keepUpdated(this._store);this._register(this._editorObs.createOverlayWidget({domNode:p.element,position:Oo(null),allowEditorOverflow:!1,minContentWidthInPx:vf(this,(h,g)=>{let f=c.read(h);if(!f)return g??0;let v=f.rect.map(b=>b.right).read(h)+this._editorObs.layoutInfoVerticalScrollbarWidth.read(h)+lj-this._editorObs.layoutInfoContentLeft.read(h);return Math.max(g??0,v)}).recomputeInitiallyAndOnChange(this._store)})),this._register(he(h=>{if(!u.read(h)){this._isHovered.set(!1,void 0);return}this._isHovered.set(p.isHovered.read(h),void 0)}))}fitsInsideViewport(e,t,o){let n=this._editorObs.layoutInfoWidth.read(o),r=this._editorObs.layoutInfoContentLeft.read(o),s=this._editor.getLayoutInfo().verticalScrollbarWidth,l=this._editorObs.layoutInfoMinimap.read(o).minimapLeft!==0?this._editorObs.layoutInfoMinimap.read(o).minimapWidth:0,c=ZM(this._editorObs,e,void 0),u=X4e(t,this._editor,this._editor.getModel()),p=lj+pCt;return c+u+p<n-r-s-l}getState(e){let t=Ce(this,l=>{let c=e.range.startLineNumber,u=e.range.endLineNumber,p=e.range.startColumn,h=e.range.endColumn,g=this._editor.getModel()?.getLineCount()??0,f=ZM(this._editorObs,new ro(c,c+1),l),v=c+1<=g?ZM(this._editorObs,new ro(c+1,c+2),l):void 0,b=c-1>=1?ZM(this._editorObs,new ro(c-1,c),l):void 0,S=this._editor.getOffsetForColumn(c,p),y=this._editor.getOffsetForColumn(u,h);return{lineWidth:f,lineWidthBelow:v,lineWidthAbove:b,startContentLeftOffset:S,endContentLeftOffset:y}}),o=e.range.startLineNumber,n=e.range.endLineNumber,r=this.fitsInsideViewport(new ro(o,n+1),e.content,void 0);return{rect:Ce(this,l=>{let c=this._editorObs.getOption(59).read(l).typicalHalfwidthCharacterWidth,{lineWidth:u,lineWidthBelow:p,lineWidthAbove:h,startContentLeftOffset:g,endContentLeftOffset:f}=t.read(l),v=this._editorObs.layoutInfoContentLeft.read(l),b=this._editorObs.observeLineHeightForLine(o).recomputeInitiallyAndOnChange(l.store).read(l),S=this._editorObs.scrollTop.read(l),y=this._editorObs.scrollLeft.read(l),w;o===n&&f+5*c>=u&&r?w="end":p!==void 0&&p+pCt-mCt-lj<g?w="below":h!==void 0&&h+pCt-mCt-lj<g?w="above":w="end";let k,T,N=0,O=0;switch(w){case"end":{k=this._editorObs.editor.getTopForLineNumber(o),T=u,N=lj+pCt;break}case"below":{k=this._editorObs.editor.getTopForLineNumber(o+1),T=g,N=lj+mCt,O=yai+KQi;break}case"above":{k=this._editorObs.editor.getTopForLineNumber(o-1),T=g,N=lj+mCt,O=-yai+KQi;break}}return bu.fromLeftTopWidthHeight(v+T-y,k-S,c*e.content.length,b).withMargin(yai,lj).translateX(N).translateY(O)}),label:e.content,kind:e.style}}getRendering(e,t){let o=document.createElement("div"),n=this._editor.getModel().tokenization.tokenizeLinesAt(1,[e.label])?.[0],r;n&&e.kind===1?r=aW.fromLineTokens(n).toLineTokens(e.label,this._languageService.languageIdCodec):r=Bc.createEmpty(e.label,this._languageService.languageIdCodec);let s=EL(new dE([r]),uE.fromEditor(this._editor).withSetWidth(!1).withScrollBeyondLastColumn(0),[],o,!0);o.style.width=`${s.minWidthInPx}px`;let l=e.rect.map(c=>c.withMargin(0,lj));return Mo.div({class:"collapsedView",ref:this._viewRef,style:{position:"absolute",...lb(c=>l.read(c)),overflow:"hidden",boxSizing:"border-box",cursor:"pointer",border:t.map(c=>`1px solid ${c.border}`),borderRadius:`${ab}px`,backgroundColor:t.map(c=>c.background),display:"flex",alignItems:"center",justifyContent:"center",whiteSpace:"nowrap"},onmousedown:c=>{c.preventDefault()},onclick:c=>{this._onDidClick.fire(WL.create(c))}},[o])}};WCe=I([m(4,De),m(5,kt)],WCe);var hBo=0,gBo=0,wai=1,fBo=1,vBo=3,Cai=ab,hCt=class extends C{constructor(e,t,o,n){super();this._editor=e;this._edit=t;this._uiState=o;this._tabAction=n;this.onDidClick=H.None;this._display=Ce(this,e=>this._uiState.read(e)?"block":"none");this._editorMaxContentWidthInRange=Ce(this,e=>{let t=this._originalDisplayRange.read(e);return t?(this._editorObs.versionId.read(e),vf(this,(o,n)=>{let r=ZM(this._editorObs,t,o);return Math.max(r,n??0)})):Oo(0)}).map((e,t)=>e.read(t));this._maxPrefixTrim=Ce(this,e=>{let t=this._uiState.read(e);return t?MCe(t.deletions,t.originalRange,[],this._editor):{prefixTrim:0,prefixLeftOffset:0}});this._editorLayoutInfo=Ce(this,e=>{let t=this._edit.read(e);if(!t||!this._uiState.read(e))return null;let n=this._editorObs.layoutInfo.read(e),r=this._editorObs.scrollLeft.read(e),s=this._editorObs.getOption(59).map(f=>f.typicalHalfwidthCharacterWidth).read(e),l=n.contentLeft+Math.max(this._editorMaxContentWidthInRange.read(e),s)-r,c=t.originalLineRange,u=this._originalVerticalStartPosition.read(e)??this._editor.getTopForLineNumber(c.startLineNumber)-this._editorObs.scrollTop.read(e),p=this._originalVerticalEndPosition.read(e)??this._editor.getTopForLineNumber(c.endLineNumberExclusive)-this._editorObs.scrollTop.read(e),h=n.contentLeft+this._maxPrefixTrim.read(e).prefixLeftOffset-r;return l<=h?null:{codeRect:bu.fromLeftTopRightBottom(h,u,l,p).withMargin(gBo,hBo),contentLeft:n.contentLeft}}).recomputeInitiallyAndOnChange(this._store);this._originalOverlay=Mo.div({style:{pointerEvents:"none"}},Ce(this,e=>{let t=CE(this._editorLayoutInfo).read(e);if(!t)return;let o=t.map(c=>bu.fromLeftTopRightBottom(c.contentLeft-Cai-wai,c.codeRect.top,c.contentLeft,c.codeRect.bottom)),n=Ce(this,c=>{let u=t.read(c).codeRect,p=o.read(c);return u.intersectHorizontal(new di(p.left,Number.MAX_SAFE_INTEGER))}),r=this._uiState.map(c=>c?.editorType==="diffEditor"?vBo:fBo).read(e),s=n.map(c=>c.withMargin(r,r)),l=b_(this._uiState.map(c=>c?.editorType??"textEditor").read(e));return[Mo.div({class:"originalSeparatorDeletion",style:{...s.read(e).toStyles(),borderRadius:`${Cai}px`,border:`${wai+r}px solid ${l}`,boxSizing:"border-box"}}),Mo.div({class:"originalOverlayDeletion",style:{...n.read(e).toStyles(),borderRadius:`${Cai}px`,border:G7(this._tabAction).map(c=>`${wai}px solid ${wt(c)}`),boxSizing:"border-box",backgroundColor:wt(z7)}}),Mo.div({class:"originalOverlayHiderDeletion",style:{...o.read(e).toStyles(),backgroundColor:l}})]})).keepUpdated(this._store);this._nonOverflowView=Mo.div({class:"inline-edits-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:this._display}},[[this._originalOverlay]]).keepUpdated(this._store);this.isHovered=Oo(!1);this._editorObs=os(this._editor);let r=Ce(this,l=>{let c=this._edit.read(l);return c?new Ie(c.originalLineRange.startLineNumber,1):null}),s=Ce(this,l=>{let c=this._edit.read(l);return c?new Ie(c.originalLineRange.endLineNumberExclusive,1):null});this._originalDisplayRange=this._uiState.map(l=>l?.originalRange),this._originalVerticalStartPosition=this._editorObs.observePosition(r,this._store).map(l=>l?.y),this._originalVerticalEndPosition=this._editorObs.observePosition(s,this._store).map(l=>l?.y),this._register(this._editorObs.createOverlayWidget({domNode:this._nonOverflowView.element,position:Oo(null),allowEditorOverflow:!1,minContentWidthInPx:Ce(this,l=>{let c=this._editorLayoutInfo.read(l);return c===null?0:c.codeRect.width})}))}};var J4e=1,bBo=1,SBo=3,xai=ab,VCe=class extends C{constructor(e,t,o,n,r){super();this._editor=e;this._input=t;this._tabAction=o;this._languageService=r;this._onDidClick=this._register(new E);this.onDidClick=this._onDidClick.event;this._state=Ce(this,e=>{let t=this._input.read(e);if(!t)return;let o=this._editor.getModel(),n=o.getEOL();if(t.startColumn===1&&t.lineNumber>1&&o.getLineLength(t.lineNumber)!==0&&t.text.endsWith(n)&&!t.text.startsWith(n)){let r=o.getLineLength(t.lineNumber-1)+1;return{lineNumber:t.lineNumber-1,column:r,text:n+t.text.slice(0,-n.length)}}return{lineNumber:t.lineNumber,column:t.startColumn,text:t.text}});this._trimVertically=Ce(this,e=>{let t=this._state.read(e),o=t?.text;if(!o||o.trim()==="")return{topOffset:0,bottomOffset:0,linesTop:0,linesBottom:0};let n=this._editor.getLineHeightForPosition(new Ie(t.lineNumber,1)),r=this._editor.getModel().getEOL(),s=0,l=0,c=0;for(;c<o.length&&o.startsWith(r,c);c+=r.length)s+=1;for(let u=o.length;u>c&&o.endsWith(r,u);u-=r.length)l+=1;return{topOffset:s*n,bottomOffset:l*n,linesTop:s,linesBottom:l}});this._maxPrefixTrim=Ce(this,e=>{let t=this._state.read(e);if(!t)return{prefixLeftOffset:0,prefixTrim:0};let o=this._editor.getModel(),n=o.getEOL(),r=this._trimVertically.read(e),s=t.text.split(n),l=s.slice(r.linesTop,s.length-r.linesBottom);r.linesTop===0&&(l[0]=o.getLineContent(t.lineNumber)+l[0]);let c=new ro(t.lineNumber,t.lineNumber+(r.linesTop>0?0:1));return MCe([],c,l,this._editor)});this._ghostText=Ce(e=>{let t=this._state.read(e),o=this._maxPrefixTrim.read(e);if(!t)return;let r=this._editor.getModel().getEOL(),l=t.text.split(r).map((c,u)=>new Zk(new z(u+1,u===0?1:o.prefixTrim+1,u+1,c.length+1),"modified-background",0));return new $1(t.lineNumber,[new W7(t.column,t.text,!1,l)])});this._display=Ce(this,e=>this._state.read(e)?"block":"none");this._editorMaxContentWidthInRange=Ce(this,e=>{let t=this._state.read(e);if(!t)return 0;this._editorObs.versionId.read(e);let o=this._editor.getModel(),n=o.getEOL(),r=t.text.startsWith(n)?"":o.getValueInRange(new z(t.lineNumber,1,t.lineNumber,t.column)),s=o.getValueInRange(new z(t.lineNumber,t.column,t.lineNumber,o.getLineLength(t.lineNumber)+1)),c=(r+t.text+s).split(n),u=uE.fromEditor(this._editor).withSetWidth(!1).withScrollBeyondLastColumn(0),p=c.map(h=>{let g=o.tokenization.tokenizeLinesAt(t.lineNumber,[h])?.[0],f;return g?f=aW.fromLineTokens(g).toLineTokens(h,this._languageService.languageIdCodec):f=Bc.createEmpty(h,this._languageService.languageIdCodec),EL(new dE([f]),u,[],_("div"),!0).minWidthInPx});return Math.max(...p)});this.startLineOffset=this._trimVertically.map(e=>e.topOffset);this.originalLines=this._state.map(e=>e?new ro(e.lineNumber,Math.min(e.lineNumber+2,this._editor.getModel().getLineCount()+1)):void 0);this._overlayLayout=Ce(this,e=>{this._ghostText.read(e);let t=this._state.read(e);if(!t)return null;this._editorObs.observePosition(Le(this,new Ie(t.lineNumber,t.column)),e.store).read(e);let o=this._editorObs.layoutInfo.read(e),n=this._editorObs.scrollLeft.read(e),r=this._editorObs.layoutInfoVerticalScrollbarWidth.read(e),s=o.contentLeft+this._editorMaxContentWidthInRange.read(e)-n,l=this._maxPrefixTrim.read(e).prefixLeftOffset??0,c=o.contentLeft+l-n;if(s<=c)return null;let{topOffset:u,bottomOffset:p}=this._trimVertically.read(e),h=this._editorObs.scrollTop.read(e),g=this._ghostTextView.height.read(e)-u-p,f=this._editor.getTopForLineNumber(t.lineNumber)-h+u,v=f+g,b=new bu(c,f,s,v);return{overlay:b,startsAtContentLeft:l===0,contentLeft:o.contentLeft,minContentWidthRequired:l+b.width+r}}).recomputeInitiallyAndOnChange(this._store);this._modifiedOverlay=Mo.div({style:{pointerEvents:"none"}},Ce(this,e=>{let t=CE(this._overlayLayout).read(e);if(!t)return;let o=t.map(c=>bu.fromLeftTopRightBottom(c.contentLeft-xai-J4e,c.overlay.top,c.contentLeft,c.overlay.bottom)).read(e),n=this._input.map(c=>c?.editorType==="diffEditor"?SBo:bBo).read(e),r=t.map(c=>c.overlay.withMargin(0,J4e,0,c.startsAtContentLeft?0:J4e).intersectHorizontal(new di(o.left,Number.MAX_SAFE_INTEGER))),s=r.map(c=>c.withMargin(n,n)),l=b_(this._input.read(void 0)?.editorType??"textEditor");return[Mo.div({class:"originalUnderlayInsertion",style:{...s.read(e).toStyles(),borderRadius:xai,border:`${J4e+n}px solid ${l}`,boxSizing:"border-box"}}),Mo.div({class:"originalOverlayInsertion",style:{...r.read(e).toStyles(),borderRadius:xai,border:sj(this._tabAction).map(c=>`${J4e}px solid ${wt(c)}`),boxSizing:"border-box",backgroundColor:wt(cCt)}}),Mo.div({class:"originalOverlayHiderInsertion",style:{...o.toStyles(),backgroundColor:l}})]})).keepUpdated(this._store);this._view=Mo.div({class:"inline-edits-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:this._display}},[[this._modifiedOverlay]]).keepUpdated(this._store);this._editorObs=os(this._editor),this._ghostTextView=this._register(n.createInstance(X1,this._editor,Ce(s=>{let l=this._ghostText.read(s);if(l)return{ghostText:l,handleInlineCompletionShown:c=>{},warning:void 0}}),{extraClasses:["inline-edit"],isClickable:!0,shouldKeepCursorStable:!0})),this.isHovered=this._ghostTextView.isHovered,this._register(this._ghostTextView.onDidClick(s=>{this._onDidClick.fire(new WL(s))})),this._register(this._editorObs.createOverlayWidget({domNode:this._view.element,position:Oo(null),allowEditorOverflow:!1,minContentWidthInPx:Ce(this,s=>{let l=this._overlayLayout.read(s);return l===null?0:l.minContentWidthRequired})}))}};VCe=I([m(3,F),m(4,kt)],VCe);var BCe=class extends C{constructor(e,t,o,n,r,s){super();this._editor=e;this._edit=t;this._editorType=o;this._tabAction=n;this._languageService=r;this._themeService=s;this._onDidClick=this._register(new E);this.onDidClick=this._onDidClick.event;this._maxPrefixTrim=this._edit.map((l,c)=>l?MCe(l.replacements.flatMap(u=>[u.originalRange,u.modifiedRange]),l.originalRange,l.modifiedLines,this._editor.editor,c):void 0),this._modifiedLineElements=Ce(this,l=>{let c=[],u=0,p=this._maxPrefixTrim.read(l),h=this._edit.read(l);if(!h||!p)return;let g=p.prefixTrim,f=IBo(h.replacements.map(S=>S.modifiedRange)).map(S=>new z(S.startLineNumber,S.startColumn-g,S.endLineNumber,S.endColumn-g)),v=this._editor.model.get(),b=h.modifiedRange.startLineNumber;for(let S=0;S<h.modifiedRange.length;S++){let y=document.createElement("div"),w=b+S,k=h.modifiedLines[S].slice(g),T=v.tokenization.tokenizeLinesAt(w,[k])?.[0],N;T?N=aW.fromLineTokens(T).toLineTokens(k,this._languageService.languageIdCodec):N=Bc.createEmpty(k,this._languageService.languageIdCodec);let O=[];for(let U of f.filter(G=>G.startLineNumber===w)){let G=Math.min(U.endColumn,k.length+1);O.push(new Zk(new z(1,U.startColumn,1,G),"inlineCompletions-modified-bubble",0))}let V=EL(new dE([N]),uE.fromEditor(this._editor.editor).withSetWidth(!1).withScrollBeyondLastColumn(0),O,y,!0);this._editor.getOption(59).read(l),u=Math.max(u,V.minWidthInPx),c.push(y)}return{lines:c,requiredWidth:u}}),this._layout=Ce(this,l=>{let c=this._modifiedLineElements.read(l),u=this._maxPrefixTrim.read(l),p=this._edit.read(l);if(!c||!u||!p)return;let{prefixLeftOffset:h}=u,{requiredWidth:g}=c,f=this._editor.observeLineHeightsForLineRange(p.originalRange).read(l),v=(()=>{let ke=f.slice(0,p.modifiedRange.length);for(;ke.length<p.modifiedRange.length;)ke.push(f[f.length-1]);return ke})(),b=this._editor.layoutInfoContentLeft.read(l),S=this._editor.layoutInfoVerticalScrollbarWidth.read(l),y=this._editor.scrollLeft.read(l),w=this._editor.scrollTop.read(l),k=b-y,T=this._editor.editor.getModel(),N=p.originalRange.mapToLineArray(ke=>this._editor.editor.getOffsetForColumn(ke,T.getLineMaxColumn(ke))-h),O=Math.max(...N,g),V=p.originalRange.startLineNumber,U=p.originalRange.endLineNumberExclusive-1,G=this._editor.editor.getTopForLineNumber(V)-w,$=this._editor.editor.getBottomForLineNumber(U)-w,te=bu.fromLeftTopWidthHeight(k+h,G,O,$-G),pe=bu.fromLeftTopWidthHeight(te.left,te.bottom,te.width,v.reduce((ke,Ee)=>ke+Ee,0)),de=bu.hull([te,pe]),se=de.intersectVertical(new di(te.bottom,Number.MAX_SAFE_INTEGER)),Se=new bu(se.left,se.top,se.right,se.bottom);return{originalLinesOverlay:te,modifiedLinesOverlay:pe,background:de,lowerBackground:se,lowerText:Se,modifiedLineHeights:v,minContentWidthRequired:h+O+S}}),this._viewZoneInfo=Ce(l=>{if(!this._editor.getOption(71).map(f=>f.edits.allowCodeShifting==="always").read(l))return;let u=this._layout.read(l),p=this._edit.read(l);if(!u||!p)return;let h=u.lowerBackground.height,g=p.originalRange.endLineNumberExclusive;return{height:h,lineNumber:g}}),this.minEditorScrollHeight=Ce(this,l=>{let c=CE(this._layout).read(l);return!c||this._viewZoneInfo.read(l)!==void 0?0:c.read(l).lowerText.bottom+this._editor.editor.getScrollTop()}),this._div=Mo.div({class:"line-replacement"},[Ce(this,l=>{let c=CE(this._layout).read(l),u=this._modifiedLineElements.read(l);if(!c||!u)return[];let p=c.read(l),h=this._editor.layoutInfoContentLeft.read(l),g=this._editorType.read(l)==="diffEditor"?3:1;u.lines.forEach((S,y)=>{S.style.width=`${p.lowerText.width}px`,S.style.height=`${p.modifiedLineHeights[y]}px`,S.style.position="relative"});let f=sj(this._tabAction).read(l),v=G7(this._tabAction).read(l),b=b_(this._editorType.read(l));return[Mo.div({style:{position:"absolute",...lb(S=>PCe(this._editor).read(S)),overflow:"hidden",pointerEvents:"none"}},[Mo.div({class:"borderAroundLineReplacement",style:{position:"absolute",...lb(S=>c.read(S).background.translateX(-h).withMargin(g)),borderRadius:`${ab}px`,border:`${g+1}px solid ${b}`,boxSizing:"border-box",pointerEvents:"none"}}),Mo.div({class:"originalOverlayLineReplacement",style:{position:"absolute",...lb(S=>c.read(S).background.translateX(-h)),borderRadius:`${ab}px`,border:sb(v,this._themeService).map(S=>`1px solid ${S.toString()}`),pointerEvents:"none",boxSizing:"border-box",background:wt(z7)}}),Mo.div({class:"modifiedOverlayLineReplacement",style:{position:"absolute",...lb(S=>c.read(S).lowerBackground.translateX(-h)),borderRadius:`0 0 ${ab}px ${ab}px`,background:b,boxShadow:`${wt(PU)} 0 6px 6px -6px`,border:`1px solid ${wt(f)}`,boxSizing:"border-box",overflow:"hidden",cursor:"pointer",pointerEvents:"auto"},onmousedown:S=>{S.preventDefault()},onclick:S=>this._onDidClick.fire(WL.create(S))},[Mo.div({style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",background:wt(LQi)}})]),Mo.div({class:"modifiedLinesLineReplacement",style:{position:"absolute",boxSizing:"border-box",...lb(S=>c.read(S).lowerText.translateX(-h)),fontFamily:this._editor.getOption(58),fontSize:this._editor.getOption(61),fontWeight:this._editor.getOption(62),pointerEvents:"none",whiteSpace:"nowrap",borderRadius:`0 0 ${ab}px ${ab}px`,overflow:"hidden"}},[...u.lines])])]})]).keepUpdated(this._store),this.isHovered=this._editor.isTargetHovered(l=>this._isMouseOverWidget(l),this._store),this._previousViewZoneInfo=void 0,this._register(Z(()=>this._editor.editor.changeViewZones(l=>this.removePreviousViewZone(l)))),this._register(Mre(this._viewZoneInfo,({lastValue:l,newValue:c})=>{l===c||l?.height===c?.height&&l?.lineNumber===c?.lineNumber||this._editor.editor.changeViewZones(u=>{this.removePreviousViewZone(u),c&&this.addViewZone(c,u)})})),this._register(this._editor.createOverlayWidget({domNode:this._div.element,minContentWidthInPx:Ce(this,l=>this._layout.read(l)?.minContentWidthRequired??0),position:Oo({preference:{top:0,left:0}}),allowEditorOverflow:!1}))}_isMouseOverWidget(e){let t=this._layout.get();return!t||!(e.event instanceof mL)?!1:t.lowerBackground.containsPoint(new Uh(e.event.relativePos.x,e.event.relativePos.y))}removePreviousViewZone(e){if(!this._previousViewZoneInfo)return;e.removeZone(this._previousViewZoneInfo.id);let t=this._editor.cursorLineNumber.get();t!==null&&t>=this._previousViewZoneInfo.lineNumber&&this._editor.editor.setScrollTop(this._editor.scrollTop.get()-this._previousViewZoneInfo.height),this._previousViewZoneInfo=void 0}addViewZone(e,t){let o=t.addZone({afterLineNumber:e.lineNumber-1,heightInPx:e.height,domNode:_("div")});this._previousViewZoneInfo={height:e.height,lineNumber:e.lineNumber,id:o};let n=this._editor.cursorLineNumber.get();n!==null&&n>=e.lineNumber&&this._editor.editor.setScrollTop(this._editor.scrollTop.get()+e.height)}};BCe=I([m(4,kt),m(5,De)],BCe);function IBo(a){let i=[];for(;a.length;){let e=a.shift();e.startLineNumber!==e.endLineNumber&&(a.push(new z(e.startLineNumber+1,1,e.endLineNumber,e.endColumn)),e=new z(e.startLineNumber,e.startColumn,e.startLineNumber,Number.MAX_SAFE_INTEGER)),i.push(e)}return i}function yBo(a,i){a.$$visualization=i}function Z4e(a,i){if(Array.isArray(a)){let e={};a.forEach((t,o)=>{e[o.toString()]=t}),a=e}return yBo(a,new kai(a,i)),a}var kai=class{constructor(i,e){this._rects=i;this._elem=e}visualize(){let i=[];for(let e in this._rects){let t=new Eai(this._rects[e],this._elem,e);i.push(t.visualize())}return{dispose:()=>{i.forEach(e=>e.dispose())}}}};var Eai=class{constructor(i,e,t){this._rect=i;this._elem=e;this._name=t}visualize(){let i=document.createElement("div");i.style.position="fixed",i.style.border="1px solid red",i.style.boxSizing="border-box",i.style.pointerEvents="none",i.style.zIndex="100000";let e=document.createElement("div");e.textContent=this._name,e.style.position="absolute",e.style.top="-20px",e.style.left="0",e.style.color="red",e.style.fontSize="12px",e.style.backgroundColor="rgba(255, 255, 255, 0.7)",i.appendChild(e);let t=()=>{let n=this._elem.getBoundingClientRect();console.log(n),i.style.left=n.left+this._rect.left+"px",i.style.top=n.top+this._rect.top+"px",i.style.width=this._rect.width+"px",i.style.height=this._rect.height+"px"};document.body.appendChild(i),t();let o=new ResizeObserver(t);return o.observe(this._elem),{dispose:()=>{o.disconnect(),i.remove()}}}};function e3e(a,i){if(typeof a=="object"&&a&&"$$visualization"in a){let e=a.$$visualization;wBo(e.visualize(),i)}}function wBo(a,i){Ce({name:"debugReadDisposable"},e=>{e.store.add(a)}).read(i)}function GQi(a,i){let e={};for(let[r,s]of Object.entries(i))Array.isArray(s)?e[r]={min:0,rules:s}:e[r]={min:s.min??0,rules:s.rules??[{max:s.max,priority:s.priority,share:s.share}]};let t={},o=0;for(let[r,s]of Object.entries(e))t[r]=s.min,o+=s.min;if(o>a)return null;let n=a-o;for(;n>0;){let r=[];for(let[h,g]of Object.entries(e))for(let f=0;f<g.rules.length;f++){let v=g.rules[f],b=t[h],S=v.max??1/0;b<S&&r.push({partKey:h,ruleIndex:f,rule:v,priority:v.priority??0,share:v.share??1})}if(r.length===0)break;let s=Math.max(...r.map(h=>h.priority)),l=r.filter(h=>h.priority===s),c=l.reduce((h,g)=>h+g.share,0),u=0,p=[];for(let h of l){let g=h.rule,f=t[h.partKey],b=(g.max??1/0)-f,S=n*h.share/c,y=Math.min(S,b);p.push({partKey:h.partKey,ruleIndex:h.ruleIndex,amount:y}),u+=y}if(u===0)break;for(let h of p)t[h.partKey]+=h.amount;if(n-=u,n<1e-4)break}return t}var Q7=class extends C{constructor(e,t,o,n,r,s){super();this._editor=e;this._data=o;this._themeService=n;this._keybindingService=r;this._contextKeyService=s;this._styles=Ce(this,e=>({background:sb(J1,this._themeService).read(e).toString(),foreground:sb(K7,this._themeService).read(e).toString(),border:sb(SO,this._themeService).read(e).toString()}));this._pos=Ce(this,e=>this._editor.observePosition(Ce(t=>this._data.read(t)?.jumpToPosition||null),e.store)).flatten();this._layout=Ce(this,e=>{let t=this._data.read(e);if(!t)return;let o=t.jumpToPosition,n=this._editor.observeLineHeightForLine(Oo(o.lineNumber)).read(e),r=this._editor.scrollLeft.read(e),s=this._pos.read(e);if(!s)return;let l=this._editor.layoutInfo.read(e);return{widgetRect:bu.fromLeftTopWidthHeight(s.x+l.contentLeft+2-r,s.y,100,n)}});this._blink=CBo([{value:!0,durationMs:600},{value:!1,durationMs:600}]);this._widget=Mo.div({class:"inline-edit-jump-to-widget",style:{position:"absolute",display:this._layout.map(e=>e?"flex":"none"),alignItems:"center",cursor:"pointer",userSelect:"none",...lb(e=>this._layout.read(e)?.widgetRect)}},Ce(e=>this._data.read(e)===void 0?[]:Mo.div({style:{display:"flex",alignItems:"center",gap:"4px",padding:"0 4px",height:"100%",backgroundColor:this._styles.map(t=>t.background),"--vscodeIconForeground":this._styles.map(t=>t.foreground),border:this._styles.map(t=>`1px solid ${t.border}`),borderRadius:"3px",boxSizing:"border-box",fontSize:"11px",color:this._styles.map(t=>t.foreground)}},[this._style==="cursor"?Mo.elem("div",{style:{borderLeft:"2px solid",height:14,opacity:this._blink.map(t=>t?"0":"1")}}):[Ce(()=>Mo.elem("div",{},xBo(this._keybinding))),Mo.elem("div",{style:{lineHeight:this._layout.map(t=>t?.widgetRect.height),marginTop:"-2px"}},["to jump"])]])));this._style=t.style,this._keybinding=this._getKeybinding(E1);let l=this._widget.keepUpdated(this._store);this._register(this._editor.createOverlayWidget({domNode:l.element,position:Oo(null),allowEditorOverflow:!1,minContentWidthInPx:Oo(0)})),this._register(this._editor.setDecorations(Ce(c=>{let u=this._data.read(c);return u?[{range:z.fromPositions(u.jumpToPosition,u.jumpToPosition),options:{description:"inline-edit-jump-to-decoration",inlineClassNameAffectsLetterSpacing:!0,showIfCollapsed:!0,after:{content:this._style==="label"?" ":" "}}}]:[]})))}_getKeybinding(e,t=Il.ofCaller()){return e?ui(this,this._contextKeyService.onDidChangeContext,()=>this._keybindingService.lookupKeybinding(e),t):Oo(void 0)}};Q7=I([m(3,De),m(4,_e),m(5,X)],Q7);function CBo(a,i=Il.ofCaller()){let e=0;return ui(void 0,t=>{e=0;let o=new Dt(()=>{e=(e+1)%a.length,t(null),o.schedule(a[e].durationMs)},0);return o.schedule(0),o},()=>a[e].value,i)}function xBo(a){return Ce(i=>Mo.div({style:{},ref:e=>{let t=i.store.add(new ah(e,zo,{disableTitle:!0,...l_,keybindingLabelShadow:void 0,keybindingLabelForeground:wt(K7),keybindingLabelBackground:"transparent",keybindingLabelBorder:wt(K7),keybindingLabelBottomBorder:void 0}));i.store.add(he(o=>{t.set(a.read(o))}))}}))}var HCe=class extends C{constructor(e,t,o,n,r){super();this._previewTextModel=e;this._properties=t;this._parentEditor=o;this._tabAction=n;this._instantiationService=r;this._previewRef=Mo.ref();this.element=Mo.div({class:"preview",style:{},ref:this._previewRef});this._state=Ce(this,e=>{let t=this._properties.read(e);if(!t)return;let o,n;t.nextCursorPosition!==null?(o="original",n=ro.ofLength(t.nextCursorPosition.lineNumber,1)):t.diff[0].innerChanges?.every(s=>s.modifiedRange.isEmpty())?(o="original",n=ro.ofLength(t.diff[0].original.startLineNumber,1)):(o="modified",n=ro.ofLength(t.diff[0].modified.startLineNumber,1));let r=o==="modified"?j1.snapshot(this._previewTextModel):t.target;return{mode:o,visibleLineRange:n,textModel:r,diff:t.diff}});this.updatePreviewEditorEffect=Ce(this,e=>{this._previewEditorObs.model.read(e);let t=this._state.read(e)?.visibleLineRange;if(!t)return;let o=[];t.startLineNumber>1&&o.push(new z(1,1,t.startLineNumber-1,1)),t.endLineNumberExclusive<this._previewTextModel.getLineCount()+1&&o.push(new z(t.endLineNumberExclusive,1,this._previewTextModel.getLineCount()+1,1)),this.previewEditor.setHiddenAreas(o,void 0,!0)});this.horizontalContentRangeInPreviewEditorToShow=Ce(this,e=>this._getHorizontalContentRangeInPreviewEditorToShow(this.previewEditor,e));this.contentHeight=Ce(this,e=>{let t=this._state.read(e);return t?this._previewEditorObs.observeLineHeightForLine(t.visibleLineRange.startLineNumber):Oo(null)}).flatten();this._editorDecorations=Ce(this,e=>{let t=this._state.read(e);if(!t)return;let o={mode:"insertionInline",diff:t.diff},n=[],r=[],s=po.register({className:"inlineCompletions-char-delete",description:"char-delete",isWholeLine:!1,zIndex:1}),l=po.register({className:"inlineCompletions-char-insert",description:"char-insert",isWholeLine:!0}),c=po.register({className:"inlineCompletions-char-insert",description:"char-insert",shouldFillLineOnLineBreak:!0}),u=!0;for(let p of o.diff)if(p.modified.isEmpty||p.original.isEmpty)p.original.isEmpty||n.push({range:p.original.toInclusiveRange(),options:s}),p.modified.isEmpty||r.push({range:p.modified.toInclusiveRange(),options:l});else for(let h of p.innerChanges||[])p.original.contains(h.originalRange.startLineNumber)&&!(u&&h.originalRange.isEmpty())&&n.push({range:h.originalRange,options:{description:"char-delete",shouldFillLineOnLineBreak:!1,className:ACe("inlineCompletions-char-delete",h.originalRange.isEmpty()&&"empty"),zIndex:1}}),p.modified.contains(h.modifiedRange.startLineNumber)&&r.push({range:h.modifiedRange,options:c});return{originalDecorations:n,modifiedDecorations:r}});this.previewEditor=this._register(this._createPreviewEditor()),this._parentEditorObs=os(this._parentEditor),this._register(he(l=>{let c=this._state.read(l)?.textModel||null;c&&this.previewEditor.setModel(c.dangerouslyGetUnderlyingModel())})),this._previewEditorObs=os(this.previewEditor),this._register(this._previewEditorObs.setDecorations(Ce(l=>{let c=this._state.read(l),u=this._editorDecorations.read(l);return(c?.mode==="original"?u?.originalDecorations:u?.modifiedDecorations)??[]}))),!1&&this._register(this._instantiationService.createInstance(Q7,this._previewEditorObs,{style:"cursor"},Ce(l=>{let c=this._properties.read(l);if(!(!c||!c.nextCursorPosition))return{jumpToPosition:c.nextCursorPosition}}))),this._register(he(l=>{if(!this._properties.read(l))return;let c=this._parentEditorObs.cursorPosition.read(l);c&&this.previewEditor.setPosition(this._previewTextModel.validatePosition(c),"longDistanceHintPreview")})),this._register(he(l=>{let c=this._state.read(l);if(!c)return;let u=c.visibleLineRange.startLineNumber.toString().length;this.previewEditor.updateOptions({lineNumbersMinChars:u+1})})),this._register(this._instantiationService.createInstance(Z1,this._previewEditorObs,Ce(l=>{let c=this._state.read(l);if(!c)return;let u=this._properties.read(l);if(u)return new $7(u.inlineSuggestInfo,ro.ofLength(c.visibleLineRange.startLineNumber,1),u.model,void 0)}),this._tabAction,Oo(0),Oo(!1),Le(this,!1))),this.updatePreviewEditorEffect.recomputeInitiallyAndOnChange(this._store)}_createPreviewEditor(){return this._instantiationService.createInstance(zc,this._previewRef.element,{glyphMargin:!1,lineNumbers:"on",minimap:{enabled:!1},guides:{indentation:!1,bracketPairs:!1,bracketPairsHorizontal:!1,highlightActiveIndentation:!1},editContext:!1,rulers:[],padding:{top:0,bottom:0},selectOnLineNumbers:!1,selectionHighlight:!1,columnSelection:!1,overviewRulerBorder:!1,overviewRulerLanes:0,revealHorizontalRightPadding:0,bracketPairColorization:{enabled:!0,independentColorPoolPerBracketType:!1},scrollBeyondLastLine:!1,scrollbar:{vertical:"hidden",horizontal:"hidden",handleMouseWheel:!1},readOnly:!0,wordWrap:"off",wordWrapOverride1:"off",wordWrapOverride2:"off"},{contextKeyValues:{[ka.inInlineEditsPreviewEditor.key]:!0},contributions:[]},this._parentEditor)}_getHorizontalContentRangeInPreviewEditorToShow(e,t){let o=this._state.read(t);if(!o)return;let n=o.diff,r=this._properties.read(t)?.nextCursorPosition,s=o.visibleLineRange,l=this._previewEditorObs.layoutInfo.read(t),c=ZM(this._previewEditorObs,s,t),u;if(r)u=z.fromPositions(r);else if(n[0].innerChanges)u=o.mode==="modified"?n[0].innerChanges[0].modifiedRange:n[0].innerChanges[0].originalRange;else return;let p=kBo(e.getModel(),u,5),h=this._previewEditorObs.getLeftOfPosition(p.getStartPosition(),t),g=this._previewEditorObs.getLeftOfPosition(p.getEndPosition(),t),f=Kn(h,0,c),v=Kn(g,f,c),b=e.getModel().getLineFirstNonWhitespaceColumn(p.startLineNumber),S=this._previewEditorObs.getLeftOfPosition(new Ie(p.startLineNumber,b),t),y=new di(f,v);return{indentationEnd:S,preferredRangeToReveal:y,maxEditorWidth:c+l.contentLeft,contentWidth:c,nonContentWidth:l.contentLeft}}layout(e,t){this.previewEditor.layout(e),this._previewEditorObs.editor.setScrollLeft(t)}};HCe=I([m(4,F)],HCe);function kBo(a,i,e){let t=i.getStartPosition(),o=i.getEndPosition(),n=a.getLineContent(t.lineNumber);function r(u){let p=n.charAt(u-1);return/[a-zA-Z0-9_]/.test(p)}function s(u){let p=n.charAt(u-1);return p===" "||p===" "}let l=t.column;for(;l>1&&r(l)&&!s(l-1)&&t.column-l<e;)l--;let c=o.column-1;for(;c<=n.length&&r(c)&&!s(c+1)&&c-o.column<e;)c++;return new z(t.lineNumber,t.column,o.lineNumber,c+1)}function $Qi(a,i){let e=a.start,t=a.endExclusive,o=Number.MAX_VALUE,n=0;for(let r of i){let s=n+r.width,l=Math.max(e,n),c=Math.min(t,s);l<c&&(o=Math.min(o,r.height)),n=s}return t>n||o===Number.MAX_VALUE?0:o}var t3e=class{constructor(i,e,t){this._lineRangeInfo=i;this.availableSpaceSizes=i.sizes.map((o,n)=>{let r=i.lineRange.startLineNumber+n,s=t(r);return new H7(Math.max(0,e-o.width-s),o.height)}),this.availableSpaceHeightPrefixSums=TBo(this.availableSpaceSizes,o=>o.height),this.availableSpaceSizesTransposed=this.availableSpaceSizes.map(o=>o.transpose())}getWidgetVerticalOutline(i,e,t){let o=i-this._lineRangeInfo.lineRange.startLineNumber,n=this._lineRangeInfo.top+this.availableSpaceHeightPrefixSums[o],r=di.ofStartAndLength(n,e),{previewEditorMargin:s,widgetPadding:l,widgetBorder:c,lowerBarHeight:u}=t;return r.withMargin(s+l+c).withMargin(0,u)}tryFindWidgetOutline(i,e,t,o){if(!(this._lineRangeInfo.lineRange.length<3))return EBo(this._lineRangeInfo.lineRange.addMargin(-1,-1),i,n=>{let r=this.getWidgetVerticalOutline(n,e,o),s=$Qi(r.delta(-this._lineRangeInfo.top),this.availableSpaceSizesTransposed);return s<o.minWidgetWidth?void 0:{horizontalWidgetRange:di.ofStartAndLength(t-s,s),verticalWidgetRange:r}})}};function qQi(a,i,e,t,o){let n=[],r=a.startLineNumber,s=e,l=[];for(let c=0;c<i.length;c++){let u=a.startLineNumber+c,p=s+l.reduce((g,f)=>g+f.height,0),h=t.editor.getTopForLineNumber(u);c>0&&h!==p&&(n.push({lineRange:ro.ofLength(r,u-r),top:s,sizes:l}),r=u,s=h,l=[]),l.push(i[c])}return n.push({lineRange:ro.ofLength(r,a.endLineNumberExclusive-r),top:s,sizes:l}),Ce({owner:"splitIntoContinuousLineRanges"},c=>t.observeTopForLineNumber(a.endLineNumberExclusive-1).read(c)).read(o),n}function EBo(a,i,e){for(let t=0;;t++){let o=i+t;if(o<=a.endLineNumberExclusive){let r=e(o);if(r!==void 0)return r}let n=i-t;if(n>=a.startLineNumber){let r=e(n);if(r!==void 0)return r}if(n<a.startLineNumber&&o>a.endLineNumberExclusive)return}}function TBo(a,i){let e=[0],t=0;for(let o of a)t+=i(o),e.push(t);return e}var _Bo=6,Tai={EMPTY_SPACE:425,OVERLAY:375},DBo=250,LBo={previewEditorMargin:2,widgetPadding:2,widgetBorder:1,lowerBarHeight:20,minWidgetWidth:DBo},UCe=class extends C{constructor(e,t,o,n,r,s,l,c,u){super();this._editor=e;this._viewState=t;this._previewTextModel=o;this._tabAction=n;this._instantiationService=r;this._themeService=s;this._keybindingService=l;this._modelService=c;this._languageService=u;this.onDidClick=H.None;this._viewWithElement=void 0;this._hintTextPosition=Ce(this,e=>{let t=this._viewState.read(e);return t?new Ie(t.hint.lineNumber,Number.MAX_SAFE_INTEGER):null});this._lineSizesAroundHintPosition=Ce(this,e=>{let t=this._viewState.read(e),o=this._hintTextPosition.read(e);if(!t||!o)return[];let n=this._editorObs.model.read(e);if(!n)return[];let r=ro.ofLength(o.lineNumber,1).addMargin(5,5).intersect(ro.ofLength(1,n.getLineCount()));if(!r)return[];let s=FQi(this._editorObs,r,e),l=this._editorObs.observeTopForLineNumber(r.startLineNumber).read(e);return qQi(r,s,l,this._editorObs,e)});this._isVisibleDelayed=B9t(Ce(this,e=>this._viewState.read(e)?.hint.isVisible),(e,t)=>e===!0&&t===!1?200:0);this._previewEditorLayoutInfo=Ce(this,e=>{let t=this._viewState.read(e);if(!t||!this._isVisibleDelayed.read(e))return;let o=this._lineSizesAroundHintPosition.read(e);if(o.length===0)return;let n=this._editorObs.scrollTop.read(e),r=this._editorObs.scrollLeft.read(e),s=this._editorObs.layoutInfo.read(e),l=this._previewEditor.contentHeight.read(e),c=this._previewEditor.horizontalContentRangeInPreviewEditorToShow.read(e);if(!l||!c)return;let u=s.contentWidth-s.verticalScrollbarWidth,p=s.contentLeft+u;if(!this._editorObs.cursorLineNumber.read(e))return;let g=LBo,v=l+2,b,S,y=Ze=>Ze===t.hint.lineNumber?40:20;for(let Ze of o){let Ti=new t3e(Ze,u,y);if(S=Ti,!1){let bo=MBo(new Uh(p,Ze.top-n),Ti.availableSpaceSizes,"right");e3e(Z4e({...bo},this._editor.getDomNode()),e)}if(b=Ti.tryFindWidgetOutline(t.hint.lineNumber,v,p,g),b)break}let w="empty-space";if(!b){w="overlay";let Ze=Math.min(s.width-s.contentLeft,Tai.OVERLAY),Ti=S??new t3e(o[0],u,y);b={horizontalWidgetRange:di.ofStartAndLength(p-Ze,Ze),verticalWidgetRange:Ti.getWidgetVerticalOutline(t.hint.lineNumber+2,v,g).delta(10)}}if(!b)return;let k=bu.fromRanges(b.horizontalWidgetRange,b.verticalWidgetRange).translateX(-r).translateY(-n);!1&&e3e(Z4e({rectAvailableSpace:k},this._editor.getDomNode()),e);let{previewEditorMargin:N,widgetPadding:O,widgetBorder:V,lowerBarHeight:U}=g,G=Math.min(w==="overlay"?Tai.OVERLAY:Tai.EMPTY_SPACE,c.maxEditorWidth+N+O),$=GQi(k.width,{spaceBefore:{min:0,max:10,priority:1},content:{min:50,rules:[{max:150,priority:2},{max:G,priority:1}]},spaceAfter:{min:10}});if(!$)return null;let te=RBo([$.spaceBefore,$.content,$.spaceAfter],k.left),pe=k.withHorizontalRange(te[0]),de=k.withHorizontalRange(te[1]),se=k.withHorizontalRange(te[2]);!1&&e3e(Z4e({spaceBeforeRect:pe,widgetRect:de,spaceAfterRect:se},this._editor.getDomNode()),e);let ke=de.withMargin(-O-V-N).withMargin(0,0,-U,0);!1&&e3e(Z4e({previewEditorRect:ke},this._editor.getDomNode()),e);let He=ke.width-c.nonContentWidth,Ve=He*.8,Fe=c.preferredRangeToReveal.intersect(di.ofStartAndLength(c.preferredRangeToReveal.start,Ve))??c.preferredRangeToReveal,Qt=PBo(c.indentationEnd,He,Fe);return{codeEditorSize:ke.getSize(),codeScrollLeft:r,contentLeft:s.contentLeft,widgetRect:de,previewEditorMargin:N,widgetPadding:O,widgetBorder:V,lowerBarHeight:U,desiredPreviewEditorScrollLeft:Qt.newScrollPosition}});this._view=Mo.div({class:"inline-edits-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:Ce(this,e=>this._previewEditorLayoutInfo.read(e)?"block":"none")}},[Ce(this,e=>[this._widgetContent])]);this._widgetContent=Ce(this,e=>Mo.div({class:["inline-edits-long-distance-hint-widget","show-file-icons"],style:{position:"absolute",overflow:"hidden",cursor:"pointer",background:wt(gm),padding:this._previewEditorLayoutInfo.map(t=>t?.widgetPadding),boxSizing:"border-box",borderRadius:_Bo,border:Ce(t=>`${this._previewEditorLayoutInfo.read(t)?.widgetBorder}px solid ${this._styles.read(t).border}`),display:"flex",flexDirection:"column",opacity:Ce(t=>this._viewState.read(t)?.hint.isVisible?"1":"0"),transition:"opacity 200ms ease-in-out",...lb(t=>this._previewEditorLayoutInfo.read(t)?.widgetRect)},onmousedown:t=>{t.preventDefault()},onclick:()=>{this._viewState.read(void 0)?.model.jump()}},[Mo.div({class:["editorContainer"],style:{overflow:"hidden",padding:this._previewEditorLayoutInfo.map(t=>t?.previewEditorMargin),background:this._styles.map(t=>t.background),pointerEvents:"none"}},[Ce(this,t=>this._previewEditor.element)]),Mo.div({class:"bar",style:{color:wt(A$e),pointerEvents:"none",margin:"0 4px",height:this._previewEditorLayoutInfo.map(t=>t?.lowerBarHeight),display:"flex",justifyContent:"space-between",alignItems:"center"}},[Ce(this,t=>{let o=[],n=this._viewState.read(t);if(!n)return o;let r=this._editorObs.model.read(t)?.uri,s=n.target.uri,l=s&&(!r||s.toString()!==r.toString());if(l){let g=Ye(s),f=js(this._modelService,this._languageService,s,0);o.push(Mo.div({class:"target-file",style:{display:"flex",alignItems:"center",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},[Mo.elem("span",{class:f,style:{flexShrink:"0",marginRight:"4px"}}),g]))}else{let g=this._originalOutlineSource.read(t),f=this._originalTargetLineNumber.read(t),v=g?.getAt(f,t).slice(0,1)??[],b=[];if(v.length>0)for(let S=0;S<v.length;S++){let y=v[S],w=sh.toIcon(y.kind);b.push(Mo.div({class:"breadcrumb-item",style:{display:"flex",alignItems:"center",flex:"1 1 auto",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}},[Qo(w),"\xA0",y.name,...S===v.length-1?[]:[Qo(M.chevronRight)]]))}o.push(Mo.div({class:"outline-elements",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},b))}let c=this._originalTargetLineNumber.read(t),u=l?M.arrowRight:n.hint.lineNumber<c?M.arrowDown:M.arrowUp,p=this._keybindingService.lookupKeybinding(DIt),h=l?"Go to file":"Go to suggestion";return p&&p.getLabel()==="Tab"&&(h=l?"Tab to open":"Tab to jump"),o.push(Mo.div({class:"go-to-label",style:{position:"relative",display:"flex",alignItems:"center",flex:"0 0 auto",paddingLeft:"6px"}},[h,"\xA0",Qo(u)])),o})])]));this._originalTargetLineNumber=Ce(this,e=>{let t=this._viewState.read(e);return t?t.edit.action?.kind==="jumpTo"?t.edit.action.position.lineNumber:t.diff[0]?.original.startLineNumber??-1:-1});this._originalOutlineSource=RI(this,e=>{let t=this._editorObs.model.read(e),o=tO._breadcrumbsSourceFactory.read(e);return!t||!o?void 0:o(t,this._instantiationService)});this._styles=Ce(p=>{let h=this._tabAction.read(p),g=U7(DN,this._themeService).read(p),f=ui(this._themeService.onDidColorThemeChange,()=>{let b=this._themeService.getColorTheme();return b.type==="hcDark"||b.type==="hcLight"}).read(p),v;if(f)v=g;else{let b;switch(h){case"inactive":b=LCe;break;case"jump":b=J1;break;case"accept":b=RCe;break}v=sb(b,this._themeService).read(p)}return{border:v.toString(),background:b_(this._viewState.map(b=>b?.editorType??"textEditor").read(p))}}),this._editorObs=os(this._editor),this._previewEditor=this._register(this._instantiationService.createInstance(HCe,this._previewTextModel,Ce(p=>{let h=this._viewState.read(p);if(h)return{diff:h.diff,model:h.model,inlineSuggestInfo:h.inlineSuggestInfo,nextCursorPosition:h.nextCursorPosition,target:h.target}}),this._editor,this._tabAction)),this._viewWithElement=this._view.keepUpdated(this._store),this._register(this._editorObs.createOverlayWidget({domNode:this._viewWithElement.element,position:Oo(null),allowEditorOverflow:!1,minContentWidthInPx:Oo(0)})),this._widgetContent.get().keepUpdated(this._store),this._register(he(p=>{let h=this._previewEditorLayoutInfo.read(p);h&&this._previewEditor.layout(h.codeEditorSize.toDimension(),h.desiredPreviewEditorScrollLeft)})),this._isVisibleDelayed.recomputeInitiallyAndOnChange(this._store)}get isHovered(){return this._widgetContent.get().didMouseMoveDuringHover}};UCe=I([m(4,F),m(5,De),m(6,_e),m(7,Ct),m(8,kt)],UCe);function RBo(a,i=0){let e=[],t=i;for(let o of a)e.push(new di(t,t+o)),t+=o;return e}function MBo(a,i,e="left"){let t=[],o=0;for(let n of i)t.push(bu.fromLeftTopWidthHeight(a.x+(e==="left"?0:-n.width),a.y+o,n.width,n.height)),o+=n.height;return t}function PBo(a,i,e){let t=new di(a,a+i);return t.containsRange(e)?{newScrollPosition:a}:e.length>i?{newScrollPosition:e.start}:e.endExclusive>t.endExclusive?{newScrollPosition:e.endExclusive-i}:e.start<t.start?{newScrollPosition:e.start}:{newScrollPosition:a}}var zCe=0,i3e=0,ABo=!1,UW=1,NBo=1,OBo=3,cj=ab,_ai=20,jQi=12,Mle=class extends C{constructor(e,t,o,n,r,s,l,c){super();this._editor=e;this._edit=t;this._previewTextModel=o;this._uiState=n;this._tabAction=r;this._instantiationService=s;this._themeService=l;this._userInteractionService=c;this._onDidClick=this._register(new E);this.onDidClick=this._onDidClick.event;this._editorObs=os(this._editor),this._display=Ce(this,h=>this._uiState.read(h)?"block":"none"),this.previewRef=Mo.ref();let u=this._uiState.map(h=>h?.editorType==="diffEditor"?OBo:NBo);this._editorContainer=Mo.div({class:["editorContainer"],style:{position:"absolute",overflow:"hidden",cursor:"pointer"},onmousedown:h=>{h.preventDefault()},onclick:h=>{this._onDidClick.fire(WL.create(h))}},[Mo.div({class:"preview",style:{pointerEvents:"none"},ref:this.previewRef})]).keepUpdated(this._store),this.isHovered=this._userInteractionService.createHoverTracker(this._editorContainer.element,this._store),this.previewEditor=this._register(this._instantiationService.createInstance(zc,this.previewRef.element,{glyphMargin:!1,lineNumbers:"off",minimap:{enabled:!1},guides:{indentation:!1,bracketPairs:!1,bracketPairsHorizontal:!1,highlightActiveIndentation:!1},editContext:!1,rulers:[],padding:{top:0,bottom:0},folding:!1,selectOnLineNumbers:!1,selectionHighlight:!1,columnSelection:!1,overviewRulerBorder:!1,overviewRulerLanes:0,lineDecorationsWidth:0,lineNumbersMinChars:0,revealHorizontalRightPadding:0,bracketPairColorization:{enabled:!0,independentColorPoolPerBracketType:!1},scrollBeyondLastLine:!1,scrollbar:{vertical:"hidden",horizontal:"hidden",handleMouseWheel:!1},readOnly:!0,wordWrap:"off",wordWrapOverride1:"off",wordWrapOverride2:"off"},{contextKeyValues:{[ka.inInlineEditsPreviewEditor.key]:!0},contributions:[]},this._editor)),this._previewEditorObs=os(this.previewEditor),this._activeViewZones=[],this._updatePreviewEditor=Ce(this,h=>{this._editorContainer.readEffect(h),this._previewEditorObs.model.read(h),this._display.read(h),this._nonOverflowView&&(this._nonOverflowView.element.style.display=this._display.read(h));let g=this._uiState.read(h),f=this._edit.read(h);if(!g||!f)return;let v=f.originalLineRange,b=[];v.startLineNumber>1&&b.push(new z(1,1,v.startLineNumber-1,1)),v.startLineNumber+g.newTextLineCount<this._previewTextModel.getLineCount()+1&&b.push(new z(v.startLineNumber+g.newTextLineCount,1,this._previewTextModel.getLineCount()+1,1)),this.previewEditor.setHiddenAreas(b,void 0,!0);let S=[...this._activeViewZones];this._activeViewZones=[];let y=v.endLineNumberExclusive-v.startLineNumber-g.newTextLineCount;this.previewEditor.changeViewZones(w=>{S.forEach(k=>w.removeZone(k)),y>0&&this._activeViewZones.push(w.addZone({afterLineNumber:v.startLineNumber+g.newTextLineCount-1,heightInLines:y,showInHiddenAreas:!0,domNode:_("div.diagonal-fill.inline-edits-view-zone")}))})}),this._previewEditorWidth=Ce(this,h=>{let g=this._edit.read(h);return g?(this._updatePreviewEditor.read(h),ZM(this._previewEditorObs,g.modifiedLineRange,h)):0}),this._cursorPosIfTouchesEdit=Ce(this,h=>{let g=this._editorObs.cursorPosition.read(h),f=this._edit.read(h);if(!(!f||!g))return f.modifiedLineRange.contains(g.lineNumber)?g:void 0}),this._originalStartPosition=Ce(this,h=>{let g=this._edit.read(h);return g?new Ie(g.originalLineRange.startLineNumber,1):null}),this._originalEndPosition=Ce(this,h=>{let g=this._edit.read(h);return g?new Ie(g.originalLineRange.endLineNumberExclusive,1):null}),this._originalVerticalStartPosition=this._editorObs.observePosition(this._originalStartPosition,this._store).map(h=>h?.y),this._originalVerticalEndPosition=this._editorObs.observePosition(this._originalEndPosition,this._store).map(h=>h?.y),this._originalDisplayRange=this._edit.map(h=>h?.displayRange),this._editorMaxContentWidthInRange=Ce(this,h=>{let g=this._originalDisplayRange.read(h);return g?(this._editorObs.versionId.read(h),vf(this,(f,v)=>{let b=ZM(this._editorObs,g,f);return Math.max(b,v??0)})):Oo(0)}).map((h,g)=>h.read(g));let p=HQi(this._editor,this._store);this._previewEditorLayoutInfo=Ce(this,h=>{let g=this._edit.read(h);if(!g||!this._uiState.read(h))return null;let v=g.originalLineRange,b=this._editorObs.scrollLeft.read(h),S=this._editorMaxContentWidthInRange.read(h),y=this._editorObs.layoutInfo.read(h),w=this._previewEditorWidth.read(h),k=y.contentWidth-y.verticalScrollbarWidth,T=p.read(h),N=y.contentLeft+y.contentWidth+T.left,O=Me(this._editor.getContainerDomNode()).innerWidth-N,V=Me(this._editor.getContainerDomNode()).innerWidth-T.right,U=Math.min(y.contentWidth*.3,w,100),G=0,$=G+O,te=this._cursorPosIfTouchesEdit.read(h),pe=Math.max(k+b-G-Math.max(0,U-$),Math.min(te?WQi(this._editorObs,te,h)+50:0,k+b)),de=Math.min(S+_ai,pe),se=S+_ai+w+70,Se=pe-de,ke,Ee;de>b?(ke=0,Ee=y.contentLeft+de-b):(ke=b-de,Ee=y.contentLeft);let He=this._originalVerticalStartPosition.read(h)??this._editor.getTopForLineNumber(v.startLineNumber)-this._editorObs.scrollTop.read(h),Ve=this._originalVerticalEndPosition.read(h)??this._editor.getBottomForLineNumber(v.endLineNumberExclusive-1)-this._editorObs.scrollTop.read(h),Fe=y.contentLeft-b,Qt=bu.fromLeftTopRightBottom(Fe,He,Ee,Ve),Ze=Qt.height===0;Ze||(Qt=Qt.withMargin(i3e,zCe));let ti=this._previewEditorObs.observeLineHeightsForLineRange(g.modifiedLineRange).read(h).reduce((Ws,ba)=>Ws+ba,0),bo=Ve-He,Ro=Math.max(bo,ti),_o=Se===0,sr=0,ln=Math.min(w+jQi,V+y.width-y.contentLeft-sr),en=bu.fromLeftTopWidthHeight(Qt.right+sr,He,ln,Ro);return Ze?en=en.withMargin(i3e,zCe).translateY(i3e):en=en.withMargin(i3e,zCe).translateX(zCe+UW),{codeRect:Qt,editRect:en,codeScrollLeft:b,contentLeft:y.contentLeft,isInsertion:Ze,maxContentWidth:se,shouldShowShadow:_o,desiredPreviewEditorScrollLeft:ke,previewEditorWidth:ln}}),this._stickyScrollController=rb.get(this._editorObs.editor),this._stickyScrollHeight=this._stickyScrollController?ui(this._stickyScrollController.onDidChangeStickyScrollHeight,()=>this._stickyScrollController.stickyScrollWidgetHeight):Oo(0),this._shouldOverflow=Ce(this,h=>{if(!ABo)return!1;let g=this._edit.read(h)?.originalLineRange;if(!g)return!1;let f=this._stickyScrollHeight.read(h);return!(this._editor.getTopForLineNumber(g.startLineNumber)-this._editorObs.scrollTop.read(h)<=f||this._editor.getTopForLineNumber(g.endLineNumberExclusive)-this._editorObs.scrollTop.read(h)>=this._editorObs.layoutInfo.read(h).height)}),this._originalBackgroundColor=ui(this,this._themeService.onDidColorThemeChange,()=>this._themeService.getColorTheme().getColor(z7)??Oe.transparent),this._editorBackgroundColor=this._uiState.map(h=>b_(h?.editorType??"textEditor")),this._backgroundSvg=Mo.svg({transform:"translate(-0.5 -0.5)",style:{overflow:"visible",pointerEvents:"none",position:"absolute"}},[Mo.svgElem("path",{class:"rightOfModifiedBackgroundCoverUp",d:Ce(this,h=>{let g=this._previewEditorLayoutInfo.read(h);if(!(!g||this._originalBackgroundColor.read(h).isTransparent()))return new Rle().moveTo(g.codeRect.getRightTop()).lineTo(g.codeRect.getRightTop().deltaX(1e3)).lineTo(g.codeRect.getRightBottom().deltaX(1e3)).lineTo(g.codeRect.getRightBottom()).build()}),style:{fill:this._editorBackgroundColor}})]).keepUpdated(this._store),this._originalOverlay=Mo.div({style:{pointerEvents:"none",display:this._previewEditorLayoutInfo.map(h=>h?.isInsertion?"none":"block")}},Ce(this,h=>{let g=CE(this._previewEditorLayoutInfo).read(h);if(!g)return;let f=this._editorBackgroundColor.read(h),v=u.read(h),b=G7(this._tabAction).map(G=>`${UW}px solid ${wt(G)}`),S=`${UW+v}px solid ${f}`,y=g.read(h).codeScrollLeft!==0,w=g.map(G=>G.codeRect.bottom<G.editRect.bottom),k=cj*2+UW*2,T=g.map(G=>bu.fromLeftTopRightBottom(G.contentLeft-cj-UW,G.codeRect.top,G.contentLeft,G.codeRect.bottom+k)).read(h),N=new di(T.left,Number.MAX_SAFE_INTEGER),O=g.map(G=>G.codeRect.intersectHorizontal(N)),V=O.map(G=>G.withMargin(v,0,v,v).intersectHorizontal(N)),U=O.map(G=>bu.fromLeftTopWidthHeight(G.right-k+UW,G.bottom-UW,k,k).intersectHorizontal(N));return[Mo.div({class:"originalSeparatorSideBySide",style:{...V.read(h).toStyles(),boxSizing:"border-box",borderRadius:`${cj}px 0 0 ${cj}px`,borderTop:S,borderBottom:S,borderLeft:y?"none":S}}),Mo.div({class:"originalOverlaySideBySide",style:{...O.read(h).toStyles(),boxSizing:"border-box",borderRadius:`${cj}px 0 0 ${cj}px`,borderTop:b,borderBottom:b,borderLeft:y?"none":b,backgroundColor:wt(z7)}}),Mo.div({class:"originalCornerCutoutSideBySide",style:{pointerEvents:"none",display:w.map(G=>G?"block":"none"),...U.read(h).toStyles()}},[Mo.div({class:"originalCornerCutoutBackground",style:{position:"absolute",top:"0px",left:"0px",width:"100%",height:"100%",backgroundColor:sb(z7,this._themeService).map(G=>G.toString())}}),Mo.div({class:"originalCornerCutoutBorder",style:{position:"absolute",top:"0px",left:"0px",width:"100%",height:"100%",boxSizing:"border-box",borderTop:b,borderRight:b,borderRadius:"0 100% 0 0",backgroundColor:f}})]),Mo.div({class:"originalOverlaySideBySideHider",style:{...T.toStyles(),backgroundColor:f}})]})).keepUpdated(this._store),this._modifiedOverlay=Mo.div({style:{pointerEvents:"none"}},Ce(this,h=>{let g=CE(this._previewEditorLayoutInfo).read(h);if(!g)return;let f=g.map(O=>O.codeRect.bottom<O.editRect.bottom),v=this._editorBackgroundColor.read(h),b=u.read(h),S=f.map(O=>`0 ${cj}px ${cj}px ${O?cj:0}px`),y=sb(sj(this._tabAction),this._themeService).map(O=>`1px solid ${O.toString()}`),w=`${UW+b}px solid ${v}`,k=g.map(O=>O.editRect.withMargin(0,UW)),T=k.map(O=>O.withMargin(b,b,b,0)),N=Ce(this,O=>{let V=k.read(O),U=g.read(O);return!U.isInsertion||U.contentLeft>=V.left?bu.fromLeftTopWidthHeight(V.left,V.top,0,0):new bu(U.contentLeft,V.top,V.left,V.top+UW*2)});return[Mo.div({class:"modifiedInsertionSideBySide",style:{...N.read(h).toStyles(),backgroundColor:sj(this._tabAction).map(O=>wt(O))}}),Mo.div({class:"modifiedSeparatorSideBySide",style:{...T.read(h).toStyles(),borderRadius:S,borderTop:w,borderBottom:w,borderRight:w,boxSizing:"border-box"}}),Mo.div({class:"modifiedOverlaySideBySide",style:{...k.read(h).toStyles(),borderRadius:S,border:y,boxSizing:"border-box",backgroundColor:wt(cCt)}})]})).keepUpdated(this._store),this._nonOverflowView=Mo.div({class:"inline-edits-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:this._display}},[this._backgroundSvg,Ce(this,h=>this._shouldOverflow.read(h)?[]:[this._editorContainer,this._originalOverlay,this._modifiedOverlay])]).keepUpdated(this._store),this._register(this._editorObs.createOverlayWidget({domNode:this._nonOverflowView.element,position:Oo(null),allowEditorOverflow:!1,minContentWidthInPx:Ce(this,h=>{let g=this._previewEditorLayoutInfo.read(h)?.maxContentWidth;return g===void 0?0:g})})),this.previewEditor.setModel(this._previewTextModel),this._register(he(h=>{let g=this._previewEditorLayoutInfo.read(h);if(!g)return;let f=g.editRect.withMargin(-i3e,-zCe);this.previewEditor.layout({height:f.height,width:g.previewEditorWidth+15}),this._editorContainer.element.style.top=`${f.top}px`,this._editorContainer.element.style.left=`${f.left}px`,this._editorContainer.element.style.width=`${g.previewEditorWidth+zCe}px`})),this._register(he(h=>{let g=this._previewEditorLayoutInfo.read(h);g&&this._previewEditorObs.editor.setScrollLeft(g.desiredPreviewEditorScrollLeft)})),this._updatePreviewEditor.recomputeInitiallyAndOnChange(this._store)}static fitsInsideViewport(e,t,o,n){let r=os(e),s=r.layoutInfoWidth.read(n),l=r.layoutInfoContentLeft.read(n),c=e.getLayoutInfo().verticalScrollbarWidth,u=r.layoutInfoMinimap.read(n).minimapLeft!==0?r.layoutInfoMinimap.read(n).minimapWidth:0,p=ZM(r,o.displayRange,void 0),h=o.lineEdit.newLines.reduce((v,b)=>Math.max(v,X4e(b,e,t)),0),g=_ai,f=jQi+2*UW;return p+h+g+f<s-l-c-u}};Mle=I([m(5,F),m(6,De),m(7,eC)],Mle);var gCt=class{constructor(i,e,t){this.edit=i;this.editorType=e;this.alternativeAction=t}equals(i){return this.edit.equals(i.edit)&&this.alternativeAction===i.alternativeAction}},Ox=1,QQi="word-replacement-view-overlay",YQi="word-replacement-view-widget",XQi="word-replacement-view-replacement",Dai="word-replacement-view-rename",dj=class extends C{constructor(e,t,o,n,r,s,l,c){super();this._editor=e;this._viewData=t;this._tabAction=o;this._languageService=n;this._themeService=r;this._keybindingService=s;this._hoverService=l;this._userInteractionService=c;this._onDidClick=this._register(new E);this.onDidClick=this._onDidClick.event;this._start=this._editor.observePosition(Oo(this._viewData.edit.range.getStartPosition()),this._store),this._end=this._editor.observePosition(Oo(this._viewData.edit.range.getEndPosition()),this._store),this._line=document.createElement("div"),this._primaryElement=Le(this,null),this._secondaryElement=Le(this,null),this.isHovered=Ce(this,g=>{let f=this._primaryElement.read(g);return f?this._userInteractionService.createHoverTracker(f.element,g.store).read(g):!1}),this._renderTextEffect=Ce(this,g=>{let f=this._editor.model.get(),v=f.getLineContent(this._viewData.edit.range.startLineNumber),b=Hc.replace(new di(this._viewData.edit.range.startColumn-1,this._viewData.edit.range.endColumn-1),this._viewData.edit.text),S=b.replace(v),y=f.tokenization.tokenizeLinesAt(this._viewData.edit.range.startLineNumber,[S])?.[0],w;y?w=aW.fromLineTokens(y).slice(b.getRangeAfterReplace()).toLineTokens(this._viewData.edit.text,this._languageService.languageIdCodec):w=Bc.createEmpty(this._viewData.edit.text,this._languageService.languageIdCodec);let k=EL(new dE([w]),uE.fromEditor(this._editor.editor).withSetWidth(!1).withScrollBeyondLastColumn(0),[],this._line,!0);this._line.style.width=`${k.minWidthInPx}px`});let u=this._editor.observeLineHeightForPosition(this._viewData.edit.range.getStartPosition()),p=EGe(this._viewData.alternativeAction?.count??new Promise(g=>g(void 0))).map(g=>g.value),h=Ce(this,g=>this._userInteractionService.readModifierKeyStatus(this._editor.editor.getDomNode(),g).shiftKey);this._layout=Ce(this,g=>{this._renderTextEffect.read(g);let f=this._start.read(g),v=this._end.read(g);if(!f||!v||f.x>v.x||f.y>v.y)return;let b=u.read(g),S=this._editor.scrollLeft.read(g),y=this._editor.getOption(59).read(g).typicalHalfwidthCharacterWidth,w=3*y,k=4,T=new Uh(w,k),N;if(this._viewData.alternativeAction){let $=this._viewData.alternativeAction.label,te=p.read(g),pe=h.read(g),de=te!==void 0?te===1?d(1375,null,$):d(1376,null,$,te):$,se=d(1377,null,"[shift]");N={label:te!==void 0&&pe?de:$,tooltip:de?`${de}
${se}`:void 0,icon:void 0,count:te,keybinding:this._keybindingService.lookupKeybinding(Kae),active:h}}let O=bu.fromPoints(f,v).withHeight(b).translateX(-S),V=bu.fromPointSize(O.getLeftBottom().add(T),new Uh(this._viewData.edit.text.length*y,O.height)),U=V.withWidth(V.width+(N?N.label.length*y+8+4+12:0)),G=U.withLeft(O.left);return{alternativeAction:N,originalLine:O,codeLine:V,modifiedLine:U,lowerBackground:G,lineHeight:b}}),this.minEditorScrollHeight=Ce(this,g=>{let f=CE(this._layout).read(g);return f?f.read(g).modifiedLine.bottom+Ox+this._editor.editor.getScrollTop():0}),this._root=Mo.div({class:"word-replacement"},[Ce(this,g=>{let f=CE(this._layout).read(g);if(!f)return[];let v=G7(this._tabAction).map(te=>wt(te)).read(g),b=sj(this._tabAction).map(te=>wt(te)).read(g);this._line.style.lineHeight=`${f.read(g).modifiedLine.height+2*Ox}px`;let S=Oo(!1),y=f.map(te=>te.alternativeAction),w=Ce(te=>(y.read(te)?.active.read(te)??!1)||S.read(te)),T=ui(this._themeService.onDidColorThemeChange,()=>{let te=this._themeService.getColorTheme();return te.type==="hcDark"||te.type==="hcLight"}).read(g)?U7(gi,this._themeService).read(g):null,N={borderColor:T?T.toString():b,backgroundColor:wt(RQi),color:"",opacity:"1"},O={borderColor:T?T.toString():wt(SO),backgroundColor:wt(J1),color:wt(K7),opacity:"1"},V={borderColor:T?T.toString():U7(s9,this._themeService).map(te=>te.transparent(.2).toString()).read(g),backgroundColor:b_(this._viewData.editorType),color:"",opacity:"0.7"},U=b_(this._viewData.editorType),G=Ce(this,te=>(w.read(te),N)),$=Ce(this,te=>w.read(te)?O:V);return[Mo.div({id:QQi,style:{position:"absolute",...lb(te=>PCe(this._editor).read(te)),overflow:"hidden",pointerEvents:"none"}},[Mo.div({style:{position:"absolute",...lb(te=>f.read(te).lowerBackground.withMargin(Ox,2*Ox,Ox,0)),background:U,cursor:"pointer",pointerEvents:"auto"},onmousedown:te=>this._mouseDown(te)}),Mo.div({id:YQi,style:{position:"absolute",...lb(te=>f.read(te).modifiedLine.withMargin(Ox,2*Ox)),width:void 0,pointerEvents:"auto",boxSizing:"border-box",borderRadius:`${ab}px`,background:U,display:"flex",justifyContent:"left",outline:`2px solid ${U}`},onmousedown:te=>this._mouseDown(te)},[Mo.div({id:XQi,style:{fontFamily:this._editor.getOption(58),fontSize:this._editor.getOption(61),fontWeight:this._editor.getOption(62),width:lb(te=>f.read(te).codeLine.withMargin(Ox,2*Ox)).width,borderRadius:`${ab}px`,border:G.map(te=>`${Ox}px solid ${te.borderColor}`),boxSizing:"border-box",padding:`${Ox}px`,opacity:G.map(te=>te.opacity),background:G.map(te=>te.backgroundColor),display:"flex",justifyContent:"left",alignItems:"center",pointerEvents:"auto",cursor:"pointer"},obsRef:te=>{this._primaryElement.set(te,void 0)}},[this._line]),Ce(this,te=>{let pe=y.read(te);if(!pe)return;let de=document.createElement("div");return te.store.add(new ah(de,zo,{...t5e,disableTitle:!0})).set(pe.keybinding),Mo.div({id:Dai,style:{position:"relative",borderRadius:`${ab}px`,borderTop:`${Ox}px solid`,borderRight:`${Ox}px solid`,borderBottom:`${Ox}px solid`,borderLeft:`${Ox}px solid`,borderColor:$.map(Se=>Se.borderColor),opacity:$.map(Se=>Se.opacity),color:$.map(Se=>Se.color),display:"flex",justifyContent:"center",alignItems:"center",padding:"0 4px 0 1px",marginLeft:"4px",background:$.map(Se=>Se.backgroundColor),cursor:"pointer",textWrap:"nowrap"},class:"inline-edit-alternative-action-label",obsRef:Se=>{this._secondaryElement.set(Se,void 0)},ref:Se=>{pe.tooltip&&te.store.add(this._hoverService.setupDelayedHoverAtMouse(Se,{content:pe.tooltip,appearance:{compact:!0}}))}},[de,_("div.inline-edit-alternative-action-label-separator"),pe.icon?Qo(pe.icon):void 0,pe.label])})]),Mo.div({style:{position:"absolute",...lb(te=>f.read(te).originalLine.withMargin(Ox)),boxSizing:"border-box",borderRadius:`${ab}px`,border:`${Ox}px solid ${v}`,background:wt(DQi),pointerEvents:"none"}},[]),Mo.svg({width:11,height:14,viewBox:"0 0 11 14",fill:"none",style:{position:"absolute",left:f.map(te=>te.modifiedLine.left-16),top:f.map(te=>te.modifiedLine.top+Math.round((te.lineHeight-14-5)/2)),pointerEvents:"none"},onmousedown:te=>this._mouseDown(te)},[Mo.svgElem("path",{d:"M1 0C1 2.98966 1 5.92087 1 8.49952C1 9.60409 1.89543 10.5 3 10.5H10.5",stroke:wt(s9)}),Mo.svgElem("path",{d:"M6 7.5L9.99999 10.49998L6 13.5",stroke:wt(s9)})])])]})]).keepUpdated(this._store),this._register(this._editor.createOverlayWidget({domNode:this._root.element,minContentWidthInPx:Oo(0),position:Oo({preference:{top:0,left:0}}),allowEditorOverflow:!1}))}static{this.MAX_LENGTH=100}_mouseDown(e){let t=FBo(e.target,new Set([YQi,XQi,Dai,QQi]));t&&(e.preventDefault(),this._onDidClick.fire(WL.create(e,t===Dai)))}};dj=I([m(3,kt),m(4,De),m(5,_e),m(6,tt),m(7,eC)],dj);function FBo(a,i){let e=a;for(;e;){if(i.has(e.id))return e.id;e=e.parentElement}return null}var fCt=class extends C{constructor(e,t,o){super();this._originalEditor=e;this._state=t;this._modifiedTextModel=o;this._onDidClick=this._register(new E);this.onDidClick=this._onDidClick.event;this.isHovered=os(this._originalEditor).isTargetHovered(r=>r.target.type===6&&r.target.detail.injectedText?.options.attachedData instanceof o3e&&r.target.detail.injectedText.options.attachedData.owner===this,this._store),this._tokenizationFinished=VBo(this._modifiedTextModel),this._decorations=Ce(this,r=>{let s=this._state.read(r);if(!s)return;let l=s.modifiedText,c=s.mode==="insertionInline",u=s.diff.length===1&&s.diff[0].innerChanges?.length===1,p=!0,h=[],g=[],f=po.register({className:"inlineCompletions-line-insert",description:"line-insert",isWholeLine:!0,marginClassName:"gutter-insert"}),v=po.register({className:"inlineCompletions-line-delete",description:"line-delete",isWholeLine:!0,marginClassName:"gutter-delete"}),b=po.register({className:"inlineCompletions-char-delete",description:"char-delete",isWholeLine:!1,zIndex:1}),S=po.register({className:"inlineCompletions-char-insert",description:"char-insert",isWholeLine:!0}),y=po.register({className:"inlineCompletions-char-insert",description:"char-insert",shouldFillLineOnLineBreak:!0}),w=po.register({className:"inlineCompletions-char-insert diff-range-empty",description:"char-insert diff-range-empty"}),k=po.register({className:"inlineCompletions-original-lines",description:"inlineCompletions-original-lines",isWholeLine:!1,shouldFillLineOnLineBreak:!0}),T=s.mode!=="sideBySide"&&s.mode!=="deletion"&&s.mode!=="insertionInline"&&s.mode!=="lineReplacement",N=s.mode==="lineReplacement";for(let O of s.diff)if(T&&(O.original.isEmpty||h.push({range:O.original.toInclusiveRange(),options:v}),O.modified.isEmpty||g.push({range:O.modified.toInclusiveRange(),options:f})),O.modified.isEmpty||O.original.isEmpty)O.original.isEmpty||h.push({range:O.original.toInclusiveRange(),options:b}),O.modified.isEmpty||g.push({range:O.modified.toInclusiveRange(),options:S});else{let V=c&&JQi(O);for(let U of O.innerChanges||[]){if(O.original.contains(U.originalRange.startLineNumber)&&!(N&&U.originalRange.isEmpty())){let G=this._originalEditor.getModel()?.getValueInRange(U.originalRange,1);h.push({range:U.originalRange,options:{description:"char-delete",shouldFillLineOnLineBreak:!1,className:ACe("inlineCompletions-char-delete",U.originalRange.isSingleLine()&&s.mode==="insertionInline"&&"single-line-inline",U.originalRange.isEmpty()&&"empty",(U.originalRange.isEmpty()&&u||s.mode==="deletion"&&G===`
`)&&p&&!V&&"diff-range-empty"),inlineClassName:V?ACe("strike-through","inlineCompletions"):null,zIndex:1}})}if(O.modified.contains(U.modifiedRange.startLineNumber)&&g.push({range:U.modifiedRange,options:U.modifiedRange.isEmpty()&&p&&!V&&u?w:y}),V){let G=l.getValueOfRange(U.modifiedRange),$=G.length>3?[{text:G.slice(0,1),extraClasses:["start"],offsetRange:new di(U.modifiedRange.startColumn-1,U.modifiedRange.startColumn)},{text:G.slice(1,-1),extraClasses:[],offsetRange:new di(U.modifiedRange.startColumn,U.modifiedRange.endColumn-2)},{text:G.slice(-1),extraClasses:["end"],offsetRange:new di(U.modifiedRange.endColumn-2,U.modifiedRange.endColumn-1)}]:[{text:G,extraClasses:["start","end"],offsetRange:new di(U.modifiedRange.startColumn-1,U.modifiedRange.endColumn)}];this._tokenizationFinished.read(r);let te=this._modifiedTextModel.tokenization.getLineTokens(U.modifiedRange.startLineNumber);for(let{text:pe,extraClasses:de,offsetRange:se}of $)h.push({range:z.fromPositions(U.originalRange.getEndPosition()),options:{description:"inserted-text",before:{tokens:te.getTokensInRange(se),content:pe,inlineClassName:ACe("inlineCompletions-char-insert",U.modifiedRange.isSingleLine()&&s.mode==="insertionInline"&&"single-line-inline",...de),cursorStops:3,attachedData:new o3e(this)},zIndex:2,showIfCollapsed:!0}})}}}if(s.editorType==="diffEditor")for(let O of s.diff)O.original.isEmpty||h.push({range:O.original.toExclusiveRange(),options:k});return{originalDecorations:h,modifiedDecorations:g}}),this._register(os(this._originalEditor).setDecorations(this._decorations.map(r=>r?.originalDecorations??[])));let n=this._state.map(r=>r?.modifiedCodeEditor);this._register(Ga((r,s)=>{let l=n.read(r);l&&s.add(os(l).setDecorations(this._decorations.map(c=>c?.modifiedDecorations??[])))})),this._register(this._originalEditor.onMouseUp(r=>{if(r.target.type!==6)return;let s=r.target.detail.injectedText?.options.attachedData;s instanceof o3e&&s.owner===this&&this._onDidClick.fire(new WL(r.event))}))}static supportsInlineDiffRendering(e){return JQi(e)}},o3e=class{constructor(i){this.owner=i}};function JQi(a){return a.innerChanges?a.innerChanges.every(i=>Lje(i.modifiedRange)&&Lje(i.originalRange)):!1}var WBo=0;function VBo(a){return ui(a.onDidChangeTokens,()=>WBo++)}var KCe=class extends C{constructor(e,t,o,n,r,s){super();this._editor=e;this._model=t;this._simpleModel=o;this._inlineSuggestInfo=n;this._showCollapsed=r;this._instantiationService=s;this._tabAction=Ce(e=>this._model.read(e)?.tabAction.read(e)??"inactive");this.displayRange=Ce(this,e=>{let t=this._uiState.read(e);if(t&&t.target.uri.toString()===this._editorObs.model.read(e)?.uri.toString()){if(t.state?.kind==="custom"){let o=t.state.displayLocation?.range;if(!o)throw new ni("custom view should have a range");return new ro(o.startLineNumber,o.endLineNumber)}return t.state?.kind==="insertionMultiLine"?this._insertion.originalLines.read(e):t.edit.displayRange}});this._currentInlineEditCache=void 0;this._uiState=Ce(this,e=>{let t=this._model.read(e),o=this._editorObs.model.read(e);if(!t||!o||!this._constructorDone.read(e))return;let n=t.inlineEdit,r,s,l;n.edit?(s=cg.fromEdit(n.edit),l=new _S(n.edit.apply(n.originalText)),r=PSe(s,n.originalText,l)):(s=[],r=[],l=n.originalText);let c=this._determineRenderState(t,e,r,l);if(!c){mt(new Error(`unable to determine view: tried to render ${this._previousView?.view}`));return}let u=this._getLongDistanceHintState(t,e);if(u&&u.isVisible&&c.viewData.setLongDistanceViewData(u.lineNumber,n.lineEdit.lineRange.startLineNumber),c.kind==="sideBySide"){let g=BQi(l.getValue(),n.modifiedLineRange,o.getOptions().tabSize);l=new _S(g.applyToString(l.getValue())),s=VQi(s,g),r=PSe(s,n.originalText,l)}this._previewTextModel.setLanguage(o.getLanguageId());let p=this._previewTextModel.getValue();if(p!==l.getValue()){this._previewTextModel.setEOL(o.getEndOfLineSequence());let f=Qc.replace(new di(0,p.length),l.getValue()).removeCommonSuffixPrefix(p),v=Cle(this._previewTextModel).getTextEdit(f);this._previewTextModel.edit(v)}this._showCollapsed.read(e)&&(c={kind:"collapsed",viewData:c.viewData}),t.handleInlineEditShownNextFrame(c.kind,c.viewData);let h=n.action?.kind==="jumpTo"?n.action.position:null;return{state:c,diff:r,edit:n,newText:l.getValue(),newTextLineCount:n.modifiedLineRange.length,editorType:t.editorType,longDistanceHint:u,nextCursorPosition:h,target:n.inlineCompletion.originalTextRef}});this.inlineEditsIsHovered=Ce(this,e=>this._sideBySide.isHovered.read(e)||this._wordReplacementViews.read(e).some(t=>t.isHovered.read(e))||this._deletion.isHovered.read(e)||this._inlineDiffView.isHovered.read(e)||this._lineReplacementView.isHovered.read(e)||this._insertion.isHovered.read(e)||this._customView.isHovered.read(e)||this._longDistanceHint.map((t,o)=>t?.isHovered.read(o)??!1).read(e));this.gutterIndicatorOffset=Ce(this,e=>this._uiState.read(e)?.state?.kind==="insertionMultiLine"?this._insertion.startLineOffset.read(e):0);this._editorObs=os(this._editor),this._constructorDone=Le(this,!1),this._previewTextModel=this._register(this._instantiationService.createInstance(Bu,"",this._editor.getModel().getLanguageId(),{...Bu.DEFAULT_CREATION_OPTIONS,bracketPairColorizationOptions:{enabled:!0,independentColorPoolPerBracketType:!1}},null)),this._sideBySide=this._register(this._instantiationService.createInstance(Mle,this._editor,this._model.map(p=>p?.inlineEdit),this._previewTextModel,this._uiState.map(p=>p&&p.state?.kind==="sideBySide"?{newTextLineCount:p.newTextLineCount,editorType:p.editorType}:void 0),this._tabAction)),this._deletion=this._register(this._instantiationService.createInstance(hCt,this._editor,this._model.map(p=>p?.inlineEdit),this._uiState.map(p=>p&&p.state?.kind==="deletion"?{originalRange:p.state.originalRange,deletions:p.state.deletions,editorType:p.editorType}:void 0),this._tabAction)),this._insertion=this._register(this._instantiationService.createInstance(VCe,this._editor,this._uiState.map(p=>p&&p.state?.kind==="insertionMultiLine"?{lineNumber:p.state.lineNumber,startColumn:p.state.column,text:p.state.text,editorType:p.editorType}:void 0),this._tabAction)),this._inlineCollapsedView=this._register(this._instantiationService.createInstance(FCe,this._editor,this._model.map((p,h)=>this._uiState.read(h)?.state?.kind==="collapsed"?p?.inlineEdit:void 0))),this._customView=this._register(this._instantiationService.createInstance(WCe,this._editor,this._model.map((p,h)=>this._uiState.read(h)?.state?.kind==="custom"?p?.displayLocation:void 0),this._tabAction,this._uiState.map(p=>p?.editorType??"textEditor"))),this._showLongDistanceHint=this._editorObs.getOption(71).map(this,p=>p.edits.showLongDistanceHint),this._longDistanceHint=Ce(this,p=>{if(this._showLongDistanceHint.read(p))return p.store.add(this._instantiationService.createInstance(UCe,this._editor,this._uiState.map((h,g)=>h?.longDistanceHint?{hint:h.longDistanceHint,newTextLineCount:h.newTextLineCount,edit:h.edit,diff:h.diff,editorType:h.editorType,model:this._simpleModel.read(g),inlineSuggestInfo:this._inlineSuggestInfo.read(g),nextCursorPosition:h.nextCursorPosition,target:h.target}:void 0),this._previewTextModel,this._tabAction))}).recomputeInitiallyAndOnChange(this._store),this._inlineDiffViewState=Ce(this,p=>{let h=this._uiState.read(p);if(!(!h||!h.state)&&!(h.state.kind==="wordReplacements"||h.state.kind==="insertionMultiLine"||h.state.kind==="collapsed"||h.state.kind==="custom"||h.state.kind==="jumpTo"))return{modifiedText:new _S(h.newText),diff:h.diff,mode:h.state.kind,modifiedCodeEditor:this._sideBySide.previewEditor,editorType:h.editorType}}),this._inlineDiffView=this._register(new fCt(this._editor,this._inlineDiffViewState,this._previewTextModel)),this._jumpToView=this._register(this._instantiationService.createInstance(Q7,this._editorObs,{style:"label"},Ce(p=>{let h=this._uiState.read(p);if(h?.state?.kind==="jumpTo")return{jumpToPosition:h.state.position}})));let l=hs({equalsFn:Apt.arrayC(Apt.thisC())},p=>{let h=this._uiState.read(p);return h?.state?.kind==="wordReplacements"?h.state.replacements.map(g=>new gCt(g,h.editorType,h.state?.alternativeAction)):[]});this._wordReplacementViews=$v(this,l,(p,h)=>h.add(this._instantiationService.createInstance(dj,this._editorObs,p,this._tabAction))),this._lineReplacementView=this._register(this._instantiationService.createInstance(BCe,this._editorObs,this._uiState.map(p=>p?.state?.kind==="lineReplacement"?{originalRange:p.state.originalRange,modifiedRange:p.state.modifiedRange,modifiedLines:p.state.modifiedLines,replacements:p.state.replacements}:void 0),this._uiState.map(p=>p?.editorType??"textEditor"),this._tabAction)),this._useCodeShifting=this._editorObs.getOption(71).map(p=>p.edits.allowCodeShifting),this._renderSideBySide=this._editorObs.getOption(71).map(p=>p.edits.renderSideBySide),this._register(he(p=>{let h=this._model.read(p);h&&p.store.add(H.any(this._sideBySide.onDidClick,this._lineReplacementView.onDidClick,this._insertion.onDidClick,...this._wordReplacementViews.read(p).map(g=>g.onDidClick),this._inlineDiffView.onDidClick,this._customView.onDidClick)(g=>{this._viewHasBeenShownLongerThan(350)&&(g.event.preventDefault(),h.accept(g.alternativeAction))}))})),this._wordReplacementViews.recomputeInitiallyAndOnChange(this._store);let c=Ce(this,p=>Math.max(...this._wordReplacementViews.read(p).map(h=>h.minEditorScrollHeight.read(p)),this._lineReplacementView.minEditorScrollHeight.read(p),this._customView.minEditorScrollHeight.read(p))).recomputeInitiallyAndOnChange(this._store),u;this._register(he(p=>{let h=c.read(p),g=this._editorObs.model.read(p);g&&this._editor.changeViewZones(f=>{let v=this._editor.getScrollHeight(),b=h-v+1;b!==0&&u!==void 0&&(f.removeZone(u),u=void 0),!(b<=0)&&(u=f.addZone({afterLineNumber:g.getLineCount(),heightInPx:b,domNode:_("div.minScrollHeightViewZone")}))})})),this._constructorDone.set(!0,void 0)}_getLongDistanceHintState(e,t){if(!e.inlineEdit.inlineCompletion.identity.jumpedTo.read(t)&&e.inlineEdit.action!==void 0)return e.inlineEdit.originalText.uri.toString()!==this._editorObs.model.read(t)?.uri.toString()?{isVisible:!0,lineNumber:e.inlineEdit.cursorPosition.lineNumber}:(this._currentInlineEditCache?.inlineSuggestionIdentity!==e.inlineEdit.inlineCompletion.identity&&(this._currentInlineEditCache={inlineSuggestionIdentity:e.inlineEdit.inlineCompletion.identity,firstCursorLineNumber:e.inlineEdit.cursorPosition.lineNumber}),{lineNumber:this._currentInlineEditCache.firstCursorLineNumber,isVisible:!e.inViewPort.read(t)})}_getCacheId(e){return e.inlineEdit.inlineCompletion.identity.id}_determineView(e,t,o,n){let r=e.inlineEdit,s=this._previousView?.id===this._getCacheId(e)&&this._previousView?.uri.toString()===this._editorObs.model.get().uri.toString(),l=this._previousView?.editorWidth!==this._editorObs.layoutInfoWidth.read(t)&&(this._previousView?.view==="sideBySide"||this._previousView?.view==="lineReplacement");if(s&&!l)return this._previousView.view;let c=e.inlineEdit.inlineCompletion.action;if(c?.kind==="edit"&&c.alternativeAction)return"wordReplacements";let u=e.inlineEdit.inlineCompletion.originalTextRef.uri,p=this._editorObs.model.read(t)?.uri;if(p&&u.toString()!==p.toString())return"custom";if(e.displayLocation&&!e.inlineEdit.inlineCompletion.identity.jumpedTo.read(t))return"custom";let h=r.originalLineRange.length,g=r.modifiedLineRange.length,f=o.flatMap(b=>b.innerChanges??[]),v=f.length===1;if(e.editorType!=="diffEditor"){if(v&&this._useCodeShifting.read(t)!=="never"&&o6i(o))return HBo(o,r.cursorPosition)?"insertionInline":"lineReplacement";if(e6i(f,r,n))return"deletion";if(ZQi(o)&&this._useCodeShifting.read(t)==="always")return"insertionMultiLine";if(f.every(S=>Zl.ofRange(S.originalRange).columnCount<dj.MAX_LENGTH&&Zl.ofRange(S.modifiedRange).columnCount<dj.MAX_LENGTH)&&v&&h===1&&g===1){let S=f.map(w=>n.getValueOfRange(w.modifiedRange)),y=f.map(w=>e.inlineEdit.originalText.getValueOfRange(w.originalRange));if(!S.some(w=>w.includes(" "))&&!y.some(w=>w.includes(" "))&&(!f.some(w=>w.originalRange.isEmpty())||!t6i(f.map(w=>new Xr(w.originalRange,"")),r.originalText).some(w=>w.range.isEmpty()&&Zl.ofRange(w.range).columnCount<dj.MAX_LENGTH)))return"wordReplacements"}}if(h>0&&g>0)return h===1&&g===1&&e.editorType!=="diffEditor"?"lineReplacement":this._renderSideBySide.read(t)!=="never"&&Mle.fitsInsideViewport(this._editor,this._previewTextModel,r,t)?"sideBySide":"lineReplacement";if(e.editorType==="diffEditor"){if(e6i(f,r,n))return"deletion";if(ZQi(o)&&this._useCodeShifting.read(t)==="always")return"insertionMultiLine"}return"sideBySide"}_determineRenderState(e,t,o,n){if(e.inlineEdit.action?.kind==="jumpTo")return{kind:"jumpTo",position:e.inlineEdit.action.position,viewData:i6i};let r=e.inlineEdit,s=this._determineView(e,t,o,n);if(this._willRenderAboveCursor(t,r,s))switch(s){case"lineReplacement":case"wordReplacements":s="sideBySide";break}this._previousView={id:this._getCacheId(e),view:s,editorWidth:this._editor.getLayoutInfo().width,timestamp:Date.now(),uri:this._editorObs.model.get().uri};let l=o.flatMap(g=>g.innerChanges??[]),c=this._editor.getModel(),u=l.map(g=>({originalRange:g.originalRange,modifiedRange:g.modifiedRange,original:r.originalText.getValueOfRange(g.originalRange),modified:n.getValueOfRange(g.modifiedRange)})),p=BBo(r,u,c);switch(s){case"insertionInline":return{kind:"insertionInline",viewData:p};case"sideBySide":return{kind:"sideBySide",viewData:p};case"collapsed":return{kind:"collapsed",viewData:p};case"custom":return{kind:"custom",displayLocation:e.displayLocation,viewData:p}}if(s==="deletion")return{kind:"deletion",originalRange:r.originalLineRange,deletions:l.map(g=>g.originalRange),viewData:p};if(s==="insertionMultiLine"){let g=l[0];return{kind:"insertionMultiLine",lineNumber:g.originalRange.startLineNumber,column:g.originalRange.startColumn,text:n.getValueOfRange(g.modifiedRange),viewData:p}}let h=u.map(g=>new Xr(g.originalRange,g.modified));if(h.length!==0){if(s==="wordReplacements"){let g=UBo(h,r.originalText);return g.some(f=>f.range.isEmpty())&&(g=t6i(h,r.originalText)),{kind:"wordReplacements",replacements:g,alternativeAction:e.inlineEdit.action?.alternativeAction,viewData:p}}if(s==="lineReplacement")return{kind:"lineReplacement",originalRange:r.originalLineRange,modifiedRange:r.modifiedLineRange,modifiedLines:r.modifiedLineRange.mapToLineArray(g=>n.getLineAt(g)),replacements:l.map(g=>({originalRange:g.originalRange,modifiedRange:g.modifiedRange})),viewData:p}}}_willRenderAboveCursor(e,t,o){if(this._useCodeShifting.read(e)==="always")return!1;for(let r of t.multiCursorPositions)if(o==="wordReplacements"&&r.lineNumber===t.originalLineRange.startLineNumber+1||o==="lineReplacement"&&r.lineNumber>=t.originalLineRange.endLineNumberExclusive&&r.lineNumber<t.modifiedLineRange.endLineNumberExclusive+t.modifiedLineRange.length)return!0;return!1}_viewHasBeenShownLongerThan(e){let t=this._previousView?.timestamp;if(!t)throw new ni("viewHasBeenShownLongThan called before a view has been shown");return Date.now()-t>=e}};KCe=I([m(5,F)],KCe);var i6i=new xle(-1,-1,-1,-1,-1,-1,-1,!0);function BBo(a,i,e){if(!a.edit)return i6i;let t=a.cursorPosition,o=i.length===0?!1:i[0].modified.startsWith(e.getEOL());return new xle(a.edit.replacements.length===0?0:a.edit.replacements[0].range.getStartPosition().column-t.column,a.lineEdit.lineRange.startLineNumber-t.lineNumber+(o&&a.lineEdit.lineRange.startLineNumber>=t.lineNumber?1:0),a.lineEdit.lineRange.length,a.lineEdit.newLines.length,i.reduce((r,s)=>r+s.original.length,0),i.reduce((r,s)=>r+s.modified.length,0),i.length,i.every(r=>r.original===i[0].original&&r.modified===i[0].modified))}function o6i(a){return a.every(e=>e.innerChanges.every(t=>i(t)));function i(e){return!(!e.originalRange.isEmpty()||!(e.modifiedRange.startLineNumber===e.modifiedRange.endLineNumber))}}function HBo(a,i){if(!i||!o6i(a))return!1;let e=i;return a.every(o=>o.innerChanges.every(n=>t(n)));function t(o){let n=o.originalRange.getStartPosition();return!!(e.isBeforeOrEqual(n)||n.lineNumber<e.lineNumber)}}function ZQi(a){let i=a.flatMap(t=>t.innerChanges??[]);if(i.length!==1)return!1;let e=i[0];return!(!e.originalRange.isEmpty()||e.modifiedRange.startLineNumber===e.modifiedRange.endLineNumber)}function e6i(a,i,e){return a.map(o=>({original:i.originalText.getValueOfRange(o.originalRange),modified:e.getValueOfRange(o.modifiedRange)})).every(({original:o,modified:n})=>n.trim()===""&&o.length>0&&(o.length>n.length||o.trim()!==""))}function UBo(a,i){return n6i(a,i,e=>/^[a-zA-Z]$/.test(e))}function t6i(a,i){return n6i(a,i,e=>!/^\s$/.test(e))}function n6i(a,i,e){let t=[];a.sort((n,r)=>z.compareRangesUsingStarts(n.range,r.range));for(let n of a){let r=n.range.startColumn-1,s=n.range.endColumn-2,l="",c="",u=i.getLineAt(n.range.startLineNumber),p=i.getLineAt(n.range.endLineNumber);if(o(u[r]))for(;o(u[r-1]);)l=u[r-1]+l,r--;if(o(p[s])||s<r)for(;o(p[s+1]);)c+=p[s+1],s++;let h=new Xr(new z(n.range.startLineNumber,r+1,n.range.endLineNumber,s+2),l+n.text+c);t.length>0&&z.areIntersectingOrTouching(t[t.length-1].range,h.range)&&(h=Xr.joinReplacements([t.pop(),h],i)),t.push(h)}function o(n){return n===void 0?!1:e(n)}return t}var GCe=class extends C{constructor(e,t,o,n){super();this._editor=e;this._model=t;this._showCollapsed=o;this._inlineEdit=Ce(this,e=>{let t=this._model.read(e);if(!t||!this._editor.getModel())return;let n=t.inlineEditState.read(e);if(!n)return;let r=n.inlineSuggestion.action,s;if(r?.kind==="edit"){let l=r.stringEdit,c=n.inlineSuggestion.originalTextRef.getTransformer(),u=l.replacements.map(p=>{let h=z.fromPositions(c.getPosition(p.replaceRange.start),c.getPosition(p.replaceRange.endExclusive));return new Xr(h,p.newText)});s=new bp(u)}else s=void 0;return new dCt(n.inlineSuggestion.originalTextRef,r,s,t.primaryPosition.read(void 0),t.allPositions.read(void 0),n.inlineSuggestion.source.inlineSuggestions.commands??[],n.inlineSuggestion)});this._inlineEditModel=Ce(this,e=>{let t=this._model.read(e);if(!t)return;let o=this._inlineEdit.read(e);if(!o)return;let n=Ce(this,r=>{if(this._editorObs.isFocused.read(r)){if(t.tabShouldJumpToInlineEdit.read(r))return"jump";if(t.tabShouldAcceptInlineEdit.read(r))return"accept"}return"inactive"});return new uCt(t,o,n)});this._editorObs=os(this._editor),this.view=this._register(n.createInstance(KCe,this._editor,this._inlineEditModel,this._model.map(r=>r?j7.fromInlineCompletionModel(r):void 0),this._inlineEdit.map(r=>r?q7.fromInlineSuggestion(r.inlineCompletion):void 0),this._showCollapsed))}};GCe=I([m(3,F)],GCe);var $Ce=class extends C{constructor(e,t,o,n){super();this._editor=e;this._model=t;this._focusIsInMenu=o;this._instantiationService=n;this._ghostTexts=Ce(this,e=>this._model.read(e)?.ghostTexts.read(e)??[]);this._inlineEdit=Ce(this,e=>this._model.read(e)?.inlineEditState.read(e)?.inlineSuggestion);this._everHadInlineEdit=vf(this,(e,t)=>t||!!this._inlineEdit.read(e)||!!this._model.read(e)?.inlineCompletionState.read(e)?.inlineSuggestion?.showInlineEditMenu);this._indicatorIsHoverVisible=Le(this,void 0);this._showInlineEditCollapsed=Ce(this,e=>(this._model.read(e)?.showCollapsed.read(e)??!1)&&!this._indicatorIsHoverVisible.read(e)?.read(e));this._inlineEditWidget=RI(e=>{if(this._everHadInlineEdit.read(e))return this._instantiationService.createInstance(GCe,this._editor,this._model,this._showInlineEditCollapsed)});this._gutterIndicatorState=Ce(e=>{let t=this._model.read(e);if(!t)return;let o=t.state.read(e);if(o?.kind==="ghostText"&&o.inlineSuggestion?.showInlineEditMenu)return{displayRange:ro.ofLength(o.primaryGhostText.lineNumber,1),tabAction:Ce(this,n=>this._editorObs.isFocused.read(n)?"accept":"inactive"),gutterIndicatorOffset:Oo(zBo(o.inlineSuggestion,this._editor)),inlineSuggestion:o.inlineSuggestion,model:t};if(o?.kind==="inlineEdit"){let n=this._inlineEditWidget.read(e)?.view;if(!n)return;let r=n.displayRange.read(e);return r?{displayRange:r,tabAction:Ce(s=>{if(this._editorObs.isFocused.read(s)){if(t.tabShouldJumpToInlineEdit.read(s))return"jump";if(t.tabShouldAcceptInlineEdit.read(s))return"accept"}return"inactive"}),gutterIndicatorOffset:n.gutterIndicatorOffset,inlineSuggestion:o.inlineSuggestion,model:t}:void 0}else return});this._stablizedGhostTexts=nQi(this._ghostTexts,this._store),this._editorObs=os(this._editor),this._ghostTextWidgets=$v(this,this._stablizedGhostTexts,(r,s)=>s.add(this._createGhostText(r))).recomputeInitiallyAndOnChange(this._store),this._inlineEditWidget.recomputeInitiallyAndOnChange(this._store),this._fontFamily=this._editorObs.getOption(71).map(r=>r.fontFamily),this._register(z2i(Ce(r=>`
.monaco-editor .ghost-text-decoration,
.monaco-editor .ghost-text-decoration-preview,
.monaco-editor .ghost-text {
font-family: ${this._fontFamily.read(r)};
}`))),this._register(new Ewe(this._editor,this._model,this._instantiationService)),this._indicator=this._register(this._instantiationService.createInstance(Z1,this._editorObs,Ce(r=>{let s=this._gutterIndicatorState.read(r);if(s)return new $7(q7.fromInlineSuggestion(s.inlineSuggestion),s.displayRange,j7.fromInlineCompletionModel(s.model),s.inlineSuggestion.action?.kind==="edit"?s.inlineSuggestion.action.alternativeAction:void 0)}),this._gutterIndicatorState.map((r,s)=>r?.tabAction.read(s)??"inactive"),this._gutterIndicatorState.map((r,s)=>r?.gutterIndicatorOffset.read(s)??0),this._inlineEditWidget.map((r,s)=>r?.view.inlineEditsIsHovered.read(s)??!1),this._focusIsInMenu)),this._indicatorIsHoverVisible.set(this._indicator.isHoverVisible,void 0),Ce(r=>{let s=this._inlineEditWidget.read(r);if(s)return r.store.add(this._instantiationService.createInstance(OCe,s._inlineEditModel,Oo(this._indicator),s.view._inlineCollapsedView))}).recomputeInitiallyAndOnChange(this._store)}static{this.hot=s1(this)}_createGhostText(e){return this._instantiationService.createInstance(X1,this._editor,Ce(t=>{let o=this._model.read(t),n=o?.inlineCompletionState.read(t)?.inlineSuggestion;return!o||!n?{ghostText:e.read(t),handleInlineCompletionShown:()=>{},warning:void 0}:{ghostText:e.read(t),handleInlineCompletionShown:r=>o.handleInlineSuggestionShown(n,"ghostText",r,Date.now()),warning:rCt.from(o?.warning.read(t))}}),{useSyntaxHighlighting:this._editorObs.getOption(71).map(t=>t.syntaxHighlightingEnabled),highlightShortSuggestions:!0})}shouldShowHoverAtViewZone(e){return this._ghostTextWidgets.get()[0]?.ownsViewZone(e)??!1}};$Ce=I([m(3,F)],$Ce);function zBo(a,i){let e=a.getSingleTextEdit(),t=i.getModel();if(!t)return 0;let o=t.getEOL();if(e.range.isEmpty()&&e.text.startsWith(o)){let n=i.getLineHeightForPosition(e.range.getStartPosition());return KBo(e.text,o)*n}return 0}function KBo(a,i){if(!i.length)return 0;let e=0,t=0;for(;a.startsWith(i,t);)e++,t+=i.length;return e}IQi(a=>Rc.get(a));var Rc=class extends C{constructor(e,t,o,n,r,s,l,c,u,p){super();this.editor=e;this._instantiationService=t;this._contextKeyService=o;this._configurationService=n;this._commandService=r;this._debounceService=s;this._languageFeaturesService=l;this._accessibilitySignalService=c;this._keybindingService=u;this._accessibilityService=p;this._enabled=Ce(this,e=>this._enabledInConfig.read(e)&&(!this._isScreenReaderEnabled.read(e)||!this._editorDictationInProgress.read(e)));this._focusIsInMenu=Le(this,!1);this._focusIsInEditorOrMenu=Ce(this,e=>{let t=this._editorObs.isFocused.read(e),o=this._focusIsInMenu.read(e);return t||o});this._cursorIsInIndentation=Ce(this,e=>{let t=this._editorObs.cursorPosition.read(e);if(t===null)return!1;let o=this._editorObs.model.read(e);if(!o)return!1;this._editorObs.versionId.read(e);let n=o.getLineIndentColumn(t.lineNumber);return t.column<=n});this.model=RI(this,e=>{if(this._editorObs.isReadonly.read(e))return;let t=this._editorObs.model.read(e);return t?this._instantiationService.createInstance(ICe,t,this._suggestWidgetAdapter.selectedItem,this._editorObs.versionId,this._positions,this._debounceValue,this._enabled,this.editor):void 0});this._playAccessibilitySignal=Wc(this);this._view=Ce(e=>e.store.add(this._instantiationService.createInstance($Ce.hot.read(e),this.editor,this.model,this._focusIsInMenu)));this._editorObs=os(this.editor),this._positions=Ce(this,b=>this._editorObs.selections.read(b)?.map(S=>S.getEndPosition())??[new Ie(1,1)]),this._suggestWidgetAdapter=this._register(new iCt(this._editorObs,b=>this.model.get()?.handleSuggestAccepted(b),()=>this.model.get()?.selectedInlineCompletion.get()?.getSingleTextEdit())),this._enabledInConfig=ui(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(71).enabled),this._isScreenReaderEnabled=ui(this,this._accessibilityService.onDidChangeScreenReaderOptimized,()=>this._accessibilityService.isScreenReaderOptimized()),this._editorDictationInProgress=ui(this,this._contextKeyService.onDidChangeContext,()=>this._contextKeyService.getContext(this.editor.getDomNode()).getValue("editorDictation.inProgress")===!0),this._debounceValue=this._debounceService.for(this._languageFeaturesService.inlineCompletionsProvider,"InlineCompletionsDebounce",{min:50,max:50}),this.model.recomputeInitiallyAndOnChange(this._store),this._hideInlineEditOnSelectionChange=this._editorObs.getOption(71).map(b=>!0),this._view.recomputeInitiallyAndOnChange(this._store),Rc._instances.add(this),this._register(Z(()=>Rc._instances.delete(this))),this._register(he(b=>{let S=this.model.read(b);if(!S)return;let y=S.state.read(b);if(!y||!this._focusIsInEditorOrMenu.read(void 0))return;let w=y.kind==="inlineEdit"?y.nextEditUri:void 0;for(let k of Rc._instances)k!==this&&(w&&Xe(w,k.editor.getModel()?.uri)?k.model.read(void 0)?.trigger():k.reject())})),this._register(he(b=>{let S=this.model.read(b),y=this.editor.getModel()?.uri;!S||!y||b.store.add(S.onDidAccept(()=>{for(let w of Rc._instances){if(w===this)continue;let k=w.model.read(void 0)?.state.read(void 0);k?.kind==="inlineEdit"&&Xe(k.nextEditUri,y)&&w.model.read(void 0)?.stop("automatic")}}))})),this._register(_s(this._editorObs.onDidType,(b,S)=>{this._enabled.get()&&this.model.get()?.trigger()})),this._register(_s(this._editorObs.onDidPaste,(b,S)=>{this._enabled.get()&&this.model.get()?.trigger()}));let h=new Set([rL.Tab.id,rL.DeleteLeft.id,rL.DeleteRight.id,E1,"acceptSelectedSuggestion",yle.ID,C4e.ID,ad.NextMatchFindAction,sle.ID,J5e.ID,Z5e.ID,e4e.ID,...tSe.getRegisteredCommands()]);this._register(this._commandService.onDidExecuteCommand(b=>{if(h.has(b.commandId)&&e.hasTextFocus()&&this._enabled.get()){let S=!1;b.commandId===E1&&(S=!0),this._editorObs.forceUpdate(y=>{this.model.get()?.trigger(y,{noDelay:S})})}})),this._register(_s(this._editorObs.selections,(b,S,y)=>{if(y.some(w=>w.reason===3||w.source==="api")){if(!this._hideInlineEditOnSelectionChange.get()&&this.model.get()?.state.get()?.kind==="inlineEdit")return;let w=this.model.get();if(!w)return;w.state.get()?.kind==="ghostText"&&this.model.get()?.stop()}})),this._register(he(b=>{let S=this._focusIsInEditorOrMenu.read(b),y=this.model.read(void 0);if(S){let w=y?.state.read(void 0);(!w||w.kind!=="inlineEdit"||!w.nextEditUri)&&Ui(k=>{for(let T of Rc._instances)T!==this&&T.model.read(void 0)?.stop("automatic",k)});return}this._contextKeyService.getContextKeyValue("accessibleViewIsShown")||this._configurationService.getValue("editor.inlineSuggest.keepOnBlur")||e.getOption(71).keepOnBlur||LL.dropDownVisible||y&&(y.state.read(void 0)?.inlineSuggestion?.isFromExplicitRequest&&y.inlineEditAvailable.read(void 0)||Ui(w=>{y.stop("automatic",w)}))})),this._register(he(b=>{let S=this.model.read(b)?.inlineCompletionState.read(b);S?.suggestItem?S.primaryGhostText.lineCount>=2&&this._suggestWidgetAdapter.forceRenderingAbove():this._suggestWidgetAdapter.stopForceRenderingAbove()})),this._register(Z(()=>{this._suggestWidgetAdapter.stopForceRenderingAbove()}));let g=vf(this,(b,S)=>{let w=this.model.read(b)?.state.read(b);return this._suggestWidgetAdapter.selectedItem.get()?S:w?.inlineSuggestion?.semanticId});this._register(Upt(Ce(b=>(this._playAccessibilitySignal.read(b),g.read(b),{})),async(b,S,y,w)=>{let k=this.model.get(),T=k?.state.get();if(!T||!k||(await Pi(50,u6(w)),await gf(this._suggestWidgetAdapter.selectedItem,cn,()=>!1,u6(w)),k=this.model.get(),T=k?.state.get(),!T||!k))return;let N=T.kind==="ghostText"?k.textModel.getLineContent(T.primaryGhostText.lineNumber):"";this._accessibilitySignalService.playSignal(T.kind==="ghostText"?$o.inlineSuggestion:$o.nextEditSuggestion),this.editor.getOption(12)&&(T.kind==="ghostText"?this._provideScreenReaderUpdate(T.primaryGhostText.renderForScreenReader(N)):this._provideScreenReaderUpdate(""))})),this._register(this._configurationService.onDidChangeConfiguration(b=>{b.affectsConfiguration("accessibility.verbosity.inlineCompletions")&&this.editor.updateOptions({inlineCompletionsAccessibilityVerbose:this._configurationService.getValue("accessibility.verbosity.inlineCompletions")})})),this.editor.updateOptions({inlineCompletionsAccessibilityVerbose:this._configurationService.getValue("accessibility.verbosity.inlineCompletions")});let f=new Pwt(this._contextKeyService);this._register(f.bind(ka.cursorInIndentation,this._cursorIsInIndentation)),this._register(f.bind(ka.hasSelection,b=>!this._editorObs.cursorSelection.read(b)?.isEmpty())),this._register(f.bind(ka.cursorAtInlineEdit,this.model.map((b,S)=>b?.inlineEditState?.read(S)?.cursorAtInlineEdit.read(S)))),this._register(f.bind(ka.tabShouldAcceptInlineEdit,this.model.map((b,S)=>!!b?.tabShouldAcceptInlineEdit.read(S)))),this._register(f.bind(ka.tabShouldJumpToInlineEdit,this.model.map((b,S)=>!!b?.tabShouldJumpToInlineEdit.read(S)))),this._register(f.bind(ka.inlineEditVisible,b=>this.model.read(b)?.inlineEditState.read(b)!==void 0)),this._register(f.bind(ka.inlineSuggestionHasIndentation,b=>this.model.read(b)?.getIndentationInfo(b)?.startsWithIndentation)),this._register(f.bind(ka.inlineSuggestionHasIndentationLessThanTabSize,b=>this.model.read(b)?.getIndentationInfo(b)?.startsWithIndentationLessThanTabSize)),this._register(f.bind(ka.suppressSuggestions,b=>{let y=this.model.read(b)?.inlineCompletionState.read(b);return y?.primaryGhostText&&y?.inlineSuggestion?y.inlineSuggestion.source.inlineSuggestions.suppressSuggestions:void 0})),this._register(f.bind(ka.inlineSuggestionAlternativeActionVisible,b=>{let w=this.model.read(b)?.inlineEditState.read(b)?.inlineSuggestion.action;return w&&w.kind==="edit"&&w.alternativeAction!==void 0})),this._register(f.bind(ka.inlineSuggestionVisible,b=>{let y=this.model.read(b)?.inlineCompletionState.read(b);return!!y?.inlineSuggestion&&y?.primaryGhostText!==void 0&&!y?.primaryGhostText.isEmpty()}));let v=Ce(this,b=>{let w=this.model.read(b)?.inlineCompletionState.read(b)?.primaryGhostText;return!w||w.isEmpty()?void 0:new Ie(w.lineNumber,w.parts[0].column)});this._register(f.bind(ka.cursorBeforeGhostText,b=>{let S=v.read(b);if(!S)return!1;let y=this._editorObs.cursorPosition.read(b);return y?S.equals(y):!1})),this._register(this._instantiationService.createInstance(gCe,this.editor))}static{this._instances=new Set}static{this.hot=s1(this)}static{this.ID="editor.contrib.inlineCompletionsController"}static getInFocusedEditorOrParent(e){let t=Bwe(e);return t?Rc.get(t):null}static get(e){return H8i(e.getContribution(Rc.ID))}playAccessibilitySignal(e){this._playAccessibilitySignal.trigger(e)}_provideScreenReaderUpdate(e){let t=this._contextKeyService.getContextKeyValue("accessibleViewIsShown"),o=this._keybindingService.lookupKeybinding("editor.action.accessibleView"),n;!t&&o&&this.editor.getOption(169)&&(n=d(1360,null,o.getAriaLabel())),Jo(n?e+", "+n:e)}shouldShowHoverAt(e){let t=this.model.get()?.primaryGhostText.get();return t?t.parts.some(o=>e.containsPosition(new Ie(t.lineNumber,o.column))):!1}shouldShowHoverAtViewZone(e){return this._view.get().shouldShowHoverAtViewZone(e)}reject(){Ui(e=>{let t=this.model.get();if(t&&(t.stop("explicitCancel",e),this._focusIsInEditorOrMenu.get()))for(let o of Rc._instances)o!==this&&!o._focusIsInEditorOrMenu.get()&&o.model.get()?.stop("automatic",e)})}jump(){let e=this.model.get();e&&e.jump()}};Rc=I([m(1,F),m(2,X),m(3,B),m(4,ge),m(5,jg),m(6,zt),m(7,tr),m(8,_e),m(9,Bi)],Rc);var vCt=class a extends xi{static{this.ID=_It}constructor(){super({id:a.ID,label:L(1338,"Show Next Inline Suggestion"),precondition:x.and(ue.writable,ka.inlineSuggestionVisible),kbOpts:{weight:100,primary:606}})}async run(i,e){Rc.get(e)?.model.get()?.next()}},bCt=class a extends xi{static{this.ID=TIt}constructor(){super({id:a.ID,label:L(1339,"Show Previous Inline Suggestion"),precondition:x.and(ue.writable,ka.inlineSuggestionVisible),kbOpts:{weight:100,primary:604}})}async run(i,e){Rc.get(e)?.model.get()?.previous()}},Lai="vscode://schemas/inlineCompletionProviderIdArgs";function Rai(a){let i=[];return a.providerId&&(i.push(a.providerId.toStringWithoutVersion()),i.push(a.providerId.extensionId+":*")),i}var r6i=$8i(G8i({showNoResultNotification:v4e(tsi()),providerId:v4e(q8i(Lai,U8i())),explicit:v4e(tsi()),changeHintData:v4e(z8i())}),K8i()),SCt=class extends xi{constructor(){super({id:"editor.action.inlineSuggest.trigger",label:L(1341,"Trigger Inline Suggestion"),precondition:ue.writable,metadata:{description:d(1343,null),args:[{name:"args",description:d(1342,null),isOptional:!0,schema:r6i.getJSONSchema()}]}})}async run(i,e,t){let o=i.get(Ne),n=i.get(zt),r=Rc.get(e),s=r6i.validateOrThrow(t),l=s?.providerId?n.inlineCompletionsProvider.all(e.getModel()).find(c=>Rai(c).some(u=>u===s.providerId)):void 0;await P9t(async c=>{await r?.model.get()?.trigger(c,{provider:l,explicit:s?.explicit??!0,changeHint:s?.changeHintData?{data:s.changeHintData}:void 0}),r?.playAccessibilitySignal(c)}),s?.showNoResultNotification&&(r?.model.get()?.state.get()||o.notify({severity:St.Info,message:d(1345,null)}))}},ICt=class extends xi{constructor(){super({id:"editor.action.inlineSuggest.acceptNextWord",label:L(1333,"Accept Next Word Of Inline Suggestion"),precondition:x.and(ue.writable,ka.inlineSuggestionVisible),kbOpts:{weight:101,primary:2065,kbExpr:x.and(ue.writable,ka.inlineSuggestionVisible,ka.cursorBeforeGhostText,$a.negate())},menuOpts:[{menuId:D.InlineSuggestionToolbar,title:d(1329,null),group:"primary",order:2}]})}async run(i,e){await Rc.get(e)?.model.get()?.acceptNextWord()}},yCt=class extends xi{constructor(){super({id:"editor.action.inlineSuggest.acceptNextLine",label:L(1332,"Accept Next Line Of Inline Suggestion"),precondition:x.and(ue.writable,ka.inlineSuggestionVisible),kbOpts:{weight:101},menuOpts:[{menuId:D.InlineSuggestionToolbar,title:d(1328,null),group:"secondary",order:2}]})}async run(i,e){await Rc.get(e)?.model.get()?.acceptNextLine()}},wCt=class extends xi{constructor(){super({id:E1,label:L(1330,"Accept Inline Suggestion"),precondition:x.or(ka.inlineSuggestionVisible,ka.inlineEditVisible),menuOpts:[{menuId:D.InlineSuggestionToolbar,title:d(1327,null),group:"primary",order:2},{menuId:D.InlineEditsActions,title:d(1327,null),group:"primary",order:2}],kbOpts:[{primary:2,weight:200,kbExpr:x.or(x.and(ka.inlineSuggestionVisible,ue.tabMovesFocus.toNegated(),$n.Visible.toNegated(),ue.hoverFocused.toNegated(),ka.hasSelection.toNegated(),ka.inlineSuggestionHasIndentationLessThanTabSize),x.and(ka.inlineEditVisible,ue.tabMovesFocus.toNegated(),$n.Visible.toNegated(),ue.hoverFocused.toNegated(),ka.tabShouldAcceptInlineEdit))}]})}async run(i,e){let t=Rc.getInFocusedEditorOrParent(i);t&&(t.model.get()?.accept(t.editor),t.editor.focus())}};yt.registerKeybindingRule({id:E1,weight:202,primary:2,when:x.and(ka.inInlineEditsPreviewEditor)});var CCt=class extends xi{constructor(){super({id:Kae,label:L(1331,"Accept Inline Suggestion Alternative Action"),precondition:x.and(ka.inlineSuggestionAlternativeActionVisible,ka.inlineEditVisible),menuOpts:[],kbOpts:[{primary:1026,weight:203}]})}async run(i,e){let t=Rc.getInFocusedEditorOrParent(i);t&&(t.model.get()?.accept(t.editor,!0),t.editor.focus())}};yt.registerKeybindingRule({id:Kae,weight:203,primary:1026,when:x.and(ka.inInlineEditsPreviewEditor)});var xCt=class extends xi{constructor(){super({id:DIt,label:L(1337,"Jump to next inline edit"),precondition:ka.inlineEditVisible,menuOpts:[{menuId:D.InlineEditsActions,title:d(1344,null),group:"primary",order:1,when:ka.cursorAtInlineEdit.toNegated()}],kbOpts:{primary:2,weight:201,kbExpr:x.and(ka.inlineEditVisible,ue.tabMovesFocus.toNegated(),$n.Visible.toNegated(),ue.hoverFocused.toNegated(),ka.tabShouldJumpToInlineEdit)}})}async run(i,e){let t=Rc.get(e);t&&t.jump()}},n3e=class a extends xi{static{this.ID=LIt}constructor(){super({id:a.ID,label:L(1336,"Hide Inline Suggestion"),precondition:x.or(ka.inlineSuggestionVisible,ka.inlineEditVisible),kbOpts:{weight:190,primary:9},menuOpts:[{menuId:D.InlineEditsActions,title:d(1346,null),group:"primary",order:3}]})}async run(i,e){let t=Rc.getInFocusedEditorOrParent(i);Ui(o=>{t?.model.get()?.stop("explicitCancel",o)}),t?.editor.focus()}},kCt=class a extends xi{static{this.ID=u5e}constructor(){super({id:a.ID,label:L(1340,"Toggle Inline Suggestions Show Collapsed"),precondition:x.true()})}async run(i,e){let t=i.get(B),o=t.getValue("editor.inlineSuggest.edits.showCollapsed");t.updateValue("editor.inlineSuggest.edits.showCollapsed",!o)}};yt.registerKeybindingRule({id:n3e.ID,weight:-1,primary:9,secondary:[1033],when:x.and(ka.inInlineEditsPreviewEditor)});var ECt=class a extends K{static{this.ID="editor.action.inlineSuggest.toggleAlwaysShowToolbar"}constructor(){super({id:a.ID,title:d(1334,null),f1:!1,precondition:void 0,menu:[{id:D.InlineSuggestionToolbar,group:"secondary",order:10}],toggled:x.equals("config.editor.inlineSuggest.showToolbar","always")})}async run(i){let e=i.get(B),o=e.getValue("editor.inlineSuggest.showToolbar")==="always"?"onHover":"always";e.updateValue("editor.inlineSuggest.showToolbar",o)}},TCt=class extends xi{constructor(){super({id:"editor.action.inlineSuggest.dev.extractRepro",label:d(1335,null),alias:"Developer: Inline Suggest Extract Repro",precondition:x.or(ka.inlineEditVisible,ka.inlineSuggestionVisible)})}async run(i,e){let t=i.get(Wi),n=Rc.get(e)?.model.get();if(!n)return;let r=n.extractReproSample(),l=mc(JSON.stringify({inlineCompletion:r.inlineCompletion},null,4)).map(u=>"// "+u).join(`
`),c=`${r.documentValue}
// <json>
${l}
// </json>
`;return await t.writeText(c),{reproCase:c}}};var Mai=class{constructor(i,e,t){this.owner=i;this.range=e;this.controller=t}isValidForHoverAnchor(i){return i.type===1&&this.range.startColumn<=i.range.startColumn&&this.range.endColumn>=i.range.endColumn}},qCe=class{constructor(i,e,t,o,n){this._editor=i;this.accessibilityService=e;this._instantiationService=t;this._telemetryService=o;this._markdownRendererService=n;this.hoverOrdinal=4}suggestHoverAnchor(i){let e=Rc.get(this._editor);if(!e)return null;let t=i.target;if(t.type===8){let o=t.detail;if(e.shouldShowHoverAtViewZone(o.viewZoneId))return new Fq(1e3,this,z.fromPositions(this._editor.getModel().validatePosition(o.positionBefore||o.position)),i.event.posx,i.event.posy,!1)}if(t.type===7&&e.shouldShowHoverAt(t.range))return new Fq(1e3,this,t.range,i.event.posx,i.event.posy,!1);if(t.type===6&&t.detail.mightBeForeignElement&&e.shouldShowHoverAt(t.range))return new Fq(1e3,this,t.range,i.event.posx,i.event.posy,!1);if(t.type===9&&t.element){let o=X1.getWarningWidgetContext(t.element);if(o&&e.shouldShowHoverAt(o.range))return new Fq(1e3,this,o.range,i.event.posx,i.event.posy,!1)}return null}computeSync(i,e){if(this._editor.getOption(71).showToolbar!=="onHover")return[];let t=Rc.get(this._editor);return t&&t.shouldShowHoverAt(i.range)?[new Mai(this,i.range,t)]:[]}renderHoverParts(i,e){let t=new P,o=e[0];this._telemetryService.publicLog2("inlineCompletionHover.shown"),this.accessibilityService.isScreenReaderOptimized()&&!this._editor.getOption(12)&&t.add(this.renderScreenReaderText(i,o));let n=o.controller.model.get(),r=document.createElement("div");i.fragment.appendChild(r),t.add(Ga((l,c)=>{let u=c.add(this._instantiationService.createInstance(LL.hot.read(l),this._editor,!1,Oo(null),n.selectedInlineCompletionIndex,n.inlineCompletionsCount,n.activeCommands,n.warning,()=>{i.onContentsChanged()}));r.replaceChildren(u.getDomNode())})),n.triggerExplicitly();let s={hoverPart:o,hoverElement:r,dispose(){t.dispose()}};return new Lx([s])}getAccessibleContent(i){return d(1361,null)}renderScreenReaderText(i,e){let t=new P,o=_,n=o("div.hover-row.markdown-hover"),r=R(n,o("div.hover-contents",{"aria-live":"assertive"})),s=l=>{let c=d(1362,null),u=t.add(this._markdownRendererService.render(new xe().appendText(c).appendCodeblock("text",l),{context:this._editor,asyncRenderCallback:()=>{r.className="hover-contents code-hover-contents",i.onContentsChanged()}}));r.replaceChildren(u.element)};return t.add(he(l=>{let c=e.controller.model.read(l)?.primaryGhostText.read(l);if(c){let u=this._editor.getModel().getLineContent(c.lineNumber);s(c.renderForScreenReader(u))}else Fi(r)})),i.fragment.appendChild(n),t}};qCe=I([m(1,Bi),m(2,F),m(3,Te),m(4,Qn)],qCe);var Wd=ae("accessibleViewService");var tp=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.id=e;this.options=t;this.provideContent=o;this.onClose=n;this.verbositySettingKey=r;this.onOpen=s;this.actions=l;this.provideNextContent=c;this.providePreviousContent=u;this.onDidChangeContent=p;this.onKeyDown=h;this.getSymbols=g;this.onDidRequestClearLastProvider=f}};function _Ct(a){if(!a||typeof a!="object")return!1;let i=a;return!!i.id&&!!i.options&&typeof i.provideContent=="function"&&typeof i.onClose=="function"&&typeof i.verbositySettingKey=="string"}var Y7=class extends C{constructor(e,t,o,n,r,s,l,c,u){super();this.id=e;this.options=t;this.provideContent=o;this.onClose=n;this.onOpen=r;this.provideNextContent=s;this.providePreviousContent=l;this.actions=c;this.onDidChangeContent=u}};var DCt=class{constructor(){this.type="view";this.priority=95;this.name="inline-completions";this.when=x.or(ka.inlineSuggestionVisible,ka.inlineEditVisible)}getProvider(i){let e=i.get(Kt),t=e.getActiveCodeEditor()||e.getFocusedCodeEditor();if(!t)return;let o=Rc.get(t)?.model.get();if(o?.state.get())return new Pai(t,o)}},Pai=class extends C{constructor(e,t){super();this._editor=e;this._model=t;this._onDidChangeContent=this._register(new E);this.onDidChangeContent=this._onDidChangeContent.event;this.id="inlineCompletions";this.verbositySettingKey="accessibility.verbosity.inlineCompletions";this.options={language:this._editor.getModel()?.getLanguageId()??void 0,type:"view"}}provideContent(){let e=this._model.state.get();if(!e)throw new Error("Inline completion is visible but state is not available");if(e.kind==="ghostText"){let t=this._model.textModel.getLineContent(e.primaryGhostText.lineNumber),o=e.primaryGhostText.renderForScreenReader(t);if(!o)throw new Error("Inline completion is visible but ghost text is not available");return t+o}else{let t=new _L(this._model.textModel);return rq.fromTextEdit(new bp(e.edits),t).humanReadablePatch(t.getLines())}}provideNextContent(){this._model.next().then((()=>this._onDidChangeContent.fire()))}providePreviousContent(){this._model.previous().then((()=>this._onDidChangeContent.fire()))}onClose(){this._model.stop(),this._editor.focus()}};go(Rc.ID,bwt(Rc.hot),3);Jt(SCt);Jt(vCt);Jt(bCt);Jt(ICt);Jt(yCt);Jt(wCt);Jt(CCt);Jt(kCt);Jt(n3e);Jt(xCt);W(ECt);Jt(TCt);W(jwt);W(Qwt);d_.register(qCe);xa.register(new DCt);var S_=class{constructor(i,e,t,o){this.textModelResolverService=e;this.languageService=t;this.languageFeaturesService=o;this.toUnhook=new P;this.toUnhookForKeyboard=new P;this.currentWordAtPosition=null;this.previousPromise=null;this.editor=i,this.linkDecorations=this.editor.createDecorationsCollection();let n=new sO(i);this.toUnhook.add(n),this.toUnhook.add(n.onMouseMoveOrRelevantKeyDown(([r,s])=>{this.startFindDefinitionFromMouse(r,s??void 0)})),this.toUnhook.add(n.onExecute(r=>{this.isEnabled(r)&&this.gotoDefinition(r.target.position,r.hasSideBySideModifier).catch(s=>{mt(s)}).finally(()=>{this.removeLinkDecorations()})})),this.toUnhook.add(n.onCancel(()=>{this.removeLinkDecorations(),this.currentWordAtPosition=null}))}static{this.ID="editor.contrib.gotodefinitionatposition"}static{this.MAX_SOURCE_PREVIEW_LINES=8}static get(i){return i.getContribution(S_.ID)}async startFindDefinitionFromCursor(i){await this.startFindDefinition(i),this.toUnhookForKeyboard.add(this.editor.onDidChangeCursorPosition(()=>{this.currentWordAtPosition=null,this.removeLinkDecorations(),this.toUnhookForKeyboard.clear()})),this.toUnhookForKeyboard.add(this.editor.onKeyDown(e=>{e&&(this.currentWordAtPosition=null,this.removeLinkDecorations(),this.toUnhookForKeyboard.clear())}))}startFindDefinitionFromMouse(i,e){if(i.target.type===9&&this.linkDecorations.length>0)return;if(!this.editor.hasModel()||!this.isEnabled(i,e)){this.currentWordAtPosition=null,this.removeLinkDecorations();return}let t=i.target.position;this.startFindDefinition(t)}async startFindDefinition(i){this.toUnhookForKeyboard.clear();let e=i?this.editor.getModel()?.getWordAtPosition(i):null;if(!e){this.currentWordAtPosition=null,this.removeLinkDecorations();return}if(this.currentWordAtPosition&&this.currentWordAtPosition.startColumn===e.startColumn&&this.currentWordAtPosition.endColumn===e.endColumn&&this.currentWordAtPosition.word===e.word)return;this.currentWordAtPosition=e;let t=new y1(this.editor,15);this.previousPromise&&(this.previousPromise.cancel(),this.previousPromise=null),this.previousPromise=xn(r=>this.findDefinition(i,r));let o;try{o=await this.previousPromise}catch(r){mt(r);return}if(!o||!o.length||!t.validate(this.editor)){this.removeLinkDecorations();return}let n=o[0].originSelectionRange?z.lift(o[0].originSelectionRange):new z(i.lineNumber,e.startColumn,i.lineNumber,e.endColumn);if(o.length>1){let r=n;for(let{originSelectionRange:s}of o)s&&(r=z.plusRange(r,s));this.addDecoration(r,new xe().appendText(d(1230,null,o.length)))}else{let r=o[0];return r.uri?this.textModelResolverService.createModelReference(r.uri).then(s=>{if(!s.object||!s.object.textEditorModel){s.dispose();return}let{object:{textEditorModel:l}}=s,{startLineNumber:c}=r.range;if(c<1||c>l.getLineCount()){s.dispose();return}let u=this.getPreviewValue(l,c,r),p=this.languageService.guessLanguageIdByFilepathOrFirstLine(l.uri);this.addDecoration(n,u?new xe().appendCodeblock(p||"",u):void 0),s.dispose()}):void 0}}getPreviewValue(i,e,t){let o=t.range;return o.endLineNumber-o.startLineNumber>=S_.MAX_SOURCE_PREVIEW_LINES&&(o=this.getPreviewRangeBasedOnIndentation(i,e)),o=i.validateRange(o),this.stripIndentationFromPreviewRange(i,e,o)}stripIndentationFromPreviewRange(i,e,t){let n=i.getLineFirstNonWhitespaceColumn(e);for(let s=e+1;s<t.endLineNumber;s++){let l=i.getLineFirstNonWhitespaceColumn(s);n=Math.min(n,l)}return i.getValueInRange(t).replace(new RegExp(`^\\s{${n-1}}`,"gm"),"").trim()}getPreviewRangeBasedOnIndentation(i,e){let t=i.getLineFirstNonWhitespaceColumn(e),o=Math.min(i.getLineCount(),e+S_.MAX_SOURCE_PREVIEW_LINES),n=e+1;for(;n<o;n++){let r=i.getLineFirstNonWhitespaceColumn(n);if(t===r)break}return new z(e,1,n+1,1)}addDecoration(i,e){let t={range:i,options:{description:"goto-definition-link",inlineClassName:"goto-definition-link",hoverMessage:e}};this.linkDecorations.set([t])}removeLinkDecorations(){this.linkDecorations.clear()}isEnabled(i,e){return this.editor.hasModel()&&i.isLeftClick&&i.isNoneOrSingleMouseDown&&i.target.type===6&&!(i.target.detail.injectedText?.options instanceof r1)&&(i.hasTriggerModifier||(e?e.keyCodeIsTriggerKey:!1))&&this.languageFeaturesService.definitionProvider.has(this.editor.getModel())}findDefinition(i,e){let t=this.editor.getModel();return t?U1(this.languageFeaturesService.definitionProvider,t,i,!1,e):Promise.resolve(null)}async gotoDefinition(i,e){return this.editor.setPosition(i),this.editor.invokeWithinContext(t=>{let o=!e&&this.editor.getOption(101)&&!this.isInPeekEditor(t);return new NW({openToSide:e,openInPeek:o,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(t)})}isInPeekEditor(i){let e=i.get(X);return Gh.inPeekEditor.getValue(e)}dispose(){this.toUnhook.dispose(),this.toUnhookForKeyboard.dispose()}};S_=I([m(1,Nt),m(2,kt),m(3,zt)],S_);go(S_.ID,S_,2);var jCe=class extends C{constructor(e,t,o){super();this._editor=e;this._markerService=o;this._ctxHasDiagnostics=ue.selectionHasDiagnostics.bindTo(t),this._store.add(this._editor.onDidChangeCursorSelection(()=>this._update())),this._store.add(this._editor.onDidChangeModel(()=>this._update())),this._store.add(this._markerService.onMarkerChanged(n=>{let r=this._editor.getModel();r&&n.some(s=>Xe(s,r.uri))&&this._update()})),this._update()}static{this.ID="editor.contrib.markerSelectionStatus"}dispose(){this._ctxHasDiagnostics.reset(),super.dispose()}_update(){let e=this._editor.getModel(),t=this._editor.getSelection();if(!e||!t){this._ctxHasDiagnostics.reset();return}let n=this._markerService.read({resource:e.uri,severities:14}).some(r=>z.areIntersecting({startLineNumber:r.startLineNumber,startColumn:r.startColumn,endLineNumber:r.endLineNumber,endColumn:r.endColumn},t));this._ctxHasDiagnostics.set(n)}};jCe=I([m(1,X),m(2,Ns)],jCe);go(jCe.ID,jCe,1);var Aai=class extends xi{constructor(){super({id:"editor.action.debugEditorGpuRenderer",label:L(1252,"Developer: Debug Editor GPU Renderer"),precondition:x.true()})}async run(i,e){let t=i.get(F),n=await i.get(Ge).pick([{label:d(1253,null),id:"logTextureAtlasStats"},{label:d(1254,null),id:"saveTextureAtlas"},{label:d(1251,null),id:"drawGlyph"}],{canPickMany:!1});if(n)switch(n.id){case"logTextureAtlasStats":t.invokeFunction(r=>{let s=r.get(ne),l=ec.atlas;if(!ec.atlas){s.error("No texture atlas found");return}let c=l.getStats();s.info(["Texture atlas stats",...c].join(`
`))});break;case"saveTextureAtlas":t.invokeFunction(async r=>{let s=r.get(Pe),l=r.get(be),c=s.getWorkspace().folders;if(c.length>0){let u=ec.atlas,p=[];for(let[h,g]of u.pages.entries())p.push(l.writeFile(A.joinPath(c[0].uri,`textureAtlasPage${h}_actual.png`),Je.wrap(new Uint8Array(await(await g.source.convertToBlob()).arrayBuffer()))),l.writeFile(A.joinPath(c[0].uri,`textureAtlasPage${h}_usage.png`),Je.wrap(new Uint8Array(await(await g.getUsagePreview()).arrayBuffer()))));await Promise.all(p)}});break;case"drawGlyph":t.invokeFunction(async r=>{let s=r.get(B),l=r.get(be),c=r.get(Ge),p=r.get(Pe).getWorkspace().folders;if(p.length===0)return;let h=ec.atlas,g=s.getValue("editor.fontFamily"),f=s.getValue("editor.fontSize"),v=new GU(f,g,Ki().devicePixelRatio,ec.decorationStyleCache),b=await c.input({prompt:"Enter a character to draw (prefix with 0x for code point))"});if(!b)return;let S=b.match(/0x(?<codePoint>[0-9a-f]+)/i)?.groups?.codePoint;S!==void 0&&(b=String.fromCodePoint(parseInt(S,16)));let y=0,k=h.getGlyph(v,b,y,0,0);if(!k)return;let T=h.pages[k.pageIndex].source.getContext("2d")?.getImageData(k.x,k.y,k.w,k.h);if(!T)return;let N=new OffscreenCanvas(T.width,T.height);UN(N.getContext("2d")).putImageData(T,0,0);let V=await N.convertToBlob({type:"image/png"}),U=A.joinPath(p[0].uri,`glyph_${b}_${y}_${f}px_${g.replaceAll(/[,\\\/\.'\s]/g,"_")}.png`);await l.writeFile(U,Je.wrap(new Uint8Array(await V.arrayBuffer())))});break}}};Jt(Aai);var s6i=(t=>(t.NoAutoFocus="noAutoFocus",t.FocusIfVisible="focusIfVisible",t.AutoFocusImmediately="autoFocusImmediately",t))(s6i||{}),LCt=class extends xi{constructor(){super({id:EIt,label:L(1281,"Show or Focus Hover"),metadata:{description:L(1285,"Show or focus the editor hover which shows documentation, references, and other content for a symbol at the current cursor position."),args:[{name:"args",schema:{type:"object",properties:{focus:{description:"Controls if and when the hover should take focus upon being triggered by this action.",enum:["noAutoFocus","focusIfVisible","autoFocusImmediately"],enumDescriptions:[d(1284,null),d(1283,null),d(1282,null)],default:"focusIfVisible"}}}}]},precondition:void 0,kbOpts:{kbExpr:ue.editorTextFocus,primary:Ai(2089,2087),weight:100}})}run(i,e,t){if(!e.hasModel())return;let o=kl.get(e);if(!o)return;let n=t?.focus,r="focusIfVisible";Object.values(s6i).includes(n)?r=n:typeof n=="boolean"&&n&&(r="autoFocusImmediately");let s=c=>{let u=e.getPosition(),p=new z(u.lineNumber,u.column,u.lineNumber,u.column);o.showContentHover(p,1,2,c)},l=e.getOption(2)===2;o.isHoverVisible?r!=="noAutoFocus"?o.focus():s(l):s(l||r==="autoFocusImmediately")}},RCt=class extends xi{constructor(){super({id:l3i,label:L(1279,"Show Definition Preview Hover"),precondition:void 0,metadata:{description:L(1280,"Show the definition preview hover in the editor.")}})}run(i,e){let t=kl.get(e);if(!t)return;let o=e.getPosition();if(!o)return;let n=new z(o.lineNumber,o.column,o.lineNumber,o.column),r=S_.get(e);if(!r)return;r.startFindDefinitionFromCursor(o).then(()=>{t.showContentHover(n,1,2,!0)})}},MCt=class extends xi{constructor(){super({id:c3i,label:L(1266,"Hide Hover"),alias:"Hide Content Hover",precondition:void 0})}run(i,e){kl.get(e)?.hideContentHover()}},PCt=class extends xi{constructor(){super({id:d3i,label:L(1277,"Scroll Up Hover"),precondition:ue.hoverFocused,kbOpts:{kbExpr:ue.hoverFocused,primary:16,weight:100},metadata:{description:L(1278,"Scroll up the editor hover.")}})}run(i,e){let t=kl.get(e);t&&t.scrollUp()}},ACt=class extends xi{constructor(){super({id:u3i,label:L(1271,"Scroll Down Hover"),precondition:ue.hoverFocused,kbOpts:{kbExpr:ue.hoverFocused,primary:18,weight:100},metadata:{description:L(1272,"Scroll down the editor hover.")}})}run(i,e){let t=kl.get(e);t&&t.scrollDown()}},NCt=class extends xi{constructor(){super({id:p3i,label:L(1273,"Scroll Left Hover"),precondition:ue.hoverFocused,kbOpts:{kbExpr:ue.hoverFocused,primary:15,weight:100},metadata:{description:L(1274,"Scroll left the editor hover.")}})}run(i,e){let t=kl.get(e);t&&t.scrollLeft()}},OCt=class extends xi{constructor(){super({id:m3i,label:L(1275,"Scroll Right Hover"),precondition:ue.hoverFocused,kbOpts:{kbExpr:ue.hoverFocused,primary:17,weight:100},metadata:{description:L(1276,"Scroll right the editor hover.")}})}run(i,e){let t=kl.get(e);t&&t.scrollRight()}},FCt=class extends xi{constructor(){super({id:h3i,label:L(1269,"Page Up Hover"),precondition:ue.hoverFocused,kbOpts:{kbExpr:ue.hoverFocused,primary:11,secondary:[528],weight:100},metadata:{description:L(1270,"Page up the editor hover.")}})}run(i,e){let t=kl.get(e);t&&t.pageUp()}},WCt=class extends xi{constructor(){super({id:g3i,label:L(1267,"Page Down Hover"),precondition:ue.hoverFocused,kbOpts:{kbExpr:ue.hoverFocused,primary:12,secondary:[530],weight:100},metadata:{description:L(1268,"Page down the editor hover.")}})}run(i,e){let t=kl.get(e);t&&t.pageDown()}},VCt=class extends xi{constructor(){super({id:f3i,label:L(1264,"Go To Top Hover"),precondition:ue.hoverFocused,kbOpts:{kbExpr:ue.hoverFocused,primary:14,secondary:[2064],weight:100},metadata:{description:L(1265,"Go to the top of the editor hover.")}})}run(i,e){let t=kl.get(e);t&&t.goToTop()}},BCt=class extends xi{constructor(){super({id:v3i,label:L(1262,"Go To Bottom Hover"),precondition:ue.hoverFocused,kbOpts:{kbExpr:ue.hoverFocused,primary:13,secondary:[2066],weight:100},metadata:{description:L(1263,"Go to the bottom of the editor hover.")}})}run(i,e){let t=kl.get(e);t&&t.goToBottom()}},HCt=class extends xi{constructor(){super({id:x1,label:S3i,alias:"Increase Hover Verbosity Level",precondition:ue.hoverVisible})}run(i,e,t){let o=kl.get(e);if(!o)return;let n=t?.index!==void 0?t.index:o.focusedHoverPartIndex();o.updateHoverVerbosityLevel(0,n,t?.focus)}},UCt=class extends xi{constructor(){super({id:k1,label:y3i,alias:"Decrease Hover Verbosity Level",precondition:ue.hoverVisible})}run(i,e,t){let o=kl.get(e);if(!o)return;let n=t?.index!==void 0?t.index:o.focusedHoverPartIndex();kl.get(e)?.updateHoverVerbosityLevel(1,n,t?.focus)}};var zCt=class{constructor(i){this._editor=i}computeSync(i){let e=r=>({value:r}),t=this._editor.getLineDecorations(i.lineNumber),o=[],n=i.laneOrLine==="lineNo";if(!t)return o;for(let r of t){let s=r.options.glyphMargin?.position??2;if(!n&&s!==i.laneOrLine)continue;let l=n?r.options.lineNumberHoverMessage:r.options.glyphMarginHoverMessage;!l||yW(l)||o.push(...Yl(l).map(e))}return o}};var a6i=_,X7=class extends C{constructor(e,t){super();this._markdownRendererService=t;this.allowEditorOverflow=!0;this._renderDisposeables=this._register(new P);this._editor=e,this._isVisible=!1,this._messages=[],this._hover=this._register(new e7(!0)),this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible),this._hoverOperation=this._register(new Twe(this._editor,new zCt(this._editor))),this._register(this._hoverOperation.onResult(o=>this._withResult(o))),this._register(this._editor.onDidChangeModelDecorations(()=>this._onModelDecorationsChanged())),this._register(this._editor.onDidChangeConfiguration(o=>{o.hasChanged(59)&&this._updateFont()})),this._register(Vo(this._hover.containerDomNode,"mouseleave",o=>{this._onMouseLeave(o)})),this._editor.addOverlayWidget(this)}static{this.ID="editor.contrib.modesGlyphHoverWidget"}dispose(){this._hoverComputerOptions=void 0,this._editor.removeOverlayWidget(this),super.dispose()}getId(){return X7.ID}getDomNode(){return this._hover.containerDomNode}getPosition(){return null}_updateFont(){Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach(t=>this._editor.applyFontInfo(t))}_onModelDecorationsChanged(){this._isVisible&&this._hoverComputerOptions&&(this._hoverOperation.cancel(),this._hoverOperation.start(0,this._hoverComputerOptions))}showsOrWillShow(e){let t=e.target;return t.type===2&&t.detail.glyphMarginLane?(this._startShowingAt(t.position.lineNumber,t.detail.glyphMarginLane),!0):t.type===3?(this._startShowingAt(t.position.lineNumber,"lineNo"),!0):!1}_startShowingAt(e,t){this._hoverComputerOptions&&this._hoverComputerOptions.lineNumber===e&&this._hoverComputerOptions.laneOrLine===t||(this._hoverOperation.cancel(),this.hide(),this._hoverComputerOptions={lineNumber:e,laneOrLine:t},this._hoverOperation.start(0,this._hoverComputerOptions))}hide(){this._hoverComputerOptions=void 0,this._hoverOperation.cancel(),this._isVisible&&(this._isVisible=!1,this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible))}_withResult(e){this._messages=e.value,this._messages.length>0?this._renderMessages(e.options.lineNumber,e.options.laneOrLine,this._messages):this.hide()}_renderMessages(e,t,o){this._renderDisposeables.clear();let n=document.createDocumentFragment();for(let r of o){let s=a6i("div.hover-row.markdown-hover"),l=R(s,a6i("div.hover-contents")),c=this._renderDisposeables.add(this._markdownRendererService.render(r.value,{context:this._editor}));l.appendChild(c.element),n.appendChild(s)}this._updateContents(n),this._showAt(e,t)}_updateContents(e){this._hover.contentsDomNode.textContent="",this._hover.contentsDomNode.appendChild(e),this._updateFont()}_showAt(e,t){this._isVisible||(this._isVisible=!0,this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible));let o=this._editor.getLayoutInfo(),n=this._editor.getTopForLineNumber(e),r=this._editor.getScrollTop(),s=this._editor.getOption(75),l=this._hover.containerDomNode.clientHeight,c=n-r-(l-s)/2,u=o.glyphMarginLeft+o.glyphMarginWidth+(t==="lineNo"?o.lineNumbersWidth:0),h=o.height-l,g=Math.max(0,Math.min(Math.round(c),h));if(this._editor.getOption(51)){let v=this._editor.getDomNode();if(v){let b=Yn(v);this._hover.containerDomNode.style.position="fixed",this._hover.containerDomNode.style.left=`${b.left+u}px`,this._hover.containerDomNode.style.top=`${b.top+g}px`}}else this._hover.containerDomNode.style.position="absolute",this._hover.containerDomNode.style.left=`${u}px`,this._hover.containerDomNode.style.top=`${g}px`;this._hover.containerDomNode.style.zIndex="11"}_onMouseLeave(e){let t=this._editor.getDomNode();(!t||!g7(t,e.x,e.y))&&this.hide()}};X7=I([m(1,Qn)],X7);var KCt=!1,Yg=class extends C{constructor(e,t){super();this._editor=e;this._instantiationService=t;this.shouldKeepOpenOnEditorMouseMoveOrLeave=!1;this._listenersStore=new P;this._hoverState={mouseDown:!1};this._reactToEditorMouseMoveRunner=this._register(new Dt(()=>this._reactToEditorMouseMove(this._mouseMoveEvent),0)),this._hookListeners(),this._register(this._editor.onDidChangeConfiguration(o=>{o.hasChanged(69)&&(this._unhookListeners(),this._hookListeners())}))}static{this.ID="editor.contrib.marginHover"}static get(e){return e.getContribution(Yg.ID)}_hookListeners(){let e=this._editor.getOption(69);this._hoverSettings={enabled:e.enabled,sticky:e.sticky,hidingDelay:e.hidingDelay},e.enabled!=="off"?(this._listenersStore.add(this._editor.onMouseDown(t=>this._onEditorMouseDown(t))),this._listenersStore.add(this._editor.onMouseUp(()=>this._onEditorMouseUp())),this._listenersStore.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._listenersStore.add(this._editor.onKeyDown(t=>this._onKeyDown(t)))):(this._listenersStore.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._listenersStore.add(this._editor.onKeyDown(t=>this._onKeyDown(t)))),this._listenersStore.add(this._editor.onMouseLeave(t=>this._onEditorMouseLeave(t))),this._listenersStore.add(this._editor.onDidChangeModel(()=>{this._cancelScheduler(),this.hideGlyphHover()})),this._listenersStore.add(this._editor.onDidChangeModelContent(()=>this._cancelScheduler())),this._listenersStore.add(this._editor.onDidScrollChange(t=>this._onEditorScrollChanged(t)))}_unhookListeners(){this._listenersStore.clear()}_cancelScheduler(){this._mouseMoveEvent=void 0,this._reactToEditorMouseMoveRunner.cancel()}_onEditorScrollChanged(e){(e.scrollTopChanged||e.scrollLeftChanged)&&this.hideGlyphHover()}_onEditorMouseDown(e){this._hoverState.mouseDown=!0,!this._isMouseOnGlyphHoverWidget(e)&&this.hideGlyphHover()}_isMouseOnGlyphHoverWidget(e){let t=this._glyphWidget?.getDomNode();return t?g7(t,e.event.posx,e.event.posy):!1}_onEditorMouseUp(){this._hoverState.mouseDown=!1}_onEditorMouseLeave(e){this.shouldKeepOpenOnEditorMouseMoveOrLeave||(this._cancelScheduler(),this._isMouseOnGlyphHoverWidget(e))||KCt||this.hideGlyphHover()}_shouldNotRecomputeCurrentHoverWidget(e){let t=this._hoverSettings.sticky,o=this._isMouseOnGlyphHoverWidget(e);return t&&o}_onEditorMouseMove(e){if(this.shouldKeepOpenOnEditorMouseMoveOrLeave)return;if(this._mouseMoveEvent=e,this._shouldNotRecomputeCurrentHoverWidget(e)){this._reactToEditorMouseMoveRunner.cancel();return}this._reactToEditorMouseMove(e)}_reactToEditorMouseMove(e){if(!e)return;if(!PIt(this._hoverSettings.enabled,this._editor.getOption(86),e)){if(KCt)return;this.hideGlyphHover();return}this._tryShowHoverWidget(e)||KCt||this.hideGlyphHover()}_tryShowHoverWidget(e){return this._getOrCreateGlyphWidget().showsOrWillShow(e)}_onKeyDown(e){if(this._editor.hasModel()){if(this._hoverSettings.enabled==="onKeyboardModifier"&&h5e(this._editor.getOption(86),e)&&this._mouseMoveEvent){this._tryShowHoverWidget(this._mouseMoveEvent);return}tN(e.keyCode)||this.hideGlyphHover()}}hideGlyphHover(){KCt||this._glyphWidget?.hide()}_getOrCreateGlyphWidget(){return this._glyphWidget||(this._glyphWidget=this._instantiationService.createInstance(X7,this._editor)),this._glyphWidget}dispose(){super.dispose(),this._unhookListeners(),this._listenersStore.dispose(),this._glyphWidget?.dispose()}};Yg=I([m(1,F)],Yg);var Nai;(e=>(e.increaseVerbosity=d(1259,null,`<keybinding:${x1}>`),e.decreaseVerbosity=d(1258,null,`<keybinding:${k1}>`)))(Nai||={});var GCt=class{constructor(){this.type="view";this.priority=95;this.name="hover";this.when=ue.hoverFocused}getProvider(i){let e=i.get(Kt),t=e.getActiveCodeEditor()||e.getFocusedCodeEditor();if(!t)throw new Error("No active or focused code editor");let o=kl.get(t);if(!o)return;let n=i.get(_e);return i.get(F).createInstance(Oai,n,t,o)}},$Ct=class{constructor(){this.priority=100;this.name="hover";this.type="help";this.when=ue.hoverVisible}getProvider(i){let e=i.get(Kt),t=e.getActiveCodeEditor()||e.getFocusedCodeEditor();if(!t)throw new Error("No active or focused code editor");let o=kl.get(t);if(o)return i.get(F).createInstance(jCt,o)}},qCt=class extends C{constructor(e){super();this._hoverController=e;this.id="hover";this.verbositySettingKey="accessibility.verbosity.hover";this._onDidChangeContent=this._register(new E);this.onDidChangeContent=this._onDidChangeContent.event;this._focusedHoverPartIndex=-1}onOpen(){this._hoverController&&(this._hoverController.shouldKeepOpenOnEditorMouseMoveOrLeave=!0,this._focusedHoverPartIndex=this._hoverController.focusedHoverPartIndex(),this._register(this._hoverController.onHoverContentsChanged(()=>{this._onDidChangeContent.fire()})))}onClose(){this._hoverController&&(this._focusedHoverPartIndex===-1?this._hoverController.focus():this._hoverController.focusHoverPartWithIndex(this._focusedHoverPartIndex),this._focusedHoverPartIndex=-1,this._hoverController.shouldKeepOpenOnEditorMouseMoveOrLeave=!1)}provideContentAtIndex(e,t){if(e!==-1){let o=this._hoverController.getAccessibleWidgetContentAtIndex(e);if(o===void 0)return"";let n=[];return t&&n.push(...this._descriptionsOfVerbosityActionsForIndex(e)),n.push(o),n.join(`
`)}else{let o=this._hoverController.getAccessibleWidgetContent();if(o===void 0)return"";let n=[];return n.push(o),n.join(`
`)}}_descriptionsOfVerbosityActionsForIndex(e){let t=[],o=this._descriptionOfVerbosityActionForIndex(0,e);o!==void 0&&t.push(o);let n=this._descriptionOfVerbosityActionForIndex(1,e);return n!==void 0&&t.push(n),t}_descriptionOfVerbosityActionForIndex(e,t){if(this._hoverController.doesHoverAtIndexSupportVerbosityAction(t,e))switch(e){case 0:return Nai.increaseVerbosity;case 1:return Nai.decreaseVerbosity}}},jCt=class extends qCt{constructor(e){super(e);this.options={type:"help"}}provideContent(){return this.provideContentAtIndex(this._focusedHoverPartIndex,!0)}},Oai=class extends qCt{constructor(e,t,o){super(o);this._keybindingService=e;this._editor=t;this.options={type:"view"};this._initializeOptions(this._editor,o)}provideContent(){return this.provideContentAtIndex(this._focusedHoverPartIndex,!1)}get actions(){let e=[];return e.push(this._getActionFor(this._editor,0)),e.push(this._getActionFor(this._editor,1)),e}_getActionFor(e,t){let o,n,r;switch(t){case 0:o=x1,n=b3i,r=M.add;break;case 1:o=k1,n=I3i,r=M.remove;break}let s=xoi(this._keybindingService,t),l=this._hoverController.doesHoverAtIndexSupportVerbosityAction(this._focusedHoverPartIndex,t);return new st(n,s,q.asClassName(r),l,()=>{e.getAction(o)?.run({index:this._focusedHoverPartIndex,focus:!1})})}_initializeOptions(e,t){let o=this._register(new jCt(t));this.options.language=e.getModel()?.getLanguageId(),this.options.customHelp=()=>o.provideContentAtIndex(this._focusedHoverPartIndex,!0)}},QCt=class{constructor(){this.type="view";this.priority=90;this.name="extension-hover"}getProvider(i){let t=i.get(_n).getContextViewElement(),o=t?.textContent??void 0,n=i.get(tt);if(!(t.classList.contains("accessible-view-container")||!o))return new tp("hover",{language:"typescript",type:"view"},()=>o,()=>{n.showAndFocusLastHover()},"accessibility.verbosity.hover")}};go(kl.ID,kl,2);go(Yg.ID,Yg,2);Jt(LCt);Jt(RCt);Jt(MCt);Jt(PCt);Jt(ACt);Jt(NCt);Jt(OCt);Jt(FCt);Jt(WCt);Jt(VCt);Jt(BCt);Jt(HCt);Jt(UCt);d_.register(P1);d_.register(eCe);qe.registerCommand(d5e,a=>{a.get(B).updateValue("editor.hover.showLongLineWarning",!1)});is((a,i)=>{let e=a.getColor(OU);e&&(i.addRule(`.monaco-editor .monaco-hover .hover-row:not(:first-child):not(:empty) { border-top: 1px solid ${e.transparent(.5)}; }`),i.addRule(`.monaco-editor .monaco-hover hr { border-top: 1px solid ${e.transparent(.5)}; }`),i.addRule(`.monaco-editor .monaco-hover hr { border-bottom: 0px solid ${e.transparent(.5)}; }`))});xa.register(new GCt);xa.register(new $Ct);xa.register(new QCt);function Fai(a,i,e,t){if(a.getLineCount()===1&&a.getLineMaxColumn(1)===1)return[];let o=i.getLanguageConfiguration(a.getLanguageId()).indentRulesSupport;if(!o)return[];let n=new lse(a,o,i);for(t=Math.min(t,a.getLineCount());e<=t&&n.shouldIgnore(e);)e++;if(e>t-1)return[];let{tabSize:r,indentSize:s,insertSpaces:l}=a.getOptions(),c=(v,b)=>(b=b||1,Xv.shiftIndent(v,v.length+b,r,s,l)),u=(v,b)=>(b=b||1,Xv.unshiftIndent(v,v.length+b,r,s,l)),p=[],h=a.getLineContent(e),g=bl(h),f=g;n.shouldIncrease(e)?(f=c(f),g=c(g)):n.shouldIndentNextLine(e)&&(f=c(f)),e++;for(let v=e;v<=t;v++){if(GBo(a,v))continue;let b=a.getLineContent(v),S=bl(b),y=f;n.shouldDecrease(v,y)&&(f=u(f),g=u(g)),S!==f&&p.push(An.replaceMove(new Yt(v,1,v,S.length+1),sSe(f,s,l))),!n.shouldIgnore(v)&&(n.shouldIncrease(v,y)?(g=c(g),f=g):n.shouldIndentNextLine(v,y)?f=c(f):f=g)}return p}function GBo(a,i){return a.tokenization.isCheapToTokenize(i)?a.tokenization.getLineTokens(i).getStandardTokenType(0)===2:!1}var r3e=class a extends xi{static{this.ID="editor.action.indentationToSpaces"}constructor(){super({id:a.ID,label:L(1310,"Convert Indentation to Spaces"),precondition:ue.writable,metadata:{description:L(1311,"Convert the tab indentation to spaces.")}})}run(i,e){let t=e.getModel();if(!t)return;let o=t.getOptions(),n=e.getSelection();if(!n)return;let r=new Hai(n,o.tabSize);e.pushUndoStop(),e.executeCommands(this.id,[r]),e.pushUndoStop(),t.updateOptions({insertSpaces:!0})}},s3e=class a extends xi{static{this.ID="editor.action.indentationToTabs"}constructor(){super({id:a.ID,label:L(1312,"Convert Indentation to Tabs"),precondition:ue.writable,metadata:{description:L(1313,"Convert the spaces indentation to tabs.")}})}run(i,e){let t=e.getModel();if(!t)return;let o=t.getOptions(),n=e.getSelection();if(!n)return;let r=new Uai(n,o.tabSize);e.pushUndoStop(),e.executeCommands(this.id,[r]),e.pushUndoStop(),t.updateOptions({insertSpaces:!1})}},a3e=class extends xi{constructor(e,t,o){super(o);this.insertSpaces=e;this.displaySizeOnly=t}run(e,t){let o=e.get(Ge),n=e.get(Ct),r=t.getModel();if(!r)return;let s=n.getCreationOptions(r.getLanguageId(),r.uri,r.isForSimpleWidget),l=r.getOptions(),c=[1,2,3,4,5,6,7,8].map(p=>({id:p.toString(),label:p.toString(),description:p===s.tabSize&&p===l.tabSize?d(1301,null):p===s.tabSize?d(1303,null):p===l.tabSize?d(1302,null):void 0})),u=Math.min(r.getOptions().tabSize-1,7);setTimeout(()=>{o.pick(c,{placeHolder:d(1318,null),activeItem:c[u]}).then(p=>{if(p&&r&&!r.isDisposed()){let h=parseInt(p.label,10);this.displaySizeOnly?r.updateOptions({tabSize:h}):r.updateOptions({tabSize:h,indentSize:h,insertSpaces:this.insertSpaces})}})},50)}},l3e=class a extends a3e{static{this.ID="editor.action.indentUsingTabs"}constructor(){super(!1,!1,{id:a.ID,label:L(1316,"Indent Using Tabs"),precondition:void 0,metadata:{description:L(1317,"Use indentation with tabs.")}})}},c3e=class a extends a3e{static{this.ID="editor.action.indentUsingSpaces"}constructor(){super(!0,!1,{id:a.ID,label:L(1314,"Indent Using Spaces"),precondition:void 0,metadata:{description:L(1315,"Use indentation with spaces.")}})}},d3e=class a extends a3e{static{this.ID="editor.action.changeTabDisplaySize"}constructor(){super(!0,!0,{id:a.ID,label:L(1299,"Change Tab Display Size"),precondition:void 0,metadata:{description:L(1300,"Change the space size equivalent of the tab.")}})}},u3e=class a extends xi{static{this.ID="editor.action.detectIndentation"}constructor(){super({id:a.ID,label:L(1304,"Detect Indentation from Content"),precondition:void 0,metadata:{description:L(1305,"Detect the indentation from content.")}})}run(i,e){let t=i.get(Ct),o=e.getModel();if(!o)return;let n=t.getCreationOptions(o.getLanguageId(),o.uri,o.isForSimpleWidget);o.detectIndentation(n.insertSpaces,n.tabSize)}},Wai=class extends xi{constructor(){super({id:"editor.action.reindentlines",label:L(1306,"Reindent Lines"),precondition:ue.writable,metadata:{description:L(1307,"Reindent the lines of the editor.")},canTriggerInlineEdits:!0})}run(i,e){let t=i.get(bs),o=e.getModel();if(!o)return;let n=Fai(o,t,1,o.getLineCount());n.length>0&&(e.pushUndoStop(),e.executeEdits(this.id,n),e.pushUndoStop())}},Vai=class extends xi{constructor(){super({id:"editor.action.reindentselectedlines",label:L(1308,"Reindent Selected Lines"),precondition:ue.writable,metadata:{description:L(1309,"Reindent the selected lines of the editor.")},canTriggerInlineEdits:!0})}run(i,e){let t=i.get(bs),o=e.getModel();if(!o)return;let n=e.getSelections();if(n===null)return;let r=[];for(let s of n){let l=s.startLineNumber,c=s.endLineNumber;if(l!==c&&s.endColumn===1&&c--,l===1){if(l===c)continue}else l--;let u=Fai(o,t,l,c);r.push(...u)}r.length>0&&(e.pushUndoStop(),e.executeEdits(this.id,r),e.pushUndoStop())}},Bai=class{constructor(i,e){this._initialSelection=e,this._edits=[],this._selectionId=null;for(let t of i)t.range&&typeof t.text=="string"&&this._edits.push(t)}getEditOperations(i,e){for(let o of this._edits)e.addEditOperation(z.lift(o.range),o.text);let t=!1;Array.isArray(this._edits)&&this._edits.length===1&&this._initialSelection.isEmpty()&&(this._edits[0].range.startColumn===this._initialSelection.endColumn&&this._edits[0].range.startLineNumber===this._initialSelection.endLineNumber?(t=!0,this._selectionId=e.trackSelection(this._initialSelection,!0)):this._edits[0].range.endColumn===this._initialSelection.startColumn&&this._edits[0].range.endLineNumber===this._initialSelection.startLineNumber&&(t=!0,this._selectionId=e.trackSelection(this._initialSelection,!1))),t||(this._selectionId=e.trackSelection(this._initialSelection))}computeCursorState(i,e){return e.getTrackedSelection(this._selectionId)}},QCe=class{constructor(i,e){this.editor=i;this._languageConfigurationService=e;this.callOnDispose=new P;this.callOnModel=new P;this.callOnDispose.add(i.onDidChangeConfiguration(()=>this.update())),this.callOnDispose.add(i.onDidChangeModel(()=>this.update())),this.callOnDispose.add(i.onDidChangeModelLanguage(()=>this.update()))}static{this.ID="editor.contrib.autoIndentOnPaste"}update(){this.callOnModel.clear(),!(!this.editor.getOption(17)||this.editor.getOption(16)<4)&&this.editor.hasModel()&&this.callOnModel.add(this.editor.onDidPaste(({range:i})=>{this.trigger(i)}))}trigger(i){let e=this.editor.getSelections();if(e===null||e.length>1)return;let t=this.editor.getModel();if(!t||this.rangeContainsOnlyWhitespaceCharacters(t,i)||!this.editor.getOption(18)&&$Bo(t,i)||!t.tokenization.isCheapToTokenize(i.getStartPosition().lineNumber))return;let n=this.editor.getOption(16),{tabSize:r,indentSize:s,insertSpaces:l}=t.getOptions(),c=[],u={shiftIndent:f=>Xv.shiftIndent(f,f.length+1,r,s,l),unshiftIndent:f=>Xv.unshiftIndent(f,f.length+1,r,s,l)},p=i.startLineNumber,h=t.getLineContent(p);if(!/\S/.test(h.substring(0,i.startColumn-1))){let f=use(n,t,t.getLanguageId(),p,u,this._languageConfigurationService);if(f!==null){let v=bl(h),b=Ax(f,r),S=Ax(v,r);if(b!==S){let y=Ile(b,r,l);c.push({range:new z(p,1,p,v.length+1),text:y}),h=y+h.substring(v.length)}else{let y=nht(t,p,this._languageConfigurationService);if(y===0||y===8)return}}}let g=p;for(;p<i.endLineNumber;){if(!/\S/.test(t.getLineContent(p+1))){p++;continue}break}if(p!==i.endLineNumber){let v=use(n,{tokenization:{getLineTokens:b=>t.tokenization.getLineTokens(b),getLanguageId:()=>t.getLanguageId(),getLanguageIdAtPosition:(b,S)=>t.getLanguageIdAtPosition(b,S)},getLineContent:b=>b===g?h:t.getLineContent(b)},t.getLanguageId(),p+1,u,this._languageConfigurationService);if(v!==null){let b=Ax(v,r),S=Ax(bl(t.getLineContent(p+1)),r);if(b!==S){let y=b-S;for(let w=p+1;w<=i.endLineNumber;w++){let k=t.getLineContent(w),T=bl(k),O=Ax(T,r)+y,V=Ile(O,r,l);V!==T&&c.push({range:new z(w,1,w,T.length+1),text:V})}}}}if(c.length>0){this.editor.pushUndoStop();let f=new Bai(c,this.editor.getSelection());this.editor.executeCommand("autoIndentOnPaste",f),this.editor.pushUndoStop()}}rangeContainsOnlyWhitespaceCharacters(i,e){let t=n=>n.trim().length===0,o=!0;if(e.startLineNumber===e.endLineNumber){let r=i.getLineContent(e.startLineNumber).substring(e.startColumn-1,e.endColumn-1);o=t(r)}else for(let n=e.startLineNumber;n<=e.endLineNumber;n++){let r=i.getLineContent(n);if(n===e.startLineNumber){let s=r.substring(e.startColumn-1);o=t(s)}else if(n===e.endLineNumber){let s=r.substring(0,e.endColumn-1);o=t(s)}else o=i.getLineFirstNonWhitespaceColumn(n)===0;if(!o)break}return o}dispose(){this.callOnDispose.dispose(),this.callOnModel.dispose()}};QCe=I([m(1,bs)],QCe);function $Bo(a,i){let e=t=>BKi(a,t)===2;return e(i.getStartPosition())||e(i.getEndPosition())}function l6i(a,i,e,t){if(a.getLineCount()===1&&a.getLineMaxColumn(1)===1)return;let o="";for(let r=0;r<e;r++)o+=" ";let n=new RegExp(o,"gi");for(let r=1,s=a.getLineCount();r<=s;r++){let l=a.getLineFirstNonWhitespaceColumn(r);if(l===0&&(l=a.getLineMaxColumn(r)),l===1)continue;let c=new z(r,1,r,l),u=a.getValueInRange(c),p=t?u.replace(/\t/ig,o):u.replace(n," ");i.addEditOperation(c,p)}}var Hai=class{constructor(i,e){this.selection=i;this.tabSize=e;this.selectionId=null}getEditOperations(i,e){this.selectionId=e.trackSelection(this.selection),l6i(i,e,this.tabSize,!0)}computeCursorState(i,e){return e.getTrackedSelection(this.selectionId)}},Uai=class{constructor(i,e){this.selection=i;this.tabSize=e;this.selectionId=null}getEditOperations(i,e){this.selectionId=e.trackSelection(this.selection),l6i(i,e,this.tabSize,!1)}computeCursorState(i,e){return e.getTrackedSelection(this.selectionId)}};go(QCe.ID,QCe,2);Jt(r3e);Jt(s3e);Jt(l3e);Jt(c3e);Jt(d3e);Jt(u3e);Jt(Wai);Jt(Vai);go(wE.ID,wE,1);d_.register(_7);var YCt=class{constructor(i,e,t){this._editRange=i,this._originalSelection=e,this._text=t}getEditOperations(i,e){e.addTrackedEditOperation(this._editRange,this._text)}computeCursorState(i,e){let o=e.getInverseEditOperations()[0].range;return this._originalSelection.isEmpty()?new Yt(o.endLineNumber,Math.min(this._originalSelection.positionColumn,o.endColumn),o.endLineNumber,Math.min(this._originalSelection.positionColumn,o.endColumn)):new Yt(o.endLineNumber,o.endColumn-this._text.length,o.endLineNumber,o.endColumn)}};var zW=class{static{this.ID="editor.contrib.inPlaceReplaceController"}static get(i){return i.getContribution(zW.ID)}static{this.DECORATION=po.register({description:"in-place-replace",className:"valueSetReplacement"})}constructor(i,e){this.editor=i,this.editorWorkerService=e,this.decorations=this.editor.createDecorationsCollection()}dispose(){}run(i,e){this.currentRequest?.cancel();let t=this.editor.getSelection(),o=this.editor.getModel();if(!o||!t)return;let n=t;if(n.startLineNumber!==n.endLineNumber)return;let r=new y1(this.editor,5),s=o.uri;return this.editorWorkerService.canNavigateValueSet(s)?(this.currentRequest=xn(l=>this.editorWorkerService.navigateValueSet(s,n,e)),this.currentRequest.then(l=>{if(!l||!l.range||!l.value||!r.validate(this.editor))return;let c=z.lift(l.range),u=l.range,p=l.value.length-(n.endColumn-n.startColumn);u={startLineNumber:u.startLineNumber,startColumn:u.startColumn,endLineNumber:u.endLineNumber,endColumn:u.startColumn+l.value.length},p>1&&(n=new Yt(n.startLineNumber,n.startColumn,n.endLineNumber,n.endColumn+p-1));let h=new YCt(c,n,l.value);this.editor.pushUndoStop(),this.editor.executeCommand(i,h),this.editor.pushUndoStop(),this.decorations.set([{range:u,options:zW.DECORATION}]),this.decorationRemover?.cancel(),this.decorationRemover=Pi(350),this.decorationRemover.then(()=>this.decorations.clear()).catch(mt)}).catch(mt)):Promise.resolve(void 0)}};zW=I([m(1,$s)],zW);var zai=class extends xi{constructor(){super({id:"editor.action.inPlaceReplace.up",label:L(1399,"Replace with Previous Value"),precondition:ue.writable,kbOpts:{kbExpr:ue.editorTextFocus,primary:3159,weight:100}})}run(i,e){let t=zW.get(e);return t?t.run(this.id,!1):Promise.resolve(void 0)}},Kai=class extends xi{constructor(){super({id:"editor.action.inPlaceReplace.down",label:L(1398,"Replace with Next Value"),precondition:ue.writable,kbOpts:{kbExpr:ue.editorTextFocus,primary:3161,weight:100}})}run(i,e){let t=zW.get(e);return t?t.run(this.id,!0):Promise.resolve(void 0)}};go(zW.ID,zW,4);Jt(zai);Jt(Kai);var XCt=class{constructor(i){this._selection=i,this._selectionId=null}getEditOperations(i,e){let t=qBo(i);t&&e.addEditOperation(t.range,t.text),this._selectionId=e.trackSelection(this._selection)}computeCursorState(i,e){return e.getTrackedSelection(this._selectionId)}};function qBo(a){let i=a.getLineCount(),e=a.getLineContent(i),t=tv(e)===-1;if(!(!i||t))return An.insert(new Ie(i,a.getLineMaxColumn(i)),a.getEOL())}var Gai=class a extends xi{static{this.ID="editor.action.insertFinalNewLine"}constructor(){super({id:a.ID,label:L(1400,"Insert Final New Line"),precondition:ue.writable})}run(i,e,t){let o=e.getSelection();if(o===null)return;let n=new XCt(o);e.pushUndoStop(),e.executeCommands(this.id,[n]),e.pushUndoStop()}};Jt(Gai);var $ai=class extends xi{constructor(){super({id:"expandLineSelection",label:L(1401,"Expand Line Selection"),precondition:void 0,kbOpts:{weight:0,kbExpr:ue.textInputFocus,primary:2090}})}run(i,e,t){if(t=t||{},!e.hasModel())return;let o=e._getViewModel();o.model.pushStackElement(),o.setCursorStates(t.source,3,Wg.expandLineSelection(o,o.getCursorStates())),o.revealAllCursors(t.source,!0)}};Jt($ai);var c6i=new Q("LinkedEditingInputVisible",!1),jBo="linked-editing-decoration",KW=class extends C{constructor(e,t,o,n,r){super();this.languageConfigurationService=n;this._syncRangesToken=0;this._localToDispose=this._register(new P);this._editor=e,this._providers=o.linkedEditingRangeProvider,this._enabled=!1,this._visibleContextKey=c6i.bindTo(t),this._debounceInformation=r.for(this._providers,"Linked Editing",{max:200}),this._currentDecorations=this._editor.createDecorationsCollection(),this._languageWordPattern=null,this._currentWordPattern=null,this._ignoreChangeEvent=!1,this._localToDispose=this._register(new P),this._rangeUpdateTriggerPromise=null,this._rangeSyncTriggerPromise=null,this._currentRequestCts=null,this._currentRequestPosition=null,this._currentRequestModelVersion=null,this._register(this._editor.onDidChangeModel(()=>this.reinitialize(!0))),this._register(this._editor.onDidChangeConfiguration(s=>{(s.hasChanged(78)||s.hasChanged(106))&&this.reinitialize(!1)})),this._register(this._providers.onDidChange(()=>this.reinitialize(!1))),this._register(this._editor.onDidChangeModelLanguage(()=>this.reinitialize(!0))),this.reinitialize(!0)}static{this.ID="editor.contrib.linkedEditing"}static{this.DECORATION=po.register({description:"linked-editing",stickiness:0,className:jBo})}static get(e){return e.getContribution(KW.ID)}reinitialize(e){let t=this._editor.getModel(),o=t!==null&&(this._editor.getOption(78)||this._editor.getOption(106))&&this._providers.has(t);if(o===this._enabled&&!e||(this._enabled=o,this.clearRanges(),this._localToDispose.clear(),!o||t===null))return;this._localToDispose.add(H.runAndSubscribe(t.onDidChangeLanguageConfiguration,()=>{this._languageWordPattern=this.languageConfigurationService.getLanguageConfiguration(t.getLanguageId()).getWordDefinition()}));let n=new jo(this._debounceInformation.get(t)),r=()=>{this._rangeUpdateTriggerPromise=n.trigger(()=>this.updateRanges(),this._debounceDuration??this._debounceInformation.get(t))},s=new jo(0),l=c=>{this._rangeSyncTriggerPromise=s.trigger(()=>this._syncRanges(c))};this._localToDispose.add(this._editor.onDidChangeCursorPosition(()=>{r()})),this._localToDispose.add(this._editor.onDidChangeModelContent(c=>{if(!this._ignoreChangeEvent&&this._currentDecorations.length>0){let u=this._currentDecorations.getRange(0);if(u&&c.changes.every(p=>u.intersectRanges(p.range))){l(this._syncRangesToken);return}}r()})),this._localToDispose.add({dispose:()=>{n.dispose(),s.dispose()}}),this.updateRanges()}_syncRanges(e){if(!this._editor.hasModel()||e!==this._syncRangesToken||this._currentDecorations.length===0)return;let t=this._editor.getModel(),o=this._currentDecorations.getRange(0);if(!o||o.startLineNumber!==o.endLineNumber)return this.clearRanges();let n=t.getValueInRange(o);if(this._currentWordPattern){let s=n.match(this._currentWordPattern);if((s?s[0].length:0)!==n.length)return this.clearRanges()}let r=[];for(let s=1,l=this._currentDecorations.length;s<l;s++){let c=this._currentDecorations.getRange(s);if(c)if(c.startLineNumber!==c.endLineNumber)r.push({range:c,text:n});else{let u=t.getValueInRange(c),p=n,h=c.startColumn,g=c.endColumn,f=Ng(u,p);h+=f,u=u.substr(f),p=p.substr(f);let v=zw(u,p);g-=v,u=u.substr(0,u.length-v),p=p.substr(0,p.length-v),(h!==g||p.length!==0)&&r.push({range:new z(c.startLineNumber,h,c.endLineNumber,g),text:p})}}if(r.length!==0)try{this._editor.popUndoStop(),this._ignoreChangeEvent=!0;let s=this._editor._getViewModel().getPrevEditOperationType();this._editor.executeEdits("linkedEditing",r),this._editor._getViewModel().setPrevEditOperationType(s)}finally{this._ignoreChangeEvent=!1}}dispose(){this.clearRanges(),super.dispose()}clearRanges(){this._visibleContextKey.set(!1),this._currentDecorations.clear(),this._currentRequestCts&&(this._currentRequestCts.cancel(),this._currentRequestCts=null,this._currentRequestPosition=null)}get currentUpdateTriggerPromise(){return this._rangeUpdateTriggerPromise||Promise.resolve()}get currentSyncTriggerPromise(){return this._rangeSyncTriggerPromise||Promise.resolve()}async updateRanges(e=!1){if(!this._editor.hasModel()){this.clearRanges();return}let t=this._editor.getPosition();if(!this._enabled&&!e||this._editor.getSelections().length>1){this.clearRanges();return}let o=this._editor.getModel(),n=o.getVersionId();if(this._currentRequestPosition&&this._currentRequestModelVersion===n){if(t.equals(this._currentRequestPosition))return;if(this._currentDecorations.length>0){let s=this._currentDecorations.getRange(0);if(s&&s.containsPosition(t))return}}this._currentRequestPosition?.equals(t)||this._currentDecorations.getRange(0)?.containsPosition(t)||this.clearRanges(),this._currentRequestPosition=t,this._currentRequestModelVersion=n;let r=this._currentRequestCts=new $e;try{let s=new En(!1),l=await d6i(this._providers,o,t,r.token);if(this._debounceInformation.update(o,s.elapsed()),r!==this._currentRequestCts||(this._currentRequestCts=null,n!==o.getVersionId()))return;let c=[];l?.ranges&&(c=l.ranges),this._currentWordPattern=l?.wordPattern||this._languageWordPattern;let u=!1;for(let h=0,g=c.length;h<g;h++)if(z.containsPosition(c[h],t)){if(u=!0,h!==0){let f=c[h];c.splice(h,1),c.unshift(f)}break}if(!u){this.clearRanges();return}let p=c.map(h=>({range:h,options:KW.DECORATION}));this._visibleContextKey.set(!0),this._currentDecorations.set(p),this._syncRangesToken++}catch(s){so(s)||mt(s),(this._currentRequestCts===r||!this._currentRequestCts)&&this.clearRanges()}}setDebounceDuration(e){this._debounceDuration=e}};KW=I([m(1,X),m(2,zt),m(3,bs),m(4,jg)],KW);var qai=class extends xi{constructor(){super({id:"editor.action.linkedEditing",label:L(1434,"Start Linked Editing"),precondition:x.and(ue.writable,ue.hasRenameProvider),kbOpts:{kbExpr:ue.editorTextFocus,primary:3132,weight:100}})}runCommand(i,e){let t=i.get(Kt),[o,n]=Array.isArray(e)&&e||[void 0,void 0];return A.isUri(o)&&Ie.isIPosition(n)?t.openCodeEditor({resource:o},t.getActiveCodeEditor()).then(r=>{r&&(r.setPosition(n),r.invokeWithinContext(s=>(this.reportTelemetry(s,r),this.run(s,r))))},mt):super.runCommand(i,e)}run(i,e){let t=KW.get(e);return t?Promise.resolve(t.updateRanges(!0)):Promise.resolve()}},QBo=xc.bindToContribution(KW.get);qi(new QBo({id:"cancelLinkedEditingInput",precondition:c6i,handler:a=>a.clearRanges(),kbOpts:{kbExpr:ue.editorTextFocus,weight:199,primary:9,secondary:[1033]}}));function d6i(a,i,e,t){let o=a.ordered(i);return Lre(o.map(n=>async()=>{try{return await n.provideLinkedEditingRanges(i,e,t)}catch(r){ss(r);return}}),n=>!!n&&dr(n?.ranges))}var NBs=J("editor.linkedEditingBackground",{dark:Oe.fromHex("#f00").transparent(.3),light:Oe.fromHex("#f00").transparent(.3),hcDark:Oe.fromHex("#f00").transparent(.3),hcLight:Oe.white},d(1433,null));kS("_executeLinkedEditingProvider",(a,i,e)=>{let{linkedEditingRangeProvider:t}=a.get(zt);return d6i(t,i,e,ve.None)});go(KW.ID,KW,1);Jt(qai);var jai=class{constructor(i,e){this._link=i,this._provider=e}toJSON(){return{range:this.range,url:this.url,tooltip:this.tooltip}}get range(){return this._link.range}get url(){return this._link.url}get tooltip(){return this._link.tooltip}async resolve(i){return this._link.url?this._link.url:typeof this._provider.resolveLink=="function"?Promise.resolve(this._provider.resolveLink(this._link,i)).then(e=>(this._link=e||this._link,this._link.url?this.resolve(i):Promise.reject(new Error("missing")))):Promise.reject(new Error("missing"))}},JCt=class a{constructor(i){this._disposables=new P;let e=[];for(let[t,o]of i){let n=t.links.map(r=>new jai(r,o));e=a._union(e,n),Ac(t)&&(this._disposables??=new P,this._disposables.add(t))}this.links=e}static{this.Empty=new a([])}dispose(){this._disposables?.dispose(),this.links.length=0}static _union(i,e){let t=[],o,n,r,s;for(o=0,r=0,n=i.length,s=e.length;o<n&&r<s;){let l=i[o],c=e[r];if(z.areIntersectingOrTouching(l.range,c.range)){o++;continue}z.compareRangesUsingStarts(l.range,c.range)<0?(t.push(l),o++):(t.push(c),r++)}for(;o<n;o++)t.push(i[o]);for(;r<s;r++)t.push(e[r]);return t}};async function Qai(a,i,e){let t=[],o=a.ordered(i).reverse().map(async(r,s)=>{try{let l=await r.provideLinks(i,e);l&&(t[s]=[l,r])}catch(l){ss(l)}});await Promise.all(o);let n=new JCt(si(t));return e.isCancellationRequested&&(n.dispose(),n=JCt.Empty),n}qe.registerCommand("_executeLinkProvider",async(a,...i)=>{let[e,t]=i;So(e instanceof A),typeof t!="number"&&(t=0);let{linkProvider:o}=a.get(zt),n=a.get(Ct).getModel(e);if(!n)return[];let r=await Qai(o,n,ve.None);if(!r)return[];for(let l=0;l<Math.min(t,r.links.length);l++)await r.links[l].resolve(ve.None);let s=r.links.slice(0);return r.dispose(),s});var Fx=class extends C{constructor(e,t,o,n,r){super();this.editor=e;this.openerService=t;this.notificationService=o;this.languageFeaturesService=n;this.providers=this.languageFeaturesService.linkProvider,this.debounceInformation=r.for(this.providers,"Links",{min:1e3,max:4e3}),this.computeLinks=this._register(new Dt(()=>this.computeLinksNow(),1e3)),this.computePromise=null,this.activeLinksList=null,this.currentOccurrences={},this.activeLinkDecorationId=null;let s=this._register(new sO(e));this._register(s.onMouseMoveOrRelevantKeyDown(([l,c])=>{this._onEditorMouseMove(l,c)})),this._register(s.onExecute(l=>{this.onEditorMouseUp(l)})),this._register(s.onCancel(l=>{this.cleanUpActiveLinkDecoration()})),this._register(e.onDidChangeConfiguration(l=>{l.hasChanged(79)&&(this.updateDecorations([]),this.stop(),this.computeLinks.schedule(0))})),this._register(e.onDidChangeModelContent(l=>{this.editor.hasModel()&&this.computeLinks.schedule(this.debounceInformation.get(this.editor.getModel()))})),this._register(e.onDidChangeModel(l=>{this.currentOccurrences={},this.activeLinkDecorationId=null,this.stop(),this.computeLinks.schedule(0)})),this._register(e.onDidChangeModelLanguage(l=>{this.stop(),this.computeLinks.schedule(0)})),this._register(this.providers.onDidChange(l=>{this.stop(),this.computeLinks.schedule(0)})),this.computeLinks.schedule(0)}static{this.ID="editor.linkDetector"}static get(e){return e.getContribution(Fx.ID)}async computeLinksNow(){if(!this.editor.hasModel()||!this.editor.getOption(79))return;let e=this.editor.getModel();if(!e.isTooLargeForSyncing()&&this.providers.has(e)){this.activeLinksList&&(this.activeLinksList.dispose(),this.activeLinksList=null),this.computePromise=xn(t=>Qai(this.providers,e,t));try{let t=new En(!1);if(this.activeLinksList=await this.computePromise,this.debounceInformation.update(e,t.elapsed()),e.isDisposed())return;this.updateDecorations(this.activeLinksList.links)}catch(t){mt(t)}finally{this.computePromise=null}}}updateDecorations(e){let t=this.editor.getOption(86)==="altKey",o=[],n=Object.keys(this.currentOccurrences);for(let s of n){let l=this.currentOccurrences[s];o.push(l.decorationId)}let r=[];if(e)for(let s of e)r.push(ZCt.decoration(s,t));this.editor.changeDecorations(s=>{let l=s.deltaDecorations(o,r);this.currentOccurrences={},this.activeLinkDecorationId=null;for(let c=0,u=l.length;c<u;c++){let p=new ZCt(e[c],l[c]);this.currentOccurrences[p.decorationId]=p}})}_onEditorMouseMove(e,t){let o=this.editor.getOption(86)==="altKey";if(this.isEnabled(e,t)){this.cleanUpActiveLinkDecoration();let n=this.getLinkOccurrence(e.target.position);n&&this.editor.changeDecorations(r=>{n.activate(r,o),this.activeLinkDecorationId=n.decorationId})}else this.cleanUpActiveLinkDecoration()}cleanUpActiveLinkDecoration(){let e=this.editor.getOption(86)==="altKey";if(this.activeLinkDecorationId){let t=this.currentOccurrences[this.activeLinkDecorationId];t&&this.editor.changeDecorations(o=>{t.deactivate(o,e)}),this.activeLinkDecorationId=null}}onEditorMouseUp(e){if(!this.isEnabled(e))return;let t=this.getLinkOccurrence(e.target.position);t&&this.openLinkOccurrence(t,e.hasSideBySideModifier,!0)}openLinkOccurrence(e,t,o=!1){if(!this.openerService)return;let{link:n}=e;n.resolve(ve.None).then(r=>{if(typeof r=="string"&&this.editor.hasModel()){let s=this.editor.getModel().uri;if(s.scheme===Y.file&&r.startsWith(`${Y.file}:`)){let l=A.parse(r);if(l.scheme===Y.file){let c=q0(l),u=null;c.startsWith("/./")||c.startsWith("\\.\\")?u=`.${c.substr(1)}`:(c.startsWith("//./")||c.startsWith("\\\\.\\"))&&(u=`.${c.substr(2)}`),u&&(r=je(s,u))}}}return this.openerService.open(r,{openToSide:t,fromUserGesture:o,allowContributedOpeners:!0,allowCommands:!0,fromWorkspace:!0})},r=>{let s=r instanceof Error?r.message:r;s==="invalid"?this.notificationService.warn(d(1435,null,n.url.toString())):s==="missing"?this.notificationService.warn(d(1443,null)):mt(r)})}getLinkOccurrence(e){if(!this.editor.hasModel()||!e)return null;let t=this.editor.getModel().getDecorationsInRange({startLineNumber:e.lineNumber,startColumn:e.column,endLineNumber:e.lineNumber,endColumn:e.column},0,!0);for(let o of t){let n=this.currentOccurrences[o.id];if(n)return n}return null}isEnabled(e,t){return!!(e.target.type===6&&(e.hasTriggerModifier||t&&t.keyCodeIsTriggerKey||e.isMiddleClick&&e.mouseMiddleClickAction==="openLink"))}stop(){this.computeLinks.cancel(),this.activeLinksList&&(this.activeLinksList?.dispose(),this.activeLinksList=null),this.computePromise&&(this.computePromise.cancel(),this.computePromise=null)}dispose(){super.dispose(),this.stop()}};Fx=I([m(1,Qe),m(2,Ne),m(3,zt),m(4,jg)],Fx);var u6i={general:po.register({description:"detected-link",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link"}),active:po.register({description:"detected-link-active",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link-active"})},ZCt=class a{static decoration(i,e){return{range:i.range,options:a._getOptions(i,e,!1)}}static _getOptions(i,e,t){let o={...t?u6i.active:u6i.general};return o.hoverMessage=YBo(i,e),o}constructor(i,e){this.link=i,this.decorationId=e}activate(i,e){i.changeDecorationOptions(this.decorationId,a._getOptions(this.link,e,!0))}deactivate(i,e){i.changeDecorationOptions(this.decorationId,a._getOptions(this.link,e,!1))}};function YBo(a,i){let e=a.url&&/^command:/i.test(a.url.toString()),t=a.tooltip?a.tooltip:e?d(1437,null):d(1438,null),o=i?it?d(1442,null):d(1441,null):it?d(1440,null):d(1439,null);if(a.url){let n="";if(/^command:/i.test(a.url.toString())){let s=a.url.toString().match(/^command:([^?#]+)/);if(s){let l=s[1];n=d(1444,null,l)}}return new xe("",!0).appendLink(a.url.toString(!0).replace(/ /g,"%20"),t,n).appendMarkdown(` (${o})`)}else return new xe().appendText(`${t} (${o})`)}var Yai=class extends xi{constructor(){super({id:"editor.action.openLink",label:L(1436,"Open Link"),precondition:void 0})}run(i,e){let t=Fx.get(e);if(!t||!e.hasModel())return;let o=e.getSelections();for(let n of o){let r=t.getLinkOccurrence(n.getEndPosition());r&&t.openLinkOccurrence(r,!1)}}};go(Fx.ID,Fx,1);Jt(Yai);var ext=class a extends C{constructor(e){super();this._editor=e;this._register(this._editor.onMouseDown(t=>{let o=this._editor.getOption(133);o>=0&&t.target.type===6&&t.target.position.column>=o&&this._editor.updateOptions({stopRenderingLineAfter:-1})}))}static{this.ID="editor.contrib.longLinesHelper"}static get(e){return e.getContribution(a.ID)}};go(ext.ID,ext,2);var p3e=class a extends C{constructor(e){super();this._editor=e;let t=os(this._editor),o=t.getOption(171);this._register(he(n=>{if(!o.read(n))return;let r=t.domNode.read(n);if(!r)return;let s=n.store.add(X0("scrollingSession",void 0));n.store.add(this._editor.onMouseDown(c=>{if(s.read(void 0)){s.set(void 0,void 0);return}if(!c.event.middleButton)return;c.event.stopPropagation(),c.event.preventDefault();let p=new P,h=new Uh(c.event.posx,c.event.posy),f=XBo(Me(r),h,p).map(S=>S.subtract(h).withThreshold(5)),v=r.getBoundingClientRect(),b=new Uh(h.x-v.left,h.y-v.top);s.set({mouseDeltaAfterThreshold:f,initialMousePosInEditor:b,didScroll:!1,dispose:()=>p.dispose()},void 0),p.add(this._editor.onMouseUp(S=>{let y=s.read(void 0);y&&y.didScroll&&s.set(void 0,void 0)})),p.add(this._editor.onKeyDown(S=>{s.set(void 0,void 0)}))})),n.store.add(he(c=>{let u=s.read(c);if(!u)return;let p=Date.now();c.store.add(he(g=>{P4e.instance.invalidateOnNextAnimationFrame(g);let f=Date.now(),v=f-p;p=f;let b=u.mouseDeltaAfterThreshold.read(void 0),S=v/32,y=b.scale(S),w=new Uh(this._editor.getScrollLeft(),this._editor.getScrollTop());this._editor.setScrollPosition(JBo(w.add(y))),y.isZero()||(u.didScroll=!0)}));let h=Ce(g=>{let f=u.mouseDeltaAfterThreshold.read(g),v="";return v+=f.y<0?"n":f.y>0?"s":"",v+=f.x<0?"w":f.x>0?"e":"",v});c.store.add(he(g=>{r.setAttribute("data-scroll-direction",h.read(g))}))}));let l=n.store.add(Mo.div({class:["scroll-editor-on-middle-click-dot",s.map(c=>c?"":"hidden")],style:{left:s.map(c=>c?c.initialMousePosInEditor.x:0),top:s.map(c=>c?c.initialMousePosInEditor.y:0)}}).toDisposableLiveElement());n.store.add(wq(r,l.element)),n.store.add(he(c=>{let u=s.read(c);r.classList.toggle("scroll-editor-on-middle-click-editor",!!u)}))}))}static{this.ID="editor.contrib.middleScroll"}static get(e){return e.getContribution(a.ID)}};function XBo(a,i,e){let t=Le("pos",i);return e.add(j(a,"mousemove",o=>{t.set(new Uh(o.pageX,o.pageY),void 0)})),t}function JBo(a){return{scrollLeft:a.x,scrollTop:a.y}}go(p3e.ID,p3e,2);var eHo=J("editor.wordHighlightBackground",{dark:"#575757B8",light:"#57575740",hcDark:null,hcLight:null},d(1723,null),!0);J("editor.wordHighlightStrongBackground",{dark:"#004972B8",light:"#0e639c40",hcDark:null,hcLight:null},d(1725,null),!0);J("editor.wordHighlightTextBackground",eHo,d(1727,null),!0);var tHo=J("editor.wordHighlightBorder",{light:null,dark:null,hcDark:qs,hcLight:qs},d(1724,null));J("editor.wordHighlightStrongBorder",{light:null,dark:null,hcDark:qs,hcLight:qs},d(1726,null));J("editor.wordHighlightTextBorder",tHo,d(1728,null));var iHo=J("editorOverviewRuler.wordHighlightForeground","#A0A0A0CC",d(1720,null),!0),oHo=J("editorOverviewRuler.wordHighlightStrongForeground","#C0A0C0CC",d(1721,null),!0),nHo=J("editorOverviewRuler.wordHighlightTextForeground",XSe,d(1722,null),!0),rHo=po.register({description:"word-highlight-strong",stickiness:1,className:"wordHighlightStrong",overviewRuler:{color:Ss(oHo),position:2},minimap:{color:Ss(W$e),position:1}}),sHo=po.register({description:"word-highlight-text",stickiness:1,className:"wordHighlightText",overviewRuler:{color:Ss(nHo),position:2},minimap:{color:Ss(W$e),position:1}}),aHo=po.register({description:"selection-highlight-overview",stickiness:1,className:"selectionHighlight",overviewRuler:{color:Ss(XSe),position:2},minimap:{color:Ss(W$e),position:1}}),lHo=po.register({description:"selection-highlight",stickiness:1,className:"selectionHighlight"}),cHo=po.register({description:"word-highlight",stickiness:1,className:"wordHighlight",overviewRuler:{color:Ss(iHo),position:2},minimap:{color:Ss(W$e),position:1}});function p6i(a){return a===2?rHo:a===0?sHo:cHo}function m6i(a){return a?lHo:aHo}is((a,i)=>{let e=a.getColor(YSe);e&&i.addRule(`.monaco-editor .selectionHighlight { background-color: ${e.transparent(.5)}; }`)});function tY(a,i){let e=i.filter(t=>!a.find(o=>o.equals(t)));if(e.length>=1){let t=e.map(n=>`line ${n.viewState.position.lineNumber} column ${n.viewState.position.column}`).join(", "),o=e.length===1?d(1449,null,t):d(1450,null,t);Or(o)}}var Xai=class extends xi{constructor(){super({id:"editor.action.insertCursorAbove",label:L(1465,"Add Cursor Above"),precondition:void 0,kbOpts:{kbExpr:ue.editorTextFocus,primary:2576,linux:{primary:1552,secondary:[3088]},weight:100},menuOpts:{menuId:D.MenubarSelectionMenu,group:"3_multi",title:d(1453,null),order:2}})}run(i,e,t){if(!e.hasModel())return;let o=!0;t&&t.logicalLine===!1&&(o=!1);let n=e._getViewModel();if(n.cursorConfig.readOnly)return;n.model.pushStackElement();let r=n.getCursorStates();n.setCursorStates(t.source,3,Wg.addCursorUp(n,r,o)),n.revealTopMostCursor(t.source),tY(r,n.getCursorStates())}},Jai=class extends xi{constructor(){super({id:"editor.action.insertCursorBelow",label:L(1467,"Add Cursor Below"),precondition:void 0,kbOpts:{kbExpr:ue.editorTextFocus,primary:2578,linux:{primary:1554,secondary:[3090]},weight:100},menuOpts:{menuId:D.MenubarSelectionMenu,group:"3_multi",title:d(1455,null),order:3}})}run(i,e,t){if(!e.hasModel())return;let o=!0;t&&t.logicalLine===!1&&(o=!1);let n=e._getViewModel();if(n.cursorConfig.readOnly)return;n.model.pushStackElement();let r=n.getCursorStates();n.setCursorStates(t.source,3,Wg.addCursorDown(n,r,o)),n.revealBottomMostCursor(t.source),tY(r,n.getCursorStates())}},Zai=class extends xi{constructor(){super({id:"editor.action.insertCursorAtEndOfEachLineSelected",label:L(1466,"Add Cursors to Line Ends"),precondition:void 0,kbOpts:{kbExpr:ue.editorTextFocus,primary:1575,weight:100},menuOpts:{menuId:D.MenubarSelectionMenu,group:"3_multi",title:d(1454,null),order:4}})}getCursorsForSelection(i,e,t){if(!i.isEmpty()){for(let o=i.startLineNumber;o<i.endLineNumber;o++){let n=e.getLineMaxColumn(o);t.push(new Yt(o,n,o,n))}i.endColumn>1&&t.push(new Yt(i.endLineNumber,i.endColumn,i.endLineNumber,i.endColumn))}}run(i,e){if(!e.hasModel())return;let t=e.getModel(),o=e.getSelections(),n=e._getViewModel(),r=n.getCursorStates(),s=[];o.forEach(l=>this.getCursorsForSelection(l,t,s)),s.length>0&&e.setSelections(s),tY(r,n.getCursorStates())}},eli=class extends xi{constructor(){super({id:"editor.action.addCursorsToBottom",label:L(1459,"Add Cursors to Bottom"),precondition:void 0})}run(i,e){if(!e.hasModel())return;let t=e.getSelections(),o=e.getModel().getLineCount(),n=[];for(let l=t[0].startLineNumber;l<=o;l++)n.push(new Yt(l,t[0].startColumn,l,t[0].endColumn));let r=e._getViewModel(),s=r.getCursorStates();n.length>0&&e.setSelections(n),tY(s,r.getCursorStates())}},tli=class extends xi{constructor(){super({id:"editor.action.addCursorsToTop",label:L(1460,"Add Cursors to Top"),precondition:void 0})}run(i,e){if(!e.hasModel())return;let t=e.getSelections(),o=[];for(let s=t[0].startLineNumber;s>=1;s--)o.push(new Yt(s,t[0].startColumn,s,t[0].endColumn));let n=e._getViewModel(),r=n.getCursorStates();o.length>0&&e.setSelections(o),tY(r,n.getCursorStates())}},YCe=class{constructor(i,e,t){this.selections=i;this.revealRange=e;this.revealScrollType=t}},txt=class a{constructor(i,e,t,o,n,r,s){this._editor=i;this.findController=e;this.isDisconnectedFromFindController=t;this.searchText=o;this.wholeWord=n;this.matchCase=r;this.currentMatch=s}static create(i,e){if(!i.hasModel())return null;let t=e.getState();if(!i.hasTextFocus()&&t.isRevealed&&t.searchString.length>0)return new a(i,e,!1,t.searchString,t.wholeWord,t.matchCase,null);let o=!1,n,r,s=i.getSelections();s.length===1&&s[0].isEmpty()?(o=!0,n=!0,r=!0):(n=t.wholeWord,r=t.matchCase);let l=i.getSelection(),c,u=null;if(l.isEmpty()){let p=i.getConfiguredWordAtPosition(l.getStartPosition());if(!p)return null;c=p.word,u=new Yt(l.startLineNumber,p.startColumn,l.startLineNumber,p.endColumn)}else c=i.getModel().getValueInRange(l).replace(/\r\n/g,`
`);return new a(i,e,o,c,n,r,u)}addSelectionToNextFindMatch(){if(!this._editor.hasModel())return null;let i=this._getNextMatch();if(!i)return null;let e=this._editor.getSelections();return new YCe(e.concat(i),i,0)}moveSelectionToNextFindMatch(){if(!this._editor.hasModel())return null;let i=this._getNextMatch();if(!i)return null;let e=this._editor.getSelections();return new YCe(e.slice(0,e.length-1).concat(i),i,0)}_getNextMatch(){if(!this._editor.hasModel())return null;if(this.currentMatch){let o=this.currentMatch;return this.currentMatch=null,o}this.findController.highlightFindOptions();let i=this._editor.getSelections(),e=i[i.length-1],t=this._editor.getModel().findNextMatch(this.searchText,e.getEndPosition(),!1,this.matchCase,this.wholeWord?this._editor.getOption(148):null,!1);return t?new Yt(t.range.startLineNumber,t.range.startColumn,t.range.endLineNumber,t.range.endColumn):null}addSelectionToPreviousFindMatch(){if(!this._editor.hasModel())return null;let i=this._getPreviousMatch();if(!i)return null;let e=this._editor.getSelections();return new YCe(e.concat(i),i,0)}moveSelectionToPreviousFindMatch(){if(!this._editor.hasModel())return null;let i=this._getPreviousMatch();if(!i)return null;let e=this._editor.getSelections();return new YCe(e.slice(0,e.length-1).concat(i),i,0)}_getPreviousMatch(){if(!this._editor.hasModel())return null;if(this.currentMatch){let o=this.currentMatch;return this.currentMatch=null,o}this.findController.highlightFindOptions();let i=this._editor.getSelections(),e=i[i.length-1],t=this._editor.getModel().findPreviousMatch(this.searchText,e.getStartPosition(),!1,this.matchCase,this.wholeWord?this._editor.getOption(148):null,!1);return t?new Yt(t.range.startLineNumber,t.range.startColumn,t.range.endLineNumber,t.range.endColumn):null}selectAll(i){if(!this._editor.hasModel())return[];this.findController.highlightFindOptions();let e=this._editor.getModel();return i?e.findMatches(this.searchText,i,!1,this.matchCase,this.wholeWord?this._editor.getOption(148):null,!1,1073741824):e.findMatches(this.searchText,!0,!1,this.matchCase,this.wholeWord?this._editor.getOption(148):null,!1,1073741824)}},Z7=class a extends C{constructor(e){super();this._sessionDispose=this._register(new P);this._editor=e,this._ignoreSelectionChange=!1,this._session=null}static{this.ID="editor.contrib.multiCursorController"}static get(e){return e.getContribution(a.ID)}dispose(){this._endSession(),super.dispose()}_beginSessionIfNeeded(e){if(!this._session){let t=txt.create(this._editor,e);if(!t)return;this._session=t;let o={searchString:this._session.searchText};this._session.isDisconnectedFromFindController&&(o.wholeWordOverride=1,o.matchCaseOverride=1,o.isRegexOverride=2),e.getState().change(o,!1),this._sessionDispose.add(this._editor.onDidChangeCursorSelection(n=>{this._ignoreSelectionChange||this._endSession()})),this._sessionDispose.add(this._editor.onDidBlurEditorText(()=>{this._endSession()})),this._sessionDispose.add(e.getState().onFindReplaceStateChange(n=>{(n.matchCase||n.wholeWord)&&this._endSession()}))}}_endSession(){if(this._sessionDispose.clear(),this._session&&this._session.isDisconnectedFromFindController){let e={wholeWordOverride:0,matchCaseOverride:0,isRegexOverride:0};this._session.findController.getState().change(e,!1)}this._session=null}_setSelections(e){this._ignoreSelectionChange=!0,this._editor.setSelections(e),this._ignoreSelectionChange=!1}_expandEmptyToWord(e,t){if(!t.isEmpty())return t;let o=this._editor.getConfiguredWordAtPosition(t.getStartPosition());return o?new Yt(t.startLineNumber,o.startColumn,t.startLineNumber,o.endColumn):t}_applySessionResult(e){e&&(this._setSelections(e.selections),e.revealRange&&this._editor.revealRangeInCenterIfOutsideViewport(e.revealRange,e.revealScrollType))}getSession(e){return this._session}addSelectionToNextFindMatch(e){if(this._editor.hasModel()){if(!this._session){let t=this._editor.getSelections();if(t.length>1){let n=e.getState().matchCase;if(!g6i(this._editor.getModel(),t,n)){let s=this._editor.getModel(),l=[];for(let c=0,u=t.length;c<u;c++)l[c]=this._expandEmptyToWord(s,t[c]);this._editor.setSelections(l);return}}}this._beginSessionIfNeeded(e),this._session&&this._applySessionResult(this._session.addSelectionToNextFindMatch())}}addSelectionToPreviousFindMatch(e){this._beginSessionIfNeeded(e),this._session&&this._applySessionResult(this._session.addSelectionToPreviousFindMatch())}moveSelectionToNextFindMatch(e){this._beginSessionIfNeeded(e),this._session&&this._applySessionResult(this._session.moveSelectionToNextFindMatch())}moveSelectionToPreviousFindMatch(e){this._beginSessionIfNeeded(e),this._session&&this._applySessionResult(this._session.moveSelectionToPreviousFindMatch())}selectAll(e){if(!this._editor.hasModel())return;let t=null,o=e.getState();if(o.isRevealed&&o.searchString.length>0&&o.isRegex){let n=this._editor.getModel();o.searchScope?t=n.findMatches(o.searchString,o.searchScope,o.isRegex,o.matchCase,o.wholeWord?this._editor.getOption(148):null,!1,1073741824):t=n.findMatches(o.searchString,!0,o.isRegex,o.matchCase,o.wholeWord?this._editor.getOption(148):null,!1,1073741824)}else{if(this._beginSessionIfNeeded(e),!this._session)return;t=this._session.selectAll(o.searchScope)}if(t.length>0){let n=this._editor.getSelection();for(let r=0,s=t.length;r<s;r++){let l=t[r];if(l.range.intersectRanges(n)){t[r]=t[0],t[0]=l;break}}this._setSelections(t.map(r=>new Yt(r.range.startLineNumber,r.range.startColumn,r.range.endLineNumber,r.range.endColumn)))}}selectAllUsingSelections(e){e.length>0&&this._setSelections(e)}},eY=class extends xi{run(i,e){let t=Z7.get(e);if(!t)return;let o=e._getViewModel();if(o){let n=o.getCursorStates(),r=Tf.get(e);if(r)this._run(t,r);else{let s=i.get(F).createInstance(Tf,e);this._run(t,s),s.dispose()}tY(n,o.getCursorStates())}}},ili=class extends eY{constructor(){super({id:"editor.action.addSelectionToNextFindMatch",label:L(1446,"Add Selection to Next Find Match"),precondition:void 0,kbOpts:{kbExpr:ue.focus,primary:2082,weight:100},menuOpts:{menuId:D.MenubarSelectionMenu,group:"3_multi",title:d(1451,null),order:5}})}_run(i,e){i.addSelectionToNextFindMatch(e)}},oli=class extends eY{constructor(){super({id:"editor.action.addSelectionToPreviousFindMatch",label:L(1447,"Add Selection to Previous Find Match"),precondition:void 0,menuOpts:{menuId:D.MenubarSelectionMenu,group:"3_multi",title:d(1452,null),order:6}})}_run(i,e){i.addSelectionToPreviousFindMatch(e)}},nli=class extends eY{constructor(){super({id:"editor.action.moveSelectionToNextFindMatch",label:L(1457,"Move Last Selection to Next Find Match"),precondition:void 0,kbOpts:{kbExpr:ue.focus,primary:Ai(2089,2082),weight:100}})}_run(i,e){i.moveSelectionToNextFindMatch(e)}},rli=class extends eY{constructor(){super({id:"editor.action.moveSelectionToPreviousFindMatch",label:L(1458,"Move Last Selection to Previous Find Match"),precondition:void 0})}_run(i,e){i.moveSelectionToPreviousFindMatch(e)}},sli=class extends eY{constructor(){super({id:"editor.action.selectHighlights",label:L(1468,"Select All Occurrences of Find Match"),precondition:void 0,kbOpts:{kbExpr:ue.focus,primary:3114,weight:100},menuOpts:{menuId:D.MenubarSelectionMenu,group:"3_multi",title:d(1456,null),order:7}})}_run(i,e){i.selectAll(e)}},ali=class extends eY{constructor(){super({id:"editor.action.changeAll",label:L(1448,"Change All Occurrences"),precondition:x.and(ue.writable,ue.editorTextFocus),kbOpts:{kbExpr:ue.editorTextFocus,primary:2108,weight:100},contextMenuOpts:{group:"1_modification",order:1.2}})}_run(i,e){i.selectAll(e)}},lli=class{constructor(i,e,t,o,n){this._model=i;this._searchText=e;this._matchCase=t;this._wordSeparators=o;this._cachedFindMatches=null;this._modelVersionId=this._model.getVersionId(),n&&this._model===n._model&&this._searchText===n._searchText&&this._matchCase===n._matchCase&&this._wordSeparators===n._wordSeparators&&this._modelVersionId===n._modelVersionId&&(this._cachedFindMatches=n._cachedFindMatches)}findMatches(){return this._cachedFindMatches===null&&(this._cachedFindMatches=this._model.findMatches(this._searchText,!0,!1,this._matchCase,this._wordSeparators,!1).map(i=>i.range),this._cachedFindMatches.sort(z.compareRangesUsingStarts)),this._cachedFindMatches}},J7=class extends C{constructor(e,t){super();this._languageFeaturesService=t;this.editor=e,this._isEnabled=e.getOption(122),this._isEnabledMultiline=e.getOption(124),this._maxLength=e.getOption(123),this._decorations=e.createDecorationsCollection(),this.updateSoon=this._register(new Dt(()=>this._update(),300)),this.state=null,this._register(e.onDidChangeConfiguration(n=>{this._isEnabled=e.getOption(122),this._isEnabledMultiline=e.getOption(124),this._maxLength=e.getOption(123)})),this._register(e.onDidChangeCursorSelection(n=>{this._isEnabled&&(n.selection.isEmpty()?n.reason===3?(this.state&&this._setState(null),this.updateSoon.schedule()):this._setState(null):this._update())})),this._register(e.onDidChangeModel(n=>{this._setState(null)})),this._register(e.onDidChangeModelContent(n=>{this._isEnabled&&this.updateSoon.schedule()}));let o=Tf.get(e);o&&this._register(o.getState().onFindReplaceStateChange(n=>{this._update()})),this.updateSoon.schedule()}static{this.ID="editor.contrib.selectionHighlighter"}_update(){this._setState(J7._createState(this.state,this._isEnabled,this._isEnabledMultiline,this._maxLength,this.editor))}static _createState(e,t,o,n,r){if(!t||!r.hasModel())return null;if(!o){let h=r.getSelection();if(h.startLineNumber!==h.endLineNumber)return null}let s=Z7.get(r);if(!s)return null;let l=Tf.get(r);if(!l)return null;let c=s.getSession(l);if(!c){let h=r.getSelections();if(h.length>1){let f=l.getState().matchCase;if(!g6i(r.getModel(),h,f))return null}c=txt.create(r,l)}if(!c||c.currentMatch||/^[ \t]+$/.test(c.searchText)||n>0&&c.searchText.length>n)return null;let u=l.getState(),p=u.matchCase;if(u.isRevealed){let h=u.searchString;p||(h=h.toLowerCase());let g=c.searchText;if(p||(g=g.toLowerCase()),h===g&&c.matchCase===u.matchCase&&c.wholeWord===u.wholeWord&&!u.isRegex)return null}return new lli(r.getModel(),c.searchText,c.matchCase,c.wholeWord?r.getOption(148):null,e)}_setState(e){if(this.state=e,!this.state){this._decorations.clear();return}if(!this.editor.hasModel())return;let t=this.editor.getModel();if(t.isTooLargeForTokenization())return;let o=this.state.findMatches(),n=this.editor.getSelections();n.sort(z.compareRangesUsingStarts);let r=[];for(let u=0,p=0,h=o.length,g=n.length;u<h;){let f=o[u];if(p>=g)r.push(f),u++;else{let v=z.compareRangesUsingStarts(f,n[p]);v<0?((n[p].isEmpty()||!z.areIntersecting(f,n[p]))&&r.push(f),u++):(v>0||u++,p++)}}let s=this.editor.getOption(90)!=="off",l=this._languageFeaturesService.documentHighlightProvider.has(t)&&s,c=r.map(u=>({range:u,options:m6i(l)}));this._decorations.set(c)}dispose(){this._setState(null),super.dispose()}};J7=I([m(1,zt)],J7);function g6i(a,i,e){let t=h6i(a,i[0],!e);for(let o=1,n=i.length;o<n;o++){let r=i[o];if(r.isEmpty())return!1;let s=h6i(a,r,!e);if(t!==s)return!1}return!0}function h6i(a,i,e){let t=a.getValueInRange(i);return e?t.toLowerCase():t}var cli=class extends xi{constructor(){super({id:"editor.action.focusNextCursor",label:L(1461,"Focus Next Cursor"),metadata:{description:d(1462,null),args:[]},precondition:void 0})}run(i,e,t){if(!e.hasModel())return;let o=e._getViewModel();if(o.cursorConfig.readOnly)return;o.model.pushStackElement();let n=Array.from(o.getCursorStates()),r=n.shift();r&&(n.push(r),o.setCursorStates(t.source,3,n),o.revealPrimaryCursor(t.source,!0),tY(n,o.getCursorStates()))}},dli=class extends xi{constructor(){super({id:"editor.action.focusPreviousCursor",label:L(1463,"Focus Previous Cursor"),metadata:{description:d(1464,null),args:[]},precondition:void 0})}run(i,e,t){if(!e.hasModel())return;let o=e._getViewModel();if(o.cursorConfig.readOnly)return;o.model.pushStackElement();let n=Array.from(o.getCursorStates()),r=n.pop();r&&(n.unshift(r),o.setCursorStates(t.source,3,n),o.revealPrimaryCursor(t.source,!0),tY(n,o.getCursorStates()))}};go(Z7.ID,Z7,4);go(J7.ID,J7,1);Jt(Xai);Jt(Jai);Jt(Zai);Jt(ili);Jt(oli);Jt(nli);Jt(rli);Jt(sli);Jt(ali);Jt(eli);Jt(tli);Jt(cli);Jt(dli);var uj={Visible:new Q("parameterHintsVisible",!1),MultipleSignatures:new Q("parameterHintsMultipleSignatures",!1)};async function uli(a,i,e,t,o){let n=a.ordered(i);for(let r of n)try{let s=await r.provideSignatureHelp(i,e,o,t);if(s)return s}catch(s){ss(s)}}qe.registerCommand("_executeSignatureHelpProvider",async(a,...i)=>{let[e,t,o]=i;So(A.isUri(e)),So(Ie.isIPosition(t)),So(typeof o=="string"||!o);let n=a.get(zt),r=await a.get(Nt).createModelReference(e);try{let s=await uli(n.signatureHelpProvider,r.object.textEditorModel,Ie.lift(t),{triggerKind:1,isRetrigger:!1,triggerCharacter:o},ve.None);return s?(setTimeout(()=>s.dispose(),0),s.value):void 0}finally{r.dispose()}});var Ple;(o=>{let a;(l=>(l[l.Default=0]="Default",l[l.Active=1]="Active",l[l.Pending=2]="Pending"))(a=o.Type||={}),o.Default={type:0};class e{constructor(r,s){this.request=r;this.previouslyActiveHints=s;this.type=2}}o.Pending=e;class t{constructor(r){this.hints=r;this.type=1}}o.Active=t})(Ple||={});var ixt=class a extends C{constructor(e,t,o=a.DEFAULT_DELAY){super();this._onChangedHints=this._register(new E);this.onChangedHints=this._onChangedHints.event;this.triggerOnType=!1;this._state=Ple.Default;this._pendingTriggers=[];this._lastSignatureHelpResult=this._register(new me);this.triggerChars=new D$;this.retriggerChars=new D$;this.triggerId=0;this.editor=e,this.providers=t,this.throttledDelayer=this._register(new jo(o)),this._register(this.editor.onDidBlurEditorWidget(()=>this.cancel())),this._register(this.editor.onDidChangeConfiguration(()=>this.onEditorConfigurationChange())),this._register(this.editor.onDidChangeModel(n=>this.onModelChanged())),this._register(this.editor.onDidChangeModelLanguage(n=>this.onModelChanged())),this._register(this.editor.onDidChangeCursorSelection(n=>this.onCursorChange(n))),this._register(this.editor.onDidChangeModelContent(n=>this.onModelContentChange())),this._register(this.providers.onDidChange(this.onModelChanged,this)),this._register(this.editor.onDidType(n=>this.onDidType(n))),this.onEditorConfigurationChange(),this.onModelChanged()}static{this.DEFAULT_DELAY=120}get state(){return this._state}set state(e){this._state.type===2&&this._state.request.cancel(),this._state=e}cancel(e=!1){this.state=Ple.Default,this.throttledDelayer.cancel(),e||this._onChangedHints.fire(void 0)}trigger(e,t){let o=this.editor.getModel();if(!o||!this.providers.has(o))return;let n=++this.triggerId;this._pendingTriggers.push(e),this.throttledDelayer.trigger(()=>this.doTrigger(n),t).catch(mt)}next(){if(this.state.type!==1)return;let e=this.state.hints.signatures.length,t=this.state.hints.activeSignature,o=t%e===e-1,n=this.editor.getOption(98).cycle;if((e<2||o)&&!n){this.cancel();return}this.updateActiveSignature(o&&n?0:t+1)}previous(){if(this.state.type!==1)return;let e=this.state.hints.signatures.length,t=this.state.hints.activeSignature,o=t===0,n=this.editor.getOption(98).cycle;if((e<2||o)&&!n){this.cancel();return}this.updateActiveSignature(o&&n?e-1:t-1)}updateActiveSignature(e){this.state.type===1&&(this.state=new Ple.Active({...this.state.hints,activeSignature:e}),this._onChangedHints.fire(this.state.hints))}async doTrigger(e){let t=this.state.type===1||this.state.type===2,o=this.getLastActiveHints();if(this.cancel(!0),this._pendingTriggers.length===0)return!1;let n=this._pendingTriggers.reduce(dHo);this._pendingTriggers=[];let r={triggerKind:n.triggerKind,triggerCharacter:n.triggerCharacter,isRetrigger:t,activeSignatureHelp:o};if(!this.editor.hasModel())return!1;let s=this.editor.getModel(),l=this.editor.getPosition();this.state=new Ple.Pending(xn(c=>uli(this.providers,s,l,r,c)),o);try{let c=await this.state.request;return e!==this.triggerId?(c?.dispose(),!1):!c||!c.value.signatures||c.value.signatures.length===0?(c?.dispose(),this._lastSignatureHelpResult.clear(),this.cancel(),!1):(this.state=new Ple.Active(c.value),this._lastSignatureHelpResult.value=c,this._onChangedHints.fire(this.state.hints),!0)}catch(c){return e===this.triggerId&&(this.state=Ple.Default),mt(c),!1}}getLastActiveHints(){switch(this.state.type){case 1:return this.state.hints;case 2:return this.state.previouslyActiveHints;default:return}}get isTriggered(){return this.state.type===1||this.state.type===2||this.throttledDelayer.isTriggered()}onModelChanged(){this.cancel(),this.triggerChars.clear(),this.retriggerChars.clear();let e=this.editor.getModel();if(e)for(let t of this.providers.ordered(e)){for(let o of t.signatureHelpTriggerCharacters||[])if(o.length){let n=o.charCodeAt(0);this.triggerChars.add(n),this.retriggerChars.add(n)}for(let o of t.signatureHelpRetriggerCharacters||[])o.length&&this.retriggerChars.add(o.charCodeAt(0))}}onDidType(e){if(!this.triggerOnType)return;let t=e.length-1,o=e.charCodeAt(t);(this.triggerChars.has(o)||this.isTriggered&&this.retriggerChars.has(o))&&this.trigger({triggerKind:2,triggerCharacter:e.charAt(t)})}onCursorChange(e){e.source==="mouse"?this.cancel():this.isTriggered&&this.trigger({triggerKind:3})}onModelContentChange(){this.isTriggered&&this.trigger({triggerKind:3})}onEditorConfigurationChange(){this.triggerOnType=this.editor.getOption(98).enabled,this.triggerOnType||this.cancel()}dispose(){this.cancel(!0),super.dispose()}};function dHo(a,i){switch(i.triggerKind){case 1:return i;case 3:return a;case 2:default:return i}}var VL=_,uHo=Re("parameter-hints-next",M.chevronDown,d(1472,null)),pHo=Re("parameter-hints-previous",M.chevronUp,d(1473,null)),iY=class extends C{constructor(e,t,o,n){super();this.editor=e;this.model=t;this.markdownRendererService=n;this.renderDisposeables=this._register(new P);this.visible=!1;this.announcedLabel=null;this.allowEditorOverflow=!0;this.keyVisible=uj.Visible.bindTo(o),this.keyMultipleSignatures=uj.MultipleSignatures.bindTo(o)}static{this.ID="editor.widget.parameterHintsWidget"}createParameterHintDOMNodes(){let e=VL(".editor-widget.parameter-hints-widget"),t=R(e,VL(".phwrapper"));t.tabIndex=-1;let o=R(t,VL(".controls")),n=R(o,VL(".button"+q.asCSSSelector(pHo))),r=R(o,VL(".overloads")),s=R(o,VL(".button"+q.asCSSSelector(uHo)));this._register(j(n,"click",g=>{$t.stop(g),this.previous()})),this._register(j(s,"click",g=>{$t.stop(g),this.next()}));let l=VL(".body"),c=new Pa(l,{alwaysConsumeMouseWheel:!0});this._register(c),t.appendChild(c.getDomNode());let u=R(l,VL(".signature")),p=R(l,VL(".docs"));e.style.userSelect="text",this.domNodes={element:e,signature:u,overloads:r,docs:p,scrollbar:c},this.editor.addContentWidget(this),this.hide(),this._register(this.editor.onDidChangeCursorSelection(g=>{this.visible&&this.editor.layoutContentWidget(this)}));let h=()=>{if(!this.domNodes)return;let g=this.editor.getOption(59),f=this.domNodes.element;f.style.fontSize=`${g.fontSize}px`,f.style.lineHeight=`${g.lineHeight/g.fontSize}`,f.style.setProperty("--vscode-parameterHintsWidget-editorFontFamily",g.fontFamily),f.style.setProperty("--vscode-parameterHintsWidget-editorFontFamilyDefault",Yd.fontFamily)};h(),this._register(H.chain(this.editor.onDidChangeConfiguration.bind(this.editor),g=>g.filter(f=>f.hasChanged(59)))(h)),this._register(this.editor.onDidLayoutChange(g=>this.updateMaxHeight())),this.updateMaxHeight()}show(){this.visible||(this.domNodes||this.createParameterHintDOMNodes(),this.keyVisible.set(!0),this.visible=!0,setTimeout(()=>{this.domNodes?.element.classList.add("visible")},100),this.editor.layoutContentWidget(this))}hide(){this.renderDisposeables.clear(),this.visible&&(this.keyVisible.reset(),this.visible=!1,this.announcedLabel=null,this.domNodes?.element.classList.remove("visible"),this.editor.layoutContentWidget(this))}getPosition(){return this.visible?{position:this.editor.getPosition(),preference:[1,2]}:null}render(e){if(this.renderDisposeables.clear(),!this.domNodes)return;let t=e.signatures.length>1;this.domNodes.element.classList.toggle("multiple",t),this.keyMultipleSignatures.set(t),this.domNodes.signature.innerText="",this.domNodes.docs.innerText="";let o=e.signatures[e.activeSignature];if(!o)return;let n=R(this.domNodes.signature,VL(".code")),r=o.parameters.length>0,s=o.activeParameter??e.activeParameter;if(r)this.renderParameters(n,o,s);else{let u=R(n,VL("span"));u.textContent=o.label}let l=o.parameters[s];if(l?.documentation){let u=VL("span.documentation");if(typeof l.documentation=="string")u.textContent=l.documentation;else{let p=this.renderMarkdownDocs(l.documentation);u.appendChild(p.element)}R(this.domNodes.docs,VL("p",{},u))}if(o.documentation!==void 0)if(typeof o.documentation=="string")R(this.domNodes.docs,VL("p",{},o.documentation));else{let u=this.renderMarkdownDocs(o.documentation);R(this.domNodes.docs,u.element)}let c=this.hasDocs(o,l);if(this.domNodes.signature.classList.toggle("has-docs",c),this.domNodes.docs.classList.toggle("empty",!c),this.domNodes.overloads.textContent=String(e.activeSignature+1).padStart(e.signatures.length.toString().length,"0")+"/"+e.signatures.length,l){let u="",p=o.parameters[s];Array.isArray(p.label)?u=o.label.substring(p.label[0],p.label[1]):u=p.label,p.documentation&&(u+=typeof p.documentation=="string"?`, ${p.documentation}`:`, ${p.documentation.value}`),o.documentation&&(u+=typeof o.documentation=="string"?`, ${o.documentation}`:`, ${o.documentation.value}`),this.announcedLabel!==u&&(Jo(d(1471,null,u)),this.announcedLabel=u)}this.editor.layoutContentWidget(this),this.domNodes.scrollbar.scanDomNode()}renderMarkdownDocs(e){let t=this.renderDisposeables.add(this.markdownRendererService.render(e,{context:this.editor,asyncRenderCallback:()=>{this.domNodes?.scrollbar.scanDomNode()}}));return t.element.classList.add("markdown-docs"),t}hasDocs(e,t){return!!(t&&typeof t.documentation=="string"&&Oi(t.documentation).length>0||t&&typeof t.documentation=="object"&&Oi(t.documentation).value.length>0||e.documentation&&typeof e.documentation=="string"&&Oi(e.documentation).length>0||e.documentation&&typeof e.documentation=="object"&&Oi(e.documentation.value).length>0)}renderParameters(e,t,o){let[n,r]=this.getParameterLabelOffsets(t,o),s=document.createElement("span");s.textContent=t.label.substring(0,n);let l=document.createElement("span");l.textContent=t.label.substring(n,r),l.className="parameter active";let c=document.createElement("span");c.textContent=t.label.substring(r),R(e,s,l,c)}getParameterLabelOffsets(e,t){let o=e.parameters[t];if(o){if(Array.isArray(o.label))return o.label;if(o.label.length){let n=new RegExp(`(\\W|^)${Yr(o.label)}(?=\\W|$)`,"g");n.test(e.label);let r=n.lastIndex-o.label.length;return r>=0?[r,n.lastIndex]:[0,0]}else return[0,0]}else return[0,0]}next(){this.editor.focus(),this.model.next()}previous(){this.editor.focus(),this.model.previous()}getDomNode(){return this.domNodes||this.createParameterHintDOMNodes(),this.domNodes.element}getId(){return iY.ID}updateMaxHeight(){if(!this.domNodes)return;let t=`${Math.max(this.editor.getLayoutInfo().height/4,250)}px`;this.domNodes.element.style.maxHeight=t;let o=this.domNodes.element.getElementsByClassName("phwrapper");o.length&&(o[0].style.maxHeight=t)}};iY=I([m(2,X),m(3,Qn)],iY);J("editorHoverWidget.highlightForeground",l9,d(1470,null));var IO=class extends C{static{this.ID="editor.controller.parameterHints"}static get(i){return i.getContribution(IO.ID)}constructor(i,e,t){super(),this.editor=i,this.model=this._register(new ixt(i,t.signatureHelpProvider)),this._register(this.model.onChangedHints(o=>{o?(this.widget.value.show(),this.widget.value.render(o)):this.widget.rawValue?.hide()})),this.widget=new co(()=>this._register(e.createInstance(iY,this.editor,this.model)))}cancel(){this.model.cancel()}previous(){this.widget.rawValue?.previous()}next(){this.widget.rawValue?.next()}trigger(i){this.model.trigger(i,0)}};IO=I([m(1,F),m(2,zt)],IO);var pli=class extends xi{constructor(){super({id:"editor.action.triggerParameterHints",label:L(1469,"Trigger Parameter Hints"),precondition:ue.hasSignatureHelpProvider,kbOpts:{kbExpr:ue.editorTextFocus,primary:3082,weight:100}})}run(i,e){IO.get(e)?.trigger({triggerKind:1})}};go(IO.ID,IO,2);Jt(pli);var mli=175,hli=xc.bindToContribution(IO.get);qi(new hli({id:"closeParameterHints",precondition:uj.Visible,handler:a=>a.cancel(),kbOpts:{weight:mli,kbExpr:ue.focus,primary:9,secondary:[1033]}}));qi(new hli({id:"showPrevParameterHint",precondition:x.and(uj.Visible,uj.MultipleSignatures),handler:a=>a.previous(),kbOpts:{weight:mli,kbExpr:ue.focus,primary:16,secondary:[528],mac:{primary:16,secondary:[528,302]}}}));qi(new hli({id:"showNextParameterHint",precondition:x.and(uj.Visible,uj.MultipleSignatures),handler:a=>a.next(),kbOpts:{weight:mli,kbExpr:ue.focus,primary:18,secondary:[530],mac:{primary:18,secondary:[530,300]}}}));var GW=class a extends C{constructor(e){super();this._editor=e;this._editorObs=os(this._editor),this._placeholderText=this._editorObs.getOption(100),this._state=hs({owner:this,equalsFn:VT},t=>{let o=this._placeholderText.read(t);if(o&&this._editorObs.valueIsEmpty.read(t))return{placeholder:o}}),this._shouldViewBeAlive=mHo(this,t=>this._state.read(t)?.placeholder!==void 0),this._view=Ce(t=>{if(!this._shouldViewBeAlive.read(t))return;let o=bt("div.editorPlaceholder");t.store.add(he(n=>{let r=this._state.read(n),s=r?.placeholder!==void 0;o.root.style.display=s?"block":"none",o.root.innerText=r?.placeholder??""})),t.store.add(he(n=>{let r=this._editorObs.layoutInfo.read(n);o.root.style.left=`${r.contentLeft}px`,o.root.style.width=r.contentWidth-r.verticalScrollbarWidth+"px",o.root.style.top=`${this._editor.getTopForLineNumber(0)}px`})),t.store.add(he(n=>{o.root.style.fontFamily=this._editorObs.getOption(58).read(n),o.root.style.fontSize=this._editorObs.getOption(61).read(n)+"px",o.root.style.lineHeight=this._editorObs.getOption(75).read(n)+"px"})),t.store.add(this._editorObs.createOverlayWidget({allowEditorOverflow:!1,minContentWidthInPx:Oo(0),position:Oo(null),domNode:o.root}))}),this._view.recomputeInitiallyAndOnChange(this._store)}static get(e){return e.getContribution(a.ID)}static{this.ID="editor.contrib.placeholderText"}};function mHo(a,i){return vf(a,(e,t)=>t===!0?!0:i(e))}function v6i(a){return rE()?b6i(a,m3e):a()}var oxt=class{constructor(i){this.instantiationService=i}init(...i){}};function b6i(a,i){return class extends i{constructor(){super(...arguments);this._autorun=void 0}init(...o){this._autorun=Ga((n,r)=>{let s=Cx(a(),n);r.add(this.instantiationService.createInstance(s,...o))})}dispose(){this._autorun?.dispose()}}}var m3e=class extends oxt{constructor(i){super(i),this.init()}};m3e=I([m(0,F)],m3e);function S6i(a){return rE()?b6i(a,h3e):a()}var h3e=class extends oxt{constructor(i,e){super(e),this.init(i)}};h3e=I([m(1,F)],h3e);go(GW.ID,S6i(()=>GW),0);J("editor.placeholder.foreground",mqi,d(1492,null));var XCe=class extends C{constructor(e,t,o){super();this.editor=e;this.languageConfigurationService=t;this.editorWorkerService=o;this.decorations=this.editor.createDecorationsCollection(),this.options=this.createOptions(e.getOption(81)),this.computePromise=null,this.currentOccurrences={},this._register(e.onDidChangeModel(n=>{this.currentOccurrences={},this.options=this.createOptions(e.getOption(81)),this.stop(),this.computeSectionHeaders.schedule(0)})),this._register(e.onDidChangeModelLanguage(n=>{this.currentOccurrences={},this.options=this.createOptions(e.getOption(81)),this.stop(),this.computeSectionHeaders.schedule(0)})),this._register(t.onDidChange(n=>{let r=this.editor.getModel()?.getLanguageId();r&&n.affects(r)&&(this.currentOccurrences={},this.options=this.createOptions(e.getOption(81)),this.stop(),this.computeSectionHeaders.schedule(0))})),this._register(e.onDidChangeConfiguration(n=>{this.options&&!n.hasChanged(81)||(this.options=this.createOptions(e.getOption(81)),this.updateDecorations([]),this.stop(),this.computeSectionHeaders.schedule(0))})),this._register(this.editor.onDidChangeModelContent(n=>{this.computeSectionHeaders.schedule()})),this._register(e.onDidChangeModelTokens(n=>{this.computeSectionHeaders.isScheduled()||this.computeSectionHeaders.schedule(1e3)})),this.computeSectionHeaders=this._register(new Dt(()=>{this.findSectionHeaders()},250)),this.computeSectionHeaders.schedule(0)}static{this.ID="editor.sectionHeaderDetector"}createOptions(e){if(!e||!this.editor.hasModel())return;let t=this.editor.getModel().getLanguageId();if(!t)return;let o=this.languageConfigurationService.getLanguageConfiguration(t).comments,n=this.languageConfigurationService.getLanguageConfiguration(t).foldingRules;if(!(!o&&!n?.markers))return{foldingRules:n,markSectionHeaderRegex:e.markSectionHeaderRegex,findMarkSectionHeaders:e.showMarkSectionHeaders,findRegionSectionHeaders:e.showRegionSectionHeaders}}findSectionHeaders(){if(!this.editor.hasModel()||!this.options?.findMarkSectionHeaders&&!this.options?.findRegionSectionHeaders)return;let e=this.editor.getModel();if(e.isDisposed()||e.isTooLargeForSyncing())return;let t=e.getVersionId();this.editorWorkerService.findSectionHeaders(e.uri,this.options).then(o=>{e.isDisposed()||e.getVersionId()!==t||this.updateDecorations(o)})}updateDecorations(e){let t=this.editor.getModel();t&&(e=e.filter(r=>{if(!r.shouldBeInComments)return!0;let s=t.validateRange(r.range),l=t.tokenization.getLineTokens(s.startLineNumber),c=l.findTokenIndexAtOffset(s.startColumn-1),u=l.getStandardTokenType(c),p=t.getLanguageIdAtPosition(s.startLineNumber,s.startColumn);return l.getLanguageId(c)===p&&u===1}));let o=Object.values(this.currentOccurrences).map(r=>r.decorationId),n=e.map(r=>hHo(r));this.editor.changeDecorations(r=>{let s=r.deltaDecorations(o,n);this.currentOccurrences={};for(let l=0,c=s.length;l<c;l++){let u={sectionHeader:e[l],decorationId:s[l]};this.currentOccurrences[u.decorationId]=u}})}stop(){this.computeSectionHeaders.cancel(),this.computePromise&&(this.computePromise.cancel(),this.computePromise=null)}dispose(){super.dispose(),this.stop(),this.decorations.clear()}};XCe=I([m(1,bs),m(2,$s)],XCe);function hHo(a){return{range:a.range,options:po.createDynamic({description:"section-header",stickiness:3,collapseOnReplaceEdit:!0,minimap:{color:void 0,position:1,sectionHeaderStyle:a.hasSeparatorLine?2:1,sectionHeaderText:a.text}})}}go(XCe.ID,XCe,1);var nxt=class{constructor(i=5){this.timesPerSecond=i;this._lastRun=0,this._minimumTimeBetweenRuns=1e3/i}runIfNotLimited(i){let e=Date.now();e-this._lastRun>=this._minimumTimeBetweenRuns&&(this._lastRun=e,i())}};var rxt=class a{static create(i,e){return new a(i,new gli(e))}get startLineNumber(){return this._startLineNumber}get endLineNumber(){return this._endLineNumber}constructor(i,e){this._startLineNumber=i,this._tokens=e,this._endLineNumber=this._startLineNumber+this._tokens.getMaxDeltaLine()}toString(){return this._tokens.toString(this._startLineNumber)}_updateEndLineNumber(){this._endLineNumber=this._startLineNumber+this._tokens.getMaxDeltaLine()}isEmpty(){return this._tokens.isEmpty()}getLineTokens(i){return this._startLineNumber<=i&&i<=this._endLineNumber?this._tokens.getLineTokens(i-this._startLineNumber):null}getRange(){let i=this._tokens.getRange();return i&&new z(this._startLineNumber+i.startLineNumber,i.startColumn,this._startLineNumber+i.endLineNumber,i.endColumn)}removeTokens(i){let e=i.startLineNumber-this._startLineNumber,t=i.endLineNumber-this._startLineNumber;this._startLineNumber+=this._tokens.removeTokens(e,i.startColumn-1,t,i.endColumn-1),this._updateEndLineNumber()}split(i){let e=i.startLineNumber-this._startLineNumber,t=i.endLineNumber-this._startLineNumber,[o,n,r]=this._tokens.split(e,i.startColumn-1,t,i.endColumn-1);return[new a(this._startLineNumber,o),new a(this._startLineNumber+r,n)]}applyEdit(i,e){let[t,o,n]=OS(e);this.acceptEdit(i,t,o,n,e.length>0?e.charCodeAt(0):0)}acceptEdit(i,e,t,o,n){this._acceptDeleteRange(i),this._acceptInsertText(new Ie(i.startLineNumber,i.startColumn),e,t,o,n),this._updateEndLineNumber()}_acceptDeleteRange(i){if(i.startLineNumber===i.endLineNumber&&i.startColumn===i.endColumn)return;let e=i.startLineNumber-this._startLineNumber,t=i.endLineNumber-this._startLineNumber;if(t<0){let n=t-e;this._startLineNumber-=n;return}let o=this._tokens.getMaxDeltaLine();if(!(e>=o+1)){if(e<0&&t>=o+1){this._startLineNumber=0,this._tokens.clear();return}if(e<0){let n=-e;this._startLineNumber-=n,this._tokens.acceptDeleteRange(i.startColumn-1,0,0,t,i.endColumn-1)}else this._tokens.acceptDeleteRange(0,e,i.startColumn-1,t,i.endColumn-1)}}_acceptInsertText(i,e,t,o,n){if(e===0&&t===0)return;let r=i.lineNumber-this._startLineNumber;if(r<0){this._startLineNumber+=e;return}let s=this._tokens.getMaxDeltaLine();r>=s+1||this._tokens.acceptInsertText(r,i.column-1,e,t,o,n)}reportIfInvalid(i){this._tokens.reportIfInvalid(i,this._startLineNumber)}},gli=class a{constructor(i){this._tokens=i,this._tokenCount=i.length/4}toString(i){let e=[];for(let t=0;t<this._tokenCount;t++)e.push(`(${this._getDeltaLine(t)+i},${this._getStartCharacter(t)}-${this._getEndCharacter(t)})`);return`[${e.join(",")}]`}getMaxDeltaLine(){let i=this._getTokenCount();return i===0?-1:this._getDeltaLine(i-1)}getRange(){let i=this._getTokenCount();if(i===0)return null;let e=this._getStartCharacter(0),t=this._getDeltaLine(i-1),o=this._getEndCharacter(i-1);return new z(0,e+1,t,o+1)}_getTokenCount(){return this._tokenCount}_getDeltaLine(i){return this._tokens[4*i]}_getStartCharacter(i){return this._tokens[4*i+1]}_getEndCharacter(i){return this._tokens[4*i+2]}isEmpty(){return this._getTokenCount()===0}getLineTokens(i){let e=0,t=this._getTokenCount()-1;for(;e<t;){let o=e+Math.floor((t-e)/2),n=this._getDeltaLine(o);if(n<i)e=o+1;else if(n>i)t=o-1;else{let r=o;for(;r>e&&this._getDeltaLine(r-1)===i;)r--;let s=o;for(;s<t&&this._getDeltaLine(s+1)===i;)s++;return new sxt(this._tokens.subarray(4*r,4*s+4))}}return this._getDeltaLine(e)===i?new sxt(this._tokens.subarray(4*e,4*e+4)):null}clear(){this._tokenCount=0}removeTokens(i,e,t,o){let n=this._tokens,r=this._tokenCount,s=0,l=!1,c=0;for(let u=0;u<r;u++){let p=4*u,h=n[p],g=n[p+1],f=n[p+2],v=n[p+3];if((h>i||h===i&&f>=e)&&(h<t||h===t&&g<=o))l=!0;else{if(s===0&&(c=h),l){let b=4*s;n[b]=h-c,n[b+1]=g,n[b+2]=f,n[b+3]=v}else c!==0&&(n[p]=h-c);s++}}return this._tokenCount=s,c}split(i,e,t,o){let n=this._tokens,r=this._tokenCount,s=[],l=[],c=s,u=0,p=0;for(let h=0;h<r;h++){let g=4*h,f=n[g],v=n[g+1],b=n[g+2],S=n[g+3];if(f>i||f===i&&b>=e){if(f<t||f===t&&v<=o)continue;c!==l&&(c=l,u=0,p=f)}c[u++]=f-p,c[u++]=v,c[u++]=b,c[u++]=S}return[new a(new Uint32Array(s)),new a(new Uint32Array(l)),p]}acceptDeleteRange(i,e,t,o,n){let r=this._tokens,s=this._tokenCount,l=o-e,c=0,u=!1;for(let p=0;p<s;p++){let h=4*p,g=r[h],f=r[h+1],v=r[h+2],b=r[h+3];if(g<e||g===e&&v<=t){c++;continue}else if(g===e&&f<t)g===o&&v>n?v-=n-t:v=t;else if(g===e&&f===t)if(g===o&&v>n)v-=n-t;else{u=!0;continue}else if(g<o||g===o&&f<n)if(g===o&&v>n)g=e,f=t,v=f+(v-n);else{u=!0;continue}else if(g>o){if(l===0&&!u){c=s;break}g-=l}else if(g===o&&f>=n)i&&g===0&&(f+=i,v+=i),g-=l,f-=n-t,v-=n-t;else throw new Error("Not possible!");let S=4*c;r[S]=g,r[S+1]=f,r[S+2]=v,r[S+3]=b,c++}this._tokenCount=c}acceptInsertText(i,e,t,o,n,r){let s=t===0&&o===1&&(r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122),l=this._tokens,c=this._tokenCount;for(let u=0;u<c;u++){let p=4*u,h=l[p],g=l[p+1],f=l[p+2];if(!(h<i||h===i&&f<e)){if(h===i&&f===e)if(s)f+=1;else continue;else if(h===i&&g<e&&e<f)t===0?f+=o:f=e;else{if(h===i&&g===e&&s)continue;if(h===i)if(h+=t,t===0)g+=o,f+=o;else{let v=f-g;g=n+(g-e),f=g+v}else h+=t}l[p]=h,l[p+1]=g,l[p+2]=f}}}static{this._rateLimiter=new nxt(10/60)}reportIfInvalid(i,e){for(let t=0;t<this._tokenCount;t++){let o=this._getDeltaLine(t)+e;o<1?a._rateLimiter.runIfNotLimited(()=>{console.error("Invalid Semantic Tokens Data From Extension: lineNumber < 1")}):o>i.getLineCount()?a._rateLimiter.runIfNotLimited(()=>{console.error("Invalid Semantic Tokens Data From Extension: lineNumber > model.getLineCount()")}):this._getEndCharacter(t)>i.getLineLength(o)&&a._rateLimiter.runIfNotLimited(()=>{console.error("Invalid Semantic Tokens Data From Extension: end character > model.getLineLength(lineNumber)")})}}},sxt=class{constructor(i){this._tokens=i}getCount(){return this._tokens.length/4}getStartCharacter(i){return this._tokens[4*i+1]}getEndCharacter(i){return this._tokens[4*i+2]}getMetadata(i){return this._tokens[4*i+3]}};var axt=!1,JCe=class{constructor(i,e,t,o){this._legend=i;this._themeService=e;this._languageService=t;this._logService=o;this._hasWarnedOverlappingTokens=!1;this._hasWarnedInvalidLengthTokens=!1;this._hasWarnedInvalidEditStart=!1;this._hashTable=new vli}getMetadata(i,e,t){let o=this._languageService.languageIdCodec.encodeLanguageId(t),n=this._hashTable.get(i,e,o),r;if(n)r=n.metadata,axt&&this._logService.getLevel()===1&&this._logService.trace(`SemanticTokensProviderStyling [CACHED] ${i} / ${e}: foreground ${Qu.getForeground(r)}, fontStyle ${Qu.getFontStyle(r).toString(2)}`);else{let s=this._legend.tokenTypes[i],l=[];if(s){let c=e;for(let p=0;c>0&&p<this._legend.tokenModifiers.length;p++)c&1&&l.push(this._legend.tokenModifiers[p]),c=c>>1;axt&&c>0&&this._logService.getLevel()===1&&(this._logService.trace(`SemanticTokensProviderStyling: unknown token modifier index: ${e.toString(2)} for legend: ${JSON.stringify(this._legend.tokenModifiers)}`),l.push("not-in-legend"));let u=this._themeService.getColorTheme().getTokenStyleMetadata(s,l,t);if(typeof u>"u")r=2147483647;else{if(r=0,typeof u.italic<"u"){let p=(u.italic?1:0)<<11;r|=p|1}if(typeof u.bold<"u"){let p=(u.bold?2:0)<<11;r|=p|2}if(typeof u.underline<"u"){let p=(u.underline?4:0)<<11;r|=p|4}if(typeof u.strikethrough<"u"){let p=(u.strikethrough?8:0)<<11;r|=p|8}if(u.foreground){let p=u.foreground<<15;r|=p|16}r===0&&(r=2147483647)}}else axt&&this._logService.getLevel()===1&&this._logService.trace(`SemanticTokensProviderStyling: unknown token type index: ${i} for legend: ${JSON.stringify(this._legend.tokenTypes)}`),r=2147483647,s="not-in-legend";this._hashTable.add(i,e,o,r),axt&&this._logService.getLevel()===1&&this._logService.trace(`SemanticTokensProviderStyling ${i} (${s}) / ${e} (${l.join(" ")}): foreground ${Qu.getForeground(r)}, fontStyle ${Qu.getFontStyle(r).toString(2)}`)}return r}warnOverlappingSemanticTokens(i,e){this._hasWarnedOverlappingTokens||(this._hasWarnedOverlappingTokens=!0,this._logService.warn(`Overlapping semantic tokens detected at lineNumber ${i}, column ${e}`))}warnInvalidLengthSemanticTokens(i,e){this._hasWarnedInvalidLengthTokens||(this._hasWarnedInvalidLengthTokens=!0,this._logService.warn(`Semantic token with invalid length detected at lineNumber ${i}, column ${e}`))}warnInvalidEditStart(i,e,t,o,n){this._hasWarnedInvalidEditStart||(this._hasWarnedInvalidEditStart=!0,this._logService.warn(`Invalid semantic tokens edit detected (previousResultId: ${i}, resultId: ${e}) at edit #${t}: The provided start offset ${o} is outside the previous data (length ${n}).`))}};JCe=I([m(1,De),m(2,kt),m(3,ne)],JCe);function lxt(a,i,e){let t=a.data,o=a.data.length/5|0,n=Math.max(Math.ceil(o/1024),400),r=[],s=0,l=1,c=0;for(;s<o;){let u=s,p=Math.min(u+n,o);if(p<o){let y=p;for(;y-1>u&&t[5*y]===0;)y--;if(y-1===u){let w=p;for(;w+1<o&&t[5*w]===0;)w++;p=w}else p=y}let h=new Uint32Array((p-u)*4),g=0,f=0,v=0,b=0;for(;s<p;){let y=5*s,w=t[y],k=t[y+1],T=l+w|0,N=w===0?c+k|0:k,O=t[y+2],V=N+O|0,U=t[y+3],G=t[y+4];if(V<=N)i.warnInvalidLengthSemanticTokens(T,N+1);else if(v===T&&b>N)i.warnOverlappingSemanticTokens(T,N+1);else{let $=i.getMetadata(U,G,e);$!==2147483647&&(f===0&&(f=T),h[g]=T-f,h[g+1]=N,h[g+2]=V,h[g+3]=$,g+=4,v=T,b=V)}l=T,c=N,s++}g!==h.length&&(h=h.subarray(0,g));let S=rxt.create(f,h);r.push(S)}return r}var fli=class{constructor(i,e,t,o){this.tokenTypeIndex=i,this.tokenModifierSet=e,this.languageId=t,this.metadata=o,this.next=null}},vli=class a{static{this._SIZES=[3,7,13,31,61,127,251,509,1021,2039,4093,8191,16381,32749,65521,131071,262139,524287,1048573,2097143]}constructor(){this._elementsCount=0,this._currentLengthIndex=0,this._currentLength=a._SIZES[this._currentLengthIndex],this._growCount=Math.round(this._currentLengthIndex+1<a._SIZES.length?2/3*this._currentLength:0),this._elements=[],a._nullOutEntries(this._elements,this._currentLength)}static _nullOutEntries(i,e){for(let t=0;t<e;t++)i[t]=null}_hash2(i,e){return(i<<5)-i+e|0}_hashFunc(i,e,t){return this._hash2(this._hash2(i,e),t)%this._currentLength}get(i,e,t){let o=this._hashFunc(i,e,t),n=this._elements[o];for(;n;){if(n.tokenTypeIndex===i&&n.tokenModifierSet===e&&n.languageId===t)return n;n=n.next}return null}add(i,e,t,o){if(this._elementsCount++,this._growCount!==0&&this._elementsCount>=this._growCount){let n=this._elements;this._currentLengthIndex++,this._currentLength=a._SIZES[this._currentLengthIndex],this._growCount=Math.round(this._currentLengthIndex+1<a._SIZES.length?2/3*this._currentLength:0),this._elements=[],a._nullOutEntries(this._elements,this._currentLength);for(let r of n){let s=r;for(;s;){let l=s.next;s.next=null,this._add(s),s=l}}}this._add(new fli(i,e,t,o))}_add(i){let e=this._hashFunc(i.tokenTypeIndex,i.tokenModifierSet,i.languageId);i.next=this._elements[e],this._elements[e]=i}};var Ale=ae("semanticTokensStylingService");function I6i(a){for(let i=0,e=a.length;i<e;i+=4){let t=a[i+0],o=a[i+1],n=a[i+2],r=a[i+3];a[i+0]=r,a[i+1]=n,a[i+2]=o,a[i+3]=t}}function gHo(a){let i=new Uint8Array(a.buffer,a.byteOffset,a.length*4);return lGe()||I6i(i),Je.wrap(i)}function fHo(a){let i=a.buffer;if(lGe()||I6i(i),i.byteOffset%4===0)return new Uint32Array(i.buffer,i.byteOffset,i.length/4);{let e=new Uint8Array(i.byteLength);return e.set(i),new Uint32Array(e.buffer,e.byteOffset,e.length/4)}}function bli(a){let i=new Uint32Array(vHo(a)),e=0;if(i[e++]=a.id,a.type==="full")i[e++]=1,i[e++]=a.data.length,i.set(a.data,e),e+=a.data.length;else{i[e++]=2,i[e++]=a.deltas.length;for(let t of a.deltas)i[e++]=t.start,i[e++]=t.deleteCount,t.data?(i[e++]=t.data.length,i.set(t.data,e),e+=t.data.length):i[e++]=0}return gHo(i)}function vHo(a){let i=0;if(i+=2,a.type==="full")i+=1+a.data.length;else{i+=1,i+=3*a.deltas.length;for(let e of a.deltas)e.data&&(i+=e.data.length)}return i}function Sli(a){let i=fHo(a),e=0,t=i[e++];if(i[e++]===1){let s=i[e++],l=i.subarray(e,e+s);return e+=s,{id:t,type:"full",data:l}}let n=i[e++],r=[];for(let s=0;s<n;s++){let l=i[e++],c=i[e++],u=i[e++],p;u>0&&(p=i.subarray(e,e+u),e+=u),r[s]={start:l,deleteCount:c,data:p}}return{id:t,type:"delta",deltas:r}}function g3e(a){return a&&!!a.data}function wli(a){return a&&Array.isArray(a.edits)}var Ili=class{constructor(i,e,t){this.provider=i;this.tokens=e;this.error=t}};function Cli(a,i){return a.has(i)}function bHo(a,i){let e=a.orderedGroups(i);return e.length>0?e[0]:[]}async function xli(a,i,e,t,o){let n=bHo(a,i),r=await Promise.all(n.map(async s=>{let l,c=null;try{l=await s.provideDocumentSemanticTokens(i,s===e?t:null,o)}catch(u){c=u,l=null}return(!l||!g3e(l)&&!wli(l))&&(l=null),new Ili(s,l,c)}));for(let s of r){if(s.error)throw s.error;if(s.tokens)return s}return r.length>0?r[0]:null}function SHo(a,i){let e=a.orderedGroups(i);return e.length>0?e[0]:null}var yli=class{constructor(i,e){this.provider=i;this.tokens=e}};function y6i(a,i){return a.has(i)}function w6i(a,i){let e=a.orderedGroups(i);return e.length>0?e[0]:[]}async function cxt(a,i,e,t){let o=w6i(a,i),n=await Promise.all(o.map(async r=>{let s;try{s=await r.provideDocumentRangeSemanticTokens(i,e,t)}catch(l){ss(l),s=null}return(!s||!g3e(s))&&(s=null),new yli(r,s)}));for(let r of n)if(r.tokens)return r;return n.length>0?n[0]:null}qe.registerCommand("_provideDocumentSemanticTokensLegend",async(a,...i)=>{let[e]=i;So(e instanceof A);let t=a.get(Ct).getModel(e);if(!t)return;let{documentSemanticTokensProvider:o}=a.get(zt),n=SHo(o,t);return n?n[0].getLegend():a.get(ge).executeCommand("_provideDocumentRangeSemanticTokensLegend",e)});qe.registerCommand("_provideDocumentSemanticTokens",async(a,...i)=>{let[e]=i;So(e instanceof A);let t=a.get(Ct).getModel(e);if(!t)return;let{documentSemanticTokensProvider:o}=a.get(zt);if(!Cli(o,t))return a.get(ge).executeCommand("_provideDocumentRangeSemanticTokens",e,t.getFullModelRange());let n=await xli(o,t,null,null,ve.None);if(!n)return;let{provider:r,tokens:s}=n;if(!s||!g3e(s))return;let l=bli({id:0,type:"full",data:s.data});return s.resultId&&r.releaseDocumentSemanticTokens(s.resultId),l});qe.registerCommand("_provideDocumentRangeSemanticTokensLegend",async(a,...i)=>{let[e,t]=i;So(e instanceof A);let o=a.get(Ct).getModel(e);if(!o)return;let{documentRangeSemanticTokensProvider:n}=a.get(zt),r=w6i(n,o);if(r.length===0)return;if(r.length===1)return r[0].getLegend();if(!t||!z.isIRange(t))return console.warn("provideDocumentRangeSemanticTokensLegend might be out-of-sync with provideDocumentRangeSemanticTokens unless a range argument is passed in"),r[0].getLegend();let s=await cxt(n,o,z.lift(t),ve.None);if(s)return s.provider.getLegend()});qe.registerCommand("_provideDocumentRangeSemanticTokens",async(a,...i)=>{let[e,t]=i;So(e instanceof A),So(z.isIRange(t));let o=a.get(Ct).getModel(e);if(!o)return;let{documentRangeSemanticTokensProvider:n}=a.get(zt),r=await cxt(n,o,z.lift(t),ve.None);if(!(!r||!r.tokens))return bli({id:0,type:"full",data:r.tokens.data})});var Nle="editor.semanticHighlighting";function ZCe(a,i,e){let t=e.getValue(Nle,{overrideIdentifier:a.getLanguageId(),resource:a.uri})?.enabled;return typeof t=="boolean"?t:i.getColorTheme().semanticHighlighting}var f3e=class extends C{constructor(e,t,o,n,r,s){super();this._watchers=new vt;this._providerChangeListeners=this._register(new P);let l=s.documentSemanticTokensProvider,c=g=>{this._watchers.get(g.uri)?.dispose(),this._watchers.set(g.uri,new yO(g,e,o,r,s))},u=(g,f)=>{f.dispose(),this._watchers.delete(g.uri)},p=()=>{for(let g of t.getModels()){let f=this._watchers.get(g.uri);ZCe(g,o,n)?f||c(g):f&&u(g,f)}},h=()=>{this._providerChangeListeners.clear();for(let g of l.allNoModel())typeof g.onDidChange=="function"&&this._providerChangeListeners.add(g.onDidChange(()=>{for(let f of this._watchers.values())f.handleProviderDidChange(g)}))};t.getModels().forEach(g=>{ZCe(g,o,n)&&c(g)}),this._register(t.onModelAdded(g=>{ZCe(g,o,n)&&c(g)})),this._register(t.onModelRemoved(g=>{let f=this._watchers.get(g.uri);f&&u(g,f)})),this._register(n.onDidChangeConfiguration(g=>{g.affectsConfiguration(Nle)&&p()})),this._register(o.onDidColorThemeChange(p)),h(),this._register(l.onDidChange(()=>{h();for(let g of this._watchers.values())g.handleRegistryChange()}))}dispose(){Ue(this._watchers.values()),this._watchers.clear(),super.dispose()}};f3e=I([m(0,Ale),m(1,Ct),m(2,De),m(3,B),m(4,jg),m(5,zt)],f3e);var yO=class extends C{constructor(e,t,o,n,r){super();this._semanticTokensStylingService=t;this._relevantProviders=new Set;this._isDisposed=!1,this._model=e,this._provider=r.documentSemanticTokensProvider,this._debounceInformation=n.for(this._provider,"DocumentSemanticTokens",{min:yO.REQUEST_MIN_DELAY,max:yO.REQUEST_MAX_DELAY}),this._fetchDocumentSemanticTokens=this._register(new Dt(()=>this._fetchDocumentSemanticTokensNow(),yO.REQUEST_MIN_DELAY)),this._currentDocumentResponse=null,this._currentDocumentRequestCancellationTokenSource=null,this._providersChangedDuringRequest=!1,this._updateRelevantProviders(),this._register(this._model.onDidChangeContent(()=>{this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._register(this._model.onDidChangeAttached(()=>{this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._register(this._model.onDidChangeLanguage(()=>{this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._currentDocumentRequestCancellationTokenSource&&(this._currentDocumentRequestCancellationTokenSource.cancel(),this._currentDocumentRequestCancellationTokenSource=null),this._setDocumentSemanticTokens(null,null,null,[]),this._updateRelevantProviders(),this._fetchDocumentSemanticTokens.schedule(0)})),this._register(o.onDidColorThemeChange(s=>{this._setDocumentSemanticTokens(null,null,null,[]),this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._fetchDocumentSemanticTokens.schedule(0)}static{this.REQUEST_MIN_DELAY=300}static{this.REQUEST_MAX_DELAY=2e3}handleRegistryChange(){this._updateRelevantProviders(),this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))}handleProviderDidChange(e){if(this._relevantProviders.has(e)){if(this._currentDocumentRequestCancellationTokenSource){this._providersChangedDuringRequest=!0;return}this._fetchDocumentSemanticTokens.schedule(0)}}_updateRelevantProviders(){this._relevantProviders=new Set(this._provider.all(this._model))}dispose(){this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._currentDocumentRequestCancellationTokenSource&&(this._currentDocumentRequestCancellationTokenSource.cancel(),this._currentDocumentRequestCancellationTokenSource=null),this._setDocumentSemanticTokens(null,null,null,[]),this._isDisposed=!0,super.dispose()}_fetchDocumentSemanticTokensNow(){if(this._currentDocumentRequestCancellationTokenSource)return;if(!Cli(this._provider,this._model)){this._currentDocumentResponse&&this._model.tokenization.setSemanticTokens(null,!1);return}if(!this._model.isAttachedToEditor())return;let e=new $e,t=this._currentDocumentResponse?this._currentDocumentResponse.provider:null,o=this._currentDocumentResponse&&this._currentDocumentResponse.resultId||null,n=xli(this._provider,this._model,t,o,e.token);this._currentDocumentRequestCancellationTokenSource=e,this._providersChangedDuringRequest=!1;let r=[],s=this._model.onDidChangeContent(c=>{r.push(c)}),l=new En(!1);n.then(c=>{if(this._debounceInformation.update(this._model,l.elapsed()),this._currentDocumentRequestCancellationTokenSource=null,s.dispose(),!c)this._setDocumentSemanticTokens(null,null,null,r);else{let{provider:u,tokens:p}=c,h=this._semanticTokensStylingService.getStyling(u);this._setDocumentSemanticTokens(u,p||null,h,r)}},c=>{c&&(so(c)||typeof c.message=="string"&&c.message.indexOf("busy")!==-1)||mt(c),this._currentDocumentRequestCancellationTokenSource=null,s.dispose(),(r.length>0||this._providersChangedDuringRequest)&&(this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model)))})}static _copy(e,t,o,n,r){r=Math.min(r,o.length-n,e.length-t);for(let s=0;s<r;s++)o[n+s]=e[t+s]}_setDocumentSemanticTokens(e,t,o,n){let r=this._currentDocumentResponse,s=()=>{(n.length>0||this._providersChangedDuringRequest)&&!this._fetchDocumentSemanticTokens.isScheduled()&&this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))};if(this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._isDisposed){e&&t&&e.releaseDocumentSemanticTokens(t.resultId);return}if(!e||!o){this._model.tokenization.setSemanticTokens(null,!1);return}if(!t){this._model.tokenization.setSemanticTokens(null,!0),s();return}if(wli(t)){if(!r){this._model.tokenization.setSemanticTokens(null,!0);return}if(t.edits.length===0)t={resultId:t.resultId,data:r.data};else{let l=0;for(let g of t.edits)l+=(g.data?g.data.length:0)-g.deleteCount;let c=r.data,u=new Uint32Array(c.length+l),p=c.length,h=u.length;for(let g=t.edits.length-1;g>=0;g--){let f=t.edits[g];if(f.start>c.length){o.warnInvalidEditStart(r.resultId,t.resultId,g,f.start,c.length),this._model.tokenization.setSemanticTokens(null,!0);return}let v=p-(f.start+f.deleteCount);v>0&&(yO._copy(c,p-v,u,h-v,v),h-=v),f.data&&(yO._copy(f.data,0,u,h-f.data.length,f.data.length),h-=f.data.length),p=f.start}p>0&&yO._copy(c,0,u,0,p),t={resultId:t.resultId,data:u}}}if(g3e(t)){this._currentDocumentResponse=new kli(e,t.resultId,t.data);let l=lxt(t,o,this._model.getLanguageId());if(n.length>0)for(let c of n)for(let u of l)for(let p of c.changes)u.applyEdit(p.range,p.text);this._model.tokenization.setSemanticTokens(l,!0)}else this._model.tokenization.setSemanticTokens(null,!0);s()}};yO=I([m(1,Ale),m(2,De),m(3,jg),m(4,zt)],yO);var kli=class{constructor(i,e,t){this.provider=i;this.resultId=e;this.data=t}dispose(){this.provider.releaseDocumentSemanticTokens(this.resultId)}};Dx(f3e);var $W=class extends C{constructor(e,t,o,n,r,s){super();this._semanticTokensStylingService=t;this._themeService=o;this._configurationService=n;this._editor=e,this._provider=s.documentRangeSemanticTokensProvider,this._debounceInformation=r.for(this._provider,"DocumentRangeSemanticTokens",{min:100,max:500}),this._tokenizeViewport=this._register(new Dt(()=>this._tokenizeViewportNow(),100)),this._outstandingRequests=[],this._rangeProvidersChangeListeners=[];let l=()=>{this._editor.hasModel()&&this._tokenizeViewport.schedule(this._debounceInformation.get(this._editor.getModel()))},c=()=>{if(this._cleanupProviderListeners(),this._editor.hasModel()){let u=this._editor.getModel();for(let p of this._provider.all(u)){let h=p.onDidChange?.(()=>{this._cancelAll(),l()});h&&this._rangeProvidersChangeListeners.push(h)}}};this._register(this._editor.onDidScrollChange(()=>{l()})),this._register(this._editor.onDidChangeModel(()=>{c(),this._cancelAll(),l()})),this._register(this._editor.onDidChangeModelLanguage(()=>{c(),this._cancelAll(),l()})),this._register(this._editor.onDidChangeModelContent(u=>{this._cancelAll(),l()})),c(),this._register(this._provider.onDidChange(()=>{c(),this._cancelAll(),l()})),this._register(this._configurationService.onDidChangeConfiguration(u=>{u.affectsConfiguration(Nle)&&(this._cancelAll(),l())})),this._register(this._themeService.onDidColorThemeChange(()=>{this._cancelAll(),l()})),l()}static{this.ID="editor.contrib.viewportSemanticTokens"}static get(e){return e.getContribution($W.ID)}dispose(){this._cleanupProviderListeners(),super.dispose()}_cleanupProviderListeners(){Ue(this._rangeProvidersChangeListeners),this._rangeProvidersChangeListeners=[]}_cancelAll(){for(let e of this._outstandingRequests)e.cancel();this._outstandingRequests=[]}_removeOutstandingRequest(e){for(let t=0,o=this._outstandingRequests.length;t<o;t++)if(this._outstandingRequests[t]===e){this._outstandingRequests.splice(t,1);return}}_tokenizeViewportNow(){if(!this._editor.hasModel())return;let e=this._editor.getModel();if(e.tokenization.hasCompleteSemanticTokens())return;if(!ZCe(e,this._themeService,this._configurationService)){e.tokenization.hasSomeSemanticTokens()&&e.tokenization.setSemanticTokens(null,!1);return}if(!y6i(this._provider,e)){e.tokenization.hasSomeSemanticTokens()&&e.tokenization.setSemanticTokens(null,!1);return}let t=this._editor.getVisibleRangesPlusViewportAboveBelow();this._outstandingRequests=this._outstandingRequests.concat(t.map(o=>this._requestRange(e,o)))}_requestRange(e,t){let o=e.getVersionId(),n=xn(s=>Promise.resolve(cxt(this._provider,e,t,s))),r=new En(!1);return n.then(s=>{if(this._debounceInformation.update(e,r.elapsed()),!s||!s.tokens||e.isDisposed()||e.getVersionId()!==o)return;let{provider:l,tokens:c}=s,u=this._semanticTokensStylingService.getStyling(l);e.tokenization.setPartialSemanticTokens(t,lxt(c,u,e.getLanguageId()))}).then(()=>this._removeOutstandingRequest(n),()=>this._removeOutstandingRequest(n)),n}};$W=I([m(1,Ale),m(2,De),m(3,B),m(4,jg),m(5,zt)],$W);go($W.ID,$W,1);var dxt=class{constructor(i=!0){this.selectSubwords=i}provideSelectionRanges(i,e){let t=[];for(let o of e){let n=[];t.push(n),this.selectSubwords&&this._addInWordRanges(n,i,o),this._addWordRanges(n,i,o),this._addWhitespaceLine(n,i,o),n.push({range:i.getFullModelRange()})}return t}_addInWordRanges(i,e,t){let o=e.getWordAtPosition(t);if(!o)return;let{word:n,startColumn:r}=o,s=t.column-r,l=s,c=s,u=0;for(;l>=0;l--){let p=n.charCodeAt(l);if(l!==s&&(p===95||p===45))break;if(iU(p)&&Hk(u))break;u=p}for(l+=1;c<n.length;c++){let p=n.charCodeAt(c);if(Hk(p)&&iU(u))break;if(p===95||p===45)break;u=p}l<c&&i.push({range:new z(t.lineNumber,r+l,t.lineNumber,r+c)})}_addWordRanges(i,e,t){let o=e.getWordAtPosition(t);o&&i.push({range:new z(t.lineNumber,o.startColumn,t.lineNumber,o.endColumn)})}_addWhitespaceLine(i,e,t){e.getLineLength(t.lineNumber)>0&&e.getLineFirstNonWhitespaceColumn(t.lineNumber)===0&&e.getLineLastNonWhitespaceColumn(t.lineNumber)===0&&i.push({range:new z(t.lineNumber,1,t.lineNumber,e.getLineMaxColumn(t.lineNumber))})}};var Eli=class a{constructor(i,e){this.index=i;this.ranges=e}mov(i){let e=this.index+(i?1:-1);if(e<0||e>=this.ranges.length)return this;let t=new a(e,this.ranges);return t.ranges[e].equalsRange(this.ranges[this.index])?t.mov(i):t}},wO=class{constructor(i,e){this._editor=i;this._languageFeaturesService=e;this._ignoreSelection=!1}static{this.ID="editor.contrib.smartSelectController"}static get(i){return i.getContribution(wO.ID)}dispose(){this._selectionListener?.dispose()}async run(i){if(!this._editor.hasModel())return;let e=this._editor.getSelections(),t=this._editor.getModel();if(this._state||await C6i(this._languageFeaturesService.selectionRangeProvider,t,e.map(n=>n.getPosition()),this._editor.getOption(129),ve.None).then(n=>{if(!(!dr(n)||n.length!==e.length)&&!(!this._editor.hasModel()||!$i(this._editor.getSelections(),e,(r,s)=>r.equalsSelection(s)))){for(let r=0;r<n.length;r++)n[r]=n[r].filter(s=>s.containsPosition(e[r].getStartPosition())&&s.containsPosition(e[r].getEndPosition())),n[r].unshift(e[r]);this._state=n.map(r=>new Eli(0,r)),this._selectionListener?.dispose(),this._selectionListener=this._editor.onDidChangeCursorPosition(()=>{this._ignoreSelection||(this._selectionListener?.dispose(),this._state=void 0)})}}),!this._state)return;this._state=this._state.map(n=>n.mov(i));let o=this._state.map(n=>Yt.fromPositions(n.ranges[n.index].getStartPosition(),n.ranges[n.index].getEndPosition()));this._ignoreSelection=!0;try{this._editor.setSelections(o)}finally{this._ignoreSelection=!1}}};wO=I([m(1,zt)],wO);var uxt=class extends xi{constructor(i,e){super(e),this._forward=i}async run(i,e){let t=wO.get(e);t&&await t.run(this._forward)}},Tli=class extends uxt{constructor(){super(!0,{id:"editor.action.smartSelect.expand",label:L(1558,"Expand Selection"),precondition:void 0,kbOpts:{kbExpr:ue.editorTextFocus,primary:1553,mac:{primary:3345,secondary:[1297]},weight:100},menuOpts:{menuId:D.MenubarSelectionMenu,group:"1_basic",title:d(1556,null),order:2}})}};qe.registerCommandAlias("editor.action.smartSelect.grow","editor.action.smartSelect.expand");var _li=class extends uxt{constructor(){super(!1,{id:"editor.action.smartSelect.shrink",label:L(1559,"Shrink Selection"),precondition:void 0,kbOpts:{kbExpr:ue.editorTextFocus,primary:1551,mac:{primary:3343,secondary:[1295]},weight:100},menuOpts:{menuId:D.MenubarSelectionMenu,group:"1_basic",title:d(1557,null),order:3}})}};go(wO.ID,wO,4);Jt(Tli);Jt(_li);async function C6i(a,i,e,t,o){let n=a.all(i).concat(new dxt(t.selectSubwords));n.length===1&&n.unshift(new wCe);let r=[],s=[];for(let l of n)r.push(Promise.resolve(l.provideSelectionRanges(i,e,o)).then(c=>{if(dr(c)&&c.length===e.length)for(let u=0;u<e.length;u++){s[u]||(s[u]=[]);for(let p of c[u])z.isIRange(p.range)&&z.containsPosition(p.range,e[u])&&s[u].push(z.lift(p.range))}},ss));return await Promise.all(r),s.map(l=>{if(l.length===0)return[];l.sort((h,g)=>Ie.isBefore(h.getStartPosition(),g.getStartPosition())?1:Ie.isBefore(g.getStartPosition(),h.getStartPosition())||Ie.isBefore(h.getEndPosition(),g.getEndPosition())?-1:Ie.isBefore(g.getEndPosition(),h.getEndPosition())?1:0);let c=[],u;for(let h of l)(!u||z.containsRange(h,u)&&!z.equalsRange(h,u))&&(c.push(h),u=h);if(!t.selectLeadingAndTrailingWhitespace)return c;let p=[c[0]];for(let h=1;h<c.length;h++){let g=c[h-1],f=c[h];if(f.startLineNumber!==g.startLineNumber||f.endLineNumber!==g.endLineNumber){let v=new z(g.startLineNumber,i.getLineFirstNonWhitespaceColumn(g.startLineNumber),g.endLineNumber,i.getLineLastNonWhitespaceColumn(g.endLineNumber));v.containsRange(g)&&!v.equalsRange(g)&&f.containsRange(v)&&!f.equalsRange(v)&&p.push(v);let b=new z(g.startLineNumber,1,g.endLineNumber,i.getLineMaxColumn(g.endLineNumber));b.containsRange(g)&&!b.equalsRange(v)&&f.containsRange(b)&&!f.equalsRange(b)&&p.push(b)}p.push(f)}return p})}qe.registerCommand("_executeSelectionRangeProvider",async function(a,...i){let[e,t]=i;So(A.isUri(e)),So(N6t(t,r=>Ie.isIPosition(r)));let o=a.get(zt).selectionRangeProvider,n=await a.get(Nt).createModelReference(e);try{return C6i(o,n.object.textEditorModel,t.map(Ie.lift),{selectLeadingAndTrailingWhitespace:!0,selectSubwords:!0},ve.None)}finally{n.dispose()}});var We=Object.freeze({View:L(1802,"View"),Help:L(1799,"Help"),Test:L(1801,"Test"),File:L(1798,"File"),Preferences:L(1800,"Preferences"),Developer:L(1797,"Developer")});var pxt=class extends wl{constructor(){super({id:"editor.action.toggleStickyScroll",title:{...L(1611,"Toggle Editor Sticky Scroll"),mnemonicTitle:d(1606,null)},metadata:{description:L(1612,"Toggle/enable the editor sticky scroll which shows the nested scopes at the top of the viewport")},category:We.View,toggled:{condition:x.equals("config.editor.stickyScroll.enabled",!0),title:d(1610,null),mnemonicTitle:d(1605,null)},menu:[{id:D.CommandPalette},{id:D.MenubarAppearanceMenu,group:"4_editor",order:3},{id:D.StickyScrollContext}]})}async runEditorCommand(i,e){let t=i.get(B),o=!t.getValue("editor.stickyScroll.enabled"),n=rb.get(e)?.isFocused();t.updateValue("editor.stickyScroll.enabled",o),n&&e.focus()}},bxt=100,mxt=class extends wl{constructor(){super({id:"editor.action.focusStickyScroll",title:{...L(1602,"Focus Editor Sticky Scroll"),mnemonicTitle:d(1604,null)},precondition:x.and(x.has("config.editor.stickyScroll.enabled"),ue.stickyScrollVisible),menu:[{id:D.CommandPalette}]})}runEditorCommand(i,e){rb.get(e)?.focus()}},hxt=class extends wl{constructor(){super({id:"editor.action.selectNextStickyScrollLine",title:L(1608,"Select the next editor sticky scroll line"),precondition:ue.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:bxt,primary:18}})}runEditorCommand(i,e){rb.get(e)?.focusNext()}},gxt=class extends wl{constructor(){super({id:"editor.action.selectPreviousStickyScrollLine",title:L(1609,"Select the previous sticky scroll line"),precondition:ue.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:bxt,primary:16}})}runEditorCommand(i,e){rb.get(e)?.focusPrevious()}},fxt=class extends wl{constructor(){super({id:"editor.action.goToFocusedStickyScrollLine",title:L(1603,"Go to the focused sticky scroll line"),precondition:ue.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:bxt,primary:3}})}runEditorCommand(i,e){rb.get(e)?.goToFocused()}},vxt=class extends wl{constructor(){super({id:"editor.action.selectEditor",title:L(1607,"Select Editor"),precondition:ue.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:bxt,primary:9}})}runEditorCommand(i,e){rb.get(e)?.selectEditor()}};go(rb.ID,rb,1);W(pxt);W(mxt);W(gxt);W(hxt);W(fxt);W(vxt);var Dli=class{constructor(i,e,t,o,n,r,s){this.range=i;this.insertText=e;this.filterText=t;this.additionalTextEdits=o;this.command=n;this.gutterMenuLinkAction=r;this.completion=s;this.doNotLog=!0}},v3e=class extends qH{constructor(e,t,o,n,r,s){super(r.disposable);this.model=e;this.line=t;this.word=o;this.completionModel=n;this._suggestMemoryService=s}canBeReused(e,t,o){return this.model===e&&this.line===t&&this.word.word.length>0&&this.word.startColumn===o.startColumn&&this.word.endColumn<o.endColumn&&this.completionModel.getIncompleteProvider().size===0}get items(){let e=[],{items:t}=this.completionModel,o=this._suggestMemoryService.select(this.model,{lineNumber:this.line,column:this.word.endColumn+this.completionModel.lineContext.characterCountDelta},t),n=ht.slice(t,o),r=ht.slice(t,0,o),s=5;for(let l of ht.concat(n,r)){if(l.score===uv.Default)continue;let c=new z(l.editStart.lineNumber,l.editStart.column,l.editInsertEnd.lineNumber,l.editInsertEnd.column+this.completionModel.lineContext.characterCountDelta),u=l.completion.insertTextRules&&l.completion.insertTextRules&4?{snippet:l.completion.insertText}:l.completion.insertText;e.push(new Dli(c,u,l.filterTextLow??l.labelLow,l.completion.additionalTextEdits,l.completion.command,l.completion.action,l)),s-->=0&&l.resolve(ve.None)}return e}};v3e=I([m(5,yCe)],v3e);var b3e=class extends C{constructor(e,t,o,n){super();this._languageFeatureService=e;this._clipboardService=t;this._suggestMemoryService=o;this._editorService=n;this._store.add(e.inlineCompletionsProvider.register("*",this))}async provideInlineCompletions(e,t,o,n){if(o.selectedSuggestionInfo)return;let r;for(let f of this._editorService.listCodeEditors())if(f.getModel()===e){r=f;break}if(!r)return;let s=r.getOption(102);if(FW.isAllOff(s))return;e.tokenization.tokenizeIfCheap(t.lineNumber);let l=e.tokenization.getLineTokens(t.lineNumber),c=l.getStandardTokenType(l.findTokenIndexAtOffset(Math.max(t.column-1-1,0)));if(FW.valueFor(s,c)!=="inline")return;let u=e.getWordAtPosition(t),p;if(u?.word||(p=this._getTriggerCharacterInfo(e,t)),!u?.word&&!p||(u||(u=e.getWordUntilPosition(t)),u.endColumn!==t.column))return;let h,g=e.getValueInRange(new z(t.lineNumber,1,t.lineNumber,t.column));if(!p&&this._lastResult?.canBeReused(e,t.lineNumber,u)){let f=new V4e(g,t.column-this._lastResult.word.endColumn);this._lastResult.completionModel.lineContext=f,this._lastResult.acquire(),h=this._lastResult}else{let f=await Sle(this._languageFeatureService.completionProvider,e,t,new Jq(void 0,Q1.createSuggestFilter(r).itemKind,p?.providers),p&&{triggerKind:1,triggerCharacter:p.ch},n),v;f.needsClipboard&&(v=await this._clipboardService.readText());let b=new xCe(f.items,t.column,new V4e(g,0),CCe.None,r.getOption(134),r.getOption(128),{boostFullMatch:!1,firstMatchCanBeWeak:!1},v);h=new v3e(e,t.lineNumber,u,b,f,this._suggestMemoryService)}return this._lastResult=h,h}handleItemDidShow(e,t){t.completion.resolve(ve.None)}disposeInlineCompletions(e){e.release()}_getTriggerCharacterInfo(e,t){let o=e.getValueInRange(z.fromPositions({lineNumber:t.lineNumber,column:t.column-1},t)),n=new Set;for(let r of this._languageFeatureService.completionProvider.all(e))r.triggerCharacters?.includes(o)&&n.add(r);if(n.size!==0)return{providers:n,ch:o}}};b3e=I([m(0,zt),m(1,Wi),m(2,yCe),m(3,Kt)],b3e);Dx(b3e);var Lli=class extends xi{constructor(){super({id:"editor.action.forceRetokenize",label:L(1689,"Developer: Force Retokenize"),precondition:void 0})}run(i,e){if(!e.hasModel())return;let t=e.getModel();t.tokenization.resetTokenization();let o=new En;t.tokenization.forceTokenization(t.getLineCount()),o.stop(),console.log(`tokenization took ${o.elapsed()}`)}};Jt(Lli);var S3e=class a extends K{static{this.ID="editor.action.toggleTabFocusMode"}constructor(){super({id:a.ID,title:L(1686,"Toggle Tab Key Moves Focus"),precondition:void 0,keybinding:{primary:2091,mac:{primary:1323},weight:100},metadata:{description:L(1685,"Determines whether the tab key moves focus around the workbench or inserts the tab character in the current editor. This is also called tab trapping, tab navigation, or tab focus mode.")},f1:!0})}run(){let e=!GT.getTabFocusMode();GT.setTabFocusMode(e),e?Jo(d(1688,null)):Jo(d(1687,null))}};W(S3e);var Xg=class extends C{constructor(e,t,o={},n,r){super();this._link=t;this._hoverService=n;this._enabled=!0;this.el=R(e,_("a.monaco-link",{tabIndex:t.tabIndex??0,href:t.href},t.label)),this.hoverDelegate=o.hoverDelegate??Ni("mouse"),this.setTooltip(t.title),this.el.setAttribute("role","button");let s=this._register(new On(this.el,"click")),l=this._register(new On(this.el,"keydown")),c=H.chain(l.event,h=>h.map(g=>new Ii(g)).filter(g=>g.keyCode===3||g.keyCode===10)),u=this._register(new On(this.el,Gn.Tap)).event;this._register(ws.addTarget(this.el));let p=H.any(s.event,c,u);this._register(p(h=>{this.enabled&&($t.stop(h,!0),o?.opener?o.opener(this._link.href):r.open(this._link.href,{allowCommands:!0}))})),this.enabled=!0}get enabled(){return this._enabled}set enabled(e){e?(this.el.setAttribute("aria-disabled","false"),this.el.tabIndex=0,this.el.style.pointerEvents="auto",this.el.style.opacity="1",this.el.style.cursor="pointer",this._enabled=!1):(this.el.setAttribute("aria-disabled","true"),this.el.tabIndex=-1,this.el.style.pointerEvents="none",this.el.style.opacity="0.4",this.el.style.cursor="default",this._enabled=!0),this._enabled=e}set link(e){typeof e.label=="string"?this.el.textContent=e.label:(Rt(this.el),this.el.appendChild(e.label)),this.el.href=e.href,typeof e.tabIndex<"u"&&(this.el.tabIndex=e.tabIndex),this.setTooltip(e.title),this._link=e}setTooltip(e){!this.hover&&e?this.hover=this._register(this._hoverService.setupManagedHover(this.hoverDelegate,this.el,e)):this.hover&&this.hover.update(e)}};Xg=I([m(3,tt),m(4,Qe)],Xg);var IHo=26,exe=class extends C{constructor(e,t){super();this._editor=e;this.instantiationService=t;this.banner=this._register(this.instantiationService.createInstance(I3e))}hide(){this._editor.setBanner(null,0),this.banner.clear()}show(e){this.banner.show({...e,onClose:()=>{this.hide(),e.onClose?.()}}),this._editor.setBanner(this.banner.element,IHo)}};exe=I([m(1,F)],exe);var I3e=class extends C{constructor(e,t){super();this.instantiationService=e;this.markdownRendererService=t;this.element=_("div.editor-banner"),this.element.tabIndex=0}getAriaLabel(e){if(e.ariaLabel)return e.ariaLabel;if(typeof e.message=="string")return e.message}getBannerMessage(e){if(typeof e=="string"){let t=_("span");return t.innerText=e,t}return this.markdownRendererService.render(e).element}clear(){Rt(this.element)}show(e){Rt(this.element);let t=this.getAriaLabel(e);t&&this.element.setAttribute("aria-label",t);let o=R(this.element,_("div.icon-container"));o.setAttribute("aria-hidden","true"),e.icon&&o.appendChild(_(`div${q.asCSSSelector(e.icon)}`));let n=R(this.element,_("div.message-container"));if(n.setAttribute("aria-hidden","true"),n.appendChild(this.getBannerMessage(e.message)),this.messageActionsContainer=R(this.element,_("div.message-actions-container")),e.actions)for(let s of e.actions)this._register(this.instantiationService.createInstance(Xg,this.messageActionsContainer,{...s,tabIndex:-1},{}));let r=R(this.element,_("div.action-container"));this.actionBar=this._register(new ji(r)),this.actionBar.push(this._register(new st("banner.close",d(1690,null),q.asClassName(lE),!0,()=>{typeof e.onClose=="function"&&e.onClose()})),{icon:!0,label:!1}),this.actionBar.setFocusable(!1)}};I3e=I([m(0,F),m(1,Qn)],I3e);var BL=ae("workspaceTrustEnablementService"),ns=ae("workspaceTrustManagementService");var Vd=ae("workspaceTrustRequestService");var yHo=Re("extensions-warning-message",M.warning,d(1714,null)),Ole=class extends C{constructor(e,t,o,n){super();this._editor=e;this._editorWorkerService=t;this._workspaceTrustService=o;this._highlighter=null;this._bannerClosed=!1;this._updateState=e=>{if(e&&e.hasMore){if(this._bannerClosed)return;let t=Math.max(e.ambiguousCharacterCount,e.nonBasicAsciiCharacterCount,e.invisibleCharacterCount),o;if(e.nonBasicAsciiCharacterCount>=t)o={message:d(1713,null),command:new x3e};else if(e.ambiguousCharacterCount>=t)o={message:d(1711,null),command:new Fle};else if(e.invisibleCharacterCount>=t)o={message:d(1712,null),command:new C3e};else throw new Error("Unreachable");this._bannerController.show({id:"unicodeHighlightBanner",message:o.message,icon:yHo,actions:[{label:o.command.shortLabel,href:`command:${o.command.desc.id}`}],onClose:()=>{this._bannerClosed=!0}})}else this._bannerController.hide()};this._bannerController=this._register(n.createInstance(exe,e)),this._register(this._editor.onDidChangeModel(()=>{this._bannerClosed=!1,this._updateHighlighter()})),this._options=e.getOption(142),this._register(o.onDidChangeTrust(r=>{this._updateHighlighter()})),this._register(e.onDidChangeConfiguration(r=>{r.hasChanged(142)&&(this._options=e.getOption(142),this._updateHighlighter())})),this._updateHighlighter()}static{this.ID="editor.contrib.unicodeHighlighter"}dispose(){this._highlighter&&(this._highlighter.dispose(),this._highlighter=null),super.dispose()}_updateHighlighter(){if(this._updateState(null),this._highlighter&&(this._highlighter.dispose(),this._highlighter=null),!this._editor.hasModel())return;let e=wHo(this._workspaceTrustService.isWorkspaceTrusted(),this._options);if([e.nonBasicASCII,e.ambiguousCharacters,e.invisibleCharacters].every(o=>o===!1))return;let t={nonBasicASCII:e.nonBasicASCII,ambiguousCharacters:e.ambiguousCharacters,invisibleCharacters:e.invisibleCharacters,includeComments:e.includeComments,includeStrings:e.includeStrings,allowedCodePoints:Object.keys(e.allowedCharacters).map(o=>o.codePointAt(0)),allowedLocales:Object.keys(e.allowedLocales).map(o=>o==="_os"?Wu.NumberFormat().value.resolvedOptions().locale:o==="_vscode"?Dr:o)};this._editorWorkerService.canComputeUnicodeHighlights(this._editor.getModel().uri)?this._highlighter=new y3e(this._editor,t,this._updateState,this._editorWorkerService):this._highlighter=new Mli(this._editor,t,this._updateState)}getDecorationInfo(e){return this._highlighter?this._highlighter.getDecorationInfo(e):null}};Ole=I([m(1,$s),m(2,ns),m(3,F)],Ole);function wHo(a,i){return{nonBasicASCII:i.nonBasicASCII===zT?!a:i.nonBasicASCII,ambiguousCharacters:i.ambiguousCharacters,invisibleCharacters:i.invisibleCharacters,includeComments:i.includeComments===zT?!a:i.includeComments,includeStrings:i.includeStrings===zT?!a:i.includeStrings,allowedCharacters:i.allowedCharacters,allowedLocales:i.allowedLocales}}var y3e=class extends C{constructor(e,t,o,n){super();this._editor=e;this._options=t;this._updateState=o;this._editorWorkerService=n;this._model=this._editor.getModel(),this._decorations=this._editor.createDecorationsCollection(),this._updateSoon=this._register(new Dt(()=>this._update(),250)),this._register(this._editor.onDidChangeModelContent(()=>{this._updateSoon.schedule()})),this._updateSoon.schedule()}dispose(){this._decorations.clear(),super.dispose()}_update(){if(this._model.isDisposed())return;if(!this._model.mightContainNonBasicASCII()){this._decorations.clear();return}let e=this._model.getVersionId();this._editorWorkerService.computedUnicodeHighlights(this._model.uri,this._options).then(t=>{if(this._model.isDisposed()||this._model.getVersionId()!==e)return;this._updateState(t);let o=[];if(!t.hasMore)for(let n of t.ranges)o.push({range:n,options:Sxt.instance.getDecorationFromOptions(this._options)});this._decorations.set(o)})}getDecorationInfo(e){if(!this._decorations.has(e))return null;let t=this._editor.getModel();if(!$$e(t,e))return null;let o=t.getValueInRange(e.range);return{reason:k6i(o,this._options),inComment:kgt(t,e),inString:Egt(t,e)}}};y3e=I([m(3,$s)],y3e);var Mli=class extends C{constructor(e,t,o){super();this._editor=e;this._options=t;this._updateState=o;this._model=this._editor.getModel(),this._decorations=this._editor.createDecorationsCollection(),this._updateSoon=this._register(new Dt(()=>this._update(),250)),this._register(this._editor.onDidLayoutChange(()=>{this._updateSoon.schedule()})),this._register(this._editor.onDidScrollChange(()=>{this._updateSoon.schedule()})),this._register(this._editor.onDidChangeHiddenAreas(()=>{this._updateSoon.schedule()})),this._register(this._editor.onDidChangeModelContent(()=>{this._updateSoon.schedule()})),this._updateSoon.schedule()}dispose(){this._decorations.clear(),super.dispose()}_update(){if(this._model.isDisposed())return;if(!this._model.mightContainNonBasicASCII()){this._decorations.clear();return}let e=this._editor.getVisibleRanges(),t=[],o={ranges:[],ambiguousCharacterCount:0,invisibleCharacterCount:0,nonBasicAsciiCharacterCount:0,hasMore:!1};for(let n of e){let r=Ise.computeUnicodeHighlights(this._model,this._options,n);for(let s of r.ranges)o.ranges.push(s);o.ambiguousCharacterCount+=o.ambiguousCharacterCount,o.invisibleCharacterCount+=o.invisibleCharacterCount,o.nonBasicAsciiCharacterCount+=o.nonBasicAsciiCharacterCount,o.hasMore=o.hasMore||r.hasMore}if(!o.hasMore)for(let n of o.ranges)t.push({range:n,options:Sxt.instance.getDecorationFromOptions(this._options)});this._updateState(o),this._decorations.set(t)}getDecorationInfo(e){if(!this._decorations.has(e))return null;let t=this._editor.getModel(),o=t.getValueInRange(e.range);return $$e(t,e)?{reason:k6i(o,this._options),inComment:kgt(t,e),inString:Egt(t,e)}:null}};var x6i=d(1703,null),w3e=class{constructor(i,e){this._editor=i;this._markdownRendererService=e;this.hoverOrdinal=5}computeSync(i,e){if(!this._editor.hasModel()||i.type!==1)return[];let t=this._editor.getModel(),o=this._editor.getContribution(Ole.ID);if(!o)return[];let n=[],r=new Set,s=300;for(let l of e){let c=o.getDecorationInfo(l);if(!c)continue;let p=t.getValueInRange(l.range).codePointAt(0),h=Rli(p),g;switch(c.reason.kind){case 0:{oU(c.reason.confusableWith)?g=d(1700,null,h,Rli(c.reason.confusableWith.codePointAt(0))):g=d(1699,null,h,Rli(c.reason.confusableWith.codePointAt(0)));break}case 1:g=d(1701,null,h);break;case 2:g=d(1702,null,h);break}if(r.has(g))continue;r.add(g);let f={codePoint:p,reason:c.reason,inComment:c.inComment,inString:c.inString},v=d(1697,null),b=ic(Ixt.ID,f),S=new xe("",!0).appendMarkdown(g).appendText(" ").appendLink(b,v,x6i);n.push(new vE(this,l.range,[S],!1,s++))}return n}renderHoverParts(i,e){return z3i(i,e,this._editor,this._markdownRendererService)}getAccessibleContent(i){return i.contents.map(e=>e.value).join(`
`)}};w3e=I([m(1,Qn)],w3e);function Pli(a){return`U+${a.toString(16).padStart(4,"0")}`}function Rli(a){let i=`\`${Pli(a)}\``;return K0.isInvisibleCharacter(a)||(i+=` "${`${CHo(a)}`}"`),i}function CHo(a){return a===96?"`` ` ``":"`"+String.fromCodePoint(a)+"`"}function k6i(a,i){return Ise.computeUnicodeHighlightReason(a,i)}var Sxt=class a{constructor(){this.map=new Map}static{this.instance=new a}getDecorationFromOptions(i){return this.getDecoration(!i.includeComments,!i.includeStrings)}getDecoration(i,e){let t=`${i}${e}`,o=this.map.get(t);return o||(o=po.createDynamic({description:"unicode-highlight",stickiness:1,className:"unicode-highlight",showIfCollapsed:!0,overviewRuler:null,minimap:null,hideInCommentTokens:i,hideInStringTokens:e}),this.map.set(t,o)),o}},Ali=class extends xi{constructor(){super({id:Fle.ID,label:L(1691,"Disable highlighting of characters in comments"),precondition:void 0});this.shortLabel=d(1704,null)}static{this.ID="editor.action.unicodeHighlight.disableHighlightingInComments"}async run(e,t){let o=e.get(B);o&&this.runAction(o)}async runAction(e){await e.updateValue(px.includeComments,!1,2)}},Nli=class extends xi{constructor(){super({id:Fle.ID,label:L(1692,"Disable highlighting of characters in strings"),precondition:void 0});this.shortLabel=d(1705,null)}static{this.ID="editor.action.unicodeHighlight.disableHighlightingInStrings"}async run(e,t){let o=e.get(B);o&&this.runAction(o)}async runAction(e){await e.updateValue(px.includeStrings,!1,2)}},Fle=class a extends K{constructor(){super({id:a.ID,title:L(1693,"Disable highlighting of ambiguous characters"),precondition:void 0,f1:!1});this.shortLabel=d(1706,null)}static{this.ID="editor.action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters"}async run(e,t){let o=e.get(B);o&&this.runAction(o)}async runAction(e){await e.updateValue(px.ambiguousCharacters,!1,2)}},C3e=class a extends K{constructor(){super({id:a.ID,title:L(1694,"Disable highlighting of invisible characters"),precondition:void 0,f1:!1});this.shortLabel=d(1707,null)}static{this.ID="editor.action.unicodeHighlight.disableHighlightingOfInvisibleCharacters"}async run(e,t){let o=e.get(B);o&&this.runAction(o)}async runAction(e){await e.updateValue(px.invisibleCharacters,!1,2)}},x3e=class a extends K{constructor(){super({id:a.ID,title:L(1695,"Disable highlighting of non basic ASCII characters"),precondition:void 0,f1:!1});this.shortLabel=d(1708,null)}static{this.ID="editor.action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters"}async run(e,t){let o=e.get(B);o&&this.runAction(o)}async runAction(e){await e.updateValue(px.nonBasicASCII,!1,2)}},Ixt=class a extends K{static{this.ID="editor.action.unicodeHighlight.showExcludeOptions"}constructor(){super({id:a.ID,title:L(1696,"Show Exclude Options"),precondition:void 0,f1:!1})}async run(i,e){let{codePoint:t,reason:o,inString:n,inComment:r}=e,s=String.fromCodePoint(t),l=i.get(Ge),c=i.get(B);function u(f){return K0.isInvisibleCharacter(f)?d(1710,null,Pli(f)):d(1709,null,`${Pli(f)} "${s}"`)}let p=[];if(o.kind===0)for(let f of o.notAmbiguousInLocales)p.push({label:d(1698,null,f),run:async()=>{kHo(c,[f])}});if(p.push({label:u(t),run:()=>xHo(c,[t])}),r){let f=new Ali;p.push({label:f.label,run:async()=>f.runAction(c)})}else if(n){let f=new Nli;p.push({label:f.label,run:async()=>f.runAction(c)})}function h(f){return typeof f.desc.title=="string"?f.desc.title:f.desc.title.value}if(o.kind===0){let f=new Fle;p.push({label:h(f),run:async()=>f.runAction(c)})}else if(o.kind===1){let f=new C3e;p.push({label:h(f),run:async()=>f.runAction(c)})}else if(o.kind===2){let f=new x3e;p.push({label:h(f),run:async()=>f.runAction(c)})}else EHo(o);let g=await l.pick(p,{title:x6i});g&&await g.run()}};async function xHo(a,i){let e=a.getValue(px.allowedCharacters),t;typeof e=="object"&&e?t=e:t={};for(let o of i)t[String.fromCodePoint(o)]=!0;await a.updateValue(px.allowedCharacters,t,2)}async function kHo(a,i){let e=a.inspect(px.allowedLocales).user?.value,t;typeof e=="object"&&e?t=Object.assign({},e):t={};for(let o of i)t[o]=!0;await a.updateValue(px.allowedLocales,t,2)}function EHo(a){throw new Error(`Unexpected value: ${a}`)}W(Fle);W(C3e);W(x3e);W(Ixt);go(Ole.ID,Ole,1);d_.register(w3e);var E6i="ignoreUnusualLineTerminators";function THo(a,i,e){a.setModelProperty(i.uri,E6i,e)}function _Ho(a,i){return a.getModelProperty(i.uri,E6i)}var oY=class extends C{constructor(e,t,o){super();this._editor=e;this._dialogService=t;this._codeEditorService=o;this._isPresentingDialog=!1;this._config=this._editor.getOption(143),this._register(this._editor.onDidChangeConfiguration(n=>{n.hasChanged(143)&&(this._config=this._editor.getOption(143),this._checkForUnusualLineTerminators())})),this._register(this._editor.onDidChangeModel(()=>{this._checkForUnusualLineTerminators()})),this._register(this._editor.onDidChangeModelContent(n=>{n.isUndoing||this._checkForUnusualLineTerminators()})),this._checkForUnusualLineTerminators()}static{this.ID="editor.contrib.unusualLineTerminatorsDetector"}async _checkForUnusualLineTerminators(){if(this._config==="off"||!this._editor.hasModel())return;let e=this._editor.getModel();if(!e.mightContainUnusualLineTerminators()||_Ho(this._codeEditorService,e)===!0||this._editor.getOption(104))return;if(this._config==="auto"){e.removeUnusualLineTerminators(this._editor.getSelections());return}if(this._isPresentingDialog)return;let o;try{this._isPresentingDialog=!0,o=await this._dialogService.confirm({title:d(1719,null),message:d(1718,null),detail:d(1715,null,Ye(e.uri)),primaryButton:d(1716,null),cancelButton:d(1717,null)})}finally{this._isPresentingDialog=!1}if(!o.confirmed){THo(this._codeEditorService,e,!0);return}e.removeUnusualLineTerminators(this._editor.getSelections())}};oY=I([m(1,ct),m(2,Kt)],oY);go(oY.ID,oY,1);function Wli(){return Object.create(null)}var k3e="**",T6i="/",yxt="[/\\\\]",wxt="[^/\\\\]",DHo=/\//g;function _6i(a,i){switch(a){case 0:return"";case 1:return`${wxt}*?`;default:return`(?:${yxt}|${wxt}+${yxt}${i?`|${yxt}${wxt}+`:""})*?`}}function HL(a,i){if(!a)return[];let e=[],t=!1,o=!1,n="";for(let r of a){switch(r){case i:if(!t&&!o){e.push(n),n="";continue}break;case"{":t=!0;break;case"}":t=!1;break;case"[":o=!0;break;case"]":o=!1;break}n+=r}return n&&e.push(n),e}function M6i(a){if(!a)return"";let i="",e=HL(a,T6i);if(e.every(t=>t===k3e))i=".*";else{let t=!1;e.forEach((o,n)=>{if(o===k3e){if(t)return;i+=_6i(2,n===e.length-1)}else{let r=!1,s="",l=!1,c="";for(let u of o){if(u!=="}"&&r){s+=u;continue}if(l&&(u!=="]"||!c)){let p;u==="-"?p=u:(u==="^"||u==="!")&&!c?p="^":u===T6i?p="":p=Yr(u),c+=p;continue}switch(u){case"{":r=!0;continue;case"[":l=!0;continue;case"}":{let h=`(?:${HL(s,",").map(g=>M6i(g)).join("|")})`;i+=h,r=!1,s="";break}case"]":{i+="["+c+"]",l=!1,c="";break}case"?":i+=wxt;continue;case"*":i+=_6i(1);continue;default:i+=Yr(u)}}n<e.length-1&&(e[n+1]!==k3e||n+2<e.length)&&(i+=yxt)}t=o===k3e})}return i}var LHo=/^\*\*\/\*\.[\w\.-]+$/,RHo=/^\*\*\/([\w\.-]+)\/?$/,MHo=/^{\*\*\/\*?[\w\.-]+\/?(,\*\*\/\*?[\w\.-]+\/?)*}$/,PHo=/^{\*\*\/\*?[\w\.-]+(\/(\*\*)?)?(,\*\*\/\*?[\w\.-]+(\/(\*\*)?)?)*}$/,AHo=/^\*\*((\/[\w\.-]+)+)\/?$/,NHo=/^([\w\.-]+(\/[\w\.-]+)*)\/?$/,D6i=new il(1e4),Fli=function(){return!1},qW=function(){return null};function Vli(a){return a===Fli||a===qW}function Bli(a,i){if(!a)return qW;let e;typeof a!="string"?e=a.pattern:e=a,e=e.trim();let t=i.ignoreCase??!1,o={...i,equals:t?mr:(l,c)=>l===c,endsWith:t?gpt:(l,c)=>l.endsWith(c),isEqualOrParent:(l,c)=>rU(l,c,!Wn||t)},n=`${t?e.toLowerCase():e}_${!!i.trimForExclusions}_${t}`,r=D6i.get(n);if(r)return L6i(r,a,o);let s;return LHo.test(e)?r=OHo(e.substring(4),e,o):(s=RHo.exec(Oli(e,o)))?r=FHo(s[1],e,o):(i.trimForExclusions?PHo:MHo).test(e)?r=WHo(e,o):(s=AHo.exec(Oli(e,o)))?r=R6i(s[1].substring(1),e,!0,o):(s=NHo.exec(Oli(e,o)))?r=R6i(s[1],e,!1,o):r=VHo(e,o),D6i.set(n,r),L6i(r,a,o)}function L6i(a,i,e){if(typeof i=="string")return a;let t=function(o,n){return e.isEqualOrParent(o,i.base)?a(Hw(o.substring(i.base.length),Rd),n):null};return t.allBasenames=a.allBasenames,t.allPaths=a.allPaths,t.basenames=a.basenames,t.patterns=a.patterns,t}function Oli(a,i){return i.trimForExclusions&&a.endsWith("/**")?a.substring(0,a.length-2):a}function OHo(a,i,e){return function(t,o){return typeof t=="string"&&e.endsWith(t,a)?i:null}}function FHo(a,i,e){let t=`/${a}`,o=`\\${a}`,n=function(s,l){return typeof s!="string"?null:l?e.equals(l,a)?i:null:e.equals(s,a)||e.endsWith(s,t)||e.endsWith(s,o)?i:null},r=[a];return n.basenames=r,n.patterns=[i],n.allBasenames=r,n}function WHo(a,i){let e=P6i(a.slice(1,-1).split(",").map(s=>Bli(s,i)).filter(s=>s!==qW),a),t=e.length;if(!t)return qW;if(t===1)return e[0];let o=function(s,l){for(let c=0,u=e.length;c<u;c++)if(e[c](s,l))return a;return null},n=e.find(s=>!!s.allBasenames);n&&(o.allBasenames=n.allBasenames);let r=e.reduce((s,l)=>l.allPaths?s.concat(l.allPaths):s,[]);return r.length&&(o.allPaths=r),o}function R6i(a,i,e,t){let o=Rd===Lo.sep,n=o?a:a.replace(DHo,Rd),r=Rd+n,s=Lo.sep+a,l;return e?l=function(c,u){return typeof c=="string"&&(t.equals(c,n)||t.endsWith(c,r)||!o&&(t.equals(c,a)||t.endsWith(c,s)))?i:null}:l=function(c,u){return typeof c=="string"&&(t.equals(c,n)||!o&&t.equals(c,a))?i:null},l.allPaths=[(e?"*/":"./")+a],l}function VHo(a,i){try{let e=new RegExp(`^${M6i(a)}$`,i.ignoreCase?"i":void 0);return function(t){return e.lastIndex=0,typeof t=="string"&&e.test(t)?a:null}}catch{return qW}}function Cp(a,i,e){return!a||typeof i!="string"?!1:zm(a,e)(i)}function zm(a,i={}){if(!a)return Fli;if(typeof a=="string"||eP(a)){let e=Bli(a,i);if(e===qW)return Fli;let t=function(o,n){return!!e(o,n)};return e.allBasenames&&(t.allBasenames=e.allBasenames),e.allPaths&&(t.allPaths=e.allPaths),t}return BHo(a,i)}function eP(a){let i=a;return i?typeof i.base=="string"&&typeof i.pattern=="string":!1}function BHo(a,i){let e=P6i(Object.getOwnPropertyNames(a).map(s=>HHo(s,a[s],i)).filter(s=>s!==qW)),t=e.length;if(!t)return qW;if(!e.some(s=>!!s.requiresSiblings)){if(t===1)return e[0];let s=function(u,p){let h;for(let g=0,f=e.length;g<f;g++){let v=e[g](u,p);if(typeof v=="string")return v;FT(v)&&(h||(h=[]),h.push(v))}return h?(async()=>{for(let g of h){let f=await g;if(typeof f=="string")return f}return null})():null},l=e.find(u=>!!u.allBasenames);l&&(s.allBasenames=l.allBasenames);let c=e.reduce((u,p)=>p.allPaths?u.concat(p.allPaths):u,[]);return c.length&&(s.allPaths=c),s}let o=function(s,l,c){let u,p;for(let h=0,g=e.length;h<g;h++){let f=e[h];f.requiresSiblings&&c&&(l||(l=No(s)),u||(u=l.substring(0,l.length-Am(s).length)));let v=f(s,l,u,c);if(typeof v=="string")return v;FT(v)&&(p||(p=[]),p.push(v))}return p?(async()=>{for(let h of p){let g=await h;if(typeof g=="string")return g}return null})():null},n=e.find(s=>!!s.allBasenames);n&&(o.allBasenames=n.allBasenames);let r=e.reduce((s,l)=>l.allPaths?s.concat(l.allPaths):s,[]);return r.length&&(o.allPaths=r),o}function HHo(a,i,e){if(i===!1)return qW;let t=Bli(a,e);if(t===qW)return qW;if(typeof i=="boolean")return t;if(i){let o=i.when;if(typeof o=="string"){let n=(r,s,l,c)=>{if(!c||!t(r,s))return null;let u=o.replace("$(basename)",()=>l),p=c(u);return FT(p)?p.then(h=>h?a:null):p?a:null};return n.requiresSiblings=!0,n}}return t}function P6i(a,i){let e=a.filter(s=>!!s.basenames);if(e.length<2)return a;let t=e.reduce((s,l)=>{let c=l.basenames;return c?s.concat(c):s},[]),o;if(i){o=[];for(let s=0,l=t.length;s<l;s++)o.push(i)}else o=e.reduce((s,l)=>{let c=l.patterns;return c?s.concat(c):s},[]);let n=function(s,l){if(typeof s!="string")return null;if(!l){let u;for(u=s.length;u>0;u--){let p=s.charCodeAt(u-1);if(p===47||p===92)break}l=s.substring(u)}let c=t.indexOf(l);return c!==-1?o[c]:null};n.basenames=t,n.patterns=o,n.allBasenames=t;let r=a.filter(s=>!s.basenames);return r.push(n),r}function jW(a,i,e,t,o,n){if(Array.isArray(a)){let r=0;for(let s of a){let l=jW(s,i,e,t,o,n);if(l===10)return l;l>r&&(r=l)}return r}else{if(typeof a=="string")return t?a==="*"?5:a===e?10:0:0;if(a){let{language:r,pattern:s,scheme:l,hasAccessToAllModels:c,notebookType:u}=a;if(!t&&!c)return 0;u&&o&&(i=o);let p=0;if(l)if(l===i.scheme)p=10;else if(l==="*")p=5;else return 0;if(r)if(r===e)p=10;else if(r==="*")p=Math.max(p,5);else return 0;if(u)if(u===n)p=10;else if(u==="*"&&n!==void 0)p=Math.max(p,5);else return 0;if(s){let h;if(typeof s=="string"?h=s:h={...s,base:th(s.base)},h===i.fsPath||Cp(h,i.fsPath))p=10;else return 0}return p}else return 0}}function Hli(a,i){if(typeof a=="string")i.add(a);else if(Array.isArray(a))for(let e of a)Hli(e,i);else{let e=a.language;e&&i.add(e)}}var Cxt=class{constructor(){this.selector={language:"*"}}provideDocumentHighlights(i,e,t){let o=[],n=i.getWordAtPosition({lineNumber:e.lineNumber,column:e.column});return n?i.isDisposed()?void 0:i.findMatches(n.word,!0,!1,!0,tW,!1).map(s=>({range:s.range,kind:0})):Promise.resolve(o)}provideMultiDocumentHighlights(i,e,t,o){let n=new vt,r=i.getWordAtPosition({lineNumber:e.lineNumber,column:e.column});if(!r)return Promise.resolve(n);for(let s of[i,...t]){if(s.isDisposed())continue;let c=s.findMatches(r.word,!0,!1,!0,tW,!1).map(u=>({range:u.range,kind:0}));c&&n.set(s.uri,c)}return n}},txe=class extends C{constructor(i){super(),this._register(i.documentHighlightProvider.register("*",new Cxt)),this._register(i.multiDocumentHighlightProvider.register("*",new Cxt))}};txe=I([m(0,zt)],txe);var qli=new Q("hasWordHighlights",!1);function A6i(a,i,e,t){let o=a.ordered(i);return Lre(o.map(n=>()=>Promise.resolve(n.provideDocumentHighlights(i,e,t)).then(void 0,ss)),n=>n!=null).then(n=>{if(n){let r=new vt;return r.set(i.uri,n),r}return new vt})}function UHo(a,i,e,t,o){let n=a.ordered(i);return Lre(n.map(r=>()=>{let s=o.filter(l=>hx(l)).filter(l=>jW(r.selector,l.uri,l.getLanguageId(),!0,void 0,void 0)>0);return Promise.resolve(r.provideMultiDocumentHighlights(i,e,s,t)).then(void 0,ss)}),r=>r!=null)}var xxt=class{constructor(i,e,t){this._model=i;this._selection=e;this._wordSeparators=t;this._wordRange=this._getCurrentWordRange(i,e),this._result=null}get result(){return this._result||(this._result=xn(i=>this._compute(this._model,this._selection,this._wordSeparators,i))),this._result}_getCurrentWordRange(i,e){let t=i.getWordAtPosition(e.getPosition());return t?new z(e.startLineNumber,t.startColumn,e.startLineNumber,t.endColumn):null}isValid(i,e,t){let o=e.startLineNumber,n=e.startColumn,r=e.endColumn,s=this._getCurrentWordRange(i,e),l=!!(this._wordRange&&this._wordRange.equalsRange(s));for(let c=0,u=t.length;!l&&c<u;c++){let p=t.getRange(c);p&&p.startLineNumber===o&&p.startColumn<=n&&p.endColumn>=r&&(l=!0)}return l}cancel(){this.result.cancel()}},Uli=class extends xxt{constructor(i,e,t,o){super(i,e,t),this._providers=o}_compute(i,e,t,o){return A6i(this._providers,i,e.getPosition(),o).then(n=>n||new vt)}},zli=class extends xxt{constructor(i,e,t,o,n){super(i,e,t),this._providers=o,this._otherModels=n}_compute(i,e,t,o){return UHo(this._providers,i,e.getPosition(),o,this._otherModels).then(n=>n||new vt)}};function zHo(a,i,e,t){return new Uli(i,e,t,a)}function KHo(a,i,e,t,o){return new zli(i,e,t,a,o)}kS("_executeDocumentHighlights",async(a,i,e)=>{let t=a.get(zt);return(await A6i(t.documentHighlightProvider,i,e,ve.None))?.get(i.uri)});var ip=class{constructor(i,e,t,o,n,r,s,l){this.toUnhook=new P;this.workerRequestTokenId=0;this.workerRequestCompleted=!1;this.workerRequestValue=new vt;this.lastCursorPositionChangeTime=0;this.renderDecorationsTimer=void 0;this.runDelayer=this.toUnhook.add(new jo(50));this.editor=i,this.providers=e,this.multiDocumentProviders=t,this.codeEditorService=r,this.textModelService=n,this.configurationService=s,this.logService=l,this._hasWordHighlights=qli.bindTo(o),this._ignorePositionChangeEvent=!1,this.occurrencesHighlightEnablement=this.editor.getOption(90),this.occurrencesHighlightDelay=this.configurationService.getValue("editor.occurrencesHighlightDelay"),this.model=this.editor.getModel(),this.toUnhook.add(i.onDidChangeCursorPosition(c=>{this._ignorePositionChangeEvent||this.occurrencesHighlightEnablement!=="off"&&this.runDelayer.trigger(()=>{this._onPositionChanged(c)}).catch(mt)})),this.toUnhook.add(i.onDidFocusEditorText(c=>{this.occurrencesHighlightEnablement!=="off"&&(this.workerRequest||this.runDelayer.trigger(()=>{this._run()}).catch(mt))})),this.toUnhook.add(i.onDidChangeModelContent(c=>{jd(this.model.uri,"output")||this._stopAll()})),this.toUnhook.add(i.onDidChangeModel(c=>{!c.newModelUrl&&c.oldModelUrl?this._stopSingular():ip.query&&this._run()})),this.toUnhook.add(i.onDidChangeConfiguration(c=>{let u=this.editor.getOption(90);if(this.occurrencesHighlightEnablement!==u)switch(this.occurrencesHighlightEnablement=u,u){case"off":this._stopAll();break;case"singleFile":this._stopAll(ip.query?.modelInfo?.modelURI);break;case"multiFile":ip.query&&this._run(!0);break;default:console.warn("Unknown occurrencesHighlight setting value:",u);break}})),this.toUnhook.add(this.configurationService.onDidChangeConfiguration(c=>{if(c.affectsConfiguration("editor.occurrencesHighlightDelay")){let u=s.getValue("editor.occurrencesHighlightDelay");this.occurrencesHighlightDelay!==u&&(this.occurrencesHighlightDelay=u)}})),this.toUnhook.add(i.onDidBlurEditorWidget(()=>{let c=this.codeEditorService.getFocusedCodeEditor();c?c.getModel()?.uri.scheme===Y.vscodeNotebookCell&&this.editor.getModel()?.uri.scheme!==Y.vscodeNotebookCell&&this._stopAll():this._stopAll()})),this.decorations=this.editor.createDecorationsCollection(),this.workerRequestTokenId=0,this.workerRequest=null,this.workerRequestCompleted=!1,this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=void 0,ip.query&&this._run()}static{this.storedDecorationIDs=new vt}static{this.query=null}hasDecorations(){return this.decorations.length>0}restore(i){this.occurrencesHighlightEnablement!=="off"&&(this.runDelayer.cancel(),this.runDelayer.trigger(()=>{this._run(!1,i)}).catch(mt))}trigger(){this.runDelayer.cancel(),this._run(!1,0)}stop(){this.occurrencesHighlightEnablement!=="off"&&this._stopAll()}_getSortedHighlights(){return this.decorations.getRanges().sort(z.compareRangesUsingStarts)}moveNext(){let i=this._getSortedHighlights(),t=(i.findIndex(n=>n.containsPosition(this.editor.getPosition()))+1)%i.length,o=i[t];try{this._ignorePositionChangeEvent=!0,this.editor.setPosition(o.getStartPosition()),this.editor.revealRangeInCenterIfOutsideViewport(o);let n=this._getWord();if(n){let r=this.editor.getModel().getLineContent(o.startLineNumber);Jo(`${r}, ${t+1} of ${i.length} for '${n.word}'`)}}finally{this._ignorePositionChangeEvent=!1}}moveBack(){let i=this._getSortedHighlights(),t=(i.findIndex(n=>n.containsPosition(this.editor.getPosition()))-1+i.length)%i.length,o=i[t];try{this._ignorePositionChangeEvent=!0,this.editor.setPosition(o.getStartPosition()),this.editor.revealRangeInCenterIfOutsideViewport(o);let n=this._getWord();if(n){let r=this.editor.getModel().getLineContent(o.startLineNumber);Jo(`${r}, ${t+1} of ${i.length} for '${n.word}'`)}}finally{this._ignorePositionChangeEvent=!1}}_removeSingleDecorations(){if(!this.editor.hasModel())return;let i=ip.storedDecorationIDs.get(this.editor.getModel().uri);i&&(this.editor.removeDecorations(i),ip.storedDecorationIDs.delete(this.editor.getModel().uri),this.decorations.length>0&&(this.decorations.clear(),this._hasWordHighlights.set(!1)))}_removeAllDecorations(i){let e=this.codeEditorService.listCodeEditors(),t=[];for(let o of e){if(!o.hasModel()||Xe(o.getModel().uri,i))continue;let n=ip.storedDecorationIDs.get(o.getModel().uri);if(!n)continue;o.removeDecorations(n),t.push(o.getModel().uri);let r=Xb.get(o);r?.wordHighlighter&&r.wordHighlighter.decorations.length>0&&(r.wordHighlighter.decorations.clear(),r.wordHighlighter.workerRequest=null,r.wordHighlighter._hasWordHighlights.set(!1))}for(let o of t)ip.storedDecorationIDs.delete(o)}_stopSingular(){this._removeSingleDecorations(),this.editor.hasTextFocus()&&(this.editor.getModel()?.uri.scheme!==Y.vscodeNotebookCell&&ip.query?.modelInfo?.modelURI.scheme!==Y.vscodeNotebookCell?(ip.query=null,this._run()):ip.query?.modelInfo&&(ip.query.modelInfo=null)),this.renderDecorationsTimer!==void 0&&(clearTimeout(this.renderDecorationsTimer),this.renderDecorationsTimer=void 0),this.workerRequest!==null&&(this.workerRequest.cancel(),this.workerRequest=null),this.workerRequestCompleted||(this.workerRequestTokenId++,this.workerRequestCompleted=!0)}_stopAll(i){this._removeAllDecorations(i),this.renderDecorationsTimer!==void 0&&(clearTimeout(this.renderDecorationsTimer),this.renderDecorationsTimer=void 0),this.workerRequest!==null&&(this.workerRequest.cancel(),this.workerRequest=null),this.workerRequestCompleted||(this.workerRequestTokenId++,this.workerRequestCompleted=!0)}_onPositionChanged(i){if(this.occurrencesHighlightEnablement==="off"){this._stopAll();return}if(i.source!=="api"&&i.reason!==3){this._stopAll();return}this._run()}_getWord(){let i=this.editor.getSelection(),e=i.startLineNumber,t=i.startColumn;return this.model.isDisposed()?null:this.model.getWordAtPosition({lineNumber:e,column:t})}getOtherModelsToHighlight(i){if(!i)return[];if(i.uri.scheme===Y.vscodeNotebookCell){let n=[],r=this.codeEditorService.listCodeEditors();for(let s of r){let l=s.getModel();l&&l!==i&&l.uri.scheme===Y.vscodeNotebookCell&&n.push(l)}return n}let t=[],o=this.codeEditorService.listCodeEditors();for(let n of o){if(!Ec(n))continue;let r=n.getModel();r&&i===r.modified&&t.push(r.modified)}if(t.length)return t;if(this.occurrencesHighlightEnablement==="singleFile")return[];for(let n of o){let r=n.getModel();r&&r!==i&&t.push(r)}return t}async _run(i,e){if(this.editor.hasTextFocus()){let o=this.editor.getSelection();if(!o||o.startLineNumber!==o.endLineNumber){ip.query=null,this._stopAll();return}let n=o.startColumn,r=o.endColumn,s=this._getWord();if(!s||s.startColumn>n||s.endColumn<r){ip.query=null,this._stopAll();return}ip.query={modelInfo:{modelURI:this.model.uri,selection:o}}}else if(!ip.query){this._stopAll();return}if(this.lastCursorPositionChangeTime=new Date().getTime(),Xe(this.editor.getModel().uri,ip.query.modelInfo?.modelURI)){if(!i){let s=this.decorations.getRanges();for(let l of s)if(l.containsPosition(this.editor.getPosition()))return}this._stopAll(i?this.model.uri:void 0);let o=++this.workerRequestTokenId;this.workerRequestCompleted=!1;let n=this.getOtherModelsToHighlight(this.editor.getModel());if(!ip.query||!ip.query.modelInfo)return;let r=await this.textModelService.createModelReference(ip.query.modelInfo.modelURI);try{this.workerRequest=this.computeWithModel(r.object.textEditorModel,ip.query.modelInfo.selection,n),this.workerRequest?.result.then(s=>{o===this.workerRequestTokenId&&(this.workerRequestCompleted=!0,this.workerRequestValue=s||[],this._beginRenderDecorations(e??this.occurrencesHighlightDelay))},mt)}catch(s){this.logService.error("Unexpected error during occurrence request. Log: ",s)}finally{r.dispose()}}else if(this.model.uri.scheme===Y.vscodeNotebookCell){let o=++this.workerRequestTokenId;if(this.workerRequestCompleted=!1,!ip.query||!ip.query.modelInfo)return;let n=await this.textModelService.createModelReference(ip.query.modelInfo.modelURI);try{this.workerRequest=this.computeWithModel(n.object.textEditorModel,ip.query.modelInfo.selection,[this.model]),this.workerRequest?.result.then(r=>{o===this.workerRequestTokenId&&(this.workerRequestCompleted=!0,this.workerRequestValue=r||[],this._beginRenderDecorations(e??this.occurrencesHighlightDelay))},mt)}catch(r){this.logService.error("Unexpected error during occurrence request. Log: ",r)}finally{n.dispose()}}}computeWithModel(i,e,t){return t.length?KHo(this.multiDocumentProviders,i,e,this.editor.getOption(148),t):zHo(this.providers,i,e,this.editor.getOption(148))}_beginRenderDecorations(i){let e=new Date().getTime(),t=this.lastCursorPositionChangeTime+i;e>=t?(this.renderDecorationsTimer=void 0,this.renderDecorations()):this.renderDecorationsTimer=setTimeout(()=>{this.renderDecorations()},t-e)}renderDecorations(){this.renderDecorationsTimer=void 0;let i=this.codeEditorService.listCodeEditors();for(let e of i){let t=Xb.get(e);if(!t)continue;let o=[],n=e.getModel()?.uri;if(n&&this.workerRequestValue.has(n)){let r=ip.storedDecorationIDs.get(n),s=this.workerRequestValue.get(n);if(s)for(let c of s)c.range&&o.push({range:c.range,options:p6i(c.kind)});let l=[];e.changeDecorations(c=>{l=c.deltaDecorations(r??[],o)}),ip.storedDecorationIDs=ip.storedDecorationIDs.set(n,l),o.length>0&&(t.wordHighlighter?.decorations.set(o),t.wordHighlighter?._hasWordHighlights.set(!0))}}this.workerRequest=null}dispose(){this._stopSingular(),this.toUnhook.dispose()}};ip=I([m(4,Nt),m(5,Kt),m(6,B),m(7,ne)],ip);var Xb=class extends C{static{this.ID="editor.contrib.wordHighlighter"}static get(i){return i.getContribution(Xb.ID)}constructor(i,e,t,o,n,r,s){super(),this._wordHighlighter=null;let l=()=>{i.hasModel()&&!i.getModel().isTooLargeForTokenization()&&i.getModel().uri.scheme!==Y.accessibleView&&(this._wordHighlighter=new ip(i,t.documentHighlightProvider,t.multiDocumentHighlightProvider,e,n,o,r,s))};this._register(i.onDidChangeModel(c=>{this._wordHighlighter&&(!c.newModelUrl&&c.oldModelUrl?.scheme!==Y.vscodeNotebookCell&&this.wordHighlighter?.stop(),this._wordHighlighter.dispose(),this._wordHighlighter=null),l()})),l()}get wordHighlighter(){return this._wordHighlighter}saveViewState(){return!!(this._wordHighlighter&&this._wordHighlighter.hasDecorations())}moveNext(){this._wordHighlighter?.moveNext()}moveBack(){this._wordHighlighter?.moveBack()}restoreViewState(i){this._wordHighlighter&&i&&this._wordHighlighter.restore(250)}stopHighlighting(){this._wordHighlighter?.stop()}dispose(){this._wordHighlighter&&(this._wordHighlighter.dispose(),this._wordHighlighter=null),super.dispose()}};Xb=I([m(1,X),m(2,zt),m(3,Kt),m(4,Nt),m(5,B),m(6,ne)],Xb);var kxt=class extends xi{constructor(i,e){super(e),this._isNext=i}run(i,e){let t=Xb.get(e);t&&(this._isNext?t.moveNext():t.moveBack())}},Kli=class extends kxt{constructor(){super(!0,{id:"editor.action.wordHighlight.next",label:L(1729,"Go to Next Symbol Highlight"),precondition:qli,kbOpts:{kbExpr:ue.editorTextFocus,primary:65,weight:100}})}},Gli=class extends kxt{constructor(){super(!1,{id:"editor.action.wordHighlight.prev",label:L(1730,"Go to Previous Symbol Highlight"),precondition:qli,kbOpts:{kbExpr:ue.editorTextFocus,primary:1089,weight:100}})}},$li=class extends xi{constructor(){super({id:"editor.action.wordHighlight.trigger",label:L(1731,"Trigger Symbol Highlight"),precondition:void 0,kbOpts:{kbExpr:ue.editorTextFocus,primary:0,weight:100}})}run(i,e){let t=Xb.get(e);t&&t.restoreViewState(!0)}};go(Xb.ID,Xb,0);Jt(Kli);Jt(Gli);Jt($li);Dx(txe);var Wle=class extends xc{constructor(i){super(i),this._inSelectionMode=i.inSelectionMode,this._wordNavigationType=i.wordNavigationType}runEditorCommand(i,e,t){if(!e.hasModel())return;let o=jw(e.getOption(148),e.getOption(147)),n=e.getModel(),r=e.getSelections(),s=r.length>1,l=r.map(c=>{let u=new Ie(c.positionLineNumber,c.positionColumn),p=this._move(o,n,u,this._wordNavigationType,s);return this._moveTo(c,p,this._inSelectionMode)});if(n.pushStackElement(),e._getViewModel().setCursorStates("moveWordCommand",3,l.map(c=>Ps.fromModelSelection(c))),l.length===1){let c=new Ie(l[0].positionLineNumber,l[0].positionColumn);e.revealPosition(c,0)}}_moveTo(i,e,t){return t?new Yt(i.selectionStartLineNumber,i.selectionStartColumn,e.lineNumber,e.column):new Yt(e.lineNumber,e.column,e.lineNumber,e.column)}},ez=class extends Wle{_move(i,e,t,o,n){return yf.moveWordLeft(i,e,t,o,n)}},tz=class extends Wle{_move(i,e,t,o,n){return yf.moveWordRight(i,e,t,o)}},jli=class extends ez{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartLeft",precondition:void 0})}},Qli=class extends ez{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndLeft",precondition:void 0})}},Yli=class extends ez{constructor(){super({inSelectionMode:!1,wordNavigationType:1,id:"cursorWordLeft",precondition:void 0,kbOpts:{kbExpr:x.and(ue.textInputFocus,x.and($a,Zy)?.negate()),primary:2063,mac:{primary:527},weight:100}})}},Xli=class extends ez{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartLeftSelect",precondition:void 0})}},Jli=class extends ez{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndLeftSelect",precondition:void 0})}},Zli=class extends ez{constructor(){super({inSelectionMode:!0,wordNavigationType:1,id:"cursorWordLeftSelect",precondition:void 0,kbOpts:{kbExpr:x.and(ue.textInputFocus,x.and($a,Zy)?.negate()),primary:3087,mac:{primary:1551},weight:100}})}},eci=class extends ez{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityLeft",precondition:void 0})}_move(i,e,t,o,n){return super._move(jw(zb.wordSeparators.defaultValue,i.intlSegmenterLocales),e,t,o,n)}},tci=class extends ez{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityLeftSelect",precondition:void 0})}_move(i,e,t,o,n){return super._move(jw(zb.wordSeparators.defaultValue,i.intlSegmenterLocales),e,t,o,n)}},ici=class extends tz{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartRight",precondition:void 0})}},oci=class extends tz{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndRight",precondition:void 0,kbOpts:{kbExpr:x.and(ue.textInputFocus,x.and($a,Zy)?.negate()),primary:2065,mac:{primary:529},weight:100}})}},nci=class extends tz{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordRight",precondition:void 0})}},rci=class extends tz{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartRightSelect",precondition:void 0})}},sci=class extends tz{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndRightSelect",precondition:void 0,kbOpts:{kbExpr:x.and(ue.textInputFocus,x.and($a,Zy)?.negate()),primary:3089,mac:{primary:1553},weight:100}})}},aci=class extends tz{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordRightSelect",precondition:void 0})}},lci=class extends tz{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityRight",precondition:void 0})}_move(i,e,t,o,n){return super._move(jw(zb.wordSeparators.defaultValue,i.intlSegmenterLocales),e,t,o,n)}},cci=class extends tz{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityRightSelect",precondition:void 0})}_move(i,e,t,o,n){return super._move(jw(zb.wordSeparators.defaultValue,i.intlSegmenterLocales),e,t,o,n)}},Vle=class extends xc{constructor(i){super({canTriggerInlineEdits:!0,...i}),this._whitespaceHeuristics=i.whitespaceHeuristics,this._wordNavigationType=i.wordNavigationType}runEditorCommand(i,e,t){let o=i?.get(bs);if(!e.hasModel()||!o)return;let n=jw(e.getOption(148),e.getOption(147)),r=e.getModel(),s=e.getSelections(),l=e.getOption(10),c=e.getOption(15),u=o.getLanguageConfiguration(r.getLanguageId()).getAutoClosingPairs(),p=e._getViewModel(),h=s.map(g=>{let f=this._delete({wordSeparators:n,model:r,selection:g,whitespaceHeuristics:this._whitespaceHeuristics,autoClosingDelete:e.getOption(13),autoClosingBrackets:l,autoClosingQuotes:c,autoClosingPairs:u,autoClosedCharacters:p.getCursorAutoClosedCharacters()},this._wordNavigationType);return new Wh(f,"")});e.pushUndoStop(),e.executeCommands(this.id,h),e.pushUndoStop()}},E3e=class extends Vle{_delete(i,e){let t=yf.deleteWordLeft(i,e);return t||new z(1,1,1,1)}},T3e=class extends Vle{_delete(i,e){let t=yf.deleteWordRight(i,e);if(t)return t;let o=i.model.getLineCount(),n=i.model.getLineMaxColumn(o);return new z(o,n,o,n)}},dci=class extends E3e{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartLeft",precondition:ue.writable})}},uci=class extends E3e{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndLeft",precondition:ue.writable})}},pci=class extends E3e{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordLeft",precondition:ue.writable,kbOpts:{kbExpr:ue.textInputFocus,primary:2049,mac:{primary:513},weight:100}})}},mci=class extends T3e{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartRight",precondition:ue.writable})}},hci=class extends T3e{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndRight",precondition:ue.writable})}},gci=class extends T3e{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordRight",precondition:ue.writable,kbOpts:{kbExpr:ue.textInputFocus,primary:2068,mac:{primary:532},weight:100}})}},fci=class extends xi{constructor(){super({id:"deleteInsideWord",precondition:ue.writable,label:L(1732,"Delete Word"),metadata:{description:L(1734,"Delete the word at the cursor"),args:[{name:"args",schema:{type:"object",properties:{onlyWord:{type:"boolean",default:!1,description:d(1733,null)}}}}]}})}run(i,e,t){if(!e.hasModel())return;let o=!!(t&&typeof t=="object"&&t.onlyWord),n=jw(e.getOption(148),e.getOption(147)),r=e.getModel(),l=e.getSelections().map(c=>{let u=yf.deleteInsideWord(n,r,c,o);return new Wh(u,"")});e.pushUndoStop(),e.executeCommands(this.id,l),e.pushUndoStop()}};qi(new jli);qi(new Qli);qi(new Yli);qi(new Xli);qi(new Jli);qi(new Zli);qi(new ici);qi(new oci);qi(new nci);qi(new rci);qi(new sci);qi(new aci);qi(new eci);qi(new tci);qi(new lci);qi(new cci);qi(new dci);qi(new uci);qi(new pci);qi(new mci);qi(new hci);qi(new gci);Jt(fci);var vci=class extends Vle{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordPartLeft",precondition:ue.writable,kbOpts:{kbExpr:ue.textInputFocus,primary:0,mac:{primary:769},weight:100}})}_delete(i,e){let t=tse.deleteWordPartLeft(i);return t||new z(1,1,1,1)}},bci=class extends Vle{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordPartRight",precondition:ue.writable,kbOpts:{kbExpr:ue.textInputFocus,primary:0,mac:{primary:788},weight:100}})}_delete(i,e){let t=tse.deleteWordPartRight(i);if(t)return t;let o=i.model.getLineCount(),n=i.model.getLineMaxColumn(o);return new z(o,n,o,n)}},Ext=class extends Wle{_move(i,e,t,o,n){return tse.moveWordPartLeft(i,e,t,n)}},Sci=class extends Ext{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordPartLeft",precondition:void 0,kbOpts:{kbExpr:ue.textInputFocus,primary:0,mac:{primary:783},weight:100}})}};qe.registerCommandAlias("cursorWordPartStartLeft","cursorWordPartLeft");var Ici=class extends Ext{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordPartLeftSelect",precondition:void 0,kbOpts:{kbExpr:ue.textInputFocus,primary:0,mac:{primary:1807},weight:100}})}};qe.registerCommandAlias("cursorWordPartStartLeftSelect","cursorWordPartLeftSelect");var Txt=class extends Wle{_move(i,e,t,o,n){return tse.moveWordPartRight(i,e,t)}},yci=class extends Txt{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordPartRight",precondition:void 0,kbOpts:{kbExpr:ue.textInputFocus,primary:0,mac:{primary:785},weight:100}})}},wci=class extends Txt{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordPartRightSelect",precondition:void 0,kbOpts:{kbExpr:ue.textInputFocus,primary:0,mac:{primary:1809},weight:100}})}};qi(new vci);qi(new bci);qi(new Sci);qi(new Ici);qi(new yci);qi(new wci);var _xt=class extends C{constructor(e){super();this.editor=e;this._register(this.editor.onDidAttemptReadOnlyEdit(()=>this._onDidAttemptReadOnlyEdit()))}static{this.ID="editor.contrib.readOnlyMessageController"}_onDidAttemptReadOnlyEdit(){let e=iu.get(this.editor);if(e&&this.editor.hasModel()){let t=this.editor.getOptions().get(105);t||(this.editor.isSimpleWidget?t=new xe(d(1537,null)):t=new xe(d(1536,null))),e.showMessage(t,this.editor.getPosition())}}};go(_xt.ID,_xt,2);var _3e=class extends C{constructor(e,t,o){super();this._textModel=e;this._languageFeaturesService=t;this._outlineModelService=o;this._currentModel=Le(this,void 0);let n=Nr("documentSymbolProvider.onDidChange",this._languageFeaturesService.documentSymbolProvider.onDidChange),r=Nr("_textModel.onDidChangeContent",H.debounce(s=>this._textModel.onDidChangeContent(s),()=>{},100));this._register(Ga(async(s,l)=>{n.read(s),r.read(s);let c=l.add(new hSt),u=await this._outlineModelService.getOrCreate(this._textModel,c.token);l.isDisposed||this._currentModel.set(u,void 0)}))}getBreadcrumbItems(e,t){let o=this._currentModel.read(t);if(!o)return[];let n=o.asListOfDocumentSymbols().filter(r=>e.contains(r.range.startLineNumber)&&!e.contains(r.range.endLineNumber));return n.sort(pre(tl(r=>r.range.endLineNumber-r.range.startLineNumber,qd))),n.map(r=>({name:r.name,kind:r.kind,startLineNumber:r.range.startLineNumber}))}getAt(e,t){let o=this._currentModel.read(t);if(!o)return[];let n=o.asListOfDocumentSymbols().filter(r=>new ro(r.range.startLineNumber,r.range.endLineNumber).contains(e));return n.length===0?[]:(n.sort(pre(tl(r=>r.range.endLineNumber-r.range.startLineNumber,qd))),n.map(r=>({name:r.name,kind:r.kind,startLineNumber:r.range.startLineNumber})))}};_3e=I([m(1,zt),m(2,f_)],_3e);tO.setBreadcrumbsSourceFactory((a,i)=>i.createInstance(_3e,a));var QW=class extends C{static{this.ID="editor.contrib.floatingToolbar"}constructor(i,e,t,o){super();let n=this._register(os(i)),r=Ce(l=>n.model.read(l)?.uri),s=this._register(e.createInstance(Ble,D.EditorContent,i.contextKeyService,r));this._register(he(l=>{s.hasActions.read(l)&&l.store.add(n.createOverlayWidget({allowEditorOverflow:!1,domNode:s.element,minContentWidthInPx:Oo(0),position:Oo({preference:1})}))}))}};QW=I([m(1,F),m(2,_e),m(3,qt)],QW);var Ble=class extends C{constructor(i,e,t,o,n,r){super();let s=this._register(r.createMenu(i,e)),l=ui(this,s.onDidChange,()=>s.getActions()),c=Ce(u=>{let p=l.read(u),{primary:h}=hl(p,()=>!0);return h.filter(g=>g.id!==li.ID)});this.hasActions=Ce(u=>c.read(u).length>0),this.element=bt("div.floating-menu-overlay-widget").root,this._register(Z(()=>this.element.remove())),this._register(he(u=>{let p=c.read(u),h=p.length>0,g=h?p[0].id:void 0,f=p.length===1;if(this.element.classList.toggle("single-button",f),this.element.style.height=f?"28px":"26px",!h)return;let v=o.createInstance(Ln,this.element,i,{actionViewItemProvider:(b,S)=>{if(b instanceof Eo)return o.createInstance(class extends ml{render(y){super.render(y),b.id===g&&this.element?.classList.add("primary")}updateLabel(){let y=n.lookupKeybinding(b.id),w=y?y.getLabel():void 0;this.options.label&&this.label&&(this.label.textContent=w?`${this._commandAction.label} (${w})`:this._commandAction.label)}},b,{...S,keybindingNotRenderedWithLabel:!0})},hiddenItemStrategy:0,menuOptions:{shouldForwardArgs:!0},telemetrySource:"editor.overlayToolbar",toolbarOptions:{primaryGroup:()=>!0,useSeparatorsInPrimaryActions:!0}});u.store.add(v),u.store.add(he(b=>{let S=t.read(b);v.context=S}))}))}};Ble=I([m(3,F),m(4,_e),m(5,qt)],Ble);go(QW.ID,QW,1);var gc;(Ze=>(Ze.accessibilityHelpTitle=d(910,null),Ze.openingDocs=d(939,null),Ze.readonlyDiffEditor=d(945,null),Ze.editableDiffEditor=d(927,null),Ze.readonlyEditor=d(946,null),Ze.editableEditor=d(928,null),Ze.defaultWindowTitleIncludesEditorState=d(926,null),Ze.defaultWindowTitleExcludingEditorState=d(925,null),Ze.toolbar=d(958,null),Ze.changeConfigToOnMac=d(915,null),Ze.changeConfigToOnWinLinux=d(916,null),Ze.auto_on=d(913,null),Ze.auto_off=d(912,null),Ze.screenReaderModeEnabled=d(948,null),Ze.screenReaderModeDisabled=d(947,null),Ze.tabFocusModeOnMsg=d(955,null,"<keybinding:editor.action.toggleTabFocusMode>"),Ze.tabFocusModeOffMsg=d(954,null,"<keybinding:editor.action.toggleTabFocusMode>"),Ze.stickScroll=d(952,null,"<keybinding:editor.action.focusStickyDebugConsole>"),Ze.suggestActions=d(953,null,"<keybinding:editor.action.triggerSuggest>"),Ze.acceptSuggestAction=d(909,null,"<keybinding:acceptSelectedSuggestion>"),Ze.toggleSuggestionFocus=d(957,null,"<keybinding:focusSuggestion>","<keybinding:toggleSuggestionFocus>"),Ze.codeFolding=d(920,null,"<keybinding:editor.toggleFold>"),Ze.intellisense=d(936,null,"<keybinding:editor.action.triggerSuggest>"),Ze.showOrFocusHover=d(950,null,"<keybinding:editor.action.showHover>"),Ze.goToSymbol=d(933,null,"<keybinding:workbench.action.gotoSymbol>"),Ze.showAccessibilityHelpAction=d(949,null),Ze.listSignalSounds=d(938,null),Ze.listAlerts=d(937,null),Ze.announceCursorPosition=d(911,null,"<keybinding:editor.action.announceCursorPosition>"),Ze.focusNotifications=d(930,null,"<keybinding:notifications.focusToasts>","<keybinding:notification.acceptPrimaryAction>"),Ze.quickChat=d(940,null,"<keybinding:workbench.action.quickchat.toggle>"),Ze.startInlineChat=d(951,null,"<keybinding:inlineChat.start>"),Ze.startDebugging=d(921,null,"<keybinding:workbench.action.debug.start>"),Ze.setBreakpoint=d(924,null,"<keybinding:editor.debug.action.toggleInlineBreakpoint>"),Ze.addToWatch=d(922,null,"<keybinding:editor.debug.action.selectionToWatch>"),Ze.debugExecuteSelection=d(923,null,"<keybinding:editor.debug.action.selectionToRepl>"),Ze.chatEditorModification=d(918,null),Ze.chatEditorRequestInProgress=d(919,null),Ze.chatEditActions=d(917,null,"<keybinding:chatEditor.action.navigatePrevious>","<keybinding:chatEditor.action.navigateNext>","<keybinding:chatEditor.action.acceptHunk>","<keybinding:chatEditor.action.undoHunk>","<keybinding:chatEditor.action.toggleDiff>","<keybinding:chatEditor.action.acceptAllEdits>")))(gc||={});var $Ho;(i=>i.inspectTokensAction=d(935,null))($Ho||={});var qHo;(e=>(e.gotoLineActionLabel=d(931,null),e.gotoOffsetActionLabel=d(932,null)))(qHo||={});var jHo;(i=>i.helpQuickAccessActionLabel=d(934,null))(jHo||={});var QHo;(e=>(e.quickCommandActionLabel=d(942,null),e.quickCommandHelp=d(941,null)))(QHo||={});var YHo;(e=>(e.quickOutlineActionLabel=d(943,null),e.quickOutlineByCategoryActionLabel=d(944,null)))(YHo||={});var XHo;(i=>i.editorViewAccessibleLabel=d(929,null))(XHo||={});var JHo;(i=>i.toggleHighContrast=d(956,null))(JHo||={});var ZHo;(i=>i.bulkEditServiceSummary=d(914,null))(ZHo||={});var ao=ae("lifecycleService");function Dxt(a){switch(a){case 1:return"NewWindow";case 3:return"ReloadedWindow";case 4:return"ReopenedWindow"}}function N6i(a){switch(a){case 1:return"Starting";case 2:return"Ready";case 3:return"Restored";case 4:return"Eventually"}}var Lxt=ae("editorPaneService");var Qi;(i=>i.Workbench="workbench.contributions.kind")(Qi||={});var ut=(o=>(o[o.BlockStartup=1]="BlockStartup",o[o.BlockRestore=2]="BlockRestore",o[o.AfterRestored=3]="AfterRestored",o[o.Eventually=4]="Eventually",o))(ut||{});function O6i(a){let i=a;return!!i&&typeof i.editorTypeId=="string"}function eUo(a){switch(a){case 3:return ut.AfterRestored;case 4:return ut.Eventually}}function F6i(a){switch(a){case ut.BlockStartup:return 1;case ut.BlockRestore:return 2;case ut.AfterRestored:return 3;case ut.Eventually:return 4}}var Hle=class a extends C{constructor(){super(...arguments);this.contributionsByPhase=new Map;this.contributionsByEditor=new Map;this.contributionsById=new Map;this.instancesById=new Map;this.instanceDisposables=this._register(new P);this.timingsByPhase=new Map;this.pendingRestoredContributions=new Go;this.whenRestored=this.pendingRestoredContributions.p}static{this.INSTANCE=new a}static{this.BLOCK_BEFORE_RESTORE_WARN_THRESHOLD=20}static{this.BLOCK_AFTER_RESTORE_WARN_THRESHOLD=100}get timings(){return this.timingsByPhase}registerWorkbenchContribution2(e,t,o){let n={id:e,ctor:t};this.instantiationService&&this.lifecycleService&&this.logService&&this.environmentService&&this.editorPaneService&&(typeof o=="number"&&this.lifecycleService.phase>=o||typeof e=="string"&&O6i(o)&&this.editorPaneService.didInstantiateEditorPane(o.editorTypeId))?this.safeCreateContribution(this.instantiationService,this.logService,this.environmentService,n,typeof o=="number"?F6i(o):this.lifecycleService.phase):(typeof o=="number"&&$H(this.contributionsByPhase,F6i(o),[]).push(n),typeof e=="string"&&(this.contributionsById.has(e)?console.error(`IWorkbenchContributionsRegistry#registerWorkbenchContribution(): Can't register multiple contributions with same id '${e}'`):this.contributionsById.set(e,n),O6i(o)&&$H(this.contributionsByEditor,o.editorTypeId,[]).push(n)))}registerWorkbenchContribution(e,t){this.registerWorkbenchContribution2(void 0,e,eUo(t))}getWorkbenchContribution(e){if(this.instancesById.has(e))return this.instancesById.get(e);let t=this.instantiationService,o=this.lifecycleService,n=this.logService,r=this.environmentService;if(!t||!o||!n||!r)throw new Error(`IWorkbenchContributionsRegistry#getContribution('${e}'): cannot be called before registry started`);let s=this.contributionsById.get(e);if(!s)throw new Error(`IWorkbenchContributionsRegistry#getContribution('${e}'): contribution with that identifier is unknown.`);o.phase<3&&n.warn(`IWorkbenchContributionsRegistry#getContribution('${e}'): contribution instantiated before LifecyclePhase.Restored!`),this.safeCreateContribution(t,n,r,s,o.phase);let l=this.instancesById.get(e);if(!l)throw new Error(`IWorkbenchContributionsRegistry#getContribution('${e}'): failed to create contribution.`);return l}start(e){let t=this.instantiationService=e.get(F),o=this.lifecycleService=e.get(ao),n=this.logService=e.get(ne),r=this.environmentService=e.get(Co),s=this.editorPaneService=e.get(Lxt);this._register(o.onDidShutdown(()=>{this.instanceDisposables.clear()}));for(let l of[1,2,3,4])this.instantiateByPhase(t,o,n,r,l);for(let l of this.contributionsByEditor.keys())s.didInstantiateEditorPane(l)&&this.onEditor(l,t,o,n,r);this._register(s.onWillInstantiateEditorPane(l=>this.onEditor(l.typeId,t,o,n,r)))}onEditor(e,t,o,n,r){let s=this.contributionsByEditor.get(e);if(s){this.contributionsByEditor.delete(e);for(let l of s)this.safeCreateContribution(t,n,r,l,o.phase)}}instantiateByPhase(e,t,o,n,r){t.phase>=r?this.doInstantiateByPhase(e,o,n,r):t.when(r).then(()=>this.doInstantiateByPhase(e,o,n,r))}async doInstantiateByPhase(e,t,o,n){let r=this.contributionsByPhase.get(n);if(r)switch(this.contributionsByPhase.delete(n),n){case 1:case 2:{sn(`code/willCreateWorkbenchContributions/${n}`);for(let s of r)this.safeCreateContribution(e,t,o,s,n);sn(`code/didCreateWorkbenchContributions/${n}`);break}case 3:case 4:{n===4&&await this.pendingRestoredContributions.p,this.doInstantiateWhenIdle(r,e,t,o,n);break}}}doInstantiateWhenIdle(e,t,o,n,r){sn(`code/willCreateWorkbenchContributions/${r}`);let s=0,l=r===4?3e3:500,c=u=>{for(;s<e.length;){let p=e[s++];if(this.safeCreateContribution(t,o,n,p,r),u.timeRemaining()<1){aN(c,l);break}}s===e.length&&(sn(`code/didCreateWorkbenchContributions/${r}`),r===3&&this.pendingRestoredContributions.complete())};aN(c,l)}safeCreateContribution(e,t,o,n,r){if(typeof n.id=="string"&&this.instancesById.has(n.id))return;let s=Date.now();try{typeof n.id=="string"&&sn(`code/willCreateWorkbenchContribution/${r}/${n.id}`);let l=e.createInstance(n.ctor);typeof n.id=="string"&&(this.instancesById.set(n.id,l),this.contributionsById.delete(n.id)),Ac(l)&&this.instanceDisposables.add(l)}catch(l){t.error(`Unable to create workbench contribution '${n.id??n.ctor.name}'.`,l)}finally{typeof n.id=="string"&&sn(`code/didCreateWorkbenchContribution/${r}/${n.id}`)}if(typeof n.id=="string"||!o.isBuilt){let l=Date.now()-s;if(l>(r<3?a.BLOCK_BEFORE_RESTORE_WARN_THRESHOLD:a.BLOCK_AFTER_RESTORE_WARN_THRESHOLD)&&t.warn(`Creation of workbench contribution '${n.id??n.ctor.name}' took ${l}ms.`),typeof n.id=="string"){let c=this.timingsByPhase.get(r);c||(c=[],this.timingsByPhase.set(r,c)),c.push([n.id,l])}}}},pt=Hle.INSTANCE.registerWorkbenchContribution2.bind(Hle.INSTANCE),Ule=Hle.INSTANCE.getWorkbenchContribution.bind(Hle.INSTANCE);oe.add(Qi.Workbench,Hle.INSTANCE);var iz=(n=>(n.Extensions="Extensions",n.IntegratedTerminal="IntegratedTerminal",n.InteractiveSession="InteractiveSession",n.Telemetry="Telemetry",n.Update="Update",n))(iz||{}),W6i={Extensions:{name:{key:"extensionsConfigurationTitle",value:d(138,null)}},IntegratedTerminal:{name:{key:"terminalIntegratedConfigurationTitle",value:d(141,null)}},InteractiveSession:{name:{key:"interactiveSessionConfigurationTitle",value:d(139,null)}},Telemetry:{name:{key:"telemetryConfigurationTitle",value:d(140,null)}},Update:{name:{key:"updateConfigurationTitle",value:d(142,null)}}};var CO="^([a-z0-9A-Z][a-z0-9-A-Z]*)\\.([a-z0-9A-Z][a-z0-9-A-Z]*)$",mj=new RegExp(CO),Rxt="__web_extension",hj="skipWalkthrough",UL="skipPublisherTrust",YW="extensionInstallSource",Mxt="dependecyOrPackExtensionInstall",V6i="clientTargetPlatform";function D3e(a){switch(a){case"win32-x64":return"Windows 64 bit";case"win32-arm64":return"Windows ARM";case"linux-x64":return"Linux 64 bit";case"linux-arm64":return"Linux ARM 64";case"linux-armhf":return"Linux ARM";case"alpine-x64":return"Alpine Linux 64 bit";case"alpine-arm64":return"Alpine ARM 64";case"darwin-x64":return"Mac";case"darwin-arm64":return"Mac Silicon";case"web":return"Web";case"universal":return"universal";case"unknown":return"unknown";case"undefined":return"undefined"}}function B6i(a){switch(a){case"win32-x64":return"win32-x64";case"win32-arm64":return"win32-arm64";case"linux-x64":return"linux-x64";case"linux-arm64":return"linux-arm64";case"linux-armhf":return"linux-armhf";case"alpine-x64":return"alpine-x64";case"alpine-arm64":return"alpine-arm64";case"darwin-x64":return"darwin-x64";case"darwin-arm64":return"darwin-arm64";case"web":return"web";case"universal":return"universal";default:return"unknown"}}function Pxt(a,i){switch(a){case 3:return i==="x64"?"win32-x64":i==="arm64"?"win32-arm64":"unknown";case 2:return i==="x64"?"linux-x64":i==="arm64"?"linux-arm64":i==="arm"?"linux-armhf":"unknown";case"alpine":return i==="x64"?"alpine-x64":i==="arm64"?"alpine-arm64":"unknown";case 1:return i==="x64"?"darwin-x64":i==="arm64"?"darwin-arm64":"unknown";case 0:return"web"}}function ixe(a,i){return i==="web"&&!a.includes("web")}function zle(a,i,e){return ixe(i,e)?!1:a==="undefined"||a==="universal"?!0:a==="unknown"?!1:a===e}function H6i(a){let i=a;return!!i&&typeof i=="object"&&typeof i.id=="string"&&(!i.uuid||typeof i.uuid=="string")}var ta=ae("extensionGalleryService");var xE=class extends Error{constructor(e,t){super(e);this.code=t;this.name=t}};var ch=class extends Error{constructor(e,t){super(e);this.code=t;this.name=t}},ls=ae("extensionManagementService"),nY="extensionsIdentifiers/disabled",Cci="extensionsIdentifiers/enabled",nz=ae("IGlobalExtensionEnablementService"),oxe=ae("IExtensionTipsService"),zp=ae("IAllowedExtensionsService");async function xci(a,i){let e;try{e=await i.resolve(a)}catch(t){if(t.fileOperationResult===1)return 0;throw t}return e.children?(await Promise.all(e.children.map(o=>xci(o.resource,i)))).reduce((o,n)=>o+n,0):e.size??0}var dh=L(1964,"Extensions"),kci=L(1981,"Preferences"),Kle="extensions.allowed",nxe="extensions.verifySignature",Axt="extensions.requestTimeout";oe.as(ii.Configuration).registerConfiguration({id:"extensions",order:30,title:d(1980,null),type:"object",properties:{[Kle]:{type:"object",markdownDescription:d(1970,null),default:"*",defaultSnippets:[{body:{},description:d(1975,null)},{body:{"*":!0},description:d(1971,null)}],scope:1,policy:{name:"AllowedExtensions",category:"Extensions",minimumVersion:"1.96",localization:{description:{key:"extensions.allowed.policy",value:d(1976,null)}}},additionalProperties:!1,patternProperties:{"([a-z0-9A-Z][a-z0-9-A-Z]*)\\.([a-z0-9A-Z][a-z0-9-A-Z]*)$":{anyOf:[{type:["boolean","string"],enum:[!0,!1,"stable"],description:d(1968,null),enumDescriptions:[d(1974,null),d(1972,null),d(1973,null)]},{type:"array",items:{type:"string"},description:d(1969,null)}]},"([a-z0-9A-Z][a-z0-9-A-Z]*)$":{type:["boolean","string"],enum:[!0,!1,"stable"],description:d(1963,null),enumDescriptions:[d(1979,null),d(1977,null),d(1978,null)]},"\\*":{type:"boolean",enum:[!0,!1],description:d(1965,null),enumDescriptions:[d(1967,null),d(1966,null)]}}}}});function L3e(a,i){return a?i?.capabilities.signing?.allPrivateRepositorySigned===!0:i?.capabilities.signing?.allPublicRepositorySigned===!0}var nt=ae("productService"),U6i="vscode://schemas/vscode-product";var Eci=class{constructor(){this._generators=new Map;this._cache=new WeakMap}register(i,e){this._generators.set(i,e)}readActivationEvents(i){return this._cache.has(i)||this._cache.set(i,this._readActivationEvents(i)),this._cache.get(i)}createActivationEventsMap(i){let e=Object.create(null);for(let t of i){let o=this.readActivationEvents(t);o.length>0&&(e[Ei.toKey(t.identifier)]=o)}return e}_readActivationEvents(i){if(typeof i.main>"u"&&typeof i.browser>"u")return[];let e=Array.isArray(i.activationEvents)?i.activationEvents.slice(0):[];for(let t=0;t<e.length;t++)e[t]==="onUri"&&(e[t]=`onUri:${Ei.toKey(i.identifier)}`);if(!i.contributes)return e;for(let t in i.contributes){let o=this._generators.get(t);if(!o)continue;let n=i.contributes[t],r=Array.isArray(n)?n:[n];try{e.push(...o(r))}catch(s){mt(s)}}return e}},gj=new Eci;var tUo={activeComment:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.activeComment.d.ts"},agentSessionsWorkspace:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.agentSessionsWorkspace.d.ts"},aiRelatedInformation:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.aiRelatedInformation.d.ts"},aiSettingsSearch:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.aiSettingsSearch.d.ts"},aiTextSearchProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.aiTextSearchProvider.d.ts",version:2},authIssuers:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.authIssuers.d.ts"},authLearnMore:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.authLearnMore.d.ts"},authProviderSpecific:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.authProviderSpecific.d.ts"},authSession:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.authSession.d.ts"},authenticationChallenges:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.authenticationChallenges.d.ts"},canonicalUriProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.canonicalUriProvider.d.ts"},chatContextProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatContextProvider.d.ts"},chatDebug:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatDebug.d.ts",version:2},chatHooks:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatHooks.d.ts",version:6},chatOutputRenderer:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatOutputRenderer.d.ts"},chatParticipantAdditions:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatParticipantAdditions.d.ts",version:3},chatParticipantPrivate:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatParticipantPrivate.d.ts",version:15},chatPromptFiles:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatPromptFiles.d.ts",version:1},chatProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatProvider.d.ts",version:4},chatReferenceBinaryData:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatReferenceBinaryData.d.ts"},chatReferenceDiagnostic:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatReferenceDiagnostic.d.ts"},chatSessionsProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatSessionsProvider.d.ts",version:3},chatStatusItem:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatStatusItem.d.ts"},chatTab:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatTab.d.ts"},codeActionAI:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.codeActionAI.d.ts"},codeActionRanges:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.codeActionRanges.d.ts"},codiconDecoration:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.codiconDecoration.d.ts"},commentReactor:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.commentReactor.d.ts"},commentReveal:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.commentReveal.d.ts"},commentThreadApplicability:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.commentThreadApplicability.d.ts"},commentingRangeHint:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.commentingRangeHint.d.ts"},commentsDraftState:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.commentsDraftState.d.ts"},contribAccessibilityHelpContent:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribAccessibilityHelpContent.d.ts"},contribChatEditorInlineGutterMenu:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribChatEditorInlineGutterMenu.d.ts"},contribCommentEditorActionsMenu:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribCommentEditorActionsMenu.d.ts"},contribCommentPeekContext:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribCommentPeekContext.d.ts"},contribCommentThreadAdditionalMenu:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribCommentThreadAdditionalMenu.d.ts"},contribCommentsViewThreadMenus:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribCommentsViewThreadMenus.d.ts"},contribDebugCreateConfiguration:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribDebugCreateConfiguration.d.ts"},contribDiffEditorGutterToolBarMenus:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribDiffEditorGutterToolBarMenus.d.ts"},contribEditSessions:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribEditSessions.d.ts"},contribEditorContentMenu:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribEditorContentMenu.d.ts"},contribLabelFormatterWorkspaceTooltip:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribLabelFormatterWorkspaceTooltip.d.ts"},contribLanguageModelToolSets:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribLanguageModelToolSets.d.ts"},contribMenuBarHome:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribMenuBarHome.d.ts"},contribMergeEditorMenus:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribMergeEditorMenus.d.ts"},contribMultiDiffEditorMenus:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribMultiDiffEditorMenus.d.ts"},contribNotebookStaticPreloads:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribNotebookStaticPreloads.d.ts"},contribRemoteHelp:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribRemoteHelp.d.ts"},contribShareMenu:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribShareMenu.d.ts"},contribSourceControlArtifactGroupMenu:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribSourceControlArtifactGroupMenu.d.ts"},contribSourceControlArtifactMenu:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribSourceControlArtifactMenu.d.ts"},contribSourceControlHistoryItemMenu:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribSourceControlHistoryItemMenu.d.ts"},contribSourceControlHistoryTitleMenu:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribSourceControlHistoryTitleMenu.d.ts"},contribSourceControlInputBoxMenu:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribSourceControlInputBoxMenu.d.ts"},contribSourceControlTitleMenu:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribSourceControlTitleMenu.d.ts"},contribStatusBarItems:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribStatusBarItems.d.ts"},contribViewContainerTitle:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribViewContainerTitle.d.ts"},contribViewsRemote:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribViewsRemote.d.ts"},contribViewsWelcome:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribViewsWelcome.d.ts"},css:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.css.d.ts"},customEditorMove:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.customEditorMove.d.ts"},dataChannels:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.dataChannels.d.ts"},debugVisualization:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.debugVisualization.d.ts"},defaultChatParticipant:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.defaultChatParticipant.d.ts",version:4},devDeviceId:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.devDeviceId.d.ts"},diffCommand:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.diffCommand.d.ts"},diffContentOptions:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.diffContentOptions.d.ts"},documentFiltersExclusive:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.documentFiltersExclusive.d.ts"},editSessionIdentityProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.editSessionIdentityProvider.d.ts"},editorHoverVerbosityLevel:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.editorHoverVerbosityLevel.d.ts"},editorInsets:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.editorInsets.d.ts"},embeddings:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.embeddings.d.ts"},envIsConnectionMetered:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.envIsConnectionMetered.d.ts"},environmentPower:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.environmentPower.d.ts"},extensionAffinity:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.extensionAffinity.d.ts"},extensionRuntime:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.extensionRuntime.d.ts"},extensionsAny:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.extensionsAny.d.ts"},externalUriOpener:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.externalUriOpener.d.ts"},fileSearchProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.fileSearchProvider.d.ts"},fileSearchProvider2:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.fileSearchProvider2.d.ts"},findFiles2:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.findFiles2.d.ts",version:2},findTextInFiles:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.findTextInFiles.d.ts"},findTextInFiles2:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.findTextInFiles2.d.ts"},fsChunks:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.fsChunks.d.ts"},inlineCompletionsAdditions:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.inlineCompletionsAdditions.d.ts"},interactive:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.interactive.d.ts"},interactiveWindow:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.interactiveWindow.d.ts"},ipc:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.ipc.d.ts"},languageModelCapabilities:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageModelCapabilities.d.ts"},languageModelProxy:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageModelProxy.d.ts"},languageModelSystem:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageModelSystem.d.ts"},languageModelThinkingPart:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageModelThinkingPart.d.ts",version:1},languageModelToolResultAudience:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageModelToolResultAudience.d.ts"},languageModelToolSupportsModel:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageModelToolSupportsModel.d.ts",version:1},languageStatusText:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageStatusText.d.ts"},mappedEditsProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.mappedEditsProvider.d.ts"},markdownAlertSyntax:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.markdownAlertSyntax.d.ts"},mcpServerDefinitions:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.mcpServerDefinitions.d.ts"},mcpToolDefinitions:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.mcpToolDefinitions.d.ts"},multiDocumentHighlightProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.multiDocumentHighlightProvider.d.ts"},nativeWindowHandle:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.nativeWindowHandle.d.ts"},newSymbolNamesProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.newSymbolNamesProvider.d.ts"},notebookCellExecution:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookCellExecution.d.ts"},notebookControllerAffinityHidden:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookControllerAffinityHidden.d.ts"},notebookDeprecated:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookDeprecated.d.ts"},notebookExecution:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookExecution.d.ts"},notebookKernelSource:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookKernelSource.d.ts"},notebookLiveShare:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookLiveShare.d.ts"},notebookMessaging:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookMessaging.d.ts"},notebookMime:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookMime.d.ts"},notebookReplDocument:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookReplDocument.d.ts"},notebookVariableProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookVariableProvider.d.ts"},portsAttributes:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.portsAttributes.d.ts"},profileContentHandlers:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.profileContentHandlers.d.ts"},quickDiffProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.quickDiffProvider.d.ts"},quickPickItemTooltip:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.quickPickItemTooltip.d.ts"},quickPickSortByLabel:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.quickPickSortByLabel.d.ts"},remoteCodingAgents:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.remoteCodingAgents.d.ts"},resolvers:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.resolvers.d.ts"},scmActionButton:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmActionButton.d.ts"},scmArtifactProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmArtifactProvider.d.ts"},scmHistoryProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmHistoryProvider.d.ts"},scmMultiDiffEditor:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmMultiDiffEditor.d.ts"},scmProviderOptions:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmProviderOptions.d.ts"},scmSelectedProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmSelectedProvider.d.ts"},scmTextDocument:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmTextDocument.d.ts"},scmValidation:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmValidation.d.ts"},shareProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.shareProvider.d.ts"},speech:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.speech.d.ts"},statusBarItemTooltip:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.statusBarItemTooltip.d.ts"},tabInputMultiDiff:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.tabInputMultiDiff.d.ts"},tabInputTextMerge:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.tabInputTextMerge.d.ts"},taskExecutionTerminal:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.taskExecutionTerminal.d.ts"},taskPresentationGroup:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.taskPresentationGroup.d.ts"},taskProblemMatcherStatus:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.taskProblemMatcherStatus.d.ts"},telemetry:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.telemetry.d.ts"},terminalCompletionProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalCompletionProvider.d.ts"},terminalDataWriteEvent:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalDataWriteEvent.d.ts"},terminalDimensions:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalDimensions.d.ts"},terminalExecuteCommandEvent:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalExecuteCommandEvent.d.ts"},terminalQuickFixProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalQuickFixProvider.d.ts"},terminalSelection:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalSelection.d.ts"},terminalShellEnv:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalShellEnv.d.ts"},terminalTitle:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalTitle.d.ts"},testObserver:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.testObserver.d.ts"},testRelatedCode:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.testRelatedCode.d.ts"},textDocumentChangeReason:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.textDocumentChangeReason.d.ts"},textEditorDiffInformation:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.textEditorDiffInformation.d.ts"},textSearchComplete2:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.textSearchComplete2.d.ts"},textSearchProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.textSearchProvider.d.ts"},textSearchProvider2:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.textSearchProvider2.d.ts"},timeline:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.timeline.d.ts"},tokenInformation:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.tokenInformation.d.ts"},toolProgress:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.toolProgress.d.ts"},treeItemMarkdownLabel:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.treeItemMarkdownLabel.d.ts"},treeViewActiveItem:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.treeViewActiveItem.d.ts"},treeViewMarkdownMessage:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.treeViewMarkdownMessage.d.ts"},treeViewReveal:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.treeViewReveal.d.ts"},tunnelFactory:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.tunnelFactory.d.ts"},tunnels:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.tunnels.d.ts"},valueSelectionInQuickPick:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.valueSelectionInQuickPick.d.ts"},workspaceTrust:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.workspaceTrust.d.ts"}},rz=Object.freeze(tUo);var Rci=oe.as(ea.JSONContribution),Nxt=class{constructor(i,e,t){this._messageHandler=i,this._extension=e,this._extensionPointId=t}_msg(i,e){this._messageHandler({type:i,message:e,extensionId:this._extension.identifier,extensionPointId:this._extensionPointId})}error(i){this._msg(gt.Error,i)}warn(i){this._msg(gt.Warning,i)}info(i){this._msg(gt.Info,i)}},Tci=class a{constructor(i,e){this.added=i;this.removed=e}static _toSet(i){let e=new QI;for(let t=0,o=i.length;t<o;t++)e.add(i[t].description.identifier);return e}static compute(i,e){if(!i||!i.length)return new a(e,[]);if(!e||!e.length)return new a([],i);let t=this._toSet(i),o=this._toSet(e),n=e.filter(s=>!t.has(s.description.identifier)),r=i.filter(s=>!o.has(s.description.identifier));return new a(n,r)}},_ci=class{constructor(i,e,t){this.name=i,this.defaultExtensionKind=e,this.canHandleResolver=t,this._handler=null,this._users=null,this._delta=null}setHandler(i){if(this._handler!==null)throw new Error("Handler already set!");return this._handler=i,this._handle(),{dispose:()=>{this._handler=null}}}acceptUsers(i){this._delta=Tci.compute(this._users,i),this._users=i,this._handle()}_handle(){if(!(this._handler===null||this._users===null||this._delta===null))try{this._handler(this._users,this._delta)}catch(i){mt(i)}}},iUo={type:"string",enum:["ui","workspace"],enumDescriptions:[d(16930,null),d(17010,null)]},z6i="vscode://schemas/vscode-extensions",Dci={properties:{engines:{type:"object",description:d(16994,null),properties:{vscode:{type:"string",description:d(16995,null),default:"^1.22.0"}}},publisher:{description:d(17006,null),type:"string"},displayName:{description:d(16991,null),type:"string"},categories:{description:d(16985,null),type:"array",uniqueItems:!0,items:{oneOf:[{type:"string",enum:gO},{type:"string",const:"Languages",deprecationMessage:d(16986,null)}]}},galleryBanner:{type:"object",description:d(16998,null),properties:{color:{description:d(16999,null),type:"string"},theme:{description:d(17000,null),type:"string",enum:["dark","light"]}}},contributes:{description:d(16987,null),type:"object",properties:{},default:{}},preview:{type:"boolean",description:d(17004,null)},enableProposedApi:{type:"boolean",deprecationMessage:d(16993,null)},enabledApiProposals:{markdownDescription:d(16992,null),type:"array",uniqueItems:!0,items:{type:"string",enum:Object.keys(rz).map(a=>a),markdownEnumDescriptions:Object.values(rz).map(a=>a.proposal)}},api:{markdownDescription:d(16965,null),type:"string",enum:["none"],enumDescriptions:[d(16966,null)]},activationEvents:{description:d(16931,null),type:"array",items:{type:"string",defaultSnippets:[{label:"onWebviewPanel",description:d(16962,null),body:"onWebviewPanel:viewType"},{label:"onLanguage",description:d(16945,null),body:"onLanguage:${1:languageId}"},{label:"onCommand",description:d(16935,null),body:"onCommand:${2:commandId}"},{label:"onDebug",description:d(16937,null),body:"onDebug"},{label:"onDebugInitialConfigurations",description:d(16940,null),body:"onDebugInitialConfigurations"},{label:"onDebugDynamicConfigurations",description:d(16939,null),body:"onDebugDynamicConfigurations"},{label:"onDebugResolve",description:d(16941,null),body:"onDebugResolve:${6:type}"},{label:"onDebugAdapterProtocolTracker",description:d(16938,null),body:"onDebugAdapterProtocolTracker:${6:type}"},{label:"workspaceContains",description:d(16964,null),body:"workspaceContains:${4:filePattern}"},{label:"onStartupFinished",description:d(16953,null),body:"onStartupFinished"},{label:"onTaskType",description:d(16954,null),body:"onTaskType:${1:taskType}"},{label:"onFileSystem",description:d(16943,null),body:"onFileSystem:${1:scheme}"},{label:"onEditSession",description:d(16942,null),body:"onEditSession:${1:scheme}"},{label:"onSearch",description:d(16952,null),body:"onSearch:${7:scheme}"},{label:"onView",body:"onView:${5:viewId}",description:d(16960,null)},{label:"onUri",body:"onUri",description:d(16959,null)},{label:"onOpenExternalUri",body:"onOpenExternalUri",description:d(16950,null)},{label:"onCustomEditor",body:"onCustomEditor:${9:viewType}",description:d(16936,null)},{label:"onNotebook",body:"onNotebook:${1:type}",description:d(16949,null)},{label:"onAuthenticationRequest",body:"onAuthenticationRequest:${11:authenticationProviderId}",description:d(16932,null)},{label:"onRenderer",description:d(16951,null),body:"onRenderer:${11:rendererId}"},{label:"onTerminalProfile",body:"onTerminalProfile:${1:terminalId}",description:d(16956,null)},{label:"onTerminalQuickFixRequest",body:"onTerminalQuickFixRequest:${1:quickFixId}",description:d(16957,null)},{label:"onWalkthrough",body:"onWalkthrough:${1:walkthroughID}",description:d(16961,null)},{label:"onIssueReporterOpened",body:"onIssueReporterOpened",description:d(16944,null)},{label:"onChatParticipant",body:"onChatParticipant:${1:participantId}",description:d(16934,null)},{label:"onChatContextProvider",body:"onChatContextProvider:${1:contextProviderId}",description:d(16933,null)},{label:"onLanguageModelChatProvider",body:"onLanguageModelChatProvider:${1:vendor}",description:d(16946,null)},{label:"onLanguageModelTool",body:"onLanguageModelTool:${1:toolId}",description:d(16947,null)},{label:"onTerminal",body:"onTerminal:{1:shellType}",description:d(16955,null)},{label:"onTerminalShellIntegration",body:"onTerminalShellIntegration:${1:shellType}",description:d(16958,null)},{label:"onMcpCollection",description:d(16948,null),body:"onMcpCollection:${2:collectionId}"},{label:"*",description:d(16963,null),body:"*"}]}},badges:{type:"array",description:d(16967,null),items:{type:"object",required:["url","href","description"],properties:{url:{type:"string",description:d(16970,null)},href:{type:"string",description:d(16969,null)},description:{type:"string",description:d(16968,null)}}}},markdown:{type:"string",description:d(17003,null),enum:["github","standard"],default:"github"},qna:{default:"marketplace",description:d(17007,null),anyOf:[{type:["string","boolean"],enum:["marketplace",!1]},{type:"string"}]},extensionDependencies:{description:d(16997,null),type:"array",uniqueItems:!0,items:{type:"string",pattern:CO}},extensionAffinity:{description:d(16996,null),type:"array",uniqueItems:!0,items:{type:"string",pattern:CO}},extensionPack:{description:d(16988,null),type:"array",uniqueItems:!0,items:{type:"string",pattern:CO}},extensionKind:{description:d(16923,null),type:"array",items:iUo,default:["workspace"],defaultSnippets:[{body:["ui"],description:d(16925,null)},{body:["workspace"],description:d(16927,null)},{body:["ui","workspace"],description:d(16926,null)},{body:["workspace","ui"],description:d(16928,null)},{body:[],description:d(16924,null)}]},capabilities:{description:d(16971,null),type:"object",properties:{virtualWorkspaces:{description:d(16979,null),type:["boolean","object"],defaultSnippets:[{label:"limited",body:{supported:"${1:limited}",description:"${2}"}},{label:"false",body:{supported:!1,description:"${2}"}}],default:(!0).valueOf,properties:{supported:{markdownDescription:d(16981,null),type:["string","boolean"],enum:["limited",!0,!1],enumDescriptions:[d(16983,null),d(16984,null),d(16982,null)]},description:{type:"string",markdownDescription:d(16980,null)}}},untrustedWorkspaces:{description:d(16972,null),type:"object",required:["supported"],defaultSnippets:[{body:{supported:"${1:limited}",description:"${2}"}}],properties:{supported:{markdownDescription:d(16975,null),type:["string","boolean"],enum:["limited",!0,!1],enumDescriptions:[d(16977,null),d(16978,null),d(16976,null)]},restrictedConfigurations:{description:d(16974,null),type:"array",items:{type:"string"}},description:{type:"string",markdownDescription:d(16973,null)}}}}},sponsor:{description:d(16989,null),type:"object",defaultSnippets:[{body:{url:"${1:https:}"}}],properties:{url:{description:d(16990,null),type:"string"}}},scripts:{type:"object",properties:{"vscode:prepublish":{description:d(17008,null),type:"string"},"vscode:uninstall":{description:d(17009,null),type:"string"}}},icon:{type:"string",description:d(17001,null)},l10n:{type:"string",description:d(17002,null)},pricing:{type:"string",markdownDescription:d(17005,null),enum:["Free","Trial"],default:"Free"}}},Lci=class{constructor(){this._extensionPoints=new Map}registerExtensionPoint(i){if(this._extensionPoints.has(i.extensionPoint))throw new Error("Duplicate extension point: "+i.extensionPoint);let e=new _ci(i.extensionPoint,i.defaultExtensionKind,i.canHandleResolver);return this._extensionPoints.set(i.extensionPoint,e),i.activationEventsGenerator&&gj.register(i.extensionPoint,i.activationEventsGenerator),Dci.properties.contributes.properties[i.extensionPoint]=i.jsonSchema,Rci.registerSchema(z6i,Dci),e}getExtensionPoints(){return Array.from(this._extensionPoints.values())}},K6i={ExtensionsRegistry:"ExtensionsRegistry"};oe.add(K6i.ExtensionsRegistry,new Lci);var Tn=oe.as(K6i.ExtensionsRegistry);Rci.registerSchema(z6i,Dci);Rci.registerSchema(U6i,{properties:{extensionEnabledApiProposals:{description:d(16929,null),type:"object",properties:{},additionalProperties:{anyOf:[{type:"array",uniqueItems:!0,items:{type:"string",enum:Object.keys(rz),markdownEnumDescriptions:Object.values(rz).map(a=>a.proposal)}}]}}}});var Ds;(i=>i.ExtensionFeaturesRegistry="workbench.registry.extensionFeatures")(Ds||={});var YI=ae("IExtensionFeaturesManagementService"),Mci=class{constructor(){this.extensionFeatures=new Map}registerExtensionFeature(i){if(this.extensionFeatures.has(i.id))throw new Error(`Extension feature with id '${i.id}' already exists`);return this.extensionFeatures.set(i.id,i),{dispose:()=>this.extensionFeatures.delete(i.id)}}getExtensionFeature(i){return this.extensionFeatures.get(i)}getExtensionFeatures(){return Array.from(this.extensionFeatures.values())}};oe.add(Ds.ExtensionFeaturesRegistry,new Mci);var G6i=Tn.registerExtensionPoint({extensionPoint:"jsonValidation",defaultExtensionKind:["workspace","web"],jsonSchema:{description:d(3214,null),type:"array",defaultSnippets:[{body:[{fileMatch:"${1:file.json}",url:"${2:url}"}]}],items:{type:"object",defaultSnippets:[{body:{fileMatch:"${1:file.json}",url:"${2:url}"}}],properties:{fileMatch:{type:["string","array"],description:d(3215,null),items:{type:["string"]}},url:{description:d(3216,null),type:"string"}}}}}),Oxt=class{constructor(){G6i.setHandler(i=>{for(let e of i){let t=e.value,o=e.collector,n=e.description.extensionLocation;if(!t||!Array.isArray(t)){o.error(d(3219,null));return}t.forEach(r=>{if(!Ae(r.fileMatch)&&!(Array.isArray(r.fileMatch)&&r.fileMatch.every(Ae))){o.error(d(3218,null));return}let s=r.url;if(!Ae(s)){o.error(d(3221,null));return}if(s.startsWith("./"))try{let l=je(n,s);La(l,n)||o.warn(d(3220,null,G6i.name,l.toString(),n.path))}catch(l){o.error(d(3222,null,l.message))}else if(!/^[^:/?#]+:\/\//.test(s)){o.error(d(3223,null));return}})}})}},Pci=class extends C{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.jsonValidation}render(e){let t=e.contributes?.jsonValidation||[];if(!t.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let o=[d(3217,null),d(3225,null)],n=t.map(r=>[new xe().appendMarkdown(`\`${Array.isArray(r.fileMatch)?r.fileMatch.join(", "):r.fileMatch}\``),r.url]);return{data:{headers:o,rows:n},dispose:()=>{}}}};oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:"jsonValidation",label:d(3224,null),access:{canToggle:!1},renderer:new Mt(Pci)});var Aci=oe.as(Tse.ColorContribution),Fxt=Aci.getColorReferenceSchema(),$6i="^\\w+[.\\w+]*$",oUo=Tn.registerExtensionPoint({extensionPoint:"colors",jsonSchema:{description:d(17285,null),type:"array",items:{type:"object",properties:{id:{type:"string",description:d(17287,null),pattern:$6i,patternErrorMessage:d(17288,null)},description:{type:"string",description:d(17286,null)},defaults:{type:"object",properties:{light:{description:d(17292,null),type:"string",anyOf:[Fxt,{type:"string",format:"color-hex"}]},dark:{description:d(17289,null),type:"string",anyOf:[Fxt,{type:"string",format:"color-hex"}]},highContrast:{description:d(17290,null),type:"string",anyOf:[Fxt,{type:"string",format:"color-hex"}]},highContrastLight:{description:d(17291,null),type:"string",anyOf:[Fxt,{type:"string",format:"color-hex"}]}},required:["light","dark"]}}}}}),Wxt=class{constructor(){oUo.setHandler((i,e)=>{for(let t of e.added){let o=t.value,n=t.collector;if(!o||!Array.isArray(o)){n.error(d(17298,null));return}let r=(s,l)=>s.length>0?s[0]==="#"?Oe.Format.CSS.parseHex(s):s:(n.error(d(17299,null,l)),Oe.red);for(let s of o){if(typeof s.id!="string"||s.id.length===0){n.error(d(17304,null));return}if(!s.id.match($6i)){n.error(d(17305,null));return}if(typeof s.description!="string"||s.id.length===0){n.error(d(17303,null));return}let l=s.defaults;if(!l||typeof l!="object"||typeof l.light!="string"||typeof l.dark!="string"){n.error(d(17300,null));return}if(l.highContrast&&typeof l.highContrast!="string"){n.error(d(17301,null));return}if(l.highContrastLight&&typeof l.highContrastLight!="string"){n.error(d(17302,null));return}Aci.registerColor(s.id,{light:r(l.light,"configuration.colors.defaults.light"),dark:r(l.dark,"configuration.colors.defaults.dark"),hcDark:r(l.highContrast??l.dark,"configuration.colors.defaults.highContrast"),hcLight:r(l.highContrastLight??l.light,"configuration.colors.defaults.highContrastLight")},s.description)}}for(let t of e.removed){let o=t.value;for(let n of o)Aci.deregisterColor(n.id)}})}},Nci=class extends C{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.colors}render(e){let t=e.contributes?.colors||[];if(!t.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let o=[d(17297,null),d(17296,null),d(17293,null),d(17295,null),d(17294,null)],n=s=>s[0]==="#"?Oe.fromHex(s):void 0,r=t.sort((s,l)=>s.id.localeCompare(l.id)).map(s=>[new xe().appendMarkdown(`\`${s.id}\``),s.description,n(s.defaults.dark)??new xe().appendMarkdown(`\`${s.defaults.dark}\``),n(s.defaults.light)??new xe().appendMarkdown(`\`${s.defaults.light}\``),n(s.defaults.highContrast)??new xe().appendMarkdown(`\`${s.defaults.highContrast}\``)]);return{data:{headers:o,rows:r},dispose:()=>{}}}};oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:"colors",label:d(17284,null),access:{canToggle:!1},renderer:new Mt(Nci)});var R3e=oe.as(Uti.IconContribution),nUo=R3e.getIconReferenceSchema(),q6i=`^${q.iconNameSegment}(-${q.iconNameSegment})+$`,rUo=Tn.registerExtensionPoint({extensionPoint:"icons",jsonSchema:{description:d(17373,null),type:"object",propertyNames:{pattern:q6i,description:d(17371,null),patternErrorMessage:d(17372,null)},additionalProperties:{type:"object",properties:{description:{type:"string",description:d(17370,null)},default:{anyOf:[nUo,{type:"object",properties:{fontPath:{description:d(17369,null),type:"string"},fontCharacter:{description:d(17368,null),type:"string"}},required:["fontPath","fontCharacter"],defaultSnippets:[{body:{fontPath:"${1:myiconfont.woff}",fontCharacter:"${2:\\\\E001}"}}]}],description:d(17367,null)}},required:["description","default"],defaultSnippets:[{body:{description:"${1:my icon}",default:{fontPath:"${2:myiconfont.woff}",fontCharacter:"${3:\\\\E001}"}}}]},defaultSnippets:[{body:{"${1:my-icon-id}":{description:"${2:my icon}",default:{fontPath:"${3:myiconfont.woff}",fontCharacter:"${4:\\\\E001}"}}}}]}}),Vxt=class{constructor(){rUo.setHandler((i,e)=>{for(let t of e.added){let o=t.value,n=t.collector;if(!o||typeof o!="object"){n.error(d(17374,null));return}for(let r in o){if(!r.match(q6i)){n.error(d(17379,null));return}let s=o[r];if(typeof s.description!="string"||s.description.length===0){n.error(d(17378,null));return}let l=s.default;if(typeof l=="string")R3e.registerIcon(r,{id:l},s.description);else if(typeof l=="object"&&typeof l.fontPath=="string"&&typeof l.fontCharacter=="string"){let c=Am(l.fontPath).substring(1),u=sUo[c];if(!u){n.warn(d(17376,null,c));return}let p=t.description.extensionLocation,h=je(p,l.fontPath),g=aUo(t.description,l.fontPath),f=R3e.registerIconFont(g,{src:[{location:h,format:u}]});if(!La(h,p)){n.warn(d(17377,null,h.path,p.path));return}R3e.registerIcon(r,{fontCharacter:l.fontCharacter,font:{id:g,definition:f}},s.description)}else n.error(d(17375,null))}}for(let t of e.removed){let o=t.value;for(let n in o)R3e.deregisterIcon(n)}})}},sUo={ttf:"truetype",woff:"woff",woff2:"woff2"};function aUo(a,i){return Lo.join(a.identifier.value,i)}var lUo="*",Y6i=":",X6i=".",Bxt="\\w+[-_\\w+]*",fj=`^${Bxt}$`,cUo=`^(${Bxt}|\\*)(\\${X6i}${Bxt})*(${Y6i}${Bxt})?$`,dUo="^(\\s*(italic|bold|underline|strikethrough))*\\s*$",tP=class{constructor(i,e,t,o,n){this.foreground=i;this.bold=e;this.underline=t;this.strikethrough=o;this.italic=n}};(r=>{function a(s){return{_foreground:s.foreground===void 0?null:Oe.Format.CSS.formatHexA(s.foreground,!0),_bold:s.bold===void 0?null:s.bold,_underline:s.underline===void 0?null:s.underline,_italic:s.italic===void 0?null:s.italic,_strikethrough:s.strikethrough===void 0?null:s.strikethrough}}r.toJSONObject=a;function i(s){if(s){let l=u=>typeof u=="boolean"?u:void 0,c=u=>typeof u=="string"?Oe.fromHex(u):void 0;return new r(c(s._foreground),l(s._bold),l(s._underline),l(s._strikethrough),l(s._italic))}}r.fromJSONObject=i;function e(s,l){return s===l?!0:s!==void 0&&l!==void 0&&(s.foreground instanceof Oe?s.foreground.equals(l.foreground):l.foreground===void 0)&&s.bold===l.bold&&s.underline===l.underline&&s.strikethrough===l.strikethrough&&s.italic===l.italic}r.equals=e;function t(s){return s instanceof r}r.is=t;function o(s){return new r(s.foreground,s.bold,s.underline,s.strikethrough,s.italic)}r.fromData=o;function n(s,l,c,u,p,h){let g;if(s!==void 0&&(g=Oe.fromHex(s)),l!==void 0){c=h=u=p=!1;let f=/italic|bold|underline|strikethrough/g,v;for(;v=f.exec(l);)switch(v[0]){case"bold":c=!0;break;case"italic":h=!0;break;case"underline":u=!0;break;case"strikethrough":p=!0;break}}return new r(g,c,u,p,h)}r.fromSettings=n})(tP||={});var rxe;(o=>{function a(n,r){if(r&&typeof r._selector=="string"&&r._style){let s=tP.fromJSONObject(r._style);if(s)try{return{selector:n.parseTokenSelector(r._selector),style:s}}catch{}}}o.fromJSONObject=a;function i(n){return{_selector:n.selector.id,_style:tP.toJSONObject(n.style)}}o.toJSONObject=i;function e(n,r){return n===r?!0:n!==void 0&&r!==void 0&&n.selector&&r.selector&&n.selector.id===r.selector.id&&tP.equals(n.style,r.style)}o.equals=e;function t(n){return n&&n.selector&&typeof n.selector.id=="string"&&tP.is(n.style)}o.is=t})(rxe||={});var uUo={TokenClassificationContribution:"base.contributions.tokenClassification"},Fci=class extends C{constructor(){super();this._onDidChangeSchema=this._register(new E);this.onDidChangeSchema=this._onDidChangeSchema.event;this.currentTypeNumber=0;this.currentModifierBit=1;this.tokenStylingDefaultRules=[];this.tokenStylingSchema={type:"object",properties:{},patternProperties:{[cUo]:Oci()},additionalProperties:!1,definitions:{style:{type:"object",description:d(2644,null),properties:{foreground:{type:"string",description:d(2642,null),format:"color-hex",default:"#ff0000"},background:{type:"string",deprecationMessage:d(2638,null)},fontStyle:{type:"string",description:d(2640,null),pattern:dUo,patternErrorMessage:d(2637,null),defaultSnippets:[{label:d(2641,null),bodyText:'""'},{body:"italic"},{body:"bold"},{body:"underline"},{body:"strikethrough"},{body:"italic bold"},{body:"italic underline"},{body:"italic strikethrough"},{body:"bold underline"},{body:"bold strikethrough"},{body:"underline strikethrough"},{body:"italic bold underline"},{body:"italic bold strikethrough"},{body:"italic underline strikethrough"},{body:"bold underline strikethrough"},{body:"italic bold underline strikethrough"}]},bold:{type:"boolean",description:d(2639,null)},italic:{type:"boolean",description:d(2643,null)},underline:{type:"boolean",description:d(2646,null)},strikethrough:{type:"boolean",description:d(2645,null)}},defaultSnippets:[{body:{foreground:"${1:#FF0000}",fontStyle:"${2:bold}"}}]}}};this.tokenTypeById=Object.create(null),this.tokenModifierById=Object.create(null),this.typeHierarchy=Object.create(null)}registerTokenType(e,t,o,n){if(!e.match(fj))throw new Error("Invalid token type id.");if(o&&!o.match(fj))throw new Error("Invalid token super type id.");let s={num:this.currentTypeNumber++,id:e,superType:o,description:t,deprecationMessage:n};this.tokenTypeById[e]=s;let l=Oci(t,n);this.tokenStylingSchema.properties[e]=l,this.typeHierarchy=Object.create(null)}registerTokenModifier(e,t,o){if(!e.match(fj))throw new Error("Invalid token modifier id.");let n=this.currentModifierBit;this.currentModifierBit=this.currentModifierBit*2;let r={num:n,id:e,description:t,deprecationMessage:o};this.tokenModifierById[e]=r,this.tokenStylingSchema.properties[`*.${e}`]=Oci(t,o)}parseTokenSelector(e,t){let o=Hxt(e,t);return o.type?{match:(n,r,s)=>{let l=0;if(o.language!==void 0){if(o.language!==s)return-1;l+=10}if(o.type!==lUo){let u=this.getTypeHierarchy(n).indexOf(o.type);if(u===-1)return-1;l+=100-u}for(let c of o.modifiers)if(r.indexOf(c)===-1)return-1;return l+o.modifiers.length*100},id:`${[o.type,...o.modifiers.sort()].join(".")}${o.language!==void 0?":"+o.language:""}`}:{match:()=>-1,id:"$invalid"}}registerTokenStyleDefault(e,t){this.tokenStylingDefaultRules.push({selector:e,defaults:t})}deregisterTokenStyleDefault(e){let t=e.id;this.tokenStylingDefaultRules=this.tokenStylingDefaultRules.filter(o=>o.selector.id!==t)}deregisterTokenType(e){delete this.tokenTypeById[e],delete this.tokenStylingSchema.properties[e],this.typeHierarchy=Object.create(null)}deregisterTokenModifier(e){delete this.tokenModifierById[e],delete this.tokenStylingSchema.properties[`*.${e}`]}getTokenTypes(){return Object.keys(this.tokenTypeById).map(e=>this.tokenTypeById[e])}getTokenModifiers(){return Object.keys(this.tokenModifierById).map(e=>this.tokenModifierById[e])}getTokenStylingSchema(){return this.tokenStylingSchema}getTokenStylingDefaultRules(){return this.tokenStylingDefaultRules}getTypeHierarchy(e){let t=this.typeHierarchy[e];if(!t){this.typeHierarchy[e]=t=[e];let o=this.tokenTypeById[e];for(;o&&o.superType;)t.push(o.superType),o=this.tokenTypeById[o.superType]}return t}toString(){let e=(t,o)=>{let n=t.indexOf(".")===-1?0:1,r=o.indexOf(".")===-1?0:1;return n!==r?n-r:t.localeCompare(o)};return Object.keys(this.tokenTypeById).sort(e).map(t=>`- \`${t}\`: ${this.tokenTypeById[t].description}`).join(`
`)}},j6i=Y6i.charCodeAt(0),pUo=X6i.charCodeAt(0);function Hxt(a,i){let e=a.length,t=i,o=[];for(let r=e-1;r>=0;r--){let s=a.charCodeAt(r);if(s===j6i||s===pUo){let l=a.substring(r+1,e);e=r,s===j6i?t=l:o.push(l)}}return{type:a.substring(0,e),modifiers:o,language:t}}var Uxt=mUo();oe.add(uUo.TokenClassificationContribution,Uxt);function mUo(){let a=new Fci;function i(t,o,n=[],r,s){return a.registerTokenType(t,o,r,s),n&&e(t,n),t}function e(t,o){try{let n=a.parseTokenSelector(t);a.registerTokenStyleDefault(n,{scopesToProbe:o})}catch(n){console.log(n)}}return i("comment",d(2614,null),[["comment"]]),i("string",d(2648,null),[["string"]]),i("keyword",d(2624,null),[["keyword.control"]]),i("number",d(2631,null),[["constant.numeric"]]),i("regexp",d(2636,null),[["constant.regexp"]]),i("operator",d(2632,null),[["keyword.operator"]]),i("namespace",d(2630,null),[["entity.name.namespace"]]),i("type",d(2650,null),[["entity.name.type"],["support.type"]]),i("struct",d(2649,null),[["entity.name.type.struct"]]),i("class",d(2613,null),[["entity.name.type.class"],["support.class"]]),i("interface",d(2623,null),[["entity.name.type.interface"]]),i("enum",d(2619,null),[["entity.name.type.enum"]]),i("typeParameter",d(2651,null),[["entity.name.type.parameter"]]),i("function",d(2622,null),[["entity.name.function"],["support.function"]]),i("member",d(2627,null),[],"method","Deprecated use `method` instead"),i("method",d(2628,null),[["entity.name.function.member"],["support.function"]]),i("macro",d(2626,null),[["entity.name.function.preprocessor"]]),i("variable",d(2652,null),[["variable.other.readwrite"],["entity.name.variable"]]),i("parameter",d(2633,null),[["variable.parameter"]]),i("property",d(2634,null),[["variable.other.property"]]),i("enumMember",d(2620,null),[["variable.other.enummember"]]),i("event",d(2621,null),[["variable.other.event"]]),i("decorator",d(2616,null),[["entity.name.decorator"],["entity.name.function"]]),i("label",d(2625,null),void 0),a.registerTokenModifier("declaration",d(2615,null),void 0),a.registerTokenModifier("documentation",d(2618,null),void 0),a.registerTokenModifier("static",d(2647,null),void 0),a.registerTokenModifier("abstract",d(2611,null),void 0),a.registerTokenModifier("deprecated",d(2617,null),void 0),a.registerTokenModifier("modification",d(2629,null),void 0),a.registerTokenModifier("async",d(2612,null),void 0),a.registerTokenModifier("readonly",d(2635,null),void 0),e("variable.readonly",[["variable.other.constant"]]),e("property.readonly",[["variable.other.constant.property"]]),e("type.defaultLibrary",[["support.type"]]),e("class.defaultLibrary",[["support.class"]]),e("interface.defaultLibrary",[["support.class"]]),e("variable.defaultLibrary",[["support.variable"],["support.other.variable"]]),e("variable.defaultLibrary.readonly",[["support.constant"]]),e("property.defaultLibrary",[["support.variable.property"]]),e("property.defaultLibrary.readonly",[["support.constant.property"]]),e("function.defaultLibrary",[["support.function"]]),e("member.defaultLibrary",[["support.function"]]),a}function zxt(){return Uxt}function Oci(a,i){return{description:a,deprecationMessage:i,defaultSnippets:[{body:"${1:#ff0000}"}],anyOf:[{type:"string",format:"color-hex"},{$ref:"#/definitions/style"}]}}var sxe="vscode://schemas/token-styling",J6i=oe.as(ea.JSONContribution);J6i.registerSchema(sxe,Uxt.getTokenStylingSchema());var Q6i=new Dt(()=>J6i.notifySchemaChanged(sxe),200);Uxt.onDidChangeSchema(()=>{Q6i.isScheduled()||Q6i.schedule()});var rY=zxt(),hUo=Tn.registerExtensionPoint({extensionPoint:"semanticTokenTypes",jsonSchema:{description:d(17448,null),type:"array",items:{type:"object",properties:{id:{type:"string",description:d(17449,null),pattern:fj,patternErrorMessage:d(17450,null)},superType:{type:"string",description:d(17451,null),pattern:fj,patternErrorMessage:d(17452,null)},description:{type:"string",description:d(17440,null)}}}}}),gUo=Tn.registerExtensionPoint({extensionPoint:"semanticTokenModifiers",jsonSchema:{description:d(17441,null),type:"array",items:{type:"object",properties:{id:{type:"string",description:d(17443,null),pattern:fj,patternErrorMessage:d(17444,null)},description:{description:d(17442,null)}}}}}),fUo=Tn.registerExtensionPoint({extensionPoint:"semanticTokenScopes",jsonSchema:{description:d(17445,null),type:"array",items:{type:"object",properties:{language:{description:d(17446,null),type:"string"},scopes:{description:d(17447,null),type:"object",additionalProperties:{type:"array",items:{type:"string"}}}}}}}),Kxt=class{constructor(){function i(e,t,o){if(typeof e.id!="string"||e.id.length===0)return o.error(d(17454,null,t)),!1;if(!e.id.match(fj))return o.error(d(17455,null,t)),!1;let n=e.superType;return n&&!n.match(fj)?(o.error(d(17463,null,t)),!1):typeof e.description!="string"||e.id.length===0?(o.error(d(17453,null,t)),!1):!0}hUo.setHandler((e,t)=>{for(let o of t.added){let n=o.value,r=o.collector;if(!n||!Array.isArray(n)){r.error(d(17462,null));return}for(let s of n)i(s,"semanticTokenType",r)&&rY.registerTokenType(s.id,s.description,s.superType)}for(let o of t.removed){let n=o.value;for(let r of n)rY.deregisterTokenType(r.id)}}),gUo.setHandler((e,t)=>{for(let o of t.added){let n=o.value,r=o.collector;if(!n||!Array.isArray(n)){r.error(d(17456,null));return}for(let s of n)i(s,"semanticTokenModifier",r)&&rY.registerTokenModifier(s.id,s.description)}for(let o of t.removed){let n=o.value;for(let r of n)rY.deregisterTokenModifier(r.id)}}),fUo.setHandler((e,t)=>{for(let o of t.added){let n=o.value,r=o.collector;if(!n||!Array.isArray(n)){r.error(d(17457,null));return}for(let s of n){if(s.language&&typeof s.language!="string"){r.error(d(17458,null));continue}if(!s.scopes||typeof s.scopes!="object"){r.error(d(17459,null));continue}for(let l in s.scopes){let c=s.scopes[l];if(!Array.isArray(c)||c.some(u=>typeof u!="string")){r.error(d(17461,null));continue}try{let u=rY.parseTokenSelector(l,s.language);rY.registerTokenStyleDefault(u,{scopesToProbe:c.map(p=>p.split(" "))})}catch{r.error(d(17460,null,l))}}}}for(let o of t.removed){let n=o.value;for(let r of n)for(let s in r.scopes){let l=r.scopes[s];try{let c=rY.parseTokenSelector(s,r.language);rY.registerTokenStyleDefault(c,{scopesToProbe:l.map(u=>u.split(" "))})}catch{}}}})}};var $xt;(i=>i.DEFAULT={allowTrailingComma:!0})($xt||={});function $le(a,i=!1){let e=0,t=a.length,o="",n=0,r=16,s=0;function l(v){let b=0,S=0;for(;b<v;){let y=a.charCodeAt(e);if(y>=48&&y<=57)S=S*16+y-48;else if(y>=65&&y<=70)S=S*16+y-65+10;else if(y>=97&&y<=102)S=S*16+y-97+10;else break;e++,b++}return b<v&&(S=-1),S}function c(v){e=v,o="",n=0,r=16,s=0}function u(){let v=e;if(a.charCodeAt(e)===48)e++;else for(e++;e<a.length&&axe(a.charCodeAt(e));)e++;if(e<a.length&&a.charCodeAt(e)===46)if(e++,e<a.length&&axe(a.charCodeAt(e)))for(e++;e<a.length&&axe(a.charCodeAt(e));)e++;else return s=3,a.substring(v,e);let b=e;if(e<a.length&&(a.charCodeAt(e)===69||a.charCodeAt(e)===101))if(e++,(e<a.length&&a.charCodeAt(e)===43||a.charCodeAt(e)===45)&&e++,e<a.length&&axe(a.charCodeAt(e))){for(e++;e<a.length&&axe(a.charCodeAt(e));)e++;b=e}else s=3;return a.substring(v,b)}function p(){let v="",b=e;for(;;){if(e>=t){v+=a.substring(b,e),s=2;break}let S=a.charCodeAt(e);if(S===34){v+=a.substring(b,e),e++;break}if(S===92){if(v+=a.substring(b,e),e++,e>=t){s=2;break}switch(a.charCodeAt(e++)){case 34:v+='"';break;case 92:v+="\\";break;case 47:v+="/";break;case 98:v+="\b";break;case 102:v+="\f";break;case 110:v+=`
`;break;case 114:v+="\r";break;case 116:v+=" ";break;case 117:{let w=l(4);w>=0?v+=String.fromCharCode(w):s=4;break}default:s=5}b=e;continue}if(S>=0&&S<=31)if(Gxt(S)){v+=a.substring(b,e),s=2;break}else s=6;e++}return v}function h(){if(o="",s=0,n=e,e>=t)return n=t,r=17;let v=a.charCodeAt(e);if(Wci(v)){do e++,o+=String.fromCharCode(v),v=a.charCodeAt(e);while(Wci(v));return r=15}if(Gxt(v))return e++,o+=String.fromCharCode(v),v===13&&a.charCodeAt(e)===10&&(e++,o+=`
`),r=14;switch(v){case 123:return e++,r=1;case 125:return e++,r=2;case 91:return e++,r=3;case 93:return e++,r=4;case 58:return e++,r=6;case 44:return e++,r=5;case 34:return e++,o=p(),r=10;case 47:{let b=e-1;if(a.charCodeAt(e+1)===47){for(e+=2;e<t&&!Gxt(a.charCodeAt(e));)e++;return o=a.substring(b,e),r=12}if(a.charCodeAt(e+1)===42){e+=2;let S=t-1,y=!1;for(;e<S;){if(a.charCodeAt(e)===42&&a.charCodeAt(e+1)===47){e+=2,y=!0;break}e++}return y||(e++,s=1),o=a.substring(b,e),r=13}return o+=String.fromCharCode(v),e++,r=16}case 45:if(o+=String.fromCharCode(v),e++,e===t||!axe(a.charCodeAt(e)))return r=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return o+=u(),r=11;default:for(;e<t&&g(v);)e++,v=a.charCodeAt(e);if(n!==e){switch(o=a.substring(n,e),o){case"true":return r=8;case"false":return r=9;case"null":return r=7}return r=16}return o+=String.fromCharCode(v),e++,r=16}}function g(v){if(Wci(v)||Gxt(v))return!1;switch(v){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function f(){let v;do v=h();while(v>=12&&v<=15);return v}return{setPosition:c,getPosition:()=>e,scan:i?f:h,getToken:()=>r,getTokenValue:()=>o,getTokenOffset:()=>n,getTokenLength:()=>e-n,getTokenError:()=>s}}function Wci(a){return a===32||a===9||a===11||a===12||a===160||a===5760||a>=8192&&a<=8203||a===8239||a===8287||a===12288||a===65279}function Gxt(a){return a===10||a===13||a===8232||a===8233}function axe(a){return a>=48&&a<=57}function Z6i(a,i){let e=[],t=new Object,o,n={value:{},offset:0,length:0,type:"object",parent:void 0},r=!1;function s(l,c,u,p){n.value=l,n.offset=c,n.length=u,n.type=p,n.colonOffset=void 0,o=n}try{Wx(a,{onObjectBegin:(l,c)=>{if(i<=l)throw t;o=void 0,r=i>l,e.push("")},onObjectProperty:(l,c,u)=>{if(i<c||(s(l,c,u,"property"),e[e.length-1]=l,i<=c+u))throw t},onObjectEnd:(l,c)=>{if(i<=l)throw t;o=void 0,e.pop()},onArrayBegin:(l,c)=>{if(i<=l)throw t;o=void 0,e.push(0)},onArrayEnd:(l,c)=>{if(i<=l)throw t;o=void 0,e.pop()},onLiteralValue:(l,c,u)=>{if(i<c||(s(l,c,u,Vx(l)),i<=c+u))throw t},onSeparator:(l,c,u)=>{if(i<=c)throw t;if(l===":"&&o&&o.type==="property")o.colonOffset=c,r=!1,o=void 0;else if(l===","){let p=e[e.length-1];typeof p=="number"?e[e.length-1]=p+1:(r=!0,e[e.length-1]=""),o=void 0}}})}catch(l){if(l!==t)throw l}return{path:e,previousNode:o,isAtPropertyKey:r,matches:l=>{let c=0;for(let u=0;c<l.length&&u<e.length;u++)if(l[c]===e[u]||l[c]==="*")c++;else if(l[c]!=="**")return!1;return c===l.length}}}function Ur(a,i=[],e=$xt.DEFAULT){let t=null,o=[],n=[];function r(l){Array.isArray(o)?o.push(l):t!==null&&(o[t]=l)}return Wx(a,{onObjectBegin:()=>{let l={};r(l),n.push(o),o=l,t=null},onObjectProperty:l=>{t=l},onObjectEnd:()=>{o=n.pop()},onArrayBegin:()=>{let l=[];r(l),n.push(o),o=l,t=null},onArrayEnd:()=>{o=n.pop()},onLiteralValue:r,onError:(l,c,u)=>{i.push({error:l,offset:c,length:u})}},e),o[0]}function zL(a,i=[],e=$xt.DEFAULT){let t={type:"array",offset:-1,length:-1,children:[],parent:void 0};function o(l){t.type==="property"&&(t.length=l-t.offset,t=t.parent)}function n(l){return t.children.push(l),l}Wx(a,{onObjectBegin:l=>{t=n({type:"object",offset:l,length:-1,parent:t,children:[]})},onObjectProperty:(l,c,u)=>{t=n({type:"property",offset:c,length:-1,parent:t,children:[]}),t.children.push({type:"string",value:l,offset:c,length:u,parent:t})},onObjectEnd:(l,c)=>{t.length=l+c-t.offset,t=t.parent,o(l+c)},onArrayBegin:(l,c)=>{t=n({type:"array",offset:l,length:-1,parent:t,children:[]})},onArrayEnd:(l,c)=>{t.length=l+c-t.offset,t=t.parent,o(l+c)},onLiteralValue:(l,c,u)=>{n({type:Vx(l),offset:c,length:u,parent:t,value:l}),o(c+u)},onSeparator:(l,c,u)=>{t.type==="property"&&(l===":"?t.colonOffset=c:l===","&&o(c))},onError:(l,c,u)=>{i.push({error:l,offset:c,length:u})}},e);let s=t.children[0];return s&&delete s.parent,s}function lC(a,i){if(!a)return;let e=a;for(let t of i)if(typeof t=="string"){if(e.type!=="object"||!Array.isArray(e.children))return;let o=!1;for(let n of e.children)if(Array.isArray(n.children)&&n.children[0].value===t){e=n.children[1],o=!0;break}if(!o)return}else{let o=t;if(e.type!=="array"||o<0||!Array.isArray(e.children)||o>=e.children.length)return;e=e.children[o]}return e}function Vci(a){if(!a.parent||!a.parent.children)return[];let i=Vci(a.parent);if(a.parent.type==="property"){let e=a.parent.children[0].value;i.push(e)}else if(a.parent.type==="array"){let e=a.parent.children.indexOf(a);e!==-1&&i.push(e)}return i}function vUo(a,i,e=!1){return i>=a.offset&&i<a.offset+a.length||e&&i===a.offset+a.length}function Bci(a,i,e=!1){if(vUo(a,i,e)){let t=a.children;if(Array.isArray(t))for(let o=0;o<t.length&&t[o].offset<=i;o++){let n=Bci(t[o],i,e);if(n)return n}return a}}function Wx(a,i,e=$xt.DEFAULT){let t=$le(a,!1);function o(U){return U?()=>U(t.getTokenOffset(),t.getTokenLength()):()=>!0}function n(U){return U?G=>U(G,t.getTokenOffset(),t.getTokenLength()):()=>!0}let r=o(i.onObjectBegin),s=n(i.onObjectProperty),l=o(i.onObjectEnd),c=o(i.onArrayBegin),u=o(i.onArrayEnd),p=n(i.onLiteralValue),h=n(i.onSeparator),g=o(i.onComment),f=n(i.onError),v=e&&e.disallowComments,b=e&&e.allowTrailingComma;function S(){for(;;){let U=t.scan();switch(t.getTokenError()){case 4:y(14);break;case 5:y(15);break;case 3:y(13);break;case 1:v||y(11);break;case 2:y(12);break;case 6:y(16);break}switch(U){case 12:case 13:v?y(10):g();break;case 16:y(1);break;case 15:case 14:break;default:return U}}}function y(U,G=[],$=[]){if(f(U),G.length+$.length>0){let te=t.getToken();for(;te!==17;){if(G.indexOf(te)!==-1){S();break}else if($.indexOf(te)!==-1)break;te=S()}}}function w(U){let G=t.getTokenValue();return U?p(G):s(G),S(),!0}function k(){switch(t.getToken()){case 11:{let U=0;try{U=JSON.parse(t.getTokenValue()),typeof U!="number"&&(y(2),U=0)}catch{y(2)}p(U);break}case 7:p(null);break;case 8:p(!0);break;case 9:p(!1);break;default:return!1}return S(),!0}function T(){return t.getToken()!==10?(y(3,[],[2,5]),!1):(w(!1),t.getToken()===6?(h(":"),S(),V()||y(4,[],[2,5])):y(5,[],[2,5]),!0)}function N(){r(),S();let U=!1;for(;t.getToken()!==2&&t.getToken()!==17;){if(t.getToken()===5){if(U||y(4,[],[]),h(","),S(),t.getToken()===2&&b)break}else U&&y(6,[],[]);T()||y(4,[],[2,5]),U=!0}return l(),t.getToken()!==2?y(7,[2],[]):S(),!0}function O(){c(),S();let U=!1;for(;t.getToken()!==4&&t.getToken()!==17;){if(t.getToken()===5){if(U||y(4,[],[]),h(","),S(),t.getToken()===4&&b)break}else U&&y(6,[],[]);V()||y(4,[],[4,5]),U=!0}return u(),t.getToken()!==4?y(8,[4],[]):S(),!0}function V(){switch(t.getToken()){case 3:return O();case 1:return N();case 10:return w(!0);default:return k()}}return S(),t.getToken()===17?e.allowEmptyContent?!0:(y(4,[],[]),!1):V()?(t.getToken()!==17&&y(9,[],[]),!0):(y(4,[],[]),!1)}function Vx(a){switch(typeof a){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(a){if(Array.isArray(a))return"array"}else return"null";return"object"}default:return"null"}}function bUo(a){if(Pp===2&&/^penguin(\.|$)/i.test(a))return"chromebook"}function e9i(a,i,e,t,o,n,r,s,l,c,u){let p=Object.create(null);p["common.machineId"]=n,p["common.sqmId"]=r,p["common.devDeviceId"]=s,p.sessionID=_t()+Date.now(),p.commitHash=t,p.version=o,p["common.releaseDate"]=c,p["common.platformVersion"]=(a||"").replace(/^(\d+)(\.\d+)?(\.\d+)?(.*)/,"$1$2$3"),p["common.platform"]=LT(Pp),p["common.nodePlatform"]=ZA,p["common.nodeArch"]=e,p["common.product"]=u||"desktop",l&&(p["common.msftInternal"]=l);let h=0,g=Date.now();Object.defineProperties(p,{timestamp:{get:()=>new Date,enumerable:!0},"common.timesincesessionstart":{get:()=>Date.now()-g,enumerable:!0},"common.sequence":{get:()=>h++,enumerable:!0}}),rbe&&(p["common.snap"]="true");let f=bUo(i);return f&&(p["common.platformDetail"]=f),p}function t9i(a){let i=fp.USERDNSDOMAIN;if(!i)return!1;let e=i.toLowerCase();return a.some(t=>e===t)}var Im=class{constructor(i){this.value=i;this.isTrustedTelemetryValue=!0}},Hci=class{constructor(){this.telemetryLevel=0;this.sessionId="someValue.sessionId";this.machineId="someValue.machineId";this.sqmId="someValue.sqmId";this.devDeviceId="someValue.devDeviceId";this.firstSessionDate="someValue.firstSessionDate";this.sendErrorTelemetry=!1}publicLog(){}publicLog2(){}publicLogError(){}publicLogError2(){}setExperimentProperty(){}},i9i=new Hci;var qle="telemetry",qxt={id:qle,name:d(2302,null)};function KL(a,i){return!i.isBuilt&&!i.disableTelemetry?!0:!(i.disableTelemetry||!a.enableTelemetry)}function lxe(a,i){return i.extensionTestsLocationURI?!0:!(i.isBuilt||i.disableTelemetry||a.enableTelemetry&&a.aiConfig?.ariaKey)}function xO(a){let i=a.getValue(bN),e=a.getValue(hmt);if(a.getValue(zre)===!1||e===!1)return 0;switch(i??"all"){case"all":return 3;case"error":return 2;case"crash":return 1;case"off":return 0}}function jxt(a,i){if(!a)return"none";let e=$S(a),t=i?.remoteExtensionTips;if(t&&Object.prototype.hasOwnProperty.call(t,e))return e;let o=i?.virtualWorkspaceExtensionTips;return o&&Object.prototype.hasOwnProperty.call(o,e)?e:"other"}function o9i(a,i){let e=a.msftInternalDomains||[],t=i.getValue("telemetry.internalTesting");return t9i(e)||t}function n9i(a){return[a.appRoot,a.extensionsPath,a.userHome.fsPath,a.tmpDir.fsPath,a.userDataPath]}function IUo(a,i){if(!a||!a.includes("/")&&!a.includes("\\"))return a;let e=a,t=[];for(let l of i)for(;;){let c=l.exec(a);if(!c)break;t.push([c.index,l.lastIndex])}let o=/^[\\\/]?(node_modules|node_modules\.asar)[\\\/]/,n=/^(.*?)((?:\.vscode(?:-[a-z]+)*|resources[\\\/]app)[\\\/]extensions[\\\/].*)$/i,r=/(file:\/\/)?([a-zA-Z]:(\\\\|\\|\/)|(\\\\|\\|\/))?([\w-\._]+(\\\\|\\|\/))+[\w-\._]*/g,s=0;for(e="";;){let l=r.exec(a);if(!l)break;let c=t.some(([u,p])=>l.index<p&&u<r.lastIndex);if(!o.test(l[0])&&!c){let u=n.exec(l[0]);u?e+=a.substring(s,l.index)+"<REDACTED: user-file-path>/"+u[2]:e+=a.substring(s,l.index)+"<REDACTED: user-file-path>",s=r.lastIndex}}return s<a.length&&(e+=a.substr(s)),e}function yUo(a){if(!a)return a;let i=[{label:"URL",regex:/[a-zA-Z][a-zA-Z0-9+.-]*:\/\/[^\s]*/},{label:"Google API Key",regex:/AIza[A-Za-z0-9_\\\-]{35}/},{label:"JWT",regex:/eyJ[0eXAiOiJKV1Qi|hbGci|a-zA-Z0-9\-_]+\.[a-zA-Z0-9\-_]+\.[a-zA-Z0-9\-_]+/},{label:"Slack Token",regex:/xox[pbar]\-[A-Za-z0-9]/},{label:"GitHub Token",regex:/(gh[psuro]_[a-zA-Z0-9]{36}|github_pat_[a-zA-Z0-9]{22}_[a-zA-Z0-9]{59})/},{label:"Generic Secret",regex:/(key|token|sig|secret|signature|password|passwd|pwd|android:value)[^a-zA-Z0-9]/i},{label:"CLI Credentials",regex:/((login|psexec|(certutil|psexec)\.exe).{1,50}(\s-u(ser(name)?)?\s+.{3,100})?\s-(admin|user|vm|root)?p(ass(word)?)?\s+["']?[^$\-\/\s]|(^|[\s\r\n\\])net(\.exe)?.{1,5}(user\s+|share\s+\/user:| user -? secrets ? set) \s + [^ $\s \/])/},{label:"Microsoft Entra ID",regex:/eyJ(?:0eXAiOiJKV1Qi|hbGci|[a-zA-Z0-9\-_]+\.[a-zA-Z0-9\-_]+\.)/},{label:"Email",regex:/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/}];for(let e of i)if(e.regex.test(a))return`<REDACTED: ${e.label}>`;return a}function r9i(a,i){return a?Gk(a,e=>{if(e instanceof Im||Object.hasOwnProperty.call(e,"isTrustedTelemetryValue"))return e.value;if(typeof e=="string"){let t=e.replaceAll("%20"," ");t=IUo(t,i);for(let o of i)t=t.replace(o,"");return t=yUo(t),t}}):{}}function Ot(a,i){return a.uuid&&i.uuid?a.uuid===i.uuid:a.id===i.id?!0:Uw(a.id,i.id)===0}var wUo=/^([^.]+\..+)-(\d+\.\d+\.\d+)(-(.+))?$/,Qxt=class a{constructor(i,e,t="undefined"){this.identifier=i;this.version=e;this.targetPlatform=t;this.id=i.id}static create(i){let e=i.manifest?i.manifest.version:i.version,t=i.manifest?i.targetPlatform:i.properties.targetPlatform;return new a(i.identifier,e,t)}static parse(i){let e=wUo.exec(i);return e&&e[1]&&e[2]?new a({id:e[1]},e[2],e[4]||void 0):null}toString(){return`${this.id}-${this.version}${this.targetPlatform!=="undefined"?`-${this.targetPlatform}`:""}`}equals(i){return i instanceof a?Ot(this,i)&&this.version===i.version&&this.targetPlatform===i.targetPlatform:!1}},CUo=/^([^.]+\..+)@((prerelease)|(\d+\.\d+\.\d+(-.*)?))$/;function M3e(a){let i=CUo.exec(a);return i&&i[1]?[jle(i[1]),i[2]]:[jle(a),void 0]}function Jb(a,i){return`${a}.${i}`}function jle(a){return a.toLowerCase()}function Df(a,i){return jle(Jb(a??fwt,i))}function Uci(a,i){let e=[],t=o=>{for(let n of e)if(n.some(r=>Ot(i(r),i(o))))return n;return null};for(let o of a){let n=t(o);n?n.push(o):e.push([o])}return e}function Yxt(a){return{id:a.identifier.id,name:a.manifest.name,galleryId:null,publisherId:a.publisherId,publisherName:a.manifest.publisher,publisherDisplayName:a.publisherDisplayName,dependencies:a.manifest.extensionDependencies&&a.manifest.extensionDependencies.length>0}}function Qle(a){return{id:new Im(a.identifier.id),name:new Im(a.name),extensionVersion:a.version,galleryId:a.identifier.uuid,publisherId:a.publisherId,publisherName:a.publisher,publisherDisplayName:a.publisherDisplayName,isPreReleaseVersion:a.properties.isPreReleaseVersion,dependencies:!!(a.properties.dependencies&&a.properties.dependencies.length>0),isSigned:a.isSigned,...a.telemetryData}}var s9i=new Ei("pprice.better-merge");function Yle(a,i){let e=[],t=i.manifest.extensionDependencies?.slice(0)??[];for(;t.length;){let o=t.shift();if(o&&e.every(n=>!Ot(n.identifier,{id:o}))){let n=a.filter(r=>Ot(r.identifier,{id:o}));n.length===1&&(e.push(n[0]),t.push(...n[0].manifest.extensionDependencies?.slice(0)??[]))}}return e}async function xUo(a,i){if(!Wn)return!1;let e;try{e=(await a.readFile(A.file("/etc/os-release"))).value.toString()}catch{try{e=(await a.readFile(A.file("/usr/lib/os-release"))).value.toString()}catch(o){i.debug("Error while getting the os-release file.",Cn(o))}}return!!e&&(e.match(/^ID=([^\u001b\r\n]*)/m)||[])[1]==="alpine"}async function Xxt(a,i){let e=await xUo(a,i),t=Pxt(e?"alpine":Pp,ube);return i.debug("ComputeTargetPlatform:",t),t}function Jxt(a,i){return zci(a,i)!==void 0}function zci(a,i){return i.find(({extensionOrPublisher:e})=>Ae(e)?Uw(a.id.split(".")[0],e)===0:Ot(a,e))}var tkt=Object.freeze({identifier:new Ei("nullExtensionDescription"),name:"Null Extension Description",version:"0.0.0",publisher:"vscode",engines:{vscode:""},extensionLocation:A.parse("void:location"),isBuiltin:!1,targetPlatform:"undefined",isUserBuiltin:!1,isUnderDevelopment:!1,preRelease:!1}),ikt="extensions.webWorker",lt=ae("extensionService");var Xle=class{get versionId(){return this._versionId}get allExtensions(){return this._allExtensions}get myExtensions(){return this._myExtensions}constructor(i,e,t){this._versionId=i,this._allExtensions=e.slice(0),this._myExtensions=t.slice(0),this._myActivationEvents=null}toSnapshot(){return{versionId:this._versionId,allExtensions:this._allExtensions,myExtensions:this._myExtensions,activationEvents:gj.createActivationEventsMap(this._allExtensions)}}set(i,e,t){if(this._versionId>i)throw new Error(`ExtensionHostExtensions: invalid versionId ${i} (current: ${this._versionId})`);let o=[],n=[],r=[],s=[],l=a9i(this._allExtensions),c=a9i(e),u=(v,b)=>v.extensionLocation.toString()===b.extensionLocation.toString()||v.isBuiltin===b.isBuiltin||v.isUserBuiltin===b.isUserBuiltin||v.isUnderDevelopment===b.isUnderDevelopment;for(let v of this._allExtensions){let b=c.get(v.identifier);if(!b){o.push(v.identifier),l.delete(v.identifier);continue}if(!u(v,b)){o.push(v.identifier),l.delete(v.identifier);continue}}for(let v of e){let b=l.get(v.identifier);if(!b){n.push(v);continue}if(!u(b,v)){o.push(b.identifier),l.delete(b.identifier);continue}}let p=new QI(this._myExtensions),h=new QI(t);for(let v of this._myExtensions)h.has(v)||r.push(v);for(let v of t)p.has(v)||s.push(v);let g=gj.createActivationEventsMap(n),f={versionId:i,toRemove:o,toAdd:n,addActivationEvents:g,myToRemove:r,myToAdd:s};return this.delta(f),f}delta(i){if(this._versionId>=i.versionId)return null;let{toRemove:e,toAdd:t,myToRemove:o,myToAdd:n}=i,r=new QI(e),s=new QI(o);for(let l=0;l<this._allExtensions.length;l++)r.has(this._allExtensions[l].identifier)&&(this._allExtensions.splice(l,1),l--);for(let l=0;l<this._myExtensions.length;l++)s.has(this._myExtensions[l])&&(this._myExtensions.splice(l,1),l--);for(let l of t)this._allExtensions.push(l);for(let l of n)this._myExtensions.push(l);return this._myActivationEvents=null,i}containsExtension(i){for(let e of this._myExtensions)if(Ei.equals(e,i))return!0;return!1}containsActivationEvent(i){return this._myActivationEvents||(this._myActivationEvents=this._readMyActivationEvents()),this._myActivationEvents.has(i)}_readMyActivationEvents(){let i=new Set;for(let e of this._allExtensions){if(!this.containsExtension(e.identifier))continue;let t=gj.readActivationEvents(e);for(let o of t)i.add(o)}return i}};function a9i(a){let i=new Fd;for(let e of a)i.set(e.identifier,e);return i}function Ea(a,i){return a.enabledApiProposals?a.enabledApiProposals.includes(i):!1}function P3e(a,i){if(!Ea(a,i))throw new Error(`Extension '${a.identifier.value}' CANNOT use API proposal: ${i}.
Its package.json#enabledApiProposals-property declares: ${a.enabledApiProposals?.join(", ")??"[]"} but NOT ${i}.
The missing proposal MUST be added and you must start in extension development mode or use the following command line switch: --enable-proposed-api ${a.identifier.value}`)}var Zxt=class{constructor(i,e,t,o){this.codeLoadingTime=i;this.activateCallTime=e;this.activateResolvedTime=t;this.activationReason=o}},ekt=class{constructor(i,e){this.description=i,this.value=e}};function kE(a){return{type:a.isBuiltin?0:1,isBuiltin:a.isBuiltin||a.isUserBuiltin,identifier:{id:Df(a.publisher,a.name),uuid:a.uuid},manifest:a,location:a.extensionLocation,targetPlatform:a.targetPlatform,validations:[],isValid:!0,preRelease:a.preRelease,publisherDisplayName:a.publisherDisplayName}}function kO(a,i){let e=Jb(a.manifest.publisher,a.manifest.name);return{id:e,identifier:new Ei(e),isBuiltin:a.type===0,isUserBuiltin:a.type===1&&a.isBuiltin,isUnderDevelopment:!!i,extensionLocation:a.location,uuid:a.identifier.uuid,targetPlatform:a.targetPlatform,publisherDisplayName:a.publisherDisplayName,preRelease:a.preRelease,...a.manifest}}function EO(a){switch(a){case 1:return d(123,null);case 2:return d(122,null);case 3:return d(124,null);case 4:return d(125,null);case 5:return d(119,null);case 6:return d(120,null);case 7:return d(117,null);case 8:return d(118,null);case 9:return d(121,null);default:return""}}async function TO(a,i,e){let t=e&&e.get("storage.serviceMachineId",-1)||null;if(t)return t;try{let n=(await i.readFile(a.serviceMachineIdResource)).value.toString();t=Ugt(n)?n:null}catch{t=null}if(!t){t=_t();try{await i.writeFile(a.serviceMachineIdResource,Je.fromString(t))}catch{}}return e?.store("storage.serviceMachineId",t,-1,1),t}var vv=ae("IExtensionGalleryManifestService");function oP(a,i){let[e,t]=i.split("/");for(let o of a.resources){let[n,r]=o.type.split("/");if(n===e){if(!t||r===t)return o.id;break}}}var A3e="extensions.gallery.serviceUrl";var kUo="/web-extension-resource/",Bx=ae("extensionResourceLoaderService");var okt=class extends C{constructor(e,t,o,n,r,s,l){super();this._fileService=e;this._storageService=t;this._productService=o;this._environmentService=n;this._configurationService=r;this._extensionGalleryManifestService=s;this._logService=l;this._initPromise=this._init()}async _init(){try{let e=await this._extensionGalleryManifestService.getExtensionGalleryManifest();this.resolve(e),this._register(this._extensionGalleryManifestService.onDidChangeExtensionGalleryManifest(()=>this.resolve(e)))}catch(e){this._logService.error(e)}}resolve(e){this._extensionGalleryResourceUrlTemplate=e?oP(e,"ExtensionResourceUriTemplate"):void 0,this._extensionGalleryAuthority=this._extensionGalleryResourceUrlTemplate?this._getExtensionGalleryAuthority(A.parse(this._extensionGalleryResourceUrlTemplate)):void 0}async supportsExtensionGalleryResources(){return await this._initPromise,this._extensionGalleryResourceUrlTemplate!==void 0}async getExtensionGalleryResourceURL({publisher:e,name:t,version:o,targetPlatform:n},r){if(await this._initPromise,this._extensionGalleryResourceUrlTemplate){let s=A.parse(PT(this._extensionGalleryResourceUrlTemplate,{publisher:e,name:t,version:n!==void 0&&n!=="undefined"&&n!=="unknown"&&n!=="universal"?`${o}+${n}`:o,path:"extension"}));return this._isWebExtensionResourceEndPoint(s)?s.with({scheme:jD.getPreferredWebSchema()}):s}}async isExtensionGalleryResource(e){return await this._initPromise,!!this._extensionGalleryAuthority&&this._extensionGalleryAuthority===this._getExtensionGalleryAuthority(e)}async getExtensionGalleryRequestHeaders(){let e={"X-Client-Name":`${this._productService.applicationName}${Gt?"-web":""}`,"X-Client-Version":this._productService.version};return KL(this._productService,this._environmentService)&&xO(this._configurationService)===3&&(e["X-Machine-Id"]=await this._getServiceMachineId()),this._productService.commit&&(e["X-Client-Commit"]=this._productService.commit),e}_getServiceMachineId(){return this._serviceMachineIdPromise||(this._serviceMachineIdPromise=TO(this._environmentService,this._fileService,this._storageService)),this._serviceMachineIdPromise}_getExtensionGalleryAuthority(e){if(this._isWebExtensionResourceEndPoint(e))return e.authority;let t=e.authority.indexOf(".");return t!==-1?e.authority.substring(t+1):void 0}_isWebExtensionResourceEndPoint(e){let t=e.path,o=jD.getServerRootPath();return t.startsWith(o)&&t.startsWith(kUo,o.length)}};function l9i(a){if(!Array.isArray(a))return!1;for(let i=0,e=a.length;i<e;i++)if(typeof a[i]!="string")return!1;return!0}function N3e(a){return l9i(a)&&a.length===2}var sY=class extends C{constructor(e,t,o,n){super();this._languageService=e;this._extensionResourceLoaderService=t;this._extensionService=o;this._languageConfigurationService=n;this._done=new Map;this._register(this._languageService.onDidRequestBasicLanguageFeatures(async r=>{this._extensionService.whenInstalledExtensionsRegistered().then(()=>{this._loadConfigurationsForMode(r)})})),this._register(this._languageService.onDidChange(()=>{for(let[r]of this._done)this._loadConfigurationsForMode(r)}))}async _loadConfigurationsForMode(e){let t=this._languageService.getConfigurationFiles(e),o=Ir(t.map(r=>r.toString()));if(this._done.get(e)===o)return;this._done.set(e,o);let n=await Promise.all(t.map(r=>this._readConfigFile(r)));for(let r of n)this._handleConfig(e,r)}async _readConfigFile(e){try{let t=await this._extensionResourceLoaderService.readExtensionResource(e),o=[],n=Ur(t,o);return o.length&&console.error(d(8355,null,e.toString(),o.map(r=>`[${r.offset}, ${r.length}] ${EO(r.error)}`).join(`
`))),Vx(n)!=="object"&&(console.error(d(8354,null,e.toString())),n={}),n}catch(t){return console.error(t),{}}}static _extractValidCommentRule(e,t){let o=t.comments;if(typeof o>"u")return;if(!yi(o)){console.warn(`[${e}]: language configuration: expected \`comments\` to be an object.`);return}let n;if(typeof o.lineComment<"u")if(typeof o.lineComment=="string")n=n||{},n.lineComment=o.lineComment;else if(yi(o.lineComment)){let r=o.lineComment;typeof r.comment=="string"?(n=n||{},n.lineComment={comment:r.comment,noIndent:r.noIndent}):console.warn(`[${e}]: language configuration: expected \`comments.lineComment.comment\` to be a string.`)}else console.warn(`[${e}]: language configuration: expected \`comments.lineComment\` to be a string or an object with comment property.`);return typeof o.blockComment<"u"&&(N3e(o.blockComment)?(n=n||{},n.blockComment=o.blockComment):console.warn(`[${e}]: language configuration: expected \`comments.blockComment\` to be an array of two strings.`)),n}static _extractValidBrackets(e,t){let o=t.brackets;if(typeof o>"u")return;if(!Array.isArray(o)){console.warn(`[${e}]: language configuration: expected \`brackets\` to be an array.`);return}let n;for(let r=0,s=o.length;r<s;r++){let l=o[r];if(!N3e(l)){console.warn(`[${e}]: language configuration: expected \`brackets[${r}]\` to be an array of two strings.`);continue}n=n||[],n.push(l)}return n}static _extractValidAutoClosingPairs(e,t){let o=t.autoClosingPairs;if(typeof o>"u")return;if(!Array.isArray(o)){console.warn(`[${e}]: language configuration: expected \`autoClosingPairs\` to be an array.`);return}let n;for(let r=0,s=o.length;r<s;r++){let l=o[r];if(Array.isArray(l)){if(!N3e(l)){console.warn(`[${e}]: language configuration: expected \`autoClosingPairs[${r}]\` to be an array of two strings or an object.`);continue}n=n||[],n.push({open:l[0],close:l[1]})}else{if(!yi(l)){console.warn(`[${e}]: language configuration: expected \`autoClosingPairs[${r}]\` to be an array of two strings or an object.`);continue}if(typeof l.open!="string"){console.warn(`[${e}]: language configuration: expected \`autoClosingPairs[${r}].open\` to be a string.`);continue}if(typeof l.close!="string"){console.warn(`[${e}]: language configuration: expected \`autoClosingPairs[${r}].close\` to be a string.`);continue}if(typeof l.notIn<"u"&&!l9i(l.notIn)){console.warn(`[${e}]: language configuration: expected \`autoClosingPairs[${r}].notIn\` to be a string array.`);continue}n=n||[],n.push({open:l.open,close:l.close,notIn:l.notIn})}}return n}static _extractValidSurroundingPairs(e,t){let o=t.surroundingPairs;if(typeof o>"u")return;if(!Array.isArray(o)){console.warn(`[${e}]: language configuration: expected \`surroundingPairs\` to be an array.`);return}let n;for(let r=0,s=o.length;r<s;r++){let l=o[r];if(Array.isArray(l)){if(!N3e(l)){console.warn(`[${e}]: language configuration: expected \`surroundingPairs[${r}]\` to be an array of two strings or an object.`);continue}n=n||[],n.push({open:l[0],close:l[1]})}else{if(!yi(l)){console.warn(`[${e}]: language configuration: expected \`surroundingPairs[${r}]\` to be an array of two strings or an object.`);continue}if(typeof l.open!="string"){console.warn(`[${e}]: language configuration: expected \`surroundingPairs[${r}].open\` to be a string.`);continue}if(typeof l.close!="string"){console.warn(`[${e}]: language configuration: expected \`surroundingPairs[${r}].close\` to be a string.`);continue}n=n||[],n.push({open:l.open,close:l.close})}}return n}static _extractValidColorizedBracketPairs(e,t){let o=t.colorizedBracketPairs;if(typeof o>"u")return;if(!Array.isArray(o)){console.warn(`[${e}]: language configuration: expected \`colorizedBracketPairs\` to be an array.`);return}let n=[];for(let r=0,s=o.length;r<s;r++){let l=o[r];if(!N3e(l)){console.warn(`[${e}]: language configuration: expected \`colorizedBracketPairs[${r}]\` to be an array of two strings.`);continue}n.push([l[0],l[1]])}return n}static _extractValidOnEnterRules(e,t){let o=t.onEnterRules;if(typeof o>"u")return;if(!Array.isArray(o)){console.warn(`[${e}]: language configuration: expected \`onEnterRules\` to be an array.`);return}let n;for(let r=0,s=o.length;r<s;r++){let l=o[r];if(!yi(l)){console.warn(`[${e}]: language configuration: expected \`onEnterRules[${r}]\` to be an object.`);continue}if(!yi(l.action)){console.warn(`[${e}]: language configuration: expected \`onEnterRules[${r}].action\` to be an object.`);continue}let c;if(l.action.indent==="none")c=0;else if(l.action.indent==="indent")c=1;else if(l.action.indent==="indentOutdent")c=2;else if(l.action.indent==="outdent")c=3;else{console.warn(`[${e}]: language configuration: expected \`onEnterRules[${r}].action.indent\` to be 'none', 'indent', 'indentOutdent' or 'outdent'.`);continue}let u={indentAction:c};l.action.appendText&&(typeof l.action.appendText=="string"?u.appendText=l.action.appendText:console.warn(`[${e}]: language configuration: expected \`onEnterRules[${r}].action.appendText\` to be undefined or a string.`)),l.action.removeText&&(typeof l.action.removeText=="number"?u.removeText=l.action.removeText:console.warn(`[${e}]: language configuration: expected \`onEnterRules[${r}].action.removeText\` to be undefined or a number.`));let p=this._parseRegex(e,`onEnterRules[${r}].beforeText`,l.beforeText);if(!p)continue;let h={beforeText:p,action:u};if(l.afterText){let g=this._parseRegex(e,`onEnterRules[${r}].afterText`,l.afterText);g&&(h.afterText=g)}if(l.previousLineText){let g=this._parseRegex(e,`onEnterRules[${r}].previousLineText`,l.previousLineText);g&&(h.previousLineText=g)}n=n||[],n.push(h)}return n}static extractValidConfig(e,t){let o=this._extractValidCommentRule(e,t),n=this._extractValidBrackets(e,t),r=this._extractValidAutoClosingPairs(e,t),s=this._extractValidSurroundingPairs(e,t),l=this._extractValidColorizedBracketPairs(e,t),c=typeof t.autoCloseBefore=="string"?t.autoCloseBefore:void 0,u=t.wordPattern?this._parseRegex(e,"wordPattern",t.wordPattern):void 0,p=t.indentationRules?this._mapIndentationRules(e,t.indentationRules):void 0,h;if(t.folding){let v=t.folding.markers,b=v&&v.start?this._parseRegex(e,"folding.markers.start",v.start):void 0,S=v&&v.end?this._parseRegex(e,"folding.markers.end",v.end):void 0,y=b&&S?{start:b,end:S}:void 0;h={offSide:t.folding.offSide,markers:y}}let g=this._extractValidOnEnterRules(e,t);return{comments:o,brackets:n,wordPattern:u,indentationRules:p,onEnterRules:g,autoClosingPairs:r,surroundingPairs:s,colorizedBracketPairs:l,autoCloseBefore:c,folding:h,__electricCharacterSupport:void 0}}_handleConfig(e,t){let o=sY.extractValidConfig(e,t);this._languageConfigurationService.register(e,o,50)}static _parseRegex(e,t,o){if(typeof o=="string")try{return new RegExp(o,"")}catch(n){console.warn(`[${e}]: Invalid regular expression in \`${t}\`: `,n);return}if(yi(o)){if(typeof o.pattern!="string"){console.warn(`[${e}]: language configuration: expected \`${t}.pattern\` to be a string.`);return}if(typeof o.flags<"u"&&typeof o.flags!="string"){console.warn(`[${e}]: language configuration: expected \`${t}.flags\` to be a string.`);return}try{return new RegExp(o.pattern,o.flags)}catch(n){console.warn(`[${e}]: Invalid regular expression in \`${t}\`: `,n);return}}console.warn(`[${e}]: language configuration: expected \`${t}\` to be a string or an object.`)}static _mapIndentationRules(e,t){let o=this._parseRegex(e,"indentationRules.increaseIndentPattern",t.increaseIndentPattern);if(!o)return;let n=this._parseRegex(e,"indentationRules.decreaseIndentPattern",t.decreaseIndentPattern);if(!n)return;let r={increaseIndentPattern:o,decreaseIndentPattern:n};return t.indentNextLinePattern&&(r.indentNextLinePattern=this._parseRegex(e,"indentationRules.indentNextLinePattern",t.indentNextLinePattern)),t.unIndentedLinePattern&&(r.unIndentedLinePattern=this._parseRegex(e,"indentationRules.unIndentedLinePattern",t.unIndentedLinePattern)),r}};sY=I([m(0,kt),m(1,Bx),m(2,lt),m(3,bs)],sY);var EUo="vscode://schemas/language-configuration",TUo={allowComments:!0,allowTrailingCommas:!0,default:{comments:{blockComment:["/*","*/"],lineComment:"//"},brackets:[["(",")"],["[","]"],["{","}"]],autoClosingPairs:[["(",")"],["[","]"],["{","}"]],surroundingPairs:[["(",")"],["[","]"],["{","}"]]},definitions:{openBracket:{type:"string",description:d(8412,null)},closeBracket:{type:"string",description:d(8363,null)},bracketPair:{type:"array",items:[{$ref:"#/definitions/openBracket"},{$ref:"#/definitions/closeBracket"}]}},properties:{comments:{default:{blockComment:["/*","*/"],lineComment:{comment:"//",noIndent:!1}},description:d(8365,null),type:"object",properties:{blockComment:{type:"array",description:d(8361,null),items:[{type:"string",description:d(8359,null)},{type:"string",description:d(8360,null)}]},lineComment:{type:"object",description:d(8390,null),properties:{comment:{type:"string",description:d(8388,null)},noIndent:{type:"boolean",description:d(8389,null),default:!1}},required:["comment"],additionalProperties:!1}}},brackets:{default:[["(",")"],["[","]"],["{","}"]],markdownDescription:d(8362,null,"`colorizedBracketPairs`"),type:"array",items:{$ref:"#/definitions/bracketPair"}},colorizedBracketPairs:{default:[["(",")"],["[","]"],["{","}"]],markdownDescription:d(8364,null,"`brackets`"),type:"array",items:{$ref:"#/definitions/bracketPair"}},autoClosingPairs:{default:[["(",")"],["[","]"],["{","}"]],description:d(8357,null),type:"array",items:{oneOf:[{$ref:"#/definitions/bracketPair"},{type:"object",properties:{open:{$ref:"#/definitions/openBracket"},close:{$ref:"#/definitions/closeBracket"},notIn:{type:"array",description:d(8358,null),items:{enum:["string","comment"]}}}}]}},autoCloseBefore:{default:`;:.,=}])>
`,description:d(8356,null),type:"string"},surroundingPairs:{default:[["(",")"],["[","]"],["{","}"]],description:d(8413,null),type:"array",items:{oneOf:[{$ref:"#/definitions/bracketPair"},{type:"object",properties:{open:{$ref:"#/definitions/openBracket"},close:{$ref:"#/definitions/closeBracket"}}}]}},wordPattern:{default:"",description:d(8414,null),type:["string","object"],properties:{pattern:{type:"string",description:d(8417,null),default:""},flags:{type:"string",description:d(8415,null),default:"g",pattern:"^([gimuy]+)$",patternErrorMessage:d(8416,null)}}},indentationRules:{default:{increaseIndentPattern:"",decreaseIndentPattern:""},description:d(8371,null),type:"object",properties:{increaseIndentPattern:{type:["string","object"],description:d(8376,null),properties:{pattern:{type:"string",description:d(8379,null),default:""},flags:{type:"string",description:d(8378,null),default:"",pattern:"^([gimuy]+)$",patternErrorMessage:d(8377,null)}}},decreaseIndentPattern:{type:["string","object"],description:d(8372,null),properties:{pattern:{type:"string",description:d(8375,null),default:""},flags:{type:"string",description:d(8374,null),default:"",pattern:"^([gimuy]+)$",patternErrorMessage:d(8373,null)}}},indentNextLinePattern:{type:["string","object"],description:d(8380,null),properties:{pattern:{type:"string",description:d(8383,null),default:""},flags:{type:"string",description:d(8382,null),default:"",pattern:"^([gimuy]+)$",patternErrorMessage:d(8381,null)}}},unIndentedLinePattern:{type:["string","object"],description:d(8384,null),properties:{pattern:{type:"string",description:d(8387,null),default:""},flags:{type:"string",description:d(8386,null),default:"",pattern:"^([gimuy]+)$",patternErrorMessage:d(8385,null)}}}}},folding:{type:"object",description:d(8366,null),properties:{offSide:{type:"boolean",description:d(8370,null)},markers:{type:"object",description:d(8367,null),properties:{start:{type:"string",description:d(8369,null)},end:{type:"string",description:d(8368,null)}}}}},onEnterRules:{type:"array",description:d(8391,null),items:{type:"object",description:d(8391,null),required:["beforeText","action"],properties:{beforeText:{type:["string","object"],description:d(8404,null),properties:{pattern:{type:"string",description:d(8407,null),default:""},flags:{type:"string",description:d(8406,null),default:"",pattern:"^([gimuy]+)$",patternErrorMessage:d(8405,null)}}},afterText:{type:["string","object"],description:d(8400,null),properties:{pattern:{type:"string",description:d(8403,null),default:""},flags:{type:"string",description:d(8402,null),default:"",pattern:"^([gimuy]+)$",patternErrorMessage:d(8401,null)}}},previousLineText:{type:["string","object"],description:d(8408,null),properties:{pattern:{type:"string",description:d(8411,null),default:""},flags:{type:"string",description:d(8410,null),default:"",pattern:"^([gimuy]+)$",patternErrorMessage:d(8409,null)}}},action:{type:["string","object"],description:d(8392,null),required:["indent"],default:{indent:"indent"},properties:{indent:{type:"string",description:d(8394,null),default:"indent",enum:["none","indent","indentOutdent","outdent"],markdownEnumDescriptions:[d(8397,null),d(8395,null),d(8396,null),d(8398,null)]},appendText:{type:"string",description:d(8393,null),default:""},removeText:{type:"number",description:d(8399,null),default:0}}}}}}}},_Uo=oe.as(ea.JSONContribution);_Uo.registerSchema(EUo,TUo);var Tr=ae("statusbarService");function Jle(a){let i=a;return typeof i?.location?.id=="string"&&typeof i.alignment=="number"}function c9i(a){let i=a;return(typeof i?.primary=="number"||Jle(i?.primary))&&typeof i?.secondary=="number"}var GL={id:"statusBar.entry.showTooltip",title:""},d9i=["standard","warning","error","prominent","remote","offline"];function u9i(a){let i=a;return!!i?.content&&Array.isArray(i?.commands)}var Mc=ae("remoteAuthorityResolverService");var rkt=class{constructor(i){this.id=i;this.type=1}toString(){return`Managed(${this.id})`}},skt=class{constructor(i,e){this.host=i;this.port=e;this.type=0}toString(){return`WebSocket(${this.host}:${this.port})`}};var ow=class a extends Zs{static isNotAvailable(i){return i instanceof a&&i._code==="NotAvailable"}static isTemporarilyNotAvailable(i){return i instanceof a&&i._code==="TemporarilyNotAvailable"}static isNoResolverFound(i){return i instanceof a&&i._code==="NoResolverFound"}static isInvalidAuthority(i){return i instanceof a&&i._code==="InvalidAuthority"}static isHandled(i){return i instanceof a&&i.isHandled}constructor(i,e="Unknown",t){super(i),this._message=i,this._code=e,this._detail=t,this.isHandled=e==="NotAvailable"&&t===!0,Object.setPrototypeOf(this,a.prototype)}};function sz(a){let i=a.indexOf("+");return i===-1?a:a.substring(0,i)}function cr(a){return Object.assign(a,{apply:function(...e){if(e.length===0)return Reflect.construct(a,[]);{let t=e.length===1?[]:e[1];return Reflect.construct(a,t,e[0].constructor)}},call:function(...e){if(e.length===0)return Reflect.construct(a,[]);{let[t,...o]=e;return Reflect.construct(a,o,t.constructor)}}})}var nw,EE=class{constructor(i,e=!1){Yve(this,nw);j2e(this,nw,new xe(i,{supportThemeIcons:e}))}static isMarkdownString(i){return i instanceof EE?!0:!i||typeof i!="object"?!1:i.appendCodeblock&&i.appendMarkdown&&i.appendText&&i.value!==void 0}get value(){return pf(this,nw).value}set value(i){pf(this,nw).value=i}get isTrusted(){return pf(this,nw).isTrusted}set isTrusted(i){pf(this,nw).isTrusted=i}get supportThemeIcons(){return pf(this,nw).supportThemeIcons}set supportThemeIcons(i){pf(this,nw).supportThemeIcons=i}get supportHtml(){return pf(this,nw).supportHtml}set supportHtml(i){pf(this,nw).supportHtml=i}get supportAlertSyntax(){return pf(this,nw).supportAlertSyntax}set supportAlertSyntax(i){pf(this,nw).supportAlertSyntax=i}get baseUri(){return pf(this,nw).baseUri}set baseUri(i){pf(this,nw).baseUri=i}appendText(i){return pf(this,nw).appendText(i),this}appendMarkdown(i){return pf(this,nw).appendMarkdown(i),this}appendCodeblock(i,e){return pf(this,nw).appendCodeblock(e??"",i),this}};nw=new WeakMap,EE=I([cr],EE);var sc=class{static Min(...i){if(i.length===0)throw new TypeError;let e=i[0];for(let t=1;t<i.length;t++){let o=i[t];o.isBefore(e)&&(e=o)}return e}static Max(...i){if(i.length===0)throw new TypeError;let e=i[0];for(let t=1;t<i.length;t++){let o=i[t];o.isAfter(e)&&(e=o)}return e}static isPosition(i){if(!i)return!1;if(i instanceof sc)return!0;let{line:e,character:t}=i;return typeof e=="number"&&typeof t=="number"}static of(i){if(i instanceof sc)return i;if(this.isPosition(i))return new sc(i.line,i.character);throw new Error("Invalid argument, is NOT a position-like object")}get line(){return this._line}get character(){return this._character}constructor(i,e){if(i<0)throw Br("line must be non-negative");if(e<0)throw Br("character must be non-negative");this._line=i,this._character=e}isBefore(i){return this._line<i._line?!0:i._line<this._line?!1:this._character<i._character}isBeforeOrEqual(i){return this._line<i._line?!0:i._line<this._line?!1:this._character<=i._character}isAfter(i){return!this.isBeforeOrEqual(i)}isAfterOrEqual(i){return!this.isBefore(i)}isEqual(i){return this._line===i._line&&this._character===i._character}compareTo(i){return this._line<i._line?-1:this._line>i.line?1:this._character<i._character?-1:this._character>i._character?1:0}translate(i,e=0){if(i===null||e===null)throw Br();let t;return typeof i>"u"?t=0:typeof i=="number"?t=i:(t=typeof i.lineDelta=="number"?i.lineDelta:0,e=typeof i.characterDelta=="number"?i.characterDelta:0),t===0&&e===0?this:new sc(this.line+t,this.character+e)}with(i,e=this.character){if(i===null||e===null)throw Br();let t;return typeof i>"u"?t=this.line:typeof i=="number"?t=i:(t=typeof i.line=="number"?i.line:this.line,e=typeof i.character=="number"?i.character:this.character),t===this.line&&e===this.character?this:new sc(t,e)}toJSON(){return{line:this.line,character:this.character}}[Symbol.for("debug.description")](){return`(${this.line}:${this.character})`}};sc=I([cr],sc);var Kc=class{static isRange(i){return i instanceof Kc?!0:!i||typeof i!="object"?!1:sc.isPosition(i.start)&&sc.isPosition(i.end)}static of(i){if(i instanceof Kc)return i;if(this.isRange(i))return new Kc(i.start,i.end);throw new Error("Invalid argument, is NOT a range-like object")}get start(){return this._start}get end(){return this._end}constructor(i,e,t,o){let n,r;if(typeof i=="number"&&typeof e=="number"&&typeof t=="number"&&typeof o=="number"?(n=new sc(i,e),r=new sc(t,o)):sc.isPosition(i)&&sc.isPosition(e)&&(n=sc.of(i),r=sc.of(e)),!n||!r)throw new Error("Invalid arguments");n.isBefore(r)?(this._start=n,this._end=r):(this._start=r,this._end=n)}contains(i){return Kc.isRange(i)?this.contains(i.start)&&this.contains(i.end):sc.isPosition(i)?!(sc.of(i).isBefore(this._start)||this._end.isBefore(i)):!1}isEqual(i){return this._start.isEqual(i._start)&&this._end.isEqual(i._end)}intersection(i){let e=sc.Max(i.start,this._start),t=sc.Min(i.end,this._end);if(!e.isAfter(t))return new Kc(e,t)}union(i){if(this.contains(i))return this;if(i.contains(this))return i;let e=sc.Min(i.start,this._start),t=sc.Max(i.end,this.end);return new Kc(e,t)}get isEmpty(){return this._start.isEqual(this._end)}get isSingleLine(){return this._start.line===this._end.line}with(i,e=this.end){if(i===null||e===null)throw Br();let t;return i?sc.isPosition(i)?t=i:(t=i.start||this.start,e=i.end||this.end):t=this.start,t.isEqual(this._start)&&e.isEqual(this.end)?this:new Kc(t,e)}toJSON(){return[this.start,this.end]}[Symbol.for("debug.description")](){return Kci(this)}};Kc=I([cr],Kc);function Kci(a){return a.isEmpty?`[${a.start.line}:${a.start.character})`:`[${a.start.line}:${a.start.character} -> ${a.end.line}:${a.end.character})`}var Kp=class{constructor(i){this.value=i}append(i){return new Kp(this.value?this.value+Kp.sep+i:i)}intersects(i){return this.contains(i)||i.contains(this)}contains(i){return this.value===i.value||i.value.startsWith(this.value+Kp.sep)}};Kp.sep=".",Kp=I([cr],Kp);Kp.Empty=new Kp("");Kp.QuickFix=Kp.Empty.append("quickfix");Kp.Refactor=Kp.Empty.append("refactor");Kp.RefactorExtract=Kp.Refactor.append("extract");Kp.RefactorInline=Kp.Refactor.append("inline");Kp.RefactorMove=Kp.Refactor.append("move");Kp.RefactorRewrite=Kp.Refactor.append("rewrite");Kp.Source=Kp.Empty.append("source");Kp.SourceOrganizeImports=Kp.Source.append("organizeImports");Kp.SourceFixAll=Kp.Source.append("fixAll");Kp.Notebook=Kp.Empty.append("notebook");var akt=(o=>(o[o.Hint=3]="Hint",o[o.Information=2]="Information",o[o.Warning=1]="Warning",o[o.Error=0]="Error",o))(akt||{}),aY=class{static is(i){return i?typeof i.message=="string"&&i.location&&Kc.isRange(i.location.range)&&A.isUri(i.location.uri):!1}constructor(i,e){this.location=i,this.message=e}static isEqual(i,e){return i===e?!0:!i||!e?!1:i.message===e.message&&i.location.range.isEqual(e.location.range)&&i.location.uri.toString()===e.location.uri.toString()}};aY=I([cr],aY);var Zle=class{constructor(i,e,t=0){if(!Kc.isRange(i))throw new TypeError("range must be set");if(!e)throw new TypeError("message must be set");this.range=i,this.message=e,this.severity=t}toJSON(){return{severity:akt[this.severity],message:this.message,range:this.range,source:this.source,code:this.code}}static isEqual(i,e){return i===e?!0:!i||!e?!1:i.message===e.message&&i.severity===e.severity&&i.code===e.code&&i.severity===e.severity&&i.source===e.source&&i.range.isEqual(e.range)&&$i(i.tags,e.tags)&&$i(i.relatedInformation,e.relatedInformation,aY.isEqual)}};Zle=I([cr],Zle);var y_=class{static isLocation(i){return i instanceof y_?!0:i?Kc.isRange(i.range)&&A.isUri(i.uri):!1}constructor(i,e){if(this.uri=i,e)if(Kc.isRange(e))this.range=Kc.of(e);else if(sc.isPosition(e))this.range=new Kc(e,e);else throw new Error("Illegal argument")}toJSON(){return{uri:this.uri,range:this.range}}};y_=I([cr],y_);var vj=class a{static isNotebookRange(i){return i instanceof a?!0:i?typeof i.start=="number"&&typeof i.end=="number":!1}get start(){return this._start}get end(){return this._end}get isEmpty(){return this._start===this._end}constructor(i,e){if(i<0)throw Br("start must be positive");if(e<0)throw Br("end must be positive");i<=e?(this._start=i,this._end=e):(this._start=e,this._end=i)}with(i){let e=this._start,t=this._end;return i.start!==void 0&&(e=i.start),i.end!==void 0&&(t=i.end),e===this._start&&t===this._end?this:new a(e,t)}},cxe=class a{static validate(i){if(typeof i.kind!="number")throw new Error("NotebookCellData MUST have 'kind' property");if(typeof i.value!="string")throw new Error("NotebookCellData MUST have 'value' property");if(typeof i.languageId!="string")throw new Error("NotebookCellData MUST have 'languageId' property")}static isNotebookCellDataArray(i){return Array.isArray(i)&&i.every(e=>a.isNotebookCellData(e))}static isNotebookCellData(i){return!0}constructor(i,e,t,o,n,r,s){this.kind=i,this.value=e,this.languageId=t,this.mime=o,this.outputs=n??[],this.metadata=r,this.executionSummary=s,a.validate(this)}},O3e=class{constructor(i){this.cells=i}},$L=class{static isNotebookCellEdit(i){return i instanceof $L?!0:i?vj.isNotebookRange(i)&&Array.isArray(i.newCells):!1}static replaceCells(i,e){return new $L(i,e)}static insertCells(i,e){return new $L(new vj(i,i),e)}static deleteCells(i){return new $L(i,[])}static updateCellMetadata(i,e){let t=new $L(new vj(i,i),[]);return t.newCellMetadata=e,t}static updateNotebookMetadata(i){let e=new $L(new vj(0,0),[]);return e.newNotebookMetadata=i,e}constructor(i,e){this.range=i,this.newCells=e}};$L=I([cr],$L);var F3e=class a{constructor(i,e){this.data=i;this.mime=e;let t=RYt(e,!0);if(!t)throw new Error(`INVALID mime type: ${e}. Must be in the format "type/subtype[;optionalparameter]"`);this.mime=t}static isNotebookCellOutputItem(i){return i instanceof a?!0:i?typeof i.mime=="string"&&i.data instanceof Uint8Array:!1}static error(i){let e={name:i.name,message:i.message,stack:i.stack};return a.json(e,"application/vnd.code.notebook.error")}static stdout(i){return a.text(i,"application/vnd.code.notebook.stdout")}static stderr(i){return a.text(i,"application/vnd.code.notebook.stderr")}static bytes(i,e="application/octet-stream"){return new a(i,e)}static$a=new TextEncoder;static text(i,e=Zn.text){let t=a.$a.encode(String(i));return new a(t,e)}static json(i,e="text/x-json"){let t=JSON.stringify(i,void 0," ");return a.text(t,e)}},W3e=class a{static isNotebookCellOutput(i){return i instanceof a?!0:!i||typeof i!="object"?!1:typeof i.id=="string"&&Array.isArray(i.items)}static ensureUniqueMimeTypes(i,e=!1){let t=new Set,o=new Set;for(let n=0;n<i.length;n++){let r=i[n],s=RYt(r.mime);if(!t.has(s)||oL(s)){t.add(s);continue}o.add(n),e&&console.warn(`DUPLICATED mime type '${r.mime}' will be dropped`)}return o.size===0?i:i.filter((n,r)=>!o.has(r))}constructor(i,e,t){this.items=a.ensureUniqueMimeTypes(i,!0),typeof e=="string"?(this.id=e,this.metadata=t):(this.id=_t(),this.metadata=e??t)}};var bj=class extends Kc{static isSelection(i){return i instanceof bj?!0:!i||typeof i!="object"?!1:Kc.isRange(i)&&sc.isPosition(i.anchor)&&sc.isPosition(i.active)&&typeof i.isReversed=="boolean"}get anchor(){return this._anchor}get active(){return this._active}constructor(i,e,t,o){let n,r;if(typeof i=="number"&&typeof e=="number"&&typeof t=="number"&&typeof o=="number"?(n=new sc(i,e),r=new sc(t,o)):sc.isPosition(i)&&sc.isPosition(e)&&(n=sc.of(i),r=sc.of(e)),!n||!r)throw new Error("Invalid arguments");super(n,r),this._anchor=n,this._active=r}get isReversed(){return this._anchor===this._end}toJSON(){return{start:this.start,end:this.end,active:this.active,anchor:this.anchor}}[Symbol.for("debug.description")](){return DUo(this)}};bj=I([cr],bj);function DUo(a){let i=Kci(a);return a.isEmpty||(a.active.isEqual(a.start)?i=`|${i}`:i=`${i}|`),i}var TE=class{constructor(i){this._tabstop=1;this.value=i||""}static isSnippetString(i){return i instanceof TE?!0:!i||typeof i!="object"?!1:typeof i.value=="string"}static _escape(i){return i.replace(/\$|}|\\/g,"\\$&")}appendText(i){return this.value+=TE._escape(i),this}appendTabstop(i=this._tabstop++){return this.value+="$",this.value+=i,this}appendPlaceholder(i,e=this._tabstop++){if(typeof i=="function"){let t=new TE;t._tabstop=this._tabstop,i(t),this._tabstop=t._tabstop,i=t.value}else i=TE._escape(i);return this.value+="${",this.value+=e,this.value+=":",this.value+=i,this.value+="}",this}appendChoice(i,e=this._tabstop++){let t=i.map(o=>o.replaceAll(/[|\\,]/g,"\\$&")).join(",");return this.value+="${",this.value+=e,this.value+="|",this.value+=t,this.value+="|}",this}appendVariable(i,e){if(typeof e=="function"){let t=new TE;t._tabstop=this._tabstop,e(t),this._tabstop=t._tabstop,e=t.value}else typeof e=="string"&&(e=e.replace(/\$|}/g,"\\$&"));return this.value+="${",this.value+=i,e&&(this.value+=":",this.value+=e),this.value+="}",this}};TE=I([cr],TE);var ece=class a{static isSnippetTextEdit(i){return i instanceof a?!0:i?Kc.isRange(i.range)&&TE.isSnippetString(i.snippet):!1}static replace(i,e){return new a(i,e)}static insert(i,e){return a.replace(new Kc(i,i),e)}constructor(i,e){this.range=i,this.snippet=e}};var lkt=(G=>(G[G.File=0]="File",G[G.Module=1]="Module",G[G.Namespace=2]="Namespace",G[G.Package=3]="Package",G[G.Class=4]="Class",G[G.Method=5]="Method",G[G.Property=6]="Property",G[G.Field=7]="Field",G[G.Constructor=8]="Constructor",G[G.Enum=9]="Enum",G[G.Interface=10]="Interface",G[G.Function=11]="Function",G[G.Variable=12]="Variable",G[G.Constant=13]="Constant",G[G.String=14]="String",G[G.Number=15]="Number",G[G.Boolean=16]="Boolean",G[G.Array=17]="Array",G[G.Object=18]="Object",G[G.Key=19]="Key",G[G.Null=20]="Null",G[G.EnumMember=21]="EnumMember",G[G.Struct=22]="Struct",G[G.Event=23]="Event",G[G.Operator=24]="Operator",G[G.TypeParameter=25]="TypeParameter",G))(lkt||{});var Sj=class{static validate(i){if(!i.name)throw new Error("name must not be falsy")}constructor(i,e,t,o,n){this.name=i,this.kind=e,this.containerName=n,typeof t=="string"&&(this.containerName=t),o instanceof y_?this.location=o:t instanceof Kc&&(this.location=new y_(o,t)),Sj.validate(this)}toJSON(){return{name:this.name,kind:lkt[this.kind],location:this.location,containerName:this.containerName}}};Sj=I([cr],Sj);var Hx=class{static isTextEdit(i){return i instanceof Hx?!0:!i||typeof i!="object"?!1:Kc.isRange(i)&&typeof i.newText=="string"}static replace(i,e){return new Hx(i,e)}static insert(i,e){return Hx.replace(new Kc(i,i),e)}static delete(i){return Hx.replace(i,"")}static setEndOfLine(i){let e=new Hx(new Kc(new sc(0,0),new sc(0,0)),"");return e.newEol=i,e}get range(){return this._range}set range(i){if(i&&!Kc.isRange(i))throw Br("range");this._range=i}get newText(){return this._newText||""}set newText(i){if(i&&typeof i!="string")throw Br("newText");this._newText=i}get newEol(){return this._newEol}set newEol(i){if(i&&typeof i!="number")throw Br("newEol");this._newEol=i}constructor(i,e){this._range=i,this._newText=e}toJSON(){return{range:this.range,newText:this.newText,newEol:this._newEol}}};Hx=I([cr],Hx);var Ij=ae("notebookDocumentService"),Gci=["W","X","Y","Z","a","b","c","d","e","f"],LUo=new RegExp(`^[${Gci.join("")}]+`),p9i=7;function dxe(a){if(a.scheme!==Y.vscodeNotebookCell)return;let i=a.fragment.indexOf("s");if(i<0)return;let e=parseInt(a.fragment.substring(0,i).replace(LUo,""),p9i),t=Sl(a.fragment.substring(i+1)).toString();if(!isNaN(e))return{handle:e,notebook:a.with({scheme:t,fragment:null})}}function m9i(a,i){let e=i.toString(p9i),o=`${e.length<Gci.length?Gci[e.length-1]:"z"}${e}s${Qd(Je.fromString(a.scheme),!0,!0)}`;return a.with({scheme:Y.vscodeNotebookCell,fragment:o})}function h9i(a){if(a.scheme!==Y.vscodeNotebookMetadata)return;let i=Sl(a.fragment).toString();return a.with({scheme:i,fragment:null})}function g9i(a){let i=`${Qd(Je.fromString(a.scheme),!0,!0)}`;return a.with({scheme:Y.vscodeNotebookMetadata,fragment:i})}function V3e(a){if(a.scheme!==Y.vscodeNotebookCellOutput)return;let i=new URLSearchParams(a.query),e=i.get("openIn");if(!e)return;let t=i.get("outputId")??void 0,o=dxe(a.with({scheme:Y.vscodeNotebookCell,query:null})),n=i.get("outputIndex")?parseInt(i.get("outputIndex")||"",10):void 0,r=o?o.notebook:a.with({scheme:i.get("notebookScheme")||Y.file,fragment:null,query:null}),s=i.get("cellIndex")?parseInt(i.get("cellIndex")||"",10):void 0;return{notebook:r,openIn:e,outputId:t,outputIndex:n,cellHandle:o?.handle,cellFragment:a.fragment,cellIndex:s}}var $ci=class{constructor(){this._documents=new vt}getNotebook(i){if(i.scheme===Y.vscodeNotebookCell){let e=dxe(i);if(e){let t=this._documents.get(e.notebook);if(t)return t}}if(i.scheme===Y.vscodeNotebookCellOutput){let e=V3e(i);if(e){let t=this._documents.get(e.notebook);if(t)return t}}return this._documents.get(i)}addNotebookDocument(i){this._documents.set(i.uri,i)}removeNotebookDocument(i){this._documents.delete(i.uri)}};we(Ij,$ci,1);var qL="workbench.editor.notebook",lY="workbench.editor.notebookTextDiffEditor",f9i="workbench.editor.notebookMultiTextDiffEditor",cY="workbench.editor.interactive",uxe="workbench.editor.repl",v9i="workbench.editor.notebookOutputEditor";var jci=["application/json","application/javascript","text/html","image/svg+xml",Zn.latex,Zn.markdown,"image/png","image/jpeg",Zn.text],b9i=[Zn.latex,Zn.markdown,"application/json","text/html","image/svg+xml","image/png","image/jpeg",Zn.text],S9i=new Map([["ms-toolsai.jupyter",new Set(["jupyter-notebook","interactive"])],["ms-toolsai.jupyter-renderers",new Set(["jupyter-notebook","interactive"])]]),az="_notAvailable";var B3e;(t=>{t.scheme=Y.vscodeNotebookMetadata;function i(o){return g9i(o)}t.generate=i;function e(o){return h9i(o)}t.parse=e})(B3e||={});var Zo;(c=>{c.scheme=Y.vscodeNotebookCell;function i(u,p){return m9i(u,p)}c.generate=i;function e(u){return dxe(u)}c.parse=e;function t(u,p){return u.with({scheme:Y.vscodeNotebookCellOutput,query:new URLSearchParams({openIn:"editor",outputId:p??"",notebookScheme:u.scheme!==Y.file?u.scheme:""}).toString()})}c.generateCellOutputUriWithId=t;function o(u,p,h){return u.with({scheme:Y.vscodeNotebookCellOutput,fragment:p.fragment,query:new URLSearchParams({openIn:"notebook",outputIndex:String(h)}).toString()})}c.generateCellOutputUriWithIndex=o;function n(u,p,h,g,f){return u.with({scheme:Y.vscodeNotebookCellOutput,query:new URLSearchParams({openIn:"notebookOutputEditor",notebook:u.toString(),cellIndex:String(h),outputId:g,outputIndex:String(f)}).toString()})}c.generateOutputEditorUri=n;function r(u){return V3e(u)}c.parseCellOutputUri=r;function s(u,p,h){return c.generate(u,p).with({scheme:h})}c.generateCellPropertyUri=s;function l(u,p){if(u.scheme===p)return c.parse(u.with({scheme:c.scheme}))}c.parseCellPropertyUri=l})(Zo||={});var ckt=a=>ri?a.replace(/\//g,"\\"):a,ukt=class{constructor(i=[],e=jci){this.defaultOrder=e;this.order=[...new Set(i)].map(t=>({pattern:t,matches:zm(ckt(t),{ignoreCase:!0})}))}sort(i){let e=new Map(ht.map(i,o=>[o,ckt(o)])),t=[];for(let{matches:o}of this.order)for(let[n,r]of e)if(o(r)){t.push(n),e.delete(n);break}return e.size&&(t=t.concat([...e.keys()].sort((o,n)=>this.defaultOrder.indexOf(o)-this.defaultOrder.indexOf(n)))),t}prioritize(i,e){let t=this.findIndex(i);if(t===-1){this.order.unshift({pattern:i,matches:zm(ckt(i),{ignoreCase:!0})});return}let o=new Set(e.map(r=>this.findIndex(r,t)));o.delete(-1);let n=Array.from(o).sort();this.order.splice(t+1,0,...n.map(r=>this.order[r]));for(let r=n.length-1;r>=0;r--)this.order.splice(n[r],1)}toArray(){return this.order.map(i=>i.pattern)}findIndex(i,e=this.order.length){let t=ckt(i);for(let o=0;o<e;o++)if(this.order[o].matches(t))return o;return-1}};function H3e(a,i,e,t=(o,n)=>o===n){let o=[];function n(l,c,u){if(c===0&&u.length===0)return;let p=o[o.length-1];p&&p.start+p.deleteCount===l?(p.deleteCount+=c,p.toInsert.push(...u)):o.push({start:l,deleteCount:c,toInsert:u})}let r=0,s=0;for(;;){if(r===a.length){n(r,0,i.slice(s));break}if(s===i.length){n(r,a.length-r,[]);break}let l=a[r],c=i[s];if(t(l,c)){r+=1,s+=1;continue}e(c)?(n(r,1,[]),r+=1):(n(r,0,[c]),s+=1)}return o}var tce=new Q("notebookEditorCursorAtBoundary","none"),ice=new Q("notebookEditorCursorAtLineBoundary","none");function pkt(a){let i=a;return!!((typeof i.include=="string"||eP(i.include))&&(typeof i.exclude=="string"||eP(i.exclude)))}var ft={displayOrder:"notebook.displayOrder",cellToolbarLocation:"notebook.cellToolbarLocation",cellToolbarVisibility:"notebook.cellToolbarVisibility",showCellStatusBar:"notebook.showCellStatusBar",cellExecutionTimeVerbosity:"notebook.cellExecutionTimeVerbosity",textDiffEditorPreview:"notebook.diff.enablePreview",diffOverviewRuler:"notebook.diff.overviewRuler",experimentalInsertToolbarAlignment:"notebook.experimental.insertToolbarAlignment",compactView:"notebook.compactView",focusIndicator:"notebook.cellFocusIndicator",insertToolbarLocation:"notebook.insertToolbarLocation",globalToolbar:"notebook.globalToolbar",stickyScrollEnabled:"notebook.stickyScroll.enabled",stickyScrollMode:"notebook.stickyScroll.mode",undoRedoPerCell:"notebook.undoRedoPerCell",consolidatedOutputButton:"notebook.consolidatedOutputButton",openOutputInPreviewEditor:"notebook.output.openInPreviewEditor.enabled",showFoldingControls:"notebook.showFoldingControls",dragAndDropEnabled:"notebook.dragAndDropEnabled",cellEditorOptionsCustomizations:"notebook.editorOptionsCustomizations",consolidatedRunButton:"notebook.consolidatedRunButton",openGettingStarted:"notebook.experimental.openGettingStarted",globalToolbarShowLabel:"notebook.globalToolbarShowLabel",markupFontSize:"notebook.markup.fontSize",markdownLineHeight:"notebook.markdown.lineHeight",interactiveWindowCollapseCodeCells:"interactiveWindow.collapseCellInputCode",outputScrollingDeprecated:"notebook.experimental.outputScrolling",outputScrolling:"notebook.output.scrolling",textOutputLineLimit:"notebook.output.textLineLimit",LinkifyOutputFilePaths:"notebook.output.linkifyFilePaths",minimalErrorRendering:"notebook.output.minimalErrorRendering",formatOnSave:"notebook.formatOnSave.enabled",insertFinalNewline:"notebook.insertFinalNewline",defaultFormatter:"notebook.defaultFormatter",formatOnCellExecution:"notebook.formatOnCellExecution",codeActionsOnSave:"notebook.codeActionsOnSave",outputWordWrap:"notebook.output.wordWrap",outputLineHeightDeprecated:"notebook.outputLineHeight",outputLineHeight:"notebook.output.lineHeight",outputFontSizeDeprecated:"notebook.outputFontSize",outputFontSize:"notebook.output.fontSize",outputFontFamilyDeprecated:"notebook.outputFontFamily",outputFontFamily:"notebook.output.fontFamily",findFilters:"notebook.find.filters",logging:"notebook.logging",confirmDeleteRunningCell:"notebook.confirmDeleteRunningCell",remoteSaving:"notebook.experimental.remoteSave",gotoSymbolsAllSymbols:"notebook.gotoSymbols.showAllSymbols",outlineShowMarkdownHeadersOnly:"notebook.outline.showMarkdownHeadersOnly",outlineShowCodeCells:"notebook.outline.showCodeCells",outlineShowCodeCellSymbols:"notebook.outline.showCodeCellSymbols",breadcrumbsShowCodeCells:"notebook.breadcrumbs.showCodeCells",scrollToRevealCell:"notebook.scrolling.revealNextCellOnExecute",cellChat:"notebook.experimental.cellChat",cellGenerate:"notebook.experimental.generate",notebookVariablesView:"notebook.variablesView",notebookInlineValues:"notebook.inlineValues",InteractiveWindowPromptToSave:"interactiveWindow.promptToSaveOnClose",cellFailureDiagnostics:"notebook.cellFailureDiagnostics",outputBackupSizeLimit:"notebook.backup.sizeLimit",multiCursor:"notebook.multiCursor.enabled",markupFontFamily:"notebook.markup.fontFamily"};var _O=class a{static{this._prefix="notebook/"}static create(i,e){return`${a._prefix}${i}/${e??i}`}static parse(i){if(i.startsWith(a._prefix)){let e=i.substring(a._prefix.length).split("/");if(e.length===2)return{notebookType:e[0],viewType:e[1]}}}},RUo=new TextDecoder;function I9i(a){let i=[],e=!1;for(let r of a)(i.length===0||e)&&(i.push(r),e=!0);let t=PUo(i),o=Je.concat(i.map(r=>Je.wrap(r))),n=WUo(o);return t=t||n.byteLength!==o.byteLength,{data:n,didCompression:t}}var dkt="\x1B[A",qci=dkt.split("").map(a=>a.charCodeAt(0)),MUo=10;function PUo(a){let i=!1;return a.forEach((e,t)=>{if(t===0||e.length<dkt.length)return;let o=a[t-1],n=e.subarray(0,dkt.length);if(n[0]===qci[0]&&n[1]===qci[1]&&n[2]===qci[2]){let r=o.lastIndexOf(MUo);if(r===-1)return;i=!0,a[t-1]=o.subarray(0,r),a[t]=e.subarray(dkt.length)}}),i}function AUo(a){let i=a;do a=i,i=a.replace(/[^\n]\x08/gm,"");while(i.length<a.length);return a}function NUo(a){for(a=a.replace(/\r+\n/gm,`
`);a.search(/\r[^$]/g)>-1;){let i=a.match(/^(.*)\r+/m)[1],e=a.match(/\r+(.*)$/m)[1];e=e+i.slice(e.length,i.length),a=a.replace(/\r+.*$/m,"\r").replace(/^.*\r/m,e)}return a}var OUo=8,FUo=13;function WUo(a){return!a.buffer.includes(OUo)&&!a.buffer.includes(FUo)?a:Je.fromString(NUo(AUo(RUo.decode(a.buffer))))}var dY=class{constructor(){this._edits=[]}_allEntries(){return this._edits}renameFile(i,e,t,o){this._edits.push({_type:1,from:i,to:e,options:t,metadata:o})}createFile(i,e,t){this._edits.push({_type:1,from:void 0,to:i,options:e,metadata:t})}deleteFile(i,e,t){this._edits.push({_type:1,from:i,to:void 0,options:e,metadata:t})}replaceNotebookMetadata(i,e,t){this._edits.push({_type:3,metadata:t,uri:i,edit:{editType:5,metadata:e}})}replaceNotebookCells(i,e,t,o){let n=e.start,r=e.end;(n!==r||t.length>0)&&this._edits.push({_type:5,uri:i,index:n,count:r-n,cells:t,metadata:o})}replaceNotebookCellMetadata(i,e,t,o){this._edits.push({_type:3,metadata:o,uri:i,edit:{editType:3,index:e,metadata:t}})}replace(i,e,t,o){this._edits.push({_type:2,uri:i,edit:new Hx(e,t),metadata:o})}insert(i,e,t,o){this.replace(i,new Kc(e,e),t,o)}delete(i,e,t){this.replace(i,e,"",t)}has(i){return this._edits.some(e=>e._type===2&&e.uri.toString()===i.toString())}set(i,e){if(e)for(let t of e){if(!t)continue;let o,n;Array.isArray(t)?(o=t[0],n=t[1]):o=t,$L.isNotebookCellEdit(o)?o.newCellMetadata?this.replaceNotebookCellMetadata(i,o.range.start,o.newCellMetadata,n):o.newNotebookMetadata?this.replaceNotebookMetadata(i,o.newNotebookMetadata,n):this.replaceNotebookCells(i,o.range,o.newCells,n):ece.isSnippetTextEdit(o)?this._edits.push({_type:6,uri:i,range:o.range,edit:o.snippet,metadata:n,keepWhitespace:o.keepWhitespace}):this._edits.push({_type:2,uri:i,edit:o,metadata:n})}else{for(let t=0;t<this._edits.length;t++){let o=this._edits[t];switch(o._type){case 2:case 6:case 3:case 5:o.uri.toString()===i.toString()&&(this._edits[t]=void 0);break}}ZG(this._edits)}}get(i){let e=[];for(let t of this._edits)t._type===2&&t.uri.toString()===i.toString()&&e.push(t.edit);return e}entries(){let i=new vt;for(let e of this._edits)if(e._type===2){let t=i.get(e.uri);t||(t=[e.uri,[]],i.set(e.uri,t)),t[1].push(e.edit)}return[...i.values()]}get size(){return this.entries().length}toJSON(){return this.entries()}};dY=I([cr],dY);var sce,uY=class{constructor(i){Yve(this,sce);j2e(this,sce,i)}static from(...i){let e=i;return new uY(function(){if(e){for(let t of e)t&&typeof t.dispose=="function"&&t.dispose();e=void 0}})}dispose(){typeof pf(this,sce)=="function"&&(pf(this,sce).call(this),j2e(this,sce,void 0))}};sce=new WeakMap,uY=I([cr],uY);var z3e=class{constructor(i,e){if(!i)throw new Error("Illegal argument, contents must be defined");Array.isArray(i)?this.contents=i:this.contents=[i],this.range=e}};z3e=I([cr],z3e);var pxe=class extends z3e{constructor(i,e,t,o){super(i,e),this.canIncreaseVerbosity=t,this.canDecreaseVerbosity=o}};pxe=I([cr],pxe);var w9i=(t=>(t[t.Text=0]="Text",t[t.Read=1]="Read",t[t.Write=2]="Write",t))(w9i||{}),mxe=class{constructor(i,e=0){this.range=i,this.kind=e}toJSON(){return{range:this.range,kind:w9i[this.kind]}}};mxe=I([cr],mxe);var hxe=class{constructor(i,e){this.uri=i,this.highlights=e}toJSON(){return{uri:this.uri,highlights:this.highlights.map(i=>i.toJSON())}}};hxe=I([cr],hxe);var wj=class{static validate(i){if(!i.name)throw new Error("name must not be falsy");if(!i.range.contains(i.selectionRange))throw new Error("selectionRange must be contained in fullRange");i.children?.forEach(wj.validate)}constructor(i,e,t,o,n){this.name=i,this.detail=e,this.kind=t,this.range=o,this.selectionRange=n,this.children=[],wj.validate(this)}};wj=I([cr],wj);var mkt=class{constructor(i,e){this.title=i,this.kind=e}};mkt=I([cr],mkt);var gxe=class{constructor(i,e){if(this.range=i,this.parent=e,e&&!e.range.contains(this.range))throw new Error("Invalid argument: parent must contain this range")}};gxe=I([cr],gxe);var Nkt=class{constructor(i,e,t,o,n,r){this.kind=i,this.name=e,this.detail=t,this.uri=o,this.range=n,this.selectionRange=r}},Okt=class{constructor(i,e){this.fromRanges=e,this.from=i}},Fkt=class{constructor(i,e){this.fromRanges=e,this.to=i}};var hkt=class{constructor(i,e){this.range=i,this.command=e}get isResolved(){return!!this.command}};hkt=I([cr],hkt);var gkt=class{constructor(i,e){this.label=i,this.documentation=e}};gkt=I([cr],gkt);var fkt=class{constructor(i,e){this.label=i,this.documentation=e,this.parameters=[]}};fkt=I([cr],fkt);var vkt=class{constructor(){this.activeSignature=0;this.activeParameter=0;this.signatures=[]}};vkt=I([cr],vkt);var fxe=class{constructor(i){this.value=i}};fxe=I([cr],fxe);var vxe=class{constructor(i,e,t){this.position=i,this.label=e,this.kind=t}};vxe=I([cr],vxe);var Yci=($=>($[$.Text=0]="Text",$[$.Method=1]="Method",$[$.Function=2]="Function",$[$.Constructor=3]="Constructor",$[$.Field=4]="Field",$[$.Variable=5]="Variable",$[$.Class=6]="Class",$[$.Interface=7]="Interface",$[$.Module=8]="Module",$[$.Property=9]="Property",$[$.Unit=10]="Unit",$[$.Value=11]="Value",$[$.Enum=12]="Enum",$[$.Keyword=13]="Keyword",$[$.Snippet=14]="Snippet",$[$.Color=15]="Color",$[$.File=16]="File",$[$.Reference=17]="Reference",$[$.Folder=18]="Folder",$[$.EnumMember=19]="EnumMember",$[$.Constant=20]="Constant",$[$.Struct=21]="Struct",$[$.Event=22]="Event",$[$.Operator=23]="Operator",$[$.TypeParameter=24]="TypeParameter",$[$.User=25]="User",$[$.Issue=26]="Issue",$))(Yci||{});var bxe=class{constructor(i,e){this.label=i,this.kind=e}toJSON(){return{label:this.label,kind:this.kind&&Yci[this.kind],detail:this.detail,documentation:this.documentation,sortText:this.sortText,filterText:this.filterText,preselect:this.preselect,insertText:this.insertText,textEdit:this.textEdit}}};bxe=I([cr],bxe);var bkt=class{constructor(i=[],e=!1){this.items=i,this.isIncomplete=e}};bkt=I([cr],bkt);var Skt=class{constructor(i,e,t){this.insertText=i,this.range=e,this.command=t}};Skt=I([cr],Skt);var Ikt=class{constructor(i){this.commands=void 0;this.suppressSuggestions=void 0;this.items=i}};Ikt=I([cr],Ikt);function C9i(a,i){return`${Ei.toKey(a)}.${i}`}var Xci=(t=>(t[t.Keyboard=1]="Keyboard",t[t.Mouse=2]="Mouse",t[t.Command=3]="Command",t))(Xci||{});(i=>{function a(e){switch(e){case"keyboard":return 1;case"mouse":return 2;case"api":case"code.jump":case"code.navigation":return 3}}i.fromValue=a})(Xci||={});var Jci=(o=>(o[o.Other=0]="Other",o[o.Comment=1]="Comment",o[o.String=2]="String",o[o.RegEx=3]="RegEx",o))(Jci||{});(i=>{function a(e){switch(e){case 0:return"other";case 1:return"comment";case 2:return"string";case 3:return"regex"}return"other"}i.toString=a})(Jci||={});var Sxe=class{constructor(i,e){if(e&&!A.isUri(e))throw Br("target");if(!Kc.isRange(i)||i.isEmpty)throw Br("range");this.range=i,this.target=e}};Sxe=I([cr],Sxe);var oce=class{constructor(i,e,t,o){this.red=i,this.green=e,this.blue=t,this.alpha=o}};oce=I([cr],oce);var ykt=class{constructor(i,e){if(e&&!(e instanceof oce))throw Br("color");if(!Kc.isRange(i)||i.isEmpty)throw Br("range");this.range=i,this.color=e}};ykt=I([cr],ykt);var Ixe=class{constructor(i){if(!i||typeof i!="string")throw Br("label");this.label=i}};Ixe=I([cr],Ixe);var Ux=class{constructor(i,e){this.label=e;if(typeof i!="string")throw Br("name");if(typeof e!="string")throw Br("name");this._id=i}static from(i){switch(i){case"clean":return Ux.Clean;case"build":return Ux.Build;case"rebuild":return Ux.Rebuild;case"test":return Ux.Test;default:return}}get id(){return this._id}};Ux.Clean=new Ux("clean","Clean"),Ux.Build=new Ux("build","Build"),Ux.Rebuild=new Ux("rebuild","Rebuild"),Ux.Test=new Ux("test","Test"),Ux=I([cr],Ux);function x9i(a){let i="";for(let e=0;e<a.length;e++)i+=a[e].replace(/,/g,",,")+",";return i}var K3e=class{constructor(i,e,t){if(typeof i!="string")throw Br("process");this._args=[],this._process=i,e!==void 0&&(Array.isArray(e)?(this._args=e,this._options=t):this._options=e)}get process(){return this._process}set process(i){if(typeof i!="string")throw Br("process");this._process=i}get args(){return this._args}set args(i){Array.isArray(i)||(i=[]),this._args=i}get options(){return this._options}set options(i){this._options=i}computeId(){let i=[];if(i.push("process"),this._process!==void 0&&i.push(this._process),this._args&&this._args.length>0)for(let e of this._args)i.push(e);return x9i(i)}};K3e=I([cr],K3e);var G3e=class{constructor(i,e,t){this._args=[];if(Array.isArray(e)){if(!i)throw Br("command can't be undefined or null");if(typeof i!="string"&&typeof i.value!="string")throw Br("command");this._command=i,e&&(this._args=e),this._options=t}else{if(typeof i!="string")throw Br("commandLine");this._commandLine=i,this._options=e}}get commandLine(){return this._commandLine}set commandLine(i){if(typeof i!="string")throw Br("commandLine");this._commandLine=i}get command(){return this._command?this._command:""}set command(i){if(typeof i!="string"&&typeof i.value!="string")throw Br("command");this._command=i}get args(){return this._args}set args(i){this._args=i||[]}get options(){return this._options}set options(i){this._options=i}computeId(){let i=[];if(i.push("shell"),this._commandLine!==void 0&&i.push(this._commandLine),this._command!==void 0&&i.push(typeof this._command=="string"?this._command:this._command.value),this._args&&this._args.length>0)for(let e of this._args)i.push(typeof e=="string"?e:e.value);return x9i(i)}};G3e=I([cr],G3e);var Qci=class{constructor(i){this._callback=i}computeId(){return"customExecution"+_t()}set callback(i){this._callback=i}get callback(){return this._callback}},zx=class{constructor(i,e,t,o,n,r){this.__deprecated=!1;this._definition=this.definition=i;let s;typeof e=="string"?(this._name=this.name=e,this._source=this.source=t,this.execution=o,s=n,this.__deprecated=!0):e===1||e===2?(this.target=e,this._name=this.name=t,this._source=this.source=o,this.execution=n,s=r):(this.target=e,this._name=this.name=t,this._source=this.source=o,this.execution=n,s=r),typeof s=="string"?(this._problemMatchers=[s],this._hasDefinedMatchers=!0):Array.isArray(s)?(this._problemMatchers=s,this._hasDefinedMatchers=!0):(this._problemMatchers=[],this._hasDefinedMatchers=!1),this._isBackground=!1,this._presentationOptions=Object.create(null),this._runOptions=Object.create(null)}get _id(){return this.__id}set _id(i){this.__id=i}get _deprecated(){return this.__deprecated}clear(){this.__id!==void 0&&(this.__id=void 0,this._scope=void 0,this.computeDefinitionBasedOnExecution())}computeDefinitionBasedOnExecution(){this._execution instanceof K3e?this._definition={type:zx.ProcessType,id:this._execution.computeId()}:this._execution instanceof G3e?this._definition={type:zx.ShellType,id:this._execution.computeId()}:this._execution instanceof Qci?this._definition={type:zx.ExtensionCallbackType,id:this._execution.computeId()}:this._definition={type:zx.EmptyType,id:_t()}}get definition(){return this._definition}set definition(i){if(i==null)throw Br("Kind can't be undefined or null");this.clear(),this._definition=i}get scope(){return this._scope}set target(i){this.clear(),this._scope=i}get name(){return this._name}set name(i){if(typeof i!="string")throw Br("name");this.clear(),this._name=i}get execution(){return this._execution}set execution(i){i===null&&(i=void 0),this.clear(),this._execution=i;let e=this._definition.type;(zx.EmptyType===e||zx.ProcessType===e||zx.ShellType===e||zx.ExtensionCallbackType===e)&&this.computeDefinitionBasedOnExecution()}get problemMatchers(){return this._problemMatchers}set problemMatchers(i){if(Array.isArray(i))this.clear(),this._problemMatchers=i,this._hasDefinedMatchers=!0;else{this.clear(),this._problemMatchers=[],this._hasDefinedMatchers=!1;return}}get hasDefinedMatchers(){return this._hasDefinedMatchers}get isBackground(){return this._isBackground}set isBackground(i){i!==!0&&i!==!1&&(i=!1),this.clear(),this._isBackground=i}get source(){return this._source}set source(i){if(typeof i!="string"||i.length===0)throw Br("source must be a string of length > 0");this.clear(),this._source=i}get group(){return this._group}set group(i){i===null&&(i=void 0),this.clear(),this._group=i}get detail(){return this._detail}set detail(i){i===null&&(i=void 0),this._detail=i}get presentationOptions(){return this._presentationOptions}set presentationOptions(i){i==null&&(i=Object.create(null)),this.clear(),this._presentationOptions=i}get runOptions(){return this._runOptions}set runOptions(i){i==null&&(i=Object.create(null)),this.clear(),this._runOptions=i}};zx.ExtensionCallbackType="customExecution",zx.ProcessType="process",zx.ShellType="shell",zx.EmptyType="$empty",zx=I([cr],zx);var KUo;(i=>{function a(e){let t=e;return Xo(t.value)?t.tooltip&&!Ae(t.tooltip)?(console.log("INVALID view badge, invalid tooltip",t.tooltip),!1):!0:(console.log("INVALID view badge, invalid value",t.value),!1)}i.isViewBadge=a})(KUo||={});var yxe=class{constructor(i,e=0){this.collapsibleState=e;A.isUri(i)?this.resourceUri=i:this.label=i}static isTreeItem(i,e){let t=i;if(t.checkboxState!==void 0){let o=Xo(t.checkboxState)?t.checkboxState:yi(t.checkboxState)&&Xo(t.checkboxState.state)?t.checkboxState.state:void 0,n=!Xo(t.checkboxState)&&yi(t.checkboxState)?t.checkboxState.tooltip:void 0;if(o===void 0||o!==1&&o!==0||n!==void 0&&!Ae(n))return console.log("INVALID tree item, invalid checkboxState",t.checkboxState),!1}if(i instanceof yxe)return!0;if(t.label!==void 0&&!Ae(t.label)&&!t.label?.label)return console.log("INVALID tree item, invalid label",t.label),!1;if(t.id!==void 0&&!Ae(t.id))return console.log("INVALID tree item, invalid id",t.id),!1;if(t.iconPath!==void 0&&!Ae(t.iconPath)&&!A.isUri(t.iconPath)&&(!t.iconPath||!Ae(t.iconPath.id))){let o=t.iconPath;if(!o||!Ae(o.light)&&!A.isUri(o.light)&&!Ae(o.dark)&&!A.isUri(o.dark))return console.log("INVALID tree item, invalid iconPath",t.iconPath),!1}return t.description!==void 0&&!Ae(t.description)&&typeof t.description!="boolean"?(console.log("INVALID tree item, invalid description",t.description),!1):t.resourceUri!==void 0&&!A.isUri(t.resourceUri)?(console.log("INVALID tree item, invalid resourceUri",t.resourceUri),!1):t.tooltip!==void 0&&!Ae(t.tooltip)&&!(t.tooltip instanceof EE)?(console.log("INVALID tree item, invalid tooltip",t.tooltip),!1):t.command!==void 0&&!t.command.command?(console.log("INVALID tree item, invalid command",t.command),!1):t.collapsibleState!==void 0&&t.collapsibleState<0&&t.collapsibleState>2?(console.log("INVALID tree item, invalid collapsibleState",t.collapsibleState),!1):t.contextValue!==void 0&&!Ae(t.contextValue)?(console.log("INVALID tree item, invalid contextValue",t.contextValue),!1):t.accessibilityInformation!==void 0&&!t.accessibilityInformation?.label?(console.log("INVALID tree item, invalid accessibilityInformation",t.accessibilityInformation),!1):!0}};yxe=I([cr],yxe);var $3e=class{constructor(i){this.value=i}async asString(){return typeof this.value=="string"?this.value:JSON.stringify(this.value)}asFile(){}};$3e=I([cr],$3e);var _xe=class extends $3e{},Wkt=class extends _xe{$b;constructor(i){super(""),this.$b=i}asFile(){return this.$b}},Vkt=class{constructor(i,e,t,o){this.name=i,this.uri=e,this._itemId=t,this._getData=o}data(){return this._getData()}},yj,ace,q3e,wxe=class{constructor(i){Yve(this,ace);Yve(this,yj,new Map);for(let[e,t]of i??[]){let o=pf(this,yj).get(Q2e(this,ace,q3e).call(this,e));o?o.push(t):pf(this,yj).set(Q2e(this,ace,q3e).call(this,e),[t])}}get(i){return pf(this,yj).get(Q2e(this,ace,q3e).call(this,i))?.[0]}set(i,e){pf(this,yj).set(Q2e(this,ace,q3e).call(this,i),[e])}forEach(i,e){for(let[t,o]of pf(this,yj))for(let n of o)i.call(e,n,t,this)}*[Symbol.iterator](){for(let[i,e]of pf(this,yj))for(let t of e)yield[i,t]}};yj=new WeakMap,ace=new WeakSet,q3e=function(i){return i.toLowerCase()},wxe=I([cr],wxe);var wkt=class{constructor(i,e,t){this.insertText=i,this.title=e,this.kind=t}};wkt=I([cr],wkt);var hY=class a{constructor(i){this.value=i}static{this.sep="."}append(...i){return new a((this.value?[this.value,...i]:i).join(a.sep))}intersects(i){return this.contains(i)||i.contains(this)}contains(i){return this.value===i.value||i.value.startsWith(this.value+a.sep)}};hY.Empty=new hY("");hY.Text=new hY("text");hY.TextUpdateImports=hY.Text.append("updateImports");var Cj=class{constructor(i,e){this.id=i,this.color=e}static isThemeIcon(i){return typeof i.id!="string"?(console.log("INVALID ThemeIcon, invalid id",i.id),!1):!0}};Cj=I([cr],Cj);Cj.File=new Cj("file");Cj.Folder=new Cj("folder");var Ckt=class{constructor(i){this.id=i}};Ckt=I([cr],Ckt);var pY=class{get base(){return this._base}set base(i){this._base=i,this._baseUri=A.file(i)}get baseUri(){return this._baseUri}set baseUri(i){this._baseUri=i,this._base=i.fsPath}constructor(i,e){if(typeof i!="string"&&(!i||!A.isUri(i)&&!A.isUri(i.uri)))throw Br("base");if(typeof e!="string")throw Br("pattern");typeof i=="string"?this.baseUri=A.file(i):A.isUri(i)?this.baseUri=i:this.baseUri=i.uri,this.pattern=e}toJSON(){return{pattern:this.pattern,base:this.base,baseUri:this.baseUri.toJSON()}}};pY=I([cr],pY);var GUo=new WeakMap;var nce=class{constructor(i,e,t,o,n){this.enabled=typeof i=="boolean"?i:!0,typeof e=="string"&&(this.condition=e),typeof t=="string"&&(this.hitCondition=t),typeof o=="string"&&(this.logMessage=o),typeof n=="string"&&(this.mode=n)}get id(){return this._id||(this._id=GUo.get(this)??_t()),this._id}};nce=I([cr],nce);var xkt=class extends nce{constructor(i,e,t,o,n,r){if(super(e,t,o,n,r),i===null)throw Br("location");this.location=i}};xkt=I([cr],xkt);var kkt=class extends nce{constructor(i,e,t,o,n,r){super(e,t,o,n,r),this.functionName=i}};kkt=I([cr],kkt);var Ekt=class extends nce{constructor(i,e,t,o,n,r,s,l){if(super(o,n,r,s,l),!e)throw Br("dataId");this.label=i,this.dataId=e,this.canPersist=t}};Ekt=I([cr],Ekt);var Tkt=class{constructor(i,e,t){this.command=i,this.args=e||[],this.options=t}};Tkt=I([cr],Tkt);var _kt=class{constructor(i,e){this.port=i,this.host=e}};_kt=I([cr],_kt);var Dkt=class{constructor(i){this.path=i}};Dkt=I([cr],Dkt);var Lkt=class{constructor(i){this.implementation=i}};Lkt=I([cr],Lkt);var Cxe=class{constructor(i,e){this.range=i,this.expression=e}};Cxe=I([cr],Cxe);var xxe=class{constructor(i,e){this.range=i,this.text=e}};xxe=I([cr],xxe);var kxe=class{constructor(i,e,t=!0){this.range=i,this.variableName=e,this.caseSensitiveLookup=t}};kxe=I([cr],kxe);var Exe=class{constructor(i,e){this.range=i,this.expression=e}};Exe=I([cr],Exe);var Txe=class{constructor(i,e){this.frameId=i,this.stoppedLocation=e}};Txe=I([cr],Txe);var cC=class extends Error{static FileExists(i){return new cC(i,"EntryExists",cC.FileExists)}static FileNotFound(i){return new cC(i,"EntryNotFound",cC.FileNotFound)}static FileNotADirectory(i){return new cC(i,"EntryNotADirectory",cC.FileNotADirectory)}static FileIsADirectory(i){return new cC(i,"EntryIsADirectory",cC.FileIsADirectory)}static NoPermissions(i){return new cC(i,"NoPermissions",cC.NoPermissions)}static Unavailable(i){return new cC(i,"Unavailable",cC.Unavailable)}constructor(i,e="Unknown",t){super(A.isUri(i)?i.toString(!0):i),this.code=t?.name??"Unknown",gJt(this,e),Object.setPrototypeOf(this,cC.prototype),typeof Error.captureStackTrace=="function"&&typeof t=="function"&&Error.captureStackTrace(this,t)}};cC=I([cr],cC);var Rkt=class{constructor(i,e,t){this.start=i,this.end=e,this.kind=t}};Rkt=I([cr],Rkt);var U3e=class{constructor(){}};U3e.Back={iconPath:new Cj("arrow-left")},U3e=I([cr],U3e);var Mkt=class{constructor(i){this.kind=i}};Mkt=I([cr],Mkt);var Bkt=class{constructor(i,e=[]){this.uri=i;this.provides=Yl(e)}};var Pkt=class{constructor(i,e){this.label=i;this.timestamp=e}};Pkt=I([cr],Pkt);var Akt=class{constructor(i=void 0,e=void 0,t=void 0,o=!1,n=!0){this.include=i;this.exclude=e;this.profile=t;this.continuous=o;this.preserveFocus=n}};Akt=I([cr],Akt);var mY=class{constructor(i){this.message=i}static diff(i,e,t){let o=new mY(i);return o.expectedOutput=e,o.actualOutput=t,o}};mY=I([cr],mY);var rce=class{constructor(i){this.id=i}};rce=I([cr],rce);var j3e=class{constructor(i,e){this.covered=i;this.total=e;p8e(this)}};function p8e(a){if(a){if(a.covered>a.total)throw new Error(`The total number of covered items (${a.covered}) cannot be greater than the total (${a.total})`);if(a.total<0)throw new Error(`The number of covered items (${a.total}) cannot be negative`)}}var Hkt=class a{constructor(i,e,t,o,n=[]){this.uri=i;this.statementCoverage=e;this.branchCoverage=t;this.declarationCoverage=o;this.includesTests=n}static fromDetails(i,e){let t=new j3e(0,0),o=new j3e(0,0),n=new j3e(0,0);for(let s of e)if("branches"in s){t.total+=1,t.covered+=s.executed?1:0;for(let l of s.branches)o.total+=1,o.covered+=l.executed?1:0}else n.total+=1,n.covered+=s.executed?1:0;let r=new a(i,t,o.total>0?o:void 0,n.total>0?n:void 0);return r.detailedCoverage=e,r}},Ukt=class{constructor(i,e,t=[]){this.executed=i;this.location=e;this.branches=t}get executionCount(){return+this.executed}set executionCount(i){this.executed=i}},zkt=class{constructor(i,e,t){this.executed=i;this.location=e;this.label=t}get executionCount(){return+this.executed}set executionCount(i){this.executed=i}},Kkt=class{constructor(i,e,t){this.name=i;this.executed=e;this.location=t}get executionCount(){return+this.executed}set executionCount(i){this.executed=i}};var Gkt=class{constructor(i,e,t,o,n,r){this.kind=i,this.name=e,this.detail=t,this.uri=o,this.range=n,this.selectionRange=r}};var Q3e=class{constructor(i){if(typeof i!="string"&&i.isTrusted===!0)throw new Error("The boolean form of MarkdownString.isTrusted is NOT supported for chat participants.");this.value=typeof i=="string"?new EE(i):i}},Y3e=class{constructor(i,e){if(typeof i!="string"&&i.isTrusted===!0)throw new Error("The boolean form of MarkdownString.isTrusted is NOT supported for chat participants.");this.value=typeof i=="string"?new EE(i):i,this.vulnerabilities=e}},$kt=class{constructor(i,e,t,o){this.title=i,this.message=e,this.data=t,this.buttons=o}},X3e=class{constructor(i,e){this.value=i,this.baseUri=e}},J3e=class{constructor(i,e,t){this.value=i,this.title=e,this.readOnly=t}};var qkt=class{constructor(i,e,t,o){this.description=i,this.agentName=e,this.prompt=t,this.result=o}};var Z3e=class{constructor(i,e){this.value=i,this.value2=i,this.title=e}},e8e=class{constructor(i){this.value=i}};var t8e=class{constructor(i,e,t){this.value=i,this.id=e,this.metadata=t}},i8e=class{constructor(i,e,t,o){this.hookType=i,this.stopReason=e,this.systemMessage=t,this.metadata=o}},o8e=class{constructor(i){if(typeof i!="string"&&i.isTrusted===!0)throw new Error("The boolean form of MarkdownString.isTrusted is NOT supported for chat participants.");this.value=typeof i=="string"?new EE(i):i}},n8e=class{constructor(i){this.value=i}},r8e=class{constructor(i,e,t){this.value=i,this.iconPath=e,this.options=t}},s8e=class{constructor(i,e,t){this.value=i,this.isEdit=e,this.undoStopId=t}},jkt=class{constructor(i,e,t){this.value=i,this.license=e,this.snippet=t}},a8e=class{constructor(i,e){this.uri=i;this.range=e}},Qkt=class{constructor(i){this.extensions=i}},Ykt=class{constructor(i,e,t,o,n){this.title=e;this.description=t;this.author=o;this.linkTag=n;oh(i)?(this.uri=i,this.command={title:"Open Pull Request",command:"vscode.open",arguments:[i]}):this.command=i}toJSON(){return{$mid:26,uri:this.uri,title:this.title,description:this.description,author:this.author}}};var Xkt=class{constructor(i,e,t,o){this.id=i,this.type=e,this.title=t,this.message=o?.message,this.options=o?.options,this.defaultValue=o?.defaultValue,this.allowFreeformInput=o?.allowFreeformInput}},l8e=class{constructor(i,e=!0){this.questions=i,this.allowSkip=e}},c8e=class{constructor(i,e){this.uri=i,e===!0?(this.isDone=!0,this.edits=[]):this.edits=Array.isArray(e)?e:[e]}},Jkt=class{constructor(i,e){this.uri=i,e===!0?(this.isDone=!0,this.edits=[]):this.edits=Array.isArray(e)?e:[e]}},Zkt=class{constructor(i){this.edits=i}};var d8e=class{constructor(i,e,t){this.toolName=i,this.toolCallId=e,this.errorMessage=t}};var eEt=class{constructor(i,e,t){this.mimeType=i,this.data=e,this.reference=t}},tEt=class{constructor(i){this.diagnostics=i}};var lce=class{constructor(i,e,t){this.callId=i,this.content=e,this.isError=t??!1}};var iEt=class a{constructor(i,e,t){this._content=[];this.role=i,this.content=e,this.name=t}static User(i,e){return new a(1,i,e)}static Assistant(i,e){return new a(2,i,e)}set content(i){typeof i=="string"?this._content=[new qS(i)]:this._content=i}get content(){return this._content}},oEt=class a{constructor(i,e,t){this._content=[];this.role=i,this.content=e,this.name=t}static User(i,e){return new a(1,i,e)}static Assistant(i,e){return new a(2,i,e)}set content(i){typeof i=="string"?this._content=[new qS(i)]:this._content=i}get content(){return this._content}set content2(i){i&&(this.content=i.map(e=>typeof e=="string"?new qS(e):e))}get content2(){return this.content.map(i=>i instanceof qS?i.value:i)}},cce=class{constructor(i,e,t){this.callId=i,this.name=e,this.input=t}};var qS=class{constructor(i,e){this.value=i,e=e}toJSON(){return{$mid:21,value:this.value,audience:this.audience}}},w_=class a{constructor(i,e,t){this.mimeType=e,this.data=i,this.audience=t}static image(i,e){return new a(i,e)}static json(i,e="text/x-json"){let t=JSON.stringify(i,void 0," ");return new a(Je.fromString(t).buffer,e)}static text(i,e=Zn.text){return new a(Je.fromString(i).buffer,e)}toJSON(){return{$mid:24,mimeType:this.mimeType,data:this.data,audience:this.audience}}};var Dxe=class{constructor(i,e,t){this.value=i,this.id=e,this.metadata=t}toJSON(){return{$mid:22,value:this.value,id:this.id,metadata:this.metadata}}},lz=class{constructor(i){this.value=i}toJSON(){return{$mid:23,value:this.value}}};var nEt=class a extends Error{static$c="LanguageModelError";static NotFound(i){return new a(i,a.NotFound.name)}static NoPermissions(i){return new a(i,a.NoPermissions.name)}static Blocked(i){return new a(i,a.Blocked.name)}static tryDeserialize(i){if(i.name===a.$c)return new a(i.message,i.code,i.cause)}constructor(i,e,t){super(i,{cause:t}),this.name=a.$c,this.code=e??""}},u8e=class{constructor(i){this.content=i}toJSON(){return{$mid:20,content:this.content}}};var rEt=class{constructor(i,e){this.id=i;this.label=e}},sEt=class{constructor(i,e,t){this.label=i;this.name=e;this.instructions=t}};var aEt=class{constructor(i,e,t,o={},n,r){this.label=i;this.command=e;this.args=t;this.env=o;this.version=n;this.metadata=r}},lEt=class{constructor(i,e,t={},o,n,r){this.label=i;this.uri=e;this.headers=t;this.version=o;this.metadata=n;this.authentication=r}};function DO(a){switch(a.type){case"light":return Oe.fromHex("#F3F3F3");case"hcLight":return Oe.fromHex("#FFFFFF");case"hcDark":return Oe.fromHex("#000000");default:return Oe.fromHex("#252526")}}var gEt=J("tab.activeBackground",qo,d(4757,null)),_9i=J("tab.unfocusedActiveBackground",gEt,d(4777,null)),Zci=J("tab.inactiveBackground",{dark:"#2D2D2D",light:"#ECECEC",hcDark:null,hcLight:null},d(4769,null)),D9i=J("tab.unfocusedInactiveBackground",Zci,d(4782,null)),ZW=J("tab.activeForeground",{dark:Oe.white,light:"#333333",hcDark:Oe.white,hcLight:"#292929"},d(4760,null)),E9i=J("tab.inactiveForeground",{dark:ei(ZW,.5),light:ei(ZW,.7),hcDark:Oe.white,hcLight:"#292929"},d(4770,null)),L9i=J("tab.unfocusedActiveForeground",{dark:ei(ZW,.5),light:ei(ZW,.7),hcDark:Oe.white,hcLight:"#292929"},d(4778,null)),_7s=J("tab.unfocusedInactiveForeground",{dark:ei(E9i,.5),light:ei(E9i,.5),hcDark:Oe.white,hcLight:"#292929"},d(4783,null)),dEt=J("tab.hoverBackground",null,d(4766,null)),R9i=J("tab.unfocusedHoverBackground",{dark:ei(dEt,.5),light:ei(dEt,.7),hcDark:null,hcLight:null},d(4779,null)),uEt=J("tab.hoverForeground",null,d(4768,null)),M9i=J("tab.unfocusedHoverForeground",{dark:ei(uEt,.5),light:ei(uEt,.5),hcDark:null,hcLight:null},d(4781,null)),h8e=J("tab.border",{dark:"#252526",light:"#F3F3F3",hcDark:gi,hcLight:gi},d(4764,null)),P9i=J("tab.lastPinnedBorder",{dark:tIe,light:tIe,hcDark:gi,hcLight:gi},d(4672,null)),Lxe=J("tab.activeBorder",null,d(4758,null)),A9i=J("tab.unfocusedActiveBorder",{dark:ei(Lxe,.5),light:ei(Lxe,.7),hcDark:null,hcLight:null},d(4762,null)),m8e=J("tab.activeBorderTop",{dark:null,light:null,hcDark:null,hcLight:"#B5200D"},d(4759,null)),N9i=J("tab.unfocusedActiveBorderTop",{dark:ei(m8e,.5),light:ei(m8e,.7),hcDark:null,hcLight:"#B5200D"},d(4763,null)),O9i=J("tab.selectedBorderTop",m8e,d(4775,null)),D7s=J("tab.selectedBackground",gEt,d(4774,null)),L7s=J("tab.selectedForeground",ZW,d(4776,null)),pEt=J("tab.hoverBorder",null,d(4767,null)),F9i=J("tab.unfocusedHoverBorder",{dark:ei(pEt,.5),light:ei(pEt,.7),hcDark:null,hcLight:gi},d(4780,null)),R7s=J("tab.dragAndDropBorder",{dark:ZW,light:ZW,hcDark:qs,hcLight:qs},d(4765,null)),Rxe=J("tab.activeModifiedBorder",{dark:"#3399CC",light:"#33AAEE",hcDark:null,hcLight:gi},d(4761,null)),mEt=J("tab.inactiveModifiedBorder",{dark:ei(Rxe,.5),light:ei(Rxe,.5),hcDark:Oe.white,hcLight:gi},d(4771,null)),W9i=J("tab.unfocusedActiveModifiedBorder",{dark:ei(Rxe,.5),light:ei(Rxe,.7),hcDark:Oe.white,hcLight:gi},d(4789,null)),V9i=J("tab.unfocusedInactiveModifiedBorder",{dark:ei(mEt,.5),light:ei(mEt,.5),hcDark:Oe.white,hcLight:gi},d(4790,null)),g8e=J("editorPane.background",qo,d(4668,null)),B9i=J("editorGroup.emptyBackground",null,d(4665,null)),M7s=J("editorGroup.focusedEmptyBorder",{dark:null,light:null,hcDark:Ad,hcLight:Ad},d(4666,null)),fEt=J("editorGroupHeader.tabsBackground",{dark:"#252526",light:"#F3F3F3",hcDark:null,hcLight:null},d(4772,null)),H9i=J("editorGroupHeader.tabsBorder",null,d(4773,null)),U9i=J("editorGroupHeader.noTabsBackground",qo,d(4667,null)),z9i=J("editorGroupHeader.border",{dark:null,light:null,hcDark:gi,hcLight:gi},d(4669,null)),vEt=J("editorGroup.border",{dark:"#444444",light:"#E7E7E7",hcDark:gi,hcLight:gi},d(4664,null)),_E=J("editorGroup.dropBackground",{dark:Oe.fromHex("#53595D").transparent(.5),light:Oe.fromHex("#2677CB").transparent(.18),hcDark:null,hcLight:Oe.fromHex("#0F4A85").transparent(.5)},d(4660,null)),K9i=J("editorGroup.dropIntoPromptForeground",dL,d(4663,null)),G9i=J("editorGroup.dropIntoPromptBackground",gm,d(4661,null)),$9i=J("editorGroup.dropIntoPromptBorder",{dark:null,light:null,hcDark:gi,hcLight:gi},d(4662,null)),q9i=J("sideBySideEditor.horizontalBorder",vEt,d(4723,null)),j9i=J("sideBySideEditor.verticalBorder",vEt,d(4724,null)),$Uo=J("outputView.background",null,d(4687,null));J("outputViewStickyScroll.background",$Uo,d(4688,null));var P7s=J("banner.background",{dark:Wy,light:Sp(Wy,.3),hcDark:Wy,hcLight:Wy},d(4648,null)),A7s=J("banner.foreground",QT,d(4649,null)),N7s=J("banner.iconForeground",fm,d(4650,null)),jL=J("statusBar.foreground",{dark:"#FFFFFF",light:"#FFFFFF",hcDark:"#FFFFFF",hcLight:od},d(4732,null)),Q9i=J("statusBar.noFolderForeground",jL,d(4744,null)),bEt=J("statusBar.background",{dark:"#007ACC",light:"#007ACC",hcDark:null,hcLight:null},d(4725,null)),SEt=J("statusBar.noFolderBackground",{dark:"#68217A",light:"#68217A",hcDark:null,hcLight:null},d(4742,null)),dce=J("statusBar.border",{dark:null,light:null,hcDark:gi,hcLight:gi},d(4726,null)),Y9i=J("statusBar.focusBorder",{dark:jL,light:jL,hcDark:null,hcLight:jL},d(4731,null)),X9i=J("statusBar.noFolderBorder",dce,d(4743,null)),O7s=J("statusBarItem.activeBackground",{dark:Oe.white.transparent(.18),light:Oe.white.transparent(.18),hcDark:Oe.white.transparent(.18),hcLight:Oe.black.transparent(.18)},d(4733,null)),J9i=J("statusBarItem.focusBorder",{dark:jL,light:jL,hcDark:null,hcLight:qs},d(4735,null)),JW=J("statusBarItem.hoverBackground",{dark:Oe.white.transparent(.12),light:Oe.black.transparent(.12),hcDark:Oe.black,hcLight:Oe.white},d(4736,null)),f8e=J("statusBarItem.hoverForeground",jL,d(4737,null)),Z9i=J("statusBarItem.compactHoverBackground",{dark:Oe.white.transparent(.12),light:Oe.black.transparent(.12),hcDark:Oe.black,hcLight:Oe.white},d(4734,null)),F7s=J("statusBarItem.prominentForeground",jL,d(4748,null)),W7s=J("statusBarItem.prominentBackground",Oe.black.transparent(.5),d(4747,null)),V7s=J("statusBarItem.prominentHoverForeground",f8e,d(4750,null)),B7s=J("statusBarItem.prominentHoverBackground",JW,d(4749,null)),edi=J("statusBarItem.errorBackground",{dark:Sp(Rse,.4),light:Sp(Rse,.4),hcDark:null,hcLight:"#B5200D"},d(4727,null)),H7s=J("statusBarItem.errorForeground",Oe.white,d(4728,null)),U7s=J("statusBarItem.errorHoverForeground",f8e,d(4730,null)),z7s=J("statusBarItem.errorHoverBackground",JW,d(4729,null)),e7i=J("statusBarItem.warningBackground",{dark:Sp(Bh,.4),light:Sp(Bh,.4),hcDark:null,hcLight:"#895503"},d(4753,null)),K7s=J("statusBarItem.warningForeground",Oe.white,d(4754,null)),G7s=J("statusBarItem.warningHoverForeground",f8e,d(4756,null)),$7s=J("statusBarItem.warningHoverBackground",JW,d(4755,null)),t7i=J("activityBar.background",{dark:"#333333",light:"#2C2C2C",hcDark:"#000000",hcLight:"#FFFFFF"},d(4635,null)),fY=J("activityBar.foreground",{dark:Oe.white,light:Oe.white,hcDark:Oe.white,hcLight:od},d(4640,null)),q7s=J("activityBar.inactiveForeground",{dark:ei(fY,.4),light:ei(fY,.4),hcDark:Oe.white,hcLight:od},d(4641,null)),i7i=J("activityBar.border",{dark:null,light:null,hcDark:gi,hcLight:gi},d(4638,null)),j7s=J("activityBar.activeBorder",{dark:fY,light:fY,hcDark:gi,hcLight:gi},d(4633,null)),Q7s=J("activityBar.activeFocusBorder",{dark:null,light:null,hcDark:null,hcLight:"#B5200D"},d(4634,null)),Y7s=J("activityBar.activeBackground",null,d(4632,null)),X7s=J("activityBar.dropBorder",{dark:fY,light:fY,hcDark:null,hcLight:null},d(4639,null)),kj=J("activityBarBadge.background",{dark:"#007ACC",light:"#007ACC",hcDark:"#000000",hcLight:"#0F4A85"},d(4636,null)),Ej=J("activityBarBadge.foreground",Oe.white,d(4637,null)),xj=J("activityBarTop.foreground",{dark:"#E7E7E7",light:"#424242",hcDark:Oe.white,hcLight:od},d(4642,null)),IEt=J("activityBarTop.activeBorder",{dark:xj,light:xj,hcDark:gi,hcLight:"#B5200D"},d(4644,null)),J7s=J("activityBarTop.activeBackground",null,d(4643,null)),yEt=J("activityBarTop.inactiveForeground",{dark:ei(xj,.6),light:ei(xj,.75),hcDark:Oe.white,hcLight:od},d(4647,null)),wEt=J("activityBarTop.dropBorder",xj,d(4646,null)),Z7s=J("activityBarTop.background",null,d(4645,null)),jS=J("panel.background",qo,d(4691,null)),cb=J("panel.border",{dark:Oe.fromHex("#808080").transparent(.35),light:Oe.fromHex("#808080").transparent(.35),hcDark:gi,hcLight:gi},d(4692,null)),o7i=J("panelTitle.border",{dark:null,light:null,hcDark:cb,hcLight:cb},d(4706,null)),eV=J("panelTitle.activeForeground",{dark:"#E7E7E7",light:"#424242",hcDark:Oe.white,hcLight:od},d(4690,null)),Pxe=J("panelTitle.inactiveForeground",{dark:ei(eV,.6),light:ei(eV,.75),hcDark:Oe.white,hcLight:od},d(4694,null)),Axe=J("panelTitle.activeBorder",{dark:eV,light:eV,hcDark:gi,hcLight:"#B5200D"},d(4689,null)),n7i=J("panelTitleBadge.background",kj,d(4704,null)),r7i=J("panelTitleBadge.foreground",Ej,d(4705,null)),eYs=J("panelInput.border",{dark:Vy,light:Oe.fromHex("#ddd"),hcDark:Vy,hcLight:Vy},d(4695,null)),Nxe=J("panel.dropBorder",eV,d(4693,null)),v8e=J("panelSection.dropBackground",_E,d(4697,null)),s7i=J("panelSectionHeader.background",{dark:Oe.fromHex("#808080").transparent(.2),light:Oe.fromHex("#808080").transparent(.2),hcDark:null,hcLight:null},d(4698,null)),a7i=J("panelSectionHeader.foreground",null,d(4700,null)),l7i=J("panelSectionHeader.border",gi,d(4699,null)),CEt=J("panelSection.border",cb,d(4696,null)),c7i=J("panelStickyScroll.background",jS,d(4701,null)),d7i=J("panelStickyScroll.border",null,d(4702,null)),u7i=J("panelStickyScroll.shadow",PU,d(4703,null)),tYs=J("browser.border",h8e,d(4651,null)),iYs=J("profileBadge.background",{dark:"#4D4D4D",light:"#C4C4C4",hcDark:Oe.white,hcLight:Oe.black},d(4707,null)),oYs=J("profileBadge.foreground",{dark:Oe.white,light:"#333333",hcDark:Oe.black,hcLight:Oe.white},d(4708,null)),p7i=J("statusBarItem.remoteBackground",kj,d(4740,null)),qUo=J("statusBarItem.remoteForeground",Ej,d(4741,null)),nYs=J("statusBarItem.remoteHoverForeground",f8e,d(4752,null)),rYs=J("statusBarItem.remoteHoverBackground",{dark:JW,light:JW,hcDark:JW,hcLight:null},d(4751,null)),sYs=J("statusBarItem.offlineBackground","#6c1717",d(4738,null)),aYs=J("statusBarItem.offlineForeground",qUo,d(4739,null)),lYs=J("statusBarItem.offlineHoverForeground",f8e,d(4746,null)),cYs=J("statusBarItem.offlineHoverBackground",{dark:JW,light:JW,hcDark:JW,hcLight:null},d(4745,null)),m7i=J("extensionBadge.remoteBackground",kj,d(4670,null)),h7i=J("extensionBadge.remoteForeground",Ej,d(4671,null)),op=J("sideBar.background",{dark:"#252526",light:"#F3F3F3",hcDark:"#000000",hcLight:"#FFFFFF"},d(4710,null)),nP=J("sideBar.foreground",null,d(4713,null)),hEt=J("sideBar.border",{dark:null,light:null,hcDark:gi,hcLight:gi},d(4711,null)),dYs=J("sideBarTitle.background",op,d(4720,null)),g7i=J("sideBarTitle.foreground",nP,d(4722,null)),Oxe=J("sideBarTitle.border",{dark:null,light:null,hcDark:hEt,hcLight:hEt},d(4721,null)),Tj=J("sideBar.dropBackground",_E,d(4712,null)),f7i=J("sideBarSectionHeader.background",{dark:Oe.fromHex("#808080").transparent(.2),light:Oe.fromHex("#808080").transparent(.2),hcDark:null,hcLight:null},d(4714,null)),v7i=J("sideBarSectionHeader.foreground",nP,d(4716,null)),tdi=J("sideBarSectionHeader.border",gi,d(4715,null)),uYs=J("sideBarActivityBarTop.border",tdi,d(4709,null)),b7i=J("sideBarStickyScroll.background",op,d(4717,null)),S7i=J("sideBarStickyScroll.border",null,d(4718,null)),I7i=J("sideBarStickyScroll.shadow",PU,d(4719,null)),cz=J("titleBar.activeForeground",{dark:"#CCCCCC",light:"#333333",hcDark:"#FFFFFF",hcLight:"#292929"},d(4785,null)),y7i=J("titleBar.inactiveForeground",{dark:ei(cz,.6),light:ei(cz,.6),hcDark:null,hcLight:"#292929"},d(4788,null)),Mxe=J("titleBar.activeBackground",{dark:"#3C3C3C",light:"#DDDDDD",hcDark:"#000000",hcLight:"#FFFFFF"},d(4784,null)),pYs=J("titleBar.inactiveBackground",{dark:ei(Mxe,.6),light:ei(Mxe,.6),hcDark:null,hcLight:null},d(4787,null)),w7i=J("titleBar.border",{dark:null,light:null,hcDark:gi,hcLight:gi},d(4786,null)),jUo=J("menubar.selectionForeground",cz,d(4675,null)),T9i=J("menubar.selectionBackground",{dark:Mse,light:Mse,hcDark:null,hcLight:null},d(4673,null)),mYs=J("menubar.selectionBorder",{dark:null,light:null,hcDark:qs,hcLight:qs},d(4674,null)),hYs=J("commandCenter.foreground",cz,d(4657,null),!1),gYs=J("commandCenter.activeForeground",jUo,d(4654,null),!1),fYs=J("commandCenter.inactiveForeground",y7i,d(4659,null),!1),C7i=J("commandCenter.background",{dark:Oe.white.transparent(.05),hcDark:null,light:Oe.black.transparent(.05),hcLight:null},d(4655,null),!1),vYs=J("commandCenter.activeBackground",{dark:Oe.white.transparent(.08),hcDark:T9i,light:Oe.black.transparent(.08),hcLight:T9i},d(4652,null),!1),bYs=J("commandCenter.border",{dark:ei(cz,.2),hcDark:gi,light:ei(cz,.2),hcLight:gi},d(4656,null),!1),SYs=J("commandCenter.activeBorder",{dark:ei(cz,.3),hcDark:cz,light:ei(cz,.3),hcLight:cz},d(4653,null),!1),IYs=J("commandCenter.inactiveBorder",ei(y7i,.25),d(4658,null),!1),x7i=J("notificationCenter.border",{dark:jT,light:jT,hcDark:gi,hcLight:gi},d(4676,null)),k7i=J("notificationToast.border",{dark:jT,light:jT,hcDark:gi,hcLight:gi},d(4686,null)),yYs=J("notifications.foreground",dL,d(4682,null)),gY=J("notifications.background",gm,d(4679,null)),wYs=J("notificationLink.foreground",WI,d(4684,null)),E7i=J("notificationCenterHeader.foreground",null,d(4678,null)),idi=J("notificationCenterHeader.background",{dark:RS(gY,.3),light:Sp(gY,.05),hcDark:gY,hcLight:gY},d(4677,null)),CYs=J("notifications.border",idi,d(4680,null)),xYs=J("notificationsErrorIcon.foreground",av,d(4681,null)),kYs=J("notificationsWarningIcon.foreground",Bh,d(4685,null)),EYs=J("notificationsInfoIcon.foreground",fm,d(4683,null)),xEt=J("window.activeBorder",{dark:null,light:null,hcDark:gi,hcLight:gi},d(4791,null)),kEt=J("window.inactiveBorder",{dark:null,light:null,hcDark:gi,hcLight:gi},d(4792,null));var EEt=ae("IExtensionStatusBarItemService");var b8e=class{constructor(i){this._statusbarService=i;this._entries=new Map;this._onDidChange=new E;this.onDidChange=this._onDidChange.event}dispose(){this._entries.forEach(i=>i.accessor.dispose()),this._entries.clear(),this._onDidChange.dispose()}setOrUpdateEntry(i,e,t,o,n,r,s,l,c,u,p,h){let g,f;if(h)g=h.label,f=h.role;else if(g=m1(n),typeof r=="string"||Mr(r)){let w=typeof r=="string"?r:r.value;g+=`, ${w}`}let v;switch(c?.id){case edi:case e7i:v=c.id===edi?"error":"warning",l=void 0,c=void 0}let b={name:o,text:n,tooltip:r,command:s,color:l,backgroundColor:c,ariaLabel:g,role:f,kind:v,extensionId:t};typeof p>"u"&&(p=0);let S=u?0:1,y=this._entries.get(i);if(y&&(S=y.alignment,p=y.priority),y)return y.accessor.update(b),y.entry=b,1;{let w;typeof t=="string"?w={primary:p,secondary:Ir(t)}:w=p;let k=this._statusbarService.addEntry(b,e,S,w);return this._entries.set(i,{accessor:k,entry:b,alignment:S,priority:p,disposable:Z(()=>{k.dispose(),this._entries.delete(i),this._onDidChange.fire({removed:i})})}),this._onDidChange.fire({added:[i,{entry:b,alignment:S,priority:p}]}),0}}unsetEntry(i){this._entries.get(i)?.disposable.dispose(),this._entries.delete(i)}getEntries(){return this._entries.entries()}};b8e=I([m(0,Tr)],b8e);we(EEt,b8e,1);function YUo(a){let i=a;return typeof i.id=="string"&&i.id.length>0&&typeof i.name=="string"&&typeof i.text=="string"&&(i.alignment==="left"||i.alignment==="right")&&(i.command===void 0||typeof i.command=="string")&&(i.tooltip===void 0||typeof i.tooltip=="string")&&(i.priority===void 0||typeof i.priority=="number")&&(i.accessibilityInformation===void 0||uKi(i.accessibilityInformation))}var T7i={type:"object",required:["id","text","alignment","name"],properties:{id:{type:"string",markdownDescription:d(3075,null)},name:{type:"string",description:d(3077,null)},text:{type:"string",description:d(3079,null)},tooltip:{type:"string",description:d(3080,null)},command:{type:"string",description:d(3074,null)},alignment:{type:"string",enum:["left","right"],description:d(3073,null)},priority:{type:"number",description:d(3078,null)},accessibilityInformation:{type:"object",description:d(3070,null),required:["label"],properties:{role:{type:"string",description:d(3072,null)},label:{type:"string",description:d(3071,null)}}}}},XUo={description:d(3081,null),oneOf:[T7i,{type:"array",items:T7i}]},_7i=Tn.registerExtensionPoint({extensionPoint:"statusBarItems",jsonSchema:XUo}),Fxe=class{constructor(i){let e=new P;_7i.setHandler(t=>{e.clear();for(let o of t){if(!Ea(o.description,"contribStatusBarItems")){o.collector.error(`The ${_7i.name} is proposed API`);continue}let{value:n,collector:r}=o;for(let s of ht.wrap(n)){if(!YUo(s)){r.error(d(3076,null));continue}let l=C9i(o.description.identifier,s.id);i.setOrUpdateEntry(l,l,Ei.toKey(o.description.identifier),s.name??o.description.displayName??o.description.name,s.text,s.tooltip,s.command?{id:s.command,title:s.name}:void 0,void 0,void 0,s.alignment==="left",s.priority,s.accessibilityInformation)===0&&e.add(Z(()=>i.unsetEntry(l)))}}})}};Fxe=I([m(0,EEt)],Fxe);var uce=/^([^.]+\..+)[:=](.+)$/,Su=class{constructor(i,e,t){this._args=i;this.paths=e;this.productService=t}get appRoot(){return wc(gn.asFileUri("").fsPath)}get userHome(){return A.file(this.paths.homeDir)}get userDataPath(){return this.paths.userDataDir}get appSettingsHome(){return A.file(Ld(this.userDataPath,"User"))}get tmpDir(){return A.file(this.paths.tmpDir)}get cacheHome(){return A.file(this.userDataPath)}get stateResource(){return je(this.appSettingsHome,"globalStorage","storage.json")}get userRoamingDataHome(){return this.appSettingsHome.with({scheme:Y.vscodeUserData})}get userDataSyncHome(){return je(this.appSettingsHome,"sync")}get logsHome(){if(!this.args.logsPath){let i=Pmt(new Date).replace(/-|:|\.\d+Z$/g,"");this.args.logsPath=Ld(this.userDataPath,"logs",i)}return A.file(this.args.logsPath)}get sync(){return this.args.sync}get workspaceStorageHome(){return je(this.appSettingsHome,"workspaceStorage")}get localHistoryHome(){return je(this.appSettingsHome,"History")}get keyboardLayoutResource(){return je(this.userRoamingDataHome,"keyboardLayout.json")}get argvResource(){let i=fp.VSCODE_PORTABLE;return i?A.file(Ld(i,"argv.json")):je(this.userHome,this.productService.dataFolderName,"argv.json")}get isExtensionDevelopment(){return!!this.args.extensionDevelopmentPath}get untitledWorkspacesHome(){return A.file(Ld(this.userDataPath,"Workspaces"))}get builtinExtensionsPath(){let i=this.args["builtin-extensions-dir"];return i?iN(i):th(Ld(gn.asFileUri("").fsPath,"..","extensions"))}get extensionsDownloadLocation(){let i=this.args["extensions-download-dir"];return i?A.file(iN(i)):A.file(Ld(this.userDataPath,"CachedExtensionVSIXs"))}get extensionsPath(){let i=this.args["extensions-dir"];if(i)return iN(i);let e=fp.VSCODE_EXTENSIONS;if(e)return e;let t=fp.VSCODE_PORTABLE;return t?Ld(t,"extensions"):je(this.userHome,this.productService.dataFolderName,"extensions").fsPath}get extensionDevelopmentLocationURI(){let i=this.args.extensionDevelopmentPath;if(Array.isArray(i))return i.map(e=>/^[^:/?#]+?:\/\//.test(e)?A.parse(e):A.file(th(e)))}get extensionDevelopmentKind(){return this.args.extensionDevelopmentKind?.map(i=>i==="ui"||i==="workspace"||i==="web"?i:"workspace")}get extensionTestsLocationURI(){let i=this.args.extensionTestsPath;if(i)return/^[^:/?#]+?:\/\//.test(i)?A.parse(i):A.file(th(i))}get disableExtensions(){if(this.args["disable-extensions"])return!0;let i=this.args["disable-extension"];if(i){if(typeof i=="string")return[i];if(Array.isArray(i)&&i.length>0)return i}return!1}get debugExtensionHost(){return JUo(this.args,this.isBuilt)}get debugRenderer(){return!!this.args.debugRenderer}get isBuilt(){return!fp.VSCODE_DEV}get verbose(){return!!this.args.verbose}get logLevel(){return this.args.log?.find(i=>!uce.test(i))}get extensionLogLevel(){let i=[];for(let e of this.args.log||[]){let t=uce.exec(e);t?.[1]&&t[2]&&i.push([t[1],t[2]])}return i.length?i:void 0}get serviceMachineIdResource(){return je(A.file(this.userDataPath),"machineid")}get crashReporterId(){return this.args["crash-reporter-id"]}get crashReporterDirectory(){return this.args["crash-reporter-directory"]}get disableTelemetry(){return!!this.args["disable-telemetry"]}get disableExperiments(){return!!this.args["disable-experiments"]}get disableWorkspaceTrust(){return!!this.args["disable-workspace-trust"]}get useInMemorySecretStorage(){return!!this.args["use-inmemory-secretstorage"]}get policyFile(){if(this.args["__enable-file-policy"]){let i=fp.VSCODE_PORTABLE;return i?A.file(Ld(i,"policy.json")):je(this.userHome,this.productService.dataFolderName,"policy.json")}}get agentSessionsWorkspace(){return je(this.appSettingsHome,"agent-sessions.code-workspace")}get editSessionId(){return this.args.editSessionId}get exportPolicyData(){return this.args["export-policy-data"]}get continueOn(){return this.args.continueOn}set continueOn(i){this.args.continueOn=i}get args(){return this._args}};I([mi],Su.prototype,"appRoot",1),I([mi],Su.prototype,"userHome",1),I([mi],Su.prototype,"userDataPath",1),I([mi],Su.prototype,"appSettingsHome",1),I([mi],Su.prototype,"tmpDir",1),I([mi],Su.prototype,"cacheHome",1),I([mi],Su.prototype,"stateResource",1),I([mi],Su.prototype,"userRoamingDataHome",1),I([mi],Su.prototype,"userDataSyncHome",1),I([mi],Su.prototype,"sync",1),I([mi],Su.prototype,"workspaceStorageHome",1),I([mi],Su.prototype,"localHistoryHome",1),I([mi],Su.prototype,"keyboardLayoutResource",1),I([mi],Su.prototype,"argvResource",1),I([mi],Su.prototype,"isExtensionDevelopment",1),I([mi],Su.prototype,"untitledWorkspacesHome",1),I([mi],Su.prototype,"builtinExtensionsPath",1),I([mi],Su.prototype,"extensionsDownloadLocation",1),I([mi],Su.prototype,"extensionsPath",1),I([mi],Su.prototype,"extensionDevelopmentLocationURI",1),I([mi],Su.prototype,"extensionDevelopmentKind",1),I([mi],Su.prototype,"extensionTestsLocationURI",1),I([mi],Su.prototype,"debugExtensionHost",1),I([mi],Su.prototype,"logLevel",1),I([mi],Su.prototype,"extensionLogLevel",1),I([mi],Su.prototype,"serviceMachineIdResource",1),I([mi],Su.prototype,"disableTelemetry",1),I([mi],Su.prototype,"disableExperiments",1),I([mi],Su.prototype,"disableWorkspaceTrust",1),I([mi],Su.prototype,"useInMemorySecretStorage",1),I([mi],Su.prototype,"policyFile",1),I([mi],Su.prototype,"agentSessionsWorkspace",1);function JUo(a,i){return ZUo(a["inspect-extensions"],a["inspect-brk-extensions"],5870,i,a.debugId,a.extensionEnvironment)}function ZUo(a,i,e,t,o,n){let s=Number(i||a)||(t?null:e),l=s?!!i:!1,c;if(n)try{c=JSON.parse(n)}catch{}return{port:s,break:l,debugId:o,env:c}}var ru=Co,ac=class{constructor(i,e,t,o){this.workspaceId=i;this.logsHome=e;this.options=t;this.productService=o;this.extensionHostDebugEnvironment=void 0;if(t.workspaceProvider&&Array.isArray(t.workspaceProvider.payload))try{this.payload=new Map(t.workspaceProvider.payload)}catch(n){mt(n)}}get remoteAuthority(){return this.options.remoteAuthority}get expectsResolverExtension(){return!!this.options.remoteAuthority?.includes("+")&&!this.options.webSocketFactory}get isBuilt(){return!!this.productService.commit}get logLevel(){let i=this.payload?.get("logLevel");return i?i.split(",").find(e=>!uce.test(e)):this.options.developmentOptions?.logLevel!==void 0?$w(this.options.developmentOptions?.logLevel):void 0}get extensionLogLevel(){let i=this.payload?.get("logLevel");if(i){let e=[];for(let t of i.split(",")){let o=uce.exec(t);o?.[1]&&o[2]&&e.push([o[1],o[2]])}return e.length?e:void 0}return this.options.developmentOptions?.extensionLogLevel!==void 0?this.options.developmentOptions?.extensionLogLevel.map(([e,t])=>[e,$w(t)]):void 0}get profDurationMarkers(){let i=this.payload?.get("profDurationMarkers");if(i){let e=[];for(let t of i.split(","))e.push(t);return e.length===2?e:void 0}}get windowLogsPath(){return this.logsHome}get logFile(){return je(this.windowLogsPath,"window.log")}get userRoamingDataHome(){return A.file("/User").with({scheme:Y.vscodeUserData})}get argvResource(){return je(this.userRoamingDataHome,"argv.json")}get cacheHome(){return je(this.userRoamingDataHome,"caches")}get workspaceStorageHome(){return je(this.userRoamingDataHome,"workspaceStorage")}get localHistoryHome(){return je(this.userRoamingDataHome,"History")}get stateResource(){return je(this.userRoamingDataHome,"State","storage.json")}get userDataSyncHome(){return je(this.userRoamingDataHome,"sync",this.workspaceId)}get sync(){}get keyboardLayoutResource(){return je(this.userRoamingDataHome,"keyboardLayout.json")}get untitledWorkspacesHome(){return je(this.userRoamingDataHome,"Workspaces")}get serviceMachineIdResource(){return je(this.userRoamingDataHome,"machineid")}get extHostLogsPath(){return je(this.logsHome,"exthost")}get debugExtensionHost(){return this.extensionHostDebugEnvironment||(this.extensionHostDebugEnvironment=this.resolveExtensionHostDebugEnvironment()),this.extensionHostDebugEnvironment.params}get isExtensionDevelopment(){return this.extensionHostDebugEnvironment||(this.extensionHostDebugEnvironment=this.resolveExtensionHostDebugEnvironment()),this.extensionHostDebugEnvironment.isExtensionDevelopment}get extensionDevelopmentLocationURI(){return this.extensionHostDebugEnvironment||(this.extensionHostDebugEnvironment=this.resolveExtensionHostDebugEnvironment()),this.extensionHostDebugEnvironment.extensionDevelopmentLocationURI}get extensionDevelopmentLocationKind(){return this.extensionHostDebugEnvironment||(this.extensionHostDebugEnvironment=this.resolveExtensionHostDebugEnvironment()),this.extensionHostDebugEnvironment.extensionDevelopmentKind}get extensionTestsLocationURI(){return this.extensionHostDebugEnvironment||(this.extensionHostDebugEnvironment=this.resolveExtensionHostDebugEnvironment()),this.extensionHostDebugEnvironment.extensionTestsLocationURI}get extensionEnabledProposedApi(){return this.extensionHostDebugEnvironment||(this.extensionHostDebugEnvironment=this.resolveExtensionHostDebugEnvironment()),this.extensionHostDebugEnvironment.extensionEnabledProposedApi}get debugRenderer(){return this.extensionHostDebugEnvironment||(this.extensionHostDebugEnvironment=this.resolveExtensionHostDebugEnvironment()),this.extensionHostDebugEnvironment.debugRenderer}get enableSmokeTestDriver(){return this.options.developmentOptions?.enableSmokeTestDriver}get disableExtensions(){return this.payload?.get("disableExtensions")==="true"}get enableExtensions(){return this.options.enabledExtensions}get webviewExternalEndpoint(){let i=this.options.webviewEndpoint||this.productService.webviewContentExternalBaseUrlTemplate||"https://{{uuid}}.vscode-cdn.net/{{quality}}/{{commit}}/out/vs/workbench/contrib/webview/browser/pre/",e=this.payload?.get("webviewExternalEndpointCommit");return i.replace("{{commit}}",e??this.productService.commit??"ef65ac1ba57f57f2a3961bfe94aa20481caca4c6").replace("{{quality}}",(e?"insider":this.productService.quality)??"insider")}get extensionTelemetryLogResource(){return je(this.logsHome,"extensionTelemetry.log")}get disableTelemetry(){return!1}get disableExperiments(){return!1}get verbose(){return this.payload?.get("verbose")==="true"}get logExtensionHostCommunication(){return this.payload?.get("logExtensionHostCommunication")==="true"}get skipReleaseNotes(){return this.payload?.get("skipReleaseNotes")==="true"}get skipWelcome(){return this.payload?.get("skipWelcome")==="true"}get disableWorkspaceTrust(){return!this.options.enableWorkspaceTrust}get isSessionsWindow(){return!1}get profile(){return this.payload?.get("profile")}get editSessionId(){return this.options.editSessionId}resolveExtensionHostDebugEnvironment(){let i={params:{port:null,break:!1},debugRenderer:!1,isExtensionDevelopment:!1,extensionDevelopmentLocationURI:void 0,extensionDevelopmentKind:void 0};if(this.payload)for(let[t,o]of this.payload)switch(t){case"extensionDevelopmentPath":i.extensionDevelopmentLocationURI||(i.extensionDevelopmentLocationURI=[]),i.extensionDevelopmentLocationURI.push(A.parse(o)),i.isExtensionDevelopment=!0;break;case"extensionDevelopmentKind":i.extensionDevelopmentKind=[o];break;case"extensionTestsPath":i.extensionTestsLocationURI=A.parse(o);break;case"debugRenderer":i.debugRenderer=o==="true";break;case"debugId":i.params.debugId=o;break;case"inspect-brk-extensions":i.params.port=parseInt(o),i.params.break=!0;break;case"inspect-extensions":i.params.port=parseInt(o);break;case"extensionEnvironment":try{i.params.env=JSON.parse(o)}catch(n){mt(n)}break;case"enableProposedApi":i.extensionEnabledProposedApi=[];break}let e=this.options.developmentOptions;return e&&!i.isExtensionDevelopment&&(e.extensions?.length&&(i.extensionDevelopmentLocationURI=e.extensions.map(t=>A.revive(t)),i.isExtensionDevelopment=!0),e.extensionTestsPath&&(i.extensionTestsLocationURI=A.revive(e.extensionTestsPath))),i}get filesToOpenOrCreate(){if(this.payload){let i=this.payload.get("openFile");if(i){let e=A.parse(i);if(this.payload.has("gotoLineMode")){let t=w1i(e.path);return[{fileUri:e.with({path:t.path}),options:{selection:cn(t.line)?void 0:{startLineNumber:t.line,startColumn:t.column||1}}}]}return[{fileUri:e}]}}}get filesToDiff(){if(this.payload){let i=this.payload.get("diffFilePrimary"),e=this.payload.get("diffFileSecondary");if(i&&e)return[{fileUri:A.parse(e)},{fileUri:A.parse(i)}]}}get filesToMerge(){if(this.payload){let i=this.payload.get("mergeFile1"),e=this.payload.get("mergeFile2"),t=this.payload.get("mergeFileBase"),o=this.payload.get("mergeFileResult");if(i&&e&&t&&o)return[{fileUri:A.parse(i)},{fileUri:A.parse(e)},{fileUri:A.parse(t)},{fileUri:A.parse(o)}]}}};I([mi],ac.prototype,"remoteAuthority",1),I([mi],ac.prototype,"expectsResolverExtension",1),I([mi],ac.prototype,"isBuilt",1),I([mi],ac.prototype,"logLevel",1),I([mi],ac.prototype,"windowLogsPath",1),I([mi],ac.prototype,"logFile",1),I([mi],ac.prototype,"userRoamingDataHome",1),I([mi],ac.prototype,"argvResource",1),I([mi],ac.prototype,"cacheHome",1),I([mi],ac.prototype,"workspaceStorageHome",1),I([mi],ac.prototype,"localHistoryHome",1),I([mi],ac.prototype,"stateResource",1),I([mi],ac.prototype,"userDataSyncHome",1),I([mi],ac.prototype,"sync",1),I([mi],ac.prototype,"keyboardLayoutResource",1),I([mi],ac.prototype,"untitledWorkspacesHome",1),I([mi],ac.prototype,"serviceMachineIdResource",1),I([mi],ac.prototype,"extHostLogsPath",1),I([mi],ac.prototype,"debugExtensionHost",1),I([mi],ac.prototype,"isExtensionDevelopment",1),I([mi],ac.prototype,"extensionDevelopmentLocationURI",1),I([mi],ac.prototype,"extensionDevelopmentLocationKind",1),I([mi],ac.prototype,"extensionTestsLocationURI",1),I([mi],ac.prototype,"extensionEnabledProposedApi",1),I([mi],ac.prototype,"debugRenderer",1),I([mi],ac.prototype,"enableSmokeTestDriver",1),I([mi],ac.prototype,"disableExtensions",1),I([mi],ac.prototype,"enableExtensions",1),I([mi],ac.prototype,"webviewExternalEndpoint",1),I([mi],ac.prototype,"extensionTelemetryLogResource",1),I([mi],ac.prototype,"disableTelemetry",1),I([mi],ac.prototype,"disableExperiments",1),I([mi],ac.prototype,"verbose",1),I([mi],ac.prototype,"logExtensionHostCommunication",1),I([mi],ac.prototype,"skipReleaseNotes",1),I([mi],ac.prototype,"skipWelcome",1),I([mi],ac.prototype,"disableWorkspaceTrust",1),I([mi],ac.prototype,"isSessionsWindow",1),I([mi],ac.prototype,"profile",1),I([mi],ac.prototype,"editSessionId",1),I([mi],ac.prototype,"filesToOpenOrCreate",1),I([mi],ac.prototype,"filesToDiff",1),I([mi],ac.prototype,"filesToMerge",1);var Gp=De,L7i="[",R7i="]",S8e="*",M7i=/\[(.+?)\]/g;var D7i=!to.quality,Bd;(l=>(l.COLOR_THEME_DARK=D7i?"Experimental Dark":"Default Dark Modern",l.COLOR_THEME_LIGHT=D7i?"Experimental Light":"Default Light Modern",l.COLOR_THEME_HC_DARK="Default High Contrast",l.COLOR_THEME_HC_LIGHT="Default High Contrast Light",l.COLOR_THEME_DARK_OLD="Default Dark+",l.COLOR_THEME_LIGHT_OLD="Default Light+",l.FILE_ICON_THEME="vs-seti",l.PRODUCT_ICON_THEME="Default"))(Bd||={});var P7i={"actionBar.toggledBackground":"#383a49","activityBar.activeBorder":"#0078D4","activityBar.background":"#181818","activityBar.border":"#2B2B2B","activityBar.foreground":"#D7D7D7","activityBar.inactiveForeground":"#868686","activityBarBadge.background":"#0078D4","activityBarBadge.foreground":"#FFFFFF","badge.background":"#616161","badge.foreground":"#F8F8F8","button.background":"#0078D4","button.border":"#FFFFFF12","button.foreground":"#FFFFFF","button.hoverBackground":"#026EC1","button.secondaryBackground":"#313131","button.secondaryForeground":"#CCCCCC","button.secondaryHoverBackground":"#3C3C3C","chat.slashCommandBackground":"#26477866","chat.slashCommandForeground":"#85B6FF","chat.editedFileForeground":"#E2C08D","checkbox.background":"#313131","checkbox.border":"#3C3C3C","debugToolBar.background":"#181818",descriptionForeground:"#9D9D9D","dropdown.background":"#313131","dropdown.border":"#3C3C3C","dropdown.foreground":"#CCCCCC","dropdown.listBackground":"#1F1F1F","editor.background":"#1F1F1F","editor.findMatchBackground":"#9E6A03","editor.foreground":"#CCCCCC","editor.inactiveSelectionBackground":"#3A3D41","editor.selectionHighlightBackground":"#ADD6FF26","editorGroup.border":"#FFFFFF17","editorGroupHeader.tabsBackground":"#181818","editorGroupHeader.tabsBorder":"#2B2B2B","editorGutter.addedBackground":"#2EA043","editorGutter.deletedBackground":"#F85149","editorGutter.modifiedBackground":"#0078D4","editorIndentGuide.activeBackground1":"#707070","editorIndentGuide.background1":"#404040","editorLineNumber.activeForeground":"#CCCCCC","editorLineNumber.foreground":"#6E7681","editorOverviewRuler.border":"#010409","editorWidget.background":"#202020",errorForeground:"#F85149",focusBorder:"#0078D4",foreground:"#CCCCCC","icon.foreground":"#CCCCCC","input.background":"#313131","input.border":"#3C3C3C","input.foreground":"#CCCCCC","input.placeholderForeground":"#989898","inputOption.activeBackground":"#2489DB82","inputOption.activeBorder":"#2488DB","keybindingLabel.foreground":"#CCCCCC","list.activeSelectionIconForeground":"#FFF","list.dropBackground":"#383B3D","menu.background":"#1F1F1F","menu.border":"#454545","menu.foreground":"#CCCCCC","menu.selectionBackground":"#0078d4","menu.separatorBackground":"#454545","notificationCenterHeader.background":"#1F1F1F","notificationCenterHeader.foreground":"#CCCCCC","notifications.background":"#1F1F1F","notifications.border":"#2B2B2B","notifications.foreground":"#CCCCCC","panel.background":"#181818","panel.border":"#2B2B2B","panelInput.border":"#2B2B2B","panelTitle.activeBorder":"#0078D4","panelTitle.activeForeground":"#CCCCCC","panelTitle.inactiveForeground":"#9D9D9D","peekViewEditor.background":"#1F1F1F","peekViewEditor.matchHighlightBackground":"#BB800966","peekViewResult.background":"#1F1F1F","peekViewResult.matchHighlightBackground":"#BB800966","pickerGroup.border":"#3C3C3C","ports.iconRunningProcessForeground":"#369432","progressBar.background":"#0078D4","quickInput.background":"#222222","quickInput.foreground":"#CCCCCC","settings.dropdownBackground":"#313131","settings.dropdownBorder":"#3C3C3C","settings.headerForeground":"#FFFFFF","settings.modifiedItemIndicator":"#BB800966","sideBar.background":"#181818","sideBar.border":"#2B2B2B","sideBar.foreground":"#CCCCCC","sideBarSectionHeader.background":"#181818","sideBarSectionHeader.border":"#2B2B2B","sideBarSectionHeader.foreground":"#CCCCCC","sideBarTitle.foreground":"#CCCCCC","statusBar.background":"#181818","statusBar.border":"#2B2B2B","statusBar.debuggingBackground":"#0078D4","statusBar.debuggingForeground":"#FFFFFF","statusBar.focusBorder":"#0078D4","statusBar.foreground":"#CCCCCC","statusBar.noFolderBackground":"#1F1F1F","statusBarItem.focusBorder":"#0078D4","statusBarItem.prominentBackground":"#6E768166","statusBarItem.remoteBackground":"#0078D4","statusBarItem.remoteForeground":"#FFFFFF","tab.activeBackground":"#1F1F1F","tab.activeBorder":"#1F1F1F","tab.activeBorderTop":"#0078D4","tab.activeForeground":"#FFFFFF","tab.border":"#2B2B2B","tab.hoverBackground":"#1F1F1F","tab.inactiveBackground":"#181818","tab.inactiveForeground":"#9D9D9D","tab.lastPinnedBorder":"#ccc3","tab.selectedBackground":"#222222","tab.selectedBorderTop":"#6caddf","tab.selectedForeground":"#ffffffa0","tab.unfocusedActiveBorder":"#1F1F1F","tab.unfocusedActiveBorderTop":"#2B2B2B","tab.unfocusedHoverBackground":"#1F1F1F","terminal.foreground":"#CCCCCC","terminal.inactiveSelectionBackground":"#3A3D41","terminal.tab.activeBorder":"#0078D4","textBlockQuote.background":"#2B2B2B","textBlockQuote.border":"#616161","textCodeBlock.background":"#2B2B2B","textLink.activeForeground":"#4daafc","textLink.foreground":"#4daafc","textPreformat.background":"#3C3C3C","textPreformat.foreground":"#D0D0D0","textSeparator.foreground":"#21262D","titleBar.activeBackground":"#181818","titleBar.activeForeground":"#CCCCCC","titleBar.border":"#2B2B2B","titleBar.inactiveBackground":"#1F1F1F","titleBar.inactiveForeground":"#9D9D9D","welcomePage.progress.foreground":"#0078D4","welcomePage.tileBackground":"#2B2B2B","widget.border":"#313131"},A7i={"actionBar.toggledBackground":"#dddddd","activityBar.activeBorder":"#005FB8","activityBar.background":"#F8F8F8","activityBar.border":"#E5E5E5","activityBar.foreground":"#1F1F1F","activityBar.inactiveForeground":"#616161","activityBarBadge.background":"#005FB8","activityBarBadge.foreground":"#FFFFFF","badge.background":"#CCCCCC","badge.foreground":"#3B3B3B","button.background":"#005FB8","button.border":"#0000001a","button.foreground":"#FFFFFF","button.hoverBackground":"#0258A8","button.secondaryBackground":"#E5E5E5","button.secondaryForeground":"#3B3B3B","button.secondaryHoverBackground":"#CCCCCC","chat.slashCommandBackground":"#ADCEFF7A","chat.slashCommandForeground":"#26569E","chat.editedFileForeground":"#895503","checkbox.background":"#F8F8F8","checkbox.border":"#CECECE",descriptionForeground:"#3B3B3B","diffEditor.unchangedRegionBackground":"#f8f8f8","dropdown.background":"#FFFFFF","dropdown.border":"#CECECE","dropdown.foreground":"#3B3B3B","dropdown.listBackground":"#FFFFFF","editor.background":"#FFFFFF","editor.foreground":"#3B3B3B","editor.inactiveSelectionBackground":"#E5EBF1","editor.selectionHighlightBackground":"#ADD6FF80","editorGroup.border":"#E5E5E5","editorGroupHeader.tabsBackground":"#F8F8F8","editorGroupHeader.tabsBorder":"#E5E5E5","editorGutter.addedBackground":"#2EA043","editorGutter.deletedBackground":"#F85149","editorGutter.modifiedBackground":"#005FB8","editorIndentGuide.activeBackground1":"#939393","editorIndentGuide.background1":"#D3D3D3","editorLineNumber.activeForeground":"#171184","editorLineNumber.foreground":"#6E7681","editorOverviewRuler.border":"#E5E5E5","editorSuggestWidget.background":"#F8F8F8","editorWidget.background":"#F8F8F8",errorForeground:"#F85149",focusBorder:"#005FB8",foreground:"#3B3B3B","icon.foreground":"#3B3B3B","input.background":"#FFFFFF","input.border":"#CECECE","input.foreground":"#3B3B3B","input.placeholderForeground":"#767676","inputOption.activeBackground":"#BED6ED","inputOption.activeBorder":"#005FB8","inputOption.activeForeground":"#000000","keybindingLabel.foreground":"#3B3B3B","list.activeSelectionBackground":"#E8E8E8","list.activeSelectionForeground":"#000000","list.activeSelectionIconForeground":"#000000","list.focusAndSelectionOutline":"#005FB8","list.hoverBackground":"#F2F2F2","menu.border":"#CECECE","menu.selectionBackground":"#005FB8","menu.selectionForeground":"#ffffff","notebook.cellBorderColor":"#E5E5E5","notebook.selectedCellBackground":"#C8DDF150","notificationCenterHeader.background":"#FFFFFF","notificationCenterHeader.foreground":"#3B3B3B","notifications.background":"#FFFFFF","notifications.border":"#E5E5E5","notifications.foreground":"#3B3B3B","panel.background":"#F8F8F8","panel.border":"#E5E5E5","panelInput.border":"#E5E5E5","panelTitle.activeBorder":"#005FB8","panelTitle.activeForeground":"#3B3B3B","panelTitle.inactiveForeground":"#3B3B3B","peekViewEditor.matchHighlightBackground":"#BB800966","peekViewResult.background":"#FFFFFF","peekViewResult.matchHighlightBackground":"#BB800966","pickerGroup.border":"#E5E5E5","pickerGroup.foreground":"#8B949E","ports.iconRunningProcessForeground":"#369432","progressBar.background":"#005FB8","quickInput.background":"#F8F8F8","quickInput.foreground":"#3B3B3B","searchEditor.textInputBorder":"#CECECE","settings.dropdownBackground":"#FFFFFF","settings.dropdownBorder":"#CECECE","settings.headerForeground":"#1F1F1F","settings.modifiedItemIndicator":"#BB800966","settings.numberInputBorder":"#CECECE","settings.textInputBorder":"#CECECE","sideBar.background":"#F8F8F8","sideBar.border":"#E5E5E5","sideBar.foreground":"#3B3B3B","sideBarSectionHeader.background":"#F8F8F8","sideBarSectionHeader.border":"#E5E5E5","sideBarSectionHeader.foreground":"#3B3B3B","sideBarTitle.foreground":"#3B3B3B","statusBar.background":"#F8F8F8","statusBar.border":"#E5E5E5","statusBar.debuggingBackground":"#FD716C","statusBar.debuggingForeground":"#000000","statusBar.focusBorder":"#005FB8","statusBar.foreground":"#3B3B3B","statusBar.noFolderBackground":"#F8F8F8","statusBarItem.compactHoverBackground":"#CCCCCC","statusBarItem.errorBackground":"#C72E0F","statusBarItem.focusBorder":"#005FB8","statusBarItem.hoverBackground":"#B8B8B850","statusBarItem.prominentBackground":"#6E768166","statusBarItem.remoteBackground":"#005FB8","statusBarItem.remoteForeground":"#FFFFFF","tab.activeBackground":"#FFFFFF","tab.activeBorder":"#F8F8F8","tab.activeBorderTop":"#005FB8","tab.activeForeground":"#3B3B3B","tab.border":"#E5E5E5","tab.hoverBackground":"#FFFFFF","tab.inactiveBackground":"#F8F8F8","tab.inactiveForeground":"#868686","tab.lastPinnedBorder":"#D4D4D4","tab.selectedBackground":"#ffffffa5","tab.selectedBorderTop":"#68a3da","tab.selectedForeground":"#333333b3","tab.unfocusedActiveBorder":"#F8F8F8","tab.unfocusedActiveBorderTop":"#E5E5E5","tab.unfocusedHoverBackground":"#F8F8F8","terminal.foreground":"#3B3B3B","terminal.inactiveSelectionBackground":"#E5EBF1","terminal.tab.activeBorder":"#005FB8","terminalCursor.foreground":"#005FB8","textBlockQuote.background":"#F8F8F8","textBlockQuote.border":"#E5E5E5","textCodeBlock.background":"#F8F8F8","textLink.activeForeground":"#005FB8","textLink.foreground":"#005FB8","textPreformat.background":"#0000001F","textPreformat.foreground":"#3B3B3B","textSeparator.foreground":"#21262D","titleBar.activeBackground":"#F8F8F8","titleBar.activeForeground":"#1E1E1E","titleBar.border":"#E5E5E5","titleBar.inactiveBackground":"#F8F8F8","titleBar.inactiveForeground":"#8B949E","welcomePage.tileBackground":"#F3F3F3","widget.border":"#E5E5E5"},DE;(t=>{function a(o){return o&&{_extensionId:o.extensionId,_extensionIsBuiltin:o.extensionIsBuiltin,_extensionName:o.extensionName,_extensionPublisher:o.extensionPublisher}}t.toJSONObject=a;function i(o){if(o&&Ae(o._extensionId)&&Da(o._extensionIsBuiltin)&&Ae(o._extensionName)&&Ae(o._extensionPublisher))return{extensionId:o._extensionId,extensionIsBuiltin:o._extensionIsBuiltin,extensionName:o._extensionName,extensionPublisher:o._extensionPublisher}}t.fromJSONObject=i;function e(o,n,r=!1){return{extensionPublisher:o,extensionId:`${o}.${n}`,extensionName:n,extensionIsBuiltin:r}}t.fromName=e})(DE||={});var odi="workbench.contrib.css.cache",N7i=Tn.registerExtensionPoint({extensionPoint:"css",jsonSchema:{description:d(17264,null),type:"array",items:{type:"object",properties:{path:{description:d(17265,null),type:"string"}},required:["path"]},defaultSnippets:[{body:[{path:"${1:styles.css}"}]}]}}),ndi=class{constructor(i,e,t){this.fileService=i;this.environmentService=e;this.onUpdate=t;this.watchedLocations=new Map}watch(i){let e=i.toString();if(this.watchedLocations.has(e)||!this.environmentService.isExtensionDevelopment)return;let t=new P;t.add(this.fileService.watch(i)),t.add(this.fileService.onDidFilesChange(o=>{o.contains(i,0)&&this.onUpdate(i)})),this.watchedLocations.set(e,{uri:i,disposables:t})}unwatch(i){let e=i.toString(),t=this.watchedLocations.get(e);t&&(t.disposables.dispose(),this.watchedLocations.delete(e))}dispose(){for(let i of this.watchedLocations.values())i.disposables.dispose();this.watchedLocations.clear()}},Wxe=class{constructor(i,e,t,o){this.themeService=t;this.storageService=o;this.disposables=new P;this.stylesheetsByExtension=new Map;this.pendingExtensions=new Map;this.watcher=this.disposables.add(new ndi(i,e,n=>this.reloadStylesheet(n))),this.disposables.add(Z(()=>{for(let n of this.stylesheetsByExtension.values())for(let r of n)r.disposables.dispose();this.stylesheetsByExtension.clear()})),this.applyCachedCSS(),this.disposables.add(this.themeService.onDidColorThemeChange(()=>this.onThemeChange())),this.disposables.add(this.themeService.onDidFileIconThemeChange(()=>this.onThemeChange())),this.disposables.add(this.themeService.onDidProductIconThemeChange(()=>this.onThemeChange())),N7i.setHandler((n,r)=>{for(let s of r.removed){let l=s.description.identifier.value;this.pendingExtensions.delete(l),this.removeStylesheets(l),this.clearCacheForExtension(l)}for(let s of r.added){if(!Ea(s.description,"css")){s.collector.error(`The '${N7i.name}' contribution point is proposed API.`);continue}let l=s.value,c=s.collector;if(!l||!Array.isArray(l)){c.error(d(17266,null));continue}let u=s.description.identifier.value;this.pendingExtensions.set(u,s),this.isExtensionThemeActive(u)?this.activateExtensionCSS(s):this.stylesheetsByExtension.has(u)&&(this.removeStylesheets(u),this.clearCacheForExtension(u))}})}isExtensionThemeActive(i){let e=this.themeService.getColorTheme(),t=this.themeService.getFileIconTheme(),o=this.themeService.getProductIconTheme();return!!(e.extensionData&&Ei.equals(e.extensionData.extensionId,i))||!!(t.extensionData&&Ei.equals(t.extensionData.extensionId,i))||!!(o.extensionData&&Ei.equals(o.extensionData.extensionId,i))}onThemeChange(){for(let[i,e]of this.pendingExtensions)!this.stylesheetsByExtension.has(i)&&this.isExtensionThemeActive(i)&&this.activateExtensionCSS(e);for(let i of this.stylesheetsByExtension.keys())this.isExtensionThemeActive(i)||(this.removeStylesheets(i),this.clearCacheForExtension(i))}activateExtensionCSS(i){let e=i.description.identifier.value;if(this.stylesheetsByExtension.has(e))return;let t=i.description.extensionLocation,o=i.value,n=i.collector,r=[],s=[];for(let l of o){if(!l.path||typeof l.path!="string"){n.error(d(17267,null));continue}let c=je(t,l.path);if(!La(c,t)){n.warn(d(17268,null,c.path,t.path));continue}let u=new P,p=this.createCSSLinkElement(c,e,u);r.push({uri:c,element:p,disposables:u}),s.push(c.toString()),this.watcher.watch(c)}r.length>0&&(this.stylesheetsByExtension.set(e,r),this.cacheExtensionCSS(e,s))}removeStylesheets(i){let e=this.stylesheetsByExtension.get(i);if(e){for(let t of e)this.watcher.unwatch(t.uri),t.disposables.dispose();this.stylesheetsByExtension.delete(i)}}applyCachedCSS(){let i=this.getCachedCSS();if(!i)return;if(!this.isExtensionThemeActive(i.extensionId)){this.clearCacheForExtension(i.extensionId);return}let e=[];for(let t of i.cssLocations){let o=A.parse(t),n=new P,r=this.createCSSLinkElement(o,i.extensionId,n);e.push({uri:o,element:r,disposables:n}),this.watcher.watch(o)}e.length>0&&this.stylesheetsByExtension.set(i.extensionId,e)}getCachedCSS(){let i=this.storageService.get(odi,0);if(i)try{return JSON.parse(i)}catch{return}}cacheExtensionCSS(i,e){let t={extensionId:i,cssLocations:e};this.storageService.store(odi,JSON.stringify(t),0,1)}clearCacheForExtension(i){let e=this.getCachedCSS();e&&Ei.equals(e.extensionId,i)&&this.storageService.remove(odi,0)}createCSSLinkElement(i,e,t){let o=Xpt();return o.rel="stylesheet",o.type="text/css",o.className=`extension-contributed-css ${e}`,o.href=gn.uriToBrowserUri(i).toString(!0),t.add(Z(()=>o.remove())),o}reloadStylesheet(i){let e=i.toString();for(let t of this.stylesheetsByExtension.values())for(let o of t)if(o.uri.toString()===e){let n=gn.uriToBrowserUri(i);o.element.href=n.with({query:`v=${Date.now()}`}).toString(!0)}}dispose(){this.disposables.dispose()}};Wxe=I([m(0,be),m(1,ru),m(2,Gp),m(3,le)],Wxe);var I8e=class a{constructor(i){this._proxyIdentifierBrand=void 0;this.sid=i,this.nid=++a.count}static{this.count=0}},O7i=[];function Yi(a){let i=new I8e(a);return O7i[i.nid]=i,i}function y8e(a){return O7i[a].sid}var qh=class{constructor(i){this.value=i}};var F7i=class a{static{this._n=0}static mixin(i){return i._id=a._n++,i}};var Gi={MainThreadAuthentication:Yi("MainThreadAuthentication"),MainThreadBulkEdits:Yi("MainThreadBulkEdits"),MainThreadLanguageModels:Yi("MainThreadLanguageModels"),MainThreadEmbeddings:Yi("MainThreadEmbeddings"),MainThreadChatAgents2:Yi("MainThreadChatAgents2"),MainThreadCodeMapper:Yi("MainThreadCodeMapper"),MainThreadLanguageModelTools:Yi("MainThreadChatSkills"),MainThreadGitExtension:Yi("MainThreadGitExtension"),MainThreadClipboard:Yi("MainThreadClipboard"),MainThreadCommands:Yi("MainThreadCommands"),MainThreadComments:Yi("MainThreadComments"),MainThreadConfiguration:Yi("MainThreadConfiguration"),MainThreadConsole:Yi("MainThreadConsole"),MainThreadDebugService:Yi("MainThreadDebugService"),MainThreadDecorations:Yi("MainThreadDecorations"),MainThreadDiagnostics:Yi("MainThreadDiagnostics"),MainThreadDialogs:Yi("MainThreadDiaglogs"),MainThreadDocuments:Yi("MainThreadDocuments"),MainThreadDocumentContentProviders:Yi("MainThreadDocumentContentProviders"),MainThreadTextEditors:Yi("MainThreadTextEditors"),MainThreadEditorInsets:Yi("MainThreadEditorInsets"),MainThreadEditorTabs:Yi("MainThreadEditorTabs"),MainThreadErrors:Yi("MainThreadErrors"),MainThreadTreeViews:Yi("MainThreadTreeViews"),MainThreadDownloadService:Yi("MainThreadDownloadService"),MainThreadLanguageFeatures:Yi("MainThreadLanguageFeatures"),MainThreadLanguages:Yi("MainThreadLanguages"),MainThreadLogger:Yi("MainThreadLogger"),MainThreadMessageService:Yi("MainThreadMessageService"),MainThreadOutputService:Yi("MainThreadOutputService"),MainThreadProgress:Yi("MainThreadProgress"),MainThreadQuickDiff:Yi("MainThreadQuickDiff"),MainThreadQuickOpen:Yi("MainThreadQuickOpen"),MainThreadStatusBar:Yi("MainThreadStatusBar"),MainThreadSecretState:Yi("MainThreadSecretState"),MainThreadStorage:Yi("MainThreadStorage"),MainThreadSpeech:Yi("MainThreadSpeechProvider"),MainThreadTelemetry:Yi("MainThreadTelemetry"),MainThreadMeteredConnection:Yi("MainThreadMeteredConnection"),MainThreadTerminalService:Yi("MainThreadTerminalService"),MainThreadTerminalShellIntegration:Yi("MainThreadTerminalShellIntegration"),MainThreadWebviews:Yi("MainThreadWebviews"),MainThreadWebviewPanels:Yi("MainThreadWebviewPanels"),MainThreadWebviewViews:Yi("MainThreadWebviewViews"),MainThreadCustomEditors:Yi("MainThreadCustomEditors"),MainThreadUrls:Yi("MainThreadUrls"),MainThreadUriOpeners:Yi("MainThreadUriOpeners"),MainThreadProfileContentHandlers:Yi("MainThreadProfileContentHandlers"),MainThreadWorkspace:Yi("MainThreadWorkspace"),MainThreadFileSystem:Yi("MainThreadFileSystem"),MainThreadFileSystemEventService:Yi("MainThreadFileSystemEventService"),MainThreadExtensionService:Yi("MainThreadExtensionService"),MainThreadSCM:Yi("MainThreadSCM"),MainThreadSearch:Yi("MainThreadSearch"),MainThreadShare:Yi("MainThreadShare"),MainThreadTask:Yi("MainThreadTask"),MainThreadWindow:Yi("MainThreadWindow"),MainThreadPower:Yi("MainThreadPower"),MainThreadLabelService:Yi("MainThreadLabelService"),MainThreadNotebook:Yi("MainThreadNotebook"),MainThreadNotebookDocuments:Yi("MainThreadNotebookDocumentsShape"),MainThreadNotebookEditors:Yi("MainThreadNotebookEditorsShape"),MainThreadNotebookKernels:Yi("MainThreadNotebookKernels"),MainThreadNotebookRenderers:Yi("MainThreadNotebookRenderers"),MainThreadInteractive:Yi("MainThreadInteractive"),MainThreadTheming:Yi("MainThreadTheming"),MainThreadTunnelService:Yi("MainThreadTunnelService"),MainThreadManagedSockets:Yi("MainThreadManagedSockets"),MainThreadTimeline:Yi("MainThreadTimeline"),MainThreadTesting:Yi("MainThreadTesting"),MainThreadLocalization:Yi("MainThreadLocalizationShape"),MainThreadMcp:Yi("MainThreadMcpShape"),MainThreadAiRelatedInformation:Yi("MainThreadAiRelatedInformation"),MainThreadAiEmbeddingVector:Yi("MainThreadAiEmbeddingVector"),MainThreadChatStatus:Yi("MainThreadChatStatus"),MainThreadAiSettingsSearch:Yi("MainThreadAiSettingsSearch"),MainThreadDataChannels:Yi("MainThreadDataChannels"),MainThreadChatSessions:Yi("MainThreadChatSessions"),MainThreadChatOutputRenderer:Yi("MainThreadChatOutputRenderer"),MainThreadChatContext:Yi("MainThreadChatContext"),MainThreadChatDebug:Yi("MainThreadChatDebug")},Zi={ExtHostCodeMapper:Yi("ExtHostCodeMapper"),ExtHostCommands:Yi("ExtHostCommands"),ExtHostConfiguration:Yi("ExtHostConfiguration"),ExtHostDiagnostics:Yi("ExtHostDiagnostics"),ExtHostDebugService:Yi("ExtHostDebugService"),ExtHostDecorations:Yi("ExtHostDecorations"),ExtHostDocumentsAndEditors:Yi("ExtHostDocumentsAndEditors"),ExtHostDocuments:Yi("ExtHostDocuments"),ExtHostDocumentContentProviders:Yi("ExtHostDocumentContentProviders"),ExtHostDocumentSaveParticipant:Yi("ExtHostDocumentSaveParticipant"),ExtHostEditors:Yi("ExtHostEditors"),ExtHostTreeViews:Yi("ExtHostTreeViews"),ExtHostFileSystem:Yi("ExtHostFileSystem"),ExtHostFileSystemInfo:Yi("ExtHostFileSystemInfo"),ExtHostFileSystemEventService:Yi("ExtHostFileSystemEventService"),ExtHostLanguages:Yi("ExtHostLanguages"),ExtHostLanguageFeatures:Yi("ExtHostLanguageFeatures"),ExtHostQuickOpen:Yi("ExtHostQuickOpen"),ExtHostQuickDiff:Yi("ExtHostQuickDiff"),ExtHostStatusBar:Yi("ExtHostStatusBar"),ExtHostShare:Yi("ExtHostShare"),ExtHostExtensionService:Yi("ExtHostExtensionService"),ExtHostLogLevelServiceShape:Yi("ExtHostLogLevelServiceShape"),ExtHostTerminalService:Yi("ExtHostTerminalService"),ExtHostTerminalShellIntegration:Yi("ExtHostTerminalShellIntegration"),ExtHostSCM:Yi("ExtHostSCM"),ExtHostSearch:Yi("ExtHostSearch"),ExtHostTask:Yi("ExtHostTask"),ExtHostWorkspace:Yi("ExtHostWorkspace"),ExtHostWindow:Yi("ExtHostWindow"),ExtHostPower:Yi("ExtHostPower"),ExtHostWebviews:Yi("ExtHostWebviews"),ExtHostWebviewPanels:Yi("ExtHostWebviewPanels"),ExtHostCustomEditors:Yi("ExtHostCustomEditors"),ExtHostWebviewViews:Yi("ExtHostWebviewViews"),ExtHostEditorInsets:Yi("ExtHostEditorInsets"),ExtHostEditorTabs:Yi("ExtHostEditorTabs"),ExtHostProgress:Yi("ExtHostProgress"),ExtHostComments:Yi("ExtHostComments"),ExtHostSecretState:Yi("ExtHostSecretState"),ExtHostStorage:Yi("ExtHostStorage"),ExtHostUrls:Yi("ExtHostUrls"),ExtHostUriOpeners:Yi("ExtHostUriOpeners"),ExtHostChatOutputRenderer:Yi("ExtHostChatOutputRenderer"),ExtHostProfileContentHandlers:Yi("ExtHostProfileContentHandlers"),ExtHostOutputService:Yi("ExtHostOutputService"),ExtHostLabelService:Yi("ExtHostLabelService"),ExtHostNotebook:Yi("ExtHostNotebook"),ExtHostNotebookDocuments:Yi("ExtHostNotebookDocuments"),ExtHostNotebookEditors:Yi("ExtHostNotebookEditors"),ExtHostNotebookKernels:Yi("ExtHostNotebookKernels"),ExtHostNotebookRenderers:Yi("ExtHostNotebookRenderers"),ExtHostNotebookDocumentSaveParticipant:Yi("ExtHostNotebookDocumentSaveParticipant"),ExtHostInteractive:Yi("ExtHostInteractive"),ExtHostChatAgents2:Yi("ExtHostChatAgents"),ExtHostLanguageModelTools:Yi("ExtHostChatSkills"),ExtHostChatProvider:Yi("ExtHostChatProvider"),ExtHostChatContext:Yi("ExtHostChatContext"),ExtHostChatDebug:Yi("ExtHostChatDebug"),ExtHostSpeech:Yi("ExtHostSpeech"),ExtHostEmbeddings:Yi("ExtHostEmbeddings"),ExtHostAiRelatedInformation:Yi("ExtHostAiRelatedInformation"),ExtHostAiEmbeddingVector:Yi("ExtHostAiEmbeddingVector"),ExtHostAiSettingsSearch:Yi("ExtHostAiSettingsSearch"),ExtHostTheming:Yi("ExtHostTheming"),ExtHostTunnelService:Yi("ExtHostTunnelService"),ExtHostManagedSockets:Yi("ExtHostManagedSockets"),ExtHostAuthentication:Yi("ExtHostAuthentication"),ExtHostTimeline:Yi("ExtHostTimeline"),ExtHostTesting:Yi("ExtHostTesting"),ExtHostTelemetry:Yi("ExtHostTelemetry"),ExtHostMeteredConnection:Yi("ExtHostMeteredConnection"),ExtHostLocalization:Yi("ExtHostLocalization"),ExtHostMcp:Yi("ExtHostMcp"),ExtHostDataChannels:Yi("ExtHostDataChannels"),ExtHostChatSessions:Yi("ExtHostChatSessions"),ExtHostGitExtension:Yi("ExtHostGitExtension")};function vo(a){return function(i){Bxe.INSTANCE.registerNamedCustomer(a,i)}}function QL(a){Bxe.INSTANCE.registerCustomer(a)}var TEt;(e=>{function a(){return Bxe.INSTANCE.getNamedCustomers()}e.getNamedCustomers=a;function i(){return Bxe.INSTANCE.getCustomers()}e.getCustomers=i})(TEt||={});var Bxe=class a{static{this.INSTANCE=new a}constructor(){this._namedCustomers=[],this._customers=[]}registerNamedCustomer(i,e){let t=[i,e];this._namedCustomers.push(t)}getNamedCustomers(){return this._namedCustomers}registerCustomer(i){this._customers.push(i)}getCustomers(){return this._customers}};function vY(a){return a.tags.find(i=>i.startsWith("lp-"))?.split("lp-")[1]}var _j=ae("languagePackService"),_Et=class extends C{constructor(e){super();this.extensionGalleryService=e}async getAvailableLanguages(){let e=new $e;setTimeout(()=>e.cancel(),1e3);let t;try{t=await this.extensionGalleryService.query({text:'category:"language packs"',pageSize:20},e.token)}catch{return[]}let n=t.firstPage.filter(r=>r.properties.localizedLanguages?.length&&r.tags.some(s=>s.startsWith("lp-"))).map(r=>{let s=r.properties.localizedLanguages?.[0],l=vY(r);return{...this.createQuickPickItem(l,s,r),extensionId:r.identifier.id,galleryExtension:r}});return n.push(this.createQuickPickItem("en","English")),n}createQuickPickItem(e,t,o){let n=t??e,r;if(n!==e&&(r=`(${e})`),e.toLowerCase()===Dr.toLowerCase()&&(r??="",r+=d(2109,null)),o?.installCount){r??="";let s=o.installCount,l;s>1e6?l=`${Math.floor(s/1e5)/10}M`:s>1e3?l=`${Math.floor(s/1e3)}K`:l=String(s),r+=` $(cloud-download) ${l}`}return{id:e,label:n,description:r}}};_Et=I([m(0,ta)],_Et);var DEt=class extends C{constructor(e,t,o){super();this.fileService=t;this.languagePackService=o}async $fetchBuiltInBundleUri(e,t){try{return await this.languagePackService.getBuiltInExtensionTranslationsUri(e,t)}catch{return}}async $fetchBundleContents(e){return(await this.fileService.readFile(A.revive(e))).value.toString()}};DEt=I([vo(Gi.MainThreadLocalization),m(1,be),m(2,_j)],DEt);var rn={EditorPane:"workbench.contributions.editors",EditorFactory:"workbench.contributions.editor.inputFactories"},Ys={id:"default",displayName:d(4628,null),providerDisplayName:d(4625,null)},W7i="workbench.editor.sidebysideEditor",SY="workbench.editors.textDiffEditor",LEt="workbench.editors.binaryResourceDiffEditor";function pce(a){let i=a;return!!i&&typeof i.getSelection=="function"&&!!i.onDidChangeSelection}function REt(a){let i=a;return!!i&&typeof i.getScrollPosition=="function"&&typeof i.setScrollPosition=="function"&&!!i.onDidChangeScroll}function Dj(a,i,e){for(let t of e.visibleEditorPanes)if(t.group.id===i&&a.matches(t.input))return t.getViewState()}function QS(a){if(Ta(a))return!1;let i=a;return A.isUri(i?.resource)}function db(a){if(Ta(a))return!1;let i=a;return i?.original!==void 0&&i.modified!==void 0}function bY(a){if(Ta(a))return!1;let i=a;return!i||i.resources&&!Array.isArray(i.resources)?!1:!!i.resources||!!i.multiDiffSource}function C_(a){if(Ta(a)||db(a))return!1;let i=a;return i?.primary!==void 0&&i.secondary!==void 0}function Hxe(a){if(Ta(a))return!1;let i=a;return i?i.resource===void 0||i.resource.scheme===Y.untitled||i.forceUntitled===!0:!1}function dC(a){if(Ta(a))return!1;let i=a;return A.isUri(i?.base?.resource)&&A.isUri(i?.input1?.resource)&&A.isUri(i?.input2?.resource)&&A.isUri(i?.result?.resource)}var rdi=class{constructor(){this.mapIdToSaveSource=new Map}registerSource(i,e){let t=this.mapIdToSaveSource.get(i);return t||(t={source:i,label:e},this.mapIdToSaveSource.set(i,t)),t.source}getSourceLabel(i){return this.mapIdToSaveSource.get(i)?.label??i}},ph=new rdi;var w8e=class extends C{};function Ta(a){return a instanceof w8e}function e1o(a){let i=a;return A.isUri(i?.preferredResource)}function ldi(a){let i=a;return Ta(i?.primary)&&Ta(i?.secondary)}function Lj(a){let i=a;return Ta(i?.modified)&&Ta(i?.original)}function Uxe(a,i,e,t,o){return Aj(t,[pi({id:"workbench.action.openLargeFile",label:d(4627,null),run:()=>{let n={...e,limits:{size:Number.MAX_VALUE}};a.openEditor(i,n)}}),pi({id:"workbench.action.configureEditorLargeFileConfirmation",label:d(4626,null),run:()=>o.openUserSettings({query:"workbench.editorLargeFileConfirmation"})})],{forceMessage:!0,forceSeverity:gt.Warning})}function tV(a){return Ta(a?.editor)}function Rj(a){let i=a;return tV(a)&&i?.group!==void 0}function C8e(a){let i=a;return typeof i?.groupId=="number"&&Ta(i.editor)}function mce(a){return typeof a?.groupId=="number"}var sdi=class{getOriginalUri(i,e){if(!i)return;if(dC(i))return no.getOriginalUri(i.result,e);if(e?.supportSideBySide){let{primary:o,secondary:n}=this.getSideEditors(i);if(o&&n){if(e?.supportSideBySide===3)return{primary:this.getOriginalUri(o,{filterByScheme:e.filterByScheme}),secondary:this.getOriginalUri(n,{filterByScheme:e.filterByScheme})};if(e?.supportSideBySide===4)return this.getOriginalUri(o,{filterByScheme:e.filterByScheme})??this.getOriginalUri(n,{filterByScheme:e.filterByScheme});i=e.supportSideBySide===1?o:n}}if(db(i)||bY(i)||C_(i)||dC(i))return;let t=e1o(i)?i.preferredResource:i.resource;return!t||!e?.filterByScheme?t:this.filterUri(t,e.filterByScheme)}getSideEditors(i){return ldi(i)||C_(i)?{primary:i.primary,secondary:i.secondary}:Lj(i)||db(i)?{primary:i.modified,secondary:i.original}:{primary:void 0,secondary:void 0}}getCanonicalUri(i,e){if(!i)return;if(dC(i))return no.getCanonicalUri(i.result,e);if(e?.supportSideBySide){let{primary:o,secondary:n}=this.getSideEditors(i);if(o&&n){if(e?.supportSideBySide===3)return{primary:this.getCanonicalUri(o,{filterByScheme:e.filterByScheme}),secondary:this.getCanonicalUri(n,{filterByScheme:e.filterByScheme})};if(e?.supportSideBySide===4)return this.getCanonicalUri(o,{filterByScheme:e.filterByScheme})??this.getCanonicalUri(n,{filterByScheme:e.filterByScheme});i=e.supportSideBySide===1?o:n}}if(db(i)||bY(i)||C_(i)||dC(i))return;let t=i.resource;return!t||!e?.filterByScheme?t:this.filterUri(t,e.filterByScheme)}filterUri(i,e){if(Array.isArray(e)){if(e.some(t=>i.scheme===t))return i}else if(e===i.scheme)return i}};function zxe(a,i,e,t){if(!a.isSticky(i))return!1;switch(t.preventPinnedEditorClose){case"keyboardAndMouse":return e===2||e===1;case"mouse":return e===2;case"keyboard":return e===1}return!1}var no=new sdi;var adi=class{constructor(){this.editorSerializerConstructors=new Map;this.editorSerializerInstances=new Map}start(i){let e=this.instantiationService=i.get(F);for(let[t,o]of this.editorSerializerConstructors)this.createEditorSerializer(t,o,e);this.editorSerializerConstructors.clear()}createEditorSerializer(i,e,t){let o=t.createInstance(e);this.editorSerializerInstances.set(i,o)}registerFileEditorFactory(i){if(this.fileEditorFactory)throw new Error("Can only register one file editor factory.");this.fileEditorFactory=i}getFileEditorFactory(){return Oi(this.fileEditorFactory)}registerEditorSerializer(i,e){if(this.editorSerializerConstructors.has(i)||this.editorSerializerInstances.has(i))throw new Error(`A editor serializer with type ID '${i}' was already registered.`);return this.instantiationService?this.createEditorSerializer(i,e,this.instantiationService):this.editorSerializerConstructors.set(i,e),Z(()=>{this.editorSerializerConstructors.delete(i),this.editorSerializerInstances.delete(i)})}getEditorSerializer(i){return this.editorSerializerInstances.get(typeof i=="string"?i:i.typeId)}};oe.add(rn.EditorFactory,new adi);async function V7i(a,i,e){return a?.length?await Promise.all(a.map(async t=>{let o=A.revive(t.fileUri);if(!o){e.info("Cannot resolve the path because it is not valid.",t);return}if(!await i.canHandleResource(o)){e.info("Cannot resolve the path because it cannot be handled",t);return}let r=t.exists,s=t.type;if(typeof r!="boolean"||typeof s!="number")try{s=(await i.stat(o)).isDirectory?2:0,r=!0}catch(c){e.error(c),r=!1}if(!r&&t.openOnlyIfExists){e.info("Cannot resolve the path because it does not exist",t);return}if(s===2){e.info("Cannot resolve the path because it is a directory",t);return}let l={...t.options,pinned:!0};return r?{resource:o,options:l}:{resource:o,options:l,forceUntitled:!0}})):[]}function Mj(a){let i=a;if(!i)return!1;let e=i;if(e.modified)return Mj(e.modified);let t=i;return!!(t.contributionsState&&t.viewState&&Array.isArray(t.cursorState))}function Pj(a){return A6(a)}function Aj(a,i,e){let t=dU(a,i);return t.forceMessage=e?.forceMessage,t.forceSeverity=e?.forceSeverity,t.allowDialog=e?.allowDialog,t}var un=ae("notebookService"),YL=class{constructor(i,e,t){this.viewType=i;this.serializer=e;this.extensionData=t}};var mh=ae("INotebookModelResolverService");var Us=class extends w8e{constructor(){super(...arguments);this._onDidChangeDirty=this._register(new E);this._onDidChangeLabel=this._register(new E);this._onDidChangeCapabilities=this._register(new E);this._onWillDispose=this._register(new E);this.onDidChangeDirty=this._onDidChangeDirty.event;this.onDidChangeLabel=this._onDidChangeLabel.event;this.onDidChangeCapabilities=this._onDidChangeCapabilities.event;this.onWillDispose=this._onWillDispose.event}get editorId(){}get capabilities(){return 2}hasCapability(e){return e===0?this.capabilities===0:(this.capabilities&e)!==0}isReadonly(){return this.hasCapability(2)}getName(){return`Editor ${this.typeId}`}getDescription(e){}getTitle(e){return this.getName()}getLabelExtraClasses(){return[]}getAriaLabel(){return this.getTitle(0)}getIcon(){}getTelemetryDescriptor(){return{typeId:this.typeId}}isDirty(){return!1}isModified(){return this.isDirty()}isSaving(){return!1}async resolve(){return null}async save(e,t){return this}async saveAs(e,t){return this}async revert(e,t){}async rename(e,t){}copy(){return this}canMove(e,t){return!0}canReopen(){return!0}matches(e){if(Ta(e))return this===e;let t=e.options?.override;return this.editorId!==t&&t!==void 0&&this.editorId!==void 0?!1:Xe(this.resource,no.getCanonicalUri(e))}prefersEditorPane(e){return e.at(0)}toUntyped(e){}isDisposed(){return this._store.isDisposed}dispose(){this.isDisposed()||this._onWillDispose.fire(),super.dispose()}};var YS=class extends C{constructor(e,t,o,n){super();this.getExpression=e;this.shouldUpdate=t;this.contextService=o;this.configurationService=n;this._onExpressionChange=this._register(new E);this.onExpressionChange=this._onExpressionChange.event;this.mapFolderToParsedExpression=new Map;this.mapFolderToConfiguredExpression=new Map;this.updateExpressions(!1),this.registerListeners()}static{this.NO_FOLDER=null}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>{this.shouldUpdate(e)&&this.updateExpressions(!0)})),this._register(this.contextService.onDidChangeWorkspaceFolders(()=>this.updateExpressions(!0)))}updateExpressions(e){let t=!1;for(let s of this.contextService.getWorkspace().folders){let l=s.uri.toString(),c=this.doGetExpression(s.uri),u=this.mapFolderToConfiguredExpression.get(l);c?(!u||!uo(u.expression,c.expression))&&(t=!0,this.mapFolderToParsedExpression.set(l,zm(c.expression)),this.mapFolderToConfiguredExpression.set(l,c)):u&&(t=!0,this.mapFolderToParsedExpression.delete(l),this.mapFolderToConfiguredExpression.delete(l))}let o=new Mn(this.contextService.getWorkspace().folders.map(s=>s.uri));for(let[s]of this.mapFolderToConfiguredExpression)s!==YS.NO_FOLDER&&(o.has(A.parse(s))||(this.mapFolderToParsedExpression.delete(s),this.mapFolderToConfiguredExpression.delete(s),t=!0));let n=this.doGetExpression(void 0),r=this.mapFolderToConfiguredExpression.get(YS.NO_FOLDER);n?(!r||!uo(r.expression,n.expression))&&(t=!0,this.mapFolderToParsedExpression.set(YS.NO_FOLDER,zm(n.expression)),this.mapFolderToConfiguredExpression.set(YS.NO_FOLDER,n)):r&&(t=!0,this.mapFolderToParsedExpression.delete(YS.NO_FOLDER),this.mapFolderToConfiguredExpression.delete(YS.NO_FOLDER)),e&&t&&this._onExpressionChange.fire()}doGetExpression(e){let t=this.getExpression(e);if(!t)return;let o=Object.keys(t);if(o.length===0)return;let n=!1,r=Object.create(null);for(let s of o){n||(n=Xl(s));let l=s,c=y1i(l,!0);if(c){let u=c.toLowerCase();c!==c.toLowerCase()&&(l=`${u}${l.substring(1)}`)}r[l]=t[s]}return{expression:r,hasAbsolutePath:n}}matches(e,t){if(this.mapFolderToParsedExpression.size===0)return!1;let o=this.contextService.getWorkspaceFolder(e),n,r;if(o&&this.mapFolderToParsedExpression.has(o.uri.toString())?(n=this.mapFolderToParsedExpression.get(o.uri.toString()),r=this.mapFolderToConfiguredExpression.get(o.uri.toString())):(n=this.mapFolderToParsedExpression.get(YS.NO_FOLDER),r=this.mapFolderToConfiguredExpression.get(YS.NO_FOLDER)),!n)return!1;let s;return o?s=Fc(o.uri,e):s=this.uriToPath(e),typeof s=="string"&&n(s,void 0,t)?!0:s!==this.uriToPath(e)&&r?.hasAbsolutePath?!!n(this.uriToPath(e),void 0,t):!1}uriToPath(e){return e.scheme===Y.file?e.fsPath:e.path}};YS=I([m(2,Pe),m(3,B)],YS);var x8e=new Q("autoSaveAfterShortDelayContext",!1,!0);var lr=ae("filesConfigurationService"),x_=class extends C{constructor(e,t,o,n,r,s,l,c){super();this.configurationService=t;this.contextService=o;this.environmentService=n;this.uriIdentityService=r;this.fileService=s;this.markerService=l;this.textResourceConfigurationService=c;this._onDidChangeAutoSaveConfiguration=this._register(new E);this.onDidChangeAutoSaveConfiguration=this._onDidChangeAutoSaveConfiguration.event;this._onDidChangeAutoSaveDisabled=this._register(new E);this.onDidChangeAutoSaveDisabled=this._onDidChangeAutoSaveDisabled.event;this._onDidChangeFilesAssociation=this._register(new E);this.onDidChangeFilesAssociation=this._onDidChangeFilesAssociation.event;this._onDidChangeReadonly=this._register(new E);this.onDidChangeReadonly=this._onDidChangeReadonly.event;this.autoSaveConfigurationCache=new il(1e3);this.autoSaveAfterShortDelayOverrides=new vt;this.autoSaveDisabledOverrides=new vt;this.readonlyIncludeMatcher=this._register(new v$(()=>this.createReadonlyMatcher(Jgt)));this.readonlyExcludeMatcher=this._register(new v$(()=>this.createReadonlyMatcher(Zgt)));this.sessionReadonlyOverrides=new vt(e=>this.uriIdentityService.extUri.getComparisonKey(e));this.autoSaveAfterShortDelayContext=x8e.bindTo(e);let u=t.getValue();this.currentGlobalAutoSaveConfiguration=this.computeAutoSaveConfiguration(void 0,u.files),this.currentFilesAssociationConfiguration=u?.files?.associations,this.currentHotExitConfiguration=u?.files?.hotExit||AS.ON_EXIT,this.onFilesConfigurationChange(u,!1),this.registerListeners()}static{this.DEFAULT_AUTO_SAVE_MODE=Gt?cv.AFTER_DELAY:cv.OFF}static{this.DEFAULT_AUTO_SAVE_DELAY=1e3}static{this.READONLY_MESSAGES={providerReadonly:{value:d(17045,null),isTrusted:!0},sessionReadonly:{value:d(17046,null,"workbench.action.files.setActiveEditorWriteableInSession"),isTrusted:!0},configuredReadonly:{value:d(17042,null,`workbench.action.openSettings?${encodeURIComponent('["files.readonly"]')}`,"workbench.action.files.toggleActiveEditorReadonlyInSession"),isTrusted:!0},fileLocked:{value:d(17043,null,"workbench.action.files.setActiveEditorWriteableInSession"),isTrusted:!0},fileReadonly:{value:d(17044,null),isTrusted:!0}}}createReadonlyMatcher(e){let t=this._register(new YS(o=>this.configurationService.getValue(e,{resource:o}),o=>o.affectsConfiguration(e),this.contextService,this.configurationService));return this._register(t.onExpressionChange(()=>this._onDidChangeReadonly.fire())),t}isReadonly(e,t){let o=this.fileService.getProvider(e.scheme);if(o&&P$i(o))return o.readOnlyMessage??x_.READONLY_MESSAGES.providerReadonly;let n=this.sessionReadonlyOverrides.get(e);return typeof n=="boolean"?n===!0?x_.READONLY_MESSAGES.sessionReadonly:!1:this.uriIdentityService.extUri.isEqualOrParent(e,this.environmentService.userRoamingDataHome)||this.uriIdentityService.extUri.isEqual(e,this.contextService.getWorkspace().configuration??void 0)?!1:this.readonlyIncludeMatcher.value.matches(e)?this.readonlyExcludeMatcher.value.matches(e)?!1:x_.READONLY_MESSAGES.configuredReadonly:this.configuredReadonlyFromPermissions&&t?.locked?x_.READONLY_MESSAGES.fileLocked:t?.readonly?x_.READONLY_MESSAGES.fileReadonly:!1}async updateReadonly(e,t){if(t==="toggle"){let o;try{o=await this.fileService.resolve(e,{resolveMetadata:!0})}catch{}t=!this.isReadonly(e,o)}t==="reset"?this.sessionReadonlyOverrides.delete(e):this.sessionReadonlyOverrides.set(e,t),this._onDidChangeReadonly.fire()}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration("files")&&this.onFilesConfigurationChange(this.configurationService.getValue(),!0)}))}onFilesConfigurationChange(e,t){this.currentGlobalAutoSaveConfiguration=this.computeAutoSaveConfiguration(void 0,e.files),this.autoSaveConfigurationCache.clear(),this.autoSaveAfterShortDelayContext.set(this.getAutoSaveMode(void 0).mode===1),t&&this._onDidChangeAutoSaveConfiguration.fire();let o=e?.files?.associations;uo(this.currentFilesAssociationConfiguration,o)||(this.currentFilesAssociationConfiguration=o,t&&this._onDidChangeFilesAssociation.fire());let n=e?.files?.hotExit;n===AS.OFF||n===AS.ON_EXIT_AND_WINDOW_CLOSE?this.currentHotExitConfiguration=n:this.currentHotExitConfiguration=AS.ON_EXIT;let r=!!e?.files?.readonlyFromPermissions;r!==!!this.configuredReadonlyFromPermissions&&(this.configuredReadonlyFromPermissions=r,t&&this._onDidChangeReadonly.fire())}getAutoSaveConfiguration(e){let t=this.toResource(e);if(t){let o=this.autoSaveConfigurationCache.get(t);return o||(o=this.computeAutoSaveConfiguration(t,this.textResourceConfigurationService.getValue(t,"files")),this.autoSaveConfigurationCache.set(t,o)),o}return this.currentGlobalAutoSaveConfiguration}computeAutoSaveConfiguration(e,t){let o,n,r,s,l,c;switch(t?.autoSave??x_.DEFAULT_AUTO_SAVE_MODE){case cv.AFTER_DELAY:{o="afterDelay",n=typeof t?.autoSaveDelay=="number"&&t.autoSaveDelay>=0?t.autoSaveDelay:x_.DEFAULT_AUTO_SAVE_DELAY,c=n<=x_.DEFAULT_AUTO_SAVE_DELAY;break}case cv.ON_FOCUS_CHANGE:o="onFocusChange";break;case cv.ON_WINDOW_CHANGE:o="onWindowChange";break}return t?.autoSaveWorkspaceFilesOnly===!0&&(r=!0,e&&!this.contextService.isInsideWorkspace(e)&&(l=!0,c=void 0)),t?.autoSaveWhenNoErrors===!0&&(s=!0,c=void 0),{autoSave:o,autoSaveDelay:n,autoSaveWorkspaceFilesOnly:r,autoSaveWhenNoErrors:s,isOutOfWorkspace:l,isShortAutoSaveDelay:c}}toResource(e){return e instanceof Us?no.getOriginalUri(e,{supportSideBySide:1}):e}hasShortAutoSaveDelay(e){let t=this.toResource(e);return t&&this.autoSaveAfterShortDelayOverrides.has(t)?!0:this.getAutoSaveConfiguration(t).isShortAutoSaveDelay?!t||!this.autoSaveDisabledOverrides.has(t):!1}getAutoSaveMode(e,t){let o=this.toResource(e);if(o&&this.autoSaveAfterShortDelayOverrides.has(o))return{mode:1};if(o&&this.autoSaveDisabledOverrides.has(o))return{mode:0,reason:4};let n=this.getAutoSaveConfiguration(o);if(typeof n.autoSave>"u")return{mode:0,reason:1};if(typeof t=="number"&&(n.autoSave==="afterDelay"&&t!==2||n.autoSave==="onFocusChange"&&t!==3&&t!==4||n.autoSave==="onWindowChange"&&t!==4))return{mode:0,reason:1};if(o){if(n.autoSaveWorkspaceFilesOnly&&n.isOutOfWorkspace)return{mode:0,reason:2};if(n.autoSaveWhenNoErrors&&this.markerService.read({resource:o,take:1,severities:8}).length>0)return{mode:0,reason:3}}switch(n.autoSave){case"afterDelay":return typeof n.autoSaveDelay=="number"&&n.autoSaveDelay<=x_.DEFAULT_AUTO_SAVE_DELAY?{mode:n.autoSaveWhenNoErrors?2:1}:{mode:2};case"onFocusChange":return{mode:3};case"onWindowChange":return{mode:4}}}async toggleAutoSave(){let e=this.configurationService.getValue("files.autoSave"),t;return[cv.AFTER_DELAY,cv.ON_FOCUS_CHANGE,cv.ON_WINDOW_CHANGE].some(o=>o===e)?t=cv.OFF:t=cv.AFTER_DELAY,this.configurationService.updateValue("files.autoSave",t)}enableAutoSaveAfterShortDelay(e){let t=this.toResource(e);if(!t)return C.None;let o=this.autoSaveAfterShortDelayOverrides.get(t)??0;return this.autoSaveAfterShortDelayOverrides.set(t,o+1),Z(()=>{let n=this.autoSaveAfterShortDelayOverrides.get(t)??0;n<=1?this.autoSaveAfterShortDelayOverrides.delete(t):this.autoSaveAfterShortDelayOverrides.set(t,n-1)})}disableAutoSave(e){let t=this.toResource(e);if(!t)return C.None;let o=this.autoSaveDisabledOverrides.get(t)??0;return this.autoSaveDisabledOverrides.set(t,o+1),o===0&&this._onDidChangeAutoSaveDisabled.fire(t),Z(()=>{let n=this.autoSaveDisabledOverrides.get(t)??0;n<=1?(this.autoSaveDisabledOverrides.delete(t),this._onDidChangeAutoSaveDisabled.fire(t)):this.autoSaveDisabledOverrides.set(t,n-1)})}get isHotExitEnabled(){return this.contextService.getWorkspace().transient?!1:this.currentHotExitConfiguration!==AS.OFF}get hotExitConfiguration(){return this.currentHotExitConfiguration}preventSaveConflicts(e,t){return this.configurationService.getValue("files.saveConflictResolution",{resource:e,overrideIdentifier:t})!=="overwriteFileOnDisk"}};x_=I([m(0,X),m(1,B),m(2,Pe),m(3,Co),m(4,dt),m(5,be),m(6,Ns),m(7,Nn)],x_);we(lr,x_,0);var sP=class extends C{constructor(e,t){super();this.configurationService=e;this.workspaceContextService=t;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this.patterns=[];this.enabled=!0;this.cache=new Hut(1e3);this._templateRegexValidation=/[a-zA-Z0-9]/;this._parsedTemplateExpression=/\$\{(dirname|filename|extname|extname\((?<extnameN>[-+]?\d+)\)|dirname\((?<dirnameN>[-+]?\d+)\))\}/g;this._filenameCaptureExpression=/(?<filename>^\.*[^.]*)/;this.storeEnablementState(),this.storeCustomPatterns(),this.registerListeners()}static{this.SETTING_ID_PATTERNS="workbench.editor.customLabels.patterns"}static{this.SETTING_ID_ENABLED="workbench.editor.customLabels.enabled"}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>{if(e.affectsConfiguration(sP.SETTING_ID_ENABLED)){let t=this.enabled;this.storeEnablementState(),t!==this.enabled&&this.patterns.length>0&&this._onDidChange.fire()}else e.affectsConfiguration(sP.SETTING_ID_PATTERNS)&&(this.cache.clear(),this.storeCustomPatterns(),this._onDidChange.fire())}))}storeEnablementState(){this.enabled=this.configurationService.getValue(sP.SETTING_ID_ENABLED)}storeCustomPatterns(){this.patterns=[];let e=this.configurationService.getValue(sP.SETTING_ID_PATTERNS);for(let t in e){let o=e[t];if(!this._templateRegexValidation.test(o))continue;let n=Xl(t),r=zm(t,{ignoreCase:!0});this.patterns.push({pattern:t,template:o,isAbsolutePath:n,parsedPattern:r})}this.patterns.sort((t,o)=>this.patternWeight(o.pattern)-this.patternWeight(t.pattern))}patternWeight(e){let t=0;for(let o of e.split("/"))o==="**"?t+=1:o==="*"?t+=10:o.includes("*")||o.includes("?")?t+=50:o!==""&&(t+=100);return t}getName(e){if(!this.enabled||this.patterns.length===0)return;let t=e.toString(),o=this.cache.get(t);if(o!==void 0)return o??void 0;let n=this.applyPatterns(e);return this.cache.set(t,n??null),n}applyPatterns(e){let t=this.workspaceContextService.getWorkspaceFolder(e),o;for(let n of this.patterns){let r;if(t&&!n.isAbsolutePath?(o||(o=Fc(ci(t.uri),e)??e.path),r=o):r=e.path,n.parsedPattern(r))return this.applyTemplate(n.template,e,r)}}applyTemplate(e,t,o){let n;return e.replace(this._parsedTemplateExpression,(r,s,...l)=>{n=n??c$(t.path);let{dirnameN:c="0",extnameN:u="0"}=l.pop();if(s==="filename"){let{filename:p}=this._filenameCaptureExpression.exec(n.base)?.groups??{};if(p)return p}else if(s==="extname"){let p=this.getExtnames(n.base);if(p)return p}else if(s.startsWith("extname")){let p=parseInt(u),h=this.getNthExtname(n.base,p);if(h)return h}else if(s.startsWith("dirname")){let p=parseInt(c),h=this.getNthDirname(wc(o),p);if(h)return h}return r})}removeLeadingDot(e){let t=e;for(;t.startsWith(".");)t=t.slice(1);return t}getNthDirname(e,t){e=e.startsWith("/")?e.slice(1):e;let o=e.split("/");return this.getNthFragment(o,t)}getExtnames(e){return this.removeLeadingDot(e).split(".").slice(1).join(".")}getNthExtname(e,t){let o=this.removeLeadingDot(e).split(".");return o.shift(),this.getNthFragment(o,t)}getNthFragment(e,t){let o=e.length,n;t<0?n=Math.abs(t)-1:n=o-t-1;let r=e[n];if(!(r===void 0||r===""))return r}};sP=I([m(0,B),m(1,Pe)],sP);var Sv=ae("ICustomEditorLabelService");we(Sv,sP,1);var IY=class extends Us{constructor(e,t,o,n,r,s,l){super();this.resource=e;this.labelService=o;this.fileService=n;this.filesConfigurationService=r;this.textResourceConfigurationService=s;this.customEditorLabelService=l;this._name=void 0;this._shortDescription=void 0;this._mediumDescription=void 0;this._longDescription=void 0;this._shortTitle=void 0;this._mediumTitle=void 0;this._longTitle=void 0;this._preferredResource=t||e,this.registerListeners()}get capabilities(){let e=32;return this.fileService.hasProvider(this.resource)?this.filesConfigurationService.isReadonly(this.resource)&&(e|=2):e|=4,e&2||(e|=128),e}get preferredResource(){return this._preferredResource}registerListeners(){this._register(this.labelService.onDidChangeFormatters(e=>this.onLabelEvent(e.scheme))),this._register(this.fileService.onDidChangeFileSystemProviderRegistrations(e=>this.onLabelEvent(e.scheme))),this._register(this.fileService.onDidChangeFileSystemProviderCapabilities(e=>this.onLabelEvent(e.scheme))),this._register(this.customEditorLabelService.onDidChange(()=>this.updateLabel())),this._register(this.filesConfigurationService.onDidChangeReadonly(()=>this._onDidChangeCapabilities.fire()))}onLabelEvent(e){e===this._preferredResource.scheme&&this.updateLabel()}updateLabel(){this._name=void 0,this._shortDescription=void 0,this._mediumDescription=void 0,this._longDescription=void 0,this._shortTitle=void 0,this._mediumTitle=void 0,this._longTitle=void 0,this._onDidChangeLabel.fire()}setPreferredResource(e){Xe(e,this._preferredResource)||(this._preferredResource=e,this.updateLabel())}getName(){return typeof this._name!="string"&&(this._name=this.customEditorLabelService.getName(this._preferredResource)??this.labelService.getUriBasenameLabel(this._preferredResource)),this._name}getDescription(e=1){switch(e){case 0:return this.shortDescription;case 2:return this.longDescription;case 1:default:return this.mediumDescription}}get shortDescription(){return typeof this._shortDescription!="string"&&(this._shortDescription=this.labelService.getUriBasenameLabel(ci(this._preferredResource))),this._shortDescription}get mediumDescription(){return typeof this._mediumDescription!="string"&&(this._mediumDescription=this.labelService.getUriLabel(ci(this._preferredResource),{relative:!0})),this._mediumDescription}get longDescription(){return typeof this._longDescription!="string"&&(this._longDescription=this.labelService.getUriLabel(ci(this._preferredResource))),this._longDescription}get shortTitle(){return typeof this._shortTitle!="string"&&(this._shortTitle=this.getName()),this._shortTitle}get mediumTitle(){return typeof this._mediumTitle!="string"&&(this._mediumTitle=this.labelService.getUriLabel(this._preferredResource,{relative:!0})),this._mediumTitle}get longTitle(){return typeof this._longTitle!="string"&&(this._longTitle=this.labelService.getUriLabel(this._preferredResource)),this._longTitle}getTitle(e){switch(e){case 0:return this.shortTitle;case 2:return this.longTitle;default:case 1:return this.mediumTitle}}isReadonly(){return this.filesConfigurationService.isReadonly(this.resource)}ensureLimits(e){if(e?.limits)return e.limits;let t=eft(this.resource),o,n=this.textResourceConfigurationService.inspect(this.resource,null,"workbench.editorLargeFileConfirmation");return e$e(n)&&(o=n.value*ll.MB),{size:o??t}}};IY=I([m(2,ot),m(3,be),m(4,lr),m(5,Nn),m(6,Sv)],IY);var Et=ae("editorGroupsService");function cdi(a){let i=a;return Ta(i?.editor)&&Ta(i?.replacement)}function hce(a){let i=a;return!!i&&typeof i.id=="number"&&Array.isArray(i.editors)}function pC(a){return a.getValue("workbench.editor.openSideBySideDirection")==="down"?1:3}var ee=ae("editorService"),Un=-1,vn=-2,hg=-3,ym=-4;function B7i(a){return typeof a=="number"||hce(a)}var Vt=Co;function gce(a){return a.scheme!==Y.file&&a.scheme!==Y.vscodeRemote}function XL(a){if(a.folders.length)return a.folders.every(i=>gce(i.uri))?a.folders[0].uri:void 0;if(a.configuration&&gce(a.configuration))return a.configuration}function MEt(a){return XL(a)?.scheme}function H7i(a){return XL(a)?.authority}function LO(a){return XL(a)!==void 0}var yo=ae("remoteAgentService"),RO=new class{constructor(){this.maxSampleCount=5;this.sampleDelay=2e3;this.initial=[];this.maxInitialCount=3;this.average=[];this.maxAverageCount=100;this.highLatencyMultiple=2;this.highLatencyMinThreshold=500;this.highLatencyMaxThreshold=1500;this.lastMeasurement=void 0}get latency(){return this.lastMeasurement}async measure(a){let i=1/0;for(let t=0;t<this.maxSampleCount;t++){let o=await a.getRoundTripTime();if(o===void 0)return;i=Math.min(i,o/2),await Pi(this.sampleDelay)}this.average.push(i),this.average.length>this.maxAverageCount&&this.average.shift();let e;return this.initial.length<this.maxInitialCount?this.initial.push(i):e=this.initial.reduce((t,o)=>t+o,0)/this.initial.length,this.lastMeasurement={initial:e,current:i,average:this.average.reduce((t,o)=>t+o,0)/this.average.length,high:typeof e>"u"?!1:i>this.highLatencyMaxThreshold||i>this.highLatencyMinThreshold&&i>e*this.highLatencyMultiple},this.lastMeasurement}};var wn=ae("pathService"),yY=class{constructor(i,e,t,o){this.localUserHome=i;this.remoteAgentService=e;this.environmentService=t;this.contextService=o;this.resolveOS=(async()=>(await this.remoteAgentService.getEnvironment())?.os||zo)(),this.resolveUserHome=(async()=>{let n=await this.remoteAgentService.getEnvironment();return this.maybeUnresolvedUserHome=n?.userHome??i})()}hasValidBasename(i,e,t){return typeof e=="string"||typeof e>"u"?this.resolveOS.then(o=>this.doHasValidBasename(i,o,e)):this.doHasValidBasename(i,e,t)}doHasValidBasename(i,e,t){return i.scheme===Y.file||i.scheme===Y.vscodeRemote?nU(t??Ye(i),e===1):!0}get defaultUriScheme(){return yY.findDefaultUriScheme(this.environmentService,this.contextService)}static findDefaultUriScheme(i,e){if(i.remoteAuthority)return Y.vscodeRemote;let t=MEt(e.getWorkspace());if(t)return t;let o=e.getWorkspace().folders[0];if(o)return o.uri.scheme;let n=e.getWorkspace().configuration;return n?n.scheme:Y.file}userHome(i){return i?.preferLocal?this.localUserHome:this.resolveUserHome}get resolvedUserHome(){return this.maybeUnresolvedUserHome}get path(){return this.resolveOS.then(i=>i===1?Ms:Lo)}async fileURI(i){let e="";if(await this.resolveOS===1&&(i=i.replace(/\\/g,"/")),i[0]==="/"&&i[1]==="/"){let o=i.indexOf("/",2);o===-1?(e=i.substring(2),i="/"):(e=i.substring(2,o),i=i.substring(o)||"/")}return A.from({scheme:Y.file,authority:e,path:i,query:"",fragment:""})}};yY=I([m(1,yo),m(2,Vt),m(3,Pe)],yY);var ha=class extends IY{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super(e,t,c,u,p,f,v);this.viewType=o;this.options=n;this._notebookService=r;this._notebookModelResolverService=s;this._fileDialogService=l;this.environmentService=b;this.pathService=S;this.editorModelReference=null;this._defaultDirtyState=!1;this._defaultDirtyState=!!n.startDirty,this._sideLoadedListener=r.onDidAddNotebookDocument(y=>{y.viewType===this.viewType&&y.uri.toString()===this.resource.toString()&&this.resolve().catch(mt)}),this._register(h.onWillStop(y=>{if(!y.auto&&!this.isDirty())return;let w=y.auto?d(12147,null,this.getName()):d(12148,null,this.getName());y.veto((async()=>{let k=g.findEditors(this);return y.auto?!0:!(k.length>0&&(await g.save(k[0])).success)})(),w)}))}static getOrCreate(e,t,o,n,r={}){let s=e.createInstance(ha,t,o,n,r);return o&&s.setPreferredResource(o),s}static{this.ID="workbench.input.notebook"}dispose(){this._sideLoadedListener.dispose(),this.editorModelReference?.dispose(),this.editorModelReference=null,super.dispose()}get typeId(){return ha.ID}get editorId(){return this.viewType}get capabilities(){let e=0;return this.resource.scheme===Y.untitled&&(e|=4),this.editorModelReference?this.editorModelReference.object.isReadonly()&&(e|=2):this.filesConfigurationService.isReadonly(this.resource)&&(e|=2),e&2||(e|=128),e}getDescription(e=1){if(!this.hasCapability(4)||this.editorModelReference?.object.hasAssociatedFilePath())return super.getDescription(e)}isReadonly(){return this.editorModelReference?this.editorModelReference.object.isReadonly():this.filesConfigurationService.isReadonly(this.resource)}isDirty(){return this.editorModelReference?this.editorModelReference.object.isDirty():this._defaultDirtyState}isSaving(){let e=this.editorModelReference?.object;return!e||!e.isDirty()||e.hasErrorState||this.hasCapability(4)?!1:this.filesConfigurationService.hasShortAutoSaveDelay(this)}async save(e,t){if(this.editorModelReference)return this.hasCapability(4)?this.saveAs(e,t):(await this.editorModelReference.object.save(t),this)}async saveAs(e,t){if(!this.editorModelReference)return;let o=this._notebookService.getContributedNotebookType(this.viewType);if(!o)return;let n=this.hasCapability(4)?await this._suggestName(o):this.editorModelReference.object.resource,r;if(this.editorModelReference.object.hasAssociatedFilePath())r=n;else if(r=await this._fileDialogService.pickFileToSave(n,t?.availableFileSystems),!r)return;if(!o.matches(r)){let s=o.selectors.map(l=>typeof l=="string"?l:eP(l)?`${l} (base ${l.base})`:l.exclude?`${l.include} (exclude: ${l.exclude})`:`${l.include}`).join(", ");throw new Error(`File name ${r} is not supported by ${o.providerDisplayName}.
Please make sure the file name matches following patterns:
${s}`)}return await this.editorModelReference.object.saveAs(r)}async _suggestName(e){let t=await this.ensureAbsolutePath(this.ensureProviderExtension(e)),o=this.environmentService.remoteAuthority;return Og(t,o,this.pathService.defaultUriScheme)}async ensureAbsolutePath(e){if(e.scheme!==Y.untitled||Xl(e.path))return e;let t=await this._fileDialogService.defaultFilePath();return A.joinPath(t,e.path)}ensureProviderExtension(e){let t=e.selectors[0],o=t&&typeof t=="string"?t:void 0;if(!o&&t){let r=t.include;typeof r=="string"&&(o=r)}let n=this.resource;if(o){let r=/^\*\.([A-Za-z_-]*)$/.exec(o);if(r&&r.length>1){let s=r[1];if(!n.path.endsWith(s))return n.with({path:n.path+"."+s})}}return n}async rename(e,t){if(this.editorModelReference)return{editor:{resource:t},options:{override:this.viewType}}}async revert(e,t){this.editorModelReference&&this.editorModelReference.object.isDirty()&&await this.editorModelReference.object.revert(t)}async resolve(e,t){if(!await this._notebookService.canResolve(this.viewType))return null;if(t?.mark("extensionActivated"),this._sideLoadedListener.dispose(),this.editorModelReference)this.editorModelReference.object.load({limits:this.ensureLimits(e)});else{let o=!!(this.capabilities&512),n=await this._notebookModelResolverService.resolve(this.resource,this.viewType,{limits:this.ensureLimits(e),scratchpad:o,viewType:this.editorId});if(this.editorModelReference)return n.dispose(),this.editorModelReference.object;if(this.editorModelReference=n,this.isDisposed())return this.editorModelReference.dispose(),this.editorModelReference=null,null;this._register(this.editorModelReference.object.onDidChangeDirty(()=>this._onDidChangeDirty.fire())),this._register(this.editorModelReference.object.onDidChangeReadonly(()=>this._onDidChangeCapabilities.fire())),this._register(this.editorModelReference.object.onDidRevertUntitled(()=>this.dispose())),this.editorModelReference.object.isDirty()&&this._onDidChangeDirty.fire()}if(this.options._backupId){let o=await this._notebookService.withNotebookDataProvider(this.editorModelReference.object.notebook.viewType);if(!(o instanceof YL))throw new Error("CANNOT open file notebook with this provider");let n=await o.serializer.dataToNotebook(Je.fromString(JSON.stringify({__webview_backup:this.options._backupId})));this.editorModelReference.object.notebook.applyEdits([{editType:1,index:0,count:this.editorModelReference.object.notebook.length,cells:n.cells}],!0,void 0,()=>{},void 0,!1),this.options._workingCopy&&(this.options._backupId=void 0,this.options._workingCopy=void 0,this.options.startDirty=void 0)}return this.editorModelReference.object}toUntyped(){return{resource:this.resource,options:{override:this.viewType}}}matches(e){return super.matches(e)?!0:e instanceof ha?this.viewType===e.viewType&&Xe(this.resource,e.resource):QS(e)&&e.resource.scheme===Zo.scheme?Xe(this.resource,Zo.parse(e.resource)?.notebook):!1}};ha=I([m(4,un),m(5,mh),m(6,dn),m(7,ot),m(8,be),m(9,lr),m(10,lt),m(11,ee),m(12,Nn),m(13,Sv),m(14,Vt),m(15,wn)],ha);function Nj(a){return!!a&&typeof a=="object"&&Array.isArray(a.editorInputs)&&a.editorInputs.every(i=>i instanceof ha)}function k8e(a){return!!a&&typeof a=="object"&&a.typeId===ha.ID}function ddi(a){return!a||typeof a!="object"?!1:typeof a.start=="number"&&typeof a.end=="number"}function fce(a){a.sort((e,t)=>e-t);let i=a.shift();return i===void 0?[]:a.reduce(function(e,t){return t<=e[0][1]?e[0][1]=t+1:e.unshift([t,t+1]),e},[[i,i+1]]).reverse().map(e=>({start:e[0],end:e[1]}))}function Lf(a){return a.reduce((e,t)=>{for(let o=t.start;o<t.end;o++)e.push(o);return e},[])}function MO(a){let i=a.sort((o,n)=>o.start-n.start),e=i[0];if(!e)return[];let t=i.reduce((o,n)=>{let r=o[o.length-1];return r.end>=n.start?r.end=Math.max(r.end,n.end):o.push(n),o},[e]);return t.length>1?t.filter(o=>!(o.start===o.end&&o.start===0)):t}function E8e(a,i){if(a=MO(a),i=MO(i),a.length!==i.length)return!1;for(let e=0;e<a.length;e++)if(a[e].start!==i[e].start||a[e].end!==i[e].end)return!1;return!0}function PEt(a,i){return i.start>=a.start&&i.end<=a.end}var Kxe="notebook.cell.expandCellInput",U7i="notebook.cell.execute",T8e="notebook.cell.detectLanguage",AEt="notebook.cell.changeLanguage",udi="notebook.cell.quitEdit",NEt="notebook.cell.expandCellOutput",pdi="jupyter-notebook",Gxe="ms-toolsai.jupyter",z7i=new Map([[pdi,Gxe]]),OEt=new Map;OEt.set(pdi,new Map);OEt.get(pdi)?.set("python",{extensionIds:["ms-python.python",Gxe],displayName:"Python + Jupyter"});function K7i(a){return!!a&&typeof a.handle=="number"}function qn(a){if(!a)return;if(a.getId()===qL)return a.getControl();if(a.getId()===lY)return a.getControl().inlineNotebookEditor;let i=a.input;if(i&&Nj(i))return a.getControl()?.notebookEditor}function wY(a,i){let e=Lf(i),t=[];return e.forEach(o=>{if(!a.cellAt(o))return;let r=a.getViewIndexByModelIndex(o);if(r<0)return;let s=r+1,l=a.getCellRangeFromViewRange(r,s);l&&t.push(l)}),MO(t)}function _8e(a,i){let e=[];return MO(i).forEach(t=>{e.push(...a.getCellsInRange(t))}),e}var Iv=class a extends s7{constructor(e,t,o=void 0,n){super(n);this.resource=e;this.cellEdit=t;this.notebookVersionId=o}static is(e){return e instanceof a?!0:A.isUri(e.resource)&&yi(e.cellEdit)}static lift(e){return e instanceof a?e:new a(e.resource,e.cellEdit,e.notebookVersionId,e.metadata)}},$xe=class{constructor(i,e,t,o,n,r,s){this._undoRedoGroup=i;this._progress=t;this._token=o;this._edits=n;this._editorService=r;this._notebookModelService=s;this._edits=this._edits.map(l=>{if(l.resource.scheme===Zo.scheme){let c=Zo.parse(l.resource)?.notebook;if(!c)throw new Error(`Invalid notebook URI: ${l.resource}`);return new Iv(c,l.cellEdit,l.notebookVersionId,l.metadata)}else return l})}async apply(){let i=[],e=Pg(this._edits,(t,o)=>Al(t.resource.toString(),o.resource.toString()));for(let t of e){if(this._token.isCancellationRequested)break;let[o]=t,n=await this._notebookModelService.resolve(o.resource);if(typeof o.notebookVersionId=="number"&&n.object.notebook.versionId!==o.notebookVersionId)throw n.dispose(),new Error(`Notebook '${o.resource}' has changed in the meantime`);let r=t.map(u=>u.cellEdit),s=!n.object.isReadonly(),l=qn(this._editorService.activeEditorPane),c=l?.textModel?.uri.toString()===n.object.notebook.uri.toString()?{kind:1,focus:l.getFocus(),selections:l.getSelections()}:void 0;n.object.notebook.applyEdits(r,!0,c,()=>{},this._undoRedoGroup,s),n.dispose(),this._progress.report(void 0),i.push(o.resource)}return i}};$xe=I([m(5,ee),m(6,mh)],$xe);var FEt=class{constructor(i,e,t,o){this._bulkEditService=e;this._logService=t;this._uriIdentService=o}dispose(){}$tryApplyWorkspaceEdit(i,e,t){let o=iV(i.value,this._uriIdentService);return this._bulkEditService.apply(o,{undoRedoGroupId:e,respectAutoSaveConfig:t}).then(n=>n.isApplied,n=>(this._logService.warn(`IGNORING workspace edit: ${n}`),!1))}};FEt=I([vo(Gi.MainThreadBulkEdits),m(1,ma),m(2,ne),m(3,dt)],FEt);function iV(a,i,e){if(!a||!a.edits)return a;let t=Xn(a);for(let o of t.edits){if(ja.is(o)&&(o.resource=i.asCanonicalUri(o.resource)),tu.is(o)){if(o.options){let n=o.options?.contents;if(n)if(n.type==="base64")o.options.contents=Promise.resolve(Sl(n.value));else if(e)o.options.contents=e(n.id);else throw new Error("Could not revive data transfer file")}o.newResource=o.newResource&&i.asCanonicalUri(o.newResource),o.oldResource=o.oldResource&&i.asCanonicalUri(o.oldResource)}if(Iv.is(o)){o.resource=i.asCanonicalUri(o.resource);let n=o.cellEdit;n.editType===1&&(o.cellEdit={...n,cells:n.cells.map(r=>({...r,outputs:r.outputs.map(s=>({...s,outputs:s.items.map(l=>({mime:l.mime,data:l.valueBytes}))}))}))})}}return a}async function k_(a,i){let e=i==="image/gif";return typeof a=="string"&&(a=mdi(a)),new Promise((t,o)=>{let n=new Blob([a],{type:i}),r=new Image,s=URL.createObjectURL(n);r.src=s,r.onload=()=>{URL.revokeObjectURL(s);let{width:l,height:c}=r;if((l<=768||c<=768)&&!e){t(a);return}if(l>2048||c>2048){let g=2048/Math.max(l,c);l=Math.round(l*g),c=Math.round(c*g)}let u=768/Math.min(l,c);l=Math.round(l*u),c=Math.round(c*u);let p=document.createElement("canvas");p.width=l,p.height=c;let h=p.getContext("2d");if(h){h.drawImage(r,0,0,l,c);let f=i&&["image/jpeg","image/jpg"].includes(i)?"image/jpeg":"image/png";p.toBlob(v=>{if(v){let b=new FileReader;b.onload=()=>{t(new Uint8Array(b.result))},b.onerror=S=>o(S),b.readAsArrayBuffer(v)}else o(new Error("Failed to create blob from canvas"))},f)}else o(new Error("Failed to get canvas context"))},r.onerror=l=>{URL.revokeObjectURL(s),o(l)}})}function mdi(a){let i=a.includes(",")?a.split(",")[1]:a;return t1o(i)?Sl(i).buffer:new TextEncoder().encode(a)}function t1o(a){return/^[A-Za-z0-9+/]*={0,2}$/.test(a)&&(()=>{try{return atob(a),!0}catch{return!1}})()}async function WEt(a,i,e,t){await a.exists(i)||await a.createFolder(i);let n=t.split("/")[1]||"png",r=`image-${Date.now()}.${n}`,s=je(i,r),l=Je.wrap(e);return await a.writeFile(s,l),s}async function VEt(a,i,e){if(!await a.exists(e))return;let o=10080*60*1e3,n=await a.resolve(e);n.children&&await Promise.all(n.children.map(async r=>{try{let s=i1o(r.name);s&&Date.now()-s>o&&await a.del(r.resource)}catch(s){i.error("Failed to clean up old images",s)}}))}function i1o(a){let i=a.match(/image-(\d+)\./);if(i)return parseInt(i[1],10)}var jxe=ae("languageModelIgnoredFilesService"),BEt=class{constructor(){this._providers=new Set}async fileIsIgnored(i,e){let t=this._providers.values().next().value;return t?t.isFileIgnored(i,e):!1}registerIgnoredFileProvider(i){return this._providers.add(i),Z(()=>{this._providers.delete(i)})}};var _a=ae("requestService"),gdi=class{constructor(i){this.original=i}toJSON(){if(!this.headers){let i=Object.create(null);for(let e in this.original)e.toLowerCase()==="authorization"||e.toLowerCase()==="proxy-authorization"?i[e]="*****":i[e]=this.original[e];this.headers=i}return this.headers}},HEt=class extends C{constructor(e){super();this.logService=e;this.counter=0}async logAndRequest(e,t){let o=`#${++this.counter}: ${e.url}`;this.logService.trace(`${o} - begin`,e.type,new gdi(e.headers??{}));try{let n=await t();return this.logService.trace(`${o} - end`,e.type,n.res.statusCode,n.res.headers),n}catch(n){throw this.logService.error(`${o} - error`,e.type,Cn(n)),n}}};function aP(a){return a.res.statusCode&&a.res.statusCode>=200&&a.res.statusCode<300||a.res.statusCode===1223}function UEt(a){return!!a.res.statusCode&&a.res.statusCode>=400&&a.res.statusCode<500}function q7i(a){return!!a.res.statusCode&&a.res.statusCode>=500&&a.res.statusCode<600}function zEt(a){return a.res.statusCode===204}async function E_(a){return zEt(a)?null:(await Kv(a.stream)).toString()}async function Kx(a){if(!aP(a))throw new Error("Server returned "+a.res.statusCode);return E_(a)}async function hh(a){if(!aP(a))throw new Error("Server returned "+a.res.statusCode);if(zEt(a))return null;let e=(await Kv(a.stream)).toString();try{return JSON.parse(e)}catch(t){throw t.message+=`:
`+e,t}}function fdi(a,i){j7i(a,i)}var vdi=["http.proxy","http.proxyStrictSSL","http.proxyKerberosServicePrincipal","http.noProxy","http.proxyAuthorization","http.proxySupport","http.systemCertificates","http.systemCertificatesNode","http.experimental.systemCertificatesV2","http.fetchAdditionalSupport","http.experimental.networkInterfaceCheckInterval"],o1o=!1,hdi=[],G7i,$7i;function j7i(a=!0,i=!0){if(G7i===a&&$7i===i)return;G7i=a,$7i=i;let e=oe.as(ii.Configuration),t=hdi;hdi=[{id:"http",order:15,title:d(2263,null),type:"object",scope:2,properties:{"http.useLocalProxyConfiguration":{type:"boolean",default:i,markdownDescription:d(2278,null),restricted:!0}}},{id:"http",order:15,title:d(2263,null),type:"object",scope:1,properties:{"http.electronFetch":{type:"boolean",default:!1,description:d(2261,null),restricted:!0}}},{id:"http",order:15,title:d(2263,null),type:"object",scope:a?1:2,properties:{"http.proxy":{type:"string",pattern:"^(https?|socks|socks4a?|socks5h?)://([^:]*(:[^@]*)?@)?([^:]+|\\[[:0-9a-fA-F]+\\])(:\\d+)?/?$|^$",markdownDescription:d(2266,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.proxyStrictSSL":{type:"boolean",default:!0,markdownDescription:d(2274,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.proxyKerberosServicePrincipal":{type:"string",markdownDescription:d(2268,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.noProxy":{type:"array",items:{type:"string"},markdownDescription:d(2265,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.proxyAuthorization":{type:["null","string"],default:null,markdownDescription:d(2267,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.proxySupport":{type:"string",enum:["off","on","fallback","override"],enumDescriptions:[d(2271,null),d(2272,null),d(2270,null),d(2273,null)],default:"override",markdownDescription:d(2269,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.systemCertificates":{type:"boolean",default:!0,markdownDescription:d(2275,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.systemCertificatesNode":{type:"boolean",tags:["experimental"],default:o1o,markdownDescription:d(2276,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0,experiment:{mode:"auto"}},"http.experimental.systemCertificatesV2":{type:"boolean",tags:["experimental"],default:!1,markdownDescription:d(2277,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.fetchAdditionalSupport":{type:"boolean",default:!0,markdownDescription:d(2262,null,"`#http.useLocalProxyConfiguration#`","`#http.proxySupport#`","`#http.systemCertificates#`"),restricted:!0},"http.experimental.networkInterfaceCheckInterval":{type:"number",default:300,minimum:-1,tags:["experimental"],markdownDescription:d(2264,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0,experiment:{mode:"auto"}}}}],e.updateConfigurations({add:hdi,remove:t})}j7i();var Qxe=ae("encryptionService"),roa=ae("encryptionMainService");function Q7i(a){return a==="kwallet"||a==="kwallet5"||a==="kwallet6"}function Y7i(a){return a==="gnome_any"||a==="gnome_libsecret"||a==="gnome_keyring"}var LE=ae("secretStorageService"),Yxe=class extends C{constructor(e,t,o,n){super();this._useInMemoryStorage=e;this._storageService=t;this._encryptionService=o;this._logService=n;this._storagePrefix="secret://";this.onDidChangeSecretEmitter=this._register(new E);this.onDidChangeSecret=this.onDidChangeSecretEmitter.event;this._sequencer=new NT;this._type="unknown";this._onDidChangeValueDisposable=this._register(new P);this._lazyStorageService=new co(()=>this.initialize())}get type(){return this._type}get resolvedStorageService(){return this._lazyStorageService.value}get(e){return this._sequencer.queue(e,async()=>{let t=await this.resolvedStorageService,o=this.getKey(e);this._logService.trace("[secrets] getting secret for key:",o);let n=t.get(o,-1);if(!n){this._logService.trace("[secrets] no secret found for key:",o);return}try{this._logService.trace("[secrets] decrypting gotten secret for key:",o);let r=this._type==="in-memory"?n:await this._encryptionService.decrypt(n);return this._logService.trace("[secrets] decrypted secret for key:",o),r}catch(r){this._logService.error(r),this.delete(e);return}})}set(e,t){return this._sequencer.queue(e,async()=>{let o=await this.resolvedStorageService;this._logService.trace("[secrets] encrypting secret for key:",e);let n;try{n=this._type==="in-memory"?t:await this._encryptionService.encrypt(t)}catch(s){throw this._logService.error(s),s}let r=this.getKey(e);this._logService.trace("[secrets] storing encrypted secret for key:",r),o.store(r,n,-1,1),this._logService.trace("[secrets] stored encrypted secret for key:",r)})}delete(e){return this._sequencer.queue(e,async()=>{let t=await this.resolvedStorageService,o=this.getKey(e);this._logService.trace("[secrets] deleting secret for key:",o),t.remove(o,-1),this._logService.trace("[secrets] deleted secret for key:",o)})}keys(){return this._sequencer.queue("__keys__",async()=>{let e=await this.resolvedStorageService;this._logService.trace("[secrets] fetching keys of all secrets");let t=e.keys(-1,1);return this._logService.trace("[secrets] fetched keys of all secrets"),t.filter(o=>o.startsWith(this._storagePrefix)).map(o=>o.slice(this._storagePrefix.length))})}async initialize(){let e;if(!this._useInMemoryStorage&&await this._encryptionService.isEncryptionAvailable())this._logService.trace("[SecretStorageService] Encryption is available, using persisted storage"),this._type="persisted",e=this._storageService;else{if(this._type==="in-memory")return this._storageService;this._logService.trace("[SecretStorageService] Encryption is not available, falling back to in-memory storage"),this._type="in-memory",e=this._register(new RSt)}return this._onDidChangeValueDisposable.clear(),this._onDidChangeValueDisposable.add(e.onDidChangeValue(-1,void 0,this._onDidChangeValueDisposable)(t=>{this.onDidChangeValue(t.key)})),e}reinitialize(){this._lazyStorageService=new co(()=>this.initialize())}onDidChangeValue(e){if(!e.startsWith(this._storagePrefix))return;let t=e.slice(this._storagePrefix.length);this._logService.trace(`[SecretStorageService] Notifying change in value for secret: ${t}`),this.onDidChangeSecretEmitter.fire(t)}getKey(e){return`${this._storagePrefix}${e}`}};Yxe=I([m(1,le),m(2,Qxe),m(3,ne)],Yxe);var ga=class extends Us{constructor(e,t,o,n,r){super();this.preferredName=e;this.preferredDescription=t;this.secondary=o;this.primary=n;this.editorService=r;this.hasIdenticalSides=this.primary.matches(this.secondary),this.registerListeners()}static{this.ID="workbench.editorinputs.sidebysideEditorInput"}get typeId(){return ga.ID}get capabilities(){let e=this.primary.capabilities;return e&=-33,this.secondary.hasCapability(16)&&(e|=16),this.secondary.hasCapability(8)&&(e|=8),this.secondary.hasCapability(1024)&&(e|=1024),e|=256,e}get resource(){if(this.hasIdenticalSides)return this.primary.resource}registerListeners(){this._register(H.once(H.any(this.primary.onWillDispose,this.secondary.onWillDispose))(()=>{this.isDisposed()||this.dispose()})),this._register(this.primary.onDidChangeDirty(()=>this._onDidChangeDirty.fire())),this._register(this.primary.onDidChangeCapabilities(()=>this._onDidChangeCapabilities.fire())),this._register(this.secondary.onDidChangeCapabilities(()=>this._onDidChangeCapabilities.fire())),this._register(this.primary.onDidChangeLabel(()=>this._onDidChangeLabel.fire())),this._register(this.secondary.onDidChangeLabel(()=>this._onDidChangeLabel.fire()))}getName(){let e=this.getPreferredName();return e||(this.hasIdenticalSides?this.primary.getName():d(4630,null,this.secondary.getName(),this.primary.getName()))}getPreferredName(){return this.preferredName}getDescription(e){let t=this.getPreferredDescription();return t||(this.hasIdenticalSides?this.primary.getDescription(e):super.getDescription(e))}getPreferredDescription(){return this.preferredDescription}getTitle(e){let t;this.hasIdenticalSides?t=this.primary.getTitle(e)??this.getName():t=super.getTitle(e);let o=this.getPreferredTitle();return o&&(t=`${o} (${t})`),t}getPreferredTitle(){if(this.preferredName&&this.preferredDescription)return`${this.preferredName} ${this.preferredDescription}`;if(this.preferredName||this.preferredDescription)return this.preferredName??this.preferredDescription}getLabelExtraClasses(){return this.hasIdenticalSides?this.primary.getLabelExtraClasses():super.getLabelExtraClasses()}getAriaLabel(){return this.hasIdenticalSides?this.primary.getAriaLabel():super.getAriaLabel()}getTelemetryDescriptor(){return{...this.primary.getTelemetryDescriptor(),...super.getTelemetryDescriptor()}}isDirty(){return this.primary.isDirty()}isSaving(){return this.primary.isSaving()}async save(e,t){let o=await this.primary.save(e,t);return this.saveResultToEditor(o)}async saveAs(e,t){let o=await this.primary.saveAs(e,t);return this.saveResultToEditor(o)}saveResultToEditor(e){if(!e||!this.hasIdenticalSides)return e;if(this.primary.matches(e))return this;if(e instanceof Us)return new ga(this.preferredName,this.preferredDescription,e,e,this.editorService);if(!db(e)&&!bY(e)&&!C_(e)&&!dC(e))return{primary:e,secondary:e,label:this.preferredName,description:this.preferredDescription}}revert(e,t){return this.primary.revert(e,t)}async rename(e,t){if(!this.hasIdenticalSides)return;let o=await this.primary.rename(e,t);if(o){if(Ta(o.editor))return{editor:new ga(this.preferredName,this.preferredDescription,o.editor,o.editor,this.editorService),options:{...o.options,viewState:Dj(this,e,this.editorService)}};if(QS(o.editor))return{editor:{label:this.preferredName,description:this.preferredDescription,primary:o.editor,secondary:o.editor,options:{...o.options,viewState:Dj(this,e,this.editorService)}}}}}isReadonly(){return this.primary.isReadonly()}toUntyped(e){let t=this.primary.toUntyped(e),o=this.secondary.toUntyped(e);if(t&&o&&!db(t)&&!db(o)&&!bY(t)&&!bY(o)&&!C_(t)&&!C_(o)&&!dC(t)&&!dC(o)){let n={label:this.preferredName,description:this.preferredDescription,primary:t,secondary:o};return typeof e?.preserveViewState=="number"&&(n.options={viewState:Dj(this,e.preserveViewState,this.editorService)}),n}}matches(e){return this===e?!0:Lj(e)||db(e)?!1:e instanceof ga?this.primary.matches(e.primary)&&this.secondary.matches(e.secondary):C_(e)?this.primary.matches(e.primary)&&this.secondary.matches(e.secondary):!1}};ga=I([m(4,ee)],ga);var D8e=class{canSerialize(i){let e=i;if(e.primary&&e.secondary){let[t,o]=this.getSerializers(e.secondary.typeId,e.primary.typeId);return!!(t?.canSerialize(e.secondary)&&o?.canSerialize(e.primary))}return!1}serialize(i){let e=i;if(e.primary&&e.secondary){let[t,o]=this.getSerializers(e.secondary.typeId,e.primary.typeId);if(o&&t){let n=o.serialize(e.primary),r=t.serialize(e.secondary);if(n&&r){let s={name:e.getPreferredName(),description:e.getPreferredDescription(),primarySerialized:n,secondarySerialized:r,primaryTypeId:e.primary.typeId,secondaryTypeId:e.secondary.typeId};return JSON.stringify(s)}}}}deserialize(i,e){let t=JSON.parse(e),[o,n]=this.getSerializers(t.secondaryTypeId,t.primaryTypeId);if(n&&o){let r=n.deserialize(i,t.primarySerialized),s=o.deserialize(i,t.secondarySerialized);if(r instanceof Us&&s instanceof Us)return this.createEditorInput(i,t.name,t.description,s,r)}}getSerializers(i,e){let t=oe.as(rn.EditorFactory);return[t.getEditorSerializer(i),t.getEditorSerializer(e)]}},KEt=class extends D8e{createEditorInput(i,e,t,o,n){return i.createInstance(ga,e,t,o,n)}};var gg=class extends C{constructor(){super(...arguments);this._onWillDispose=this._register(new E);this.onWillDispose=this._onWillDispose.event;this.resolved=!1}async resolve(){this.resolved=!0}isResolved(){return this.resolved}isDisposed(){return this._store.isDisposed}dispose(){this._onWillDispose.fire(),super.dispose()}};var eS=ae("ILanguageDetectionService"),L8e="languageDetection",X7i="automaticlanguagedetection.likelywrong",J7i="automaticlanguagedetection.stats";var rw=class extends gg{constructor(e,t,o,n,r){super();this.modelService=e;this.languageService=t;this.languageDetectionService=o;this.accessibilityService=n;this.textEditorModelHandle=void 0;this.modelDisposeListener=this._register(new me);this.autoDetectLanguageThrottler=this._register(new ya(rw.AUTO_DETECT_LANGUAGE_THROTTLE_DELAY));this._blockLanguageChangeListener=!1;this._languageChangeSource=void 0;r&&this.handleExistingModel(r)}static{this.AUTO_DETECT_LANGUAGE_THROTTLE_DELAY=600}handleExistingModel(e){let t=this.modelService.getModel(e);if(!t)throw new Error(`Document with resource ${e.toString(!0)} does not exist`);this.textEditorModelHandle=e,this.registerModelDisposeListener(t)}registerModelDisposeListener(e){this.modelDisposeListener.value=e.onWillDispose(()=>{this.textEditorModelHandle=void 0,this.dispose()})}get textEditorModel(){return this.textEditorModelHandle?this.modelService.getModel(this.textEditorModelHandle):null}isReadonly(){return!0}get languageChangeSource(){return this._languageChangeSource}get hasLanguageSetExplicitly(){return typeof this._languageChangeSource=="string"}setLanguageId(e,t){this._languageChangeSource="user",this.setLanguageIdInternal(e,t)}setLanguageIdInternal(e,t){if(this.isResolved()&&!(!e||e===this.textEditorModel.getLanguageId())){this._blockLanguageChangeListener=!0;try{this.textEditorModel.setLanguage(this.languageService.createById(e),t)}finally{this._blockLanguageChangeListener=!1}}}installModelListeners(e){let t=this._register(e.onDidChangeLanguage(o=>{o.source===L8e||this._blockLanguageChangeListener||(this._languageChangeSource="api",t.dispose())}))}getLanguageId(){return this.textEditorModel?.getLanguageId()}autoDetectLanguage(){return this.autoDetectLanguageThrottler.trigger(()=>this.doAutoDetectLanguage())}async doAutoDetectLanguage(){if(this.hasLanguageSetExplicitly||!this.textEditorModelHandle||!this.languageDetectionService.isEnabledForLanguage(this.getLanguageId()??Fr))return;let e=await this.languageDetectionService.detectLanguage(this.textEditorModelHandle),t=this.getLanguageId();if(e&&e!==t&&!this.isDisposed()){this.setLanguageIdInternal(e,L8e);let o=this.languageService.getLanguageName(e);this.accessibilityService.alert(d(4631,null,o??e))}}createTextEditorModel(e,t,o){let n=this.getFirstLineText(e),r=this.getOrCreateLanguage(t,this.languageService,o,n);return this.doCreateTextEditorModel(e,r,t)}doCreateTextEditorModel(e,t,o){let n=o&&this.modelService.getModel(o);return n?this.updateTextEditorModel(e,t.languageId):(n=this.modelService.createModel(e,t,o),this.createdEditorModel=!0,this.registerModelDisposeListener(n)),this.textEditorModelHandle=n.uri,n}getFirstLineText(e){let t=e;return typeof t.getFirstLineText=="function"?t.getFirstLineText(1e3):e.getLineContent(1).substr(0,1e3)}getOrCreateLanguage(e,t,o,n){return!o||o===Fr?t.createByFilepathOrFirstLine(e??null,n):t.createById(o)}updateTextEditorModel(e,t,o){this.isResolved()&&(e&&this.modelService.updateModel(this.textEditorModel,e,o),t&&t!==Fr&&this.textEditorModel.getLanguageId()!==t&&this.textEditorModel.setLanguage(this.languageService.createById(t)))}createSnapshot(){return this.textEditorModel?this.textEditorModel.createSnapshot(!0):null}isResolved(){return!!this.textEditorModelHandle}dispose(){this.modelDisposeListener.dispose(),this.textEditorModelHandle&&this.createdEditorModel&&this.modelService.destroyModel(this.textEditorModelHandle),this.textEditorModelHandle=void 0,this.createdEditorModel=!1,super.dispose()}};rw=I([m(0,Ct),m(1,kt),m(2,eS),m(3,Bi)],rw);var Xxe=class extends gg{get originalModel(){return this._originalModel}get modifiedModel(){return this._modifiedModel}constructor(i,e){super(),this._originalModel=i,this._modifiedModel=e}async resolve(){await Promise.all([this._originalModel?.resolve(),this._modifiedModel?.resolve()])}isResolved(){return!!(this._originalModel?.isResolved()&&this._modifiedModel?.isResolved())}dispose(){super.dispose()}};var Jxe=class extends Xxe{constructor(e,t){super(e,t);this._textDiffEditorModel=void 0;this._originalModel=e,this._modifiedModel=t,this.updateTextDiffEditorModel()}get originalModel(){return this._originalModel}get modifiedModel(){return this._modifiedModel}get textDiffEditorModel(){return this._textDiffEditorModel}async resolve(){await super.resolve(),this.updateTextDiffEditorModel()}updateTextDiffEditorModel(){this.originalModel?.isResolved()&&this.modifiedModel?.isResolved()&&(this._textDiffEditorModel?(this._textDiffEditorModel.original=this.originalModel.textEditorModel,this._textDiffEditorModel.modified=this.modifiedModel.textEditorModel):this._textDiffEditorModel={original:this.originalModel.textEditorModel,modified:this.modifiedModel.textEditorModel})}isResolved(){return!!this._textDiffEditorModel}isReadonly(){return!!this.modifiedModel&&this.modifiedModel.isReadonly()}dispose(){this._textDiffEditorModel=void 0,super.dispose()}};var Fa=class extends ga{constructor(e,t,o,n,r,s){super(e,t,o,n,s);this.original=o;this.modified=n;this.forceOpenAsBinary=r;this.cachedModel=void 0;this.labels=this.computeLabels()}static{this.ID="workbench.editors.diffEditorInput"}get typeId(){return Fa.ID}get editorId(){return this.modified.editorId===this.original.editorId?this.modified.editorId:void 0}get capabilities(){let e=super.capabilities;return this.labels.forceDescription&&(e|=64),e}computeLabels(){let e,t=!1;if(this.preferredName)e=this.preferredName;else{let p=this.original.getName(),h=this.modified.getName();e=d(4629,null,p,h),t=p===h}let o,n,r;if(this.preferredDescription)o=this.preferredDescription,n=this.preferredDescription,r=this.preferredDescription;else{o=this.computeLabel(this.original.getDescription(0),this.modified.getDescription(0)),r=this.computeLabel(this.original.getDescription(2),this.modified.getDescription(2));let p=this.original.getDescription(1),h=this.modified.getDescription(1);if(typeof p=="string"&&typeof h=="string"&&(p||h)){let[g,f]=wIe([p,h]);n=this.computeLabel(g,f)}}let s=this.computeLabel(this.original.getTitle(0)??this.original.getName(),this.modified.getTitle(0)??this.modified.getName()," \u2194 "),l=this.computeLabel(this.original.getTitle(1)??this.original.getName(),this.modified.getTitle(1)??this.modified.getName()," \u2194 "),c=this.computeLabel(this.original.getTitle(2)??this.original.getName(),this.modified.getTitle(2)??this.modified.getName()," \u2194 "),u=this.getPreferredTitle();return u&&(s=`${u} (${s})`,l=`${u} (${l})`,c=`${u} (${c})`),{name:e,shortDescription:o,mediumDescription:n,longDescription:r,forceDescription:t,shortTitle:s,mediumTitle:l,longTitle:c}}computeLabel(e,t,o=" - "){if(!(!e||!t))return e===t?t:`${e}${o}${t}`}getName(){return this.labels.name}getDescription(e=1){switch(e){case 0:return this.labels.shortDescription;case 2:return this.labels.longDescription;case 1:default:return this.labels.mediumDescription}}getTitle(e){switch(e){case 0:return this.labels.shortTitle;case 2:return this.labels.longTitle;default:case 1:return this.labels.mediumTitle}}async resolve(){let e=await this.createModel();return this.cachedModel?.dispose(),this.cachedModel=e,this.cachedModel}prefersEditorPane(e){return this.forceOpenAsBinary?e.find(t=>t.typeId===LEt):e.find(t=>t.typeId===SY)}async createModel(){let[e,t]=await Promise.all([this.original.resolve(),this.modified.resolve()]);return t instanceof rw&&e instanceof rw?new Jxe(e,t):new Xxe(XYt(e)?e:void 0,XYt(t)?t:void 0)}toUntyped(e){let t=super.toUntyped(e);if(t)return{...t,modified:t.primary,original:t.secondary}}matches(e){return this===e?!0:e instanceof Fa?this.modified.matches(e.modified)&&this.original.matches(e.original)&&e.forceOpenAsBinary===this.forceOpenAsBinary:db(e)?this.modified.matches(e.modified)&&this.original.matches(e.original):!1}dispose(){this.cachedModel&&(this.cachedModel.dispose(),this.cachedModel=void 0),super.dispose()}};Fa=I([m(5,ee)],Fa);var GEt=class extends D8e{createEditorInput(i,e,t,o,n){return i.createInstance(Fa,e,t,o,n,void 0)}};var Qa=new Q("workbenchState",void 0,{type:"string",description:d(4623,null)}),mC=new Q("workspaceFolderCount",0,d(4624,null)),PO=new Q("openFolderWorkspaceSupport",!0,!0),T_=new Q("enterMultiRootWorkspaceSupport",!0,!0),xY=new Q("emptyWorkspaceSupport",!0,!0),R8e=new Q("dirtyWorkingCopies",!1,d(4569,null)),ub=new Q("remoteName","",d(4601,null)),JL=new Q("virtualWorkspace","",d(4622,null)),$Et=new Q("temporaryWorkspace",!1,d(4616,null)),$p=new Q("isSessionsWindow",!1,d(4588,null)),qEt=new Q("hasWebFileSystemAccess",!1,!0),Z7i=new Q("embedderIdentifier",void 0,d(4577,null)),jEt=new Q("inAutomation",!1,d(4580,null)),lP=new Q("isFullscreen",!1,d(4586,null)),sw=new Q("isAuxiliaryWindowFocusedContext",!1,d(4583,null)),vce=new Q("isWindowAlwaysOnTop",!1,d(4589,null)),Xc=new Q("isAuxiliaryWindow",!1,d(4582,null)),bce=new Q("activeEditorIsDirty",!1,d(4557,null)),Zxe=new Q("activeEditorIsNotPreview",!1,d(4560,null)),QEt=new Q("activeEditorIsFirstInGroup",!1,d(4558,null)),Sce=new Q("activeEditorIsLastInGroup",!1,d(4559,null)),ZL=new Q("activeEditorIsPinned",!1,d(4561,null)),eYi=new Q("activeEditorIsReadonly",!1,d(4562,null)),eke=new Q("activeCompareEditorCanSwap",!1,d(4548,null)),YEt=new Q("activeEditorCanToggleReadonly",!0,d(4552,null)),XEt=new Q("activeEditorCanRevert",!1,d(4551,null)),oV=new Q("activeEditorCanSplitInGroup",!0),fr=new Q("activeEditor",null,{type:"string",description:d(4549,null)}),AO=new Q("activeEditorAvailableEditorIds","",d(4550,null)),M8e=new Q("textCompareEditorVisible",!1,d(4618,null)),tS=new Q("textCompareEditorActive",!1,d(4617,null)),hC=new Q("sideBySideEditorActive",!1,d(4613,null)),JEt=new Q("groupEditorsCount",0,d(4579,null)),Ice=new Q("activeEditorGroupEmpty",!1,d(4553,null)),tYi=new Q("activeEditorGroupIndex",0,d(4554,null)),iYi=new Q("activeEditorGroupLast",!1,d(4555,null)),ME=new Q("activeEditorGroupLocked",!1,d(4556,null)),iS=new Q("multipleEditorGroups",!1,d(4591,null)),oYi=iS.toNegated(),Oj=new Q("multipleEditorsSelectedInGroup",!1,d(4592,null)),ZEt=new Q("twoEditorsSelectedInGroup",!1,d(4621,null)),eTt=new Q("SelectedEditorsInGroupFileOrUntitledResourceContextKey",!0,d(4610,null)),Fj=new Q("editorPartMultipleEditorGroups",!1,d(4575,null)),Ona=Fj.toNegated(),nV=new Q("editorPartMaximizedEditorGroup",!1,d(4571,null)),rV=new Q("editorPartModal",!1,d(4572,null)),tTt=new Q("editorPartModalMaximized",!1,d(4573,null)),yce=new Q("editorPartModalNavigation",!1,d(4574,null)),wce=new Q("editorIsOpen",!1,d(4570,null)),gC=new Q("inZenMode",!1,d(4581,null)),P8e=new Q("isCenteredLayout",!1,d(4587,null)),Cce=new Q("splitEditorsVertically",!1,d(4614,null)),iTt=new Q("mainEditorAreaVisible",!0,d(4590,null)),dz=new Q("editorTabsVisible",!0,d(4576,null)),cP=new Q("sideBarVisible",!1,d(4612,null)),sV=new Q("sideBarFocus",!1,d(4611,null)),nYi=new Q("activeViewlet","",d(4564,null)),kY=new Q("statusBarFocused",!1,d(4615,null)),EY=new Q("titleBarStyle","custom",d(4619,null)),xce=new Q("titleBarVisible",!1,d(4620,null)),aV=new Q("isCompactTitleBar",!1,d(4584,null)),A8e=new Q("bannerFocused",!1,d(4568,null)),__=new Q("notificationFocus",!0,d(4594,null)),N8e=new Q("notificationCenterVisible",!1,d(4593,null)),lV=new Q("notificationToastsVisible",!1,d(4595,null)),rYi=new Q("activeAuxiliary","",d(4547,null)),sYi=new Q("auxiliaryBarFocus",!1,d(4565,null)),D_=new Q("auxiliaryBarVisible",!1,d(4567,null)),tke=new Q("auxiliaryBarMaximized",!1,d(4566,null)),aYi=new Q("activePanel","",d(4563,null)),kce=new Q("panelFocus",!1,d(4597,null)),TY=new Q("panelPosition","bottom",d(4599,null)),cV=new Q("panelAlignment","center",d(4596,null)),_Y=new Q("panelVisible",!1,d(4600,null)),oTt=new Q("panelMaximized",!1,d(4598,null)),Vl=new Q("focusedView","",d(4578,null));function O8e(a){return`view.${a}.visible`}var RE=class{constructor(i,e,t,o){this._contextKeyService=i;this._fileService=e;this._languageService=t;this._modelService=o;this._schemeKey=RE.Scheme.bindTo(this._contextKeyService),this._filenameKey=RE.Filename.bindTo(this._contextKeyService),this._dirnameKey=RE.Dirname.bindTo(this._contextKeyService),this._pathKey=RE.Path.bindTo(this._contextKeyService),this._langIdKey=RE.LangId.bindTo(this._contextKeyService),this._resourceKey=RE.Resource.bindTo(this._contextKeyService),this._extensionKey=RE.Extension.bindTo(this._contextKeyService),this._hasResource=RE.HasResource.bindTo(this._contextKeyService),this._isFileSystemResource=RE.IsFileSystemResource.bindTo(this._contextKeyService)}static{this.Scheme=new Q("resourceScheme",void 0,{type:"string",description:d(4608,null)})}static{this.Filename=new Q("resourceFilename",void 0,{type:"string",description:d(4605,null)})}static{this.Dirname=new Q("resourceDirname",void 0,{type:"string",description:d(4603,null)})}static{this.Path=new Q("resourcePath",void 0,{type:"string",description:d(4607,null)})}static{this.LangId=new Q("resourceLangId",void 0,{type:"string",description:d(4606,null)})}static{this.Resource=new Q("resource",void 0,{type:"URI",description:d(4602,null)})}static{this.Extension=new Q("resourceExtname",void 0,{type:"string",description:d(4604,null)})}static{this.HasResource=new Q("resourceSet",void 0,{type:"boolean",description:d(4609,null)})}static{this.IsFileSystemResource=new Q("isFileSystemResource",void 0,{type:"boolean",description:d(4585,null)})}_setLangId(){let i=this.get();if(!i){this._langIdKey.set(null);return}let e=this._modelService.getModel(i)?.getLanguageId()??this._languageService.guessLanguageIdByFilepathOrFirstLine(i);this._langIdKey.set(e)}set(i){i=i??void 0,!Xe(this._value,i)&&(this._value=i,this._contextKeyService.bufferChangeEvents(()=>{this._resourceKey.set(i?i.toString():null),this._schemeKey.set(i?i.scheme:null),this._filenameKey.set(i?Ye(i):null),this._dirnameKey.set(i?this.uriToPath(ci(i)):null),this._pathKey.set(i?this.uriToPath(i):null),this._setLangId(),this._extensionKey.set(i?ms(i):null),this._hasResource.set(!!i),this._isFileSystemResource.set(i?this._fileService.hasProvider(i):!1)}))}uriToPath(i){return i.scheme===Y.file?i.fsPath:i.path}reset(){this._value=void 0,this._contextKeyService.bufferChangeEvents(()=>{this._resourceKey.reset(),this._schemeKey.reset(),this._filenameKey.reset(),this._dirnameKey.reset(),this._pathKey.reset(),this._langIdKey.reset(),this._extensionKey.reset(),this._hasResource.reset(),this._isFileSystemResource.reset()})}get(){return this._value}};RE=I([m(0,X),m(1,be),m(2,kt),m(3,Ct)],RE);var Fo=class extends RE{constructor(e,t,o,n){super(e,t,o,n);this._disposables=new P;this._disposables.add(t.onDidChangeFileSystemProviderRegistrations(()=>{let r=this.get();this._isFileSystemResource.set(!!(r&&t.hasProvider(r)))})),this._disposables.add(n.onModelAdded(r=>{Xe(r.uri,this.get())&&this._setLangId()})),this._disposables.add(n.onModelLanguageChanged(r=>{Xe(r.model.uri,this.get())&&this._setLangId()}))}dispose(){this._disposables.dispose()}};Fo=I([m(0,X),m(1,be),m(2,kt),m(3,Ct)],Fo);var CY=class extends RE{};function nTt(a,i,e){if(!i){a.set("");return}let t=bdi(i,e);a.set(t.join(","))}function bdi(a,i){if(a.resource?.scheme===Y.untitled&&a.editorId!==Ys.id)return[];if(a instanceof Fa){let e=bdi(a.original,i),t=new Set(bdi(a.modified,i));return e.filter(o=>t.has(o))}return a.resource?i.getEditors(a.resource).map(e=>e.id):[]}var dV="__";function Ece(a){return typeof a=="object"&&a!==null&&"wwwAuthenticate"in a&&typeof a.wwwAuthenticate=="string"}var Cs=ae("IAuthenticationService");var DY=ae("IAuthenticationExtensionsService");var xs;(n=>(n.Setup={hidden:new Q("chatSetupHidden",!1,!0),installed:new Q("chatSetupInstalled",!1,!0),disabled:new Q("chatSetupDisabled",!1,!0),untrusted:new Q("chatSetupUntrusted",!1,!0),later:new Q("chatSetupLater",!1,!0),registered:new Q("chatSetupRegistered",!1,!0)},n.Entitlement={signedOut:new Q("chatEntitlementSignedOut",!1,!0),canSignUp:new Q("chatPlanCanSignUp",!1,!0),planFree:new Q("chatPlanFree",!1,!0),planPro:new Q("chatPlanPro",!1,!0),planProPlus:new Q("chatPlanProPlus",!1,!0),planBusiness:new Q("chatPlanBusiness",!1,!0),planEnterprise:new Q("chatPlanEnterprise",!1,!0),organisations:new Q("chatEntitlementOrganisations",void 0,!0),internal:new Q("chatEntitlementInternal",!1,!0),sku:new Q("chatEntitlementSku",void 0,!0)},n.chatQuotaExceeded=new Q("chatQuotaExceeded",!1,!0),n.completionsQuotaExceeded=new Q("completionsQuotaExceeded",!1,!0),n.chatAnonymous=new Q("chatAnonymous",!1,!0)))(xs||={});var vr=ae("chatEntitlementService");function dP(a){return a===6||a===7||a===8||a===9}function sTt(a){switch(a){case 6:return d(16665,null);case 7:return d(16666,null);case 8:return d(16662,null);case 9:return d(16663,null);default:return d(16664,null)}}var rTt={upgradePlanUrl:to.defaultChatAgent?.upgradePlanUrl??"",providerUriSetting:to.defaultChatAgent?.providerUriSetting??"",entitlementSignupLimitedUrl:to.defaultChatAgent?.entitlementSignupLimitedUrl??"",chatQuotaExceededContext:to.defaultChatAgent?.chatQuotaExceededContext??"",completionsQuotaExceededContext:to.defaultChatAgent?.completionsQuotaExceededContext??""},lYi="chat.allowAnonymousAccess";function Sdi(a,i,e){return!(a.getValue(lYi)!==!0||i!==1||e.hidden||e.disabled)}function cYi(a,i,e){e.publicLog2("chatEntitlements",{chatHidden:!!a.hidden,chatDisabled:!!a.disabled,chatEntitlement:a.entitlement,chatRegistered:!!a.registered,chatAnonymous:Sdi(i,a.entitlement,a)})}var F8e=class extends C{constructor(e,t,o,n,r,s){super();this.contextKeyService=n;this.configurationService=r;this.telemetryService=s;this._onDidChangeQuotaExceeded=this._register(new E);this.onDidChangeQuotaExceeded=this._onDidChangeQuotaExceeded.event;this._onDidChangeQuotaRemaining=this._register(new E);this.onDidChangeQuotaRemaining=this._onDidChangeQuotaRemaining.event;this._quotas={};this.ExtensionQuotaContextKeys={chatQuotaExceeded:rTt.chatQuotaExceededContext,completionsQuotaExceeded:rTt.completionsQuotaExceededContext};this._onDidChangeAnonymous=this._register(new E);this.onDidChangeAnonymous=this._onDidChangeAnonymous.event;this.anonymousObs=ui(this.onDidChangeAnonymous,()=>this.anonymous);if(this.chatQuotaExceededContextKey=xs.chatQuotaExceeded.bindTo(this.contextKeyService),this.completionsQuotaExceededContextKey=xs.completionsQuotaExceeded.bindTo(this.contextKeyService),this.anonymousContextKey=xs.chatAnonymous.bindTo(this.contextKeyService),this.anonymousContextKey.set(this.anonymous),this.onDidChangeEntitlement=H.map(H.filter(this.contextKeyService.onDidChangeContext,c=>c.affectsSome(new Set([xs.Entitlement.planPro.key,xs.Entitlement.planBusiness.key,xs.Entitlement.planEnterprise.key,xs.Entitlement.planProPlus.key,xs.Entitlement.planFree.key,xs.Entitlement.canSignUp.key,xs.Entitlement.signedOut.key,xs.Entitlement.organisations.key,xs.Entitlement.internal.key,xs.Entitlement.sku.key])),this._store),()=>{},this._store),this.entitlementObs=ui(this.onDidChangeEntitlement,()=>this.entitlement),this.onDidChangeSentiment=H.map(H.filter(this.contextKeyService.onDidChangeContext,c=>c.affectsSome(new Set([xs.Setup.hidden.key,xs.Setup.disabled.key,xs.Setup.untrusted.key,xs.Setup.installed.key,xs.Setup.later.key,xs.Setup.registered.key])),this._store),()=>{},this._store),this.sentimentObs=ui(this.onDidChangeSentiment,()=>this.sentiment),Gt&&!o.remoteAuthority){xs.Setup.hidden.bindTo(this.contextKeyService).set(!0);return}if(!t.defaultChatAgent)return;let l=this.context=new co(()=>this._register(e.createInstance(uz)));this.requests=new co(()=>this._register(e.createInstance(W8e,l.value,{clearQuotas:()=>this.clearQuotas(),acceptQuotas:c=>this.acceptQuotas(c)}))),this.registerListeners()}get entitlement(){return this.contextKeyService.getContextKeyValue(xs.Entitlement.planPro.key)===!0?6:this.contextKeyService.getContextKeyValue(xs.Entitlement.planBusiness.key)===!0?8:this.contextKeyService.getContextKeyValue(xs.Entitlement.planEnterprise.key)===!0?9:this.contextKeyService.getContextKeyValue(xs.Entitlement.planProPlus.key)===!0?7:this.contextKeyService.getContextKeyValue(xs.Entitlement.planFree.key)===!0?5:this.contextKeyService.getContextKeyValue(xs.Entitlement.canSignUp.key)===!0?3:this.contextKeyService.getContextKeyValue(xs.Entitlement.signedOut.key)===!0?1:2}get isInternal(){return this.contextKeyService.getContextKeyValue(xs.Entitlement.internal.key)===!0}get organisations(){return this.contextKeyService.getContextKeyValue(xs.Entitlement.organisations.key)}get sku(){return this.contextKeyService.getContextKeyValue(xs.Entitlement.sku.key)}get copilotTrackingId(){return this.context?.value.state.copilotTrackingId}get previewFeaturesDisabled(){return this.contextKeyService.getContextKeyValue("github.copilot.previewFeaturesDisabled")===!0}get quotas(){return this._quotas}registerListeners(){let e=new Set([this.ExtensionQuotaContextKeys.chatQuotaExceeded,this.ExtensionQuotaContextKeys.completionsQuotaExceeded]),t=this._register(new me);this._register(this.contextKeyService.onDidChangeContext(r=>{r.affectsSome(e)&&(t.value&&t.value.cancel(),t.value=new $e,this.update(t.value.token))}));let o=this.anonymous,n=()=>{let r=this.anonymous;r!==o&&(o=r,this.anonymousContextKey.set(r),this.context?.hasValue&&cYi(this.context.value.state,this.configurationService,this.telemetryService),this._onDidChangeAnonymous.fire())};this._register(this.configurationService.onDidChangeConfiguration(r=>{r.affectsConfiguration(lYi)&&n()})),this._register(this.onDidChangeEntitlement(()=>n())),this._register(this.onDidChangeSentiment(()=>n()))}acceptQuotas(e){let t=this._quotas;this._quotas=e,this.updateContextKeys();let{changed:o}=this.compareQuotas(t.chat,e.chat),{changed:n}=this.compareQuotas(t.completions,e.completions),{changed:r}=this.compareQuotas(t.premiumChat,e.premiumChat);(o.exceeded||n.exceeded||r.exceeded)&&this._onDidChangeQuotaExceeded.fire(),(o.remaining||n.remaining||r.remaining)&&this._onDidChangeQuotaRemaining.fire()}compareQuotas(e,t){return{changed:{exceeded:e?.percentRemaining===0!=(t?.percentRemaining===0),remaining:e?.percentRemaining!==t?.percentRemaining}}}clearQuotas(){this.acceptQuotas({})}updateContextKeys(){this.chatQuotaExceededContextKey.set(this._quotas.chat?.percentRemaining===0),this.completionsQuotaExceededContextKey.set(this._quotas.completions?.percentRemaining===0)}get sentiment(){return{installed:this.contextKeyService.getContextKeyValue(xs.Setup.installed.key)===!0,hidden:this.contextKeyService.getContextKeyValue(xs.Setup.hidden.key)===!0,disabled:this.contextKeyService.getContextKeyValue(xs.Setup.disabled.key)===!0,untrusted:this.contextKeyService.getContextKeyValue(xs.Setup.untrusted.key)===!0,later:this.contextKeyService.getContextKeyValue(xs.Setup.later.key)===!0,registered:this.contextKeyService.getContextKeyValue(xs.Setup.registered.key)===!0}}get anonymous(){return Sdi(this.configurationService,this.entitlement,this.sentiment)}markAnonymousRateLimited(){this.anonymous&&(this.chatQuotaExceededContextKey.set(!0),this._onDidChangeQuotaExceeded.fire())}async update(e){await this.requests?.value.forceResolveEntitlement(e)}};F8e=I([m(0,F),m(1,nt),m(2,Vt),m(3,X),m(4,B),m(5,Te)],F8e);var W8e=class extends C{constructor(e,t,o,n,r,s,l,c,u,p){super();this.context=e;this.chatQuotasAccessor=t;this.telemetryService=o;this.logService=n;this.requestService=r;this.dialogService=s;this.openerService=l;this.lifecycleService=c;this.defaultAccountService=u;this.authenticationService=p;this.pendingResolveCts=new $e;this.state={entitlement:this.context.state.entitlement},this.registerListeners(),this.resolve()}registerListeners(){this._register(this.defaultAccountService.onDidChangeDefaultAccount(()=>this.resolve())),this._register(this.context.onDidChange(()=>{(!this.context.state.installed||this.context.state.disabled||this.context.state.entitlement===1)&&(this.state={entitlement:this.state.entitlement,quotas:void 0},this.chatQuotasAccessor.clearQuotas())}))}async resolve(){this.pendingResolveCts.dispose(!0);let e=this.pendingResolveCts=new $e,t=await this.defaultAccountService.getDefaultAccount();if(e.token.isCancellationRequested)return;let o;t?this.state.entitlement===1&&(o={entitlement:2}):o={entitlement:1},o&&this.update(o),t&&await this.resolveEntitlement(t,e.token)}async resolveEntitlement(e,t){let o=await this.doResolveEntitlement(e,t);return typeof o?.entitlement=="number"&&!t.isCancellationRequested&&this.update(o),o}async doResolveEntitlement(e,t){if(t.isCancellationRequested)return;let o=e.entitlementsData;if(!o)return this.logService.trace("[chat entitlement]: no entitlements data available on default account"),{entitlement:o===null?1:2};let n;o.access_type_sku==="free_limited_copilot"?n=5:o.can_signup_for_limited?n=3:o.copilot_plan==="individual"?n=6:o.copilot_plan==="individual_pro"?n=7:o.copilot_plan==="business"?n=8:o.copilot_plan==="enterprise"?n=9:n=4;let r={entitlement:n,organisations:o.organization_login_list,quotas:this.toQuotas(o),sku:o.access_type_sku,copilotTrackingId:o.analytics_tracking_id};return this.logService.trace(`[chat entitlement]: resolved to ${r.entitlement}, quotas: ${JSON.stringify(r.quotas)}`),this.telemetryService.publicLog2("chatInstallEntitlement",{entitlement:r.entitlement,tid:o.analytics_tracking_id,sku:r.sku,quotaChat:r.quotas?.chat?.remaining,quotaPremiumChat:r.quotas?.premiumChat?.remaining,quotaCompletions:r.quotas?.completions?.remaining,quotaResetDate:r.quotas?.resetDate}),r}toQuotas(e){let t={resetDate:e.quota_reset_date_utc??e.quota_reset_date??e.limited_user_reset_date,resetDateHasTime:typeof e.quota_reset_date_utc=="string"};if(e.monthly_quotas?.chat&&typeof e.limited_user_quotas?.chat=="number"&&(t.chat={total:e.monthly_quotas.chat,remaining:e.limited_user_quotas.chat,percentRemaining:Math.min(100,Math.max(0,e.limited_user_quotas.chat/e.monthly_quotas.chat*100)),overageEnabled:!1,overageCount:0,unlimited:!1}),e.monthly_quotas?.completions&&typeof e.limited_user_quotas?.completions=="number"&&(t.completions={total:e.monthly_quotas.completions,remaining:e.limited_user_quotas.completions,percentRemaining:Math.min(100,Math.max(0,e.limited_user_quotas.completions/e.monthly_quotas.completions*100)),overageEnabled:!1,overageCount:0,unlimited:!1}),e.quota_snapshots)for(let o of["chat","completions","premium_interactions"]){let n=e.quota_snapshots[o];if(!n)continue;let r={total:n.entitlement,remaining:n.remaining,percentRemaining:Math.min(100,Math.max(0,n.percent_remaining)),overageEnabled:n.overage_permitted,overageCount:n.overage_count,unlimited:n.unlimited};switch(o){case"chat":t.chat=r;break;case"completions":t.completions=r;break;case"premium_interactions":t.premiumChat=r;break}}return t}async request(e,t,o,n,r){let s;for(let l of n){if(r.isCancellationRequested)return s;try{let c=await this.requestService.request({type:t,url:e,data:t==="POST"?JSON.stringify(o):void 0,disableCache:!0,headers:{Authorization:`Bearer ${l.accessToken}`}},r),u=c.res.statusCode;if(u&&u!==200){s=c;continue}return c}catch(c){r.isCancellationRequested||this.logService.error(`[chat entitlement] request: error ${c}`)}}return s}update(e){this.state=e,this.context.update({entitlement:this.state.entitlement,organisations:this.state.organisations,sku:this.state.sku,copilotTrackingId:this.state.copilotTrackingId}),e.quotas&&this.chatQuotasAccessor.acceptQuotas(e.quotas)}async forceResolveEntitlement(e=ve.None){let t=await this.defaultAccountService.refresh();if(t)return this.resolveEntitlement(t,e)}async signUpFree(){let e=await this.getSessions();if(e.length!==0)return this.doSignUpFree(e)}async doSignUpFree(e){let t={restricted_telemetry:this.telemetryService.telemetryLevel===0?"disabled":"enabled",public_code_suggestions:"enabled"},o=await this.request(rTt.entitlementSignupLimitedUrl,"POST",t,e,ve.None);if(!o)return await this.onUnknownSignUpError(d(16670,null),"[chat entitlement] sign-up: no response")?this.doSignUpFree(e):{errorCode:1};if(o.res.statusCode&&o.res.statusCode!==200){if(o.res.statusCode===422)try{let l=await E_(o);if(l){let c=JSON.parse(l);if(typeof c.message=="string"&&c.message)return this.onUnprocessableSignUpError(`[chat entitlement] sign-up: unprocessable entity (${c.message})`,c.message),{errorCode:o.res.statusCode}}}catch{}return await this.onUnknownSignUpError(d(16671,null,o.res.statusCode),`[chat entitlement] sign-up: unexpected status code ${o.res.statusCode}`)?this.doSignUpFree(e):{errorCode:o.res.statusCode}}let n=null;try{n=await E_(o)}catch{}if(!n)return await this.onUnknownSignUpError(d(16669,null),"[chat entitlement] sign-up: response has no content")?this.doSignUpFree(e):{errorCode:2};let r;try{r=JSON.parse(n),this.logService.trace(`[chat entitlement] sign-up: response is ${n}`)}catch(s){return await this.onUnknownSignUpError(d(16668,null),`[chat entitlement] sign-up: error parsing response (${s})`)?this.doSignUpFree(e):{errorCode:3}}return this.update({entitlement:5}),!!r?.subscribed}async getSessions(){let e=await this.defaultAccountService.getDefaultAccount();if(e){let o=(await this.authenticationService.getSessions(e.authenticationProvider.id)).filter(n=>n.id===e.sessionId);if(o.length)return o}return[...await this.authenticationService.getSessions(this.defaultAccountService.getDefaultAccountAuthenticationProvider().id)]}async onUnknownSignUpError(e,t){if(this.logService.error(t),!this.lifecycleService.willShutdown){let{confirmed:o}=await this.dialogService.confirm({type:gt.Error,message:d(16672,null),detail:e,primaryButton:d(16667,null)});return o}return!1}onUnprocessableSignUpError(e,t){this.logService.error(e),this.lifecycleService.willShutdown||this.dialogService.prompt({type:gt.Error,message:d(16673,null),detail:t,buttons:[{label:d(16661,null),run:()=>{}},{label:d(16660,null),run:()=>this.openerService.open(A.parse(rTt.upgradePlanUrl))}]})}async signIn(e){let t=await this.defaultAccountService.signIn({additionalScopes:e?.additionalScopes,extraAuthorizeParameters:{get_started_with:"copilot-vscode"},provider:e?.useSocialProvider});if(!t)return{};let o=await this.doResolveEntitlement(t,ve.None);return{defaultAccount:t,entitlements:o}}dispose(){this.pendingResolveCts.dispose(!0),super.dispose()}};W8e=I([m(2,Te),m(3,ne),m(4,_a),m(5,ct),m(6,Qe),m(7,ao),m(8,Um),m(9,Cs)],W8e);var uz=class extends C{constructor(e,t,o,n,r){super();this.storageService=t;this.logService=o;this.configurationService=n;this.telemetryService=r;this.suspendedState=void 0;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this.updateBarrier=void 0;this.canSignUpContextKey=xs.Entitlement.canSignUp.bindTo(e),this.signedOutContextKey=xs.Entitlement.signedOut.bindTo(e),this.freeContextKey=xs.Entitlement.planFree.bindTo(e),this.proContextKey=xs.Entitlement.planPro.bindTo(e),this.proPlusContextKey=xs.Entitlement.planProPlus.bindTo(e),this.businessContextKey=xs.Entitlement.planBusiness.bindTo(e),this.enterpriseContextKey=xs.Entitlement.planEnterprise.bindTo(e),this.organisationsContextKey=xs.Entitlement.organisations.bindTo(e),this.isInternalContextKey=xs.Entitlement.internal.bindTo(e),this.skuContextKey=xs.Entitlement.sku.bindTo(e),this.hiddenContext=xs.Setup.hidden.bindTo(e),this.laterContext=xs.Setup.later.bindTo(e),this.installedContext=xs.Setup.installed.bindTo(e),this.disabledContext=xs.Setup.disabled.bindTo(e),this.untrustedContext=xs.Setup.untrusted.bindTo(e),this.registeredContext=xs.Setup.registered.bindTo(e),this._state=this.storageService.getObject(uz.CHAT_ENTITLEMENT_CONTEXT_STORAGE_KEY,0)??{entitlement:1,organisations:void 0,sku:void 0,copilotTrackingId:void 0},this.updateContextSync(),this.registerListeners()}static{this.CHAT_ENTITLEMENT_CONTEXT_STORAGE_KEY="chat.setupContext"}static{this.CHAT_DISABLED_CONFIGURATION_KEY="chat.disableAIFeatures"}get state(){return this.withConfiguration(this.suspendedState??this._state)}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration(uz.CHAT_DISABLED_CONFIGURATION_KEY)&&this.updateContext()}))}withConfiguration(e){return this.configurationService.getValue(uz.CHAT_DISABLED_CONFIGURATION_KEY)===!0?{...e,hidden:!0}:e}async update(e){this.logService.trace(`[chat entitlement context] update(): ${JSON.stringify(e)}`);let t=JSON.stringify(this._state);if(typeof e.installed=="boolean"&&typeof e.disabled=="boolean"&&typeof e.untrusted=="boolean"&&(this._state.installed=e.installed,this._state.disabled=e.disabled,this._state.untrusted=e.untrusted,e.installed&&!e.disabled&&(e.hidden=!1)),typeof e.hidden=="boolean"&&(this._state.hidden=e.hidden),typeof e.later=="boolean"&&(this._state.later=e.later),typeof e.entitlement=="number"&&(this._state.entitlement=e.entitlement,this._state.organisations=e.organisations,this._state.sku=e.sku,this._state.copilotTrackingId=e.copilotTrackingId,this._state.entitlement===5||dP(this._state.entitlement)?this._state.registered=!0:this._state.entitlement===3&&(this._state.registered=!1)),Sdi(this.configurationService,this._state.entitlement,this._state)&&(this._state.sku="no_auth_limited_copilot"),t!==JSON.stringify(this._state))return this.storageService.store(uz.CHAT_ENTITLEMENT_CONTEXT_STORAGE_KEY,{...this._state,later:void 0},0,1),this.updateContext()}async updateContext(){await this.updateBarrier?.wait(),this.updateContextSync()}updateContextSync(){let e=this.withConfiguration(this._state);this.signedOutContextKey.set(e.entitlement===1),this.canSignUpContextKey.set(e.entitlement===3),this.freeContextKey.set(e.entitlement===5),this.proContextKey.set(e.entitlement===6),this.proPlusContextKey.set(e.entitlement===7),this.businessContextKey.set(e.entitlement===8),this.enterpriseContextKey.set(e.entitlement===9),this.organisationsContextKey.set(e.organisations),this.isInternalContextKey.set(!!e.organisations?.some(t=>t==="github"||t==="microsoft"||t==="ms-copilot"||t==="MicrosoftCopilot")),this.skuContextKey.set(e.sku),this.hiddenContext.set(!!e.hidden),this.laterContext.set(!!e.later),this.installedContext.set(!!e.installed),this.disabledContext.set(!!e.disabled),this.untrustedContext.set(!!e.untrusted),this.registeredContext.set(!!e.registered),this.logService.trace(`[chat entitlement context] updateContext(): ${JSON.stringify(e)}`),cYi(e,this.configurationService,this.telemetryService),this._onDidChange.fire()}suspend(){this.suspendedState={...this._state},this.updateBarrier=new Np}resume(){this.suspendedState=void 0,this.updateBarrier?.open(),this.updateBarrier=void 0}};uz=I([m(0,X),m(1,le),m(2,ne),m(3,B),m(4,Te)],uz);we(vr,F8e,0);var qp="local",aTt="agent";function L_(a){return a===2||a===3}function ike(a){let i=a;return i&&i.uri instanceof A&&typeof i.insertions=="number"&&typeof i.deletions=="number"}var Ls=ae("chatSessionsService");var cc=(t=>(t.Ask="ask",t.Edit="edit",t.Agent="agent",t))(cc||{});function dYi(a){switch(a){case"ask":case"edit":case"agent":return a;default:return}}function pz(a){return a==="autoApprove"||a==="autopilot"}var ks=(o=>(o.Chat="panel",o.Terminal="terminal",o.Notebook="notebook",o.EditorInline="editor",o))(ks||{});(i=>{function a(e){switch(e){case"panel":return"panel";case"terminal":return"terminal";case"notebook":return"notebook";case"editor":return"editor"}return"panel"}i.fromRaw=a})(ks||={});var r1o=new Set([Y.vscodeChatEditor,Y.walkThrough,Y.vscodeLocalChatSession,Y.vscodeSettings,Y.webviewPanel,Y.vscodeUserData,Y.extension,"ccreq","openai-codex"]);function oke(a,i){let e=a.get(Ls);return!(r1o.has(i)||e.getContentProviderSchemes().includes(i))}var V8e="workbench.action.chat.manage",uYi=30;var nke=new Q("inModelsEditor",!1),lTt=new Q("inModelsSearch",!1);var ie;(oo=>{oo.responseVote=new Q("chatSessionResponseVote","",{type:"string",description:d(7582,null)}),oo.responseDetectedAgentCommand=new Q("chatSessionResponseDetectedAgentOrCommand",!1,{type:"boolean",description:d(7562,null)}),oo.responseSupportsIssueReporting=new Q("chatResponseSupportsIssueReporting",!1,{type:"boolean",description:d(7554,null)}),oo.responseIsFiltered=new Q("chatSessionResponseFiltered",!1,{type:"boolean",description:d(7553,null)}),oo.responseHasError=new Q("chatSessionResponseError",!1,{type:"boolean",description:d(7552,null)}),oo.requestInProgress=new Q("chatSessionRequestInProgress",!1,{type:"boolean",description:d(7581,null)}),oo.currentlyEditing=new Q("chatSessionCurrentlyEditing",!1,{type:"boolean",description:d(7579,null)}),oo.currentlyEditingInput=new Q("chatSessionCurrentlyEditingInput",!1,{type:"boolean",description:d(7580,null)});let l;(_r=>(_r.Sent="s",_r.QueueOrSteer="qs"))(l=oo.EditingRequestType||={}),oo.editingRequestType=new Q("chatEditingSentRequest",void 0,{type:"string",description:d(7528,null)}),oo.isResponse=new Q("chatResponse",!1,{type:"boolean",description:d(7551,null)}),oo.isRequest=new Q("chatRequest",!1,{type:"boolean",description:d(7549,null)}),oo.isPendingRequest=new Q("chatRequestIsPending",!1,{type:"boolean",description:d(7550,null)}),oo.itemId=new Q("chatItemId","",{type:"string",description:d(7538,null)}),oo.lastItemId=new Q("chatLastItemId",[],{type:"string",description:d(7539,null)}),oo.editApplied=new Q("chatEditApplied",!1,{type:"boolean",description:d(7522,null)}),oo.inputHasText=new Q("chatInputHasText",!1,{type:"boolean",description:d(7578,null)}),oo.inputHasFocus=new Q("chatInputHasFocus",!1,{type:"boolean",description:d(7577,null)}),oo.inChatInput=new Q("inChatInput",!1,{type:"boolean",description:d(7575,null)}),oo.inChatSession=new Q("inChat",!1,{type:"boolean",description:d(7569,null)}),oo.inChatQuestionCarousel=new Q("inChatQuestionCarousel",!1,{type:"boolean",description:d(7571,null)}),oo.inChatEditor=new Q("inChatEditor",!1,{type:"boolean",description:d(7570,null)}),oo.inChatTodoList=new Q("inChatTodoList",!1,{type:"boolean",description:d(7574,null)}),oo.inChatTip=new Q("inChatTip",!1,{type:"boolean",description:d(7573,null)}),oo.multipleChatTips=new Q("multipleChatTips",!1,{type:"boolean",description:d(7584,null)}),oo.inChatTerminalToolOutput=new Q("inChatTerminalToolOutput",!1,{type:"boolean",description:d(7572,null)}),oo.chatModeKind=new Q("chatAgentKind","ask",{type:"string",description:d(7508,null)}),oo.chatPermissionLevel=new Q("chatPermissionLevel","default",{type:"string",description:d(7547,null)}),oo.chatModeName=new Q("chatModeName","",{type:"string",description:d(7542,null)}),oo.chatModelId=new Q("chatModelId","",{type:"string",description:d(7540,null)}),oo.supported=x.or(ep.negate(),ub.notEqualsTo(""),x.has("config.chat.experimental.serverlessWebEnabled")),oo.enabled=new Q("chatIsEnabled",!1,{type:"boolean",description:d(7536,null)}),oo.lockedToCodingAgent=new Q("lockedToCodingAgent",!1,{type:"boolean",description:d(7583,null)}),oo.chatSessionHasCustomAgentTarget=new Q("chatSessionHasCustomAgentTarget",!1,{type:"boolean",description:d(7556,null)}),oo.chatSessionHasTargetedModels=new Q("chatSessionHasTargetedModels",!1,{type:"boolean",description:d(7559,null)}),oo.agentSupportsAttachments=new Q("agentSupportsAttachments",!1,{type:"boolean",description:d(7519,null)}),oo.withinEditSessionDiff=new Q("withinEditSessionDiff",!1,{type:"boolean",description:d(7586,null)}),oo.filePartOfEditSession=new Q("filePartOfEditSession",!1,{type:"boolean",description:d(7566,null)}),oo.extensionParticipantRegistered=new Q("chatPanelExtensionParticipantRegistered",!1,{type:"boolean",description:d(7544,null)}),oo.panelParticipantRegistered=new Q("chatPanelParticipantRegistered",!1,{type:"boolean",description:d(7546,null)}),oo.chatEditingCanUndo=new Q("chatEditingCanUndo",!1,{type:"boolean",description:d(7524,null)}),oo.chatEditingCanRedo=new Q("chatEditingCanRedo",!1,{type:"boolean",description:d(7523,null)}),oo.languageModelsAreUserSelectable=new Q("chatModelsAreUserSelectable",!1,{type:"boolean",description:d(7541,null)}),oo.chatSessionHasModels=new Q("chatSessionHasModels",!1,{type:"boolean",description:d(7558,null)}),oo.chatSessionOptionsValid=new Q("chatSessionOptionsValid",!0,{type:"boolean",description:d(7561,null)}),oo.extensionInvalid=new Q("chatExtensionInvalid",!1,{type:"boolean",description:d(7529,null)}),oo.inputCursorAtTop=new Q("chatCursorAtTop",!1),oo.inputHasAgent=new Q("chatInputHasAgent",!1),oo.location=new Q("chatLocation",void 0),oo.inQuickChat=new Q("quickChatHasFocus",!1,{type:"boolean",description:d(7576,null)}),oo.inAgentSessionsWelcome=new Q("inAgentSessionsWelcome",!1,{type:"boolean",description:d(7568,null)}),oo.chatSessionType=new Q("chatSessionType","",{type:"string",description:d(7563,null)}),oo.hasFileAttachments=new Q("chatHasFileAttachments",!1,{type:"boolean",description:d(7533,null)}),oo.chatSessionIsEmpty=new Q("chatSessionIsEmpty",!0,{type:"boolean",description:d(7560,null)}),oo.hasPendingRequests=new Q("chatHasPendingRequests",!1,{type:"boolean",description:d(7534,null)}),oo.chatSessionHasDebugData=new Q("chatSessionHasDebugData",!1,{type:"boolean",description:d(7557,null)}),oo.chatSessionHasAttachedDebugData=new Q("chatSessionHasAttachedDebugData",!1,{type:"boolean",description:d(7555,null)}),oo.remoteJobCreating=new Q("chatRemoteJobCreating",!1,{type:"boolean",description:d(7548,null)}),oo.hasRemoteCodingAgent=new Q("hasRemoteCodingAgent",!1,d(7567,null)),oo.hasCanDelegateProviders=new Q("chatHasCanDelegateProviders",!1,{type:"boolean",description:d(7532,null)}),oo.enableRemoteCodingAgentPromptFileOverlay=new Q("enableRemoteCodingAgentPromptFileOverlay",!1,d(7565,null)),oo.skipChatRequestInProgressMessage=new Q("chatSkipRequestInProgressMessage",!1,{type:"boolean",description:d(7564,null)}),oo.Setup=xs.Setup,oo.Entitlement=xs.Entitlement,oo.chatQuotaExceeded=xs.chatQuotaExceeded,oo.completionsQuotaExceeded=xs.completionsQuotaExceeded,oo.Editing={hasToolConfirmation:new Q("chatHasToolConfirmation",!1,{type:"boolean",description:d(7527,null)}),hasElicitationRequest:new Q("chatHasElicitationRequest",!1,{type:"boolean",description:d(7525,null)}),hasQuestionCarousel:new Q("chatHasQuestionCarousel",!1,{type:"boolean",description:d(7526,null)})},oo.Tools={toolsCount:new Q("toolsCount",0,{type:"number",description:d(7585,null)})},oo.foregroundSessionCount=new Q("chatForegroundSessionCount",0,{type:"number",description:d(7530,null)}),oo.Modes={hasCustomChatModes:new Q("chatHasCustomAgents",!1,{type:"boolean",description:d(7531,null)}),agentModeDisabledByPolicy:new Q("chatAgentModeDisabledByPolicy",!1,{type:"boolean",description:d(7520,null)})},oo.panelLocation=new Q("chatPanelLocation",void 0,{type:"number",description:d(7545,null)}),oo.agentSessionsViewerFocused=new Q("agentSessionsViewerFocused",!0,{type:"boolean",description:d(7514,null)}),oo.agentSessionsViewerOrientation=new Q("agentSessionsViewerOrientation",void 0,{type:"number",description:d(7515,null)}),oo.agentSessionsViewerPosition=new Q("agentSessionsViewerPosition",void 0,{type:"number",description:d(7516,null)}),oo.agentSessionsViewerVisible=new Q("agentSessionsViewerVisible",void 0,{type:"boolean",description:d(7517,null)}),oo.agentSessionType=new Q("chatSessionType","",{type:"string",description:d(7518,null)}),oo.agentSessionSection=new Q("agentSessionSection","",{type:"string",description:d(7513,null)}),oo.isArchivedAgentSession=new Q("agentSessionIsArchived",!1,{type:"boolean",description:d(7511,null)}),oo.isReadAgentSession=new Q("agentSessionIsRead",!1,{type:"boolean",description:d(7512,null)}),oo.hasMultipleAgentSessionsSelected=new Q("agentSessionHasMultipleSelected",!1,{type:"boolean",description:d(7510,null)}),oo.hasAgentSessionChanges=new Q("agentSessionHasChanges",!1,{type:"boolean",description:d(7509,null)}),oo.isKatexMathElement=new Q("chatIsKatexMathElement",!1,{type:"boolean",description:d(7537,null)}),oo.hasUsedCreateSlashCommands=new Q("chatHasUsedCreateSlashCommands",!1,{type:"boolean",description:d(7535,null)}),oo.contextUsageHasBeenOpened=new Q("chatContextUsageHasBeenOpened",!1,{type:"boolean",description:d(7521,null)}),oo.newChatButtonExperimentIcon=new Q("chatNewChatButtonExperimentIcon","",{type:"string",description:d(7543,null)})})(ie||={});var Idi;(e=>(e.inEditingMode=x.or(ie.chatModeKind.isEqualTo("edit"),ie.chatModeKind.isEqualTo("agent")),e.chatSetupTriggerContext=x.or(ie.Setup.installed.negate(),ie.Entitlement.canSignUp)))(Idi||={});var Wj=ae("ILanguageModelsConfigurationService");var R_;(t=>{function a(o){return(typeof o.capabilities?.agentMode>"u"||o.capabilities.agentMode)&&!!o.capabilities?.toolCalling}t.suitableForAgentMode=a;function i(o){return`${o.name} (${o.vendor})`}t.asQualifiedName=i;function e(o,n){return n.vendor==="copilot"&&o===n.name?!0:o===i(n)}t.matchesQualifiedName=e})(R_||={});async function Tce(a){let i="",e=(async()=>{if(a?.stream)for await(let t of a.stream)if(Array.isArray(t))for(let o of t)o.type==="text"&&(i+=o.value);else t.type==="text"&&(i+=t.value)})();try{return await Promise.all([a.result,e]),i}catch(t){if(i)return i;throw t}}function hYi(a){if(typeof a!="object"||a===null)return!1;let i=a;return(i.name===void 0||typeof i.name=="string")&&(i.id===void 0||typeof i.id=="string")&&(i.vendor===void 0||typeof i.vendor=="string")&&(i.version===void 0||typeof i.version=="string")&&(i.family===void 0||typeof i.family=="string")&&(i.tokens===void 0||typeof i.tokens=="number")&&(i.extension===void 0||typeof i.extension=="object")}var Wr=ae("ILanguageModelsService"),pYi={type:"object",required:["vendor","displayName"],properties:{vendor:{type:"string",description:d(7613,null)},displayName:{type:"string",description:d(7609,null)},configuration:{type:"object",description:d(7607,null),anyOf:[{$ref:"http://json-schema.org/draft-07/schema#"},{properties:{properties:{type:"object",additionalProperties:{$ref:"http://json-schema.org/draft-07/schema#",properties:{secret:{type:"boolean",description:d(7608,null)}}}},additionalProperties:{$ref:"http://json-schema.org/draft-07/schema#",properties:{secret:{type:"boolean",description:d(7608,null)}}}}}]},managementCommand:{type:"string",description:d(7611,null),deprecated:!0,deprecationMessage:d(7612,null)},when:{type:"string",description:d(7615,null)}}},s1o=Tn.registerExtensionPoint({extensionPoint:"languageModelChatProviders",jsonSchema:{description:d(7606,null),oneOf:[pYi,{type:"array",items:pYi}]},activationEventsGenerator:function*(a){for(let i of a)yield`onLanguageModelChatProvider:${i.vendor}`}}),ydi="chatModelPickerPreferences",mYi="chatModelRecentlyUsed",wdi="chat.participantNameRegistry",Cdi="chat.modelsControl",Vj=class{constructor(i,e,t,o,n,r,s,l,c){this._extensionService=i;this._logService=e;this._storageService=t;this._contextKeyService=o;this._languageModelsConfigurationService=n;this._quickInputService=r;this._secretStorageService=s;this._productService=l;this._requestService=c;this._store=new P;this._providers=new Map;this._vendors=new Map;this._onDidChangeLanguageModelVendors=this._store.add(new E);this.onDidChangeLanguageModelVendors=this._onDidChangeLanguageModelVendors.event;this._modelsGroups=new Map;this._modelCache=new Map;this._resolveLMSequencer=new NT;this._modelPickerUserPreferences={};this._onLanguageModelChange=this._store.add(new E);this.onDidChangeLanguageModels=this._onLanguageModelChange.event;this._recentlyUsedModelIds=[];this._onDidChangeModelsControlManifest=this._store.add(new E);this.onDidChangeModelsControlManifest=this._onDidChangeModelsControlManifest.event;this._modelsControlManifest={free:{},paid:{}};this._chatControlDisposed=!1;this._restrictedChatParticipants=Le(this,Object.create(null));this.restrictedChatParticipants=this._restrictedChatParticipants;this._hasUserSelectableModels=ie.languageModelsAreUserSelectable.bindTo(o),this._modelPickerUserPreferences=this._readModelPickerPreferences(),this._recentlyUsedModelIds=this._readRecentlyUsedModels(),this._initChatControlData(),this._store.add(this._storageService.onDidChangeValue(0,ydi,this._store)(()=>this._onDidChangeModelPickerPreferences())),this._store.add(this.onDidChangeLanguageModels(()=>{this._hasUserSelectableModels.set(this._modelCache.size>0&&Array.from(this._modelCache.values()).some(u=>u.isUserSelectable)),this._refreshModelsControlManifest()})),this._store.add(this._languageModelsConfigurationService.onDidChangeLanguageModelGroups(u=>this._onDidChangeLanguageModelGroups(u))),this._store.add(s1o.setHandler((u,{added:p,removed:h})=>{let g=[],f=[];for(let v of p)for(let b of ht.wrap(v.value)){if(this._vendors.has(b.vendor)){v.collector.error(d(7614,null,b.vendor));continue}if(Jl(b.vendor)){v.collector.error(d(7610,null));continue}if(b.vendor.trim()!==b.vendor){v.collector.error(d(7616,null));continue}g.push(b)}for(let v of h)for(let b of ht.wrap(v.value))f.push(b);this.deltaLanguageModelChatProviderDescriptors(g,f)}))}static{this.SECRET_KEY_PREFIX="chat.lm.secret."}static{this.SECRET_INPUT="${input:{0}}"}deltaLanguageModelChatProviderDescriptors(i,e){let t=[],o=[];for(let n of i){if(this._vendors.has(n.vendor)){this._logService.error(`The vendor '${n.vendor}' is already registered and cannot be registered twice`);continue}if(Jl(n.vendor)){this._logService.error("The vendor field cannot be empty.");continue}if(n.vendor.trim()!==n.vendor){this._logService.error("The vendor field cannot start or end with whitespace.");continue}let r={vendor:n.vendor,displayName:n.displayName,configuration:n.configuration,managementCommand:n.managementCommand,when:n.when,isDefault:n.vendor==="copilot"};this._vendors.set(n.vendor,r),t.push(n.vendor),this._hasStoredModelForVendor(n.vendor)&&this._extensionService.activateByEvent(`onLanguageModelChatProvider:${n.vendor}`)}for(let n of e)this._vendors.delete(n.vendor),this._providers.delete(n.vendor),this._clearModelCache(n.vendor),o.push(n.vendor);for(let[n,r]of this._providers)this._vendors.has(n)||this._providers.delete(n);if((t.length>0||o.length>0)&&(this._onDidChangeLanguageModelVendors.fire([...t,...o]),o.length>0))for(let n of o)this._onLanguageModelChange.fire(n)}async _onDidChangeLanguageModelGroups(i){let e=new Set(i.map(t=>t.vendor));await Promise.all(Array.from(e).map(t=>this._resolveAllLanguageModels(t,!0)))}_readModelPickerPreferences(){return this._storageService.getObject(ydi,0,{})}_onDidChangeModelPickerPreferences(){let i=this._readModelPickerPreferences(),e=this._modelPickerUserPreferences,t=new Set,o=!1;for(let n in i)if(e[n]!==i[n]){o=!0;let r=this._modelCache.get(n);r&&t.add(r.vendor)}for(let n in e)if(!i.hasOwnProperty(n)){o=!0;let r=this._modelCache.get(n);r&&t.add(r.vendor)}if(o){this._logService.trace("[LM] Updated model picker preferences from storage"),this._modelPickerUserPreferences=i;for(let n of t)this._onLanguageModelChange.fire(n)}}_hasStoredModelForVendor(i){return Object.keys(this._modelPickerUserPreferences).some(e=>e.startsWith(i))}_saveModelPickerPreferences(){this._storageService.store(ydi,this._modelPickerUserPreferences,0,0)}updateModelPickerPreference(i,e){let t=this._modelCache.get(i);if(!t){this._logService.warn(`[LM] Cannot update model picker preference for unknown model ${i}`);return}this._modelPickerUserPreferences[i]=e,e===t.isUserSelectable?(delete this._modelPickerUserPreferences[i],this._saveModelPickerPreferences()):t.isUserSelectable!==e&&this._saveModelPickerPreferences(),this._onLanguageModelChange.fire(t.vendor),this._logService.trace(`[LM] Updated model picker preference for ${i} to ${e}`)}getVendors(){return Array.from(this._vendors.values()).filter(i=>{if(!i.when)return!0;let e=x.deserialize(i.when);return e?this._contextKeyService.contextMatchesRules(e):!1})}getLanguageModelIds(){return Array.from(this._modelCache.keys())}lookupLanguageModel(i){let e=this._modelCache.get(i);return e&&this._modelPickerUserPreferences[i]!==void 0?{...e,isUserSelectable:this._modelPickerUserPreferences[i]}:e}lookupLanguageModelByQualifiedName(i){for(let[e,t]of this._modelCache.entries())if(R_.matchesQualifiedName(i,t))return{metadata:t,identifier:e}}async _resolveAllLanguageModels(i,e){let t=this._vendors.get(i);if(!t)return;await this._extensionService.activateByEvent(`onLanguageModelChatProvider:${i}`);let o=this._providers.get(i);if(!o){this._logService.warn(`[LM] No provider registered for vendor ${i}`);return}return this._resolveLMSequencer.queue(i,async()=>{let n=[],r=[];try{let u=await o.provideLanguageModelChatInfo({silent:e},ve.None);if(u.length){n.push(...u);let p=[];for(let h of u)t.isDefault?h.metadata.isUserSelectable||this._modelPickerUserPreferences[h.identifier]===!0?p.push(h.identifier):this._logService.trace(`[LM] Skipping model ${h.identifier} from model picker as it is not user selectable.`):p.push(h.identifier);r.push({modelIdentifiers:p})}}catch(u){r.push({modelIdentifiers:[],status:{message:Cn(u),severity:gt.Error}})}let s=this._languageModelsConfigurationService.getLanguageModelsProviderGroups();for(let u of s){if(u.vendor!==i)continue;let p=await this._resolveConfiguration(u,t.configuration);try{let h=await o.provideLanguageModelChatInfo({group:u.name,silent:e,configuration:p},ve.None);h.length&&(n.push(...h),r.push({group:u,modelIdentifiers:h.map(g=>g.identifier)}))}catch(h){r.push({group:u,modelIdentifiers:[],status:{message:Cn(h),severity:gt.Error}})}}this._modelsGroups.set(i,r);let l=this._clearModelCache(i),c=!1;for(let u of n){if(this._modelCache.has(u.identifier)){this._logService.warn(`[LM] Model ${u.identifier} is already registered. Skipping.`);continue}this._modelCache.set(u.identifier,u.metadata),c=c||!uo(l.get(u.identifier),u.metadata),l.delete(u.identifier)}this._logService.trace(`[LM] Resolved language models for vendor ${i}`,n),c=c||l.size>0,c?this._onLanguageModelChange.fire(i):this._logService.trace(`[LM] No changes in language models for vendor ${i}`)})}getLanguageModelGroups(i){return this._modelsGroups.get(i)??[]}async selectLanguageModels(i){if(i.vendor)await this._resolveAllLanguageModels(i.vendor,!0);else{let t=Array.from(this._vendors.keys());await Promise.all(t.map(o=>this._resolveAllLanguageModels(o,!0)))}let e=[];for(let[t,o]of this._modelCache)(i.vendor===void 0||o.vendor===i.vendor)&&(i.family===void 0||o.family===i.family)&&(i.version===void 0||o.version===i.version)&&(i.id===void 0||o.id===i.id)&&e.push(t);return this._logService.trace("[LM] selected language models",i,e),e}registerLanguageModelProvider(i,e){if(this._logService.trace("[LM] registering language model provider",i,e),!this._vendors.has(i))throw new Error(`Chat model provider uses UNKNOWN vendor ${i}.`);if(this._providers.has(i))throw new Error(`Chat model provider for vendor ${i} is already registered.`);this._providers.set(i,e),this._hasStoredModelForVendor(i)&&this._resolveAllLanguageModels(i,!0);let t=e.onDidChange(()=>{this._resolveAllLanguageModels(i,!0)});return Z(()=>{this._logService.trace("[LM] UNregistered language model provider",i),this._clearModelCache(i),this._providers.delete(i),t.dispose()})}async sendChatRequest(i,e,t,o,n){let r=this._providers.get(this._modelCache.get(i)?.vendor||"");if(!r)throw new Error(`Chat provider for model ${i} is not registered.`);return r.sendChatRequest(i,t,e,o,n)}computeTokenLength(i,e,t){let o=this._modelCache.get(i);if(!o)throw new Error(`Chat model ${i} could not be found.`);let n=this._providers.get(o.vendor);if(!n)throw new Error(`Chat provider for model ${i} is not registered.`);return n.provideTokenCount(i,e,t)}async configureLanguageModelsProviderGroup(i,e){let t=this.getVendors().find(({vendor:l})=>l===i);if(!t)throw new Error(`Vendor ${i} not found.`);if(t.managementCommand){await this._resolveAllLanguageModels(t.vendor,!1);return}let o=this._languageModelsConfigurationService.getLanguageModelsProviderGroups(),n=o.find(l=>l.vendor===i&&l.name===e),r=await this.promptForName(o,t,n);if(!r)return;let s=n?await this._resolveConfiguration(n,t.configuration):void 0;try{let l=t.configuration?await this.promptForConfiguration(r,t.configuration,s):void 0;if(t.configuration&&!l)return;let c=await this._resolveLanguageModelProviderGroup(r,i,l,t.configuration),u=n?await this._languageModelsConfigurationService.updateLanguageModelsProviderGroup(n,c):await this._languageModelsConfigurationService.addLanguageModelsProviderGroup(c);if(t.configuration&&this.requireConfiguring(t.configuration)){let p=this.getSnippetForFirstUnconfiguredProperty(l??{},t.configuration);await this._languageModelsConfigurationService.configureLanguageModels({group:u,snippet:p})}}catch(l){if(so(l))return;throw l}}async addLanguageModelsProviderGroup(i,e,t){let o=this.getVendors().find(({vendor:r})=>r===e);if(!o)throw new Error(`Vendor ${e} not found.`);let n=await this._resolveLanguageModelProviderGroup(i,e,t,o.configuration);await this._languageModelsConfigurationService.addLanguageModelsProviderGroup(n)}async removeLanguageModelsProviderGroup(i,e){let t=this.getVendors().find(({vendor:r})=>r===i);if(!t)throw new Error(`Vendor ${i} not found.`);let n=this._languageModelsConfigurationService.getLanguageModelsProviderGroups().find(r=>r.vendor===i&&r.name===e);if(!n)throw new Error(`Language model provider group ${e} for vendor ${i} not found.`);await this._deleteSecretsInConfiguration(n,t.configuration),await this._languageModelsConfigurationService.removeLanguageModelsProviderGroup(n)}requireConfiguring(i){if(i.additionalProperties)return!0;if(!i.properties)return!1;for(let e of Object.keys(i.properties))if(!this.canPromptForProperty(i.properties[e]))return!0;return!1}getSnippetForFirstUnconfiguredProperty(i,e){if(e.properties){for(let t of Object.keys(e.properties))if(i[t]===void 0){let o=e.properties[t];if(o&&typeof o!="boolean"&&o.defaultSnippets?.[0]){let n=o.defaultSnippets[0],r=n.bodyText??JSON.stringify(n.body,null," ");return r=r.replace(/"(\^[^"]*)"/g,(s,l)=>l.substring(1)),`"${t}": ${r}`}}}}async promptForName(i,e,t){let o=t?.name;if(!o){o=e.displayName;let s=1;for(;i.some(l=>l.vendor===e.vendor&&l.name===o);)s++,o=`${e.displayName} ${s}`}let n,r=new P;try{await new Promise(s=>{let l=r.add(this._quickInputService.createInputBox());l.title=d(7598,null),l.placeholder=d(7601,null),l.value=o,l.ignoreFocusOut=!0,r.add(l.onDidChangeValue(c=>{if(!c){l.validationMessage=d(7599,null),l.severity=gt.Error;return}if(!t&&i.some(u=>u.name===c)){l.validationMessage=d(7602,null),l.severity=gt.Error;return}l.validationMessage=void 0,l.severity=gt.Ignore})),r.add(l.onDidAccept(async()=>{n=l.value,l.hide()})),r.add(l.onDidHide(()=>s())),l.show()})}finally{r.dispose()}return n}async promptForConfiguration(i,e,t){if(!e.properties)return;let o=t?{...t}:{};for(let n of Object.keys(e.properties)){let r=e.properties[n],s=!!e.required?.includes(n),l=await this.promptForValue(i,n,r,s,t);l!==void 0&&(o[n]=l)}return o}async promptForValue(i,e,t,o,n){if(!t||!this.canPromptForProperty(t))return;if(t.type==="array"&&t.items&&!Array.isArray(t.items)&&t.items.enum){let s=await this.promptForArray(i,e,t);return s===void 0?void 0:s}let r=await this.promptForInput(i,e,t,o,n);if(r!==void 0)return r}canPromptForProperty(i){return!i||typeof i=="boolean"?!1:!!(i.type==="array"&&i.items&&!Array.isArray(i.items)&&i.items.enum||i.type==="string"||i.type==="number"||i.type==="integer"||i.type==="boolean")}async promptForArray(i,e,t){if(!t.items||Array.isArray(t.items)||!t.items.enum)return;let o=t.items.enum,n=new P;try{return await new Promise(r=>{let s=n.add(this._quickInputService.createQuickPick());s.title=`${i}: ${t.title??e}`,s.items=o.map(l=>({label:l})),s.placeholder=t.description??d(7604,null,e),s.canSelectMany=!0,s.ignoreFocusOut=!0,n.add(s.onDidAccept(()=>{r(s.selectedItems.map(l=>l.label)),s.hide()})),n.add(s.onDidHide(()=>{r(void 0)})),s.show()})}finally{n.dispose()}}async promptForInput(i,e,t,o,n){let r=new P;try{let s=await new Promise((l,c)=>{let u=r.add(this._quickInputService.createInputBox());u.title=`${i}: ${t.title??e}`,u.placeholder=d(7600,null,e),u.password=!!t.secret,u.ignoreFocusOut=!0,n?.[e]?u.value=String(n?.[e]):t.default&&(u.value=String(t.default)),t.description&&(u.prompt=t.description),r.add(u.onDidChangeValue(p=>{if(!p&&o){u.validationMessage=d(7605,null),u.severity=gt.Error;return}if((t.type==="number"||t.type==="integer")&&isNaN(Number(p))){u.validationMessage=d(7603,null),u.severity=gt.Error;return}if(t.type==="boolean"&&p!=="true"&&p!=="false"){u.validationMessage=d(7597,null),u.severity=gt.Error;return}u.validationMessage=void 0,u.severity=gt.Ignore})),r.add(u.onDidAccept(()=>{if(!u.value&&o){u.validationMessage=d(7605,null),u.severity=gt.Error;return}l(u.value),u.hide()})),r.add(u.onDidHide(p=>{p.reason===2?c(new ho):l(void 0)})),u.show()});return s?t.type==="number"||t.type==="integer"?Number(s):t.type==="boolean"?s==="true":s:void 0}finally{r.dispose()}}encodeSecretKey(i){return id(Vj.SECRET_INPUT,i)}decodeSecretKey(i){if(Ae(i))return i.substring(i.indexOf(":")+1,i.length-1)}_clearModelCache(i){let e=new Map;for(let[t,o]of this._modelCache.entries())o.vendor===i&&(e.set(t,o),this._modelCache.delete(t));return e}async _resolveConfiguration(i,e){if(!e)return{};let t={};for(let o in i){if(o==="vendor"||o==="name"||o==="range")continue;let n=i[o];if(e.properties?.[o]?.secret){let r=this.decodeSecretKey(n);n=r?await this._secretStorageService.get(r):void 0}t[o]=n}return t}async _resolveLanguageModelProviderGroup(i,e,t,o){if(!o)return{name:i,vendor:e};let n={};for(let r in t){let s=t[r];if(o.properties?.[r]?.secret&&Ae(s)){let l=`${Vj.SECRET_KEY_PREFIX}${Ir(_t()).toString(16)}`;await this._secretStorageService.set(l,s),s=this.encodeSecretKey(l)}n[r]=s}return{name:i,vendor:e,...n}}async _deleteSecretsInConfiguration(i,e){if(!e)return;let{vendor:t,name:o,range:n,...r}=i;for(let s in r){let l=i[s];if(e.properties?.[s]?.secret){let c=this.decodeSecretKey(l);c&&await this._secretStorageService.delete(c)}}}async migrateLanguageModelsProviderGroup(i){let{vendor:e,name:t,...o}=i;if(!this._vendors.get(e))throw new Error(`Vendor ${e} not found.`);await this._extensionService.activateByEvent(`onLanguageModelChatProvider:${e}`);let n=this._providers.get(e);if(!n)throw new Error(`Chat model provider for vendor ${e} is not registered.`);let r=await n.provideLanguageModelChatInfo({group:t,silent:!1,configuration:o},ve.None);for(let s of r){let l=`${e}/${s.metadata.id}`;this._modelPickerUserPreferences[l]===!0&&(this._modelPickerUserPreferences[s.identifier]=!0),delete this._modelPickerUserPreferences[l]}this._saveModelPickerPreferences(),await this.addLanguageModelsProviderGroup(t,e,o)}_readRecentlyUsedModels(){return this._storageService.getObject(mYi,0,[])}_saveRecentlyUsedModels(){this._storageService.store(mYi,this._recentlyUsedModelIds,0,0)}getRecentlyUsedModelIds(){return this._recentlyUsedModelIds.filter(i=>this._modelCache.has(i)&&i!=="copilot/auto").slice(0,4)}addToRecentlyUsedList(i){if(i==="copilot/auto")return;let e=this._recentlyUsedModelIds.indexOf(i);e!==-1&&this._recentlyUsedModelIds.splice(e,1),this._recentlyUsedModelIds.unshift(i),this._recentlyUsedModelIds.length>20&&(this._recentlyUsedModelIds.length=20),this._saveRecentlyUsedModels()}clearRecentlyUsedList(){this._recentlyUsedModelIds=[],this._saveRecentlyUsedModels()}getModelsControlManifest(){return this._modelsControlManifest}_setModelsControlManifest(i){this._modelsControlRawResponse=i,this._refreshModelsControlManifest()}_refreshModelsControlManifest(){let i=this._modelsControlRawResponse,e={},t={};if(i?.free){let o=Array.isArray(i.free)?i.free:Object.values(i.free);for(let n of o)!n||!yi(n)||(e[n.id]={label:n.label,featured:n.featured,exists:this._modelExistsInCache(n.id)})}if(i?.paid){let o=Array.isArray(i.paid)?i.paid:Object.values(i.paid);for(let n of o)!n||!yi(n)||(t[n.id]={label:n.label,featured:n.featured,minVSCodeVersion:n.minVSCodeVersion,exists:this._modelExistsInCache(n.id)})}this._modelsControlManifest={free:e,paid:t},this._onDidChangeModelsControlManifest.fire(this._modelsControlManifest)}_modelExistsInCache(i){for(let e of this._modelCache.values())if(e.id===i)return!0;return!1}_initChatControlData(){if(this._chatControlUrl=this._productService.chatParticipantRegistry,!this._chatControlUrl)return;let i=this._storageService.get(wdi,-1);try{this._restrictedChatParticipants.set(JSON.parse(i??"{}"),void 0)}catch{this._storageService.remove(wdi,-1)}let e=this._storageService.get(Cdi,-1);try{let t=JSON.parse(e??"{}");yi(t)&&this._setModelsControlManifest(t)}catch{this._storageService.remove(Cdi,-1)}this._refreshChatControlData()}_refreshChatControlData(){this._chatControlDisposed||this._fetchChatControlData().catch(i=>this._logService.warn("Failed to fetch chat control data",i)).then(()=>Pi(300*1e3)).then(()=>this._refreshChatControlData())}async _fetchChatControlData(){this._logService.trace("[LM] Fetching chat control data from",this._chatControlUrl);let i;try{i=await this._requestService.request({type:"GET",url:this._chatControlUrl},ve.None)}catch(o){this._logService.warn("[LM] Failed to request chat control data",Cn(o));return}if(i.res.statusCode!==200){this._logService.warn(`[LM] Chat control data request failed with status ${i.res.statusCode}`);return}let e;try{e=await hh(i)}catch(o){this._logService.warn("[LM] Failed to parse chat control response",Cn(o));return}if(this._logService.trace("[LM] Received chat control response",e?Object.keys(e):"null"),!e||e.version!==1){this._logService.warn("[LM] Unexpected chat control response version",e?.version);return}let t=e.restrictedChatParticipants;this._restrictedChatParticipants.set(t,void 0),this._storageService.store(wdi,JSON.stringify(t),-1,1),e.models&&(this._logService.trace("[LM] Updating models control manifest",{freeCount:Object.keys(e.models.free??{}).length,paidCount:Object.keys(e.models.paid??{}).length}),this._setModelsControlManifest(e.models),this._storageService.store(Cdi,JSON.stringify(e.models),-1,1))}dispose(){this._chatControlDisposed=!0,this._store.dispose(),this._providers.clear()}};Vj=I([m(0,lt),m(1,ne),m(2,le),m(3,X),m(4,Wj),m(5,Ge),m(6,LE),m(7,nt),m(8,_a)],Vj);var Gx=ae("IAuthenticationAccessService"),B8e=class extends C{constructor(e,t){super();this._storageService=e;this._productService=t;this._onDidChangeExtensionSessionAccess=this._register(new E);this.onDidChangeExtensionSessionAccess=this._onDidChangeExtensionSessionAccess.event}isAccessAllowed(e,t,o){let n=this._productService.trustedExtensionAuthAccess,r=Ei.toKey(o);if(Array.isArray(n)){if(n.includes(r))return!0}else if(n?.[e]?.includes(r))return!0;let l=this.readAllowedExtensions(e,t).find(c=>c.id===r);if(l)return l.allowed!==void 0?l.allowed:!0}readAllowedExtensions(e,t){let o=[];try{let s=this._storageService.get(`${e}-${t}`,-1);s&&(o=JSON.parse(s))}catch{}let n=this._productService.trustedExtensionAuthAccess,r=Array.isArray(n)?n:typeof n=="object"?n[e]??[]:[];for(let s of r){let l=Ei.toKey(s),c=o.find(u=>u.id===l);c?(c.allowed=!0,c.trusted=!0):o.push({id:l,name:s,allowed:!0,trusted:!0})}return o}updateAllowedExtensions(e,t,o){let n=this.readAllowedExtensions(e,t);for(let s of o){let l=Ei.toKey(s.id),c=n.findIndex(u=>u.id===l);c===-1?n.push({...s,id:l}):(n[c].allowed=s.allowed,s.name&&s.name!==l&&n[c].name!==s.name&&(n[c].name=s.name))}let r=n.filter(s=>!s.trusted);this._storageService.store(`${e}-${t}`,JSON.stringify(r),-1,0),this._onDidChangeExtensionSessionAccess.fire({providerId:e,accountName:t})}removeAllowedExtensions(e,t){this._storageService.remove(`${e}-${t}`,-1),this._onDidChangeExtensionSessionAccess.fire({providerId:e,accountName:t})}};B8e=I([m(0,le),m(1,nt)],B8e);we(Gx,B8e,1);var cTt=class{constructor(i,e,t,o,n,r,s){this._chatProviderService=e;this._logService=t;this._authenticationService=o;this._authenticationAccessService=n;this._extensionService=r;this._ignoredFilesService=s;this._store=new P;this._providerRegistrations=new jt;this._lmProviderChange=new E;this._pendingProgress=new Map;this._ignoredFileProviderRegistrations=new jt;this._proxy=i.getProxy(Zi.ExtHostChatProvider)}dispose(){this._lmProviderChange.dispose(),this._providerRegistrations.dispose(),this._ignoredFileProviderRegistrations.dispose(),this._store.dispose()}$registerLanguageModelProvider(i){let e=new P;try{e.add(this._chatProviderService.registerLanguageModelProvider(i,{onDidChange:H.filter(this._lmProviderChange.event,t=>t.vendor===i,e),provideLanguageModelChatInfo:async(t,o)=>{let n=await this._proxy.$provideLanguageModelChatInfo(i,t,o);return n.forEach(r=>{r.metadata.auth&&e.add(this._registerAuthenticationProvider(r.metadata.extension,r.metadata.auth))}),n},sendChatRequest:async(t,o,n,r,s)=>{let l=Math.random()*1e6|0,c=new Go,u=new kpt;try{this._pendingProgress.set(l,{defer:c,stream:u}),await Promise.all(o.flatMap(p=>p.content).filter(p=>p.type==="image_url").map(async p=>{p.value.data=Je.wrap(await k_(p.value.data.buffer))})),await this._proxy.$startChatRequest(t,l,n,new qh(o),r,s)}catch(p){throw this._pendingProgress.delete(l),p}return{result:c.p,stream:u.asyncIterable}},provideTokenCount:(t,o,n)=>this._proxy.$provideTokenLength(t,o,n)})),this._providerRegistrations.set(i,e)}catch(t){throw e.dispose(),t}}$onLMProviderChange(i){this._lmProviderChange.fire({vendor:i})}async $reportResponsePart(i,e){let t=this._pendingProgress.get(i);this._logService.trace("[LM] report response PART",!!t,i,e),t&&t.stream.emitOne(e.value)}async $reportResponseDone(i,e){let t=this._pendingProgress.get(i);if(this._logService.trace("[LM] report response DONE",!!t,i,e),t)if(this._pendingProgress.delete(i),e){let o=nEt.tryDeserialize(e)??n6(e);t.stream.reject(o),t.defer.error(o)}else t.stream.resolve(),t.defer.complete(void 0)}$unregisterProvider(i){this._providerRegistrations.deleteAndDispose(i)}$selectChatModels(i){return this._chatProviderService.selectLanguageModels(i)}async $tryStartChatRequest(i,e,t,o,n,r){this._logService.trace("[CHAT] request STARTED",i.value,t);let s;try{s=await this._chatProviderService.sendChatRequest(e,i,o.value,n,r)}catch(c){throw this._logService.error("[CHAT] request FAILED",i.value,t,c),c}let l=(async()=>{try{for await(let c of s.stream)this._logService.trace("[CHAT] request PART",i.value,t,c),await this._proxy.$acceptResponsePart(t,new qh(c));this._logService.trace("[CHAT] request DONE",i.value,t)}catch(c){this._logService.error("[CHAT] extension request ERRORED in STREAM",In(c,!0),i.value,t),this._proxy.$acceptResponseDone(t,QG(c))}})();Promise.allSettled([s.result,l]).then(()=>{this._logService.debug("[CHAT] extension request DONE",i.value,t),this._proxy.$acceptResponseDone(t,void 0)},c=>{this._logService.error("[CHAT] extension request ERRORED",In(c,!0),i.value,t),this._proxy.$acceptResponseDone(t,QG(c))})}$countTokens(i,e,t){return this._chatProviderService.computeTokenLength(i,e,t)}_registerAuthenticationProvider(i,e){let t=dV+i.value;if(this._authenticationService.getProviderIds().includes(t))return C.None;let o=e.accountLabel??d(3040,null),n=new P,r=new xdi(t,e.providerLabel,o);return this._authenticationService.registerAuthenticationProvider(t,r),n.add(Z(()=>{this._authenticationService.unregisterAuthenticationProvider(t),r.dispose()})),n.add(this._authenticationAccessService.onDidChangeExtensionSessionAccess(async s=>{let l=this._authenticationAccessService.readAllowedExtensions(t,o),c=[];for(let u of l){let p=await this._extensionService.getExtension(u.id);p&&c.push({from:p.identifier,to:i,enabled:u.allowed??!0})}this._proxy.$updateModelAccesslist(c)})),n}$fileIsIgnored(i,e){return this._ignoredFilesService.fileIsIgnored(A.revive(i),e)}$registerFileIgnoreProvider(i){this._ignoredFileProviderRegistrations.set(i,this._ignoredFilesService.registerIgnoredFileProvider({isFileIgnored:async(e,t)=>this._proxy.$isFileIgnored(i,e,t)}))}$unregisterFileIgnoreProvider(i){this._ignoredFileProviderRegistrations.deleteAndDispose(i)}};cTt=I([vo(Gi.MainThreadLanguageModels),m(1,Wr),m(2,ne),m(3,Cs),m(4,Gx),m(5,lt),m(6,jxe)],cTt);var xdi=class{constructor(i,e,t){this.id=i;this.label=e;this._accountLabel=t;this.supportsMultipleAccounts=!1;this._onDidChangeSessions=new E;this.onDidChangeSessions=this._onDidChangeSessions.event}async getSessions(i){return i===void 0&&!this._session?[]:this._session?[this._session]:[await this.createSession(i||[])]}async createSession(i){return this._session=this._createFakeSession(i),this._onDidChangeSessions.fire({added:[this._session],changed:[],removed:[]}),this._session}removeSession(i){return this._session&&(this._onDidChangeSessions.fire({added:[],changed:[],removed:[this._session]}),this._session=void 0),Promise.resolve()}confirmation(i,e){return d(3039,null,i,this.label)}_createFakeSession(i){return{id:"fake-session",account:{id:this.id,label:this._accountLabel},accessToken:"fake-access-token",scopes:i}}dispose(){this._onDidChangeSessions.dispose()}};var ake="copilot";var At=ae("chatWidgetService"),$x=Symbol("ChatViewPaneTarget"),M_=ae("quickChatService"),NO=ae("chatAccessibilityService");function XI(a){return typeof a.viewId=="string"}function _ce(a){return!XI(a)}var LY=ae("chatCodeBlockContextProviderService"),Vr=`workbench.panel.chat.view.${ake}`,eR="workbench.panel.chat";var cs;(r=>{r.scheme=Y.vscodeLocalChatSession;function i(s){let l=Qd(Je.wrap(new TextEncoder().encode(s)),!1,!0);return A.from({scheme:r.scheme,authority:qp,path:"/"+l})}r.forSession=i;function e(){let s=Math.floor(Math.random()*1e9);return i(`chat-${s}`)}r.getNewSessionUri=e;function t(s){let l=n(s);return l?.chatSessionType===qp?l.sessionId:void 0}r.parseLocalSessionId=t;function o(s){return!!t(s)}r.isLocalSession=o;function n(s){if(s.scheme!==r.scheme||!s.authority)return;let l=s.path.split("/");if(l.length!==2)return;let c=s.authority,u=Sl(l[1]);return{chatSessionType:c,sessionId:new TextDecoder().decode(u.buffer)}}})(cs||={});function P_(a){let i=cs.parseLocalSessionId(a);return i||a.toString()}function fg(a){return a.scheme===Y.vscodeChatEditor?qp:a.scheme===cs.scheme?a.authority||qp:a.scheme}var np=(r=>(r.Local="local",r.Background="copilotcli",r.Cloud="copilot-cloud-agent",r.Claude="claude-code",r.Codex="openai-codex",r.Growth="copilot-growth",r))(np||{});function gYi(a){return a==="local"||a==="copilotcli"||a==="copilot-cloud-agent"||a==="claude-code"}function Rf(a){let i=A.isUri(a)?fg(a):a;switch(i){case"local":case"copilotcli":case"copilot-cloud-agent":case"claude-code":case"openai-codex":return i;default:return}}function XS(a){switch(a){case"local":return d(5651,null);case"copilotcli":return d(5649,null);case"copilot-cloud-agent":return d(5650,null);case"claude-code":return"Claude";case"openai-codex":return"Codex";case"copilot-growth":return"Growth"}}function A_(a){switch(a){case"local":return M.vm;case"copilotcli":return M.worktree;case"copilot-cloud-agent":return M.cloud;case"openai-codex":return M.openai;case"claude-code":return M.claude;case"copilot-growth":return M.lightbulb}}function dTt(a){switch(a){case"local":case"copilotcli":case"copilot-cloud-agent":return!0;case"claude-code":case"openai-codex":case"copilot-growth":return!1}}function uTt(a){switch(a){case"local":case"copilotcli":case"copilot-cloud-agent":return!0;case"claude-code":case"openai-codex":case"copilot-growth":return!1}}function kdi(a){switch(a){case"local":return d(5648,null);case"copilotcli":return d(5643,null);case"copilot-cloud-agent":return d(5645,null);case"claude-code":return d(5644,null);case"openai-codex":return d(5646,null);case"copilot-growth":return d(5647,null)}}var vaa=J("agentSessionReadIndicator.foreground",{dark:ei(ko,.2),light:ei(ko,.2),hcDark:null,hcLight:null},d(5640,null)),baa=J("agentSessionSelectedBadge.border",{dark:ei(QT,.3),light:ei(QT,.3),hcDark:ko,hcLight:ko},d(5641,null)),Saa=J("agentSessionSelectedUnfocusedBadge.border",{dark:ei(ko,.3),light:ei(ko,.3),hcDark:ko,hcLight:ko},d(5642,null)),lke="agentSession.rename",cke="agentSession.delete";function Bj(a){return a.lastRequestStarted??a.created}var Tdi="chat-dynamic-variable",JS=class extends C{constructor(e,t){super();this.widget=e;this.labelService=t;this._variables=[];this.decorationData=[];this._editorListener=this._register(new me);this._subscribeToEditor(),this._register(e.onDidChangeActiveInputEditor(()=>{this._subscribeToEditor(),this.updateDecorations()}))}static{this.ID="chatDynamicVariableModel"}get variables(){return[...this._variables]}get id(){return JS.ID}_subscribeToEditor(){this._editorListener.value=this.widget.inputEditor.onDidChangeModelContent(e=>{let t=[],o=!1;this._variables=si(this._variables.map((n,r)=>{let s=this.widget.inputEditor.getModel();if(!s)return t.push(n),null;let l=this.decorationData[r];if(!l)return t.push(n),null;let c=s.getDecorationRange(l.id);return c?s.getValueInRange(c)!==l.text?(this.widget.inputEditor.executeEdits(this.id,[{range:c,text:""}]),this.widget.refreshParsedInput(),t.push(n),null):c.equalsRange(n.range)?n:(o=!0,{...n,range:c}):(t.push(n),null)})),Ue(t.filter(Ac)),(o||t.length>0)&&this.widget.refreshParsedInput(),this.updateDecorations()})}getInputState(e){e[JS.ID]=this.variables}setInputState(e){let t=e[JS.ID];Array.isArray(t)||(t=[]),this.disposeVariables(),this._variables=[];for(let o of t)l1o(o)&&this.addReference(o)}addReference(e){Edi(e.range)&&(this._variables.push(e),this.updateDecorations(),this.widget.refreshParsedInput())}updateDecorations(){let e=this.widget.inputEditor.getModel();if(!e){this.decorationData=[];return}let t=this._variables.filter(n=>Edi(n.range)),o=this.widget.inputEditor.setDecorationsByType("chat",Tdi,t.map(n=>({range:n.range,hoverMessage:this.getHoverForReference(n)})));this._variables=t.slice(0,o.length),this.decorationData=[];for(let n=0;n<o.length;n++)this.decorationData.push({id:o[n],text:e.getValueInRange(this._variables[n].range)})}getHoverForReference(e){let t=e.data;if(A.isUri(t))return new xe(this.labelService.getUriLabel(t,{relative:!0}));if(nv(t)){let o=e.fullName?` ${e.fullName}`:"",n=`#${t.range.startLineNumber}-${t.range.endLineNumber}`;return new xe(o+this.labelService.getUriLabel(t.uri,{relative:!0})+n)}else return}disposeVariables(){for(let e of this._variables)Ac(e)&&e.dispose()}dispose(){this.disposeVariables(),super.dispose()}};JS=I([m(1,ot)],JS);function l1o(a){return a&&typeof a.id=="string"&&z.isIRange(a.range)&&Edi(a.range)&&"data"in a}function Edi(a){return!(a.startLineNumber<1||a.endLineNumber<1||a.startColumn<1||a.endColumn<1||a.startLineNumber>a.endLineNumber||a.startLineNumber===a.endLineNumber&&a.startColumn>=a.endColumn)}function c1o(a){return"widget"in a&&"range"in a&&"variableData"in a}var H8e=class a extends K{static{this.ID="workbench.action.chat.addDynamicVariable"}constructor(){super({id:a.ID,title:""})}async run(i,...e){let t=e[0];if(!c1o(t))return;let o=t.range,n=t.variableData,r=()=>{t.widget.inputEditor.executeEdits("chatInsertDynamicVariableWithArguments",[{range:t.range,text:""}])};if(t.command){let l=await i.get(ge).executeCommand(t.command.id,...t.command.arguments??[]);if(!l){r();return}let c=":"+l,u=new z(o.startLineNumber,o.endColumn,o.endLineNumber,o.endColumn+c.length);if(o=new z(o.startLineNumber,o.startColumn,o.endLineNumber,o.endColumn+c.length),!t.widget.inputEditor.executeEdits("chatInsertDynamicVariableWithArguments",[{range:u,text:c+" "}])){r();return}}t.widget.getContrib(JS.ID)?.addReference({id:t.id,range:o,isFile:!0,data:n})}};W(H8e);var br=ae("chatAgentService"),dke=class extends C{constructor(e,t){super();this.contextKeyService=e;this.configurationService=t;this._agents=new Map;this._onDidChangeAgents=this._register(new E);this.onDidChangeAgents=this._onDidChangeAgents.event;this._agentsContextKeys=new Set;this._hasToolsAgent=!1;this._chatParticipantDetectionProviders=new Map;this._agentCompletionProviders=new Map;this._hasDefaultAgent=ie.enabled.bindTo(this.contextKeyService),this._extensionAgentRegistered=ie.extensionParticipantRegistered.bindTo(this.contextKeyService),this._defaultAgentRegistered=ie.panelParticipantRegistered.bindTo(this.contextKeyService),this._register(e.onDidChangeContext(o=>{o.affectsSome(this._agentsContextKeys)&&this._updateContextKeys()}))}static{this.AGENT_LEADER="@"}registerAgent(e,t){if(this.getAgent(e))throw new Error(`Agent already registered: ${JSON.stringify(e)}`);let n=this,r=t.slashCommands;t={...t,get slashCommands(){return r.filter(l=>!l.when||n.contextKeyService.contextMatchesRules(x.deserialize(l.when)))}};let s={data:t};return this._agents.set(e,s),this._updateAgentsContextKeys(),this._updateContextKeys(),this._onDidChangeAgents.fire(void 0),Z(()=>{this._agents.delete(e),this._updateAgentsContextKeys(),this._updateContextKeys(),this._onDidChangeAgents.fire(void 0)})}_updateAgentsContextKeys(){this._agentsContextKeys.clear();for(let e of this._agents.values())if(e.data.when){let t=x.deserialize(e.data.when);for(let o of t?.keys()||[])this._agentsContextKeys.add(o)}}_updateContextKeys(){let e=!1,t=!1,o=!1;for(let n of this.getAgents())n.isDefault&&(n.isCore||(e=!0),n.id==="chat.setup"||n.id==="github.copilot.editsAgent"?o=!0:t=!0);this._defaultAgentRegistered.set(t),this._extensionAgentRegistered.set(e),o!==this._hasToolsAgent&&(this._hasToolsAgent=o,this._onDidChangeAgents.fire(this.getDefaultAgent("panel","agent")))}registerAgentImplementation(e,t){let o=this._agents.get(e);if(!o)throw new Error(`Unknown agent: ${JSON.stringify(e)}`);if(o.impl)throw new Error(`Agent already has implementation: ${JSON.stringify(e)}`);return o.data.isDefault&&this._hasDefaultAgent.set(!0),o.impl=t,this._onDidChangeAgents.fire(new uke(o.data,t)),Z(()=>{o.impl=void 0,this._onDidChangeAgents.fire(void 0),o.data.isDefault&&this._hasDefaultAgent.set(ht.some(this._agents.values(),n=>n.data.isDefault&&!!n.impl))})}registerDynamicAgent(e,t){e.isDynamic=!0;let o={data:e,impl:t};return this._agents.set(e.id,o),this._onDidChangeAgents.fire(new uke(e,t)),Z(()=>{this._agents.delete(e.id),this._onDidChangeAgents.fire(void 0)})}registerAgentCompletionProvider(e,t){return this._agentCompletionProviders.set(e,t),{dispose:()=>{this._agentCompletionProviders.delete(e)}}}async getAgentCompletionItems(e,t,o){return await this._agentCompletionProviders.get(e)?.(t,o)??[]}updateAgent(e,t){let o=this._agents.get(e);if(!o?.impl)throw new Error(`No activated agent with id ${JSON.stringify(e)} registered`);o.data.metadata={...o.data.metadata,...t},this._onDidChangeAgents.fire(new uke(o.data,o.impl))}getDefaultAgent(e,t="ask"){return this._preferExtensionAgent(this.getActivatedAgents().filter(o=>t&&!o.modes.includes(t)?!1:!!o.isDefault&&o.locations.includes(e)))}get hasToolsAgent(){return!!this.configurationService.getValue("chat.agent.enabled")}getContributedDefaultAgent(e){return this._preferExtensionAgent(this.getAgents().filter(t=>!!t.isDefault&&t.locations.includes(e)))}_preferExtensionAgent(e){return ju(e,t=>!t.isCore)??e.at(-1)}getAgent(e,t=!1){if(!(!this._agentIsEnabled(e)&&!t))return this._agents.get(e)?.data}_agentIsEnabled(e){let t=typeof e=="string"?this._agents.get(e):e;return!t?.data.when||this.contextKeyService.contextMatchesRules(x.deserialize(t.data.when))}getAgentByFullyQualifiedId(e){let t=ht.find(this._agents.values(),o=>Hj(o.data)===e)?.data;if(!(t&&!this._agentIsEnabled(t.id)))return t}getAgents(){return Array.from(this._agents.values()).map(e=>e.data).filter(e=>this._agentIsEnabled(e.id))}getActivatedAgents(){return Array.from(this._agents.values()).filter(e=>!!e.impl).filter(e=>this._agentIsEnabled(e.data.id)).map(e=>new uke(e.data,e.impl))}getAgentsByName(e){return this._preferExtensionAgents(this.getAgents().filter(t=>t.name===e))}_preferExtensionAgents(e){let t=e.filter(o=>!o.isCore);return t.length>0?t:e}agentHasDupeName(e){let t=this.getAgent(e);return t?this.getAgentsByName(t.name).filter(o=>o.extensionId.value!==t.extensionId.value).length>0:!1}async invokeAgent(e,t,o,n,r){let s=this._agents.get(e);if(!s?.impl)throw new Error(`No activated agent with id "${e}"`);return await s.impl.invoke(t,o,n,r)}setRequestTools(e,t,o){let n=this._agents.get(e);if(!n?.impl)throw new Error(`No activated agent with id "${e}"`);n.impl.setRequestTools?.(t,o)}setYieldRequested(e,t,o){let n=this._agents.get(e);n?.impl&&n.impl.setYieldRequested?.(t,o)}async getFollowups(e,t,o,n,r){let s=this._agents.get(e);return s?.impl?.provideFollowups?s.impl.provideFollowups(t,o,n,r):[]}async getChatTitle(e,t,o){let n=this._agents.get(e);if(n?.impl?.provideChatTitle)return n.impl.provideChatTitle(t,o)}async getChatSummary(e,t,o){let n=this._agents.get(e);if(n?.impl?.provideChatSummary)return n.impl.provideChatSummary(t,o)}registerChatParticipantDetectionProvider(e,t){return this._chatParticipantDetectionProviders.set(e,t),Z(()=>{this._chatParticipantDetectionProviders.delete(e)})}hasChatParticipantDetectionProviders(){return this._chatParticipantDetectionProviders.size>0}async detectAgentOrCommand(e,t,o,n){let r=ht.first(this._chatParticipantDetectionProviders.values());if(!r)return;let s=this.getAgents().reduce((p,h)=>{if(h.locations.includes(o.location)){p.push({participant:h.id,disambiguation:h.disambiguation??[]});for(let g of h.slashCommands)p.push({participant:h.id,command:g.name,disambiguation:g.disambiguation??[]})}return p},[]),l=await r.provideParticipantDetection(e,t,{...o,participants:s},n);if(!l)return;let c=this.getAgent(l.participant);if(!c)return;if(!l.command)return{agent:c};let u=c?.slashCommands.find(p=>p.name===l.command);if(u)return{agent:c,command:u}}};dke=I([m(0,X),m(1,B)],dke);var uke=class{constructor(i,e){this.data=i;this.impl=e}get id(){return this.data.id}get name(){return this.data.name??""}get fullName(){return this.data.fullName??""}get description(){return this.data.description??""}get extensionId(){return this.data.extensionId}get extensionVersion(){return this.data.extensionVersion}get extensionPublisherId(){return this.data.extensionPublisherId}get extensionPublisherDisplayName(){return this.data.publisherDisplayName}get extensionDisplayName(){return this.data.extensionDisplayName}get isDefault(){return this.data.isDefault}get isCore(){return this.data.isCore}get metadata(){return this.data.metadata}get slashCommands(){return this.data.slashCommands}get locations(){return this.data.locations}get modes(){return this.data.modes}get disambiguation(){return this.data.disambiguation}async invoke(i,e,t,o){return this.impl.invoke(i,e,t,o)}setRequestTools(i,e){this.impl.setRequestTools?.(i,e)}setYieldRequested(i,e){this.impl.setYieldRequested?.(i,e)}async provideFollowups(i,e,t,o){return this.impl.provideFollowups?this.impl.provideFollowups(i,e,t,o):[]}toJSON(){return this.data}},mz=ae("chatAgentNameService"),pke=class{constructor(i){this.languageModelsService=i}getAgentNameRestriction(i){if(i.isCore)return!0;let e=this.checkAgentNameRestriction(i.name,i).get(),t=!i.fullName||this.checkAgentNameRestriction(i.fullName.replace(/\s/g,""),i).get();return e&&t}checkAgentNameRestriction(i,e){return this.languageModelsService.restrictedChatParticipants.map(o=>o[i.toLowerCase()]).map(o=>o?o.some(n=>mr(n,n.includes(".")?e.extensionId.value:e.extensionPublisherId)):!0)}};pke=I([m(0,Wr)],pke);function Hj(a){return`${a.extensionId.value}.${a.id}`}function d1o(a){return a.name!==void 0}function pTt(a){let i=d1o(a)?a:{...a,name:a.id};return i.extensionPublisherId||(i.extensionPublisherId=a.extensionPublisher??""),i.extensionDisplayName||(i.extensionDisplayName=""),i.extensionId||(i.extensionId=new Ei("")),Xn(i)}var fYi="onCustomAgentProvider",vYi="onInstructionsProvider",bYi="onPromptFileProvider",SYi="onSkillProvider",nr=ae("IPromptsService");function IYi(a){if(typeof a!="object"||a===null)return!1;let i=a;return typeof i.userInvocable=="boolean"&&typeof i.agentInvocable=="boolean"}var RY="https://aka.ms/vscode-ghcp-prompt-snippets",mTt="https://aka.ms/vscode-ghcp-custom-instructions",U8e="https://aka.ms/vscode-ghcp-custom-chat-modes",hTt="https://aka.ms/vscode-agent-skills",gTt="https://aka.ms/vscode-chat-hooks",PE="prompt",z8e="instructions",K8e="chatagent",_di="skill",hz=[PE,z8e,K8e,_di];function yYi(a){switch(a){case"prompt":return PE;case"instructions":return z8e;case"agent":return K8e;case"skill":return _di;case"hook":return"jsonc";default:throw new Error(`Unknown prompt type: ${a}`)}}function Mf(a){switch(a){case PE:return"prompt";case z8e:return"instructions";case K8e:return"agent";case _di:return"skill";default:return}}var fc=(n=>(n.instructions="instructions",n.prompt="prompt",n.agent="agent",n.skill="skill",n.hook="hook",n))(fc||{});function wYi(a){return Object.values(fc).includes(a)}var uP;(n=>{n.icon=M.error;function i(r){return{filterUri:r.resource,owner:r.owner,problemMessage:r.message,filterRange:{startLineNumber:r.startLineNumber,endLineNumber:r.endLineNumber,startColumn:r.startColumn,endColumn:r.endColumn}}}n.fromMarker=i;function e(r){return{id:t(r),name:o(r),icon:n.icon,value:r,kind:"diagnostic",...r}}n.toEntry=e;function t(r){return[r.filterUri,r.owner,r.filterSeverity,r.filterRange?.startLineNumber,r.filterRange?.startColumn].join(":")}n.id=t;function o(r){let s;if((p=>(p[p.MaxChars=30]="MaxChars",p[p.MaxSpaceLookback=10]="MaxSpaceLookback"))(s||={}),r.problemMessage){if(r.problemMessage.length<30)return r.problemMessage;let c=r.problemMessage.lastIndexOf(" ",30);return c===-1||c+10<30?r.problemMessage.substring(0,30)+"\u2026":r.problemMessage.substring(0,c)+"\u2026"}let l=d(7587,null);return r.filterUri&&(l=d(7588,null,Ye(r.filterUri))),l}n.label=o})(uP||={});var uV;(t=>{function a(o){return A.isUri(o.value)?o.value:nv(o.value)?o.value.uri:void 0}t.toUri=a;function i(o){if(o.value instanceof Uint8Array){let n={...o};return n.value={$base64:Qd(Je.wrap(o.value))},n}return o}t.toExport=i;function e(o){if(o&&"values"in o&&Array.isArray(o.values))return{kind:"generic",id:o.id??"",name:o.name,value:o.values[0]?.value,range:o.range,modelDescription:o.modelDescription,references:o.references};if(o.value&&typeof o.value=="object"&&"$base64"in o.value&&typeof o.value.$base64=="string"){let n={...o};return n.value=Sl(o.value.$base64).buffer,n}return o}t.fromExport=e})(uV||={});function CYi(a){return a.kind==="implicit"}function MY(a){return a.kind==="string"}function xYi(a){return a.kind==="terminalCommand"}function fTt(a){return a.kind==="paste"}function vTt(a){return a.kind==="workspace"}function pV(a){return a.kind==="image"}function bTt(a){return a.kind==="notebookOutput"}function STt(a){return a.kind==="element"}function pP(a){return a.kind==="promptFile"}function PY(a){return a.kind==="promptText"}function ITt(a){return a.kind==="scmHistoryItem"}function yTt(a){return a.kind==="scmHistoryItemChange"}function wTt(a){return a.kind==="scmHistoryItemChangeRange"}function qx(a){let i=a;return typeof i=="object"&&i!==null&&(typeof i.value=="string"||typeof i.value>"u")&&(typeof i.name=="string"||typeof i.name>"u")&&(i.resourceUri===void 0||A.isUri(i.resourceUri))&&(typeof i.name=="string"||A.isUri(i.resourceUri))&&(i.icon===void 0||q.isThemeIcon(i.icon))&&A.isUri(i.uri)&&typeof i.handle=="number"}function mP(a,i,e,t=!1,o){return{id:`${i}__${a.toString()}`,name:`prompt:${Ye(a)}`,value:a,kind:"promptFile",modelDescription:"Prompt instructions file",isRoot:i!=="vscode.prompt.instructions",originLabel:e,toolReferences:o,automaticallyAdded:t}}function kYi(a,i=!1,e){return{id:"vscode.prompt.instructions.text",name:"prompt:instructionsList",value:a,kind:"promptText",modelDescription:"Prompt instructions list",automaticallyAdded:i,toolReferences:e}}function Dce(a,i){return{kind:"tool",id:a.id,icon:q.isThemeIcon(a.icon)?a.icon:void 0,name:a.displayName,value:void 0,range:i}}function CTt(a,i){return{kind:"toolset",id:a.id,icon:a.icon,name:a.referenceName,value:Array.from(a.getTools()).map(e=>Dce(e)),range:i}}var Uj=class{constructor(i){this._ids=new Set;this._entries=[];i&&this.add(...i)}add(...i){for(let e of i)this._ids.has(e.id)||(this._ids.add(e.id),this._entries.push(e))}insertFirst(i){this._ids.has(i.id)||(this._ids.add(i.id),this._entries.unshift(i))}remove(i){this._ids.delete(i.id),this._entries=this._entries.filter(e=>e.id!==i.id)}has(i){return this._ids.has(i.id)}asArray(){return this._entries.slice(0)}get length(){return this._entries.length}};var Ddi;(i=>{function a(e,t){return e.text===t.text&&D9t(e.parts,t.parts,(o,n)=>o.kind===n.kind&&di.equals(o.range,n.range)&&z.equalsRange(o.editorRange,n.editorRange)&&o.text===n.text)}i.equals=a})(Ddi||={});function kTt(a){let i=a.parts.map(t=>t.promptText).join("").trimStart(),e=a.text.length-i.length;return{message:i,diff:e}}var pb=class a{constructor(i,e,t){this.range=i;this.editorRange=e;this.text=t;this.kind=a.Kind}static{this.Kind="text"}get promptText(){return this.text}},su="#",vg="@",yu="/",xTt=class a{constructor(i,e,t,o,n){this.range=i;this.editorRange=e;this.variableName=t;this.variableArg=o;this.variableId=n;this.kind=a.Kind}static{this.Kind="var"}get text(){let i=this.variableArg?`:${this.variableArg}`:"";return`${su}${this.variableName}${i}`}get promptText(){return this.text}},ZS=class a{constructor(i,e,t,o,n,r){this.range=i;this.editorRange=e;this.toolName=t;this.toolId=o;this.displayName=n;this.icon=r;this.kind=a.Kind}static{this.Kind="tool"}get text(){return`${su}${this.toolName}`}get promptText(){return this.text}toVariableEntry(){return{kind:"tool",id:this.toolId,name:this.toolName,range:this.range,value:void 0,icon:q.isThemeIcon(this.icon)?this.icon:void 0,fullName:this.displayName}}},OO=class a{constructor(i,e,t,o,n,r){this.range=i;this.editorRange=e;this.id=t;this.name=o;this.icon=n;this.tools=r;this.kind=a.Kind}static{this.Kind="toolset"}get text(){return`${su}${this.name}`}get promptText(){return this.text}toVariableEntry(){return{kind:"toolset",id:this.id,name:this.name,range:this.range,icon:this.icon,value:this.tools}}},zu=class a{constructor(i,e,t){this.range=i;this.editorRange=e;this.agent=t;this.kind=a.Kind}static{this.Kind="agent"}get text(){return`${vg}${this.agent.name}`}get promptText(){return""}},Pf=class a{constructor(i,e,t){this.range=i;this.editorRange=e;this.command=t;this.kind=a.Kind}static{this.Kind="subcommand"}get text(){return`${yu}${this.command.name}`}get promptText(){return""}},jx=class a{constructor(i,e,t){this.range=i;this.editorRange=e;this.slashCommand=t;this.kind=a.Kind}static{this.Kind="slash"}get text(){return`${yu}${this.slashCommand.command}`}get promptText(){return`${yu}${this.slashCommand.command}`}},Qx=class a{constructor(i,e,t){this.range=i;this.editorRange=e;this.name=t;this.kind=a.Kind}static{this.Kind="prompt"}get text(){return`${yu}${this.name}`}get promptText(){return`${yu}${this.name}`}},tR=class a{constructor(i,e,t,o,n,r,s,l,c,u){this.range=i;this.editorRange=e;this.text=t;this.id=o;this.modelDescription=n;this.data=r;this.fullName=s;this.icon=l;this.isFile=c;this.isDirectory=u;this.kind=a.Kind}static{this.Kind="dynamic"}get referenceText(){return this.text.replace(su,"")}get promptText(){return this.text}toVariableEntry(){return this.id==="vscode.problems"?uP.toEntry(this.data.filter):{kind:this.isDirectory?"directory":this.isFile?"file":"generic",id:this.id,name:this.referenceText,range:this.range,value:this.data,fullName:this.fullName,icon:this.icon}}};function EYi(a){return{text:a.text,parts:a.parts.map(i=>{if(i.kind===pb.Kind)return new pb(new di(i.range.start,i.range.endExclusive),i.editorRange,i.text);if(i.kind===xTt.Kind)return new xTt(new di(i.range.start,i.range.endExclusive),i.editorRange,i.variableName,i.variableArg,i.variableId||"");if(i.kind===ZS.Kind)return new ZS(new di(i.range.start,i.range.endExclusive),i.editorRange,i.toolName,i.toolId,i.displayName,i.icon);if(i.kind===OO.Kind)return new OO(new di(i.range.start,i.range.endExclusive),i.editorRange,i.id,i.name,i.icon,i.tools??[]);if(i.kind===zu.Kind){let e=i.agent;return e=pTt(e),new zu(new di(i.range.start,i.range.endExclusive),i.editorRange,e)}else{if(i.kind===Pf.Kind)return new Pf(new di(i.range.start,i.range.endExclusive),i.editorRange,i.command);if(i.kind===jx.Kind)return new jx(new di(i.range.start,i.range.endExclusive),i.editorRange,i.slashCommand);if(i.kind===Qx.Kind)return new Qx(new di(i.range.start,i.range.endExclusive),i.editorRange,i.name);if(i.kind===tR.Kind)return new tR(new di(i.range.start,i.range.endExclusive),i.editorRange,i.text,i.id,i.modelDescription,Xn(i.data),i.fullName,i.icon,i.isFile,i.isDirectory);throw new Error(`Unknown chat request part: ${i.kind}`)}})}}function TYi(a){let i=a.parts.find(t=>t instanceof zu),e=a.parts.find(t=>t instanceof Pf);return{agentPart:i,commandPart:e}}function ETt(a,i,e,t=null,o=null){let n="";if(t&&t!==a.getDefaultAgent(i)?.id){let r=a.getAgent(t);if(!r)return;n+=`${vg}${r.name} `,o&&(n+=`${yu}${o} `)}return n+e}var TTt=ae("IChatVariablesService");var FO=ae("chatSlashCommandService"),mke=class extends C{constructor(e){super();this._extensionService=e;this._commands=new Map;this._onDidChangeCommands=this._register(new E);this.onDidChangeCommands=this._onDidChangeCommands.event}dispose(){super.dispose(),this._commands.clear()}registerSlashCommand(e,t){if(this._commands.has(e.command))throw new Error(`Already registered a command with id ${e.command}}`);return this._commands.set(e.command,{data:e,command:t}),this._onDidChangeCommands.fire(),Z(()=>{this._commands.delete(e.command)&&this._onDidChangeCommands.fire()})}getCommands(e,t){return Array.from(this._commands.values(),o=>o.data).filter(o=>o.locations.includes(e)&&(!o.modes||o.modes.includes(t)))}hasCommand(e){return this._commands.has(e)}async executeCommand(e,t,o,n,r,s,l,c){let u=this._commands.get(e);if(!u)throw new Error("No command with id ${id} NOT registered");if(u.command||await this._extensionService.activateByEvent(`onSlash:${e}`),!u.command)throw new Error(`No command with id ${e} NOT resolved`);return await u.command(t,o,n,r,s,l,c)}};mke=I([m(0,lt)],mke);function _Yi(a){let i=[];return DYi(a.node,i),i.join("")}function DYi(a,i){if(a.type===2)a.lineBreakBefore&&i.push(`
`),typeof a.text=="string"&&i.push(a.text);else if(a.ctor===3)i.push("<image>");else if(a.ctor===1||a.ctor===2)for(let e of a.children)DYi(e,i)}function _Tt(a,i){return!a.models||a.models.length===0||!i?!0:a.models.some(e=>(!e.id||e.id===i.id)&&(!e.vendor||e.vendor===i.vendor)&&(!e.family||e.family===i.family)&&(!e.version||e.version===i.version))}var Rn;(n=>{n.Internal={type:"internal",label:"Built-In"},n.External={type:"external",label:"External"};function e(r){switch(r.type){case"extension":return`extension:${r.extensionId.value}`;case"mcp":return`mcp:${r.collectionId}:${r.definitionId}`;case"user":return`user:${r.file.toString()}`;case"internal":return"internal";case"external":return"external"}}n.toKey=e;function t(r,s){return e(r)===e(s)}n.equals=t;function o(r){return r.type==="internal"?{ordinal:1,label:d(8069,null)}:r.type==="mcp"?{ordinal:2,label:r.label}:r.type==="user"?{ordinal:0,label:d(8071,null)}:{ordinal:3,label:r.label}}n.classify=o})(Rn||={});function mV(a){return typeof a=="object"&&typeof a?.input=="string"&&(typeof a?.output=="string"||Array.isArray(a?.output))}function zj(a){return typeof a=="object"&&typeof a?.output=="object"&&typeof a?.output?.mimeType=="string"&&a?.output?.type==="data"}function DTt(a){return a.map(i=>{switch(i.kind){case"promptTsx":return $8e(i);case"text":return i.value;case"data":return d(8070,null,ll.formatSize(i.value.data.byteLength),i.value.mimeType||"unknown")}}).join(", ")}function LYi(a){return a.content.some(i=>i.kind==="data")}function $8e(a){return _Yi(a.value)}function Km(a){return!!a&&a.getTools!==void 0}var hke=class{constructor(i,e,t,o,n,r,s){this.id=i;this.referenceName=e;this.icon=t;this.source=o;this.description=n;this.legacyFullNames=r;this._contextKeyService=s;this._tools=new k6;this._toolSets=new k6;this.isHomogenous=Ce(l=>!ht.some(this._tools.observable.read(l),c=>!Rn.equals(c.source,this.source))&&!ht.some(this._toolSets.observable.read(l),c=>!Rn.equals(c.source,this.source)))}addTool(i,e){return this._tools.add(i,e),Z(()=>{this._tools.delete(i)})}addToolSet(i,e){return i===this?C.None:(this._toolSets.add(i,e),Z(()=>{this._toolSets.delete(i)}))}getTools(i){return ht.concat(ht.filter(this._tools.observable.read(i),e=>this._contextKeyService.contextMatchesRules(e.when)),...ht.map(this._toolSets.observable.read(i),e=>e.getTools(i)))}},G8e=class{constructor(i,e){this._toolSet=i;this.model=e}get id(){return this._toolSet.id}get referenceName(){return this._toolSet.referenceName}get icon(){return this._toolSet.icon}get source(){return this._toolSet.source}get description(){return this._toolSet.description}get legacyFullNames(){return this._toolSet.legacyFullNames}getTools(i){return ht.filter(this._toolSet.getTools(i),e=>_Tt(e,this.model))}},jn=ae("ILanguageModelToolsService");function RYi(a){return A.from({scheme:Y.inMemory,path:`/lm/tool/${a}/tool_input.json`})}function q8e(a){return typeof a!="string"&&(a=a.id),A.from({scheme:Y.vscode,authority:"schemas",path:`/lm/tool/${a}`})}var jp;(s=>(s.execute="execute",s.edit="edit",s.search="search",s.agent="agent",s.read="read",s.web="web",s.todo="todo"))(jp||={});var Kj;(e=>(e.runSubagent="runSubagent",e.vscode="vscode"))(Kj||={});var u1o=/^@([\w_\-\.]+)(?=(\s|$|\b))/i,p1o=/^#([\w_\-]+)(:\d+)?(?=(\s|$|\b))/i,m1o=/^\/([\p{L}\d_\-\.:]+)(?=(\s|$|\b))/iu,AE=class{constructor(i,e,t,o){this.agentService=i;this.variableService=e;this.slashCommandService=t;this.promptsService=o}parseChatRequest(i,e,t="panel",o){let n=this.variableService.getDynamicVariables(i),r=this.variableService.getSelectedToolAndToolSets(i);return this.parseChatRequestWithReferences(n,r,e,t,o)}parseChatRequestWithReferences(i,e,t,o="panel",n){let r=[],s=new Map,l=new Map;for(let[g,f]of e)f&&(Km(g)?l.set(g.referenceName,g):s.set(g.toolReferenceName??g.displayName,g));let c=1,u=1;for(let g=0;g<t.length;g++){let f=t.charAt(g-1),v=t.charAt(g),b;if((f.match(/\s/)||g===0)&&(v===su?b=this.tryToParseVariable(t.slice(g),g,new Ie(c,u),r,s,l):v===vg?b=this.tryToParseAgent(t.slice(g),t,g,new Ie(c,u),r,o,n):v===yu&&(b=this.tryToParseSlashCommand(t.slice(g),t,g,new Ie(c,u),r,o,n)),b||(b=this.tryToParseDynamicVariable(t.slice(g),g,new Ie(c,u),i))),b){if(g!==0){let S=r.at(-1),y=S?.range.endExclusive??0,w=S?.editorRange.endLineNumber??1,k=S?.editorRange.endColumn??1;r.push(new pb(new di(y,g),new z(w,k,c,u),t.slice(y,g)))}r.push(b)}v===`
`?(c++,u=1):u++}let p=r.at(-1),h=p?.range.endExclusive??0;return h<t.length&&r.push(new pb(new di(h,t.length),new z(p?.editorRange.endLineNumber??1,p?.editorRange.endColumn??1,c,u),t.slice(h,t.length))),{parts:r,text:t}}tryToParseAgent(i,e,t,o,n,r,s){let l=i.match(u1o);if(!l)return;let[c,u]=l,p=new di(t,t+c.length),h=new z(o.lineNumber,o.column,o.lineNumber,o.column+c.length),g=this.agentService.getAgentsByName(u);if(!g.length){let y=this.agentService.getAgentByFullyQualifiedId(u);y&&(g=[y])}let f=g.length>1&&s?.selectedAgent?s.selectedAgent:g.find(y=>y.locations.includes(r));if(!f||s?.mode&&!f.modes.includes(s.mode)||n.some(y=>y instanceof zu)||n.some(y=>y instanceof pb&&y.text.trim()!==""||!(y instanceof zu)))return;let b=n.at(-1)?.range.endExclusive??0;if(e.slice(b,t).trim()==="")return new zu(p,h,f)}tryToParseVariable(i,e,t,o,n,r){let s=i.match(p1o);if(!s)return;let[l,c]=s,u=new di(e,e+l.length),p=new z(t.lineNumber,t.column,t.lineNumber,t.column+l.length),h=n.get(c);if(h)return new ZS(u,p,c,h.id,h.displayName,h.icon);let g=r.get(c);if(g){let f=Array.from(g.getTools()).map(v=>new ZS(u,p,v.toolReferenceName??v.displayName,v.id,v.displayName,v.icon).toVariableEntry());return new OO(u,p,g.id,g.referenceName,g.icon,f)}}tryToParseSlashCommand(i,e,t,o,n,r,s){let l=i.match(m1o);if(!l||n.some(y=>!(y instanceof zu)&&!(y instanceof pb&&y.text.trim()==="")))return;let u=n.at(-1)?.range.endExclusive??0;if(e.slice(u,t).trim()!=="")return;let[h,g]=l,f=new di(t,t+h.length),v=new z(o.lineNumber,o.column,o.lineNumber,o.column+h.length),b=n.find(y=>y instanceof zu)?.agent??(s?.forcedAgent?s.forcedAgent:void 0);if(b){let y=b.slashCommands.find(w=>w.name===g);if(y)return new Pf(f,v,y)}let S=s?.attachmentCapabilities??b?.capabilities??s?.attachmentCapabilities;if(!b||S?.supportsPromptAttachments){let w=this.slashCommandService.getCommands(r,s?.mode??"ask").find(T=>T.command===g);if(w)return new jx(f,v,w);{let N=this.agentService.getDefaultAgent(r,s?.mode)?.slashCommands.find(O=>O.name===g);if(N)return new Pf(f,v,N)}if(this.promptsService.isValidSlashCommandName(g))return new Qx(f,v,g)}}tryToParseDynamicVariable(i,e,t,o){let n=o.find(r=>r.range.startLineNumber===t.lineNumber&&r.range.startColumn===t.column);if(n){let r=n.range.endColumn-n.range.startColumn,s=i.substring(0,r),l=new di(e,e+r);return new tR(l,n.range,s,n.id,n.modelDescription,n.data,n.fullName,n.icon,n.isFile,n.isDirectory)}}};AE=I([m(0,br),m(1,TTt),m(2,FO),m(3,nr)],AE);function WO(a){if(!a.viewModel||!a.supportsFileReferences)return[];let i=a.getContrib(JS.ID);if(!i)return[];if(a.viewModel.editing&&i.variables.length>0)return i.variables;if(a.input.attachmentModel.attachments.length>0&&a.viewModel.editing){let e=[],t=a.inputEditor.getModel(),o=t?.getValueLength()??0;for(let n of a.input.attachmentModel.attachments)if(n.range){if(n.range.start>=n.range.endExclusive||n.range.start<0||n.range.endExclusive>o||!t)continue;let r=t.getPositionAt(n.range.start),s=t.getPositionAt(n.range.endExclusive),l={id:n.id,fullName:n.name,modelDescription:n.modelDescription,range:new z(r.lineNumber,r.column,s.lineNumber,s.column),icon:n.icon,isFile:n.kind==="file",isDirectory:n.kind==="directory",data:n.value};e.push(l)}return e.length>0?e:i.variables}return i.variables}function gz(a){return a.input.selectedToolsModel.entriesMap.get()}var gke=class{constructor(i){this.chatWidgetService=i}getDynamicVariables(i){let e=this.chatWidgetService.getWidgetBySessionResource(i);return e?WO(e):[]}getSelectedToolAndToolSets(i){let e=this.chatWidgetService.getWidgetBySessionResource(i);return e?gz(e):new Map}};gke=I([m(0,At)],gke);function h1o(a){return!!a&&typeof a=="object"&&"uri"in a&&a.uri instanceof A&&"version"in a&&typeof a.version=="number"&&"ranges"in a&&Array.isArray(a.ranges)&&a.ranges.every(z.isIRange)}function MYi(a){return!!a&&typeof a=="object"&&"documents"in a&&Array.isArray(a.documents)&&a.documents.every(h1o)}function PYi(a){return!!a&&typeof a=="object"&&typeof a.variableName=="string"}function RTt(a){return!!a&&typeof a=="object"&&"command"in a&&"language"in a}var lo;(p=>{let a;(y=>(y[y.Streaming=0]="Streaming",y[y.WaitingForConfirmation=1]="WaitingForConfirmation",y[y.Executing=2]="Executing",y[y.WaitingForPostApproval=3]="WaitingForPostApproval",y[y.Completed=4]="Completed",y[y.Cancelled=5]="Cancelled"))(a=p.StateKind||={});function i(h,g){if(h.kind==="toolInvocationSerialized")return h.isConfirmed===void 0||typeof h.isConfirmed=="boolean"?{type:h.isConfirmed?4:0}:h.isConfirmed;let f=h.state.read(g);if(!(f.type===0||f.type===1))return f.type===5?{type:f.reason}:f.confirmed}p.executionConfirmedOrDenied=i;function e(h,g){let f=i(h);if(f)return Promise.resolve(f);let v=new P;return new Promise(b=>{g&&v.add(g.onCancellationRequested(()=>{b({type:0})})),v.add(he(S=>{let y=i(h,S);y&&(v.dispose(),b(y))}))}).finally(()=>{v.dispose()})}p.awaitConfirmation=e;function t(h,g){let f=h.state.read(g);if(f.type===4)return f.postConfirmed||{type:1};if(f.type===5)return{type:f.reason}}function o(h,g){let f=h?.state.get();return f?.type===1||f?.type===3?(f.confirm(g),!0):!1}p.confirmWith=o;function n(h,g){let f=t(h);if(f)return Promise.resolve(f);let v=new P;return new Promise(b=>{g&&v.add(g.onCancellationRequested(()=>{b({type:0})})),v.add(he(S=>{let y=t(h,S);y&&(v.dispose(),b(y))}))}).finally(()=>{v.dispose()})}p.awaitPostConfirmation=n;function r(h,g){if(h.kind==="toolInvocationSerialized")return h.resultDetails;let f=h.state.read(g);if(f.type===4||f.type===3)return f.resultDetails}p.resultDetails=r;function s(h,g){if(h.kind==="toolInvocationSerialized")return!0;let f=h.state.read(g);return f.type===4||f.type===5}p.isComplete=s;function l(h,g){return h.kind==="toolInvocationSerialized"?!1:h.state.read(g).type===0}p.isStreaming=l;function c(h,g){if(h.kind==="toolInvocationSerialized")return;let f=h.state.read(g);if(f.type!==0)return f.parameters}p.getParameters=c;function u(h,g){if(h.kind==="toolInvocationSerialized")return;let f=h.state.read(g);if(f.type!==0)return f.confirmationMessages}p.getConfirmationMessages=u})(lo||={});var LTt=class{constructor(i){this.state=i;this.kind="mcpServersStarting";this.didStartServerIds=[]}get isEmpty(){let i=this.state.get();return!i.working&&i.serversRequiringInteraction.length===0}wait(){return new Promise(i=>{ux(e=>{let t=this.state.read(e);t.working||(e.dispose(),i(t))})})}toJSON(){return{kind:"mcpServersStarting",didStartServerIds:this.didStartServerIds}}};function AYi(a){return!!a&&a.kind==="reply"&&typeof a.message=="string"&&typeof a.agentId=="string"}function NYi(a){return Wo(a,{created:!0})?a:{created:a.startTime,lastRequestStarted:a.startTime,lastRequestEnded:a.endTime}}var Gj;(o=>{function a(n){return n.kind==="sent"}o.isSent=a;function i(n){return n.kind==="rejected"}o.isRejected=i;function e(n){return n.kind==="queued"}o.isQueued=e;function t(n){if(n.kind!=="sent")throw new Error(`Expected ChatSendResult to be 'sent', but was '${n.kind}'`)}o.assertSent=t})(Gj||={});var Si=ae("IChatService"),Lce="accessibility.voice.keywordActivation",j8e="chat.stopCancellationNoop",fz="chat.pendingRequestChange";var Q8e=(t=>(t[t.Output=1]="Output",t[t.OutputItems=2]="OutputItems",t[t.ExecutionState=3]="ExecutionState",t))(Q8e||{}),AY=ae("INotebookExecutionService");var eI;(h=>{function a(g){return{mime:g.mime,valueBytes:g.data}}h.toNotebookOutputItemDto=a;function i(g){return{outputId:g.outputId,metadata:g.metadata,items:g.outputs.map(a)}}h.toNotebookOutputDto=i;function e(g){return{cellKind:g.cellKind,language:g.language,mime:g.mime,source:g.source,internalMetadata:g.internalMetadata,metadata:g.metadata,outputs:g.outputs.map(i)}}h.toNotebookCellDataDto=e;function t(g){return{metadata:g.metadata,cells:g.cells.map(e)}}h.toNotebookDataDto=t;function o(g){return{mime:g.mime,data:g.valueBytes}}h.fromNotebookOutputItemDto=o;function n(g){return{outputId:g.outputId,metadata:g.metadata,outputs:g.items.map(o)}}h.fromNotebookOutputDto=n;function r(g){return{cellKind:g.cellKind,language:g.language,mime:g.mime,source:g.source,outputs:g.outputs.map(n),metadata:g.metadata,internalMetadata:g.internalMetadata}}h.fromNotebookCellDataDto=r;function s(g){return{metadata:g.metadata,cells:g.cells.map(r)}}h.fromNotebookDataDto=s;function l(g){return{handle:g.handle,uri:g.uri,source:g.textBuffer.getLinesContent(),eol:g.textBuffer.getEOL(),language:g.language,cellKind:g.cellKind,outputs:g.outputs.map(i),metadata:g.metadata,internalMetadata:g.internalMetadata}}h.toNotebookCellDto=l;function c(g){return g.editType===1?{editType:g.editType,cellHandle:g.cellHandle,append:g.append,outputs:g.outputs.map(n)}:g.editType===2?{editType:g.editType,append:g.append,outputId:g.outputId,items:g.items.map(o)}:g}h.fromCellExecuteUpdateDto=c;function u(g){return g}h.fromCellExecuteCompleteDto=u;function p(g){return g.editType===1?{editType:g.editType,index:g.index,count:g.count,cells:g.cells.map(r)}:g}h.fromCellEditOperationDto=p})(eI||={});var Ldi=class{constructor(i){this.content=i;this.kind="progressTask";this.deferred=new Go;this._onDidAddProgress=new E;this.progress=[]}get onDidAddProgress(){return this._onDidAddProgress.event}task(){return this.deferred.p}isSettled(){return this.deferred.isSettled}complete(i){this.deferred.complete(i)}add(i){this.progress.push(i),this._onDidAddProgress.fire(i)}toJSON(){return{kind:"progressTaskSerialized",content:this.content,progress:this.progress}}},MTt=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this._chatAgentService=t;this._chatSessionService=o;this._chatService=n;this._languageFeaturesService=r;this._chatWidgetService=s;this._instantiationService=l;this._logService=c;this._extensionService=u;this._uriIdentityService=p;this._promptsService=h;this._languageModelToolsService=g;this._agents=this._register(new jt);this._agentCompletionProviders=this._register(new jt);this._agentIdsToCompletionProviders=this._register(new jt);this._chatParticipantDetectionProviders=this._register(new jt);this._promptFileProviders=this._register(new jt);this._promptFileProviderEmitters=this._register(new jt);this._promptFileContentRegistrations=this._register(new jt);this._pendingProgress=new Map;this._activeTasks=new Map;this._unresolvedAnchors=new Map;this._proxy=e.getProxy(Zi.ExtHostChatAgents2),this._register(this._chatService.onDidDisposeSession(f=>{for(let v of f.sessionResource)this._proxy.$releaseSession(v)})),this._register(this._chatService.onDidPerformUserAction(f=>{if(typeof f.agentId=="string"){for(let[v,b]of this._agents)if(b.id===f.agentId){f.action.kind==="vote"?this._proxy.$acceptFeedback(v,f.result??{},f.action):this._proxy.$acceptAction(v,f.result||{},f);break}}})),this._register(this._chatService.onDidReceiveQuestionCarouselAnswer(f=>{this._proxy.$handleQuestionCarouselAnswer(f.requestId,f.resolveId,f.answers)})),this._register(this._chatWidgetService.onDidChangeFocusedSession(()=>{this._acceptActiveChatSession(this._chatWidgetService.lastFocusedWidget)})),this._acceptActiveChatSession(this._chatWidgetService.lastFocusedWidget),this._pushCustomAgents(),this._register(this._promptsService.onDidChangeCustomAgents(()=>{this._pushCustomAgents()})),this._pushInstructions(),this._register(this._promptsService.onDidChangeInstructions(()=>{this._pushInstructions()})),this._pushSkills(),this._register(this._promptsService.onDidChangeSkills(()=>{this._pushSkills()}))}_acceptActiveChatSession(e){let t=e?.viewModel?.sessionResource,o=t&&Rf(t)==="local";this._proxy.$acceptActiveChatSession(o?t:void 0)}async _pushCustomAgents(){try{let t=(await this._promptsService.getCustomAgents(ve.None)).map(o=>({uri:o.uri}));this._proxy.$acceptCustomAgents(t)}catch(e){this._logService.error("[chat] Failed to push custom agents to extension host",e)}}async _pushInstructions(){try{let t=(await this._promptsService.getInstructionFiles(ve.None)).map(o=>({uri:o.uri}));this._proxy.$acceptInstructions(t)}catch(e){this._logService.error("[chat] Failed to push instructions to extension host",e)}}async _pushSkills(){try{let t=(await this._promptsService.findAgentSkills(ve.None)??[]).map(o=>({uri:o.uri}));this._proxy.$acceptSkills(t)}catch(e){this._logService.error("[chat] Failed to push skills to extension host",e)}}$unregisterAgent(e){this._agents.deleteAndDispose(e)}async $transferActiveChatSession(e){let o=this._chatWidgetService.lastFocusedWidget?.viewModel?.model;if(!o){this._logService.error("MainThreadChat#$transferActiveChatSession: No active chat session found");return}await this._chatService.transferChatSession(o.sessionResource,A.revive(e))}async $registerAgent(e,t,o,n,r){await this._extensionService.whenInstalledExtensionsRegistered();let s=this._chatAgentService.getAgent(o,!0),l=this._chatSessionService.getAllChatSessionContributions().find(p=>p.type===o||p.alternativeIds?.includes(o));if(!s&&!l&&!r)throw this._chatAgentService.getAgentsByName(o).length?new Error(`chatParticipant must be declared with an ID in package.json. The "id" property may be missing! "${o}"`):new Error(`chatParticipant must be declared in package.json: ${o}`);let c={invoke:async(p,h,g,f)=>{let v=this._chatService.getSession(p.sessionResource);this._pendingProgress.set(p.requestId,{progress:h,chatSession:v});try{let b=v?.contributedChatSession,S;if(b){let y=b.chatSessionResource,w=b.isUntitled;if(w){let k=await this._chatSessionService.createNewChatSessionItem(b.chatSessionType,p,f);k&&(y=k.resource,w=!1,v?.setContributedChatSession({chatSessionType:b.chatSessionType,chatSessionResource:y,isUntitled:!1,initialSessionOptions:b.initialSessionOptions}),this._chatSessionService.registerSessionResourceAlias(b.chatSessionResource,y))}S={chatSessionResource:y,isUntitled:w,initialSessionOptions:b.initialSessionOptions?.map(k=>({optionId:k.optionId,value:typeof k.value=="string"?k.value:k.value.id}))}}return await this._proxy.$invokeAgent(e,p,{history:g,chatSessionContext:S},f)??{}}finally{this._pendingProgress.delete(p.requestId)}},setRequestTools:(p,h)=>{this._proxy.$setRequestTools(p,h)},setYieldRequested:(p,h)=>{this._proxy.$setYieldRequested(p,h)},provideFollowups:async(p,h,g,f)=>this._agents.get(e)?.hasFollowups?this._proxy.$provideFollowups(p,e,h,{history:g},f):[],provideChatTitle:(p,h)=>this._proxy.$provideChatTitle(e,p,h),provideChatSummary:(p,h)=>this._proxy.$provideChatSummary(e,p,h)};if(l?.alternativeIds?.includes(o))return;let u;if(!s&&r){let p=this._extensionService.extensions.find(h=>Ei.equals(h.identifier,t));u=this._chatAgentService.registerDynamicAgent({id:o,name:r.name,description:r.description,extensionId:t,extensionVersion:p?.version,extensionDisplayName:p?.displayName??t.value,extensionPublisherId:p?.publisher??"",publisherDisplayName:r.publisherName,fullName:r.fullName,metadata:Xn(n),slashCommands:[],disambiguation:[],locations:["panel"],modes:["ask","agent","edit"]},c)}else u=this._chatAgentService.registerAgentImplementation(o,c);this._agents.set(e,{id:o,extensionId:t,dispose:()=>u.dispose(),hasFollowups:n.hasFollowups})}async $updateAgent(e,t){await this._extensionService.whenInstalledExtensionsRegistered();let o=this._agents.get(e);if(!o){this._logService.error(`MainThreadChatAgents2#$updateAgent: No agent with handle ${e} registered`);return}o.hasFollowups=t.hasFollowups,this._chatAgentService.updateAgent(o.id,Xn(t))}async $handleProgressChunk(e,t){let o=this._pendingProgress.get(e);if(!o){this._logService.warn(`MainThreadChatAgents2#$handleProgressChunk: No pending progress for requestId ${e}`);return}let{progress:n,chatSession:r}=o,s=[],l=r?.getRequests().find(c=>c.id===e)?.response;for(let c of t){let[u,p]=Array.isArray(c)?c:[c];if(u.kind==="externalEdits"){if(r?.editingSession&&p!==void 0&&l){let g=u.start?await r.editingSession.startExternalEdits(l,p,Xn(u.resources),u.undoStopId):await r.editingSession.stopExternalEdits(l,p);s.push(...g)}continue}if(u.kind==="beginToolInvocation"){this._languageModelToolsService.beginToolCall({toolCallId:u.toolCallId,toolId:u.toolName,chatRequestId:e,sessionResource:r?.sessionResource,subagentInvocationId:u.subagentInvocationId});continue}if(u.kind==="updateToolInvocation"){this._languageModelToolsService.updateToolStream(u.toolCallId,u.streamData?.partialInput,ve.None);continue}if(u.kind==="usage"){l&&l.setUsage({kind:"usage",promptTokens:u.promptTokens,completionTokens:u.completionTokens,promptTokenDetails:u.promptTokenDetails});continue}let h=u.kind==="notebookEdit"?OYi.fromChatEdit(u):Xn(u);if((h.kind==="notebookEdit"||h.kind==="textEdit"||h.kind==="codeblockUri")&&(h.uri=this._uriIdentityService.asCanonicalUri(h.uri)),p!==void 0){if(h.kind==="progressTask"){let f=`${e}_${p}`,v=new Ldi(h.content);this._activeTasks.set(f,v),s.push(v)}else if(p!==void 0){let g=`${e}_${p}`,f=this._activeTasks.get(g);switch(h.kind){case"progressTaskResult":f&&h.content?(f.complete(h.content.value),this._activeTasks.delete(g)):f?.complete(void 0);break;case"warning":case"reference":f?.add(h);break}}continue}h.kind==="inlineReference"&&h.resolveId&&(this._unresolvedAnchors.has(e)||this._unresolvedAnchors.set(e,new Map),this._unresolvedAnchors.get(e)?.set(h.resolveId,h)),s.push(h)}n(s)}$handleAnchorResolve(e,t,o){let n=this._unresolvedAnchors.get(e)?.get(t);if(n&&(this._unresolvedAnchors.get(e)?.delete(t),o)){let r=Xn(o);n.inlineReference=r.inlineReference}}$registerAgentCompletionsProvider(e,t,o){let n=async(r,s)=>(await this._proxy.$invokeCompletionProvider(e,r,s)).map(c=>({...c,icon:c.icon?q.fromId(c.icon):void 0}));this._agentIdsToCompletionProviders.set(t,this._chatAgentService.registerAgentCompletionProvider(t,n)),this._agentCompletionProviders.set(e,this._languageFeaturesService.completionProvider.register({scheme:Y.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"chatAgentCompletions:"+e,triggerCharacters:o,provideCompletionItems:async(r,s,l,c)=>{let u=this._chatWidgetService.getWidgetByInputUri(r.uri);if(!u||!u.viewModel)return;let p=o.map(k=>Yr(k)).join(""),h=new RegExp(`[${p}]\\S*`,"g"),g=My(s.column,h,r.getLineContent(s.lineNumber),0)?.word??"";if(g&&!o.some(k=>g.startsWith(k)))return;let v=this._instantiationService.createInstance(AE).parseChatRequestWithReferences(WO(u),gz(u),r.getValue()).parts.find(k=>k instanceof zu),b=this._agents.get(e)?.id;if(v?.agent.id!==b)return;let S=g1o(r,s,h);return S?{suggestions:(await n(g,c)).map(k=>{let T=k.insertText??(typeof k.label=="string"?k.label:k.label.label),N=new z(S.insert.startLineNumber,S.insert.startColumn,S.insert.endLineNumber,S.insert.startColumn+T.length);return{label:k.label,range:S,insertText:T+" ",kind:18,detail:k.detail,documentation:k.documentation,command:{id:H8e.ID,title:"",arguments:[{id:k.id,widget:u,range:N,variableData:Xn(k.value),command:k.command}]}}})}:null}}))}$unregisterAgentCompletionsProvider(e,t){this._agentCompletionProviders.deleteAndDispose(e),this._agentIdsToCompletionProviders.deleteAndDispose(t)}$registerChatParticipantDetectionProvider(e){this._chatParticipantDetectionProviders.set(e,this._chatAgentService.registerChatParticipantDetectionProvider(e,{provideParticipantDetection:async(t,o,n,r)=>await this._proxy.$detectChatParticipant(e,t,{history:o},n,r)}))}$unregisterChatParticipantDetectionProvider(e){this._chatParticipantDetectionProviders.deleteAndDispose(e)}async $registerPromptFileProvider(e,t,o){let n=await this._extensionService.getExtension(o.value);if(!n){this._logService.error(`[MainThreadChatAgents2] Could not find extension for prompt file provider: ${o.value}`);return}if(!wYi(t)){this._logService.error(`[MainThreadChatAgents2] Invalid contribution type: ${t}`);return}let r=new E;this._promptFileProviderEmitters.set(e,r);let s=new jt;this._promptFileContentRegistrations.set(e,s);let l=this._promptsService.registerPromptFileProvider(n,t,{onDidChangePromptFiles:r.event,providePromptFiles:async(c,u)=>{let p=await this._proxy.$providePromptFiles(e,t,c,u);if(p)return p.map(h=>({uri:A.revive(h.uri)}))}});this._promptFileProviders.set(e,l)}$unregisterPromptFileProvider(e){this._promptFileProviders.deleteAndDispose(e),this._promptFileProviderEmitters.deleteAndDispose(e),this._promptFileContentRegistrations.deleteAndDispose(e)}$onDidChangePromptFiles(e){let t=this._promptFileProviderEmitters.get(e);t&&t.fire()}};MTt=I([vo(Gi.MainThreadChatAgents2),m(1,br),m(2,Ls),m(3,Si),m(4,zt),m(5,At),m(6,F),m(7,ne),m(8,lt),m(9,dt),m(10,nr),m(11,jn)],MTt);function g1o(a,i,e){let t=My(i.column,e,a.getLineContent(i.lineNumber),0);if(!t&&a.getWordUntilPosition(i).word)return;let o,n;return t?(o=new z(i.lineNumber,t.startColumn,i.lineNumber,i.column),n=new z(i.lineNumber,t.startColumn,i.lineNumber,t.endColumn)):o=n=z.fromPositions(i),{insert:o,replace:n}}var OYi;(i=>{function a(e){return{kind:"notebookEdit",uri:A.revive(e.uri),done:e.done,edits:e.edits.map(eI.fromCellEditOperationDto)}}i.fromChatEdit=a})(OYi||={});var NY=ae("codeMapperService"),PTt=class{constructor(){this.providers=[]}registerCodeMapperProvider(i,e){return this.providers.push(e),{dispose:()=>{let t=this.providers.indexOf(e);t>=0&&this.providers.splice(t,1)}}}async mapCode(i,e,t){for(let o of this.providers){let n=await o.mapCode(i,e,t);return t.isCancellationRequested?void 0:n}}};var Rce=class extends C{constructor(e,t){super();this.codeMapperService=t;this.providers=this._register(new jt);this._responseMap=new Map;this._proxy=e.getProxy(Zi.ExtHostCodeMapper)}$registerCodeMapperProvider(e,t){let o={displayName:t,mapCode:async(r,s,l)=>{let c=String(Rce._requestHandlePool++);this._responseMap.set(c,s);let u={requestId:c,codeBlocks:r.codeBlocks,chatRequestId:r.chatRequestId,chatRequestModel:r.chatRequestModel,chatSessionResource:r.chatSessionResource,location:r.location};try{return await this._proxy.$mapCode(e,u,l).then(p=>p??void 0)}finally{this._responseMap.delete(c)}}},n=this.codeMapperService.registerCodeMapperProvider(e,o);this.providers.set(e,n)}$unregisterCodeMapperProvider(e){this.providers.deleteAndDispose(e)}$handleProgress(e,t){let o=this._responseMap.get(e);if(o){let n=t.edits,r=A.revive(t.uri);n.length?n.every(Qk.isTextEdit)?o.textEdit(r,n):o.notebookEdit(r,n.map(eI.fromCellEditOperationDto)):o.textEdit(r,[])}return Promise.resolve()}};Rce._requestHandlePool=0,Rce=I([vo(Gi.MainThreadCodeMapper),m(1,NY)],Rce);var Rdi="vscode://schemas/toolsParameters",f1o={definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},enum:{type:"array",minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},defaultSnippets:[{body:{type:"object",properties:{"${1:paramName}":{type:"string",description:"${2:description}"}}}}]},v1o=oe.as(ea.JSONContribution);v1o.registerSchema(Rdi,f1o);var WYi=Tn.registerExtensionPoint({extensionPoint:"languageModelTools",activationEventsGenerator:function*(a){for(let i of a)yield`onLanguageModelTool:${i.name}`},jsonSchema:{description:d(8067,null),type:"array",items:{additionalProperties:!1,type:"object",defaultSnippets:[{body:{name:"${1}",modelDescription:"${2}",inputSchema:{type:"object",properties:{"${3:name}":{type:"string",description:"${4:description}"}}}}}],required:["name","displayName","modelDescription"],properties:{name:{description:d(8055,null),type:"string",pattern:"^(?!copilot_|vscode_)[\\w-]+$"},toolReferenceName:{markdownDescription:d(8056,null,"`canBeReferencedInPrompt`"),type:"string",pattern:"^[\\w-]+$"},displayName:{description:d(8053,null),type:"string"},userDescription:{description:d(8066,null),type:"string"},modelDescription:{description:d(8054,null),type:"string"},inputSchema:{description:d(8051,null),$ref:Rdi},canBeReferencedInPrompt:{markdownDescription:d(8042,null,"`ChatRequest#toolReferences`"),type:"boolean"},icon:{markdownDescription:d(8045,null),anyOf:[{type:"string"},{type:"object",properties:{light:{description:d(8047,null),type:"string"},dark:{description:d(8046,null),type:"string"}}}]},when:{markdownDescription:d(8043,null),type:"string"},tags:{description:d(8065,null),type:"array",items:{type:"string",pattern:"^(?!copilot_|vscode_)"}}}}}}),b1o=Tn.registerExtensionPoint({extensionPoint:"languageModelToolSets",deps:[WYi],jsonSchema:{description:d(8068,null),type:"array",items:{additionalProperties:!1,type:"object",defaultSnippets:[{body:{name:"${1}",description:"${2}",tools:["${3}"]}}],required:["name","description","tools"],properties:{name:{description:d(8060,null),type:"string",pattern:"^[\\w-]+$"},description:{description:d(8058,null),type:"string"},icon:{markdownDescription:d(8059,null),type:"string"},tools:{markdownDescription:d(8061,null),type:"array",minItems:1,items:{type:"string"}}}}}});function FYi(a,i){return`${a.value}/${i}`}function Y8e(a,i){return`toolset:${a.value}/${i}`}var Mce=class{constructor(i,e){this._registrationDisposables=new jt;WYi.setHandler((t,o)=>{for(let n of o.added)for(let r of n.value){if(!r.name||!r.modelDescription||!r.displayName){n.collector.error(`Extension '${n.description.identifier.value}' CANNOT register tool without name, modelDescription, and displayName: ${JSON.stringify(r)}`);continue}if(!r.name.match(/^[\w-]+$/)){n.collector.error(`Extension '${n.description.identifier.value}' CANNOT register tool with invalid id: ${r.name}. The id must match /^[\\w-]+$/.`);continue}if(r.canBeReferencedInPrompt&&!r.toolReferenceName){n.collector.error(`Extension '${n.description.identifier.value}' CANNOT register tool with 'canBeReferencedInPrompt' set without a 'toolReferenceName': ${JSON.stringify(r)}`);continue}if((r.name.startsWith("copilot_")||r.name.startsWith("vscode_"))&&!Ea(n.description,"chatParticipantPrivate")){n.collector.error(`Extension '${n.description.identifier.value}' CANNOT register tool with name starting with "vscode_" or "copilot_"`);continue}if(r.tags?.some(h=>h.startsWith("copilot_")||h.startsWith("vscode_"))&&!Ea(n.description,"chatParticipantPrivate")&&n.collector.error(`Extension '${n.description.identifier.value}' CANNOT register tool with tags starting with "vscode_" or "copilot_"`),r.legacyToolReferenceFullNames&&!Ea(n.description,"chatParticipantPrivate")){n.collector.error(`Extension '${n.description.identifier.value}' CANNOT use 'legacyToolReferenceFullNames' without the 'chatParticipantPrivate' API proposal enabled`);continue}let s=r.icon,l;typeof s=="string"?l=q.fromString(s)??{dark:je(n.description.extensionLocation,s),light:je(n.description.extensionLocation,s)}:s&&(l={dark:je(n.description.extensionLocation,s.dark),light:je(n.description.extensionLocation,s.light)});let c=i.defaultChatAgent?.chatExtensionId?Ei.equals(n.description.identifier,i.defaultChatAgent.chatExtensionId):Ea(n.description,"chatParticipantPrivate"),u=c?Rn.Internal:{type:"extension",label:n.description.displayName??n.description.name,extensionId:n.description.identifier},p={...r,source:u,inputSchema:r.inputSchema,id:r.name,icon:l,when:r.when?x.deserialize(r.when):void 0,alwaysDisplayInputOutput:!c};try{let h=e.registerToolData(p);this._registrationDisposables.set(FYi(n.description.identifier,r.name),h)}catch(h){n.collector.error(`Failed to register tool '${r.name}': ${h}`)}}for(let n of o.removed)for(let r of n.value)this._registrationDisposables.deleteAndDispose(FYi(n.description.identifier,r.name))}),b1o.setHandler((t,o)=>{for(let n of o.added){if(!Ea(n.description,"contribLanguageModelToolSets")){n.collector.error(`Extension '${n.description.identifier.value}' CANNOT register language model tools because the 'contribLanguageModelToolSets' API proposal is not enabled.`);continue}let r=i.defaultChatAgent?.chatExtensionId?Ei.equals(n.description.identifier,i.defaultChatAgent.chatExtensionId):Ea(n.description,"chatParticipantPrivate"),s=r?Rn.Internal:{type:"extension",label:n.description.displayName??n.description.name,extensionId:n.description.identifier};for(let l of n.value){if(Jl(l.name)){n.collector.error(`Tool set '${l.name}' CANNOT have an empty name`);continue}if(l.legacyFullNames&&!Ea(n.description,"contribLanguageModelToolSets")){n.collector.error(`Tool set '${l.name}' CANNOT use 'legacyFullNames' without the 'contribLanguageModelToolSets' API proposal enabled`);continue}if(JA(l.tools)){n.collector.error(`Tool set '${l.name}' CANNOT have an empty tools array`);continue}let c=[],u=[],p=[];for(let S of l.tools){let y=e.getToolByName(S);if(y){c.push(y);continue}let w=e.getToolSetByName(S);if(w){u.push(w);continue}p.push(S)}if(u.length===0&&c.length===0){n.collector.error(`Tool set '${l.name}' CANNOT have an empty tools array (none of the tools were found)`);continue}let h=new P,g=l.referenceName??l.name,f=e.getToolSetByName(g),v=r&&f?.source===Rn.Internal,b;if(v?b=f:b=e.createToolSet(s,Y8e(n.description.identifier,l.name),g,{icon:l.icon?q.fromString(l.icon):void 0,description:l.description,legacyFullNames:l.legacyFullNames}),Ui(S=>{v||h.add(b),c.forEach(y=>h.add(b.addTool(y,S))),u.forEach(y=>h.add(b.addToolSet(y,S)))}),p.length>0){let S=new Set(p),y=h.add(e.onDidChangeTools(()=>{for(let w of S){let k=e.getToolByName(w);if(k)h.add(b.addTool(k)),S.delete(w);else{let T=e.getToolSetByName(w);T&&(h.add(b.addToolSet(T)),S.delete(w))}}S.size===0&&h.delete(y)}))}this._registrationDisposables.set(Y8e(n.description.identifier,l.name),h)}}for(let n of o.removed)for(let r of n.value)this._registrationDisposables.deleteAndDispose(Y8e(n.description.identifier,r.name))})}static{this.ID="workbench.contrib.toolsExtensionPointHandler"}};Mce=I([m(0,nt),m(1,jn)],Mce);var Mdi=class extends C{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.languageModelTools}render(e){let t=e.contributes?.languageModelTools??[];if(!t.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let o=[d(8064,null),d(8063,null),d(8062,null)],n=t.map(r=>[new xe(`\`${r.name}\``),r.displayName,r.userDescription??r.modelDescription]);return{data:{headers:o,rows:n},dispose:()=>{}}}};oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:"languageModelTools",label:d(8048,null),access:{canToggle:!1},renderer:new Mt(Mdi)});var Pdi=class extends C{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.languageModelToolSets}render(e){let t=e.contributes?.languageModelToolSets??[];if(!t.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let o=[d(8050,null),d(8052,null),d(8057,null),d(8044,null)],n=t.map(r=>[new xe(`\`${r.name}\``),r.referenceName?new xe(`\`#${r.referenceName}\``):"none",r.tools.join(", "),r.description]);return{data:{headers:o,rows:n},dispose:()=>{}}}};oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:"languageModelToolSets",label:d(8049,null),access:{canToggle:!1},renderer:new Mt(Pdi)});var ATt=class extends C{constructor(e,t,o){super();this._languageModelToolsService=t;this._logService=o;this._tools=this._register(new jt);this._runningToolCalls=new Map;this._proxy=e.getProxy(Zi.ExtHostLanguageModelTools),this._register(this._languageModelToolsService.onDidChangeTools(n=>this._proxy.$onDidChangeTools(this.getToolDtos())))}getToolDtos(){return Array.from(this._languageModelToolsService.getAllToolsIncludingDisabled()).map(e=>({id:e.id,displayName:e.displayName,toolReferenceName:e.toolReferenceName,legacyToolReferenceFullNames:e.legacyToolReferenceFullNames,tags:e.tags,userDescription:e.userDescription,modelDescription:e.modelDescription,inputSchema:e.inputSchema,source:e.source}))}async $getTools(){return this.getToolDtos()}async $invokeTool(e,t){let o=await this._languageModelToolsService.invokeTool(Xn(e),(r,s)=>this._proxy.$countTokensForInvocation(e.callId,r,s),t??ve.None),n={content:o.content,toolMetadata:o.toolMetadata,toolResultError:o.toolResultError};return LYi(o)?new qh(n):n}$acceptToolProgress(e,t){this._runningToolCalls.get(e)?.progress.report(t)}$countTokensForInvocation(e,t,o){let n=this._runningToolCalls.get(e);if(!n)throw new Error(`Tool invocation call ${e} not found`);return n.countTokens(t,o)}$registerTool(e,t){let o=this._languageModelToolsService.registerToolImplementation(e,{invoke:async(n,r,s,l)=>{try{this._runningToolCalls.set(n.callId,{countTokens:r,progress:s});let c=await this._proxy.$invokeTool(n,l),u=c instanceof qh?c.value:c;return Xn(u)}finally{this._runningToolCalls.delete(n.callId)}},prepareToolInvocation:(n,r)=>this._proxy.$prepareToolInvocation(e,n,r),handleToolStream:t?(n,r)=>this._proxy.$handleToolStream(e,n,r):void 0});this._tools.set(e,o)}$registerToolWithDefinition(e,t,o){let n;if(t.icon)if(q.isThemeIcon(t.icon))n=t.icon;else if(typeof t.icon=="object"&&t.icon!==null&&oh(t.icon))n={dark:A.revive(t.icon)};else{let u=t.icon;n={dark:A.revive(u.dark),light:u.light?A.revive(u.light):void 0}}let r=Xn(t.source),s={id:t.id,displayName:t.displayName,toolReferenceName:t.toolReferenceName,legacyToolReferenceFullNames:t.legacyToolReferenceFullNames,tags:t.tags,userDescription:t.userDescription,modelDescription:t.modelDescription,inputSchema:t.inputSchema,source:r,icon:n,models:t.models,canBeReferencedInPrompt:!!t.userDescription&&!t.toolSet},l=t.id,c=new P;if(c.add(this._languageModelToolsService.registerTool(s,{invoke:async(u,p,h,g)=>{try{this._runningToolCalls.set(u.callId,{countTokens:p,progress:h});let f=await this._proxy.$invokeTool(u,g),v=f instanceof qh?f.value:f;return Xn(v)}finally{this._runningToolCalls.delete(u.callId)}},handleToolStream:o?(u,p)=>this._proxy.$handleToolStream(l,u,p):void 0,prepareToolInvocation:(u,p)=>this._proxy.$prepareToolInvocation(l,u,p)})),t.toolSet){let u=this._languageModelToolsService.getToolSet(Y8e(e,t.toolSet))||this._languageModelToolsService.getToolSet(t.toolSet);!u||!(u instanceof hke)?this._logService.warn(`ToolSet ${t.toolSet} not found for tool ${t.id} from extension ${e.value}`):c.add(u.addTool(s))}this._tools.set(l,c)}$unregisterTool(e){this._tools.deleteAndDispose(e)}};ATt=I([vo(Gi.MainThreadLanguageModelTools),m(1,jn),m(2,ne)],ATt);var VYi=ae("embeddingsService"),Adi=class{constructor(){this._onDidChange=new E;this.onDidChange=this._onDidChange.event;this.providers=new Map}get allProviders(){return this.providers.keys()}registerProvider(i,e){return this.providers.set(i,e),this._onDidChange.fire(),{dispose:()=>{this.providers.delete(i),this._onDidChange.fire()}}}computeEmbeddings(i,e,t){let o=this.providers.get(i);return o?o.provideEmbeddings(e,t):Promise.reject(new Error(`No embeddings provider registered with id: ${i}`))}};we(VYi,Adi,1);var NTt=class{constructor(i,e){this.embeddingsService=e;this._store=new P;this._providers=this._store.add(new jt);this._proxy=i.getProxy(Zi.ExtHostEmbeddings),this._store.add(e.onDidChange((()=>{this._proxy.$acceptEmbeddingModels(Array.from(e.allProviders))})))}dispose(){this._store.dispose()}$registerEmbeddingProvider(i,e){let t=this.embeddingsService.registerProvider(e,{provideEmbeddings:(o,n)=>this._proxy.$provideEmbeddings(i,o,n)});this._providers.set(i,t)}$unregisterEmbeddingProvider(i){this._providers.deleteAndDispose(i)}$computeEmbeddings(i,e,t){return this.embeddingsService.computeEmbeddings(i,e,t)}};NTt=I([vo(Gi.MainThreadEmbeddings),m(1,VYi)],NTt);var Ndi=class{constructor(){this.buffers=[]}add(i){let e=this.buffers.indexOf(i);return e<0&&(e=this.buffers.length,this.buffers.push(i)),e}};function BYi(a,i){if(i.serializeBuffersForPostMessage){let e=new Ndi,o=JSON.stringify(a,(r,s)=>{if(s instanceof ArrayBuffer)return{$$vscode_array_buffer_reference$$:!0,index:e.add(s)};if(ArrayBuffer.isView(s)){let l=S1o(s);if(l)return{$$vscode_array_buffer_reference$$:!0,index:e.add(s.buffer),view:{type:l,byteLength:s.byteLength,byteOffset:s.byteOffset}}}return s}),n=e.buffers.map(r=>{let s=new Uint8Array(r);return Je.wrap(s)});return{message:o,buffers:n}}else return{message:JSON.stringify(a),buffers:[]}}function S1o(a){switch(a.constructor.name){case"Int8Array":return 1;case"Uint8Array":return 2;case"Uint8ClampedArray":return 3;case"Int16Array":return 4;case"Uint16Array":return 5;case"Int32Array":return 6;case"Uint32Array":return 7;case"Float32Array":return 8;case"Float64Array":return 9;case"BigInt64Array":return 10;case"BigUint64Array":return 11}}function HYi(a,i){let e=i.map(n=>{let r=new ArrayBuffer(n.byteLength);return new Uint8Array(r).set(n.buffer),r}),t=i.length?(n,r)=>{if(r&&typeof r=="object"&&r.$$vscode_array_buffer_reference$$){let s=r,{index:l}=s,c=e[l];if(s.view)switch(s.view.type){case 1:return new Int8Array(c,s.view.byteOffset,s.view.byteLength/Int8Array.BYTES_PER_ELEMENT);case 2:return new Uint8Array(c,s.view.byteOffset,s.view.byteLength/Uint8Array.BYTES_PER_ELEMENT);case 3:return new Uint8ClampedArray(c,s.view.byteOffset,s.view.byteLength/Uint8ClampedArray.BYTES_PER_ELEMENT);case 4:return new Int16Array(c,s.view.byteOffset,s.view.byteLength/Int16Array.BYTES_PER_ELEMENT);case 5:return new Uint16Array(c,s.view.byteOffset,s.view.byteLength/Uint16Array.BYTES_PER_ELEMENT);case 6:return new Int32Array(c,s.view.byteOffset,s.view.byteLength/Int32Array.BYTES_PER_ELEMENT);case 7:return new Uint32Array(c,s.view.byteOffset,s.view.byteLength/Uint32Array.BYTES_PER_ELEMENT);case 8:return new Float32Array(c,s.view.byteOffset,s.view.byteLength/Float32Array.BYTES_PER_ELEMENT);case 9:return new Float64Array(c,s.view.byteOffset,s.view.byteLength/Float64Array.BYTES_PER_ELEMENT);case 10:return new BigInt64Array(c,s.view.byteOffset,s.view.byteLength/BigInt64Array.BYTES_PER_ELEMENT);case 11:return new BigUint64Array(c,s.view.byteOffset,s.view.byteLength/BigUint64Array.BYTES_PER_ELEMENT);default:throw new Error("Unknown array buffer view type")}return c}return r}:void 0;return{message:JSON.parse(a,t),arrayBuffers:e}}var OY=class extends C{constructor(e,t,o){super();this._openerService=t;this._productService=o;this._webviews=new Map;this._proxy=e.getProxy(Zi.ExtHostWebviews)}static{this.standardSupportedLinkSchemes=new Set([Y.http,Y.https,Y.mailto,Y.vscode,"vscode-insider"])}addWebview(e,t,o){if(this._webviews.has(e))throw new Error("Webview already registered");this._webviews.set(e,t),this.hookupWebviewEventDelegate(e,t,o)}$setHtml(e,t){this.tryGetWebview(e)?.setHtml(t)}$setOptions(e,t){let o=this.tryGetWebview(e);o&&(o.contentOptions=fke(t))}async $postMessage(e,t,...o){let n=this.tryGetWebview(e);if(!n)return!1;let{message:r,arrayBuffers:s}=HYi(t,o);return n.postMessage(r,s)}hookupWebviewEventDelegate(e,t,o){let n=new P;n.add(t.onDidClickLink(r=>this.onDidClickLink(e,r))),n.add(t.onMessage(r=>{let s=BYi(r.message,o);this._proxy.$onMessage(e,s.message,new qh(s.buffers))})),n.add(t.onMissingCsp(r=>this._proxy.$onMissingCsp(e,r.value))),n.add(t.onDidDispose(()=>{n.dispose(),this._webviews.delete(e)}))}onDidClickLink(e,t){let o=this.getWebview(e);this.isSupportedLink(o,A.parse(t))&&this._openerService.open(t,{fromUserGesture:!0,allowContributedOpeners:!0,allowCommands:Array.isArray(o.contentOptions.enableCommandUris)||o.contentOptions.enableCommandUris===!0,fromWorkspace:!0})}isSupportedLink(e,t){return OY.standardSupportedLinkSchemes.has(t.scheme)||!Gt&&this._productService.urlProtocol===t.scheme?!0:t.scheme===Y.command?Array.isArray(e.contentOptions.enableCommandUris)?e.contentOptions.enableCommandUris.includes(t.path):e.contentOptions.enableCommandUris===!0:!1}tryGetWebview(e){return this._webviews.get(e)}getWebview(e){let t=this.tryGetWebview(e);if(!t)throw new Error(`Unknown webview handle:${e}`);return t}getWebviewResolvedFailedContent(e){return`<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<meta http-equiv="Content-Security-Policy" content="default-src 'none';">
</head>
<body>${d(3064,null,ur(e))}</body>
</html>`}};OY=I([m(1,Qe),m(2,nt)],OY);function Pce(a){return{id:a.id,location:A.revive(a.location)}}function fke(a){return{allowScripts:a.enableScripts,allowForms:a.enableForms,enableCommandUris:a.enableCommandUris,localResourceRoots:Array.isArray(a.localResourceRoots)?a.localResourceRoots.map(i=>A.revive(i)):void 0,portMapping:a.portMapping}}var Bl=class a{constructor(i,e){this.storageService=e;this.id=a.COMMON_PREFIX+i}static{this.applicationMementos=new Map}static{this.profileMementos=new Map}static{this.workspaceMementos=new Map}static{this.COMMON_PREFIX="memento/"}getMemento(i,e){switch(i){case 1:{let t=a.workspaceMementos.get(this.id);return t||(t=new X8e(this.id,i,e,this.storageService),a.workspaceMementos.set(this.id,t)),t.getMemento()}case 0:{let t=a.profileMementos.get(this.id);return t||(t=new X8e(this.id,i,e,this.storageService),a.profileMementos.set(this.id,t)),t.getMemento()}case-1:{let t=a.applicationMementos.get(this.id);return t||(t=new X8e(this.id,i,e,this.storageService),a.applicationMementos.set(this.id,t)),t.getMemento()}}}onDidChangeValue(i,e){return this.storageService.onDidChangeValue(i,this.id,e)}saveMemento(){a.workspaceMementos.get(this.id)?.save(),a.profileMementos.get(this.id)?.save(),a.applicationMementos.get(this.id)?.save()}reloadMemento(i){let e;switch(i){case-1:e=a.applicationMementos.get(this.id);break;case 0:e=a.profileMementos.get(this.id);break;case 1:e=a.workspaceMementos.get(this.id);break}e?.reload()}static clear(i){switch(i){case 1:a.workspaceMementos.clear();break;case 0:a.profileMementos.clear();break;case-1:a.applicationMementos.clear();break}}},X8e=class{constructor(i,e,t,o){this.id=i;this.scope=e;this.target=t;this.storageService=o;this.mementoObj=this.doLoad()}doLoad(){try{return this.storageService.getObject(this.id,this.scope,{})}catch(i){mt(`[memento]: failed to parse contents: ${i} (id: ${this.id}, scope: ${this.scope}, contents: ${this.storageService.get(this.id,this.scope)})`)}return{}}getMemento(){return this.mementoObj}reload(){for(let i of Object.getOwnPropertyNames(this.mementoObj))delete this.mementoObj[i];Object.assign(this.mementoObj,this.doLoad())}save(){mf(this.mementoObj)?this.storageService.remove(this.id,this.scope):this.storageService.store(this.id,this.mementoObj,this.scope,this.target)}};var OTt=new Q("webviewFindWidgetVisible",!1),bz=new Q("webviewFindWidgetFocused",!1),FTt=new Q("webviewFindWidgetEnabled",!1),wm=ae("webviewService");function UYi(a,i){return a.allowMultipleAPIAcquire===i.allowMultipleAPIAcquire&&a.allowScripts===i.allowScripts&&a.allowForms===i.allowForms&&$i(a.localResourceRoots,i.localResourceRoots,Xe)&&$i(a.portMapping,i.portMapping,(e,t)=>e.extensionHostPort===t.extensionHostPort&&e.webviewPort===t.webviewPort)&&I1o(a,i)}function I1o(a,i){return a.enableCommandUris===i.enableCommandUris?!0:Array.isArray(a.enableCommandUris)&&Array.isArray(i.enableCommandUris)?$i(a.enableCommandUris,i.enableCommandUris):!1}var $j=class{constructor(i,e){this._memento=new Bl(i,e),this._state=this._memento.getMemento(-1,1)}getOrigin(i,e){let t=this._getKey(i,e),o=this._state[t];if(o&&typeof o=="string")return o;let n=_t();return this._state[t]=n,this._memento.saveMemento(),n}_getKey(i,e){return JSON.stringify({viewType:i,key:e})}};$j=I([m(1,le)],$j);var vz=class{constructor(i,e){this._store=new $j(i,e)}getOrigin(i,e){return this._store.getOrigin(i,e.value)}};vz=I([m(1,le)],vz);var Odi=class{constructor(i,e,t,o){this.editor=i;this.line=e;this.height=t;this.webview=o;this.domNode=document.createElement("div"),this.domNode.style.zIndex="10",this.afterLineNumber=e,this.afterColumn=1,this.heightInLines=t,i.changeViewZones(n=>this._id=n.addZone(this)),o.mountTo(this.domNode,Me(i.getDomNode()))}dispose(){this.editor.changeViewZones(i=>this._id&&i.removeZone(this._id))}},WTt=class{constructor(i,e,t){this._editorService=e;this._webviewService=t;this._disposables=new P;this._insets=new Map;this._proxy=i.getProxy(Zi.ExtHostEditorInsets)}dispose(){this._disposables.dispose()}async $createEditorInset(i,e,t,o,n,r,s,l){let c;e=e.substr(0,e.indexOf(","));for(let f of this._editorService.listCodeEditors())if(f.getId()===e&&f.hasModel()&&Xe(f.getModel().uri,A.revive(t))){c=f;break}if(!c){setTimeout(()=>this._proxy.$onDidDispose(i));return}let u=new P,p=this._webviewService.createWebviewElement({title:void 0,options:{enableFindWidget:!1},contentOptions:fke(r),extension:{id:s,location:A.revive(l)}}),h=new Odi(c,o,n,p),g=()=>{u.dispose(),this._proxy.$onDidDispose(i),this._insets.delete(i)};u.add(c.onDidChangeModel(g)),u.add(c.onDidDispose(g)),u.add(h),u.add(p),u.add(p.onMessage(f=>this._proxy.$onDidReceiveMessage(i,f.message))),this._insets.set(i,h)}$disposeEditorInset(i){let e=this.getInset(i);this._insets.delete(i),e.dispose()}$setHtml(i,e){this.getInset(i).webview.setHtml(e)}$setOptions(i,e){let t=this.getInset(i);t.webview.contentOptions=fke(e)}async $postMessage(i,e){return this.getInset(i).webview.postMessage(e),!0}getInset(i){let e=this._insets.get(i);if(!e)throw new Error("Unknown inset");return e}};WTt=I([vo(Gi.MainThreadEditorInsets),m(1,Kt),m(2,wm)],WTt);var VTt={},kd={exports:VTt};(function(a,i){if(typeof VTt=="object"&&typeof kd=="object")kd.exports=i();else if(typeof define=="function"&&define.amd)define([],i);else{var e=i();for(var t in e)(typeof VTt=="object"?VTt:a)[t]=e[t]}})(typeof self<"u"?self:void 0,(function(){return(function(a){var i={};function e(t){if(i[t])return i[t].exports;var o=i[t]={i:t,l:!1,exports:{}};return a[t].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=a,e.c=i,e.d=function(t,o,n){e.o(t,o)||Object.defineProperty(t,o,{enumerable:!0,get:n})},e.r=function(t){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,o){if(1&o&&(t=e(t)),8&o||4&o&&typeof t=="object"&&t&&t.__esModule)return t;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&o&&typeof t!="string")for(var r in t)e.d(n,r,function(s){return t[s]}.bind(null,r));return n},e.n=function(t){var o=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(o,"a",o),o},e.o=function(t,o){return Object.prototype.hasOwnProperty.call(t,o)},e.p="",e(e.s=0)})([function(a,i,e){(function(t){var o;i=a.exports=ba,o=typeof t=="object"&&t.env&&t.env.NODE_DEBUG&&/\bsemver\b/i.test(t.env.NODE_DEBUG)?function(){var Ut=Array.prototype.slice.call(arguments,0);Ut.unshift("SEMVER"),console.log.apply(console,Ut)}:function(){},i.SEMVER_SPEC_VERSION="2.0.0";var n=256,r=Number.MAX_SAFE_INTEGER||9007199254740991,s=i.re=[],l=i.src=[],c=0,u=c++;l[u]="0|[1-9]\\d*";var p=c++;l[p]="[0-9]+";var h=c++;l[h]="\\d*[a-zA-Z-][a-zA-Z0-9-]*";var g=c++;l[g]="("+l[u]+")\\.("+l[u]+")\\.("+l[u]+")";var f=c++;l[f]="("+l[p]+")\\.("+l[p]+")\\.("+l[p]+")";var v=c++;l[v]="(?:"+l[u]+"|"+l[h]+")";var b=c++;l[b]="(?:"+l[p]+"|"+l[h]+")";var S=c++;l[S]="(?:-("+l[v]+"(?:\\."+l[v]+")*))";var y=c++;l[y]="(?:-?("+l[b]+"(?:\\."+l[b]+")*))";var w=c++;l[w]="[0-9A-Za-z-]+";var k=c++;l[k]="(?:\\+("+l[w]+"(?:\\."+l[w]+")*))";var T=c++,N="v?"+l[g]+l[S]+"?"+l[k]+"?";l[T]="^"+N+"$";var O="[v=\\s]*"+l[f]+l[y]+"?"+l[k]+"?",V=c++;l[V]="^"+O+"$";var U=c++;l[U]="((?:<|>)?=?)";var G=c++;l[G]=l[p]+"|x|X|\\*";var $=c++;l[$]=l[u]+"|x|X|\\*";var te=c++;l[te]="[v=\\s]*("+l[$]+")(?:\\.("+l[$]+")(?:\\.("+l[$]+")(?:"+l[S]+")?"+l[k]+"?)?)?";var pe=c++;l[pe]="[v=\\s]*("+l[G]+")(?:\\.("+l[G]+")(?:\\.("+l[G]+")(?:"+l[y]+")?"+l[k]+"?)?)?";var de=c++;l[de]="^"+l[U]+"\\s*"+l[te]+"$";var se=c++;l[se]="^"+l[U]+"\\s*"+l[pe]+"$";var Se=c++;l[Se]="(?:^|[^\\d])(\\d{1,16})(?:\\.(\\d{1,16}))?(?:\\.(\\d{1,16}))?(?:$|[^\\d])";var ke=c++;l[ke]="(?:~>?)";var Ee=c++;l[Ee]="(\\s*)"+l[ke]+"\\s+",s[Ee]=new RegExp(l[Ee],"g");var He=c++;l[He]="^"+l[ke]+l[te]+"$";var Ve=c++;l[Ve]="^"+l[ke]+l[pe]+"$";var Fe=c++;l[Fe]="(?:\\^)";var Qt=c++;l[Qt]="(\\s*)"+l[Fe]+"\\s+",s[Qt]=new RegExp(l[Qt],"g");var Ze=c++;l[Ze]="^"+l[Fe]+l[te]+"$";var Ti=c++;l[Ti]="^"+l[Fe]+l[pe]+"$";var ti=c++;l[ti]="^"+l[U]+"\\s*("+O+")$|^$";var bo=c++;l[bo]="^"+l[U]+"\\s*("+N+")$|^$";var Ro=c++;l[Ro]="(\\s*)"+l[U]+"\\s*("+O+"|"+l[te]+")",s[Ro]=new RegExp(l[Ro],"g");var _o=c++;l[_o]="^\\s*("+l[te]+")\\s+-\\s+("+l[te]+")\\s*$";var sr=c++;l[sr]="^\\s*("+l[pe]+")\\s+-\\s+("+l[pe]+")\\s*$";var ln=c++;l[ln]="(<|>)?=?\\s*\\*";for(var en=0;en<35;en++)o(en,l[en]),s[en]||(s[en]=new RegExp(l[en]));function Ws(Ut,_i){if(Ut instanceof ba)return Ut;if(typeof Ut!="string"||Ut.length>n||!(_i?s[V]:s[T]).test(Ut))return null;try{return new ba(Ut,_i)}catch{return null}}function ba(Ut,_i){if(Ut instanceof ba){if(Ut.loose===_i)return Ut;Ut=Ut.version}else if(typeof Ut!="string")throw new TypeError("Invalid Version: "+Ut);if(Ut.length>n)throw new TypeError("version is longer than "+n+" characters");if(!(this instanceof ba))return new ba(Ut,_i);o("SemVer",Ut,_i),this.loose=_i;var eo=Ut.trim().match(_i?s[V]:s[T]);if(!eo)throw new TypeError("Invalid Version: "+Ut);if(this.raw=Ut,this.major=+eo[1],this.minor=+eo[2],this.patch=+eo[3],this.major>r||this.major<0)throw new TypeError("Invalid major version");if(this.minor>r||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>r||this.patch<0)throw new TypeError("Invalid patch version");eo[4]?this.prerelease=eo[4].split(".").map((function(Ar){if(/^[0-9]+$/.test(Ar)){var na=+Ar;if(na>=0&&na<r)return na}return Ar})):this.prerelease=[],this.build=eo[5]?eo[5].split("."):[],this.format()}i.parse=Ws,i.valid=function(Ut,_i){var eo=Ws(Ut,_i);return eo?eo.version:null},i.clean=function(Ut,_i){var eo=Ws(Ut.trim().replace(/^[=v]+/,""),_i);return eo?eo.version:null},i.SemVer=ba,ba.prototype.format=function(){return this.version=this.major+"."+this.minor+"."+this.patch,this.prerelease.length&&(this.version+="-"+this.prerelease.join(".")),this.version},ba.prototype.toString=function(){return this.version},ba.prototype.compare=function(Ut){return o("SemVer.compare",this.version,this.loose,Ut),Ut instanceof ba||(Ut=new ba(Ut,this.loose)),this.compareMain(Ut)||this.comparePre(Ut)},ba.prototype.compareMain=function(Ut){return Ut instanceof ba||(Ut=new ba(Ut,this.loose)),Dg(this.major,Ut.major)||Dg(this.minor,Ut.minor)||Dg(this.patch,Ut.patch)},ba.prototype.comparePre=function(Ut){if(Ut instanceof ba||(Ut=new ba(Ut,this.loose)),this.prerelease.length&&!Ut.prerelease.length)return-1;if(!this.prerelease.length&&Ut.prerelease.length)return 1;if(!this.prerelease.length&&!Ut.prerelease.length)return 0;var _i=0;do{var eo=this.prerelease[_i],Ar=Ut.prerelease[_i];if(o("prerelease compare",_i,eo,Ar),eo===void 0&&Ar===void 0)return 0;if(Ar===void 0)return 1;if(eo===void 0)return-1;if(eo!==Ar)return Dg(eo,Ar)}while(++_i)},ba.prototype.inc=function(Ut,_i){switch(Ut){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",_i);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",_i);break;case"prepatch":this.prerelease.length=0,this.inc("patch",_i),this.inc("pre",_i);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",_i),this.inc("pre",_i);break;case"major":this.minor===0&&this.patch===0&&this.prerelease.length!==0||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":this.patch===0&&this.prerelease.length!==0||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":if(this.prerelease.length===0)this.prerelease=[0];else{for(var eo=this.prerelease.length;--eo>=0;)typeof this.prerelease[eo]=="number"&&(this.prerelease[eo]++,eo=-2);eo===-1&&this.prerelease.push(0)}_i&&(this.prerelease[0]===_i?isNaN(this.prerelease[1])&&(this.prerelease=[_i,0]):this.prerelease=[_i,0]);break;default:throw new Error("invalid increment argument: "+Ut)}return this.format(),this.raw=this.version,this},i.inc=function(Ut,_i,eo,Ar){typeof eo=="string"&&(Ar=eo,eo=void 0);try{return new ba(Ut,eo).inc(_i,Ar).version}catch{return null}},i.diff=function(Ut,_i){if(Dh(Ut,_i))return null;var eo=Ws(Ut),Ar=Ws(_i);if(eo.prerelease.length||Ar.prerelease.length){for(var na in eo)if((na==="major"||na==="minor"||na==="patch")&&eo[na]!==Ar[na])return"pre"+na;return"prerelease"}for(var na in eo)if((na==="major"||na==="minor"||na==="patch")&&eo[na]!==Ar[na])return na},i.compareIdentifiers=Dg;var Id=/^[0-9]+$/;function Dg(Ut,_i){var eo=Id.test(Ut),Ar=Id.test(_i);return eo&&Ar&&(Ut=+Ut,_i=+_i),eo&&!Ar?-1:Ar&&!eo?1:Ut<_i?-1:Ut>_i?1:0}function yd(Ut,_i,eo){return new ba(Ut,eo).compare(new ba(_i,eo))}function uu(Ut,_i,eo){return yd(Ut,_i,eo)>0}function Jm(Ut,_i,eo){return yd(Ut,_i,eo)<0}function Dh(Ut,_i,eo){return yd(Ut,_i,eo)===0}function Rp(Ut,_i,eo){return yd(Ut,_i,eo)!==0}function Uv(Ut,_i,eo){return yd(Ut,_i,eo)>=0}function Cr(Ut,_i,eo){return yd(Ut,_i,eo)<=0}function sx(Ut,_i,eo,Ar){var na;switch(_i){case"===":typeof Ut=="object"&&(Ut=Ut.version),typeof eo=="object"&&(eo=eo.version),na=Ut===eo;break;case"!==":typeof Ut=="object"&&(Ut=Ut.version),typeof eo=="object"&&(eo=eo.version),na=Ut!==eo;break;case"":case"=":case"==":na=Dh(Ut,eo,Ar);break;case"!=":na=Rp(Ut,eo,Ar);break;case">":na=uu(Ut,eo,Ar);break;case">=":na=Uv(Ut,eo,Ar);break;case"<":na=Jm(Ut,eo,Ar);break;case"<=":na=Cr(Ut,eo,Ar);break;default:throw new TypeError("Invalid operator: "+_i)}return na}function Lg(Ut,_i){if(Ut instanceof Lg){if(Ut.loose===_i)return Ut;Ut=Ut.value}if(!(this instanceof Lg))return new Lg(Ut,_i);o("comparator",Ut,_i),this.loose=_i,this.parse(Ut),this.semver===Nw?this.value="":this.value=this.operator+this.semver.version,o("comp",this)}i.rcompareIdentifiers=function(Ut,_i){return Dg(_i,Ut)},i.major=function(Ut,_i){return new ba(Ut,_i).major},i.minor=function(Ut,_i){return new ba(Ut,_i).minor},i.patch=function(Ut,_i){return new ba(Ut,_i).patch},i.compare=yd,i.compareLoose=function(Ut,_i){return yd(Ut,_i,!0)},i.rcompare=function(Ut,_i,eo){return yd(_i,Ut,eo)},i.sort=function(Ut,_i){return Ut.sort((function(eo,Ar){return i.compare(eo,Ar,_i)}))},i.rsort=function(Ut,_i){return Ut.sort((function(eo,Ar){return i.rcompare(eo,Ar,_i)}))},i.gt=uu,i.lt=Jm,i.eq=Dh,i.neq=Rp,i.gte=Uv,i.lte=Cr,i.cmp=sx,i.Comparator=Lg;var Nw={};function gp(Ut,_i){if(Ut instanceof gp)return Ut.loose===_i?Ut:new gp(Ut.raw,_i);if(Ut instanceof Lg)return new gp(Ut.value,_i);if(!(this instanceof gp))return new gp(Ut,_i);if(this.loose=_i,this.raw=Ut,this.set=Ut.split(/\s*\|\|\s*/).map((function(eo){return this.parseRange(eo.trim())}),this).filter((function(eo){return eo.length})),!this.set.length)throw new TypeError("Invalid SemVer Range: "+Ut);this.format()}function uf(Ut){return!Ut||Ut.toLowerCase()==="x"||Ut==="*"}function KG(Ut,_i,eo,Ar,na,Rg,wo,tn,Pt,Ke,ye,Be,Tt){return((_i=uf(eo)?"":uf(Ar)?">="+eo+".0.0":uf(na)?">="+eo+"."+Ar+".0":">="+_i)+" "+(tn=uf(Pt)?"":uf(Ke)?"<"+(+Pt+1)+".0.0":uf(ye)?"<"+Pt+"."+(+Ke+1)+".0":Be?"<="+Pt+"."+Ke+"."+ye+"-"+Be:"<="+tn)).trim()}function e6(Ut,_i){for(var eo=0;eo<Ut.length;eo++)if(!Ut[eo].test(_i))return!1;if(_i.prerelease.length){for(eo=0;eo<Ut.length;eo++)if(o(Ut[eo].semver),Ut[eo].semver!==Nw&&Ut[eo].semver.prerelease.length>0){var Ar=Ut[eo].semver;if(Ar.major===_i.major&&Ar.minor===_i.minor&&Ar.patch===_i.patch)return!0}return!1}return!0}function ax(Ut,_i,eo){try{_i=new gp(_i,eo)}catch{return!1}return _i.test(Ut)}function II(Ut,_i,eo,Ar){var na,Rg,wo,tn,Pt;switch(Ut=new ba(Ut,Ar),_i=new gp(_i,Ar),eo){case">":na=uu,Rg=Cr,wo=Jm,tn=">",Pt=">=";break;case"<":na=Jm,Rg=Uv,wo=uu,tn="<",Pt="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(ax(Ut,_i,Ar))return!1;for(var Ke=0;Ke<_i.set.length;++Ke){var ye=_i.set[Ke],Be=null,Tt=null;if(ye.forEach((function(Ht){Ht.semver===Nw&&(Ht=new Lg(">=0.0.0")),Be=Be||Ht,Tt=Tt||Ht,na(Ht.semver,Be.semver,Ar)?Be=Ht:wo(Ht.semver,Tt.semver,Ar)&&(Tt=Ht)})),Be.operator===tn||Be.operator===Pt||(!Tt.operator||Tt.operator===tn)&&Rg(Ut,Tt.semver)||Tt.operator===Pt&&wo(Ut,Tt.semver))return!1}return!0}Lg.prototype.parse=function(Ut){var _i=this.loose?s[ti]:s[bo],eo=Ut.match(_i);if(!eo)throw new TypeError("Invalid comparator: "+Ut);this.operator=eo[1],this.operator==="="&&(this.operator=""),eo[2]?this.semver=new ba(eo[2],this.loose):this.semver=Nw},Lg.prototype.toString=function(){return this.value},Lg.prototype.test=function(Ut){return o("Comparator.test",Ut,this.loose),this.semver===Nw||(typeof Ut=="string"&&(Ut=new ba(Ut,this.loose)),sx(Ut,this.operator,this.semver,this.loose))},Lg.prototype.intersects=function(Ut,_i){if(!(Ut instanceof Lg))throw new TypeError("a Comparator is required");var eo;if(this.operator==="")return eo=new gp(Ut.value,_i),ax(this.value,eo,_i);if(Ut.operator==="")return eo=new gp(this.value,_i),ax(Ut.semver,eo,_i);var Ar=!(this.operator!==">="&&this.operator!==">"||Ut.operator!==">="&&Ut.operator!==">"),na=!(this.operator!=="<="&&this.operator!=="<"||Ut.operator!=="<="&&Ut.operator!=="<"),Rg=this.semver.version===Ut.semver.version,wo=!(this.operator!==">="&&this.operator!=="<="||Ut.operator!==">="&&Ut.operator!=="<="),tn=sx(this.semver,"<",Ut.semver,_i)&&(this.operator===">="||this.operator===">")&&(Ut.operator==="<="||Ut.operator==="<"),Pt=sx(this.semver,">",Ut.semver,_i)&&(this.operator==="<="||this.operator==="<")&&(Ut.operator===">="||Ut.operator===">");return Ar||na||Rg&&wo||tn||Pt},i.Range=gp,gp.prototype.format=function(){return this.range=this.set.map((function(Ut){return Ut.join(" ").trim()})).join("||").trim(),this.range},gp.prototype.toString=function(){return this.range},gp.prototype.parseRange=function(Ut){var _i=this.loose;Ut=Ut.trim(),o("range",Ut,_i);var eo=_i?s[sr]:s[_o];Ut=Ut.replace(eo,KG),o("hyphen replace",Ut),Ut=Ut.replace(s[Ro],"$1$2$3"),o("comparator trim",Ut,s[Ro]),Ut=(Ut=(Ut=Ut.replace(s[Ee],"$1~")).replace(s[Qt],"$1^")).split(/\s+/).join(" ");var Ar=_i?s[ti]:s[bo],na=Ut.split(" ").map((function(Rg){return(function(wo,tn){return o("comp",wo),wo=(function(Pt,Ke){return Pt.trim().split(/\s+/).map((function(ye){return(function(Be,Tt){o("caret",Be,Tt);var Ht=Tt?s[Ti]:s[Ze];return Be.replace(Ht,(function(Do,io,xr,oo,Gr){var Sa;return o("caret",Be,Do,io,xr,oo,Gr),uf(io)?Sa="":uf(xr)?Sa=">="+io+".0.0 <"+(+io+1)+".0.0":uf(oo)?Sa=io==="0"?">="+io+"."+xr+".0 <"+io+"."+(+xr+1)+".0":">="+io+"."+xr+".0 <"+(+io+1)+".0.0":Gr?(o("replaceCaret pr",Gr),Gr.charAt(0)!=="-"&&(Gr="-"+Gr),Sa=io==="0"?xr==="0"?">="+io+"."+xr+"."+oo+Gr+" <"+io+"."+xr+"."+(+oo+1):">="+io+"."+xr+"."+oo+Gr+" <"+io+"."+(+xr+1)+".0":">="+io+"."+xr+"."+oo+Gr+" <"+(+io+1)+".0.0"):(o("no pr"),Sa=io==="0"?xr==="0"?">="+io+"."+xr+"."+oo+" <"+io+"."+xr+"."+(+oo+1):">="+io+"."+xr+"."+oo+" <"+io+"."+(+xr+1)+".0":">="+io+"."+xr+"."+oo+" <"+(+io+1)+".0.0"),o("caret return",Sa),Sa}))})(ye,Ke)})).join(" ")})(wo,tn),o("caret",wo),wo=(function(Pt,Ke){return Pt.trim().split(/\s+/).map((function(ye){return(function(Be,Tt){var Ht=Tt?s[Ve]:s[He];return Be.replace(Ht,(function(Do,io,xr,oo,Gr){var Sa;return o("tilde",Be,Do,io,xr,oo,Gr),uf(io)?Sa="":uf(xr)?Sa=">="+io+".0.0 <"+(+io+1)+".0.0":uf(oo)?Sa=">="+io+"."+xr+".0 <"+io+"."+(+xr+1)+".0":Gr?(o("replaceTilde pr",Gr),Gr.charAt(0)!=="-"&&(Gr="-"+Gr),Sa=">="+io+"."+xr+"."+oo+Gr+" <"+io+"."+(+xr+1)+".0"):Sa=">="+io+"."+xr+"."+oo+" <"+io+"."+(+xr+1)+".0",o("tilde return",Sa),Sa}))})(ye,Ke)})).join(" ")})(wo,tn),o("tildes",wo),wo=(function(Pt,Ke){return o("replaceXRanges",Pt,Ke),Pt.split(/\s+/).map((function(ye){return(function(Be,Tt){Be=Be.trim();var Ht=Tt?s[se]:s[de];return Be.replace(Ht,(function(Do,io,xr,oo,Gr,Sa){o("xRange",Be,Do,io,xr,oo,Gr,Sa);var _r=uf(xr),sl=_r||uf(oo),Dd=sl||uf(Gr);return io==="="&&Dd&&(io=""),_r?Do=io===">"||io==="<"?"<0.0.0":"*":io&&Dd?(sl&&(oo=0),Dd&&(Gr=0),io===">"?(io=">=",sl?(xr=+xr+1,oo=0,Gr=0):Dd&&(oo=+oo+1,Gr=0)):io==="<="&&(io="<",sl?xr=+xr+1:oo=+oo+1),Do=io+xr+"."+oo+"."+Gr):sl?Do=">="+xr+".0.0 <"+(+xr+1)+".0.0":Dd&&(Do=">="+xr+"."+oo+".0 <"+xr+"."+(+oo+1)+".0"),o("xRange return",Do),Do}))})(ye,Ke)})).join(" ")})(wo,tn),o("xrange",wo),wo=(function(Pt,Ke){return o("replaceStars",Pt,Ke),Pt.trim().replace(s[ln],"")})(wo,tn),o("stars",wo),wo})(Rg,_i)})).join(" ").split(/\s+/);return this.loose&&(na=na.filter((function(Rg){return!!Rg.match(Ar)}))),na=na.map((function(Rg){return new Lg(Rg,_i)}))},gp.prototype.intersects=function(Ut,_i){if(!(Ut instanceof gp))throw new TypeError("a Range is required");return this.set.some((function(eo){return eo.every((function(Ar){return Ut.set.some((function(na){return na.every((function(Rg){return Ar.intersects(Rg,_i)}))}))}))}))},i.toComparators=function(Ut,_i){return new gp(Ut,_i).set.map((function(eo){return eo.map((function(Ar){return Ar.value})).join(" ").trim().split(" ")}))},gp.prototype.test=function(Ut){if(!Ut)return!1;typeof Ut=="string"&&(Ut=new ba(Ut,this.loose));for(var _i=0;_i<this.set.length;_i++)if(e6(this.set[_i],Ut))return!0;return!1},i.satisfies=ax,i.maxSatisfying=function(Ut,_i,eo){var Ar=null,na=null;try{var Rg=new gp(_i,eo)}catch{return null}return Ut.forEach((function(wo){Rg.test(wo)&&(Ar&&na.compare(wo)!==-1||(na=new ba(Ar=wo,eo)))})),Ar},i.minSatisfying=function(Ut,_i,eo){var Ar=null,na=null;try{var Rg=new gp(_i,eo)}catch{return null}return Ut.forEach((function(wo){Rg.test(wo)&&(Ar&&na.compare(wo)!==1||(na=new ba(Ar=wo,eo)))})),Ar},i.validRange=function(Ut,_i){try{return new gp(Ut,_i).range||"*"}catch{return null}},i.ltr=function(Ut,_i,eo){return II(Ut,_i,"<",eo)},i.gtr=function(Ut,_i,eo){return II(Ut,_i,">",eo)},i.outside=II,i.prerelease=function(Ut,_i){var eo=Ws(Ut,_i);return eo&&eo.prerelease.length?eo.prerelease:null},i.intersects=function(Ut,_i,eo){return Ut=new gp(Ut,eo),_i=new gp(_i,eo),Ut.intersects(_i)},i.coerce=function(Ut){if(Ut instanceof ba)return Ut;if(typeof Ut!="string")return null;var _i=Ut.match(s[Se]);return _i==null?null:Ws((_i[1]||"0")+"."+(_i[2]||"0")+"."+(_i[3]||"0"))}}).call(this,e(1))},function(a,i){var e,t,o=a.exports={};function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function s(b){if(e===setTimeout)return setTimeout(b,0);if((e===n||!e)&&setTimeout)return e=setTimeout,setTimeout(b,0);try{return e(b,0)}catch{try{return e.call(null,b,0)}catch{return e.call(this,b,0)}}}(function(){try{e=typeof setTimeout=="function"?setTimeout:n}catch{e=n}try{t=typeof clearTimeout=="function"?clearTimeout:r}catch{t=r}})();var l,c=[],u=!1,p=-1;function h(){u&&l&&(u=!1,l.length?c=l.concat(c):p=-1,c.length&&g())}function g(){if(!u){var b=s(h);u=!0;for(var S=c.length;S;){for(l=c,c=[];++p<S;)l&&l[p].run();p=-1,S=c.length}l=null,u=!1,(function(y){if(t===clearTimeout)return clearTimeout(y);if((t===r||!t)&&clearTimeout)return t=clearTimeout,clearTimeout(y);try{t(y)}catch{try{return t.call(null,y)}catch{return t.call(this,y)}}})(b)}}function f(b,S){this.fun=b,this.array=S}function v(){}o.nextTick=function(b){var S=new Array(arguments.length-1);if(arguments.length>1)for(var y=1;y<arguments.length;y++)S[y-1]=arguments[y];c.push(new f(b,S)),c.length!==1||u||s(g)},f.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=v,o.addListener=v,o.once=v,o.off=v,o.removeListener=v,o.removeAllListeners=v,o.emit=v,o.prependListener=v,o.prependOnceListener=v,o.listeners=function(b){return[]},o.binding=function(b){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(b){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}}])}));var Vma=kd.exports.SEMVER_SPEC_VERSION,Bma=kd.exports.parse,vke=kd.exports.valid,zYi=kd.exports.coerce,Hma=kd.exports.clean,Uma=kd.exports.inc,zma=kd.exports.major,Kma=kd.exports.minor,Gma=kd.exports.patch,$ma=kd.exports.prerelease,iR=kd.exports.gt,BTt=kd.exports.gte,qma=kd.exports.lt,KYi=kd.exports.lte,HTt=kd.exports.eq,jma=kd.exports.neq,Qma=kd.exports.cmp,Yma=kd.exports.compare,Xma=kd.exports.rcompare,Jma=kd.exports.compareIdentifiers,Zma=kd.exports.rcompareIdentifiers,eha=kd.exports.compareBuild,tha=kd.exports.sort,iha=kd.exports.rsort,oha=kd.exports.diff,nha=kd.exports.validRange,J8e=kd.exports.satisfies,rha=kd.exports.maxSatisfying,sha=kd.exports.minSatisfying,aha=kd.exports.minVersion,lha=kd.exports.gtr,cha=kd.exports.ltr,dha=kd.exports.outside,uha=kd.exports.intersects,pha=kd.exports.SemVer,mha=kd.exports.Comparator,hha=kd.exports.Range;var y1o=a=>d(1999,null,a),GYi=d(2012,null,"ms-dotnettools.csharp"),bke=class{constructor(i,e,t,o,n){this.extensionsForceVersionByQuality=i;this.logger=e;this.extensionManagementService=t;this.extensionGalleryService=o;this.productService=n;this.extensionsForceVersionByQuality=this.extensionsForceVersionByQuality.map(r=>r.toLowerCase())}get location(){}async listExtensions(i,e,t){let o=await this.extensionManagementService.getInstalled(1,t),n=gO.map(s=>s.toLowerCase());if(e&&e!==""){if(n.indexOf(e.toLowerCase())<0){this.logger.info("Invalid category please enter a valid category. To list valid categories run --category without a category specified");return}o=o.filter(s=>s.manifest.categories?s.manifest.categories.map(c=>c.toLowerCase()).indexOf(e.toLowerCase())>-1:!1)}else if(e===""){this.logger.info("Possible Categories: "),n.forEach(s=>{this.logger.info(s)});return}this.location&&this.logger.info(d(1998,null,this.location)),o=o.sort((s,l)=>s.identifier.id.localeCompare(l.identifier.id));let r;for(let s of o)r!==s.identifier.id&&(r=s.identifier.id,this.logger.info(i?`${r}@${s.manifest.version}`:r))}async installExtensions(i,e,t,o){let n=[];try{i.length&&this.logger.info(this.location?d(1997,null,this.location):d(1996,null));let r=[],s=[],l=(u,p,h)=>{this.extensionsForceVersionByQuality?.some(g=>g===u.toLowerCase())&&(p=this.productService.quality!=="stable"?"prerelease":void 0),s.push({id:u,version:p!=="prerelease"?p:void 0,installOptions:{...t,isBuiltin:h,installPreReleaseVersion:p==="prerelease"||t.installPreReleaseVersion}})};for(let u of i)if(u instanceof A)r.push({vsix:u,installOptions:t});else{let[p,h]=M3e(u);l(p,h,!1)}for(let u of e)if(u instanceof A)r.push({vsix:u,installOptions:{...t,isBuiltin:!0,donotIncludePackAndDependencies:!0}});else{let[p,h]=M3e(u);l(p,h,!0)}let c=await this.extensionManagementService.getInstalled(void 0,t.profileLocation);if(r.length&&await Promise.all(r.map(async({vsix:u,installOptions:p})=>{try{await this.installVSIX(u,p,o,c)}catch(h){this.logger.error(h),n.push(u.toString())}})),s.length){let u=await this.installGalleryExtensions(s,c,o);n.push(...u)}}catch(r){throw this.logger.error(d(1986,null,Cn(r))),r}if(n.length)throw new Error(d(1991,null,n.join(", ")))}async updateExtensions(i){let e=await this.extensionManagementService.getInstalled(1,i),t=[];for(let s of e)s.identifier.uuid&&t.push({...s.identifier,preRelease:s.preRelease});this.logger.trace(d(2010,null,t.length));let o=await this.extensionGalleryService.getExtensions(t,{compatible:!0},ve.None),n=[];for(let s of o)for(let l of e)Ot(l.identifier,s.identifier)&&iR(s.version,l.manifest.version)&&n.push({extension:s,options:{operation:3,installPreReleaseVersion:l.preRelease,profileLocation:i,isApplicationScoped:l.isApplicationScoped}});if(!n.length){this.logger.info(d(2009,null));return}this.logger.info(d(2008,null,n.map(s=>s.extension.identifier.id).join(", ")));let r=await this.extensionManagementService.installGalleryExtensions(n);for(let s of r)s.error?this.logger.error(d(1988,null,s.identifier.id,Cn(s.error))):this.logger.info(d(2005,null,s.identifier.id,s.local?.manifest.version))}async installGalleryExtensions(i,e,t){if(i=i.filter(s=>{let{id:l,version:c,installOptions:u}=s,p=e.find(h=>Ot(h.identifier,{id:l}));if(p){if(!t&&(!c||c==="prerelease"&&p.preRelease))return this.logger.info(d(1983,null,l,p.manifest.version,l)),!1;if(c&&p.manifest.version===c)return this.logger.info(d(1982,null,`${l}@${c}`)),!1;p.preRelease&&c!=="prerelease"&&(u.preRelease=!1)}return!0}),!i.length)return[];let o=[],n=[],r=await this.getGalleryExtensions(i);if(await Promise.all(i.map(async({id:s,version:l,installOptions:c})=>{let u=r.get(s.toLowerCase());if(!u){this.logger.error(`${y1o(l?`${s}@${l}`:s)}
${GYi}`),o.push(s);return}try{let h=await this.extensionGalleryService.getManifest(u,ve.None);if(h&&!this.validateExtensionKind(h))return}catch(h){this.logger.error(h.message||h.stack||h),o.push(s);return}let p=e.find(h=>Ot(h.identifier,u.identifier));if(p){if(u.version===p.manifest.version){this.logger.info(d(1982,null,l?`${s}@${l}`:s));return}this.logger.info(d(2011,null,s,u.version))}c.isBuiltin?this.logger.info(l?d(1994,null,s,l):d(1993,null,s)):this.logger.info(l?d(1995,null,s,l):d(1992,null,s)),n.push({extension:u,options:{...c,installGivenVersion:!!l,isApplicationScoped:c.isApplicationScoped||p?.isApplicationScoped}})})),n.length){let s=await this.extensionManagementService.installGalleryExtensions(n);for(let l of s)l.error?(this.logger.error(d(1987,null,l.identifier.id,Cn(l.error))),o.push(l.identifier.id)):this.logger.info(d(2002,null,l.identifier.id,l.local?.manifest.version))}return o}async installVSIX(i,e,t,o){let n=await this.extensionManagementService.getManifest(i);if(!n)throw new Error("Invalid vsix");if(await this.validateVSIX(n,t,e.profileLocation,o))try{await this.extensionManagementService.install(i,{...e,installGivenVersion:!0}),this.logger.info(d(2006,null,Ye(i)))}catch(s){if(so(s))this.logger.info(d(1985,null,Ye(i)));else throw s}}async getGalleryExtensions(i){let e=new Map,t=i.some(r=>r.installOptions.installPreReleaseVersion),o=await this.extensionManagementService.getTargetPlatform(),n=[];for(let r of i)mj.test(r.id)&&n.push({...r,preRelease:t});if(n.length){let r=await this.extensionGalleryService.getExtensions(n,{targetPlatform:o},ve.None);for(let s of r)e.set(s.identifier.id.toLowerCase(),s)}return e}validateExtensionKind(i){return!0}async validateVSIX(i,e,t,o){if(!e){let n={id:Df(i.publisher,i.name)},r=o.find(s=>Ot(n,s.identifier)&&iR(s.manifest.version,i.version));if(r)return this.logger.info(d(1989,null,r.identifier.id,r.manifest.version,i.version)),!1}return this.validateExtensionKind(i)}async uninstallExtensions(i,e,t){let o=async r=>{if(r instanceof A){let s=await this.extensionManagementService.getManifest(r);return Jb(s.publisher,s.name)}return r},n=[];for(let r of i){let s=await o(r),c=(await this.extensionManagementService.getInstalled(void 0,t)).filter(u=>Ot(u.identifier,{id:s}));if(!c.length)throw new Error(`${this.notInstalled(s)}
${GYi}`);if(c.some(u=>u.type===0)){this.logger.info(d(1984,null,s));return}if(!e&&c.some(u=>u.isBuiltin)){this.logger.info(d(1990,null,s));return}this.logger.info(d(2007,null,s));for(let u of c)await this.extensionManagementService.uninstall(u,{profileLocation:t}),n.push(u);this.location?this.logger.info(d(2004,null,s,this.location)):this.logger.info(d(2003,null,s))}}async locateExtension(i){let e=await this.extensionManagementService.getInstalled();i.forEach(t=>{e.forEach(o=>{if(o.identifier.id===t&&o.location.scheme===Y.file){this.logger.info(o.location.fsPath);return}})})}notInstalled(i){return this.location?d(2001,null,i,this.location):d(2000,null,i)}};bke=I([m(2,ls),m(3,ta),m(4,nt)],bke);var w1o=ls;var Gc=ae("extensionManagementServerService"),Hd=w1o;var Os=ae("extensionEnablementService"),$ha=ae("IWebExtensionsScannerService");var tQe="security.workspace.trust.enabled",Bdi="security.workspace.trust.startupPrompt",Hdi="security.workspace.trust.banner",eQe="security.workspace.trust.untrustedFiles",UTt="security.workspace.trust.emptyWindow",zTt="extensions.supportUntrustedWorkspaces",C1o="content.trust.model.key",Fdi=class{constructor(i,e,t){this.originalWorkspace=i;this.canonicalFolderUris=e;this.canonicalConfiguration=t}get folders(){return this.originalWorkspace.folders.map((i,e)=>({index:i.index,name:i.name,toResource:i.toResource,uri:this.canonicalFolderUris[e]}))}get transient(){return this.originalWorkspace.transient}get configuration(){return this.canonicalConfiguration??this.originalWorkspace.configuration}get id(){return this.originalWorkspace.id}},Ske=class extends C{constructor(e,t){super();this.configurationService=e;this.environmentService=t}isWorkspaceTrustEnabled(){return this.environmentService.disableWorkspaceTrust?!1:!!this.configurationService.getValue(tQe)}};Ske=I([m(0,B),m(1,Vt)],Ske);var Ike=class extends C{constructor(e,t,o,n,r,s,l,c){super();this.configurationService=e;this.remoteAuthorityResolverService=t;this.storageService=o;this.uriIdentityService=n;this.environmentService=r;this.workspaceService=s;this.workspaceTrustEnablementService=l;this.fileService=c;this.storageKey=C1o;this._onDidChangeTrust=this._register(new E);this.onDidChangeTrust=this._onDidChangeTrust.event;this._onDidChangeTrustedFolders=this._register(new E);this.onDidChangeTrustedFolders=this._onDidChangeTrustedFolders.event;this._canonicalStartupFiles=[];this._canonicalUrisResolved=!1,this._canonicalWorkspace=this.workspaceService.getWorkspace(),{promise:this._workspaceResolvedPromise,resolve:this._workspaceResolvedPromiseResolve}=TI(),{promise:this._workspaceTrustInitializedPromise,resolve:this._workspaceTrustInitializedPromiseResolve}=TI(),this._storedTrustState=new Vdi(Gt&&this.isEmptyWorkspace()?void 0:this.storageService),this._trustTransitionManager=this._register(new Wdi),this._trustStateInfo=this.loadTrustInfo(),this._isTrusted=this.calculateWorkspaceTrust(),this.initializeWorkspaceTrust(),this.registerListeners()}initializeWorkspaceTrust(){this.resolveCanonicalUris().then(async()=>{this._canonicalUrisResolved=!0,await this.updateWorkspaceTrust()}).finally(()=>{this._workspaceResolvedPromiseResolve(),this.environmentService.remoteAuthority||this._workspaceTrustInitializedPromiseResolve()}),this.environmentService.remoteAuthority&&this.remoteAuthorityResolverService.resolveAuthority(this.environmentService.remoteAuthority).then(async e=>{this._remoteAuthority=e,await this.fileService.activateProvider(Y.vscodeRemote),await this.updateWorkspaceTrust()}).finally(()=>{this._workspaceTrustInitializedPromiseResolve()}),this.isEmptyWorkspace()&&this._workspaceTrustInitializedPromise.then(()=>{this._storedTrustState.isEmptyWorkspaceTrusted===void 0&&(this._storedTrustState.isEmptyWorkspaceTrusted=this.isWorkspaceTrusted())})}registerListeners(){this._register(this.workspaceService.onDidChangeWorkspaceFolders(async()=>await this.updateWorkspaceTrust())),this._register(this.storageService.onDidChangeValue(-1,this.storageKey,this._store)(async()=>{JSON.stringify(this._trustStateInfo)!==JSON.stringify(this.loadTrustInfo())&&(this._trustStateInfo=this.loadTrustInfo(),this._onDidChangeTrustedFolders.fire(),await this.updateWorkspaceTrust())}))}async getCanonicalUri(e){let t=e;if(this.environmentService.remoteAuthority&&e.scheme===Y.vscodeRemote)t=await this.remoteAuthorityResolverService.getCanonicalURI(e);else if(e.scheme==="vscode-vfs"){let o=e.authority.indexOf("+");o!==-1&&(t=e.with({authority:e.authority.substr(0,o)}))}return t.with({query:null,fragment:null})}async resolveCanonicalUris(){let e=[];if(this.environmentService.filesToOpenOrCreate&&e.push(...this.environmentService.filesToOpenOrCreate),this.environmentService.filesToDiff&&e.push(...this.environmentService.filesToDiff),this.environmentService.filesToMerge&&e.push(...this.environmentService.filesToMerge),e.length){let r=e.filter(l=>!!l.fileUri).map(l=>l.fileUri),s=await Promise.all(r.map(l=>this.getCanonicalUri(l)));this._canonicalStartupFiles.push(...s.filter(l=>this._canonicalStartupFiles.every(c=>!this.uriIdentityService.extUri.isEqual(l,c))))}let t=this.workspaceService.getWorkspace().folders.map(r=>r.uri),o=await Promise.all(t.map(r=>this.getCanonicalUri(r))),n=this.workspaceService.getWorkspace().configuration;n&&Vje(n,this.environmentService)&&(n=await this.getCanonicalUri(n)),this._canonicalWorkspace=new Fdi(this.workspaceService.getWorkspace(),o,n)}loadTrustInfo(){let e=this.storageService.get(this.storageKey,-1),t;try{e&&(t=JSON.parse(e))}catch{}return t||(t={uriTrustInfo:[]}),t.uriTrustInfo||(t.uriTrustInfo=[]),t.uriTrustInfo=t.uriTrustInfo.map(o=>({uri:A.revive(o.uri),trusted:o.trusted})),t.uriTrustInfo=t.uriTrustInfo.filter(o=>o.trusted),t}async saveTrustInfo(){this.storageService.store(this.storageKey,JSON.stringify(this._trustStateInfo),-1,1),this._onDidChangeTrustedFolders.fire(),await this.updateWorkspaceTrust()}getWorkspaceUris(){let e=this._canonicalWorkspace.folders.map(o=>o.uri),t=this._canonicalWorkspace.configuration;return t&&Vje(t,this.environmentService)&&e.push(t),e}calculateWorkspaceTrust(){return this.workspaceTrustEnablementService.isWorkspaceTrustEnabled()?this._canonicalUrisResolved?this.environmentService.remoteAuthority&&this._remoteAuthority?.options?.isTrusted?this._remoteAuthority.options.isTrusted:this.isEmptyWorkspace()?this._storedTrustState.isEmptyWorkspaceTrusted!==void 0?this._storedTrustState.isEmptyWorkspaceTrusted:this._canonicalStartupFiles.length?this.getUrisTrust(this._canonicalStartupFiles):!!this.configurationService.getValue(UTt):this.getUrisTrust(this.getWorkspaceUris()):!1:!0}async updateWorkspaceTrust(e){this.workspaceTrustEnablementService.isWorkspaceTrustEnabled()&&(e===void 0&&(await this.resolveCanonicalUris(),e=this.calculateWorkspaceTrust()),this.isWorkspaceTrusted()!==e&&(this.isTrusted=e,await this._trustTransitionManager.participate(e),this._onDidChangeTrust.fire(e)))}getUrisTrust(e){let t=!0;for(let o of e){let{trusted:n}=this.doGetUriTrustInfo(o);if(!n)return t=n,t}return t}doGetUriTrustInfo(e){if(!this.workspaceTrustEnablementService.isWorkspaceTrustEnabled())return{trusted:!0,uri:e};if(this.uriIdentityService.extUri.isEqual(e,this.environmentService.agentSessionsWorkspace))return{trusted:!0,uri:e};if(this.isTrustedVirtualResource(e))return{trusted:!0,uri:e};if(this.isTrustedByRemote(e))return{trusted:!0,uri:e};let t=!1,o=-1,n=e;for(let r of this._trustStateInfo.uriTrustInfo)if(this.uriIdentityService.extUri.isEqualOrParent(e,r.uri)){let s=r.uri.fsPath;s.length>o&&(o=s.length,t=r.trusted,n=r.uri)}return{trusted:t,uri:n}}async doSetUrisTrust(e,t){let o=!1;for(let n of e)if(t){if(this.isTrustedVirtualResource(n)||this.isTrustedByRemote(n))continue;this._trustStateInfo.uriTrustInfo.find(s=>this.uriIdentityService.extUri.isEqual(s.uri,n))||(this._trustStateInfo.uriTrustInfo.push({uri:n,trusted:!0}),o=!0)}else{let r=this._trustStateInfo.uriTrustInfo.length;this._trustStateInfo.uriTrustInfo=this._trustStateInfo.uriTrustInfo.filter(s=>!this.uriIdentityService.extUri.isEqual(s.uri,n)),r!==this._trustStateInfo.uriTrustInfo.length&&(o=!0)}o&&await this.saveTrustInfo()}isEmptyWorkspace(){if(this.workspaceService.getWorkbenchState()===1)return!0;let e=this.workspaceService.getWorkspace();return e?xx(this.workspaceService.getWorkspace())&&e.folders.length===0:!1}isTrustedVirtualResource(e){return gce(e)&&e.scheme!=="vscode-vfs"}isTrustedByRemote(e){return!this.environmentService.remoteAuthority||!this._remoteAuthority?!1:S6(M7(e),this._remoteAuthority.authority.authority)&&!!this._remoteAuthority.options?.isTrusted}set isTrusted(e){this._isTrusted=e,e||(this._storedTrustState.acceptsOutOfWorkspaceFiles=!1),this.isEmptyWorkspace()&&(this._storedTrustState.isEmptyWorkspaceTrusted=e)}get workspaceResolved(){return this._workspaceResolvedPromise}get workspaceTrustInitialized(){return this._workspaceTrustInitializedPromise}get acceptsOutOfWorkspaceFiles(){return this._storedTrustState.acceptsOutOfWorkspaceFiles}set acceptsOutOfWorkspaceFiles(e){this._storedTrustState.acceptsOutOfWorkspaceFiles=e}isWorkspaceTrusted(){return this._isTrusted}isWorkspaceTrustForced(){return!!(this.environmentService.remoteAuthority&&this._remoteAuthority?.options?.isTrusted!==void 0||this.getWorkspaceUris().filter(t=>!this.isTrustedVirtualResource(t)).length===0)}canSetParentFolderTrust(){let e=VS(this._canonicalWorkspace);if(!$g(e)||e.uri.scheme!==Y.file&&e.uri.scheme!==Y.vscodeRemote)return!1;let t=this.uriIdentityService.extUri.dirname(e.uri);return!this.uriIdentityService.extUri.isEqual(e.uri,t)}async setParentFolderTrust(e){if(this.canSetParentFolderTrust()){let t=VS(this._canonicalWorkspace).uri,o=this.uriIdentityService.extUri.dirname(t);await this.setUrisTrust([o],e)}}canSetWorkspaceTrust(){if(this.environmentService.remoteAuthority&&(!this._remoteAuthority||this._remoteAuthority.options?.isTrusted!==void 0))return!1;if(this.isEmptyWorkspace())return!0;if(this.getWorkspaceUris().filter(n=>!this.isTrustedVirtualResource(n)).length===0)return!1;if(!this.isWorkspaceTrusted())return!0;let t=VS(this._canonicalWorkspace);if(!$g(t)||t.uri.scheme!==Y.file&&t.uri.scheme!=="vscode-vfs")return!1;let o=this.doGetUriTrustInfo(t.uri);if(!o.trusted||!this.uriIdentityService.extUri.isEqual(t.uri,o.uri))return!1;if(this.canSetParentFolderTrust()){let n=this.uriIdentityService.extUri.dirname(t.uri);if(this.doGetUriTrustInfo(n).trusted)return!1}return!0}async setWorkspaceTrust(e){if(this.isEmptyWorkspace()){await this.updateWorkspaceTrust(e);return}let t=this.getWorkspaceUris();await this.setUrisTrust(t,e)}async getUriTrustInfo(e){return this.workspaceTrustEnablementService.isWorkspaceTrustEnabled()?this.isTrustedByRemote(e)?{trusted:!0,uri:e}:this.doGetUriTrustInfo(await this.getCanonicalUri(e)):{trusted:!0,uri:e}}async setUrisTrust(e,t){this.doSetUrisTrust(await Promise.all(e.map(o=>this.getCanonicalUri(o))),t)}getTrustedUris(){return this._trustStateInfo.uriTrustInfo.map(e=>e.uri)}async setTrustedUris(e){this._trustStateInfo.uriTrustInfo=[];for(let t of e){let o=await this.getCanonicalUri(t),n=this.uriIdentityService.extUri.removeTrailingPathSeparator(o),r=!1;for(let s of this._trustStateInfo.uriTrustInfo)if(this.uriIdentityService.extUri.isEqual(s.uri,n)){r=!0;break}r||this._trustStateInfo.uriTrustInfo.push({trusted:!0,uri:n})}await this.saveTrustInfo()}addWorkspaceTrustTransitionParticipant(e){return this._trustTransitionManager.addWorkspaceTrustTransitionParticipant(e)}};Ike=I([m(0,B),m(1,Mc),m(2,le),m(3,dt),m(4,Vt),m(5,Pe),m(6,BL),m(7,be)],Ike);var Z8e=class extends C{constructor(e,t){super();this.configurationService=e;this.workspaceTrustManagementService=t;this._resourcesTrustRequestPromises=new vt;this._resourcesTrustRequestResolvers=new vt;this._onDidInitiateOpenFilesTrustRequest=this._register(new E);this.onDidInitiateOpenFilesTrustRequest=this._onDidInitiateOpenFilesTrustRequest.event;this._onDidInitiateResourcesTrustRequest=this._register(new E);this.onDidInitiateResourcesTrustRequest=this._onDidInitiateResourcesTrustRequest.event;this._onDidInitiateWorkspaceTrustRequest=this._register(new E);this.onDidInitiateWorkspaceTrustRequest=this._onDidInitiateWorkspaceTrustRequest.event;this._onDidInitiateWorkspaceTrustRequestOnStartup=this._register(new E);this.onDidInitiateWorkspaceTrustRequestOnStartup=this._onDidInitiateWorkspaceTrustRequestOnStartup.event}get untrustedFilesSetting(){return this.configurationService.getValue(eQe)}set untrustedFilesSetting(e){this.configurationService.updateValue(eQe,e)}async completeOpenFilesTrustRequest(e,t){this._openFilesTrustRequestResolver&&(e===1&&(this.workspaceTrustManagementService.acceptsOutOfWorkspaceFiles=!0),t&&(e===1&&(this.untrustedFilesSetting="open"),e===2&&(this.untrustedFilesSetting="newWindow")),this._openFilesTrustRequestResolver(e),this._openFilesTrustRequestResolver=void 0,this._openFilesTrustRequestPromise=void 0)}async requestOpenFilesTrust(e){if(!this.workspaceTrustManagementService.isWorkspaceTrusted())return 1;if((await Promise.all(e.map(o=>this.workspaceTrustManagementService.getUriTrustInfo(o)))).map(o=>o.trusted).every(o=>o))return 1;if(this.untrustedFilesSetting!=="prompt"){if(this.untrustedFilesSetting==="newWindow")return 2;if(this.untrustedFilesSetting==="open")return 1}if(this.workspaceTrustManagementService.acceptsOutOfWorkspaceFiles)return 1;if(!this._openFilesTrustRequestPromise)this._openFilesTrustRequestPromise=new Promise(o=>{this._openFilesTrustRequestResolver=o});else return this._openFilesTrustRequestPromise;return this._onDidInitiateOpenFilesTrustRequest.fire(),this._openFilesTrustRequestPromise}async completeResourcesTrustRequest(e,t){let o=this._resourcesTrustRequestResolvers.get(e);if(!o)return;let n=t===1;await this.workspaceTrustManagementService.setUrisTrust([e],n),o(n),this._resourcesTrustRequestResolvers.delete(e),this._resourcesTrustRequestPromises.delete(e)}async requestResourcesTrust(e){if((await this.workspaceTrustManagementService.getUriTrustInfo(e.uri)).trusted)return!0;let o=this._resourcesTrustRequestPromises.get(e.uri);if(o)return o;let n=new Promise(r=>{this._resourcesTrustRequestResolvers.set(e.uri,r)});return this._resourcesTrustRequestPromises.set(e.uri,n),this._onDidInitiateResourcesTrustRequest.fire(e),n}resolveWorkspaceTrustRequest(e){this._workspaceTrustRequestResolver&&(this._workspaceTrustRequestResolver(e??this.workspaceTrustManagementService.isWorkspaceTrusted()),this._workspaceTrustRequestResolver=void 0,this._workspaceTrustRequestPromise=void 0)}cancelWorkspaceTrustRequest(){this._workspaceTrustRequestResolver&&(this._workspaceTrustRequestResolver(void 0),this._workspaceTrustRequestResolver=void 0,this._workspaceTrustRequestPromise=void 0)}async completeWorkspaceTrustRequest(e){if(e===void 0||e===this.workspaceTrustManagementService.isWorkspaceTrusted()){this.resolveWorkspaceTrustRequest(e);return}H.once(this.workspaceTrustManagementService.onDidChangeTrust)(t=>this.resolveWorkspaceTrustRequest(t)),await this.workspaceTrustManagementService.setWorkspaceTrust(e)}async requestWorkspaceTrust(e){if(this.workspaceTrustManagementService.isWorkspaceTrusted())return this.workspaceTrustManagementService.isWorkspaceTrusted();if(!this._workspaceTrustRequestPromise)this._workspaceTrustRequestPromise=new Promise(t=>{this._workspaceTrustRequestResolver=t});else return this._workspaceTrustRequestPromise;return this._onDidInitiateWorkspaceTrustRequest.fire(e),this._workspaceTrustRequestPromise}requestWorkspaceTrustOnStartup(){this._workspaceTrustRequestPromise||(this._workspaceTrustRequestPromise=new Promise(e=>{this._workspaceTrustRequestResolver=e})),this._onDidInitiateWorkspaceTrustRequestOnStartup.fire()}};Z8e=I([m(0,B),m(1,ns)],Z8e);var Wdi=class extends C{constructor(){super(...arguments);this.participants=new Vs}addWorkspaceTrustTransitionParticipant(e){let t=this.participants.push(e);return Z(()=>t())}async participate(e){for(let t of this.participants)await t.participate(e)}dispose(){this.participants.clear(),super.dispose()}},Vdi=class{constructor(i){this._acceptsOutOfWorkspaceFilesKey="acceptsOutOfWorkspaceFiles";this._isEmptyWorkspaceTrustedKey="isEmptyWorkspaceTrusted";i?(this._memento=new Bl("workspaceTrust",i),this._mementoObject=this._memento.getMemento(1,1)):this._mementoObject={}}get acceptsOutOfWorkspaceFiles(){return this._mementoObject[this._acceptsOutOfWorkspaceFilesKey]??!1}set acceptsOutOfWorkspaceFiles(i){this._mementoObject[this._acceptsOutOfWorkspaceFilesKey]=i,this._memento?.saveMemento()}get isEmptyWorkspaceTrusted(){return this._mementoObject[this._isEmptyWorkspaceTrustedKey]}set isEmptyWorkspaceTrusted(i){this._mementoObject[this._isEmptyWorkspaceTrustedKey]=i,this._memento?.saveMemento()}};we(Vd,Z8e,1);var xp=ae("extensionManifestPropertiesService"),iQe=class extends C{constructor(e,t,o,n){super();this.productService=e;this.configurationService=t;this.workspaceTrustEnablementService=o;this.logService=n;this._extensionPointExtensionKindsMap=null;this._productExtensionKindsMap=null;this._configuredExtensionKindsMap=null;this._productVirtualWorkspaceSupportMap=null;this._configuredVirtualWorkspaceSupportMap=null;this._configuredExtensionWorkspaceTrustRequestMap=new Fd;let r=t.inspect(zTt).userValue||{};for(let s of Object.keys(r))this._configuredExtensionWorkspaceTrustRequestMap.set(s,r[s]);if(this._productExtensionWorkspaceTrustRequestMap=new Map,e.extensionUntrustedWorkspaceSupport)for(let s of Object.keys(e.extensionUntrustedWorkspaceSupport))this._productExtensionWorkspaceTrustRequestMap.set(s,e.extensionUntrustedWorkspaceSupport[s])}prefersExecuteOnUI(e){let t=this.getExtensionKind(e);return t.length>0&&t[0]==="ui"}prefersExecuteOnWorkspace(e){let t=this.getExtensionKind(e);return t.length>0&&t[0]==="workspace"}prefersExecuteOnWeb(e){let t=this.getExtensionKind(e);return t.length>0&&t[0]==="web"}canExecuteOnUI(e){return this.getExtensionKind(e).some(o=>o==="ui")}canExecuteOnWorkspace(e){return this.getExtensionKind(e).some(o=>o==="workspace")}canExecuteOnWeb(e){return this.getExtensionKind(e).some(o=>o==="web")}getExtensionKind(e){let t=this.deduceExtensionKind(e),o=this.getConfiguredExtensionKind(e);if(o&&o.length>0){let n=[];for(let r of o)r!=="-web"&&n.push(r);return o.includes("-web")&&!n.length&&(n.push("ui"),n.push("workspace")),Gt&&!o.includes("-web")&&!o.includes("web")&&t.includes("web")&&n.push("web"),n}return t}getUserConfiguredExtensionKind(e){if(this._configuredExtensionKindsMap===null){let o=new Fd,n=this.configurationService.getValue("remote.extensionKind")||{};for(let r of Object.keys(n))o.set(r,n[r]);this._configuredExtensionKindsMap=o}let t=this._configuredExtensionKindsMap.get(e.id);return t?this.toArray(t):void 0}getExtensionUntrustedWorkspaceSupportType(e){if(!this.workspaceTrustEnablementService.isWorkspaceTrustEnabled()||!e.main)return!0;let t=this.getConfiguredExtensionWorkspaceTrustRequest(e),o=this.getProductExtensionWorkspaceTrustRequest(e);return t!==void 0?t:o?.override!==void 0?o.override:e.capabilities?.untrustedWorkspaces?.supported!==void 0?e.capabilities.untrustedWorkspaces.supported:o?.default!==void 0?o.default:!1}getExtensionVirtualWorkspaceSupportType(e){let t=this.getConfiguredVirtualWorkspaceSupport(e);if(t!==void 0)return t;let o=this.getProductVirtualWorkspaceSupport(e);if(o?.override!==void 0)return o.override;let n=e.capabilities?.virtualWorkspaces;if(Da(n))return n;if(n){let r=n.supported;if(Da(r)||r==="limited")return r}return o?.default!==void 0?o.default:!0}deduceExtensionKind(e){if(e.main)return e.browser?Gt?["workspace","web"]:["workspace"]:["workspace"];if(e.browser)return["web"];let t=[...F8i];if((dr(e.extensionPack)||dr(e.extensionDependencies))&&(t=Gt?["workspace","web"]:["workspace"]),e.contributes)for(let o of Object.keys(e.contributes)){let n=this.getSupportedExtensionKindsForExtensionPoint(o);n.length&&(t=t.filter(r=>n.includes(r)))}return t.length||this.logService.warn("Cannot deduce extensionKind for extension",Df(e.publisher,e.name)),t}getSupportedExtensionKindsForExtensionPoint(e){if(this._extensionPointExtensionKindsMap===null){let o=new Map;Tn.getExtensionPoints().forEach(n=>o.set(n.name,n.defaultExtensionKind||[])),this._extensionPointExtensionKindsMap=o}let t=this._extensionPointExtensionKindsMap.get(e);return t||(t=this.productService.extensionPointExtensionKind?this.productService.extensionPointExtensionKind[e]:void 0,t)?t:Gt?["workspace","web"]:["workspace"]}getConfiguredExtensionKind(e){let t={id:Df(e.publisher,e.name)},o=this.getUserConfiguredExtensionKind(t);return typeof o<"u"?this.toArray(o):(o=this.getProductExtensionKind(e),typeof o<"u"?o:(o=e.extensionKind,typeof o<"u"?(o=this.toArray(o),o.filter(n=>["ui","workspace"].includes(n))):null))}getProductExtensionKind(e){if(this._productExtensionKindsMap===null){let o=new Fd;if(this.productService.extensionKind)for(let n of Object.keys(this.productService.extensionKind))o.set(n,this.productService.extensionKind[n]);this._productExtensionKindsMap=o}let t=Df(e.publisher,e.name);return this._productExtensionKindsMap.get(t)}getProductVirtualWorkspaceSupport(e){if(this._productVirtualWorkspaceSupportMap===null){let o=new Fd;if(this.productService.extensionVirtualWorkspacesSupport)for(let n of Object.keys(this.productService.extensionVirtualWorkspacesSupport))o.set(n,this.productService.extensionVirtualWorkspacesSupport[n]);this._productVirtualWorkspaceSupportMap=o}let t=Df(e.publisher,e.name);return this._productVirtualWorkspaceSupportMap.get(t)}getConfiguredVirtualWorkspaceSupport(e){if(this._configuredVirtualWorkspaceSupportMap===null){let o=new Fd,n=this.configurationService.getValue("extensions.supportVirtualWorkspaces")||{};for(let r of Object.keys(n))n[r]!==void 0&&o.set(r,n[r]);this._configuredVirtualWorkspaceSupportMap=o}let t=Df(e.publisher,e.name);return this._configuredVirtualWorkspaceSupportMap.get(t)}getConfiguredExtensionWorkspaceTrustRequest(e){let t=Df(e.publisher,e.name),o=this._configuredExtensionWorkspaceTrustRequestMap.get(t);if(o&&(o.version===void 0||o.version===e.version))return o.supported}getProductExtensionWorkspaceTrustRequest(e){let t=Df(e.publisher,e.name);return this._productExtensionWorkspaceTrustRequestMap.get(t)}toArray(e){return Array.isArray(e)?e:e==="ui"?["ui","workspace"]:[e]}};iQe=I([m(0,nt),m(1,B),m(2,BL),m(3,ne)],iQe);we(xp,iQe,1);qe.registerCommand("_remoteCLI.openExternal",function(a,i){return a.get(Qe).open(Ae(i)?i:A.revive(i),{openExternal:!0,allowTunneling:!0})});qe.registerCommand("_remoteCLI.windowOpen",function(a,i,e){let t=a.get(ge);return i.length?t.executeCommand("_files.windowOpen",i,e):t.executeCommand("_files.newWindow",e)});qe.registerCommand("_remoteCLI.getSystemStatus",function(a){return a.get(ge).executeCommand("_issues.getSystemStatus")});qe.registerCommand("_remoteCLI.manageExtensions",async function(a,i){let e=a.get(F),o=a.get(Gc).remoteExtensionManagementServer?.extensionManagementService;if(!o)return;let n=[],r=new class extends Zbe{log(l,c){n.push(c)}},s=e.createChild(new Io([ls,o]));try{let l=s.createInstance(oQe,r);if(i.list)await l.listExtensions(!!i.list.showVersions,i.list.category,void 0);else{let c=u=>u.map(p=>Ae(p)?p:A.revive(p));if(Array.isArray(i.install)&&i.install.length)try{await l.installExtensions(c(i.install),[],{isMachineScoped:!0},!!i.force)}catch(u){n.push(u.message)}if(Array.isArray(i.uninstall)&&i.uninstall.length)try{await l.uninstallExtensions(c(i.uninstall),!!i.force,void 0)}catch(u){n.push(u.message)}}return n.join(`
`)}finally{s.dispose()}});var oQe=class extends bke{constructor(e,t,o,n,r,s,l){super([],e,t,o,l);this._extensionManifestPropertiesService=s;let c=r.remoteAuthority;this._location=c?n.getHostLabel(Y.vscodeRemote,c):void 0}get location(){return this._location}validateExtensionKind(e){return!this._extensionManifestPropertiesService.canExecuteOnWorkspace(e)&&!(Gt&&this._extensionManifestPropertiesService.canExecuteOnWeb(e))?(this.logger.info(d(3005,null,Jb(e.publisher,e.name))),!1):!0}};oQe=I([m(1,ls),m(2,ta),m(3,ot),m(4,Vt),m(5,xp),m(6,nt)],oQe);var KTt=class{constructor(i,e,t){this._clipboardService=e;this._logService=t}dispose(){}$readText(){return this._logService.trace("MainThreadClipboard#readText"),this._clipboardService.readText()}$writeText(i){return this._logService.trace("MainThreadClipboard#writeText with text.length : ",i.length),this._clipboardService.writeText(i)}};KTt=I([vo(Gi.MainThreadClipboard),m(1,Wi),m(2,ne)],KTt);var GTt=class{constructor(i,e,t){this._commandService=e;this._extensionService=t;this._commandRegistrations=new jt;this._proxy=i.getProxy(Zi.ExtHostCommands),this._generateCommandsDocumentationRegistration=qe.registerCommand("_generateCommandsDocumentation",()=>this._generateCommandsDocumentation())}dispose(){this._commandRegistrations.dispose(),this._generateCommandsDocumentationRegistration.dispose()}async _generateCommandsDocumentation(){let i=await this._proxy.$getContributedCommandMetadata(),e=qe.getCommands();for(let[o,n]of e)n.metadata&&(i[o]=n.metadata);let t=[];for(let o in i)t.push("`"+o+"` - "+x1o(i[o]));console.log(t.join(`
`))}$registerCommand(i){this._commandRegistrations.set(i,qe.registerCommand(i,(e,...t)=>this._proxy.$executeContributedCommand(i,...t).then(o=>Xn(o))))}$unregisterCommand(i){this._commandRegistrations.deleteAndDispose(i)}$fireCommandActivationEvent(i){let e=`onCommand:${i}`;this._extensionService.activationEventIsDone(e)||this._extensionService.activateByEvent(e)}async $executeCommand(i,e,t){e instanceof qh&&(e=e.value);for(let o=0;o<e.length;o++)e[o]=Xn(e[o]);if(t&&e.length>0&&!qe.getCommand(i))throw await this._extensionService.activateByEvent(`onCommand:${i}`),new Error("$executeCommand:retry");return this._commandService.executeCommand(i,...e)}$getCommands(){return Promise.resolve([...qe.getCommands().keys()])}};GTt=I([vo(Gi.MainThreadCommands),m(1,ge),m(2,lt)],GTt);function x1o(a){if(typeof a=="string")return a;{let e=[Ae(a.description)?a.description:a.description.original];if(e.push(`
`),a.args)for(let t of a.args)e.push(`* _${t.name}_ - ${t.description||""}
`);return a.returns&&e.push(`* _(returns)_ - ${a.returns}`),e.push(`
`),e.join("")}}var $Tt=class{constructor(i,e,t,o){this._workspaceContextService=e;this.configurationService=t;this._environmentService=o;let n=i.getProxy(Zi.ExtHostConfiguration);n.$initializeConfiguration(this._getConfigurationData()),this._configurationListener=t.onDidChangeConfiguration(r=>{n.$acceptConfigurationChanged(this._getConfigurationData(),r.change)})}_getConfigurationData(){let i={...this.configurationService.getConfigurationData(),configurationScopes:[]};return(!this._environmentService.isBuilt||this._environmentService.isExtensionDevelopment)&&(i.configurationScopes=OKi()),i}dispose(){this._configurationListener.dispose()}$updateConfigurationOption(i,e,t,o,n){return o={resource:o?.resource?A.revive(o.resource):void 0,overrideIdentifier:o?.overrideIdentifier},this.writeConfiguration(i,e,t,o,n)}$removeConfigurationOption(i,e,t,o){return t={resource:t?.resource?A.revive(t.resource):void 0,overrideIdentifier:t?.overrideIdentifier},this.writeConfiguration(i,e,void 0,t,o)}writeConfiguration(i,e,t,o,n){i=i??this.deriveConfigurationTarget(e,o);let r=this.configurationService.inspect(e,o);switch(i){case 8:return this._updateValue(e,t,i,r?.memory?.override,o,n);case 6:return this._updateValue(e,t,i,r?.workspaceFolder?.override,o,n);case 5:return this._updateValue(e,t,i,r?.workspace?.override,o,n);case 4:return this._updateValue(e,t,i,r?.userRemote?.override,o,n);default:return this._updateValue(e,t,i,r?.userLocal?.override,o,n)}}_updateValue(i,e,t,o,n,r){return n=r===!0?n:r===!1?{resource:n.resource}:n.overrideIdentifier&&o!==void 0?n:{resource:n.resource},this.configurationService.updateValue(i,e,n,t,{donotNotifyError:!0})}deriveConfigurationTarget(i,e){if(e.resource&&this._workspaceContextService.getWorkbenchState()===3){let t=oe.as(ii.Configuration).getConfigurationProperties();if(t[i]&&(t[i].scope===5||t[i].scope===6))return 6}return 5}};$Tt=I([vo(Gi.MainThreadConfiguration),m(1,Pe),m(2,B),m(3,Co)],$Tt);function qTt(a){let i=[],e;try{let t=JSON.parse(a.arguments),o=t[t.length-1];o&&o.__$stack&&(t.pop(),e=o.__$stack),i.push(...t)}catch{i.push("Unable to log remote console arguments",a.arguments)}return{args:i,stack:e}}function k1o(a){if(!a)return a;let i=a.indexOf(`
`);return i===-1?a:a.substring(0,i)}function qYi(a,i){let{args:e,stack:t}=qTt(a),o=typeof e[0]=="string"&&e.length===1,n=k1o(t);n&&(n=`(${n.trim()})`);let r=[];if(typeof e[0]=="string"?n&&o?r=[`%c[${i}] %c${e[0]} %c${n}`,yke("blue"),yke(""),yke("grey")]:r=[`%c[${i}] %c${e[0]}`,yke("blue"),yke(""),...e.slice(1)]:r=[`%c[${i}]%`,yke("blue"),...e],n&&!o&&r.push(n),typeof console[a.severity]!="function")throw new Error("Unknown console method");console[a.severity].apply(console,r)}function yke(a){return`color: ${a}`}function jYi(a,i,e=null){let t=qTt(i).args,o=t.shift();if(typeof o=="string")switch(i.severity||(i.severity="info"),e&&(/^\[/.test(e)||(e=`[${e}]`),/ $/.test(e)||(e=`${e} `),o=e+o),i.severity){case"log":case"info":a.info(o,...t);break;case"warn":a.warn(o,...t);break;case"error":a.error(o,...t);break}}function QYi(a,i,e){let t=qTt(i).args,o=t.shift();typeof o!="string"||i.severity!=="error"||(/^\[/.test(e)||(e=`[${e}]`),/ $/.test(e)||(e=`${e} `),a.error(e+o,...t))}function VO(a){let i=a.isExtensionDevelopment,e=!0,t=a.extensionDevelopmentLocationURI;if(t)for(let s of t)s.scheme!==Y.file&&(e=!1);let o=e&&typeof a.debugExtensionHost.port=="number",n=e&&!!a.debugExtensionHost.break,r=i&&!!a.extensionTestsLocationURI&&!a.debugExtensionHost.debugId;return{isExtensionDevHost:i,isExtensionDevDebug:o,isExtensionDevDebugBrk:n,isExtensionDevTestFromCli:r}}var jTt=class{constructor(i,e,t){this._environmentService=e;this._logService=t;let o=VO(this._environmentService);this._isExtensionDevTestFromCli=o.isExtensionDevTestFromCli}dispose(){}$logExtensionHostMessage(i){this._isExtensionDevTestFromCli?jYi(this._logService,i):(QYi(this._logService,i,"Extension Host"),qYi(i,"Extension Host"))}};jTt=I([vo(Gi.MainThreadConsole),m(1,Co),m(2,ne)],jTt);var jh="workbench.view.debug",Iz="workbench.debug.variablesView",Yx="workbench.debug.watchExpressionsView",qj="workbench.debug.callStackView",Ace="workbench.debug.loadedScriptsView",Xx="workbench.debug.breakPointsView",QTt="workbench.debug.disassemblyView",YTt="workbench.panel.repl",ld="workbench.panel.repl.view",wke=new Q("debugType",void 0,{type:"string",description:d(9237,null)}),YYi=new Q("debugConfigurationType",void 0,{type:"string",description:d(9228,null)}),Fs=new Q("debugState","inactive",{type:"string",description:d(9236,null)}),Udi="debugUx",hP=new Q(Udi,"default",{type:"string",description:d(9238,null)}),XTt=new Q("hasDebugged",!1,{type:"boolean",description:d(9246,null)}),Xa=new Q("inDebugMode",!1,{type:"boolean",description:d(9248,null)}),BO=new Q("inDebugRepl",!1,{type:"boolean",description:d(9249,null)}),nQe=new Q("breakpointWidgetVisible",!1,{type:"boolean",description:d(9218,null)}),zdi=new Q("inBreakpointWidget",!1,{type:"boolean",description:d(9247,null)}),Cke=new Q("breakpointsFocused",!0,{type:"boolean",description:d(9216,null)}),rQe=new Q("watchExpressionsFocused",!0,{type:"boolean",description:d(9274,null)}),sQe=new Q("watchExpressionsExist",!1,{type:"boolean",description:d(9273,null)}),JTt=new Q("variablesFocused",!0,{type:"boolean",description:d(9270,null)}),FY=new Q("expressionSelected",!1,{type:"boolean",description:d(9242,null)}),ZTt=new Q("breakpointInputFocused",!1,{type:"boolean",description:d(9212,null)}),yv=new Q("callStackItemType",void 0,{type:"string",description:d(9224,null)}),e_t=new Q("callStackSessionIsAttach",!1,{type:"boolean",description:d(9226,null)}),WY=new Q("callStackItemStopped",!1,{type:"boolean",description:d(9223,null)}),Kdi=new Q("callStackSessionHasOneThread",!1,{type:"boolean",description:d(9225,null)}),XYi=new Q("callStackFocused",!0,{type:"boolean",description:d(9222,null)}),yz=new Q("watchItemType",void 0,{type:"string",description:d(9275,null)}),VY=new Q("canViewMemory",void 0,{type:"boolean",description:d(9227,null)}),O_=new Q("breakpointItemType",void 0,{type:"string",description:d(9214,null)}),Gdi=new Q("breakpointItemBytes",void 0,{type:"boolean",description:d(9213,null)}),$di=new Q("breakpointHasModes",!1,{type:"boolean",description:d(9211,null)}),t_t=new Q("breakpointSupportsCondition",!1,{type:"boolean",description:d(9217,null)}),aQe=new Q("loadedScriptsSupported",!1,{type:"boolean",description:d(9254,null)}),JYi=new Q("loadedScriptsItemType",void 0,{type:"string",description:d(9253,null)}),fC=new Q("focusedSessionIsAttach",!1,{type:"boolean",description:d(9243,null)}),wz=new Q("focusedSessionIsNoDebug",!1,{type:"boolean",description:d(9244,null)}),lQe=new Q("stepBackSupported",!1,{type:"boolean",description:d(9259,null)}),i_t=new Q("restartFrameSupported",!1,{type:"boolean",description:d(9257,null)}),o_t=new Q("stackFrameSupportsRestart",!1,{type:"boolean",description:d(9258,null)}),Nce=new Q("jumpToCursorSupported",!1,{type:"boolean",description:d(9251,null)}),BY=new Q("stepIntoTargetsSupported",!1,{type:"boolean",description:d(9260,null)}),jj=new Q("breakpointsExist",!1,{type:"boolean",description:d(9215,null)}),fa=new Q("debuggersAvailable",!1,{type:"boolean",description:d(9231,null)}),n_t=new Q("debugExtensionAvailable",!0,{type:"boolean",description:d(9229,null)}),ZYi=new Q("debugProtocolVariableMenuContext",void 0,{type:"string",description:d(9232,null)}),cQe=new Q("debugSetVariableSupported",!1,{type:"boolean",description:d(9235,null)}),xke=new Q("debugSetDataBreakpointAddressSupported",!1,{type:"boolean",description:d(9233,null)}),dQe=new Q("debugSetExpressionSupported",!1,{type:"boolean",description:d(9234,null)}),Cz=new Q("breakWhenValueChangesSupported",!1,{type:"boolean",description:d(9219,null)}),HY=new Q("breakWhenValueIsAccessedSupported",!1,{type:"boolean",description:d(9220,null)}),UY=new Q("breakWhenValueIsReadSupported",!1,{type:"boolean",description:d(9221,null)}),gP=new Q("terminateDebuggeeSupported",!1,{type:"boolean",description:d(9262,null)}),zY=new Q("suspendDebuggeeSupported",!1,{type:"boolean",description:d(9261,null)}),uQe=new Q("terminateThreadsSupported",!1,{type:"boolean",description:d(9263,null)}),hV=new Q("variableEvaluateNamePresent",!1,{type:"boolean",description:d(9264,null)}),Oce=new Q("variableIsReadonly",!1,{type:"boolean",description:d(9267,null)}),kke=new Q("variableValue",!1,{type:"string",description:d(9272,null)}),KY=new Q("variableType",!1,{type:"string",description:d(9271,null)}),eXi=new Q("variableInterfaces",!1,{type:"array",description:d(9266,null)}),r_t=new Q("variableName",!1,{type:"string",description:d(9269,null)}),tXi=new Q("variableLanguage",!1,{type:"string",description:d(9268,null)}),iXi=new Q("variableExtensionId",!1,{type:"string",description:d(9265,null)}),s_t=new Q("exceptionWidgetVisible",!1,{type:"boolean",description:d(9241,null)}),qdi=new Q("multiSessionRepl",!1,{type:"boolean",description:d(9256,null)}),a_t=new Q("multiSessionDebug",!1,{type:"boolean",description:d(9255,null)}),Eke=new Q("disassembleRequestSupported",!1,{type:"boolean",description:d(9239,null)}),xz=new Q("disassemblyViewFocus",!1,{type:"boolean",description:d(9240,null)}),l_t=new Q("languageSupportsDisassembleRequest",!1,{type:"boolean",description:d(9252,null)}),c_t=new Q("focusedStackFrameHasInstructionReference",!1,{type:"boolean",description:d(9245,null)}),d_t=a=>d(9230,null,a),gV="editor.contrib.debug",fP="editor.contrib.breakpoint",vC="debug",u_t={enum:["neverOpen","openOnSessionStart","openOnFirstSessionStart"],default:"openOnFirstSessionStart",description:d(9250,null)};function oR(a){switch(a){case 1:return"initializing";case 2:return"stopped";case 3:return"running";default:return"inactive"}}var Fce="vscode-debug-memory";function kz(a){let i=a.presentationHint??a.source.presentationHint;return i==="deemphasize"||i==="subtle"}var Li=ae("debugService");var E1o;(e=>(e.deserialize=t=>t,e.serialize=t=>t))(E1o||={});var jdi;(e=>(e.deserialize=t=>({id:t.id,name:t.name,iconPath:t.iconPath&&{light:A.revive(t.iconPath.light),dark:A.revive(t.iconPath.dark)},iconClass:t.iconClass,visualization:t.visualization}),e.serialize=t=>t))(jdi||={});var p_t=class{constructor(){this.pendingRequests=new Map;this.queue=[];this._onError=new E;this._onExit=new E;this.sequence=1}get onError(){return this._onError.event}get onExit(){return this._onExit.event}onMessage(i){this.messageCallback&&this._onError.fire(new Error("attempt to set more than one 'Message' callback")),this.messageCallback=i}onEvent(i){this.eventCallback&&this._onError.fire(new Error("attempt to set more than one 'Event' callback")),this.eventCallback=i}onRequest(i){this.requestCallback&&this._onError.fire(new Error("attempt to set more than one 'Request' callback")),this.requestCallback=i}sendResponse(i){i.seq>0?this._onError.fire(new Error(`attempt to send more than one response for command ${i.command}`)):this.internalSend("response",i)}sendRequest(i,e,t,o){let n={command:i};if(e&&Object.keys(e).length>0&&(n.arguments=e),this.internalSend("request",n),typeof o=="number"){let r=setTimeout(()=>{clearTimeout(r);let s=this.pendingRequests.get(n.seq);if(s){this.pendingRequests.delete(n.seq);let l={type:"response",seq:0,request_seq:n.seq,success:!1,command:i,message:d(9210,null,o,i)};s(l)}},o)}return t&&this.pendingRequests.set(n.seq,t),n.seq}acceptMessage(i){this.messageCallback?this.messageCallback(i):(this.queue.push(i),this.queue.length===1&&this.processQueue())}needsTaskBoundaryBetween(i,e){return i.type!=="event"||e.type!=="event"}async processQueue(){let i;for(;this.queue.length;){if((!i||this.needsTaskBoundaryBetween(this.queue[0],i))&&await Pi(0),i=this.queue.shift(),!i)return;switch(i.type){case"event":this.eventCallback?.(i);break;case"request":this.requestCallback?.(i);break;case"response":{let e=i,t=this.pendingRequests.get(e.request_seq);t&&(this.pendingRequests.delete(e.request_seq),t(e));break}}}}internalSend(i,e){e.type=i,e.seq=this.sequence++,this.sendMessage(e)}async cancelPendingRequests(){if(this.pendingRequests.size===0)return Promise.resolve();let i=new Map;this.pendingRequests.forEach((e,t)=>i.set(t,e)),await Pi(500),i.forEach((e,t)=>{e({type:"response",seq:0,request_seq:t,success:!1,command:"canceled",message:"canceled"}),this.pendingRequests.delete(t)})}getPendingRequestIds(){return Array.from(this.pendingRequests.keys())}dispose(){this._onError.dispose(),this._onExit.dispose(),this.queue=[]}};var T1o=/{([^}]+)}/g;function nXi(a,i,e){return a.replace(T1o,function(t,o){return i&&o.length>0&&o[0]!=="_"?t:e&&e.hasOwnProperty(o)?e[o]:t})}function rXi(a){let i={};for(let e of Object.keys(a))e.startsWith("!")||(i[e]=a[e]);return i}function Wce(a){return a.configuration.request==="attach"&&!pQe(a)&&(!a.parentSession||Wce(a.parentSession))}function pQe(a){let i=a.configuration.type;if(i)return i==="vslsShare"&&(i=a.configuration.adapterProxy?.configuration?.type||i),mr(i,"extensionhost")||mr(i,"pwa-extensionhost")?a:a.parentSession?pQe(a.parentSession):void 0}function sXi(a){return a.type&&(a.label||a.program||a.runtime)}function _1o(a,i,e){let t,o=0,n=/([^()\[\]{}<>\s+\-/%~#^;=|,`!]|\->)+/g,r=null;for(;r=n.exec(a);){let s=r.index+1,l=s+r[0].length;if(s<=i&&l>=e){t=r[0],o=s;break}}if(t){let s=t.match(/^\.\.\.(.+)/);s&&(t=s[1],o+=3)}if(t){let s=/(\w|\p{L})+/gu,l=null;for(;(l=s.exec(t))&&!(l.index+1+o+l[0].length>=e););l&&(t=t.substring(0,s.lastIndex))}return t?{start:o,end:o+t.length-1}:{start:0,end:0}}async function m_t(a,i,e,t){if(a.evaluatableExpressionProvider.has(i)){let o=a.evaluatableExpressionProvider.ordered(i),n=si(await Promise.all(o.map(async r=>{try{return await r.provideEvaluatableExpression(i,e,t??ve.None)}catch{return}})));if(n.length>0){let r=n[0].expression,s=n[0].range;return r||(r=i.getLineContent(e.lineNumber).substring(s.startColumn-1,s.endColumn-1)),{range:s,matchingExpression:r}}}else{let o=i.getLineContent(e.lineNumber),{start:n,end:r}=_1o(o,e.column,e.column),s=o.substring(n-1,r);return{matchingExpression:s,range:new z(e.lineNumber,n,e.lineNumber,n+s.length)}}return null}var D1o=/^[a-zA-Z][a-zA-Z0-9\+\-\.]+:/;function GY(a){return!!(a&&a.match(D1o))}function aXi(a){if(typeof a.path=="string"&&!(typeof a.sourceReference=="number"&&a.sourceReference>0)){if(GY(a.path))return A.parse(a.path);if(Xl(a.path))return A.file(a.path)}return a.path}function lXi(a){if(typeof a.path=="object"){let i=A.revive(a.path);if(i)return i.scheme===Y.file?i.fsPath:i.toString()}return a.path}function cXi(a,i){let e=i?aXi:lXi,t=Xi(a);return uXi(t,(o,n)=>{o&&n&&(n.path=e(n))}),t}function dXi(a,i){let e=i?aXi:lXi,t=Xi(a);return uXi(t,(o,n)=>{!o&&n&&(n.path=e(n))}),t}function uXi(a,i){switch(a.type){case"event":{let e=a;switch(e.event){case"output":i(!1,e.body.source);break;case"loadedSource":i(!1,e.body.source);break;case"breakpoint":i(!1,e.body.breakpoint.source);break;default:break}break}case"request":{let e=a;switch(e.command){case"setBreakpoints":i(!0,e.arguments.source);break;case"breakpointLocations":i(!0,e.arguments.source);break;case"source":i(!0,e.arguments.source);break;case"gotoTargets":i(!0,e.arguments.source);break;case"launchVSCode":e.arguments.args.forEach(t=>i(!1,t));break;default:break}break}case"response":{let e=a;if(e.success&&e.body)switch(e.command){case"stackTrace":e.body.stackFrames.forEach(t=>i(!1,t.source));break;case"loadedSources":e.body.sources.forEach(t=>i(!1,t));break;case"scopes":e.body.scopes.forEach(t=>i(!1,t.source));break;case"setFunctionBreakpoints":e.body.breakpoints.forEach(t=>i(!1,t.source));break;case"setBreakpoints":e.body.breakpoints.forEach(t=>i(!1,t.source));break;case"disassemble":e.body?.instructions.forEach(o=>i(!1,o.location));break;case"locations":i(!1,e.body?.source);break;default:break}break}}}function Qdi(a){return a.filter(i=>!i.presentation?.hidden).sort((i,e)=>i.presentation?e.presentation?i.presentation.group?e.presentation.group?i.presentation.group!==e.presentation.group?i.presentation.group.localeCompare(e.presentation.group):oXi(i.presentation.order,e.presentation.order):-1:e.presentation.group?1:oXi(i.presentation.order,e.presentation.order):-1:e.presentation?1:0)}function oXi(a,i){return typeof a!="number"?typeof i!="number"?0:1:typeof i!="number"?-1:a-i}async function mQe(a,i){let e=a.getValue("debug.saveBeforeStart",{overrideIdentifier:i.activeTextEditorLanguageId});if(e!=="none"&&(await i.saveAll(),e==="allEditorsInActiveGroup")){let t=i.activeEditorPane;t&&t.input.resource?.scheme===Y.untitled&&await i.save({editor:t.input,groupId:t.group.id})}await a.reloadConfiguration()}var pXi=(a,i)=>!a||!i?a===i:a.name===i.name&&a.path===i.path&&a.sourceReference===i.sourceReference;function h_t(a,i){let e=i.filter(t=>t.parentSession===a);if(e.length>0){let t=e.find(o=>o.state===2);return t||e[0]}return a}function g_t(a,i,e=[]){let t=i.getSession(),o=[[ZYi.key,i.variableMenuContext||""],[hV.key,!!i.evaluateName],[VY.key,!!t?.capabilities.supportsReadMemoryRequest&&i.memoryReference!==void 0],[Oce.key,!!i.presentationHint?.attributes?.includes("readOnly")||i.presentationHint?.lazy],[KY.key,i.type],[wke.key,t?.configuration.type],...e];return a.createOverlay(o)}var f_t=d(9343,null),Ez=class{constructor(i,e,t,o){let n;i?(this.raw=i,n=this.raw.path||this.raw.name||"",this.available=!0):(this.raw={name:f_t},this.available=!1,n=`${vC}:${f_t}`),this.uri=hQe(this.raw,n,e,t,o)}get name(){return this.raw.name||Ra(this.uri)}get origin(){return this.raw.origin}get presentationHint(){return this.raw.presentationHint}get reference(){return this.raw.sourceReference}get inMemory(){return this.uri.scheme===vC}openInEditor(i,e,t,o,n){return this.available?i.openEditor({resource:this.uri,description:this.origin,options:{preserveFocus:t,selection:e,revealIfOpened:!0,selectionRevealType:1,pinned:n}},o?vn:Un):Promise.resolve(void 0)}static getEncodedDebugData(i){let e,t,o;switch(i.scheme){case Y.file:e=th(i.fsPath);break;case vC:if(e=i.path,i.query){let n=i.query.split("&");for(let r of n){let s=r.split("=");if(s.length===2)switch(s[0]){case"session":o=s[1];break;case"ref":t=parseInt(s[1]);break}}}break;default:e=i.toString();break}return{name:Ra(i),path:e,sourceReference:t,sessionId:o}}};function hQe(a,i,e,t,o){let n=r=>typeof a.sourceReference=="number"&&a.sourceReference>0?A.from({scheme:vC,path:r?.replace(/^\/+/g,"/"),query:`session=${e}&ref=${a.sourceReference}`}):r&&GY(r)?t.asCanonicalUri(A.parse(r)):r&&Xl(r)?t.asCanonicalUri(A.file(r)):t.asCanonicalUri(A.from({scheme:vC,path:r,query:`session=${e}`}));try{return n(i)}catch{return o.error("Invalid path from debug adapter: "+i),n("/invalidDebugSource")}}var L1o=Re("disassembly-editor-label-icon",M.debug,d(9344,null)),nR=class a extends Us{constructor(){super(...arguments);this.resource=void 0}static{this.ID="debug.disassemblyView.input"}get typeId(){return a.ID}static get instance(){return(!a._instance||a._instance.isDisposed())&&(a._instance=new a),a._instance}getName(){return d(9345,null)}getIcon(){return L1o}matches(e){return e instanceof a}};var Ho=ae("textFileService");var v_t=class extends As{constructor(e,t,o){super(e,10);this.textFileOperationResult=t;this.options=o}static isTextFileOperationError(e){return e instanceof Error&&!Jn(e.textFileOperationResult)}};function gQe(a){let i=a;return zut(i.setEncoding,i.getEncoding,i.save,i.revert,i.isDirty,i.getLanguageId)}function Tke(a){let i=!1;return{read(){return i?null:(i=!0,a)}}}function mXi(a){if(!(typeof a>"u"))return typeof a=="string"?Je.fromString(a):{read:()=>{let i=a.read();return typeof i=="string"?Je.fromString(i):null}}}var vP=class a{constructor(i,e,t,o,n=0,r=0,s=void 0,l=0,c=void 0,u=void 0){this.session=i;this.threadId=e;this._reference=t;this.id=o;this.namedVariables=n;this.indexedVariables=r;this.memoryReference=s;this.startOfVariables=l;this.presentationHint=c;this.valueLocationReference=u;this.valueChanged=!1;this._value=""}static{this.allValues=new Map}static{this.BASE_CHUNK_SIZE=100}get reference(){return this._reference}set reference(i){this._reference=i,this.children=void 0}async evaluateLazy(){if(typeof this.reference>"u")return;let i=await this.session.variables(this.reference,this.threadId,void 0,void 0,void 0);if(!i||!i.body||!i.body.variables||i.body.variables.length!==1)return;let e=i.body.variables[0];this.reference=e.variablesReference,this._value=e.value,this.namedVariables=e.namedVariables,this.indexedVariables=e.indexedVariables,this.memoryReference=e.memoryReference,this.presentationHint=e.presentationHint,this.valueLocationReference=e.valueLocationReference,this.adoptLazyResponse(e)}adoptLazyResponse(i){}getChildren(){return this.children||(this.children=this.doGetChildren()),this.children}async doGetChildren(){if(!this.hasChildren)return[];if(!this.getChildrenInChunks)return this.fetchVariables(void 0,void 0,void 0);let i=this.namedVariables?await this.fetchVariables(void 0,void 0,"named"):[],e=a.BASE_CHUNK_SIZE;for(;this.indexedVariables&&this.indexedVariables>e*a.BASE_CHUNK_SIZE;)e*=a.BASE_CHUNK_SIZE;if(this.indexedVariables&&this.indexedVariables>e){let o=Math.ceil(this.indexedVariables/e);for(let n=0;n<o;n++){let r=(this.startOfVariables||0)+n*e,s=Math.min(e,this.indexedVariables-n*e);i.push(new Hl(this.session,this.threadId,this,this.reference,`[${r}..${r+s-1}]`,"","",void 0,s,void 0,{kind:"virtual"},void 0,void 0,!0,r))}return i}let t=await this.fetchVariables(this.startOfVariables,this.indexedVariables,"indexed");return i.concat(t)}getId(){return this.id}getSession(){return this.session}get value(){return this._value}get hasChildren(){return!!this.reference&&this.reference>0&&!this.presentationHint?.lazy}async fetchVariables(i,e,t){try{let o=await this.session.variables(this.reference||0,this.threadId,t,i,e);if(!o||!o.body||!o.body.variables)return[];let n=new Map,r=o.body.variables.filter(s=>!!s).map(s=>{if(Ae(s.value)&&Ae(s.name)&&typeof s.variablesReference=="number"){let l=n.get(s.name)||0,c=l>0?l.toString():"";return n.set(s.name,l+1),new Hl(this.session,this.threadId,this,s.variablesReference,s.name,s.evaluateName,s.value,s.namedVariables,s.indexedVariables,s.memoryReference,s.presentationHint,s.type,s.__vscodeVariableMenuContext,!0,0,c,s.declarationLocationReference,s.valueLocationReference)}return new Hl(this.session,this.threadId,this,0,"",void 0,d(9294,null),0,0,void 0,{kind:"virtual"},void 0,void 0,!1)});return this.session.autoExpandLazyVariables&&await Promise.all(r.map(s=>s.presentationHint?.lazy&&s.evaluateLazy())),r}catch(o){return[new Hl(this.session,this.threadId,this,0,"",void 0,o.message,0,0,void 0,{kind:"virtual"},void 0,void 0,!1)]}}get getChildrenInChunks(){return!!this.indexedVariables}set value(i){this._value=i,this.valueChanged=!!a.allValues.get(this.getId())&&a.allValues.get(this.getId())!==Jc.DEFAULT_VALUE&&a.allValues.get(this.getId())!==i,a.allValues.set(this.getId(),i)}toString(){return this.value}async evaluateExpression(i,e,t,o,n=!1,r){if(!e||!t&&o!=="repl")return this.value=o==="repl"?d(9299,null):Jc.DEFAULT_VALUE,this.reference=0,!1;this.session=e;try{let s=await e.evaluate(i,t?t.frameId:void 0,o,r);return s&&s.body?(this.value=s.body.result||"",this.reference=s.body.variablesReference,this.namedVariables=s.body.namedVariables,this.indexedVariables=s.body.indexedVariables,this.memoryReference=s.body.memoryReference,this.type=s.body.type||this.type,this.presentationHint=s.body.presentationHint,this.valueLocationReference=s.body.valueLocationReference,!n&&s.body.presentationHint?.lazy&&await this.evaluateLazy(),!0):!1}catch(s){return this.value=s.message||"",this.reference=0,this.memoryReference=void 0,!1}}};function Ydi(a,i){i&&i.body&&(a.value=i.body.value||"",a.type=i.body.type||a.type,a.reference=i.body.variablesReference,a.namedVariables=i.body.namedVariables,a.indexedVariables=i.body.indexedVariables)}var rR=class{constructor(i,e,t,o,n){this.session=i;this.visualizer=e;this.treeId=t;this.treeItem=o;this.original=n;this.id=_t()}evaluateLazy(){return Promise.resolve()}getChildren(){return this.visualizer.getVisualizedChildren(this.session,this.treeId,this.treeItem.id)}getId(){return this.id}get name(){return this.treeItem.label}get value(){return this.treeItem.description||""}get hasChildren(){return this.treeItem.collapsibleState!==0}getSession(){return this.session}async edit(i){try{return await this.visualizer.editTreeItem(this.treeId,this.treeItem,i),!0}catch(e){return this.errorMessage=e.message,!1}}},Jc=class a extends vP{constructor(e,t=_t()){super(void 0,void 0,0,t);this.name=e;this._onDidChangeValue=new E;this.onDidChangeValue=this._onDidChangeValue.event;this.available=!1,e&&(this.value=a.DEFAULT_VALUE)}static{this.DEFAULT_VALUE=d(9295,null)}async evaluate(e,t,o,n,r){let s=this.value===a.DEFAULT_VALUE;this.available=await this.evaluateExpression(this.name,e,t,o,n,r),(s||this.valueChanged)&&this._onDidChangeValue.fire(this)}toString(){return`${this.name}
${this.value}`}toJSON(){return{sessionId:this.getSession()?.getId(),variable:this.toDebugProtocolObject()}}toDebugProtocolObject(){return{name:this.name,variablesReference:this.reference||0,memoryReference:this.memoryReference,value:this.value,type:this.type,evaluateName:this.name}}async setExpression(e,t){if(!this.session)return;let o=await this.session.setExpression(t.frameId,this.name,e);Ydi(this,o)}},Hl=class extends vP{constructor(e,t,o,n,r,s,l,c,u,p,h,g=void 0,f=void 0,v=!0,b=0,S="",y=void 0,w=void 0){super(e,t,n,`variable:${o.getId()}:${r}:${S}`,c,u,p,b,h,w);this.parent=o;this.name=r;this.evaluateName=s;this.variableMenuContext=f;this.available=v;this.declarationLocationReference=y;this.value=l||"",this.type=g}getThreadId(){return this.threadId}async setVariable(e,t){if(this.session)try{if(this.session.capabilities.supportsSetExpression&&!this.session.capabilities.supportsSetVariable&&this.evaluateName)return this.setExpression(e,t);let o=await this.session.setVariable(this.parent.reference,this.name,e);Ydi(this,o)}catch(o){this.errorMessage=o.message}}async setExpression(e,t){if(!this.session||!this.evaluateName)return;let o=await this.session.setExpression(t.frameId,this.evaluateName,e);Ydi(this,o)}toString(){return this.name?`${this.name}: ${this.value}`:this.value}toJSON(){return{sessionId:this.getSession()?.getId(),container:this.parent instanceof Jc?{expression:this.parent.name}:this.parent.toDebugProtocolObject(),variable:this.toDebugProtocolObject()}}adoptLazyResponse(e){this.evaluateName=e.evaluateName}toDebugProtocolObject(){return{name:this.name,variablesReference:this.reference||0,memoryReference:this.memoryReference,value:this.value,type:this.type,evaluateName:this.evaluateName}}},Tz=class extends vP{constructor(e,t,o,n,r,s,l,c){super(e.thread.session,e.thread.threadId,n,`scope:${o}:${t}`,s,l);this.stackFrame=e;this.name=o;this.expensive=r;this.range=c}get childrenHaveBeenLoaded(){return!!this.children}toString(){return this.name}toDebugProtocolObject(){return{name:this.name,variablesReference:this.reference||0,expensive:this.expensive}}},vQe=class extends Tz{constructor(i,e,t){super(i,e,t,0,!1)}toString(){return this.name}},NE=class{constructor(i,e,t,o,n,r,s,l,c){this.thread=i;this.frameId=e;this.source=t;this.name=o;this.presentationHint=n;this.range=r;this.index=s;this.canRestart=l;this.instructionPointerReference=c}getId(){return`stackframe:${this.thread.getId()}:${this.index}:${this.source.name}`}getScopes(){return this.scopes||(this.scopes=this.thread.session.scopes(this.frameId,this.thread.threadId).then(i=>{if(!i||!i.body||!i.body.scopes)return[];let e=new Set;return i.body.scopes.map(t=>{let o=0;do o=Vbe(`${t.name}:${t.line}:${t.column}`,o);while(e.has(o));return e.add(o),new Tz(this,o,t.name,t.variablesReference,t.expensive,t.namedVariables,t.indexedVariables,t.line&&t.column&&t.endLine&&t.endColumn?new z(t.line,t.column,t.endLine,t.endColumn):void 0)})},i=>[new vQe(this,0,i.message)])),this.scopes}async getMostSpecificScopes(i){let t=(await this.getScopes()).filter(r=>!r.expensive);if(!t.some(r=>!!r.range))return t;let n=t.filter(r=>r.range&&z.containsRange(r.range,i)).sort((r,s)=>r.range.endLineNumber-r.range.startLineNumber-(s.range.endLineNumber-s.range.startLineNumber));return n.length?n:t}restart(){return this.thread.session.restartFrame(this.frameId,this.thread.threadId)}forgetScopes(){this.scopes=void 0}toString(){let i=typeof this.range.startLineNumber=="number"?`:${this.range.startLineNumber}`:"",e=`${this.source.inMemory?this.source.name:this.source.uri.fsPath}${i}`;return e===f_t?this.name:`${this.name} (${e})`}async openInEditor(i,e,t,o){let n=this.thread.stoppedDetails?.reason;if(this.instructionPointerReference&&(n==="instruction breakpoint"&&!e||n==="step"&&this.thread.lastSteppingGranularity==="instruction"&&!e||i.activeEditor instanceof nR))return i.openEditor(nR.instance,{pinned:!0,revealIfOpened:!0,preserveFocus:e});if(this.source.available)return this.source.openInEditor(i,this.range,e,t,o)}equals(i){return this.name===i.name&&i.thread===this.thread&&this.frameId===i.frameId&&i.source===this.source&&z.equalsRange(this.range,i.range)}},P1o=["breakpoint","step","function breakpoint"],bP=class{constructor(i,e,t){this.session=i;this.name=e;this.threadId=t;this.callStackCancellationTokens=[];this.reachedEndOfCallStack=!1;this.callStack=[],this.staleCallStack=[],this.stopped=!1}getId(){return`thread:${this.session.getId()}:${this.threadId}`}clearCallStack(){this.callStack.length&&(this.staleCallStack=this.callStack),this.callStack=[],this.callStackCancellationTokens.forEach(i=>i.dispose(!0)),this.callStackCancellationTokens=[]}getCallStack(){return this.callStack}getStaleCallStack(){return this.staleCallStack}getTopStackFrame(){let i=this.getCallStack(),e=this.stoppedDetails?.reason;return i.find(o=>!!((e==="instruction breakpoint"||e==="step"&&this.lastSteppingGranularity==="instruction")&&o.instructionPointerReference||o.source&&o.source.available&&(P1o.includes(e)||!kz(o))))}get stateLabel(){return this.stoppedDetails?this.stoppedDetails.description||(this.stoppedDetails.reason?d(9297,null,this.stoppedDetails.reason):d(9296,null)):d(9298,null)}async fetchCallStack(i=20){if(this.stopped){let e=this.callStack.length,t=await this.getCallStackImpl(e,i);this.reachedEndOfCallStack=t.length<i,e<this.callStack.length&&this.callStack.splice(e,this.callStack.length-e),this.callStack=this.callStack.concat(t||[]),typeof this.stoppedDetails?.totalFrames=="number"&&this.stoppedDetails.totalFrames===this.callStack.length&&(this.reachedEndOfCallStack=!0)}}async getCallStackImpl(i,e){try{let t=new $e;this.callStackCancellationTokens.push(t);let o=await this.session.stackTrace(this.threadId,i,e,t.token);return!o||!o.body||t.token.isCancellationRequested?[]:(this.stoppedDetails&&(this.stoppedDetails.totalFrames=o.body.totalFrames),o.body.stackFrames.map((n,r)=>{let s=this.session.getSource(n.source);return new NE(this,n.id,s,n.name,n.presentationHint,new z(n.line,n.column,n.endLine||n.line,n.endColumn||n.column),i+r,typeof n.canRestart=="boolean"?n.canRestart:!0,n.instructionPointerReference)}))}catch(t){return this.stoppedDetails&&(this.stoppedDetails.framesErrorMessage=t.message),[]}}get exceptionInfo(){return this.stoppedDetails&&this.stoppedDetails.reason==="exception"?this.session.capabilities.supportsExceptionInfoRequest?this.session.exceptionInfo(this.threadId):Promise.resolve({description:this.stoppedDetails.text,breakMode:null}):Promise.resolve(void 0)}next(i){return this.session.next(this.threadId,i)}stepIn(i){return this.session.stepIn(this.threadId,void 0,i)}stepOut(i){return this.session.stepOut(this.threadId,i)}stepBack(i){return this.session.stepBack(this.threadId,i)}continue(){return this.session.continue(this.threadId)}pause(){return this.session.pause(this.threadId)}terminate(){return this.session.terminateThreads([this.threadId])}reverseContinue(){return this.session.reverseContinue(this.threadId)}},hXi=(a,i,e,t="memory")=>A.from({scheme:Fce,authority:a,path:"/"+encodeURIComponent(i)+`/${encodeURIComponent(t)}.bin`,query:e?`?range=${e.fromOffset}:${e.toOffset}`:void 0}),b_t=class extends C{constructor(e,t){super();this.memoryReference=e;this.session=t;this.invalidateEmitter=this._register(new E);this.onDidInvalidate=this.invalidateEmitter.event;this.writable=!!this.session.capabilities.supportsWriteMemoryRequest,this._register(t.onDidInvalidateMemory(o=>{o.body.memoryReference===e&&this.invalidate(o.body.offset,o.body.count-o.body.offset)}))}async read(e,t){let o=t-e,n=e,r=await this.session.readMemory(this.memoryReference,n,o);if(r===void 0||!r.body?.data)return[{type:1,offset:n,length:o}];let s;try{s=Sl(r.body.data)}catch{return[{type:2,offset:n,length:o,error:"Invalid base64 data from debug adapter"}]}let l=r.body.unreadableBytes||0,c=o-l;if(s.byteLength<c){let u=Je.alloc(c-s.byteLength);u.buffer.fill(0),s=Je.concat([s,u],c)}else s.byteLength>c&&(s=s.slice(0,c));return l?[{type:0,offset:n,length:c,data:s},{type:1,offset:n+c,length:l}]:[{type:0,offset:n,length:o,data:s}]}async write(e,t){let n=(await this.session.writeMemory(this.memoryReference,e,Qd(t),!0))?.body?.bytesWritten??t.byteLength;return this.invalidate(e,e+n),n}dispose(){super.dispose()}invalidate(e,t){this.invalidateEmitter.fire({fromOffset:e,toOffset:t})}},Xdi=class{constructor(i,e){this.enabled=i;this.id=e}getId(){return this.id}};function fQe(a,i){return Nu({supportsConditionalBreakpoints:!!i.supportsConditionalBreakpoints,supportsHitConditionalBreakpoints:!!i.supportsHitConditionalBreakpoints,supportsLogPoints:!!i.supportsLogPoints,supportsFunctionBreakpoints:!!i.supportsFunctionBreakpoints,supportsDataBreakpoints:!!i.supportsDataBreakpoints,supportsInstructionBreakpoints:!!i.supportsInstructionBreakpoints},a)}var Vce=class extends Xdi{constructor(e,t){super(t.enabled??!0,e);this.sessionData=new Map;this.condition=t.condition,this.hitCondition=t.hitCondition,this.logMessage=t.logMessage,this.mode=t.mode,this.modeLabel=t.modeLabel}setSessionData(e,t){t?(t.sessionId=e,this.sessionData.set(e,t)):this.sessionData.delete(e);let o=Array.from(this.sessionData.values()),n=Uo(o.filter(r=>r.verified),r=>`${r.line}:${r.column}`);n.length?this.data=n.length===1?n[0]:void 0:this.data=o.length?o[0]:void 0}get message(){if(this.data)return this.data.message}get verified(){return this.data?this.data.verified:!0}get sessionsThatVerified(){let e=[];for(let[t,o]of this.sessionData)o.verified&&e.push(t);return e}getIdFromAdapter(e){let t=this.sessionData.get(e);return t?t.id:void 0}getDebugProtocolBreakpoint(e){let t=this.sessionData.get(e);if(t)return{id:t.id,verified:t.verified,message:t.message,source:t.source,line:t.line,column:t.column,endLine:t.endLine,endColumn:t.endColumn,instructionReference:t.instructionReference,offset:t.offset}}toJSON(){return{id:this.getId(),enabled:this.enabled,condition:this.condition,hitCondition:this.hitCondition,logMessage:this.logMessage,mode:this.mode,modeLabel:this.modeLabel}}},wv=class extends Vce{constructor(e,t,o,n,r=_t()){super(r,e);this.textFileService=t;this.uriIdentityService=o;this.logService=n;this._uri=e.uri,this._lineNumber=e.lineNumber,this._column=e.column,this._adapterData=e.adapterData,this.triggeredBy=e.triggeredBy}toDAP(){return{line:this.sessionAgnosticData.lineNumber,column:this.sessionAgnosticData.column,condition:this.condition,hitCondition:this.hitCondition,logMessage:this.logMessage,mode:this.mode}}get originalUri(){return this._uri}get lineNumber(){return this.verified&&this.data&&typeof this.data.line=="number"?this.data.line:this._lineNumber}get verified(){return this.data?this.data.verified&&!this.textFileService.isDirty(this._uri):!0}get pending(){return this.data?!1:this.triggeredBy!==void 0}get uri(){return this.verified&&this.data&&this.data.source?hQe(this.data.source,this.data.source.path,this.data.sessionId,this.uriIdentityService,this.logService):this._uri}get column(){return this.verified&&this.data&&typeof this.data.column=="number"?this.data.column:this._column}get message(){return this.textFileService.isDirty(this.uri)?d(9293,null):super.message}get adapterData(){return this.data&&this.data.source&&this.data.source.adapterData?this.data.source.adapterData:this._adapterData}get endLineNumber(){return this.verified&&this.data?this.data.endLine:void 0}get endColumn(){return this.verified&&this.data?this.data.endColumn:void 0}get sessionAgnosticData(){return{lineNumber:this._lineNumber,column:this._column}}get supported(){return this.data?!(this.logMessage&&!this.data.supportsLogPoints||this.condition&&!this.data.supportsConditionalBreakpoints||this.hitCondition&&!this.data.supportsHitConditionalBreakpoints):!0}setSessionData(e,t){super.setSessionData(e,t),this._adapterData||(this._adapterData=this.adapterData)}toJSON(){return{...super.toJSON(),uri:this._uri,lineNumber:this._lineNumber,column:this._column,adapterData:this.adapterData,triggeredBy:this.triggeredBy}}toString(){return`${Ra(this.uri)} ${this.lineNumber}`}setSessionDidTrigger(e,t=!0){t?(this.sessionsDidTrigger??=new Set,this.sessionsDidTrigger.add(e)):this.sessionsDidTrigger?.delete(e)}getSessionDidTrigger(e){return!!this.sessionsDidTrigger?.has(e)}update(e){e.hasOwnProperty("lineNumber")&&!Jn(e.lineNumber)&&(this._lineNumber=e.lineNumber),e.hasOwnProperty("column")&&(this._column=e.column),e.hasOwnProperty("condition")&&(this.condition=e.condition),e.hasOwnProperty("hitCondition")&&(this.hitCondition=e.hitCondition),e.hasOwnProperty("logMessage")&&(this.logMessage=e.logMessage),e.hasOwnProperty("mode")&&(this.mode=e.mode,this.modeLabel=e.modeLabel),e.hasOwnProperty("triggeredBy")&&(this.triggeredBy=e.triggeredBy,this.sessionsDidTrigger=void 0)}},tI=class extends Vce{constructor(i,e=_t()){super(e,i),this.name=i.name}toDAP(){return{name:this.name,condition:this.condition,hitCondition:this.hitCondition}}toJSON(){return{...super.toJSON(),name:this.name}}get supported(){return this.data?this.data.supportsFunctionBreakpoints:!0}toString(){return this.name}},ZI=class extends Vce{constructor(e,t=_t()){super(t,e);this.sessionDataIdForAddr=new WeakMap;this.description=e.description,"dataId"in e&&(e.src={type:0,dataId:e.dataId}),this.src=e.src,this.canPersist=e.canPersist,this.accessTypes=e.accessTypes,this.accessType=e.accessType,e.initialSessionData&&this.sessionDataIdForAddr.set(e.initialSessionData.session,e.initialSessionData.dataId)}async toDAP(e){let t;if(this.src.type===0)t=this.src.dataId;else{let o=this.sessionDataIdForAddr.get(e);if(!o){if(o=(await e.dataBytesBreakpointInfo(this.src.address,this.src.bytes))?.dataId,!o)return;this.sessionDataIdForAddr.set(e,o)}t=o}return{dataId:t,accessType:this.accessType,condition:this.condition,hitCondition:this.hitCondition}}toJSON(){return{...super.toJSON(),description:this.description,src:this.src,accessTypes:this.accessTypes,accessType:this.accessType,canPersist:this.canPersist}}get supported(){return this.data?this.data.supportsDataBreakpoints:!0}toString(){return this.description}},SP=class extends Vce{constructor(e,t=_t()){super(t,e);this.supportedSessions=new Set;this.fallback=!1;this.filter=e.filter,this.label=e.label,this.supportsCondition=e.supportsCondition,this.description=e.description,this.conditionDescription=e.conditionDescription,this.fallback=e.fallback||!1}toJSON(){return{...super.toJSON(),filter:this.filter,label:this.label,enabled:this.enabled,supportsCondition:this.supportsCondition,conditionDescription:this.conditionDescription,condition:this.condition,fallback:this.fallback,description:this.description}}setSupportedSession(e,t){t?this.supportedSessions.add(e):this.supportedSessions.delete(e)}setFallback(e){this.fallback=e}get supported(){return!0}isSupportedSession(e){return e?this.supportedSessions.has(e):this.fallback}matches(e){return this.filter===e.filter&&this.label===e.label&&this.supportsCondition===!!e.supportsCondition&&this.conditionDescription===e.conditionDescription&&this.description===e.description}toString(){return this.label}},iI=class extends Vce{constructor(i,e=_t()){super(e,i),this.instructionReference=i.instructionReference,this.offset=i.offset,this.canPersist=i.canPersist,this.address=i.address}toDAP(){return{instructionReference:this.instructionReference,condition:this.condition,hitCondition:this.hitCondition,mode:this.mode,offset:this.offset}}toJSON(){return{...super.toJSON(),instructionReference:this.instructionReference,offset:this.offset,canPersist:this.canPersist,address:this.address}}get supported(){return this.data?this.data.supportsInstructionBreakpoints:!0}toString(){return this.instructionReference}},$Y=class{constructor(i,e){this.sessionId=i;this.threadId=e}getId(){return`${this.sessionId}:${this.threadId}`}},_ke=class extends C{constructor(e,t,o,n){super();this.textFileService=t;this.uriIdentityService=o;this.logService=n;this.schedulers=new Map;this.breakpointsActivated=!0;this._onDidChangeBreakpoints=this._register(new E);this._onDidChangeCallStack=this._register(new E);this._onDidChangeCallStackFire=this._register(new Dt(()=>{this._onDidChangeCallStack.fire(void 0)},100));this._onDidChangeWatchExpressions=this._register(new E);this._onDidChangeWatchExpressionValue=this._register(new E);this._breakpointModes=new Map;this._register(he(r=>{this.breakpoints=e.breakpoints.read(r),this.functionBreakpoints=e.functionBreakpoints.read(r),this.exceptionBreakpoints=e.exceptionBreakpoints.read(r),this.dataBreakpoints=e.dataBreakpoints.read(r),this._onDidChangeBreakpoints.fire(void 0)})),this._register(he(r=>{this.watchExpressions=e.watchExpressions.read(r),this._onDidChangeWatchExpressions.fire(void 0)})),this._register(KUi(()=>new Set(this.watchExpressions),this.onDidChangeWatchExpressions,r=>r.onDidChangeValue(s=>this._onDidChangeWatchExpressionValue.fire(s)))),this.instructionBreakpoints=[],this.sessions=[]}getId(){return"root"}getSession(e,t=!1){if(e)return this.getSessions(t).find(o=>o.getId()===e)}getSessions(e=!1){return this.sessions.filter(t=>e||t.state!==0)}addSession(e){this.sessions=this.sessions.filter(n=>n.getId()===e.getId()?!1:n.state===0&&n.configuration.name===e.configuration.name?(n.dispose(),!1):!0);let t=1;for(;this.sessions.some(n=>n.getLabel()===e.getLabel());)e.setName(`${e.configuration.name} ${++t}`);let o=-1;e.parentSession&&(o=this.sessions.findLastIndex(n=>n.parentSession===e.parentSession||n===e.parentSession)),o>=0?this.sessions.splice(o+1,0,e):this.sessions.push(e),this._onDidChangeCallStack.fire(void 0)}get onDidChangeBreakpoints(){return this._onDidChangeBreakpoints.event}get onDidChangeCallStack(){return this._onDidChangeCallStack.event}get onDidChangeWatchExpressions(){return this._onDidChangeWatchExpressions.event}get onDidChangeWatchExpressionValue(){return this._onDidChangeWatchExpressionValue.event}rawUpdate(e){let t=this.sessions.find(o=>o.getId()===e.sessionId);t&&(t.rawUpdate(e),this._onDidChangeCallStack.fire(void 0))}clearThreads(e,t,o=void 0){let n=this.sessions.find(r=>r.getId()===e);if(n){let r;if(o===void 0)r=n.getAllThreads();else{let s=n.getThread(o);r=s!==void 0?[s]:[]}for(let s of r){let l=s.getId(),c=this.schedulers.get(l);c!==void 0&&(c.scheduler.dispose(),c.completeDeferred.complete(),this.schedulers.delete(l))}n.clearThreads(t,o),this._onDidChangeCallStackFire.isScheduled()||this._onDidChangeCallStackFire.schedule()}}async fetchCallstack(e,t){if(e.reachedEndOfCallStack)return;let o=e.stoppedDetails?.totalFrames,n=typeof o=="number"?o-e.getCallStack().length:void 0;(!t||n&&t>n)&&(t=n),t&&t>0&&(await e.fetchCallStack(t),this._onDidChangeCallStack.fire())}refreshTopOfCallstack(e,t=!0){if(e.session.capabilities.supportsDelayedStackTraceLoading){let n=Promise.resolve(),r=new Promise((s,l)=>{n=e.fetchCallStack(1).then(()=>{if(!t){s(),this._onDidChangeCallStack.fire();return}if(!this.schedulers.has(e.getId())){let u=new Go;this.schedulers.set(e.getId(),{completeDeferred:u,scheduler:new Dt(()=>{e.fetchCallStack(19).then(()=>{let p=e.getStaleCallStack(),h=e.getCallStack(),g=p.length!==h.length;for(let f=1;f<p.length&&!g;f++)g=!p[f].equals(h[f]);g&&this._onDidChangeCallStack.fire()}).finally(()=>{u.complete(),this.schedulers.delete(e.getId())})},420)})}let c=this.schedulers.get(e.getId());c.scheduler.schedule(),c.completeDeferred.p.then(s,l),this._onDidChangeCallStack.fire()})});return{topCallStack:n,wholeCallStack:r}}let o=e.fetchCallStack();return{wholeCallStack:o,topCallStack:o}}getBreakpoints(e){if(e){let t=e.uri?.toString(),o=e.originalUri?.toString();return this.breakpoints.filter(n=>!(t&&n.uri.toString()!==t||o&&n.originalUri.toString()!==o||e.lineNumber&&n.lineNumber!==e.lineNumber||e.column&&n.column!==e.column||e.enabledOnly&&(!this.breakpointsActivated||!n.enabled)||e.triggeredOnly&&n.triggeredBy===void 0))}return this.breakpoints}getFunctionBreakpoints(){return this.functionBreakpoints}getDataBreakpoints(){return this.dataBreakpoints}getExceptionBreakpoints(){return this.exceptionBreakpoints}getExceptionBreakpointsForSession(e){return this.exceptionBreakpoints.filter(t=>t.isSupportedSession(e))}getInstructionBreakpoints(){return this.instructionBreakpoints}setExceptionBreakpointsForSession(e,t){if(!t)return;let o=!1;t.forEach(n=>{let r=this.exceptionBreakpoints.filter(s=>s.matches(n)).pop();r||(o=!0,r=new SP({filter:n.filter,label:n.label,enabled:!!n.default,supportsCondition:!!n.supportsCondition,description:n.description,conditionDescription:n.conditionDescription}),this.exceptionBreakpoints.push(r)),r.setSupportedSession(e,!0)}),o&&this._onDidChangeBreakpoints.fire(void 0)}removeExceptionBreakpointsForSession(e){this.exceptionBreakpoints.forEach(t=>t.setSupportedSession(e,!1))}setExceptionBreakpointFallbackSession(e){this.exceptionBreakpoints.forEach(t=>t.setFallback(t.isSupportedSession(e)))}setExceptionBreakpointCondition(e,t){e.condition=t,this._onDidChangeBreakpoints.fire(void 0)}areBreakpointsActivated(){return this.breakpointsActivated}setBreakpointsActivated(e){this.breakpointsActivated=e,this._onDidChangeBreakpoints.fire(void 0)}addBreakpoints(e,t,o=!0){let n=t.map(r=>new wv({uri:e,lineNumber:r.lineNumber,column:r.column,enabled:r.enabled??!0,condition:r.condition,hitCondition:r.hitCondition,logMessage:r.logMessage,triggeredBy:r.triggeredBy,adapterData:void 0,mode:r.mode,modeLabel:r.modeLabel},this.textFileService,this.uriIdentityService,this.logService,r.id));return this.breakpoints=this.breakpoints.concat(n),this.breakpointsActivated=!0,this.sortAndDeDup(),o&&this._onDidChangeBreakpoints.fire({added:n,sessionOnly:!1}),n}removeBreakpoints(e){this.breakpoints=this.breakpoints.filter(t=>!e.some(o=>o.getId()===t.getId())),this._onDidChangeBreakpoints.fire({removed:e,sessionOnly:!1})}updateBreakpoints(e){let t=[];this.breakpoints.forEach(o=>{let n=e.get(o.getId());n&&(o.update(n),t.push(o))}),this.sortAndDeDup(),this._onDidChangeBreakpoints.fire({changed:t,sessionOnly:!1})}setBreakpointSessionData(e,t,o){this.breakpoints.forEach(n=>{if(!o)n.setSessionData(e,void 0);else{let r=o.get(n.getId());r&&n.setSessionData(e,fQe(r,t))}}),this.functionBreakpoints.forEach(n=>{if(!o)n.setSessionData(e,void 0);else{let r=o.get(n.getId());r&&n.setSessionData(e,fQe(r,t))}}),this.dataBreakpoints.forEach(n=>{if(!o)n.setSessionData(e,void 0);else{let r=o.get(n.getId());r&&n.setSessionData(e,fQe(r,t))}}),this.exceptionBreakpoints.forEach(n=>{if(!o)n.setSessionData(e,void 0);else{let r=o.get(n.getId());r&&n.setSessionData(e,fQe(r,t))}}),this.instructionBreakpoints.forEach(n=>{if(!o)n.setSessionData(e,void 0);else{let r=o.get(n.getId());r&&n.setSessionData(e,fQe(r,t))}}),this._onDidChangeBreakpoints.fire({sessionOnly:!0})}getDebugProtocolBreakpoint(e,t){let o=this.breakpoints.find(n=>n.getId()===e);if(o)return o.getDebugProtocolBreakpoint(t)}getBreakpointModes(e){return[...this._breakpointModes.values()].filter(t=>t.appliesTo.includes(e))}registerBreakpointModes(e,t){for(let o of t){let n=`${o.mode}/${o.label}`,r=this._breakpointModes.get(n);if(r)for(let s of o.appliesTo)r.appliesTo.includes(s)||r.appliesTo.push(s);else{let s=[...this._breakpointModes.values()].find(l=>l!==r&&l.label===o.label);s&&(s.label=`${s.label} (${s.firstFromDebugType})`),this._breakpointModes.set(n,{mode:o.mode,label:s?`${o.label} (${e})`:o.label,firstFromDebugType:e,description:o.description,appliesTo:o.appliesTo.slice()})}}}sortAndDeDup(){this.breakpoints=this.breakpoints.sort((e,t)=>e.uri.toString()!==t.uri.toString()?Ra(e.uri).localeCompare(Ra(t.uri)):e.lineNumber===t.lineNumber?e.column&&t.column?e.column-t.column:1:e.lineNumber-t.lineNumber),this.breakpoints=Uo(this.breakpoints,e=>`${e.uri.toString()}:${e.lineNumber}:${e.column}`)}setEnablement(e,t){if(e instanceof wv||e instanceof tI||e instanceof SP||e instanceof ZI||e instanceof iI){let o=[];e.enabled!==t&&(e instanceof wv||e instanceof tI||e instanceof ZI||e instanceof iI)&&o.push(e),e.enabled=t,t&&(this.breakpointsActivated=!0),this._onDidChangeBreakpoints.fire({changed:o,sessionOnly:!1})}}enableOrDisableAllBreakpoints(e){let t=[];this.breakpoints.forEach(o=>{o.enabled!==e&&t.push(o),o.enabled=e}),this.functionBreakpoints.forEach(o=>{o.enabled!==e&&t.push(o),o.enabled=e}),this.dataBreakpoints.forEach(o=>{o.enabled!==e&&t.push(o),o.enabled=e}),this.instructionBreakpoints.forEach(o=>{o.enabled!==e&&t.push(o),o.enabled=e}),e&&(this.breakpointsActivated=!0),this._onDidChangeBreakpoints.fire({changed:t,sessionOnly:!1})}addFunctionBreakpoint(e,t){let o=new tI(e,t);return this.functionBreakpoints.push(o),this._onDidChangeBreakpoints.fire({added:[o],sessionOnly:!1}),o}updateFunctionBreakpoint(e,t){let o=this.functionBreakpoints.find(n=>n.getId()===e);o&&(typeof t.name=="string"&&(o.name=t.name),typeof t.condition=="string"&&(o.condition=t.condition),typeof t.hitCondition=="string"&&(o.hitCondition=t.hitCondition),this._onDidChangeBreakpoints.fire({changed:[o],sessionOnly:!1}))}removeFunctionBreakpoints(e){let t;e?(t=this.functionBreakpoints.filter(o=>o.getId()===e),this.functionBreakpoints=this.functionBreakpoints.filter(o=>o.getId()!==e)):(t=this.functionBreakpoints,this.functionBreakpoints=[]),this._onDidChangeBreakpoints.fire({removed:t,sessionOnly:!1})}addDataBreakpoint(e,t){let o=new ZI(e,t);this.dataBreakpoints.push(o),this._onDidChangeBreakpoints.fire({added:[o],sessionOnly:!1})}updateDataBreakpoint(e,t){let o=this.dataBreakpoints.find(n=>n.getId()===e);o&&(typeof t.condition=="string"&&(o.condition=t.condition),typeof t.hitCondition=="string"&&(o.hitCondition=t.hitCondition),this._onDidChangeBreakpoints.fire({changed:[o],sessionOnly:!1}))}removeDataBreakpoints(e){let t;e?(t=this.dataBreakpoints.filter(o=>o.getId()===e),this.dataBreakpoints=this.dataBreakpoints.filter(o=>o.getId()!==e)):(t=this.dataBreakpoints,this.dataBreakpoints=[]),this._onDidChangeBreakpoints.fire({removed:t,sessionOnly:!1})}addInstructionBreakpoint(e){let t=new iI(e);this.instructionBreakpoints.push(t),this._onDidChangeBreakpoints.fire({added:[t],sessionOnly:!0})}removeInstructionBreakpoints(e,t){let o=[];if(e)for(let n=0;n<this.instructionBreakpoints.length;n++){let r=this.instructionBreakpoints[n];r.instructionReference===e&&(t===void 0||r.offset===t)&&(o.push(r),this.instructionBreakpoints.splice(n--,1))}else o=this.instructionBreakpoints,this.instructionBreakpoints=[];this._onDidChangeBreakpoints.fire({removed:o,sessionOnly:!1})}getWatchExpressions(){return this.watchExpressions}addWatchExpression(e){let t=new Jc(e||"");return this.watchExpressions.push(t),this._onDidChangeWatchExpressions.fire(t),t}renameWatchExpression(e,t){let o=this.watchExpressions.filter(n=>n.getId()===e);o.length===1&&(o[0].name=t,this._onDidChangeWatchExpressions.fire(o[0]))}removeWatchExpressions(e=null){this.watchExpressions=e?this.watchExpressions.filter(t=>t.getId()!==e):[],this._onDidChangeWatchExpressions.fire(void 0)}moveWatchExpression(e,t){let o=this.watchExpressions.find(n=>n.getId()===e);o&&(this.watchExpressions=this.watchExpressions.filter(n=>n.getId()!==e),this.watchExpressions=this.watchExpressions.slice(0,t).concat(o,this.watchExpressions.slice(t)),this._onDidChangeWatchExpressions.fire(void 0))}sourceIsNotAvailable(e){this.sessions.forEach(t=>{let o=t.getSourceForUri(e);o&&(o.available=!1)}),this._onDidChangeCallStack.fire(void 0)}};_ke=I([m(1,Ho),m(2,dt),m(3,ne)],_ke);var qY=ae("debugVisualizerService"),Zdi=class{constructor(i,e){this.handle=i;this.viz=e}get name(){return this.viz.name}get iconPath(){return this.viz.iconPath}get iconClass(){return this.viz.iconClass}async resolve(i){return this.viz.visualization??=await this.handle.resolveDebugVisualizer(this.viz,i)}async execute(){await this.handle.executeDebugVisualizerCommand(this.viz.id)}},gXi={object:[],dispose:()=>{}},Dke=class{constructor(i,e,t){this.contextKeyService=i;this.extensionService=e;this.logService=t;this.handles=new Map;this.trees=new Map;this.didActivate=new Map;this.registrations=[];A1o.setHandler((o,{added:n,removed:r})=>{this.registrations=this.registrations.filter(s=>!r.some(l=>Ei.equals(l.description.identifier,s.extensionId))),n.forEach(s=>this.processExtensionRegistration(s.description))})}async getApplicableFor(i,e){if(!(i instanceof Hl))return gXi;let t=i.getThreadId();if(t===void 0)return gXi;let o=this.getVariableContext(t,i),n=g_t(this.contextKeyService,i,[[r_t.key,i.name],[kke.key,i.value],[KY.key,i.type]]),r=await Promise.all(this.registrations.map(async l=>{if(!n.contextMatchesRules(l.expr))return;let c=this.didActivate.get(l.id);if(c||(c=this.extensionService.activateByEvent(`onDebugVisualizer:${l.id}`),this.didActivate.set(l.id,c)),await c,e.isCancellationRequested)return;let u=this.handles.get(fXi(l.extensionId,l.id));return u&&{handle:u,result:await u.provideDebugVisualizers(o,e)}})),s={object:r.filter(mo).flatMap(l=>l.result.map(c=>new Zdi(l.handle,c))),dispose:()=>{for(let l of r)l?.handle.disposeDebugVisualizers(l.result.map(c=>c.id))}};return e.isCancellationRequested&&s.dispose(),s}register(i){let e=fXi(i.extensionId,i.id);return this.handles.set(e,i),Z(()=>this.handles.delete(e))}registerTree(i,e){return this.trees.set(i,e),Z(()=>this.trees.delete(i))}async getVisualizedNodeFor(i,e){if(!(e instanceof Hl))return;let t=e.getThreadId();if(t===void 0)return;let o=this.trees.get(i);if(o)try{let n=await o.getTreeItem(this.getVariableContext(t,e));return n?new rR(e.getSession(),this,i,n,e):void 0}catch(n){this.logService.warn("Failed to get visualized node",n);return}}async getVisualizedChildren(i,e,t){return(await this.trees.get(e)?.getChildren(t)||[]).map(r=>new rR(i,this,e,r,void 0))}async editTreeItem(i,e,t){let o=await this.trees.get(i)?.editItem?.(e.id,t);o&&Object.assign(e,o)}getVariableContext(i,e){let t={sessionId:e.getSession()?.getId()||"",containerId:e.parent instanceof Hl?e.reference:void 0,threadId:i,variable:{name:e.name,value:e.value,type:e.type,evaluateName:e.evaluateName,variablesReference:e.reference||0,indexedVariables:e.indexedVariables,memoryReference:e.memoryReference,namedVariables:e.namedVariables,presentationHint:e.presentationHint}};for(let o=e;o instanceof Hl;o=o.parent)o.parent instanceof Tz&&(t.frameId=o.parent.stackFrame.frameId);return t}processExtensionRegistration(i){let e=i.contributes?.debugVisualizers;if(e instanceof Array)for(let{when:t,id:o}of e)try{let n=x.deserialize(t);n&&this.registrations.push({expr:n,id:o,extensionId:i.identifier})}catch(n){this.logService.error(`Error processing debug visualizer registration from extension '${i.identifier.value}'`,n)}}};Dke=I([m(0,X),m(1,lt),m(2,ne)],Dke);var fXi=(a,i)=>`${Ei.toKey(a)}\0${i}`,A1o=Tn.registerExtensionPoint({extensionPoint:"debugVisualizers",jsonSchema:{type:"array",items:{type:"object",properties:{id:{type:"string",description:"Name of the debug visualizer"},when:{type:"string",description:"Condition when the debug visualizer is applicable"}},required:["id","when"]}},activationEventsGenerator:function*(a){for(let i of a)i.id&&(yield`onDebugVisualizer:${i.id}`)}});var S_t=class{constructor(i,e,t){this.debugService=e;this.visualizerService=t;this._toDispose=new P;this._debugAdaptersHandleCounter=1;this._visualizerHandles=new Map;this._visualizerTreeHandles=new Map;this._proxy=i.getProxy(Zi.ExtHostDebugService);let o=new jt;this._toDispose.add(o),this._toDispose.add(e.onDidNewSession(r=>{this._proxy.$acceptDebugSessionStarted(this.getSessionDto(r)),o.get(r)?.add(r.onDidChangeName(l=>{this._proxy.$acceptDebugSessionNameChanged(this.getSessionDto(r),l)}))})),this._toDispose.add(e.onWillNewSession(r=>{let s=o.get(r);s||(s=new P,o.set(r,s)),s.add(r.onDidCustomEvent(l=>this._proxy.$acceptDebugSessionCustomEvent(this.getSessionDto(r),l)))})),this._toDispose.add(e.onDidEndSession(({session:r,restart:s})=>{this._proxy.$acceptDebugSessionTerminated(this.getSessionDto(r)),this._extHostKnownSessions.delete(r.getId()),s||o.deleteAndDispose(r);for(let[l,c]of this._debugAdapters)c.session===r&&this._debugAdapters.delete(l)})),this._toDispose.add(e.getViewModel().onDidFocusSession(r=>{this._proxy.$acceptDebugSessionActiveChanged(this.getSessionDto(r))})),this._toDispose.add(Z(()=>{for(let[r,s]of this._debugAdapters)s.fireError(r,new Error("Extension host shut down"))})),this._debugAdapters=new Map,this._debugConfigurationProviders=new Map,this._debugAdapterDescriptorFactories=new Map,this._extHostKnownSessions=new Set;let n=this.debugService.getViewModel();this._toDispose.add(H.any(n.onDidFocusStackFrame,n.onDidFocusThread)(()=>{let r=n.focusedStackFrame,s=n.focusedThread;r?this._proxy.$acceptStackFrameFocus({kind:"stackFrame",threadId:r.thread.threadId,frameId:r.frameId,sessionId:r.thread.session.getId()}):s?this._proxy.$acceptStackFrameFocus({kind:"thread",threadId:s.threadId,sessionId:s.session.getId()}):this._proxy.$acceptStackFrameFocus(void 0)})),this.sendBreakpointsAndListen()}$registerDebugVisualizerTree(i,e){this._visualizerTreeHandles.set(i,this.visualizerService.registerTree(i,{disposeItem:t=>this._proxy.$disposeVisualizedTree(t),getChildren:t=>this._proxy.$getVisualizerTreeItemChildren(i,t),getTreeItem:t=>this._proxy.$getVisualizerTreeItem(i,t),editItem:e?((t,o)=>this._proxy.$editVisualizerTreeItem(t,o)):void 0}))}$unregisterDebugVisualizerTree(i){this._visualizerTreeHandles.get(i)?.dispose(),this._visualizerTreeHandles.delete(i)}$registerDebugVisualizer(i,e){let t=this.visualizerService.register({extensionId:new Ei(i),id:e,disposeDebugVisualizers:o=>this._proxy.$disposeDebugVisualizers(o),executeDebugVisualizerCommand:o=>this._proxy.$executeDebugVisualizerCommand(o),provideDebugVisualizers:(o,n)=>this._proxy.$provideDebugVisualizers(i,e,o,n).then(r=>r.map(jdi.deserialize)),resolveDebugVisualizer:(o,n)=>this._proxy.$resolveDebugVisualizer(o.id,n)});this._visualizerHandles.set(`${i}/${e}`,t)}$unregisterDebugVisualizer(i,e){let t=`${i}/${e}`;this._visualizerHandles.get(t)?.dispose(),this._visualizerHandles.delete(t)}sendBreakpointsAndListen(){this._toDispose.add(this.debugService.getModel().onDidChangeBreakpoints(o=>{if(o&&!o.sessionOnly){let n={};o.added&&(n.added=this.convertToDto(o.added)),o.removed&&(n.removed=o.removed.map(r=>r.getId())),o.changed&&(n.changed=this.convertToDto(o.changed)),(n.added||n.removed||n.changed)&&this._proxy.$acceptBreakpointsDelta(n)}}));let i=this.debugService.getModel().getBreakpoints(),e=this.debugService.getModel().getFunctionBreakpoints(),t=this.debugService.getModel().getDataBreakpoints();(i.length>0||e.length>0)&&this._proxy.$acceptBreakpointsDelta({added:this.convertToDto(i).concat(this.convertToDto(e)).concat(this.convertToDto(t))})}dispose(){this._toDispose.dispose()}createDebugAdapter(i){let e=this._debugAdaptersHandleCounter++,t=new eui(this,e,this._proxy,i);return this._debugAdapters.set(e,t),t}substituteVariables(i,e){return Promise.resolve(this._proxy.$substituteVariables(i?i.uri:void 0,e))}runInTerminal(i,e){return this._proxy.$runInTerminal(i,e)}$registerDebugTypes(i){this._toDispose.add(this.debugService.getAdapterManager().registerDebugAdapterFactory(i,this))}$registerBreakpoints(i){for(let e of i)if(e.type==="sourceMulti"){let t=e.lines.map(o=>({id:o.id,enabled:o.enabled,lineNumber:o.line+1,column:o.character>0?o.character+1:void 0,condition:o.condition,hitCondition:o.hitCondition,logMessage:o.logMessage,mode:o.mode}));this.debugService.addBreakpoints(A.revive(e.uri),t)}else e.type==="function"?this.debugService.addFunctionBreakpoint({name:e.functionName,mode:e.mode,condition:e.condition,hitCondition:e.hitCondition,enabled:e.enabled,logMessage:e.logMessage},e.id):e.type==="data"&&this.debugService.addDataBreakpoint({description:e.label,src:{type:0,dataId:e.dataId},canPersist:e.canPersist,accessTypes:e.accessTypes,accessType:e.accessType,mode:e.mode});return Promise.resolve()}$unregisterBreakpoints(i,e,t){return i.forEach(o=>this.debugService.removeBreakpoints(o)),e.forEach(o=>this.debugService.removeFunctionBreakpoints(o)),t.forEach(o=>this.debugService.removeDataBreakpoints(o)),Promise.resolve()}$registerDebugConfigurationProvider(i,e,t,o,n,r){let s={type:i,triggerKind:e};return t&&(s.provideDebugConfigurations=(l,c)=>this._proxy.$provideDebugConfigurations(r,l,c)),o&&(s.resolveDebugConfiguration=(l,c,u)=>this._proxy.$resolveDebugConfiguration(r,l,c,u)),n&&(s.resolveDebugConfigurationWithSubstitutedVariables=(l,c,u)=>this._proxy.$resolveDebugConfigurationWithSubstitutedVariables(r,l,c,u)),this._debugConfigurationProviders.set(r,s),this._toDispose.add(this.debugService.getConfigurationManager().registerDebugConfigurationProvider(s)),Promise.resolve(void 0)}$unregisterDebugConfigurationProvider(i){let e=this._debugConfigurationProviders.get(i);e&&(this._debugConfigurationProviders.delete(i),this.debugService.getConfigurationManager().unregisterDebugConfigurationProvider(e))}$registerDebugAdapterDescriptorFactory(i,e){let t={type:i,createDebugAdapterDescriptor:o=>Promise.resolve(this._proxy.$provideDebugAdapter(e,this.getSessionDto(o)))};return this._debugAdapterDescriptorFactories.set(e,t),this._toDispose.add(this.debugService.getAdapterManager().registerDebugAdapterDescriptorFactory(t)),Promise.resolve(void 0)}$unregisterDebugAdapterDescriptorFactory(i){let e=this._debugAdapterDescriptorFactories.get(i);e&&(this._debugAdapterDescriptorFactories.delete(i),this.debugService.getAdapterManager().unregisterDebugAdapterDescriptorFactory(e))}getSession(i){if(i)return this.debugService.getModel().getSession(i,!0)}async $startDebugging(i,e,t){let o=i?A.revive(i):void 0,n=this.debugService.getConfigurationManager().getLaunch(o),r=this.getSession(t.parentSessionID),s=typeof t.suppressSaveBeforeStart=="boolean"?!t.suppressSaveBeforeStart:void 0,l={noDebug:t.noDebug,parentSession:r,lifecycleManagedByParent:t.lifecycleManagedByParent,repl:t.repl,compact:t.compact,compoundRoot:r?.compoundRoot,saveBeforeRestart:s,testRun:t.testRun,suppressDebugStatusbar:t.suppressDebugStatusbar,suppressDebugToolbar:t.suppressDebugToolbar,suppressDebugView:t.suppressDebugView};try{return this.debugService.startDebugging(n,e,l,s)}catch(c){throw new Zs(c&&c.message?c.message:"cannot start debugging")}}$setDebugSessionName(i,e){this.debugService.getModel().getSession(i)?.setName(e)}$customDebugAdapterRequest(i,e,t){let o=this.debugService.getModel().getSession(i,!0);return o?o.customRequest(e,t).then(n=>n&&n.success?n.body:Promise.reject(new Zs(n?n.message:"custom request failed"))):Promise.reject(new Zs("debug session not found"))}$getDebugProtocolBreakpoint(i,e){let t=this.debugService.getModel().getSession(i,!0);return t?Promise.resolve(t.getDebugProtocolBreakpoint(e)):Promise.reject(new Zs("debug session not found"))}$stopDebugging(i){if(i){let e=this.debugService.getModel().getSession(i,!0);if(e)return this.debugService.stopSession(e,Wce(e))}else return this.debugService.stopSession(void 0);return Promise.reject(new Zs("debug session not found"))}$appendDebugConsole(i){this.debugService.getViewModel().focusedSession?.appendToRepl({output:i,sev:gt.Warning})}$acceptDAMessage(i,e){this.getDebugAdapter(i).acceptMessage(dXi(e,!1))}$acceptDAError(i,e,t,o){this._debugAdapters.get(i)?.fireError(i,new Error(`${e}: ${t}
${o}`))}$acceptDAExit(i,e,t){this._debugAdapters.get(i)?.fireExit(i,e,t)}getDebugAdapter(i){let e=this._debugAdapters.get(i);if(!e)throw new Error("Invalid debug adapter");return e}$sessionCached(i){this._extHostKnownSessions.add(i)}getSessionDto(i){if(i){let e=i.getId();return this._extHostKnownSessions.has(e)?e:{id:e,type:i.configuration.type,name:i.name,folderUri:i.root?i.root.uri:void 0,configuration:i.configuration,parent:i.parentSession?.getId()}}}convertToDto(i){return i.map(e=>{if("name"in e){let t=e;return{type:"function",id:t.getId(),enabled:t.enabled,condition:t.condition,hitCondition:t.hitCondition,logMessage:t.logMessage,functionName:t.name}}else if("src"in e){let t=e;return{type:"data",id:t.getId(),dataId:t.src.type===0?t.src.dataId:t.src.address,enabled:t.enabled,condition:t.condition,hitCondition:t.hitCondition,logMessage:t.logMessage,accessType:t.accessType,label:t.description,canPersist:t.canPersist}}else if("uri"in e){let t=e;return{type:"source",id:t.getId(),enabled:t.enabled,condition:t.condition,hitCondition:t.hitCondition,logMessage:t.logMessage,uri:t.uri,line:t.lineNumber>0?t.lineNumber-1:0,character:typeof t.column=="number"&&t.column>0?t.column-1:0}}else return}).filter(mo)}};S_t=I([vo(Gi.MainThreadDebugService),m(1,Li),m(2,qY)],S_t);var eui=class extends p_t{constructor(e,t,o,n){super();this._ds=e;this._handle=t;this._proxy=o;this.session=n}fireError(e,t){this._onError.fire(t)}fireExit(e,t,o){this._onExit.fire(t)}startSession(){return Promise.resolve(this._proxy.$startDASession(this._handle,this._ds.getSessionDto(this.session)))}sendMessage(e){this._proxy.$sendDAMessage(this._handle,cXi(e,!0))}async stopSession(){return await this.cancelPendingRequests(),Promise.resolve(this._proxy.$stopDASession(this._handle))}};var Cv=ae("IFileDecorationsService");var tui=class{constructor(i,e){this._proxy=i;this._handle=e;this._idPool=0;this._requests=new Map;this._resolver=new Map}enqueue(i,e){let t=++this._idPool,o=new Go;this._requests.set(t,{id:t,uri:i}),this._resolver.set(t,o),this._processQueue();let n=e.onCancellationRequested(()=>{this._requests.delete(t),this._resolver.delete(t),o.error(new ho)});return o.p.finally(()=>n.dispose())}_processQueue(){this._timer===void 0&&(this._timer=setTimeout(()=>{let i=this._requests,e=this._resolver;this._proxy.$provideDecorations(this._handle,[...i.values()],ve.None).then(t=>{for(let[o,n]of e)n.complete(t[o])}),this._requests=new Map,this._resolver=new Map,this._timer=void 0},0))}},I_t=class{constructor(i,e){this._decorationsService=e;this._provider=new Map;this._proxy=i.getProxy(Zi.ExtHostDecorations)}dispose(){this._provider.forEach(i=>Ue(i)),this._provider.clear()}$registerDecorationProvider(i,e){let t=new E,o=new tui(this._proxy,i),n=this._decorationsService.registerDecorationsProvider({label:e,onDidChange:t.event,provideDecorations:async(r,s)=>{let l=await o.enqueue(r,s);if(!l)return;let[c,u,p,h]=l;return{weight:10,bubble:c??!1,color:h?.id,tooltip:u,letter:p}}});this._provider.set(i,[t,n])}$onDidChange(i,e){let t=this._provider.get(i);if(t){let[o]=t;o.fire(e&&e.map(n=>A.revive(n)))}}$unregisterDecorationProvider(i){let e=this._provider.get(i);e&&(Ue(e),this._provider.delete(i))}};I_t=I([vo(Gi.MainThreadDecorations),m(1,Cv)],I_t);var Bce=class{constructor(i,e,t){this._markerService=e;this._uriIdentService=t;this._activeOwners=new Set;this._proxy=i.getProxy(Zi.ExtHostDiagnostics),this._markerListener=this._markerService.onMarkerChanged(this._forwardMarkers,this),this.extHostId=`extHost${Bce.ExtHostCounter++}`}dispose(){this._markerListener.dispose();for(let i of this._activeOwners){let e=new vt;for(let t of this._markerService.read({owner:i})){let o=e.get(t.resource);o===void 0&&(o=[],e.set(t.resource,o)),t.origin!==this.extHostId&&o.push(t)}for(let[t,o]of e.entries())this._markerService.changeOne(i,t,o)}this._activeOwners.clear()}_forwardMarkers(i){let e=[];for(let t of i){let o=this._markerService.read({resource:t,ignoreResourceFilters:!0});if(o.length===0)e.push([t,[]]);else{let n=o.filter(r=>r?.origin!==this.extHostId);n.length>0&&e.push([t,n])}}e.length>0&&this._proxy.$acceptMarkersChange(e)}$changeMany(i,e){for(let t of e){let[o,n]=t;if(n)for(let r of n){if(r.relatedInformation)for(let s of r.relatedInformation)s.resource=A.revive(s.resource);r.code&&typeof r.code!="string"&&(r.code.target=A.revive(r.code.target)),r.origin===void 0&&(r.origin=this.extHostId)}this._markerService.changeOne(i,this._uriIdentService.asCanonicalUri(A.revive(o)),n)}this._activeOwners.add(i)}$clear(i){this._markerService.changeAll(i,[]),this._activeOwners.delete(i)}};Bce.ExtHostCounter=1,Bce=I([vo(Gi.MainThreadDiagnostics),m(1,Ns),m(2,dt)],Bce);var Hce=class{constructor(i,e){this._fileDialogService=e}dispose(){}async $showOpenDialog(i){let e=Hce._convertOpenOptions(i);return e.defaultUri||(e.defaultUri=await this._fileDialogService.defaultFilePath()),Promise.resolve(this._fileDialogService.showOpenDialog(e))}async $showSaveDialog(i){let e=Hce._convertSaveOptions(i);return e.defaultUri||(e.defaultUri=await this._fileDialogService.defaultFilePath()),Promise.resolve(this._fileDialogService.showSaveDialog(e))}static _convertOpenOptions(i){let e={openLabel:i?.openLabel||void 0,canSelectFiles:i?.canSelectFiles||!i?.canSelectFiles&&!i?.canSelectFolders,canSelectFolders:i?.canSelectFolders,canSelectMany:i?.canSelectMany,defaultUri:i?.defaultUri?A.revive(i.defaultUri):void 0,title:i?.title||void 0,availableFileSystems:[]};if(i?.filters){e.filters=[];for(let[t,o]of Object.entries(i.filters))e.filters.push({name:t,extensions:o})}return e}static _convertSaveOptions(i){let e={defaultUri:i?.defaultUri?A.revive(i.defaultUri):void 0,saveLabel:i?.saveLabel||void 0,title:i?.title||void 0};if(i?.filters){e.filters=[];for(let[t,o]of Object.entries(i.filters))e.filters.push({name:t,extensions:o})}return e}};Hce=I([vo(Gi.MainThreadDialogs),m(1,dn)],Hce);var y_t=class{constructor(i,e,t,o,n){this._textModelResolverService=e;this._languageService=t;this._modelService=o;this._editorWorkerService=n;this._resourceContentProvider=new jt;this._pendingUpdate=new Map;this._proxy=i.getProxy(Zi.ExtHostDocumentContentProviders)}dispose(){this._resourceContentProvider.dispose(),Ue(this._pendingUpdate.values())}$registerTextContentProvider(i,e){let t=this._textModelResolverService.registerTextModelContentProvider(e,{provideTextContent:o=>this._proxy.$provideTextDocumentContent(i,o).then(n=>{if(typeof n=="string"){let r=n.substr(0,1+n.search(/\r?\n/)),s=this._languageService.createByFilepathOrFirstLine(o,r);return this._modelService.createModel(n,s,o)}return null})});this._resourceContentProvider.set(i,t)}$unregisterTextContentProvider(i){this._resourceContentProvider.deleteAndDispose(i)}async $onVirtualDocumentChange(i,e){let t=this._modelService.getModel(A.revive(i));if(!t)return;this._pendingUpdate.get(t.id)?.cancel();let n=new $e;this._pendingUpdate.set(t.id,n);try{let r=await this._editorWorkerService.computeMoreMinimalEdits(t.uri,[{text:e,range:t.getFullModelRange()}]);if(this._pendingUpdate.delete(t.id),n.token.isCancellationRequested||t.isDisposed())return;r&&r.length>0&&t.applyEdits(r.map(s=>An.replace(z.lift(s.range),s.text)))}catch(r){mt(r)}}};y_t=I([vo(Gi.MainThreadDocumentContentProviders),m(1,Nt),m(2,kt),m(3,Ct),m(4,$s)],y_t);var Wa=ae("workingCopyService"),iui=class extends Error{constructor(i,e){super(i),this.name="WorkingCopyLeakError",this.stack=e}},oui=class a extends C{constructor(){super(...arguments);this._onDidRegister=this._register(new E);this.onDidRegister=this._onDidRegister.event;this._onDidUnregister=this._register(new E);this.onDidUnregister=this._onDidUnregister.event;this._onDidChangeDirty=this._register(new E);this.onDidChangeDirty=this._onDidChangeDirty.event;this._onDidChangeContent=this._register(new E);this.onDidChangeContent=this._onDidChangeContent.event;this._onDidSave=this._register(new E);this.onDidSave=this._onDidSave.event;this._workingCopies=new Set;this.mapResourceToWorkingCopies=new vt;this.mapWorkingCopyToListeners=this._register(new jt);this.mapLeakToCounter=new Map}get workingCopies(){return Array.from(this._workingCopies.values())}registerWorkingCopy(e){let t=this.mapResourceToWorkingCopies.get(e.resource);if(t?.has(e.typeId))throw new Error(`Cannot register more than one working copy with the same resource ${e.resource.toString()} and type ${e.typeId}.`);this._workingCopies.add(e),t||(t=new Map,this.mapResourceToWorkingCopies.set(e.resource,t)),t.set(e.typeId,e);let o=new P;o.add(e.onDidChangeContent(()=>this._onDidChangeContent.fire(e))),o.add(e.onDidChangeDirty(()=>this._onDidChangeDirty.fire(e))),o.add(e.onDidSave(r=>this._onDidSave.fire({workingCopy:e,...r}))),this.mapWorkingCopyToListeners.set(e,o),this._onDidRegister.fire(e),e.isDirty()&&this._onDidChangeDirty.fire(e);let n=this.trackLeaks(e);return Z(()=>{n&&this.untrackLeaks(n),this.unregisterWorkingCopy(e),this._onDidUnregister.fire(e)})}unregisterWorkingCopy(e){this._workingCopies.delete(e);let t=this.mapResourceToWorkingCopies.get(e.resource);t?.delete(e.typeId)&&t.size===0&&this.mapResourceToWorkingCopies.delete(e.resource),e.isDirty()&&this._onDidChangeDirty.fire(e),this.mapWorkingCopyToListeners.deleteAndDispose(e)}has(e){return A.isUri(e)?this.mapResourceToWorkingCopies.has(e):this.mapResourceToWorkingCopies.get(e.resource)?.has(e.typeId)??!1}get(e){return this.mapResourceToWorkingCopies.get(e.resource)?.get(e.typeId)}getAll(e){let t=this.mapResourceToWorkingCopies.get(e);if(t)return Array.from(t.values())}static{this.LEAK_TRACKING_THRESHOLD=256}static{this.LEAK_REPORTING_THRESHOLD=2*a.LEAK_TRACKING_THRESHOLD}static{this.LEAK_REPORTED=!1}trackLeaks(e){if(a.LEAK_REPORTED||this._workingCopies.size<a.LEAK_TRACKING_THRESHOLD)return;let t=`${e.resource.scheme}#${e.typeId||"<no typeId>"}
${new Error().stack?.split(`
`).slice(2).join(`
`)??""}`,o=(this.mapLeakToCounter.get(t)??0)+1;if(this.mapLeakToCounter.set(t,o),this._workingCopies.size>a.LEAK_REPORTING_THRESHOLD){a.LEAK_REPORTED=!0;let[n,r]=Array.from(this.mapLeakToCounter.entries()).reduce(([l,c],[u,p])=>p>c?[u,p]:[l,c]),s=`Potential working copy LEAK detected, having ${this._workingCopies.size} working copies already. Most frequent owner (${r})`;mt(new iui(s,n))}return t}untrackLeaks(e){let t=(this.mapLeakToCounter.get(e)??1)-1;this.mapLeakToCounter.set(e,t),t===0&&this.mapLeakToCounter.delete(e)}get hasDirty(){for(let e of this._workingCopies)if(e.isDirty())return!0;return!1}get dirtyCount(){let e=0;for(let t of this._workingCopies)t.isDirty()&&e++;return e}get dirtyWorkingCopies(){return this.workingCopies.filter(e=>e.isDirty())}get modifiedCount(){let e=0;for(let t of this._workingCopies)t.isModified()&&e++;return e}get modifiedWorkingCopies(){return this.workingCopies.filter(e=>e.isModified())}isDirty(e,t){let o=this.mapResourceToWorkingCopies.get(e);if(o){if(typeof t=="string")return o.get(t)?.isDirty()??!1;for(let[,n]of o)if(n.isDirty())return!0}return!1}};we(Wa,oui,1);var Lke=class extends C{constructor(e,t){super();this.logService=e;this.configurationService=t;this.participants=new Vs}addFileOperationParticipant(e){let t=this.participants.push(e);return Z(()=>t())}async participate(e,t,o,n){let r=this.configurationService.getValue("files.participants.timeout");if(!(typeof r!="number"||r<=0))for(let s of this.participants)try{await s.participate(e,t,o,r,n)}catch(l){this.logService.warn(l)}}dispose(){this.participants.clear(),super.dispose()}};Lke=I([m(0,ne),m(1,B)],Lke);var Rke=class extends C{constructor(e,t){super();this.logService=e;this.progressService=t;this.saveParticipants=new Vs}get length(){return this.saveParticipants.size}addSaveParticipant(e){let t=this.saveParticipants.push(e);return Z(()=>t())}async participate(e,t,o,n){let r=new $e(n);e.model?.pushStackElement(),o.report({message:d(17611,null)});let s=!1;if(await this.progressService.withProgress({priority:3,location:15,cancellable:d(17612,null),delay:e.isDirty()?5e3:3e3},async l=>{let c=Array.from(this.saveParticipants).sort((u,p)=>{let h=u.ordinal??0,g=p.ordinal??0;return h-g});for(let u of c){if(r.token.isCancellationRequested||e.isDisposed())break;try{let p=u.participate(e,t,l,r.token);await wa(p,r.token)}catch(p){so(p)?r.token.isCancellationRequested||(r.cancel(),s=!0):this.logService.error(p)}}},()=>{r.cancel()}),e.model?.pushStackElement(),r.dispose(),s)throw new ho}dispose(){this.saveParticipants.clear(),super.dispose()}};Rke=I([m(0,ne),m(1,Bo)],Rke);var kp=ae("workingCopyFileService"),bQe=class extends C{constructor(e,t,o,n){super();this.fileService=e;this.workingCopyService=t;this.uriIdentityService=n;this._onWillRunWorkingCopyFileOperation=this._register(new JH);this.onWillRunWorkingCopyFileOperation=this._onWillRunWorkingCopyFileOperation.event;this._onDidFailWorkingCopyFileOperation=this._register(new JH);this.onDidFailWorkingCopyFileOperation=this._onDidFailWorkingCopyFileOperation.event;this._onDidRunWorkingCopyFileOperation=this._register(new JH);this.onDidRunWorkingCopyFileOperation=this._onDidRunWorkingCopyFileOperation.event;this.correlationIds=0;this.workingCopyProviders=[];this.fileOperationParticipants=this._register(o.createInstance(Lke)),this.saveParticipants=this._register(o.createInstance(Rke)),this._register(this.registerWorkingCopyProvider(r=>this.workingCopyService.workingCopies.filter(s=>this.fileService.hasProvider(r)?this.uriIdentityService.extUri.isEqualOrParent(s.resource,r):this.uriIdentityService.extUri.isEqual(s.resource,r))))}create(e,t,o){return this.doCreateFileOrFolder(e,!0,t,o)}createFolder(e,t,o){return this.doCreateFileOrFolder(e,!1,t,o)}async doCreateFileOrFolder(e,t,o,n){if(e.length===0)return[];if(t){let u=(await fn.settled(e.map(p=>this.fileService.canCreateFile(p.resource,{overwrite:p.overwrite})))).find(p=>p instanceof Error);if(u instanceof Error)throw u}let r=e.map(c=>({target:c.resource}));await this.runFileOperationParticipants(r,0,n,o);let s={correlationId:this.correlationIds++,operation:0,files:r};await this._onWillRunWorkingCopyFileOperation.fireAsync(s,ve.None);let l;try{t?l=await fn.settled(e.map(c=>this.fileService.createFile(c.resource,c.contents,{overwrite:c.overwrite}))):l=await fn.settled(e.map(c=>this.fileService.createFolder(c.resource)))}catch(c){throw await this._onDidFailWorkingCopyFileOperation.fireAsync(s,ve.None),c}return await this._onDidRunWorkingCopyFileOperation.fireAsync(s,ve.None),l}async move(e,t,o){return this.doMoveOrCopy(e,!0,t,o)}async copy(e,t,o){return this.doMoveOrCopy(e,!1,t,o)}async doMoveOrCopy(e,t,o,n){let r=[];for(let{file:{source:c,target:u},overwrite:p}of e){let h=await(t?this.fileService.canMove(c,u,p):this.fileService.canCopy(c,u,p));if(h instanceof Error)throw h}let s=e.map(c=>c.file);await this.runFileOperationParticipants(s,t?2:3,n,o);let l={correlationId:this.correlationIds++,operation:t?2:3,files:s};await this._onWillRunWorkingCopyFileOperation.fireAsync(l,ve.None);try{for(let{file:{source:c,target:u},overwrite:p}of e){if(!this.uriIdentityService.extUri.isEqual(c,u)){let h=t?[...this.getDirty(c),...this.getDirty(u)]:this.getDirty(u);await fn.settled(h.map(g=>g.revert({soft:!0})))}t?r.push(await this.fileService.move(c,u,p)):r.push(await this.fileService.copy(c,u,p))}}catch(c){throw await this._onDidFailWorkingCopyFileOperation.fireAsync(l,ve.None),c}return await this._onDidRunWorkingCopyFileOperation.fireAsync(l,ve.None),r}async delete(e,t,o){for(let s of e){let l=await this.fileService.canDelete(s.resource,{recursive:s.recursive,useTrash:s.useTrash});if(l instanceof Error)throw l}let n=e.map(s=>({target:s.resource}));await this.runFileOperationParticipants(n,1,o,t);let r={correlationId:this.correlationIds++,operation:1,files:n};await this._onWillRunWorkingCopyFileOperation.fireAsync(r,ve.None);for(let s of e){let l=this.getDirty(s.resource);await fn.settled(l.map(c=>c.revert({soft:!0})))}try{for(let s of e)await this.fileService.del(s.resource,{recursive:s.recursive,useTrash:s.useTrash})}catch(s){throw await this._onDidFailWorkingCopyFileOperation.fireAsync(r,ve.None),s}await this._onDidRunWorkingCopyFileOperation.fireAsync(r,ve.None)}addFileOperationParticipant(e){return this.fileOperationParticipants.addFileOperationParticipant(e)}runFileOperationParticipants(e,t,o,n){return this.fileOperationParticipants.participate(e,t,o,n)}get hasSaveParticipants(){return this.saveParticipants.length>0}addSaveParticipant(e){return this.saveParticipants.addSaveParticipant(e)}runSaveParticipants(e,t,o,n){return this.saveParticipants.participate(e,t,o,n)}registerWorkingCopyProvider(e){let t=Zm(this.workingCopyProviders,e);return Z(t)}getDirty(e){let t=new Set;for(let o of this.workingCopyProviders)for(let n of o(e))n.isDirty()&&t.add(n);return Array.from(t)}};bQe=I([m(0,be),m(1,Wa),m(2,F),m(3,dt)],bQe);we(kp,bQe,1);var SQe=class{constructor(i,e=1e3*60*3,t=1024*1024*80,o=50){this._extUri=i;this._maxAge=e;this._maxLength=t;this._maxSize=o;this._data=new Array;this._length=0}dispose(){this._data=Ue(this._data)}remove(i){for(let e of[...this._data])this._extUri.isEqualOrParent(e.uri,i)&&e.dispose()}add(i,e,t=0){let o=()=>{let s=this._data.indexOf(r);s>=0&&(this._length-=t,e.dispose(),clearTimeout(n),this._data.splice(s,1))},n=setTimeout(o,this._maxAge),r={uri:i,length:t,dispose:o};this._data.push(r),this._length+=t,this._cleanup()}_cleanup(){for(;this._length>this._maxLength;)this._data[0].dispose();let i=Math.ceil(this._maxSize*1.2);this._data.length>=i&&Ue(this._data.slice(0,i-this._maxSize))}},nui=class extends C{constructor(e,t,o,n){super();this._model=e;this._onIsCaughtUpWithContentChanges=t;this._proxy=o;this._textFileService=n;this._knownVersionId=this._model.getVersionId(),this._store.add(this._model.onDidChangeContent(r=>{this._knownVersionId=r.versionId,r.detailedReasonsChangeLengths.length!==1&&mt(new Error(`Unexpected reasons: ${r.detailedReasons.map(l=>l.toString())}`));let s={changes:r.changes,isEolChange:r.isEolChange,isUndoing:r.isUndoing,isRedoing:r.isRedoing,isFlush:r.isFlush,eol:r.eol,versionId:r.versionId,detailedReason:r.detailedReasons[0].metadata};this._proxy.$acceptModelChanged(this._model.uri,s,this._textFileService.isDirty(this._model.uri)),this.isCaughtUpWithContentChanges()&&this._onIsCaughtUpWithContentChanges.fire(this._model.uri)}))}isCaughtUpWithContentChanges(){return this._model.getVersionId()===this._knownVersionId}},Mke=class extends C{constructor(e,t,o,n,r,s,l,c,u){super();this._modelService=t;this._textFileService=o;this._fileService=n;this._textModelResolverService=r;this._environmentService=s;this._uriIdentityService=l;this._pathService=u;this._onIsCaughtUpWithContentChanges=this._store.add(new E);this.onIsCaughtUpWithContentChanges=this._onIsCaughtUpWithContentChanges.event;this._modelTrackers=new vt;this._modelReferenceCollection=this._store.add(new SQe(l.extUri)),this._proxy=e.getProxy(Zi.ExtHostDocuments),this._store.add(t.onModelLanguageChanged(this._onModelModeChanged,this)),this._store.add(o.files.onDidSave(p=>{this._shouldHandleFileEvent(p.model.resource)&&this._proxy.$acceptModelSaved(p.model.resource)})),this._store.add(o.files.onDidChangeDirty(p=>{this._shouldHandleFileEvent(p.resource)&&this._proxy.$acceptDirtyStateChanged(p.resource,p.isDirty())})),this._store.add(H.any(o.files.onDidChangeEncoding,o.untitled.onDidChangeEncoding)(p=>{if(this._shouldHandleFileEvent(p.resource)){let h=p.getEncoding();h&&this._proxy.$acceptEncodingChanged(p.resource,h)}})),this._store.add(c.onDidRunWorkingCopyFileOperation(p=>{let h=p.operation===2;if(h||p.operation===1)for(let g of p.files){let f=h?g.source:g.target;f&&this._modelReferenceCollection.remove(f)}}))}dispose(){Ue(this._modelTrackers.values()),this._modelTrackers.clear(),super.dispose()}isCaughtUpWithContentChanges(e){let t=this._modelTrackers.get(e);return t?t.isCaughtUpWithContentChanges():!0}_shouldHandleFileEvent(e){let t=this._modelService.getModel(e);return!!t&&hx(t)}handleModelAdded(e){hx(e)&&this._modelTrackers.set(e.uri,new nui(e,this._onIsCaughtUpWithContentChanges,this._proxy,this._textFileService))}_onModelModeChanged(e){let{model:t}=e;this._modelTrackers.has(t.uri)&&this._proxy.$acceptModelLanguageChanged(t.uri,t.getLanguageId())}handleModelRemoved(e){this._modelTrackers.has(e)&&(this._modelTrackers.get(e).dispose(),this._modelTrackers.delete(e))}async $trySaveDocument(e){return!!await this._textFileService.save(A.revive(e))}async $tryOpenDocument(e,t){let o=A.revive(e);if(!o.scheme||!(o.fsPath||o.authority))throw new Zs("Invalid uri. Scheme and authority or path must be set.");let n=this._uriIdentityService.asCanonicalUri(o),r;switch(n.scheme){case Y.untitled:r=this._handleUntitledScheme(n,t);break;case Y.file:default:r=this._handleAsResourceInput(n,t);break}let s;try{s=await r}catch(l){throw new Zs(`cannot open ${n.toString()}. Detail: ${In(l)}`)}if(s)if(ar.isEqual(s,n)){if(this._modelTrackers.has(n))return n;throw new Zs(`cannot open ${n.toString()}. Detail: Files above 50MB cannot be synchronized with extensions.`)}else throw new Zs(`cannot open ${n.toString()}. Detail: Actual document opened as ${s.toString()}`);else throw new Zs(`cannot open ${n.toString()}`)}$tryCreateDocument(e){return this._doCreateUntitled(void 0,e)}async _handleAsResourceInput(e,t){if(t?.encoding){let n=await this._textFileService.files.resolve(e,{encoding:t.encoding,reason:2});if(n.isDirty())throw new Zs("Cannot re-open a dirty text document with different encoding. Save it first.");await n.setEncoding(t.encoding,1)}let o=await this._textModelResolverService.createModelReference(e);return this._modelReferenceCollection.add(e,o,o.object.textEditorModel.getValueLength()),o.object.textEditorModel.uri}async _handleUntitledScheme(e,t){let o=Og(e,this._environmentService.remoteAuthority,this._pathService.defaultUriScheme);return await this._fileService.exists(o)?Promise.reject(new Error("file already exists")):await this._doCreateUntitled(e.path?e:void 0,t)}async _doCreateUntitled(e,t){let o=this._textFileService.untitled.create({associatedResource:e,languageId:t?.language,initialValue:t?.content,encoding:t?.encoding});t?.encoding&&await o.setEncoding(t.encoding);let n=o.resource,r=await this._textModelResolverService.createModelReference(n);if(!this._modelTrackers.has(n))throw r.dispose(),new Error(`expected URI ${n.toString()} to have come to LIFE`);return this._modelReferenceCollection.add(n,r,r.object.textEditorModel.getValueLength()),H.once(o.onDidRevert)(()=>this._modelReferenceCollection.remove(n)),this._proxy.$acceptDirtyStateChanged(n,!0),n}};Mke=I([m(1,Ct),m(2,Ho),m(3,be),m(4,Nt),m(5,Vt),m(6,dt),m(7,kp),m(8,wn)],Mke);var w_t=class a{constructor(i,e,t){this.selections=i;this.options=e;this.visibleRanges=t}static readFromEditor(i,e,t){let o=a._readSelectionsFromCodeEditor(i,t),n=a._readOptionsFromCodeEditor(i,e,t),r=a._readVisibleRangesFromCodeEditor(i,t);return new a(o,n,r)}static _readSelectionsFromCodeEditor(i,e){let t=null;return e&&(t=e.getSelections()),!t&&i&&(t=i.selections),t||(t=[new Yt(1,1,1,1)]),t}static _readOptionsFromCodeEditor(i,e,t){if(e.isDisposed()){if(i)return i.options;throw new Error("No valid properties")}let o,n;if(t){let s=t.getOptions(),l=s.get(76);o=s.get(34),n=l.renderType}else i?(o=i.options.cursorStyle,n=i.options.lineNumbers):(o=1,n=1);let r=e.getOptions();return{insertSpaces:r.insertSpaces,tabSize:r.tabSize,indentSize:r.indentSize,originalIndentSize:r.originalIndentSize,cursorStyle:o,lineNumbers:n}}static _readVisibleRangesFromCodeEditor(i,e){return e?e.getVisibleRanges():[]}generateDelta(i,e){let t={options:null,selections:null,visibleRanges:null};return(!i||!a._selectionsEqual(i.selections,this.selections))&&(t.selections={selections:this.selections,source:e??void 0}),(!i||!a._optionsEqual(i.options,this.options))&&(t.options=this.options),(!i||!a._rangesEqual(i.visibleRanges,this.visibleRanges))&&(t.visibleRanges=this.visibleRanges),t.selections||t.options||t.visibleRanges?t:null}static _selectionsEqual(i,e){return $i(i,e,(t,o)=>t.equalsSelection(o))}static _rangesEqual(i,e){return $i(i,e,(t,o)=>t.equalsRange(o))}static _optionsEqual(i,e){return i&&!e||!i&&e?!1:!i&&!e?!0:i.tabSize===e.tabSize&&i.indentSize===e.indentSize&&i.insertSpaces===e.insertSpaces&&i.cursorStyle===e.cursorStyle&&i.lineNumbers===e.lineNumbers}},C_t=class{constructor(i,e,t,o,n,r,s){this._modelListeners=new P;this._codeEditorListeners=new P;this._id=i,this._model=e,this._codeEditor=null,this._properties=null,this._focusTracker=o,this._mainThreadDocuments=n,this._modelService=r,this._clipboardService=s,this._onPropertiesChanged=new E,this._modelListeners.add(this._model.onDidChangeOptions(l=>{this._updatePropertiesNow(null)})),this.setCodeEditor(t),this._updatePropertiesNow(null)}dispose(){this._modelListeners.dispose(),this._onPropertiesChanged.dispose(),this._codeEditor=null,this._codeEditorListeners.dispose()}_updatePropertiesNow(i){this._setProperties(w_t.readFromEditor(this._properties,this._model,this._codeEditor),i)}_setProperties(i,e){let t=i.generateDelta(this._properties,e);this._properties=i,t&&this._onPropertiesChanged.fire(t)}getId(){return this._id}getModel(){return this._model}getCodeEditor(){return this._codeEditor}hasCodeEditor(i){return this._codeEditor===i}setCodeEditor(i){if(!this.hasCodeEditor(i)&&(this._codeEditorListeners.clear(),this._codeEditor=i,this._codeEditor)){this._codeEditorListeners.add(this._codeEditor.onDidChangeModel(()=>{this.setCodeEditor(null)})),this._codeEditorListeners.add(this._codeEditor.onDidFocusEditorWidget(()=>{this._focusTracker.onGainedFocus()})),this._codeEditorListeners.add(this._codeEditor.onDidBlurEditorWidget(()=>{this._focusTracker.onLostFocus()}));let e=null;this._codeEditorListeners.add(this._mainThreadDocuments.onIsCaughtUpWithContentChanges(n=>{if(n.toString()===this._model.uri.toString()){let r=e;e=null,this._updatePropertiesNow(r)}}));let t=()=>this._codeEditor&&this._codeEditor.getModel()===this._model,o=n=>{this._mainThreadDocuments.isCaughtUpWithContentChanges(this._model.uri)?(e=null,this._updatePropertiesNow(n)):e=n};this._codeEditorListeners.add(this._codeEditor.onDidChangeCursorSelection(n=>{t()&&o(n.source)})),this._codeEditorListeners.add(this._codeEditor.onDidChangeConfiguration(n=>{t()&&o(null)})),this._codeEditorListeners.add(this._codeEditor.onDidLayoutChange(()=>{t()&&o(null)})),this._codeEditorListeners.add(this._codeEditor.onDidScrollChange(()=>{t()&&o(null)})),this._updatePropertiesNow(null)}}isVisible(){return!!this._codeEditor}getProperties(){return this._properties}get onPropertiesChanged(){return this._onPropertiesChanged.event}setSelections(i){if(this._codeEditor){this._codeEditor.setSelections(i);return}let e=i.map(Yt.liftSelection);this._setProperties(new w_t(e,this._properties.options,this._properties.visibleRanges),null)}_setIndentConfiguration(i){let e=this._modelService.getCreationOptions(this._model.getLanguageId(),this._model.uri,this._model.isForSimpleWidget);if(i.tabSize==="auto"||i.insertSpaces==="auto"){let o=e.insertSpaces,n=e.tabSize;i.insertSpaces!=="auto"&&typeof i.insertSpaces<"u"&&(o=i.insertSpaces),i.tabSize!=="auto"&&typeof i.tabSize<"u"&&(n=i.tabSize),this._model.detectIndentation(o,n);return}let t={};typeof i.insertSpaces<"u"&&(t.insertSpaces=i.insertSpaces),typeof i.tabSize<"u"&&(t.tabSize=i.tabSize),typeof i.indentSize<"u"&&(t.indentSize=i.indentSize),this._model.updateOptions(t)}setConfiguration(i){if(this._setIndentConfiguration(i),!!this._codeEditor){if(i.cursorStyle){let e=hKi(i.cursorStyle);this._codeEditor.updateOptions({cursorStyle:e})}if(typeof i.lineNumbers<"u"){let e;switch(i.lineNumbers){case 1:e="on";break;case 2:e="relative";break;case 3:e="interval";break;default:e="off"}this._codeEditor.updateOptions({lineNumbers:e})}}}setDecorations(i,e){this._codeEditor&&this._codeEditor.setDecorationsByType("exthost-api",i,e)}setDecorationsFast(i,e){if(!this._codeEditor)return;let t=[];for(let o=0,n=Math.floor(e.length/4);o<n;o++)t[o]=new z(e[4*o],e[4*o+1],e[4*o+2],e[4*o+3]);this._codeEditor.setDecorationsByTypeFast(i,t)}revealRange(i,e){if(this._codeEditor)switch(e){case 0:this._codeEditor.revealRange(i,0);break;case 1:this._codeEditor.revealRangeInCenter(i,0);break;case 2:this._codeEditor.revealRangeInCenterIfOutsideViewport(i,0);break;case 3:this._codeEditor.revealRangeAtTop(i,0);break;default:console.warn(`Unknown revealType: ${e}`);break}}isFocused(){return this._codeEditor?this._codeEditor.hasTextFocus():!1}matches(i){return i?i.getControl()===this._codeEditor:!1}applyEdits(i,e,t){if(this._model.getVersionId()!==i||!this._codeEditor)return!1;typeof t.setEndOfLine<"u"&&this._model.pushEOL(t.setEndOfLine);let o=e.map(n=>({range:z.lift(n.range),text:n.text,forceMoveMarkers:n.forceMoveMarkers}));return t.undoStopBefore&&this._codeEditor.pushUndoStop(),this._codeEditor.executeEdits("MainThreadTextEditor",o),t.undoStopAfter&&this._codeEditor.pushUndoStop(),!0}async insertSnippet(i,e,t,o){if(!this._codeEditor||!this._codeEditor.hasModel())return!1;let n;if(zh.guessNeedsClipboard(e)){let c=new y1(this._codeEditor,5);if(n=await this._clipboardService.readText(),!c.validate(this._codeEditor))return!1}if(this._codeEditor.getModel().getVersionId()!==i)return!1;let s=Qr.get(this._codeEditor);if(!s)return!1;this._codeEditor.focus();let l=t.map(c=>({range:z.lift(c),template:e}));return s.apply(l,{overwriteBefore:0,overwriteAfter:0,undoStopBefore:o.undoStopBefore,undoStopAfter:o.undoStopAfter,adjustWhitespace:!o.keepWhitespace,clipboardText:n}),!0}};function W_(a,i,e=Un){if(e===Un||e===vn||e===hg||e===ym)return e;let t=a.getGroups(2)[e];if(!t&&e<9){for(let o=0;o<=e;o++){let n=a.getGroups(2);n[o]||a.addGroup(n[o-1],pC(i))}t=a.getGroups(2)[e]}return t?.id??vn}function bC(a,i){let e=typeof i=="number"?a.getGroup(i):i;return a.getGroups(2).indexOf(e??a.activeGroup)}var OE=ae("quickDiff"),IQe=J("editorGutter.modifiedBackground",{dark:"#1B81A8",light:"#2090D3",hcDark:"#1B81A8",hcLight:"#2090D3"},d(13131,null));J("editorGutter.modifiedSecondaryBackground",{dark:Sp(IQe,.5),light:RS(IQe,.7),hcDark:"#1B81A8",hcLight:"#2090D3"},d(13132,null));var yQe=J("editorGutter.addedBackground",{dark:"#487E02",light:"#48985D",hcDark:"#487E02",hcLight:"#48985D"},d(13125,null));J("editorGutter.addedSecondaryBackground",{dark:Sp(yQe,.5),light:RS(yQe,.7),hcDark:"#487E02",hcLight:"#48985D"},d(13126,null));var wQe=J("editorGutter.deletedBackground",av,d(13127,null));J("editorGutter.deletedSecondaryBackground",{dark:Sp(wQe,.4),light:RS(wQe,.3),hcDark:"#F48771",hcLight:"#B5200D"},d(13128,null));var Pke=J("minimapGutter.modifiedBackground",IQe,d(13135,null)),Ake=J("minimapGutter.addedBackground",yQe,d(13133,null)),Nke=J("minimapGutter.deletedBackground",wQe,d(13134,null)),jY=J("editorOverviewRuler.modifiedForeground",ei(IQe,.6),d(13138,null)),QY=J("editorOverviewRuler.addedForeground",ei(yQe,.6),d(13136,null)),YY=J("editorOverviewRuler.deletedForeground",ei(wQe,.6),d(13137,null)),zCa=J("editorGutter.itemGlyphForeground",{dark:od,light:od,hcDark:Oe.black,hcLight:Oe.white},d(13130,null)),KCa=J("editorGutter.itemBackground",{dark:W$(xf,qo),light:Sp(W$(xf,qo),.05),hcDark:Oe.white,hcLight:Oe.black},d(13129,null));function CQe(a){return a.originalEndLineNumber===0?1:a.modifiedEndLineNumber===0?2:0}function vXi(a,i){switch(i){case 0:return a.getColor(IQe);case 1:return a.getColor(yQe);case 2:return a.getColor(wQe)}}function x_t(a,i){let e=a.modifiedStartLineNumber-i.modifiedStartLineNumber;return e!==0||(e=a.modifiedEndLineNumber-i.modifiedEndLineNumber,e!==0)||(e=a.originalStartLineNumber-i.originalStartLineNumber,e!==0)?e:a.originalEndLineNumber-i.originalEndLineNumber}function bXi(a){let i=a.modifiedEndLineNumber-a.modifiedStartLineNumber+1,e=a.originalEndLineNumber-a.originalStartLineNumber+1;return a.originalEndLineNumber===0?i:a.modifiedEndLineNumber===0?e:i+e}function xQe(a){return a.modifiedEndLineNumber===0?a.modifiedStartLineNumber===0?1:a.modifiedStartLineNumber:a.modifiedEndLineNumber}function SXi(a,i){return a===1&&i.modifiedStartLineNumber===0&&i.modifiedEndLineNumber===0?!0:a>=i.modifiedStartLineNumber&&a<=(i.modifiedEndLineNumber||i.modifiedStartLineNumber)}var Uce="workbench.view.scm",Af="workbench.scm",k_t="workbench.scm.repositories",IP="workbench.scm.history";var $c=ae("scm");var au=ae("scmView");var dl=ae("chatEditingService");function Qj(a){return new Promise(i=>{ux(e=>{a.state.read(e)!==0&&(e.dispose(),i())})})}function E_t(a,i){return{originalURI:a,modifiedURI:i,added:0,removed:0,quitEarly:!1,identical:!1,isFinal:!1,isBusy:!1}}var _z="chat-editing-multi-diff-source",sR=new Q("chatEditingWidgetFileState",void 0,d(7595,null)),IXi=new Q("chatEditingAgentSupportsReadonlyReferences",void 0,d(7594,null)),kQe=new Q("decidedChatEditingResource",[]),Oke=new Q("chatEditingResource",void 0),T_t=new Q("inChatEditingSession",void 0),Zx=new Q("hasUndecidedChatEditingResource",!1),zce=new Q("hasAppliedChatEdits",!1),Yj=new Q("applyingChatEditsFailed",!1);function yXi(a){return typeof a=="object"&&!!a&&Wo(a,{sessionResource:!0})}function wXi(a,i){return A.from({scheme:_z,authority:b$(Je.fromString(a.chatSessionResource.toString())),query:i?"previous":void 0})}function EQe(a){let i=A.parse(Fbe(a.authority).toString()),e=a.query==="previous";return{chatSessionResource:i,showPreviousChanges:e}}var HO=ae("IQuickDiffModelService"),N1o={algorithm:"advanced",maxComputationTimeMs:1e3},TQe=class extends Ww{constructor(e){super();this._instantiationService=e}createReferencedObject(e,t,o){return this._instantiationService.createInstance(_Qe,t,o)}destroyReferencedObject(e,t){t.dispose()}};TQe=I([m(0,F)],TQe);var Fke=class{constructor(i,e,t){this.instantiationService=i;this.textFileService=e;this.uriIdentityService=t;this._references=this.instantiationService.createInstance(TQe)}createQuickDiffModelReference(i,e=N1o){let t=this.textFileService.files.get(i);if(t?.isResolved())return i=this.uriIdentityService.asCanonicalUri(i).with({query:JSON.stringify(e)}),this._references.acquire(i.toString(),t,e)}};Fke=I([m(0,F),m(1,Ho),m(2,dt)],Fke);var _Qe=class extends C{constructor(e,t,o,n,r,s,l,c,u){super();this.options=t;this.scmService=o;this.quickDiffService=n;this.editorWorkerService=r;this.configurationService=s;this.textModelResolverService=l;this._chatEditingService=c;this.progressService=u;this._originalEditorModels=new vt;this._originalEditorModelsDisposables=this._register(new P);this._disposed=!1;this._quickDiffs=[];this._diffDelayer=this._register(new ya(200));this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._allChanges=[];this._changes=[];this._quickDiffChanges=new Map;this._repositoryDisposables=new jt;this._model=e,this._register(e.textEditorModel.onDidChangeContent(()=>this.triggerDiff())),this._register(H.filter(s.onDidChangeConfiguration,p=>p.affectsConfiguration("scm.diffDecorationsIgnoreTrimWhitespace")||p.affectsConfiguration("diffEditor.ignoreTrimWhitespace"))(this.triggerDiff,this)),this._register(o.onDidAddRepository(this.onDidAddRepository,this));for(let p of o.repositories)this.onDidAddRepository(p);this._register(this._model.onDidChangeEncoding(()=>{this._diffDelayer.cancel(),this._quickDiffs=[],this._originalEditorModels.clear(),this._quickDiffsPromise=void 0,this.setChanges([],[],new Map),this.triggerDiff()})),this._register(this.quickDiffService.onDidChangeQuickDiffProviders(()=>this.triggerDiff())),this._register(he(p=>{for(let h of this._chatEditingService.editingSessionsObs.read(p))p.store.add(he(g=>{for(let f of h.entries.read(g))f.state.read(g);this.triggerDiff()}))})),this.triggerDiff()}get originalTextModels(){return ht.map(this._originalEditorModels.values(),e=>e.textEditorModel)}get allChanges(){return this._allChanges}get changes(){return this._changes}get quickDiffChanges(){return this._quickDiffChanges}get quickDiffs(){return this._quickDiffs}getQuickDiffResults(){return this._quickDiffs.map(e=>{let t=this.allChanges.filter(o=>o.providerId===e.id);return{providerId:e.id,providerKind:e.kind,original:e.originalResource,modified:this._model.resource,changes:t.map(o=>o.change),changes2:t.map(o=>o.change2)}})}getDiffEditorModel(e){let t=this._originalEditorModels.get(e);return t?{modified:this._model.textEditorModel,original:t.textEditorModel}:void 0}onDidAddRepository(e){let t=new P;t.add(e.provider.onDidChangeResources(this.triggerDiff,this));let o=H.filter(this.scmService.onDidRemoveRepository,n=>n===e);t.add(o(()=>this._repositoryDisposables.deleteAndDispose(e))),this._repositoryDisposables.set(e,t),this.triggerDiff()}triggerDiff(){this._diffDelayer&&this._diffDelayer.trigger(async()=>{let e=await this.diff(),t=Array.from(this._originalEditorModels.values());!e||this._disposed||this._model.isDisposed()||t.some(o=>o.isDisposed())||this.setChanges(e.allChanges,e.changes,e.mapChanges)}).catch(e=>mt(e))}setChanges(e,t,o){let n=eGe(this.changes,t,(r,s)=>x_t(r.change,s.change));this._allChanges=e,this._changes=t,this._quickDiffChanges=o,this._onDidChange.fire({changes:t,diff:n})}diff(){return this.progressService.withProgress({location:3,delay:250},async()=>{let e=await this.getQuickDiffsPromise();if(this._disposed||this._model.isDisposed()||e.length===0)return Promise.resolve({allChanges:[],changes:[],mapChanges:new Map});let t=e.filter(h=>this.editorWorkerService.canComputeDirtyDiff(h.originalResource,this._model.resource));if(t.length===0)return Promise.resolve({allChanges:[],changes:[],mapChanges:new Map});let o=t.find(h=>h.kind==="primary"),n=this.configurationService.getValue("scm.diffDecorationsIgnoreTrimWhitespace"),r=n==="inherit"?this.configurationService.getValue("diffEditor.ignoreTrimWhitespace"):n!=="false",s=[],l=[];for(let h of t){let g=await this._diff(h.originalResource,this._model.resource,r);if(g.changes&&g.changes2&&g.changes.length===g.changes2.length)for(let f=0;f<g.changes.length;f++){let v=g.changes2[f];if(o&&h.kind==="secondary"){let b=s.find(S=>S.change2.modified.equals(v.modified)&&S.change2.original.length===v.original.length);if(b){let y=this._originalEditorModels.get(o.originalResource)?.textEditorModel?.getValueInRange(b.change2.toRangeMapping().originalRange),k=this._originalEditorModels.get(h.originalResource)?.textEditorModel?.getValueInRange(v.toRangeMapping().originalRange);if(y===k){l.push({providerId:h.id,original:h.originalResource,modified:this._model.resource,change:g.changes[f],change2:g.changes2[f]});continue}}}s.push({providerId:h.id,original:h.originalResource,modified:this._model.resource,change:g.changes[f],change2:g.changes2[f]})}}let c=s.sort((h,g)=>x_t(h.change,g.change)),u=[...s,...l].sort((h,g)=>x_t(h.change,g.change)),p=new Map;for(let h=0;h<c.length;h++){let g=c[h].providerId;p.has(g)||p.set(g,[]),p.get(g).push(h)}return{allChanges:u,changes:c,mapChanges:p}})}async _diff(e,t,o){let n=this.options.maxComputationTimeMs??Number.MAX_SAFE_INTEGER,r=await this.editorWorkerService.computeDiff(e,t,{computeMoves:!1,ignoreTrimWhitespace:o,maxComputationTimeMs:n},this.options.algorithm);return{changes:r?pii(Tae.fromDiffResult(r)):null,changes2:r?.changes??null}}getQuickDiffsPromise(){return this._quickDiffsPromise?this._quickDiffsPromise:(this._quickDiffsPromise=this.getOriginalResource().then(async e=>this._disposed?[]:e.length===0?(this._quickDiffs=[],this._originalEditorModels.clear(),[]):$i(this._quickDiffs,e,(t,o)=>t.id===o.id&&t.originalResource.toString()===o.originalResource.toString()&&this.quickDiffService.isQuickDiffProviderVisible(t.id)===this.quickDiffService.isQuickDiffProviderVisible(o.id))?e:(this._quickDiffs=e,this._originalEditorModels.clear(),this._originalEditorModelsDisposables.clear(),(await Promise.all(e.map(async t=>{try{let o=await this.textModelResolverService.createModelReference(t.originalResource);if(this._disposed)return o.dispose(),[];if(this._originalEditorModels.set(t.originalResource,o.object),gQe(o.object)&&!o.object.isDirty()){let n=this._model.getEncoding();n&&o.object.setEncoding(n,1)}return this._originalEditorModelsDisposables.add(o),this._originalEditorModelsDisposables.add(o.object.textEditorModel.onDidChangeContent(()=>this.triggerDiff())),t}catch{return[]}}))).flat())),this._quickDiffsPromise.finally(()=>{this._quickDiffsPromise=void 0}))}async getOriginalResource(){if(this._disposed)return Promise.resolve([]);let e=this._model.resource;if(this._chatEditingService.editingSessionsObs.get().some(n=>n.getEntry(e)?.state.get()===0))return Promise.resolve([]);let o=this._model.textEditorModel?hx(this._model.textEditorModel):void 0;return this.quickDiffService.getQuickDiffs(e,this._model.getLanguageId(),o)}findNextClosestChange(e,t=!0,o){let n=new Set(this.quickDiffs.filter(r=>this.quickDiffService.isQuickDiffProviderVisible(r.id)).map(r=>r.id));for(let r=0;r<this.changes.length;r++){if(o&&this.changes[r].providerId!==o||!n.has(this.changes[r].providerId))continue;let s=this.changes[r].change;if(t){if(xQe(s)>=e)return r}else if(s.modifiedStartLineNumber>e)return r}return 0}findPreviousClosestChange(e,t=!0,o){let n=new Set(this.quickDiffs.filter(r=>this.quickDiffService.isQuickDiffProviderVisible(r.id)).map(r=>r.id));for(let r=this.changes.length-1;r>=0;r--){if(o&&this.changes[r].providerId!==o||!n.has(this.changes[r].providerId))continue;let s=this.changes[r].change;if(t){if(s.modifiedStartLineNumber<=e)return r}else if(xQe(s)<e)return r}return this.changes.length-1}dispose(){this._disposed=!0,this._quickDiffs=[],this._diffDelayer.cancel(),this._originalEditorModels.clear(),this._repositoryDisposables.dispose(),super.dispose()}};_Qe=I([m(2,$c),m(3,OE),m(4,$s),m(5,B),m(6,Nt),m(7,dl),m(8,Bo)],_Qe);var XY=class{constructor(i,e,t,o,n,r,s,l){this._editorLocator=i;this._codeEditorService=t;this._editorService=o;this._editorGroupService=n;this._configurationService=r;this._quickDiffModelService=s;this._uriIdentityService=l;this._toDispose=new P;this._instanceId=String(++XY.INSTANCE_COUNT),this._proxy=e.getProxy(Zi.ExtHostEditors),this._textEditorsListenersMap=Object.create(null),this._editorPositionData=null,this._toDispose.add(this._editorService.onDidVisibleEditorsChange(()=>this._updateActiveAndVisibleTextEditors())),this._toDispose.add(this._editorGroupService.onDidRemoveGroup(()=>this._updateActiveAndVisibleTextEditors())),this._toDispose.add(this._editorGroupService.onDidMoveGroup(()=>this._updateActiveAndVisibleTextEditors())),this._registeredDecorationTypes=Object.create(null)}static{this.INSTANCE_COUNT=0}dispose(){Object.keys(this._textEditorsListenersMap).forEach(i=>{Ue(this._textEditorsListenersMap[i])}),this._textEditorsListenersMap=Object.create(null),this._toDispose.dispose();for(let i in this._registeredDecorationTypes)this._codeEditorService.removeDecorationType(i);this._registeredDecorationTypes=Object.create(null)}handleTextEditorAdded(i){let e=i.getId(),t=[];t.push(i.onPropertiesChanged(n=>{this._proxy.$acceptEditorPropertiesChanged(e,n)}));let o=this._getTextEditorDiffInformation(i,t);t.push(he(n=>{let r=o.read(n);this._proxy.$acceptEditorDiffInformation(e,r)})),this._textEditorsListenersMap[e]=t}handleTextEditorRemoved(i){Ue(this._textEditorsListenersMap[i]),delete this._textEditorsListenersMap[i]}_updateActiveAndVisibleTextEditors(){let i=this._getTextEditorPositionData();uo(this._editorPositionData,i)||(this._editorPositionData=i,this._proxy.$acceptEditorPositionData(this._editorPositionData))}_getTextEditorPositionData(){let i=Object.create(null);for(let e of this._editorService.visibleEditorPanes){let t=this._editorLocator.findTextEditorIdFor(e);t&&(i[t]=bC(this._editorGroupService,e.group))}return i}_getTextEditorDiffInformation(i,e){let t=i.getCodeEditor();if(!t)return Oo(void 0);let[o]=this._codeEditorService.listDiffEditors().filter(s=>s.getOriginalEditor().getId()===t.getId()||s.getModifiedEditor().getId()===t.getId()),n=o?ui(this,o.onDidChangeModel,()=>o.getModel()):ui(this,t.onDidChangeModel,()=>t.getModel()),r=Ce(s=>{let l=n.read(s);if(!l)return Oo(void 0);if(U6(l)){let p=this._quickDiffModelService.createQuickDiffModelReference(l.uri);return p?(e.push(p),ui(this,p.object.onDidChange,()=>p.object.getQuickDiffResults().map(h=>({original:h.original,modified:h.modified,changes:h.changes2})))):Oo(void 0)}let c=this._configurationService.getValue("diffEditor.diffAlgorithm"),u=this._quickDiffModelService.createQuickDiffModelReference(l.modified.uri,{algorithm:c});return u?(e.push(u),ui(H.any(u.object.onDidChange,o.onDidUpdateDiff),()=>{let p=o.getDiffComputationResult()?.changes2??[],h=[{original:l.original.uri,modified:l.modified.uri,changes:p.map(f=>f)}],g=u.object.getQuickDiffResults().filter(f=>f.providerKind!=="primary").map(f=>({original:f.original,modified:f.modified,changes:f.changes2}));return h.concat(g)})):Oo(void 0)});return hs({owner:this,equalsFn:(s,l)=>$i(s,l,(c,u)=>qKi(this._uriIdentityService,c,u))},s=>{let l=n.read(s),c=r.read(s).read(s);if(!l||!c)return;let u=U6(l)?l.getVersionId():l.modified.getVersionId();return c.map(p=>{let h=p.changes.map(g=>[g.original.startLineNumber,g.original.endLineNumberExclusive,g.modified.startLineNumber,g.modified.endLineNumberExclusive]);return{documentVersion:u,original:p.original,modified:p.modified,changes:h}})})}async $tryShowTextDocument(i,e){let t=A.revive(i),o={preserveFocus:e.preserveFocus,pinned:e.pinned,selection:e.selection,activation:e.preserveFocus?2:void 0,override:1},n={resource:t,options:o},r=await this._editorService.openEditor(n,W_(this._editorGroupService,this._configurationService,e.position));if(!r)return;let s=r.getControl(),l=ca(s);return l?this._editorLocator.getIdOfCodeEditor(l):void 0}async $tryShowEditor(i,e){let t=this._editorLocator.getEditor(i);if(t){let o=t.getModel();await this._editorService.openEditor({resource:o.uri,options:{preserveFocus:!1}},W_(this._editorGroupService,this._configurationService,e));return}}async $tryHideEditor(i){let e=this._editorLocator.getEditor(i);if(e){let t=this._editorService.visibleEditorPanes;for(let o of t)if(e.matches(o)){await o.group.closeEditor(o.input);return}}}$trySetSelections(i,e){let t=this._editorLocator.getEditor(i);return t?(t.setSelections(e),Promise.resolve(void 0)):Promise.reject(Br(`TextEditor(${i})`))}$trySetDecorations(i,e,t){e=`${this._instanceId}-${e}`;let o=this._editorLocator.getEditor(i);return o?(o.setDecorations(e,t),Promise.resolve(void 0)):Promise.reject(Br(`TextEditor(${i})`))}$trySetDecorationsFast(i,e,t){e=`${this._instanceId}-${e}`;let o=this._editorLocator.getEditor(i);return o?(o.setDecorationsFast(e,t),Promise.resolve(void 0)):Promise.reject(Br(`TextEditor(${i})`))}$tryRevealRange(i,e,t){let o=this._editorLocator.getEditor(i);return o?(o.revealRange(e,t),Promise.resolve()):Promise.reject(Br(`TextEditor(${i})`))}$trySetOptions(i,e){let t=this._editorLocator.getEditor(i);return t?(t.setConfiguration(e),Promise.resolve(void 0)):Promise.reject(Br(`TextEditor(${i})`))}$tryApplyEdits(i,e,t,o){let n=this._editorLocator.getEditor(i);return n?Promise.resolve(n.applyEdits(e,t,o)):Promise.reject(Br(`TextEditor(${i})`))}$tryInsertSnippet(i,e,t,o,n){let r=this._editorLocator.getEditor(i);return r?Promise.resolve(r.insertSnippet(e,t,o,n)):Promise.reject(Br(`TextEditor(${i})`))}$registerTextEditorDecorationType(i,e,t){e=`${this._instanceId}-${e}`,this._registeredDecorationTypes[e]=!0,this._codeEditorService.registerDecorationType(`exthost-api-${i}`,e,t)}$removeTextEditorDecorationType(i){i=`${this._instanceId}-${i}`,delete this._registeredDecorationTypes[i],this._codeEditorService.removeDecorationType(i)}$getDiffInformation(i){let e=this._editorLocator.getEditor(i);if(!e)return Promise.reject(new Error("No such TextEditor"));let t=e.getCodeEditor();if(!t)return Promise.reject(new Error("No such CodeEditor"));let o=t.getId(),n=this._codeEditorService.listDiffEditors(),[r]=n.filter(l=>l.getOriginalEditor().getId()===o||l.getModifiedEditor().getId()===o);if(r)return Promise.resolve(r.getLineChanges()||[]);if(!t.hasModel())return Promise.resolve([]);let s=this._quickDiffModelService.createQuickDiffModelReference(t.getModel().uri);if(!s)return Promise.resolve([]);try{let l=s.object.quickDiffs.find(u=>u.kind==="primary"),c=s.object.changes.filter(u=>u.providerId===l?.id);return Promise.resolve(c.map(u=>u.change)??[])}finally{s.dispose()}}};XY=I([m(2,Kt),m(3,ee),m(4,Et),m(5,B),m(6,HO),m(7,dt)],XY);qe.registerCommand("_workbench.revertAllDirty",async function(a){if(!a.get(Co).extensionTestsLocationURI)throw new Error("Command is only available when running extension tests.");let e=a.get(Wa);for(let t of e.dirtyWorkingCopies)await t.revert({soft:!0})});var ys=class a{constructor(i,e,t){this.ctor=i;this.typeId=e;this.name=t}static{this.instantiatedEditorPanes=new Set}static didInstantiateEditorPane(i){return a.instantiatedEditorPanes.has(i)}static{this._onWillInstantiateEditorPane=new E}static{this.onWillInstantiateEditorPane=a._onWillInstantiateEditorPane.event}static create(i,e,t){return new a(i,e,t)}instantiate(i,e){a._onWillInstantiateEditorPane.fire({typeId:this.typeId});let t=i.createInstance(this.ctor,e);return a.instantiatedEditorPanes.add(this.typeId),t}describes(i){return i.getId()===this.typeId}},aui=class{constructor(){this.mapEditorPanesToEditors=new Map}registerEditorPane(i,e){return this.mapEditorPanesToEditors.set(i,e),Z(()=>{this.mapEditorPanesToEditors.delete(i)})}getEditorPane(i){let e=this.findEditorPaneDescriptors(i);if(e.length!==0)return e.length===1?e[0]:i.prefersEditorPane(e)}findEditorPaneDescriptors(i,e){let t=[];for(let o of this.mapEditorPanesToEditors.keys()){let n=this.mapEditorPanesToEditors.get(o)||[];for(let r of n){let s=r.ctor;if(!e&&i.constructor===s){t.push(o);break}else if(e&&i instanceof s){t.push(o);break}}}return!e&&t.length===0?this.findEditorPaneDescriptors(i,!0):t}getEditorPaneByType(i){return ht.find(this.mapEditorPanesToEditors.keys(),e=>e.typeId===i)}getEditorPanes(){return Array.from(this.mapEditorPanesToEditors.keys())}getEditors(){let i=[];for(let e of this.mapEditorPanesToEditors.keys()){let t=this.mapEditorPanesToEditors.get(e);t&&i.push(...t.map(o=>o.ctor))}return i}};oe.add(rn.EditorPane,new aui);function CXi(a,i){let e=a.get(ee),t=a.get(dt),o=a.get(Wa);return new Promise(n=>{let r=[...i],s=e.onDidCloseEditor(async l=>{if(l.context===2)return;let c=no.getOriginalUri(l.editor,{supportSideBySide:1}),u=no.getOriginalUri(l.editor,{supportSideBySide:2});if(l.context===1){let p=no.getOriginalUri(e.activeEditor,{supportSideBySide:1}),h=no.getOriginalUri(e.activeEditor,{supportSideBySide:2});t.extUri.isEqual(c,p)&&(c=void 0),t.extUri.isEqual(u,h)&&(u=void 0)}if(r=r.filter(p=>!(t.extUri.isEqual(p,c)||t.extUri.isEqual(p,u)||l.context!==1&&(c?.scheme===Y.untitled&&t.extUri.isEqual(p,c.with({scheme:p.scheme}))||u?.scheme===Y.untitled&&t.extUri.isEqual(p,u.with({scheme:p.scheme}))))),r.length===0){let p=i.filter(h=>o.isDirty(h));return p.length>0&&await fn.settled(p.map(async h=>await new Promise(g=>{if(!o.isDirty(h))return g();let f=o.onDidChangeDirty(v=>{if(!v.isDirty()&&t.extUri.isEqual(h,v.resource))return f.dispose(),g()})}))),s.dispose(),n()}})})}function JY(a,i,e,t){let o=a.getAriaLabel();return e&&!e.isPinned(a)&&(o=d(3495,null,o)),e?.isSticky(i??a)&&(o=d(3494,null,o)),e&&typeof t=="number"&&t>1&&(o=`${o}, ${e.ariaLabel}`),o}var Xj=class extends Jd{constructor(e,t,o){super(t);this.id=e;this.memento=new Bl(this.id,o),this._register(o.onWillSaveState(()=>{this.saveState(),this.memento.saveMemento()}))}getId(){return this.id}getMemento(e,t){return this.memento.getMemento(e,t)}reloadMemento(e){this.memento.reloadMemento(e)}onDidChangeMementoValue(e,t){return this.memento.onDidChangeValue(e,t)}saveState(){}};var Wke=class extends Xj{constructor(e,t,o,n){super(e,o,n);this.telemetryService=t;this._onTitleAreaUpdate=this._register(new E);this.onTitleAreaUpdate=this._onTitleAreaUpdate.event;this._hasFocus=!1;this.visible=!1}get onDidFocus(){return this._onDidFocus||(this._onDidFocus=this.registerFocusTrackEvents().onDidFocus),this._onDidFocus.event}get onDidBlur(){return this._onDidBlur||(this._onDidBlur=this.registerFocusTrackEvents().onDidBlur),this._onDidBlur.event}hasFocus(){return this._hasFocus}registerFocusTrackEvents(){let e=Oi(this.getContainer()),t=this._register(Vn(e)),o=this._onDidFocus=this._register(new E);this._register(t.onDidFocus(()=>{this._hasFocus=!0,o.fire()}));let n=this._onDidBlur=this._register(new E);return this._register(t.onDidBlur(()=>{this._hasFocus=!1,n.fire()})),{onDidFocus:o,onDidBlur:n}}getTitle(){}create(e){this.parent=e}getContainer(){return this.parent}setVisible(e){this.visible!==!!e&&(this.visible=e)}focus(){}getMenuIds(){return[]}getActions(){return[]}getSecondaryActions(){return[]}getContextMenuActions(){return[]}getActionViewItem(e,t){}getActionsContext(){return null}getActionRunner(){return this.actionRunner||(this.actionRunner=this._register(new as)),this.actionRunner}updateTitleArea(){this._onTitleAreaUpdate.fire()}isVisible(){return this.visible}getControl(){}},D_t=class{constructor(i,e,t,o,n,r){this.ctor=i;this.id=e;this.name=t;this.cssClass=o;this.order=n;this.requestedIndex=r}instantiate(i){return i.createInstance(this.ctor)}},L_t=class extends C{constructor(){super(...arguments);this._onDidRegister=this._register(new E);this.onDidRegister=this._onDidRegister.event;this._onDidDeregister=this._register(new E);this.onDidDeregister=this._onDidDeregister.event;this.composites=[]}registerComposite(e){this.compositeById(e.id)||(this.composites.push(e),this._onDidRegister.fire(e))}deregisterComposite(e){let t=this.compositeById(e);t&&(this.composites.splice(this.composites.indexOf(t),1),this._onDidDeregister.fire(t))}getComposite(e){return this.compositeById(e)}getComposites(){return this.composites.slice(0)}compositeById(e){return this.composites.find(t=>t.id===e)}};var Kce=class{constructor(i){this.defaultValue=i}verify(i){return this.isType(i)?i:this.defaultValue}},Qp=class extends Kce{isType(i){return typeof i=="boolean"}},Vke=class extends Kce{isType(i){return typeof i=="number"}},R_t=class extends Kce{isType(i){return i instanceof Set}},SC=class extends Kce{constructor(i,e){super(i),this.allowedValues=e}isType(i){return this.allowedValues.includes(i)}},DQe=class extends Kce{constructor(e,t){super(e);this.verifier=t}verify(e){return this.isType(e)?cui(this.verifier,e):this.defaultValue}isType(e){return yi(e)}};function cui(a,i){let e=Object.create(null);for(let t in a)if(Object.hasOwnProperty.call(a,t)){let o=a[t];e[t]=o.verify(i[t])}return e}var FE=new ai(220,70),Jj=new ai(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),Ja={showTabs:"multiple",highlightModifiedTabs:!1,tabActionLocation:"right",tabActionCloseVisibility:!0,tabActionUnpinVisibility:!0,showTabIndex:!1,alwaysShowEditorActions:!1,tabSizing:"fit",tabSizingFixedMinWidth:50,tabSizingFixedMaxWidth:160,pinnedTabSizing:"normal",pinnedTabsOnSeparateRow:!1,tabHeight:"default",preventPinnedEditorClose:"keyboardAndMouse",titleScrollbarSizing:"default",titleScrollbarVisibility:"auto",focusRecentEditorAfterClose:!0,showIcons:!0,hasIcons:!0,enablePreview:!0,openPositioning:"right",openSideBySideDirection:"right",closeEmptyGroups:!0,labelFormat:"default",splitSizing:"auto",splitOnDragAndDrop:!0,allowDropIntoGroup:!0,dragToOpenWindow:!0,centeredLayoutFixedWidth:!1,doubleClickTabToToggleEditorGroupSizes:"expand",editorActionsLocation:"default",wrapTabs:!1,enablePreviewFromQuickOpen:!1,scrollToSwitchTabs:!1,enablePreviewFromCodeNavigation:!1,closeOnFileDelete:!1,swipeToNavigate:!1,mouseBackForwardToNavigate:!0,restoreViewState:!0,splitInGroupLayout:"horizontal",revealIfOpen:!1,get limit(){return{enabled:!1,value:10,perEditorGroup:!1,excludeDirty:!1}},get decorations(){return{badges:!0,colors:!0}},get autoLockGroups(){return new Set}};function xXi(a){return a.affectsConfiguration("workbench.editor")||a.affectsConfiguration("workbench.iconTheme")||a.affectsConfiguration("window.density")}function dui(a,i){let e={...Ja,hasIcons:i.getFileIconTheme().hasFileIcons},t=a.getValue();if(t?.workbench?.editor)if(Object.assign(e,t.workbench.editor),yi(t.workbench.editor.autoLockGroups)){e.autoLockGroups=Ja.autoLockGroups;for(let[n,r]of Object.entries(t.workbench.editor.autoLockGroups))r===!0&&e.autoLockGroups.add(n)}else e.autoLockGroups=Ja.autoLockGroups;let o=a.getValue();return o?.window?.density?.editorTabHeight&&(e.tabHeight=o.window.density.editorTabHeight),O1o(e)}function O1o(a){return typeof a.showTabs=="boolean"&&(a.showTabs=a.showTabs?"multiple":"single"),cui({wrapTabs:new Qp(Ja.wrapTabs),scrollToSwitchTabs:new Qp(Ja.scrollToSwitchTabs),highlightModifiedTabs:new Qp(Ja.highlightModifiedTabs),tabActionCloseVisibility:new Qp(Ja.tabActionCloseVisibility),tabActionUnpinVisibility:new Qp(Ja.tabActionUnpinVisibility),showTabIndex:new Qp(Ja.showTabIndex),alwaysShowEditorActions:new Qp(Ja.alwaysShowEditorActions),pinnedTabsOnSeparateRow:new Qp(Ja.pinnedTabsOnSeparateRow),focusRecentEditorAfterClose:new Qp(Ja.focusRecentEditorAfterClose),showIcons:new Qp(Ja.showIcons),enablePreview:new Qp(Ja.enablePreview),enablePreviewFromQuickOpen:new Qp(Ja.enablePreviewFromQuickOpen),enablePreviewFromCodeNavigation:new Qp(Ja.enablePreviewFromCodeNavigation),closeOnFileDelete:new Qp(Ja.closeOnFileDelete),closeEmptyGroups:new Qp(Ja.closeEmptyGroups),revealIfOpen:new Qp(Ja.revealIfOpen),swipeToNavigate:new Qp(Ja.swipeToNavigate),mouseBackForwardToNavigate:new Qp(Ja.mouseBackForwardToNavigate),restoreViewState:new Qp(Ja.restoreViewState),splitOnDragAndDrop:new Qp(Ja.splitOnDragAndDrop),allowDropIntoGroup:new Qp(Ja.allowDropIntoGroup),dragToOpenWindow:new Qp(Ja.dragToOpenWindow),centeredLayoutFixedWidth:new Qp(Ja.centeredLayoutFixedWidth),hasIcons:new Qp(Ja.hasIcons),tabSizingFixedMinWidth:new Vke(Ja.tabSizingFixedMinWidth),tabSizingFixedMaxWidth:new Vke(Ja.tabSizingFixedMaxWidth),showTabs:new SC(Ja.showTabs,["multiple","single","none"]),tabActionLocation:new SC(Ja.tabActionLocation,["left","right"]),tabSizing:new SC(Ja.tabSizing,["fit","shrink","fixed"]),pinnedTabSizing:new SC(Ja.pinnedTabSizing,["normal","compact","shrink"]),tabHeight:new SC(Ja.tabHeight,["default","compact"]),preventPinnedEditorClose:new SC(Ja.preventPinnedEditorClose,["keyboardAndMouse","keyboard","mouse","never"]),titleScrollbarSizing:new SC(Ja.titleScrollbarSizing,["default","large"]),titleScrollbarVisibility:new SC(Ja.titleScrollbarVisibility,["auto","visible","hidden"]),openPositioning:new SC(Ja.openPositioning,["left","right","first","last"]),openSideBySideDirection:new SC(Ja.openSideBySideDirection,["right","down"]),labelFormat:new SC(Ja.labelFormat,["default","short","medium","long"]),splitInGroupLayout:new SC(Ja.splitInGroupLayout,["vertical","horizontal"]),splitSizing:new SC(Ja.splitSizing,["distribute","split","auto"]),doubleClickTabToToggleEditorGroupSizes:new SC(Ja.doubleClickTabToToggleEditorGroupSizes,["maximize","expand","off"]),editorActionsLocation:new SC(Ja.editorActionsLocation,["default","titleBar","hidden"]),autoLockGroups:new R_t(Ja.autoLockGroups),limit:new DQe(Ja.limit,{enabled:new Qp(Ja.limit.enabled),value:new Vke(Ja.limit.value),perEditorGroup:new Qp(Ja.limit.perEditorGroup),excludeDirty:new Qp(Ja.limit.excludeDirty)}),decorations:new DQe(Ja.decorations,{badges:new Qp(Ja.decorations.badges),colors:new Qp(Ja.decorations.colors)})},a)}function uui(a,i,e){return!i||!a.activeEditor||i.matches(a.activeEditor)?{...e,viewState:a.activeEditorPane?.getViewState()}:e||Object.create(null)}function ZY(a,i,e){if(i.length===0)return[];let t=[],o,n=[];for(let s of i)!o&&a.isActive(s)?o=s:n.push(s);o||(o=n.shift()),n.sort((s,l)=>a.getIndexOfEditor(l)-a.getIndexOfEditor(s));let r=si([o,...n]);for(let s=0;s<r.length;s++){let l=r[s];t.push({editor:l,options:{pinned:!0,sticky:a.isSticky(l),inactive:s>0,preserveFocus:e}})}return t}var pa=class a extends Wke{constructor(e,t,o,n,r){super(e,o,n,r);this.group=t;this.onDidChangeSizeConstraints=H.None;this._onDidChangeControl=this._register(new E);this.onDidChangeControl=this._onDidChangeControl.event}static{this.EDITOR_MEMENTOS=new Map}get minimumWidth(){return FE.width}get maximumWidth(){return Jj.width}get minimumHeight(){return FE.height}get maximumHeight(){return Jj.height}get input(){return this._input}get options(){return this._options}get window(){return qv(this.group.windowId,!0).window}get scopedContextKeyService(){}create(e){super.create(e),this.createEditor(e)}async setInput(e,t,o,n){this._input=e,this._options=t}clearInput(){this._input=void 0,this._options=void 0}setOptions(e){this._options=e}setVisible(e){super.setVisible(e),this.setEditorVisible(e)}setEditorVisible(e){}setBoundarySashes(e){}getEditorMemento(e,t,o,n=10){let r=`${this.getId()}${o}`,s=a.EDITOR_MEMENTOS.get(r);return s||(s=this._register(new pui(this.getId(),o,this.getMemento(1,1),n,e,t)),a.EDITOR_MEMENTOS.set(r,s)),s}getViewState(){}saveState(){for(let[,e]of a.EDITOR_MEMENTOS)e.id===this.getId()&&e.saveState();super.saveState()}dispose(){this._input=void 0,this._options=void 0,super.dispose()}},pui=class a extends C{constructor(e,t,o,n,r,s){super();this.id=e;this.key=t;this.memento=o;this.limit=n;this.editorGroupService=r;this.configurationService=s;this.cleanedUp=!1;this.shareEditorState=!1;this.updateConfiguration(void 0),this.registerListeners()}static{this.SHARED_EDITOR_STATE=-1}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>this.updateConfiguration(e)))}updateConfiguration(e){(!e||e.affectsConfiguration(void 0,"workbench.editor.sharedViewState"))&&(this.shareEditorState=this.configurationService.getValue(void 0,"workbench.editor.sharedViewState")===!0)}saveEditorState(e,t,o){let n=this.doGetResource(t);if(!n||!e)return;let r=this.doLoad(),s=r.get(n.toString());s||(s=Object.create(null),r.set(n.toString(),s)),s[e.id]=o,this.shareEditorState&&(s[a.SHARED_EDITOR_STATE]=o),Ta(t)&&this.clearEditorStateOnDispose(n,t)}loadEditorState(e,t){let o=this.doGetResource(t);if(!o||!e)return;let r=this.doLoad().get(o.toString());if(r){let s=r[e.id];if(s)return s;if(this.shareEditorState)return r[a.SHARED_EDITOR_STATE]}}clearEditorState(e,t){Ta(e)&&this.editorDisposables?.delete(e);let o=this.doGetResource(e);if(o){let n=this.doLoad();if(t){let r=n.get(o.toString());r&&(delete r[t.id],mf(r)&&n.delete(o.toString()))}else n.delete(o.toString())}}clearEditorStateOnDispose(e,t){this.editorDisposables||(this.editorDisposables=new Map),this.editorDisposables.has(t)||this.editorDisposables.set(t,H.once(t.onWillDispose)(()=>{this.clearEditorState(e),this.editorDisposables?.delete(t)}))}moveEditorState(e,t,o){let n=this.doLoad(),r=[...n.keys()];for(let s of r){let l=A.parse(s);if(!o.isEqualOrParent(l,e))continue;let c;if(Xe(e,l))c=t;else{let p=Dbe(l.path,e.path);c=je(t,l.path.substr(p+e.path.length+1))}let u=n.get(s,0);u&&(n.delete(s),n.set(c.toString(),u))}}doGetResource(e){return Ta(e)?e.resource:e}doLoad(){if(!this.cache){this.cache=new il(this.limit);let e=this.memento[this.key];Array.isArray(e)&&this.cache.fromJSON(e)}return this.cache}saveState(){let e=this.doLoad();this.cleanedUp||(this.cleanUp(),this.cleanedUp=!0),this.memento[this.key]=e.toJSON()}cleanUp(){let e=this.doLoad(),t=[...e.entries()];for(let[o,n]of t)for(let r of Object.keys(n)){let s=Number(r);s===a.SHARED_EDITOR_STATE&&this.shareEditorState||this.editorGroupService.getGroup(s)||(delete n[s],mf(n)&&e.delete(o))}}};var zO=class extends pa{constructor(e,t,o,n,r,s,l,c,u,p){super(e,t,n,c,s);this.instantiationService=r;this.textResourceConfigurationService=l;this.editorService=u;this.editorGroupService=p;this.groupListener=this._register(new me);this.viewState=this.getEditorMemento(p,l,o,100)}setEditorVisible(e){this.groupListener.value=this.group.onWillCloseEditor(t=>this.onWillCloseEditor(t)),super.setEditorVisible(e)}onWillCloseEditor(e){let t=e.editor;t===this.input&&this.updateEditorViewState(t)}clearInput(){this.updateEditorViewState(this.input),super.clearInput()}saveState(){this.updateEditorViewState(this.input),super.saveState()}updateEditorViewState(e){if(!e||!this.tracksEditorViewState(e))return;let t=this.toEditorViewStateResource(e);t&&(this.tracksDisposedEditorViewState()||(this.editorViewStateDisposables||(this.editorViewStateDisposables=this._register(new jt)),this.editorViewStateDisposables.has(e)||this.editorViewStateDisposables.set(e,H.once(e.onWillDispose)(()=>{this.clearEditorViewState(t,this.group),this.editorViewStateDisposables?.deleteAndDispose(e)}))),e.isDisposed()&&!this.tracksDisposedEditorViewState()||!this.shouldRestoreEditorViewState(e)&&!this.group.contains(e)?(this.clearEditorViewState(t,this.group),this.editorViewStateDisposables?.deleteAndDispose(e)):e.isDisposed()||this.saveEditorViewState(t))}shouldRestoreEditorViewState(e,t){return t?.newInGroup?this.textResourceConfigurationService.getValue(no.getOriginalUri(e,{supportSideBySide:1}),"workbench.editor.restoreViewState")!==!1:!0}getViewState(){let e=this.input;if(!e||!this.tracksEditorViewState(e))return;let t=this.toEditorViewStateResource(e);if(t)return this.computeEditorViewState(t)}saveEditorViewState(e){let t=this.computeEditorViewState(e);t&&this.viewState.saveEditorState(this.group,e,t)}loadEditorViewState(e,t){if(!e||!this.tracksEditorViewState(e)||!this.shouldRestoreEditorViewState(e,t))return;let o=this.toEditorViewStateResource(e);if(o)return this.viewState.loadEditorState(this.group,o)}moveEditorViewState(e,t,o){return this.viewState.moveEditorState(e,t,o)}clearEditorViewState(e,t){this.viewState.clearEditorState(e,t)}tracksDisposedEditorViewState(){return!1}};zO=I([m(3,Te),m(4,F),m(5,le),m(6,Nn),m(7,De),m(8,ee),m(9,Et)],zO);var aR=class extends zO{constructor(e,t,o,n,r,s,l,c,u,p){super(e,t,aR.VIEW_STATE_PREFERENCE_KEY,o,n,r,s,l,c,u);this.fileService=p;this._onDidChangeSelection=this._register(new E);this.onDidChangeSelection=this._onDidChangeSelection.event;this._onDidChangeScroll=this._register(new E);this.onDidChangeScroll=this._onDidChangeScroll.event;this.inputListener=this._register(new me);this._register(this.textResourceConfigurationService.onDidChangeConfiguration(h=>this.handleConfigurationChangeEvent(h))),this._register(H.any(this.editorGroupService.onDidAddGroup,this.editorGroupService.onDidRemoveGroup)(()=>{let h=this.computeAriaLabel();this.editorContainer?.setAttribute("aria-label",h),this.updateEditorControlOptions({ariaLabel:h})})),this._register(this.fileService.onDidChangeFileSystemProviderCapabilities(h=>this.onDidChangeFileSystemProvider(h.scheme))),this._register(this.fileService.onDidChangeFileSystemProviderRegistrations(h=>this.onDidChangeFileSystemProvider(h.scheme)))}static{this.VIEW_STATE_PREFERENCE_KEY="textEditorViewState"}handleConfigurationChangeEvent(e){let t=this.getActiveResource();this.shouldHandleConfigurationChangeEvent(e,t)&&(this.isVisible()?this.updateEditorConfiguration(t):this.hasPendingConfigurationChange=!0)}shouldHandleConfigurationChangeEvent(e,t){return e.affectsConfiguration(t,"editor")||e.affectsConfiguration(t,"problems.visibility")}consumePendingConfigurationChangeEvent(){this.hasPendingConfigurationChange&&(this.updateEditorConfiguration(),this.hasPendingConfigurationChange=!1)}computeConfiguration(e){let t=yi(e.editor)?Xi(e.editor):Object.create(null);return Object.assign(t,this.getConfigurationOverrides(e)),t.ariaLabel=this.computeAriaLabel(),t}computeAriaLabel(){return this.input?JY(this.input,void 0,this.group,this.editorGroupService.count):d(4049,null)}onDidChangeFileSystemProvider(e){this.input&&this.getActiveResource()?.scheme===e&&this.updateReadonly(this.input)}onDidChangeInputCapabilities(e){this.input===e&&this.updateReadonly(e)}updateReadonly(e){this.updateEditorControlOptions({...this.getReadonlyConfiguration(e.isReadonly())})}getReadonlyConfiguration(e){return{readOnly:!!e,readOnlyMessage:typeof e!="boolean"?e:void 0}}getConfigurationOverrides(e){return{overviewRulerLanes:3,lineNumbersMinChars:3,fixedOverflowWidgets:!0,...this.getReadonlyConfiguration(this.input?.isReadonly()),renderValidationDecorations:e.problems?.visibility!==!1?"on":"off"}}createEditor(e){this.editorContainer=e,this.createEditorControl(e,this.computeConfiguration(this.textResourceConfigurationService.getValue(this.getActiveResource()))),this.registerCodeEditorListeners()}registerCodeEditorListeners(){let e=this.getMainControl();e&&(this._register(e.onDidChangeModelLanguage(()=>this.updateEditorConfiguration())),this._register(e.onDidChangeModel(()=>this.updateEditorConfiguration())),this._register(e.onDidChangeCursorPosition(t=>this._onDidChangeSelection.fire({reason:this.toEditorPaneSelectionChangeReason(t)}))),this._register(e.onDidChangeModelContent(()=>this._onDidChangeSelection.fire({reason:3}))),this._register(e.onDidScrollChange(()=>this._onDidChangeScroll.fire())))}toEditorPaneSelectionChangeReason(e){switch(e.source){case"api":return 1;case"code.navigation":return 4;case"code.jump":return 5;default:return 2}}getSelection(){let e=this.getMainControl();if(e){let t=e.getSelection();if(t)return new mui(t)}}async setInput(e,t,o,n){await super.setInput(e,t,o,n),this.inputListener.value=e.onDidChangeCapabilities(()=>this.onDidChangeInputCapabilities(e)),this.updateEditorConfiguration(),Oi(this.editorContainer).setAttribute("aria-label",this.computeAriaLabel())}clearInput(){this.inputListener.clear(),super.clearInput()}getScrollPosition(){let e=this.getMainControl();if(!e)throw new Error("Control has not yet been initialized");return{scrollTop:e.getScrollTop()-e.getTopForLineNumber(1),scrollLeft:e.getScrollLeft()}}setScrollPosition(e){let t=this.getMainControl();if(!t)throw new Error("Control has not yet been initialized");t.setScrollTop(e.scrollTop),e.scrollLeft&&t.setScrollLeft(e.scrollLeft)}setEditorVisible(e){e&&this.consumePendingConfigurationChangeEvent(),super.setEditorVisible(e)}toEditorViewStateResource(e){return e.resource}updateEditorConfiguration(e=this.getActiveResource()){let t;if(e&&(t=this.textResourceConfigurationService.getValue(e)),!t)return;let o=this.computeConfiguration(t),n=o;this.lastAppliedEditorOptions&&(n=$Ge(this.lastAppliedEditorOptions,n)),Object.keys(n).length>0&&(this.lastAppliedEditorOptions=o,this.updateEditorControlOptions(n))}getActiveResource(){let e=this.getMainControl();if(e){let t=e.getModel();if(t)return t.uri}if(this.input)return this.input.resource}dispose(){this.lastAppliedEditorOptions=void 0,super.dispose()}};aR=I([m(2,Te),m(3,F),m(4,le),m(5,Nn),m(6,De),m(7,ee),m(8,Et),m(9,be)],aR);var mui=class a{constructor(i){this.textSelection=i}static{this.TEXT_EDITOR_SELECTION_THRESHOLD=10}compare(i){if(!(i instanceof a))return 3;let e=Math.min(this.textSelection.selectionStartLineNumber,this.textSelection.positionLineNumber),t=Math.min(i.textSelection.selectionStartLineNumber,i.textSelection.positionLineNumber);return e===t?1:Math.abs(e-t)<a.TEXT_EDITOR_SELECTION_THRESHOLD?2:3}restore(i){return{...i,selection:this.textSelection,selectionRevealType:1}}log(){return`line: ${this.textSelection.startLineNumber}-${this.textSelection.endLineNumber}, col: ${this.textSelection.startColumn}-${this.textSelection.endColumn}`}};var ds=ae("paneCompositePartService");var RQe="views",MQe=d(4796,null),Bke=Re("default-view-icon",M.window,d(4793,null)),on;(e=>(e.ViewContainersRegistry="workbench.registry.view.containers",e.ViewsRegistry="workbench.registry.view"))(on||={});function WE(a){switch(a){case 0:return"sidebar";case 1:return"panel";case 2:return"auxiliarybar";case 3:return"chatbar"}}var hui=class extends C{constructor(){super(...arguments);this._onDidRegister=this._register(new E);this.onDidRegister=this._onDidRegister.event;this._onDidDeregister=this._register(new E);this.onDidDeregister=this._onDidDeregister.event;this.viewContainers=new Map;this.defaultViewContainers=[]}get all(){return[...this.viewContainers.values()].flat()}registerViewContainer(e,t,o){let n=this.get(e.id);if(n)return n;let r=e;return r.openCommandActionDescriptor=o?.doNotRegisterOpenCommand?void 0:r.openCommandActionDescriptor??{id:r.id},$H(this.viewContainers,t,[]).push(r),o?.isDefault&&this.defaultViewContainers.push(r),this._onDidRegister.fire({viewContainer:r,viewContainerLocation:t}),r}deregisterViewContainer(e){for(let t of this.viewContainers.keys()){let o=this.viewContainers.get(t),n=o?.indexOf(e);if(n!==-1){o?.splice(n,1),o.length===0&&this.viewContainers.delete(t),this._onDidDeregister.fire({viewContainer:e,viewContainerLocation:t});return}}}get(e){return this.all.filter(t=>t.id===e)[0]}getViewContainers(e){return[...this.viewContainers.get(e)||[]]}getViewContainerLocation(e){return[...this.viewContainers.keys()].filter(t=>this.getViewContainers(t).filter(o=>o?.id===e.id).length>0)[0]}getDefaultViewContainers(e){return this.defaultViewContainers.filter(t=>this.getViewContainerLocation(t)===e)}};oe.add(on.ViewContainersRegistry,new hui);function F1o(a,i){let e=a.group??"9_more",t=i.group??"9_more";return e!==t?e.localeCompare(t):(a.order??5)-(i.order??5)}var gui=class extends C{constructor(){super(...arguments);this._onViewsRegistered=this._register(new E);this.onViewsRegistered=this._onViewsRegistered.event;this._onViewsDeregistered=this._register(new E);this.onViewsDeregistered=this._onViewsDeregistered.event;this._onDidChangeContainer=this._register(new E);this.onDidChangeContainer=this._onDidChangeContainer.event;this._onDidChangeViewWelcomeContent=this._register(new E);this.onDidChangeViewWelcomeContent=this._onDidChangeViewWelcomeContent.event;this._viewContainers=[];this._views=new Map;this._viewWelcomeContents=new KH}registerViews(e,t){this.registerViews2([{views:e,viewContainer:t}])}registerViews2(e){e.forEach(({views:t,viewContainer:o})=>this.addViews(t,o)),this._onViewsRegistered.fire(e)}deregisterViews(e,t){let o=this.removeViews(e,t);o.length&&this._onViewsDeregistered.fire({views:o,viewContainer:t})}moveViews(e,t){for(let o of this._views.keys())if(o!==t){let n=this.removeViews(e,o);n.length&&(this.addViews(n,t),this._onDidChangeContainer.fire({views:n,from:o,to:t}))}}getViews(e){return this._views.get(e)||[]}getView(e){for(let t of this._viewContainers){let o=(this._views.get(t)||[]).filter(n=>n.id===e)[0];if(o)return o}return null}getViewContainer(e){for(let t of this._viewContainers)if((this._views.get(t)||[]).filter(n=>n.id===e)[0])return t;return null}registerViewWelcomeContent(e,t){return this._viewWelcomeContents.add(e,t),this._onDidChangeViewWelcomeContent.fire(e),Z(()=>{this._viewWelcomeContents.delete(e,t),this._onDidChangeViewWelcomeContent.fire(e)})}registerViewWelcomeContent2(e,t){let o=new Map;for(let[n,r]of t)this._viewWelcomeContents.add(e,r),o.set(n,Z(()=>{this._viewWelcomeContents.delete(e,r),this._onDidChangeViewWelcomeContent.fire(e)}));return this._onDidChangeViewWelcomeContent.fire(e),o}getViewWelcomeContent(e){let t=[];return this._viewWelcomeContents.forEach(e,o=>t.push(o)),t.sort(F1o)}addViews(e,t){let o=this._views.get(t);o||(o=[],this._views.set(t,o),this._viewContainers.push(t));for(let n of e){if(this.getView(n.id)!==null)throw new Error(d(4794,null,n.id));o.push(n)}}removeViews(e,t){let o=this._views.get(t);if(!o)return[];let n=[],r=[];for(let s of o)e.includes(s)?n.push(s):r.push(s);return n.length&&(r.length?this._views.set(t,r):(this._views.delete(t),this._viewContainers.splice(this._viewContainers.indexOf(t),1))),n}};oe.add(on.ViewsRegistry,new gui);var Ri=ae("viewDescriptorService");var Zj=class{constructor(i,e){this.resolved=!1;this._hasResolve=!1;Nu(this,i),this._hasResolve=!!e,this.resolve=async t=>{if(e&&!this.resolved){let o=await e(t);o&&(this.tooltip=this.tooltip??o.tooltip,this.command=this.command??o.command)}t.isCancellationRequested||(this.resolved=!0)}}get hasResolve(){return this._hasResolve}resetResolve(){this.resolved=!1}asTreeItem(){return{handle:this.handle,parentHandle:this.parentHandle,collapsibleState:this.collapsibleState,label:this.label,description:this.description,icon:this.icon,iconDark:this.iconDark,themeIcon:this.themeIcon,resourceUri:this.resourceUri,tooltip:this.tooltip,contextValue:this.contextValue,command:this.command,children:this.children,accessibilityInformation:this.accessibilityInformation}}},A_t=class extends Error{constructor(e){super(d(4795,null,e));this.name="NoTreeViewError"}static is(e){return!!e&&e.name==="NoTreeViewError"}};var fui=class{constructor(i){this.editor=i;this.id=`${i.getId()},${i.getModel().id}`}},NQe=class{constructor(i,e,t,o,n,r){this.removedDocuments=i;this.addedDocuments=e;this.removedEditors=t;this.addedEditors=o;this.oldActiveEditor=n;this.newActiveEditor=r;this.isEmpty=this.removedDocuments.length===0&&this.addedDocuments.length===0&&this.removedEditors.length===0&&this.addedEditors.length===0&&n===r}toString(){let i=`DocumentAndEditorStateDelta
`;return i+=` Removed Documents: [${this.removedDocuments.map(e=>e.uri.toString(!0)).join(", ")}]
`,i+=` Added Documents: [${this.addedDocuments.map(e=>e.uri.toString(!0)).join(", ")}]
`,i+=` Removed Editors: [${this.removedEditors.map(e=>e.id).join(", ")}]
`,i+=` Added Editors: [${this.addedEditors.map(e=>e.id).join(", ")}]
`,i+=` New Active Editor: ${this.newActiveEditor}
`,i}},AQe=class{constructor(i,e,t){this.documents=i;this.textEditors=e;this.activeEditor=t}static compute(i,e){if(!i)return new NQe([],[...e.documents.values()],[],[...e.textEditors.values()],void 0,e.activeEditor);let t=HH(i.documents,e.documents),o=X2e(i.textEditors,e.textEditors),n=i.activeEditor!==e.activeEditor?i.activeEditor:void 0,r=i.activeEditor!==e.activeEditor?e.activeEditor:void 0;return new NQe(t.removed,t.added,o.removed,o.added,n,r)}};var PQe=class{constructor(i,e,t,o,n){this._onDidChangeState=i;this._modelService=e;this._codeEditorService=t;this._editorService=o;this._paneCompositeService=n;this._toDispose=new P;this._toDisposeOnEditorRemove=new jt;this._activeEditorOrder=0;this._modelService.onModelAdded(this._updateStateOnModelAdd,this,this._toDispose),this._modelService.onModelRemoved(r=>this._updateState(),this,this._toDispose),this._editorService.onDidActiveEditorChange(r=>this._updateState(),this,this._toDispose),this._codeEditorService.onCodeEditorAdd(this._onDidAddEditor,this,this._toDispose),this._codeEditorService.onCodeEditorRemove(this._onDidRemoveEditor,this,this._toDispose),this._codeEditorService.listCodeEditors().forEach(this._onDidAddEditor,this),H.filter(this._paneCompositeService.onDidPaneCompositeOpen,r=>r.viewContainerLocation===1)(r=>this._activeEditorOrder=1,void 0,this._toDispose),H.filter(this._paneCompositeService.onDidPaneCompositeClose,r=>r.viewContainerLocation===1)(r=>this._activeEditorOrder=0,void 0,this._toDispose),this._editorService.onDidVisibleEditorsChange(r=>this._activeEditorOrder=0,void 0,this._toDispose),this._updateState()}dispose(){this._toDispose.dispose(),this._toDisposeOnEditorRemove.dispose()}_onDidAddEditor(i){this._toDisposeOnEditorRemove.set(i.getId(),hn(i.onDidChangeModel(()=>this._updateState()),i.onDidFocusEditorText(()=>this._updateState()),i.onDidFocusEditorWidget(()=>this._updateState(i)))),this._updateState()}_onDidRemoveEditor(i){let e=i.getId();this._toDisposeOnEditorRemove.has(e)&&(this._toDisposeOnEditorRemove.deleteAndDispose(e),this._updateState())}_updateStateOnModelAdd(i){if(hx(i)){if(!this._currentState){this._updateState();return}this._currentState=new AQe(this._currentState.documents.add(i),this._currentState.textEditors,this._currentState.activeEditor),this._onDidChangeState(new NQe([],[i],[],[],void 0,void 0))}}_updateState(i){let e=new Set;for(let s of this._modelService.getModels())hx(s)&&e.add(s);let t=new Map,o=null;for(let s of this._codeEditorService.listCodeEditors()){if(s.isSimpleWidget)continue;let l=s.getModel();if(s.hasModel()&&l&&hx(l)&&!l.isDisposed()&&this._modelService.getModel(l.uri)){let c=new fui(s);t.set(c.id,c),(s.hasTextFocus()||i===s&&s.hasWidgetFocus())&&(o=c.id)}}if(!o){let s;if(this._activeEditorOrder===0?s=this._getActiveEditorFromEditorPart()||this._getActiveEditorFromPanel():s=this._getActiveEditorFromPanel()||this._getActiveEditorFromEditorPart(),s)for(let l of t.values())s===l.editor&&(o=l.id)}let n=new AQe(e,t,o),r=AQe.compute(this._currentState,n);r.isEmpty||(this._currentState=n,this._onDidChangeState(r))}_getActiveEditorFromPanel(){let i=this._paneCompositeService.getActivePaneComposite(1);if(i instanceof aR){let e=i.getControl();if(pn(e))return e}}_getActiveEditorFromEditorPart(){let i=this._editorService.activeTextEditorControl;return Ec(i)&&(i=i.getModifiedEditor()),i}};PQe=I([m(1,Ct),m(2,Kt),m(3,ee),m(4,ds)],PQe);var N_t=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){this._modelService=e;this._textFileService=t;this._editorService=o;this._editorGroupService=l;this._clipboardService=g;this._toDispose=new P;this._textEditors=new Map;this._proxy=i.getProxy(Zi.ExtHostDocumentsAndEditors),this._mainThreadDocuments=this._toDispose.add(new Mke(i,this._modelService,this._textFileService,r,s,u,h,p,f)),i.set(Gi.MainThreadDocuments,this._mainThreadDocuments),this._mainThreadEditors=this._toDispose.add(new XY(this,i,n,this._editorService,this._editorGroupService,v,b,h)),i.set(Gi.MainThreadTextEditors,this._mainThreadEditors),this._toDispose.add(new PQe(S=>this._onDelta(S),e,n,this._editorService,c))}dispose(){this._toDispose.dispose()}_onDelta(i){let e=[],t=[],o=i.removedDocuments.map(s=>s.uri);for(let s of i.addedEditors){let l=new C_t(s.id,s.editor.getModel(),s.editor,{onGainedFocus(){},onLostFocus(){}},this._mainThreadDocuments,this._modelService,this._clipboardService);this._textEditors.set(s.id,l),t.push(l)}for(let{id:s}of i.removedEditors){let l=this._textEditors.get(s);l&&(l.dispose(),this._textEditors.delete(s),e.push(s))}let n=Object.create(null),r=!0;i.newActiveEditor!==void 0&&(r=!1,n.newActiveEditor=i.newActiveEditor),o.length>0&&(r=!1,n.removedDocuments=o),e.length>0&&(r=!1,n.removedEditors=e),i.addedDocuments.length>0&&(r=!1,n.addedDocuments=i.addedDocuments.map(s=>this._toModelAddData(s))),i.addedEditors.length>0&&(r=!1,n.addedEditors=t.map(s=>this._toTextEditorAddData(s))),r||(this._proxy.$acceptDocumentsAndEditorsDelta(n),o.forEach(this._mainThreadDocuments.handleModelRemoved,this._mainThreadDocuments),i.addedDocuments.forEach(this._mainThreadDocuments.handleModelAdded,this._mainThreadDocuments),e.forEach(this._mainThreadEditors.handleTextEditorRemoved,this._mainThreadEditors),t.forEach(this._mainThreadEditors.handleTextEditorAdded,this._mainThreadEditors))}_toModelAddData(i){return{uri:i.uri,versionId:i.getVersionId(),lines:i.getLinesContent(),EOL:i.getEOL(),languageId:i.getLanguageId(),isDirty:this._textFileService.isDirty(i.uri),encoding:this._textFileService.getEncoding(i.uri)}}_toTextEditorAddData(i){let e=i.getProperties();return{id:i.getId(),documentUri:i.getModel().uri,options:e.options,selections:e.selections,visibleRanges:e.visibleRanges,editorPosition:this._findEditorPosition(i)}}_findEditorPosition(i){for(let e of this._editorService.visibleEditorPanes)if(i.matches(e))return bC(this._editorGroupService,e.group)}findTextEditorIdFor(i){for(let[e,t]of this._textEditors)if(t.matches(i))return e}getIdOfCodeEditor(i){for(let[e,t]of this._textEditors)if(t.getCodeEditor()===i)return e}getEditor(i){return this._textEditors.get(i)}};N_t=I([QL,m(1,Ct),m(2,Ho),m(3,ee),m(4,Kt),m(5,be),m(6,Nt),m(7,Et),m(8,ds),m(9,Vt),m(10,kp),m(11,dt),m(12,Wi),m(13,wn),m(14,B),m(15,HO)],N_t);var vui={LEFT:"left",RIGHT:"right",FIRST:"first",LAST:"last"};function OQe(a){let i=a;return!!(i&&typeof i=="object"&&Array.isArray(i.editors)&&Array.isArray(i.mru))}function kXi(a){let i=a;return i.kind===5&&i.editorIndex!==void 0}function EXi(a){let i=a;return i.kind===7&&i.editorIndex!==void 0&&i.oldEditorIndex!==void 0}function TXi(a){let i=a;return i.kind===6&&i.editorIndex!==void 0&&i.context!==void 0&&i.sticky!==void 0}var yP=class extends C{constructor(e,t,o){super();this.instantiationService=t;this.configurationService=o;this._onDidModelChange=this._register(new E({leakWarningThreshold:500}));this.onDidModelChange=this._onDidModelChange.event;this.editors=[];this.mru=[];this.editorListeners=new Set;this.locked=!1;this.selection=[];this.preview=null;this.sticky=-1;this.transient=new Set;OQe(e)?this._id=this.deserialize(e):this._id=yP.IDS++,this.onConfigurationUpdated(),this.registerListeners()}static{this.IDS=0}get id(){return this._id}get active(){return this.selection[0]??null}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>this.onConfigurationUpdated(e)))}onConfigurationUpdated(e){e&&!e.affectsConfiguration("workbench.editor.openPositioning")&&!e.affectsConfiguration("workbench.editor.focusRecentEditorAfterClose")||(this.editorOpenPositioning=this.configurationService.getValue("workbench.editor.openPositioning"),this.focusRecentEditorAfterClose=this.configurationService.getValue("workbench.editor.focusRecentEditorAfterClose"))}get count(){return this.editors.length}get stickyCount(){return this.sticky+1}getEditors(e,t){let o=e===0?this.mru.slice(0):this.editors.slice(0);return t?.excludeSticky?e===0?o.filter(n=>!this.isSticky(n)):o.slice(this.sticky+1):o}getEditorByIndex(e){return this.editors[e]}get activeEditor(){return this.active}isActive(e){return this.matches(this.active,e)}get previewEditor(){return this.preview}openEditor(e,t){let o=t?.sticky||typeof t?.index=="number"&&this.isSticky(t.index),n=t?.pinned||t?.sticky,r=!!t?.transient,s=t?.active||!this.activeEditor||!n&&this.preview===this.activeEditor,l=this.findEditor(e,t);if(l){let[c,u]=l;return this.doSetTransient(c,u,r===!1?!1:this.isTransient(c)),n&&this.doPin(c,u),this.setSelection(s?c:this.activeEditor,t?.inactiveSelection??[]),t&&typeof t.index=="number"&&this.moveEditor(c,t.index),o&&this.doStick(c,this.indexOf(c)),{editor:c,isNew:!1}}else{let c=e,u=this.indexOf(this.active),p;if(t&&typeof t.index=="number"?p=t.index:this.editorOpenPositioning===vui.FIRST?(p=0,!o&&this.isSticky(p)&&(p=this.sticky+1)):this.editorOpenPositioning===vui.LAST?p=this.editors.length:(this.editorOpenPositioning===vui.LEFT?u===0||!this.editors.length?p=0:p=u:p=u+1,!o&&this.isSticky(p)&&(p=this.sticky+1)),o&&(this.sticky++,this.isSticky(p)||(p=this.sticky)),(n||!this.preview)&&this.splice(p,!1,c),r&&this.doSetTransient(c,p,!0),!n){if(this.preview){let g=this.indexOf(this.preview);p>g&&p--,this.replaceEditor(this.preview,c,p,!s)}this.preview=c}this.registerEditorListeners(c);let h={kind:5,editor:c,editorIndex:p};return this._onDidModelChange.fire(h),this.setSelection(s?c:this.activeEditor,t?.inactiveSelection??[]),{editor:c,isNew:!0}}}registerEditorListeners(e){let t=new P;this.editorListeners.add(t),t.add(H.once(e.onWillDispose)(()=>{let o=this.editors.indexOf(e);if(o>=0){let n={kind:15,editor:e,editorIndex:o};this._onDidModelChange.fire(n)}})),t.add(e.onDidChangeDirty(()=>{let o={kind:14,editor:e,editorIndex:this.editors.indexOf(e)};this._onDidModelChange.fire(o)})),t.add(e.onDidChangeLabel(()=>{let o={kind:9,editor:e,editorIndex:this.editors.indexOf(e)};this._onDidModelChange.fire(o)})),t.add(e.onDidChangeCapabilities(()=>{let o={kind:10,editor:e,editorIndex:this.editors.indexOf(e)};this._onDidModelChange.fire(o)})),t.add(this.onDidModelChange(o=>{o.kind===6&&o.editor?.matches(e)&&(Ue(t),this.editorListeners.delete(t))}))}replaceEditor(e,t,o,n=!0){let r=this.doCloseEditor(e,1,n);if(this.splice(o,!1,t),r){let s={kind:6,...r};this._onDidModelChange.fire(s)}}closeEditor(e,t=0,o=!0){let n=this.doCloseEditor(e,t,o);if(n){let r={kind:6,...n};return this._onDidModelChange.fire(r),n}}doCloseEditor(e,t,o){let n=this.indexOf(e);if(n===-1)return;let r=this.editors[n],s=this.isSticky(n),l=this.active===r;if(o&&l)if(this.mru.length>1){let c;this.focusRecentEditorAfterClose?c=this.mru[1]:n===this.editors.length-1?c=this.editors[n-1]:c=this.editors[n+1];let u=this.selection.filter(p=>p!==r&&p!==c);this.doSetSelection(c,this.editors.indexOf(c),u)}else this.doSetSelection(null,void 0,[]);else if(!l&&this.doIsSelected(r)){let c=this.selection.filter(u=>u!==r&&u!==this.activeEditor);this.doSetSelection(this.activeEditor,this.indexOf(this.activeEditor),c)}return this.preview===r&&(this.preview=null),this.transient.delete(r),this.splice(n,!0),{editor:r,sticky:s,editorIndex:n,context:t}}moveEditor(e,t){t>=this.editors.length?t=this.editors.length-1:t<0&&(t=0);let o=this.indexOf(e);if(o<0||t===o)return;let n=this.editors[o],r=this.sticky;this.isSticky(o)&&t>this.sticky?this.sticky--:!this.isSticky(o)&&t<=this.sticky&&this.sticky++,this.editors.splice(o,1),this.editors.splice(t,0,n);let s={kind:7,editor:n,oldEditorIndex:o,editorIndex:t};if(this._onDidModelChange.fire(s),r!==this.sticky){let l={kind:13,editor:n,editorIndex:t};this._onDidModelChange.fire(l)}return n}setActive(e){let t;return e?t=this.setEditorActive(e):this.setGroupActive(),t}setGroupActive(){this._onDidModelChange.fire({kind:0})}setEditorActive(e){let t=this.findEditor(e);if(!t)return;let[o,n]=t;return this.doSetSelection(o,n,[]),o}get selectedEditors(){return this.editors.filter(e=>this.doIsSelected(e))}isSelected(e){let t;return typeof e=="number"?t=this.editors[e]:t=this.findEditor(e)?.[0],!!t&&this.doIsSelected(t)}doIsSelected(e){return this.selection.includes(e)}setSelection(e,t){let o=this.findEditor(e);if(!o)return;let[n,r]=o,s=new Set;for(let l of t){let c=this.findEditor(l);if(!c)return;let[u]=c;u!==n&&s.add(u)}this.doSetSelection(n,r,Array.from(s))}doSetSelection(e,t,o){let n=this.activeEditor,r=this.selection,s;e?s=[e,...o]:s=[],this.selection=s;let l=e&&typeof t=="number"&&n!==e;if(l){let c=this.indexOf(e,this.mru);this.mru.splice(c,1),this.mru.unshift(e);let u={kind:8,editor:e,editorIndex:t};this._onDidModelChange.fire(u)}if(l||r.length!==s.length||r.some(c=>!s.includes(c))){let c={kind:4};this._onDidModelChange.fire(c)}}setIndex(e){this._onDidModelChange.fire({kind:1})}setLabel(e){this._onDidModelChange.fire({kind:2})}pin(e){let t=this.findEditor(e);if(!t)return;let[o,n]=t;return this.doPin(o,n),o}doPin(e,t){if(this.isPinned(e))return;this.setTransient(e,!1),this.preview=null;let o={kind:11,editor:e,editorIndex:t};this._onDidModelChange.fire(o)}unpin(e){let t=this.findEditor(e);if(!t)return;let[o,n]=t;return this.doUnpin(o,n),o}doUnpin(e,t){if(!this.isPinned(e))return;let o=this.preview;this.preview=e;let n={kind:11,editor:e,editorIndex:t};this._onDidModelChange.fire(n),o&&this.closeEditor(o,3)}isPinned(e){let t;return typeof e=="number"?t=this.editors[e]:t=e,!this.matches(this.preview,t)}stick(e){let t=this.findEditor(e);if(!t)return;let[o,n]=t;return this.doStick(o,n),o}doStick(e,t){if(this.isSticky(t))return;this.pin(e);let o=this.sticky+1;this.moveEditor(e,o),this.sticky++;let n={kind:13,editor:e,editorIndex:o};this._onDidModelChange.fire(n)}unstick(e){let t=this.findEditor(e);if(!t)return;let[o,n]=t;return this.doUnstick(o,n),o}doUnstick(e,t){if(!this.isSticky(t))return;let o=this.sticky;this.moveEditor(e,o),this.sticky--;let n={kind:13,editor:e,editorIndex:o};this._onDidModelChange.fire(n)}isSticky(e){if(this.sticky<0)return!1;let t;return typeof e=="number"?t=e:t=this.indexOf(e),t<0?!1:t<=this.sticky}setTransient(e,t){if(!t&&this.transient.size===0)return;let o=this.findEditor(e);if(!o)return;let[n,r]=o;return this.doSetTransient(n,r,t),n}doSetTransient(e,t,o){if(o){if(this.transient.has(e))return;this.transient.add(e)}else{if(!this.transient.has(e))return;this.transient.delete(e)}let n={kind:12,editor:e,editorIndex:t};this._onDidModelChange.fire(n)}isTransient(e){if(this.transient.size===0)return!1;let t;return typeof e=="number"?t=this.editors[e]:t=this.findEditor(e)?.[0],!!t&&this.transient.has(t)}splice(e,t,o){let n=this.editors[e];if(t&&this.isSticky(e)&&this.sticky--,o?this.editors.splice(e,t?1:0,o):this.editors.splice(e,t?1:0),!t&&o)this.mru.length===0?this.mru.push(o):this.mru.splice(1,0,o);else{let r=this.indexOf(n,this.mru);t&&!o?this.mru.splice(r,1):t&&o&&this.mru.splice(r,1,o)}}indexOf(e,t=this.editors,o){let n=-1;if(!e)return n;for(let r=0;r<t.length;r++){let s=t[r];if(this.matches(s,e,o))if(o?.supportSideBySide&&s instanceof ga&&!(e instanceof ga))n=r;else{n=r;break}}return n}findEditor(e,t){let o=this.indexOf(e,this.editors,t);if(o!==-1)return[this.editors[o],o]}isFirst(e,t=this.editors){return this.matches(t[0],e)}isLast(e,t=this.editors){return this.matches(t[t.length-1],e)}contains(e,t){return this.indexOf(e,this.editors,t)!==-1}matches(e,t,o){if(!e||!t)return!1;if(o?.supportSideBySide&&e instanceof ga&&!(t instanceof ga))switch(o.supportSideBySide){case 4:if(this.matches(e.primary,t,o)||this.matches(e.secondary,t,o))return!0;break;case 3:if(this.matches(e.primary,t,o)&&this.matches(e.secondary,t,o))return!0;break}let n=e===t;return o?.strictEquals?n:n||e.matches(t)}get isLocked(){return this.locked}lock(e){this.isLocked!==e&&(this.locked=e,this._onDidModelChange.fire({kind:3}))}clone(){let e=this.instantiationService.createInstance(yP,void 0);e.editors=this.editors.slice(0),e.mru=this.mru.slice(0),e.preview=this.preview,e.selection=this.selection.slice(0),e.sticky=this.sticky;for(let t of e.editors)e.registerEditorListeners(t);return e}serialize(){let e=oe.as(rn.EditorFactory),t=[],o=[],n,r=this.sticky;for(let l=0;l<this.editors.length;l++){let c=this.editors[l],u=!1,p=e.getEditorSerializer(c);if(p){let h=p.canSerialize(c)?p.serialize(c):void 0;typeof h=="string"?(u=!0,o.push({id:c.typeId,value:h}),t.push(c),this.preview===c&&(n=t.length-1)):u=!1}!u&&this.isSticky(l)&&r--}let s=this.mru.map(l=>this.indexOf(l,t)).filter(l=>l>=0);return{id:this.id,locked:this.locked?!0:void 0,editors:o,mru:s,preview:n,sticky:r>=0?r:void 0}}deserialize(e){let t=oe.as(rn.EditorFactory);return typeof e.id=="number"?(this._id=e.id,yP.IDS=Math.max(e.id+1,yP.IDS)):this._id=yP.IDS++,e.locked&&(this.locked=!0),this.editors=si(e.editors.map((o,n)=>{let r,s=t.getEditorSerializer(o.id);if(s){let l=s.deserialize(this.instantiationService,o.value);l instanceof Us&&(r=l,this.registerEditorListeners(r))}return!r&&typeof e.sticky=="number"&&n<=e.sticky&&e.sticky--,r})),this.mru=si(e.mru.map(o=>this.editors[o])),this.selection=this.mru.length>0?[this.mru[0]]:[],typeof e.preview=="number"&&(this.preview=this.editors[e.preview]),typeof e.sticky=="number"&&(this.sticky=e.sticky),this._id}dispose(){Ue(Array.from(this.editorListeners)),this.editorListeners.clear(),this.transient.clear(),super.dispose()}};yP=I([m(1,F),m(2,B)],yP);var t5=class extends rw{constructor(i,e,t,o,n){super(t,e,o,n,i)}dispose(){this.textEditorModelHandle&&this.modelService.destroyModel(this.textEditorModelHandle),super.dispose()}};t5=I([m(1,kt),m(2,Ct),m(3,eS),m(4,Bi)],t5);var ek=class extends IY{constructor(e,t,o,n,r,s,l,c,u){super(e,t,r,s,l,c,u);this.editorService=o;this.textFileService=n}save(e,t){return this.resource.scheme!==Y.untitled&&!this.fileService.hasProvider(this.resource)?this.saveAs(e,t):this.doSave(t,!1,e)}saveAs(e,t){return this.doSave(t,!0,e)}async doSave(e,t,o){let n;if(t?n=await this.textFileService.saveAs(this.resource,void 0,{...e,suggestedTarget:this.preferredResource}):n=await this.textFileService.save(this.resource,e),!!n)return{resource:n}}async revert(e,t){await this.textFileService.revert(this.resource,t)}};ek=I([m(2,ee),m(3,Ho),m(4,ot),m(5,be),m(6,lr),m(7,Nn),m(8,Sv)],ek);var IC=class extends ek{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(e,void 0,c,l,p,u,h,g,f);this.name=t;this.description=o;this.preferredLanguageId=n;this.preferredContents=r;this.textModelService=s;this.cachedModel=void 0;this.modelReference=void 0}static{this.ID="workbench.editors.resourceEditorInput"}get typeId(){return IC.ID}get editorId(){return Ys.id}getName(){return this.name||super.getName()}setName(e){this.name!==e&&(this.name=e,this._onDidChangeLabel.fire())}getDescription(){return this.description}setDescription(e){this.description!==e&&(this.description=e,this._onDidChangeLabel.fire())}setLanguageId(e,t){this.setPreferredLanguageId(e),this.cachedModel?.setLanguageId(e,t)}setPreferredLanguageId(e){this.preferredLanguageId=e}setPreferredContents(e){this.preferredContents=e}async resolve(){let e=this.preferredContents,t=this.preferredLanguageId;this.preferredContents=void 0,this.preferredLanguageId=void 0,this.modelReference||(this.modelReference=this.textModelService.createModelReference(this.resource));let o=await this.modelReference,n=o.object;if(!(n instanceof t5))throw o.dispose(),this.modelReference=void 0,new Error(`Unexpected model for TextResourceEditorInput: ${this.resource}`);return this.cachedModel=n,(typeof e=="string"||typeof t=="string")&&n.updateTextEditorModel(typeof e=="string"?lae(e):void 0,t),n}matches(e){return this===e?!0:e instanceof IC?Xe(e.resource,this.resource):QS(e)?super.matches(e):!1}dispose(){this.modelReference&&(this.modelReference.then(e=>e.dispose()),this.modelReference=void 0),this.cachedModel=void 0,super.dispose()}};IC=I([m(5,Nt),m(6,Ho),m(7,ee),m(8,be),m(9,ot),m(10,lr),m(11,Nn),m(12,Sv)],IC);var W1o=Re("chat-editor-label-icon",M.chatSparkle,d(7492,null)),Va=class extends Us{constructor(e,t,o,n,r,s){super();this.resource=e;this.options=t;this.chatService=o;this.dialogService=n;this.chatSessionsService=r;this.instantiationService=s;this.didTransferOutEditingSession=!1;this.modelRef=this._register(new me);this.closeHandler=this;if(e.scheme===Y.vscodeChatEditor){let l=Sui.parse(e);if(!l||typeof l!="number")throw new Error("Invalid chat URI")}else if(e.scheme===Y.vscodeLocalChatSession){if(!cs.parseLocalSessionId(e))throw new Error("Invalid local chat session URI");this._sessionResource=e}else this._sessionResource=e}static{this.TypeID="workbench.input.chatSession"}static{this.EditorID="workbench.editor.chatSession"}get sessionResource(){return this._sessionResource}get model(){return this.modelRef.value?.object}static getNewEditorUri(){return Sui.getNewEditorUri()}showConfirm(){return!!(this.model&&_Xi(this.model))}transferOutEditingSession(){return this.didTransferOutEditingSession=!0,this.model?.editingSession}async confirm(e){if(!this.model?.editingSession||this.didTransferOutEditingSession||this.getSessionType()!==qp)return 0;let t=d(7491,null),o=d(7488,null);return await FQe(this.model,this.dialogService,{titleOverride:t,messageOverride:o})?0:2}get editorId(){return Va.EditorID}get capabilities(){return super.capabilities|1024|128}copy(){return this.instantiationService.createInstance(Va,Va.getNewEditorUri(),{})}matches(e){return e instanceof Va?Xe(this.sessionResource,e.sessionResource):!1}get typeId(){return Va.TypeID}getName(){if(this.model?.title)return this.model.hasCustomTitle?this.model.title:oN(this.model.title,uYi);if(this._sessionResource){let e=this.chatService.getSession(this._sessionResource);if(e?.title)return e.title;let t=this.chatService.getSessionTitle(this._sessionResource);if(t&&t.trim())return t}return this.options.title?.preferred?this.options.title.preferred:this.options.title?.fallback??d(7493,null)}getTitle(e){let t=this.getName();if(e===2){let o=this.getSessionTypeDisplayName();if(o)return`${t} | ${o}`}return t}getSessionTypeDisplayName(){let e=this.getSessionType();return e===qp?void 0:this.chatSessionsService.getAllChatSessionContributions().find(n=>n.type===e)?.displayName}getIcon(){let e=this.resolveIcon();return e?(this.cachedIcon=e,e):W1o}resolveIcon(){let e=this.getSessionType();if(e!==qp){let t=this.chatSessionsService.getIconForSessionType(e);if(t)return t}}getSessionType(){return fg(this.resource)}async resolve(){let o=new URLSearchParams(this.resource.query).get("chatSessionType")??this.resource.authority;if(this._sessionResource?(this.modelRef.value=await this.chatService.acquireOrLoadSession(this._sessionResource,"panel",ve.None),!this.model&&cs.parseLocalSessionId(this._sessionResource)&&(this.modelRef.value=this.chatService.startNewLocalSession("panel",{canUseTools:!0}))):this.options.target?this.options.target.data&&(this.modelRef.value=this.chatService.loadSessionFromData(this.options.target.data)):this.modelRef.value=this.chatService.startNewLocalSession("panel",{canUseTools:!o}),!this.model||this.isDisposed())return null;this._sessionResource=this.model.sessionResource,this._register(this.model.onDidChange(r=>{this.cachedIcon=void 0,this._onDidChangeLabel.fire()}));let n=this.resolveIcon();return n&&(!this.cachedIcon||!this.iconsEqual(this.cachedIcon,n))&&(this.cachedIcon=n),this._onDidChangeLabel.fire(),this._register(new bui(this.model))}iconsEqual(e,t){return q.isThemeIcon(e)&&q.isThemeIcon(t)?e.id===t.id:e instanceof A&&t instanceof A?e.toString()===t.toString():!1}};Va=I([m(2,Si),m(3,ct),m(4,Ls),m(5,F)],Va);var bui=class extends C{constructor(e){super();this.model=e;this._isResolved=!1}async resolve(){this._isResolved=!0}isResolved(){return this._isResolved}isDisposed(){return this._store.isDisposed}},Sui;(t=>{let a=Y.vscodeChatEditor;function i(){let o=Math.floor(Math.random()*1e9);return A.from({scheme:a,path:`chat-${o}`})}t.getNewEditorUri=i;function e(o){if(o.scheme!==a)return;let r=o.path.match(/chat-(\d+)/)?.[1];if(typeof r!="string")return;let s=parseInt(r);if(!isNaN(s))return s}t.parse=e})(Sui||={});var O_t=class{canSerialize(i){return i instanceof Va&&!!i.sessionResource}serialize(i){if(!this.canSerialize(i))return;let e={options:i.options,sessionResource:i.sessionResource,resource:i.resource};return JSON.stringify(e)}deserialize(i,e){try{let t=Xn(JSON.parse(e));if(t.sessionResource){let n=A.revive(t.sessionResource);return i.createInstance(Va,n,t.options)}let o=A.revive(t.resource);return o.scheme===Y.vscodeChatEditor&&t.sessionId&&(o=cs.forSession(t.sessionId)),i.createInstance(Va,o,t.options)}catch{return}}};async function FQe(a,i,e){let t=_Xi(a,e);if(!t)return!0;let o=d(7489,null),n=d(7490,null),r=e?.messageOverride??o,s=e?.titleOverride??n,{result:l}=await i.prompt({title:s,message:r+" "+d(7487,null,t),type:"info",cancelButton:!0,buttons:[{label:d(7485,null),run:async()=>(await a.editingSession.accept(),!0)},{label:d(7486,null),run:async()=>(await a.editingSession.reject(),!0)}]});return!!l}function _Xi(a,i){return!a.editingSession||a.willKeepAlive&&!i?.isArchiveAction?0:a.editingSession.entries.get().filter(o=>o.state.get()===0).length}var W_t=Object.freeze({id:"application",order:100,title:d(4538,null),type:"object"}),Cm=Object.freeze({id:"workbench",order:7,title:d(4546,null),type:"object"}),WQe=Object.freeze({id:"security",scope:1,title:d(4544,null),type:"object",order:7}),V_t=Object.freeze({id:"problems",title:d(4540,null),type:"object",order:101}),yui=Object.freeze({id:"window",order:8,title:d(4545,null),type:"object"}),rp={ConfigurationMigration:"base.contributions.configuration.migration"},Iui=class{constructor(){this.migrations=[];this._onDidRegisterConfigurationMigrations=new E;this.onDidRegisterConfigurationMigration=this._onDidRegisterConfigurationMigrations.event}registerConfigurationMigrations(i){this.migrations.push(...i)}},F_t=new Iui;oe.add(rp.ConfigurationMigration,F_t);var $ce=class extends C{constructor(e,t){super();this.configurationService=e;this.workspaceService=t;this._register(this.workspaceService.onDidChangeWorkspaceFolders(async o=>{for(let n of o.added)await this.migrateConfigurationsForFolder(n,F_t.migrations)})),this.migrateConfigurations(F_t.migrations),this._register(F_t.onDidRegisterConfigurationMigration(o=>this.migrateConfigurations(o)))}static{this.ID="workbench.contrib.configurationMigration"}async migrateConfigurations(e){await this.migrateConfigurationsForFolder(void 0,e);for(let t of this.workspaceService.getWorkspace().folders)await this.migrateConfigurationsForFolder(t,e)}async migrateConfigurationsForFolder(e,t){await Promise.all([t.map(o=>this.migrateConfigurationsForFolderAndOverride(o,e?.uri))])}async migrateConfigurationsForFolderAndOverride(e,t){let o=this.configurationService.inspect(e.key,{resource:t}),n=this.workspaceService.getWorkbenchState()===3?[["user",2],["userLocal",3],["userRemote",4],["workspace",5],["workspaceFolder",6]]:[["user",2],["userLocal",3],["userRemote",4],["workspace",5]];for(let[r,s]of n){let l=o[r];if(!l)continue;let c=[];if(l.value!==void 0){let u=await this.runMigration(e,r,l.value,t,void 0);for(let p of u??[])c.push([p,[]])}for(let{identifiers:u,value:p}of l.overrides??[])if(p!==void 0){let h=await this.runMigration(e,r,p,t,u);for(let g of h??[])c.push([g,u])}c.length&&await Promise.allSettled(c.map(async([[u,p],h])=>this.configurationService.updateValue(u,p.value,{resource:t,overrideIdentifiers:h},s)))}}async runMigration(e,t,o,n,r){let s=c=>{let p=this.configurationService.inspect(c,{resource:n})[t];if(p)return r?p.overrides?.find(({identifiers:h})=>uo(h,r))?.value:p.value},l=await e.migrateFn(o,s);return Array.isArray(l)?l:[[e.key,l]]}};$ce=I([m(0,B),m(1,Pe)],$ce);var i5=class extends C{constructor(e){super();this.remoteAgentService=e;this._ready=new Go;this.ready=this._ready.p;this.create()}static{this.ID="workbench.contrib.dynamicWorkbenchSecurityConfiguration"}async create(){try{await this.doCreate()}finally{this._ready.complete()}}async doCreate(){if(!ri&&(await this.remoteAgentService.getEnvironment())?.os!==1)return;oe.as(ii.Configuration).registerConfiguration({...WQe,properties:{"security.allowedUNCHosts":{type:"array",items:{type:"string",pattern:"^[^\\\\]+$",patternErrorMessage:d(4542,null)},default:[],markdownDescription:d(4541,null),scope:3},"security.restrictUNCAccess":{type:"boolean",default:!0,markdownDescription:d(4543,null),scope:3}}})}};i5=I([m(0,yo)],i5);var wP="window.newWindowProfile",qce=class extends C{constructor(e,t){super();this.userDataProfilesService=e;this.configurationService=t;this.registerNewWindowProfileConfiguration(),this._register(this.userDataProfilesService.onDidChangeProfiles(o=>this.registerNewWindowProfileConfiguration())),this.setNewWindowProfile(),this.checkAndResetNewWindowProfileConfig(),this._register(t.onDidChangeConfiguration(o=>{o.source!==7&&o.affectsConfiguration(wP)&&this.setNewWindowProfile()})),this._register(this.userDataProfilesService.onDidChangeProfiles(()=>this.checkAndResetNewWindowProfileConfig()))}static{this.ID="workbench.contrib.dynamicWindowConfiguration"}registerNewWindowProfileConfiguration(){let e=oe.as(ii.Configuration),t={...yui,properties:{[wP]:{type:["string","null"],default:null,enum:[...this.userDataProfilesService.profiles.map(o=>o.name),null],enumItemLabels:[...this.userDataProfilesService.profiles.map(()=>""),d(4537,null)],description:d(4539,null),scope:1}}};this.configurationNode?e.updateConfigurations({add:[t],remove:[this.configurationNode]}):e.registerConfiguration(t),this.configurationNode=t}setNewWindowProfile(){let e=this.configurationService.getValue(wP);this.newWindowProfile=e?this.userDataProfilesService.profiles.find(t=>t.name===e):void 0}checkAndResetNewWindowProfileConfig(){let e=this.configurationService.getValue(wP);if(!e)return;let t=this.newWindowProfile?this.userDataProfilesService.profiles.find(o=>o.id===this.newWindowProfile.id):void 0;e!==t?.name&&this.configurationService.updateValue(wP,t?.name)}};qce=I([m(0,an),m(1,B)],qce);var ul=ae("editorResolverService"),wui="workbench.editorAssociations",V1o=oe.as(ii.Configuration),B1o={...Cm,properties:{"workbench.editorAssociations":{type:"object",markdownDescription:d(16803,null),additionalProperties:{type:"string"}}}};V1o.registerConfiguration(B1o);function lR(a){switch(a){case"exclusive":return 5;case"default":return 4;case"builtin":return 3;default:return 1}}function eX(a,i){if(new Set([Y.extension,Y.webviewPanel,Y.vscodeWorkspaceTrust,Y.vscodeSettings]).has(i.scheme))return!1;let o=typeof a=="string"&&a.indexOf(Lo.sep)>=0?`${i.scheme}:${i.path}`:Ye(i);return Cp(a,o,{ignoreCase:!0})}var tX=ae("customEditorService"),DXi=new Q("activeCustomEditorId","",{type:"string",description:d(8572,null)}),LXi=new Q("focusedCustomEditorIsEditable",!1);var VQe=class{constructor(i){this.id=i.id,this.displayName=i.displayName,this.providerDisplayName=i.providerDisplayName,this.priority=i.priority,this.selector=i.selector}matches(i){return this.selector.some(e=>e.filenamePattern&&eX(e.filenamePattern,i))}},Hke=class{constructor(i){this.allEditors=Uo(i,e=>e.id)}get length(){return this.allEditors.length}get defaultEditor(){return this.allEditors.find(i=>{switch(i.priority){case"default":case"builtin":return this.allEditors.every(e=>e===i||H1o(e,i));default:return!1}})}get bestAvailableEditor(){return Array.from(this.allEditors).sort((e,t)=>lR(e.priority)-lR(t.priority))[0]}};function H1o(a,i){return lR(a.priority)<lR(i.priority)}var iX=class extends C{constructor(i,e){super();let t=()=>{e()?.windowDidDragStart()},o=()=>{e()?.windowDidDragEnd()};this._register(j(i,re.DRAG_START,()=>{t()})),this._register(j(i,re.DRAG_END,o)),this._register(j(i,re.MOUSE_MOVE,n=>{n.buttons===0&&o()})),this._register(j(i,re.DRAG,n=>{n.shiftKey?o():t()})),this._register(j(i,re.DRAG_OVER,n=>{n.shiftKey?o():t()}))}};var wu=class extends Us{constructor(e,t,o){super();this._themeService=o;this._resourceId=_t();this._hasTransfered=!1;this.viewType=e.viewType,this.providerId=e.providedId,this._webviewTitle=e.name,this._iconPath=e.iconPath,this._webview=t,this._register(o.onDidColorThemeChange(()=>{this._onDidChangeLabel.fire()}))}static{this.typeId="workbench.editors.webviewInput"}get typeId(){return wu.typeId}get editorId(){return this.viewType}get capabilities(){return 138}get resource(){return A.from({scheme:Y.webviewPanel,path:`webview-panel/webview-${this.providerId}-${this._resourceId}`})}dispose(){this.isDisposed()||this._hasTransfered||this._webview?.dispose(),super.dispose()}getName(){return this._webviewTitle}getTitle(e){return this.getName()}getDescription(){}setWebviewTitle(e){this._webviewTitle=e,this.webview.setTitle(e),this._onDidChangeLabel.fire()}getWebviewTitle(){return this._webviewTitle}get webview(){return this._webview}get extension(){return this.webview.extension}getIcon(){if(this._iconPath)return q.isThemeIcon(this._iconPath)?this._iconPath:Ip(this._themeService.getColorTheme().type)?this._iconPath.dark:this._iconPath.light??this._iconPath.dark}get iconPath(){return this._iconPath}set iconPath(e){this._iconPath=e,this._onDidChangeLabel.fire()}matches(e){return super.matches(e)||e===this}get group(){return this._group}updateGroup(e){this._group=e}transfer(e){if(!this._hasTransfered)return this._hasTransfered=!0,e._webview=this._webview,e}claim(e,t,o){return this._webview.claim(e,t,o)}};wu=I([m(2,De)],wu);var oi=ae("hostService");var fi=nc;function fV(a){return a===2||a===3}function KO(a){switch(a){case 0:return"left";case 1:return"right";case 2:return"bottom";case 3:return"top";default:return"bottom"}}var z1o={[KO(0)]:0,[KO(1)]:1,[KO(2)]:2,[KO(3)]:3};function RXi(a){return z1o[a]}function Cui(a){switch(a){case 0:return"always";case 1:return"never";case 2:return"preserve";default:return"preserve"}}var KLa={[Cui(0)]:0,[Cui(1)]:1,[Cui(2)]:2};function kui(a,i,e){if(!rwe(a))return!1;let t=wS(i),o=eO(a);if(!Gt){let r=a.getValue("window.customTitleBarVisibility");if(r==="never"&&o||r==="windowed"&&t)return!1}if(!K1o(a))return!0;if(o&&Mae(a))return!1;if(it&&kr)return!t;if(kr&&!t||dGe()&&!t)return!0;switch(Cy(i)?"hidden":Hje(a)){case"classic":return!t||!!e;case"compact":case"hidden":return!1;case"toggle":return!!e;case"visible":return!0;default:return Gt?!1:!t||!!e}}function K1o(a){if(a.getValue("window.commandCenter"))return!1;let i=a.getValue("workbench.activityBar.location");if(i==="top"||i==="bottom")return!1;let e=a.getValue("workbench.editor.editorActionsLocation"),t=a.getValue("workbench.editor.showTabs");return!(e==="titleBar"||e==="default"&&t==="none"||a.getValue("workbench.layoutControl.enabled"))}var MXi=new Q("activeWebviewPanelId","",{type:"string",description:d(15889,null)}),cR=class extends pa{constructor(e,t,o,n,r,s,l,c,u){super(cR.ID,e,t,o,n);this._editorGroupsService=r;this._editorService=s;this._workbenchLayoutService=l;this._hostService=c;this._contextKeyService=u;this._visible=!1;this._isDisposed=!1;this._webviewVisibleDisposables=this._register(new P);this._onFocusWindowHandler=this._register(new me);this._onDidFocusWebview=this._register(new E);this._scopedContextKeyService=this._register(new me);let p=r.getPart(e);this._register(H.any(p.onDidScroll,p.onDidAddGroup,p.onDidRemoveGroup,p.onDidMoveGroup)(()=>{this.webview&&this._visible&&this.synchronizeWebviewContainerDimensions(this.webview)}))}static{this.ID="WebviewEditor"}get onDidFocus(){return this._onDidFocusWebview.event}get webview(){return this.input instanceof wu?this.input.webview:void 0}get scopedContextKeyService(){return this._scopedContextKeyService.value}createEditor(e){let t=document.createElement("div");this._element=t,this._element.id=`webview-editor-element-${_t()}`,e.appendChild(t),this._scopedContextKeyService.value=this._register(this._contextKeyService.createScoped(t))}dispose(){this._isDisposed=!0,this._element?.remove(),this._element=void 0,super.dispose()}layout(e){this._dimension=e,this.webview&&this._visible&&this.synchronizeWebviewContainerDimensions(this.webview,e)}focus(){super.focus(),!this._onFocusWindowHandler.value&&!Gt&&(this._onFocusWindowHandler.value=this._hostService.onDidChangeFocus(e=>{e&&this._editorService.activeEditorPane===this&&this._workbenchLayoutService.hasFocus("workbench.parts.editor")&&this.focus()})),this.webview?.focus()}setEditorVisible(e){this._visible=e,this.input instanceof wu&&this.webview&&(e?this.claimWebview(this.input):this.webview.release(this)),super.setEditorVisible(e)}clearInput(){this.webview&&(this.webview.release(this),this._webviewVisibleDisposables.clear()),super.clearInput()}async setInput(e,t,o,n){if(this.input&&e.matches(this.input))return;let r=e instanceof wu&&e.webview===this.webview;this.webview&&!r&&this.webview.release(this),await super.setInput(e,t,o,n),await e.resolve(),!(n.isCancellationRequested||this._isDisposed)&&e instanceof wu&&(e.updateGroup(this.group.id),r||this.claimWebview(e),this._dimension&&this.layout(this._dimension))}claimWebview(e){e.claim(this,this.window,this.scopedContextKeyService),this._element&&(this._element.setAttribute("aria-flowto",e.webview.container.id),vN(e.webview.container,this._element)),this._webviewVisibleDisposables.clear(),this._webviewVisibleDisposables.add(this._editorGroupsService.createEditorDropTarget(e.webview.container,{containsGroup:t=>this.group.id===t.id})),this._webviewVisibleDisposables.add(new iX(this.window,()=>this.webview)),this.synchronizeWebviewContainerDimensions(e.webview),this._webviewVisibleDisposables.add(this.trackFocus(e.webview))}synchronizeWebviewContainerDimensions(e,t){if(!this._element?.isConnected)return;let o=this._editorGroupsService.activeModalEditorPart?.modalElement,n;Ao(o)?n=o:n=this._workbenchLayoutService.getContainer(this.window,"workbench.parts.editor"),e.layoutWebviewOverElement(this._element.parentElement,t,n)}trackFocus(e){let t=new P,o=Vn(e.container);return t.add(o),t.add(o.onDidFocus(()=>this._onDidFocusWebview.fire())),t.add(e.onDidFocus(()=>this._onDidFocusWebview.fire())),t}};cR=I([m(1,Te),m(2,De),m(3,le),m(4,Et),m(5,ee),m(6,fi),m(7,oi),m(8,X)],cR);var V_=ae("webviewEditorService");function B_t(a,i){return a.canResolve(i)}var o5=class extends wu{constructor(e,t,o,n){super(e,t,o);this._webviewWorkbenchService=n;this._resolved=!1}dispose(){super.dispose(),this._resolvePromise?.cancel(),this._resolvePromise=void 0}async resolve(){if(!this._resolved){this._resolved=!0,this._resolvePromise=xn(e=>this._webviewWorkbenchService.resolveWebview(this,e));try{await this._resolvePromise}catch(e){if(!so(e))throw e}}return super.resolve()}transfer(e){if(super.transfer(e))return e._resolved=this._resolved,e}};I([mi],o5.prototype,"resolve",1),o5=I([m(2,De),m(3,V_)],o5);var Eui=class{constructor(){this._awaitingRevival=[]}enqueueForRestoration(i,e){let t=new Go,o=()=>{let r=this._awaitingRevival.findIndex(s=>i===s.input);r>=0&&this._awaitingRevival.splice(r,1)},n=hn(i.webview.onDidDispose(o),e.onCancellationRequested(()=>{o(),t.cancel()}));return this._awaitingRevival.push({input:i,promise:t,disposable:n}),t.p}reviveFor(i,e){let t=this._awaitingRevival.filter(({input:o})=>B_t(i,o));this._awaitingRevival=this._awaitingRevival.filter(({input:o})=>!B_t(i,o));for(let{input:o,promise:n,disposable:r}of t)i.resolveWebview(o,e).then(s=>n.complete(s),s=>n.error(s)).finally(()=>{r.dispose()})}},Uke=class extends C{constructor(e,t,o,n){super();this._editorService=t;this._instantiationService=o;this._webviewService=n;this._revivers=new Set;this._revivalPool=new Eui;this._onDidChangeActiveWebviewEditor=this._register(new E);this.onDidChangeActiveWebviewEditor=this._onDidChangeActiveWebviewEditor.event;this._register(e.registerContextKeyProvider({contextKey:MXi,getGroupContextKeyValue:r=>this.getWebviewId(r.activeEditor)})),this._register(t.onDidActiveEditorChange(()=>{this.updateActiveWebview()})),this._register(n.onDidChangeActiveWebview(()=>{this.updateActiveWebview()})),this.updateActiveWebview()}getWebviewId(e){let t;return e instanceof wu?t=e:e instanceof Fa&&(e.primary instanceof wu?t=e.primary:e.secondary instanceof wu&&(t=e.secondary)),t?.webview.providedViewType??""}updateActiveWebview(){let e=this._editorService.activeEditor,t;e instanceof wu?t=e:e instanceof Fa&&(e.primary instanceof wu&&e.primary.webview===this._webviewService.activeWebview?t=e.primary:e.secondary instanceof wu&&e.secondary.webview===this._webviewService.activeWebview&&(t=e.secondary)),t!==this._activeWebview&&(this._activeWebview=t,this._onDidChangeActiveWebviewEditor.fire(t))}openWebview(e,t,o,n,r){let s=this._webviewService.createWebviewOverlay(e),l=this._instantiationService.createInstance(wu,{viewType:t,name:o,providedId:e.providedViewType,iconPath:n},s);return this._editorService.openEditor(l,{pinned:!0,preserveFocus:r.preserveFocus,activation:r.preserveFocus?2:void 0},r.group),l}revealWebview(e,t,o){let n=this.findTopLevelEditorForWebview(e);this._editorService.openEditor(n,{preserveFocus:o,activation:o?2:void 0},t)}findTopLevelEditorForWebview(e){for(let t of this._editorService.editors)if(t===e||t instanceof Fa&&(e===t.primary||e===t.secondary))return t;return e}openRevivedWebview(e){let t=this._webviewService.createWebviewOverlay(e.webviewInitInfo);t.state=e.state;let o=this._instantiationService.createInstance(o5,{viewType:e.viewType,providedId:e.webviewInitInfo.providedViewType,name:e.title,iconPath:e.iconPath},t);return o.iconPath=e.iconPath,typeof e.group=="number"&&o.updateGroup(e.group),o}registerResolver(e){this._revivers.add(e);let t=new $e;return this._revivalPool.reviveFor(e,t.token),Z(()=>{this._revivers.delete(e),t.dispose(!0)})}shouldPersist(e){return e instanceof o5?!0:ht.some(this._revivers.values(),t=>B_t(t,e))}async tryRevive(e,t){for(let o of this._revivers.values())if(B_t(o,e))return await o.resolveWebview(e,t),!0;return!1}async resolveWebview(e,t){if(!await this.tryRevive(e,t)&&!t.isCancellationRequested)return this._revivalPool.enqueueForRestoration(e,t)}};Uke=I([m(0,Et),m(1,ee),m(2,F),m(3,wm)],Uke);var Gm=ae("workingCopyBackupService");var CP="";var Dz=!1,_ui=class{constructor(i,e,t){this.id=i;this.dependencies=e;this.callback=t}};var Dui=class a{constructor(){this._isWebWorker=typeof self=="object"&&self.constructor&&self.constructor.name==="DedicatedWorkerGlobalScope";this._isRenderer=typeof document=="object";this._defineCalls=[];this._state=1}static{this.INSTANCE=new a}_initialize(){if(this._state===1){if(globalThis.define){this._state=3;return}}else return;this._state=2,globalThis.define=(i,e,t)=>{typeof i!="string"&&(t=e,e=i,i=null),(typeof e!="object"||!Array.isArray(e))&&(t=e,e=null),this._defineCalls.push(new _ui(i,e,t))},globalThis.define.amd=!0,this._isRenderer?this._amdPolicy=globalThis._VSCODE_WEB_PACKAGE_TTP??window.trustedTypes?.createPolicy("amdLoader",{createScriptURL(i){if(i.startsWith(window.location.origin)||i.startsWith(`${Y.vscodeFileResource}://${u9t}`))return i;throw new Error(`[trusted_script_src] Invalid script url: ${i}`)}}):this._isWebWorker&&(this._amdPolicy=globalThis._VSCODE_WEB_PACKAGE_TTP??globalThis.trustedTypes?.createPolicy("amdLoader",{createScriptURL(i){return i}}))}async load(i){if(this._initialize(),this._state===3)return new Promise(r=>{let s=_t();globalThis.define(s,[i],function(l){r(l)})});let e=await(this._isWebWorker?this._workerLoadScript(i):this._isRenderer?this._rendererLoadScript(i):this._nodeJSLoadScript(i));if(!e){console.warn(`Did not receive a define call from script ${i}`);return}let t={},o=[],n=[];if(Array.isArray(e.dependencies))for(let r of e.dependencies)r==="exports"?o.push(t):n.push(r);if(n.length>0)throw new Error(`Cannot resolve dependencies for script ${i}. The dependencies are: ${n.join(", ")}`);return typeof e.callback=="function"?e.callback(...o)??t:e.callback}_rendererLoadScript(i){return new Promise((e,t)=>{let o=document.createElement("script");o.setAttribute("async","async"),o.setAttribute("type","text/javascript");let n=()=>{o.removeEventListener("load",r),o.removeEventListener("error",s)},r=l=>{n(),e(this._defineCalls.pop())},s=l=>{n(),t(l)};o.addEventListener("load",r),o.addEventListener("error",s),this._amdPolicy&&(i=this._amdPolicy.createScriptURL(i)),o.setAttribute("src",i),window.document.getElementsByTagName("head")[0].appendChild(o)})}async _workerLoadScript(i){return this._amdPolicy&&(i=this._amdPolicy.createScriptURL(i)),await import(i),this._defineCalls.pop()}async _nodeJSLoadScript(i){try{let e=(await import("fs")).default,t=(await import("vm")).default,o=(await import("module")).default,n=A.parse(i).fsPath,r=e.readFileSync(n).toString(),s=o.wrap(r.replace(/^#!.*/,""));return new t.Script(s).runInThisContext().apply(),this._defineCalls.pop()}catch(e){throw e}}},Tui=new Map;async function bg(a,i,e){e===void 0&&(e=!!(globalThis._VSCODE_PRODUCT_JSON??globalThis.vscode?.context?.configuration()?.product)?.commit);let t=i?`${a}/${i}`:a;if(Tui.has(t))return Tui.get(t);let o;if(/^\w[\w\d+.-]*:\/\//.test(t))o=t;else{let l=`${Dz&&e&&!Gt?b6:sN}/${t}`;o=gn.asBrowserUri(l).toString(!0)}let n=Dui.INSTANCE.load(o);return Tui.set(t,n),n}function H_t(a,i){let t=!!(globalThis._VSCODE_PRODUCT_JSON??globalThis.vscode?.context?.configuration()?.product)?.commit,o=Dz&&t&&!Gt,n=`${a}/${i}`,s=`${o?b6:sN}/${n}`;return gn.asBrowserUri(s).toString(!0)}var mb="utf8",vV="utf8bom",n5="utf16be",r5="utf16le";var U_t=[254,255],Lui=[255,254],BQe=[239,187,191],G1o=512,$1o=512,q1o=512*8,j1o=512*128;var Rui=class extends Error{constructor(e,t){super(e);this.decodeStreamErrorKind=t}},Mui=class a{constructor(i){this.iconvLiteDecoder=i}static async create(i){let e;if(i!==mb)e=(await bg("@vscode/iconv-lite-umd","lib/iconv-lite-umd.js")).getDecoder(Pui(i));else{let t=new TextDecoder;e={write(o){return t.decode(o,{stream:!0})},end(){return t.decode()}}}return new a(e)}write(i){return this.iconvLiteDecoder.write(i)}end(){return this.iconvLiteDecoder.end()}};function PXi(a,i){let e=i.minBytesRequiredForDetection??(i.guessEncoding?q1o:$1o);return new Promise((t,o)=>{let n=_I(p=>p.join("")),r=[],s=0,l,c=new $e,u=async()=>{try{let p=await zke({buffer:Je.concat(r),bytesRead:s},i.guessEncoding,i.candidateGuessEncodings);if(p.seemsBinary&&i.acceptTextOnly)throw new Rui("Stream is binary but only text is accepted for decoding",1);p.encoding=await i.overwriteEncoding(p.encoding),l=await Mui.create(p.encoding);let h=l.write(Je.concat(r).buffer);n.write(h),r.length=0,s=0,t({stream:n,detected:p})}catch(p){c.cancel(),n.destroy(),o(p)}};j0(a,{onData:async p=>{l?n.write(l.write(p.buffer)):(r.push(p),s+=p.byteLength,s>=e&&(a.pause(),await u(),setTimeout(()=>a.resume())))},onError:p=>n.error(p),onEnd:async()=>{l||await u(),n.end(l?.end())}},c.token)})}async function AXi(a,i,e){let o=(await bg("@vscode/iconv-lite-umd","lib/iconv-lite-umd.js")).getEncoder(Pui(i),e),n=!1,r=!1;return{read(){if(r)return null;let s=a.read();if(typeof s!="string"){if(r=!0,!n&&e?.addBOM)switch(i){case mb:case vV:return Je.wrap(Uint8Array.from(BQe));case n5:return Je.wrap(Uint8Array.from(U_t));case r5:return Je.wrap(Uint8Array.from(Lui))}let l=o.end();return l&&l.length>0?(n=!0,Je.wrap(l)):null}return n=!0,Je.wrap(o.write(s))}}}async function NXi(a){return(await bg("@vscode/iconv-lite-umd","lib/iconv-lite-umd.js")).encodingExists(Pui(a))}function Pui(a){return a===vV||a===null?mb:a}function Q1o(a,i){if(!a||i<U_t.length)return null;let e=a.readUInt8(0),t=a.readUInt8(1);if(e===U_t[0]&&t===U_t[1])return n5;if(e===Lui[0]&&t===Lui[1])return r5;if(i<BQe.length)return null;let o=a.readUInt8(2);return e===BQe[0]&&t===BQe[1]&&o===BQe[2]?vV:null}var Y1o=["ascii","utf-16","utf-32"];async function X1o(a,i){let e=await bg("jschardet","dist/jschardet.min.js"),t=a.slice(0,j1o),o=tzo(t.buffer);i&&(i=si(i.map(s=>ezo(s))),i.length===0&&(i=void 0));let n;try{n=e.detect(o,i?{detectEncodings:i}:void 0)}catch{return null}if(!n?.encoding)return null;let r=n.encoding.toLowerCase();return 0<=Y1o.indexOf(r)?null:Z1o(n.encoding)}var J1o={ibm866:"cp866",big5:"cp950"};function OXi(a){return a.replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}function Z1o(a){let i=OXi(a);return J1o[i]||i}function ezo(a){let i=OXi(a),e=HQe[i];return e?e.guessableName:void 0}function tzo(a){let i="";for(let e=0;e<a.length;e++)i+=String.fromCharCode(a[e]);return i}function zke({buffer:a,bytesRead:i},e,t){let o=Q1o(a,i),n=!1;if(o!==n5&&o!==r5&&a){let r=!0,s=!0,l=!1;for(let c=0;c<i&&c<G1o;c++){let u=c%2===1,p=a.readUInt8(c)===0;if(p&&(l=!0),r&&(u&&!p||!u&&p)&&(r=!1),s&&(u&&p||!u&&!p)&&(s=!1),p&&!r&&!s)break}l&&(r?o=r5:s?o=n5:n=!0)}return e&&!n&&!o&&a?X1o(a.slice(0,i),t).then(r=>({seemsBinary:!1,encoding:r})):{seemsBinary:n,encoding:o}}var aw={utf8:{labelLong:"UTF-8",labelShort:"UTF-8",order:1,alias:"utf8bom",guessableName:"UTF-8"},utf8bom:{labelLong:"UTF-8 with BOM",labelShort:"UTF-8 with BOM",encodeOnly:!0,order:2,alias:"utf8"},utf16le:{labelLong:"UTF-16 LE",labelShort:"UTF-16 LE",order:3,guessableName:"UTF-16LE"},utf16be:{labelLong:"UTF-16 BE",labelShort:"UTF-16 BE",order:4,guessableName:"UTF-16BE"},windows1252:{labelLong:"Western (Windows 1252)",labelShort:"Windows 1252",order:5,guessableName:"windows-1252"},iso88591:{labelLong:"Western (ISO 8859-1)",labelShort:"ISO 8859-1",order:6},iso88593:{labelLong:"Western (ISO 8859-3)",labelShort:"ISO 8859-3",order:7},iso885915:{labelLong:"Western (ISO 8859-15)",labelShort:"ISO 8859-15",order:8},macroman:{labelLong:"Western (Mac Roman)",labelShort:"Mac Roman",order:9},cp437:{labelLong:"DOS (CP 437)",labelShort:"CP437",order:10},windows1256:{labelLong:"Arabic (Windows 1256)",labelShort:"Windows 1256",order:11},iso88596:{labelLong:"Arabic (ISO 8859-6)",labelShort:"ISO 8859-6",order:12},windows1257:{labelLong:"Baltic (Windows 1257)",labelShort:"Windows 1257",order:13},iso88594:{labelLong:"Baltic (ISO 8859-4)",labelShort:"ISO 8859-4",order:14},iso885914:{labelLong:"Celtic (ISO 8859-14)",labelShort:"ISO 8859-14",order:15},windows1250:{labelLong:"Central European (Windows 1250)",labelShort:"Windows 1250",order:16,guessableName:"windows-1250"},iso88592:{labelLong:"Central European (ISO 8859-2)",labelShort:"ISO 8859-2",order:17,guessableName:"ISO-8859-2"},cp852:{labelLong:"Central European (CP 852)",labelShort:"CP 852",order:18},windows1251:{labelLong:"Cyrillic (Windows 1251)",labelShort:"Windows 1251",order:19,guessableName:"windows-1251"},cp866:{labelLong:"Cyrillic (CP 866)",labelShort:"CP 866",order:20,guessableName:"IBM866"},cp1125:{labelLong:"Cyrillic (CP 1125)",labelShort:"CP 1125",order:21,guessableName:"IBM1125"},iso88595:{labelLong:"Cyrillic (ISO 8859-5)",labelShort:"ISO 8859-5",order:22,guessableName:"ISO-8859-5"},koi8r:{labelLong:"Cyrillic (KOI8-R)",labelShort:"KOI8-R",order:23,guessableName:"KOI8-R"},koi8u:{labelLong:"Cyrillic (KOI8-U)",labelShort:"KOI8-U",order:24},iso885913:{labelLong:"Estonian (ISO 8859-13)",labelShort:"ISO 8859-13",order:25},windows1253:{labelLong:"Greek (Windows 1253)",labelShort:"Windows 1253",order:26,guessableName:"windows-1253"},iso88597:{labelLong:"Greek (ISO 8859-7)",labelShort:"ISO 8859-7",order:27,guessableName:"ISO-8859-7"},windows1255:{labelLong:"Hebrew (Windows 1255)",labelShort:"Windows 1255",order:28,guessableName:"windows-1255"},iso88598:{labelLong:"Hebrew (ISO 8859-8)",labelShort:"ISO 8859-8",order:29,guessableName:"ISO-8859-8"},iso885910:{labelLong:"Nordic (ISO 8859-10)",labelShort:"ISO 8859-10",order:30},iso885916:{labelLong:"Romanian (ISO 8859-16)",labelShort:"ISO 8859-16",order:31},windows1254:{labelLong:"Turkish (Windows 1254)",labelShort:"Windows 1254",order:32},iso88599:{labelLong:"Turkish (ISO 8859-9)",labelShort:"ISO 8859-9",order:33},windows1258:{labelLong:"Vietnamese (Windows 1258)",labelShort:"Windows 1258",order:34},gbk:{labelLong:"Simplified Chinese (GBK)",labelShort:"GBK",order:35},gb18030:{labelLong:"Simplified Chinese (GB18030)",labelShort:"GB18030",order:36},cp950:{labelLong:"Traditional Chinese (Big5)",labelShort:"Big5",order:37,guessableName:"Big5"},big5hkscs:{labelLong:"Traditional Chinese (Big5-HKSCS)",labelShort:"Big5-HKSCS",order:38},shiftjis:{labelLong:"Japanese (Shift JIS)",labelShort:"Shift JIS",order:39,guessableName:"SHIFT_JIS"},eucjp:{labelLong:"Japanese (EUC-JP)",labelShort:"EUC-JP",order:40,guessableName:"EUC-JP"},euckr:{labelLong:"Korean (EUC-KR)",labelShort:"EUC-KR",order:41,guessableName:"EUC-KR"},windows874:{labelLong:"Thai (Windows 874)",labelShort:"Windows 874",order:42},iso885911:{labelLong:"Latin/Thai (ISO 8859-11)",labelShort:"ISO 8859-11",order:43},koi8ru:{labelLong:"Cyrillic (KOI8-RU)",labelShort:"KOI8-RU",order:44},koi8t:{labelLong:"Tajik (KOI8-T)",labelShort:"KOI8-T",order:45},gb2312:{labelLong:"Simplified Chinese (GB 2312)",labelShort:"GB 2312",order:46,guessableName:"GB2312"},cp865:{labelLong:"Nordic DOS (CP 865)",labelShort:"CP 865",order:47},cp850:{labelLong:"Western European DOS (CP 850)",labelShort:"CP 850",order:48}},HQe=(()=>{let a={};for(let i in aw)aw[i].guessableName&&(a[i]=aw[i]);return a})();var B_=class extends rw{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super(l,s,v,b);this.resource=e;this.hasAssociatedFilePath=t;this.initialValue=o;this.preferredLanguageId=n;this.preferredEncoding=r;this.workingCopyBackupService=c;this.textResourceConfigurationService=u;this.workingCopyService=p;this.textFileService=h;this.labelService=g;this.editorService=f;this._onDidChangeContent=this._register(new E);this.onDidChangeContent=this._onDidChangeContent.event;this._onDidChangeName=this._register(new E);this.onDidChangeName=this._onDidChangeName.event;this._onDidChangeDirty=this._register(new E);this.onDidChangeDirty=this._onDidChangeDirty.event;this._onDidChangeEncoding=this._register(new E);this.onDidChangeEncoding=this._onDidChangeEncoding.event;this._onDidSave=this._register(new E);this.onDidSave=this._onDidSave.event;this._onDidRevert=this._register(new E);this.onDidRevert=this._onDidRevert.event;this.typeId=CP;this.capabilities=2;this.configuredLabelFormat="content";this.cachedModelFirstLineWords=void 0;this.ignoreDirtyOnModelContentChange=!1;this.dirty=this.hasAssociatedFilePath||!!this.initialValue,this._register(this.workingCopyService.registerWorkingCopy(this)),n&&this.setLanguageId(n),this.onConfigurationChange(void 0,!1),this.registerListeners()}static{this.FIRST_LINE_NAME_MAX_LENGTH=40}static{this.FIRST_LINE_NAME_CANDIDATE_MAX_LENGTH=this.FIRST_LINE_NAME_MAX_LENGTH*10}static{this.ACTIVE_EDITOR_LANGUAGE_ID="${activeEditorLanguage}"}get name(){return this.configuredLabelFormat==="content"&&!this.hasAssociatedFilePath&&this.cachedModelFirstLineWords?this.cachedModelFirstLineWords:this.labelService.getUriBasenameLabel(this.resource)}registerListeners(){this._register(this.textResourceConfigurationService.onDidChangeConfiguration(e=>this.onConfigurationChange(e,!0)))}onConfigurationChange(e,t){if(!e||e.affectsConfiguration(this.resource,"files.encoding")){let o=this.textResourceConfigurationService.getValue(this.resource,"files.encoding");this.configuredEncoding!==o&&typeof o=="string"&&(this.configuredEncoding=o,t&&!this.preferredEncoding&&this._onDidChangeEncoding.fire())}if(!e||e.affectsConfiguration(this.resource,"workbench.editor.untitled.labelFormat")){let o=this.textResourceConfigurationService.getValue(this.resource,"workbench.editor.untitled.labelFormat");this.configuredLabelFormat!==o&&(o==="content"||o==="name")&&(this.configuredLabelFormat=o,t&&this._onDidChangeName.fire())}}setLanguageId(e,t){let o=e===B_.ACTIVE_EDITOR_LANGUAGE_ID?this.editorService.activeTextEditorLanguageId:e;this.preferredLanguageId=o,o&&super.setLanguageId(o,t)}getLanguageId(){return this.textEditorModel?this.textEditorModel.getLanguageId():this.preferredLanguageId}getEncoding(){return this.preferredEncoding||this.configuredEncoding}async setEncoding(e){let t=this.getEncoding();this.preferredEncoding=e,t!==this.preferredEncoding&&this._onDidChangeEncoding.fire()}isDirty(){return this.dirty}isModified(){return this.isDirty()}setDirty(e){this.dirty!==e&&(this.dirty=e,this._onDidChangeDirty.fire())}async save(e){let t=await this.textFileService.save(this.resource,e);return t&&this._onDidSave.fire({reason:e?.reason,source:e?.source}),!!t}async revert(){this.ignoreDirtyOnModelContentChange=!0;try{this.updateTextEditorModel(lae(""))}finally{this.ignoreDirtyOnModelContentChange=!1}this.setDirty(!1),this._onDidRevert.fire()}async backup(e){let t;return this.isResolved()?t=await this.textFileService.getEncodedReadable(this.resource,this.createSnapshot()??void 0,{encoding:mb}):typeof this.initialValue=="string"&&(t=Nbe(Je.fromString(this.initialValue))),{content:t}}async resolve(){let e=!1,t=!1;if(this.textEditorModel)this.updateTextEditorModel(void 0,this.preferredLanguageId);else{let n,r=await this.workingCopyBackupService.resolve(this);r?(n=r.value,t=!0):n=WT(Je.fromString(this.initialValue||""));let s=await W9(await this.textFileService.getDecodedStream(this.resource,n,{encoding:mb}));this.createTextEditorModel(s,this.resource,this.preferredLanguageId),e=!0}let o=Oi(this.textEditorModel);return this.installModelListeners(o),e&&((t||this.initialValue)&&this.updateNameFromFirstLine(o),this.setDirty(this.hasAssociatedFilePath||!!t||!!this.initialValue),(t||this.initialValue)&&this._onDidChangeContent.fire()),super.resolve()}isResolved(){return!!this.textEditorModelHandle}installModelListeners(e){this._register(e.onDidChangeContent(t=>this.onModelContentChanged(e,t))),this._register(e.onDidChangeLanguage(()=>this.onConfigurationChange(void 0,!0))),super.installModelListeners(e)}onModelContentChanged(e,t){this.ignoreDirtyOnModelContentChange||(!this.hasAssociatedFilePath&&e.getLineCount()===1&&e.getLineLength(1)===0?this.setDirty(!1):this.setDirty(!0)),t.changes.some(o=>(o.range.startLineNumber===1||o.range.endLineNumber===1)&&o.range.startColumn<=B_.FIRST_LINE_NAME_CANDIDATE_MAX_LENGTH)&&this.updateNameFromFirstLine(e),this._onDidChangeContent.fire(),this.autoDetectLanguage()}updateNameFromFirstLine(e){if(this.hasAssociatedFilePath)return;let t,o=e.getValueInRange({startLineNumber:1,endLineNumber:1,startColumn:1,endColumn:B_.FIRST_LINE_NAME_CANDIDATE_MAX_LENGTH+1}).trim().replace(/\s+/g," ").replace(/\u202E/g,"");o=o.substr(0,vpt(o,B_.FIRST_LINE_NAME_MAX_LENGTH)[0]),o&&E$().exec(o)&&(t=o),t!==this.cachedModelFirstLineWords&&(this.cachedModelFirstLineWords=t,this._onDidChangeName.fire())}isReadonly(){return!1}};B_=I([m(5,kt),m(6,Ct),m(7,Gm),m(8,Nn),m(9,Wa),m(10,Ho),m(11,ot),m(12,ee),m(13,eS),m(14,Bi)],B_);var H_=ae("untitledTextEditorService"),jce=class extends C{constructor(e,t){super();this.instantiationService=e;this.configurationService=t;this._onDidSave=this._register(new E);this.onDidSave=this._onDidSave.event;this._onDidChangeDirty=this._register(new E);this.onDidChangeDirty=this._onDidChangeDirty.event;this._onDidChangeEncoding=this._register(new E);this.onDidChangeEncoding=this._onDidChangeEncoding.event;this._onDidCreate=this._register(new E);this.onDidCreate=this._onDidCreate.event;this._onWillDispose=this._register(new E);this.onWillDispose=this._onWillDispose.event;this._onDidChangeLabel=this._register(new E);this.onDidChangeLabel=this._onDidChangeLabel.event;this.mapResourceToModel=this._register(new UD)}static{this.UNTITLED_WITHOUT_ASSOCIATED_RESOURCE_REGEX=/Untitled-\d+/}get(e){return this.mapResourceToModel.get(e)}getValue(e){return this.get(e)?.textEditorModel?.getValue()}async resolve(e){let t=this.doCreateOrGet(e);return await t.resolve(),t}create(e){return this.doCreateOrGet(e)}doCreateOrGet(e=Object.create(null)){let t=this.massageOptions(e);return t.untitledResource&&this.mapResourceToModel.has(t.untitledResource)?this.mapResourceToModel.get(t.untitledResource):this.doCreate(t)}massageOptions(e){let t=Object.create(null);if(e.associatedResource?(t.untitledResource=A.from({scheme:Y.untitled,authority:e.associatedResource.authority,fragment:e.associatedResource.fragment,path:e.associatedResource.path,query:e.associatedResource.query}),t.associatedResource=e.associatedResource):e.untitledResource?.scheme===Y.untitled&&(t.untitledResource=e.untitledResource),e.languageId)t.languageId=e.languageId;else if(!t.associatedResource){let o=this.configurationService.getValue();o.files?.defaultLanguage&&(t.languageId=o.files.defaultLanguage)}return t.encoding=e.encoding,t.initialValue=e.initialValue,t}doCreate(e){let t=e.untitledResource;if(!t){let n=1;do t=A.from({scheme:Y.untitled,path:`Untitled-${n}`}),n++;while(this.mapResourceToModel.has(t))}let o=this.instantiationService.createInstance(B_,t,!!e.associatedResource,e.initialValue,e.languageId,e.encoding);return this.registerModel(o),o}registerModel(e){let t=new P;t.add(e.onDidChangeDirty(()=>this._onDidChangeDirty.fire(e))),t.add(e.onDidChangeName(()=>this._onDidChangeLabel.fire(e))),t.add(e.onDidChangeEncoding(()=>this._onDidChangeEncoding.fire(e))),t.add(e.onWillDispose(()=>this._onWillDispose.fire(e))),H.once(e.onWillDispose)(()=>{this.mapResourceToModel.deleteAndLeak(e.resource),t.dispose()}),this.mapResourceToModel.set(e.resource,e),this._onDidCreate.fire(e),e.isDirty()&&this._onDidChangeDirty.fire(e)}isUntitledWithAssociatedResource(e){return e.scheme===Y.untitled&&e.path.length>1&&!jce.UNTITLED_WITHOUT_ASSOCIATED_RESOURCE_REGEX.test(e.path)}canDispose(e){return e.isDisposed()?!0:this.doCanDispose(e)}async doCanDispose(e){return e.isDirty()?(await H.toPromise(e.onDidChangeDirty),this.canDispose(e)):!0}notifyDidSave(e,t){this._onDidSave.fire({source:e,target:t})}};jce=I([m(0,F),m(1,B)],jce);we(H_,jce,1);var Yp=class extends o5{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super({providedId:e.viewType,viewType:e.viewType,name:"",iconPath:e.iconPath},t,n,r);this.instantiationService=s;this.labelService=l;this.customEditorService=c;this.fileDialogService=u;this.undoRedoService=p;this.fileService=h;this.filesConfigurationService=g;this.editorGroupsService=f;this.layoutService=v;this.customEditorLabelService=b;this._editorName=void 0;this._shortDescription=void 0;this._mediumDescription=void 0;this._longDescription=void 0;this._shortTitle=void 0;this._mediumTitle=void 0;this._longTitle=void 0;this._editorResource=e.resource,this.oldResource=o.oldResource,this._defaultDirtyState=o.startsDirty,this._backupId=o.backupId,this._untitledDocumentData=o.untitledDocumentData,this.registerListeners()}static create(e,t,o,n){return e.invokeFunction(r=>{let l=r.get(H_).get(t.resource),c=l?.textEditorModel?.getValue(),u=c?Je.fromString(c):void 0;l?.revert();let p=r.get(wm).createWebviewOverlay({providedViewType:t.viewType,title:t.webviewTitle,options:{customClasses:n?.customClasses},contentOptions:{},extension:void 0}),h=e.createInstance(Yp,t,p,{untitledDocumentData:u,oldResource:n?.oldResource});return typeof o<"u"&&h.updateGroup(o),h})}static{this.typeId="workbench.editors.webviewEditor"}get resource(){return this._editorResource}registerListeners(){this._register(this.labelService.onDidChangeFormatters(e=>this.onLabelEvent(e.scheme))),this._register(this.fileService.onDidChangeFileSystemProviderRegistrations(e=>this.onLabelEvent(e.scheme))),this._register(this.fileService.onDidChangeFileSystemProviderCapabilities(e=>this.onLabelEvent(e.scheme))),this._register(this.customEditorLabelService.onDidChange(()=>this.updateLabel())),this._register(this.filesConfigurationService.onDidChangeReadonly(()=>this._onDidChangeCapabilities.fire()))}onLabelEvent(e){e===this.resource.scheme&&this.updateLabel()}updateLabel(){this._editorName=void 0,this._shortDescription=void 0,this._mediumDescription=void 0,this._longDescription=void 0,this._shortTitle=void 0,this._mediumTitle=void 0,this._longTitle=void 0,this._onDidChangeLabel.fire()}get typeId(){return Yp.typeId}get editorId(){return this.viewType}get capabilities(){let e=0;return e|=128,this.customEditorService.getCustomEditorCapabilities(this.viewType)?.supportsMultipleEditorsPerDocument||(e|=8),this._modelRef?this._modelRef.object.isReadonly()&&(e|=2):this.filesConfigurationService.isReadonly(this.resource)&&(e|=2),this.resource.scheme===Y.untitled&&(e|=4),e}getName(){let e=this.getWebviewTitle();return e||(this._editorName??=this.customEditorLabelService.getName(this.resource)??No(this.labelService.getUriLabel(this.resource)),this._editorName)}getDescription(e=1){switch(e){case 0:return this.shortDescription;case 2:return this.longDescription;case 1:default:return this.mediumDescription}}get shortDescription(){return this._shortDescription??=this.labelService.getUriBasenameLabel(ci(this.resource)),this._shortDescription}get mediumDescription(){return this._mediumDescription??=this.labelService.getUriLabel(ci(this.resource),{relative:!0}),this._mediumDescription}get longDescription(){return this._longDescription??=this.labelService.getUriLabel(ci(this.resource)),this._longDescription}get shortTitle(){return this._shortTitle??=this.getName(),this._shortTitle}get mediumTitle(){return this._mediumTitle??=this.labelService.getUriLabel(this.resource,{relative:!0}),this._mediumTitle}get longTitle(){return this._longTitle??=this.labelService.getUriLabel(this.resource),this._longTitle}getTitle(e){let t=this.getWebviewTitle();if(t)return t;switch(e){case 0:return this.shortTitle;case 2:return this.longTitle;default:case 1:return this.mediumTitle}}matches(e){return super.matches(e)?!0:this===e||e instanceof Yp&&this.viewType===e.viewType&&Xe(this.resource,e.resource)}copy(){return Yp.create(this.instantiationService,{resource:this.resource,viewType:this.viewType,webviewTitle:this.getWebviewTitle(),iconPath:this.iconPath},this.group,this.webview.options)}isReadonly(){return this._modelRef?this._modelRef.object.isReadonly():this.filesConfigurationService.isReadonly(this.resource)}isDirty(){return this._modelRef?this._modelRef.object.isDirty():!!this._defaultDirtyState}async save(e,t){if(!this._modelRef)return;let o=await this._modelRef.object.saveCustomEditor(t);if(o)return Xe(o,this.resource)?this:{resource:o}}async saveAs(e,t){if(!this._modelRef)return;let o=this._editorResource,n=await this.fileDialogService.pickFileToSave(o,t?.availableFileSystems);if(n&&await this._modelRef.object.saveCustomEditorAs(this._editorResource,n,t))return(await this.rename(e,n))?.editor}async revert(e,t){if(this._modelRef)return this._modelRef.object.revert(t);this._defaultDirtyState=!1,this._onDidChangeDirty.fire()}async resolve(){if(await super.resolve(),this.isDisposed())return null;if(!this._modelRef){let e=this.capabilities;this._modelRef=this._register(Oi(await this.customEditorService.models.tryRetain(this.resource,this.viewType))),this._register(this._modelRef.object.onDidChangeDirty(()=>this._onDidChangeDirty.fire())),this._register(this._modelRef.object.onDidChangeReadonly(()=>this._onDidChangeCapabilities.fire())),this._untitledDocumentData&&(this._defaultDirtyState=!0),this.isDirty()&&this._onDidChangeDirty.fire(),this.capabilities!==e&&this._onDidChangeCapabilities.fire()}return null}async rename(e,t){return{editor:{resource:t}}}undo(){return Oi(this._modelRef),this.undoRedoService.undo(this.resource)}redo(){return Oi(this._modelRef),this.undoRedoService.redo(this.resource)}onMove(e){this._moveHandler=e}transfer(e){if(super.transfer(e))return e._moveHandler=this._moveHandler,this._moveHandler=void 0,e}get backupId(){return this._modelRef?this._modelRef.object.backupId:this._backupId}get untitledDocumentData(){return this._untitledDocumentData}toUntyped(){return{resource:this.resource,options:{override:this.viewType}}}claim(e,t,o){if(this.doCanMove(t.vscodeWindowId)!==!0)throw Aj(d(8569,null),[pi({id:"openInOriginalWindow",label:d(8570,null),run:async()=>{let n=this.editorGroupsService.getPart(this.layoutService.getContainer(Me(this.webview.container).window));this.editorGroupsService.getPart(this.layoutService.getContainer(t.window)).activeGroup.moveEditor(this,n.activeGroup)}})],{forceMessage:!0});return super.claim(e,t,o)}canMove(e,t){let o=this.editorGroupsService.getGroup(t);if(o){let n=this.doCanMove(o.windowId);if(typeof n=="string")return n}return super.canMove(e,t)}doCanMove(e){return this.isModified()&&this._modelRef?.object.canHotExit===!1&&Me(this.webview.container).vscodeWindowId!==e?d(8568,null,this.getName()):!0}};Yp=I([m(3,De),m(4,V_),m(5,F),m(6,ot),m(7,tX),m(8,dn),m(9,Cl),m(10,be),m(11,lr),m(12,Et),m(13,fi),m(14,Sv)],Yp);var Kke=ae("IInteractiveDocumentService"),z_t=class extends C{constructor(){super();this._onWillAddInteractiveDocument=this._register(new E);this.onWillAddInteractiveDocument=this._onWillAddInteractiveDocument.event;this._onWillRemoveInteractiveDocument=this._register(new E);this.onWillRemoveInteractiveDocument=this._onWillRemoveInteractiveDocument.event}willCreateInteractiveDocument(e,t,o){this._onWillAddInteractiveDocument.fire({notebookUri:e,inputUri:t,languageId:o})}willRemoveInteractiveDocument(e,t){this._onWillRemoveInteractiveDocument.fire({notebookUri:e,inputUri:t})}};var $O=ae("IInteractiveHistoryService"),K_t=class extends C{constructor(){super(),this._history=new vt}matchesCurrent(i,e){let t=this._history.get(i);return t?t.current()===e:!1}addToHistory(i,e){let t=this._history.get(i);if(!t){this._history.set(i,new zq([e],50));return}t.resetCursor(),t.add(e)}getPreviousValue(i){return this._history.get(i)?.previous()??null}getNextValue(i){return this._history.get(i)?.next()??null}replaceLast(i,e){let t=this._history.get(i);if(t)t.replaceLast(e),t.resetCursor();else{this._history.set(i,new zq([e],50));return}}clearHistory(i){this._history.delete(i)}has(i){return!!this._history.has(i)}};var Zg=class extends Us{constructor(e,t,o,n,r,s,l,c,u,p,h){let g=ha.getOrCreate(r,e,void 0,"interactive",{});super();this._notebookService=u;this._fileDialogService=p;this.isScratchpad=h.getValue(ft.InteractiveWindowPromptToSave)!==!0,this._notebookEditorInput=g,this._register(this._notebookEditorInput),this.name=o??Zg.windowNames[e.path]??No(e.path,Am(e.path)),this._initLanguage=n,this._resource=e,this._inputResource=t,this._inputResolver=null,this._editorModelReference=null,this._inputModelRef=null,this._textModelService=s,this._interactiveDocumentService=l,this._historyService=c,this._registerListeners()}static create(e,t,o,n,r){return e.createInstance(Zg,t,o,n,r)}static{this.windowNames={}}static setName(e,t){t&&(this.windowNames[e.path]=t)}static{this.ID="workbench.input.interactive"}get editorId(){return"interactive"}get typeId(){return Zg.ID}get language(){return this._inputModelRef?.object.textEditorModel.getLanguageId()??this._initLanguage}get notebookEditorInput(){return this._notebookEditorInput}get editorInputs(){return[this._notebookEditorInput]}get resource(){return this._resource}get inputResource(){return this._inputResource}get primary(){return this._notebookEditorInput}_registerListeners(){let e=H.once(this.primary.onWillDispose);this._register(e(()=>{this.isDisposed()||this.dispose()})),this._register(this.primary.onDidChangeDirty(()=>this._onDidChangeDirty.fire())),this._register(this.primary.onDidChangeLabel(()=>this._onDidChangeLabel.fire())),this._register(this.primary.onDidChangeCapabilities(()=>this._onDidChangeCapabilities.fire()))}get capabilities(){let e=this.isScratchpad?512:0;return 6|e}async _resolveEditorModel(){return this._editorModelReference||(this._editorModelReference=await this._notebookEditorInput.resolve()),this._editorModelReference}async resolve(){return this._editorModelReference?this._editorModelReference:this._inputResolver?this._inputResolver:(this._inputResolver=this._resolveEditorModel(),this._inputResolver)}async resolveInput(e){if(this._inputModelRef)return this._inputModelRef.object.textEditorModel;let t=e??this._initLanguage??Fr;return this._interactiveDocumentService.willCreateInteractiveDocument(this.resource,this.inputResource,t),this._inputModelRef=await this._textModelService.createModelReference(this.inputResource),this._inputModelRef.object.textEditorModel}async save(e,t){if(this._editorModelReference)return this.hasCapability(4)?this.saveAs(e,t):(await this._editorModelReference.save(t),this)}async saveAs(e,t){if(!this._editorModelReference||!this._notebookService.getContributedNotebookType("interactive"))return;let n=this.getName()+".ipynb",r=je(await this._fileDialogService.defaultFilePath(),n),s=await this._fileDialogService.pickFileToSave(r,t?.availableFileSystems);if(!s)return;let l=await this._editorModelReference.saveAs(s);return l&&"resource"in l&&l.resource&&this._notebookService.getNotebookTextModel(l.resource)?.dispose(),l}matches(e){return super.matches(e)?!0:e instanceof Zg?Xe(this.resource,e.resource)&&Xe(this.inputResource,e.inputResource):!1}getName(){return this.name}isDirty(){return this.isScratchpad?!1:this._editorModelReference?.isDirty()??!1}isModified(){return this._editorModelReference?.isModified()??!1}async revert(e,t){this._editorModelReference&&this._editorModelReference.isDirty()&&await this._editorModelReference.revert(t)}dispose(){this._editorModelReference?.revert({soft:!0}),this._notebookEditorInput?.dispose(),this._editorModelReference?.dispose(),this._editorModelReference=null,this._interactiveDocumentService.willRemoveInteractiveDocument(this.resource,this.inputResource),this._inputModelRef?.dispose(),this._inputModelRef=null,super.dispose()}get historyService(){return this._historyService}};Zg=I([m(4,F),m(5,Nt),m(6,Kke),m(7,$O),m(8,un),m(9,dn),m(10,B)],Zg);var Qh=class a extends ro{static fromLineNumbers(i,e){return a.fromLength(i,e-i)}static fromLength(i,e){return new a(i,i+e)}join(i){return a.fromLineNumbers(Math.min(this.startLineNumber,i.startLineNumber),Math.max(this.endLineNumberExclusive,i.endLineNumberExclusive))}isAfter(i){return this.startLineNumber>=i.endLineNumberExclusive}isBefore(i){return i.startLineNumber>=this.endLineNumberExclusive}delta(i){return a.fromLength(this.startLineNumber+i,this.length)}deltaEnd(i){return a.fromLength(this.startLineNumber,this.length+i)}deltaStart(i){return a.fromLength(this.startLineNumber+i,this.length-i)}getLines(i){let e=new Array(this.length);for(let t=0;t<this.length;t++)e[t]=i.getLineContent(this.startLineNumber+t);return e}toInclusiveRangeOrEmpty(){return this.isEmpty?new z(this.startLineNumber,1,this.startLineNumber,1):new z(this.startLineNumber,1,this.endLineNumberExclusive-1,1073741824)}};var FXi={start:"<<<<<<<",end:">>>>>>>"};var Lz=class{constructor(i,e){this.range=i;this.newLines=e}equals(i){return this.range.equals(i.range)&&$i(this.newLines,i.newLines)}toEdits(i){return new Aui([this]).toEdits(i)}},G_t=class{constructor(i,e){this.range=i;this.newText=e}equals(i){return z.equalsRange(this.range,i.range)&&this.newText===i.newText}},Aui=class{constructor(i){this.edits=i}toEdits(i){return this.edits.map(e=>e.range.endLineNumberExclusive<=i?{range:new z(e.range.startLineNumber,1,e.range.endLineNumberExclusive,1),text:e.newLines.map(t=>t+`
`).join("")}:e.range.startLineNumber===1?{range:new z(1,1,i,Number.MAX_SAFE_INTEGER),text:e.newLines.join(`
`)}:{range:new z(e.range.startLineNumber-1,Number.MAX_SAFE_INTEGER,i,Number.MAX_SAFE_INTEGER),text:e.newLines.map(t=>`
`+t).join("")})}};function WXi(a,i){return!(i.lineNumber<a.startLineNumber||i.lineNumber>a.endLineNumber||i.lineNumber===a.startLineNumber&&i.column<a.startColumn||i.lineNumber===a.endLineNumber&&i.column>=a.endColumn)}function UQe(a){return a.startLineNumber===a.endLineNumber?new Zl(0,a.endColumn-a.startColumn):new Zl(a.endLineNumber-a.startLineNumber,a.endColumn-1)}function $_t(a,i){return a.lineNumber===i.lineNumber?new Zl(0,i.column-a.column):new Zl(i.lineNumber-a.lineNumber,i.column-1)}function zQe(a,i){return i.lineCount===0?new Ie(a.lineNumber,a.column+i.columnCount):new Ie(a.lineNumber+i.lineCount,i.columnCount+1)}function Nui(a,i){return a.endLineNumber<i.startLineNumber||a.endLineNumber===i.startLineNumber&&a.endColumn<=i.startColumn}var xP=class a{constructor(i,e){this.inputRange=i;this.outputRange=e}static join(i){return i.reduce((e,t)=>e?e.join(t):t,void 0)}extendInputRange(i){if(!i.containsRange(this.inputRange))throw new ni;let e=i.startLineNumber-this.inputRange.startLineNumber,t=i.endLineNumberExclusive-this.inputRange.endLineNumberExclusive;return new a(i,Qh.fromLength(this.outputRange.startLineNumber+e,this.outputRange.length-e+t))}join(i){return new a(this.inputRange.join(i.inputRange),this.outputRange.join(i.outputRange))}get resultingDeltaFromOriginalToModified(){return this.outputRange.endLineNumberExclusive-this.inputRange.endLineNumberExclusive}toString(){return`${this.inputRange.toString()} -> ${this.outputRange.toString()}`}addOutputLineDelta(i){return new a(this.inputRange,this.outputRange.delta(i))}addInputLineDelta(i){return new a(this.inputRange.delta(i),this.outputRange)}reverse(){return new a(this.outputRange,this.inputRange)}},qO=class a{constructor(i,e){this.lineRangeMappings=i;this.inputLineCount=e;eh(()=>Ty(i,(t,o)=>t.inputRange.isBefore(o.inputRange)&&t.outputRange.isBefore(o.outputRange)&&o.inputRange.startLineNumber-t.inputRange.endLineNumberExclusive===o.outputRange.startLineNumber-t.outputRange.endLineNumberExclusive))}static betweenOutputs(i,e,t){let n=KQe.compute(i,e).map(r=>new xP(r.output1Range,r.output2Range));return new a(n,t)}project(i){let e=ju(this.lineRangeMappings,n=>n.inputRange.startLineNumber<=i);if(!e)return new xP(Qh.fromLength(i,1),Qh.fromLength(i,1));if(e.inputRange.contains(i))return e;let t=Qh.fromLength(i,1),o=Qh.fromLength(i+e.outputRange.endLineNumberExclusive-e.inputRange.endLineNumberExclusive,1);return new xP(t,o)}get outputLineCount(){let i=this.lineRangeMappings.at(-1),e=i?i.outputRange.endLineNumberExclusive-i.inputRange.endLineNumberExclusive:0;return this.inputLineCount+e}reverse(){return new a(this.lineRangeMappings.map(i=>i.reverse()),this.outputLineCount)}},KQe=class a{constructor(i,e,t,o,n){this.inputRange=i;this.output1Range=e;this.output1LineMappings=t;this.output2Range=o;this.output2LineMappings=n}static compute(i,e){let t=tl(u=>u.inputRange.startLineNumber,qd),o=Out(i.map(u=>({source:0,diff:u})),e.map(u=>({source:1,diff:u}))).sort(tl(u=>u.diff,t)),n=[new Array,new Array],r=[0,0],s=new Array;function l(u){let p=xP.join(n[0])||new xP(u,u.delta(r[0])),h=xP.join(n[1])||new xP(u,u.delta(r[1]));s.push(new a(c,p.extendInputRange(c).outputRange,n[0],h.extendInputRange(c).outputRange,n[1])),n[0]=[],n[1]=[]}let c;for(let u of o){let p=u.diff.inputRange;c&&!c.intersectsOrTouches(p)&&(l(c),c=void 0),r[u.source]=u.diff.resultingDeltaFromOriginalToModified,c=c?c.join(p):p,n[u.source].push(u.diff)}return c&&l(c),s}toString(){return`${this.output1Range} <- ${this.inputRange} -> ${this.output2Range}`}},s5=class a extends xP{constructor(e,t,o,n,r){super(e,o);this.inputTextModel=t;this.outputTextModel=n;this.rangeMappings=r||[new bV(this.inputRange.toExclusiveRange(),this.outputRange.toExclusiveRange())]}static join(e){return e.reduce((t,o)=>t?t.join(o):o,void 0)}addOutputLineDelta(e){return new a(this.inputRange,this.inputTextModel,this.outputRange.delta(e),this.outputTextModel,this.rangeMappings.map(t=>t.addOutputLineDelta(e)))}addInputLineDelta(e){return new a(this.inputRange.delta(e),this.inputTextModel,this.outputRange,this.outputTextModel,this.rangeMappings.map(t=>t.addInputLineDelta(e)))}join(e){return new a(this.inputRange.join(e.inputRange),this.inputTextModel,this.outputRange.join(e.outputRange),this.outputTextModel)}getLineEdit(){return new Lz(this.inputRange,this.getOutputLines())}getReverseLineEdit(){return new Lz(this.outputRange,this.getInputLines())}getOutputLines(){return this.outputRange.getLines(this.outputTextModel)}getInputLines(){return this.inputRange.getLines(this.inputTextModel)}},bV=class a{constructor(i,e){this.inputRange=i;this.outputRange=e}toString(){function i(e){return`[${e.startLineNumber}:${e.startColumn}, ${e.endLineNumber}:${e.endColumn})`}return`${i(this.inputRange)} -> ${i(this.outputRange)}`}addOutputLineDelta(i){return new a(this.inputRange,new z(this.outputRange.startLineNumber+i,this.outputRange.startColumn,this.outputRange.endLineNumber+i,this.outputRange.endColumn))}addInputLineDelta(i){return new a(new z(this.inputRange.startLineNumber+i,this.inputRange.startColumn,this.inputRange.endLineNumber+i,this.inputRange.endColumn),this.outputRange)}reverse(){return new a(this.outputRange,this.inputRange)}},Qce=class a{constructor(i,e){this.rangeMappings=i;this.inputLineCount=e;eh(()=>Ty(i,(t,o)=>Nui(t.inputRange,o.inputRange)&&Nui(t.outputRange,o.outputRange)))}project(i){let e=ju(this.rangeMappings,n=>n.inputRange.getStartPosition().isBeforeOrEqual(i));if(!e)return new bV(z.fromPositions(i,i),z.fromPositions(i,i));if(WXi(e.inputRange,i))return e;let t=$_t(e.inputRange.getEndPosition(),i),o=zQe(e.outputRange.getEndPosition(),t);return new bV(z.fromPositions(i),z.fromPositions(o))}projectRange(i){let e=this.project(i.getStartPosition()),t=this.project(i.getEndPosition());return new bV(e.inputRange.plusRange(t.inputRange),e.outputRange.plusRange(t.outputRange))}get outputLineCount(){let i=this.rangeMappings.at(-1),e=i?i.outputRange.endLineNumber-i.inputRange.endLineNumber:0;return this.inputLineCount+e}reverse(){return new a(this.rangeMappings.map(i=>i.reverse()),this.outputLineCount)}};var Yce=class{constructor(i,e){this.editorWorkerService=i;this.configurationService=e;this.mergeAlgorithm=pr("mergeEditor.diffAlgorithm","advanced",this.configurationService).map(t=>t==="smart"?"legacy":t==="experimental"?"advanced":t)}async computeDiff(i,e,t){let o=this.mergeAlgorithm.read(t),n=i.getVersionId(),r=e.getVersionId(),s=await this.editorWorkerService.computeDiff(i.uri,e.uri,{ignoreTrimWhitespace:!1,maxComputationTimeMs:0,computeMoves:!1},o);if(!s)throw new Error("Diff computation failed");if(i.isDisposed()||e.isDisposed())return{diffs:null};let l=s.changes.map(p=>new s5(VXi(p.original),i,VXi(p.modified),e,p.innerChanges?.map(h=>izo(h)))),c=i.getVersionId(),u=e.getVersionId();return n!==c||r!==u?{diffs:null}:(eh(()=>l.length===0||l[0].inputRange.startLineNumber===l[0].outputRange.startLineNumber&&Ty(l,(p,h)=>h.inputRange.startLineNumber-p.inputRange.endLineNumberExclusive===h.outputRange.startLineNumber-p.outputRange.endLineNumberExclusive&&p.inputRange.endLineNumberExclusive<h.inputRange.startLineNumber&&p.outputRange.endLineNumberExclusive<h.outputRange.startLineNumber)),{diffs:l})}};Yce=I([m(0,$s),m(1,B)],Yce);function VXi(a){return Qh.fromLength(a.startLineNumber,a.length)}function izo(a){return new bV(a.originalRange,a.modifiedRange)}var oX=class{constructor(){this._isOccupied=!1}runExclusivelyOrSkip(i){if(!this._isOccupied){this._isOccupied=!0;try{i()}finally{this._isOccupied=!1}}}runExclusivelyOrThrow(i){if(this._isOccupied)throw new ni("ReentrancyBarrier: reentrant call detected!");this._isOccupied=!0;try{i()}finally{this._isOccupied=!1}}get isOccupied(){return this._isOccupied}makeExclusiveOrSkip(i){return((...e)=>{if(!this._isOccupied){this._isOccupied=!0;try{return i(...e)}finally{this._isOccupied=!1}}})}};var Gke=class extends C{constructor(e,t,o){super();this.baseTextModel=e;this.textModel=t;this.diffComputer=o;this._recomputeCount=0;this._state=Le(this,1);this._diffs=Le(this,[]);this._barrier=new oX;this._isDisposed=!1;this._isInitializing=!0;let n=Wc("recompute");this._register(he(r=>{n.read(r),this._recompute(r)})),this._register(e.onDidChangeContent(this._barrier.makeExclusiveOrSkip(()=>{n.trigger(void 0)}))),this._register(t.onDidChangeContent(this._barrier.makeExclusiveOrSkip(()=>{n.trigger(void 0)}))),this._register(Z(()=>{this._isDisposed=!0}))}get isApplyingChange(){return this._barrier.isOccupied}get state(){return this._state}get diffs(){return this._diffs}_recompute(e){this._recomputeCount++;let t=this._recomputeCount;this._state.get()===1&&(this._isInitializing=!0),Ui(n=>{this._state.set(this._isInitializing?1:3,n,0)}),this.diffComputer.computeDiff(this.baseTextModel,this.textModel,e).then(n=>{this._isDisposed||t===this._recomputeCount&&Ui(r=>{n.diffs?(this._state.set(2,r,1),this._diffs.set(n.diffs,r,1)):this._state.set(4,r,1),this._isInitializing=!1})})}ensureUpToDate(){if(this.state.get()!==2)throw new ni("Cannot remove diffs when the model is not up to date")}removeDiffs(e,t,o){this.ensureUpToDate(),e.sort(tl(r=>r.inputRange.startLineNumber,qd)),e.reverse();let n=this._diffs.get();for(let r of e){let s=n.length;if(n=n.filter(l=>l!==r),s===n.length)throw new ni;this._barrier.runExclusivelyOrThrow(()=>{let l=r.getReverseLineEdit().toEdits(this.textModel.getLineCount());this.textModel.pushEditOperations(null,l,()=>null,o)}),n=n.map(l=>l.outputRange.isAfter(r.outputRange)?l.addOutputLineDelta(r.inputRange.length-r.outputRange.length):l)}this._diffs.set(n,t,0)}applyEditRelativeToOriginal(e,t,o){this.ensureUpToDate();let n=new s5(e.range,this.baseTextModel,Qh.fromLength(e.range.startLineNumber,e.newLines.length),this.textModel),r=!1,s=0,l=new Array;for(let c of this.diffs.get()){if(c.inputRange.intersectsOrTouches(e.range))throw new ni("Edit must be conflict free.");c.inputRange.isAfter(e.range)?(r||(r=!0,l.push(n.addOutputLineDelta(s))),l.push(c.addOutputLineDelta(e.newLines.length-e.range.length))):l.push(c),r||(s+=c.outputRange.length-c.inputRange.length)}r||(r=!0,l.push(n.addOutputLineDelta(s))),this._barrier.runExclusivelyOrThrow(()=>{let c=new Lz(e.range.delta(s),e.newLines).toEdits(this.textModel.getLineCount());this.textModel.pushEditOperations(null,c,()=>null,o)}),this._diffs.set(l,t,0)}findTouchingDiffs(e){return this.diffs.get().filter(t=>t.inputRange.intersectsOrTouches(e))}getResultLine(e,t){let o=0,n=t?this.diffs.read(t):this.diffs.get();for(let r of n){if(r.inputRange.contains(e)||r.inputRange.endLineNumberExclusive===e)return r;if(r.inputRange.endLineNumberExclusive<e)o=r.resultingDeltaFromOriginalToModified;else break}return e+o}getResultLineRange(e,t){let o=this.getResultLine(e.startLineNumber,t);typeof o!="number"&&(o=o.outputRange.startLineNumber);let n=this.getResultLine(e.endLineNumberExclusive,t);return typeof n!="number"&&(n=n.outputRange.endLineNumberExclusive),Qh.fromLineNumbers(o,n)}};function BXi(a,i){Object.entries(i).forEach(([e,t])=>{a.style.setProperty(e,ozo(t))})}function ozo(a){return typeof a=="number"?`${a}px`:a}function qke(a,i){let e=new P,t=[];return e.add(XD({debugName:()=>`Apply decorations from ${i.debugName}`},o=>{let n=i.read(o);a.changeDecorations(r=>{t=r.deltaDecorations(t,n)})})),e.add({dispose:()=>{a.changeDecorations(o=>{t=o.deltaDecorations(t,[])})}}),e}function*HXi(a,i,e){let t=new bS(i);for(let o of a){t.takeWhile(r=>Fw.isGreaterThan(e(o,r)));let n=t.takeWhile(r=>Fw.isNeitherLessOrGreaterThan(e(o,r)));yield{left:o,rights:n||[]}}}function*q_t(a,i,e){let t=new bS(i);for(let o of a){let n=t.takeWhile(s=>Fw.isGreaterThan(e(o,s)));n&&(yield{rights:n});let r=t.takeWhile(s=>Fw.isNeitherLessOrGreaterThan(e(o,s)));yield{left:o,rights:r||[]}}}function j_t(a,i){return Object.assign(a,i)}function Q_t(a,i){let e={};for(let t in a)e[t]=a[t];for(let t in i){let o=i[t];typeof e[t]=="object"&&o&&typeof o=="object"?e[t]=Q_t(e[t],o):e[t]=o}return e}var $ke=class{constructor(i,e){this.key=i;this.storageService=e;this.hasValue=!1;this.value=void 0}get(){if(!this.hasValue){let i=this.storageService.get(this.key,0);if(i!==void 0)try{this.value=JSON.parse(i)}catch(e){mt(e)}this.hasValue=!0}return this.value}set(i){this.value=i,this.storageService.store(this.key,JSON.stringify(this.value),0,0)}};$ke=I([m(1,le)],$ke);var Y_t=class a{constructor(i,e,t,o,n,r,s,l){this.baseRange=i;this.baseTextModel=e;this.input1Range=t;this.input1TextModel=o;this.input1Diffs=n;this.input2Range=r;this.input2TextModel=s;this.input2Diffs=l;if(this.input1CombinedDiff=s5.join(this.input1Diffs),this.input2CombinedDiff=s5.join(this.input2Diffs),this.isEqualChange=$i(this.input1Diffs,this.input2Diffs,(c,u)=>c.getLineEdit().equals(u.getLineEdit())),this.smartInput1LineRangeEdit=null,this.smartInput2LineRangeEdit=null,this.dumbInput1LineRangeEdit=null,this.dumbInput2LineRangeEdit=null,this.input1Diffs.length===0&&this.input2Diffs.length===0)throw new ni("must have at least one diff")}static fromDiffs(i,e,t,o,n){return KQe.compute(i,e).map(s=>new a(s.inputRange,t,s.output1Range,o,s.output1LineMappings,s.output2Range,n,s.output2LineMappings))}getInputRange(i){return i===1?this.input1Range:this.input2Range}getInputCombinedDiff(i){return i===1?this.input1CombinedDiff:this.input2CombinedDiff}getInputDiffs(i){return i===1?this.input1Diffs:this.input2Diffs}get isConflicting(){return this.input1Diffs.length>0&&this.input2Diffs.length>0}get canBeCombined(){return this.smartCombineInputs(1)!==void 0}get isOrderRelevant(){let i=this.smartCombineInputs(1),e=this.smartCombineInputs(2);return!i||!e?!1:!i.equals(e)}getEditForBase(i){let e=[];if(i.includesInput1&&this.input1CombinedDiff&&e.push({diff:this.input1CombinedDiff,inputNumber:1}),i.includesInput2&&this.input2CombinedDiff&&e.push({diff:this.input2CombinedDiff,inputNumber:2}),e.length===0)return{edit:void 0,effectiveState:oS.base};if(e.length===1)return{edit:e[0].diff.getLineEdit(),effectiveState:oS.base.withInputValue(e[0].inputNumber,!0,!1)};if(i.kind!==3)throw new ni;let t=i.smartCombination?this.smartCombineInputs(i.firstInput):this.dumbCombineInputs(i.firstInput);return t?{edit:t,effectiveState:i}:{edit:e[Oui(i.firstInput)-1].diff.getLineEdit(),effectiveState:oS.base.withInputValue(Oui(i.firstInput),!0,!1)}}smartCombineInputs(i){if(i===1&&this.smartInput1LineRangeEdit!==null)return this.smartInput1LineRangeEdit;if(i===2&&this.smartInput2LineRangeEdit!==null)return this.smartInput2LineRangeEdit;let t=Out(this.input1Diffs.flatMap(n=>n.rangeMappings.map(r=>({diff:r,input:1}))),this.input2Diffs.flatMap(n=>n.rangeMappings.map(r=>({diff:r,input:2})))).sort(Wut(tl(n=>n.diff.inputRange,z.compareRangesUsingStarts),tl(n=>n.input===i?1:2,qd))).map(n=>{let r=n.input===1?this.input1TextModel:this.input2TextModel;return new G_t(n.diff.inputRange,r.getValueInRange(n.diff.outputRange))}),o=nzo(this.baseRange,t,this.baseTextModel);return i===1?this.smartInput1LineRangeEdit=o:this.smartInput2LineRangeEdit=o,o}dumbCombineInputs(i){if(i===1&&this.dumbInput1LineRangeEdit!==null)return this.dumbInput1LineRangeEdit;if(i===2&&this.dumbInput2LineRangeEdit!==null)return this.dumbInput2LineRangeEdit;let e=this.input1Range.getLines(this.input1TextModel),t=this.input2Range.getLines(this.input2TextModel);i===2&&([e,t]=[t,e]);let o=new Lz(this.baseRange,e.concat(t));return i===1?this.dumbInput1LineRangeEdit=o:this.dumbInput2LineRangeEdit=o,o}};function nzo(a,i,e){let t="",o=a.startLineNumber>1,n=o?new Ie(a.startLineNumber-1,e.getLineMaxColumn(a.startLineNumber-1)):new Ie(a.startLineNumber,1);for(let u of i){let p=u.range.getStartPosition();if(!n.isBeforeOrEqual(p))return;let h=e.getValueInRange(z.fromPositions(n,p));p.lineNumber>e.getLineCount()&&(h+=`
`),t+=h,t+=u.newText,n=u.range.getEndPosition()}let r=a.endLineNumberExclusive<=e.getLineCount(),s=r?new Ie(a.endLineNumberExclusive,1):new Ie(a.endLineNumberExclusive-1,1073741824),l=e.getValueInRange(z.fromPositions(n,s));t+=l;let c=mc(t);if(o){if(c[0]!=="")return;c.shift()}if(r){if(c[c.length-1]!=="")return;c.pop()}return new Lz(a,c)}function Oui(a){return a===1?2:1}var Xce=class{constructor(){}get includesInput1(){return!1}get includesInput2(){return!1}includesInput(i){return i===1?this.includesInput1:this.includesInput2}isInputIncluded(i){return i===1?this.includesInput1:this.includesInput2}toggle(i){return this.withInputValue(i,!this.includesInput(i),!0)}getInput(i){return this.isInputIncluded(i)?1:0}},GQe=class extends Xce{get kind(){return 0}toString(){return"base"}swap(){return this}withInputValue(i,e,t=!1){return i===1?e?new jke:this:e?new Jce:this}equals(i){return i.kind===0}},jke=class extends Xce{get kind(){return 1}get includesInput1(){return!0}toString(){return"1\u2713"}swap(){return new Jce}withInputValue(i,e,t=!1){return i===1?e?this:new GQe:e?new X_t(1,t):new Jce}equals(i){return i.kind===1}},Jce=class a extends Xce{get kind(){return 2}get includesInput2(){return!0}toString(){return"2\u2713"}swap(){return new jke}withInputValue(i,e,t=!1){return i===2?e?this:new GQe:e?new X_t(2,t):new a}equals(i){return i.kind===2}},X_t=class a extends Xce{constructor(e,t){super();this.firstInput=e;this.smartCombination=t}get kind(){return 3}get includesInput1(){return!0}get includesInput2(){return!0}toString(){return"2\u2713"}swap(){return new a(Oui(this.firstInput),this.smartCombination)}withInputValue(e,t,o=!1){return t?this:e===1?new Jce:new jke}equals(e){return e.kind===3&&this.firstInput===e.firstInput&&this.smartCombination===e.smartCombination}getInput(e){return e===this.firstInput?1:2}},Fui=class extends Xce{get kind(){return 4}toString(){return"unrecognized"}swap(){return this}withInputValue(i,e,t=!1){return e?i===1?new jke:new Jce:this}equals(i){return i.kind===4}},oS;(e=>(e.base=new GQe,e.unrecognized=new Fui))(oS||={});var Zce=class extends gg{constructor(e,t,o,n,r,s,l,c,u){super();this.base=e;this.input1=t;this.input2=o;this.resultTextModel=n;this.diffComputer=r;this.options=s;this.telemetry=l;this.languageService=c;this.undoRedoService=u;this.input1TextModelDiffs=this._register(new Gke(this.base,this.input1.textModel,this.diffComputer)),this.input2TextModelDiffs=this._register(new Gke(this.base,this.input2.textModel,this.diffComputer)),this.resultTextModelDiffs=this._register(new Gke(this.base,this.resultTextModel,this.diffComputer)),this.modifiedBaseRanges=Ce(this,h=>{let g=this.input1TextModelDiffs.diffs.read(h),f=this.input2TextModelDiffs.diffs.read(h);return Y_t.fromDiffs(g,f,this.base,this.input1.textModel,this.input2.textModel)}),this.modifiedBaseRangeResultStates=Ce(this,h=>new Map(this.modifiedBaseRanges.read(h).map(f=>[f,new J_t(f)]))),this.resultSnapshot=this.resultTextModel.createSnapshot(),this.baseInput1Diffs=this.input1TextModelDiffs.diffs,this.baseInput2Diffs=this.input2TextModelDiffs.diffs,this.baseResultDiffs=this.resultTextModelDiffs.diffs,this.input1ResultMapping=Ce(this,h=>this.getInputResultMapping(this.baseInput1Diffs.read(h),this.baseResultDiffs.read(h),this.input1.textModel.getLineCount())),this.resultInput1Mapping=Ce(this,h=>this.input1ResultMapping.read(h).reverse()),this.input2ResultMapping=Ce(this,h=>this.getInputResultMapping(this.baseInput2Diffs.read(h),this.baseResultDiffs.read(h),this.input2.textModel.getLineCount())),this.resultInput2Mapping=Ce(this,h=>this.input2ResultMapping.read(h).reverse()),this.baseResultMapping=Ce(this,h=>{let g=new qO(this.baseResultDiffs.read(h),-1);return new qO(g.lineRangeMappings.map(f=>f.inputRange.isEmpty||f.outputRange.isEmpty?new xP(f.inputRange.deltaStart(-1),f.outputRange.deltaStart(-1)):f),g.inputLineCount)}),this.resultBaseMapping=Ce(this,h=>this.baseResultMapping.read(h).reverse()),this.diffComputingState=Ce(this,h=>{let g=[this.input1TextModelDiffs,this.input2TextModelDiffs,this.resultTextModelDiffs].map(f=>f.state.read(h));return g.some(f=>f===1)?1:g.some(f=>f===3)?3:2}),this.inputDiffComputingState=Ce(this,h=>{let g=[this.input1TextModelDiffs,this.input2TextModelDiffs].map(f=>f.state.read(h));return g.some(f=>f===1)?1:g.some(f=>f===3)?3:2}),this.isUpToDate=Ce(this,h=>this.diffComputingState.read(h)===2),this.firstRun=!0,this.unhandledConflictsCount=Ce(this,h=>{let g=this.modifiedBaseRangeResultStates.read(h),f=0;for(let[v,b]of g)b.handled.read(h)||f++;return f}),this.hasUnhandledConflicts=this.unhandledConflictsCount.map(h=>h>0),this._register(lU(this.modifiedBaseRangeResultStates)),this._register(lU(this.input1ResultMapping)),this._register(lU(this.input2ResultMapping));let p=this.initialize();this.onInitialized=gf(this.diffComputingState,h=>h===2).then(async()=>{await p}),p.then(()=>{let h=!0;this._register(xM({changeTracker:{createChangeSummary:()=>{},handleChange:g=>(g.didChange(this.modifiedBaseRangeResultStates)&&(h=!0),g.didChange(this.resultTextModelDiffs.diffs)?g.change===1:!0)}},g=>{let f=this.modifiedBaseRangeResultStates.read(g);if(!this.isUpToDate.read(g))return;let v=this.resultTextModelDiffs.diffs.read(g);Ui(b=>{if(this.updateBaseRangeAcceptedState(v,f,b),h){h=!1;for(let[S,y]of f){let w=y.accepted.read(void 0),k=!(w.kind===0||w.kind===4);y.handledInput1.set(k,b),y.handledInput2.set(k,b)}}})}))})}async initialize(){this.options.resetResult&&await this.reset()}async reset(){await gf(this.inputDiffComputingState,t=>t===2);let e=this.modifiedBaseRangeResultStates.get();Ui(t=>{for(let[o,n]of e){let r,s=!1;o.input1Diffs.length===0?(r=oS.base.withInputValue(2,!0),s=!0):o.input2Diffs.length===0?(r=oS.base.withInputValue(1,!0),s=!0):o.isEqualChange?(r=oS.base.withInputValue(1,!0),s=!0):(r=oS.base,s=!1),n.accepted.set(r,t),n.computedFromDiffing=!1,n.previousNonDiffingState=void 0,n.handledInput1.set(s,t),n.handledInput2.set(s,t)}this.resultTextModel.pushEditOperations(null,[{range:new z(1,1,Number.MAX_SAFE_INTEGER,1),text:this.computeAutoMergedResult()}],()=>null)})}computeAutoMergedResult(){let e=this.modifiedBaseRanges.get(),t=this.base.getLinesContent(),o=this.input1.textModel.getLinesContent(),n=this.input2.textModel.getLinesContent(),r=[];function s(c,u){for(let p=u.startLineNumber;p<u.endLineNumberExclusive;p++)r.push(c[p-1])}let l=1;for(let c of e)s(t,Qh.fromLineNumbers(l,c.baseRange.startLineNumber)),l=c.baseRange.endLineNumberExclusive,c.input1Diffs.length===0?s(n,c.input2Range):c.input2Diffs.length===0||c.isEqualChange?s(o,c.input1Range):s(t,c.baseRange);return s(t,Qh.fromLineNumbers(l,t.length+1)),r.join(this.resultTextModel.getEOL())}hasBaseRange(e){return this.modifiedBaseRangeResultStates.get().has(e)}get isApplyingEditInResult(){return this.resultTextModelDiffs.isApplyingChange}getInputResultMapping(e,t,o){let n=qO.betweenOutputs(e,t,o);return new qO(n.lineRangeMappings.map(r=>r.inputRange.isEmpty||r.outputRange.isEmpty?new xP(r.inputRange.deltaStart(-1),r.outputRange.deltaStart(-1)):r),n.inputLineCount)}translateInputRangeToBase(e,t){let o=e===1?this.baseInput1Diffs.get():this.baseInput2Diffs.get();return new Qce(o.flatMap(r=>r.rangeMappings),0).reverse().projectRange(t).outputRange}translateBaseRangeToInput(e,t){let o=e===1?this.baseInput1Diffs.get():this.baseInput2Diffs.get();return new Qce(o.flatMap(r=>r.rangeMappings),0).projectRange(t).outputRange}getLineRangeInResult(e,t){return this.resultTextModelDiffs.getResultLineRange(e,t)}translateResultRangeToBase(e){return new Qce(this.baseResultDiffs.get().flatMap(o=>o.rangeMappings),0).reverse().projectRange(e).outputRange}translateBaseRangeToResult(e){return new Qce(this.baseResultDiffs.get().flatMap(o=>o.rangeMappings),0).projectRange(e).outputRange}findModifiedBaseRangesInRange(e){return this.modifiedBaseRanges.get().filter(t=>t.baseRange.intersectsOrTouches(e))}updateBaseRangeAcceptedState(e,t,o){let n=HXi(t,e,(r,s)=>r[0].baseRange.intersectsOrTouches(s.inputRange)?Fw.neitherLessOrGreaterThan:Qh.compareByStart(r[0].baseRange,s.inputRange));for(let r of n){let s=this.computeState(r.left[0],r.rights),l=r.left[1],c=l.accepted.get();c.equals(s)||(!this.firstRun&&!l.computedFromDiffing&&(l.computedFromDiffing=!0,l.previousNonDiffingState=c),l.accepted.set(s,o))}this.firstRun&&(this.firstRun=!1)}computeState(e,t){if(t.length===0)return oS.base;let o=t.map(s=>s.getLineEdit());function n(s){return $i(o,s.map(l=>l.getLineEdit()),(l,c)=>l.equals(c))}if(n(e.input1Diffs))return oS.base.withInputValue(1,!0);if(n(e.input2Diffs))return oS.base.withInputValue(2,!0);let r=[oS.base.withInputValue(1,!0).withInputValue(2,!0,!0),oS.base.withInputValue(2,!0).withInputValue(1,!0,!0),oS.base.withInputValue(1,!0).withInputValue(2,!0,!1),oS.base.withInputValue(2,!0).withInputValue(1,!0,!1)];for(let s of r){let{edit:l}=e.getEditForBase(s);if(l){let u=this.resultTextModelDiffs.getResultLineRange(e.baseRange).getLines(this.resultTextModel);if($i(l.newLines,u,(p,h)=>p===h))return s}}return oS.unrecognized}getState(e){let t=this.modifiedBaseRangeResultStates.get().get(e);if(!t)throw new ni("object must be from this instance");return t.accepted}setState(e,t,o,n,r=!1){if(!this.isUpToDate.get())throw new ni("Cannot set state while updating");let s=this.modifiedBaseRangeResultStates.get().get(e);if(!s)throw new ni("object must be from this instance");let l=this.resultTextModelDiffs.findTouchingDiffs(e.baseRange),c=new R9;l&&this.resultTextModelDiffs.removeDiffs(l,n,c);let{edit:u,effectiveState:p}=e.getEditForBase(t);s.accepted.set(p,n),s.previousNonDiffingState=void 0,s.computedFromDiffing=!1;let h=s.handledInput1.get(),g=s.handledInput2.get();(!h||!g)&&this.undoRedoService.pushElement(new Wui(this.resultTextModel.uri,new WeakRef(this),new WeakRef(s),h,g),c),u&&(this.resultTextModel.pushStackElement(),this.resultTextModelDiffs.applyEditRelativeToOriginal(u,n,c),this.resultTextModel.pushStackElement()),s.handledInput1.set(!0,n),s.handledInput2.set(!0,n)}resetDirtyConflictsToBase(){Ui(e=>{this.resultTextModel.pushStackElement();for(let t of this.modifiedBaseRanges.get())this.getState(t).get().kind===4&&this.setState(t,oS.base,!1,e,!1);this.resultTextModel.pushStackElement()})}isHandled(e){return this.modifiedBaseRangeResultStates.get().get(e).handled}isInputHandled(e,t){let o=this.modifiedBaseRangeResultStates.get().get(e);return t===1?o.handledInput1:o.handledInput2}setInputHandled(e,t,o,n){let r=this.modifiedBaseRangeResultStates.get().get(e);if(r.handled.get()===o)return;let s=new WeakRef(J_t),l=new WeakRef(this);this.undoRedoService.pushElement({type:0,resource:this.resultTextModel.uri,code:"setInputHandled",label:d(11529,null),redo(){let c=l.deref(),u=s.deref();c&&!c.isDisposed()&&u&&Ui(p=>{t===1?r.handledInput1.set(o,p):r.handledInput2.set(o,p)})},undo(){let c=l.deref(),u=s.deref();c&&!c.isDisposed()&&u&&Ui(p=>{t===1?r.handledInput1.set(!o,p):r.handledInput2.set(!o,p)})}}),t===1?r.handledInput1.set(o,n):r.handledInput2.set(o,n)}setHandled(e,t,o){let n=this.modifiedBaseRangeResultStates.get().get(e);n.handled.get()!==t&&(n.handledInput1.set(t,o),n.handledInput2.set(t,o))}setLanguageId(e,t){let o=this.languageService.createById(e);this.base.setLanguage(o,t),this.input1.textModel.setLanguage(o,t),this.input2.textModel.setLanguage(o,t),this.resultTextModel.setLanguage(o,t)}getInitialResultValue(){let e=[];for(;;){let t=this.resultSnapshot.read();if(t===null)break;e.push(t)}return e.join()}async getResultValueWithConflictMarkers(){if(await gf(this.diffComputingState,c=>c===2),this.unhandledConflictsCount.get()===0)return this.resultTextModel.getValue();let e=this.resultTextModel.getLinesContent(),t=this.input1.textModel.getLinesContent(),o=this.input2.textModel.getLinesContent(),n=this.modifiedBaseRangeResultStates.get(),r=[];function s(c,u){for(let p=u.startLineNumber;p<u.endLineNumberExclusive;p++)r.push(c[p-1])}let l=1;for(let[c,u]of n){if(u.handled.get())continue;let p=this.resultTextModelDiffs.getResultLineRange(c.baseRange);s(e,Qh.fromLineNumbers(l,Math.max(l,p.startLineNumber))),l=p.endLineNumberExclusive,r.push("<<<<<<<"),u.accepted.get().kind===4?s(e,p):s(t,c.input1Range),r.push("======="),s(o,c.input2Range),r.push(">>>>>>>")}return s(e,Qh.fromLineNumbers(l,e.length+1)),r.join(`
`)}get conflictCount(){return U_(this.modifiedBaseRanges.get(),e=>e.isConflicting)}get combinableConflictCount(){return U_(this.modifiedBaseRanges.get(),e=>e.isConflicting&&e.canBeCombined)}get conflictsResolvedWithBase(){return U_(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>e.isConflicting&&t.accepted.get().kind===0)}get conflictsResolvedWithInput1(){return U_(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>e.isConflicting&&t.accepted.get().kind===1)}get conflictsResolvedWithInput2(){return U_(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>e.isConflicting&&t.accepted.get().kind===2)}get conflictsResolvedWithSmartCombination(){return U_(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>{let o=t.accepted.get();return e.isConflicting&&o.kind===3&&o.smartCombination})}get manuallySolvedConflictCountThatEqualNone(){return U_(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>e.isConflicting&&t.accepted.get().kind===4)}get manuallySolvedConflictCountThatEqualSmartCombine(){return U_(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>{let o=t.accepted.get();return e.isConflicting&&t.computedFromDiffing&&o.kind===3&&o.smartCombination})}get manuallySolvedConflictCountThatEqualInput1(){return U_(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>{let o=t.accepted.get();return e.isConflicting&&t.computedFromDiffing&&o.kind===1})}get manuallySolvedConflictCountThatEqualInput2(){return U_(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>{let o=t.accepted.get();return e.isConflicting&&t.computedFromDiffing&&o.kind===2})}get manuallySolvedConflictCountThatEqualNoneAndStartedWithBase(){return U_(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>{let o=t.accepted.get();return e.isConflicting&&o.kind===4&&t.previousNonDiffingState?.kind===0})}get manuallySolvedConflictCountThatEqualNoneAndStartedWithInput1(){return U_(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>{let o=t.accepted.get();return e.isConflicting&&o.kind===4&&t.previousNonDiffingState?.kind===1})}get manuallySolvedConflictCountThatEqualNoneAndStartedWithInput2(){return U_(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>{let o=t.accepted.get();return e.isConflicting&&o.kind===4&&t.previousNonDiffingState?.kind===2})}get manuallySolvedConflictCountThatEqualNoneAndStartedWithBothNonSmart(){return U_(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>{let o=t.accepted.get();return e.isConflicting&&o.kind===4&&t.previousNonDiffingState?.kind===3&&!t.previousNonDiffingState?.smartCombination})}get manuallySolvedConflictCountThatEqualNoneAndStartedWithBothSmart(){return U_(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>{let o=t.accepted.get();return e.isConflicting&&o.kind===4&&t.previousNonDiffingState?.kind===3&&t.previousNonDiffingState?.smartCombination})}};Zce=I([m(7,kt),m(8,Cl)],Zce);function U_(a,i){let e=0;for(let t of a)i(t)&&e++;return e}var J_t=class{constructor(i){this.baseRange=i;this.accepted=Le(`BaseRangeState${this.baseRange.baseRange}`,oS.base),this.handledInput1=Le(`BaseRangeHandledState${this.baseRange.baseRange}.Input1`,!1),this.handledInput2=Le(`BaseRangeHandledState${this.baseRange.baseRange}.Input2`,!1),this.computedFromDiffing=!1,this.previousNonDiffingState=void 0,this.handled=Ce(this,e=>this.handledInput1.read(e)&&this.handledInput2.read(e))}};var Wui=class{constructor(i,e,t,o,n){this.resource=i;this.mergeEditorModelRef=e;this.stateRef=t;this.input1Handled=o;this.input2Handled=n;this.code="undoMarkAsHandled";this.label=d(11530,null);this.type=0}redo(){let i=this.mergeEditorModelRef.deref();if(!i||i.isDisposed())return;let e=this.stateRef.deref();e&&Ui(t=>{e.handledInput1.set(!0,t),e.handledInput2.set(!0,t)})}undo(){let i=this.mergeEditorModelRef.deref();if(!i||i.isDisposed())return;let e=this.stateRef.deref();e&&Ui(t=>{e.handledInput1.set(this.input1Handled,t),e.handledInput2.set(this.input2Handled,t)})}};var Ep=new Q("isMergeEditor",!1,{type:"boolean",description:d(11584,null)}),Z_t=new Q("isMergeResultEditor",!1,{type:"boolean",description:d(11585,null)}),nX=new Q("mergeEditorLayout","mixed",{type:"string",description:d(11583,null)}),Qke=new Q("mergeEditorShowBase",!1,{type:"boolean",description:d(11587,null)}),$Qe=new Q("mergeEditorShowBaseAtTop",!1,{type:"boolean",description:d(11588,null)}),eDt=new Q("mergeEditorShowNonConflictingChanges",!1,{type:"boolean",description:d(11589,null)}),tDt=new Q("mergeEditorBaseUri","",{type:"string",description:d(11582,null)}),zXi=new Q("mergeEditorResultUri","",{type:"string",description:d(11586,null)}),qQe="mergeEditorCloseWithConflicts";var Yke=class{constructor(i,e,t,o){this._mergeEditorTelemetry=i;this._instantiationService=e;this._textModelService=t;this._modelService=o}async createInputModel(i){let e=new P,[t,o,n,r]=await Promise.all([this._textModelService.createModelReference(i.base),this._textModelService.createModelReference(i.result),iDt(i.input1,this._textModelService,e),iDt(i.input2,this._textModelService,e)]);e.add(t),e.add(o);let s=o.object.textEditorModel.uri.with({scheme:"merge-result"}),l=this._modelService.createModel("",{languageId:o.object.textEditorModel.getLanguageId(),onDidChange:H.None},s);e.add(l);let c=this._instantiationService.createInstance(Yce),u=this._instantiationService.createInstance(Zce,t.object.textEditorModel,n,r,l,c,{resetResult:!0},this._mergeEditorTelemetry);return e.add(u),await u.onInitialized,this._instantiationService.createInstance(jQe,u,e,o.object,i.result)}};Yke=I([m(1,F),m(2,Nt),m(3,Ct)],Yke);var jQe=class extends gg{constructor(e,t,o,n,r,s,l){super();this.model=e;this.disposable=t;this.result=o;this.resultUri=n;this.textFileService=r;this.dialogService=s;this.editorService=l;this.savedAltVersionId=Le(this,this.model.resultTextModel.getAlternativeVersionId()),this.altVersionId=ui(this,c=>this.model.resultTextModel.onDidChangeContent(c),()=>this.model.resultTextModel.getAlternativeVersionId()),this.isDirty=Ce(this,c=>this.altVersionId.read(c)!==this.savedAltVersionId.read(c)),this.finished=!1}dispose(){this.disposable.dispose(),super.dispose()}async accept(){let e=await this.model.resultTextModel.getValue();this.result.textEditorModel.setValue(e),this.savedAltVersionId.set(this.model.resultTextModel.getAlternativeVersionId(),void 0),await this.textFileService.save(this.result.textEditorModel.uri),this.finished=!0}async _discard(){await this.textFileService.revert(this.model.resultTextModel.uri),this.savedAltVersionId.set(this.model.resultTextModel.getAlternativeVersionId(),void 0),this.finished=!0}shouldConfirmClose(){return!0}async confirmClose(e){eh(()=>e.some(n=>n===this));let t=e.some(n=>n.isDirty.get()),o;if(t){let n=e.length>1,r=n?d(11506,null,e.length):d(11505,null,Ye(e[0].model.resultTextModel.uri)),s=e.some(c=>c.model.hasUnhandledConflicts.get()),l=[{label:s?d(11511,null):d(11508,null),run:()=>0},{label:d(11503,null),run:()=>1}];o=(await this.dialogService.prompt({type:gt.Info,message:r,detail:s?n?d(11502,null):d(11500,null):n?d(11501,null):d(11499,null),buttons:l,cancelButton:{run:()=>2}})).result}else o=1;return o===0?await Promise.all(e.map(n=>n.accept())):o===1&&await Promise.all(e.map(n=>n._discard())),o}async save(e){this.finished||(async()=>{let{confirmed:t}=await this.dialogService.confirm({message:d(11510,null),detail:d(11509,null),primaryButton:d(11498,null)});if(t){await this.accept();let o=this.editorService.findEditors(this.resultUri).filter(n=>n.editor.typeId==="mergeEditor.Input");await this.editorService.closeEditors(o)}})()}async revert(e){}};jQe=I([m(4,Ho),m(5,ct),m(6,ee)],jQe);var rX=class{constructor(i,e,t,o,n,r){this._mergeEditorTelemetry=i;this._instantiationService=e;this._textModelService=t;this.textFileService=o;this._modelService=n;this._languageService=r}static{this.FILE_SAVED_SOURCE=ph.registerSource("merge-editor.source",d(11504,null))}async createInputModel(i){let e=new P,[t,o,n,r]=await Promise.all([this._textModelService.createModelReference(i.base).then(g=>({object:g.object.textEditorModel,dispose:()=>g.dispose()})).catch(g=>{mt(g),console.error(g)}),this._textModelService.createModelReference(i.result),iDt(i.input1,this._textModelService,e),iDt(i.input2,this._textModelService,e)]);if(t===void 0){let g=this._modelService.createModel("",this._languageService.createById(o.object.getLanguageId()));t={dispose:()=>{g.dispose()},object:g}}e.add(t),e.add(o);let s=this.textFileService.files.models.find(g=>g.resource.toString()===o.object.textEditorModel.uri.toString());if(!s)throw new ni;await s.save({source:rX.FILE_SAVED_SOURCE});let u=s.textEditorModel.getLinesContent().some(g=>g.startsWith(FXi.start)),p=this._instantiationService.createInstance(Yce),h=this._instantiationService.createInstance(Zce,t.object,n,r,o.object.textEditorModel,p,{resetResult:u},this._mergeEditorTelemetry);return e.add(h),await h.onInitialized,this._instantiationService.createInstance(QQe,h,e,s,this._mergeEditorTelemetry)}};rX=I([m(1,F),m(2,Nt),m(3,Ho),m(4,Ct),m(5,kt)],rX);var QQe=class extends gg{constructor(e,t,o,n,r,s){super();this.model=e;this.disposableStore=t;this.resultTextFileModel=o;this.telemetry=n;this._dialogService=r;this._storageService=s;this.isDirty=ui(this,H.any(this.resultTextFileModel.onDidChangeDirty,this.resultTextFileModel.onDidSaveError),()=>this.resultTextFileModel.isDirty()),this.reported=!1,this.dateTimeOpened=new Date}dispose(){this.disposableStore.dispose(),super.dispose(),this.reportClose(!1)}reportClose(e){if(!this.reported){let t=this.model.unhandledConflictsCount.get(),o=new Date().getTime()-this.dateTimeOpened.getTime();this.telemetry.reportMergeEditorClosed({durationOpenedSecs:o/1e3,remainingConflictCount:t,accepted:e,conflictCount:this.model.conflictCount,combinableConflictCount:this.model.combinableConflictCount,conflictsResolvedWithBase:this.model.conflictsResolvedWithBase,conflictsResolvedWithInput1:this.model.conflictsResolvedWithInput1,conflictsResolvedWithInput2:this.model.conflictsResolvedWithInput2,conflictsResolvedWithSmartCombination:this.model.conflictsResolvedWithSmartCombination,manuallySolvedConflictCountThatEqualNone:this.model.manuallySolvedConflictCountThatEqualNone,manuallySolvedConflictCountThatEqualSmartCombine:this.model.manuallySolvedConflictCountThatEqualSmartCombine,manuallySolvedConflictCountThatEqualInput1:this.model.manuallySolvedConflictCountThatEqualInput1,manuallySolvedConflictCountThatEqualInput2:this.model.manuallySolvedConflictCountThatEqualInput2,manuallySolvedConflictCountThatEqualNoneAndStartedWithBase:this.model.manuallySolvedConflictCountThatEqualNoneAndStartedWithBase,manuallySolvedConflictCountThatEqualNoneAndStartedWithInput1:this.model.manuallySolvedConflictCountThatEqualNoneAndStartedWithInput1,manuallySolvedConflictCountThatEqualNoneAndStartedWithInput2:this.model.manuallySolvedConflictCountThatEqualNoneAndStartedWithInput2,manuallySolvedConflictCountThatEqualNoneAndStartedWithBothNonSmart:this.model.manuallySolvedConflictCountThatEqualNoneAndStartedWithBothNonSmart,manuallySolvedConflictCountThatEqualNoneAndStartedWithBothSmart:this.model.manuallySolvedConflictCountThatEqualNoneAndStartedWithBothSmart}),this.reported=!0}}async accept(){this.reportClose(!0),await this.resultTextFileModel.save()}get resultUri(){return this.resultTextFileModel.resource}async save(e){await this.resultTextFileModel.save(e)}async revert(e){await this.resultTextFileModel.revert(e)}shouldConfirmClose(){return!0}async confirmClose(e){let t=e.length>1,o=e.some(r=>r.isDirty.get()),n=e.some(r=>r.model.hasUnhandledConflicts.get());if(o){let r=t?d(11523,null,e.length):d(11521,null,Ye(e[0].resultUri)),{result:s}=await this._dialogService.prompt({type:gt.Info,message:r,detail:n?t?d(11518,null):d(11515,null):t?d(11517,null):d(11514,null),buttons:[{label:n?d(11526,null):d(11525,null),run:()=>0},{label:d(11520,null),run:()=>1}],cancelButton:{run:()=>2}});return s}else if(n&&!this._storageService.getBoolean(qQe,0,!1)){let{confirmed:r,checkboxChecked:s}=await this._dialogService.confirm({message:t?d(11524,null,e.length):d(11522,null,Ye(e[0].resultUri)),detail:n?t?d(11519,null):d(11516,null):void 0,primaryButton:n?d(11513,null):d(11512,null),checkbox:{label:d(11507,null)}});return s&&this._storageService.store(qQe,!0,0,0),r?0:2}else return 0}};QQe=I([m(4,ct),m(5,le)],QQe);async function iDt(a,i,e){let t=await i.createModelReference(a.uri);return e.add(t),{textModel:t.object.textEditorModel,title:a.title,description:a.description,detail:a.detail}}var Xke=class{constructor(i){this.telemetryService=i}reportMergeEditorOpened(i){this.telemetryService.publicLog2("mergeEditor.opened",{conflictCount:i.conflictCount,combinableConflictCount:i.combinableConflictCount,baseVisible:i.baseVisible,isColumnView:i.isColumnView,baseTop:i.baseTop})}reportLayoutChange(i){this.telemetryService.publicLog2("mergeEditor.layoutChanged",{baseVisible:i.baseVisible,isColumnView:i.isColumnView,baseTop:i.baseTop})}reportMergeEditorClosed(i){this.telemetryService.publicLog2("mergeEditor.closed",{conflictCount:i.conflictCount,combinableConflictCount:i.combinableConflictCount,durationOpenedSecs:i.durationOpenedSecs,remainingConflictCount:i.remainingConflictCount,accepted:i.accepted,conflictsResolvedWithBase:i.conflictsResolvedWithBase,conflictsResolvedWithInput1:i.conflictsResolvedWithInput1,conflictsResolvedWithInput2:i.conflictsResolvedWithInput2,conflictsResolvedWithSmartCombination:i.conflictsResolvedWithSmartCombination,manuallySolvedConflictCountThatEqualNone:i.manuallySolvedConflictCountThatEqualNone,manuallySolvedConflictCountThatEqualSmartCombine:i.manuallySolvedConflictCountThatEqualSmartCombine,manuallySolvedConflictCountThatEqualInput1:i.manuallySolvedConflictCountThatEqualInput1,manuallySolvedConflictCountThatEqualInput2:i.manuallySolvedConflictCountThatEqualInput2,manuallySolvedConflictCountThatEqualNoneAndStartedWithBase:i.manuallySolvedConflictCountThatEqualNoneAndStartedWithBase,manuallySolvedConflictCountThatEqualNoneAndStartedWithInput1:i.manuallySolvedConflictCountThatEqualNoneAndStartedWithInput1,manuallySolvedConflictCountThatEqualNoneAndStartedWithInput2:i.manuallySolvedConflictCountThatEqualNoneAndStartedWithInput2,manuallySolvedConflictCountThatEqualNoneAndStartedWithBothNonSmart:i.manuallySolvedConflictCountThatEqualNoneAndStartedWithBothNonSmart,manuallySolvedConflictCountThatEqualNoneAndStartedWithBothSmart:i.manuallySolvedConflictCountThatEqualNoneAndStartedWithBothSmart})}reportAcceptInvoked(i,e){this.telemetryService.publicLog2("mergeEditor.action.accept",{otherAccepted:e,isInput1:i===1})}reportSmartCombinationInvoked(i){this.telemetryService.publicLog2("mergeEditor.action.smartCombination",{otherAccepted:i})}reportRemoveInvoked(i,e){this.telemetryService.publicLog2("mergeEditor.action.remove",{otherAccepted:e,isInput1:i===1})}reportResetToBaseInvoked(){this.telemetryService.publicLog2("mergeEditor.action.resetToBase",{})}reportNavigationToNextConflict(){this.telemetryService.publicLog2("mergeEditor.action.goToNextConflict",{})}reportNavigationToPreviousConflict(){this.telemetryService.publicLog2("mergeEditor.action.goToPreviousConflict",{})}reportConflictCounterClicked(){this.telemetryService.publicLog2("mergeEditor.action.conflictCounterClicked",{})}};Xke=I([m(0,Te)],Xke);var a5=class{constructor(i,e,t,o){this.uri=i;this.title=e;this.detail=t;this.description=o}},hb=class extends ek{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super(n,void 0,s,l,c,u,h,g,f);this.base=e;this.input1=t;this.input2=o;this.result=n;this._instaService=r;this.configurationService=p;this.logService=v;this._focusedEditor="result",this.closeHandler={showConfirm:()=>this._inputModel?.shouldConfirmClose()??!1,confirm:async b=>{eh(()=>b.every(y=>y.editor instanceof hb));let S=b.map(y=>y.editor._inputModel).filter(mo);return await this._inputModel.confirmClose(S)}},this.mergeEditorModeFactory=this._instaService.createInstance(this.useWorkingCopy?Yke:rX,this._instaService.createInstance(Xke))}static{this.ID="mergeEditor.Input"}get useWorkingCopy(){return this.configurationService.getValue("mergeEditor.useWorkingCopy")??!1}dispose(){super.dispose()}get typeId(){return hb.ID}get editorId(){return Ys.id}get capabilities(){let e=super.capabilities|256;return this.useWorkingCopy&&(e|=4),e}getName(){return d(11497,null,super.getName())}async resolve(){if(!this._inputModel){let e=this._register(await this.mergeEditorModeFactory.createInputModel({base:this.base,input1:this.input1,input2:this.input2,result:this.result}));this._inputModel=e,this._register(he(t=>{e.isDirty.read(t),this._onDidChangeDirty.fire()})),await this._inputModel.model.onInitialized}return this._inputModel}async accept(){await this._inputModel?.accept()}async save(e,t){await this._inputModel?.save(t)}toUntyped(){return{input1:{resource:this.input1.uri,label:this.input1.title,description:this.input1.description,detail:this.input1.detail},input2:{resource:this.input2.uri,label:this.input2.title,description:this.input2.description,detail:this.input2.detail},base:{resource:this.base},result:{resource:this.result},options:{override:this.typeId}}}matches(e){return this===e?!0:e instanceof hb?Xe(this.base,e.base)&&Xe(this.input1.uri,e.input1.uri)&&Xe(this.input2.uri,e.input2.uri)&&Xe(this.result,e.result):dC(e)?(this.editorId===e.options?.override||e.options?.override===void 0)&&Xe(this.base,e.base.resource)&&Xe(this.input1.uri,e.input1.resource)&&Xe(this.input2.uri,e.input2.resource)&&Xe(this.result,e.result.resource):!1}async revert(e,t){return this._inputModel?.revert(t)}isDirty(){return this._inputModel?.isDirty.get()??!1}setLanguageId(e,t){this._inputModel?.model.setLanguageId(e,t)}updateFocusedEditor(e){this._focusedEditor!==e&&(this._focusedEditor=e,this.logService.trace("alertFocusedEditor",e),rzo(e))}};hb=I([m(4,F),m(5,ee),m(6,Ho),m(7,ot),m(8,be),m(9,B),m(10,lr),m(11,Nn),m(12,Sv),m(13,ne)],hb);function rzo(a){switch(a){case"input1":Jo(d(11494,null));break;case"input2":Jo(d(11495,null));break;case"result":Jo(d(11496,null));break}}var Jke=class extends C{constructor(e,t){super();this.model=e;this._instantiationService=t;this._documents=Pre(this.model,this.model.documents),this._documentsArr=Ce(this,o=>{let n=this._documents.read(o);return n==="loading"?[]:n}),this.isLoading=Ce(this,o=>this._documents.read(o)==="loading"),this.items=$v(this,this._documentsArr,(o,n)=>n.add(this._instantiationService.createInstance(YQe,o,this))).recomputeInitiallyAndOnChange(this._store),this.focusedDiffItem=Ce(this,o=>this.items.read(o).find(n=>n.isFocused.read(o))),this.activeDiffItem=TGe(this,(o,n)=>this.focusedDiffItem.read(o)??(n&&this.items.read(o).indexOf(n)!==-1)?n:void 0)}async waitForDiffs(){for(let e of this.items.get())await e.diffEditorViewModel.waitForDiff()}collapseAll(){Ui(e=>{for(let t of this.items.get())t.collapsed.set(!0,e)})}expandAll(){Ui(e=>{for(let t of this.items.get())t.collapsed.set(!1,e)})}get contextKeys(){return this.model.contextKeys}},YQe=class extends C{constructor(e,t,o,n){super();this._editorViewModel=t;this._instantiationService=o;this._modelService=n;this.collapsed=Le(this,!1);this.lastTemplateData=Le(this,{contentHeight:500,selections:void 0});this.isActive=Ce(this,e=>this._editorViewModel.activeDiffItem.read(e)===this);this._isFocusedSource=Le(this,Oo(!1));this.isFocused=Ce(this,e=>this._isFocusedSource.read(e).read(e));this.isAlive=Le(this,!0);this._register(Z(()=>{this.isAlive.set(!1,void 0)})),this.documentDiffItemRef=this._register(e.createNewRef(this));function r(p){return{...p,hideUnchangedRegions:{enabled:!0}}}let s=this._instantiationService.createInstance(Z9,r(this.documentDiffItem.options||{}));this.documentDiffItem.onOptionsDidChange&&this._register(this.documentDiffItem.onOptionsDidChange(()=>{s.updateOptions(r(this.documentDiffItem.options||{}))}));let l=new P,c=this.documentDiffItem.original??l.add(this._modelService.createModel("",null)),u=this.documentDiffItem.modified??l.add(this._modelService.createModel("",null));l.add(this.documentDiffItemRef.createNewRef(this)),this.diffEditorViewModelRef=this._register(CW.createWithDisposable(this._instantiationService.createInstance(Y9,{original:c,modified:u},s),l,this))}get diffEditorViewModel(){return this.diffEditorViewModelRef.object}get originalUri(){return this.documentDiffItem.original?.uri}get modifiedUri(){return this.documentDiffItem.modified?.uri}setIsFocused(e,t){this._isFocusedSource.set(e,t)}get documentDiffItem(){return this.documentDiffItemRef.object}getKey(){return JSON.stringify([this.originalUri?.toString(),this.modifiedUri?.toString()])}};YQe=I([m(2,F),m(3,Ct)],YQe);var KXi=Re("multi-diff-editor-label-icon",M.diffMultiple,d(11611,null));var Rz=ae("multiDiffSourceResolverService"),ik=class{constructor(i,e,t,o,n){this.originalUri=i;this.modifiedUri=e;this.goToFileUri=t;this.goToFileEditorTitle=o;this.contextKeys=n;if(!i&&!e)throw new ni("Invalid arguments")}getKey(){return JSON.stringify([this.modifiedUri?.toString(),this.originalUri?.toString()])}},oDt=class{constructor(){this._resolvers=new Set}registerResolver(i){if(this._resolvers.has(i))throw new ni("Duplicate resolver");return this._resolvers.add(i),Z(()=>this._resolvers.delete(i))}resolve(i){for(let e of this._resolvers)if(e.canHandleUri(i))return e.resolveDiffSource(i);return Promise.resolve(void 0)}};var xu=class extends Us{constructor(e,t,o,n=!1,r,s,l,c,u){super();this.multiDiffSource=e;this.label=t;this.initialResources=o;this.isTransient=n;this._textModelService=r;this._textResourceConfigurationService=s;this._instantiationService=l;this._multiDiffSourceResolverService=c;this._textFileService=u;this._name="",this._viewModel=new xpt(async()=>{let p=await this._createModel();this._register(p);let h=new Jke(p,this._instantiationService);return this._register(h),await Wp(h.waitForDiffs(),1e3),h}),this._resolvedSource=new kGe(async()=>{let p=this.initialResources?{resources:fbe.const(this.initialResources)}:await this._multiDiffSourceResolverService.resolve(this.multiDiffSource);return{source:p,resources:p?Pre(this,p.resources):Oo([])}}),this.resources=Ce(this,p=>this._resolvedSource.cachedPromiseResult.read(p)?.data?.resources.read(p)),this.textFileServiceOnDidChange=new Vui(this._textFileService.files.onDidChangeDirty,p=>p.resource.toString(),p=>p.toString()),this._isDirtyObservables=$v(this,this.resources.map(p=>p??[]),p=>{let h=p.modifiedUri?GXi(this.textFileServiceOnDidChange,this._textFileService,p.modifiedUri):Oo(!1),g=p.originalUri?GXi(this.textFileServiceOnDidChange,this._textFileService,p.originalUri):Oo(!1);return Ce(f=>h.read(f)||g.read(f))},p=>p.getKey()),this._isDirtyObservable=Ce(this,p=>this._isDirtyObservables.read(p).some(h=>h.read(p))).keepObserved(this._store),this.onDidChangeDirty=H.fromObservableLight(this._isDirtyObservable),this.closeHandler={async confirm(){return 1},showConfirm(){return!1}},this._register(he(p=>{let h=this.resources.read(p),g=this.label??d(11613,null);h&&h.length===1?this._name=d(11615,null,g):h?this._name=d(11614,null,g,h.length):this._name=g,this._onDidChangeLabel.fire()}))}static fromResourceMultiDiffEditorInput(e,t){if(!e.multiDiffSource&&!e.resources)throw new ni("MultiDiffEditorInput requires either multiDiffSource or resources");let o=e.multiDiffSource??A.parse(`multi-diff-editor:${new Date().getMilliseconds().toString()+Math.random().toString()}`);return t.createInstance(xu,o,e.label,e.resources?.map(n=>new ik(n.original.resource,n.modified.resource,n.goToFileResource)),e.isTransient??!1)}static fromSerialized(e,t){return t.createInstance(xu,A.parse(e.multiDiffSourceUri),e.label,e.resources?.map(o=>new ik(o.originalUri?A.parse(o.originalUri):void 0,o.modifiedUri?A.parse(o.modifiedUri):void 0,o.goToFileUri?A.parse(o.goToFileUri):void 0)),!1)}static{this.ID="workbench.input.multiDiffEditor"}get resource(){return this.multiDiffSource}get capabilities(){return 2}get typeId(){return xu.ID}getName(){return this._name}get editorId(){return Ys.id}getIcon(){return KXi}serialize(){return{label:this.label,multiDiffSourceUri:this.multiDiffSource.toString(),resources:this.initialResources?.map(e=>({originalUri:e.originalUri?.toString(),modifiedUri:e.modifiedUri?.toString(),goToFileUri:e.goToFileUri?.toString()}))}}setLanguageId(e,t){let n=this._viewModel.requireValue().activeDiffItem.get()?.documentDiffItem;if(!n)return;let r=n.modified??n.original;r&&r.setLanguage(e,t)}async getViewModel(){return this._viewModel.getPromise()}async _createModel(){let e=await this._resolvedSource.getPromise(),t=this._textResourceConfigurationService,o=$v(this,e.resources,async(c,u)=>{let p,h,g=new P;try{[p,h]=await Promise.all([c.originalUri?this._textModelService.createModelReference(c.originalUri):void 0,c.modifiedUri?this._textModelService.createModelReference(c.modifiedUri):void 0]),p&&g.add(p),h&&g.add(h)}catch(b){console.error(b),mt(b);return}let f=c.modifiedUri??c.originalUri,v={multiDiffEditorItem:c,original:p?.object.textEditorModel,modified:h?.object.textEditorModel,contextKeys:c.contextKeys,get options(){return{...szo(h?.object.isReadonly()??!0),...azo(t.getValue(f))}},onOptionsDidChange:b=>this._textResourceConfigurationService.onDidChangeConfiguration(S=>{(S.affectsConfiguration(f,"editor")||S.affectsConfiguration(f,"diffEditor"))&&b()})};return u.add(CW.createOfNonDisposable(v,g,this))},c=>JSON.stringify([c.modifiedUri?.toString(),c.originalUri?.toString()])),n=Le("documents","loading"),r=Ce(async c=>{let u=o.read(c),h=(await Promise.all(u)).filter(mo);n.set(h,void 0)}),s=EM(r);return await r.get(),{dispose:()=>s.dispose(),documents:new pN(n),contextKeys:e.source?.contextKeys}}matches(e){return super.matches(e)?!0:e instanceof xu?this.multiDiffSource.toString()===e.multiDiffSource.toString():!1}isDirty(){return this._isDirtyObservable.get()}async save(e,t){return await this.doSaveOrRevert("save",e,t),this}revert(e,t){return this.doSaveOrRevert("revert",e,t)}async doSaveOrRevert(e,t,o){let n=this._viewModel.currentValue?.items.get();n&&await Promise.all(n.map(async r=>{let s=r.diffEditorViewModel.model,l=s.original.uri.scheme!==Y.untitled&&this._textFileService.isDirty(s.original.uri);await Promise.all([l?e==="save"?this._textFileService.save(s.original.uri,o):this._textFileService.revert(s.original.uri,o):Promise.resolve(),e==="save"?this._textFileService.save(s.modified.uri,o):this._textFileService.revert(s.modified.uri,o)])}))}};xu=I([m(4,Nt),m(5,Nn),m(6,F),m(7,Rz),m(8,Ho)],xu);var Vui=class{constructor(i,e,t){this._event=i;this._getEventArgsKey=e;this._keyToString=t;this._count=0;this._buckets=new Map;this._handleEventChange=i=>{let e=this._getEventArgsKey(i),t=this._buckets.get(e);if(t)for(let o of t)o(i)}}filteredEvent(i){return e=>{let t=this._keyToString(i),o=this._buckets.get(t);return o||(o=new Set,this._buckets.set(t,o)),o.add(e),this._count++,this._count===1&&(this._eventSubscription=this._event(this._handleEventChange)),{dispose:()=>{o.delete(e),o.size===0&&this._buckets.delete(t),this._count--,this._count===0&&(this._eventSubscription?.dispose(),this._eventSubscription=void 0)}}}}};function GXi(a,i,e){return ui(a.filteredEvent(e),()=>i.isDirty(e))}function szo(a){return{readOnly:!!a,readOnlyMessage:typeof a!="boolean"?a:void 0}}function azo(a){let i=Xi(a.editor);if(yi(a.diffEditor)){let e=Xi(a.diffEditor);e.diffCodeLens=e.codeLens,delete e.codeLens,e.diffWordWrap=e.wordWrap,delete e.wordWrap,Object.assign(i,e)}return i}var ede=class extends C{static{this.ID="workbench.contrib.multiDiffEditorResolver"}constructor(i,e){super(),this._register(i.registerEditor("*",{id:Ys.id,label:Ys.displayName,detail:Ys.providerDisplayName,priority:"builtin"},{},{createMultiDiffEditorInput:t=>({editor:xu.fromResourceMultiDiffEditorInput(t,e)})}))}};ede=I([m(0,ul),m(1,F)],ede);var nDt=class{canSerialize(i){return i instanceof xu&&!i.isTransient}serialize(i){if(this.canSerialize(i))return JSON.stringify(i.serialize())}deserialize(i,e){try{let t=zg(e);return xu.fromSerialized(t,i)}catch(t){mt(t);return}}};var Yo=ae("terminalService"),ku=ae("terminalConfigurationService"),xv=ae("terminalEditorService"),sX=ae("terminalEditingService"),jl=ae("terminalGroupService"),xm=ae("terminalInstanceService"),kv=ae("terminalChatService");var dR=a=>!Xo(a.instanceId),tde=class extends MouseEvent{},Mz="terminalEditor";var $Xi=["workbench.action.terminal.focusAccessibleBuffer"];var qXi={"terminal.integrated.accessibleViewPreserveCursorPosition":{markdownDescription:d(14534,null),type:"boolean",default:!1},"terminal.integrated.accessibleViewFocusOnCommandExecution":{markdownDescription:d(14533,null),type:"boolean",default:!1}};var jXi={"terminal.integrated.autoReplies":{markdownDescription:d(14535,null,'`"Terminate batch job (Y/N)": "Y\\r"`','`"\\r"`'),type:"object",additionalProperties:{oneOf:[{type:"string",description:d(14536,null)},{type:"null"}]},restricted:!0,default:{}}};var QXi=D.for("terminalChatWidget"),jO=D.for("terminalChatWidget.status"),g0a=D.for("terminalChatWidget.toolbar");var Ba;(c=>(c.focused=new Q("terminalChatFocus",!1,d(14538,null)),c.visible=new Q("terminalChatVisible",!1,d(14543,null)),c.requestActive=new Q("terminalChatActiveRequest",!1,d(14540,null)),c.inputHasText=new Q("terminalChatInputHasText",!1,d(14539,null)),c.responseContainsCodeBlock=new Q("terminalChatResponseContainsCodeBlock",!1,d(14541,null)),c.responseContainsMultipleCodeBlocks=new Q("terminalChatResponseContainsMultipleCodeBlocks",!1,d(14542,null)),c.hasChatAgent=new Q("terminalChatAgentRegistered",!1,d(14537,null)),c.hasChatTerminals=new Q("hasChatTerminals",!1,d(14544,null)),c.hasHiddenChatTerminals=new Q("hasHiddenChatTerminals",!1,d(14545,null))))(Ba||={});var S0a=ae("ptyService");var SV={Backend:"workbench.contributions.terminal.processBackend"},Bui=class{constructor(){this._backends=new Map}get backends(){return this._backends}registerTerminalBackend(i){let e=this._sanitizeRemoteAuthority(i.remoteAuthority);if(this._backends.has(e))throw new Error(`A terminal backend with remote authority '${e}' was already registered.`);this._backends.set(e,i)}getTerminalBackend(i){return this._backends.get(this._sanitizeRemoteAuthority(i))}_sanitizeRemoteAuthority(i){return i?.toLowerCase()??""}};oe.add(SV.Backend,new Bui);var rDt=ae("localPtyService"),Xs=ae("terminalLogService");var YXi={"terminal.integrated.initialHint":{restricted:!0,markdownDescription:d(14826,null,"`#terminal.integrated.sendKeybindingsToShell#`"),type:"boolean",default:!0}};function sDt(a,i){let e=[{name:null,description:d(2334,null)}];return e.push(...a.map(t=>({name:t.profileName,description:lzo(t)}))),i&&e.push(...i.map(t=>({name:t.title,description:czo(t)}))),{values:e.map(t=>t.name),markdownDescriptions:e.map(t=>t.description)}}function lzo(a){let i=`$(${q.isThemeIcon(a.icon)?a.icon.id:a.icon?a.icon:M.terminal.id}) ${a.profileName}
- path: ${a.path}`;return a.args&&(Ae(a.args)?i+=`
- args: "${a.args}"`:i+=`
- args: [${a.args.length===0?"":`'${a.args.join("','")}'`}]`),a.overrideName!==void 0&&(i+=`
- overrideName: ${a.overrideName}`),a.color&&(i+=`
- color: ${a.color}`),a.env&&(i+=`
- env: ${JSON.stringify(a.env)}`),i}function czo(a){return`$(${q.isThemeIcon(a.icon)?a.icon.id:a.icon?a.icon:M.terminal.id}) ${a.title}
- extensionIdentifier: ${a.extensionIdentifier}`}function XXi(a,i){if(!a&&!i)return!0;if(Ae(a)&&Ae(i))return a===i;if(Array.isArray(a)&&Array.isArray(i)){if(a.length!==i.length)return!1;for(let e=0;e<a.length;e++)if(a[e]!==i[e])return!1;return!0}return!1}function JXi(a,i){if(!a&&!i)return!0;if(!a||!i)return!1;if(q.isThemeIcon(a)&&q.isThemeIcon(i))return a.id===i.id&&a.color===i.color;if(yi(a)&&!A.isUri(a)&&!q.isThemeIcon(a)&&yi(i)&&!A.isUri(i)&&!q.isThemeIcon(i)){let e=a,t=i;if((A.isUri(e.light)||oh(e.light))&&(A.isUri(e.dark)||oh(e.dark))&&(A.isUri(t.light)||oh(t.light))&&(A.isUri(t.dark)||oh(t.dark)))return e.light.path===t.light.path&&e.dark.path===t.dark.path}if(A.isUri(a)&&A.isUri(i)||oh(a)||oh(i)){let e=a,t=i;return e.path===t.path&&e.scheme===t.scheme}return!1}var Gui={type:["string","null"],enum:["terminal.ansiBlack","terminal.ansiRed","terminal.ansiGreen","terminal.ansiYellow","terminal.ansiBlue","terminal.ansiMagenta","terminal.ansiCyan","terminal.ansiWhite"],default:null},$ui={type:"string",enum:Array.from(k$(),a=>a.id),markdownEnumDescriptions:Array.from(k$(),a=>`$(${a.id})`)},aX={args:{description:d(2318,null),type:"array",items:{type:"string"}},icon:{description:d(2321,null),...$ui},color:{description:d(2319,null),...Gui},env:{markdownDescription:d(2320,null),type:"object",additionalProperties:{type:["string","null"]},default:{}}},Hui={type:"object",required:["path"],properties:{path:{description:d(2329,null),type:["string","array"],items:{type:"string"}},overrideName:{description:d(2328,null),type:"boolean"},...aX}},Uui={type:"object",required:["path"],properties:{path:{description:d(2316,null),type:["string"],items:{type:"string"}},...aX}};function zui(a){let i=a===2?"linux":a===1?"osx":"windows";return d(2313,null,LT(a),'```json\n"terminal.integrated.profile.'+i+'": {\n "bash": null\n}\n```',"[","](https://code.visualstudio.com/docs/terminal/profiles)")}var dzo={id:"terminal",order:100,title:d(2317,null),type:"object",properties:{"terminal.integrated.automationProfile.linux":{restricted:!0,markdownDescription:d(2304,null),type:["object","null"],default:null,anyOf:[{type:"null"},Uui],defaultSnippets:[{body:{path:"${1}",icon:"${2}"}}]},"terminal.integrated.automationProfile.osx":{restricted:!0,markdownDescription:d(2305,null),type:["object","null"],default:null,anyOf:[{type:"null"},Uui],defaultSnippets:[{body:{path:"${1}",icon:"${2}"}}]},"terminal.integrated.automationProfile.windows":{restricted:!0,markdownDescription:d(2306,null,"`terminal.integrated.automationShell.windows`"),type:["object","null"],default:null,anyOf:[{type:"null"},Uui],defaultSnippets:[{body:{path:"${1}",icon:"${2}"}}]},"terminal.integrated.profiles.windows":{restricted:!0,markdownDescription:zui(3),type:"object",default:{PowerShell:{source:"PowerShell",icon:M.terminalPowershell.id},"Command Prompt":{path:["${env:windir}\\Sysnative\\cmd.exe","${env:windir}\\System32\\cmd.exe"],args:[],icon:M.terminalCmd.id},"Git Bash":{source:"Git Bash",icon:M.terminalGitBash.id}},additionalProperties:{anyOf:[{type:"object",required:["source"],properties:{source:{description:d(2333,null),enum:["PowerShell","Git Bash"]},...aX}},{type:"object",required:["extensionIdentifier","id","title"],properties:{extensionIdentifier:{description:d(2331,null),type:"string"},id:{description:d(2330,null),type:"string"},title:{description:d(2332,null),type:"string"},...aX}},{type:"null"},Hui]}},"terminal.integrated.profiles.osx":{restricted:!0,markdownDescription:zui(1),type:"object",default:{bash:{path:"bash",args:["-l"],icon:M.terminalBash.id},zsh:{path:"zsh",args:["-l"]},fish:{path:"fish",args:["-l"]},tmux:{path:"tmux",icon:M.terminalTmux.id},pwsh:{path:"pwsh",icon:M.terminalPowershell.id}},additionalProperties:{anyOf:[{type:"object",required:["extensionIdentifier","id","title"],properties:{extensionIdentifier:{description:d(2326,null),type:"string"},id:{description:d(2325,null),type:"string"},title:{description:d(2327,null),type:"string"},...aX}},{type:"null"},Hui]}},"terminal.integrated.profiles.linux":{restricted:!0,markdownDescription:zui(2),type:"object",default:{bash:{path:"bash",icon:M.terminalBash.id},zsh:{path:"zsh"},fish:{path:"fish"},tmux:{path:"tmux",icon:M.terminalTmux.id},pwsh:{path:"pwsh",icon:M.terminalPowershell.id}},additionalProperties:{anyOf:[{type:"object",required:["extensionIdentifier","id","title"],properties:{extensionIdentifier:{description:d(2323,null),type:"string"},id:{description:d(2322,null),type:"string"},title:{description:d(2324,null),type:"string"},...aX}},{type:"null"},Hui]}},"terminal.integrated.useWslProfiles":{description:d(2315,null),type:"boolean",default:!0},"terminal.integrated.inheritEnv":{scope:1,description:d(2311,null),type:"boolean",default:!0},"terminal.integrated.persistentSessionScrollback":{scope:1,markdownDescription:d(2312,null),type:"number",default:100},"terminal.integrated.showLinkHover":{scope:1,description:d(2314,null),type:"boolean",default:!0},"terminal.integrated.ignoreProcessNames":{markdownDescription:d(2307,null,"`#terminal.integrated.confirmOnKill#`"),type:"array",items:{type:"string",uniqueItems:!0},default:["starship","oh-my-posh","bash","zsh"]}}};function ZXi(){oe.as(ii.Configuration).registerConfiguration(dzo),qui()}var Kui;function qui(a,i){let e=oe.as(ii.Configuration),t;a&&(t=sDt(a?.profiles,i));let o=Kui;Kui={id:"terminal",order:100,title:d(2317,null),type:"object",properties:{"terminal.integrated.defaultProfile.linux":{restricted:!0,markdownDescription:d(2308,null),type:["string","null"],default:null,enum:a?.os===3?t?.values:void 0,markdownEnumDescriptions:a?.os===3?t?.markdownDescriptions:void 0},"terminal.integrated.defaultProfile.osx":{restricted:!0,markdownDescription:d(2309,null),type:["string","null"],default:null,enum:a?.os===2?t?.values:void 0,markdownEnumDescriptions:a?.os===2?t?.markdownDescriptions:void 0},"terminal.integrated.defaultProfile.windows":{restricted:!0,markdownDescription:d(2310,null),type:["string","null"],default:null,enum:a?.os===1?t?.values:void 0,markdownEnumDescriptions:a?.os===1?t?.markdownDescriptions:void 0}}},e.updateConfigurations({add:[Kui],remove:o?[o]:[]})}var eJi={type:"boolean",enum:[!0,!1],enumDescriptions:[d(14703,null),d(14697,null)],description:d(14698,null)},jui={type:"object",required:["path"],properties:{path:{description:d(14725,null),type:"string"},...aX}},Qui={"chat.tools.terminal.enableAutoApprove":{description:d(14704,null),type:"boolean",default:!0,policy:{name:"ChatToolsTerminalEnableAutoApprove",category:"IntegratedTerminal",minimumVersion:"1.104",localization:{description:{key:"autoApproveMode.description",value:d(14704,null)}}}},"chat.tools.terminal.autoApprove":{markdownDescription:[d(14694,null,"`/`","`i`"),d(14696,null,"`true`","`false`","`null`"),d(14695,null,"`foo && bar`","`foo`","`bar`","`true`","`false`","`<(foo)`"),d(14681,null,"`{ approve: false, matchCommandLine: true }`"),d(14679,null,"`#chat.tools.terminal.ignoreDefaultAutoApproveRules#`","`true`"),[d(14692,null),`|${d(14693,null)}|${d(14683,null)}|`,"|---|---|",'| `"mkdir": true` | '+d(14684,null,"`mkdir`"),'| `"npm run build": true` | '+d(14685,null,"`npm run build`"),'| `"bin/test.sh": true` | '+d(14682,null,"`bin/test.sh`","`bin\\test.sh`","`./bin/test.sh`"),'| `"/^git (status\\|show\\\\b.*)$/": true` | '+d(14689,null,"`git status`","`git show`"),'| `"/^Get-ChildItem\\\\b/i": true` | '+d(14688,null,"`Get-ChildItem`"),'| `"/.*/": true` | '+d(14687,null),'| `"rm": false` | '+d(14690,null,"`rm`"),'| `"/\\\\.ps1/i": { approve: false, matchCommandLine: true }` | '+d(14686,null,'`".ps1"`'),'| `"rm": null` | '+d(14691,null,"`false`","`rm`")].join(`
`)].join(`
`),type:"object",additionalProperties:{anyOf:[eJi,{type:"object",properties:{approve:eJi,matchCommandLine:{type:"boolean",enum:[!0,!1],enumDescriptions:[d(14701,null),d(14700,null)],description:d(14699,null)}},required:["approve"]},{type:"null",description:d(14702,null)}]},default:{cd:!0,echo:!0,ls:!0,dir:!0,pwd:!0,cat:!0,head:!0,tail:!0,findstr:!0,wc:!0,tr:!0,cut:!0,cmp:!0,which:!0,basename:!0,dirname:!0,realpath:!0,readlink:!0,stat:!0,file:!0,od:!0,du:!0,df:!0,sleep:!0,nl:!0,grep:!0,"/^git(\\s+(-C\\s+\\S+|--no-pager))*\\s+status\\b/":!0,"/^git(\\s+(-C\\s+\\S+|--no-pager))*\\s+log\\b/":!0,"/^git(\\s+(-C\\s+\\S+|--no-pager))*\\s+log\\b.*\\s--output(=|\\s|$)/":!1,"/^git(\\s+(-C\\s+\\S+|--no-pager))*\\s+show\\b/":!0,"/^git(\\s+(-C\\s+\\S+|--no-pager))*\\s+diff\\b/":!0,"/^git(\\s+(-C\\s+\\S+|--no-pager))*\\s+ls-files\\b/":!0,"/^git(\\s+(-C\\s+\\S+|--no-pager))*\\s+grep\\b/":!0,"/^git(\\s+(-C\\s+\\S+|--no-pager))*\\s+branch\\b/":!0,"/^git(\\s+(-C\\s+\\S+|--no-pager))*\\s+branch\\b.*\\s-(d|D|m|M|-delete|-force)\\b/":!1,"/^docker\\s+(ps|images|info|version|inspect|logs|top|stats|port|diff|search|events)\\b/":!0,"/^docker\\s+(container|image|network|volume|context|system)\\s+(ls|ps|inspect|history|show|df|info)\\b/":!0,"/^docker\\s+compose\\s+(ps|ls|top|logs|images|config|version|port|events)\\b/":!0,"Get-ChildItem":!0,"Get-Content":!0,"Get-Date":!0,"Get-Random":!0,"Get-Location":!0,"Set-Location":!0,"Write-Host":!0,"Write-Output":!0,"Out-String":!0,"Split-Path":!0,"Join-Path":!0,"Start-Sleep":!0,"Where-Object":!0,"/^Select-[a-z0-9]/i":!0,"/^Measure-[a-z0-9]/i":!0,"/^Compare-[a-z0-9]/i":!0,"/^Format-[a-z0-9]/i":!0,"/^Sort-[a-z0-9]/i":!0,"/^npm\\s+(ls|list|outdated|view|info|show|explain|why|root|prefix|bin|search|doctor|fund|repo|bugs|docs|home|help(-search)?)\\b/":!0,"/^npm\\s+config\\s+(list|get)\\b/":!0,"/^npm\\s+pkg\\s+get\\b/":!0,"/^npm\\s+audit$/":!0,"/^npm\\s+cache\\s+verify\\b/":!0,"/^yarn\\s+(list|outdated|info|why|bin|help|versions)\\b/":!0,"/^yarn\\s+licenses\\b/":!0,"/^yarn\\s+audit\\b(?!.*\\bfix\\b)/":!0,"/^yarn\\s+config\\s+(list|get)\\b/":!0,"/^yarn\\s+cache\\s+dir\\b/":!0,"/^pnpm\\s+(ls|list|outdated|why|root|bin|doctor)\\b/":!0,"/^pnpm\\s+licenses\\b/":!0,"/^pnpm\\s+audit\\b(?!.*\\bfix\\b)/":!0,"/^pnpm\\s+config\\s+(list|get)\\b/":!0,"npm ci":!0,"/^yarn\\s+install\\s+--frozen-lockfile\\b/":!0,"/^pnpm\\s+install\\s+--frozen-lockfile\\b/":!0,column:!0,"/^column\\b.*\\s-c\\s+[0-9]{4,}/":!1,date:!0,"/^date\\b.*\\s(-s|--set)\\b/":!1,find:!0,"/^find\\b.*\\s-(delete|exec|execdir|fprint|fprintf|fls|ok|okdir)\\b/":!1,rg:!0,"/^rg\\b.*\\s(--pre|--hostname-bin)\\b/":!1,sed:!0,"/^sed\\b.*\\s(-[a-zA-Z]*(e|f)[a-zA-Z]*|--expression|--file)\\b/":!1,"/^sed\\b.*s\\/.*\\/.*\\/[ew]/":!1,"/^sed\\b.*;W/":!1,sort:!0,"/^sort\\b.*\\s-(o|S)\\b/":!1,tree:!0,"/^tree\\b.*\\s-o\\b/":!1,"/^xxd$/":!0,"/^xxd\\b(\\s+-\\S+)*\\s+[^-\\s]\\S*$/":!0,rm:!1,rmdir:!1,del:!1,"Remove-Item":!1,ri:!1,rd:!1,erase:!1,dd:!1,kill:!1,ps:!1,top:!1,"Stop-Process":!1,spps:!1,taskkill:!1,"taskkill.exe":!1,curl:!1,wget:!1,"Invoke-RestMethod":!1,"Invoke-WebRequest":!1,irm:!1,iwr:!1,chmod:!1,chown:!1,"Set-ItemProperty":!1,sp:!1,"Set-Acl":!1,jq:!1,xargs:!1,eval:!1,"Invoke-Expression":!1,iex:!1}},"chat.tools.terminal.ignoreDefaultAutoApproveRules":{type:"boolean",default:!1,tags:["experimental"],markdownDescription:d(14712,null,"`#chat.tools.terminal.autoApprove#`")},"chat.tools.terminal.autoApproveWorkspaceNpmScripts":{restricted:!0,type:"boolean",default:!0,tags:["experimental"],markdownDescription:d(14705,null)},"chat.tools.terminal.blockDetectedFileWrites":{type:"string",enum:["never","outsideWorkspace","all"],enumDescriptions:[d(14709,null),d(14710,null),d(14707,null)],default:"outsideWorkspace",tags:["experimental"],markdownDescription:d(14708,null)},"chat.tools.terminal.shellIntegrationTimeout":{markdownDescription:d(14722,null,"`#terminal.integrated.shellIntegration.enabled#`"),type:"integer",minimum:-1,maximum:6e4,default:-1,markdownDeprecationMessage:d(14721,null,"`#terminal.integrated.shellIntegration.timeout#`")},"chat.tools.terminal.terminalProfile.linux":{restricted:!0,markdownDescription:d(14723,null),type:["object","null"],default:null,anyOf:[{type:"null"},jui],defaultSnippets:[{body:{path:"${1}"}}]},"chat.tools.terminal.terminalProfile.osx":{restricted:!0,markdownDescription:d(14724,null),type:["object","null"],default:null,anyOf:[{type:"null"},jui],defaultSnippets:[{body:{path:"${1}"}}]},"chat.tools.terminal.terminalProfile.windows":{restricted:!0,markdownDescription:d(14726,null),type:["object","null"],default:null,anyOf:[{type:"null"},jui],defaultSnippets:[{body:{path:"${1}"}}]},"chat.tools.terminal.autoReplyToPrompts":{type:"boolean",default:!1,tags:["experimental"],markdownDescription:d(14706,null)},"chat.tools.terminal.outputLocation":{markdownDescription:d(14714,null),type:"string",enum:["terminal","chat"],enumDescriptions:[d(14715,null),d(14713,null)],default:"chat",tags:["experimental"],experiment:{mode:"auto"}},"chat.tools.terminal.sandbox.enabled":{markdownDescription:d(14727,null),type:"boolean",default:!1,tags:["preview"],restricted:!0},"chat.tools.terminal.sandbox.network":{markdownDescription:d(14736,null,"`#chat.tools.terminal.sandbox.enabled#`"),type:"object",properties:{allowedDomains:{type:"array",description:d(14737,null,"`*.example.com`"),items:{type:"string"},default:[]},deniedDomains:{type:"array",description:d(14739,null),items:{type:"string"},default:[]},allowTrustedDomains:{type:"boolean",description:d(14738,null),default:!1}},default:{allowedDomains:[],deniedDomains:[],allowTrustedDomains:!1},tags:["preview"],restricted:!0},"chat.tools.terminal.sandbox.linuxFileSystem":{markdownDescription:d(14728,null,"`#chat.tools.terminal.sandbox.enabled#`"),type:"object",properties:{denyRead:{type:"array",description:d(14730,null),items:{type:"string"},default:[]},allowWrite:{type:"array",description:d(14729,null),items:{type:"string"},default:["."]},denyWrite:{type:"array",description:d(14731,null),items:{type:"string"},default:[]}},default:{denyRead:[],allowWrite:["."],denyWrite:[]},tags:["preview"],restricted:!0},"chat.tools.terminal.sandbox.macFileSystem":{markdownDescription:d(14732,null,"`#chat.tools.terminal.sandbox.enabled#`"),type:"object",properties:{denyRead:{type:"array",description:d(14734,null),items:{type:"string"},default:[]},allowWrite:{type:"array",description:d(14733,null),items:{type:"string"},default:["."]},denyWrite:{type:"array",description:d(14735,null),items:{type:"string"},default:[]}},default:{denyRead:[],allowWrite:["."],denyWrite:[]},tags:["preview"],restricted:!0},"chat.tools.terminal.preventShellHistory":{type:"boolean",default:!0,markdownDescription:[d(14716,null),`- \`bash\`: ${d(14717,null)}`,`- \`zsh\`: ${d(14720,null)}`,`- \`fish\`: ${d(14718,null)}`,`- \`pwsh\`: ${d(14719,null)}`].join(`
`)},"chat.tools.terminal.enforceTimeoutFromModel":{restricted:!0,type:"boolean",default:!0,tags:["experimental"],experiment:{mode:"auto"},markdownDescription:d(14711,null)}};for(let a of["chat.agent.terminal.allowList","chat.agent.terminal.denyList","github.copilot.chat.agent.terminal.allowList","github.copilot.chat.agent.terminal.denyList","chat.agent.terminal.autoApprove"])Qui[a]={deprecated:!0,markdownDeprecationMessage:d(14680,null,"`#chat.tools.terminal.autoApprove#`")};var tJi="terminal.integrated.shellIntegration",iJi={"terminal.integrated.shellIntegration.showCommandGuide":{restricted:!0,markdownDescription:d(14754,null),type:"boolean",default:!0}};var oJi=["workbench.action.terminal.focusFind","workbench.action.terminal.hideFind","workbench.action.terminal.findNext","workbench.action.terminal.findPrevious","workbench.action.terminal.toggleFindRegex","workbench.action.terminal.toggleFindWholeWord","workbench.action.terminal.toggleFindCaseSensitive","workbench.action.terminal.searchWorkspace"];var nJi=["workbench.action.terminal.goToRecentDirectory","workbench.action.terminal.runRecentCommand"];var rJi={"terminal.integrated.shellIntegration.history":{restricted:!0,markdownDescription:d(14815,null),type:"number",default:100}};var sJi={"terminal.integrated.enableNotifications":{description:d(14853,null),type:"boolean",default:!0}};var aJi={"terminal.integrated.stickyScroll.enabled":{markdownDescription:d(14897,null,"https://code.visualstudio.com/docs/terminal/shell-integration","`#terminal.integrated.shellIntegration.enabled#`"),type:"boolean",default:!0},"terminal.integrated.stickyScroll.maxLineCount":{markdownDescription:d(14899,null),type:"number",default:5,minimum:1,maximum:10},"terminal.integrated.stickyScroll.ignoredCommands":{markdownDescription:d(14898,null),type:"array",items:{type:"string"},default:["clear","cls","clear-host","copilot","claude","codex","gemini"]}};var lJi=["workbench.action.terminal.selectPrevSuggestion","workbench.action.terminal.selectPrevPageSuggestion","workbench.action.terminal.selectNextSuggestion","workbench.action.terminal.selectNextPageSuggestion","workbench.action.terminal.acceptSelectedSuggestion","workbench.action.terminal.acceptSelectedSuggestionEnter","workbench.action.terminal.hideSuggestWidget","workbench.action.terminal.triggerSuggest","workbench.action.terminal.suggestToggleDetails","workbench.action.terminal.suggestToggleDetailsFocus"];var uzo=["exe","bat","cmd","com","msi","ps1","vbs","js","jar","py","rb","pl","sh"],Pz="terminal.integrated.suggest";function Xui(a){return typeof a=="boolean"?a?{commands:"on",arguments:"on",unknown:"off"}:{commands:"off",arguments:"off",unknown:"off"}:a}var cJi={"terminal.integrated.suggest.enabled":{restricted:!0,markdownDescription:d(14988,null,"Windows PowerShell, PowerShell v7+, zsh, bash, fish","`#terminal.integrated.shellIntegration.enabled#`"),type:"boolean",default:!0},"terminal.integrated.suggest.providers":{restricted:!0,markdownDescription:d(14996,null),type:"object",properties:{}},"terminal.integrated.suggest.quickSuggestions":{restricted:!0,markdownDescription:d(14998,null,"`#terminal.integrated.suggest.suggestOnTriggerCharacters#`"),type:"object",properties:{commands:{description:d(15000,null),type:"string",enum:["on","off"]},arguments:{description:d(14999,null),type:"string",enum:["on","off"]},unknown:{description:d(15001,null),type:"string",enum:["on","off"]}},additionalProperties:!1,default:{commands:"off",arguments:"off",unknown:"off"}},"terminal.integrated.suggest.suggestOnTriggerCharacters":{restricted:!0,markdownDescription:d(15004,null),type:"boolean",default:!1},"terminal.integrated.suggest.runOnEnter":{restricted:!0,markdownDescription:d(15002,null),enum:["never","exactMatch","exactMatchIgnoreExtension","always"],markdownEnumDescriptions:[d(14983,null),d(14981,null),d(14982,null),d(14980,null)],default:"never"},"terminal.integrated.suggest.selectionMode":{markdownDescription:d(15006,null),type:"string",enum:["partial","always","never"],markdownEnumDescriptions:[d(15009,null),d(15007,null),d(15008,null)],default:"partial"},"terminal.integrated.suggest.windowsExecutableExtensions":{restricted:!0,markdownDescription:d(15011,null,uzo.sort().map(a=>`- ${a}`).join(`
`)),type:"object",default:{}},"terminal.integrated.suggest.showStatusBar":{restricted:!0,markdownDescription:d(15003,null),type:"boolean",default:!0},"terminal.integrated.suggest.cdPath":{restricted:!0,markdownDescription:d(14984,null),type:"string",enum:["off","relative","absolute"],markdownEnumDescriptions:[d(14986,null),d(14987,null),d(14985,null)],default:"absolute"},"terminal.integrated.suggest.inlineSuggestion":{restricted:!0,markdownDescription:d(14989,null),type:"string",enum:["off","alwaysOnTopExceptExactMatch","alwaysOnTop"],markdownEnumDescriptions:[d(14992,null),d(14991,null),d(14990,null)],default:"alwaysOnTop"},"terminal.integrated.suggest.upArrowNavigatesHistory":{restricted:!0,markdownDescription:d(15005,null),type:"boolean",default:!0},"terminal.integrated.suggest.insertTrailingSpace":{restricted:!0,markdownDescription:d(14993,null),type:"boolean",default:!1}},Yui;function Jui(a){let i=Yui;a??=new Map,a.has("lsp")||a.set("lsp",{id:"lsp",description:d(14994,null)});let e={};for(let n of Array.from(a.keys()).sort())e[n]={type:"boolean",default:n!=="lsp",description:a.get(n)?.description??d(14995,null,n)};let t={};for(let n in e)t[n]=e[n].default;Yui={id:"terminalSuggestProviders",order:100,title:d(15010,null),type:"object",properties:{"terminal.integrated.suggest.providers":{restricted:!0,markdownDescription:d(14997,null),type:"object",properties:e,default:t,tags:["preview"],additionalProperties:!1}}},oe.as(ii.Configuration).updateConfigurations({add:[Yui],remove:i?[i]:[]})}Jui();var Zui=["vim","vi","nano","tmux"];var dJi={"terminal.integrated.localEchoLatencyThreshold":{description:d(15017,null),type:"integer",minimum:-1,default:30,tags:["preview"]},"terminal.integrated.localEchoEnabled":{markdownDescription:d(15012,null,"`#terminal.integrated.localEchoLatencyThreshold#`"),type:"string",enum:["on","off","auto"],enumDescriptions:[d(15015,null),d(15014,null),d(15013,null)],default:"off",tags:["preview"]},"terminal.integrated.localEchoExcludePrograms":{description:d(15016,null),type:"array",items:{type:"string",uniqueItems:!0},default:Zui,tags:["preview"]},"terminal.integrated.localEchoStyle":{description:d(15018,null),default:"dim",anyOf:[{enum:["bold","dim","italic","underlined","inverted","#ff0000"]},{type:"string",format:"color-hex"}],tags:["preview"]}};var uJi={"terminal.integrated.mouseWheelZoom":{markdownDescription:it?d(15034,null):d(15033,null),type:"boolean",default:!1}};var lw=(c=>(c[c.A11yFocusAccessibleBuffer="workbench.action.terminal.focusAccessibleBuffer"]="A11yFocusAccessibleBuffer",c[c.DeveloperRestartPtyHost="workbench.action.terminal.restartPtyHost"]="DeveloperRestartPtyHost",c[c.OpenTerminalSettingsLink="workbench.action.terminal.chat.openTerminalSettingsLink"]="OpenTerminalSettingsLink",c[c.DisableSessionAutoApproval="workbench.action.terminal.chat.disableSessionAutoApproval"]="DisableSessionAutoApproval",c[c.FocusMostRecentChatTerminalOutput="workbench.action.terminal.chat.focusMostRecentChatTerminalOutput"]="FocusMostRecentChatTerminalOutput",c[c.FocusMostRecentChatTerminal="workbench.action.terminal.chat.focusMostRecentChatTerminal"]="FocusMostRecentChatTerminal",c[c.ToggleChatTerminalOutput="workbench.action.terminal.chat.toggleChatTerminalOutput"]="ToggleChatTerminalOutput",c[c.FocusChatInstanceAction="workbench.action.terminal.chat.focusChatInstance"]="FocusChatInstanceAction",c[c.ContinueInBackground="workbench.action.terminal.chat.continueInBackground"]="ContinueInBackground",c))(lw||{}),ty=(r=>(r[r.StickyScrollEnabled="terminal.integrated.stickyScroll.enabled"]="StickyScrollEnabled",r[r.SuggestEnabled="terminal.integrated.suggest.enabled"]="SuggestEnabled",r[r.AutoApprove="chat.tools.terminal.autoApprove"]="AutoApprove",r[r.EnableAutoApprove="chat.tools.terminal.enableAutoApprove"]="EnableAutoApprove",r[r.ShellIntegrationTimeout="chat.tools.terminal.shellIntegrationTimeout"]="ShellIntegrationTimeout",r[r.OutputLocation="chat.tools.terminal.outputLocation"]="OutputLocation",r))(ty||{}),ide=(e=>(e[e.ChatHasTerminals="hasChatTerminals"]="ChatHasTerminals",e[e.ChatHasHiddenTerminals="hasHiddenChatTerminals"]="ChatHasHiddenTerminals",e))(ide||{}),mJi={...qXi,...jXi,...Qui,...YXi,...iJi,...rJi,...sJi,...aJi,...cJi,...dJi,...uJi},hJi=[...$Xi,...oJi,...nJi,...lJi];var dc="terminal";var Ev="terminal.integrated",aDt=0,gJi=-5,lDt=Wn?1.1:1,JQe=1,ZQe=1e3,fJi="normal",vJi="bold",tpi=["normal","bold","100","200","300","400","500","600","700","800","900"],Sg=ae("terminalProfileResolverService");var iy=ae("terminalProfileService"),bJi=a=>typeof a.write=="function";var cDt=["workbench.action.terminal.clearSelection","workbench.action.terminal.clear","workbench.action.terminal.copyAndClearSelection","workbench.action.terminal.copySelection","workbench.action.terminal.copySelectionAsHtml","workbench.action.terminal.copyLastCommand","workbench.action.terminal.copyLastCommandOutput","workbench.action.terminal.copyLastCommandAndLastCommandOutput","workbench.action.terminal.deleteToLineStart","workbench.action.terminal.deleteWordLeft","workbench.action.terminal.deleteWordRight","workbench.action.terminal.focusNextPane","workbench.action.terminal.focusNext","workbench.action.terminal.focusPreviousPane","workbench.action.terminal.focusPrevious","workbench.action.terminal.focus","workbench.action.terminal.sizeToContentWidth","workbench.action.terminal.kill","workbench.action.terminal.killEditor","workbench.action.terminal.moveToEditor","workbench.action.terminal.moveToLineEnd","workbench.action.terminal.moveToLineStart","workbench.action.terminal.moveToTerminalPanel","workbench.action.terminal.newInActiveWorkspace","workbench.action.terminal.new","workbench.action.terminal.newInNewWindow","workbench.action.terminal.paste","workbench.action.terminal.pasteSelection","workbench.action.terminal.resizePaneDown","workbench.action.terminal.resizePaneLeft","workbench.action.terminal.resizePaneRight","workbench.action.terminal.resizePaneUp","workbench.action.terminal.runActiveFile","workbench.action.terminal.runSelectedText","workbench.action.terminal.scrollDown","workbench.action.terminal.scrollDownPage","workbench.action.terminal.scrollToBottom","workbench.action.terminal.scrollToNextCommand","workbench.action.terminal.scrollToPreviousCommand","workbench.action.terminal.scrollToTop","workbench.action.terminal.scrollUp","workbench.action.terminal.scrollUpPage","workbench.action.terminal.sendSequence","workbench.action.terminal.selectAll","workbench.action.terminal.selectToNextCommand","workbench.action.terminal.selectToNextLine","workbench.action.terminal.selectToPreviousCommand","workbench.action.terminal.selectToPreviousLine","workbench.action.terminal.splitInActiveWorkspace","workbench.action.terminal.split","workbench.action.terminal.toggleTerminal","workbench.action.terminal.focusHover","editor.action.accessibilityHelp","workbench.action.terminal.stopVoice","workbench.action.terminal.sendSignal","workbench.action.tasks.rerunForActiveTerminal","editor.action.toggleTabFocusMode","notifications.hideList","notifications.hideToasts","workbench.action.closeQuickOpen","workbench.action.quickOpen","workbench.action.quickOpenPreviousEditor","workbench.action.showCommands","workbench.action.tasks.build","workbench.action.tasks.restartTask","workbench.action.tasks.runTask","workbench.action.tasks.reRunTask","workbench.action.tasks.showLog","workbench.action.tasks.showTasks","workbench.action.tasks.terminate","workbench.action.tasks.test","workbench.action.toggleFullScreen","workbench.action.terminal.focusAtIndex1","workbench.action.terminal.focusAtIndex2","workbench.action.terminal.focusAtIndex3","workbench.action.terminal.focusAtIndex4","workbench.action.terminal.focusAtIndex5","workbench.action.terminal.focusAtIndex6","workbench.action.terminal.focusAtIndex7","workbench.action.terminal.focusAtIndex8","workbench.action.terminal.focusAtIndex9","workbench.action.focusSecondEditorGroup","workbench.action.focusThirdEditorGroup","workbench.action.focusFourthEditorGroup","workbench.action.focusFifthEditorGroup","workbench.action.focusSixthEditorGroup","workbench.action.focusSeventhEditorGroup","workbench.action.focusEighthEditorGroup","workbench.action.focusNextPart","workbench.action.focusPreviousPart","workbench.action.nextPanelView","workbench.action.previousPanelView","workbench.action.nextSideBarView","workbench.action.previousSideBarView","workbench.action.debug.disconnect","workbench.action.debug.start","workbench.action.debug.stop","workbench.action.debug.run","workbench.action.debug.restart","workbench.action.debug.continue","workbench.action.debug.pause","workbench.action.debug.stepInto","workbench.action.debug.stepOut","workbench.action.debug.stepOver","workbench.action.nextEditor","workbench.action.previousEditor","workbench.action.nextEditorInGroup","workbench.action.previousEditorInGroup","workbench.action.openNextRecentlyUsedEditor","workbench.action.openPreviousRecentlyUsedEditor","workbench.action.openNextRecentlyUsedEditorInGroup","workbench.action.openPreviousRecentlyUsedEditorInGroup","workbench.action.quickOpenPreviousRecentlyUsedEditor","workbench.action.quickOpenLeastRecentlyUsedEditor","workbench.action.quickOpenPreviousRecentlyUsedEditorInGroup","workbench.action.quickOpenLeastRecentlyUsedEditorInGroup","workbench.action.focusActiveEditorGroup","workbench.action.focusFirstEditorGroup","workbench.action.focusLastEditorGroup","workbench.action.firstEditorInGroup","workbench.action.lastEditorInGroup","workbench.action.navigateUp","workbench.action.navigateDown","workbench.action.navigateRight","workbench.action.navigateLeft","workbench.action.togglePanel","workbench.action.quickOpenView","workbench.action.toggleMaximizedPanel","notification.acceptPrimaryAction","runCommands","workbench.action.terminal.chat.start","workbench.action.terminal.chat.close","workbench.action.terminal.chat.discard","workbench.action.terminal.chat.makeRequest","workbench.action.terminal.chat.cancel","workbench.action.terminal.chat.feedbackHelpful","workbench.action.terminal.chat.feedbackUnhelpful","workbench.action.terminal.chat.feedbackReportIssue","workbench.action.terminal.chat.runCommand","workbench.action.terminal.chat.insertCommand","workbench.action.terminal.chat.viewInChat",...hJi],SJi={extensionPoint:"terminal",defaultExtensionKind:["workspace"],activationEventsGenerator:function*(a){for(let i of a)for(let e of i.profiles??[])yield`onTerminalProfile:${e.id}`},jsonSchema:{description:d(14264,null),type:"object",properties:{profiles:{type:"array",description:d(14267,null),items:{type:"object",required:["id","title"],defaultSnippets:[{body:{id:"$1",title:"$2"}}],properties:{id:{description:d(14268,null),type:"string"},title:{description:d(14269,null),type:"string"},icon:{description:d(14271,null),anyOf:[{type:"string"},{type:"object",properties:{light:{description:d(14273,null),type:"string"},dark:{description:d(14272,null),type:"string"}}}]},titleTemplate:{description:d(14270,null),type:"string"}}}},completionProviders:{type:"array",description:d(14265,null),items:{type:"object",required:["id"],defaultSnippets:[{body:{id:"$1",description:"$2"}}],properties:{description:{description:d(14266,null),type:"string"}}}}}}};var nS=[],lX=J("terminal.background",null,d(14275,null)),IJi=J("terminal.foreground",{light:"#333333",dark:"#CCCCCC",hcDark:"#FFFFFF",hcLight:"#292929"},d(14282,null)),yJi=J("terminalCursor.foreground",null,d(14292,null)),wJi=J("terminalCursor.background",null,d(14291,null)),eEe=J("terminal.selectionBackground",sv,d(14285,null)),CJi=J("terminal.inactiveSelectionBackground",{light:ei(eEe,.5),dark:ei(eEe,.5),hcDark:ei(eEe,.7),hcLight:ei(eEe,.5)},d(14284,null)),xJi=J("terminal.selectionForeground",{light:null,dark:null,hcDark:"#000000",hcLight:"#ffffff"},d(14286,null)),kJi=J("terminalCommandDecoration.defaultBackground",{light:"#00000040",dark:"#ffffff40",hcDark:"#ffffff80",hcLight:"#00000040"},d(14288,null)),EJi=J("terminalCommandDecoration.successBackground",{dark:"#1B81A8",light:"#2090D3",hcDark:"#1B81A8",hcLight:"#007100"},d(14290,null)),TJi=J("terminalCommandDecoration.errorBackground",{dark:"#F14C4C",light:"#E51400",hcDark:"#F14C4C",hcLight:"#B5200D"},d(14289,null)),uDt=J("terminalOverviewRuler.cursorForeground","#A0A0A0CC",d(14295,null)),jWa=J("terminal.border",cb,d(14276,null)),_Ji=J("terminalOverviewRuler.border",bft,d(14294,null)),DJi=J("terminal.findMatchBackground",{dark:Pse,light:Pse,hcDark:null,hcLight:"#0F4A85"},d(14278,null),!0),QWa=J("terminal.hoverHighlightBackground",ei(ogt,.5),d(14283,null)),LJi=J("terminal.findMatchBorder",{dark:null,light:null,hcDark:"#f38518",hcLight:"#0F4A85"},d(14279,null)),RJi=J("terminal.findMatchHighlightBackground",{dark:Kb,light:Kb,hcDark:null,hcLight:null},d(14280,null),!0),MJi=J("terminal.findMatchHighlightBorder",{dark:null,light:null,hcDark:"#f38518",hcLight:"#0F4A85"},d(14281,null)),PJi=J("terminalOverviewRuler.findMatchForeground",{dark:MN,light:MN,hcDark:"#f38518",hcLight:"#0F4A85"},d(14296,null)),YWa=J("terminal.dropBackground",_E,d(14277,null),!0),XWa=J("terminal.tab.activeBorder",Lxe,d(14287,null)),JWa=J("terminal.initialHintForeground",{dark:"#ffffff56",light:"#0007",hcDark:null,hcLight:null},d(14293,null)),dDt={"terminal.ansiBlack":{index:0,defaults:{light:"#000000",dark:"#000000",hcDark:"#000000",hcLight:"#292929"}},"terminal.ansiRed":{index:1,defaults:{light:"#cd3131",dark:"#cd3131",hcDark:"#cd0000",hcLight:"#cd3131"}},"terminal.ansiGreen":{index:2,defaults:{light:"#107C10",dark:"#0DBC79",hcDark:"#00cd00",hcLight:"#136C13"}},"terminal.ansiYellow":{index:3,defaults:{light:"#949800",dark:"#e5e510",hcDark:"#cdcd00",hcLight:"#949800"}},"terminal.ansiBlue":{index:4,defaults:{light:"#0451a5",dark:"#2472c8",hcDark:"#0000ee",hcLight:"#0451a5"}},"terminal.ansiMagenta":{index:5,defaults:{light:"#bc05bc",dark:"#bc3fbc",hcDark:"#cd00cd",hcLight:"#bc05bc"}},"terminal.ansiCyan":{index:6,defaults:{light:"#0598bc",dark:"#11a8cd",hcDark:"#00cdcd",hcLight:"#0598bc"}},"terminal.ansiWhite":{index:7,defaults:{light:"#555555",dark:"#e5e5e5",hcDark:"#e5e5e5",hcLight:"#555555"}},"terminal.ansiBrightBlack":{index:8,defaults:{light:"#666666",dark:"#666666",hcDark:"#7f7f7f",hcLight:"#666666"}},"terminal.ansiBrightRed":{index:9,defaults:{light:"#cd3131",dark:"#f14c4c",hcDark:"#ff0000",hcLight:"#cd3131"}},"terminal.ansiBrightGreen":{index:10,defaults:{light:"#14CE14",dark:"#23d18b",hcDark:"#00ff00",hcLight:"#00bc00"}},"terminal.ansiBrightYellow":{index:11,defaults:{light:"#b5ba00",dark:"#f5f543",hcDark:"#ffff00",hcLight:"#b5ba00"}},"terminal.ansiBrightBlue":{index:12,defaults:{light:"#0451a5",dark:"#3b8eea",hcDark:"#5c5cff",hcLight:"#0451a5"}},"terminal.ansiBrightMagenta":{index:13,defaults:{light:"#bc05bc",dark:"#d670d6",hcDark:"#ff00ff",hcLight:"#bc05bc"}},"terminal.ansiBrightCyan":{index:14,defaults:{light:"#0598bc",dark:"#29b8db",hcDark:"#00ffff",hcLight:"#0598bc"}},"terminal.ansiBrightWhite":{index:15,defaults:{light:"#a5a5a5",dark:"#e5e5e5",hcDark:"#ffffff",hcLight:"#a5a5a5"}}};function AJi(){for(let a in dDt){let i=dDt[a],e=a.substring(13);nS[i.index]=J(a,i.defaults,d(14274,null,e))}}function oy(a){let i;if(Ae(a)?i=a:a.color?i=a.color.replace(/\./g,"_"):q.isThemeIcon(a.icon)&&a.icon.color&&(i=a.icon.color.id.replace(/\./g,"_")),i)return`terminal-icon-${i.replace(/\./g,"_")}`}function pDt(a){let i=[];for(let e in dDt)a.getColor(e)&&!e.toLowerCase().includes("bright")&&i.push(e);return i}function tEe(a){let i=new P,e=pDt(a),t=hr(void 0,void 0,i),o="";for(let n of e){let r=oy(n),s=a.getColor(n);s&&(o+=`.monaco-workbench .${r} .codicon:first-child:not(.codicon-split-horizontal):not(.codicon-trashcan):not(.file-icon){ color: ${s} !important; }`)}return t.textContent=o,i}function NJi(a,i){let e=pDt(a),t="";for(let o of e){let n=oy(o),r=a.getColor(o);r&&(i?t+=`.monaco-workbench .show-file-icons .predefined-file-icon.terminal-tab.${n}::before,.monaco-workbench .show-file-icons .file-icon.terminal-tab.${n}::before{ color: ${r} !important; }`:t+=`.monaco-workbench .${n} .codicon:first-child:not(.codicon-split-horizontal):not(.codicon-trashcan):not(.file-icon){ color: ${r} !important; }`)}return t}function z_(a,i,e){let t=a.icon;if(!t)return;let o=[],n;if(e){if(Ae(t)&&(t.startsWith("$(")||jy().getIcon(t)))return o;Ae(t)&&(n=A.parse(t))}if(A.isUri(t)?n=t:!q.isThemeIcon(t)&&!Ae(t)&&(n=Ip(i)?t.dark:t.light),n instanceof A){let s=`terminal-uri-icon-${Ir(n.path).toString(36)}`;o.push(s),o.push("terminal-uri-icon")}return o}function cX(a,i){return Ae(i.icon)?i.icon:q.isThemeIcon(i.icon)?i.icon.id:a.get(Sg).getDefaultIcon().id}var at;(Ee=>(Ee.isOpen=new Q("terminalIsOpen",!1,!0),Ee.focus=new Q("terminalFocus",!1,d(14466,null)),Ee.focusInAny=new Q("terminalFocusInAny",!1,d(14467,null)),Ee.editorFocus=new Q("terminalEditorFocus",!1,d(14465,null)),Ee.count=new Q("terminalCount",0,d(14464,null)),Ee.groupCount=new Q("terminalGroupCount",0,!0),Ee.tabsNarrow=new Q("isTerminalTabsNarrow",!1,!0),Ee.terminalHasFixedWidth=new Q("terminalHasFixedWidth",!1,!0),Ee.tabsFocus=new Q("terminalTabsFocus",!1,d(14472,null)),Ee.webExtensionContributedProfile=new Q("terminalWebExtensionContributedProfile",!1,!0),Ee.terminalHasBeenCreated=new Q("terminalHasBeenCreated",!1,!0),Ee.terminalEditorActive=new Q("terminalEditorActive",!1,!0),Ee.tabsMouse=new Q("terminalTabsMouse",!1,!0),Ee.shellType=new Q("terminalShellType",void 0,{type:"string",description:d(14470,null)}),Ee.altBufferActive=new Q("terminalAltBufferActive",!1,d(14463,null)),Ee.suggestWidgetVisible=new Q("terminalSuggestWidgetVisible",!1,d(14471,null)),Ee.notFocus=Ee.focus.toNegated(),Ee.viewShowing=new Q("terminalViewShowing",!1,d(14476,null)),Ee.textSelected=new Q("terminalTextSelected",!1,d(14474,null)),Ee.textSelectedInFocused=new Q("terminalTextSelectedInFocused",!1,d(14475,null)),Ee.notTextSelected=Ee.textSelected.toNegated(),Ee.findVisible=new Q("terminalFindVisible",!1,!0),Ee.notFindVisible=Ee.findVisible.toNegated(),Ee.findInputFocus=new Q("terminalFindInputFocused",!1,!0),Ee.findFocus=new Q("terminalFindFocused",!1,!0),Ee.notFindFocus=Ee.findInputFocus.toNegated(),Ee.processSupported=new Q("terminalProcessSupported",!1,d(14468,null)),Ee.tabsSingularSelection=new Q("terminalTabsSingularSelection",!1,d(14473,null)),Ee.splitTerminalTabFocused=new Q("terminalSplitTerminal",!1,d(14461,null)),Ee.splitTerminalActive=new Q("terminalSplitPaneActive",!1,d(14462,null)),Ee.inTerminalRunCommandPicker=new Q("inTerminalRunCommandPicker",!1,d(14460,null)),Ee.terminalShellIntegrationEnabled=new Q("terminalShellIntegrationEnabled",!1,d(14469,null)),Ee.terminalDictationInProgress=new Q("terminalDictationInProgress",!1),Ee.shouldShowViewInlineActions=x.and(x.equals("view",dc),x.notEquals("config.terminal.integrated.tabs.hideCondition","never"),x.not(ide.ChatHasHiddenTerminals),x.or(x.not("config.terminal.integrated.tabs.enabled"),x.and(x.equals("config.terminal.integrated.tabs.showActions","singleTerminal"),x.equals("terminalGroupCount",1)),x.and(x.equals("config.terminal.integrated.tabs.showActions","singleTerminalOrNarrow"),x.or(x.equals("terminalGroupCount",1),x.has("isTerminalTabsNarrow"))),x.and(x.equals("config.terminal.integrated.tabs.showActions","singleGroup"),x.equals("terminalGroupCount",1)),x.equals("config.terminal.integrated.tabs.showActions","always")))))(at||={});var ef=class extends Us{constructor(e,t,o,n,r,s,l,c,u){super();this.resource=e;this._terminalInstance=t;this._themeService=o;this._terminalInstanceService=n;this._instantiationService=r;this._configurationService=s;this._lifecycleService=l;this._contextKeyService=c;this._dialogService=u;this.closeHandler=this;this._isDetached=!1;this._isShuttingDown=!1;this._isReverted=!1;this._onDidRequestAttach=this._register(new E);this.onDidRequestAttach=this._onDidRequestAttach.event;this._terminalEditorFocusContextKey=at.editorFocus.bindTo(c),t&&this._setupInstanceListeners()}static{this.ID="workbench.editors.terminal"}setGroup(e){this._group=e,e?.scopedContextKeyService&&this._terminalInstance?.setParentContextKeyService(e.scopedContextKeyService)}get group(){return this._group}get typeId(){return ef.ID}get editorId(){return Mz}get capabilities(){return 1218}setTerminalInstance(e){if(this._terminalInstance)throw new Error("cannot set instance that has already been set");this._terminalInstance=e,this._setupInstanceListeners()}copy(){let e=this._terminalInstanceService.createInstance(this._copyLaunchConfig||{},2);return e.focusWhenReady(),this._copyLaunchConfig=void 0,this._instantiationService.createInstance(ef,e.resource,e)}setCopyLaunchConfig(e){this._copyLaunchConfig=e}get terminalInstance(){return this._isDetached?void 0:this._terminalInstance}showConfirm(){if(this._isReverted)return!1;let e=this._configurationService.getValue("terminal.integrated.confirmOnKill");return(e==="editor"||e==="always")&&this._terminalInstance?.hasChildProcesses||!1}async confirm(e){let{confirmed:t}=await this._dialogService.confirm({type:gt.Warning,message:d(14122,null),primaryButton:d(14120,null),detail:e.length>1?e.map(o=>o.editor.getName()).join(`
`)+`
`+d(14123,null):d(14121,null)});return t?1:2}async revert(){this._isReverted=!0}_setupInstanceListeners(){let e=this._terminalInstance;if(!e)return;let t=e.onDidFocus(()=>this._terminalEditorFocusContextKey.set(!0)),o=e.onDidBlur(()=>this._terminalEditorFocusContextKey.reset()),n=[e.onExit(r=>{e.waitOnExit||this.dispose()}),e.onDisposed(()=>this.dispose()),e.onTitleChanged(()=>this._onDidChangeLabel.fire()),e.onIconChanged(()=>this._onDidChangeLabel.fire()),t,o,e.statusList.onDidChangePrimaryStatus(()=>this._onDidChangeLabel.fire())];this._register(Z(()=>{!this._isDetached&&!this._isShuttingDown&&e.dispose(3),Ue(n),Ue([t,o])})),this._register(this._lifecycleService.onWillShutdown(r=>{this._isShuttingDown=!0,Ue(n),this._configurationService.getValue("terminal.integrated.enablePersistentSessions")&&r.reason===3?e.detachProcessAndDispose(1):e.dispose(1)}))}getName(){return this._terminalInstance?.title||this.resource.fragment}getIcon(){if(!(!this._terminalInstance||!q.isThemeIcon(this._terminalInstance.icon)))return this._terminalInstance.icon}getLabelExtraClasses(){if(!this._terminalInstance)return[];let e=["terminal-tab","predefined-file-icon"],t=oy(this._terminalInstance);t&&e.push(t);let o=z_(this._terminalInstance,this._themeService.getColorTheme().type);return o&&e.push(...o),e}detachInstance(){this._isShuttingDown||(this._terminalInstance?.detachFromElement(),this._terminalInstance?.setParentContextKeyService(this._contextKeyService),this._isDetached=!0)}getDescription(){return this._terminalInstance?.description}toUntyped(){return{resource:this.resource,options:{override:Mz,pinned:!0,forceReload:!0}}}canReopen(){return!1}};ef=I([m(2,De),m(3,xm),m(4,F),m(5,B),m(6,ao),m(7,X),m(8,ct)],ef);var mDt=class{constructor(i,e,t,o,n){this._editorGroupsService=e;this._configurationService=t;this._logService=o;this._dispoables=new P;this._tabGroupModel=[];this._groupLookup=new Map;this._tabInfoLookup=new Map;this._multiDiffEditorInputListeners=new jt;this._proxy=i.getProxy(Zi.ExtHostEditorTabs),this._dispoables.add(n.onDidEditorsChange(r=>{try{this._updateTabsModel(r)}catch{this._logService.error("Failed to update model, rebuilding"),this._createTabsModel()}})),this._dispoables.add(this._multiDiffEditorInputListeners),this._dispoables.add(this._editorGroupsService.onDidAddGroup(()=>this._createTabsModel())),this._dispoables.add(this._editorGroupsService.onDidRemoveGroup(()=>this._createTabsModel())),this._editorGroupsService.whenReady.then(()=>this._createTabsModel())}dispose(){this._groupLookup.clear(),this._tabInfoLookup.clear(),this._dispoables.dispose()}_buildTabObject(i,e,t){let o=e.editorId;return{id:this._generateTabId(e,i.id),label:e.getName(),editorId:o,input:this._editorInputToDto(e),isPinned:i.isSticky(t),isPreview:!i.isPinned(t),isActive:i.isActive(e),isDirty:e.isDirty()}}_editorInputToDto(i){if(i instanceof hb)return{kind:3,base:i.base,input1:i.input1.uri,input2:i.input2.uri,result:i.resource};if(i instanceof ek)return{kind:1,uri:i.resource};if(i instanceof ga&&!(i instanceof Fa)){let e=i.primary.resource,t=i.secondary.resource;return i.primary instanceof ek&&i.secondary instanceof ek&&Xe(e,t)&&e&&t?{kind:1,uri:e}:{kind:0}}if(i instanceof ha)return{kind:4,notebookType:i.viewType,uri:i.resource};if(i instanceof Yp)return{kind:6,viewType:i.viewType,uri:i.resource};if(i instanceof wu)return{kind:7,viewType:i.viewType};if(i instanceof ef)return{kind:8};if(i instanceof Fa){if(i.modified instanceof ek&&i.original instanceof ek)return{kind:2,modified:i.modified.resource,original:i.original.resource};if(i.modified instanceof ha&&i.original instanceof ha)return{kind:5,notebookType:i.original.viewType,modified:i.modified.resource,original:i.original.resource}}if(i instanceof Zg)return{kind:9,uri:i.resource,inputBoxUri:i.inputResource};if(i instanceof Va)return{kind:10};if(i instanceof xu){let e=[];for(let t of i?.resources.get()??[])t.originalUri&&t.modifiedUri&&e.push({kind:2,original:t.originalUri,modified:t.modifiedUri});return{kind:11,diffEditors:e}}return{kind:0}}_generateTabId(i,e){let t,o=no.getCanonicalUri(i,{supportSideBySide:3});return o instanceof A?t=o.toString():t=`${o?.primary?.toString()}-${o?.secondary?.toString()}`,`${e}~${i.editorId}-${i.typeId}-${t} `}_onDidGroupActivate(){let i=this._editorGroupsService.activeGroup.id,e=this._groupLookup.get(i);e&&(e.isActive=!0,this._proxy.$acceptTabGroupUpdate(e))}_onDidTabLabelChange(i,e,t){let o=this._generateTabId(e,i),n=this._tabInfoLookup.get(o);n?(n.tab.label=e.getName(),this._proxy.$acceptTabOperation({groupId:i,index:t,tabDto:n.tab,kind:2})):(this._logService.error("Invalid model for label change, rebuilding"),this._createTabsModel())}_onDidTabOpen(i,e,t){let o=this._editorGroupsService.getGroup(i),n=this._groupLookup.get(i)!==void 0;if(!o||!n){this._createTabsModel();return}let r=this._groupLookup.get(i)?.tabs;if(!r)return;let s=this._buildTabObject(o,e,t);r.splice(t,0,s);let l=this._generateTabId(e,i);this._tabInfoLookup.set(l,{group:o,editorInput:e,tab:s}),e instanceof xu&&this._multiDiffEditorInputListeners.set(e,H.fromObservableLight(e.resources)(()=>{let c=this._tabInfoLookup.get(l);c&&(c.tab=this._buildTabObject(o,e,t),this._proxy.$acceptTabOperation({groupId:i,index:t,tabDto:c.tab,kind:2}))})),this._proxy.$acceptTabOperation({groupId:i,index:t,tabDto:s,kind:0})}_onDidTabClose(i,e){let t=this._editorGroupsService.getGroup(i),o=this._groupLookup.get(i)?.tabs;if(!t||!o){this._createTabsModel();return}let n=o.splice(e,1);n.length!==0&&(this._tabInfoLookup.delete(n[0]?.id??""),n[0]?.input instanceof xu&&this._multiDiffEditorInputListeners.deleteAndDispose(n[0]?.input),this._proxy.$acceptTabOperation({groupId:i,index:e,tabDto:n[0],kind:1}))}_onDidTabActiveChange(i,e){let t=this._groupLookup.get(i)?.tabs;if(!t)return;let o=t[e];o.isActive=!0,this._proxy.$acceptTabOperation({groupId:i,index:e,tabDto:o,kind:2})}_onDidTabDirty(i,e,t){let o=this._generateTabId(t,i),n=this._tabInfoLookup.get(o);if(!n){this._logService.error("Invalid model for dirty change, rebuilding"),this._createTabsModel();return}n.tab.isDirty=t.isDirty(),this._proxy.$acceptTabOperation({groupId:i,index:e,tabDto:n.tab,kind:2})}_onDidTabPinChange(i,e,t){let o=this._generateTabId(t,i),n=this._tabInfoLookup.get(o),r=n?.group,s=n?.tab;if(!r||!s){this._logService.error("Invalid model for sticky change, rebuilding"),this._createTabsModel();return}s.isPinned=r.isSticky(e),this._proxy.$acceptTabOperation({groupId:i,index:e,tabDto:s,kind:2})}_onDidTabPreviewChange(i,e,t){let o=this._generateTabId(t,i),n=this._tabInfoLookup.get(o),r=n?.group,s=n?.tab;if(!r||!s){this._logService.error("Invalid model for sticky change, rebuilding"),this._createTabsModel();return}s.isPreview=!r.isPinned(e),this._proxy.$acceptTabOperation({kind:2,groupId:i,tabDto:s,index:e})}_onDidTabMove(i,e,t,o){let n=this._groupLookup.get(i)?.tabs;if(!n){this._logService.error("Invalid model for move change, rebuilding"),this._createTabsModel();return}let r=n.splice(t,1);r.length!==0&&(n.splice(e,0,r[0]),this._proxy.$acceptTabOperation({kind:3,groupId:i,tabDto:r[0],index:e,oldIndex:t}))}_createTabsModel(){if(this._editorGroupsService.groups.length===0)return;this._tabGroupModel=[],this._groupLookup.clear(),this._tabInfoLookup.clear();let i=[];for(let e of this._editorGroupsService.groups){let t={groupId:e.id,isActive:e.id===this._editorGroupsService.activeGroup.id,viewColumn:bC(this._editorGroupsService,e),tabs:[]};e.editors.forEach((o,n)=>{let r=this._buildTabObject(e,o,n);i.push(r),this._tabInfoLookup.set(this._generateTabId(o,e.id),{group:e,tab:r,editorInput:o})}),t.tabs=i,this._tabGroupModel.push(t),this._groupLookup.set(e.id,t),i=[]}this._proxy.$acceptEditorTabModel(this._tabGroupModel)}_updateTabsModel(i){let e=i.event,t=i.groupId;switch(e.kind){case 0:if(t===this._editorGroupsService.activeGroup.id){this._onDidGroupActivate();break}else return;case 9:if(e.editor!==void 0&&e.editorIndex!==void 0){this._onDidTabLabelChange(t,e.editor,e.editorIndex);break}case 5:if(e.editor!==void 0&&e.editorIndex!==void 0){this._onDidTabOpen(t,e.editor,e.editorIndex);break}case 6:if(e.editorIndex!==void 0){this._onDidTabClose(t,e.editorIndex);break}case 8:if(e.editorIndex!==void 0){this._onDidTabActiveChange(t,e.editorIndex);break}case 14:if(e.editorIndex!==void 0&&e.editor!==void 0){this._onDidTabDirty(t,e.editorIndex,e.editor);break}case 13:if(e.editorIndex!==void 0&&e.editor!==void 0){this._onDidTabPinChange(t,e.editorIndex,e.editor);break}case 11:if(e.editorIndex!==void 0&&e.editor!==void 0){this._onDidTabPreviewChange(t,e.editorIndex,e.editor);break}case 12:break;case 7:if(EXi(e)&&e.editor&&e.editorIndex!==void 0&&e.oldEditorIndex!==void 0){this._onDidTabMove(t,e.editorIndex,e.oldEditorIndex,e.editor);break}default:this._createTabsModel()}}$moveTab(i,e,t,o){let n=W_(this._editorGroupsService,this._configurationService,t),r=this._tabInfoLookup.get(i);if(!r?.tab)throw new Error(`Attempted to close tab with id ${i} which does not exist`);let l,c=this._editorGroupsService.getGroup(r.group.id);if(!c)return;if(this._groupLookup.get(n)===void 0){let p=3;t===vn&&(p=pC(this._configurationService)),l=this._editorGroupsService.addGroup(this._editorGroupsService.groups[this._editorGroupsService.groups.length-1],p)}else l=this._editorGroupsService.getGroup(n);if(!l)return;(e<0||e>l.editors.length)&&(e=l.editors.length);let u=r?.editorInput;u&&c.moveEditor(u,l,{index:e,preserveFocus:o})}async $closeTab(i,e){let t=new Map;for(let n of i){let r=this._tabInfoLookup.get(n),s=r?.tab,l=r?.group,c=r?.editorInput;if(!l||!s||!r||!c)continue;let u=t.get(l);u?u.push(c):t.set(l,[c])}let o=[];for(let[n,r]of t)o.push(await n.closeEditors(r,{preserveFocus:e}));return o.every(n=>n)}async $closeGroup(i,e){let t=[];for(let o of i){let n=this._editorGroupsService.getGroup(o);n&&(t.push(await n.closeAllEditors()),n.count===0&&this._editorGroupsService.getGroup(n.id)&&this._editorGroupsService.removeGroup(n))}return t.every(o=>o)}};mDt=I([vo(Gi.MainThreadEditorTabs),m(1,Et),m(2,B),m(3,ne),m(4,ee)],mDt);var hDt=class{dispose(){}$onUnexpectedError(i){i?.$isError&&(i=n6(i)),mt(i)}};hDt=I([vo(Gi.MainThreadErrors)],hDt);var Yh="workbench.view.extensions",c5=L(10070,"Extensions");var zi=ae("extensionsWorkbenchService");var VE="extensions.autoUpdate",i6e="extensions.autoCheckUpdates",OJi="extensions.closeExtensionDetailsOnViewChange",IV="extensions.autoRestart",dX=class extends C{constructor(e,t){super();this.containers=e;this._register(t.onChange(this.update,this))}set extension(e){this.containers.forEach(t=>t.extension=e)}update(e){for(let t of this.containers)e&&t.extension?Ot(t.extension.identifier,e.identifier)&&(t.extension.server&&e.server&&t.extension.server!==e.server?t.updateWhenCounterExtensionChanges&&t.update():t.extension=e):t.update()}};dX=I([m(1,zi)],dX);var iEe="workbench.views.extensions.workspaceRecommendations",gDt="workbench.views.extensions.searchOutdated",fDt="workbench.extensions.action.toggleIgnoreExtension",vDt="workbench.extensions.action.installVSIX",o6e="workbench.extensions.command.installFromVSIX",yV="workbench.extensions.action.listWorkspaceUnsupportedExtensions",yC=new Q("defaultExtensionViews",!0),bDt=new Q("hasOutdatedExtensions",!1),fh=new Q("hasGallery",!1),uX=new Q("extensionsGalleryStatus","unavailable"),FJi=new Q("extensionResultListFocused ",!0),n6e=new Q("searchMcpServers",!1),SDt=new Q("searchAgentPlugins",!1),oEe="_theme_",pX="0_install",r6e="0_update",s6e=new D("extensionsSearchActionsMenu"),Xh=new D("extensionsFilterSubMenu");function kP(a){if(a===null)return"None";switch(a){case 1:return"LocalProcess";case 2:return"LocalWebWorker";case 3:return"Remote"}}function VJi(a){switch(a){case 0:return"None";case 1:return"Local";case 2:return"Remote"}}function BJi(a,i,e,t){let o=WJi(a,e),n=WJi(i,e),r=new Map,s=c=>{if(r.has(c.key))return;let u=o.get(c.key)||null,p=n.get(c.key)||null,h=new opi(u,p);r.set(h.key,h)};o.forEach(c=>s(c)),n.forEach(c=>s(c));let l=new Map;return r.forEach(c=>{let u=!!c.local,p=!!c.remote,h=!!(c.local&&c.local.isUnderDevelopment),g=!!(c.remote&&c.remote.isUnderDevelopment),f=0;h&&!g?f=1:g&&!h&&(f=2),l.set(c.key,t(c.identifier,c.kind,u,p,f))}),l}function WJi(a,i){let e=new Map;return a.forEach(t=>{let o=new ipi(t,i(t));e.set(o.key,o)}),e}var ipi=class{constructor(i,e){this.desc=i;this.kind=e}get key(){return Ei.toKey(this.desc.identifier)}get isUnderDevelopment(){return this.desc.isUnderDevelopment}},opi=class{constructor(i,e){this.local=i;this.remote=e}get key(){return this.local?this.local.key:this.remote.key}get identifier(){return this.local?this.local.desc.identifier:this.remote.desc.identifier}get kind(){return this.local?this.local.kind:this.remote.kind}};var HJi={Uninitialized:{type:"uninitialized"},Disabled:a=>({type:"disabled",reason:a}),Idle:(a,i)=>({type:"idle",updateType:a,error:i}),CheckingForUpdates:a=>({type:"checking for updates",explicit:a}),AvailableForDownload:a=>({type:"available for download",update:a}),Downloading:(a,i,e,t,o,n)=>({type:"downloading",update:a,explicit:i,overwrite:e,downloadedBytes:t,totalBytes:o,startTime:n}),Downloaded:(a,i,e)=>({type:"downloaded",update:a,explicit:i,overwrite:e}),Updating:(a,i,e)=>({type:"updating",update:a,currentProgress:i,maxProgress:e}),Ready:(a,i,e)=>({type:"ready",update:a,explicit:i,overwrite:e}),Overwriting:(a,i)=>({type:"overwriting",update:a,explicit:i})},zd=ae("updateService");var IDt=class a{static{this._workerIdPool=0}createWorkerClient(i){let e,t=++a._workerIdPool;return i instanceof Worker||gzo(i)?e=Promise.resolve(i):e=this._createWorker(i),new Lht(new npi(e,t))}_createWorker(i){let e=this.getWorkerUrl(i),t=mzo(i.label,e,this._getWorkerLoadingFailedErrorMessage(i)),o=new Worker(yDt?yDt.createScriptURL(t):t,{name:i.label,type:"module"});return hzo(o)}_getWorkerLoadingFailedErrorMessage(i){}getWorkerUrl(i){if(!i.esmModuleLocation)throw new Error("Missing esmModuleLocation in WebWorkerDescriptor");return(typeof i.esmModuleLocation=="function"?i.esmModuleLocation():i.esmModuleLocation).toString(!0)}},yDt=(()=>{let a=globalThis;return typeof self=="object"&&self.constructor&&self.constructor.name==="DedicatedWorkerGlobalScope"&&a.workerttPolicy!==void 0?a.workerttPolicy:Kg("defaultWorkerFactory",{createScriptURL:i=>i})})();function UJi(a,i){if(!a.startsWith("blob:"))throw new URIError("Not a blob-url: "+a);return new Worker(yDt?yDt.createScriptURL(a):a,{...i,type:"module"})}function mzo(a,i,e){if(!(/^((http:)|(https:)|(file:))/.test(i)&&i.substring(0,globalThis.origin.length)!==globalThis.origin)){let o=i.lastIndexOf("?"),n=i.lastIndexOf("#",o),r=o>0?new URLSearchParams(i.substring(o+1,~n?n:void 0)):new URLSearchParams;kre.addSearchParam(r,!0,!0),r.toString()?i=`${i}?${r.toString()}#${a}`:i=`${i}#${a}`}let t=new Blob([si([`/*${a}*/`,`globalThis._VSCODE_NLS_MESSAGES = ${JSON.stringify(Y2e())};`,`globalThis._VSCODE_NLS_LANGUAGE = ${JSON.stringify(are())};`,`globalThis._VSCODE_FILE_ROOT = ${JSON.stringify(globalThis._VSCODE_FILE_ROOT)};`,"const ttPolicy = globalThis.trustedTypes?.createPolicy('defaultWorkerFactory', { createScriptURL: value => value });","globalThis.workerttPolicy = ttPolicy;",e?"try {":"",`await import(ttPolicy?.createScriptURL(${JSON.stringify(i)}) ?? ${JSON.stringify(i)});`,e?`} catch (err) { console.error(${JSON.stringify(e)}, err); throw err; }`:"","globalThis.postMessage({ type: 'vscode-worker-ready' });",`/*${a}*/`]).join("")],{type:"application/javascript"});return URL.createObjectURL(t)}function hzo(a){return new Promise((i,e)=>{a.onmessage=function(t){t.data.type==="vscode-worker-ready"&&(a.onmessage=null,i(a))},a.onerror=e})}function gzo(a){return!!a&&typeof a.then=="function"}var npi=class extends C{constructor(e,t){super();this._onMessage=this._register(new E);this.onMessage=this._onMessage.event;this._onError=this._register(new E);this.onError=this._onError.event;this.id=t,this.worker=e,this.postMessage("-please-ignore-",[]);let o=n=>{this._onError.fire(n)};this.worker.then(n=>{n.onmessage=r=>{this._onMessage.fire(r.data)},n.onmessageerror=r=>{this._onError.fire(r)},typeof n.addEventListener=="function"&&n.addEventListener("error",o)}),this._register(Z(()=>{this.worker?.then(n=>{n.onmessage=null,n.onmessageerror=null,n.removeEventListener("error",o),n.terminate()}),this.worker=null}))}getId(){return this.id}postMessage(e,t){this.worker?.then(o=>{try{o.postMessage(e,t)}catch(n){mt(n),mt(new Error("FAILED to post message to worker",{cause:n}))}})}};var wC=ae("timerService"),rpi=class{constructor(){this._entries=[]}setMarks(i,e){this._entries.push([i,e])}getDuration(i,e){let t=this._findEntry(i);if(!t)return 0;let o=this._findEntry(e);return o?o.startTime-t.startTime:0}getStartTime(i){let e=this._findEntry(i);return e?e.startTime:-1}_findEntry(i){for(let[,e]of this._entries)for(let t=e.length-1;t>=0;t--)if(e[t].name===i)return e[t]}getEntries(){return this._entries.slice(0)}},nEe=class{constructor(i,e,t,o,n,r,s,l,c){this._lifecycleService=i;this._contextService=e;this._extensionService=t;this._updateService=o;this._paneCompositeService=n;this._editorService=r;this._accessibilityService=s;this._telemetryService=l;this._barrier=new Np;this._marks=new rpi;this._rndValueShouldSendTelemetry=Math.random()<.03;Promise.all([this._extensionService.whenInstalledExtensionsRegistered(),i.when(3),c.whenRestored,Promise.all(Array.from(oe.as(SV.Backend).backends.values()).map(u=>u.whenReady))]).then(()=>(this.setPerformanceMarks("renderer",S4i()),this._computeStartupMetrics())).then(u=>{this._startupMetrics=u,this._reportStartupTimes(u),this._barrier.open()}),this.perfBaseline=this._barrier.wait().then(()=>this._lifecycleService.when(4)).then(()=>Pi(this._startupMetrics.timers.ellapsedRequire)).then(()=>{let u=(function(){let f=!1;function v(y){return f?0:(performance.now()-b>=1e3&&(f=!0),y<=2?y:v(y-1)+v(y-2))}let b=performance.now();v(24);let S=Math.round(performance.now()-b);self.postMessage({value:f?-1:S})}).toString(),p=new Blob([`(${u})();`],{type:"application/javascript"}),h=URL.createObjectURL(p),g=UJi(h,{name:"perfBaseline"});return new Promise(f=>{g.onmessage=v=>f(v.data.value)}).finally(()=>{g.terminate(),URL.revokeObjectURL(h)})})}whenReady(){return this._barrier.wait()}get startupMetrics(){if(!this._startupMetrics)throw new Error("illegal state, MUST NOT access startupMetrics before whenReady has resolved");return this._startupMetrics}setPerformanceMarks(i,e){let t=e.filter(o=>o.name.startsWith("code/"));this._marks.setMarks(i,t),this._reportPerformanceMarks(i,t)}getPerformanceMarks(){return this._marks.getEntries()}getDuration(i,e){return this._marks.getDuration(i,e)}getStartTime(i){return this._marks.getStartTime(i)}_reportStartupTimes(i){this._telemetryService.publicLog("startupTimeVaried",i)}_shouldReportPerfMarks(){return this._rndValueShouldSendTelemetry}_reportPerformanceMarks(i,e){if(this._shouldReportPerfMarks())for(let t of e)this._telemetryService.publicLog2("startup.timer.mark",{source:i,name:new Im(t.name),startTime:t.startTime})}async _computeStartupMetrics(){let i=this._isInitialStartup(),e;Gt?e="code/timeOrigin":e=i?"code/didStartMain":"code/willOpenNewWindow";let t=this._paneCompositeService.getActivePaneComposite(0),o=this._paneCompositeService.getActivePaneComposite(2),n=this._paneCompositeService.getActivePaneComposite(1),r={ellapsed:this._marks.getDuration(e,"code/didStartWorkbench"),isLatestVersion:!!await this._updateService.isLatestVersion(),didUseCachedData:this._didUseCachedData(),windowKind:this._lifecycleService.startupKind,windowCount:await this._getWindowCount(),viewletId:t?.getId(),auxiliaryViewletId:o?.getId(),editorIds:this._editorService.visibleEditors.map(s=>s.typeId),panelId:n?n.getId():void 0,timers:{ellapsedAppReady:i?this._marks.getDuration("code/didStartMain","code/mainAppReady"):void 0,ellapsedNlsGeneration:i?this._marks.getDuration("code/willGenerateNls","code/didGenerateNls"):void 0,ellapsedLoadMainBundle:i?this._marks.getDuration("code/willLoadMainBundle","code/didLoadMainBundle"):void 0,ellapsedRunMainBundle:i?this._marks.getDuration("code/didStartMain","code/didRunMainBundle"):void 0,ellapsedCrashReporter:i?this._marks.getDuration("code/willStartCrashReporter","code/didStartCrashReporter"):void 0,ellapsedMainServer:i?this._marks.getDuration("code/willStartMainServer","code/didStartMainServer"):void 0,ellapsedWindowCreate:i?this._marks.getDuration("code/willCreateCodeWindow","code/didCreateCodeWindow"):void 0,ellapsedWindowRestoreState:i?this._marks.getDuration("code/willRestoreCodeWindowState","code/didRestoreCodeWindowState"):void 0,ellapsedBrowserWindowCreate:i?this._marks.getDuration("code/willCreateCodeBrowserWindow","code/didCreateCodeBrowserWindow"):void 0,ellapsedWindowMaximize:i?this._marks.getDuration("code/willMaximizeCodeWindow","code/didMaximizeCodeWindow"):void 0,ellapsedWindowLoad:i?this._marks.getDuration("code/mainAppReady","code/willOpenNewWindow"):void 0,ellapsedWindowLoadToRequire:this._marks.getDuration("code/willOpenNewWindow","code/willLoadWorkbenchMain"),ellapsedRequire:this._marks.getDuration("code/willLoadWorkbenchMain","code/didLoadWorkbenchMain"),ellapsedWaitForWindowConfig:this._marks.getDuration("code/willWaitForWindowConfig","code/didWaitForWindowConfig"),ellapsedStorageInit:this._marks.getDuration("code/willInitStorage","code/didInitStorage"),ellapsedSharedProcesConnected:this._marks.getDuration("code/willConnectSharedProcess","code/didConnectSharedProcess"),ellapsedWorkspaceServiceInit:this._marks.getDuration("code/willInitWorkspaceService","code/didInitWorkspaceService"),ellapsedRequiredUserDataInit:this._marks.getDuration("code/willInitRequiredUserData","code/didInitRequiredUserData"),ellapsedOtherUserDataInit:this._marks.getDuration("code/willInitOtherUserData","code/didInitOtherUserData"),ellapsedExtensions:this._marks.getDuration("code/willLoadExtensions","code/didLoadExtensions"),ellapsedEditorRestore:this._marks.getDuration("code/willRestoreEditors","code/didRestoreEditors"),ellapsedViewletRestore:this._marks.getDuration("code/willRestoreViewlet","code/didRestoreViewlet"),ellapsedAuxiliaryViewletRestore:this._marks.getDuration("code/willRestoreAuxiliaryBar","code/didRestoreAuxiliaryBar"),ellapsedPanelRestore:this._marks.getDuration("code/willRestorePanel","code/didRestorePanel"),ellapsedWorkbenchContributions:this._marks.getDuration("code/willCreateWorkbenchContributions/1","code/didCreateWorkbenchContributions/2"),ellapsedWorkbench:this._marks.getDuration("code/willStartWorkbench","code/didStartWorkbench"),ellapsedExtensionsReady:this._marks.getDuration(e,"code/didLoadExtensions"),ellapsedRenderer:this._marks.getDuration("code/didStartRenderer","code/didStartWorkbench")},platform:void 0,release:void 0,arch:void 0,totalmem:void 0,freemem:void 0,meminfo:void 0,cpus:void 0,loadavg:void 0,isVMLikelyhood:void 0,initialStartup:i,hasAccessibilitySupport:this._accessibilityService.isScreenReaderOptimized(),emptyWorkbench:this._contextService.getWorkbenchState()===1};return await this._extendStartupInfo(r),r}};nEe=I([m(0,ao),m(1,Pe),m(2,lt),m(3,zd),m(4,ds),m(5,ee),m(6,Bi),m(7,Te),m(8,fi)],nEe);var wDt=class{constructor(i,e,t,o,n,r,s,l,c){this._extensionService=e;this._notificationService=t;this._extensionsWorkbenchService=o;this._hostService=n;this._extensionEnablementService=r;this._timerService=s;this._commandService=l;this._environmentService=c;this._extensionHostKind=i.extensionHostKind;let u=i;this._internalExtensionService=u.internalExtensionService,u._setExtensionHostProxy(new spi(i.getProxy(Zi.ExtHostExtensionService))),u._setAllMainProxyIdentifiers(Object.keys(Gi).map(p=>Gi[p]))}dispose(){}$getExtension(i){return this._extensionService.getExtension(i)}$activateExtension(i,e){return this._internalExtensionService._activateById(i,e)}async $onWillActivateExtension(i){this._internalExtensionService._onWillActivateExtension(i)}$onDidActivateExtension(i,e,t,o,n){this._internalExtensionService._onDidActivateExtension(i,e,t,o,n)}$onExtensionRuntimeError(i,e){let t=n6(e);this._internalExtensionService._onExtensionRuntimeError(i,t),console.error(`[${i.value}]${t.message}`),console.error(t.stack)}async $onExtensionActivationError(i,e,t){let o=n6(e);if(this._internalExtensionService._onDidActivateExtensionError(i,o),t){let r=await this._extensionService.getExtension(i.value);if(r){let l=(await this._extensionsWorkbenchService.queryLocal()).find(c=>Ot(c.identifier,{id:t.dependency}));if(l?.local){await this._handleMissingInstalledDependency(r,l.local);return}else{await this._handleMissingNotInstalledDependency(r,t.dependency);return}}}if(!this._environmentService.isBuilt||this._environmentService.isExtensionDevelopment){this._notificationService.error(o);return}console.error(o.message)}async _handleMissingInstalledDependency(i,e){let t=i.displayName||i.name;if(this._extensionEnablementService.isEnabled(e))this._notificationService.notify({severity:gt.Error,message:d(3017,null,t,e.manifest.displayName||e.manifest.name),actions:{primary:[pi({id:"reload",label:d(3016,null),run:()=>this._hostService.reload()})]}});else{let o=this._extensionEnablementService.getEnablementState(e);o===5?this._notificationService.notify({severity:gt.Error,message:d(3015,null,t,e.manifest.displayName||e.manifest.name)}):o===0?this._notificationService.notify({severity:gt.Error,message:d(3018,null,t,e.manifest.displayName||e.manifest.name),actions:{primary:[pi({id:"manageWorkspaceTrust",label:d(3014,null),run:()=>this._commandService.executeCommand("workbench.trust.manage")})]}}):this._extensionEnablementService.canChangeEnablement(e)?this._notificationService.notify({severity:gt.Error,message:d(3010,null,t,e.manifest.displayName||e.manifest.name),actions:{primary:[pi({id:"enable",label:d(3012,null),enabled:!0,run:()=>this._extensionEnablementService.setEnablement([e],o===10?12:13).then(()=>this._hostService.reload(),n=>this._notificationService.error(n))})]}}):this._notificationService.notify({severity:gt.Error,message:d(3011,null,t,e.manifest.displayName||e.manifest.name)})}}async _handleMissingNotInstalledDependency(i,e){let t=i.displayName||i.name,o=null;try{o=(await this._extensionsWorkbenchService.getExtensions([{id:e}],ve.None))[0]}catch{}o?this._notificationService.notify({severity:gt.Error,message:d(3019,null,t,o.displayName,o.publisherDisplayName),actions:{primary:[pi({id:"install",label:d(3013,null),run:()=>this._extensionsWorkbenchService.install(o).then(()=>this._hostService.reload(),n=>this._notificationService.error(n))})]}}):this._notificationService.error(d(3020,null,t,e))}async $setPerformanceMarks(i){this._extensionHostKind===1?this._timerService.setPerformanceMarks("localExtHost",i):this._extensionHostKind===2?this._timerService.setPerformanceMarks("workerExtHost",i):this._timerService.setPerformanceMarks("remoteExtHost",i)}async $asBrowserUri(i){return gn.uriToBrowserUri(A.revive(i))}};wDt=I([vo(Gi.MainThreadExtensionService),m(1,lt),m(2,Ne),m(3,zi),m(4,oi),m(5,Os),m(6,wC),m(7,ge),m(8,Vt)],wDt);var spi=class{constructor(i){this._actual=i}async resolveAuthority(i,e){return fzo(await this._actual.$resolveAuthority(i,e))}async getCanonicalURI(i,e){let t=await this._actual.$getCanonicalURI(i,e);return t&&A.revive(t)}startExtensionHost(i){return this._actual.$startExtensionHost(i)}extensionTestsExecute(){return this._actual.$extensionTestsExecute()}activateByEvent(i,e){return this._actual.$activateByEvent(i,e)}activate(i,e){return this._actual.$activate(i,e)}setRemoteEnvironment(i){return this._actual.$setRemoteEnvironment(i)}updateRemoteConnectionData(i){return this._actual.$updateRemoteConnectionData(i)}deltaExtensions(i){return this._actual.$deltaExtensions(i)}test_latency(i){return this._actual.$test_latency(i)}test_up(i){return this._actual.$test_up(i)}test_down(i){return this._actual.$test_down(i)}};function fzo(a){return a.type==="ok"?{type:"ok",value:{...a.value,authority:vzo(a.value.authority)}}:a}function vzo(a){return{...a,connectTo:bzo(a.connectTo)}}function bzo(a){return a.type===0?new skt(a.host,a.port):new rkt(a.id)}var K_=class{constructor(i,e){this._fileService=e;this._fileProvider=new jt;this._disposables=new P;this._proxy=i.getProxy(Zi.ExtHostFileSystem);let t=i.getProxy(Zi.ExtHostFileSystemInfo);for(let o of e.listCapabilities())t.$acceptProviderInfos(A.from({scheme:o.scheme,path:"/dummy"}),o.capabilities);this._disposables.add(e.onDidChangeFileSystemProviderRegistrations(o=>t.$acceptProviderInfos(A.from({scheme:o.scheme,path:"/dummy"}),o.provider?.capabilities??null))),this._disposables.add(e.onDidChangeFileSystemProviderCapabilities(o=>t.$acceptProviderInfos(A.from({scheme:o.scheme,path:"/dummy"}),o.provider.capabilities)))}dispose(){this._disposables.dispose(),this._fileProvider.dispose()}async $registerFileSystemProvider(i,e,t,o){this._fileProvider.set(i,new api(this._fileService,e,t,o,i,this._proxy))}$unregisterProvider(i){this._fileProvider.deleteAndDispose(i)}$onFileSystemChange(i,e){let t=this._fileProvider.get(i);if(!t)throw new Error("Unknown file provider");t.$onFileSystemChange(e)}async $stat(i){try{let e=await this._fileService.stat(A.revive(i));return{ctime:e.ctime,mtime:e.mtime,size:e.size,permissions:e.readonly?1:void 0,type:K_._asFileType(e)}}catch(e){return K_._handleError(e)}}async $readdir(i){try{let e=await this._fileService.resolve(A.revive(i),{resolveMetadata:!1});if(!e.isDirectory){let t=new Error(e.name);throw t.name="EntryNotADirectory",t}return e.children?e.children.map(t=>[t.name,K_._asFileType(t)]):[]}catch(e){return K_._handleError(e)}}static _asFileType(i){let e=0;return i.isFile?e+=1:i.isDirectory&&(e+=2),i.isSymbolicLink&&(e+=64),e}async $readFile(i){try{return(await this._fileService.readFile(A.revive(i))).value}catch(e){return K_._handleError(e)}}async $writeFile(i,e){try{await this._fileService.writeFile(A.revive(i),e)}catch(t){return K_._handleError(t)}}async $rename(i,e,t){try{await this._fileService.move(A.revive(i),A.revive(e),t.overwrite)}catch(o){return K_._handleError(o)}}async $copy(i,e,t){try{await this._fileService.copy(A.revive(i),A.revive(e),t.overwrite)}catch(o){return K_._handleError(o)}}async $mkdir(i){try{await this._fileService.createFolder(A.revive(i))}catch(e){return K_._handleError(e)}}async $delete(i,e){try{return await this._fileService.del(A.revive(i),e)}catch(t){return K_._handleError(t)}}static _handleError(i){if(i instanceof As)switch(i.fileOperationResult){case 1:i.name="EntryNotFound";break;case 0:i.name="EntryIsADirectory";break;case 6:i.name="NoPermissions";break;case 4:i.name="EntryExists";break}else if(i instanceof Error){let e=Gse(i);e!=="Unknown"&&(i.name=e)}throw i}$ensureActivation(i){return this._fileService.activateProvider(i)}};K_=I([vo(Gi.MainThreadFileSystem),m(1,be)],K_);var api=class a{constructor(i,e,t,o,n,r){this.readOnlyMessage=o;this._handle=n;this._proxy=r;this._onDidChange=new E;this.onDidChangeFile=this._onDidChange.event;this.onDidChangeCapabilities=H.None;this.capabilities=t,this._registration=i.registerProvider(e,this)}dispose(){this._registration.dispose(),this._onDidChange.dispose()}watch(i,e){let t=Math.random();return this._proxy.$watch(this._handle,t,i,e),Z(()=>{this._proxy.$unwatch(this._handle,t)})}$onFileSystemChange(i){this._onDidChange.fire(i.map(a._createFileChange))}static _createFileChange(i){return{resource:A.revive(i.resource),type:i.type}}async stat(i){try{return await this._proxy.$stat(this._handle,i)}catch(e){throw e}}async readFile(i){return(await this._proxy.$readFile(this._handle,i)).buffer}writeFile(i,e,t){return this._proxy.$writeFile(this._handle,i,Je.wrap(e),t)}delete(i,e){return this._proxy.$delete(this._handle,i,e)}mkdir(i){return this._proxy.$mkdir(this._handle,i)}readdir(i){return this._proxy.$readdir(this._handle,i)}rename(i,e,t){return this._proxy.$rename(this._handle,i,e,t)}copy(i,e,t){return this._proxy.$copy(this._handle,i,e,t)}open(i,e){return this._proxy.$open(this._handle,i,e)}close(i){return this._proxy.$close(this._handle,i)}async read(i,e,t,o,n){let r=await this._proxy.$read(this._handle,i,e,n);return t.set(r.buffer,o),r.byteLength}write(i,e,t,o,n){return this._proxy.$write(this._handle,i,e,Je.wrap(t).slice(o,o+n))}};var u5=class{constructor(i,e,t,o,n,r,s,l,c,u,p){this._fileService=e;this._logService=p;this._listener=new P;this._watches=new jt;this._proxy=i.getProxy(Zi.ExtHostFileSystemEventService),this._listener.add(e.onDidFilesChange(f=>{this._proxy.$onFileEvent({created:f.rawAdded,changed:f.rawUpdated,deleted:f.rawDeleted})}));let h=this,g=new class{async participate(f,v,b,S,y){if(b?.isUndoing)return;let w=new $e(y),k=setTimeout(()=>w.cancel(),S),T=await n.withProgress({location:15,title:this._progressLabel(v),cancellable:!0,delay:Math.min(S/2,3e3)},()=>{let V=h._proxy.$onWillRunFileOperation(v,f,S,w.token);return wa(V,w.token)},()=>{w.cancel()}).finally(()=>{w.dispose(),clearTimeout(k)});if(!T||T.edit.edits.length===0)return;let N=T.edit.edits.some(V=>V.metadata?.needsConfirmation),O=s.getBoolean(u5.MementoKeyAdditionalEdits,0);if(c.extensionTestsLocationURI&&(O=!1),O===void 0){let V;if(T.extensionNames.length===1?v===0?V=d(3023,null,T.extensionNames[0]):v===3?V=d(3022,null,T.extensionNames[0]):v===2?V=d(3025,null,T.extensionNames[0]):V=d(3024,null,T.extensionNames[0]):v===0?V=d(3027,null,T.extensionNames.length):v===3?V=d(3026,null,T.extensionNames.length):v===2?V=d(3029,null,T.extensionNames.length):V=d(3028,null,T.extensionNames.length),N){let{confirmed:U}=await r.confirm({type:gt.Info,message:V,primaryButton:d(3038,null),cancelButton:d(3030,null)});if(O=!0,!U)return}else{let U;(se=>(se[se.OK=0]="OK",se[se.Preview=1]="Preview",se[se.Cancel=2]="Cancel"))(U||={});let{result:G,checkboxChecked:$}=await r.prompt({type:gt.Info,message:V,buttons:[{label:d(3037,null),run:()=>0},{label:d(3038,null),run:()=>1}],cancelButton:{label:d(3030,null),run:()=>2},checkbox:{label:d(3021,null)}});if(G===2)return;O=G===1,$&&s.store(u5.MementoKeyAdditionalEdits,O,0,0)}}l.info("[onWill-handler] applying additional workspace edit from extensions",T.extensionNames),await o.apply(iV(T.edit,u),{undoRedoGroupId:b?.undoRedoGroupId,showPreview:O})}_progressLabel(f){switch(f){case 0:return d(3033,null);case 2:return d(3035,null);case 3:return d(3032,null);case 1:return d(3034,null);case 4:return d(3036,null)}}};this._listener.add(t.addFileOperationParticipant(g)),this._listener.add(t.onDidRunWorkingCopyFileOperation(f=>this._proxy.$onDidRunFileOperation(f.operation,f.files)))}async $watch(i,e,t,o,n){let r=A.revive(t);await this._fileService.canHandleResource(r)||this._logService.warn(`MainThreadFileSystemEventService#$watch(): cannot watch resource as its scheme is not handled by the file service (extension: ${i}, path: ${r.toString(!0)})`);let l={...o};if(l.recursive)try{(await this._fileService.stat(r)).isDirectory||(l.recursive=!1)}catch{}if(n&&!l.recursive){this._logService.trace(`MainThreadFileSystemEventService#$watch(): request to start watching correlated (extension: ${i}, path: ${r.toString(!0)}, recursive: ${l.recursive}, session: ${e}, excludes: ${JSON.stringify(l.excludes)}, includes: ${JSON.stringify(l.includes)})`);let c=new P,u=c.add(this._fileService.createWatcher(r,{...l,recursive:!1}));c.add(u.onDidChange(p=>{this._proxy.$onFileEvent({session:e,created:p.rawAdded,changed:p.rawUpdated,deleted:p.rawDeleted})})),this._watches.set(e,c)}else{this._logService.trace(`MainThreadFileSystemEventService#$watch(): request to start watching uncorrelated (extension: ${i}, path: ${r.toString(!0)}, recursive: ${l.recursive}, session: ${e}, excludes: ${JSON.stringify(l.excludes)}, includes: ${JSON.stringify(l.includes)})`);let c=this._fileService.watch(r,l);this._watches.set(e,c)}}$unwatch(i){this._watches.has(i)&&(this._logService.trace(`MainThreadFileSystemEventService#$unwatch(): request to stop watching (session: ${i})`),this._watches.deleteAndDispose(i))}dispose(){this._listener.dispose(),this._watches.dispose()}};u5.MementoKeyAdditionalEdits="file.particpants.additionalEdits",u5=I([vo(Gi.MainThreadFileSystemEventService),m(1,be),m(2,kp),m(3,ma),m(4,Bo),m(5,ct),m(6,le),m(7,ne),m(8,Co),m(9,dt),m(10,ne)],u5);W(class extends K{constructor(){super({id:"files.participants.resetChoice",title:{value:d(3031,null),original:"Reset choice for 'File operation needs preview'"},f1:!0})}run(i){i.get(le).remove(u5.MementoKeyAdditionalEdits,0)}});var BE=Symbol("unset"),EP=class{constructor(){this.root=new l6e;this._size=0}get size(){return this._size}get nodes(){return this.root.children?.values()||ht.empty()}get entries(){return this.root.children?.entries()||ht.empty()}insert(i,e,t){this.opNode(i,o=>o._value=e,t)}mutate(i,e){this.opNode(i,t=>t._value=e(t._value===BE?void 0:t._value))}mutatePath(i,e){this.opNode(i,()=>{},t=>e(t))}delete(i){let e=this.getPathToKey(i);if(!e)return;let t=e.length-1,o=e[t].node._value;if(o!==BE){for(this._size--,e[t].node._value=BE;t>0;t--){let{node:n,part:r}=e[t];if(n.children?.size||n._value!==BE)break;e[t-1].node.children.delete(r)}return o}}*deleteRecursive(i){let e=this.getPathToKey(i);if(!e)return;let t=e[e.length-1].node;for(let o=e.length-1;o>0;o--){let n=e[o-1];if(n.node.children.delete(e[o].part),n.node.children.size>0||n.node._value!==BE)break}for(let o of zJi(t))o._value!==BE&&(this._size--,yield o._value);t===this.root&&(this.root._value=BE,this.root.children=void 0)}find(i){let e=this.root;for(let t of i){let o=e.children?.get(t);if(!o)return;e=o}return e._value===BE?void 0:e._value}hasKeyOrParent(i){let e=this.root;for(let t of i){let o=e.children?.get(t);if(!o)return!1;if(o._value!==BE)return!0;e=o}return!1}hasKeyOrChildren(i){let e=this.root;for(let t of i){let o=e.children?.get(t);if(!o)return!1;e=o}return!0}hasKey(i){let e=this.root;for(let t of i){let o=e.children?.get(t);if(!o)return!1;e=o}return e._value!==BE}getPathToKey(i){let e=[{part:"",node:this.root}],t=0;for(let o of i){let n=e[t].node.children?.get(o);if(!n)return;e.push({part:o,node:n}),t++}return e}opNode(i,e,t){let o=this.root;for(let s of i){if(o.children)if(o.children.has(s))o=o.children.get(s);else{let l=new l6e;o.children.set(s,l),o=l}else{let l=new l6e;o.children=new Map([[s,l]]),o=l}t?.(o)}let n=o._value===BE?0:1;e(o);let r=o._value===BE?0:1;this._size+=r-n}*values(){for(let{_value:i}of zJi(this.root))i!==BE&&(yield i)}};function*zJi(a){let i=[a];for(;i.length>0;){let e=i.pop();if(yield e,e.children)for(let t of e.children.values())i.push(t)}}var l6e=class{constructor(){this._value=BE}get value(){return this._value===BE?void 0:this._value}set value(i){this._value=i===void 0?BE:i}};var TP=(u=>(u.SessionStart="SessionStart",u.SessionEnd="SessionEnd",u.UserPromptSubmit="UserPromptSubmit",u.PreToolUse="PreToolUse",u.PostToolUse="PostToolUse",u.PreCompact="PreCompact",u.SubagentStart="SubagentStart",u.SubagentStop="SubagentStop",u.Stop="Stop",u.ErrorOccurred="ErrorOccurred",u))(TP||{}),Jh={vscode:{SessionStart:"SessionStart",UserPromptSubmit:"UserPromptSubmit",PreToolUse:"PreToolUse",PostToolUse:"PostToolUse",PreCompact:"PreCompact",SubagentStart:"SubagentStart",SubagentStop:"SubagentStop",Stop:"Stop"},"github-copilot":{sessionStart:"SessionStart",sessionEnd:"SessionEnd",userPromptSubmitted:"UserPromptSubmit",preToolUse:"PreToolUse",postToolUse:"PostToolUse",agentStop:"Stop",subagentStop:"SubagentStop",errorOccurred:"ErrorOccurred"},claude:{SessionStart:"SessionStart",UserPromptSubmit:"UserPromptSubmit",PreToolUse:"PreToolUse",PostToolUse:"PostToolUse",PreCompact:"PreCompact",SubagentStart:"SubagentStart",SubagentStop:"SubagentStop",Stop:"Stop"},undefined:Object.fromEntries(Object.values(TP).map(a=>[a,a]))},CC={SessionStart:{label:d(7687,null),description:d(7686,null)},UserPromptSubmit:{label:d(7695,null),description:d(7694,null)},PreToolUse:{label:d(7683,null),description:d(7682,null)},PostToolUse:{label:d(7679,null),description:d(7678,null)},PreCompact:{label:d(7681,null),description:d(7680,null)},SubagentStart:{label:d(7691,null),description:d(7690,null)},SubagentStop:{label:d(7693,null),description:d(7692,null)},Stop:{label:d(7689,null),description:d(7688,null)},SessionEnd:{label:d(7685,null),description:d(7684,null)},ErrorOccurred:{label:d(7677,null),description:d(7676,null)}};function xDt(a,i){if(!a)return i;let e={...a};for(let t of Object.values(TP)){let o=a[t],n=i[t];n&&n.length>0&&(e[t]=o?[...o,...n]:n)}return e}var xC={type:d(7669,null),command:d(7660,null),windows:d(7670,null),linux:d(7664,null),osx:d(7665,null),bash:d(7658,null),powershell:d(7666,null),cwd:d(7662,null),env:d(7663,null),timeout:d(7667,null),timeoutSec:d(7668,null)},Szo={type:"object",additionalProperties:!0,required:["type"],anyOf:[{required:["command"]},{required:["windows"]},{required:["linux"]},{required:["osx"]},{required:["bash"]},{required:["powershell"]}],errorMessage:d(7661,null),properties:{type:{type:"string",enum:["command"],description:xC.type},command:{type:"string",description:xC.command},windows:{type:"string",description:xC.windows},linux:{type:"string",description:xC.linux},osx:{type:"string",description:xC.osx},cwd:{type:"string",description:xC.cwd},env:{type:"object",additionalProperties:{type:"string"},description:xC.env},timeout:{type:"number",default:30,description:xC.timeout}}},Izo={type:"array",items:Szo};function $Ji(a,i){return Object.fromEntries(Object.entries(Jh[a]).map(([e,t])=>[e,{...i,description:CC[t]?.description}]))}var yzo=$Ji("vscode",Izo),wzo={type:"object",additionalProperties:!0,required:["type"],anyOf:[{required:["bash"]},{required:["powershell"]}],errorMessage:d(7659,null),properties:{type:{type:"string",enum:["command"],description:xC.type},bash:{type:"string",description:xC.bash},powershell:{type:"string",description:xC.powershell},cwd:{type:"string",description:xC.cwd},env:{type:"object",additionalProperties:{type:"string"},description:xC.env},timeoutSec:{type:"number",default:10,description:xC.timeoutSec}}},Czo={type:"array",items:wzo},xzo=$Ji("github-copilot",Czo),qJi={$schema:"http://json-schema.org/draft-07/schema#",type:"object",description:d(7671,null),additionalProperties:!0,required:["hooks"],properties:{hooks:{type:"object",description:d(7672,null),additionalProperties:!0}},if:{required:["version"],properties:{version:{type:"number"}}},then:{properties:{version:{type:"number",description:d(7675,null)},hooks:{properties:xzo}}},else:{properties:{hooks:{properties:yzo}}},defaultSnippets:[{label:d(7673,null),description:d(7674,null),body:{hooks:{SessionStart:[{type:"command",command:'${1:echo "Session started" >> session.log}'}],PreToolUse:[{type:"command",command:"${2:./scripts/validate.sh}",timeout:15}]}}}]},cpi="vscode://schemas/hooks";function c6e(a){if(Object.values(TP).includes(a))return a}function kzo(a){if(a.type!=="command")return;let i=typeof a.command=="string"&&a.command.length>0,e=typeof a.bash=="string"&&a.bash.length>0,t=typeof a.powershell=="string"&&a.powershell.length>0,o=typeof a.windows=="string"&&a.windows.length>0,n=typeof a.linux=="string"&&a.linux.length>0,r=typeof a.osx=="string"&&a.osx.length>0,s=o?a.windows:t?a.powershell:void 0,l=n?a.linux:e?a.bash:void 0,c=r?a.osx:e?a.bash:void 0,u=o?"windows":t?"powershell":void 0,p=n?"linux":e?"bash":void 0,h=r?"osx":e?"bash":void 0;return{...i&&{command:a.command},...s&&{windows:s},...l&&{linux:l},...c&&{osx:c},...u&&{windowsSource:u},...p&&{linuxSource:p},...h&&{osxSource:h},...typeof a.cwd=="string"&&{cwd:a.cwd},...typeof a.env=="object"&&a.env!==null&&{env:a.env},...typeof a.timeout!="number"&&typeof a.timeoutSec=="number"&&{timeout:a.timeoutSec},...typeof a.timeout=="number"&&{timeout:a.timeout}}}function dpi(a,i){return i===1&&a.windows?a.windows:i===2&&a.osx?a.osx:i===3&&a.linux?a.linux:a.command}function jJi(a,i){return i===1&&a.windows?a.windowsSource??"windows":i===2&&a.osx?a.osxSource??"osx":i===3&&a.linux?a.linuxSource??"linux":"command"}function p5(a,i){let e=dpi(a,i);return e||""}function KJi(a,i,e){let t=kzo(a);if(!t)return;let o;if(t.cwd){let n=v9(t.cwd,e);Xl(n)?o=A.file(n):i&&(o=je(i,n))}else o=i;return{type:"command",...t.command&&{command:t.command},...t.windows&&{windows:t.windows},...t.linux&&{linux:t.linux},...t.osx&&{osx:t.osx},...t.windowsSource&&{windowsSource:t.windowsSource},...t.linuxSource&&{linuxSource:t.linuxSource},...t.osxSource&&{osxSource:t.osxSource},...o&&{cwd:o},...t.env&&{env:t.env},...t.timeout!==void 0&&{timeout:t.timeout}}}function d6e(a,i,e){if(!a||typeof a!="object")return[];let t=a,o=[],n=t.hooks;if(n!==void 0&&Array.isArray(n))for(let r of n){if(!r||typeof r!="object")continue;let s=GJi(r),l=KJi(s,i,e);l&&o.push(l)}else{let r=GJi(t),s=KJi(r,i,e);s&&o.push(s)}return o}function GJi(a){return a.type===void 0||a.type==="command"?{...a,type:"command"}:a}function lpi(a){switch(a.type){case"scalar":return a.value;case"sequence":return a.items.map(lpi);case"map":{let i={};for(let e of a.properties)i[e.key.value]=lpi(e.value);return i}}}function QJi(a,i,e,t="undefined"){let o={},n=Jh[t]??Jh.undefined;for(let r of a.properties){let s=r.key.value,l=n[s]??c6e(s);if(!l||r.value.type!=="sequence")continue;let c=[];for(let u of r.value.items){let p=lpi(u),h=d6e(p,i,e);c.push(...h)}c.length>0&&(o[l]||(o[l]=[]),o[l].push(...c))}return o}var wV=ae("IMcpGalleryManifestService");function m5(a,i){let[e,t]=i.split("/");for(let o of a.resources){let[n,r]=o.type.split("/");if(n===e){if(!t||r===t)return o.id;break}}}var Tv;(l=>(l.LATEST_PROTOCOL_VERSION="2025-11-25",l.JSONRPC_VERSION="2.0",l.PARSE_ERROR=-32700,l.INVALID_REQUEST=-32600,l.METHOD_NOT_FOUND=-32601,l.INVALID_PARAMS=-32602,l.INTERNAL_ERROR=-32603,l.URL_ELICITATION_REQUIRED=-32042))(Tv||={});var YJi="ext.";function p6e(a,i){return Ei.toKey(a)+"/"+i}var upi;(i=>{function a(e,t){return e.id===t.id&&e.remoteAuthority===t.remoteAuthority&&e.label===t.label&&e.trustBehavior===t.trustBehavior&&uo(e.sandbox,t.sandbox)}i.equals=a})(upi||={});var CV;(t=>{function a(o){return o}t.toSerialized=a;function i(o){return{id:o.id,label:o.label,cacheNonce:o.cacheNonce,staticMetadata:o.staticMetadata,launch:_P.fromSerialized(o.launch),sandboxEnabled:o.sandboxEnabled,variableReplacement:o.variableReplacement?XJi.fromSerialized(o.variableReplacement):void 0}}t.fromSerialized=i;function e(o,n){return o.id===n.id&&o.label===n.label&&o.cacheNonce===n.cacheNonce&&$i(o.roots,n.roots,(r,s)=>r.toString()===s.toString())&&uo(o.launch,n.launch)&&uo(o.presentation,n.presentation)&&uo(o.variableReplacement,n.variableReplacement)&&uo(o.devMode,n.devMode)&&o.sandboxEnabled===n.sandboxEnabled}t.equals=e})(CV||={});var XJi;(e=>{function a(t){return t}e.toSerialized=a;function i(t){return{section:t.section,folder:t.folder?{...t.folder,uri:A.revive(t.folder.uri)}:void 0,target:t.target}}e.fromSerialized=i})(XJi||={});var rEe;(i=>i.Empty={working:!1,starting:[],serversRequiringInteraction:[]})(rEe||={});var es=ae("IMcpService"),hX=class{constructor(){this.participants=new w$}},nk;(i=>{let a;(r=>(r[r.Trusted=0]="Trusted",r[r.TrustedOnNonce=1]="TrustedOnNonce",r[r.Untrusted=2]="Untrusted",r[r.Unknown=3]="Unknown"))(a=i.Kind||={})})(nk||={});var sEe=a=>a.template!==void 0;var ppi=a=>a.replace(/[^a-z0-9_.-]/gi,"_"),JJi=a=>"/mcp."+ppi(a.label);var _P;(t=>{function a(o){return o}t.toSerialized=a;function i(o){switch(o.type){case 2:return{type:o.type,uri:A.revive(o.uri),headers:o.headers,authentication:o.authentication};case 1:return{type:o.type,cwd:o.cwd,command:o.command,args:o.args,env:o.env,envFile:o.envFile,sandbox:o.sandbox}}}t.fromSerialized=i;async function e(o){let n=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(JSON.stringify(o)));return b$(Je.wrap(new Uint8Array(n)))}t.hash=e})(_P||={});var ir;(n=>{let a;(u=>(u[u.Stopped=0]="Stopped",u[u.Starting=1]="Starting",u[u.Running=2]="Running",u[u.Error=3]="Error"))(a=n.Kind||={}),n.toString=r=>{switch(r.state){case 0:return d(11448,null);case 1:return d(11447,null);case 2:return d(11446,null);case 3:return d(11445,null,r.message);default:Hr(r)}},n.toKindString=r=>{switch(r){case 0:return"stopped";case 1:return"starting";case 2:return"running";case 3:return"error";default:Hr(r)}},n.canBeStarted=r=>r===3||r===0,n.isRunning=r=>!(0,n.canBeStarted)(r.state)})(ir||={});var gX=class extends Error{constructor(e,t,o){super(`MPC ${t}: ${e}`);this.code=t;this.data=o}},u6e=class extends Error{},dw=class a extends Error{constructor(e){super(`${a.prefix}${e}`);this.reason=e}static{this.prefix="User interaction required: "}static is(e){return e.message.startsWith(this.prefix)}};var Nf=ae("IMcpWorkbenchService"),mX=class extends C{constructor(e,t){super();this.containers=e;this._register(t.onChange(this.update,this))}set mcpServer(e){this.containers.forEach(t=>t.mcpServer=e)}update(e){for(let t of this.containers)e&&t.mcpServer?e.id===t.mcpServer.id&&(t.mcpServer=e):t.update()}};mX=I([m(1,Nf)],mX);var ode=new Q("mcpServersGalleryStatus","unavailable"),fX=new Q("hasInstalledMcpServers",!0),aEe="workbench.views.mcp.installed",uw;(o=>{o.scheme="mcp-resource";let i="dylo78gyp";function e(n,r){return typeof r=="string"&&(r=A.parse(r)),r.with({scheme:o.scheme,authority:b$(Je.fromString(n.id)),path:["",r.scheme,r.authority||i].join("/")+r.path})}o.fromServer=e;function t(n){if(typeof n=="string"&&(n=A.parse(n)),n.scheme!==o.scheme)throw new Error(`Invalid MCP resource URI: ${n.toString()}`);let r=n.path.split("/");if(r.length<3)throw new Error(`Invalid MCP resource URI: ${n.toString()}`);let[,s,l,...c]=r,u=new URL(`${s}://${l.toLowerCase()===i?"":l}`);return u.pathname=c.length?"/"+c.join("/"):"",u.search=n.query,u.hash=n.fragment,{definitionId:Fbe(n.authority).toString(),resourceURL:u}}o.toServer=t})(uw||={});var h5=ae("IMcpServerSampling"),gb=class a extends Error{constructor(e,t,o){super(t);this.code=e;this.data=o}static methodNotFound(e){return new a(Tv.METHOD_NOT_FOUND,`Method not found: ${e}`)}static notAllowed(){return new a(-32e3,"The user has denied permission to call this method.")}static unknown(e){let t=new a(Tv.INTERNAL_ERROR,`Unknown error: ${e.stack}`);return t.cause=e,t}};var m6e=ae("IMcpElicitationService"),ZJi="application/vnd.code.resource-link";var Pr=class a{constructor(i,e=i.length){this.path=i;this.viewEnd=e;if(i.length===0||e<1)throw new Error("cannot create test with empty path")}static fromExtHostTestItem(i,e,t=i.parent){if(i._isRoot)return new a([e]);let o=[i.id];for(let n=t;n&&n.id!==e;n=n.parent)o.push(n.id);return o.push(e),new a(o.reverse())}static isRoot(i){return!i.includes("\0")}static root(i){let e=i.indexOf("\0");return e===-1?i:i.slice(0,e)}static fromString(i){return new a(i.split("\0"))}static join(i,e){return new a([...i.path,e])}static split(i){return i.split("\0")}static joinToString(i,e){return i.toString()+"\0"+e}static parentId(i){let e=i.lastIndexOf("\0");return e===-1?void 0:i.slice(0,e)}static localId(i){let e=i.lastIndexOf("\0");return e===-1?i:i.slice(e+1)}static isChild(i,e){return e[i.length]==="\0"&&e.startsWith(i)}static compare(i,e){return i===e?0:a.isChild(i,e)?2:a.isChild(e,i)?3:1}static getLengthOfCommonPrefix(i,e){if(i===0)return 0;let t=0;for(;t<i-1;){for(let o=1;o<i;o++){let n=e(o-1),r=e(o);if(n.path[t]!==r.path[t])return t}t++}return t}get rootId(){return new a(this.path,1)}get parentId(){return this.viewEnd>1?new a(this.path,this.viewEnd-1):void 0}get localId(){return this.path[this.viewEnd-1]}get controllerId(){return this.path[0]}get isRoot(){return this.viewEnd===1}*idsFromRoot(){for(let i=1;i<=this.viewEnd;i++)yield new a(this.path,i)}*idsToRoot(){for(let i=this.viewEnd;i>0;i--)yield new a(this.path,i)}compare(i){if(typeof i=="string")return a.compare(this.toString(),i);for(let e=0;e<i.viewEnd&&e<this.viewEnd;e++)if(i.path[e]!==this.path[e])return 1;return i.viewEnd>this.viewEnd?2:i.viewEnd<this.viewEnd?3:0}toJSON(){return this.toString()}toString(){if(!this.stringifed){this.stringifed=this.path[0];for(let i=1;i<this.viewEnd;i++)this.stringifed+="\0",this.stringifed+=this.path[i]}return this.stringifed}};var DDt={0:"unset",1:"queued",2:"running",3:"passed",4:"failed",5:"skipped",6:"errored"};var Spi={2:d(15408,null),4:d(15407,null),8:d(15406,null)},eZi=[2,4,8,16,32,64];var h6e;(e=>(e.serialize=t=>({range:t.range.toJSON(),uri:t.uri.toJSON()}),e.deserialize=(t,o)=>({range:z.lift(o.range),uri:t.asCanonicalUri(A.revive(o.uri))})))(h6e||={});var mpi;(e=>(e.serialize=t=>({label:t.label,uri:t.uri?.toJSON(),position:t.position?.toJSON()}),e.deserialize=(t,o)=>({label:o.label,uri:o.uri?t.asCanonicalUri(A.revive(o.uri)):void 0,position:o.position?Ie.lift(o.position):void 0})))(mpi||={});var hpi;(e=>(e.serialize=t=>({message:t.message,type:0,expected:t.expected,actual:t.actual,contextValue:t.contextValue,location:t.location&&h6e.serialize(t.location),stackTrace:t.stackTrace?.map(mpi.serialize)}),e.deserialize=(t,o)=>({message:o.message,type:0,expected:o.expected,actual:o.actual,contextValue:o.contextValue,location:o.location&&h6e.deserialize(t,o.location),stackTrace:o.stackTrace&&o.stackTrace.map(n=>mpi.deserialize(t,n))})))(hpi||={});var f6e=(a,i)=>`${i?"s":"e"}${a}`,gpi;(e=>(e.serialize=t=>({message:t.message,type:1,offset:t.offset,length:t.length,location:t.location&&h6e.serialize(t.location)}),e.deserialize=(t,o)=>({message:o.message,type:1,offset:o.offset,length:o.length,location:o.location&&h6e.deserialize(t,o.location)})))(gpi||={});var XO;(t=>(t.serialize=o=>o.type===0?hpi.serialize(o):gpi.serialize(o),t.deserialize=(o,n)=>n.type===0?hpi.deserialize(o,n):gpi.deserialize(o,n),t.isDiffable=o=>o.type===0&&o.actual!==void 0&&o.expected!==void 0))(XO||={});var EDt;(t=>(t.serializeWithoutMessages=o=>({state:o.state,duration:o.duration,messages:[]}),t.serialize=o=>({state:o.state,duration:o.duration,messages:o.messages.map(XO.serialize)}),t.deserialize=(o,n)=>({state:n.state,duration:n.duration,messages:n.messages.map(r=>XO.deserialize(o,r))})))(EDt||={});var tZi="\0",lEe=(a,i)=>a+tZi+i,LDt=a=>{let i=a.indexOf(tZi);return{ctrlId:a.slice(0,i),tagId:a.slice(i+1)}},g6e;(e=>(e.serialize=t=>({extId:t.extId,label:t.label,tags:t.tags,busy:t.busy,children:void 0,uri:t.uri?.toJSON(),range:t.range?.toJSON()||null,description:t.description,error:t.error,sortText:t.sortText}),e.deserialize=(t,o)=>({extId:o.extId,label:o.label,tags:o.tags,busy:o.busy,children:void 0,uri:o.uri?t.asCanonicalUri(A.revive(o.uri)):void 0,range:o.range?z.lift(o.range):null,description:o.description,error:o.error,sortText:o.sortText})))(g6e||={});var pR;(e=>(e.serialize=t=>({expand:t.expand,item:g6e.serialize(t.item)}),e.deserialize=(t,o)=>({controllerId:Pr.root(o.item.extId),expand:o.expand,item:g6e.deserialize(t,o.item)})))(pR||={});var TDt;(e=>(e.serialize=t=>{let o;return t.item&&(o={},t.item.label!==void 0&&(o.label=t.item.label),t.item.tags!==void 0&&(o.tags=t.item.tags),t.item.busy!==void 0&&(o.busy=t.item.busy),t.item.uri!==void 0&&(o.uri=t.item.uri?.toJSON()),t.item.range!==void 0&&(o.range=t.item.range?.toJSON()),t.item.description!==void 0&&(o.description=t.item.description),t.item.error!==void 0&&(o.error=t.item.error),t.item.sortText!==void 0&&(o.sortText=t.item.sortText)),{extId:t.extId,expand:t.expand,item:o}},e.deserialize=t=>{let o;return t.item&&(o={},t.item.label!==void 0&&(o.label=t.item.label),t.item.tags!==void 0&&(o.tags=t.item.tags),t.item.busy!==void 0&&(o.busy=t.item.busy),t.item.range!==void 0&&(o.range=t.item.range?z.lift(t.item.range):null),t.item.description!==void 0&&(o.description=t.item.description),t.item.error!==void 0&&(o.error=t.item.error),t.item.sortText!==void 0&&(o.sortText=t.item.sortText)),{extId:t.extId,expand:t.expand,item:o}}))(TDt||={});var cEe=(a,i)=>{i.expand!==void 0&&(a.expand=i.expand),i.item!==void 0&&(a.item=a.item?Object.assign(a.item,i.item):i.item)},v6e;(t=>(t.serializeWithoutMessages=o=>({...pR.serialize(o),ownComputedState:o.ownComputedState,computedState:o.computedState,tasks:o.tasks.map(EDt.serializeWithoutMessages)}),t.serialize=o=>({...pR.serialize(o),ownComputedState:o.ownComputedState,computedState:o.computedState,tasks:o.tasks.map(EDt.serialize)}),t.deserialize=(o,n)=>({...pR.deserialize(o,n),ownComputedState:n.ownComputedState,computedState:n.computedState,tasks:n.tasks.map(r=>EDt.deserialize(o,r)),retired:!0})))(v6e||={});var Ipi;(e=>(e.empty=()=>({covered:0,total:0}),e.sum=(t,o)=>{t.covered+=o.covered,t.total+=o.total}))(Ipi||={});var ypi;(t=>(t.serialize=o=>({id:o.id,statement:o.statement,branch:o.branch,declaration:o.declaration,testIds:o.testIds,uri:o.uri.toJSON()}),t.deserialize=(o,n)=>({id:n.id,statement:n.statement,branch:n.branch,declaration:n.declaration,testIds:n.testIds,uri:o.asCanonicalUri(A.revive(n.uri))}),t.empty=(o,n)=>({id:o,uri:n,statement:Ipi.empty()})))(ypi||={});function wpi(a){return{...a,location:a.location?.toJSON()}}function Cpi(a){return a.location=a.location?Ie.isIPosition(a.location)?Ie.lift(a.location):z.lift(a.location):void 0,a}var xpi;(e=>(e.serialize=t=>t.type===0?vpi.serialize(t):bpi.serialize(t),e.deserialize=t=>t.type===0?vpi.deserialize(t):bpi.deserialize(t)))(xpi||={});var fpi;(e=>(e.serialize=wpi,e.deserialize=Cpi))(fpi||={});var vpi;(e=>(e.serialize=wpi,e.deserialize=Cpi))(vpi||={});var bpi;(e=>(e.serialize=t=>({...wpi(t),branches:t.branches?.map(fpi.serialize)}),e.deserialize=t=>({...Cpi(t),branches:t.branches?.map(fpi.deserialize)})))(bpi||={});var RDt;(e=>(e.deserialize=(t,o)=>o.op===0?{op:o.op,item:pR.deserialize(t,o.item)}:o.op===1?{op:o.op,item:TDt.deserialize(o.item)}:o.op===2?{op:o.op,uri:t.asCanonicalUri(A.revive(o.uri)),docv:o.docv}:o,e.serialize=t=>t.op===0?{op:t.op,item:pR.serialize(t.item)}:t.op===1?{op:t.op,item:TDt.serialize(t.item)}:t))(RDt||={});var _Dt=class{constructor(i){this.uriIdentity=i;this._tags=new Map;this.items=new Map;this.roots=new Set;this.busyControllerCount=0;this.pendingRootCount=0;this.tags=this._tags}apply(i){let e=this.createChangeCollector();for(let t of i)switch(t.op){case 0:this.add(pR.deserialize(this.uriIdentity,t.item),e);break;case 1:this.update(TDt.deserialize(t.item),e);break;case 3:this.remove(t.itemId,e);break;case 5:this.retireTest(t.itemId);break;case 4:this.updatePendingRoots(t.amount);break;case 6:this._tags.set(t.tag.id,t.tag);break;case 7:this._tags.delete(t.id);break}e.complete?.()}add(i,e){let t=Pr.parentId(i.item.extId)?.toString(),o;if(!t)o=this.createItem(i),this.roots.add(o),this.items.set(i.item.extId,o);else if(this.items.has(t)){let n=this.items.get(t);n.children.add(i.item.extId),o=this.createItem(i,n),this.items.set(i.item.extId,o)}else{console.error(`Test with unknown parent ID: ${JSON.stringify(i)}`);return}return e.add?.(o),i.expand===2&&this.busyControllerCount++,o}update(i,e){let t=this.items.get(i.extId);if(t)return i.expand!==void 0&&(t.expand===2&&this.busyControllerCount--,i.expand===2&&this.busyControllerCount++),cEe(t,i),e.update?.(t),t}remove(i,e){let t=this.items.get(i);if(!t)return;let o=Pr.parentId(t.item.extId)?.toString();o?this.items.get(o).children.delete(t.item.extId):this.roots.delete(t);let n=[[i]];for(;n.length;)for(let r of n.pop()){let s=this.items.get(r);s&&(n.push(s.children),this.items.delete(r),e.remove?.(s,s!==t),s.expand===2&&this.busyControllerCount--)}}retireTest(i){}updatePendingRoots(i){this.pendingRootCount+=i}createChangeCollector(){return{}}};var dEe=ae("IAiSettingsSearchService");var b6e=(a,i)=>a===i,Ezo={range:(a,i)=>a===i?!0:!a||!i?!1:a.equalsRange(i),busy:b6e,label:b6e,description:b6e,error:b6e,sortText:b6e,tags:(a,i)=>!(a.length!==i.length||a.some(e=>!i.includes(e)))},wza=Object.entries(Ezo);var MDt=class extends Error{constructor(i){super(`TestItem with ID "${i}" is invalid. Make sure to create it from the createTestItem method.`)}};var Tzo=new WeakMap;var iZi=a=>{let i=Tzo.get(a);if(!i)throw new MDt(a?.id||"<unknown>");return i};var Rzo;(e=>{function a(t){let{selectionStartLineNumber:o,selectionStartColumn:n,positionLineNumber:r,positionColumn:s}=t,l=new sc(o-1,n-1),c=new sc(r-1,s-1);return new bj(l,c)}e.to=a;function i(t){let{anchor:o,active:n}=t;return{selectionStartLineNumber:o.line+1,selectionStartColumn:o.character+1,positionLineNumber:n.line+1,positionColumn:n.character+1}}e.from=i})(Rzo||={});var Rs;(e=>{function a(t){if(!t)return;let{start:o,end:n}=t;return{startLineNumber:o.line+1,startColumn:o.character+1,endLineNumber:n.line+1,endColumn:n.character+1}}e.from=a;function i(t){if(!t)return;let{startLineNumber:o,startColumn:n,endLineNumber:r,endColumn:s}=t;return new Kc(o-1,n-1,r-1,s-1)}e.to=i})(Rs||={});var g5;(e=>{function a(t){return{uri:t.uri,range:Rs.from(t.range)}}e.from=a;function i(t){return new y_(A.revive(t.uri),Rs.to(t.range))}e.to=i})(g5||={});var Mzo;(i=>{function a(e){switch(e){case 1:return 1;case 0:return 0;case 3:return 3;case 2:return 2}}i.to=a})(Mzo||={});var I6e;(e=>{function a(t){return new sc(t.lineNumber-1,t.column-1)}e.to=a;function i(t){return{lineNumber:t.line+1,column:t.character+1}}e.from=i})(I6e||={});var Pzo;(t=>{function a(o,n,r){return si(Yl(o).map(s=>i(s,n,r)))}t.from=a;function i(o,n,r){if(typeof o=="string")return{$serialized:!0,language:o,isBuiltin:r?.isBuiltin};if(o)return{$serialized:!0,language:o.language,scheme:e(o.scheme,n),pattern:Az.from(o.pattern)??void 0,exclusive:o.exclusive,notebookType:o.notebookType,isBuiltin:r?.isBuiltin}}function e(o,n){return n&&typeof o=="string"?n.transformOutgoingScheme(o):o}})(Pzo||={});var kpi;(e=>{function a(t){switch(t){case 1:return 1;case 2:return 2}}e.from=a;function i(t){switch(t){case 1:return 1;case 2:return 2;default:return}}e.to=i})(kpi||={});var Azo;(e=>{function a(t){let o;return t.code&&(Ae(t.code)||Xo(t.code)?o=String(t.code):o={value:String(t.code.value),target:t.code.target}),{...Rs.from(t.range),message:t.message,source:t.source,code:o,severity:ADt.from(t.severity),relatedInformation:t.relatedInformation&&t.relatedInformation.map(Epi.from),tags:Array.isArray(t.tags)?si(t.tags.map(kpi.from)):void 0}}e.from=a;function i(t){let o=new Zle(Rs.to(t),t.message,ADt.to(t.severity));return o.source=t.source,o.code=Ae(t.code)?t.code:t.code?.value,o.relatedInformation=t.relatedInformation&&t.relatedInformation.map(Epi.to),o.tags=t.tags&&si(t.tags.map(kpi.to)),o}e.to=i})(Azo||={});var Epi;(e=>{function a(t){return{...Rs.from(t.location.range),message:t.message,resource:t.location.uri}}e.from=a;function i(t){return new aY(new y_(t.resource,Rs.to(t)),t.message)}e.to=i})(Epi||={});var ADt;(e=>{function a(t){switch(t){case 0:return 8;case 1:return 4;case 2:return 2;case 3:return 1}return 8}e.from=a;function i(t){switch(t){case 2:return 2;case 4:return 1;case 8:return 0;case 1:return 3;default:return 0}}e.to=i})(ADt||={});var Nzo;(e=>{function a(t){return typeof t=="number"&&t>=1?t-1:t===-2?vn:Un}e.from=a;function i(t){if(typeof t=="number"&&t>=0)return t+1;throw new Error("invalid 'EditorGroupColumn'")}e.to=i})(Nzo||={});var Ku;(r=>{function a(s){return s.map(r.from)}r.fromMany=a;function i(s){return s&&typeof s=="object"&&typeof s.language=="string"&&typeof s.value=="string"}function e(s){let l;if(i(s)){let{language:p,value:h}=s;l={value:"```"+p+`
`+h+"\n```\n"}}else EE.isMarkdownString(s)?l={value:s.value,isTrusted:s.isTrusted,supportThemeIcons:s.supportThemeIcons,supportHtml:s.supportHtml,supportAlertSyntax:s.supportAlertSyntax,baseUri:s.baseUri}:typeof s=="string"?l={value:s}:l={value:""};let c=Object.create(null);l.uris=c;let u=({href:p})=>{try{let h=A.parse(p,!0);h=h.with({query:t(h.query,c)}),c[p]=h}catch{}return""};return Yc.walkTokens(Yc.lexer(l.value),p=>{p.type==="link"?u({href:p.href}):p.type==="image"&&typeof p.href=="string"&&u(iSt(p.href))}),l}r.from=e;function t(s,l){if(!s)return s;let c;try{c=zg(s)}catch{}if(!c)return s;let u=!1;return c=Gk(c,p=>{if(A.isUri(p)){let h=`__uri_${Math.random().toString(16).slice(2,8)}`;return l[h]=p,u=!0,h}else return}),u?JSON.stringify(c):s}function o(s){let l=new EE(s.value,s.supportThemeIcons);return l.isTrusted=s.isTrusted,l.supportHtml=s.supportHtml,l.supportAlertSyntax=s.supportAlertSyntax,l.baseUri=s.baseUri?A.from(s.baseUri):void 0,l}r.to=o;function n(s){if(s)return typeof s=="string"?s:r.from(s)}r.fromStrict=n})(Ku||={});function Gpi(a){return typeof a>"u"?a:typeof a=="string"?A.file(a):a}var y6e;(i=>{function a(e){return typeof e>"u"?e:{contentText:e.contentText,contentIconPath:e.contentIconPath?Gpi(e.contentIconPath):void 0,border:e.border,borderColor:e.borderColor,fontStyle:e.fontStyle,fontWeight:e.fontWeight,textDecoration:e.textDecoration,color:e.color,backgroundColor:e.backgroundColor,margin:e.margin,width:e.width,height:e.height}}i.from=a})(y6e||={});var Tpi;(i=>{function a(e){return typeof e>"u"?e:{backgroundColor:e.backgroundColor,outline:e.outline,outlineColor:e.outlineColor,outlineStyle:e.outlineStyle,outlineWidth:e.outlineWidth,border:e.border,borderColor:e.borderColor,borderRadius:e.borderRadius,borderSpacing:e.borderSpacing,borderStyle:e.borderStyle,borderWidth:e.borderWidth,fontStyle:e.fontStyle,fontWeight:e.fontWeight,textDecoration:e.textDecoration,cursor:e.cursor,color:e.color,opacity:e.opacity,letterSpacing:e.letterSpacing,gutterIconPath:e.gutterIconPath?Gpi(e.gutterIconPath):void 0,gutterIconSize:e.gutterIconSize,overviewRulerColor:e.overviewRulerColor,before:e.before?y6e.from(e.before):void 0,after:e.after?y6e.from(e.after):void 0}}i.from=a})(Tpi||={});var nZi;(i=>{function a(e){if(typeof e>"u")return e;switch(e){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3}}i.from=a})(nZi||={});var Ozo;(i=>{function a(e){return{isWholeLine:e.isWholeLine,rangeBehavior:e.rangeBehavior?nZi.from(e.rangeBehavior):void 0,overviewRulerLane:e.overviewRulerLane,light:e.light?Tpi.from(e.light):void 0,dark:e.dark?Tpi.from(e.dark):void 0,backgroundColor:e.backgroundColor,outline:e.outline,outlineColor:e.outlineColor,outlineStyle:e.outlineStyle,outlineWidth:e.outlineWidth,border:e.border,borderColor:e.borderColor,borderRadius:e.borderRadius,borderSpacing:e.borderSpacing,borderStyle:e.borderStyle,borderWidth:e.borderWidth,fontStyle:e.fontStyle,fontWeight:e.fontWeight,textDecoration:e.textDecoration,cursor:e.cursor,color:e.color,opacity:e.opacity,letterSpacing:e.letterSpacing,gutterIconPath:e.gutterIconPath?Gpi(e.gutterIconPath):void 0,gutterIconSize:e.gutterIconSize,overviewRulerColor:e.overviewRulerColor,before:e.before?y6e.from(e.before):void 0,after:e.after?y6e.from(e.after):void 0}}i.from=a})(Ozo||={});var Nz;(e=>{function a(t){return{text:t.newText,eol:t.newEol&&Mpi.from(t.newEol),range:Rs.from(t.range)}}e.from=a;function i(t){let o=new Hx(Rs.to(t.range),t.text);return o.newEol=typeof t.eol>"u"?void 0:Mpi.to(t.eol),o}e.to=i})(Nz||={});var Fzo;(e=>{function a(t,o){let n={edits:[]};if(t instanceof dY){let r=new Mn;for(let s of t._allEntries())s._type===1&&A.isUri(s.to)&&s.from===void 0&&r.add(s.to);for(let s of t._allEntries())if(s._type===1){let l;s.options?.contents&&(ArrayBuffer.isView(s.options.contents)?l={type:"base64",value:Qd(Je.wrap(s.options.contents))}:l={type:"dataTransferItem",id:s.options.contents._itemId}),n.edits.push({oldResource:s.from,newResource:s.to,options:{...s.options,contents:l},metadata:s.metadata})}else s._type===2?n.edits.push({resource:s.uri,textEdit:Nz.from(s.edit),versionId:r.has(s.uri)?void 0:o?.getTextDocumentVersion(s.uri),metadata:s.metadata}):s._type===6?n.edits.push({resource:s.uri,textEdit:{range:Rs.from(s.range),text:s.edit.value,insertAsSnippet:!0,keepWhitespace:s.keepWhitespace},versionId:r.has(s.uri)?void 0:o?.getTextDocumentVersion(s.uri),metadata:s.metadata}):s._type===3?n.edits.push({metadata:s.metadata,resource:s.uri,cellEdit:s.edit,notebookVersionId:o?.getNotebookDocumentVersion(s.uri)}):s._type===5&&n.edits.push({metadata:s.metadata,resource:s.uri,notebookVersionId:o?.getNotebookDocumentVersion(s.uri),cellEdit:{editType:1,index:s.index,count:s.count,cells:s.cells.map(C6e.from)}})}return n}e.from=a;function i(t){let o=new dY,n=new vt;for(let r of t.edits)if(r.textEdit){let s=r,l=A.revive(s.resource),c=Rs.to(s.textEdit.range),u=s.textEdit.text,p=s.textEdit.insertAsSnippet,h;p?h=ece.replace(c,new TE(u)):h=Hx.replace(c,u);let g=n.get(l);g?g.push(h):n.set(l,[h])}else o.renameFile(A.revive(r.oldResource),A.revive(r.newResource),r.options);for(let[r,s]of n)o.set(r,s);return o}e.to=i})(Fzo||={});var f5;(t=>{let a=Object.create(null);a[0]=0,a[1]=1,a[2]=2,a[3]=3,a[4]=4,a[5]=5,a[6]=6,a[7]=7,a[8]=8,a[9]=9,a[10]=10,a[11]=11,a[12]=12,a[13]=13,a[14]=14,a[15]=15,a[16]=16,a[17]=17,a[18]=18,a[19]=19,a[20]=20,a[21]=21,a[22]=22,a[23]=23,a[24]=24,a[25]=25;function i(o){return typeof a[o]=="number"?a[o]:6}t.from=i;function e(o){for(let n in a)if(a[n]===o)return Number(n);return 6}t.to=e})(f5||={});var nde;(e=>{function a(t){if(t===1)return 1}e.from=a;function i(t){if(t===1)return 1}e.to=i})(nde||={});var _pi;(e=>{function a(t){return{name:t.name,kind:f5.from(t.kind),tags:t.tags&&t.tags.map(nde.from),containerName:t.containerName,location:w6e.from(t.location)}}e.from=a;function i(t){let o=new Sj(t.name,f5.to(t.kind),t.containerName,w6e.to(t.location));return o.tags=t.tags&&t.tags.map(nde.to),o}e.to=i})(_pi||={});var Wzo;(e=>{function a(t){let o={name:t.name||"!!MISSING: name!!",detail:t.detail,range:Rs.from(t.range),selectionRange:Rs.from(t.selectionRange),kind:f5.from(t.kind),tags:t.tags?.map(nde.from)??[]};return t.children&&(o.children=t.children.map(a)),o}e.from=a;function i(t){let o=new wj(t.name,t.detail,f5.to(t.kind),Rs.to(t.range),Rs.to(t.selectionRange));return dr(t.tags)&&(o.tags=t.tags.map(nde.to)),t.children&&(o.children=t.children.map(i)),o}e.to=i})(Wzo||={});var $pi;(e=>{function a(t){let o=new Nkt(f5.to(t.kind),t.name,t.detail||"",A.revive(t.uri),Rs.to(t.range),Rs.to(t.selectionRange));return o._sessionId=t._sessionId,o._itemId=t._itemId,o}e.to=a;function i(t,o,n){if(o=o??t._sessionId,n=n??t._itemId,o===void 0||n===void 0)throw new Error("invalid item");return{_sessionId:o,_itemId:n,name:t.name,detail:t.detail,kind:f5.from(t.kind),uri:t.uri,range:Rs.from(t.range),selectionRange:Rs.from(t.selectionRange),tags:t.tags?.map(nde.from)}}e.from=i})($pi||={});var Vzo;(i=>{function a(e){return new Okt($pi.to(e.from),e.fromRanges.map(t=>Rs.to(t)))}i.to=a})(Vzo||={});var Bzo;(i=>{function a(e){return new Fkt($pi.to(e.to),e.fromRanges.map(t=>Rs.to(t)))}i.to=a})(Bzo||={});var w6e;(e=>{function a(t){return{range:t.range&&Rs.from(t.range),uri:t.uri}}e.from=a;function i(t){return new y_(A.revive(t.uri),Rs.to(t.range))}e.to=i})(w6e||={});var Hzo;(e=>{function a(t){let o=t,n=t;return{originSelectionRange:o.originSelectionRange?Rs.from(o.originSelectionRange):void 0,uri:o.targetUri?o.targetUri:n.uri,range:Rs.from(o.targetRange?o.targetRange:n.range),targetSelectionRange:o.targetSelectionRange?Rs.from(o.targetSelectionRange):void 0}}e.from=a;function i(t){return{targetUri:A.revive(t.uri),targetRange:Rs.to(t.range),targetSelectionRange:t.targetSelectionRange?Rs.to(t.targetSelectionRange):void 0,originSelectionRange:t.originSelectionRange?Rs.to(t.originSelectionRange):void 0}}e.to=i})(Hzo||={});var Uzo;(e=>{function a(t){return{range:Rs.from(t.range),contents:Ku.fromMany(t.contents),canIncreaseVerbosity:t.canIncreaseVerbosity,canDecreaseVerbosity:t.canDecreaseVerbosity}}e.from=a;function i(t){let o=t.contents.map(Ku.to),n=Rs.to(t.range),r=t.canIncreaseVerbosity,s=t.canDecreaseVerbosity;return new pxe(o,n,r,s)}e.to=i})(Uzo||={});var zzo;(e=>{function a(t){return{range:Rs.from(t.range),expression:t.expression}}e.from=a;function i(t){return new Cxe(Rs.to(t.range),t.expression)}e.to=i})(zzo||={});var Kzo;(e=>{function a(t){if(t instanceof xxe)return{type:"text",range:Rs.from(t.range),text:t.text};if(t instanceof kxe)return{type:"variable",range:Rs.from(t.range),variableName:t.variableName,caseSensitiveLookup:t.caseSensitiveLookup};if(t instanceof Exe)return{type:"expression",range:Rs.from(t.range),expression:t.expression};throw new Error("Unknown 'InlineValue' type")}e.from=a;function i(t){switch(t.type){case"text":return{range:Rs.to(t.range),text:t.text};case"variable":return{range:Rs.to(t.range),variableName:t.variableName,caseSensitiveLookup:t.caseSensitiveLookup};case"expression":return{range:Rs.to(t.range),expression:t.expression}}}e.to=i})(Kzo||={});var Gzo;(e=>{function a(t){return{frameId:t.frameId,stoppedLocation:Rs.from(t.stoppedLocation)}}e.from=a;function i(t){return new Txe(t.frameId,Rs.to(t.stoppedLocation))}e.to=i})(Gzo||={});var Dpi;(e=>{function a(t){return{range:Rs.from(t.range),kind:t.kind}}e.from=a;function i(t){return new mxe(Rs.to(t.range),t.kind)}e.to=i})(Dpi||={});var $zo;(e=>{function a(t){return{uri:t.uri,highlights:t.highlights.map(Dpi.from)}}e.from=a;function i(t){return new hxe(A.revive(t.uri),t.highlights.map(Dpi.to))}e.to=i})($zo||={});var rZi;(i=>{function a(e){switch(e){case 1:return 1;case 2:return 2;case 0:default:return 0}}i.to=a})(rZi||={});var qzo;(i=>{function a(e){return{triggerKind:rZi.to(e.triggerKind),triggerCharacter:e.triggerCharacter}}i.to=a})(qzo||={});var sZi;(e=>{function a(t){if(t===1)return 1}e.from=a;function i(t){if(t===1)return 1}e.to=i})(sZi||={});var jzo;(i=>{function a(e,t,o){return"icon"in e&&"command"in e?{command:t.toInternal(e.command,o),icon:VZi.fromThemeIcon(e.icon)}:{command:t.toInternal(e,o)}}i.from=a})(jzo||={});var aZi;(o=>{let a=new Map([[1,0],[2,1],[3,2],[4,3],[5,4],[6,5],[7,7],[21,6],[8,8],[9,9],[10,12],[11,13],[20,14],[12,15],[19,16],[13,17],[14,28],[0,18],[15,19],[16,20],[17,21],[18,23],[22,10],[23,11],[24,24],[26,26],[25,25]]);function i(n){return a.get(n)??9}o.from=i;let e=new Map([[0,1],[1,2],[2,3],[3,4],[4,5],[5,6],[7,7],[6,21],[8,8],[9,9],[12,10],[13,11],[14,20],[15,12],[16,19],[17,13],[28,14],[18,0],[19,15],[20,16],[21,17],[23,18],[10,22],[11,23],[24,24],[25,25],[26,26]]);function t(n){return e.get(n)??9}o.to=t})(aZi||={});var Qzo;(i=>{function a(e,t){let o=new bxe(e.label);return o.insertText=e.insertText,o.kind=aZi.to(e.kind),o.tags=e.tags?.map(sZi.to),o.detail=e.detail,o.documentation=Mr(e.documentation)?Ku.to(e.documentation):e.documentation,o.sortText=e.sortText,o.filterText=e.filterText,o.preselect=e.preselect,o.commitCharacters=e.commitCharacters,z.isIRange(e.range)?o.range=Rs.to(e.range):typeof e.range=="object"&&(o.range={inserting:Rs.to(e.range.insert),replacing:Rs.to(e.range.replace)}),o.keepWhitespace=typeof e.insertTextRules>"u"?!1:!!(e.insertTextRules&1),typeof e.insertTextRules<"u"&&e.insertTextRules&4?o.insertText=new TE(e.insertText):(o.insertText=e.insertText,o.textEdit=o.range instanceof Kc?new Hx(o.range,o.insertText):void 0),e.additionalTextEdits&&e.additionalTextEdits.length>0&&(o.additionalTextEdits=e.additionalTextEdits.map(n=>Nz.to(n))),o.command=t&&e.command?t.fromInternal(e.command):void 0,o}i.to=a})(Qzo||={});var Lpi;(e=>{function a(t){if(typeof t.label!="string"&&!Array.isArray(t.label))throw new TypeError("Invalid label");return{label:t.label,documentation:Ku.fromStrict(t.documentation)}}e.from=a;function i(t){return{label:t.label,documentation:Mr(t.documentation)?Ku.to(t.documentation):t.documentation}}e.to=i})(Lpi||={});var Rpi;(e=>{function a(t){return{label:t.label,documentation:Ku.fromStrict(t.documentation),parameters:Array.isArray(t.parameters)?t.parameters.map(Lpi.from):[],activeParameter:t.activeParameter}}e.from=a;function i(t){return{label:t.label,documentation:Mr(t.documentation)?Ku.to(t.documentation):t.documentation,parameters:Array.isArray(t.parameters)?t.parameters.map(Lpi.to):[],activeParameter:t.activeParameter}}e.to=i})(Rpi||={});var Yzo;(e=>{function a(t){return{activeSignature:t.activeSignature,activeParameter:t.activeParameter,signatures:Array.isArray(t.signatures)?t.signatures.map(Rpi.from):[]}}e.from=a;function i(t){return{activeSignature:t.activeSignature,activeParameter:t.activeParameter,signatures:Array.isArray(t.signatures)?t.signatures.map(Rpi.to):[]}}e.to=i})(Yzo||={});var Xzo;(i=>{function a(e,t){let o=new vxe(I6e.to(t.position),typeof t.label=="string"?t.label:t.label.map(lZi.to.bind(void 0,e)),t.kind&&cZi.to(t.kind));return o.textEdits=t.textEdits&&t.textEdits.map(Nz.to),o.tooltip=Mr(t.tooltip)?Ku.to(t.tooltip):t.tooltip,o.paddingLeft=t.paddingLeft,o.paddingRight=t.paddingRight,o}i.to=a})(Xzo||={});var lZi;(i=>{function a(e,t){let o=new fxe(t.label);return o.tooltip=Mr(t.tooltip)?Ku.to(t.tooltip):t.tooltip,vse.is(t.command)&&(o.command=e.fromInternal(t.command)),t.location&&(o.location=w6e.to(t.location)),o}i.to=a})(lZi||={});var cZi;(e=>{function a(t){return t}e.from=a;function i(t){return t}e.to=i})(cZi||={});var Jzo;(e=>{function a(t){return{range:Rs.from(t.range),url:t.target,tooltip:t.tooltip}}e.from=a;function i(t){let o;if(t.url)try{o=typeof t.url=="string"?A.parse(t.url,!0):A.revive(t.url)}catch{}let n=new Sxe(Rs.to(t.range),o);return n.tooltip=t.tooltip,n}e.to=i})(Jzo||={});var Zzo;(e=>{function a(t){let o=new Ixe(t.label);return t.textEdit&&(o.textEdit=Nz.to(t.textEdit)),t.additionalTextEdits&&(o.additionalTextEdits=t.additionalTextEdits.map(n=>Nz.to(n))),o}e.to=a;function i(t){return{label:t.label,textEdit:t.textEdit?Nz.from(t.textEdit):void 0,additionalTextEdits:t.additionalTextEdits?t.additionalTextEdits.map(o=>Nz.from(o)):void 0}}e.from=i})(Zzo||={});var eKo;(e=>{function a(t){return new oce(t[0],t[1],t[2],t[3])}e.to=a;function i(t){return[t.red,t.green,t.blue,t.alpha]}e.from=i})(eKo||={});var tKo;(e=>{function a(t){return{range:Rs.from(t.range)}}e.from=a;function i(t){return new gxe(Rs.to(t.range))}e.to=i})(tKo||={});var iKo;(i=>{function a(e){switch(e){case 2:return 2;case 1:return 1;case 3:case 4:return 3}}i.to=a})(iKo||={});var oKo;(e=>{function a(t){switch(t){case 0:return 0;case 2:return 2;case 3:return 3;case 1:default:return 1}}e.from=a;function i(t){switch(t){case 0:return 0;case 2:return 2;case 3:return 3;case 1:default:return 1}}e.to=i})(oKo||={});var Mpi;(e=>{function a(t){if(t===2)return 1;if(t===1)return 0}e.from=a;function i(t){if(t===1)return 2;if(t===0)return 1}e.to=i})(Mpi||={});var nKo;(i=>{function a(e){if(typeof e=="object")return e.viewId;switch(e){case 1:return 3;case 10:return 10;case 15:return 15}throw new Error("Unknown 'ProgressLocation'")}i.from=a})(nKo||={});var rKo;(e=>{function a(t){let o={start:t.start+1,end:t.end+1};return t.kind&&(o.kind=Ppi.from(t.kind)),o}e.from=a;function i(t){let o={start:t.start-1,end:t.end-1};return t.kind&&(o.kind=Ppi.to(t.kind)),o}e.to=i})(rKo||={});var Ppi;(e=>{function a(t){if(t)switch(t){case 1:return Yk.Comment;case 2:return Yk.Imports;case 3:return Yk.Region}}e.from=a;function i(t){if(t)switch(t.value){case Yk.Comment.value:return 1;case Yk.Imports.value:return 2;case Yk.Region.value:return 3}}e.to=i})(Ppi||={});var sKo;(i=>{function a(e){if(e)return{pinned:typeof e.preview=="boolean"?!e.preview:void 0,inactive:e.background,preserveFocus:e.preserveFocus,selection:typeof e.selection=="object"?Rs.from(e.selection):void 0,override:typeof e.override=="boolean"?Ys.id:void 0}}i.from=a})(sKo||={});var Az;(o=>{function a(n){return n instanceof pY?n.toJSON():typeof n=="string"?n:i(n)||e(n)?new pY(n.baseUri??n.base,n.pattern).toJSON():n}o.from=a;function i(n){let r=n;return r?A.isUri(r.baseUri)&&typeof r.pattern=="string":!1}function e(n){let r=n;return r?typeof r.base=="string"&&typeof r.pattern=="string":!1}function t(n){return typeof n=="string"?n:new pY(A.revive(n.baseUri),n.pattern)}o.to=t})(Az||={});var aKo;(i=>{function a(e){if(e){if(Array.isArray(e))return e.map(a);if(typeof e=="string")return e;{let t=e;return{language:t.language,scheme:t.scheme,pattern:Az.from(t.pattern)??void 0,exclusive:t.exclusive,notebookType:t.notebookType}}}else return}i.from=a})(aKo||={});var lKo;(e=>{function a(t){return{start:t.start,end:t.end}}e.from=a;function i(t){return new vj(t.start,t.end)}e.to=i})(lKo||={});var Api;(e=>{function a(t){return{timing:typeof t.runStartTime=="number"&&typeof t.runEndTime=="number"?{startTime:t.runStartTime,endTime:t.runEndTime}:void 0,executionOrder:t.executionOrder,success:t.lastRunSuccess}}e.to=a;function i(t){return{lastRunSuccess:t.success,runStartTime:t.timing?.startTime,runEndTime:t.timing?.endTime,executionOrder:t.executionOrder}}e.from=i})(Api||={});var Npi;(e=>{function a(t){switch(t){case 1:return 1;case 2:default:return 2}}e.from=a;function i(t){switch(t){case 1:return 1;case 2:default:return 2}}e.to=i})(Npi||={});var cKo;(e=>{function a(t){let o={metadata:t.metadata??Object.create(null),cells:[]};for(let n of t.cells)cxe.validate(n),o.cells.push(C6e.from(n));return o}e.from=a;function i(t){let o=new O3e(t.cells.map(C6e.to));return mf(t.metadata)||(o.metadata=t.metadata),o}e.to=i})(cKo||={});var C6e;(e=>{function a(t){return{cellKind:Npi.from(t.kind),language:t.languageId,mime:t.mime,source:t.value,metadata:t.metadata,internalMetadata:Api.from(t.executionSummary??{}),outputs:t.outputs?t.outputs.map(Fpi.from):[]}}e.from=a;function i(t){return new cxe(Npi.to(t.cellKind),t.source,t.language,t.mime,t.outputs?t.outputs.map(Fpi.to):void 0,t.metadata,t.internalMetadata?Api.to(t.internalMetadata):void 0)}e.to=i})(C6e||={});var Opi;(e=>{function a(t){return{mime:t.mime,valueBytes:Je.wrap(t.data)}}e.from=a;function i(t){return new F3e(t.valueBytes.buffer,t.mime)}e.to=i})(Opi||={});var Fpi;(e=>{function a(t){return{outputId:t.id,items:t.items.map(Opi.from),metadata:t.metadata}}e.from=a;function i(t){let o=t.items.map(Opi.to);return new W3e(o,t.outputId,t.metadata)}e.to=i})(Fpi||={});var dKo;(t=>{function a(o){return e(o)?{include:Az.from(o.include)??void 0,exclude:Az.from(o.exclude)??void 0}:Az.from(o)??void 0}t.from=a;function i(o){return e(o)?{include:Az.to(o.include),exclude:Az.to(o.exclude)}:Az.to(o)}t.to=i;function e(o){let n=o;return n?!Jn(n.include)&&!Jn(n.exclude):!1}})(dKo||={});var uKo;(i=>{function a(e,t,o){let n=typeof e.command=="string"?{title:"",command:e.command}:e.command;return{alignment:e.alignment===1?1:2,command:t.toInternal(n,o),text:e.text,tooltip:e.tooltip,accessibilityInformation:e.accessibilityInformation,priority:e.priority}}i.from=a})(uKo||={});var pKo;(i=>{function a(e,t,o){let n=typeof e.command=="string"?{title:"",command:e.command}:e.command;return{command:t.toInternal(n,o),label:e.label,description:e.description,detail:e.detail,documentation:e.documentation}}i.from=a})(pKo||={});var mKo;(i=>{function a(e){return{transientOutputs:e?.transientOutputs??!1,transientCellMetadata:e?.transientCellMetadata??{},transientDocumentMetadata:e?.transientDocumentMetadata??{},cellContentMetadata:e?.cellContentMetadata??{}}}i.from=a})(mKo||={});var hKo;(e=>{function a(t){return{uri:t.uri,provides:t.provides}}e.from=a;function i(t){return new Bkt(A.revive(t.uri),t.provides)}e.to=i})(hKo||={});var dZi;(e=>{function a(t){return{message:Ku.fromStrict(t.message)||"",type:0,expected:t.expectedOutput,actual:t.actualOutput,contextValue:t.contextValue,location:t.location&&{range:Rs.from(t.location.range),uri:t.location.uri},stackTrace:t.stackTrace?.map(o=>({label:o.label,position:o.position&&I6e.from(o.position),uri:o.uri&&A.revive(o.uri).toJSON()}))}}e.from=a;function i(t){let o=new mY(typeof t.message=="string"?t.message:Ku.to(t.message));return o.actualOutput=t.actual,o.expectedOutput=t.expected,o.contextValue=t.contextValue,o.location=t.location?w6e.to(t.location):void 0,o}e.to=i})(dZi||={});var x6e;(e=>(e.namespace=lEe,e.denamespace=LDt))(x6e||={});var gKo;(i=>{function a(e){return{controllerId:e.controllerId,profileId:e.profileId,group:uZi.from(e.kind)}}i.from=a})(gKo||={});var uZi;(e=>{let a={3:8,2:4,1:2};function i(t){return a.hasOwnProperty(t)?a[t]:2}e.from=i})(uZi||={});var pZi;(e=>{function a(t){let o=iZi(t).controllerId;return{extId:Pr.fromExtHostTestItem(t,o).toString(),label:t.label,uri:A.revive(t.uri),busy:t.busy,tags:t.tags.map(n=>x6e.namespace(o,n.id)),range:z.lift(Rs.from(t.range)),description:t.description||null,sortText:t.sortText||null,error:t.error&&Ku.fromStrict(t.error)||null}}e.from=a;function i(t){return{parent:void 0,error:void 0,id:Pr.fromString(t.extId).localId,label:t.label,uri:A.revive(t.uri),tags:(t.tags||[]).map(o=>{let{tagId:n}=x6e.denamespace(o);return new rce(n)}),children:{add:()=>{},delete:()=>{},forEach:()=>{},*[Symbol.iterator](){},get:()=>{},replace:()=>{},size:0},range:Rs.to(t.range||void 0),canResolveChildren:!1,busy:t.busy,description:t.description||void 0,sortText:t.sortText||void 0}}e.toPlain=i})(pZi||={});(e=>{function a(t){return{id:t.id}}e.from=a;function i(t){return new rce(t.id)}e.to=i})(x6e||={});var fKo;(e=>{let a=(t,o)=>{let n=t.value;if(!n)return;let r={...pZi.toPlain(n.item),parent:o,taskStates:n.tasks.map(s=>({state:s.state,duration:s.duration,messages:s.messages.filter(l=>l.type===0).map(dZi.to)})),children:[]};if(t.children)for(let s of t.children.values()){let l=a(s,r);l&&r.children.push(l)}return r};function i(t){let o=new EP;for(let s of t.items)o.insert(Pr.fromString(s.item.extId).path,s);let n=[o.nodes],r=[];for(;n.length;)for(let s of n.pop())s.value?r.push(s):s.children&&n.push(s.children.values());return{completedAt:t.completedAt,results:r.map(s=>a(s)).filter(mo)}}e.to=i})(fKo||={});var vKo;(r=>{function a(s){return{covered:s.covered,total:s.total}}function i(s){return"line"in s?I6e.from(s):Rs.from(s)}function e(s){if(s)return"endLineNumber"in s?Rs.to(s):I6e.to(s)}function t(s){if(s.type===1){let l=[];if(s.branches)for(let c of s.branches)l.push({executed:c.count,location:e(c.location),label:c.label});return new Ukt(s.count,e(s.location),s.branches?.map(c=>new zkt(c.count,e(c.location),c.label)))}else return new Kkt(s.name,s.count,e(s.location))}r.to=t;function o(s){if(typeof s.executed=="number"&&s.executed<0)throw new Error(`Invalid coverage count ${s.executed}`);return"branches"in s?{count:s.executed,location:i(s.location),type:1,branches:s.branches.length?s.branches.map(l=>({count:l.executed,location:l.location&&i(l.location),label:l.label})):void 0}:{type:0,name:s.name,count:s.executed,location:i(s.location)}}r.fromDetails=o;function n(s,l,c){return p8e(c.statementCoverage),p8e(c.branchCoverage),p8e(c.declarationCoverage),{id:l,uri:c.uri,statement:a(c.statementCoverage),branch:c.branchCoverage&&a(c.branchCoverage),declaration:c.declarationCoverage&&a(c.declarationCoverage),testIds:c instanceof Hkt&&c.includesTests.length?c.includesTests.map(u=>Pr.fromExtHostTestItem(u,s).toString()):void 0}}r.fromFile=n})(vKo||={});var bKo;(i=>{function a(e){switch(e){case 1:return 1;case 2:return 2}}i.to=a})(bKo||={});var SKo;(e=>{function a(t){let o=new Gkt(f5.to(t.kind),t.name,t.detail||"",A.revive(t.uri),Rs.to(t.range),Rs.to(t.selectionRange));return o._sessionId=t._sessionId,o._itemId=t._itemId,o}e.to=a;function i(t,o,n){if(o=o??t._sessionId,n=n??t._itemId,o===void 0||n===void 0)throw new Error("invalid item");return{_sessionId:o,_itemId:n,kind:f5.from(t.kind),name:t.name,detail:t.detail??"",uri:t.uri,range:Rs.from(t.range),selectionRange:Rs.from(t.selectionRange),tags:t.tags?.map(nde.from)}}e.from=i})(SKo||={});var IKo;(i=>{function a(e){if(e)return{value:e.value,tooltip:e.tooltip}}i.from=a})(IKo||={});var PDt;(o=>{function a(n,r,s){let l=r.fileData;return l?new Wkt(new Vkt(l.name,A.revive(l.uri),l.id,wd(()=>s(l.id)))):n===Zn.uriList&&r.uriListData?new _xe(t(r.uriListData)):new _xe(r.asString)}o.to=a;async function i(n,r,s=_t()){let l=await r.asString();if(n===Zn.uriList)return{id:s,asString:l,fileData:void 0,uriListData:e(l)};let c=r.asFile();return{id:s,asString:l,fileData:c?{name:c.name,uri:c.uri,id:c._itemId??c.id}:void 0}}o.from=i;function e(n){return Uy.split(n).map(r=>{if(r.startsWith("#"))return r;try{return A.parse(r)}catch{}return r})}function t(n){return Uy.create(n.map(r=>typeof r=="string"?r:A.revive(r)))}})(PDt||={});var sde;(t=>{function a(o,n){let r=o.items.map(([s,l])=>[s,PDt.to(s,l,n)]);return new wxe(r)}t.toDataTransfer=a;async function i(o){return{items:await Promise.all(Array.from(o,async([r,s])=>[r,await PDt.from(r,s)]))}}t.from=i;async function e(o){return{items:await Promise.all(Array.from(o,async([r,s])=>[r,await PDt.from(r,s,s.id)]))}}t.fromList=e})(sde||={});var mZi;(e=>{function a(t,o){return{kind:"reply",agentId:t.participant??o?.agentId??"",subCommand:t.command??o?.command,message:t.prompt,title:t.label}}e.from=a;function i(t){return{prompt:t.message,label:t.title,participant:t.agentId,command:t.subCommand}}e.to=i})(mZi||={});var k6e;(e=>{function a(t){switch(t){case 0:return 3;case 1:return 1;case 2:return 2}}e.to=a;function i(t){switch(t){case 3:return 0;case 1:return 1;case 2:return 2}return 1}e.from=i})(k6e||={});var yKo;(e=>{function a(t){let o=t.content.map(s=>{if(s.type==="text")return new qS(s.value,s.audience);if(s.type==="tool_result"){let l=si(s.value.map(c=>c.type==="text"?new qS(c.value,c.audience):c.type==="data"?new w_(c.data.buffer,c.mimeType):c.type==="prompt_tsx"?new lz(c.value):void 0));return new lce(s.toolCallId,l,s.isError)}else{if(s.type==="image_url")return new w_(s.value.data.buffer,s.value.mimeType);if(s.type==="data")return new w_(s.data.buffer,s.mimeType);if(s.type==="tool_use")return new cce(s.toolCallId,s.name,s.parameters)}}).filter(s=>s!==void 0),n=k6e.to(t.role);return new iEt(n,o,t.name)}e.to=a;function i(t){let o=k6e.from(t.role),n=t.name,r=t.content;typeof r=="string"&&(r=[new qS(r)]);let s=r.map(l=>{if(l instanceof lce)return{type:"tool_result",toolCallId:l.callId,value:si(l.content.map(c=>c instanceof qS?{type:"text",value:c.value,audience:c.audience}:c instanceof lz?{type:"prompt_tsx",value:c.value}:c instanceof w_?{type:"data",mimeType:c.mimeType,data:Je.wrap(c.data),audience:c.audience}:void 0)),isError:l.isError};if(l instanceof w_)return hZi(l)?{type:"image_url",value:{mimeType:l.mimeType,data:Je.wrap(l.data)}}:{type:"data",mimeType:l.mimeType,data:Je.wrap(l.data),audience:l.audience};if(l instanceof cce)return{type:"tool_use",toolCallId:l.callId,name:l.name,parameters:l.input};if(l instanceof qS)return{type:"text",value:l.value};if(typeof l!="string")throw new Error("Unexpected chat message content type");return{type:"text",value:l}});return{role:o,name:n,content:s}}e.from=i})(yKo||={});var wKo;(e=>{function a(t){let o=t.content.map(s=>{if(s.type==="text")return new qS(s.value,s.audience);if(s.type==="tool_result"){let l=s.value.map(c=>c.type==="text"?new qS(c.value,c.audience):c.type==="data"?new w_(c.data.buffer,c.mimeType):new lz(c.value));return new lce(s.toolCallId,l,s.isError)}else return s.type==="image_url"?new w_(s.value.data.buffer,s.value.mimeType):s.type==="data"?new w_(s.data.buffer,s.mimeType):s.type==="thinking"?new Dxe(s.value,s.id,s.metadata):new cce(s.toolCallId,s.name,s.parameters)}),n=k6e.to(t.role);return new oEt(n,o,t.name)}e.to=a;function i(t){let o=k6e.from(t.role),n=t.name,r=t.content;typeof r=="string"&&(r=[new qS(r)]);let s=r.map(l=>{if(l instanceof lce)return{type:"tool_result",toolCallId:l.callId,value:si(l.content.map(c=>c instanceof qS?{type:"text",value:c.value,audience:c.audience}:c instanceof lz?{type:"prompt_tsx",value:c.value}:c instanceof w_?{type:"data",mimeType:c.mimeType,data:Je.wrap(c.data),audience:c.audience}:void 0)),isError:l.isError};if(l instanceof w_)return hZi(l)?{type:"image_url",value:{mimeType:l.mimeType,data:Je.wrap(l.data)}}:{type:"data",mimeType:l.mimeType,data:Je.wrap(l.data),audience:l.audience};if(l instanceof cce)return{type:"tool_use",toolCallId:l.callId,name:l.name,parameters:l.input};if(l instanceof qS)return{type:"text",value:l.value};if(l instanceof Dxe)return{type:"thinking",value:l.value,id:l.id,metadata:l.metadata};if(typeof l!="string")throw new Error("Unexpected chat message content type llm 2");return{type:"text",value:l}});return{role:o,name:n,content:s}}e.from=i})(wKo||={});function hZi(a){switch(typeof a.mimeType=="string"?a.mimeType.toLowerCase():""){case"image/png":case"image/jpeg":case"image/jpg":case"image/gif":case"image/webp":case"image/bmp":return!0;default:return!1}}var Wpi;(e=>{function a(t){return{kind:"markdownContent",content:Ku.from(t.value)}}e.from=a;function i(t){return new Q3e(Ku.to(t.content))}e.to=i})(Wpi||={});var gZi;(e=>{function a(t){return{kind:"codeblockUri",uri:t.value,isEdit:t.isEdit,undoStopId:t.undoStopId}}e.from=a;function i(t){return new s8e(A.revive(t.uri),t.isEdit,t.undoStopId)}e.to=i})(gZi||={});var fZi;(e=>{function a(t){return{kind:"markdownVuln",content:Ku.from(t.value),vulnerabilities:t.vulnerabilities}}e.from=a;function i(t){return new Y3e(Ku.to(t.content),t.vulnerabilities)}e.to=i})(fZi||={});var vZi;(i=>{function a(e){return{kind:"confirmation",title:e.title,message:Ku.from(e.message),data:e.data,buttons:e.buttons}}i.from=a})(vZi||={});var bZi;(o=>{function a(n){switch(n){case 1:return"text";case 2:return"singleSelect";case 3:return"multiSelect";default:return"text"}}function i(n){switch(n){case"text":return 1;case"singleSelect":return 2;case"multiSelect":return 3;default:return 1}}function e(n){return{kind:"questionCarousel",questions:n.questions.map(r=>({id:r.id,type:a(r.type),title:r.title,message:r.message?Ku.from(r.message):void 0,options:r.options,defaultValue:r.defaultValue,allowFreeformInput:r.allowFreeformInput})),allowSkip:n.allowSkip}}o.from=e;function t(n){let r=n.questions.map(s=>new Xkt(s.id,i(s.type),s.title,{message:s.message?typeof s.message=="string"?new EE(s.message):Ku.to(s.message):void 0,options:s.options?.map(l=>({id:l.id,label:l.label,value:l.value})),defaultValue:s.defaultValue,allowFreeformInput:s.allowFreeformInput}));return new l8e(r,n.allowSkip)}o.to=t})(bZi||={});var Vpi;(e=>{function a(t){let{value:o,baseUri:n}=t;function r(s,l){return s.map(c=>{let u=A.joinPath(l,c.name);return{label:c.name,uri:u,children:c.children&&r(c.children,u)}})}return{kind:"treeData",treeData:{label:Ye(n),uri:n,children:r(o,n)}}}e.from=a;function i(t){let o=Xn(t.treeData);function n(l){return l.map(c=>({name:c.label,children:c.children&&n(c.children)}))}let r=o.uri,s=o.children?n(o.children):[];return new X3e(s,r)}e.to=i})(Vpi||={});var SZi;(e=>{function a(t){return{kind:"multiDiffData",multiDiffData:{title:t.title,resources:t.value.map(o=>({originalUri:o.originalUri,modifiedUri:o.modifiedUri,goToFileUri:o.goToFileUri,added:o.added,removed:o.removed}))},readOnly:t.readOnly}}e.from=a;function i(t){let o=t.multiDiffData.resources.map(n=>({originalUri:n.originalUri?A.revive(n.originalUri):void 0,modifiedUri:n.modifiedUri?A.revive(n.modifiedUri):void 0,goToFileUri:n.goToFileUri?A.revive(n.goToFileUri):void 0,added:n.added,removed:n.removed}));return new J3e(o,t.multiDiffData.title,t.readOnly)}e.to=i})(SZi||={});var Bpi;(e=>{function a(t){let o=r=>A.isUri(r),n=r=>"name"in r;return{kind:"inlineReference",name:t.title,inlineReference:o(t.value)?t.value:n(t.value)?_pi.from(t.value):g5.from(t.value)}}e.from=a;function i(t){let o=Xn(t);return new Z3e(A.isUri(o.inlineReference)?o.inlineReference:"location"in o.inlineReference?_pi.to(o.inlineReference):g5.to(o.inlineReference),t.name)}e.to=i})(Bpi||={});var IZi;(e=>{function a(t){return{kind:"progressMessage",content:Ku.from(t.value)}}e.from=a;function i(t){return new e8e(t.content.value)}e.to=i})(IZi||={});var yZi;(e=>{function a(t){return{kind:"thinking",value:t.value,id:t.id,metadata:t.metadata}}e.from=a;function i(t){return new t8e(t.value??"",t.id,t.metadata)}e.to=i})(yZi||={});var wZi;(e=>{function a(t){return{kind:"hook",hookType:t.hookType,stopReason:t.stopReason,systemMessage:t.systemMessage,metadata:t.metadata}}e.from=a;function i(t){return new i8e(t.hookType,t.stopReason,t.systemMessage,t.metadata)}e.to=i})(wZi||={});var CZi;(e=>{function a(t){return{kind:"warning",content:Ku.from(t.value)}}e.from=a;function i(t){return new o8e(t.content.value)}e.to=i})(CZi||={});var xZi;(i=>{function a(e){return{kind:"extensions",extensions:e.extensions}}i.from=a})(xZi||={});var kZi;(i=>{function a(e,t,o){let n;if(e.command)n=t.toInternal(e.command,o);else{if(!e.uri)throw new Error("Pull request part must have a command if URI is provided");n={title:"Open Pull Request",id:"vscode.open",arguments:[e.uri]}}return{kind:"pullRequest",author:e.author,title:e.title,description:e.description,uri:e.uri,linkTag:e.linkTag,command:n}}i.from=a})(kZi||={});var EZi;(e=>{function a(t){return{kind:"move",uri:t.uri,range:Rs.from(t.range)}}e.from=a;function i(t){return new a8e(A.revive(t.uri),Rs.to(t.range))}e.to=i})(EZi||={});var TZi;(l=>{function a(c){let u,p;c.toolSpecificData&&i(c.toolSpecificData)?(u=e(c.toolSpecificData,c.isError),p=void 0):p=c.toolSpecificData?t(c.toolSpecificData):void 0;let h=c.presentation==="hidden"?"hidden":c.presentation==="hiddenAfterComplete"?"hiddenAfterComplete":void 0;return c.enablePartialUpdate?{kind:"externalToolInvocationUpdate",toolCallId:c.toolCallId,toolName:c.toolName,isComplete:!!c.isComplete,invocationMessage:c.invocationMessage?Ku.from(c.invocationMessage):void 0,pastTenseMessage:c.pastTenseMessage?Ku.from(c.pastTenseMessage):void 0,toolSpecificData:p,subagentInvocationId:c.subAgentInvocationId}:{kind:"toolInvocationSerialized",toolCallId:c.toolCallId,toolId:c.toolName,invocationMessage:c.invocationMessage?Ku.from(c.invocationMessage):c.toolName,originMessage:c.originMessage?Ku.from(c.originMessage):void 0,pastTenseMessage:c.pastTenseMessage?Ku.from(c.pastTenseMessage):void 0,isConfirmed:c.isConfirmed,isComplete:!0,source:Rn.External,toolSpecificData:p,resultDetails:u,presentation:h,subAgentInvocationId:c.subAgentInvocationId}}l.from=a;function i(c){return c!==null&&typeof c=="object"&&"input"in c&&typeof c.input=="string"&&"output"in c&&Array.isArray(c.output)}function e(c,u){return{input:c.input,output:c.output.map(p=>{let h=p.mimeType.startsWith("text/");return{type:"embed",mimeType:p.mimeType,value:h?Je.wrap(p.data).toString():Qd(Je.wrap(p.data)),isText:h}}),isError:u??!1}}function t(c){return"command"in c&&"language"in c?{kind:"terminal",command:c.command,language:c.language}:"commandLine"in c&&"language"in c?{kind:"terminal",presentationOverrides:c.presentationOverrides&&typeof c.presentationOverrides.commandLine=="string"?{commandLine:c.presentationOverrides.commandLine,language:c.presentationOverrides.language}:void 0,commandLine:c.commandLine,language:c.language,terminalCommandOutput:typeof c.output?.text=="string"?{text:c.output.text}:void 0,terminalCommandState:c.state?{exitCode:c.state.exitCode,duration:c.state.duration}:void 0}:"todoList"in c&&Array.isArray(c.todoList)?{kind:"todoList",todoList:c.todoList.map(u=>({id:String(u.id),title:u.title,status:o(u.status)}))}:"input"in c&&"output"in c&&!Array.isArray(c.output)?{kind:"simpleToolInvocation",input:typeof c.input=="string"?c.input:"",output:typeof c.output=="string"?c.output:""}:c&&"values"in c&&Array.isArray(c.values)?{kind:"resources",values:c.values.map(u=>u instanceof y_?g5.from(u):A.revive(u))}:c instanceof qkt?{kind:"subagent",description:c.description,agentName:c.agentName,prompt:c.prompt,result:c.result}:c}function o(c){switch(c){case 1:return"not-started";case 2:return"in-progress";case 3:return"completed";default:return"not-started"}}function n(c){switch(c){case"not-started":return 1;case"in-progress":return 2;case"completed":return 3;default:return 1}}function r(c){let u=new d8e(c.toolId||c.toolName,c.toolCallId,c.errorMessage);return c.invocationMessage&&(u.invocationMessage=c.invocationMessage),c.originMessage&&(u.originMessage=c.originMessage),c.pastTenseMessage&&(u.pastTenseMessage=c.pastTenseMessage),c.isConfirmed!==void 0&&(u.isConfirmed=c.isConfirmed),c.isComplete!==void 0&&(u.isComplete=c.isComplete),c.toolSpecificData&&(u.toolSpecificData=s(c.toolSpecificData)),u.subAgentInvocationId=c.subAgentInvocationId,u.subAgentName=c.subAgentName,u}l.to=r;function s(c){if(c.kind==="terminal")if(c.commandLine){let u={commandLine:c.commandLine,language:c.language};return c.terminalCommandOutput&&(u.output={text:c.terminalCommandOutput.text,truncated:c.terminalCommandOutput.truncated,lineCount:c.terminalCommandOutput.lineCount}),c.terminalCommandState&&(u.state={exitCode:c.terminalCommandState.exitCode,duration:c.terminalCommandState.duration}),u}else return{command:c.command,language:c.language};else{if(c.kind==="terminal2")return{commandLine:c.commandLine,language:c.language};if(c.kind==="todoList")return{todoList:c.todoList.map((u,p)=>{let h=Number(u.id);return{id:Number.isFinite(h)?h:p,title:u.title,status:n(u.status)}})}}return c}})(TZi||={});var CKo;(i=>{function a(e){return{kind:"progressTask",content:Ku.from(e.value)}}i.from=a})(CKo||={});var xKo;(i=>{function a(e){return{kind:"progressTaskResult",content:typeof e=="string"?Ku.from(e):void 0}}i.from=a})(xKo||={});var Hpi;(e=>{function a(t,o,n){return{kind:"command",command:o.toInternal(t.value,n)??{command:t.value.command,title:t.value.title}}}e.from=a;function i(t,o){return new n8e(o.fromInternal(t.command)??{command:t.command.id,title:t.command.title})}e.to=i})(Hpi||={});var _Zi;(e=>{function a(t){return{kind:"textEdit",uri:t.uri,edits:t.edits.map(o=>Nz.from(o)),done:t.isDone}}e.from=a;function i(t){let o=new c8e(A.revive(t.uri),t.edits.map(n=>Nz.to(n)));return o.isDone=t.done,o}e.to=i})(_Zi||={});var DZi;(i=>{function a(e){return e.newCellMetadata?{editType:3,index:e.range.start,metadata:e.newCellMetadata}:e.newNotebookMetadata?{editType:5,metadata:e.newNotebookMetadata}:{editType:1,index:e.range.start,count:e.range.end-e.range.start,cells:e.newCells.map(C6e.from)}}i.from=a})(DZi||={});var LZi;(i=>{function a(e){return{kind:"notebookEdit",uri:e.uri,edits:e.edits.map(DZi.from),done:e.isDone}}i.from=a})(LZi||={});var RZi;(i=>{function a(e){return{kind:"workspaceEdit",edits:e.edits.map(t=>({oldResource:t.oldResource,newResource:t.newResource}))}}i.from=a})(RZi||={});var Upi;(e=>{function a(t){let o=q.isThemeIcon(t.iconPath)?t.iconPath:A.isUri(t.iconPath)?{light:A.revive(t.iconPath)}:t.iconPath&&"light"in t.iconPath&&"dark"in t.iconPath&&A.isUri(t.iconPath.light)&&A.isUri(t.iconPath.dark)?{light:A.revive(t.iconPath.light),dark:A.revive(t.iconPath.dark)}:void 0;return typeof t.value=="object"&&"variableName"in t.value?{kind:"reference",reference:{variableName:t.value.variableName,value:A.isUri(t.value.value)||!t.value.value?t.value.value:g5.from(t.value.value)},iconPath:o,options:t.options}:{kind:"reference",reference:A.isUri(t.value)||typeof t.value=="string"?t.value:g5.from(t.value),iconPath:o,options:t.options}}e.from=a;function i(t){let o=Xn(t),n=r=>A.isUri(r)?r:g5.to(r);return new r8e(typeof o.reference=="string"?o.reference:"variableName"in o.reference?{variableName:o.reference.variableName,value:o.reference.value&&n(o.reference.value)}:n(o.reference))}e.to=i})(Upi||={});var MZi;(i=>{function a(e){return{kind:"codeCitation",value:e.value,license:e.license,snippet:e.snippet}}i.from=a})(MZi||={});var kKo;(t=>{function a(o,n,r){return o instanceof Q3e?Wpi.from(o):o instanceof Z3e?Bpi.from(o):o instanceof r8e?Upi.from(o):o instanceof e8e?IZi.from(o):o instanceof t8e?yZi.from(o):o instanceof i8e?wZi.from(o):o instanceof X3e?Vpi.from(o):o instanceof J3e?SZi.from(o):o instanceof n8e?Hpi.from(o,n,r):o instanceof c8e?_Zi.from(o):o instanceof Jkt?LZi.from(o):o instanceof Y3e?fZi.from(o):o instanceof s8e?gZi.from(o):o instanceof o8e?CZi.from(o):o instanceof $kt?vZi.from(o):o instanceof l8e?bZi.from(o):o instanceof jkt?MZi.from(o):o instanceof a8e?EZi.from(o):o instanceof Qkt?xZi.from(o):o instanceof Ykt?kZi.from(o,n,r):o instanceof d8e?TZi.from(o):o instanceof Zkt?RZi.from(o):{kind:"markdownContent",content:Ku.from("")}}t.from=a;function i(o,n){switch(o.kind){case"reference":return Upi.to(o);case"markdownContent":case"inlineReference":case"progressMessage":case"treeData":case"command":return e(o,n)}}t.to=i;function e(o,n){switch(o.kind){case"markdownContent":return Wpi.to(o);case"inlineReference":return Bpi.to(o);case"progressMessage":return;case"treeData":return Vpi.to(o);case"command":return Hpi.to(o,n)}}t.toContent=e})(kKo||={});var EKo;(i=>{function a(e,t,o,n,r,s,l){let c=[],u=[];for(let g of e.variables.variables)g.kind==="tool"?c.push(g):g.kind==="toolset"?c.push(...g.value):u.push(g);let p=cs.parseLocalSessionId(e.sessionResource)??e.sessionResource.toString(),h={id:e.requestId,prompt:e.message,command:e.command,attempt:e.attempt??0,enableCommandDetection:e.enableCommandDetection??!0,isParticipantDetected:e.isParticipantDetected??!1,sessionId:p,sessionResource:e.sessionResource,references:u.map(g=>AZi.to(g,n,l)).filter(mo),toolReferences:c.map(NDt.to),location:PZi.to(e.location),acceptedConfirmationData:e.acceptedConfirmationData,rejectedConfirmationData:e.rejectedConfirmationData,location2:t,toolInvocationToken:Object.freeze({sessionResource:e.sessionResource}),tools:r,model:o,editedFileEvents:e.editedFileEvents,modeInstructions:e.modeInstructions?.content,modeInstructions2:NZi.to(e.modeInstructions),permissionLevel:e.permissionLevel,subAgentInvocationId:e.subAgentInvocationId,subAgentName:e.subAgentName,parentRequestId:e.parentRequestId,hasHooksEnabled:e.hasHooksEnabled??!1,hooks:e.hooks?BZi.to(e.hooks):void 0};return Ea(s,"chatParticipantPrivate")||(delete h.id,delete h.attempt,delete h.enableCommandDetection,delete h.isParticipantDetected,delete h.location,delete h.location2,delete h.editedFileEvents,delete h.sessionId,delete h.subAgentInvocationId,delete h.subAgentName,delete h.parentRequestId,delete h.hasHooksEnabled,delete h.hooks),Ea(s,"chatParticipantAdditions")||(delete h.acceptedConfirmationData,delete h.rejectedConfirmationData,delete h.tools),h}i.to=a})(EKo||={});var PZi;(e=>{function a(t){switch(t){case"notebook":return 3;case"terminal":return 2;case"panel":return 1;case"editor":return 4}}e.to=a;function i(t){switch(t){case 3:return"notebook";case 2:return"terminal";case 1:return"panel";case 4:return"editor"}}e.from=i})(PZi||={});var AZi;(i=>{function a(e,t,o){let n=e.value;if(!n){let s;try{s=JSON.stringify(e)}catch{s=`kind=${e.kind}, id=${e.id}, name=${e.name}`}o.error(`[ChatPromptReference] Ignoring invalid reference in variable: ${s}`);return}if(oh(n))n=A.revive(n);else if(n&&typeof n=="object"&&"uri"in n&&"range"in n&&oh(n.uri))n=g5.to(Xn(n));else if(pV(e)){let s=e.references?.[0]?.reference;n=new eEt(e.mimeType??"image/png",()=>Promise.resolve(new Uint8Array(Object.values(e.value))),s&&A.isUri(s)?s:void 0)}else if(e.kind==="diagnostic"){let s=e.filterSeverity&&ADt.to(e.filterSeverity),l=e.filterUri&&A.revive(e.filterUri).toString();n=new tEt(t.map(([c,u])=>e.filterUri&&c.toString()!==l?[c,[]]:[c,u.filter(p=>!(s&&p.severity>s||e.filterRange&&!z.areIntersectingOrTouching(e.filterRange,Rs.from(p.range))))]).filter(([,c])=>c.length>0))}let r;return(pP(e)||PY(e))&&e.toolReferences&&(r=qpi.to(e.toolReferences)),{id:e.id,name:e.name,range:e.range&&[e.range.start,e.range.endExclusive],toolReferences:r,value:n,modelDescription:e.modelDescription}}i.to=a})(AZi||={});var NDt;(i=>{function a(e){if(e.value)throw new Error("Invalid tool reference");return{name:e.id,range:e.range&&[e.range.start,e.range.endExclusive]}}i.to=a})(NDt||={});var qpi;(i=>{function a(e){let t=[];for(let o of e)if(o.kind==="tool")t.push(NDt.to(o));else if(o.kind==="toolset")t.push(...o.value.map(NDt.to));else throw new Error("Invalid tool reference in prompt variables");return t}i.to=a})(qpi||={});var NZi;(i=>{function a(e){if(e)return{uri:A.revive(e.uri),name:e.name,content:e.content,toolReferences:qpi.to(e.toolReferences),metadata:e.metadata,isBuiltin:e.isBuiltin}}i.to=a})(NZi||={});var TKo;(i=>{function a(e,t,o){return{id:e.id,label:e.label,fullName:e.fullName,icon:e.icon?.id,value:e.values[0].value,insertText:e.insertText,detail:e.detail,documentation:e.documentation,command:t.toInternal(e.command,o)}}i.from=a})(TKo||={});var OZi;(t=>{function a(o){return{errorDetails:o.errorDetails,metadata:e(o.metadata),nextQuestion:o.nextQuestion,details:o.details}}t.to=a;function i(o){return{errorDetails:o.errorDetails,metadata:o.metadata,nextQuestion:o.nextQuestion,details:o.details}}t.from=i;function e(o){return Gk(o,n=>{if(n.$mid===20)return new u8e(Gk(n.content,e));if(n.$mid===21)return new qS(n.value);if(n.$mid===22)return new Dxe(n.value,n.id,n.metadata);if(n.$mid===23)return new lz(n.value)})}})(OZi||={});var _Ko;(i=>{function a(e,t,o){if(t.action.kind==="vote")return;let n=OZi.to(e);if(t.action.kind==="command"){let r=t.action.commandButton.command;return{action:{kind:"command",commandButton:{command:o.fromInternal(r)??{command:r.id,title:r.title}}},result:n}}else return t.action.kind==="followUp"?{action:{kind:"followUp",followup:mZi.to(t.action.followup)},result:n}:t.action.kind==="inlineChat"?{action:{kind:"editor",accepted:t.action.action==="accepted"},result:n}:t.action.kind==="chatEditingSessionAction"?{action:{kind:"chatEditingSessionAction",outcome:new Map([["accepted",1],["rejected",2],["saved",3]]).get(t.action.outcome)??2,uri:A.revive(t.action.uri),hasRemainingEdits:t.action.hasRemainingEdits},result:n}:t.action.kind==="chatEditingHunkAction"?{action:{kind:"chatEditingHunkAction",outcome:new Map([["accepted",1],["rejected",2]]).get(t.action.outcome)??2,uri:A.revive(t.action.uri),hasRemainingEdits:t.action.hasRemainingEdits,lineCount:t.action.lineCount,linesAdded:t.action.linesAdded,linesRemoved:t.action.linesRemoved},result:n}:{action:t.action,result:n}}i.to=a})(_Ko||={});var DKo;(i=>{function a(e,t,o){return"terminalCommand"in e?{terminalCommand:e.terminalCommand,shouldExecute:e.shouldExecute}:"uri"in e?{uri:e.uri}:t.toInternal(e,o)}i.from=a})(DKo||={});var zpi;(i=>{function a(e){return{...e,documentation:Ku.fromStrict(e.documentation)}}i.from=a})(zpi||={});var LKo;(i=>{function a(e,t){return Array.isArray(e)?{items:e.map(o=>zpi.from(o))}:{items:e.items.map(o=>zpi.from(o)),resourceOptions:e.resourceOptions?FZi.from(e.resourceOptions,t):void 0}}i.from=a})(LKo||={});var FZi;(i=>{function a(e,t){return{...e,pathSeparator:t,cwd:e.cwd,globPattern:Az.from(e.globPattern)??void 0}}i.from=a})(FZi||={});var RKo;(i=>{function a(e){return{kind:WZi.to(e.kind),acceptedLength:e.acceptedLength}}i.to=a})(RKo||={});var WZi;(i=>{function a(e){switch(e){case 0:return 1;case 1:return 2;case 2:return 3;default:return 0}}i.to=a})(WZi||={});var MKo;(i=>{function a(e,t){if(e.kind===2){let o=e.supersededBy?t(e.supersededBy):void 0;return{kind:2,supersededBy:o,userTypingDisagreed:e.userTypingDisagreed}}else if(e.kind===0)return{kind:0};return{kind:1}}i.to=a})(MKo||={});var PKo;(e=>{function a(t){return t===2?2:1}e.from=a;function i(t){return t===2?2:1}e.to=i})(PKo||={});var AKo;(i=>{function a(e,t){return{id:t,label:e.label,description:e.description,canEdit:e.canEdit,collapsibleState:e.collapsibleState||0,contextValue:e.contextValue}}i.from=a})(AKo||={});var NKo;(i=>{function a(e){return e.type==="mcp"?new sEt(e.label,e.serverLabel||e.label,e.instructions):e.type==="extension"?new rEt(e.extensionId.value,e.label):void 0}i.to=a})(NKo||={});var OKo;(e=>{function a(t){let o=new u8e(t.content.map(n=>n.kind==="text"?new qS(n.value,n.audience):n.kind==="data"?new w_(n.value.data.buffer,n.value.mimeType,n.audience):new lz(n.value)));return t.toolMetadata!==void 0&&(o.toolMetadata=t.toolMetadata),t.toolResultError&&(o.hasError=!!t.toolResultError),o}e.to=a;function i(t,o){t.toolResultMessage&&P3e(o,"chatParticipantPrivate");let n=c=>{c.audience&&P3e(o,"languageModelToolResultAudience")},r=!1,s;Array.isArray(t.toolResultDetails)?s=t.toolResultDetails?.map(c=>A.isUri(c)?c:g5.from(c)):t.toolResultDetails2&&(s={output:{type:"data",mimeType:t.toolResultDetails2.mime,value:Je.wrap(t.toolResultDetails2.value)}},r=!0);let l={content:t.content.map(c=>{if(c instanceof qS)return n(c),{kind:"text",value:c.value,audience:c.audience};if(c instanceof lz)return{kind:"promptTsx",value:c.value};if(c instanceof w_)return n(c),r=!0,{kind:"data",value:{mimeType:c.mimeType,data:Je.wrap(c.data)},audience:c.audience};throw new Error("Unknown LanguageModelToolResult part type")}),toolResultMessage:Ku.fromStrict(t.toolResultMessage),toolResultDetails:s,toolMetadata:t.toolMetadata,toolResultError:t.hasError};return r?new qh(l):l}e.from=i})(OKo||={});var VZi;(t=>{function a(o){return o}t.fromThemeIcon=a;function i(o){if(o){if(q.isThemeIcon(o))return o;if(A.isUri(o))return o;if(typeof o=="string")return A.file(o);if(typeof o=="object"&&o!==null&&"dark"in o){let n=typeof o.dark=="string"?A.file(o.dark):o.dark,r=typeof o.light=="string"?A.file(o.light):o.light;return n?{dark:n,light:r??n}:void 0}else return}else return}t.from=i;function e(o){if(o){if(q.isThemeIcon(o))return o;if(oh(o))return A.revive(o);{let n=o;return{light:A.revive(n.light),dark:A.revive(n.dark)}}}else return}t.to=e})(VZi||={});var FKo;(e=>{function a(t){return{query:t.query,kind:i(t.kind),settings:t.settings}}e.fromSettingsSearchResult=a;function i(t){switch(t){case 1:return 1;case 2:return 2;case 3:return 3;default:throw new Error("Unknown AiSettingsSearchResultKind")}}})(FKo||={});var WKo;(t=>{function a(o){return!!o.uri}function i(o){return _P.toSerialized(a(o)?{type:2,uri:o.uri,headers:Object.entries(o.headers),authentication:o.authentication?{providerId:o.authentication.providerId,scopes:o.authentication.scopes}:void 0}:{type:1,cwd:o.cwd?.fsPath,args:o.args,command:o.command,env:o.env,envFile:void 0,sandbox:void 0})}t.from=i;function e(o){let n=_P.fromSerialized(o.launch);if(n.type===2)return new lEt(o.label,n.uri,Object.fromEntries(n.headers),o.cacheNonce==="$$NONE"?void 0:o.cacheNonce);{let r=new aEt(o.label,n.command,[...n.args],Object.fromEntries(Object.entries(n.env).map(([s,l])=>[s,l===null?null:String(l)])),o.cacheNonce==="$$NONE"?void 0:o.cacheNonce);return n.cwd&&(r.cwd=A.file(n.cwd)),r}}t.to=e})(WKo||={});var VKo;(i=>{function a(e){switch(e){case 0:return 0;case 1:return 1;case 2:return 2;default:throw new Error("Unknown SourceControlInputBoxValidationType")}}i.from=a})(VKo||={});var BZi;(i=>{function a(e){let t={};for(let[o,n]of Object.entries(e)){if(!n||n.length===0)continue;let r=[];for(let s of n){let l=HZi.to(s);l&&r.push(l)}r.length>0&&(t[o]=r)}return t}i.to=a})(BZi||={});var HZi;(i=>{function a(e){let t=dpi(e,zo);if(t)return{command:t,cwd:e.cwd,env:e.env,timeout:e.timeout}}i.to=a})(HZi||={});var BKo;(e=>{function a(t){if(t!==void 0)switch(t){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3;default:return}}function i(t){let o=t.timing,n=o?.created??o?.startTime??0,r=o?.lastRequestStarted??o?.startTime,s=o?.lastRequestEnded??o?.endTime;return{resource:t.resource,label:t.label,description:t.description?Ku.from(t.description):void 0,badge:t.badge?Ku.from(t.badge):void 0,status:a(t.status),archived:t.archived,tooltip:Ku.fromStrict(t.tooltip),timing:{created:n,lastRequestStarted:r,lastRequestEnded:s},changes:t.changes instanceof Array?t.changes:void 0,metadata:t.metadata}}e.from=i})(BKo||={});var ade=class{constructor(){this.requestIdPool=0;this.dataTransferFiles=new Map}add(i){let e=this.requestIdPool++;return this.dataTransferFiles.set(e,si(Array.from(i,([,t])=>t.asFile()))),{id:e,dispose:()=>{this.dataTransferFiles.delete(e)}}}async resolveFileData(i,e){let t=this.dataTransferFiles.get(i);if(!t)throw new Error("No data transfer found");let o=t.find(n=>n.id===e);if(!o)throw new Error("No matching file found in data transfer");return Je.wrap(await o.data())}dispose(){this.dataTransferFiles.clear()}};function zZi(a){return typeof a=="string"?!1:Array.isArray(a)?a.every(zZi):!!a.exclusive}var FDt=class{constructor(i,e,t,o,n){this.uri=i;this.languageId=e;this.notebookUri=t;this.notebookType=o;this.recursive=n}equals(i){return this.notebookType===i.notebookType&&this.languageId===i.languageId&&this.uri.toString()===i.uri.toString()&&this.notebookUri?.toString()===i.notebookUri?.toString()&&this.recursive===i.recursive}},cd=class a{constructor(i){this._notebookInfoResolver=i;this._clock=0;this._entries=[];this._onDidChange=new E}get onDidChange(){return this._onDidChange.event}register(i,e){let t={selector:i,provider:e,_score:-1,_time:this._clock++};return this._entries.push(t),this._lastCandidate=void 0,this._onDidChange.fire(this._entries.length),Z(()=>{if(t){let o=this._entries.indexOf(t);o>=0&&(this._entries.splice(o,1),this._lastCandidate=void 0,this._onDidChange.fire(this._entries.length),t=void 0)}})}has(i){return this.all(i).length>0}all(i){if(!i)return[];this._updateScores(i,!1);let e=[];for(let t of this._entries)t._score>0&&e.push(t.provider);return e}allNoModel(){return this._entries.map(i=>i.provider)}get registeredLanguageIds(){let i=new Set;for(let e of this._entries)Hli(e.selector,i);return i}ordered(i,e=!1){let t=[];return this._orderedForEach(i,e,o=>t.push(o.provider)),t}orderedGroups(i){let e=[],t,o;return this._orderedForEach(i,!1,n=>{t&&o===n._score?t.push(n.provider):(o=n._score,t=[n.provider],e.push(t))}),e}_orderedForEach(i,e,t){this._updateScores(i,e);for(let o of this._entries)o._score>0&&t(o)}_updateScores(i,e){let t=this._notebookInfoResolver?.(i.uri),o=t?new FDt(i.uri,i.getLanguageId(),t.uri,t.type,e):new FDt(i.uri,i.getLanguageId(),void 0,void 0,e);if(!this._lastCandidate?.equals(o)){this._lastCandidate=o;for(let n of this._entries)if(n._score=jW(n.selector,o.uri,o.languageId,hx(i),o.notebookUri,o.notebookType),zZi(n.selector)&&n._score>0)if(e)n._score=0;else{for(let r of this._entries)r._score=0;n._score=1e3;break}this._entries.sort(a._compareByScoreAndTime)}}static _compareByScoreAndTime(i,e){return i._score<e._score?1:i._score>e._score?-1:_6e(i.selector)&&!_6e(e.selector)?1:!_6e(i.selector)&&_6e(e.selector)?-1:i._time<e._time?1:i._time>e._time?-1:0}};function _6e(a){return typeof a=="string"?!1:Array.isArray(a)?a.some(_6e):!!a.isBuiltin}var cde=new cd,lde=class a{constructor(i,e,t,o){this.id=i;this.provider=e;this.roots=t;this.ref=o;this.root=t[0]}static async create(i,e,t){let[o]=cde.ordered(i);if(!o)return;let n=await o.prepareCallHierarchy(i,e,t);if(n)return new a(n.roots.reduce((r,s)=>r+s._sessionId,""),o,n.roots,new qH(n))}dispose(){this.ref.release()}fork(i){let e=this;return new class extends a{constructor(){super(e.id,e.provider,[i],e.ref.acquire())}}}async resolveIncomingCalls(i,e){try{let t=await this.provider.provideIncomingCalls(i,e);if(dr(t))return t}catch(t){ss(t)}return[]}async resolveOutgoingCalls(i,e){try{let t=await this.provider.provideOutgoingCalls(i,e);if(dr(t))return t}catch(t){ss(t)}return[]}},D6e=new Map;qe.registerCommand("_executePrepareCallHierarchy",async(a,...i)=>{let[e,t]=i;So(A.isUri(e)),So(Ie.isIPosition(t));let n=a.get(Ct).getModel(e),r;if(!n){let l=await a.get(Nt).createModelReference(e);n=l.object.textEditorModel,r=l}try{let s=await lde.create(n,t,ve.None);return s?(D6e.set(s.id,s),D6e.forEach((l,c,u)=>{u.size>10&&(l.dispose(),D6e.delete(c))}),[s.root]):[]}finally{r?.dispose()}});function KZi(a){return!0}qe.registerCommand("_executeProvideIncomingCalls",async(a,...i)=>{let[e]=i;So(KZi(e));let t=D6e.get(e._sessionId);return t?t.resolveIncomingCalls(e,ve.None):[]});qe.registerCommand("_executeProvideOutgoingCalls",async(a,...i)=>{let[e]=i;So(KZi(e));let t=D6e.get(e._sessionId);return t?t.resolveOutgoingCalls(e,ve.None):[]});var WDt;(t=>{let a=[];function i(o){let n=o;return n&&a.push(n),{dispose(){if(n){let r=a.indexOf(n);r>=0&&(a.splice(r,1),n=void 0)}}}}t.register=i;function e(){return a.slice(0)}t.all=e})(WDt||={});var jpi=class{constructor(i,e){this.symbol=i;this.provider=e}};async function VDt(a,i=ve.None){let e=[],t=WDt.all().map(async n=>{try{let r=await n.provideWorkspaceSymbols(a,i);if(!r)return;for(let s of r)e.push(new jpi(s,n))}catch(r){ss(r)}});if(await Promise.all(t),i.isCancellationRequested)return[];function o(n,r){let s=Al(n.symbol.name,r.symbol.name);return s===0&&(s=n.symbol.kind-r.symbol.kind),s===0&&(s=Al(n.symbol.location.uri.toString(),r.symbol.location.uri.toString())),s===0&&(n.symbol.location.range&&r.symbol.location.range?z.areIntersecting(n.symbol.location.range,r.symbol.location.range)||(s=z.compareRangesUsingStarts(n.symbol.location.range,r.symbol.location.range)):n.provider.resolveWorkspaceSymbol&&!r.provider.resolveWorkspaceSymbol?s=-1:!n.provider.resolveWorkspaceSymbol&&r.provider.resolveWorkspaceSymbol&&(s=1)),s===0&&(s=Al(n.symbol.containerName??"",r.symbol.containerName??"")),s}return Pg(e,o).map(n=>n[0]).flat()}function SX(a){let i=a.get(ee),e=a.get(Pe),t=a.get(be);return i.editors.map(n=>no.getOriginalUri(n,{supportSideBySide:1})).filter(n=>!!n&&!e.isInsideWorkspace(n)&&t.hasProvider(n))}var GZi=/\s?[#:\(](?:line )?(\d*)(?:[#:,](\d*))?\)?:?\s*$/;function $Zi(a,i){if(!a||i?.some(o=>{let n=a.indexOf(o);return n===0||n>0&&!GZi.test(a.substring(n+1))}))return;let e,t=GZi.exec(a);if(t){let o=parseInt(t[1]??"",10);if(Xo(o)){e={startLineNumber:o,startColumn:1,endLineNumber:o,endColumn:1};let n=parseInt(t[2]??"",10);Xo(n)&&(e={startLineNumber:e.startLineNumber,startColumn:n,endLineNumber:e.endLineNumber,endColumn:n})}else t[1]===""&&(e={startLineNumber:1,startColumn:1,endLineNumber:1,endColumn:1})}if(t&&e)return{filter:a.substr(0,t.index),range:e}}var pEe=new Q("searchState",0);var ude=new cd,dde=class a{constructor(i,e,t,o){this.id=i;this.provider=e;this.roots=t;this.ref=o;this.root=t[0]}static async create(i,e,t){let[o]=ude.ordered(i);if(!o)return;let n=await o.prepareTypeHierarchy(i,e,t);if(n)return new a(n.roots.reduce((r,s)=>r+s._sessionId,""),o,n.roots,new qH(n))}dispose(){this.ref.release()}fork(i){let e=this;return new class extends a{constructor(){super(e.id,e.provider,[i],e.ref.acquire())}}}async provideSupertypes(i,e){try{let t=await this.provider.provideSupertypes(i,e);if(dr(t))return t}catch(t){ss(t)}return[]}async provideSubtypes(i,e){try{let t=await this.provider.provideSubtypes(i,e);if(dr(t))return t}catch(t){ss(t)}return[]}},L6e=new Map;qe.registerCommand("_executePrepareTypeHierarchy",async(a,...i)=>{let[e,t]=i;So(A.isUri(e)),So(Ie.isIPosition(t));let n=a.get(Ct).getModel(e),r;if(!n){let l=await a.get(Nt).createModelReference(e);n=l.object.textEditorModel,r=l}try{let s=await dde.create(n,t,ve.None);if(!s)return[];L6e.forEach((l,c,u)=>{u.size>10&&(l.dispose(),L6e.delete(c))});for(let l of s.roots)L6e.set(l._sessionId,s);return s.roots}finally{r?.dispose()}});function qZi(a){let i=a;return typeof a=="object"&&typeof i.name=="string"&&typeof i.kind=="number"&&A.isUri(i.uri)&&z.isIRange(i.range)&&z.isIRange(i.selectionRange)}qe.registerCommand("_executeProvideSupertypes",async(a,...i)=>{let[e]=i;So(qZi(e));let t=L6e.get(e._sessionId);return t?t.provideSupertypes(e,ve.None):[]});qe.registerCommand("_executeProvideSubtypes",async(a,...i)=>{let[e]=i;So(qZi(e));let t=L6e.get(e._sessionId);return t?t.provideSubtypes(e,ve.None):[]});var rS=ae("aiEditTelemetryService");var jZi="VSCode.ABExp.FeatureData",QZi=3600*1e3;var YZi=(h=>(h.Market="X-MSEdge-Market",h.CorpNet="X-FD-Corpnet",h.ApplicationVersion="X-VSCode-AppVersion",h.Build="X-VSCode-Build",h.ClientId="X-MSEdge-ClientId",h.DeveloperDeviceId="X-VSCode-DevDeviceId",h.ExtensionName="X-VSCode-ExtensionName",h.ExtensionVersion="X-VSCode-ExtensionVersion",h.Language="X-VSCode-Language",h.TargetPopulation="X-VSCode-TargetPopulation",h.Platform="X-VSCode-Platform",h.ReleaseDate="X-VSCode-ReleaseDate",h))(YZi||{}),BDt=class a{constructor(i,e,t,o,n,r){this.version=i;this.appName=e;this.machineId=t;this.devDeviceId=o;this.targetPopulation=n;this.releaseDate=r}static trimVersionSuffix(i){let e=/\-[a-zA-Z0-9]+$/;return i.split(e)[0]}getFilterValue(i){switch(i){case"X-VSCode-AppVersion":return a.trimVersionSuffix(this.version);case"X-VSCode-Build":return this.appName;case"X-MSEdge-ClientId":return this.machineId;case"X-VSCode-DevDeviceId":return this.devDeviceId;case"X-VSCode-Language":return Dr;case"X-VSCode-ExtensionName":return"vscode-core";case"X-VSCode-ExtensionVersion":return"999999.0";case"X-VSCode-TargetPopulation":return this.targetPopulation;case"X-VSCode-Platform":return LT(Pp);case"X-VSCode-ReleaseDate":return a.formatReleaseDate(this.releaseDate);default:return""}}static formatReleaseDate(i){if(!i)return"";let e=/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2})/.exec(i);return e?e.slice(1,5).join(""):""}getFilters(){let i=new Map,e=Object.values(YZi);for(let t of e)i.set(t,this.getFilterValue(t));return i}};function HDt(a){let i=a?.includes("Visual-Studio-Code"),e=a?.includes("github"),t=a?.includes("microsoft")||a?.includes("ms-copilot")||a?.includes("MicrosoftCopilot");return i?"vscode":e?"github":t?"microsoft":void 0}var XZi=(l=>(l.CopilotExtensionVersion="X-Copilot-RelatedPluginVersion-githubcopilot",l.CopilotChatExtensionVersion="X-Copilot-RelatedPluginVersion-githubcopilotchat",l.CompletionsVersionInCopilotChat="X-VSCode-CompletionsInChatExtensionVersion",l.CopilotSku="X-GitHub-Copilot-SKU",l.MicrosoftInternalOrg="X-Microsoft-Internal-Org",l.CopilotTrackingId="X-Copilot-Tracking-Id",l.CopilotIsSn="X-GitHub-Copilot-IsSn",l.CopilotIsFcv1="X-GitHub-Copilot-IsFcv1",l))(XZi||{});var Oz=class extends C{constructor(e,t,o,n,r){super();this._extensionService=e;this._logService=t;this._storageService=o;this._chatEntitlementService=n;this._defaultAccountService=r;this._onDidChangeFilters=this._register(new E);this.onDidChangeFilters=this._onDidChangeFilters.event;this.copilotExtensionVersion=this._storageService.get("extensionsAssignmentFilterProvider.copilotExtensionVersion",0),this.copilotChatExtensionVersion=this._storageService.get("extensionsAssignmentFilterProvider.copilotChatExtensionVersion",0),this.copilotCompletionsVersion=this._storageService.get("extensionsAssignmentFilterProvider.copilotCompletionsVersion",0),this.copilotSku=this._storageService.get("extensionsAssignmentFilterProvider.copilotSku",0),this.copilotInternalOrg=this._storageService.get("extensionsAssignmentFilterProvider.copilotInternalOrg",0),this.copilotTrackingId=this._storageService.get("extensionsAssignmentFilterProvider.copilotTrackingId",0),this.copilotIsSn=this._storageService.get("extensionsAssignmentFilterProvider.copilotIsSn",0),this.copilotIsFcv1=this._storageService.get("extensionsAssignmentFilterProvider.copilotIsFcv1",0),this._register(this._extensionService.onDidChangeExtensionsStatus(s=>{s.some(l=>Ei.equals(l,"github.copilot")||Ei.equals(l,"github.copilot-chat"))&&this.updateExtensionVersions()})),this._register(this._chatEntitlementService.onDidChangeEntitlement(()=>{this.updateCopilotEntitlementInfo()})),this._register(this._defaultAccountService.onDidChangeCopilotTokenInfo(()=>{this.updateCopilotTokenInfo()})),this.updateExtensionVersions(),this.updateCopilotEntitlementInfo(),this.updateCopilotTokenInfo()}async updateExtensionVersions(){let e,t,o;try{let[n,r]=await Promise.all([this._extensionService.getExtension("github.copilot"),this._extensionService.getExtension("github.copilot-chat")]);e=n?.version,t=r?.version,o=r?.completionsCoreVersion}catch(n){this._logService.error("Failed to update extension version assignments",n)}this.copilotCompletionsVersion===o&&this.copilotExtensionVersion===e&&this.copilotChatExtensionVersion===t||(this.copilotExtensionVersion=e,this.copilotChatExtensionVersion=t,this.copilotCompletionsVersion=o,this._storageService.store("extensionsAssignmentFilterProvider.copilotExtensionVersion",this.copilotExtensionVersion,0,1),this._storageService.store("extensionsAssignmentFilterProvider.copilotChatExtensionVersion",this.copilotChatExtensionVersion,0,1),this._storageService.store("extensionsAssignmentFilterProvider.copilotCompletionsVersion",this.copilotCompletionsVersion,0,1),this._onDidChangeFilters.fire())}updateCopilotEntitlementInfo(){let e=this._chatEntitlementService.sku,t=this._chatEntitlementService.copilotTrackingId,o=HDt(this._chatEntitlementService.organisations);this.copilotSku===e&&this.copilotInternalOrg===o&&this.copilotTrackingId===t||(this.copilotSku=e,this.copilotInternalOrg=o,this.copilotTrackingId=t,this._storageService.store("extensionsAssignmentFilterProvider.copilotSku",this.copilotSku,0,1),this._storageService.store("extensionsAssignmentFilterProvider.copilotInternalOrg",this.copilotInternalOrg,0,1),this._storageService.store("extensionsAssignmentFilterProvider.copilotTrackingId",this.copilotTrackingId,0,1),this._onDidChangeFilters.fire())}updateCopilotTokenInfo(){let e=this._defaultAccountService.copilotTokenInfo,t=e?.sn==="1"?"1":"0",o=e?.fcv1==="1"?"1":"0";this.copilotIsSn===t&&this.copilotIsFcv1===o||(this.copilotIsSn=t,this.copilotIsFcv1=o,this._storageService.store("extensionsAssignmentFilterProvider.copilotIsSn",this.copilotIsSn,0,1),this._storageService.store("extensionsAssignmentFilterProvider.copilotIsFcv1",this.copilotIsFcv1,0,1),this._onDidChangeFilters.fire())}static trimVersionSuffix(e){let t=/\-[a-zA-Z0-9]+$/;return e.split(t)[0]}getFilterValue(e){switch(e){case"X-Copilot-RelatedPluginVersion-githubcopilot":return this.copilotExtensionVersion?Oz.trimVersionSuffix(this.copilotExtensionVersion):null;case"X-VSCode-CompletionsInChatExtensionVersion":return this.copilotCompletionsVersion?Oz.trimVersionSuffix(this.copilotCompletionsVersion):null;case"X-Copilot-RelatedPluginVersion-githubcopilotchat":return this.copilotChatExtensionVersion?Oz.trimVersionSuffix(this.copilotChatExtensionVersion):null;case"X-GitHub-Copilot-SKU":return this.copilotSku??null;case"X-Microsoft-Internal-Org":return this.copilotInternalOrg??null;case"X-Copilot-Tracking-Id":return this.copilotTrackingId??null;case"X-GitHub-Copilot-IsSn":return this.copilotIsSn??null;case"X-GitHub-Copilot-IsFcv1":return this.copilotIsFcv1??null;default:return null}}getFilters(){let e=new Map,t=Object.values(XZi);for(let o of t)e.set(o,this.getFilterValue(o));return e}};Oz=I([m(0,lt),m(1,ne),m(2,le),m(3,vr),m(4,Um)],Oz);function UDt(a,i,e){return xO(a)===3&&!!i.tasConfig&&!e.disableExperiments&&!e.extensionTestsLocationURI&&!e.enableSmokeTestDriver&&a.getValue("workbench.enableExperiments")===!0}var kC=ae("assignmentService"),Qpi=class{constructor(i){this.memento=i;this.mementoObj=i.getMemento(-1,1)}async getValue(i,e){return await this.mementoObj[i]||e}setValue(i,e){this.mementoObj[i]=e,this.memento.saveMemento()}},Ypi=class extends C{constructor(e,t){super();this.telemetryService=e;this.productService=t;this._onDidUpdateAssignmentContext=this._register(new E);this.onDidUpdateAssignmentContext=this._onDidUpdateAssignmentContext.event;this._assignmentFilters=[];this._assignmentFilterDisposables=this._register(new P)}get assignmentContext(){return this._lastAssignmentContext?.split(";")}_filterAssignmentContext(e){return e.split(";").filter(n=>{for(let r of this._assignmentFilters)if(r.exclude(n))return!1;return!0}).join(";")}_setAssignmentContext(e){let t=this._filterAssignmentContext(e);this._lastAssignmentContext=t,this._onDidUpdateAssignmentContext.fire(),this.productService.tasConfig?.assignmentContextTelemetryPropertyName&&this.telemetryService.setExperimentProperty(this.productService.tasConfig.assignmentContextTelemetryPropertyName,t)}addAssignmentFilter(e){this._assignmentFilters.push(e),this._assignmentFilterDisposables.add(e.onDidChange(()=>{this._previousAssignmentContext&&this._setAssignmentContext(this._previousAssignmentContext)})),this._previousAssignmentContext&&this._setAssignmentContext(this._previousAssignmentContext)}setSharedProperty(e,t){if(e===this.productService.tasConfig?.assignmentContextTelemetryPropertyName)return this._previousAssignmentContext=t,this._setAssignmentContext(t);this.telemetryService.setExperimentProperty(e,t)}postEvent(e,t){let o={};for(let[n,r]of t.entries())o[n]=r;this.telemetryService.publicLog(e,o)}},R6e=class extends C{constructor(e,t,o,n,r,s){super();this.telemetryService=e;this.configurationService=o;this.productService=n;this.instantiationService=s;this.tasSetupDisposables=new P;this.networkInitialized=!1;this._onDidRefetchAssignments=this._register(new E);this.onDidRefetchAssignments=this._onDidRefetchAssignments.event;this.experimentsEnabled=UDt(o,n,r),this.experimentsEnabled&&(this.tasClient=this.setupTASClient()),this.telemetry=this._register(new Ypi(e,n)),this._register(this.telemetry.onDidUpdateAssignmentContext(()=>this._onDidRefetchAssignments.fire())),this._register(this.configurationService.onDidChangeConfiguration(u=>{u.affectsConfiguration("experiments.override")&&this._onDidRefetchAssignments.fire()})),this.keyValueStorage=new Qpi(new Bl("experiment.service.memento",t));let l=o.getValue("experiments.overrideDelay"),c=typeof l=="number"?l:0;this.overrideInitDelay=Pi(c)}async getTreatment(e){let t=await this.doGetTreatment(e);return this.telemetryService.publicLog2("tasClientReadTreatmentComplete",{treatmentName:e,treatmentValue:JSON.stringify(t)}),t}async doGetTreatment(e){await this.overrideInitDelay;let t=this.configurationService.getValue(`experiments.override.${e}`);if(t!==void 0)return t;if(!this.tasClient||!this.experimentsEnabled)return;let o,n=await this.tasClient;return this.networkInitialized?o=n.getTreatmentVariable("vscode",e):o=await n.getTreatmentVariableAsync("vscode",e,!0),o=n.getTreatmentVariable("vscode",e),o}async setupTASClient(){this.tasSetupDisposables.clear();let e=this.productService.quality==="stable"?"public":this.productService.quality==="exploration"?"exploration":"insider",t=new BDt(this.productService.version,this.productService.nameLong,this.telemetryService.machineId,this.telemetryService.devDeviceId,e,this.productService.date??""),o=this.instantiationService.createInstance(Oz);this.tasSetupDisposables.add(o),this.tasSetupDisposables.add(o.onDidChangeFilters(()=>this.refetchAssignments()));let n=this.productService.tasConfig,r=new(await bg("tas-client","dist/tas-client.min.js")).ExperimentationService({filterProviders:[t,o],telemetry:this.telemetry,storageKey:jZi,keyValueStorage:this.keyValueStorage,assignmentContextTelemetryPropertyName:n.assignmentContextTelemetryPropertyName,telemetryEventName:n.telemetryEventName,endpoint:n.endpoint,refetchInterval:QZi});return await r.initializePromise,r.initialFetch.then(()=>{this.networkInitialized=!0}),r}async refetchAssignments(){if(!this.tasClient)return;let e=await this.tasClient;await e.initialFetch,await e.getTreatmentVariableAsync("vscode","refresh",!1)}async getCurrentExperiments(){if(this.tasClient&&this.experimentsEnabled)return await this.tasClient,this.telemetry.assignmentContext}addTelemetryAssignmentFilter(e){this.telemetry.addAssignmentFilter(e)}};R6e=I([m(0,Te),m(1,le),m(2,B),m(3,nt),m(4,Vt),m(5,F)],R6e);we(kC,R6e,1);var KKo=oe.as(ii.Configuration);KKo.registerConfiguration({...Cm,properties:{"workbench.enableExperiments":{type:"boolean",description:d(16627,null),default:!0,scope:1,restricted:!0,tags:["usesOnlineServices"]}}});var Xpi=ae("inlineCompletionsUnificationService"),GKo="cmp-cht-",JZi="cmp-ext-",$Ko="inlineCompletionsUnificationCode",qKo="inlineCompletionsUnificationModel",jKo=new Q("isRunningUnificationExperiment",!1),zDt="chat.extensionUnification.enabled",M6e=class extends C{constructor(e,t,o,n,r,s,l){super();this._assignmentService=e;this._contextKeyService=t;this._configurationService=o;this._extensionEnablementService=n;this._extensionManagementService=r;this._extensionService=s;this._state=new KDt(!1,!1,!1,[]);this._onDidStateChange=this._register(new E);this.onDidStateChange=this._onDidStateChange.event;this._onDidChangeExtensionUnificationState=this._register(new E);this._onDidChangeExtensionUnificationSetting=this._register(new E);this._completionsExtensionId=l.defaultChatAgent?.extensionId.toLowerCase(),this._chatExtensionId=l.defaultChatAgent?.chatExtensionId.toLowerCase();let c=[this._completionsExtensionId,this._chatExtensionId].filter(u=>!!u);this.isRunningUnificationExperiment=jKo.bindTo(this._contextKeyService),this._assignmentService.addTelemetryAssignmentFilter({exclude:u=>u.startsWith(JZi)&&this._state.extensionUnification!==this._configurationService.getValue(zDt),onDidChange:H.any(this._onDidChangeExtensionUnificationState.event,this._onDidChangeExtensionUnificationSetting.event)}),this._register(this._extensionEnablementService.onEnablementChanged(u=>{u.some(p=>c.includes(p.identifier.id.toLowerCase()))&&this._update()})),this._register(this._configurationService.onDidChangeConfiguration(u=>{u.affectsConfiguration(zDt)&&(this._update(),this._onDidChangeExtensionUnificationSetting.fire())})),this._register(this._extensionService.onDidChangeExtensions(({added:u})=>{u.some(p=>c.includes(p.identifier.value.toLowerCase()))&&this._update()})),this._register(this._assignmentService.onDidRefetchAssignments(()=>this._update())),this._update()}get state(){return this._state}async _update(){let[e,t,o]=await Promise.all([this._assignmentService.getTreatment($Ko),this._assignmentService.getTreatment(qKo),this._isExtensionUnificationActive()]),n=this._configurationService.getValue(zDt)===o,r=await this._assignmentService.getCurrentExperiments(),s=new KDt(e===!0,t===!0,o,r?.filter(c=>c.startsWith(GKo)||n&&c.startsWith(JZi))??[]);if(this._state.equals(s))return;let l=this._state;this._state=s,this.isRunningUnificationExperiment.set(this._state.codeUnification||this._state.modelUnification||this._state.extensionUnification),this._onDidStateChange.fire(),l.extensionUnification!==this._state.extensionUnification&&this._onDidChangeExtensionUnificationState.fire()}async _isExtensionUnificationActive(){if(!this._configurationService.getValue(zDt)||!this._completionsExtensionId||!this._chatExtensionId)return!1;let[e,t,o]=await Promise.all([this._extensionService.getExtension(this._completionsExtensionId),this._extensionService.getExtension(this._chatExtensionId),this._extensionManagementService.getInstalled(1)]);if(!t||e)return!1;let n=o.filter(s=>s.identifier.id.toLowerCase()===this._completionsExtensionId);if(n.length===0)return!0;let r=n.some(s=>this._extensionEnablementService.getEnablementState(s)===9);return!!t&&r}};M6e=I([m(0,kC),m(1,X),m(2,B),m(3,Os),m(4,ls),m(5,lt),m(6,nt)],M6e);var KDt=class{constructor(i,e,t,o){this.codeUnification=i;this.modelUnification=e;this.extensionUnification=t;this.expAssignments=o}equals(i){return this.codeUnification===i.codeUnification&&this.modelUnification===i.modelUnification&&this.extensionUnification===i.extensionUnification&&$i(this.expAssignments,i.expAssignments)}};we(Xpi,M6e,1);var Ed=class extends C{constructor(e,t,o,n,r,s,l){super();this._languageService=t;this._languageConfigurationService=o;this._languageFeaturesService=n;this._uriIdentService=r;this._instantiationService=s;this._inlineCompletionsUnificationService=l;this._registrations=this._register(new jt);this._pasteEditProviders=new Map;this._documentOnDropEditProviders=new Map;if(this._proxy=e.getProxy(Zi.ExtHostLanguageFeatures),this._languageService){let c=()=>{let u=[];for(let p of t.getRegisteredLanguageIds()){let h=this._languageConfigurationService.getLanguageConfiguration(p).getWordDefinition();u.push({languageId:p,regexSource:h.source,regexFlags:h.flags})}this._proxy.$setWordDefinitions(u)};this._register(this._languageConfigurationService.onDidChange(u=>{if(!u.languageId)c();else{let p=this._languageConfigurationService.getLanguageConfiguration(u.languageId).getWordDefinition();this._proxy.$setWordDefinitions([{languageId:u.languageId,regexSource:p.source,regexFlags:p.flags}])}})),c()}this._inlineCompletionsUnificationService&&(this._register(this._inlineCompletionsUnificationService.onDidStateChange(()=>{this._proxy.$acceptInlineCompletionsUnificationState(this._inlineCompletionsUnificationService.state)})),this._proxy.$acceptInlineCompletionsUnificationState(this._inlineCompletionsUnificationService.state))}$unregister(e){this._registrations.deleteAndDispose(e)}static _reviveLocationDto(e){return e&&(Array.isArray(e)?(e.forEach(t=>Ed._reviveLocationDto(t)),e):(e.uri=A.revive(e.uri),e))}static _reviveLocationLinkDto(e){return e&&(Array.isArray(e)?(e.forEach(t=>Ed._reviveLocationLinkDto(t)),e):(e.uri=A.revive(e.uri),e))}static _reviveWorkspaceSymbolDto(e){return e&&(Array.isArray(e)?(e.forEach(Ed._reviveWorkspaceSymbolDto),e):(e.location=Ed._reviveLocationDto(e.location),e))}static _reviveCodeActionDto(e,t){return e?.forEach(o=>iV(o.edit,t)),e}static _reviveLinkDTO(e){return e.url&&typeof e.url!="string"&&(e.url=A.revive(e.url)),e}static _reviveCallHierarchyItemDto(e){return e&&(e.uri=A.revive(e.uri)),e}static _reviveTypeHierarchyItemDto(e){return e&&(e.uri=A.revive(e.uri)),e}$registerDocumentSymbolProvider(e,t,o){this._registrations.set(e,this._languageFeaturesService.documentSymbolProvider.register(t,{displayName:o,provideDocumentSymbols:(n,r)=>this._proxy.$provideDocumentSymbols(e,n.uri,r)}))}$registerCodeLensSupport(e,t,o){let n={provideCodeLenses:async(r,s)=>{let l=await this._proxy.$provideCodeLenses(e,r.uri,s);if(l)return{lenses:l.lenses,dispose:()=>l.cacheId&&this._proxy.$releaseCodeLenses(e,l.cacheId)}},resolveCodeLens:async(r,s,l)=>{let c=await this._proxy.$resolveCodeLens(e,s,l);if(!(!c||l.isCancellationRequested))return{...c,range:r.validateRange(c.range)}}};if(typeof o=="number"){let r=new E;this._registrations.set(o,r),n.onDidChange=r.event}this._registrations.set(e,this._languageFeaturesService.codeLensProvider.register(t,n))}$emitCodeLensEvent(e,t){let o=this._registrations.get(e);o instanceof E&&o.fire(t)}$registerDefinitionSupport(e,t){this._registrations.set(e,this._languageFeaturesService.definitionProvider.register(t,{provideDefinition:(o,n,r)=>this._proxy.$provideDefinition(e,o.uri,n,r).then(Ed._reviveLocationLinkDto)}))}$registerDeclarationSupport(e,t){this._registrations.set(e,this._languageFeaturesService.declarationProvider.register(t,{provideDeclaration:(o,n,r)=>this._proxy.$provideDeclaration(e,o.uri,n,r).then(Ed._reviveLocationLinkDto)}))}$registerImplementationSupport(e,t){this._registrations.set(e,this._languageFeaturesService.implementationProvider.register(t,{provideImplementation:(o,n,r)=>this._proxy.$provideImplementation(e,o.uri,n,r).then(Ed._reviveLocationLinkDto)}))}$registerTypeDefinitionSupport(e,t){this._registrations.set(e,this._languageFeaturesService.typeDefinitionProvider.register(t,{provideTypeDefinition:(o,n,r)=>this._proxy.$provideTypeDefinition(e,o.uri,n,r).then(Ed._reviveLocationLinkDto)}))}$registerHoverProvider(e,t){this._registrations.set(e,this._languageFeaturesService.hoverProvider.register(t,{provideHover:async(o,n,r,s)=>{let l={verbosityRequest:s?.verbosityRequest?{verbosityDelta:s.verbosityRequest.verbosityDelta,previousHover:{id:s.verbosityRequest.previousHover.id}}:void 0};return await this._proxy.$provideHover(e,o.uri,n,l,r)}}))}$registerEvaluatableExpressionProvider(e,t){this._registrations.set(e,this._languageFeaturesService.evaluatableExpressionProvider.register(t,{provideEvaluatableExpression:(o,n,r)=>this._proxy.$provideEvaluatableExpression(e,o.uri,n,r)}))}$registerInlineValuesProvider(e,t,o){let n={provideInlineValues:(r,s,l,c)=>this._proxy.$provideInlineValues(e,r.uri,s,l,c)};if(typeof o=="number"){let r=new E;this._registrations.set(o,r),n.onDidChangeInlineValues=r.event}this._registrations.set(e,this._languageFeaturesService.inlineValuesProvider.register(t,n))}$emitInlineValuesEvent(e,t){let o=this._registrations.get(e);o instanceof E&&o.fire(t)}$registerDocumentHighlightProvider(e,t){this._registrations.set(e,this._languageFeaturesService.documentHighlightProvider.register(t,{provideDocumentHighlights:(o,n,r)=>this._proxy.$provideDocumentHighlights(e,o.uri,n,r)}))}$registerMultiDocumentHighlightProvider(e,t){this._registrations.set(e,this._languageFeaturesService.multiDocumentHighlightProvider.register(t,{selector:t,provideMultiDocumentHighlights:(o,n,r,s)=>this._proxy.$provideMultiDocumentHighlights(e,o.uri,n,r.map(l=>l.uri),s).then(l=>{if(l==null)return;let c=new vt;return l?.forEach(u=>{let p=A.revive(u.uri);c.has(p)?c.get(p).push(...u.highlights):c.set(p,u.highlights)}),c})}))}$registerLinkedEditingRangeProvider(e,t){this._registrations.set(e,this._languageFeaturesService.linkedEditingRangeProvider.register(t,{provideLinkedEditingRanges:async(o,n,r)=>{let s=await this._proxy.$provideLinkedEditingRanges(e,o.uri,n,r);if(s)return{ranges:s.ranges,wordPattern:s.wordPattern?Ed._reviveRegExp(s.wordPattern):void 0}}}))}$registerReferenceSupport(e,t){this._registrations.set(e,this._languageFeaturesService.referenceProvider.register(t,{provideReferences:(o,n,r,s)=>this._proxy.$provideReferences(e,o.uri,n,r,s).then(Ed._reviveLocationDto)}))}$registerCodeActionSupport(e,t,o,n,r,s){let l={provideCodeActions:async(c,u,p,h)=>{let g=await this._proxy.$provideCodeActions(e,c.uri,u,p,h);if(g)return{actions:Ed._reviveCodeActionDto(g.actions,this._uriIdentService),dispose:()=>{typeof g.cacheId=="number"&&this._proxy.$releaseCodeActions(e,g.cacheId)}}},providedCodeActionKinds:o.providedKinds,documentation:o.documentation,displayName:n,extensionId:r};s&&(l.resolveCodeAction=async(c,u)=>{let p=await this._proxy.$resolveCodeAction(e,c.cacheId,u);return p.edit&&(c.edit=iV(p.edit,this._uriIdentService)),p.command&&(c.command=p.command),c}),this._registrations.set(e,this._languageFeaturesService.codeActionProvider.register(t,l))}$registerPasteEditProvider(e,t,o){let n=new P6e(e,this._proxy,o,this._uriIdentService);this._pasteEditProviders.set(e,n),this._registrations.set(e,hn(this._languageFeaturesService.documentPasteEditProvider.register(t,n),Z(()=>this._pasteEditProviders.delete(e))))}$resolvePasteFileData(e,t,o){let n=this._pasteEditProviders.get(e);if(!n)throw new Error("Could not find provider");return n.resolveFileData(t,o)}$registerDocumentFormattingSupport(e,t,o,n){this._registrations.set(e,this._languageFeaturesService.documentFormattingEditProvider.register(t,{extensionId:o,displayName:n,provideDocumentFormattingEdits:(r,s,l)=>this._proxy.$provideDocumentFormattingEdits(e,r.uri,s,l)}))}$registerRangeFormattingSupport(e,t,o,n,r){this._registrations.set(e,this._languageFeaturesService.documentRangeFormattingEditProvider.register(t,{extensionId:o,displayName:n,provideDocumentRangeFormattingEdits:(s,l,c,u)=>this._proxy.$provideDocumentRangeFormattingEdits(e,s.uri,l,c,u),provideDocumentRangesFormattingEdits:r?(s,l,c,u)=>this._proxy.$provideDocumentRangesFormattingEdits(e,s.uri,l,c,u):void 0}))}$registerOnTypeFormattingSupport(e,t,o,n){this._registrations.set(e,this._languageFeaturesService.onTypeFormattingEditProvider.register(t,{extensionId:n,autoFormatTriggerCharacters:o,provideOnTypeFormattingEdits:(r,s,l,c,u)=>this._proxy.$provideOnTypeFormattingEdits(e,r.uri,s,l,c,u)}))}$registerNavigateTypeSupport(e,t){let o,n={provideWorkspaceSymbols:async(r,s)=>{let l=await this._proxy.$provideWorkspaceSymbols(e,r,s);return o!==void 0&&this._proxy.$releaseWorkspaceSymbols(e,o),o=l.cacheId,Ed._reviveWorkspaceSymbolDto(l.symbols)}};t&&(n.resolveWorkspaceSymbol=async(r,s)=>{let l=await this._proxy.$resolveWorkspaceSymbol(e,r,s);return l&&Ed._reviveWorkspaceSymbolDto(l)}),this._registrations.set(e,WDt.register(n))}$registerRenameSupport(e,t,o){this._registrations.set(e,this._languageFeaturesService.renameProvider.register(t,{provideRenameEdits:(n,r,s,l)=>this._proxy.$provideRenameEdits(e,n.uri,r,s,l).then(c=>iV(c,this._uriIdentService)),resolveRenameLocation:o?(n,r,s)=>this._proxy.$resolveRenameLocation(e,n.uri,r,s):void 0}))}$registerNewSymbolNamesProvider(e,t){this._registrations.set(e,this._languageFeaturesService.newSymbolNamesProvider.register(t,{supportsAutomaticNewSymbolNamesTriggerKind:this._proxy.$supportsAutomaticNewSymbolNamesTriggerKind(e),provideNewSymbolNames:(o,n,r,s)=>this._proxy.$provideNewSymbolNames(e,o.uri,n,r,s)}))}$registerDocumentSemanticTokensProvider(e,t,o,n){let r;if(typeof n=="number"){let s=new E;this._registrations.set(n,s),r=s.event}this._registrations.set(e,this._languageFeaturesService.documentSemanticTokensProvider.register(t,new Jpi(this._proxy,e,o,r)))}$emitDocumentSemanticTokensEvent(e){let t=this._registrations.get(e);t instanceof E&&t.fire(void 0)}$emitDocumentRangeSemanticTokensEvent(e){let t=this._registrations.get(e);t instanceof E&&t.fire(void 0)}$registerDocumentRangeSemanticTokensProvider(e,t,o,n){let r;if(typeof n=="number"){let s=new E;this._registrations.set(n,s),r=s.event}this._registrations.set(e,this._languageFeaturesService.documentRangeSemanticTokensProvider.register(t,new Zpi(this._proxy,e,o,r)))}static _inflateSuggestDto(e,t,o){let n=t.a,r=t.o,s=t.n,l=t.k,c;return r&&(c={$ident:s,id:r,title:"",arguments:s?[s]:t.p}),{label:n,extensionId:o,kind:t.b??9,tags:t.m,detail:t.c,documentation:t.d,sortText:t.e,filterText:t.f,preselect:t.g,insertText:t.h??(typeof n=="string"?n:n.label),range:t.j??e,insertTextRules:t.i,commitCharacters:l?Array.from(l):void 0,additionalTextEdits:t.l,command:c,_id:t.x}}$registerCompletionsProvider(e,t,o,n,r){let s={triggerCharacters:o,_debugDisplayName:`${r.value}(${o.join("")})`,provideCompletionItems:async(l,c,u,p)=>{let h=await this._proxy.$provideCompletionItems(e,l.uri,c,u,p);return h&&{suggestions:h.b.map(g=>Ed._inflateSuggestDto(h.a,g,r)),incomplete:h.c||!1,duration:h.d,dispose:()=>{typeof h.x=="number"&&this._proxy.$releaseCompletionItems(e,h.x)}}}};n&&(s.resolveCompletionItem=(l,c)=>this._proxy.$resolveCompletionItem(e,l._id,c).then(u=>{if(!u)return l;let p=Ed._inflateSuggestDto(l.range,u,r);return Nu(l,p,!0)})),this._registrations.set(e,this._languageFeaturesService.completionProvider.register(t,s))}$registerInlineCompletionsSupport(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){let w=new CU(n,r,s),k=this._instantiationService.createInstance(IX,e,s??n,w,l,p,u,c,f,o,g,h,v,S,b,y,t,this._proxy);this._registrations.set(e,k)}$emitInlineCompletionsChange(e,t){let o=this._registrations.get(e);o instanceof IX&&o._emitDidChange(t)}$emitInlineCompletionModelInfoChange(e,t){let o=this._registrations.get(e);o instanceof IX&&o._setModelInfo(t)}$emitInlineCompletionProviderOptionsChange(e,t){let o=this._registrations.get(e);o instanceof IX&&o._setProviderOptions(t)}$registerSignatureHelpProvider(e,t,o){this._registrations.set(e,this._languageFeaturesService.signatureHelpProvider.register(t,{signatureHelpTriggerCharacters:o.triggerCharacters,signatureHelpRetriggerCharacters:o.retriggerCharacters,provideSignatureHelp:async(n,r,s,l)=>{let c=await this._proxy.$provideSignatureHelp(e,n.uri,r,l,s);if(c)return{value:c,dispose:()=>{this._proxy.$releaseSignatureHelp(e,c.id)}}}}))}$registerInlayHintsProvider(e,t,o,n,r){let s={displayName:r,provideInlayHints:async(l,c,u)=>{let p=await this._proxy.$provideInlayHints(e,l.uri,c,u);if(p)return{hints:Xn(p.hints),dispose:()=>{p.cacheId&&this._proxy.$releaseInlayHints(e,p.cacheId)}}}};if(o&&(s.resolveInlayHint=async(l,c)=>{let u=l;if(!u.cacheId)return l;let p=await this._proxy.$resolveInlayHint(e,u.cacheId,c);if(c.isCancellationRequested)throw new ho;return p?{...l,tooltip:p.tooltip,label:Xn(p.label),textEdits:p.textEdits}:l}),typeof n=="number"){let l=new E;this._registrations.set(n,l),s.onDidChangeInlayHints=l.event}this._registrations.set(e,this._languageFeaturesService.inlayHintsProvider.register(t,s))}$emitInlayHintsEvent(e){let t=this._registrations.get(e);t instanceof E&&t.fire(void 0)}$registerDocumentLinkProvider(e,t,o){let n={provideLinks:(r,s)=>this._proxy.$provideDocumentLinks(e,r.uri,s).then(l=>{if(l)return{links:l.links.map(Ed._reviveLinkDTO),dispose:()=>{typeof l.cacheId=="number"&&this._proxy.$releaseDocumentLinks(e,l.cacheId)}}})};o&&(n.resolveLink=(r,s)=>{let l=r;return l.cacheId?this._proxy.$resolveDocumentLink(e,l.cacheId,s).then(c=>c&&Ed._reviveLinkDTO(c)):r}),this._registrations.set(e,this._languageFeaturesService.linkProvider.register(t,n))}$registerDocumentColorProvider(e,t){let o=this._proxy;this._registrations.set(e,this._languageFeaturesService.colorProvider.register(t,{provideDocumentColors:(n,r)=>o.$provideDocumentColors(e,n.uri,r).then(s=>s.map(l=>{let[c,u,p,h]=l.color;return{color:{red:c,green:u,blue:p,alpha:h},range:l.range}})),provideColorPresentations:(n,r,s)=>o.$provideColorPresentations(e,n.uri,{color:[r.color.red,r.color.green,r.color.blue,r.color.alpha],range:r.range},s)}))}$registerFoldingRangeProvider(e,t,o,n){let r={id:o.value,provideFoldingRanges:(s,l,c)=>this._proxy.$provideFoldingRanges(e,s.uri,l,c)};if(typeof n=="number"){let s=new E;this._registrations.set(n,s),r.onDidChange=s.event}this._registrations.set(e,this._languageFeaturesService.foldingRangeProvider.register(t,r))}$emitFoldingRangeEvent(e,t){let o=this._registrations.get(e);o instanceof E&&o.fire(t)}$registerSelectionRangeProvider(e,t){this._registrations.set(e,this._languageFeaturesService.selectionRangeProvider.register(t,{provideSelectionRanges:(o,n,r)=>this._proxy.$provideSelectionRanges(e,o.uri,n,r)}))}$registerCallHierarchyProvider(e,t){this._registrations.set(e,cde.register(t,{prepareCallHierarchy:async(o,n,r)=>{let s=await this._proxy.$prepareCallHierarchy(e,o.uri,n,r);if(!(!s||s.length===0))return{dispose:()=>{for(let l of s)this._proxy.$releaseCallHierarchy(e,l._sessionId)},roots:s.map(Ed._reviveCallHierarchyItemDto)}},provideOutgoingCalls:async(o,n)=>{let r=await this._proxy.$provideCallHierarchyOutgoingCalls(e,o._sessionId,o._itemId,n);return r&&(r.forEach(s=>{s.to=Ed._reviveCallHierarchyItemDto(s.to)}),r)},provideIncomingCalls:async(o,n)=>{let r=await this._proxy.$provideCallHierarchyIncomingCalls(e,o._sessionId,o._itemId,n);return r&&(r.forEach(s=>{s.from=Ed._reviveCallHierarchyItemDto(s.from)}),r)}}))}static _reviveRegExp(e){return new RegExp(e.pattern,e.flags)}static _reviveIndentationRule(e){return{decreaseIndentPattern:Ed._reviveRegExp(e.decreaseIndentPattern),increaseIndentPattern:Ed._reviveRegExp(e.increaseIndentPattern),indentNextLinePattern:e.indentNextLinePattern?Ed._reviveRegExp(e.indentNextLinePattern):void 0,unIndentedLinePattern:e.unIndentedLinePattern?Ed._reviveRegExp(e.unIndentedLinePattern):void 0}}static _reviveOnEnterRule(e){return{beforeText:Ed._reviveRegExp(e.beforeText),afterText:e.afterText?Ed._reviveRegExp(e.afterText):void 0,previousLineText:e.previousLineText?Ed._reviveRegExp(e.previousLineText):void 0,action:e.action}}static _reviveOnEnterRules(e){return e.map(Ed._reviveOnEnterRule)}$setLanguageConfiguration(e,t,o){let n={comments:o.comments,brackets:o.brackets,wordPattern:o.wordPattern?Ed._reviveRegExp(o.wordPattern):void 0,indentationRules:o.indentationRules?Ed._reviveIndentationRule(o.indentationRules):void 0,onEnterRules:o.onEnterRules?Ed._reviveOnEnterRules(o.onEnterRules):void 0,autoClosingPairs:void 0,surroundingPairs:void 0,__electricCharacterSupport:void 0};o.autoClosingPairs?n.autoClosingPairs=o.autoClosingPairs:o.__characterPairSupport&&(n.autoClosingPairs=o.__characterPairSupport.autoClosingPairs),o.__electricCharacterSupport&&o.__electricCharacterSupport.docComment&&(n.__electricCharacterSupport={docComment:{open:o.__electricCharacterSupport.docComment.open,close:o.__electricCharacterSupport.docComment.close}}),this._languageService.isRegisteredLanguageId(t)&&this._registrations.set(e,this._languageConfigurationService.register(t,n,100))}$registerTypeHierarchyProvider(e,t){this._registrations.set(e,ude.register(t,{prepareTypeHierarchy:async(o,n,r)=>{let s=await this._proxy.$prepareTypeHierarchy(e,o.uri,n,r);if(s)return{dispose:()=>{for(let l of s)this._proxy.$releaseTypeHierarchy(e,l._sessionId)},roots:s.map(Ed._reviveTypeHierarchyItemDto)}},provideSupertypes:async(o,n)=>{let r=await this._proxy.$provideTypeHierarchySupertypes(e,o._sessionId,o._itemId,n);return r&&r.map(Ed._reviveTypeHierarchyItemDto)},provideSubtypes:async(o,n)=>{let r=await this._proxy.$provideTypeHierarchySubtypes(e,o._sessionId,o._itemId,n);return r&&r.map(Ed._reviveTypeHierarchyItemDto)}}))}$registerDocumentOnDropEditProvider(e,t,o){let n=new A6e(e,this._proxy,o,this._uriIdentService);this._documentOnDropEditProviders.set(e,n),this._registrations.set(e,hn(this._languageFeaturesService.documentDropEditProvider.register(t,n),Z(()=>this._documentOnDropEditProviders.delete(e))))}async $resolveDocumentOnDropFileData(e,t,o){let n=this._documentOnDropEditProviders.get(e);if(!n)throw new Error("Could not find provider");return n.resolveDocumentOnDropFileData(t,o)}};Ed=I([vo(Gi.MainThreadLanguageFeatures),m(1,kt),m(2,bs),m(3,zt),m(4,dt),m(5,F),m(6,Xpi)],Ed);var P6e=class{constructor(i,e,t,o){this._handle=i;this._proxy=e;this._uriIdentService=o;this.dataTransfers=new ade;this.copyMimeTypes=t.copyMimeTypes??[],this.pasteMimeTypes=t.pasteMimeTypes??[],this.providedPasteEditKinds=t.providedPasteEditKinds?.map(n=>new Is(n))??[],t.supportsCopy&&(this.prepareDocumentPaste=async(n,r,s,l)=>{let c=await sde.fromList(s);if(l.isCancellationRequested)return;let u=await this._proxy.$prepareDocumentPaste(i,n.uri,r,c,l);if(!u)return;let p=new bx;for(let[h,g]of u.items)p.replace(h,NN(g.asString,g.id));return p}),t.supportsPaste&&(this.provideDocumentPasteEdits=async(n,r,s,l,c)=>{let u=this.dataTransfers.add(s);try{let p=await sde.fromList(s);if(c.isCancellationRequested)return;let h=await this._proxy.$providePasteEdits(this._handle,u.id,n.uri,r,p,{only:l.only?.value,triggerKind:l.triggerKind},c);return h?{edits:h.map(g=>({...g,kind:g.kind?new Is(g.kind.value):new Is(""),yieldTo:g.yieldTo?.map(f=>({kind:new Is(f)})),additionalEdit:g.additionalEdit?iV(g.additionalEdit,this._uriIdentService,f=>this.resolveFileData(u.id,f)):void 0})),dispose:()=>{this._proxy.$releasePasteEdits(this._handle,u.id)}}:void 0}finally{u.dispose()}}),t.supportsResolve&&(this.resolveDocumentPasteEdit=async(n,r)=>{let s=await this._proxy.$resolvePasteEdit(this._handle,n._cacheId,r);return typeof s.insertText<"u"&&(n.insertText=s.insertText),s.additionalEdit&&(n.additionalEdit=iV(s.additionalEdit,this._uriIdentService)),n})}resolveFileData(i,e){return this.dataTransfers.resolveFileData(i,e)}};P6e=I([m(3,dt)],P6e);var A6e=class{constructor(i,e,t,o){this._handle=i;this._proxy=e;this._uriIdentService=o;this.dataTransfers=new ade;this.dropMimeTypes=t?.dropMimeTypes??["*/*"],this.providedDropEditKinds=t?.providedDropKinds?.map(n=>new Is(n)),t?.supportsResolve&&(this.resolveDocumentDropEdit=async(n,r)=>{let s=await this._proxy.$resolvePasteEdit(this._handle,n._cacheId,r);return s.additionalEdit&&(n.additionalEdit=iV(s.additionalEdit,this._uriIdentService)),n})}async provideDocumentDropEdits(i,e,t,o){let n=this.dataTransfers.add(t);try{let r=await sde.fromList(t);if(o.isCancellationRequested)return;let s=await this._proxy.$provideDocumentOnDropEdits(this._handle,n.id,i.uri,e,r,o);return s?{edits:s.map(l=>({...l,yieldTo:l.yieldTo?.map(c=>({kind:new Is(c)})),kind:l.kind?new Is(l.kind):void 0,additionalEdit:iV(l.additionalEdit,this._uriIdentService,c=>this.resolveDocumentOnDropFileData(n.id,c))})),dispose:()=>{this._proxy.$releaseDocumentOnDropEdits(this._handle,n.id)}}:void 0}finally{n.dispose()}}resolveDocumentOnDropFileData(i,e){return this.dataTransfers.resolveFileData(i,e)}};A6e=I([m(3,dt)],A6e);var Jpi=class{constructor(i,e,t,o){this._proxy=i;this._handle=e;this._legend=t;this.onDidChange=o}releaseDocumentSemanticTokens(i){i&&this._proxy.$releaseDocumentSemanticTokens(this._handle,parseInt(i,10))}getLegend(){return this._legend}async provideDocumentSemanticTokens(i,e,t){let o=e?parseInt(e,10):0,n=await this._proxy.$provideDocumentSemanticTokens(this._handle,i.uri,o,t);if(!n||t.isCancellationRequested)return null;let r=Sli(n);return r.type==="full"?{resultId:String(r.id),data:r.data}:{resultId:String(r.id),edits:r.deltas}}},Zpi=class{constructor(i,e,t,o){this._proxy=i;this._handle=e;this._legend=t;this.onDidChange=o}getLegend(){return this._legend}async provideDocumentRangeSemanticTokens(i,e,t){let o=await this._proxy.$provideDocumentRangeSemanticTokens(this._handle,i.uri,e,t);if(!o||t.isCancellationRequested)return null;let n=Sli(o);if(n.type==="full")return{resultId:String(n.id),data:n.data};throw new Error("Unexpected")}},IX=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T){super();this.handle=e;this.groupId=t;this.providerId=o;this.yieldsToGroupIds=n;this.excludesGroupIds=r;this.debounceDelayMs=s;this.displayName=l;this.modelInfo=c;this._supportsHandleEvents=u;this._supportsSetModelId=p;this._supportsOnDidChange=h;this._supportsOnDidChangeModelInfo=g;this.providerOptions=f;this._supportsSetProviderOption=v;this._supportsOnDidChangeProviderOptions=b;this._selector=S;this._proxy=y;this._languageFeaturesService=w;this._aiEditTelemetryService=k;this._instantiationService=T;this._onDidChangeEmitter=this._register(new E);this._onDidChangeModelInfoEmitter=this._register(new E);this._onDidProviderOptionsChangeEmitter=this._register(new E);this.setModelId=this._supportsSetModelId?async N=>{await this._proxy.$handleInlineCompletionSetCurrentModelId(this.handle,N)}:void 0,this.setProviderOption=this._supportsSetProviderOption?async(N,O)=>{await this._proxy.$handleInlineCompletionSetProviderOption(this.handle,N,O)}:void 0,this.onDidChangeInlineCompletions=this._supportsOnDidChange?this._onDidChangeEmitter.event:void 0,this.onDidChangeModelInfo=this._supportsOnDidChangeModelInfo?this._onDidChangeModelInfoEmitter.event:void 0,this.onDidProviderOptionsChange=this._supportsOnDidChangeProviderOptions?this._onDidProviderOptionsChangeEmitter.event:void 0,this._register(this._languageFeaturesService.inlineCompletionsProvider.register(this._selector,this))}_setModelInfo(e){this.modelInfo=e,this._supportsOnDidChangeModelInfo&&this._onDidChangeModelInfoEmitter.fire()}_setProviderOptions(e){this.providerOptions=e,this._supportsOnDidChangeProviderOptions&&this._onDidProviderOptionsChangeEmitter.fire()}_emitDidChange(e){this._supportsOnDidChange&&this._onDidChangeEmitter.fire(e)}async provideInlineCompletions(e,t,o,n){return await this._proxy.$provideInlineCompletions(this.handle,e.uri,t,o,n)}async handleItemDidShow(e,t,o,n){t.suggestionId===void 0&&(t.suggestionId=this._aiEditTelemetryService.createSuggestionId({applyCodeBlockSuggestionId:void 0,feature:"inlineSuggestion",source:this.providerId,languageId:e.languageId,editDeltaInfo:n,modeId:void 0,modelId:void 0,presentation:t.isInlineEdit?"nextEditSuggestion":"inlineCompletion"})),this._supportsHandleEvents&&await this._proxy.$handleInlineCompletionDidShow(this.handle,e.pid,t.idx,o)}async handlePartialAccept(e,t,o,n){this._supportsHandleEvents&&await this._proxy.$handleInlineCompletionPartialAccept(this.handle,e.pid,t.idx,o,n)}async handleEndOfLifetime(e,t,o,n){function r(c,u){return c.kind===2?{...c,supersededBy:c.supersededBy?u(c.supersededBy):void 0}:c}this._supportsHandleEvents&&await this._proxy.$handleInlineCompletionEndOfLifetime(this.handle,e.pid,t.idx,r(o,c=>({pid:e.pid,idx:c.idx}))),o.kind===0&&t.suggestionId!==void 0&&this._aiEditTelemetryService.handleCodeAccepted({suggestionId:t.suggestionId,feature:"inlineSuggestion",source:this.providerId,languageId:e.languageId,editDeltaInfo:zy.tryCreate(n.lineCountModified,n.lineCountOriginal,n.characterCountModified,n.characterCountOriginal),modeId:void 0,modelId:void 0,presentation:t.isInlineEdit?"nextEditSuggestion":"inlineCompletion",acceptanceMethod:"accept",applyCodeBlockSuggestionId:void 0});let s={opportunityId:n.requestUuid,correlationId:n.correlationId,shown:n.shown,shownDuration:n.shownDuration,shownDurationUncollapsed:n.shownDurationUncollapsed,timeUntilShown:n.timeUntilShown,timeUntilProviderRequest:n.timeUntilProviderRequest,timeUntilProviderResponse:n.timeUntilProviderResponse,editorType:n.editorType,viewKind:n.viewKind,preceeded:n.preceeded,requestReason:n.requestReason,typingInterval:n.typingInterval,typingIntervalCharacterCount:n.typingIntervalCharacterCount,languageId:n.languageId,cursorColumnDistance:n.cursorColumnDistance,cursorLineDistance:n.cursorLineDistance,lineCountOriginal:n.lineCountOriginal,lineCountModified:n.lineCountModified,characterCountOriginal:n.characterCountOriginal,characterCountModified:n.characterCountModified,disjointReplacements:n.disjointReplacements,sameShapeReplacements:n.sameShapeReplacements,selectedSuggestionInfo:n.selectedSuggestionInfo,extensionId:this.providerId.extensionId,extensionVersion:this.providerId.extensionVersion,groupId:QKo(n.correlationId)??this.groupId,skuPlan:n.skuPlan,skuType:n.skuType,performanceMarkers:n.performanceMarkers,availableProviders:n.availableProviders,partiallyAccepted:n.partiallyAccepted,partiallyAcceptedCountSinceOriginal:n.partiallyAcceptedCountSinceOriginal,partiallyAcceptedRatioSinceOriginal:n.partiallyAcceptedRatioSinceOriginal,partiallyAcceptedCharactersSinceOriginal:n.partiallyAcceptedCharactersSinceOriginal,superseded:o.kind===2&&!!o.supersededBy,reason:o.kind===0?"accepted":o.kind===1?"rejected":o.kind===2?"ignored":void 0,acceptedAlternativeAction:o.kind===0&&o.alternativeAction,noSuggestionReason:void 0,notShownReason:n.notShownReason,renameCreated:n.renameCreated,renameDuration:n.renameDuration,renameTimedOut:n.renameTimedOut,renameDroppedOtherEdits:n.renameDroppedOtherEdits,renameDroppedRenameEdits:n.renameDroppedRenameEdits,editKind:n.editKind,longDistanceHintVisible:n.longDistanceHintVisible,longDistanceHintDistance:n.longDistanceHintDistance,...q1(VW(this.providerId.extensionId))},l=this._instantiationService.createInstance(vO);Fwt(l,s)}disposeInlineCompletions(e,t){this._proxy.$freeInlineCompletionsList(this.handle,e.pid,t)}async handleRejection(e,t){this._supportsHandleEvents&&await this._proxy.$handleInlineCompletionRejection(this.handle,e.pid,t.idx)}toString(){return`InlineCompletionsProvider(${this.providerId.toString()})`}};IX=I([m(17,zt),m(18,rS),m(19,F)],IX);function QKo(a){if(a)try{let i=JSON.parse(a);return typeof i=="object"&&i!==null&&typeof i.engine=="string"?i.engine:void 0}catch{return}}var kV=ae("ILanguageStatusService"),emi=class{constructor(){this._provider=new cd;this.onDidChange=H.map(this._provider.onDidChange,()=>{})}addStatus(i){return this._provider.register(i.selector,i)}getLanguageStatus(i){return this._provider.ordered(i).sort((e,t)=>{let o=t.severity-e.severity;return o===0&&(o=Al(e.source,t.source)),o===0&&(o=Al(e.id,t.id)),o})}};we(kV,emi,1);var GDt=class extends C{constructor(e,t,o,n,r){super();this._languageService=t;this._modelService=o;this._resolverService=n;this._languageStatusService=r;this._status=this._register(new jt);this._proxy=e.getProxy(Zi.ExtHostLanguages),this._proxy.$acceptLanguageIds(t.getRegisteredLanguageIds()),this._register(t.onDidChange(s=>{this._proxy.$acceptLanguageIds(t.getRegisteredLanguageIds())}))}async $changeLanguage(e,t){if(!this._languageService.isRegisteredLanguageId(t))return Promise.reject(new Error(`Unknown language id: ${t}`));let o=A.revive(e),n=await this._resolverService.createModelReference(o);try{n.object.textEditorModel.setLanguage(this._languageService.createById(t))}finally{n.dispose()}}async $tokensAtPosition(e,t){let o=A.revive(e),n=this._modelService.getModel(o);if(!n)return;n.tokenization.tokenizeIfCheap(t.lineNumber);let r=n.tokenization.getLineTokens(t.lineNumber),s=r.findTokenIndexAtOffset(t.column-1);return{type:r.getStandardTokenType(s),range:new z(t.lineNumber,1+r.getStartOffset(s),t.lineNumber,1+r.getEndOffset(s))}}$setLanguageStatus(e,t){this._status.set(e,this._languageStatusService.addStatus(t))}$removeLanguageStatus(e){this._status.deleteAndDispose(e)}};GDt=I([vo(Gi.MainThreadLanguages),m(1,kt),m(2,Ct),m(3,Nt),m(4,kV)],GDt);var $Dt=class{constructor(i,e){this.loggerService=e;this.disposables=new P;let t=i.getProxy(Zi.ExtHostLogLevelServiceShape);this.disposables.add(e.onDidChangeLogLevel(o=>{N6(o)?t.$setLogLevel(o):t.$setLogLevel(o[1],o[0])}))}$log(i,e){let t=this.loggerService.getLogger(A.revive(i));if(!t)throw new Error("Create the logger before logging");for(let[o,n]of e)Kre(t,o,n)}async $createLogger(i,e){this.loggerService.createLogger(A.revive(i),e)}async $registerLogger(i){this.loggerService.registerLogger({...i,resource:A.revive(i.resource)})}async $deregisterLogger(i){this.loggerService.deregisterLogger(A.revive(i))}async $setVisibility(i,e){this.loggerService.setVisibility(A.revive(i),e)}$flush(i){let e=this.loggerService.getLogger(A.revive(i));if(!e)throw new Error("Create the logger before flushing");e.flush()}dispose(){this.disposables.dispose()}};$Dt=I([vo(Gi.MainThreadLogger),m(1,ol)],$Dt);qe.registerCommand("_extensionTests.setLogLevel",function(a,i){let e=a.get(ol),t=a.get(Co);if(t.isExtensionDevelopment&&t.extensionTestsLocationURI){let o=Gre(i);o!==void 0&&e.setLogLevel(o)}});qe.registerCommand("_extensionTests.getLogLevel",function(a){let i=a.get(ne);return $w(i.getLevel())});var pde=class{constructor(i,e,t,o,n){this._notificationService=e;this._commandService=t;this._dialogService=o;this.extensionsListener=n.onDidChangeExtensions(r=>{for(let s of r.removed)this._notificationService.removeFilter(s.identifier.value)})}dispose(){this.extensionsListener.dispose()}$showMessage(i,e,t,o){return t.modal?this._showModalMessage(i,e,t.detail,o,t.useCustom):this._showMessage(i,e,o,t)}_showMessage(i,e,t,o){return new Promise(n=>{let r=t.map(p=>pi({id:`_extension_message_handle_${p.handle}`,label:p.title,enabled:!0,run:()=>(n(p.handle),Promise.resolve())})),s,l=!1;o.source&&(s={label:o.source.label,id:o.source.identifier.value},l=pde.URGENT_NOTIFICATION_SOURCES.includes(s.id)),s||(s=d(3050,null));let c=[];o.source&&c.push(pi({id:o.source.identifier.value,label:d(3051,null),run:()=>this._commandService.executeCommand("_extensions.manage",o.source.identifier.value)}));let u=this._notificationService.notify({severity:i,message:e,actions:{primary:r,secondary:c},source:s,priority:l?3:0,sticky:l});H.once(u.onDidClose)(()=>{n(void 0)})})}async _showModalMessage(i,e,t,o,n){let r=[],s;for(let c of o){let u={label:c.title,run:()=>c.handle};c.isCloseAffordance?s=u:r.push(u)}s||(r.length>0?s={label:d(3049,null),run:()=>{}}:s={label:d(3052,null),run:()=>{}});let{result:l}=await this._dialogService.prompt({type:i,message:e,detail:t,buttons:r,cancelButton:s,custom:n});return l}};pde.URGENT_NOTIFICATION_SOURCES=["vscode.github-authentication","vscode.microsoft-authentication"],pde=I([vo(Gi.MainThreadMessageService),m(1,Ne),m(2,ge),m(3,ct),m(4,lt)],pde);function gEe(a){switch(a){case 100:return"req";case 101:return"cancel";case 102:return"subscribe";case 103:return"unsubscribe"}}function jDt(a){switch(a){case 200:return"init";case 201:return"reply:";case 202:case 203:return"replyErr:";case 204:return"event:"}}function mEe(a){let i=0;for(let e=0;;e+=7){let t=a.read(1);if(i|=(t.buffer[0]&127)<<e,!(t.buffer[0]&128))return i}}var YKo=yX(0);function hEe(a,i){if(i===0){a.write(YKo);return}let e=0;for(let o=i;o!==0;o=o>>>7)e++;let t=Je.alloc(e);for(let o=0;i!==0;o++)t.buffer[o]=i&127,i=i>>>7,i>0&&(t.buffer[o]|=128);a.write(t)}var QDt=class{constructor(i){this.buffer=i;this.pos=0}read(i){let e=this.buffer.slice(this.pos,this.pos+i);return this.pos+=e.byteLength,e}},N6e=class{constructor(){this.buffers=[]}get buffer(){return Je.concat(this.buffers)}write(i){this.buffers.push(i)}};function yX(a){let i=Je.alloc(1);return i.writeUInt8(a,0),i}var mde={Undefined:yX(0),String:yX(1),Buffer:yX(2),VSBuffer:yX(3),Array:yX(4),Object:yX(5),Uint:yX(6)};function fEe(a,i){if(typeof i>"u")a.write(mde.Undefined);else if(typeof i=="string"){let e=Je.fromString(i);a.write(mde.String),hEe(a,e.byteLength),a.write(e)}else if(Je.isNativeBuffer(i)){let e=Je.wrap(i);a.write(mde.Buffer),hEe(a,e.byteLength),a.write(e)}else if(i instanceof Je)a.write(mde.VSBuffer),hEe(a,i.byteLength),a.write(i);else if(Array.isArray(i)){a.write(mde.Array),hEe(a,i.length);for(let e of i)fEe(a,e)}else if(typeof i=="number"&&(i|0)===i)a.write(mde.Uint),hEe(a,i);else{let e=Je.fromString(JSON.stringify(i));a.write(mde.Object),hEe(a,e.byteLength),a.write(e)}}function O6e(a){switch(a.read(1).readUInt8(0)){case 0:return;case 1:return a.read(mEe(a)).toString();case 2:return a.read(mEe(a)).buffer;case 3:return a.read(mEe(a));case 4:{let e=mEe(a),t=[];for(let o=0;o<e;o++)t.push(O6e(a));return t}case 5:return JSON.parse(a.read(mEe(a)).toString());case 6:return mEe(a)}}var tmi=class{constructor(i,e,t=null,o=1e3){this.protocol=i;this.ctx=e;this.logger=t;this.timeoutDelay=o;this.channels=new Map;this.activeRequests=new Map;this.pendingRequests=new Map;this.protocolListener=this.protocol.onMessage(n=>this.onRawMessage(n)),this.sendResponse({type:200})}registerChannel(i,e){this.channels.set(i,e),setTimeout(()=>this.flushPendingRequests(i),0)}sendResponse(i){switch(i.type){case 200:{let e=this.send([i.type]);this.logger?.logOutgoing(e,0,1,jDt(i.type));return}case 201:case 202:case 204:case 203:{let e=this.send([i.type,i.id],i.data);this.logger?.logOutgoing(e,i.id,1,jDt(i.type),i.data);return}}}send(i,e=void 0){let t=new N6e;return fEe(t,i),fEe(t,e),this.sendBuffer(t.buffer)}sendBuffer(i){try{return this.protocol.send(i),i.byteLength}catch{return 0}}onRawMessage(i){let e=new QDt(i),t=O6e(e),o=O6e(e),n=t[0];switch(n){case 100:return this.logger?.logIncoming(i.byteLength,t[1],1,`${gEe(n)}: ${t[2]}.${t[3]}`,o),this.onPromise({type:n,id:t[1],channelName:t[2],name:t[3],arg:o});case 102:return this.logger?.logIncoming(i.byteLength,t[1],1,`${gEe(n)}: ${t[2]}.${t[3]}`,o),this.onEventListen({type:n,id:t[1],channelName:t[2],name:t[3],arg:o});case 101:return this.logger?.logIncoming(i.byteLength,t[1],1,`${gEe(n)}`),this.disposeActiveRequest({type:n,id:t[1]});case 103:return this.logger?.logIncoming(i.byteLength,t[1],1,`${gEe(n)}`),this.disposeActiveRequest({type:n,id:t[1]})}}onPromise(i){let e=this.channels.get(i.channelName);if(!e){this.collectPendingRequest(i);return}let t=new $e,o;try{o=e.call(this.ctx,i.name,i.arg,t.token)}catch(s){o=Promise.reject(s)}let n=i.id;o.then(s=>{this.sendResponse({id:n,data:s,type:201})},s=>{s instanceof Error?this.sendResponse({id:n,data:{message:s.message,name:s.name,stack:s.stack?s.stack.split(`
`):void 0},type:202}):this.sendResponse({id:n,data:s,type:203})}).finally(()=>{r.dispose(),this.activeRequests.delete(i.id)});let r=Z(()=>t.cancel());this.activeRequests.set(i.id,r)}onEventListen(i){let e=this.channels.get(i.channelName);if(!e){this.collectPendingRequest(i);return}let t=i.id,n=e.listen(this.ctx,i.name,i.arg)(r=>this.sendResponse({id:t,data:r,type:204}));this.activeRequests.set(i.id,n)}disposeActiveRequest(i){let e=this.activeRequests.get(i.id);e&&(e.dispose(),this.activeRequests.delete(i.id))}collectPendingRequest(i){let e=this.pendingRequests.get(i.channelName);e||(e=[],this.pendingRequests.set(i.channelName,e));let t=setTimeout(()=>{console.error(`Unknown channel: ${i.channelName}`),i.type===100&&this.sendResponse({id:i.id,data:{name:"Unknown channel",message:`Channel name '${i.channelName}' timed out after ${this.timeoutDelay}ms`,stack:void 0},type:202})},this.timeoutDelay);e.push({request:i,timeoutTimer:t})}flushPendingRequests(i){let e=this.pendingRequests.get(i);if(e){for(let t of e)switch(clearTimeout(t.timeoutTimer),t.request.type){case 100:this.onPromise(t.request);break;case 102:this.onEventListen(t.request);break}this.pendingRequests.delete(i)}}dispose(){this.protocolListener&&(this.protocolListener.dispose(),this.protocolListener=null),Ue(this.activeRequests.values()),this.activeRequests.clear()}};var qDt=class{constructor(i,e=null){this.protocol=i;this.isDisposed=!1;this.state=0;this.activeRequests=new Set;this.handlers=new Map;this.lastRequestId=0;this._onDidInitialize=new E;this.onDidInitialize=this._onDidInitialize.event;this.protocolListener=this.protocol.onMessage(t=>this.onBuffer(t)),this.logger=e}getChannel(i){let e=this;return{call(t,o,n){return e.isDisposed?Promise.reject(new ho):e.requestPromise(i,t,o,n)},listen(t,o){return e.isDisposed?H.None:e.requestEvent(i,t,o)}}}requestPromise(i,e,t,o=ve.None){let n=this.lastRequestId++,s={id:n,type:100,channelName:i,name:e,arg:t};if(o.isCancellationRequested)return Promise.reject(new ho);let l,c;return new Promise((p,h)=>{if(o.isCancellationRequested)return h(new ho);let g=()=>{let b=S=>{switch(S.type){case 201:this.handlers.delete(n),p(S.data);break;case 202:{this.handlers.delete(n);let y=new Error(S.data.message);y.stack=Array.isArray(S.data.stack)?S.data.stack.join(`
`):S.data.stack,y.name=S.data.name,h(y);break}case 203:this.handlers.delete(n),h(S.data);break}};this.handlers.set(n,b),this.sendRequest(s)},f=null;this.state===1?g():(f=xn(b=>this.whenInitialized()),f.then(()=>{f=null,g()}));let v=()=>{f?(f.cancel(),f=null):this.sendRequest({id:n,type:101}),h(new ho)};l=o.onCancellationRequested(v),c={dispose:wd(()=>{v(),l.dispose()})},this.activeRequests.add(c)}).finally(()=>{l?.dispose(),this.activeRequests.delete(c)})}requestEvent(i,e,t){let o=this.lastRequestId++,r={id:o,type:102,channelName:i,name:e,arg:t},s=null,l=new E({onWillAddFirstListener:()=>{let u=()=>{this.activeRequests.add(l),this.sendRequest(r)};this.state===1?u():(s=xn(p=>this.whenInitialized()),s.then(()=>{s=null,u()}))},onDidRemoveLastListener:()=>{s?(s.cancel(),s=null):(this.activeRequests.delete(l),this.sendRequest({id:o,type:103})),this.handlers.delete(o)}}),c=u=>l.fire(u.data);return this.handlers.set(o,c),l.event}sendRequest(i){switch(i.type){case 100:case 102:{let e=this.send([i.type,i.id,i.channelName,i.name],i.arg);this.logger?.logOutgoing(e,i.id,0,`${gEe(i.type)}: ${i.channelName}.${i.name}`,i.arg);return}case 101:case 103:{let e=this.send([i.type,i.id]);this.logger?.logOutgoing(e,i.id,0,gEe(i.type));return}}}send(i,e=void 0){let t=new N6e;return fEe(t,i),fEe(t,e),this.sendBuffer(t.buffer)}sendBuffer(i){try{return this.protocol.send(i),i.byteLength}catch{return 0}}onBuffer(i){let e=new QDt(i),t=O6e(e),o=O6e(e),n=t[0];switch(n){case 200:return this.logger?.logIncoming(i.byteLength,0,0,jDt(n)),this.onResponse({type:t[0]});case 201:case 202:case 204:case 203:return this.logger?.logIncoming(i.byteLength,t[1],0,jDt(n),o),this.onResponse({type:t[0],id:t[1],data:o})}}onResponse(i){if(i.type===200){this.state=1,this._onDidInitialize.fire();return}this.handlers.get(i.id)?.(i)}get onDidInitializePromise(){return H.toPromise(this.onDidInitialize)}whenInitialized(){return this.state===1?Promise.resolve():this.onDidInitializePromise}dispose(){this.isDisposed=!0,this.protocolListener&&(this.protocolListener.dispose(),this.protocolListener=null),Ue(this.activeRequests.values()),this.activeRequests.clear(),this._onDidInitialize.dispose()}};I([mi],qDt.prototype,"onDidInitializePromise",1);var wX=class{constructor(i,e,t=null){let o=new N6e;fEe(o,e),i.send(o.buffer),this.channelClient=new qDt(i,t),this.channelServer=new tmi(i,e,t)}getChannel(i){return this.channelClient.getChannel(i)}registerChannel(i,e){this.channelServer.registerChannel(i,e)}dispose(){this.channelClient.dispose(),this.channelServer.dispose()}};function CX(a){return{call(i,e,t){return a.then(o=>o.call(i,e,t))},listen(i,e){let t=new Mh;return a.then(o=>t.input=o.listen(i,e)),t.event}}}var dd;(o=>{function a(n,r,s){let l=n,c=s?.disableMarshalling,u=new Map;for(let p in l)e(p)&&u.set(p,H.buffer(l[p],p,!0,void 0,r));return new class{listen(p,h,g){let f=u.get(h);if(f)return f;let v=l[h];if(typeof v=="function"){if(t(h))return v.call(l,g);if(e(h))return u.set(h,H.buffer(l[h],h,!0,void 0,r)),u.get(h)}throw new Zs(`Event not found: ${h}`)}call(p,h,g){let f=l[h];if(typeof f=="function"){if(!c&&Array.isArray(g))for(let b=0;b<g.length;b++)g[b]=Xn(g[b]);let v=f.apply(l,g);return v instanceof Promise||(v=Promise.resolve(v)),v}throw new Zs(`Method not found: ${h}`)}}}o.fromService=a;function i(n,r){let s=r?.disableMarshalling;return new Proxy({},{get(l,c){if(typeof c=="string")return r?.properties?.has(c)?r.properties.get(c):t(c)?function(u){return n.listen(c,u)}:e(c)?n.listen(c):async function(...u){let p;r&&!Jn(r.context)?p=[r.context,...u]:p=u;let h=await n.call(c,p);return s?h:Xn(h)};throw new Zs(`Property not found: ${String(c)}`)}})}o.toService=i;function e(n){return n[0]==="o"&&n[1]==="n"&&Hk(n.charCodeAt(2))}function t(n){return/^onDynamic/.test(n)&&Hk(n.charCodeAt(9))}})(dd||={});var vEe;(r=>{r.enableDiagnostics=!1,r.records=[];let e=new WeakMap,t=0;function o(s,l){if(!e.has(s)){let c=String(++t);e.set(s,c)}return e.get(s)}function n(s,l,c,u){}r.traceSocketEvent=n})(vEe||={});var imi=null;function xX(){return imi||(imi=Je.alloc(0)),imi}var omi=class{get byteLength(){return this._totalLength}constructor(){this._chunks=[],this._totalLength=0}acceptChunk(i){this._chunks.push(i),this._totalLength+=i.byteLength}read(i){return this._read(i,!0)}peek(i){return this._read(i,!1)}_read(i,e){if(i===0)return xX();if(i>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===i){let r=this._chunks[0];return e&&(this._chunks.shift(),this._totalLength-=i),r}if(this._chunks[0].byteLength>i){let r=this._chunks[0].slice(0,i);return e&&(this._chunks[0]=this._chunks[0].slice(i),this._totalLength-=i),r}let t=Je.alloc(i),o=0,n=0;for(;i>0;){let r=this._chunks[n];if(r.byteLength>i){let s=r.slice(0,i);t.set(s,o),o+=i,e&&(this._chunks[n]=r.slice(i),this._totalLength-=i),i-=i}else t.set(r,o),o+=r.byteLength,e?(this._chunks.shift(),this._totalLength-=r.byteLength):n++,i-=r.byteLength}return t}};function ZZi(a){switch(a){case 0:return"None";case 1:return"Regular";case 2:return"Control";case 3:return"Ack";case 5:return"Disconnect";case 6:return"ReplayRequest";case 7:return"PauseWriting";case 8:return"ResumeWriting";case 9:return"KeepAlive"}}var DP=class{constructor(i,e,t,o){this.type=i;this.id=e;this.ack=t;this.data=o;this.writtenTime=0}get size(){return this.data.byteLength}},F6e=class extends C{constructor(e){super();this._onMessage=this._register(new E);this.onMessage=this._onMessage.event;this._state={readHead:!0,readLen:13,messageType:0,id:0,ack:0};this._socket=e,this._isDisposed=!1,this._incomingData=new omi,this._register(this._socket.onData(t=>this.acceptChunk(t))),this.lastReadTime=Date.now()}acceptChunk(e){if(!(!e||e.byteLength===0))for(this.lastReadTime=Date.now(),this._incomingData.acceptChunk(e);this._incomingData.byteLength>=this._state.readLen;){let t=this._incomingData.read(this._state.readLen);if(this._state.readHead)this._state.readHead=!1,this._state.readLen=t.readUInt32BE(9),this._state.messageType=t.readUInt8(0),this._state.id=t.readUInt32BE(1),this._state.ack=t.readUInt32BE(5),this._socket.traceSocketEvent("protocolHeaderRead",{messageType:ZZi(this._state.messageType),id:this._state.id,ack:this._state.ack,messageSize:this._state.readLen});else{let o=this._state.messageType,n=this._state.id,r=this._state.ack;if(this._state.readHead=!0,this._state.readLen=13,this._state.messageType=0,this._state.id=0,this._state.ack=0,this._socket.traceSocketEvent("protocolMessageRead",t),this._onMessage.fire(new DP(o,n,r,t)),this._isDisposed)break}}}readEntireBuffer(){return this._incomingData.read(this._incomingData.byteLength)}dispose(){this._isDisposed=!0,super.dispose()}},W6e=class{constructor(i){this._writeNowTimeout=null;this._isDisposed=!1,this._isPaused=!1,this._socket=i,this._data=[],this._totalLength=0,this.lastWriteTime=0}dispose(){try{this.flush()}catch{}this._isDisposed=!0}drain(){return this.flush(),this._socket.drain()}flush(){this._writeNow()}pause(){this._isPaused=!0}resume(){this._isPaused=!1,this._scheduleWriting()}write(i){if(this._isDisposed)return;i.writtenTime=Date.now(),this.lastWriteTime=Date.now();let e=Je.alloc(13);e.writeUInt8(i.type,0),e.writeUInt32BE(i.id,1),e.writeUInt32BE(i.ack,5),e.writeUInt32BE(i.data.byteLength,9),this._socket.traceSocketEvent("protocolHeaderWrite",{messageType:ZZi(i.type),id:i.id,ack:i.ack,messageSize:i.data.byteLength}),this._socket.traceSocketEvent("protocolMessageWrite",i.data),this._writeSoon(e,i.data)}_bufferAdd(i,e){let t=this._totalLength===0;return this._data.push(i,e),this._totalLength+=i.byteLength+e.byteLength,t}_bufferTake(){let i=Je.concat(this._data,this._totalLength);return this._data.length=0,this._totalLength=0,i}_writeSoon(i,e){this._bufferAdd(i,e)&&this._scheduleWriting()}_scheduleWriting(){this._writeNowTimeout||(this._writeNowTimeout=setTimeout(()=>{this._writeNowTimeout=null,this._writeNow()}))}_writeNow(){if(this._totalLength===0||this._isPaused)return;let i=this._bufferTake();this._socket.traceSocketEvent("protocolWrite",{byteLength:i.byteLength}),this._socket.write(i)}},nmi=class extends C{constructor(e){super();this._onMessage=this._register(new E);this.onMessage=this._onMessage.event;this._onDidDispose=this._register(new E);this.onDidDispose=this._onDidDispose.event;this._socket=e,this._socketWriter=this._register(new W6e(this._socket)),this._socketReader=this._register(new F6e(this._socket)),this._register(this._socketReader.onMessage(t=>{t.type===1&&this._onMessage.fire(t.data)})),this._register(this._socket.onClose(()=>this._onDidDispose.fire()))}drain(){return this._socketWriter.drain()}getSocket(){return this._socket}sendDisconnect(){}send(e){this._socketWriter.write(new DP(1,0,0,e))}},YDt=class a extends wX{constructor(e,t,o=null){super(e,t,o);this.protocol=e}static fromSocket(e,t){return new a(new nmi(e),t)}get onDidDispose(){return this.protocol.onDidDispose}dispose(){super.dispose();let e=this.protocol.getSocket();this.protocol.sendDisconnect(),this.protocol.dispose(),e.end()}},S5=class{constructor(){this._hasListeners=!1;this._isDeliveringMessages=!1;this._bufferedMessages=[];this._emitter=new E({onWillAddFirstListener:()=>{this._hasListeners=!0,queueMicrotask(()=>this._deliverMessages())},onDidRemoveLastListener:()=>{this._hasListeners=!1}}),this.event=this._emitter.event}_deliverMessages(){if(!this._isDeliveringMessages){for(this._isDeliveringMessages=!0;this._hasListeners&&this._bufferedMessages.length>0;)this._emitter.fire(this._bufferedMessages.shift());this._isDeliveringMessages=!1}}fire(i){this._hasListeners?this._bufferedMessages.length>0?this._bufferedMessages.push(i):this._emitter.fire(i):this._bufferedMessages.push(i)}flushBuffer(){this._bufferedMessages=[]}},rmi=class{constructor(i){this.data=i,this.next=null}},smi=class{constructor(){this._first=null,this._last=null}length(){let i=0,e=this._first;for(;e;)e=e.next,i++;return i}peek(){return this._first?this._first.data:null}toArray(){let i=[],e=0,t=this._first;for(;t;)i[e++]=t.data,t=t.next;return i}pop(){if(this._first){if(this._first===this._last){this._first=null,this._last=null;return}this._first=this._first.next}}push(i){let e=new rmi(i);if(!this._first){this._first=e,this._last=e;return}this._last.next=e,this._last=e}},ami=class a{static{this._HISTORY_LENGTH=10}static{this._INSTANCE=null}static getInstance(){return a._INSTANCE||(a._INSTANCE=new a),a._INSTANCE}constructor(){this.lastRuns=[];let i=Date.now();for(let e=0;e<a._HISTORY_LENGTH;e++)this.lastRuns[e]=i-1e3*e;setInterval(()=>{for(let e=a._HISTORY_LENGTH;e>=1;e--)this.lastRuns[e]=this.lastRuns[e-1];this.lastRuns[0]=Date.now()},1e3)}load(){let i=Date.now(),e=(1+a._HISTORY_LENGTH)*1e3,t=0;for(let o=0;o<a._HISTORY_LENGTH;o++)i-this.lastRuns[o]<=e&&t++;return 1-t/a._HISTORY_LENGTH}hasHighLoad(){return this.load()>=.5}},XDt=class{constructor(i){this._onControlMessage=new S5;this.onControlMessage=this._onControlMessage.event;this._onMessage=new S5;this.onMessage=this._onMessage.event;this._onDidDispose=new S5;this.onDidDispose=this._onDidDispose.event;this._onSocketClose=new S5;this.onSocketClose=this._onSocketClose.event;this._onSocketTimeout=new S5;this.onSocketTimeout=this._onSocketTimeout.event;this._loadEstimator=i.loadEstimator??ami.getInstance(),this._shouldSendKeepAlive=i.sendKeepAlive??!0,this._isReconnecting=!1,this._outgoingUnackMsg=new smi,this._outgoingMsgId=0,this._outgoingAckId=0,this._outgoingAckTimeout=null,this._incomingMsgId=0,this._incomingAckId=0,this._incomingMsgLastTime=0,this._incomingAckTimeout=null,this._lastReplayRequestTime=0,this._lastSocketTimeoutTime=Date.now(),this._socketDisposables=new P,this._socket=i.socket,this._socketWriter=this._socketDisposables.add(new W6e(this._socket)),this._socketReader=this._socketDisposables.add(new F6e(this._socket)),this._socketDisposables.add(this._socketReader.onMessage(e=>this._receiveMessage(e))),this._socketDisposables.add(this._socket.onClose(e=>this._onSocketClose.fire(e))),i.initialChunk&&this._socketReader.acceptChunk(i.initialChunk),this._shouldSendKeepAlive?this._keepAliveInterval=setInterval(()=>{this._sendKeepAlive()},5e3):this._keepAliveInterval=null}get unacknowledgedCount(){return this._outgoingMsgId-this._outgoingAckId}dispose(){this._outgoingAckTimeout&&(clearTimeout(this._outgoingAckTimeout),this._outgoingAckTimeout=null),this._incomingAckTimeout&&(clearTimeout(this._incomingAckTimeout),this._incomingAckTimeout=null),this._keepAliveInterval&&(clearInterval(this._keepAliveInterval),this._keepAliveInterval=null),this._socketDisposables.dispose()}drain(){return this._socketWriter.drain()}sendDisconnect(){if(!this._didSendDisconnect){this._didSendDisconnect=!0;let i=new DP(5,0,0,xX());this._socketWriter.write(i),this._socketWriter.flush()}}sendPause(){let i=new DP(7,0,0,xX());this._socketWriter.write(i)}sendResume(){let i=new DP(8,0,0,xX());this._socketWriter.write(i)}pauseSocketWriting(){this._socketWriter.pause()}getSocket(){return this._socket}getMillisSinceLastIncomingData(){return Date.now()-this._socketReader.lastReadTime}beginAcceptReconnection(i,e){this._isReconnecting=!0,this._socketDisposables.dispose(),this._socketDisposables=new P,this._onControlMessage.flushBuffer(),this._onSocketClose.flushBuffer(),this._onSocketTimeout.flushBuffer(),this._socket.dispose(),this._lastReplayRequestTime=0,this._lastSocketTimeoutTime=Date.now(),this._socket=i,this._socketWriter=this._socketDisposables.add(new W6e(this._socket)),this._socketReader=this._socketDisposables.add(new F6e(this._socket)),this._socketDisposables.add(this._socketReader.onMessage(t=>this._receiveMessage(t))),this._socketDisposables.add(this._socket.onClose(t=>this._onSocketClose.fire(t))),this._socketReader.acceptChunk(e)}endAcceptReconnection(){this._isReconnecting=!1,this._incomingAckId=this._incomingMsgId;let i=new DP(3,0,this._incomingAckId,xX());this._socketWriter.write(i);let e=this._outgoingUnackMsg.toArray();for(let t=0,o=e.length;t<o;t++)this._socketWriter.write(e[t]);this._recvAckCheck()}acceptDisconnect(){this._onDidDispose.fire()}_receiveMessage(i){if(i.ack>this._outgoingAckId){this._outgoingAckId=i.ack;do{let e=this._outgoingUnackMsg.peek();if(e&&e.id<=i.ack)this._outgoingUnackMsg.pop();else break}while(!0)}switch(i.type){case 0:break;case 1:{if(i.id>this._incomingMsgId)if(i.id!==this._incomingMsgId+1){let e=Date.now();e-this._lastReplayRequestTime>1e4&&(this._lastReplayRequestTime=e,this._socketWriter.write(new DP(6,0,0,xX())))}else this._incomingMsgId=i.id,this._incomingMsgLastTime=Date.now(),this._sendAckCheck(),this._onMessage.fire(i.data);break}case 2:{this._onControlMessage.fire(i.data);break}case 3:break;case 5:{this._onDidDispose.fire();break}case 6:{let e=this._outgoingUnackMsg.toArray();for(let t=0,o=e.length;t<o;t++)this._socketWriter.write(e[t]);this._recvAckCheck();break}case 7:{this._socketWriter.pause();break}case 8:{this._socketWriter.resume();break}case 9:break}}readEntireBuffer(){return this._socketReader.readEntireBuffer()}flush(){this._socketWriter.flush()}send(i){let e=++this._outgoingMsgId;this._incomingAckId=this._incomingMsgId;let t=new DP(1,e,this._incomingAckId,i);this._outgoingUnackMsg.push(t),this._isReconnecting||(this._socketWriter.write(t),this._recvAckCheck())}sendControl(i){let e=new DP(2,0,0,i);this._socketWriter.write(e)}_sendAckCheck(){if(this._incomingMsgId<=this._incomingAckId||this._incomingAckTimeout)return;let i=Date.now()-this._incomingMsgLastTime;if(i>=2e3){this._sendAck();return}this._incomingAckTimeout=setTimeout(()=>{this._incomingAckTimeout=null,this._sendAckCheck()},2e3-i+5)}_recvAckCheck(){if(this._outgoingMsgId<=this._outgoingAckId||this._outgoingAckTimeout||this._isReconnecting)return;let i=this._outgoingUnackMsg.peek(),e=Date.now()-i.writtenTime,t=Date.now()-this._socketReader.lastReadTime,o=Date.now()-this._lastSocketTimeoutTime;if(e>=2e4&&t>=2e4&&o>=2e4&&!this._loadEstimator.hasHighLoad()){this._lastSocketTimeoutTime=Date.now(),this._onSocketTimeout.fire({unacknowledgedMsgCount:this._outgoingUnackMsg.length(),timeSinceOldestUnacknowledgedMsg:e,timeSinceLastReceivedSomeData:t});return}let n=Math.max(2e4-e,2e4-t,2e4-o,500);this._outgoingAckTimeout=setTimeout(()=>{this._outgoingAckTimeout=null,this._recvAckCheck()},n)}_sendAck(){if(this._incomingMsgId<=this._incomingAckId)return;this._incomingAckId=this._incomingMsgId;let i=new DP(3,0,this._incomingAckId,xX());this._socketWriter.write(i)}_sendKeepAlive(){this._incomingAckId=this._incomingMsgId;let i=new DP(9,0,this._incomingAckId,xX());this._socketWriter.write(i)}};var XKo=(a,i,e)=>{let t=new Uint8Array(16);for(let r=0;r<16;r++)t[r]=Math.round(Math.random()*256);let o=Qd(Je.wrap(t));return[`GET ws://localhost${a}?${i}&skipWebSocketFrames=true HTTP/1.1`,"Connection: Upgrade","Upgrade: websocket",`Sec-WebSocket-Key: ${o}`].join(`\r
`)+`\r
\r
`},eeo=Je.fromString(`\r
\r
`);async function teo(a,i,e,t,o){a.write(Je.fromString(XKo(i,e,t)));let n=new P;try{return await new Promise((r,s)=>{let l;n.add(a.onData(c=>{l?l=Je.concat([l,c],l.byteLength+c.byteLength):l=c;let u=l.indexOf(eeo);if(u===-1)return;r(a),a.pauseData();let p=l.slice(u+eeo.byteLength);p.byteLength&&o.onData.fire(p)})),n.add(a.onClose(c=>s(c??new Error("socket closed")))),n.add(a.onEnd(()=>s(new Error("socket ended"))))})}catch(r){throw a.dispose(),r}finally{n.dispose()}}var JDt=class extends C{constructor(e,t){super();this.debugLabel=e;this.pausableDataEmitter=this._register(new Pm);this.onData=(...e)=>(this.pausableDataEmitter.isPaused&&queueMicrotask(()=>this.pausableDataEmitter.resume()),this.pausableDataEmitter.event(...e));this.didDisposeEmitter=this._register(new E);this.onDidDispose=this.didDisposeEmitter.event;this.ended=!1;this._register(t.onData),this._register(t.onData.event(o=>this.pausableDataEmitter.fire(o))),this.onClose=this._register(t.onClose).event,this.onEnd=this._register(t.onEnd).event}pauseData(){this.pausableDataEmitter.pause()}drain(){return Promise.resolve()}end(){this.ended=!0,this.closeRemote()}traceSocketEvent(e,t){vEe.traceSocketEvent(this,this.debugLabel,e,t)}dispose(){this.ended||this.closeRemote(),this.didDisposeEmitter.fire(),super.dispose()}};var Fz=ae("remoteSocketFactoryService"),ZDt=class{constructor(){this.factories={}}register(i,e){return this.factories[i]??=[],this.factories[i].push(e),Z(()=>{let t=this.factories[i]?.indexOf(e);typeof t=="number"&&t>=0&&this.factories[i]?.splice(t,1)})}getSocketFactory(i){return(this.factories[i.type]||[]).find(t=>t.supports(i))}connect(i,e,t,o){let n=this.getSocketFactory(i);if(!n)throw new Error(`No socket factory found for ${i}`);return n.connect(i,e,t,o)}};var eLt=class extends C{constructor(e,t){super();this._remoteSocketFactoryService=t;this._registrations=this._register(new jt);this._remoteSockets=new Map;this._proxy=e.getProxy(Zi.ExtHostManagedSockets)}async $registerSocketFactory(e){let t=this,o=new P,n=new class{supports(r){return r.id===e}connect(r,s,l,c){return new Promise((u,p)=>{if(r.id!==e)return p(new Error("Invalid connectTo"));let h=r.id;t._proxy.$openRemoteSocket(h).then(g=>{let f={onClose:new E,onData:new E,onEnd:new E};t._remoteSockets.set(g,f),lmi.connect(g,t._proxy,s,l,c,f).then(v=>{o.add(H.once(v.onDidDispose)(()=>t._remoteSockets.delete(g))),u(v)},v=>{t._remoteSockets.delete(g),p(v)})}).catch(p)})}};o.add(this._remoteSocketFactoryService.register(1,n)),this._registrations.set(e,o)}async $unregisterSocketFactory(e){this._registrations.deleteAndDispose(e)}$onDidManagedSocketHaveData(e,t){this._remoteSockets.get(e)?.onData.fire(t)}$onDidManagedSocketClose(e,t){this._remoteSockets.get(e)?.onClose.fire({type:0,error:t?new Error(t):void 0,hadError:!!t}),this._remoteSockets.delete(e)}$onDidManagedSocketEnd(e){this._remoteSockets.get(e)?.onEnd.fire()}};eLt=I([vo(Gi.MainThreadManagedSockets),m(1,Fz)],eLt);var lmi=class a extends JDt{constructor(e,t,o,n){super(o,n);this.socketId=e;this.proxy=t}static connect(e,t,o,n,r,s){let l=new a(e,t,r,s);return teo(l,o,n,r,s)}write(e){this.proxy.$remoteSocketWrite(this.socketId,e)}closeRemote(){this.proxy.$remoteSocketEnd(this.socketId)}drain(){return this.proxy.$remoteSocketDrain(this.socketId)}};var tLt="text/x-code-output",bEe="Log",kX="text/x-code-log-output",SEe="log",Ul="workbench.panel.output",iLt=new Q("inOutput",!1),oeo=new Q("activeLogOutput",!1),oLt=new Q("activeLogOutput.isLog",!1),nLt=new Q("activeLogOutput.levelSettable",!1),rLt=new Q("activeLogOutput.level",""),sLt=new Q("activeLogOutput.levelIsDefault",!1),aLt=new Q("outputView.scrollLock",!1),lLt=new Q("activeOutputChannel",""),cLt=new Q("output.filter.trace",!0),dLt=new Q("output.filter.debug",!0),uLt=new Q("output.filter.info",!0),pLt=new Q("output.filter.warning",!0),mLt=new Q("output.filter.error",!0),IEe=new Q("outputFilterFocus",!1),hLt=new Q("output.filter.categories",""),Ml=ae("outputService");var sS={OutputChannels:"workbench.contributions.outputChannels"};function LP(a){return!!a.source&&!Array.isArray(a.source)}function EV(a){return Array.isArray(a.source)}var cmi=class extends C{constructor(){super(...arguments);this.channels=new Map;this._onDidRegisterChannel=this._register(new E);this.onDidRegisterChannel=this._onDidRegisterChannel.event;this._onDidRemoveChannel=this._register(new E);this.onDidRemoveChannel=this._onDidRemoveChannel.event;this._onDidUpdateChannelFiles=this._register(new E);this.onDidUpdateChannelSources=this._onDidUpdateChannelFiles.event}registerChannel(e){this.channels.has(e.id)||(this.channels.set(e.id,e),this._onDidRegisterChannel.fire(e.id))}getChannels(){let e=[];return this.channels.forEach(t=>e.push(t)),e}getChannel(e){return this.channels.get(e)}updateChannelSources(e,t){let o=this.channels.get(e);o&&EV(o)&&(o.source=t,this._onDidUpdateChannelFiles.fire(o))}removeChannel(e){let t=this.channels.get(e);t&&(this.channels.delete(e),this._onDidRemoveChannel.fire(t))}};oe.add(sS.OutputChannels,new cmi);var Ft=ae("viewsService");var EX=class extends C{constructor(e,t,o,n,r){super();this._outputStatusItem=this._register(new me);this._outputService=t,this._viewsService=o,this._configurationService=n,this._statusbarService=r,this._proxy=e.getProxy(Zi.ExtHostOutputService);let s=()=>{let l=this._viewsService.isViewVisible(Ul)?this._outputService.getActiveChannel():void 0;this._proxy.$setVisibleChannel(l?l.id:null),this._outputStatusItem.value=void 0};this._register(H.any(this._outputService.onActiveOutputChannel,H.filter(this._viewsService.onDidChangeViewVisibility,({id:l})=>l===Ul))(()=>s())),s()}async $register(e,t,o,n){let r=(EX._extensionIdPool.get(n)||0)+1;EX._extensionIdPool.set(n,r);let s=`extension-output-${n}-#${r}-${e}`,l=A.revive(t);return oe.as(sS.OutputChannels).registerChannel({id:s,label:e,source:{resource:l},log:!1,languageId:o,extensionId:n}),this._register(Z(()=>this.$dispose(s))),s}async $update(e,t,o){let n=this._getChannel(e);n&&(t===1?n.update(t):Xo(o)&&n.update(t,o))}async $reveal(e,t){let o=this._getChannel(e);if(!o)return;let n=this._configurationService.getValue("workbench.view.showQuietly")??{};if(!this._viewsService.isViewVisible(Ul)&&n[Ul]){this._showChannelQuietly(o);return}this._outputService.showChannel(o.id,t)}_showChannelQuietly(e){let t={name:d(3054,null),text:"$(output)",ariaLabel:d(3055,null,e.label),command:`workbench.action.output.show.${e.id}`,tooltip:d(3056,null,e.label),kind:"prominent"};this._outputStatusItem.value?this._outputStatusItem.value.update(t):this._outputStatusItem.value=this._statusbarService.addEntry(t,"status.view.showQuietly",1,{location:{id:"status.notifications",priority:Number.NEGATIVE_INFINITY},alignment:0})}async $close(e){if(this._viewsService.isViewVisible(Ul)){let t=this._outputService.getActiveChannel();t&&e===t.id&&this._viewsService.closeView(Ul)}}async $dispose(e){this._getChannel(e)?.dispose()}_getChannel(e){return this._outputService.getChannel(e)}};EX._extensionIdPool=new Map,EX=I([vo(Gi.MainThreadOutputService),m(1,Ml),m(2,Ft),m(3,B),m(4,Tr)],EX);var hde=class{constructor(i,e,t){this._commandService=t;this._progress=new Map;this._proxy=i.getProxy(Zi.ExtHostProgress),this._progressService=e}dispose(){this._progress.forEach(i=>i.resolve()),this._progress.clear()}async $startProgress(i,e,t){let o=this._createTask(i);if(e.location===15&&t){let n=hde.URGENT_PROGRESS_SOURCES.includes(t);e={...e,priority:n?3:0,location:15,secondaryActions:[pi({id:t,label:d(3057,null),run:()=>this._commandService.executeCommand("_extensions.manage",t)})]}}try{this._progressService.withProgress(e,o,()=>this._proxy.$acceptProgressCanceled(i))}catch(n){ss(n)}}$progressReport(i,e){this._progress.get(i)?.progress.report(e)}$progressEnd(i){let e=this._progress.get(i);e&&(e.resolve(),this._progress.delete(i))}_createTask(i){return e=>new Promise(t=>{this._progress.set(i,{resolve:t,progress:e})})}};hde.URGENT_PROGRESS_SOURCES=["vscode.github-authentication","vscode.microsoft-authentication"],hde=I([vo(Gi.MainThreadProgress),m(1,Bo),m(2,ge)],hde);var gLt=class{constructor(i,e){this.quickDiffService=e;this.providerDisposables=new jt;this.proxy=i.getProxy(Zi.ExtHostQuickDiff)}async $registerQuickDiffProvider(i,e,t,o,n){let r={id:t,label:o,rootUri:A.revive(n),selector:e,kind:"contributed",getOriginalResource:async l=>A.revive(await this.proxy.$provideOriginalResource(i,l,ve.None))},s=this.quickDiffService.addQuickDiffProvider(r);this.providerDisposables.set(i,s)}async $unregisterQuickDiffProvider(i){this.providerDisposables.has(i)&&this.providerDisposables.deleteAndDispose(i)}dispose(){this.providerDisposables.dispose()}};gLt=I([vo(Gi.MainThreadQuickDiff),m(1,OE)],gLt);var fLt=class{constructor(i,e,t,o,n,r){this.labelService=t;this.customEditorLabelService=o;this.modelService=n;this.languageService=r;this._items={};this.sessions=new Map;this._proxy=i.getProxy(Zi.ExtHostQuickOpen),this._quickInputService=e}dispose(){for(let[i,e]of this.sessions)e.store.dispose()}$show(i,e,t){let o=new Promise((n,r)=>{this._items[i]={resolve:n,reject:r}});return e={...e,onDidFocus:n=>{n&&this._proxy.$onItemSelected(n.handle)}},e.canPickMany?this._quickInputService.pick(o,e,t).then(n=>{if(n)return n.map(r=>r.handle)}):this._quickInputService.pick(o,e,t).then(n=>{if(n)return n.handle})}$setItems(i,e){return this._items[i]&&(e.forEach(t=>this.expandItemProps(t)),this._items[i].resolve(e),delete this._items[i]),Promise.resolve()}$setError(i,e){return this._items[i]&&(this._items[i].reject(e),delete this._items[i]),Promise.resolve()}$input(i,e,t){let o=Object.create(null);return i&&(o.title=i.title,o.password=i.password,o.placeHolder=i.placeHolder,o.valueSelection=i.valueSelection,o.prompt=i.prompt,o.value=i.value,o.ignoreFocusLost=i.ignoreFocusOut),e&&(o.validateInput=n=>this._proxy.$validateInput(n)),this._quickInputService.input(o,t)}$createOrUpdate(i){let e=i.id,t=this.sessions.get(e);if(!t){let s=new P,l=i.type==="quickPick"?this._quickInputService.createQuickPick():this._quickInputService.createInputBox();if(s.add(l),s.add(l.onDidAccept(()=>{this._proxy.$onDidAccept(e)})),s.add(l.onDidTriggerButton(c=>{this._proxy.$onDidTriggerButton(e,c.handle,c.toggle?.checked)})),s.add(l.onDidChangeValue(c=>{this._proxy.$onDidChangeValue(e,c)})),s.add(l.onDidHide(()=>{this._proxy.$onDidHide(e)})),i.type==="quickPick"){let c=l;s.add(c.onDidChangeActive(u=>{this._proxy.$onDidChangeActive(e,u.map(p=>p.handle))})),s.add(c.onDidChangeSelection(u=>{this._proxy.$onDidChangeSelection(e,u.map(p=>p.handle))})),s.add(c.onDidTriggerItemButton(u=>{let p=u.button;this._proxy.$onDidTriggerItemButton(e,u.item.handle,p.handle,p.toggle?.checked)}))}t={input:l,handlesToItems:new Map,store:s},this.sessions.set(e,t)}let{input:o,handlesToItems:n}=t,r=o;for(let s in i)switch(s){case"id":case"type":continue;case"visible":i.visible?o.show():o.hide();break;case"items":{n.clear(),i.items?.forEach(l=>{this.expandItemProps(l),l.type!=="separator"&&(l.buttons?.forEach(c=>this.expandIconPath(c)),n.set(l.handle,l))}),r.items=i.items;break}case"activeItems":r.activeItems=i.activeItems?.map(l=>n.get(l)).filter(Boolean);break;case"selectedItems":r.selectedItems=i.selectedItems?.map(l=>n.get(l)).filter(Boolean);break;case"buttons":{let l=[];for(let c of i.buttons)c.handle===-1?l.push(this._quickInputService.backButton):(this.expandIconPath(c),l.push(c));o.buttons=l;break}default:o[s]=i[s];break}return Promise.resolve(void 0)}$dispose(i){let e=this.sessions.get(i);return e&&(e.store.dispose(),this.sessions.delete(i)),Promise.resolve(void 0)}expandItemProps(i){if(i.type==="separator")return;if(!i.resourceUri){this.expandIconPath(i);return}let e=A.from(i.resourceUri);i.label??=this.customEditorLabelService.getName(e)||"",i.label?i.description??=this.labelService.getUriLabel(e,{relative:!0}):(i.label=Ra(e),i.description??=this.labelService.getUriLabel(ci(e),{relative:!0}));let t=i.iconPathDto;if(q.isThemeIcon(t)&&(q.isFile(t)||q.isFolder(t))){let o=q.isFolder(t)||Tre(e)?1:0,n=new co(()=>js(this.modelService,this.languageService,e,o));Object.defineProperty(i,"iconClasses",{get:()=>n.value})}else this.expandIconPath(i)}expandIconPath(i){let e=i.iconPathDto;if(e)if(q.isThemeIcon(e))i.iconClass=q.asClassName(e);else if(oh(e)){let t=A.from(e);i.iconPath={dark:t,light:t}}else{let{dark:t,light:o}=e;i.iconPath={dark:A.from(t),light:A.from(o)}}else return}};fLt=I([vo(Gi.MainThreadQuickOpen),m(1,Ge),m(2,ot),m(3,Sv),m(4,Ct),m(5,kt)],fLt);var vLt=class extends C{constructor(e,t,o){super();this._environmentService=t;this._proxy=e.getProxy(Zi.ExtHostExtensionService);let n=this._environmentService.remoteAuthority;n&&this._register(o.onDidChangeConnectionData(()=>{let r=o.getConnectionData(n);r&&this._proxy.$updateRemoteConnectionData(r)}))}};vLt=I([QL,m(1,Vt),m(2,Mc)],vLt);var dmi=class{constructor(i){this._proxy=i.getProxy(Zi.ExtHostDocumentSaveParticipant)}async participate(i,e,t,o){if(!i.textEditorModel||!hx(i.textEditorModel))return;let n=new Promise((r,s)=>{setTimeout(()=>s(new Error(d(3058,null))),1750),this._proxy.$participateInSave(i.resource,e.reason).then(l=>{if(!l.every(c=>c))return Promise.reject(new Error("listener failed"))}).then(r,s)});return pm(n,o)}},bLt=class{constructor(i,e,t){this._textFileService=t;this._saveParticipantDisposable=this._textFileService.files.addSaveParticipant(e.createInstance(dmi,i))}dispose(){this._saveParticipantDisposable.dispose()}};bLt=I([QL,m(1,F),m(2,Ho)],bLt);var EC=ae("speechService"),TV=new Q("hasSpeechProvider",!1,{type:"boolean",description:d(13572,null)}),TX=new Q("speechToTextInProgress",!1,{type:"boolean",description:d(13599,null)}),SLt=new Q("textToSpeechInProgress",!1,{type:"boolean",description:d(13600,null)});var umi="accessibility.voice.speechLanguage",pmi={"da-DK":{name:d(13573,null)},"de-DE":{name:d(13574,null)},"en-AU":{name:d(13575,null)},"en-CA":{name:d(13576,null)},"en-GB":{name:d(13577,null)},"en-IE":{name:d(13578,null)},"en-IN":{name:d(13579,null)},"en-NZ":{name:d(13580,null)},"en-US":{name:d(13581,null)},"es-ES":{name:d(13582,null)},"es-MX":{name:d(13583,null)},"fr-CA":{name:d(13584,null)},"fr-FR":{name:d(13585,null)},"hi-IN":{name:d(13586,null)},"it-IT":{name:d(13587,null)},"ja-JP":{name:d(13588,null)},"ko-KR":{name:d(13589,null)},"nl-NL":{name:d(13590,null)},"pt-PT":{name:d(13592,null)},"pt-BR":{name:d(13591,null)},"ru-RU":{name:d(13593,null)},"sv-SE":{name:d(13594,null)},"tr-TR":{name:d(13595,null)},"zh-CN":{name:d(13596,null)},"zh-HK":{name:d(13597,null)},"zh-TW":{name:d(13598,null)}};function ILt(a,i=Dr){if(typeof a=="string"){if(a==="auto"){if(i!=="en"){let e=i.split("-");return ILt(`${e[0]}-${(e[1]??e[0]).toUpperCase()}`)}}else if(pmi[a])return a}return"en-US"}var yLt=class{constructor(i,e,t){this.speechService=e;this.logService=t;this.providerRegistrations=new Map;this.speechToTextSessions=new Map;this.textToSpeechSessions=new Map;this.keywordRecognitionSessions=new Map;this.proxy=i.getProxy(Zi.ExtHostSpeech)}$registerProvider(i,e,t){this.logService.trace("[Speech] extension registered provider",t.extension.value);let o=this.speechService.registerSpeechProvider(e,{metadata:t,createSpeechToTextSession:(n,r)=>{if(n.isCancellationRequested)return{onDidChange:H.None};let s=new P,l=Math.random();this.proxy.$createSpeechToTextSession(i,l,r?.language);let c=s.add(new E);return this.speechToTextSessions.set(l,{onDidChange:c}),s.add(n.onCancellationRequested(()=>{this.proxy.$cancelSpeechToTextSession(l),this.speechToTextSessions.delete(l),s.dispose()})),{onDidChange:c.event}},createTextToSpeechSession:(n,r)=>{if(n.isCancellationRequested)return{onDidChange:H.None,synthesize:async()=>{}};let s=new P,l=Math.random();this.proxy.$createTextToSpeechSession(i,l,r?.language);let c=s.add(new E);return this.textToSpeechSessions.set(l,{onDidChange:c}),s.add(n.onCancellationRequested(()=>{this.proxy.$cancelTextToSpeechSession(l),this.textToSpeechSessions.delete(l),s.dispose()})),{onDidChange:c.event,synthesize:async u=>{await this.proxy.$synthesizeSpeech(l,u);let p=new P;try{await wa(H.toPromise(H.filter(c.event,h=>h.status===2,p),p),n)}finally{p.dispose()}}}},createKeywordRecognitionSession:n=>{if(n.isCancellationRequested)return{onDidChange:H.None};let r=new P,s=Math.random();this.proxy.$createKeywordRecognitionSession(i,s);let l=r.add(new E);return this.keywordRecognitionSessions.set(s,{onDidChange:l}),r.add(n.onCancellationRequested(()=>{this.proxy.$cancelKeywordRecognitionSession(s),this.keywordRecognitionSessions.delete(s),r.dispose()})),{onDidChange:l.event}}});this.providerRegistrations.set(i,{dispose:()=>{o.dispose()}})}$unregisterProvider(i){let e=this.providerRegistrations.get(i);e&&(e.dispose(),this.providerRegistrations.delete(i))}$emitSpeechToTextEvent(i,e){this.speechToTextSessions.get(i)?.onDidChange.fire(e)}$emitTextToSpeechEvent(i,e){this.textToSpeechSessions.get(i)?.onDidChange.fire(e)}$emitKeywordRecognitionEvent(i,e){this.keywordRecognitionSessions.get(i)?.onDidChange.fire(e)}dispose(){this.providerRegistrations.forEach(i=>i.dispose()),this.providerRegistrations.clear(),this.speechToTextSessions.forEach(i=>i.onDidChange.dispose()),this.speechToTextSessions.clear(),this.textToSpeechSessions.forEach(i=>i.onDidChange.dispose()),this.textToSpeechSessions.clear(),this.keywordRecognitionSessions.forEach(i=>i.onDidChange.dispose()),this.keywordRecognitionSessions.clear()}};yLt=I([vo(Gi.MainThreadSpeech),m(1,EC),m(2,ne)],yLt);var Wz=ae("editSessionIdentityService");var mmi=class{constructor(i){this.timeout=2e4;this._proxy=i.getProxy(Zi.ExtHostWorkspace)}async participate(i,e){let t=new Promise((o,n)=>{setTimeout(()=>n(new Error(d(3009,null))),this.timeout),this._proxy.$onWillCreateEditSessionIdentity(i.uri,e,this.timeout).then(o,n)});return pm(t,e)}},wLt=class{constructor(i,e,t){this._editSessionIdentityService=t;this._saveParticipantDisposable=this._editSessionIdentityService.addEditSessionIdentityCreateParticipant(e.createInstance(mmi,i))}dispose(){this._saveParticipantDisposable.dispose()}};wLt=I([QL,m(1,F),m(2,Wz)],wLt);var yEe=class{constructor(i,e,t,o=void 0,n=void 0){this.uri=i;this.relativePath=e;this.context=t;this.element=o;this.parent=n;this._children=new Map}get childrenCount(){return this._children.size}get children(){return this._children.values()}get name(){return Lo.basename(this.relativePath)}get(i){return this._children.get(i)}set(i,e){this._children.set(i,e)}delete(i){this._children.delete(i)}clear(){this._children.clear()}};I([mi],yEe.prototype,"name",1);function reo(a,i){typeof a.element<"u"&&i.push(a.element);for(let e of a.children)reo(e,i);return i}var Xp=class{constructor(i,e=A.file("/"),t=ar){this.extUri=t;this.root=new yEe(e,"",i)}static getRoot(i){for(;i.parent;)i=i.parent;return i}static collect(i){return reo(i,[])}static isResourceNode(i){return i instanceof yEe}add(i,e){let t=this.extUri.relativePath(this.root.uri,i)||i.path,o=new b9(!1).reset(t),n=this.root,r="";for(;;){let s=o.value();r=r+"/"+s;let l=n.get(s);if(l?o.hasNext()||(l.element=e):(l=new yEe(this.extUri.joinPath(this.root.uri,r),r,this.root.context,o.hasNext()?void 0:e,n),n.set(s,l)),n=l,!o.hasNext())return;o.next()}}delete(i){let e=this.extUri.relativePath(this.root.uri,i)||i.path,t=new b9(!1).reset(e);return this._delete(this.root,t)}_delete(i,e){let t=e.value(),o=i.get(t);if(o){if(e.hasNext()){let n=this._delete(o,e.next());return typeof n<"u"&&o.childrenCount===0&&i.delete(t),n}return i.delete(t),o.element}}clear(){this.root.clear()}getNode(i){let e=this.extUri.relativePath(this.root.uri,i)||i.path,t=new b9(!1).reset(e),o=this.root;for(;;){let n=t.value(),r=o.get(n);if(!r||!t.hasNext())return r;o=r,t.next()}}};var JO="scm-graph-incoming-changes",_X="scm-graph-outgoing-changes";var RP=22,vh=11,gde=5,I5=4,DX=2,vde=J("scmGraph.historyItemRefColor",B$e,d(13070,null)),V6e=J("scmGraph.historyItemRemoteRefColor",cgt,d(13071,null)),aeo=J("scmGraph.historyItemBaseRefColor","#EA5C00",d(13066,null)),ZKo=J("scmGraph.historyItemHoverDefaultLabelForeground",ko,d(13068,null)),gmi=J("scmGraph.historyItemHoverDefaultLabelBackground",rv,d(13067,null)),fmi=J("scmGraph.historyItemHoverLabelForeground",jS,d(13069,null)),W8a=J("scmGraph.historyItemHoverAdditionsForeground",{light:"#587C0C",dark:"#81B88B",hcDark:"#A1E3AD",hcLight:"#374E06"},d(13059,null)),V8a=J("scmGraph.historyItemHoverDeletionsForeground",{light:"#AD0707",dark:"#C74E39",hcDark:"#C74E39",hcLight:"#AD0707"},d(13060,null)),seo=[J("scmGraph.foreground1","#FFB000",d(13061,null)),J("scmGraph.foreground2","#DC267F",d(13062,null)),J("scmGraph.foreground3","#994F00",d(13063,null)),J("scmGraph.foreground4","#40B0A6",d(13064,null)),J("scmGraph.foreground5","#B66DFF",d(13065,null))];function hmi(a,i){if(a.id===JO)return V6e;if(a.id===_X)return vde;for(let e of a.references??[]){let t=i.get(e.id);if(t!==void 0)return t}}function CLt(a,i=1){let e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttribute("fill","none"),e.setAttribute("stroke-width",`${i}px`),e.setAttribute("stroke-linecap","round"),e.style.stroke=wt(a),e}function fde(a,i,e,t){let o=document.createElementNS("http://www.w3.org/2000/svg","circle");return o.setAttribute("cx",`${vh*(a+1)}`),o.setAttribute("cy",`${vh}`),o.setAttribute("r",`${i}`),o.style.strokeWidth=`${e}px`,t&&(o.style.fill=wt(t)),o}function e2o(a,i,e,t){let o=document.createElementNS("http://www.w3.org/2000/svg","circle");return o.setAttribute("cx",`${vh*(a+1)}`),o.setAttribute("cy",`${vh}`),o.setAttribute("r",`${I5+1}`),o.style.stroke=wt(t),o.style.strokeWidth=`${e}px`,o.style.strokeDasharray="4,2",o}function xLt(a,i,e,t,o=1){let n=CLt(t,o);return n.setAttribute("d",`M ${a} ${i} V ${e}`),n}function t2o(a,i){for(let e=a.length-1;e>=0;e--)if(a[e].id===i)return e;return-1}function leo(a){let i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.classList.add("graph");let e=a.historyItem,t=a.inputSwimlanes,o=a.outputSwimlanes,n=t.findIndex(c=>c.id===e.id),r=n!==-1?n:t.length,s=r<o.length?o[r].color:r<t.length?t[r].color:vde,l=0;for(let c=0;c<t.length;c++){let u=t[c].color;if(t[c].id===e.id)if(c!==r){let p=[],h=CLt(u);p.push(`M ${vh*(c+1)} 0`),p.push(`A ${vh} ${vh} 0 0 1 ${vh*c} ${vh}`),p.push(`H ${vh*(r+1)}`),h.setAttribute("d",p.join(" ")),i.append(h)}else l++;else if(l<o.length&&t[c].id===o[l].id){if(c===l){let p=xLt(vh*(c+1),0,RP,u);i.append(p)}else{let p=[],h=CLt(u);p.push(`M ${vh*(c+1)} 0`),p.push("V 6"),p.push(`A ${gde} ${gde} 0 0 1 ${vh*(c+1)-gde} ${RP/2}`),p.push(`H ${vh*(l+1)+gde}`),p.push(`A ${gde} ${gde} 0 0 0 ${vh*(l+1)} ${RP/2+gde}`),p.push(`V ${RP}`),h.setAttribute("d",p.join(" ")),i.append(h)}l++}}for(let c=1;c<e.parentIds.length;c++){let u=t2o(o,e.parentIds[c]);if(u===-1)continue;let p=[],h=CLt(o[u].color);p.push(`M ${vh*u} ${RP/2}`),p.push(`A ${vh} ${vh} 0 0 1 ${vh*(u+1)} ${RP}`),p.push(`M ${vh*u} ${RP/2}`),p.push(`H ${vh*(r+1)} `),h.setAttribute("d",p.join(" ")),i.append(h)}if(n!==-1){let c=xLt(vh*(r+1),0,RP/2,t[n].color);i.append(c)}if(e.parentIds.length>0){let c=xLt(vh*(r+1),RP/2,RP,s);i.append(c)}if(a.kind==="HEAD"){let c=fde(r,I5+3,DX,s);i.append(c);let u=fde(r,DX,I5);i.append(u)}else if(a.kind==="incoming-changes"||a.kind==="outgoing-changes"){let c=fde(r,I5+3,DX,s);i.append(c);let u=fde(r,I5+1,DX+1);i.append(u);let p=e2o(r,I5+1,DX-1,s);i.append(p)}else if(e.parentIds.length>1){let c=fde(r,I5+2,DX,s);i.append(c);let u=fde(r,I5-1,DX,s);i.append(u)}else{let c=fde(r,I5+1,DX,s);i.append(c)}return i.style.height=`${RP}px`,i.style.width=`${vh*(Math.max(t.length,o.length,1)+1)}px`,i}function vmi(a,i){let e=Wzi("svg",{style:{height:`${RP}px`,width:`${vh*(a.length+1)}px`}});for(let t=0;t<a.length;t++){let o=t===i?3:1,n=xLt(vh*(t+1),0,RP,a[t].color,o);e.root.append(n)}return e.root}function ceo(a,i=new Map,e,t,o,n,r,s){let l=-1,c=[];for(let u=0;u<a.length;u++){let p=a[u],h=p.id===e?.revision?"HEAD":"node",f=(c.at(-1)?.outputSwimlanes??[]).map(y=>Xi(y)),v=[],b=!1;if(p.parentIds.length>0)for(let y of f){if(y.id===p.id){b||(v.push({id:p.parentIds[0],color:hmi(p,i)??y.color}),b=!0);continue}v.push(Xi(y))}for(let y=b?1:0;y<p.parentIds.length;y++){let w;if(y===0)w=hmi(p,i);else{let k=a.find(T=>T.id===p.parentIds[y]);w=k?hmi(k,i):void 0}w||(l=Y0(l+1,seo.length),w=seo[l]),v.push({id:p.parentIds[y],color:w})}let S=(p.references??[]).map(y=>{let w=i.get(y.id);if(i.has(y.id)&&w===void 0){let k=f.findIndex(N=>N.id===p.id),T=k!==-1?k:f.length;w=T<v.length?v[T].color:T<f.length?f[T].color:vde}return{...y,color:w}});S.sort((y,w)=>o2o(y,w,e,t,o)),c.push({historyItem:{...p,references:S},kind:h,inputSwimlanes:f,outputSwimlanes:v})}return i2o(c,e,t,n,r,s),c}function deo(a){let i=a.historyItem,e=a.inputSwimlanes,t=e.findIndex(o=>o.id===i.id);return t!==-1?t:e.length}function i2o(a,i,e,t,o,n){if(i?.revision!==e?.revision&&n){if(t&&e&&e.revision!==n){let r=Jve(a,l=>l.outputSwimlanes.some(c=>c.id===n)),s=a.findIndex(l=>l.historyItem.id===n);if(r!==-1&&s!==-1&&!(a[r].historyItem.parentIds.length===2&&a[r].historyItem.parentIds.includes(n))){a[r]={...a[r],inputSwimlanes:a[r].inputSwimlanes.map(g=>g.id===n&&g.color===V6e?{...g,id:JO}:g),outputSwimlanes:a[r].outputSwimlanes.map(g=>g.id===n&&g.color===V6e?{...g,id:JO}:g)};let c=a[r].outputSwimlanes.map(g=>Xi(g)),u=a[s].inputSwimlanes.map(g=>Xi(g)),p=a[0].historyItem.displayId?.length??0,h={id:JO,displayId:"0".repeat(p),parentIds:[n],author:e?.name,subject:d(13057,null),message:""};a.splice(s,0,{historyItem:h,kind:"incoming-changes",inputSwimlanes:c,outputSwimlanes:u})}}if(o&&i?.revision&&i.revision!==n){let r=a.findIndex(s=>s.kind==="HEAD"&&s.historyItem.id===i.revision);if(r!==-1){let s={id:_X,displayId:a[0].historyItem.displayId?"0".repeat(a[0].historyItem.displayId.length):void 0,parentIds:[i.revision],author:i?.name,subject:d(13058,null),message:""},l=a[r].inputSwimlanes.slice(0),c=l.slice(0).concat({id:i.revision,color:vde});a.splice(r,0,{historyItem:s,kind:"outgoing-changes",inputSwimlanes:l,outputSwimlanes:c}),a[r+1].inputSwimlanes.push({id:i.revision,color:vde})}}}}function o2o(a,i,e,t,o){let n=l=>l.id===e?.id?1:l.id===t?.id?2:l.id===o?.id?3:l.color!==void 0?4:99,r=n(a),s=n(i);return r-s}function B6e(a,i,e){let t=new P;if(i.tooltip===void 0)return{content:i.message,disposables:t};if(Mr(i.tooltip))return{content:i.tooltip,disposables:t};let o=i.tooltip.slice();if(e&&i.references?.length){let r=new xe("",{supportHtml:!0,supportThemeIcons:!0});for(let s of i.references){let l=q.isThemeIcon(s.icon)?s.icon.id:"",c=s.color?wt(s.color):wt(gmi),u=s.color?wt(fmi):wt(ZKo);r.appendMarkdown(`<span style="color:${u};background-color:${c};border-radius:10px;"> $(${l}) `),r.appendText(s.name),r.appendMarkdown(" </span>")}r.appendMarkdown(`
---
`),o.splice(o.length-1,0,r)}let n=_(".history-item-hover-container");for(let r of o){if(yW(r))continue;let s=a.render(r);n.appendChild(s.element),t.add(s)}return{content:n,disposables:t}}function bde(a){if(a!==void 0){if(q.isThemeIcon(a))return a;if(oh(a))return A.revive(a);{let i=a;return{light:A.revive(i.light),dark:A.revive(i.dark)}}}}function ueo(a){let i=bde(a.authorIcon),e=a.references?.map(t=>({...t,icon:bde(t.icon)}));return{...a,authorIcon:i,references:e}}function wEe(a,i){return a?{...a,icon:bde(a.icon),color:i}:void 0}var bmi=class extends C{constructor(e,t,o){super();this.modelService=t;this.languageService=o;this._register(e.registerTextModelContentProvider(Y.vscodeSourceControl,this))}async provideTextContent(e){let t=this.modelService.getModel(e);return t||this.modelService.createModel("",this.languageService.createById("scminput"),e)}},Smi=class{constructor(i,e,t,o,n,r,s,l){this.sourceControlHandle=i;this.handle=e;this.provider=t;this.features=o;this.label=n;this.id=r;this.multiDiffEditorEnableViewChanges=s;this._uriIdentService=l;this.resources=[];this._onDidChange=new E;this.onDidChange=this._onDidChange.event;this._onDidChangeResources=new E;this.onDidChangeResources=this._onDidChangeResources.event}get resourceTree(){if(!this._resourceTree){let i=this.provider.rootUri??A.file("/");this._resourceTree=new Xp(this,i,this._uriIdentService.extUri);for(let e of this.resources)this._resourceTree.add(e.sourceUri,e)}return this._resourceTree}get hideWhenEmpty(){return!!this.features.hideWhenEmpty}get contextValue(){return this.features.contextValue}toJSON(){return{$mid:4,sourceControlHandle:this.sourceControlHandle,groupHandle:this.handle}}splice(i,e,t){this.resources.splice(i,e,...t),this._resourceTree=void 0,this._onDidChangeResources.fire()}$updateGroup(i){this.features={...this.features,...i},this._onDidChange.fire()}$updateGroupLabel(i){this.label=i,this._onDidChange.fire()}},Imi=class{constructor(i,e,t,o,n,r,s,l,c,u,p){this.proxy=i;this.sourceControlHandle=e;this.groupHandle=t;this.handle=o;this.sourceUri=n;this.resourceGroup=r;this.decorations=s;this.contextValue=l;this.command=c;this.multiDiffEditorOriginalUri=u;this.multiDiffEditorModifiedUri=p}open(i){return this.proxy.$executeResourceCommand(this.sourceControlHandle,this.groupHandle,this.handle,i)}toJSON(){return{$mid:3,sourceControlHandle:this.sourceControlHandle,groupHandle:this.groupHandle,handle:this.handle}}},ymi=class{constructor(i,e){this.proxy=i;this.handle=e;this._onDidChangeArtifacts=new E;this.onDidChangeArtifacts=this._onDidChangeArtifacts.event;this._disposables=new P;this._disposables.add(this._onDidChangeArtifacts)}async provideArtifactGroups(i){return(await this.proxy.$provideArtifactGroups(this.handle,i??ve.None))?.map(t=>({...t,icon:bde(t.icon)}))}async provideArtifacts(i,e){return(await this.proxy.$provideArtifacts(this.handle,i,e??ve.None))?.map(o=>({...o,icon:bde(o.icon)}))}$onDidChangeArtifacts(i){this._onDidChangeArtifacts.fire(i)}dispose(){this._disposables.dispose()}},wmi=class{constructor(i,e){this.proxy=i;this.handle=e;this._historyItemRef=rg({owner:this,equalsFn:VT},void 0);this._historyItemRemoteRef=rg({owner:this,equalsFn:VT},void 0);this._historyItemBaseRef=rg({owner:this,equalsFn:VT},void 0);this._historyItemRefChanges=Le(this,{added:[],modified:[],removed:[],silent:!1})}get historyItemRef(){return this._historyItemRef}get historyItemRemoteRef(){return this._historyItemRemoteRef}get historyItemBaseRef(){return this._historyItemBaseRef}get historyItemRefChanges(){return this._historyItemRefChanges}async resolveHistoryItem(i,e){let t=await this.proxy.$resolveHistoryItem(this.handle,i,e??ve.None);return t?ueo(t):void 0}async resolveHistoryItemChatContext(i,e){return this.proxy.$resolveHistoryItemChatContext(this.handle,i,e??ve.None)}async resolveHistoryItemChangeRangeChatContext(i,e,t,o){return this.proxy.$resolveHistoryItemChangeRangeChatContext(this.handle,i,e,t,o??ve.None)}async resolveHistoryItemRefsCommonAncestor(i,e){return this.proxy.$resolveHistoryItemRefsCommonAncestor(this.handle,i,e??ve.None)}async provideHistoryItemRefs(i,e){return(await this.proxy.$provideHistoryItemRefs(this.handle,i,e??ve.None))?.map(o=>({...o,icon:bde(o.icon)}))}async provideHistoryItems(i,e){return(await this.proxy.$provideHistoryItems(this.handle,i,e??ve.None))?.map(o=>ueo(o))}async provideHistoryItemChanges(i,e,t){return(await this.proxy.$provideHistoryItemChanges(this.handle,i,e,t??ve.None))?.map(n=>({uri:A.revive(n.uri),originalUri:n.originalUri&&A.revive(n.originalUri),modifiedUri:n.modifiedUri&&A.revive(n.modifiedUri)}))}$onDidChangeCurrentHistoryItemRefs(i,e,t){Ui(o=>{this._historyItemRef.set(wEe(i,vde),o),this._historyItemRemoteRef.set(wEe(e,V6e),o),this._historyItemBaseRef.set(wEe(t,aeo),o)})}$onDidChangeHistoryItemRefs(i){let e=i.added.map(n=>wEe(n)),t=i.modified.map(n=>wEe(n)),o=i.removed.map(n=>wEe(n));this._historyItemRefChanges.set({added:e,modified:t,removed:o,silent:i.silent},void 0)}},Cmi=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h){this.proxy=i;this._handle=e;this._parentHandle=t;this._providerId=o;this._label=n;this._rootUri=r;this._iconPath=s;this._isHidden=l;this._inputBoxTextModel=c;this._quickDiffService=u;this._uriIdentService=p;this._workspaceContextService=h;this.groups=[];this._onDidChangeResourceGroups=new E;this.onDidChangeResourceGroups=this._onDidChangeResourceGroups.event;this._onDidChangeResources=new E;this.onDidChangeResources=this._onDidChangeResources.event;this._groupsByHandle=Object.create(null);this.features={};this._contextValue=Le(this,void 0);this._count=Le(this,void 0);this._statusBarCommands=Le(this,void 0);this._commitTemplate=Le(this,"");this._actionButton=Le(this,void 0);this._artifactProvider=Le(this,void 0);this._historyProvider=Le(this,void 0);if(r){let g=this._workspaceContextService.getWorkspaceFolder(r);g?.uri.toString()===r.toString()?this._name=g.name:r.path!=="/"&&(this._name=Ye(r))}}get id(){return`scm${this._handle}`}get parentId(){return this._parentHandle!==void 0?`scm${this._parentHandle}`:void 0}get providerId(){return this._providerId}get handle(){return this._handle}get label(){return this._label}get rootUri(){return this._rootUri}get iconPath(){return this._iconPath}get isHidden(){return this._isHidden}get inputBoxTextModel(){return this._inputBoxTextModel}get contextValue(){return this._contextValue}get acceptInputCommand(){return this.features.acceptInputCommand}get count(){return this._count}get statusBarCommands(){return this._statusBarCommands}get name(){return this._name??this._label}get commitTemplate(){return this._commitTemplate}get actionButton(){return this._actionButton}get artifactProvider(){return this._artifactProvider}get historyProvider(){return this._historyProvider}$updateSourceControl(i){if(this.features={...this.features,...i},typeof i.commitTemplate<"u"&&this._commitTemplate.set(i.commitTemplate,void 0),typeof i.actionButton<"u"&&this._actionButton.set(i.actionButton??void 0,void 0),typeof i.contextValue<"u"&&this._contextValue.set(i.contextValue,void 0),typeof i.count<"u"&&this._count.set(i.count,void 0),typeof i.statusBarCommands<"u"&&this._statusBarCommands.set(i.statusBarCommands,void 0),i.hasQuickDiffProvider&&!this._quickDiff?this._quickDiff=this._quickDiffService.addQuickDiffProvider({id:`${this._providerId}.quickDiffProvider`,label:i.quickDiffLabel??this.label,rootUri:this.rootUri,kind:"primary",getOriginalResource:async e=>{if(!this.features.hasQuickDiffProvider)return null;let t=await this.proxy.$provideOriginalResource(this.handle,e,ve.None);return t&&A.revive(t)}}):i.hasQuickDiffProvider===!1&&this._quickDiff&&(this._quickDiff.dispose(),this._quickDiff=void 0),i.hasSecondaryQuickDiffProvider&&!this._stagedQuickDiff?this._stagedQuickDiff=this._quickDiffService.addQuickDiffProvider({id:`${this._providerId}.secondaryQuickDiffProvider`,label:i.secondaryQuickDiffLabel??this.label,rootUri:this.rootUri,kind:"secondary",getOriginalResource:async e=>{if(!this.features.hasSecondaryQuickDiffProvider)return null;let t=await this.proxy.$provideSecondaryOriginalResource(this.handle,e,ve.None);return t&&A.revive(t)}}):i.hasSecondaryQuickDiffProvider===!1&&this._stagedQuickDiff&&(this._stagedQuickDiff.dispose(),this._stagedQuickDiff=void 0),i.hasArtifactProvider&&!this.artifactProvider.get()){let e=new ymi(this.proxy,this.handle);this._artifactProvider.set(e,void 0)}else i.hasArtifactProvider===!1&&this.artifactProvider.get()&&(this._artifactProvider.get()?.dispose(),this._artifactProvider.set(void 0,void 0));if(i.hasHistoryProvider&&!this.historyProvider.get()){let e=new wmi(this.proxy,this.handle);this._historyProvider.set(e,void 0)}else i.hasHistoryProvider===!1&&this.historyProvider.get()&&this._historyProvider.set(void 0,void 0)}$registerGroups(i){let e=i.map(([t,o,n,r,s])=>{let l=new Smi(this.handle,t,this,r,n,o,s,this._uriIdentService);return this._groupsByHandle[t]=l,l});this.groups.splice(this.groups.length,0,...e),this._onDidChangeResourceGroups.fire()}$updateGroup(i,e){let t=this._groupsByHandle[i];t&&t.$updateGroup(e)}$updateGroupLabel(i,e){let t=this._groupsByHandle[i];t&&t.$updateGroupLabel(e)}$spliceGroupResourceStates(i){for(let[e,t]of i){let o=this._groupsByHandle[e];if(!o){console.warn(`SCM group ${e} not found in provider ${this.label}`);continue}t.reverse();for(let[n,r,s]of t){let l=s.map(c=>{let[u,p,h,g,f,v,b,S,y,w]=c,[k,T]=h,N=q.isThemeIcon(k)?k:A.revive(k),O=(q.isThemeIcon(T)?T:A.revive(T))||N,V={icon:N,iconDark:O,tooltip:g,strikeThrough:f,faded:v};return new Imi(this.proxy,this.handle,e,u,A.revive(p),o,V,b||void 0,S,A.revive(y),A.revive(w))});o.splice(n,r,l)}}this._onDidChangeResources.fire()}$unregisterGroup(i){let e=this._groupsByHandle[i];e&&(delete this._groupsByHandle[i],this.groups.splice(this.groups.indexOf(e),1),this._onDidChangeResourceGroups.fire())}async getOriginalResource(i){if(!this.features.hasQuickDiffProvider)return null;let e=await this.proxy.$provideOriginalResource(this.handle,i,ve.None);return e&&A.revive(e)}$onDidChangeHistoryProviderCurrentHistoryItemRefs(i,e,t){let o=this.historyProvider.get();o&&o.$onDidChangeCurrentHistoryItemRefs(i,e,t)}$onDidChangeHistoryProviderHistoryItemRefs(i){let e=this.historyProvider.get();e&&e.$onDidChangeHistoryItemRefs(i)}$onDidChangeArtifacts(i){let e=this.artifactProvider.get();e&&e.$onDidChangeArtifacts(i)}toJSON(){return{$mid:5,handle:this.handle}}dispose(){this._onDidChangeResourceGroups.dispose(),this._onDidChangeResources.dispose(),this._artifactProvider.get()?.dispose(),this._stagedQuickDiff?.dispose(),this._quickDiff?.dispose()}},kLt=class{constructor(i,e,t,o,n,r,s,l,c){this.scmService=e;this.scmViewService=t;this.languageService=o;this.modelService=n;this.textModelService=r;this.quickDiffService=s;this._uriIdentService=l;this.workspaceContextService=c;this._repositories=new Map;this._repositoryBarriers=new Map;this._repositoryDisposables=new Map;this._disposables=new P;this._proxy=i.getProxy(Zi.ExtHostSCM),this._disposables.add(new bmi(this.textModelService,this.modelService,this.languageService))}dispose(){Ue(this._repositories.values()),this._repositories.clear(),Ue(this._repositoryDisposables.values()),this._repositoryDisposables.clear(),this._disposables.dispose()}async $registerSourceControl(i,e,t,o,n,r,s,l){this._repositoryBarriers.set(i,new Np);let c=await this.textModelService.createModelReference(A.revive(l)),u=new Cmi(this._proxy,i,e,t,o,n?A.revive(n):void 0,bde(r),s,c.object.textEditorModel,this.quickDiffService,this._uriIdentService,this.workspaceContextService),p=this.scmService.registerSCMProvider(u);this._repositories.set(i,p);let h=hn(c,H.filter(this.scmViewService.onDidFocusRepository,g=>g===p)(g=>this._proxy.$setSelectedSourceControl(i)),p.input.onDidChange(({value:g})=>this._proxy.$onInputBoxValueChange(i,g)));this._repositoryDisposables.set(i,h),this.scmViewService.focusedRepository===p&&setTimeout(()=>this._proxy.$setSelectedSourceControl(i),0),p.input.value&&setTimeout(()=>this._proxy.$onInputBoxValueChange(i,p.input.value),0),this._repositoryBarriers.get(i)?.open()}async $updateSourceControl(i,e){await this._repositoryBarriers.get(i)?.wait();let t=this._repositories.get(i);if(!t)return;t.provider.$updateSourceControl(e)}async $unregisterSourceControl(i){await this._repositoryBarriers.get(i)?.wait();let e=this._repositories.get(i);e&&(this._repositoryDisposables.get(i).dispose(),this._repositoryDisposables.delete(i),e.dispose(),this._repositories.delete(i))}async $registerGroups(i,e,t){await this._repositoryBarriers.get(i)?.wait();let o=this._repositories.get(i);if(!o)return;let n=o.provider;n.$registerGroups(e),n.$spliceGroupResourceStates(t)}async $updateGroup(i,e,t){await this._repositoryBarriers.get(i)?.wait();let o=this._repositories.get(i);if(!o)return;o.provider.$updateGroup(e,t)}async $updateGroupLabel(i,e,t){await this._repositoryBarriers.get(i)?.wait();let o=this._repositories.get(i);if(!o)return;o.provider.$updateGroupLabel(e,t)}async $spliceResourceStates(i,e){await this._repositoryBarriers.get(i)?.wait();let t=this._repositories.get(i);if(!t)return;t.provider.$spliceGroupResourceStates(e)}async $unregisterGroup(i,e){await this._repositoryBarriers.get(i)?.wait();let t=this._repositories.get(i);if(!t)return;t.provider.$unregisterGroup(e)}async $setInputBoxValue(i,e){await this._repositoryBarriers.get(i)?.wait();let t=this._repositories.get(i);t&&t.input.setValue(e,!1)}async $setInputBoxPlaceholder(i,e){await this._repositoryBarriers.get(i)?.wait();let t=this._repositories.get(i);t&&(t.input.placeholder=e)}async $setInputBoxEnablement(i,e){await this._repositoryBarriers.get(i)?.wait();let t=this._repositories.get(i);t&&(t.input.enabled=e)}async $setInputBoxVisibility(i,e){await this._repositoryBarriers.get(i)?.wait();let t=this._repositories.get(i);t&&(t.input.visible=e)}async $showValidationMessage(i,e,t){await this._repositoryBarriers.get(i)?.wait();let o=this._repositories.get(i);o&&o.input.showValidationMessage(e,t)}async $setValidationProviderIsEnabled(i,e){await this._repositoryBarriers.get(i)?.wait();let t=this._repositories.get(i);t&&(e?t.input.validateInput=async(o,n)=>{let r=await this._proxy.$validateInput(i,o,n);return r&&{message:r[0],type:r[1]}}:t.input.validateInput=async()=>{})}async $onDidChangeHistoryProviderCurrentHistoryItemRefs(i,e,t,o){await this._repositoryBarriers.get(i)?.wait();let n=this._repositories.get(i);if(!n)return;n.provider.$onDidChangeHistoryProviderCurrentHistoryItemRefs(e,t,o)}async $onDidChangeHistoryProviderHistoryItemRefs(i,e){await this._repositoryBarriers.get(i)?.wait();let t=this._repositories.get(i);if(!t)return;t.provider.$onDidChangeHistoryProviderHistoryItemRefs(e)}async $onDidChangeArtifacts(i,e){await this._repositoryBarriers.get(i)?.wait();let t=this._repositories.get(i);if(!t)return;t.provider.$onDidChangeArtifacts(e)}};kLt=I([vo(Gi.MainThreadSCM),m(1,$c),m(2,au),m(3,kt),m(4,Ct),m(5,Nt),m(6,OE),m(7,dt),m(8,Pe)],kLt);var xmi="workbench.view.search";var ny="workbench.view.search",Vz="search-result",_Lt="search.exclude",y5=2e4,meo="\u27EA ",heo=" characters skipped \u27EB",n2o=(meo.length+heo.length+5)*2,Jp=ae("searchService");function ZO(a){return!!a.rangeLocations&&!!a.previewText}function kmi(a){return!!a.resource}function DLt(a){return!!a.keyword}function Emi(a){return!!a.message}var ELt=class{constructor(i){this.resource=i;this.results=[]}},LX=class{constructor(i,e,t,o){this.rangeLocations=[];this.webviewIndex=o;let n=Array.isArray(e)?e:[e];if(t&&t.matchLines===1&&r2o(n)){i=h1i(i,t.matchLines);let r="",s=0,l=0,c=Math.floor(t.charsPerLine/5);for(let u of n){let p=Math.max(u.startColumn-c,0),h=u.startColumn+t.charsPerLine;if(p>l+c+n2o){let g=meo+(p-l)+heo;r+=g+i.slice(p,h),s+=p-(l+g.length)}else r+=i.slice(l,h);l=h,this.rangeLocations.push({source:u,preview:new U6e(0,u.startColumn-s,u.endColumn-s)})}this.previewText=r}else{let r=Array.isArray(e)?e[0].startLineNumber:e.startLineNumber,s=uUi(e,l=>({preview:new TLt(l.startLineNumber-r,l.startColumn,l.endLineNumber-r,l.endColumn),source:l}));this.rangeLocations=Array.isArray(s)?s:[s],this.previewText=i}}};function r2o(a){let i=a[0].startLineNumber;for(let e of a)if(e.startLineNumber!==i||e.endLineNumber!==i)return!1;return!0}var TLt=class{constructor(i,e,t,o){this.startLineNumber=i,this.startColumn=e,this.endLineNumber=t,this.endColumn=o}},U6e=class extends TLt{constructor(i,e,t){super(i,e,i,t)}};function MP(a,i=!0){let e=a&&a.files&&a.files.exclude,t=i&&a&&a.search&&a.search.exclude;if(!e&&!t)return;if(!e||!t)return e||t||void 0;let o=Object.create(null);return o=Nu(o,Xi(e)),o=Nu(o,Xi(t),!0),o}function Sde(a,i){let e=a.ignoreGlobCase?{ignoreCase:!0}:void 0;return a.excludePattern&&Cp(a.excludePattern,i,e)?!1:a.includePattern||a.usingSearchPaths?a.includePattern&&Cp(a.includePattern,i,e)?!0:a.usingSearchPaths?!!a.folderQueries&&a.folderQueries.some(t=>{let o=t.folder.fsPath;if(rU(i,o,a.ignoreGlobCase)){let n=SM(o,i);return!t.includePattern||!!Cp(t.includePattern,n,e)}else return!1}):!1:!0}var H6e=class extends Error{constructor(e,t){super(e);this.code=t}};function geo(a){let i=a.message;if(so(a))return new H6e(i,7);try{let e=JSON.parse(i);return new H6e(e.message,e.code)}catch{return new H6e(i,6)}}var Ci={SearchViewVisibleKey:new Q("searchViewletVisible",!0),SearchViewFocusedKey:new Q("searchViewletFocus",!1),SearchResultListFocusedKey:new Q("searchResultListFocused",!0),InputBoxFocusedKey:new Q("inputBoxFocus",!1),SearchInputBoxFocusedKey:new Q("searchInputBoxFocus",!1),ReplaceInputBoxFocusedKey:new Q("replaceInputBoxFocus",!1),PatternIncludesFocusedKey:new Q("patternIncludesInputBoxFocus",!1),PatternExcludesFocusedKey:new Q("patternExcludesInputBoxFocus",!1),ReplaceActiveKey:new Q("replaceActive",!1),HasSearchResults:new Q("hasSearchResult",!1),FirstMatchFocusKey:new Q("firstMatchFocus",!1),FileMatchOrMatchFocusKey:new Q("fileMatchOrMatchFocus",!1),FileMatchOrFolderMatchFocusKey:new Q("fileMatchOrFolderMatchFocus",!1),FileMatchOrFolderMatchWithResourceFocusKey:new Q("fileMatchOrFolderMatchWithResourceFocus",!1),FileFocusKey:new Q("fileMatchFocus",!1),FolderFocusKey:new Q("folderMatchFocus",!1),ResourceFolderFocusKey:new Q("folderMatchWithResourceFocus",!1),IsEditableItemKey:new Q("isEditableItem",!0),MatchFocusKey:new Q("matchFocus",!1),SearchResultHeaderFocused:new Q("searchResultHeaderFocused",!1),ViewHasSearchPatternKey:new Q("viewHasSearchPattern",!1),ViewHasReplacePatternKey:new Q("viewHasReplacePattern",!1),ViewHasFilePatternKey:new Q("viewHasFilePattern",!1),ViewHasSomeCollapsibleKey:new Q("viewHasSomeCollapsibleResult",!1),InTreeViewKey:new Q("inTreeView",!1),hasAIResultProvider:new Q("hasAIResultProviderKey",!1),AIResultsTitle:new Q("aiResultsTitle",!1),AIResultsRequested:new Q("aiResultsRequested",!1)};var LLt=class{constructor(i,e,t,o,n){this._searchService=e;this._telemetryService=t;this.contextKeyService=n;this._searchProvider=new Map;this._aiSearchProviderHandles=new Set;this._proxy=i.getProxy(Zi.ExtHostSearch),this._proxy.$enableExtensionHostSearch()}dispose(){this._searchProvider.forEach(i=>i.dispose()),this._searchProvider.clear(),this._aiSearchProviderHandles.clear(),Ci.hasAIResultProvider.bindTo(this.contextKeyService).set(!1)}$registerTextSearchProvider(i,e){this._searchProvider.set(i,new z6e(this._searchService,1,e,i,this._proxy))}$registerAITextSearchProvider(i,e){Ci.hasAIResultProvider.bindTo(this.contextKeyService).set(!0),this._aiSearchProviderHandles.add(i),this._searchProvider.set(i,new z6e(this._searchService,2,e,i,this._proxy))}$registerFileSearchProvider(i,e){this._searchProvider.set(i,new z6e(this._searchService,0,e,i,this._proxy))}$unregisterProvider(i){Ue(this._searchProvider.get(i)),this._searchProvider.delete(i),this._aiSearchProviderHandles.delete(i)&&this._aiSearchProviderHandles.size===0&&Ci.hasAIResultProvider.bindTo(this.contextKeyService).set(!1)}$handleFileMatch(i,e,t){let o=this._searchProvider.get(i);if(!o)throw new Error("Got result for unknown provider");o.handleFindMatch(e,t)}$handleTextMatch(i,e,t){let o=this._searchProvider.get(i);if(!o)throw new Error("Got result for unknown provider");o.handleFindMatch(e,t)}$handleKeywordResult(i,e,t){let o=this._searchProvider.get(i);if(!o)throw new Error("Got result for unknown provider");o.handleKeywordResult(e,t)}$handleTelemetry(i,e){this._telemetryService.publicLog(i,e)}};LLt=I([vo(Gi.MainThreadSearch),m(1,Jp),m(2,Te),m(3,B),m(4,X)],LLt);var Tmi=class a{constructor(i,e=++a._idPool,t=new Map,o=[]){this.progress=i;this.id=e;this.matches=t;this.keywords=o}static{this._idPool=0}addMatch(i){let e=this.matches.get(i.resource.toString());e?e.results&&i.results&&e.results.push(...i.results):this.matches.set(i.resource.toString(),i),this.progress?.(i)}addKeyword(i){this.keywords.push(i),this.progress?.(i)}},z6e=class{constructor(i,e,t,o,n){this._scheme=t;this._handle=o;this._proxy=n;this._registrations=new P;this._searches=new Map;this._registrations.add(i.registerSearchResultProvider(this._scheme,e,this))}async getAIName(){return this.cachedAIName===void 0&&(this.cachedAIName=await this._proxy.$getAIName(this._handle)),this.cachedAIName}dispose(){this._registrations.dispose()}fileSearch(i,e=ve.None){return this.doSearch(i,void 0,e)}textSearch(i,e,t=ve.None){return this.doSearch(i,e,t)}doSearch(i,e,t=ve.None){if(!i.folderQueries.length)throw new Error("Empty folderQueries");let o=new Tmi(e);this._searches.set(o.id,o);let n=this._provideSearchResults(i,o.id,t);return Promise.resolve(n).then(r=>(this._searches.delete(o.id),{results:Array.from(o.matches.values()),aiKeywords:Array.from(o.keywords),stats:r.stats,limitHit:r.limitHit,messages:r.messages}),r=>(this._searches.delete(o.id),Promise.reject(r)))}clearCache(i){return Promise.resolve(this._proxy.$clearCache(i))}handleFindMatch(i,e){let t=this._searches.get(i);t&&e.forEach(o=>{o.results?t.addMatch(Xn(o)):t.addMatch({resource:A.revive(o)})})}handleKeywordResult(i,e){let t=this._searches.get(i);t&&t.addKeyword(e)}_provideSearchResults(i,e,t){switch(i.type){case 1:return this._proxy.$provideFileSearchResults(this._handle,e,i,t);case 2:return this._proxy.$provideTextSearchResults(this._handle,e,i,t);default:return this._proxy.$provideAITextSearchResults(this._handle,e,i,t)}}};var RLt=class extends C{constructor(e,t){super();this.statusbarService=t;this._entryDisposables=this._register(new jt);this._proxy=e.getProxy(Zi.ExtHostStatusBar);let o=[];for(let[r,s]of t.getEntries())o.push(n(r,s));this._proxy.$acceptStaticEntries(o),this._register(t.onDidChange(r=>{r.added&&this._proxy.$acceptStaticEntries([n(r.added[0],r.added[1])])}));function n(r,s){return{entryId:r,name:s.entry.name,text:s.entry.text,tooltip:s.entry.tooltip,command:typeof s.entry.command=="string"?s.entry.command:typeof s.entry.command=="object"?s.entry.command.id:void 0,priority:s.priority,alignLeft:s.alignment===0,accessibilityInformation:s.entry.ariaLabel?{label:s.entry.ariaLabel,role:s.entry.role}:void 0}}}$setEntry(e,t,o,n,r,s,l,c,u,p,h,g,f){let v=l?{markdown:S=>this._proxy.$provideTooltip(e,S),markdownNotSupportedFallback:void 0}:s;if(this.statusbarService.setOrUpdateEntry(e,t,o,n,r,v,c,u,p,h,g,f)===0){let S=Z(()=>this.statusbarService.unsetEntry(e));this._entryDisposables.set(e,S)}}$disposeEntry(e){this._entryDisposables.deleteAndDispose(e)}};RLt=I([vo(Gi.MainThreadStatusBar),m(1,EEt)],RLt);var Hz=ae("IExtensionStorageService"),a2o=/^extensionKeys\/([^.]+\..+)@(\d+\.\d+\.\d+(-.*)?)$/,pw=class extends C{constructor(e,t,o){super();this.storageService=e;this.productService=t;this.logService=o;this._onDidChangeExtensionStorageToSync=this._register(new E);this.onDidChangeExtensionStorageToSync=this._onDidChangeExtensionStorageToSync.event;this.extensionsWithKeysForSync=pw.readAllExtensionsWithKeysForSync(e),this._register(this.storageService.onDidChangeValue(0,void 0,this._store)(n=>this.onDidChangeStorageValue(n)))}static{this.LARGE_STATE_WARNING_THRESHOLD=512*1024}static toKey(e){return`extensionKeys/${jle(e.id)}@${e.version}`}static fromKey(e){let t=a2o.exec(e);if(t&&t[1])return{id:t[1],version:t[2]}}static async removeOutdatedExtensionVersions(e,t){let o=await e.getInstalled(),n=[];for(let[r,s]of pw.readAllExtensionsWithKeysForSync(t)){let l=o.find(c=>Ot(c.identifier,{id:r}))?.manifest.version;for(let c of s)l!==c&&n.push(pw.toKey({id:r,version:c}))}for(let r of n)t.remove(r,0)}static readAllExtensionsWithKeysForSync(e){let t=new Map,o=e.keys(0,1);for(let n of o){let r=pw.fromKey(n);if(r){let s=t.get(r.id.toLowerCase());s||t.set(r.id.toLowerCase(),s=[]),s.push(r.version)}}return t}onDidChangeStorageValue(e){if(this.extensionsWithKeysForSync.has(e.key.toLowerCase())){this._onDidChangeExtensionStorageToSync.fire();return}let t=pw.fromKey(e.key);if(t){if(this.storageService.get(e.key,0)===void 0)this.extensionsWithKeysForSync.delete(t.id.toLowerCase());else{let o=this.extensionsWithKeysForSync.get(t.id.toLowerCase());o||this.extensionsWithKeysForSync.set(t.id.toLowerCase(),o=[]),o.push(t.version),this._onDidChangeExtensionStorageToSync.fire()}return}}getExtensionId(e){if(Ae(e))return e;let t=e.manifest?e.manifest.publisher:e.publisher,o=e.manifest?e.manifest.name:e.name;return Jb(t,o)}getExtensionState(e,t){let o=this.getExtensionId(e),n=this.getExtensionStateRaw(e,t);if(n)try{return JSON.parse(n)}catch(r){this.logService.error(`[mainThreadStorage] unexpected error parsing storage contents (extensionId: ${o}, global: ${t}): ${r}`)}}getExtensionStateRaw(e,t){let o=this.getExtensionId(e),n=this.storageService.get(o,t?0:1);return n&&n?.length>pw.LARGE_STATE_WARNING_THRESHOLD&&this.logService.warn(`[mainThreadStorage] large extension state detected (extensionId: ${o}, global: ${t}): ${n.length/1024}kb. Consider to use 'storageUri' or 'globalStorageUri' to store this data on disk instead.`),n}setExtensionState(e,t,o){let n=this.getExtensionId(e);t===void 0?this.storageService.remove(n,o?0:1):this.storageService.store(n,JSON.stringify(t),o?0:1,1)}setKeysForSync(e,t){this.storageService.store(pw.toKey(e),JSON.stringify(t),0,1)}getKeysForSync(e){let t=this.productService.extensionSyncedKeys?.[e.id.toLowerCase()],o=this.storageService.get(pw.toKey(e),0),n=o?JSON.parse(o):void 0;return n&&t?Uo([...n,...t]):n||t}addToMigrationList(e,t){if(e!==t){let o=this.migrationList.filter(n=>!n.includes(e)&&!n.includes(t));o.push([e,t]),this.migrationList=o}}getSourceExtensionToMigrate(e){let t=this.migrationList.find(([,o])=>e===o);return t?t[0]:void 0}get migrationList(){let e=this.storageService.get("extensionStorage.migrationList",-1,"[]");try{let t=JSON.parse(e);if(Array.isArray(t))return t}catch{}return[]}set migrationList(e){e.length?this.storageService.store("extensionStorage.migrationList",JSON.stringify(e),-1,1):this.storageService.remove("extensionStorage.migrationList",-1)}};pw=I([m(0,le),m(1,nt),m(2,ne)],pw);async function feo(a,i,e,t){return t.invokeFunction(async o=>{let n=o.get(Co),r=o.get(an),s=o.get(Hz),l=o.get(le),c=o.get(dt),u=o.get(be),p=o.get(Pe),h=o.get(ne),g=`extensionStorage.migrate.${a}-${i}`,f=a.toLowerCase()===i.toLowerCase()?`extension.storage.migrateFromLowerCaseKey.${a.toLowerCase()}`:void 0;if(a===i)return;let v=(S,y)=>y?c.extUri.joinPath(r.defaultProfile.globalStorageHome,S.toLowerCase()):c.extUri.joinPath(n.workspaceStorageHome,p.getWorkspace().id,S),b=e?0:1;if(!l.getBoolean(g,b,!1)&&!(f&&l.getBoolean(f,b,!1))){h.info(`Migrating ${e?"global":"workspace"} extension storage from ${a} to ${i}...`);let S=s.getExtensionState(a,e);S&&(s.setExtensionState(i,S,e),s.setExtensionState(a,void 0,e));let y=v(a,e),w=v(i,e);if(!c.extUri.isEqual(y,w))try{await u.move(y,w,!0)}catch(k){k.code!=="EntryNotFound"&&h.info(`Error while migrating ${e?"global":"workspace"} file storage from '${a}' to '${i}'`,Cn(k))}h.info(`Migrated ${e?"global":"workspace"} extension storage from ${a} to ${i}`),l.store(g,!0,b,1)}})}var MLt=class{constructor(i,e,t,o,n){this._extensionStorageService=e;this._storageService=t;this._instantiationService=o;this._logService=n;this._storageListener=new P;this._sharedStorageKeysToWatch=new Map;this._proxy=i.getProxy(Zi.ExtHostStorage),this._storageListener.add(this._storageService.onDidChangeValue(0,void 0,this._storageListener)(r=>{if(this._sharedStorageKeysToWatch.has(r.key)){let s=this._extensionStorageService.getExtensionStateRaw(r.key,!0);typeof s=="string"&&this._proxy.$acceptValue(!0,r.key,s)}}))}dispose(){this._storageListener.dispose()}async $initializeExtensionStorage(i,e){return await this.checkAndMigrateExtensionStorage(e,i),i&&this._sharedStorageKeysToWatch.set(e,!0),this._extensionStorageService.getExtensionStateRaw(e,i)}async $setValue(i,e,t){this._extensionStorageService.setExtensionState(e,t,i)}$registerExtensionStorageKeysToSync(i,e){this._extensionStorageService.setKeysForSync(i,e)}async checkAndMigrateExtensionStorage(i,e){try{let t=this._extensionStorageService.getSourceExtensionToMigrate(i);!t&&Gt&&i!==i.toLowerCase()&&(t=i.toLowerCase()),t&&(Gt&&t!==t.toLowerCase()&&this._extensionStorageService.getExtensionState(t.toLowerCase(),e)&&!this._extensionStorageService.getExtensionState(t,e)&&(t=t.toLowerCase()),await feo(t,i,e,this._instantiationService))}catch(t){this._logService.error(t)}}};MLt=I([vo(Gi.MainThreadStorage),m(1,Hz),m(2,le),m(3,F),m(4,ne)],MLt);var Ide=class extends C{constructor(e,t,o,n,r){super();this._telemetryService=t;this._configurationService=o;this._environmentService=n;this._productService=r;this._proxy=e.getProxy(Zi.ExtHostTelemetry),KL(this._productService,this._environmentService)&&this._register(this._configurationService.onDidChangeConfiguration(s=>{(s.affectsConfiguration(bN)||s.affectsConfiguration(zre))&&this._proxy.$onDidChangeTelemetryLevel(this.telemetryLevel)})),this._proxy.$initializeTelemetryLevel(this.telemetryLevel,KL(this._productService,this._environmentService),this._productService.enabledTelemetryLevels)}get telemetryLevel(){return KL(this._productService,this._environmentService)?this._telemetryService.telemetryLevel:0}$publicLog(e,t=Object.create(null)){t[Ide._name]=!0,this._telemetryService.publicLog(e,t)}$publicLog2(e,t){this.$publicLog(e,t)}};Ide._name="pluginHostTelemetry",Ide=I([vo(Gi.MainThreadTelemetry),m(1,Te),m(2,B),m(3,Co),m(4,nt)],Ide);var PLt=class{constructor(i){this._callback=i;this._terminalBufferMap=new Map}dispose(){for(let i of this._terminalBufferMap.values())i.dispose()}startBuffering(i,e,t=5){let o=e(n=>{let r=Ae(n)?n:n.data,s=this._terminalBufferMap.get(i);if(s){s.data.push(r);return}let l=setTimeout(()=>this.flushBuffer(i),t);s={data:[r],timeoutId:l,dispose:()=>{clearTimeout(l),this.flushBuffer(i),o.dispose()}},this._terminalBufferMap.set(i,s)});return o}stopBuffering(i){this._terminalBufferMap.get(i)?.dispose()}flushBuffer(i){let e=this._terminalBufferMap.get(i);e&&(this._terminalBufferMap.delete(i),this._callback(i,e.data.join("")))}};var RX=class extends C{constructor(e,t,o,n){super();this.instanceId=e;this._cols=t;this._rows=o;this._terminalService=n;this.id=0;this.shouldPersist=!1;this._onProcessData=this._register(new E);this.onProcessData=this._onProcessData.event;this._onProcessReady=this._register(new E);this._onStart=this._register(new E);this.onStart=this._onStart.event;this._onInput=this._register(new E);this.onInput=this._onInput.event;this._onBinary=this._register(new E);this.onBinary=this._onBinary.event;this._onResize=this._register(new E);this.onResize=this._onResize.event;this._onAcknowledgeDataEvent=this._register(new E);this.onAcknowledgeDataEvent=this._onAcknowledgeDataEvent.event;this._onShutdown=this._register(new E);this.onShutdown=this._onShutdown.event;this._onRequestInitialCwd=this._register(new E);this.onRequestInitialCwd=this._onRequestInitialCwd.event;this._onRequestCwd=this._register(new E);this.onRequestCwd=this._onRequestCwd.event;this._onDidChangeProperty=this._register(new E);this.onDidChangeProperty=this._onDidChangeProperty.event;this._onProcessExit=this._register(new E);this.onProcessExit=this._onProcessExit.event;this._pendingInitialCwdRequests=[];this._pendingCwdRequests=[]}get onProcessReady(){return this._onProcessReady.event}emitData(e){this._onProcessData.fire(e)}emitTitle(e){this._onDidChangeProperty.fire({type:"title",value:e})}emitReady(e,t){this._onProcessReady.fire({pid:e,cwd:t,windowsPty:void 0})}emitProcessProperty({type:e,value:t}){switch(e){case"cwd":this.emitCwd(t);break;case"initialCwd":this.emitInitialCwd(t);break;case"title":this.emitTitle(t);break;case"overrideDimensions":this.emitOverrideDimensions(t);break;case"resolvedShellLaunchConfig":this.emitResolvedShellLaunchConfig(t);break}}emitExit(e){this._onProcessExit.fire(e),this.dispose()}emitOverrideDimensions(e){this._onDidChangeProperty.fire({type:"overrideDimensions",value:e})}emitResolvedShellLaunchConfig(e){this._onDidChangeProperty.fire({type:"resolvedShellLaunchConfig",value:e})}emitInitialCwd(e){for(;this._pendingInitialCwdRequests.length>0;)this._pendingInitialCwdRequests.pop()(e)}emitCwd(e){for(;this._pendingCwdRequests.length>0;)this._pendingCwdRequests.pop()(e)}async start(){return this._terminalService.requestStartExtensionTerminal(this,this._cols,this._rows)}shutdown(e){this._onShutdown.fire(e)}input(e){this._onInput.fire(e)}sendSignal(e){}resize(e,t){this._onResize.fire({cols:e,rows:t})}clearBuffer(){}acknowledgeDataEvent(){}async setUnicodeVersion(e){}async processBinary(e){this._onBinary.fire(e)}getInitialCwd(){return new Promise(e=>{this._onRequestInitialCwd.fire(),this._pendingInitialCwdRequests.push(e)})}getCwd(){return new Promise(e=>{this._onRequestCwd.fire(),this._pendingCwdRequests.push(e)})}async refreshProperty(e){throw new Error("refreshProperty not implemented on extension host")}async updateProperty(e,t){}};RX=I([m(3,Yo)],RX);var Uz=ae("environmentVariableService");function yde(a){return[...a.entries()]}function G6e(a){return a?[...a.entries()]:[]}function $6e(a){return new Map(a)}function q6e(a){return new Map(a??[])}function _mi(a){return Array.from(a.entries()).map(i=>[i[0],yde(i[1].map),G6e(i[1].descriptionMap)])}function veo(a){return new Map(a.map(i=>[i[0],{map:$6e(i[1]),descriptionMap:q6e(i[2])}]))}var j6e=ae("terminalLinkProviderService");var CEe=ae("terminalQuickFixService");var ALt=class{constructor(i){this.completion=i;this.score=uv.Default;this.isInvalid=!1;this.textLabel=typeof i.label=="string"?i.label:i.label?.label,this.labelLow=this.textLabel.toLowerCase()}};function beo(a){switch(a){case 20:return 0;case 23:return 1;case 0:return 2;case 18:return 4;case 4:return 4;case 16:return 6;case 17:return 3;default:return 2}}var xEe=class extends ALt{constructor(e,t){super(e);this.completion=e;this.fileExtLow="";this.punctuationPenalty=0;let n=(t??(this.labelLow.includes("\\")?"\\":void 0))==="\\";if(this.labelLowExcludeFileExt=this.labelLow,this.labelLowNormalizedPath=this.labelLow,(Dmi(e)||e.kind===11)&&n&&(this.labelLow=this.labelLow.replaceAll("/","\\")),Dmi(e)){let r=this.labelLow.lastIndexOf(".");r>0&&(this.labelLowExcludeFileExt=this.labelLow.substring(0,r),this.fileExtLow=this.labelLow.substring(r+1))}(Dmi(e)||e.kind===1)&&(n&&(this.labelLowNormalizedPath=this.labelLow.replaceAll("\\","/")),e.kind===1&&(this.labelLowNormalizedPath=this.labelLowNormalizedPath.replace(/\/$/,""))),this.punctuationPenalty=l2o(this.labelLowExcludeFileExt)?1:0}async resolve(e){if(this.resolveCache)return this.resolveCache;let t=this.completion._unresolvedItem,o=this.completion._resolveProvider;if(!(!t||!o||!o.resolveCompletionItem))return this.resolveCache=(async()=>{try{let n=await o.resolveCompletionItem(t,e);n&&(n.detail&&(this.completion.detail=n.detail),n.documentation&&(this.completion.documentation=n.documentation))}catch{return}})(),this.resolveCache}};function Dmi(a){return!!(a.kind===0||a.isFileOverride)}function l2o(a){return No(a).startsWith("_")||/^[\[\]\{\}\(\)\.,;:!?\/\\\-_@#~*%^=$]+$/.test(a)}function Seo(a,i){let e=(i||"C:").toUpperCase();if(a==="/")return`${e}\\`;let t=a.match(/^\/([a-zA-Z])(\/.*)?$/);if(t){let o=t[1].toUpperCase(),n=t[2]?t[2].replace(/\//g,"\\"):"\\";return`${o}:${n}`}return a.replace(/\//g,"\\")}function Ieo(a){return a.replace(/^[a-zA-Z]:\\/,i=>`/${i[0].toLowerCase()}/`).replace(/\\/g,"/")}var PX=ae("terminalCompletionService");var kEe=class extends C{constructor(e,t,o,n){super();this._configurationService=e;this._fileService=t;this._labelService=o;this._logService=n;this._providers=new Map;this._onDidChangeProviders=this._register(new E);this.onDidChangeProviders=this._onDidChangeProviders.event;this._processEnv=fp}get providers(){return this._providersGenerator()}*_providersGenerator(){for(let e of this._providers.values())for(let t of e.values())yield t}set processEnv(e){this._processEnv=e}registerTerminalCompletionProvider(e,t,o,...n){let r=this._providers.get(e);return r||(r=new Map,this._providers.set(e,r)),o.triggerCharacters=n,o.id=t,r.set(t,o),this._onDidChangeProviders.fire(),Z(()=>{let s=this._providers.get(e);s&&(s.delete(t),s.size===0&&this._providers.delete(e)),this._onDidChangeProviders.fire()})}async provideCompletions(e,t,o,n,r,s,l,c,u){if(this._logService.trace("TerminalCompletionService#provideCompletions"),!this._providers||!this._providers.values||t<0)return;let p;if(l){let h=[];for(let g of this.providers)if(g.triggerCharacters){for(let f of g.triggerCharacters)if(e.substring(0,t)?.endsWith(f)){h.push(g);break}}p=h}else p=[...this._providers.values()].flatMap(h=>[...h.values()]);if(c)return p=p.filter(h=>h.isBuiltin),this._collectCompletions(p,n,e,t,o,r,s,u);if(p=this._getEnabledProviders(p),!!p.length)return this._collectCompletions(p,n,e,t,o,r,s,u)}_getEnabledProviders(e){let t=this._configurationService.getValue("terminal.integrated.suggest.providers");return e.filter(o=>{let n=o.id;return n&&(!Object.prototype.hasOwnProperty.call(t,n)||t[n]!==!1)})}async _collectCompletions(e,t,o,n,r,s,l,c){this._logService.trace("TerminalCompletionService#_collectCompletions");let u=e.map(async h=>{if(h.shellTypes&&t&&!h.shellTypes.includes(t))return;let g=c?3e4:5e3,f=!1,v;try{v=await Promise.race([h.provideCompletions(o,n,l).then(S=>(this._logService.trace(`TerminalCompletionService#_collectCompletions provider ${h.id} finished`),S)),(async()=>{await Pi(g),f=!0})()])}catch(S){this._logService.trace(`[TerminalCompletionService] Exception from provider '${h.id}':`,S);return}if(f){this._logService.trace(`[TerminalCompletionService] Provider '${h.id}' timed out after ${g}ms. promptValue='${o}', cursorPosition=${n}, explicitlyInvoked=${c}`);return}if(!v)return;let b=Array.isArray(v)?v:v.items??[];if(this._logService.trace(`TerminalCompletionService#_collectCompletions amend ${b.length} completion items`),t==="pwsh")for(let S of b){let y=S.replacementRange?S.replacementRange[0]:0;S.isFileOverride??=S.kind===2&&y===0}if(h.isBuiltin)for(let S of b)S.provider??=h.id;if(Array.isArray(v))return b;if(v.resourceOptions){let S=await this.resolveResources(v.resourceOptions,o,n,`core:path:ext:${h.id}`,s,t);if(this._logService.trace("TerminalCompletionService#_collectCompletions dedupe"),S){let y=new Set(b.map(w=>w.label));for(let w of S)y.has(w.label)||b.push(w)}this._logService.trace("TerminalCompletionService#_collectCompletions dedupe done")}return b}),p=await Promise.all(u);return this._logService.trace("TerminalCompletionService#_collectCompletions done"),p.filter(h=>!!h).flat()}async resolveResources(e,t,o,n,r,s){this._logService.trace("TerminalCompletionService#resolveResources");let l=e.pathSeparator==="\\";l&&(t=t.replaceAll(/[\\/]/g,e.pathSeparator));let c=(e.showDirectories||e.showFiles)??!1,u=e.showFiles??!1,p=e.globPattern??void 0;if(!c&&!u)return;let h=[],g=t.substring(0,o),v=g.split(/(?<!\\) /).length<=1&&!g.endsWith(" "),b=g.endsWith(" ")?"":g.split(/(?<!\\) /).at(-1)??"",S=b.match(/^[a-zA-Z_]+=(?<rhs>.+)$/);S?.groups?.rhs&&(b=S.groups.rhs);let y;if(l){let $=-1;for(let te=b.length-1;te>=0;te--)if(b[te]==="\\"&&(te===b.length-1||b[te+1]!==" ")){$=te;break}y=Math.max($,b.lastIndexOf("/"))}else y=b.lastIndexOf(e.pathSeparator);let w=y===-1?"":b.slice(0,y+1);l&&(w=w.replaceAll("/","\\"));let k=!!w.match(/^\.\.?[\\\/]/),T=!!w.match(/^~[\\\/]?/),N=d2o(s,e.pathSeparator,w,l),O=T?"tilde":N?"absolute":"relative",V=A.revive(e.cwd),U;if(O==="relative"&&w.length>0){let $=(l?w.replaceAll("\\","/"):w).replaceAll("\\ "," ");if($.startsWith("./")){let pe=$.replace(/^\.\/+/,"").replace(/\/+$/,"");if(pe){let de=V.path.replace(/\/+$/,"").split("/"),se=pe.split("/");if(se.length<=de.length&&se.every((ke,Ee)=>de[de.length-se.length+Ee]===ke))try{await this._fileService.stat(V),U=V}catch{return}}else try{await this._fileService.stat(V),U=V}catch{return}}if(!U){let pe=A.joinPath(V,$);try{await this._fileService.stat(pe),U=pe}catch{return}}}else O==="relative"&&(U=V);if(O==="relative"&&!U)try{await this._fileService.stat(V),U=V}catch{return}switch(O){case"tilde":{let $=this._getHomeDir(l,r);$&&(U=A.joinPath(Q6e(V,$),w.slice(1).replaceAll("\\ "," "))),U||b.match(/^~[\\\/]$/)&&(U=l?"Home directory":"$HOME");break}case"absolute":{s==="gitbash"?U=Q6e(V,Seo(w,this._processEnv.SystemDrive)):U=Q6e(V,w.replaceAll("\\ "," "));break}case"relative":{U??=V;break}}if(!U)return;if(Ae(U))return h.push({label:w,provider:n,kind:1,detail:U,replacementRange:[o-b.length,o]}),h;let G=await this._fileService.resolve(U,{resolveMetadata:!0,resolveSingleChildDescendants:!0});if(G?.children){if(this._logService.trace("TerminalCompletionService#resolveResources cwd"),c){let $;switch(O){case"tilde":{$=w;break}case"absolute":{$=w;break}case"relative":{$=".",w.length>0&&($=Lmi(w,e,k));break}}h.push({label:$,provider:n,kind:1,detail:MX(this._labelService,U,e.pathSeparator,1,s),replacementRange:[o-b.length,o]})}if(this._logService.trace("TerminalCompletionService#resolveResources direct children"),await Promise.all(G.children.map($=>(async()=>{let te,pe;if(c&&$.isDirectory)$.isSymbolicLink?te=9:te=1;else if(u&&$.isFile){if(v&&!l&&!$.executable)return;$.isSymbolicLink?te=8:te=0}if(te===void 0)return;let de=w;if(de.length>0&&!de.endsWith(e.pathSeparator)&&(de+=e.pathSeparator),de+=$.name,O==="relative"&&(de=Lmi(de,e,k)),$.isDirectory&&!de.endsWith(e.pathSeparator)&&(de+=e.pathSeparator),de=c2o(de,s,e.pathSeparator),$.isFile&&p){let se=$.resource.fsPath,Se=!this._fileService.hasCapability($.resource,1024);if(!Cp(p,se,{ignoreCase:Se}))return}if($.isSymbolicLink)try{let se=await this._fileService.realpath($.resource);se&&!Xe($.resource,se)&&(pe=`${MX(this._labelService,$.resource,e.pathSeparator,te,s)} -> ${MX(this._labelService,se,e.pathSeparator,te,s)}`)}catch{}h.push({label:de,provider:n,kind:te,detail:pe??MX(this._labelService,$.resource,e.pathSeparator,te,s),replacementRange:[o-b.length,o]})})())),this._logService.trace("TerminalCompletionService#resolveResources CDPATH"),O==="relative"&&c&&t.startsWith("cd ")){let $=this._configurationService.getValue("terminal.integrated.suggest.cdPath");if($==="absolute"||$==="relative"){let te=this._getEnvVar("CDPATH",r);if(te){let pe=te.split(l?";":":");for(let de of pe)try{let se=await this._fileService.resolve(Q6e(V,de),{resolveSingleChildDescendants:!0});if(se?.children)for(let Se of se.children){if(!Se.isDirectory)continue;let ke=$==="relative",Ee=1,He=ke?No(Se.resource.fsPath):s==="gitbash"?Ieo(Se.resource.fsPath):MX(this._labelService,Se.resource,e.pathSeparator,Ee,s),Ve=ke?`CDPATH ${MX(this._labelService,Se.resource,e.pathSeparator,Ee,s)}`:"CDPATH";h.push({label:He,provider:n,kind:Ee,detail:Ve,replacementRange:[o-b.length,o]})}}catch{}}}}if(this._logService.trace("TerminalCompletionService#resolveResources parent dir"),O==="relative"&&c){let $=`..${e.pathSeparator}`;w.length>0&&($=Lmi(w+$,e,k));let te=A.joinPath(U,".."+e.pathSeparator);h.push({label:$,provider:n,kind:1,detail:MX(this._labelService,te,e.pathSeparator,1,s),replacementRange:[o-b.length,o]})}if(this._logService.trace("TerminalCompletionService#resolveResources tilde"),O==="relative"&&!w.match(/[\\\/]/)){let $,te=this._getHomeDir(l,r);te&&($=Q6e(V,te)),$||($=l?"Home directory":"$HOME"),h.push({label:"~",provider:n,kind:1,detail:Ae($)?$:MX(this._labelService,$,e.pathSeparator,1,s),replacementRange:[o-b.length,o]})}return this._logService.trace("TerminalCompletionService#resolveResources done"),h}}_getEnvVar(e,t){let o=t.get(5)?.env?.value;return o?o[e]:this._processEnv[e]}_getHomeDir(e,t){return e?this._getEnvVar("USERPROFILE",t):this._getEnvVar("HOME",t)}};kEe=I([m(0,B),m(1,be),m(2,ot),m(3,Xs)],kEe);function MX(a,i,e,t,o){let n=a.getUriLabel(i,{noPrefix:!0}),r=o==="gitbash"?"\\":e;return t===1&&!n.endsWith(r)&&(n+=r),n}function Lmi(a,i,e){return e?a:a.startsWith(i.pathSeparator)?`.${a}`:`.${i.pathSeparator}${a}`}function c2o(a,i,e){return i===void 0||i==="pwsh"||i==="cmd"?a:a.replace(/[\[\]\(\)'"\\\`\*\?;|&<>]/g,"\\$&")}function d2o(a,i,e,t){return a==="gitbash"?e.startsWith(i)||/^[a-zA-Z]:\//.test(e):t?/^[a-zA-Z]:[\\\/]/.test(e):e.startsWith(i)}function Q6e(a,i){return a.scheme==="file"?A.file(i):a.with({path:i})}var OLt=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super();this._terminalService=t;this._terminalLinkProviderService=o;this._terminalQuickFixService=n;this._instantiationService=r;this._environmentVariableService=s;this._logService=l;this._terminalProfileResolverService=c;this._terminalGroupService=p;this._terminalEditorService=h;this._terminalProfileService=g;this._terminalCompletionService=f;this._environmentService=v;this._extHostTerminals=new Map;this._terminalProcessProxies=new Map;this._profileProviders=new Map;this._completionProviders=new Map;this._quickFixProviders=new Map;this._dataEventTracker=this._register(new me);this._sendCommandEventListener=this._register(new me);this._linkProvider=this._register(new me);this._os=zo;this._proxy=e.getProxy(Zi.ExtHostTerminalService),this._register(t.onDidCreateInstance(S=>{this._onTerminalOpened(S),this._onInstanceDimensionsChanged(S)})),this._register(t.onDidDisposeInstance(S=>this._onTerminalDisposed(S))),this._register(t.onAnyInstanceProcessIdReady(S=>this._onTerminalProcessIdReady(S))),this._register(t.onDidChangeInstanceDimensions(S=>this._onInstanceDimensionsChanged(S))),this._register(t.onAnyInstanceMaximumDimensionsChange(S=>this._onInstanceMaximumDimensionsChanged(S))),this._register(t.onDidRequestStartExtensionTerminal(S=>this._onRequestStartExtensionTerminal(S))),this._register(t.onDidChangeActiveInstance(S=>this._onActiveTerminalChanged(S?S.instanceId:null))),this._register(t.onAnyInstanceTitleChange(S=>S&&this._onTitleChanged(S.instanceId,S.title))),this._register(t.onAnyInstanceDataInput(S=>this._proxy.$acceptTerminalInteraction(S.instanceId))),this._register(t.onAnyInstanceSelectionChange(S=>this._proxy.$acceptTerminalSelection(S.instanceId,S.selection))),this._register(t.onAnyInstanceShellTypeChanged(S=>this._onShellTypeChanged(S.instanceId)));for(let S of this._terminalService.instances)this._onTerminalOpened(S),S.processReady.then(()=>this._onTerminalProcessIdReady(S)),S.shellType&&this._proxy.$acceptTerminalShellType(S.instanceId,S.shellType);let b=this._terminalService.activeInstance;if(b&&this._proxy.$acceptActiveTerminalChanged(b.instanceId),this._environmentVariableService.collections.size>0){let y=[...this._environmentVariableService.collections.entries()].map(w=>[w[0],yde(w[1].map)]);this._proxy.$initEnvironmentVariableCollections(y)}this._store.add(Z(()=>{for(let S of this._terminalProcessProxies.values())S.proxy.dispose(),S.store.dispose();this._terminalProcessProxies.clear()})),u.getEnvironment().then(async S=>{this._os=S?.os||zo,this._updateDefaultProfile()}),this._register(this._terminalProfileService.onDidChangeAvailableProfiles(()=>this._updateDefaultProfile())),this._register(Z(()=>{for(let S of this._profileProviders.values())S.dispose();for(let S of this._quickFixProviders.values())S.dispose()}))}async _updateDefaultProfile(){let e=this._environmentService.remoteAuthority,t=this._terminalProfileResolverService.getDefaultProfile({remoteAuthority:e,os:this._os}),o=this._terminalProfileResolverService.getDefaultProfile({remoteAuthority:e,os:this._os,allowAutomationShell:!0});this._proxy.$acceptDefaultProfile(...await Promise.all([t,o]))}async _getTerminalInstance(e){return typeof e=="string"?this._extHostTerminals.get(e):this._terminalService.getInstanceFromId(e)}async $createTerminal(e,t){let o={name:t.name,executable:t.shellPath,args:t.shellArgs,cwd:typeof t.cwd=="string"?t.cwd:A.revive(t.cwd),icon:t.icon,color:t.color,initialText:t.initialText,waitOnExit:t.waitOnExit,ignoreConfigurationCwd:!0,env:t.env,strictEnv:t.strictEnv,hideFromUser:t.hideFromUser,customPtyImplementation:t.isExtensionCustomPtyTerminal?(s,l,c)=>new RX(s,l,c,this._terminalService):void 0,extHostTerminalId:e,forceShellIntegration:t.forceShellIntegration,isFeatureTerminal:t.isFeatureTerminal,isExtensionOwnedTerminal:t.isExtensionOwnedTerminal,useShellEnvironment:t.useShellEnvironment,isTransient:t.isTransient,shellIntegrationNonce:t.shellIntegrationNonce,titleTemplate:t.titleTemplate},n=fn.withAsyncBody(async s=>{let l=await this._terminalService.createTerminal({config:o,location:await this._deserializeParentTerminal(t.location)});s(l)});this._extHostTerminals.set(e,n);let r=await n;this._register(r.onDisposed(()=>{this._extHostTerminals.delete(e)}))}async _deserializeParentTerminal(e){if(typeof e=="object"&&Wo(e,{parentTerminal:!0})){let t=await this._extHostTerminals.get(e.parentTerminal.toString());return t?{parentTerminal:t}:void 0}return e}async $show(e,t){let o=await this._getTerminalInstance(e);o&&(this._terminalService.setActiveInstance(o),o.target===2?await this._terminalEditorService.revealActiveEditor(t):await this._terminalGroupService.showPanel(!t))}async $hide(e){let t=await this._getTerminalInstance(e),o=this._terminalService.activeInstance;o&&o.instanceId===t?.instanceId&&o.target!==2&&this._terminalGroupService.hidePanel()}async $dispose(e){(await this._getTerminalInstance(e))?.dispose(4)}async $sendText(e,t,o){await(await this._getTerminalInstance(e))?.sendText(t,o)}$sendProcessExit(e,t){this._terminalProcessProxies.get(e)?.proxy.emitExit(t)}$startSendingDataEvents(){if(!this._dataEventTracker.value){this._dataEventTracker.value=this._instantiationService.createInstance(Y6e,(e,t)=>{this._onTerminalData(e,t)});for(let e of this._terminalService.instances)for(let t of e.initialDataEvents||[])this._onTerminalData(e.instanceId,t)}}$stopSendingDataEvents(){this._dataEventTracker.clear()}$startSendingCommandEvents(){if(this._sendCommandEventListener.value)return;let e=this._terminalService.createOnInstanceCapabilityEvent(2,o=>o.onCommandFinished),t=e.event(o=>{this._onDidExecuteCommand(o.instance.instanceId,{commandLine:o.data.command,cwd:o.data.cwd,exitCode:o.data.exitCode,output:o.data.getOutput()})});this._sendCommandEventListener.value=hn(e,t)}$stopSendingCommandEvents(){this._sendCommandEventListener.clear()}$startLinkProvider(){this._linkProvider.value=this._terminalLinkProviderService.registerLinkProvider(new Rmi(this._proxy))}$stopLinkProvider(){this._linkProvider.clear()}$registerProcessSupport(e){this._terminalService.registerProcessSupport(e)}$registerCompletionProvider(e,t,...o){this._completionProviders.set(e,this._terminalCompletionService.registerTerminalCompletionProvider(t,e,{id:e,provideCompletions:async(n,r,s)=>{let l=await this._proxy.$provideTerminalCompletions(e,{commandLine:n,cursorIndex:r},s);if(l){if(l.resourceOptions){let{cwd:c,globPattern:u,...p}=l.resourceOptions;return{items:l.items?.map(h=>({provider:`ext:${e}`,...h})),resourceOptions:{...p,cwd:c,globPattern:u}}}return l.items?.map(c=>({provider:`ext:${e}`,...c}))}}},...o))}$unregisterCompletionProvider(e){this._completionProviders.get(e)?.dispose(),this._completionProviders.delete(e)}$registerProfileProvider(e,t){this._profileProviders.set(e,this._terminalProfileService.registerTerminalProfileProvider(t,e,{createContributedTerminalProfile:async o=>this._proxy.$createContributedProfileTerminal(e,o)}))}$unregisterProfileProvider(e){this._profileProviders.get(e)?.dispose(),this._profileProviders.delete(e)}async $registerQuickFixProvider(e,t){this._quickFixProviders.set(e,this._terminalQuickFixService.registerQuickFixProvider(e,{provideTerminalQuickFixes:async(o,n,r,s)=>{if(s.isCancellationRequested)return;r.outputMatcher?.length&&r.outputMatcher.length>40&&(r.outputMatcher.length=40,this._logService.warn("Cannot exceed output matcher length of 40"));let l=o.command.match(r.commandLineMatcher);if(!l||!n)return;let c=r.outputMatcher,u;if(c&&(u=u2o(n,c)),!u)return;let p={commandLineMatch:l,outputMatch:u,commandLine:o.command};if(p){let h=await this._proxy.$provideTerminalQuickFixes(e,p,s);if(h&&Array.isArray(h))return h.map(g=>yeo(e,t,g));if(h)return yeo(e,t,h)}}}))}$unregisterQuickFixProvider(e){this._quickFixProviders.get(e)?.dispose(),this._quickFixProviders.delete(e)}_onActiveTerminalChanged(e){this._proxy.$acceptActiveTerminalChanged(e)}_onTerminalData(e,t){this._proxy.$acceptTerminalProcessData(e,t)}_onDidExecuteCommand(e,t){this._proxy.$acceptDidExecuteCommand(e,t)}_onTitleChanged(e,t){this._proxy.$acceptTerminalTitleChange(e,t)}_onShellTypeChanged(e){let t=this._terminalService.getInstanceFromId(e);t&&this._proxy.$acceptTerminalShellType(e,t.shellType)}_onTerminalDisposed(e){this._proxy.$acceptTerminalClosed(e.instanceId,e.exitCode,e.exitReason??0);let t=this._terminalProcessProxies.get(e.instanceId);t&&(t.proxy.dispose(),t.store.dispose(),this._terminalProcessProxies.delete(e.instanceId))}_onTerminalOpened(e){let t=e.shellLaunchConfig.extHostTerminalId,o={name:e.shellLaunchConfig.name,executable:e.shellLaunchConfig.executable,args:e.shellLaunchConfig.args,cwd:e.shellLaunchConfig.cwd,env:e.shellLaunchConfig.env,hideFromUser:e.shellLaunchConfig.hideFromUser,tabActions:e.shellLaunchConfig.tabActions,titleTemplate:e.shellLaunchConfig.titleTemplate};this._proxy.$acceptTerminalOpened(e.instanceId,t,e.title,o)}_onTerminalProcessIdReady(e){e.processId!==void 0&&this._proxy.$acceptTerminalProcessId(e.instanceId,e.processId)}_onInstanceDimensionsChanged(e){this._proxy.$acceptTerminalDimensions(e.instanceId,e.cols,e.rows)}_onInstanceMaximumDimensionsChanged(e){this._proxy.$acceptTerminalMaximumDimensions(e.instanceId,e.maxCols,e.maxRows)}_onRequestStartExtensionTerminal(e){let t=e.proxy,o=new P;this._terminalProcessProxies.set(t.instanceId,{proxy:t,store:o});let n=e.cols&&e.rows?{columns:e.cols,rows:e.rows}:void 0;this._proxy.$startExtensionTerminal(t.instanceId,n).then(e.callback),o.add(t.onInput(r=>this._proxy.$acceptProcessInput(t.instanceId,r))),o.add(t.onShutdown(r=>this._proxy.$acceptProcessShutdown(t.instanceId,r))),o.add(t.onRequestCwd(()=>this._proxy.$acceptProcessRequestCwd(t.instanceId))),o.add(t.onRequestInitialCwd(()=>this._proxy.$acceptProcessRequestInitialCwd(t.instanceId)))}$sendProcessData(e,t){this._terminalProcessProxies.get(e)?.proxy.emitData(t)}$sendProcessReady(e,t,o,n){this._terminalProcessProxies.get(e)?.proxy.emitReady(t,o,n)}$sendProcessProperty(e,t){t.type==="title"&&this._terminalService.getInstanceFromId(e)?.rename(t.value),this._terminalProcessProxies.get(e)?.proxy.emitProcessProperty(t)}$setEnvironmentVariableCollection(e,t,o,n){if(o){let r={persistent:t,map:$6e(o),descriptionMap:q6e(n)};this._environmentVariableService.set(e,r)}else this._environmentVariableService.delete(e)}};OLt=I([vo(Gi.MainThreadTerminalService),m(1,Yo),m(2,j6e),m(3,CEe),m(4,F),m(5,Uz),m(6,ne),m(7,Sg),m(8,yo),m(9,jl),m(10,xv),m(11,iy),m(12,PX),m(13,Vt)],OLt);var Y6e=class extends C{constructor(e,t){super();this._callback=e;this._terminalService=t;this._register(this._bufferer=new PLt(this._callback));for(let o of this._terminalService.instances)this._registerInstance(o);this._register(this._terminalService.onDidCreateInstance(o=>this._registerInstance(o))),this._register(this._terminalService.onDidDisposeInstance(o=>this._bufferer.stopBuffering(o.instanceId)))}_registerInstance(e){this._register(this._bufferer.startBuffering(e.instanceId,e.onData))}};Y6e=I([m(1,Yo)],Y6e);var Rmi=class{constructor(i){this._proxy=i}async provideLinks(i,e){let t=this._proxy;return(await t.$provideLinks(i.instanceId,e)).map(n=>({id:n.id,startIndex:n.startIndex,length:n.length,label:n.label,activate:()=>t.$activateLink(i.instanceId,n.id)}))}};function u2o(a,i){let e=a.join(`
`).match(i.lineMatcher);return e?{regexMatch:e,outputLines:a}:void 0}function yeo(a,i,e){let t=0;return Wo(e,{uri:!0})?(e.uri=A.revive(e.uri),t=1):Wo(e,{id:!0})&&(t=3),{id:a,type:t,source:i,...e}}var FLt=class extends C{constructor(e,t,o,n){super();this._terminalService=t;this._extensionService=n;this._proxy=e.getProxy(Zi.ExtHostTerminalShellIntegration);let r=new Map;this._register(Z(()=>{for(let g of r.values())g.dispose()}));for(let g of this._terminalService.instances)g.capabilities.get(2)&&this._enableShellIntegration(g);let s=this._store.add(this._terminalService.createOnInstanceEvent(g=>H.map(g.capabilities.onDidAddCommandDetectionCapability,()=>g))).event;this._store.add(s(g=>this._enableShellIntegration(g)));let l=this._store.add(this._terminalService.createOnInstanceCapabilityEvent(0,g=>g.onDidChangeCwd));this._store.add(l.event(g=>{this._proxy.$cwdChange(g.instance.instanceId,g.data)}));let c=this._store.add(this._terminalService.createOnInstanceCapabilityEvent(5,g=>g.onDidChangeEnv));this._store.add(c.event(g=>{if(g.data.value&&typeof g.data.value=="object"){let f=g.data.value,v=Object.keys(f),b=Object.values(f);this._proxy.$shellEnvChange(g.instance.instanceId,v,b,g.data.isTrusted)}}));let u=this._store.add(this._terminalService.createOnInstanceCapabilityEvent(2,g=>g.onCommandExecuted)),p;this._store.add(u.event(g=>{if(g.data===p)return;p=g.data;let f=g.instance.instanceId;this._proxy.$shellExecutionStart(f,xeo(g.instance),g.data.command,Ceo(g.data),g.data.isTrusted,g.data.cwd),r.get(f)?.dispose(),r.set(f,H.accumulate(g.instance.onData,50,!0,this._store)(v=>{this._proxy.$shellExecutionData(f,v.join(""))}))}));let h=this._store.add(this._terminalService.createOnInstanceCapabilityEvent(2,g=>g.onCommandFinished));this._store.add(h.event(g=>{p=void 0;let f=g.instance.instanceId;r.get(f)?.dispose(),this._proxy.$shellExecutionEnd(f,g.data.command,Ceo(g.data),g.data.isTrusted,g.data.exitCode)})),this._store.add(this._terminalService.onDidDisposeInstance(g=>this._proxy.$closeTerminal(g.instanceId)))}$executeCommand(e,t){this._terminalService.getInstanceFromId(e)?.runCommand(t,!0)}_enableShellIntegration(e){this._extensionService.activateByEvent("onTerminalShellIntegration:*"),e.shellType&&this._extensionService.activateByEvent(`onTerminalShellIntegration:${e.shellType}`),this._proxy.$shellIntegrationChange(e.instanceId,xeo(e));let t=e.capabilities.get(0);t&&this._proxy.$cwdChange(e.instanceId,t.getCwd())}};FLt=I([vo(Gi.MainThreadTerminalShellIntegration),m(1,Yo),m(2,Vt),m(3,lt)],FLt);function Ceo(a){switch(a.commandLineConfidence){case"high":return 2;case"medium":return 1;default:return 0}}function xeo(a){return a.shellLaunchConfig.type!=="Task"}var WLt=class{constructor(i,e){this._themeService=e,this._proxy=i.getProxy(Zi.ExtHostTheming),this._themeChangeListener=this._themeService.onDidColorThemeChange(t=>{this._proxy.$onColorThemeChange(this._themeService.getColorTheme().type)}),this._proxy.$onColorThemeChange(this._themeService.getColorTheme().type)}dispose(){this._themeChangeListener.dispose()}};WLt=I([vo(Gi.MainThreadTheming),m(1,De)],WLt);var VLt=class extends C{constructor(e,t,o,n,r,s){super();this.viewsService=t;this.notificationService=o;this.extensionService=n;this.logService=r;this.telemetryService=s;this._dataProviders=this._register(new jt);this._dndControllers=new Map;this._proxy=e.getProxy(Zi.ExtHostTreeViews)}async $registerTreeViewDataProvider(e,t){this.logService.trace("MainThreadTreeViews#$registerTreeViewDataProvider",e,t),this.extensionService.whenInstalledExtensionsRegistered().then(()=>{let o=new Pmi(e,this._proxy,this.notificationService),n=new P;this._dataProviders.set(e,{dataProvider:o,dispose:()=>n.dispose()});let r=t.hasHandleDrag||t.hasHandleDrop?new Mmi(e,t.dropMimeTypes,t.dragMimeTypes,t.hasHandleDrag,this._proxy):void 0,s=this.getTreeView(e);s?(s.showCollapseAllAction=t.showCollapseAll,s.canSelectMany=t.canSelectMany,s.manuallyManageCheckboxes=t.manuallyManageCheckboxes,s.dragAndDropController=r,r&&this._dndControllers.set(e,r),s.dataProvider=o,this.registerListeners(e,s,n),this._proxy.$setVisible(e,s.visible)):this.notificationService.error("No view is registered with id: "+e)})}$reveal(e,t,o){return this.logService.trace("MainThreadTreeViews#$reveal",e,t?.item,t?.parentChain,o),this.viewsService.openView(e,o.focus).then(()=>{let n=this.getTreeView(e);if(n&&t)return this.reveal(n,this._dataProviders.get(e).dataProvider,t.item,t.parentChain,o)})}$refresh(e,t){this.logService.trace("MainThreadTreeViews#$refresh",e,t);let o=this.getTreeView(e),n=this._dataProviders.get(e);if(o&&n){let r=n.dataProvider.getItemsToRefresh(t);return o.refresh(r.items.length?r.items:void 0,r.checkboxes.length?r.checkboxes:void 0)}return Promise.resolve()}$setMessage(e,t){this.logService.trace("MainThreadTreeViews#$setMessage",e,t.toString());let o=this.getTreeView(e);o&&(o.message=t)}$setTitle(e,t,o){this.logService.trace("MainThreadTreeViews#$setTitle",e,t,o);let n=this.getTreeView(e);n&&(n.title=t,n.description=o)}$setBadge(e,t){this.logService.trace("MainThreadTreeViews#$setBadge",e,t?.value,t?.tooltip);let o=this.getTreeView(e);o&&(o.badge=t)}$resolveDropFileData(e,t,o){let n=this._dndControllers.get(e);if(!n)throw new Error("Unknown tree");return n.resolveDropFileData(t,o)}async $disposeTree(e){let t=this.getTreeView(e);t&&(t.dataProvider=void 0),this._dataProviders.deleteAndDispose(e)}$logResolveTreeNodeFailure(e){this.telemetryService.publicLog2("treeView.resolveFailure",{extensionId:e})}async reveal(e,t,o,n,r){r=r||{select:!1,focus:!1};let s=Jn(r.select)?!1:r.select,l=Jn(r.focus)?!1:r.focus,c=Math.min(Xo(r.expand)?r.expand:r.expand===!0?1:0,3);t.isEmpty()&&await e.refresh();for(let p of n){let h=t.getItem(p.handle);h&&await e.expand(h)}let u=t.getItem(o.handle);if(u){await e.reveal(u),s&&e.setSelection([u]),l===!1?e.setFocus():l&&e.setFocus(u);let p=[u];for(;p.length>0&&c>0;c--)await e.expand(p),p=p.reduce((h,g)=>{let f=t.getItem(g.handle);return f&&f.children&&f.children.length&&h.push(...f.children),h},[])}}registerListeners(e,t,o){o.add(t.onDidExpandItem(n=>this._proxy.$setExpanded(e,n.handle,!0))),o.add(t.onDidCollapseItem(n=>this._proxy.$setExpanded(e,n.handle,!1))),o.add(t.onDidChangeSelectionAndFocus(n=>this._proxy.$setSelectionAndFocus(e,n.selection.map(({handle:r})=>r),n.focus.handle))),o.add(t.onDidChangeVisibility(n=>this._proxy.$setVisible(e,n))),o.add(t.onDidChangeCheckboxState(n=>{this._proxy.$changeCheckboxState(e,n.map(r=>({treeItemHandle:r.handle,newState:r.checkbox?.isChecked??!1})))}))}getTreeView(e){let t=oe.as(on.ViewsRegistry).getView(e);return t?t.treeView:null}dispose(){for(let e of this._dataProviders){let t=this.getTreeView(e[0]);t&&(t.dataProvider=void 0)}this._dataProviders.dispose(),this._dndControllers.clear(),super.dispose()}};VLt=I([vo(Gi.MainThreadTreeViews),m(1,Ft),m(2,Ne),m(3,lt),m(4,ne),m(5,Te)],VLt);var Mmi=class{constructor(i,e,t,o,n){this.treeViewId=i;this.dropMimeTypes=e;this.dragMimeTypes=t;this.hasWillDrop=o;this._proxy=n;this.dataTransfersCache=new ade}async handleDrop(i,e,t,o,n,r){let s=this.dataTransfersCache.add(i);try{let l=await sde.fromList(i);return t.isCancellationRequested?void 0:await this._proxy.$handleDrop(this.treeViewId,s.id,l,e?.handle,t,o,n,r)}finally{s.dispose()}}async handleDrag(i,e,t){if(!this.hasWillDrop)return;let o=await this._proxy.$handleDrag(this.treeViewId,i,e,t);if(!o)return;let n=new bx;return o.items.forEach(([r,s])=>{let l=r===Zn.uriList&&s.uriListData?Uy.create(s.uriListData.map(c=>typeof c=="string"?c:A.revive(c))):s.asString;n.replace(r,NN(l))}),n}resolveDropFileData(i,e){return this.dataTransfersCache.resolveFileData(i,e)}},Pmi=class{constructor(i,e,t){this.treeViewId=i;this._proxy=e;this.notificationService=t;this.itemsMap=new Map;this.hasResolve=this._proxy.$hasResolve(this.treeViewId)}async getChildren(i){return(await this.getChildrenBatch(i?[i]:void 0))?.[0]}getChildrenBatch(i){return i||this.itemsMap.clear(),this._proxy.$getChildren(this.treeViewId,i?i.map(e=>e.handle):void 0).then(e=>{let t=this.convertTransferChildren(i??[],e);return this.postGetChildren(t)},e=>(A_t.is(e)||this.notificationService.error(e),[]))}convertTransferChildren(i,e){let t=Array(i.length);if(e)for(let o of e){let n=o[0];t[n]=o.slice(1)}return t}getItemsToRefresh(i){let e=[],t=[];if(i)for(let o of Object.keys(i)){let n=this.getItem(o);if(n){let r=i[o];if(n.checkbox?.isChecked!==r.checkbox?.isChecked&&t.push(n),this.updateTreeItem(n,r),o===r.handle)e.push(n);else{this.itemsMap.delete(o),this.itemsMap.set(n.handle,n);let s=r.parentHandle?this.itemsMap.get(r.parentHandle):null;s&&e.push(s)}}}return{items:e,checkboxes:t}}getItem(i){return this.itemsMap.get(i)}isEmpty(){return this.itemsMap.size===0}async postGetChildren(i){if(i===void 0)return;let e=[],t=await this.hasResolve;if(i)for(let o of i){let n=[];if(e.push(n),!!o)for(let r of o){let s=new Zj(r,t?l=>this._proxy.$resolve(this.treeViewId,r.handle,l):void 0);this.itemsMap.set(r.handle,s),n.push(s)}}return e}updateTreeItem(i,e){if(e.children=e.children?e.children:void 0,i){let t=Uo([...Object.keys(i instanceof Zj?i.asTreeItem():i),...Object.keys(e)]);for(let o of t)i[o]=e[o];i instanceof Zj&&i.resetResolve()}}};var tF=ae("downloadService");var BLt=class extends C{constructor(e,t){super();this.downloadService=t}$download(e,t){return this.downloadService.download(A.revive(e),A.revive(t))}};BLt=I([vo(Gi.MainThreadDownloadService),m(1,tF)],BLt);var nI=ae("urlService");var p2o=300*1e3,m2o=30*1e3,Ami="extensionUrlHandler.urlToHandle",h2o="extensions.confirmedUriHandlerExtensionIds",keo="extensionUrlHandler.confirmedExtensions";function Eeo(a){return/^[a-z0-9][a-z0-9\-]*\.[a-z0-9][a-z0-9\-]*$/i.test(a)}var HLt=class{constructor(i){this.storageService=i}get extensions(){let i=this.storageService.get(keo,0,"[]");try{return JSON.parse(i)}catch{return[]}}has(i){return this.extensions.indexOf(i)>-1}add(i){this.set([...this.extensions,i])}set(i){this.storageService.store(keo,JSON.stringify(i),0,1)}},Omi=ae("extensionUrlHandler"),J6e=class{static{this.handlers=new Set}static registerHandler(i){return this.handlers.add(i),Z(()=>this.handlers.delete(i))}static getHandler(i){for(let e of this.handlers)if(e.canHandleURL(i))return e}},X6e=class{constructor(i,e,t,o,n,r,s,l,c){this.extensionService=e;this.dialogService=t;this.commandService=o;this.hostService=n;this.storageService=r;this.configurationService=s;this.notificationService=l;this.productService=c;this.extensionHandlers=new Map;this.uriBuffer=new Map;this.userTrustedExtensionsStorage=new HLt(r);let u=MI(It,()=>this.garbageCollect(),m2o),p=this.storageService.get(Ami,1);p&&(this.storageService.remove(Ami,1),this.handleURL(A.revive(JSON.parse(p)),{trusted:!0})),this.disposable=hn(i.registerHandler(this),u);let h=PP.cache;setTimeout(()=>h.forEach(([g,f])=>this.handleURL(g,f)))}async handleURL(i,e){if(!Eeo(i.authority))return!1;let t=J6e.getHandler(i);if(t){let p=await t.handleURL(i);if(p)return p}let o=i.authority,n=this.extensionHandlers.get(Ei.toKey(o)),r;if(n)r=n.extensionDisplayName;else{let p=await this.extensionService.getExtension(o);if(p)r=p.displayName??"";else return await this.handleUnhandledURL(i,o,e),!0}if(!(e?.trusted||this.productService.trustedExtensionProtocolHandlers?.some(p=>mr(p,o))||this.didUserTrustExtension(Ei.toKey(o)))){let p=i.toString(!1),h=p;h.length>40&&(h=`${h.substring(0,30)}...${h.substring(h.length-5)}`);let g=await this.dialogService.confirm({message:d(16900,null,r),checkbox:{label:d(16909,null)},primaryButton:d(16905,null),custom:{markdownDetails:[{markdown:new xe(`<div title="${p}" aria-label='${p}'>${h}</div>`,{supportHtml:!0})}]}});if(!g.confirmed)return!0;g.checkboxChecked&&this.userTrustedExtensionsStorage.add(Ei.toKey(o))}let l=this.extensionHandlers.get(Ei.toKey(o));if(l)return n?!1:await this.handleURLByExtension(o,l,i,e);let c=new Date().getTime(),u=this.uriBuffer.get(Ei.toKey(o));return u||(u=[],this.uriBuffer.set(Ei.toKey(o),u)),u.push({timestamp:c,uri:i}),await this.extensionService.activateByEvent(`onUri:${Ei.toKey(o)}`,1),!0}registerExtensionHandler(i,e){this.extensionHandlers.set(Ei.toKey(i),e);let t=this.uriBuffer.get(Ei.toKey(i))||[];for(let{uri:o}of t)this.handleURLByExtension(i,e,o);this.uriBuffer.delete(Ei.toKey(i))}unregisterExtensionHandler(i){this.extensionHandlers.delete(Ei.toKey(i))}async handleURLByExtension(i,e,t,o){return await e.handleURL(t,o)}async handleUnhandledURL(i,e,t){try{await this.commandService.executeCommand("workbench.extensions.installExtension",e,{justification:{reason:`${d(16902,null)}
${i.toString()}`,action:d(16906,null)},enable:!0,installPreReleaseVersion:this.productService.quality!=="stable"})}catch(n){so(n)||this.notificationService.error(n);return}if(await this.extensionService.getExtension(e))await this.handleURL(i,{...t,trusted:!0});else{if(!(await this.dialogService.confirm({message:d(16907,null,e),primaryButton:d(16908,null)})).confirmed)return;this.storageService.store(Ami,JSON.stringify(i.toJSON()),1,1),await this.hostService.reload()}}garbageCollect(){let i=new Date().getTime(),e=new Map;this.uriBuffer.forEach((t,o)=>{t=t.filter(({timestamp:n})=>i-n<p2o),t.length>0&&e.set(o,t)}),this.uriBuffer=e}didUserTrustExtension(i){return this.userTrustedExtensionsStorage.has(i)?!0:this.getConfirmedTrustedExtensionIdsFromConfiguration().indexOf(i)>-1}getConfirmedTrustedExtensionIdsFromConfiguration(){let i=this.configurationService.getValue(h2o);return Array.isArray(i)?i:[]}dispose(){this.disposable.dispose(),this.extensionHandlers.clear(),this.uriBuffer.clear()}};X6e=I([m(0,nI),m(1,lt),m(2,ct),m(3,ge),m(4,oi),m(5,le),m(6,B),m(7,Ne),m(8,nt)],X6e);we(Omi,X6e,0);var PP=class{static{this.ID="workbench.contrib.extensionUrlBootstrapHandler"}static{this._cache=[]}static get cache(){PP.disposable.dispose();let i=PP._cache;return PP._cache=[],i}constructor(i){PP.disposable=i.registerHandler(this)}async handleURL(i,e){return Eeo(i.authority)?(PP._cache.push([i,e]),!0):!1}};PP=I([m(0,nI)],PP);pt(PP.ID,PP,ut.BlockRestore);var Nmi=class extends K{constructor(){super({id:"workbench.extensions.action.manageAuthorizedExtensionURIs",title:L(16903,"Manage Authorized Extension URIs..."),category:L(16901,"Extensions"),menu:{id:D.CommandPalette,when:ep.toNegated()}})}async run(i){let e=i.get(le),t=i.get(Ge),o=new HLt(e),n=o.extensions.map(s=>({label:s,picked:!0}));if(n.length===0){await t.pick([{label:d(16904,null)}]);return}let r=await t.pick(n,{canPickMany:!0});r&&o.set(r.map(s=>s.label))}};W(Nmi);var _eo=A.parse("trustedDomains:/Trusted Domains"),_Ee="http.linkProtectionTrustedDomains",ULt="http.linkProtectionTrustedDomainsContent";async function Deo(a,i){await a.openEditor({resource:i,languageId:"jsonc",options:{pinned:!0}});let e=a.activeTextEditorControl;if(!pn(e))return;let t=e.getModel();if(!t||!Xe(t.uri,i))return;let o=$le(t.getValue(),!0),n;for(let r=o.scan();r!==17;r=o.scan())if(r===3){n=o.getTokenOffset()+o.getTokenLength();let s=o.scan();s!==17&&s!==4&&(n=o.getTokenOffset());break}if(n!==void 0){let r=t.getPositionAt(n);e.setPosition(r),e.revealPositionInCenter(r)}}var zLt={id:"workbench.action.manageTrustedDomain",description:{description:L(15598,"Manage Trusted Domains"),args:[]},handler:async a=>{let i=a.get(ee);await Deo(i,_eo)}};async function Leo(a,i,e,t,o,n,r){let s=A.parse(i),l=s.authority.split("."),c=l.slice(l.length-2).join("."),u="*."+c,p=[];if(p.push({type:"item",label:d(15602,null,i),id:"trust",toTrust:i,picked:!0}),l.length===4&&l.every(f=>Number.isInteger(+f)||Number.isInteger(+f.split(":")[0]))){if(s.authority.includes(":")){let f=s.authority.split(":")[0];p.push({type:"item",label:d(15601,null,f),toTrust:f+":*",id:"trust"})}}else p.push({type:"item",label:d(15603,null,c),toTrust:u,id:"trust"});p.push({type:"item",label:d(15600,null),toTrust:"*",id:"trust"}),p.push({type:"item",label:d(15599,null),id:"manage"});let g=await t.pick(p,{activeItem:p[0]});if(g&&g.id)switch(g.id){case"manage":{let f=_eo.with({fragment:e.toString()});return await Deo(n,f),a}case"trust":{let f=g.toTrust;if(a.indexOf(f)===-1)return o.remove(ULt,-1),o.store(_Ee,JSON.stringify([...a,f]),-1,0),[...a,f]}}return[]}async function Reo(a){let{defaultTrustedDomains:i,trustedDomains:e}=DEe(a);return{defaultTrustedDomains:i,trustedDomains:e}}function DEe(a){let i=a.get(le),e=a.get(nt),t=a.get(ru),o=[...e.linkProtectionTrustedDomains??[],...t.options?.additionalTrustedDomains??[]],n=[];try{let r=i.get(_Ee,-1);r&&(n=JSON.parse(r))}catch{}return{defaultTrustedDomains:o,trustedDomains:n}}function Fmi(a){let i=typeof a=="string"?A.parse(a):a;return i.with({path:i.path.replace(/\/+$/,""),query:null,fragment:null})}function LEe(a,i){let e=Fmi(a),t;if(/^[^./:]*:\/\//.test(i))t=Fmi(i);else{if(e.scheme!=="http"&&e.scheme!=="https")return!1;t=Fmi(`${e.scheme}://${i}`)}return Wmi(e.scheme,t.scheme)&&Wmi(e.authority,t.authority,!0)&&(t.path==="/"||Wmi(e.path,t.path))}function Wmi(a,i,e=!1){let t=Array.from({length:a.length+1}).map(()=>Array.from({length:i.length+1}).map(()=>{}));return w5(t,e,a,i,0,0)}function w5(a,i,e,t,o,n){if(a[o]?.[n]!==void 0)return a[o][n];let r=[];if(o===e.length)return n===t.length?!0:i&&t[n]+t[n+1]===":*"?n+2===t.length:!1;if(n===t.length)return e.slice(o)[0]==="/";if(e[o]===t[n]&&r.push(w5(a,i,e,t,o+1,n+1)),t[n]+t[n+1]==="*."&&(["/",":"].includes(e[o])||r.push(w5(a,i,e,t,o+1,n)),r.push(w5(a,i,e,t,o,n+2))),t[n]==="*"&&(o+1===e.length?r.push(w5(a,i,e,t,o+1,n+1)):r.push(w5(a,i,e,t,o+1,n)),r.push(w5(a,i,e,t,o,n+1))),i&&t[n]+t[n+1]===":*")if(e[o]===":"){let s=o+1;do s++;while(/[0-9]/.test(e[s]));r.push(w5(a,i,e,t,s,n+2))}else r.push(w5(a,i,e,t,o,n+2));return a[o][n]=r.some(s=>s===!0)}function KLt(a,i){if(a=A.parse(e9e(a)),i=i.map(e9e),t9e(a.authority))return!0;for(let e=0;e<i.length;e++)if(i[e]==="*"||LEe(a,i[e]))return!0;return!1}function e9e(a){let i=["github.com"];try{let e=typeof a=="string"?A.parse(a,!0):a;return i.includes(e.authority)?e.with({path:e.path.toLowerCase()}).toString(!0):e.toString(!0)}catch{return a.toString()}}var g2o=/^(.+\.)?localhost(:\d+)?$/i,f2o=/^127.0.0.1(:\d+)?$/,v2o=/^\[::1\](:\d+)?$/;function t9e(a){return g2o.test(a)||f2o.test(a)||v2o.test(a)}var _V=ae("ITrustedDomainService");var REe=class extends C{constructor(e,t){super();this._instantiationService=e;this._storageService=t;this._onDidChangeTrustedDomains=this._register(new E);this.onDidChangeTrustedDomains=this._onDidChangeTrustedDomains.event;let o=()=>new hN(It,()=>{let{defaultTrustedDomains:n,trustedDomains:r}=this._instantiationService.invokeFunction(DEe);return[...n,...r]});this._staticTrustedDomainsResult=o(),this._register(this._storageService.onDidChangeValue(-1,_Ee,this._store)(()=>{this._staticTrustedDomainsResult?.dispose(),this._staticTrustedDomainsResult=o(),this._onDidChangeTrustedDomains.fire()}))}get trustedDomains(){return this._staticTrustedDomainsResult.value}isValid(e){let{defaultTrustedDomains:t,trustedDomains:o}=this._instantiationService.invokeFunction(DEe),n=[...t,...o];return KLt(e,n)}};REe=I([m(0,F),m(1,le)],REe);var Vmi=class{constructor(i,e,t,o){this.proxy=i;this.handle=e;this.extensionId=t;this.extensionDisplayName=o}async handleURL(i,e){return Ei.equals(this.extensionId,i.authority)?(await this.proxy.$handleExternalUri(this.handle,i),!0):!1}},GLt=class extends C{constructor(e,t,o,n){super();this.urlService=o;this.extensionUrlHandler=n;this.handlers=new Map;this.proxy=e.getProxy(Zi.ExtHostUrls)}async $registerUriHandler(e,t,o){let n=new Vmi(this.proxy,e,t,o),r=this.urlService.registerHandler(n);this.handlers.set(e,{extensionId:t,disposable:r}),this.extensionUrlHandler.registerExtensionHandler(t,n)}async $unregisterUriHandler(e){let t=this.handlers.get(e);if(!t)return;let{extensionId:o,disposable:n}=t;this.extensionUrlHandler.unregisterExtensionHandler(o),this.handlers.delete(e),n.dispose()}async $createAppUri(e){return this.urlService.create(e)}dispose(){super.dispose(),this.handlers.forEach(({disposable:e})=>e.dispose()),this.handlers.clear()}};GLt=I([vo(Gi.MainThreadUrls),m(1,_V),m(2,nI),m(3,Omi)],GLt);var wde="default",$Lt="workbench.externalUriOpeners",Bmi={type:"string",enum:[]},Meo="\n- `https://microsoft.com`: Matches this specific domain using https\n- `https://microsoft.com:8080`: Matches this specific domain on this port using https\n- `https://microsoft.com:*`: Matches this specific domain on any port using https\n- `https://microsoft.com/foo`: Matches `https://microsoft.com/foo` and `https://microsoft.com/foo/bar`, but not `https://microsoft.com/foobar` or `https://microsoft.com/bar`\n- `https://*.microsoft.com`: Match all domains ending in `microsoft.com` using https\n- `microsoft.com`: Match this specific domain using either http or https\n- `*.microsoft.com`: Match all domains ending in `microsoft.com` using either http or https\n- `http://192.168.0.1`: Matches this specific IP using http\n- `http://192.168.0.*`: Matches all IP's with this prefix using http\n- `*`: Match all domains using either http or https",Hmi={...Cm,properties:{[$Lt]:{type:"object",markdownDescription:d(10135,null),defaultSnippets:[{body:{"example.com":"$1"}}],additionalProperties:{anyOf:[{type:"string",markdownDescription:d(10137,null,Meo)},{type:"string",markdownDescription:d(10137,null,Meo),enum:[wde],enumDescriptions:[d(10136,null)]},Bmi]}}}};function Peo(a,i){Bmi.enum=a,Bmi.enumDescriptions=i,oe.as(ii.Configuration).notifyConfigurationSchemaUpdated(Hmi)}var AX=class extends C{constructor(e,t){super();this._extensionService=t;this._openers=new Map;this._memento=new Bl(AX.STORAGE_ID,e),this._mementoObject=this._memento.getMemento(0,1);for(let[o,n]of Object.entries(this._mementoObject||{}))n&&this.add(o,n.extensionId,{isCurrentlyRegistered:!1});this.invalidateOpenersOnExtensionsChanged(),this._register(this._extensionService.onDidChangeExtensions(()=>this.invalidateOpenersOnExtensionsChanged())),this._register(this._extensionService.onDidChangeExtensionsStatus(()=>this.invalidateOpenersOnExtensionsChanged()))}static{this.STORAGE_ID="externalUriOpeners"}didRegisterOpener(e,t){this.add(e,t,{isCurrentlyRegistered:!0})}add(e,t,o){let n=this._openers.get(e);if(n){n.isCurrentlyRegistered=n.isCurrentlyRegistered||o.isCurrentlyRegistered;return}let r={extensionId:t,isCurrentlyRegistered:o.isCurrentlyRegistered};this._openers.set(e,r),this._mementoObject[e]=r,this._memento.saveMemento(),this.updateSchema()}delete(e){this._openers.delete(e),delete this._mementoObject[e],this._memento.saveMemento(),this.updateSchema()}async invalidateOpenersOnExtensionsChanged(){await this._extensionService.whenInstalledExtensionsRegistered();let e=this._extensionService.extensions;for(let[t,o]of this._openers){let n=e.find(r=>r.identifier.value===o.extensionId);n?this._extensionService.canRemoveExtension(n)||o.isCurrentlyRegistered||this.delete(t):this.delete(t)}}updateSchema(){let e=[],t=[];for(let[o,n]of this._openers)e.push(o),t.push(n.extensionId);Peo(e,t)}};AX=I([m(0,le),m(1,lt)],AX);var Aeo=244;function MEe(a){return{...a,override:Ys.id,pinned:!0}}var Po=ae("preferencesService"),qLt="editor.contrib.defineKeybinding",PEe=".vscode/settings.json",i9e="workbench.settings.openDefaultSettings",o9e="workbench.settings.useSplitJSON",Umi="workbench.settings.alwaysShowAdvancedSettings",AEe="settings";var NX=ae("externalUriOpenerService"),NEe=class extends C{constructor(e,t,o,n,r){super();this.configurationService=t;this.logService=o;this.preferencesService=n;this.quickInputService=r;this._providers=new Vs;this._register(e.registerExternalOpener(this))}registerExternalOpenerProvider(e){return{dispose:this._providers.push(e)}}async getOpeners(e,t,o,n){let r=await this.getAllOpenersForUri(e);if(r.size===0)return[];if(o.preferredOpenerId){if(o.preferredOpenerId===wde)return[];let u=r.get(o.preferredOpenerId);if(u)return[u]}let s=this.getConfiguredOpenerForUri(r,e);if(s)return s===wde?[]:[s];let l=[];if(await Promise.all(Array.from(r.values()).map(async u=>{let p;try{p=await u.canOpen(o.sourceUri,n)}catch(h){this.logService.error(h);return}switch(p){case 1:case 2:case 3:l.push({opener:u,priority:p});break}})),l.length===0)return[];let c=l.filter(u=>u.priority===3).at(0);return c?[c.opener]:!t&&l.every(u=>u.priority===1)?[]:l.map(u=>u.opener)}async openExternal(e,t,o){let n=typeof e=="string"?A.parse(e):e,r=await this.getOpeners(n,!1,t,o);return r.length===0?!1:r.length===1?r[0].openExternalUri(n,t,o):this.showOpenerPrompt(r,n,t,o)}async getOpener(e,t,o){let n=await this.getOpeners(e,!0,t,o);if(n.length>=1)return n[0]}async getAllOpenersForUri(e){let t=new Map;return await Promise.all(ht.map(this._providers,async o=>{for await(let n of o.getOpeners(e))t.set(n.id,n)})),t}getConfiguredOpenerForUri(e,t){let o=this.configurationService.getValue($Lt)||{};for(let[n,r]of Object.entries(o))if(LEe(t,n)){if(r===wde)return"default";let s=e.get(r);if(s)return s}}async showOpenerPrompt(e,t,o,n){let r=e.map(l=>({label:l.label,opener:l}));r.push({label:Gt?d(10140,null):d(10139,null),opener:void 0},{type:"separator"},{label:d(10138,null),opener:"configureDefault"});let s=await this.quickInputService.pick(r,{placeHolder:d(10141,null,t.toString())});return s?typeof s.opener>"u"?!1:s.opener==="configureDefault"?(await this.preferencesService.openUserSettings({jsonEditor:!0,revealSetting:{key:$Lt,edit:!0}}),!0):s.opener.openExternalUri(t,o,n):!0}};NEe=I([m(0,Qe),m(1,B),m(2,ne),m(3,Po),m(4,Ge)],NEe);var jLt=class extends C{constructor(e,t,o,n,r,s){super();this.extensionService=n;this.openerService=r;this.notificationService=s;this._registeredOpeners=new Map;this.proxy=e.getProxy(Zi.ExtHostUriOpeners),this._register(o.registerExternalOpenerProvider(this)),this._contributedExternalUriOpenersStore=this._register(new AX(t,n))}async*getOpeners(e){if(!(e.scheme!==Y.http&&e.scheme!==Y.https)){await this.extensionService.activateByEvent(`onOpenExternalUri:${e.scheme}`);for(let[t,o]of this._registeredOpeners)o.schemes.has(e.scheme)&&(yield this.createOpener(t,o))}}createOpener(e,t){return{id:e,label:t.label,canOpen:(o,n)=>this.proxy.$canOpenUri(e,o,n),openExternalUri:async(o,n,r)=>{try{await this.proxy.$openUri(e,{resolvedUri:o,sourceUri:n.sourceUri},r)}catch(s){if(!so(s)){let l=new st("default",d(3063,null),void 0,void 0,async()=>{await this.openerService.open(o,{allowTunneling:!1,allowContributedOpeners:wde})});l.tooltip=o.toString(),this.notificationService.notify({severity:St.Error,message:d(3062,null,e,s.toString()),actions:{primary:[l]}})}}return!0}}}async $registerUriOpener(e,t,o,n){if(this._registeredOpeners.has(e))throw new Error(`Opener with id '${e}' already registered`);this._registeredOpeners.set(e,{schemes:new Set(t),label:n,extensionId:o}),this._contributedExternalUriOpenersStore.didRegisterOpener(e,o.value)}async $unregisterUriOpener(e){this._registeredOpeners.delete(e),this._contributedExternalUriOpenersStore.delete(e)}dispose(){super.dispose(),this._registeredOpeners.clear()}};jLt=I([vo(Gi.MainThreadUriOpeners),m(1,le),m(2,NX),m(3,lt),m(4,Qe),m(5,Ne)],jLt);var zmi=class{constructor(){this.todo=[];this.add=i=>{this.todo.push(i)}}take(i,e){this.add=t=>e.createInstance(t,i),this.todo.forEach(this.add),this.todo=[]}},QLt=new zmi;var b2o=1e4,Cde=ae("IUserActivityService"),n9e=class extends C{constructor(e){super();this.markInactive=this._register(new Dt(()=>{this.isActive=!1,this.changeEmitter.fire(!1)},b2o));this.changeEmitter=this._register(new E);this.active=0;this.isActive=!0;this.onDidChangeIsActive=this.changeEmitter.event;this._register(aN(()=>QLt.take(this,e)))}markActive(e){if(e?.extendOnly&&!this.isActive)return C.None;if(e?.whenHeldFor){let t=new P;return t.add(nn(()=>t.add(this.markActive()),e.whenHeldFor)),t}return++this.active===1&&(this.isActive=!0,this.changeEmitter.fire(!0),this.markInactive.cancel()),Z(()=>{--this.active===0&&this.markInactive.schedule()})}};n9e=I([m(0,F)],n9e);we(Cde,n9e,1);var YLt=class{constructor(i,e,t,o){this.hostService=e;this.openerService=t;this.userActivityService=o;this.disposables=new P;this.proxy=i.getProxy(Zi.ExtHostWindow),H.latch(e.onDidChangeFocus)(this.proxy.$onDidChangeWindowFocus,this.proxy,this.disposables),o.onDidChangeIsActive(this.proxy.$onDidChangeWindowActive,this.proxy,this.disposables),this.registerNativeHandle()}dispose(){this.disposables.dispose()}registerNativeHandle(){H.latch(this.hostService.onDidChangeActiveWindow)(async i=>{let e=await this.hostService.getNativeWindowHandle(i);this.proxy.$onDidChangeActiveNativeWindowHandle(e?Qd(e):void 0)},this,this.disposables)}$getInitialState(){return Promise.resolve({isFocused:this.hostService.hasFocus,isActive:this.userActivityService.isActive})}async $openUri(i,e,t){let o=A.from(i),n;return e&&A.parse(e).toString()===o.toString()?n=e:n=o,this.openerService.open(n,{openExternal:!0,allowTunneling:t.allowTunneling,allowContributedOpeners:t.allowContributedOpeners})}async $asExternalUri(i,e){return(await this.openerService.resolveExternalUri(A.revive(i),e)).resolved}};YLt=I([vo(Gi.MainThreadWindow),m(1,oi),m(2,Qe),m(3,Cde)],YLt);var XLt=ae("powerService");var JLt=class extends C{constructor(e,t){super();this.powerService=t;this.proxy=e.getProxy(Zi.ExtHostPower),this._register(this.powerService.onDidSuspend(this.proxy.$onDidSuspend,this.proxy)),this._register(this.powerService.onDidResume(this.proxy.$onDidResume,this.proxy)),this._register(this.powerService.onDidChangeOnBatteryPower(this.proxy.$onDidChangeOnBatteryPower,this.proxy)),this._register(this.powerService.onDidChangeThermalState(o=>this.proxy.$onDidChangeThermalState(o),this)),this._register(this.powerService.onDidChangeSpeedLimit(this.proxy.$onDidChangeSpeedLimit,this.proxy)),this._register(this.powerService.onWillShutdown(this.proxy.$onWillShutdown,this.proxy)),this._register(this.powerService.onDidLockScreen(this.proxy.$onDidLockScreen,this.proxy)),this._register(this.powerService.onDidUnlockScreen(this.proxy.$onDidUnlockScreen,this.proxy))}async $getSystemIdleState(e){return this.powerService.getSystemIdleState(e)}async $getSystemIdleTime(){return this.powerService.getSystemIdleTime()}async $getCurrentThermalState(){return this.powerService.getCurrentThermalState()}async $isOnBatteryPower(){return this.powerService.isOnBatteryPower()}async $startPowerSaveBlocker(e){return this.powerService.startPowerSaveBlocker(e)}async $stopPowerSaveBlocker(e){return this.powerService.stopPowerSaveBlocker(e)}async $isPowerSaveBlockerStarted(e){return this.powerService.isPowerSaveBlockerStarted(e)}};JLt=I([vo(Gi.MainThreadPower),m(1,XLt)],JLt);var OX=class extends C{constructor(e,t,o,n,r,s){super();this.viewType=e;this._resource=t;this._model=o;this.textFileService=n;this._labelService=r;this._onDidChangeOrphaned=this._register(new E);this.onDidChangeOrphaned=this._onDidChangeOrphaned.event;this._onDidChangeReadonly=this._register(new E);this.onDidChangeReadonly=this._onDidChangeReadonly.event;this._onDidChangeDirty=this._register(new E);this.onDidChangeDirty=this._onDidChangeDirty.event;this._onDidChangeContent=this._register(new E);this.onDidChangeContent=this._onDidChangeContent.event;this._register(o),this._textFileModel=this.textFileService.files.get(t),this._textFileModel&&(this._register(this._textFileModel.onDidChangeOrphaned(()=>this._onDidChangeOrphaned.fire())),this._register(this._textFileModel.onDidChangeReadonly(()=>this._onDidChangeReadonly.fire()))),this._register(this.textFileService.files.onDidChangeDirty(l=>{Xe(this.resource,l.resource)&&(this._onDidChangeDirty.fire(),this._onDidChangeContent.fire())})),this._register(s.onWillStop(l=>{l.veto(!0,d(8573,null,this.name))}))}static async create(e,t,o){return e.invokeFunction(async n=>{let s=await n.get(Nt).createModelReference(o);return e.createInstance(OX,t,o,s)})}get resource(){return this._resource}get name(){return No(this._labelService.getUriLabel(this._resource))}isReadonly(){return this._model.object.isReadonly()}get backupId(){}get canHotExit(){return!0}isDirty(){return this.textFileService.isDirty(this.resource)}isOrphaned(){return!!this._textFileModel?.hasState(4)}async revert(e){return this.textFileService.revert(this.resource,e)}saveCustomEditor(e){return this.textFileService.save(this.resource,e)}async saveCustomEditorAs(e,t,o){return!!await this.textFileService.saveAs(e,t,o)}};OX=I([m(3,Ho),m(4,ot),m(5,lt)],OX);var FX=class extends C{constructor(e,t){super();this.resource=e;this.fileService=t;this._onDidChangeOrphaned=this._register(new E);this.onDidChangeOrphaned=this._onDidChangeOrphaned.event;this.orphaned=!1;this._onWillDispose=this._register(new E);this.onWillDispose=this._onWillDispose.event;this._register(this.fileService.onDidFilesChange(o=>this.onDidFilesChange(o)))}isOrphaned(){return this.orphaned}async onDidFilesChange(e){let t=!1,o;if(this.orphaned?e.contains(this.resource,1)&&(o=!1,t=!0):e.contains(this.resource,2)&&(o=!0,t=!0),t&&this.orphaned!==o){let n=!1;o&&(await Pi(100,ve.None),this.isDisposed()?n=!0:n=!await this.fileService.exists(this.resource)),this.orphaned!==n&&!this.isDisposed()&&this.setOrphaned(n)}}setOrphaned(e){this.orphaned!==e&&(this.orphaned=e,this._onDidChangeOrphaned.fire())}isDisposed(){return this._store.isDisposed}dispose(){this.orphaned=!1,this._onWillDispose.fire(),super.dispose()}isModified(){return this.isDirty()}};FX=I([m(1,be)],FX);var FEe=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.mainThreadWebview=t;this.mainThreadWebviewPanels=o;this._customEditorService=c;this._editorGroupService=u;this._editorService=p;this._instantiationService=h;this._webviewWorkbenchService=g;this._uriIdentityService=f;this._editorProviders=this._register(new jt);this._editorRenameBackups=new Map;this._webviewOriginStore=new vz("mainThreadCustomEditors.origins",r),this._proxyCustomEditors=e.getProxy(Zi.ExtHostCustomEditors),this._register(l.registerWorkingCopyProvider(v=>{let b=[];for(let S of s.workingCopies)S instanceof DV&&La(v,S.editorResource)&&b.push(S);return b})),this._register(g.registerResolver({canResolve:v=>(v instanceof Yp&&n.activateByEvent(`onCustomEditor:${v.viewType}`),!1),resolveWebview:()=>{throw new Error("not implemented")}})),this._register(l.onWillRunWorkingCopyFileOperation(async v=>this.onWillRunWorkingCopyFileOperation(v)))}$registerTextEditorProvider(e,t,o,n,r){this.registerEditorProvider(1,Pce(e),t,o,n,!0,r)}$registerCustomEditorProvider(e,t,o,n,r){this.registerEditorProvider(0,Pce(e),t,o,{},n,r)}registerEditorProvider(e,t,o,n,r,s,l){if(this._editorProviders.has(o))throw new Error(`Provider for ${o} already registered`);let c=new P;c.add(this._customEditorService.registerCustomEditorCapabilities(o,{supportsMultipleEditorsPerDocument:s})),c.add(this._webviewWorkbenchService.registerResolver({canResolve:u=>u instanceof Yp&&u.viewType===o,resolveWebview:async(u,p)=>{let h=_t(),g=u.resource;u.webview.origin=this._webviewOriginStore.getOrigin(o,t.id),this.mainThreadWebviewPanels.addWebviewInput(h,u,{serializeBuffersForPostMessage:l}),u.webview.options=n,u.webview.extension=t;let f=u.backupId;u.oldResource&&!u.backupId&&(f=this._editorRenameBackups.get(u.oldResource.toString())?.backupId,this._editorRenameBackups.delete(u.oldResource.toString()));let v;try{v=await this.getOrCreateCustomEditorModel(e,g,o,{backupId:f},p)}catch(y){mt(y),u.webview.setHtml(this.mainThreadWebview.getWebviewResolvedFailedContent(o));return}if(p.isCancellationRequested){v.dispose();return}let b=u.webview.onDidDispose(()=>{if(b.dispose(),S.dispose(),v.object.isDirty()){let y=v.object.onDidChangeDirty(()=>{v.object.isDirty()||(y.dispose(),v.dispose())});return}v.dispose()}),S=u.onWillDispose(()=>{S.dispose(),b.dispose(),v.dispose()});r.supportsMove&&u.onMove(async y=>{let w=v;v=await this.getOrCreateCustomEditorModel(e,y,o,{},ve.None),this._proxyCustomEditors.$onMoveCustomEditor(h,y,o),w.dispose()});try{let y=e===1?this._uriIdentityService.asCanonicalUri(g):g;await this._proxyCustomEditors.$resolveCustomEditor(y,h,o,{title:u.getTitle(),contentOptions:u.webview.contentOptions,options:u.webview.options,active:u===this._editorService.activeEditor},bC(this._editorGroupService,u.group||0),p)}catch(y){mt(y),u.webview.setHtml(this.mainThreadWebview.getWebviewResolvedFailedContent(o)),v.dispose();return}}})),this._editorProviders.set(o,c)}$unregisterEditorProvider(e){if(!this._editorProviders.has(e))throw new Error(`No provider for ${e} registered`);this._editorProviders.deleteAndDispose(e),this._customEditorService.models.disposeAllModelsForView(e)}async getOrCreateCustomEditorModel(e,t,o,n,r){let s=this._customEditorService.models.tryRetain(t,o);if(s)return s;switch(e){case 1:{let l=OX.create(this._instantiationService,o,t);return this._customEditorService.models.add(t,o,l)}case 0:{let l=DV.create(this._instantiationService,this._proxyCustomEditors,o,t,n,()=>Array.from(this.mainThreadWebviewPanels.webviewInputs).filter(c=>c instanceof Yp&&Xe(c.resource,t)),r);return this._customEditorService.models.add(t,o,l)}}}async $onDidEdit(e,t,o,n){(await this.getCustomEditorModel(e,t)).pushEdit(o,n)}async $onContentChange(e,t){(await this.getCustomEditorModel(e,t)).changeContent()}async getCustomEditorModel(e,t){let o=A.revive(e),n=await this._customEditorService.models.get(o,t);if(!n||!(n instanceof DV))throw new Error("Could not find model for webview editor");return n}async onWillRunWorkingCopyFileOperation(e){e.operation===2&&e.waitUntil((async()=>{let t=[];for(let o of e.files)o.source&&t.push(...await this._customEditorService.models.getAllModels(o.source));for(let o of t)if(o instanceof DV&&o.isDirty()){let n=await o.backup(ve.None);n.meta&&this._editorRenameBackups.set(o.editorResource.toString(),n.meta)}})())}};FEe=I([m(3,lt),m(4,le),m(5,Wa),m(6,kp),m(7,tX),m(8,Et),m(9,ee),m(10,F),m(11,V_),m(12,dt)],FEe);var OEe;(o=>{let a;(l=>(l[l.Allowed=0]="Allowed",l[l.NotAllowed=1]="NotAllowed",l[l.Pending=2]="Pending"))(a=o.Type||={}),o.Allowed=Object.freeze({type:0}),o.NotAllowed=Object.freeze({type:1});class t{constructor(r){this.operation=r;this.type=2}}o.Pending=t})(OEe||={});var DV=class extends FX{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super(DV.toWorkingCopyResource(t,o),u);this._proxy=e;this._viewType=t;this._editorResource=o;this._editable=r;this._getEditors=l;this._fileDialogService=c;this._labelService=p;this._undoService=h;this._environmentService=g;this._pathService=v;this._fromBackup=!1;this._hotExitState=OEe.Allowed;this._currentEditIndex=-1;this._savePoint=-1;this._edits=[];this.typeId=CP;this._onDidChangeDirty=this._register(new E);this.onDidChangeDirty=this._onDidChangeDirty.event;this._onDidChangeContent=this._register(new E);this.onDidChangeContent=this._onDidChangeContent.event;this._onDidSave=this._register(new E);this.onDidSave=this._onDidSave.event;this.onDidChangeReadonly=H.None;this._fromBackup=n,this._isDirtyFromContentChange=s,r&&(this._register(f.registerWorkingCopy(this)),this._register(b.onWillStop(S=>{S.veto(!0,d(3008,null,this.name))})))}static async create(e,t,o,n,r,s,l){let c=s(),u;c.length!==0&&(u=c[0].untitledDocumentData);let{editable:p}=await t.$createCustomDocument(n,o,r.backupId,u,l);return e.createInstance(DV,t,o,n,!!r.backupId,p,!!u,s)}get editorResource(){return this._editorResource}dispose(){this._editable&&this._undoService.removeElements(this._editorResource),this._proxy.$disposeCustomDocument(this._editorResource,this._viewType),super.dispose()}static toWorkingCopyResource(e,t){let o=e.replace(/[^a-z0-9\-_]/gi,"-"),n=`/${m6(t.with({query:null,fragment:null}).toString(!0))}`;return A.from({scheme:Y.vscodeCustomEditor,authority:o,path:n,query:JSON.stringify(t.toJSON())})}get name(){return No(this._labelService.getUriLabel(this._editorResource))}get capabilities(){return this.isUntitled()?2:0}isDirty(){return this._isDirtyFromContentChange?!0:this._edits.length>0?this._savePoint!==this._currentEditIndex:this._fromBackup}isUntitled(){return this._editorResource.scheme===Y.untitled}isReadonly(){return!this._editable}get viewType(){return this._viewType}get backupId(){return this._backupId}pushEdit(e,t){if(!this._editable)throw new Error("Document is not editable");this.change(()=>{this.spliceEdits(e),this._currentEditIndex=this._edits.length-1}),this._undoService.pushElement({type:0,resource:this._editorResource,label:t??d(3007,null),code:"undoredo.customEditorEdit",undo:()=>this.undo(),redo:()=>this.redo()})}changeContent(){this.change(()=>{this._isDirtyFromContentChange=!0})}async undo(){if(!this._editable||this._currentEditIndex<0)return;let e=this._edits[this._currentEditIndex];this.change(()=>{--this._currentEditIndex}),await this._proxy.$undo(this._editorResource,this.viewType,e,this.isDirty())}async redo(){if(!this._editable||this._currentEditIndex>=this._edits.length-1)return;let e=this._edits[this._currentEditIndex+1];this.change(()=>{++this._currentEditIndex}),await this._proxy.$redo(this._editorResource,this.viewType,e,this.isDirty())}spliceEdits(e){let t=this._currentEditIndex+1,o=this._edits.length-this._currentEditIndex,n=typeof e=="number"?this._edits.splice(t,o,e):this._edits.splice(t,o);n.length&&this._proxy.$disposeEdits(this._editorResource,this._viewType,n)}change(e){let t=this.isDirty();e(),this._onDidChangeContent.fire(),this.isDirty()!==t&&this._onDidChangeDirty.fire()}async revert(e){this._editable&&(this._currentEditIndex===this._savePoint&&!this._isDirtyFromContentChange&&!this._fromBackup||(e?.soft||this._proxy.$revert(this._editorResource,this.viewType,ve.None),this.change(()=>{this._isDirtyFromContentChange=!1,this._fromBackup=!1,this._currentEditIndex=this._savePoint,this.spliceEdits()})))}async save(e){let t=!!await this.saveCustomEditor(e);return t&&this._onDidSave.fire({reason:e?.reason,source:e?.source}),t}async saveCustomEditor(e){if(!this._editable)return;if(this.isUntitled()){let o=await this.suggestUntitledSavePath(e);return o?(await this.saveCustomEditorAs(this._editorResource,o,e),o):void 0}let t=xn(o=>this._proxy.$onSave(this._editorResource,this.viewType,o));this._ongoingSave?.cancel(),this._ongoingSave=t;try{await t,this._ongoingSave===t&&this.change(()=>{this._isDirtyFromContentChange=!1,this._savePoint=this._currentEditIndex,this._fromBackup=!1})}finally{this._ongoingSave===t&&(this._ongoingSave=void 0)}return this._editorResource}suggestUntitledSavePath(e){if(!this.isUntitled())throw new Error("Resource is not untitled");let t=this._environmentService.remoteAuthority,o=Og(this._editorResource,t,this._pathService.defaultUriScheme);return this._fileDialogService.pickFileToSave(o,e?.availableFileSystems)}async saveCustomEditorAs(e,t,o){return this._editable?(await xn(n=>this._proxy.$onSaveAs(this._editorResource,this.viewType,t,n)),this.change(()=>{this._isDirtyFromContentChange=!1,this._savePoint=this._currentEditIndex,this._fromBackup=!1}),!0):(await this.fileService.copy(e,t,!1),!0)}get canHotExit(){return typeof this._backupId=="string"&&this._hotExitState.type===0}async backup(e){let t=this._getEditors();if(!t.length)throw new Error("No editors found for resource, cannot back up");let o=t[0],r={meta:{viewType:this.viewType,editorResource:this._editorResource,customTitle:o.getWebviewTitle(),iconPath:o.iconPath,backupId:"",extension:o.extension?{id:o.extension.id.value,location:o.extension.location}:void 0,webview:{origin:o.webview.origin,options:o.webview.options,state:o.webview.state}}};if(!this._editable)return r;this._hotExitState.type===2&&this._hotExitState.operation.cancel();let s=new OEe.Pending(xn(c=>this._proxy.$backup(this._editorResource.toJSON(),this.viewType,c)));this._hotExitState=s,e.onCancellationRequested(()=>{s.operation.cancel()});let l="";try{let c=await s.operation;this._hotExitState===s&&(this._hotExitState=OEe.Allowed,r.meta.backupId=c,this._backupId=c)}catch(c){if(so(c))throw c;this._hotExitState===s&&(this._hotExitState=OEe.NotAllowed),c.message&&(l=c.message)}if(this._hotExitState===OEe.Allowed)return r;throw new Error(`Cannot backup in this state: ${l}`)}};DV=I([m(7,dn),m(8,be),m(9,ot),m(10,Cl),m(11,Vt),m(12,Wa),m(13,wn),m(14,lt)],DV);var Kmi=class{constructor(){this._handlesToInputs=new Map;this._inputsToHandles=new Map}add(i,e){this._handlesToInputs.set(i,e),this._inputsToHandles.set(e,i)}getHandleForInput(i){return this._inputsToHandles.get(i)}getInputForHandle(i){return this._handlesToInputs.get(i)}delete(i){let e=this.getInputForHandle(i);this._handlesToInputs.delete(i),e&&this._inputsToHandles.delete(e)}get size(){return this._handlesToInputs.size}[Symbol.iterator](){return this._handlesToInputs.values()}},Gmi=class{constructor(i){this.prefix=i}fromExternal(i){return this.prefix+i}toExternal(i){return i.startsWith(this.prefix)?i.substr(this.prefix.length):void 0}},WEe=class extends C{constructor(e,t,o,n,r,s,l,c){super();this._mainThreadWebviews=t;this._configurationService=o;this._editorGroupService=n;this._editorService=r;this._webviewWorkbenchService=c;this.webviewPanelViewType=new Gmi("mainThreadWebview-");this._webviewInputs=new Kmi;this._revivers=this._register(new jt);this.webviewOriginStore=new vz("mainThreadWebviewPanel.origins",l),this._proxy=e.getProxy(Zi.ExtHostWebviewPanels),this._register(H.any(r.onDidActiveEditorChange,r.onDidVisibleEditorsChange,n.onDidAddGroup,n.onDidRemoveGroup,n.onDidMoveGroup)(()=>{this.updateWebviewViewStates(this._editorService.activeEditor)})),this._register(c.onDidChangeActiveWebviewEditor(u=>{this.updateWebviewViewStates(u)})),this._register(c.registerResolver({canResolve:u=>{let p=this.webviewPanelViewType.toExternal(u.viewType);return typeof p=="string"&&s.activateByEvent(`onWebviewPanel:${p}`),!1},resolveWebview:()=>{throw new Error("not implemented")}}))}get webviewInputs(){return this._webviewInputs}addWebviewInput(e,t,o){this._webviewInputs.add(e,t),this._mainThreadWebviews.addWebview(e,t.webview,o);let n=t.webview.onDidDispose(()=>{n.dispose(),this._proxy.$onDidDisposeWebviewPanel(e).finally(()=>{this._webviewInputs.delete(e)})})}$createWebviewPanel(e,t,o,n,r){let s=this.getTargetGroupFromShowOptions(r),l=r?{preserveFocus:!!r.preserveFocus,group:s}:{},c=Pce(e),u=this.webviewOriginStore.getOrigin(o,c.id),p=this._webviewWorkbenchService.openWebview({origin:u,providedViewType:o,title:n.title,options:I2o(n.panelOptions),contentOptions:fke(n.webviewOptions),extension:c},this.webviewPanelViewType.fromExternal(o),n.title,void 0,l);this.addWebviewInput(t,p,{serializeBuffersForPostMessage:n.serializeBuffersForPostMessage})}$disposeWebview(e){let t=this.tryGetWebviewInput(e);t&&t.dispose()}$setTitle(e,t){this.tryGetWebviewInput(e)?.setWebviewTitle(t)}$setIconPath(e,t){let o=this.tryGetWebviewInput(e);o&&(o.iconPath=S2o(t))}$reveal(e,t){let o=this.tryGetWebviewInput(e);if(!o||o.isDisposed())return;let n=this.getTargetGroupFromShowOptions(t);this._webviewWorkbenchService.revealWebview(o,n,!!t.preserveFocus)}getTargetGroupFromShowOptions(e){if(typeof e.viewColumn>"u"||e.viewColumn===Un||this._editorGroupService.count===1&&this._editorGroupService.activeGroup.isEmpty)return Un;if(e.viewColumn===vn)return vn;if(e.viewColumn>=0){let t=this._editorGroupService.getGroups(2)[e.viewColumn];if(t)return t.id;let o=this._editorGroupService.findGroup({location:1});if(o){let n=pC(this._configurationService);return this._editorGroupService.addGroup(o,n)}}return Un}$registerSerializer(e,t){if(this._revivers.has(e))throw new Error(`Reviver for ${e} already registered`);this._revivers.set(e,this._webviewWorkbenchService.registerResolver({canResolve:o=>o.viewType===this.webviewPanelViewType.fromExternal(e),resolveWebview:async o=>{let n=this.webviewPanelViewType.toExternal(o.viewType);if(!n){o.webview.setHtml(this._mainThreadWebviews.getWebviewResolvedFailedContent(o.viewType));return}let r=_t();this.addWebviewInput(r,o,t);let s;if(o.webview.state)try{s=JSON.parse(o.webview.state)}catch(l){console.error("Could not load webview state",l,o.webview.state)}try{await this._proxy.$deserializeWebviewPanel(r,n,{title:o.getTitle(),state:s,panelOptions:o.webview.options,webviewOptions:o.webview.contentOptions,active:o===this._editorService.activeEditor},bC(this._editorGroupService,o.group||0))}catch(l){mt(l),o.webview.setHtml(this._mainThreadWebviews.getWebviewResolvedFailedContent(n))}}}))}$unregisterSerializer(e){if(!this._revivers.has(e))throw new Error(`No reviver for ${e} registered`);this._revivers.deleteAndDispose(e)}updateWebviewViewStates(e){if(!this._webviewInputs.size)return;let t={},o=(n,r,s)=>{if(!(s instanceof wu))return;s.updateGroup(n.id);let l=this._webviewInputs.getHandleForInput(s);l&&(t[l]={visible:r===n.activeEditor,active:s===e,position:bC(this._editorGroupService,n.id)})};for(let n of this._editorGroupService.groups)for(let r of n.editors)r instanceof Fa?(o(n,r,r.primary),o(n,r,r.secondary)):o(n,r,r);Object.keys(t).length&&this._proxy.$onDidChangeWebviewPanelViewStates(t)}tryGetWebviewInput(e){return this._webviewInputs.getInputForHandle(e)}};WEe=I([m(2,B),m(3,Et),m(4,ee),m(5,lt),m(6,le),m(7,V_)],WEe);function S2o(a){if(a)return q.isThemeIcon(a)?a:{light:A.revive(a.light),dark:A.revive(a.dark)}}function I2o(a){return{enableFindWidget:a.enableFindWidget,retainContextWhenHidden:a.retainContextWhenHidden}}var VEe=ae("webviewViewService"),ZLt=class extends C{constructor(){super(...arguments);this._resolvers=new Map;this._awaitingRevival=new Map;this._onNewResolverRegistered=this._register(new E);this.onNewResolverRegistered=this._onNewResolverRegistered.event}register(e,t){if(this._resolvers.has(e))throw new Error(`View resolver already registered for ${e}`);this._resolvers.set(e,t),this._onNewResolverRegistered.fire({viewType:e});let o=this._awaitingRevival.get(e);return o&&t.resolve(o.webview,ve.None).then(()=>{this._awaitingRevival.delete(e),o.resolve()}),Z(()=>{this._resolvers.delete(e)})}resolve(e,t,o){let n=this._resolvers.get(e);if(!n){if(this._awaitingRevival.has(e))throw new Error("View already awaiting revival");let{promise:r,resolve:s}=TI();return this._awaitingRevival.set(e,{webview:t,resolve:s}),r}return n.resolve(t,o)}};var BEe=class extends C{constructor(e,t,o,n){super();this.mainThreadWebviews=t;this._telemetryService=o;this._webviewViewService=n;this._webviewViews=this._register(new jt);this._webviewViewProviders=this._register(new jt);this._proxy=e.getProxy(Zi.ExtHostWebviewViews)}$setWebviewViewTitle(e,t){let o=this.getWebviewView(e);o.title=t}$setWebviewViewDescription(e,t){let o=this.getWebviewView(e);o.description=t}$setWebviewViewBadge(e,t){let o=this.getWebviewView(e);o.badge=t}$show(e,t){this.getWebviewView(e).show(t)}$registerWebviewViewProvider(e,t,o){if(this._webviewViewProviders.has(t))throw new Error(`View provider for ${t} already registered`);let n=Pce(e),r=this._webviewViewService.register(t,{resolve:async(s,l)=>{let c=_t();this._webviewViews.set(c,s),this.mainThreadWebviews.addWebview(c,s.webview,{serializeBuffersForPostMessage:o.serializeBuffersForPostMessage});let u;if(s.webview.state)try{u=JSON.parse(s.webview.state)}catch(h){console.error("Could not load webview state",h,s.webview.state)}s.webview.extension=n,o&&(s.webview.options=o);let p=new P;p.add(s.onDidChangeVisibility(h=>{this._proxy.$onDidChangeWebviewViewVisibility(c,h)})),p.add(s.onDispose(()=>{this._proxy.$disposeWebviewView(c),this._webviewViews.deleteAndDispose(c),p.dispose()})),this._telemetryService.publicLog2("webviews:createWebviewView",{extensionId:n.id.value,id:t});try{await this._proxy.$resolveWebviewView(c,t,s.title,u,l)}catch(h){mt(h),s.webview.setHtml(this.mainThreadWebviews.getWebviewResolvedFailedContent(t))}}});this._webviewViewProviders.set(t,r)}$unregisterWebviewViewProvider(e){if(!this._webviewViewProviders.has(e))throw new Error(`No view provider for ${e} registered`);this._webviewViewProviders.deleteAndDispose(e)}getWebviewView(e){let t=this._webviewViews.get(e);if(!t)throw new Error("unknown webview view");return t}};BEe=I([m(2,Te),m(3,VEe)],BEe);var UEe=ae("chatOutputRendererService"),HEe=class extends C{constructor(e,t,o){super();this._contextKeyService=e;this._extensionService=t;this._webviewService=o;this._contributions=new Map;this._renderers=new Map;this._register(w2o.setHandler(n=>{this.updateContributions(n)}))}registerRenderer(e,t,o){return this._renderers.set(e,{viewType:e,renderer:t,options:o}),{dispose:()=>{this._renderers.delete(e)}}}async renderOutputPart(e,t,o,n,r){let s=await this.getRenderer(e,r);if(r.isCancellationRequested)throw new ho;if(!s)throw new Error(`No renderer registered found for mime type: ${e}`);let l=new P,c=l.add(this._webviewService.createWebviewElement({title:"",origin:n.origin??_t(),providedViewType:s.viewType,options:{enableFindWidget:!1,purpose:"chatOutputItem",tryRestoreScrollPosition:!1},contentOptions:{},extension:s.options.extension?s.options.extension:void 0}));c.setContextKeyService(l.add(this._contextKeyService.createScoped(o)));let u=l.add(new E);return l.add(he(p=>{let h=p.readObservable(c.intrinsicContentSize);h&&(u.fire(h.height),o.style.height=`${h.height}px`)})),n.webviewState&&(c.state=n.webviewState),c.mountTo(o,Me(o)),await s.renderer.renderOutputPart(e,t,c,r),{get webview(){return c},onDidChangeHeight:u.event,dispose:()=>{l.dispose()},reinitialize:()=>{c.reinitializeAfterDismount()}}}async getRenderer(e,t){await pm(this._extensionService.whenInstalledExtensionsRegistered(),t);for(let[o,n]of this._contributions)if(n.mimes.some(r=>Y$e(r,[e]))){await pm(this._extensionService.activateByEvent(`onChatOutputRenderer:${o}`),t);let r=this._renderers.get(o);if(r)return r}}updateContributions(e){this._contributions.clear();for(let t of e)if(Ea(t.description,"chatOutputRenderer"))for(let o of t.value){if(this._contributions.has(o.viewType)){t.collector.error(`Chat output renderer with view type '${o.viewType}' already registered`);continue}this._contributions.set(o.viewType,{mimes:o.mimeTypes})}}};HEe=I([m(0,X),m(1,lt),m(2,wm)],HEe);var y2o={type:"object",additionalProperties:!1,required:["viewType","mimeTypes"],properties:{viewType:{type:"string",description:d(6577,null)},mimeTypes:{type:"array",description:d(6576,null),items:{type:"string"}}}},w2o=Tn.registerExtensionPoint({extensionPoint:"chatOutputRenderers",activationEventsGenerator:function*(a){for(let i of a)yield`onChatOutputRenderer:${i.viewType}`},jsonSchema:{description:d(6578,null),type:"array",items:y2o}});var zEe=class extends C{constructor(e,t,o){super();this._mainThreadWebview=t;this._rendererService=o;this._webviewHandlePool=0;this.registeredRenderers=new Map;this._proxy=e.getProxy(Zi.ExtHostChatOutputRenderer)}dispose(){super.dispose(),this.registeredRenderers.forEach(e=>e.dispose()),this.registeredRenderers.clear()}$registerChatOutputRenderer(e,t,o){this._rendererService.registerRenderer(e,{renderOutputPart:async(n,r,s,l)=>{let c=`chat-output-${++this._webviewHandlePool}`;return this._mainThreadWebview.addWebview(c,s,{serializeBuffersForPostMessage:!0}),this._proxy.$renderChatOutput(e,n,Je.wrap(r),c,l)}},{extension:{id:t,location:A.revive(o)}})}$unregisterChatOutputRenderer(e){this.registeredRenderers.get(e)?.dispose()}};zEe=I([m(2,UEe)],zEe);var tRt=class extends C{constructor(i,e){super();let t=this._register(e.createInstance(OY,i));i.set(Gi.MainThreadWebviews,t);let o=this._register(e.createInstance(WEe,i,t));i.set(Gi.MainThreadWebviewPanels,o);let n=this._register(e.createInstance(FEe,i,t,o));i.set(Gi.MainThreadCustomEditors,n);let r=this._register(e.createInstance(BEe,i,t));i.set(Gi.MainThreadWebviewViews,r);let s=this._register(e.createInstance(zEe,i,t));i.set(Gi.MainThreadChatOutputRenderer,s)}};tRt=I([QL,m(1,F)],tRt);function C2o(a){return typeof a=="object"&&"uri"in a&&"pattern"in a}var aS=class{constructor(i,e,t,o,n,r){this.configurationService=i;this.workspaceContextService=e;this.editorGroupsService=t;this.logService=o;this.pathService=n;this.uriIdentityService=r}aiText(i,e,t={}){return{...this.commonQuery(e?.map(Dae),t),type:3,contentPattern:i}}text(i,e,t={}){i=this.getContentPattern(i,t);let o=this.configurationService.getValue(),n=e&&e.some(s=>!this.configurationService.getValue({resource:s}).search.useRipgrep);return{...this.commonQuery(e?.map(Dae),t),type:2,contentPattern:i,previewOptions:t.previewOptions,maxFileSize:t.maxFileSize,usePCRE2:o.search.usePCRE2||n||!1,surroundingContext:t.surroundingContext,userDisabledExcludesAndIgnoreFiles:t.disregardExcludeSettings&&t.disregardIgnoreFiles}}getContentPattern(i,e){let t=this.configurationService.getValue();i.isRegExp&&(i.pattern=i.pattern.replace(/\r?\n/g,"\\n"));let o={...i,wordSeparators:t.editor.wordSeparators};return this.isCaseSensitive(i,e)&&(o.isCaseSensitive=!0),this.isMultiline(i)&&(o.isMultiline=!0),e.notebookSearchConfig?.includeMarkupInput&&(o.notebookInfo||(o.notebookInfo={}),o.notebookInfo.isInNotebookMarkdownInput=e.notebookSearchConfig.includeMarkupInput),e.notebookSearchConfig?.includeMarkupPreview&&(o.notebookInfo||(o.notebookInfo={}),o.notebookInfo.isInNotebookMarkdownPreview=e.notebookSearchConfig.includeMarkupPreview),e.notebookSearchConfig?.includeCodeInput&&(o.notebookInfo||(o.notebookInfo={}),o.notebookInfo.isInNotebookCellInput=e.notebookSearchConfig.includeCodeInput),e.notebookSearchConfig?.includeOutput&&(o.notebookInfo||(o.notebookInfo={}),o.notebookInfo.isInNotebookCellOutput=e.notebookSearchConfig.includeOutput),o}file(i,e={}){return{...this.commonQuery(i,e),type:1,filePattern:e.filePattern?e.filePattern.trim():e.filePattern,exists:e.exists,sortByScore:e.sortByScore,cacheKey:e.cacheKey,shouldGlobMatchFilePattern:e.shouldGlobSearch}}handleIncludeExclude(i,e){if(!i)return{};if(Array.isArray(i)){if(i=i.filter(t=>t.length>0).map(iRt),!i.length)return{}}else i=iRt(i);return e?this.parseSearchPaths(i):{pattern:$mi(...Array.isArray(i)?i:[i])}}commonQuery(i=[],e={}){let t=Array.isArray(e.excludePattern)?e.excludePattern.map(u=>u.pattern).flat():e.excludePattern;t=t?.length===1?t[0]:t;let o=this.handleIncludeExclude(e.includePattern,e.expandPatterns),n=this.handleIncludeExclude(t,e.expandPatterns),r=i.length>1,s=(o.searchPaths&&o.searchPaths.length?o.searchPaths.map(u=>this.getFolderQueryForSearchPath(u,e,n)):i.map(u=>this.getFolderQueryForRoot(u,e,n,r))).filter(u=>!!u),l={_reason:e._reason,folderQueries:s,usingSearchPaths:!!(o.searchPaths&&o.searchPaths.length),extraFileResources:e.extraFileResources,excludePattern:n.pattern,includePattern:o.pattern,ignoreGlobCase:e.ignoreGlobCase,onlyOpenEditors:e.onlyOpenEditors,maxResults:e.maxResults,onlyFileScheme:e.onlyFileScheme};if(e.onlyOpenEditors){let u=si(this.editorGroupsService.groups.flatMap(g=>g.editors.map(f=>f.resource)));this.logService.trace("QueryBuilder#commonQuery - openEditor URIs",JSON.stringify(u));let p=u.filter(g=>Sde(l,g.fsPath)),h=this.commonQueryFromFileList(p);return this.logService.trace("QueryBuilder#commonQuery - openEditor Query",JSON.stringify(h)),{...l,...h}}let c=e.extraFileResources&&e.extraFileResources.filter(u=>Sde(l,u.fsPath));return l.extraFileResources=c&&c.length?c:void 0,l}commonQueryFromFileList(i){let e=[],t=new vt,o={},n=!1;return i.forEach(r=>{if(r.scheme===Y.walkThrough)return;if(wpt(r)){let l=this.workspaceContextService.getWorkspaceFolder(r)?.uri??this.uriIdentityService.extUri.dirname(r),c=t.get(l);c||(n=!0,c={folder:l,includePattern:{}},e.push(c),t.set(l,c));let u=SM(l.fsPath,r.fsPath);Oi(c.includePattern)[jmi(u.replace(/\\/g,"/"))]=!0}else r.fsPath&&(n=!0,o[jmi(r.fsPath)]=!0)}),{folderQueries:e,includePattern:o,usingSearchPaths:!0,excludePattern:n?void 0:{"**/*":!0}}}isCaseSensitive(i,e){if(e.isSmartCase){if(i.isRegExp){if(gGe(i.pattern,!0))return!0}else if(gGe(i.pattern))return!0}return!!i.isCaseSensitive}isMultiline(i){return i.isMultiline||i.isRegExp&&I$e(i.pattern)||i.pattern.indexOf(`
`)>=0?!0:!!i.isMultiline}parseSearchPaths(i){let e=p=>Xl(p)||/^\.\.?([\/\\]|$)/.test(p),o=(Array.isArray(i)?i:k2o(i)).map(p=>{let h=this.pathService.resolvedUserHome;return h?v9(p,h.scheme===Y.file?h.fsPath:h.path):p}),n=wI(o,p=>e(p)?"searchPaths":"exprSegments"),r=(n.exprSegments||[]).map(p=>ih(p,"/")).map(p=>ih(p,"\\")).map(p=>(p[0]==="."&&(p="*"+p),E2o(p))),s={},l=this.expandSearchPathPatterns(n.searchPaths||[]);l&&l.length&&(s.searchPaths=l);let c=r.flat(),u=$mi(...c);return u&&(s.pattern=u),s}getExcludesForFolder(i,e){return e.disregardExcludeSettings?void 0:MP(i,!e.disregardSearchExcludeSettings)}expandSearchPathPatterns(i){if(!i||!i.length)return[];let e=i.flatMap(o=>{let{pathPortion:n,globPortion:r}=x2o(o);return r&&(r=qmi(r)),this.expandOneSearchPath(n).flatMap(l=>this.resolveOneSearchPathPattern(l,r))}),t=new Map;return e.forEach(o=>{let n=o.searchPath.toString(),r=t.get(n);r?o.pattern&&(r.pattern=r.pattern||{},r.pattern[o.pattern]=!0):t.set(n,{searchPath:o.searchPath,pattern:o.pattern?$mi(o.pattern):void 0})}),Array.from(t.values())}expandOneSearchPath(i){if(Xl(i)){let e=this.workspaceContextService.getWorkspace().folders;return e[0]&&e[0].uri.scheme!==Y.file?[{searchPath:e[0].uri.with({path:i})}]:[{searchPath:A.file(th(i))}]}if(this.workspaceContextService.getWorkbenchState()===2){let e=this.workspaceContextService.getWorkspace().folders[0].uri;if(i=iRt(i),i.startsWith("../")||i===".."){let o=Lo.resolve(e.path,i);return[{searchPath:e.with({path:o})}]}let t=qmi(i);return[{searchPath:e,pattern:t}]}else{if(i==="./"||i===".\\")return[];{let e=i.replace(/^\.[\/\\]/,""),o=this.workspaceContextService.getWorkspace().folders.map(n=>{let r=e.match(new RegExp(`^${Yr(n.name)}(?:/(.*)|$)`));return r?{match:r,folder:n}:null}).filter(mo);if(o.length)return o.map(n=>{let r=n.match[1];return{searchPath:n.folder.uri,pattern:r&&qmi(r)}});{let n=i.match(/\.[\/\\](.+)[\/\\]?/),r=n?n[1]:i,s=d(17203,null,r);throw new Error(s)}}}}resolveOneSearchPathPattern(i,e){let t=i.pattern&&e?`${i.pattern}/${e}`:i.pattern||e,o=[{searchPath:i.searchPath,pattern:t}];return t&&!t.endsWith("**")&&o.push({searchPath:i.searchPath,pattern:t+"/**"}),o}getFolderQueryForSearchPath(i,e,t){let o=this.getFolderQueryForRoot(Dae(i.searchPath),e,t,!1);return o?{...o,includePattern:i.pattern}:null}getFolderQueryForRoot(i,e,t,o){let n,r=A.isUri(i)?i:i.uri,s=e.excludePattern?.map(g=>{let f=e.excludePattern&&C2o(g)?g.uri:void 0;return!f||!(A.isUri(i)&&this.uriIdentityService.extUri.isEqual(i,f))?f:void 0});if(s?.length||(s=[void 0]),t.searchPaths){let g=t.searchPaths.filter(f=>Xe(f.searchPath,r))[0];if(g&&!g.pattern)return null;g&&(n=g.pattern)}let l=this.configurationService.getValue({resource:r}),u={...this.getExcludesForFolder(l,e)||{},...n||{}},p=A.isUri(i)?Ye(i):i.name,h=s.map(g=>Object.keys(u).length>0?{folder:g,pattern:u}:void 0).filter(g=>g);return{folder:r,folderName:o?p:void 0,excludePattern:h,fileEncoding:l.files&&l.files.encoding,disregardIgnoreFiles:typeof e.disregardIgnoreFiles=="boolean"?e.disregardIgnoreFiles:!l.search.useIgnoreFiles,disregardGlobalIgnoreFiles:typeof e.disregardGlobalIgnoreFiles=="boolean"?e.disregardGlobalIgnoreFiles:!l.search.useGlobalIgnoreFiles,disregardParentIgnoreFiles:typeof e.disregardParentIgnoreFiles=="boolean"?e.disregardParentIgnoreFiles:!l.search.useParentIgnoreFiles,ignoreSymlinks:typeof e.ignoreSymlinks=="boolean"?e.ignoreSymlinks:!l.search.followSymlinks,ignoreGlobCase:e.ignoreGlobCase}}};aS=I([m(0,B),m(1,Pe),m(2,Et),m(3,ne),m(4,wn),m(5,dt)],aS);function x2o(a){let i=a.match(/[\*\{\}\(\)\[\]\?]/);if(i){let e=i.index,t=a.substr(0,e).match(/[/|\\][^/\\]*$/);if(t){let o=a.substr(0,t.index);return o.match(/[/\\]/)||(o+="/"),{pathPortion:o,globPortion:a.substr((t.index||0)+1)}}}return{pathPortion:a}}function $mi(...a){return a.length?a.reduce((i,e)=>(i[e]=!0,i),Object.create(null)):void 0}function k2o(a){return HL(a,",").map(i=>i.trim()).filter(i=>!!i.length)}function E2o(a){return[`**/${a}/**`,`**/${a}`].map(e=>e.replace(/\*\*\/\*\*/g,"**"))}function iRt(a){return a.replace(/\\/g,"/")}function qmi(a){return iRt(a).replace(/^\.\//,"").replace(/\/+$/g,"")}function jmi(a){return a.replace(/([?*[\]])/g,"[$1]")}function Neo(a,i){a=Uo(a,o=>o.toString());let e=[],t=i.getWorkspace();return a&&a.forEach(o=>{let n;if(i.getWorkbenchState()===2)n=Fc(t.folders[0].uri,o),n&&n!=="."&&(n="./"+n);else{let r=i.getWorkspaceFolder(o);if(r){let s=r.name;if(t.folders.filter(c=>c.name===s).length===1){let c=Fc(r.uri,o);c===""?n=`./${r.name}`:n=`./${r.name}/${c}`}else n=o.fsPath}}n&&e.push(jmi(n))}),e}var T2o=7e3;function Oeo(a,i){let e=i.activationEvents;if(!e)return Promise.resolve(void 0);let t=[],o=[];for(let u of e)if(/^workspaceContains:/.test(u)){let p=u.substr(18);p.indexOf("*")>=0||p.indexOf("?")>=0||a.forceUsingSearch?o.push(p):t.push(p)}if(t.length===0&&o.length===0)return Promise.resolve(void 0);let{promise:n,resolve:r}=TI(),s=u=>r({activationEvent:u}),l=Promise.all(t.map(u=>_2o(a,u,s))).then(()=>{}),c=D2o(a,i.identifier,o,s);return Promise.all([l,c]).then(()=>{r(void 0)}),n}async function _2o(a,i,e){for(let t of a.folders)if(await a.exists(je(A.revive(t),i))){e(`workspaceContains:${i}`);return}}async function D2o(a,i,e,t){if(e.length===0)return Promise.resolve(void 0);let o=new $e,n=a.checkExists(a.folders,e,o.token),r=setTimeout(async()=>{o.cancel(),a.logService.info(`Not activating extension '${i.value}': Timed out while searching for 'workspaceContains' pattern ${e.join(",")}`)},T2o),s=!1;try{s=await n}catch(l){so(l)||mt(l)}o.dispose(),clearTimeout(r),s&&t(`workspaceContains:${e.join(",")}`)}function KEe(a,i,e,t){let o=a.get(F),n=a.get(Jp),s=o.createInstance(aS).file(i.map(l=>Dae(A.revive(l))),{_reason:"checkExists",includePattern:e,exists:!0});return n.fileSearch(s,t).then(l=>!!l.limitHit,l=>so(l)?!1:Promise.reject(l))}var Of=ae("workspaceEditingService");var oRt=ae("canonicalUriIdentityService");var nRt=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){this._searchService=e;this._contextService=t;this._editSessionIdentityService=o;this._canonicalUriService=n;this._editorService=r;this._workspaceEditingService=s;this._notificationService=l;this._requestService=c;this._instantiationService=u;this._labelService=p;this._environmentService=h;this._workspaceTrustManagementService=f;this._workspaceTrustRequestService=v;this._textFileService=b;this._toDispose=new P;this._activeCancelTokens=Object.create(null);this.registeredEditSessionProviders=new Map;this.registeredCanonicalUriProviders=new Map;this._queryBuilder=this._instantiationService.createInstance(aS),this._proxy=i.getProxy(Zi.ExtHostWorkspace);let S=this._contextService.getWorkspace();S.configuration&&!kr&&!g.hasProvider(S.configuration)?this._proxy.$initializeWorkspace(this.getWorkspaceData(S),this.isWorkspaceTrusted()):this._contextService.getCompleteWorkspace().then(y=>this._proxy.$initializeWorkspace(this.getWorkspaceData(y),this.isWorkspaceTrusted())),this._contextService.onDidChangeWorkspaceFolders(this._onDidChangeWorkspace,this,this._toDispose),this._contextService.onDidChangeWorkbenchState(this._onDidChangeWorkspace,this,this._toDispose),this._workspaceTrustManagementService.onDidChangeTrust(this._onDidGrantWorkspaceTrust,this,this._toDispose),this._workspaceTrustManagementService.onDidChangeTrustedFolders(this._onDidChangeWorkspaceTrustedFolders,this,this._toDispose)}dispose(){this._toDispose.dispose();for(let i in this._activeCancelTokens)this._activeCancelTokens[i].cancel()}$updateWorkspaceFolders(i,e,t,o){let n=o.map(r=>({uri:A.revive(r.uri),name:r.name}));return this._notificationService.status(this.getStatusMessage(i,n.length,t),{hideAfter:10*1e3}),this._workspaceEditingService.updateFolders(e,t,n,!0)}getStatusMessage(i,e,t){let o,n=e>0,r=t>0;return n&&!r?e===1?o=d(3067,null,i):o=d(3066,null,i,e):r&&!n?t===1?o=d(3069,null,i):o=d(3068,null,i,t):o=d(3065,null,i),o}_onDidChangeWorkspace(){this._proxy.$acceptWorkspaceData(this.getWorkspaceData(this._contextService.getWorkspace()))}getWorkspaceData(i){return this._contextService.hasWorkspaceData()?{configuration:i.configuration||void 0,isUntitled:i.configuration?_q(i.configuration,this._environmentService):!1,folders:i.folders,id:i.id,name:this._labelService.getWorkspaceLabel(i),transient:i.transient}:null}$startFileSearch(i,e,t){let o=A.revive(i),n=this._contextService.getWorkspace(),r=this._queryBuilder.file(o?[o]:n.folders,Xn(e));return this._searchService.fileSearch(r,t).then(s=>s.results.map(l=>l.resource),s=>so(s)?null:Promise.reject(s))}$startTextSearch(i,e,t,o,n){let r=A.revive(e),s=this._contextService.getWorkspace(),l=r?[r]:s.folders.map(h=>h.uri),c=this._queryBuilder.text(i,l,Xn(t));c._reason="startTextSearch";let u=h=>{h.results&&this._proxy.$handleTextSearchResult(h,o)};return this._searchService.textSearch(c,n,u).then(h=>({limitHit:h.limitHit}),h=>so(h)?null:Promise.reject(h))}$checkExists(i,e,t){return this._instantiationService.invokeFunction(o=>KEe(o,i,e,t))}async $save(i,e){let t=A.revive(i),o=[...this._editorService.findEditors(t,{supportSideBySide:1})],n=await this._editorService.save(o,{reason:1,saveAs:e.saveAs,force:!e.saveAs});return this._saveResultToUris(n).at(0)}_saveResultToUris(i){return i.success?si(i.editors.map(e=>no.getCanonicalUri(e,{supportSideBySide:1}))):[]}$saveAll(i){return this._editorService.saveAll({includeUntitled:i}).then(e=>e.success)}$resolveProxy(i){return this._requestService.resolveProxy(i)}$lookupAuthorization(i){return this._requestService.lookupAuthorization(i)}$lookupKerberosAuthorization(i){return this._requestService.lookupKerberosAuthorization(i)}$loadCertificates(){return this._requestService.loadCertificates()}$requestResourceTrust(i){let e={...i,uri:A.revive(i.uri)};return this._workspaceTrustRequestService.requestResourcesTrust(e)}$requestWorkspaceTrust(i){return this._workspaceTrustRequestService.requestWorkspaceTrust(i)}async $isResourceTrusted(i){let e=A.revive(i);return(await this._workspaceTrustManagementService.getUriTrustInfo(e)).trusted}isWorkspaceTrusted(){return this._workspaceTrustManagementService.isWorkspaceTrusted()}_onDidGrantWorkspaceTrust(){this._proxy.$onDidGrantWorkspaceTrust()}_onDidChangeWorkspaceTrustedFolders(){this._proxy.$onDidChangeWorkspaceTrustedFolders()}$registerEditSessionIdentityProvider(i,e){let t=this._editSessionIdentityService.registerEditSessionIdentityProvider({scheme:e,getEditSessionIdentifier:async(o,n)=>this._proxy.$getEditSessionIdentifier(o.uri,n),provideEditSessionIdentityMatch:async(o,n,r,s)=>this._proxy.$provideEditSessionIdentityMatch(o.uri,n,r,s)});this.registeredEditSessionProviders.set(i,t),this._toDispose.add(t)}$unregisterEditSessionIdentityProvider(i){this.registeredEditSessionProviders.get(i)?.dispose(),this.registeredEditSessionProviders.delete(i)}$registerCanonicalUriProvider(i,e){let t=this._canonicalUriService.registerCanonicalUriProvider({scheme:e,provideCanonicalUri:async(o,n,r)=>{let s=await this._proxy.$provideCanonicalUri(o,n,r);return s&&A.revive(s)}});this.registeredCanonicalUriProviders.set(i,t),this._toDispose.add(t)}$unregisterCanonicalUriProvider(i){this.registeredCanonicalUriProviders.get(i)?.dispose(),this.registeredCanonicalUriProviders.delete(i)}$resolveDecoding(i,e){return this._textFileService.resolveDecoding(A.revive(i),e)}$validateDetectedEncoding(i,e,t){return this._textFileService.validateDetectedEncoding(A.revive(i),e,t)}$resolveEncoding(i,e){return this._textFileService.resolveEncoding(A.revive(i),e)}};nRt=I([vo(Gi.MainThreadWorkspace),m(1,Jp),m(2,Pe),m(3,Wz),m(4,oRt),m(5,ee),m(6,Of),m(7,Ne),m(8,_a),m(9,F),m(10,ot),m(11,Co),m(12,be),m(13,ns),m(14,Vd),m(15,Ho)],nRt);var GEe=class{constructor(i){this.menuService=i}getCommentThreadTitleActions(i){return this.getMenu(D.CommentThreadTitle,i)}getCommentThreadActions(i){return this.getMenu(D.CommentThreadActions,i)}getCommentEditorActions(i){return this.getMenu(D.CommentEditorActions,i)}getCommentThreadAdditionalActions(i){return this.getMenu(D.CommentThreadAdditionalActions,i,{emitEventsForSubmenuChanges:!0})}getCommentTitleActions(i,e){return this.getMenu(D.CommentTitle,e)}getCommentActions(i,e){return this.getMenu(D.CommentActions,e)}getCommentThreadTitleContextActions(i){return this.getActions(D.CommentThreadTitleContext,i,{shouldForwardArgs:!0})}getMenu(i,e,t){return this.menuService.createMenu(i,e,t)}getActions(i,e,t){return this.menuService.getMenuActions(i,e,t).map(o=>o[1]).flat()}dispose(){}};GEe=I([m(0,qt)],GEe);var zz="comments";var vc;(h=>(h.activeCursorHasCommentingRange=new Q("activeCursorHasCommentingRange",!1,{description:d(8567,null),type:"boolean"}),h.activeCursorHasComment=new Q("activeCursorHasComment",!1,{description:d(8565,null),type:"boolean"}),h.activeEditorHasCommentingRange=new Q("activeEditorHasCommentingRange",!1,{description:d(8564,null),type:"boolean"}),h.WorkspaceHasCommenting=new Q("workspaceHasCommenting",!1,{description:d(8566,null),type:"boolean"}),h.commentThreadIsEmpty=new Q("commentThreadIsEmpty",!1,{type:"boolean",description:d(8562,null)}),h.commentIsEmpty=new Q("commentIsEmpty",!1,{type:"boolean",description:d(8560,null)}),h.commentContext=new Q("comment",void 0,{type:"string",description:d(8556,null)}),h.commentThreadContext=new Q("commentThread",void 0,{type:"string",description:d(8561,null)}),h.commentControllerContext=new Q("commentController",void 0,{type:"string",description:d(8557,null)}),h.commentFocused=new Q("commentFocused",!1,{type:"boolean",description:d(8558,null)}),h.commentWidgetVisible=new Q("commentWidgetVisible",!1,{type:"boolean",description:d(8563,null)}),h.commentingEnabled=new Q("commentingEnabled",!0,{description:d(8559,null),type:"boolean"})))(vc||={});var HE=class{constructor(i,e,t,o,n){this.uniqueOwner=i;this.owner=e;this.resource=t;this.comment=o;this.thread=n;this.isRoot=!1;this.replies=[];this.threadId=n.threadId,this.range=n.range,this.threadState=n.state,this.threadRelevance=n.applicability,this.contextValue=n.contextValue,this.controllerHandle=n.controllerHandle,this.threadHandle=n.commentThreadHandle}hasReply(){return this.replies&&this.replies.length!==0}get lastUpdatedAt(){if(this._lastUpdatedAt===void 0){let i=this.comment.timestamp||"";if(this.replies.length){let t=this.replies[this.replies.length-1].lastUpdatedAt;t>i&&(i=t)}this._lastUpdatedAt=i}return this._lastUpdatedAt}},mw=class a{constructor(i,e,t,o){this.uniqueOwner=i,this.owner=e,this.id=t.toString(),this.resource=t,this.commentThreads=o.filter(n=>n.comments&&n.comments.length).map(n=>a.createCommentNode(i,e,t,n))}static createCommentNode(i,e,t,o){let{comments:n}=o,r=n.map(s=>new HE(i,e,t,s,o));return r.length>1&&(r[0].replies=r.slice(1,r.length)),r[0].isRoot=!0,r[0]}get lastUpdatedAt(){if(this._lastUpdatedAt===void 0){let i="";if(!this.commentThreads.length)return i;for(let e of this.commentThreads){let t=e.lastUpdatedAt;t&&t>i&&(i=t)}this._lastUpdatedAt=i}return this._lastUpdatedAt}};function a9e(a){return!!a.comments&&!!a.comments.length&&a.comments.some(i=>Mr(i.body)?i.body.value.length>0:i.body.length>0)}var Kz=class a extends C{get resourceCommentThreads(){return this._resourceCommentThreads}constructor(){super(),this._resourceCommentThreads=[],this.commentThreadsMap=new Map}updateResourceCommentThreads(){let i=this.commentThreadsMap.size>1;this._resourceCommentThreads=[...this.commentThreadsMap.values()].map(e=>e.resourceWithCommentThreads.map(t=>(t.ownerLabel=i?e.ownerLabel:void 0,t)).flat()).flat()}setCommentThreads(i,e,t,o){this.commentThreadsMap.set(i,{ownerLabel:t,resourceWithCommentThreads:this.groupByResource(i,e,o)}),this.updateResourceCommentThreads()}deleteCommentsByOwner(i){if(i){let e=this.commentThreadsMap.get(i);this.commentThreadsMap.set(i,{ownerLabel:e?.ownerLabel,resourceWithCommentThreads:[]})}else this.commentThreadsMap.clear();this.updateResourceCommentThreads()}updateCommentThreads(i){let{uniqueOwner:e,owner:t,ownerLabel:o,removed:n,changed:r,added:s}=i,l=this.commentThreadsMap.get(e)?.resourceWithCommentThreads||[];return n.forEach(c=>{let u=l.findIndex(g=>g.id===c.resource),p=u>=0?l[u]:void 0,h=p?.commentThreads.findIndex(g=>g.threadId===c.threadId)??0;h>=0&&p?.commentThreads.splice(h,1),p?.commentThreads.length===0&&l.splice(u,1)}),r.forEach(c=>{let u=l.findIndex(g=>g.id===c.resource),p=u>=0?l[u]:void 0;if(!p)return;let h=p.commentThreads.findIndex(g=>g.threadId===c.threadId);h>=0?p.commentThreads[h]=mw.createCommentNode(e,t,A.parse(p.id),c):c.comments&&c.comments.length&&p.commentThreads.push(mw.createCommentNode(e,t,A.parse(p.id),c))}),s.forEach(c=>{let u=l.filter(p=>p.resource.toString()===c.resource);if(u.length){let p=u[0];c.comments&&c.comments.length&&p.commentThreads.push(mw.createCommentNode(e,t,p.resource,c))}else l.push(new mw(e,t,A.parse(c.resource),[c]))}),this.commentThreadsMap.set(e,{ownerLabel:o,resourceWithCommentThreads:l}),this.updateResourceCommentThreads(),n.length>0||r.length>0||s.length>0}hasCommentThreads(){return!!this._resourceCommentThreads.length&&this._resourceCommentThreads.some(i=>i.commentThreads.length>0&&i.commentThreads.some(e=>a9e(e.thread)))}getMessage(){return this._resourceCommentThreads.length?"":d(8499,null)}groupByResource(i,e,t){let o=[],n=new Map;for(let r of Pg(t,a._compareURIs))n.set(r[0].resource,new mw(i,e,A.parse(r[0].resource),r));return n.forEach((r,s,l)=>{o.push(r)}),o}static _compareURIs(i,e){let t=i.resource.toString(),o=e.resource.toString();return t<o?-1:t>o?1:0}};var km=ae("commentService"),Qmi="comments.continueOnComments",$Ee=class extends C{constructor(e,t,o,n,r,s,l){super();this.instantiationService=e;this.layoutService=t;this.configurationService=o;this.storageService=r;this.logService=s;this.modelService=l;this._onDidSetDataProvider=this._register(new E);this.onDidSetDataProvider=this._onDidSetDataProvider.event;this._onDidDeleteDataProvider=this._register(new E);this.onDidDeleteDataProvider=this._onDidDeleteDataProvider.event;this._onDidSetResourceCommentInfos=this._register(new E);this.onDidSetResourceCommentInfos=this._onDidSetResourceCommentInfos.event;this._onDidSetAllCommentThreads=this._register(new E);this.onDidSetAllCommentThreads=this._onDidSetAllCommentThreads.event;this._onDidUpdateCommentThreads=this._register(new E);this.onDidUpdateCommentThreads=this._onDidUpdateCommentThreads.event;this._onDidUpdateNotebookCommentThreads=this._register(new E);this.onDidUpdateNotebookCommentThreads=this._onDidUpdateNotebookCommentThreads.event;this._onDidUpdateCommentingRanges=this._register(new E);this.onDidUpdateCommentingRanges=this._onDidUpdateCommentingRanges.event;this._onDidChangeActiveEditingCommentThread=this._register(new E);this.onDidChangeActiveEditingCommentThread=this._onDidChangeActiveEditingCommentThread.event;this._onDidChangeCurrentCommentThread=this._register(new E);this.onDidChangeCurrentCommentThread=this._onDidChangeCurrentCommentThread.event;this._onDidChangeCommentingEnabled=this._register(new E);this.onDidChangeCommentingEnabled=this._onDidChangeCommentingEnabled.event;this._onResourceHasCommentingRanges=this._register(new E);this.onResourceHasCommentingRanges=this._onResourceHasCommentingRanges.event;this._onDidChangeActiveCommentingRange=this._register(new E);this.onDidChangeActiveCommentingRange=this._onDidChangeActiveCommentingRange.event;this._commentControls=new Map;this._commentMenus=new Map;this._isCommentingEnabled=!0;this._continueOnComments=new Map;this._continueOnCommentProviders=new Set;this._commentsModel=this._register(new Kz);this.commentsModel=this._commentsModel;this._commentingRangeResources=new Set;this._commentingRangeResourceHintSchemes=new Set;this._handleConfiguration(),this._handleZenMode(),this._workspaceHasCommenting=vc.WorkspaceHasCommenting.bindTo(n),this._commentingEnabled=vc.commentingEnabled.bindTo(n);let c=this._register(new P),u=H.debounce(this.storageService.onDidChangeValue(1,Qmi,c),(p,h)=>p?.external?p:h,500);c.add(u(p=>{if(!p.external)return;let h=this.storageService.getObject(Qmi,1);if(!h)return;this.logService.debug(`Comments: URIs of continue on comments from storage ${h.map(f=>f.uri.toString()).join(", ")}.`);let g=this._addContinueOnComments(h,this._continueOnComments);for(let f of g){let v=this._commentControls.get(f);if(!v)continue;let b={uniqueOwner:f,owner:v.owner,ownerLabel:v.label,pending:this._continueOnComments.get(f)||[],added:[],removed:[],changed:[]};this.updateModelThreads(b)}})),this._register(r.onWillSaveState(()=>{let p=new Map;for(let h of this._continueOnCommentProviders){let g=h.provideContinueOnComments();this._addContinueOnComments(g,p)}this._saveContinueOnComments(p)})),this._register(this.modelService.onModelAdded(p=>{p.uri.scheme!==Y.vscodeSourceControl&&(this._commentingRangeResources.has(p.uri.toString())||this.getDocumentComments(p.uri))}))}_updateResourcesWithCommentingRanges(e,t){let o=!1;for(let n of t)n&&(n.commentingRanges.ranges.length>0||n.threads.length>0)&&(this._commentingRangeResources.add(e.toString()),o=!0);o&&this._onResourceHasCommentingRanges.fire()}_handleConfiguration(){this._isCommentingEnabled=this._defaultCommentingEnablement,this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration("comments.visible")&&this.enableCommenting(this._defaultCommentingEnablement)}))}_handleZenMode(){let e=this._isCommentingEnabled;this._register(this.layoutService.onDidChangeZenMode(t=>{t?(e=this._isCommentingEnabled,this.enableCommenting(!1)):this.enableCommenting(e)}))}get _defaultCommentingEnablement(){return!!this.configurationService.getValue(zz)?.visible}get isCommentingEnabled(){return this._isCommentingEnabled}enableCommenting(e){e!==this._isCommentingEnabled&&(this._isCommentingEnabled=e,this._commentingEnabled.set(e),this._onDidChangeCommentingEnabled.fire(e))}setCurrentCommentThread(e){this._onDidChangeCurrentCommentThread.fire(e)}setActiveEditingCommentThread(e){this._onDidChangeActiveEditingCommentThread.fire(e)}get lastActiveCommentcontroller(){return this._lastActiveCommentController}async setActiveCommentAndThread(e,t){let o=this._commentControls.get(e);if(o)return o!==this._lastActiveCommentController&&await this._lastActiveCommentController?.setActiveCommentAndThread(void 0),this._lastActiveCommentController=o,o.setActiveCommentAndThread(t)}setDocumentComments(e,t){this._onDidSetResourceCommentInfos.fire({resource:e,commentInfos:t})}setModelThreads(e,t,o,n){this._commentsModel.setCommentThreads(e,t,o,n),this._onDidSetAllCommentThreads.fire({ownerId:e,ownerLabel:o,commentThreads:n})}updateModelThreads(e){this._commentsModel.updateCommentThreads(e),this._onDidUpdateCommentThreads.fire(e)}setWorkspaceComments(e,t){t.length&&this._workspaceHasCommenting.set(!0);let o=this._commentControls.get(e);o&&this.setModelThreads(e,o.owner,o.label,t)}removeWorkspaceComments(e){let t=this._commentControls.get(e);t&&this.setModelThreads(e,t.owner,t.label,[])}registerCommentController(e,t){this._commentControls.set(e,t),this._onDidSetDataProvider.fire()}unregisterCommentController(e){e?this._commentControls.delete(e):this._commentControls.clear(),this._commentsModel.deleteCommentsByOwner(e),this._onDidDeleteDataProvider.fire(e)}getCommentController(e){return this._commentControls.get(e)}async createCommentThreadTemplate(e,t,o,n){let r=this._commentControls.get(e);if(r)return r.createCommentThreadTemplate(t,o,n)}async updateCommentThreadTemplate(e,t,o){let n=this._commentControls.get(e);n&&await n.updateCommentThreadTemplate(t,o)}disposeCommentThread(e,t){this.getCommentController(e)?.deleteCommentThreadMain(t)}getCommentMenus(e){if(this._commentMenus.get(e))return this._commentMenus.get(e);let t=this.instantiationService.createInstance(GEe);return this._commentMenus.set(e,t),t}updateComments(e,t){let o=this._commentControls.get(e);if(o){let n=Object.assign({},t,{uniqueOwner:e,ownerLabel:o.label,owner:o.owner});this.updateModelThreads(n)}}updateNotebookComments(e,t){let o=Object.assign({},t,{uniqueOwner:e});this._onDidUpdateNotebookCommentThreads.fire(o)}updateCommentingRanges(e,t){if(t?.schemes&&t.schemes.length>0)for(let o of t.schemes)this._commentingRangeResourceHintSchemes.add(o);this._workspaceHasCommenting.set(!0),this._onDidUpdateCommentingRanges.fire({uniqueOwner:e})}async toggleReaction(e,t,o,n,r){let s=this._commentControls.get(e);if(s)return s.toggleReaction(t,o,n,r,ve.None);throw new Error("Not supported")}hasReactionHandler(e){let t=this._commentControls.get(e);return t?!!t.features.reactionHandler:!1}async getDocumentComments(e){let t=[];for(let n of this._commentControls.values())t.push(n.getDocumentComments(e,ve.None).then(r=>{for(let l of r.threads)l.comments?.length===0&&l.range&&this.removeContinueOnComment({range:l.range,uri:e,uniqueOwner:r.uniqueOwner});let s=this._continueOnComments.get(r.uniqueOwner);return r.pendingCommentThreads=s?.filter(l=>l.uri.toString()===e.toString()),r}).catch(r=>null));let o=await Promise.all(t);return this._updateResourcesWithCommentingRanges(e,o),o}async getNotebookComments(e){let t=[];return this._commentControls.forEach(o=>{t.push(o.getNotebookComments(e,ve.None).catch(n=>null))}),Promise.all(t)}registerContinueOnCommentProvider(e){return this._continueOnCommentProviders.add(e),{dispose:()=>{this._continueOnCommentProviders.delete(e)}}}_saveContinueOnComments(e){let t=[];for(let o of e.values())t.push(...o);this.logService.debug(`Comments: URIs of continue on comments to add to storage ${t.map(o=>o.uri.toString()).join(", ")}.`),this.storageService.store(Qmi,t,1,0)}removeContinueOnComment(e){let t=this._continueOnComments.get(e.uniqueOwner);if(t){let o=t.findIndex(n=>n.uri.toString()===e.uri.toString()&&z.equalsRange(n.range,e.range)&&(e.isReply===void 0||n.isReply===e.isReply));if(o>-1)return t.splice(o,1)[0]}}_addContinueOnComments(e,t){let o=new Set;for(let n of e)if(!t.has(n.uniqueOwner))t.set(n.uniqueOwner,[n]),o.add(n.uniqueOwner);else{let r=t.get(n.uniqueOwner);r.every(s=>s.uri.toString()!==n.uri.toString()||!z.equalsRange(s.range,n.range))&&(r.push(n),o.add(n.uniqueOwner))}return o}resourceHasCommentingRanges(e){return this._commentingRangeResourceHintSchemes.has(e.scheme)||this._commentingRangeResources.has(e.toString())}};$Ee=I([m(0,F),m(1,fi),m(2,B),m(3,X),m(4,le),m(5,ne),m(6,Ct)],$Ee);function Gz(a){if(a?.resource)return A.isUri(a.resource)?a.resource:a.resource.primary}var AP={onDidChangeVisibility:H.None},Za=class extends C{constructor(e,t,o,n,r,s,l,c,u,p){super();this.instantiationService=t;this.configurationService=o;this.modelService=n;this.workspaceService=r;this.languageService=s;this.decorationsService=l;this.themeService=c;this.labelService=u;this.textFileService=p;this._onDidChangeDecorations=this._register(new E);this.widgets=[];this.labels=[];this.registerListeners(e)}get onDidChangeDecorations(){return this._onDidChangeDecorations.event}registerListeners(e){this._register(e.onDidChangeVisibility(t=>{this.widgets.forEach(o=>o.notifyVisibilityChanged(t))})),this._register(this.languageService.onDidChange(()=>this.widgets.forEach(t=>t.notifyExtensionsRegistered()))),this._register(this.modelService.onModelLanguageChanged(t=>{t.model.uri&&this.widgets.forEach(o=>o.notifyModelLanguageChanged(t.model))})),this._register(this.modelService.onModelAdded(t=>{t.uri&&this.widgets.forEach(o=>o.notifyModelAdded(t))})),this._register(this.workspaceService.onDidChangeWorkspaceFolders(()=>{this.widgets.forEach(t=>t.notifyWorkspaceFoldersChange())})),this._register(this.decorationsService.onDidChangeDecorations(t=>{let o=!1;this.widgets.forEach(n=>{n.notifyFileDecorationsChanges(t)&&(o=!0)}),o&&this._onDidChangeDecorations.fire()})),this._register(this.themeService.onDidColorThemeChange(()=>this.widgets.forEach(t=>t.notifyThemeChange()))),this._register(this.configurationService.onDidChangeConfiguration(t=>{t.affectsConfiguration(Y$)&&this.widgets.forEach(o=>o.notifyFileAssociationsChange())})),this._register(this.labelService.onDidChangeFormatters(t=>{this.widgets.forEach(o=>o.notifyFormattersChange(t.scheme))})),this._register(this.textFileService.untitled.onDidChangeLabel(t=>{this.widgets.forEach(o=>o.notifyUntitledLabelChange(t.resource))}))}get(e){return this.labels[e]}create(e,t){let o=this.instantiationService.createInstance(l9e,e,t),n={element:o.element,get onDidRender(){return o.onDidRender},setLabel:(r,s,l)=>o.setLabel(r,s,l),setResource:(r,s)=>o.setResource(r,s),setFile:(r,s)=>o.setFile(r,s),clear:()=>o.clear(),dispose:()=>this.disposeWidget(o)};return this.labels.push(n),this.widgets.push(o),n}disposeWidget(e){let t=this.widgets.indexOf(e);t>-1&&(this.widgets.splice(t,1),this.labels.splice(t,1)),Ue(e)}clear(){this.widgets=Ue(this.widgets),this.labels=[]}dispose(){super.dispose(),this.clear()}};Za=I([m(1,F),m(2,B),m(3,Ct),m(4,Pe),m(5,kt),m(6,Cv),m(7,De),m(8,ot),m(9,Ho)],Za);var rk=class extends Za{get element(){return this.label}constructor(i,e,t,o,n,r,s,l,c,u,p){super(AP,t,o,n,r,s,l,c,u,p),this.label=this._register(this.create(i,e))}};rk=I([m(2,F),m(3,B),m(4,Ct),m(5,Pe),m(6,kt),m(7,Cv),m(8,De),m(9,ot),m(10,Ho)],rk);var l9e=class extends Lc{constructor(e,t,o,n,r,s,l,c,u){super(e,t);this.languageService=o;this.modelService=n;this.decorationsService=r;this.labelService=s;this.textFileService=l;this.contextService=c;this.notebookDocumentService=u;this._onDidRender=this._register(new E);this.label=void 0;this.decoration=this._register(new me);this.options=void 0;this.computedIconClasses=void 0;this.computedLanguageId=void 0;this.computedPathLabel=void 0;this.computedWorkspaceFolderLabel=void 0;this.needsRedraw=void 0;this.isHidden=!1}get onDidRender(){return this._onDidRender.event}notifyVisibilityChanged(e){e===this.isHidden&&(this.isHidden=!e,e&&this.needsRedraw&&(this.render({updateIcon:this.needsRedraw===2,updateDecoration:this.needsRedraw===2}),this.needsRedraw=void 0))}notifyModelLanguageChanged(e){this.handleModelEvent(e)}notifyModelAdded(e){this.handleModelEvent(e)}handleModelEvent(e){let t=Gz(this.label);t&&Xe(e.uri,t)&&this.computedLanguageId!==e.getLanguageId()&&(this.computedLanguageId=e.getLanguageId(),this.render({updateIcon:!0,updateDecoration:!1}))}notifyFileDecorationsChanges(e){if(!this.options)return!1;let t=Gz(this.label);return t&&this.options.fileDecorations&&e.affectsResource(t)?this.render({updateIcon:!1,updateDecoration:!0}):!1}notifyExtensionsRegistered(){this.render({updateIcon:!0,updateDecoration:!1})}notifyThemeChange(){this.render({updateIcon:!1,updateDecoration:!1})}notifyFileAssociationsChange(){this.render({updateIcon:!0,updateDecoration:!1})}notifyFormattersChange(e){Gz(this.label)?.scheme===e&&this.render({updateIcon:!1,updateDecoration:!1})}notifyUntitledLabelChange(e){Xe(e,Gz(this.label))&&this.render({updateIcon:!1,updateDecoration:!1})}notifyWorkspaceFoldersChange(){if(typeof this.computedWorkspaceFolderLabel=="string"){let e=Gz(this.label);A.isUri(e)&&this.label?.name===this.computedWorkspaceFolderLabel&&this.setFile(e,this.options)}}setFile(e,t){let o=t?.hideLabel,n;if(!o){if(t?.fileKind===2){let s=this.contextService.getWorkspaceFolder(e);s&&(n=s.name,this.computedWorkspaceFolderLabel=n)}n||(n=Hp(Ra(e)))}let r;if(!t?.hidePath){let s=this.labelService.getUriLabel(ci(e),{relative:!0});s&&s!=="."&&(r=s)}this.setResource({resource:e,name:n,description:r,range:t?.range},t)}setResource(e,t=Object.create(null)){let o=Gz(e),n=e?.resource&&!A.isUri(e.resource);if(!t.forceLabel&&!n&&o?.scheme===Y.untitled){let u=this.textFileService.untitled.get(o);if(u&&!u.hasAssociatedFilePath){if(typeof e.name=="string"&&(e.name=u.name),typeof e.description=="string"){let h=u.resource.path;e.name!==h?e.description=h:e.description=void 0}let p=u.resource.path;u.name!==p?t.title=`${u.name} \u2022 ${p}`:t.title=p}}if(!t.forceLabel&&!n&&o?.scheme===Y.vscodeNotebookCell){let u=this.notebookDocumentService.getNotebook(o),p=u?.getCellIndex(o);u&&p!==void 0&&typeof e.name=="string"&&(t.title=d(3496,null,e.name,`${p+1}`)),typeof e.name=="string"&&u&&p!==void 0&&typeof e.name=="string"&&(e.name=d(3496,null,e.name,`${p+1}`))}if(!t.forceLabel&&!n&&o?.scheme===Y.vscodeNotebookCellOutput){let u=this.notebookDocumentService.getNotebook(o),p=V3e(o);if(p?.cellFragment){if(!p.notebook)return;let h=p.notebook.with({scheme:Y.vscodeNotebookCell,fragment:p.cellFragment}),g=u?.getCellIndex(h),f=p.outputIndex;g!==void 0&&f!==void 0&&typeof e.name=="string"?e.name=d(3497,null,e.name,`${g+1}`,`${f+1}`):g!==void 0&&typeof e.name=="string"&&(e.name=d(3498,null,e.name,`${g+1}`))}}t.namePrefix&&(typeof e.name=="string"?e.name=t.namePrefix+e.name:Array.isArray(e.name)&&e.name.length>0&&(e.name=[t.namePrefix+e.name[0],...e.name.slice(1)])),t.nameSuffix&&(typeof e.name=="string"?e.name=e.name+t.nameSuffix:Array.isArray(e.name)&&e.name.length>0&&(e.name=[...e.name.slice(0,e.name.length-1),e.name[e.name.length-1]+t.nameSuffix]));let r=this.hasResourceChanged(e),s=r||this.hasPathLabelChanged(e),l=this.hasFileKindChanged(t),c=this.hasIconChanged(t);this.label=e,this.options=t,r&&(this.computedLanguageId=void 0),s&&(this.computedPathLabel=void 0),this.render({updateIcon:r||l||c,updateDecoration:r||l})}hasFileKindChanged(e){let t=e?.fileKind,o=this.options?.fileKind;return t!==o}hasResourceChanged(e){let t=Gz(e),o=Gz(this.label);return t&&o?t.toString()!==o.toString():!(!t&&!o)}hasPathLabelChanged(e){let t=Gz(e);return!!t&&this.computedPathLabel!==this.labelService.getUriLabel(t)}hasIconChanged(e){return this.options?.icon!==e?.icon}clear(){this.label=void 0,this.options=void 0,this.computedLanguageId=void 0,this.computedIconClasses=void 0,this.computedPathLabel=void 0,this.setLabel("")}render(e){if(this.isHidden)return this.needsRedraw!==2&&(this.needsRedraw=e.updateIcon||e.updateDecoration?2:1),!1;if(e.updateIcon&&(this.computedIconClasses=void 0),!this.label)return!1;let t={title:"",bold:this.options?.bold,italic:this.options?.italic,strikethrough:this.options?.strikethrough,matches:this.options?.matches,descriptionMatches:this.options?.descriptionMatches,extraClasses:[],separator:this.options?.separator,domId:this.options?.domId,disabledCommand:this.options?.disabledCommand,labelEscapeNewLines:this.options?.labelEscapeNewLines,descriptionTitle:this.options?.descriptionTitle,supportIcons:this.options?.supportIcons},o=Gz(this.label);if(this.options?.title!==void 0&&(t.title=this.options.title),o&&o.scheme!==Y.data&&(!this.options?.title||typeof this.options.title!="string"&&!this.options.title.markdownNotSupportedFallback)&&(this.computedPathLabel||(this.computedPathLabel=this.labelService.getUriLabel(o)),!t.title||typeof t.title=="string"?t.title=this.computedPathLabel:t.title.markdownNotSupportedFallback||(t.title.markdownNotSupportedFallback=this.computedPathLabel)),this.options&&!this.options.hideIcon&&(this.computedIconClasses||(this.computedIconClasses=js(this.modelService,this.languageService,o,this.options.fileKind,this.options.icon)),A.isUri(this.options.icon)&&(t.iconPath=this.options.icon),t.extraClasses=this.computedIconClasses.slice(0)),this.options?.extraClasses&&t.extraClasses.push(...this.options.extraClasses),this.options?.fileDecorations&&o){e.updateDecoration&&(this.decoration.value=this.decorationsService.getDecoration(o,this.options.fileKind!==0));let n=this.decoration.value;if(n){if(n.tooltip){if(typeof t.title=="string")t.title=`${t.title} \u2022 ${n.tooltip}`;else if(typeof t.title?.markdown=="string"){let r=`${t.title.markdown} \u2022 ${n.tooltip}`;t.title={markdown:r,markdownNotSupportedFallback:r}}}n.strikethrough&&(t.strikethrough=!0),this.options.fileDecorations.colors&&t.extraClasses.push(n.labelClassName),this.options.fileDecorations.badges&&(t.extraClasses.push(n.badgeClassName),t.extraClasses.push(n.iconClassName))}}return this.label.range&&(t.suffix=this.label.range.startLineNumber!==this.label.range.endLineNumber?`:${this.label.range.startLineNumber}-${this.label.range.endLineNumber}`:`:${this.label.range.startLineNumber}`),this.setLabel(this.label.name??"",this.label.description,t),this._onDidRender.fire(),!0}dispose(){super.dispose(),this.label=void 0,this.options=void 0,this.computedLanguageId=void 0,this.computedIconClasses=void 0,this.computedPathLabel=void 0,this.computedWorkspaceFolderLabel=void 0}};l9e=I([m(2,kt),m(3,Ct),m(4,Cv),m(5,ot),m(6,Ho),m(7,Pe),m(8,Ij)],l9e);var xde=class extends C{constructor(e,t,o,n){super();this.configurationService=e;this._date=R(o,_("span.timestamp")),this._date.style.display="none",this._useRelativeTime=this.useRelativeTimeSetting,this.hover=this._register(t.setupManagedHover(Ni("mouse"),this._date,"")),this.setTimestamp(n)}get useRelativeTimeSetting(){return this.configurationService.getValue(zz).useRelativeTime}async setTimestamp(e){(e!==this._timestamp||this.useRelativeTimeSetting!==this._useRelativeTime)&&this.updateDate(e),this._timestamp=e,this._useRelativeTime=this.useRelativeTimeSetting}updateDate(e){if(!e)this._date.textContent="",this._date.style.display="none";else if(e!==this._timestamp||this.useRelativeTimeSetting!==this._useRelativeTime){this._date.style.display="";let t,o;this.useRelativeTimeSetting?(t=this.getRelative(e),o=this.getDateString(e)):t=this.getDateString(e),this._date.textContent=t,this.hover.update(o??"")}}getRelative(e){return Bs(e,!0,!0)}getDateString(e){return e.toLocaleString(Dr)}};var Ymi=J("commentsView.resolvedIcon",{dark:WXt,light:WXt,hcDark:gi,hcLight:gi},d(8429,null)),Xmi=J("commentsView.unresolvedIcon",{dark:H$e,light:H$e,hcDark:gi,hcLight:gi},d(8431,null));J("editorCommentsWidget.replyInputBackground",DW,d(8425,null));var L2o=J("editorCommentsWidget.resolvedBorder",{dark:Ymi,light:Ymi,hcDark:gi,hcLight:gi},d(8428,null)),Jmi=J("editorCommentsWidget.unresolvedBorder",{dark:Xmi,light:Xmi,hcDark:gi,hcLight:gi},d(8430,null)),Jsl=J("editorCommentsWidget.rangeBackground",ei(Jmi,.1),d(8427,null)),Zsl=J("editorCommentsWidget.rangeActiveBackground",ei(Jmi,.1),d(8426,null)),R2o=new Map([[0,Jmi],[1,L2o]]),M2o=new Map([[0,Xmi],[1,Ymi]]),Feo="--comment-thread-state-color",Zmi="--comment-view-thread-state-color",Weo="--comment-thread-state-background-color";function Veo(a,i,e){let t=a!==void 0?e.get(a):void 0;return t!==void 0?i.getColor(t):void 0}function Beo(a,i){return Veo(a,i,R2o)}function Heo(a,i){return Veo(a,i,M2o)}var LV=class{constructor(i,e,t){this.filter=i;this.showResolved=!0;this.showUnresolved=!0;i=i.trim(),this.showResolved=e,this.showUnresolved=t;let o=i.startsWith("!");this.textFilter={text:(o?Hw(i,"!"):i).trim(),negate:o}}static{this._filter=Dye}static{this._messageFilter=Up}};var Eu="workbench.panel.comments",Ueo="Comments",d9e=L(8503,"Comments"),ehi=class a{static{this.RESOURCE_ID="resource-with-comments"}static{this.COMMENT_ID="comment-node"}getHeight(i){return i instanceof HE&&i.hasReply()?44:22}getTemplateId(i){return i instanceof mw?a.RESOURCE_ID:i instanceof HE?a.COMMENT_ID:""}},thi=class{constructor(i){this.labels=i;this.templateId="resource-with-comments"}renderTemplate(i){let e=R(i,_(".resource-container")),t=this.labels.create(e),o=R(e,_(".separator")),n=e.appendChild(_(".owner"));return{resourceLabel:t,owner:n,separator:o}}renderElement(i,e,t){t.resourceLabel.setFile(i.element.resource),t.separator.innerText="\xB7",i.element.ownerLabel?(t.owner.innerText=i.element.ownerLabel,t.separator.style.display="inline"):(t.owner.innerText="",t.separator.style.display="none")}disposeTemplate(i){i.resourceLabel.dispose()}},Ede=class{constructor(i){this.menuService=i}getResourceActions(i){return{actions:this.getActions(D.CommentsViewThreadActions,i).primary}}getResourceContextActions(i){return this.getActions(D.CommentsViewThreadActions,i).secondary}setContextKeyService(i){this.contextKeyService=i}getActions(i,e){if(!this.contextKeyService)return{primary:[],secondary:[]};let t=[["commentController",e.owner],["resourceScheme",e.resource.scheme],["commentThread",e.contextValue],["canReply",e.thread.canReply]],o=this.contextKeyService.createOverlay(t),n=this.menuService.getMenuActions(i,o,{shouldForwardArgs:!0});return Ef(n,"inline")}dispose(){this.contextKeyService=void 0}};Ede=I([m(0,qt)],Ede);var c9e=class{constructor(i,e,t,o,n){this.actionViewItemProvider=i;this.menus=e;this.configurationService=t;this.hoverService=o;this.themeService=n;this.templateId="comment-node"}renderTemplate(i){let e=R(i,_(".comment-thread-container")),t=R(e,_(".comment-metadata-container")),o=R(t,_(".comment-metadata")),n=R(o,_(".icon")),r=R(o,_(".user")),s=new xde(this.configurationService,this.hoverService,R(o,_(".timestamp-container"))),l=R(o,_(".relevance")),c=R(o,_(".separator")),u=R(o,_(".text")),p=R(o,_(".range")),h=_("p");p.appendChild(h);let g={icon:n,userNames:r,timestamp:s,relevance:l,separator:c,commentPreview:u,range:h};g.separator.innerText="\xB7";let f=R(t,_(".actions")),v=new ji(f,{actionViewItemProvider:this.actionViewItemProvider}),b=R(e,_(".comment-snippet-container")),S={container:b,icon:R(b,_(".icon")),count:R(b,_(".count")),lastReplyDetail:R(b,_(".reply-detail")),separator:R(b,_(".separator")),timestamp:new xde(this.configurationService,this.hoverService,R(b,_(".timestamp-container")))};S.separator.innerText="\xB7",S.icon.classList.add(...q.asClassNameArray(M.indent));let y=[g.timestamp,S.timestamp];return{threadMetadata:g,repliesMetadata:S,actionBar:v,disposables:y}}getCountString(i){return i>2?d(8504,null,i-1):i===2?d(8505,null):d(8500,null)}getRenderedComment(i){let e=nb(i,{},document.createElement("span")),t=e.element.getElementsByTagName("img");for(let n=0;n<t.length;n++){let r=t[n],s=_("");s.textContent=r.alt?d(8507,null,r.alt):d(8506,null),r.replaceWith(s)}let o=[...e.element.getElementsByTagName("h1"),...e.element.getElementsByTagName("h2"),...e.element.getElementsByTagName("h3"),...e.element.getElementsByTagName("h4"),...e.element.getElementsByTagName("h5"),...e.element.getElementsByTagName("h6")];for(let n of o){let r=document.createTextNode(n.textContent||"");n.replaceWith(r)}for(;e.element.children.length>1&&e.element.firstElementChild?.tagName==="HR";)e.element.removeChild(e.element.firstElementChild);return e}getIcon(i,e){return e?M.commentDraft:i===0?M.commentUnresolved:M.comment}renderElement(i,e,t){t.actionBar.clear();let o=i.element.replies.length+1;i.element.threadRelevance===1?(t.threadMetadata.relevance.style.display="",t.threadMetadata.relevance.innerText=d(8509,null),t.threadMetadata.separator.style.display="none"):(t.threadMetadata.relevance.innerText="",t.threadMetadata.relevance.style.display="none",t.threadMetadata.separator.style.display=""),t.threadMetadata.icon.classList.remove(...Array.from(t.threadMetadata.icon.classList.values()).filter(c=>c.startsWith("codicon")));let n=i.element.thread.comments?.some(c=>c.state===1);if(t.threadMetadata.icon.classList.add(...q.asClassNameArray(this.getIcon(i.element.threadState,n))),i.element.threadState!==void 0){let c=this.getCommentThreadWidgetStateColor(i.element.threadState,this.themeService.getColorTheme());t.threadMetadata.icon.style.setProperty(Zmi,`${c}`),t.threadMetadata.icon.style.color=`var(${Zmi})`}t.threadMetadata.userNames.textContent=i.element.comment.userName,t.threadMetadata.timestamp.setTimestamp(i.element.comment.timestamp?new Date(i.element.comment.timestamp):void 0);let r=i.element;if(t.threadMetadata.commentPreview.innerText="",t.threadMetadata.commentPreview.style.height="22px",typeof r.comment.body=="string")t.threadMetadata.commentPreview.innerText=r.comment.body;else{let c=new P;t.disposables.push(c);let u=this.getRenderedComment(r.comment.body);t.disposables.push(u);for(let p=u.element.children.length-1;p>=1;p--)u.element.removeChild(u.element.children[p]);t.threadMetadata.commentPreview.appendChild(u.element),t.disposables.push(this.hoverService.setupManagedHover(Ni("mouse"),t.threadMetadata.commentPreview,u.element.textContent??""))}i.element.range&&(i.element.range.startLineNumber===i.element.range.endLineNumber?t.threadMetadata.range.textContent=d(8501,null,i.element.range.startLineNumber):t.threadMetadata.range.textContent=d(8502,null,i.element.range.startLineNumber,i.element.range.endLineNumber));let s=this.menus.getResourceActions(i.element);if(t.actionBar.push(s.actions,{icon:!0,label:!1}),t.actionBar.context={commentControlHandle:i.element.controllerHandle,commentThreadHandle:i.element.threadHandle,$mid:7},!i.element.hasReply()){t.repliesMetadata.container.style.display="none";return}t.repliesMetadata.container.style.display="",t.repliesMetadata.count.textContent=this.getCountString(o);let l=i.element.replies[i.element.replies.length-1].comment;t.repliesMetadata.lastReplyDetail.textContent=d(8508,null,l.userName),t.repliesMetadata.timestamp.setTimestamp(l.timestamp?new Date(l.timestamp):void 0)}getCommentThreadWidgetStateColor(i,e){return i!==void 0?Heo(i,e):void 0}disposeTemplate(i){i.disposables.forEach(e=>e.dispose()),i.actionBar.dispose()}};c9e=I([m(2,B),m(3,tt),m(4,De)],c9e);var rRt=class{constructor(i){this.options=i}filter(i,e){return this.options.filter===""&&this.options.showResolved&&this.options.showUnresolved?1:i instanceof mw?this.filterResourceMarkers(i):this.filterCommentNode(i,e)}filterResourceMarkers(i){if(this.options.textFilter.text&&!this.options.textFilter.negate){let e=LV._filter(this.options.textFilter.text,Ye(i.resource));if(e)return{visibility:!0,data:{type:0,uriMatches:e||[]}}}return 2}filterCommentNode(i,e){if(!(i.threadState===void 0||this.options.showResolved&&1===i.threadState||this.options.showUnresolved&&0===i.threadState))return!1;if(!this.options.textFilter.text)return!0;let o=LV._messageFilter(this.options.textFilter.text,typeof i.comment.body=="string"?i.comment.body:i.comment.body.value)||LV._messageFilter(this.options.textFilter.text,i.comment.userName)||i.replies.map(n=>LV._messageFilter(this.options.textFilter.text,n.comment.userName)||LV._messageFilter(this.options.textFilter.text,typeof n.comment.body=="string"?n.comment.body:n.comment.body.value)).filter(n=>!!n).flat();return o.length&&!this.options.textFilter.negate?{visibility:!0,data:{type:1,textMatches:o}}:o.length&&this.options.textFilter.negate&&e===2?!1:o.length===0&&this.options.textFilter.negate&&e===2?!0:e}},qEe=class extends mg{constructor(e,t,o,n,r,s,l,c,u){let p=new ehi,h=Ca.bind(void 0,s),g=s.createInstance(Ede);g.setContextKeyService(n);let f=[s.createInstance(thi,e),s.createInstance(c9e,h,g)];super("CommentsTree",t,p,f,{accessibilityProvider:o.accessibilityProvider,identityProvider:{getId:v=>v instanceof Kz?"root":v instanceof mw?`${v.uniqueOwner}-${v.id}`:v instanceof HE?`${v.uniqueOwner}-${v.resource.toString()}-${v.threadId}-${v.comment.uniqueIdInThread}`+(v.isRoot?"-root":""):""},expandOnlyOnTwistieClick:!0,collapseByDefault:!1,overrideStyles:o.overrideStyles,filter:o.filter,sorter:o.sorter,findWidgetEnabled:!1,multipleSelectionSupport:!1},s,n,r,l);this.contextMenuService=c;this.keybindingService=u;this.menus=g,this.disposables.add(this.onContextMenu(v=>this.commentsOnContextMenu(v)))}commentsOnContextMenu(e){let t=e.element;if(!(t instanceof HE))return;let o=e.browserEvent;o.preventDefault(),o.stopPropagation(),this.setFocus([t]);let n=this.menus.getResourceContextActions(t);n.length&&this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>n,getActionViewItem:r=>{let s=this.keybindingService.lookupKeybinding(r.id);if(s)return new Lr(r,r,{label:!0,keybinding:s.getLabel()})},onHide:r=>{r&&this.domFocus()},getActionsContext:()=>({commentControlHandle:t.controllerHandle,commentThreadHandle:t.threadHandle,$mid:7,thread:t.thread})})}filterComments(){this.refilter()}getVisibleItemCount(){let e=0,t=this.getNode();for(let o of t.children)for(let n of o.children)n.visible&&o.visible&&e++;return e}};qEe=I([m(3,X),m(4,fo),m(5,F),m(6,B),m(7,ze),m(8,_e)],qEe);var sRt=class a extends C{constructor(e){super();this.expandedSize=void 0;this._headerVisible=!0;this._collapsible=!0;this._bodyRendered=!1;this.styles={dropBackground:void 0,headerBackground:void 0,headerBorder:void 0,headerForeground:void 0,leftBorder:void 0};this.animationTimer=void 0;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._onDidChangeExpansionState=this._register(new E);this.onDidChangeExpansionState=this._onDidChangeExpansionState.event;this.orthogonalSize=0;this._expanded=typeof e.expanded>"u"?!0:!!e.expanded,this._orientation=typeof e.orientation>"u"?0:e.orientation,this._ariaHeaderLabel=this.getAriaHeaderLabel(e.title),this._minimumBodySize=typeof e.minimumBodySize=="number"?e.minimumBodySize:this._orientation===1?200:120,this._maximumBodySize=typeof e.maximumBodySize=="number"?e.maximumBodySize:Number.POSITIVE_INFINITY,this.element=_(".pane")}static{this.HEADER_SIZE=22}get ariaHeaderLabel(){return this._ariaHeaderLabel}set ariaHeaderLabel(e){this._ariaHeaderLabel=e,this.header?.setAttribute("aria-label",this.ariaHeaderLabel)}get draggableElement(){return this.header}get dropTargetElement(){return this.element}get dropBackground(){return this.styles.dropBackground}get minimumBodySize(){return this._minimumBodySize}set minimumBodySize(e){this._minimumBodySize=e,this._onDidChange.fire(void 0)}get maximumBodySize(){return this._maximumBodySize}set maximumBodySize(e){this._maximumBodySize=e,this._onDidChange.fire(void 0)}get headerSize(){return this.headerVisible?a.HEADER_SIZE:0}get minimumSize(){let e=this.headerSize,o=!this.headerVisible||this.isExpanded()?this.minimumBodySize:0;return e+o}get maximumSize(){let e=this.headerSize,o=!this.headerVisible||this.isExpanded()?this.maximumBodySize:0;return e+o}getAriaHeaderLabel(e){return d(31,null,e)}isExpanded(){return this._expanded}setExpanded(e){return!e&&!this.collapsible||this._expanded===!!e?!1:(this.element?.classList.toggle("expanded",e),this._expanded=!!e,this.updateHeader(),e?(this._bodyRendered||(this.renderBody(this.body),this._bodyRendered=!0),typeof this.animationTimer=="number"&&Me(this.element).clearTimeout(this.animationTimer),R(this.element,this.body)):this.animationTimer=Me(this.element).setTimeout(()=>{this.body.remove()},200),this._onDidChangeExpansionState.fire(e),this._onDidChange.fire(e?this.expandedSize:void 0),!0)}get headerVisible(){return this._headerVisible}set headerVisible(e){this._headerVisible!==!!e&&(this._headerVisible=!!e,this.updateHeader(),this._onDidChange.fire(void 0))}get collapsible(){return this._collapsible}set collapsible(e){this._collapsible!==!!e&&(this._collapsible=!!e,this.updateHeader())}get orientation(){return this._orientation}set orientation(e){this._orientation!==e&&(this._orientation=e,this.element&&(this.element.classList.toggle("horizontal",this.orientation===1),this.element.classList.toggle("vertical",this.orientation===0)),this.header&&this.updateHeader())}render(){this.element.classList.toggle("expanded",this.isExpanded()),this.element.classList.toggle("horizontal",this.orientation===1),this.element.classList.toggle("vertical",this.orientation===0),this.header=_(".pane-header"),R(this.element,this.header),this.header.setAttribute("tabindex","0"),this.header.setAttribute("role","button"),this.header.setAttribute("aria-label",this.ariaHeaderLabel),this.renderHeader(this.header);let e=Vn(this.header);this._register(e),this._register(e.onDidFocus(()=>this.header?.classList.add("focused"),null)),this._register(e.onDidBlur(()=>this.header?.classList.remove("focused"),null)),this.updateHeader();let t=this._register(new P),o=this._register(new On(this.header,"keydown")),n=H.map(o.event,s=>new Ii(s),t);this._register(H.filter(n,s=>s.keyCode===3||s.keyCode===10,t)(()=>this.setExpanded(!this.isExpanded()),null)),this._register(H.filter(n,s=>s.keyCode===15,t)(()=>this.setExpanded(!1),null)),this._register(H.filter(n,s=>s.keyCode===17,t)(()=>this.setExpanded(!0),null)),this._register(ws.addTarget(this.header));let r=this.header;[re.CLICK,Gn.Tap].forEach(s=>{this._register(j(r,s,l=>{l.defaultPrevented||this.setExpanded(!this.isExpanded())}))}),this.body=R(this.element,_(".pane-body")),!this._bodyRendered&&this.isExpanded()&&(this.renderBody(this.body),this._bodyRendered=!0),this.isExpanded()||this.body.remove()}layout(e){let t=this.headerVisible?a.HEADER_SIZE:0,o=this._orientation===0?this.orthogonalSize:e,n=this._orientation===0?e-t:this.orthogonalSize-t;this.isExpanded()&&(this.body.classList.toggle("wide",o>=600),this.layoutBody(n,o),this.expandedSize=e)}style(e){this.styles=e,this.header&&this.updateHeader()}updateHeader(){if(!this.header)return;let e=!this.headerVisible||this.isExpanded();this.collapsible?(this.header.setAttribute("tabindex","0"),this.header.setAttribute("role","button")):(this.header.removeAttribute("tabindex"),this.header.removeAttribute("role")),this.header.style.lineHeight=`${this.headerSize}px`,this.header.classList.toggle("hidden",!this.headerVisible),this.header.classList.toggle("expanded",e),this.header.classList.toggle("not-collapsible",!this.collapsible),this.header.setAttribute("aria-expanded",String(e)),this.header.style.color=this.collapsible?this.styles.headerForeground??"":"",this.header.style.backgroundColor=(this.collapsible?this.styles.headerBackground:"transparent")??"",this.header.style.borderTop=this.styles.headerBorder&&this.orientation===0?`1px solid ${this.styles.headerBorder}`:"",this.element.style.borderLeft=this.styles.leftBorder&&this.orientation===1?`1px solid ${this.styles.leftBorder}`:""}},ihi=class a extends C{constructor(e,t,o){super();this.pane=e;this.dnd=t;this.context=o;this.dragOverCounter=0;this._onDidDrop=this._register(new E);this.onDidDrop=this._onDidDrop.event;e.draggableElement.draggable=!0,this._register(j(e.draggableElement,"dragstart",n=>this.onDragStart(n))),this._register(j(e.dropTargetElement,"dragenter",n=>this.onDragEnter(n))),this._register(j(e.dropTargetElement,"dragleave",n=>this.onDragLeave(n))),this._register(j(e.dropTargetElement,"dragend",n=>this.onDragEnd(n))),this._register(j(e.dropTargetElement,"drop",n=>this.onDrop(n)))}static{this.DefaultDragOverBackgroundColor=new Oe(new Bt(128,128,128,.5))}onDragStart(e){if(!this.dnd.canDrag(this.pane)||!e.dataTransfer){e.preventDefault(),e.stopPropagation();return}let t=this.pane.draggableElement?.textContent||"";e.dataTransfer.effectAllowed="move",yc&&e.dataTransfer?.setData(Aa.TEXT,t),$N(e,this.pane.element,t),this.context.draggable=this}onDragEnter(e){!this.context.draggable||this.context.draggable===this||this.dnd.canDrop(this.context.draggable.pane,this.pane)&&(this.dragOverCounter++,this.render())}onDragLeave(e){!this.context.draggable||this.context.draggable===this||this.dnd.canDrop(this.context.draggable.pane,this.pane)&&(this.dragOverCounter--,this.dragOverCounter===0&&this.render())}onDragEnd(e){this.context.draggable&&(this.dragOverCounter=0,this.render(),this.context.draggable=null)}onDrop(e){this.context.draggable&&($t.stop(e),this.dragOverCounter=0,this.render(),this.dnd.canDrop(this.context.draggable.pane,this.pane)&&this.context.draggable!==this&&this._onDidDrop.fire({from:this.context.draggable.pane,to:this.pane}),this.context.draggable=null)}render(){let e=null;this.dragOverCounter>0&&(e=this.pane.dropBackground??a.DefaultDragOverBackgroundColor.toString()),this.pane.dropTargetElement.style.backgroundColor=e||""}};var aRt=class extends C{constructor(e,t={}){super();this.dndContext={draggable:null};this.paneItems=[];this.orthogonalSize=0;this.size=0;this.animationTimer=void 0;this._onDidDrop=this._register(new E);this.onDidDrop=this._onDidDrop.event;this.dnd=t.dnd,this.orientation=t.orientation??0,this.element=R(e,_(".monaco-pane-view")),this.splitview=this._register(new vu(this.element,{orientation:this.orientation})),this.onDidSashReset=this.splitview.onDidSashReset,this.onDidSashChange=this.splitview.onDidSashChange,this.onDidScroll=this.splitview.onDidScroll;let o=this._register(new P),n=this._register(new On(this.element,"keydown")),r=H.map(H.filter(n.event,s=>Ao(s.target)&&s.target.classList.contains("pane-header"),o),s=>new Ii(s),o);this._register(H.filter(r,s=>s.keyCode===16,o)(()=>this.focusPrevious())),this._register(H.filter(r,s=>s.keyCode===18,o)(()=>this.focusNext()))}addPane(e,t,o=this.splitview.length){let n=new P;e.onDidChangeExpansionState(this.setupAnimation,this,n);let r={pane:e,disposable:n};if(this.paneItems.splice(o,0,r),e.orientation=this.orientation,e.orthogonalSize=this.orthogonalSize,this.splitview.addView(e,t,o),this.dnd){let s=new ihi(e,this.dnd,this.dndContext);n.add(s),n.add(s.onDidDrop(this._onDidDrop.fire,this._onDidDrop))}}removePane(e){let t=this.paneItems.findIndex(n=>n.pane===e);if(t===-1)return;this.splitview.removeView(t,e.isExpanded()?Wl.Distribute:void 0),this.paneItems.splice(t,1)[0].disposable.dispose()}movePane(e,t){let o=this.paneItems.findIndex(s=>s.pane===e),n=this.paneItems.findIndex(s=>s.pane===t);if(o===-1||n===-1)return;let[r]=this.paneItems.splice(o,1);this.paneItems.splice(n,0,r),this.splitview.moveView(o,n)}resizePane(e,t){let o=this.paneItems.findIndex(n=>n.pane===e);o!==-1&&this.splitview.resizeView(o,t)}getPaneSize(e){let t=this.paneItems.findIndex(o=>o.pane===e);return t===-1?-1:this.splitview.getViewSize(t)}layout(e,t){this.orthogonalSize=this.orientation===0?t:e,this.size=this.orientation===1?t:e;for(let o of this.paneItems)o.pane.orthogonalSize=this.orthogonalSize;this.splitview.layout(this.size)}setBoundarySashes(e){this.boundarySashes=e,this.updateSplitviewOrthogonalSashes(e)}updateSplitviewOrthogonalSashes(e){this.orientation===0?(this.splitview.orthogonalStartSash=e?.left,this.splitview.orthogonalEndSash=e?.right):this.splitview.orthogonalEndSash=e?.bottom}flipOrientation(e,t){this.orientation=this.orientation===0?1:0;let o=this.paneItems.map(s=>this.getPaneSize(s.pane));this.splitview.dispose(),Rt(this.element),this.splitview=this._register(new vu(this.element,{orientation:this.orientation})),this.updateSplitviewOrthogonalSashes(this.boundarySashes);let n=this.orientation===0?t:e,r=this.orientation===1?t:e;this.paneItems.forEach((s,l)=>{s.pane.orthogonalSize=n,s.pane.orientation=this.orientation;let c=this.size===0?0:r*o[l]/this.size;this.splitview.addView(s.pane,c,l)}),this.size=r,this.orthogonalSize=n,this.splitview.layout(this.size)}setupAnimation(){typeof this.animationTimer=="number"&&Me(this.element).clearTimeout(this.animationTimer),this.element.classList.add("animated"),this.animationTimer=Me(this.element).setTimeout(()=>{this.animationTimer=void 0,this.element.classList.remove("animated")},200)}getPaneHeaderElements(){return[...this.element.querySelectorAll(".pane-header")]}focusPrevious(){let e=this.getPaneHeaderElements(),t=e.indexOf(this.element.ownerDocument.activeElement);t!==-1&&e[Math.max(t-1,0)].focus()}focusNext(){let e=this.getPaneHeaderElements(),t=e.indexOf(this.element.ownerDocument.activeElement);t!==-1&&e[Math.min(t+1,e.length-1)].focus()}dispose(){super.dispose(),this.paneItems.forEach(e=>e.disposable.dispose())}};var lRt=class{constructor(i){this.nodes=i}toString(){return this.nodes.map(i=>typeof i=="string"?i:i.label).join("")}};I([mi],lRt.prototype,"toString",1);var N2o=/\[([^\]]+)\]\(((?:https?:\/\/|command:|file:)[^\)\s]+)(?: (["'])(.+?)(\3))?\)/gi;function lS(a){let i=[],e=0,t;for(;t=N2o.exec(a);){t.index-e>0&&i.push(a.substring(e,t.index));let[,o,n,,r]=t;r?i.push({label:o,href:n,title:r}):i.push({label:o,href:n}),e=t.index+t[0].length}return e<a.length&&i.push(a.substring(e)),new lRt(i)}var O2o=()=>({msLoopTime:-1,msDelayTime:-1,dispose:()=>{}}),zeo=O2o;function Keo(a){zeo=a}function Geo(a,i){return zeo(a,i)}var ohi="done",nhi="active",cRt="infinite",dRt="infinite-long-running",rhi="discrete",F2o=d(28,null);var fb=class a extends C{constructor(e,t){super();this.progressSignal=this._register(new me);this.workedVal=0,this.showDelayedScheduler=this._register(new Dt(()=>bn(this.element),0)),this.longRunningScheduler=this._register(new Dt(()=>this.infiniteLongRunning(),a.LONG_RUNNING_INFINITE_THRESHOLD)),this.create(e,t)}static{this.LONG_RUNNING_INFINITE_THRESHOLD=1e4}static{this.PROGRESS_SIGNAL_DEFAULT_DELAY=3e3}create(e,t){this.element=document.createElement("div"),this.element.classList.add("monaco-progress-container"),this.element.setAttribute("role","progressbar"),this.element.setAttribute("aria-valuemin","0"),this.element.setAttribute("aria-label",t?.ariaLabel&&t.ariaLabel.trim()?t.ariaLabel:F2o),e.appendChild(this.element),this.bit=document.createElement("div"),this.bit.classList.add("progress-bit"),this.bit.style.backgroundColor=t?.progressBarBackground||"#0E70C0",this.element.appendChild(this.bit)}off(){this.bit.style.width="inherit",this.bit.style.opacity="1",this.element.classList.remove(nhi,cRt,dRt,rhi),this.workedVal=0,this.totalWork=void 0,this.longRunningScheduler.cancel(),this.progressSignal.clear()}done(){return this.doDone(!0)}stop(){return this.doDone(!1)}doDone(e){return this.element.classList.add(ohi),this.element.classList.contains(cRt)?(this.bit.style.opacity="0",e?setTimeout(()=>this.off(),200):this.off()):(this.bit.style.width="inherit",e?setTimeout(()=>this.off(),200):this.off()),this}infinite(){return this.bit.style.width="2%",this.bit.style.opacity="1",this.element.classList.remove(rhi,ohi,dRt),this.element.classList.add(nhi,cRt),this.longRunningScheduler.schedule(),this}infiniteLongRunning(){this.element.classList.add(dRt)}total(e){return this.workedVal=0,this.totalWork=e,this.element.setAttribute("aria-valuemax",e.toString()),this}hasTotal(){return Xo(this.totalWork)}worked(e){return e=Math.max(1,Number(e)),this.doSetWorked(this.workedVal+e)}setWorked(e){return e=Math.max(1,Number(e)),this.doSetWorked(e)}doSetWorked(e){let t=this.totalWork||100;return this.workedVal=e,this.workedVal=Math.min(t,this.workedVal),this.element.classList.remove(cRt,dRt,ohi),this.element.classList.add(nhi,rhi),this.element.setAttribute("aria-valuenow",e.toString()),this.bit.style.width=100*(this.workedVal/t)+"%",this}getContainer(){return this.element}show(e){this.showDelayedScheduler.cancel(),this.progressSignal.value=Geo(a.PROGRESS_SIGNAL_DEFAULT_DELAY),typeof e=="number"?this.showDelayedScheduler.schedule(e):bn(this.element)}hide(){xo(this.element),this.showDelayedScheduler.cancel(),this.progressSignal.clear()}};var uRt=class extends C{constructor(e,t){super();this.progressBar=e;this.group=t;this.registerListeners()}registerListeners(){this._register(this.group.onDidModelChange(e=>{(e.kind===8||e.kind===6&&this.group.isEmpty)&&this.progressBar.stop().hide()}))}show(e,t){return this.group.isEmpty?zbt:e===!0?this.doShow(!0,t):this.doShow(e,t)}doShow(e,t){return typeof e=="boolean"?this.progressBar.infinite().show(t):this.progressBar.total(e).show(t),{total:o=>{this.progressBar.total(o)},worked:o=>{this.progressBar.hasTotal()?this.progressBar.worked(o):this.progressBar.infinite().show()},done:()=>{this.progressBar.stop().hide()}}}async showWhile(e,t){if(this.group.isEmpty)try{await e}catch{}return this.doShowWhile(e,t)}async doShowWhile(e,t){try{this.progressBar.infinite().show(t),await e}catch{}finally{this.progressBar.stop().hide()}}},RV;(r=>{let a;(h=>(h[h.None=0]="None",h[h.Done=1]="Done",h[h.Infinite=2]="Infinite",h[h.While=3]="While",h[h.Work=4]="Work"))(a=r.Type||={}),r.None={type:0},r.Done={type:1},r.Infinite={type:2};class o{constructor(l,c,u){this.whilePromise=l;this.whileStart=c;this.whileDelay=u;this.type=3}}r.While=o;class n{constructor(l,c){this.total=l;this.worked=c;this.type=4}}r.Work=n})(RV||={});var jEe=class extends C{constructor(e,t){super();this.progressBar=e;this.scope=t;this.progressState=RV.None;this.registerListeners()}registerListeners(){this._register(this.scope.onDidChangeActive(()=>{this.scope.isActive?this.onDidScopeActivate():this.onDidScopeDeactivate()}))}onDidScopeActivate(){if(this.progressState.type!==RV.Done.type)if(this.progressState.type===3){let e;if(this.progressState.whileDelay>0){let t=this.progressState.whileDelay-(Date.now()-this.progressState.whileStart);t>0&&(e=t)}this.doShowWhile(e)}else this.progressState.type===2?this.progressBar.infinite().show():this.progressState.type===4&&(this.progressState.total&&this.progressBar.total(this.progressState.total).show(),this.progressState.worked&&this.progressBar.worked(this.progressState.worked).show())}onDidScopeDeactivate(){this.progressBar.stop().hide()}show(e,t){return typeof e=="boolean"?this.progressState=RV.Infinite:this.progressState=new RV.Work(e,void 0),this.scope.isActive&&(this.progressState.type===2?this.progressBar.infinite().show(t):this.progressState.type===4&&typeof this.progressState.total=="number"&&this.progressBar.total(this.progressState.total).show(t)),{total:o=>{this.progressState=new RV.Work(o,this.progressState.type===4?this.progressState.worked:void 0),this.scope.isActive&&this.progressBar.total(o)},worked:o=>{!this.scope.isActive||this.progressBar.hasTotal()?(this.progressState=new RV.Work(this.progressState.type===4?this.progressState.total:void 0,this.progressState.type===4&&typeof this.progressState.worked=="number"?this.progressState.worked+o:o),this.scope.isActive&&this.progressBar.worked(o)):(this.progressState=RV.Infinite,this.progressBar.infinite().show())},done:()=>{this.progressState=RV.Done,this.scope.isActive&&this.progressBar.stop().hide()}}}async showWhile(e,t){this.progressState.type===3&&(e=Promise.allSettled([e,this.progressState.whilePromise])),this.progressState=new RV.While(e,t||0,Date.now());try{this.doShowWhile(t),await e}catch{}finally{(this.progressState.type!==3||this.progressState.whilePromise===e)&&(this.progressState=RV.None,this.scope.isActive&&this.progressBar.stop().hide())}}doShowWhile(e){this.scope.isActive&&this.progressBar.infinite().show(e)}},QEe=class extends C{constructor(e,t){super();this.scopeId=e;this._isActive=t;this._onDidChangeActive=this._register(new E);this.onDidChangeActive=this._onDidChangeActive.event}get isActive(){return this._isActive}onScopeOpened(e){e===this.scopeId&&(this._isActive||(this._isActive=!0,this._onDidChangeActive.fire()))}onScopeClosed(e){e===this.scopeId&&this._isActive&&(this._isActive=!1,this._onDidChangeActive.fire())}};var $eo=new D("menu.view.filter"),TC=new D("submenu.view.filter");fe.appendMenuItem($eo,{submenu:TC,title:d(4248,null),group:"navigation",icon:M.filter});var shi=class extends mE{constructor(){super(...arguments);this._checked=!1}set checked(e){this._checked!==e&&(this._checked=e,this.updateChecked())}updateChecked(){this.element&&this.element.classList.toggle("checked",this._checked)}render(e){super.render(e),this.updateChecked()}},$z=class extends Ma{constructor(e,t,o,n,r,s,l){super();this.options=e;this.instantiationService=t;this.contextViewService=o;this.keybindingService=r;this.configurationService=s;this.accessibilityService=l;this._onDidChangeFilterText=this._register(new E);this.onDidChangeFilterText=this._onDidChangeFilterText.event;this._onDidAcceptFilterText=this._register(new E);this.onDidAcceptFilterText=this._onDidAcceptFilterText.event;this.isMoreFiltersChecked=!1;this._accessibilityHelpHintAnnounced=!1;this.delayedFilterUpdate=new jo(300),this._register(Z(()=>this.delayedFilterUpdate.cancel())),e.focusContextKey&&(this.focusContextKey=new Q(e.focusContextKey,!1).bindTo(n)),this.element=_(".viewpane-filter"),[this.filterInputBox,this.focusTracker]=this.createInput(this.element),this._register(this.filterInputBox),this._register(this.focusTracker);let c=R(this.element,_(".viewpane-filter-controls"));this.filterBadge=this.createBadge(c),this.toolbar=this._register(this.createToolBar(c)),this.adjustInputBox()}get onDidFocus(){return this.focusTracker.onDidFocus}get onDidBlur(){return this.focusTracker.onDidBlur}hasFocus(){return this.filterInputBox.hasFocus()}focus(){this._updateFilterInputAriaLabel(),this.filterInputBox.focus()}_updateFilterInputAriaLabel(){let e=this.options.ariaLabel||d(4249,null);if(!this._accessibilityHelpHintAnnounced&&this.configurationService.getValue("accessibility.verbosity.find")&&this.accessibilityService.isScreenReaderOptimized()){let t=this.keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getAriaLabel();t&&(e+=", "+d(4247,null,t),this._accessibilityHelpHintAnnounced=!0,this._labelResetTimeout?.dispose(),this._labelResetTimeout=nn(()=>{this.filterInputBox.setAriaLabel(this.options.ariaLabel||d(4249,null))},1e3))}this.filterInputBox.setAriaLabel(e)}blur(){this.filterInputBox.blur()}updateBadge(e){this.filterBadge.classList.toggle("hidden",!e),this.filterBadge.textContent=e||"",this.adjustInputBox()}setFilterText(e){this.filterInputBox.value=e}getFilterText(){return this.filterInputBox.value}getHistory(){return this.filterInputBox.getHistory()}layout(e){this.element.parentElement?.classList.toggle("grow",e>700),this.element.classList.toggle("small",e<400),this.adjustInputBox(),this.lastWidth=e}relayout(){this.lastWidth&&this.layout(this.lastWidth)}checkMoreFilters(e){this.isMoreFiltersChecked=e,this.moreFiltersActionViewItem&&(this.moreFiltersActionViewItem.checked=e)}createInput(e){let t=this.options.history||[],o=this._register(this.instantiationService.createInstance(D1,e,this.contextViewService,{placeholder:this.options.placeholder,ariaLabel:this.options.ariaLabel,history:new Set(t),showHistoryHint:()=>ML(this.keybindingService),inputBoxStyles:pl}));this.options.text&&(o.value=this.options.text),this._register(o.onDidChange(r=>this.delayedFilterUpdate.trigger(()=>this.onDidInputChange(o)))),this._register(Vo(o.inputElement,re.KEY_DOWN,r=>this.onInputKeyDown(r))),this._register(Vo(e,re.KEY_DOWN,r=>this.handleKeyboardEvent(r))),this._register(Vo(e,re.KEY_UP,r=>this.handleKeyboardEvent(r))),this._register(Vo(o.inputElement,re.CLICK,r=>{r.stopPropagation(),r.preventDefault()}));let n=this._register(Vn(o.inputElement));return this.focusContextKey&&(this._register(n.onDidFocus(()=>this.focusContextKey.set(!0))),this._register(n.onDidBlur(()=>this.focusContextKey.set(!1))),this._register(Z(()=>this.focusContextKey.reset()))),[o,n]}createBadge(e){let t=R(e,_(".viewpane-filter-badge.hidden"));return t.style.backgroundColor=wt(rv),t.style.color=wt(Yw),t.style.border=`1px solid ${wt(gi)}`,t}createToolBar(e){return this.instantiationService.createInstance(Ln,e,$eo,{hiddenItemStrategy:-1,actionViewItemProvider:(t,o)=>{if(t instanceof Cc&&t.item.submenu.id===TC.id)return this.moreFiltersActionViewItem=this.instantiationService.createInstance(shi,t,o),this.moreFiltersActionViewItem.checked=this.isMoreFiltersChecked,this.moreFiltersActionViewItem}})}onDidInputChange(e){e.addToHistory(),this._onDidChangeFilterText.fire(e.value)}adjustInputBox(){this.filterInputBox.inputElement.style.paddingRight=this.element.classList.contains("small")||this.filterBadge.classList.contains("hidden")?"25px":"150px"}handleKeyboardEvent(e){(e.equals(10)||e.equals(15)||e.equals(17)||e.equals(14)||e.equals(13))&&e.stopPropagation()}onInputKeyDown(e){let t=!1;e.equals(2)&&!this.toolbar.isEmpty()&&(this.toolbar.focus(),t=!0),e.equals(3)&&(this._onDidAcceptFilterText.fire(),t=!0),t&&(e.stopPropagation(),e.preventDefault())}};$z=I([m(1,F),m(2,_n),m(3,X),m(4,_e),m(5,B),m(6,Bi)],$z);var Tde=class extends C{constructor(e,t,o,n,r){super();this.menuId=e;this.contextMenuId=t;this.options=o;this.contextKeyService=n;this.menuService=r;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this.menu=this._register(r.createMenu(e,n,{emitEventsForSubmenuChanges:!0})),this._register(this.menu.onDidChange(()=>{this.actions=void 0,this._onDidChange.fire()}))}getActions(){return this.actions||(this.actions=hl(this.menu.getActions(this.options))),this.actions}getPrimaryActions(){return this.getActions().primary}getSecondaryActions(){return this.getActions().secondary}getContextMenuActions(){if(this.contextMenuId){let e=this.menuService.getMenuActions(this.contextMenuId,this.contextKeyService,this.options);return hl(e).secondary}return[]}};Tde=I([m(3,X),m(4,qt)],Tde);var YEe=class extends Tde{constructor(i,e,t,o,n){let r=o.createScoped(i);r.createKey("viewContainer",e.id);let s=r.createKey("viewContainerLocation",WE(t.getViewContainerLocation(e)));super(D.ViewContainerTitle,D.ViewContainerTitleContext,{shouldForwardArgs:!0,renderShortTitle:!0},r,n),this._register(r),this._register(H.filter(t.onDidChangeContainerLocation,l=>l.viewContainer===e)(()=>s.set(WE(t.getViewContainerLocation(e)))))}};YEe=I([m(2,Ri),m(3,X),m(4,qt)],YEe);var pRt=new st("viewpane.action.filter"),W2o=Re("view-pane-container-expanded",M.chevronDown,d(4252,null)),V2o=Re("view-pane-container-collapsed",M.chevronRight,d(4251,null)),qeo=oe.as(on.ViewsRegistry),u9e=class{constructor(i,e,t,o,n,r){this.container=i;this.delegate=e;this.instantiationService=t;this.openerService=o;this.contextKeyService=n;this.items=[];this._enabled=!1;this._wide=!1;this.disposables=new P;this.enabledDisposables=this.disposables.add(new P);this.renderDisposables=this.disposables.add(new P);this.disposables.add(H.runAndSubscribe(this.delegate.onDidChangeViewWelcomeState,()=>this.onDidChangeViewWelcomeState())),this.disposables.add(r.onWillShutdown(()=>this.dispose()))}get enabled(){return this._enabled}layout(i,e){this._enabled&&(this.element.style.height=`${i}px`,this.element.style.width=`${e}px`,this._wide=e>640,this.element.classList.toggle("wide",this._wide),this.scrollableElement.scanDomNode())}focus(){this._enabled&&this.element.focus()}onDidChangeViewWelcomeState(){let i=this.delegate.shouldShowWelcome();if(this._enabled===i)return;if(this._enabled=i,!i){this.enabledDisposables.clear();return}this.container.classList.add("welcome");let e=R(this.container,_(".welcome-view"));this.element=_(".welcome-view-content",{tabIndex:0,role:"region","aria-label":d(4254,null)}),this._wide&&this.element.classList.add("wide"),this.scrollableElement=new Pa(this.element,{alwaysConsumeMouseWheel:!0,horizontal:2,vertical:3}),R(e,this.scrollableElement.getDomNode()),this.enabledDisposables.add(Z(()=>{this.container.classList.remove("welcome"),this.scrollableElement.dispose(),e.remove(),this.scrollableElement=void 0,this.element=void 0})),this.contextKeyService.onDidChangeContext(this.onDidChangeContext,this,this.enabledDisposables),H.chain(qeo.onDidChangeViewWelcomeContent,t=>t.filter(o=>o===this.delegate.id))(this.onDidChangeViewWelcomeContent,this,this.enabledDisposables),this.onDidChangeViewWelcomeContent()}onDidChangeViewWelcomeContent(){let i=qeo.getViewWelcomeContent(this.delegate.id);this.items=[];for(let e of i)if(e.when==="default")this.defaultItem={descriptor:e,visible:!0};else{let t=e.when?this.contextKeyService.contextMatchesRules(e.when):!0;this.items.push({descriptor:e,visible:t})}this.render()}onDidChangeContext(){let i=!1;for(let e of this.items){if(!e.descriptor.when||e.descriptor.when==="default")continue;let t=this.contextKeyService.contextMatchesRules(e.descriptor.when);e.visible!==t&&(e.visible=t,i=!0)}i&&this.render()}render(){this.renderDisposables.clear(),this.element.textContent="";let i=this.getContentDescriptors();if(i.length===0){this.container.classList.remove("welcome"),this.scrollableElement.scanDomNode();return}let e=0;for(let{content:t,precondition:o,renderSecondaryButtons:n}of i){let r=t.split(`
`);for(let s of r){if(s=s.trim(),!s)continue;let l=lS(s);if(l.nodes.length===1&&typeof l.nodes[0]!="string"){let c=l.nodes[0],u=R(this.element,_(".button-container")),p=new Mi(u,{title:c.title,supportIcons:!0,secondary:!!(n&&e>0),...Ko});if(p.label=c.label,p.onDidClick(h=>{this.openerService.open(c.href,{allowCommands:!0})},null,this.renderDisposables),this.renderDisposables.add(p),e++,o){let h=()=>p.enabled=this.contextKeyService.contextMatchesRules(o);h();let g=new Set(o.keys());H.filter(this.contextKeyService.onDidChangeContext,v=>v.affectsSome(g))(h,null,this.renderDisposables)}}else{let c=R(this.element,_("p"));for(let u of l.nodes)if(typeof u=="string")R(c,...Bn(u));else{let p=this.renderDisposables.add(this.instantiationService.createInstance(Xg,c,u,{}));if(o&&u.href.startsWith("command:")){let h=()=>p.enabled=this.contextKeyService.contextMatchesRules(o);h();let g=new Set(o.keys());H.filter(this.contextKeyService.onDidChangeContext,v=>v.affectsSome(g))(h,null,this.renderDisposables)}}}}}this.container.classList.add("welcome"),this.scrollableElement.scanDomNode()}getContentDescriptors(){let i=this.items.filter(e=>e.visible);return i.length===0&&this.defaultItem?[this.defaultItem.descriptor]:i.map(e=>e.descriptor)}dispose(){this.disposables.dispose()}};u9e=I([m(2,F),m(3,Qe),m(4,X),m(5,ao)],u9e);var zr=class extends sRt{constructor(e,t,o,n,r,s,l,c,u,p,h){super({...e,orientation:s.getViewLocationById(e.id)===1?1:0});this.keybindingService=t;this.contextMenuService=o;this.configurationService=n;this.contextKeyService=r;this.viewDescriptorService=s;this.instantiationService=l;this.openerService=c;this.themeService=u;this.hoverService=p;this.accessibleViewInformationService=h;this._onDidFocus=this._register(new E);this.onDidFocus=this._onDidFocus.event;this._onDidBlur=this._register(new E);this.onDidBlur=this._onDidBlur.event;this._onDidChangeBodyVisibility=this._register(new E);this.onDidChangeBodyVisibility=this._onDidChangeBodyVisibility.event;this._onDidChangeTitleArea=this._register(new E);this.onDidChangeTitleArea=this._onDidChangeTitleArea.event;this._onDidChangeViewWelcomeState=this._register(new E);this.onDidChangeViewWelcomeState=this._onDidChangeViewWelcomeState.event;this._isVisible=!1;this.headerActionViewItems=this._register(new jt);this.id=e.id,this._title=e.title,this._titleDescription=e.titleDescription,this._singleViewPaneContainerTitle=e.singleViewPaneContainerTitle,this.showActions=e.showActions??0,this.scopedContextKeyService=this._register(r.createScoped(this.element)),this.scopedContextKeyService.createKey("view",this.id);let g=this.scopedContextKeyService.createKey("viewLocation",WE(s.getViewLocationById(this.id)));this._register(H.filter(s.onDidChangeLocation,v=>v.views.some(b=>b.id===this.id))(()=>g.set(WE(s.getViewLocationById(this.id)))));let f=this._register(this.instantiationService.createChild(new Io([X,this.scopedContextKeyService])));this.menuActions=this._register(f.createInstance(Tde,e.titleMenuId??D.ViewTitle,D.ViewTitleContext,{shouldForwardArgs:!e.donotForwardArgs,renderShortTitle:!0})),this._register(this.menuActions.onDidChange(()=>this.updateActions()))}static{this.AlwaysShowActionsConfig="workbench.view.alwaysShowHeaderActions"}get title(){return this._title}get titleDescription(){return this._titleDescription}get singleViewPaneContainerTitle(){return this._singleViewPaneContainerTitle}get headerVisible(){return super.headerVisible}set headerVisible(e){super.headerVisible=e,this.element.classList.toggle("merged-header",!e)}setVisible(e){this._isVisible!==e&&(this._isVisible=e,this.isExpanded()&&this._onDidChangeBodyVisibility.fire(e))}isVisible(){return this._isVisible}isBodyVisible(){return this._isVisible&&this.isExpanded()}setExpanded(e){let t=super.setExpanded(e);return t&&this._onDidChangeBodyVisibility.fire(e),this.updateTwistyIcon(),t}render(){super.render();let e=Vn(this.element);this._register(e),this._register(e.onDidFocus(()=>this._onDidFocus.fire())),this._register(e.onDidBlur(()=>this._onDidBlur.fire()))}renderHeader(e){this.headerContainer=e,this.twistiesContainer=R(e,_(`.twisty-container${q.asCSSSelector(this.getTwistyIcon(this.isExpanded()))}`)),this.renderHeaderTitle(e,this.title);let t=R(e,_(".actions"));t.classList.toggle("show-always",this.showActions===2),t.classList.toggle("show-expanded",this.showActions===1),this.toolbar=this.instantiationService.createInstance(Ol,t,{orientation:0,actionViewItemProvider:(r,s)=>{let l=this.createActionViewItem(r,s);return l&&this.headerActionViewItems.set(l.action.id,l),l},ariaLabel:d(4253,null,this.title),getKeyBinding:r=>this.keybindingService.lookupKeybinding(r.id),renderDropdownAsChildElement:!0,actionRunner:this.getActionRunner(),resetMenu:this.menuActions.menuId}),this._register(this.toolbar),this.setActions(),this._register(j(t,re.CLICK,r=>r.preventDefault()));let o=this.viewDescriptorService.getViewContainerByViewId(this.id);o?this._register(this.viewDescriptorService.getViewContainerModel(o).onDidChangeContainerInfo(({title:r})=>this.updateTitle(this.title))):console.error(`View container model not found for view ${this.id}`);let n=H.filter(this.configurationService.onDidChangeConfiguration,r=>r.affectsConfiguration(zr.AlwaysShowActionsConfig));this._register(n(this.updateActionsVisibility,this)),this.updateActionsVisibility()}updateHeader(){super.updateHeader(),this.updateTwistyIcon()}updateTwistyIcon(){this.twistiesContainer&&(this.twistiesContainer.classList.remove(...q.asClassNameArray(this.getTwistyIcon(!this._expanded))),this.twistiesContainer.classList.add(...q.asClassNameArray(this.getTwistyIcon(this._expanded))))}getTwistyIcon(e){return e?W2o:V2o}style(e){super.style(e);let t=this.getIcon();if(this.iconContainer){let o=n_(e.headerForeground,wt(ko));A.isUri(t)?(this.iconContainer.style.backgroundColor=o,this.iconContainer.style.color=""):(this.iconContainer.style.color=o,this.iconContainer.style.backgroundColor="")}}getIcon(){return this.viewDescriptorService.getViewDescriptorById(this.id)?.containerIcon||Bke}renderHeaderTitle(e,t){this.iconContainer=R(e,_(".icon",void 0));let o=this.getIcon(),n;if(A.isUri(o)){n=`view-${this.id.replace(/[\.\:]/g,"-")}`;let s=`.pane-header .icon.${n}`;Vh(s,`
mask: ${Na(o)} no-repeat 50% 50%;
mask-size: 24px;
-webkit-mask: ${Na(o)} no-repeat 50% 50%;
-webkit-mask-size: 16px;
`)}else q.isThemeIcon(o)&&(n=q.asClassName(o));n&&this.iconContainer.classList.add(...n.split(" "));let r=this.calculateTitle(t);this.titleContainer=R(e,_("h3.title",{},r)),this.titleContainerHover=this._register(this.hoverService.setupManagedHover(Ni("mouse"),this.titleContainer,r)),this._titleDescription&&this.setTitleDescription(this._titleDescription),this.iconContainerHover=this._register(this.hoverService.setupManagedHover(Ni("mouse"),this.iconContainer,r)),this.iconContainer.setAttribute("aria-label",this._getAriaLabel(r,this._titleDescription))}_getAriaLabel(e,t){let o=this.viewDescriptorService.getViewDescriptorById(this.id)?.accessibilityHelpContent,n=this.accessibleViewInformationService?.hasShownAccessibleView(this.id);return!o||n?t?`${e} - ${t}`:e:d(4250,null,e)}updateTitle(e){let t=this.calculateTitle(e);this.titleContainer&&(this.titleContainer.textContent=t,this.titleContainerHover?.update(t)),this.updateAriaHeaderLabel(t,this._titleDescription),this._title=e,this._onDidChangeTitleArea.fire()}updateAriaHeaderLabel(e,t){let o=this._getAriaLabel(e,t);this.iconContainer&&(this.iconContainerHover?.update(e),this.iconContainer.setAttribute("aria-label",o)),this.ariaHeaderLabel=this.getAriaHeaderLabel(o)}setTitleDescription(e){this.titleDescriptionContainer?(this.titleDescriptionContainer.textContent=e??"",this.titleDescriptionContainerHover?.update(e??"")):e&&this.titleContainer&&(this.titleDescriptionContainer=emt(this.titleContainer,_("span.description",{},e)),this.titleDescriptionContainerHover=this._register(this.hoverService.setupManagedHover(Ni("mouse"),this.titleDescriptionContainer,e)))}updateTitleDescription(e){this.setTitleDescription(e),this.updateAriaHeaderLabel(this._title,e),this._titleDescription=e,this._onDidChangeTitleArea.fire()}calculateTitle(e){let t=this.viewDescriptorService.getViewContainerByViewId(this.id),o=this.viewDescriptorService.getViewContainerModel(t),n=this.viewDescriptorService.getViewDescriptorById(this.id);return!(this.viewDescriptorService.getDefaultContainerById(this.id)===t)&&n?.containerTitle&&o.title!==n.containerTitle&&e!==n.containerTitle?`${n.containerTitle}: ${e}`:e}renderBody(e){this.viewWelcomeController=this._register(this.instantiationService.createInstance(u9e,e,this))}layoutBody(e,t){this.viewWelcomeController?.layout(e,t)}onDidScrollRoot(){}getProgressIndicator(){if(this.progressBar===void 0&&(this.progressBar=this._register(new fb(this.element,kx)),this.progressBar.hide()),this.progressIndicator===void 0){let e=this;this.progressIndicator=this._register(new jEe(Oi(this.progressBar),this._register(new class extends QEe{constructor(){super(e.id,e.isBodyVisible()),this._register(e.onDidChangeBodyVisibility(t=>t?this.onScopeOpened(e.id):this.onScopeClosed(e.id)))}})))}return this.progressIndicator}getProgressLocation(){return this.viewDescriptorService.getViewContainerByViewId(this.id).id}getLocationBasedColors(){return qz(this.viewDescriptorService.getViewLocationById(this.id))}focus(){this.viewWelcomeController?.enabled?this.viewWelcomeController.focus():this.element&&this.element.focus(),(sa(this.element)||ts(this.element))&&this._onDidFocus.fire()}setActions(){if(this.toolbar){let e=[...this.menuActions.getPrimaryActions()];this.shouldShowFilterInHeader()&&e.unshift(pRt),this.toolbar.setActions(yq(e),yq(this.menuActions.getSecondaryActions())),this.toolbar.context=this.getActionsContext()}}updateActionsVisibility(){if(!this.headerContainer)return;let e=this.configurationService.getValue("workbench.view.alwaysShowHeaderActions");this.headerContainer.classList.toggle("actions-always-visible",e)}updateActions(){this.setActions(),this._onDidChangeTitleArea.fire()}createActionViewItem(e,t){if(e.id===pRt.id){let o=this;return new class extends oc{constructor(){super(null,e)}setFocusable(){}get trapsArrowNavigation(){return!0}render(n){n.classList.add("viewpane-filter-container");let r=o.getFilterWidget();R(n,r.element),r.relayout()}}}return Ca(this.instantiationService,e,{...t,menuAsChild:e instanceof Cc})}getActionsContext(){}getActionRunner(){}getOptimalWidth(){return 0}saveState(){}shouldShowWelcome(){return!1}getFilterWidget(){}shouldShowFilterInHeader(){return!1}};zr=I([m(1,_e),m(2,ze),m(3,B),m(4,X),m(5,Ri),m(6,F),m(7,Qe),m(8,De),m(9,tt)],zr);var iF=class extends zr{constructor(i,e,t,o,n,r,s,l,c,u,p){super(i,e,t,o,n,r,s,l,c,u,p);let h=this._register(s.createChild(new Io([X,this.scopedContextKeyService])));this.filterWidget=this._register(h.createInstance($z,i.filterOptions)),this._register(this.filterWidget.onDidAcceptFilterText(()=>this.focusBodyContent()))}getFilterWidget(){return this.filterWidget}renderBody(i){super.renderBody(i),this.filterContainer=R(i,_(".viewpane-filter-container"))}layoutBody(i,e){super.layoutBody(i,e),this.dimension=new ai(e,i);let t=!this.filterContainer?.hasChildNodes(),o=this.shouldShowFilterInHeader();t!==o&&(o&&Fi(this.filterContainer),this.updateActions(),o||R(this.filterContainer,this.filterWidget.element)),o||(i=i-44),this.filterWidget.layout(e),this.layoutBodyContent(i,e)}shouldShowFilterInHeader(){return!(this.dimension&&this.dimension.width<600&&this.dimension.height>100)}focusBodyContent(){this.focus()}};iF=I([m(1,_e),m(2,ze),m(3,B),m(4,X),m(5,Ri),m(6,F),m(7,Qe),m(8,De),m(9,tt)],iF);function qz(a){let i,e,t,o,n;switch(a){case 1:i=jS,e=v8e,t=c7i,o=d7i,n=u7i;break;case 0:case 2:default:i=op,e=Tj,t=b7i,o=S7i,n=I7i}return{background:i,overlayBackground:e,listOverrideStyles:{listBackground:i,treeStickyScrollBackground:t,treeStickyScrollBorder:o,treeStickyScrollShadow:n}}}var Fn=class extends K{constructor(i){super(i),this.desc=i}run(i,...e){let t=i.get(Ft).getActiveViewWithId(this.desc.viewId);if(t)return this.runInView(i,t,...e)}};var p9e=new Q("commentsFilterFocus",!1);var jeo=new Q("commentsView.showResolvedFilter",!0),Qeo=new Q("commentsView.showUnResolvedFilter",!0),ahi=new Q("commentsView.sortBy","resourceAscending"),mRt=class extends C{constructor(e,t){super();this.contextKeyService=t;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._showUnresolved=Qeo.bindTo(this.contextKeyService),this._showResolved=jeo.bindTo(this.contextKeyService),this._sortBy=ahi.bindTo(this.contextKeyService),this._showResolved.set(e.showResolved),this._showUnresolved.set(e.showUnresolved),this._sortBy.set(e.sortBy)}get showUnresolved(){return!!this._showUnresolved.get()}set showUnresolved(e){this._showUnresolved.get()!==e&&(this._showUnresolved.set(e),this._onDidChange.fire({showUnresolved:!0}))}get showResolved(){return!!this._showResolved.get()}set showResolved(e){this._showResolved.get()!==e&&(this._showResolved.set(e),this._onDidChange.fire({showResolved:!0}))}get sortBy(){return this._sortBy.get()??"resourceAscending"}set sortBy(e){this._sortBy.get()!==e&&(this._sortBy.set(e),this._onDidChange.fire({sortBy:e}))}};W(class extends Fn{constructor(){super({id:"commentsFocusViewFromFilter",title:d(8528,null),keybinding:{when:p9e,weight:200,primary:2066},viewId:Eu})}async runInView(a,i){i.focus()}});W(class extends Fn{constructor(){super({id:"commentsClearFilterText",title:d(8526,null),keybinding:{when:p9e,weight:200,primary:9},viewId:Eu})}async runInView(a,i){i.clearFilterText()}});W(class extends Fn{constructor(){super({id:"commentsFocusFilter",title:d(8527,null),keybinding:{when:Vl.isEqualTo(Eu),weight:200,primary:2084},viewId:Eu})}async runInView(a,i){i.focusFilter()}});W(class extends Fn{constructor(){super({id:`workbench.actions.${Eu}.toggleUnResolvedComments`,title:d(8535,null),category:d(8525,null),toggled:{condition:Qeo,title:d(8536,null)},menu:{id:TC,group:"1_filter",when:x.equals("view",Eu),order:1},viewId:Eu})}async runInView(a,i){i.filters.showUnresolved=!i.filters.showUnresolved}});W(class extends Fn{constructor(){super({id:`workbench.actions.${Eu}.toggleResolvedComments`,title:d(8532,null),category:d(8525,null),toggled:{condition:jeo,title:d(8529,null)},menu:{id:TC,group:"1_filter",when:x.equals("view",Eu),order:1},viewId:Eu})}async runInView(a,i){i.filters.showResolved=!i.filters.showResolved}});var lhi=new D("submenu.filter.commentSort");fe.appendMenuItem(TC,{submenu:lhi,title:d(8524,null),group:"2_sort",icon:M.history,when:x.equals("view",Eu)});W(class extends Fn{constructor(){super({id:`workbench.actions.${Eu}.toggleSortByUpdatedAt`,title:d(8534,null),category:d(8525,null),icon:M.history,viewId:Eu,toggled:{condition:x.equals(ahi.key,"updatedAtDescending"),title:d(8531,null)},menu:{id:lhi,group:"navigation",order:1,isHiddenByDefault:!1}})}async runInView(a,i){i.filters.sortBy="updatedAtDescending"}});W(class extends Fn{constructor(){super({id:`workbench.actions.${Eu}.toggleSortByResource`,title:d(8533,null),category:d(8525,null),icon:M.history,viewId:Eu,toggled:{condition:x.equals(ahi.key,"resourceAscending"),title:d(8530,null)},menu:{id:lhi,group:"navigation",order:0,isHiddenByDefault:!1}})}async runInView(a,i){i.filters.sortBy="resourceAscending"}});var B2o=J("editorGutter.commentRangeForeground",{dark:W$(xf,qo),light:Sp(W$(xf,qo),.05),hcDark:Oe.white,hcLight:Oe.black},d(8434,null)),Yeo=J("editorOverviewRuler.commentForeground",B2o,d(8437,null)),Xeo=J("editorOverviewRuler.commentUnresolvedForeground",Yeo,d(8438,null)),H2o=J("editorOverviewRuler.commentDraftForeground",Xeo,d(8436,null)),Jeo=J("editorGutter.commentGlyphForeground",{dark:od,light:od,hcDark:Oe.black,hcLight:Oe.white},d(8433,null));J("editorGutter.commentUnresolvedGlyphForeground",Jeo,d(8435,null));J("editorGutter.commentDraftGlyphForeground",Jeo,d(8432,null));var _de=class a extends C{constructor(e,t){super();this._threadHasDraft=!1;this._onDidChangeLineNumber=this._register(new E);this.onDidChangeLineNumber=this._onDidChangeLineNumber.event;this._commentsOptions=this.createDecorationOptions(),this._editor=e,this._commentsDecorations=this._editor.createDecorationsCollection(),this._register(this._commentsDecorations.onDidChange(o=>{let n=this._commentsDecorations.length>0?this._commentsDecorations.getRange(0):null;n&&n.endLineNumber!==this._lineNumber&&(this._lineNumber=n.endLineNumber,this._onDidChangeLineNumber.fire(this._lineNumber))})),this._register(Z(()=>this._commentsDecorations.clear())),this.setLineNumber(t)}static{this.description="comment-glyph-widget"}createDecorationOptions(){let e;this._threadHasDraft?e="comment-range-glyph comment-thread-draft":e=`comment-range-glyph comment-thread${this._threadState===0?"-unresolved":""}`;let t={description:a.description,isWholeLine:!0,overviewRuler:{color:Ss(this._threadHasDraft?H2o:this._threadState===0?Xeo:Yeo),position:2},collapseOnReplaceEdit:!0,linesDecorationsClassName:e};return po.createDynamic(t)}setThreadState(e,t=!1){(this._threadState!==e||this._threadHasDraft!==t)&&(this._threadState=e,this._threadHasDraft=t,this._commentsOptions=this.createDecorationOptions(),this._updateDecorations())}_updateDecorations(){let e=[{range:{startLineNumber:this._lineNumber,startColumn:1,endLineNumber:this._lineNumber,endColumn:1},options:this._commentsOptions}];this._commentsDecorations.set(e)}setLineNumber(e){this._lineNumber=e,this._updateDecorations()}getPosition(){let e=this._commentsDecorations.length>0?this._commentsDecorations.getRange(0):null;return{position:{lineNumber:e?e.endLineNumber:this._lineNumber,column:1},preference:[0]}}};var jz=class{constructor(i,e,t,o,n,r,s){this.keybindingService=i;this.contextKeyService=e;this.contextMenuService=t;this.container=o;this.actionHandler=n;this.maxActions=r;this.supportDropdowns=s;this._buttonElements=[];this._toDispose=new P;this._actions=[]}setActions(i,e=!1){this._toDispose.clear(),this._buttonElements.forEach(n=>n.remove()),this._buttonElements=[];let t=i.getActions({shouldForwardArgs:!0}),o=!e;for(let n of t){let[,r]=n;this._actions=r;for(let s of r){let l=this.supportDropdowns&&s instanceof Cc?s.actions:[],c=l.length?l[0]:s,u=this.keybindingService.lookupKeybinding(c.id,this.contextKeyService)?.getLabel();!u&&o&&(u=this.keybindingService.lookupKeybinding("editor.action.submitComment",this.contextKeyService)?.getLabel());let p=u?`${c.label} (${u})`:c.label,h=this.actionHandler,g=l.length?new $I(this.container,{contextMenuProvider:this.contextMenuService,actions:l,actionRunner:this._toDispose.add(new class extends as{async runAction(f,v){return h(f)}}),secondary:!o,title:p,addPrimaryActionToDropdown:!1,small:!0,...Ko}):new Mi(this.container,{secondary:!o,title:p,small:!0,...Ko});if(o=!1,this._buttonElements.push(g.element),this._toDispose.add(g),this._toDispose.add(g.onDidClick(()=>this.actionHandler(c))),g.enabled=c.enabled,g.label=c.label,this.maxActions!==void 0&&this._buttonElements.length>=this.maxActions){console.warn("An extension has contributed more than the allowable number of actions to a comments menu.");return}}}}triggerDefaultAction(){if(this._actions.length){let i=this._actions[0];if(i.enabled)return this.actionHandler(i)}}dispose(){this._toDispose.dispose()}};var ry=class extends C{static{this.ID="editor.contrib.menuPreventer"}constructor(i){super(),this._editor=i,this._altListeningMouse=!1,this._altMouseTriggered=!1,this._register(this._editor.onMouseDown(e=>{this._altListeningMouse&&(this._altMouseTriggered=!0)})),this._register(this._editor.onKeyDown(e=>{e.equals(512)&&(this._altListeningMouse||(this._altMouseTriggered=!1),this._altListeningMouse=!0)})),this._register(this._editor.onKeyUp(e=>{e.equals(512)&&(this._altMouseTriggered&&e.preventDefault(),this._altListeningMouse=!1,this._altMouseTriggered=!1)}))}};go(ry.ID,ry,2);var Zeo=new Q("editorDictation.inProgress",!1),eto=L(8167,"Voice"),dhi=class extends wl{constructor(){super({id:"workbench.action.editorDictation.start",title:L(8163,"Start Dictation in Editor"),category:eto,precondition:x.and(TV,TX.toNegated(),ue.readOnly.toNegated()),f1:!0,keybinding:{primary:2612,weight:200,secondary:ri?[603]:void 0}})}runEditorCommand(i,e){let o=i.get(_e).enableKeybindingHoldMode(this.desc.id);if(o){let n=!1,r=setTimeout(()=>{n=!0},500);o.finally(()=>{clearTimeout(r),n&&_C.get(e)?.stop()})}_C.get(e)?.start()}},m9e=class a extends wl{static{this.ID="workbench.action.editorDictation.stop"}constructor(){super({id:a.ID,title:L(8164,"Stop Dictation in Editor"),category:eto,precondition:Zeo,f1:!0,keybinding:{primary:9,weight:300}})}runEditorCommand(i,e){_C.get(e)?.stop()}},uhi=class extends C{constructor(e,t){super();this.editor=e;this.suppressMouseDown=!0;this.allowEditorOverflow=!0;this.domNode=document.createElement("div");let o=this._register(new ji(this.domNode)),n=t.lookupKeybinding(m9e.ID)?.getLabel();o.push(pi({id:m9e.ID,label:n?d(8165,null,n):d(8166,null),class:q.asClassName(M.micFilled),run:()=>_C.get(e)?.stop()}),{icon:!0,label:!1,keybinding:n}),this.domNode.classList.add("editor-dictation-widget"),this.domNode.appendChild(o.domNode)}getId(){return"editorDictation"}getDomNode(){return this.domNode}getPosition(){if(!this.editor.hasModel())return null;let e=this.editor.getSelection();return{position:e.getPosition(),preference:[e.getPosition().equals(e.getStartPosition())?1:2,0]}}beforeRender(){let e=this.editor.getPosition(),t=e?this.editor.getLineHeightForPosition(e):this.editor.getOption(75),o=this.editor.getLayoutInfo().contentWidth*.7;return this.domNode.style.setProperty("--vscode-editor-dictation-widget-height",`${t}px`),this.domNode.style.setProperty("--vscode-editor-dictation-widget-width",`${o}px`),null}show(){this.editor.addContentWidget(this)}layout(){this.editor.layoutContentWidget(this)}active(){this.domNode.classList.add("recording")}hide(){this.domNode.classList.remove("recording"),this.editor.removeContentWidget(this)}},_C=class extends C{constructor(e,t,o,n){super();this.editor=e;this.speechService=t;this.sessionDisposables=this._register(new me);this.widget=this._register(new uhi(this.editor,n)),this.editorDictationInProgress=Zeo.bindTo(o)}static{this.ID="editorDictation"}static get(e){return e.getContribution(_C.ID)}async start(){let e=new P;this.sessionDisposables.value=e,this.widget.show(),e.add(Z(()=>this.widget.hide())),this.editorDictationInProgress.set(!0),e.add(Z(()=>this.editorDictationInProgress.reset()));let t=this.editor.createDecorationsCollection();e.add(Z(()=>t.clear())),e.add(this.editor.onDidChangeCursorPosition(()=>this.widget.layout()));let o,n=0,r=(c,u)=>{o||(o=Oi(this.editor.getPosition()));let p=new Ie(o.lineNumber,o.column+c.length);this.editor.executeEdits(_C.ID,[An.replace(z.fromPositions(o,o.with(void 0,o.column+n)),c)],[Yt.fromPositions(p)]),u?t.set([{range:z.fromPositions(o,o.with(void 0,o.column+c.length)),options:{description:"editor-dictation-preview",inlineClassName:"ghost-text-decoration-preview"}}]):t.clear(),n=c.length,u||(o=void 0,n=0),this.editor.revealPositionInCenterIfOutsideViewport(p)},s=new $e;e.add(Z(()=>s.dispose(!0)));let l=await this.speechService.createSpeechToTextSession(s.token,"editor");e.add(l.onDidChange(c=>{if(!s.token.isCancellationRequested)switch(c.status){case 1:this.widget.active();break;case 4:e.dispose();break;case 2:{if(!c.text)return;r(c.text,!0);break}case 3:{if(!c.text)return;r(`${c.text} `,!1);break}}}))}stop(){this.sessionDisposables.clear()}};_C=I([m(1,EC),m(2,X),m(3,_e)],_C);go(_C.ID,_C,4);W(dhi);W(m9e);var sy=ae("snippetService");var phi=class{constructor(i){this.isBogous=!1,this.isTrivial=!1,this.usesClipboardVariable=!1,this.usesSelectionVariable=!1,this.codeSnippet=i;let e=new zh().parse(i,!1),t=new Map,o=0;for(let r of e.placeholders)o=Math.max(o,r.index);if(e.placeholders.length===0)this.isTrivial=!0;else if(o===0){let r=e.children.at(-1);this.isTrivial=r instanceof Tx&&r.isFinalTabstop}let n=[...e.children];for(;n.length>0;){let r=n.shift();if(r instanceof Wae){if(r.children.length===0&&!eQi[r.name]){let s=t.has(r.name)?t.get(r.name):++o;t.set(r.name,s);let l=new Tx(s).appendChild(new Qb(r.name));e.replace(r,[l]),this.isBogous=!0}switch(r.name){case"CLIPBOARD":this.usesClipboardVariable=!0;break;case"SELECTION":case"TM_SELECTED_TEXT":this.usesSelectionVariable=!0;break}}else n.push(...r.children)}this.isBogous&&(this.codeSnippet=e.toTextmateString())}},Dde=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h){this.isFileTemplate=i;this.scopes=e;this.name=t;this.prefix=o;this.description=n;this.body=r;this.source=s;this.snippetSource=l;this.snippetIdentifier=c;this.include=u;this.exclude=p;this.extensionId=h;this.prefixLow=o.toLowerCase(),this._bodyInsights=new hN(Ki(),()=>new phi(this.body))}get codeSnippet(){return this._bodyInsights.value.codeSnippet}get isBogous(){return this._bodyInsights.value.isBogous}get isTrivial(){return this._bodyInsights.value.isTrivial}get needsClipboard(){return this._bodyInsights.value.usesClipboardVariable}get usesSelection(){return this._bodyInsights.value.usesSelectionVariable}isFileIncluded(i){let e=i.scheme===Y.file?i.fsPath:i.path,t=No(e),o=n=>n.includes("/")?e:t;if(this.exclude){for(let n of this.exclude.filter(Boolean))if(Cp(n,o(n),{ignoreCase:!0}))return!1}if(this.include){for(let n of this.include.filter(Boolean))if(Cp(n,o(n),{ignoreCase:!0}))return!0;return!1}return!0}};function U2o(a){return yi(a)&&!!a.body}var XEe=class{constructor(i,e,t,o,n,r){this.source=i;this.location=e;this.defaultScopes=t;this._extension=o;this._fileService=n;this._extensionResourceLoaderService=r;this.data=[];this.isGlobalSnippets=Am(e.path)===".code-snippets",this.isUserSnippets=!this._extension}select(i,e){this.isGlobalSnippets||!this.isUserSnippets?this._scopeSelect(i,e):this._filepathSelect(i,e)}_filepathSelect(i,e){i+".json"===No(this.location.path)&&e.push(...this.data)}_scopeSelect(i,e){for(let o of this.data){let n=o.scopes.length;if(n===0)e.push(o);else for(let r=0;r<n;r++)if(o.scopes[r]===i){e.push(o);break}}let t=i.lastIndexOf(".");t>=0&&this._scopeSelect(i.substring(0,t),e)}async _load(){return this._extension?this._extensionResourceLoaderService.readExtensionResource(this.location):(await this._fileService.readFile(this.location)).value.toString()}load(){return this._loadPromise||(this._loadPromise=Promise.resolve(this._load()).then(i=>{let e=Ur(i);if(Vx(e)==="object")for(let[t,o]of Object.entries(e))if(U2o(o))this._parseSnippet(t,o,this.data);else for(let[n,r]of Object.entries(o))this._parseSnippet(n,r,this.data);return this})),this._loadPromise}reset(){this._loadPromise=void 0,this.data.length=0}_parseSnippet(i,e,t){let{isFileTemplate:o,prefix:n,body:r,description:s}=e;if(n||(n=""),Array.isArray(r)&&(r=r.join(`
`)),typeof r!="string")return;Array.isArray(s)&&(s=s.join(`
`));let l;this.defaultScopes?l=this.defaultScopes:typeof e.scope=="string"?l=e.scope.split(",").map(h=>h.trim()).filter(Boolean):l=[];let c;e.include&&(Array.isArray(e.include)?c=e.include:typeof e.include=="string"&&(c=[e.include]));let u;e.exclude&&(Array.isArray(e.exclude)?u=e.exclude:typeof e.exclude=="string"&&(u=[e.exclude]));let p;this._extension?p=this._extension.displayName||this._extension.name:this.source===2?p=d(13559,null):this.isGlobalSnippets?p=d(13558,null):p=d(13557,null);for(let h of ht.wrap(n))t.push(new Dde(!!o,l,i,h,s,r,p,this.source,this._extension?`${Fc(this._extension.extensionLocation,this.location)}/${i}`:`${No(this.location.path)}/${i}`,c,u,this._extension?.identifier))}};var WX=[],mhi=[],hhi=[];function h9e(a,i=!1){oto(a,!1,i)}function ito(a){oto(a,!0,!1)}function oto(a,i,e){let t=z2o(a,i);WX.push(t),t.userConfigured?hhi.push(t):mhi.push(t),e&&!t.userConfigured&&WX.forEach(o=>{o.mime===t.mime||o.userConfigured||(t.extension&&o.extension===t.extension&&console.warn(`Overwriting extension <<${t.extension}>> to now point to mime <<${t.mime}>>`),t.filename&&o.filename===t.filename&&console.warn(`Overwriting filename <<${t.filename}>> to now point to mime <<${t.mime}>>`),t.filepattern&&o.filepattern===t.filepattern&&console.warn(`Overwriting filepattern <<${t.filepattern}>> to now point to mime <<${t.mime}>>`),t.firstline&&o.firstline===t.firstline&&console.warn(`Overwriting firstline <<${t.firstline}>> to now point to mime <<${t.mime}>>`))})}function z2o(a,i){return{id:a.id,mime:a.mime,filename:a.filename,extension:a.extension,filepattern:a.filepattern,firstline:a.firstline,userConfigured:i,filepatternParsed:a.filepattern?zm(a.filepattern,{ignoreCase:!0}):void 0,filepatternOnPath:a.filepattern?a.filepattern.indexOf(Lo.sep)>=0:!1}}function nto(){WX=WX.filter(a=>a.userConfigured),mhi=[]}function rto(){WX=WX.filter(a=>!a.userConfigured),hhi=[]}function JEe(a,i){return ato(a,i).map(e=>e.mime)}function sto(a,i){return ato(a,i).map(e=>e.id)}function ato(a,i){let e;if(a)switch(a.scheme){case Y.file:e=a.fsPath;break;case Y.data:{e=g$.parseMetaData(a).get(g$.META_DATA_LABEL);break}case Y.vscodeNotebookCell:e=void 0;break;default:e=a.path}if(!e)return[{id:"unknown",mime:Zn.unknown}];e=e.toLowerCase();let t=No(e),o=tto(e,t,hhi);if(o)return[o,{id:Fr,mime:Zn.text}];let n=tto(e,t,mhi);if(n)return[n,{id:Fr,mime:Zn.text}];if(i){let r=K2o(i);if(r)return[r,{id:Fr,mime:Zn.text}]}return[{id:"unknown",mime:Zn.unknown}]}function tto(a,i,e){let t,o,n;for(let r=e.length-1;r>=0;r--){let s=e[r];if(l1i(i,s.filename,!0)){t=s;break}if(s.filepattern&&(!o||s.filepattern.length>o.filepattern.length)){let l=s.filepatternOnPath?a:i;s.filepatternParsed?.(l)&&(o=s)}s.extension&&(!n||s.extension.length>n.extension.length)&&gpt(i,s.extension)&&(n=s)}if(t)return t;if(o)return o;if(n)return n}function K2o(a){if(Spt(a)&&(a=a.substring(1)),a.length>0)for(let i=WX.length-1;i>=0;i--){let e=WX[i];if(!e.firstline)continue;let t=a.match(e.firstline);if(t&&t.length>0)return e}}var MV=Object.prototype.hasOwnProperty,lto="vs.editor.nullLanguage",ghi=class{constructor(){this._languageIdToLanguage=[];this._languageToLanguageId=new Map;this._register(lto,0),this._register(Fr,1),this._nextLanguageId=2}_register(i,e){this._languageIdToLanguage[e]=i,this._languageToLanguageId.set(i,e)}register(i){if(this._languageToLanguageId.has(i))return;let e=this._nextLanguageId++;this._register(i,e)}encodeLanguageId(i){return this._languageToLanguageId.get(i)||0}decodeLanguageId(i){return this._languageIdToLanguage[i]||lto}},gRt=class a extends C{constructor(e=!0,t=!1){super();this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;a.instanceCount++,this._warnOnOverwrite=t,this.languageIdCodec=new ghi,this._dynamicLanguages=[],this._languages={},this._mimeTypesMap={},this._nameMap={},this._lowercaseNameMap={},e&&(this._initializeFromRegistry(),this._register(LM.onDidChangeLanguages(o=>{this._initializeFromRegistry()})))}static{this.instanceCount=0}dispose(){a.instanceCount--,super.dispose()}setDynamicLanguages(e){this._dynamicLanguages=e,this._initializeFromRegistry()}_initializeFromRegistry(){this._languages={},this._mimeTypesMap={},this._nameMap={},this._lowercaseNameMap={},nto();let e=[].concat(LM.getLanguages()).concat(this._dynamicLanguages);this._registerLanguages(e)}registerLanguage(e){return LM.registerLanguage(e)}_registerLanguages(e){for(let t of e)this._registerLanguage(t);this._mimeTypesMap={},this._nameMap={},this._lowercaseNameMap={},Object.keys(this._languages).forEach(t=>{let o=this._languages[t];o.name&&(this._nameMap[o.name]=o.identifier),o.aliases.forEach(n=>{this._lowercaseNameMap[n.toLowerCase()]=o.identifier}),o.mimetypes.forEach(n=>{this._mimeTypesMap[n]=o.identifier})}),oe.as(ii.Configuration).registerOverrideIdentifiers(this.getRegisteredLanguageIds()),this._onDidChange.fire()}_registerLanguage(e){let t=e.id,o;MV.call(this._languages,t)?o=this._languages[t]:(this.languageIdCodec.register(t),o={identifier:t,name:null,mimetypes:[],aliases:[],extensions:[],filenames:[],configurationFiles:[],icons:[]},this._languages[t]=o),this._mergeLanguage(o,e)}_mergeLanguage(e,t){let o=t.id,n=null;if(Array.isArray(t.mimetypes)&&t.mimetypes.length>0&&(e.mimetypes.push(...t.mimetypes),n=t.mimetypes[0]),n||(n=`text/x-${o}`,e.mimetypes.push(n)),Array.isArray(t.extensions)){t.configuration?e.extensions=t.extensions.concat(e.extensions):e.extensions=e.extensions.concat(t.extensions);for(let l of t.extensions)h9e({id:o,mime:n,extension:l},this._warnOnOverwrite)}if(Array.isArray(t.filenames))for(let l of t.filenames)h9e({id:o,mime:n,filename:l},this._warnOnOverwrite),e.filenames.push(l);if(Array.isArray(t.filenamePatterns))for(let l of t.filenamePatterns)h9e({id:o,mime:n,filepattern:l},this._warnOnOverwrite);if(typeof t.firstLine=="string"&&t.firstLine.length>0){let l=t.firstLine;l.charAt(0)!=="^"&&(l="^"+l);try{let c=new RegExp(l);xbe(c)||h9e({id:o,mime:n,firstline:c},this._warnOnOverwrite)}catch(c){console.warn(`[${t.id}]: Invalid regular expression \`${l}\`: `,c)}}e.aliases.push(o);let r=null;if(typeof t.aliases<"u"&&Array.isArray(t.aliases)&&(t.aliases.length===0?r=[null]:r=t.aliases),r!==null)for(let l of r)!l||l.length===0||e.aliases.push(l);let s=r!==null&&r.length>0;if(!(s&&r[0]===null)){let l=(s?r[0]:null)||o;(s||!e.name)&&(e.name=l)}t.configuration&&e.configurationFiles.push(t.configuration),t.icon&&e.icons.push(t.icon)}isRegisteredLanguageId(e){return e?MV.call(this._languages,e):!1}getRegisteredLanguageIds(){return Object.keys(this._languages)}getSortedRegisteredLanguageNames(){let e=[];for(let t in this._nameMap)MV.call(this._nameMap,t)&&e.push({languageName:t,languageId:this._nameMap[t]});return e.sort((t,o)=>Uw(t.languageName,o.languageName)),e}getLanguageName(e){return MV.call(this._languages,e)?this._languages[e].name:null}getMimeType(e){return MV.call(this._languages,e)&&this._languages[e].mimetypes[0]||null}getExtensions(e){return MV.call(this._languages,e)?this._languages[e].extensions:[]}getFilenames(e){return MV.call(this._languages,e)?this._languages[e].filenames:[]}getIcon(e){return MV.call(this._languages,e)&&this._languages[e].icons[0]||null}getConfigurationFiles(e){return MV.call(this._languages,e)?this._languages[e].configurationFiles||[]:[]}getLanguageIdByLanguageName(e){let t=e.toLowerCase();return MV.call(this._lowercaseNameMap,t)?this._lowercaseNameMap[t]:null}getLanguageIdByMimeType(e){return e&&MV.call(this._mimeTypesMap,e)?this._mimeTypesMap[e]:null}guessLanguageIdByFilepathOrFirstLine(e,t){return!e&&!t?[]:sto(e,t)}};var fRt=class a extends C{constructor(e=!1){super();this._onDidRequestBasicLanguageFeatures=this._register(new E);this.onDidRequestBasicLanguageFeatures=this._onDidRequestBasicLanguageFeatures.event;this._onDidRequestRichLanguageFeatures=this._register(new E);this.onDidRequestRichLanguageFeatures=this._onDidRequestRichLanguageFeatures.event;this._onDidChange=this._register(new E({leakWarningThreshold:200}));this.onDidChange=this._onDidChange.event;this._requestedBasicLanguages=new Set;this._requestedRichLanguages=new Set;a.instanceCount++,this._registry=this._register(new gRt(!0,e)),this.languageIdCodec=this._registry.languageIdCodec,this._register(this._registry.onDidChange(()=>this._onDidChange.fire()))}static{this.instanceCount=0}dispose(){a.instanceCount--,super.dispose()}registerLanguage(e){return this._registry.registerLanguage(e)}isRegisteredLanguageId(e){return this._registry.isRegisteredLanguageId(e)}getRegisteredLanguageIds(){return this._registry.getRegisteredLanguageIds()}getSortedRegisteredLanguageNames(){return this._registry.getSortedRegisteredLanguageNames()}getLanguageName(e){return this._registry.getLanguageName(e)}getMimeType(e){return this._registry.getMimeType(e)}getIcon(e){return this._registry.getIcon(e)}getExtensions(e){return this._registry.getExtensions(e)}getFilenames(e){return this._registry.getFilenames(e)}getConfigurationFiles(e){return this._registry.getConfigurationFiles(e)}getLanguageIdByLanguageName(e){return this._registry.getLanguageIdByLanguageName(e)}getLanguageIdByMimeType(e){return this._registry.getLanguageIdByMimeType(e)}guessLanguageIdByFilepathOrFirstLine(e,t){return this._registry.guessLanguageIdByFilepathOrFirstLine(e,t).at(0)??null}createById(e){return new g9e(this.onDidChange,()=>this._createAndGetLanguageIdentifier(e))}createByMimeType(e){return new g9e(this.onDidChange,()=>{let t=this.getLanguageIdByMimeType(e);return this._createAndGetLanguageIdentifier(t)})}createByFilepathOrFirstLine(e,t){return new g9e(this.onDidChange,()=>{let o=this.guessLanguageIdByFilepathOrFirstLine(e,t);return this._createAndGetLanguageIdentifier(o)})}_createAndGetLanguageIdentifier(e){return(!e||!this.isRegisteredLanguageId(e))&&(e=Fr),e}requestBasicLanguageFeatures(e){this._requestedBasicLanguages.has(e)||(this._requestedBasicLanguages.add(e),this._onDidRequestBasicLanguageFeatures.fire(e))}requestRichLanguageFeatures(e){this._requestedRichLanguages.has(e)||(this._requestedRichLanguages.add(e),this.requestBasicLanguageFeatures(e),kc.getOrCreate(e),this._onDidRequestRichLanguageFeatures.fire(e))}},g9e=class{constructor(i,e){this._value=ui(this,i,()=>e()),this.onDidChange=H.fromObservable(this._value)}get languageId(){return this._value.get()}};var C5=Tn.registerExtensionPoint({extensionPoint:"languages",jsonSchema:{description:d(17112,null),type:"array",items:{type:"object",defaultSnippets:[{body:{id:"${1:languageId}",aliases:["${2:label}"],extensions:["${3:extension}"],configuration:"./language-configuration.json"}}],properties:{id:{description:d(17122,null),type:"string"},aliases:{description:d(17113,null),type:"array",items:{type:"string"}},extensions:{description:d(17115,null),default:[".foo"],type:"array",items:{type:"string"}},filenames:{description:d(17117,null),type:"array",items:{type:"string"}},filenamePatterns:{description:d(17116,null),type:"array",items:{type:"string"}},mimetypes:{description:d(17123,null),type:"array",items:{type:"string"}},firstLine:{description:d(17118,null),type:"string"},configuration:{description:d(17114,null),type:"string",default:"./language-configuration.json"},icon:{type:"object",description:d(17119,null),properties:{light:{description:d(17121,null),type:"string"},dark:{description:d(17120,null),type:"string"}}}}}},activationEventsGenerator:function*(a){for(let i of a)i.id&&i.configuration&&(yield`onLanguage:${i.id}`)}}),fhi=class extends C{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.languages}render(e){let t=e.contributes,o=t?.languages||[],n=[];for(let p of o)cto(p)&&n.push({id:p.id,name:(p.aliases||[])[0]||p.id,extensions:p.extensions||[],hasGrammar:!1,hasSnippets:!1});let r=a6(n,p=>p.id);if((t?.grammars||[]).forEach(p=>{if(!Ae(p.language))return;let h=r[p.language];h?h.hasGrammar=!0:(h={id:p.language,name:p.language,extensions:[],hasGrammar:!0,hasSnippets:!1},r[h.id]=h,n.push(h))}),(t?.snippets||[]).forEach(p=>{if(!Ae(p.language))return;let h=r[p.language];h?h.hasSnippets=!0:(h={id:p.language,name:p.language,extensions:[],hasGrammar:!1,hasSnippets:!0},r[h.id]=h,n.push(h))}),!n.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let c=[d(17100,null),d(17101,null),d(17096,null),d(17097,null),d(17111,null)],u=n.sort((p,h)=>p.id.localeCompare(h.id)).map(p=>[p.id,p.name,new xe().appendMarkdown(`${p.extensions.map(h=>`\`${h}\``).join(" ")}`),p.hasGrammar?"\u2714\uFE0E":"\u2014",p.hasSnippets?"\u2714\uFE0E":"\u2014"]);return{data:{headers:c,rows:u},dispose:()=>{}}}};oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:"languages",label:d(17102,null),access:{canToggle:!1},renderer:new Mt(fhi)});var f9e=class extends fRt{constructor(e,t,o,n){super(o.verbose||o.isExtensionDevelopment||!o.isBuilt);this.logService=n;this._configurationService=t,this._extensionService=e,C5.setHandler(r=>{let s=[];for(let l=0,c=r.length;l<c;l++){let u=r[l];if(!Array.isArray(u.value)){u.collector.error(d(17098,null,C5.name));continue}for(let p=0,h=u.value.length;p<h;p++){let g=u.value[p];if(cto(g,u.collector)){let f;g.configuration&&(f=je(u.description.extensionLocation,g.configuration)),s.push({id:g.id,extensions:g.extensions,filenames:g.filenames,filenamePatterns:g.filenamePatterns,firstLine:g.firstLine,aliases:g.aliases,mimetypes:g.mimetypes,configuration:f,icon:g.icon&&{light:je(u.description.extensionLocation,g.icon.light),dark:je(u.description.extensionLocation,g.icon.dark)}})}}}this._registry.setDynamicLanguages(s)}),this.updateMime(),this._register(this._configurationService.onDidChangeConfiguration(r=>{r.affectsConfiguration(Y$)&&this.updateMime()})),this._extensionService.whenInstalledExtensionsRegistered().then(()=>{this.updateMime()}),this._register(this.onDidRequestRichLanguageFeatures(r=>{this._extensionService.activateByEvent(`onLanguage:${r}`),this._extensionService.activateByEvent("onLanguage")}))}updateMime(){let e=this._configurationService.getValue();rto(),e.files?.associations&&Object.keys(e.files.associations).forEach(t=>{let o=e.files.associations[t];if(typeof o!="string"){this.logService.warn(`Ignoring configured 'files.associations' for '${t}' because its type is not a string but '${typeof o}'`);return}let n=this.getMimeType(o)||`text/x-${o}`;ito({id:o,mime:n,filepattern:t})}),this._onDidChange.fire()}};f9e=I([m(0,lt),m(1,B),m(2,Co),m(3,ne)],f9e);function vRt(a){return typeof a>"u"?!0:Array.isArray(a)?a.every(i=>typeof i=="string"):!1}function cto(a,i){return a?typeof a.id!="string"?(i?.error(d(17110,null,"id")),!1):vRt(a.extensions)?vRt(a.filenames)?typeof a.firstLine<"u"&&typeof a.firstLine!="string"?(i?.error(d(17107,null,"firstLine")),!1):typeof a.configuration<"u"&&typeof a.configuration!="string"?(i?.error(d(17104,null,"configuration")),!1):vRt(a.aliases)?vRt(a.mimetypes)?typeof a.icon<"u"&&(typeof a.icon!="object"||typeof a.icon.light!="string"||typeof a.icon.dark!="string")?(i?.error(d(17108,null,"icon","light","dark")),!1):!0:(i?.error(d(17109,null,"mimetypes")),!1):(i?.error(d(17103,null,"aliases")),!1):(i?.error(d(17106,null,"filenames")),!1):(i?.error(d(17105,null,"extensions")),!1):(i?.error(d(17099,null,C5.name)),!1)}we(kt,f9e,0);var dto="_snippet.markAsUsed";qe.registerCommand(dto,(a,...i)=>{let e=a.get(sy),[t]=i;t instanceof Dde&&e.updateUsageTimestamp(t)});var VX=class{constructor(i,e){this.snippet=i;this.label={label:i.prefix,description:i.name},this.detail=d(13538,null,i.description||i.name,i.source),this.insertText=i.codeSnippet,this.extensionId=i.extensionId,this.range=e,this.sortText=`${i.snippetSource===3?"z":"a"}-${i.prefix}`,this.kind=28,this.insertTextRules=4,this.command={id:dto,title:"",arguments:[i]}}resolve(){return this.documentation=new xe().appendCodeblock("",zh.asInsertText(this.snippet.codeSnippet)),this}static compareByLabel(i,e){return Al(i.label.label,e.label.label)}},ZEe=class{constructor(i,e,t){this._languageService=i;this._snippets=e;this._languageConfigurationService=t;this._debugDisplayName="snippetCompletions"}async provideCompletionItems(i,e,t){let o=new En,n=e.lineNumber,r=i.getWordAtPosition(e)??{startColumn:e.column,endColumn:e.column,word:""},s=i.getLineContent(e.lineNumber).toLowerCase(),l=s.substring(0,r.startColumn+r.word.length-1),c=this._computeSnippetPositions(i,n,r,l),u=e.column-1,p=t.triggerCharacter?.toLowerCase()??"",h=this._getLanguageIdAtPosition(i,e),g=this._languageConfigurationService.getLanguageConfiguration(h),f=new Set(await this._snippets.getSnippets(h,i.uri)),v=[];for(let b of f){if(t.triggerKind===1&&!b.prefixLow.startsWith(p))continue;let S;for(let U of c)if(!(U.prefixLow.match(/^\s/)&&!b.prefixLow.match(/^\s/))&&Jqe(U.prefixLow,0,U.prefixLow.length,b.prefixLow,0,b.prefixLow.length)){S=U;break}if(!S)continue;let y=S.startColumn-1,w=b.prefixLow.length-(u-y),k=kbe(s,b.prefixLow,u,u+w,u-y),T=e.with(void 0,y+1),N=k===0?e.column+w:e.column;u<s.length&&g.getAutoClosingPairs().autoClosingPairsCloseSingleChar.get(s[u])?.some($=>$.open===s[T.column-1]&&b.prefix.startsWith($.open)&&b.prefix[b.prefix.length-1]===$.close)&&N++;let O=z.fromPositions({lineNumber:n,column:S.startColumn},{lineNumber:n,column:N}),V=O.setEndPosition(n,e.column);v.push(new VX(b,{replace:O,insert:V})),f.delete(b)}if(!p&&(/\s/.test(s[e.column-2])||!s))for(let b of f){let S=z.fromPositions(e),y=s.indexOf(b.prefixLow,u)===u?S.setEndPosition(e.lineNumber,e.column+b.prefixLow.length):S;v.push(new VX(b,{replace:y,insert:S}))}return this._disambiguateSnippets(v),{suggestions:v,duration:o.elapsed()}}_disambiguateSnippets(i){i.sort(VX.compareByLabel);for(let e=0;e<i.length;e++){let t=i[e],o=e+1;for(;o<i.length&&t.label===i[o].label;o++)i[o].label.label=d(13539,null,i[o].label.label,i[o].snippet.name);o>e+1&&(i[e].label.label=d(13539,null,i[e].label.label,i[e].snippet.name),e=o)}}resolveCompletionItem(i){return i instanceof VX?i.resolve():i}_computeSnippetPositions(i,e,t,o){let n=[];for(let r=1;r<t.startColumn;r++){let s=i.getWordAtPosition(new Ie(e,r));n.push({startColumn:r,prefixLow:o.substring(r-1),isWord:!!s}),s&&(r=s.endColumn,n.push({startColumn:s.endColumn,prefixLow:o.substring(s.endColumn-1),isWord:!1}))}return(t.word.length>0||n.length===0)&&n.push({startColumn:t.startColumn,prefixLow:o.substring(t.startColumn-1),isWord:!0}),n}_getLanguageIdAtPosition(i,e){i.tokenization.tokenizeIfCheap(e.lineNumber);let t=i.getLanguageIdAtPosition(e.lineNumber,e.column);return this._languageService.getLanguageName(t)||(t=i.getLanguageId()),t}};ZEe=I([m(0,kt),m(1,sy),m(2,bs)],ZEe);var mn=ae("IUserDataProfileService"),UE=ae("IUserDataProfileManagementService");var v9e="profile";function uto(a,i){return A.from({scheme:i.urlProtocol,authority:v9e,path:a.startsWith("/")?a:`/${a}`})}var vhi="profile-";function eTe(a){return a.authority===v9e||new RegExp(`^${vhi}`).test(a.authority)}var PV=ae("IUserDataProfileImportExportService"),pto=Re("defaultProfile-icon",M.settings,d(17523,null)),bhi=L(17525,"Profiles"),oF={...bhi},b9e="code-profile",S9e=[{name:d(17524,null),extensions:[b9e]}],I9e=new Q("currentProfile",""),mto=new Q("isCurrentProfileTransient",!1),x5=new Q("hasProfiles",!1);var Shi;(t=>{function a(o,n,r){if(Jl(n.path))return o.collector.error(d(13564,null,o.description.name,String(n.path))),null;if(Jl(n.language)&&!n.path.endsWith(".code-snippets"))return o.collector.error(d(13563,null,o.description.name,String(n.path))),null;if(!Jl(n.language)&&!r.isRegisteredLanguageId(n.language))return o.collector.error(d(13562,null,o.description.name,String(n.language))),null;let s=o.description.extensionLocation,l=je(s,n.path);return La(l,s)?{language:n.language,location:l}:(o.collector.error(d(13565,null,o.description.name,l.path,s.path)),null)}t.toValidSnippet=a,t.snippetsContribution={description:d(13566,null),type:"array",defaultSnippets:[{body:[{language:"",path:""}]}],items:{type:"object",defaultSnippets:[{body:{language:"${1:id}",path:"./snippets/${2:id}.json."}}],properties:{language:{description:d(13567,null),type:"string"},path:{description:d(13568,null),type:"string"}}}},t.point=Tn.registerExtensionPoint({extensionPoint:"snippets",deps:[C5],jsonSchema:t.snippetsContribution})})(Shi||={});function G2o(a,i,e){return hn(a.watch(i),a.onDidFilesChange(t=>{t.affects(i)&&e()}))}var BX=class{constructor(i){this._storageService=i;let e=i.get(BX._key,0,""),t;try{t=JSON.parse(e)}catch{}this._ignored=SS(t)?new Set(t):new Set}static{this._key="snippets.ignoredSnippets"}isIgnored(i){return this._ignored.has(i)}updateIgnored(i,e){let t=!1;this._ignored.has(i)&&!e?(this._ignored.delete(i),t=!0):!this._ignored.has(i)&&e&&(this._ignored.add(i),t=!0),t&&this._storageService.store(BX._key,JSON.stringify(Array.from(this._ignored)),0,0)}};BX=I([m(0,le)],BX);var HX=class{constructor(i){this._storageService=i;let e=i.get(HX._key,0,""),t;try{t=JSON.parse(e)}catch{t=[]}this._usages=Array.isArray(t)?new Map(t):new Map}static{this._key="snippets.usageTimestamps"}getUsageTimestamp(i){return this._usages.get(i)}updateUsageTimestamp(i){this._usages.delete(i),this._usages.set(i,Date.now());let e=[...this._usages].slice(-100);this._storageService.store(HX._key,JSON.stringify(e),0,0)}};HX=I([m(0,le)],HX);var tTe=class{constructor(i,e,t,o,n,r,s,l,c,u,p){this._environmentService=i;this._userDataProfileService=e;this._contextService=t;this._languageService=o;this._logService=n;this._fileService=r;this._textfileService=s;this._extensionResourceLoaderService=l;this._disposables=new P;this._pendingWork=[];this._files=new vt;this._pendingWork.push(Promise.resolve(c.when(3).then(()=>{this._initExtensionSnippets(),this._initUserSnippets(),this._initWorkspaceSnippets()}))),Y8i(new ZEe(this._languageService,this,p)),this._enablement=u.createInstance(BX),this._usageTimestamps=u.createInstance(HX)}dispose(){this._disposables.dispose()}isEnabled(i){return!this._enablement.isIgnored(i.snippetIdentifier)}updateEnablement(i,e){this._enablement.updateIgnored(i.snippetIdentifier,!e)}updateUsageTimestamp(i){this._usageTimestamps.updateUsageTimestamp(i.snippetIdentifier)}_joinSnippets(){let i=this._pendingWork.slice(0);return this._pendingWork.length=0,Promise.all(i)}async getSnippetFiles(){return await this._joinSnippets(),this._files.values()}async getSnippets(i,e,t){await this._joinSnippets();let o=[],n=[];if(i){if(this._languageService.isRegisteredLanguageId(i))for(let r of this._files.values())n.push(r.load().then(s=>s.select(i,o)).catch(s=>this._logService.error(s,r.location.toString())))}else for(let r of this._files.values())n.push(r.load().then(s=>dre(o,o.length,s.data)).catch(s=>this._logService.error(s,r.location.toString())));return await Promise.all(n),this._filterAndSortSnippets(o,e,t)}getSnippetsSync(i,e,t){let o=[];if(this._languageService.isRegisteredLanguageId(i))for(let n of this._files.values())n.load().catch(r=>{}),n.select(i,o);return this._filterAndSortSnippets(o,e,t)}_filterAndSortSnippets(i,e,t){let o=[];for(let n of i)!n.prefix&&!t?.includeNoPrefixSnippets||!this.isEnabled(n)&&!t?.includeDisabledSnippets||typeof t?.fileTemplateSnippets=="boolean"&&t.fileTemplateSnippets!==n.isFileTemplate||e&&!n.isFileIncluded(e)||o.push(n);return o.sort((n,r)=>{let s=0;if(!t?.noRecencySort){let l=this._usageTimestamps.getUsageTimestamp(n.snippetIdentifier)??-1;s=(this._usageTimestamps.getUsageTimestamp(r.snippetIdentifier)??-1)-l}return s===0&&(s=this._compareSnippet(n,r)),s})}_compareSnippet(i,e){return i.snippetSource<e.snippetSource?-1:i.snippetSource>e.snippetSource?1:i.source<e.source?-1:i.source>e.source||i.name>e.name?1:i.name<e.name?-1:0}_initExtensionSnippets(){Shi.point.setHandler(i=>{for(let[e,t]of this._files)t.source===3&&this._files.delete(e);for(let e of i)for(let t of e.value){let o=Shi.toValidSnippet(e,t,this._languageService);if(!o)continue;let n=this._files.get(o.location);if(n)n.defaultScopes?n.defaultScopes.push(o.language):n.defaultScopes=[];else{let r=new XEe(3,o.location,o.language?[o.language]:void 0,e.description,this._fileService,this._extensionResourceLoaderService);this._files.set(r.location,r),this._environmentService.isExtensionDevelopment&&r.load().then(s=>{s.data.some(l=>l.isBogous)&&e.collector.warn(d(13561,null,e.description.name))},s=>{e.collector.warn(d(13560,null,r.location.toString()))})}}})}_initWorkspaceSnippets(){let i=new P,e=()=>{i.clear(),this._pendingWork.push(this._initWorkspaceFolderSnippets(this._contextService.getWorkspace(),i))};this._disposables.add(i),this._disposables.add(this._contextService.onDidChangeWorkspaceFolders(e)),this._disposables.add(this._contextService.onDidChangeWorkbenchState(e)),e()}async _initWorkspaceFolderSnippets(i,e){let t=i.folders.map(async o=>{let n=o.toResource(".vscode");await this._fileService.exists(n)?this._initFolderSnippets(2,n,e):e.add(this._fileService.onDidFilesChange(s=>{s.contains(n,1)&&this._initFolderSnippets(2,n,e)}))});await Promise.all(t)}async _initUserSnippets(){let i=new P,e=async()=>{i.clear();let t=this._userDataProfileService.currentProfile.snippetsHome;await this._fileService.createFolder(t),await this._initFolderSnippets(1,t,i)};this._disposables.add(i),this._disposables.add(this._userDataProfileService.onDidChangeCurrentProfile(t=>t.join((async()=>{this._pendingWork.push(e())})()))),await e()}_initFolderSnippets(i,e,t){let o=new P,n=async()=>{if(o.clear(),!!await this._fileService.exists(e))try{let r=await this._fileService.resolve(e);for(let s of r.children||[])o.add(this._addSnippetFile(s.resource,i))}catch(r){this._logService.error(`Failed snippets from folder '${e.toString()}'`,r)}};return t.add(this._textfileService.files.onDidSave(r=>{La(r.model.resource,e)&&n()})),t.add(G2o(this._fileService,e,n)),t.add(o),n()}_addSnippetFile(i,e){let t=ms(i);if(e===1&&t===".json"){let o=Ye(i).replace(/\.json/,"");this._files.set(i,new XEe(e,i,[o],void 0,this._fileService,this._extensionResourceLoaderService))}else t===".code-snippets"&&this._files.set(i,new XEe(e,i,void 0,void 0,this._fileService,this._extensionResourceLoaderService));return{dispose:()=>this._files.delete(i)}}};tTe=I([m(0,Co),m(1,mn),m(2,Pe),m(3,kt),m(4,ne),m(5,be),m(6,Ho),m(7,Bx),m(8,ao),m(9,F),m(10,bs)],tTe);function hto(a,i){let t=a.getLineContent(i.lineNumber).substr(0,i.column-1),o=Math.max(0,t.length-100);for(let n=t.length-1;n>=o;n--){let r=t.charAt(n);if(/\s/.test(r))return t.substr(n+1)}return o===0?t:""}var ay=class{constructor(i,e,t,o,n){this._editor=i;this._snippetService=e;this._clipboardService=t;this._languageFeaturesService=o;this._activeSnippets=[];this._hasSnippets=ay.ContextKey.bindTo(n),this._configListener=this._editor.onDidChangeConfiguration(r=>{r.hasChanged(139)&&this._update()}),this._update()}static{this.ID="editor.tabCompletionController"}static{this.ContextKey=new Q("hasSnippetCompletions",void 0)}static get(i){return i.getContribution(ay.ID)}dispose(){this._configListener.dispose(),this._selectionListener?.dispose()}_update(){let i=this._editor.getOption(139)==="onlySnippets";this._enabled!==i&&(this._enabled=i,this._enabled?(this._selectionListener=this._editor.onDidChangeCursorSelection(e=>this._updateSnippets()),this._editor.getModel()&&this._updateSnippets()):this._selectionListener?.dispose())}_updateSnippets(){if(this._activeSnippets=[],this._completionProvider?.dispose(),!this._editor.hasModel())return;let i=this._editor.getSelection(),e=this._editor.getModel();e.tokenization.tokenizeIfCheap(i.positionLineNumber);let t=e.getLanguageIdAtPosition(i.positionLineNumber,i.positionColumn),o=this._snippetService.getSnippetsSync(t,e.uri);if(!o){this._hasSnippets.set(!1);return}if(z.isEmpty(i)){let r=hto(e,i.getPosition());if(r)for(let s of o)r.endsWith(s.prefix)&&this._activeSnippets.push(s)}else if(!z.spansMultipleLines(i)&&e.getValueLengthInRange(i)<=100){let r=e.getValueInRange(i);if(r)for(let s of o)r===s.prefix&&this._activeSnippets.push(s)}let n=this._activeSnippets.length;if(n===0)this._hasSnippets.set(!1);else if(n===1)this._hasSnippets.set(!0);else{this._hasSnippets.set(!0),this._completionProvider={_debugDisplayName:"tabCompletion",dispose:()=>{r.dispose()},provideCompletionItems:(s,l)=>s!==e||!i.containsPosition(l)?void 0:{suggestions:this._activeSnippets.map(u=>{let p=z.fromPositions(l.delta(0,-u.prefix.length),l);return new VX(u,p)})}};let r=this._languageFeaturesService.completionProvider.register({language:e.getLanguageId(),pattern:e.uri.fsPath,scheme:e.uri.scheme},this._completionProvider)}}async performSnippetCompletions(){if(this._editor.hasModel())if(this._activeSnippets.length===1){let[i]=this._activeSnippets,e;if(i.needsClipboard){let t=new y1(this._editor,5);if(e=await this._clipboardService.readText(),!t.validate(this._editor))return}Qr.get(this._editor)?.insert(i.codeSnippet,{overwriteBefore:i.prefix.length,overwriteAfter:0,clipboardText:e})}else this._activeSnippets.length>1&&this._completionProvider&&ywt(this._editor,this._completionProvider)}};ay=I([m(1,sy),m(2,Wi),m(3,zt),m(4,X)],ay);go(ay.ID,ay,0);var $2o=xc.bindToContribution(ay.get);qi(new $2o({id:"insertSnippet",precondition:ay.ContextKey,handler:a=>a.performSnippetCompletions(),kbOpts:{weight:100,kbExpr:x.and(ue.editorTextFocus,ue.tabDoesNotMoveFocus,Qr.InSnippetMode.toNegated()),primary:2}}));var ly="editor.contrib.selectionClipboard";var iTe=new Q("commentEditorFocused",!1),Lde=90,q2o=450,G_=class extends jr{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g){let f={contributions:[{id:ry.ID,ctor:ry,instantiation:2},{id:Hm.ID,ctor:Hm,instantiation:2},{id:El.ID,ctor:El,instantiation:0},{id:Qr.ID,ctor:Qr,instantiation:4},{id:ay.ID,ctor:ay,instantiation:0},{id:_C.ID,ctor:_C,instantiation:4},...aa.getSomeEditorContributions([ou.ID,lh.ID,Fx.ID,iu.ID,kl.ID,Yg.ID,ly,Rc.ID,Zu.ID,GW.ID])],contextMenuId:D.SimpleEditorContext};super(i,e,f,n,r,s,t,l,c,u,p,h,g),this._commentEditorFocused=iTe.bindTo(t),this._commentEditorEmpty=vc.commentIsEmpty.bindTo(t),this._commentEditorEmpty.set(!this.getModel()?.getValueLength()),this._parentThread=o,this._register(this.onDidFocusEditorWidget(v=>this._commentEditorFocused.set(!0))),this._register(this.onDidChangeModelContent(v=>this._commentEditorEmpty.set(!this.getModel()?.getValueLength()))),this._register(this.onDidBlurEditorWidget(v=>this._commentEditorFocused.reset()))}getParentThread(){return this._parentThread}_getActions(){return aa.getEditorActions()}updateOptions(i){let e={...i,lineNumbers:"off"};super.updateOptions(e)}static getEditorOptions(i){return{wordWrap:"on",glyphMargin:!1,lineNumbers:"off",folding:!1,selectOnLineNumbers:!1,scrollbar:{vertical:"visible",verticalScrollbarSize:14,horizontal:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,alwaysConsumeMouseWheel:!1},overviewRulerLanes:2,lineDecorationsWidth:0,scrollBeyondLastLine:!1,renderLineHighlight:"none",fixedOverflowWidgets:!0,acceptSuggestionOnEnter:"smart",minimap:{enabled:!1},dropIntoEditor:{enabled:!0},autoClosingBrackets:i.getValue("editor.autoClosingBrackets"),quickSuggestions:!1,accessibilitySupport:i.getValue("editor.accessibilitySupport"),fontFamily:i.getValue("editor.fontFamily"),fontSize:i.getValue("editor.fontSize"),allowVariableLineHeights:!1}}};G_=I([m(4,F),m(5,Kt),m(6,ge),m(7,De),m(8,Ne),m(9,Bi),m(10,bs),m(11,zt),m(12,eC)],G_);function SRt(a,i,e){let t=i.getLayoutInfo(),o=i.getOption(75),n=i._getViewModel()?.getLineCount()*o;if(n>t.height||n<t.height&&e>Lde){let r=Math.ceil((n-t.height)/o),s=t.height+o*r;return Kn(s,Lde,Kn(a.getLayoutInfo().height-90,Lde,q2o))}return e}var j2o=0,IRt="commenteditordecoration",oTe=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w){super();this.owner=e;this._parentEditor=o;this._commentThread=n;this._scopedInstatiationService=r;this._contextKeyService=s;this._commentMenus=l;this._commentOptions=c;this._pendingComment=u;this._parentThread=p;this._actionRunDelegate=g;this.commentService=f;this.keybindingService=b;this.contextMenuService=S;this.hoverService=y;this.textModelService=w;this._commentThreadDisposables=[];this._editorHeight=Lde;this._container=R(t,_(".comment-form-container")),this._form=R(this._container,_(".comment-form")),this.commentEditor=this._register(this._scopedInstatiationService.createInstance(G_,this._form,G_.getEditorOptions(v),s,this._parentThread)),this.commentEditorIsEmpty=vc.commentIsEmpty.bindTo(this._contextKeyService),this.commentEditorIsEmpty.set(!this._pendingComment),this.initialize(h)}async initialize(e){this.avatar=R(this._form,_(".avatar-container")),this.updateAuthorInfo();let t=this._commentThread.comments&&this._commentThread.comments.length>0,o=_t()+"-"+(t?this._commentThread.threadId:++j2o),n=JSON.stringify({extensionId:this._commentThread.extensionId,commentThreadId:this._commentThread.threadId}),r=A.from({scheme:Y.commentsInput,path:`/${this._commentThread.extensionId}/commentinput-${o}.md?${n}`}),s=this.commentService.getCommentController(this.owner);s&&(r=r.with({authority:s.id}));let l=await this.textModelService.createModelReference(r);l.object.textEditorModel.setValue(this._pendingComment?.body||""),this._register(l),this.commentEditor.setModel(l.object.textEditorModel),this._pendingComment&&this.commentEditor.setPosition(this._pendingComment.cursor),this.calculateEditorHeight(),this._register(l.object.textEditorModel.onDidChangeContent(()=>{this.setCommentEditorDecorations(),this.commentEditorIsEmpty?.set(!this.commentEditor.getValue()),this.calculateEditorHeight()&&(this.commentEditor.layout({height:this._editorHeight,width:this.commentEditor.getLayoutInfo().width}),this.commentEditor.render(!0))})),this.createTextModelListener(this.commentEditor,this._form),this.setCommentEditorDecorations(),this._pendingComment?this.expandReplyArea():t?this.createReplyButton(this.commentEditor,this._form):this._commentThread.comments&&this._commentThread.comments.length===0&&this.expandReplyArea(e),this._error=R(this._container,_(".validation-error.hidden"));let c=R(this._container,_(".form-actions"));this._formActions=R(c,_(".other-actions")),this.createCommentWidgetFormActions(this._formActions,l.object.textEditorModel),this._editorActions=R(c,_(".editor-actions")),this.createCommentWidgetEditorActions(this._editorActions,l.object.textEditorModel)}calculateEditorHeight(){let e=SRt(this._parentEditor,this.commentEditor,this._editorHeight);return e!==this._editorHeight?(this._editorHeight=e,!0):!1}updateCommentThread(e){let t=this.commentEditor.hasTextFocus(),o=!this._commentThread.comments?.length&&!e.comments?.length;this._reviewThreadReplyButton||this.createReplyButton(this.commentEditor,this._form),this._commentThread.comments&&this._commentThread.comments.length===0&&!o&&this.expandReplyArea(),t&&this.commentEditor.focus()}getPendingComment(){let e=this.commentEditor.getModel();if(e&&e.getValueLength()>0)return{body:e.getValue(),cursor:this.commentEditor.getPosition()??new Ie(1,1)}}setPendingComment(e){this._pendingComment=e,this.expandReplyArea(),this.commentEditor.setValue(e.body),this.commentEditor.setPosition(e.cursor)}layout(e){this.commentEditor.layout({height:this._editorHeight,width:e-54})}focusIfNeeded(){!this._commentThread.comments||!this._commentThread.comments.length?this.commentEditor.focus():(this.commentEditor.getModel()?.getValueLength()??0)>0&&this.expandReplyArea()}focusCommentEditor(){this.commentEditor.focus()}expandReplyAreaAndFocusCommentEditor(){this.expandReplyArea(),this.commentEditor.focus()}isCommentEditorFocused(){return this.commentEditor.hasWidgetFocus()}updateAuthorInfo(){if(this.avatar.textContent="",typeof this._commentThread.canReply!="boolean"&&this._commentThread.canReply.iconPath){this.avatar.style.display="block";let e=R(this.avatar,_("img.avatar"));e.src=gn.uriToBrowserUri(A.revive(this._commentThread.canReply.iconPath)).toString(!0)}else this.avatar.style.display="none"}updateCanReply(){this.updateAuthorInfo(),this._commentThread.canReply?this._container.style.display="block":this._container.style.display="none"}async submitComment(){await this._commentFormActions?.triggerDefaultAction(),this._pendingComment=void 0}setCommentEditorDecorations(){let t=this._commentThread.comments&&this._commentThread.comments.length>0?this._commentOptions?.placeHolder||d(8447,null):this._commentOptions?.placeHolder||d(8446,null);this.commentEditor.updateOptions({placeholder:t})}createTextModelListener(e,t){this._commentThreadDisposables.push(e.onDidFocusEditorWidget(()=>{this._commentThread.input={uri:e.getModel().uri,value:e.getValue()},this.commentService.setActiveEditingCommentThread(this._commentThread),this.commentService.setActiveCommentAndThread(this.owner,{thread:this._commentThread})})),this._commentThreadDisposables.push(e.getModel().onDidChangeContent(()=>{let o=e.getValue();if(this._commentThread.input&&this._commentThread.input.uri===e.getModel().uri&&this._commentThread.input.value!==o){let n=this._commentThread.input;n.value=o,this._commentThread.input=n}this.commentService.setActiveEditingCommentThread(this._commentThread)})),this._commentThreadDisposables.push(this._commentThread.onDidChangeInput(o=>{let n=this._commentThread,r=e.getModel();n.input&&r&&n.input.uri!==r.uri||o&&e.getValue()!==o.value&&(e.setValue(o.value),o.value===""&&(this._pendingComment={body:"",cursor:new Ie(1,1)},t.classList.remove("expand"),e.getDomNode().style.outline="",this._error.textContent="",this._error.classList.add("hidden")))}))}createCommentWidgetFormActions(e,t){let o=this._commentMenus.getCommentThreadActions(this._contextKeyService);this._register(o),this._register(o.onDidChange(()=>{this._commentFormActions.setActions(o)})),this._commentFormActions=new jz(this.keybindingService,this._contextKeyService,this.contextMenuService,e,async n=>{await this._actionRunDelegate?.(),await n.run({thread:this._commentThread,text:this.commentEditor.getValue(),$mid:9}),this.hideReplyArea()}),this._register(this._commentFormActions),this._commentFormActions.setActions(o)}createCommentWidgetEditorActions(e,t){let o=this._commentMenus.getCommentEditorActions(this._contextKeyService);this._register(o),this._register(o.onDidChange(()=>{this._commentEditorActions.setActions(o,!0)})),this._commentEditorActions=new jz(this.keybindingService,this._contextKeyService,this.contextMenuService,e,async n=>{this._actionRunDelegate?.(),n.run({thread:this._commentThread,text:this.commentEditor.getValue(),$mid:9}),this.focusCommentEditor()}),this._register(this._commentEditorActions),this._commentEditorActions.setActions(o,!0)}get isReplyExpanded(){return this._container.classList.contains("expand")}expandReplyArea(e=!0){this.isReplyExpanded||(this._container.classList.add("expand"),e&&this.commentEditor.focus(),this.commentEditor.layout())}clearAndExpandReplyArea(){this.isReplyExpanded||(this.commentEditor.setValue(""),this.expandReplyArea())}hideReplyArea(){let e=this.commentEditor.getDomNode();e&&(e.style.outline=""),this.commentEditor.setValue(""),this._pendingComment={body:"",cursor:new Ie(1,1)},this._container.classList.remove("expand"),this._error.textContent="",this._error.classList.add("hidden")}createReplyButton(e,t){this._reviewThreadReplyButton=R(t,_(`button.review-thread-reply-button.${tE}`)),this._register(this.hoverService.setupManagedHover(Ni("mouse"),this._reviewThreadReplyButton,this._commentOptions?.prompt||d(8447,null))),this._reviewThreadReplyButton.textContent=this._commentOptions?.prompt||d(8447,null),this._register(j(this._reviewThreadReplyButton,"click",o=>this.clearAndExpandReplyArea())),this._register(j(this._reviewThreadReplyButton,"focus",o=>this.clearAndExpandReplyArea())),this._register(e.onDidBlurEditorWidget(()=>{e.getModel().getValueLength()===0&&t.classList.contains("expand")&&t.classList.remove("expand")}))}dispose(){super.dispose(),Ue(this._commentThreadDisposables)}};oTe=I([m(12,km),m(13,B),m(14,_e),m(15,ze),m(16,tt),m(17,Nt)],oTe);var UX=class a extends st{constructor(e,t){super(a.ID,t||d(8555,null),"toggle-reactions",!0);this._menuActions=[];this.toggleDropdownMenu=e}static{this.ID="toolbar.toggle.pickReactions"}run(){return this.toggleDropdownMenu(),Promise.resolve(!0)}get menuActions(){return this._menuActions}set menuActions(e){this._menuActions=e}},yRt=class extends Lr{constructor(i){super(null,i,{})}updateLabel(){if(!this.label)return;let i=this.action;if(i.class&&this.label.classList.add(i.class),i.icon){let e=R(this.label,_(".reaction-icon")),t=A.revive(i.icon);e.style.backgroundImage=Na(t)}else{let e=R(this.label,_("span.reaction-label"));e.innerText=i.label}if(i.count){let e=R(this.label,_("span.reaction-count"));e.innerText=`${i.count}`}}getTooltip(){let i=this.action,e=i.enabled?d(8554,null):"";if(i.count===void 0)return d(8550,null,e,i.label);if(i.reactors===void 0||i.reactors.length===0){if(i.count===1)return d(8551,null,e,i.label);if(i.count>1)return d(8549,null,e,i.count,i.label)}else{if(i.reactors.length<=10&&i.reactors.length===i.count)return d(8552,null,e,i.reactors.join(", "),i.label);if(i.count>1){let t=i.reactors.slice(0,10);return d(8553,null,e,t.join(", "),i.count-t.length,i.label)}}}},y9e=class a extends st{constructor(e,t="",o="",n=!0,r,s,l,c){super(a.ID,t,o,n,r);this.reactors=s;this.icon=l;this.count=c}static{this.ID="toolbar.toggle.reaction"}};var Ihi=class extends as{async runAction(i,e){await i.run(...e)}},nTe=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w){super();this.parentEditor=e;this.commentThread=t;this.comment=o;this.pendingEdit=n;this.owner=r;this.resource=s;this.parentThread=l;this.markdownRendererOptions=c;this.instantiationService=u;this.commentService=p;this.notificationService=h;this.contextMenuService=g;this.configurationService=v;this.hoverService=b;this.keybindingService=S;this.textModelService=y;this.markdownRendererService=w;this._md=this._register(new me);this._editAction=null;this._commentEditContainer=null;this._reactionsActionBar=this._register(new me);this._reactionActions=this._register(new P);this._commentEditor=null;this._commentEditorModel=null;this._editorHeight=Lde;this._actionRunner=this._register(new Ihi);this.toolbar=this._register(new me);this._commentFormActions=null;this._commentEditorActions=null;this._onDidClick=this._register(new E);this.isEditing=!1;this._editModeDisposables=this._register(new P);this._domNode=_("div.review-comment"),this._contextKeyService=this._register(f.createScoped(this._domNode)),this._commentContextValue=vc.commentContext.bindTo(this._contextKeyService),this.comment.contextValue&&this._commentContextValue.set(this.comment.contextValue),this._commentMenus=this.commentService.getCommentMenus(this.owner),this._domNode.tabIndex=-1,this._avatar=R(this._domNode,_("div.avatar-container")),this.updateCommentUserIcon(this.comment.userIconPath),this._commentDetailsContainer=R(this._domNode,_(".review-comment-contents")),this.createHeader(this._commentDetailsContainer),this._body=document.createElement("div"),this._body.classList.add("comment-body",tE),v.getValue(zz)?.maxHeight!==!1&&this._body.classList.add("comment-body-max-height"),this.createScroll(this._commentDetailsContainer,this._body),this.updateCommentBody(this.comment.body),this.createReactionsContainer(this._commentDetailsContainer),this._domNode.setAttribute("aria-label",`${o.userName}, ${this.commentBodyValue}`),this._domNode.setAttribute("role","treeitem"),this._clearTimeout=null,this._register(j(this._domNode,re.CLICK,()=>this.isEditing||this._onDidClick.fire(this))),this._register(j(this._domNode,re.CONTEXT_MENU,k=>this.onContextMenu(k))),n&&this.switchToEditMode(),this.activeCommentListeners()}get domNode(){return this._domNode}activeCommentListeners(){this._register(j(this._domNode,re.FOCUS_IN,()=>{this.commentService.setActiveCommentAndThread(this.owner,{thread:this.commentThread,comment:this.comment})},!0))}createScroll(e,t){this._scrollable=this._register(new UT({forceIntegerValues:!0,smoothScrollDuration:125,scheduleAtNextAnimationFrame:n=>$r(Me(e),n)})),this._scrollableElement=this._register(new AN(t,{horizontal:3,vertical:3},this._scrollable)),this._register(this._scrollableElement.onScroll(n=>{n.scrollLeftChanged&&(t.scrollLeft=n.scrollLeft),n.scrollTopChanged&&(t.scrollTop=n.scrollTop)}));let o=this._register(new On(t,"scroll")).event;this._register(o(n=>{let r=this._scrollableElement.getScrollPosition(),s=Math.abs(t.scrollLeft-r.scrollLeft)<=1?void 0:t.scrollLeft,l=Math.abs(t.scrollTop-r.scrollTop)<=1?void 0:t.scrollTop;(s!==void 0||l!==void 0)&&this._scrollableElement.setScrollPosition({scrollLeft:s,scrollTop:l})})),e.appendChild(this._scrollableElement.getDomNode())}updateCommentBody(e){this._body.innerText="",this._md.clear(),this._plainText=void 0,typeof e=="string"?(this._plainText=R(this._body,_(".comment-body-plainstring")),this._plainText.innerText=e):(this._md.value=this.markdownRendererService.render(e,this.markdownRendererOptions),this._body.appendChild(this._md.value.element))}updateCommentUserIcon(e){if(this._avatar.textContent="",e){let t=R(this._avatar,_("img.avatar"));t.src=gn.uriToBrowserUri(A.revive(e)).toString(!0),t.onerror=o=>t.remove()}}get onDidClick(){return this._onDidClick.event}createTimestamp(e){this._timestamp=R(e,_("span.timestamp-container")),this.updateTimestamp(this.comment.timestamp)}updateTimestamp(e){if(!this._timestamp)return;let t=e!==void 0?new Date(e):void 0;t?this._timestampWidget?this._timestampWidget.setTimestamp(t):(this._timestampWidget=new xde(this.configurationService,this.hoverService,this._timestamp,t),this._register(this._timestampWidget)):this._timestampWidget?.dispose()}createHeader(e){let t=R(e,_(`div.comment-title.${tE}`)),o=R(t,_("comment-header-info")),n=R(o,_("strong.author"));n.innerText=this.comment.userName,this.createTimestamp(o),this._isPendingLabel=R(o,_("span.isPending")),this.comment.label?this._isPendingLabel.innerText=this.comment.label:this._isPendingLabel.innerText="",this._actionsToolbarContainer=R(t,_(".comment-actions")),this.createActionsToolbar()}getToolbarActions(e){let t=e.getActions({shouldForwardArgs:!0}),r={primary:[],secondary:[]};return Y2o(t,r,!1,s=>/^inline/.test(s)),r}get commentNodeContext(){return[{thread:this.commentThread,commentUniqueId:this.comment.uniqueIdInThread,$mid:10},{commentControlHandle:this.commentThread.controllerHandle,commentThreadHandle:this.commentThread.commentThreadHandle,$mid:7}]}createToolbar(){this.toolbar.value=new Ju(this._actionsToolbarContainer,this.contextMenuService,{actionViewItemProvider:(e,t)=>e.id===UX.ID?new wp(e,e.menuActions,this.contextMenuService,{...t,actionViewItemProvider:(o,n)=>this.actionViewItemProvider(o,n),classNames:["toolbar-toggle-pickReactions",...q.asClassNameArray(M.reactions)],anchorAlignmentProvider:()=>1}):this.actionViewItemProvider(e,t),orientation:0}),this.toolbar.value.context=this.commentNodeContext,this.toolbar.value.actionRunner=this._actionRunner}createActionsToolbar(){let e=[],t=this._commentMenus.getCommentTitleActions(this.comment,this._contextKeyService);this._register(t),this._register(t.onDidChange(r=>{let{primary:s,secondary:l}=this.getToolbarActions(t);!this.toolbar&&(s.length||l.length)&&this.createToolbar(),this.toolbar.value.setActions(s,l)}));let{primary:o,secondary:n}=this.getToolbarActions(t);e.push(...o),(e.length||n.length)&&(this.createToolbar(),this.toolbar.value.setActions(e,n))}actionViewItemProvider(e,t){return e.id===UX.ID?t={label:!1,icon:!0}:t={label:!1,icon:!0},e.id===y9e.ID?new yRt(e):e instanceof Eo?this.instantiationService.createInstance(ml,e,{hoverDelegate:t.hoverDelegate}):e instanceof Cc?this.instantiationService.createInstance(mE,e,t):new Lr({},e,t)}async submitComment(){this._commentEditor&&this._commentFormActions&&(await this._commentFormActions.triggerDefaultAction(),this.pendingEdit=void 0)}createReactionPicker(e){let t=this._reactionActions.add(new UX(()=>{n?.show()},d(8443,null))),o=[];e&&e.length&&(o=e.map(r=>this._reactionActions.add(new st(`reaction.command.${r.label}`,`${r.label}`,"",!0,async()=>{try{await this.commentService.toggleReaction(this.owner,this.resource,this.commentThread,this.comment,r)}catch(s){let l=s.message?d(8445,null,s.message):d(8444,null);this.notificationService.error(l)}})))),t.menuActions=o;let n=this._reactionActions.add(new wp(t,t.menuActions,this.contextMenuService,{actionViewItemProvider:(r,s)=>r.id===UX.ID?n:this.actionViewItemProvider(r,s),classNames:"toolbar-toggle-pickReactions",anchorAlignmentProvider:()=>1}));return t}createReactionsContainer(e){this._reactionActionsContainer?.remove(),this._reactionsActionBar.clear(),this._reactionActions.clear();let t=this.commentService.hasReactionHandler(this.owner),o=this.comment.commentReactions?.filter(n=>!!n.count)||[];if(!(o.length===0&&!t)&&(this._reactionActionsContainer=R(e,_("div.comment-reactions")),this._reactionsActionBar.value=new ji(this._reactionActionsContainer,{actionViewItemProvider:(n,r)=>n.id===UX.ID?new wp(n,n.menuActions,this.contextMenuService,{actionViewItemProvider:(s,l)=>this.actionViewItemProvider(s,l),classNames:["toolbar-toggle-pickReactions",...q.asClassNameArray(M.reactions)],anchorAlignmentProvider:()=>1}):this.actionViewItemProvider(n,r)}),o.map(n=>{let r=this._reactionActions.add(new y9e(`reaction.${n.label}`,`${n.label}`,n.hasReacted&&(n.canEdit||t)?"active":"",n.canEdit||t,async()=>{try{await this.commentService.toggleReaction(this.owner,this.resource,this.commentThread,this.comment,n)}catch(s){let l;n.hasReacted?l=s.message?d(8442,null,s.message):d(8441,null):l=s.message?d(8440,null,s.message):d(8439,null),this.notificationService.error(l)}},n.reactors,n.iconPath,n.count));this._reactionsActionBar.value?.push(r,{label:!0,icon:!0})}),t)){let n=this.createReactionPicker(this.comment.commentReactions||[]);this._reactionsActionBar.value?.push(n,{label:!1,icon:!0})}}get commentBodyValue(){return typeof this.comment.body=="string"?this.comment.body:this.comment.body.value}async createCommentEditor(e){this._editModeDisposables.clear();let t=R(e,_(".edit-textarea"));this._commentEditor=this.instantiationService.createInstance(G_,t,G_.getEditorOptions(this.configurationService),this._contextKeyService,this.parentThread),this._editModeDisposables.add(this._commentEditor);let o=A.from({scheme:Y.commentsInput,path:`/commentinput-${this.comment.uniqueIdInThread}-${Date.now()}.md`}),n=await this.textModelService.createModelReference(o);if(this._commentEditorModel=n,this._editModeDisposables.add(this._commentEditorModel),this._commentEditor.setModel(this._commentEditorModel.object.textEditorModel),this._commentEditor.setValue(this.pendingEdit?.body??this.commentBodyValue),this.pendingEdit)this._commentEditor.setPosition(this.pendingEdit.cursor);else{let s=this._commentEditorModel.object.textEditorModel.getLineCount(),l=this._commentEditorModel.object.textEditorModel.getLineLength(s)+1;this._commentEditor.setPosition(new Ie(s,l))}this.pendingEdit=void 0,this._commentEditor.layout({width:t.clientWidth-14,height:this._editorHeight}),this._commentEditor.focus(),$r(Me(e),()=>{this._commentEditor.layout({width:t.clientWidth-14,height:this._editorHeight}),this._commentEditor.focus()});let r=this.commentThread;r.input={uri:this._commentEditor.getModel().uri,value:this.commentBodyValue},this.commentService.setActiveEditingCommentThread(r),this.commentService.setActiveCommentAndThread(this.owner,{thread:r,comment:this.comment}),this._editModeDisposables.add(this._commentEditor.onDidFocusEditorWidget(()=>{r.input={uri:this._commentEditor.getModel().uri,value:this.commentBodyValue},this.commentService.setActiveEditingCommentThread(r),this.commentService.setActiveCommentAndThread(this.owner,{thread:r,comment:this.comment})})),this._editModeDisposables.add(this._commentEditor.onDidChangeModelContent(s=>{if(r.input&&this._commentEditor&&this._commentEditor.getModel().uri===r.input.uri){let l=this._commentEditor.getValue();if(l!==r.input.value){let c=r.input;c.value=l,r.input=c,this.commentService.setActiveEditingCommentThread(r),this.commentService.setActiveCommentAndThread(this.owner,{thread:r,comment:this.comment})}}})),this.calculateEditorHeight(),this._editModeDisposables.add(this._commentEditorModel.object.textEditorModel.onDidChangeContent(()=>{this._commentEditor&&this.calculateEditorHeight()&&(this._commentEditor.layout({height:this._editorHeight,width:this._commentEditor.getLayoutInfo().width}),this._commentEditor.render(!0))}))}calculateEditorHeight(){if(this._commentEditor){let e=SRt(this.parentEditor,this._commentEditor,this._editorHeight);if(e!==this._editorHeight)return this._editorHeight=e,!0}return!1}getPendingEdit(){let e=this._commentEditor?.getModel();if(this._commentEditor&&e&&e.getValueLength()>0)return{body:e.getValue(),cursor:this._commentEditor.getPosition()}}removeCommentEditor(){this.isEditing=!1,this._editAction&&(this._editAction.enabled=!0),this._body.classList.remove("hidden"),this._editModeDisposables.clear(),this._commentEditor=null,this._commentEditContainer.remove()}layout(e){let t=e!==void 0?e-72:this._commentEditor?.getLayoutInfo().width??0;this._commentEditor?.layout({width:t,height:this._editorHeight});let o=this._body.scrollWidth,n=D6(this._body),r=this._body.scrollHeight,s=qbe(this._body)+4;this._scrollableElement.setScrollDimensions({width:n,scrollWidth:o,height:s,scrollHeight:r})}async switchToEditMode(){if(this.isEditing)return;this.isEditing=!0,this._body.classList.add("hidden"),this._commentEditContainer=R(this._commentDetailsContainer,_(".edit-container")),await this.createCommentEditor(this._commentEditContainer);let e=R(this._commentEditContainer,_(".form-actions")),t=R(e,_(".other-actions"));this.createCommentWidgetFormActions(t);let o=R(e,_(".editor-actions"));this.createCommentWidgetEditorActions(o)}createCommentWidgetFormActions(e){let o=this.commentService.getCommentMenus(this.owner).getCommentActions(this.comment,this._contextKeyService);this._editModeDisposables.add(o),this._editModeDisposables.add(o.onDidChange(()=>{this._commentFormActions?.setActions(o)})),this._commentFormActions=new jz(this.keybindingService,this._contextKeyService,this.contextMenuService,e,n=>{let r=this._commentEditor.getValue();n.run({thread:this.commentThread,commentUniqueId:this.comment.uniqueIdInThread,text:r,$mid:11}),this.removeCommentEditor()}),this._editModeDisposables.add(this._commentFormActions),this._commentFormActions.setActions(o)}createCommentWidgetEditorActions(e){let o=this.commentService.getCommentMenus(this.owner).getCommentEditorActions(this._contextKeyService);this._editModeDisposables.add(o),this._editModeDisposables.add(o.onDidChange(()=>{this._commentEditorActions?.setActions(o,!0)})),this._commentEditorActions=new jz(this.keybindingService,this._contextKeyService,this.contextMenuService,e,n=>{let r=this._commentEditor.getValue();n.run({thread:this.commentThread,commentUniqueId:this.comment.uniqueIdInThread,text:r,$mid:11}),this._commentEditor?.focus()}),this._editModeDisposables.add(this._commentEditorActions),this._commentEditorActions.setActions(o,!0)}setFocus(e,t=!1){e?(this._domNode.focus(),this._actionsToolbarContainer.classList.add("tabfocused"),this._domNode.tabIndex=0,this.comment.mode===0&&this._commentEditor?.focus()):(this._actionsToolbarContainer.classList.contains("tabfocused")&&!this._actionsToolbarContainer.classList.contains("mouseover")&&(this._domNode.tabIndex=-1),this._actionsToolbarContainer.classList.remove("tabfocused"))}async update(e){e.body!==this.comment.body&&this.updateCommentBody(e.body),this.comment.userIconPath&&e.userIconPath&&A.from(this.comment.userIconPath).toString()!==A.from(e.userIconPath).toString()&&this.updateCommentUserIcon(e.userIconPath);let t=e.mode!==void 0&&e.mode!==this.comment.mode;this.comment=e,t&&(e.mode===0?await this.switchToEditMode():this.removeCommentEditor()),e.label?this._isPendingLabel.innerText=e.label:this._isPendingLabel.innerText="",this.createReactionsContainer(this._commentDetailsContainer),this.comment.contextValue?this._commentContextValue.set(this.comment.contextValue):this._commentContextValue.reset(),this.comment.timestamp&&this.updateTimestamp(this.comment.timestamp)}onContextMenu(e){let t=new yn(Me(this._domNode),e);this.contextMenuService.showContextMenu({getAnchor:()=>t,menuId:D.CommentThreadCommentContext,menuActionOptions:{shouldForwardArgs:!0},contextKeyService:this._contextKeyService,actionRunner:this._actionRunner,getActionsContext:()=>this.commentNodeContext})}focus(){this.domNode.focus(),this._clearTimeout||(this.domNode.classList.add("focus"),this._clearTimeout=setTimeout(()=>{this.domNode.classList.remove("focus")},3e3))}dispose(){super.dispose()}};nTe=I([m(8,F),m(9,km),m(10,Ne),m(11,ze),m(12,X),m(13,B),m(14,tt),m(15,_e),m(16,Nt),m(17,Qn)],nTe);function Y2o(a,i,e,t=o=>o==="navigation"){for(let o of a){let[n,r]=o;if(e&&(r=r.map(s=>s instanceof Eo&&s.alt?s.alt:s)),t(n))(Array.isArray(i)?i:i.primary).unshift(...r);else{let s=Array.isArray(i)?i:i.secondary;s.length>0&&s.push(new li),s.push(...r)}}}var rTe=class extends C{constructor(e,t,o,n,r,s,l,c,u,p){super();this._parentEditor=e;this.owner=t;this.parentResourceUri=o;this.container=n;this._markdownRendererOptions=r;this._commentThread=s;this._pendingEdits=l;this._scopedInstatiationService=c;this._parentCommentThreadWidget=u;this.commentService=p;this._commentElements=[];this._resizeObserver=null;this._focusedComment=void 0;this._onDidResize=this._register(new E);this.onDidResize=this._onDidResize.event;this._commentDisposable=new jt;this._containerClientArea=void 0;this._register(j(n,re.FOCUS_IN,h=>{this.commentService.setActiveEditingCommentThread(this._commentThread)}))}get length(){return this._commentThread.comments?this._commentThread.comments.length:0}get activeComment(){return this._commentElements.filter(e=>e.isEditing)[0]}focus(e){if(e!==void 0){let t=this._commentElements.find(o=>o.comment.uniqueIdInThread===e);if(t){t.focus();return}}this._commentsElement.focus()}hasCommentsInEditMode(){return this._commentElements.some(e=>e.isEditing)}ensureFocusIntoNewEditingComment(){this._commentElements.length===1&&this._commentElements[0].isEditing&&this._commentElements[0].setFocus(!0)}async display(){if(this._commentsElement=R(this.container,_("div.comments-container")),this._commentsElement.setAttribute("role","presentation"),this._commentsElement.tabIndex=0,this._updateAriaLabel(),this._register(j(this._commentsElement,re.KEY_DOWN,e=>{let t=new Ii(e);if((t.equals(16)||t.equals(18))&&(!this._focusedComment||!this._commentElements[this._focusedComment].isEditing)){let o=n=>{if(this._focusedComment===void 0&&n>=0)return 0;if(this._focusedComment===void 0&&n<0)return this._commentElements.length-1;let r=this._focusedComment+n;return Math.min(Math.max(0,r),this._commentElements.length-1)};this._setFocusedComment(t.equals(16)?o(-1):o(1))}})),this._commentDisposable.clearAndDisposeAll(),this._commentElements=[],this._commentThread.comments)for(let e of this._commentThread.comments){let t=this.createNewCommentNode(e);this._commentElements.push(t),this._commentsElement.appendChild(t.domNode),e.mode===0&&await t.switchToEditMode()}this._resizeObserver=new MutationObserver(this._refresh.bind(this)),this._resizeObserver.observe(this.container,{attributes:!0,childList:!0,characterData:!0,subtree:!0})}_refresh(){let e=Fm(this.container);e.height===0&&e.width===0||ai.equals(this._containerClientArea,e)||(this._containerClientArea=e,this._onDidResize.fire(e))}getDimensions(){return Fm(this.container)}layout(e){this._commentElements.forEach(t=>{t.layout(e)})}getPendingEdits(){let e={};return this._commentElements.forEach(t=>{if(t.isEditing){let o=t.getPendingEdit();o&&(e[t.comment.uniqueIdInThread]=o)}}),e}getCommentCoords(e){let t=this._commentElements.filter(o=>o.comment.uniqueIdInThread===e);if(t&&t.length){let o=Yn(this._commentElements[0].domNode),n=Yn(t[0].domNode);return{thread:o,comment:n}}}async updateCommentThread(e,t){let o=this._commentElements.length,n=e.comments?e.comments.length:0,r=[],s=[];for(let h=0;h<o;h++){let g=this._commentElements[h].comment,f=e.comments?e.comments.filter(v=>v.uniqueIdInThread===g.uniqueIdInThread):[];f.length?this._commentElements[h].update(f[0]):(s.push(h),r.push(this._commentElements[h]))}for(let h=r.length-1;h>=0;h--){let g=r[h];this._commentDisposable.deleteAndDispose(g),this._commentElements.splice(s[h],1),g.domNode.remove()}let l=null,c=[],u=[],p=[];for(let h=n-1;h>=0;h--){let g=e.comments[h],f=this._commentElements.filter(v=>v.comment.uniqueIdInThread===g.uniqueIdInThread);if(f.length)l=f[0].domNode,c.unshift(f[0]);else{let v=this.createNewCommentNode(g);c.unshift(v),l?(this._commentsElement.insertBefore(v.domNode,l),l=v.domNode):(this._commentsElement.appendChild(v.domNode),l=v.domNode),g.mode===0&&(p.push(v.switchToEditMode()),u.push(v))}}if(this._commentThread=e,this._commentElements=c,await Promise.all(p),u.length){let h=this._commentElements.indexOf(u[u.length-1]);this._focusedComment=h}this._updateAriaLabel(),t||this._setFocusedComment(this._focusedComment)}_updateAriaLabel(){this._commentThread.isDocumentCommentThread()?this._commentThread.range?this._commentsElement.ariaLabel=d(8539,null,this._commentThread.comments?.length,this._commentThread.range.startLineNumber,this._commentThread.range.endLineNumber,this._commentThread.label):this._commentsElement.ariaLabel=d(8538,null,this._commentThread.comments?.length,this._commentThread.label):this._commentsElement.ariaLabel=d(8537,null,this._commentThread.comments?.length,this._commentThread.label)}_setFocusedComment(e){this._focusedComment!==void 0&&this._commentElements[this._focusedComment]?.setFocus(!1),this._commentElements.length===0||e===void 0?this._focusedComment=void 0:(this._focusedComment=Math.min(e,this._commentElements.length-1),this._commentElements[this._focusedComment].setFocus(!0))}createNewCommentNode(e){let t=this._scopedInstatiationService.createInstance(nTe,this._parentEditor,this._commentThread,e,this._pendingEdits?this._pendingEdits[e.uniqueIdInThread]:void 0,this.owner,this.parentResourceUri,this._parentCommentThreadWidget,this._markdownRendererOptions),o=new P;return o.add(t.onDidClick(n=>this._setFocusedComment(this._commentElements.findIndex(r=>r.comment.uniqueIdInThread===n.comment.uniqueIdInThread)))),o.add(t),this._commentDisposable.set(t,o),t}dispose(){super.dispose(),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null),this._commentDisposable.dispose()}};rTe=I([m(9,km)],rTe);var X2o=Re("review-comment-collapse",M.chevronUp,d(8540,null)),gto="expand-review-action "+q.asClassName(X2o),J2o="expand-review-action "+q.asClassName(M.trashcan);function yhi(a){return!!a&&a.length>0}var sTe=class extends C{constructor(e,t,o,n,r,s,l){super();this._delegate=t;this._commentMenus=o;this._commentThread=n;this._contextKeyService=r;this._instantiationService=s;this._contextMenuService=l;this._headElement=_(".head"),e.appendChild(this._headElement),this._register(Z(()=>this._headElement.remove())),this._fillHead()}_fillHead(){let e=R(this._headElement,_(".review-title"));this._headingLabel=R(e,_("span.filename")),this.createThreadLabel();let t=R(this._headElement,_(".review-actions"));this._actionbarWidget=new ji(t,{actionViewItemProvider:Ca.bind(void 0,this._instantiationService)}),this._register(this._actionbarWidget);let o=yhi(this._commentThread.comments)?gto:J2o;if(this._collapseAction=new st("workbench.action.hideComment",d(8541,null),o,!0,()=>this._delegate.collapse()),!yhi(this._commentThread.comments)){let r=this._register(new me);r.value=this._commentThread.onDidChangeComments(()=>{yhi(this._commentThread.comments)&&(this._collapseAction.class=gto,r.clear())})}let n=this._commentMenus.getCommentThreadTitleActions(this._contextKeyService);this._register(n),this.setActionBarActions(n),this._register(n),this._register(n.onDidChange(r=>{this.setActionBarActions(n)})),this._register(j(this._headElement,re.CONTEXT_MENU,r=>this.onContextMenu(r))),this._actionbarWidget.context=this._commentThread}setActionBarActions(e){let t=e.getActions({shouldForwardArgs:!0}).reduce((o,[,n])=>[...o,...n],[]);this._actionbarWidget.clear(),this._actionbarWidget.push([...t,this._collapseAction],{label:!1,icon:!0})}updateCommentThread(e){this._commentThread=e,this._actionbarWidget.context=this._commentThread,this.createThreadLabel()}createThreadLabel(){let e;e=this._commentThread.label,e===void 0&&(this._commentThread.comments&&this._commentThread.comments.length||(e=d(8542,null))),e&&(this._headingLabel.textContent=ur(e),this._headingLabel.setAttribute("aria-label",e))}updateHeight(e){this._headElement.style.height=`${e}px`,this._headElement.style.lineHeight=this._headElement.style.height}onContextMenu(e){let t=this._commentMenus.getCommentThreadTitleContextActions(this._contextKeyService);if(!t.length)return;let o=new yn(Me(this._headElement),e);this._contextMenuActionRunner||(this._contextMenuActionRunner=this._register(new as)),this._contextMenuService.showContextMenu({getAnchor:()=>o,getActions:()=>t,actionRunner:this._contextMenuActionRunner,getActionsContext:()=>({commentControlHandle:this._commentThread.controllerHandle,commentThreadHandle:this._commentThread.commentThreadHandle,$mid:7})})}};sTe=I([m(4,X),m(5,F),m(6,ze)],sTe);var aTe=class extends C{constructor(e,t,o,n,r,s,l){super();this._commentThread=t;this._contextKeyService=o;this._commentMenus=n;this._actionRunDelegate=r;this._keybindingService=s;this._contextMenuService=l;this._container=R(e,_(".comment-additional-actions")),R(this._container,_(".section-separator")),this._buttonBar=R(this._container,_(".button-bar")),this._createAdditionalActions(this._buttonBar)}_showMenu(){this._container?.classList.remove("hidden")}_hideMenu(){this._container?.classList.add("hidden")}_enableDisableMenu(e){let t=e.getActions({shouldForwardArgs:!0});for(let o of t){let[,n]=o;for(let r of n){if(r.enabled){this._showMenu();return}for(let s of r.actions??[])if(s.enabled){this._showMenu();return}}}this._hideMenu()}_createAdditionalActions(e){let t=this._commentMenus.getCommentThreadAdditionalActions(this._contextKeyService);this._register(t),this._register(t.onDidChange(()=>{this._commentFormActions.setActions(t,!0),this._enableDisableMenu(t)})),this._commentFormActions=new jz(this._keybindingService,this._contextKeyService,this._contextMenuService,e,async o=>{this._actionRunDelegate?.(),o.run({thread:this._commentThread,$mid:8})},4,!0),this._register(this._commentFormActions),this._commentFormActions.setActions(t,!0),this._enableDisableMenu(t)}};aTe=I([m(5,_e),m(6,ze)],aTe);function Z2o(a,i,e){let t=new Set;return hn(...a.map((o,n)=>hn(o.onDidFocus(()=>{e?.(n,"focus"),t.size||i(!0),t.add(n)}),o.onDidBlur(()=>{e?.(n,"blur"),t.delete(n),t.size||i(!1)}))))}var whi=new Q("navigableContainerFocused",!1),nF=class{constructor(i,e,t){this.logService=e;this.configurationService=t;this.containers=new Set;this.focused=whi.bindTo(i),nF.INSTANCE=this}static{this.ID="workbench.contrib.navigableContainerManager"}dispose(){this.containers.clear(),this.focused.reset(),nF.INSTANCE=void 0}get debugEnabled(){return this.configurationService.getValue("workbench.navigibleContainer.enableDebug")}log(i,...e){this.debugEnabled&&this.logService.debug(i,...e)}static register(i){let e=this.INSTANCE;return e?(e.containers.add(i),e.log("NavigableContainerManager.register",i.name),hn(Z2o(i.focusNotifiers,t=>{t?(e.log("NavigableContainerManager.focus",i.name),e.focused.set(!0),e.lastContainer=i):(e.log("NavigableContainerManager.blur",i.name,e.lastContainer?.name),e.lastContainer===i&&(e.focused.set(!1),e.lastContainer=void 0))},(t,o)=>{e.log("NavigableContainerManager.partFocusChange",i.name,t,o)}),Z(()=>{e.containers.delete(i),e.log("NavigableContainerManager.unregister",i.name,e.lastContainer?.name),e.lastContainer===i&&(e.focused.set(!1),e.lastContainer=void 0)}))):C.None}static getActive(){return this.INSTANCE?.lastContainer}};nF=I([m(0,X),m(1,ne),m(2,B)],nF);function zE(a){return nF.register(a)}pt(nF.ID,nF,ut.BlockStartup);yt.registerCommandAndKeybindingRule({id:"widgetNavigation.focusPrevious",weight:200,when:x.and(whi,x.or(rc?.negate(),Pyt)),primary:2064,handler:()=>{nF.getActive()?.focusPreviousWidget()}});yt.registerCommandAndKeybindingRule({id:"widgetNavigation.focusNext",weight:200,when:x.and(whi,x.or(rc?.negate(),Ayt)),primary:2066,handler:()=>{nF.getActive()?.focusNextWidget()}});var LC=new Q("accessibilityHelpIsShown",!1,!0),ud=new Q("accessibleViewIsShown",!1,!0),Mde=new Q("accessibleViewSupportsNavigation",!1,!0),w9e=new Q("accessibleViewVerbosityEnabled",!1,!0),C9e=new Q("accessibleViewGoToSymbolSupported",!1,!0),wRt=new Q("accessibleViewOnLastLine",!1,!0),Kd=new Q("accessibleViewCurrentProviderId",void 0,void 0),lTe=new Q("accessibleViewInCodeBlock",void 0,void 0),Pde=new Q("accessibleViewContainsCodeBlocks",void 0,void 0),x9e=new Q("accessibleViewHasUnassignedKeybindings",void 0,void 0),k9e=new Q("accessibleViewHasAssignedKeybindings",void 0,void 0);var DC={type:"boolean",default:!0,tags:["accessibility"]},CRt=Object.freeze({id:"accessibility",title:d(4922,null),type:"object"}),Zp={type:"string",enum:["auto","on","off"],default:"auto",enumDescriptions:[d(4929,null),d(4932,null),d(4931,null)],tags:["accessibility"]},vb={type:"object",tags:["accessibility"],additionalProperties:!1,default:{sound:"auto",announcement:"auto"}},bb={type:"string",enum:["auto","off"],default:"auto",enumDescriptions:[d(4923,null),d(4924,null)],tags:["accessibility"]},Qz={type:"object",tags:["accessibility"],additionalProperties:!1,default:{sound:"auto"}},eGo={...CRt,scope:5,properties:{"accessibility.verbosity.terminal":{description:d(4950,null),...DC},"accessibility.verbosity.diffEditor":{description:d(4938,null),...DC},"accessibility.verbosity.panelChat":{description:d(4935,null),...DC},"accessibility.verbosity.inlineChat":{description:d(4944,null),...DC},"accessibility.verbosity.terminalChatOutput":{description:d(4951,null),...DC},"accessibility.verbosity.inlineCompletions":{description:d(4943,null),...DC},"accessibility.verbosity.keybindingsEditor":{description:d(4945,null),...DC},"accessibility.verbosity.notebook":{description:d(4946,null),...DC},"accessibility.verbosity.hover":{description:d(4942,null),...DC},"accessibility.verbosity.notification":{description:d(4947,null),...DC},"accessibility.verbosity.emptyEditorHint":{description:d(4940,null),...DC},"accessibility.verbosity.replEditor":{description:d(4948,null),...DC},"accessibility.verbosity.comments":{description:d(4936,null),...DC},"accessibility.verbosity.diffEditorActive":{description:d(4939,null),...DC},"accessibility.verbosity.debug":{description:d(4937,null),...DC},"accessibility.verbosity.walkthrough":{description:d(4952,null),...DC},"accessibility.accessibleView.closeOnKeyPress":{markdownDescription:d(4934,null),type:"boolean",default:!0},"accessibility.verbosity.sourceControl":{description:d(4949,null),...DC},"accessibility.verbosity.find":{description:d(4941,null),...DC},"accessibility.signalOptions.volume":{description:d(4809,null),type:"number",minimum:0,maximum:100,default:70,tags:["accessibility"]},"accessibility.signalOptions.debouncePositionChanges":{description:d(4802,null),type:"boolean",default:!1,tags:["accessibility"]},"accessibility.signalOptions.experimental.delays.general":{type:"object",description:"Delays for all signals besides error and warning at position",additionalProperties:!1,properties:{announcement:{description:d(4805,null),type:"number",minimum:0,default:3e3},sound:{description:d(4806,null),type:"number",minimum:0,default:400}},tags:["accessibility"]},"accessibility.signalOptions.experimental.delays.warningAtPosition":{type:"object",additionalProperties:!1,properties:{announcement:{description:d(4807,null),type:"number",minimum:0,default:3e3},sound:{description:d(4808,null),type:"number",minimum:0,default:1e3}},tags:["accessibility"]},"accessibility.signalOptions.experimental.delays.errorAtPosition":{type:"object",additionalProperties:!1,properties:{announcement:{description:d(4803,null),type:"number",minimum:0,default:3e3},sound:{description:d(4804,null),type:"number",minimum:0,default:1e3}},tags:["accessibility"]},"accessibility.signals.lineHasBreakpoint":{...vb,description:d(4847,null),properties:{sound:{description:d(4849,null),...Zp},announcement:{description:d(4848,null),...bb}}},"accessibility.signals.lineHasInlineSuggestion":{...Qz,description:d(4856,null),properties:{sound:{description:d(4857,null),...Zp,default:"off"}}},"accessibility.signals.nextEditSuggestion":{...vb,description:d(4861,null),properties:{sound:{description:d(4863,null),...Zp},announcement:{description:d(4862,null),...bb}}},"accessibility.signals.lineHasError":{...vb,description:d(4850,null),properties:{sound:{description:d(4852,null),...Zp},announcement:{description:d(4851,null),...bb,default:"off"}}},"accessibility.signals.lineHasFoldedArea":{...vb,description:d(4853,null),properties:{sound:{description:d(4855,null),...Zp,default:"off"},announcement:{description:d(4854,null),...bb}}},"accessibility.signals.lineHasWarning":{...vb,description:d(4858,null),properties:{sound:{description:d(4860,null),...Zp},announcement:{description:d(4859,null),...bb,default:"off"}}},"accessibility.signals.positionHasError":{...vb,description:d(4876,null),properties:{sound:{description:d(4878,null),...Zp},announcement:{description:d(4877,null),...bb,default:"on"}}},"accessibility.signals.positionHasWarning":{...vb,description:d(4879,null),properties:{sound:{description:d(4881,null),...Zp},announcement:{description:d(4880,null),...bb,default:"on"}}},"accessibility.signals.onDebugBreak":{...vb,description:d(4873,null),properties:{sound:{description:d(4875,null),...Zp},announcement:{description:d(4874,null),...bb}}},"accessibility.signals.noInlayHints":{...vb,description:d(4864,null),properties:{sound:{description:d(4866,null),...Zp},announcement:{description:d(4865,null),...bb}}},"accessibility.signals.taskCompleted":{...vb,description:d(4895,null),properties:{sound:{description:d(4897,null),...Zp},announcement:{description:d(4896,null),...bb}}},"accessibility.signals.taskFailed":{...vb,description:d(4898,null),properties:{sound:{description:d(4900,null),...Zp},announcement:{description:d(4899,null),...bb}}},"accessibility.signals.terminalCommandFailed":{...vb,description:d(4904,null),properties:{sound:{description:d(4906,null),...Zp},announcement:{description:d(4905,null),...bb}}},"accessibility.signals.terminalCommandSucceeded":{...vb,description:d(4907,null),properties:{sound:{description:d(4909,null),...Zp},announcement:{description:d(4908,null),...bb}}},"accessibility.signals.terminalQuickFix":{...vb,description:d(4910,null),properties:{sound:{description:d(4912,null),...Zp},announcement:{description:d(4911,null),...bb}}},"accessibility.signals.terminalBell":{...vb,description:d(4901,null),properties:{sound:{description:d(4903,null),...Zp},announcement:{description:d(4902,null),...bb}}},"accessibility.signals.diffLineInserted":{...Qz,description:d(4829,null),properties:{sound:{description:d(4894,null),...Zp}}},"accessibility.signals.diffLineModified":{...Qz,description:d(4830,null),properties:{sound:{description:d(4831,null),...Zp}}},"accessibility.signals.diffLineDeleted":{...Qz,description:d(4827,null),properties:{sound:{description:d(4828,null),...Zp}}},"accessibility.signals.chatEditModifiedFile":{...Qz,description:d(4810,null),properties:{sound:{description:d(4811,null),...Zp}}},"accessibility.signals.notebookCellCompleted":{...vb,description:d(4867,null),properties:{sound:{description:d(4869,null),...Zp},announcement:{description:d(4868,null),...bb}}},"accessibility.signals.notebookCellFailed":{...vb,description:d(4870,null),properties:{sound:{description:d(4872,null),...Zp},announcement:{description:d(4871,null),...bb}}},"accessibility.signals.progress":{...vb,description:d(4882,null),default:{sound:"auto",announcement:"off"},properties:{sound:{description:d(4884,null),...Zp},announcement:{description:d(4883,null),...bb}}},"accessibility.signals.chatRequestSent":{...vb,description:d(4812,null),properties:{sound:{description:d(4814,null),...Zp},announcement:{description:d(4813,null),...bb}}},"accessibility.signals.chatResponseReceived":{...Qz,description:d(4815,null),properties:{sound:{description:d(4816,null),...Zp}}},"accessibility.signals.codeActionTriggered":{...Qz,description:d(4825,null),properties:{sound:{description:d(4826,null),...Zp}}},"accessibility.signals.codeActionApplied":{...Qz,description:d(4823,null),properties:{sound:{description:d(4824,null),...Zp}}},"accessibility.signals.voiceRecordingStarted":{...Qz,description:d(4913,null),properties:{sound:{description:d(4914,null),...Zp}},default:{sound:"on"}},"accessibility.signals.voiceRecordingStopped":{...Qz,description:d(4915,null),properties:{sound:{description:d(4916,null),...Zp,default:"off"}}},"accessibility.signals.clear":{...vb,description:d(4820,null),properties:{sound:{description:d(4822,null),...Zp},announcement:{description:d(4821,null),...bb}}},"accessibility.signals.editsUndone":{...vb,description:d(4835,null),properties:{sound:{description:d(4837,null),...Zp},announcement:{description:d(4836,null),...bb}}},"accessibility.signals.editsKept":{...vb,description:d(4832,null),properties:{sound:{description:d(4834,null),...Zp},announcement:{description:d(4833,null),...bb}}},"accessibility.signals.save":{type:"object",tags:["accessibility"],additionalProperties:!1,markdownDescription:d(4885,null),properties:{sound:{description:d(4890,null),type:"string",enum:["userGesture","always","never"],default:"never",enumDescriptions:[d(4893,null),d(4891,null),d(4892,null)]},announcement:{description:d(4886,null),type:"string",enum:["userGesture","always","never"],default:"never",enumDescriptions:[d(4889,null),d(4887,null),d(4888,null)]}},default:{sound:"never",announcement:"never"}},"accessibility.signals.format":{type:"object",tags:["accessibility"],additionalProperties:!1,markdownDescription:d(4838,null),properties:{sound:{description:d(4845,null),type:"string",enum:["userGesture","always","never"],default:"never",enumDescriptions:[d(4846,null),d(4839,null),d(4844,null)]},announcement:{description:d(4840,null),type:"string",enum:["userGesture","always","never"],default:"never",enumDescriptions:[d(4843,null),d(4841,null),d(4842,null)]}},default:{sound:"never",announcement:"never"}},"accessibility.signals.chatUserActionRequired":{...vb,markdownDescription:d(4817,null),properties:{sound:{description:d(4819,null),type:"string",enum:["auto","on","off"],enumDescriptions:[d(4930,null),d(4932,null),d(4931,null)]},announcement:{description:d(4818,null),...bb}},default:{sound:"auto",announcement:"auto"},tags:["accessibility"]},"accessibility.underlineLinks":{type:"boolean",description:d(4917,null),default:!1},"accessibility.debugWatchVariableAnnouncements":{type:"boolean",description:d(4798,null),default:!0},"accessibility.replEditor.readLastExecutionOutput":{type:"boolean",description:d(4801,null),default:!0},"accessibility.replEditor.autoFocusReplExecution":{type:"string",enum:["none","input","lastExecution"],default:"input",description:d(4928,null)},"accessibility.windowTitleOptimized":{type:"boolean",default:!0,markdownDescription:d(4921,null,"`#window.title#`","`activeEditorState`")},"accessibility.openChatEditedFiles":{type:"boolean",default:!1,markdownDescription:d(4800,null)},"accessibility.verboseChatProgressUpdates":{type:"boolean",default:!0,markdownDescription:d(4918,null)}}};function fto(){let a=oe.as(ii.Configuration);a.registerConfiguration(eGo),a.registerConfiguration({...Cm,properties:{"accessibility.dimUnfocused.enabled":{description:d(4926,null),type:"boolean",default:!1,tags:["accessibility"],scope:1},"accessibility.dimUnfocused.opacity":{markdownDescription:d(4927,null,"`#accessibility.dimUnfocused.enabled#`"),type:"number",minimum:.2,maximum:1,default:.75,tags:["accessibility"],scope:1},"accessibility.hideAccessibleView":{description:d(4799,null),type:"boolean",default:!1,tags:["accessibility"]},"accessibility.verboseChatProgressUpdates":{type:"boolean",default:!0,markdownDescription:d(4918,null)},"accessibility.chat.showCheckmarks":{type:"boolean",default:!1,tags:["accessibility"],markdownDescription:d(4797,null)}}})}var E9e=0,Rde=class extends C{constructor(e){super();this.speechService=e;this._register(H.runAndSubscribe(e.onDidChangeHasSpeechProvider,()=>this.updateConfiguration()))}static{this.ID="workbench.contrib.dynamicSpeechAccessibilityConfiguration"}updateConfiguration(){if(!this.speechService.hasSpeechProvider)return;let e=this.getLanguages(),t=Object.keys(e).sort((n,r)=>e[n].name.localeCompare(e[r].name));oe.as(ii.Configuration).registerConfiguration({...CRt,properties:{"accessibility.voice.speechTimeout":{markdownDescription:d(4955,null),type:"number",default:E9e,minimum:0,tags:["accessibility"]},"accessibility.voice.ignoreCodeBlocks":{markdownDescription:d(4953,null),type:"boolean",default:!1,tags:["accessibility"]},"accessibility.voice.speechLanguage":{markdownDescription:d(4954,null),type:"string",enum:t,default:"auto",tags:["accessibility"],enumDescriptions:t.map(n=>e[n].name),enumItemLabels:t.map(n=>e[n].name)},"accessibility.voice.autoSynthesize":{type:"string",enum:["on","off"],enumDescriptions:[d(4920,null),d(4919,null)],markdownDescription:d(4925,null),default:"off",tags:["accessibility"]}}})}getLanguages(){return{auto:{name:d(4933,null)},...pmi}}};Rde=I([m(0,EC)],Rde);oe.as(rp.ConfigurationMigration).registerConfigurationMigrations([{key:"audioCues.volume",migrateFn:(a,i)=>[["accessibility.signalOptions.volume",{value:a}],["audioCues.volume",{value:void 0}]]}]);oe.as(rp.ConfigurationMigration).registerConfigurationMigrations([{key:"audioCues.debouncePositionChanges",migrateFn:a=>[["accessibility.signalOptions.debouncePositionChanges",{value:a}],["audioCues.debouncePositionChanges",{value:void 0}]]}]);oe.as(rp.ConfigurationMigration).registerConfigurationMigrations([{key:"accessibility.signalOptions",migrateFn:(a,i)=>{let e=Chi(i,"general"),t=Chi(i,"errorAtPosition"),o=Chi(i,"warningAtPosition"),n=tGo(i),r=iGo(i),s=[];return n&&s.push(["accessibility.signalOptions.volume",{value:n}]),e&&s.push(["accessibility.signalOptions.experimental.delays.general",{value:e}]),t&&s.push(["accessibility.signalOptions.experimental.delays.errorAtPosition",{value:t}]),o&&s.push(["accessibility.signalOptions.experimental.delays.warningAtPosition",{value:o}]),r&&s.push(["accessibility.signalOptions.debouncePositionChanges",{value:r}]),s.push(["accessibility.signalOptions",{value:void 0}]),s}}]);oe.as(rp.ConfigurationMigration).registerConfigurationMigrations([{key:"accessibility.signals.sounds.volume",migrateFn:a=>[["accessibility.signalOptions.volume",{value:a}],["accessibility.signals.sounds.volume",{value:void 0}]]}]);oe.as(rp.ConfigurationMigration).registerConfigurationMigrations([{key:"accessibility.signals.debouncePositionChanges",migrateFn:a=>[["accessibility.signalOptions.debouncePositionChanges",{value:a}],["accessibility.signals.debouncePositionChanges",{value:void 0}]]}]);function Chi(a,i){return a(`accessibility.signalOptions.experimental.delays.${i}`)||a("accessibility.signalOptions")?.["experimental.delays"]?.[`${i}`]||a("accessibility.signalOptions")?.delays?.[`${i}`]}function tGo(a){return a("accessibility.signalOptions.volume")||a("accessibility.signalOptions")?.volume||a("accessibility.signals.sounds.volume")||a("audioCues.volume")}function iGo(a){return a("accessibility.signalOptions.debouncePositionChanges")||a("accessibility.signalOptions")?.debouncePositionChanges||a("accessibility.signals.debouncePositionChanges")||a("audioCues.debouncePositionChanges")}oe.as(rp.ConfigurationMigration).registerConfigurationMigrations([{key:"accessibility.voice.autoSynthesize",migrateFn:a=>{let i;if(a===!0)i="on";else if(a===!1)i="off";else return[];return[["accessibility.voice.autoSynthesize",{value:i}]]}}]);oe.as(rp.ConfigurationMigration).registerConfigurationMigrations([{key:"accessibility.signals.chatResponsePending",migrateFn:(a,i)=>[["accessibility.signals.progress",{value:a}],["accessibility.signals.chatResponsePending",{value:void 0}]]}]);oe.as(rp.ConfigurationMigration).registerConfigurationMigrations($o.allAccessibilitySignals.map(a=>a.legacySoundSettingsKey?{key:a.legacySoundSettingsKey,migrateFn:(i,e)=>{let t=[],o=a.legacyAnnouncementSettingsKey,n;return o&&(n=e(o)??void 0,n!==void 0&&typeof n!="string"&&(n=n?"auto":"off")),t.push([`${a.legacySoundSettingsKey}`,{value:void 0}]),t.push([`${a.settingsKey}`,{value:n!==void 0?{announcement:n,sound:i}:{sound:i}}]),t}}:void 0).filter(mo));oe.as(rp.ConfigurationMigration).registerConfigurationMigrations($o.allAccessibilitySignals.filter(a=>!!a.legacyAnnouncementSettingsKey&&!!a.legacySoundSettingsKey).map(a=>({key:a.legacyAnnouncementSettingsKey,migrateFn:(i,e)=>{let t=[],o=e(a.settingsKey)?.sound||e(a.legacySoundSettingsKey);return i!==void 0&&typeof i!="string"&&(i=i?"auto":"off"),t.push([`${a.settingsKey}`,{value:i!==void 0?{announcement:i,sound:o}:{sound:o}}]),t.push([`${a.legacyAnnouncementSettingsKey}`,{value:void 0}]),t.push([`${a.legacySoundSettingsKey}`,{value:void 0}]),t}})));var zX=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super();this.container=e;this._parentEditor=t;this._owner=o;this._parentResourceUri=n;this._contextKeyService=r;this._scopedInstantiationService=s;this._commentThread=l;this._pendingComment=c;this._pendingEdits=u;this._markdownOptions=p;this._commentOptions=h;this._containerDelegate=g;this.commentService=f;this.configurationService=v;this._keybindingService=b;this._commentThreadDisposables=[];this._onDidResize=this._register(new E);this.onDidResize=this._onDidResize.event;this._threadIsEmpty=vc.commentThreadIsEmpty.bindTo(this._contextKeyService),this._threadIsEmpty.set(!l.comments||!l.comments.length),this._focusedContextKey=vc.commentFocused.bindTo(this._contextKeyService),this._commentMenus=this.commentService.getCommentMenus(this._owner),this._register(this._header=this._scopedInstantiationService.createInstance(sTe,e,{collapse:this._containerDelegate.collapse.bind(this)},this._commentMenus,this._commentThread)),this._header.updateCommentThread(this._commentThread);let S=_(".body");e.appendChild(S),this._register(Z(()=>S.remove()));let y=this._register(Vn(S));this._register(zE({name:"commentThreadWidget",focusNotifiers:[y],focusNextWidget:()=>{this._commentReply?.isCommentEditorFocused()||this._commentReply?.expandReplyAreaAndFocusCommentEditor()},focusPreviousWidget:()=>{this._commentReply?.isCommentEditorFocused()&&this._commentThread.comments?.length&&this._body.focus()}})),this._register(y.onDidFocus(()=>this._focusedContextKey.set(!0))),this._register(y.onDidBlur(()=>this._focusedContextKey.reset())),this._register(this.configurationService.onDidChangeConfiguration(T=>{T.affectsConfiguration("accessibility.verbosity.comments")&&this._setAriaLabel()})),this._body=this._scopedInstantiationService.createInstance(rTe,this._parentEditor,this._owner,this._parentResourceUri,S,this._markdownOptions,this._commentThread,this._pendingEdits,this._scopedInstantiationService,this),this._register(this._body),this._setAriaLabel(),this._commentThreadContextValue=vc.commentThreadContext.bindTo(this._contextKeyService),this._commentThreadContextValue.set(l.contextValue);let w=vc.commentControllerContext.bindTo(this._contextKeyService),k=this.commentService.getCommentController(this._owner);k?.contextValue&&w.set(k.contextValue),this.currentThreadListeners()}get commentThread(){return this._commentThread}get hasUnsubmittedComments(){return!!this._commentReply?.commentEditor.getValue()||this._body.hasCommentsInEditMode()}_setAriaLabel(){let e=d(8543,null),t,o=this.configurationService.getValue("accessibility.verbosity.comments");o&&(t=this._keybindingService.lookupKeybinding("editor.action.accessibilityHelp",this._contextKeyService)?.getLabel()??void 0),t?e=d(8544,null,e,t):o&&(e=d(8545,null,e)),this._body.container.ariaLabel=e}updateCurrentThread(e,t){e||t?this.commentService.setCurrentCommentThread(this.commentThread):this.commentService.setCurrentCommentThread(void 0)}currentThreadListeners(){let e=!1,t=!1;this._register(j(this.container,re.MOUSE_ENTER,o=>{o.relatedTarget===this.container&&(e=!0,this.updateCurrentThread(e,t))},!0)),this._register(j(this.container,re.MOUSE_LEAVE,o=>{o.relatedTarget===this.container&&(e=!1,this.updateCurrentThread(e,t))},!0)),this._register(j(this.container,re.FOCUS_IN,()=>{t=!0,this.updateCurrentThread(e,t)},!0)),this._register(j(this.container,re.FOCUS_OUT,()=>{t=!1,this.updateCurrentThread(e,t)},!0))}async updateCommentThread(e){let t=this._commentThread.collapsibleState===1&&this._commentThreadState===0&&e.state===1;this._commentThreadState=e.state,this._commentThread=e,Ue(this._commentThreadDisposables),this._commentThreadDisposables=[],this._bindCommentThreadListeners(),await this._body.updateCommentThread(e,this._commentReply?.isCommentEditorFocused()??!1),this._threadIsEmpty.set(!this._body.length),this._header.updateCommentThread(e),this._commentReply?.updateCommentThread(e),this._commentThread.contextValue?this._commentThreadContextValue.set(this._commentThread.contextValue):this._commentThreadContextValue.reset(),t&&this.configurationService.getValue(zz).collapseOnResolve&&this.collapse()}async display(e,t){let o=Math.max(23,Math.ceil(e*1.2));this._header.updateHeight(o),await this._body.display(),this._commentThread.canReply&&this._createCommentForm(t),this._createAdditionalActions(),this._register(this._body.onDidResize(n=>{this._refresh(n)})),this._commentThread.canReply&&this._commentReply&&this._commentReply.focusIfNeeded(),this._bindCommentThreadListeners()}_refresh(e){this._body.layout(),this._onDidResize.fire(e)}dispose(){super.dispose(),Ue(this._commentThreadDisposables),this.updateCurrentThread(!1,!1)}_bindCommentThreadListeners(){this._commentThreadDisposables.push(this._commentThread.onDidChangeCanReply(()=>{this._commentReply?this._commentReply.updateCanReply():this._commentThread.canReply&&this._createCommentForm(!1)})),this._commentThreadDisposables.push(this._commentThread.onDidChangeComments(async e=>{await this.updateCommentThread(this._commentThread)})),this._commentThreadDisposables.push(this._commentThread.onDidChangeLabel(e=>{this._header.createThreadLabel()}))}_createCommentForm(e){this._commentReply=this._scopedInstantiationService.createInstance(oTe,this._owner,this._body.container,this._parentEditor,this._commentThread,this._scopedInstantiationService,this._contextKeyService,this._commentMenus,this._commentOptions,this._pendingComment,this,e,this._containerDelegate.actionRunner),this._register(this._commentReply)}_createAdditionalActions(){this._additionalActions=this._scopedInstantiationService.createInstance(aTe,this._body.container,this._commentThread,this._contextKeyService,this._commentMenus,this._containerDelegate.actionRunner),this._register(this._additionalActions)}getCommentCoords(e){return this._body.getCommentCoords(e)}getPendingEdits(){return this._body.getPendingEdits()}getPendingComment(){if(this._commentReply)return this._commentReply.getPendingComment()}setPendingComment(e){this._pendingComment=e,this._commentReply?.setPendingComment(e)}getDimensions(){return this._body.getDimensions()}layout(e){this._body.layout(e),e!==void 0&&this._commentReply?.layout(e)}ensureFocusIntoNewEditingComment(){this._body.ensureFocusIntoNewEditingComment()}focusCommentEditor(){this._commentReply?.expandReplyAreaAndFocusCommentEditor()}focus(e){this._body.focus(e)}async submitComment(){let e=this._body.activeComment;if(e)return e.submitComment();if((this._commentReply?.getPendingComment()?.body.length??0)>0)return this._commentReply?.submitComment()}async collapse(){await this._containerDelegate.collapse()&&z.isIRange(this.commentThread.range)&&pn(this._parentEditor)&&this._parentEditor.setSelection(this.commentThread.range)}applyTheme(e){let t="--comment-thread-editor-font-family",o="--comment-thread-editor-font-weight";this.container?.style.setProperty(t,e.fontFamily),this.container?.style.setProperty(o,e.fontWeight),this._commentReply?.setCommentEditorDecorations()}};zX=I([m(12,km),m(13,B),m(14,_e)],zX);function vto(a,i){return Beo(a,i)??i.getColor(p_)}function bto(a){let i=a.comments;return i?i.some(e=>e.state===1):!1}function Sto(a){let i=a.target.range;if(!i||!a.event.leftButton||a.target.type!==4)return null;let e=a.target.detail;return e.offsetX-e.glyphMarginWidth-e.lineNumbersWidth-e.glyphMarginLeft>20?null:{lineNumber:i.startLineNumber}}function Ito(a,i){if(!a)return null;let{lineNumber:e}=a;return i.target.range?e:null}var cTe=class extends aO{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,{keepEditorSelection:!0,isAccessible:!0,showArrow:!!o.range});this._uniqueOwner=t;this._commentThread=o;this._pendingComment=n;this._pendingEdits=r;this.themeService=l;this.commentService=c;this.configurationService=p;this.dialogService=h;this._onDidClose=new E;this._onDidCreateThread=new E;this._onDidChangeExpandedState=new E;this._globalToDispose=new P;this._commentThreadDisposables=[];this._contextKeyService=this._globalToDispose.add(u.createScoped(this.domNode)),this._scopedInstantiationService=this._globalToDispose.add(s.createChild(new Io([X,this._contextKeyService])));let g=this.commentService.getCommentController(this._uniqueOwner);g&&(this._commentOptions=g.options),this._initialCollapsibleState=n?1:o.initialCollapsibleState,o.initialCollapsibleState=this._initialCollapsibleState,this._commentThreadDisposables=[],this.create(),this._globalToDispose.add(this.themeService.onDidColorThemeChange(this._applyTheme,this)),this._globalToDispose.add(this.editor.onDidChangeConfiguration(f=>{f.hasChanged(59)&&this._applyTheme()})),this._applyTheme()}get uniqueOwner(){return this._uniqueOwner}get commentThread(){return this._commentThread}get expanded(){return this._isExpanded}get onDidClose(){return this._onDidClose.event}get onDidCreateThread(){return this._onDidCreateThread.event}get onDidChangeExpandedState(){return this._onDidChangeExpandedState.event}getPosition(){if(this.position)return this.position;if(this._commentGlyph)return this._commentGlyph.getPosition().position??void 0}revealRange(){}reveal(e,t=0){this.makeVisible(e,t);let o=this._commentThread.comments?.find(n=>n.uniqueIdInThread===e)??this._commentThread.comments?.[0];this.commentService.setActiveCommentAndThread(this.uniqueOwner,{thread:this._commentThread,comment:o})}_expandAndShowZoneWidget(){this._isExpanded||this.show(this.arrowPosition(this._commentThread.range),2)}_setFocus(e,t){t===1?this._commentThreadWidget.focus(e):t===2&&this._commentThreadWidget.focusCommentEditor()}_goToComment(e,t){let o=this.editor.getLayoutInfo().height,n=this._commentThreadWidget.getCommentCoords(e);if(n){let r=1;if(this._commentThread.range){let s=n.thread,l=n.comment;r=this.editor.getTopForLineNumber(this._commentThread.range.startLineNumber)-o/2+l.top-s.top}this.editor.setScrollTop(r),this._setFocus(e,t)}else this._goToThread(t)}_goToThread(e){let t=this._commentThread.range?new z(this._commentThread.range.startLineNumber,this._commentThread.range.startColumn,this._commentThread.range.endLineNumber+1,1):new z(1,1,1,1);this.editor.revealRangeInCenter(t),this._setFocus(void 0,e)}makeVisible(e,t=0){this._expandAndShowZoneWidget(),e!==void 0?this._goToComment(e,t):this._goToThread(t)}getPendingComments(){return{newComment:this._commentThreadWidget.getPendingComment(),edits:this._commentThreadWidget.getPendingEdits()}}setPendingComment(e){this._pendingComment=e,this.expand(),this._commentThreadWidget.setPendingComment(e)}_fillContainer(e){this.setCssClass("review-widget"),this._commentThreadWidget=this._scopedInstantiationService.createInstance(zX,e,this.editor,this._uniqueOwner,this.editor.getModel().uri,this._contextKeyService,this._scopedInstantiationService,this._commentThread,this._pendingComment,this._pendingEdits,{context:this.editor},this._commentOptions,{actionRunner:async()=>{if(!this._commentThread.comments||!this._commentThread.comments.length){let t=this.getPosition();if(t){let o=this._commentThread.range;if(!o)return;let n;if(t.lineNumber!==o.endLineNumber){let r=t.lineNumber-o.endLineNumber;n=new z(o.startLineNumber+r,o.startColumn,o.endLineNumber+r,o.endColumn)}else n=new z(o.startLineNumber,o.startColumn,o.endLineNumber,o.endColumn);await this.commentService.updateCommentThreadTemplate(this.uniqueOwner,this._commentThread.commentThreadHandle,n)}}},collapse:()=>this.collapse(!0)}),this._disposables.add(this._commentThreadWidget)}arrowPosition(e){if(e)return{lineNumber:e.endLineNumber,column:e.endLineNumber===e.startLineNumber?(e.startColumn+e.endColumn+1)/2:1}}deleteCommentThread(){this.dispose(),this.commentService.disposeCommentThread(this.uniqueOwner,this._commentThread.threadId)}doCollapse(){this._commentThread.collapsibleState=0}async collapse(e=!1){return!e||await this.confirmCollapse()?(this.doCollapse(),!0):!1}async confirmCollapse(){if(this.configurationService.getValue("comments.thread.confirmOnCollapse")==="whenHasUnsubmittedComments"&&this._commentThreadWidget.hasUnsubmittedComments){let t=await this.dialogService.confirm({message:d(8546,null),primaryButton:d(8547,null),type:gt.Warning,checkbox:{label:d(8548,null),checked:!1}});return t.checkboxChecked&&await this.configurationService.updateValue("comments.thread.confirmOnCollapse","never"),t.confirmed}return!0}expand(e){this._commentThread.collapsibleState=1,e&&this.commentService.setActiveCommentAndThread(this.uniqueOwner,{thread:this._commentThread})}getGlyphPosition(){return this._commentGlyph?this._commentGlyph.getPosition().position.lineNumber:0}async update(e){this._commentThread!==e&&(this._commentThreadDisposables.forEach(n=>n.dispose()),this._commentThread=e,this._commentThreadDisposables=[],this.bindCommentThreadListeners()),await this._commentThreadWidget.updateCommentThread(e);let t=this._commentThread.range?.endLineNumber??1,o=!1;if(this._commentGlyph){let n=bto(e);this._commentGlyph.setThreadState(e.state,n),this._commentGlyph.getPosition().position.lineNumber!==t&&(o=!0,this._commentGlyph.setLineNumber(t))}o&&this._isExpanded||this._commentThread.collapsibleState===1&&!this._isExpanded?this.show(this.arrowPosition(this._commentThread.range),2):this._commentThread.collapsibleState!==1&&this.hide()}_onWidth(e){this._commentThreadWidget.layout(e)}_doLayout(e,t){this._commentThreadWidget.layout(t)}async display(e,t){if(e){this._commentGlyph=new _de(this.editor,e?.endLineNumber??-1);let o=bto(this._commentThread);this._commentGlyph.setThreadState(this._commentThread.state,o),this._globalToDispose.add(this._commentGlyph.onDidChangeLineNumber(async n=>{if(!this._commentThread.range)return;let r=n-this._commentThread.range.endLineNumber,s=new z(this._commentThread.range.startLineNumber+r,this._commentThread.range.startColumn,this._commentThread.range.endLineNumber+r,this._commentThread.range.endColumn);this._commentThread.range=s}))}await this._commentThreadWidget.display(this.editor.getOption(75),t),this._disposables.add(this._commentThreadWidget.onDidResize(o=>{this._refresh(o)})),this._commentThread.collapsibleState===1&&this.show(this.arrowPosition(e),2),t&&this.makeVisible(),this.bindCommentThreadListeners()}bindCommentThreadListeners(){if(this._commentThreadDisposables.push(this._commentThread.onDidChangeComments(async e=>{await this.update(this._commentThread)})),this._commentThreadDisposables.push(this._commentThread.onDidChangeCollapsibleState(e=>{if(e===1&&!this._isExpanded){this.show(this.arrowPosition(this._commentThread.range),2),this._commentThreadWidget.ensureFocusIntoNewEditingComment();return}if(e===0&&this._isExpanded){this.hide();return}})),this._initialCollapsibleState===void 0){let e=this._commentThread.onDidChangeInitialCollapsibleState(t=>{this._initialCollapsibleState=t,this._commentThread.collapsibleState=this._initialCollapsibleState,e.dispose()});this._commentThreadDisposables.push(e)}this._commentThreadDisposables.push(this._commentThread.onDidChangeState(()=>{let e=vto(this._commentThread.state,this.themeService.getColorTheme())||Oe.transparent;this.style({frameColor:e,arrowColor:e}),this.container?.style.setProperty(Feo,`${e}`),this.container?.style.setProperty(Weo,`${e.transparent(.1)}`)}))}async submitComment(){return this._commentThreadWidget.submitComment()}_refresh(e){if(this._isExpanded===void 0&&e.height===0&&e.width===0){this.commentThread.collapsibleState=0;return}if(this._isExpanded){this._commentThreadWidget.layout();let t=Math.ceil(this.editor.getOption(75)*1.2),o=this.editor.getOption(75),n=Math.round(o/3),r=Math.round(o/9)*2,s=Math.ceil((t+e.height+n+r+8)/o);if(this._viewZone?.heightInLines===s)return;let l=this.getPosition();this._viewZone&&l&&l.lineNumber!==this._viewZone.afterLineNumber&&this._viewZone.afterLineNumber!==0&&(this._viewZone.afterLineNumber=l.lineNumber);let c=tC.capture(this.editor);this._relayout(s),c.restore(this.editor)}}_applyTheme(){let e=vto(this._commentThread.state,this.themeService.getColorTheme())||Oe.transparent;this.style({arrowColor:e,frameColor:e});let t=this.editor.getOption(59);this._commentThreadWidget.applyTheme(t)}show(e,t){let o=this._commentGlyph?.getPosition(),n=z.isIRange(e)?e:e?z.fromPositions(e):void 0;if(o?.position&&n&&o.position.lineNumber!==n.endLineNumber){let s=o.position.lineNumber-n.endLineNumber;n=new z(n.startLineNumber+s,n.startColumn,n.endLineNumber+s,n.endColumn)}let r=this._isExpanded;this._isExpanded=!0,super.show(n??new z(0,0,0,0),t),this._commentThread.collapsibleState=1,this._refresh(this._commentThreadWidget.getDimensions()),r||this._onDidChangeExpandedState.fire(!0)}async collapseAndFocusRange(){await this.collapse(!0)&&z.isIRange(this.commentThread.range)&&pn(this.editor)&&this.editor.setSelection(this.commentThread.range)}hide(){this._isExpanded&&(this._isExpanded=!1,this.editor.hasWidgetFocus()&&this.editor.focus(),(!this._commentThread.comments||!this._commentThread.comments.length)&&this.deleteCommentThread(),this._onDidChangeExpandedState.fire(!1)),super.hide()}dispose(){super.dispose(),this._commentGlyph&&(this._commentGlyph.dispose(),this._commentGlyph=void 0),this._globalToDispose.dispose(),this._commentThreadDisposables.forEach(e=>e.dispose()),this._onDidClose.fire(void 0),this._onDidClose.dispose(),this._onDidCreateThread.dispose(),this._onDidChangeExpandedState.dispose()}};cTe=I([m(5,F),m(6,De),m(7,km),m(8,X),m(9,B),m(10,ct)],cTe);var kRt=class{constructor(i,e){this.range=i;this.options=e}get id(){return this._decorationId}set id(i){this._decorationId=i}},ERt=class a extends C{constructor(e){super();this.decorationIds=[];this.activeDecorationIds=[];this.threadCollapseStateListeners=[];let t={description:a.description,isWholeLine:!1,zIndex:20,className:"comment-thread-range",shouldFillLineOnLineBreak:!0};this.decorationOptions=po.createDynamic(t);let o={description:a.description,isWholeLine:!1,zIndex:20,className:"comment-thread-range-current",shouldFillLineOnLineBreak:!0};this.activeDecorationOptions=po.createDynamic(o),this._register(e.onDidChangeCurrentCommentThread(n=>{this.updateCurrent(n)})),this._register(e.onDidUpdateCommentThreads(()=>{this.updateCurrent(void 0)}))}static{this.description="comment-thread-range-decorator"}updateCurrent(e){if(!this.editor||e?.resource&&e.resource?.toString()!==this.editor.getModel()?.uri.toString())return;this.currentThreadCollapseStateListener?.dispose();let t=[];if(e){let o=e.range;o&&!(o.startLineNumber===o.endLineNumber&&o.startColumn===o.endColumn)&&e.collapsibleState===1&&(this.currentThreadCollapseStateListener=e.onDidChangeCollapsibleState(n=>{n===0&&this.updateCurrent(void 0)}),t.push(new kRt(o,this.activeDecorationOptions)))}this.editor.changeDecorations(o=>{this.activeDecorationIds=o.deltaDecorations(this.activeDecorationIds,t),t.forEach((n,r)=>n.id=this.decorationIds[r])})}update(e,t){let o=e?.getModel();if(!e||!o)return;Ue(this.threadCollapseStateListeners),this.editor=e;let n=[];for(let r of t)r.threads.forEach(s=>{if(s.isDisposed)return;let l=s.range;!l||l.startLineNumber===l.endLineNumber&&l.startColumn===l.endColumn||(this.threadCollapseStateListeners.push(s.onDidChangeCollapsibleState(()=>{this.update(e,t)})),s.collapsibleState!==0&&n.push(new kRt(l,this.decorationOptions)))});e.changeDecorations(r=>{this.decorationIds=r.deltaDecorations(this.decorationIds,n),n.forEach((s,l)=>s.id=this.decorationIds[l])})}dispose(){Ue(this.threadCollapseStateListeners),this.currentThreadCollapseStateListener?.dispose(),super.dispose()}};var khi="editor.contrib.review",Yz=class{constructor(i,e,t,o,n,r,s,l=!1){this._editor=i;this._ownerId=e;this._extensionId=t;this._label=o;this._range=n;this.options=r;this.commentingRangesInfo=s;this.isHover=l;this._startLineNumber=n.startLineNumber,this._endLineNumber=n.endLineNumber}get id(){return this._decorationId}set id(i){this._decorationId=i}get range(){return{startLineNumber:this._startLineNumber,startColumn:1,endLineNumber:this._endLineNumber,endColumn:1}}getCommentAction(){return{extensionId:this._extensionId,label:this._label,ownerId:this._ownerId,commentingRangesInfo:this.commentingRangesInfo}}getOriginalRange(){return this._range}getActiveRange(){return this.id?this._editor.getModel().getDecorationRange(this.id):void 0}},TRt=class a{constructor(){this.commentingRangeDecorations=[];this.decorationIds=[];this._lastHover=-1;this._onDidChangeDecorationsCount=new E;this.onDidChangeDecorationsCount=this._onDidChangeDecorationsCount.event;let i={description:a.description,isWholeLine:!0,linesDecorationsClassName:"comment-range-glyph comment-diff-added"};this.decorationOptions=po.createDynamic(i);let e={description:a.description,isWholeLine:!0,linesDecorationsClassName:"comment-range-glyph line-hover"};this.hoverDecorationOptions=po.createDynamic(e);let t={description:a.description,isWholeLine:!0,linesDecorationsClassName:"comment-range-glyph multiline-add"};this.multilineDecorationOptions=po.createDynamic(t)}static{this.description="commenting-range-decorator"}updateHover(i){this._editor&&this._infos&&i!==this._lastHover&&this._doUpdate(this._editor,this._infos,i),this._lastHover=i??-1}updateSelection(i,e=new z(0,0,0,0)){this._lastSelection=e.isEmpty()?void 0:e,this._lastSelectionCursor=e.isEmpty()?void 0:i,this._editor&&this._infos&&this._doUpdate(this._editor,this._infos,i,e)}update(i,e,t,o){i&&(this._editor=i,this._infos=e,this._doUpdate(i,e,t,o))}_lineHasThread(i,e){return i.getDecorationsInRange(e)?.find(t=>t.options.description===_de.description)}_doUpdate(i,e,t=-1,o=this._lastSelection){if(!i.getModel())return;t=this._lastSelectionCursor??t;let r=[];for(let l of e)l.commentingRanges.ranges.forEach(c=>{let u=new z(c.startLineNumber,c.startColumn,c.endLineNumber,c.endColumn),p=o?u.intersectRanges(o):void 0;if(o&&t>=0&&p&&!(p.startLineNumber===p.endLineNumber&&t===p.startLineNumber)){let h;t<=p.startLineNumber?(h=p.collapseToStart(),p=new z(p.startLineNumber+1,1,p.endLineNumber,1)):(h=new z(p.endLineNumber,1,p.endLineNumber,1),p=new z(p.startLineNumber,1,p.endLineNumber-1,1)),r.push(new Yz(i,l.uniqueOwner,l.extensionId,l.label,p,this.multilineDecorationOptions,l.commentingRanges,!0)),this._lineHasThread(i,h)||r.push(new Yz(i,l.uniqueOwner,l.extensionId,l.label,h,this.hoverDecorationOptions,l.commentingRanges,!0));let g=Math.min(h.startLineNumber,p.startLineNumber)-1,f=u.startLineNumber<=g,v=Math.max(h.endLineNumber,p.endLineNumber)+1,b=u.endLineNumber>=v;if(f){let S=new z(c.startLineNumber,1,g,1);r.push(new Yz(i,l.uniqueOwner,l.extensionId,l.label,S,this.decorationOptions,l.commentingRanges,!0))}if(b){let S=new z(v,1,c.endLineNumber,1);r.push(new Yz(i,l.uniqueOwner,l.extensionId,l.label,S,this.decorationOptions,l.commentingRanges,!0))}}else if(u.startLineNumber<=t&&t<=u.endLineNumber){if(u.startLineNumber<t){let g=new z(c.startLineNumber,1,t-1,1);r.push(new Yz(i,l.uniqueOwner,l.extensionId,l.label,g,this.decorationOptions,l.commentingRanges,!0))}let h=new z(t,1,t,1);if(this._lineHasThread(i,h)||r.push(new Yz(i,l.uniqueOwner,l.extensionId,l.label,h,this.hoverDecorationOptions,l.commentingRanges,!0)),t<u.endLineNumber){let g=new z(t+1,1,c.endLineNumber,1);r.push(new Yz(i,l.uniqueOwner,l.extensionId,l.label,g,this.decorationOptions,l.commentingRanges,!0))}}else r.push(new Yz(i,l.uniqueOwner,l.extensionId,l.label,c,this.decorationOptions,l.commentingRanges))});i.changeDecorations(l=>{this.decorationIds=l.deltaDecorations(this.decorationIds,r),r.forEach((c,u)=>c.id=this.decorationIds[u])});let s=this.commentingRangeDecorations.length-r.length;this.commentingRangeDecorations=r,s&&this._onDidChangeDecorationsCount.fire(this.commentingRangeDecorations.length)}areRangesIntersectingOrTouchingByLine(i,e){return!(i.endLineNumber<e.startLineNumber-1||e.endLineNumber+1<i.startLineNumber)}getMatchedCommentAction(i){if(i===void 0){let o=this._infos?.filter(n=>n.commentingRanges.fileComments);return o?o.map(n=>({action:{ownerId:n.uniqueOwner,extensionId:n.extensionId,label:n.label,commentingRangesInfo:n.commentingRanges}})):[]}let e=new Map;for(let o of this.commentingRangeDecorations){let n=o.getActiveRange();if(n&&this.areRangesIntersectingOrTouchingByLine(n,i)){let r=o.getCommentAction(),s=e.get(r.ownerId);if(s?.action.commentingRangesInfo===r.commentingRangesInfo){let l=new z(n.startLineNumber<s.range.startLineNumber?n.startLineNumber:s.range.startLineNumber,n.startColumn<s.range.startColumn?n.startColumn:s.range.startColumn,n.endLineNumber>s.range.endLineNumber?n.endLineNumber:s.range.endLineNumber,n.endColumn>s.range.endColumn?n.endColumn:s.range.endColumn);e.set(r.ownerId,{range:l,action:r})}else e.set(r.ownerId,{range:n,action:r})}}let t=new Set;return Array.from(e.values()).filter(o=>t.has(o.action.ownerId)?!1:(t.add(o.action.ownerId),!0))}getNearestCommentingRange(i,e){let t,o;if(e){o=[];for(let n=this.commentingRangeDecorations.length-1;n>=0;n--)o.push(this.commentingRangeDecorations[n])}else o=this.commentingRangeDecorations;for(let n of o){let r=n.getActiveRange();if(r){if(t&&this.areRangesIntersectingOrTouchingByLine(r,t)){t=z.plusRange(t,r);continue}if(r.startLineNumber<=i.lineNumber&&i.lineNumber<=r.endLineNumber){t=new z(r.startLineNumber,r.startColumn,r.endLineNumber,r.endColumn);continue}if(!(!e&&r.endLineNumber<i.lineNumber)&&!(e&&r.startLineNumber>i.lineNumber))return r}}return o.length>0?o[0].getActiveRange()??void 0:void 0}dispose(){this._onDidChangeDecorationsCount.dispose(),this.commentingRangeDecorations=[]}};function Ehi(a,i){if(!a?.comment||!a?.thread?.comments)return;let e=a.thread.comments?.indexOf(a.comment);if(e===void 0||e<0||i==="previous"&&e===0||i==="next"&&e===a.thread.comments.length-1)return;let t=a.thread.comments?.[i==="previous"?e-1:e+1];if(t)return{...a,comment:t}}function KX(a,i,e,t,o,n,r,s,l){if(!t.resource)return;a.isCommentingEnabled||a.enableCommenting(!0);let c=t.range,u=n?2:s?0:1,p=i.activeTextEditorControl,h=Ec(p)?[p.getOriginalEditor(),p.getModifiedEditor()]:p?[p]:[],g=t.threadId,f=o?.uniqueIdInThread,v=A.parse(t.resource);for(let b of h){let S=b.getModel();if(S instanceof Bu&&e.extUri.isEqual(v,S.uri)){g&&pn(b)&&RC.get(b)?.revealCommentThread(g,f,!0,u);return}}i.openEditor({resource:v,options:{pinned:r,preserveFocus:s,selection:c??new z(1,1,1,1)}},l?vn:Un).then(b=>{if(b){let S=b.getControl();g&&pn(S)&&RC.get(S)?.revealCommentThread(g,f,!0,u)}})}var RC=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.commentService=t;this.instantiationService=o;this.codeEditorService=n;this.contextMenuService=r;this.quickInputService=s;this.viewsService=l;this.configurationService=c;this.editorService=p;this.keybindingService=h;this.accessibilityService=g;this.notificationService=f;this.localToDispose=this._register(new P);this.mouseDownInfo=null;this._commentingRangeSpaceReserved=!1;this._commentingRangeAmountReserved=0;this._emptyThreadsToAddQueue=[];this._inProcessContinueOnComments=new Map;this._editorDisposables=[];this._hasRespondedToEditorChange=!1;this._commentInfos=[],this._commentWidgets=[],this._pendingNewCommentCache={},this._pendingEditsCache={},this._computePromise=null,this._activeCursorHasCommentingRange=vc.activeCursorHasCommentingRange.bindTo(u),this._activeCursorHasComment=vc.activeCursorHasComment.bindTo(u),this._activeEditorHasCommentingRange=vc.activeEditorHasCommentingRange.bindTo(u),this._commentWidgetVisible=vc.commentWidgetVisible.bindTo(u),!(e instanceof zc)&&(this.editor=e,this._commentingRangeDecorator=this._register(new TRt),this._register(this._commentingRangeDecorator.onDidChangeDecorationsCount(v=>{v===0?this.clearEditorListeners():this._editorDisposables.length===0&&this.registerEditorListeners()})),this._register(this._commentThreadRangeDecorator=new ERt(this.commentService)),this._register(this.commentService.onDidDeleteDataProvider(v=>{v?(delete this._pendingNewCommentCache[v],delete this._pendingEditsCache[v]):(this._pendingNewCommentCache={},this._pendingEditsCache={}),this.beginCompute()})),this._register(this.commentService.onDidSetDataProvider(v=>this.beginComputeAndHandleEditorChange())),this._register(this.commentService.onDidUpdateCommentingRanges(v=>this.beginComputeAndHandleEditorChange())),this._register(this.commentService.onDidSetResourceCommentInfos(async v=>{let b=this.editor&&this.editor.hasModel()&&this.editor.getModel().uri;b&&b.toString()===v.resource.toString()&&await this.setComments(v.commentInfos.filter(S=>S!==null))})),this._register(this.commentService.onDidChangeCommentingEnabled(v=>{v?(this.registerEditorListeners(),this.beginCompute()):(this.tryUpdateReservedSpace(),this.clearEditorListeners(),this._commentingRangeDecorator.update(this.editor,[]),this._commentThreadRangeDecorator.update(this.editor,[]),Ue(this._commentWidgets),this._commentWidgets=[])})),this._register(this.editor.onWillChangeModel(v=>this.onWillChangeModel(v))),this._register(this.editor.onDidChangeModel(v=>this.onModelChanged())),this._register(this.configurationService.onDidChangeConfiguration(v=>{v.affectsConfiguration("diffEditor.renderSideBySide")&&this.beginCompute()})),this.onModelChanged(),this._register(this.codeEditorService.registerDecorationType("comment-controller",IRt,{})),this._register(this.commentService.registerContinueOnCommentProvider({provideContinueOnComments:()=>{let v=[];if(this._commentWidgets)for(let b of this._commentWidgets){let y=b.getPendingComments().newComment;if(!y)continue;let w;if(b.commentThread.comments&&b.commentThread.comments.length){let k=b.commentThread.comments[b.commentThread.comments.length-1];typeof k.body=="string"?w=k.body:w=k.body.value}y.body!==w&&v.push({uniqueOwner:b.uniqueOwner,uri:b.editor.getModel().uri,range:b.commentThread.range,comment:y,isReply:b.commentThread.comments!==void 0&&b.commentThread.comments.length>0})}return v}})))}registerEditorListeners(){this._editorDisposables=[],this.editor&&(this._editorDisposables.push(this.editor.onMouseMove(e=>this.onEditorMouseMove(e))),this._editorDisposables.push(this.editor.onMouseLeave(()=>this.onEditorMouseLeave())),this._editorDisposables.push(this.editor.onDidChangeCursorPosition(e=>this.onEditorChangeCursorPosition(e.position))),this._editorDisposables.push(this.editor.onDidFocusEditorWidget(()=>this.onEditorChangeCursorPosition(this.editor?.getPosition()??null))),this._editorDisposables.push(this.editor.onDidChangeCursorSelection(e=>this.onEditorChangeCursorSelection(e))),this._editorDisposables.push(this.editor.onDidBlurEditorWidget(()=>this.onEditorChangeCursorSelection())))}clearEditorListeners(){Ue(this._editorDisposables),this._editorDisposables=[]}onEditorMouseLeave(){this._commentingRangeDecorator.updateHover()}onEditorMouseMove(e){let t=e.target.position?.lineNumber;e.event.leftButton.valueOf()&&t&&this.mouseDownInfo?this._commentingRangeDecorator.updateSelection(t,new z(this.mouseDownInfo.lineNumber,1,t,1)):this._commentingRangeDecorator.updateHover(t)}onEditorChangeCursorSelection(e){let t=this.editor?.getPosition()?.lineNumber;t&&this._commentingRangeDecorator.updateSelection(t,e?.selection)}onEditorChangeCursorPosition(e){if(!e)return;let t=z.fromPositions(e,{column:-1,lineNumber:e.lineNumber}),o=this.editor?.getDecorationsInRange(t),n=!1;if(o)for(let r of o)if(r.options.description===_de.description){n=!1;break}else r.options.description===TRt.description&&(n=!0);this._activeCursorHasCommentingRange.set(n),this._activeCursorHasComment.set(this.getCommentsAtLine(t).length>0)}isEditorInlineOriginal(e){return this.configurationService.getValue("diffEditor.renderSideBySide")?!1:!!this.editorService.visibleTextEditorControls.find(o=>o.getEditorType()===P$.IDiffEditor?o.getOriginalEditor()===e:!1)}beginCompute(){return this._computePromise=xn(e=>{let t=this.editor&&this.editor.hasModel()&&this.editor.getModel().uri;return t?this.commentService.getDocumentComments(t):Promise.resolve([])}),this._computeAndSetPromise=this._computePromise.then(async e=>{await this.setComments(si(e)),this._computePromise=null},e=>console.log(e)),this._computePromise.then(()=>this._computeAndSetPromise=void 0),this._computeAndSetPromise}beginComputeCommentingRanges(){this._computeCommentingRangeScheduler&&this._computeCommentingRangeScheduler.trigger(()=>{let e=this.editor&&this.editor.hasModel()&&this.editor.getModel().uri;return e?this.commentService.getDocumentComments(e):Promise.resolve([])}).then(e=>{if(this.commentService.isCommentingEnabled){let t=si(e);this._commentingRangeDecorator.update(this.editor,t,this.editor?.getPosition()?.lineNumber,this.editor?.getSelection()??void 0)}},e=>(mt(e),null))}static get(e){return e.getContribution(khi)}revealCommentThread(e,t,o,n){let r=this._commentWidgets.filter(s=>s.commentThread.threadId===e);r.length===1?r[0].reveal(t,n):o&&(this._computeAndSetPromise?this._computeAndSetPromise.then(s=>{this.revealCommentThread(e,t,!1,n)}):this.beginCompute().then(s=>{this.revealCommentThread(e,t,!1,n)}))}collapseAll(){for(let e of this._commentWidgets)e.collapse(!0)}async collapseVisibleComments(){if(!this.editor)return;let e=this.editor.getVisibleRanges();for(let t of this._commentWidgets)t.expanded&&t.commentThread.range&&e.some(n=>z.areIntersectingOrTouching(n,t.commentThread.range))&&await t.collapse(!0)}_updateCommentWidgetVisibleContext(){let e=this._commentWidgets.some(t=>t.expanded);this._commentWidgetVisible.set(e)}expandAll(){for(let e of this._commentWidgets)e.expand()}expandUnresolved(){for(let e of this._commentWidgets)e.commentThread.state===0&&e.expand()}nextCommentThread(e){this._findNearestCommentThread(e)}_findNearestCommentThread(e,t){if(!this._commentWidgets.length||!this.editor?.hasModel())return;let o=t?this.editor.getSelection().getStartPosition():this.editor.getSelection().getEndPosition(),n=this._commentWidgets.sort((l,c)=>{if(t){let u=l;l=c,c=u}return l.commentThread.range===void 0?-1:c.commentThread.range===void 0?1:l.commentThread.range.startLineNumber<c.commentThread.range.startLineNumber?-1:l.commentThread.range.startLineNumber>c.commentThread.range.startLineNumber?1:l.commentThread.range.startColumn<c.commentThread.range.startColumn?-1:l.commentThread.range.startColumn>c.commentThread.range.startColumn?1:0}),r=xy(n,l=>{let c=t?o.lineNumber:l.commentThread.range?.startLineNumber??0,u=t?l.commentThread.range?.startLineNumber??0:o.lineNumber,p=t?o.column:l.commentThread.range?.startColumn??0,h=t?l.commentThread.range?.startColumn??0:o.column;return c>u?!0:c<u?!1:p>h}),s=n[r];s!==void 0&&(this.editor.setSelection(s.commentThread.range??new z(1,1,1,1)),s.reveal(void 0,e?1:0))}previousCommentThread(e){this._findNearestCommentThread(e,!0)}_findNearestCommentingRange(e){if(!this.editor?.hasModel())return;let t=this.editor.getSelection().getEndPosition(),o=this._commentingRangeDecorator.getNearestCommentingRange(t,e);if(o){let n=e?o.getEndPosition():o.getStartPosition();this.editor.setPosition(n),this.editor.revealLineInCenterIfOutsideViewport(n.lineNumber)}if(this.accessibilityService.isScreenReaderOptimized()){let n=o?.getStartPosition().lineNumber,r=o?.getEndPosition().lineNumber;n&&r&&(n===r?Or(d(8479,null,n)):Or(d(8480,null,n,r)))}}nextCommentingRange(){this._findNearestCommentingRange()}previousCommentingRange(){this._findNearestCommentingRange(!0)}dispose(){super.dispose(),Ue(this._editorDisposables),Ue(this._commentWidgets),this.editor=null}onWillChangeModel(e){e.newModelUrl&&this.tryUpdateReservedSpace(e.newModelUrl)}async handleCommentAdded(e,t,o){if(this._commentWidgets.filter(h=>h.uniqueOwner===t&&h.commentThread.threadId===o.threadId).length)return;let r=this._commentWidgets.filter(h=>h.uniqueOwner===t&&h.commentThread.commentThreadHandle===-1&&z.equalsRange(h.commentThread.range,o.range));if(r.length){r[0].update(o);return}let s=this._inProcessContinueOnComments.get(t)?.findIndex(h=>h.range===void 0?o.range===void 0:z.lift(h.range).equalsRange(o.range)),l;s!==void 0&&s>=0&&(l=this._inProcessContinueOnComments.get(t)?.splice(s,1)[0].comment.body);let c=(this._pendingNewCommentCache[t]&&this._pendingNewCommentCache[t][o.threadId])??l,u=this._pendingEditsCache[t]&&this._pendingEditsCache[t][o.threadId],p=o.canReply&&o.isTemplate&&(!o.comments||o.comments.length===0)&&(!o.editorId||o.editorId===e);await this.displayCommentThread(t,o,p,c,u),this._commentInfos.filter(h=>h.uniqueOwner===t)[0].threads.push(o),this.tryUpdateReservedSpace()}onModelChanged(){this.localToDispose.clear(),this.tryUpdateReservedSpace(),this.removeCommentWidgetsAndStoreCache(),this.editor&&(this._hasRespondedToEditorChange=!1,this.localToDispose.add(this.editor.onMouseDown(e=>this.onEditorMouseDown(e))),this.localToDispose.add(this.editor.onMouseUp(e=>this.onEditorMouseUp(e))),this._editorDisposables.length&&(this.clearEditorListeners(),this.registerEditorListeners()),this._computeCommentingRangeScheduler=new jo(200),this.localToDispose.add({dispose:()=>{this._computeCommentingRangeScheduler?.cancel(),this._computeCommentingRangeScheduler=null}}),this.localToDispose.add(this.editor.onDidChangeModelContent(async()=>{this.beginComputeCommentingRanges()})),this.localToDispose.add(this.commentService.onDidUpdateCommentThreads(async e=>{let t=this.editor&&this.editor.hasModel()&&this.editor.getModel().uri;if(!t||!this.commentService.isCommentingEnabled)return;this._computePromise&&await this._computePromise;let o=this._commentInfos.filter(u=>u.uniqueOwner===e.uniqueOwner);if(!o||!o.length)return;let n=e.added.filter(u=>u.resource&&u.resource===t.toString()),r=e.removed.filter(u=>u.resource&&u.resource===t.toString()),s=e.changed.filter(u=>u.resource&&u.resource===t.toString()),l=e.pending.filter(u=>u.uri.toString()===t.toString());r.forEach(u=>{let p=this._commentWidgets.filter(g=>g.uniqueOwner===e.uniqueOwner&&g.commentThread.threadId===u.threadId&&g.commentThread.threadId!=="");if(p.length){let g=p[0],f=this._commentWidgets.indexOf(g);this._commentWidgets.splice(f,1),g.dispose()}let h=this._commentInfos.filter(g=>g.uniqueOwner===e.uniqueOwner)[0].threads;for(let g=0;g<h.length;g++)h[g]===u&&(h.splice(g,1),g--)});for(let u of s){let p=this._commentWidgets.filter(h=>h.uniqueOwner===e.uniqueOwner&&h.commentThread.threadId===u.threadId);p.length&&(p[0].update(u),this.openCommentsView(u))}let c=this.editor?.getId();for(let u of n)await this.handleCommentAdded(c,e.uniqueOwner,u);for(let u of l)await this.resumePendingComment(t,u);this._commentThreadRangeDecorator.update(this.editor,o)})),this.beginComputeAndHandleEditorChange())}async resumePendingComment(e,t){let o=this._commentWidgets.filter(n=>n.uniqueOwner===t.uniqueOwner&&z.lift(n.commentThread.range)?.equalsRange(t.range));if(t.isReply&&o.length)this.commentService.removeContinueOnComment({uniqueOwner:t.uniqueOwner,uri:e,range:t.range,isReply:!0}),o[0].setPendingComment(t.comment);else if(o.length){this.commentService.removeContinueOnComment({uniqueOwner:t.uniqueOwner,uri:e,range:t.range,isReply:!1});let n=o[0].getPendingComments().newComment,r;!n||t.comment.body.includes(n.body)?r=t.comment:n.body.includes(t.comment.body)?r=n:r={body:`${n}
${t.comment.body}`,cursor:t.comment.cursor},o[0].setPendingComment(r)}else if(!t.isReply){if(!this.commentService.removeContinueOnComment({uniqueOwner:t.uniqueOwner,uri:e,range:t.range,isReply:!1}))return;this._inProcessContinueOnComments.has(t.uniqueOwner)||this._inProcessContinueOnComments.set(t.uniqueOwner,[]),this._inProcessContinueOnComments.get(t.uniqueOwner)?.push(t),await this.commentService.createCommentThreadTemplate(t.uniqueOwner,t.uri,t.range?z.lift(t.range):void 0)}}beginComputeAndHandleEditorChange(){this.beginCompute().then(()=>{if(!this._hasRespondedToEditorChange&&this._commentInfos.some(e=>e.commentingRanges.ranges.length>0||e.commentingRanges.fileComments))if(this._hasRespondedToEditorChange=!0,this.configurationService.getValue("accessibility.verbosity.comments")){let t=this.keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getAriaLabel();t?Or(d(8484,null,t)):Or(d(8485,null))}else Or(d(8483,null))})}async openCommentsView(e){if(e.comments&&e.comments.length>0&&a9e(e)){let t=this.configurationService.getValue(zz).openView;if(t==="file")return this.viewsService.openView(Eu);if((t==="firstFile"||t==="firstFileUnresolved"&&e.state===0)&&!this.viewsService.getViewWithId(Eu)?.hasRendered)return this.viewsService.openView(Eu)}}async displayCommentThread(e,t,o,n,r){let s=this.editor?.getModel();if(!s||!this.editor||this.isEditorInlineOriginal(this.editor))return;let l;t.range&&!n&&(l=this.commentService.removeContinueOnComment({uniqueOwner:e,uri:s.uri,range:t.range,isReply:!0}));let c=this.instantiationService.createInstance(cTe,this.editor,e,t,n??l?.comment,r);await c.display(t.range,o),this._commentWidgets.push(c),this.localToDispose.add(c.onDidChangeExpandedState(()=>this._updateCommentWidgetVisibleContext())),this.localToDispose.add(c.onDidClose(()=>this._updateCommentWidgetVisibleContext())),this.openCommentsView(t)}onEditorMouseDown(e){this.mouseDownInfo=(e.target.element?.className.indexOf("comment-range-glyph")??-1)>=0?Sto(e):null}onEditorMouseUp(e){let t=Ito(this.mouseDownInfo,e);if(this.mouseDownInfo=null,!this.editor||t===null||!e.target.element)return;let o=e.target.element.className.indexOf("comment-range-glyph")>=0,n=e.target.position.lineNumber,r,s;t!==n?t>n?s=new z(t,this.editor.getModel().getLineLength(t)+1,n,1):s=new z(t,1,n,this.editor.getModel().getLineLength(n)+1):o&&(s=this.editor.getSelection()),s&&s.startLineNumber<=n&&n<=s.endLineNumber?(r=s,this.editor.setSelection(new z(s.endLineNumber,1,s.endLineNumber,1))):o&&(r=new z(n,1,n,1)),r&&this.addOrToggleCommentAtLine(r,e)}getCommentsAtLine(e){return this._commentWidgets.filter(t=>t.getGlyphPosition()===(e?e.endLineNumber:0))}async addOrToggleCommentAtLine(e,t){if(this._addInProgress)this._emptyThreadsToAddQueue.push([e,t]);else{this._addInProgress=!0;let o=this.getCommentsAtLine(e);if(o.length){let n=o.every(r=>r.expanded);o.forEach(n?r=>r.collapse(!0):r=>r.expand(!0)),this.processNextThreadToAdd();return}else this.addCommentAtLine(e,t)}}processNextThreadToAdd(){this._addInProgress=!1;let e=this._emptyThreadsToAddQueue.shift();e&&this.addOrToggleCommentAtLine(e[0],e[1])}clipUserRangeToCommentRange(e,t){return e.startLineNumber<t.startLineNumber&&(e=new z(t.startLineNumber,t.startColumn,e.endLineNumber,e.endColumn)),e.endLineNumber>t.endLineNumber&&(e=new z(e.startLineNumber,e.startColumn,t.endLineNumber,t.endColumn)),e}addCommentAtLine(e,t){let o=this._commentingRangeDecorator.getMatchedCommentAction(e);if(!o.length||!this.editor?.hasModel())return this._addInProgress=!1,o.length||(e?this.notificationService.error(d(8481,null)):this.notificationService.error(d(8482,null))),Promise.resolve();if(o.length>1){if(t&&e)return this.contextMenuService.showContextMenu({getAnchor:()=>t.event,getActions:()=>this.getContextMenuActions(o,e),getActionsContext:()=>o.length?o[0]:void 0,onHide:()=>{this._addInProgress=!1}}),Promise.resolve();{let n=this.getCommentProvidersQuickPicks(o);return this.quickInputService.pick(n,{placeHolder:d(8486,null),matchOnDescription:!0}).then(r=>{if(!r)return;let s=o.filter(l=>l.action.ownerId===r.id);if(s.length){let{ownerId:l}=s[0].action,c=e&&s[0].range?this.clipUserRangeToCommentRange(e,s[0].range):e;this.addCommentAtLine2(c,l)}}).then(()=>{this._addInProgress=!1})}}else{let{ownerId:n}=o[0].action,r=e&&o[0].range?this.clipUserRangeToCommentRange(e,o[0].range):e;this.addCommentAtLine2(r,n)}return Promise.resolve()}getCommentProvidersQuickPicks(e){return e.map(o=>{let{ownerId:n,extensionId:r,label:s}=o.action;return{label:s??r??n,id:n}})}getContextMenuActions(e,t){let o=[];return e.forEach(n=>{let{ownerId:r,extensionId:s,label:l}=n.action;o.push(new st("addCommentThread",`${l||s}`,void 0,!0,()=>{let c=n.range?this.clipUserRangeToCommentRange(t,n.range):t;return this.addCommentAtLine2(c,r),Promise.resolve()}))}),o}addCommentAtLine2(e,t){this.editor&&(this.commentService.createCommentThreadTemplate(t,this.editor.getModel().uri,e,this.editor.getId()),this.processNextThreadToAdd())}getExistingCommentEditorOptions(e){let t=e.getOption(74),o=[],n=e.getRawOptions().extraEditorClassName;return n&&(o=n.split(" ")),{lineDecorationsWidth:t,extraEditorClassName:o}}getWithoutCommentsEditorOptions(e,t,o){let n=o,r=t.findIndex(l=>l==="inline-comment");r>=0&&t.splice(r,1);let s=e.getOptions();return s.get(52)&&s.get(126)!=="never"&&(n+=11),n-=24,{extraEditorClassName:t,lineDecorationsWidth:n}}getWithCommentsLineDecorationWidth(e,t){let o=t,n=e.getOptions();return n.get(52)&&n.get(126)!=="never"&&(o-=11),o+=24,this._commentingRangeAmountReserved=o,this._commentingRangeAmountReserved}getWithCommentsEditorOptions(e,t,o){return t.push("inline-comment"),{lineDecorationsWidth:this.getWithCommentsLineDecorationWidth(e,o),extraEditorClassName:t}}updateEditorLayoutOptions(e,t,o){e.updateOptions({extraEditorClassName:t.join(" "),lineDecorationsWidth:o})}ensureCommentingRangeReservedAmount(e){let t=this.getExistingCommentEditorOptions(e);t.lineDecorationsWidth!==this._commentingRangeAmountReserved&&e.updateOptions({lineDecorationsWidth:this.getWithCommentsLineDecorationWidth(e,t.lineDecorationsWidth)})}tryUpdateReservedSpace(e){if(!this.editor)return;let t=this._commentInfos.some(r=>!!(r.commentingRanges&&(Array.isArray(r.commentingRanges)?r.commentingRanges:r.commentingRanges.ranges).length)||r.threads.length>0);e=e??this.editor.getModel()?.uri;let o=e?this.commentService.resourceHasCommentingRanges(e):!1,n=t||o;if(n&&this.commentService.isCommentingEnabled)if(this._commentingRangeSpaceReserved)this.ensureCommentingRangeReservedAmount(this.editor);else{this._commentingRangeSpaceReserved=!0;let{lineDecorationsWidth:r,extraEditorClassName:s}=this.getExistingCommentEditorOptions(this.editor),l=this.getWithCommentsEditorOptions(this.editor,s,r);this.updateEditorLayoutOptions(this.editor,l.extraEditorClassName,l.lineDecorationsWidth)}else if((!n||!this.commentService.isCommentingEnabled)&&this._commentingRangeSpaceReserved){this._commentingRangeSpaceReserved=!1;let{lineDecorationsWidth:r,extraEditorClassName:s}=this.getExistingCommentEditorOptions(this.editor),l=this.getWithoutCommentsEditorOptions(this.editor,s,r);this.updateEditorLayoutOptions(this.editor,l.extraEditorClassName,l.lineDecorationsWidth)}}async setComments(e){if(!this.editor||!this.commentService.isCommentingEnabled)return;this._commentInfos=e,this.tryUpdateReservedSpace(),this.removeCommentWidgetsAndStoreCache();let t=!1;for(let o of this._commentInfos){!t&&(o.commentingRanges.ranges.length>0||o.commentingRanges.fileComments)&&(t=!0);let n=this._pendingNewCommentCache[o.uniqueOwner],r=this._pendingEditsCache[o.uniqueOwner];o.threads=o.threads.filter(s=>!s.isDisposed);for(let s of o.threads){let l;n&&(l=n[s.threadId]);let c;r&&(c=r[s.threadId]),await this.displayCommentThread(o.uniqueOwner,s,!1,l,c)}for(let s of o.pendingCommentThreads??[])this.resumePendingComment(this.editor.getModel().uri,s)}this._commentingRangeDecorator.update(this.editor,this._commentInfos),this._commentThreadRangeDecorator.update(this.editor,this._commentInfos),t?this._activeEditorHasCommentingRange.set(!0):this._activeEditorHasCommentingRange.set(!1)}collapseAndFocusRange(e){this._commentWidgets?.find(t=>t.commentThread.threadId===e)?.collapseAndFocusRange()}removeCommentWidgetsAndStoreCache(){this._commentWidgets&&this._commentWidgets.forEach(e=>{let t=e.getPendingComments(),o=t.newComment,n=this._pendingNewCommentCache[e.uniqueOwner],r;if(e.commentThread.comments&&e.commentThread.comments.length){let c=e.commentThread.comments[e.commentThread.comments.length-1];typeof c.body=="string"?r=c.body:r=c.body.value}o&&o.body!==r?(n||(this._pendingNewCommentCache[e.uniqueOwner]={}),this._pendingNewCommentCache[e.uniqueOwner][e.commentThread.threadId]=o):n&&delete n[e.commentThread.threadId];let s=t.edits,l=this._pendingEditsCache[e.uniqueOwner];Object.keys(s).length>0?(l||(this._pendingEditsCache[e.uniqueOwner]={}),this._pendingEditsCache[e.uniqueOwner][e.commentThread.threadId]=s):l&&delete l[e.commentThread.threadId],e.dispose()}),this._commentWidgets=[]}};RC=I([m(1,km),m(2,F),m(3,Kt),m(4,ze),m(5,Ge),m(6,Ft),m(7,B),m(8,X),m(9,ee),m(10,_e),m(11,Bi),m(12,Ne)],RC);var T9e={id:D.AccessibleView,group:"navigation",when:ud},_9e={id:D.CommandPalette,group:"",order:1},Thi=class extends K{constructor(){super({id:"editor.action.accessibleViewNext",precondition:x.and(ud,Mde),keybinding:{primary:606,weight:200},menu:[_9e,{...T9e,when:x.and(ud,Mde)}],icon:M.arrowDown,title:d(4999,null)})}run(i){i.get(Wd).next()}};W(Thi);var _hi=class extends K{constructor(){super({id:"editor.action.accessibleViewNextCodeBlock",precondition:x.and(Pde,x.or(x.equals(Kd.key,"panelChat"),x.equals(Kd.key,"inlineChat"),x.equals(Kd.key,"quickChat"))),keybinding:{primary:2572,mac:{primary:2572},weight:200},icon:M.arrowRight,menu:{...T9e,when:x.and(ud,Pde)},title:d(5000,null)})}run(i){i.get(Wd).navigateToCodeBlock("next")}};W(_hi);var Dhi=class extends K{constructor(){super({id:"editor.action.accessibleViewPreviousCodeBlock",precondition:x.and(Pde,x.or(x.equals(Kd.key,"panelChat"),x.equals(Kd.key,"inlineChat"),x.equals(Kd.key,"quickChat"))),keybinding:{primary:2571,mac:{primary:2571},weight:200},icon:M.arrowLeft,menu:{...T9e,when:x.and(ud,Pde)},title:d(5002,null)})}run(i){i.get(Wd).navigateToCodeBlock("previous")}};W(Dhi);var Lhi=class extends K{constructor(){super({id:"editor.action.accessibleViewPrevious",precondition:x.and(ud,Mde),keybinding:{primary:604,weight:200},icon:M.arrowUp,menu:[_9e,{...T9e,when:x.and(ud,Mde)}],title:d(5001,null)})}run(i){i.get(Wd).previous()}};W(Lhi);var Rhi=class extends K{constructor(){super({id:"editor.action.accessibleViewGoToSymbol",precondition:x.and(x.or(ud,LC),C9e),keybinding:{primary:3117,secondary:[3161],weight:210},icon:M.symbolMisc,menu:[_9e,{...T9e,when:x.and(x.or(ud,LC),C9e)}],title:d(4998,null)})}run(i){i.get(Wd).goToSymbol()}};W(Rhi);function yto(a){return a.register(),a}var Ade=yto(new SN({id:"editor.action.accessibilityHelp",precondition:void 0,kbOpts:{primary:571,weight:200,linux:{primary:1595,secondary:[571]},kbExpr:LC.toNegated()},menuOpts:[{menuId:D.CommandPalette,group:"",title:d(4991,null),order:1}]})),dTe=yto(new SN({id:"editor.action.accessibleView",precondition:void 0,kbOpts:{primary:572,weight:200,linux:{primary:1596,secondary:[572]}},menuOpts:[{menuId:D.CommandPalette,group:"",title:d(4995,null),order:1}]})),Mhi=class extends K{constructor(){super({id:"editor.action.accessibleViewDisableHint",precondition:x.and(x.or(ud,LC),w9e),keybinding:{primary:576,weight:200},icon:M.bellSlash,menu:[_9e,{id:D.AccessibleView,group:"navigation",when:x.and(x.or(ud,LC),w9e)}],title:d(4997,null)})}run(i){i.get(Wd).disableHint()}};W(Mhi);var Phi=class extends K{constructor(){super({id:"editor.action.accessibilityHelpConfigureKeybindings",precondition:x.and(LC,x9e),icon:M.recordKeys,keybinding:{primary:553,weight:200},menu:[{id:D.AccessibleView,group:"navigation",order:3,when:x9e}],title:d(4993,null)})}async run(i){await i.get(Wd).configureKeybindings(!0)}};W(Phi);var Ahi=class extends K{constructor(){super({id:"editor.action.accessibilityHelpConfigureAssignedKeybindings",precondition:x.and(LC,k9e),icon:M.recordKeys,keybinding:{primary:543,weight:200},menu:[{id:D.AccessibleView,group:"navigation",order:4,when:k9e}],title:d(4992,null)})}async run(i){await i.get(Wd).configureKeybindings(!1)}};W(Ahi);var Nhi=class extends K{constructor(){super({id:"editor.action.accessibilityHelpOpenHelpLink",precondition:x.and(LC),keybinding:{primary:550,weight:200},title:d(4994,null)})}run(i){i.get(Wd).openHelpLink()}};W(Nhi);var Ohi=class extends K{constructor(){super({id:"editor.action.accessibleViewAcceptInlineCompletion",precondition:x.and(ud,x.equals(Kd.key,"inlineCompletions")),keybinding:{primary:2138,mac:{primary:346},weight:200},icon:M.check,menu:[_9e,{id:D.AccessibleView,group:"navigation",order:0,when:x.and(ud,x.equals(Kd.key,"inlineCompletions"))}],title:d(4996,null)})}async run(i){let e=i.get(Kt),t=e.getActiveCodeEditor()||e.getFocusedCodeEditor();if(!t)return;let o=Rc.get(t)?.model.get(),n=o?.state.get();!o||!n||(await o.accept(t),o.stop(),t.focus())}};W(Ohi);var _Rt=new Q("commentsView.hasComments",!1),DRt=new Q("commentsView.someCommentsExpanded",!1),Fhi=new Q("commentsView.commentFocused",!1),nGo="commentsViewState";function rGo(a){let i=[];for(let e of a.resourceCommentThreads){let t=[];for(let o of e.commentThreads)a9e(o.thread)&&t.push({element:o});t.length>0&&i.push({element:e,children:t})}return i}var uTe=class extends iF{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){let S=new Bl(nGo,v),y=S.getMemento(1,1);super({...e,filterOptions:{placeholder:d(8513,null),ariaLabel:d(8512,null),history:y.filterHistory||[],text:y.filter||"",focusContextKey:p9e.key}},c,l,r,s,o,t,u,p,g);this.editorService=n;this.commentService=h;this.uriIdentityService=f;this.pathService=b;this.totalComments=0;this.currentHeight=0;this.currentWidth=0;this.cachedFilterStats=void 0;this.onDidChangeVisibility=this.onDidChangeBodyVisibility;this.hasCommentsContextKey=_Rt.bindTo(s),this.someCommentsExpandedContextKey=DRt.bindTo(s),this.commentsFocusedContextKey=Fhi.bindTo(s),this.stateMemento=S,this.viewState=y,this.filters=this._register(new mRt({showResolved:this.viewState.showResolved!==!1,showUnresolved:this.viewState.showUnresolved!==!1,sortBy:this.viewState.sortBy??"resourceAscending"},this.contextKeyService)),this.filter=new rRt(new LV(this.filterWidget.getFilterText(),this.filters.showResolved,this.filters.showUnresolved)),this._register(this.filters.onDidChange(w=>{(w.showResolved||w.showUnresolved)&&this.updateFilter(),w.sortBy&&this.refresh()})),this._register(this.filterWidget.onDidChangeFilterText(()=>this.updateFilter()))}get focusedCommentNode(){let e=this.tree?.getFocus();if(e?.length===1&&e[0]instanceof HE)return e[0]}get focusedCommentInfo(){if(this.focusedCommentNode)return this.getScreenReaderInfoForNode(this.focusedCommentNode)}focusNextNode(){if(!this.tree)return;let e=this.tree.getFocus()?.[0];if(!e)return;let t=this.tree.navigate(e).next();for(;t&&!(t instanceof HE);)t=this.tree.navigate(t).next();t&&this.tree.setFocus([t])}focusPreviousNode(){if(!this.tree)return;let e=this.tree.getFocus()?.[0];if(!e)return;let t=this.tree.navigate(e).previous();for(;t&&!(t instanceof HE);)t=this.tree.navigate(t).previous();t&&this.tree.setFocus([t])}saveState(){this.viewState.filter=this.filterWidget.getFilterText(),this.viewState.filterHistory=this.filterWidget.getHistory(),this.viewState.showResolved=this.filters.showResolved,this.viewState.showUnresolved=this.filters.showUnresolved,this.viewState.sortBy=this.filters.sortBy,this.stateMemento.saveMemento(),super.saveState()}render(){super.render(),this._register(zE({name:"commentsView",focusNotifiers:[this,this.filterWidget],focusNextWidget:()=>{this.filterWidget.hasFocus()&&this.focus()},focusPreviousWidget:()=>{this.filterWidget.hasFocus()||this.focusFilter()}}))}focusFilter(){this.filterWidget.focus()}clearFilterText(){this.filterWidget.setFilterText("")}getFilterStats(){return this.cachedFilterStats||(this.cachedFilterStats={total:this.totalComments,filtered:this.tree?.getVisibleItemCount()??0}),this.cachedFilterStats}updateFilter(){this.filter.options=new LV(this.filterWidget.getFilterText(),this.filters.showResolved,this.filters.showUnresolved),this.tree?.filterComments(),this.cachedFilterStats=void 0;let{total:e,filtered:t}=this.getFilterStats();this.filterWidget.updateBadge(e===t||e===0?void 0:d(8523,null,t,e)),this.filterWidget.checkMoreFilters(!this.filters.showResolved||!this.filters.showUnresolved)}renderBody(e){super.renderBody(e),e.classList.add("comments-panel");let t=R(e,_(".comments-panel-container"));this.treeContainer=R(t,_(".tree-container")),this.treeContainer.classList.add("file-icon-themable-tree","show-file-icons"),this.cachedFilterStats=void 0,this.createTree(),this.createMessageBox(t),this._register(this.commentService.onDidSetAllCommentThreads(this.onAllCommentsChanged,this)),this._register(this.commentService.onDidUpdateCommentThreads(this.onCommentsUpdated,this)),this._register(this.commentService.onDidDeleteDataProvider(this.onDataProviderDeleted,this)),this._register(this.onDidChangeBodyVisibility(o=>{o&&this.refresh()})),this.renderComments()}focus(){super.focus();let e=this.tree?.getHTMLElement();e&&sa(e)||(!this.commentService.commentsModel.hasCommentThreads()&&this.messageBoxContainer?this.messageBoxContainer.focus():this.tree&&this.tree.domFocus())}renderComments(){this.treeContainer.classList.toggle("hidden",!this.commentService.commentsModel.hasCommentThreads()),this.renderMessage(),this.tree?.setChildren(null,rGo(this.commentService.commentsModel))}collapseAll(){this.tree&&(this.tree.collapseAll(),this.tree.setSelection([]),this.tree.setFocus([]),this.tree.domFocus(),this.tree.focusFirst())}expandAll(){this.tree&&(this.tree.expandAll(),this.tree.setSelection([]),this.tree.setFocus([]),this.tree.domFocus(),this.tree.focusFirst())}get hasRendered(){return!!this.tree}layoutBodyContent(e=this.currentHeight,t=this.currentWidth){this.messageBoxContainer&&(this.messageBoxContainer.style.height=`${e}px`),this.tree?.layout(e,t),this.currentHeight=e,this.currentWidth=t}createMessageBox(e){this.messageBoxContainer=R(e,_(".message-box-container")),this.messageBoxContainer.setAttribute("tabIndex","0")}renderMessage(){this.messageBoxContainer.textContent=this.commentService.commentsModel.getMessage(),this.messageBoxContainer.classList.toggle("hidden",this.commentService.commentsModel.hasCommentThreads())}makeCommentLocationLabel(e,t){let o=Ye(e);return t?t.startLineNumber===t.endLineNumber?d(8516,null,t.startLineNumber,t.startColumn,o):d(8515,null,t.startLineNumber,t.endLineNumber,o):d(8514,null,o)}makeScreenReaderLabelInfo(e,t){let o=e.comment.userName,n=this.makeCommentLocationLabel(e.resource,e.range),r=this.getReplyCountAsString(e,t),s=typeof e.comment.body=="string"?e.comment.body:e.comment.body.value;return{userName:o,locationLabel:n,replyCountLabel:r,bodyLabel:s}}getScreenReaderInfoForNode(e,t){let o="";if(t&&this.configurationService.getValue("accessibility.verbosity.comments")){let u=this.keybindingService.lookupKeybinding(dTe.id)?.getAriaLabel();o=u?d(8510,null,u):d(8511,null)}let n=this.getRepliesAsString(e,t),r=this.editorService.findEditors(e.resource),s=this.editorService.activeEditorPane?.getControl(),l;e.range&&r?.length&&pn(s)&&(l=s.getModel()?.getValueInRange(e.range),l&&(l=`
Corresponding code:
`+l)),l||(l="");let c=this.makeScreenReaderLabelInfo(e,t);return e.threadRelevance===1?d(8519,null,c.userName,c.bodyLabel,c.locationLabel,c.replyCountLabel,l)+n+o:d(8518,null,c.userName,c.bodyLabel,c.locationLabel,c.replyCountLabel,l)+n+o}getRepliesAsString(e,t){return!e.replies.length||t?"":`
`+e.replies.map(o=>d(8521,null,o.comment.userName,typeof o.comment.body=="string"?o.comment.body:o.comment.body.value)).join(`
`)}getReplyCountAsString(e,t){return e.replies.length&&!t?d(8517,null,e.replies.length):""}createTree(){this.treeLabels=this._register(this.instantiationService.createInstance(Za,this)),this.tree=this._register(this.instantiationService.createInstance(qEe,this.treeLabels,this.treeContainer,{overrideStyles:this.getLocationBasedColors().listOverrideStyles,selectionNavigation:!0,filter:this.filter,sorter:{compare:(e,t)=>{if(e instanceof Kz||t instanceof Kz)return 0;if(this.filters.sortBy==="updatedAtDescending")return e.lastUpdatedAt>t.lastUpdatedAt?-1:1;if(this.filters.sortBy==="resourceAscending"){if(e instanceof mw&&t instanceof mw){let o=this.pathService.defaultUriScheme;return e.resource.scheme!==t.resource.scheme&&(e.resource.scheme===o||t.resource.scheme===o)?t.resource.scheme===o?1:-1:e.resource.toString()>t.resource.toString()?1:-1}else if(e instanceof HE&&t instanceof HE&&e.thread.range&&t.thread.range)return e.thread.range?.startLineNumber>t.thread.range?.startLineNumber?1:-1}return 0}},keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:e=>{}},accessibilityProvider:{getAriaLabel:e=>e instanceof Kz?d(8522,null):e instanceof mw?d(8520,null,Ye(e.resource),e.resource.fsPath):e instanceof HE?this.getScreenReaderInfoForNode(e,!0):"",getWidgetAriaLabel(){return d9e.value}}})),this._register(this.tree.onDidOpen(e=>{this.openFile(e.element,e.editorOptions.pinned,e.editorOptions.preserveFocus,e.sideBySide)})),this._register(this.tree.onDidChangeModel(()=>{this.updateSomeCommentsExpanded()})),this._register(this.tree.onDidChangeCollapseState(()=>{this.updateSomeCommentsExpanded()})),this._register(this.tree.onDidFocus(()=>this.commentsFocusedContextKey.set(!0))),this._register(this.tree.onDidBlur(()=>this.commentsFocusedContextKey.set(!1)))}openFile(e,t,o,n){if(!e||!(e instanceof mw||e instanceof HE))return;let r=e instanceof mw?e.commentThreads[0].thread:e.thread,s=e instanceof mw?e.commentThreads[0].comment:void 0;return KX(this.commentService,this.editorService,this.uriIdentityService,r,s,!1,t,o,n)}async refresh(){if(this.tree&&this.isVisible()&&(this.hasCommentsContextKey.set(this.commentService.commentsModel.hasCommentThreads()),this.cachedFilterStats=void 0,this.renderComments(),this.tree.getSelection().length===0&&this.commentService.commentsModel.hasCommentThreads())){let e=this.commentService.commentsModel.resourceCommentThreads[0].commentThreads[0];e&&(this.tree.setFocus([e]),this.tree.setSelection([e]))}}onAllCommentsChanged(e){this.cachedFilterStats=void 0,this.totalComments+=e.commentThreads.length;let t=0;for(let o of e.commentThreads)o.state===0&&t++;this.refresh()}onCommentsUpdated(e){this.cachedFilterStats=void 0,this.totalComments+=e.added.length,this.totalComments-=e.removed.length;let t=0;for(let o of this.commentService.commentsModel.resourceCommentThreads)for(let n of o.commentThreads)n.threadState===0&&t++;this.refresh()}onDataProviderDeleted(e){this.cachedFilterStats=void 0,this.totalComments=0,this.refresh()}updateSomeCommentsExpanded(){this.someCommentsExpandedContextKey.set(this.isSomeCommentsExpanded())}areAllCommentsExpanded(){if(!this.tree)return!1;let e=this.tree.navigate();for(;e.next();)if(this.tree.isCollapsed(e.current()))return!1;return!0}isSomeCommentsExpanded(){if(!this.tree)return!1;let e=this.tree.navigate();for(;e.next();)if(!this.tree.isCollapsed(e.current()))return!0;return!1}};uTe=I([m(1,F),m(2,Ri),m(3,ee),m(4,B),m(5,X),m(6,ze),m(7,_e),m(8,Qe),m(9,De),m(10,km),m(11,tt),m(12,dt),m(13,le),m(14,wn)],uTe);function wto(a,i,e){let t,o,n,r,s;if(i){for(r=i.offset,s=r+i.length,n=r;n>0&&!D9e(a,n-1);)n--;let w=s;for(;w<a.length&&!D9e(a,w);)w++;o=a.substring(n,w),t=sGo(o,e)}else o=a,t=0,n=0,r=0,s=a.length;let l=Vhi(e,a),c=!1,u=0,p;e.insertSpaces?p=Whi(" ",e.tabSize||4):p=" ";let h=$le(o,!1),g=!1;function f(){return l+Whi(p,t+u)}function v(){let w=h.scan();for(c=!1;w===15||w===14;)c=c||w===14,w=h.scan();return g=w===16||h.getTokenError()!==0,w}let b=[];function S(w,k,T){!g&&k<s&&T>r&&a.substring(k,T)!==w&&b.push({offset:k,length:T-k,content:w})}let y=v();if(y!==17){let w=h.getTokenOffset()+n,k=Whi(p,t);S(k,n,w)}for(;y!==17;){let w=h.getTokenOffset()+h.getTokenLength()+n,k=v(),T="";for(;!c&&(k===12||k===13);){let O=h.getTokenOffset()+n;S(" ",w,O),w=h.getTokenOffset()+h.getTokenLength()+n,T=k===12?f():"",k=v()}if(k===2)y!==1&&(u--,T=f());else if(k===4)y!==3&&(u--,T=f());else{switch(y){case 3:case 1:u++,T=f();break;case 5:case 12:T=f();break;case 13:c?T=f():T=" ";break;case 6:T=" ";break;case 10:if(k===6){T="";break}case 7:case 8:case 9:case 11:case 2:case 4:k===12||k===13?T=" ":k!==5&&k!==17&&(g=!0);break;case 16:g=!0;break}c&&(k===12||k===13)&&(T=f())}let N=h.getTokenOffset()+n;S(T,w,N),y=k}return b}function rF(a,i){let e=JSON.stringify(a,void 0,i.insertSpaces?i.tabSize||4:" ");return i.eol!==void 0?e.replace(/\r\n|\r|\n/g,i.eol):e}function Whi(a,i){let e="";for(let t=0;t<i;t++)e+=a;return e}function sGo(a,i){let e=0,t=0,o=i.tabSize||4;for(;e<a.length;){let n=a.charAt(e);if(n===" ")t++;else if(n===" ")t+=o;else break;e++}return Math.floor(t/o)}function Vhi(a,i){for(let e=0;e<i.length;e++){let t=i.charAt(e);if(t==="\r")return e+1<i.length&&i.charAt(e+1)===`
`?`\r
`:"\r";if(t===`
`)return`
`}return a&&a.eol||`
`}function D9e(a,i){return`\r
`.indexOf(a.charAt(i))!==-1}function Sb(a,i,e,t,o){let n=i.slice(),s=zL(a,[]),l,c;for(;n.length>0&&(c=n.pop(),l=lC(s,n),l===void 0&&e!==void 0);)typeof c=="string"?e={[c]:e}:e=[e];if(l)if(l.type==="object"&&typeof c=="string"&&Array.isArray(l.children)){let u=lC(l,[c]);if(u!==void 0)if(e===void 0){if(!u.parent)throw new Error("Malformed AST");let p=l.children.indexOf(u.parent),h,g=u.parent.offset+u.parent.length;if(p>0){let f=l.children[p-1];h=f.offset+f.length}else h=l.offset+1,l.children.length>1&&(g=l.children[1].offset);return GX(a,{offset:h,length:g-h,content:""},t)}else return GX(a,{offset:u.offset,length:u.length,content:JSON.stringify(e)},t);else{if(e===void 0)return[];let p=`${JSON.stringify(c)}: ${JSON.stringify(e)}`,h=o?o(l.children.map(f=>f.children[0].value)):l.children.length,g;if(h>0){let f=l.children[h-1];g={offset:f.offset+f.length,length:0,content:","+p}}else l.children.length===0?g={offset:l.offset+1,length:0,content:p}:g={offset:l.offset+1,length:0,content:p+","};return GX(a,g,t)}}else if(l.type==="array"&&typeof c=="number"&&Array.isArray(l.children))if(e!==void 0){let u=`${JSON.stringify(e)}`,p;if(l.children.length===0||c===0)p={offset:l.offset+1,length:0,content:l.children.length===0?u:u+","};else{let h=c===-1||c>l.children.length?l.children.length:c,g=l.children[h-1];p={offset:g.offset+g.length,length:0,content:","+u}}return GX(a,p,t)}else{let u=c,p=l.children[u],h;if(l.children.length===1)h={offset:l.offset+1,length:l.length-2,content:""};else if(l.children.length-1===u){let g=l.children[u-1],f=g.offset+g.length,v=l.offset+l.length;h={offset:f,length:v-2-f,content:""}}else h={offset:p.offset,length:l.children[u+1].offset-p.offset,content:""};return GX(a,h,t)}else throw new Error(`Can not add ${typeof c!="number"?"index":"property"} to parent of type ${l.type}`);else return e===void 0?[]:GX(a,{offset:s?s.offset:0,length:s?s.length:0,content:JSON.stringify(e)},t)}function GX(a,i,e){let t=Bhi(a,i),o=i.offset,n=i.offset+i.content.length;if(i.length===0||i.content.length===0){for(;o>0&&!D9e(t,o-1);)o--;for(;n<t.length&&!D9e(t,n);)n++}let r=wto(t,{offset:o,length:n-o},e);for(let l=r.length-1;l>=0;l--){let c=r[l];t=Bhi(t,c),o=Math.min(o,c.offset),n=Math.max(n,c.offset+c.length),n+=c.content.length-c.length}let s=a.length-(t.length-n)-o;return[{offset:o,length:s,content:t.substring(o,n)}]}function Bhi(a,i){return a.substring(0,i.offset)+i.content+a.substring(i.offset+i.length)}function Nde(a,i){let e=i.slice(0).sort((o,n)=>{let r=o.offset-n.offset;return r===0?o.length-n.length:r}),t=a.length;for(let o=e.length-1;o>=0;o--){let n=e[o];if(n.offset+n.length<=t)a=Bhi(a,n);else throw new Error("Overlapping edit");t=n.offset}return a}var Ff=ae("workspacesService");function L9e(a){return a.hasOwnProperty("workspace")}function Ode(a){return a.hasOwnProperty("folderUri")}var LRt=class extends C{constructor(e){super();this.channelName=e;this._onDidReceiveData=this._register(new E);this.onDidReceiveData=this._onDidReceiveData.event;if("BroadcastChannel"in It)try{this.broadcastChannel=new BroadcastChannel(e);let t=o=>{this._onDidReceiveData.fire(o.data)};this.broadcastChannel.addEventListener("message",t),this._register(Z(()=>{this.broadcastChannel&&(this.broadcastChannel.removeEventListener("message",t),this.broadcastChannel.close())}))}catch(t){console.warn("Error while creating broadcast channel. Falling back to localStorage.",Cn(t))}this.broadcastChannel||(this.channelName=`BroadcastDataChannel.${e}`,this.createBroadcastChannel())}createBroadcastChannel(){let e=t=>{t.key===this.channelName&&t.newValue&&this._onDidReceiveData.fire(JSON.parse(t.newValue))};It.addEventListener("storage",e),this._register(Z(()=>It.removeEventListener("storage",e)))}postData(e){this.broadcastChannel?this.broadcastChannel.postMessage(e):(localStorage.removeItem(this.channelName),localStorage.setItem(this.channelName,JSON.stringify(e)))}};var Wf=class{constructor(i){this.identifier=i}},rI=class{constructor(i){this.identifier=i}};async function RRt(a){let i=[],e=Zn.uriList.toLowerCase();if(a.has(e))try{let t=await a.get(e)?.asString(),o=JSON.stringify(Uy.parse(t??""));i.push(...SJt(o))}catch{}return i}var sF=class{constructor(i,e,t,o,n,r,s,l){this.options=i;this.fileService=e;this.workspacesService=t;this.editorService=o;this.workspaceEditingService=n;this.hostService=r;this.contextService=s;this.instantiationService=l}async handleDrop(i,e,t,o,n){let r=await this.instantiationService.invokeFunction(u=>TIe(u,i));if(!r.length)return;await this.hostService.focus(e);let s=oe.as(mW.DragAndDropContribution);for(let{resource:u}of r)if(u&&await this.instantiationService.invokeFunction(h=>s.handleResourceDrop(u,h)))return;if(this.options.allowWorkspaceOpen){let u=si(r.filter(p=>p.allowWorkspaceOpen&&p.resource?.scheme===Y.file).map(p=>p.resource));if(u.length>0&&await this.handleWorkspaceDrop(u))return}let l=si(r.filter(u=>u.isExternal&&u.resource?.scheme===Y.file).map(u=>u.resource));l.length&&this.workspacesService.addRecentlyOpened(l.map(u=>({fileUri:u})));let c=t?.();await this.editorService.openEditors(r.map(u=>({...u,resource:u.resource,options:{...u.options,...n,pinned:!0}})),c,{validateTrust:!0}),o?.(c)}async handleWorkspaceDrop(i){let e=[],t=[];return await Promise.all(i.map(async o=>{if(o7(o)){e.push({workspaceUri:o});return}try{let n=await this.fileService.stat(o);n.isDirectory&&(e.push({folderUri:n.resource}),t.push({uri:n.resource}))}catch{}})),e.length===0?!1:(e.length>t.length||t.length===1?await this.hostService.openWindow(e):xx(this.contextService.getWorkspace())?await this.workspaceEditingService.addFolders(t):await this.workspaceEditingService.createAndEnterWorkspace(t),!0)}};sF=I([m(1,be),m(2,Ff),m(3,ee),m(4,Of),m(5,oi),m(6,Pe),m(7,F)],sF);function Ig(a,i,e,t){if(i.length===0||!e.dataTransfer)return;let o=a.get(Ho),n=a.get(ee),r=a.get(be),s=a.get(ot),l=si(i.map(f=>A.isUri(f)?{resource:f}:C8e(f)?A.isUri(f.editor.resource)?{resource:f.editor.resource}:void 0:{resource:f.selection?fL(f.resource,f.selection):f.resource,isDirectory:f.isDirectory,selection:f.selection})),c=l.filter(({resource:f})=>r.hasProvider(f));if(!t?.disableStandardTransfer){let f=ri?`\r
`:`
`;e.dataTransfer.setData(Aa.TEXT,c.map(({resource:b})=>s.getUriLabel(b,{noPrefix:!0})).join(f));let v=c.find(({isDirectory:b})=>!b);if(v){let b=gn.uriToFileUri(v.resource);b.scheme===Y.file&&e.dataTransfer.setData(Aa.DOWNLOAD_URL,[Zn.binary,Ye(v.resource),b.toString()].join(":"))}}let u=c.filter(({isDirectory:f})=>!f);u.length&&e.dataTransfer.setData(Aa.RESOURCES,JSON.stringify(u.map(({resource:f})=>f.toString())));let p=oe.as(mW.DragAndDropContribution).getAll();for(let f of p)f.setData(l,e);let h=[];for(let f of i){let v;if(C8e(f)){let b=f.editor.toUntyped({preserveViewState:f.groupId});b&&(v={...b,resource:no.getCanonicalUri(b)})}else if(A.isUri(f)){let{selection:b,uri:S}=EIe(f);v={resource:S,options:b?{selection:b}:void 0}}else f.isDirectory||(v={resource:f.resource,options:{selection:f.selection}});if(v){{let b=v.resource;if(b){let S=o.files.get(b);S&&(typeof v.languageId!="string"&&(v.languageId=S.getLanguageId()),typeof v.encoding!="string"&&(v.encoding=S.getEncoding()),typeof v.contents!="string"&&S.isDirty()&&!S.textEditorModel.isTooLargeForHeapOperation()&&(v.contents=S.textEditorModel.getValue())),v.options?.viewState||(v.options={...v.options,viewState:(()=>{for(let y of n.visibleEditorPanes)if(Xe(y.input.resource,b)){let w=y.getViewState();if(w)return w}})()})}}h.push(v)}}h.length&&e.dataTransfer.setData(Ll.EDITORS,yIe(h));let g=c.filter(({isDirectory:f})=>f).map(({resource:f})=>f);if(h.length||g.length){let f=[...g];for(let v of h)v.resource?f.push(v.options?.selection?fL(v.resource,v.options.selection):v.resource):db(v)?v.modified.resource&&f.push(v.modified.resource):C_(v)?v.primary.resource&&f.push(v.primary.resource):dC(v)&&f.push(v.result.resource);t?.disableStandardTransfer||e.dataTransfer.setData(Zn.uriList,Uy.create(f.slice(0,1))),e.dataTransfer.setData(Aa.INTERNAL_URI_LIST,Uy.create(f))}}var Hhi=class{constructor(i,e){this.type=i;this.id=e}update(i){}getData(){return{type:this.type,id:this.id}}},Fde=class{constructor(i){this.compositeId=i}get id(){return this.compositeId}},Wde=class{constructor(i){this.viewId=i}get id(){return this.viewId}},KE=class a extends C{constructor(){super();this.transferData=VI.getInstance();this.onDragStart=this._register(new E);this.onDragEnd=this._register(new E);this._register(this.onDragEnd.event(e=>{let t=e.dragAndDropData.getData().id,o=e.dragAndDropData.getData().type;this.readDragData(o)?.getData().id===t&&this.transferData.clearData(o==="view"?Wde.prototype:Fde.prototype)}))}static get INSTANCE(){return a.instance||(a.instance=new a,Mp(a.instance)),a.instance}readDragData(e){if(this.transferData.hasData(e==="view"?Wde.prototype:Fde.prototype)){let t=this.transferData.getData(e==="view"?Wde.prototype:Fde.prototype);if(t?.[0])return new Hhi(e,t[0].id)}}writeDragData(e,t){this.transferData.setData([t==="view"?new Wde(e):new Fde(e)],t==="view"?Wde.prototype:Fde.prototype)}registerTarget(e,t){let o=new P;return o.add(new Om(e,{onDragEnter:n=>{if(n.preventDefault(),t.onDragEnter){let r=this.readDragData("composite")||this.readDragData("view");r&&t.onDragEnter({eventData:n,dragAndDropData:r})}},onDragLeave:n=>{let r=this.readDragData("composite")||this.readDragData("view");t.onDragLeave&&r&&t.onDragLeave({eventData:n,dragAndDropData:r})},onDrop:n=>{if(t.onDrop){let r=this.readDragData("composite")||this.readDragData("view");if(!r)return;t.onDrop({eventData:n,dragAndDropData:r}),this.onDragEnd.fire({eventData:n,dragAndDropData:r})}},onDragOver:n=>{if(n.preventDefault(),t.onDragOver){let r=this.readDragData("composite")||this.readDragData("view");if(!r)return;t.onDragOver({eventData:n,dragAndDropData:r})}}})),t.onDragStart&&this.onDragStart.event(n=>{t.onDragStart(n)},this,o),t.onDragEnd&&this.onDragEnd.event(n=>{t.onDragEnd(n)},this,o),this._register(o)}registerDraggable(e,t,o){e.draggable=!0;let n=new P;return n.add(new Om(e,{onDragStart:r=>{let{id:s,type:l}=t();this.writeDragData(s,l),r.dataTransfer?.setDragImage(e,0,0),this.onDragStart.fire({eventData:r,dragAndDropData:this.readDragData(l)})},onDragEnd:r=>{let{type:s}=t(),l=this.readDragData(s);l&&this.onDragEnd.fire({eventData:r,dragAndDropData:l})},onDragEnter:r=>{if(o.onDragEnter){let s=this.readDragData("composite")||this.readDragData("view");if(!s)return;s&&o.onDragEnter({eventData:r,dragAndDropData:s})}},onDragLeave:r=>{let s=this.readDragData("composite")||this.readDragData("view");s&&o.onDragLeave?.({eventData:r,dragAndDropData:s})},onDrop:r=>{if(o.onDrop){let s=this.readDragData("composite")||this.readDragData("view");if(!s)return;o.onDrop({eventData:r,dragAndDropData:s}),this.onDragEnd.fire({eventData:r,dragAndDropData:s})}},onDragOver:r=>{if(o.onDragOver){let s=this.readDragData("composite")||this.readDragData("view");if(!s)return;o.onDragOver({eventData:r,dragAndDropData:s})}}})),o.onDragStart&&this.onDragStart.event(r=>{o.onDragStart(r)},this,n),o.onDragEnd&&this.onDragEnd.event(r=>{o.onDragEnd(r)},this,n),this._register(n)}};function E5(a,i,e){a&&(a.dropEffect=e?i:"none")}var k5=class{constructor(i,e){this.toResource=i;this.instantiationService=e}getDragURI(i){let e=this.toResource(i);return e?e.toString():null}getDragLabel(i){let e=si(i.map(this.toResource));return e.length===1?Ye(e[0]):e.length>1?String(e.length):void 0}onDragStart(i,e){let t=[],o=i.elements;for(let n of o){let r=this.toResource(n);r&&t.push(r)}this.onWillDragElements(o,e),t.length&&this.instantiationService.invokeFunction(n=>Ig(n,t,e))}onWillDragElements(i,e){}onDragOver(i,e,t,o,n){return!1}drop(i,e,t,o,n){}dispose(){}};k5=I([m(1,F)],k5);var Uhi=class a extends C{constructor(){super();this.broadcaster=this._register(new LRt(a.CHANNEL_NAME));this.draggedOver=!1;this.registerListeners()}static{this.CHANNEL_NAME="monaco-workbench-global-dragged-over"}registerListeners(){this._register(H.runAndSubscribe(Fg,({window:e,disposables:t})=>{t.add(j(e,re.DRAG_OVER,()=>this.markDraggedOver(!1),!0)),t.add(j(e,re.DRAG_LEAVE,()=>this.clearDraggedOver(!1),!0))},{window:It,disposables:this._store})),this._register(this.broadcaster.onDidReceiveData(e=>{e===!0?this.markDraggedOver(!0):this.clearDraggedOver(!0)}))}get isDraggedOver(){return this.draggedOver}markDraggedOver(e){this.draggedOver!==!0&&(this.draggedOver=!0,e||this.broadcaster.postData(!0))}clearDraggedOver(e){this.draggedOver!==!1&&(this.draggedOver=!1,e||this.broadcaster.postData(!1))}},lGo=new Uhi;function MRt(){return lGo.isDraggedOver}var T5=new D("Views");fe.appendMenuItem(D.ViewContainerTitle,{submenu:T5,title:d(4259,null),order:1});var pTe=class a extends Jd{constructor(e,t,o,n,r){super(r);this.paneElement=e;this.orientation=t;this.bounds=o;this.location=n;this.cleanupOverlayScheduler=this._register(new Dt(()=>this.dispose(),300)),this.create()}static{this.OVERLAY_ID="monaco-pane-drop-overlay"}get currentDropOperation(){return this._currentDropOperation}get disposed(){return!!this._disposed}create(){this.container=_("div",{id:a.OVERLAY_ID}),this.container.style.top="0px",this.paneElement.appendChild(this.container),this.paneElement.classList.add("dragged-over"),this._register(Z(()=>{this.container.remove(),this.paneElement.classList.remove("dragged-over")})),this.overlay=_(".pane-overlay-indicator"),this.container.appendChild(this.overlay),this.registerListeners(),this.updateStyles()}updateStyles(){this.overlay.style.backgroundColor=this.getColor(this.location===1?v8e:Tj)||"";let e=this.getColor(qs);this.overlay.style.outlineColor=e||"",this.overlay.style.outlineOffset=e?"-2px":"",this.overlay.style.outlineStyle=e?"dashed":"",this.overlay.style.outlineWidth=e?"2px":"",this.overlay.style.borderColor=e||"",this.overlay.style.borderStyle="solid",this.overlay.style.borderWidth="0px"}registerListeners(){this._register(new Om(this.container,{onDragOver:e=>{this.positionOverlay(e.offsetX,e.offsetY),this.cleanupOverlayScheduler.isScheduled()&&this.cleanupOverlayScheduler.cancel()},onDragLeave:e=>this.dispose(),onDragEnd:e=>this.dispose(),onDrop:e=>{this.dispose()}})),this._register(j(this.container,re.MOUSE_OVER,()=>{this.cleanupOverlayScheduler.isScheduled()||this.cleanupOverlayScheduler.schedule()}))}positionOverlay(e,t){let o=this.paneElement.clientWidth,n=this.paneElement.clientHeight,r=o/2,s=n/2,l;switch(this.orientation===0?t<s?l=0:t>=s&&(l=1):this.orientation===1&&(e<r?l=2:e>=r&&(l=3)),l){case 0:this.doPositionOverlay({top:"0",left:"0",width:"100%",height:"50%"});break;case 1:this.doPositionOverlay({bottom:"0",left:"0",width:"100%",height:"50%"});break;case 2:this.doPositionOverlay({top:"0",left:"0",width:"50%",height:"100%"});break;case 3:this.doPositionOverlay({top:"0",right:"0",width:"50%",height:"100%"});break;default:{let c="0",u="0",p="100%",h="100%";if(this.bounds){let g=this.container.getBoundingClientRect();c=`${this.bounds.top-g.top}px`,u=`${this.bounds.left-g.left}px`,h=`${this.bounds.bottom-this.bounds.top}px`,p=`${this.bounds.right-this.bounds.left}px`}this.doPositionOverlay({top:c,left:u,width:p,height:h})}}this.orientation===0&&n<=25||this.orientation===1&&o<=25?this.doUpdateOverlayBorder(l):this.doUpdateOverlayBorder(void 0),this.overlay.style.opacity="1",setTimeout(()=>this.overlay.classList.add("overlay-move-transition"),0),this._currentDropOperation=l}doUpdateOverlayBorder(e){this.overlay.style.borderTopWidth=e===0?"2px":"0px",this.overlay.style.borderLeftWidth=e===2?"2px":"0px",this.overlay.style.borderBottomWidth=e===1?"2px":"0px",this.overlay.style.borderRightWidth=e===3?"2px":"0px"}doPositionOverlay(e){this.container.style.height="100%",this.overlay.style.top=e.top||"",this.overlay.style.left=e.left||"",this.overlay.style.bottom=e.bottom||"",this.overlay.style.right=e.right||"",this.overlay.style.width=e.width,this.overlay.style.height=e.height}contains(e){return e===this.container||e===this.overlay}dispose(){super.dispose(),this._disposed=!0}},Ha=class extends Xj{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(e,u,p);this.options=t;this.instantiationService=o;this.configurationService=n;this.layoutService=r;this.contextMenuService=s;this.telemetryService=l;this.extensionService=c;this.storageService=p;this.contextService=h;this.viewDescriptorService=g;this.logService=f;this.paneItems=[];this.visible=!1;this.areExtensionsReady=!1;this.didLayout=!1;this._onTitleAreaUpdate=this._register(new E);this.onTitleAreaUpdate=this._onTitleAreaUpdate.event;this._onDidChangeVisibility=this._register(new E);this.onDidChangeVisibility=this._onDidChangeVisibility.event;this._onDidAddViews=this._register(new E);this.onDidAddViews=this._onDidAddViews.event;this._onDidRemoveViews=this._register(new E);this.onDidRemoveViews=this._onDidRemoveViews.event;this._onDidChangeViewVisibility=this._register(new E);this.onDidChangeViewVisibility=this._onDidChangeViewVisibility.event;this._onDidFocusView=this._register(new E);this.onDidFocusView=this._onDidFocusView.event;this._onDidBlurView=this._register(new E);this.onDidBlurView=this._onDidBlurView.event;let v=this.viewDescriptorService.getViewContainerById(e);if(!v)throw new Error("Could not find container");this.viewContainer=v,this.visibleViewsStorageId=`${e}.numberOfVisibleViews`,this.visibleViewsCountFromCache=this.storageService.getNumber(this.visibleViewsStorageId,1,void 0),this.viewContainerModel=this.viewDescriptorService.getViewContainerModel(v)}get onDidSashChange(){return Oi(this.paneview).onDidSashChange}get panes(){return this.paneItems.map(e=>e.pane)}get views(){return this.panes}get length(){return this.paneItems.length}get menuActions(){return this._menuActions}create(e){let t=this.options;t.orientation=this.orientation,this.paneview=this._register(new aRt(e,this.options)),this._boundarySashes&&this.paneview.setBoundarySashes(this._boundarySashes),this._register(this.paneview.onDidDrop(({from:c,to:u})=>this.movePane(c,u))),this._register(this.paneview.onDidScroll(c=>this.onDidScrollPane())),this._register(this.paneview.onDidSashReset(c=>this.onDidSashReset(c))),this._register(j(e,re.CONTEXT_MENU,c=>this.showContextMenu(new yn(Me(e),c)))),this._register(ws.addTarget(e)),this._register(j(e,Gn.Contextmenu,c=>this.showContextMenu(new yn(Me(e),c)))),this._menuActions=this._register(this.instantiationService.createInstance(YEe,this.paneview.element,this.viewContainer)),this._register(this._menuActions.onDidChange(()=>this.updateTitleArea()));let o,n=()=>{let c=e.getBoundingClientRect(),u=this.panes[this.panes.length-1].element.getBoundingClientRect(),p=this.orientation===0?u.bottom:c.top,h=this.orientation===1?u.right:c.left;return{top:p,bottom:c.bottom,left:h,right:c.right}},r=(c,u)=>u.x>=c.left&&u.x<=c.right&&u.y>=c.top&&u.y<=c.bottom,s;this.viewDescriptorService.canMoveViews()&&this._register(KE.INSTANCE.registerTarget(e,{onDragEnter:c=>{if(s=n(),o?.disposed&&(o=void 0),!o&&r(s,c.eventData)){let u=c.dragAndDropData.getData();if(u.type==="view"){let p=this.viewDescriptorService.getViewContainerByViewId(u.id),h=this.viewDescriptorService.getViewDescriptorById(u.id);if(p!==this.viewContainer&&(!h||!h.canMoveView||this.viewContainer.rejectAddedViews))return;o=new pTe(e,void 0,s,this.viewDescriptorService.getViewContainerLocation(this.viewContainer),this.themeService)}if(u.type==="composite"&&u.id!==this.viewContainer.id){let p=this.viewDescriptorService.getViewContainerById(u.id),h=this.viewDescriptorService.getViewContainerModel(p).allViewDescriptors;!h.some(g=>!g.canMoveView)&&h.length>0&&(o=new pTe(e,void 0,s,this.viewDescriptorService.getViewContainerLocation(this.viewContainer),this.themeService))}}},onDragOver:c=>{o?.disposed&&(o=void 0),o&&!r(s,c.eventData)&&(o.dispose(),o=void 0),r(s,c.eventData)&&E5(c.eventData.dataTransfer,"move",o!==void 0)},onDragLeave:c=>{o?.dispose(),o=void 0},onDrop:c=>{if(o){let u=c.dragAndDropData.getData(),p=[];if(u.type==="composite"&&u.id!==this.viewContainer.id){let g=this.viewDescriptorService.getViewContainerById(u.id),f=this.viewDescriptorService.getViewContainerModel(g).allViewDescriptors;f.some(v=>!v.canMoveView)||p.push(...f)}else if(u.type==="view"){let g=this.viewDescriptorService.getViewContainerByViewId(u.id),f=this.viewDescriptorService.getViewDescriptorById(u.id);g!==this.viewContainer&&f?.canMoveView&&this.viewDescriptorService.moveViewsToContainer([f],this.viewContainer,void 0,"dnd")}let h=this.panes.length;if(p.length>0&&this.viewDescriptorService.moveViewsToContainer(p,this.viewContainer,void 0,"dnd"),h>0)for(let g of p){let f=this.panes.find(v=>v.id===g.id);f&&this.movePane(f,this.panes[this.panes.length-1])}}o?.dispose(),o=void 0}})),this._register(this.onDidSashChange(()=>this.saveViewSizes())),this._register(this.viewContainerModel.onDidAddVisibleViewDescriptors(c=>this.onDidAddViewDescriptors(c))),this._register(this.viewContainerModel.onDidRemoveVisibleViewDescriptors(c=>this.onDidRemoveViewDescriptors(c)));let l=this.viewContainerModel.visibleViewDescriptors.map((c,u)=>{let p=this.viewContainerModel.getSize(c.id),h=this.viewContainerModel.isCollapsed(c.id);return{viewDescriptor:c,index:u,size:p,collapsed:h}});l.length&&this.onDidAddViewDescriptors(l),this.extensionService.whenInstalledExtensionsRegistered().then(()=>{this.areExtensionsReady=!0,this.panes.length&&(this.updateTitleArea(),this.updateViewHeaders()),this._register(this.configurationService.onDidChangeConfiguration(c=>{c.affectsConfiguration("workbench.activityBar.location")&&this.updateViewHeaders()}))}),this._register(this.viewContainerModel.onDidChangeActiveViewDescriptors(()=>this._onTitleAreaUpdate.fire()))}getTitle(){let e=this.viewContainerModel.title;if(this.isViewMergedWithContainer()){let t=this.paneItems[0].pane.singleViewPaneContainerTitle;if(t)return t;let o=this.paneItems[0].pane.title;return e===o?o:o?`${e}: ${o}`:e}return e}showContextMenu(e){for(let t of this.paneItems)if(gs(e.target,t.pane.element))return;e.stopPropagation(),e.preventDefault(),this.contextMenuService.showContextMenu({getAnchor:()=>e,getActions:()=>this.menuActions?.getContextMenuActions()??[]})}getActionsContext(){if(this.isViewMergedWithContainer())return this.panes[0].getActionsContext()}getActionViewItem(e,t){return this.isViewMergedWithContainer()?this.paneItems[0].pane.createActionViewItem(e,t):Ca(this.instantiationService,e,t)}focus(){let e;if(this.lastFocusedPane)e=this.lastFocusedPane;else if(this.paneItems.length>0){for(let{pane:t}of this.paneItems)if(t.isExpanded()){e=t;break}}e&&e.focus()}get orientation(){switch(this.viewDescriptorService.getViewContainerLocation(this.viewContainer)){case 0:case 2:return 0;case 1:return fV(this.layoutService.getPanelPosition())?1:0}return 0}layout(e){this.paneview&&(this.paneview.orientation!==this.orientation&&this.paneview.flipOrientation(e.height,e.width),this.paneview.layout(e.height,e.width)),this.dimension=e,this.didLayout?this.saveViewSizes():(this.didLayout=!0,this.restoreViewSizes())}setBoundarySashes(e){this._boundarySashes=e,this.paneview?.setBoundarySashes(e)}getOptimalWidth(){return Math.max(...this.panes.map(o=>o.getOptimalWidth()||0))+16}addPanes(e){let t=this.isViewMergedWithContainer();for(let{pane:o,size:n,index:r,disposable:s}of e)this.addPane(o,n,s,r);this.updateViewHeaders(),this.isViewMergedWithContainer()!==t&&this.updateTitleArea(),this._onDidAddViews.fire(e.map(({pane:o})=>o))}setVisible(e){this.visible!==!!e&&(this.visible=e,this._onDidChangeVisibility.fire(e)),this.panes.filter(t=>t.isVisible()!==e).map(t=>t.setVisible(e))}isVisible(){return this.visible}updateTitleArea(){this._onTitleAreaUpdate.fire()}createView(e,t){return this.instantiationService.createInstance(e.ctorDescriptor.ctor,...e.ctorDescriptor.staticArguments||[],t)}getView(e){return this.panes.filter(t=>t.id===e)[0]}saveViewSizes(){this.didLayout&&this.viewContainerModel.setSizes(this.panes.map(e=>({id:e.id,size:this.getPaneSize(e)})))}restoreViewSizes(){if(this.didLayout){let e;for(let t=0;t<this.viewContainerModel.visibleViewDescriptors.length;t++){let o=this.panes[t],n=this.viewContainerModel.visibleViewDescriptors[t],r=this.viewContainerModel.getSize(n.id);typeof r=="number"?this.resizePane(o,r):(e=e||this.computeInitialSizes(),this.resizePane(o,e.get(o.id)||200))}}}computeInitialSizes(){let e=new Map;if(this.dimension){let t=this.viewContainerModel.visibleViewDescriptors.reduce((o,{weight:n})=>o+(n||20),0);for(let o of this.viewContainerModel.visibleViewDescriptors)this.orientation===0?e.set(o.id,this.dimension.height*(o.weight||20)/t):e.set(o.id,this.dimension.width*(o.weight||20)/t)}return e}saveState(){this.panes.forEach(e=>e.saveState()),this.storageService.store(this.visibleViewsStorageId,this.length,1,1)}onContextMenu(e,t){e.stopPropagation(),e.preventDefault();let o=t.menuActions.getContextMenuActions();this.contextMenuService.showContextMenu({getAnchor:()=>e,getActions:()=>o})}openView(e,t){let o=this.getView(e);return o||this.toggleViewVisibility(e),o=this.getView(e),o&&(o.setExpanded(!0),t&&o.focus()),o}onDidAddViewDescriptors(e){let t=[];for(let{viewDescriptor:n,collapsed:r,index:s,size:l}of e){let c=this.createView(n,{id:n.id,title:n.name.value,fromExtensionId:n.extensionId,expanded:!r,singleViewPaneContainerTitle:n.singleViewPaneContainerTitle});try{c.render()}catch(u){this.logService.error(`Fail to render view ${n.id}`,u);continue}if(c.draggableElement){let u=j(c.draggableElement,"contextmenu",h=>{h.stopPropagation(),h.preventDefault(),this.onContextMenu(new yn(Me(c.draggableElement),h),c)}),p=H.latch(H.map(c.onDidChange,()=>!c.isExpanded()))(h=>{this.viewContainerModel.setCollapsed(n.id,h)});t.push({pane:c,size:l||c.minimumSize,index:s,disposable:hn(u,p)})}}this.addPanes(t),this.restoreViewSizes();let o=[];for(let{pane:n}of t)n.setVisible(this.isVisible()),o.push(n);return o}onDidRemoveViewDescriptors(e){e=e.sort((o,n)=>n.index-o.index);let t=[];for(let{index:o}of e)this.paneItems[o]&&t.push(this.paneItems[o].pane);if(t.length){this.removePanes(t);for(let o of t)o.setVisible(!1)}}toggleViewVisibility(e){if(this.viewContainerModel.activeViewDescriptors.some(t=>t.id===e)){let t=!this.viewContainerModel.isVisible(e);this.viewContainerModel.setVisible(e,t)}}addPane(e,t,o,n=this.paneItems.length-1){let r=e.onDidFocus(()=>{this._onDidFocusView.fire(e),this.lastFocusedPane=e}),s=e.onDidBlur(()=>this._onDidBlurView.fire(e)),l=e.onDidChangeTitleArea(()=>{this.isViewMergedWithContainer()&&this.updateTitleArea()}),c=e.onDidChangeBodyVisibility(()=>this._onDidChangeViewVisibility.fire(e)),u=e.onDidChange(()=>{e===this.lastFocusedPane&&!e.isExpanded()&&(this.lastFocusedPane=void 0)}),p=this.viewDescriptorService.getViewContainerLocation(this.viewContainer)===1;e.style({headerForeground:wt(p?a7i:v7i),headerBackground:wt(p?s7i:f7i),headerBorder:wt(p?l7i:tdi),dropBackground:wt(p?v8e:Tj),leftBorder:p?wt(CEt):void 0});let h=new P;h.add(o),h.add(hn(e,r,s,l,u,c));let g={pane:e,disposable:h};this.paneItems.splice(n,0,g),Oi(this.paneview).addPane(e,t,n);let f;this.viewDescriptorService.canMoveViews()&&(e.draggableElement&&h.add(KE.INSTANCE.registerDraggable(e.draggableElement,()=>({type:"view",id:e.id}),{})),h.add(KE.INSTANCE.registerTarget(e.dropTargetElement,{onDragEnter:v=>{if(!f){let b=v.dragAndDropData.getData();if(b.type==="view"&&b.id!==e.id){let S=this.viewDescriptorService.getViewContainerByViewId(b.id),y=this.viewDescriptorService.getViewDescriptorById(b.id);if(S!==this.viewContainer&&(!y||!y.canMoveView||this.viewContainer.rejectAddedViews))return;f=new pTe(e.dropTargetElement,this.orientation??0,void 0,this.viewDescriptorService.getViewContainerLocation(this.viewContainer),this.themeService)}if(b.type==="composite"&&b.id!==this.viewContainer.id&&!this.viewContainer.rejectAddedViews){let S=this.viewDescriptorService.getViewContainerById(b.id),y=this.viewDescriptorService.getViewContainerModel(S).allViewDescriptors;!y.some(w=>!w.canMoveView)&&y.length>0&&(f=new pTe(e.dropTargetElement,this.orientation??0,void 0,this.viewDescriptorService.getViewContainerLocation(this.viewContainer),this.themeService))}}},onDragOver:v=>{E5(v.eventData.dataTransfer,"move",f!==void 0)},onDragLeave:v=>{f?.dispose(),f=void 0},onDrop:v=>{if(f){let b=v.dragAndDropData.getData(),S=[],y;if(b.type==="composite"&&b.id!==this.viewContainer.id&&!this.viewContainer.rejectAddedViews){let w=this.viewDescriptorService.getViewContainerById(b.id),k=this.viewDescriptorService.getViewContainerModel(w).allViewDescriptors;k.length>0&&!k.some(T=>!T.canMoveView)&&(S.push(...k),y=k[0])}else if(b.type==="view"){let w=this.viewDescriptorService.getViewContainerByViewId(b.id),k=this.viewDescriptorService.getViewDescriptorById(b.id);w!==this.viewContainer&&k&&k.canMoveView&&!this.viewContainer.rejectAddedViews&&S.push(k),k&&(y=k)}if(S&&this.viewDescriptorService.moveViewsToContainer(S,this.viewContainer,void 0,"dnd"),y){if(f.currentDropOperation===1||f.currentDropOperation===3){let w=this.panes.findIndex(T=>T.id===y.id),k=this.panes.findIndex(T=>T.id===e.id);w>=0&&k>=0&&(w>k&&k++,k<this.panes.length&&k!==w&&this.movePane(this.panes[w],this.panes[k]))}if(f.currentDropOperation===0||f.currentDropOperation===2){let w=this.panes.findIndex(T=>T.id===y.id),k=this.panes.findIndex(T=>T.id===e.id);w>=0&&k>=0&&(w<k&&k--,k>=0&&k!==w&&this.movePane(this.panes[w],this.panes[k]))}S.length>1&&S.slice(1).forEach(w=>{let k=this.panes.findIndex(N=>N.id===y.id),T=this.panes.findIndex(N=>N.id===w.id);T>=0&&k>=0&&(T>k&&k++,k<this.panes.length&&k!==T&&(this.movePane(this.panes[T],this.panes[k]),y=w))})}}f?.dispose(),f=void 0}})))}removePanes(e){let t=this.isViewMergedWithContainer();e.forEach(o=>this.removePane(o)),this.updateViewHeaders(),t!==this.isViewMergedWithContainer()&&this.updateTitleArea(),this._onDidRemoveViews.fire(e)}removePane(e){let t=this.paneItems.findIndex(n=>n.pane===e);if(t===-1)return;this.lastFocusedPane===e&&(this.lastFocusedPane=void 0),Oi(this.paneview).removePane(e);let[o]=this.paneItems.splice(t,1);o.disposable.dispose()}movePane(e,t){let o=this.paneItems.findIndex(c=>c.pane===e),n=this.paneItems.findIndex(c=>c.pane===t),r=this.viewContainerModel.visibleViewDescriptors[o],s=this.viewContainerModel.visibleViewDescriptors[n];if(o<0||o>=this.paneItems.length||n<0||n>=this.paneItems.length)return;let[l]=this.paneItems.splice(o,1);this.paneItems.splice(n,0,l),Oi(this.paneview).movePane(e,t),this.viewContainerModel.move(r.id,s.id),this.updateTitleArea()}resizePane(e,t){Oi(this.paneview).resizePane(e,t)}getPaneSize(e){return Oi(this.paneview).getPaneSize(e)}updateViewHeaders(){this.isViewMergedWithContainer()?(this.paneItems[0].pane.isExpanded()?this.lastMergedCollapsedPane=void 0:(this.lastMergedCollapsedPane=this.paneItems[0].pane,this.paneItems[0].pane.setExpanded(!0)),this.paneItems[0].pane.headerVisible=!1,this.paneItems[0].pane.collapsible=!0):(this.paneItems.length===1?(this.paneItems[0].pane.headerVisible=!0,this.paneItems[0].pane===this.lastMergedCollapsedPane&&this.paneItems[0].pane.setExpanded(!1),this.paneItems[0].pane.collapsible=!1):this.paneItems.forEach(e=>{e.pane.headerVisible=!0,e.pane.collapsible=!0,e.pane===this.lastMergedCollapsedPane&&e.pane.setExpanded(!1)}),this.lastMergedCollapsedPane=void 0)}isViewMergedWithContainer(){return this.options.mergeViewWithContainerWhenSingleView&&this.paneItems.length===1?this.areExtensionsReady?!0:this.visibleViewsCountFromCache===void 0?this.paneItems[0].pane.isExpanded():this.visibleViewsCountFromCache===1:!1}onDidScrollPane(){for(let e of this.panes)e.onDidScrollRoot()}onDidSashReset(e){let t,o;for(let n=e;n>=0;n--)if(this.paneItems[n].pane?.isVisible()&&this.paneItems[n]?.pane.isExpanded()){t=this.paneItems[n].pane;break}for(let n=e+1;n<this.paneItems.length;n++)if(this.paneItems[n].pane?.isVisible()&&this.paneItems[n]?.pane.isExpanded()){o=this.paneItems[n].pane;break}if(t&&o){let n=this.getPaneSize(t),r=this.getPaneSize(o),s=Math.ceil((n+r)/2),l=Math.floor((n+r)/2);n>r?(this.resizePane(t,s),this.resizePane(o,l)):(this.resizePane(o,l),this.resizePane(t,s))}}dispose(){super.dispose(),this.paneItems.forEach(e=>e.disposable.dispose()),this.paneview&&this.paneview.dispose()}};Ha=I([m(2,F),m(3,B),m(4,fi),m(5,ze),m(6,Te),m(7,lt),m(8,De),m(9,le),m(10,Pe),m(11,Ri),m(12,ne)],Ha);var R9e=class extends K{constructor(i){super(i),this.desc=i}run(i,...e){let t=i.get(Ft).getActiveViewPaneContainerWithId(this.desc.viewPaneContainerId);if(t)return this.runInViewPaneContainer(i,t,...e)}},mTe=class extends K{constructor(e,t){super(e);this.offset=t}async run(e){let t=e.get(Ri),o=e.get(X),n=Vl.getValue(o);if(n===void 0)return;let r=t.getViewContainerByViewId(n),s=t.getViewContainerModel(r),l=s.visibleViewDescriptors.find(p=>p.id===n),c=s.visibleViewDescriptors.indexOf(l);if(c+this.offset<0||c+this.offset>=s.visibleViewDescriptors.length)return;let u=s.visibleViewDescriptors[c+this.offset];s.move(l.id,u.id)}};W(class extends mTe{constructor(){super({id:"views.moveViewUp",title:d(4258,null),keybinding:{primary:Ai(2089,16),weight:201,when:Vl.notEqualsTo("")}},-1)}});W(class extends mTe{constructor(){super({id:"views.moveViewLeft",title:d(4256,null),keybinding:{primary:Ai(2089,15),weight:201,when:Vl.notEqualsTo("")}},-1)}});W(class extends mTe{constructor(){super({id:"views.moveViewDown",title:d(4255,null),keybinding:{primary:Ai(2089,18),weight:201,when:Vl.notEqualsTo("")}},1)}});W(class extends mTe{constructor(){super({id:"views.moveViewRight",title:d(4257,null),keybinding:{primary:Ai(2089,17),weight:201,when:Vl.notEqualsTo("")}},1)}});W(class extends K{constructor(){super({id:"vscode.moveViews",title:d(4260,null)})}async run(i,e){if(!Array.isArray(e?.viewIds)||typeof e?.destinationId!="string")return Promise.reject("Invalid arguments");let t=i.get(Ri),o=t.getViewContainerById(e.destinationId);if(o){for(let n of e.viewIds){let r=t.getViewDescriptorById(n);r?.canMoveView&&t.moveViewsToContainer([r],o,0,this.desc.id)}await i.get(Ft).openViewContainer(o.id,!0)}}});var zhi=class{constructor(i,e,t,o,n,r,s,l,c,u){this.commentThreadHandle=i;this.controllerHandle=e;this.extensionId=t;this.threadId=o;this.resource=n;this._range=r;this._canReply=l;this._isTemplate=c;this.editorId=u;this._onDidChangeInput=new E;this._onDidChangeLabel=new E;this.onDidChangeLabel=this._onDidChangeLabel.event;this._onDidChangeComments=new E;this._onDidChangeCanReply=new E;this._collapsibleState=0;this._onDidChangeCollapsibleState=new E;this.onDidChangeCollapsibleState=this._onDidChangeCollapsibleState.event;this._onDidChangeInitialCollapsibleState=new E;this.onDidChangeInitialCollapsibleState=this._onDidChangeInitialCollapsibleState.event;this._onDidChangeApplicability=new E;this.onDidChangeApplicability=this._onDidChangeApplicability.event;this._onDidChangeState=new E;this.onDidChangeState=this._onDidChangeState.event;this._isDisposed=!1,c?this.comments=[]:s&&(this._comments=s)}get input(){return this._input}set input(i){this._input=i,this._onDidChangeInput.fire(i)}get onDidChangeInput(){return this._onDidChangeInput.event}get label(){return this._label}set label(i){this._label=i,this._onDidChangeLabel.fire(this._label)}get contextValue(){return this._contextValue}set contextValue(i){this._contextValue=i}get comments(){return this._comments}set comments(i){this._comments=i,this._onDidChangeComments.fire(this._comments)}get onDidChangeComments(){return this._onDidChangeComments.event}set range(i){this._range=i}get range(){return this._range}get onDidChangeCanReply(){return this._onDidChangeCanReply.event}set canReply(i){this._canReply=i,this._onDidChangeCanReply.fire(!!this._canReply)}get canReply(){return this._canReply}get collapsibleState(){return this._collapsibleState}set collapsibleState(i){this.initialCollapsibleState===void 0&&(this.initialCollapsibleState=i),i!==this._collapsibleState&&(this._collapsibleState=i,this._onDidChangeCollapsibleState.fire(this._collapsibleState))}get initialCollapsibleState(){return this._initialCollapsibleState}set initialCollapsibleState(i){this._initialCollapsibleState=i,this._onDidChangeInitialCollapsibleState.fire(i)}get isDisposed(){return this._isDisposed}isDocumentCommentThread(){return this._range===void 0||z.isIRange(this._range)}get state(){return this._state}set state(i){this._state=i,this._onDidChangeState.fire(this._state)}get applicability(){return this._applicability}set applicability(i){this._applicability=i,this._onDidChangeApplicability.fire(i)}get isTemplate(){return this._isTemplate}batchUpdate(i){let e=t=>Object.prototype.hasOwnProperty.call(i,t);e("range")&&(this._range=i.range),e("label")&&(this._label=i.label),e("contextValue")&&(this._contextValue=i.contextValue===null?void 0:i.contextValue),e("comments")&&(this.comments=i.comments),e("collapseState")&&(this.collapsibleState=i.collapseState),e("canReply")&&(this.canReply=i.canReply),e("state")&&(this.state=i.state),e("applicability")&&(this.applicability=i.applicability),e("isTemplate")&&(this._isTemplate=i.isTemplate)}hasComments(){return!!this.comments&&this.comments.length>0}dispose(){this._isDisposed=!0,this._onDidChangeCollapsibleState.dispose(),this._onDidChangeInitialCollapsibleState.dispose(),this._onDidChangeComments.dispose(),this._onDidChangeInput.dispose(),this._onDidChangeLabel.dispose(),this._onDidChangeCanReply.dispose(),this._onDidChangeState.dispose(),this._onDidChangeApplicability.dispose()}toJSON(){return{$mid:7,commentControlHandle:this.controllerHandle,commentThreadHandle:this.commentThreadHandle}}},Khi=class{constructor(i){this.thread=i;this.disposableStore=new P}dispose(){this.disposableStore.dispose()}},Ghi=class extends C{constructor(e,t,o,n,r,s,l){super();this._proxy=e;this._commentService=t;this._handle=o;this._uniqueId=n;this._id=r;this._label=s;this._features=l;this._threads=this._register(new jt)}get handle(){return this._handle}get id(){return this._id}get contextValue(){return this._id}get proxy(){return this._proxy}get label(){return this._label}get reactions(){return this._reactions}set reactions(e){this._reactions=e}get options(){return this._features.options}get features(){return this._features}get owner(){return this._id}get activeComment(){return this._activeComment}async setActiveCommentAndThread(e){return this._activeComment=e,this._proxy.$setActiveComment(this._handle,e?{commentThreadHandle:e.thread.commentThreadHandle,uniqueIdInThread:e.comment?.uniqueIdInThread}:void 0)}updateFeatures(e){this._features=e}createCommentThread(e,t,o,n,r,s,l,c){let u=new zhi(t,this.handle,e,o,A.revive(n).toString(),r,s,!0,l,c),p=new Khi(u);return this._threads.set(t,p),p.disposableStore.add(u.onDidChangeCollapsibleState(()=>{this.proxy.$updateCommentThread(this.handle,u.commentThreadHandle,{collapseState:u.collapsibleState})})),u.isDocumentCommentThread()?this._commentService.updateComments(this._uniqueId,{added:[u],removed:[],changed:[],pending:[]}):this._commentService.updateNotebookComments(this._uniqueId,{added:[u],removed:[],changed:[],pending:[]}),u}updateCommentThread(e,t,o,n){let r=this.getKnownThread(e);r.batchUpdate(n),r.isDocumentCommentThread()?this._commentService.updateComments(this._uniqueId,{added:[],removed:[],changed:[r],pending:[]}):this._commentService.updateNotebookComments(this._uniqueId,{added:[],removed:[],changed:[r],pending:[]})}deleteCommentThread(e){let t=this.getKnownThread(e);this._threads.deleteAndDispose(e),t.dispose(),t.isDocumentCommentThread()?this._commentService.updateComments(this._uniqueId,{added:[],removed:[t],changed:[],pending:[]}):this._commentService.updateNotebookComments(this._uniqueId,{added:[],removed:[t],changed:[],pending:[]})}deleteCommentThreadMain(e){for(let{thread:t}of this._threads.values())t.threadId===e&&this._proxy.$deleteCommentThread(this._handle,t.commentThreadHandle)}updateInput(e){let t=this.activeEditingCommentThread;if(t&&t.input){let o=t.input;o.value=e,t.input=o}}updateCommentingRanges(e){this._commentService.updateCommentingRanges(this._uniqueId,e)}getKnownThread(e){let t=this._threads.get(e);if(!t)throw new Error("unknown thread");return t.thread}async getDocumentComments(e,t){if(e.scheme===Y.vscodeNotebookCell)return{uniqueOwner:this._uniqueId,label:this.label,threads:[],commentingRanges:{resource:e,ranges:[],fileComments:!1}};let o=[];for(let r of[...this._threads.keys()]){let s=this._threads.get(r);s.thread.resource===e.toString()&&s.thread.isDocumentCommentThread()&&o.push(s.thread)}let n=await this._proxy.$provideCommentingRanges(this.handle,e,t);return{uniqueOwner:this._uniqueId,label:this.label,threads:o,commentingRanges:{resource:e,ranges:n?.ranges||[],fileComments:!!n?.fileComments}}}async getNotebookComments(e,t){if(e.scheme!==Y.vscodeNotebookCell)return{uniqueOwner:this._uniqueId,label:this.label,threads:[]};let o=[];for(let n of[...this._threads.keys()]){let r=this._threads.get(n);r.thread.resource===e.toString()&&(r.thread.isDocumentCommentThread()||o.push(r.thread))}return{uniqueOwner:this._uniqueId,label:this.label,threads:o}}async toggleReaction(e,t,o,n,r){return this._proxy.$toggleReaction(this._handle,t.commentThreadHandle,e,o,n)}getAllComments(){let e=[];for(let t of[...this._threads.keys()])e.push(this._threads.get(t).thread);return e}createCommentThreadTemplate(e,t,o){return this._proxy.$createCommentThreadTemplate(this.handle,e,t,o)}async updateCommentThreadTemplate(e,t){await this._proxy.$updateCommentThreadTemplate(this.handle,e,t)}toJSON(){return{$mid:6,handle:this.handle}}},Cto=Re("comments-view-icon",M.commentDiscussion,d(3006,null)),PRt=class extends C{constructor(e,t,o,n,r,s){super();this._commentService=t;this._viewsService=o;this._viewDescriptorService=n;this._uriIdentityService=r;this._editorService=s;this._handlers=new Map;this._commentControllers=new Map;this._activeEditingCommentThreadDisposables=this._register(new P);this._openViewListener=this._register(new me);this._onChangeContainerListener=this._register(new me);this._onChangeContainerLocationListener=this._register(new me);this._proxy=e.getProxy(Zi.ExtHostComments),this._commentService.unregisterCommentController(),this._register(this._commentService.onDidChangeActiveEditingCommentThread(async l=>{let c=l.controllerHandle,u=this._commentControllers.get(c);u&&(this._activeEditingCommentThreadDisposables.clear(),this._activeEditingCommentThread=l,u.activeEditingCommentThread=this._activeEditingCommentThread)}))}$registerCommentController(e,t,o,n){let r=`${t}-${n}`;this._handlers.set(e,r);let s=new Ghi(this._proxy,this._commentService,e,r,t,o,{});this._commentService.registerCommentController(r,s),this._commentControllers.set(e,s),this._register(this._commentService.onResourceHasCommentingRanges(l=>{this.registerView()})),this._register(this._commentService.onDidUpdateCommentThreads(l=>{this.registerView()})),this._commentService.setWorkspaceComments(String(e),[])}$unregisterCommentController(e){let t=this._handlers.get(e);this._handlers.delete(e),this._commentControllers.get(e)?.dispose(),this._commentControllers.delete(e),typeof t=="string"&&this._commentService.unregisterCommentController(t)}$updateCommentControllerFeatures(e,t){let o=this._commentControllers.get(e);o&&o.updateFeatures(t)}$createCommentThread(e,t,o,n,r,s,l,c,u){let p=this._commentControllers.get(e);if(p)return p.createCommentThread(l.value,t,o,n,r,s,c,u)}$updateCommentThread(e,t,o,n,r){let s=this._commentControllers.get(e);if(s)return s.updateCommentThread(t,o,n,r)}$deleteCommentThread(e,t){let o=this._commentControllers.get(e);if(o)return o.deleteCommentThread(t)}$updateCommentingRanges(e,t){let o=this._commentControllers.get(e);o&&o.updateCommentingRanges(t)}async $revealCommentThread(e,t,o,n){let r=this._commentControllers.get(e);if(!r)return Promise.resolve();let s=r.getAllComments().find(c=>c.commentThreadHandle===t);if(!s||!s.isDocumentCommentThread())return Promise.resolve();let l=s.comments?.find(c=>c.uniqueIdInThread===o);KX(this._commentService,this._editorService,this._uriIdentityService,s,l,n.focusReply,void 0,n.preserveFocus)}async $hideCommentThread(e,t){let o=this._commentControllers.get(e);if(!o)return Promise.resolve();let n=o.getAllComments().find(r=>r.commentThreadHandle===t);if(!n||!n.isDocumentCommentThread())return Promise.resolve();n.collapsibleState=0}registerView(){let e=!!this._viewDescriptorService.getViewDescriptorById(Eu);if(!e){let t=oe.as(on.ViewContainersRegistry).registerViewContainer({id:Eu,title:d9e,ctorDescriptor:new Mt(Ha,[Eu,{mergeViewWithContainerWhenSingleView:!0}]),storageId:Ueo,hideIfEmpty:!0,icon:Cto,order:10},1);oe.as(on.ViewsRegistry).registerViews([{id:Eu,name:d9e,canToggleVisibility:!1,ctorDescriptor:new Mt(uTe),canMoveView:!0,containerIcon:Cto,focusCommand:{id:"workbench.action.focusCommentsPanel"}}],t)}this.registerViewListeners(e)}setComments(){[...this._commentControllers.keys()].forEach(e=>{let t=this._commentControllers.get(e).getAllComments();if(t.length){let o=this.getHandler(e);this._commentService.setWorkspaceComments(o,t)}})}registerViewOpenedListener(){this._openViewListener.value||(this._openViewListener.value=this._viewsService.onDidChangeViewVisibility(e=>{e.id===Eu&&e.visible&&(this.setComments(),this._openViewListener&&this._openViewListener.dispose())}))}registerViewListeners(e){e||this.registerViewOpenedListener(),this._onChangeContainerListener.value||(this._onChangeContainerListener.value=this._viewDescriptorService.onDidChangeContainer(t=>{t.views.find(o=>o.id===Eu)&&(this.setComments(),this.registerViewOpenedListener())})),this._onChangeContainerLocationListener.value||(this._onChangeContainerLocationListener.value=this._viewDescriptorService.onDidChangeContainerLocation(t=>{let o=this._viewDescriptorService.getViewContainerByViewId(Eu);t.viewContainer.id===o?.id&&(this.setComments(),this.registerViewOpenedListener())}))}getHandler(e){if(!this._handlers.has(e))throw new Error("Unknown handler");return this._handlers.get(e)}};PRt=I([vo(Gi.MainThreadComments),m(1,km),m(2,Ft),m(3,Ri),m(4,dt),m(5,ee)],PRt);var qX=ae("notebookCellStatusBarService");var ARt=class{constructor(i,e,t,o){this._notebookService=e;this._cellStatusBarService=t;this._logService=o;this._disposables=new P;this._notebookSerializer=new Map;this._notebookCellStatusBarRegistrations=new Map;this._proxy=i.getProxy(Zi.ExtHostNotebook)}dispose(){this._disposables.dispose(),Ue(this._notebookSerializer.values())}$registerNotebookSerializer(i,e,t,o,n){let r=new P;r.add(this._notebookService.registerNotebookSerializer(t,e,{options:o,dataToNotebook:async s=>{let l=new En,c;if(s.byteLength===0&&t==="interactive")c=eI.fromNotebookDataDto({cells:[],metadata:{}});else{let u=await this._proxy.$dataToNotebook(i,s,ve.None);c=eI.fromNotebookDataDto(u.value)}return this._logService.trace(`[NotebookSerializer] dataToNotebook DONE after ${l.elapsed()}ms`,{viewType:t,extensionId:e.id.value}),c},notebookToData:s=>{let l=new En,c=this._proxy.$notebookToData(i,new qh(eI.toNotebookDataDto(s)),ve.None);return this._logService.trace(`[NotebookSerializer] notebookToData DONE after ${l.elapsed()}`,{viewType:t,extensionId:e.id.value}),c},save:async(s,l,c,u)=>{let p=await this._proxy.$saveNotebook(i,s,l,c,u);if(dGo(p))throw new As(p.message,p.fileOperationResult,p.options);return{...p,children:void 0,resource:s}},searchInNotebooks:async(s,l,c)=>{let u=this._notebookService.getContributedNotebookType(t);if(!u)return{results:[],limitHit:!1};let h=u.selectors.map(S=>(S.include||S).toString());if(!h.length)return{results:[],limitHit:!1};let g=si([{isFromSettings:!1,filenamePatterns:h},...c.get(t)??[]]),f=Array.from(c.keys()).flatMap(S=>S!==t?c.get(S)??[]:[]),v=await this._proxy.$searchInNotebooks(i,s,g,f,l);return{results:v.results.map(S=>({resource:A.revive(S.resource),cellResults:S.cellResults.map(w=>Xn(w))})),limitHit:v.limitHit}}})),n&&r.add(this._notebookService.registerContributedNotebookType(t,n)),this._notebookSerializer.set(i,r),this._logService.trace("[NotebookSerializer] registered notebook serializer",{viewType:t,extensionId:e.id.value})}$unregisterNotebookSerializer(i){this._notebookSerializer.get(i)?.dispose(),this._notebookSerializer.delete(i)}$emitCellStatusBarEvent(i){let e=this._notebookCellStatusBarRegistrations.get(i);e instanceof E&&e.fire(void 0)}async $registerNotebookCellStatusBarItemProvider(i,e,t){let o=this,n={async provideCellStatusBarItems(s,l,c){let u=await o._proxy.$provideNotebookCellStatusBarItems(i,s,l,c);return{items:u?.items??[],dispose(){u&&o._proxy.$releaseNotebookCellStatusBarItems(u.cacheId)}}},viewType:t};if(typeof e=="number"){let s=new E;this._notebookCellStatusBarRegistrations.set(e,s),n.onDidChangeStatusBarItems=s.event}let r=this._cellStatusBarService.registerCellStatusBarItemProvider(n);this._notebookCellStatusBarRegistrations.set(i,r)}async $unregisterNotebookCellStatusBarItemProvider(i,e){let t=o=>{this._notebookCellStatusBarRegistrations.get(o)&&(this._notebookCellStatusBarRegistrations.get(o)?.dispose(),this._notebookCellStatusBarRegistrations.delete(o))};t(i),typeof e=="number"&&t(e)}};ARt=I([vo(Gi.MainThreadNotebook),m(1,un),m(2,qX),m(3,ne)],ARt);qe.registerCommand("_executeDataToNotebook",async(a,...i)=>{let[e,t]=i;So(typeof e=="string","string"),So(t instanceof Je,"VSBuffer");let n=await a.get(un).withNotebookDataProvider(e);if(!(n instanceof YL))return;let r=await n.serializer.dataToNotebook(t);return new qh(eI.toNotebookDataDto(r))});qe.registerCommand("_executeNotebookToData",async(a,i,e)=>{So(typeof i=="string","string");let o=await a.get(un).withNotebookDataProvider(i);if(!(o instanceof YL))return;let n=eI.fromNotebookDataDto(e.value);return await o.serializer.notebookToData(n)});function dGo(a){let i=a;return typeof i?.fileOperationResult=="number"&&typeof i?.message=="string"}var Zc=ae("INotebookEditorWidgetService");var rs=ae("INotebookExecutionStateService");var NRt=100;var Tl=ae("INotebookKernelService"),mR=ae("INotebookKernelHistoryService");var $hi=class{constructor(i,e){this._languageService=e;this._onDidChange=new E;this.onDidChange=this._onDidChange.event;this.id=i.id,this.viewType=i.notebookType,this.extension=i.extensionId,this.implementsInterrupt=i.supportsInterrupt??!1,this.label=i.label,this.description=i.description,this.detail=i.detail,this.supportedLanguages=dr(i.supportedLanguages)?i.supportedLanguages:e.getRegisteredLanguageIds(),this.implementsExecutionOrder=i.supportsExecutionOrder??!1,this.hasVariableProvider=i.hasVariableProvider??!1,this.localResourceRoot=A.revive(i.extensionLocation),this.preloads=i.preloads?.map(t=>({uri:A.revive(t.uri),provides:t.provides}))??[]}get preloadUris(){return this.preloads.map(i=>i.uri)}get preloadProvides(){return this.preloads.flatMap(i=>i.provides)}update(i){let e=Object.create(null);i.label!==void 0&&(this.label=i.label,e.label=!0),i.description!==void 0&&(this.description=i.description,e.description=!0),i.detail!==void 0&&(this.detail=i.detail,e.detail=!0),i.supportedLanguages!==void 0&&(this.supportedLanguages=dr(i.supportedLanguages)?i.supportedLanguages:this._languageService.getRegisteredLanguageIds(),e.supportedLanguages=!0),i.supportsExecutionOrder!==void 0&&(this.implementsExecutionOrder=i.supportsExecutionOrder,e.hasExecutionOrder=!0),i.supportsInterrupt!==void 0&&(this.implementsInterrupt=i.supportsInterrupt,e.hasInterruptHandler=!0),i.hasVariableProvider!==void 0&&(this.hasVariableProvider=i.hasVariableProvider,e.hasVariableProvider=!0),this._onDidChange.fire(e)}},qhi=class{constructor(i){this.notebookType=i}},ORt=class{constructor(i,e,t,o,n,r){this._languageService=e;this._notebookKernelService=t;this._notebookExecutionStateService=o;this._notebookService=n;this._editors=new jt;this._disposables=new P;this._kernels=new Map;this._kernelDetectionTasks=new Map;this._kernelSourceActionProviders=new Map;this._kernelSourceActionProvidersEventRegistrations=new Map;this._executions=new Map;this._notebookExecutions=new Map;this.variableRequestIndex=0;this.variableRequestMap=new Map;this._proxy=i.getProxy(Zi.ExtHostNotebookKernels),r.listNotebookEditors().forEach(this._onEditorAdd,this),r.onDidAddNotebookEditor(this._onEditorAdd,this,this._disposables),r.onDidRemoveNotebookEditor(this._onEditorRemove,this,this._disposables),this._disposables.add(Z(()=>{this._executions.forEach(s=>{s.complete({})}),this._notebookExecutions.forEach(s=>s.complete())})),this._disposables.add(this._notebookKernelService.onDidChangeSelectedNotebooks(s=>{for(let[l,[c]]of this._kernels)s.oldKernel===c.id?this._proxy.$acceptNotebookAssociation(l,s.notebook,!1):s.newKernel===c.id&&this._proxy.$acceptNotebookAssociation(l,s.notebook,!0)}))}dispose(){this._disposables.dispose();for(let[,i]of this._kernels.values())i.dispose();for(let[,i]of this._kernelDetectionTasks.values())i.dispose();for(let[,i]of this._kernelSourceActionProviders.values())i.dispose();this._editors.dispose()}_onEditorAdd(i){let e=i.onDidReceiveMessage(t=>{if(!i.hasModel())return;let{selected:o}=this._notebookKernelService.getMatchingKernel(i.textModel);if(o){for(let[n,r]of this._kernels)if(r[0]===o){this._proxy.$acceptKernelMessageFromRenderer(n,i.getId(),t.message);break}}});this._editors.set(i,e)}_onEditorRemove(i){this._editors.deleteAndDispose(i)}async $postMessage(i,e,t){let o=this._kernels.get(i);if(!o)throw new Error("kernel already disposed");let[n]=o,r=!1;for(let[s]of this._editors)if(s.hasModel()&&this._notebookKernelService.getMatchingKernel(s.textModel).selected===n){if(e===void 0)s.postMessage(t),r=!0;else if(s.getId()===e){s.postMessage(t),r=!0;break}}return r}$receiveVariable(i,e){let t=this.variableRequestMap.get(i);t&&t.emitOne(e)}async $addKernel(i,e){let t=this,o=new class extends $hi{async executeNotebookCellsRequest(r,s){await t._proxy.$executeCells(i,r,s)}async cancelNotebookCellExecution(r,s){await t._proxy.$cancelCells(i,r,s)}provideVariables(r,s,l,c,u){let p=`${i}variables${t.variableRequestIndex++}`;return new Fp(async h=>{t.variableRequestMap.set(p,h);try{await t._proxy.$provideVariables(i,p,r,s,l,c,u)}finally{t.variableRequestMap.delete(p)}})}}(e,this._languageService),n=this._disposables.add(new P);this._kernels.set(i,[o,n]),n.add(this._notebookKernelService.registerKernel(o))}$updateKernel(i,e){let t=this._kernels.get(i);t&&t[0].update(e)}$removeKernel(i){let e=this._kernels.get(i);e&&(e[1].dispose(),this._kernels.delete(i))}$updateNotebookPriority(i,e,t){let o=this._kernels.get(i);o&&this._notebookKernelService.updateKernelNotebookAffinity(o[0],A.revive(e),t)}$createExecution(i,e,t,o){let n=A.revive(t),r=this._notebookService.getNotebookTextModel(n);if(!r)throw new Error(`Notebook not found: ${n.toString()}`);let s=this._notebookKernelService.getMatchingKernel(r);if(!s.selected||s.selected.id!==e)throw new Error(`Kernel is not selected: ${s.selected?.id} !== ${e}`);let l=this._notebookExecutionStateService.createCellExecution(n,o);l.confirm(),this._executions.set(i,l)}$updateExecution(i,e){let t=e.value;try{this._executions.get(i)?.update(t.map(eI.fromCellExecuteUpdateDto))}catch(o){mt(o)}}$completeExecution(i,e){try{this._executions.get(i)?.complete(eI.fromCellExecuteCompleteDto(e.value))}catch(t){mt(t)}finally{this._executions.delete(i)}}$createNotebookExecution(i,e,t){let o=A.revive(t),n=this._notebookService.getNotebookTextModel(o);if(!n)throw new Error(`Notebook not found: ${o.toString()}`);let r=this._notebookKernelService.getMatchingKernel(n);if(!r.selected||r.selected.id!==e)throw new Error(`Kernel is not selected: ${r.selected?.id} !== ${e}`);let s=this._notebookExecutionStateService.createExecution(o);s.confirm(),this._notebookExecutions.set(i,s)}$beginNotebookExecution(i){try{this._notebookExecutions.get(i)?.begin()}catch(e){mt(e)}}$completeNotebookExecution(i){try{this._notebookExecutions.get(i)?.complete()}catch(e){mt(e)}finally{this._notebookExecutions.delete(i)}}async $addKernelDetectionTask(i,e){let t=new qhi(e),o=this._notebookKernelService.registerNotebookKernelDetectionTask(t);this._kernelDetectionTasks.set(i,[t,o])}$removeKernelDetectionTask(i){let e=this._kernelDetectionTasks.get(i);e&&(e[1].dispose(),this._kernelDetectionTasks.delete(i))}async $addKernelSourceActionProvider(i,e,t){let o={viewType:t,provideKernelSourceActions:async()=>(await this._proxy.$provideKernelSourceActions(i,ve.None)).map(s=>{let l=s.documentation;return s.documentation&&typeof s.documentation!="string"&&(l=A.revive(s.documentation)),{label:s.label,command:s.command,description:s.description,detail:s.detail,documentation:l}})};if(typeof e=="number"){let r=new E;this._kernelSourceActionProvidersEventRegistrations.set(e,r),o.onDidChangeSourceActions=r.event}let n=this._notebookKernelService.registerKernelSourceActionProvider(t,o);this._kernelSourceActionProviders.set(i,[o,n])}$removeKernelSourceActionProvider(i,e){let t=this._kernelSourceActionProviders.get(i);t&&(t[1].dispose(),this._kernelSourceActionProviders.delete(i)),typeof e=="number"&&this._kernelSourceActionProvidersEventRegistrations.delete(e)}$emitNotebookKernelSourceActionsChangeEvent(i){let e=this._kernelSourceActionProvidersEventRegistrations.get(i);e instanceof E&&e.fire(void 0)}$variablesUpdated(i){this._notebookKernelService.notifyVariablesChange(A.revive(i))}};ORt=I([vo(Gi.MainThreadNotebookKernels),m(1,kt),m(2,Tl),m(3,rs),m(4,un),m(5,Zc)],ORt);var hTe=class{constructor(i,e,t){this._notebookEditorModelResolverService=e;this._uriIdentityService=t;this._disposables=new P;this._documentEventListenersMapping=new vt;this._proxy=i.getProxy(Zi.ExtHostNotebookDocuments),this._modelReferenceCollection=new SQe(this._uriIdentityService.extUri),this._disposables.add(this._notebookEditorModelResolverService.onDidChangeDirty(o=>this._proxy.$acceptDirtyStateChanged(o.resource,o.isDirty()))),this._disposables.add(this._notebookEditorModelResolverService.onDidSaveNotebook(o=>this._proxy.$acceptModelSaved(o))),this._disposables.add(e.onWillFailWithConflict(o=>{this._modelReferenceCollection.remove(o.resource)}))}dispose(){this._disposables.dispose(),this._modelReferenceCollection.dispose(),Ue(this._documentEventListenersMapping.values())}handleNotebooksAdded(i){for(let e of i){let t=new P;t.add(e.onDidChangeContent(o=>{let n={versionId:o.versionId,rawEvents:[]};for(let s of o.rawEvents)switch(s.kind){case 1:n.rawEvents.push({kind:s.kind,changes:s.changes.map(l=>[l[0],l[1],l[2].map(c=>eI.toNotebookCellDto(c))])});break;case 2:n.rawEvents.push({kind:s.kind,index:s.index,length:s.length,newIdx:s.newIdx});break;case 8:n.rawEvents.push({kind:s.kind,index:s.index,outputs:s.outputs.map(eI.toNotebookOutputDto)});break;case 9:n.rawEvents.push({kind:s.kind,index:s.index,outputId:s.outputId,outputItems:s.outputItems.map(eI.toNotebookOutputItemDto),append:s.append});break;case 5:case 10:case 7:case 12:n.rawEvents.push(s);break}let r=o.rawEvents.find(s=>s.kind===11);this._proxy.$acceptModelChanged(e.uri,new qh(n),this._notebookEditorModelResolverService.isDirty(e.uri),r?e.metadata:void 0)})),this._documentEventListenersMapping.set(e.uri,t)}}handleNotebooksRemoved(i){for(let e of i)this._documentEventListenersMapping.get(e)?.dispose(),this._documentEventListenersMapping.delete(e)}async $tryCreateNotebook(i){if(i.content){let e=await this._notebookEditorModelResolverService.resolve({untitledResource:void 0},i.viewType);if(H.once(e.object.notebook.onWillDispose)(()=>{e.dispose()}),this._proxy.$acceptDirtyStateChanged(e.object.resource,!0),i.content){let t=eI.fromNotebookDataDto(i.content);e.object.notebook.reset(t.cells,t.metadata,e.object.notebook.transientOptions)}return e.object.notebook.uri}else return(await this._notebookEditorModelResolverService.createUntitledNotebookTextModel(i.viewType)).uri}async $tryOpenNotebook(i){let e=A.revive(i),t=await this._notebookEditorModelResolverService.resolve(e,void 0);return i.scheme==="untitled"&&t.object.notebook.onWillDispose(()=>{t.dispose()}),this._modelReferenceCollection.add(e,t),e}async $trySaveNotebook(i){let e=A.revive(i),t=await this._notebookEditorModelResolverService.resolve(e),o=await t.object.save();return t.dispose(),o}};hTe=I([m(1,mh),m(2,dt)],hTe);var jhi=class{constructor(i,e){this.editor=i;this.disposables=e}dispose(){this.disposables.dispose()}},gTe=class{constructor(i,e,t,o,n){this._editorService=e;this._notebookEditorService=t;this._editorGroupService=o;this._configurationService=n;this._disposables=new P;this._mainThreadEditors=new Map;this._proxy=i.getProxy(Zi.ExtHostNotebookEditors),this._editorService.onDidActiveEditorChange(()=>this._updateEditorViewColumns(),this,this._disposables),this._editorGroupService.onDidRemoveGroup(()=>this._updateEditorViewColumns(),this,this._disposables),this._editorGroupService.onDidMoveGroup(()=>this._updateEditorViewColumns(),this,this._disposables)}dispose(){this._disposables.dispose(),Ue(this._mainThreadEditors.values())}handleEditorsAdded(i){for(let e of i){let t=new P;t.add(e.onDidChangeVisibleRanges(()=>{this._proxy.$acceptEditorPropertiesChanged(e.getId(),{visibleRanges:{ranges:e.visibleRanges}})})),t.add(e.onDidChangeSelection(()=>{this._proxy.$acceptEditorPropertiesChanged(e.getId(),{selections:{selections:e.getSelections()}})}));let o=new jhi(e,t);this._mainThreadEditors.set(e.getId(),o)}}handleEditorsRemoved(i){for(let e of i)this._mainThreadEditors.get(e)?.dispose(),this._mainThreadEditors.delete(e)}_updateEditorViewColumns(){let i=Object.create(null);for(let e of this._editorService.visibleEditorPanes){let t=qn(e);t&&this._mainThreadEditors.has(t.getId())&&(i[t.getId()]=bC(this._editorGroupService,e.group))}uo(i,this._currentViewColumnInfo)||(this._currentViewColumnInfo=i,this._proxy.$acceptEditorViewColumns(i))}async $tryShowNotebookDocument(i,e,t){let o={cellSelections:t.selections,preserveFocus:t.preserveFocus,pinned:t.pinned,activation:t.preserveFocus?2:void 0,label:t.label,override:e},n=await this._editorService.openEditor({resource:A.revive(i),options:o},W_(this._editorGroupService,this._configurationService,t.position)),r=qn(n);if(r)return r.getId();throw new Error(`Notebook Editor creation failure for document ${JSON.stringify(i)}`)}async $tryRevealRange(i,e,t){let o=this._notebookEditorService.getNotebookEditor(i);if(!o)return;let n=o;if(!n.hasModel()||e.start>=n.getLength())return;let r=n.cellAt(e.start);switch(t){case 0:return n.revealCellRangeInView(e);case 1:return n.revealInCenter(r);case 2:return n.revealInCenterIfOutsideViewport(r);case 3:return n.revealInViewAtTop(r)}}$trySetSelections(i,e){let t=this._notebookEditorService.getNotebookEditor(i);t&&(t.setSelections(e),e.length&&t.setFocus({start:e[0].start,end:e[0].start+1}))}};gTe=I([m(1,ee),m(2,Zc),m(3,Et),m(4,B)],gTe);var FRt=class{constructor(i,e,t,o){this.documents=i;this.textEditors=e;this.activeEditor=t;this.visibleEditors=o}static delta(i,e){if(!i)return{addedDocuments:[...e.documents],removedDocuments:[],addedEditors:[...e.textEditors.values()],removedEditors:[],visibleEditors:[...e.visibleEditors].map(s=>s[0])};let t=HH(i.documents,e.documents),o=X2e(i.textEditors,e.textEditors),n=i.activeEditor!==e.activeEditor?e.activeEditor:void 0,r=X2e(i.visibleEditors,e.visibleEditors);return{addedDocuments:t.added,removedDocuments:t.removed.map(s=>s.uri),addedEditors:o.added,removedEditors:o.removed.map(s=>s.getId()),newActiveEditor:n,visibleEditors:r.added.length===0&&r.removed.length===0?void 0:[...e.visibleEditors].map(s=>s[0])}}},Vde=class{constructor(i,e,t,o,n,r,s){this._notebookService=t;this._notebookEditorService=o;this._editorService=n;this._editorGroupService=r;this._logService=s;this._disposables=new P;this._editorListeners=new jt;this._proxy=i.getProxy(Zi.ExtHostNotebook),this._mainThreadNotebooks=e.createInstance(hTe,i),this._mainThreadEditors=e.createInstance(gTe,i),i.set(Gi.MainThreadNotebookDocuments,this._mainThreadNotebooks),i.set(Gi.MainThreadNotebookEditors,this._mainThreadEditors),this._notebookService.onWillAddNotebookDocument(()=>this._updateState(),this,this._disposables),this._notebookService.onDidRemoveNotebookDocument(()=>this._updateState(),this,this._disposables),this._editorService.onDidActiveEditorChange(()=>this._updateState(),this,this._disposables),this._editorService.onDidVisibleEditorsChange(()=>this._updateState(),this,this._disposables),this._notebookEditorService.onDidAddNotebookEditor(this._handleEditorAdd,this,this._disposables),this._notebookEditorService.onDidRemoveNotebookEditor(this._handleEditorRemove,this,this._disposables),this._updateState()}dispose(){this._mainThreadNotebooks.dispose(),this._mainThreadEditors.dispose(),this._disposables.dispose(),this._editorListeners.dispose()}_handleEditorAdd(i){this._editorListeners.set(i.getId(),hn(i.onDidChangeModel(()=>this._updateState()),i.onDidFocusWidget(()=>this._updateState(i)))),this._updateState()}_handleEditorRemove(i){this._editorListeners.deleteAndDispose(i.getId()),this._updateState()}_updateState(i){let e=new Map,t=new Map;for(let s of this._notebookEditorService.listNotebookEditors())s.hasModel()&&e.set(s.getId(),s);let o=qn(this._editorService.activeEditorPane),n=null;o?n=o.getId():i?.textModel&&(n=i.getId()),n&&!e.has(n)&&(this._logService.trace("MainThreadNotebooksAndEditors#_updateState: active editor is not in editors list",n,e.keys()),n=null);for(let s of this._editorService.visibleEditorPanes){let l=qn(s);l?.hasModel()&&e.has(l.getId())&&t.set(l.getId(),l)}let r=new FRt(new Set(this._notebookService.listNotebookDocuments()),e,n,t);this._onDelta(FRt.delta(this._currentState,r)),this._currentState=r}_onDelta(i){if(Vde._isDeltaEmpty(i))return;let e={removedDocuments:i.removedDocuments,removedEditors:i.removedEditors,newActiveEditor:i.newActiveEditor,visibleEditors:i.visibleEditors,addedDocuments:i.addedDocuments.map(Vde._asModelAddData),addedEditors:i.addedEditors.map(this._asEditorAddData,this)};this._proxy.$acceptDocumentAndEditorsDelta(new qh(e)),this._mainThreadEditors.handleEditorsRemoved(i.removedEditors),this._mainThreadNotebooks.handleNotebooksRemoved(i.removedDocuments),this._mainThreadNotebooks.handleNotebooksAdded(i.addedDocuments),this._mainThreadEditors.handleEditorsAdded(i.addedEditors)}static _isDeltaEmpty(i){return!(i.addedDocuments!==void 0&&i.addedDocuments.length>0||i.removedDocuments!==void 0&&i.removedDocuments.length>0||i.addedEditors!==void 0&&i.addedEditors.length>0||i.removedEditors!==void 0&&i.removedEditors.length>0||i.visibleEditors!==void 0&&i.visibleEditors.length>0||i.newActiveEditor!==void 0)}static _asModelAddData(i){return{viewType:i.viewType,uri:i.uri,metadata:i.metadata,versionId:i.versionId,cells:i.cells.map(eI.toNotebookCellDto)}}_asEditorAddData(i){let e=this._editorService.visibleEditorPanes.find(t=>qn(t)===i);return{id:i.getId(),documentUri:i.textModel.uri,selections:i.getSelections(),visibleRanges:i.visibleRanges,viewColumn:e&&bC(this._editorGroupService,e.group),viewType:i.getViewModel().viewType}}};Vde=I([QL,m(1,F),m(2,un),m(3,Zc),m(4,ee),m(5,Et),m(6,ne)],Vde);var fTe=ae("INotebookRendererMessagingService");var WRt=class extends C{constructor(e,t){super();this.messaging=t;this.proxy=e.getProxy(Zi.ExtHostNotebookRenderers),this._register(t.onShouldPostMessage(o=>{this.proxy.$postRendererMessage(o.editorId,o.rendererId,o.message)}))}$postMessage(e,t,o){return this.messaging.receiveMessage(e,t,o)}};WRt=I([vo(Gi.MainThreadNotebookRenderers),m(1,fTe)],WRt);var _v=ae("INotebookLoggingService");var Vf=ae("workingCopyEditorService"),M9e=class extends C{constructor(e){super();this.editorService=e;this._onDidRegisterHandler=this._register(new E);this.onDidRegisterHandler=this._onDidRegisterHandler.event;this.handlers=new Set}registerHandler(e){return this.handlers.add(e),this._onDidRegisterHandler.fire(e),Z(()=>this.handlers.delete(e))}findEditor(e){for(let t of this.editorService.getEditors(0))if(this.isOpen(e,t.editor))return t}isOpen(e,t){for(let o of this.handlers)if(o.isOpen(e,t))return!0;return!1}};M9e=I([m(0,ee)],M9e);we(Vf,M9e,1);var aF=ae("elevatedFileService");function xto(a){return!!a.stat}var _5=class extends FX{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super(t,s);this.typeId=e;this.name=o;this.modelFactory=n;this.externalResolver=r;this.logService=l;this.workingCopyFileService=c;this.filesConfigurationService=u;this.workingCopyBackupService=p;this.notificationService=g;this.workingCopyEditorService=f;this.editorService=v;this.elevatedFileService=b;this.progressService=S;this.capabilities=0;this._model=void 0;this._onDidChangeContent=this._register(new E);this.onDidChangeContent=this._onDidChangeContent.event;this._onDidResolve=this._register(new E);this.onDidResolve=this._onDidResolve.event;this._onDidChangeDirty=this._register(new E);this.onDidChangeDirty=this._onDidChangeDirty.event;this._onDidSaveError=this._register(new E);this.onDidSaveError=this._onDidSaveError.event;this._onDidSave=this._register(new E);this.onDidSave=this._onDidSave.event;this._onDidRevert=this._register(new E);this.onDidRevert=this._onDidRevert.event;this._onDidChangeReadonly=this._register(new E);this.onDidChangeReadonly=this._onDidChangeReadonly.event;this.dirty=!1;this.ignoreDirtyOnModelContentChange=!1;this.versionId=0;this.lastContentChangeFromUndoRedo=void 0;this.saveSequentializer=new Abe;this.ignoreSaveFromSaveParticipants=!1;this.inConflictMode=!1;this.inErrorMode=!1;this._register(h.registerWorkingCopy(this)),this.registerListeners()}get model(){return this._model}registerListeners(){this._register(this.filesConfigurationService.onDidChangeReadonly(()=>this._onDidChangeReadonly.fire()))}isDirty(){return this.dirty}markModified(){this.setDirty(!0)}setDirty(e){if(!this.isResolved())return;let t=this.dirty;this.doSetDirty(e),e!==t&&this._onDidChangeDirty.fire()}doSetDirty(e){let t=this.dirty,o=this.inConflictMode,n=this.inErrorMode,r=this.savedVersionId;return e?this.dirty=!0:(this.dirty=!1,this.inConflictMode=!1,this.inErrorMode=!1,this.isResolved()&&(this.savedVersionId=this.model.versionId)),()=>{this.dirty=t,this.inConflictMode=o,this.inErrorMode=n,this.savedVersionId=r}}isResolved(){return!!this.model}async resolve(e){if(this.trace("resolve() - enter"),this.isDisposed()){this.trace("resolve() - exit - without resolving because file working copy is disposed");return}if(!e?.contents&&(this.dirty||this.saveSequentializer.isRunning())){this.trace("resolve() - exit - without resolving because file working copy is dirty or being saved");return}return this.doResolve(e)}async doResolve(e){if(e?.contents)return this.resolveFromBuffer(e.contents);if(!(!this.isResolved()&&await this.resolveFromBackup()))return this.resolveFromFile(e)}async resolveFromBuffer(e){this.trace("resolveFromBuffer()");let t,o,n,r;try{let s=await this.fileService.stat(this.resource);t=s.mtime,o=s.ctime,n=s.size,r=s.etag,this.setOrphaned(!1)}catch(s){t=Date.now(),o=Date.now(),n=0,r=gL,this.setOrphaned(s.fileOperationResult===1)}return this.resolveFromContent({resource:this.resource,name:this.name,mtime:t,ctime:o,size:n,etag:r,value:e,readonly:!1,locked:!1,executable:!1},!0)}async resolveFromBackup(){let e=await this.workingCopyBackupService.resolve(this);return this.isResolved()?(this.trace("resolveFromBackup() - exit - withoutresolving because previously new file working copy got created meanwhile"),!0):e?(await this.doResolveFromBackup(e),!0):!1}async doResolveFromBackup(e){this.trace("doResolveFromBackup()"),await this.resolveFromContent({resource:this.resource,name:this.name,mtime:e.meta?e.meta.mtime:Date.now(),ctime:e.meta?e.meta.ctime:Date.now(),size:e.meta?e.meta.size:0,etag:e.meta?e.meta.etag:gL,value:e.value,readonly:!1,locked:!1,executable:!1},!0),e.meta?.orphaned&&this.setOrphaned(!0)}async resolveFromFile(e){this.trace("resolveFromFile()");let t=e?.forceReadFromFile,o;t?o=gL:this.lastResolvedFileStat&&(o=this.lastResolvedFileStat.etag);let n=this.versionId;try{let r=await this.fileService.readFileStream(this.resource,{etag:o,limits:e?.limits});if(this.setOrphaned(!1),n!==this.versionId){this.trace("resolveFromFile() - exit - without resolving because file working copy content changed");return}await this.resolveFromContent(r,!1)}catch(r){let s=r.fileOperationResult;if(this.setOrphaned(s===1),this.isResolved()&&s===2){r instanceof UU&&this.updateLastResolvedFileStat(r.stat);return}if(this.isResolved()&&s===1&&!t)return;throw r}}async resolveFromContent(e,t){if(this.trace("resolveFromContent() - enter"),this.isDisposed()){this.trace("resolveFromContent() - exit - because working copy is disposed");return}this.updateLastResolvedFileStat({resource:this.resource,name:e.name,mtime:e.mtime,ctime:e.ctime,size:e.size,etag:e.etag,readonly:e.readonly,locked:e.locked,executable:!1,isFile:!0,isDirectory:!1,isSymbolicLink:!1,children:void 0}),this.isResolved()?await this.doUpdateModel(e.value):await this.doCreateModel(e.value),this.setDirty(!!t),this._onDidResolve.fire()}async doCreateModel(e){this.trace("doCreateModel()"),this._model=this._register(await this.modelFactory.createModel(this.resource,e,ve.None)),this.installModelListeners(this._model)}async doUpdateModel(e){this.trace("doUpdateModel()"),this.ignoreDirtyOnModelContentChange=!0;try{await this.model?.update(e,ve.None)}finally{this.ignoreDirtyOnModelContentChange=!1}}installModelListeners(e){this._register(e.onDidChangeContent(t=>this.onModelContentChanged(e,t.isUndoing||t.isRedoing))),this._register(e.onWillDispose(()=>this.dispose()))}onModelContentChanged(e,t){if(this.trace("onModelContentChanged() - enter"),this.versionId++,this.trace(`onModelContentChanged() - new versionId ${this.versionId}`),t&&(this.lastContentChangeFromUndoRedo=Date.now()),!this.ignoreDirtyOnModelContentChange&&!this.isReadonly())if(e.versionId===this.savedVersionId){this.trace("onModelContentChanged() - model content changed back to last saved version");let o=this.dirty;this.setDirty(!1),o&&this._onDidRevert.fire()}else this.trace("onModelContentChanged() - model content changed and marked as dirty"),this.setDirty(!0);this._onDidChangeContent.fire()}async forceResolveFromFile(){this.isDisposed()||await this.externalResolver({forceReadFromFile:!0})}get backupDelay(){return this.model?.configuration?.backupDelay}async backup(e){let t;this.lastResolvedFileStat&&(t={mtime:this.lastResolvedFileStat.mtime,ctime:this.lastResolvedFileStat.ctime,size:this.lastResolvedFileStat.size,etag:this.lastResolvedFileStat.etag,orphaned:this.isOrphaned()});let o;return this.isResolved()&&(o=await wa(this.model.snapshot(2,e),e)),{meta:t,content:o}}static{this.UNDO_REDO_SAVE_PARTICIPANTS_AUTO_SAVE_THROTTLE_THRESHOLD=500}async save(e=Object.create(null)){return this.isResolved()?this.isReadonly()?(this.trace("save() - ignoring request for readonly resource"),!1):(this.hasState(3)||this.hasState(5))&&(e.reason===2||e.reason===3||e.reason===4)?(this.trace("save() - ignoring auto save request for file working copy that is in conflict or error"),!1):(this.trace("save() - enter"),await this.doSave(e),this.trace("save() - exit"),this.hasState(0)):!1}async doSave(e){typeof e.reason!="number"&&(e.reason=1);let t=this.versionId;if(this.trace(`doSave(${t}) - enter with versionId ${t}`),this.ignoreSaveFromSaveParticipants){this.trace(`doSave(${t}) - exit - refusing to save() recursively from save participant`);return}if(this.saveSequentializer.isRunning(t))return this.trace(`doSave(${t}) - exit - found a running save for versionId ${t}`),this.saveSequentializer.running;if(!e.force&&!this.dirty){this.trace(`doSave(${t}) - exit - because not dirty and/or versionId is different (this.isDirty: ${this.dirty}, this.versionId: ${this.versionId})`);return}if(this.saveSequentializer.isRunning())return this.trace(`doSave(${t}) - exit - because busy saving`),this.saveSequentializer.cancelRunning(),this.saveSequentializer.queue(()=>this.doSave(e));this.isResolved()&&this.model.pushStackElement();let o=new $e;return this.progressService.withProgress({title:d(17607,null,this.name),location:10,cancellable:!0,delay:this.isDirty()?3e3:5e3},n=>this.doSaveSequential(t,e,n,o),()=>{o.cancel()}).finally(()=>{o.dispose()})}doSaveSequential(e,t,o,n){return this.saveSequentializer.run(e,(async()=>{if(this.isResolved()&&!t.skipSaveParticipants&&this.workingCopyFileService.hasSaveParticipants)try{if(t.reason===2&&typeof this.lastContentChangeFromUndoRedo=="number"){let l=Date.now()-this.lastContentChangeFromUndoRedo;l<_5.UNDO_REDO_SAVE_PARTICIPANTS_AUTO_SAVE_THROTTLE_THRESHOLD&&await Pi(_5.UNDO_REDO_SAVE_PARTICIPANTS_AUTO_SAVE_THROTTLE_THRESHOLD-l)}if(!n.token.isCancellationRequested){this.ignoreSaveFromSaveParticipants=!0;try{await this.workingCopyFileService.runSaveParticipants(this,{reason:t.reason??1,savedFrom:t.from},o,n.token)}catch(l){so(l)&&!n.token.isCancellationRequested&&n.cancel()}finally{this.ignoreSaveFromSaveParticipants=!1}}}catch(l){this.logService.error(`[stored file working copy] runSaveParticipants(${e}) - resulted in an error: ${l.toString()}`,this.resource.toString(),this.typeId)}if(n.token.isCancellationRequested||this.isDisposed()||!this.isResolved())return;e=this.versionId,this.inErrorMode=!1,o.report({message:d(17608,null)}),this.trace(`doSave(${e}) - before write()`);let r=Oi(this.lastResolvedFileStat),s=this;return this.saveSequentializer.run(e,(async()=>{try{let l={mtime:r.mtime,etag:t.ignoreModifiedSince||!this.filesConfigurationService.preventSaveConflicts(r.resource)?gL:r.etag,unlock:t.writeUnlock},c;if(typeof s.model.save=="function")try{c=await s.model.save(l,n.token)}catch(u){if(n.token.isCancellationRequested)return;throw u}else{let u=await wa(s.model.snapshot(1,n.token),n.token);if(n.token.isCancellationRequested)return;n.dispose(),t?.writeElevated&&this.elevatedFileService.isSupported(r.resource)?c=await this.elevatedFileService.writeFileElevated(r.resource,Oi(u),l):c=await this.fileService.writeFile(r.resource,Oi(u),l)}this.handleSaveSuccess(c,e,t)}catch(l){this.handleSaveError(l,e,t)}})(),()=>n.cancel())})(),()=>n.cancel())}handleSaveSuccess(e,t,o){this.updateLastResolvedFileStat(e),t===this.versionId?(this.trace(`handleSaveSuccess(${t}) - setting dirty to false because versionId did not change`),this.setDirty(!1)):this.trace(`handleSaveSuccess(${t}) - not setting dirty to false because versionId did change meanwhile`),this.setOrphaned(!1),this._onDidSave.fire({reason:o.reason,stat:e,source:o.source})}handleSaveError(e,t,o){if((o.ignoreErrorHandler?this.logService.trace:this.logService.error).apply(this.logService,[`[stored file working copy] handleSaveError(${t}) - exit - resulted in a save error: ${e.toString()}`,this.resource.toString(),this.typeId]),o.ignoreErrorHandler)throw e;this.setDirty(!0),this.inErrorMode=!0,e.fileOperationResult===3&&(this.inConflictMode=!0),this.doHandleSaveError(e,o),this._onDidSaveError.fire()}doHandleSaveError(e,t){let o=e,n=[],r;if(o.fileOperationResult===3)r=d(17609,null,this.name),n.push(pi({id:"fileWorkingCopy.overwrite",label:d(17594,null),run:()=>this.save({...t,ignoreModifiedSince:!0,reason:1})})),n.push(pi({id:"fileWorkingCopy.revert",label:d(17603,null),run:()=>this.revert()}));else{let c=o.fileOperationResult===5,u=c&&o.options?.unlock,p=o.fileOperationResult===6,h=this.elevatedFileService.isSupported(this.resource);A6(e)&&n.push(...e.actions),h&&(p||u)?n.push(pi({id:"fileWorkingCopy.saveElevated",label:u?ri?d(17595,null):d(17596,null):ri?d(17605,null):d(17606,null),run:()=>{this.save({...t,writeElevated:!0,writeUnlock:u,reason:1})}})):c?n.push(pi({id:"fileWorkingCopy.unlock",label:d(17594,null),run:()=>this.save({...t,writeUnlock:!0,reason:1})})):n.push(pi({id:"fileWorkingCopy.retry",label:d(17602,null),run:()=>this.save({...t,reason:1})})),n.push(pi({id:"fileWorkingCopy.saveAs",label:d(17604,null),run:async()=>{let g=this.workingCopyEditorService.findEditor(this);g&&((await this.editorService.save(g,{saveAs:!0,reason:1})).success||this.doHandleSaveError(e,t))}})),n.push(pi({id:"fileWorkingCopy.revert",label:d(17603,null),run:()=>this.revert()})),c?u&&h?r=ri?d(17600,null,this.name):d(17601,null,this.name):r=d(17599,null,this.name):h&&p?r=ri?d(17597,null,this.name):d(17598,null,this.name):r=d(17593,null,this.name,In(e,!1))}let s=this.notificationService.notify({id:`${Ir(this.resource.toString())}`,severity:St.Error,message:r,actions:{primary:n}}),l=this._register(H.once(H.any(this.onDidSave,this.onDidRevert))(()=>s.close()));this._register(H.once(s.onDidClose)(()=>l.dispose()))}updateLastResolvedFileStat(e){let t=this.isReadonly();this.lastResolvedFileStat?this.lastResolvedFileStat.mtime<=e.mtime?this.lastResolvedFileStat=e:this.lastResolvedFileStat={...this.lastResolvedFileStat,readonly:e.readonly,locked:e.locked}:this.lastResolvedFileStat=e,this.isReadonly()!==t&&this._onDidChangeReadonly.fire()}async revert(e){if(!this.isResolved()||!this.dirty&&!e?.force)return;this.trace("revert()");let t=this.dirty,o=this.doSetDirty(!1);if(!e?.soft)try{await this.forceResolveFromFile()}catch(r){if(r.fileOperationResult!==1)throw o(),r}this._onDidRevert.fire(),t&&this._onDidChangeDirty.fire()}hasState(e){switch(e){case 3:return this.inConflictMode;case 1:return this.dirty;case 5:return this.inErrorMode;case 4:return this.isOrphaned();case 2:return this.saveSequentializer.isRunning();case 0:return!this.dirty}}async joinState(e){return this.saveSequentializer.running}isReadonly(){return this.filesConfigurationService.isReadonly(this.resource,this.lastResolvedFileStat)}trace(e){this.logService.trace(`[stored file working copy] ${e}`,this.resource.toString(),this.typeId)}dispose(){this.trace("dispose()"),this.inConflictMode=!1,this.inErrorMode=!1,this._model=void 0,super.dispose()}};_5=I([m(5,be),m(6,ne),m(7,kp),m(8,lr),m(9,Gm),m(10,Wa),m(11,Ne),m(12,Vf),m(13,ee),m(14,aF),m(15,Bo)],_5);var lF=class extends gg{constructor(e,t,o,n,r,s){super();this.resource=e;this._hasAssociatedFilePath=t;this.viewType=o;this._workingCopyManager=n;this._filesConfigurationService=s;this._onDidChangeDirty=this._register(new E);this._onDidSave=this._register(new E);this._onDidChangeOrphaned=this._register(new E);this._onDidChangeReadonly=this._register(new E);this._onDidRevertUntitled=this._register(new E);this.onDidChangeDirty=this._onDidChangeDirty.event;this.onDidSave=this._onDidSave.event;this.onDidChangeOrphaned=this._onDidChangeOrphaned.event;this.onDidChangeReadonly=this._onDidChangeReadonly.event;this.onDidRevertUntitled=this._onDidRevertUntitled.event;this._workingCopyListeners=this._register(new P);this.scratchPad=r}dispose(){this._workingCopy?.dispose(),super.dispose()}get notebook(){return this._workingCopy?.model?.notebookModel}isResolved(){return!!this._workingCopy?.model?.notebookModel}async canDispose(){return this._workingCopy&&lF._isStoredFileWorkingCopy(this._workingCopy)?this._workingCopyManager.stored.canDispose(this._workingCopy):!0}isDirty(){return this._workingCopy?.isDirty()??!1}isModified(){return this._workingCopy?.isModified()??!1}isOrphaned(){return lF._isStoredFileWorkingCopy(this._workingCopy)&&this._workingCopy.hasState(4)}hasAssociatedFilePath(){return!lF._isStoredFileWorkingCopy(this._workingCopy)&&!!this._workingCopy?.hasAssociatedFilePath}isReadonly(){return lF._isStoredFileWorkingCopy(this._workingCopy)?this._workingCopy?.isReadonly():this._filesConfigurationService.isReadonly(this.resource)}get hasErrorState(){return this._workingCopy&&Wo(this._workingCopy,{hasState:!0})?this._workingCopy.hasState(5):!1}async revert(e){return So(this.isResolved()),this._workingCopy.revert(e)}async save(e){return So(this.isResolved()),this._workingCopy.save(e)}async load(e){return!this._workingCopy||!this._workingCopy.model?(this.resource.scheme===Y.untitled?(this._hasAssociatedFilePath?this._workingCopy=await this._workingCopyManager.resolve({associatedResource:this.resource}):this._workingCopy=await this._workingCopyManager.resolve({untitledResource:this.resource,isScratchpad:this.scratchPad}),this._register(this._workingCopy.onDidRevert(()=>this._onDidRevertUntitled.fire()))):(this._workingCopy=await this._workingCopyManager.resolve(this.resource,{limits:e?.limits,reload:e?.forceReadFromFile?{async:!1,force:!0}:void 0}),this._workingCopyListeners.add(this._workingCopy.onDidSave(t=>this._onDidSave.fire(t))),this._workingCopyListeners.add(this._workingCopy.onDidChangeOrphaned(()=>this._onDidChangeOrphaned.fire())),this._workingCopyListeners.add(this._workingCopy.onDidChangeReadonly(()=>this._onDidChangeReadonly.fire()))),this._workingCopyListeners.add(this._workingCopy.onDidChangeDirty(()=>this._onDidChangeDirty.fire(),void 0)),this._workingCopyListeners.add(this._workingCopy.onWillDispose(()=>{this._workingCopyListeners.clear(),this._workingCopy?.model?.dispose()}))):await this._workingCopyManager.resolve(this.resource,{reload:{async:!e?.forceReadFromFile,force:e?.forceReadFromFile},limits:e?.limits}),So(this.isResolved()),this}async saveAs(e){let t=await this._workingCopyManager.saveAs(this.resource,e);if(t)return{resource:t.resource}}static _isStoredFileWorkingCopy(e){return!(e&&e.capabilities&2)}};lF=I([m(5,lr)],lF);var AV=class extends C{constructor(e,t,o,n,r){super();this._notebookModel=e;this._notebookService=t;this._configurationService=o;this._telemetryService=n;this._notebookLogService=r;this._onDidChangeContent=this._register(new E);this.onDidChangeContent=this._onDidChangeContent.event;this.configuration=void 0;this.onWillDispose=e.onWillDispose.bind(e),this._register(e.onDidChangeContent(l=>{for(let c of l.rawEvents)if(c.kind!==6&&!c.transient){this._onDidChangeContent.fire({isRedoing:!1,isUndoing:!1,isInitial:!1});break}}));let s=this._configurationService.getValue(ft.remoteSaving);(s||e.uri.scheme===Y.vscodeRemote)&&(this.configuration={backupDelay:1e4}),s&&this.setSaveDelegate().catch(l=>this._notebookLogService.error("WorkingCopyModel",`Failed to set save delegate: ${l}`))}async setSaveDelegate(){await this.getNotebookSerializer(),this.save=async(e,t)=>{try{let o=this._notebookService.tryGetDataProviderSync(this.notebookModel.viewType)?.serializer;if(o||(this._notebookLogService.info("WorkingCopyModel","No serializer found for notebook model, checking if provider still needs to be resolved"),o=await this.getNotebookSerializer().catch(r=>{throw this._notebookLogService.error("WorkingCopyModel",`Failed to get notebook serializer: ${r}`),this.save=void 0,new VRt("Failed to get notebook serializer")})),t.isCancellationRequested)throw new ho;return await o.save(this._notebookModel.uri,this._notebookModel.versionId,e,t)}catch(o){if(!t.isCancellationRequested&&o.name!=="Canceled"){let n=this._notebookModel.viewType==="jupyter-notebook"||this._notebookModel.viewType==="interactive",r=uGo(o);this._telemetryService.publicLogError2("notebook/SaveError",{isRemote:this._notebookModel.uri.scheme===Y.vscodeRemote,isIPyNbWorkerSerializer:n&&this._configurationService.getValue("ipynb.experimental.serialization"),error:r})}throw o}}}dispose(){this._notebookModel.dispose(),super.dispose()}get notebookModel(){return this._notebookModel}async snapshot(e,t){return this._notebookService.createNotebookTextDocumentSnapshot(this._notebookModel.uri,e,t)}async update(e,t){let o=await this.getNotebookSerializer(),n=await Kv(e),r=await o.dataToNotebook(n);if(t.isCancellationRequested)throw new ho;this._notebookLogService.info("WorkingCopyModel","Notebook content updated from file system - "+this._notebookModel.uri.toString()),this._notebookModel.reset(r.cells,r.metadata,o.options)}async getNotebookSerializer(){let e=await this._notebookService.withNotebookDataProvider(this.notebookModel.viewType);if(!(e instanceof YL)){let t="CANNOT open notebook with this provider";throw new VRt(t)}return e.serializer}get versionId(){return this._notebookModel.alternativeVersionId}pushStackElement(){this._notebookModel.pushStackElement()}},bTe=class{constructor(i,e,t,o,n){this._viewType=i;this._notebookService=e;this._configurationService=t;this._telemetryService=o;this._notebookLogService=n}async createModel(i,e,t){let o=this._notebookService.getNotebookTextModel(i)??await this._notebookService.createNotebookTextModel(this._viewType,i,e);return new AV(o,this._notebookService,this._configurationService,this._telemetryService,this._notebookLogService)}};bTe=I([m(1,un),m(2,B),m(3,Te),m(4,_v)],bTe);var VRt=class extends Error{constructor(i){super(i),this.name="NotebookSaveError"}};function uGo(a){if(a.name==="NotebookSaveError")return a.message;if(a instanceof As)switch(a.fileOperationResult){case 0:return"File is a directory";case 1:return"File not found";case 2:return"File not modified since";case 3:return"File modified since";case 4:return"File move conflict";case 5:return"File write locked";case 6:return"File permission denied";case 7:return"File too large";case 8:return"File invalid path";case 9:return"File not directory";case 10:return"File other error"}return"Unknown error"}var Qhi=class{constructor(i){this._proxy=i.getProxy(Zi.ExtHostNotebookDocumentSaveParticipant)}async participate(i,e,t,o){if(!i.model||!(i.model instanceof AV))return;let n,r=new Promise((s,l)=>{n=setTimeout(()=>l(new Error(d(3053,null))),1750),this._proxy.$participateInSave(i.resource,e.reason,o).then(c=>{clearTimeout(n)}).then(s,l)});return pm(r,o)}},BRt=class{constructor(i,e,t){this.workingCopyFileService=t;this._saveParticipantDisposable=this.workingCopyFileService.addSaveParticipant(e.createInstance(Qhi,i))}dispose(){this._saveParticipantDisposable.dispose()}};BRt=I([QL,m(1,F),m(2,kp)],BRt);var HRt=class{constructor(i,e){this._disposables=new P;this._proxy=i.getProxy(Zi.ExtHostInteractive),this._disposables.add(e.onWillAddInteractiveDocument(t=>{this._proxy.$willAddInteractiveDocument(t.inputUri,`
`,Fr,t.notebookUri)})),this._disposables.add(e.onWillRemoveInteractiveDocument(t=>{this._proxy.$willRemoveInteractiveDocument(t.inputUri,t.notebookUri)}))}dispose(){this._disposables.dispose()}};HRt=I([vo(Gi.MainThreadInteractive),m(1,Kke)],HRt);var pGo={type:"object",additionalProperties:!1,properties:{type:{type:"string",description:d(14025,null)},required:{type:"array",items:{type:"string"}},properties:{type:"object",description:d(14026,null),additionalProperties:{$ref:"http://json-schema.org/draft-07/schema#"}},when:{type:"string",markdownDescription:d(14027,null),default:""}}},Eto;(i=>{function a(e,t,o){if(!e)return;let n=Ae(e.type)?e.type:void 0;if(!n||n.length===0){o.error(d(14029,null));return}let r=[];if(Array.isArray(e.required))for(let s of e.required)Ae(s)&&r.push(s);return{extensionId:t.value,taskType:n,required:r,properties:e.properties?Xi(e.properties):{},when:e.when?x.deserialize(e.when):void 0}}i.from=a})(Eto||={});var mGo=Tn.registerExtensionPoint({extensionPoint:"taskDefinitions",activationEventsGenerator:function*(a){for(let i of a)i.type&&(yield`onTaskType:${i.type}`)},jsonSchema:{description:d(14028,null),type:"array",items:pGo}}),Yhi=class{constructor(){this._onDefinitionsChanged=new E;this.onDefinitionsChanged=this._onDefinitionsChanged.event;this.taskTypes=Object.create(null),this.readyPromise=new Promise((i,e)=>{mGo.setHandler((t,o)=>{this._schema=void 0;try{for(let n of o.removed){let r=n.value;for(let s of r)this.taskTypes&&s.type&&this.taskTypes[s.type]&&delete this.taskTypes[s.type]}for(let n of o.added){let r=n.value;for(let s of r){let l=Eto.from(s,n.description.identifier,n.collector);l&&(this.taskTypes[l.taskType]=l)}}(o.removed.length>0||o.added.length>0)&&this._onDefinitionsChanged.fire()}catch{}i(void 0)})})}onReady(){return this.readyPromise}get(i){return this.taskTypes[i]}all(){return Object.keys(this.taskTypes).map(i=>this.taskTypes[i])}getJsonSchema(){if(this._schema===void 0){let i=[];for(let e of this.all()){let t={type:"object",additionalProperties:!1};e.required.length>0&&(t.required=e.required.slice(0)),e.properties!==void 0?t.properties=Xi(e.properties):t.properties=Object.create(null),t.properties.type={type:"string",enum:[e.taskType]},i.push(t)}this._schema={oneOf:i}}return this._schema}},sk=new Yhi;var NV="settings",ITe=new Q("taskRunning",!1,d(14032,null)),A9e=new Q("taskTerminalActive",!1,d(14034,null)),MC=L(14033,"Tasks"),yTe=(t=>(t[t.Escape=1]="Escape",t[t.Strong=2]="Strong",t[t.Weak=3]="Weak",t))(yTe||{}),D5="$customized";(i=>{function a(e){if(!e)return 2;switch(e.toLowerCase()){case"escape":return 1;case"strong":return 2;case"weak":return 3;default:return 2}}i.from=a})(yTe||={});var N9e;(i=>i.defaults={cwd:"${workspaceFolder}"})(N9e||={});var Bde=(t=>(t[t.Always=1]="Always",t[t.Silent=2]="Silent",t[t.Never=3]="Never",t))(Bde||{});(i=>{function a(e){switch(e.toLowerCase()){case"always":return 1;case"silent":return 2;case"never":return 3;default:return 1}}i.fromString=a})(Bde||={});var wTe=(t=>(t[t.Never=1]="Never",t[t.OnProblem=2]="OnProblem",t[t.Always=3]="Always",t))(wTe||{});(i=>{function a(e){switch(e.toLowerCase()){case"always":return 3;case"never":return 1;case"onproblem":return 2;default:return 2}}i.fromString=a})(wTe||={});var CTe=(t=>(t[t.Shared=1]="Shared",t[t.Dedicated=2]="Dedicated",t[t.New=3]="New",t))(CTe||{});(i=>{function a(e){switch(e.toLowerCase()){case"shared":return 1;case"dedicated":return 2;case"new":return 3;default:return 1}}i.fromString=a})(CTe||={});var zRt;(i=>i.defaults={echo:!0,reveal:1,revealProblems:1,focus:!1,panel:1,showReuseMessage:!0,clear:!1,preserveTerminalName:!1})(zRt||={});var L5=(t=>(t[t.Shell=1]="Shell",t[t.Process=2]="Process",t[t.CustomExecution=3]="CustomExecution",t))(L5||{});(e=>{function a(t){switch(t.toLowerCase()){case"shell":return 1;case"process":return 2;case"customExecution":return 3;default:return 2}}e.fromString=a;function i(t){switch(t){case 1:return"shell";case 2:return"process";case 3:return"customExecution";default:return"process"}}e.toString=i})(L5||={});var R5;(i=>{function a(e){return Ae(e)?e:e.value}i.value=a})(R5||={});var $m;(r=>{r.Clean={_id:"clean",isDefault:!1},r.Build={_id:"build",isDefault:!1},r.Rebuild={_id:"rebuild",isDefault:!1},r.Test={_id:"test",isDefault:!1};function o(s){return s===r.Clean._id||s===r.Build._id||s===r.Rebuild._id||s===r.Test._id}r.is=o;function n(s){if(s!==void 0)return Ae(s)?o(s)?{_id:s,isDefault:!1}:void 0:s}r.from=n})($m||={});var gl;(r=>{r.Workspace="workspace",r.Extension="extension",r.InMemory="inMemory",r.WorkspaceFile="workspaceFile",r.User="user";function n(s){switch(s){case r.User:return 2;case r.WorkspaceFile:return 5;default:return 6}}r.toConfigurationTarget=n})(gl||={});var KRt;(i=>i.defaults={reevaluateOnRerun:!0,runOn:1,instanceLimit:1,instancePolicy:"prompt"})(KRt||={});var STe=class{constructor(i,e,t,o,n,r){this._label="";this._id=i,e&&(this._label=e),t&&(this.type=t),this.runOptions=o,this.configurationProperties=n,this._source=r}getDefinition(i){}getMapKey(){return this._id}getKey(){}getCommonTaskId(){let i={folder:this.getFolderId(),id:this._id};return JSON.stringify(i)}clone(){return this.fromObject(Object.assign({},this))}getWorkspaceFolder(){}getWorkspaceFileName(){}getTelemetryKind(){return"unknown"}matches(i,e=!1){if(i===void 0)return!1;if(Ae(i))return i===this._label||i===this.configurationProperties.identifier||e&&i===this._id;let t=this.getDefinition(!0);return t!==void 0&&t._key===i._key}getQualifiedLabel(){let i=this.getWorkspaceFolder();return i?`${this._label} (${i.name})`:this._label}getTaskExecution(){return{id:this._id,task:this}}addTaskLoadMessages(i){this._taskLoadMessages===void 0&&(this._taskLoadMessages=[]),i&&(this._taskLoadMessages=this._taskLoadMessages.concat(i))}get taskLoadMessages(){return this._taskLoadMessages}},pd=class a extends STe{constructor(e,t,o,n,r,s,l,c){super(e,o,void 0,l,c,t);this.command={};this._source=t,this.hasDefinedMatchers=s,r&&(this.command=r)}clone(){return new a(this._id,this._source,this._label,this.type,this.command,this.hasDefinedMatchers,this.runOptions,this.configurationProperties)}customizes(){if(this._source&&this._source.customizes)return this._source.customizes}getDefinition(e=!1){if(e&&this._source.customizes!==void 0)return this._source.customizes;{let t;switch(this.command?this.command.runtime:void 0){case 1:t="shell";break;case 2:t="process";break;case 3:t="customExecution";break;case void 0:t="$composite";break;default:throw new Error("Unexpected task runtime")}return{type:t,_key:this._id,id:this._id}}}static is(e){return e instanceof a}getMapKey(){let e=this._source.config.workspaceFolder;return e?`${e.uri.toString()}|${this._id}|${this.instance}`:`${this._id}|${this.instance}`}getFolderId(){return this._source.kind===gl.User?NV:this._source.config.workspaceFolder?.uri.toString()}getCommonTaskId(){return this._source.customizes?super.getCommonTaskId():this.getKey()??super.getCommonTaskId()}getKey(){let e=this.getFolderId();if(!e)return;let t=this.configurationProperties.identifier;return this._source.kind!==gl.Workspace&&(t+=this._source.kind),JSON.stringify({type:D5,folder:e,id:t})}getWorkspaceFolder(){return this._source.config.workspaceFolder}getWorkspaceFileName(){return this._source.config.workspace&&this._source.config.workspace.configuration?Ye(this._source.config.workspace.configuration):void 0}getTelemetryKind(){return this._source.customizes?"workspace>extension":"workspace"}fromObject(e){let t=e;return new a(t._id,t._source,t._label,t.type,t.command,t.hasDefinedMatchers,t.runOptions,t.configurationProperties)}},tf=class a extends STe{constructor(i,e,t,o,n,r,s){super(i,t,o,r,s,e),this._source=e,this.configures=n}static is(i){return i instanceof a}fromObject(i){return i}getDefinition(){return this.configures}getWorkspaceFileName(){return this._source.config.workspace&&this._source.config.workspace.configuration?Ye(this._source.config.workspace.configuration):void 0}getWorkspaceFolder(){return this._source.config.workspaceFolder}getFolderId(){return this._source.kind===gl.User?NV:this._source.config.workspaceFolder?.uri.toString()}getKey(){let i=this.getFolderId();if(!i)return;let e=this.configurationProperties.identifier;return this._source.kind!==gl.Workspace&&(e+=this._source.kind),JSON.stringify({type:D5,folder:i,id:e})}},bh=class a extends STe{constructor(i,e,t,o,n,r,s,l,c){super(i,t,o,l,c,e),this.defines=n,this.hasDefinedMatchers=s,this.command=r,this.icon=c.icon,this.hide=c.hide}clone(){return new a(this._id,this._source,this._label,this.type,this.defines,this.command,this.hasDefinedMatchers,this.runOptions,this.configurationProperties)}getDefinition(){return this.defines}static is(i){return i instanceof a}getMapKey(){let i=this._source.workspaceFolder;return i?`${this._source.scope.toString()}|${i.uri.toString()}|${this._id}|${this.instance}`:`${this._source.scope.toString()}|${this._id}|${this.instance}`}getFolderId(){if(this._source.scope===3&&this._source.workspaceFolder)return this._source.workspaceFolder.uri.toString()}getKey(){let i={type:"contributed",scope:this._source.scope,id:this._id};return i.folder=this.getFolderId(),JSON.stringify(i)}getWorkspaceFolder(){return this._source.workspaceFolder}getTelemetryKind(){return"extension"}fromObject(i){let e=i;return new a(e._id,e._source,e._label,e.type,e.defines,e.command,e.hasDefinedMatchers,e.runOptions,e.configurationProperties)}},GE=class a extends STe{constructor(i,e,t,o,n,r){super(i,t,o,n,r,e),this._source=e}clone(){return new a(this._id,this._source,this._label,this.type,this.runOptions,this.configurationProperties)}static is(i){return i instanceof a}getTelemetryKind(){return"composite"}getMapKey(){return`${this._id}|${this.instance}`}getFolderId(){}fromObject(i){let e=i;return new a(e._id,e._source,e._label,e.type,e.runOptions,e.configurationProperties)}},Hde=(e=>(e[e.Process=1]="Process",e[e.Terminal=2]="Terminal",e))(Hde||{});(i=>i._default=2)(Hde||={});var URt=class{constructor(i){this._order=new Map;for(let e=0;e<i.length;e++)this._order.set(i[e].uri.toString(),e)}compare(i,e){let t=i.getWorkspaceFolder(),o=e.getWorkspaceFolder();if(t&&o){let n=this._order.get(t.uri.toString());n=n===void 0?0:n+1;let r=this._order.get(o.uri.toString());return r=r===void 0?0:r+1,n===r?i._label.localeCompare(e._label):n-r}else return!t&&o?-1:t&&!o?1:0}};var Gu;(c=>{function a(u){return{taskId:u._id,taskName:u.configurationProperties.name,runType:u.configurationProperties.isBackground?"background":"singleRun",group:u.configurationProperties.group,__task:u}}function i(u,p,h){return{...a(u),kind:"start",terminalId:p,resolvedVariables:h}}c.start=i;function e(u,p,h){return{...a(u),kind:"processStarted",terminalId:p,processId:h}}c.processStarted=e;function t(u,p,h,g){return{...a(u),kind:"processEnded",terminalId:p,exitCode:h,durationMs:g}}c.processEnded=t;function o(u,p,h){return{...a(u),kind:"inactive",terminalId:p,durationMs:h}}c.inactive=o;function n(u,p,h){return{...a(u),kind:"terminated",exitReason:h,terminalId:p}}c.terminated=n;function r(u,p,h){return{...a(p),kind:u,terminalId:h}}c.general=r;function s(u,p,h){return{...a(u),kind:"problemMatcherEnded",hasErrors:p}}c.problemMatcherEnded=s;function l(){return{kind:"changed"}}c.changed=l})(Gu||={});var P9e;(e=>{function a(t){let o=Object.keys(t).sort(),n="";for(let r of o){let s=t[r];s instanceof Object?s=a(s):typeof s=="string"&&(s=s.replace(/,/g,",,")),n+=r+","+s+","}return n}function i(t){let n={_key:a(t),type:t.taskType};return Object.assign(n,t),n}e.create=i})(P9e||={});var OV;(i=>{function a(e,t){let o=sk.get(e.type);if(o===void 0){let l=Xi(e);return delete l._key,P9e.create(l)}let n=Object.create(null);n.type=o.taskType;let r=new Set;o.required.forEach(l=>r.add(l));let s=o.properties;for(let l of Object.keys(s)){let c=e[l];if(c!=null)n[l]=c;else if(r.has(l)){let u=s[l];if(u.default!==void 0)n[l]=Xi(u.default);else switch(u.type){case"boolean":n[l]=!1;break;case"number":case"integer":n[l]=0;break;case"string":n[l]="";break;default:t.error(d(14031,null,JSON.stringify(e,void 0,0),l));return}}}return P9e.create(n)}i.createTaskIdentifier=a})(OV||={});var GRt=Re("rerun-task",M.refresh,d(14030,null)),$Rt="workbench.action.tasks.rerunForActiveTerminal",qRt="workbench.action.tasks.rerunAllRunningTasks";var Xhi=new Q("customExecutionSupported",!1,d(14035,null)),Ude=new Q("shellExecutionSupported",!1,d(14038,null)),jRt=new Q("taskCommandsRegistered",!1,d(14039,null)),xTe=new Q("processExecutionSupported",!1,d(14036,null)),QRt=new Q("serverlessWebContext",!1,d(14037,null)),kTe=new Q("tasksAvailable",!1,d(14040,null)),Sh=x.or(x.and(Ude,xTe),Xhi),yg=ae("taskService");var sp=ae("configurationResolverService"),YRt=($=>($.Unknown="unknown",$.Env="env",$.Config="config",$.Command="command",$.Input="input",$.ExtensionInstallFolder="extensionInstallFolder",$.WorkspaceFolder="workspaceFolder",$.Cwd="cwd",$.WorkspaceFolderBasename="workspaceFolderBasename",$.UserHome="userHome",$.LineNumber="lineNumber",$.ColumnNumber="columnNumber",$.SelectedText="selectedText",$.File="file",$.FileWorkspaceFolder="fileWorkspaceFolder",$.FileWorkspaceFolderBasename="fileWorkspaceFolderBasename",$.RelativeFile="relativeFile",$.RelativeFileDirname="relativeFileDirname",$.FileDirname="fileDirname",$.FileExtname="fileExtname",$.FileBasename="fileBasename",$.FileBasenameNoExtension="fileBasenameNoExtension",$.FileDirnameBasename="fileDirnameBasename",$.ExecPath="execPath",$.ExecInstallFolder="execInstallFolder",$.PathSeparator="pathSeparator",$.PathSeparatorAlias="/",$))(YRt||{}),Tto=Object.values(YRt).filter(a=>typeof a=="string"),Bf=class extends Zs{constructor(e,t){super(t);this.variable=e}};var cS=class a{constructor(i){this.locations=new Map;this.newReplacementNotifiers=new Set;typeof i=="string"?(this.stringRoot=!0,this.root={value:i}):(this.stringRoot=!1,this.root=structuredClone(i))}static{this.VARIABLE_LHS="${"}static parse(i){if(i instanceof a)return i;let e=new a(i);return e.applyPlatformSpecificKeys(),e.parseObject(e.root),e}applyPlatformSpecificKeys(){let i=this.root,e=ri?"windows":it?"osx":Wn?"linux":void 0;e&&i&&typeof i=="object"&&i.hasOwnProperty(e)&&Object.keys(i[e]).forEach(t=>i[t]=i[e][t]),delete i.windows,delete i.osx,delete i.linux}parseVariable(i,e){if(i[e]!=="$"||i[e+1]!=="{")return;let t=e+2,o=1;for(;t<i.length;){if(i[t]==="{")o++;else if(i[t]==="}"&&(o--,o===0))break;t++}if(o!==0)return;let n=i.slice(e,t+1),r=i.substring(e+2,t),s=r.indexOf(":");return s===-1?{replacement:{id:n,name:r,inner:r},end:t}:{replacement:{id:n,inner:r,name:r.slice(0,s),arg:r.slice(s+1)},end:t}}parseObject(i){if(!(typeof i!="object"||i===null)){if(Array.isArray(i)){for(let e=0;e<i.length;e++){let t=i[e];typeof t=="string"?this.parseString(i,e,t):this.parseObject(t)}return}for(let[e,t]of Object.entries(i))this.parseString(i,e,e,!0),typeof t=="string"?this.parseString(i,e,t):this.parseObject(t)}}parseString(i,e,t,o,n){let r=0;for(;r<t.length;){let s=t.indexOf("${",r);if(s===-1)break;let l=this.parseVariable(t,s);if(l){if(r=l.end+1,n?.includes(l.replacement.id))continue;let c=this.locations.get(l.replacement.id)||{locations:[],replacement:l.replacement},u={object:i,propertyName:e,replaceKeyName:o};c.locations.push(u),this.locations.set(l.replacement.id,c),c.resolved?this._resolveAtLocation(l.replacement,u,c.resolved,n):this.newReplacementNotifiers.forEach(p=>p(l.replacement))}else r=s+2}}*unresolved(){let i=new Map,e=t=>{i.set(t.id,t)};for(let t of this.locations.values())t.resolved===void 0&&i.set(t.replacement.id,t.replacement);for(this.newReplacementNotifiers.add(e);;){let t=ht.first(i);if(!t)break;let[o,n]=t;yield n,i.delete(o)}this.newReplacementNotifiers.delete(e)}resolved(){return ht.map(ht.filter(this.locations.values(),i=>!!i.resolved),i=>[i.replacement,i.resolved])}resolve(i,e){typeof e!="object"&&(e={value:String(e)});let t=this.locations.get(i.id);if(t&&(t.resolved=e,e.value!==void 0))for(let o of t.locations||ht.empty())this._resolveAtLocation(i,o,e)}_resolveAtLocation(i,{replaceKeyName:e,propertyName:t,object:o},n,r=[]){if(n.value!==void 0){if(r.push(i.id),e&&typeof t=="string"){let s=o[t],l=t.replaceAll(i.id,n.value);delete o[t],o[l]=s,this._renameKeyInLocations(o,t,l),this.parseString(o,l,n.value,!0,r)}else o[t]=o[t].replaceAll(i.id,n.value),this.parseString(o,t,n.value,!1,r);r.pop()}}_renameKeyInLocations(i,e,t){for(let o of this.locations.values())for(let n of o.locations)n.object===i&&n.propertyName===e&&(n.propertyName=t)}toObject(){return this.stringRoot?this.root.value:this.root}};var Jhi;(i=>{function a(e){return{id:e.id,task:$_.from(e.task)}}i.from=a})(Jhi||={});var _to;(i=>{function a(e){return{execution:{id:e.execution.id,task:$_.from(e.execution.task)}}}i.from=a})(_to||={});var Zhi;(i=>{function a(e){return{execution:{id:e.execution.id,task:$_.from(e.execution.task)},hasErrors:e.hasErrors}}i.from=a})(Zhi||={});var Dto;(i=>{function a(e,t){return{id:e.id,processId:t}}i.from=a})(Dto||={});var Lto;(i=>{function a(e,t){return{id:e.id,exitCode:t}}i.from=a})(Lto||={});var egi;(e=>{function a(t){let o=Object.assign(Object.create(null),t);return delete o._key,o}e.from=a;function i(t,o){let n=OV.createTaskIdentifier(t,console);return n===void 0&&o&&(n={_key:_t(),type:"$executeOnly"}),n}e.to=i})(egi||={});var tgi;(e=>{function a(t){if(t!=null)return Object.assign(Object.create(null),t)}e.from=a;function i(t){return t==null?zRt.defaults:Object.assign(Object.create(null),zRt.defaults,t)}e.to=i})(tgi||={});var igi;(e=>{function a(t){if(t!=null)return Object.assign(Object.create(null),t)}e.from=a;function i(t){return t==null?KRt.defaults:Object.assign(Object.create(null),KRt.defaults,t)}e.to=i})(igi||={});var ogi;(e=>{function a(t){if(t!=null)return{cwd:t.cwd,env:t.env}}e.from=a;function i(t){return t==null?N9e.defaults:{cwd:t.cwd||N9e.defaults.cwd,env:t.env}}e.to=i})(ogi||={});var JRt;(t=>{function a(o){let n=o;return n&&!!n.process}t.is=a;function i(o){let n=Ae(o.name)?o.name:o.name.value,r=o.args?o.args.map(l=>Ae(l)?l:l.value):[],s={process:n,args:r};return o.options&&(s.options=ogi.from(o.options)),s}t.from=i;function e(o){let n={runtime:2,name:o.process,args:o.args,presentation:void 0};return n.options=ogi.to(o.options),n}t.to=e})(JRt||={});var ngi;(e=>{function a(t){if(t==null)return;let o={cwd:t.cwd||N9e.defaults.cwd,env:t.env};return t.shell&&(o.executable=t.shell.executable,o.shellArgs=t.shell.args,o.shellQuoting=t.shell.quoting),o}e.from=a;function i(t){if(t==null)return;let o={cwd:t.cwd,env:t.env};return t.executable&&(o.shell={executable:t.executable},t.shellArgs&&(o.shell.args=t.shellArgs),t.shellQuoting&&(o.shell.quoting=t.shellQuoting)),o}e.to=i})(ngi||={});var ZRt;(t=>{function a(o){let n=o;return n&&(!!n.commandLine||!!n.command)}t.is=a;function i(o){let n={};return o.name&&Ae(o.name)&&(o.args===void 0||o.args===null||o.args.length===0)?n.commandLine=o.name:(n.command=o.name,n.args=o.args),o.options&&(n.options=ngi.from(o.options)),n}t.from=i;function e(o){let n={runtime:1,name:o.commandLine?o.commandLine:o.command,args:o.args,presentation:void 0};return o.options&&(n.options=ngi.to(o.options)),n}t.to=e})(ZRt||={});var ETe;(t=>{function a(o){let n=o;return n&&n.customExecution==="customExecution"}t.is=a;function i(o){return{customExecution:"customExecution"}}t.from=i;function e(o){return{runtime:3,presentation:void 0}}t.to=e})(ETe||={});var rgi;(e=>{function a(t){let o={label:t.label};return t.kind===gl.Extension?(o.extensionId=t.extension,t.workspaceFolder?o.scope=t.workspaceFolder.uri:o.scope=t.scope):t.kind===gl.Workspace&&(o.extensionId="$core",o.scope=t.config.workspaceFolder?t.config.workspaceFolder.uri:1),o}e.from=a;function i(t,o){let n,r;return t.scope===void 0||typeof t.scope=="number"&&t.scope!==1?o.getWorkspace().folders.length===0?(n=1,r=void 0):(n=3,r=o.getWorkspace().folders[0]):typeof t.scope=="number"?n=t.scope:(n=3,r=o.getWorkspaceFolder(A.revive(t.scope))??void 0),{kind:gl.Extension,label:t.label,extension:t.extensionId,scope:n,workspaceFolder:r}}e.to=i})(rgi||={});var sgi;(i=>{function a(e){let t=e;return!!t&&Ae(t.id)&&!!t.workspaceFolder}i.is=a})(sgi||={});var $_;(e=>{function a(t){if(t==null||!pd.is(t)&&!bh.is(t)&&!tf.is(t))return;let o={_id:t._id,name:t.configurationProperties.name,definition:egi.from(t.getDefinition(!0)),source:rgi.from(t._source),execution:void 0,presentationOptions:!tf.is(t)&&t.command?tgi.from(t.command.presentation):void 0,isBackground:t.configurationProperties.isBackground,problemMatchers:[],hasDefinedMatchers:bh.is(t)?t.hasDefinedMatchers:!1,runOptions:igi.from(t.runOptions)};if(o.group=Rto.from(t.configurationProperties.group),t.configurationProperties.detail&&(o.detail=t.configurationProperties.detail),!tf.is(t)&&t.command)switch(t.command.runtime){case 2:o.execution=JRt.from(t.command);break;case 1:o.execution=ZRt.from(t.command);break;case 3:o.execution=ETe.from(t.command);break}if(t.configurationProperties.problemMatchers)for(let n of t.configurationProperties.problemMatchers)Ae(n)&&o.problemMatchers.push(n);return o}e.from=a;function i(t,o,n,r,s){if(!t||typeof t.name!="string")return;let l;if(t.execution&&(ZRt.is(t.execution)?l=ZRt.to(t.execution):JRt.is(t.execution)?l=JRt.to(t.execution):ETe.is(t.execution)&&(l=ETe.to(t.execution))),!l)return;l.presentation=tgi.to(t.presentationOptions);let c=rgi.to(t.source,o),u=d(3059,null,c.label,t.name),p=egi.to(t.definition,n),h=ETe.is(t.execution)&&t._id?t._id:`${t.source.extensionId}.${p._key}`;return new bh(h,c,u,p.type,p,l,t.hasDefinedMatchers,igi.to(t.runOptions),{name:t.name,identifier:u,group:t.group,isBackground:!!t.isBackground,problemMatchers:t.problemMatchers.slice(),detail:t.detail,icon:r,hide:s})}e.to=i})($_||={});var Rto;(i=>{function a(e){if(e!==void 0)return{_id:typeof e=="string"?e:e._id,isDefault:typeof e=="string"||typeof e.isDefault=="string"?!1:e.isDefault}}i.from=a})(Rto||={});var Mto;(e=>{function a(t){return t}e.from=a;function i(t){return t}e.to=i})(Mto||={});var XRt=class extends C{constructor(e,t,o,n){super();this._taskService=t;this._workspaceContextServer=o;this._configurationResolverService=n;this._proxy=e.getProxy(Zi.ExtHostTask),this._providers=new Map,this._register(this._taskService.onDidStateChange(async r=>{if(r.kind==="changed")return;let s=r.__task;if(r.kind==="start"){let l=Jhi.from(s.getTaskExecution()),c=l.task.definition;if(l.task?.execution&&ETe.is(l.task.execution)&&r.resolvedVariables){let u=cS.parse(l.task.definition);for(let p of u.unresolved()){let h=r.resolvedVariables.get(p.inner);h!==void 0&&u.resolve(p,h)}c=await this._configurationResolverService.resolveAsync(s.getWorkspaceFolder(),u)}this._proxy.$onDidStartTask(l,r.terminalId,c)}else r.kind==="processStarted"?this._proxy.$onDidStartTaskProcess(Dto.from(s.getTaskExecution(),r.processId)):r.kind==="processEnded"?this._proxy.$onDidEndTaskProcess(Lto.from(s.getTaskExecution(),r.exitCode)):r.kind==="end"?this._proxy.$OnDidEndTask(Jhi.from(s.getTaskExecution())):r.kind==="problemMatcherStarted"?this._proxy.$onDidStartTaskProblemMatchers(_to.from({execution:s.getTaskExecution()})):r.kind==="problemMatcherEnded"?this._proxy.$onDidEndTaskProblemMatchers(Zhi.from({execution:s.getTaskExecution(),hasErrors:!1})):r.kind==="problemMatcherFoundErrors"&&this._proxy.$onDidEndTaskProblemMatchers(Zhi.from({execution:s.getTaskExecution(),hasErrors:!0}))}))}dispose(){for(let e of this._providers.values())e.disposable.dispose();this._providers.clear(),super.dispose()}$createTaskId(e){return new Promise((t,o)=>{let n=$_.to(e,this._workspaceContextServer,!0);n?t(n._id):o(new Error("Task could not be created from DTO"))})}$registerTaskProvider(e,t){let o={provideTasks:r=>Promise.resolve(this._proxy.$provideTasks(e,r)).then(s=>{let l=[];for(let u of s.tasks){let p=$_.to(u,this._workspaceContextServer,!0);p?l.push(p):console.error(`Task System: can not convert task: ${JSON.stringify(u.definition,void 0,0)}. Task will be dropped`)}let c={...s.extension,extensionLocation:A.revive(s.extension.extensionLocation)};return{tasks:l,extension:c}}),resolveTask:r=>{let s=$_.from(r);return s?(s.name=s.name===void 0?"":s.name,Promise.resolve(this._proxy.$resolveTask(e,s)).then(l=>{if(l)return $_.to(l,this._workspaceContextServer,!0,r.configurationProperties.icon,r.configurationProperties.hide)})):Promise.resolve(void 0)}},n=this._taskService.registerTaskProvider(o,t);return this._providers.set(e,{disposable:n,provider:o}),Promise.resolve(void 0)}$unregisterTaskProvider(e){let t=this._providers.get(e);return t&&(t.disposable.dispose(),this._providers.delete(e)),Promise.resolve(void 0)}$fetchTasks(e){return this._taskService.tasks(Mto.to(e)).then(t=>{let o=[];for(let n of t){let r=$_.from(n);r&&o.push(r)}return o})}getWorkspace(e){let t;if(typeof e=="string")t=e;else{let o=this._workspaceContextServer.getWorkspace(),n=A.revive(e);o.configuration?.toString()===n.toString()?t=o:t=this._workspaceContextServer.getWorkspaceFolder(n)}return t}async $getTaskExecution(e){if(sgi.is(e)){let t=this.getWorkspace(e.workspaceFolder);if(t){let o=await this._taskService.getTask(t,e.id,!0);if(o)return{id:o._id,task:$_.from(o)};throw new Error("Task not found")}else throw new Error("No workspace folder")}else{let t=$_.to(e,this._workspaceContextServer,!0);return{id:t._id,task:$_.from(t)}}}$executeTask(e){return new Promise((t,o)=>{if(sgi.is(e)){let n=this.getWorkspace(e.workspaceFolder);n?this._taskService.getTask(n,e.id,!0).then(r=>{if(!r)o(new Error("Task not found"));else{let s={id:e.id,task:$_.from(r)};this._taskService.run(r).then(l=>{(l?.exitCode===void 0||l.exitCode!==0)&&this._proxy.$OnDidEndTask(s)},l=>{}),t(s)}},r=>{o(new Error("Task not found"))}):o(new Error("No workspace folder"))}else{let n=$_.to(e,this._workspaceContextServer,!0);this._taskService.run(n).then(void 0,s=>{});let r={id:n._id,task:$_.from(n)};t(r)}})}$customExecutionComplete(e,t){return new Promise((o,n)=>{this._taskService.getActiveTasks().then(r=>{for(let s of r)if(e===s._id){this._taskService.extensionCallbackTaskComplete(s,t).then(l=>{o(void 0)},l=>{n(l)});return}n(new Error("Task to mark as complete not found"))})})}$terminateTask(e){return new Promise((t,o)=>{this._taskService.getActiveTasks().then(n=>{for(let r of n)if(e===r._id){this._taskService.terminate(r).then(s=>{t(void 0)},s=>{o(void 0)});return}o(new Zs("Task to terminate not found"))})})}$registerTaskSystem(e,t){let o;switch(t.platform){case"Web":o=0;break;case"win32":o=3;break;case"darwin":o=1;break;case"linux":o=2;break;default:o=Pp}this._taskService.registerTaskSystem(e,{platform:o,uriProvider:n=>A.from({scheme:t.scheme,authority:t.authority,path:n}),context:this._extHostContext,resolveVariables:(n,r,s)=>{let l=[];return r.variables.forEach(c=>l.push(c)),Promise.resolve(this._proxy.$resolveVariables(n.uri,{process:r.process,variables:l})).then(c=>{let u=Array.from(Object.values(c.variables));return new Promise((p,h)=>{this._configurationResolverService.resolveWithInteraction(n,u,"tasks",void 0,s).then(g=>{g||p(void 0);let f={process:void 0,variables:new Map};for(let v=0;v<u.length;v++){let b=l[v].substring(2,l[v].length-1);if(g&&c.variables[l[v]]===l[v]){let S=g.get(b);typeof S=="string"&&f.variables.set(b,S)}else f.variables.set(b,u[v])}Ae(c.process)&&(f.process=c.process),p(f)},g=>{h(g)})})})},findExecutable:(n,r,s)=>this._proxy.$findExecutable(n,r,s)})}async $registerSupportedExecutions(e,t,o){return this._taskService.registerSupportedExecutions(e,t,o)}};XRt=I([vo(Gi.MainThreadTask),m(1,yg),m(2,Pe),m(3,sp)],XRt);var eMt=class extends C{constructor(e,t){super();this._labelService=t;this._resourceLabelFormatters=this._register(new jt)}$registerResourceLabelFormatter(e,t){t.priority=!0;let o=this._labelService.registerCachedFormatter(t);this._resourceLabelFormatters.set(e,o)}$unregisterResourceLabelFormatter(e){this._resourceLabelFormatters.deleteAndDispose(e)}};eMt=I([vo(Gi.MainThreadLabelService),m(1,ot)],eMt);var ap=ae("tunnelService"),YLl=ae("sharedTunnelsService");function agi(a){let i=a;return!!(i.tunnelRemotePort&&i.tunnelRemoteHost&&i.localAddress&&i.privacy&&i.dispose)}function Pto(a){return!!a.forwardPort}function DTe(a){if(a.scheme!=="http"&&a.scheme!=="https")return;let i=/^(localhost|127\.0\.0\.1|0\.0\.0\.0):(\d+)$/.exec(a.authority);if(i)return{address:i[1],port:+i[2]}}function Ato(a){if(a.scheme!=="http"&&a.scheme!=="https"||!a.query)return;let i=a.query.split("&");for(let e of i){let t=e.split("=")[1];if(/^https?:/.exec(t)){let o=DTe(A.parse(t));if(o)return o}}}var _Te=["localhost","127.0.0.1","0:0:0:0:0:0:0:1","::1"];function jX(a){return _Te.indexOf(a)>=0}var O9e=["0.0.0.0","0:0:0:0:0:0:0:0","::"];function M5(a){return O9e.indexOf(a)>=0}function Nto(a,i,e,t){if(e===1)return!1;if(e===2&&M5(i)){let o=/(\d+)\.(\d+)\.(\d+)/g.exec(t);if(o?.length===4&&parseInt(o[1])>=18)return!1}return a<1024}var tMt=class{constructor(i,e,t){this.remoteAddress=i;this.localAddress=e;this._dispose=t;this._onDispose=new E;this.onDidDispose=this._onDispose.event}dispose(){return this._onDispose.fire(),this._onDispose.dispose(),this._dispose()}},TTe=class extends C{constructor(e,t){super();this.logService=e;this.configurationService=t;this._onTunnelOpened=this._register(new E);this.onTunnelOpened=this._onTunnelOpened.event;this._onTunnelClosed=this._register(new E);this.onTunnelClosed=this._onTunnelClosed.event;this._onAddedTunnelProvider=this._register(new E);this.onAddedTunnelProvider=this._onAddedTunnelProvider.event;this._tunnels=new Map;this._canElevate=!1;this._canChangeProtocol=!0;this._privacyOptions=[];this._factoryInProgress=new Set}get hasTunnelProvider(){return!!this._tunnelProvider}get defaultTunnelHost(){let e=this.configurationService.getValue("remote.localPortHost");return!e||e==="localhost"?"127.0.0.1":"0.0.0.0"}setTunnelProvider(e){return this._tunnelProvider=e,e?(this._onAddedTunnelProvider.fire(),{dispose:()=>{this._tunnelProvider=void 0,this._canElevate=!1,this._privacyOptions=[]}}):(this._canElevate=!1,this._privacyOptions=[],this._onAddedTunnelProvider.fire(),{dispose:()=>{}})}setTunnelFeatures(e){this._canElevate=e.elevation,this._privacyOptions=e.privacyOptions,this._canChangeProtocol=e.protocol}get canChangeProtocol(){return this._canChangeProtocol}get canElevate(){return this._canElevate}get canChangePrivacy(){return this._privacyOptions.length>0}get privacyOptions(){return this._privacyOptions}get tunnels(){return this.getTunnels()}async getTunnels(){let e=[],t=Array.from(this._tunnels.values());for(let o of t){let n=Array.from(o.values());for(let r of n){let s=await r.value;s&&typeof s!="string"&&e.push(s)}}return e}async dispose(){super.dispose();for(let e of this._tunnels.values()){for(let{value:t}of e.values())await t.then(o=>typeof o!="string"?o?.dispose():void 0);e.clear()}this._tunnels.clear()}setEnvironmentTunnel(e,t,o,n,r){this.addTunnelToMap(e,t,Promise.resolve({tunnelRemoteHost:e,tunnelRemotePort:t,localAddress:o,privacy:n,protocol:r,dispose:()=>Promise.resolve()}))}async getExistingTunnel(e,t){(M5(e)||jX(e))&&(e=_Te[0]);let o=this.getTunnelFromMap(e,t);if(o)return++o.refcount,o.value}openTunnel(e,t,o,n,r,s=!1,l,c){this.logService.trace(`ForwardedPorts: (TunnelService) openTunnel request for ${t}:${o} on local port ${r}.`);let u=this._tunnelProvider??e;if(!u)return;if(t||(t="localhost"),n||(n=this.defaultTunnelHost),this._tunnelProvider&&this._factoryInProgress.has(o)){this.logService.debug("ForwardedPorts: (TunnelService) Another call to create a tunnel with the same address has occurred before the last one completed. This call will be ignored.");return}let p=this.retainOrCreateTunnel(u,t,o,n,r,s,l,c);return p?p.then(h=>{if(h){if(typeof h=="string")return this.logService.trace("ForwardedPorts: (TunnelService) The tunnel provider returned an error when creating the tunnel."),this.removeEmptyOrErrorTunnelFromMap(t,o),h}else{this.logService.trace("ForwardedPorts: (TunnelService) New tunnel is undefined."),this.removeEmptyOrErrorTunnelFromMap(t,o);return}this.logService.trace("ForwardedPorts: (TunnelService) New tunnel established.");let g=this.makeTunnel(h);return(h.tunnelRemoteHost!==t||h.tunnelRemotePort!==o)&&this.logService.warn("ForwardedPorts: (TunnelService) Created tunnel does not match requirements of requested tunnel. Host or port mismatch."),l&&h.privacy!==l&&this.logService.warn("ForwardedPorts: (TunnelService) Created tunnel does not match requirements of requested tunnel. Privacy mismatch."),this._onTunnelOpened.fire(g),g}):(this.logService.trace("ForwardedPorts: (TunnelService) Tunnel was not created."),p)}makeTunnel(e){return{tunnelRemotePort:e.tunnelRemotePort,tunnelRemoteHost:e.tunnelRemoteHost,tunnelLocalPort:e.tunnelLocalPort,localAddress:e.localAddress,privacy:e.privacy,protocol:e.protocol,dispose:async()=>{this.logService.trace(`ForwardedPorts: (TunnelService) dispose request for ${e.tunnelRemoteHost}:${e.tunnelRemotePort} `);let t=this._tunnels.get(e.tunnelRemoteHost);if(t){let o=t.get(e.tunnelRemotePort);o&&(o.refcount--,await this.tryDisposeTunnel(e.tunnelRemoteHost,e.tunnelRemotePort,o))}}}}async tryDisposeTunnel(e,t,o){if(o.refcount<=0){this.logService.trace(`ForwardedPorts: (TunnelService) Tunnel is being disposed ${e}:${t}.`);let n=o.value.then(async r=>{r&&typeof r!="string"&&(await r.dispose(!0),this._onTunnelClosed.fire({host:r.tunnelRemoteHost,port:r.tunnelRemotePort}))});return this._tunnels.has(e)&&this._tunnels.get(e).delete(t),n}}async closeTunnel(e,t){this.logService.trace(`ForwardedPorts: (TunnelService) close request for ${e}:${t} `);let o=this._tunnels.get(e);if(o&&o.has(t)){let n=o.get(t);n.refcount=0,await this.tryDisposeTunnel(e,t,n)}}addTunnelToMap(e,t,o){this._tunnels.has(e)||this._tunnels.set(e,new Map),this._tunnels.get(e).set(t,{refcount:1,value:o})}async removeEmptyOrErrorTunnelFromMap(e,t){let o=this._tunnels.get(e);if(o){let n=o.get(t),r=n?await n.value:void 0;(!r||typeof r=="string")&&o.delete(t),o.size===0&&this._tunnels.delete(e)}}getTunnelFromMap(e,t){let o=[e];jX(e)?(o.push(..._Te),o.push(...O9e)):M5(e)&&o.push(...O9e);let n=o.map(r=>this._tunnels.get(r));for(let r of n){let s=r?.get(t);if(s)return s}}canTunnel(e){return!!DTe(e)}createWithProvider(e,t,o,n,r,s,l){this.logService.trace(`ForwardedPorts: (TunnelService) Creating tunnel with provider ${t}:${o} on local port ${n}.`);let c=o;this._factoryInProgress.add(c);let u=n===void 0?o:n,p={elevationRequired:r?this.isPortPrivileged(u):!1},h={remoteAddress:{host:t,port:o},localAddressPort:n,privacy:s,public:s?s!=="private":void 0,protocol:l},g=e.forwardPort(h,p);return g?(this.addTunnelToMap(t,o,g),g.finally(()=>{this.logService.trace("ForwardedPorts: (TunnelService) Tunnel created by provider."),this._factoryInProgress.delete(c)})):this._factoryInProgress.delete(c),g}};TTe=I([m(0,ne),m(1,B)],TTe);var Oto=ae("IExtHostInitDataService");var Fto=ae("IExtHostRpcService");var lgi=class extends tMt{},oMt;(e=>{function a(t){return{remoteAddress:t.remoteAddress,localAddress:t.localAddress,public:!!t.public,privacy:t.privacy??(t.public?"public":"private"),protocol:t.protocol}}e.fromApiTunnel=a;function i(t){return{remoteAddress:{host:t.tunnelRemoteHost,port:t.tunnelRemotePort},localAddress:t.localAddress,public:t.privacy!=="constantPrivate"&&t.privacy!=="constantPrivate",privacy:t.privacy,protocol:t.protocol}}e.fromServiceTunnel=i})(oMt||={});var wRl=ae("IExtHostTunnelService"),iMt=class extends C{constructor(e,t,o){super();this.logService=o;this._showCandidatePort=()=>Promise.resolve(!0);this._extensionTunnels=new Map;this._onDidChangeTunnels=this._register(new E);this.onDidChangeTunnels=this._onDidChangeTunnels.event;this._providerHandleCounter=0;this._portAttributesProviders=new Map;this._proxy=e.getProxy(Gi.MainThreadTunnelService)}async openTunnel(e,t){this.logService.trace(`ForwardedPorts: (ExtHostTunnelService) ${e.identifier.value} called openTunnel API for ${t.remoteAddress.host}:${t.remoteAddress.port}.`);let o=await this._proxy.$openTunnel(t,e.displayName);if(o){let n=new lgi(o.remoteAddress,o.localAddress,()=>this._proxy.$closeTunnel(o.remoteAddress));return this._register(n),n}}async getTunnels(){return this._proxy.$getTunnels()}nextPortAttributesProviderHandle(){return this._providerHandleCounter++}registerPortsAttributesProvider(e,t){e.portRange===void 0&&e.commandPattern===void 0&&this.logService.error("PortAttributesProvider must specify either a portRange or a commandPattern");let o=this.nextPortAttributesProviderHandle();return this._portAttributesProviders.set(o,{selector:e,provider:t}),this._proxy.$registerPortsAttributesProvider(e,o),new uY(()=>{this._portAttributesProviders.delete(o),this._proxy.$unregisterPortsAttributesProvider(o)})}async $providePortAttributes(e,t,o,n,r){let s=[];for(let c of e){let u=this._portAttributesProviders.get(c);if(!u)return[];s.push(...await Promise.all(t.map(async p=>{let h;try{h=await u.provider.providePortAttributes({port:p,pid:o,commandLine:n},r)}catch{h=await u.provider.providePortAttributes(p,o,n,r)}return{providedAttributes:h,port:p}})))}let l=s.filter(c=>!!c.providedAttributes);return l.length>0?l.map(c=>({autoForwardAction:c.providedAttributes.autoForwardAction,port:c.port})):[]}async $registerCandidateFinder(e){}registerTunnelProvider(e,t){if(this._forwardPortProvider)throw new Error("A tunnel provider has already been registered. Only the first tunnel provider to be registered will be used.");this._forwardPortProvider=async(n,r)=>await e.provideTunnel(n,r,ve.None)??void 0;let o=t.tunnelFeatures?{elevation:!!t.tunnelFeatures?.elevation,privacyOptions:t.tunnelFeatures?.privacyOptions,protocol:t.tunnelFeatures.protocol===void 0?!0:t.tunnelFeatures.protocol}:void 0;return this._proxy.$setTunnelProvider(o,!0),Promise.resolve(Z(()=>{this._forwardPortProvider=void 0,this._proxy.$setTunnelProvider(void 0,!1)}))}hasTunnelProvider(){return this._proxy.$hasTunnelProvider()}async setTunnelFactory(e,t){if(e){e.candidatePortSource!==void 0&&this._proxy.$setCandidatePortSource(e.candidatePortSource),e.showCandidatePort&&(this._showCandidatePort=e.showCandidatePort,this._proxy.$setCandidateFilter());let o=e.tunnelFactory??(t?this.makeManagedTunnelFactory(t):void 0);if(o){this._forwardPortProvider=o;let n=e.tunnelFeatures?.privacyOptions??[];e.tunnelFeatures?.public&&n.length===0&&(n=[{id:"private",label:d(3211,null),themeIcon:"lock"},{id:"public",label:d(3212,null),themeIcon:"eye"}]);let r=e.tunnelFeatures?{elevation:!!e.tunnelFeatures?.elevation,public:!!e.tunnelFeatures?.public,privacyOptions:n,protocol:!0}:void 0;this._proxy.$setTunnelProvider(r,!!e.tunnelFactory)}}else this._forwardPortProvider=void 0;return Z(()=>{this._forwardPortProvider=void 0})}makeManagedTunnelFactory(e){}async $closeTunnel(e,t){if(this._extensionTunnels.has(e.host)){let o=this._extensionTunnels.get(e.host);o.has(e.port)&&(t&&o.get(e.port).disposeListener.dispose(),await o.get(e.port).tunnel.dispose(),o.delete(e.port))}}async $onDidTunnelsChange(){this._onDidChangeTunnels.fire()}async $forwardPort(e,t){if(this._forwardPortProvider)try{this.logService.trace("ForwardedPorts: (ExtHostTunnelService) Getting tunnel from provider.");let o=this._forwardPortProvider(e,t);if(this.logService.trace("ForwardedPorts: (ExtHostTunnelService) Got tunnel promise from provider."),o!==void 0){let n=await o;if(this.logService.trace("ForwardedPorts: (ExtHostTunnelService) Successfully awaited tunnel from provider."),n===void 0){this.logService.error("ForwardedPorts: (ExtHostTunnelService) Resolved tunnel is undefined");return}this._extensionTunnels.has(e.remoteAddress.host)||this._extensionTunnels.set(e.remoteAddress.host,new Map);let r=this._register(n.onDidDispose(()=>(this.logService.trace("ForwardedPorts: (ExtHostTunnelService) Extension fired tunnel's onDidDispose."),this._proxy.$closeTunnel(n.remoteAddress))));return this._extensionTunnels.get(e.remoteAddress.host).set(e.remoteAddress.port,{tunnel:n,disposeListener:r}),oMt.fromApiTunnel(n)}else this.logService.trace("ForwardedPorts: (ExtHostTunnelService) Tunnel is undefined")}catch(o){if(this.logService.trace("ForwardedPorts: (ExtHostTunnelService) tunnel provider error"),o instanceof Error)return o.message}}async $applyCandidateFilter(e){let t=await Promise.all(e.map(n=>this._showCandidatePort(n.host,n.port,n.detail??""))),o=e.filter((n,r)=>t[r]);return this.logService.trace(`ForwardedPorts: (ExtHostTunnelService) filtered from ${e.map(n=>n.port).join(", ")} to ${o.map(n=>n.port).join(", ")}`),o}};iMt=I([m(0,Fto),m(1,Oto),m(2,ne)],iMt);var fGo=10*1e3,nMt="remote.tunnels.toRestore",cgi="remote.tunnels.toRestoreExpiration",vGo=1e3*60*60*24*14,Wto="onTunnel",Kde=new Q("forwardedPortsViewEnabled",!1,d(17195,null)),Xz=new Q("forwardedPortsViewOnlyEnabled",!1,d(17195,null));function W9e(a){let i=a.match(/^([a-zA-Z0-9_-]+(?:\.[a-zA-Z0-9_-]+)*:)?([0-9]+)$/);if(i)return{host:i[1]?.substring(0,i[1].length-1)||"localhost",port:Number(i[2])}}var dgi={source:0,description:d(17197,null)},sMt={source:1,description:d(17196,null)};function Vto(a,i,e){let t=a.get(Tp(i,e));if(t)return t;if(jX(i))for(let o of _Te){let n=Tp(o,e);if(a.has(n))return a.get(n)}else if(M5(i))for(let o of O9e){let n=Tp(o,e);if(a.has(n))return a.get(n)}}function Ib(a,i,e){let t=Vto(a,i,e);if(t)return t;let o=M5(i)?"localhost":jX(i)?"0.0.0.0":void 0;if(o)return Vto(a,o,e)}function Tp(a,i){return a+":"+i}function bGo(a){return a&&"host"in a&&typeof a.host=="string"&&"port"in a&&typeof a.port=="number"&&(!("detail"in a)||typeof a.detail=="string")&&(!("pid"in a)||typeof a.pid=="string")}var rMt=class a extends C{constructor(e){super();this.configurationService=e;this.portsAttributes=[];this._onDidChangeAttributes=this._register(new E);this.onDidChangeAttributes=this._onDidChangeAttributes.event;this._register(e.onDidChangeConfiguration(t=>{(t.affectsConfiguration(a.SETTING)||t.affectsConfiguration(a.DEFAULTS))&&this.updateAttributes()})),this.updateAttributes()}static{this.SETTING="remote.portsAttributes"}static{this.DEFAULTS="remote.otherPortsAttributes"}static{this.RANGE=/^(\d+)\-(\d+)$/}static{this.HOST_AND_PORT=/^([a-z0-9\-]+):(\d{1,5})$/}updateAttributes(){this.portsAttributes=this.readSetting(),this._onDidChangeAttributes.fire()}getAttributes(e,t,o){let n=this.findNextIndex(e,t,o,this.portsAttributes,0),r={label:void 0,onAutoForward:void 0,elevateIfNeeded:void 0,requireLocalPort:void 0,protocol:void 0};for(;n>=0;){let s=this.portsAttributes[n];s.key===e?(r.onAutoForward=s.onAutoForward??r.onAutoForward,r.elevateIfNeeded=s.elevateIfNeeded!==void 0?s.elevateIfNeeded:r.elevateIfNeeded,r.label=s.label??r.label,r.requireLocalPort=s.requireLocalPort,r.protocol=s.protocol):(r.onAutoForward=r.onAutoForward??s.onAutoForward,r.elevateIfNeeded=r.elevateIfNeeded!==void 0?r.elevateIfNeeded:s.elevateIfNeeded,r.label=r.label??s.label,r.requireLocalPort=r.requireLocalPort!==void 0?r.requireLocalPort:void 0,r.protocol=r.protocol??s.protocol),n=this.findNextIndex(e,t,o,this.portsAttributes,n+1)}return r.onAutoForward!==void 0||r.elevateIfNeeded!==void 0||r.label!==void 0||r.requireLocalPort!==void 0||r.protocol!==void 0?r:this.getOtherAttributes()}hasStartEnd(e){return e.start!==void 0&&e.end!==void 0}hasHostAndPort(e){return e.host!==void 0&&e.port!==void 0&&Ae(e.host)&&Xo(e.port)}findNextIndex(e,t,o,n,r){if(r>=n.length)return-1;let s=!jX(t)&&!M5(t),c=n.slice(r).findIndex(u=>Xo(u.key)?s?!1:u.key===e:this.hasStartEnd(u.key)?s?!1:e>=u.key.start&&e<=u.key.end:this.hasHostAndPort(u.key)?e===u.key.port&&t===u.key.host:o?u.key.test(o):!1);return c>=0?c+r:-1}readSetting(){let e=this.configurationService.getValue(a.SETTING);if(!e||!yi(e))return[];let t=[];for(let n in e){if(n===void 0)continue;let r=e[n],s;if(Number(n))s=Number(n);else if(Ae(n))if(a.RANGE.test(n)){let l=n.match(a.RANGE);s={start:Number(l[1]),end:Number(l[2])}}else if(a.HOST_AND_PORT.test(n)){let l=n.match(a.HOST_AND_PORT);s={host:l[1],port:Number(l[2])}}else{let l;try{l=RegExp(n)}catch{}l&&(s=l)}s&&t.push({key:s,elevateIfNeeded:r.elevateIfNeeded,onAutoForward:r.onAutoForward,label:r.label,requireLocalPort:r.requireLocalPort,protocol:r.protocol})}let o=this.configurationService.getValue(a.DEFAULTS);return o&&(this.defaultPortAttributes={elevateIfNeeded:o.elevateIfNeeded,label:o.label,onAutoForward:o.onAutoForward,requireLocalPort:o.requireLocalPort,protocol:o.protocol}),this.sortAttributes(t)}sortAttributes(e){function t(o,n){return Xo(o.key)?o.key:n.hasStartEnd(o.key)?o.key.start:n.hasHostAndPort(o.key)?o.key.port:Number.MAX_VALUE}return e.sort((o,n)=>t(o,this)-t(n,this))}getOtherAttributes(){return this.defaultPortAttributes}static providedActionToAction(e){switch(e){case 1:return"notify";case 2:return"openBrowser";case 6:return"openBrowserOnce";case 3:return"openPreview";case 4:return"silent";case 5:return"ignore";default:return}}async addAttributes(e,t,o){let r=this.configurationService.inspect(a.SETTING).userRemoteValue,s;!r||!yi(r)?s={}:s=Xi(r),s[`${e}`]||(s[`${e}`]={});for(let l in t)s[`${e}`][l]=t[l];return this.configurationService.updateValue(a.SETTING,s,o)}},zde=class extends C{constructor(e,t,o,n,r,s,l,c,u,p){super();this.tunnelService=e;this.storageService=t;this.configurationService=o;this.environmentService=n;this.remoteAuthorityResolverService=r;this.workspaceContextService=s;this.logService=l;this.dialogService=c;this.extensionService=u;this.contextKeyService=p;this.inProgress=new Map;this._onForwardPort=this._register(new E);this.onForwardPort=this._onForwardPort.event;this._onClosePort=this._register(new E);this.onClosePort=this._onClosePort.event;this._onPortName=this._register(new E);this.onPortName=this._onPortName.event;this._onCandidatesChanged=this._register(new E);this.onCandidatesChanged=this._onCandidatesChanged.event;this._onEnvironmentTunnelsSet=this._register(new E);this.onEnvironmentTunnelsSet=this._onEnvironmentTunnelsSet.event;this._environmentTunnelsSet=!1;this.restoreListener=void 0;this.restoreComplete=!1;this.onRestoreComplete=this._register(new E);this.unrestoredExtensionTunnels=new Map;this.sessionCachedProperties=new Map;this.portAttributesProviders=[];this.hasCheckedExtensionsOnTunnelOpened=!1;this.mismatchCooldown=new Date;this.configPortsAttributes=new rMt(o),this.tunnelRestoreValue=this.getTunnelRestoreValue(),this._register(this.configPortsAttributes.onDidChangeAttributes(this.updateAttributes,this)),this.forwarded=new Map,this.remoteTunnels=new Map,this.tunnelService.tunnels.then(async h=>{let g=await this.getAttributes(h.map(f=>({port:f.tunnelRemotePort,host:f.tunnelRemoteHost})));for(let f of h)if(f.localAddress){let v=Tp(f.tunnelRemoteHost,f.tunnelRemotePort),b=Ib(this._candidates??new Map,f.tunnelRemoteHost,f.tunnelRemotePort);this.forwarded.set(v,{remotePort:f.tunnelRemotePort,remoteHost:f.tunnelRemoteHost,localAddress:f.localAddress,protocol:g?.get(f.tunnelRemotePort)?.protocol??"http",localUri:await this.makeLocalUri(f.localAddress,g?.get(f.tunnelRemotePort)),localPort:f.tunnelLocalPort,name:g?.get(f.tunnelRemotePort)?.label,runningProcess:b?.detail,hasRunningProcess:!!b,pid:b?.pid,privacy:f.privacy,source:dgi}),this.remoteTunnels.set(v,f)}}),this.detected=new Map,this._register(this.tunnelService.onTunnelOpened(async h=>{let g=Tp(h.tunnelRemoteHost,h.tunnelRemotePort);if(!Ib(this.forwarded,h.tunnelRemoteHost,h.tunnelRemotePort)&&!Ib(this.detected,h.tunnelRemoteHost,h.tunnelRemotePort)&&!Ib(this.inProgress,h.tunnelRemoteHost,h.tunnelRemotePort)&&h.localAddress){let f=Ib(this._candidates??new Map,h.tunnelRemoteHost,h.tunnelRemotePort),v=(await this.getAttributes([{port:h.tunnelRemotePort,host:h.tunnelRemoteHost}]))?.get(h.tunnelRemotePort);this.forwarded.set(g,{remoteHost:h.tunnelRemoteHost,remotePort:h.tunnelRemotePort,localAddress:h.localAddress,protocol:v?.protocol??"http",localUri:await this.makeLocalUri(h.localAddress,v),localPort:h.tunnelLocalPort,name:v?.label,closeable:!0,runningProcess:f?.detail,hasRunningProcess:!!f,pid:f?.pid,privacy:h.privacy,source:dgi})}await this.storeForwarded(),this.checkExtensionActivationEvents(!0),this.remoteTunnels.set(g,h),this._onForwardPort.fire(this.forwarded.get(g))})),this._register(this.tunnelService.onTunnelClosed(h=>this.onTunnelClosed(h,"Other"))),this.checkExtensionActivationEvents(!1)}extensionHasActivationEvent(){return this.extensionService.extensions.find(e=>e.activationEvents?.includes(Wto))?(this.contextKeyService.createKey(Xz.key,!0),!0):!1}checkExtensionActivationEvents(e){if(this.hasCheckedExtensionsOnTunnelOpened||(e&&(this.hasCheckedExtensionsOnTunnelOpened=!0),this.environmentService.remoteAuthority!==void 0&&!e)||this.extensionHasActivationEvent())return;let o=this._register(this.extensionService.onDidRegisterExtensions(()=>{this.extensionHasActivationEvent()&&o.dispose()}))}async onTunnelClosed(e,t){let o=Tp(e.host,e.port);this.forwarded.delete(o)&&(await this.storeForwarded(),this._onClosePort.fire(e))}makeLocalUri(e,t){if(e.startsWith("http"))return A.parse(e);let o=t?.protocol??"http";return A.parse(`${o}://${e}`)}async addStorageKeyPostfix(e){let t=this.workspaceContextService.getWorkspace(),o=t.configuration?Ir(t.configuration.path):t.folders.length>0?Ir(t.folders[0].uri.path):void 0;if(o===void 0){this.logService.debug("Could not get workspace hash for forwarded ports storage key.");return}return`${e}.${this.environmentService.remoteAuthority}.${o}`}async getTunnelRestoreStorageKey(){return this.addStorageKeyPostfix(nMt)}async getRestoreExpirationStorageKey(){return this.addStorageKeyPostfix(cgi)}async getTunnelRestoreValue(){let e=this.storageService.get(nMt,1);if(e)return this.storageService.remove(nMt,1),await this.storeForwarded(),e;let t=await this.getTunnelRestoreStorageKey();if(t)return this.storageService.get(t,0)}async restoreForwarded(){if(this.cleanupExpiredTunnelsForRestore(),this.configurationService.getValue("remote.restoreForwardedPorts")){let e=await this.tunnelRestoreValue;if(e&&e!==this.knownPortsRestoreValue){let t=JSON.parse(e)??[];this.logService.trace(`ForwardedPorts: (TunnelModel) restoring ports ${t.map(o=>o.remotePort).join(", ")}`);for(let o of t){let n=Ib(this.detected,o.remoteHost,o.remotePort);o.source.source!==2&&!n||o.source.source===2&&n?await this.doForward({remote:{host:o.remoteHost,port:o.remotePort},local:o.localPort,name:o.name,elevateIfNeeded:!0,source:o.source}):o.source.source===2&&!n&&this.unrestoredExtensionTunnels.set(Tp(o.remoteHost,o.remotePort),o)}}}if(this.restoreComplete=!0,this.onRestoreComplete.fire(),!this.restoreListener){let e=await this.getTunnelRestoreStorageKey();this.restoreListener=this._register(new P),this.restoreListener.add(this.storageService.onDidChangeValue(0,void 0,this.restoreListener)(async t=>{t.key===e&&(this.tunnelRestoreValue=Promise.resolve(this.storageService.get(e,0)),await this.restoreForwarded())}))}}cleanupExpiredTunnelsForRestore(){let e=this.storageService.keys(0,0).filter(t=>t.startsWith(cgi));for(let t of e){let o=this.storageService.getNumber(t,0);if(o&&o<Date.now()){this.tunnelRestoreValue=Promise.resolve(void 0);let n=t.replace(cgi,nMt);this.storageService.remove(t,0),this.storageService.remove(n,0)}}}async storeForwarded(){if(this.configurationService.getValue("remote.restoreForwardedPorts")){let e=Array.from(this.forwarded.values()),t=e.map(s=>({remoteHost:s.remoteHost,remotePort:s.remotePort,localPort:s.localPort,name:s.name,localAddress:s.localAddress,localUri:s.localUri,protocol:s.protocol,source:s.source})),o;e.length>0&&(o=JSON.stringify(t));let n=await this.getTunnelRestoreStorageKey(),r=await this.getRestoreExpirationStorageKey();!o&&n&&r?(this.storageService.remove(n,0),this.storageService.remove(r,0)):o!==this.knownPortsRestoreValue&&n&&r&&(this.storageService.store(n,o,0,0),this.storageService.store(r,Date.now()+vGo,0,0)),this.knownPortsRestoreValue=o}}async showPortMismatchModalIfNeeded(e,t,o){if(!e.tunnelLocalPort||!o?.requireLocalPort||e.tunnelLocalPort===t)return;let n=new Date;if(this.mismatchCooldown.getTime()+fGo>n.getTime())return;this.mismatchCooldown=n;let r=d(17194,null,t,e.tunnelRemotePort,e.tunnelLocalPort);return this.dialogService.info(r)}async forward(e,t){return!this.restoreComplete&&this.environmentService.remoteAuthority&&await H.toPromise(this.onRestoreComplete.event),this.doForward(e,t)}async doForward(e,t){await this.extensionService.activateByEvent(Wto);let o=Ib(this.forwarded,e.remote.host,e.remote.port);t=t??(t!==null?(await this.getAttributes([e.remote]))?.get(e.remote.port):void 0);let n=e.local!==void 0?e.local:e.remote.port,r;if(o)return this.mergeAttributesIntoExistingTunnel(o,e,t);{let s=this.environmentService.remoteAuthority,l=s?{getAddress:async()=>(await this.remoteAuthorityResolverService.resolveAuthority(s)).authority}:void 0,c=Tp(e.remote.host,e.remote.port);this.inProgress.set(c,!0),e=this.mergeCachedAndUnrestoredProperties(c,e);let u=await this.tunnelService.openTunnel(l,e.remote.host,e.remote.port,void 0,n,e.elevateIfNeeded?e.elevateIfNeeded:t?.elevateIfNeeded,e.privacy,t?.protocol);if(typeof u=="string")r=u;else if(u&&u.localAddress){let p=Ib(this._candidates??new Map,e.remote.host,e.remote.port),h=u.protocol?u.protocol==="https"?"https":"http":t?.protocol??"http",g={remoteHost:u.tunnelRemoteHost,remotePort:u.tunnelRemotePort,localPort:u.tunnelLocalPort,name:t?.label??e.name,closeable:!0,localAddress:u.localAddress,protocol:h,localUri:await this.makeLocalUri(u.localAddress,t),runningProcess:p?.detail,hasRunningProcess:!!p,pid:p?.pid,source:e.source??dgi,privacy:u.privacy};return this.forwarded.set(c,g),this.remoteTunnels.set(c,u),this.inProgress.delete(c),await this.storeForwarded(),await this.showPortMismatchModalIfNeeded(u,n,t),this._onForwardPort.fire(g),u}this.inProgress.delete(c)}return r}mergeCachedAndUnrestoredProperties(e,t){let o=this.unrestoredExtensionTunnels.has(e)?this.unrestoredExtensionTunnels:this.sessionCachedProperties.has(e)?this.sessionCachedProperties:void 0;if(o){let n=o.get(e);o.delete(e),n&&(t.name=n.name??t.name,t.local=("local"in n?n.local:"localPort"in n?n.localPort:void 0)??t.local,t.privacy=t.privacy)}return t}async mergeAttributesIntoExistingTunnel(e,t,o){let n=o?.label??t.name,r;(p=>(p[p.None=0]="None",p[p.Fire=1]="Fire",p[p.Reopen=2]="Reopen"))(r||={});let s=0;switch(n!==e.name&&(e.name=n,s=1),(o?.protocol||e.protocol!=="http")&&o?.protocol!==e.protocol&&(t.source=e.source,s=2),t.privacy&&e.privacy!==t.privacy&&(s=2),s){case 1:{this._onForwardPort.fire();break}case 2:await this.close(e.remoteHost,e.remotePort,"User"),await this.doForward(t,o)}return Ib(this.remoteTunnels,t.remote.host,t.remote.port)}async name(e,t,o){let n=Ib(this.forwarded,e,t),r=Tp(e,t);if(n){n.name=o,await this.storeForwarded(),this._onPortName.fire({host:e,port:t});return}else this.detected.has(r)&&(this.detected.get(r).name=o,this._onPortName.fire({host:e,port:t}))}async close(e,t,o){let n=Tp(e,t),r=this.forwarded.get(n);return o==="AutoForwardEnd"&&r&&r.source.source===1&&this.sessionCachedProperties.set(n,{local:r.localPort,name:r.name,privacy:r.privacy}),await this.tunnelService.closeTunnel(e,t),this.onTunnelClosed({host:e,port:t},o)}address(e,t){let o=Tp(e,t);return(this.forwarded.get(o)||this.detected.get(o))?.localAddress}get environmentTunnelsSet(){return this._environmentTunnelsSet}addEnvironmentTunnels(e){if(e)for(let t of e){let o=Ib(this._candidates??new Map,t.remoteAddress.host,t.remoteAddress.port),n=typeof t.localAddress=="string"?t.localAddress:Tp(t.localAddress.host,t.localAddress.port);this.detected.set(Tp(t.remoteAddress.host,t.remoteAddress.port),{remoteHost:t.remoteAddress.host,remotePort:t.remoteAddress.port,localAddress:n,protocol:"http",localUri:this.makeLocalUri(n),closeable:!1,runningProcess:o?.detail,hasRunningProcess:!!o,pid:o?.pid,privacy:"constantPrivate",source:{source:2,description:d(17198,null)}}),this.tunnelService.setEnvironmentTunnel(t.remoteAddress.host,t.remoteAddress.port,n,"constantPrivate","http")}this._environmentTunnelsSet=!0,this._onEnvironmentTunnelsSet.fire(),this._onForwardPort.fire()}setCandidateFilter(e){this._candidateFilter=e}async setCandidates(e){let t=e;this._candidateFilter&&(t=await this._candidateFilter(e));let o=this.updateInResponseToCandidates(t);this.logService.trace(`ForwardedPorts: (TunnelModel) removed candidates ${Array.from(o.values()).map(n=>n.port).join(", ")}`),this._onCandidatesChanged.fire(o)}updateInResponseToCandidates(e){let t=this._candidates??new Map,o=new Map;return this._candidates=o,e.forEach(n=>{let r=Tp(n.host,n.port);o.set(r,{host:n.host,port:n.port,detail:n.detail,pid:n.pid}),t.delete(r);let s=Ib(this.forwarded,n.host,n.port);s&&(s.runningProcess=n.detail,s.hasRunningProcess=!0,s.pid=n.pid)}),t.forEach((n,r)=>{let s=W9e(r);if(!s)return;let l=Ib(this.forwarded,s.host,s.port);l&&(l.runningProcess=void 0,l.hasRunningProcess=!1,l.pid=void 0);let c=Ib(this.detected,s.host,s.port);c&&(c.runningProcess=void 0,c.hasRunningProcess=!1,c.pid=void 0)}),t}get candidates(){return this._candidates?Array.from(this._candidates.values()):[]}get candidatesOrUndefined(){return this._candidates?this.candidates:void 0}async updateAttributes(){let e=Array.from(this.forwarded.values()),t=await this.getAttributes(e.map(o=>({port:o.remotePort,host:o.remoteHost})),!1);if(t)for(let o of e){let n=t.get(o.remotePort);(n?.protocol||o.protocol!=="http")&&n?.protocol!==o.protocol&&await this.doForward({remote:{host:o.remoteHost,port:o.remotePort},local:o.localPort,name:o.name,source:o.source},n),n&&n.label&&n.label!==o.name&&await this.name(o.remoteHost,o.remotePort,n.label)}}async getAttributes(e,t=!0){let o=new Map,n=new Map;e.forEach(u=>{let p=Ib(this._candidates??new Map,_Te[0],u.port)??u;if(p){o.set(u.port,p);let h=bGo(p)?p.pid:void 0;n.has(h)||n.set(h,[]),n.get(h)?.push(u.port)}});let r=new Map;if(e.forEach(u=>{let p=this.configPortsAttributes.getAttributes(u.port,u.host,o.get(u.port)?.detail);p&&r.set(u.port,p)}),this.portAttributesProviders.length===0||!t)return r.size>0?r:void 0;let s=await Promise.all(this.portAttributesProviders.flatMap(u=>Array.from(n.entries()).map(p=>{let h=p[1],g=o.get(h[0]);return u.providePortAttributes(h,g?.pid,g?.detail,ve.None)}))),l=new Map;if(s.forEach(u=>u.forEach(p=>{p&&l.set(p.port,p)})),!r&&!l)return;let c=new Map;return e.forEach(u=>{let p=r.get(u.port),h=l.get(u.port);c.set(u.port,{elevateIfNeeded:p?.elevateIfNeeded,label:p?.label,onAutoForward:p?.onAutoForward??rMt.providedActionToAction(h?.autoForwardAction),requireLocalPort:p?.requireLocalPort,protocol:p?.protocol})}),c}addAttributesProvider(e){this.portAttributesProviders.push(e)}};I([Nd(1e3)],zde.prototype,"storeForwarded",1),zde=I([m(0,ap),m(1,le),m(2,B),m(3,Vt),m(4,Mc),m(5,Pe),m(6,ne),m(7,ct),m(8,lt),m(9,X)],zde);var Gd=ae("remoteExplorerService"),B9e="remote.explorerType",P5="~remote.forwardedPorts",aMt="~remote.forwardedPortsContainer",A5="remote.autoForwardPorts",q_="remote.autoForwardPortsSource",H9e="remote.autoForwardPortsFallback",Jz="process",QX="output",LTe="hybrid";var SGo={type:"object",required:["id"],properties:{id:{description:d(17186,null),type:"string"}}},IGo=Tn.registerExtensionPoint({extensionPoint:"remoteHelp",jsonSchema:{description:d(17187,null),type:"object",properties:{getStarted:{description:d(17191,null),oneOf:[{type:"string"},SGo]},documentation:{description:d(17188,null),type:"string"},feedback:{description:d(17189,null),type:"string",markdownDeprecationMessage:d(17190,null,"`reportIssue`")},reportIssue:{description:d(17193,null),type:"string"},issues:{description:d(17192,null),type:"string"}}}});var V9e=class{constructor(i,e,t){this.storageService=i;this.tunnelService=e;this._targetType=[];this._onDidChangeTargetType=new E;this.onDidChangeTargetType=this._onDidChangeTargetType.event;this._onDidChangeHelpInformation=new E;this.onDidChangeHelpInformation=this._onDidChangeHelpInformation.event;this._helpInformation=[];this._onDidChangeEditable=new E;this.onDidChangeEditable=this._onDidChangeEditable.event;this._onEnabledPortsFeatures=new E;this.onEnabledPortsFeatures=this._onEnabledPortsFeatures.event;this._portsFeaturesEnabled=0;this.namedProcesses=new Map;this._tunnelModel=t.createInstance(zde),IGo.setHandler(o=>{this._helpInformation.push(...o),this._onDidChangeHelpInformation.fire(o)})}get helpInformation(){return this._helpInformation}set targetType(i){let e=this._targetType.length>0?this._targetType[0]:"",t=i.length>0?i[0]:"";e!==t&&(this._targetType=i,this.storageService.store(B9e,this._targetType.toString(),1,1),this.storageService.store(B9e,this._targetType.toString(),0,0),this._onDidChangeTargetType.fire(this._targetType))}get targetType(){return this._targetType}get tunnelModel(){return this._tunnelModel}forward(i,e){return this.tunnelModel.forward(i,e)}close(i,e){return this.tunnelModel.close(i.host,i.port,e)}setTunnelInformation(i){i?.features&&this.tunnelService.setTunnelFeatures(i.features),this.tunnelModel.addEnvironmentTunnels(i?.environmentTunnels)}setEditable(i,e,t){t?this._editable={tunnelItem:i,data:t,editId:e}:this._editable=void 0,this._onDidChangeEditable.fire(i?{tunnel:i,editId:e}:void 0)}getEditableData(i,e){return this._editable&&(!i&&i===this._editable.tunnelItem||i&&this._editable.tunnelItem?.remotePort===i.remotePort&&this._editable.tunnelItem.remoteHost===i.remoteHost&&this._editable.editId===e)?this._editable.data:void 0}setCandidateFilter(i){return i?(this.tunnelModel.setCandidateFilter(i),{dispose:()=>{this.tunnelModel.setCandidateFilter(void 0)}}):{dispose:()=>{}}}onFoundNewCandidates(i){this.tunnelModel.setCandidates(i)}restore(){return this.tunnelModel.restoreForwarded()}enablePortsFeatures(i){this._portsFeaturesEnabled=i?1:2,this._onEnabledPortsFeatures.fire()}get portsFeaturesEnabled(){return this._portsFeaturesEnabled}};V9e=I([m(0,le),m(1,ap),m(2,F)],V9e);we(Gd,V9e,1);var lMt=class extends C{constructor(e,t,o,n,r,s,l,c){super();this.remoteExplorerService=t;this.tunnelService=o;this.notificationService=n;this.configurationService=r;this.logService=s;this.remoteAgentService=l;this.contextKeyService=c;this.elevateionRetry=!1;this.portsAttributesProviders=new Map;this._alreadyRegistered=!1;this._proxy=e.getProxy(Zi.ExtHostTunnelService),this._register(o.onTunnelOpened(()=>this._proxy.$onDidTunnelsChange())),this._register(o.onTunnelClosed(()=>this._proxy.$onDidTunnelsChange()))}processFindingEnabled(){return(!!this.configurationService.getValue(A5)||this.tunnelService.hasTunnelProvider)&&this.configurationService.getValue(q_)!==QX}async $setRemoteTunnelService(e){this.remoteExplorerService.namedProcesses.set(e,"Code Extension Host"),this.remoteExplorerService.portsFeaturesEnabled===2?this._proxy.$registerCandidateFinder(this.processFindingEnabled()):this._register(this.remoteExplorerService.onEnabledPortsFeatures(()=>this._proxy.$registerCandidateFinder(this.processFindingEnabled()))),this._register(this.configurationService.onDidChangeConfiguration(async t=>{if(this.remoteExplorerService.portsFeaturesEnabled===2&&(t.affectsConfiguration(A5)||t.affectsConfiguration(q_)))return this._proxy.$registerCandidateFinder(this.processFindingEnabled())})),this._register(this.tunnelService.onAddedTunnelProvider(async()=>{if(this.remoteExplorerService.portsFeaturesEnabled===2)return this._proxy.$registerCandidateFinder(this.processFindingEnabled())}))}async $registerPortsAttributesProvider(e,t){this.portsAttributesProviders.set(t,e),this._alreadyRegistered||(this.remoteExplorerService.tunnelModel.addAttributesProvider(this),this._alreadyRegistered=!0)}async $unregisterPortsAttributesProvider(e){this.portsAttributesProviders.delete(e)}async providePortAttributes(e,t,o,n){if(this.portsAttributesProviders.size===0)return[];let r=Array.from(this.portsAttributesProviders.entries()).filter(s=>{let l=s[1],c=typeof l.portRange=="number"?[l.portRange,l.portRange+1]:l.portRange,u=c?e.some(h=>c[0]<=h&&h<c[1]):!0,p=!l.commandPattern||o&&o.match(l.commandPattern);return u&&p}).map(s=>s[0]);return r.length===0?[]:this._proxy.$providePortAttributes(r,e,t,o,n)}async $openTunnel(e,t){let o=await this.remoteExplorerService.forward({remote:e.remoteAddress,local:e.localAddressPort,name:e.label,source:{source:2,description:t},elevateIfNeeded:!1});if(!(!o||typeof o=="string"))return!this.elevateionRetry&&e.localAddressPort!==void 0&&o.tunnelLocalPort!==void 0&&this.tunnelService.isPortPrivileged(e.localAddressPort)&&o.tunnelLocalPort!==e.localAddressPort&&this.tunnelService.canElevate&&this.elevationPrompt(e,o,t),oMt.fromServiceTunnel(o)}async elevationPrompt(e,t,o){return this.notificationService.prompt(St.Info,d(3060,null,o,e.remoteAddress.port,e.localAddressPort),[{label:d(3061,null,t.tunnelRemotePort),run:async()=>{this.elevateionRetry=!0,await this.remoteExplorerService.close({host:t.tunnelRemoteHost,port:t.tunnelRemotePort},"Other"),await this.remoteExplorerService.forward({remote:e.remoteAddress,local:e.localAddressPort,name:e.label,source:{source:2,description:o},elevateIfNeeded:!0}),this.elevateionRetry=!1}}])}async $closeTunnel(e){return this.remoteExplorerService.close(e,"Other")}async $getTunnels(){return(await this.tunnelService.tunnels).map(e=>({remoteAddress:{port:e.tunnelRemotePort,host:e.tunnelRemoteHost},localAddress:e.localAddress,privacy:e.privacy,protocol:e.protocol}))}async $onFoundNewCandidates(e){this.remoteExplorerService.onFoundNewCandidates(e)}async $setTunnelProvider(e,t){let o={forwardPort:(n,r)=>this._proxy.$forwardPort(n,r).then(l=>{if(l){if(typeof l=="string")return l}else return;let c=l;return this.logService.trace(`ForwardedPorts: (MainThreadTunnelService) New tunnel established by tunnel provider: ${c?.remoteAddress.host}:${c?.remoteAddress.port}`),{tunnelRemotePort:c.remoteAddress.port,tunnelRemoteHost:c.remoteAddress.host,localAddress:typeof c.localAddress=="string"?c.localAddress:Tp(c.localAddress.host,c.localAddress.port),tunnelLocalPort:typeof c.localAddress!="string"?c.localAddress.port:void 0,public:c.public,privacy:c.privacy,protocol:c.protocol??"http",dispose:async u=>(this.logService.trace(`ForwardedPorts: (MainThreadTunnelService) Closing tunnel from tunnel provider: ${c?.remoteAddress.host}:${c?.remoteAddress.port}`),this._proxy.$closeTunnel({host:c.remoteAddress.host,port:c.remoteAddress.port},u))}})};e&&this.tunnelService.setTunnelFeatures(e),this.tunnelService.setTunnelProvider(o),t&&this.contextKeyService.createKey(Kde.key,!0)}async $hasTunnelProvider(){return this.tunnelService.hasTunnelProvider}async $setCandidateFilter(){this.remoteExplorerService.setCandidateFilter(e=>this._proxy.$applyCandidateFilter(e))}async $setCandidatePortSource(e){this.remoteAgentService.getEnvironment().then(()=>{switch(e){case 0:{oe.as(ii.Configuration).registerDefaultConfigurations([{overrides:{"remote.autoForwardPorts":!1}}]);break}case 2:{oe.as(ii.Configuration).registerDefaultConfigurations([{overrides:{"remote.autoForwardPortsSource":QX}}]);break}case 3:{oe.as(ii.Configuration).registerDefaultConfigurations([{overrides:{"remote.autoForwardPortsSource":LTe}}]);break}default:}}).catch(()=>{})}};lMt=I([vo(Gi.MainThreadTunnelService),m(1,Gd),m(2,ap),m(3,Ne),m(4,B),m(5,ne),m(6,yo),m(7,X)],lMt);var OP=ae("IAuthenticationUsageService"),U9e=class extends C{constructor(e,t,o,n){super();this._storageService=e;this._authenticationService=t;this._logService=o;this._queue=this._register(new Op);this._extensionsUsingAuth=new Set;this._disposed=!1;this._register(Z(()=>this._disposed=!0));let r=n.trustedExtensionAuthAccess;if(Array.isArray(r))for(let s of r)this._extensionsUsingAuth.add(s);else if(r)for(let s of Object.values(r))for(let l of s)this._extensionsUsingAuth.add(l);this._register(this._authenticationService.onDidRegisterAuthenticationProvider(s=>this._queue.queue(()=>this._addExtensionsToCache(s.id))))}async initializeExtensionUsageCache(){await this._queue.queue(()=>Promise.all(this._authenticationService.getProviderIds().map(e=>this._addExtensionsToCache(e))))}async extensionUsesAuth(e){return await this._queue.whenIdle(),this._extensionsUsingAuth.has(e)}readAccountUsages(e,t){let o=`${e}-${t}-usages`,n=this._storageService.get(o,-1),r=[];if(n)try{r=JSON.parse(n)}catch{}return r}removeAccountUsage(e,t){let o=`${e}-${t}-usages`;this._storageService.remove(o,-1)}addAccountUsage(e,t,o,n,r){let s=`${e}-${t}-usages`,l=this.readAccountUsages(e,t),c=l.findIndex(u=>u.extensionId===n);c>-1?l.splice(c,1,{extensionId:n,extensionName:r,scopes:o,lastUsed:Date.now()}):l.push({extensionId:n,extensionName:r,scopes:o,lastUsed:Date.now()}),this._storageService.store(s,JSON.stringify(l),-1,1),this._extensionsUsingAuth.add(n)}async _addExtensionsToCache(e){if(!this._disposed)try{let t=await this._authenticationService.getAccounts(e);for(let o of t){let n=this.readAccountUsages(e,o.label);for(let r of n)this._extensionsUsingAuth.add(r.extensionId)}}catch(t){this._logService.error(t)}}};U9e=I([m(0,le),m(1,Cs),m(2,ne),m(3,nt)],U9e);we(OP,U9e,1);var mgi="/.well-known",oPl=`${mgi}/oauth-protected-resource`,nPl=`${mgi}/oauth-authorization-server`,rPl=`${mgi}/openid-configuration`;function Hto(a){if(typeof a!="object"||a===null)return!1;let i=a;return i.access_token!==void 0&&i.token_type!==void 0}function hgi(a){let i=[],e=[],t="",o=!1;for(let r=0;r<a.length;r++){let s=a[r];s==='"'?(o=!o,t+=s):s===","&&!o?(t.trim()&&e.push(t.trim()),t=""):t+=s}t.trim()&&e.push(t.trim());let n;for(let r of e)if(!r.includes("="))n&&i.push(n),n={scheme:r.trim(),params:{}};else{let l=r.indexOf(" ");if(l>0){let c=r.substring(0,l),u=r.substring(l+1);if(!c.includes("=")&&u.includes("=")){n&&i.push(n),n={scheme:c.trim(),params:{}};let p=u.indexOf("=");if(p>0){let h=u.substring(0,p).trim(),g=u.substring(p+1).trim().replace(/^"|"$/g,"");h&&g!==void 0&&(n.params[h]=g)}continue}}if(n){let c=r.indexOf("=");if(c>0){let u=r.substring(0,c).trim(),p=r.substring(c+1).trim().replace(/^"|"$/g,"");u&&p!==void 0&&(n.params[u]=p)}}}return n&&i.push(n),i}function cMt(a,i){if(a===i)return!0;if(!a||!i||a.length!==i.length)return!1;let e=[...a].sort(),t=[...i].sort();return e.every((o,n)=>o===t[n])}function ggi(a){return`onAuthenticationRequest:${a}`}async function RTe(a,i){let e=await a.get(`${i.urlProtocol}.loginAccount`);if(e)try{let t=JSON.parse(e);if(t&&Ae(t.id)&&Ae(t.accessToken)&&Ae(t.providerId))return t}catch(t){console.error(`Failed parsing current auth session value: ${t}`)}}var wGo={type:"object",additionalProperties:!1,properties:{id:{type:"string",description:d(16648,null)},label:{type:"string",description:d(16650,null)},authorizationServerGlobs:{type:"array",items:{type:"string",description:d(16646,null)},description:d(16647,null)}}},CGo=Tn.registerExtensionPoint({extensionPoint:"authentication",jsonSchema:{description:d(16653,null),type:"array",items:wGo},activationEventsGenerator:function*(a){for(let i of a)i.id&&(yield`onAuthenticationRequest:${i.id}`)}}),z9e=class extends C{constructor(e,t,o,n){super();this._extensionService=e;this._environmentService=o;this._logService=n;this._onDidRegisterAuthenticationProvider=this._register(new E);this.onDidRegisterAuthenticationProvider=this._onDidRegisterAuthenticationProvider.event;this._onDidUnregisterAuthenticationProvider=this._register(new E);this.onDidUnregisterAuthenticationProvider=this._onDidUnregisterAuthenticationProvider.event;this._onDidChangeSessions=this._register(new E);this.onDidChangeSessions=this._onDidChangeSessions.event;this._onDidChangeDeclaredProviders=this._register(new E);this.onDidChangeDeclaredProviders=this._onDidChangeDeclaredProviders.event;this._authenticationProviders=new Map;this._authenticationProviderDisposables=this._register(new jt);this._dynamicAuthenticationProviderIds=new Set;this._delegates=[];this._disposedSource=new $e;this._declaredProviders=[];this._register(Z(()=>this._disposedSource.dispose(!0))),this._register(t.onDidChangeExtensionSessionAccess(r=>{this._onDidChangeSessions.fire({providerId:r.providerId,label:r.accountName,event:{added:[],changed:[],removed:[]}})})),this._registerEnvContributedAuthenticationProviders(),this._registerAuthenticationExtensionPointHandler()}get declaredProviders(){return this._declaredProviders}_registerEnvContributedAuthenticationProviders(){if(this._environmentService.options?.authenticationProviders?.length)for(let e of this._environmentService.options.authenticationProviders)this.registerDeclaredAuthenticationProvider(e),this.registerAuthenticationProvider(e.id,e)}_registerAuthenticationExtensionPointHandler(){this._register(CGo.setHandler((e,{added:t,removed:o})=>{this._logService.debug(`Found authentication providers. added: ${t.length}, removed: ${o.length}`),t.forEach(r=>{for(let s of r.value){if(Jl(s.id)){r.collector.error(d(16651,null));continue}if(Jl(s.label)){r.collector.error(d(16652,null));continue}this.declaredProviders.some(l=>l.id===s.id)?r.collector.error(d(16649,null,s.id)):(this.registerDeclaredAuthenticationProvider(s),this._logService.debug(`Declared authentication provider: ${s.id}`))}}),o.flatMap(r=>r.value).forEach(r=>{let s=this.declaredProviders.find(l=>l.id===r.id);s&&(this.unregisterDeclaredAuthenticationProvider(s.id),this._logService.debug(`Undeclared authentication provider: ${s.id}`))})}))}registerDeclaredAuthenticationProvider(e){if(Jl(e.id))throw new Error(d(16651,null));if(Jl(e.label))throw new Error(d(16652,null));if(this.declaredProviders.some(t=>t.id===e.id))throw new Error(d(16649,null,e.id));this._declaredProviders.push(e),this._onDidChangeDeclaredProviders.fire()}unregisterDeclaredAuthenticationProvider(e){let t=this.declaredProviders.findIndex(o=>o.id===e);t>-1&&this.declaredProviders.splice(t,1),this._onDidChangeDeclaredProviders.fire()}isAuthenticationProviderRegistered(e){return this._authenticationProviders.has(e)}isDynamicAuthenticationProvider(e){return this._dynamicAuthenticationProviderIds.has(e)}registerAuthenticationProvider(e,t){this._authenticationProviders.set(e,t);let o=new P;o.add(t.onDidChangeSessions(n=>this._onDidChangeSessions.fire({providerId:e,label:t.label,event:n}))),Ac(t)&&o.add(t),this._authenticationProviderDisposables.set(e,o),this._onDidRegisterAuthenticationProvider.fire({id:e,label:t.label})}unregisterAuthenticationProvider(e){let t=this._authenticationProviders.get(e);t&&(this._authenticationProviders.delete(e),this._dynamicAuthenticationProviderIds.delete(e),this._onDidUnregisterAuthenticationProvider.fire({id:e,label:t.label})),this._authenticationProviderDisposables.deleteAndDispose(e)}getProviderIds(){let e=[];return this._authenticationProviders.forEach(t=>{e.push(t.id)}),e}getProvider(e){if(this._authenticationProviders.has(e))return this._authenticationProviders.get(e);throw new Error(`No authentication provider '${e}' is currently registered.`)}async getAccounts(e){let t=await this.getSessions(e),o=new Array,n=new Set;for(let r of t)n.has(r.account.label)||(n.add(r.account.label),o.push(r.account));return o}async getSessions(e,t,o,n=!1){if(this._disposedSource.token.isCancellationRequested)return[];let r=this._authenticationProviders.get(e)||await this.tryActivateProvider(e,n);if(r){let s=o?.authorizationServer;if(s&&!this.matchesProvider(r,s))throw new Error(`The authentication provider '${e}' does not support the authorization server '${s.toString(!0)}'.`);if(Ece(t)){if(!r.getSessionsFromChallenges)throw new Error(`The authentication provider '${e}' does not support getting sessions from challenges.`);return await r.getSessionsFromChallenges({challenges:hgi(t.wwwAuthenticate),fallbackScopes:t.fallbackScopes},{...o})}return await r.getSessions(t?[...t]:void 0,{...o})}else throw new Error(`No authentication provider '${e}' is currently registered.`)}async createSession(e,t,o){if(this._disposedSource.token.isCancellationRequested)throw new Error("Authentication service is disposed.");let n=this._authenticationProviders.get(e)||await this.tryActivateProvider(e,!!o?.activateImmediate);if(n){if(Ece(t)){if(!n.createSessionFromChallenges)throw new Error(`The authentication provider '${e}' does not support creating sessions from challenges.`);return await n.createSessionFromChallenges({challenges:hgi(t.wwwAuthenticate),fallbackScopes:t.fallbackScopes},{...o})}return await n.createSession([...t],{...o})}else throw new Error(`No authentication provider '${e}' is currently registered.`)}async removeSession(e,t){if(this._disposedSource.token.isCancellationRequested)throw new Error("Authentication service is disposed.");let o=this._authenticationProviders.get(e);if(o)return o.removeSession(t);throw new Error(`No authentication provider '${e}' is currently registered.`)}async getOrActivateProviderIdForServer(e,t){for(let r of this._authenticationProviders.values())if(this.matchesProvider(r,e,t))return r.id;let o=e.toString(!0),n=this._declaredProviders.filter(r=>!this._authenticationProviders.has(r.id)).filter(r=>!!r.authorizationServerGlobs?.some(s=>Cp(s,o,{ignoreCase:!0})));for(let r of n){let s=await this.tryActivateProvider(r.id,!0);if(this.matchesProvider(s,e,t))return s.id}}async createDynamicAuthenticationProvider(e,t,o){let n=this._delegates[0];if(!n){this._logService.error("No authentication provider host delegate found");return}let r=await n.create(e,t,o),s=this._authenticationProviders.get(r);if(s)return this._logService.debug(`Created dynamic authentication provider: ${r}`),this._dynamicAuthenticationProviderIds.add(r),s;this._logService.error(`Failed to create dynamic authentication provider: ${r}`)}registerAuthenticationProviderHostDelegate(e){return this._delegates.push(e),this._delegates.sort((t,o)=>o.priority-t.priority),{dispose:()=>{let t=this._delegates.indexOf(e);t!==-1&&this._delegates.splice(t,1)}}}matchesProvider(e,t,o){if(o&&e.resourceServer){let n=o.toString(!0),r=e.resourceServer.toString(!0);if(!mr(r,n))return!1}if(e.authorizationServers){let n=t.toString(!0);for(let r of e.authorizationServers){let s=r.toString(!0);if(mr(s,n)||Cp(s,n,{ignoreCase:!0}))return!0}}return!1}async tryActivateProvider(e,t){await this._extensionService.activateByEvent(ggi(e),t?1:0);let o=this._authenticationProviders.get(e);if(o)return o;if(this._disposedSource.token.isCancellationRequested)throw new Error("Authentication service is disposed.");let n=new P;try{let r=await Wp(wa(H.toPromise(H.filter(this.onDidRegisterAuthenticationProvider,s=>s.id===e,n),n),this._disposedSource.token),5e3);if(o=this._authenticationProviders.get(e),o)return o;throw r?new Error(`No authentication provider '${e}' is currently registered.`):new Error(`Timed out waiting for authentication provider '${e}' to register.`)}finally{n.dispose()}}};z9e=I([m(0,lt),m(1,Gx),m(2,ru),m(3,ne)],z9e);we(Cs,z9e,1);var YX=ae("dynamicAuthenticationProviderStorageService");var uMt=class extends C{constructor(e,t,o,n,r,s,l){super();this._proxy=e;this.id=t;this.label=o;this.supportsMultipleAccounts=n;this.authorizationServers=r;this.resourceServer=s;this.onDidChangeSessions=l.event}async getSessions(e,t){return this._proxy.$getSessions(this.id,e,t)}createSession(e,t){return this._proxy.$createSession(this.id,e,t)}async removeSession(e){await this._proxy.$removeSession(this.id,e)}},fgi=class extends uMt{constructor(i,e,t,o,n,r,s){super(i,e,t,o,n,r,s)}getSessionsFromChallenges(i,e){return this._proxy.$getSessionsFromChallenges(this.id,i,e)}createSessionFromChallenges(i,e){return this._proxy.$createSessionFromChallenges(this.id,i,e)}},dMt=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super();this.productService=t;this.authenticationService=o;this.authenticationExtensionsService=n;this.authenticationAccessService=r;this.authenticationUsageService=s;this.dialogService=l;this.notificationService=c;this.extensionService=u;this.telemetryService=p;this.openerService=h;this.logService=g;this.urlService=f;this.dynamicAuthProviderStorageService=v;this.clipboardService=b;this.quickInputService=S;this._registrations=this._register(new jt);this._sentProviderUsageEvents=new Set;this._suppressUnregisterEvent=!1;this._sentClientIdUsageEvents=new Set;this._proxy=e.getProxy(Zi.ExtHostAuthentication),this._register(this.authenticationService.onDidChangeSessions(y=>this._proxy.$onDidChangeAuthenticationSessions(y.providerId,y.label))),this._register(this.authenticationService.onDidUnregisterAuthenticationProvider(y=>{this._suppressUnregisterEvent||this._proxy.$onDidUnregisterAuthenticationProvider(y.id)})),this._register(this.authenticationExtensionsService.onDidChangeAccountPreference(y=>{let w=this.authenticationService.getProvider(y.providerId);this._proxy.$onDidChangeAuthenticationSessions(w.id,w.label,y.extensionIds)})),this._register(this.dynamicAuthProviderStorageService.onDidChangeTokens(y=>{this._proxy.$onDidChangeDynamicAuthProviderTokens(y.authProviderId,y.clientId,y.tokens)})),this._register(o.registerAuthenticationProviderHostDelegate({priority:e.extensionHostKind===2?0:1,create:async(y,w,k)=>{let T=k?`${y.toString(!0)} ${k.resource}`:y.toString(!0),N=await this.dynamicAuthProviderStorageService.getClientRegistration(T),O=N?.clientId,V=N?.clientSecret,U;return O?U=await this.dynamicAuthProviderStorageService.getSessionsForDynamicAuthProvider(T,O):w.client_id_metadata_document_supported&&(O=this.productService.authClientIdMetadataUrl),await this._proxy.$registerDynamicAuthProvider(y,w,k,O,V,U)}}))}async $registerAuthenticationProvider({id:e,label:t,supportsMultipleAccounts:o,resourceServer:n,supportedAuthorizationServers:r,supportsChallenges:s}){this.authenticationService.declaredProviders.find(p=>p.id===e)||(this.logService.warn(`Authentication provider ${e} was not declared in the Extension Manifest.`),this.telemetryService.publicLog2("authentication.providerNotDeclared",{id:e}));let l=new E;this._registrations.set(e,l);let c=(r??[]).map(p=>A.revive(p)),u=s?new fgi(this._proxy,e,t,o,c,n?A.revive(n):void 0,l):new uMt(this._proxy,e,t,o,c,n?A.revive(n):void 0,l);this.authenticationService.registerAuthenticationProvider(e,u)}async $unregisterAuthenticationProvider(e){this._registrations.deleteAndDispose(e),this._suppressUnregisterEvent=!0;try{this.authenticationService.unregisterAuthenticationProvider(e)}finally{this._suppressUnregisterEvent=!1}}async $ensureProvider(e){if(!this.authenticationService.isAuthenticationProviderRegistered(e))return await this.extensionService.activateByEvent(ggi(e),1)}async $sendDidChangeSessions(e,t){let o=this._registrations.get(e);o instanceof E&&o.fire(t)}$removeSession(e,t){return this.authenticationService.removeSession(e,t)}async $waitForUriHandler(e){let t=new Go,o=this.urlService.registerHandler({handleURL:async r=>r.scheme!==e.scheme||r.authority!==e.authority||r.path!==e.path?!1:(t.complete(r),o.dispose(),!0)});if(!await Wp(t.p,300*1e3))throw new Error("Timed out waiting for URI handler");return await t.p}$showContinueNotification(e){let t=d(3002,null),o=d(3001,null),n=new Go,r=!1,l=this.notificationService.prompt(gt.Warning,e,[{label:t,run:()=>r=!0},{label:o,run:()=>r=!1}]).onDidClose(()=>{n.complete(r),l.dispose()});return n.p}async $registerDynamicAuthenticationProvider(e){await this.$registerAuthenticationProvider({id:e.id,label:e.label,supportsMultipleAccounts:!0,supportedAuthorizationServers:[e.authorizationServer],resourceServer:e.resourceServer}),await this.dynamicAuthProviderStorageService.storeClientRegistration(e.id,A.revive(e.authorizationServer).toString(!0),e.clientId,e.clientSecret,e.label)}async $setSessionsForDynamicAuthProvider(e,t,o){await this.dynamicAuthProviderStorageService.setSessionsForDynamicAuthProvider(e,t,o)}async $sendDidChangeDynamicProviderInfo({providerId:e,clientId:t,authorizationServer:o,label:n,clientSecret:r}){this.logService.info(`Client ID for authentication provider ${e} changed to ${t}`);let s=this.dynamicAuthProviderStorageService.getInteractedProviders().find(l=>l.providerId===e);if(!s)throw new Error(`Dynamic authentication provider ${e} not found. Has it been registered?`);await this.dynamicAuthProviderStorageService.storeClientRegistration(e||s.providerId,o?A.revive(o).toString(!0):s.authorizationServer,t||s.clientId,r,n||s.label)}async loginPrompt(e,t,o,n){let r,s=e.confirmation?.(t,o);s?r=s:r=o?d(2987,null,t,e.label):d(2986,null,t,e.label);let l=[{label:d(2979,null),run(){return!0}}];n?.learnMore&&l.push({label:d(2999,null),run:async()=>{let u=this.loginPrompt(e,t,o,n);return await this.openerService.open(A.revive(n.learnMore),{allowCommands:!0}),await u}});let{result:c}=await this.dialogService.prompt({type:gt.Info,message:r,buttons:l,detail:n?.detail,cancelButton:!0});return c??!1}async continueWithIncorrectAccountPrompt(e,t){let o=await this.dialogService.prompt({message:d(2996,null),detail:d(2997,null,e,t),type:gt.Warning,cancelButton:!0,buttons:[{label:d(2998,null,e),run:()=>e},{label:d(3000,null,t),run:()=>t}]});if(!o.result)throw new ho;return o.result===e}async doGetSession(e,t,o,n,r){let s=A.revive(r.authorizationServer),l=await this.authenticationService.getSessions(e,t,{account:r.account,authorizationServer:s},!0),c=this.authenticationService.getProvider(e);if(r.forceNewSession&&r.createIfNone)throw new Error("Invalid combination of options. Please remove one of the following: forceNewSession, createIfNone");if(r.forceNewSession&&r.silent)throw new Error("Invalid combination of options. Please remove one of the following: forceNewSession, silent");if(r.createIfNone&&r.silent)throw new Error("Invalid combination of options. Please remove one of the following: createIfNone, silent");r.clearSessionPreference&&this.authenticationExtensionsService.removeAccountPreference(o,e);let u=r.account?l[0]:this._getAccountPreference(o,e,l);if(!r.forceNewSession&&l.length){if(u&&this.authenticationAccessService.isAccessAllowed(e,u.account.label,o))return u;if(!c.supportsMultipleAccounts&&this.authenticationAccessService.isAccessAllowed(e,l[0].account.label,o))return l[0]}if(r.createIfNone||r.forceNewSession){let p;typeof r.forceNewSession=="object"?p=r.forceNewSession:typeof r.createIfNone=="object"&&(p=r.createIfNone);let h=!!(r.forceNewSession&&l.length);if(!await this.loginPrompt(c,n,h,p))throw new Error("User did not consent to login.");let f;if(l?.length&&!r.forceNewSession)f=c.supportsMultipleAccounts&&!r.account?await this.authenticationExtensionsService.selectSession(e,o,n,t,l):l[0];else{let v=r.account??u?.account;do f=await this.authenticationService.createSession(e,t,{activateImmediate:!0,account:v,authorizationServer:s});while(v&&v.label!==f.account.label&&!await this.continueWithIncorrectAccountPrompt(f.account.label,v.label))}return this.authenticationAccessService.updateAllowedExtensions(e,f.account.label,[{id:o,name:n,allowed:!0}]),this.authenticationExtensionsService.updateNewSessionRequests(e,[f]),this.authenticationExtensionsService.updateAccountPreference(o,e,f.account),f}if(!u){let p=l.filter(h=>this.authenticationAccessService.isAccessAllowed(e,h.account.label,o));if(p.length===1)return p[0]}r.silent||(l.length?this.authenticationExtensionsService.requestSessionAccess(e,o,n,t,l):await this.authenticationExtensionsService.requestNewSession(e,t,o,n))}async $getSession(e,t,o,n,r){let s=Ece(t)?t.fallbackScopes:t;s&&this.sendClientIdUsageTelemetry(o,e,s);let l=await this.doGetSession(e,t,o,n,r);return l&&(this.sendProviderUsageTelemetry(o,e),this.authenticationUsageService.addAccountUsage(e,l.account.label,l.scopes,o,n)),l}async $getAccounts(e){return await this.authenticationService.getAccounts(e)}sendClientIdUsageTelemetry(e,t,o){let n=o.some(s=>s.startsWith("VSCODE_CLIENT_ID:")),r=`${e}|${t}|${n}`;this._sentClientIdUsageEvents.has(r)||(this._sentClientIdUsageEvents.add(r),n&&this.telemetryService.publicLog2("authentication.clientIdUsage",{extensionId:e}))}sendProviderUsageTelemetry(e,t){let o=`${e}|${t}`;this._sentProviderUsageEvents.has(o)||(this._sentProviderUsageEvents.add(o),this.telemetryService.publicLog2("authentication.providerUsage",{providerId:t,extensionId:e}))}_getAccountPreference(e,t,o){if(o.length===0)return;let n=this.authenticationExtensionsService.getAccountPreference(e,t);if(n)return o.find(s=>s.account.label===n)}async $showDeviceCodeModal(e,t){let{result:o}=await this.dialogService.prompt({type:gt.Info,message:d(2994,null),detail:d(2993,null,e,t),buttons:[{label:d(2988,null),run:()=>!0}],cancelButton:!0});if(o)try{return await this.clipboardService.writeText(e),await this.openerService.open(A.parse(t))}catch{this.notificationService.error(d(2995,null,t))}return!1}async $promptForClientRegistration(e){let t=`http://127.0.0.1:33418
https://vscode.dev/redirect`;if(!await this.dialogService.prompt({type:gt.Info,message:d(2991,null),detail:d(2992,null,e,t),buttons:[{label:d(2989,null),run:async()=>{try{await this.clipboardService.writeText(t)}catch{this.notificationService.error(d(2990,null))}return!0}}],cancelButton:{label:d(2980,null),run:()=>!1}}))return;let n=d(2978,null),r=await this.quickInputService.input({title:n,prompt:d(2982,null),placeHolder:d(2981,null),ignoreFocusLost:!0,validateInput:async l=>{if(!l||l.trim().length===0)return d(2983,null)}});if(!r||r.trim().length===0)return;let s=await this.quickInputService.input({title:n,prompt:d(2985,null,r),placeHolder:d(2984,null),password:!0,ignoreFocusLost:!0});return{clientId:r.trim(),clientSecret:s?.trim()||void 0}}};dMt=I([vo(Gi.MainThreadAuthentication),m(1,nt),m(2,Cs),m(3,DY),m(4,Gx),m(5,OP),m(6,ct),m(7,Ne),m(8,lt),m(9,Te),m(10,Qe),m(11,ne),m(12,nI),m(13,YX),m(14,Wi),m(15,Ge)],dMt);var pMt="timeline",xGo="timeline",Zz=ae(xGo);var mMt=class{constructor(i,e,t){this.logService=e;this._timelineService=t;this._providerEmitters=new Map;this._proxy=i.getProxy(Zi.ExtHostTimeline)}$registerTimelineProvider(i){this.logService.trace(`MainThreadTimeline#registerTimelineProvider: id=${i.id}`);let e=this._proxy,t=this._providerEmitters,o=t.get(i.id);o===void 0&&(o=new E,t.set(i.id,o)),this._timelineService.registerTimelineProvider({...i,onDidChange:o.event,async provideTimeline(n,r,s){return Xn(await e.$getTimeline(i.id,n,r,s))},dispose(){t.delete(i.id),o?.dispose()}})}$unregisterTimelineProvider(i){this.logService.trace(`MainThreadTimeline#unregisterTimelineProvider: id=${i}`),this._timelineService.unregisterTimelineProvider(i)}$emitTimelineChangeEvent(i){this.logService.trace(`MainThreadTimeline#emitChangeEvent: id=${i.id}, uri=${i.uri?.toString(!0)}`),this._providerEmitters.get(i.id)?.fire(i)}dispose(){}};mMt=I([vo(Gi.MainThreadTimeline),m(1,ne),m(2,Zz)],mMt);var Uto=0,hMt=class{constructor(i,e,t,o){this.result=i;this.fromTaskId=e;this.uriIdentityService=t;this.accessor=o;this.fileCoverage=new vt;this.didAddCoverage=Wc(this);this.tree=new EP;this.associatedData=new Map}*allPerTestIDs(){let i=new Set;for(let e of this.tree.nodes)if(e.value&&e.value.perTestData)for(let t of e.value.perTestData)i.has(t)||(i.add(t),yield t)}append(i,e){let t=this.getComputedForUri(i.uri),o=this.result,n=(l,c)=>{c[l]?(c[l].covered+=(i[l]?.covered||0)-(t?.[l]?.covered||0),c[l].total+=(i[l]?.total||0)-(t?.[l]?.total||0)):i[l]&&(c[l]={...i[l]})},r=[...this.treePathForUri(i.uri,!0)],s=[];this.tree.mutatePath(this.treePathForUri(i.uri,!1),l=>{if(s.push(l),s.length===r.length)if(l.value){let c=l.value;c.id=i.id,c.statement=i.statement,c.branch=i.branch,c.declaration=i.declaration}else{let c=l.value=new N5(i,o,this.accessor);this.fileCoverage.set(i.uri,c)}else if(l.value)n("statement",l.value),n("branch",l.value),n("declaration",l.value),l.value.didChange.trigger(e);else{let c=Xi(i);c.id=String(Uto++),c.uri=this.treePathToUri(r.slice(0,s.length)),l.value=new fMt(c,o)}if(i.testIds){l.value.perTestData??=new Set;for(let c of i.testIds)l.value.perTestData.add(c)}}),s&&this.didAddCoverage.trigger(e,s)}filterTreeForTest(i){let e=new EP;for(let t of this.tree.values())if(t instanceof N5){if(!t.perTestData?.has(i.toString()))continue;let o=[...this.treePathForUri(t.uri,!0)],n=[];e.mutatePath(this.treePathForUri(t.uri,!1),r=>{n.push(r),r.value??=new K9e(this.treePathToUri(o.slice(0,n.length)),t.fromResult)})}return e}getAllFiles(){return this.fileCoverage}getUri(i){return this.fileCoverage.get(i)}getComputedForUri(i){return this.tree.find(this.treePathForUri(i,!1))}*treePathForUri(i,e){yield i.scheme,yield i.authority,yield*(!e&&this.uriIdentityService.extUri.ignorePathCasing(i)?i.path.toLowerCase():i.path).split("/")}treePathToUri(i){return A.from({scheme:i[0],authority:i[1],path:i.slice(2).join("/")})}},Gde=(a,i,e)=>{let t=a.covered,o=a.total;return i&&(t+=i.covered,o+=i.total),e&&(t+=e.covered,o+=e.total),o===0?1:t/o},gMt=class{constructor(i,e){this.fromResult=e;this.didChange=Wc(this);this.id=i.id,this.uri=i.uri,this.statement=i.statement,this.branch=i.branch,this.declaration=i.declaration}get tpc(){return Gde(this.statement,this.branch,this.declaration)}},fMt=class extends gMt{},K9e=class extends fMt{constructor(i,e){super({id:String(Uto++),uri:i,statement:{covered:0,total:0}},e)}},N5=class extends gMt{constructor(e,t,o){super(e,t);this.accessor=o}get hasSynchronousDetails(){return this._details instanceof Array||this.resolved}async detailsForTest(e,t=ve.None){this._detailsForTest??=new Map;let o=e.toString(),n=this._detailsForTest.get(o);if(n)return n;let r=(async()=>{try{return await this.accessor.getCoverageDetails(this.id,o,t)}catch(s){throw this._detailsForTest?.delete(o),s}})();return this._detailsForTest.set(o,r),r}async details(e=ve.None){this._details??=this.accessor.getCoverageDetails(this.id,void 0,e);try{let t=await this._details;return this.resolved=!0,t}catch(t){throw this._details=void 0,t}}};var kGo={deserialize:a=>JSON.parse(a),serialize:a=>JSON.stringify(a)},dS=class extends C{constructor(e,t){super();this.storage=t;this.key=e.key,this.scope=e.scope,this.target=e.target,this.serialization=e.serialization??kGo,this.onDidChange=this.storage.onDidChangeValue(this.scope,this.key,this._store)}get(e){if(this.value===void 0){let t=this.storage.get(this.key,this.scope);this.value=t===void 0?e:this.serialization.deserialize(t)}return this.value}store(e){this.value=e,this.storage.store(this.key,this.serialization.serialize(e),this.scope,this.target)}delete(){this.storage.remove(this.key,this.scope)}};dS=I([m(1,le)],dS);var EGo={6:d(15347,null),4:d(15348,null),3:d(15349,null),1:d(15350,null),2:d(15351,null),5:d(15352,null),0:d(15353,null)},vMt=(a,i)=>d(15346,null,fu(a),EGo[i]),bMt={4:d(15344,null),2:d(15345,null),8:d(15343,null)};var Ji;(Ze=>(Ze.providerCount=new Q("testing.providerCount",0),Ze.canRefreshTests=new Q("testing.canRefresh",!1,{type:"boolean",description:d(15369,null)}),Ze.isRefreshingTests=new Q("testing.isRefreshing",!1,{type:"boolean",description:d(15385,null)}),Ze.isContinuousModeOn=new Q("testing.isContinuousModeOn",!1,{type:"boolean",description:d(15382,null)}),Ze.hasDebuggableTests=new Q("testing.hasDebuggableTests",!1,{type:"boolean",description:d(15376,null)}),Ze.hasRunnableTests=new Q("testing.hasRunnableTests",!1,{type:"boolean",description:d(15380,null)}),Ze.hasCoverableTests=new Q("testing.hasCoverableTests",!1,{type:"boolean",description:d(15374,null)}),Ze.hasNonDefaultProfile=new Q("testing.hasNonDefaultProfile",!1,{type:"boolean",description:d(15378,null)}),Ze.hasConfigurableProfile=new Q("testing.hasConfigurableProfile",!1,{type:"boolean",description:d(15373,null)}),Ze.supportsContinuousRun=new Q("testing.supportsContinuousRun",!1,{type:"boolean",description:d(15390,null)}),Ze.isParentRunningContinuously=new Q("testing.isParentRunningContinuously",!1,{type:"boolean",description:d(15384,null)}),Ze.activeEditorHasTests=new Q("testing.activeEditorHasTests",!1,{type:"boolean",description:d(15366,null)}),Ze.cursorInsideTestRange=new Q("testing.cursorInsideTestRange",!1,{type:"boolean",description:d(15372,null)}),Ze.isTestCoverageOpen=new Q("testing.isTestCoverageOpen",!1,{type:"boolean",description:d(15386,null)}),Ze.hasCoverageInFile=new Q("testing.hasCoverageInFile",!1,{type:"boolean",description:d(15375,null)}),Ze.hasPerTestCoverage=new Q("testing.hasPerTestCoverage",!1,{type:"boolean",description:d(15379,null)}),Ze.hasInlineCoverageDetails=new Q("testing.hasInlineCoverageDetails",!1,{type:"boolean",description:d(15377,null)}),Ze.isCoverageFilteredToTest=new Q("testing.isCoverageFilteredToTest",!1,{type:"boolean",description:d(15383,null)}),Ze.coverageToolbarEnabled=new Q("testing.coverageToolbarEnabled",!0,{type:"boolean",description:d(15371,null)}),Ze.inlineCoverageEnabled=new Q("testing.inlineCoverageEnabled",!1,{type:"boolean",description:d(15381,null)}),Ze.canGoToRelatedCode=new Q("testing.canGoToRelatedCode",!1,{type:"boolean",description:d(15367,null)}),Ze.canGoToRelatedTest=new Q("testing.canGoToRelatedTest",!1,{type:"boolean",description:d(15368,null)}),Ze.peekHasStack=new Q("testing.peekHasStack",!1,{type:"boolean",description:d(15387,null)}),Ze.capabilityToContextKey={2:Ze.hasRunnableTests,8:Ze.hasCoverableTests,4:Ze.hasDebuggableTests,16:Ze.hasNonDefaultProfile,32:Ze.hasConfigurableProfile,64:Ze.supportsContinuousRun},Ze.hasAnyResults=new Q("testing.hasAnyResults",!1),Ze.viewMode=new Q("testing.explorerViewMode","list"),Ze.viewSorting=new Q("testing.explorerViewSorting","location"),Ze.isRunning=new Q("testing.isRunning",!1),Ze.isInPeek=new Q("testing.isInPeek",!1),Ze.isPeekVisible=new Q("testing.isPeekVisible",!1),Ze.peekItemType=new Q("peekItemType",void 0,{type:"string",description:d(15388,null)}),Ze.controllerId=new Q("controllerId",void 0,{type:"string",description:d(15370,null)}),Ze.testItemExtId=new Q("testId",void 0,{type:"string",description:d(15391,null)}),Ze.testItemHasUri=new Q("testing.testItemHasUri",!1,{type:"boolean",description:d(15392,null)}),Ze.testItemIsHidden=new Q("testing.testItemIsHidden",!1,{type:"boolean",description:d(15393,null)}),Ze.testMessageContext=new Q("testMessage",void 0,{type:"string",description:d(15394,null)}),Ze.testResultOutdated=new Q("testResultOutdated",void 0,{type:"boolean",description:d(15395,null)}),Ze.testResultState=new Q("testResultState",void 0,{type:"string",description:d(15396,null)}),Ze.testProfileContextGroup=new Q("testing.profile.context.group",void 0,{type:"string",description:d(15389,null)})))(Ji||={});var $d=ae("testProfileService"),hR=(a,i)=>a.controllerId===i.controllerId&&(Pr.isRoot(i.item.extId)||!a.tag||i.item.tags.includes(a.tag)),vgi=(a,i)=>a.isDefault!==i.isDefault?a.isDefault?-1:1:a.label.localeCompare(i.label),SMt=a=>[[Ji.hasRunnableTests.key,(a&2)!==0],[Ji.hasDebuggableTests.key,(a&4)!==0],[Ji.hasCoverableTests.key,(a&8)!==0]],MTe=class extends C{constructor(e,t){super();this.changeEmitter=this._register(new E);this.controllerProfiles=new Map;this.onDidChange=this.changeEmitter.event;t.remove("testingPreferredProfiles",1),this.userDefaults=this._register(new dS({key:"testingPreferredProfiles2",scope:1,target:1},t)),this.capabilitiesContexts={2:Ji.hasRunnableTests.bindTo(e),4:Ji.hasDebuggableTests.bindTo(e),8:Ji.hasCoverableTests.bindTo(e),16:Ji.hasNonDefaultProfile.bindTo(e),32:Ji.hasConfigurableProfile.bindTo(e),64:Ji.supportsContinuousRun.bindTo(e)},this.refreshContextKeys()}addProfile(e,t){let o=this.userDefaults.get()?.[e.id]?.[t.profileId],n={...t,isDefault:o??t.isDefault,wasInitiallyDefault:t.isDefault},r=this.controllerProfiles.get(t.controllerId);r?(r.profiles.push(n),r.profiles.sort(vgi)):(r={profiles:[n],controller:e},this.controllerProfiles.set(t.controllerId,r)),this.refreshContextKeys(),this.changeEmitter.fire()}updateProfile(e,t,o){let n=this.controllerProfiles.get(e);if(!n)return;let r=n.profiles.find(s=>s.controllerId===e&&s.profileId===t);if(r){if(Object.assign(r,o),n.profiles.sort(vgi),o.isDefault!==void 0){let s=Xi(this.userDefaults.get({}));bgi(s,r,o.isDefault),this.userDefaults.store(s)}this.changeEmitter.fire()}}configure(e,t){this.controllerProfiles.get(e)?.controller.configureRunProfile(t)}removeProfile(e,t){let o=this.controllerProfiles.get(e);if(!o)return;if(!t){this.controllerProfiles.delete(e),this.changeEmitter.fire();return}let n=o.profiles.findIndex(r=>r.profileId===t);n!==-1&&(o.profiles.splice(n,1),this.refreshContextKeys(),this.changeEmitter.fire())}capabilitiesForTest(e){let t=this.controllerProfiles.get(Pr.root(e.extId));if(!t)return 0;let o=0;for(let n of t.profiles)(!n.tag||e.tags.includes(n.tag))&&(o|=o&n.group?16:n.group);return o}all(){return this.controllerProfiles.values()}getControllerProfiles(e){return this.controllerProfiles.get(e)?.profiles??[]}getGroupDefaultProfiles(e,t){let o=t?this.controllerProfiles.get(t)?.profiles||[]:[...ht.flatMap(this.controllerProfiles.values(),r=>r.profiles)],n=o.filter(r=>r.group===e&&r.isDefault);if(n.length===0){let r=o.find(s=>s.group===e);r&&n.push(r)}return n}setGroupDefaultProfiles(e,t){let o={};for(let n of this.controllerProfiles.values()){o[n.controller.id]={};for(let r of n.profiles)r.group===e&&bgi(o,r,t.some(s=>s.profileId===r.profileId));for(let r of n.profiles){if(r.group===e)continue;let s=n.profiles.find(l=>l.group===e&&l.label===r.label);s&&bgi(o,r,s.isDefault)}n.profiles.sort(vgi)}this.userDefaults.store(o),this.changeEmitter.fire()}getDefaultProfileForTest(e,t){return this.getControllerProfiles(t.controllerId).find(o=>(o.group&e)!==0&&hR(o,t))}refreshContextKeys(){let e=0;for(let{profiles:t}of this.controllerProfiles.values())for(let o of t)e|=e&o.group?16:o.group,e|=o.supportsContinuousRun?64:0;for(let t of eZi)this.capabilitiesContexts[t].set((e&t)!==0)}};MTe=I([m(0,X),m(1,le)],MTe);var bgi=(a,i,e)=>{i.isDefault=e,a[i.controllerId]??={},i.isDefault!==i.wasInitiallyDefault?a[i.controllerId][i.profileId]=i.isDefault:delete a[i.controllerId][i.profileId]};var FP={2:6,6:5,4:4,1:3,3:2,0:0,5:1},ak=a=>a===6||a===4,Gto=a=>a===6||a===4||a===3,WNl=iSe(FP,(a,i)=>({statusNode:!0,state:Number(i),priority:a})),G9e=(a,i)=>FP[i]-FP[a],PTe=(...a)=>{switch(a.length){case 0:return 0;case 1:return a[0];case 2:return FP[a[0]]>FP[a[1]]?a[0]:a[1];default:{let i=a[0];for(let e=1;e<a.length;e++)FP[i]<FP[a[e]]&&(i=a[e]);return i}}},$9e=Object.keys(FP).map(a=>Number(a)).sort(G9e),Sgi={3:0,5:1,4:2,6:3},q9e=()=>new Uint32Array($9e.length);var TGo=a=>"getOwnDuration"in a,Igi=(a,i,e=!1)=>{let t=a.getCurrentComputedState(i);if(t===void 0||e){t=a.getOwnState(i)??0;let o=0,n=q9e();for(let r of a.getChildren(i)){let s=Igi(a,r);o++,n[s]++,t=s===5&&t===0?5:PTe(t,s)}o>_Go&&qto.set(i,n),a.setComputedState(i,t)}return t},$to=(a,i,e=!1)=>{let t=a.getCurrentComputedDuration(i);if(t===void 0||e){let o=a.getOwnDuration(i);if(o!==void 0)t=o;else{t=void 0;for(let n of a.getChildren(i)){let r=$to(a,n);r!==void 0&&(t=(t||0)+r)}}a.setComputedDuration(i,t)}return t},_Go=64,qto=new WeakMap,$de=(a,i,e,t=!0)=>{let o=a.getCurrentComputedState(i),n=FP[o],r=e??Igi(a,i,!0),s=FP[r],l=new Set;if(s!==n){a.setComputedState(i,r),l.add(i);let c=o,u=r;for(let p of a.getParents(i)){let h=qto.get(p);h&&(h[c]--,h[u]++);let g=a.getCurrentComputedState(p);if(s>n){if(g!==void 0&&FP[g]>=s||h&&h[u]>1)break;a.setComputedState(p,r),l.add(p)}else{if(g===void 0||FP[g]>n||h&&h[c]>0)break;u=Igi(a,p,!0),a.setComputedState(p,u),l.add(p)}c=g}}if(TGo(a)&&t)for(let c of ht.concat(ht.single(i),a.getParents(i))){let u=a.getCurrentComputedDuration(c),p=$to(a,c,!0);if(u===p)break;a.setComputedDuration(c,p),l.add(c)}return l};var DGo={buffers:[],length:0,onDidWriteData:H.None,endPromise:Promise.resolve(),getRange:()=>Je.alloc(0),getRangeIter:()=>[]},ygi=class{constructor(){this.writeDataEmitter=new E;this.endDeferred=new Go;this.offset=0;this.onDidWriteData=this.writeDataEmitter.event;this.endPromise=this.endDeferred.p;this.buffers=[]}get length(){return this.offset}getRange(i,e){let t=Je.alloc(e),o=0;for(let n of this.getRangeIter(i,e))t.buffer.set(n.buffer,o),o+=n.byteLength;return o<e?t.slice(0,o):t}*getRangeIter(i,e){let t=0,o=0;for(let n of this.buffers){if(o+n.byteLength<=i){o+=n.byteLength;continue}let r=Math.max(0,i-o),s=Math.min(n.byteLength,r+e-t);if(yield n.slice(r,s),t+=s-r,o+=n.byteLength,t===e)break}}append(i,e){let t=this.offset,o=i.byteLength;if(e===void 0)return this.push(i),{offset:t,length:o};let n;(p=>(p[p.CR=13]="CR",p[p.LF=10]="LF"))(n||={});let r=Je.fromString(jto(e,!0)),s=Je.fromString(jto(e,!1));o+=r.byteLength+s.byteLength,this.push(r);let l=i.byteLength;for(;l>0;l--){let c=i.buffer[l-1];if(c!==13&&c!==10)break}return this.push(i.slice(0,l)),this.push(s),this.push(i.slice(l)),{offset:t,length:o}}push(i){i.byteLength!==0&&(this.buffers.push(i),this.writeDataEmitter.fire(i),this.offset+=i.byteLength)}end(){this.endDeferred.complete()}},Qto=function*(a,i){for(let e of Pr.fromString(i.item.extId).idsToRoot())yield a.getStateById(e.toString())},Yto=a=>{for(let i of $9e)if(a[i]>0)return i;return 0},jto=(a,i)=>`\x1B]633;SetMark;Id=${f6e(a,i)};Hidden\x07`,LGo=(a,i,e)=>({controllerId:a,expand:0,item:{...i},children:[],tasks:[],ownComputedState:0,computedState:0});var Ih=class extends C{constructor(e,t,o,n,r){super();this.id=e;this.persist=t;this.request=o;this.insertOrder=n;this.telemetry=r;this.completeEmitter=this._register(new E);this.newTaskEmitter=this._register(new E);this.endTaskEmitter=this._register(new E);this.changeEmitter=this._register(new E);this.testById=new Map;this.testMarkerCounter=0;this.startedAt=Date.now();this.onChange=this.changeEmitter.event;this.onComplete=this.completeEmitter.event;this.onNewTask=this.newTaskEmitter.event;this.onEndTask=this.endTaskEmitter.event;this.tasks=[];this.name=d(15402,null,new Date().toLocaleString(Dr));this.counts=q9e();this.computedStateAccessor={getOwnState:e=>e.ownComputedState,getCurrentComputedState:e=>e.computedState,setComputedState:(e,t)=>e.computedState=t,getChildren:e=>e.children,getParents:e=>{let{testById:t}=this;return(function*(){let o=Pr.fromString(e.item.extId).parentId;if(o)for(let n of o.idsToRoot())yield t.get(n.toString())})()}};this.doSerialize=new co(()=>({id:this.id,completedAt:this.completedAt,tasks:this.tasks.map(e=>({id:e.id,name:e.name,ctrlId:e.ctrlId,hasCoverage:!!e.coverage.get()})),name:this.name,request:this.request,items:[...this.testById.values()].map(v6e.serializeWithoutMessages)}));this.doSerializeWithMessages=new co(()=>({id:this.id,completedAt:this.completedAt,tasks:this.tasks.map(e=>({id:e.id,name:e.name,ctrlId:e.ctrlId,hasCoverage:!!e.coverage.get()})),name:this.name,request:this.request,items:[...this.testById.values()].map(v6e.serialize)}))}get completedAt(){return this._completedAt}get tests(){return this.testById.values()}getTestById(e){return this.testById.get(e)?.item}getStateById(e){return this.testById.get(e)}appendOutput(e,t,o,n){let r=e.byteLength>100?e.slice(0,100).toString()+"\u2026":e.toString(),s;(n||o)&&(s=this.testMarkerCounter++);let l=this.mustGetTaskIndex(t),c=this.tasks[l],{offset:u,length:p}=c.output.append(e,s),h={location:o,message:r,offset:u,length:p,marker:s,type:1},g=n&&this.testById.get(n);g?(g.tasks[l].messages.push(h),this.changeEmitter.fire({item:g,result:this,reason:2,message:h})):c.otherMessages.push(h)}addTask(e){this.tasks.push({...e,coverage:Le(this,void 0),otherMessages:[],output:new ygi});for(let t of this.tests)t.tasks.push({duration:void 0,messages:[],state:0});this.newTaskEmitter.fire(this.tasks.length-1)}addTestChainToRun(e,t){let o=this.testById.get(t[0].extId);o||(o=this.addTestToRun(e,t[0],null));for(let n=1;n<t.length;n++)o=this.addTestToRun(e,t[n],o.item.extId)}updateState(e,t,o,n){let r=this.testById.get(e);if(!r)return;let s=this.mustGetTaskIndex(t),l=Sgi[r.tasks[s].state],c=Sgi[o];l!==void 0&&(c===void 0||c<l)||this.fireUpdateAndRefresh(r,s,o,n)}appendMessage(e,t,o){let n=this.testById.get(e);n&&(n.tasks[this.mustGetTaskIndex(t)].messages.push(o),this.changeEmitter.fire({item:n,result:this,reason:2,message:o}))}markTaskComplete(e){let t=this.mustGetTaskIndex(e),o=this.tasks[t];o.running=!1,o.output.end(),this.setAllToState(5,e,n=>n.state===1||n.state===2),this.endTaskEmitter.fire(t)}markComplete(){if(this._completedAt!==void 0)throw new Error("cannot complete a test result multiple times");for(let e of this.tasks)e.running&&this.markTaskComplete(e.id);this._completedAt=Date.now(),this.completeEmitter.fire(),this.telemetry.publicLog2("test.outcomes",{failures:this.counts[6]+this.counts[4],passes:this.counts[3],controller:this.request.targets.map(e=>e.controllerId).join(",")})}markRetired(e){for(let[t,o]of this.testById)!o.retired&&(!e||e.hasKeyOrParent(Pr.fromString(t).path))&&(o.retired=!0,this.changeEmitter.fire({reason:0,item:o,result:this}))}toJSON(){return this.completedAt&&this.persist?this.doSerialize.value:void 0}toJSONWithMessages(){return this.completedAt&&this.persist?this.doSerializeWithMessages.value:void 0}setAllToState(e,t,o){let n=this.mustGetTaskIndex(t);for(let r of this.testById.values())o(r.tasks[n],r)&&this.fireUpdateAndRefresh(r,n,e)}fireUpdateAndRefresh(e,t,o,n){let r=e.ownComputedState,s=e.ownDuration,l={item:e,result:this,reason:1,previousState:r,previousOwnDuration:s};e.tasks[t].state=o,n!==void 0&&(e.tasks[t].duration=n,e.ownDuration=Math.max(e.ownDuration||0,n));let c=PTe(...e.tasks.map(u=>u.state));if(c===r){n!==s&&this.changeEmitter.fire(l);return}e.ownComputedState=c,this.counts[r]--,this.counts[c]++,$de(this.computedStateAccessor,e).forEach(u=>this.changeEmitter.fire(u===e?l:{item:u,result:this,reason:0}))}addTestToRun(e,t,o){let n=LGo(e,t,o);if(this.testById.set(t.extId,n),this.counts[0]++,o&&this.testById.get(o)?.children.push(n),this.tasks.length)for(let r=0;r<this.tasks.length;r++)n.tasks.push({duration:void 0,messages:[],state:0});return n}mustGetTaskIndex(e){let t=this.tasks.findIndex(o=>o.id===e);if(t===-1)throw new Error(`Unknown task ${e} in updateState`);return t}};Ih=I([m(4,Te)],Ih);var IMt=class{constructor(i,e,t=!0){this.serialized=e;this.persist=t;this.counts=q9e();this.testById=new Map;this.id=e.id,this.completedAt=e.completedAt,this.tasks=e.tasks.map((o,n)=>({id:o.id,name:o.name||d(15403,null),ctrlId:o.ctrlId,running:!1,coverage:Le(this,void 0),output:DGo,otherMessages:[]})),this.name=e.name,this.request=e.request;for(let o of e.items){let n=v6e.deserialize(i,o);this.counts[n.ownComputedState]++,this.testById.set(o.item.extId,n)}}get tests(){return this.testById.values()}getStateById(i){return this.testById.get(i)}toJSON(){return this.persist?this.serialized:void 0}toJSONWithMessages(){return this.toJSON()}};var wgi=128,RGo=16,MGo=1024*128,PGo=.2,wMt=ae("ITestResultStorage"),yMt=1,j9e=class extends C{constructor(e,t,o){super();this.uriIdentityService=e;this.logService=o;this.stored=this._register(new dS({key:"storedTestResults",scope:1,target:1},t))}async read(){let e=await Promise.all(this.stored.get([]).map(async o=>{if(o.rev===yMt)try{let n=await this.readForResultId(o.id);return n?{rec:o,result:new IMt(this.uriIdentityService,n)}:void 0}catch(n){this.logService.warn(`Error deserializing stored test result ${o.id}`,n);return}})),t=e.filter(mo);return t.length!==e.length&&this.stored.store(t.map(({rec:o})=>o)),t.map(({result:o})=>o)}getResultOutputWriter(e){let t=Obe();return this.storeOutputForResultId(e,t),t}async persist(e){let t=new Map(this.stored.get([]).map(({id:s,bytes:l})=>[s,l])),o=[],n=[],r=MGo;for(let s=0;s<e.length&&s<wgi&&(r>0||o.length<RGo);s++){let l=e[s],c=t.get(l.id);if(c!==void 0){t.delete(l.id),o.push({id:l.id,rev:yMt,bytes:c}),r-=c;continue}let u=l.toJSON();if(!u)continue;let p=Je.fromString(JSON.stringify(u));n.push(this.storeForResultId(l.id,u)),o.push({id:l.id,rev:yMt,bytes:p.byteLength}),r-=p.byteLength}for(let s of t.keys())n.push(this.deleteForResultId(s).catch(()=>{}));this.stored.store(o),await Promise.all(n)}};j9e=I([m(0,dt),m(1,le),m(2,ne)],j9e);var ATe=class extends j9e{constructor(e,t,o,n,r,s){super(e,t,o);this.fileService=r;this.directory=A.joinPath(s.workspaceStorageHome,n.getWorkspace().id,"testResults")}async readForResultId(e){let t=await this.fileService.readFile(this.getResultJsonPath(e));return JSON.parse(t.value.toString())}storeForResultId(e,t){return this.fileService.writeFile(this.getResultJsonPath(e),Je.fromString(JSON.stringify(t)))}deleteForResultId(e){return this.fileService.del(this.getResultJsonPath(e)).catch(()=>{})}async readOutputRangeForResultId(e,t,o){try{let{value:n}=await this.fileService.readFile(this.getResultOutputPath(e),{position:t,length:o});return n}catch{return Je.alloc(0)}}async readOutputForResultId(e){try{let{value:t}=await this.fileService.readFileStream(this.getResultOutputPath(e));return t}catch{return WT(Je.alloc(0))}}async storeOutputForResultId(e,t){await this.fileService.createFile(this.getResultOutputPath(e),t)}async persist(e){await super.persist(e),Math.random()<PGo&&await this.cleanupDereferenced()}async cleanupDereferenced(){let{children:e}=await this.fileService.resolve(this.directory);if(!e)return;let t=new Set(this.stored.get([]).filter(o=>o.rev===yMt).map(o=>o.id));await Promise.all(e.filter(o=>!t.has(o.name.replace(/\.[a-z]+$/,""))).map(o=>this.fileService.del(o.resource).catch(()=>{})))}getResultJsonPath(e){return A.joinPath(this.directory,`${e}.json`)}getResultOutputPath(e){return A.joinPath(this.directory,`${e}.output`)}};ATe=I([m(0,dt),m(1,le),m(2,ne),m(3,Pe),m(4,be),m(5,Co)],ATe);var AGo=a=>a.results.length>0&&a.results[0].completedAt===void 0,ed=ae("testResultService"),NTe=class extends C{constructor(e,t,o,n){super();this.storage=t;this.testProfiles=o;this.telemetryService=n;this.changeResultEmitter=this._register(new E);this._results=[];this._resultsDisposables=[];this.testChangeEmitter=this._register(new E);this.insertOrderCounter=0;this.onResultsChanged=this.changeResultEmitter.event;this.onTestChanged=this.testChangeEmitter.event;this.loadResults=wd(()=>this.storage.read().then(e=>{for(let t=e.length-1;t>=0;t--)this.push(e[t])}));this.persistScheduler=this._register(new Dt(()=>this.persistImmediately(),500));this._register(Z(()=>Ue(this._resultsDisposables))),this.isRunning=Ji.isRunning.bindTo(e),this.hasAnyResults=Ji.hasAnyResults.bindTo(e)}get results(){return this.loadResults(),this._results}getStateById(e){for(let t of this.results){let o=t.getStateById(e);if(o&&o.computedState!==0)return[t,o]}}createLiveResult(e){if("targets"in e){let n=_t();return this.push(new Ih(n,!0,e,this.insertOrderCounter++,this.telemetryService))}let t;e.profile&&(t=this.testProfiles.getControllerProfiles(e.controllerId).find(r=>r.profileId===e.profile.id));let o={preserveFocus:e.preserveFocus,targets:[],exclude:e.exclude,continuous:e.continuous,group:t?.group??2};return t&&o.targets.push({profileId:t.profileId,controllerId:e.controllerId,testIds:e.include}),this.push(new Ih(e.id,e.persist,o,this.insertOrderCounter++,this.telemetryService))}push(e){if(e.completedAt===void 0)this.results.unshift(e);else{let o=xy(this.results,n=>n.completedAt!==void 0&&n.completedAt<=e.completedAt);this.results.splice(o,0,e),this.persistScheduler.schedule()}this.hasAnyResults.set(!0),this.results.length>wgi&&(this.results.pop(),this._resultsDisposables.pop()?.dispose());let t=new P;if(this._resultsDisposables.push(t),e instanceof Ih)t.add(e),t.add(e.onComplete(()=>this.onComplete(e))),t.add(e.onChange(this.testChangeEmitter.fire,this.testChangeEmitter)),this.isRunning.set(!0),this.changeResultEmitter.fire({started:e});else{this.changeResultEmitter.fire({inserted:e});for(let o of e.tests)for(let n of this.results)if(n===e){this.testChangeEmitter.fire({item:o,result:e,reason:0});break}else if(n.getStateById(o.item.extId)!==void 0)break}return e}getResult(e){return this.results.find(t=>t.id===e)}clear(){let e=[],t=[];for(let o of this.results)o.completedAt!==void 0?t.push(o):e.push(o);this._results=e,this.persistScheduler.schedule(),e.length===0&&this.hasAnyResults.set(!1),this.changeResultEmitter.fire({removed:t})}onComplete(e){this.resort(),this.updateIsRunning(),this.persistScheduler.schedule(),this.changeResultEmitter.fire({completed:e})}resort(){this.results.sort((e,t)=>{if(!!e.completedAt!=!!t.completedAt)return e.completedAt===void 0?-1:1;let o=e instanceof Ih?e.insertOrder:-1;return(t instanceof Ih?t.insertOrder:-1)-o})}updateIsRunning(){this.isRunning.set(AGo(this))}async persistImmediately(){await this.loadResults(),this.storage.persist(this.results)}};NTe=I([m(0,X),m(1,wMt),m(2,$d),m(3,Te)],NTe);var Es=ae("testService"),Xto=a=>!ht.some(a.rootItems,i=>i.children.size>0),Jto=(a,i)=>{if(typeof i=="string"&&(i=Pr.fromString(i)),i.isRoot)return{controller:i.toString()};let e={$mid:16,tests:[]};for(let t of i.idsFromRoot())if(!t.isRoot){let o=a.getNodeById(t.toString());o&&e.tests.push(o)}return e},Zto=async(a,i,e=ve.None)=>{let t=[...Pr.fromString(i).idsFromRoot()],o=0;for(let n=t.length-1;!e.isCancellationRequested&&n>=o;){let r=t[n].toString(),s=a.getNodeById(r);if(!s){n--;continue}if(n===t.length-1)return s;s.children.has(t[n+1].toString())||await a.expand(r,0),o=n+1,n=t.length-1}},Q9e=(a,i)=>{if(i.item.busy)return new Promise(e=>{let t=a.onDidProcessDiff(()=>{a.collection.getNodeById(i.item.extId)?.item.busy!==!0&&(e(),t.dispose())})})},qde=async function*(a,i,e,t=!0,o=!0){let n=new Vs,r=[...a.collection.getNodeByUrl(e)].sort((c,u)=>c.item.extId.length-u.item.extId.length);for(let c=0;c<r.length-1;c++){let u=r[c].item.extId+"\0";for(let p=c+1;p<r.length;p++)r[p].item.extId.startsWith(u)&&r.splice(p--,1)}n.push(r.length?r.map(c=>c.item.extId):a.collection.rootIds);let s=0,l=[];for(;n.size>0;){let c=n.pop(),u;c instanceof Go?c.isSettled?u=c.value||ht.empty():(l.length&&(yield l,l=[]),u=await c.p):u=c;for(let p of u){s++;let h=a.collection.getNodeById(p);if(h){if(!h.item.uri){n.push(h.children);continue}if(!(i.extUri.isEqual(e,h.item.uri)&&(l.push(h),!o))&&i.extUri.isEqualOrParent(e,h.item.uri)){let g;h.expand===1&&(g=a.collection.expand(h.item.extId,1)),t&&(g?g=g.then(()=>Q9e(a,h)):h.item.busy&&(g=Q9e(a,h))),g?n.push(Go.fromPromise(g.then(()=>h.children))):h.children.size&&n.push(h.children)}}}}l.length&&(yield l)},eio=async function*(a,i,e,t=!0){let o=[a.collection.rootIds];for(;o.length;)for(let n of o.pop()){let r=a.collection.getNodeById(n);r&&(r.item.uri&&i.extUri.isEqualOrParent(r.item.uri,e)?yield r:(!r.item.uri||i.extUri.isEqualOrParent(e,r.item.uri))&&(r.expand===1&&await a.collection.expand(r.item.extId,1),t&&await Q9e(a,r),o.push(r.children.values())))}},tio=(a,i)=>{if(i.length<2)return i;let e=new EP;for(let n of i)e.insert(Pr.fromString(n.item.extId).path,n);let t=[],o=(n,r)=>{if(r.value)return r.value;Ey(!!r.children,"expect to have children");let s=[];for(let[u,p]of r.children){n.push(u);let h=o(n,p);h&&s.push(h),n.pop()}if(!s.length)return;let l=new Pr(n),c=a.getNodeById(l.toString());if(c?.children.size===s.length)return c;t.push(...s)};for(let[n,r]of e.entries){let s=o([n],r);s&&t.push(s)}return t};var CMt=class extends C{constructor(e,t,o,n,r){super();this.uriIdentityService=t;this.testService=o;this.testProfiles=n;this.resultService=r;this.diffListener=this._register(new me);this.testProviderRegistrations=new Map;this.proxy=e.getProxy(Zi.ExtHostTesting),this._register(this.testService.registerExtHost({provideTestFollowups:(s,l)=>this.proxy.$provideTestFollowups(s,l),executeTestFollowup:s=>this.proxy.$executeTestFollowup(s),disposeTestFollowups:s=>this.proxy.$disposeTestFollowups(s),getTestsRelatedToCode:(s,l,c)=>this.proxy.$getTestsRelatedToCode(s,l,c)})),this._register(this.testService.onDidCancelTestRun(({runId:s,taskId:l})=>{this.proxy.$cancelExtensionTestRun(s,l)})),this._register(H.debounce(n.onDidChange,(s,l)=>l)(()=>{let s={};for(let l of[2,4,8])for(let c of this.testProfiles.getGroupDefaultProfiles(l))s[c.controllerId]??=[],s[c.controllerId].push(c.profileId);this.proxy.$setDefaultRunProfiles(s)})),this._register(r.onResultsChanged(s=>{if("completed"in s){let l=s.completed.toJSONWithMessages();l&&this.proxy.$publishTestResults([l])}else"removed"in s&&s.removed.forEach(l=>{l instanceof Ih&&this.proxy.$disposeRun(l.id)})}))}$markTestRetired(e){let t;if(e){t=new EP;for(let o of e)t.insert(Pr.fromString(o).path,void 0)}for(let o of this.resultService.results)o instanceof Ih&&o.markRetired(t)}$publishTestRunProfile(e){let t=this.testProviderRegistrations.get(e.controllerId);t&&this.testProfiles.addProfile(t.instance,e)}$updateTestRunConfig(e,t,o){this.testProfiles.updateProfile(e,t,o)}$removeTestProfile(e,t){this.testProfiles.removeProfile(e,t)}$addTestsToRun(e,t,o){this.withLiveRun(t,n=>n.addTestChainToRun(e,o.map(r=>g6e.deserialize(this.uriIdentityService,r))))}$appendCoverage(e,t,o){this.withLiveRun(e,n=>{let r=n.tasks.find(l=>l.id===t);if(!r)return;let s=ypi.deserialize(this.uriIdentityService,o);Ui(l=>{let c=r.coverage.read(void 0);c?c.append(s,l):(c=new hMt(n,t,this.uriIdentityService,{getCoverageDetails:(u,p,h)=>this.proxy.$getCoverageDetails(u,p,h).then(g=>g.map(xpi.deserialize))}),c.append(s,l),r.coverage.set(c,l))})})}$startedExtensionTestRun(e){this.resultService.createLiveResult(e)}$startedTestRunTask(e,t){this.withLiveRun(e,o=>o.addTask(t))}$finishedTestRunTask(e,t){this.withLiveRun(e,o=>o.markTaskComplete(t))}$finishedExtensionTestRun(e){this.withLiveRun(e,t=>t.markComplete())}$updateTestStateInRun(e,t,o,n,r){this.withLiveRun(e,s=>s.updateState(o,t,n,r))}$appendOutputToRun(e,t,o,n,r){let s=n&&{uri:A.revive(n.uri),range:z.lift(n.range)};this.withLiveRun(e,l=>l.appendOutput(o,t,s,r))}$appendTestMessagesInRun(e,t,o,n){let r=this.resultService.getResult(e);if(r&&r instanceof Ih)for(let s of n)r.appendMessage(o,t,XO.deserialize(this.uriIdentityService,s))}$registerTestController(e,t,o){let n=new P,r=Le(`${e}.label`,t),s=Le(`${e}.cap`,o),l={id:e,label:r,capabilities:s,syncTests:()=>this.proxy.$syncTests(),refreshTests:c=>this.proxy.$refreshTests(e,c),configureRunProfile:c=>this.proxy.$configureRunProfile(e,c),runTests:(c,u)=>this.proxy.$runControllerTests(c,u),startContinuousRun:(c,u)=>this.proxy.$startContinuousRun(c,u),expandTest:(c,u)=>this.proxy.$expandTest(c,isFinite(u)?u:-1),getRelatedCode:(c,u)=>this.proxy.$getCodeRelatedToTest(c,u).then(p=>p.map(h=>({uri:A.revive(h.uri),range:z.lift(h.range)})))};n.add(Z(()=>this.testProfiles.removeProfile(e))),n.add(this.testService.registerTestController(e,l)),this.testProviderRegistrations.set(e,{instance:l,label:r,capabilities:s,disposable:n})}$updateController(e,t){let o=this.testProviderRegistrations.get(e);o&&Ui(n=>{t.label!==void 0&&o.label.set(t.label,n),t.capabilities!==void 0&&o.capabilities.set(t.capabilities,n)})}$unregisterTestController(e){this.testProviderRegistrations.get(e)?.disposable.dispose(),this.testProviderRegistrations.delete(e)}$subscribeToDiffs(){this.proxy.$acceptDiff(this.testService.collection.getReviverDiff().map(RDt.serialize)),this.diffListener.value=this.testService.onDidProcessDiff(this.proxy.$acceptDiff,this.proxy)}$unsubscribeFromDiffs(){this.diffListener.clear()}$publishDiff(e,t){this.testService.publishDiff(e,t.map(o=>RDt.deserialize(this.uriIdentityService,o)))}async $runTests(e,t){return(await this.testService.runResolvedTests(e,t)).id}async $getCoverageDetails(e,t,o,n){return await this.resultService.getResult(e)?.tasks[t]?.coverage.get()?.getUri(A.from(o))?.details(n)||[]}dispose(){super.dispose();for(let e of this.testProviderRegistrations.values())e.disposable.dispose();this.testProviderRegistrations.clear()}withLiveRun(e,t){let o=this.resultService.getResult(e);return o&&o instanceof Ih?t(o):void 0}};CMt=I([vo(Gi.MainThreadTesting),m(1,dt),m(2,Es),m(3,$d),m(4,ed)],CMt);var xMt=class extends C{constructor(e,t,o,n){super();this.secretStorageService=t;this.logService=o;this._sequencer=new NT;this._proxy=e.getProxy(Zi.ExtHostSecretState),this._register(this.secretStorageService.onDidChangeSecret(r=>{let s=this.parseKey(r);s&&this._proxy.$onDidChangePassword(s)}))}$getPassword(e,t){return this.logService.trace(`[mainThreadSecretState] Getting password for ${e} extension: `,t),this._sequencer.queue(e,()=>this.doGetPassword(e,t))}async doGetPassword(e,t){let o=this.getKey(e,t),n=await this.secretStorageService.get(o);return this.logService.trace(`[mainThreadSecretState] ${n?"P":"No p"}assword found for: `,e,t),n}$setPassword(e,t,o){return this.logService.trace(`[mainThreadSecretState] Setting password for ${e} extension: `,t),this._sequencer.queue(e,()=>this.doSetPassword(e,t,o))}async doSetPassword(e,t,o){let n=this.getKey(e,t);await this.secretStorageService.set(n,o),this.logService.trace("[mainThreadSecretState] Password set for: ",e,t)}$deletePassword(e,t){return this.logService.trace(`[mainThreadSecretState] Deleting password for ${e} extension: `,t),this._sequencer.queue(e,()=>this.doDeletePassword(e,t))}async doDeletePassword(e,t){let o=this.getKey(e,t);await this.secretStorageService.delete(o),this.logService.trace("[mainThreadSecretState] Password deleted for: ",e,t)}$getKeys(e){return this.logService.trace(`[mainThreadSecretState] Getting keys for ${e} extension: `),this._sequencer.queue(e,()=>this.doGetKeys(e))}async doGetKeys(e){if(!this.secretStorageService.keys)throw new Error("Secret storage service does not support keys() method");let o=(await this.secretStorageService.keys()).map(n=>this.parseKey(n)).filter(n=>n!==void 0&&n.extensionId===e).map(({key:n})=>n);return this.logService.trace(`[mainThreadSecretState] Got ${o.length}key(s) for: `,e),o}getKey(e,t){return JSON.stringify({extensionId:e,key:t})}parseKey(e){try{return JSON.parse(e)}catch{return}}};xMt=I([vo(Gi.MainThreadSecretState),m(1,LE),m(2,ne),m(3,ru)],xMt);var OTe=ae("shareService");var kMt=class{constructor(i,e){this.shareService=e;this.providers=new Map;this.providerDisposables=new Map;this.proxy=i.getProxy(Zi.ExtHostShare)}$registerShareProvider(i,e,t,o,n){let r={id:t,label:o,selector:e,priority:n,provideShare:async l=>{let c=await this.proxy.$provideShare(i,l,ve.None);return typeof c=="string"?c:A.revive(c)}};this.providers.set(i,r);let s=this.shareService.registerShareProvider(r);this.providerDisposables.set(i,s)}$unregisterShareProvider(i){this.providers.delete(i),this.providerDisposables.delete(i)}dispose(){this.providers.clear(),Ue(this.providerDisposables.values()),this.providerDisposables.clear()}};kMt=I([vo(Gi.MainThreadShare),m(1,OTe)],kMt);var EMt=class extends C{constructor(e,t){super();this.userDataProfileImportExportService=t;this.registeredHandlers=this._register(new jt);this.proxy=e.getProxy(Zi.ExtHostProfileContentHandlers)}async $registerProfileContentHandler(e,t,o,n){this.registeredHandlers.set(e,this.userDataProfileImportExportService.registerProfileContentHandler(e,{name:t,description:o,extensionId:n,saveProfile:async(r,s,l)=>{let c=await this.proxy.$saveProfile(e,r,s,l);return c?Xn(c):null},readProfile:async(r,s)=>this.proxy.$readProfile(e,r,s)}))}async $unregisterProfileContentHandler(e){this.registeredHandlers.deleteAndDispose(e)}};EMt=I([vo(Gi.MainThreadProfileContentHandlers),m(1,PV)],EMt);var FTe=ae("IAiRelatedInformationService");var TMt=class extends C{constructor(e,t){super();this._aiRelatedInformationService=t;this._registrations=this._register(new jt);this._proxy=e.getProxy(Zi.ExtHostAiRelatedInformation)}$getAiRelatedInformation(e,t){return this._aiRelatedInformationService.getRelatedInformation(e,t,ve.None)}$registerAiRelatedInformationProvider(e,t){let o={provideAiRelatedInformation:(n,r)=>this._proxy.$provideAiRelatedInformation(e,n,r)};this._registrations.set(e,this._aiRelatedInformationService.registerAiRelatedInformationProvider(t,o))}$unregisterAiRelatedInformationProvider(e){this._registrations.deleteAndDispose(e)}};TMt=I([vo(Gi.MainThreadAiRelatedInformation),m(1,FTe)],TMt);var Cgi=ae("IAiEmbeddingVectorService"),jde=class{constructor(i){this.logService=i;this._providers=[]}static{this.DEFAULT_TIMEOUT=1e3*10}isEnabled(){return this._providers.length>0}registerAiEmbeddingVectorProvider(i,e){return this._providers.push(e),{dispose:()=>{let t=this._providers.indexOf(e);t>=0&&this._providers.splice(t,1)}}}async getEmbeddingVector(i,e){if(this._providers.length===0)throw new Error("No embedding vector providers registered");let t=En.create(),o=[],n=Pi(jde.DEFAULT_TIMEOUT),r=e.onCancellationRequested(()=>{r.dispose(),n.cancel()});for(let s of this._providers)o.push(xn(async l=>{try{return await s.provideAiEmbeddingVector(Array.isArray(i)?i:[i],l)}catch{}throw await n,new Error("Embedding vector provider timed out")}));o.push(xn(async s=>{let l=s.onCancellationRequested(()=>{n.cancel(),l.dispose()});throw await n,new Error("Embedding vector provider timed out")}));try{let s=await Dre(o);return s.length===1?s[0]:s}finally{t.stop(),this.logService.trace(`[AiEmbeddingVectorService]: getEmbeddingVector took ${t.elapsed()}ms`)}}};jde=I([m(0,ne)],jde);we(Cgi,jde,1);var _Mt=class extends C{constructor(e,t){super();this._AiEmbeddingVectorService=t;this._registrations=this._register(new jt);this._proxy=e.getProxy(Zi.ExtHostAiEmbeddingVector)}$registerAiEmbeddingVectorProvider(e,t){let o={provideAiEmbeddingVector:(n,r)=>this._proxy.$provideAiEmbeddingVector(t,n,r)};this._registrations.set(t,this._AiEmbeddingVectorService.registerAiEmbeddingVectorProvider(e,o))}$unregisterAiEmbeddingVectorProvider(e){this._registrations.deleteAndDispose(e)}};_Mt=I([vo(Gi.MainThreadAiEmbeddingVector),m(1,Cgi)],_Mt);var DMt=class extends C{constructor(e,t){super();this._settingsSearchService=t;this._registrations=this._register(new jt);this._proxy=e.getProxy(Zi.ExtHostAiSettingsSearch)}$registerAiSettingsSearchProvider(e){let t={searchSettings:(o,n,r)=>this._proxy.$startSearch(e,o,n,r)};this._registrations.set(e,this._settingsSearchService.registerSettingsSearchProvider(t))}$unregisterAiSettingsSearchProvider(e){this._registrations.deleteAndDispose(e)}$handleSearchResult(e,t){if(!this._registrations.has(e))throw new Error("No AI settings search provider found");this._settingsSearchService.handleSearchResult(t)}};DMt=I([vo(Gi.MainThreadAiSettingsSearch),m(1,dEe)],DMt);var WTe=ae("IWorkbenchMcpGatewayService");var md=ae("mcpRegistry");var Qde=ae("IAuthenticationMcpAccessService"),Y9e=class extends C{constructor(e,t){super();this._storageService=e;this._productService=t;this._onDidChangeMcpSessionAccess=this._register(new E);this.onDidChangeMcpSessionAccess=this._onDidChangeMcpSessionAccess.event}isAccessAllowed(e,t,o){let n=this._productService.trustedMcpAuthAccess;if(Array.isArray(n)){if(n.includes(o))return!0}else if(n?.[e]?.includes(o))return!0;let s=this.readAllowedMcpServers(e,t).find(l=>l.id===o);if(s)return s.allowed!==void 0?s.allowed:!0}readAllowedMcpServers(e,t){let o=[];try{let s=this._storageService.get(`mcpserver-${e}-${t}`,-1);s&&(o=JSON.parse(s))}catch{}let n=this._productService.trustedMcpAuthAccess,r=Array.isArray(n)?n:typeof n=="object"?n[e]??[]:[];for(let s of r){let l=o.find(c=>c.id===s);l?(l.allowed=!0,l.trusted=!0):o.push({id:s,name:s,allowed:!0,trusted:!0})}return o}updateAllowedMcpServers(e,t,o){let n=this.readAllowedMcpServers(e,t);for(let s of o){let l=n.findIndex(c=>c.id===s.id);l===-1?n.push(s):(n[l].allowed=s.allowed,s.name&&s.name!==s.id&&n[l].name!==s.name&&(n[l].name=s.name))}let r=n.filter(s=>!s.trusted);this._storageService.store(`mcpserver-${e}-${t}`,JSON.stringify(r),-1,0),this._onDidChangeMcpSessionAccess.fire({providerId:e,accountName:t})}removeAllowedMcpServers(e,t){this._storageService.remove(`mcpserver-${e}-${t}`,-1),this._onDidChangeMcpSessionAccess.fire({providerId:e,accountName:t})}};Y9e=I([m(0,le),m(1,nt)],Y9e);we(Qde,Y9e,1);var zl=ae("activityService"),X9e=class{constructor(i,e){this.descriptorFn=i;this.stylesFn=e}getDescription(){return this.descriptorFn(null)}getColors(i){return this.stylesFn?.(i)}},qc=class extends X9e{constructor(e,t){super(t,void 0);this.number=e;this.number=e}getDescription(){return this.descriptorFn(this.number)}},eK=class extends X9e{constructor(e,t,o){super(t,o);this.icon=e}},PC=class extends X9e{constructor(i){super(i,void 0)}},J9e=class extends eK{constructor(i){super(M.warning,i,e=>({badgeBackground:e.getColor(q2i),badgeForeground:e.getColor($2i),badgeBorder:void 0}))}};var Yde=ae("IAuthenticationMcpUsageService"),Z9e=class extends C{constructor(e,t,o,n){super();this._storageService=e;this._authenticationService=t;this._logService=o;this._queue=new Op;this._mcpServersUsingAuth=new Set;let r=n.trustedMcpAuthAccess;if(Array.isArray(r))for(let s of r)this._mcpServersUsingAuth.add(s);else if(r)for(let s of Object.values(r))for(let l of s)this._mcpServersUsingAuth.add(l);this._register(this._authenticationService.onDidRegisterAuthenticationProvider(s=>this._queue.queue(()=>this._addToCache(s.id))))}async initializeUsageCache(){await this._queue.queue(()=>Promise.all(this._authenticationService.getProviderIds().map(e=>this._addToCache(e))))}async hasUsedAuth(e){return await this._queue.whenIdle(),this._mcpServersUsingAuth.has(e)}readAccountUsages(e,t){let o=`${e}-${t}-mcpserver-usages`,n=this._storageService.get(o,-1),r=[];if(n)try{r=JSON.parse(n)}catch{}return r}removeAccountUsage(e,t){let o=`${e}-${t}-mcpserver-usages`;this._storageService.remove(o,-1)}addAccountUsage(e,t,o,n,r){let s=`${e}-${t}-mcpserver-usages`,l=this.readAccountUsages(e,t),c=l.findIndex(u=>u.mcpServerId===n);c>-1?l.splice(c,1,{mcpServerId:n,mcpServerName:r,scopes:o,lastUsed:Date.now()}):l.push({mcpServerId:n,mcpServerName:r,scopes:o,lastUsed:Date.now()}),this._storageService.store(s,JSON.stringify(l),-1,1),this._mcpServersUsingAuth.add(n)}async _addToCache(e){try{let t=await this._authenticationService.getAccounts(e);for(let o of t){let n=this.readAccountUsages(e,o.label);for(let r of n)this._mcpServersUsingAuth.add(r.mcpServerId)}}catch(t){this._logService.error(t)}}};Z9e=I([m(0,le),m(1,Cs),m(2,ne),m(3,nt)],Z9e);we(Yde,Z9e,1);var e7e=" ",i7e=ae("IAuthenticationMcpService"),t7e=class extends C{constructor(e,t,o,n,r,s,l,c){super();this.activityService=e;this.storageService=t;this.dialogService=o;this.quickInputService=n;this._productService=r;this._authenticationService=s;this._authenticationUsageService=l;this._authenticationAccessService=c;this._signInRequestItems=new Map;this._sessionAccessRequestItems=new Map;this._accountBadgeDisposable=this._register(new me);this._onDidAccountPreferenceChange=this._register(new E);this.onDidChangeAccountPreference=this._onDidAccountPreferenceChange.event;this._inheritAuthAccountPreferenceParentToChildren=this._productService.inheritAuthAccountPreference||{},this._inheritAuthAccountPreferenceChildToParent=Object.entries(this._inheritAuthAccountPreferenceParentToChildren).reduce((u,[p,h])=>(h.forEach(g=>{u[g]=p}),u),{}),this.registerListeners()}registerListeners(){this._register(this._authenticationService.onDidChangeSessions(async e=>{e.event.added?.length&&await this.updateNewSessionRequests(e.providerId,e.event.added),e.event.removed?.length&&await this.updateAccessRequests(e.providerId,e.event.removed),this.updateBadgeCount()})),this._register(this._authenticationService.onDidUnregisterAuthenticationProvider(e=>{let t=this._sessionAccessRequestItems.get(e.id)||{};Object.keys(t).forEach(o=>{this.removeAccessRequest(e.id,o)})}))}async updateNewSessionRequests(e,t){let o=this._signInRequestItems.get(e);o&&Object.keys(o).forEach(n=>{let r=n.split(e7e);t.some(s=>cMt(s.scopes,r))&&(o[n]?.disposables.forEach(l=>l.dispose()),delete o[n],Object.keys(o).length===0?this._signInRequestItems.delete(e):this._signInRequestItems.set(e,o))})}async updateAccessRequests(e,t){let o=this._sessionAccessRequestItems.get(e);o&&Object.keys(o).forEach(n=>{t.forEach(r=>{let s=o[n].possibleSessions.findIndex(l=>l.id===r.id);s&&o[n].possibleSessions.splice(s,1)}),o[n].possibleSessions.length||this.removeAccessRequest(e,n)})}updateBadgeCount(){this._accountBadgeDisposable.clear();let e=0;if(this._signInRequestItems.forEach(t=>{Object.keys(t).forEach(o=>{e+=t[o].requestingMcpServerIds.length})}),this._sessionAccessRequestItems.forEach(t=>{e+=Object.keys(t).length}),e>0){let t=new qc(e,()=>d(16643,null));this._accountBadgeDisposable.value=this.activityService.showAccountsActivity({badge:t})}}removeAccessRequest(e,t){let o=this._sessionAccessRequestItems.get(e)||{};o[t]&&(Ue(o[t].disposables),delete o[t],this.updateBadgeCount())}updateAccountPreference(e,t,o){let n=this._inheritAuthAccountPreferenceChildToParent[e]??e,r=this._getKey(n,t);this.storageService.store(r,o.label,1,1),this.storageService.store(r,o.label,-1,1);let s=this._inheritAuthAccountPreferenceParentToChildren[n],l=s?[n,...s]:[n];this._onDidAccountPreferenceChange.fire({mcpServerIds:l,providerId:t})}getAccountPreference(e,t){let o=this._getKey(this._inheritAuthAccountPreferenceChildToParent[e]??e,t);return this.storageService.get(o,1)??this.storageService.get(o,-1)}removeAccountPreference(e,t){let o=this._getKey(this._inheritAuthAccountPreferenceChildToParent[e]??e,t);this.storageService.remove(o,1),this.storageService.remove(o,-1)}_getKey(e,t){return`${e}-${t}`}updateSessionPreference(e,t,o){let n=`${t}-${e}-${o.scopes.join(e7e)}`;this.storageService.store(n,o.id,1,1),this.storageService.store(n,o.id,-1,1)}getSessionPreference(e,t,o){let n=`${t}-${e}-${o.join(e7e)}`;return this.storageService.get(n,1)??this.storageService.get(n,-1)}removeSessionPreference(e,t,o){let n=`${t}-${e}-${o.join(e7e)}`;this.storageService.remove(n,1),this.storageService.remove(n,-1)}_updateAccountAndSessionPreferences(e,t,o){this.updateAccountPreference(t,e,o.account),this.updateSessionPreference(e,t,o)}async showGetSessionPrompt(e,t,o,n){let r;(p=>(p[p.Allow=0]="Allow",p[p.Deny=1]="Deny",p[p.Cancel=2]="Cancel"))(r||={});let{result:s}=await this.dialogService.prompt({type:St.Info,message:d(16639,null,n,e.label,t),buttons:[{label:d(16638,null),run:()=>0},{label:d(16640,null),run:()=>1}],cancelButton:{run:()=>2}});return s!==2&&(this._authenticationAccessService.updateAllowedMcpServers(e.id,t,[{id:o,name:n,allowed:s===0}]),this.removeAccessRequest(e.id,o)),s===0}async selectSession(e,t,o,n,r){let s=await this._authenticationService.getAccounts(e);if(!s.length)throw new Error("No accounts available");let l=new P,c=l.add(this.quickInputService.createQuickPick());c.ignoreFocusOut=!0;let u=new Set,p=r.filter(h=>!u.has(h.account.label)&&u.add(h.account.label)).map(h=>({label:h.account.label,session:h}));return s.forEach(h=>{u.has(h.label)||p.push({label:h.label,account:h})}),p.push({label:d(16645,null)}),c.items=p,c.title=d(16642,null,o,this._authenticationService.getProvider(e).label),c.placeholder=d(16641,null,o),await new Promise((h,g)=>{l.add(c.onDidAccept(async f=>{c.dispose();let v=c.selectedItems[0].session;if(!v){let S=c.selectedItems[0].account;try{v=await this._authenticationService.createSession(e,n,{account:S})}catch(y){g(y);return}}let b=v.account.label;this._authenticationAccessService.updateAllowedMcpServers(e,b,[{id:t,name:o,allowed:!0}]),this._updateAccountAndSessionPreferences(e,t,v),this.removeAccessRequest(e,t),h(v)})),l.add(c.onDidHide(f=>{c.selectedItems[0]||g("User did not consent to account access"),l.dispose()})),c.show()})}async completeSessionAccessRequest(e,t,o,n){let s=(this._sessionAccessRequestItems.get(e.id)||{})[t];if(!s||!e)return;let l=s.possibleSessions,c;if(e.supportsMultipleAccounts)try{c=await this.selectSession(e.id,t,o,n,l)}catch{}else await this.showGetSessionPrompt(e,l[0].account.label,t,o)&&(c=l[0]);c&&this._authenticationUsageService.addAccountUsage(e.id,c.account.label,c.scopes,t,o)}requestSessionAccess(e,t,o,n,r){let s=this._sessionAccessRequestItems.get(e)||{};if(s[t])return;let c=this._authenticationService.getProvider(e),u=fe.appendMenuItem(D.AccountsContext,{group:"3_accessRequests",command:{id:`${e}${t}Access`,title:d(16637,null,c.label,o)}}),p=qe.registerCommand({id:`${e}${t}Access`,handler:async h=>{this.completeSessionAccessRequest(c,t,o,n)}});s[t]={possibleSessions:r,disposables:[u,p]},this._sessionAccessRequestItems.set(e,s),this.updateBadgeCount()}async requestNewSession(e,t,o,n){this._authenticationService.isAuthenticationProviderRegistered(e)||await new Promise((g,f)=>{let v=this._authenticationService.onDidRegisterAuthenticationProvider(b=>{b.id===e&&(v.dispose(),g())})});let r;try{r=this._authenticationService.getProvider(e)}catch{return}let s=this._signInRequestItems.get(e),l=t.join(e7e);if(s&&s[l]&&s[l].requestingMcpServerIds.includes(o))return;let u=`${e}:${o}:signIn${Object.keys(s||[]).length}`,p=fe.appendMenuItem(D.AccountsContext,{group:"2_signInRequests",command:{id:u,title:d(16644,null,r.label,n)}}),h=qe.registerCommand({id:u,handler:async g=>{let v=await g.get(Cs).createSession(e,t);this._authenticationAccessService.updateAllowedMcpServers(e,v.account.label,[{id:o,name:n,allowed:!0}]),this._updateAccountAndSessionPreferences(e,o,v)}});if(s){let g=s[l]||{disposables:[],requestingMcpServerIds:[]};s[l]={disposables:[...g.disposables,p,h],requestingMcpServerIds:[...g.requestingMcpServerIds,o]},this._signInRequestItems.set(e,s)}else this._signInRequestItems.set(e,{[l]:{disposables:[p,h],requestingMcpServerIds:[o]}});this.updateBadgeCount()}};t7e=I([m(0,zl),m(1,le),m(2,ct),m(3,Ge),m(4,nt),m(5,Cs),m(6,Yde),m(7,Qde)],t7e);we(i7e,t7e,1);var LMt=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this._extHostContext=e;this._mcpRegistry=t;this.dialogService=o;this._authenticationService=n;this.authenticationMcpServersService=r;this.authenticationMCPServerAccessService=s;this.authenticationMCPServerUsageService=l;this._dynamicAuthenticationProviderStorageService=c;this._extensionService=u;this._contextKeyService=p;this._telemetryService=h;this._mcpGatewayService=g;this._serverIdCounter=0;this._servers=new Map;this._serverDefinitions=new Map;this._serverAuthTracking=new kgi;this._collectionDefinitions=this._register(new jt);this._gateways=this._register(new jt);this._register(n.onDidChangeSessions(b=>this._onDidChangeAuthSessions(b.providerId,b.label)));let f=this._proxy=e.getProxy(Zi.ExtHostMcp);this._register(this._mcpRegistry.registerDelegate({priority:e.extensionHostKind===2?0:1,waitForInitialProviderPromises(){return f.$waitForInitialCollectionProviders()},canStart(b,S){return!(b.remoteAuthority!==e.remoteAuthority||S.launch.type===1&&e.extensionHostKind===2)},async substituteVariables(b,S){let y=await f.$substituteVariables(b.variableReplacement?.folder?.uri,_P.toSerialized(S));return _P.fromSerialized(y)},start:(b,S,y,w)=>{let k=++this._serverIdCounter,T=new xgi(e.extensionHostKind,()=>f.$stopMcp(k),N=>f.$sendMessage(k,JSON.stringify(N)));return this._servers.set(k,T),this._serverDefinitions.set(k,S),f.$startMcp(k,{launch:y,defaultCwd:S.variableReplacement?.folder?.uri,errorOnUserInteraction:w?.errorOnUserInteraction}),T}}));let v=this._register(new Dt(()=>this._publishServerDefinitions(),500));this._register(he(b=>{let S=this._mcpRegistry.collections.read(b);for(let y of S)y.serverDefinitions.read(b);v.isScheduled()||v.schedule()})),v.schedule()}_publishServerDefinitions(){let e=this._mcpRegistry.collections.get(),t=[];for(let o of e){let n=o.serverDefinitions.get();for(let r of n)t.push(CV.toSerialized(r))}this._proxy.$onDidChangeMcpServerDefinitions(t)}$upsertMcpCollection(e,t){let o=t.map(CV.fromSerialized),n=this._collectionDefinitions.get(e.id);if(n)n.servers.set(o,void 0);else{let r=Le("mcpServers",o),s=new Ei(e.extensionId),l=new P,c=l.add(new me),u=()=>{c.value??=this._mcpRegistry.registerCollection({...e,source:s,resolveServerLanch:e.canResolveLaunch?(async g=>{let f=await this._proxy.$resolveMcpLaunch(e.id,g.label);return f?_P.fromSerialized(f):void 0}):void 0,trustBehavior:e.isTrustedByDefault?nk.Kind.Trusted:nk.Kind.TrustedOnNonce,remoteAuthority:this._extHostContext.remoteAuthority,serverDefinitions:r})},p=DT(this._extensionService.extensions,g=>Ei.equals(s,g.identifier)?g.contributes?.mcpServerDefinitionProviders?.find(f=>p6e(s,f.id)===e.id)?.when:void 0),h=p&&x.deserialize(p);if(!h)u();else{let g=()=>{this._contextKeyService.contextMatchesRules(h)?u():c.clear()};l.add(this._contextKeyService.onDidChangeContext(g)),g()}this._collectionDefinitions.set(e.id,{servers:r,dispose:()=>l.dispose()})}}$deleteMcpCollection(e){this._collectionDefinitions.deleteAndDispose(e)}$onDidChangeState(e,t){let o=this._servers.get(e);o&&(o.state.set(t,void 0),ir.isRunning(t)||(o.dispose(),this._servers.delete(e),this._serverDefinitions.delete(e),this._serverAuthTracking.untrack(e)))}$onDidPublishLog(e,t,o){typeof t=="string"&&(t=3,o=t),this._servers.get(e)?.pushLog(t,o)}$onDidReceiveMessage(e,t){this._servers.get(e)?.pushMessage(t)}async $getTokenForProviderId(e,t,o,n={}){let r=this._serverDefinitions.get(e);if(r)return this._getSessionForProvider(e,r,t,o,void 0,n.errorOnUserInteraction)}async $getTokenFromServerMetadata(e,t,{errorOnUserInteraction:o,forceNewRegistration:n}={}){let r=this._serverDefinitions.get(e);if(!r)return;let s=A.revive(t.authorizationServer),l=t.resourceMetadata?.resource?A.parse(t.resourceMetadata.resource):void 0,c=t.scopes??t.resourceMetadata?.scopes_supported??t.authorizationServerMetadata.scopes_supported??[],u=await this._authenticationService.getOrActivateProviderIdForServer(s,l);if(n&&u){if(!this._authenticationService.isDynamicAuthenticationProvider(u))throw new Error("Cannot force new registration for a non-dynamic authentication provider.");this._authenticationService.unregisterAuthenticationProvider(u),await this._dynamicAuthenticationProviderStorageService.removeDynamicProvider(u),u=void 0}if(!u){let p=await this._authenticationService.createDynamicAuthenticationProvider(s,t.authorizationServerMetadata,t.resourceMetadata);if(!p)return;u=p.id}return this._getSessionForProvider(e,r,u,c,s,o)}async _getSessionForProvider(e,t,o,n,r,s=!1){let l=await this._authenticationService.getSessions(o,n,{authorizationServer:r},!0),c=this.authenticationMcpServersService.getAccountPreference(t.id,o),u;c&&(u=l.find(f=>f.account.label===c));let p=this._authenticationService.getProvider(o),h;if(l.length){if(u&&this.authenticationMCPServerAccessService.isAccessAllowed(o,u.account.label,t.id))return this.authenticationMCPServerUsageService.addAccountUsage(o,u.account.label,n,t.id,t.label),this._serverAuthTracking.track(o,e,n),u.accessToken;if(!p.supportsMultipleAccounts&&this.authenticationMCPServerAccessService.isAccessAllowed(o,l[0].account.label,t.id))return this.authenticationMCPServerUsageService.addAccountUsage(o,l[0].account.label,n,t.id,t.label),this._serverAuthTracking.track(o,e,n),l[0].accessToken}if(s)throw new dw("authentication");if(!await this.loginPrompt(t.label,p.label,!1))throw new Error("User did not consent to login.");if(l.length){if(p.supportsMultipleAccounts&&s)throw new dw("authentication");h=p.supportsMultipleAccounts?await this.authenticationMcpServersService.selectSession(o,t.id,t.label,n,l):l[0]}else{if(s)throw new dw("authentication");let f=u?.account;do h=await this._authenticationService.createSession(o,n,{activateImmediate:!0,account:f,authorizationServer:r});while(f&&f.label!==h.account.label&&!await this.continueWithIncorrectAccountPrompt(h.account.label,f.label))}return this.authenticationMCPServerAccessService.updateAllowedMcpServers(o,h.account.label,[{id:t.id,name:t.label,allowed:!0}]),this.authenticationMcpServersService.updateAccountPreference(t.id,o,h.account),this.authenticationMCPServerUsageService.addAccountUsage(o,h.account.label,n,t.id,t.label),this._serverAuthTracking.track(o,e,n),h.accessToken}async continueWithIncorrectAccountPrompt(e,t){let o=await this.dialogService.prompt({message:d(3044,null),detail:d(3045,null,e,t),type:gt.Warning,cancelButton:!0,buttons:[{label:d(3046,null,e),run:()=>e},{label:d(3047,null,t),run:()=>t}]});if(!o.result)throw new ho;return o.result===e}async _onDidChangeAuthSessions(e,t){let o=this._serverAuthTracking.get(e);if(o)for(let{serverId:n,scopes:r}of o){let s=this._servers.get(n),l=this._serverDefinitions.get(n);if(!(!s||!l||s.state.get().state!==ir.Kind.Running))try{await this._getSessionForProvider(n,l,e,r,void 0,!0)}catch(u){dw.is(u)&&(s.pushLog(4,d(3048,null,t)),s.stop())}}}$logMcpAuthSetup(e){this._telemetryService.publicLog2("mcp/authSetup",e)}async $startMcpGateway(){let e=await this._mcpGatewayService.createGateway(this._extHostContext.extensionHostKind===3);if(!e)return;if(this._store.isDisposed){e.dispose();return}let t=_t();return this._gateways.set(t,e),{address:e.address,gatewayId:t}}$disposeMcpGateway(e){this._gateways.deleteAndDispose(e)}async loginPrompt(e,t,o){let n=o?d(3043,null,e,t):d(3042,null,e,t),r=[{label:d(3041,null),run(){return!0}}],{result:s}=await this.dialogService.prompt({type:gt.Info,message:n,buttons:r,cancelButton:!0});return s??!1}dispose(){for(let e of this._servers.values())e.extHostDispose();this._servers.clear(),this._serverDefinitions.clear(),this._serverAuthTracking.clear(),super.dispose()}};LMt=I([vo(Gi.MainThreadMcp),m(1,md),m(2,ct),m(3,Cs),m(4,i7e),m(5,Qde),m(6,Yde),m(7,YX),m(8,lt),m(9,X),m(10,Te),m(11,WTe)],LMt);var xgi=class extends C{constructor(e,t,o){super();this.stop=t;this.send=o;this.state=Le("mcpServerState",{state:ir.Kind.Starting});this._onDidLog=this._register(new E);this.onDidLog=this._onDidLog.event;this._onDidReceiveMessage=this._register(new E);this.onDidReceiveMessage=this._onDidReceiveMessage.event;this._register(nn(()=>{this.pushLog(3,`Starting server from ${kP(e)} extension host`)}))}pushLog(e,t){this._onDidLog.fire({message:t,level:e})}pushMessage(e){let t;try{t=JSON.parse(e)}catch{this.pushLog(4,`Failed to parse message: ${JSON.stringify(e)}`)}t&&(Array.isArray(t)?t.forEach(o=>this._onDidReceiveMessage.fire(o)):this._onDidReceiveMessage.fire(t))}extHostDispose(){ir.isRunning(this.state.get())&&(this.pushLog(4,"Extension host shut down, server will stop."),this.state.set({state:ir.Kind.Stopped},void 0)),this.dispose()}dispose(){ir.isRunning(this.state.get())&&this.stop(),super.dispose()}},kgi=class{constructor(){this._tracking=new Map}track(i,e,t){let n=(this._tracking.get(i)||[]).filter(r=>r.serverId!==e);n.push({serverId:e,scopes:t}),this._tracking.set(i,n)}untrack(i){for(let[e,t]of this._tracking.entries()){let o=t.filter(n=>n.serverId!==i);o.length===0?this._tracking.delete(e):this._tracking.set(e,o)}}get(i){return this._tracking.get(i)}clear(){this._tracking.clear()}};function iio(a){return yi(a)&&typeof a.asAttachment=="function"}function Xde(a){return(i,e)=>Ce(o=>{let n=i.read(o),r=new $e(e);return o.store.add(Z(()=>r.dispose(!0))),new Au(a(n,r.token))}).map((o,n)=>{let r=o.promiseResult.read(n);return{picks:r?.data||[],busy:r===void 0}})}var uS=ae("IContextPickService"),RMt=class{constructor(){this._picks=[];this.items=this._picks}registerChatContextItem(i){return this._picks.push(i),this._picks.sort((e,t)=>{let o=e.ordinal??0,n=t.ordinal??0;return o===n?Al(e.label,t.label):o<n?1:-1}),Z(()=>{let e=this._picks.indexOf(i);e>=0&&this._picks.splice(e,1)})}};var Q_=ae("chatContextService"),o7e=class extends C{constructor(e,t){super();this._contextPickService=e;this._extensionService=t;this._providers=new Map;this._workspaceContext=new Map;this._registeredPickers=this._register(new jt);this._lastResourceContext=new Map}setExecuteCommandCallback(e){this._executeCommandCallback=e}async executeChatContextItemCommand(e){this._executeCommandCallback&&await this._executeCommandCallback(e)}setChatContextProvider(e,t){let o=this._providers.get(e)??{};o.picker=t,this._providers.set(e,o),this._registerWithPickService(e)}_registerWithPickService(e){let t=this._providers.get(e);if(!t||!t.picker||!t.explicitProvider)return;let o=`${t.picker.title.replace(/\.+$/,"")}...`;this._registeredPickers.set(e,this._contextPickService.registerChatContextItem(this._asPicker(o,t.picker.icon,e)))}registerChatWorkspaceContextProvider(e,t){let o=this._providers.get(e)??{};o.workspaceProvider=t,this._providers.set(e,o)}registerChatExplicitContextProvider(e,t){let o=this._providers.get(e)??{};o.explicitProvider=t,this._providers.set(e,o),this._registerWithPickService(e)}registerChatResourceContextProvider(e,t,o){let n=this._providers.get(e)??{};n.resourceProvider={selector:t,provider:o},this._providers.set(e,n)}unregisterChatContextProvider(e){this._providers.delete(e),this._registeredPickers.deleteAndDispose(e)}updateWorkspaceContextItems(e,t){this._workspaceContext.set(e,t)}getWorkspaceContextItems(){let e=[];for(let t of this._workspaceContext.values())for(let o of t){if(!o.value)continue;let n=o.label??(o.resourceUri?Ye(o.resourceUri):"Unknown");e.push({value:o.value,name:n,modelDescription:o.modelDescription,id:n,kind:"workspace"})}return e}async contextForResource(e,t){return this._contextForResource(e,!1,t)}async _contextForResource(e,t,o){let n=[];for(let p of this._providers.values()){if(!p.resourceProvider)continue;let h=jW(p.resourceProvider.selector,e,o??"",!0,void 0,void 0);n.push({score:h,provider:p.resourceProvider.provider})}if(n.sort((p,h)=>h.score-p.score),n.length===0||n[0].score<=0)return;let r=n[0].provider,s=await r.provideChatContext(e,t,ve.None);if(!s)return;let l=s.resourceUri??e,u={value:void 0,name:s.label??Ye(l),icon:s.icon,uri:e,resourceUri:s.resourceUri,modelDescription:s.modelDescription,tooltip:s.tooltip,commandId:s.command?.id,handle:s.handle};return this._lastResourceContext.clear(),this._lastResourceContext.set(u,{originalItem:s,provider:r}),u}async resolveChatContext(e,t){if(e.value!==void 0)return e;let o=this._lastResourceContext.get(e);if(o){let n=await o.provider.resolveChatContext(o.originalItem,ve.None);if(n)return e.value=n.value,e.modelDescription=n.modelDescription,e.tooltip=n.tooltip,e}else{let n=await this._contextForResource(e.uri,!0,t);return e.value=n?.value,e.modelDescription=n?.modelDescription,e.tooltip=n?.tooltip,e}return e}_asPicker(e,t,o){return{asPicker:()=>{let s=this._providers.get(o);if(!s)throw new Error("No chat context provider registered");return{picks:(async()=>s&&!s.explicitProvider&&(await this._extensionService.activateByEvent(`onChatContextProvider:${o}`),s=this._providers.get(o),!s?.explicitProvider)?[]:await s?.explicitProvider.provideChatContext(ve.None)||[])().then(c=>c.map(u=>({label:u.label??(u.resourceUri?Ye(u.resourceUri):"Unknown"),iconClass:u.icon?q.asClassName(u.icon):void 0,asAttachment:async()=>{let h=u;h.value===void 0&&s?.explicitProvider&&(h=await s.explicitProvider.resolveChatContext(u,ve.None));let g=h.label??(h.resourceUri?Ye(h.resourceUri):"Unknown");return{kind:"generic",id:g,name:g,icon:h.icon,value:h.value}}}))),placeholder:e}},type:"pickerPick",label:e,icon:t}}};o7e=I([m(0,uS),m(1,lt)],o7e);we(Q_,o7e,1);function PMt(a){return{...a,resourceUri:a.resourceUri?A.revive(a.resourceUri):void 0}}function Egi(a){return a.map(PMt)}var MMt=class extends C{constructor(e,t){super();this._chatContextService=t;this._providers=new Map;this._proxy=e.getProxy(Zi.ExtHostChatContext),this._chatContextService.setExecuteCommandCallback(o=>this._proxy.$executeChatContextItemCommand(o))}$registerChatWorkspaceContextProvider(e,t){this._providers.set(e,{id:t}),this._chatContextService.registerChatWorkspaceContextProvider(t,{provideWorkspaceChatContext:async o=>{let n=await this._proxy.$provideWorkspaceChatContext(e,o);return Egi(n)}})}$registerChatExplicitContextProvider(e,t){this._providers.set(e,{id:t}),this._chatContextService.registerChatExplicitContextProvider(t,{provideChatContext:async o=>{let n=await this._proxy.$provideExplicitChatContext(e,o);return Egi(n)},resolveChatContext:async(o,n)=>{let r=await this._proxy.$resolveExplicitChatContext(e,o,n);return PMt(r)}})}$registerChatResourceContextProvider(e,t,o){this._providers.set(e,{id:t,selector:o}),this._chatContextService.registerChatResourceContextProvider(t,o,{provideChatContext:async(n,r,s)=>{let l=await this._proxy.$provideResourceChatContext(e,{resource:n,withValue:r},s);return l?PMt(l):void 0},resolveChatContext:async(n,r)=>{let s=await this._proxy.$resolveResourceChatContext(e,n,r);return PMt(s)}})}$unregisterChatContextProvider(e){let t=this._providers.get(e);t&&(this._chatContextService.unregisterChatContextProvider(t.id),this._providers.delete(e))}$updateWorkspaceContextItems(e,t){let o=this._providers.get(e);o&&this._chatContextService.updateWorkspaceContextItems(o.id,Egi(t))}$executeChatContextItemCommand(e){return this._proxy.$executeChatContextItemCommand(e)}};MMt=I([vo(Gi.MainThreadChatContext),m(1,Q_)],MMt);var em=ae("chatDebugService");var AMt=class extends C{constructor(e,t){super();this._chatDebugService=t;this._providerDisposables=new Map;this._activeSessionResources=new Map;this._proxy=e.getProxy(Zi.ExtHostChatDebug)}$registerChatDebugLogProvider(e){let t=new P;this._providerDisposables.set(e,t),t.add(this._chatDebugService.registerProvider({provideChatDebugLog:async(o,n)=>(this._activeSessionResources.set(e,o),(await this._proxy.$provideChatDebugLog(e,o,n))?.map(s=>this._reviveEvent(s,o))),resolveChatDebugLogEvent:async(o,n)=>this._proxy.$resolveChatDebugLogEvent(e,o,n)}))}$unregisterChatDebugLogProvider(e){this._providerDisposables.get(e)?.dispose(),this._providerDisposables.delete(e),this._activeSessionResources.delete(e)}$acceptChatDebugEvent(e,t){let o=(t.sessionResource?A.revive(t.sessionResource):void 0)??this._activeSessionResources.get(e)??this._chatDebugService.activeSessionResource;if(!o)return;let n=this._reviveEvent(t,o);this._chatDebugService.addProviderEvent(n)}_reviveEvent(e,t){let o={id:e.id,sessionResource:t,created:new Date(e.created),parentEventId:e.parentEventId};switch(e.kind){case"toolCall":return{...o,kind:"toolCall",toolName:e.toolName,toolCallId:e.toolCallId,input:e.input,output:e.output,result:e.result,durationInMillis:e.durationInMillis};case"modelTurn":return{...o,kind:"modelTurn",model:e.model,requestName:e.requestName,inputTokens:e.inputTokens,outputTokens:e.outputTokens,totalTokens:e.totalTokens,durationInMillis:e.durationInMillis};case"generic":return{...o,kind:"generic",name:e.name,details:e.details,level:e.level,category:e.category};case"subagentInvocation":return{...o,kind:"subagentInvocation",agentName:e.agentName,description:e.description,status:e.status,durationInMillis:e.durationInMillis,toolCallCount:e.toolCallCount,modelTurnCount:e.modelTurnCount};case"userMessage":return{...o,kind:"userMessage",message:e.message,sections:e.sections};case"agentResponse":return{...o,kind:"agentResponse",message:e.message,sections:e.sections}}}};AMt=I([vo(Gi.MainThreadChatDebug),m(1,em)],AMt);var n7e=ae("chatStatusItemService"),Tgi=class{constructor(){this._entries=new Map;this._onDidChange=new E;this.onDidChange=this._onDidChange.event}setOrUpdateEntry(i){let e=this._entries.has(i.id);this._entries.set(i.id,i),e&&this._onDidChange.fire({entry:i})}deleteEntry(i){this._entries.delete(i)}getEntries(){return this._entries.values()}};we(n7e,Tgi,1);var NMt=class extends C{constructor(e,t){super();this._chatStatusItemService=t}$setEntry(e,t){this._chatStatusItemService.setOrUpdateEntry({id:e,label:t.title,description:t.description,detail:t.detail})}$disposeEntry(e){this._chatStatusItemService.deleteEntry(e)}};NMt=I([vo(Gi.MainThreadChatStatus),m(1,n7e)],NMt);function FV(a){return a?a instanceof Array?a.length>0:a.files>0||a.insertions>0||a.deletions>0:!1}function JX(a){if(!a)return;if(!(a instanceof Array))return a;let i=0,e=0;for(let t of a)i+=t.insertions,e+=t.deletions;return{files:a.length,insertions:i,deletions:e}}function VTe(a){return a.providerType==="local"}function gR(a){let i=a;return A.isUri(i?.resource)&&typeof i.setArchived=="function"&&typeof i.setRead=="function"}function OMt(a){let i=a;return Array.isArray(i?.sessions)&&typeof i?.getSession=="function"}function hw(a){let i=a;return typeof i.section=="string"&&Array.isArray(i.sessions)}function FMt(a){if(typeof a=="object"&&a!==null){let i=a;return i.$mid===25&&typeof i.session=="object"&&i.session!==null}return!1}var _gi="agentSessionsOutput",NGo=d(5714,null);function OGo(a){switch(a){case 0:return"Failed";case 1:return"Completed";case 2:return"InProgress";case 3:return"NeedsInput";default:return`Unknown(${a})`}}var r7e=class extends C{constructor(e,t,o,n){super();this.getSessionsData=e;this.logService=t;this.outputService=o;this.chatEntitlementService=n;this.isChannelRegistered=!1;this.updateChannelRegistration(),this.registerListeners()}updateChannelRegistration(){let e=this.chatEntitlementService.sentiment.hidden;e&&this.isChannelRegistered?(oe.as(sS.OutputChannels).removeChannel(_gi),this.isChannelRegistered=!1):!e&&!this.isChannelRegistered&&(oe.as(sS.OutputChannels).registerChannel({id:_gi,label:NGo,log:!1}),this.isChannelRegistered=!0)}registerListeners(){this._register(this.logService.onDidChangeLogLevel(e=>{e===1&&this.logAllStatsIfTrace("Log level changed to trace")})),this._register(this.chatEntitlementService.onDidChangeSentiment(()=>{this.updateChannelRegistration()}))}logIfTrace(e){this.logService.getLevel()===1&&this.trace(`[Agent Sessions] ${e}`)}logAllStatsIfTrace(e){this.logService.getLevel()===1&&(this.logAllSessions(e),this.logSessionStates())}logAllSessions(e){let{sessions:t,sessionStates:o}=this.getSessionsData(),n=[];n.push(`=== Agent Sessions (${e}) ===`);let r=0;for(let s of t){r++;let l=o.get(s.resource);if(n.push(`--- Session: ${s.label} ---`),n.push(` Resource: ${s.resource.toString()}`),n.push(` Provider Type: ${s.providerType}`),n.push(` Provider Label: ${s.providerLabel}`),n.push(` Status: ${OGo(s.status)}`),n.push(` Icon: ${s.icon.id}`),s.description&&n.push(` Description: ${typeof s.description=="string"?s.description:s.description.value}`),s.badge&&n.push(` Badge: ${typeof s.badge=="string"?s.badge:s.badge.value}`),s.tooltip&&n.push(` Tooltip: ${typeof s.tooltip=="string"?s.tooltip:s.tooltip.value}`),n.push(" Timing:"),n.push(` Created: ${s.timing.created?new Date(s.timing.created).toISOString():"N/A"}`),n.push(` Last Request Started: ${s.timing.lastRequestStarted?new Date(s.timing.lastRequestStarted).toISOString():"N/A"}`),n.push(` Last Request Ended: ${s.timing.lastRequestEnded?new Date(s.timing.lastRequestEnded).toISOString():"N/A"}`),s.changes){let c=JX(s.changes);c&&n.push(` Changes: ${c.files} files, +${c.insertions} -${c.deletions}`)}n.push(" State:"),n.push(` Archived (provider): ${s.archived??"N/A"}`),n.push(` Archived (computed): ${s.isArchived()}`),n.push(` Archived (stored): ${l?.archived??"N/A"}`),n.push(` Read: ${s.isRead()}`),n.push(` Read date (stored): ${l?.read?new Date(l.read).toISOString():"N/A"}`),n.push("")}n.unshift(`Total sessions: ${r}`,""),n.push("=== End Agent Sessions ==="),this.trace(n.join(`
`))}logSessionStates(){let{sessionStates:e}=this.getSessionsData(),t=[];t.push("=== Session States ==="),t.push(`Total stored states: ${e.size}`),t.push("");for(let[o,n]of e)t.push(`URI: ${o.toString()}`),t.push(` Archived: ${n.archived}`),t.push(` Read: ${n.read?new Date(n.read).toISOString():"0 (unread)"}`),t.push("");t.push("=== End Session States ==="),this.trace(t.join(`
`))}trace(e){let t=this.outputService.getChannel(_gi);t&&t.append(`${e}
`)}};r7e=I([m(1,ne),m(2,Ml),m(3,vr)],r7e);var cF=class extends C{constructor(e,t,o,n,r,s,l,c){super();this.chatSessionsService=e;this.lifecycleService=t;this.instantiationService=o;this.storageService=n;this.productService=r;this.chatWidgetService=s;this.workspaceContextService=l;this.workspaceTrustManagementService=c;this._onWillResolve=this._register(new E);this.onWillResolve=this._onWillResolve.event;this._onDidResolve=this._register(new E);this.onDidResolve=this._onDidResolve.event;this._onDidChangeSessions=this._register(new E);this.onDidChangeSessions=this._onDidChangeSessions.event;this._onDidChangeSessionArchivedState=this._register(new E);this.onDidChangeSessionArchivedState=this._onDidChangeSessionArchivedState.event;this._resolved=!1;this.resolver=this._register(new ya(300));this.providersToResolve=new Set;this._sessions=new vt,this.cache=this.instantiationService.createInstance(tK);for(let u of this.cache.loadCachedSessions()){let p=this.toAgentSession(u);this._sessions.set(p.resource,p)}this.sessionStates=this.cache.loadSessionStates(),this.logger=this._register(this.instantiationService.createInstance(r7e,()=>({sessions:this._sessions.values(),sessionStates:this.sessionStates}))),this.logger.logAllStatsIfTrace("Loaded cached sessions"),this.readDateBaseline=this.resolveReadDateBaseline(),this.registerListeners()}get resolved(){return this._resolved}get sessions(){return Array.from(this._sessions.values())}registerListeners(){this._register(this.chatSessionsService.onDidChangeItemsProviders(({chatSessionType:e})=>this.resolve(e))),this._register(this.chatSessionsService.onDidChangeAvailability(()=>this.resolve(void 0))),this._register(this.chatSessionsService.onDidChangeSessionItems(({chatSessionType:e})=>this.updateItems([e],ve.None))),this._register(this.workspaceContextService.onDidChangeWorkspaceFolders(()=>this.resolve(void 0))),this._register(this.workspaceTrustManagementService.onDidChangeTrust(()=>this.resolve(void 0))),this._register(this.storageService.onWillSaveState(()=>{this.cache.saveCachedSessions(Array.from(this._sessions.values())),this.cache.saveSessionStates(this.sessionStates)}))}getSession(e){return this._sessions.get(e)}async resolve(e){if(Array.isArray(e))for(let t of e)this.providersToResolve.add(t);else this.providersToResolve.add(e);return this.resolver.trigger(async t=>{if(!(t.isCancellationRequested||this.lifecycleService.willShutdown))try{return this._onWillResolve.fire(),await this.doResolve(t)}finally{this._onDidResolve.fire()}})}async doResolve(e){let t=Array.from(this.providersToResolve);this.providersToResolve.clear();let o=t.includes(void 0)?void 0:si(t);await this.chatSessionsService.refreshChatSessionItems(o,e),await this.updateItems(o,e)}async updateItems(e,t){let o=new Map;for(let l of this.chatSessionsService.getAllChatSessionContributions())o.set(l.type,l);let n=await this.chatSessionsService.getChatSessionItems(e,t),r=new Set,s=new vt;for(let{chatSessionType:l,items:c}of n){if(r.add(l),t.isCancellationRequested)return;for(let u of c){let p,h,g=Rf(l);g!==void 0?(h=XS(g),p=A_(g)):(h=o.get(l)?.name??l,p=u.iconPath??M.terminal);let f=u.changes,v=f&&!(f instanceof Array)?{files:f.files,insertions:f.insertions,deletions:f.deletions}:f;s.set(u.resource,this.toAgentSession({providerType:l,providerLabel:h,resource:u.resource,label:u.label.split(`
`)[0],description:u.description,icon:p,badge:u.badge,tooltip:u.tooltip,status:u.status??1,archived:u.archived,timing:u.timing,changes:v,metadata:u.metadata}))}}for(let[,l]of this._sessions)!r.has(l.providerType)&&(gYi(l.providerType)||o.has(l.providerType))&&s.set(l.resource,l);this._sessions=s,this._resolved=!0,this.logger.logAllStatsIfTrace("Sessions resolved from providers"),this._onDidChangeSessions.fire()}toAgentSession(e){return{...e,isArchived:()=>this.isArchived(e),setArchived:t=>this.setArchived(e,t),isRead:()=>this.isRead(e),setRead:t=>this.setRead(e,t)}}static{this.UNREAD_MARKER=-1}isArchived(e){return this.sessionStates.get(e.resource)?.archived??!!e.archived}setArchived(e,t){if(t&&this.setRead(e,!0),t===this.isArchived(e))return;let o=this.sessionStates.get(e.resource)??{};this.sessionStates.set(e.resource,{...o,archived:t});let n=this._sessions.get(e.resource);n&&this._onDidChangeSessionArchivedState.fire(n),this._onDidChangeSessions.fire()}isRead(e){if(this.isArchived(e))return!0;let t=this.sessionStates.get(e.resource)?.read;return t===cF.UNREAD_MARKER?!1:Math.max(t??0,this.readDateBaseline)>=this.sessionTimeForReadStateTracking(e)-2e3?!0:!!this.chatWidgetService.getWidgetBySessionResource(e.resource)}sessionTimeForReadStateTracking(e){return e.timing.lastRequestEnded??e.timing.created}setRead(e,t,o){let n=this.sessionStates.get(e.resource)??{},r;if(t){if(r=Math.max(Date.now(),this.sessionTimeForReadStateTracking(e)),typeof n.read=="number"&&n.read>=r)return}else if(r=cF.UNREAD_MARKER,n.read===cF.UNREAD_MARKER)return;this.sessionStates.set(e.resource,{...n,read:r}),o||this._onDidChangeSessions.fire()}static{this.READ_DATE_BASELINE_KEY="agentSessions.readDateBaseline2"}resolveReadDateBaseline(){let e=this.storageService.getNumber(cF.READ_DATE_BASELINE_KEY,1,0);return e>0||(e=this.productService.quality==="stable"?Date.now()-10080*60*1e3:Date.now(),this.storageService.store(cF.READ_DATE_BASELINE_KEY,e,1,1)),e}};cF=I([m(0,Ls),m(1,ao),m(2,F),m(3,le),m(4,nt),m(5,At),m(6,Pe),m(7,ns)],cF);var tK=class{constructor(i){this.storageService=i}static{this.SESSIONS_STORAGE_KEY="agentSessions.model.cache"}static{this.STATE_STORAGE_KEY="agentSessions.state.cache"}saveCachedSessions(i){let e=i.map(t=>({providerType:t.providerType,providerLabel:t.providerLabel,resource:t.resource.toString(),icon:t.icon.id,label:t.label,description:t.description,badge:t.badge,tooltip:t.tooltip,status:t.status,archived:t.archived,timing:t.timing,changes:t.changes,metadata:t.metadata}));this.storageService.store(tK.SESSIONS_STORAGE_KEY,pU(e),1,1)}loadCachedSessions(){let i=this.storageService.get(tK.SESSIONS_STORAGE_KEY,1);if(!i)return[];try{return JSON.parse(i).map(t=>({providerType:t.providerType,providerLabel:t.providerLabel,resource:typeof t.resource=="string"?A.parse(t.resource):A.revive(t.resource),icon:q.fromId(t.icon),label:t.label,description:t.description,badge:t.badge,tooltip:t.tooltip,status:t.status,archived:t.archived,timing:{created:t.timing.created??t.timing.startTime??0,lastRequestStarted:t.timing.lastRequestStarted??t.timing.startTime,lastRequestEnded:t.timing.lastRequestEnded??t.timing.endTime},changes:Array.isArray(t.changes)?t.changes.map(o=>({modifiedUri:A.revive(o.modifiedUri),originalUri:o.originalUri?A.revive(o.originalUri):void 0,insertions:o.insertions,deletions:o.deletions})):t.changes,metadata:t.metadata}))}catch{return[]}}saveSessionStates(i){let e=Array.from(i.entries()).map(([t,o])=>({resource:t.toString(),archived:o.archived,read:o.read}));this.storageService.store(tK.STATE_STORAGE_KEY,JSON.stringify(e),1,1)}loadSessionStates(){let i=new vt,e=this.storageService.get(tK.STATE_STORAGE_KEY,1);if(!e)return i;try{let t=JSON.parse(e);for(let o of t)i.set(typeof o.resource=="string"?A.parse(o.resource):A.revive(o.resource),{archived:o.archived,read:o.read})}catch{}return i}};tK=I([m(0,le)],tK);var BTe=class extends C{constructor(e){super();this.instantiationService=e}get model(){return this._model||(this._model=this._register(this.instantiationService.createInstance(cF)),this._model.resolve(void 0)),this._model}getSession(e){return this.model.getSession(e)}};BTe=I([m(0,F)],BTe);var ia=ae("agentSessions");function ZX(a,i){if(i!==void 0)return typeof i=="function"?i(a):i}function fR(a){return RTt(a)&&(a={kind:"terminal",commandLine:{original:a.command,toolEdited:void 0,userEdited:void 0},language:a.language}),a}async function HTe(a){if(!a.editingSession)return;await Qj(a.editingSession),await Promise.all(a.editingSession.entries.get().map(t=>t.getDiffInfo?.()));let e=a.editingSession.entries.get().reduce((t,o)=>(t.fileUris.add(o.originalURI),t.added+=o.linesAdded?.get()??0,t.removed+=o.linesRemoved?.get()??0,t),{fileUris:new Mn,added:0,removed:0});if(e.fileUris.size>0&&(e.added>0||e.removed>0))return{fileCount:e.fileUris.size,added:e.added,removed:e.removed}}var dF=ae("chatTodoListService"),s7e=class{constructor(i){this.memento=new Bl("chat-todo-list",i)}getSessionData(i){return this.memento.getMemento(1,1)[this.toKey(i)]||[]}setSessionData(i,e){let t=this.memento.getMemento(1,1);t[this.toKey(i)]=e,this.memento.saveMemento()}getTodoList(i){return this.getSessionData(i)}setTodoList(i,e){this.setSessionData(i,e)}migrateTodoList(i,e){let t=this.getSessionData(i);if(t.length>0){this.setSessionData(e,t);let o=this.memento.getMemento(1,1);delete o[this.toKey(i)],this.memento.saveMemento()}}toKey(i){return P_(i)}};s7e=I([m(0,le)],s7e);var UTe=class extends C{constructor(e){super();this._onDidUpdateTodos=this._register(new E);this.onDidUpdateTodos=this._onDidUpdateTodos.event;this.todoListStorage=new s7e(e)}getTodos(e){return this.todoListStorage.getTodoList(e)}setTodos(e,t){this.todoListStorage.setTodoList(e,t),this._onDidUpdateTodos.fire(e)}migrateTodos(e,t){this.todoListStorage.migrateTodoList(e,t),this._onDidUpdateTodos.fire(t)}};UTe=I([m(0,le)],UTe);var Dgi=class extends C{constructor(e,t,o,n,r){super();this._progressObservable=Le(this,[]);this._isCompleteObservable=Le(this,!1);this._onWillDispose=new E;this.onWillDispose=this._onWillDispose.event;this._pendingProgressChunks=new Map;this._isInitialized=!1;this._interruptionWasCanceled=!1;this._disposalPending=!1;this.sessionResource=e,this.providerHandle=t,this.history=[],this._proxy=o,this._providerHandle=t,this._logService=n,this._dialogService=r}get options(){return this._options}get progressObs(){return this._progressObservable}get isCompleteObs(){return this._isCompleteObservable}initialize(e){return this._initializationPromise||(this._initializationPromise=this._doInitializeContent(e)),this._initializationPromise}async _doInitializeContent(e){try{let t=await pm(this._proxy.$provideChatSessionContent(this._providerHandle,this.sessionResource,e),e);this._options=t.options,this.title=t.title,this.history.length=0,this.history.push(...t.history.map(s=>{if(s.type==="request"){let l=s.variableData?.variables.map(c=>({...c,value:Xn(c.value)}));return{type:"request",prompt:s.prompt,participant:s.participant,command:s.command,variableData:l?{variables:l}:void 0,id:s.id,modelId:s.modelId}}return{type:"response",parts:s.parts.map(l=>Xn(l)),participant:s.participant}})),t.hasActiveResponseCallback&&!this.interruptActiveResponseCallback&&(this.interruptActiveResponseCallback=async()=>{let s=()=>(this._disposalPending&&(this._proxy.$disposeChatSessionContent(this._providerHandle,this.sessionResource),this._disposalPending=!1),this._proxy.$interruptChatSessionActiveResponse(this._providerHandle,this.sessionResource,"ongoing"),!0);return t.supportsInterruption?s():this._dialogService.confirm({message:d(3004,null)}).then(l=>l.confirmed?s():(this._addProgress([{kind:"progressMessage",content:{value:"",isTrusted:!1}}]),this._interruptionWasCanceled=!0,this._disposalPending&&(this._logService.info(`Canceling deferred disposal for session ${this.sessionResource} (user canceled interruption)`),this._disposalPending=!1),!1))}),t.hasRequestHandler&&!this.requestHandler&&(this.requestHandler=async(s,l,c,u)=>{this._progressObservable.set([],void 0),this._isCompleteObservable.set(!1,void 0);let p=0,h=he(g=>{let f=this._progressObservable.read(g),v=this._isCompleteObservable.read(g);if(f.length>p){let b=f.slice(p);l(b),p=f.length}v&&h.dispose()});try{await this._proxy.$invokeChatSessionRequestHandler(this._providerHandle,this.sessionResource,s,c,u),!this._isCompleteObservable.get()&&!this.interruptActiveResponseCallback&&this._markComplete()}catch(g){let f={kind:"progressMessage",content:{value:`Error: ${g instanceof Error?g.message:String(g)}`,isTrusted:!1}};throw this._addProgress([f]),this._markComplete(),g}finally{h.dispose()}}),this._isInitialized=!0;let o=t.hasActiveResponseCallback,n=t.hasRequestHandler,r=o||n;for(let[s,l]of this._pendingProgressChunks)this._logService.debug(`Processing ${l.length} pending progress chunks for session ${this.sessionResource}, requestId ${s}`),this._addProgress(l);this._pendingProgressChunks.clear(),r||this._isCompleteObservable.set(!0,void 0)}catch(t){throw this._logService.error(`Failed to initialize chat session ${this.sessionResource}:`,t),t}}handleProgressChunk(e,t){if(!this._isInitialized){let o=this._pendingProgressChunks.get(e)||[];this._pendingProgressChunks.set(e,[...o,...t]),this._logService.debug(`Queuing ${t.length} progress chunks for session ${this.sessionResource}, requestId ${e} (session not initialized)`);return}this._addProgress(t)}handleProgressComplete(e){this._pendingProgressChunks.delete(e),this._isInitialized&&(this._interruptionWasCanceled?this._interruptionWasCanceled=!1:this._markComplete())}_addProgress(e){let t=this._progressObservable.get();this._progressObservable.set([...t,...e],void 0)}_markComplete(){this._isCompleteObservable.get()||this._isCompleteObservable.set(!0,void 0)}dispose(){this._onWillDispose.fire(),this._onWillDispose.dispose(),this._pendingProgressChunks.clear(),this.interruptActiveResponseCallback&&!this._interruptionWasCanceled?this._disposalPending=!0:this._proxy.$disposeChatSessionContent(this._providerHandle,this.sessionResource),super.dispose()}},Lgi=class extends C{constructor(e,t){super();this._onDidChangeChatSessionItems=this._register(new E);this.onDidChangeChatSessionItems=this._onDidChangeChatSessionItems.event;this._items=new vt;this._proxy=e,this._handle=t}get items(){return Array.from(this._items.values())}refresh(e){return this._proxy.$refreshChatSessionItems(this._handle,e)}async newChatSessionItem(e,t){let o=await pm(this._proxy.$newChatSessionItem(this._handle,e,t),t);if(!o)return;let n={...o,resource:A.revive(o.resource),changes:Xn(o.changes)};return this._items.set(n.resource,n),this._onDidChangeChatSessionItems.fire(),n}acceptChange(e){for(let t of e.addedOrUpdated)this._items.set(t.resource,t);for(let t of e.removed)this._items.delete(t);this._onDidChangeChatSessionItems.fire()}addOrUpdateItem(e){this._items.set(e.resource,e),this._onDidChangeChatSessionItems.fire()}fireOnDidChangeChatSessionItems(){this._onDidChangeChatSessionItems.fire()}},WMt=class extends C{constructor(e,t,o,n,r,s,l,c,u,p){super();this._extHostContext=e;this._agentSessionsService=t;this._chatSessionsService=o;this._chatService=n;this._chatWidgetService=r;this._chatTodoListService=s;this._dialogService=l;this._editorService=c;this.editorGroupService=u;this._logService=p;this._itemControllerRegistrations=this._register(new jt);this._contentProvidersRegistrations=this._register(new jt);this._sessionTypeToHandle=new Map;this._activeSessions=new vt;this._sessionDisposables=new vt;this._proxy=this._extHostContext.getProxy(Zi.ExtHostChatSessions),this._register(this._chatSessionsService.onRequestNotifyExtension(({sessionResource:h,updates:g,waitUntil:f})=>{let v=this._getHandleForSessionType(h.scheme);this._logService.trace(`[MainThreadChatSessions] onRequestNotifyExtension received: scheme '${h.scheme}', handle ${v}, ${g.length} update(s)`),v!==void 0?f(this.notifyOptionsChange(v,h,g)):this._logService.warn(`[MainThreadChatSessions] Cannot notify option change for scheme '${h.scheme}': no provider registered. Registered schemes: [${Array.from(this._sessionTypeToHandle.keys()).join(", ")}]`)})),this._register(this._agentSessionsService.model.onDidChangeSessionArchivedState(h=>{for(let[g,{chatSessionType:f}]of this._itemControllerRegistrations)f===h.providerType&&this._proxy.$onDidChangeChatSessionItemState(g,h.resource,h.isArchived())}))}_getHandleForSessionType(e){return this._sessionTypeToHandle.get(e)}$registerChatSessionItemController(e,t){let o=new P,n=o.add(new Lgi(this._proxy,e));o.add(this._chatSessionsService.registerChatSessionItemController(t,n)),this._itemControllerRegistrations.set(e,{chatSessionType:t,controller:n,dispose:()=>o.dispose()}),o.add(this._chatSessionsService.registerChatModelChangeListeners(this._chatService,t,()=>n.fireOnDidChangeChatSessionItems()))}getController(e){let t=this._itemControllerRegistrations.get(e);if(!t)throw new Error(`No chat session controller registered for handle ${e}`);return t.controller}$onDidChangeChatSessionItems(e){this.getController(e).fireOnDidChangeChatSessionItems()}async _resolveSessionItem(e){let t=A.revive(e.resource),o=this._chatService.getSession(t);if(o&&(e=await this.handleSessionModelOverrides(o,e)),!e.changes||!o){let n=(await this._chatService.getMetadataForSession(t))?.stats,r={files:n?.fileCount||0,insertions:n?.added||0,deletions:n?.removed||0};FV(r)&&(e.changes=r)}return{...e,changes:Xn(e.changes),resource:t,iconPath:e.iconPath,tooltip:e.tooltip?this._reviveTooltip(e.tooltip):void 0,archived:e.archived}}async $updateChatSessionItems(e,t){let o=this.getController(e),n=await Promise.all(t.addedOrUpdated.map(r=>this._resolveSessionItem(r)));o.acceptChange({addedOrUpdated:n,removed:t.removed.map(r=>A.revive(r))})}async $addOrUpdateChatSessionItem(e,t){let o=this.getController(e),n=await this._resolveSessionItem(t);o.addOrUpdateItem(n)}$onDidChangeChatSessionOptions(e,t,o){let n=A.revive(t);this._chatSessionsService.notifySessionOptionsChange(n,o)}async $onDidCommitChatSessionItem(e,t,o){let n=A.revive(t),r=A.revive(o);this._logService.trace(`$onDidCommitChatSessionItem: handle(${e}), original(${n}), modified(${r})`);let s=this._itemControllerRegistrations.get(e)?.chatSessionType;if(!s){this._logService.error(`No chat session type found for provider handle ${e}`);return}let l=this._editorService.editors.find(p=>p.resource?.toString()===n.toString()),c=this._chatService.acquireExistingSession(n),u=this._chatSessionsService.getAllChatSessionContributions().find(p=>p.type===s);try{this._chatTodoListService.migrateTodos(n,r);let p=this.editorGroupService.groups.find(v=>v.editors.some(b=>Xe(b.resource,n)))??this.editorGroupService.activeGroup,h={title:{preferred:l?.getName()||void 0,fallback:d(3003,null,u?.displayName)}},g=await this._chatSessionsService.getOrCreateChatSession(A.revive(r),ve.None);if(l){g.transferredState=l instanceof Va?{editingSession:l.transferOutEditingSession(),inputState:c?.object?.inputModel.toJSON()}:void 0,await this._editorService.replaceEditors([{editor:l,replacement:{resource:r,options:h}}],p);return}c&&(g.transferredState={editingSession:c.object.editingSession,inputState:c.object.inputModel.toJSON()});let f=this._chatWidgetService.getWidgetBySessionResource(n);f&&XI(f.viewContext)?await this._chatWidgetService.openSession(r,void 0,{preserveFocus:!0}):(await this._chatService.acquireOrLoadSession(r,"panel",ve.None))?.dispose()}finally{c?.dispose()}}async handleSessionModelOverrides(e,t){if(e.getRequests().filter(n=>n.response&&!n.response.isComplete).length&&(t.description=this._chatSessionsService.getInProgressSessionDescription(e)),!(t.changes instanceof Array)){let n=await HTe(e);n&&(t.changes={files:n.fileCount,insertions:n.added,deletions:n.removed})}return e.lastRequest?.response?.state===4&&(t.status=3),t}async _provideChatSessionContent(e,t,o){let n=this._activeSessions.get(t);if(!n){n=new Dgi(t,e,this._proxy,this._logService,this._dialogService),this._activeSessions.set(t,n);let r=n.onWillDispose(()=>{this._activeSessions.delete(t),this._sessionDisposables.get(t)?.dispose(),this._sessionDisposables.delete(t)});this._sessionDisposables.set(t,r)}try{if(await n.initialize(o),n.options){for(let[r,s]of this._sessionTypeToHandle)if(s===e){for(let[l,c]of Object.entries(n.options))this._chatSessionsService.setSessionOption(t,l,c);break}}return n}catch(r){throw n.dispose(),this._logService.error(`Error providing chat session content for handle ${e} and resource ${t.toString()}:`,r),r}}$unregisterChatSessionItemController(e){this._itemControllerRegistrations.deleteAndDispose(e)}$registerChatSessionContentProvider(e,t){let o={provideChatSessionContent:(n,r)=>this._provideChatSessionContent(e,n,r)};this._sessionTypeToHandle.set(t,e),this._contentProvidersRegistrations.set(e,this._chatSessionsService.registerChatSessionContentProvider(t,o)),this._refreshProviderOptions(e,t)}$unregisterChatSessionContentProvider(e){this._contentProvidersRegistrations.deleteAndDispose(e);for(let[t,o]of this._sessionTypeToHandle)if(o===e){this._sessionTypeToHandle.delete(t);break}for(let[t,o]of this._activeSessions)o.providerHandle===e&&(o.dispose(),this._activeSessions.delete(t))}async $handleProgressChunk(e,t,o,n){let r=A.revive(t),s=this._activeSessions.get(r);if(!s){this._logService.warn(`No session found for progress chunks: handle ${e}, sessionResource ${r}, requestId ${o}`);return}let l=n.map(c=>{let[u]=Array.isArray(c)?c:[c];return Xn(u)});s.handleProgressChunk(o,l)}$handleProgressComplete(e,t,o){let n=A.revive(t),r=this._activeSessions.get(n);if(!r){this._logService.warn(`No session found for progress completion: handle ${e}, sessionResource ${n}, requestId ${o}`);return}r.handleProgressComplete(o)}$handleAnchorResolve(e,t,o,n,r){}$onDidChangeChatSessionProviderOptions(e){let t;for(let[o,n]of this._sessionTypeToHandle)if(n===e){t=o;break}if(!t){this._logService.warn(`No session type found for chat session content provider handle ${e} when refreshing provider options`);return}this._refreshProviderOptions(e,t)}_refreshProviderOptions(e,t){this._proxy.$provideChatSessionProviderOptions(e,ve.None).then(o=>{if(o?.optionGroups&&o.optionGroups.length){let n=o.optionGroups.map(r=>({...r,onSearch:r.searchable?async(s,l)=>await this._proxy.$invokeOptionGroupSearch(e,r.id,s,l):void 0}));this._chatSessionsService.setOptionGroupsForSessionType(t,e,n)}o?.newSessionOptions&&this._chatSessionsService.setNewSessionOptionsForSessionType(t,o.newSessionOptions)}).catch(o=>this._logService.error("Error fetching chat session options",o))}dispose(){for(let e of this._activeSessions.values())e.dispose();this._activeSessions.clear();for(let e of this._sessionDisposables.values())e.dispose();this._sessionDisposables.clear(),super.dispose()}_reviveTooltip(e){if(e){if(typeof e=="string")return e;if(typeof e=="object"&&"value"in e)return xe.lift(e)}}async notifyOptionsChange(e,t,o){this._logService.trace(`[MainThreadChatSessions] notifyOptionsChange: starting proxy call for handle ${e}, sessionResource ${t}`);try{await this._proxy.$provideHandleOptionsChange(e,t,o,ve.None),this._logService.trace(`[MainThreadChatSessions] notifyOptionsChange: proxy call completed for handle ${e}, sessionResource ${t}`)}catch(n){this._logService.error(`[MainThreadChatSessions] notifyOptionsChange: error for handle ${e}, sessionResource ${t}:`,n)}}};WMt=I([vo(Gi.MainThreadChatSessions),m(1,ia),m(2,Ls),m(3,Si),m(4,At),m(5,dF),m(6,ct),m(7,ee),m(8,Et),m(9,ne)],WMt);var VMt=class extends C{constructor(e,t){super();this._dataChannelService=t;this._proxy=e.getProxy(Zi.ExtHostDataChannels),this._register(this._dataChannelService.onDidSendData(o=>{this._proxy.$onDidReceiveData(o.channelId,o.data)}))}};VMt=I([vo(Gi.MainThreadDataChannels),m(1,O7)],VMt);var eJ=ae("meteredConnectionService"),KTe="network.meteredConnection";function Rgi(){let a=navigator.connection;if(!a)return!1;if(a.saveData||a.metered)return!0;let i=a.effectiveType;return i==="2g"||i==="slow-2g"}var BMt=class extends C{constructor(e,t){super();this._onDidChangeIsConnectionMetered=this._register(new E);this.onDidChangeIsConnectionMetered=this._onDidChangeIsConnectionMetered.event;this._isBrowserConnectionMetered=t,this._meteredConnectionSetting=e.getValue(KTe),this._isConnectionMetered=this._meteredConnectionSetting==="on"||this._meteredConnectionSetting!=="off"&&this._isBrowserConnectionMetered,this._register(e.onDidChangeConfiguration(o=>{if(o.affectsConfiguration(KTe)){let n=e.getValue(KTe);n!==this._meteredConnectionSetting&&(this._meteredConnectionSetting=n,this.onUpdated())}}))}get isConnectionMetered(){return this._isConnectionMetered}get isBrowserConnectionMetered(){return this._isBrowserConnectionMetered}setIsBrowserConnectionMetered(e){e!==this._isBrowserConnectionMetered&&(this._isBrowserConnectionMetered=e,this.onChangeBrowserConnection())}onChangeBrowserConnection(){this.onUpdated()}onUpdated(){let e=this._meteredConnectionSetting==="on"||this._meteredConnectionSetting!=="off"&&this._isBrowserConnectionMetered;e!==this._isConnectionMetered&&(this._isConnectionMetered=e,this.onChangeIsConnectionMetered())}onChangeIsConnectionMetered(){this._onDidChangeIsConnectionMetered.fire(this._isConnectionMetered)}};var HMt=class extends C{constructor(e,t){super();this.meteredConnectionService=t;this._proxy=e.getProxy(Zi.ExtHostMeteredConnection),this._proxy.$initializeIsConnectionMetered(this.meteredConnectionService.isConnectionMetered),this._register(this.meteredConnectionService.onDidChangeIsConnectionMetered(o=>{this._proxy.$onDidChangeIsConnectionMetered(o)}))}};HMt=I([vo(Gi.MainThreadMeteredConnection),m(1,eJ)],HMt);var GTe=class extends C{constructor(e){super();this.logService=e;this._delegateBarrier=new f$(1e4)}get repositories(){return this._delegate?.repositories??[]}setDelegate(e){if(this._delegate)throw this.logService.error("[GitService][setDelegate] GitExtension delegate is already set."),new ni("GitExtension delegate is already set.");return this._delegate=e,this._delegateBarrier.open(),Z(()=>{this._delegate=void 0})}async openRepository(e){if(await this._delegateBarrier.wait(),!this._delegate){this.logService.warn("[GitService][openRepository] GitExtension delegate is not set after 10 seconds. Cannot open repository.");return}return this._delegate.openRepository(e)}};GTe=I([m(0,ne)],GTe);var UMt=class extends C{constructor(e,t,o){super();this.delegate=o;this.rootUri=e,this.state=rg({owner:this,equalsFn:VT},t)}updateState(e){this.state.set(e,void 0)}async getRefs(e,t){return this.delegate.getRefs(this.rootUri,e,t)}};var tJ=ae("gitService");function nio(a){switch(a){case 0:return 0;case 1:return 1;case 2:return 2;default:throw new Error(`Unknown GitRefType: ${a}`)}}function oio(a){return{HEAD:a?.HEAD?{type:nio(a.HEAD.type),name:a.HEAD.name,commit:a.HEAD.commit,remote:a.HEAD.remote,upstream:a.HEAD.upstream,ahead:a.HEAD.ahead,behind:a.HEAD.behind}:void 0}}var zMt=class extends C{constructor(e,t){super();this.gitService=t;this._openRepositorySequencer=new Nm;this._repositoryHandles=new vt;this._repositories=new Map;this._proxy=e.getProxy(Zi.ExtHostGitExtension),this._initializeDelegate()}get repositories(){return this._repositories.values()}async _initializeDelegate(){await this._proxy.$isGitExtensionAvailable()&&!this._store.isDisposed&&this._register(this.gitService.setDelegate(this))}_getRepositoryByUri(e){let t=this._repositoryHandles.get(e);return t!==void 0?this._repositories.get(t):void 0}async openRepository(e){return this._openRepositorySequencer.queue(async()=>{let t=this._getRepositoryByUri(e);if(t)return t;let o=await this._proxy.$openRepository(e);if(!o)return;let n=A.revive(o.rootUri),r=this._getRepositoryByUri(n);if(r)return r;let s=oio(o.state),l=new UMt(n,s,this);return this._repositories.set(o.handle,l),this._repositoryHandles.set(n,o.handle),l})}async getRefs(e,t,o){let n=this._repositoryHandles.get(e);if(n===void 0)return[];let r=await this._proxy.$getRefs(n,t,o);return o?.isCancellationRequested?[]:r.map(s=>({...s,type:nio(s.type)}))}async $onDidChangeRepository(e){let t=this._repositories.get(e);if(!t)return;let o=await this._proxy.$getRepositoryState(e);o&&t.updateState(oio(o))}};zMt=I([vo(Gi.MainThreadGitExtension),m(1,tJ)],zMt);var $Te=class{constructor(i){this.instantiationService=i;this.instantiationService.createInstance(Oxt),this.instantiationService.createInstance(Wxt),this.instantiationService.createInstance(Vxt),this.instantiationService.createInstance(Kxt),this.instantiationService.createInstance(sY),this.instantiationService.createInstance(Fxe),this.instantiationService.createInstance(Wxe)}static{this.ID="workbench.contrib.extensionPoints"}};$Te=I([m(0,F)],$Te);pt($Te.ID,$Te,ut.BlockStartup);var Mgi=class extends C{constructor(e,t){super();this.item=e;this.onClose=t;this._onDidClose=this._register(new E);this.onDidClose=this._onDidClose.event;this._onDidChangeVisibility=this._register(new E);this.onDidChangeVisibility=this._onDidChangeVisibility.event;this.registerListeners()}registerListeners(){this._register(this.item.onDidChangeVisibility(e=>this._onDidChangeVisibility.fire(e))),H.once(this.item.onDidClose)(()=>{this._onDidClose.fire(),this.dispose()})}get progress(){return this.item.progress}updateSeverity(e){this.item.updateSeverity(e)}updateMessage(e){this.item.updateMessage(e)}updateActions(e){this.item.updateActions(e)}close(){this.onClose(this.item),this.dispose()}},KMt=class a extends C{constructor(){super(...arguments);this._onDidChangeNotification=this._register(new E);this.onDidChangeNotification=this._onDidChangeNotification.event;this._onDidChangeStatusMessage=this._register(new E);this.onDidChangeStatusMessage=this._onDidChangeStatusMessage.event;this._onDidChangeFilter=this._register(new E);this.onDidChangeFilter=this._onDidChangeFilter.event;this._notifications=[];this.filter={global:0,sources:new Map}}static{this.NO_OP_NOTIFICATION=new tae}get notifications(){return this._notifications}get statusMessage(){return this._statusMessage}setFilter(e){let t=!1;typeof e.global=="number"&&(t=this.filter.global!==e.global,this.filter.global=e.global);let o=!1;e.sources&&(o=!mre(this.filter.sources,e.sources),this.filter.sources=e.sources),(t||o)&&this._onDidChangeFilter.fire({global:t?e.global:void 0,sources:o?e.sources:void 0})}addNotification(e){let t=this.createViewItem(e);return t?(this.findNotification(t)?.close(),this._notifications.splice(0,0,t),this._onDidChangeNotification.fire({item:t,index:0,kind:0}),new Mgi(t,n=>this.onClose(n))):a.NO_OP_NOTIFICATION}onClose(e){let t=this.findNotification(e);t&&t!==e?t.close():e.close()}findNotification(e){return this._notifications.find(t=>t.equals(e))}createViewItem(e){let t=qTe.create(e,this.filter);if(!t)return;let o=(s,l)=>{let c=this._notifications.indexOf(t);c>=0&&this._onDidChangeNotification.fire({item:t,index:c,kind:s,detail:l})},n=t.onDidChangeExpansion(()=>o(2)),r=t.onDidChangeContent(s=>o(1,s.kind));return H.once(t.onDidClose)(()=>{n.dispose(),r.dispose();let s=this._notifications.indexOf(t);s>=0&&(this._notifications.splice(s,1),this._onDidChangeNotification.fire({item:t,index:s,kind:3}))}),t}showStatusMessage(e,t){let o=Agi.create(e,t);return o?(this._statusMessage=o,this._onDidChangeStatusMessage.fire({kind:0,item:o}),{close:()=>{this._statusMessage===o&&(this._statusMessage=void 0,this._onDidChangeStatusMessage.fire({kind:1,item:o}))}}):{close:()=>{}}}};function GMt(a){return a instanceof qTe}var Pgi=class extends C{constructor(){super();this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._state=Object.create(null)}get state(){return this._state}infinite(){this._state.infinite||(this._state.infinite=!0,this._state.total=void 0,this._state.worked=void 0,this._state.done=void 0,this._onDidChange.fire())}done(){this._state.done||(this._state.done=!0,this._state.infinite=void 0,this._state.total=void 0,this._state.worked=void 0,this._onDidChange.fire())}total(e){this._state.total!==e&&(this._state.total=e,this._state.infinite=void 0,this._state.done=void 0,this._onDidChange.fire())}worked(e){typeof this._state.worked=="number"?this._state.worked+=e:this._state.worked=e,this._state.infinite=void 0,this._state.done=void 0,this._onDidChange.fire()}},qTe=class a extends C{constructor(e,t,o,n,r,s,l,c){super();this.id=e;this._severity=t;this._sticky=o;this._priority=n;this._message=r;this._source=s;this._visible=!1;this._onDidChangeExpansion=this._register(new E);this.onDidChangeExpansion=this._onDidChangeExpansion.event;this._onDidClose=this._register(new E);this.onDidClose=this._onDidClose.event;this._onDidChangeContent=this._register(new E);this.onDidChangeContent=this._onDidChangeContent.event;this._onDidChangeVisibility=this._register(new E);this.onDidChangeVisibility=this._onDidChangeVisibility.event;l&&this.setProgress(l),this.setActions(c)}static{this.MAX_MESSAGE_LENGTH=1e3}static create(e,t){if(!e?.message||so(e.message))return;let o;typeof e.severity=="number"?o=e.severity:o=St.Info;let n=a.parseNotificationMessage(e.message);if(!n)return;let r;e.actions?r=e.actions:A6(e.message)&&(r={primary:e.message.actions});let s=e.priority??0;return(s===0||s===1)&&o!==St.Error&&(t.global===1?s=2:C9(e.source)&&t.sources.get(e.source.id)===1&&(s=2)),new a(e.id,o,e.sticky,s,n,e.source,e.progress,r)}static parseNotificationMessage(e){let t;if(e instanceof Error?t=In(e,!1):typeof e=="string"&&(t=e),!t)return;let o=t;t.length>a.MAX_MESSAGE_LENGTH&&(t=`${t.substr(0,a.MAX_MESSAGE_LENGTH)}...`),t=t.replace(/(\r\n|\n|\r)/gm," ").trim();let n=lS(t);return{raw:o,linkedText:n,original:e}}setProgress(e){e.infinite?this.progress.infinite():e.total&&(this.progress.total(e.total),e.worked&&this.progress.worked(e.worked))}setActions(e={primary:[],secondary:[]}){this._actions={primary:Array.isArray(e.primary)?e.primary:[],secondary:Array.isArray(e.secondary)?e.secondary:[]},this._expanded=e.primary&&e.primary.length>0}get canCollapse(){return!this.hasActions}get expanded(){return!!this._expanded}get severity(){return this._severity}get sticky(){if(this._sticky)return!0;let e=this.hasActions;return!!(e&&this._severity===St.Error||!e&&this._expanded||this._progress&&!this._progress.state.done)}get priority(){return this._priority}get hasActions(){return!this._actions||!this._actions.primary?!1:this._actions.primary.length>0}get hasProgress(){return!!this._progress}get progress(){return this._progress||(this._progress=this._register(new Pgi),this._register(this._progress.onDidChange(()=>this._onDidChangeContent.fire({kind:3})))),this._progress}get message(){return this._message}get source(){return typeof this._source=="string"?this._source:this._source?this._source.label:void 0}get sourceId(){return this._source&&typeof this._source!="string"&&"id"in this._source?this._source.id:void 0}get actions(){return this._actions}get visible(){return this._visible}updateSeverity(e){e!==this._severity&&(this._severity=e,this._onDidChangeContent.fire({kind:0}))}updateMessage(e){let t=a.parseNotificationMessage(e);!t||t.raw===this._message.raw||(this._message=t,this._onDidChangeContent.fire({kind:1}))}updateActions(e){this.setActions(e),this._onDidChangeContent.fire({kind:2})}updateVisibility(e){this._visible!==e&&(this._visible=e,this._onDidChangeVisibility.fire(e))}expand(){this._expanded||!this.canCollapse||(this._expanded=!0,this._onDidChangeExpansion.fire())}collapse(e){!this._expanded||!this.canCollapse||(this._expanded=!1,e||this._onDidChangeExpansion.fire())}toggle(){this._expanded?this.collapse():this.expand()}close(){this._onDidClose.fire(),this.dispose()}equals(e){if(this.hasProgress||e.hasProgress)return!1;if(typeof this.id=="string"||typeof e.id=="string")return this.id===e.id;if(typeof this._source=="object"){if(this._source.label!==e.source||this._source.id!==e.sourceId)return!1}else if(this._source!==e.source)return!1;if(this._message.raw!==e.message.raw)return!1;let t=this._actions?.primary||[],o=e.actions?.primary||[];return $i(t,o,(n,r)=>n.id+n.label===r.id+r.label)}},Jde=class a extends st{constructor(e,t){super(e,t.label,void 0,!0,async()=>{t.run(),this._onDidRun.fire()});this._onDidRun=this._register(new E);this.onDidRun=this._onDidRun.event;this._keepOpen=!!t.keepOpen,this._menu=!t.isSecondary&&t.menu?t.menu.map((o,n)=>new a(`${e}.${n}`,o)):void 0}get menu(){return this._menu}get keepOpen(){return this._keepOpen}},Agi=class{static create(i,e){if(!i||so(i))return;let t;if(i instanceof Error?t=In(i,!1):typeof i=="string"&&(t=i),!!t)return{message:t,options:e}}};function WP(a){let i=a.getValue("workbench.notifications.position");return i==="bottom-left"||i==="top-right"?i:"bottom-right"}var Ngi=(()=>{if(it&&kr)return"${activeEditorShort}${separator}${rootName}${separator}${profileName}";let a="${dirty}${activeEditorShort}${separator}${rootName}${separator}${profileName}${separator}${appName}";return Gt?a+"${separator}${remoteName}":a})(),Ogi=it?" \u2014 ":" - ",VP=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.configurationService=t;this.contextKeyService=o;this.editorService=n;this.environmentService=r;this.contextService=s;this.labelService=l;this.userDataProfileService=c;this.productService=u;this.viewsService=p;this.decorationsService=h;this.accessibilityService=g;this.properties={isPure:!0,isAdmin:!1,prefix:void 0};this.variables=new Map;this.activeEditorListeners=this._register(new P);this.titleUpdater=this._register(new Dt(()=>this.doUpdateTitle(),0));this.onDidChangeEmitter=this._register(new E);this.onDidChange=this.onDidChangeEmitter.event;this.titleIncludesFocusedView=!1;this.titleIncludesEditorState=!1;this.windowId=e.vscodeWindowId,this.checkTitleVariables(),this.registerListeners()}static{this.NLS_USER_IS_ADMIN=ri?d(4236,null):d(4237,null)}static{this.NLS_EXTENSION_HOST=d(4235,null)}static{this.TITLE_DIRTY="\u25CF "}get value(){return this.title??""}get workspaceName(){return this.labelService.getWorkspaceLabel(this.contextService.getWorkspace())}get fileName(){let e=this.editorService.activeEditor;if(!e)return;let t=e.getTitle(0);return`${e?.isDirty()&&!e.isSaving()?VP.TITLE_DIRTY:""}${t}`}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>this.onConfigurationChanged(e))),this._register(this.editorService.onDidActiveEditorChange(()=>this.onActiveEditorChange())),this._register(this.contextService.onDidChangeWorkspaceFolders(()=>this.titleUpdater.schedule())),this._register(this.contextService.onDidChangeWorkbenchState(()=>this.titleUpdater.schedule())),this._register(this.contextService.onDidChangeWorkspaceName(()=>this.titleUpdater.schedule())),this._register(this.labelService.onDidChangeFormatters(()=>this.titleUpdater.schedule())),this._register(this.userDataProfileService.onDidChangeCurrentProfile(()=>this.titleUpdater.schedule())),this._register(this.viewsService.onDidChangeFocusedView(()=>{this.titleIncludesFocusedView&&this.titleUpdater.schedule()})),this._register(this.contextKeyService.onDidChangeContext(e=>{e.affectsSome(this.variables)&&this.titleUpdater.schedule()})),this._register(this.accessibilityService.onDidChangeScreenReaderOptimized(()=>this.titleUpdater.schedule()))}onConfigurationChanged(e){let t=e.affectsConfiguration("window.title");t&&this.checkTitleVariables(),(t||e.affectsConfiguration("window.titleSeparator"))&&this.titleUpdater.schedule()}checkTitleVariables(){let e=this.configurationService.getValue("window.title");typeof e=="string"&&(this.titleIncludesFocusedView=e.includes("${focusedView}"),this.titleIncludesEditorState=e.includes("${activeEditorState}"))}onActiveEditorChange(){this.activeEditorListeners.clear(),this.titleUpdater.schedule();let e=this.editorService.activeEditor;if(e&&(this.activeEditorListeners.add(e.onDidChangeDirty(()=>this.titleUpdater.schedule())),this.activeEditorListeners.add(e.onDidChangeLabel(()=>this.titleUpdater.schedule()))),this.titleIncludesFocusedView){let t=this.editorService.activeTextEditorControl,o=[];pn(t)?o.push(t):Ec(t)&&o.push(t.getOriginalEditor(),t.getModifiedEditor());for(let n of o)this.activeEditorListeners.add(n.onDidBlurEditorText(()=>this.titleUpdater.schedule())),this.activeEditorListeners.add(n.onDidFocusEditorText(()=>this.titleUpdater.schedule()))}this.titleIncludesEditorState&&this.activeEditorListeners.add(this.decorationsService.onDidChangeDecorations(()=>this.titleUpdater.schedule()))}doUpdateTitle(){let e=this.getFullWindowTitle();if(e!==this.title){let t=e;qD(t)||(t=this.productService.nameLong);let o=qv(this.windowId,!0).window;!o.document.title&&it&&t===this.productService.nameLong&&(o.document.title=`${this.productService.nameLong} ${VP.TITLE_DIRTY}`),o.document.title=t,this.title=e,this.onDidChangeEmitter.fire()}}getFullWindowTitle(){let{prefix:e,suffix:t}=this.getTitleDecorations(),o=this.getWindowTitle()||this.productService.nameLong;return e&&(o=`${e} ${o}`),t&&(o=`${o} ${t}`),o.replace(/[^\S ]/g," ")}getTitleDecorations(){let e,t;return this.properties.prefix&&(e=this.properties.prefix),this.environmentService.isExtensionDevelopment&&(e=e?`${VP.NLS_EXTENSION_HOST} - ${e}`:VP.NLS_EXTENSION_HOST),this.properties.isAdmin&&(t=VP.NLS_USER_IS_ADMIN),{prefix:e,suffix:t}}updateProperties(e){let t=typeof e.isAdmin=="boolean"?e.isAdmin:this.properties.isAdmin,o=typeof e.isPure=="boolean"?e.isPure:this.properties.isPure,n=typeof e.prefix=="string"?e.prefix:this.properties.prefix;(t!==this.properties.isAdmin||o!==this.properties.isPure||n!==this.properties.prefix)&&(this.properties.isAdmin=t,this.properties.isPure=o,this.properties.prefix=n,this.titleUpdater.schedule())}registerVariables(e){let t=!1;for(let{name:o,contextKey:n}of e)this.variables.has(n)||(this.variables.set(n,o),t=!0);t&&this.titleUpdater.schedule()}getWindowTitle(){let e=this.editorService.activeEditor,t=this.contextService.getWorkspace(),o;t.configuration?o=t.configuration:t.folders.length&&(o=t.folders[0].uri);let n=no.getOriginalUri(e,{supportSideBySide:1}),r=n?ci(n):void 0;r?.path==="."&&(r=void 0);let s;this.contextService.getWorkbenchState()===2?s=t.folders[0]:n&&(s=this.contextService.getWorkspaceFolder(n)??void 0);let l;if(this.environmentService.remoteAuthority&&!Gt)l=this.labelService.getHostLabel(Y.vscodeRemote,this.environmentService.remoteAuthority);else{let pe=XL(t);pe&&(l=this.labelService.getHostLabel(pe.scheme,pe.authority))}let c=e?e.getTitle(0):"",u=e?e.getTitle(1):c,p=e?e.getTitle(2):u,h=r?Ye(r):"",g=r?this.labelService.getUriLabel(r,{relative:!0}):"",f=r?this.labelService.getUriLabel(r):"",v=this.labelService.getWorkspaceLabel(t),b=this.labelService.getWorkspaceLabel(t,{verbose:0}),S=o?this.labelService.getUriLabel(o):"",y=s?s.name:"",w=s?this.labelService.getUriLabel(s.uri):"",k=e?.isDirty()&&!e.isSaving()?VP.TITLE_DIRTY:"",T=this.productService.nameLong,N=this.userDataProfileService.currentProfile.isDefault?"":this.userDataProfileService.currentProfile.name,O=this.viewsService.getFocusedViewName(),V=n?this.decorationsService.getDecoration(n,!1)?.tooltip:void 0,U=this.editorService.activeTextEditorLanguageId,G={};for(let[pe,de]of this.variables)G[de]=this.contextKeyService.getContextKeyValue(pe)??"";let $=this.configurationService.getValue("window.title");typeof $!="string"&&($=Ngi),!this.titleIncludesEditorState&&this.accessibilityService.isScreenReaderOptimized()&&this.configurationService.getValue("accessibility.windowTitleOptimized")&&($+="${separator}${activeEditorState}");let te=this.configurationService.getValue("window.titleSeparator");return typeof te!="string"&&(te=Ogi),$gt($,{...G,activeEditorShort:c,activeEditorLong:p,activeEditorMedium:u,activeEditorLanguageId:U,activeFolderShort:h,activeFolderMedium:g,activeFolderLong:f,rootName:v,rootPath:S,rootNameShort:b,folderName:y,folderPath:w,dirty:k,appName:T,remoteName:l,profileName:N,focusedView:O,activeEditorState:V,separator:{label:te}})}isCustomTitleFormat(){if(this.accessibilityService.isScreenReaderOptimized()||this.titleIncludesEditorState)return!0;let e=this.configurationService.inspect("window.title"),t=this.configurationService.inspect("window.titleSeparator");if(e$e(e)||e$e(t))return!0;let n=oe.as(ii.Configuration).getConfigurationProperties();return e.defaultValue!==n["window.title"]?.defaultDefaultValue}};VP=I([m(1,B),m(2,X),m(3,ee),m(4,ru),m(5,Pe),m(6,ot),m(7,mn),m(8,nt),m(9,Ft),m(10,Cv),m(11,Bi)],VP);var $Mt=oe.as(ii.Configuration);(function(){pt($ce.ID,$ce,ut.Eventually),pt(i5.ID,i5,ut.AfterRestored),$Mt.registerConfiguration({...Cm,properties:{"workbench.externalBrowser":{type:"string",markdownDescription:d(4300,null),included:kr,restricted:!0},"workbench.editor.titleScrollbarSizing":{type:"string",enum:["default","large"],enumDescriptions:[d(4489,null),d(4490,null)],description:d(4395,null),default:"default"},"workbench.editor.titleScrollbarVisibility":{type:"string",enum:["auto","visible","hidden"],enumDescriptions:[d(4491,null),d(4493,null),d(4492,null)],description:d(4398,null),default:"auto"},"workbench.editor.showTabs":{type:"string",enum:["multiple","single","none"],enumDescriptions:[d(4473,null),d(4475,null),d(4474,null)],description:d(4382,null),default:"multiple"},"workbench.editor.editorActionsLocation":{type:"string",enum:["default","titleBar","hidden"],markdownEnumDescriptions:[d(4439,null,"`#workbench.editor.showTabs#`","`none`"),d(4441,null,"`#window.customTitleBarVisibility#`","`never`"),d(4440,null)],markdownDescription:d(4316,null),default:"default"},"workbench.editor.alwaysShowEditorActions":{type:"boolean",markdownDescription:d(4295,null),default:!1},"workbench.editor.wrapTabs":{type:"boolean",markdownDescription:d(4524,null,"`#workbench.editor.showTabs#`","`multiple`"),default:!1},"workbench.editor.scrollToSwitchTabs":{type:"boolean",markdownDescription:d(4371,null,"`#workbench.editor.showTabs#`","`multiple`"),default:!1},"workbench.editor.highlightModifiedTabs":{type:"boolean",markdownDescription:d(4329,null,"`#workbench.editor.showTabs#`","multiple"),default:!1},"workbench.editor.decorations.badges":{type:"boolean",markdownDescription:d(4311,null),default:!0},"workbench.editor.decorations.colors":{type:"boolean",markdownDescription:d(4312,null),default:!0},[sP.SETTING_ID_ENABLED]:{type:"boolean",markdownDescription:d(4445,null),default:!0},[sP.SETTING_ID_PATTERNS]:{type:"object",markdownDescription:(()=>{let e=d(4450,null);return e+=`
- `+[d(4444,null),d(4448,null),d(4447,null),d(4446,null),d(4449,null)].join(`
- `),e+=`
`+d(4309,null),e})(),additionalProperties:{type:["string","null"],markdownDescription:d(4451,null),minLength:1,pattern:".*[a-zA-Z0-9].*"},default:{}},"workbench.editor.labelFormat":{type:"string",enum:["default","short","medium","long"],enumDescriptions:[d(4452,null),d(4455,null),d(4454,null),d(4453,null)],default:"default",description:d(4394,null)},"workbench.editor.untitled.labelFormat":{type:"string",enum:["content","name"],enumDescriptions:[d(4494,null),d(4495,null)],default:"content",description:d(4399,null)},"workbench.editor.empty.hint":{type:"string",enum:["text","hidden"],default:"text",markdownDescription:d(4442,null)},"workbench.editor.languageDetection":{type:"boolean",default:!0,description:d(4456,null),scope:6},"workbench.editor.historyBasedLanguageDetection":{type:"boolean",default:!0,description:d(4443,null)},"workbench.editor.preferHistoryBasedLanguageDetection":{type:"boolean",default:!1,description:d(4464,null)},"workbench.editor.languageDetectionHints":{type:"object",default:{untitledEditors:!0,notebookEditors:!0},description:d(4470,null),additionalProperties:!1,properties:{untitledEditors:{type:"boolean",description:d(4471,null)},notebookEditors:{type:"boolean",description:d(4472,null)}}},"workbench.editor.tabActionLocation":{type:"string",enum:["left","right"],default:"right",markdownDescription:d(4393,null,"`#workbench.editor.showTabs#`","`multiple`")},"workbench.editor.tabActionCloseVisibility":{type:"boolean",default:!0,description:d(4481,null)},"workbench.editor.tabActionUnpinVisibility":{type:"boolean",default:!0,description:d(4482,null)},"workbench.editor.showTabIndex":{type:"boolean",default:!1,markdownDescription:d(4384,null,"`#workbench.editor.showTabs#`","`multiple`")},"workbench.editor.tabSizing":{type:"string",enum:["fit","shrink","fixed"],default:"fit",enumDescriptions:[d(4484,null),d(4486,null),d(4485,null)],markdownDescription:d(4396,null,"`#workbench.editor.showTabs#`","`multiple`")},"workbench.editor.tabSizingFixedMinWidth":{type:"number",default:50,minimum:38,markdownDescription:d(4488,null,"`#workbench.editor.tabSizing#`","`fixed`")},"workbench.editor.tabSizingFixedMaxWidth":{type:"number",default:160,minimum:38,markdownDescription:d(4487,null,"`#workbench.editor.tabSizing#`","`fixed`")},"window.density.editorTabHeight":{type:"string",enum:["default","compact"],default:"default",markdownDescription:d(4483,null,"`#workbench.editor.showTabs#`","`multiple`")},"workbench.editor.pinnedTabSizing":{type:"string",enum:["normal","compact","shrink"],default:"normal",enumDescriptions:[d(4461,null),d(4460,null),d(4462,null)],markdownDescription:d(4360,null,"`#workbench.editor.showTabs#`","`multiple`")},"workbench.editor.pinnedTabsOnSeparateRow":{type:"boolean",default:!1,markdownDescription:d(4463,null,"`#workbench.editor.showTabs#`","`multiple`")},"workbench.editor.preventPinnedEditorClose":{type:"string",enum:["keyboardAndMouse","keyboard","mouse","never"],default:"keyboardAndMouse",enumDescriptions:[d(4466,null),d(4468,null),d(4469,null),d(4467,null)],description:d(4465,null)},"workbench.editor.splitSizing":{type:"string",enum:["auto","distribute","split"],default:"auto",enumDescriptions:[d(4478,null),d(4479,null),d(4480,null)],description:d(4389,null)},"workbench.editor.splitOnDragAndDrop":{type:"boolean",default:!0,description:d(4388,null)},"workbench.editor.dragToOpenWindow":{type:"boolean",default:!0,markdownDescription:d(4315,null)},"workbench.editor.focusRecentEditorAfterClose":{type:"boolean",description:d(4325,null),default:!0},"workbench.editor.showIcons":{type:"boolean",description:d(4383,null),default:!0},"workbench.editor.enablePreview":{type:"boolean",description:d(4320,null),default:!0},"workbench.editor.enablePreviewFromQuickOpen":{type:"boolean",markdownDescription:d(4322,null,"`#workbench.editor.showTabs#`","`multiple`"),default:!1},"workbench.editor.enablePreviewFromCodeNavigation":{type:"boolean",markdownDescription:d(4321,null,"`#workbench.editor.showTabs#`","`multiple`"),default:!1},"workbench.editor.closeOnFileDelete":{type:"boolean",description:d(4304,null),default:!1},"workbench.editor.openPositioning":{type:"string",enum:["left","right","first","last"],default:"right",markdownDescription:d(4317,null,"`left`","`right`","`first`","`last`")},"workbench.editor.openSideBySideDirection":{type:"string",enum:["right","down"],default:"right",markdownDescription:d(4386,null)},"workbench.editor.closeEmptyGroups":{type:"boolean",description:d(4303,null),default:!0},"workbench.editor.revealIfOpen":{type:"boolean",description:d(4367,null),default:!1},"workbench.editor.useModal":{type:"string",enum:["off","some","all"],enumDescriptions:[d(4402,null),d(4403,null),d(4401,null)],description:d(4400,null),default:to.quality!=="stable"?"some":"off",tags:["experimental"],experiment:{mode:"auto"}},"workbench.editor.swipeToNavigate":{type:"boolean",description:d(4392,null),default:!1,included:it&&!Gt},"workbench.editor.mouseBackForwardToNavigate":{type:"boolean",description:d(4345,null),default:!0},"workbench.editor.navigationScope":{type:"string",enum:["default","editorGroup","editor"],default:"default",markdownDescription:d(4348,null),enumDescriptions:[d(4457,null),d(4459,null),d(4458,null)]},"workbench.editor.restoreViewState":{type:"boolean",markdownDescription:d(4366,null,"`#workbench.editor.sharedViewState#`"),default:!0,scope:6},"workbench.editor.sharedViewState":{type:"boolean",description:d(4380,null),default:!1},"workbench.editor.restoreEditors":{type:"boolean",description:d(4365,null),default:!0},"workbench.editor.splitInGroupLayout":{type:"string",enum:["vertical","horizontal"],default:"horizontal",markdownDescription:d(4387,null),enumDescriptions:[d(4477,null),d(4476,null)]},"workbench.editor.centeredLayoutAutoResize":{type:"boolean",default:!0,description:d(4301,null)},"workbench.editor.centeredLayoutFixedWidth":{type:"boolean",default:!1,description:d(4302,null)},"workbench.editor.doubleClickTabToToggleEditorGroupSizes":{type:"string",enum:["maximize","expand","off"],default:"expand",markdownDescription:d(4314,null,"`#workbench.editor.showTabs#`","`multiple`"),enumDescriptions:[d(4437,null),d(4436,null),d(4438,null)]},"workbench.editor.limit.enabled":{type:"boolean",default:!1,description:d(4336,null)},"workbench.editor.limit.value":{type:"number",default:10,exclusiveMinimum:0,markdownDescription:d(4338,null,"`#workbench.editor.limit.perEditorGroup#`")},"workbench.editor.limit.excludeDirty":{type:"boolean",default:!1,description:d(4337,null)},"workbench.editor.limit.perEditorGroup":{type:"boolean",default:!1,description:d(4359,null)},"workbench.localHistory.enabled":{type:"boolean",default:!0,description:d(4339,null),scope:5},"workbench.localHistory.maxFileSize":{type:"number",default:256,minimum:1,description:d(4341,null),scope:5},"workbench.localHistory.maxFileEntries":{type:"number",default:50,minimum:0,description:d(4340,null),scope:5},"workbench.localHistory.exclude":{type:"object",patternProperties:{".*":{type:"boolean"}},markdownDescription:d(4323,null),scope:5},"workbench.localHistory.mergeWindow":{type:"number",default:10,minimum:1,markdownDescription:d(4344,null),scope:5},"workbench.commandPalette.history":{type:"number",description:d(4306,null),default:50,minimum:0},"workbench.commandPalette.preserveInput":{type:"boolean",description:d(4361,null),default:!1},"workbench.commandPalette.experimental.suggestCommands":{type:"boolean",tags:["experimental"],description:d(4391,null),default:!1},"workbench.commandPalette.experimental.askChatLocation":{type:"string",tags:["experimental"],description:d(4297,null),default:"chatView",enum:["chatView","quickChat"],enumDescriptions:[d(4298,null),d(4299,null)]},"workbench.commandPalette.showAskInChat":{type:"boolean",tags:["experimental"],description:d(4381,null),default:!0},"workbench.commandPalette.experimental.enableNaturalLanguageSearch":{type:"boolean",tags:["experimental"],description:d(4319,null),default:!0},"workbench.quickOpen.closeOnFocusLost":{type:"boolean",description:d(4305,null),default:!0},"workbench.quickOpen.preserveInput":{type:"boolean",description:d(4509,null),default:!1},"workbench.settings.openDefaultSettings":{type:"boolean",description:d(4352,null),default:!1},"workbench.settings.useSplitJSON":{type:"boolean",markdownDescription:d(4404,null),default:!1},"workbench.settings.openDefaultKeybindings":{type:"boolean",description:d(4351,null),default:!1},"workbench.settings.alwaysShowAdvancedSettings":{type:"boolean",description:d(4294,null),default:to.quality!=="stable"},"workbench.sideBar.location":{type:"string",enum:["left","right"],default:"left",description:d(4385,null)},"workbench.panel.showLabels":{type:"boolean",default:!0,description:d(4358,null)},"workbench.panel.defaultLocation":{type:"string",enum:["left","bottom","top","right"],default:"bottom",description:d(4356,null)},"workbench.panel.opensMaximized":{type:"string",enum:["always","never","preserve"],default:"preserve",description:d(4357,null),enumDescriptions:[d(4505,null),d(4506,null),d(4507,null)]},"workbench.secondarySideBar.defaultVisibility":{type:"string",enum:["hidden","visibleInWorkspace","visible","maximizedInWorkspace","maximized"],default:"visibleInWorkspace",description:d(4372,null),enumDescriptions:[d(4518,null),d(4522,null),d(4521,null),d(4520,null),d(4519,null)]},"workbench.secondarySideBar.forceMaximized":{type:"boolean",default:!1,tags:["experimental"],description:d(4373,null)},"workbench.secondarySideBar.showLabels":{type:"boolean",default:!0,markdownDescription:d(4374,null,"`#workbench.activityBar.location#`","`top`")},"workbench.statusBar.visible":{type:"boolean",default:!0,description:d(4390,null)},"workbench.notifications.position":{type:"string",enum:["bottom-right","bottom-left","top-right"],default:"bottom-right",description:d(4350,null),enumDescriptions:[d(4503,null),d(4502,null),d(4504,null)],tags:["experimental"],experiment:{mode:"auto"}},"workbench.notifications.showInTitleBar":{type:"boolean",default:!0,description:d(4349,null)},"workbench.activityBar.location":{type:"string",enum:["default","top","bottom","hidden"],default:"default",markdownDescription:d(4293,null),enumDescriptions:[d(4433,null),d(4435,null),d(4432,null),d(4434,null)]},"workbench.activityBar.autoHide":{type:"boolean",default:!1,markdownDescription:d(4290,null,"`#workbench.activityBar.location#`","`top`","`bottom`")},"workbench.activityBar.compact":{type:"boolean",default:!1,markdownDescription:d(4291,null,"`#workbench.activityBar.location#`","`default`")},"workbench.activityBar.iconClickBehavior":{type:"string",enum:["toggle","focus"],default:"toggle",markdownDescription:d(4292,null,"`#workbench.activityBar.location#`","`default`"),enumDescriptions:[d(4431,null),d(4430,null)]},"workbench.view.alwaysShowHeaderActions":{type:"boolean",default:!1,description:d(4405,null)},"workbench.view.showQuietly":{type:"object",description:d(4523,null),scope:4,properties:{"workbench.panel.output":{type:"boolean",description:d(4508,null)}},additionalProperties:!1},"workbench.fontAliasing":{type:"string",enum:["default","antialiased","none","auto"],default:"default",description:d(4328,null),enumDescriptions:[d(4498,null),d(4496,null),d(4499,null),d(4497,null)],included:it},"workbench.settings.editor":{type:"string",enum:["ui","json"],enumDescriptions:[d(4378,null),d(4377,null)],description:d(4376,null),default:"ui",scope:4},"workbench.settings.showAISearchToggle":{type:"boolean",default:!0,description:d(4379,null)},"workbench.hover.delay":{type:"number",description:d(4500,null),default:it?1500:500,minimum:0},"workbench.hover.reducedDelay":{type:"number",description:d(4501,null),default:500,minimum:0},"workbench.reduceMotion":{type:"string",description:d(4510,null),enumDescriptions:[d(4513,null),d(4512,null),d(4511,null)],default:"auto",tags:["accessibility"],enum:["on","off","auto"]},"workbench.reduceTransparency":{type:"string",description:d(4514,null),enumDescriptions:[d(4517,null),d(4516,null),d(4515,null)],default:"off",tags:["accessibility"],enum:["on","off","auto"]},"workbench.navigationControl.enabled":{type:"boolean",default:!0,markdownDescription:Gt?d(4347,null):d(4346,null,"`#window.customTitleBarVisibility#`","`never`")},"workbench.layoutControl.enabled":{type:"boolean",default:!0,markdownDescription:Gt?d(4334,null):d(4333,null,"`#window.customTitleBarVisibility#`","`never`")},"workbench.layoutControl.type":{type:"string",enum:["menu","toggles","both"],enumDescriptions:[d(4331,null),d(4332,null),d(4330,null)],default:"both",description:d(4335,null)},"workbench.tips.enabled":{type:"boolean",default:!0,description:d(4397,null)}}});let i=d(4429,null);i+=`
- `+[d(4283,null),d(4282,null),d(4281,null),d(4280,null),d(4287,null),d(4286,null),d(4285,null),d(4326,null),d(4327,null),d(4368,null),d(4369,null),d(4370,null),d(4363,null),d(4296,null),d(4364,null),d(4313,null),d(4324,null),d(4289,null),d(4288,null),d(4284,null,"`accessibility.windowTitleOptimized`"),d(4375,null)].join(`
- `),$Mt.registerConfiguration({...yui,properties:{"window.title":{type:"string",default:Ngi,markdownDescription:i},"window.titleSeparator":{type:"string",default:Ogi,markdownDescription:d(4428,null,"`#window.title#`")},"window.commandCenter":{type:"boolean",default:!0,markdownDescription:Gt?d(4407,null):d(4406,null,"`#window.customTitleBarVisibility#`","`never`")},"window.menuBarVisibility":{type:"string",enum:["classic","visible","toggle","hidden","compact"],markdownEnumDescriptions:[d(4414,null),d(4420,null),it?d(4419,null):d(4418,null),d(4417,null),Gt?d(4416,null):d(4415,null,"`#window.titleBarStyle#`","`native`","`#window.menuStyle#`","`native`","`inherit`")],default:Gt?"compact":"classic",scope:1,markdownDescription:it?d(4343,null):d(4342,null),included:ri||Wn||Gt},"window.enableMenuBarMnemonics":{type:"boolean",default:!0,scope:1,description:d(4318,null),included:ri||Wn},"window.customMenuBarAltFocus":{type:"boolean",default:!0,scope:1,markdownDescription:d(4310,null),included:ri||Wn},"window.openFilesInNewWindow":{type:"string",enum:["on","off","default"],enumDescriptions:[d(4424,null),d(4423,null),it?d(4422,null):d(4421,null)],default:"off",scope:1,markdownDescription:it?d(4354,null):d(4353,null)},"window.openFoldersInNewWindow":{type:"string",enum:["on","off","default"],enumDescriptions:[d(4427,null),d(4426,null),d(4425,null)],default:"default",scope:1,markdownDescription:d(4355,null)},"window.confirmBeforeClose":{type:"string",enum:["always","keyboardOnly","never"],enumDescriptions:[Gt?d(4409,null):d(4408,null),Gt?d(4411,null):d(4410,null),Gt?d(4413,null):d(4412,null)],default:Gt&&!bbe()?"keyboardOnly":"never",markdownDescription:Gt?d(4308,null):d(4307,null),scope:1}}}),pt(qce.ID,qce,ut.Eventually),$Mt.registerConfiguration({...V_t,properties:{"problems.visibility":{type:"boolean",default:!0,description:d(4362,null)}}}),$Mt.registerConfiguration({id:"zenMode",order:9,title:d(4536,null),type:"object",properties:{"zenMode.fullScreen":{type:"boolean",default:!0,description:d(4526,null)},"zenMode.centerLayout":{type:"boolean",default:!0,description:d(4525,null)},"zenMode.showTabs":{type:"string",enum:["multiple","single","none"],description:d(4531,null),enumDescriptions:[d(4532,null),d(4534,null),d(4533,null)],default:"multiple"},"zenMode.hideStatusBar":{type:"boolean",default:!0,description:d(4529,null)},"zenMode.hideActivityBar":{type:"boolean",default:!0,description:d(4527,null)},"zenMode.hideLineNumbers":{type:"boolean",default:!0,description:d(4528,null)},"zenMode.restore":{type:"boolean",default:!0,description:d(4530,null)},"zenMode.silentNotifications":{type:"boolean",default:!0,description:d(4535,null)}}})})();oe.as(rp.ConfigurationMigration).registerConfigurationMigrations([{key:"workbench.activityBar.visible",migrateFn:a=>{let i=[];return a!==void 0&&i.push(["workbench.activityBar.visible",{value:void 0}]),a===!1&&i.push(["workbench.activityBar.location",{value:"hidden"}]),i}}]);oe.as(rp.ConfigurationMigration).registerConfigurationMigrations([{key:"workbench.activityBar.location",migrateFn:a=>{let i=[];return a==="side"&&i.push(["workbench.activityBar.location",{value:"default"}]),i}}]);oe.as(rp.ConfigurationMigration).registerConfigurationMigrations([{key:"workbench.editor.doubleClickTabToToggleEditorGroupSizes",migrateFn:a=>{let i=[];return typeof a=="boolean"&&(a=a?"expand":"off",i.push(["workbench.editor.doubleClickTabToToggleEditorGroupSizes",{value:a}])),i}},{key:"workbench.editor.showTabs",migrateFn:a=>{let i=[];return typeof a=="boolean"&&(a=a?"multiple":"single",i.push(["workbench.editor.showTabs",{value:a}])),i}},{key:"workbench.editor.tabCloseButton",migrateFn:a=>{let i=[];return a==="left"||a==="right"?i.push(["workbench.editor.tabActionLocation",{value:a}]):a==="off"&&i.push(["workbench.editor.tabActionCloseVisibility",{value:!1}]),i}},{key:"zenMode.hideTabs",migrateFn:a=>{let i=[["zenMode.hideTabs",{value:void 0}]];return a===!0&&i.push(["zenMode.showTabs",{value:"single"}]),i}}]);oe.as(rp.ConfigurationMigration).registerConfigurationMigrations([{key:"workbench.editor.useModal",migrateFn:a=>{let i=[];return a==="default"?i.push(["workbench.editor.useModal",{value:"some"}]):a==="on"&&i.push(["workbench.editor.useModal",{value:"all"}]),i}}]);function Fgi(a,i){return[pi({id:"undo",label:d(3437,null),run:()=>rh().execCommand("undo")}),pi({id:"redo",label:d(3435,null),run:()=>rh().execCommand("redo")}),new li,pi({id:"editor.action.clipboardCutAction",label:d(3433,null),run:()=>{i.trace("TextInputActionsProvider#cut"),rh().execCommand("cut")}}),pi({id:"editor.action.clipboardCopyAction",label:d(3432,null),run:()=>{i.trace("TextInputActionsProvider#copy"),rh().execCommand("copy")}}),pi({id:"editor.action.clipboardPasteAction",label:d(3434,null),run:async e=>{i.trace("TextInputActionsProvider#paste");let t=await a.readText();if(L6(e)||Wre(e)){let o=e.selectionStart||0,n=e.selectionEnd||0;e.value=`${e.value.substring(0,o)}${t}${e.value.substring(n,e.value.length)}`,e.selectionStart=o+t.length,e.selectionEnd=e.selectionStart,e.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!0}))}}}),new li,pi({id:"editor.action.selectAll",label:d(3436,null),run:()=>rh().execCommand("selectAll")})]}var YTe=class extends C{constructor(e,t,o,n){super();this.layoutService=e;this.contextMenuService=t;this.clipboardService=o;this.logService=n;this.textInputActions=new co(()=>Fgi(this.clipboardService,this.logService));this.registerListeners()}static{this.ID="workbench.contrib.textInputActionsProvider"}registerListeners(){this._register(H.runAndSubscribe(this.layoutService.onDidAddContainer,({container:e,disposables:t})=>{t.add(j(e,"contextmenu",o=>this.onContextMenu(Me(e),o)))},{container:this.layoutService.mainContainer,disposables:this._store}))}onContextMenu(e,t){if(t.defaultPrevented)return;let o=t.target;if(!L6(o)&&!Wre(o))return;$t.stop(t,!0);let n=new yn(e,t);this.contextMenuService.showContextMenu({getAnchor:()=>n,getActions:()=>this.textInputActions.value,getActionsContext:()=>o})}};YTe=I([m(0,fi),m(1,ze),m(2,Wi),m(3,ne)],YTe);pt(YTe.ID,YTe,ut.BlockRestore);var eue="rendererLog",vR={id:eue,name:d(17130,null)},iK="workbench.action.showWindowLog";var XTe=ae("policy"),iJ=class extends C{constructor(){super(...arguments);this.policyDefinitions={};this.policies=new Map;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event}async updatePolicyDefinitions(e){let t=Object.keys(this.policyDefinitions).length;return this.policyDefinitions={...e,...this.policyDefinitions},t!==Object.keys(this.policyDefinitions).length&&await this._updatePolicyDefinitions(this.policyDefinitions),ht.reduce(this.policies.entries(),(o,[n,r])=>({...o,[n]:r}),{})}getPolicyValue(e){return this.policies.get(e)}serialize(){return ht.reduce(Object.entries(this.policyDefinitions),(e,[t,o])=>({...e,[t]:{definition:o,value:this.policies.get(t)}}),{})}},l7e=class{constructor(){this.onDidChange=H.None;this.policyDefinitions={}}async updatePolicyDefinitions(){return{}}getPolicyValue(){}serialize(){}};var Wgi=class extends K{constructor(){super({id:"workbench.action.inspectContextKeys",title:L(3232,"Inspect Context Keys"),category:We.Developer,f1:!0})}run(i){let e=i.get(X),t=new P,o=hr(void 0,void 0,t);Vh("*","cursor: crosshair !important;",o);let n=document.createElement("div"),r=rh();r.body.appendChild(n),t.add(Z(()=>n.remove())),n.style.position="absolute",n.style.pointerEvents="none",n.style.backgroundColor="rgba(255, 0, 0, 0.5)",n.style.zIndex="1000";let s=t.add(new On(r,"mousemove",!0));t.add(s.event(u=>{let p=u.target,h=Yn(p);n.style.top=`${h.top}px`,n.style.left=`${h.left}px`,n.style.width=`${h.width}px`,n.style.height=`${h.height}px`}));let l=t.add(new On(r,"mousedown",!0));H.once(l.event)(u=>{u.preventDefault(),u.stopPropagation()},null,t);let c=t.add(new On(r,"mouseup",!0));H.once(c.event)(u=>{u.preventDefault(),u.stopPropagation();let p=e.getContext(u.target);console.log(p.collectAllValues()),Ue(t)},null,t)}},Vgi=class a extends K{constructor(){super({id:"workbench.action.toggleScreencastMode",title:L(3263,"Toggle Screencast Mode"),category:We.Developer,f1:!0})}run(i){if(a.disposable){a.disposable.dispose(),a.disposable=void 0;return}let e=i.get(nc),t=i.get(B),o=i.get(_e),n=new P,r=e.activeContainer,s=R(r,_(".screencast-mouse"));n.add(Z(()=>s.remove()));let l=R(r,_(".screencast-keyboard"));n.add(Z(()=>l.remove()));let c=n.add(new E),u=n.add(new E),p=n.add(new E);function h(pe,de){let se=new P;se.add(se.add(new On(pe,"mousedown",!0)).event(Se=>c.fire(Se))),se.add(se.add(new On(pe,"mouseup",!0)).event(Se=>u.fire(Se))),se.add(se.add(new On(pe,"mousemove",!0)).event(Se=>p.fire(Se))),de.add(se),n.add(Z(()=>de.delete(se))),n.add(se)}for(let{window:pe,disposables:de}of Gw())h(e.getContainer(pe),de);n.add(Fg(({window:pe,disposables:de})=>h(e.getContainer(pe),de))),n.add(e.onDidChangeActiveContainer(()=>{e.activeContainer.appendChild(s),e.activeContainer.appendChild(l)}));let g=()=>{s.style.borderColor=Oe.fromHex(t.getValue("screencastMode.mouseIndicatorColor")).toString()},f,v=()=>{f=Kn(t.getValue("screencastMode.mouseIndicatorSize")||20,20,100),s.style.height=`${f}px`,s.style.width=`${f}px`};g(),v(),n.add(c.event(pe=>{s.style.top=`${pe.clientY-f/2}px`,s.style.left=`${pe.clientX-f/2}px`,s.style.display="block",s.style.transform="scale(1)",s.style.transition="transform 0.1s";let de=p.event(se=>{s.style.top=`${se.clientY-f/2}px`,s.style.left=`${se.clientX-f/2}px`,s.style.transform=`scale(${.8})`});H.once(u.event)(()=>{s.style.display="none",de.dispose()})}));let b=()=>{l.style.fontSize=`${Kn(t.getValue("screencastMode.fontSize")||56,20,100)}px`},S=()=>{l.style.bottom=`${Kn(t.getValue("screencastMode.verticalOffset")||0,0,90)}%`},y,w=()=>{y=Kn(t.getValue("screencastMode.keyboardOverlayTimeout")||800,500,5e3)};b(),S(),w(),n.add(t.onDidChangeConfiguration(pe=>{pe.affectsConfiguration("screencastMode.verticalOffset")&&S(),pe.affectsConfiguration("screencastMode.fontSize")&&b(),pe.affectsConfiguration("screencastMode.keyboardOverlayTimeout")&&w(),pe.affectsConfiguration("screencastMode.mouseIndicatorColor")&&g(),pe.affectsConfiguration("screencastMode.mouseIndicatorSize")&&v()}));let k=n.add(new E),T=n.add(new E),N=n.add(new E),O=n.add(new E);function V(pe,de){let se=new P;se.add(se.add(new On(pe,"keydown",!0)).event(Se=>k.fire(Se))),se.add(se.add(new On(pe,"compositionstart",!0)).event(Se=>T.fire(Se))),se.add(se.add(new On(pe,"compositionupdate",!0)).event(Se=>N.fire(Se))),se.add(se.add(new On(pe,"compositionend",!0)).event(Se=>O.fire(Se))),de.add(se),n.add(Z(()=>de.delete(se))),n.add(se)}for(let{window:pe,disposables:de}of Gw())V(pe,de);n.add(Fg(({window:pe,disposables:de})=>V(pe,de)));let U=0,G,$=!1,te=n.add(new Dt(()=>{l.textContent="",G=void 0,U=0},y));n.add(T.event(pe=>{$=!0})),n.add(N.event(pe=>{pe.data&&$?(U>20&&(l.innerText="",U=0),G=G??R(l,_("span.key")),G.textContent=pe.data):$&&(l.innerText="",R(l,_("span.key",{},"Backspace"))),te.schedule(y)})),n.add(O.event(pe=>{G=void 0,U++})),n.add(k.event(pe=>{if(pe.key==="Process"||/[\uac00-\ud787\u3131-\u314e\u314f-\u3163\u3041-\u3094\u30a1-\u30f4\u30fc\u3005\u3006\u3024\u4e00-\u9fa5]/u.test(pe.key)){pe.code==="Backspace"||pe.code.includes("Key")?$=!0:(G=void 0,$=!1),te.schedule(y);return}if(pe.isComposing)return;let de=t.getValue("screencastMode.keyboardOptions"),se=new Ii(pe),Se=o.softDispatch(se,se.target);if(Se.kind===2&&Se.commandId&&!(de.showSingleEditorCursorMoves??!0)&&["cursorLeft","cursorRight","cursorUp","cursorDown"].includes(Se.commandId))return;(se.ctrlKey||se.altKey||se.metaKey||se.shiftKey||U>20||se.keyCode===1||se.keyCode===9||se.keyCode===16||se.keyCode===18||se.keyCode===15||se.keyCode===17)&&(l.innerText="",U=0);let ke=o.resolveKeyboardEvent(se),Ee=this._isKbFound(Se)&&Se.commandId?this.getCommandDetails(Se.commandId):void 0,He=Ee?.title,Ve=ke.getLabel();if(Ee&&((de.showCommandGroups??!1)&&Ee.category&&(He=`${Ee.category}: ${He} `),this._isKbFound(Se)&&Se.commandId)){let Fe=o.lookupKeybindings(Se.commandId).filter(Qt=>Qt.getLabel()?.endsWith(Ve??""));Fe.length>0&&(Ve=Fe[Fe.length-1].getLabel())}(de.showCommands??!0)&&He&&R(l,_("span.title",{},`${He} `)),((de.showKeys??!0)||(de.showKeybindings??!0)&&this._isKbFound(Se))&&(Ve=Ve?.replace("UpArrow","\u2191")?.replace("DownArrow","\u2193")?.replace("LeftArrow","\u2190")?.replace("RightArrow","\u2192"),R(l,_("span.key",{},Ve??""))),U++,te.schedule(y)})),a.disposable=n}_isKbFound(i){return i.kind===2}getCommandDetails(i){let e=fe.getCommand(i);if(e)return{title:typeof e.title=="string"?e.title:e.title.value,category:e.category?typeof e.category=="string"?e.category:e.category.value:void 0};let t=qe.getCommand(i);if(t?.metadata?.description)return{title:typeof t.metadata.description=="string"?t.metadata.description:t.metadata.description.value}}},Bgi=class extends K{constructor(){super({id:"workbench.action.logStorage",title:L(3234,"Log Storage Database Contents"),category:We.Developer,f1:!0})}run(i){let e=i.get(le),t=i.get(ct);e.log(),t.info(d(3262,null),d(3261,null))}},Hgi=class extends K{constructor(){super({id:"workbench.action.logWorkingCopies",title:L(3235,"Log Working Copies"),category:We.Developer,f1:!0})}async run(i){let e=i.get(Wa),t=i.get(Gm),o=i.get(ne),n=i.get(Ml),r=await t.getBackups(),s=["","[Working Copies]",...e.workingCopies.length>0?e.workingCopies.map(l=>`${l.isDirty()?"\u25CF ":""}${l.resource.toString(!0)} (typeId: ${l.typeId||"<no typeId>"})`):["<none>"],"","[Backups]",...r.length>0?r.map(l=>`${l.resource.toString(!0)} (typeId: ${l.typeId||"<no typeId>"})`):["<none>"]];o.info(s.join(`
`)),n.showChannel(eue,!0)}},Ugi=class a extends K{static{this.SIZE_THRESHOLD=1024*16}constructor(){super({id:"workbench.action.removeLargeStorageDatabaseEntries",title:L(3239,"Remove Large Storage Database Entries..."),category:We.Developer,f1:!0})}async run(i){let e=i.get(le),t=i.get(Ge),o=i.get(mn),n=i.get(ct),r=i.get(Co),s=[];for(let p of[-1,0,1])if(!(p===0&&o.currentProfile.isDefault))for(let h of[1,0])for(let g of e.keys(p,h)){let f=e.get(g,p);f&&(!r.isBuilt||f.length>a.SIZE_THRESHOLD)&&s.push({key:g,scope:p,target:h,size:f.length,label:g,description:ll.formatSize(f.length),detail:d(3233,null,p===-1?d(3231,null):p===0?d(3238,null):d(3265,null),h===1?d(3236,null):d(3264,null))})}s.sort((p,h)=>h.size-p.size);let l=await new Promise(p=>{let h=new P,g=h.add(t.createQuickPick());g.items=s,g.canSelectMany=!0,g.ok=!1,g.customButton=!0,g.hideCheckAll=!0,g.customLabel=d(3243,null),g.placeholder=d(3245,null),s.length===0&&(g.description=d(3244,null)),g.show(),h.add(g.onDidCustom(()=>{p(g.selectedItems),g.hide()})),h.add(g.onDidHide(()=>h.dispose()))});if(l.length===0)return;let{confirmed:c}=await n.confirm({type:"warning",message:d(3241,null),detail:d(3242,null,l.map(p=>p.label).join(`
`)),primaryButton:d(3240,null)});if(!c)return;let u=new Set;for(let p of l)e.remove(p.key,p.scope),u.add(p.scope);for(let p of u)await e.optimize(p)}},tue,qMt=new Set,iue=new Q("dirtyWorkingCopies","stopped"),zgi=class extends K{constructor(){super({id:"workbench.action.startTrackDisposables",title:L(3259,"Start Tracking Disposables"),category:We.Developer,f1:!0,precondition:x.and(iue.isEqualTo("pending").negate(),iue.isEqualTo("started").negate())})}run(i){iue.bindTo(i.get(X)).set("started"),qMt.clear(),tue=new Gut,obe(tue)}},Kgi=class extends K{constructor(){super({id:"workbench.action.snapshotTrackedDisposables",title:L(3258,"Snapshot Tracked Disposables"),category:We.Developer,f1:!0,precondition:iue.isEqualTo("started")})}run(i){iue.bindTo(i.get(X)).set("pending"),qMt=new Set(tue?.computeLeakingDisposables(1e3)?.leaks.map(t=>t.value))}},Ggi=class extends K{constructor(){super({id:"workbench.action.stopTrackDisposables",title:L(3260,"Stop Tracking Disposables"),category:We.Developer,f1:!0,precondition:iue.isEqualTo("pending")})}run(i){let e=i.get(ee);if(iue.bindTo(i.get(X)).set("stopped"),tue){let o=new Set;for(let r of new Set(tue.computeLeakingDisposables(1e3)?.leaks)??[])qMt.has(r.value)&&o.add(r);let n=tue.computeLeakingDisposables(1e3,Array.from(o));n&&e.openEditor({resource:void 0,contents:n.details})}obe(null),tue=void 0,qMt.clear()}},$gi=class extends K{constructor(){super({id:"workbench.action.showPolicyDiagnostics",title:L(3237,"Policy Diagnostics"),category:We.Developer,f1:!0})}async run(i){let e=i.get(ee),t=i.get(B),o=i.get(nt),n=i.get(Um),r=i.get(Cs),s=i.get(Gx),l=i.get(XTe),c=oe.as(ii.Configuration),u=`# VS Code Policy Diagnostics
`;u+=`*WARNING: This file may contain sensitive information.*
`,u+=`## System Information
`,u+=`| Property | Value |
`,u+=`|----------|-------|
`,u+=`| Generated | ${new Date().toISOString()} |
`,u+=`| Product | ${o.nameLong} ${o.version} |
`,u+=`| Commit | ${o.commit||"n/a"} |
`,u+=`## Account Information
`;try{let f=await n.getDefaultAccount(),v=["sessionId","analytics_tracking_id"];if(f){let b="Unknown",S="Unknown";try{let w=r.getProviderIds();for(let k of w){let N=(await r.getSessions(k)).find(O=>O.id===f.sessionId);if(N){b=N.account.id,S=N.account.label;break}}}catch{}u+=`### Default Account Summary
`,u+=`**Account ID/Username**: ${b}
`,u+=`**Account Label**: ${S}
`,u+=`### Detailed Account Properties
`,u+=`| Property | Value |
`,u+=`|----------|-------|
`;for(let[w,k]of Object.entries(f))if(k!=null){let T;v.includes(w)?T="***":typeof k=="object"?T=JSON.stringify(k):T=String(k),u+=`| ${w} | ${T} |
`}let y=n.policyData;u+=`| policyData | ${y?JSON.stringify(y):"No Policy Data"} |
`,u+=`
`}else u+=`*No default account configured*
`}catch(f){u+=`*Error retrieving account information: ${f}*
`}u+=`## Policy-Controlled Settings
`;let p=c.getPolicyConfigurations(),h=c.getConfigurationProperties(),g=c.getExcludedConfigurationProperties();if(p.size>0){let f=[],v=[];for(let[y,w]of p){let k=h[w]??g[w];if(k){let T=t.inspect(w),N={name:y,key:w,property:k,inspection:T};T.policyValue!==void 0?f.push(N):v.push(N)}}let b=new Map,S=y=>{if(b.has(y))return b.get(y);try{if(l.constructor.name==="MultiplexPolicyService"){let k=l;if(k.policyServices){let T=k.policyServices;for(let N of T)if(N.getPolicyValue&&N.getPolicyValue(y)!==void 0)return b.set(y,N.constructor.name),N.constructor.name}}return""}catch{return"Unknown"}};if(u+=`### Applied Policy
`,f.sort((y,w)=>S(y.name).localeCompare(S(w.name))||y.name.localeCompare(w.name)),f.length>0){u+=`| Setting Key | Policy Name | Policy Source | Default Value | Current Value | Policy Value |
`,u+=`|-------------|-------------|---------------|---------------|---------------|-------------|
`;for(let y of f){let w=JSON.stringify(y.property.default),k=JSON.stringify(y.inspection.value),T=JSON.stringify(y.inspection.policyValue),N=S(y.name);u+=`| ${y.key} | ${y.name} | ${N} | \`${w}\` | \`${k}\` | \`${T}\` |
`}u+=`
`}else u+=`*No settings are currently controlled by policies*
`;if(u+=`### Non-applied Policy
`,v.length>0){u+=`| Setting Key | Policy Name
`,u+=`|-------------|-------------|
`;for(let y of v)u+=`| ${y.key} | ${y.name}|
`;u+=`
`}else u+=`*All policy-controllable settings are currently being enforced*
`}else u+=`*No policy-controlled settings found*
`;u+=`## Authentication Information
`;try{let f=r.getProviderIds();if(f.length>0){u+=`### Authentication Providers
`,u+=`| Provider ID | Sessions | Accounts |
`,u+=`|-------------|----------|----------|
`;for(let v of f)try{let b=await r.getSessions(v),S=b.map(w=>w.account),y=Array.from(new Set(S.map(w=>w.label)));u+=`| ${v} | ${b.length} | ${y.join(", ")||"None"} |
`}catch(b){u+=`| ${v} | Error | ${b} |
`}u+=`
`,u+=`### Detailed Session Information
`;for(let v of f)try{let b=await r.getSessions(v);if(b.length>0){u+=`#### ${v}
`,u+=`| Account | Scopes | Extensions with Access |
`,u+=`|---------|--------|------------------------|
`;for(let S of b){let y=S.account.label,w=S.scopes.join(", ")||"Default";try{let T=s.readAllowedExtensions(v,y).filter(N=>N.allowed!==!1).map(N=>`${N.name}${N.trusted?" (trusted)":""}`).join(", ")||"None";u+=`| ${y} | ${w} | ${T} |
`}catch(k){u+=`| ${y} | ${w} | Error: ${k} |
`}}u+=`
`}}catch(b){u+=`#### ${v}
*Error retrieving sessions: ${b}*
`}}else u+=`*No authentication providers found*
`}catch(f){u+=`*Error retrieving authentication information: ${f}*
`}await e.openEditor({resource:void 0,contents:u,languageId:"markdown",options:{pinned:!0}})}};W(Wgi);W(Vgi);W(Bgi);W(Hgi);W(Ugi);W($gi);to.commit||(W(zgi),W(Kgi),W(Ggi));var WGo=oe.as(ii.Configuration);WGo.registerConfiguration({id:"screencastMode",order:9,title:d(3257,null),type:"object",properties:{"screencastMode.verticalOffset":{type:"number",default:20,minimum:0,maximum:90,description:d(3254,null)},"screencastMode.fontSize":{type:"number",default:56,minimum:20,maximum:100,description:d(3246,null)},"screencastMode.keyboardOptions":{type:"object",description:d(3247,null),properties:{showKeys:{type:"boolean",default:!0,description:d(3251,null)},showKeybindings:{type:"boolean",default:!0,description:d(3250,null)},showCommands:{type:"boolean",default:!0,description:d(3249,null)},showCommandGroups:{type:"boolean",default:!1,description:d(3248,null)},showSingleEditorCursorMoves:{type:"boolean",default:!0,description:d(3252,null)}},default:{showKeys:!0,showKeybindings:!0,showCommands:!0,showCommandGroups:!1,showSingleEditorCursorMoves:!0},additionalProperties:!1},"screencastMode.keyboardOverlayTimeout":{type:"number",default:800,minimum:500,maximum:5e3,description:d(3253,null)},"screencastMode.mouseIndicatorColor":{type:"string",format:"color-hex",default:"#FF0000",description:d(3255,null)},"screencastMode.mouseIndicatorSize":{type:"number",default:20,minimum:20,maximum:100,description:d(3256,null)}}});var jMt=class a extends K{static{this.ID="workbench.action.keybindingsReference"}static{this.AVAILABLE=!!(Wn?to.keyboardShortcutsUrlLinux:it?to.keyboardShortcutsUrlMac:to.keyboardShortcutsUrlWin)}constructor(){super({id:a.ID,title:{...L(3268,"Keyboard Shortcuts Reference"),mnemonicTitle:d(3270,null)},category:We.Help,f1:!0,keybinding:{weight:200,when:null,primary:Ai(2089,2096)},menu:{id:D.MenubarHelpMenu,group:"2_reference",order:1}})}run(i){let e=i.get(nt),t=i.get(Qe),o=Wn?e.keyboardShortcutsUrlLinux:it?e.keyboardShortcutsUrlMac:e.keyboardShortcutsUrlWin;o&&t.open(A.parse(o))}},QMt=class a extends K{static{this.ID="workbench.action.openVideoTutorialsUrl"}static{this.AVAILABLE=!!to.introductoryVideosUrl}constructor(){super({id:a.ID,title:{...L(3283,"Video Tutorials"),mnemonicTitle:d(3275,null)},category:We.Help,f1:!0,menu:{id:D.MenubarHelpMenu,group:"2_reference",order:2}})}run(i){let e=i.get(nt),t=i.get(Qe);e.introductoryVideosUrl&&t.open(A.parse(e.introductoryVideosUrl))}},YMt=class a extends K{static{this.ID="workbench.action.openTipsAndTricksUrl"}static{this.AVAILABLE=!!to.tipsAndTricksUrl}constructor(){super({id:a.ID,title:{...L(3281,"Tips and Tricks"),mnemonicTitle:d(3273,null)},category:We.Help,f1:!0,menu:{id:D.MenubarHelpMenu,group:"2_reference",order:3}})}run(i){let e=i.get(nt),t=i.get(Qe);e.tipsAndTricksUrl&&t.open(A.parse(e.tipsAndTricksUrl))}},XMt=class a extends K{static{this.ID="workbench.action.openDocumentationUrl"}static{this.AVAILABLE=!!(Gt?to.serverDocumentationUrl:to.documentationUrl)}constructor(){super({id:a.ID,title:{...L(3278,"Documentation"),mnemonicTitle:d(3269,null)},category:We.Help,f1:!0,menu:{id:D.MenubarHelpMenu,group:"1_welcome",order:3}})}run(i){let e=i.get(nt),t=i.get(Qe),o=Gt?e.serverDocumentationUrl:e.documentationUrl;o&&t.open(A.parse(o))}},JMt=class a extends K{static{this.ID="workbench.action.openNewsletterSignupUrl"}static{this.AVAILABLE=!!to.newsletterSignupUrl}constructor(){super({id:a.ID,title:L(3277,"Signup for the VS Code Newsletter"),category:We.Help,f1:!0})}run(i){let e=i.get(nt),t=i.get(Qe),o=i.get(Te);t.open(A.parse(`${e.newsletterSignupUrl}?machineId=${encodeURIComponent(o.machineId)}`))}},ZMt=class a extends K{static{this.ID="workbench.action.openYouTubeUrl"}static{this.AVAILABLE=!!to.youTubeUrl}constructor(){super({id:a.ID,title:{...L(3284,"Join Us on YouTube"),mnemonicTitle:d(3276,null)},category:We.Help,f1:!0,menu:{id:D.MenubarHelpMenu,group:"3_feedback",order:1}})}run(i){let e=i.get(nt),t=i.get(Qe);e.youTubeUrl&&t.open(A.parse(e.youTubeUrl))}},ePt=class a extends K{static{this.ID="workbench.action.openRequestFeatureUrl"}static{this.AVAILABLE=!!to.requestFeatureUrl}constructor(){super({id:a.ID,title:{...L(3282,"Search Feature Requests"),mnemonicTitle:d(3274,null)},category:We.Help,f1:!0,menu:{id:D.MenubarHelpMenu,group:"3_feedback",order:2}})}run(i){let e=i.get(nt),t=i.get(Qe);e.requestFeatureUrl&&t.open(A.parse(e.requestFeatureUrl))}},tPt=class a extends K{static{this.ID="workbench.action.openLicenseUrl"}static{this.AVAILABLE=!!(Gt?to.serverLicense:to.licenseUrl)}constructor(){super({id:a.ID,title:{...L(3279,"View License"),mnemonicTitle:d(3271,null)},category:We.Help,f1:!0,menu:{id:D.MenubarHelpMenu,group:"4_legal",order:1}})}run(i){let e=i.get(nt),t=i.get(Qe),o=Gt?e.serverLicenseUrl:e.licenseUrl;if(o)if(Dr){let n=o.indexOf("?")>0?"&":"?";t.open(A.parse(`${o}${n}lang=${Dr}`))}else t.open(A.parse(o))}},iPt=class a extends K{static{this.ID="workbench.action.openPrivacyStatementUrl"}static{this.AVAILABLE=!!to.privacyStatementUrl}constructor(){super({id:a.ID,title:{...L(3280,"Privacy Statement"),mnemonicTitle:d(3272,null)},category:We.Help,f1:!0,menu:{id:D.MenubarHelpMenu,group:"4_legal",order:2}})}run(i){let e=i.get(nt),t=i.get(Qe);e.privacyStatementUrl&&t.open(A.parse(e.privacyStatementUrl))}},qgi=class a extends K{static{this.ID="workbench.action.getStartedWithAccessibilityFeatures"}constructor(){super({id:a.ID,title:L(3267,"Get Started with Accessibility Features"),category:We.Help,f1:!0,menu:{id:D.MenubarHelpMenu,group:"1_welcome",order:6}})}run(i){i.get(ge).executeCommand("workbench.action.openWalkthrough","SetupAccessibility")}},oPt=class a extends K{static{this.ID="workbench.action.askVScode"}constructor(){super({id:a.ID,title:L(3266,"Ask @vscode"),category:We.Help,f1:!0,precondition:x.equals("chatSetupHidden",!1)})}async run(i){i.get(ge).executeCommand("workbench.action.chat.open",{mode:"agent",query:"@vscode ",isPartialQuery:!0})}};fe.appendMenuItem(D.MenubarHelpMenu,{command:{id:oPt.ID,title:L(3266,"Ask @vscode")},order:7,group:"1_welcome",when:x.equals("chatSetupHidden",!1)});jMt.AVAILABLE&&W(jMt);QMt.AVAILABLE&&W(QMt);YMt.AVAILABLE&&W(YMt);XMt.AVAILABLE&&W(XMt);JMt.AVAILABLE&&W(JMt);ZMt.AVAILABLE&&W(ZMt);ePt.AVAILABLE&&W(ePt);tPt.AVAILABLE&&W(tPt);iPt.AVAILABLE&&W(iPt);W(qgi);W(oPt);function jgi(a){let i=a?.getHTMLElement();i&&!sa(i)&&a?.domFocus()}async function VGo(a,i){if(!Zae.getValue(a.contextKeyService))return i(a);let e=a.getFocus(),t=a.getSelection();await i(a);let o=a.getFocus();if(t.length>1||!$i(e,t)||$i(e,o))return;let n=new KeyboardEvent("keydown");a.setSelection(o,n)}async function bR(a,i){if(!a)return;await VGo(a,i);let e=a.getFocus();e.length&&a.reveal(e[0]),a.setAnchor(e[0]),jgi(a)}yt.registerCommandAndKeybindingRule({id:"list.focusDown",weight:200,when:rc,primary:18,mac:{primary:18,secondary:[300]},handler:(a,i)=>{bR(a.get(fo).lastFocusedList,async e=>{let t=new KeyboardEvent("keydown");await e.focusNext(typeof i=="number"?i:1,!1,t)})}});yt.registerCommandAndKeybindingRule({id:"list.focusUp",weight:200,when:rc,primary:16,mac:{primary:16,secondary:[302]},handler:(a,i)=>{bR(a.get(fo).lastFocusedList,async e=>{let t=new KeyboardEvent("keydown");await e.focusPrevious(typeof i=="number"?i:1,!1,t)})}});yt.registerCommandAndKeybindingRule({id:"list.focusAnyDown",weight:200,when:rc,primary:530,mac:{primary:530,secondary:[812]},handler:(a,i)=>{bR(a.get(fo).lastFocusedList,async e=>{let t=new KeyboardEvent("keydown",{altKey:!0});await e.focusNext(typeof i=="number"?i:1,!1,t)})}});yt.registerCommandAndKeybindingRule({id:"list.focusAnyUp",weight:200,when:rc,primary:528,mac:{primary:528,secondary:[814]},handler:(a,i)=>{bR(a.get(fo).lastFocusedList,async e=>{let t=new KeyboardEvent("keydown",{altKey:!0});await e.focusPrevious(typeof i=="number"?i:1,!1,t)})}});yt.registerCommandAndKeybindingRule({id:"list.focusPageDown",weight:200,when:rc,primary:12,handler:a=>{bR(a.get(fo).lastFocusedList,async i=>{let e=new KeyboardEvent("keydown");await i.focusNextPage(e)})}});yt.registerCommandAndKeybindingRule({id:"list.focusPageUp",weight:200,when:rc,primary:11,handler:a=>{bR(a.get(fo).lastFocusedList,async i=>{let e=new KeyboardEvent("keydown");await i.focusPreviousPage(e)})}});yt.registerCommandAndKeybindingRule({id:"list.focusFirst",weight:200,when:rc,primary:14,handler:a=>{bR(a.get(fo).lastFocusedList,async i=>{let e=new KeyboardEvent("keydown");await i.focusFirst(e)})}});yt.registerCommandAndKeybindingRule({id:"list.focusLast",weight:200,when:rc,primary:13,handler:a=>{bR(a.get(fo).lastFocusedList,async i=>{let e=new KeyboardEvent("keydown");await i.focusLast(e)})}});yt.registerCommandAndKeybindingRule({id:"list.focusAnyFirst",weight:200,when:rc,primary:526,handler:a=>{bR(a.get(fo).lastFocusedList,async i=>{let e=new KeyboardEvent("keydown",{altKey:!0});await i.focusFirst(e)})}});yt.registerCommandAndKeybindingRule({id:"list.focusAnyLast",weight:200,when:rc,primary:525,handler:a=>{bR(a.get(fo).lastFocusedList,async i=>{let e=new KeyboardEvent("keydown",{altKey:!0});await i.focusLast(e)})}});function aio(a,i){if(a instanceof hc||a instanceof A1||a instanceof dO){let e=a,t=e.getFocus()?e.getFocus()[0]:void 0,o=e.getSelection();o&&typeof t=="number"&&o.indexOf(t)>=0?e.setSelection(o.filter(n=>n!==i)):typeof t=="number"&&e.setSelection(o.concat(t))}else if(a instanceof Jy||a instanceof SE||a instanceof gv){let e=a,t=e.getFocus()?e.getFocus()[0]:void 0;if(i===t)return;let o=e.getSelection(),n=new KeyboardEvent("keydown",{shiftKey:!0});o&&o.indexOf(t)>=0?e.setSelection(o.filter(r=>r!==i),n):e.setSelection(o.concat(t),n)}}function Qgi(a,i){let e=a.getStickyScrollFocus();if(e.length===0)throw new Error("StickyScroll has no focus");if(e.length>1)throw new Error("StickyScroll can only have a single focused item");a.reveal(e[0]),a.getHTMLElement().focus(),a.setFocus(e),i?.(e[0])}yt.registerCommandAndKeybindingRule({id:"list.expandSelectionDown",weight:200,when:x.and(rc,E7),primary:1042,handler:(a,i)=>{let e=a.get(fo).lastFocusedList;if(!e)return;let t=e.getFocus()?e.getFocus()[0]:void 0,o=new KeyboardEvent("keydown");e.focusNext(typeof i=="number"?i:1,!1,o),aio(e,t);let n=e.getFocus();n.length&&e.reveal(n[0]),jgi(e)}});yt.registerCommandAndKeybindingRule({id:"list.expandSelectionUp",weight:200,when:x.and(rc,E7),primary:1040,handler:(a,i)=>{let e=a.get(fo).lastFocusedList;if(!e)return;let t=e.getFocus()?e.getFocus()[0]:void 0,o=new KeyboardEvent("keydown");e.focusPrevious(typeof i=="number"?i:1,!1,o),aio(e,t);let n=e.getFocus();n.length&&e.reveal(n[0]),jgi(e)}});yt.registerCommandAndKeybindingRule({id:"list.collapse",weight:200,when:x.and(rc,x.or($we,wni)),primary:15,mac:{primary:15,secondary:[2064]},handler:a=>{let i=a.get(fo).lastFocusedList;if(!i||!(i instanceof Jy||i instanceof SE||i instanceof gv))return;let e=i,t=e.getFocus();if(t.length===0)return;let o=t[0];if(!e.collapse(o)){let n=e.getParentElement(o);n&&bR(i,r=>{let s=new KeyboardEvent("keydown");r.setFocus([n],s)})}}});yt.registerCommandAndKeybindingRule({id:"list.stickyScroll.collapse",weight:250,when:Gwe,primary:15,mac:{primary:15,secondary:[2064]},handler:a=>{let i=a.get(fo).lastFocusedList;!i||!(i instanceof Jy||i instanceof SE||i instanceof gv)||Qgi(i,e=>i.collapse(e))}});yt.registerCommandAndKeybindingRule({id:"list.collapseAll",weight:200,when:rc,primary:2063,mac:{primary:2063,secondary:[3088]},handler:a=>{let i=a.get(fo).lastFocusedList;i&&!(i instanceof hc||i instanceof A1||i instanceof dO)&&i.collapseAll()}});yt.registerCommandAndKeybindingRule({id:"list.collapseAllToFocus",weight:200,when:rc,handler:a=>{let i=a.get(fo).lastFocusedList,e=IE("keydown",!0);if(i instanceof Jy||i instanceof SE||i instanceof gv){let t=i,o=t.getFocus();o.length>0&&t.collapse(o[0],!0),t.setSelection(o,e),t.setAnchor(o[0])}}});yt.registerCommandAndKeybindingRule({id:"list.focusParent",weight:200,when:rc,handler:a=>{let i=a.get(fo).lastFocusedList;if(!i||!(i instanceof Jy||i instanceof SE||i instanceof gv))return;let e=i,t=e.getFocus();if(t.length===0)return;let o=t[0],n=e.getParentElement(o);n&&bR(i,r=>{let s=new KeyboardEvent("keydown");r.setFocus([n],s)})}});yt.registerCommandAndKeybindingRule({id:"list.expand",weight:200,when:x.and(rc,x.or(qwe,Cni)),primary:17,handler:a=>{let i=a.get(fo).lastFocusedList;if(i){if(i instanceof Jy||i instanceof SE){let e=i.getFocus();if(e.length===0)return;let t=e[0];if(!i.expand(t)){let o=i.getFirstElementChild(t);o&&i.getNode(o).visible&&bR(i,r=>{let s=new KeyboardEvent("keydown");r.setFocus([o],s)})}}else if(i instanceof gv){let e=i.getFocus();if(e.length===0)return;let t=e[0];i.expand(t).then(o=>{if(t&&!o){let n=i.getFirstElementChild(t);n&&i.getNode(n).visible&&bR(i,s=>{let l=new KeyboardEvent("keydown");s.setFocus([n],l)})}})}}}});function Ygi(a,i){let e=a.get(fo).lastFocusedList,t=IE("keydown",i);if(e instanceof hc||e instanceof A1||e instanceof dO){let o=e;o.setAnchor(o.getFocus()[0]),o.setSelection(o.getFocus(),t)}else if(e instanceof Jy||e instanceof SE||e instanceof gv){let o=e,n=o.getFocus();if(n.length>0){let r=!0;(o.expandOnlyOnTwistieClick===!0||typeof o.expandOnlyOnTwistieClick!="boolean"&&o.expandOnlyOnTwistieClick(n[0]))&&(r=!1),r&&o.toggleCollapsed(n[0])}o.setAnchor(n[0]),o.setSelection(n,t)}}yt.registerCommandAndKeybindingRule({id:"list.select",weight:200,when:rc,primary:3,mac:{primary:3,secondary:[2066]},handler:a=>{Ygi(a,!1)}});yt.registerCommandAndKeybindingRule({id:"list.stickyScrollselect",weight:250,when:Gwe,primary:3,mac:{primary:3,secondary:[2066]},handler:a=>{let i=a.get(fo).lastFocusedList;!i||!(i instanceof Jy||i instanceof SE||i instanceof gv)||Qgi(i,e=>i.setSelection([e]))}});yt.registerCommandAndKeybindingRule({id:"list.selectAndPreserveFocus",weight:200,when:rc,handler:a=>{Ygi(a,!0)}});yt.registerCommandAndKeybindingRule({id:"list.selectAll",weight:200,when:x.and(rc,E7),primary:2079,handler:a=>{let i=a.get(fo).lastFocusedList;if(i instanceof hc||i instanceof A1||i instanceof dO){let e=i,t=new KeyboardEvent("keydown");e.setSelection(ig(e.length),t)}else if(i instanceof Jy||i instanceof SE||i instanceof gv){let e=i,t=e.getFocus(),o=e.getSelection(),n;t.length>0&&(o.length===0||!o.includes(t[0]))&&(n=t[0]),!n&&o.length>0&&(n=o[0]);let r;n?r=e.getParentElement(n):r=void 0;let s=[],l=u=>{for(let p of u.children)p.visible&&(s.push(p.element),p.collapsed||l(p))};l(e.getNode(r)),r&&o.length===s.length&&s.unshift(r);let c=new KeyboardEvent("keydown");e.setSelection(s,c)}}});yt.registerCommandAndKeybindingRule({id:"list.toggleSelection",weight:200,when:rc,primary:3075,handler:a=>{let i=a.get(fo).lastFocusedList;if(!i)return;let e=i.getFocus();if(e.length===0)return;let t=i.getSelection(),o=t.indexOf(e[0]);o>-1?i.setSelection([...t.slice(0,o),...t.slice(o+1)]):i.setSelection([...t,e[0]])}});yt.registerCommandAndKeybindingRule({id:"list.showHover",weight:200,primary:Ai(2089,2087),when:rc,handler:async a=>{let e=a.get(fo).lastFocusedList;if(!e)return;let t=e.getFocus();if(!t||t.length===0)return;let s=e.getHTMLElement().querySelector(".monaco-scrollable-element")?.querySelector(".monaco-list-rows")?.querySelector(".focused");if(!s)return;let l=BGo(s);l&&a.get(tt).showManagedHover(l)}});function BGo(a){if(a.matches('[custom-hover="true"]'))return a;let i=a.querySelector('[custom-hover="true"]:not([tabindex]):not(.action-item)');if(i)return i}yt.registerCommandAndKeybindingRule({id:"list.toggleExpand",weight:200,when:rc,primary:10,handler:a=>{let i=a.get(fo).lastFocusedList;if(i instanceof Jy||i instanceof SE||i instanceof gv){let e=i,t=e.getFocus();if(!e.options.disableExpandOnSpacebar&&t.length>0&&e.isCollapsible(t[0])){e.toggleCollapsed(t[0]);return}}Ygi(a,!0)}});yt.registerCommandAndKeybindingRule({id:"list.stickyScrolltoggleExpand",weight:250,when:Gwe,primary:10,handler:a=>{let i=a.get(fo).lastFocusedList;!i||!(i instanceof Jy||i instanceof SE||i instanceof gv)||Qgi(i)}});yt.registerCommandAndKeybindingRule({id:"list.clear",weight:200,when:x.and(rc,H5e),primary:9,handler:a=>{let i=a.get(fo).lastFocusedList;if(!i)return;let e=i.getSelection(),t=new KeyboardEvent("keydown");if(e.length>1)if(Zae.getValue(i.contextKeyService)){let n=i.getFocus();i.setSelection([n[0]],t)}else i.setSelection([],t);else i.setSelection([],t),i.setFocus([],t);i.setAnchor(void 0)}});qe.registerCommand({id:"list.triggerTypeNavigation",handler:a=>{a.get(fo).lastFocusedList?.triggerTypeNavigation()}});qe.registerCommand({id:"list.toggleFindMode",handler:a=>{let i=a.get(fo).lastFocusedList;if(i instanceof LW||i instanceof gv){let e=i;e.findMode=e.findMode===1?0:1}}});qe.registerCommand({id:"list.toggleFindMatchType",handler:a=>{let i=a.get(fo).lastFocusedList;if(i instanceof LW||i instanceof gv){let e=i;e.findMatchType=e.findMatchType===1?0:1}}});qe.registerCommandAlias("list.toggleKeyboardNavigation","list.triggerTypeNavigation");qe.registerCommandAlias("list.toggleFilterOnType","list.toggleFindMode");yt.registerCommandAndKeybindingRule({id:"list.find",weight:200,when:x.and(B5e,yni),primary:2596,secondary:[61],handler:a=>{let i=a.get(fo).lastFocusedList;i instanceof hc||i instanceof A1||i instanceof dO||(i instanceof LW||i instanceof gv)&&i.openFind()}});yt.registerCommandAndKeybindingRule({id:"list.closeFind",weight:200,when:x.and(B5e,xni),primary:9,handler:a=>{let i=a.get(fo).lastFocusedList;(i instanceof LW||i instanceof gv)&&i.closeFind()}});yt.registerCommandAndKeybindingRule({id:"list.scrollUp",weight:200,when:x.and(rc,Pyt?.negate()),primary:2064,handler:a=>{let i=a.get(fo).lastFocusedList;i&&(i.scrollTop-=10)}});yt.registerCommandAndKeybindingRule({id:"list.scrollDown",weight:200,when:x.and(rc,Ayt?.negate()),primary:2066,handler:a=>{let i=a.get(fo).lastFocusedList;i&&(i.scrollTop+=10)}});yt.registerCommandAndKeybindingRule({id:"list.scrollLeft",weight:200,when:rc,handler:a=>{let i=a.get(fo).lastFocusedList;i&&(i.scrollLeft-=10)}});yt.registerCommandAndKeybindingRule({id:"list.scrollRight",weight:200,when:rc,handler:a=>{let i=a.get(fo).lastFocusedList;i&&(i.scrollLeft+=10)}});W(class extends K{constructor(){super({id:"tree.toggleStickyScroll",title:{...L(3418,"Toggle Tree Sticky Scroll"),mnemonicTitle:d(3417,null)},category:"View",metadata:{description:d(3419,null)},f1:!0})}run(i){let e=i.get(B),t=!e.getValue("workbench.tree.enableStickyScroll");e.updateValue("workbench.tree.enableStickyScroll",t)}});var HGo={separatorBorder:Oe.transparent};function BP(a){return a===0?1:0}var Xgi=class{constructor(i){this.isLayoutEnabled=i}};function UGo(a,i){return i===1?{left:a.start,right:a.end,top:a.orthogonalStart,bottom:a.orthogonalEnd}:{top:a.start,bottom:a.end,left:a.orthogonalStart,right:a.orthogonalEnd}}function zGo(a,i){return i===1?{start:a.left,end:a.right,orthogonalStart:a.top,orthogonalEnd:a.bottom}:{start:a.top,end:a.bottom,orthogonalStart:a.left,orthogonalEnd:a.right}}function WV(a,i){if(Math.abs(a)>i)throw new Error("Invalid index");return Y0(a,i+1)}var yb=class a{constructor(i,e,t,o,n=0,r=0,s=!1,l){this.orientation=i;this.layoutController=e;this.splitviewProportionalLayout=o;this.children=[];this._absoluteOffset=0;this._absoluteOrthogonalOffset=0;this.absoluteOrthogonalSize=0;this._onDidChange=new E;this.onDidChange=this._onDidChange.event;this._onDidVisibilityChange=new E;this.onDidVisibilityChange=this._onDidVisibilityChange.event;this.childrenVisibilityChangeDisposable=new P;this._onDidScroll=new E;this.onDidScrollDisposable=C.None;this.onDidScroll=this._onDidScroll.event;this.childrenChangeDisposable=C.None;this._onDidSashReset=new E;this.onDidSashReset=this._onDidSashReset.event;this.splitviewSashResetDisposable=C.None;this.childrenSashResetDisposable=C.None;this._boundarySashes={};this._edgeSnapping=!1;if(this._styles=t,this._size=n,this._orthogonalSize=r,this.element=_(".monaco-grid-branch-node"),!l)this.splitview=new vu(this.element,{orientation:i,styles:t,proportionalLayout:o}),this.splitview.layout(n,{orthogonalSize:r,absoluteOffset:0,absoluteOrthogonalOffset:0,absoluteSize:n,absoluteOrthogonalSize:r});else{let u={views:l.map(h=>({view:h.node,size:h.node.size,visible:h.visible!==!1})),size:this.orthogonalSize},p={proportionalLayout:o,orientation:i,styles:t};this.children=l.map(h=>h.node),this.splitview=new vu(this.element,{...p,descriptor:u}),this.children.forEach((h,g)=>{let f=g===0,v=g===this.children.length;h.boundarySashes={start:this.boundarySashes.orthogonalStart,end:this.boundarySashes.orthogonalEnd,orthogonalStart:f?this.boundarySashes.start:this.splitview.sashes[g-1],orthogonalEnd:v?this.boundarySashes.end:this.splitview.sashes[g]}})}let c=H.map(this.splitview.onDidSashReset,u=>[u]);this.splitviewSashResetDisposable=c(this._onDidSashReset.fire,this._onDidSashReset),this.updateChildrenEvents()}get size(){return this._size}get orthogonalSize(){return this._orthogonalSize}get absoluteOffset(){return this._absoluteOffset}get absoluteOrthogonalOffset(){return this._absoluteOrthogonalOffset}get styles(){return this._styles}get width(){return this.orientation===1?this.size:this.orthogonalSize}get height(){return this.orientation===1?this.orthogonalSize:this.size}get top(){return this.orientation===1?this._absoluteOffset:this._absoluteOrthogonalOffset}get left(){return this.orientation===1?this._absoluteOrthogonalOffset:this._absoluteOffset}get minimumSize(){return this.children.length===0?0:Math.max(...this.children.map((i,e)=>this.splitview.isViewVisible(e)?i.minimumOrthogonalSize:0))}get maximumSize(){return Math.min(...this.children.map((i,e)=>this.splitview.isViewVisible(e)?i.maximumOrthogonalSize:Number.POSITIVE_INFINITY))}get priority(){if(this.children.length===0)return 0;let i=this.children.map(e=>typeof e.priority>"u"?0:e.priority);return i.some(e=>e===2)?2:i.some(e=>e===1)?1:0}get proportionalLayout(){return this.children.length===0?!0:this.children.every(i=>i.proportionalLayout)}get minimumOrthogonalSize(){return this.splitview.minimumSize}get maximumOrthogonalSize(){return this.splitview.maximumSize}get minimumWidth(){return this.orientation===1?this.minimumOrthogonalSize:this.minimumSize}get minimumHeight(){return this.orientation===1?this.minimumSize:this.minimumOrthogonalSize}get maximumWidth(){return this.orientation===1?this.maximumOrthogonalSize:this.maximumSize}get maximumHeight(){return this.orientation===1?this.maximumSize:this.maximumOrthogonalSize}get boundarySashes(){return this._boundarySashes}set boundarySashes(i){if(!(this._boundarySashes.start===i.start&&this._boundarySashes.end===i.end&&this._boundarySashes.orthogonalStart===i.orthogonalStart&&this._boundarySashes.orthogonalEnd===i.orthogonalEnd)){this._boundarySashes=i,this.splitview.orthogonalStartSash=i.orthogonalStart,this.splitview.orthogonalEndSash=i.orthogonalEnd;for(let e=0;e<this.children.length;e++){let t=this.children[e],o=e===0,n=e===this.children.length-1;t.boundarySashes={start:i.orthogonalStart,end:i.orthogonalEnd,orthogonalStart:o?i.start:t.boundarySashes.orthogonalStart,orthogonalEnd:n?i.end:t.boundarySashes.orthogonalEnd}}}}get edgeSnapping(){return this._edgeSnapping}set edgeSnapping(i){if(this._edgeSnapping!==i){this._edgeSnapping=i;for(let e of this.children)e instanceof a&&(e.edgeSnapping=i);this.updateSplitviewEdgeSnappingEnablement()}}style(i){this._styles=i,this.splitview.style(i);for(let e of this.children)e instanceof a&&e.style(i)}layout(i,e,t){if(this.layoutController.isLayoutEnabled){if(typeof t>"u")throw new Error("Invalid state");this._size=t.orthogonalSize,this._orthogonalSize=i,this._absoluteOffset=t.absoluteOffset+e,this._absoluteOrthogonalOffset=t.absoluteOrthogonalOffset,this.absoluteOrthogonalSize=t.absoluteOrthogonalSize,this.splitview.layout(t.orthogonalSize,{orthogonalSize:i,absoluteOffset:this._absoluteOrthogonalOffset,absoluteOrthogonalOffset:this._absoluteOffset,absoluteSize:t.absoluteOrthogonalSize,absoluteOrthogonalSize:t.absoluteSize}),this.updateSplitviewEdgeSnappingEnablement()}}setVisible(i){for(let e of this.children)e.setVisible(i)}addChild(i,e,t,o){t=WV(t,this.children.length),this.splitview.addView(i,e,t,o),this.children.splice(t,0,i),this.updateBoundarySashes(),this.onDidChildrenChange()}removeChild(i,e){i=WV(i,this.children.length);let t=this.splitview.removeView(i,e);return this.children.splice(i,1),this.updateBoundarySashes(),this.onDidChildrenChange(),t}removeAllChildren(){let i=this.splitview.removeAllViews();return this.children.splice(0,this.children.length),this.updateBoundarySashes(),this.onDidChildrenChange(),i}moveChild(i,e){i=WV(i,this.children.length),e=WV(e,this.children.length),i!==e&&(i<e&&(e-=1),this.splitview.moveView(i,e),this.children.splice(e,0,this.children.splice(i,1)[0]),this.updateBoundarySashes(),this.onDidChildrenChange())}swapChildren(i,e){i=WV(i,this.children.length),e=WV(e,this.children.length),i!==e&&(this.splitview.swapViews(i,e),[this.children[i].boundarySashes,this.children[e].boundarySashes]=[this.children[i].boundarySashes,this.children[e].boundarySashes],[this.children[i],this.children[e]]=[this.children[e],this.children[i]],this.onDidChildrenChange())}resizeChild(i,e){i=WV(i,this.children.length),this.splitview.resizeView(i,e)}isChildExpanded(i){return this.splitview.isViewExpanded(i)}distributeViewSizes(i=!1){if(this.splitview.distributeViewSizes(),i)for(let e of this.children)e instanceof a&&e.distributeViewSizes(!0)}getChildSize(i){return i=WV(i,this.children.length),this.splitview.getViewSize(i)}isChildVisible(i){return i=WV(i,this.children.length),this.splitview.isViewVisible(i)}setChildVisible(i,e){if(i=WV(i,this.children.length),this.splitview.isViewVisible(i)===e)return;let t=this.splitview.contentSize===0;this.splitview.setViewVisible(i,e);let o=this.splitview.contentSize===0;(e&&t||!e&&o)&&this._onDidVisibilityChange.fire(e)}getChildCachedVisibleSize(i){return i=WV(i,this.children.length),this.splitview.getViewCachedVisibleSize(i)}updateBoundarySashes(){for(let i=0;i<this.children.length;i++)this.children[i].boundarySashes={start:this.boundarySashes.orthogonalStart,end:this.boundarySashes.orthogonalEnd,orthogonalStart:i===0?this.boundarySashes.start:this.splitview.sashes[i-1],orthogonalEnd:i===this.children.length-1?this.boundarySashes.end:this.splitview.sashes[i]}}onDidChildrenChange(){this.updateChildrenEvents(),this._onDidChange.fire(void 0)}updateChildrenEvents(){let i=H.map(H.any(...this.children.map(o=>o.onDidChange)),()=>{});this.childrenChangeDisposable.dispose(),this.childrenChangeDisposable=i(this._onDidChange.fire,this._onDidChange);let e=H.any(...this.children.map((o,n)=>H.map(o.onDidSashReset,r=>[n,...r])));this.childrenSashResetDisposable.dispose(),this.childrenSashResetDisposable=e(this._onDidSashReset.fire,this._onDidSashReset);let t=H.any(H.signal(this.splitview.onDidScroll),...this.children.map(o=>o.onDidScroll));this.onDidScrollDisposable.dispose(),this.onDidScrollDisposable=t(this._onDidScroll.fire,this._onDidScroll),this.childrenVisibilityChangeDisposable.clear(),this.children.forEach((o,n)=>{o instanceof a&&this.childrenVisibilityChangeDisposable.add(o.onDidVisibilityChange(r=>{this.setChildVisible(n,r)}))})}trySet2x2(i){if(this.children.length!==2||i.children.length!==2)return C.None;if(this.getChildSize(0)!==i.getChildSize(0))return C.None;let[e,t]=this.children,[o,n]=i.children;if(!(e instanceof wb)||!(t instanceof wb))return C.None;if(!(o instanceof wb)||!(n instanceof wb))return C.None;this.orientation===0?(t.linkedWidthNode=o.linkedHeightNode=e,e.linkedWidthNode=n.linkedHeightNode=t,n.linkedWidthNode=e.linkedHeightNode=o,o.linkedWidthNode=t.linkedHeightNode=n):(o.linkedWidthNode=t.linkedHeightNode=e,n.linkedWidthNode=e.linkedHeightNode=t,e.linkedWidthNode=n.linkedHeightNode=o,t.linkedWidthNode=o.linkedHeightNode=n);let r=this.splitview.sashes[0],s=i.splitview.sashes[0];return r.linkedSash=s,s.linkedSash=r,this._onDidChange.fire(void 0),i._onDidChange.fire(void 0),Z(()=>{r.linkedSash=s.linkedSash=void 0,e.linkedHeightNode=e.linkedWidthNode=void 0,t.linkedHeightNode=t.linkedWidthNode=void 0,o.linkedHeightNode=o.linkedWidthNode=void 0,n.linkedHeightNode=n.linkedWidthNode=void 0})}updateSplitviewEdgeSnappingEnablement(){this.splitview.startSnappingEnabled=this._edgeSnapping||this._absoluteOrthogonalOffset>0,this.splitview.endSnappingEnabled=this._edgeSnapping||this._absoluteOrthogonalOffset+this._size<this.absoluteOrthogonalSize}dispose(){for(let i of this.children)i.dispose();this._onDidChange.dispose(),this._onDidScroll.dispose(),this._onDidSashReset.dispose(),this._onDidVisibilityChange.dispose(),this.childrenVisibilityChangeDisposable.dispose(),this.splitviewSashResetDisposable.dispose(),this.childrenSashResetDisposable.dispose(),this.childrenChangeDisposable.dispose(),this.onDidScrollDisposable.dispose(),this.splitview.dispose()}};function KGo(a){let[i,e]=H.split(a.onDidChange,cn);return H.any(e,H.map(H.latch(H.map(i,t=>[a.minimumWidth,a.maximumWidth,a.minimumHeight,a.maximumHeight]),$i),t=>{}))}var wb=class{constructor(i,e,t,o,n=0){this.view=i;this.orientation=e;this.layoutController=t;this._size=0;this.absoluteOffset=0;this.absoluteOrthogonalOffset=0;this.onDidScroll=H.None;this.onDidSashReset=H.None;this._onDidLinkedWidthNodeChange=new Mh;this._linkedWidthNode=void 0;this._onDidLinkedHeightNodeChange=new Mh;this._linkedHeightNode=void 0;this._onDidSetLinkedNode=new E;this.disposables=new P;this._boundarySashes={};this.cachedWidth=0;this.cachedHeight=0;this.cachedTop=0;this.cachedLeft=0;this._orthogonalSize=o,this._size=n;let r=KGo(i);this._onDidViewChange=H.map(r,s=>s&&(this.orientation===0?s.width:s.height),this.disposables),this.onDidChange=H.any(this._onDidViewChange,this._onDidSetLinkedNode.event,this._onDidLinkedWidthNodeChange.event,this._onDidLinkedHeightNodeChange.event)}get size(){return this._size}get orthogonalSize(){return this._orthogonalSize}get linkedWidthNode(){return this._linkedWidthNode}set linkedWidthNode(i){this._onDidLinkedWidthNodeChange.input=i?i._onDidViewChange:H.None,this._linkedWidthNode=i,this._onDidSetLinkedNode.fire(void 0)}get linkedHeightNode(){return this._linkedHeightNode}set linkedHeightNode(i){this._onDidLinkedHeightNodeChange.input=i?i._onDidViewChange:H.None,this._linkedHeightNode=i,this._onDidSetLinkedNode.fire(void 0)}get width(){return this.orientation===1?this.orthogonalSize:this.size}get height(){return this.orientation===1?this.size:this.orthogonalSize}get top(){return this.orientation===1?this.absoluteOffset:this.absoluteOrthogonalOffset}get left(){return this.orientation===1?this.absoluteOrthogonalOffset:this.absoluteOffset}get element(){return this.view.element}get minimumWidth(){return this.linkedWidthNode?Math.max(this.linkedWidthNode.view.minimumWidth,this.view.minimumWidth):this.view.minimumWidth}get maximumWidth(){return this.linkedWidthNode?Math.min(this.linkedWidthNode.view.maximumWidth,this.view.maximumWidth):this.view.maximumWidth}get minimumHeight(){return this.linkedHeightNode?Math.max(this.linkedHeightNode.view.minimumHeight,this.view.minimumHeight):this.view.minimumHeight}get maximumHeight(){return this.linkedHeightNode?Math.min(this.linkedHeightNode.view.maximumHeight,this.view.maximumHeight):this.view.maximumHeight}get minimumSize(){return this.orientation===1?this.minimumHeight:this.minimumWidth}get maximumSize(){return this.orientation===1?this.maximumHeight:this.maximumWidth}get priority(){return this.view.priority}get proportionalLayout(){return this.view.proportionalLayout??!0}get snap(){return this.view.snap}get minimumOrthogonalSize(){return this.orientation===1?this.minimumWidth:this.minimumHeight}get maximumOrthogonalSize(){return this.orientation===1?this.maximumWidth:this.maximumHeight}get boundarySashes(){return this._boundarySashes}set boundarySashes(i){this._boundarySashes=i,this.view.setBoundarySashes?.(UGo(i,this.orientation))}layout(i,e,t){if(this.layoutController.isLayoutEnabled){if(typeof t>"u")throw new Error("Invalid state");this._size=i,this._orthogonalSize=t.orthogonalSize,this.absoluteOffset=t.absoluteOffset+e,this.absoluteOrthogonalOffset=t.absoluteOrthogonalOffset,this._layout(this.width,this.height,this.top,this.left)}}_layout(i,e,t,o){this.cachedWidth===i&&this.cachedHeight===e&&this.cachedTop===t&&this.cachedLeft===o||(this.cachedWidth=i,this.cachedHeight=e,this.cachedTop=t,this.cachedLeft=o,this.view.layout(i,e,t,o))}setVisible(i){this.view.setVisible?.(i)}dispose(){this._onDidSetLinkedNode.dispose(),this.disposables.dispose()}};function lio(a,i,e){if(a instanceof yb){let t=new yb(BP(a.orientation),a.layoutController,a.styles,a.splitviewProportionalLayout,i,e,a.edgeSnapping),o=0;for(let n=a.children.length-1;n>=0;n--){let r=a.children[n],s=r instanceof yb?r.orthogonalSize:r.size,l=a.size===0?0:Math.round(i*s/a.size);o+=l,n===0&&(l+=i-o),t.addChild(lio(r,e,l),l,0,!0)}return a.dispose(),t}else{let t=new wb(a.view,BP(a.orientation),a.layoutController,e);return a.dispose(),t}}var oue=class a{constructor(i={}){this.onDidSashResetRelay=new Mh;this._onDidScroll=new Mh;this._onDidChange=new Mh;this._boundarySashes={};this.disposable2x2=C.None;this.onDidSashReset=this.onDidSashResetRelay.event;this.onDidScroll=this._onDidScroll.event;this.onDidChange=this._onDidChange.event;this.maximizedNode=void 0;this._onDidChangeViewMaximized=new E;this.onDidChangeViewMaximized=this._onDidChangeViewMaximized.event;this.element=_(".monaco-grid-view"),this.styles=i.styles||HGo,this.proportionalLayout=typeof i.proportionalLayout<"u"?!!i.proportionalLayout:!0,this.layoutController=new Xgi(!1),this.root=new yb(0,this.layoutController,this.styles,this.proportionalLayout)}get root(){return this._root}set root(i){let e=this._root;e&&(e.element.remove(),e.dispose()),this._root=i,this.element.appendChild(i.element),this.onDidSashResetRelay.input=i.onDidSashReset,this._onDidChange.input=H.map(i.onDidChange,()=>{}),this._onDidScroll.input=i.onDidScroll}get width(){return this.root.width}get height(){return this.root.height}get minimumWidth(){return this.root.minimumWidth}get minimumHeight(){return this.root.minimumHeight}get maximumWidth(){return this.root.maximumHeight}get maximumHeight(){return this.root.maximumHeight}get orientation(){return this._root.orientation}get boundarySashes(){return this._boundarySashes}set orientation(i){if(this._root.orientation===i)return;let{size:e,orthogonalSize:t,absoluteOffset:o,absoluteOrthogonalOffset:n}=this._root;this.root=lio(this._root,t,e),this.root.layout(e,0,{orthogonalSize:t,absoluteOffset:n,absoluteOrthogonalOffset:o,absoluteSize:e,absoluteOrthogonalSize:t}),this.boundarySashes=this.boundarySashes}set boundarySashes(i){this._boundarySashes=i,this.root.boundarySashes=zGo(i,this.orientation)}set edgeSnapping(i){this.root.edgeSnapping=i}style(i){this.styles=i,this.root.style(i)}layout(i,e,t=0,o=0){this.layoutController.isLayoutEnabled=!0;let[n,r,s,l]=this.root.orientation===1?[e,i,t,o]:[i,e,o,t];this.root.layout(n,0,{orthogonalSize:r,absoluteOffset:s,absoluteOrthogonalOffset:l,absoluteSize:n,absoluteOrthogonalSize:r})}addView(i,e,t){this.hasMaximizedView()&&this.exitMaximizedView(),this.disposable2x2.dispose(),this.disposable2x2=C.None;let[o,n]=Mg(t),[r,s]=this.getNode(o);if(s instanceof yb){let l=new wb(i,BP(s.orientation),this.layoutController,s.orthogonalSize);try{s.addChild(l,e,n)}catch(c){throw l.dispose(),c}}else{let[,l]=Mg(r),[,c]=Mg(o),u=0,p=l.getChildCachedVisibleSize(c);typeof p=="number"&&(u=Wl.Invisible(p)),l.removeChild(c).dispose();let g=new yb(s.orientation,s.layoutController,this.styles,this.proportionalLayout,s.size,s.orthogonalSize,l.edgeSnapping);l.addChild(g,s.size,c);let f=new wb(s.view,l.orientation,this.layoutController,s.size);g.addChild(f,u,0),typeof e!="number"&&e.type==="split"&&(e=Wl.Split(0));let v=new wb(i,l.orientation,this.layoutController,s.size);g.addChild(v,e,n)}this.trySet2x2()}removeView(i,e){this.hasMaximizedView()&&this.exitMaximizedView(),this.disposable2x2.dispose(),this.disposable2x2=C.None;let[t,o]=Mg(i),[n,r]=this.getNode(t);if(!(r instanceof yb))throw new Error("Invalid location");let s=r.children[o];if(!(s instanceof wb))throw new Error("Invalid location");if(r.removeChild(o,e),s.dispose(),r.children.length===0)throw new Error("Invalid grid state");if(r.children.length>1)return this.trySet2x2(),s.view;if(n.length===0){let g=r.children[0];return g instanceof wb||(r.removeChild(0),r.dispose(),this.root=g,this.boundarySashes=this.boundarySashes,this.trySet2x2()),s.view}let[,l]=Mg(n),[,c]=Mg(t),u=r.isChildVisible(0),p=r.removeChild(0),h=l.children.map((g,f)=>l.getChildSize(f));if(l.removeChild(c,e),r.dispose(),p instanceof yb){h.splice(c,1,...p.children.map(f=>f.size));let g=p.removeAllChildren();for(let f=0;f<g.length;f++)l.addChild(g[f],g[f].size,c+f)}else{let g=new wb(p.view,BP(p.orientation),this.layoutController,p.size),f=u?p.orthogonalSize:Wl.Invisible(p.orthogonalSize);l.addChild(g,f,c)}p.dispose();for(let g=0;g<h.length;g++)l.resizeChild(g,h[g]);return this.trySet2x2(),s.view}moveView(i,e,t){this.hasMaximizedView()&&this.exitMaximizedView();let[,o]=this.getNode(i);if(!(o instanceof yb))throw new Error("Invalid location");o.moveChild(e,t),this.trySet2x2()}swapViews(i,e){this.hasMaximizedView()&&this.exitMaximizedView();let[t,o]=Mg(i),[,n]=this.getNode(t);if(!(n instanceof yb))throw new Error("Invalid from location");let r=n.getChildSize(o),s=n.children[o];if(!(s instanceof wb))throw new Error("Invalid from location");let[l,c]=Mg(e),[,u]=this.getNode(l);if(!(u instanceof yb))throw new Error("Invalid to location");let p=u.getChildSize(c),h=u.children[c];if(!(h instanceof wb))throw new Error("Invalid to location");n===u?n.swapChildren(o,c):(n.removeChild(o),u.removeChild(c),n.addChild(h,r,o),u.addChild(s,p,c)),this.trySet2x2()}resizeView(i,e){this.hasMaximizedView()&&this.exitMaximizedView();let[t,o]=Mg(i),[n,r]=this.getNode(t);if(!(r instanceof yb))throw new Error("Invalid location");if(!e.width&&!e.height)return;let[s,l]=r.orientation===1?[e.width,e.height]:[e.height,e.width];if(typeof l=="number"&&n.length>0){let[,c]=Mg(n),[,u]=Mg(t);c.resizeChild(u,l)}typeof s=="number"&&r.resizeChild(o,s),this.trySet2x2()}getViewSize(i){if(!i)return{width:this.root.width,height:this.root.height};let[,e]=this.getNode(i);return{width:e.width,height:e.height}}getViewCachedVisibleSize(i){let[e,t]=Mg(i),[,o]=this.getNode(e);if(!(o instanceof yb))throw new Error("Invalid location");return o.getChildCachedVisibleSize(t)}expandView(i){this.hasMaximizedView()&&this.exitMaximizedView();let[e,t]=this.getNode(i);if(!(t instanceof wb))throw new Error("Invalid location");for(let o=0;o<e.length;o++)e[o].resizeChild(i[o],Number.POSITIVE_INFINITY)}isViewExpanded(i){if(this.hasMaximizedView())return!1;let[e,t]=this.getNode(i);if(!(t instanceof wb))throw new Error("Invalid location");for(let o=0;o<e.length;o++)if(!e[o].isChildExpanded(i[o]))return!1;return!0}maximizeView(i,e=[]){let[,t]=this.getNode(i);if(!(t instanceof wb))throw new Error("Location is not a LeafNode");if(this.maximizedNode===t)return;this.hasMaximizedView()&&this.exitMaximizedView();let o=new Set(e);function n(r,s){for(let l=0;l<r.children.length;l++){let c=r.children[l];c instanceof wb?c!==s&&!o.has(c.view)&&r.setChildVisible(l,!1):n(c,s)}}n(this.root,t),this.maximizedNode=t,this._onDidChangeViewMaximized.fire(!0)}exitMaximizedView(){if(!this.maximizedNode)return;this.maximizedNode=void 0;function i(e){for(let t=e.children.length-1;t>=0;t--){let o=e.children[t];o instanceof wb?e.setChildVisible(t,!0):i(o)}}i(this.root),this._onDidChangeViewMaximized.fire(!1)}hasMaximizedView(){return this.maximizedNode!==void 0}isViewMaximized(i){let[,e]=this.getNode(i);if(!(e instanceof wb))throw new Error("Location is not a LeafNode");return e===this.maximizedNode}distributeViewSizes(i){if(this.hasMaximizedView()&&this.exitMaximizedView(),!i){this.root.distributeViewSizes(!0);return}let[,e]=this.getNode(i);if(!(e instanceof yb))throw new Error("Invalid location");e.distributeViewSizes(),this.trySet2x2()}isViewVisible(i){let[e,t]=Mg(i),[,o]=this.getNode(e);if(!(o instanceof yb))throw new Error("Invalid from location");return o.isChildVisible(t)}setViewVisible(i,e){if(this.hasMaximizedView()){this.exitMaximizedView();return}let[t,o]=Mg(i),[,n]=this.getNode(t);if(!(n instanceof yb))throw new Error("Invalid from location");n.setChildVisible(o,e)}getView(i){let e=i?this.getNode(i)[1]:this._root;return this._getViews(e,this.orientation)}static deserialize(i,e,t={}){if(typeof i.orientation!="number")throw new Error("Invalid JSON: 'orientation' property must be a number.");if(typeof i.width!="number")throw new Error("Invalid JSON: 'width' property must be a number.");if(typeof i.height!="number")throw new Error("Invalid JSON: 'height' property must be a number.");if(i.root?.type!=="branch")throw new Error("Invalid JSON: 'root' property must have 'type' value of branch.");let o=i.orientation,n=i.height,r=new a(t);return r._deserialize(i.root,o,e,n),r}_deserialize(i,e,t,o){this.root=this._deserializeNode(i,e,t,o)}_deserializeNode(i,e,t,o){let n;if(i.type==="branch"){let s=i.data.map(l=>({node:this._deserializeNode(l,BP(e),t,i.size),visible:l.visible}));n=new yb(e,this.layoutController,this.styles,this.proportionalLayout,i.size,o,void 0,s)}else n=new wb(t.fromJSON(i.data),e,this.layoutController,o,i.size),i.maximized&&!this.maximizedNode&&(this.maximizedNode=n,this._onDidChangeViewMaximized.fire(!0));return n}_getViews(i,e,t){let o={top:i.top,left:i.left,width:i.width,height:i.height};if(i instanceof wb)return{view:i.view,box:o,cachedVisibleSize:t,maximized:this.maximizedNode===i};let n=[];for(let r=0;r<i.children.length;r++){let s=i.children[r],l=i.getChildCachedVisibleSize(r);n.push(this._getViews(s,BP(e),l))}return{children:n,box:o}}getNode(i,e=this.root,t=[]){if(i.length===0)return[t,e];if(!(e instanceof yb))throw new Error("Invalid location");let[o,...n]=i;if(o<0||o>=e.children.length)throw new Error("Invalid location");let r=e.children[o];return t.push(e),this.getNode(n,r,t)}trySet2x2(){if(this.disposable2x2.dispose(),this.disposable2x2=C.None,this.root.children.length!==2)return;let[i,e]=this.root.children;!(i instanceof yb)||!(e instanceof yb)||(this.disposable2x2=i.trySet2x2(e))}getViewMap(i,e){e||(e=this.root),e instanceof yb?e.children.forEach(t=>this.getViewMap(i,t)):i.set(e.view,e.element)}dispose(){this._onDidChangeViewMaximized.dispose(),this.onDidSashResetRelay.dispose(),this.root.dispose(),this.element.remove()}};function GGo(a){switch(a){case 0:return 1;case 1:return 0;case 2:return 3;case 3:return 2}}function oJ(a){return!!a.children}function dio(a,i){if(i.length===0)return a;if(!oJ(a))throw new Error("Invalid location");let[e,...t]=i;return dio(a.children[e],t)}function $Go(a,i){return!(a.start>=i.end||i.start>=a.end)}function uio(a,i){let e=efi(i),t=i===0?a.top:i===3?a.left+a.width:i===1?a.top+a.height:a.left,o={start:e===1?a.top:a.left,end:e===1?a.top+a.height:a.left+a.width};return{offset:t,range:o}}function qGo(a,i,e){let t=[];function o(n,r,s){if(oJ(n))for(let l of n.children)o(l,r,s);else{let{offset:l,range:c}=uio(n.box,r);l===s.offset&&$Go(c,s.range)&&t.push(n)}}return o(a,i,e),t}function Jgi(a,i){return i.length%2===0?BP(a):a}function efi(a){return a===0||a===1?0:1}function cio(a,i,e){let t=Jgi(a,i),o=efi(e);if(t===o){let[n,r]=Mg(i);return(e===3||e===1)&&(r+=1),[...n,r]}else{let n=e===3||e===1?1:0;return[...i,n]}}function jGo(a){let i=a.parentElement;if(!i)throw new Error("Invalid grid element");let e=i.firstElementChild,t=0;for(;e!==a&&e!==i.lastElementChild&&e;)e=e.nextElementSibling,t++;return t}function pio(a){let i=a.parentElement;if(!i)throw new Error("Invalid grid element");if(/\bmonaco-grid-view\b/.test(i.className))return[];let e=jGo(i),t=i.parentElement.parentElement.parentElement.parentElement;return[...pio(t),e]}var JTe;(o=>{o.Distribute={type:"distribute"},o.Split={type:"split"},o.Auto={type:"auto"};function t(n){return{type:"invisible",cachedVisibleSize:n}}o.Invisible=t})(JTe||={});var Zgi=class extends C{constructor(e,t={}){super();this.views=new Map;this.didLayout=!1;e instanceof oue?(this.gridview=e,this.gridview.getViewMap(this.views)):this.gridview=new oue(t),this._register(this.gridview),this._register(this.gridview.onDidSashReset(this.onDidSashReset,this)),e instanceof oue||this._addView(e,0,[0]),this.onDidChange=this.gridview.onDidChange,this.onDidScroll=this.gridview.onDidScroll,this.onDidChangeViewMaximized=this.gridview.onDidChangeViewMaximized}get orientation(){return this.gridview.orientation}set orientation(e){this.gridview.orientation=e}get width(){return this.gridview.width}get height(){return this.gridview.height}get minimumWidth(){return this.gridview.minimumWidth}get minimumHeight(){return this.gridview.minimumHeight}get maximumWidth(){return this.gridview.maximumWidth}get maximumHeight(){return this.gridview.maximumHeight}get boundarySashes(){return this.gridview.boundarySashes}set boundarySashes(e){this.gridview.boundarySashes=e}set edgeSnapping(e){this.gridview.edgeSnapping=e}get element(){return this.gridview.element}style(e){this.gridview.style(e)}layout(e,t,o=0,n=0){this.gridview.layout(e,t,o,n),this.didLayout=!0}addView(e,t,o,n){if(this.views.has(e))throw new Error("Can't add same view twice");let r=efi(n);this.views.size===1&&this.orientation!==r&&(this.orientation=r);let s=this.getViewLocation(o),l=cio(this.gridview.orientation,s,n),c;if(typeof t=="number")c=t;else if(t.type==="split"){let[,u]=Mg(s);c=Wl.Split(u)}else if(t.type==="distribute")c=Wl.Distribute;else if(t.type==="auto"){let[,u]=Mg(s);c=Wl.Auto(u)}else c=t;this._addView(e,c,l)}addViewAt(e,t,o){if(this.views.has(e))throw new Error("Can't add same view twice");let n;typeof t=="number"?n=t:t.type==="distribute"?n=Wl.Distribute:n=t,this._addView(e,n,o)}_addView(e,t,o){this.views.set(e,e.element),this.gridview.addView(e,t,o)}removeView(e,t){if(this.views.size===1)throw new Error("Can't remove last view");let o=this.getViewLocation(e),n;if(t?.type==="distribute")n=Wl.Distribute;else if(t?.type==="auto"){let r=o[o.length-1];n=Wl.Auto(r===0?1:r-1)}this.gridview.removeView(o,n),this.views.delete(e)}moveView(e,t,o,n){let r=this.getViewLocation(e),[s,l]=Mg(r),c=this.getViewLocation(o),u=cio(this.gridview.orientation,c,n),[p,h]=Mg(u);$i(s,p)?this.gridview.moveView(s,l,h):(this.removeView(e,typeof t=="number"?void 0:t),this.addView(e,t,o,n))}moveViewTo(e,t){let o=this.getViewLocation(e),[n,r]=Mg(o),[s,l]=Mg(t);if($i(n,s))this.gridview.moveView(n,r,l);else{let c=this.getViewSize(e),u=Jgi(this.gridview.orientation,o),p=this.getViewCachedVisibleSize(e),h=typeof p>"u"?u===1?c.width:c.height:JTe.Invisible(p);this.removeView(e),this.addViewAt(e,h,t)}}swapViews(e,t){let o=this.getViewLocation(e),n=this.getViewLocation(t);return this.gridview.swapViews(o,n)}resizeView(e,t){let o=this.getViewLocation(e);return this.gridview.resizeView(o,t)}isViewExpanded(e){let t=this.getViewLocation(e);return this.gridview.isViewExpanded(t)}isViewMaximized(e){let t=this.getViewLocation(e);return this.gridview.isViewMaximized(t)}hasMaximizedView(){return this.gridview.hasMaximizedView()}getViewSize(e){if(!e)return this.gridview.getViewSize();let t=this.getViewLocation(e);return this.gridview.getViewSize(t)}getViewCachedVisibleSize(e){let t=this.getViewLocation(e);return this.gridview.getViewCachedVisibleSize(t)}maximizeView(e,t=[]){if(this.views.size<2)throw new Error("At least two views are required to maximize a view");let o=this.getViewLocation(e);this.gridview.maximizeView(o,t)}exitMaximizedView(){this.gridview.exitMaximizedView()}expandView(e){let t=this.getViewLocation(e);this.gridview.expandView(t)}distributeViewSizes(){this.gridview.distributeViewSizes()}isViewVisible(e){let t=this.getViewLocation(e);return this.gridview.isViewVisible(t)}setViewVisible(e,t){let o=this.getViewLocation(e);this.gridview.setViewVisible(o,t)}getViews(){return this.gridview.getView()}getNeighborViews(e,t,o=!1){if(!this.didLayout)throw new Error("Can't call getNeighborViews before first layout");let n=this.getViewLocation(e),r=this.getViews(),s=dio(r,n),l=uio(s.box,t);return o&&(t===0&&s.box.top===0?l={offset:r.box.top+r.box.height,range:l.range}:t===3&&s.box.left+s.box.width===r.box.width?l={offset:0,range:l.range}:t===1&&s.box.top+s.box.height===r.box.height?l={offset:0,range:l.range}:t===2&&s.box.left===0&&(l={offset:r.box.left+r.box.width,range:l.range})),qGo(r,GGo(t),l).map(c=>c.view)}getViewLocation(e){let t=this.views.get(e);if(!t)throw new Error("View not found");return pio(t)}onDidSashReset(e){let t=r=>{let s=this.gridview.getView(r);if(oJ(s))return!1;let l=Jgi(this.orientation,r),c=l===1?s.view.preferredWidth:s.view.preferredHeight;if(typeof c!="number")return!1;let u=l===1?{width:Math.round(c)}:{height:Math.round(c)};return this.gridview.resizeView(r,u),!0};if(t(e))return;let[o,n]=Mg(e);t([...o,n+1])||this.gridview.distributeViewSizes(o)}},O5=class a extends Zgi{constructor(){super(...arguments);this.initialLayoutContext=!0}static serializeNode(e,t){let o=t===0?e.box.width:e.box.height;if(!oJ(e)){let r={type:"leaf",data:e.view.toJSON(),size:o};return typeof e.cachedVisibleSize=="number"?(r.size=e.cachedVisibleSize,r.visible=!1):e.maximized&&(r.maximized=!0),r}let n=e.children.map(r=>a.serializeNode(r,BP(t)));return n.some(r=>r.visible!==!1)?{type:"branch",data:n,size:o}:{type:"branch",data:n,size:o,visible:!1}}static deserialize(e,t,o={}){if(typeof e.orientation!="number")throw new Error("Invalid JSON: 'orientation' property must be a number.");if(typeof e.width!="number")throw new Error("Invalid JSON: 'width' property must be a number.");if(typeof e.height!="number")throw new Error("Invalid JSON: 'height' property must be a number.");let n=oue.deserialize(e,t,o);return new a(n,o)}static from(e,t={}){return a.deserialize(tfi(e),{fromJSON:o=>o},t)}serialize(){return{root:a.serializeNode(this.getViews(),this.orientation),orientation:this.orientation,width:this.width,height:this.height}}layout(e,t,o=0,n=0){super.layout(e,t,o,n),this.initialLayoutContext&&(this.initialLayoutContext=!1,this.gridview.trySet2x2())}};function mio(a){return!!a.groups}function hio(a,i){if(!i&&a.groups&&a.groups.length<=1&&(a.groups=void 0),!mio(a))return;let e=0,t=0;for(let s of a.groups)hio(s,!1),s.size&&(e+=s.size,t++);let o=t>0?e:1,n=a.groups.length-t,r=o/n;for(let s of a.groups)s.size||(s.size=r)}function gio(a){return mio(a)?{type:"branch",data:a.groups.map(i=>gio(i)),size:a.size}:{type:"leaf",data:a.data,size:a.size}}function fio(a,i){if(a.type==="branch"){let e=a.data.map(t=>fio(t,BP(i)));if(i===0){let t=a.size||(e.length===0?void 0:Math.max(...e.map(n=>n.width||0))),o=e.length===0?void 0:e.reduce((n,r)=>n+(r.height||0),0);return{width:t,height:o}}else{let t=e.length===0?void 0:e.reduce((n,r)=>n+(r.width||0),0),o=a.size||(e.length===0?void 0:Math.max(...e.map(n=>n.height||0)));return{width:t,height:o}}}else{let e=i===0?a.size:void 0,t=i===0?void 0:a.size;return{width:e,height:t}}}function tfi(a){hio(a,!0);let i=gio(a),{width:e,height:t}=fio(i,a.orientation);return{root:i,orientation:a.orientation,width:e||1,height:t||1}}var ZTe=class extends K{constructor(e,t){super(e);this.direction=t}run(e){let t=e.get(fi),o=e.get(Et),n=e.get(ds),r=t.hasFocus("workbench.parts.editor"),s=t.hasFocus("workbench.parts.panel"),l=t.hasFocus("workbench.parts.sidebar"),c=t.hasFocus("workbench.parts.auxiliarybar"),u;if(r){if(this.navigateAcrossEditorGroup(this.toGroupDirection(this.direction),o))return;u=t.getVisibleNeighborPart("workbench.parts.editor",this.direction)}s&&(u=t.getVisibleNeighborPart("workbench.parts.panel",this.direction)),l&&(u=t.getVisibleNeighborPart("workbench.parts.sidebar",this.direction)),c&&(u=u=t.getVisibleNeighborPart("workbench.parts.auxiliarybar",this.direction)),u==="workbench.parts.editor"?this.navigateBackToEditorGroup(this.toGroupDirection(this.direction),o)||this.navigateToEditorGroup(this.direction===3?0:1,o):u==="workbench.parts.sidebar"?this.navigateToSidebar(t,n):u==="workbench.parts.panel"?this.navigateToPanel(t,n):u==="workbench.parts.auxiliarybar"&&this.navigateToAuxiliaryBar(t,n)}async navigateToPanel(e,t){if(!e.isVisible("workbench.parts.panel"))return!1;let o=t.getActivePaneComposite(1);if(!o)return!1;let n=o.getId(),r=await t.openPaneComposite(n,1,!0);return r||!1}async navigateToSidebar(e,t){if(!e.isVisible("workbench.parts.sidebar"))return!1;let o=t.getActivePaneComposite(0);if(!o)return!1;let n=o.getId();return!!await t.openPaneComposite(n,0,!0)}async navigateToAuxiliaryBar(e,t){if(!e.isVisible("workbench.parts.auxiliarybar"))return!1;let o=t.getActivePaneComposite(2);if(!o)return!1;let n=o.getId(),r=await t.openPaneComposite(n,2,!0);return r||!1}navigateAcrossEditorGroup(e,t){return this.doNavigateToEditorGroup({direction:e},t)}navigateToEditorGroup(e,t){return this.doNavigateToEditorGroup({location:e},t)}navigateBackToEditorGroup(e,t){if(!t.activeGroup)return!1;let o=this.toOppositeDirection(e);return t.findGroup({direction:o},t.activeGroup)?!1:(t.activeGroup.focus(),!0)}toGroupDirection(e){switch(e){case 1:return 1;case 2:return 2;case 3:return 3;case 0:return 0}}toOppositeDirection(e){switch(e){case 0:return 1;case 3:return 2;case 2:return 3;case 1:return 0}}doNavigateToEditorGroup(e,t){let o=t.findGroup(e,t.activeGroup);return o?(o.focus(),!0):!1}};W(class extends ZTe{constructor(){super({id:"workbench.action.navigateLeft",title:L(3423,"Navigate to the View on the Left"),category:We.View,f1:!0},2)}});W(class extends ZTe{constructor(){super({id:"workbench.action.navigateRight",title:L(3424,"Navigate to the View on the Right"),category:We.View,f1:!0},3)}});W(class extends ZTe{constructor(){super({id:"workbench.action.navigateUp",title:L(3425,"Navigate to the View Above"),category:We.View,f1:!0},0)}});W(class extends ZTe{constructor(){super({id:"workbench.action.navigateDown",title:L(3422,"Navigate to the View Below"),category:We.View,f1:!0},1)}});var nPt=class extends K{constructor(e,t){super(e);this.focusNext=t}run(e){let t=e.get(fi),o=e.get(ee);this.focusNextOrPreviousPart(t,o,this.focusNext)}findVisibleNeighbour(e,t,o){let n=Ki(),r=Cy(n),s;if(r)t==="workbench.parts.editor"?s="workbench.parts.statusbar":s="workbench.parts.editor";else switch(t){case"workbench.parts.editor":s=o?"workbench.parts.panel":"workbench.parts.sidebar";break;case"workbench.parts.panel":s=o?"workbench.parts.auxiliarybar":"workbench.parts.editor";break;case"workbench.parts.auxiliarybar":s=o?"workbench.parts.statusbar":"workbench.parts.panel";break;case"workbench.parts.statusbar":s=o?"workbench.parts.activitybar":"workbench.parts.auxiliarybar";break;case"workbench.parts.activitybar":s=o?"workbench.parts.sidebar":"workbench.parts.statusbar";break;case"workbench.parts.sidebar":s=o?"workbench.parts.editor":"workbench.parts.activitybar";break;default:s="workbench.parts.editor"}return e.isVisible(s,n)||s==="workbench.parts.editor"?s:this.findVisibleNeighbour(e,s,o)}focusNextOrPreviousPart(e,t,o){let n;t.activeEditorPane?.hasFocus()||e.hasFocus("workbench.parts.editor")?n="workbench.parts.editor":e.hasFocus("workbench.parts.activitybar")?n="workbench.parts.activitybar":e.hasFocus("workbench.parts.statusbar")?n="workbench.parts.statusbar":e.hasFocus("workbench.parts.sidebar")?n="workbench.parts.sidebar":e.hasFocus("workbench.parts.auxiliarybar")?n="workbench.parts.auxiliarybar":e.hasFocus("workbench.parts.panel")&&(n="workbench.parts.panel"),e.focusPart(n?this.findVisibleNeighbour(e,n,o):"workbench.parts.editor",Ki())}};W(class extends nPt{constructor(){super({id:"workbench.action.focusNextPart",title:L(3420,"Focus Next Part"),category:We.View,f1:!0,keybinding:{primary:64,weight:200}},!0)}});W(class extends nPt{constructor(){super({id:"workbench.action.focusPreviousPart",title:L(3421,"Focus Previous Part"),category:We.View,f1:!0,keybinding:{primary:1088,weight:200}},!1)}});var vio="inQuickOpen",bio=new Q(vio,!1,d(4261,null)),$E=x.has(vio),ifi="inFilesPicker",ofi=x.and($E,x.has(ifi));function Y_(a,i){return e=>{let t=e.get(_e),o=e.get(Ge),r={keybindings:t.lookupKeybindings(a)};o.navigate(!!i,r)}}var oK=class extends C{constructor(e,t){super();this.editorService=e;this.editorGroupsService=t;this.editorViewState=void 0;this.openedTransientEditors=new Set}set(){if(this.editorViewState)return;let e=this.editorService.activeEditorPane;e&&(this.editorViewState={group:e.group,editor:e.input,state:F2i(e.getControl())?.saveViewState()??void 0})}async openTransientEditor(e,t){e.options={...e.options,transient:!0};let o=await this.editorService.openEditor(e,t);return o?.input&&o.input!==this.editorViewState?.editor&&o.group.isTransient(o.input)&&this.openedTransientEditors.add(o.input),o}async restore(){if(this.editorViewState){for(let e of this.openedTransientEditors)if(!e.isDirty())for(let t of this.editorGroupsService.groups)t.isTransient(e)&&await t.closeEditor(e,{preserveFocus:!0});await this.editorViewState.group.openEditor(this.editorViewState.editor,{viewState:this.editorViewState.state,preserveFocus:!0}),this.reset()}}reset(){this.editorViewState=void 0,this.openedTransientEditors.clear()}dispose(){super.dispose(),this.reset()}};oK=I([m(0,ee),m(1,Et)],oK);function nfi(a){return a?.hasOwnProperty("folderUri")}function Sio(a){return a?.hasOwnProperty("workspace")}var wio="inRecentFilesPicker",rPt=class extends K{constructor(){super(...arguments);this.removeFromRecentlyOpened={iconClass:q.asClassName(M.removeClose),tooltip:d(3468,null)};this.dirtyRecentlyOpenedFolder={iconClass:"dirty-workspace "+q.asClassName(M.closeDirty),tooltip:d(3445,null),alwaysVisible:!0};this.dirtyRecentlyOpenedWorkspace={...this.dirtyRecentlyOpenedFolder,tooltip:d(3446,null)};this.windowOpenedRecentlyOpenedFolder={iconClass:"opened-workspace "+q.asClassName(M.window),tooltip:d(3459,null),alwaysVisible:!0};this.windowOpenedRecentlyOpenedWorkspace={...this.windowOpenedRecentlyOpenedFolder,tooltip:d(3460,null)};this.activeWindowOpenedRecentlyOpenedFolder={iconClass:"opened-workspace "+q.asClassName(M.windowActive),tooltip:d(3439,null),alwaysVisible:!0};this.activeWindowOpenedRecentlyOpenedWorkspace={...this.activeWindowOpenedRecentlyOpenedFolder,tooltip:d(3440,null)}}async run(e){let t=e.get(Ff),o=e.get(Ge),n=e.get(Pe),r=e.get(ot),s=e.get(_e),l=e.get(Ct),c=e.get(kt),u=e.get(oi),p=e.get(ct),[h,g,f]=await Promise.all([u.getWindows({includeAuxiliaryWindows:!1}),t.getRecentlyOpened(),t.getDirtyWorkspaces()]),v=!1,b=new vt,S=new vt;for(let se of f)nfi(se)?b.set(se.folderUri,!0):(S.set(se.workspace.configPath,se.workspace),v=!0);let y=Ki().vscodeWindowId,w=new vt;for(let se of h){let Se=se.id===y;$g(se.workspace)?w.set(se.workspace.uri,{isActive:Se}):TL(se.workspace)&&w.set(se.workspace.configPath,{isActive:Se})}let k=new vt,T=new vt;for(let se of g.workspaces)Ode(se)?k.set(se.folderUri,!0):(T.set(se.workspace.configPath,se.workspace),v=!0);let N=[];for(let se of g.workspaces){let Se=Ode(se)?b.has(se.folderUri):S.has(se.workspace.configPath),ke=Ode(se)?w.get(se.folderUri):w.get(se.workspace.configPath);N.push(this.toQuickPick(l,c,r,se,{isDirty:Se,windowState:ke}))}for(let se of f)nfi(se)&&!k.has(se.folderUri)?N.push(this.toQuickPick(l,c,r,se,{isDirty:!0,windowState:void 0})):Sio(se)&&!T.has(se.workspace.configPath)&&N.push(this.toQuickPick(l,c,r,se,{isDirty:!0,windowState:void 0}));let O=g.files.map(se=>this.toQuickPick(l,c,r,se,{isDirty:!1,windowState:void 0})),V=g.workspaces[0],U=V&&n.isCurrentWorkspace(L9e(V)?V.workspace:V.folderUri),G,$={type:"separator",label:v?d(3470,null):d(3451,null)},te={type:"separator",label:d(3450,null)},pe=[$,...N,te,...O],de=await o.pick(pe,{contextKey:wio,activeItem:[...N,...O][U?1:0],placeHolder:it?d(3463,null):d(3462,null),matchOnDescription:!0,sortByLabel:!1,onKeyMods:se=>G=se,quickNavigate:this.isQuickNavigate()?{keybindings:s.lookupKeybindings(this.desc.id)}:void 0,hideInput:this.isQuickNavigate(),onDidTriggerItemButton:async se=>{if(se.button===this.removeFromRecentlyOpened||se.button===this.windowOpenedRecentlyOpenedFolder||se.button===this.windowOpenedRecentlyOpenedWorkspace)await t.removeRecentlyOpened([se.item.resource]),se.removeItem();else if(se.button===this.dirtyRecentlyOpenedFolder||se.button===this.dirtyRecentlyOpenedWorkspace){let Se=se.button===this.dirtyRecentlyOpenedWorkspace,{confirmed:ke}=await p.confirm({title:Se?d(3447,null):d(3442,null),message:Se?d(3448,null):d(3443,null),detail:Se?d(3449,null):d(3444,null)});ke&&(u.openWindow([se.item.openable],{remoteAuthority:se.item.remoteAuthority||null}),o.cancel())}}});if(de)return u.openWindow([de.openable],{forceNewWindow:G?.ctrlCmd,forceReuseWindow:G?.alt,remoteAuthority:de.remoteAuthority||null})}toQuickPick(e,t,o,n,r){let s,l,c,u,p=!1;Ode(n)?(u=n.folderUri,l=js(e,t,u,1),s={folderUri:u},c=n.label||o.getWorkspaceLabel(u,{verbose:2})):L9e(n)?(u=n.workspace.configPath,l=js(e,t,u,2),s={workspaceUri:u},c=n.label||o.getWorkspaceLabel(n.workspace,{verbose:2}),p=!0):(u=n.fileUri,l=js(e,t,u,0),s={fileUri:u},c=n.label||o.getUriLabel(u,{appendWorkspaceSuffix:!0}));let{name:h,parentPath:g}=_$i(c),f=[];return r.isDirty?f.push(p?this.dirtyRecentlyOpenedWorkspace:this.dirtyRecentlyOpenedFolder):r.windowState?r.windowState.isActive?f.push(p?this.activeWindowOpenedRecentlyOpenedWorkspace:this.activeWindowOpenedRecentlyOpenedFolder):f.push(p?this.windowOpenedRecentlyOpenedWorkspace:this.windowOpenedRecentlyOpenedFolder):f.push(this.removeFromRecentlyOpened),{iconClasses:l,label:h,ariaLabel:r.isDirty?p?d(3466,null,h):d(3465,null,h):h,description:g,buttons:f,openable:s,resource:u,remoteAuthority:n.remoteAuthority}}},F5=class a extends rPt{static{this.ID="workbench.action.openRecent"}constructor(){super({id:a.ID,title:{...L(3461,"Open Recent..."),mnemonicTitle:d(3454,null)},category:We.File,f1:!0,keybinding:{weight:200,primary:2096,mac:{primary:304}},menu:{id:D.MenubarRecentMenu,group:"y_more",order:1}})}isQuickNavigate(){return!1}},rfi=class extends rPt{constructor(){super({id:"workbench.action.quickOpenRecent",title:L(3464,"Quick Open Recent..."),category:We.File,f1:!1})}isQuickNavigate(){return!0}},sfi=class extends K{constructor(){super({id:"workbench.action.toggleFullScreen",title:{...L(3469,"Toggle Full Screen"),mnemonicTitle:d(3457,null)},category:We.View,f1:!0,keybinding:{weight:200,primary:69,mac:{primary:2340}},precondition:xyt.toNegated(),toggled:lP,menu:[{id:D.MenubarAppearanceMenu,group:"1_toggle_view",order:1}]})}run(i){return i.get(oi).toggleFullScreen(Ki())}},nJ=class a extends K{static{this.ID="workbench.action.reloadWindow"}constructor(){super({id:a.ID,title:L(3467,"Reload Window"),category:We.Developer,f1:!0,keybinding:{weight:250,when:Gq,primary:2096}})}async run(i){return i.get(oi).reload()}},afi=class extends K{constructor(){super({id:"workbench.action.showAboutDialog",title:{...L(3438,"About"),mnemonicTitle:d(3452,null)},category:We.Help,f1:!0,menu:{id:D.MenubarHelpMenu,group:"z_about",order:1,when:Mx.toNegated()}})}run(i){return i.get(ct).about()}},lfi=class extends K{constructor(){super({id:"workbench.action.newWindow",title:{...L(3458,"New Window"),mnemonicTitle:d(3455,null)},f1:!0,keybinding:{weight:200,primary:Gt?ri?Ai(2089,1068):3628:3116,secondary:Gt?[3116]:void 0},menu:{id:D.MenubarFileMenu,group:"1_new",order:3}})}run(i){return i.get(oi).openWindow({remoteAuthority:null})}},cfi=class extends K{constructor(){super({id:"workbench.action.blur",title:L(3441,"Remove keyboard focus from focused element")})}run(){let i=Pn();Ao(i)&&i.blur()}};W(lfi);W(sfi);W(rfi);W(F5);W(nJ);W(afi);W(cfi);var Cio=x.and($E,x.has(wio)),Iio="workbench.action.quickOpenNavigateNextInRecentFilesPicker";yt.registerCommandAndKeybindingRule({id:Iio,weight:250,handler:Y_(Iio,!0),when:Cio,primary:2096,mac:{primary:304}});var yio="workbench.action.quickOpenNavigatePreviousInRecentFilesPicker";yt.registerCommandAndKeybindingRule({id:yio,weight:250,handler:Y_(yio,!1),when:Cio,primary:3120,mac:{primary:1328}});qe.registerCommand("workbench.action.toggleConfirmBeforeClose",a=>{let i=a.get(B),e=i.inspect("window.confirmBeforeClose").userValue;return i.updateValue("window.confirmBeforeClose",e==="never"?"keyboardOnly":"never")});fe.appendMenuItem(D.MenubarFileMenu,{group:"z_ConfirmClose",command:{id:"workbench.action.toggleConfirmBeforeClose",title:d(3453,null),toggled:x.notEquals("config.window.confirmBeforeClose","never")},order:1,when:ep});fe.appendMenuItem(D.MenubarFileMenu,{title:d(3456,null),submenu:D.MenubarRecentMenu,group:"2_open",order:4});var e_e="addRootFolder",sPt=L(3491,"Add Folder to Workspace..."),dfi="setRootFolder",SR="_workbench.pickWorkspaceFolder";qe.registerCommand({id:"workbench.action.files.openFileFolderInNewWindow",handler:a=>a.get(dn).pickFileFolderAndOpen({forceNewWindow:!0})});qe.registerCommand({id:"_files.pickFolderAndOpen",handler:(a,i)=>a.get(dn).pickFolderAndOpen(i)});qe.registerCommand({id:"workbench.action.files.openFolderInNewWindow",handler:a=>a.get(dn).pickFolderAndOpen({forceNewWindow:!0})});qe.registerCommand({id:"workbench.action.files.openFileInNewWindow",handler:a=>a.get(dn).pickFileAndOpen({forceNewWindow:!0})});qe.registerCommand({id:"workbench.action.openWorkspaceInNewWindow",handler:a=>a.get(dn).pickWorkspaceAndOpen({forceNewWindow:!0})});qe.registerCommand({id:e_e,handler:async a=>{let i=a.get(Of),e=await xio(a);e?.length&&await i.addFolders(e.map(t=>({uri:t})))}});qe.registerCommand({id:dfi,handler:async a=>{let i=a.get(Of),e=a.get(Pe),t=await xio(a);t?.length&&await i.updateFolders(0,e.getWorkspace().folders.length,t.map(o=>({uri:o})))}});async function xio(a){let i=a.get(dn),e=a.get(wn);return await i.showOpenDialog({openLabel:$$(d(3490,null)),title:d(3492,null),canSelectFolders:!0,canSelectMany:!0,defaultUri:await i.defaultFolderPath(),availableFileSystems:[e.defaultUriScheme]})}qe.registerCommand(SR,async function(a,i){let e=a.get(Ge),t=a.get(ot),o=a.get(Pe),n=a.get(Ct),r=a.get(kt),s=o.getWorkspace().folders;if(!s.length)return;let l=s.map(h=>{let g=h.name,f=t.getUriLabel(ci(h.uri),{relative:!0});return{label:g,description:f!==g?f:void 0,folder:h,iconClasses:js(n,r,h.uri,2)}}),c=(i?i[0]:void 0)||Object.create(null);c.activeItem||(c.activeItem=l[0]),c.placeHolder||(c.placeHolder=d(3493,null)),typeof c.matchOnDescription!="boolean"&&(c.matchOnDescription=!0);let u=(i?i[1]:void 0)||ve.None,p=await e.pick(l,c,u);if(p)return s[l.indexOf(p)]});qe.registerCommand({id:"vscode.openFolder",handler:(a,i,e)=>{let t=a.get(ge);if(typeof e=="boolean"&&(e={forceNewWindow:e}),!i){let l={forceNewWindow:e?.forceNewWindow};return e?.forceLocalWindow&&(l.remoteAuthority=null,l.availableFileSystems=["file"]),t.executeCommand("_files.pickFolderAndOpen",l)}let o=A.from(i,!0),n={forceNewWindow:e?.forceNewWindow,forceReuseWindow:e?.forceReuseWindow,noRecentEntry:e?.noRecentEntry,remoteAuthority:e?.forceLocalWindow?null:void 0,forceProfile:e?.forceProfile,forceTempProfile:e?.forceTempProfile},r=o7(o)||o.scheme===Y.untitled?{workspaceUri:o}:{folderUri:o},s=e?.filesToOpen?.map(l=>({fileUri:A.from(l,!0)}))??[];return t.executeCommand("_files.windowOpen",[r,...s],n)},metadata:{description:"Open a folder or workspace in the current window or new window depending on the newWindow argument. Note that opening in the same window will shutdown the current extension host process and start a new one on the given folder/workspace unless the newWindow parameter is set to true.",args:[{name:"uri",description:"(optional) Uri of the folder or workspace file to open. If not provided, a native dialog will ask the user for the folder",constraint:a=>a==null||a instanceof A},{name:"options",description:"(optional) Options. Object with the following properties: `forceNewWindow`: Whether to open the folder/workspace in a new window or the same. Defaults to opening in the same window. `forceReuseWindow`: Whether to force opening the folder/workspace in the same window. Defaults to false. `noRecentEntry`: Whether the opened URI will appear in the 'Open Recent' list. Defaults to false. `forceLocalWindow`: Whether to force opening the folder/workspace in a local window. Defaults to false. `forceProfile`: The profile to use when opening the folder/workspace. Defaults to the current profile. `forceTempProfile`: Whether to use a temporary profile when opening the folder/workspace. Defaults to false. `filesToOpen`: An array of files to open in the new window. Defaults to an empty array. Note, for backward compatibility, options can also be of type boolean, representing the `forceNewWindow` setting.",constraint:a=>a===void 0||typeof a=="object"||typeof a=="boolean"}]}});qe.registerCommand({id:"vscode.newWindow",handler:(a,i)=>{let e=a.get(ge),t={forceReuseWindow:i?.reuseWindow,remoteAuthority:i?.remoteAuthority};return e.executeCommand("_files.newWindow",t)},metadata:{description:"Opens an new window depending on the newWindow argument.",args:[{name:"options",description:"(optional) Options. Object with the following properties: `reuseWindow`: Whether to open a new window or the same. Defaults to opening in a new window. ",constraint:a=>a===void 0||typeof a=="object"}]}});qe.registerCommand("_workbench.removeFromRecentlyOpened",function(a,i){return a.get(Ff).removeRecentlyOpened([i])});qe.registerCommand({id:"vscode.removeFromRecentlyOpened",handler:(a,i)=>{let e=a.get(Ff);return typeof i=="string"?i=i.match(/^[^:/?#]+:\/\//)?A.parse(i):A.file(i):i=A.revive(i),e.removeRecentlyOpened([i])},metadata:{description:"Removes an entry with the given path from the recently opened list.",args:[{name:"path",description:"URI or URI string to remove from recently opened.",constraint:a=>typeof a=="string"||a instanceof A}]}});qe.registerCommand("_workbench.addToRecentlyOpened",async function(a,i){let e=a.get(Ff),t=i.uri,o=i.label,n=i.remoteAuthority,r;return i.type==="workspace"?r={workspace:await e.getWorkspaceIdentifier(t),label:o,remoteAuthority:n}:i.type==="folder"?r={folderUri:t,label:o,remoteAuthority:n}:r={fileUri:t,label:o,remoteAuthority:n},e.addRecentlyOpened([r])});qe.registerCommand("_workbench.getRecentlyOpened",async function(a){return a.get(Ff).getRecentlyOpened()});var n_e=L(3489,"Workspaces"),t_e=class a extends K{static{this.ID="workbench.action.files.openFile"}constructor(){super({id:a.ID,title:L(3483,"Open File..."),category:We.File,f1:!0,keybinding:{when:Mx.toNegated(),weight:200,primary:2093}})}async run(i,e){return i.get(dn).pickFileAndOpen({forceNewWindow:!1,telemetryExtraData:e})}},nK=class a extends K{static{this.ID="workbench.action.files.openFolder"}constructor(){super({id:a.ID,title:L(3485,"Open Folder..."),category:We.File,f1:!0,precondition:PO,keybinding:{weight:200,primary:void 0,linux:{primary:Ai(2089,2093)},win:{primary:Ai(2089,2093)}}})}async run(i,e){return i.get(dn).pickFolderAndOpen({forceNewWindow:!1,telemetryExtraData:e})}},i_e=class a extends K{static{this.ID="workbench.action.files.openFolderViaWorkspace"}constructor(){super({id:a.ID,title:L(3485,"Open Folder..."),category:We.File,f1:!0,precondition:x.and(PO.toNegated(),Qa.isEqualTo("workspace")),keybinding:{weight:200,primary:2093}})}run(i){return i.get(ge).executeCommand(dfi)}},aPt=class a extends K{static{this.ID="workbench.action.files.openFileFolder"}static{this.LABEL=L(3484,"Open...")}constructor(){super({id:a.ID,title:a.LABEL,category:We.File,f1:!0,precondition:x.and(Mx,PO),keybinding:{weight:200,primary:2093}})}async run(i,e){return i.get(dn).pickFileFolderAndOpen({forceNewWindow:!1,telemetryExtraData:e})}},lPt=class a extends K{static{this.ID="workbench.action.openWorkspace"}constructor(){super({id:a.ID,title:L(3486,"Open Workspace from File..."),category:We.File,f1:!0,precondition:T_})}async run(i,e){return i.get(dn).pickWorkspaceAndOpen({telemetryExtraData:e})}},c7e=class a extends K{static{this.ID="workbench.action.closeFolder"}constructor(){super({id:a.ID,title:L(3471,"Close Workspace"),category:n_e,f1:!0,precondition:x.and(Qa.notEqualsTo("empty"),xY),keybinding:{weight:200,primary:Ai(2089,36)}})}async run(i){let e=i.get(oi),t=i.get(Vt);return e.openWindow({forceReuseWindow:!0,remoteAuthority:t.remoteAuthority})}},ufi=class a extends K{static{this.ID="workbench.action.openWorkspaceConfigFile"}constructor(){super({id:a.ID,title:L(3487,"Open Workspace Configuration File"),category:n_e,f1:!0,precondition:Qa.isEqualTo("workspace")})}async run(i){let e=i.get(Pe),t=i.get(ee),o=e.getWorkspace().configuration;o&&await t.openEditor({resource:o,options:{pinned:!0}})}},o_e=class a extends K{static{this.ID="workbench.action.addRootFolder"}constructor(){super({id:a.ID,title:sPt,category:n_e,f1:!0,precondition:x.or(T_,Qa.isEqualTo("workspace"))})}run(i){return i.get(ge).executeCommand(e_e)}},d7e=class a extends K{static{this.ID="workbench.action.removeRootFolder"}constructor(){super({id:a.ID,title:L(3474,"Remove Folder from Workspace..."),category:n_e,f1:!0,precondition:x.and(mC.notEqualsTo("0"),x.or(T_,Qa.isEqualTo("workspace")))})}async run(i){let e=i.get(ge),t=i.get(Of),o=await e.executeCommand(SR);o&&await t.removeFolders([o.uri])}},cPt=class a extends K{static{this.ID="workbench.action.saveWorkspaceAs"}constructor(){super({id:a.ID,title:L(3488,"Save Workspace As..."),category:n_e,f1:!0,precondition:T_})}async run(i){let e=i.get(Of),t=i.get(Pe),o=await e.pickNewWorkspacePath();if(o&&o7(o))switch(t.getWorkbenchState()){case 1:case 2:{let n=t.getWorkspace().folders.map(r=>({uri:r.uri}));return e.createAndEnterWorkspace(n,o)}case 3:return e.saveAndEnterWorkspace(o)}}},dPt=class a extends K{static{this.ID="workbench.action.duplicateWorkspaceInNewWindow"}constructor(){super({id:a.ID,title:L(3473,"Duplicate As Workspace in New Window"),category:n_e,f1:!0,precondition:T_})}async run(i){let e=i.get(Pe),t=i.get(Of),o=i.get(oi),n=i.get(Ff),r=i.get(Vt),s=e.getWorkspace().folders,l=r.remoteAuthority,c=await n.createUntitledWorkspace(s,l);return await t.copyWorkspaceSettings(c),o.openWindow([{workspaceUri:c.configPath}],{forceNewWindow:!0,remoteAuthority:l})}};W(o_e);W(d7e);W(t_e);W(nK);W(i_e);W(aPt);W(lPt);W(ufi);W(c7e);W(cPt);W(dPt);fe.appendMenuItem(D.MenubarFileMenu,{group:"2_open",command:{id:t_e.ID,title:d(3479,null)},order:1,when:Mx.toNegated()});fe.appendMenuItem(D.MenubarFileMenu,{group:"2_open",command:{id:nK.ID,title:d(3480,null)},order:2,when:PO});fe.appendMenuItem(D.MenubarFileMenu,{group:"2_open",command:{id:i_e.ID,title:d(3480,null)},order:2,when:x.and(PO.toNegated(),Qa.isEqualTo("workspace"))});fe.appendMenuItem(D.MenubarFileMenu,{group:"2_open",command:{id:aPt.ID,title:d(3478,null)},order:1,when:x.and(Mx,PO)});fe.appendMenuItem(D.MenubarFileMenu,{group:"2_open",command:{id:lPt.ID,title:d(3481,null)},order:3,when:T_});fe.appendMenuItem(D.MenubarFileMenu,{group:"3_workspace",command:{id:e_e,title:d(3475,null)},when:x.or(T_,Qa.isEqualTo("workspace")),order:1});fe.appendMenuItem(D.MenubarFileMenu,{group:"3_workspace",command:{id:cPt.ID,title:d(3482,null)},order:2,when:T_});fe.appendMenuItem(D.MenubarFileMenu,{group:"3_workspace",command:{id:dPt.ID,title:d(3472,null)},order:3,when:T_});fe.appendMenuItem(D.MenubarFileMenu,{group:"6_close",command:{id:c7e.ID,title:d(3476,null)},order:3,when:x.and(Qa.isEqualTo("folder"),xY)});fe.appendMenuItem(D.MenubarFileMenu,{group:"6_close",command:{id:c7e.ID,title:d(3477,null)},order:3,when:x.and(Qa.isEqualTo("workspace"),xY)});var W5={primary:2094,secondary:[2083],mac:{primary:2094,secondary:void 0}};yt.registerCommandAndKeybindingRule({id:"workbench.action.closeQuickOpen",weight:200,when:$E,primary:9,secondary:[1033],handler:a=>a.get(Ge).cancel(2)});yt.registerCommandAndKeybindingRule({id:"workbench.action.acceptSelectedQuickOpenItem",weight:200,when:$E,primary:0,handler:a=>a.get(Ge).accept()});yt.registerCommandAndKeybindingRule({id:"workbench.action.alternativeAcceptSelectedQuickOpenItem",weight:200,when:$E,primary:0,handler:a=>a.get(Ge).accept({ctrlCmd:!0,alt:!1})});yt.registerCommandAndKeybindingRule({id:"workbench.action.focusQuickOpen",weight:200,when:$E,primary:0,handler:a=>{a.get(Ge).focus()}});var kio="workbench.action.quickOpenNavigateNextInFilePicker";yt.registerCommandAndKeybindingRule({id:kio,weight:250,handler:Y_(kio,!0),when:ofi,primary:W5.primary,secondary:W5.secondary,mac:W5.mac});var Eio="workbench.action.quickOpenNavigatePreviousInFilePicker";yt.registerCommandAndKeybindingRule({id:Eio,weight:250,handler:Y_(Eio,!1),when:ofi,primary:W5.primary|1024,secondary:[W5.secondary[0]|1024],mac:{primary:W5.mac.primary|1024,secondary:void 0}});yt.registerCommandAndKeybindingRule({id:"workbench.action.quickPickManyToggle",weight:200,when:$E,primary:0,handler:a=>{a.get(Ge).toggle()}});yt.registerCommandAndKeybindingRule({id:"workbench.action.quickInputBack",weight:250,when:$E,primary:0,win:{primary:527},mac:{primary:344},linux:{primary:2648},handler:a=>{a.get(Ge).back()}});W(class extends K{constructor(){super({id:"workbench.action.quickOpen",title:L(3428,"Go to File..."),metadata:{description:"Quick access",args:[{name:"prefix",schema:{type:"string"}}]},keybinding:{weight:200,primary:W5.primary,secondary:W5.secondary,mac:W5.mac},f1:!0})}run(i,e){i.get(Ge).quickAccess.show(typeof e=="string"?e:void 0,{preserveValue:typeof e=="string"})}});W(class extends K{constructor(){super({id:"workbench.action.quickOpenWithModes",title:d(3429,null),icon:M.search,menu:{id:D.CommandCenterCenter,order:100}})}run(i){let e=i.get(Ge),t={includeHelp:!0,from:"commandCenter"};e.quickAccess.show(void 0,{preserveValue:!0,providerOptions:t})}});qe.registerCommand("workbench.action.quickOpenPreviousEditor",async a=>{a.get(Ge).quickAccess.show("",{itemActivation:2})});var r_e=class extends K{constructor(e,t,o,n,r){super({id:e,title:t,f1:!0,keybinding:r});this.id=e;this.next=o;this.quickNavigate=n}async run(e){let t=e.get(_e),o=e.get(Ge),n=t.lookupKeybindings(this.id),r=this.quickNavigate?{keybindings:n}:void 0;o.navigate(this.next,r)}},pfi=class extends r_e{constructor(){super("workbench.action.quickOpenNavigateNext",L(3426,"Navigate Next in Quick Open"),!0,!0)}},mfi=class extends r_e{constructor(){super("workbench.action.quickOpenNavigatePrevious",L(3427,"Navigate Previous in Quick Open"),!1,!0)}},hfi=class extends r_e{constructor(){super("workbench.action.quickOpenSelectNext",L(3430,"Select Next in Quick Open"),!0,!1,{weight:250,when:$E,primary:0,mac:{primary:300}})}},gfi=class extends r_e{constructor(){super("workbench.action.quickOpenSelectPrevious",L(3431,"Select Previous in Quick Open"),!1,!1,{weight:250,when:$E,primary:0,mac:{primary:302}})}};W(hfi);W(gfi);W(pfi);W(mfi);var Dio=[{key:"commandPalette",id:D.CommandPalette,description:d(16527,null),supportsSubmenus:!1},{key:"touchBar",id:D.TouchBarContext,description:d(16565,null),supportsSubmenus:!1},{key:"editor/title",id:D.EditorTitle,description:d(16538,null)},{key:"editor/title/run",id:D.EditorTitleRun,description:d(16540,null)},{key:"editor/context",id:D.EditorContext,description:d(16534,null)},{key:"editor/context/copy",id:D.EditorContextCopy,description:d(16535,null)},{key:"editor/context/share",id:D.EditorContextShare,description:d(16536,null),proposed:"contribShareMenu"},{key:"explorer/context",id:D.ExplorerContext,description:d(16541,null)},{key:"explorer/context/share",id:D.ExplorerContextShare,description:d(16542,null),proposed:"contribShareMenu"},{key:"editor/title/context",id:D.EditorTitleContext,description:d(16537,null)},{key:"editor/title/context/share",id:D.EditorTitleContextShare,description:d(16539,null),proposed:"contribShareMenu"},{key:"debug/callstack/context",id:D.DebugCallStackContext,description:d(16528,null)},{key:"debug/variables/context",id:D.DebugVariablesContext,description:d(16531,null)},{key:"debug/watch/context",id:D.DebugWatchContext,description:d(16532,null)},{key:"debug/toolBar",id:D.DebugToolBar,description:d(16530,null)},{key:"debug/createConfiguration",id:D.DebugCreateConfiguration,proposed:"contribDebugCreateConfiguration",description:d(16529,null)},{key:"notebook/variables/context",id:D.NotebookVariablesContext,description:d(16551,null)},{key:"menuBar/home",id:D.MenubarHomeMenu,description:d(16546,null),proposed:"contribMenuBarHome",supportsSubmenus:!1},{key:"menuBar/edit/copy",id:D.MenubarCopy,description:d(16552,null)},{key:"scm/title",id:D.SCMTitle,description:d(16560,null)},{key:"scm/sourceControl",id:D.SCMSourceControl,description:d(16557,null)},{key:"scm/repositories/title",id:D.SCMSourceControlTitle,description:d(16559,null),proposed:"contribSourceControlTitleMenu"},{key:"scm/repository",id:D.SCMSourceControlInline,description:d(16558,null)},{key:"scm/resourceState/context",id:D.SCMResourceContext,description:d(16555,null)},{key:"scm/resourceFolder/context",id:D.SCMResourceFolderContext,description:d(16553,null)},{key:"scm/resourceGroup/context",id:D.SCMResourceGroupContext,description:d(16554,null)},{key:"scm/change/title",id:D.SCMChangeContext,description:d(16517,null)},{key:"scm/inputBox",id:D.SCMInputBox,description:d(16547,null),proposed:"contribSourceControlInputBoxMenu"},{key:"scm/history/title",id:D.SCMHistoryTitle,description:d(16556,null),proposed:"contribSourceControlHistoryTitleMenu"},{key:"scm/historyItem/context",id:D.SCMHistoryItemContext,description:d(16544,null),proposed:"contribSourceControlHistoryItemMenu"},{key:"scm/historyItemRef/context",id:D.SCMHistoryItemRefContext,description:d(16545,null),proposed:"contribSourceControlHistoryItemMenu"},{key:"scm/artifactGroup/context",id:D.SCMArtifactGroupContext,description:d(16516,null),proposed:"contribSourceControlArtifactGroupMenu"},{key:"scm/artifact/context",id:D.SCMArtifactContext,description:d(16515,null),proposed:"contribSourceControlArtifactMenu"},{key:"statusBar/remoteIndicator",id:D.StatusBarRemoteIndicatorMenu,description:d(16562,null),supportsSubmenus:!1},{key:"terminal/context",id:D.TerminalInstanceContext,description:d(16563,null)},{key:"terminal/title/context",id:D.TerminalTabContext,description:d(16564,null)},{key:"view/title",id:D.ViewTitle,description:d(16603,null)},{key:"viewContainer/title",id:D.ViewContainerTitle,description:d(16596,null),proposed:"contribViewContainerTitle"},{key:"view/item/context",id:D.ViewItemContext,description:d(16597,null)},{key:"comments/comment/editorActions",id:D.CommentEditorActions,description:d(16501,null),proposed:"contribCommentEditorActionsMenu"},{key:"comments/commentThread/title",id:D.CommentThreadTitle,description:d(16502,null)},{key:"comments/commentThread/context",id:D.CommentThreadActions,description:d(16500,null),supportsSubmenus:!1},{key:"comments/commentThread/additionalActions",id:D.CommentThreadAdditionalActions,description:d(16500,null),supportsSubmenus:!0,proposed:"contribCommentThreadAdditionalMenu"},{key:"comments/commentThread/title/context",id:D.CommentThreadTitleContext,description:d(16503,null),proposed:"contribCommentPeekContext"},{key:"comments/comment/title",id:D.CommentTitle,description:d(16498,null)},{key:"comments/comment/context",id:D.CommentActions,description:d(16496,null),supportsSubmenus:!1},{key:"comments/commentThread/comment/context",id:D.CommentThreadCommentContext,description:d(16497,null),proposed:"contribCommentPeekContext"},{key:"commentsView/commentThread/context",id:D.CommentsViewThreadActions,description:d(16499,null),proposed:"contribCommentsViewThreadMenus"},{key:"notebook/toolbar",id:D.NotebookToolbar,description:d(16574,null)},{key:"notebook/kernelSource",id:D.NotebookKernelSource,description:d(16573,null),proposed:"notebookKernelSource"},{key:"notebook/cell/title",id:D.NotebookCellTitle,description:d(16572,null)},{key:"notebook/cell/execute",id:D.NotebookCellExecute,description:d(16571,null)},{key:"interactive/toolbar",id:D.InteractiveToolbar,description:d(16511,null)},{key:"interactive/cell/title",id:D.InteractiveCellTitle,description:d(16510,null)},{key:"issue/reporter",id:D.IssueReporter,description:d(16512,null)},{key:"testing/item/context",id:D.TestItem,description:d(16589,null)},{key:"testing/item/gutter",id:D.TestItemGutter,description:d(16590,null)},{key:"testing/profiles/context",id:D.TestProfilesContext,description:d(16594,null)},{key:"testing/item/result",id:D.TestPeekElement,description:d(16591,null)},{key:"testing/message/context",id:D.TestMessageContext,description:d(16593,null)},{key:"testing/message/content",id:D.TestMessageContent,description:d(16592,null)},{key:"extension/context",id:D.ExtensionContext,description:d(16543,null)},{key:"timeline/title",id:D.TimelineTitle,description:d(16599,null)},{key:"timeline/item/context",id:D.TimelineItemContext,description:d(16598,null)},{key:"ports/item/context",id:D.TunnelContext,description:d(16600,null)},{key:"ports/item/origin/inline",id:D.TunnelOriginInline,description:d(16601,null)},{key:"ports/item/port/inline",id:D.TunnelPortInline,description:d(16602,null)},{key:"file/newFile",id:D.NewFile,description:d(16508,null),supportsSubmenus:!1},{key:"webview/context",id:D.WebviewContext,description:d(16626,null)},{key:"file/share",id:D.MenubarShare,description:d(16561,null),proposed:"contribShareMenu"},{key:"editor/inlineCompletions/actions",id:D.InlineCompletionsActions,description:d(16509,null),supportsSubmenus:!1,proposed:"inlineCompletionsAdditions"},{key:"editor/content",id:D.EditorContent,description:d(16566,null),proposed:"contribEditorContentMenu"},{key:"editor/lineNumber/context",id:D.EditorLineNumberContext,description:d(16507,null)},{key:"mergeEditor/result/title",id:D.MergeInputResultToolbar,description:d(16548,null),proposed:"contribMergeEditorMenus"},{key:"multiDiffEditor/content",id:D.MultiDiffEditorContent,description:d(16549,null),proposed:"contribEditorContentMenu"},{key:"multiDiffEditor/resource/title",id:D.MultiDiffEditorFileToolbar,description:d(16550,null),proposed:"contribMultiDiffEditorMenus"},{key:"diffEditor/gutter/hunk",id:D.DiffEditorHunkToolbar,description:d(16533,null),proposed:"contribDiffEditorGutterToolBarMenus"},{key:"diffEditor/gutter/selection",id:D.DiffEditorSelectionToolbar,description:d(16533,null),proposed:"contribDiffEditorGutterToolBarMenus"},{key:"searchPanel/aiResults/commands",id:D.SearchActionMenu,description:d(16584,null)},{key:"editor/context/chat",id:D.ChatTextEditorMenu,description:d(16526,null),supportsSubmenus:!1,proposed:"chatParticipantPrivate"},{key:"chat/input/editing/sessionToolbar",id:D.ChatEditingSessionChangesToolbar,description:d(16520,null),proposed:"chatSessionsProvider"},{key:"chat/input/editing/sessionApplyActions",id:D.ChatEditingSessionApplySubmenu,description:d(16519,null),proposed:"chatSessionsProvider"},{key:"chat/chatSessions",id:D.AgentSessionsContext,description:d(16524,null),supportsSubmenus:!1,proposed:"chatSessionsProvider"},{key:"chatSessions/newSession",id:D.AgentSessionsCreateSubMenu,description:d(16525,null),supportsSubmenus:!1,proposed:"chatSessionsProvider"},{key:"chat/multiDiff/context",id:D.ChatMultiDiffContext,description:d(16522,null),supportsSubmenus:!1,proposed:"chatSessionsProvider"},{key:"chat/editor/inlineGutter",id:D.ChatEditorInlineMenu,description:d(16521,null),supportsSubmenus:!1,proposed:"contribChatEditorInlineGutterMenu"},{key:"chat/contextUsage/actions",id:D.ChatContextUsageActions,description:d(16518,null),proposed:"chatParticipantAdditions"},{key:"chat/newSession",id:D.ChatNewMenu,description:d(16523,null),proposed:"chatSessionsProvider"}],rJ;(v=>{function a(b){return typeof b.command=="string"}v.isMenuItem=a;function i(b,S){return typeof b.command!="string"?(S.error(d(16581,null,"command")),!1):b.alt&&typeof b.alt!="string"?(S.error(d(16576,null,"alt")),!1):b.when&&typeof b.when!="string"?(S.error(d(16576,null,"when")),!1):b.group&&typeof b.group!="string"?(S.error(d(16576,null,"group")),!1):!0}v.isValidMenuItem=i;function e(b,S){return typeof b.submenu!="string"?(S.error(d(16581,null,"submenu")),!1):b.when&&typeof b.when!="string"?(S.error(d(16576,null,"when")),!1):b.group&&typeof b.group!="string"?(S.error(d(16576,null,"group")),!1):!0}v.isValidSubmenuItem=e;function t(b,S){if(!Array.isArray(b))return S.error(d(16580,null)),!1;for(let y of b)if(a(y)){if(!i(y,S))return!1}else if(!e(y,S))return!1;return!0}v.isValidItems=t;function o(b,S){return typeof b!="object"?(S.error(d(16579,null)),!1):typeof b.id!="string"?(S.error(d(16581,null,"id")),!1):typeof b.label!="string"?(S.error(d(16581,null,"label")),!1):!0}v.isValidSubmenu=o;let n={type:"object",required:["command"],properties:{command:{description:d(16615,null),type:"string"},alt:{description:d(16614,null),type:"string"},when:{description:d(16618,null),type:"string"},group:{description:d(16616,null),type:"string"}}},r={type:"object",required:["submenu"],properties:{submenu:{description:d(16617,null),type:"string"},when:{description:d(16618,null),type:"string"},group:{description:d(16616,null),type:"string"}}},s={type:"object",required:["id","label"],properties:{id:{description:d(16623,null),type:"string"},label:{description:d(16624,null),type:"string"},icon:{description:d(16620,null),anyOf:[{type:"string"},{type:"object",properties:{light:{description:d(16622,null),type:"string"},dark:{description:d(16621,null),type:"string"}}}]}}};v.menusContribution={description:d(16619,null),type:"object",properties:a6(Dio,b=>b.key,b=>({markdownDescription:b.proposed?d(16577,null,b.proposed,b.description):b.description,type:"array",items:b.supportsSubmenus===!1?n:{oneOf:[n,r]}})),additionalProperties:{description:"Submenu",type:"array",items:{oneOf:[n,r]}}},v.submenusContribution={description:d(16625,null),type:"array",items:s};function u(b,S){return b?Jl(b.command)?(S.error(d(16581,null,"command")),!1):!h(b.title,S,"title")||b.shortTitle&&!h(b.shortTitle,S,"shortTitle")?!1:b.enablement&&typeof b.enablement!="string"?(S.error(d(16576,null,"precondition")),!1):!(b.category&&!h(b.category,S,"category")||!p(b.icon,S)):(S.error(d(16570,null)),!1)}v.isValidCommand=u;function p(b,S){return typeof b>"u"||typeof b=="string"||typeof b.dark=="string"&&typeof b.light=="string"?!0:(S.error(d(16575,null)),!1)}function h(b,S,y){return typeof b>"u"?(S.error(d(16582,null,y)),!1):typeof b=="string"&&Jl(b)?(S.error(d(16581,null,y)),!1):typeof b!="string"&&(Jl(b.original)||Jl(b.value))?(S.error(d(16583,null,`${y}.value`,`${y}.original`)),!1):!0}let g={type:"object",required:["command","title"],properties:{command:{description:d(16607,null),type:"string"},title:{description:d(16613,null),type:"string"},shortTitle:{markdownDescription:d(16612,null),type:"string"},category:{description:d(16606,null),type:"string"},enablement:{description:d(16611,null),type:"string"},icon:{description:d(16608,null),anyOf:[{type:"string"},{type:"object",properties:{light:{description:d(16610,null),type:"string"},dark:{description:d(16609,null),type:"string"}}}]}}};v.commandsContribution={description:d(16605,null),oneOf:[g,{type:"array",items:g}]}})(rJ||={});var Tio=new P,vfi=Tn.registerExtensionPoint({extensionPoint:"commands",jsonSchema:rJ.commandsContribution,activationEventsGenerator:function*(a){for(let i of a)i.command&&(yield`onCommand:${i.command}`)}});vfi.setHandler(a=>{function i(e,t){if(!rJ.isValidCommand(e,t.collector))return;let{icon:o,enablement:n,category:r,title:s,shortTitle:l,command:c}=e,u;o&&(typeof o=="string"?u=q.fromString(o)??{dark:je(t.description.extensionLocation,o),light:je(t.description.extensionLocation,o)}:u={dark:je(t.description.extensionLocation,o.dark),light:je(t.description.extensionLocation,o.light)});let p=fe.getCommand(c);p&&(p.source?t.collector.info(d(16505,null,e.command,p.source.title,p.source.id)):t.collector.info(d(16504,null,e.command))),Tio.add(fe.addCommand({id:c,title:s,source:{id:t.description.identifier.value,title:t.description.displayName??t.description.name},shortTitle:l,tooltip:s,category:r,precondition:x.deserialize(n),icon:u}))}Tio.clear();for(let e of a){let{value:t}=e;if(Array.isArray(t))for(let o of t)i(o,e);else i(t,e)}});var p7e=new Map,Lio=Tn.registerExtensionPoint({extensionPoint:"submenus",jsonSchema:rJ.submenusContribution});Lio.setHandler(a=>{p7e.clear();for(let i of a){let{value:e,collector:t}=i;for(let[,o]of Object.entries(e)){if(!rJ.isValidSubmenu(o,t))continue;if(!o.id){t.warn(d(16586,null,o.id));continue}if(p7e.has(o.id)){t.info(d(16585,null,o.id));continue}if(!o.label){t.warn(d(16587,null,o.label));continue}let n;o.icon&&(typeof o.icon=="string"?n=q.fromString(o.icon)||{dark:je(i.description.extensionLocation,o.icon)}:n={dark:je(i.description.extensionLocation,o.icon.dark),light:je(i.description.extensionLocation,o.icon.light)});let r={id:D.for(`api:${o.id}`),label:o.label,icon:n};p7e.set(o.id,r)}}});var YGo=new Map(Dio.map(a=>[a.key,a])),_io=new P,ffi=new Map,XGo=Tn.registerExtensionPoint({extensionPoint:"menus",jsonSchema:rJ.menusContribution,deps:[Lio]});XGo.setHandler(a=>{_io.clear(),ffi.clear();for(let i of a){let{value:e,collector:t}=i;for(let o of Object.entries(e)){if(!rJ.isValidItems(o[1],t))continue;let n=YGo.get(o[0]);if(!n){let r=p7e.get(o[0]);r&&(n={key:o[0],id:r.id,description:""})}if(n){if(n.proposed&&!Ea(i.description,n.proposed)){t.error(d(16578,null,o[0],n.proposed,i.description.identifier.value));continue}for(let r of o[1]){let s;if(rJ.isMenuItem(r)){let l=fe.getCommand(r.command),c=r.alt&&fe.getCommand(r.alt)||void 0;if(!l){t.error(d(16568,null,r.command));continue}r.alt&&!c&&t.warn(d(16567,null,r.alt)),r.command===r.alt&&t.info(d(16506,null)),s={command:l,alt:c,group:void 0,order:void 0,when:void 0}}else{if(n.supportsSubmenus===!1){t.error(d(16595,null));continue}let l=p7e.get(r.submenu);if(!l){t.error(d(16569,null,r.submenu));continue}let c=ffi.get(n.id.id);if(c||(c=new Set,ffi.set(n.id.id,c)),c.has(l.id.id)){t.warn(d(16588,null,r.submenu,o[0]));continue}c.add(l.id.id),s={submenu:l.id,icon:l.icon,title:l.label,group:void 0,order:void 0,when:void 0}}if(r.group){let l=r.group.lastIndexOf("@");l>0?(s.group=r.group.substr(0,l),s.order=Number(r.group.substr(l+1))||void 0):s.group=r.group}if(n.id===D.ViewContainerTitle&&!r.when?.includes("viewContainer == workbench.view.debug")){t.error(d(16604,null,"`viewContainer/title`","`viewContainer == workbench.view.debug`",'"when"'));continue}s.when=x.deserialize(r.when),_io.add(fe.appendMenuItem(n.id,s))}}}}});var u7e=class extends C{constructor(e){super();this._keybindingService=e;this.type="table"}shouldRender(e){return!!e.contributes?.commands}render(e){let o=(e.contributes?.commands||[]).map(p=>({id:p.command,title:p.title,keybindings:[],menus:[]})),n=a6(o,p=>p.id),r=e.contributes?.menus||{},s=a6(o,p=>p.id);if(r.commandPalette)for(let p of r.commandPalette)delete s[p.command];if(Object.keys(s).length){r.commandPalette||(r.commandPalette=[]);for(let p in s)r.commandPalette.push({command:p})}for(let p in r)for(let h of r[p])if(h.when!=="false"&&h.command){let g=n[h.command];g?g.menus.includes(p)||g.menus.push(p):(g={id:h.command,title:"",keybindings:[],menus:[p]},n[g.id]=g,o.push(g))}if((e.contributes?.keybindings?Array.isArray(e.contributes.keybindings)?e.contributes.keybindings:[e.contributes.keybindings]:[]).forEach(p=>{let h=this.resolveKeybinding(p);if(!h)return;let g=n[p.command];g?g.keybindings.push(h):(g={id:p.command,title:"",keybindings:[h],menus:[]},n[g.id]=g,o.push(g))}),!o.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let c=[d(16493,null),d(16494,null),d(16513,null),d(16514,null)],u=o.sort((p,h)=>p.id.localeCompare(h.id)).map(p=>[new xe().appendMarkdown(`\`${p.id}\``),typeof p.title=="string"?p.title:p.title.value,p.keybindings,new xe().appendMarkdown(`${p.menus.sort((h,g)=>h.localeCompare(g)).map(h=>`\`${h}\``).join(" ")}`)]);return{data:{headers:c,rows:u},dispose:()=>{}}}resolveKeybinding(e){let t;switch(ZA){case"win32":t=e.win;break;case"linux":t=e.linux;break;case"darwin":t=e.mac;break}return this._keybindingService.resolveUserBinding(t??e.key)[0]}};u7e=I([m(0,_e)],u7e);oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:"commands",label:d(16495,null),access:{canToggle:!1},renderer:new Mt(u7e)});var sue=".vscode",m7e="settings",uPt=`${sue}/${m7e}.json`,Rio="vscode://schemas/settings/default",Mio="vscode://schemas/settings/user",Pio="vscode://schemas/settings/profile",Aio="vscode://schemas/settings/machine",pPt="vscode://schemas/settings/workspace",Nio="vscode://schemas/settings/folder",VV="vscode://schemas/launch",aue="vscode://schemas/tasks",s_e="vscode://schemas/mcp",AC=[1,3],JGo=[2,4,5,6,7],Oio=[4,5,6],bfi=[1,...Oio],Sfi=[2,3,4,5,6,7],a_e=[4,5,6,7],sJ=[5,6,7],qE="tasks",rK="launch",Dv="mcp",X_=Object.create(null);X_[qE]=`${sue}/${qE}.json`;X_[rK]=`${sue}/${rK}.json`;X_[Dv]=`${sue}/${Dv}.json`;var mPt=Object.create(null);mPt[qE]=`${qE}.json`;mPt[Dv]=`${Dv}.json`;var Lv=B,Fio=`{
"version": "2.0.0",
"tasks": []
}`,IR="workbench.settings.applyToAllProfiles";var ZGo=oe.as(ea.JSONContribution),hPt=oe.as(ii.Configuration),Wio={type:"object",defaultSnippets:[{body:{title:"",properties:{}}}],properties:{title:{description:d(3179,null),type:"string"},order:{description:d(3175,null),type:"integer"},properties:{description:d(3176,null),type:"object",propertyNames:{pattern:"\\S+",patternErrorMessage:d(3178,null)},additionalProperties:{anyOf:[{title:d(3177,null),$ref:"http://json-schema.org/draft-07/schema#"},{type:"object",properties:{scope:{type:"string",enum:["application","machine","window","resource","language-overridable","machine-overridable"],default:"window",enumDescriptions:[d(3147,null),d(3157,null),d(3166,null),d(3163,null),d(3155,null),d(3156,null)],markdownDescription:d(3149,null)},enumDescriptions:{type:"array",items:{type:"string"},description:d(3151,null)},markdownEnumDescriptions:{type:"array",items:{type:"string"},description:d(3160,null)},enumItemLabels:{type:"array",items:{type:"string"},markdownDescription:d(3152,null,"`enum`")},markdownDescription:{type:"string",description:d(3159,null)},deprecationMessage:{type:"string",description:d(3148,null)},markdownDeprecationMessage:{type:"string",description:d(3158,null)},editPresentation:{type:"string",enum:["singlelineText","multilineText"],enumDescriptions:[d(3164,null),d(3161,null)],default:"singlelineText",description:d(3150,null)},order:{type:"integer",description:d(3162,null)},ignoreSync:{type:"boolean",description:d(3153,null)},keywords:{type:"array",items:{type:"string"},description:d(3154,null)},tags:{type:"array",items:{type:"string",enum:["accessibility","advanced","experimental","telemetry","usesOnlineServices"],enumDescriptions:[d(3132,null),d(3133,null),d(3140,null),d(3146,null),d(3171,null),d(3173,null)]},additionalItems:!0,markdownDescription:d(3165,null)}}}]}}}},HP,Vio=Tn.registerExtensionPoint({extensionPoint:"configurationDefaults",jsonSchema:{$ref:Gmt},canHandleResolver:!0});Vio.setHandler((a,{added:i,removed:e})=>{HP&&hPt.deltaConfiguration(HP);let t=HP={};if(queueMicrotask(()=>{HP===t&&(hPt.deltaConfiguration(HP),HP=void 0)}),e.length){let o=e.map(n=>({overrides:Xi(n.value),source:{id:n.description.identifier.value,displayName:n.description.displayName}}));HP.removedDefaults=o}if(i.length){let o=hPt.getConfigurationProperties(),n=[7,4,5,6],r=i.map(s=>{let l=Xi(s.value);for(let c of Object.keys(l)){let u=o[c];if(u?.disallowConfigurationDefault){s.collector.warn(d(3136,null,c)),delete l[c];continue}if(!lg.test(c)&&u?.scope&&!n.includes(u.scope)){s.collector.warn(d(3134,null,c)),delete l[c];continue}}return{overrides:l,source:{id:s.description.identifier.value,displayName:s.description.displayName}}});HP.addedDefaults=r}});var e$o=Tn.registerExtensionPoint({extensionPoint:"configuration",deps:[Vio],jsonSchema:{description:d(3174,null),oneOf:[Wio,{type:"array",items:Wio}]},canHandleResolver:!0}),Ifi=new Fd;e$o.setHandler((a,{added:i,removed:e})=>{if(HP??={},e.length){let r=[];for(let s of e)r.push(...Ifi.get(s.description.identifier)||[]),Ifi.delete(s.description.identifier);HP.removedConfigurations=r}let t=new Set;function o(r,s){let l=Xi(r);return l.title&&typeof l.title!="string"&&s.collector.error(d(3144,null)),n(l,s),l.id=r.id||s.description.identifier.value,l.extensionInfo={id:s.description.identifier.value,displayName:s.description.displayName},l.restrictedProperties=s.description.capabilities?.untrustedWorkspaces?.supported==="limited"?s.description.capabilities?.untrustedWorkspaces.restrictedConfigurations:void 0,l.title=l.title||s.description.displayName||s.description.identifier.value,l}function n(r,s){let l=r.properties,c=to.extensionConfigurationPolicy;if(l){typeof l!="object"&&(s.collector.error(d(3142,null)),r.properties={});for(let p in l){let h=l[p],g=OYt(p,h,s.description.identifier.value);if(g){delete l[p],s.collector.warn(g);continue}if(t.has(p)&&!FYt.has(s.description.identifier.value.toLowerCase())){delete l[p],s.collector.warn(d(3135,null,p));continue}if(!yi(h)){delete l[p],s.collector.error(d(3143,null,p));continue}c?.[p]&&(h.policy=c?.[p]),h.tags?.some(f=>f.toLowerCase()==="onexp")&&(h.experiment={mode:"startup"}),t.add(p),h.scope=h.scope?qmt(h.scope.toString()):4}}let u=r.allOf;if(u){s.collector.error(d(3141,null));for(let p of u)n(p,s)}}if(i.length){let r=[];for(let s of i){let l=[],c=s.value;Array.isArray(c)?c.forEach(u=>l.push(o(u,s))):l.push(o(c,s)),Ifi.set(s.description.identifier,l),r.push(...l)}HP.addedConfigurations=r}hPt.deltaConfiguration(HP),HP=void 0});ZGo.registerSchema("vscode://schemas/workspaceConfig",{allowComments:!0,allowTrailingCommas:!0,default:{folders:[{path:""}],settings:{}},required:["folders"],properties:{folders:{minItems:0,uniqueItems:!0,description:d(3181,null),items:{type:"object",defaultSnippets:[{body:{path:"$1"}}],oneOf:[{properties:{path:{type:"string",description:d(3185,null)},name:{type:"string",description:d(3184,null)}},required:["path"]},{properties:{uri:{type:"string",description:d(3190,null)},name:{type:"string",description:d(3184,null)}},required:["uri"]}]}},settings:{type:"object",default:{},description:d(3187,null),$ref:pPt},launch:{type:"object",default:{configurations:[],compounds:[]},description:d(3182,null),$ref:VV},tasks:{type:"object",default:{version:"2.0.0",tasks:[]},description:d(3188,null),$ref:aue},mcp:{type:"object",default:{inputs:[],servers:{"mcp-server-time":{command:"uvx",args:["mcp_server_time","--local-timezone=America/Los_Angeles"]}}},description:d(3183,null),$ref:s_e},extensions:{type:"object",default:{},description:d(3180,null),$ref:"vscode://schemas/extensions"},remoteAuthority:{type:"string",doNotSuggest:!0,description:d(3186,null)},transient:{type:"boolean",doNotSuggest:!0,description:d(3189,null)}},errorMessage:d(3172,null)});var yfi=class extends C{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.configuration}render(e){let t=e.contributes?.configuration?Array.isArray(e.contributes.configuration)?e.contributes.configuration:[e.contributes.configuration]:[],o=$mt(t),n=o?Object.keys(o):[],r=[d(3168,null),d(3139,null),d(3137,null)],s=n.sort((l,c)=>l.localeCompare(c)).map(l=>[new xe().appendMarkdown(`\`${l}\``),o[l].markdownDescription?new xe(o[l].markdownDescription,!1):o[l].description??"",new xe().appendCodeblock("json",JSON.stringify(cn(o[l].default)?r$e(o[l].type):o[l].default,null,2))]);return{data:{headers:r,rows:s},dispose:()=>{}}}};oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:"configuration",label:d(3169,null),access:{canToggle:!1},renderer:new Mt(yfi)});var wfi=class extends C{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.configurationDefaults}render(e){let t=e.contributes?.configurationDefaults??{},o=[d(3145,null),d(3167,null),d(3138,null)],n=[];for(let r of Object.keys(t).sort((s,l)=>s.localeCompare(l))){let s=t[r];if(lg.test(r)){let l=yU(r),c=new xe().appendMarkdown(`${l.join(", ")}`);for(let u of Object.keys(s).sort((p,h)=>p.localeCompare(h))){let p=[];p.push(c),p.push(new xe().appendMarkdown(`\`${u}\``)),p.push(new xe().appendCodeblock("json",JSON.stringify(s[u],null,2))),n.push(p)}}else{let l=[];l.push(""),l.push(new xe().appendMarkdown(`\`${r}\``)),l.push(new xe().appendCodeblock("json",JSON.stringify(s,null,2))),n.push(l)}}return{data:{headers:o,rows:n},dispose:()=>{}}}};oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:"configurationDefaults",label:d(3170,null),access:{canToggle:!1},renderer:new Mt(wfi)});var l_e=class extends Wke{constructor(e,t,o,n,r,s,l,c){super(e,t,r,o);this.storageService=o;this.instantiationService=n;this.contextMenuService=s;this.extensionService=l;this.contextService=c}create(e){super.create(e),this.viewPaneContainer=this._register(this.createViewPaneContainer(e)),this._register(this.viewPaneContainer.onTitleAreaUpdate(()=>this.updateTitleArea())),this.viewPaneContainer.create(e)}setVisible(e){super.setVisible(e),this.viewPaneContainer?.setVisible(e)}layout(e){this.viewPaneContainer?.layout(e)}setBoundarySashes(e){this.viewPaneContainer?.setBoundarySashes(e)}getOptimalWidth(){return this.viewPaneContainer?.getOptimalWidth()??0}openView(e,t){return this.viewPaneContainer?.openView(e,t)}getViewPaneContainer(){return this.viewPaneContainer}getActionsContext(){return this.getViewPaneContainer()?.getActionsContext()}getContextMenuActions(){return this.viewPaneContainer?.menuActions?.getContextMenuActions()??[]}getMenuIds(){let e=[];return this.viewPaneContainer?.menuActions&&(e.push(this.viewPaneContainer.menuActions.menuId),this.viewPaneContainer.isViewMergedWithContainer()&&e.push(this.viewPaneContainer.panes[0].menuActions.menuId)),e}getActions(){let e=[];if(this.viewPaneContainer?.menuActions&&(e.push(...this.viewPaneContainer.menuActions.getPrimaryActions()),this.viewPaneContainer.isViewMergedWithContainer())){let t=this.viewPaneContainer.panes[0];t.shouldShowFilterInHeader()&&e.push(pRt),e.push(...t.menuActions.getPrimaryActions())}return e}getSecondaryActions(){if(!this.viewPaneContainer?.menuActions)return[];let e=this.viewPaneContainer.isViewMergedWithContainer()?this.viewPaneContainer.panes[0].menuActions.getSecondaryActions():[],t=this.viewPaneContainer.menuActions.getSecondaryActions(),o=t.findIndex(n=>n instanceof Cc&&n.item.submenu===T5);if(o!==-1){let n=t[o];n.actions.some(({enabled:r})=>r)?t.length===1&&e.length===0?t=n.actions.slice():o!==0&&(t=[n,...t.slice(0,o),...t.slice(o+1)]):t.splice(o,1)}return t.length&&e.length?[...t,new li,...e]:t.length?t:e}getActionViewItem(e,t){return this.viewPaneContainer?.getActionViewItem(e,t)}getTitle(){return this.viewPaneContainer?.getTitle()??""}focus(){super.focus(),this.viewPaneContainer?.focus()}};l_e=I([m(1,Te),m(2,le),m(3,F),m(4,De),m(5,ze),m(6,lt),m(7,Pe)],l_e);var gPt=class a extends D_t{constructor(e,t,o,n,r,s,l){super(e,t,o,n,r,s);this.iconUrl=l}static create(e,t,o,n,r,s,l){return new a(e,t,o,n,r,s,l)}},yR={Viewlets:"workbench.contributions.viewlets",Panels:"workbench.contributions.panels",Auxiliary:"workbench.contributions.auxiliary",ChatBar:"workbench.contributions.chatbar"},c_e=class extends L_t{registerPaneComposite(i){super.registerComposite(i)}deregisterPaneComposite(i){super.deregisterComposite(i)}getPaneComposite(i){return this.getComposite(i)}getPaneComposites(){return this.getComposites()}};oe.add(yR.Viewlets,new c_e);oe.add(yR.Panels,new c_e);oe.add(yR.Auxiliary,new c_e);oe.add(yR.ChatBar,new c_e);var fPt=class extends st{constructor(e,t){super("vs.tree.collapse",d(45,null),"collapse-all",t);this.viewer=e}async run(){this.viewer.collapseAll(),this.viewer.setSelection([]),this.viewer.setFocus([])}};function Cfi(a){return Array.isArray(a.items)}function Bio(a){let i=a;return!!i.picks&&i.additionalPicks instanceof Promise}var yh=class extends C{constructor(e,t){super();this.prefix=e;this.options=t}provide(e,t,o){let n=new P;e.canAcceptInBackground=!!this.options?.canAcceptInBackground,e.matchOnLabel=e.matchOnDescription=e.matchOnDetail=e.sortByLabel=!1;let r,s=n.add(new me),l=async()=>{r?.dispose(!0),e.busy=!1;let u=s.value=new P;r=u.add(new $e(t));let p=r.token,h=e.value.substring(this.prefix.length);this.options?.shouldSkipTrimPickFilter||(h=h.trim());let g=this._getPicks(h,u,p,o),f=(b,S)=>{let y,w;if(Cfi(b)?(y=b.items,w=b.active):y=b,y.length===0){if(S)return!1;(h.length>0||e.hideInput)&&this.options?.noResultsPick&&(HD(this.options.noResultsPick)?y=[this.options.noResultsPick(h)]:y=[this.options.noResultsPick])}return e.items=y,w&&(e.activeItems=[w]),!0},v=async b=>{let S=!1,y=!1;await Promise.all([(async()=>{typeof b.mergeDelay=="number"&&(await Pi(b.mergeDelay),p.isCancellationRequested)||y||(S=f(b.picks,!0))})(),(async()=>{e.busy=!0;try{let w=await b.additionalPicks;if(p.isCancellationRequested)return;let k,T;Cfi(b.picks)?(k=b.picks.items,T=b.picks.active):k=b.picks;let N,O;if(Cfi(w)?(N=w.items,O=w.active):N=w,N.length>0||!S){let V;if(!T&&!O){let U=e.activeItems[0];U&&k.indexOf(U)!==-1&&(V=U)}f({items:[...k,...N],active:T||O||V})}}finally{p.isCancellationRequested||(e.busy=!1),y=!0}})()])};if(g!==null)if(Bio(g))await v(g);else if(!(g instanceof Promise))f(g);else{e.busy=!0;try{let b=await g;if(p.isCancellationRequested)return;Bio(b)?await v(b):f(b)}finally{p.isCancellationRequested||(e.busy=!1)}}};n.add(e.onDidChangeValue(()=>l())),l(),n.add(e.onDidAccept(u=>{if(o?.handleAccept){u.inBackground||e.hide(),o.handleAccept?.(e.activeItems[0],u.inBackground);return}let[p]=e.selectedItems;typeof p?.accept=="function"&&(u.inBackground||e.hide(),p.accept(e.keyMods,u))}));let c=async(u,p)=>{if(typeof p.trigger!="function")return;let h=p.buttons?.indexOf(u)??-1;if(h>=0){let g=p.trigger(h,e.keyMods),f=typeof g=="number"?g:await g;if(t.isCancellationRequested)return;switch(f){case 0:break;case 1:e.hide();break;case 2:l();break;case 3:{let v=e.items.indexOf(p);if(v!==-1){let b=e.items.slice(),S=b.splice(v,1),y=e.activeItems.filter(k=>k!==S[0]),w=e.keepScrollPosition;e.keepScrollPosition=!0,e.items=b,y&&(e.activeItems=y),e.keepScrollPosition=w}break}}}};return n.add(e.onDidTriggerItemButton(({button:u,item:p})=>c(u,p))),n.add(e.onDidTriggerSeparatorButton(({button:u,separator:p})=>c(u,p))),n}};var d_e=new co(()=>{let a=Wu.Collator(void 0,{numeric:!0,sensitivity:"base"}).value;return{collator:a,collatorIsNumeric:a.resolvedOptions().numeric}}),u_e=new co(()=>({collator:Wu.Collator(void 0,{numeric:!0}).value})),xfi=new co(()=>({collator:Wu.Collator(void 0,{numeric:!0,sensitivity:"accent"}).value}));function jE(a,i,e=!1){let t=a||"",o=i||"",n=d_e.value.collator.compare(t,o);return d_e.value.collatorIsNumeric&&n===0&&t!==o?t<o?-1:1:n}function h7e(a,i){let e=u_e.value.collator;return a=a||"",i=i||"",V5(e,a,i)}function Uio(a,i){let e=u_e.value.collator;return a=a||"",i=i||"",Xio(a,i)||V5(e,a,i)}function zio(a,i){let e=u_e.value.collator;return a=a||"",i=i||"",Yio(a,i)||V5(e,a,i)}function Kio(a,i){return a=a||"",i=i||"",a===i?0:a<i?-1:1}function kfi(a,i){let[e,t]=Hio(a),[o,n]=Hio(i),r=d_e.value.collator.compare(t,n);if(r===0){if(d_e.value.collatorIsNumeric&&t!==n)return t<n?-1:1;if(r=d_e.value.collator.compare(e,o),d_e.value.collatorIsNumeric&&r===0&&e!==o)return e<o?-1:1}return r}function Gio(a,i){a=a||"",i=i||"";let e=aJ(a),t=aJ(i),o=u_e.value.collator,n=xfi.value.collator;return V5(n,e,t)||V5(o,a,i)}function $io(a,i){a=a||"",i=i||"";let e=aJ(a),t=aJ(i),o=u_e.value.collator,n=xfi.value.collator;return V5(n,e,t)||Xio(a,i)||V5(o,a,i)}function qio(a,i){a=a||"",i=i||"";let e=aJ(a),t=aJ(i),o=u_e.value.collator,n=xfi.value.collator;return V5(n,e,t)||Yio(a,i)||V5(o,a,i)}function jio(a,i){a=a||"",i=i||"";let e=aJ(a).toLowerCase(),t=aJ(i).toLowerCase();return e!==t?e<t?-1:1:a!==i?a<i?-1:1:0}var Qio=/^(.*?)(\.([^.]*))?$/;function Hio(a,i=!1){let e=a?Qio.exec(a):[],t=[e&&e[1]||"",e&&e[3]||""];return i&&(!t[0]&&t[1]||t[0]&&t[0].charAt(0)===".")&&(t=[t[0]+"."+t[1],""]),t}function aJ(a){let i=a?Qio.exec(a):[];return i&&i[1]&&i[1].charAt(0)!=="."&&i[3]||""}function V5(a,i,e){let t=a.compare(i,e);return t!==0?t:i.length!==e.length?i.length<e.length?-1:1:0}function vPt(a){let i=a.charAt(0);return i.toLocaleUpperCase()!==i}function bPt(a){let i=a.charAt(0);return i.toLocaleLowerCase()!==i}function Yio(a,i){return vPt(a)&&bPt(i)?-1:bPt(a)&&vPt(i)?1:0}function Xio(a,i){return bPt(a)&&vPt(i)?-1:vPt(a)&&bPt(i)?1:0}function t$o(a,i,e=!1){return e||(a=a&&a.toLowerCase(),i=i&&i.toLowerCase()),a===i?0:a<i?-1:1}function lJ(a,i,e=!1){let t=a.split(Rd),o=i.split(Rd),n=t.length-1,r=o.length-1,s,l;for(let c=0;;c++){if(s=n===c,l=r===c,s&&l)return jE(t[c],o[c],e);if(s)return-1;if(l)return 1;let u=t$o(t[c],o[c],e);if(u!==0)return u}}function p_e(a,i,e){let t=a.toLowerCase(),o=i.toLowerCase(),n=i$o(a,i,e);if(n)return n;let r=t.endsWith(e),s=o.endsWith(e);if(r!==s)return r?-1:1;let l=jE(t,o);return l!==0?l:t.localeCompare(o)}function i$o(a,i,e){let t=a.toLowerCase(),o=i.toLowerCase(),n=t.startsWith(e),r=o.startsWith(e);if(n!==r)return n?-1:1;if(n&&r){if(t.length<o.length)return-1;if(t.length>o.length)return 1}return 0}var IPt=0,Jio=[IPt,[]];function Zio(a,i,e,t){if(!a||!i)return Jio;let o=a.length,n=i.length;if(o<n)return Jio;let r=a.toLowerCase();return o$o(i,e,n,a,r,o,t)}function o$o(a,i,e,t,o,n,r){let s=[],l=[];for(let h=0;h<e;h++){let g=h*n,f=g-n,v=h>0,b=a[h],S=i[h];for(let y=0;y<n;y++){let w=y>0,k=g+y,T=k-1,N=f+y-1,O=w?s[T]:0,V=v&&w?s[N]:0,U=v&&w?l[N]:0,G;!V&&v?G=0:G=n$o(b,S,t,o,y,U),G&&V+G>=O&&(r||v||o.startsWith(i,y))?(l[k]=U+1,s[k]=V+G):(l[k]=IPt,s[k]=O)}}let c=[],u=e-1,p=n-1;for(;u>=0&&p>=0;){let h=u*n+p;l[h]===IPt||(c.push(p),u--),p--}return[s[e*n-1],c.reverse()]}function n$o(a,i,e,t,o,n){let r=0;if(!r$o(i,t[o]))return r;if(r+=1,n>0&&(r+=Math.min(n,3)*6+Math.max(0,n-3)*3),a===e[o]&&(r+=1),o===0)r+=8;else{let s=s$o(e.charCodeAt(o-1));s?r+=s:_ye(e.charCodeAt(o))&&n===0&&(r+=2)}return r}function r$o(a,i){return a===i?!0:a==="/"||a==="\\"?i==="/"||i==="\\":!1}function s$o(a){switch(a){case 47:case 92:return 5;case 95:case 45:case 46:case 32:case 39:case 34:case 58:return 4;default:return 0}}var noo=[void 0,[]];function dJ(a,i,e=0,t=0){let o=i;return o.values&&o.values.length>1?a$o(a,o.values,e,t):roo(a,i,e,t)}function a$o(a,i,e,t){let o=0,n=[];for(let r of i){let[s,l]=roo(a,r,e,t);if(typeof s!="number")return noo;o+=s,n.push(...l)}return[o,_fi(n)]}function roo(a,i,e,t){let o=wL(i.normalized,i.normalizedLowercase,e,a,a.toLowerCase(),t,{firstMatchCanBeWeak:!0,boostFullMatch:!0});return o?[o[0],ua(o)]:noo}var yPt=Object.freeze({score:0}),SPt=1<<18,Efi=1<<17,Tfi=65536;function l$o(a,i,e,t){let o=t.values?t.values:[t];return Ir({[t.normalized]:{values:o.map(r=>({value:r.normalized,expectContiguousMatch:r.expectContiguousMatch})),label:a,description:i,allowNonContiguousMatches:e}})}function cJ(a,i,e,t,o){if(!a||!i.normalized)return yPt;let n=t.getItemLabel(a);if(!n)return yPt;let r=t.getItemDescription(a),s=l$o(n,r,e,i),l=o[s];if(l)return l;let c=c$o(n,r,t.getItemPath(a),i,e);return o[s]=c,c}function c$o(a,i,e,t,o){let n=!e||!t.containsPathSeparator;return e&&(Wn?t.pathNormalized===e:mr(t.pathNormalized,e))?{score:SPt,labelMatch:[{start:0,end:a.length}],descriptionMatch:i?[{start:0,end:i.length}]:void 0}:t.values&&t.values.length>1?d$o(a,i,e,t.values,n,o):soo(a,i,e,t,n,o)}function d$o(a,i,e,t,o,n){let r=0,s=[],l=[];for(let c of t){let{score:u,labelMatch:p,descriptionMatch:h}=soo(a,i,e,c,o,n);if(u===IPt)return yPt;r+=u,p&&s.push(...p),h&&l.push(...h)}return{score:r,labelMatch:_fi(s),descriptionMatch:_fi(l)}}function soo(a,i,e,t,o,n){if(o||!i){let[r,s]=Zio(a,t.normalized,t.normalizedLowercase,n&&!t.expectContiguousMatch);if(r){let l=pae(t.normalized,a),c;if(l){c=Efi;let u=Math.round(t.normalized.length/a.length*100);c+=u}else c=Tfi;return{score:c+r,labelMatch:l||eoo(s)}}}if(i){let r=i;e&&(r=`${i}${Rd}`);let s=r.length,l=`${r}${a}`,[c,u]=Zio(l,t.normalized,t.normalizedLowercase,n&&!t.expectContiguousMatch);if(c){let p=eoo(u),h=[],g=[];return p.forEach(f=>{f.start<s&&f.end>s?(h.push({start:0,end:f.end-s}),g.push({start:f.start,end:s})):f.start>=s?h.push({start:f.start-s,end:f.end-s}):g.push(f)}),{score:c,labelMatch:h,descriptionMatch:g}}}return yPt}function eoo(a){let i=[];if(!a)return i;let e;for(let t of a)e&&e.end===t?e.end+=1:(e={start:t,end:t+1},i.push(e));return i}function _fi(a){let i=a.sort((o,n)=>o.start-n.start),e=[],t;for(let o of i)!t||!u$o(t,o)?(t=o,e.push(o)):(t.start=Math.min(t.start,o.start),t.end=Math.max(t.end,o.end));return e}function u$o(a,i){return!(a.end<i.start||i.end<a.start)}function g7e(a,i,e,t,o,n){let r=cJ(a,e,t,o,n),s=cJ(i,e,t,o,n),l=r.score,c=s.score;if((l===SPt||c===SPt)&&l!==c)return l===SPt?-1:1;if(l>Tfi||c>Tfi){if(l!==c)return l>c?-1:1;if(l<Efi&&c<Efi){let b=p$o(r.labelMatch,s.labelMatch);if(b!==0)return b}let f=o.getItemLabel(a)||"",v=o.getItemLabel(i)||"";if(f.length!==v.length)return f.length-v.length}if(l!==c)return l>c?-1:1;let u=Array.isArray(r.labelMatch)&&r.labelMatch.length>0,p=Array.isArray(s.labelMatch)&&s.labelMatch.length>0;if(u&&!p)return-1;if(p&&!u)return 1;let h=too(a,r,o),g=too(i,s,o);return h&&g&&h!==g?g>h?-1:1:m$o(a,i,e,o)}function too(a,i,e){let t=-1,o=-1;if(i.descriptionMatch?.length?t=i.descriptionMatch[0].start:i.labelMatch?.length&&(t=i.labelMatch[0].start),i.labelMatch?.length){if(o=i.labelMatch[i.labelMatch.length-1].end,i.descriptionMatch?.length){let n=e.getItemDescription(a);n&&(o+=n.length)}}else i.descriptionMatch?.length&&(o=i.descriptionMatch[i.descriptionMatch.length-1].end);return o-t}function p$o(a,i){if(!a&&!i||!a?.length&&!i?.length)return 0;if(!i?.length)return-1;if(!a?.length)return 1;let e=a[0].start,o=a[a.length-1].end-e,n=i[0].start,s=i[i.length-1].end-n;return o===s?0:s<o?1:-1}function m$o(a,i,e,t){let o=t.getItemLabel(a)||"",n=t.getItemLabel(i)||"",r=t.getItemDescription(a),s=t.getItemDescription(i),l=o.length+(r?r.length:0),c=n.length+(s?s.length:0);if(l!==c)return l-c;let u=t.getItemPath(a),p=t.getItemPath(i);return u&&p&&u.length!==p.length?u.length-p.length:o!==n?p_e(o,n,e.normalized):r&&s&&r!==s?p_e(r,s,e.normalized):u&&p&&u!==p?p_e(u,p,e.normalized):0}function ioo(a){return a.startsWith('"')&&a.endsWith('"')}var aoo=" ";function uF(a){typeof a!="string"&&(a="");let i=a.toLowerCase(),{pathNormalized:e,normalized:t,normalizedLowercase:o}=ooo(a),n=e.indexOf(Rd)>=0,r=ioo(a),s,l=a.split(aoo);if(l.length>1)for(let c of l){let u=ioo(c),{pathNormalized:p,normalized:h,normalizedLowercase:g}=ooo(c);h&&(s||(s=[]),s.push({original:c,originalLowercase:c.toLowerCase(),pathNormalized:p,normalized:h,normalizedLowercase:g,expectContiguousMatch:u}))}return{original:a,originalLowercase:i,pathNormalized:e,normalized:t,normalizedLowercase:o,values:s,containsPathSeparator:n,expectContiguousMatch:r}}function ooo(a){let i;ri?i=a.replace(/\//g,Rd):i=a.replace(/\\/g,Rd);let e=i.replace(/[\*\u2026\s"]/g,"").replace(/(?<=.)#$/,"");return{pathNormalized:i,normalized:e,normalizedLowercase:e.toLowerCase()}}function m_e(a){return Array.isArray(a)?uF(a.map(i=>i.original).join(aoo)):uF(a.original)}var lue=class extends yh{constructor(e,t,o,n,r){super(e,{canAcceptInBackground:!0,noResultsPick:{label:d(3976,null),groupId:-1}});this.editorGroupService=t;this.editorService=o;this.modelService=n;this.languageService=r;this.pickState=new class{constructor(){this.scorerCache=Object.create(null);this.isQuickNavigating=void 0}reset(e){e||(this.scorerCache=Object.create(null)),this.isQuickNavigating=e}}}provide(e,t){return this.pickState.reset(!!e.quickNavigate),super.provide(e,t)}_getPicks(e){let t=uF(e),o=this.doGetEditorPickItems().filter(r=>{if(!t.normalized)return!0;let s=cJ(r,t,!0,r7,this.pickState.scorerCache);return s.score?(r.highlights={label:s.labelMatch,description:s.descriptionMatch},!0):!1});if(t.normalized){let r=this.editorGroupService.getGroups(2).map(s=>s.id);o.sort((s,l)=>s.groupId!==l.groupId?r.indexOf(s.groupId)-r.indexOf(l.groupId):g7e(s,l,t,!0,r7,this.pickState.scorerCache))}let n=[];if(this.editorGroupService.count>1){let r;for(let s of o){if(typeof r!="number"||r!==s.groupId){let l=this.editorGroupService.getGroup(s.groupId);l&&n.push({type:"separator",label:l.label}),r=s.groupId}n.push(s)}}else n.push(...o);return n}doGetEditorPickItems(){let e=this.doGetEditors(),t=new Map;for(let{groupId:o}of e)if(!t.has(o)){let n=this.editorGroupService.getGroup(o);n&&t.set(o,n.ariaLabel)}return this.doGetEditors().map(({editor:o,groupId:n})=>{let r=no.getOriginalUri(o,{supportSideBySide:1}),s=o.isDirty()&&!o.isSaving(),l=o.getDescription(),c=l?`${o.getName()} ${l}`:o.getName();return{groupId:n,resource:r,label:o.getName(),ariaLabel:t.size>1?s?d(3975,null,c,t.get(n)):d(3974,null,c,t.get(n)):s?d(3973,null,c):c,description:l,iconClasses:js(this.modelService,this.languageService,r,void 0,o.getIcon()).concat(o.getLabelExtraClasses()),italic:!this.editorGroupService.getGroup(n)?.isPinned(o),buttons:[{iconClass:s?"dirty-editor "+q.asClassName(M.closeDirty):q.asClassName(M.close),tooltip:d(3972,null),alwaysVisible:s}],trigger:async()=>{let u=this.editorGroupService.getGroup(n);return u&&(await u.closeEditor(o,{preserveFocus:!0}),!u.contains(o))?3:0},accept:(u,p)=>this.editorGroupService.getGroup(n)?.openEditor(o,{preserveFocus:p.inBackground})}})}};lue=I([m(1,Et),m(2,ee),m(3,Ct),m(4,kt)],lue);var J_=class extends lue{static{this.PREFIX="edt active "}constructor(i,e,t,o){super(J_.PREFIX,i,e,t,o)}doGetEditors(){let i=this.editorGroupService.activeGroup;return i.getEditors(0).map(e=>({editor:e,groupId:i.id}))}};J_=I([m(0,Et),m(1,ee),m(2,Ct),m(3,kt)],J_);var BV=class extends lue{static{this.PREFIX="edt "}constructor(i,e,t,o){super(BV.PREFIX,i,e,t,o)}doGetEditors(){let i=[];for(let e of this.editorGroupService.getGroups(2))for(let t of e.getEditors(1))i.push({editor:t,groupId:e.id});return i}};BV=I([m(0,Et),m(1,ee),m(2,Ct),m(3,kt)],BV);var UP=class extends lue{static{this.PREFIX="edt mru "}constructor(i,e,t,o){super(UP.PREFIX,i,e,t,o)}doGetEditors(){let i=[];for(let e of this.editorService.getEditors(0))i.push(e);return i}};UP=I([m(0,Et),m(1,ee),m(2,Ct),m(3,kt)],UP);function h$o(a){let i=a;return typeof i?.primary=="object"&&typeof i.secondary=="object"}var of=class extends zO{constructor(e,t,o,n,r,s,l,c,u){super(of.ID,e,of.VIEW_STATE_PREFERENCE_KEY,t,o,r,l,n,c,u);this.configurationService=s;this.onDidCreateEditors=this._register(new E);this._onDidChangeSizeConstraints=this._register(new Mh);this.onDidChangeSizeConstraints=H.any(this.onDidCreateEditors.event,this._onDidChangeSizeConstraints.event);this._onDidChangeSelection=this._register(new E);this.onDidChangeSelection=this._onDidChangeSelection.event;this.primaryEditorPane=void 0;this.secondaryEditorPane=void 0;this.splitviewDisposables=this._register(new P);this.editorDisposables=this._register(new P);this.dimension=new ai(0,0);this.lastFocusedSide=void 0;this.orientation=this.configurationService.getValue(of.SIDE_BY_SIDE_LAYOUT_SETTING)==="vertical"?0:1,this.registerListeners()}static{this.ID=W7i}static{this.SIDE_BY_SIDE_LAYOUT_SETTING="workbench.editor.splitInGroupLayout"}static{this.VIEW_STATE_PREFERENCE_KEY="sideBySideEditorViewState"}get minimumPrimaryWidth(){return this.primaryEditorPane?this.primaryEditorPane.minimumWidth:0}get maximumPrimaryWidth(){return this.primaryEditorPane?this.primaryEditorPane.maximumWidth:Number.POSITIVE_INFINITY}get minimumPrimaryHeight(){return this.primaryEditorPane?this.primaryEditorPane.minimumHeight:0}get maximumPrimaryHeight(){return this.primaryEditorPane?this.primaryEditorPane.maximumHeight:Number.POSITIVE_INFINITY}get minimumSecondaryWidth(){return this.secondaryEditorPane?this.secondaryEditorPane.minimumWidth:0}get maximumSecondaryWidth(){return this.secondaryEditorPane?this.secondaryEditorPane.maximumWidth:Number.POSITIVE_INFINITY}get minimumSecondaryHeight(){return this.secondaryEditorPane?this.secondaryEditorPane.minimumHeight:0}get maximumSecondaryHeight(){return this.secondaryEditorPane?this.secondaryEditorPane.maximumHeight:Number.POSITIVE_INFINITY}set minimumWidth(e){}set maximumWidth(e){}set minimumHeight(e){}set maximumHeight(e){}get minimumWidth(){return this.minimumPrimaryWidth+this.minimumSecondaryWidth}get maximumWidth(){return this.maximumPrimaryWidth+this.maximumSecondaryWidth}get minimumHeight(){return this.minimumPrimaryHeight+this.minimumSecondaryHeight}get maximumHeight(){return this.maximumPrimaryHeight+this.maximumSecondaryHeight}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>this.onConfigurationUpdated(e)))}onConfigurationUpdated(e){e.affectsConfiguration(of.SIDE_BY_SIDE_LAYOUT_SETTING)&&(this.orientation=this.configurationService.getValue(of.SIDE_BY_SIDE_LAYOUT_SETTING)==="vertical"?0:1,this.splitview&&this.recreateSplitview())}recreateSplitview(){let e=Oi(this.getContainer()),t=this.getSplitViewRatio();this.splitview&&(this.splitview.el.remove(),this.splitviewDisposables.clear()),this.createSplitView(e,t),this.layout(this.dimension)}getSplitViewRatio(){let e;if(this.splitview){let t=this.splitview.getViewSize(0),o=this.splitview.getViewSize(1);if(Math.abs(t-o)>1){let n=this.splitview.orientation===1?this.dimension.width:this.dimension.height;e=t/n}}return e}createEditor(e){e.classList.add("side-by-side-editor"),this.secondaryEditorContainer=_(".side-by-side-editor-container.editor-instance"),this.primaryEditorContainer=_(".side-by-side-editor-container.editor-instance"),this.createSplitView(e)}createSplitView(e,t){this.splitview=this.splitviewDisposables.add(new vu(e,{orientation:this.orientation})),this.splitviewDisposables.add(this.splitview.onDidSashReset(()=>this.splitview?.distributeViewSizes())),this.orientation===1?this.splitview.orthogonalEndSash=this._boundarySashes?.bottom:(this.splitview.orthogonalStartSash=this._boundarySashes?.left,this.splitview.orthogonalEndSash=this._boundarySashes?.right);let o=Wl.Distribute,n=Wl.Distribute;if(t){let l=this.splitview.orientation===1?this.dimension.width:this.dimension.height;o=Math.round(l*t),n=l-o,this.splitview.layout(this.orientation===1?this.dimension.width:this.dimension.height)}let r=Oi(this.secondaryEditorContainer);this.splitview.addView({element:r,layout:l=>this.layoutPane(this.secondaryEditorPane,l),minimumSize:this.orientation===1?FE.width:FE.height,maximumSize:Number.POSITIVE_INFINITY,onDidChange:H.None},o);let s=Oi(this.primaryEditorContainer);this.splitview.addView({element:s,layout:l=>this.layoutPane(this.primaryEditorPane,l),minimumSize:this.orientation===1?FE.width:FE.height,maximumSize:Number.POSITIVE_INFINITY,onDidChange:H.None},n),this.updateStyles()}getTitle(){return this.input?this.input.getName():d(4044,null)}async setInput(e,t,o,n){let r=this.input;await super.setInput(e,t,o,n),(!r||!e.matches(r))&&(r&&this.disposeEditors(),this.createEditors(e));let{primary:s,secondary:l,viewState:c}=this.loadViewState(e,t,o);if(this.lastFocusedSide=c?.focus,typeof c?.ratio=="number"&&this.splitview){let u=this.splitview.orientation===1?this.dimension.width:this.dimension.height;this.splitview.resizeView(0,Math.round(u*c.ratio))}else this.splitview?.distributeViewSizes();await Promise.all([this.secondaryEditorPane?.setInput(e.secondary,l,o,n),this.primaryEditorPane?.setInput(e.primary,s,o,n)]),typeof t?.target=="number"&&(this.lastFocusedSide=t.target)}loadViewState(e,t,o){let n=h$o(t?.viewState)?t?.viewState:this.loadEditorViewState(e,o),r=Object.create(null),s;return t?.target===2?s={...t}:r={...t},r.viewState=n?.primary,n?.secondary&&(s?s.viewState=n?.secondary:s={viewState:n.secondary}),{primary:r,secondary:s,viewState:n}}createEditors(e){this.secondaryEditorPane=this.doCreateEditor(e.secondary,Oi(this.secondaryEditorContainer)),this.primaryEditorPane=this.doCreateEditor(e.primary,Oi(this.primaryEditorContainer)),this.layout(this.dimension),this._onDidChangeSizeConstraints.input=H.any(H.map(this.secondaryEditorPane.onDidChangeSizeConstraints,()=>{}),H.map(this.primaryEditorPane.onDidChangeSizeConstraints,()=>{})),this.onDidCreateEditors.fire(void 0),this.editorDisposables.add(this.primaryEditorPane.onDidFocus(()=>this.onDidFocusChange(1))),this.editorDisposables.add(this.secondaryEditorPane.onDidFocus(()=>this.onDidFocusChange(2)))}doCreateEditor(e,t){let o=oe.as(rn.EditorPane).getEditorPane(e);if(!o)throw new Error("No editor pane descriptor for editor found");let n=o.instantiate(this.instantiationService,this.group);return n.create(t),n.setVisible(this.isVisible()),pce(n)&&this.editorDisposables.add(n.onDidChangeSelection(r=>this._onDidChangeSelection.fire(r))),this.editorDisposables.add(n),n}onDidFocusChange(e){this.lastFocusedSide=e,this._onDidChangeControl.fire()}getSelection(){let e=this.getLastFocusedEditorPane();if(pce(e)){let t=e.getSelection();if(t)return new Dfi(t,e===this.primaryEditorPane?1:2)}}setOptions(e){super.setOptions(e),typeof e?.target=="number"&&(this.lastFocusedSide=e.target),this.getLastFocusedEditorPane()?.setOptions(e)}setEditorVisible(e){this.primaryEditorPane?.setVisible(e),this.secondaryEditorPane?.setVisible(e),super.setEditorVisible(e)}clearInput(){super.clearInput(),this.primaryEditorPane?.clearInput(),this.secondaryEditorPane?.clearInput(),this.disposeEditors()}focus(){super.focus(),this.getLastFocusedEditorPane()?.focus()}getLastFocusedEditorPane(){return this.lastFocusedSide===2?this.secondaryEditorPane:this.primaryEditorPane}layout(e){this.dimension=e,Oi(this.splitview).layout(this.orientation===1?e.width:e.height)}setBoundarySashes(e){this._boundarySashes=e,this.splitview&&(this.splitview.orthogonalEndSash=e.bottom)}layoutPane(e,t){e?.layout(this.orientation===1?new ai(t,this.dimension.height):new ai(this.dimension.width,t))}getControl(){return this.getLastFocusedEditorPane()?.getControl()}getPrimaryEditorPane(){return this.primaryEditorPane}getSecondaryEditorPane(){return this.secondaryEditorPane}tracksEditorViewState(e){return e instanceof ga}computeEditorViewState(e){if(!this.input||!Xe(e,this.toEditorViewStateResource(this.input)))return;let t=this.primaryEditorPane?.getViewState(),o=this.secondaryEditorPane?.getViewState();if(!(!t||!o))return{primary:t,secondary:o,focus:this.lastFocusedSide,ratio:this.getSplitViewRatio()}}toEditorViewStateResource(e){let t,o;if(e instanceof ga&&(t=e.primary.resource,o=e.secondary.resource),!(!o||!t))return A.from({scheme:"sideBySide",path:`${m6(o.toString())}${m6(t.toString())}`})}updateStyles(){super.updateStyles(),this.primaryEditorContainer&&(this.orientation===1?(this.primaryEditorContainer.style.borderLeftWidth="1px",this.primaryEditorContainer.style.borderLeftStyle="solid",this.primaryEditorContainer.style.borderLeftColor=this.getColor(j9i)??"",this.primaryEditorContainer.style.borderTopWidth="0"):(this.primaryEditorContainer.style.borderTopWidth="1px",this.primaryEditorContainer.style.borderTopStyle="solid",this.primaryEditorContainer.style.borderTopColor=this.getColor(q9i)??"",this.primaryEditorContainer.style.borderLeftWidth="0"))}dispose(){this.disposeEditors(),super.dispose()}disposeEditors(){this.editorDisposables.clear(),this.secondaryEditorPane=void 0,this.primaryEditorPane=void 0,this.lastFocusedSide=void 0,this.secondaryEditorContainer&&Rt(this.secondaryEditorContainer),this.primaryEditorContainer&&Rt(this.primaryEditorContainer)}};of=I([m(1,Te),m(2,F),m(3,De),m(4,le),m(5,B),m(6,Nn),m(7,ee),m(8,Et)],of);var Dfi=class a{constructor(i,e){this.selection=i;this.side=e}compare(i){return i instanceof a?this.side!==i.side?3:this.selection.compare(i.selection):3}restore(i){let e={...i,target:this.side};return this.selection.restore(e)}};function QE(a,i,e){let t=!1,o=g$o(a);if(Mj(o)&&(i.restoreViewState(o),t=!0),a.selection){let n={startLineNumber:a.selection.startLineNumber,startColumn:a.selection.startColumn,endLineNumber:a.selection.endLineNumber??a.selection.startLineNumber,endColumn:a.selection.endColumn??a.selection.startColumn};i.setSelection(n,a.selectionSource??"code.navigation"),a.selectionRevealType===2?i.revealRangeNearTop(n,e):a.selectionRevealType===3?i.revealRangeNearTopIfOutsideViewport(n,e):a.selectionRevealType===1?i.revealRangeInCenterIfOutsideViewport(n,e):i.revealRangeInCenter(n,e),t=!0}return t}function g$o(a){if(!a.selection||!a.viewState)return a.viewState;let i=a.viewState;if(i.modified)return i.modified.cursorState=[],i;let e=a.viewState;return e.cursorState&&(e.cursorState=[]),e}var Z_=class extends aR{constructor(e,t,o,n,r,s,l,c,u,p){super(Z_.ID,e,t,o,n,r,l,s,c,u);this.preferencesService=p;this.diffEditorControl=void 0;this.inputLifecycleStopWatch=void 0;this._previousViewModel=null}static{this.ID=SY}get scopedContextKeyService(){if(!this.diffEditorControl)return;let e=this.diffEditorControl.getOriginalEditor(),t=this.diffEditorControl.getModifiedEditor();return(e.hasTextFocus()?e:t).invokeWithinContext(o=>o.get(X))}getTitle(){return this.input?this.input.getName():d(4048,null)}createEditorControl(e,t){this.diffEditorControl=this._register(this.instantiationService.createInstance(Hu,e,t,{}))}updateEditorControlOptions(e){this.diffEditorControl?.updateOptions(e)}getMainControl(){return this.diffEditorControl?.getModifiedEditor()}async setInput(e,t,o,n){this._previousViewModel&&(this._previousViewModel.dispose(),this._previousViewModel=null),this.inputLifecycleStopWatch=void 0,await super.setInput(e,t,o,n);try{let r=await e.resolve();if(n.isCancellationRequested)return;if(!(r instanceof Jxe)){this.openAsBinary(e,t);return}let s=Oi(this.diffEditorControl),l=r,c=l.textDiffEditorModel?s.createViewModel(l.textDiffEditorModel):null;this._previousViewModel=c,await c?.waitForDiff(),s.setModel(c);let u=!1;Mj(t?.viewState)||(u=this.restoreTextDiffEditorViewState(e,t,o,s));let p=!1;t&&(p=QE(t,s,1)),!p&&!u&&s.revealFirstDiff(),s.updateOptions({...this.getReadonlyConfiguration(l.modifiedModel?.isReadonly()),originalEditable:!l.originalModel?.isReadonly()}),s.handleInitialized(),this.inputLifecycleStopWatch=new En(!1)}catch(r){await this.handleSetInputError(r,e,t)}}async handleSetInputError(e,t,o){if(this.isFileBinaryError(e))return this.openAsBinary(t,o);if(e.fileOperationResult===7){let n;throw e instanceof WN?n=d(4047,null,ll.formatSize(e.size)):n=d(4046,null),Uxe(this.group,t,o,n,this.preferencesService)}throw e}restoreTextDiffEditorViewState(e,t,o,n){let r=this.loadEditorViewState(e,o);return r?(t?.selection&&r.modified&&(r.modified.cursorState=[]),n.restoreViewState(r),t?.revealIfVisible&&n.revealFirstDiff(),!0):!1}openAsBinary(e,t){let o=e.original,n=e.modified,r=this.instantiationService.createInstance(Fa,e.getName(),e.getDescription(),o,n,!0),s=oe.as(rn.EditorFactory).getFileEditorFactory();s.isFileEditor(o)&&o.setForceOpenAsBinary(),s.isFileEditor(n)&&n.setForceOpenAsBinary(),this.group.replaceEditors([{editor:e,replacement:r,options:{...t,activation:3,pinned:this.group.isPinned(e),sticky:this.group.isSticky(e)}}])}setOptions(e){super.setOptions(e),e&&QE(e,Oi(this.diffEditorControl),0)}shouldHandleConfigurationChangeEvent(e,t){return super.shouldHandleConfigurationChangeEvent(e,t)?!0:e.affectsConfiguration(t,"diffEditor")||e.affectsConfiguration(t,"accessibility.verbosity.diffEditor")}computeConfiguration(e){let t=super.computeConfiguration(e);if(yi(e.diffEditor)){let n=Xi(e.diffEditor);n.diffCodeLens=n.codeLens,delete n.codeLens,n.diffWordWrap=n.wordWrap,delete n.wordWrap,Object.assign(t,n)}let o=e.accessibility?.verbosity?.diffEditor??!1;return t.accessibilityVerbose=o,t}getConfigurationOverrides(e){return{...super.getConfigurationOverrides(e),...this.getReadonlyConfiguration(this.input?.isReadonly()),originalEditable:this.input instanceof Fa&&!this.input.original.isReadonly(),lineDecorationsWidth:"2ch"}}updateReadonly(e){e instanceof Fa?this.diffEditorControl?.updateOptions({...this.getReadonlyConfiguration(e.isReadonly()),originalEditable:!e.original.isReadonly()}):super.updateReadonly(e)}isFileBinaryError(e){return Array.isArray(e)?e.some(o=>this.isFileBinaryError(o)):e.textFileOperationResult===0}clearInput(){this._previousViewModel&&(this._previousViewModel.dispose(),this._previousViewModel=null),super.clearInput();let e=this.inputLifecycleStopWatch?.elapsed();this.inputLifecycleStopWatch=void 0,typeof e=="number"&&this.logInputLifecycleTelemetry(e,this.getControl()?.getModel()?.modified?.getLanguageId()),this.diffEditorControl?.setModel(null)}logInputLifecycleTelemetry(e,t){let o=!1;this.diffEditorControl instanceof Hu&&(o=this.diffEditorControl.collapseUnchangedRegions),this.telemetryService.publicLog2("diffEditor.editorVisibleTime",{editorVisibleTimeMs:e,languageId:t??"",collapseUnchangedRegions:o})}getControl(){return this.diffEditorControl}focus(){super.focus(),this.diffEditorControl?.focus()}hasFocus(){return this.diffEditorControl?.hasTextFocus()||super.hasFocus()}setEditorVisible(e){super.setEditorVisible(e),e?this.diffEditorControl?.onVisible():this.diffEditorControl?.onHide()}layout(e){this.diffEditorControl?.layout(e)}setBoundarySashes(e){this.diffEditorControl?.setBoundarySashes(e)}tracksEditorViewState(e){return e instanceof Fa}computeEditorViewState(e){if(!this.diffEditorControl)return;let t=this.diffEditorControl.getModel();if(!t?.modified||!t.original)return;let o=this.toEditorViewStateResource(t);if(o&&Xe(o,e))return this.diffEditorControl.saveViewState()??void 0}toEditorViewStateResource(e){let t,o;if(e instanceof Fa?(t=e.original.resource,o=e.modified.resource):Ta(e)||(t=e.original.uri,o=e.modified.uri),!(!t||!o))return A.from({scheme:"diff",path:`${m6(t.toString())}${m6(o.toString())}`})}};Z_=I([m(1,Te),m(2,F),m(3,le),m(4,Nn),m(5,ee),m(6,De),m(7,Et),m(8,be),m(9,Po)],Z_);var wPt="toggle.diff.renderSideBySide",CPt="workbench.action.compareEditor.nextChange",xPt="workbench.action.compareEditor.previousChange",Rfi="workbench.action.compareEditor.focusPrimarySide",Mfi="workbench.action.compareEditor.focusSecondarySide",Pfi="workbench.action.compareEditor.focusOtherSide",loo="workbench.action.compareEditor.openSide",Afi="toggle.diff.ignoreTrimWhitespace",kPt="workbench.action.compareEditor.swapSides";function coo(){yt.registerCommandAndKeybindingRule({id:loo,weight:200,when:ue.inDiffEditor,primary:Ai(2089,1069),handler:async s=>{let l=s.get(ee),c=l.activeEditor,u=l.activeTextEditorControl;if(!Ec(u)||!(c instanceof Fa))return;let p;return u.getOriginalEditor().hasTextFocus()?p=c.original:p=c.modified,l.openEditor(p)}}),fe.appendMenuItem(D.CommandPalette,{command:{id:loo,title:L(3633,"Open Active Diff Side")}}),yt.registerCommandAndKeybindingRule({id:CPt,weight:200,when:M8e,primary:575,handler:(s,...l)=>i(s,l,!0)}),fe.appendMenuItem(D.CommandPalette,{command:{id:CPt,title:L(3632,"Go to Next Change")}}),yt.registerCommandAndKeybindingRule({id:xPt,weight:200,when:M8e,primary:1599,handler:(s,...l)=>i(s,l,!1)}),fe.appendMenuItem(D.CommandPalette,{command:{id:xPt,title:L(3634,"Go to Previous Change")}});function a(s,l){let c=s.get(ee),u=l.length>0&&l[0]instanceof A?l[0]:void 0;for(let p of[c.activeEditorPane,...c.visibleEditorPanes])if(p instanceof Z_&&(!u||p.input instanceof Fa&&Xe(p.input.primary.resource,u)))return p}function i(s,l,c){let u=a(s,l);u&&u.getControl()?.goToDiff(c?"next":"previous")}let e;(u=>(u[u.Original=0]="Original",u[u.Modified=1]="Modified",u[u.Toggle=2]="Toggle"))(e||={});function t(s,l,c){let u=a(s,l);if(u)switch(c){case 0:u.getControl()?.getOriginalEditor().focus();break;case 1:u.getControl()?.getModifiedEditor().focus();break;case 2:return u.getControl()?.getModifiedEditor().hasWidgetFocus()?t(s,l,0):t(s,l,1)}}function o(s,l){let c=s.get(Nn),p=a(s,l)?.getControl()?.getModifiedEditor()?.getModel();if(!p)return;let h="diffEditor.renderSideBySide",g=c.getValue(p.uri,h);c.updateValue(p.uri,h,!g)}function n(s,l){let c=s.get(Nn),p=a(s,l)?.getControl()?.getModifiedEditor()?.getModel();if(!p)return;let h="diffEditor.ignoreTrimWhitespace",g=c.getValue(p.uri,h);c.updateValue(p.uri,h,!g)}async function r(s,l){let c=s.get(ee),u=a(s,l),p=u?.group,h=u?.input;if(!u||typeof p>"u"||!(h instanceof Fa)||!h.modified.resource)return;let g=h.toUntyped({preserveViewState:p.id,preserveResource:!0});if(g){if(h.modified.isModified()&&c.findEditors({resource:h.modified.resource,typeId:h.modified.typeId,editorId:h.modified.editorId}).length===0){let f={...g.modified};f.options||(f.options={}),f.options.pinned=!0,f.options.inactive=!0,await c.openEditor(f,p)}await c.replaceEditors([{editor:h,replacement:{...g,original:g.modified,modified:g.original,options:{...g.options,pinned:!0}}}],p)}}yt.registerCommandAndKeybindingRule({id:wPt,weight:200,when:void 0,primary:void 0,handler:(s,...l)=>o(s,l)}),yt.registerCommandAndKeybindingRule({id:Rfi,weight:200,when:void 0,primary:void 0,handler:(s,...l)=>t(s,l,1)}),yt.registerCommandAndKeybindingRule({id:Mfi,weight:200,when:void 0,primary:void 0,handler:(s,...l)=>t(s,l,0)}),yt.registerCommandAndKeybindingRule({id:Pfi,weight:200,when:void 0,primary:void 0,handler:(s,...l)=>t(s,l,2)}),yt.registerCommandAndKeybindingRule({id:Afi,weight:200,when:void 0,primary:void 0,handler:(s,...l)=>n(s,l)}),yt.registerCommandAndKeybindingRule({id:kPt,weight:200,when:void 0,primary:void 0,handler:(s,...l)=>r(s,l)}),fe.appendMenuItem(D.CommandPalette,{command:{id:wPt,title:L(3636,"Toggle Inline View"),category:d(3631,null)},when:tS}),fe.appendMenuItem(D.CommandPalette,{command:{id:kPt,title:L(3635,"Swap Left and Right Editor Side"),category:d(3631,null)},when:x.and(tS,eke)})}function lp(a,i,e,t){let o=f$o(a,i,e,t),n=o.length&&o[0].preserveFocus||!1,r={groupedEditors:[],preserveFocus:n};for(let s of o){let l=S$o(s,e);if(!l)continue;let{group:c,editor:u}=l,p;for(let h of r.groupedEditors)if(h.group.id===c.id){p=h;break}p||(p={group:c,editors:[]},r.groupedEditors.push(p)),u&&p.editors.push(u)}return r}function f$o(a,i,e,t){let o=t.lastFocusedList,n=o instanceof hc&&o.getHTMLElement()===Pn(),r=b$o(a,n,i,e,t);if(!r){let l=e.activeGroup,c=l.activeEditor;r={groupId:l.id,editorIndex:c?l.getIndexOfEditor(c):void 0},n=!1}let s=doo(r,n,i,e,t);return v$o(r,s)}function v$o(a,i){if(i.length<=1)return i;let e=i.findIndex(t=>t.groupId===a.groupId&&t.editorIndex===a.editorIndex);if(e!==-1)i.splice(e,1),i.unshift(a);else if(a.editorIndex===void 0)i.unshift(a);else throw new Error("Editor context not found in multi editor context");return i}function b$o(a,i,e,t,o){let n=a.filter(r=>mce(r)||A.isUri(r));for(let r of n)if(mce(r))return r;for(let r of n){let s=e.findEditors(r);if(s.length){let l=s[0],c=t.getGroup(l.groupId);return{groupId:l.groupId,editorIndex:c?.getIndexOfEditor(l.editor)}}}if(i){let r=o.lastFocusedList;for(let s of r.getFocusedElements())if(uoo(s))return Nfi(s,void 0,t)}}function doo(a,i,e,t,o){if(i){let r=o.lastFocusedList.getSelectedElements().filter(uoo);if(r.length>1)return r.map(s=>Nfi(s,a.preserveFocus,t));if(r.length===0)return doo(a,!1,e,t,o)}else{let n=t.getGroup(a.groupId),r=a.editorIndex!==void 0?n?.getEditorByIndex(a.editorIndex):n?.activeEditor;if(n&&r&&n.isSelected(r))return n.selectedEditors.map(s=>Nfi({editor:s,groupId:n.id},a.preserveFocus,t))}return[a]}function Nfi(a,i,e){if(hce(a))return{groupId:a.id,editorIndex:void 0,preserveFocus:i};let t=e.getGroup(a.groupId);return{groupId:a.groupId,editorIndex:t?t.getIndexOfEditor(a.editor):-1,preserveFocus:i}}function uoo(a){return hce(a)||C8e(a)}function S$o(a,i){let e=i.getGroup(a.groupId);if(!e)return;if(a.editorIndex===void 0)return{group:e,editor:void 0};let t=e.getEditorByIndex(a.editorIndex);return{group:e,editor:t}}var cue="workbench.action.closeUnmodifiedEditors",B5="workbench.action.closeEditorsInGroup",f7e="workbench.action.closeEditorsAndGroup",EPt="workbench.action.closeEditorsToTheRight",OC="workbench.action.closeActiveEditor",Ofi="workbench.action.closeActivePinnedEditor",TPt="workbench.action.closeGroup",g_e="workbench.action.closeOtherEditors",aK="moveActiveEditor",lK="copyActiveEditor",cK="layoutEditorGroups",_Pt="workbench.action.keepEditor",Ffi="workbench.action.toggleKeepEditors",DPt="workbench.action.toggleEditorGroupLock",LPt="workbench.action.lockEditorGroup",H5="workbench.action.unlockEditorGroup",Wfi="workbench.action.showEditorsInGroup",f_e="workbench.action.reopenWithEditor",I$o="reopenActiveEditorWith",RPt="workbench.action.pinEditor",U5="workbench.action.unpinEditor",uJ="workbench.action.splitEditor",z5="workbench.action.splitEditorUp",dK="workbench.action.splitEditorDown",K5="workbench.action.splitEditorLeft",uK="workbench.action.splitEditorRight",v_e="workbench.action.moveEditorToAboveGroup",b_e="workbench.action.moveEditorToBelowGroup",S_e="workbench.action.moveEditorToLeftGroup",I_e="workbench.action.moveEditorToRightGroup",y_e="workbench.action.toggleMaximizeEditorGroup",MPt="workbench.action.splitEditorInGroup",y$o="workbench.action.toggleSplitEditorInGroup",PPt="workbench.action.joinEditorInGroup",Vfi="workbench.action.toggleSplitEditorInGroupLayout",Bfi="workbench.action.focusFirstSideEditor",Hfi="workbench.action.focusSecondSideEditor",w$o="workbench.action.focusOtherSideEditor",C$o="workbench.action.focusLeftGroupWithoutWrap",x$o="workbench.action.focusRightGroupWithoutWrap",k$o="workbench.action.focusAboveGroupWithoutWrap",E$o="workbench.action.focusBelowGroupWithoutWrap",poo="workbench.action.openEditorAtIndex",v7e="workbench.action.moveEditorToNewWindow",b7e="workbench.action.copyEditorToNewWindow",APt="workbench.action.moveEditorGroupToNewWindow",NPt="workbench.action.copyEditorGroupToNewWindow",OPt="workbench.action.newEmptyEditorWindow",Ufi="workbench.action.closeModalEditor",zfi="workbench.action.moveModalEditorToMain",Kfi="workbench.action.moveModalEditorToWindow",Gfi="workbench.action.toggleModalEditorMaximized",$fi="workbench.action.navigateModalEditorPrevious",qfi="workbench.action.navigateModalEditorNext",Zh="_workbench.open",NC="_workbench.diff",T$o="_workbench.openWith",goo=[uJ,OC,U5,H5,y_e],moo=function(a){return!(!yi(a)||!Ae(a.to)||!cn(a.by)&&!Ae(a.by)||!cn(a.value)&&!Xo(a.value))};function _$o(){let a={type:"object",required:["to"],properties:{to:{type:"string",enum:["left","right"]},by:{type:"string",enum:["tab","group"]},value:{type:"number"}}};yt.registerCommandAndKeybindingRule({id:aK,weight:200,when:ue.editorTextFocus,primary:0,handler:(n,r)=>i(!0,r,n),metadata:{description:d(3912,null),args:[{name:d(3911,null),description:d(3910,null),constraint:moo,schema:a}]}}),yt.registerCommandAndKeybindingRule({id:lK,weight:200,when:ue.editorTextFocus,primary:0,handler:(n,r)=>i(!1,r,n),metadata:{description:d(3909,null),args:[{name:d(3908,null),description:d(3907,null),constraint:moo,schema:a}]}}),[{id:v_e,to:"up"},{id:b_e,to:"down"},{id:S_e,to:"left"},{id:I_e,to:"right"}].forEach(({id:n,to:r})=>{qe.registerCommand(n,function(s,...l){let c=lp(l,s.get(ee),s.get(Et),s.get(fo));c.groupedEditors.length&&o(!0,{to:r,by:"group"},c.groupedEditors[0].group,c.groupedEditors[0].editors,s)})});function i(n,r=Object.create(null),s){r.to=r.to||"right",r.by=r.by||"tab",r.value=typeof r.value=="number"?r.value:1;let l=s.get(Et).activeGroup,c=l.selectedEditors;if(c.length>0)switch(r.by){case"tab":if(n)return e(r,l,c);break;case"group":return o(n,r,l,c,s)}}function e(n,r,s){let l=n.to;l==="first"||l==="right"?s=[...s].reverse():l==="position"&&(n.value??1)<r.getIndexOfEditor(s[0])&&(s=[...s].reverse());for(let c of s)t(n,r,c)}function t(n,r,s){let l=r.getIndexOfEditor(s);switch(n.to){case"first":l=0;break;case"last":l=r.count-1;break;case"left":l=l-(n.value??1);break;case"right":l=l+(n.value??1);break;case"center":l=Math.round(r.count/2)-1;break;case"position":l=(n.value??1)-1;break}l=l<0?0:l>=r.count?r.count-1:l,r.moveEditor(s,r,{index:l})}function o(n,r,s,l,c){let u=c.get(Et),p=c.get(B),h;switch(r.to){case"left":h=u.findGroup({direction:2},s),h||(h=u.addGroup(s,2));break;case"right":h=u.findGroup({direction:3},s),h||(h=u.addGroup(s,3));break;case"up":h=u.findGroup({direction:0},s),h||(h=u.addGroup(s,0));break;case"down":h=u.findGroup({direction:1},s),h||(h=u.addGroup(s,1));break;case"first":h=u.findGroup({location:0},s);break;case"last":h=u.findGroup({location:1},s);break;case"previous":if(h=u.findGroup({location:3},s),!h){let g=pC(p)===3?2:0;h=u.addGroup(s,g)}break;case"next":h=u.findGroup({location:2},s),h||(h=u.addGroup(s,pC(p)));break;case"center":h=u.getGroups(2)[u.count/2-1];break;case"position":h=u.getGroups(2)[(r.value??1)-1];break}if(h){let g=ZY(s,l);n?s.moveEditors(g,h):s.id!==h.id&&s.copyEditors(g,h),h.focus()}}}function D$o(){function a(i,e){if(!e||typeof e!="object")return;i.get(Et).applyLayout(e)}qe.registerCommand(cK,(i,e)=>{a(i,e)}),qe.registerCommand({id:"vscode.setEditorLayout",handler:(i,e)=>a(i,e),metadata:{description:`Set the editor layout. Editor layout is represented as a tree of groups in which the first group is the root group of the layout.
The orientation of the first group is 0 (horizontal) by default unless specified otherwise. The other orientations are 1 (vertical).
The orientation of subsequent groups is the opposite of the orientation of the group that contains it.
Here are some examples: A layout representing 1 row and 2 columns: { orientation: 0, groups: [{}, {}] }.
A layout representing 3 rows and 1 column: { orientation: 1, groups: [{}, {}, {}] }.
A layout representing 3 rows and 1 column in which the second row has 2 columns: { orientation: 1, groups: [{}, { groups: [{}, {}] }, {}] }
`,args:[{name:"args",schema:{type:"object",required:["groups"],properties:{orientation:{type:"number",default:0,description:"The orientation of the root group in the layout. 0 for horizontal, 1 for vertical.",enum:[0,1],enumDescriptions:[d(3913,null),d(3914,null)]},groups:{$ref:"#/definitions/editorGroupsSchema",default:[{},{}]}}}}]}}),qe.registerCommand({id:"vscode.getEditorLayout",handler:i=>i.get(Et).getLayout(),metadata:{description:"Get Editor Layout",args:[],returns:"An editor layout object, in the same format as vscode.setEditorLayout"}})}function L$o(){function a(i,e,t){return i?[{...i.editorOptions,...e??Object.create(null)},i.sideBySide?vn:t]:[e,t]}qe.registerCommand({id:"vscode.open",handler:(i,e)=>{i.get(ge).executeCommand(Zh,e)},metadata:{description:"Opens the provided resource in the editor.",args:[{name:"Uri"}]}}),qe.registerCommand(Zh,async function(i,e,t,o,n){let r=i.get(ee),s=i.get(Et),l=i.get(Qe),c=i.get(wn),u=i.get(B),p=i.get(H_),h=typeof e=="string"?e:A.from(e,!0),[g,f]=t??[];if(f||typeof g=="number"||jd(h,Y.untitled)){let[v,b]=a(n,f,g),S=A.isUri(h)?h:A.parse(h),y;p.isUntitledWithAssociatedResource(S)?y={resource:S.with({scheme:c.defaultUriScheme}),forceUntitled:!0,options:v,label:o}:y={resource:S,options:v,label:o},await r.openEditor(y,W_(s,u,b))}else{if(jd(h,Y.command))return;await l.open(h,{openToSide:n?.sideBySide,editorOptions:n?.editorOptions})}}),qe.registerCommand({id:"vscode.diff",handler:(i,e,t,o)=>{i.get(ge).executeCommand(NC,e,t,o)},metadata:{description:"Opens the provided resources in the diff editor to compare their contents.",args:[{name:"left",description:"Left-hand side resource of the diff editor"},{name:"right",description:"Right-hand side resource of the diff editor"},{name:"title",description:"Human readable title for the diff editor"}]}}),qe.registerCommand(NC,async function(i,e,t,o,n,r){let s=i.get(ee),l=i.get(Et),c=i.get(B),[u,p]=n??[],[h,g]=a(r,p,u),f,v;typeof o=="string"?f=o:o&&(f=o.label,v=o.description),await s.openEditor({original:{resource:A.from(e,!0)},modified:{resource:A.from(t,!0)},label:f,description:v,options:h},W_(l,c,g))}),qe.registerCommand(T$o,async(i,e,t,o)=>{let n=i.get(ee),r=i.get(Et),s=i.get(B),[l,c]=o??[];await n.openEditor({resource:A.from(e,!0),options:{pinned:!0,...c,override:t}},W_(r,s,l))}),qe.registerCommand({id:"vscode.changes",handler:(i,e,t)=>{i.get(ge).executeCommand("_workbench.changes",e,t)},metadata:{description:"Opens a list of resources in the changes editor to compare their contents.",args:[{name:"title",description:"Human readable title for the diff editor"},{name:"resources",description:"List of resources to open in the changes editor"}]}}),qe.registerCommand("_workbench.changes",async(i,e,t)=>{let o=i.get(ee),n=[];for(let[r,s,l]of t)n.push({resource:A.revive(r),original:{resource:A.revive(s)},modified:{resource:A.revive(l)}});await o.openEditor({resources:n,label:e})}),qe.registerCommand("_workbench.openMultiDiffEditor",async(i,e)=>{let t=i.get(ee),o=e.resources?.map(l=>({original:{resource:A.revive(l.originalUri)},modified:{resource:A.revive(l.modifiedUri)}})),n=e.reveal?.modifiedUri?A.revive(e.reveal.modifiedUri):void 0,r=n&&o?o.find(l=>Xe(l.modified.resource,n)):void 0;e.reveal&&!r&&console.error("Reveal resource not found");let s={viewState:r?{revealData:{resource:{original:r.original.resource,modified:r.modified.resource},range:e.reveal?.range}}:void 0};await t.openEditor({multiDiffSource:e.multiDiffSourceUri?A.revive(e.multiDiffSourceUri):void 0,resources:o,label:e.title,options:s})})}function R$o(){let a=(e,t)=>{let o=e.get(ee),n=o.activeEditorPane;if(n&&typeof t=="number"){let r=n.group.getEditorByIndex(t);r&&o.openEditor(r)}};qe.registerCommand({id:poo,handler:a});for(let e=0;e<9;e++){let t=e,o=e+1;yt.registerCommandAndKeybindingRule({id:poo+o,weight:200,when:void 0,primary:512|i(o),mac:{primary:256|i(o)},handler:n=>a(n,t)})}function i(e){switch(e){case 0:return 21;case 1:return 22;case 2:return 23;case 3:return 24;case 4:return 25;case 5:return 26;case 6:return 27;case 7:return 28;case 8:return 29;case 9:return 30}throw new Error("invalid index")}}function M$o(){for(let e=1;e<8;e++)yt.registerCommandAndKeybindingRule({id:a(e),weight:200,when:void 0,primary:2048|i(e),handler:t=>{let o=t.get(Et),n=t.get(B);if(e>o.count)return;let r=o.getGroups(2);if(r[e])return r[e].focus();let s=pC(n),l=o.findGroup({location:1});if(!l)return;o.addGroup(l,s).focus()}});function a(e){switch(e){case 1:return"workbench.action.focusSecondEditorGroup";case 2:return"workbench.action.focusThirdEditorGroup";case 3:return"workbench.action.focusFourthEditorGroup";case 4:return"workbench.action.focusFifthEditorGroup";case 5:return"workbench.action.focusSixthEditorGroup";case 6:return"workbench.action.focusSeventhEditorGroup";case 7:return"workbench.action.focusEighthEditorGroup"}throw new Error("Invalid index")}function i(e){switch(e){case 1:return 23;case 2:return 24;case 3:return 25;case 4:return 26;case 5:return 27;case 6:return 28;case 7:return 29}throw new Error("Invalid index")}}function jfi(a,i,e){if(!e.groupedEditors.length)return;let{group:t,editors:o}=e.groupedEditors[0],n=e.preserveFocus,r=a.addGroup(t,i);for(let s of o)s&&!s.hasCapability(8)&&t.copyEditor(s,r,{preserveFocus:n});r.focus()}function P$o(){[{id:z5,direction:0},{id:dK,direction:1},{id:K5,direction:2},{id:uK,direction:3}].forEach(({id:a,direction:i})=>{qe.registerCommand(a,function(e,...t){let o=lp(t,e.get(ee),e.get(Et),e.get(fo));jfi(e.get(Et),i,o)})})}function A$o(){function a(e,t,...o){let n=e.get(Et),r=e.get(ee),s;if(t||o.length?s=!1:s=n.partOptions.preventPinnedEditorClose==="keyboard"||n.partOptions.preventPinnedEditorClose==="keyboardAndMouse",s){let u=n.activeGroup,p=u.activeEditor;if(p&&u.isSticky(p)){let h=u.getEditors(0,{excludeSticky:!0})[0];if(h)return u.openEditor(h);let g=r.getEditors(0,{excludeSticky:!0})[0];if(g)return Promise.resolve(n.getGroup(g.groupId)?.openEditor(g.editor))}}let l=lp(o,e.get(ee),e.get(Et),e.get(fo)),c=l.preserveFocus;return Promise.all(l.groupedEditors.map(async({group:u,editors:p})=>{let h=p.filter(g=>!s||!u.isSticky(g));await u.closeEditors(h,{preserveFocus:c})}))}yt.registerCommandAndKeybindingRule({id:OC,weight:200,when:void 0,primary:2101,win:{primary:2110,secondary:[2101]},handler:(e,...t)=>a(e,!1,...t)}),qe.registerCommand(Ofi,(e,...t)=>a(e,!0,...t)),yt.registerCommandAndKeybindingRule({id:B5,weight:200,when:void 0,primary:Ai(2089,53),handler:(e,...t)=>{let o=lp(t,e.get(ee),e.get(Et),e.get(fo));return Promise.all(o.groupedEditors.map(async({group:n})=>{await n.closeAllEditors({excludeSticky:!0})}))}}),yt.registerCommandAndKeybindingRule({id:TPt,weight:200,when:x.and(Ice,iS),primary:2101,win:{primary:2110,secondary:[2101]},handler:(e,...t)=>{let o=e.get(Et),n=lp(t,e.get(ee),o,e.get(fo));n.groupedEditors.length&&o.removeGroup(n.groupedEditors[0].group)}}),yt.registerCommandAndKeybindingRule({id:cue,weight:200,when:void 0,primary:Ai(2089,51),handler:(e,...t)=>{let o=lp(t,e.get(ee),e.get(Et),e.get(fo));return Promise.all(o.groupedEditors.map(async({group:n})=>{await n.closeEditors({savedOnly:!0,excludeSticky:!0},{preserveFocus:o.preserveFocus})}))}}),yt.registerCommandAndKeybindingRule({id:g_e,weight:200,when:void 0,primary:void 0,mac:{primary:2610},handler:(e,...t)=>{let o=lp(t,e.get(ee),e.get(Et),e.get(fo));return Promise.all(o.groupedEditors.map(async({group:n,editors:r})=>{let s=n.getEditors(1,{excludeSticky:!0}).filter(l=>!r.includes(l));for(let l of r)l&&n.pinEditor(l);await n.closeEditors(s,{preserveFocus:o.preserveFocus})}))}}),yt.registerCommandAndKeybindingRule({id:EPt,weight:200,when:void 0,primary:void 0,handler:async(e,...t)=>{let o=lp(t,e.get(ee),e.get(Et),e.get(fo));if(o.groupedEditors.length){let{group:n,editors:r}=o.groupedEditors[0];n.activeEditor&&n.pinEditor(n.activeEditor),await n.closeEditors({direction:1,except:r[0],excludeSticky:!0},{preserveFocus:o.preserveFocus})}}}),yt.registerCommandAndKeybindingRule({id:f_e,weight:200,when:void 0,primary:void 0,handler:(e,...t)=>i(e,0,...t)}),yt.registerCommandAndKeybindingRule({id:I$o,weight:200,when:void 0,primary:void 0,handler:(e,t,...o)=>i(e,t??0,...o)});async function i(e,t,...o){let n=e.get(ee),r=e.get(ul),s=e.get(Te),l=lp(o,n,e.get(Et),e.get(fo)),c=new Map;for(let{group:u,editors:p}of l.groupedEditors)for(let h of p){let g=h.toUntyped();if(!g)return;g.options={...n.activeEditorPane?.options,override:t};let f=await r.resolveEditor(g,u);if(!Rj(f))return;let v=c.get(u);v||(v=[],c.set(u,v)),v.push({editor:h,replacement:f.editor,forceReplaceDirty:h.resource?.scheme===Y.untitled,options:f.options}),s.publicLog2("workbenchEditorReopen",{scheme:h.resource?.scheme??"",ext:h.resource?ms(h.resource):"",from:h.editorId??"",to:f.editor.editorId??""})}for(let[u,p]of c)await u.replaceEditors(p),await u.openEditor(p[0].replacement)}qe.registerCommand(f7e,async(e,...t)=>{let o=e.get(Et),n=lp(t,e.get(ee),o,e.get(fo));if(n.groupedEditors.length){let{group:r}=n.groupedEditors[0];await r.closeAllEditors(),r.count===0&&o.getGroup(r.id)&&o.removeGroup(r)}})}function N$o(){let a=[{id:C$o,direction:2},{id:x$o,direction:3},{id:k$o,direction:0},{id:E$o,direction:1}];for(let i of a)qe.registerCommand(i.id,async e=>{let t=e.get(Et);(t.findGroup({direction:i.direction},t.activeGroup,!1)??t.activeGroup).focus()})}function O$o(){async function a(e,t){let o=e.get(F);if(!t.groupedEditors.length)return;let{group:n,editors:r}=t.groupedEditors[0],s=r[0];s&&await n.replaceEditors([{editor:s,replacement:o.createInstance(ga,void 0,void 0,s,s),forceReplaceDirty:!0}])}W(class extends K{constructor(){super({id:MPt,title:L(3925,"Split Editor in Group"),category:We.View,precondition:oV,f1:!0,keybinding:{weight:200,when:oV,primary:Ai(2089,3165)}})}run(e,...t){return a(e,lp(t,e.get(ee),e.get(Et),e.get(fo)))}});async function i(e){if(!e.groupedEditors.length)return;let{group:t,editors:o}=e.groupedEditors[0],n=o[0];if(!n||!(n instanceof ga))return;let r,s=t.activeEditorPane;if(s instanceof of&&t.activeEditor===n){for(let l of[s.getPrimaryEditorPane(),s.getSecondaryEditorPane()])if(l?.hasFocus()){r={viewState:l.getViewState()};break}}await t.replaceEditors([{editor:n,replacement:n.primary,options:r}])}W(class extends K{constructor(){super({id:PPt,title:L(3918,"Join Editor in Group"),category:We.View,precondition:hC,f1:!0,keybinding:{weight:200,when:hC,primary:Ai(2089,3165)}})}run(e,...t){return i(lp(t,e.get(ee),e.get(Et),e.get(fo)))}}),W(class extends K{constructor(){super({id:y$o,title:L(3927,"Toggle Split Editor in Group"),category:We.View,precondition:x.or(oV,hC),f1:!0})}async run(e,...t){let o=lp(t,e.get(ee),e.get(Et),e.get(fo));if(!o.groupedEditors.length)return;let{editors:n}=o.groupedEditors[0];n[0]instanceof ga?await i(o):n[0]&&await a(e,o)}}),W(class extends K{constructor(){super({id:Vfi,title:L(3929,"Toggle Layout of Split Editor in Group"),category:We.View,precondition:hC,f1:!0})}async run(e){let t=e.get(B),o=t.getValue(of.SIDE_BY_SIDE_LAYOUT_SETTING),n;return o!=="horizontal"?n="horizontal":n="vertical",t.updateValue(of.SIDE_BY_SIDE_LAYOUT_SETTING,n)}})}function F$o(){W(class extends K{constructor(){super({id:Bfi,title:L(3915,"Focus First Side in Active Editor"),category:We.View,precondition:x.or(hC,tS),f1:!0})}async run(a){let i=a.get(ee),e=a.get(ge),t=i.activeEditorPane;t instanceof of?t.getSecondaryEditorPane()?.focus():t instanceof Z_&&await e.executeCommand(Mfi)}}),W(class extends K{constructor(){super({id:Hfi,title:L(3917,"Focus Second Side in Active Editor"),category:We.View,precondition:x.or(hC,tS),f1:!0})}async run(a){let i=a.get(ee),e=a.get(ge),t=i.activeEditorPane;t instanceof of?t.getPrimaryEditorPane()?.focus():t instanceof Z_&&await e.executeCommand(Rfi)}}),W(class extends K{constructor(){super({id:w$o,title:L(3916,"Focus Other Side in Active Editor"),category:We.View,precondition:x.or(hC,tS),f1:!0})}async run(a){let i=a.get(ee),e=a.get(ge),t=i.activeEditorPane;t instanceof of?t.getPrimaryEditorPane()?.hasFocus()?t.getSecondaryEditorPane()?.focus():t.getPrimaryEditorPane()?.focus():t instanceof Z_&&await e.executeCommand(Pfi)}})}function W$o(){yt.registerCommandAndKeybindingRule({id:_Pt,weight:200,when:void 0,primary:Ai(2089,3),handler:async(i,...e)=>{let t=lp(e,i.get(ee),i.get(Et),i.get(fo));for(let{group:o,editors:n}of t.groupedEditors)for(let r of n)o.pinEditor(r)}}),qe.registerCommand({id:Ffi,handler:i=>{let e=i.get(B),o=e.getValue("workbench.editor.enablePreview")!==!0;e.updateValue("workbench.editor.enablePreview",o)}});function a(i,e,...t){let n=lp(t,i.get(ee),i.get(Et),i.get(fo)).groupedEditors[0]?.group;n?.lock(e??!n.isLocked)}W(class extends K{constructor(){super({id:DPt,title:L(3926,"Toggle Editor Group Lock"),category:We.View,f1:!0})}async run(i,...e){a(i,void 0,...e)}}),W(class extends K{constructor(){super({id:LPt,title:L(3919,"Lock Editor Group"),category:We.View,precondition:ME.toNegated(),f1:!0})}async run(i,...e){a(i,!0,...e)}}),W(class extends K{constructor(){super({id:H5,title:L(3930,"Unlock Editor Group"),precondition:ME,category:We.View,f1:!0})}async run(i,...e){a(i,!1,...e)}}),yt.registerCommandAndKeybindingRule({id:RPt,weight:200,when:ZL.toNegated(),primary:Ai(2089,1027),handler:async(i,...e)=>{let t=lp(e,i.get(ee),i.get(Et),i.get(fo));for(let{group:o,editors:n}of t.groupedEditors)for(let r of n)o.stickEditor(r)}}),yt.registerCommandAndKeybindingRule({id:U5,weight:200,when:ZL,primary:Ai(2089,1027),handler:async(i,...e)=>{let t=lp(e,i.get(ee),i.get(Et),i.get(fo));for(let{group:o,editors:n}of t.groupedEditors)for(let r of n)o.unstickEditor(r)}}),yt.registerCommandAndKeybindingRule({id:Wfi,weight:200,when:void 0,primary:void 0,handler:(i,...e)=>{let t=i.get(Et),o=i.get(Ge),r=lp(e,i.get(ee),t,i.get(fo)).groupedEditors[0]?.group;return r&&t.activateGroup(r),o.quickAccess.show(J_.PREFIX)}})}function V$o(){W(class extends K{constructor(){super({id:zfi,title:L(3921,"Open Modal Editor in Main Window"),category:We.View,f1:!0,icon:M.openInProduct,precondition:rV,menu:{id:D.ModalEditorTitle,group:"navigation",order:0,when:$p.negate()}})}run(a){let i=a.get(Et);for(let e of i.parts)if(h_e(e)){e.close({mergeAllEditorsToMainPart:!0});break}}}),W(class extends K{constructor(){super({id:Kfi,title:L(3920,"Open Modal Editor in New Window"),category:We.View,f1:!0,icon:M.emptyWindow,precondition:rV,menu:{id:D.ModalEditorTitle,group:"navigation",order:0,when:$p}})}async run(a){let i=a.get(Et);for(let e of i.parts)if(h_e(e)){let t=await i.createAuxiliaryEditorPart();for(let o of e.getGroups(1))o.moveEditors(o.editors.map(n=>({editor:n,options:{preserveFocus:!0}})),t.activeGroup);t.activeGroup.focus(),e.close();break}}}),W(class extends K{constructor(){super({id:Gfi,title:L(3928,"Maximize Modal Editor"),category:We.View,f1:!0,precondition:rV,icon:M.screenFull,toggled:{condition:tTt,title:d(3924,null)},menu:{id:D.ModalEditorTitle,group:"navigation",order:1}})}run(a){let i=a.get(Et);for(let e of i.parts)if(h_e(e)){e.toggleMaximized();break}}}),W(class extends K{constructor(){super({id:Ufi,title:L(3906,"Close Modal Editor"),category:We.View,f1:!0,icon:M.close,precondition:rV,keybinding:[{primary:9,weight:210,when:ue.focus.toNegated()},{primary:9,weight:99,when:ue.focus}],menu:{id:D.ModalEditorTitle,group:"navigation",order:2}})}async run(a){let i=a.get(Et);for(let e of i.parts)if(h_e(e)){e.close();break}}}),W(class extends K{constructor(){super({id:$fi,title:L(3923,"Navigate to Previous Item in Modal Editor"),category:We.View,precondition:x.and(rV,yce),keybinding:{primary:528,weight:210,when:x.and(rV,yce)}})}run(a){let i=a.get(Et);for(let e of i.parts)if(h_e(e)){let t=e.navigation;t&&t.current>0&&t.navigate(t.current-1);break}}}),W(class extends K{constructor(){super({id:qfi,title:L(3922,"Navigate to Next Item in Modal Editor"),category:We.View,precondition:x.and(rV,yce),keybinding:{primary:530,weight:210,when:x.and(rV,yce)}})}run(a){let i=a.get(Et);for(let e of i.parts)if(h_e(e)){let t=e.navigation;t&&t.current<t.total-1&&t.navigate(t.current+1);break}}})}function h_e(a){let i=a;return!!i&&typeof i.close=="function"&&typeof i.onWillClose=="function"&&typeof i.toggleMaximized=="function"&&typeof i.maximized=="boolean"&&typeof i.updateOptions=="function"&&!!i.modalElement&&i.windowId===It.vscodeWindowId}function foo(){_$o(),D$o(),coo(),L$o(),R$o(),A$o(),W$o(),O$o(),F$o(),M$o(),P$o(),N$o(),V$o()}var FPt=class extends C{constructor(){super(...arguments);this._onDidChangeCheckboxState=this._register(new E);this.onDidChangeCheckboxState=this._onDidChangeCheckboxState.event}setCheckboxState(e){this._onDidChangeCheckboxState.fire([e])}},S7e=class a extends C{constructor(e,t,o,n){super();this.checkboxStateHandler=t;this.hoverDelegate=o;this.hoverService=n;this.checkboxContainer=e}static{this.checkboxClass="custom-view-tree-node-item-checkbox"}render(e){e.checkbox&&(this.toggle?this.toggle.checked=e.checkbox.isChecked:this.createCheckbox(e))}createCheckbox(e){e.checkbox&&(this.toggle=new hv("",e.checkbox.isChecked,{...kf,size:15}),this.setHover(e.checkbox),this.setAccessibilityInformation(e.checkbox),this.toggle.domNode.classList.add(a.checkboxClass),this.toggle.domNode.tabIndex=1,R(this.checkboxContainer,this.toggle.domNode),this.registerListener(e))}registerListener(e){this.toggle&&(this._register({dispose:()=>this.removeCheckbox()}),this._register(this.toggle),this._register(this.toggle.onChange(()=>{this.setCheckbox(e)})))}setHover(e){this.toggle&&(this.hover?this.hover.update(e.tooltip):this.hover=this._register(this.hoverService.setupManagedHover(this.hoverDelegate,this.toggle.domNode,this.checkboxHoverContent(e))))}setCheckbox(e){this.toggle&&e.checkbox&&(e.checkbox.isChecked=this.toggle.checked,this.setHover(e.checkbox),this.setAccessibilityInformation(e.checkbox),this.checkboxStateHandler.setCheckboxState(e))}checkboxHoverContent(e){return e.tooltip?e.tooltip:e.isChecked?d(4238,null):d(4239,null)}setAccessibilityInformation(e){this.toggle&&e.accessibilityInformation&&(this.toggle.setTitle(e.accessibilityInformation.label),e.accessibilityInformation.role&&(this.toggle.domNode.role=e.accessibilityInformation.role))}removeCheckbox(){let e=this.checkboxContainer.children;for(let t of e)t.remove()}};var C_e=ae("accessibleViewInformationService"),w_e=class extends C{constructor(e){super();this._storageService=e}hasShownAccessibleView(e){return this._storageService.getBoolean(`${qGe}${e}`,-1,!1)===!0}};w_e=I([m(0,le)],w_e);var eD=class extends zr{constructor(i,e,t,o,n,r,s,l,c,u,p,h){super({...i,titleMenuId:D.ViewTitle,donotForwardArgs:!1},e,t,o,n,r,s,l,c,p,h);let{treeView:g}=oe.as(on.ViewsRegistry).getView(i.id);this.treeView=g,this._register(this.treeView.onDidChangeActions(()=>this.updateActions(),this)),this._register(this.treeView.onDidChangeTitle(f=>this.updateTitle(f))),this._register(this.treeView.onDidChangeDescription(f=>this.updateTitleDescription(f))),this._register(Z(()=>{this._container&&this.treeView.container&&this._container===this.treeView.container&&this.treeView.setVisibility(!1)})),this._register(this.onDidChangeBodyVisibility(()=>this.updateTreeVisibility())),this._register(this.treeView.onDidChangeWelcomeState(()=>this._onDidChangeViewWelcomeState.fire())),i.title!==this.treeView.title&&this.updateTitle(this.treeView.title),i.titleDescription!==this.treeView.description&&this.updateTitleDescription(this.treeView.description),this._actionRunner=this._register(new WPt(u,()=>this.treeView.getSelection())),this.updateTreeVisibility()}focus(){super.focus(),this.treeView.focus()}renderBody(i){this._container=i,super.renderBody(i),this.renderTreeView(i)}shouldShowWelcome(){return(this.treeView.dataProvider===void 0||!!this.treeView.dataProvider.isTreeEmpty)&&(this.treeView.message===void 0||this.treeView.message==="")}layoutBody(i,e){super.layoutBody(i,e),this.layoutTreeView(i,e)}getOptimalWidth(){return this.treeView.getOptimalWidth()}renderTreeView(i){this.treeView.show(i)}layoutTreeView(i,e){this.treeView.layout(i,e)}updateTreeVisibility(){this.treeView.setVisibility(this.isBodyVisible())}getActionRunner(){return this._actionRunner}getActionsContext(){return{$treeViewId:this.id,$focusedTreeItem:!0,$selectedTreeItems:!0}}};eD=I([m(1,_e),m(2,ze),m(3,B),m(4,X),m(5,Ri),m(6,F),m(7,Qe),m(8,De),m(9,Ne),m(10,tt),m(11,C_e)],eD);var w7e=class{constructor(){this.label={label:"root"};this.handle="0";this.parentHandle=void 0;this.collapsibleState=2;this.children=void 0}};function boo(a){let i=qe.getCommand(a);if(i)return fe.getCommand(i.id)?.precondition}function Soo(a,i){let e=a.originalId?a.originalId:a.id,t=boo(e);return t?i.contextMatchesRules(t):!0}function voo(a){return!!a&&typeof a!="string"&&!!a.element&&!!a.disposables}var B$o=d(4242,null),H$o=new Q("customTreeView",!1),Qfi=class extends nu{},x_e=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super();this.id=e;this._title=t;this.themeService=o;this.instantiationService=n;this.commandService=r;this.configurationService=s;this.progressService=l;this.contextMenuService=c;this.keybindingService=u;this.notificationService=p;this.viewDescriptorService=h;this.hoverService=g;this.contextKeyService=f;this.activityService=v;this.logService=b;this.openerService=S;this.markdownRendererService=y;this.isVisible=!1;this._hasIconForParentNode=!1;this._hasIconForLeafNode=!1;this.focused=!1;this._canSelectMany=!1;this._manuallyManageCheckboxes=!1;this.elementsToRefresh=[];this.lastSelection=[];this._onDidExpandItem=this._register(new E);this._onDidCollapseItem=this._register(new E);this._onDidChangeSelectionAndFocus=this._register(new E);this._onDidChangeVisibility=this._register(new E);this._onDidChangeActions=this._register(new E);this._onDidChangeWelcomeState=this._register(new E);this._onDidChangeTitle=this._register(new E);this._onDidChangeDescription=this._register(new E);this._onDidChangeCheckboxState=this._register(new E);this._onDidCompleteRefresh=this._register(new E);this._isInitialized=!1;this._activity=this._register(new me);this.activated=!1;this.treeDisposables=this._register(new P);this._height=0;this._width=0;this.refreshing=!1;this.root=new w7e,this.lastActive=this.root}get onDidExpandItem(){return this._onDidExpandItem.event}get onDidCollapseItem(){return this._onDidCollapseItem.event}get onDidChangeSelectionAndFocus(){return this._onDidChangeSelectionAndFocus.event}get onDidChangeVisibility(){return this._onDidChangeVisibility.event}get onDidChangeActions(){return this._onDidChangeActions.event}get onDidChangeWelcomeState(){return this._onDidChangeWelcomeState.event}get onDidChangeTitle(){return this._onDidChangeTitle.event}get onDidChangeDescription(){return this._onDidChangeDescription.event}get onDidChangeCheckboxState(){return this._onDidChangeCheckboxState.event}initialize(){this._isInitialized||(this._isInitialized=!0,this.contextKeyService.bufferChangeEvents(()=>{this.initializeShowCollapseAllAction(),this.initializeCollapseAllToggle(),this.initializeShowRefreshAction()}),this.treeViewDnd=this.instantiationService.createInstance(y7e,this.id),this._dragAndDropController&&(this.treeViewDnd.controller=this._dragAndDropController),this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration("explorer.decorations")&&this.doRefresh([this.root])})),this._register(this.viewDescriptorService.onDidChangeLocation(({views:e,from:t,to:o})=>{e.some(n=>n.id===this.id)&&this.tree?.updateOptions({overrideStyles:qz(this.viewLocation).listOverrideStyles})})),this.registerActions(),this.create())}get viewContainer(){return this.viewDescriptorService.getViewContainerByViewId(this.id)}get viewLocation(){return this.viewDescriptorService.getViewLocationById(this.id)}get dragAndDropController(){return this._dragAndDropController}set dragAndDropController(e){this._dragAndDropController=e,this.treeViewDnd&&(this.treeViewDnd.controller=e)}get dataProvider(){return this._dataProvider}set dataProvider(e){if(e){this.visible&&this.activate();let t=this;this._dataProvider=new class{constructor(){this._isEmpty=!0;this._onDidChangeEmpty=new E;this.onDidChangeEmpty=this._onDidChangeEmpty.event}get isTreeEmpty(){return this._isEmpty}async getChildren(o){return(await this.getChildrenBatch(o?[o]:void 0))?.[0]}updateEmptyState(o,n){if(o.length===1&&o[0]instanceof w7e){let r=this._isEmpty;this._isEmpty=n.length===0||n[0].length===0,r!==this._isEmpty&&this._onDidChangeEmpty.fire()}}findCheckboxesUpdated(o,n){if(n.length===0)return[];let r=[];for(let s=0;s<o.length;s++){let l=o[s],c=n[s];for(let u of c)u.parent=l,!t.manuallyManageCheckboxes&&l?.checkbox?.isChecked===!0&&u.checkbox?.isChecked===!1&&(u.checkbox.isChecked=!0,r.push(u))}return r}async getChildrenBatch(o){let n,r=[];if(o?.every(s=>!!s.children))n=o.map(s=>s.children);else{o=o??[t.root];let s=await(o.length===1&&o[0]instanceof w7e?Jfi(e,void 0):Jfi(e,o));for(let l=0;l<o.length;l++){let c=o[l];c.children=s?s[l]:void 0}n=s??[],r=this.findCheckboxesUpdated(o,n)}return this.updateEmptyState(o,n),r.length>0&&t._onDidChangeCheckboxState.fire(r),n}},this._dataProvider.onDidChangeEmpty&&this._register(this._dataProvider.onDidChangeEmpty(()=>{this.updateCollapseAllToggle(),this._onDidChangeWelcomeState.fire()})),this.updateMessage(),this.refresh()}else this._dataProvider=void 0,this.treeDisposables.clear(),this.activated=!1,this.updateMessage();this._onDidChangeWelcomeState.fire()}get message(){return this._message}set message(e){this._message=e,this.updateMessage(),this._onDidChangeWelcomeState.fire()}get title(){return this._title}set title(e){this._title=e,this.tree&&(this.tree.ariaLabel=this._title),this._onDidChangeTitle.fire(this._title)}get description(){return this._description}set description(e){this._description=e,this._onDidChangeDescription.fire(this._description)}get badge(){return this._badge}set badge(e){if(!(this._badge?.value===e?.value&&this._badge?.tooltip===e?.tooltip))if(this._badge=e,e){let t={badge:new qc(e.value,()=>e.tooltip),priority:50};this._activity.value=this.activityService.showViewActivity(this.id,t)}else this._activity.clear()}get canSelectMany(){return this._canSelectMany}set canSelectMany(e){let t=this._canSelectMany;this._canSelectMany=e,this._canSelectMany!==t&&this.tree?.updateOptions({multipleSelectionSupport:this.canSelectMany})}get manuallyManageCheckboxes(){return this._manuallyManageCheckboxes}set manuallyManageCheckboxes(e){this._manuallyManageCheckboxes=e}get hasIconForParentNode(){return this._hasIconForParentNode}get hasIconForLeafNode(){return this._hasIconForLeafNode}get visible(){return this.isVisible}initializeShowCollapseAllAction(e=!1){return this.collapseAllContext||(this.collapseAllContextKey=new Q(`treeView.${this.id}.enableCollapseAll`,e,d(4244,null,this.id)),this.collapseAllContext=this.collapseAllContextKey.bindTo(this.contextKeyService)),!0}get showCollapseAllAction(){return this.initializeShowCollapseAllAction(),!!this.collapseAllContext?.get()}set showCollapseAllAction(e){this.initializeShowCollapseAllAction(e),this.collapseAllContext?.set(e)}initializeShowRefreshAction(e=!1){this.refreshContext||(this.refreshContextKey=new Q(`treeView.${this.id}.enableRefresh`,e,d(4245,null,this.id)),this.refreshContext=this.refreshContextKey.bindTo(this.contextKeyService))}get showRefreshAction(){return this.initializeShowRefreshAction(),!!this.refreshContext?.get()}set showRefreshAction(e){this.initializeShowRefreshAction(e),this.refreshContext?.set(e)}registerActions(){let e=this;this._register(W(class extends K{constructor(){super({id:`workbench.actions.treeView.${e.id}.refresh`,title:d(4243,null),menu:{id:D.ViewTitle,when:x.and(x.equals("view",e.id),e.refreshContextKey),group:"navigation",order:Number.MAX_SAFE_INTEGER-1},icon:M.refresh})}async run(){return e.refresh()}})),this._register(W(class extends K{constructor(){super({id:`workbench.actions.treeView.${e.id}.collapseAll`,title:d(4240,null),menu:{id:D.ViewTitle,when:x.and(x.equals("view",e.id),e.collapseAllContextKey),group:"navigation",order:Number.MAX_SAFE_INTEGER},precondition:e.collapseAllToggleContextKey,icon:M.collapseAll})}async run(){if(e.tree)return new fPt(e.tree,!0).run()}}))}setVisibility(e){this.initialize(),e=!!e,this.isVisible!==e&&(this.isVisible=e,this.tree&&(this.isVisible?bn(this.tree.getHTMLElement()):xo(this.tree.getHTMLElement()),this.isVisible&&this.elementsToRefresh.length&&this.dataProvider&&(this.doRefresh(this.elementsToRefresh),this.elementsToRefresh=[])),Vw(()=>{this.dataProvider&&this._onDidChangeVisibility.fire(this.isVisible)}),this.visible&&this.activate())}focus(e=!0,t){if(this.tree&&this.root.children&&this.root.children.length>0){let o=t??this.tree.getSelection()[0];o&&e&&this.tree.reveal(o,.5),this.tree.domFocus()}else this.tree&&this.treeContainer&&!this.treeContainer.classList.contains("hide")?this.tree.domFocus():this.domNode.focus()}show(e){this._container=e,R(e,this.domNode)}create(){this.domNode=_(".tree-explorer-viewlet-tree-view"),this.messageElement=R(this.domNode,_(".message")),this.updateMessage(),this.treeContainer=R(this.domNode,_(".customview-tree")),this.treeContainer.classList.add("file-icon-themable-tree","show-file-icons");let e=this._register(Vn(this.domNode));this._register(e.onDidFocus(()=>this.focused=!0)),this._register(e.onDidBlur(()=>this.focused=!1))}createTree(){this.treeDisposables.clear();let e=Ca.bind(void 0,this.instantiationService),t=this.treeDisposables.add(this.instantiationService.createInstance(I7e,this.id));this.treeLabels=this.treeDisposables.add(this.instantiationService.createInstance(Za,this));let o=this.instantiationService.createInstance(Zfi,this,p=>this.progressService.withProgress({location:this.id},()=>p)),n=this.treeDisposables.add(new evi(this.themeService,this.logService)),r=this.treeDisposables.add(new FPt),s=this.treeDisposables.add(this.instantiationService.createInstance(G5,this.id,t,this.treeLabels,e,n,r,()=>this.manuallyManageCheckboxes));this.treeDisposables.add(s.onDidChangeCheckboxState(p=>this._onDidChangeCheckboxState.fire(p)));let l=this._title;this.tree=this.treeDisposables.add(this.instantiationService.createInstance(Qfi,this.id,this.treeContainer,new Xfi,[s],o,{identityProvider:new Yfi,accessibilityProvider:{getAriaLabel(p){if(p.accessibilityInformation)return p.accessibilityInformation.label;if(Ae(p.tooltip))return p.tooltip;{if(p.resourceUri&&!p.label)return null;let h="";if(p.label){let g=Mr(p.label.label)?p.label.label.value:p.label.label;h+=g+" "}return p.description&&(h+=p.description),h}},getRole(p){return p.accessibilityInformation?.role??"treeitem"},getWidgetAriaLabel(){return l}},keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:p=>p.label?Mr(p.label.label)?p.label.label.value:p.label.label:p.resourceUri?Ye(A.revive(p.resourceUri)):void 0},expandOnlyOnTwistieClick:p=>!!p.command||!!p.checkbox||this.configurationService.getValue("workbench.tree.expandMode")==="doubleClick",collapseByDefault:p=>p.collapsibleState!==2,multipleSelectionSupport:this.canSelectMany,dnd:this.treeViewDnd,overrideStyles:qz(this.viewLocation).listOverrideStyles})),this.treeDisposables.add(s.onDidChangeMenuContext(p=>p.forEach(h=>this.tree?.rerender(h)))),this.treeDisposables.add(this.tree),t.setContextKeyService(this.tree.contextKeyService),n.tree=this.tree;let c=this.treeDisposables.add(new WPt(this.notificationService,()=>this.tree.getSelection()));s.actionRunner=c,this.tree.contextKeyService.createKey(this.id,!0),H$o.bindTo(this.tree.contextKeyService).set(!0),this.treeDisposables.add(this.tree.onContextMenu(p=>this.onContextMenu(t,p,c))),this.treeDisposables.add(this.tree.onDidChangeSelection(p=>{this.lastSelection=p.elements,this.lastActive=this.tree?.getFocus()[0]??this.lastActive,this._onDidChangeSelectionAndFocus.fire({selection:this.lastSelection,focus:this.lastActive})})),this.treeDisposables.add(this.tree.onDidChangeFocus(p=>{p.elements.length&&p.elements[0]!==this.lastActive&&(this.lastActive=p.elements[0],this.lastSelection=this.tree?.getSelection()??this.lastSelection,this._onDidChangeSelectionAndFocus.fire({selection:this.lastSelection,focus:this.lastActive}))})),this.treeDisposables.add(this.tree.onDidChangeCollapseState(p=>{if(!p.node.element)return;let h=Array.isArray(p.node.element.element)?p.node.element.element[0]:p.node.element.element;p.node.collapsed?this._onDidCollapseItem.fire(h):this._onDidExpandItem.fire(h)})),this.tree.setInput(this.root).then(()=>this.updateContentAreas()),this.treeDisposables.add(this.tree.onDidOpen(async p=>{if(!p.browserEvent||p.browserEvent.target&&p.browserEvent.target.classList.contains(S7e.checkboxClass))return;let h=this.tree.getSelection(),g=await this.resolveCommand(h.length===1?h[0]:void 0);if(g&&Soo(g,this.contextKeyService)){let f=g.arguments||[];(g.id===Zh||g.id===NC)&&(f=[...f,p]);try{await this.commandService.executeCommand(g.id,...f)}catch(v){this.notificationService.error(v)}}})),this.treeDisposables.add(t.onDidChange(p=>{this.tree?.hasNode(p)&&this.tree?.rerender(p)}))}async resolveCommand(e){let t=e?.command;return e&&!t&&e instanceof Zj&&e.hasResolve&&(await e.resolve(ve.None),t=e.command),t}onContextMenu(e,t,o){this.hoverService.hideHover();let n=t.element;if(n===null)return;let r=t.browserEvent;r.preventDefault(),r.stopPropagation(),this.tree.setFocus([n]);let s=this.canSelectMany?this.getSelection():[];s.find(c=>c.handle===n.handle)||(s=[n]);let l=e.getResourceContextActions(s);l.length&&this.contextMenuService.showContextMenu({getAnchor:()=>t.anchor,getActions:()=>l,getActionViewItem:c=>{let u=this.keybindingService.lookupKeybinding(c.id);if(u)return new Lr(c,c,{label:!0,keybinding:u.getLabel()})},onHide:c=>{c&&this.tree.domFocus()},getActionsContext:()=>({$treeViewId:this.id,$treeItemHandle:n.handle}),actionRunner:o})}updateMessage(){this._message?this.showMessage(this._message):this.dataProvider?this.hideMessage():this.showMessage(B$o),this.updateContentAreas()}processMessage(e,t){let o=e.value.split(`
`),n=[],r=!1;for(let l of o){let c=lS(l);if(c.nodes.length===1&&typeof c.nodes[0]!="string"){let u=c.nodes[0],p=document.createElement("div");p.classList.add("button-container");let h=new Mi(p,{title:u.title,secondary:r,supportIcons:!0,...Ko});h.label=u.label,h.onDidClick(f=>{this.openerService.open(u.href,{allowCommands:!0})},null,t);let g=A.parse(u.href);if(g.scheme===Y.command){let f=boo(g.path);f&&(h.enabled=this.contextKeyService.contextMatchesRules(f),t.add(this.contextKeyService.onDidChangeContext(v=>{v.affectsSome(new Set(f.keys()))&&(h.enabled=this.contextKeyService.contextMatchesRules(f))})))}t.add(h),r=!0,n.push(p)}else{r=!1;let u=this.markdownRendererService.render(new xe(l,{isTrusted:e.isTrusted,supportThemeIcons:e.supportThemeIcons,supportHtml:e.supportHtml}));n.push(u.element),t.add(u)}}let s=document.createElement("div");s.classList.add("rendered-message");for(let l of n)Ao(l)?s.appendChild(l):s.appendChild(l.element);return s}showMessage(e){if(voo(this._messageValue)&&this._messageValue.disposables.dispose(),Mr(e)){let t=new P,o=this.processMessage(e,t);this._messageValue={element:o,disposables:t}}else this._messageValue=e;this.messageElement&&(this.messageElement.classList.remove("hide"),this.resetMessageElement(),typeof this._messageValue=="string"&&!Jl(this._messageValue)?this.messageElement.textContent=this._messageValue:voo(this._messageValue)&&this.messageElement.appendChild(this._messageValue.element),this.layout(this._height,this._width))}hideMessage(){this.resetMessageElement(),this.messageElement?.classList.add("hide"),this.layout(this._height,this._width)}resetMessageElement(){this.messageElement&&Rt(this.messageElement)}layout(e,t){if(e&&t&&this.messageElement&&this.treeContainer){this._height=e,this._width=t;let o=e-nh(this.messageElement);this.treeContainer.style.height=o+"px",this.tree?.layout(o,t)}}getOptimalWidth(){if(this.tree){let e=this.tree.getHTMLElement(),t=[].slice.call(e.querySelectorAll(".outline-item-label > a"));return jbe(e,t)}return 0}updateCheckboxes(e){return Ioo(e)}async refresh(e,t){if(this.dataProvider&&this.tree){this.refreshing&&await H.toPromise(this._onDidCompleteRefresh.event),e||(e=[this.root],this.elementsToRefresh=[]);for(let o of e)o.children=void 0;if(this.isVisible){let o=this.updateCheckboxes(t??[]);return this.doRefresh(e.concat(o))}else if(this.elementsToRefresh.length){let o=new Set;this.elementsToRefresh.forEach(n=>o.add(n.handle));for(let n of e)o.has(n.handle)||this.elementsToRefresh.push(n)}else this.elementsToRefresh.push(...e)}}async expand(e){let t=this.tree;if(t)try{e=Array.isArray(e)?e:[e];for(let o of e)await t.expand(o,!1)}catch{}}isCollapsed(e){return!!this.tree?.isCollapsed(e)}setSelection(e){this.tree?.setSelection(e)}getSelection(){return this.tree?.getSelection()??[]}setFocus(e){this.tree&&(e?(this.focus(!0,e),this.tree.setFocus([e])):this.tree.getFocus().length===0&&this.tree.setFocus([]))}async reveal(e){if(this.tree)return this.tree.reveal(e)}async doRefresh(e){let t=this.tree;if(t&&this.visible){this.refreshing=!0;let o=t.getSelection();try{await Promise.all(e.map(r=>t.updateChildren(r,!0,!0)))}catch(r){this.logService.error(r)}let n=t.getSelection();(o.length!==n.length||o.some((r,s)=>r.handle!==n[s].handle))&&(this.lastSelection=n,this._onDidChangeSelectionAndFocus.fire({selection:this.lastSelection,focus:this.lastActive})),this.refreshing=!1,this._onDidCompleteRefresh.fire(),this.updateContentAreas(),this.focused&&this.focus(!1),this.updateCollapseAllToggle()}}initializeCollapseAllToggle(){this.collapseAllToggleContext||(this.collapseAllToggleContextKey=new Q(`treeView.${this.id}.toggleCollapseAll`,!1,d(4246,null,this.id)),this.collapseAllToggleContext=this.collapseAllToggleContextKey.bindTo(this.contextKeyService))}updateCollapseAllToggle(){this.showCollapseAllAction&&(this.initializeCollapseAllToggle(),this.collapseAllToggleContext?.set(!!this.root.children&&this.root.children.length>0&&this.root.children.some(e=>e.collapsibleState!==0)))}updateContentAreas(){let e=!this.root.children||this.root.children.length===0;this._messageValue&&e&&!this.refreshing&&this.treeContainer?(this.dragAndDropController||this.treeContainer.classList.add("hide"),this.domNode.setAttribute("tabindex","0")):this.treeContainer&&(this.treeContainer.classList.remove("hide"),this.domNode===Pn()&&this.focus(),this.domNode.removeAttribute("tabindex"))}get container(){return this._container}};x_e=I([m(2,De),m(3,F),m(4,ge),m(5,B),m(6,Bo),m(7,ze),m(8,_e),m(9,Ne),m(10,Ri),m(11,tt),m(12,X),m(13,zl),m(14,ne),m(15,Qe),m(16,Qn)],x_e);var Yfi=class{getId(i){return i.handle}},Xfi=class{getHeight(i){return G5.ITEM_HEIGHT}getTemplateId(i){return G5.TREE_TEMPLATE_ID}};async function Jfi(a,i){return a.getChildrenBatch?a.getChildrenBatch(i):i?Promise.all(i.map(e=>a.getChildren(e).then(t=>t??[]))):[await a.getChildren()].filter(e=>e!==void 0)}var Zfi=class{constructor(i,e){this.treeView=i;this.withProgress=e}hasChildren(i){return!!this.treeView.dataProvider&&i.collapsibleState!==0}async getChildren(i){let e=this.treeView.dataProvider;if(!e)return[];this.batch===void 0?(this.batch=[i],this.batchPromise=void 0):this.batch.push(i);let t=this.batch.length-1;return new Promise((o,n)=>{setTimeout(async()=>{let r=this.batch;this.batch=void 0,this.batchPromise||(this.batchPromise=this.withProgress(Jfi(e,r)));try{let s=await this.batchPromise;o(s&&t<s.length?s[t]:[])}catch(s){s.message.startsWith("Bad progress location:")||n(s)}},0)})}},G5=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.treeViewId=e;this.menus=t;this.labels=o;this.actionViewItemProvider=n;this.aligner=r;this.checkboxStateHandler=s;this.manuallyManageCheckboxes=l;this.themeService=c;this.configurationService=u;this.labelService=p;this.contextKeyService=h;this.hoverService=g;this._onDidChangeCheckboxState=this._register(new E);this.onDidChangeCheckboxState=this._onDidChangeCheckboxState.event;this._onDidChangeMenuContext=this._register(new E);this.onDidChangeMenuContext=this._onDidChangeMenuContext.event;this._hasCheckbox=!1;this._renderedElements=new Map;this._hoverDelegate=this._register(f.createInstance(mv,"mouse",void 0,{})),this._register(this.themeService.onDidFileIconThemeChange(()=>this.rerender())),this._register(this.themeService.onDidColorThemeChange(()=>this.rerender())),this._register(s.onDidChangeCheckboxState(v=>{this.updateCheckboxes(v)})),this._register(this.contextKeyService.onDidChangeContext(v=>this.onDidChangeContext(v)))}static{this.ITEM_HEIGHT=22}static{this.TREE_TEMPLATE_ID="treeExplorer"}get templateId(){return G5.TREE_TEMPLATE_ID}set actionRunner(e){this._actionRunner=e}renderTemplate(e){e.classList.add("custom-view-tree-node-item");let t=R(e,_("")),o=this.labels.create(e,{supportHighlights:!0,hoverDelegate:this._hoverDelegate}),n=Sf(o.element,_(".custom-view-tree-node-item-icon")),r=R(o.element,_(".actions")),s=new ji(r,{actionViewItemProvider:this.actionViewItemProvider});return{resourceLabel:o,icon:n,checkboxContainer:t,actionBar:s,container:e}}getHover(e,t,o){return!(o instanceof Zj)||!o.hasResolve?t&&!o.tooltip?void 0:o.tooltip===void 0?Mr(e)?{markdown:e,markdownNotSupportedFallback:e.value}:e:Ae(o.tooltip)?o.tooltip!==""?o.tooltip:void 0:{markdown:o.tooltip,markdownNotSupportedFallback:t?void 0:qa(o.tooltip)}:{markdown:typeof o.tooltip=="string"?o.tooltip:n=>new Promise(r=>{o.resolve(n).then(()=>r(o.tooltip))}),markdownNotSupportedFallback:t?void 0:e?Mr(e)?e.value:e:""}}processLabel(e,t){if(!Mr(e))return{label:e};let o=e.value.trim(),n=!1,r=!1,s=!1;function l(p){if(t)for(let h of t)h.start-=p,h.end-=p}let c=[{open:"~~",close:"~~",mark:()=>{s=!0}},{open:"**",close:"**",mark:()=>{n=!0}},{open:"*",close:"*",mark:()=>{r=!0}},{open:"_",close:"_",mark:()=>{r=!0}}];function u(){let p=!1;for(let h of c)if(o.startsWith(h.open)&&o.endsWith(h.close)){if(t?.some(g=>g.start<h.open.length||g.end>o.length-h.close.length))return!1;h.mark(),o=o.substring(h.open.length,o.length-h.close.length),l(h.open.length),p=!0}return p}for(let p=0;p<10&&u();p++);return{label:o,bold:n,italic:r,strikethrough:s,supportIcons:e.supportThemeIcons}}renderElement(e,t,o){let n=e.element,r=n.resourceUri?A.revive(n.resourceUri):null,s=n.label?n.label:r?{label:Ye(r)}:void 0,l=Ae(n.description)?n.description:r&&n.description===!0?this.labelService.getUriLabel(ci(r),{relative:!0}):void 0,c=s?Mr(s.label)?s.label.value:s.label:void 0,u=s?.highlights&&c?s.highlights.map(([N,O])=>{if(N<0&&(N=c.length+N),O<0&&(O=c.length+O),N>=c.length||O>c.length)return{start:0,end:0};if(N>O){let V=N;N=O,O=V}return{start:N,end:O}}):void 0,{label:p,bold:h,italic:g,strikethrough:f,supportIcons:v}=this.processLabel(s?.label,u),b=Ip(this.themeService.getColorTheme().type)?n.iconDark:n.icon,S=b?A.revive(b):void 0,y=this.getHover(s?.label,r,n);o.actionBar.clear(),o.icon.style.color="";let w=!0;if(n.command&&(w=Soo(n.command,this.contextKeyService)),this.renderCheckbox(n,o),r){let N=this.configurationService.getValue("explorer.decorations"),O=r||A.parse("missing:_icon_resource");o.resourceLabel.setResource({name:p,description:l,resource:O},{fileKind:this.getFileKind(n),title:y,hideIcon:this.shouldHideResourceLabelIcon(S,n.themeIcon),fileDecorations:N,extraClasses:["custom-view-tree-node-item-resourceLabel"],matches:u||ua(e.filterData),bold:h,italic:g,strikethrough:f,disabledCommand:!w,labelEscapeNewLines:!0,forceLabel:!!n.label,supportIcons:v})}else o.resourceLabel.setResource({name:p,description:l},{title:y,hideIcon:!0,extraClasses:["custom-view-tree-node-item-resourceLabel"],matches:u||ua(e.filterData),bold:h,italic:g,strikethrough:f,disabledCommand:!w,labelEscapeNewLines:!0,supportIcons:v});if(S)o.icon.className="custom-view-tree-node-item-icon",o.icon.style.backgroundImage=Na(S);else{let N;this.shouldShowThemeIcon(!!r,n.themeIcon)&&(N=q.asClassName(n.themeIcon),n.themeIcon.color&&(o.icon.style.color=this.themeService.getColorTheme().getColor(n.themeIcon.color.id)?.toString()??"")),o.icon.className=N?`custom-view-tree-node-item-icon ${N}`:"",o.icon.style.backgroundImage=""}w||(o.icon.className=o.icon.className+" disabled",o.container.parentElement&&(o.container.parentElement.className=o.container.parentElement.className+" disabled")),o.actionBar.context={$treeViewId:this.treeViewId,$treeItemHandle:n.handle};let k=this.menus.getResourceActions([n]);o.actionBar.push(k,{icon:!0,label:!1}),this._actionRunner&&(o.actionBar.actionRunner=this._actionRunner),this.setAlignment(o.container,n);let T=this._renderedElements.get(e.element.handle)??[];this._renderedElements.set(e.element.handle,[...T,{original:e,rendered:o}])}rerender(){let e=new Set(this._renderedElements.keys());for(let t of e){let o=this._renderedElements.get(t)??[];for(let n of o)this.disposeElement(n.original,0,n.rendered),this.renderElement(n.original,0,n.rendered)}}renderCheckbox(e,t){if(e.checkbox){if(this._hasCheckbox||(this._hasCheckbox=!0,this.rerender()),!t.checkbox){let o=new S7e(t.checkboxContainer,this.checkboxStateHandler,this._hoverDelegate,this.hoverService);t.checkbox=o}t.checkbox.render(e)}else t.checkbox&&(t.checkbox.dispose(),t.checkbox=void 0)}setAlignment(e,t){e.parentElement.classList.toggle("align-icon-with-twisty",this.aligner.alignIconWithTwisty(t))}shouldHideResourceLabelIcon(e,t){return!!e||!!t&&!this.isFileKindThemeIcon(t)}shouldShowThemeIcon(e,t){return t?!(e&&this.isFileKindThemeIcon(t)):!1}isFileKindThemeIcon(e){return q.isFile(e)||q.isFolder(e)}getFileKind(e){if(e.themeIcon)switch(e.themeIcon.id){case G$i.id:return 0;case X$.id:return 1}return e.collapsibleState===1||e.collapsibleState===2?1:0}onDidChangeContext(e){let t=e.affectsSome(this.menus.getEntireMenuContexts()),o=[];for(let[n,r]of this._renderedElements)for(let s of r)(t||e.affectsSome(this.menus.getElementOverlayContexts(s.original.element)))&&o.push(s.original.element);o.length&&this._onDidChangeMenuContext.fire(o)}updateCheckboxes(e){let t=[];this.manuallyManageCheckboxes()?t=e:t=Ioo(e),t.forEach(o=>{let n=this._renderedElements.get(o.handle);n&&n.forEach(r=>r.rendered.checkbox?.render(o))}),this._onDidChangeCheckboxState.fire(t)}disposeElement(e,t,o){let n=this._renderedElements.get(e.element.handle)??[],r=n.findIndex(s=>o===s.rendered);n.length===1?this._renderedElements.delete(e.element.handle):n.length>0&&n.splice(r,1),o.checkbox?.dispose(),o.checkbox=void 0}disposeTemplate(e){e.resourceLabel.dispose(),e.actionBar.dispose()}};G5=I([m(7,De),m(8,B),m(9,ot),m(10,X),m(11,tt),m(12,F)],G5);var evi=class extends C{constructor(e,t){super();this.themeService=e;this.logService=t}set tree(e){this._tree=e}alignIconWithTwisty(e){if(e.collapsibleState!==0||!this.hasIconOrCheckbox(e))return!1;if(this._tree){let t=this._tree.getInput(),o;try{o=this._tree.getParentElement(e)||t}catch(n){return this.logService.error(`[TreeView] Failed to resolve parent for ${e.handle}`,n),!1}return this.hasIconOrCheckbox(o)?!!o.children&&o.children.some(n=>n.collapsibleState!==0&&!this.hasIconOrCheckbox(n)):!!o.children&&o.children.every(n=>n.collapsibleState===0||!this.hasIconOrCheckbox(n))}else return!1}hasIconOrCheckbox(e){return this.hasIcon(e)||!!e.checkbox}hasIcon(e){if(Ip(this.themeService.getColorTheme().type)?e.iconDark:e.icon)return!0;if(e.resourceUri||e.themeIcon){let o=this.themeService.getFileIconTheme();return(e.themeIcon?e.themeIcon.id===X$.id:e.collapsibleState!==0)?o.hasFileIcons&&o.hasFolderIcons:o.hasFileIcons}return!1}},WPt=class extends as{constructor(e,t){super();this.getSelectedResources=t;this._register(this.onDidRun(o=>{o.error&&!so(o.error)&&e.error(d(4241,null,o.error.message,o.action.id))}))}async runAction(e,t){let o=this.getSelectedResources(),n,r=!1;o.length>1&&(n=o.map(s=>((s.handle===t.$treeItemHandle||t.$selectedTreeItems)&&(r=!0),{$treeViewId:t.$treeViewId,$treeItemHandle:s.handle}))),!r&&n&&(n=void 0),await e.run(t,n)}},I7e=class{constructor(i,e){this.id=i;this.menuService=e;this._onDidChange=new E;this.onDidChange=this._onDidChange.event}getResourceActions(i){return this.getActions(this.getMenuId(),i).primary}getResourceContextActions(i){return this.getActions(this.getMenuId(),i).secondary}setContextKeyService(i){this.contextKeyService=i}filterNonUniversalActions(i,e){let t=new Set(e.map(o=>o.id));for(let o of i){let n=o.keys();for(let r of n)t.has(r)||o.delete(r)}}buildMenu(i){let e=[];for(let t of i)t.size>0&&(e.length&&e.push(new li),e.push(...t.values()));return e}createGroups(i){let e=[],t=new Map;for(let o of i)o instanceof li?(e.push(t),t=new Map):t.set(o.id,o);return e.push(t),e}getElementOverlayContexts(i){return new Map([["view",this.id],["viewItem",i.contextValue]])}getEntireMenuContexts(){return this.menuService.getMenuContexts(this.getMenuId())}getMenuId(){return D.ViewItemContext}getActions(i,e){if(!this.contextKeyService)return{primary:[],secondary:[]};let t=[],o=[];for(let n=0;n<e.length;n++){let r=e[n],s=this.contextKeyService.createOverlay(this.getElementOverlayContexts(r)),l=this.menuService.getMenuActions(i,s,{shouldForwardArgs:!0}),c=Ef(l,"inline");n===0?(t=this.createGroups(c.primary),o=this.createGroups(c.secondary)):(this.filterNonUniversalActions(t,c.primary),this.filterNonUniversalActions(o,c.secondary))}return{primary:this.buildMenu(t),secondary:this.buildMenu(o)}}dispose(){this.contextKeyService=void 0,this._onDidChange.dispose()}};I7e=I([m(1,qt)],I7e);var k_e=class extends x_e{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T){super(e,t,n,r,s,l,c,u,p,h,g,v,f,S,w,k,T);this.extensionId=o;this.extensionService=b;this.telemetryService=y}activate(){this.activated||(this.telemetryService.publicLog2("Extension:ViewActivate",{extensionId:new Im(this.extensionId),id:this.id}),this.createTree(),this.progressService.withProgress({location:this.id},()=>this.extensionService.activateByEvent(`onView:${this.id}`)).then(()=>Pi(2e3)).then(()=>{this.updateMessage()}),this.activated=!0)}};k_e=I([m(3,De),m(4,F),m(5,ge),m(6,B),m(7,Bo),m(8,ze),m(9,_e),m(10,Ne),m(11,Ri),m(12,X),m(13,tt),m(14,lt),m(15,zl),m(16,Te),m(17,ne),m(18,Qe),m(19,Qn)],k_e);var pK=class extends x_e{activate(){this.activated||(this.createTree(),this.activated=!0)}},y7e=class{constructor(i,e,t,o,n){this.treeId=i;this.labelService=e;this.instantiationService=t;this.treeViewsDragAndDropService=o;this.logService=n;this.treeItemsTransfer=VI.getInstance();this.treeMimeType=`application/vnd.code.tree.${i.toLowerCase()}`}set controller(i){this.dndController=i}handleDragAndLog(i,e,t,o){return i.handleDrag(e,t,o).then(n=>{if(n){let r=[];for(let s of n)s[0]!==this.treeMimeType&&i.dragMimeTypes.findIndex(l=>l===s[0])<0&&r.push(s[0]);r.length&&this.logService.warn(`Drag and drop controller for tree ${this.treeId} adds the following data transfer types but does not declare them in dragMimeTypes: ${r.join(", ")}`)}return n})}addExtensionProvidedTransferTypes(i,e){if(!i.dataTransfer||!this.dndController)return;let t=_t();this.dragCancellationToken=new $e,this.treeViewsDragAndDropService.addDragOperationTransfer(t,this.handleDragAndLog(this.dndController,e,t,this.dragCancellationToken.token)),this.treeItemsTransfer.setData([new sC(t)],sC.prototype),i.dataTransfer.clearData(Zn.text),this.dndController.dragMimeTypes.find(o=>o===Zn.uriList)&&i.dataTransfer?.setData(Aa.RESOURCES,""),this.dndController.dragMimeTypes.forEach(o=>{i.dataTransfer?.setData(o,"")})}addResourceInfoToTransfer(i,e){if(e.length&&i.dataTransfer){this.instantiationService.invokeFunction(o=>Ig(o,e,i));let t=e.filter(o=>o.scheme===Y.file).map(o=>o.fsPath);t.length&&i.dataTransfer.setData(Ll.FILES,JSON.stringify(t))}}onDragStart(i,e){if(e.dataTransfer){let t=i.getData(),o=[],n={id:this.treeId,itemHandles:[]};t.forEach(r=>{n.itemHandles.push(r.handle),r.resourceUri&&o.push(A.revive(r.resourceUri))}),this.addResourceInfoToTransfer(e,o),this.addExtensionProvidedTransferTypes(e,n.itemHandles),e.dataTransfer.setData(this.treeMimeType,JSON.stringify(n))}}debugLog(i){i.size?this.logService.debug(`TreeView dragged mime types: ${Array.from(i).join(", ")}`):this.logService.debug("TreeView dragged with no supported mime types.")}onDragOver(i,e,t,o,n){let r=$se(n.dataTransfer),s=new Set(Array.from(r,u=>u[0]));if(n.dataTransfer){for(let u of n.dataTransfer.items)if(u.kind==="file"||u.type===Aa.RESOURCES.toLowerCase()){s.add(Zn.uriList);break}}this.debugLog(s);let l=this.dndController;return!l||!n.dataTransfer||l.dropMimeTypes.length===0?!1:Array.from(s).some((u,p)=>u===this.treeMimeType?!0:l.dropMimeTypes.indexOf(u)>=0)?{accept:!0,bubble:0,autoExpand:!0}:!1}getDragURI(i){return this.dndController?i.resourceUri?A.revive(i.resourceUri).toString():i.handle:null}getDragLabel(i){if(!this.dndController)return;if(i.length>1)return String(i.length);let e=i[0];return e.label?Mr(e.label.label)?e.label.label.value:e.label.label:e.resourceUri?this.labelService.getUriLabel(A.revive(e.resourceUri)):void 0}async drop(i,e,t,o,n){let r=this.dndController;if(!n.dataTransfer||!r)return;let s,l;this.treeItemsTransfer.hasData(sC.prototype)&&(l=this.treeItemsTransfer.getData(sC.prototype)[0].identifier);let c=$se(n.dataTransfer,!0),u=new bx;for(let[h,g]of c)if((h===this.treeMimeType||r.dropMimeTypes.includes(h)||g.asFile()&&r.dropMimeTypes.includes(Aa.FILES.toLowerCase()))&&(u.append(h,g),h===this.treeMimeType))try{s=JSON.parse(await g.asString())}catch{}let p=await this.treeViewsDragAndDropService.removeDragOperationTransfer(l);if(p)for(let[h,g]of p)u.append(h,g);return r.handleDrop(u,e,ve.None,l,s?.id,s?.itemHandles)}onDragEnd(i){i.dataTransfer?.dropEffect==="none"&&this.dragCancellationToken?.cancel()}dispose(){}};y7e=I([m(1,ot),m(2,F),m(3,Yq),m(4,ne)],y7e);function Ioo(a){let i=[];for(let e of a)if(e.checkbox!==void 0){let t=r=>{for(let s of r.children??[])s.checkbox!==void 0&&r.checkbox!==void 0&&s.checkbox.isChecked!==r.checkbox.isChecked&&(s.checkbox.isChecked=r.checkbox.isChecked,i.push(s),t(s))};t(e);let o=new Set,n=r=>{if(r.parent?.checkbox!==void 0&&r.parent.children){if(o.has(r.parent))return;o.add(r.parent);let s=!1,l=!1;for(let c of r.parent.children){if(s&&l)break;c.checkbox!==void 0&&(c.checkbox.isChecked?l=!0:s=!0)}l&&!s&&r.parent.checkbox.isChecked!==!0?(r.parent.checkbox.isChecked=!0,i.push(r.parent),n(r.parent)):s&&r.parent.checkbox.isChecked!==!1&&(r.parent.checkbox.isChecked=!1,i.push(r.parent),n(r.parent))}};n(e)}return a.concat(i)}var Hf="workbench.view.explorer",Cb="workbench.explorer.fileView",yoo=new Q("explorerViewletVisible",!0,{type:"boolean",description:d(10523,null)}),$5=new Q("foldersViewVisible",!0,{type:"boolean",description:d(10525,null)}),lu=new Q("explorerResourceIsFolder",!1,{type:"boolean",description:d(10514,null)}),tvi=new Q("explorerResourceReadonly",!1,{type:"boolean",description:d(10518,null)}),pF=tvi.toNegated(),ivi=new Q("explorerResourceParentReadonly",!1,{type:"boolean",description:d(10517,null)}),VPt=new Q("explorerResourceAvailableEditorIds",""),FC=new Q("explorerResourceIsRoot",!1,{type:"boolean",description:d(10515,null)}),BPt=new Q("explorerResourceCut",!1,{type:"boolean",description:d(10513,null)}),due=new Q("explorerResourceMoveableToTrash",!1,{type:"boolean",description:d(10516,null)}),ovi=new Q("filesExplorerFocus",!0,{type:"boolean",description:d(10524,null)}),woo=new Q("openEditorsFocus",!0,{type:"boolean",description:d(10526,null)}),C7e=new Q("explorerViewletFocus",!0,{type:"boolean",description:d(10522,null)}),HPt=new Q("explorerFindProviderActive",!1,{type:"boolean",description:d(10512,null)}),uue=new Q("explorerViewletCompressedFocus",!0,{type:"boolean",description:d(10520,null)}),x7e=new Q("explorerViewletCompressedFirstFocus",!0,{type:"boolean",description:d(10519,null)}),k7e=new Q("explorerViewletCompressedLastFocus",!0,{type:"boolean",description:d(10521,null)}),Coo=new Q("viewHasSomeCollapsibleItem",!1,{type:"boolean",description:d(10527,null)}),WC=x.and($5,ovi,x.not(Uu)),xoo=x.and($5,C7e,x.not(Uu)),mF="workbench.editors.files.textFileEditor",pue="workbench.editors.files.fileEditorInput",UPt="workbench.editors.files.binaryFileEditor",E_e="code-text-binary";var wR=class extends C{constructor(e,t,o,n){super();this.textFileService=e;this.fileService=t;this.languageService=o;this.modelService=n;this.fileWatcherDisposable=this._register(new me)}static async open(e,t,o,n,r){await n.openEditor({original:{resource:wR.resourceToTextFile(t,e)},modified:{resource:e},label:o,options:r})}static resourceToTextFile(e,t){return t.with({scheme:e,query:JSON.stringify({scheme:t.scheme,query:t.query})})}static textFileToResource(e){let{scheme:t,query:o}=JSON.parse(e.query);return e.with({scheme:t,query:o})}async provideTextContent(e){if(!e.query)return null;let t=wR.textFileToResource(e),o=await this.resolveEditorModel(e);if(!this.fileWatcherDisposable.value){let n=new P;this.fileWatcherDisposable.value=n,n.add(this.fileService.onDidFilesChange(r=>{r.contains(t,0)&&this.resolveEditorModel(e,!1)})),o&&n.add(H.once(o.onWillDispose)(()=>this.fileWatcherDisposable.clear()))}return o}async resolveEditorModel(e,t=!0){let o=wR.textFileToResource(e),n=await this.textFileService.readStream(o),r=this.modelService.getModel(e);if(r)this.modelService.updateModel(r,n.value);else if(t){let s=this.modelService.getModel(o),l;s?l=this.languageService.createById(s.getLanguageId()):l=this.languageService.createByFilepathOrFirstLine(o),r=this.modelService.createModel(n.value,l,e)}return r}};wR=I([m(0,Ho),m(1,be),m(2,kt),m(3,Ct)],wR);var wh=class a{constructor(i,e){this._editor=i;this._group=e;this.id=a.COUNTER++}static{this.COUNTER=0}get editor(){return this._editor}get group(){return this._group}get groupId(){return this._group.id}getId(){return`openeditor:${this.groupId}:${this.id}`}isPreview(){return!this._group.isPinned(this.editor)}isSticky(){return this._group.isSticky(this.editor)}getResource(){return no.getOriginalUri(this.editor,{supportSideBySide:1})}};var nvi=Re("remote-explorer-get-started",M.star,d(12718,null)),rvi=Re("remote-explorer-documentation",M.book,d(12713,null)),TXl=Re("remote-explorer-feedback",M.twitter,d(12714,null)),svi=Re("remote-explorer-review-issues",M.issues,d(12727,null)),avi=Re("remote-explorer-report-issues",M.comment,d(12726,null)),koo=Re("remote-explorer-view-icon",M.remoteExplorer,d(12725,null)),zPt=Re("ports-view-icon",M.plug,d(12723,null)),_Xl=Re("ports-view-icon",M.plug,d(12722,null)),lvi=Re("private-ports-view-icon",M.lock,d(12724,null)),Eoo=Re("ports-forward-icon",M.plus,d(12717,null)),Too=Re("ports-stop-forward-icon",M.x,d(12728,null)),_oo=Re("ports-open-browser-icon",M.globe,d(12720,null)),Doo=Re("ports-open-preview-icon",M.openPreview,d(12721,null)),Loo=Re("ports-copy-address-icon",M.clippy,d(12712,null)),cvi=Re("ports-label-icon",M.tag,d(12719,null)),Roo=Re("ports-forwarded-without-process-icon",M.circleOutline,d(12715,null)),Moo=Re("ports-forwarded-with-process-icon",M.circleFilled,d(12716,null));var Poo=new Q("openPreviewEnabled",!1),dvi=class{constructor(i){this.remoteExplorerService=i;this.headerRowHeight=22}getHeight(i){return i.tunnelType==="Add"&&!this.remoteExplorerService.getEditableData(void 0)?30:22}},T_e=class{constructor(i,e){this.remoteExplorerService=i;this.tunnelService=e;this._candidates=new Map;this.input={label:d(12787,null),icon:void 0,tunnelType:"Add",hasRunningProcess:!1,remoteHost:"",remotePort:0,processDescription:"",tooltipPostfix:"",iconTooltip:"",portTooltip:"",processTooltip:"",originTooltip:"",privacyTooltip:"",source:{source:0,description:""},protocol:"http",privacy:{id:"private",themeIcon:lvi.id,label:d(12811,null)},strip:()=>{}};this.model=i.tunnelModel,this.onForwardedPortsChanged=H.any(this.model.onForwardPort,this.model.onClosePort,this.model.onPortName,this.model.onCandidatesChanged)}get all(){let i=[];return this._candidates=new Map,this.model.candidates.forEach(e=>{this._candidates.set(Tp(e.host,e.port),e)}),(this.model.forwarded.size>0||this.remoteExplorerService.getEditableData(void 0))&&i.push(...this.forwarded),this.model.detected.size>0&&i.push(...this.detected),i.push(this.input),i}addProcessInfoFromCandidate(i){let e=Tp(i.remoteHost,i.remotePort);this._candidates.has(e)&&(i.processDescription=this._candidates.get(e).detail)}get forwarded(){return Array.from(this.model.forwarded.values()).map(e=>{let t=VC.createFromTunnel(this.remoteExplorerService,this.tunnelService,e);return this.addProcessInfoFromCandidate(t),t}).sort((e,t)=>e.remotePort===t.remotePort?e.remoteHost<t.remoteHost?-1:1:e.remotePort<t.remotePort?-1:1)}get detected(){return Array.from(this.model.detected.values()).map(i=>{let e=VC.createFromTunnel(this.remoteExplorerService,this.tunnelService,i,"Detected",!1);return this.addProcessInfoFromCandidate(e),e})}isEmpty(){return this.detected.length===0&&(this.forwarded.length===0||this.forwarded.length===1&&this.forwarded[0].tunnelType==="Add"&&!this.remoteExplorerService.getEditableData(void 0))}};T_e=I([m(0,Gd),m(1,ap)],T_e);function D7e(a){return{label:"",tunnel:a,editId:0,tooltip:""}}var uvi=class{constructor(){this.label="";this.tooltip="";this.weight=1;this.minimumWidth=40;this.maximumWidth=40;this.templateId="actionbar"}project(i){if(i.tunnelType==="Add")return D7e(i);let e=i.processDescription?Moo:Roo,t="";return i instanceof VC&&(t=`${i.iconTooltip} ${i.tooltipPostfix}`),{label:"",icon:e,tunnel:i,editId:0,tooltip:t}}},pvi=class{constructor(){this.label=d(12803,null);this.tooltip=d(12804,null);this.weight=1;this.templateId="actionbar"}project(i){let e=i.tunnelType==="Add",t=i.label,o="";return i instanceof VC&&!e?o=`${i.portTooltip} ${i.tooltipPostfix}`:o=t,{label:t,tunnel:i,menuId:D.TunnelPortInline,editId:i.tunnelType==="Add"?1:2,tooltip:o}}},mvi=class a{constructor(){this.label=d(12796,null);this.tooltip=d(12797,null);this.weight=1;this.templateId="actionbar"}project(i){if(i.tunnelType==="Add")return D7e(i);let e=i.localAddress??"",t=e;return i instanceof VC&&(t=i.tooltipPostfix),{label:e,menuId:D.TunnelLocalAddressInline,tunnel:i,editId:3,tooltip:t,markdownTooltip:e?a.getHoverText(e):void 0}}static getHoverText(i){return function(e){let t=e.getValue("editor"),o="";t.multiCursorModifier==="ctrlCmd"?it?o=d(12757,null):o=d(12756,null):it?o=d(12758,null):o=d(12759,null);let n=new xe("",!0),r=i.startsWith("http")?i:`http://${i}`;return n.appendLink(r,"Follow link").appendMarkdown(` (${o})`)}}},hvi=class{constructor(){this.label=d(12807,null);this.tooltip=d(12808,null);this.weight=2;this.templateId="actionbar"}project(i){return i.tunnelType==="Add"?D7e(i):{label:i.processDescription??"",tunnel:i,editId:0,tooltip:i instanceof VC?i.processTooltip:""}}},gvi=class{constructor(){this.label=d(12801,null);this.tooltip=d(12802,null);this.weight=1;this.templateId="actionbar"}project(i){if(i.tunnelType==="Add")return D7e(i);let e=i.source.description,t=`${i instanceof VC?i.originTooltip:""}. ${i instanceof VC?i.tooltipPostfix:""}`;return{label:e,menuId:D.TunnelOriginInline,tunnel:i,editId:0,tooltip:t}}},fvi=class{constructor(){this.label=d(12805,null);this.tooltip=d(12806,null);this.weight=1;this.templateId="actionbar"}project(i){if(i.tunnelType==="Add")return D7e(i);let e=i.privacy?.label,t="";return i instanceof VC&&(t=`${i.privacy.label} ${i.tooltipPostfix}`),{label:e,tunnel:i,icon:{id:i.privacy.themeIcon},editId:0,tooltip:t}}},E7e=class{constructor(i,e,t,o,n,r,s){this.instantiationService=i;this.contextKeyService=e;this.menuService=t;this.contextViewService=o;this.remoteExplorerService=n;this.commandService=r;this.configurationService=s;this.templateId="actionbar";this._hoverDelegate=Ni("mouse")}set actionRunner(i){this._actionRunner=i}renderTemplate(i){let e=R(i,_(".ports-view-actionbar-cell")),t=R(e,_(".ports-view-actionbar-cell-icon")),o=new P,n=new P;o.add(n);let r=o.add(new Lc(e,{supportHighlights:!0,hoverDelegate:this._hoverDelegate})),s=R(e,_(".actions")),l=o.add(new ji(s,{actionViewItemProvider:Ca.bind(void 0,this.instantiationService),hoverDelegate:this._hoverDelegate}));return{label:r,icon:t,actionBar:l,container:e,templateDisposables:o,elementDisposables:n}}renderElement(i,e,t){t.actionBar.clear(),t.icon.className="ports-view-actionbar-cell-icon",t.icon.style.display="none",t.label.setLabel(""),t.label.element.style.display="none",t.container.style.height="22px",t.button&&(t.button.element.style.display="none"),t.container.style.paddingLeft="0px",t.elementDisposables.clear();let o;i.editId===1&&(o=this.remoteExplorerService.getEditableData(void 0))?this.renderInputBox(t,o):(o=this.remoteExplorerService.getEditableData(i.tunnel,i.editId),o?this.renderInputBox(t,o):i.tunnel.tunnelType==="Add"&&i.menuId===D.TunnelPortInline?this.renderButton(i,t):this.renderActionBarItem(i,t))}renderButton(i,e){e.container.style.paddingLeft="7px",e.container.style.height="28px",e.button=e.elementDisposables.add(new Mi(e.container,Ko)),e.button.label=i.label,e.button.element.title=i.tooltip,e.elementDisposables.add(e.button.onDidClick(()=>{this.commandService.executeCommand(gw.INLINE_ID)}))}tunnelContext(i){let e;return i instanceof VC&&(e=i.strip()),e||(e={tunnelType:i.tunnelType,remoteHost:i.remoteHost,remotePort:i.remotePort,localAddress:i.localAddress,protocol:i.protocol,localUri:i.localUri,localPort:i.localPort,name:i.name,closeable:i.closeable,source:i.source,privacy:i.privacy,processDescription:i.processDescription,label:i.label}),e}renderActionBarItem(i,e){e.label.element.style.display="flex",e.label.setLabel(i.label,void 0,{title:i.markdownTooltip?{markdown:i.markdownTooltip(this.configurationService),markdownNotSupportedFallback:i.tooltip}:i.tooltip,extraClasses:i.menuId===D.TunnelLocalAddressInline?["ports-view-actionbar-cell-localaddress"]:void 0}),e.actionBar.context=this.tunnelContext(i.tunnel),e.container.style.paddingLeft="10px";let t=[["view",P5],[L7e.key,i.tunnel.tunnelType],[R7e.key,i.tunnel.closeable],[vvi.key,i.tunnel.privacy.id],[GPt.key,i.tunnel.protocol]],o=this.contextKeyService.createOverlay(t);if(i.menuId){let n=e.elementDisposables.add(this.menuService.createMenu(i.menuId,o)),r=Vm(n.getActions({shouldForwardArgs:!0}));if(r){let s=r.filter(l=>l.id.toLowerCase().indexOf("label")>=0);s.length>1&&(s.sort((l,c)=>l.label.length-c.label.length),s.pop(),r=r.filter(l=>s.indexOf(l)<0)),e.actionBar.push(r,{icon:!0,label:!1}),this._actionRunner&&(e.actionBar.actionRunner=this._actionRunner)}}i.icon&&(e.icon.className=`ports-view-actionbar-cell-icon ${q.asClassName(i.icon)}`,e.icon.title=i.tooltip,e.icon.style.display="inline")}renderInputBox(i,e){this.inputDone&&(this.inputDone(!1,!1),this.inputDone=void 0);let{container:t}=i;t.style.paddingLeft="5px";let o=e.startingValue||"",n=new Dc(t,this.contextViewService,{ariaLabel:d(12789,null),validationOptions:{validation:l=>{let c=e.validationMessage(l);return c?{content:c.content,formatContent:!0,type:c.severity===St.Error?3:1}:null}},placeholder:e.placeholder||"",inputBoxStyles:pl});n.value=o,n.focus(),n.select({start:0,end:e.startingValue?e.startingValue.length:0});let r=wd(async(l,c)=>{Ue(s),this.inputDone&&(this.inputDone=void 0),n.element.style.display="none";let u=n.value;if(c)return e.onFinish(u,l)});this.inputDone=r;let s=[n,Vo(n.inputElement,re.KEY_DOWN,async l=>{if(l.equals(3))return l.stopPropagation(),n.validate()!==3?r(!0,!0):r(!1,!0);if(l.equals(9))return l.preventDefault(),l.stopPropagation(),r(!1,!0)}),j(n.inputElement,re.BLUR,()=>r(n.validate()!==3,!0))];i.elementDisposables.add(Z(()=>{r(!1,!1)}))}disposeElement(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.templateDisposables.dispose()}};E7e=I([m(0,F),m(1,X),m(2,qt),m(3,_n),m(4,Gd),m(5,ge),m(6,B)],E7e);var VC=class a{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){this.tunnelType=i;this.remoteHost=e;this.remotePort=t;this.source=o;this.hasRunningProcess=n;this.protocol=r;this.localUri=s;this.localAddress=l;this.localPort=c;this.closeable=u;this.name=p;this.runningProcess=h;this.pid=g;this._privacy=f;this.remoteExplorerService=v;this.tunnelService=b}static createFromTunnel(i,e,t,o="Forwarded",n){return new a(o,t.remoteHost,t.remotePort,t.source,!!t.hasRunningProcess,t.protocol,t.localUri,t.localAddress,t.localPort,n===void 0?t.closeable:n,t.name,t.runningProcess,t.pid,t.privacy,i,e)}strip(){return new a(this.tunnelType,this.remoteHost,this.remotePort,this.source,this.hasRunningProcess,this.protocol,this.localUri,this.localAddress,this.localPort,this.closeable,this.name,this.runningProcess,this.pid,this._privacy)}get label(){if(this.tunnelType==="Add"&&this.name)return this.name;let i=jX(this.remoteHost)||M5(this.remoteHost)?`${this.remotePort}`:`${this.remoteHost}:${this.remotePort}`;return this.name?`${this.name} (${i})`:i}set processDescription(i){this.runningProcess=i}get processDescription(){let i="";return this.runningProcess?(this.pid&&this.remoteExplorerService?.namedProcesses.has(this.pid)?i=this.remoteExplorerService.namedProcesses.get(this.pid):i=this.runningProcess.replace(/\0/g," ").trim(),this.pid&&(i+=` (${this.pid})`)):this.hasRunningProcess&&(i=d(12814,null)),i}get tooltipPostfix(){let i;return this.localAddress?i=d(12785,null,this.remoteHost,this.remotePort,this.localAddress):i=d(12784,null,this.remoteHost,this.remotePort),i}get iconTooltip(){return this.tunnelType==="Add"?this.label:`${this.processDescription?d(12800,null):d(12799,null)}`}get portTooltip(){return this.tunnelType==="Add"?"":`${this.name?d(12786,null,this.name):""}`}get processTooltip(){return this.processDescription??""}get originTooltip(){return this.source.description}get privacy(){return this.tunnelService?.privacyOptions?this.tunnelService?.privacyOptions.find(i=>i.id===this._privacy)??{id:"",themeIcon:M.question.id,label:d(12812,null)}:{id:"private",themeIcon:lvi.id,label:d(12811,null)}}},L7e=new Q("tunnelType","Add",!0),R7e=new Q("tunnelCloseable",!1,!0),vvi=new Q("tunnelPrivacy",void 0,!0),Aoo=new Q("tunnelPrivacyEnabled",!1,!0),GPt=new Q("tunnelProtocol","http",!0),$Pt=new Q("tunnelViewFocus",!1,d(12798,null)),M7e="tunnelViewSelection",K$o=new Q(M7e,void 0,!0),Noo="tunnelViewMultiSelection",Ooo=new Q(Noo,void 0,!0),Foo=new Q("portChangable",!1,!0),Woo=new Q("protocolChangable",!0,!0),hF=class extends zr{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super(t,o,n,s,r,c,l,u,f,b);this.viewModel=e;this.quickInputService=p;this.commandService=h;this.menuService=g;this.remoteExplorerService=v;this.tunnelService=S;this.contextViewService=y;this.tableDisposables=this._register(new P);this.isEditing=!1;this.titleActions=[];this.lastFocus=[];this.height=0;this.width=0;this.tunnelTypeContext=L7e.bindTo(r),this.tunnelCloseableContext=R7e.bindTo(r),this.tunnelPrivacyContext=vvi.bindTo(r),this.tunnelPrivacyEnabledContext=Aoo.bindTo(r),this.tunnelPrivacyEnabledContext.set(S.canChangePrivacy),this.protocolChangableContextKey=Woo.bindTo(r),this.protocolChangableContextKey.set(S.canChangeProtocol),this.tunnelProtocolContext=GPt.bindTo(r),this.tunnelViewFocusContext=$Pt.bindTo(r),this.tunnelViewSelectionContext=K$o.bindTo(r),this.tunnelViewMultiSelectionContext=Ooo.bindTo(r),this.portChangableContextKey=Foo.bindTo(r);let w=this.contextKeyService.createOverlay([["view",hF.ID]]),k=this._register(this.menuService.createMenu(D.TunnelTitle,w)),T=()=>{this.titleActions=Vm(k.getActions()),this.updateActions()};this._register(k.onDidChange(T)),T(),this._register(Z(()=>{this.titleActions=[]})),this.registerPrivacyActions(),this._register(H.once(this.tunnelService.onAddedTunnelProvider)(()=>{let N=!1;this.tunnelPrivacyEnabledContext.get()===!1&&(this.tunnelPrivacyEnabledContext.set(S.canChangePrivacy),N=!0),this.protocolChangableContextKey.get()===!0&&(this.protocolChangableContextKey.set(S.canChangeProtocol),N=!0),N&&(T(),this.registerPrivacyActions(),this.createTable(),this.table?.layout(this.height,this.width))}))}static{this.ID=P5}static{this.TITLE=L(12761,"Ports")}registerPrivacyActions(){for(let e of this.tunnelService.privacyOptions){let t=`remote.tunnel.privacy${e.id}`;qe.registerCommand(t,Uoo.handler(e.id)),fe.appendMenuItem(D.TunnelPrivacy,{order:0,command:{id:t,title:e.label,toggled:vvi.isEqualTo(e.id)}})}}get portCount(){return this.remoteExplorerService.tunnelModel.forwarded.size+this.remoteExplorerService.tunnelModel.detected.size}createTable(){if(!this.panelContainer)return;this.tableDisposables.clear(),Rt(this.panelContainer);let e=R(this.panelContainer,_(".customview-tree"));e.classList.add("ports-view"),e.classList.add("file-icon-themable-tree","show-file-icons");let t=new E7e(this.instantiationService,this.contextKeyService,this.menuService,this.contextViewService,this.remoteExplorerService,this.commandService,this.configurationService),o=[new uvi,new pvi,new mvi,new hvi];this.tunnelService.canChangePrivacy&&o.push(new fvi),o.push(new gvi),this.table=this.instantiationService.createInstance(rC,"RemoteTunnels",e,new dvi(this.remoteExplorerService),o,[t],{keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:l=>l.label},multipleSelectionSupport:!0,accessibilityProvider:{getAriaLabel:l=>l instanceof VC?`${l.tooltipPostfix} ${l.portTooltip} ${l.iconTooltip} ${l.processTooltip} ${l.originTooltip} ${this.tunnelService.canChangePrivacy?l.privacy.label:""}`:l.label,getWidgetAriaLabel:()=>d(12813,null)},openOnSingleClick:!0});let n=this.tableDisposables.add(new as);t.actionRunner=n,this.tableDisposables.add(this.table),this.tableDisposables.add(this.table.onContextMenu(l=>this.onContextMenu(l,n))),this.tableDisposables.add(this.table.onMouseDblClick(l=>this.onMouseDblClick(l))),this.tableDisposables.add(this.table.onDidChangeFocus(l=>this.onFocusChanged(l))),this.tableDisposables.add(this.table.onDidChangeSelection(l=>this.onSelectionChanged(l))),this.tableDisposables.add(this.table.onDidFocus(()=>this.tunnelViewFocusContext.set(!0))),this.tableDisposables.add(this.table.onDidBlur(()=>this.tunnelViewFocusContext.set(!1)));let r=()=>this.table?.splice(0,Number.POSITIVE_INFINITY,this.viewModel.all);r();let s=this.portCount;this.tableDisposables.add(H.debounce(this.viewModel.onForwardedPortsChanged,(l,c)=>c,50)(()=>{let l=this.portCount;(s===0||l===0)&&s!==l&&this._onDidChangeViewWelcomeState.fire(),s=l,r()})),this.tableDisposables.add(this.table.onMouseClick(l=>{if(this.hasOpenLinkModifier(l.browserEvent)&&this.table){let c=this.table.getSelectedElements();(c.length===0||c.length===1&&c[0]===l.element)&&this.commandService.executeCommand(zP.ID,l.element)}})),this.tableDisposables.add(this.table.onDidOpen(l=>{!l.element||l.element.tunnelType!=="Forwarded"||l.browserEvent?.type==="dblclick"&&this.commandService.executeCommand(pJ.ID)})),this.tableDisposables.add(this.remoteExplorerService.onDidChangeEditable(l=>{this.isEditing=!!this.remoteExplorerService.getEditableData(l?.tunnel,l?.editId),this._onDidChangeViewWelcomeState.fire(),this.isEditing||e.classList.remove("highlight"),r(),this.isEditing?(e.classList.add("highlight"),l||this.table?.reveal(this.table.indexOf(this.viewModel.input))):(l&&l.tunnel.tunnelType!=="Add"&&this.table?.setFocus(this.lastFocus),this.focus())}))}renderBody(e){super.renderBody(e),this.panelContainer=R(e,_(".tree-explorer-viewlet-tree-view")),this.createTable()}shouldShowWelcome(){return this.viewModel.isEmpty()&&!this.isEditing}focus(){super.focus(),this.table?.domFocus()}onFocusChanged(e){e.indexes.length>0&&e.elements.length>0&&(this.lastFocus=[...e.indexes]);let t=e.elements,o=t&&t.length?t[0]:void 0;o?(this.tunnelViewSelectionContext.set(Tp(o.remoteHost,o.remotePort)),this.tunnelTypeContext.set(o.tunnelType),this.tunnelCloseableContext.set(!!o.closeable),this.tunnelPrivacyContext.set(o.privacy.id),this.tunnelProtocolContext.set(o.protocol==="https"?"https":"https"),this.portChangableContextKey.set(!!o.localPort)):(this.tunnelTypeContext.reset(),this.tunnelViewSelectionContext.reset(),this.tunnelCloseableContext.reset(),this.tunnelPrivacyContext.reset(),this.tunnelProtocolContext.reset(),this.portChangableContextKey.reset())}hasOpenLinkModifier(e){let t=this.configurationService.getValue("editor"),o=!1;return t.multiCursorModifier==="ctrlCmd"?o=e.altKey:it?o=e.metaKey:o=e.ctrlKey,o}onSelectionChanged(e){let t=e.elements;t.length>1?this.tunnelViewMultiSelectionContext.set(t.map(o=>Tp(o.remoteHost,o.remotePort))):this.tunnelViewMultiSelectionContext.set(void 0)}onContextMenu(e,t){if(e.element!==void 0&&!(e.element instanceof VC))return;e.browserEvent.preventDefault(),e.browserEvent.stopPropagation();let o=e.element;o?(this.table?.setFocus([this.table.indexOf(o)]),this.tunnelTypeContext.set(o.tunnelType),this.tunnelCloseableContext.set(!!o.closeable),this.tunnelPrivacyContext.set(o.privacy.id),this.tunnelProtocolContext.set(o.protocol),this.portChangableContextKey.set(!!o.localPort)):(this.tunnelTypeContext.set("Add"),this.tunnelCloseableContext.set(!1),this.tunnelPrivacyContext.set(void 0),this.tunnelProtocolContext.set(void 0),this.portChangableContextKey.set(!1)),this.contextMenuService.showContextMenu({menuId:D.TunnelContext,menuActionOptions:{shouldForwardArgs:!0},contextKeyService:this.table?.contextKeyService,getAnchor:()=>e.anchor,getActionViewItem:n=>{let r=this.keybindingService.lookupKeybinding(n.id);if(r)return new Lr(n,n,{label:!0,keybinding:r.getLabel()})},onHide:n=>{n&&this.table?.domFocus()},getActionsContext:()=>o?.strip(),actionRunner:t})}onMouseDblClick(e){e.element||this.commandService.executeCommand(gw.INLINE_ID)}layoutBody(e,t){this.height=e,this.width=t,super.layoutBody(e,t),this.table?.layout(e,t)}};hF=I([m(2,_e),m(3,ze),m(4,X),m(5,B),m(6,F),m(7,Ri),m(8,Qe),m(9,Ge),m(10,ge),m(11,qt),m(12,De),m(13,Gd),m(14,tt),m(15,ap),m(16,_n)],hF);var KPt=class{constructor(i,e){this.id=hF.ID;this.name=hF.TITLE;this.canToggleVisibility=!0;this.hideByDefault=!1;this.group="details@0";this.order=-500;this.canMoveView=!0;this.containerIcon=zPt;this.ctorDescriptor=new Mt(hF,[i]),this.remoteAuthority=e.remoteAuthority?e.remoteAuthority.split("+")[0]:void 0}};function mJ(a){return a&&a.tunnelType&&a.remoteHost&&a.source}var pJ;(o=>{o.ID="remote.tunnel.label",o.LABEL=d(12775,null),o.COMMAND_ID_KEYWORD="label";function t(){return async(n,r)=>{let s=n.get(Gd),l;if(mJ(r))l=r;else{let c=n.get(X).getContextKeyValue(M7e),u=c?s.tunnelModel.forwarded.get(c):void 0;if(u){let p=n.get(ap);l=VC.createFromTunnel(s,p,u)}}if(l){let c=l;return new Promise(u=>{let p=c.name?c.name:`${c.remotePort}`;s.setEditable(c,2,{onFinish:async(h,g)=>{h=h.trim(),s.setEditable(c,2,null);let f=g&&h!==p;f&&await s.tunnelModel.name(c.remoteHost,c.remotePort,h),u(f?{port:c.remotePort,label:h}:void 0)},validationMessage:()=>null,placeholder:d(12790,null),startingValue:p})})}}}o.handler=t})(pJ||={});var G$o=d(12792,null),bvi=65536,Voo=d(12791,null,bvi),Boo=d(12795,null),$$o=d(12794,null),gw;(c=>{c.INLINE_ID="remote.tunnel.forwardInline",c.COMMANDPALETTE_ID="remote.tunnel.forwardCommandPalette",c.LABEL=L(12770,"Forward a Port"),c.TREEITEM_LABEL=d(12773,null);let o=d(12774,null);function n(u,p,h,g){let f=W9e(h);if(f){if(f.port>=bvi)return{content:Voo,severity:St.Error};if(g&&p.isPortPrivileged(f.port))return{content:Boo,severity:St.Info};if(Ib(u.tunnelModel.forwarded,f.host,f.port))return{content:$$o,severity:St.Error}}else return{content:G$o,severity:St.Error};return null}function r(u,p,h,g){p?typeof p=="string"&&u.warn(d(12772,null,h,g,p)):u.warn(d(12771,null,h,g))}function s(){return async(u,p)=>{let h=u.get(Gd),g=u.get(Ne),f=u.get(ap);h.setEditable(void 0,1,{onFinish:async(v,b)=>{h.setEditable(void 0,1,null);let S;b&&(S=W9e(v))&&h.forward({remote:{host:S.host,port:S.port},elevateIfNeeded:!0}).then(y=>r(g,y,S.host,S.port))},validationMessage:v=>n(h,f,v,f.canElevate),placeholder:o})}}c.inlineHandler=s;function l(){return async(u,p)=>{let h=u.get(Gd),g=u.get(Ne),f=u.get(Ft),v=u.get(Ge),b=u.get(ap);await f.openView(hF.ID,!0);let S=await v.input({prompt:o,validateInput:w=>Promise.resolve(n(h,b,w,b.canElevate))}),y;S&&(y=W9e(S))&&h.forward({remote:{host:y.host,port:y.port},elevateIfNeeded:!0}).then(w=>r(g,w,y.host,y.port))}}c.commandPaletteHandler=l})(gw||={});function Hoo(a,i,e){let t=a.map(o=>{let n=VC.createFromTunnel(i,e,o);return{label:n.label,description:n.processDescription,tunnel:n}});return t.length===0&&t.push({label:d(12765,null,gw.LABEL.value)}),t}var HV;(n=>{n.INLINE_ID="remote.tunnel.closeInline",n.COMMANDPALETTE_ID="remote.tunnel.closeCommandPalette",n.LABEL=L(12764,"Stop Forwarding Port");function t(){return async(r,s)=>{let l=r.get(X),c=r.get(Gd),u=[],p=l.getContextKeyValue(Noo);if(p)p.forEach(h=>{let g=c.tunnelModel.forwarded.get(h);g&&u?.push(g)});else if(mJ(s))u=[s];else{let h=l.getContextKeyValue(M7e),g=h?c.tunnelModel.forwarded.get(h):void 0;g&&(u=[g])}if(!(!u||u.length===0))return Promise.all(u.map(h=>c.close({host:h.remoteHost,port:h.remotePort},"User")))}}n.inlineHandler=t;function o(){return async r=>{let s=r.get(Ge),l=r.get(Gd),c=r.get(ap),u=r.get(ge),p=Hoo(Array.from(l.tunnelModel.forwarded.values()).filter(g=>g.closeable),l,c),h=await s.pick(p,{placeHolder:d(12766,null)});h&&h.tunnel?await l.close({host:h.tunnel.remoteHost,port:h.tunnel.remotePort},"User"):h&&await u.executeCommand(gw.COMMANDPALETTE_ID)}}n.commandPaletteHandler=o})(HV||={});var zP;(o=>{o.ID="remote.tunnel.open",o.LABEL=d(12776,null);function e(){return async(n,r)=>{let s;if(mJ(r)?s=Tp(r.remoteHost,r.remotePort):agi(r)&&(s=Tp(r.tunnelRemoteHost,r.tunnelRemotePort)),s){let l=n.get(Gd).tunnelModel,c=n.get(Qe);return t(l,c,s)}}}o.handler=e;function t(n,r,s){let l=n.forwarded.get(s)||n.detected.get(s);return l?r.open(l.localUri,{allowContributedOpeners:!1}):Promise.resolve()}o.run=t})(zP||={});var UV;(o=>{o.ID="remote.tunnel.openPreview",o.LABEL=d(12781,null);function e(){return async(n,r)=>{let s;if(mJ(r)?s=Tp(r.remoteHost,r.remotePort):agi(r)&&(s=Tp(r.tunnelRemoteHost,r.tunnelRemotePort)),s){let l=n.get(Gd).tunnelModel,c=n.get(Qe),u=n.get(NX);return t(l,c,u,s)}}}o.handler=e;async function t(n,r,s,l){let c=n.forwarded.get(l)||n.detected.get(l);if(c){let u=c.remoteHost.includes(":")?`[${c.remoteHost}]`:c.remoteHost,p=A.parse(`http://${u}:${c.remotePort}`),h=await s.getOpener(c.localUri,{sourceUri:p},ve.None);return h?h.openExternalUri(c.localUri,{sourceUri:p},ve.None):r.open(c.localUri)}return Promise.resolve()}o.run=t})(UV||={});var T7e;(t=>{t.ID="remote.tunnel.openCommandPalette",t.LABEL=d(12777,null);function e(){return async(o,n)=>{let r=o.get(Gd),s=o.get(ap),l=r.tunnelModel,c=o.get(Ge),u=o.get(Qe),p=o.get(ge),h=[...l.forwarded,...l.detected].map(f=>{let v=VC.createFromTunnel(r,s,f[1]);return{label:v.label,description:v.processDescription,tunnel:v}});h.length===0?h.push({label:d(12778,null)}):h.push({label:d(12780,null)});let g=await c.pick(h,{placeHolder:d(12779,null)});if(g&&g.tunnel)return zP.run(l,u,Tp(g.tunnel.remoteHost,g.tunnel.remotePort));if(g)return p.executeCommand(`${P5}.focus`)}}t.handler=e})(T7e||={});var zV;(s=>{s.INLINE_ID="remote.tunnel.copyAddressInline",s.COMMANDPALETTE_ID="remote.tunnel.copyAddressCommandPalette",s.INLINE_LABEL=d(12768,null),s.COMMANDPALETTE_LABEL=d(12767,null);async function o(l,c,u){let p=l.tunnelModel.address(u.remoteHost,u.remotePort);p&&await c.writeText(p.toString())}function n(){return async(l,c)=>{let u=l.get(Gd),p;if(mJ(c))p=c;else{let h=l.get(X).getContextKeyValue(M7e);p=h?u.tunnelModel.forwarded.get(h):void 0}if(p)return o(u,l.get(Wi),p)}}s.inlineHandler=n;function r(){return async(l,c)=>{let u=l.get(Ge),p=l.get(Gd),h=l.get(ap),g=l.get(ge),f=l.get(Wi),v=Array.from(p.tunnelModel.forwarded.values()).concat(Array.from(p.tunnelModel.detected.values())),b=await u.pick(Hoo(v,p,h),{placeHolder:d(12769,null)});b&&b.tunnel?await o(p,f,b.tunnel):b&&await g.executeCommand(gw.COMMANDPALETTE_ID)}}s.commandPaletteHandler=r})(zV||={});var _7e;(o=>{o.ID="remote.tunnel.changeLocalPort",o.LABEL=d(12762,null);function e(n,r,s){if(r.match(/^[0-9]+$/)){if(Number(r)>=bvi)return{content:Voo,severity:St.Error};if(s&&n.isPortPrivileged(Number(r)))return{content:Boo,severity:St.Info}}else return{content:d(12793,null),severity:St.Error};return null}function t(){return async(n,r)=>{let s=n.get(Gd),l=n.get(Ne),c=n.get(ap),u;if(mJ(r))u=r;else{let p=n.get(X).getContextKeyValue(M7e),h=p?s.tunnelModel.forwarded.get(p):void 0;if(h){let g=n.get(ap);u=VC.createFromTunnel(s,g,h)}}if(u){let p=u;s.setEditable(p,3,{onFinish:async(h,g)=>{if(s.setEditable(p,3,null),g){await s.close({host:p.remoteHost,port:p.remotePort},"Other");let f=Number(h),v=await s.forward({remote:{host:p.remoteHost,port:p.remotePort},local:f,name:p.name,elevateIfNeeded:!0,source:p.source});v&&typeof v!="string"&&v.tunnelLocalPort!==f&&l.warn(d(12763,null,h,v.tunnelLocalPort??v.localAddress))}},validationMessage:h=>e(c,h,c.canElevate),placeholder:d(12788,null)})}}}o.handler=t})(_7e||={});var Uoo;(i=>{function a(e){return async(t,o)=>{if(mJ(o)){let n=t.get(Gd);return await n.close({host:o.remoteHost,port:o.remotePort},"Other"),n.forward({remote:{host:o.remoteHost,port:o.remotePort},local:o.localPort,name:o.name,elevateIfNeeded:!0,privacy:e,source:o.source})}}}i.handler=a})(Uoo||={});var q5;(s=>{s.ID_HTTP="remote.tunnel.setProtocolHttp",s.ID_HTTPS="remote.tunnel.setProtocolHttps",s.LABEL_HTTP=d(12782,null),s.LABEL_HTTPS=d(12783,null);async function o(l,c,u,p){if(mJ(l)){let h={protocol:c},g=p.remoteAuthority?4:3;return u.tunnelModel.configPortsAttributes.addAttributes(l.remotePort,h,g)}}function n(){return async(l,c)=>o(c,"http",l.get(Gd),l.get(Vt))}s.handlerHttp=n;function r(){return async(l,c)=>o(c,"https",l.get(Gd),l.get(Vt))}s.handlerHttps=r})(q5||={});var Svi=10,mue=L7e.isEqualTo("Forwarded"),hue=x.or(mue,L7e.isEqualTo("Detected")),hJ=Ooo.isEqualTo(void 0);yt.registerCommandAndKeybindingRule({id:pJ.ID,weight:200+Svi,when:x.and($Pt,mue,hJ),primary:60,mac:{primary:3},handler:pJ.handler()});qe.registerCommand(gw.INLINE_ID,gw.inlineHandler());qe.registerCommand(gw.COMMANDPALETTE_ID,gw.commandPaletteHandler());yt.registerCommandAndKeybindingRule({id:HV.INLINE_ID,weight:200+Svi,when:x.and(R7e,$Pt),primary:20,mac:{primary:2049,secondary:[20]},handler:HV.inlineHandler()});qe.registerCommand(HV.COMMANDPALETTE_ID,HV.commandPaletteHandler());qe.registerCommand(zP.ID,zP.handler());qe.registerCommand(UV.ID,UV.handler());qe.registerCommand(T7e.ID,T7e.handler());yt.registerCommandAndKeybindingRule({id:zV.INLINE_ID,weight:200+Svi,when:x.and($Pt,hue,hJ),primary:2081,handler:zV.inlineHandler()});qe.registerCommand(zV.COMMANDPALETTE_ID,zV.commandPaletteHandler());qe.registerCommand(_7e.ID,_7e.handler());qe.registerCommand(q5.ID_HTTP,q5.handlerHttp());qe.registerCommand(q5.ID_HTTPS,q5.handlerHttps());fe.appendMenuItem(D.CommandPalette,{command:{id:HV.COMMANDPALETTE_ID,title:HV.LABEL},when:Xz});fe.appendMenuItem(D.CommandPalette,{command:{id:gw.COMMANDPALETTE_ID,title:gw.LABEL},when:Xz});fe.appendMenuItem(D.CommandPalette,{command:{id:zV.COMMANDPALETTE_ID,title:zV.COMMANDPALETTE_LABEL},when:Xz});fe.appendMenuItem(D.CommandPalette,{command:{id:T7e.ID,title:T7e.LABEL},when:Xz});fe.appendMenuItem(D.TunnelContext,{group:"._open",order:0,command:{id:zP.ID,title:zP.LABEL},when:x.and(hue,hJ)});fe.appendMenuItem(D.TunnelContext,{group:"._open",order:1,command:{id:UV.ID,title:UV.LABEL},when:x.and(hue,hJ)});fe.appendMenuItem(D.TunnelContext,{group:"0_manage",order:1,command:{id:pJ.ID,title:pJ.LABEL,icon:cvi},when:x.and(mue,hJ)});fe.appendMenuItem(D.TunnelContext,{group:"2_localaddress",order:0,command:{id:zV.INLINE_ID,title:zV.INLINE_LABEL},when:x.and(hue,hJ)});fe.appendMenuItem(D.TunnelContext,{group:"2_localaddress",order:1,command:{id:_7e.ID,title:_7e.LABEL},when:x.and(mue,Foo,hJ)});fe.appendMenuItem(D.TunnelContext,{group:"2_localaddress",order:2,submenu:D.TunnelPrivacy,title:d(12809,null),when:x.and(mue,Aoo)});fe.appendMenuItem(D.TunnelContext,{group:"2_localaddress",order:3,submenu:D.TunnelProtocol,title:d(12810,null),when:x.and(mue,hJ,Woo)});fe.appendMenuItem(D.TunnelContext,{group:"3_forward",order:0,command:{id:HV.INLINE_ID,title:HV.LABEL},when:R7e});fe.appendMenuItem(D.TunnelContext,{group:"3_forward",order:1,command:{id:gw.INLINE_ID,title:gw.LABEL}});fe.appendMenuItem(D.TunnelProtocol,{order:0,command:{id:q5.ID_HTTP,title:q5.LABEL_HTTP,toggled:GPt.isEqualTo("http")}});fe.appendMenuItem(D.TunnelProtocol,{order:1,command:{id:q5.ID_HTTPS,title:q5.LABEL_HTTPS,toggled:GPt.isEqualTo("https")}});fe.appendMenuItem(D.TunnelPortInline,{group:"0_manage",order:0,command:{id:gw.INLINE_ID,title:gw.TREEITEM_LABEL,icon:Eoo},when:L7e.isEqualTo("Candidate")});fe.appendMenuItem(D.TunnelPortInline,{group:"0_manage",order:4,command:{id:pJ.ID,title:pJ.LABEL,icon:cvi},when:mue});fe.appendMenuItem(D.TunnelPortInline,{group:"0_manage",order:5,command:{id:HV.INLINE_ID,title:HV.LABEL,icon:Too},when:R7e});fe.appendMenuItem(D.TunnelLocalAddressInline,{order:-1,command:{id:zV.INLINE_ID,title:zV.INLINE_LABEL,icon:Loo},when:hue});fe.appendMenuItem(D.TunnelLocalAddressInline,{order:0,command:{id:zP.ID,title:zP.LABEL,icon:_oo},when:hue});fe.appendMenuItem(D.TunnelLocalAddressInline,{order:1,command:{id:UV.ID,title:UV.LABEL,icon:Doo},when:hue});J("ports.iconRunningProcessForeground",p7i,d(12760,null));var qPt=class a extends C{constructor(e,t){super();this._onDidMatchLocalUrl=this._register(new E);this.onDidMatchLocalUrl=this._onDidMatchLocalUrl.event;this.listeners=new Map;this.terminalDataWorkers=this._register(new jt);this.replPositions=new Map;e.instances.forEach(o=>{this.registerTerminalInstance(o)}),this._register(e.onDidCreateInstance(o=>{this.registerTerminalInstance(o)})),this._register(e.onDidDisposeInstance(o=>{this.listeners.get(o)?.dispose(),this.listeners.delete(o),this.terminalDataWorkers.deleteAndDispose(o)})),this._register(t.onDidNewSession(o=>{(!o.parentSession||o.parentSession&&o.hasSeparateRepl())&&this.listeners.set(o.getId(),o.onDidChangeReplElements(()=>{this.processNewReplElements(o)}))})),this._register(t.onDidEndSession(({session:o})=>{this.listeners.has(o.getId())&&(this.listeners.get(o.getId())?.dispose(),this.listeners.delete(o.getId()))}))}static{this.dataDebounceTimeout=500}static{this.maxDataLength=1e4}static{this.localUrlRegex=/\b\w{0,20}(?::\/\/)?(?:localhost|127\.0\.0\.1|0\.0\.0\.0|:\d{2,5})[\w\-\.\~:\/\?\#[\]\@!\$&\(\)\*\+\,\;\=]*/gim}static{this.extractPortRegex=/(localhost|127\.0\.0\.1|0\.0\.0\.0):(\d{1,5})/}static{this.localPythonServerRegex=/HTTP\son\s(127\.0\.0\.1|0\.0\.0\.0)\sport\s(\d+)/}static{this.excludeTerminals=["Dev Containers"]}registerTerminalInstance(e){a.excludeTerminals.includes(e.title)||this.listeners.set(e,e.onData(t=>{this.getOrCreateWorker(e).work(t)}))}getOrCreateWorker(e){let t=this.terminalDataWorkers.get(e);return t||(t=new wM(o=>this.processTerminalData(o),a.dataDebounceTimeout),this.terminalDataWorkers.set(e,t)),t}processTerminalData(e){e.reduce((o,n)=>o+n.length,0)>a.maxDataLength||this.processData(e.join(""))}processNewReplElements(e){let t=this.replPositions.get(e.getId()),o=e.getReplElements();if(this.replPositions.set(e.getId(),{position:o.length-1,tail:o[o.length-1]}),!t&&o.length>0)o.forEach(n=>this.processData(n.toString()));else if(t&&o.length-1!==t.position)for(let n=o.length-1;n>=0;n--){let r=o[n];if(r===t.tail)break;this.processData(r.toString())}}dispose(){super.dispose();for(let e of this.listeners.values())e.dispose()}processData(e){e=CS(e);let t=e.match(a.localUrlRegex)||[];if(t&&t.length>0)t.forEach(o=>{let n;try{n=new URL(o)}catch{}if(n){let r=o.match(a.extractPortRegex),s=parseFloat(n.port?n.port:r?r[2]:"NaN");if(!isNaN(s)&&Number.isInteger(s)&&s>0&&s<=65535){let l=n.hostname;if(l!=="0.0.0.0"&&l!=="127.0.0.1"&&(l="localhost"),s!==9229&&e.startsWith("Debugger listening on"))return;this._onDidMatchLocalUrl.fire({port:s,host:l})}}});else{let o=e.match(a.localPythonServerRegex);o&&o.length===3&&this._onDidMatchLocalUrl.fire({host:o[1],port:Number(o[2])})}}};var KV="workbench.view.remote",__e=class extends C{constructor(e,t,o,n,r,s){super();this.contextKeyService=e;this.environmentService=t;this.remoteExplorerService=o;this.tunnelService=n;this.activityService=r;this.statusbarService=s;this.contextKeyListener=this._register(new me);this.activityBadge=this._register(new me);this.hasPortsInSession=!1;this._register(oe.as(on.ViewsRegistry).registerViewWelcomeContent(P5,{content:this.environmentService.remoteAuthority?d(12710,null,`command:${gw.INLINE_ID}`):d(12698,null,`command:${gw.INLINE_ID}`)})),this.enableBadgeAndStatusBar(),this.enableForwardedPortsFeatures(),this.environmentService.remoteAuthority||this._register(H.once(this.tunnelService.onTunnelOpened)(()=>{this.hasPortsInSession=!0}))}async getViewContainer(){return oe.as(on.ViewContainersRegistry).registerViewContainer({id:aMt,title:L(12699,"Ports"),icon:zPt,ctorDescriptor:new Mt(Ha,[aMt,{mergeViewWithContainerWhenSingleView:!0}]),storageId:aMt,hideIfEmpty:!0,order:5},1)}async enableForwardedPortsFeatures(){this.contextKeyListener.clear();let e=!!Kde.getValue(this.contextKeyService),t=!!Xz.getValue(this.contextKeyService);if(e||t){t||this.contextKeyService.createKey(Xz.key,!0);let o=await this.getViewContainer(),n=new KPt(new T_e(this.remoteExplorerService,this.tunnelService),this.environmentService),r=oe.as(on.ViewsRegistry);o&&(this.remoteExplorerService.enablePortsFeatures(!e),r.registerViews([n],o))}else this.contextKeyListener.value=this.contextKeyService.onDidChangeContext(o=>{o.affectsSome(new Set([...Kde.keys(),...Xz.keys()]))&&this.enableForwardedPortsFeatures()})}enableBadgeAndStatusBar(){let e=oe.as(on.ViewsRegistry).onViewsRegistered(t=>{t.find(o=>o.views.find(n=>n.id===P5))&&(this._register(H.debounce(this.remoteExplorerService.tunnelModel.onForwardPort,(o,n)=>n,50)(()=>{this.updateActivityBadge(),this.updateStatusBar()})),this._register(H.debounce(this.remoteExplorerService.tunnelModel.onClosePort,(o,n)=>n,50)(()=>{this.updateActivityBadge(),this.updateStatusBar()})),this.updateActivityBadge(),this.updateStatusBar(),e.dispose())})}async updateActivityBadge(){this.remoteExplorerService.tunnelModel.forwarded.size>0?this.activityBadge.value=this.activityService.showViewActivity(P5,{badge:new qc(this.remoteExplorerService.tunnelModel.forwarded.size,e=>e===1?d(12696,null):d(12697,null,e))}):this.activityBadge.clear()}updateStatusBar(){!this.environmentService.remoteAuthority&&!this.hasPortsInSession||(this.entryAccessor?this.entryAccessor.update(this.entry):this._register(this.entryAccessor=this.statusbarService.addEntry(this.entry,"status.forwardedPorts",0,40)))}get entry(){let e,t=this.remoteExplorerService.tunnelModel.forwarded.size+this.remoteExplorerService.tunnelModel.detected.size,o=`${t}`;if(t===0)e=d(12703,null);else{let n=Array.from(this.remoteExplorerService.tunnelModel.forwarded.values());n.push(...Array.from(this.remoteExplorerService.tunnelModel.detected.values())),e=d(12704,null,n.map(r=>r.remotePort).join(", "))}return{name:d(12711,null),text:`$(radio-tower) ${o}`,ariaLabel:e,tooltip:e,command:`${P5}.focus`}}};__e=I([m(0,X),m(1,Vt),m(2,Gd),m(3,ap),m(4,zl),m(5,Tr)],__e);var D_e=class{constructor(i,e){this.remoteExplorerService=i;this.logService=e;this.remoteExplorerService.tunnelModel.environmentTunnelsSet?this.restore():H.once(this.remoteExplorerService.tunnelModel.onEnvironmentTunnelsSet)(async()=>{await this.restore()})}async restore(){return this.logService.trace("ForwardedPorts: Doing first restore."),this.remoteExplorerService.restore()}};D_e=I([m(0,Gd),m(1,ne)],D_e);var L_e=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super();this.terminalService=e;this.notificationService=t;this.openerService=o;this.externalOpenerService=n;this.remoteExplorerService=r;this.contextKeyService=l;this.configurationService=c;this.debugService=u;this.tunnelService=h;this.hostService=g;this.logService=f;this.storageService=v;this.preferencesService=b;s.remoteAuthority&&(c.whenRemoteConfigurationLoaded().then(()=>p.getEnvironment()).then(S=>{this.setup(S),this._register(c.onDidChangeConfiguration(y=>{y.affectsConfiguration(q_)?this.setup(S):y.affectsConfiguration(H9e)&&!this.portListener&&this.listenForPorts()}))}),this.storageService.getBoolean("processPortForwardingFallback",1,!0)||this.configurationService.updateValue(H9e,0,5))}getPortAutoFallbackNumber(){let e=this.configurationService.inspect(H9e);if(e.value!==void 0&&(e.value===0||e.value!==e.defaultValue))return e.value;let t=this.configurationService.inspect(q_);return t.applicationValue===Jz||t.userValue===Jz||t.userLocalValue===Jz||t.userRemoteValue===Jz||t.workspaceFolderValue===Jz||t.workspaceValue===Jz?0:e.value??20}listenForPorts(){let e=this.getPortAutoFallbackNumber();if(e===0){this.portListener?.dispose();return}this.procForwarder&&!this.portListener&&this.configurationService.getValue(q_)===Jz?this.portListener=this._register(this.remoteExplorerService.tunnelModel.onForwardPort(async()=>{if(e=this.getPortAutoFallbackNumber(),e===0){this.portListener?.dispose();return}Array.from(this.remoteExplorerService.tunnelModel.forwarded.values()).filter(t=>t.source.source===1).length>e&&(await this.configurationService.updateValue(q_,LTe),this.notificationService.notify({message:d(12700,null),severity:gt.Warning,actions:{primary:[pi({id:"switchBack",label:d(12702,null),run:async()=>{await this.configurationService.updateValue(q_,Jz),await this.configurationService.updateValue(H9e,0,5),this.portListener?.dispose(),this.portListener=void 0}}),pi({id:"showPortSourceSetting",label:d(12701,null),run:async()=>{await this.preferencesService.openSettings({query:"remote.autoForwardPortsSource"})}})]}}))})):(this.portListener?.dispose(),this.portListener=void 0)}setup(e){let t=this.procForwarder?.forwarded,o=this.outputForwarder||this.procForwarder;if(this.procForwarder?.dispose(),this.procForwarder=void 0,this.outputForwarder?.dispose(),this.outputForwarder=void 0,e?.os!==3)this.configurationService.inspect(q_).default?.value!==QX&&oe.as(ii.Configuration).registerDefaultConfigurations([{overrides:{"remote.autoForwardPortsSource":QX}}]),this.outputForwarder=this._register(new QPt(this.terminalService,this.notificationService,this.openerService,this.externalOpenerService,this.remoteExplorerService,this.configurationService,this.debugService,this.tunnelService,this.hostService,this.logService,this.contextKeyService,()=>!1));else{let n=()=>this.configurationService.getValue(q_)===Jz;n()?this.procForwarder=this._register(new YPt(!1,t,!o,this.configurationService,this.remoteExplorerService,this.notificationService,this.openerService,this.externalOpenerService,this.tunnelService,this.hostService,this.logService,this.contextKeyService)):this.configurationService.getValue(q_)===LTe&&(this.procForwarder=this._register(new YPt(!0,t,!o,this.configurationService,this.remoteExplorerService,this.notificationService,this.openerService,this.externalOpenerService,this.tunnelService,this.hostService,this.logService,this.contextKeyService))),this.outputForwarder=this._register(new QPt(this.terminalService,this.notificationService,this.openerService,this.externalOpenerService,this.remoteExplorerService,this.configurationService,this.debugService,this.tunnelService,this.hostService,this.logService,this.contextKeyService,n))}this.listenForPorts()}};L_e=I([m(0,Yo),m(1,Ne),m(2,Qe),m(3,NX),m(4,Gd),m(5,Vt),m(6,X),m(7,Lv),m(8,Li),m(9,yo),m(10,ap),m(11,oi),m(12,ne),m(13,le),m(14,Po)],L_e);var jPt=class a extends C{constructor(e,t,o,n,r,s,l,c){super();this.notificationService=e;this.remoteExplorerService=t;this.openerService=o;this.externalOpenerService=n;this.tunnelService=r;this.hostService=s;this.logService=l;this.contextKeyService=c;this.notificationDisposable=this._register(new me);this.alreadyOpenedOnce=new Set;this.lastNotifyTime=new Date,this.lastNotifyTime.setFullYear(this.lastNotifyTime.getFullYear()-1)}static{this.NOTIFY_COOL_DOWN=5e3}async doAction(e){this.logService.trace(`ForwardedPorts: (OnAutoForwardedAction) Starting action for ${e[0]?.tunnelRemotePort}`),this.doActionTunnels=e;let t=await this.portNumberHeuristicDelay();if(this.logService.trace(`ForwardedPorts: (OnAutoForwardedAction) Heuristic chose ${t?.tunnelRemotePort}`),t){let n=(await this.remoteExplorerService.tunnelModel.getAttributes([{port:t.tunnelRemotePort,host:t.tunnelRemoteHost}]))?.get(t.tunnelRemotePort)?.onAutoForward;switch(this.logService.trace(`ForwardedPorts: (OnAutoForwardedAction) onAutoForward action is ${n}`),n){case"openBrowserOnce":{if(this.alreadyOpenedOnce.has(t.localAddress))break;this.alreadyOpenedOnce.add(t.localAddress)}case"openBrowser":{let r=Tp(t.tunnelRemoteHost,t.tunnelRemotePort);await zP.run(this.remoteExplorerService.tunnelModel,this.openerService,r);break}case"openPreview":{let r=Tp(t.tunnelRemoteHost,t.tunnelRemotePort);await UV.run(this.remoteExplorerService.tunnelModel,this.openerService,this.externalOpenerService,r);break}case"silent":break;default:{let r=new Date().getTime()-this.lastNotifyTime.getTime();this.logService.trace(`ForwardedPorts: (OnAutoForwardedAction) time elapsed since last notification ${r} ms`),r>a.NOTIFY_COOL_DOWN&&await this.showNotification(t)}}}}hide(e){this.doActionTunnels&&(this.doActionTunnels=this.doActionTunnels.filter(t=>!e.includes(t.tunnelRemotePort))),this.lastShownPort&&e.indexOf(this.lastShownPort)>=0&&this.lastNotification?.close()}async portNumberHeuristicDelay(){if(this.logService.trace("ForwardedPorts: (OnAutoForwardedAction) Starting heuristic delay"),!this.doActionTunnels||this.doActionTunnels.length===0)return;this.doActionTunnels=this.doActionTunnels.sort((t,o)=>t.tunnelRemotePort-o.tunnelRemotePort);let e=this.doActionTunnels.shift();return e.tunnelRemotePort%1e3===0?(this.logService.trace(`ForwardedPorts: (OnAutoForwardedAction) Heuristic chose tunnel because % 1000: ${e.tunnelRemotePort}`),this.newerTunnel=e,e):e.tunnelRemotePort<1e4&&e.tunnelRemotePort!==9229?(this.logService.trace(`ForwardedPorts: (OnAutoForwardedAction) Heuristic chose tunnel because < 10000: ${e.tunnelRemotePort}`),this.newerTunnel=e,e):(this.logService.trace(`ForwardedPorts: (OnAutoForwardedAction) Waiting for "better" tunnel than ${e.tunnelRemotePort}`),this.newerTunnel=void 0,new Promise(t=>{setTimeout(()=>{this.newerTunnel?t(void 0):this.doActionTunnels?.includes(e)?t(e):t(void 0)},3e3)}))}async basicMessage(e){let o=(await this.remoteExplorerService.tunnelModel.getAttributes([{host:e.tunnelRemoteHost,port:e.tunnelRemotePort}],!1))?.get(e.tunnelRemotePort)?.label;return d(12705,null,o?` (${o})`:"",e.tunnelRemotePort)}linkMessage(){return d(12709,null,`command:${hF.ID}.focus`)}async showNotification(e){if(!await this.hostService.hadLastFocus())return;this.lastNotification?.close();let t=await this.basicMessage(e),o=[this.openBrowserChoice(e)];(!Gt||Poo.getValue(this.contextKeyService))&&o.push(this.openPreviewChoice(e)),e.tunnelLocalPort!==e.tunnelRemotePort&&this.tunnelService.canElevate&&this.tunnelService.isPortPrivileged(e.tunnelRemotePort)&&(t+=d(12707,null,e.tunnelRemotePort),o.unshift(this.elevateChoice(e))),e.privacy==="private"&&Gt&&this.tunnelService.canChangePrivacy&&o.push(this.makePublicChoice(e)),t+=this.linkMessage(),this.lastNotification=this.notificationService.prompt(gt.Info,t,o,{neverShowAgain:{id:"remote.tunnelsView.autoForwardNeverShow",isSecondary:!0}}),this.lastShownPort=e.tunnelRemotePort,this.lastNotifyTime=new Date,this.notificationDisposable.value=this.lastNotification.onDidClose(()=>{this.lastNotification=void 0,this.lastShownPort=void 0})}makePublicChoice(e){return{label:d(12708,null),run:async()=>{let t=Ib(this.remoteExplorerService.tunnelModel.forwarded,e.tunnelRemoteHost,e.tunnelRemotePort);return await this.remoteExplorerService.close({host:e.tunnelRemoteHost,port:e.tunnelRemotePort},"Other"),this.remoteExplorerService.forward({remote:{host:e.tunnelRemoteHost,port:e.tunnelRemotePort},local:e.tunnelLocalPort,name:t?.name,elevateIfNeeded:!0,privacy:"public",source:t?.source})}}}openBrowserChoice(e){let t=Tp(e.tunnelRemoteHost,e.tunnelRemotePort);return{label:zP.LABEL,run:()=>zP.run(this.remoteExplorerService.tunnelModel,this.openerService,t)}}openPreviewChoice(e){let t=Tp(e.tunnelRemoteHost,e.tunnelRemotePort);return{label:UV.LABEL,run:()=>UV.run(this.remoteExplorerService.tunnelModel,this.openerService,this.externalOpenerService,t)}}elevateChoice(e){return{label:d(12706,null,e.tunnelRemotePort),run:async()=>{await this.remoteExplorerService.close({host:e.tunnelRemoteHost,port:e.tunnelRemotePort},"Other");let t=await this.remoteExplorerService.forward({remote:{host:e.tunnelRemoteHost,port:e.tunnelRemotePort},local:e.tunnelRemotePort,elevateIfNeeded:!0,source:sMt});!t||typeof t=="string"||(this.lastNotification?.close(),this.lastShownPort=t.tunnelRemotePort,this.lastNotification=this.notificationService.prompt(gt.Info,await this.basicMessage(t)+this.linkMessage(),[this.openBrowserChoice(t),this.openPreviewChoice(e)],{neverShowAgain:{id:"remote.tunnelsView.autoForwardNeverShow",isSecondary:!0}}),this.notificationDisposable.value=this.lastNotification.onDidClose(()=>{this.lastNotification=void 0,this.lastShownPort=void 0}))}}}},QPt=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.terminalService=e;this.notificationService=t;this.openerService=o;this.externalOpenerService=n;this.remoteExplorerService=r;this.configurationService=s;this.debugService=l;this.tunnelService=c;this.hostService=u;this.logService=p;this.contextKeyService=h;this.privilegedOnly=g;this.notifier=new jPt(t,r,o,n,c,u,p,h),this._register(s.onDidChangeConfiguration(f=>{f.affectsConfiguration(A5)&&this.tryStartStopUrlFinder()})),this.portsFeatures=this._register(this.remoteExplorerService.onEnabledPortsFeatures(()=>{this.tryStartStopUrlFinder()})),this.tryStartStopUrlFinder(),s.getValue(q_)===LTe&&this._register(this.tunnelService.onTunnelClosed(f=>this.notifier.hide([f.port])))}tryStartStopUrlFinder(){this.configurationService.getValue(A5)?this.startUrlFinder():this.stopUrlFinder()}startUrlFinder(){!this.urlFinder&&this.remoteExplorerService.portsFeaturesEnabled!==2||(this.portsFeatures?.dispose(),this.urlFinder=this._register(new qPt(this.terminalService,this.debugService)),this._register(this.urlFinder.onDidMatchLocalUrl(async e=>{if(Ib(this.remoteExplorerService.tunnelModel.detected,e.host,e.port))return;let t=(await this.remoteExplorerService.tunnelModel.getAttributes([e]))?.get(e.port);if(t?.onAutoForward==="ignore"||this.privilegedOnly()&&!this.tunnelService.isPortPrivileged(e.port))return;let o=await this.remoteExplorerService.forward({remote:e,source:sMt},t??null);o&&typeof o!="string"&&this.notifier.doAction([o])})))}stopUrlFinder(){this.urlFinder&&(this.urlFinder.dispose(),this.urlFinder=void 0)}},YPt=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.unforwardOnly=e;this.alreadyAutoForwarded=t;this.needsInitialCandidates=o;this.configurationService=n;this.remoteExplorerService=r;this.notificationService=s;this.openerService=l;this.externalOpenerService=c;this.tunnelService=u;this.hostService=p;this.logService=h;this.contextKeyService=g;this.autoForwarded=new Set;this.notifiedOnly=new Set;this.initialCandidates=new Set;this.notifier=new jPt(s,r,l,c,u,p,h,g),t?.forEach(f=>this.autoForwarded.add(f)),this.initialize()}get forwarded(){return this.autoForwarded}async initialize(){this.remoteExplorerService.tunnelModel.environmentTunnelsSet||await new Promise(e=>this.remoteExplorerService.tunnelModel.onEnvironmentTunnelsSet(()=>e())),this._register(this.configurationService.onDidChangeConfiguration(async e=>{e.affectsConfiguration(A5)&&await this.startStopCandidateListener()})),this.portsFeatures=this._register(this.remoteExplorerService.onEnabledPortsFeatures(async()=>{await this.startStopCandidateListener()})),this.startStopCandidateListener()}async startStopCandidateListener(){this.configurationService.getValue(A5)?await this.startCandidateListener():this.stopCandidateListener()}stopCandidateListener(){this.candidateListener&&(this.candidateListener.dispose(),this.candidateListener=void 0)}async startCandidateListener(){this.candidateListener||this.remoteExplorerService.portsFeaturesEnabled!==2||(this.portsFeatures?.dispose(),await this.setInitialCandidates(),this.configurationService.getValue(A5)&&(this.candidateListener=this._register(this.remoteExplorerService.tunnelModel.onCandidatesChanged(this.handleCandidateUpdate,this))))}async setInitialCandidates(){if(!this.needsInitialCandidates){this.logService.debug("ForwardedPorts: (ProcForwarding) Not setting initial candidates");return}let e=this.remoteExplorerService.tunnelModel.candidatesOrUndefined;e||(await new Promise(t=>this.remoteExplorerService.tunnelModel.onCandidatesChanged(()=>t())),e=this.remoteExplorerService.tunnelModel.candidates);for(let t of e)this.initialCandidates.add(Tp(t.host,t.port));this.logService.debug(`ForwardedPorts: (ProcForwarding) Initial candidates set to ${e.map(t=>t.port).join(", ")}`)}async forwardCandidates(){let e,t=[];this.logService.trace(`ForwardedPorts: (ProcForwarding) Attempting to forward ${this.remoteExplorerService.tunnelModel.candidates.length} candidates`);for(let o of this.remoteExplorerService.tunnelModel.candidates){if(!o.detail){this.logService.trace(`ForwardedPorts: (ProcForwarding) Port ${o.port} missing detail`);continue}e||(e=await this.remoteExplorerService.tunnelModel.getAttributes(this.remoteExplorerService.tunnelModel.candidates));let n=e?.get(o.port),r=Tp(o.host,o.port);if(this.initialCandidates.has(r)&&n?.onAutoForward===void 0||this.notifiedOnly.has(r)||this.autoForwarded.has(r))continue;let s=Ib(this.remoteExplorerService.tunnelModel.forwarded,o.host,o.port);if(Ib(this.remoteExplorerService.tunnelModel.detected,o.host,o.port))continue;if(n?.onAutoForward==="ignore"){this.logService.trace(`ForwardedPorts: (ProcForwarding) Port ${o.port} is ignored`);continue}let l=await this.remoteExplorerService.forward({remote:o,source:sMt},n??null);!s&&l?(this.logService.trace(`ForwardedPorts: (ProcForwarding) Port ${o.port} has been forwarded`),this.autoForwarded.add(r)):l&&(this.logService.trace(`ForwardedPorts: (ProcForwarding) Port ${o.port} has been notified`),this.notifiedOnly.add(r)),l&&typeof l!="string"&&t.push(l)}if(this.logService.trace(`ForwardedPorts: (ProcForwarding) Forwarded ${t.length} candidates`),t.length!==0)return t}async handleCandidateUpdate(e){let t=[],o;if(this.unforwardOnly){o=new Map;for(let r of this.remoteExplorerService.tunnelModel.forwarded.entries())r[1].source.source===1&&o.set(r[0],r[1])}else o=new Map(this.autoForwarded.entries());for(let r of e){let s=r[0],l=r[1],c=Ib(o,l.host,l.port);c?(typeof c=="string"?this.autoForwarded.delete(s):l={host:c.remoteHost,port:c.remotePort},await this.remoteExplorerService.close(l,"AutoForwardEnd"),t.push(l.port)):this.notifiedOnly.delete(s)?t.push(l.port):this.initialCandidates.delete(s)}if(this.unforwardOnly)return;t.length>0&&await this.notifier.hide(t);let n=await this.forwardCandidates();n&&await this.notifier.doAction(n)}};var Ivi={webviewState:"webviewState"},gJ=class extends zr{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super({...e,titleMenuId:D.ViewTitle,showActions:1},s,n,t,o,p,r,l,u,c);this.activityService=h;this.extensionService=g;this.progressService=f;this.storageService=v;this.viewService=b;this.webviewService=S;this.webviewViewService=y;this._webview=this._register(new me);this._webviewDisposables=this._register(new P);this._activated=!1;this.activity=this._register(new me);this._onDidChangeVisibility=this._register(new E);this.onDidChangeVisibility=this._onDidChangeVisibility.event;this._onDispose=this._register(new E);this.onDispose=this._onDispose.event;this.extensionId=e.fromExtensionId,this.defaultTitle=this.title,this.memento=new Bl(`webviewView.${this.id}`,v),this.viewState=this.memento.getMemento(1,1),this._register(this.onDidChangeBodyVisibility(()=>this.updateTreeVisibility())),this._register(this.webviewViewService.onNewResolverRegistered(w=>{w.viewType===this.id&&this.updateTreeVisibility()})),this.updateTreeVisibility()}static getOriginStore(e){return this._originStore??=new vz("webviewViews.origins",e),this._originStore}dispose(){this._onDispose.fire(),clearTimeout(this._repositionTimeout),super.dispose()}focus(){super.focus(),this._webview.value?.focus()}renderBody(e){super.renderBody(e),this._container=e,this._rootContainer=void 0,this._resizeObserver||(this._resizeObserver=new ResizeObserver(()=>{setTimeout(()=>{this.layoutWebview()},0)}),this._register(Z(()=>{this._resizeObserver?.disconnect()})),this._resizeObserver.observe(e))}saveState(){this._webview.value&&(this.viewState[Ivi.webviewState]=this._webview.value.state),this.memento.saveMemento(),super.saveState()}layoutBody(e,t){super.layoutBody(e,t),this.layoutWebview(new ai(t,e))}updateTreeVisibility(){this.isBodyVisible()?(this.activate(),this._webview.value?.claim(this,Me(this.element),void 0)):this._webview.value?.release(this)}activate(){if(this._activated)return;this._activated=!0;let e=this.extensionId?gJ.getOriginStore(this.storageService).getOrigin(this.id,this.extensionId):void 0,t=this.webviewService.createWebviewOverlay({origin:e,providedViewType:this.id,title:this.title,options:{purpose:"webviewView"},contentOptions:{},extension:this.extensionId?{id:this.extensionId}:void 0});t.state=this.viewState[Ivi.webviewState],this._webview.value=t,this._container&&this.layoutWebview(),this._webviewDisposables.add(Z(()=>{this._webview.value?.release(this)})),this._webviewDisposables.add(t.onDidUpdateState(()=>{this.viewState[Ivi.webviewState]=t.state}));for(let n of[re.DRAG,re.DRAG_END,re.DRAG_ENTER,re.DRAG_LEAVE,re.DRAG_START])this._webviewDisposables.add(j(this._webview.value.container,n,r=>{r.preventDefault(),r.stopImmediatePropagation(),this.dropTargetElement.dispatchEvent(new DragEvent(r.type,r))}));this._webviewDisposables.add(new iX(Me(this.element),()=>this._webview.value));let o=this._webviewDisposables.add(new $e);this.withProgress(async()=>{await this.extensionService.activateByEvent(`onView:${this.id}`);let n=this,r={webview:t,onDidChangeVisibility:this.onDidChangeBodyVisibility,onDispose:this.onDispose,get title(){return n.setTitle},set title(s){n.updateTitle(s)},get description(){return n.titleDescription},set description(s){n.updateTitleDescription(s)},get badge(){return n.badge},set badge(s){n.updateBadge(s)},dispose:()=>{this._activated=!1,this._webview.clear(),this._webviewDisposables.clear()},show:s=>{this.viewService.openView(this.id,!s)}};await this.webviewViewService.resolve(this.id,r,o.token)})}updateTitle(e){this.setTitle=e,super.updateTitle(typeof e=="string"?e:this.defaultTitle)}updateBadge(e){if(!(this.badge?.value===e?.value&&this.badge?.tooltip===e?.tooltip)&&(this.badge=e,e)){let t={badge:new qc(e.value,()=>e.tooltip),priority:150};this.activity.value=this.activityService.showViewActivity(this.id,t)}}async withProgress(e){return this.progressService.withProgress({location:this.id,delay:500},e)}onDidScrollRoot(){this.layoutWebview()}doLayoutWebview(e){let t=this._webview.value;!this._container||!t||((!this._rootContainer||!this._rootContainer.isConnected)&&(this._rootContainer=this.findRootContainer(this._container)),t.layoutWebviewOverElement(this._container,e,this._rootContainer))}layoutWebview(e){this.doLayoutWebview(e),clearTimeout(this._repositionTimeout),this._repositionTimeout=setTimeout(()=>this.doLayoutWebview(e),200)}findRootContainer(e){return Nh(e,"monaco-scrollable-element")??void 0}};gJ=I([m(1,B),m(2,X),m(3,ze),m(4,F),m(5,_e),m(6,Qe),m(7,tt),m(8,De),m(9,Ri),m(10,zl),m(11,lt),m(12,Bo),m(13,le),m(14,Ft),m(15,wm),m(16,VEe)],gJ);var yvi={type:"object",properties:{id:{description:d(3128,null),type:"string",pattern:"^[a-zA-Z0-9_-]+$"},title:{description:d(3129,null),type:"string"},icon:{description:d(3127,null),type:"string"}},required:["id","title","icon"]},q$o={description:d(3130,null),type:"object",properties:{activitybar:{description:d(3101,null),type:"array",items:yvi},panel:{description:d(3102,null),type:"array",items:yvi},secondarySidebar:{description:d(3103,null),type:"array",items:yvi}},additionalProperties:!1};var wvi=(t=>(t.Visible="visible",t.Hidden="hidden",t.Collapsed="collapsed",t))(wvi||{}),P7e={type:"object",required:["id","name","icon"],defaultSnippets:[{body:{id:"${1:id}",name:"${2:name}",icon:"${3:icon}"}}],properties:{type:{markdownDescription:d(3123,null),type:"string",enum:["tree","webview"],markdownEnumDescriptions:[d(3122,null),d(3124,null)]},id:{markdownDescription:d(3115,null),type:"string"},name:{description:d(3120,null),type:"string"},when:{description:d(3125,null),type:"string"},icon:{description:d(3114,null),type:"string"},contextualTitle:{description:d(3112,null),type:"string"},visibility:{description:d(3116,null),type:"string",enum:["visible","hidden","collapsed"],default:"visible",enumDescriptions:[d(3119,null),d(3118,null),d(3117,null)]},initialSize:{type:"number",description:d(3131,null)},accessibilityHelpContent:{type:"string",markdownDescription:d(3111,null)}}},j$o={type:"object",required:["id","name"],properties:{id:{description:d(3115,null),type:"string"},name:{description:d(3120,null),type:"string"},when:{description:d(3125,null),type:"string"},group:{description:d(3113,null),type:"string"},remoteName:{description:d(3121,null),type:["string","array"],items:{type:"string"}}}},Q$o={description:d(3126,null),type:"object",properties:{explorer:{description:d(3106,null),type:"array",items:P7e,default:[]},debug:{description:d(3105,null),type:"array",items:P7e,default:[]},scm:{description:d(3108,null),type:"array",items:P7e,default:[]},test:{description:d(3109,null),type:"array",items:P7e,default:[]},remote:{description:d(3107,null),type:"array",items:j$o,default:[]}},additionalProperties:{description:d(3104,null),type:"array",items:P7e,default:[]}},Koo=Tn.registerExtensionPoint({extensionPoint:"viewsContainers",jsonSchema:q$o}),Y$o=Tn.registerExtensionPoint({extensionPoint:"views",deps:[Koo],jsonSchema:Q$o,activationEventsGenerator:function*(a){for(let i of a)for(let e of Object.values(i))for(let t of e)t.id&&(yield`onView:${t.id}`)}}),X$o=7,R_e=class{constructor(i,e){this.instantiationService=i;this.logService=e;this.viewContainersRegistry=oe.as(on.ViewContainersRegistry),this.viewsRegistry=oe.as(on.ViewsRegistry),this.handleAndRegisterCustomViewContainers(),this.handleAndRegisterCustomViews()}static{this.ID="workbench.contrib.viewsExtensionHandler"}handleAndRegisterCustomViewContainers(){Koo.setHandler((i,{added:e,removed:t})=>{t.length&&this.removeCustomViewContainers(t),e.length&&this.addCustomViewContainers(e,this.viewContainersRegistry.all)})}addCustomViewContainers(i,e){let t=oe.as(on.ViewContainersRegistry),o=X$o+t.all.filter(s=>!!s.extensionId&&t.getViewContainerLocation(s)===0).length,n=5+t.all.filter(s=>!!s.extensionId&&t.getViewContainerLocation(s)===1).length+1,r=100+t.all.filter(s=>!!s.extensionId&&t.getViewContainerLocation(s)===2).length+1;for(let{value:s,collector:l,description:c}of i)Object.entries(s).forEach(([u,p])=>{if(this.isValidViewsContainer(p,l))switch(u){case"activitybar":o=this.registerCustomViewContainers(p,c,o,e,0);break;case"panel":n=this.registerCustomViewContainers(p,c,n,e,1);break;case"secondarySidebar":r=this.registerCustomViewContainers(p,c,r,e,2);break}})}removeCustomViewContainers(i){let e=oe.as(on.ViewContainersRegistry),t=i.reduce((o,n)=>(o.add(n.description.identifier),o),new QI);for(let o of e.all)if(o.extensionId&&t.has(o.extensionId)){let n=this.viewsRegistry.getViews(o);n.length&&this.viewsRegistry.moveViews(n,this.getDefaultViewContainer()),this.deregisterCustomViewContainer(o)}}isValidViewsContainer(i,e){if(!Array.isArray(i))return e.error(d(3097,null)),!1;for(let t of i){if(typeof t.id!="string"&&Jl(t.id))return e.error(d(3087,null,"id")),!1;if(!/^[a-z0-9_-]+$/i.test(t.id))return e.error(d(3087,null,"id")),!1;if(typeof t.title!="string")return e.error(d(3090,null,"title")),!1;if(typeof t.icon!="string")return e.error(d(3090,null,"icon")),!1;if(Jl(t.title))return e.warn(d(3088,null,"title")),!0}return!0}registerCustomViewContainers(i,e,t,o,n){return i.forEach(r=>{let l=q.fromString(r.icon)||je(e.extensionLocation,r.icon),c=`workbench.view.extension.${r.id}`,u=r.title||c,p=this.registerCustomViewContainer(c,u,l,t++,e.identifier,n);if(o.length){let h=[];for(let g of o)p!==g&&h.push(...this.viewsRegistry.getViews(g).filter(f=>f.originalContainerId===r.id));h.length&&this.viewsRegistry.moveViews(h,p)}}),t}registerCustomViewContainer(i,e,t,o,n,r){let s=this.viewContainersRegistry.get(i);return s||(s=this.viewContainersRegistry.registerViewContainer({id:i,title:{value:e,original:e},extensionId:n,ctorDescriptor:new Mt(Ha,[i,{mergeViewWithContainerWhenSingleView:!0}]),hideIfEmpty:!0,order:o,icon:t},r)),s}deregisterCustomViewContainer(i){this.viewContainersRegistry.deregisterViewContainer(i),oe.as(yR.Viewlets).deregisterPaneComposite(i.id)}handleAndRegisterCustomViews(){Y$o.setHandler((i,{added:e,removed:t})=>{t.length&&this.removeViews(t),e.length&&this.addViews(e)})}addViews(i){let e=new Set,t=[];for(let o of i){let{value:n,collector:r}=o;Object.entries(n).forEach(([s,l])=>{if(!this.isValidViewDescriptors(l,r))return;if(s==="remote"&&!Ea(o.description,"contribViewsRemote")){r.warn(d(3099,null,s));return}if(s==="agentSessions"&&!Ea(o.description,"chatSessionsProvider")){r.warn(d(3089,null,s));return}let c=this.getViewContainer(s);c||r.warn(d(3098,null,s));let u=c||this.getDefaultViewContainer(),p=[];for(let h=0;h<l.length;h++){let g=l[h];if(e.has(g.id)){r.error(d(3082,null,g.id));continue}if(this.viewsRegistry.getView(g.id)!==null){r.error(d(3083,null,g.id));continue}let f=Ei.equals(o.description.identifier,u.extensionId)?h+1:u.viewOrderDelegate?u.viewOrderDelegate.getOrder(g.group):void 0,v;typeof g.icon=="string"&&(v=q.fromString(g.icon)||je(o.description.extensionLocation,g.icon));let b=this.convertInitialVisibility(g.visibility),S=this.getViewType(g.type);if(!S){r.error(d(3091,null,g.type));continue}let y;typeof g.initialSize=="number"&&(u.extensionId?.value===o.description.identifier.value?y=g.initialSize:this.logService.warn(`${o.description.identifier.value} tried to set the view size of ${g.id} but it was ignored because the view container does not belong to it.`));let w;Ea(o.description,"contribAccessibilityHelpContent")&&g.accessibilityHelpContent&&(w=new xe(g.accessibilityHelpContent));let k={type:S,ctorDescriptor:S==="tree"?new Mt(eD):new Mt(gJ),id:g.id,name:{value:g.name,original:g.name},when:x.deserialize(g.when),containerIcon:v||c?.icon,containerTitle:g.contextualTitle||c&&(typeof c.title=="string"?c.title:c.title.value),canToggleVisibility:!0,canMoveView:c?.id!==KV,treeView:S==="tree"?this.instantiationService.createInstance(k_e,g.id,g.name,o.description.identifier.value):void 0,collapsed:this.showCollapsed(u)||b==="collapsed",order:f,extensionId:o.description.identifier,originalContainerId:s,group:g.group,remoteAuthority:g.remoteName||g.remoteAuthority,virtualWorkspace:g.virtualWorkspace,hideByDefault:b==="hidden",workspace:c?.id===KV?!0:void 0,weight:y,accessibilityHelpContent:w};e.add(k.id),p.push(k)}t.push({viewContainer:u,views:p})})}this.viewsRegistry.registerViews2(t)}getViewType(i){if(i==="webview")return"webview";if(!i||i==="tree")return"tree"}getDefaultViewContainer(){return this.viewContainersRegistry.get(Hf)}removeViews(i){let e=i.reduce((t,o)=>(t.add(o.description.identifier),t),new QI);for(let t of this.viewContainersRegistry.all){let o=this.viewsRegistry.getViews(t).filter(n=>n.extensionId&&e.has(n.extensionId));if(o.length){this.viewsRegistry.deregisterViews(o,t);for(let n of o){let r=n;r.treeView&&r.treeView.dispose()}}}}convertInitialVisibility(i){if(Object.values(wvi).includes(i))return i}isValidViewDescriptors(i,e){if(!Array.isArray(i))return e.error(d(3086,null)),!1;for(let t of i){if(typeof t.id!="string")return e.error(d(3090,null,"id")),!1;if(typeof t.name!="string")return e.error(d(3090,null,"name")),!1;if(t.when&&typeof t.when!="string")return e.error(d(3085,null,"when")),!1;if(t.icon&&typeof t.icon!="string")return e.error(d(3085,null,"icon")),!1;if(t.contextualTitle&&typeof t.contextualTitle!="string")return e.error(d(3085,null,"contextualTitle")),!1;if(t.visibility&&!this.convertInitialVisibility(t.visibility))return e.error(d(3084,null,"visibility",Object.values(wvi).join(", "))),!1}return!0}getViewContainer(i){switch(i){case"explorer":return this.viewContainersRegistry.get(Hf);case"debug":return this.viewContainersRegistry.get(jh);case"scm":return this.viewContainersRegistry.get(Uce);case"remote":return this.viewContainersRegistry.get(KV);default:return this.viewContainersRegistry.get(`workbench.view.extension.${i}`)}}showCollapsed(i){switch(i.id){case Hf:case Uce:case jh:return!0}return!1}};R_e=I([m(0,F),m(1,ne)],R_e);var Cvi=class extends C{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.viewsContainers}render(e){let t=e.contributes?.viewsContainers||{},o=Object.keys(t).reduce((s,l)=>{let c=t[l];return s.push(...c.map(u=>({...u,location:l}))),s},[]);if(!o.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let n=[d(3092,null),d(3094,null),d(3093,null)],r=o.sort((s,l)=>s.id.localeCompare(l.id)).map(s=>[s.id,s.title,s.location]);return{data:{headers:n,rows:r},dispose:()=>{}}}},xvi=class extends C{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.views}render(e){let t=e.contributes?.views||{},o=Object.keys(t).reduce((s,l)=>{let c=t[l];return s.push(...c.map(u=>({...u,location:l}))),s},[]);if(!o.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let n=[d(3095,null),d(3096,null),d(3093,null)],r=o.sort((s,l)=>s.id.localeCompare(l.id)).map(s=>[s.id,s.name,s.location]);return{data:{headers:n,rows:r},dispose:()=>{}}}};oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:"viewsContainers",label:d(3110,null),access:{canToggle:!1},renderer:new Mt(Cvi)});oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:"views",label:d(3100,null),access:{canToggle:!1},renderer:new Mt(xvi)});pt(R_e.ID,R_e,ut.BlockStartup);var qm=class extends ek{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e.resource,void 0,n,t,o,r,c,p,h);this.model=e;this.environmentService=s;this.pathService=l;this.textModelService=u;this.modelResolve=void 0;this.modelDisposables=this._register(new P);this.cachedUntitledTextEditorModelReference=void 0;this.registerModelListeners(e),this._register(this.textFileService.untitled.onDidCreate(g=>this.onDidCreateUntitledModel(g)))}static{this.ID="workbench.editors.untitledEditorInput"}get typeId(){return qm.ID}get editorId(){return Ys.id}registerModelListeners(e){this.modelDisposables.clear(),this.modelDisposables.add(e.onDidChangeDirty(()=>this._onDidChangeDirty.fire())),this.modelDisposables.add(e.onDidChangeName(()=>this._onDidChangeLabel.fire())),this.modelDisposables.add(e.onDidRevert(()=>this.dispose()))}onDidCreateUntitledModel(e){Xe(e.resource,this.model.resource)&&e!==this.model&&(this.model=e,this.registerModelListeners(e))}getName(){return this.model.name}getDescription(e=1){if(!this.model.hasAssociatedFilePath){let t=this.resource.path;return t!==this.getName()?t:void 0}return super.getDescription(e)}getTitle(e){if(!this.model.hasAssociatedFilePath){let t=this.getName(),o=this.getDescription();return o&&o!==t?`${t} \u2022 ${o}`:t}return super.getTitle(e)}isDirty(){return this.model.isDirty()}getEncoding(){return this.model.getEncoding()}setEncoding(e,t){return this.model.setEncoding(e)}get hasLanguageSetExplicitly(){return this.model.hasLanguageSetExplicitly}get hasAssociatedFilePath(){return this.model.hasAssociatedFilePath}setLanguageId(e,t){this.model.setLanguageId(e,t)}getLanguageId(){return this.model.getLanguageId()}async resolve(){return this.modelResolve||(this.modelResolve=(async()=>{this.cachedUntitledTextEditorModelReference=await this.textModelService.createModelReference(this.resource)})()),await this.modelResolve,this.isDisposed()&&this.disposeModelReference(),this.model}toUntyped(e){let t={resource:this.model.hasAssociatedFilePath?Og(this.model.resource,this.environmentService.remoteAuthority,this.pathService.defaultUriScheme):this.resource,forceUntitled:!0,options:{override:this.editorId}};return typeof e?.preserveViewState=="number"&&(t.encoding=this.getEncoding(),t.languageId=this.getLanguageId(),t.contents=this.model.isModified()?this.model.textEditorModel?.getValue():void 0,t.options.viewState=Dj(this,e.preserveViewState,this.editorService),typeof t.contents=="string"&&!this.model.hasAssociatedFilePath&&!e.preserveResource&&(t.resource=void 0)),t}matches(e){return this===e?!0:e instanceof qm?Xe(e.resource,this.resource):Hxe(e)?super.matches(e):!1}dispose(){this.modelResolve=void 0,this.disposeModelReference(),super.dispose()}disposeModelReference(){Ue(this.cachedUntitledTextEditorModelReference),this.cachedUntitledTextEditorModelReference=void 0}};qm=I([m(1,Ho),m(2,ot),m(3,ee),m(4,be),m(5,Vt),m(6,wn),m(7,lr),m(8,Nt),m(9,Nn),m(10,Sv)],qm);var fJ=class extends aR{constructor(){super(...arguments);this.editorControl=void 0}get scopedContextKeyService(){return this.editorControl?.invokeWithinContext(e=>e.get(X))}getTitle(){return this.input?this.input.getName():d(4045,null)}createEditorControl(e,t){this.editorControl=this._register(this.instantiationService.createInstance(jr,e,t,this.getCodeEditorWidgetOptions()))}getCodeEditorWidgetOptions(){return Object.create(null)}updateEditorControlOptions(e){this.editorControl?.updateOptions(e)}getMainControl(){return this.editorControl}getControl(){return this.editorControl}computeEditorViewState(e){if(!this.editorControl)return;let t=this.editorControl.getModel();if(!t)return;let o=t.uri;if(o&&Xe(o,e))return this.editorControl.saveViewState()??void 0}setOptions(e){super.setOptions(e),e&&QE(e,Oi(this.editorControl),0)}focus(){super.focus(),this.editorControl?.focus()}hasFocus(){return this.editorControl?.hasTextFocus()||super.hasFocus()}setEditorVisible(e){super.setEditorVisible(e),e?this.editorControl?.onVisible():this.editorControl?.onHide()}layout(e){this.editorControl?.layout(e)}};var gue=class extends fJ{constructor(i,e,t,o,n,r,s,l,c,u){super(i,e,t,o,n,r,s,c,l,u)}async setInput(i,e,t,o){await super.setInput(i,e,t,o);let n=await i.resolve();if(o.isCancellationRequested)return;if(!(n instanceof rw))throw new Error("Unable to open file as text");let r=Oi(this.editorControl),s=n.textEditorModel;if(r.setModel(s),!Mj(e?.viewState)){let l=this.loadEditorViewState(i,t);l&&(e?.selection&&(l.cursorState=[]),r.restoreViewState(l))}e&&QE(e,r,1),r.updateOptions(this.getReadonlyConfiguration(n.isReadonly()))}revealLastLine(){let i=this.editorControl;if(!i)return;let e=i.getModel();if(e){let t=e.getLineCount();i.revealPosition({lineNumber:t,column:e.getLineMaxColumn(t)},0)}}clearInput(){super.clearInput(),this.editorControl?.setModel(null)}tracksEditorViewState(i){return i instanceof qm||i instanceof IC}};gue=I([m(2,Te),m(3,F),m(4,le),m(5,Nn),m(6,De),m(7,Et),m(8,ee),m(9,be)],gue);var j5=class extends gue{constructor(e,t,o,n,r,s,l,c,u,p,h){super(j5.ID,e,t,o,n,r,s,c,l,h);this.modelService=u;this.languageService=p}static{this.ID="workbench.editors.textResourceEditor"}createEditorControl(e,t){super.createEditorControl(e,t);let o=this.editorControl;o&&this._register(o.onDidPaste(n=>this.onDidEditorPaste(n,o)))}onDidEditorPaste(e,t){if(this.input instanceof qm&&this.input.hasLanguageSetExplicitly||e.range.startLineNumber!==1||e.range.startColumn!==1||t.getOption(104))return;let o=t.getModel();if(!o||!(o.getLineCount()===e.range.endLineNumber&&o.getLineMaxColumn(e.range.endLineNumber)===e.range.endColumn)||o.getLanguageId()!==Fr)return;let s;if(e.languageId)s={id:e.languageId,source:"event"};else{let l=this.languageService.guessLanguageIdByFilepathOrFirstLine(o.uri,o.getLineContent(1).substr(0,1e3))??void 0;l&&(s={id:l,source:"guess"})}if(s&&s.id!==Fr){this.input instanceof qm&&s.source==="event"?this.input.setLanguageId(s.id):o.setLanguage(this.languageService.createById(s.id));let l=this.modelService.getCreationOptions(o.getLanguageId(),o.uri,o.isForSimpleWidget);o.detectIndentation(l.insertSpaces,l.tabSize)}}};j5=I([m(1,Te),m(2,F),m(3,le),m(4,Nn),m(5,De),m(6,ee),m(7,Et),m(8,Ct),m(9,kt),m(10,be)],j5);var hK=class extends gg{constructor(e,t,o){super();this.resource=e;this.name=t;this.fileService=o;this.mime=Zn.binary}getName(){return this.name}getSize(){return this.size}getMime(){return this.mime}getETag(){return this.etag}async resolve(){if(this.fileService.hasProvider(this.resource)){let e=await this.fileService.stat(this.resource);this.etag=e.etag,typeof e.size=="number"&&(this.size=e.size)}return super.resolve()}};hK=I([m(2,be)],hK);var BC=class{constructor(i){this._container=i}set text(i){Fi(this._container,...Bn(i??""))}set title(i){!this.hover&&i?this.hover=yp().setupManagedHover(Ni("mouse"),this._container,i):this.hover&&this.hover.update(i)}dispose(){this.hover?.dispose()}};var gK=class extends pa{constructor(e,t,o,n,r){super(e,t,o,n,r);this.inputDisposable=this._register(new me)}static{this.PLACEHOLDER_LABEL_MAX_LENGTH=1024}createEditor(e){this.container=_(".monaco-editor-pane-placeholder",{tabIndex:0}),this.container.style.outline="none",this.scrollbar=this._register(new Pa(this.container,{horizontal:1,vertical:1})),e.appendChild(this.scrollbar.getDomNode())}async setInput(e,t,o,n){await super.setInput(e,t,o,n),!n.isCancellationRequested&&(this.inputDisposable.value=await this.renderInput(e,t))}async renderInput(e,t){let[o,n]=_y(this.container,this.scrollbar);Rt(o);let r=new P,{icon:s,label:l,actions:c}=await this.getContents(e,t,r),u=oN(l,gK.PLACEHOLDER_LABEL_MAX_LENGTH),p=o.appendChild(_(".editor-placeholder-icon-container")),h=r.add(new BC(p));h.text=s;let g=o.appendChild(_(".editor-placeholder-label-container")),f=_("span");if(f.textContent=u,g.appendChild(f),o.setAttribute("aria-label",`${JY(e,void 0,this.group,void 0)}, ${u}`),c.length){let v=o.appendChild(_(".editor-placeholder-buttons-container")),b=r.add(new _x(v));for(let S=0;S<c.length;S++){let y=r.add(b.addButton({...Ko,secondary:S!==0}));y.label=c[S].label,r.add(y.onDidClick(w=>{w&&$t.stop(w,!0),c[S].run()}))}}return n.scanDomNode(),r}clearInput(){this.container&&Rt(this.container),this.inputDisposable.clear(),super.clearInput()}layout(e){let[t,o]=_y(this.container,this.scrollbar);fN(t,e.width,e.height),o.scanDomNode(),t.classList.toggle("max-height-200px",e.height<=200)}focus(){super.focus(),this.container?.focus()}dispose(){this.container?.remove(),super.dispose()}};gK=I([m(2,Te),m(3,De),m(4,le)],gK);var Q5=class extends gK{constructor(e,t,o,n,r,s){super(Q5.ID,e,t,o,s);this.commandService=n;this.workspaceService=r}static{this.ID="workbench.editors.workspaceTrustRequiredEditor"}static{this.LABEL=d(3968,null)}static{this.DESCRIPTOR=ys.create(this,this.ID,this.LABEL)}getTitle(){return Q5.LABEL}async getContents(){return{icon:"$(workspace-untrusted)",label:$g(VS(this.workspaceService.getWorkspace()))?d(3964,null):d(3965,null),actions:[{label:d(3963,null),run:()=>this.commandService.executeCommand("workbench.trust.manage")}]}}};Q5=I([m(1,Te),m(2,De),m(3,ge),m(4,Pe),m(5,le)],Q5);var vJ=class extends gK{constructor(e,t,o,n,r,s,l){super(vJ.ID,e,t,o,n);this.fileService=r;this.dialogService=s;this.commandService=l}static{this.ID="workbench.editors.errorEditor"}static{this.LABEL=d(3962,null)}static{this.DESCRIPTOR=ys.create(this,this.ID,this.LABEL)}async getContents(e,t,o){let n=e.resource,r=t.error,s=r?.fileOperationResult===1,l;s?l=d(3969,null):Pj(r)&&r.forceMessage?l=r.message:r?l=d(3970,null):l=d(3971,null);let c="$(error)";Pj(r)&&(r.forceSeverity===gt.Info?c="$(info)":r.forceSeverity===gt.Warning&&(c="$(warning)"));let u;return Pj(r)&&r.actions.length>0?u=r.actions.map(p=>({label:p.label,run:()=>{let h=p.run();h instanceof Promise&&h.catch(g=>this.dialogService.error(In(g)))}})):u=[{label:d(3966,null),run:()=>this.group.openEditor(e,{...t,source:1})},{label:d(3967,null),run:()=>this.commandService.executeCommand(iK)}],s&&n&&this.fileService.hasProvider(n)&&o.add(this.fileService.onDidFilesChange(p=>{p.contains(n,1,0)&&this.group.openEditor(e,t)})),{icon:c,label:l,actions:u??[]}}};vJ=I([m(1,Te),m(2,De),m(3,le),m(4,be),m(5,ct),m(6,ge)],vJ);var CR=class extends gK{constructor(e,t,o,n,r,s){super(e,t,n,r,s);this.callbacks=o;this._onDidChangeMetadata=this._register(new E);this.onDidChangeMetadata=this._onDidChangeMetadata.event;this._onDidOpenInPlace=this._register(new E);this.onDidOpenInPlace=this._onDidOpenInPlace.event}getTitle(){return this.input?this.input.getName():d(3573,null)}async getContents(e,t){let o=await e.resolve();if(!(o instanceof hK))throw new Error("Unable to open file as binary");let n=o.getSize();return this.handleMetadataChanged(typeof n=="number"?ll.formatSize(n):""),{icon:"$(warning)",label:d(3574,null),actions:[{label:d(3575,null),run:async()=>{await this.callbacks.openInternal(e,t),this._onDidOpenInPlace.fire()}}]}}handleMetadataChanged(e){this.metadata=e,this._onDidChangeMetadata.fire()}getMetadata(){return this.metadata}};CR=I([m(5,le)],CR);var GV=class extends of{static{this.ID=LEt}constructor(i,e,t,o,n,r,s,l,c){super(i,e,t,o,n,r,s,l,c)}getMetadata(){let i=this.getPrimaryEditorPane(),e=this.getSecondaryEditorPane();if(i instanceof CR&&e instanceof CR)return d(3572,null,e.getMetadata(),i.getMetadata())}};GV=I([m(1,Te),m(2,F),m(3,De),m(4,le),m(5,B),m(6,Nn),m(7,ee),m(8,Et)],GV);var kvi=class{constructor(i,e){this.primary=i;this.secondary=e}getEncoding(){return this.primary.getEncoding()}async setEncoding(i,e){await fn.settled([this.primary,this.secondary].map(t=>t.setEncoding(i,e)))}},Evi=class{constructor(i,e){this.primary=i;this.secondary=e}setLanguageId(i,e){[this.primary,this.secondary].forEach(t=>t.setLanguageId(i,e))}};function F7e(a){if(a instanceof qm)return a;if(a instanceof ga){let e=F7e(a.primary),t=F7e(a.secondary);return e&&t?new kvi(e,t):e}let i=a;return zut(i.setEncoding,i.getEncoding)?i:null}function XPt(a){if(a instanceof qm)return a;if(a instanceof ga){let e=XPt(a.primary),t=XPt(a.secondary);return e&&t?new Evi(e,t):e}let i=a;return typeof i.setLanguageId=="function"?i:null}var Tvi=class{constructor(){this.indentation=!1;this.selectionStatus=!1;this.languageId=!1;this.languageStatus=!1;this.encoding=!1;this.EOL=!1;this.tabFocusMode=!1;this.inputMode=!1;this.columnSelectionMode=!1;this.metadata=!1}combine(i){this.indentation=this.indentation||i.indentation,this.selectionStatus=this.selectionStatus||i.selectionStatus,this.languageId=this.languageId||i.languageId,this.languageStatus=this.languageStatus||i.languageStatus,this.encoding=this.encoding||i.encoding,this.EOL=this.EOL||i.EOL,this.tabFocusMode=this.tabFocusMode||i.tabFocusMode,this.inputMode=this.inputMode||i.inputMode,this.columnSelectionMode=this.columnSelectionMode||i.columnSelectionMode,this.metadata=this.metadata||i.metadata}hasChanges(){return this.indentation||this.selectionStatus||this.languageId||this.languageStatus||this.encoding||this.EOL||this.tabFocusMode||this.inputMode||this.columnSelectionMode||this.metadata}},_vi=class{get selectionStatus(){return this._selectionStatus}get languageId(){return this._languageId}get encoding(){return this._encoding}get EOL(){return this._EOL}get indentation(){return this._indentation}get tabFocusMode(){return this._tabFocusMode}get inputMode(){return this._inputMode}get columnSelectionMode(){return this._columnSelectionMode}get metadata(){return this._metadata}update(i){let e=new Tvi;switch(i.type){case"selectionStatus":this._selectionStatus!==i.selectionStatus&&(this._selectionStatus=i.selectionStatus,e.selectionStatus=!0);break;case"indentation":this._indentation!==i.indentation&&(this._indentation=i.indentation,e.indentation=!0);break;case"languageId":this._languageId!==i.languageId&&(this._languageId=i.languageId,e.languageId=!0);break;case"encoding":this._encoding!==i.encoding&&(this._encoding=i.encoding,e.encoding=!0);break;case"EOL":this._EOL!==i.EOL&&(this._EOL=i.EOL,e.EOL=!0);break;case"tabFocusMode":this._tabFocusMode!==i.tabFocusMode&&(this._tabFocusMode=i.tabFocusMode,e.tabFocusMode=!0);break;case"inputMode":this._inputMode!==i.inputMode&&(this._inputMode=i.inputMode,e.inputMode=!0);break;case"columnSelectionMode":this._columnSelectionMode!==i.columnSelectionMode&&(this._columnSelectionMode=i.columnSelectionMode,e.columnSelectionMode=!0);break;case"metadata":this._metadata!==i.metadata&&(this._metadata=i.metadata,e.metadata=!0);break}return e}},A7e=class extends C{constructor(e){super();this.configurationService=e;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this.registerListeners();let t=e.getValue("editor.tabFocusMode")===!0;GT.setTabFocusMode(t)}registerListeners(){this._register(GT.onDidChangeTabFocus(e=>this._onDidChange.fire(e))),this._register(this.configurationService.onDidChangeConfiguration(e=>{if(e.affectsConfiguration("editor.tabFocusMode")){let t=this.configurationService.getValue("editor.tabFocusMode")===!0;GT.setTabFocusMode(t),this._onDidChange.fire(t)}}))}};A7e=I([m(0,B)],A7e);var Dvi=class extends C{constructor(){super();this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;nW.setInputMode("insert"),this._register(nW.onDidChangeInputMode(e=>this._onDidChange.fire(e)))}},J$o=d(4023,null),Z$o=d(4022,null),eqo=d(4002,null),tqo=d(4001,null),Goo=d(3991,null),$oo=d(3990,null),N7e=class extends C{constructor(e,t,o,n,r,s,l,c){super();this.targetWindowId=e;this.editorService=t;this.quickInputService=o;this.languageService=n;this.textFileService=r;this.statusbarService=s;this.configurationService=c;this.tabFocusModeElement=this._register(new me);this.inputModeElement=this._register(new me);this.columnSelectionModeElement=this._register(new me);this.indentationElement=this._register(new me);this.selectionElement=this._register(new me);this.encodingElement=this._register(new me);this.eolElement=this._register(new me);this.languageElement=this._register(new me);this.metadataElement=this._register(new me);this.state=new _vi;this.toRender=void 0;this.activeEditorListeners=this._register(new P);this.delayedRender=this._register(new me);this.currentMarkerStatus=this._register(l.createInstance(O7e)),this.tabFocusMode=this._register(l.createInstance(A7e)),this.inputMode=this._register(l.createInstance(Dvi)),this.registerCommands(),this.registerListeners()}registerListeners(){this._register(this.editorService.onDidActiveEditorChange(()=>this.updateStatusBar())),this._register(this.textFileService.untitled.onDidChangeEncoding(e=>this.onResourceEncodingChange(e.resource))),this._register(this.textFileService.files.onDidChangeEncoding(e=>this.onResourceEncodingChange(e.resource))),this._register(H.runAndSubscribe(this.tabFocusMode.onDidChange,e=>{e!==void 0?this.onTabFocusModeChange(e):this.onTabFocusModeChange(this.configurationService.getValue("editor.tabFocusMode"))})),this._register(H.runAndSubscribe(this.inputMode.onDidChange,e=>this.onInputModeChange(e??"insert")))}registerCommands(){this._register(qe.registerCommand({id:`changeEditorIndentation${this.targetWindowId}`,handler:()=>this.showIndentationPicker()}))}async showIndentationPicker(){let e=ca(this.editorService.activeTextEditorControl);if(!e)return this.quickInputService.pick([{label:d(4003,null)}]);if(this.editorService.activeEditor?.isReadonly())return this.quickInputService.pick([{label:d(4005,null)}]);let t=[Oi(e.getAction(c3e.ID)),Oi(e.getAction(l3e.ID)),Oi(e.getAction(d3e.ID)),Oi(e.getAction(u3e.ID)),Oi(e.getAction(r3e.ID)),Oi(e.getAction(s3e.ID)),Oi(e.getAction(w4e.ID))].map(n=>({id:n.id,label:n.label,detail:IS.isDefaultVariant()||n.label===n.alias?void 0:n.alias,run:()=>{e.focus(),n.run()}}));return t.splice(3,0,{type:"separator",label:d(3995,null)}),t.unshift({type:"separator",label:d(3996,null)}),(await this.quickInputService.pick(t,{placeHolder:d(4006,null),matchOnDetail:!0}))?.run()}updateTabFocusModeElement(e){if(e){if(!this.tabFocusModeElement.value){let t=d(4035,null);this.tabFocusModeElement.value=this.statusbarService.addEntry({name:d(4034,null),text:t,ariaLabel:t,tooltip:d(3989,null),command:"editor.action.toggleTabFocusMode",kind:"prominent"},"status.editor.tabFocusMode",1,100.7)}}else this.tabFocusModeElement.clear()}updateInputModeElement(e){if(e==="overtype"){if(!this.inputModeElement.value){let t=d(3997,null),o=d(4027,null);this.inputModeElement.value=this.statusbarService.addEntry({name:o,text:t,ariaLabel:t,tooltip:o,command:"editor.action.toggleOvertypeInsertMode",kind:"prominent"},"status.editor.inputMode",1,100.6)}}else this.inputModeElement.clear()}updateColumnSelectionModeElement(e){if(e){if(!this.columnSelectionModeElement.value){let t=d(3983,null);this.columnSelectionModeElement.value=this.statusbarService.addEntry({name:d(4026,null),text:t,ariaLabel:t,tooltip:d(3988,null),command:"editor.action.toggleColumnSelection",kind:"prominent"},"status.editor.columnSelectionMode",1,100.8)}}else this.columnSelectionModeElement.clear()}updateSelectionElement(e){if(!e){this.selectionElement.clear();return}if(ca(this.editorService.activeTextEditorControl)?.getModel()?.uri?.scheme===Y.vscodeNotebookCell){this.selectionElement.clear();return}let o={name:d(4033,null),text:e,ariaLabel:e,tooltip:d(3993,null),command:"workbench.action.gotoLine"};this.updateElement(this.selectionElement,o,"status.editor.selection",1,100.5)}updateIndentationElement(e){if(!e){this.indentationElement.clear();return}if(ca(this.editorService.activeTextEditorControl)?.getModel()?.uri?.scheme===Y.vscodeNotebookCell){this.indentationElement.clear();return}let o={name:d(4030,null),text:e,ariaLabel:e,tooltip:d(4019,null),command:`changeEditorIndentation${this.targetWindowId}`};this.updateElement(this.indentationElement,o,"status.editor.indentation",1,100.4)}updateEncodingElement(e){if(!e){this.encodingElement.clear();return}let t={name:d(4028,null),text:e,ariaLabel:e,tooltip:d(4017,null),command:"workbench.action.editor.changeEncoding"};this.updateElement(this.encodingElement,t,"status.editor.encoding",1,100.3)}updateEOLElement(e){if(!e){this.eolElement.clear();return}let t={name:d(4029,null),text:e,ariaLabel:e,tooltip:d(4018,null),command:"workbench.action.editor.changeEOL"};this.updateElement(this.eolElement,t,"status.editor.eol",1,100.2)}updateLanguageIdElement(e){if(!e){this.languageElement.clear();return}let t={name:d(4032,null),text:e,ariaLabel:e,tooltip:d(4020,null),command:"workbench.action.editor.changeLanguageMode"};this.updateElement(this.languageElement,t,"status.editor.mode",1,100.1)}updateMetadataElement(e){if(!e){this.metadataElement.clear();return}let t={name:d(4031,null),text:e,ariaLabel:e,tooltip:d(3992,null)};this.updateElement(this.metadataElement,t,"status.editor.info",1,100)}updateElement(e,t,o,n,r){e.value?e.value.update(t):e.value=this.statusbarService.addEntry(t,o,n,r)}updateState(e){let t=this.state.update(e);t.hasChanges()&&(this.toRender?this.toRender.combine(t):(this.toRender=t,this.delayedRender.value=Ah(qv(this.targetWindowId,!0).window,()=>{this.delayedRender.clear();let o=this.toRender;this.toRender=void 0,o&&this.doRenderNow()})))}doRenderNow(){this.updateTabFocusModeElement(!!this.state.tabFocusMode),this.updateInputModeElement(this.state.inputMode),this.updateColumnSelectionModeElement(!!this.state.columnSelectionMode),this.updateIndentationElement(this.state.indentation),this.updateSelectionElement(this.state.selectionStatus),this.updateEncodingElement(this.state.encoding),this.updateEOLElement(this.state.EOL?this.state.EOL===`\r
`?$oo:Goo:void 0),this.updateLanguageIdElement(this.state.languageId),this.updateMetadataElement(this.state.metadata)}getSelectionLabel(e){if(e?.selections){if(e.selections.length===1)return e.charactersSelected?id(J$o,e.selections[0].positionLineNumber,e.selections[0].positionColumn,e.charactersSelected):id(Z$o,e.selections[0].positionLineNumber,e.selections[0].positionColumn);if(e.charactersSelected)return id(eqo,e.selections.length,e.charactersSelected);if(e.selections.length>0)return id(tqo,e.selections.length)}}updateStatusBar(){let e=this.editorService.activeEditor,t=this.editorService.activeEditorPane,o=t?ca(t.getControl())??void 0:void 0;if(this.onColumnSelectionModeChange(o),this.onSelectionChange(o),this.onLanguageChange(o,e),this.onEOLChange(o),this.onEncodingChange(t,o),this.onIndentationChange(o),this.onMetadataChange(t),this.currentMarkerStatus.update(o),this.activeEditorListeners.clear(),t&&this.activeEditorListeners.add(t.onDidChangeControl(()=>{this.updateStatusBar()})),o)this.activeEditorListeners.add(o.onDidChangeConfiguration(n=>{n.hasChanged(28)&&this.onColumnSelectionModeChange(o)})),this.activeEditorListeners.add(H.defer(o.onDidChangeCursorPosition)(()=>{this.onSelectionChange(o),this.currentMarkerStatus.update(o)})),this.activeEditorListeners.add(o.onDidChangeModelLanguage(()=>{this.onLanguageChange(o,e)})),this.activeEditorListeners.add(H.accumulate(o.onDidChangeModelContent)(n=>{this.onEOLChange(o),this.currentMarkerStatus.update(o);let r=o.getSelections();if(r){for(let s of n)for(let l of s.changes)if(r.some(c=>z.areIntersecting(c,l.range))){this.onSelectionChange(o);break}}})),this.activeEditorListeners.add(o.onDidChangeModelOptions(()=>{this.onIndentationChange(o)}));else if(t instanceof CR||t instanceof GV){let n=[];if(t instanceof GV){let r=t.getPrimaryEditorPane();r instanceof CR&&n.push(r);let s=t.getSecondaryEditorPane();s instanceof CR&&n.push(s)}else n.push(t);for(let r of n)this.activeEditorListeners.add(r.onDidChangeMetadata(()=>{this.onMetadataChange(t)})),this.activeEditorListeners.add(r.onDidOpenInPlace(()=>{this.updateStatusBar()}))}}onLanguageChange(e,t){let o={type:"languageId",languageId:void 0};if(e&&t&&XPt(t)){let n=e.getModel();if(n){let r=n.getLanguageId();o.languageId=this.languageService.getLanguageName(r)??void 0}}this.updateState(o)}onIndentationChange(e){let t={type:"indentation",indentation:void 0};if(e){let o=e.getModel();if(o){let n=o.getOptions();t.indentation=n.insertSpaces?n.tabSize===n.indentSize?d(4025,null,n.indentSize):d(4024,null,n.indentSize,n.tabSize):d(4036,null,n.tabSize)}}this.updateState(t)}onMetadataChange(e){let t={type:"metadata",metadata:void 0};(e instanceof CR||e instanceof GV)&&(t.metadata=e.getMetadata()),this.updateState(t)}onColumnSelectionModeChange(e){let t={type:"columnSelectionMode",columnSelectionMode:!1};e?.getOption(28)&&(t.columnSelectionMode=!0),this.updateState(t)}onSelectionChange(e){let t=Object.create(null);if(e){t.selections=e.getSelections()||[],t.charactersSelected=0;let o=e.getModel();if(o)for(let n of t.selections)typeof t.charactersSelected!="number"&&(t.charactersSelected=0),t.charactersSelected+=o.getCharacterCountInRange(n);if(t.selections.length===1){let n=e.getPosition(),r=new Yt(t.selections[0].selectionStartLineNumber,t.selections[0].selectionStartColumn,t.selections[0].positionLineNumber,n?e.getStatusbarColumn(n):t.selections[0].positionColumn);t.selections[0]=r}}this.updateState({type:"selectionStatus",selectionStatus:this.getSelectionLabel(t)})}onEOLChange(e){let t={type:"EOL",EOL:void 0};if(e&&!e.getOption(104)){let o=e.getModel();o&&(t.EOL=o.getEOL())}this.updateState(t)}onEncodingChange(e,t){if(e&&!this.isActiveEditor(e))return;let o={type:"encoding",encoding:void 0};if(e&&t?.hasModel()){let n=e.input?F7e(e.input):null;if(n){let r=n.getEncoding(),s=typeof r=="string"?aw[r]:void 0;s?o.encoding=s.labelShort:o.encoding=r}}this.updateState(o)}onResourceEncodingChange(e){let t=this.editorService.activeEditorPane;if(t){let o=no.getCanonicalUri(t.input,{supportSideBySide:1});if(o&&Xe(o,e)){let n=ca(t.getControl())??void 0;return this.onEncodingChange(t,n)}}}onTabFocusModeChange(e){let t={type:"tabFocusMode",tabFocusMode:e};this.updateState(t)}onInputModeChange(e){let t={type:"inputMode",inputMode:e};this.updateState(t)}isActiveEditor(e){let t=this.editorService.activeEditorPane;return!!t&&t===e}};N7e=I([m(1,ee),m(2,Ge),m(3,kt),m(4,Ho),m(5,Tr),m(6,F),m(7,B)],N7e);var fue=class extends C{constructor(e){super();this.editorGroupService=e;for(let t of e.parts)this.createEditorStatus(t);this._register(e.onDidCreateAuxiliaryEditorPart(t=>this.createEditorStatus(t)))}static{this.ID="workbench.contrib.editorStatus"}createEditorStatus(e){let t=new P;H.once(e.onWillDispose)(()=>t.dispose());let o=this.editorGroupService.getScopedInstantiationService(e);t.add(o.createInstance(N7e,e.windowId))}};fue=I([m(0,Et)],fue);var O7e=class extends C{constructor(e,t,o){super();this.statusbarService=e;this.markerService=t;this.configurationService=o;this.editor=void 0;this.markers=[];this.currentMarker=null;this.statusBarEntryAccessor=this._register(new me),this._register(t.onMarkerChanged(n=>this.onMarkerChanged(n))),this._register(H.filter(o.onDidChangeConfiguration,n=>n.affectsConfiguration("problems.showCurrentInStatus"))(()=>this.updateStatus()))}update(e){this.editor=e,this.updateMarkers(),this.updateStatus()}updateStatus(){let e=this.currentMarker;if(this.currentMarker=this.getMarker(),this.hasToUpdateStatus(e,this.currentMarker))if(this.currentMarker){let t=mc(this.currentMarker.message)[0],o=`${this.getType(this.currentMarker)} ${t}`;this.statusBarEntryAccessor.value?this.statusBarEntryAccessor.value.update({name:d(3987,null),text:o,ariaLabel:o}):this.statusBarEntryAccessor.value=this.statusbarService.addEntry({name:d(3987,null),text:o,ariaLabel:o},"statusbar.currentProblem",0)}else this.statusBarEntryAccessor.clear()}hasToUpdateStatus(e,t){return!t||!e?!0:TW.makeKey(e)!==TW.makeKey(t)}getType(e){switch(e.severity){case 8:return"$(error)";case 4:return"$(warning)";case 2:return"$(info)"}return""}getMarker(){if(!this.configurationService.getValue("problems.showCurrentInStatus")||!this.editor||!this.editor.getModel())return null;let t=this.editor.getPosition();return t&&this.markers.find(o=>z.containsPosition(o,t))||null}onMarkerChanged(e){if(!this.editor)return;let t=this.editor.getModel();t&&(t&&!e.some(o=>Xe(t.uri,o))||this.updateMarkers())}updateMarkers(){if(!this.editor)return;let e=this.editor.getModel();e&&(e?(this.markers=this.markerService.read({resource:e.uri,severities:14}),this.markers.sort(this.compareMarker)):this.markers=[],this.updateStatus())}compareMarker(e,t){let o=Al(e.resource.toString(),t.resource.toString());return o===0&&(o=cl.compare(e.severity,t.severity)),o===0&&(o=z.compareRangesUsingStarts(e,t)),o}};O7e=I([m(0,Tr),m(1,Ns),m(2,B)],O7e);var bJ=class a extends K{static{this.ID="workbench.action.editor.changeLanguageMode"}constructor(){super({id:a.ID,title:L(3982,"Change Language Mode"),f1:!0,keybinding:{weight:200,primary:Ai(2089,43)},precondition:x.not("notebookEditorFocused"),metadata:{description:d(3981,null),args:[{name:d(3980,null),constraint:i=>typeof i=="string"}]}})}async run(i,e){let t=i.get(Ge),o=i.get(ee),n=i.get(kt),r=i.get(eS),s=i.get(Ho),l=i.get(Po),c=i.get(B),u=i.get(Te),p=i.get(ge),h=i.get(ta),g=ca(o.activeTextEditorControl);if(!g){await t.pick([{label:d(4003,null)}]);return}let f=g.getModel(),v=no.getOriginalUri(o.activeEditor,{supportSideBySide:1}),b,S;f&&(S=f.getLanguageId(),b=n.getLanguageName(S)??void 0);let y=!!v;v?.scheme===Y.untitled&&!s.untitled.get(v)?.hasAssociatedFilePath&&(y=!1);let k=n.getSortedRegisteredLanguageNames().map(({languageName:$,languageId:te})=>{let pe=n.getExtensions(te).join(" "),de;return b===$?de=d(3998,null,te):de=d(3999,null,te),{id:te,label:$,meta:pe,iconClasses:Y1(te),description:de}});k.unshift({type:"separator",label:d(4000,null)});let T,N,O;if(y&&v){let $=ms(v)||Ye(v);h.isEnabled()&&(O=pi({id:"workbench.action.showLanguageExtensions",label:d(4021,null,$),run:()=>p.executeCommand("workbench.extensions.action.showExtensionsForLanguage",$)}),k.unshift(O)),N={label:d(3985,null,b)},k.unshift(N),T={label:d(3984,null,$)},k.unshift(T)}let V={label:d(3977,null)};f&&f.getValueLength()>0&&k.unshift(V);let U=typeof e=="string"?{label:e}:await t.pick(k,{placeHolder:d(4010,null),matchOnDescription:!0});if(!U)return;if(U===O){O.run();return}if(U===T){v&&this.configureFileAssociation(v,n,t,c);return}if(U===N){l.openUserSettings({jsonEditor:!0,revealSetting:{key:`[${S??null}]`,edit:!0}});return}let G=o.activeEditor;if(G){let $=XPt(G);if($){let te,pe;if(U===V){if(f){let de=no.getOriginalUri(G,{supportSideBySide:1});if(de){let se=n.guessLanguageIdByFilepathOrFirstLine(de,f.getLineContent(1))??void 0;(!se||se==="unknown")&&(pe=await r.detectLanguage(de),se=pe),se&&(te=n.createById(se))}}}else te=n.createById(U.id),v&&r.detectLanguage(v).then(de=>{let se=n.getLanguageIdByLanguageName(U.label)||"unknown";if(de===S&&S!==se){let Se=c.getValue("workbench.editor.preferHistoryBasedLanguageDetection")?"history":"classic";u.publicLog2(X7i,{currentLanguageId:b??"unknown",nextLanguageId:U.label,lineCount:f?.getLineCount()??-1,modelPreference:Se})}});if(typeof te<"u"&&($.setLanguageId(te.languageId,a.ID),v?.scheme===Y.untitled)){let de=c.getValue("workbench.editor.preferHistoryBasedLanguageDetection")?"history":"classic";u.publicLog2("setUntitledDocumentLanguage",{to:te.languageId,from:S??"none",modelPreference:de})}}g.focus()}}configureFileAssociation(i,e,t,o){let n=ms(i),r=Ye(i),s=e.guessLanguageIdByFilepathOrFirstLine(A.file(r)),c=e.getSortedRegisteredLanguageNames().map(({languageName:u,languageId:p})=>({id:p,label:u,iconClasses:Y1(p),description:p===s?d(3986,null):void 0}));setTimeout(async()=>{let u=await t.pick(c,{placeHolder:d(4011,null,n||r)});if(u){let p=o.inspect(Y$),h;n&&r[0]!=="."?h=`*${n}`:h=r;let g=2;p.workspaceValue?.[h]&&(g=5);let f=Xi(g===5?p.workspaceValue:p.userValue)||Object.create(null);f[h]=u.id,o.updateValue(Y$,f,g)}},50)}},JPt=class extends K{constructor(){super({id:"workbench.action.editor.changeEOL",title:L(3979,"Change End of Line Sequence"),f1:!0})}async run(i){let e=i.get(ee),t=i.get(Ge),o=ca(e.activeTextEditorControl);if(!o){await t.pick([{label:d(4003,null)}]);return}if(e.activeEditor?.isReadonly()){await t.pick([{label:d(4005,null)}]);return}let n=o.getModel(),r=[{label:Goo,eol:0},{label:$oo,eol:1}],s=n?.getEOL()===`
`?0:1,l=await t.pick(r,{placeHolder:d(4009,null),activeItem:r[s]});if(l){let c=ca(e.activeTextEditorControl);c?.hasModel()&&!e.activeEditor?.isReadonly()&&(n=c.getModel(),n.pushStackElement(),n.pushEOL(l.eol),n.pushStackElement())}o.focus()}},ZPt=class extends K{constructor(){super({id:"workbench.action.editor.changeEncoding",title:L(3978,"Change File Encoding"),f1:!0})}async run(i){let e=i.get(ee),t=i.get(Ge),o=i.get(be),n=i.get(Ho),r=i.get(Nn),s=i.get(ct),l=ca(e.activeTextEditorControl);if(!l){await t.pick([{label:d(4003,null)}]);return}let c=e.activeEditorPane;if(!c){await t.pick([{label:d(4003,null)}]);return}let u=F7e(c.input);if(!u){await t.pick([{label:d(4004,null)}]);return}let p={label:d(4016,null)},h={label:d(4013,null)};if(!IS.isDefaultVariant()){let V="Save with Encoding";V!==p.label&&(p.detail=V);let U="Reopen with Encoding";U!==h.label&&(h.detail=U)}let g;if(u instanceof qm?g=p:c.input.isReadonly()?g=h:g=await t.pick([h,p],{placeHolder:d(4006,null),matchOnDetail:!0}),!g)return;await Pi(50);let f=no.getOriginalUri(c.input,{supportSideBySide:1});if(!f||!o.hasProvider(f)&&f.scheme!==Y.untitled)return;let v;o.hasProvider(f)&&(v=(await n.readStream(f,{autoGuessEncoding:!0,candidateGuessEncodings:r.getValue(f,"files.candidateGuessEncodings")})).encoding);let b=g===h,S=r.getValue(f,"files.encoding"),y,w,k=Object.keys(aw).sort((V,U)=>V===S?-1:U===S?1:aw[V].order-aw[U].order).filter(V=>V===v&&v!==S?!1:!b||!aw[V].encodeOnly).map((V,U)=>(V===u.getEncoding()?y=U:aw[V].alias===u.getEncoding()&&(w=U),{id:V,label:aw[V].labelLong,description:V})),T=k.slice();v&&S!==v&&aw[v]&&(k.unshift({type:"separator"}),k.unshift({id:v,label:aw[v].labelLong,description:d(3994,null)}));let N=await t.pick(k,{placeHolder:b?d(4007,null):d(4008,null),activeItem:T[typeof y=="number"?y:typeof w=="number"?w:-1]});if(!N||!e.activeEditorPane)return;let O=F7e(e.activeEditorPane.input);if(typeof N.id<"u"&&O){if(b&&e.activeEditorPane.input.isDirty()){let{confirmed:V}=await s.confirm({message:d(4015,null),detail:d(4014,null),primaryButton:d(4012,null)});if(!V)return;await e.activeEditorPane.input.revert(e.activeEditorPane.group.id)}await O.setEncoding(N.id,b?1:0)}l.focus()}};var zs=ae("historyService");var cp=class extends K{constructor(e,t,o){super(e);this.commandId=t;this.commandArgs=o}run(e){return e.get(ge).executeCommand(this.commandId,this.commandArgs)}},eAt=class extends K{getDirection(i){return pC(i)}async run(i,...e){let t=i.get(Et),o=i.get(B),n=i.get(ee),r=i.get(fo),s=this.getDirection(o),l=lp(e,n,t,r);jfi(t,s,l)}},tAt=class a extends eAt{static{this.ID=uJ}constructor(){super({id:a.ID,title:L(3884,"Split Editor"),f1:!0,keybinding:{weight:200,primary:2141},category:We.View})}},iAt=class extends eAt{constructor(){super({id:"workbench.action.splitEditorOrthogonal",title:L(3891,"Split Editor Orthogonal"),f1:!0,keybinding:{weight:200,primary:Ai(2089,2141)},category:We.View})}getDirection(i){return pC(i)===3?1:3}},oAt=class extends cp{constructor(){super({id:K5,title:L(3887,"Split Editor Left"),f1:!0,keybinding:{weight:200,primary:Ai(2089,2141)},category:We.View},K5)}},nAt=class extends cp{constructor(){super({id:uK,title:L(3888,"Split Editor Right"),f1:!0,keybinding:{weight:200,primary:Ai(2089,2141)},category:We.View},uK)}},rAt=class extends cp{static{this.LABEL=d(3889,null)}constructor(){super({id:z5,title:L(3890,"Split Editor Up"),f1:!0,keybinding:{weight:200,primary:Ai(2089,2141)},category:We.View},z5)}},sAt=class extends cp{static{this.LABEL=d(3885,null)}constructor(){super({id:dK,title:L(3886,"Split Editor Down"),f1:!0,keybinding:{weight:200,primary:Ai(2089,2141)},category:We.View},dK)}},aAt=class extends K{constructor(){super({id:"workbench.action.joinTwoGroups",title:L(3813,"Join Editor Group with Next Group"),f1:!0,category:We.View})}async run(i,e){let t=i.get(Et),o;if(e&&typeof e.groupId=="number"?o=t.getGroup(e.groupId):o=t.activeGroup,o){let n=[3,1,2,0];for(let r of n){let s=t.findGroup({direction:r},o);if(s&&o!==s){t.mergeGroup(o,s);break}}}}},lAt=class extends K{constructor(){super({id:"workbench.action.joinAllGroups",title:L(3812,"Join All Editor Groups"),f1:!0,category:We.View})}async run(i){let e=i.get(Et);e.mergeAllGroups(e.activeGroup)}},cAt=class extends K{constructor(){super({id:"workbench.action.navigateEditorGroups",title:L(3848,"Navigate Between Editor Groups"),f1:!0,category:We.View})}async run(i){let e=i.get(Et);e.findGroup({location:2},e.activeGroup,!0)?.focus()}},dAt=class extends K{constructor(){super({id:"workbench.action.focusActiveEditorGroup",title:L(3804,"Focus Active Editor Group"),f1:!0,category:We.View})}async run(i){i.get(Et).activeGroup.focus()}},fK=class extends K{constructor(e,t){super(e);this.scope=t}async run(e){let t=e.get(Et);t.findGroup(this.scope,t.activeGroup,!0)?.focus()}},uAt=class extends fK{constructor(){super({id:"workbench.action.focusFirstEditorGroup",title:L(3806,"Focus First Editor Group"),f1:!0,keybinding:{weight:200,primary:2070},category:We.View},{location:0})}},pAt=class extends fK{constructor(){super({id:"workbench.action.focusLastEditorGroup",title:L(3807,"Focus Last Editor Group"),f1:!0,category:We.View},{location:1})}},mAt=class extends fK{constructor(){super({id:"workbench.action.focusNextGroup",title:L(3809,"Focus Next Editor Group"),f1:!0,category:We.View},{location:2})}},hAt=class extends fK{constructor(){super({id:"workbench.action.focusPreviousGroup",title:L(3810,"Focus Previous Editor Group"),f1:!0,category:We.View},{location:3})}},gAt=class extends fK{constructor(){super({id:"workbench.action.focusLeftGroup",title:L(3808,"Focus Left Editor Group"),f1:!0,keybinding:{weight:200,primary:Ai(2089,2063)},category:We.View},{direction:2})}},fAt=class extends fK{constructor(){super({id:"workbench.action.focusRightGroup",title:L(3811,"Focus Right Editor Group"),f1:!0,keybinding:{weight:200,primary:Ai(2089,2065)},category:We.View},{direction:3})}},vAt=class extends fK{constructor(){super({id:"workbench.action.focusAboveGroup",title:L(3803,"Focus Editor Group Above"),f1:!0,keybinding:{weight:200,primary:Ai(2089,2064)},category:We.View},{direction:0})}},bAt=class extends fK{constructor(){super({id:"workbench.action.focusBelowGroup",title:L(3805,"Focus Editor Group Below"),f1:!0,keybinding:{weight:200,primary:Ai(2089,2066)},category:We.View},{direction:1})}},SJ=class extends st{constructor(e,t,o){super(e,t,q.asClassName(M.close));this.commandService=o}static{this.ID="workbench.action.closeActiveEditor"}static{this.LABEL=d(3779,null)}run(e){return this.commandService.executeCommand(OC,void 0,e)}};SJ=I([m(2,ge)],SJ);var gF=class extends st{constructor(e,t,o){super(e,t,q.asClassName(M.pinned));this.commandService=o}static{this.ID="workbench.action.unpinActiveEditor"}static{this.LABEL=d(3905,null)}run(e){return this.commandService.executeCommand(U5,void 0,e)}};gF=I([m(2,ge)],gF);var IJ=class extends st{constructor(e,t,o){super(e,t,q.asClassName(M.close));this.editorGroupService=o}static{this.ID="workbench.action.closeActiveEditor"}static{this.LABEL=d(3783,null)}async run(e){let t=e?this.editorGroupService.getGroup(e.groupId):this.editorGroupService.activeGroup;if(!t)return;let o=e?.editorIndex!==void 0?t.getEditorByIndex(e.editorIndex):t.activeEditor;if(!o)return;let n=[];t.isSelected(o)?n.push(...t.selectedEditors):n.push(o);for(let r of n)await t.closeEditor(r,{preserveFocus:e?.preserveFocus})}};IJ=I([m(2,Et)],IJ);var SAt=class extends K{constructor(){super({id:"workbench.action.revertAndCloseActiveEditor",title:L(3879,"Revert and Close Editor"),f1:!0,category:We.View})}async run(i){let e=i.get(ee),t=i.get(ne),o=e.activeEditorPane;if(o){let n=o.input,r=o.group;try{await e.revert({editor:n,groupId:r.id})}catch(s){t.error(s),await e.revert({editor:n,groupId:r.id},{soft:!0})}await r.closeEditor(n)}}},IAt=class extends K{constructor(){super({id:"workbench.action.closeEditorsToTheLeft",title:L(3782,"Close Editors to the Left in Group"),f1:!0,category:We.View})}async run(i,e){let t=i.get(Et),{group:o,editor:n}=this.getTarget(t,e);o&&n&&await o.closeEditors({direction:0,except:n,excludeSticky:!0})}getTarget(i,e){return e?{editor:e.editor,group:i.getGroup(e.groupId)}:{group:i.activeGroup,editor:i.activeGroup.activeEditor}}},yAt=class extends K{groupsToClose(i){let e=[],t=i.getGroups(2);for(let o=t.length-1;o>=0;o--)e.push(t[o]);return e}async run(i){let e=i.get(ee),t=i.get(ne),o=i.get(Bo),n=i.get(Et),r=i.get(lr),s=i.get(dn),l=new Set,c=new Set,u=new Set,p=new Map;for(let{editor:h,groupId:g}of e.getEditors(1,{excludeSticky:this.excludeSticky})){let f=!1,v=!1;if(h.closeHandler)try{f=h.closeHandler.showConfirm()}catch(b){t.error(b),v=!0}if((!h.closeHandler||v)&&(f=h.isDirty()&&!h.isSaving()),!!f)if(typeof h.closeHandler?.confirm=="function"){let b=p.get(h.typeId);b||(b=new Set,p.set(h.typeId,b)),b.add({editor:h,groupId:g})}else!h.hasCapability(4)&&r.getAutoSaveMode(h).mode===3?c.add({editor:h,groupId:g}):kr&&(ri||Wn)&&!h.hasCapability(4)&&r.getAutoSaveMode(h).mode===4?u.add({editor:h,groupId:g}):l.add({editor:h,groupId:g})}if(l.size>0){let h=Array.from(l.values());switch(await this.revealEditorsToConfirm(h,n),await s.showSaveConfirm(h.map(({editor:f})=>f instanceof ga?f.primary.getName():f.getName()))){case 2:return;case 1:await this.revertEditors(e,t,o,h);break;case 0:await e.save(h,{reason:1});break}}for(let[,h]of p){let g=Array.from(h.values());await this.revealEditorsToConfirm(g,n);let f=await g.at(0)?.editor.closeHandler?.confirm?.(g);if(typeof f=="number")switch(f){case 2:return;case 1:await this.revertEditors(e,t,o,g);break;case 0:await e.save(g,{reason:1});break}}if(c.size>0){let h=Array.from(c.values());await e.save(h,{reason:3})}if(u.size>0){let h=Array.from(u.values());await e.save(h,{reason:4})}return this.doCloseAll(n)}revertEditors(i,e,t,o){return t.withProgress({location:10,delay:800,title:d(3880,null)},()=>this.doRevertEditors(i,e,o))}async doRevertEditors(i,e,t){try{await i.revert(t)}catch(o){e.error(o),await i.revert(t,{soft:!0})}}async revealEditorsToConfirm(i,e){try{let t=new Set;for(let{editor:o,groupId:n}of i){if(t.has(n))continue;t.add(n),await e.getGroup(n)?.openEditor(o)}}catch{}}async doCloseAll(i){await Promise.all(this.groupsToClose(i).map(e=>e.closeAllEditors({excludeSticky:this.excludeSticky})))}},vue=class a extends yAt{static{this.ID="workbench.action.closeAllEditors"}static{this.LABEL=L(3777,"Close All Editors")}constructor(){super({id:a.ID,title:a.LABEL,f1:!0,keybinding:{weight:200,primary:Ai(2089,2101)},icon:M.closeAll,category:We.View})}get excludeSticky(){return!0}},wAt=class extends yAt{constructor(){super({id:"workbench.action.closeAllGroups",title:L(3778,"Close All Editor Groups"),f1:!0,keybinding:{weight:200,primary:Ai(2089,3125)},category:We.View})}get excludeSticky(){return!1}async doCloseAll(i){await super.doCloseAll(i);for(let e of this.groupsToClose(i))i.removeGroup(e)}},CAt=class extends K{constructor(){super({id:"workbench.action.closeEditorsInOtherGroups",title:L(3781,"Close Editors in Other Groups"),f1:!0,category:We.View})}async run(i,e){let t=i.get(Et),o=e?t.getGroup(e.groupId):t.activeGroup;await Promise.all(t.getGroups(1).map(async n=>{if(!(o&&n.id===o.id))return n.closeAllEditors({excludeSticky:!0})}))}},xAt=class extends K{constructor(){super({id:"workbench.action.closeEditorInAllGroups",title:L(3780,"Close Editor in All Groups"),f1:!0,category:We.View})}async run(i){let e=i.get(ee),t=i.get(Et),o=e.activeEditor;o&&await Promise.all(t.getGroups(1).map(n=>n.closeEditor(o)))}},kAt=class extends K{constructor(e,t,o){super(e);this.direction=t;this.isMove=o}async run(e,t){let o=e.get(Et),n;if(t&&typeof t.groupId=="number"?n=o.getGroup(t.groupId):n=o.activeGroup,n){let r;if(this.isMove){let s=this.findTargetGroup(o,n);s&&(r=o.moveGroup(n,s,this.direction))}else r=o.copyGroup(n,n,this.direction);r&&o.activateGroup(r)}}findTargetGroup(e,t){let o=[this.direction];switch(this.direction){case 2:case 3:o.push(0,1);break;case 0:case 1:o.push(2,3);break}for(let n of o){let r=e.findGroup({direction:n},t);if(r)return r}}},P_e=class extends kAt{constructor(i,e){super(i,e,!0)}},EAt=class extends P_e{constructor(){super({id:"workbench.action.moveActiveEditorGroupLeft",title:L(3827,"Move Editor Group Left"),f1:!0,keybinding:{weight:200,primary:Ai(2089,15)},category:We.View},2)}},TAt=class extends P_e{constructor(){super({id:"workbench.action.moveActiveEditorGroupRight",title:L(3828,"Move Editor Group Right"),f1:!0,keybinding:{weight:200,primary:Ai(2089,17)},category:We.View},3)}},_At=class extends P_e{constructor(){super({id:"workbench.action.moveActiveEditorGroupUp",title:L(3829,"Move Editor Group Up"),f1:!0,keybinding:{weight:200,primary:Ai(2089,16)},category:We.View},0)}},DAt=class extends P_e{constructor(){super({id:"workbench.action.moveActiveEditorGroupDown",title:L(3826,"Move Editor Group Down"),f1:!0,keybinding:{weight:200,primary:Ai(2089,18)},category:We.View},1)}},A_e=class extends kAt{constructor(i,e){super(i,e,!1)}},LAt=class extends A_e{constructor(){super({id:"workbench.action.duplicateActiveEditorGroupLeft",title:L(3790,"Duplicate Editor Group Left"),f1:!0,category:We.View},2)}},RAt=class extends A_e{constructor(){super({id:"workbench.action.duplicateActiveEditorGroupRight",title:L(3791,"Duplicate Editor Group Right"),f1:!0,category:We.View},3)}},MAt=class extends A_e{constructor(){super({id:"workbench.action.duplicateActiveEditorGroupUp",title:L(3792,"Duplicate Editor Group Up"),f1:!0,category:We.View},0)}},PAt=class extends A_e{constructor(){super({id:"workbench.action.duplicateActiveEditorGroupDown",title:L(3789,"Duplicate Editor Group Down"),f1:!0,category:We.View},1)}},AAt=class extends K{constructor(){super({id:"workbench.action.minimizeOtherEditors",title:L(3823,"Expand Editor Group"),f1:!0,category:We.View,precondition:iS})}async run(i){i.get(Et).arrangeGroups(1)}},NAt=class extends K{constructor(){super({id:"workbench.action.minimizeOtherEditorsHideSidebar",title:L(3824,"Expand Editor Group and Hide Side Bars"),f1:!0,category:We.View,precondition:x.or(iS,cP,D_)})}async run(i){let e=i.get(Et),t=i.get(fi);t.setPartHidden(!0,"workbench.parts.sidebar"),t.setPartHidden(!0,"workbench.parts.auxiliarybar"),e.arrangeGroups(1)}},OAt=class extends K{constructor(){super({id:"workbench.action.evenEditorWidths",title:L(3801,"Reset Editor Group Sizes"),f1:!0,category:We.View})}async run(i){i.get(Et).arrangeGroups(2)}},FAt=class extends K{constructor(){super({id:"workbench.action.toggleEditorWidths",title:L(3902,"Toggle Editor Group Sizes"),f1:!0,category:We.View})}async run(i){i.get(Et).toggleExpandGroup()}},WAt=class extends K{constructor(){super({id:"workbench.action.maximizeEditorHideSidebar",title:L(3815,"Maximize Editor Group and Hide Side Bars"),f1:!0,category:We.View,precondition:x.or(x.and(nV.negate(),Fj),cP,D_)})}async run(i){let e=i.get(fi),t=i.get(Et);i.get(ee).activeEditor&&(e.setPartHidden(!0,"workbench.parts.sidebar"),e.setPartHidden(!0,"workbench.parts.auxiliarybar"),t.arrangeGroups(0))}},VAt=class extends K{constructor(){super({id:y_e,title:L(3903,"Toggle Maximize Editor Group"),f1:!0,category:We.View,precondition:x.or(Fj,nV),keybinding:{weight:200,primary:Ai(2089,2091)},menu:[{id:D.EditorTitle,order:-1e4,group:"navigation",when:nV},{id:D.EmptyEditorGroup,order:-1e4,group:"navigation",when:nV}],icon:M.screenFull,toggled:{condition:nV,title:d(3904,null)}})}async run(i,...e){let t=i.get(Et),o=i.get(ee),n=i.get(fo),r=lp(e,o,t,n);r.groupedEditors.length&&t.toggleMaximizeGroup(r.groupedEditors[0].group)}},yJ=class extends K{async run(i){let e=i.get(Et),t=this.navigate(e);if(!t)return;let{groupId:o,editor:n}=t;if(!n)return;let r=e.getGroup(o);r&&await r.openEditor(n)}},BAt=class extends yJ{constructor(){super({id:"workbench.action.nextEditor",title:L(3865,"Open Next Editor"),f1:!0,keybinding:{weight:200,primary:2060,mac:{primary:2577,secondary:[3166]}},category:We.View})}navigate(i){let e=i.activeGroup,t=e.getEditors(1),o=e.activeEditor?t.indexOf(e.activeEditor):-1;if(o+1<t.length)return{editor:t[o+1],groupId:e.id};let n=new Set,r=i.activeGroup;for(;r&&!n.has(r.id);)if(r=i.findGroup({location:2},r,!0),r){n.add(r.id);let s=r.getEditors(1);if(s.length>0)return{editor:s[0],groupId:r.id}}}},HAt=class extends yJ{constructor(){super({id:"workbench.action.previousEditor",title:L(3868,"Open Previous Editor"),f1:!0,keybinding:{weight:200,primary:2059,mac:{primary:2575,secondary:[3164]}},category:We.View})}navigate(i){let e=i.activeGroup,t=e.getEditors(1),o=e.activeEditor?t.indexOf(e.activeEditor):-1;if(o>0)return{editor:t[o-1],groupId:e.id};let n=new Set,r=i.activeGroup;for(;r&&!n.has(r.id);)if(r=i.findGroup({location:3},r,!0),r){n.add(r.id);let s=r.getEditors(1);if(s.length>0)return{editor:s[s.length-1],groupId:r.id}}}},UAt=class extends yJ{constructor(){super({id:"workbench.action.nextEditorInGroup",title:L(3864,"Open Next Editor in Group"),f1:!0,keybinding:{weight:200,primary:Ai(2089,2060),mac:{primary:Ai(2089,2577)}},category:We.View})}navigate(i){let e=i.activeGroup,t=e.getEditors(1),o=e.activeEditor?t.indexOf(e.activeEditor):-1;return{editor:o+1<t.length?t[o+1]:t[0],groupId:e.id}}},zAt=class extends yJ{constructor(){super({id:"workbench.action.previousEditorInGroup",title:L(3869,"Open Previous Editor in Group"),f1:!0,keybinding:{weight:200,primary:Ai(2089,2059),mac:{primary:Ai(2089,2575)}},category:We.View})}navigate(i){let e=i.activeGroup,t=e.getEditors(1),o=e.activeEditor?t.indexOf(e.activeEditor):-1;return{editor:o>0?t[o-1]:t[t.length-1],groupId:e.id}}},KAt=class extends yJ{constructor(){super({id:"workbench.action.firstEditorInGroup",title:L(3802,"Open First Editor in Group"),f1:!0,category:We.View})}navigate(i){let e=i.activeGroup;return{editor:e.getEditors(1)[0],groupId:e.id}}},GAt=class extends yJ{constructor(){super({id:"workbench.action.lastEditorInGroup",title:L(3814,"Open Last Editor in Group"),f1:!0,keybinding:{weight:200,primary:533,secondary:[2078],mac:{primary:277,secondary:[2078]}},category:We.View})}navigate(i){let e=i.activeGroup,t=e.getEditors(1);return{editor:t[t.length-1],groupId:e.id}}},N_e=class a extends K{static{this.ID="workbench.action.navigateForward"}static{this.LABEL=d(3850,null)}constructor(){super({id:a.ID,title:{...L(3851,"Go Forward"),mnemonicTitle:d(3819,null)},f1:!0,icon:M.arrowRight,precondition:x.has("canNavigateForward"),keybinding:{weight:200,win:{primary:529,secondary:[123]},mac:{primary:1368,secondary:[123]},linux:{primary:3160,secondary:[123]}},menu:[{id:D.MenubarGoMenu,group:"1_history_nav",order:2},{id:D.CommandCenter,order:2,when:x.has("config.workbench.navigationControl.enabled")}]})}async run(i){await i.get(zs).goForward(0)}},O_e=class a extends K{static{this.ID="workbench.action.navigateBack"}static{this.LABEL=d(3844,null)}constructor(){super({id:a.ID,title:{...L(3845,"Go Back"),mnemonicTitle:d(3816,null)},f1:!0,precondition:x.has("canNavigateBack"),icon:M.arrowLeft,keybinding:{weight:200,win:{primary:527,secondary:[122]},mac:{primary:344,secondary:[122]},linux:{primary:2648,secondary:[122]}},menu:[{id:D.MenubarGoMenu,group:"1_history_nav",order:1},{id:D.CommandCenter,order:1,when:x.has("config.workbench.navigationControl.enabled")}]})}async run(i){await i.get(zs).goBack(0)}},$At=class extends K{constructor(){super({id:"workbench.action.navigateLast",title:L(3854,"Go Previous"),f1:!0})}async run(i){await i.get(zs).goPrevious(0)}},qAt=class extends K{constructor(){super({id:"workbench.action.navigateForwardInEditLocations",title:L(3852,"Go Forward in Edit Locations"),f1:!0})}async run(i){await i.get(zs).goForward(1)}},jAt=class extends K{constructor(){super({id:"workbench.action.navigateBackInEditLocations",title:L(3846,"Go Back in Edit Locations"),f1:!0})}async run(i){await i.get(zs).goBack(1)}},QAt=class extends K{constructor(){super({id:"workbench.action.navigatePreviousInEditLocations",title:L(3855,"Go Previous in Edit Locations"),f1:!0})}async run(i){await i.get(zs).goPrevious(1)}},YAt=class extends K{constructor(){super({id:"workbench.action.navigateToLastEditLocation",title:L(3857,"Go to Last Edit Location"),f1:!0,keybinding:{weight:200,primary:Ai(2089,2095)}})}async run(i){await i.get(zs).goLast(1)}},XAt=class extends K{constructor(){super({id:"workbench.action.navigateForwardInNavigationLocations",title:L(3853,"Go Forward in Navigation Locations"),f1:!0})}async run(i){await i.get(zs).goForward(2)}},JAt=class extends K{constructor(){super({id:"workbench.action.navigateBackInNavigationLocations",title:L(3847,"Go Back in Navigation Locations"),f1:!0})}async run(i){await i.get(zs).goBack(2)}},ZAt=class extends K{constructor(){super({id:"workbench.action.navigatePreviousInNavigationLocations",title:L(3856,"Go Previous in Navigation Locations"),f1:!0})}async run(i){await i.get(zs).goPrevious(2)}},eNt=class extends K{constructor(){super({id:"workbench.action.navigateToLastNavigationLocation",title:L(3858,"Go to Last Navigation Location"),f1:!0})}async run(i){await i.get(zs).goLast(2)}},W7e=class a extends K{static{this.ID="workbench.action.reopenClosedEditor"}constructor(){super({id:a.ID,title:L(3876,"Reopen Closed Editor"),f1:!0,keybinding:{weight:200,primary:3122},category:We.View})}async run(i){await i.get(zs).reopenLastClosedEditor()}},V7e=class a extends K{static{this.ID="workbench.action.clearRecentFiles"}constructor(){super({id:a.ID,title:L(3776,"Clear Recently Opened..."),f1:!0,category:We.File})}async run(i){let e=i.get(ct),t=i.get(Ff),o=i.get(zs),{confirmed:n}=await e.confirm({type:"warning",message:d(3786,null),detail:d(3784,null),primaryButton:d(3773,null)});n&&(t.clearRecentlyOpened(),o.clearRecentlyOpened())}},B7e=class a extends K{static{this.ID="workbench.action.showEditorsInActiveGroup"}constructor(){super({id:a.ID,title:L(3883,"Show Editors in Active Group By Most Recently Used"),f1:!0,category:We.View})}async run(i){i.get(Ge).quickAccess.show(J_.PREFIX)}},H7e=class a extends K{static{this.ID="workbench.action.showAllEditors"}constructor(){super({id:a.ID,title:L(3881,"Show All Editors By Appearance"),f1:!0,keybinding:{weight:200,primary:Ai(2089,2094),mac:{primary:2562}},category:We.File})}async run(i){i.get(Ge).quickAccess.show(BV.PREFIX)}},U7e=class a extends K{static{this.ID="workbench.action.showAllEditorsByMostRecentlyUsed"}constructor(){super({id:a.ID,title:L(3882,"Show All Editors By Most Recently Used"),f1:!0,category:We.View})}async run(i){i.get(Ge).quickAccess.show(UP.PREFIX)}},F_e=class extends K{constructor(e,t,o){super(e);this.prefix=t;this.itemActivation=o}async run(e){let t=e.get(_e),o=e.get(Ge),n=t.lookupKeybindings(this.desc.id);o.quickAccess.show(this.prefix,{quickNavigateConfiguration:{keybindings:n},itemActivation:this.itemActivation})}},tNt=class extends F_e{constructor(){super({id:"workbench.action.quickOpenPreviousRecentlyUsedEditor",title:L(3874,"Quick Open Previous Recently Used Editor"),f1:!0,category:We.View},UP.PREFIX,void 0)}},iNt=class extends F_e{constructor(){super({id:"workbench.action.quickOpenLeastRecentlyUsedEditor",title:L(3872,"Quick Open Least Recently Used Editor"),f1:!0,category:We.View},UP.PREFIX,void 0)}},oNt=class extends F_e{constructor(){super({id:"workbench.action.quickOpenPreviousRecentlyUsedEditorInGroup",title:L(3875,"Quick Open Previous Recently Used Editor in Group"),f1:!0,keybinding:{weight:200,primary:2050,mac:{primary:258}},precondition:Ice.toNegated(),category:We.View},J_.PREFIX,void 0)}},nNt=class extends F_e{constructor(){super({id:"workbench.action.quickOpenLeastRecentlyUsedEditorInGroup",title:L(3873,"Quick Open Least Recently Used Editor in Group"),f1:!0,keybinding:{weight:200,primary:3074,mac:{primary:1282}},precondition:Ice.toNegated(),category:We.View},J_.PREFIX,3)}},rNt=class a extends K{static{this.ID="workbench.action.openPreviousEditorFromHistory"}constructor(){super({id:a.ID,title:L(3849,"Quick Open Previous Editor from History"),f1:!0})}async run(i){let e=i.get(_e),t=i.get(Ge),o=i.get(Et),n=e.lookupKeybindings(a.ID),r;o.activeGroup.count===0&&(r=1),t.quickAccess.show("",{quickNavigateConfiguration:{keybindings:n},itemActivation:r})}},sNt=class extends K{constructor(){super({id:"workbench.action.openNextRecentlyUsedEditor",title:L(3866,"Open Next Recently Used Editor"),f1:!0,category:We.View})}async run(i){i.get(zs).openNextRecentlyUsedEditor()}},aNt=class extends K{constructor(){super({id:"workbench.action.openPreviousRecentlyUsedEditor",title:L(3870,"Open Previous Recently Used Editor"),f1:!0,category:We.View})}async run(i){i.get(zs).openPreviouslyUsedEditor()}},lNt=class extends K{constructor(){super({id:"workbench.action.openNextRecentlyUsedEditorInGroup",title:L(3867,"Open Next Recently Used Editor In Group"),f1:!0,category:We.View})}async run(i){let e=i.get(zs),t=i.get(Et);e.openNextRecentlyUsedEditor(t.activeGroup.id)}},cNt=class extends K{constructor(){super({id:"workbench.action.openPreviousRecentlyUsedEditorInGroup",title:L(3871,"Open Previous Recently Used Editor In Group"),f1:!0,category:We.View})}async run(i){let e=i.get(zs),t=i.get(Et);e.openPreviouslyUsedEditor(t.activeGroup.id)}},dNt=class extends K{constructor(){super({id:"workbench.action.clearEditorHistoryWithoutConfirm",title:L(3775,"Clear Editor History without Confirmation"),f1:!0,precondition:jEt})}async run(i){i.get(zs).clear()}},uNt=class extends K{constructor(){super({id:"workbench.action.clearEditorHistory",title:L(3774,"Clear Editor History"),f1:!0})}async run(i){let e=i.get(ct),t=i.get(zs),{confirmed:o}=await e.confirm({type:"warning",message:d(3785,null),detail:d(3784,null),primaryButton:d(3773,null)});o&&t.clear()}},pNt=class extends cp{constructor(){super({id:"workbench.action.moveEditorLeftInGroup",title:L(3831,"Move Editor Left"),keybinding:{weight:200,primary:3083,mac:{primary:Ai(2089,3087)}},f1:!0,category:We.View},aK,{to:"left"})}},mNt=class extends cp{constructor(){super({id:"workbench.action.moveEditorRightInGroup",title:L(3832,"Move Editor Right"),keybinding:{weight:200,primary:3084,mac:{primary:Ai(2089,3089)}},f1:!0,category:We.View},aK,{to:"right"})}},hNt=class extends cp{constructor(){super({id:"workbench.action.moveEditorToStart",title:L(3843,"Move Editor to Start"),f1:!0,category:We.View},aK,{to:"first"})}},gNt=class extends cp{constructor(){super({id:"workbench.action.moveEditorToEnd",title:L(3835,"Move Editor to End"),f1:!0,category:We.View},aK,{to:"last"})}},fNt=class extends cp{constructor(){super({id:"workbench.action.moveEditorToPreviousGroup",title:L(3841,"Move Editor into Previous Group"),keybinding:{weight:200,primary:2575,mac:{primary:2319}},f1:!0,category:We.View},aK,{to:"previous",by:"group"})}},vNt=class extends cp{constructor(){super({id:"workbench.action.moveEditorToNextGroup",title:L(3840,"Move Editor into Next Group"),f1:!0,keybinding:{weight:200,primary:2577,mac:{primary:2321}},category:We.View},aK,{to:"next",by:"group"})}},bNt=class extends cp{constructor(){super({id:v_e,title:L(3833,"Move Editor into Group Above"),f1:!0,category:We.View},v_e)}},SNt=class extends cp{constructor(){super({id:b_e,title:L(3834,"Move Editor into Group Below"),f1:!0,category:We.View},b_e)}},INt=class extends cp{constructor(){super({id:S_e,title:L(3838,"Move Editor into Left Group"),f1:!0,category:We.View},S_e)}},yNt=class extends cp{constructor(){super({id:I_e,title:L(3842,"Move Editor into Right Group"),f1:!0,category:We.View},I_e)}},wNt=class extends cp{constructor(){super({id:"workbench.action.moveEditorToFirstGroup",title:L(3836,"Move Editor into First Group"),f1:!0,keybinding:{weight:200,primary:1558,mac:{primary:2326}},category:We.View},aK,{to:"first",by:"group"})}},CNt=class extends cp{constructor(){super({id:"workbench.action.moveEditorToLastGroup",title:L(3837,"Move Editor into Last Group"),f1:!0,keybinding:{weight:200,primary:1566,mac:{primary:2334}},category:We.View},aK,{to:"last",by:"group"})}},xNt=class extends cp{constructor(){super({id:"workbench.action.splitEditorToPreviousGroup",title:L(3899,"Split Editor into Previous Group"),f1:!0,category:We.View},lK,{to:"previous",by:"group"})}},kNt=class extends cp{constructor(){super({id:"workbench.action.splitEditorToNextGroup",title:L(3898,"Split Editor into Next Group"),f1:!0,category:We.View},lK,{to:"next",by:"group"})}},ENt=class extends cp{constructor(){super({id:"workbench.action.splitEditorToAboveGroup",title:L(3892,"Split Editor into Group Above"),f1:!0,category:We.View},lK,{to:"up",by:"group"})}},TNt=class extends cp{constructor(){super({id:"workbench.action.splitEditorToBelowGroup",title:L(3893,"Split Editor into Group Below"),f1:!0,category:We.View},lK,{to:"down",by:"group"})}},_Nt=class extends cp{static{this.ID="workbench.action.splitEditorToLeftGroup"}static{this.LABEL=d(3896,null)}constructor(){super({id:"workbench.action.splitEditorToLeftGroup",title:L(3897,"Split Editor into Left Group"),f1:!0,category:We.View},lK,{to:"left",by:"group"})}},DNt=class extends cp{constructor(){super({id:"workbench.action.splitEditorToRightGroup",title:L(3900,"Split Editor into Right Group"),f1:!0,category:We.View},lK,{to:"right",by:"group"})}},LNt=class extends cp{constructor(){super({id:"workbench.action.splitEditorToFirstGroup",title:L(3894,"Split Editor into First Group"),f1:!0,category:We.View},lK,{to:"first",by:"group"})}},RNt=class extends cp{constructor(){super({id:"workbench.action.splitEditorToLastGroup",title:L(3895,"Split Editor into Last Group"),f1:!0,category:We.View},lK,{to:"last",by:"group"})}},z7e=class a extends cp{static{this.ID="workbench.action.editorLayoutSingle"}constructor(){super({id:a.ID,title:L(3793,"Single Column Editor Layout"),f1:!0,category:We.View},cK,{groups:[{}],orientation:0})}},K7e=class a extends cp{static{this.ID="workbench.action.editorLayoutTwoColumns"}constructor(){super({id:a.ID,title:L(3797,"Two Columns Editor Layout"),f1:!0,category:We.View},cK,{groups:[{},{}],orientation:0})}},G7e=class a extends cp{static{this.ID="workbench.action.editorLayoutThreeColumns"}constructor(){super({id:a.ID,title:L(3794,"Three Columns Editor Layout"),f1:!0,category:We.View},cK,{groups:[{},{},{}],orientation:0})}},$7e=class a extends cp{static{this.ID="workbench.action.editorLayoutTwoRows"}constructor(){super({id:a.ID,title:L(3799,"Two Rows Editor Layout"),f1:!0,category:We.View},cK,{groups:[{},{}],orientation:1})}},q7e=class a extends cp{static{this.ID="workbench.action.editorLayoutThreeRows"}constructor(){super({id:a.ID,title:L(3795,"Three Rows Editor Layout"),f1:!0,category:We.View},cK,{groups:[{},{},{}],orientation:1})}},j7e=class a extends cp{static{this.ID="workbench.action.editorLayoutTwoByTwoGrid"}constructor(){super({id:a.ID,title:L(3796,"Grid Editor Layout (2x2)"),f1:!0,category:We.View},cK,{groups:[{groups:[{},{}]},{groups:[{},{}]}],orientation:0})}},Q7e=class a extends cp{static{this.ID="workbench.action.editorLayoutTwoColumnsBottom"}constructor(){super({id:a.ID,title:L(3798,"Two Columns Bottom Editor Layout"),f1:!0,category:We.View},cK,{groups:[{},{groups:[{},{}]}],orientation:1})}},Y7e=class a extends cp{static{this.ID="workbench.action.editorLayoutTwoRowsRight"}constructor(){super({id:a.ID,title:L(3800,"Two Rows Right Editor Layout"),f1:!0,category:We.View},cK,{groups:[{},{groups:[{},{}]}],orientation:0})}},W_e=class extends K{constructor(e,t){super(e);this.direction=t}async run(e){let t=e.get(Et),o=e.get(fi),n=rh(),r=o.hasFocus("workbench.parts.editor")||n.activeElement===n.body,s=t.addGroup(t.activeGroup,this.direction);t.activateGroup(s),r&&s.focus()}},MNt=class extends W_e{constructor(){super({id:"workbench.action.newGroupLeft",title:L(3862,"New Editor Group to the Left"),f1:!0,category:We.View},2)}},PNt=class extends W_e{constructor(){super({id:"workbench.action.newGroupRight",title:L(3863,"New Editor Group to the Right"),f1:!0,category:We.View},3)}},ANt=class extends W_e{constructor(){super({id:"workbench.action.newGroupAbove",title:L(3860,"New Editor Group Above"),f1:!0,category:We.View},0)}},NNt=class extends W_e{constructor(){super({id:"workbench.action.newGroupBelow",title:L(3861,"New Editor Group Below"),f1:!0,category:We.View},1)}},ONt=class extends K{constructor(){super({id:"workbench.action.toggleEditorType",title:L(3901,"Toggle Editor Type"),f1:!0,category:We.View,precondition:AO})}async run(i){let e=i.get(ee),t=i.get(ul),o=e.activeEditorPane;if(!o)return;let n=no.getCanonicalUri(o.input);if(!n)return;let r=t.getEditors(n).map(s=>s.id).filter(s=>s!==o.input.editorId);r.length!==0&&await e.replaceEditors([{editor:o.input,replacement:{resource:n,options:{override:r[0]}}}],o.group)}},FNt=class extends K{constructor(){super({id:"workbench.action.reopenTextEditor",title:L(3877,"Reopen Editor with Text Editor"),f1:!0,category:We.View,precondition:AO})}async run(i){let e=i.get(ee),t=e.activeEditorPane;if(!t)return;let o=no.getCanonicalUri(t.input);o&&await e.replaceEditors([{editor:t.input,replacement:{resource:o,options:{override:Ys.id}}}],t.group)}},WNt=class extends K{constructor(e,t,o,n){super({id:e,title:t,category:We.View,precondition:fr,keybinding:o,f1:!0});this.move=n}async run(e,...t){let o=e.get(Et),n=e.get(ee),r=e.get(fo),s=lp(t,n,o,r);if(!s.groupedEditors.length)return;let l=await o.createAuxiliaryEditorPart(),{group:c,editors:u}=s.groupedEditors[0],p=ZY(c,u,s.preserveFocus);this.move?c.moveEditors(p,l.activeGroup):c.copyEditors(p,l.activeGroup),l.activeGroup.focus()}},VNt=class extends WNt{constructor(){super(v7e,{...L(3839,"Move Editor into New Window"),mnemonicTitle:d(3821,null)},void 0,!0)}},BNt=class extends WNt{constructor(){super(b7e,{...L(3788,"Copy Editor into New Window"),mnemonicTitle:d(3818,null)},{primary:Ai(2089,45),weight:200},!1)}},HNt=class extends K{constructor(e,t,o){super({id:e,title:t,category:We.View,f1:!0});this.move=o}async run(e){let t=e.get(Et),o=t.activeGroup,n=await t.createAuxiliaryEditorPart();t.mergeGroup(o,n.activeGroup,{mode:this.move?1:0}),n.activeGroup.focus()}},UNt=class extends HNt{constructor(){super(APt,{...L(3830,"Move Editor Group into New Window"),mnemonicTitle:d(3820,null)},!0)}},zNt=class extends HNt{constructor(){super(NPt,{...L(3787,"Copy Editor Group into New Window"),mnemonicTitle:d(3817,null)},!1)}},KNt=class extends K{constructor(){super({id:"workbench.action.restoreEditorsToMainWindow",title:{...L(3878,"Restore Editors into Main Window"),mnemonicTitle:d(3825,null)},f1:!0,precondition:sw,category:We.View})}async run(i){let e=i.get(Et);e.mergeAllGroups(e.mainPart.activeGroup)}},GNt=class extends K{constructor(){super({id:OPt,title:{...L(3859,"New Empty Editor Window"),mnemonicTitle:d(3822,null)},f1:!0,category:We.View})}async run(i){(await i.get(Et).createAuxiliaryEditorPart()).activeGroup.focus()}};var bue=class extends C{constructor(e,t,o,n,r,s,l,c){super();this.filesConfigurationService=e;this.hostService=t;this.editorService=o;this.editorGroupService=n;this.workingCopyService=r;this.logService=s;this.markerService=l;this.uriIdentityService=c;this.scheduledAutoSavesAfterDelay=new Map;this.lastActiveEditor=void 0;this.lastActiveGroupId=void 0;this.lastActiveEditorControlDisposable=this._register(new P);this.waitingOnConditionAutoSaveWorkingCopies=new vt(e=>this.uriIdentityService.extUri.getComparisonKey(e));this.waitingOnConditionAutoSaveEditors=new vt(e=>this.uriIdentityService.extUri.getComparisonKey(e));for(let u of this.workingCopyService.dirtyWorkingCopies)this.onDidRegister(u);this.registerListeners()}static{this.ID="workbench.contrib.editorAutoSave"}registerListeners(){this._register(this.hostService.onDidChangeFocus(e=>this.onWindowFocusChange(e))),this._register(this.hostService.onDidChangeActiveWindow(()=>this.onActiveWindowChange())),this._register(this.editorService.onDidActiveEditorChange(()=>this.onDidActiveEditorChange())),this._register(this.filesConfigurationService.onDidChangeAutoSaveConfiguration(()=>this.onDidChangeAutoSaveConfiguration())),this._register(this.workingCopyService.onDidRegister(e=>this.onDidRegister(e))),this._register(this.workingCopyService.onDidUnregister(e=>this.onDidUnregister(e))),this._register(this.workingCopyService.onDidChangeDirty(e=>this.onDidChangeDirty(e))),this._register(this.workingCopyService.onDidChangeContent(e=>this.onDidChangeContent(e))),this._register(this.markerService.onMarkerChanged(e=>this.onConditionChanged(e,3))),this._register(this.filesConfigurationService.onDidChangeAutoSaveDisabled(e=>this.onConditionChanged([e],4)))}onConditionChanged(e,t){for(let o of e){let n=this.waitingOnConditionAutoSaveWorkingCopies.get(o);if(n?.condition===t)n.workingCopy.isDirty()&&this.filesConfigurationService.getAutoSaveMode(n.workingCopy.resource,n.reason).mode!==0&&(this.discardAutoSave(n.workingCopy),this.logService.trace("[editor auto save] running auto save from condition change event",n.workingCopy.resource.toString(),n.workingCopy.typeId),n.workingCopy.save({reason:n.reason}));else{let r=this.waitingOnConditionAutoSaveEditors.get(o);r?.condition===t&&!r.editor.editor.isDisposed()&&r.editor.editor.isDirty()&&this.filesConfigurationService.getAutoSaveMode(r.editor.editor,r.reason).mode!==0&&(this.waitingOnConditionAutoSaveEditors.delete(o),this.logService.trace(`[editor auto save] running auto save from condition change event with reason ${r.reason}`),this.editorService.save(r.editor,{reason:r.reason}))}}}onWindowFocusChange(e){e||this.maybeTriggerAutoSave(4)}onActiveWindowChange(){this.maybeTriggerAutoSave(4)}onDidActiveEditorChange(){this.lastActiveEditor&&typeof this.lastActiveGroupId=="number"&&this.maybeTriggerAutoSave(3,{groupId:this.lastActiveGroupId,editor:this.lastActiveEditor});let e=this.editorGroupService.activeGroup,t=this.lastActiveEditor=e.activeEditor??void 0;this.lastActiveGroupId=e.id,this.lastActiveEditorControlDisposable.clear();let o=this.editorService.activeEditorPane;t&&o&&this.lastActiveEditorControlDisposable.add(o.onDidBlur(()=>{this.maybeTriggerAutoSave(3,{groupId:e.id,editor:t})}))}maybeTriggerAutoSave(e,t){if(t){if(!t.editor.isDirty()||t.editor.isReadonly()||t.editor.hasCapability(4))return;let o=this.filesConfigurationService.getAutoSaveMode(t.editor,e);o.mode!==0?(e===4&&(o.mode===3||o.mode===4)||e===3&&o.mode===3)&&(this.logService.trace(`[editor auto save] triggering auto save with reason ${e}`),this.editorService.save(t,{reason:e})):t.editor.resource&&(o.reason===3||o.reason===4)&&this.waitingOnConditionAutoSaveEditors.set(t.editor.resource,{editor:t,reason:e,condition:o.reason})}else this.saveAllDirtyAutoSaveables(e)}onDidChangeAutoSaveConfiguration(){let e;switch(this.filesConfigurationService.getAutoSaveMode(void 0).mode){case 3:e=3;break;case 4:e=4;break;case 1:case 2:e=2;break}e&&this.saveAllDirtyAutoSaveables(e)}saveAllDirtyAutoSaveables(e){for(let t of this.workingCopyService.dirtyWorkingCopies){if(t.capabilities&2)continue;let o=this.filesConfigurationService.getAutoSaveMode(t.resource,e);o.mode!==0?t.save({reason:e}):(o.reason===3||o.reason===4)&&this.waitingOnConditionAutoSaveWorkingCopies.set(t.resource,{workingCopy:t,reason:e,condition:o.reason})}}onDidRegister(e){e.isDirty()&&this.scheduleAutoSave(e)}onDidUnregister(e){this.discardAutoSave(e)}onDidChangeDirty(e){e.isDirty()?this.scheduleAutoSave(e):this.discardAutoSave(e)}onDidChangeContent(e){e.isDirty()&&this.scheduleAutoSave(e)}scheduleAutoSave(e){if(e.capabilities&2)return;let t=this.filesConfigurationService.getAutoSaveConfiguration(e.resource).autoSaveDelay;if(typeof t!="number")return;this.discardAutoSave(e),this.logService.trace(`[editor auto save] scheduling auto save after ${t}ms`,e.resource.toString(),e.typeId);let o=setTimeout(()=>{if(this.discardAutoSave(e),e.isDirty()){let n=2,r=this.filesConfigurationService.getAutoSaveMode(e.resource,n);r.mode!==0?(this.logService.trace("[editor auto save] running auto save",e.resource.toString(),e.typeId),e.save({reason:n})):(r.reason===3||r.reason===4)&&this.waitingOnConditionAutoSaveWorkingCopies.set(e.resource,{workingCopy:e,reason:n,condition:r.reason})}},t);this.scheduledAutoSavesAfterDelay.set(e,Z(()=>{this.logService.trace("[editor auto save] clearing pending auto save",e.resource.toString(),e.typeId),clearTimeout(o)}))}discardAutoSave(e){Ue(this.scheduledAutoSavesAfterDelay.get(e)),this.scheduledAutoSavesAfterDelay.delete(e),this.waitingOnConditionAutoSaveWorkingCopies.delete(e.resource),this.waitingOnConditionAutoSaveEditors.delete(e.resource)}};bue=I([m(0,lr),m(1,oi),m(2,ee),m(3,Et),m(4,Wa),m(5,ne),m(6,Ns),m(7,dt)],bue);var Tu={Quickaccess:"workbench.contributions.quickaccess"},Rvi=class{constructor(){this.providers=[];this.defaultProvider=void 0}registerQuickAccessProvider(i){return i.prefix.length===0?this.defaultProvider=i:this.providers.push(i),this.providers.sort((e,t)=>t.prefix.length-e.prefix.length),Z(()=>{this.providers.splice(this.providers.indexOf(i),1),this.defaultProvider===i&&(this.defaultProvider=void 0)})}getQuickAccessProviders(i){return si([this.defaultProvider,...this.providers]).filter(e=>!e.when||i.contextMatchesRules(e.when))}getQuickAccessProvider(i,e){return(i?this.providers.find(o=>i.startsWith(o.prefix)&&(!o.when||e.contextMatchesRules(o.when))):void 0)||this.defaultProvider}clear(){let i=[...this.providers],e=this.defaultProvider;return this.providers=[],this.defaultProvider=void 0,()=>{this.providers=i,this.defaultProvider=e}}};oe.add(Tu.Quickaccess,new Rvi);var lk=ae("textEditorService"),Mvi=class extends Error{constructor(i,e){super(i),this.name="FileEditorInputLeakError",this.stack=e}},vK=class extends C{constructor(e,t,o,n,r){super();this.untitledTextEditorService=e;this.instantiationService=t;this.uriIdentityService=o;this.fileService=n;this.editorResolverService=r;this.editorInputCache=new vt;this.fileEditorFactory=oe.as(rn.EditorFactory).getFileEditorFactory();this.mapLeakToCounter=new Map;this.registerDefaultEditor()}registerDefaultEditor(){this._register(this.editorResolverService.registerEditor("*",{id:Ys.id,label:Ys.displayName,detail:Ys.providerDisplayName,priority:"builtin"},{},{createEditorInput:e=>({editor:this.createTextEditor(e)}),createUntitledEditorInput:e=>({editor:this.createTextEditor(e)}),createDiffEditorInput:e=>({editor:this.createTextEditor(e)})}))}async resolveTextEditor(e){return this.createTextEditor(e)}createTextEditor(e){if(dC(e))return this.createTextEditor(e.result);if(db(e)){let n=this.createTextEditor(e.original),r=this.createTextEditor(e.modified);return this.instantiationService.createInstance(Fa,e.label,e.description,n,r,void 0)}if(C_(e)){let n=this.createTextEditor(e.primary),r=this.createTextEditor(e.secondary);return this.instantiationService.createInstance(ga,e.label,e.description,r,n)}let t=e;if(t.forceUntitled||!t.resource||t.resource.scheme===Y.untitled){let n={languageId:t.languageId,initialValue:t.contents,encoding:t.encoding},r;return t.resource?.scheme===Y.untitled?r=this.untitledTextEditorService.create({untitledResource:t.resource,...n}):r=this.untitledTextEditorService.create({associatedResource:t.resource,...n}),this.createOrGetCached(r.resource,()=>this.instantiationService.createInstance(qm,r))}let o=e;if(o.resource instanceof A){let n=o.label||Ye(o.resource),r=o.resource,s=this.uriIdentityService.asCanonicalUri(r);return this.createOrGetCached(s,()=>o.forceFile||this.fileService.hasProvider(s)?this.fileEditorFactory.createFileEditor(s,r,o.label,o.description,o.encoding,o.languageId,o.contents,this.instantiationService):this.instantiationService.createInstance(IC,s,o.label,o.description,o.languageId,o.contents),l=>{l instanceof qm||(l instanceof IC?(n&&l.setName(n),o.description&&l.setDescription(o.description),o.languageId&&l.setPreferredLanguageId(o.languageId),typeof o.contents=="string"&&l.setPreferredContents(o.contents)):(l.setPreferredResource(r),o.label&&l.setPreferredName(o.label),o.description&&l.setPreferredDescription(o.description),o.encoding&&l.setPreferredEncoding(o.encoding),o.languageId&&l.setPreferredLanguageId(o.languageId),typeof o.contents=="string"&&l.setPreferredContents(o.contents)))})}throw new Error(`ITextEditorService: Unable to create texteditor from ${JSON.stringify(e)}`)}createOrGetCached(e,t,o){let n=this.editorInputCache.get(e);if(n)return o?.(n),n;n=t(),this.editorInputCache.set(e,n);let r=this.trackLeaks(n);return H.once(n.onWillDispose)(()=>{this.editorInputCache.delete(e),r&&this.untrackLeaks(r)}),n}static{this.LEAK_TRACKING_THRESHOLD=256}static{this.LEAK_REPORTING_THRESHOLD=2*this.LEAK_TRACKING_THRESHOLD}static{this.LEAK_REPORTED=!1}trackLeaks(e){if(vK.LEAK_REPORTED||this.editorInputCache.size<vK.LEAK_TRACKING_THRESHOLD)return;let t=`${e.resource.scheme}#${e.typeId||"<no typeId>"}#${e.editorId||"<no editorId>"}
${new Error().stack?.split(`
`).slice(2).join(`
`)??""}`,o=(this.mapLeakToCounter.get(t)??0)+1;if(this.mapLeakToCounter.set(t,o),this.editorInputCache.size>vK.LEAK_REPORTING_THRESHOLD){vK.LEAK_REPORTED=!0;let[n,r]=Array.from(this.mapLeakToCounter.entries()).reduce(([l,c],[u,p])=>p>c?[u,p]:[l,c]),s=`Potential text editor input LEAK detected, having ${this.editorInputCache.size} text editor inputs already. Most frequent owner (${r})`;mt(new Mvi(s,n))}return t}untrackLeaks(e){let t=(this.mapLeakToCounter.get(e)??1)-1;this.mapLeakToCounter.set(e,t),t===0&&this.mapLeakToCounter.delete(e)}};vK=I([m(0,H_),m(1,F),m(2,dt),m(3,be),m(4,ul)],vK);we(lk,vK,0);var V_e=class{constructor(i,e,t){this.filesConfigurationService=i;this.environmentService=e;this.pathService=t}canSerialize(i){return this.filesConfigurationService.isHotExitEnabled&&!i.isDisposed()}serialize(i){if(!this.canSerialize(i))return;let e=i,t=e.resource;e.hasAssociatedFilePath&&(t=Og(t,this.environmentService.remoteAuthority,this.pathService.defaultUriScheme));let o,n=e.getLanguageId();(n!==Fr||e.hasLanguageSetExplicitly)&&(o=n);let r={resourceJSON:t.toJSON(),modeId:o,encoding:e.getEncoding()};return JSON.stringify(r)}deserialize(i,e){return i.invokeFunction(t=>{let o=JSON.parse(e),n=A.revive(o.resourceJSON),r=o.modeId,s=o.encoding;return t.get(lk).createTextEditor({resource:n,languageId:r,encoding:s,forceUntitled:!0})})}};V_e=I([m(0,lr),m(1,Vt),m(2,wn)],V_e);var Sue=class extends C{constructor(e,t,o,n,r){super();this.environmentService=t;this.pathService=o;this.textEditorService=n;this.untitledTextEditorService=r;this._register(e.registerHandler(this))}static{this.ID="workbench.contrib.untitledTextEditorWorkingCopyEditorHandler"}handles(e){return e.resource.scheme===Y.untitled&&e.typeId===CP}isOpen(e,t){return this.handles(e)?t instanceof qm&&Xe(e.resource,t.resource):!1}createEditor(e){let t;return this.untitledTextEditorService.isUntitledWithAssociatedResource(e.resource)?t=Og(e.resource,this.environmentService.remoteAuthority,this.pathService.defaultUriScheme):t=e.resource,this.textEditorService.createTextEditor({resource:t,forceUntitled:!0})}};Sue=I([m(0,Vf),m(1,Vt),m(2,wn),m(3,lk),m(4,H_)],Sue);var fF=class extends C{constructor(e,t,o){super();this.editorResolverService=e;this.environmentService=o;this.configurationRegistry=oe.as(ii.Configuration);(async()=>(await t.whenInstalledExtensionsRegistered(),this.updateDynamicEditorConfigurations(),this.registerListeners()))()}static{this.ID="workbench.contrib.dynamicEditorConfigurations"}static{this.AUTO_LOCK_DEFAULT_ENABLED=new Set(["terminalEditor","mainThreadWebview-simpleBrowser.view","mainThreadWebview-browserPreview","workbench.editor.processExplorer"])}static{this.AUTO_LOCK_EXTRA_EDITORS=[{id:"workbench.input.interactive",label:d(3933,null),priority:"builtin"},{id:"mainThreadWebview-markdown.preview",label:d(3935,null),priority:"builtin"},{id:"mainThreadWebview-simpleBrowser.view",label:d(3936,null),priority:"builtin"},{id:"mainThreadWebview-browserPreview",label:d(3934,null),priority:"builtin"}]}static{this.AUTO_LOCK_REMOVE_EDITORS=new Set(["vscode-interactive-input","interactive","vscode.markdown.preview.editor"])}registerListeners(){this._register(H.debounce(this.editorResolverService.onDidChangeEditorRegistrations,(e,t)=>t)(()=>this.updateDynamicEditorConfigurations()))}updateDynamicEditorConfigurations(){let e=[...this.editorResolverService.getEditors(),...fF.AUTO_LOCK_EXTRA_EDITORS].filter(u=>!fF.AUTO_LOCK_REMOVE_EDITORS.has(u.id)),t=this.editorResolverService.getEditors().filter(u=>u.priority!=="exclusive").map(u=>u.id),o=Object.create(null);for(let u of e)o[u.id]={type:"boolean",default:fF.AUTO_LOCK_DEFAULT_ENABLED.has(u.id),description:u.label};let n=Object.create(null);for(let u of e)n[u.id]=fF.AUTO_LOCK_DEFAULT_ENABLED.has(u.id);let r=this.autoLockConfigurationNode;this.autoLockConfigurationNode={...Cm,properties:{"workbench.editor.autoLockGroups":{type:"object",description:d(3937,null),properties:o,default:n,additionalProperties:!1}}};let s=this.defaultBinaryEditorConfigurationNode;this.defaultBinaryEditorConfigurationNode={...Cm,properties:{"workbench.editor.defaultBinaryEditor":{type:"string",default:"",enum:[...t,""],description:d(3938,null)}}};let l=this.editorAssociationsConfigurationNode;this.editorAssociationsConfigurationNode={...Cm,properties:{"workbench.editorAssociations":{type:"object",markdownDescription:d(3931,null),patternProperties:{".*":{type:"string",enum:t}}}}};let c=this.editorLargeFileConfirmationConfigurationNode;this.editorLargeFileConfirmationConfigurationNode={...Cm,properties:{"workbench.editorLargeFileConfirmation":{type:"number",default:eft(this.environmentService.remoteAuthority)/ll.MB,minimum:1,scope:5,markdownDescription:d(3932,null)}}},this.configurationRegistry.updateConfigurations({add:[this.autoLockConfigurationNode,this.defaultBinaryEditorConfigurationNode,this.editorAssociationsConfigurationNode,this.editorLargeFileConfirmationConfigurationNode],remove:si([r,s,l,c])})}};fF=I([m(0,ul),m(1,lt),m(2,Vt)],fF);var Iue=class extends st{constructor(e){super(e.id,e.name,e.classNames?.join(" "),!0);this.item=e;this._onDidChangeCompositeBarActionItem=this._register(new E);this.onDidChangeCompositeBarActionItem=this._onDidChangeCompositeBarActionItem.event;this._onDidChangeActivity=this._register(new E);this.onDidChangeActivity=this._onDidChangeActivity.event;this._activities=[]}get compositeBarActionItem(){return this.item}set compositeBarActionItem(e){this._label=e.name,this.item=e,this._onDidChangeCompositeBarActionItem.fire(this)}get activities(){return this._activities}set activities(e){this._activities=e,this._onDidChangeActivity.fire(e)}activate(){this.checked||this._setChecked(!0)}deactivate(){this.checked&&this._setChecked(!1)}},B_e=class extends oc{constructor(e,t,o,n,r,s,l){super(null,e,t);this.badgesEnabled=o;this.themeService=n;this.hoverService=r;this.configurationService=s;this.keybindingService=l;this.badgeDisposable=this._register(new me);this.options=t,this._register(this.themeService.onDidColorThemeChange(this.onThemeChange,this)),this._register(e.onDidChangeCompositeBarActionItem(()=>this.update())),this._register(H.filter(l.onDidUpdateKeybindings,()=>this.keybindingLabel!==this.computeKeybindingLabel())(()=>this.updateTitle())),this._register(e.onDidChangeActivity(()=>this.updateActivity()))}get compositeBarActionItem(){return this._action.compositeBarActionItem}updateStyles(){let e=this.themeService.getColorTheme(),t=this.options.colors(e);if(this.label){if(this.options.icon){let o=this._action.checked?t.activeForegroundColor:t.inactiveForegroundColor;this.compositeBarActionItem.iconUrl?(this.label.style.backgroundColor=o?o.toString():"",this.label.style.color=""):(this.label.style.color=o?o.toString():"",this.label.style.backgroundColor="")}else{let o=this._action.checked?t.activeForegroundColor:t.inactiveForegroundColor,n=this._action.checked?t.activeBorderBottomColor:null;this.label.style.color=o?o.toString():"",this.label.style.borderBottomColor=n?n.toString():""}this.container.style.setProperty("--insert-border-color",t.dragAndDropBorder?t.dragAndDropBorder.toString():"")}if(this.badgeContent){let o=this.getActivities()[0]?.badge.getColors(e),n=o?.badgeForeground??t.badgeForeground??e.getColor(Yw),r=o?.badgeBackground??t.badgeBackground??e.getColor(rv),s=o?.badgeBorder??e.getColor(gi);this.badgeContent.style.color=n?n.toString():"",this.badgeContent.style.backgroundColor=r?r.toString():"",this.badgeContent.style.borderStyle=s&&!this.options.compact?"solid":"",this.badgeContent.style.borderWidth=s?"1px":"",this.badgeContent.style.borderColor=s?s.toString():""}}render(e){super.render(e),this.container=e,this.options.icon&&this.container.classList.add("icon");let t=this.options.isTabList||!this.options.hasPopup?"tab":"button";this.container.setAttribute("role",t),this.options.hasPopup&&this.container.setAttribute("aria-haspopup","true"),this._register(j(this.container,re.MOUSE_DOWN,()=>{this.container.classList.add("clicked")})),this._register(j(this.container,re.MOUSE_UP,()=>{this.mouseUpTimeout&&clearTimeout(this.mouseUpTimeout),this.mouseUpTimeout=setTimeout(()=>{this.container.classList.remove("clicked")},800)})),this._register(this.hoverService.setupDelayedHover(this.container,()=>({content:this.computeTitle(),style:1,position:{hoverPosition:this.options.hoverOptions.position()},persistence:{hideOnKeyDown:!0}}),{groupId:"composite-bar-actions"})),this.label=R(e,_("a")),this.badge=R(e,_(".badge")),this.badgeContent=R(this.badge,_(".badge-content")),R(e,_(".active-item-indicator")),xo(this.badge),this.update(),this.updateStyles(),this.updateTitle()}onThemeChange(e){this.updateStyles()}update(){this.updateLabel(),this.updateActivity(),this.updateTitle(),this.updateStyles()}getActivities(){return this._action instanceof Iue?this._action.activities:[]}updateActivity(){if(!this.badge||!this.badgeContent||!(this._action instanceof Iue))return;let{badges:e,type:t}=this.getVisibleBadges(this.getActivities());this.badgeDisposable.value=new P,Rt(this.badgeContent),xo(this.badge);let o=this.badgesEnabled(this.compositeBarActionItem.id);if(e.length>0&&o){let n=[];if(this.options.compact&&n.push("compact"),t==="progress")bn(this.badge),n.push("progress-badge");else if(t==="number"){let r=e.reduce((s,l)=>s+(l instanceof qc?l.number:0),0);if(r>0){let s=r.toString();if(r>999){let l=r/1e3,c=Math.floor(l);s=l>c?`${c}K+`:`${l}K`}this.options.compact&&s.length>=3&&n.push("compact-content"),this.badgeContent.textContent=s,bn(this.badge)}}else if(t==="icon"){n.push("icon-badge");let r=["icon-overlay",...q.asClassNameArray(e[0].icon)];this.badgeContent.classList.add(...r),this.badgeDisposable.value.add(Z(()=>this.badgeContent?.classList.remove(...r))),bn(this.badge)}n.length&&(this.badge.classList.add(...n),this.badgeDisposable.value.add(Z(()=>this.badge.classList.remove(...n))))}this.updateTitle(),this.updateStyles()}getVisibleBadges(e){let t=e.filter(r=>r.badge instanceof PC).map(r=>r.badge);if(t.length>0)return{badges:t,type:"progress"};let o=e.filter(r=>r.badge instanceof eK).map(r=>r.badge);if(o.length>0)return{badges:o,type:"icon"};let n=e.filter(r=>r.badge instanceof qc).map(r=>r.badge);return n.length>0?{badges:n,type:"number"}:{badges:[],type:void 0}}updateLabel(){this.label.className="action-label",this.compositeBarActionItem.classNames&&this.label.classList.add(...this.compositeBarActionItem.classNames),this.options.icon||(this.label.textContent=this.action.label)}updateTitle(){let e=this.computeTitle();[this.label,this.badge,this.container].forEach(t=>{t&&(t.setAttribute("aria-label",e),t.setAttribute("title",""),t.removeAttribute("title"))})}computeTitle(){this.keybindingLabel=this.computeKeybindingLabel();let e=this.keybindingLabel?d(3560,null,this.compositeBarActionItem.name,this.keybindingLabel):this.compositeBarActionItem.name,t=this.getVisibleBadges(this.action.activities).badges;for(let o of t)o.getDescription()&&(e=`${e} - ${o.getDescription()}`);return e}computeKeybindingLabel(){return(this.compositeBarActionItem.keybindingId?this.keybindingService.lookupKeybinding(this.compositeBarActionItem.keybindingId):null)?.getLabel()}dispose(){super.dispose(),this.mouseUpTimeout&&clearTimeout(this.mouseUpTimeout),this.badge.remove()}};B_e=I([m(3,De),m(4,tt),m(5,B),m(6,_e)],B_e);var X7e=class extends Iue{constructor(e){super({id:"additionalComposites.action",name:d(3554,null),classNames:q.asClassNameArray(M.more)});this.showMenu=e}async run(){this.showMenu()}},H_e=class extends B_e{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super(e,{icon:!0,colors:s,hasPopup:!0,hoverOptions:l,isTabList:!0},()=>!0,u,p,h,g);this.getOverflowingComposites=t;this.getActiveCompositeId=o;this.getBadge=n;this.getCompositeOpenAction=r;this.contextMenuService=c}showMenu(){this.contextMenuService.showContextMenu({getAnchor:()=>this.container,getActions:()=>this.getActions(),getCheckedActionsRepresentation:()=>"radio"})}getActions(){return this.getOverflowingComposites().map(e=>{let t=this.getCompositeOpenAction(e.id);t.checked=this.getActiveCompositeId()===t.id;let o=this.getBadge(e.id),n;return o instanceof qc&&(n=o.number),n?t.label=d(3558,null,e.name,n):t.label=e.name||"",t})}};H_e=I([m(7,ze),m(8,De),m(9,tt),m(10,B),m(11,_e)],H_e);var U_e=class extends B_e{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super(t,e,c.areBadgesEnabled.bind(c),g,f,v,p);this.toggleCompositePinnedAction=o;this.toggleCompositeBadgeAction=n;this.compositeContextMenuActionsProvider=r;this.contextMenuActionsProvider=s;this.dndHandler=l;this.compositeBar=c;this.contextMenuService=u;this.commandService=b}render(e){super.render(e),this.updateChecked(),this.updateEnabled(),this._register(j(this.container,re.CONTEXT_MENU,o=>{$t.stop(o,!0),this.showContextMenu(e)}));let t;this._register(KE.INSTANCE.registerDraggable(this.container,()=>({type:"composite",id:this.compositeBarActionItem.id}),{onDragOver:o=>{let n=o.dragAndDropData.getData().id!==this.compositeBarActionItem.id&&this.dndHandler.onDragOver(o.dragAndDropData,this.compositeBarActionItem.id,o.eventData);E5(o.eventData.dataTransfer,"move",n),t=this.updateFromDragging(e,n,o.eventData)},onDragLeave:o=>{t=this.updateFromDragging(e,!1,o.eventData)},onDragEnd:o=>{t=this.updateFromDragging(e,!1,o.eventData)},onDrop:o=>{$t.stop(o.eventData,!0),this.dndHandler.drop(o.dragAndDropData,this.compositeBarActionItem.id,o.eventData,t),t=this.updateFromDragging(e,!1,o.eventData)},onDragStart:o=>{o.dragAndDropData.getData().id===this.compositeBarActionItem.id&&(o.eventData.dataTransfer&&(o.eventData.dataTransfer.effectAllowed="move"),this.blur())}})),[this.badge,this.label].forEach(o=>this._register(new IIe(o,()=>{this.action.checked||this.action.run()}))),this.updateStyles()}updateFromDragging(e,t,o){let n=e.getBoundingClientRect(),r=o.clientX,s=o.clientY,l=n.bottom-n.top,c=n.right-n.left,u=s<=n.top+l*.4,p=s>n.bottom-l*.4,h=s<=n.top+l*.5,g=r<=n.left+c*.4,f=r>n.right-c*.4,v=r<=n.left+c*.5,b=e.classList,S={vertical:b.contains("top")?"top":b.contains("bottom")?"bottom":void 0,horizontal:b.contains("left")?"left":b.contains("right")?"right":void 0},y=u||h&&!S.vertical||!p&&S.vertical==="top",w=p||!h&&!S.vertical||!u&&S.vertical==="bottom",k=g||v&&!S.horizontal||!f&&S.horizontal==="left",T=f||!v&&!S.horizontal||!g&&S.horizontal==="right";if(e.classList.toggle("top",t&&y),e.classList.toggle("bottom",t&&w),e.classList.toggle("left",t&&k),e.classList.toggle("right",t&&T),!!t)return{verticallyBefore:y,horizontallyBefore:k}}showContextMenu(e){let t=[];this.compositeBarActionItem.keybindingId&&t.push(Gje(this.commandService,this.keybindingService,this.compositeBarActionItem.keybindingId)),t.push(this.toggleCompositePinnedAction,this.toggleCompositeBadgeAction);let o=this.compositeContextMenuActionsProvider(this.compositeBarActionItem.id);o.length&&t.push(...o),this.compositeBar.isPinned(this.compositeBarActionItem.id)?(this.toggleCompositePinnedAction.label=d(3555,null,this.compositeBarActionItem.name),this.toggleCompositePinnedAction.checked=!1,this.toggleCompositePinnedAction.enabled=this.compositeBar.getPinnedCompositeIds().length>1):(this.toggleCompositePinnedAction.label=d(3557,null,this.compositeBarActionItem.name),this.toggleCompositePinnedAction.enabled=!0),this.compositeBar.areBadgesEnabled(this.compositeBarActionItem.id)?this.toggleCompositeBadgeAction.label=d(3556,null):this.toggleCompositeBadgeAction.label=d(3559,null);let s=this.contextMenuActionsProvider();s.length&&(t.push(new li),t.push(...s));let l=Yn(e),c={x:Math.floor(l.left+l.width/2),y:l.top+l.height};this.contextMenuService.showContextMenu({getAnchor:()=>c,getActions:()=>t,getActionsContext:()=>this.compositeBarActionItem.id})}updateChecked(){this.action.checked?(this.container.classList.add("checked"),this.container.setAttribute("aria-label",this.getTooltip()??this.container.title),this.container.setAttribute("aria-expanded","true"),this.container.setAttribute("aria-selected","true")):(this.container.classList.remove("checked"),this.container.setAttribute("aria-label",this.getTooltip()??this.container.title),this.container.setAttribute("aria-expanded","false"),this.container.setAttribute("aria-selected","false")),this.updateStyles()}updateEnabled(){this.element&&(this.action.enabled?this.element.classList.remove("disabled"):this.element.classList.add("disabled"))}dispose(){super.dispose(),this.label.remove()}};U_e=I([m(8,ze),m(9,_e),m(10,F),m(11,De),m(12,tt),m(13,B),m(14,ge)],U_e);var J7e=class extends st{constructor(e,t){super("show.toggleCompositePinned",e?e.name:d(3561,null));this.activity=e;this.compositeBar=t;this.checked=!!this.activity&&this.compositeBar.isPinned(this.activity.id)}async run(e){let t=this.activity?this.activity.id:e;this.compositeBar.isPinned(t)?this.compositeBar.unpin(t):this.compositeBar.pin(t)}},Z7e=class extends st{constructor(e,t){super("show.toggleCompositeBadge",e?e.name:d(3562,null));this.compositeBarActionItem=e;this.compositeBar=t;this.checked=!1}async run(e){let t=this.compositeBarActionItem?this.compositeBarActionItem.id:e;this.compositeBar.toggleBadgeEnablement(t)}},wJ=class extends K{constructor(e,t,o){super(e);this.location=t;this.offset=o}async run(e){let t=e.get(ds),o=t.getActivePaneComposite(this.location);if(!o)return;let n,r=t.getVisiblePaneCompositeIds(this.location);for(let s=0;s<r.length;s++)if(r[s]===o.getId()){n=r[(s+r.length+this.offset)%r.length];break}typeof n<"u"&&await t.openPaneComposite(n,this.location,!0)}};var nqo=Re("auxiliarybar-maximize",M.screenFull,d(3531,null)),Pvi=Re("auxiliarybar-close",M.close,d(3523,null)),rqo=Re("auxiliarybar-right-layout-icon",M.layoutSidebarRight,d(3541,null)),sqo=Re("auxiliarybar-right-off-layout-icon",M.layoutSidebarRightOff,d(3542,null)),aqo=Re("auxiliarybar-left-layout-icon",M.layoutSidebarLeft,d(3539,null)),lqo=Re("auxiliarybar-left-off-layout-icon",M.layoutSidebarLeftOff,d(3540,null)),Y5=class a extends K{static{this.ID="workbench.action.toggleAuxiliaryBar"}static{this.LABEL=L(3538,"Toggle Secondary Side Bar Visibility")}constructor(){super({id:a.ID,title:a.LABEL,toggled:{condition:D_,title:d(3524,null),icon:Pvi,mnemonicTitle:d(3532,null)},icon:Pvi,category:We.View,metadata:{description:d(3534,null)},f1:!0,keybinding:{weight:200,primary:2592},menu:[{id:D.LayoutControlMenuSubmenu,group:"0_workbench_layout",order:1},{id:D.MenubarAppearanceMenu,group:"2_workbench_layout",order:2}]})}async run(i){let e=i.get(fi),t=e.isVisible("workbench.parts.auxiliarybar");e.setPartHidden(t,"workbench.parts.auxiliarybar");let o=t?d(3521,null):d(3522,null);Jo(o)}};W(Y5);fe.appendMenuItem(D.AuxiliaryBarTitle,{command:{id:Y5.ID,title:d(3524,null),icon:Pvi},group:"navigation",order:2,when:x.equals("config.workbench.activityBar.location","default")});W(class extends K{constructor(){super({id:"workbench.action.closeAuxiliaryBar",title:L(3525,"Hide Secondary Side Bar"),category:We.View,precondition:D_,f1:!0})}run(a){a.get(fi).setPartHidden(!0,"workbench.parts.auxiliarybar")}});W(class Avi extends K{static{this.ID="workbench.action.focusAuxiliaryBar"}static{this.LABEL=L(3526,"Focus into Secondary Side Bar")}constructor(){super({id:Avi.ID,title:Avi.LABEL,category:We.View,f1:!0})}async run(i){let e=i.get(ds),t=i.get(fi);t.isVisible("workbench.parts.auxiliarybar")||t.setPartHidden(!1,"workbench.parts.auxiliarybar"),e.getActivePaneComposite(2)?.focus()}});fe.appendMenuItems([{id:D.LayoutControlMenu,item:{group:"2_pane_toggles",command:{id:Y5.ID,title:d(3544,null),toggled:{condition:D_,icon:aqo},icon:lqo},when:x.and(Xc.negate(),x.or(x.equals("config.workbench.layoutControl.type","toggles"),x.equals("config.workbench.layoutControl.type","both")),x.equals("config.workbench.sideBar.location","right")),order:0}},{id:D.LayoutControlMenu,item:{group:"2_pane_toggles",command:{id:Y5.ID,title:d(3544,null),toggled:{condition:D_,icon:rqo},icon:sqo},when:x.and(Xc.negate(),x.or(x.equals("config.workbench.layoutControl.type","toggles"),x.equals("config.workbench.layoutControl.type","both")),x.equals("config.workbench.sideBar.location","left")),order:2}},{id:D.ViewContainerTitleContext,item:{group:"3_workbench_layout_move",command:{id:Y5.ID,title:L(3527,"Hide Secondary Side Bar")},when:x.and(D_,x.equals("viewContainerLocation",WE(2))),order:2}}]);W(class extends wJ{constructor(){super({id:"workbench.action.previousAuxiliaryBarView",title:L(3535,"Previous Secondary Side Bar View"),category:We.View,f1:!0},2,-1)}});W(class extends wJ{constructor(){super({id:"workbench.action.nextAuxiliaryBarView",title:L(3533,"Next Secondary Side Bar View"),category:We.View,f1:!0},2,1)}});var Nvi=class a extends K{static{this.ID="workbench.action.maximizeAuxiliaryBar"}constructor(){super({id:a.ID,title:L(3528,"Maximize Secondary Side Bar"),tooltip:d(3529,null),category:We.View,f1:!0,precondition:tke.negate()})}run(i){i.get(fi).setAuxiliaryBarMaximized(!0)}};W(Nvi);var Ovi=class a extends K{static{this.ID="workbench.action.restoreAuxiliaryBar"}constructor(){super({id:a.ID,title:L(3536,"Restore Secondary Side Bar"),tooltip:d(3537,null),category:We.View,f1:!0,precondition:tke,keybinding:{weight:200,primary:2101,win:{primary:2110,secondary:[2101]}}})}run(i){i.get(fi).setAuxiliaryBarMaximized(!1)}};W(Ovi);var Fvi=class a extends K{static{this.ID="workbench.action.toggleMaximizedAuxiliaryBar"}constructor(){super({id:a.ID,title:L(3543,"Toggle Maximized Secondary Side Bar"),tooltip:d(3530,null),f1:!0,category:We.View,icon:nqo,toggled:{condition:tke,tooltip:d(3537,null)},menu:{id:D.AuxiliaryBarTitle,group:"navigation",order:1}})}run(i){i.get(fi).toggleMaximizedAuxiliaryBar()}};W(Fvi);var cqo=Re("panel-maximize",M.screenFull,d(4156,null)),Wvi=Re("panel-close",M.close,d(4151,null)),dqo=Re("panel-layout-icon",M.layoutPanel,d(4177,null)),uqo=Re("panel-layout-icon-off",M.layoutPanelOff,d(4178,null)),yue=class a extends K{static{this.ID="workbench.action.togglePanel"}static{this.LABEL=L(4179,"Toggle Panel Visibility")}constructor(){super({id:a.ID,title:a.LABEL,toggled:{condition:_Y,title:d(4152,null),icon:Wvi,mnemonicTitle:d(4159,null)},icon:Wvi,f1:!0,category:We.View,metadata:{description:d(4163,null)},keybinding:{primary:2088,weight:200},menu:[{id:D.MenubarAppearanceMenu,group:"2_workbench_layout",order:5},{id:D.LayoutControlMenuSubmenu,group:"0_workbench_layout",order:4}]})}async run(i){let e=i.get(fi);e.setPartHidden(e.isVisible("workbench.parts.panel"),"workbench.parts.panel")}};W(yue);fe.appendMenuItem(D.PanelTitle,{command:{id:yue.ID,title:d(4152,null),icon:Wvi},group:"navigation",order:2});W(class extends K{constructor(){super({id:"workbench.action.closePanel",title:L(4153,"Hide Panel"),category:We.View,precondition:_Y,f1:!0})}run(a){a.get(fi).setPartHidden(!0,"workbench.parts.panel")}});W(class extends K{static{this.ID="workbench.action.focusPanel"}static{this.LABEL=d(4154,null)}constructor(){super({id:"workbench.action.focusPanel",title:L(4155,"Focus into Panel"),category:We.View,f1:!0})}async run(a){let i=a.get(fi),e=a.get(ds);i.isVisible("workbench.parts.panel")||i.setPartHidden(!1,"workbench.parts.panel"),e.getActivePaneComposite(1)?.focus()}});var qNt={LEFT:"workbench.action.positionPanelLeft",RIGHT:"workbench.action.positionPanelRight",BOTTOM:"workbench.action.positionPanelBottom",TOP:"workbench.action.positionPanelTop"},jNt={LEFT:"workbench.action.alignPanelLeft",RIGHT:"workbench.action.alignPanelRight",CENTER:"workbench.action.alignPanelCenter",JUSTIFY:"workbench.action.alignPanelJustify"};function Qoo(a,i,e,t,o){return{id:a,title:i,shortLabel:e,value:t,when:o}}function QNt(a,i,e,t){return Qoo(a,i,e,t,TY.notEqualsTo(KO(t)))}function YNt(a,i,e,t){return Qoo(a,i,e,t,cV.notEqualsTo(t))}var pqo=[QNt(qNt.TOP,L(4172,"Move Panel To Top"),d(4173,null),3),QNt(qNt.LEFT,L(4168,"Move Panel Left"),d(4169,null),0),QNt(qNt.RIGHT,L(4170,"Move Panel Right"),d(4171,null),1),QNt(qNt.BOTTOM,L(4166,"Move Panel To Bottom"),d(4167,null),2)],mqo=[YNt(jNt.LEFT,L(4147,"Set Panel Alignment to Left"),d(4148,null),"left"),YNt(jNt.RIGHT,L(4149,"Set Panel Alignment to Right"),d(4150,null),"right"),YNt(jNt.CENTER,L(4143,"Set Panel Alignment to Center"),d(4144,null),"center"),YNt(jNt.JUSTIFY,L(4145,"Set Panel Alignment to Justify"),d(4146,null),"justify")];fe.appendMenuItem(D.MenubarAppearanceMenu,{submenu:D.PanelPositionMenu,title:d(4165,null),group:"3_workbench_layout_move",order:4});pqo.forEach((a,i)=>{let{id:e,title:t,shortLabel:o,value:n,when:r}=a;W(class extends K{constructor(){super({id:e,title:t,category:We.View,f1:!0})}run(s){s.get(fi).setPanelPosition(n===void 0?2:n)}}),fe.appendMenuItem(D.PanelPositionMenu,{command:{id:e,title:o,toggled:r.negate()},order:5+i})});fe.appendMenuItem(D.MenubarAppearanceMenu,{submenu:D.PanelAlignmentMenu,title:d(4142,null),group:"3_workbench_layout_move",order:5});mqo.forEach(a=>{let{id:i,title:e,shortLabel:t,value:o,when:n}=a;W(class extends K{constructor(){super({id:i,title:e,category:We.View,toggled:n.negate(),f1:!0})}run(r){r.get(fi).setPanelAlignment(o===void 0?"center":o)}}),fe.appendMenuItem(D.PanelAlignmentMenu,{command:{id:i,title:t,toggled:n.negate()},order:5})});W(class extends wJ{constructor(){super({id:"workbench.action.previousPanelView",title:L(4174,"Previous Panel View"),category:We.View,f1:!0},1,-1)}});W(class extends wJ{constructor(){super({id:"workbench.action.nextPanelView",title:L(4162,"Next Panel View"),category:We.View,f1:!0},1,1)}});var joo=x.or(cV.isEqualTo("center"),x.and(TY.notEqualsTo("bottom"),TY.notEqualsTo("top")));W(class extends K{constructor(){super({id:"workbench.action.toggleMaximizedPanel",title:L(4175,"Toggle Maximized Panel"),tooltip:d(4157,null),category:We.View,f1:!0,icon:cqo,precondition:joo,toggled:{condition:oTt,tooltip:d(4158,null)},menu:[{id:D.PanelTitle,group:"navigation",order:1,when:joo}]})}run(a){let i=a.get(fi),e=a.get(Ne);if(i.getPanelAlignment()!=="center"&&fV(i.getPanelPosition())){e.warn(d(4164,null));return}i.isVisible("workbench.parts.panel")?i.toggleMaximizedPanel():(i.setPartHidden(!1,"workbench.parts.panel"),i.isPanelMaximized()||i.toggleMaximizedPanel())}});fe.appendMenuItems([{id:D.LayoutControlMenu,item:{group:"2_pane_toggles",command:{id:yue.ID,title:d(4176,null),icon:uqo,toggled:{condition:_Y,icon:dqo}},when:x.and(Xc.negate(),x.or(x.equals("config.workbench.layoutControl.type","toggles"),x.equals("config.workbench.layoutControl.type","both"))),order:1}}]);var z_e=class extends K{constructor(e,t,o){super(o);this.source=e;this.destination=t}run(e,...t){let o=e.get(Ri),n=e.get(fi),r=e.get(Ft),s=o.getViewContainersByLocation(this.source),l=o.getViewContainersByLocation(this.destination);if(s.length){let c=r.getVisibleViewContainer(this.source);s.forEach(u=>o.moveViewContainerToLocation(u,this.destination,void 0,this.desc.id)),n.setPartHidden(!1,this.destination===1?"workbench.parts.panel":"workbench.parts.auxiliarybar"),c&&l.length===0&&r.openViewContainer(c.id,!0)}}},Vvi=class a extends z_e{static{this.ID="workbench.action.movePanelToSidePanel"}constructor(){super(1,2,{id:a.ID,title:L(4160,"Move Panel Views To Secondary Side Bar"),category:We.View,f1:!1})}},Bvi=class a extends z_e{static{this.ID="workbench.action.movePanelToSecondarySideBar"}constructor(){super(1,2,{id:a.ID,title:L(4160,"Move Panel Views To Secondary Side Bar"),category:We.View,f1:!0})}};W(Vvi);W(Bvi);var Hvi=class a extends z_e{static{this.ID="workbench.action.moveSidePanelToPanel"}constructor(){super(2,1,{id:a.ID,title:L(4161,"Move Secondary Side Bar Views To Panel"),category:We.View,f1:!1})}},Uvi=class a extends z_e{static{this.ID="workbench.action.moveSecondarySideBarToPanel"}constructor(){super(2,1,{id:a.ID,title:L(4161,"Move Secondary Side Bar Views To Panel"),category:We.View,f1:!0})}};W(Hvi);W(Uvi);var zvi={},hqo=new vae("quick-input-button-icon-");function gqo(a){if(!a)return;let i,e=a.dark.toString();return zvi[e]?i=zvi[e]:(i=hqo.nextId(),Vh(`.${i}, .hc-light .${i}`,`background-image: ${Na(a.light||a.dark)}`),Vh(`.vs-dark .${i}, .hc-black .${i}`,`background-image: ${Na(a.dark)}`),zvi[e]=i),i}var Kvi=class{constructor(i,e,t,o,n,r,s){this.id=i;this.label=e;this.tooltip=t;this.enabled=n;this._checked=r;this._run=s;this.class=o}get checked(){return this._checked}set checked(i){this._checked=i,this._run()}run(){return this._checked=!this._checked,this._run()}};function Gvi(a,i,e){let t=a.iconClass||gqo(a.iconPath);a.alwaysVisible&&(t=t?`${t} always-visible`:"always-visible");let o=()=>(a.toggle&&(a.toggle.checked=!a.toggle.checked),e());return a.toggle?new Kvi(i,a.tooltip||"","",t,!0,a.toggle.checked,o):{id:i,label:"",tooltip:a.tooltip||"",class:t,enabled:!0,run:o}}function X5(a,i,e){let t=[],o=[];return a.forEach((n,r)=>{let s=Gvi(n,`${i}-${r}`,async()=>e(n));n.label&&(s.label=n.label),n.secondary?o.push(s):t.push(s)}),{primary:t,secondary:o}}function Yoo(a,i,e){Fi(i);let t=lS(a),o=0;for(let n of t.nodes)if(typeof n=="string")i.append(...Bn(n));else{let r=n.title;!r&&n.href.startsWith("command:")?r=d(2249,null,n.href.substring(8)):r||(r=n.href);let s=_("a",{href:n.href,title:r,tabIndex:o++},n.label);s.style.textDecoration="underline";let l=g=>{Zpt(g)&&$t.stop(g,!0),e.callback(n.href)},c=e.disposables.add(new On(s,re.CLICK)).event,u=e.disposables.add(new On(s,re.KEY_DOWN)).event,p=H.chain(u,g=>g.filter(f=>{let v=new Ii(f);return v.equals(10)||v.equals(3)}));e.disposables.add(ws.addTarget(s));let h=e.disposables.add(new On(s,Gn.Tap)).event;H.any(c,h,p)(l,null,e.disposables),i.appendChild(s)}}var Joo="inQuickInput",Zoo=new Q(Joo,!1,d(2229,null)),G_e=x.has(Joo),fqo="quickInputAlignment",tYe=new Q(fqo,"top",d(2233,null)),kJ="quickInputType",eno=new Q(kJ,void 0,d(2235,null)),tno="cursorAtEndOfQuickInputBox",ino=new Q(tno,!1,d(2226,null)),ono=x.has(tno),eOt={iconClass:q.asClassName(M.quickInputBack),tooltip:d(2231,null),handle:-1},CJ=class a extends C{constructor(e){super();this.ui=e;this._visible=Le("visible",!1);this._enabled=!0;this._busy=!1;this._ignoreFocusOut=!1;this._leftButtons=[];this._rightButtons=[];this._inlineButtons=[];this._inputButtons=[];this.buttonsUpdated=!1;this.noValidationMessage=a.noPromptMessage;this._severity=gt.Ignore;this.onDidTriggerButtonEmitter=this._register(new E);this.onDidHideEmitter=this._register(new E);this.onWillHideEmitter=this._register(new E);this.onDisposeEmitter=this._register(new E);this.visibleDisposables=this._register(new P);this.onDidTriggerButton=this.onDidTriggerButtonEmitter.event;this.onDidHide=this.onDidHideEmitter.event;this.onWillHide=this.onWillHideEmitter.event;this.onDispose=this.onDisposeEmitter.event}static{this.noPromptMessage=d(2227,null)}get visible(){return this._visible.get()}get title(){return this._title}set title(e){this._title=e,this.update()}get description(){return this._description}set description(e){this._description=e,this.update()}get step(){return this._steps}set step(e){this._steps=e,this.update()}get totalSteps(){return this._totalSteps}set totalSteps(e){this._totalSteps=e,this.update()}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this.update()}get contextKey(){return this._contextKey}set contextKey(e){this._contextKey=e,this.update()}get busy(){return this._busy}set busy(e){this._busy=e,this.update()}get ignoreFocusOut(){return this._ignoreFocusOut}set ignoreFocusOut(e){let t=this._ignoreFocusOut!==e&&!Nc;this._ignoreFocusOut=e&&!Nc,t&&this.update()}get titleButtons(){return this._leftButtons.length?[...this._leftButtons,this._rightButtons]:this._rightButtons}get buttons(){return[...this._leftButtons,...this._rightButtons,...this._inlineButtons,...this._inputButtons]}set buttons(e){let t=[],o=[],n=[],r=[];for(let s of e)if(s===eOt)t.push(s);else switch(s.location){case 2:n.push(s);break;case 3:r.push(s);break;default:o.push(s);break}this._leftButtons=t,this._rightButtons=o,this._inlineButtons=n,this._inputButtons=r,this.buttonsUpdated=!0,this.update()}get validationMessage(){return this._validationMessage}set validationMessage(e){this._validationMessage=e,this.update()}get severity(){return this._severity}set severity(e){this._severity=e,this.update()}show(){this.visible||(this.visibleDisposables.add(this.ui.onDidTriggerButton(e=>{this.buttons.indexOf(e)!==-1&&this.onDidTriggerButtonEmitter.fire(e)})),this.ui.show(this),this._visible.set(!0,void 0),this._lastValidationMessage=void 0,this._lastSeverity=void 0,this.buttons.length&&(this.buttonsUpdated=!0),this.update())}hide(){this.visible&&this.ui.hide()}didHide(e=3){this._visible.set(!1,void 0),this.visibleDisposables.clear(),this.onDidHideEmitter.fire({reason:e})}willHide(e=3){this.onWillHideEmitter.fire({reason:e})}update(){if(!this.visible)return;let e=this.getTitle();e&&this.ui.title.textContent!==e?this.ui.title.textContent=e:!e&&this.ui.title.innerHTML!==" "&&(this.ui.title.innerText="\xA0");let t=this.getDescription();if(this.ui.description1.textContent!==t&&(this.ui.description1.textContent=t),this.ui.description2.textContent!==t&&(this.ui.description2.textContent=t),this.busy&&!this.busyDelay&&(this.busyDelay=new Nl,this.busyDelay.setIfNotSet(()=>{this.visible&&(this.ui.progressBar.infinite(),this.ui.progressBar.getContainer().removeAttribute("aria-hidden"))},800)),!this.busy&&this.busyDelay&&(this.ui.progressBar.stop(),this.ui.progressBar.getContainer().setAttribute("aria-hidden","true"),this.busyDelay.cancel(),this.busyDelay=void 0),this.buttonsUpdated){this.buttonsUpdated=!1;let n=X5(this._leftButtons,"left-button",c=>this.onDidTriggerButtonEmitter.fire(c));this.ui.leftActionBar.setActions(n.primary,n.secondary);let r=X5(this._rightButtons,"right-button",c=>this.onDidTriggerButtonEmitter.fire(c));this.ui.rightActionBar.setActions(r.primary,r.secondary);let s=X5(this._inlineButtons,"inline-button",c=>this.onDidTriggerButtonEmitter.fire(c));this.ui.inlineActionBar.setActions(s.primary,s.secondary);let l=this._inputButtons.length*22;this.ui.countContainer.style.right=l>0?`${4+l}px`:"4px",this.ui.inputBox.actions=this._inputButtons.map((c,u)=>Gvi(c,`id-${u}`,async()=>this.onDidTriggerButtonEmitter.fire(c)))}this.ui.ignoreFocusOut=this.ignoreFocusOut,this.ui.setEnabled(this.enabled),this.ui.setContextKey(this.contextKey);let o=this.validationMessage||this.noValidationMessage;this._lastValidationMessage!==o&&(this._lastValidationMessage=o,Fi(this.ui.message),o&&Yoo(o,this.ui.message,{callback:n=>{this.ui.linkOpenerDelegate(n)},disposables:this.visibleDisposables})),this._lastSeverity!==this.severity&&(this._lastSeverity=this.severity,this.showMessageDecoration(this.severity))}getTitle(){return this.title&&this.step?`${this.title} (${this.getSteps()})`:this.title?this.title:this.step?this.getSteps():""}getDescription(){return this.description||""}getSteps(){return this.step&&this.totalSteps?d(2232,null,this.step,this.totalSteps):this.step?String(this.step):""}showMessageDecoration(e){if(this.ui.inputBox.showDecoration(e),e!==gt.Ignore){let t=this.ui.inputBox.stylesForType(e);this.ui.message.style.color=t.foreground?`${t.foreground}`:"",this.ui.message.style.backgroundColor=t.background?`${t.background}`:"",this.ui.message.style.border=t.border?`1px solid ${t.border}`:"",this.ui.message.style.marginBottom="-2px"}else this.ui.message.style.color="",this.ui.message.style.backgroundColor="",this.ui.message.style.border="",this.ui.message.style.marginBottom=""}dispose(){this.hide(),this.onDisposeEmitter.fire(),super.dispose()}},xJ=class a extends CJ{constructor(e){super(e);this._value="";this.onDidChangeValueEmitter=this._register(new E);this.onWillAcceptEmitter=this._register(new E);this.onDidAcceptEmitter=this._register(new E);this.onDidCustomEmitter=this._register(new E);this._items=[];this.itemsUpdated=!1;this._canSelectMany=!1;this._canAcceptInBackground=!1;this._matchOnDescription=!1;this._matchOnDetail=!1;this._matchOnLabel=!0;this._matchOnLabelMode="fuzzy";this._sortByLabel=!0;this._keepScrollPosition=!1;this._itemActivation=1;this._activeItems=[];this.activeItemsUpdated=!1;this.activeItemsToConfirm=[];this.onDidChangeActiveEmitter=this._register(new E);this._selectedItems=[];this.selectedItemsUpdated=!1;this.selectedItemsToConfirm=[];this.onDidChangeSelectionEmitter=this._register(new E);this.onDidTriggerItemButtonEmitter=this._register(new E);this.onDidTriggerSeparatorButtonEmitter=this._register(new E);this.valueSelectionUpdated=!0;this._ok="default";this._customButton=!1;this._customButtonSecondary=!1;this._focusEventBufferer=new eN;this.type="quickPick";this.filterValue=e=>e;this.onDidChangeValue=this.onDidChangeValueEmitter.event;this.onWillAccept=this.onWillAcceptEmitter.event;this.onDidAccept=this.onDidAcceptEmitter.event;this.onDidCustom=this.onDidCustomEmitter.event;this.onDidChangeActive=this.onDidChangeActiveEmitter.event;this.onDidChangeSelection=this.onDidChangeSelectionEmitter.event;this.onDidTriggerItemButton=this.onDidTriggerItemButtonEmitter.event;this.onDidTriggerSeparatorButton=this.onDidTriggerSeparatorButtonEmitter.event;this.noValidationMessage=void 0}static{this.DEFAULT_ARIA_LABEL=d(2234,null)}get quickNavigate(){return this._quickNavigate}set quickNavigate(e){this._quickNavigate=e,this.update()}get value(){return this._value}set value(e){this.doSetValue(e)}doSetValue(e,t){this._value!==e&&(this._value=e,t||this.update(),this.visible&&this.ui.list.filter(this.filterValue(this._value))&&this.trySelectFirst(),this.onDidChangeValueEmitter.fire(this._value))}set ariaLabel(e){this._ariaLabel=e,this.update()}get ariaLabel(){return this._ariaLabel}get placeholder(){return this._placeholder}set placeholder(e){this._placeholder=e,this.update()}get prompt(){return this.noValidationMessage}set prompt(e){this.noValidationMessage=e,this.update()}get items(){return this._items}get scrollTop(){return this.ui.list.scrollTop}set scrollTop(e){this.ui.list.scrollTop=e}set items(e){this._items=e,this.itemsUpdated=!0,this.update()}get canSelectMany(){return this._canSelectMany}set canSelectMany(e){this._canSelectMany=e,this.update()}get canAcceptInBackground(){return this._canAcceptInBackground}set canAcceptInBackground(e){this._canAcceptInBackground=e}get matchOnDescription(){return this._matchOnDescription}set matchOnDescription(e){this._matchOnDescription=e,this.update()}get matchOnDetail(){return this._matchOnDetail}set matchOnDetail(e){this._matchOnDetail=e,this.update()}get matchOnLabel(){return this._matchOnLabel}set matchOnLabel(e){this._matchOnLabel=e,this.update()}get matchOnLabelMode(){return this._matchOnLabelMode}set matchOnLabelMode(e){this._matchOnLabelMode=e,this.update()}get sortByLabel(){return this._sortByLabel}set sortByLabel(e){this._sortByLabel=e,this.update()}get keepScrollPosition(){return this._keepScrollPosition}set keepScrollPosition(e){this._keepScrollPosition=e}get itemActivation(){return this._itemActivation}set itemActivation(e){this._itemActivation=e}get activeItems(){return this._activeItems}set activeItems(e){this._activeItems=e,this.activeItemsUpdated=!0,this.update()}get selectedItems(){return this._selectedItems}set selectedItems(e){this._selectedItems=e,this.selectedItemsUpdated=!0,this.update()}get keyMods(){return this._quickNavigate?A4i:this.ui.keyMods}get valueSelection(){let e=this.ui.inputBox.getSelection();if(e)return[e.start,e.end]}set valueSelection(e){this._valueSelection=e,this.valueSelectionUpdated=!0,this.update()}get customButton(){return this._customButton}set customButton(e){this._customButton=e,this.update()}get customLabel(){return this._customButtonLabel}set customLabel(e){this._customButtonLabel=e,this.update()}get customHover(){return this._customButtonHover}set customHover(e){this._customButtonHover=e,this.update()}get customButtonSecondary(){return this._customButtonSecondary}set customButtonSecondary(e){this._customButtonSecondary=e??!1,this.update()}get ok(){return this._ok}set ok(e){this._ok=e,this.update()}get okLabel(){return this._okLabel??d(2230,null)}set okLabel(e){this._okLabel=e,this.update()}inputHasFocus(){return this.visible?this.ui.inputBox.hasFocus():!1}focusOnInput(){this.ui.inputBox.setFocus()}get hideInput(){return!!this._hideInput}set hideInput(e){this._hideInput=e,this.update()}get hideCountBadge(){return!!this._hideCountBadge}set hideCountBadge(e){this._hideCountBadge=e,this.update()}get hideCheckAll(){return!!this._hideCheckAll}set hideCheckAll(e){this._hideCheckAll=e,this.update()}trySelectFirst(){this.canSelectMany||this.ui.list.focus(1)}show(){this.visible||(this.visibleDisposables.add(this.ui.inputBox.onDidChange(e=>{this.doSetValue(e,!0)})),this.visibleDisposables.add(this.ui.onDidAccept(()=>{this.canSelectMany?this.ui.list.getCheckedElements().length||(this._selectedItems=[],this.onDidChangeSelectionEmitter.fire(this.selectedItems)):this.activeItems[0]&&(this._selectedItems=[this.activeItems[0]],this.onDidChangeSelectionEmitter.fire(this.selectedItems)),this.handleAccept(!1)})),this.visibleDisposables.add(this.ui.onDidCustom(()=>{this.onDidCustomEmitter.fire()})),this.visibleDisposables.add(this._focusEventBufferer.wrapEvent(this.ui.list.onDidChangeFocus,(e,t)=>t)(e=>{this.activeItemsUpdated||this.activeItemsToConfirm!==this._activeItems&&$i(e,this._activeItems,(t,o)=>t===o)||(this._activeItems=e,this.onDidChangeActiveEmitter.fire(e))})),this.visibleDisposables.add(this.ui.list.onDidChangeSelection(({items:e,event:t})=>{if(this.canSelectMany&&!e.some(o=>o.pickable===!1)){e.length&&this.ui.list.setSelectedElements([]);return}this.selectedItemsToConfirm!==this._selectedItems&&$i(e,this._selectedItems,(o,n)=>o===n)||(this._selectedItems=e,this.onDidChangeSelectionEmitter.fire(e),e.length&&this.handleAccept(Vp(t)&&t.button===1))})),this.visibleDisposables.add(this.ui.list.onChangedCheckedElements(e=>{!this.canSelectMany||!this.visible||this.selectedItemsToConfirm!==this._selectedItems&&$i(e,this._selectedItems,(t,o)=>t===o)||(this._selectedItems=e,this.onDidChangeSelectionEmitter.fire(e))})),this.visibleDisposables.add(this.ui.list.onButtonTriggered(e=>this.onDidTriggerItemButtonEmitter.fire(e))),this.visibleDisposables.add(this.ui.list.onSeparatorButtonTriggered(e=>this.onDidTriggerSeparatorButtonEmitter.fire(e))),this.visibleDisposables.add(this.registerQuickNavigation()),this.valueSelectionUpdated=!0),super.show()}handleAccept(e){let t=!1;this.onWillAcceptEmitter.fire({veto:()=>t=!0}),t||this.onDidAcceptEmitter.fire({inBackground:e})}registerQuickNavigation(){return j(this.ui.container,re.KEY_UP,e=>{if(this.canSelectMany||!this._quickNavigate)return;let t=new Ii(e),o=t.keyCode;this._quickNavigate.keybindings.some(s=>{let l=s.getChords();return l.length>1?!1:l[0].shiftKey&&o===4?!(t.ctrlKey||t.altKey||t.metaKey):!!(l[0].altKey&&o===6||l[0].ctrlKey&&o===5||l[0].metaKey&&o===57)})&&(this.activeItems[0]&&(this._selectedItems=[this.activeItems[0]],this.onDidChangeSelectionEmitter.fire(this.selectedItems),this.handleAccept(!1)),this._quickNavigate=void 0)})}update(){if(!this.visible)return;let e=this.keepScrollPosition?this.scrollTop:0,t=!!this.description,o={title:!!this.title||!!this.step||!!this.titleButtons.length,description:t,checkAll:this.canSelectMany&&!this._hideCheckAll,checkBox:this.canSelectMany,inputBox:!this._hideInput,progressBar:!this._hideInput||t,visibleCount:!0,count:this.canSelectMany&&!this._hideCountBadge,ok:this.ok==="default"?this.canSelectMany:this.ok,list:!0,message:!!this.validationMessage||!!this.prompt,customButton:this.customButton};this.ui.setVisibilities(o),super.update(),this.ui.inputBox.value!==this.value&&(this.ui.inputBox.value=this.value),this.valueSelectionUpdated&&(this.valueSelectionUpdated=!1,this.ui.inputBox.select(this._valueSelection&&{start:this._valueSelection[0],end:this._valueSelection[1]})),this.ui.inputBox.placeholder!==(this.placeholder||"")&&(this.ui.inputBox.placeholder=this.placeholder||"");let n=this.ariaLabel;!n&&o.inputBox&&(n=this.placeholder,this.title&&(n=n?`${n} - ${this.title}`:this.title),n||(n=a.DEFAULT_ARIA_LABEL)),this.ui.list.ariaLabel!==n&&(this.ui.list.ariaLabel=n??null),this.ui.inputBox.ariaLabel!==n&&(this.ui.inputBox.ariaLabel=n??"input"),this.ui.list.matchOnDescription=this.matchOnDescription,this.ui.list.matchOnDetail=this.matchOnDetail,this.ui.list.matchOnLabel=this.matchOnLabel,this.ui.list.matchOnLabelMode=this.matchOnLabelMode,this.ui.list.sortByLabel=this.sortByLabel,this.itemsUpdated&&(this.itemsUpdated=!1,this._focusEventBufferer.bufferEvents(()=>{switch(this.ui.list.setElements(this.items),this.ui.list.shouldLoop=!this.canSelectMany,this.ui.list.filter(this.filterValue(this.ui.inputBox.value)),this._itemActivation){case 0:this._itemActivation=1;break;case 2:this.ui.list.focus(2),this._itemActivation=1;break;case 3:this.ui.list.focus(3),this._itemActivation=1;break;default:this.trySelectFirst();break}})),this.ui.container.classList.contains("show-checkboxes")!==!!this.canSelectMany&&(this.canSelectMany?this.ui.list.clearFocus():this.trySelectFirst()),this.activeItemsUpdated&&(this.activeItemsUpdated=!1,this.activeItemsToConfirm=this._activeItems,this.ui.list.setFocusedElements(this.activeItems),this.activeItemsToConfirm===this._activeItems&&(this.activeItemsToConfirm=null)),this.selectedItemsUpdated&&(this.selectedItemsUpdated=!1,this.selectedItemsToConfirm=this._selectedItems,this.canSelectMany?this.ui.list.setCheckedElements(this.selectedItems):this.ui.list.setSelectedElements(this.selectedItems),this.selectedItemsToConfirm===this._selectedItems&&(this.selectedItemsToConfirm=null)),this.ui.ok.label=this.okLabel||"",this.ui.customButton.label=this.customLabel||"",this.ui.customButton.element.title=this.customHover||"",this.ui.customButton.secondary=this.customButtonSecondary||!1,o.inputBox||(this.ui.list.domFocus(),this.canSelectMany&&this.ui.list.focus(1)),this.keepScrollPosition&&(this.scrollTop=e)}focus(e){this.ui.list.focus(e),this.canSelectMany&&this.ui.list.domFocus()}accept(e){e&&!this._canAcceptInBackground||(this.activeItems[0]&&!this._canSelectMany&&(this._selectedItems=[this.activeItems[0]],this.onDidChangeSelectionEmitter.fire(this.selectedItems)),this.handleAccept(e??!1))}},XNt=class extends CJ{constructor(){super(...arguments);this._value="";this.valueSelectionUpdated=!0;this._password=!1;this.onDidValueChangeEmitter=this._register(new E);this.onDidAcceptEmitter=this._register(new E);this.type="inputBox";this.onDidChangeValue=this.onDidValueChangeEmitter.event;this.onDidAccept=this.onDidAcceptEmitter.event}get value(){return this._value}set value(e){this._value=e||"",this.update()}get valueSelection(){let e=this.ui.inputBox.getSelection();if(e)return[e.start,e.end]}set valueSelection(e){this._valueSelection=e,this.valueSelectionUpdated=!0,this.update()}get placeholder(){return this._placeholder}set placeholder(e){this._placeholder=e,this.update()}get ariaLabel(){return this._ariaLabel}set ariaLabel(e){this._ariaLabel=e,this.update()}get password(){return this._password}set password(e){this._password=e,this.update()}get prompt(){return this._prompt}set prompt(e){this._prompt=e,this.noValidationMessage=e?d(2228,null,e):CJ.noPromptMessage,this.update()}show(){this.visible||(this.visibleDisposables.add(this.ui.inputBox.onDidChange(e=>{e!==this.value&&(this._value=e,this.onDidValueChangeEmitter.fire(e))})),this.visibleDisposables.add(this.ui.onDidAccept(()=>this.onDidAcceptEmitter.fire())),this.valueSelectionUpdated=!0),super.show()}accept(){this.onDidAcceptEmitter.fire()}update(){if(!this.visible)return;this.ui.container.classList.remove("hidden-input");let e={title:!!this.title||!!this.step||!!this.titleButtons.length,description:!!this.description||!!this.step,inputBox:!0,message:!0,progressBar:!0};this.ui.setVisibilities(e),super.update(),this.ui.inputBox.value!==this.value&&(this.ui.inputBox.value=this.value),this.valueSelectionUpdated&&(this.valueSelectionUpdated=!1,this.ui.inputBox.select(this._valueSelection&&{start:this._valueSelection[0],end:this._valueSelection[1]})),this.ui.inputBox.placeholder!==(this.placeholder||"")&&(this.ui.inputBox.placeholder=this.placeholder||""),this.ui.inputBox.password!==this.password&&(this.ui.inputBox.password=this.password);let t=this.ariaLabel;!t&&e.inputBox&&(t=this.placeholder?this.title?`${this.placeholder} - ${this.title}`:this.placeholder:this.title?this.title:"input"),this.ui.inputBox.ariaLabel!==t&&(this.ui.inputBox.ariaLabel=t||"input")}},JNt=class extends CJ{constructor(){super(...arguments);this.type="quickWidget";this._widgetUpdated=!1}get widget(){return this._widget}set widget(e){this._widget!==e&&(this._widget=e,this._widgetUpdated=!0,this.update())}update(){this.visible&&(this.ui.setVisibilities({title:!!this.title||!!this.step||!!this.titleButtons.length,description:!!this.description||!!this.step}),this._widgetUpdated&&(this._widgetUpdated=!1,this._widget?Fi(this.ui.widget,this._widget):Fi(this.ui.widget)),super.update())}},K_e=class extends mv{constructor(i,e){super("mouse",void 0,t=>this.getOverrideOptions(t),i,e)}getOverrideOptions(i){let e=(Ao(i.content)?i.content.textContent??"":typeof i.content=="string"?i.content:i.content.value).includes(`
`);return{persistence:{hideOnKeyDown:!1},appearance:{showHoverHint:e,skipFadeInAnimation:!0}}}};K_e=I([m(0,B),m(1,tt)],K_e);var vqo=Re("menuBar",M.layoutMenubar,d(3323,null)),bqo=Re("activity-bar-left",M.layoutActivitybarLeft,d(3287,null)),Sqo=Re("activity-bar-right",M.layoutActivitybarRight,d(3288,null)),tOt=Re("panel-left",M.layoutSidebarLeft,d(3364,null)),Iqo=Re("panel-left-off",M.layoutSidebarLeftOff,d(3365,null)),iOt=Re("panel-right",M.layoutSidebarRight,d(3366,null)),yqo=Re("panel-right-off",M.layoutSidebarRightOff,d(3367,null)),wqo=Re("panel-bottom",M.layoutPanel,d(3358,null)),Cqo=Re("statusBar",M.layoutStatusbar,d(3400,null)),xqo=Re("panel-align-left",M.layoutPanelLeft,d(3361,null)),kqo=Re("panel-align-right",M.layoutPanelRight,d(3362,null)),Eqo=Re("panel-align-center",M.layoutPanelCenter,d(3359,null)),Tqo=Re("panel-align-justify",M.layoutPanelJustify,d(3360,null)),_qo=Re("quickInputAlignmentTop",M.arrowUp,d(3371,null)),Dqo=Re("quickInputAlignmentCenter",M.circle,d(3370,null)),Lqo=Re("fullscreen",M.screenFull,d(3308,null)),Rqo=Re("centerLayoutIcon",M.layoutCentered,d(3293,null)),Mqo=Re("zenMode",M.target,d(3416,null)),Pqo="workbench.action.toggleActivityBarVisibility";W(class extends K{constructor(){super({id:"workbench.action.toggleCenteredLayout",title:{...L(3402,"Toggle Centered Layout"),mnemonicTitle:d(3331,null)},precondition:sw.toNegated(),category:We.View,f1:!0,toggled:P8e,menu:[{id:D.MenubarAppearanceMenu,group:"1_toggle_view",order:3}]})}run(a){let i=a.get(fi),e=a.get(Et);i.centerMainEditorLayout(!i.isMainEditorLayoutCentered()),e.activeGroup.focus()}});var nno="workbench.sideBar.location",oOt=class extends K{constructor(e,t,o){super({id:e,title:t,f1:!1});this.position=o}async run(e){let t=e.get(fi),o=e.get(B);if(t.getSideBarPosition()!==this.position)return o.updateValue(nno,KO(this.position))}},nOt=class a extends oOt{static{this.ID="workbench.action.moveSideBarRight"}constructor(){super(a.ID,L(3352,"Move Primary Side Bar Right"),1)}},rOt=class a extends oOt{static{this.ID="workbench.action.moveSideBarLeft"}constructor(){super(a.ID,L(3350,"Move Primary Side Bar Left"),0)}};W(nOt);W(rOt);var J5=class a extends K{static{this.ID="workbench.action.toggleSidebarPosition"}static{this.LABEL=d(3409,null)}static getLabel(i){return i.getSideBarPosition()===0?d(3353,null):d(3351,null)}constructor(){super({id:a.ID,title:L(3410,"Toggle Primary Side Bar Position"),category:We.View,f1:!0})}run(i){let e=i.get(fi),t=i.get(B),n=e.getSideBarPosition()===0?"right":"left";return t.updateValue(nno,n)}};W(J5);var rno=Re("configure-layout-icon",M.layout,d(3296,null));fe.appendMenuItem(D.LayoutControlMenu,{submenu:D.LayoutControlMenuSubmenu,title:d(3299,null),icon:rno,group:"1_workbench_layout",when:x.and(Xc.negate(),x.equals("config.workbench.layoutControl.type","menu"))});fe.appendMenuItems([{id:D.ViewContainerTitleContext,item:{group:"3_workbench_layout_move",command:{id:J5.ID,title:d(3335,null)},when:x.and(x.notEquals("config.workbench.sideBar.location","right"),x.equals("viewContainerLocation",WE(0))),order:1}},{id:D.ViewContainerTitleContext,item:{group:"3_workbench_layout_move",command:{id:J5.ID,title:d(3336,null)},when:x.and(x.equals("config.workbench.sideBar.location","right"),x.equals("viewContainerLocation",WE(0))),order:1}},{id:D.ViewContainerTitleContext,item:{group:"3_workbench_layout_move",command:{id:J5.ID,title:d(3333,null)},when:x.and(x.notEquals("config.workbench.sideBar.location","right"),x.equals("viewContainerLocation",WE(2))),order:1}},{id:D.ViewContainerTitleContext,item:{group:"3_workbench_layout_move",command:{id:J5.ID,title:d(3334,null)},when:x.and(x.equals("config.workbench.sideBar.location","right"),x.equals("viewContainerLocation",WE(2))),order:1}}]);fe.appendMenuItem(D.MenubarAppearanceMenu,{group:"3_workbench_layout_move",command:{id:J5.ID,title:d(3328,null)},when:x.notEquals("config.workbench.sideBar.location","right"),order:2});fe.appendMenuItem(D.MenubarAppearanceMenu,{group:"3_workbench_layout_move",command:{id:J5.ID,title:d(3327,null)},when:x.equals("config.workbench.sideBar.location","right"),order:2});W(class extends K{constructor(){super({id:"workbench.action.toggleEditorVisibility",title:{...L(3403,"Toggle Editor Area Visibility"),mnemonicTitle:d(3329,null)},category:We.View,f1:!0,toggled:iTt,precondition:x.and(sw.toNegated(),x.or(cV.isEqualTo("center"),TY.notEqualsTo("bottom")))})}run(a){a.get(fi).toggleMaximizedPanel()}});fe.appendMenuItem(D.MenubarViewMenu,{group:"2_appearance",title:d(3324,null),submenu:D.MenubarAppearanceMenu,order:1});var wue=class a extends K{static{this.ID="workbench.action.toggleSidebarVisibility"}static{this.LABEL=d(3297,null)}constructor(){super({id:a.ID,title:L(3407,"Toggle Primary Side Bar Visibility"),toggled:{condition:cP,title:d(3368,null),mnemonicTitle:d(3369,null)},metadata:{description:d(3355,null)},category:We.View,f1:!0,keybinding:{weight:200,primary:2080},menu:[{id:D.LayoutControlMenuSubmenu,group:"0_workbench_layout",order:0},{id:D.MenubarAppearanceMenu,group:"2_workbench_layout",order:1}]})}run(i){let e=i.get(fi),t=e.isVisible("workbench.parts.sidebar");e.setPartHidden(t,"workbench.parts.sidebar");let o=t?d(3396,null):d(3398,null);Jo(o)}};W(wue);fe.appendMenuItems([{id:D.ViewContainerTitleContext,item:{group:"3_workbench_layout_move",command:{id:wue.ID,title:d(3297,null)},when:x.and(cP,x.equals("viewContainerLocation",WE(0))),order:2}},{id:D.LayoutControlMenu,item:{group:"2_pane_toggles",command:{id:wue.ID,title:d(3408,null),icon:Iqo,toggled:{condition:cP,icon:tOt}},when:x.and(Xc.negate(),x.or(x.equals("config.workbench.layoutControl.type","toggles"),x.equals("config.workbench.layoutControl.type","both")),x.equals("config.workbench.sideBar.location","left")),order:0}},{id:D.LayoutControlMenu,item:{group:"2_pane_toggles",command:{id:wue.ID,title:d(3408,null),icon:yqo,toggled:{condition:cP,icon:iOt}},when:x.and(Xc.negate(),x.or(x.equals("config.workbench.layoutControl.type","toggles"),x.equals("config.workbench.layoutControl.type","both")),x.equals("config.workbench.sideBar.location","right")),order:2}}]);var Cue=class a extends K{static{this.ID="workbench.action.toggleStatusbarVisibility"}static{this.statusbarVisibleKey="workbench.statusBar.visible"}constructor(){super({id:a.ID,title:{...L(3411,"Toggle Status Bar Visibility"),mnemonicTitle:d(3330,null)},category:We.View,f1:!0,toggled:x.equals("config.workbench.statusBar.visible",!0),menu:[{id:D.MenubarAppearanceMenu,group:"2_workbench_layout",order:3}]})}run(i){let e=i.get(fi),t=i.get(B),n=!e.isVisible("workbench.parts.statusbar",It);return t.updateValue(a.statusbarVisibleKey,n)}};W(Cue);var EJ=class extends K{constructor(e,t,o,n,r,s){super({id:n,title:o,category:We.View,precondition:r,metadata:s?{description:s}:void 0,f1:!0});this.settingName=e;this.value=t}run(e){return e.get(B).updateValue(this.settingName,this.value)}},iYe=class a extends EJ{static{this.ID="workbench.action.hideEditorTabs"}constructor(){let i=x.and(x.equals("config.workbench.editor.showTabs","none").negate(),gC.negate()),e=L(3311,"Hide Editor Tabs");super("workbench.editor.showTabs","none",e,a.ID,i,L(3312,"Hide Tab Bar"))}},oYe=class a extends EJ{static{this.ID="workbench.action.zenHideEditorTabs"}constructor(){let i=x.and(x.equals("config.zenMode.showTabs","none").negate(),gC),e=L(3313,"Hide Editor Tabs in Zen Mode");super("zenMode.showTabs","none",e,a.ID,i,L(3314,"Hide Tab Bar in Zen Mode"))}},nYe=class a extends EJ{static{this.ID="workbench.action.showMultipleEditorTabs"}constructor(){let i=x.and(x.equals("config.workbench.editor.showTabs","multiple").negate(),gC.negate()),e=L(3385,"Show Multiple Editor Tabs");super("workbench.editor.showTabs","multiple",e,a.ID,i,L(3386,"Show Tab Bar with multiple tabs"))}},rYe=class a extends EJ{static{this.ID="workbench.action.zenShowMultipleEditorTabs"}constructor(){let i=x.and(x.equals("config.zenMode.showTabs","multiple").negate(),gC),e=L(3387,"Show Multiple Editor Tabs in Zen Mode");super("zenMode.showTabs","multiple",e,a.ID,i,L(3388,"Show Tab Bar in Zen Mode"))}},sYe=class a extends EJ{static{this.ID="workbench.action.showEditorTab"}constructor(){let i=x.and(x.equals("config.workbench.editor.showTabs","single").negate(),gC.negate()),e=L(3389,"Show Single Editor Tab");super("workbench.editor.showTabs","single",e,a.ID,i,L(3390,"Show Tab Bar with one Tab"))}},aYe=class a extends EJ{static{this.ID="workbench.action.zenShowEditorTab"}constructor(){let i=x.and(x.equals("config.zenMode.showTabs","single").negate(),gC),e=L(3391,"Show Single Editor Tab in Zen Mode");super("zenMode.showTabs","single",e,a.ID,i,L(3392,"Show Tab Bar in Zen Mode with one Tab"))}};W(iYe);W(oYe);W(nYe);W(rYe);W(sYe);W(aYe);fe.appendMenuItem(D.MenubarAppearanceMenu,{submenu:D.EditorTabsBarShowTabsSubmenu,title:d(3401,null),group:"3_workbench_layout_move",order:10,when:gC.negate()});fe.appendMenuItem(D.MenubarAppearanceMenu,{submenu:D.EditorTabsBarShowTabsZenModeSubmenu,title:d(3401,null),group:"3_workbench_layout_move",order:10,when:gC});var lYe=class a extends K{static{this.ID="workbench.action.editorActionsTitleBar"}constructor(){super({id:a.ID,title:L(3339,"Move Editor Actions to Title Bar"),category:We.View,precondition:x.equals("config.workbench.editor.editorActionsLocation","titleBar").negate(),metadata:{description:L(3340,"Move Editor Actions from the tab bar to the title bar")},f1:!0})}run(i){return i.get(B).updateValue("workbench.editor.editorActionsLocation","titleBar")}};W(lYe);var cYe=class a extends K{static{this.ID="workbench.action.editorActionsDefault"}constructor(){super({id:a.ID,title:L(3337,"Move Editor Actions to Tab Bar"),category:We.View,precondition:x.and(x.equals("config.workbench.editor.editorActionsLocation","default").negate(),x.equals("config.workbench.editor.showTabs","none").negate()),metadata:{description:L(3338,"Move Editor Actions from the title bar to the tab bar")},f1:!0})}run(i){return i.get(B).updateValue("workbench.editor.editorActionsLocation","default")}};W(cYe);var dYe=class a extends K{static{this.ID="workbench.action.hideEditorActions"}constructor(){super({id:a.ID,title:L(3309,"Hide Editor Actions"),category:We.View,precondition:x.equals("config.workbench.editor.editorActionsLocation","hidden").negate(),metadata:{description:L(3310,"Hide Editor Actions in the tab and title bar")},f1:!0})}run(i){return i.get(B).updateValue("workbench.editor.editorActionsLocation","hidden")}};W(dYe);var $vi=class a extends K{static{this.ID="workbench.action.showEditorActions"}constructor(){super({id:a.ID,title:L(3383,"Show Editor Actions"),category:We.View,precondition:x.equals("config.workbench.editor.editorActionsLocation","hidden"),metadata:{description:L(3384,"Make Editor Actions visible.")},f1:!0})}run(i){return i.get(B).updateValue("workbench.editor.editorActionsLocation","default")}};W($vi);fe.appendMenuItem(D.MenubarAppearanceMenu,{submenu:D.EditorActionsPositionSubmenu,title:d(3306,null),group:"3_workbench_layout_move",order:11});var uYe=class a extends K{static{this.ID="workbench.action.configureEditorTabs"}constructor(){super({id:a.ID,title:L(3300,"Configure Tabs"),category:We.View})}run(i){i.get(Po).openSettings({jsonEditor:!1,query:"workbench.editor tab"})}};W(uYe);var pYe=class a extends K{static{this.ID="workbench.action.configureEditor"}constructor(){super({id:a.ID,title:L(3298,"Configure Editors"),category:We.View})}run(i){i.get(Po).openSettings({jsonEditor:!1,query:"workbench.editor"})}};W(pYe);W(class extends K{constructor(){super({id:"workbench.action.toggleSeparatePinnedEditorTabs",title:L(3405,"Separate Pinned Editor Tabs"),category:We.View,precondition:x.equals("config.workbench.editor.showTabs","multiple"),metadata:{description:L(3406,"Toggle whether pinned editor tabs are shown on a separate row above unpinned tabs.")},f1:!0})}run(a){let i=a.get(B),t=!i.getValue("workbench.editor.pinnedTabsOnSeparateRow");return i.updateValue("workbench.editor.pinnedTabsOnSeparateRow",t)}});W(class extends K{constructor(){super({id:"workbench.action.toggleZenMode",title:{...L(3413,"Toggle Zen Mode"),mnemonicTitle:d(3332,null)},precondition:sw.toNegated(),category:We.View,f1:!0,keybinding:{weight:200,primary:Ai(2089,56)},toggled:gC,menu:[{id:D.MenubarAppearanceMenu,group:"1_toggle_view",order:2}]})}run(a){return a.get(fi).toggleZenMode()}});yt.registerCommandAndKeybindingRule({id:"workbench.action.exitZenMode",weight:-900,handler(a){let i=a.get(fi),e=a.get(X);gC.getValue(e)&&i.toggleZenMode()},when:gC,primary:Ai(9,9)});if(ri||Wn||Gt){W(class extends K{constructor(){super({id:"workbench.action.toggleMenuBar",title:{...L(3404,"Toggle Menu Bar"),mnemonicTitle:d(3325,null)},category:We.View,f1:!0,toggled:x.and(Mx.toNegated(),x.notEquals("config.window.menuBarVisibility","hidden"),x.notEquals("config.window.menuBarVisibility","toggle"),x.notEquals("config.window.menuBarVisibility","compact")),menu:[{id:D.MenubarAppearanceMenu,group:"2_workbench_layout",order:0}]})}run(i){return i.get(fi).toggleMenuBar()}});for(let a of[D.TitleBarContext,D.TitleBarTitleContext])fe.appendMenuItem(a,{command:{id:"workbench.action.toggleMenuBar",title:d(3326,null),toggled:x.and(Mx.toNegated(),x.notEquals("config.window.menuBarVisibility","hidden"),x.notEquals("config.window.menuBarVisibility","toggle"),x.notEquals("config.window.menuBarVisibility","compact"))},when:x.and(sw.toNegated(),x.notEquals(EY.key,"native"),lP.negate()),group:"2_config",order:0})}W(class extends K{constructor(){super({id:"workbench.action.resetViewLocations",title:L(3375,"Reset View Locations"),category:We.View,f1:!0})}run(a){return a.get(Ri).reset()}});W(class extends K{constructor(){super({id:"workbench.action.moveView",title:L(3354,"Move View"),category:We.View,f1:!0})}async run(a){let i=a.get(Ri),e=a.get(F),t=a.get(Ge),o=a.get(X),n=a.get(ds),r=Vl.getValue(o),s;r&&i.getViewDescriptorById(r)?.canMoveView&&(s=r);try{if(s=await this.getView(t,i,n,s),!s)return;let l=new sOt;e.invokeFunction(c=>l.run(c,s))}catch{}}getViewItems(a,i){let e=[];return i.getVisiblePaneCompositeIds(0).forEach(r=>{let s=a.getViewContainerById(r),l=a.getViewContainerModel(s),c=!1;l.visibleViewDescriptors.forEach(u=>{u.canMoveView&&(c||(e.push({type:"separator",label:d(3395,null,l.title)}),c=!0),e.push({id:u.id,label:u.name.value}))})}),i.getPinnedPaneCompositeIds(1).forEach(r=>{let s=a.getViewContainerById(r),l=a.getViewContainerModel(s),c=!1;l.visibleViewDescriptors.forEach(u=>{u.canMoveView&&(c||(e.push({type:"separator",label:d(3363,null,l.title)}),c=!0),e.push({id:u.id,label:u.name.value}))})}),i.getPinnedPaneCompositeIds(2).forEach(r=>{let s=a.getViewContainerById(r),l=a.getViewContainerModel(s),c=!1;l.visibleViewDescriptors.forEach(u=>{u.canMoveView&&(c||(e.push({type:"separator",label:d(3380,null,l.title)}),c=!0),e.push({id:u.id,label:u.name.value}))})}),e}async getView(a,i,e,t){let o=new P,n=o.add(a.createQuickPick({useSeparators:!0}));return n.placeholder=d(3348,null),n.items=this.getViewItems(i,e),n.selectedItems=n.items.filter(r=>r.id===t),new Promise((r,s)=>{o.add(n.onDidAccept(()=>{let l=n.selectedItems[0];l.id?r(l.id):s(),n.hide()})),o.add(n.onDidHide(()=>{o.dispose(),s()})),n.show()})}});var sOt=class extends K{constructor(){super({id:"workbench.action.moveFocusedView",title:L(3341,"Move Focused View"),category:We.View,precondition:Vl.notEqualsTo(""),f1:!0})}run(i,e){let t=i.get(Ri),o=i.get(Ft),n=i.get(Ge),r=i.get(X),s=i.get(ct),l=i.get(ds),c=e||Vl.getValue(r);if(c===void 0||c.trim()===""){s.error(d(3342,null));return}let u=t.getViewDescriptorById(c);if(!u?.canMoveView){s.error(d(3343,null));return}let p=new P,h=p.add(n.createQuickPick({useSeparators:!0}));h.placeholder=d(3347,null),h.title=d(3349,null,u.name.value);let g=[],f=t.getViewContainerByViewId(c),v=t.getViewLocationById(c),b=t.getViewContainerModel(f).allViewDescriptors.length===1;b&&v===1||g.push({id:"_.panel.newcontainer",label:d(3344,null)}),b&&v===0||g.push({id:"_.sidebar.newcontainer",label:d(3345,null)}),b&&v===2||g.push({id:"_.auxiliarybar.newcontainer",label:d(3346,null)}),g.push({type:"separator",label:d(3393,null)});let S=l.getVisiblePaneCompositeIds(0);g.push(...S.filter(k=>k===t.getViewContainerByViewId(c).id?!1:!t.getViewContainerById(k).rejectAddedViews).map(k=>({id:k,label:t.getViewContainerModel(t.getViewContainerById(k)).title}))),g.push({type:"separator",label:d(3356,null)});let y=l.getPinnedPaneCompositeIds(1);g.push(...y.filter(k=>k===t.getViewContainerByViewId(c).id?!1:!t.getViewContainerById(k).rejectAddedViews).map(k=>({id:k,label:t.getViewContainerModel(t.getViewContainerById(k)).title}))),g.push({type:"separator",label:d(3379,null)});let w=l.getPinnedPaneCompositeIds(2);g.push(...w.filter(k=>k===t.getViewContainerByViewId(c).id?!1:!t.getViewContainerById(k).rejectAddedViews).map(k=>({id:k,label:t.getViewContainerModel(t.getViewContainerById(k)).title}))),h.items=g,p.add(h.onDidAccept(()=>{let k=h.selectedItems[0];k.id==="_.panel.newcontainer"?(t.moveViewToLocation(u,1,this.desc.id),o.openView(c,!0)):k.id==="_.sidebar.newcontainer"?(t.moveViewToLocation(u,0,this.desc.id),o.openView(c,!0)):k.id==="_.auxiliarybar.newcontainer"?(t.moveViewToLocation(u,2,this.desc.id),o.openView(c,!0)):k.id&&(t.moveViewsToContainer([u],t.getViewContainerById(k.id),void 0,this.desc.id),o.openView(c,!0)),h.hide()})),p.add(h.onDidHide(()=>p.dispose())),h.show()}};W(sOt);W(class extends K{constructor(){super({id:"workbench.action.resetFocusedViewLocation",title:L(3374,"Reset Focused View Location"),category:We.View,f1:!0,precondition:Vl.notEqualsTo("")})}run(a){let i=a.get(Ri),e=a.get(X),t=a.get(ct),o=a.get(Ft),n=Vl.getValue(e),r=null;if(n!==void 0&&n.trim()!==""&&(r=i.getViewDescriptorById(n)),!r){t.error(d(3373,null));return}let s=i.getDefaultContainerById(r.id);!s||s===i.getViewContainerByViewId(r.id)||(i.moveViewsToContainer([r],s,void 0,this.desc.id),o.openView(r.id,!0))}});var YE=class extends K{static{this.RESIZE_INCREMENT=60}resizePart(i,e,t,o){if(t.activeContainer!==t.mainContainer)return;let n;if(o===void 0){let r=t.hasFocus("workbench.parts.editor"),s=t.hasFocus("workbench.parts.sidebar"),l=t.hasFocus("workbench.parts.panel"),c=t.hasFocus("workbench.parts.auxiliarybar");s?n="workbench.parts.sidebar":l?n="workbench.parts.panel":r?n="workbench.parts.editor":c&&(n="workbench.parts.auxiliarybar")}else n=o;n&&t.resizePart(n,i,e)}},qvi=class extends YE{constructor(){super({id:"workbench.action.increaseViewSize",title:L(3317,"Increase Current View Size"),f1:!0,precondition:sw.toNegated()})}run(i){this.resizePart(YE.RESIZE_INCREMENT,YE.RESIZE_INCREMENT,i.get(fi))}},jvi=class extends YE{constructor(){super({id:"workbench.action.increaseViewWidth",title:L(3316,"Increase Editor Width"),f1:!0,precondition:sw.toNegated()})}run(i){this.resizePart(YE.RESIZE_INCREMENT,0,i.get(fi),"workbench.parts.editor")}},Qvi=class extends YE{constructor(){super({id:"workbench.action.increaseViewHeight",title:L(3315,"Increase Editor Height"),f1:!0,precondition:sw.toNegated()})}run(i){this.resizePart(0,YE.RESIZE_INCREMENT,i.get(fi),"workbench.parts.editor")}},Yvi=class extends YE{constructor(){super({id:"workbench.action.decreaseViewSize",title:L(3305,"Decrease Current View Size"),f1:!0,precondition:sw.toNegated()})}run(i){this.resizePart(-YE.RESIZE_INCREMENT,-YE.RESIZE_INCREMENT,i.get(fi))}},Xvi=class extends YE{constructor(){super({id:"workbench.action.decreaseViewWidth",title:L(3304,"Decrease Editor Width"),f1:!0,precondition:sw.toNegated()})}run(i){this.resizePart(-YE.RESIZE_INCREMENT,0,i.get(fi),"workbench.parts.editor")}},Jvi=class extends YE{constructor(){super({id:"workbench.action.decreaseViewHeight",title:L(3303,"Decrease Editor Height"),f1:!0,precondition:sw.toNegated()})}run(i){this.resizePart(0,-YE.RESIZE_INCREMENT,i.get(fi),"workbench.parts.editor")}};W(qvi);W(jvi);W(Qvi);W(Yvi);W(Xvi);W(Jvi);W(class extends K{constructor(){super({id:"workbench.action.alignQuickInputTop",title:L(3290,"Align Quick Input Top"),f1:!1})}run(i){i.get(Ge).setAlignment("top")}});W(class extends K{constructor(){super({id:"workbench.action.alignQuickInputCenter",title:L(3289,"Align Quick Input Center"),f1:!1})}run(i){i.get(Ge).setAlignment("center")}});function Aqo(a){return a.iconA!==void 0}var $_e=(a,i,e,t)=>({id:a,active:i,label:e,visualIcon:t,activeIcon:M.eye,inactiveIcon:M.eyeClosed,activeAriaLabel:d(3381,null),inactiveAriaLabel:d(3382,null),useButtons:!0}),$V=(a,i,e,t)=>({id:a,active:i,label:e,visualIcon:t,activeIcon:M.check,activeAriaLabel:d(3285,null),useButtons:!1}),Nqo=x.and(Mx.toNegated(),x.notEquals("config.window.menuBarVisibility","hidden"),x.notEquals("config.window.menuBarVisibility","toggle"),x.notEquals("config.window.menuBarVisibility","compact")),aOt=[];(!it||!kr)&&aOt.push($_e("workbench.action.toggleMenuBar",Nqo,d(3322,null),vqo));aOt.push($_e(Pqo,x.notEquals("config.workbench.activityBar.location","hidden"),d(3286,null),{whenA:x.equals("config.workbench.sideBar.location","left"),iconA:bqo,iconB:Sqo}),$_e(wue.ID,cP,d(3394,null),{whenA:x.equals("config.workbench.sideBar.location","left"),iconA:tOt,iconB:iOt}),$_e(Y5.ID,D_,d(3379,null),{whenA:x.equals("config.workbench.sideBar.location","left"),iconA:iOt,iconB:tOt}),$_e(yue.ID,_Y,d(3356,null),wqo),$_e(Cue.ID,x.equals("config.workbench.statusBar.visible",!0),d(3399,null),Cqo));var sno=[$V(rOt.ID,x.equals("config.workbench.sideBar.location","left"),d(3321,null),tOt),$V(nOt.ID,x.equals("config.workbench.sideBar.location","right"),d(3378,null),iOt)],ano=[$V("workbench.action.alignPanelLeft",cV.isEqualTo("left"),d(3320,null),xqo),$V("workbench.action.alignPanelRight",cV.isEqualTo("right"),d(3377,null),kqo),$V("workbench.action.alignPanelCenter",cV.isEqualTo("center"),d(3294,null),Eqo),$V("workbench.action.alignPanelJustify",cV.isEqualTo("justify"),d(3318,null),Tqo)],lno=[$V("workbench.action.alignQuickInputTop",tYe.isEqualTo("top"),d(3414,null),_qo),$V("workbench.action.alignQuickInputCenter",tYe.isEqualTo("center"),d(3291,null),Dqo)],cno=[$V("workbench.action.toggleFullScreen",lP,d(3307,null),Lqo),$V("workbench.action.toggleZenMode",gC,d(3415,null),Mqo),$V("workbench.action.toggleCenteredLayout",P8e,d(3292,null),Rqo)],dno=new Set;for(let{active:a}of[...aOt,...sno,...ano,...lno,...cno])for(let i of a.keys())dno.add(i);W(class extends K{constructor(){super({id:"workbench.action.customizeLayout",title:L(3301,"Customize Layout..."),f1:!0,icon:rno,menu:[{id:D.LayoutControlMenuSubmenu,group:"z_end"},{id:D.LayoutControlMenu,when:x.and(Xc.toNegated(),x.equals("config.workbench.layoutControl.type","both")),group:"1_layout"}]})}getItems(i,e){let t=o=>{let n=o.active.evaluate(i.getContext(null)),r=o.useButtons?o.label:o.label+(n&&o.activeIcon?` $(${o.activeIcon.id})`:!n&&o.inactiveIcon?` $(${o.inactiveIcon.id})`:""),s=o.label+(n&&o.activeAriaLabel?` (${o.activeAriaLabel})`:!n&&o.inactiveAriaLabel?` (${o.inactiveAriaLabel})`:"");if(o.visualIcon){let c=o.visualIcon;Aqo(c)&&(c=c.whenA.evaluate(i.getContext(null))?c.iconA:c.iconB),r=`$(${c.id}) ${r}`}let l=n?o.activeIcon:o.inactiveIcon;return{type:"item",id:o.id,label:r,ariaLabel:s,keybinding:e.lookupKeybinding(o.id,i),buttons:o.useButtons?[{alwaysVisible:!1,tooltip:s,iconClass:l?q.asClassName(l):void 0}]:void 0}};return[{type:"separator",label:d(3412,null)},...aOt.map(t),{type:"separator",label:d(3397,null)},...sno.map(t),{type:"separator",label:d(3357,null)},...ano.map(t),{type:"separator",label:d(3372,null)},...lno.map(t),{type:"separator",label:d(3319,null)},...cno.map(t)]}run(i){if(this._currentQuickPick){this._currentQuickPick.hide();return}let e=i.get(B),t=i.get(X),o=i.get(ge),n=i.get(Ge),r=i.get(_e),s=new P,l=s.add(n.createQuickPick({useSeparators:!0}));this._currentQuickPick=l,l.items=this.getItems(t,r),l.ignoreFocusOut=!0,l.hideInput=!0,l.title=d(3302,null);let c={alwaysVisible:!0,iconClass:q.asClassName(M.close),tooltip:d(3295,null)},u={alwaysVisible:!0,iconClass:q.asClassName(M.discard),tooltip:d(3376,null)};l.buttons=[u,c];let p;s.add(t.onDidChangeContext(h=>{h.affectsSome(dno)&&(l.items=this.getItems(t,r),p&&(l.activeItems=l.items.filter(g=>g.id===p?.id)),setTimeout(()=>n.focus(),0))})),s.add(l.onDidAccept(h=>{l.selectedItems.length&&(p=l.selectedItems[0],o.executeCommand(p.id))})),s.add(l.onDidTriggerItemButton(h=>{h.item&&(p=h.item,o.executeCommand(p.id))})),s.add(l.onDidTriggerButton(h=>{if(h===c)l.hide();else if(h===u){let g=f=>{let v=e.inspect(f);e.updateValue(f,v.defaultValue)};g("workbench.activityBar.location"),g("workbench.sideBar.location"),g("workbench.statusBar.visible"),g("workbench.panel.defaultLocation"),(!it||!kr)&&g("window.menuBarVisibility"),o.executeCommand("workbench.action.alignPanelCenter"),o.executeCommand("workbench.action.alignQuickInputTop")}})),s.add(l.onDidHide(()=>{l.dispose()})),s.add(l.onDispose(()=>{this._currentQuickPick=void 0,s.dispose()})),l.show()}});oe.as(rn.EditorPane).registerEditorPane(ys.create(j5,j5.ID,d(3762,null)),[new Mt(qm),new Mt(IC)]);oe.as(rn.EditorPane).registerEditorPane(ys.create(Z_,Z_.ID,d(3761,null)),[new Mt(Fa)]);oe.as(rn.EditorPane).registerEditorPane(ys.create(GV,GV.ID,d(3640,null)),[new Mt(Fa)]);oe.as(rn.EditorPane).registerEditorPane(ys.create(of,of.ID,d(3749,null)),[new Mt(ga)]);oe.as(rn.EditorFactory).registerEditorSerializer(qm.ID,V_e);oe.as(rn.EditorFactory).registerEditorSerializer(ga.ID,KEt);oe.as(rn.EditorFactory).registerEditorSerializer(Fa.ID,GEt);pt(bue.ID,bue,ut.BlockRestore);pt(fue.ID,fue,ut.BlockRestore);pt(Sue.ID,Sue,ut.BlockRestore);pt(fF.ID,fF,ut.BlockRestore);var tbi=oe.as(Tu.Quickaccess),lOt="inEditorsPicker",mno=x.and($E,x.has(lOt));tbi.registerQuickAccessProvider({ctor:J_,prefix:J_.PREFIX,contextKey:lOt,placeholder:d(3660,null),helpEntries:[{description:d(3637,null),commandId:B7e.ID}]});tbi.registerQuickAccessProvider({ctor:BV,prefix:BV.PREFIX,contextKey:lOt,placeholder:d(3660,null),helpEntries:[{description:d(3638,null),commandId:H7e.ID}]});tbi.registerQuickAccessProvider({ctor:UP,prefix:UP.PREFIX,contextKey:lOt,placeholder:d(3660,null),helpEntries:[{description:d(3639,null),commandId:U7e.ID}]});W(bJ);W(JPt);W(ZPt);W(N_e);W(O_e);W(BAt);W(HAt);W(UAt);W(zAt);W(KAt);W(GAt);W(sNt);W(aNt);W(lNt);W(cNt);W(W7e);W(V7e);W(H7e);W(U7e);W(B7e);W(vue);W(wAt);W(IAt);W(CAt);W(xAt);W(SAt);W(tAt);W(iAt);W(oAt);W(nAt);W(rAt);W(sAt);W(aAt);W(lAt);W(cAt);W(OAt);W(FAt);W(WAt);W(VAt);W(AAt);W(NAt);W(pNt);W(mNt);W(hNt);W(gNt);W(EAt);W(TAt);W(_At);W(DAt);W(LAt);W(RAt);W(MAt);W(PAt);W(fNt);W(vNt);W(wNt);W(CNt);W(INt);W(yNt);W(bNt);W(SNt);W(xNt);W(kNt);W(LNt);W(RNt);W(_Nt);W(DNt);W(ENt);W(TNt);W(dAt);W(uAt);W(pAt);W(hAt);W(mAt);W(gAt);W(fAt);W(vAt);W(bAt);W(MNt);W(PNt);W(ANt);W(NNt);W($At);W(qAt);W(jAt);W(QAt);W(YAt);W(XAt);W(JAt);W(ZAt);W(eNt);W(uNt);W(dNt);W(z7e);W(K7e);W(G7e);W($7e);W(q7e);W(j7e);W(Y7e);W(Q7e);W(ONt);W(FNt);W(tNt);W(iNt);W(oNt);W(nNt);W(rNt);W(VNt);W(BNt);W(UNt);W(zNt);W(KNt);W(GNt);var uno="workbench.action.quickOpenNavigateNextInEditorPicker";yt.registerCommandAndKeybindingRule({id:uno,weight:250,handler:Y_(uno,!0),when:mno,primary:2050,mac:{primary:258}});var pno="workbench.action.quickOpenNavigatePreviousInEditorPicker";yt.registerCommandAndKeybindingRule({id:pno,weight:250,handler:Y_(pno,!1),when:mno,primary:3074,mac:{primary:1282}});foo();it&&(fe.appendMenuItem(D.TouchBarContext,{command:{id:O_e.ID,title:O_e.LABEL,icon:{dark:gn.asFileUri("vs/workbench/browser/parts/editor/media/back-tb.png")}},group:"navigation",order:0}),fe.appendMenuItem(D.TouchBarContext,{command:{id:N_e.ID,title:N_e.LABEL,icon:{dark:gn.asFileUri("vs/workbench/browser/parts/editor/media/forward-tb.png")}},group:"navigation",order:1}));fe.appendMenuItem(D.EmptyEditorGroup,{command:{id:LPt,title:d(3670,null),icon:M.unlock},group:"navigation",order:10,when:x.and(Xc,ME.toNegated())});fe.appendMenuItem(D.EmptyEditorGroup,{command:{id:H5,title:d(3769,null),icon:M.lock,toggled:x.true()},group:"navigation",order:10,when:ME});fe.appendMenuItem(D.EmptyEditorGroup,{command:{id:TPt,title:d(3647,null),icon:M.close},group:"navigation",order:20,when:x.or(Xc,Fj)});fe.appendMenuItem(D.EmptyEditorGroupContext,{command:{id:z5,title:d(3758,null)},group:"2_split",order:10});fe.appendMenuItem(D.EmptyEditorGroupContext,{command:{id:dK,title:d(3752,null)},group:"2_split",order:20});fe.appendMenuItem(D.EmptyEditorGroupContext,{command:{id:K5,title:d(3756,null)},group:"2_split",order:30});fe.appendMenuItem(D.EmptyEditorGroupContext,{command:{id:uK,title:d(3757,null)},group:"2_split",order:40});fe.appendMenuItem(D.EmptyEditorGroupContext,{command:{id:OPt,title:d(3740,null)},group:"3_window",order:10});fe.appendMenuItem(D.EmptyEditorGroupContext,{command:{id:DPt,title:d(3764,null),toggled:ME},group:"4_lock",order:10,when:Xc.toNegated()});fe.appendMenuItem(D.EmptyEditorGroupContext,{command:{id:TPt,title:d(3641,null)},group:"5_close",order:10,when:iS});fe.appendMenuItem(D.EditorTabsBarContext,{command:{id:z5,title:d(3758,null)},group:"2_split",order:10});fe.appendMenuItem(D.EditorTabsBarContext,{command:{id:dK,title:d(3752,null)},group:"2_split",order:20});fe.appendMenuItem(D.EditorTabsBarContext,{command:{id:K5,title:d(3756,null)},group:"2_split",order:30});fe.appendMenuItem(D.EditorTabsBarContext,{command:{id:uK,title:d(3757,null)},group:"2_split",order:40});fe.appendMenuItem(D.EditorTabsBarContext,{command:{id:APt,title:d(3732,null)},group:"3_window",order:10});fe.appendMenuItem(D.EditorTabsBarContext,{command:{id:NPt,title:d(3656,null)},group:"3_window",order:20});fe.appendMenuItem(D.EditorTabsBarContext,{submenu:D.EditorTabsBarShowTabsSubmenu,title:d(3760,null),group:"4_config",order:10,when:gC.negate()});fe.appendMenuItem(D.EditorTabsBarShowTabsSubmenu,{command:{id:nYe.ID,title:d(3737,null),toggled:x.equals("config.workbench.editor.showTabs","multiple")},group:"1_config",order:10});fe.appendMenuItem(D.EditorTabsBarShowTabsSubmenu,{command:{id:sYe.ID,title:d(3750,null),toggled:x.equals("config.workbench.editor.showTabs","single")},group:"1_config",order:20});fe.appendMenuItem(D.EditorTabsBarShowTabsSubmenu,{command:{id:iYe.ID,title:d(3662,null),toggled:x.equals("config.workbench.editor.showTabs","none")},group:"1_config",order:30});fe.appendMenuItem(D.EditorTabsBarContext,{submenu:D.EditorTabsBarShowTabsZenModeSubmenu,title:d(3760,null),group:"4_config",order:10,when:gC});fe.appendMenuItem(D.EditorTabsBarShowTabsZenModeSubmenu,{command:{id:rYe.ID,title:d(3737,null),toggled:x.equals("config.zenMode.showTabs","multiple")},group:"1_config",order:10});fe.appendMenuItem(D.EditorTabsBarShowTabsZenModeSubmenu,{command:{id:aYe.ID,title:d(3750,null),toggled:x.equals("config.zenMode.showTabs","single")},group:"1_config",order:20});fe.appendMenuItem(D.EditorTabsBarShowTabsZenModeSubmenu,{command:{id:oYe.ID,title:d(3662,null),toggled:x.equals("config.zenMode.showTabs","none")},group:"1_config",order:30});fe.appendMenuItem(D.EditorTabsBarContext,{submenu:D.EditorActionsPositionSubmenu,title:d(3659,null),group:"4_config",order:20});fe.appendMenuItem(D.EditorActionsPositionSubmenu,{command:{id:cYe.ID,title:d(3760,null),toggled:x.equals("config.workbench.editor.editorActionsLocation","default")},group:"1_config",order:10,when:x.equals("config.workbench.editor.showTabs","none").negate()});fe.appendMenuItem(D.EditorActionsPositionSubmenu,{command:{id:lYe.ID,title:d(3763,null),toggled:x.or(x.equals("config.workbench.editor.editorActionsLocation","titleBar"),x.and(x.equals("config.workbench.editor.showTabs","none"),x.equals("config.workbench.editor.editorActionsLocation","default")))},group:"1_config",order:20});fe.appendMenuItem(D.EditorActionsPositionSubmenu,{command:{id:dYe.ID,title:d(3661,null),toggled:x.equals("config.workbench.editor.editorActionsLocation","hidden")},group:"1_config",order:30});fe.appendMenuItem(D.EditorTabsBarContext,{command:{id:uYe.ID,title:d(3655,null)},group:"9_configure",order:10});fe.appendMenuItem(D.EditorTitleContext,{command:{id:OC,title:d(3641,null)},group:"1_close",order:10});fe.appendMenuItem(D.EditorTitleContext,{command:{id:g_e,title:d(3649,null),precondition:JEt.notEqualsTo("1")},group:"1_close",order:20});fe.appendMenuItem(D.EditorTitleContext,{command:{id:EPt,title:d(3651,null),precondition:x.and(Sce.toNegated(),Oj.negate())},group:"1_close",order:30,when:dz});fe.appendMenuItem(D.EditorTitleContext,{command:{id:cue,title:d(3643,null)},group:"1_close",order:40});fe.appendMenuItem(D.EditorTitleContext,{command:{id:B5,title:d(3642,null)},group:"1_close",order:50});fe.appendMenuItem(D.EditorTitleContext,{command:{id:f_e,title:d(3745,null)},group:"1_open",order:10,when:AO});fe.appendMenuItem(D.EditorTitleContext,{command:{id:_Pt,title:d(3667,null),precondition:Zxe.toNegated()},group:"3_preview",order:10,when:x.has("config.workbench.editor.enablePreview")});fe.appendMenuItem(D.EditorTitleContext,{command:{id:RPt,title:d(3742,null)},group:"3_preview",order:20,when:ZL.toNegated()});fe.appendMenuItem(D.EditorTitleContext,{command:{id:U5,title:d(3771,null)},group:"3_preview",order:20,when:ZL});fe.appendMenuItem(D.EditorTitleContext,{command:{id:uJ,title:d(3757,null)},group:"5_split",order:10,when:Cce.negate()});fe.appendMenuItem(D.EditorTitleContext,{command:{id:uJ,title:d(3752,null)},group:"5_split",order:10,when:Cce});fe.appendMenuItem(D.EditorTitleContext,{submenu:D.EditorSplitMoveSubmenu,title:d(3751,null),group:"5_split",order:15});fe.appendMenuItem(D.EditorTitleContext,{command:{id:v7e,title:d(3736,null)},group:"7_new_window",order:10});fe.appendMenuItem(D.EditorTitleContext,{command:{id:b7e,title:d(3658,null)},group:"7_new_window",order:20});fe.appendMenuItem(D.EditorTitleContext,{submenu:D.EditorTitleContextShare,title:d(3747,null),group:"11_share",order:-1,when:Oj.negate()});fe.appendMenuItem(D.EditorSplitMoveSubmenu,{command:{id:z5,title:d(3758,null)},group:"1_split",order:10});fe.appendMenuItem(D.EditorSplitMoveSubmenu,{command:{id:dK,title:d(3752,null)},group:"1_split",order:20});fe.appendMenuItem(D.EditorSplitMoveSubmenu,{command:{id:K5,title:d(3756,null)},group:"1_split",order:30});fe.appendMenuItem(D.EditorSplitMoveSubmenu,{command:{id:uK,title:d(3757,null)},group:"1_split",order:40});fe.appendMenuItem(D.EditorSplitMoveSubmenu,{command:{id:v_e,title:d(3730,null)},group:"2_move",order:10});fe.appendMenuItem(D.EditorSplitMoveSubmenu,{command:{id:b_e,title:d(3731,null)},group:"2_move",order:20});fe.appendMenuItem(D.EditorSplitMoveSubmenu,{command:{id:S_e,title:d(3734,null)},group:"2_move",order:30});fe.appendMenuItem(D.EditorSplitMoveSubmenu,{command:{id:I_e,title:d(3735,null)},group:"2_move",order:40});fe.appendMenuItem(D.EditorSplitMoveSubmenu,{command:{id:MPt,title:d(3755,null),precondition:Oj.negate()},group:"3_split_in_group",order:10,when:oV});fe.appendMenuItem(D.EditorSplitMoveSubmenu,{command:{id:PPt,title:d(3665,null),precondition:Oj.negate()},group:"3_split_in_group",order:10,when:hC});fe.appendMenuItem(D.EditorTitle,{command:{id:wPt,title:d(3664,null),toggled:x.equals("config.diffEditor.renderSideBySide",!1)},group:"1_diff",order:10,when:x.has("isInDiffEditor")});fe.appendMenuItem(D.EditorTitle,{command:{id:Wfi,title:d(3748,null)},group:"3_open",order:10});fe.appendMenuItem(D.EditorTitle,{command:{id:B5,title:d(3642,null)},group:"5_close",order:10});fe.appendMenuItem(D.EditorTitle,{command:{id:cue,title:d(3643,null)},group:"5_close",order:20});fe.appendMenuItem(D.EditorTitle,{command:{id:Ffi,title:d(3765,null),toggled:x.has("config.workbench.editor.enablePreview")},group:"7_settings",order:10});fe.appendMenuItem(D.EditorTitle,{command:{id:y_e,title:d(3671,null)},group:"8_group_operations",order:5,when:x.and(nV.negate(),Fj)});fe.appendMenuItem(D.EditorTitle,{command:{id:y_e,title:d(3770,null)},group:"8_group_operations",order:5,when:nV});fe.appendMenuItem(D.EditorTitle,{command:{id:DPt,title:d(3669,null),toggled:ME},group:"8_group_operations",order:10,when:Xc.toNegated()});fe.appendMenuItem(D.EditorTitle,{command:{id:pYe.ID,title:d(3654,null)},group:"9_configure",order:10});function vF(a,i,e,t,o,n){let r={command:{id:a.id,title:a.title,icon:a.icon,toggled:a.toggled,precondition:o},group:"navigation",when:i,order:e};t&&(r.alt={id:t.id,title:t.title,icon:t.icon}),fe.appendMenuItem(D.EditorTitle,r),n&&fe.appendMenuItem(D.CompactWindowEditorTitle,r)}var ibi=1e5,q_e=1e6;vF({id:uJ,title:d(3754,null),icon:M.splitHorizontal},Cce.negate(),ibi,{id:dK,title:d(3753,null),icon:M.splitVertical});vF({id:uJ,title:d(3753,null),icon:M.splitVertical},Cce,ibi,{id:uK,title:d(3754,null),icon:M.splitHorizontal});vF({id:Vfi,title:d(3766,null),icon:M.editorLayout},hC,ibi-1);vF({id:OC,title:d(3641,null),icon:M.close},x.and(dz.toNegated(),bce.toNegated(),ZL.toNegated()),q_e,{id:B5,title:d(3642,null),icon:M.closeAll});vF({id:OC,title:d(3641,null),icon:M.closeDirty},x.and(dz.toNegated(),bce,ZL.toNegated()),q_e,{id:B5,title:d(3642,null),icon:M.closeAll});vF({id:U5,title:d(3771,null),icon:M.pinned},x.and(dz.toNegated(),bce.toNegated(),ZL),q_e,{id:OC,title:d(3641,null),icon:M.close});vF({id:U5,title:d(3771,null),icon:M.pinnedDirty},x.and(dz.toNegated(),bce,ZL),q_e,{id:OC,title:d(3641,null),icon:M.close});vF({id:LPt,title:d(3668,null),icon:M.unlock},x.and(Xc,ME.toNegated()),q_e-1);vF({id:H5,title:d(3768,null),icon:M.lock,toggled:x.true()},ME,q_e-1);var Oqo=Re("diff-editor-previous-change",M.arrowUp,d(3744,null));vF({id:xPt,title:d(3739,null),icon:Oqo},tS,10,void 0,ue.hasChanges,!0);var Fqo=Re("diff-editor-next-change",M.arrowDown,d(3741,null));vF({id:CPt,title:d(3738,null),icon:Fqo},tS,11,void 0,ue.hasChanges,!0);vF({id:kPt,title:d(3759,null),icon:M.arrowSwap},x.and(tS,eke),15,void 0,void 0);var Wqo=Re("diff-editor-toggle-whitespace",M.whitespace,d(3767,null));fe.appendMenuItem(D.EditorTitle,{command:{id:Afi,title:d(3663,null),icon:Wqo,precondition:tS,toggled:x.equals("config.diffEditor.ignoreTrimWhitespace",!1)},group:"navigation",when:tS,order:20});fe.appendMenuItem(D.CommandPalette,{command:{id:_Pt,title:L(3666,"Keep Editor"),category:We.View},when:x.has("config.workbench.editor.enablePreview")});fe.appendMenuItem(D.CommandPalette,{command:{id:RPt,title:L(3743,"Pin Editor"),category:We.View}});fe.appendMenuItem(D.CommandPalette,{command:{id:U5,title:L(3772,"Unpin Editor"),category:We.View}});fe.appendMenuItem(D.CommandPalette,{command:{id:OC,title:L(3644,"Close Editor"),category:We.View}});fe.appendMenuItem(D.CommandPalette,{command:{id:Ofi,title:L(3650,"Close Pinned Editor"),category:We.View}});fe.appendMenuItem(D.CommandPalette,{command:{id:B5,title:L(3646,"Close All Editors in Group"),category:We.View}});fe.appendMenuItem(D.CommandPalette,{command:{id:cue,title:L(3653,"Close Saved Editors in Group"),category:We.View}});fe.appendMenuItem(D.CommandPalette,{command:{id:g_e,title:L(3648,"Close Other Editors in Group"),category:We.View}});fe.appendMenuItem(D.CommandPalette,{command:{id:EPt,title:L(3652,"Close Editors to the Right in Group"),category:We.View},when:Sce.toNegated()});fe.appendMenuItem(D.CommandPalette,{command:{id:f7e,title:L(3645,"Close Editor Group"),category:We.View},when:iS});fe.appendMenuItem(D.CommandPalette,{command:{id:f_e,title:L(3746,"Reopen Editor With..."),category:We.View},when:AO});fe.appendMenuItem(D.MenubarRecentMenu,{group:"1_editor",command:{id:W7e.ID,title:d(3699,null),precondition:x.has("canReopenClosedEditor")},order:1});fe.appendMenuItem(D.MenubarRecentMenu,{group:"z_clear",command:{id:V7e.ID,title:d(3672,null)},order:1});fe.appendMenuItem(D.MenubarFileMenu,{title:d(3701,null),submenu:D.MenubarShare,group:"45_share",order:1});fe.appendMenuItem(D.MenubarViewMenu,{group:"2_appearance",title:d(3674,null),submenu:D.MenubarLayoutMenu,order:2});fe.appendMenuItem(D.MenubarLayoutMenu,{group:"1_split",command:{id:z5,title:{...L(3713,"Split Up"),mnemonicTitle:d(3712,null)}},order:1});fe.appendMenuItem(D.MenubarLayoutMenu,{group:"1_split",command:{id:dK,title:{...L(3705,"Split Down"),mnemonicTitle:d(3704,null)}},order:2});fe.appendMenuItem(D.MenubarLayoutMenu,{group:"1_split",command:{id:K5,title:{...L(3709,"Split Left"),mnemonicTitle:d(3708,null)}},order:3});fe.appendMenuItem(D.MenubarLayoutMenu,{group:"1_split",command:{id:uK,title:{...L(3711,"Split Right"),mnemonicTitle:d(3710,null)}},order:4});fe.appendMenuItem(D.MenubarLayoutMenu,{group:"2_split_in_group",command:{id:MPt,title:{...L(3707,"Split in Group"),mnemonicTitle:d(3706,null)}},when:oV,order:1});fe.appendMenuItem(D.MenubarLayoutMenu,{group:"2_split_in_group",command:{id:PPt,title:{...L(3686,"Join in Group"),mnemonicTitle:d(3685,null)}},when:hC,order:1});fe.appendMenuItem(D.MenubarLayoutMenu,{group:"3_new_window",command:{id:v7e,title:{...L(3733,"Move Editor into New Window"),mnemonicTitle:d(3688,null)}},order:1});fe.appendMenuItem(D.MenubarLayoutMenu,{group:"3_new_window",command:{id:b7e,title:{...L(3657,"Copy Editor into New Window"),mnemonicTitle:d(3673,null)}},order:2});fe.appendMenuItem(D.MenubarLayoutMenu,{group:"4_layouts",command:{id:z7e.ID,title:{...L(3703,"Single"),mnemonicTitle:d(3702,null)}},order:1});fe.appendMenuItem(D.MenubarLayoutMenu,{group:"4_layouts",command:{id:K7e.ID,title:{...L(3725,"Two Columns"),mnemonicTitle:d(3724,null)}},order:3});fe.appendMenuItem(D.MenubarLayoutMenu,{group:"4_layouts",command:{id:G7e.ID,title:{...L(3717,"Three Columns"),mnemonicTitle:d(3716,null)}},order:4});fe.appendMenuItem(D.MenubarLayoutMenu,{group:"4_layouts",command:{id:$7e.ID,title:{...L(3727,"Two Rows"),mnemonicTitle:d(3726,null)}},order:5});fe.appendMenuItem(D.MenubarLayoutMenu,{group:"4_layouts",command:{id:q7e.ID,title:{...L(3719,"Three Rows"),mnemonicTitle:d(3718,null)}},order:6});fe.appendMenuItem(D.MenubarLayoutMenu,{group:"4_layouts",command:{id:j7e.ID,title:{...L(3721,"Grid (2x2)"),mnemonicTitle:d(3720,null)}},order:7});fe.appendMenuItem(D.MenubarLayoutMenu,{group:"4_layouts",command:{id:Y7e.ID,title:{...L(3729,"Two Rows Right"),mnemonicTitle:d(3728,null)}},order:8});fe.appendMenuItem(D.MenubarLayoutMenu,{group:"4_layouts",command:{id:Q7e.ID,title:{...L(3723,"Two Columns Bottom"),mnemonicTitle:d(3722,null)}},order:9});fe.appendMenuItem(D.MenubarGoMenu,{group:"1_history_nav",command:{id:"workbench.action.navigateToLastEditLocation",title:d(3687,null),precondition:x.has("canNavigateToLastEditLocation")},order:3});fe.appendMenuItem(D.MenubarSwitchEditorMenu,{group:"1_sideBySide",command:{id:Bfi,title:d(3675,null)},when:x.or(hC,tS),order:1});fe.appendMenuItem(D.MenubarSwitchEditorMenu,{group:"1_sideBySide",command:{id:Hfi,title:d(3700,null)},when:x.or(hC,tS),order:2});fe.appendMenuItem(D.MenubarSwitchEditorMenu,{group:"2_any",command:{id:"workbench.action.nextEditor",title:d(3689,null)},order:1});fe.appendMenuItem(D.MenubarSwitchEditorMenu,{group:"2_any",command:{id:"workbench.action.previousEditor",title:d(3694,null)},order:2});fe.appendMenuItem(D.MenubarSwitchEditorMenu,{group:"3_any_used",command:{id:"workbench.action.openNextRecentlyUsedEditor",title:d(3692,null)},order:1});fe.appendMenuItem(D.MenubarSwitchEditorMenu,{group:"3_any_used",command:{id:"workbench.action.openPreviousRecentlyUsedEditor",title:d(3697,null)},order:2});fe.appendMenuItem(D.MenubarSwitchEditorMenu,{group:"4_group",command:{id:"workbench.action.nextEditorInGroup",title:d(3690,null)},order:1});fe.appendMenuItem(D.MenubarSwitchEditorMenu,{group:"4_group",command:{id:"workbench.action.previousEditorInGroup",title:d(3695,null)},order:2});fe.appendMenuItem(D.MenubarSwitchEditorMenu,{group:"5_group_used",command:{id:"workbench.action.openNextRecentlyUsedEditorInGroup",title:d(3693,null)},order:1});fe.appendMenuItem(D.MenubarSwitchEditorMenu,{group:"5_group_used",command:{id:"workbench.action.openPreviousRecentlyUsedEditorInGroup",title:d(3698,null)},order:2});fe.appendMenuItem(D.MenubarGoMenu,{group:"2_editor_nav",title:d(3714,null),submenu:D.MenubarSwitchEditorMenu,order:1});fe.appendMenuItem(D.MenubarSwitchGroupMenu,{group:"1_focus_index",command:{id:"workbench.action.focusFirstEditorGroup",title:d(3679,null)},order:1});fe.appendMenuItem(D.MenubarSwitchGroupMenu,{group:"1_focus_index",command:{id:"workbench.action.focusSecondEditorGroup",title:d(3683,null)},order:2});fe.appendMenuItem(D.MenubarSwitchGroupMenu,{group:"1_focus_index",command:{id:"workbench.action.focusThirdEditorGroup",title:d(3684,null),precondition:iS},order:3});fe.appendMenuItem(D.MenubarSwitchGroupMenu,{group:"1_focus_index",command:{id:"workbench.action.focusFourthEditorGroup",title:d(3680,null),precondition:iS},order:4});fe.appendMenuItem(D.MenubarSwitchGroupMenu,{group:"1_focus_index",command:{id:"workbench.action.focusFifthEditorGroup",title:d(3678,null),precondition:iS},order:5});fe.appendMenuItem(D.MenubarSwitchGroupMenu,{group:"2_next_prev",command:{id:"workbench.action.focusNextGroup",title:d(3691,null),precondition:iS},order:1});fe.appendMenuItem(D.MenubarSwitchGroupMenu,{group:"2_next_prev",command:{id:"workbench.action.focusPreviousGroup",title:d(3696,null),precondition:iS},order:2});fe.appendMenuItem(D.MenubarSwitchGroupMenu,{group:"3_directional",command:{id:"workbench.action.focusLeftGroup",title:d(3681,null),precondition:iS},order:1});fe.appendMenuItem(D.MenubarSwitchGroupMenu,{group:"3_directional",command:{id:"workbench.action.focusRightGroup",title:d(3682,null),precondition:iS},order:2});fe.appendMenuItem(D.MenubarSwitchGroupMenu,{group:"3_directional",command:{id:"workbench.action.focusAboveGroup",title:d(3676,null),precondition:iS},order:3});fe.appendMenuItem(D.MenubarSwitchGroupMenu,{group:"3_directional",command:{id:"workbench.action.focusBelowGroup",title:d(3677,null),precondition:iS},order:4});fe.appendMenuItem(D.MenubarGoMenu,{group:"2_editor_nav",title:d(3715,null),submenu:D.MenubarSwitchGroupMenu,order:2});z4i(Fft);var cy=class extends Xj{constructor(e,t,o,n,r){super(e,o,n);this.options=t;this.layoutService=r;this._onDidVisibilityChange=this._register(new E);this.onDidVisibilityChange=this._onDidVisibilityChange.event;this._onDidChange=this._register(new E);this._register(r.registerPart(this))}get dimension(){return this._dimension}get contentPosition(){return this._contentPosition}onThemeChange(e){this.parent&&super.onThemeChange(e)}create(e,t){this.parent=e,this.titleArea=this.createTitleArea(e,t),this.contentArea=this.createContentArea(e,t),this.partLayout=new obi(this.options,this.contentArea),this.updateStyles()}getContainer(){return this.parent}createTitleArea(e,t){}createContentArea(e,t){}setHeaderArea(e){if(this.headerArea)throw new Error("Header already exists");!this.parent||!this.titleArea||(Sf(this.parent,e),e.classList.add("header-or-footer"),e.classList.add("header"),this.headerArea=e,this.partLayout?.setHeaderVisibility(!0),this.relayout())}setFooterArea(e){if(this.footerArea)throw new Error("Footer already exists");!this.parent||!this.titleArea||(this.parent.appendChild(e),e.classList.add("header-or-footer"),e.classList.add("footer"),this.footerArea=e,this.partLayout?.setFooterVisibility(!0),this.relayout())}removeHeaderArea(){this.headerArea&&(this.headerArea.remove(),this.headerArea=void 0,this.partLayout?.setHeaderVisibility(!1),this.relayout())}removeFooterArea(){this.footerArea&&(this.footerArea.remove(),this.footerArea=void 0,this.partLayout?.setFooterVisibility(!1),this.relayout())}relayout(){this.dimension&&this.contentPosition&&this.layout(this.dimension.width,this.dimension.height,this.contentPosition.top,this.contentPosition.left)}layoutContents(e,t){return Oi(this.partLayout).layout(e,t)}get onDidChange(){return this._onDidChange.event}layout(e,t,o,n){this._dimension=new ai(e,t),this._contentPosition={top:o,left:n}}setVisible(e){this._onDidVisibilityChange.fire(e)}},obi=class a{constructor(i,e){this.options=i;this.contentArea=e;this.headerVisible=!1;this.footerVisible=!1}static{this.HEADER_HEIGHT=35}static{this.TITLE_HEIGHT=35}static{this.Footer_HEIGHT=35}layout(i,e){let t;this.options.hasTitle?t=new ai(i,Math.min(e,a.TITLE_HEIGHT)):t=ai.None;let o;this.headerVisible?o=new ai(i,Math.min(e,a.HEADER_HEIGHT)):o=ai.None;let n;this.footerVisible?n=new ai(i,Math.min(e,a.Footer_HEIGHT)):n=ai.None;let r=i;this.options&&typeof this.options.borderWidth=="function"&&(r-=this.options.borderWidth());let s=new ai(r,e-t.height-o.height-n.height);return this.contentArea&&fN(this.contentArea,s.width,s.height),{headerSize:o,titleSize:t,contentSize:s,footerSize:n}}setFooterVisibility(i){this.footerVisible=i}setHeaderVisibility(i){this.headerVisible=i}},TJ=class extends Xj{constructor(){super(...arguments);this._parts=new Set}get parts(){return Array.from(this._parts)}registerPart(e){return this._parts.add(e),Z(()=>this.unregisterPart(e))}unregisterPart(e){this._parts.delete(e)}getPart(e){return this.getPartByDocument(e.ownerDocument)}getPartByDocument(e){if(this._parts.size>1){for(let t of this._parts)if(t.element?.ownerDocument===e)return t}return this.mainPart}get activePart(){return this.getPartByDocument(rh())}};var j_e=class extends C{constructor(e,t,o,n,r,s,l,c,u,p){super();this.editorGroupParent=e;this.editorPanesParent=t;this.groupView=o;this.layoutService=n;this.instantiationService=r;this.workspaceTrustService=l;this.logService=c;this.dialogService=u;this.hostService=p;this._onDidFocus=this._register(new E);this.onDidFocus=this._onDidFocus.event;this._onDidChangeSizeConstraints=this._register(new E);this.onDidChangeSizeConstraints=this._onDidChangeSizeConstraints.event;this._activeEditorPane=null;this.editorPanes=[];this.mapEditorPaneToPendingSetInput=new Map;this.activeEditorPaneDisposables=this._register(new P);this.editorPanesRegistry=oe.as(rn.EditorPane);this.editorOperation=this._register(new Eye(s)),this.registerListeners()}get minimumWidth(){return this._activeEditorPane?.minimumWidth??FE.width}get minimumHeight(){return this._activeEditorPane?.minimumHeight??FE.height}get maximumWidth(){return this._activeEditorPane?.maximumWidth??Jj.width}get maximumHeight(){return this._activeEditorPane?.maximumHeight??Jj.height}get activeEditorPane(){return this._activeEditorPane}registerListeners(){this._register(this.workspaceTrustService.onDidChangeTrust(()=>this.onDidChangeWorkspaceTrust()))}onDidChangeWorkspaceTrust(){let e=this._activeEditorPane?.input,t=this._activeEditorPane?.options;e?.hasCapability(16)&&this.groupView.openEditor(e,t)}async openEditor(e,t,o,n=Object.create(null)){try{return await this.doOpenEditor(this.getEditorPaneDescriptor(e),e,t,o,n)}catch(r){return t?.ignoreError?{error:r}:this.doShowError(r,e,t,o,n)}}async doShowError(e,t,o,n,r){this.logService.error(e);let s=!1;if(o?.source===1&&(!Pj(e)||e.allowDialog)&&(s=await this.doShowErrorDialog(e,t)),s)return{error:e};let l={...o};return so(e)||(l.error=e),{...await this.doOpenEditor(vJ.DESCRIPTOR,t,l,n,r),error:e}}async doShowErrorDialog(e,t){let o=gt.Error,n,r=In(e),s;Pj(e)&&(s=e.actions,o=e.forceSeverity??gt.Error,e.forceMessage&&(n=e.message,r=void 0)),n||(n=d(3959,null,t.getName()));let l=[];if(s&&s.length>0)for(let h of s)l.push({label:h.label,run:()=>h});else l.push({label:d(3960,null),run:()=>{}});let c;l.length===1&&(c={run:()=>{u=!0}});let u=!1,{result:p}=await this.dialogService.prompt({type:o,message:n,detail:r,buttons:l,cancelButton:c});if(p){let h=p.run();h instanceof Promise&&h.catch(g=>this.dialogService.error(In(g))),u=!0}return u}async doOpenEditor(e,t,o,n,r=Object.create(null)){let s=this.doShowEditorPane(e),l=Pn(),{changed:c,cancelled:u}=await this.doSetInput(s,t,o,r);return u||(!o?.preserveFocus&&this.shouldRestoreFocus(l)?s.focus():n?.preserveWindowOrder||this.hostService.moveTop(qv(this.groupView.windowId,!0).window)),{pane:s,changed:c,cancelled:u}}shouldRestoreFocus(e){if(!this.layoutService.isRestored()||!e)return!0;let t=Pn();return!!(!t||t===e.ownerDocument.body||e===t||!Oh(t)||gs(t,this.editorGroupParent))}getEditorPaneDescriptor(e){return e.hasCapability(16)&&!this.workspaceTrustService.isWorkspaceTrusted()?Q5.DESCRIPTOR:Oi(this.editorPanesRegistry.getEditorPane(e))}doShowEditorPane(e){if(this._activeEditorPane&&e.describes(this._activeEditorPane))return this._activeEditorPane;this.doHideActiveEditorPane();let t=this.doCreateEditorPane(e);this.doSetActiveEditorPane(t);let o=Oi(t.getContainer());return this.editorPanesParent.appendChild(o),bn(o),t.setVisible(!0),this.pagePosition&&t.layout(new ai(this.pagePosition.width,this.pagePosition.height),{top:this.pagePosition.top,left:this.pagePosition.left}),this.boundarySashes&&t.setBoundarySashes(this.boundarySashes),t}doCreateEditorPane(e){let t=this.doInstantiateEditorPane(e);if(!t.getContainer()){let o=_(".editor-instance");this.editorPanesParent.appendChild(o);try{t.create(o)}catch(n){throw o.remove(),xo(o),n}}return t}doInstantiateEditorPane(e){let t=this.editorPanes.find(n=>e.describes(n));if(t)return t;let o=this._register(e.instantiate(this.instantiationService,this.groupView));return this.editorPanes.push(o),o}doSetActiveEditorPane(e){this._activeEditorPane=e,this.activeEditorPaneDisposables.clear(),e&&(this.activeEditorPaneDisposables.add(e.onDidChangeSizeConstraints(t=>this._onDidChangeSizeConstraints.fire(t))),this.activeEditorPaneDisposables.add(e.onDidFocus(()=>this._onDidFocus.fire()))),this._onDidChangeSizeConstraints.fire(void 0)}async doSetInput(e,t,o,n){let r=e.input?.matches(t);if(r&&!o?.forceReload)return this.mapEditorPaneToPendingSetInput.has(e)&&await this.mapEditorPaneToPendingSetInput.get(e),r=e.input?.matches(t),r&&e.setOptions(o),{changed:!1,cancelled:!r};let s=this.editorOperation.start(this.layoutService.isRestored()?800:3200),l=!1;try{e.clearInput();let c=e.setInput(t,o,n,s.token);this.mapEditorPaneToPendingSetInput.set(e,c),await c,s.isCurrent()||(l=!0)}catch(c){if(!s.isCurrent())l=!0;else throw c}finally{s.isCurrent()&&this.mapEditorPaneToPendingSetInput.delete(e),s.stop()}return{changed:!r,cancelled:l}}doHideActiveEditorPane(){if(!this._activeEditorPane)return;this.editorOperation.stop(),this.safeRun(()=>this._activeEditorPane?.clearInput()),this.safeRun(()=>this._activeEditorPane?.setVisible(!1)),this.mapEditorPaneToPendingSetInput.delete(this._activeEditorPane);let e=this._activeEditorPane.getContainer();e&&(e.remove(),xo(e)),this.doSetActiveEditorPane(null)}closeEditor(e){this._activeEditorPane?.input&&e.matches(this._activeEditorPane.input)&&this.doHideActiveEditorPane()}setVisible(e){this.safeRun(()=>this._activeEditorPane?.setVisible(e))}layout(e){this.pagePosition=e,this.safeRun(()=>this._activeEditorPane?.layout(new ai(e.width,e.height),e))}setBoundarySashes(e){this.boundarySashes=e,this.safeRun(()=>this._activeEditorPane?.setBoundarySashes(e))}safeRun(e){try{e()}catch(t){this.logService.error(t)}}};j_e=I([m(3,fi),m(4,F),m(5,rd),m(6,ns),m(7,ne),m(8,ct),m(9,oi)],j_e);var hno=x.and(x.equals("chatSetupHidden",!1),x.equals("chatSetupDisabled",!1)),Vqo={text:d(3949,null),id:"workbench.action.chat.open",when:{native:hno,web:hno}},Bqo={text:d(3956,null),id:"workbench.action.showCommands"},Hqo={text:d(3955,null),id:"workbench.action.quickOpen"},Uqo={text:d(3950,null),id:"workbench.action.files.openFile"},zqo={text:d(3952,null),id:"workbench.action.files.openFolder"},Kqo={text:d(3951,null),id:"workbench.action.files.openFileFolder"},Gqo={text:d(3953,null),id:"workbench.action.openRecent"},$qo={text:d(3948,null),id:"workbench.action.files.newUntitledFile"},qqo={text:d(3947,null),id:"workbench.action.findInFiles"},jqo={text:d(3958,null),id:"workbench.action.terminal.toggleTerminal",when:{web:x.equals("terminalProcessSupported",!0)}},Qqo={text:d(3957,null),id:"workbench.action.debug.start",when:{web:x.equals("terminalProcessSupported",!0)}},Yqo={text:d(3954,null),id:"workbench.action.openSettings"},bno=[Vqo,Bqo],gno=si([...bno,Gqo,...it&&!Gt?[Kqo]:[Uqo,zqo],it&&!Gt?$qo:void 0]),fno=[...bno],vno=[Hqo,qqo,Qqo,jqo,Yqo],xR=class extends C{constructor(e,t,o,n,r,s){super();this.keybindingService=t;this.contextService=o;this.contextKeyService=n;this.configurationService=r;this.storageService=s;this.transientDisposables=this._register(new P);this.keybindingLabels=this._register(new P);this.enabled=!1;this.cachedWhen=this.storageService.getObject(xR.CACHED_WHEN,0,Object.create(null)),this.workbenchState=this.contextService.getWorkbenchState();let l=bt(".editor-group-watermark",[bt(".watermark-container",[bt(".letterpress"),bt(".shortcuts@shortcuts")])]);R(e,l.root),this.shortcuts=l.shortcuts,this.registerListeners(),this.render()}static{this.CACHED_WHEN="editorGroupWatermark.whenConditions"}static{this.SETTINGS_KEY="workbench.tips.enabled"}static{this.MINIMUM_ENTRIES=3}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration(xR.SETTINGS_KEY)&&this.enabled!==this.configurationService.getValue(xR.SETTINGS_KEY)&&this.render()})),this._register(this.contextService.onDidChangeWorkbenchState(e=>{this.workbenchState!==e&&(this.workbenchState=e,this.render())})),this._register(this.storageService.onWillSaveState(e=>{if(e.reason===1){let t=[...gno,...fno,...vno];for(let o of t){let n=Gt?o.when?.web:o.when?.native;n&&(this.cachedWhen[o.id]=this.contextKeyService.contextMatchesRules(n))}this.storageService.store(xR.CACHED_WHEN,JSON.stringify(this.cachedWhen),0,1)}}))}render(){if(this.enabled=this.configurationService.getValue(xR.SETTINGS_KEY),Rt(this.shortcuts),this.transientDisposables.clear(),!this.enabled)return;let e=this.filterEntries(this.workbenchState!==1?fno:gno);if(e.length<xR.MINIMUM_ENTRIES){let n=this.filterEntries(vno);l6(n),e.push(...n.slice(0,xR.MINIMUM_ENTRIES-e.length))}let t=R(this.shortcuts,_(".watermark-box")),o=()=>{Rt(t),this.keybindingLabels.clear();for(let n of e){let r=this.keybindingService.lookupKeybinding(n.id);if(!r)continue;let s=R(t,_("dl")),l=R(s,_("dt"));l.textContent=n.text;let c=R(s,_("dd"));this.keybindingLabels.add(new ah(c,zo,{renderUnboundKeybindings:!0,...l_})).set(r)}};o(),this.transientDisposables.add(this.keybindingService.onDidUpdateKeybindings(o))}filterEntries(e){return e.filter(o=>{if(this.cachedWhen[o.id])return!0;let n=Gt?o.when?.web:o.when?.native;return!n||this.contextKeyService.contextMatchesRules(n)}).filter(o=>!!qe.getCommand(o.id)).filter(o=>!!this.keybindingService.lookupKeybinding(o.id))}};xR=I([m(1,_e),m(2,Pe),m(3,X),m(4,B),m(5,le)],xR);var _J=class{},bK=class{constructor(i,e,t=1,o,n){this._disposables=new P;this._onDidSelectItem=new E;this._onDidFocusItem=new E;this._onDidChangeFocus=new E;this.onDidSelectItem=this._onDidSelectItem.event;this.onDidFocusItem=this._onDidFocusItem.event;this.onDidChangeFocus=this._onDidChangeFocus.event;this._items=new Array;this._nodes=new Array;this._freeNodes=new Array;this._enabled=!0;this._focusedItemIdx=-1;this._selectedItemIdx=-1;this._domNode=document.createElement("div"),this._domNode.className="monaco-breadcrumbs",this._domNode.tabIndex=0,this._domNode.setAttribute("role","list"),this._scrollable=new Pa(this._domNode,{vertical:2,horizontal:t,horizontalScrollbarSize:e,useShadows:!1,scrollYToX:!0}),this._separatorIcon=o,this._disposables.add(this._scrollable),this._disposables.add(Vo(this._domNode,"click",l=>this._onClick(l))),i.appendChild(this._scrollable.getDomNode());let r=hr(this._domNode);this._style(r,n);let s=Vn(this._domNode);this._disposables.add(s),this._disposables.add(s.onDidBlur(l=>this._onDidChangeFocus.fire(!1))),this._disposables.add(s.onDidFocus(l=>this._onDidChangeFocus.fire(!0)))}setHorizontalScrollbarSize(i){this._scrollable.updateOptions({horizontalScrollbarSize:i})}setHorizontalScrollbarVisibility(i){this._scrollable.updateOptions({horizontal:i})}dispose(){this._disposables.dispose(),this._pendingLayout?.dispose(),this._pendingDimLayout?.dispose(),this._onDidSelectItem.dispose(),this._onDidFocusItem.dispose(),this._onDidChangeFocus.dispose(),this._domNode.remove(),this._nodes.length=0,this._freeNodes.length=0}layout(i){i&&ai.equals(i,this._dimension)||(i?(this._pendingDimLayout?.dispose(),this._pendingDimLayout=this._updateDimensions(i)):(this._pendingLayout?.dispose(),this._pendingLayout=this._updateScrollbar()))}_updateDimensions(i){let e=new P;return e.add(T6(Me(this._domNode),()=>{this._dimension=i,this._domNode.style.width=`${i.width}px`,this._domNode.style.height=`${i.height}px`,e.add(this._updateScrollbar())})),e}_updateScrollbar(){return o7t(Me(this._domNode),()=>{o7t(Me(this._domNode),()=>{this._scrollable.setRevealOnScroll(!1),this._scrollable.scanDomNode(),this._scrollable.setRevealOnScroll(!0)})})}_style(i,e){let t="";e.breadcrumbsBackground&&(t+=`.monaco-breadcrumbs { background-color: ${e.breadcrumbsBackground}}`),e.breadcrumbsForeground&&(t+=`.monaco-breadcrumbs .monaco-breadcrumb-item { color: ${e.breadcrumbsForeground}}
`),e.breadcrumbsFocusForeground&&(t+=`.monaco-breadcrumbs .monaco-breadcrumb-item.focused { color: ${e.breadcrumbsFocusForeground}}
`),e.breadcrumbsFocusAndSelectionForeground&&(t+=`.monaco-breadcrumbs .monaco-breadcrumb-item.focused.selected { color: ${e.breadcrumbsFocusAndSelectionForeground}}
`),e.breadcrumbsHoverForeground&&(t+=`.monaco-breadcrumbs:not(.disabled ) .monaco-breadcrumb-item:hover:not(.focused):not(.selected) { color: ${e.breadcrumbsHoverForeground}}
`),i.textContent=t}setEnabled(i){this._enabled=i,this._domNode.classList.toggle("disabled",!this._enabled)}domFocus(){let i=this._focusedItemIdx>=0?this._focusedItemIdx:this._items.length-1;i>=0&&i<this._items.length?this._focus(i,void 0):this._domNode.focus()}isDOMFocused(){return ts(this._domNode)}getFocused(){return this._items[this._focusedItemIdx]}setFocused(i,e){this._focus(this._items.indexOf(i),e)}focusPrev(i){this._focusedItemIdx>0&&this._focus(this._focusedItemIdx-1,i)}focusNext(i){this._focusedItemIdx+1<this._nodes.length&&this._focus(this._focusedItemIdx+1,i)}_focus(i,e){this._focusedItemIdx=-1;for(let t=0;t<this._nodes.length;t++){let o=this._nodes[t];t!==i?o.classList.remove("focused"):(this._focusedItemIdx=t,o.classList.add("focused"),o.focus())}this._reveal(this._focusedItemIdx,!0),this._onDidFocusItem.fire({type:"focus",item:this._items[this._focusedItemIdx],node:this._nodes[this._focusedItemIdx],payload:e})}reveal(i){let e=this._items.indexOf(i);e>=0&&this._reveal(e,!1)}revealLast(){this._reveal(this._items.length-1,!1)}_reveal(i,e){if(i<0||i>=this._nodes.length)return;let t=this._nodes[i];if(!t)return;let{width:o}=this._scrollable.getScrollDimensions(),{scrollLeft:n}=this._scrollable.getScrollPosition();(!e||t.offsetLeft>n+o||t.offsetLeft<n)&&(this._scrollable.setRevealOnScroll(!1),this._scrollable.setScrollPosition({scrollLeft:t.offsetLeft}),this._scrollable.setRevealOnScroll(!0))}getSelection(){return this._items[this._selectedItemIdx]}setSelection(i,e){this._select(this._items.indexOf(i),e)}_select(i,e){this._selectedItemIdx=-1;for(let t=0;t<this._nodes.length;t++){let o=this._nodes[t];t!==i?o.classList.remove("selected"):(this._selectedItemIdx=t,o.classList.add("selected"))}this._onDidSelectItem.fire({type:"select",item:this._items[this._selectedItemIdx],node:this._nodes[this._selectedItemIdx],payload:e})}getItems(){return this._items}setItems(i){let e,t=[];try{e=dUi(this._items,i,(o,n)=>o.equals(n)),t=this._items.splice(e,this._items.length-e,...i.slice(e)),this._render(e),Ue(t),Ue(i.slice(0,e)),this._focus(-1,void 0)}catch(o){let n=new Error(`BreadcrumbsItem#setItems: newItems: ${i.length}, prefix: ${e}, removed: ${t.length}`);throw n.name=o.name,n.stack=o.stack,n}}_render(i){let e=!1;for(;i<this._items.length&&i<this._nodes.length;i++){let t=this._items[i],o=this._nodes[i];this._renderItem(t,o),e=!0}for(;i<this._nodes.length;){let t=this._nodes.pop();t&&(this._freeNodes.push(t),t.remove(),e=!0)}for(;i<this._items.length;i++){let t=this._items[i],o=this._freeNodes.length>0?this._freeNodes.pop():document.createElement("div");o&&(this._renderItem(t,o),this._domNode.appendChild(o),this._nodes.push(o),e=!0)}e&&this.layout(void 0)}_renderItem(i,e){Rt(e),e.className="";try{i.render(e)}catch(o){e.textContent="<<RENDER ERROR>>",console.error(o)}e.tabIndex=-1,e.setAttribute("role","listitem"),e.classList.add("monaco-breadcrumb-item");let t=_(q.asCSSSelector(this._separatorIcon));e.appendChild(t)}_onClick(i){if(this._enabled)for(let e=i.target;e;e=e.parentElement){let t=this._nodes.indexOf(e);if(t>=0){this._focus(t,i),this._select(t,i);break}}}};var kR=ae("IOutlineService");var qV=ae("IEditorBreadcrumbsService"),nbi=class{constructor(){this._map=new Map}register(i,e){if(this._map.has(i))throw new Error(`group (${i}) has already a widget`);return this._map.set(i,e),{dispose:()=>this._map.delete(i)}}getWidget(i){return this._map.get(i)}};we(qV,nbi,1);var XE=class a{constructor(){}static{this.IsEnabled=a._stub("breadcrumbs.enabled")}static{this.UseQuickPick=a._stub("breadcrumbs.useQuickPick")}static{this.FilePath=a._stub("breadcrumbs.filePath")}static{this.SymbolPath=a._stub("breadcrumbs.symbolPath")}static{this.SymbolSortOrder=a._stub("breadcrumbs.symbolSortOrder")}static{this.SymbolPathSeparator=a._stub("breadcrumbs.symbolPathSeparator")}static{this.Icons=a._stub("breadcrumbs.icons")}static{this.TitleScrollbarSizing=a._stub("workbench.editor.titleScrollbarSizing")}static{this.TitleScrollbarVisibility=a._stub("workbench.editor.titleScrollbarVisibility")}static{this.FileExcludes=a._stub("files.exclude")}static _stub(i){return{bindTo(e){let t=new E,o=e.onDidChangeConfiguration(n=>{n.affectsConfiguration(i)&&t.fire(void 0)});return new class{constructor(){this.name=i;this.onDidChange=t.event}getValue(n){return n?e.getValue(i,n):e.getValue(i)}updateValue(n,r){return r?e.updateValue(i,n,r):e.updateValue(i,n)}dispose(){o.dispose(),t.dispose()}}}}}};oe.as(ii.Configuration).registerConfiguration({id:"breadcrumbs",title:d(3617,null),order:101,type:"object",properties:{"breadcrumbs.enabled":{description:d(3576,null),type:"boolean",default:!0},"breadcrumbs.filePath":{description:d(3577,null),type:"string",default:"on",enum:["on","off","last"],enumDescriptions:[d(3580,null),d(3579,null),d(3578,null)]},"breadcrumbs.symbolPath":{description:d(3608,null),type:"string",default:"on",enum:["on","off","last"],enumDescriptions:[d(3611,null),d(3610,null),d(3609,null)]},"breadcrumbs.symbolSortOrder":{description:d(3613,null),type:"string",default:"position",scope:6,enum:["position","name","type"],enumDescriptions:[d(3615,null),d(3614,null),d(3616,null)]},"breadcrumbs.icons":{description:d(3607,null),type:"boolean",default:!0},"breadcrumbs.symbolPathSeparator":{description:d(3612,null),type:"string",default:".",scope:6},"breadcrumbs.showFiles":{type:"boolean",default:!0,scope:6,markdownDescription:d(3590,null)},"breadcrumbs.showModules":{type:"boolean",default:!0,scope:6,markdownDescription:d(3595,null)},"breadcrumbs.showNamespaces":{type:"boolean",default:!0,scope:6,markdownDescription:d(3596,null)},"breadcrumbs.showPackages":{type:"boolean",default:!0,scope:6,markdownDescription:d(3601,null)},"breadcrumbs.showClasses":{type:"boolean",default:!0,scope:6,markdownDescription:d(3583,null)},"breadcrumbs.showMethods":{type:"boolean",default:!0,scope:6,markdownDescription:d(3594,null)},"breadcrumbs.showProperties":{type:"boolean",default:!0,scope:6,markdownDescription:d(3602,null)},"breadcrumbs.showFields":{type:"boolean",default:!0,scope:6,markdownDescription:d(3589,null)},"breadcrumbs.showConstructors":{type:"boolean",default:!0,scope:6,markdownDescription:d(3585,null)},"breadcrumbs.showEnums":{type:"boolean",default:!0,scope:6,markdownDescription:d(3586,null)},"breadcrumbs.showInterfaces":{type:"boolean",default:!0,scope:6,markdownDescription:d(3592,null)},"breadcrumbs.showFunctions":{type:"boolean",default:!0,scope:6,markdownDescription:d(3591,null)},"breadcrumbs.showVariables":{type:"boolean",default:!0,scope:6,markdownDescription:d(3606,null)},"breadcrumbs.showConstants":{type:"boolean",default:!0,scope:6,markdownDescription:d(3584,null)},"breadcrumbs.showStrings":{type:"boolean",default:!0,scope:6,markdownDescription:d(3603,null)},"breadcrumbs.showNumbers":{type:"boolean",default:!0,scope:6,markdownDescription:d(3598,null)},"breadcrumbs.showBooleans":{type:"boolean",default:!0,scope:6,markdownDescription:d(3582,null)},"breadcrumbs.showArrays":{type:"boolean",default:!0,scope:6,markdownDescription:d(3581,null)},"breadcrumbs.showObjects":{type:"boolean",default:!0,scope:6,markdownDescription:d(3599,null)},"breadcrumbs.showKeys":{type:"boolean",default:!0,scope:6,markdownDescription:d(3593,null)},"breadcrumbs.showNull":{type:"boolean",default:!0,scope:6,markdownDescription:d(3597,null)},"breadcrumbs.showEnumMembers":{type:"boolean",default:!0,scope:6,markdownDescription:d(3587,null)},"breadcrumbs.showStructs":{type:"boolean",default:!0,scope:6,markdownDescription:d(3604,null)},"breadcrumbs.showEvents":{type:"boolean",default:!0,scope:6,markdownDescription:d(3588,null)},"breadcrumbs.showOperators":{type:"boolean",default:!0,scope:6,markdownDescription:d(3600,null)},"breadcrumbs.showTypeParameters":{type:"boolean",default:!0,scope:6,markdownDescription:d(3605,null)}}});var xue=class{constructor(i,e){this.uri=i;this.kind=e}},Y_e=class{constructor(i,e){this.element=i;this.outline=e}},Q_e=class{constructor(i,e,t,o,n){this.resource=i;this.editor=e;this._workspaceService=o;this._outlineService=n;this._disposables=new P;this._currentOutline=new me;this._outlineDisposables=new P;this._onDidUpdate=new E;this.onDidUpdate=this._onDidUpdate.event;this._cfgFilePath=XE.FilePath.bindTo(t),this._cfgSymbolPath=XE.SymbolPath.bindTo(t),this._disposables.add(this._cfgFilePath.onDidChange(r=>this._onDidUpdate.fire(this))),this._disposables.add(this._cfgSymbolPath.onDidChange(r=>this._onDidUpdate.fire(this))),this._workspaceService.onDidChangeWorkspaceFolders(this._onDidChangeWorkspaceFolders,this,this._disposables),this._fileInfo=this._initFilePathInfo(i),e&&(this._bindToEditor(e),this._disposables.add(n.onDidChange(()=>this._bindToEditor(e))),this._disposables.add(e.onDidChangeControl(()=>this._bindToEditor(e)))),this._onDidUpdate.fire(this)}dispose(){this._disposables.dispose(),this._cfgFilePath.dispose(),this._cfgSymbolPath.dispose(),this._currentOutline.dispose(),this._outlineDisposables.dispose(),this._onDidUpdate.dispose()}isRelative(){return!!this._fileInfo.folder}getElements(){let i=[];if(this._cfgFilePath.getValue()==="on"?i=i.concat(this._fileInfo.path):this._cfgFilePath.getValue()==="last"&&this._fileInfo.path.length>0&&(i=i.concat(this._fileInfo.path.slice(-1))),this._cfgSymbolPath.getValue()==="off"||!this._currentOutline.value)return i;let e=this._currentOutline.value.config.breadcrumbsDataSource.getBreadcrumbElements();for(let t=this._cfgSymbolPath.getValue()==="last"&&e.length>0?e.length-1:0;t<e.length;t++)i.push(new Y_e(e[t].element,this._currentOutline.value));return e.length===0&&!this._currentOutline.value.isEmpty&&i.push(new Y_e(this._currentOutline.value,this._currentOutline.value)),i}_initFilePathInfo(i){if($0(i,Y.untitled,Y.data))return{folder:void 0,path:[]};let e={folder:this._workspaceService.getWorkspaceFolder(i)??void 0,path:[]},t=i;for(;t&&t.path!=="/"&&!(e.folder&&Xe(e.folder.uri,t));){e.path.unshift(new xue(t,e.path.length===0?0:1));let o=t.path.length;if(t=ci(t),t.path.length===o)break}return e.folder&&this._workspaceService.getWorkbenchState()===3&&e.path.unshift(new xue(e.folder.uri,2)),e}_onDidChangeWorkspaceFolders(){this._fileInfo=this._initFilePathInfo(this.resource),this._onDidUpdate.fire(this)}_bindToEditor(i){let e=new $e;this._currentOutline.clear(),this._outlineDisposables.clear(),this._outlineDisposables.add(Z(()=>e.dispose(!0))),this._outlineService.createOutline(i,2,e.token).then(t=>{e.token.isCancellationRequested&&(t?.dispose(),t=void 0),this._currentOutline.value=t,this._onDidUpdate.fire(this),t&&this._outlineDisposables.add(t.onDidChange(()=>this._onDidUpdate.fire(this)))}).catch(t=>{this._onDidUpdate.fire(this),mt(t)})}};Q_e=I([m(2,B),m(3,Pe),m(4,kR)],Q_e);var J_e=class{constructor(i,e,t,o,n){this.resource=e;this._instantiationService=t;this._themeService=o;this._configurationService=n;this._disposables=new P;this._fakeEvent=new UIEvent("fakeEvent");this._onWillPickElement=new E;this.onWillPickElement=this._onWillPickElement.event;this._previewDispoables=new me;this._domNode=document.createElement("div"),this._domNode.className="monaco-breadcrumbs-picker show-file-icons",i.appendChild(this._domNode)}dispose(){this._disposables.dispose(),this._previewDispoables.dispose(),this._onWillPickElement.dispose(),this._domNode.remove(),setTimeout(()=>this._tree.dispose(),0)}async show(i,e,t,o,n){let s=this._themeService.getColorTheme().getColor(KXt);this._arrow=document.createElement("div"),this._arrow.className="arrow",this._arrow.style.borderColor=`transparent transparent ${s?s.toString():""}`,this._domNode.appendChild(this._arrow),this._treeContainer=document.createElement("div"),this._treeContainer.style.background=s?s.toString():"",this._treeContainer.style.paddingTop="2px",this._treeContainer.style.borderRadius="3px",this._treeContainer.style.boxShadow="var(--vscode-shadow-lg)",this._treeContainer.style.border=`1px solid ${this._themeService.getColorTheme().getColor(jT)}`,this._domNode.appendChild(this._treeContainer),this._layoutInfo={maxHeight:e,width:t,arrowSize:o,arrowOffset:n,inputHeight:0},this._tree=this._createTree(this._treeContainer,i),this._disposables.add(this._tree.onDidOpen(async l=>{let{element:c,editorOptions:u,sideBySide:p}=l;await this._revealElement(c,{...u,preserveFocus:!1},p)})),this._disposables.add(this._tree.onDidChangeFocus(l=>{this._previewDispoables.value=this._previewElement(l.elements[0])})),this._disposables.add(this._tree.onDidChangeContentHeight(()=>{this._layout()})),this._domNode.focus();try{await this._setInput(i),this._layout()}catch(l){mt(l)}}_layout(){let i=2*this._layoutInfo.arrowSize,e=Math.min(this._layoutInfo.maxHeight-i,this._tree.contentHeight),t=e+i;this._domNode.style.height=`${t}px`,this._domNode.style.width=`${this._layoutInfo.width}px`,this._arrow.style.top=`-${2*this._layoutInfo.arrowSize}px`,this._arrow.style.borderWidth=`${this._layoutInfo.arrowSize}px`,this._arrow.style.marginLeft=`${this._layoutInfo.arrowOffset}px`,this._treeContainer.style.height=`${e}px`,this._treeContainer.style.width=`${this._layoutInfo.width}px`,this._tree.layout(e,this._layoutInfo.width)}restoreViewState(){}};J_e=I([m(2,F),m(3,De),m(4,B)],J_e);var rbi=class{getHeight(i){return 22}getTemplateId(i){return"FileStat"}},sbi=class{getId(i){return A.isUri(i)?i.toString():Tq(i)?i.id:oC(i)?i.uri.toString():i.resource.toString()}},mYe=class{constructor(i){this._fileService=i}hasChildren(i){return A.isUri(i)||Tq(i)||oC(i)||i.isDirectory}async getChildren(i){if(Tq(i))return i.folders;let e;return oC(i)?e=i.uri:A.isUri(i)?e=i:e=i.resource,(await this._fileService.resolve(e)).children??[]}};mYe=I([m(0,be)],mYe);var hYe=class{constructor(i,e){this._labels=i;this._configService=e;this.templateId="FileStat"}renderTemplate(i){return this._labels.create(i,{supportHighlights:!0})}renderElement(i,e,t){let o=this._configService.getValue("explorer.decorations"),{element:n}=i,r,s;oC(n)?(r=n.uri,s=2):(r=n.resource,s=n.isDirectory?1:0),t.setFile(r,{fileKind:s,hidePath:!0,fileDecorations:o,matches:ua(i.filterData),extraClasses:["picker-item"]})}disposeTemplate(i){i.dispose()}};hYe=I([m(1,B)],hYe);var abi=class{getKeyboardNavigationLabel(i){return i.name}},lbi=class{getWidgetAriaLabel(){return d(3630,null)}getAriaLabel(i){return i.name}},gYe=class{constructor(i,e,t){this._workspaceService=i;this._cachedExpressions=new Map;this._disposables=new P;let o=XE.FileExcludes.bindTo(e),n=()=>{i.getWorkspace().folders.forEach(r=>{let s=o.getValue({resource:r.uri});if(!s)return;let l={};for(let u in s){if(typeof s[u]!="boolean")continue;let p=u.indexOf("**/")!==0?Lo.join(r.uri.path,u):u;l[p]=s[u]}let c=!t.hasCapability(r.uri,1024);this._cachedExpressions.set(r.uri.toString(),zm(l,{ignoreCase:c}))})};n(),this._disposables.add(o),this._disposables.add(o.onDidChange(n)),this._disposables.add(i.onDidChangeWorkspaceFolders(n))}dispose(){this._disposables.dispose()}filter(i,e){if(oC(i))return!0;let t=this._workspaceService.getWorkspaceFolder(i.resource);return!t||!this._cachedExpressions.has(t.uri.toString())?!0:!this._cachedExpressions.get(t.uri.toString())(SM(t.uri.path,i.resource.path),Ye(i.resource))}};gYe=I([m(0,Pe),m(1,B),m(2,be)],gYe);var cbi=class{compare(i,e){return oC(i)&&oC(e)?i.index-e.index:i.isDirectory===e.isDirectory?jE(i.name,e.name):i.isDirectory?-1:1}},Z_e=class extends J_e{constructor(e,t,o,n,r,s,l){super(e,t,o,n,r);this._workspaceService=s;this._editorService=l}_createTree(e){this._treeContainer.classList.add("file-icon-themable-tree"),this._treeContainer.classList.add("show-file-icons");let t=n=>{this._treeContainer.classList.toggle("align-icons-and-twisties",n.hasFileIcons&&!n.hasFolderIcons),this._treeContainer.classList.toggle("hide-arrows",n.hidesExplorerArrows===!0)};this._disposables.add(this._themeService.onDidFileIconThemeChange(t)),t(this._themeService.getFileIconTheme());let o=this._instantiationService.createInstance(Za,AP);return this._disposables.add(o),this._instantiationService.createInstance(nu,"BreadcrumbsFilePicker",e,new rbi,[this._instantiationService.createInstance(hYe,o)],this._instantiationService.createInstance(mYe),{multipleSelectionSupport:!1,sorter:new cbi,filter:this._instantiationService.createInstance(gYe),identityProvider:new sbi,keyboardNavigationLabelProvider:new abi,accessibilityProvider:this._instantiationService.createInstance(lbi),showNotFoundMessage:!1,overrideStyles:{listBackground:KXt}})}async _setInput(e){let{uri:t,kind:o}=e,n;o===2?n=this._workspaceService.getWorkspace():n=ci(t);let r=this._tree;await r.setInput(n);let s;for(let{element:l}of r.getNode().children)if(oC(l)&&Xe(l.uri,t)){s=l;break}else if(Xe(l.resource,t)){s=l;break}s&&(r.reveal(s,.5),r.setFocus([s],this._fakeEvent)),r.domFocus()}_previewElement(e){return C.None}async _revealElement(e,t,o){return!oC(e)&&e.isFile?(this._onWillPickElement.fire(),await this._editorService.openEditor({resource:e.resource,options:t},o?vn:void 0),!0):!1}};Z_e=I([m(2,F),m(3,De),m(4,B),m(5,Pe),m(6,ee)],Z_e);var fYe=class{constructor(i,e,t){this.comparator=i;this._order=t.getValue(e,"breadcrumbs.symbolSortOrder")}compare(i,e){return this._order==="name"?this.comparator.compareByName(i,e):this._order==="type"?this.comparator.compareByType(i,e):this.comparator.compareByPosition(i,e)}};fYe=I([m(2,Nn)],fYe);var cOt=class extends J_e{_createTree(i,e){let{config:t}=e.outline;return this._instantiationService.createInstance(pO,"BreadcrumbsOutlinePicker",i,t.delegate,t.renderers,t.treeDataSource,{...t.options,sorter:this._instantiationService.createInstance(fYe,t.comparator,void 0),collapseByDefault:!0,expandOnlyOnTwistieClick:!0,multipleSelectionSupport:!1,showNotFoundMessage:!1})}_setInput(i){let e=i.outline.captureViewState();this.restoreViewState=()=>{e.dispose()};let t=this._tree;return t.setInput(i.outline),i.element!==i.outline&&(t.reveal(i.element,.5),t.setFocus([i.element],this._fakeEvent)),t.domFocus(),Promise.resolve()}_previewElement(i){return this._tree.getInput().preview(i)}async _revealElement(i,e,t){return this._onWillPickElement.fire(),await this._tree.getInput().reveal(i,e,t,!1),!0}};var DJ=class extends _J{constructor(e,t,o,n){super();this.model=e;this.element=t;this.options=o;this._instantiationService=n;this._disposables=new P}dispose(){this._disposables.dispose()}equals(e){return e instanceof DJ?this.element.element===e.element.element&&this.options.showFileIcons===e.options.showFileIcons&&this.options.showSymbolIcons===e.options.showSymbolIcons:!1}render(e){let{element:t,outline:o}=this.element;if(t===o){let l=_("span",void 0,"\u2026");e.appendChild(l);return}let n=o.config.delegate.getTemplateId(t),r=o.config.renderers.find(l=>l.templateId===n);if(!r){e.textContent="<<NO RENDERER>>";return}let s=r.renderTemplate(e);r.renderElement({element:t,children:[],depth:0,visibleChildrenCount:0,visibleChildIndex:0,collapsible:!1,collapsed:!1,visible:!0,filterData:void 0},0,s,void 0),this.options.showSymbolIcons||xo(s.iconClass),this._disposables.add(Z(()=>{r.disposeTemplate(s)})),t instanceof _f&&o.uri&&this._disposables.add(this._instantiationService.invokeFunction(l=>Sno(l,e,t.symbol.name,{symbol:t.symbol,uri:o.uri},this.model,this.options.dragEditor)))}};DJ=I([m(3,F)],DJ);var LJ=class extends _J{constructor(e,t,o,n,r,s){super();this.model=e;this.element=t;this.options=o;this._labels=n;this._hoverDelegate=r;this._instantiationService=s;this._disposables=new P}dispose(){this._disposables.dispose()}equals(e){return e instanceof LJ?ar.isEqual(this.element.uri,e.element.uri)&&this.options.showFileIcons===e.options.showFileIcons&&this.options.showSymbolIcons===e.options.showSymbolIcons:!1}render(e){let t=this._labels.create(e,{hoverDelegate:this._hoverDelegate});t.setFile(this.element.uri,{hidePath:!0,hideIcon:this.element.kind===1||!this.options.showFileIcons,fileKind:this.element.kind,fileDecorations:{colors:this.options.showDecorationColors,badges:!1}}),e.classList.add(Cd[this.element.kind].toLowerCase()),this._disposables.add(t),this._disposables.add(this._instantiationService.invokeFunction(o=>Sno(o,e,Ye(this.element.uri),this.element.uri,this.model,this.options.dragEditor)))}};LJ=I([m(5,F)],LJ);function Sno(a,i,e,t,o,n){let r=a.get(F);return i.draggable=!0,new Om(i,{onDragStart:s=>{s.dataTransfer&&(s.dataTransfer.effectAllowed="copyMove",r.invokeFunction(l=>{A.isUri(t)?Ig(l,[t],s):(Ig(l,[{resource:t.uri,selection:t.symbol.range}],s),_Ie([{name:t.symbol.name,fsPath:t.uri.fsPath,range:t.symbol.range,kind:t.symbol.kind}],s)),n&&o.editor?.input&&VI.getInstance().setData([new Wf({editor:o.editor.input,groupId:o.editor.group.id})],Wf.prototype)}),$N(s,i,e))}})}var Xqo=Re("breadcrumb-separator",M.chevronRight,d(3629,null)),bc=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h){this._options=e;this._editorGroup=t;this._contextKeyService=o;this._contextViewService=n;this._instantiationService=r;this._quickInputService=s;this._fileService=l;this._editorService=c;this._labelService=u;this._disposables=new P;this._breadcrumbsDisposables=new P;this._model=new me;this._breadcrumbsPickerShowing=!1;this._onDidVisibilityChange=this._disposables.add(new E);this.domNode=document.createElement("div"),this.domNode.classList.add("breadcrumbs-control"),R(i,this.domNode),this._cfUseQuickPick=XE.UseQuickPick.bindTo(p),this._cfShowIcons=XE.Icons.bindTo(p),this._cfTitleScrollbarSizing=XE.TitleScrollbarSizing.bindTo(p),this._cfTitleScrollbarVisibility=XE.TitleScrollbarVisibility.bindTo(p),this._labels=this._instantiationService.createInstance(Za,AP);let g=this._cfTitleScrollbarSizing.getValue()??"default",f=e.widgetStyles??f1,v=this._cfTitleScrollbarVisibility?.getValue()??"auto";this._widget=new bK(this.domNode,bc.SCROLLBAR_SIZES[g],bc.SCROLLBAR_VISIBILITY[v],Xqo,f),this._widget.onDidSelectItem(this._onSelectEvent,this,this._disposables),this._widget.onDidFocusItem(this._onFocusEvent,this,this._disposables),this._widget.onDidChangeFocus(this._updateCkBreadcrumbsActive,this,this._disposables),this._ckBreadcrumbsPossible=bc.CK_BreadcrumbsPossible.bindTo(this._contextKeyService),this._ckBreadcrumbsVisible=bc.CK_BreadcrumbsVisible.bindTo(this._contextKeyService),this._ckBreadcrumbsActive=bc.CK_BreadcrumbsActive.bindTo(this._contextKeyService),this._hoverDelegate=Ni("mouse"),this._disposables.add(h.register(this._editorGroup.id,this._widget)),this.hide()}static{this.HEIGHT=22}static{this.SCROLLBAR_SIZES={default:3,large:8}}static{this.SCROLLBAR_VISIBILITY={auto:1,visible:3,hidden:2}}static{this.Payload_Reveal={}}static{this.Payload_RevealAside={}}static{this.Payload_Pick={}}static{this.CK_BreadcrumbsPossible=new Q("breadcrumbsPossible",!1,d(3619,null))}static{this.CK_BreadcrumbsVisible=new Q("breadcrumbsVisible",!1,d(3620,null))}static{this.CK_BreadcrumbsActive=new Q("breadcrumbsActive",!1,d(3618,null))}get onDidVisibilityChange(){return this._onDidVisibilityChange.event}dispose(){this._disposables.dispose(),this._breadcrumbsDisposables.dispose(),this._model.dispose(),this._ckBreadcrumbsPossible.reset(),this._ckBreadcrumbsVisible.reset(),this._ckBreadcrumbsActive.reset(),this._cfUseQuickPick.dispose(),this._cfShowIcons.dispose(),this._cfTitleScrollbarSizing.dispose(),this._cfTitleScrollbarVisibility.dispose(),this._widget.dispose(),this._labels.dispose(),this.domNode.remove()}get model(){return this._model.value}layout(i){this._widget.layout(i)}isHidden(){return this.domNode.classList.contains("hidden")}hide(){let i=this.isHidden();this._breadcrumbsDisposables.clear(),this._ckBreadcrumbsVisible.set(!1),this.domNode.classList.toggle("hidden",!0),i||this._onDidVisibilityChange.fire()}show(){let i=this.isHidden();this._ckBreadcrumbsVisible.set(!0),this.domNode.classList.toggle("hidden",!1),i&&this._onDidVisibilityChange.fire()}revealLast(){this._widget.revealLast()}update(){this._breadcrumbsDisposables.clear();let i=no.getCanonicalUri(this._editorGroup.activeEditor,{supportSideBySide:1}),e=this.isHidden();if(!i||!this._fileService.hasProvider(i))return this._ckBreadcrumbsPossible.set(!1),e?!1:(this.hide(),!0);let t=no.getOriginalUri(this._editorGroup.activeEditor,{supportSideBySide:1});this.show(),this._ckBreadcrumbsPossible.set(!0);let o=this._instantiationService.createInstance(Q_e,t??i,this._editorGroup.activeEditorPane);this._model.value=o,this.domNode.classList.toggle("backslash-path",this._labelService.getSeparator(i.scheme,i.authority)==="\\");let n=()=>{this.domNode.classList.toggle("relative-path",o.isRelative());let p=this._cfShowIcons.getValue(),h={...this._options,showFileIcons:this._options.showFileIcons&&p,showSymbolIcons:this._options.showSymbolIcons&&p},g=o.getElements().map(f=>f instanceof xue?this._instantiationService.createInstance(LJ,o,f,h,this._labels,this._hoverDelegate):this._instantiationService.createInstance(DJ,o,f,h));g.length===0?(this._widget.setEnabled(!1),this._widget.setItems([new class extends _J{render(f){f.textContent=d(3627,null)}equals(f){return f===this}dispose(){}}])):(this._widget.setEnabled(!0),this._widget.setItems(g),this._widget.reveal(g[g.length-1]))},r=o.onDidUpdate(n),s=this._cfShowIcons.onDidChange(n);n(),this._breadcrumbsDisposables.clear(),this._breadcrumbsDisposables.add(r),this._breadcrumbsDisposables.add(Z(()=>this._model.clear())),this._breadcrumbsDisposables.add(s),this._breadcrumbsDisposables.add(Z(()=>this._widget.setItems([])));let l=()=>{let p=this._cfTitleScrollbarSizing.getValue()??"default",h=this._cfTitleScrollbarVisibility?.getValue()??"auto";this._widget.setHorizontalScrollbarSize(bc.SCROLLBAR_SIZES[p]),this._widget.setHorizontalScrollbarVisibility(bc.SCROLLBAR_VISIBILITY[h])};l();let c=this._cfTitleScrollbarSizing.onDidChange(l),u=this._cfTitleScrollbarVisibility.onDidChange(l);return this._breadcrumbsDisposables.add(c),this._breadcrumbsDisposables.add(u),this._breadcrumbsDisposables.add({dispose:()=>{this._breadcrumbsPickerShowing&&this._contextViewService.hideContextView({source:this})}}),e!==this.isHidden()}_onFocusEvent(i){i.item&&this._breadcrumbsPickerShowing&&(this._breadcrumbsPickerIgnoreOnceItem=void 0,this._widget.setSelection(i.item))}_onSelectEvent(i){if(!i.item)return;if(i.item===this._breadcrumbsPickerIgnoreOnceItem){this._breadcrumbsPickerIgnoreOnceItem=void 0,this._widget.setFocused(void 0),this._widget.setSelection(void 0);return}let{element:e}=i.item;this._editorGroup.focus();let t=this._getEditorGroup(i.payload);if(t!==void 0){this._widget.setFocused(void 0),this._widget.setSelection(void 0),this._revealInEditor(i,e,t);return}if(this._cfUseQuickPick.getValue()){this._widget.setFocused(void 0),this._widget.setSelection(void 0),this._quickInputService.quickAccess.show(e instanceof Y_e?"@":"");return}let o,n;this._contextViewService.showContextView({render:r=>{i.item instanceof LJ?o=this._instantiationService.createInstance(Z_e,r,i.item.model.resource):i.item instanceof DJ&&(o=this._instantiationService.createInstance(cOt,r,i.item.model.resource));let s=o.onWillPickElement(()=>this._contextViewService.hideContextView({source:this,didPick:!0})),l=Xd.getInstance(Me(this.domNode)).onDidChange(()=>this._contextViewService.hideContextView({source:this})),c=Vn(r),u=c.onDidBlur(()=>{this._breadcrumbsPickerIgnoreOnceItem=this._widget.isDOMFocused()?i.item:void 0,this._contextViewService.hideContextView({source:this})});return this._breadcrumbsPickerShowing=!0,this._updateCkBreadcrumbsActive(),hn(o,s,l,c,u)},getAnchor:()=>{if(!n){let r=Me(this.domNode),s=r.innerWidth-8,l=Math.min(r.innerHeight*.7,300),c=Math.min(s,Math.max(240,s/4.17)),u=8,p,h=Yn(i.node),g=h.top+h.height+u;g+l>=r.innerHeight&&(l=r.innerHeight-g-30);let f=h.left;if(f+c>=s&&(f=s-c),i.payload instanceof yn){let v=c-2*u;p=i.payload.posx-f,p>v&&(f=Math.min(s-c,f+p-v),p=v)}else p=h.left+h.width*.3-f;o.show(e,l,c,u,Math.max(0,p)),n={x:f,y:g}}return n},onHide:r=>{r?.didPick||o.restoreViewState(),this._breadcrumbsPickerShowing=!1,this._updateCkBreadcrumbsActive(),r?.source===this&&(this._widget.setFocused(void 0),this._widget.setSelection(void 0)),o.dispose()}})}_updateCkBreadcrumbsActive(){let i=this._widget.isDOMFocused()||this._breadcrumbsPickerShowing;this._ckBreadcrumbsActive.set(i)}async _revealInEditor(i,e,t,o=!1){if(e instanceof xue)if(e.kind===0)await this._editorService.openEditor({resource:e.uri,options:{pinned:o}},t);else{let n=this._widget.getItems(),r=n.indexOf(i.item);this._widget.setFocused(n[r+1]),this._widget.setSelection(n[r+1],bc.Payload_Pick)}else e.outline.reveal(e,{pinned:o},t===vn,!1)}_getEditorGroup(i){return i===bc.Payload_RevealAside?vn:i===bc.Payload_Reveal?Un:void 0}};bc=I([m(3,X),m(4,_n),m(5,F),m(6,Ge),m(7,be),m(8,ee),m(9,ot),m(10,B),m(11,qV)],bc);var RJ=class{constructor(i,e,t,o,n,r){this._container=i;this._editorGroup=e;this._options=t;this._instantiationService=n;this._disposables=new P;this._controlDisposables=new P;this._onDidEnablementChange=this._disposables.add(new E);this._onDidVisibilityChange=this._disposables.add(new E);let s=this._disposables.add(XE.IsEnabled.bindTo(o));this._disposables.add(s.onDidChange(()=>{let l=s.getValue();!l&&this._control?(this._controlDisposables.clear(),this._control=void 0,this._onDidEnablementChange.fire()):l&&!this._control&&(this._control=this.createControl(),this._control.update(),this._onDidEnablementChange.fire())})),s.getValue()&&(this._control=this.createControl()),this._disposables.add(r.onDidChangeFileSystemProviderRegistrations(l=>{this._control?.model&&this._control.model.resource.scheme!==l.scheme||this._control?.update()&&this._onDidEnablementChange.fire()}))}get control(){return this._control}get onDidEnablementChange(){return this._onDidEnablementChange.event}get onDidVisibilityChange(){return this._onDidVisibilityChange.event}createControl(){let i=this._controlDisposables.add(this._instantiationService.createInstance(bc,this._container,this._options,this._editorGroup));return this._controlDisposables.add(i.onDidVisibilityChange(()=>this._onDidVisibilityChange.fire())),i}dispose(){this._disposables.dispose(),this._controlDisposables.dispose()}};RJ=I([m(3,B),m(4,F),m(5,be)],RJ);W(class extends K{constructor(){super({id:"breadcrumbs.toggle",title:L(3624,"Toggle Breadcrumbs"),shortTitle:L(3625,"Breadcrumbs"),category:We.View,toggled:{condition:x.equals("config.breadcrumbs.enabled",!0),title:d(3626,null),mnemonicTitle:d(3628,null)},menu:[{id:D.CommandPalette},{id:D.MenubarAppearanceMenu,group:"4_editor",order:2},{id:D.NotebookToolbar,group:"notebookLayout",order:2},{id:D.StickyScrollContext},{id:D.NotebookStickyScrollContext,group:"notebookView",order:2},{id:D.NotebookToolbarContext,group:"notebookView",order:2}]})}run(i){let e=i.get(B),t=XE.IsEnabled.bindTo(e),o=t.getValue();t.updateValue(!o),t.dispose()}});function dbi(a,i){let e=a.get(Et),o=a.get(qV).getWidget(e.activeGroup.id);if(o){let n=o.getItems().at(-1);o.setFocused(n),i&&o.setSelection(n,bc.Payload_Pick)}}W(class extends K{constructor(){super({id:"breadcrumbs.focusAndSelect",title:L(3623,"Focus and Select Breadcrumbs"),precondition:bc.CK_BreadcrumbsVisible,keybinding:{weight:200,primary:3161,when:bc.CK_BreadcrumbsPossible},f1:!0})}run(i,...e){dbi(i,!0)}});W(class extends K{constructor(){super({id:"breadcrumbs.focus",title:L(3622,"Focus Breadcrumbs"),precondition:bc.CK_BreadcrumbsVisible,keybinding:{weight:200,primary:3157,when:bc.CK_BreadcrumbsPossible},f1:!0})}run(i,...e){dbi(i,!1)}});yt.registerCommandAndKeybindingRule({id:"breadcrumbs.toggleToOn",weight:200,primary:3161,when:x.not("config.breadcrumbs.enabled"),handler:async a=>{let i=a.get(F),e=a.get(B),t=XE.IsEnabled.bindTo(e);return t.getValue()||(await t.updateValue(!0),await Pi(50)),t.dispose(),i.invokeFunction(dbi,!0)}});yt.registerCommandAndKeybindingRule({id:"breadcrumbs.focusNext",weight:200,primary:17,secondary:[2065],mac:{primary:17,secondary:[529]},when:x.and(bc.CK_BreadcrumbsVisible,bc.CK_BreadcrumbsActive),handler(a){let i=a.get(Et),t=a.get(qV).getWidget(i.activeGroup.id);t&&t.focusNext()}});yt.registerCommandAndKeybindingRule({id:"breadcrumbs.focusPrevious",weight:200,primary:15,secondary:[2063],mac:{primary:15,secondary:[527]},when:x.and(bc.CK_BreadcrumbsVisible,bc.CK_BreadcrumbsActive),handler(a){let i=a.get(Et),t=a.get(qV).getWidget(i.activeGroup.id);t&&t.focusPrev()}});yt.registerCommandAndKeybindingRule({id:"breadcrumbs.focusNextWithPicker",weight:201,primary:2065,mac:{primary:529},when:x.and(bc.CK_BreadcrumbsVisible,bc.CK_BreadcrumbsActive,rc),handler(a){let i=a.get(Et),t=a.get(qV).getWidget(i.activeGroup.id);t&&t.focusNext()}});yt.registerCommandAndKeybindingRule({id:"breadcrumbs.focusPreviousWithPicker",weight:201,primary:2063,mac:{primary:527},when:x.and(bc.CK_BreadcrumbsVisible,bc.CK_BreadcrumbsActive,rc),handler(a){let i=a.get(Et),t=a.get(qV).getWidget(i.activeGroup.id);t&&t.focusPrev()}});yt.registerCommandAndKeybindingRule({id:"breadcrumbs.selectFocused",weight:200,primary:3,secondary:[18],when:x.and(bc.CK_BreadcrumbsVisible,bc.CK_BreadcrumbsActive),handler(a){let i=a.get(Et),t=a.get(qV).getWidget(i.activeGroup.id);t&&t.setSelection(t.getFocused(),bc.Payload_Pick)}});yt.registerCommandAndKeybindingRule({id:"breadcrumbs.revealFocused",weight:200,primary:10,secondary:[2051],when:x.and(bc.CK_BreadcrumbsVisible,bc.CK_BreadcrumbsActive),handler(a){let i=a.get(Et),t=a.get(qV).getWidget(i.activeGroup.id);t&&t.setSelection(t.getFocused(),bc.Payload_Reveal)}});yt.registerCommandAndKeybindingRule({id:"breadcrumbs.selectEditor",weight:201,primary:9,when:x.and(bc.CK_BreadcrumbsVisible,bc.CK_BreadcrumbsActive),handler(a){let i=a.get(Et),t=a.get(qV).getWidget(i.activeGroup.id);t&&(t.setFocused(void 0),t.setSelection(void 0),i.activeGroup.activeEditorPane?.focus())}});yt.registerCommandAndKeybindingRule({id:"breadcrumbs.revealFocusedFromTreeAside",weight:200,primary:2051,when:x.and(bc.CK_BreadcrumbsVisible,bc.CK_BreadcrumbsActive,rc),handler(a){let i=a.get(ee),t=a.get(fo).lastFocusedList;if(!(t instanceof pO)&&!(t instanceof nu))return;let o=t.getFocus()[0];if(A.isUri(o?.resource))return i.openEditor({resource:o.resource,options:{pinned:!0}},vn);let n=t.getInput();if(n&&typeof n.outlineKind=="string")return n.reveal(o,{pinned:!0,preserveFocus:!1},!0,!1)}});W(class extends K{constructor(){super({id:"breadcrumbs.copyPath",title:L(3621,"Copy Breadcrumbs Path"),category:We.View,precondition:bc.CK_BreadcrumbsVisible,f1:!0,menu:[{id:D.EditorTitleContext,group:"1_cutcopypaste",order:100,when:bc.CK_BreadcrumbsPossible}]})}async run(i){let e=i.get(Et),t=i.get(Wi),o=i.get(B),n=i.get(kR);if(!e.activeGroup.activeEditorPane)return;let r=await n.createOutline(e.activeGroup.activeEditorPane,2,ve.None);if(!r)return;let l=r.config.breadcrumbsDataSource.getBreadcrumbElements().map(g=>g.label).filter(Boolean);if(r.dispose(),l.length===0)return;let c=e.activeGroup.activeEditorPane.input.resource,u=XE.SymbolPathSeparator.bindTo(o),p=u.getValue(c&&{resource:c})??".";u.dispose();let h=l.join(p);await t.writeText(h)}});var vYe=class extends as{constructor(e){super();this.context=e}run(e,t){let o=this.context;return t?.preserveFocus&&(o={...this.context,preserveFocus:!0}),super.run(e,o)}},GP=class extends Jd{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super(g);this.parent=e;this.editorPartsView=t;this.groupsView=o;this.groupView=n;this.tabsModel=r;this.contextMenuService=s;this.instantiationService=l;this.contextKeyService=c;this.keybindingService=u;this.notificationService=p;this.quickInputService=h;this.editorResolverService=f;this.hostService=v;this.editorTransfer=VI.getInstance();this.groupTransfer=VI.getInstance();this.treeItemsTransfer=VI.getInstance();this.editorActionsToolbarDisposables=this._register(new P);this.editorActionsDisposables=this._register(new P);this.renderDropdownAsChildElement=!1;let b=this.create(e);this.contextMenuContextKeyService=this._register(this.contextKeyService.createScoped(b));let S=this._register(this.instantiationService.createChild(new Io([X,this.contextMenuContextKeyService])));this.resourceContext=this._register(S.createInstance(Fo)),this.editorPinnedContext=Zxe.bindTo(this.contextMenuContextKeyService),this.editorIsFirstContext=QEt.bindTo(this.contextMenuContextKeyService),this.editorIsLastContext=Sce.bindTo(this.contextMenuContextKeyService),this.editorStickyContext=ZL.bindTo(this.contextMenuContextKeyService),this.editorAvailableEditorIds=AO.bindTo(this.contextMenuContextKeyService),this.editorCanSplitInGroupContext=oV.bindTo(this.contextMenuContextKeyService),this.sideBySideEditorContext=hC.bindTo(this.contextMenuContextKeyService),this.groupLockedContext=ME.bindTo(this.contextMenuContextKeyService)}static{this.EDITOR_TAB_HEIGHT={normal:35,compact:22}}create(e){return this.updateTabHeight(),e}get editorActionsEnabled(){return this.groupsView.partOptions.editorActionsLocation==="default"&&this.groupsView.partOptions.showTabs!=="none"}createEditorActionsToolBar(e,t){this.editorActionsToolbarContainer=_("div"),this.editorActionsToolbarContainer.classList.add(...t),e.appendChild(this.editorActionsToolbarContainer),this.handleEditorActionToolBarVisibility(this.editorActionsToolbarContainer)}handleEditorActionToolBarVisibility(e){let t=this.editorActionsEnabled,o=!!this.editorActionsToolbar;t&&!o?this.doCreateEditorActionsToolBar(e):!t&&o&&(this.editorActionsToolbar?.getElement().remove(),this.editorActionsToolbar=void 0,this.editorActionsToolbarDisposables.clear(),this.editorActionsDisposables.clear()),e.classList.toggle("hidden",!t)}doCreateEditorActionsToolBar(e){let t={groupId:this.groupView.id};this.editorActionsToolbar=this.editorActionsToolbarDisposables.add(this.instantiationService.createInstance(Ol,e,{actionViewItemProvider:(o,n)=>this.actionViewItemProvider(o,n),orientation:0,ariaLabel:d(4037,null),getKeyBinding:o=>this.getKeybinding(o),actionRunner:this.editorActionsToolbarDisposables.add(new vYe(t)),anchorAlignmentProvider:()=>1,renderDropdownAsChildElement:this.renderDropdownAsChildElement,telemetrySource:"editorPart",resetMenu:D.EditorTitle,overflowBehavior:{maxItems:9,exempted:goo},highlightToggledItems:!0})),this.editorActionsToolbar.context=t,this.editorActionsToolbarDisposables.add(this.editorActionsToolbar.actionRunner.onDidRun(o=>{o.error&&!so(o.error)&&this.notificationService.error(o.error)}))}actionViewItemProvider(e,t){let o=this.groupView.activeEditorPane;if(o instanceof pa){let n=o.getActionViewItem(e,t);if(n)return n}return Ca(this.instantiationService,e,{...t,menuAsChild:this.renderDropdownAsChildElement})}updateEditorActionsToolbar(){if(!this.editorActionsEnabled)return;this.editorActionsDisposables.clear();let e=this.groupView.createEditorActions(this.editorActionsDisposables);this.editorActionsDisposables.add(e.onDidChange(()=>this.updateEditorActionsToolbar()));let t=Oi(this.editorActionsToolbar),{primary:o,secondary:n}=this.prepareEditorActions(e.actions);t.setActions(yq(o),yq(n))}getEditorPaneAwareContextKeyService(){return this.groupView.activeEditorPane?.scopedContextKeyService??this.contextKeyService}clearEditorActionsToolbar(){if(!this.editorActionsEnabled)return;Oi(this.editorActionsToolbar).setActions([],[])}onGroupDragStart(e,t){if(e.target!==t)return!1;let o=this.isNewWindowOperation(e);this.groupTransfer.setData([new rI(this.groupView.id)],rI.prototype),e.dataTransfer&&(e.dataTransfer.effectAllowed="copyMove");let n=!1;if(this.groupsView.partOptions.showTabs==="multiple"?n=this.doFillResourceDataTransfers(this.groupView.getEditors(1),e,o):this.groupView.activeEditor&&(n=this.doFillResourceDataTransfers([this.groupView.activeEditor],e,o)),!n&&yc&&e.dataTransfer?.setData(Aa.TEXT,String(this.groupView.label)),this.groupView.activeEditor){let r=this.groupView.activeEditor.getName();this.groupsView.partOptions.showTabs==="multiple"&&this.groupView.count>1&&(r=d(4038,null,r,this.groupView.count-1)),$N(e,t,r)}return o}async onGroupDragEnd(e,t,o,n){if(this.groupTransfer.clearData(rI.prototype),e.target!==o||!n||MRt())return;let r=await this.maybeCreateAuxiliaryEditorPartAt(e,o);if(!r)return;let s=r.activeGroup;this.groupsView.mergeGroup(this.groupView,s.id,{mode:this.isMoveOperation(t??e,s.id)?1:0}),s.focus()}async maybeCreateAuxiliaryEditorPartAt(e,t){let{point:o,display:n}=await this.hostService.getCursorScreenPoint()??{point:{x:e.screenX,y:e.screenY}},r=Ki();if(r.document.visibilityState==="visible"&&r.document.hasFocus()&&o.x>=r.screenX&&o.x<=r.screenX+r.outerWidth&&o.y>=r.screenY&&o.y<=r.screenY+r.outerHeight)return;let s=t.offsetWidth/2,l=30+t.offsetHeight/2,c={x:o.x-s,y:o.y-l};return n&&(c.x<n.x&&(c.x=n.x),c.y<n.y&&(c.y=n.y)),this.editorPartsView.createAuxiliaryEditorPart({bounds:c})}isNewWindowOperation(e){return this.groupsView.partOptions.dragToOpenWindow?!e.altKey:e.altKey}isMoveOperation(e,t,o){return o?.hasCapability(8)?!0:!(e.ctrlKey&&!it||e.altKey&&it)||t===this.groupView.id}doFillResourceDataTransfers(e,t,o){return e.length?(this.instantiationService.invokeFunction(Ig,e.map(n=>({editor:n,groupId:this.groupView.id})),t,{disableStandardTransfer:o}),!0):!1}onTabContextMenu(e,t,o){this.resourceContext.set(no.getOriginalUri(e,{supportSideBySide:1})),this.editorPinnedContext.set(this.tabsModel.isPinned(e)),this.editorIsFirstContext.set(this.tabsModel.isFirst(e)),this.editorIsLastContext.set(this.tabsModel.isLast(e)),this.editorStickyContext.set(this.tabsModel.isSticky(e)),this.groupLockedContext.set(this.tabsModel.isLocked),this.editorCanSplitInGroupContext.set(e.hasCapability(32)),this.sideBySideEditorContext.set(e.typeId===ga.ID),nTt(this.editorAvailableEditorIds,e,this.editorResolverService);let n=o;Vp(t)&&(n=new yn(Me(o),t)),this.contextMenuService.showContextMenu({getAnchor:()=>n,menuId:D.EditorTitleContext,menuActionOptions:{shouldForwardArgs:!0,arg:this.resourceContext.get()},contextKeyService:this.contextMenuContextKeyService,getActionsContext:()=>({groupId:this.groupView.id,editorIndex:this.groupView.getIndexOfEditor(e)}),getKeyBinding:r=>this.keybindingService.lookupKeybinding(r.id,this.contextMenuContextKeyService),onHide:()=>this.groupsView.activeGroup.focus()})}getKeybinding(e){return this.keybindingService.lookupKeybinding(e.id,this.getEditorPaneAwareContextKeyService())}getKeybindingLabel(e){let t=this.getKeybinding(e);return t?t.getLabel()??void 0:void 0}get tabHeight(){return this.groupsView.partOptions.tabHeight!=="compact"?GP.EDITOR_TAB_HEIGHT.normal:GP.EDITOR_TAB_HEIGHT.compact}getHoverTitle(e){let t=e.getTitle(2);return this.tabsModel.isPinned(e)?t:{markdown:new xe("",{supportThemeIcons:!0,isTrusted:!0}).appendText(t).appendMarkdown(' (_preview_ [$(gear)](command:workbench.action.openSettings?%5B%22workbench.editor.enablePreview%22%5D "Configure Preview Mode"))'),markdownNotSupportedFallback:t+" (preview)"}}updateTabHeight(){this.parent.style.setProperty("--editor-group-tab-height",`${this.tabHeight}px`)}updateOptions(e,t){e.tabHeight!==t.tabHeight&&this.updateTabHeight(),(e.editorActionsLocation!==t.editorActionsLocation||e.showTabs!==t.showTabs)&&this.editorActionsToolbarContainer&&(this.handleEditorActionToolBarVisibility(this.editorActionsToolbarContainer),this.updateEditorActionsToolbar())}};GP=I([m(5,ze),m(6,F),m(7,X),m(8,_e),m(9,Ne),m(10,Ge),m(11,De),m(12,ul),m(13,oi)],GP);var dOt=class extends C{constructor(e){super();this.model=e;this._onDidModelChange=this._register(new E);this.onDidModelChange=this._onDidModelChange.event;this._register(this.model.onDidModelChange(t=>{let o=t.editorIndex??t.editor;o!==void 0&&!this.filter(o)||this._onDidModelChange.fire(t)}))}get id(){return this.model.id}get isLocked(){return this.model.isLocked}get stickyCount(){return this.model.stickyCount}get activeEditor(){return this.model.activeEditor&&this.filter(this.model.activeEditor)?this.model.activeEditor:null}get previewEditor(){return this.model.previewEditor&&this.filter(this.model.previewEditor)?this.model.previewEditor:null}get selectedEditors(){return this.model.selectedEditors.filter(e=>this.filter(e))}isPinned(e){return this.model.isPinned(e)}isTransient(e){return this.model.isTransient(e)}isSticky(e){return this.model.isSticky(e)}isActive(e){return this.model.isActive(e)}isSelected(e){return this.model.isSelected(e)}isFirst(e){return this.model.isFirst(e,this.getEditors(1))}isLast(e){return this.model.isLast(e,this.getEditors(1))}getEditors(e,t){return this.model.getEditors(e,t).filter(n=>this.filter(n))}findEditor(e,t){let o=this.model.findEditor(e,t);if(o)return this.filter(o[1])?o:void 0}},eDe=class extends dOt{get count(){return this.model.stickyCount}getEditors(i,e){return e?.excludeSticky?[]:i===1?this.model.getEditors(1).slice(0,this.model.stickyCount):super.getEditors(i,e)}isSticky(i){return!0}getEditorByIndex(i){return i<this.count?this.model.getEditorByIndex(i):void 0}indexOf(i,e,t){let o=this.model.indexOf(i,e,t);return o<0||o>=this.model.stickyCount?-1:o}contains(i,e){let t=this.model.indexOf(i,void 0,e);return t>=0&&t<this.model.stickyCount}filter(i){return this.model.isSticky(i)}},tDe=class extends dOt{get count(){return this.model.count-this.model.stickyCount}get stickyCount(){return 0}isSticky(i){return!1}getEditors(i,e){return i===1?this.model.getEditors(1).slice(this.model.stickyCount):super.getEditors(i,e)}getEditorByIndex(i){return i>=0?this.model.getEditorByIndex(i+this.model.stickyCount):void 0}indexOf(i,e,t){let o=this.model.indexOf(i,e,t);return o<this.model.stickyCount||o>=this.model.count?-1:o-this.model.stickyCount}contains(i,e){let t=this.model.indexOf(i,void 0,e);return t>=this.model.stickyCount&&t<this.model.count}filter(i){return!this.model.isSticky(i)}};var sI=class extends GP{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super(e,t,o,n,r,s,l,c,u,p,h,g,S,y);this.editorService=f;this.pathService=v;this.treeViewsDragAndDropService=b;this.closeEditorAction=this._register(this.instantiationService.createInstance(IJ,IJ.ID,IJ.LABEL));this.unpinEditorAction=this._register(this.instantiationService.createInstance(gF,gF.ID,gF.LABEL));this.tabResourceLabels=this._register(this.instantiationService.createInstance(Za,AP));this.tabLabels=[];this.tabActionBars=[];this.tabDisposables=[];this.dimensions={container:ai.None,available:ai.None};this.layoutScheduler=this._register(new me);this.path=ri?Ms:Lo;this.lastMouseWheelEventTime=0;this.isMouseOverTabs=!1;this.updateEditorLabelScheduler=this._register(new Dt(()=>this.doUpdateEditorLabels(),0));(async()=>this.path=await this.pathService.path)(),this._register(this.tabResourceLabels.onDidChangeDecorations(()=>this.doHandleDecorationsChange()))}static{this.SCROLLBAR_SIZES={default:3,large:10}}static{this.TAB_WIDTH={compact:38,shrink:80,fit:120}}static{this.DRAG_OVER_OPEN_TAB_THRESHOLD=1500}static{this.MOUSE_WHEEL_EVENT_THRESHOLD=150}static{this.MOUSE_WHEEL_DISTANCE_THRESHOLD=1.5}create(e){return super.create(e),this.titleContainer=e,this.tabsAndActionsContainer=_(".tabs-and-actions-container"),this.titleContainer.appendChild(this.tabsAndActionsContainer),this.tabsContainer=_(".tabs-container",{role:"tablist",draggable:!0}),this._register(ws.addTarget(this.tabsContainer)),this.tabSizingFixedDisposables=this._register(new P),this.updateTabSizing(!1),this.tabsScrollbar=this.createTabsScrollbar(this.tabsContainer),this.tabsAndActionsContainer.appendChild(this.tabsScrollbar.getDomNode()),this.registerTabsContainerListeners(this.tabsContainer,this.tabsScrollbar),this.createEditorActionsToolBar(this.tabsAndActionsContainer,["editor-actions"]),this.updateTabsControlVisibility(),this.tabsAndActionsContainer}createTabsScrollbar(e){let t=this._register(new f9(e,{horizontal:this.getTabsScrollbarVisibility(),horizontalScrollbarSize:this.getTabsScrollbarSizing(),vertical:2,scrollYToX:!0,useShadows:!1}));return this._register(t.onScroll(o=>{o.scrollLeftChanged&&(e.scrollLeft=o.scrollLeft)})),t}updateTabsScrollbarSizing(){this.tabsScrollbar?.updateOptions({horizontalScrollbarSize:this.getTabsScrollbarSizing()})}updateTabsScrollbarVisibility(){this.tabsScrollbar?.updateOptions({horizontal:this.getTabsScrollbarVisibility()})}updateTabSizing(e){let[t,o]=_y(this.tabsContainer,this.tabSizingFixedDisposables);o.clear();let n=this.groupsView.partOptions;n.tabSizing==="fixed"?(t.style.setProperty("--tab-sizing-fixed-min-width",`${n.tabSizingFixedMinWidth}px`),t.style.setProperty("--tab-sizing-fixed-max-width",`${n.tabSizingFixedMaxWidth}px`),o.add(j(t,re.MOUSE_ENTER,()=>{this.isMouseOverTabs=!0})),o.add(j(t,re.MOUSE_LEAVE,()=>{this.isMouseOverTabs=!1,this.updateTabsFixedWidth(!1)}))):e&&(t.style.removeProperty("--tab-sizing-fixed-min-width"),t.style.removeProperty("--tab-sizing-fixed-max-width"),this.updateTabsFixedWidth(!1))}updateTabsFixedWidth(e){this.forEachTab((t,o,n)=>{if(e){let{width:r}=n.getBoundingClientRect();n.style.setProperty("--tab-sizing-current-width",`${r}px`)}else n.style.removeProperty("--tab-sizing-current-width")})}getTabsScrollbarSizing(){return this.groupsView.partOptions.titleScrollbarSizing!=="large"?sI.SCROLLBAR_SIZES.default:sI.SCROLLBAR_SIZES.large}getTabsScrollbarVisibility(){switch(this.groupsView.partOptions.titleScrollbarVisibility){case"visible":return 3;case"hidden":return 2;default:return 1}}registerTabsContainerListeners(e,t){this._register(j(e,re.SCROLL,()=>{e.classList.contains("scroll")&&t.setScrollPosition({scrollLeft:e.scrollLeft})}));for(let s of[Gn.Tap,re.DBLCLICK])this._register(j(e,s,l=>{if(s===re.DBLCLICK){if(l.target!==e)return}else if(l.tapCount!==2||l.initialTarget!==e)return;$t.stop(l),this.editorService.openEditor({resource:void 0,options:{pinned:!0,index:this.groupView.count,override:Ys.id}},this.groupView.id)}));this._register(j(e,re.MOUSE_DOWN,s=>{s.button===1&&s.preventDefault()})),Wn&&this._register(j(e,re.MOUSE_UP,s=>{s.button===1&&s.preventDefault()}));let o,n=!1;this._register(new Om(e,{onDragStart:s=>{n=this.onGroupDragStart(s,e)},onDrag:s=>{o=s},onDragEnter:s=>{if(e.classList.add("scroll"),s.target===e){if(!this.isSupportedDropTransfer(s)){s.dataTransfer&&(s.dataTransfer.dropEffect="none");return}this.editorTransfer.hasData(Wf.prototype)||s.dataTransfer&&(s.dataTransfer.dropEffect="copy"),this.updateDropFeedback(e,!0,s)}},onDragLeave:s=>{this.updateDropFeedback(e,!1,s),e.classList.remove("scroll")},onDragEnd:s=>{this.updateDropFeedback(e,!1,s),e.classList.remove("scroll"),this.onGroupDragEnd(s,o,e,n)},onDrop:s=>{if(this.updateDropFeedback(e,!1,s),e.classList.remove("scroll"),s.target===e){let l=this.groupTransfer.hasData(rI.prototype);this.onDrop(s,l?this.groupView.count:this.tabsModel.count,e)}}})),this._register(j(e,re.MOUSE_WHEEL,s=>{let l=this.groupView.activeEditor;if(!l||this.groupView.count<2)return;if(this.groupsView.partOptions.scrollToSwitchTabs===!0){if(s.shiftKey)return}else if(!s.shiftKey)return;let c=Date.now();if(c-this.lastMouseWheelEventTime<sI.MOUSE_WHEEL_EVENT_THRESHOLD-2*(Math.abs(s.deltaX)+Math.abs(s.deltaY)))return;this.lastMouseWheelEventTime=c;let u;if(s.deltaX+s.deltaY<-sI.MOUSE_WHEEL_DISTANCE_THRESHOLD)u=-1;else if(s.deltaX+s.deltaY>sI.MOUSE_WHEEL_DISTANCE_THRESHOLD)u=1;else return;let p=this.groupView.getEditorByIndex(this.groupView.getIndexOfEditor(l)+u);p&&(this.groupView.openEditor(p),$t.stop(s,!0))}));let r=s=>{$t.stop(s);let l=e;Vp(s)&&(l=new yn(Me(this.parent),s)),this.contextMenuService.showContextMenu({getAnchor:()=>l,menuId:D.EditorTabsBarContext,contextKeyService:this.contextKeyService,menuActionOptions:{shouldForwardArgs:!0},getActionsContext:()=>({groupId:this.groupView.id}),getKeyBinding:c=>this.getKeybinding(c),onHide:()=>this.groupView.focus()})};this._register(j(e,Gn.Contextmenu,s=>r(s))),this._register(j(e,re.CONTEXT_MENU,s=>r(s)))}doHandleDecorationsChange(){this.layout(this.dimensions)}updateEditorActionsToolbar(){super.updateEditorActionsToolbar(),this.layout(this.dimensions)}openEditor(e,t){let o=this.handleOpenedEditors();return t?.focusTabControl&&this.withTab(e,(n,r,s)=>s.focus()),o}openEditors(e){return this.handleOpenedEditors()}handleOpenedEditors(){this.updateTabsControlVisibility();let[e,t]=_y(this.tabsContainer,this.tabsScrollbar);for(let s=e.children.length;s<this.tabsModel.count;s++)e.appendChild(this.createTab(s,e,t));let o=this.didActiveEditorChange(),n=this.tabLabels;this.computeTabLabels();let r=!1;return o||n.length!==this.tabLabels.length||n.some((s,l)=>!this.equalsEditorInputLabel(s,this.tabLabels.at(l)))?(this.redraw({forceRevealActiveTab:!0}),r=!0):this.layout(this.dimensions,{forceRevealActiveTab:!0}),r}didActiveEditorChange(){return!!(!this.activeTabLabel?.editor&&this.tabsModel.activeEditor||this.activeTabLabel?.editor&&!this.tabsModel.activeEditor||!this.activeTabLabel?.editor||!this.tabsModel.isActive(this.activeTabLabel.editor))}equalsEditorInputLabel(e,t){return e===t?!0:!e||!t?!1:e.name===t.name&&e.description===t.description&&e.forceDescription===t.forceDescription&&e.title===t.title&&e.ariaLabel===t.ariaLabel}beforeCloseEditor(e){if(this.isMouseOverTabs&&this.groupsView.partOptions.tabSizing==="fixed"){let t=this.tabsModel.isLast(e);this.updateTabsFixedWidth(!t)}}closeEditor(e){this.handleClosedEditors()}closeEditors(e){this.handleClosedEditors()}handleClosedEditors(){if(this.tabsModel.count){let e=Oi(this.tabsContainer);for(;e.children.length>this.tabsModel.count;)e.lastChild?.remove(),Ue(this.tabDisposables.pop());this.computeTabLabels(),this.redraw({forceRevealActiveTab:!0})}else this.tabsContainer&&Rt(this.tabsContainer),this.tabDisposables=Ue(this.tabDisposables),this.tabResourceLabels.clear(),this.tabLabels=[],this.activeTabLabel=void 0,this.tabActionBars=[],this.clearEditorActionsToolbar(),this.updateTabsControlVisibility()}moveEditor(e,t,o){let n=this.tabLabels[t];this.tabLabels.splice(t,1),this.tabLabels.splice(o,0,n),this.forEachTab((r,s,l,c,u,p)=>{this.redrawTab(r,s,l,c,u,p)},Math.min(t,o),Math.max(t,o)),this.layout(this.dimensions,{forceRevealActiveTab:!0})}pinEditor(e){this.withTab(e,(t,o,n,r,s)=>this.redrawTabLabel(t,o,n,r,s))}stickEditor(e){this.doHandleStickyEditorChange(e)}unstickEditor(e){this.doHandleStickyEditorChange(e)}doHandleStickyEditorChange(e){this.withTab(e,(t,o,n,r,s,l)=>this.redrawTab(t,o,n,r,s,l)),this.forEachTab((t,o,n,r,s)=>{this.redrawTabBorders(o,n)}),this.layout(this.dimensions,{forceRevealActiveTab:!0})}setActive(e){this.forEachTab((t,o,n,r,s,l)=>{this.redrawTabSelectedActiveAndDirty(e,t,n,l)}),this.updateEditorActionsToolbar(),this.layout(this.dimensions,{forceRevealActiveTab:!0})}updateEditorSelections(){this.forEachTab((e,t,o,n,r,s)=>{this.redrawTabSelectedActiveAndDirty(this.groupsView.activeGroup===this.groupView,e,o,s)})}updateEditorLabel(e){this.updateEditorLabelScheduler.schedule()}doUpdateEditorLabels(){this.computeTabLabels(),this.forEachTab((e,t,o,n,r)=>{this.redrawTabLabel(e,t,o,n,r)}),this.layout(this.dimensions)}updateEditorDirty(e){this.withTab(e,(t,o,n,r,s,l)=>this.redrawTabSelectedActiveAndDirty(this.groupsView.activeGroup===this.groupView,t,n,l))}updateOptions(e,t){super.updateOptions(e,t),e.labelFormat!==t.labelFormat&&this.computeTabLabels(),e.titleScrollbarSizing!==t.titleScrollbarSizing&&this.updateTabsScrollbarSizing(),e.titleScrollbarVisibility!==t.titleScrollbarVisibility&&this.updateTabsScrollbarVisibility(),e.alwaysShowEditorActions!==t.alwaysShowEditorActions&&this.updateEditorActionsToolbar(),(e.tabSizingFixedMinWidth!==t.tabSizingFixedMinWidth||e.tabSizingFixedMaxWidth!==t.tabSizingFixedMaxWidth||e.tabSizing!==t.tabSizing)&&this.updateTabSizing(!0),(e.labelFormat!==t.labelFormat||e.tabActionLocation!==t.tabActionLocation||e.tabActionCloseVisibility!==t.tabActionCloseVisibility||e.tabActionUnpinVisibility!==t.tabActionUnpinVisibility||e.tabSizing!==t.tabSizing||e.pinnedTabSizing!==t.pinnedTabSizing||e.showIcons!==t.showIcons||e.hasIcons!==t.hasIcons||e.highlightModifiedTabs!==t.highlightModifiedTabs||e.wrapTabs!==t.wrapTabs||e.showTabIndex!==t.showTabIndex||!uo(e.decorations,t.decorations))&&this.redraw()}updateStyles(){this.redraw()}forEachTab(e,t,o){this.tabsModel.getEditors(1).forEach((n,r)=>{typeof t=="number"&&t>r||typeof o=="number"&&o<r||this.doWithTab(r,n,e)})}withTab(e,t){this.doWithTab(this.tabsModel.indexOf(e),e,t)}doWithTab(e,t,o){let r=Oi(this.tabsContainer).children[e],s=this.tabResourceLabels.get(e),l=this.tabLabels[e],c=this.tabActionBars[e];r&&s&&l&&o(t,e,r,s,l,c)}createTab(e,t,o){let n=_(".tab",{draggable:!0,role:"tab"}),r=ws.addTarget(n),s=_(".tab-border-top-container");n.appendChild(s);let l=this.tabResourceLabels.create(n,{hoverTargetOverride:n}),c=_(".tab-actions");n.appendChild(c);let u=this,p=new vYe({groupId:this.groupView.id,get editorIndex(){return u.toEditorIndex(e)}}),h=new ji(c,{ariaLabel:d(4043,null),actionRunner:p}),g=h.onWillRun(y=>{y.action.id===this.closeEditorAction.id&&this.blockRevealActiveTabOnce()}),f=hn(p,h,g,Z(Zm(this.tabActionBars,h))),v=_(".tab-fade-hider");n.appendChild(v);let b=_(".tab-border-bottom-container");n.appendChild(b);let S=this.registerTabListeners(n,e,t,o);return this.tabDisposables.push(hn(r,S,f,l)),n}toEditorIndex(e){let t=Oi(this.tabsModel.getEditorByIndex(e));return this.groupView.getIndexOfEditor(t)}registerTabListeners(e,t,o,n){let r=new P,s=async(p,h)=>{if(e.blur(),Vp(p)&&(p.button!==0||it&&p.ctrlKey)){p.button===1&&p.preventDefault();return}if(this.originatesFromTabActionBar(p))return;let g=this.tabsModel.getEditorByIndex(t);if(g)if(p.shiftKey){let f;if(this.lastSingleSelectSelectedEditor&&this.tabsModel.isSelected(this.lastSingleSelectSelectedEditor))f=this.lastSingleSelectSelectedEditor;else{let v=Oi(this.groupView.activeEditor);this.lastSingleSelectSelectedEditor=v,f=v}await this.selectEditorsBetween(g,f)}else if(p.ctrlKey&&!it||p.metaKey&&it)this.tabsModel.isSelected(g)?await this.unselectEditor(g):(await this.selectEditor(g),this.lastSingleSelectSelectedEditor=g);else{let f=this.tabsModel.isSelected(g)?this.groupView.selectedEditors.filter(v=>!v.matches(g)):[];await this.groupView.openEditor(g,{preserveFocus:h,activation:1},{inactiveSelection:f,focusTabControl:!0})}},l=p=>{$t.stop(p);let h=this.tabsModel.getEditorByIndex(t);h&&this.onTabContextMenu(h,p,e)};r.add(j(e,re.MOUSE_DOWN,p=>s(p,!1))),r.add(j(e,Gn.Tap,p=>s(p,!0))),r.add(j(e,Gn.Change,p=>{n.setScrollPosition({scrollLeft:n.getScrollPosition().scrollLeft-p.translationX})})),r.add(j(e,re.MOUSE_UP,async p=>{if($t.stop(p),e.blur(),Vp(p)&&(p.button!==0||it&&p.ctrlKey)||this.originatesFromTabActionBar(p))return;!(p.ctrlKey&&!it||p.metaKey&&it)&&!p.shiftKey&&this.groupView.selectedEditors.length>1&&await this.unselectAllEditors()})),r.add(j(e,re.AUXCLICK,p=>{if(p.button===1){$t.stop(p,!0);let h=this.tabsModel.getEditorByIndex(t);if(h){if(zxe(this.tabsModel,h,2,this.groupsView.partOptions))return;this.blockRevealActiveTabOnce(),this.closeEditorAction.run({groupId:this.groupView.id,editorIndex:this.groupView.getIndexOfEditor(h)})}}})),r.add(j(e,re.KEY_DOWN,p=>{let h=new Ii(p);h.shiftKey&&h.keyCode===68&&l(p)})),r.add(j(e,Gn.Contextmenu,p=>{l(p)})),r.add(j(e,re.KEY_UP,p=>{let h=new Ii(p),g=!1;if(h.equals(3)||h.equals(10)){g=!0;let f=this.tabsModel.getEditorByIndex(t);f&&this.groupView.openEditor(f)}else if([15,17,16,18,14,13].some(f=>h.equals(f))){let f=this.toEditorIndex(t);h.equals(15)||h.equals(16)?f=f-1:h.equals(17)||h.equals(18)?f=f+1:h.equals(14)?f=0:f=this.groupView.count-1;let v=this.groupView.getEditorByIndex(f);v&&(g=!0,this.groupView.openEditor(v,{preserveFocus:!0},{focusTabControl:!0}))}g&&$t.stop(p,!0),n.setScrollPosition({scrollLeft:o.scrollLeft})}));for(let p of[Gn.Tap,re.DBLCLICK])r.add(j(e,p,h=>{if(p===re.DBLCLICK)$t.stop(h);else if(h.tapCount!==2)return;let g=this.tabsModel.getEditorByIndex(t);if(g&&this.tabsModel.isPinned(g))switch(this.groupsView.partOptions.doubleClickTabToToggleEditorGroupSizes){case"maximize":this.groupsView.toggleMaximizeGroup(this.groupView);break;case"expand":this.groupsView.toggleExpandGroup(this.groupView);break;case"off":break}else this.groupView.pinEditor(g)}));r.add(j(e,re.CONTEXT_MENU,p=>{$t.stop(p,!0);let h=this.tabsModel.getEditorByIndex(t);h&&this.onTabContextMenu(h,p,e)},!0));let c,u=!1;return r.add(new Om(e,{onDragStart:p=>{let h=this.tabsModel.getEditorByIndex(t);if(!h)return;u=this.isNewWindowOperation(p);let g=this.groupView.selectedEditors;if(this.editorTransfer.setData(g.map(f=>new Wf({editor:f,groupId:this.groupView.id})),Wf.prototype),p.dataTransfer)if(p.dataTransfer.effectAllowed="copyMove",g.length>1){let f=`${h.getName()} + ${g.length-1}`;$N(p,e,f)}else p.dataTransfer.setDragImage(e,0,0);this.doFillResourceDataTransfers(g,p,u),$r(Me(this.parent),()=>this.updateDropFeedback(e,!1,p,t))},onDrag:p=>{c=p},onDragEnter:p=>{if(!this.isSupportedDropTransfer(p)){p.dataTransfer&&(p.dataTransfer.dropEffect="none");return}this.editorTransfer.hasData(Wf.prototype)||p.dataTransfer&&(p.dataTransfer.dropEffect="copy"),this.updateDropFeedback(e,!0,p,t)},onDragOver:(p,h)=>{if(h>=sI.DRAG_OVER_OPEN_TAB_THRESHOLD){let g=this.tabsModel.getEditorByIndex(t);g&&this.tabsModel.activeEditor!==g&&this.groupView.openEditor(g,{preserveFocus:!0})}this.updateDropFeedback(e,!0,p,t)},onDragEnd:async p=>{this.updateDropFeedback(e,!1,p,t);let h=this.editorTransfer.getData(Wf.prototype);if(this.editorTransfer.clearData(Wf.prototype),!u||MRt()||!h||h.length===0)return;let g=await this.maybeCreateAuxiliaryEditorPartAt(p,e);if(!g)return;let f=g.activeGroup,v=ZY(this.groupView,h.map(b=>b.identifier.editor));this.isMoveOperation(c??p,f.id,h[0].identifier.editor)?this.groupView.moveEditors(v,f):this.groupView.copyEditors(v,f),f.focus()},onDrop:p=>{this.updateDropFeedback(e,!1,p,t);let h=t;this.getTabDragOverLocation(p,e)==="right"&&h++,this.onDrop(p,h,o)}})),r}isSupportedDropTransfer(e){if(this.groupTransfer.hasData(rI.prototype)){let t=this.groupTransfer.getData(rI.prototype);return!(Array.isArray(t)&&t.length>0&&t[0].identifier===this.groupView.id)}return!!(this.editorTransfer.hasData(Wf.prototype)||e.dataTransfer&&e.dataTransfer.types.length>0)}updateDropFeedback(e,t,o,n){let r=typeof n=="number",s;t?r?s=this.computeDropTarget(o,n,e):s={leftElement:e.lastElementChild,rightElement:void 0}:s=void 0,this.updateDropTarget(s)}updateDropTarget(e){let t=this.dropTarget;if(t===e||t&&e&&t.leftElement===e.leftElement&&t.rightElement===e.rightElement)return;let o="drop-target-left",n="drop-target-right";t&&(t.leftElement?.classList.remove(o),t.rightElement?.classList.remove(n)),e&&(e.leftElement?.classList.add(o),e.rightElement?.classList.add(n)),this.dropTarget=e}getTabDragOverLocation(e,t){let o=t.getBoundingClientRect();return e.clientX-o.left<=o.width/2?"left":"right"}computeDropTarget(e,t,o){let n=this.getTabDragOverLocation(e,o)==="left",r=t===this.tabsModel.count-1;if(n&&t===0)return{leftElement:void 0,rightElement:o};if(!n&&r)return{leftElement:o,rightElement:void 0};let l=n?o.previousElementSibling:o,c=n?o:o.nextElementSibling;return{leftElement:l,rightElement:c}}async selectEditor(e){this.groupView.isActive(e)||await this.groupView.setSelection(e,this.groupView.selectedEditors)}async selectEditorsBetween(e,t){let o=this.groupView.getIndexOfEditor(e);if(o===-1)throw new ni;let n=this.groupView.getIndexOfEditor(t);if(n===-1)throw new ni;let r=this.groupView.selectedEditors,s=n;for(;s>=0&&s<=this.groupView.count-1;){s=n<o?s-1:s+1;let h=this.groupView.getEditorByIndex(s);if(!h||!this.groupView.isSelected(h))break;r=r.filter(g=>!g.matches(h))}let l=n<o?n:o,c=n<o?o:n,u=this.groupView.getEditors(1).slice(l,c+1);for(let h of u)this.groupView.isSelected(h)||r.push(h);let p=r.filter(h=>!h.matches(e));await this.groupView.setSelection(e,p)}async unselectEditor(e){let t=this.groupView.isActive(e);if(t&&this.groupView.selectedEditors.length===1)return;let o=Oi(this.groupView.activeEditor);if(t){let r=this.groupView.getEditors(0);for(let s=1;s<r.length;s++){let l=r[s];if(this.groupView.isSelected(l)){o=l;break}}}let n=this.groupView.selectedEditors.filter(r=>!r.matches(e)&&!r.matches(o));await this.groupView.setSelection(o,n)}async unselectAllEditors(){if(this.groupView.selectedEditors.length>1){let e=Oi(this.groupView.activeEditor);await this.groupView.setSelection(e,[])}}computeTabLabels(){let{labelFormat:e}=this.groupsView.partOptions,{verbosity:t,shortenDuplicates:o}=this.getLabelConfigFlags(e),n=[],r=-1;this.tabsModel.getEditors(1).forEach((s,l)=>{n.push({editor:s,name:s.getName(),description:s.getDescription(t),forceDescription:s.hasCapability(64),title:s.getTitle(2),ariaLabel:JY(s,l,this.groupView,this.editorPartsView.count)}),s===this.tabsModel.activeEditor&&(r=l)}),o&&this.shortenTabLabels(n),this.tabLabels=n,this.activeTabLabel=n[r]}shortenTabLabels(e){let t=new Map;for(let o of e)typeof o.description=="string"?$H(t,o.name,[]).push(o):o.description="";for(let[,o]of t){if(o.length===1&&!o[0].forceDescription){o[0].description="";continue}let n=new Map;for(let c of o)$H(n,c.description,[]).push(c);let r=!1;for(let[,c]of n)if(!r&&c.length>1){let[u,...p]=c.map(({editor:h})=>h.getDescription(2));r=p.some(h=>h!==u)}if(r){n.clear();for(let c of o)c.description=c.editor.getDescription(2),$H(n,c.description,[]).push(c)}let s=[];for(let[c]of n)s.push(c);if(s.length===1){for(let c of n.get(s[0])||[])c.forceDescription||(c.description="");continue}let l=wIe(s,this.path.sep);s.forEach((c,u)=>{for(let p of n.get(c)||[])p.description=l[u]})}}getLabelConfigFlags(e){switch(e){case"short":return{verbosity:0,shortenDuplicates:!1};case"medium":return{verbosity:1,shortenDuplicates:!1};case"long":return{verbosity:2,shortenDuplicates:!1};default:return{verbosity:1,shortenDuplicates:!0}}}redraw(e){if(this.tabsAndActionsContainer){let t=this.getColor(H9i);!t&&Ug(this.theme.type)&&(t=this.getColor(h8e)||this.getColor(gi)),t?(this.tabsAndActionsContainer.classList.add("tabs-border-bottom"),this.tabsAndActionsContainer.style.setProperty("--tabs-border-bottom-color",t.toString())):(this.tabsAndActionsContainer.classList.remove("tabs-border-bottom"),this.tabsAndActionsContainer.style.removeProperty("--tabs-border-bottom-color"))}this.forEachTab((t,o,n,r,s,l)=>{this.redrawTab(t,o,n,r,s,l)}),this.updateEditorActionsToolbar(),this.layout(this.dimensions,e)}redrawTab(e,t,o,n,r,s){let l=this.tabsModel.isSticky(t),c=this.groupsView.partOptions;this.redrawTabLabel(e,t,o,n,r);let u=l&&c.tabActionUnpinVisibility,p=!u&&c.tabActionCloseVisibility,h=u||p,g;h?g=u?this.unpinEditorAction:this.closeEditorAction:g=l?this.unpinEditorAction:this.closeEditorAction,s.hasAction(g)||(s.isEmpty()||s.clear(),s.push(g,{icon:!0,label:!1,keybinding:this.getKeybindingLabel(g)})),o.classList.toggle("pinned-action-off",l&&!u),o.classList.toggle("close-action-off",!u&&!p);for(let v of["left","right"])o.classList.toggle(`tab-actions-${v}`,h&&c.tabActionLocation===v);let f=l&&c.pinnedTabSizing==="shrink"?"shrink":c.tabSizing;for(let v of["fit","shrink","fixed"])o.classList.toggle(`sizing-${v}`,f===v);o.classList.toggle("has-icon",c.showIcons&&c.hasIcons),o.classList.toggle("sticky",l);for(let v of["normal","compact","shrink"])o.classList.toggle(`sticky-${v}`,l&&c.pinnedTabSizing===v);if(!c.wrapTabs&&l&&c.pinnedTabSizing!=="normal"){let v=0;switch(c.pinnedTabSizing){case"compact":v=sI.TAB_WIDTH.compact;break;case"shrink":v=sI.TAB_WIDTH.shrink;break}o.style.left=`${t*v}px`}else o.style.left="auto";this.redrawTabBorders(t,o),this.redrawTabSelectedActiveAndDirty(this.groupsView.activeGroup===this.groupView,e,o,s)}redrawTabLabel(e,t,o,n,r){let s=this.groupsView.partOptions,l,c,u=!1,p=!!s.decorations?.badges,h=!!s.decorations?.colors,g;s.pinnedTabSizing==="compact"&&this.tabsModel.isSticky(t)?(l=s.showIcons&&s.hasIcons?"":r.name?.charAt(0).toUpperCase(),g="",u=!0,p=!1):(l=r.name,c=s.showTabIndex?`${this.toEditorIndex(t)+1}: `:void 0,g=r.description||""),r.ariaLabel&&(o.setAttribute("aria-label",r.ariaLabel),o.setAttribute("aria-description","")),n.setResource({name:l,description:g,resource:no.getOriginalUri(e,{supportSideBySide:3})},{title:this.getHoverTitle(e),extraClasses:si(["tab-label",p?"tab-label-has-badge":void 0].concat(e.getLabelExtraClasses())),italic:!this.tabsModel.isPinned(e),forceLabel:u,fileDecorations:{colors:h,badges:p},icon:e.getIcon(),hideIcon:s.showIcons===!1,namePrefix:c});let f=no.getOriginalUri(e,{supportSideBySide:1});f?o.setAttribute("data-resource-name",Ra(f)):o.removeAttribute("data-resource-name")}redrawTabSelectedActiveAndDirty(e,t,o,n){let r=this.tabsModel.isActive(t),s=this.doRedrawTabDirty(e,r,t,o);this.doRedrawTabActive(e,!s,t,o,n)}doRedrawTabActive(e,t,o,n,r){let s=this.tabsModel.isActive(o),l=this.tabsModel.isSelected(o);if(n.classList.toggle("active",s),n.classList.toggle("selected",l),n.setAttribute("aria-selected",s?"true":"false"),n.tabIndex=s?0:-1,r.setFocusable(s),s){let u=this.getColor(e?Lxe:A9i);n.classList.toggle("tab-border-bottom",!!u),n.style.setProperty("--tab-border-bottom-color",u??"")}let c=null;t&&(s&&(c=this.getColor(e?m8e:N9i)),c===null&&l&&(c=this.getColor(O9i))),n.classList.toggle("tab-border-top",!!c),n.style.setProperty("--tab-border-top-color",c??"")}doRedrawTabDirty(e,t,o,n){let r=!1;if(o.isDirty()&&!o.isSaving())if(n.classList.add("dirty"),this.groupsView.partOptions.highlightModifiedTabs){let s;e&&t?s=this.getColor(Rxe):e&&!t?s=this.getColor(mEt):!e&&t?s=this.getColor(W9i):s=this.getColor(V9i),s&&(r=!0,n.classList.add("dirty-border-top"),n.style.setProperty("--tab-dirty-border-top-color",s))}else n.classList.remove("dirty-border-top"),n.style.removeProperty("--tab-dirty-border-top-color");else n.classList.remove("dirty","dirty-border-top"),n.style.removeProperty("--tab-dirty-border-top-color");return r}redrawTabBorders(e,t){let n=this.tabsModel.isSticky(e)&&this.tabsModel.stickyCount===e+1,r=this.tabsModel.stickyCount!==this.tabsModel.count,s=(n&&r?this.getColor(P9i):void 0)||this.getColor(h8e)||this.getColor(gi);t.style.borderRight=s?`1px solid ${s}`:"",t.style.outlineColor=this.getColor(qs)||""}prepareEditorActions(e){return this.groupsView.activeGroup===this.groupView?e:{primary:this.groupsView.partOptions.alwaysShowEditorActions?e.primary:e.primary.filter(o=>o.id===H5),secondary:e.secondary}}getHeight(){return this.dimensions.used?this.dimensions.used.height:this.computeHeight()}computeHeight(){let e;return this.visible?this.groupsView.partOptions.wrapTabs&&this.tabsAndActionsContainer?.classList.contains("wrapping")?e=this.tabsAndActionsContainer.offsetHeight:e=this.tabHeight:e=0,e}layout(e,t){if(Object.assign(this.dimensions,e),this.visible){if(!this.layoutScheduler.value){let o=$r(Me(this.parent),()=>{this.doLayout(this.dimensions,this.layoutScheduler.value?.options),this.layoutScheduler.clear()});this.layoutScheduler.value={options:t,dispose:()=>o.dispose()}}t?.forceRevealActiveTab&&(this.layoutScheduler.value.options={...this.layoutScheduler.value.options,forceRevealActiveTab:!0})}return this.dimensions.used||(this.dimensions.used=new ai(e.container.width,this.computeHeight())),this.dimensions.used}doLayout(e,t){e.container!==ai.None&&e.available!==ai.None&&this.doLayoutTabs(e,t);let o=this.dimensions.used,n=this.dimensions.used=new ai(e.container.width,this.computeHeight());o&&o.height!==n.height&&this.groupView.relayout()}doLayoutTabs(e,t){this.doLayoutTabsWrapping(e)||this.doLayoutTabsNonWrapping(t)}doLayoutTabsWrapping(e){let[t,o,n,r]=_y(this.tabsAndActionsContainer,this.tabsContainer,this.editorActionsToolbarContainer,this.tabsScrollbar),s=t.classList.contains("wrapping"),l=s;function c(u){l=u,t.classList.toggle("wrapping",l),o.style.setProperty("--last-tab-margin-right",l?`${n.offsetWidth}px`:"0");for(let p of o.children)p.classList.remove("last-in-row")}if(this.groupsView.partOptions.wrapTabs){let u=o.offsetWidth,p=o.scrollWidth,h=()=>{let g=this.getLastTab();return g?!(g.offsetWidth+n.offsetWidth-e.available.width>1):!0};(l||p>u&&h())&&c(!0),l&&(o.offsetHeight>e.available.height||p===u&&o.offsetHeight===this.tabHeight||!h())&&c(!1)}else s&&c(!1);if(l&&!s){let u=o.offsetWidth;r.setScrollDimensions({width:u,scrollWidth:u})}if(l){let u=new Map,p,h;for(let g of o.children){let f=g,v=f.offsetTop;v!==p&&(p=v,h&&u.set(h,!0)),h=f,u.set(f,!1)}h&&u.set(h,!0);for(let[g,f]of u)g.classList.toggle("last-in-row",f)}return l}doLayoutTabsNonWrapping(e){let[t,o]=_y(this.tabsContainer,this.tabsScrollbar),n=t.offsetWidth,r=t.scrollWidth,s=0;if(this.tabsModel.stickyCount>0){let T=0;switch(this.groupsView.partOptions.pinnedTabSizing){case"compact":T=sI.TAB_WIDTH.compact;break;case"shrink":T=sI.TAB_WIDTH.shrink;break}s=this.tabsModel.stickyCount*T}let l=this.tabsModel.activeEditor?this.getTabAndIndex(this.tabsModel.activeEditor):void 0,[c,u]=l??[void 0,void 0],p=this.groupsView.partOptions.pinnedTabSizing!=="normal"&&typeof u=="number"&&this.tabsModel.isSticky(u),h=n-s;this.tabsModel.stickyCount>0&&h<sI.TAB_WIDTH.fit?(t.classList.add("disable-sticky-tabs"),h=n,s=0,p=!1):t.classList.remove("disable-sticky-tabs");let g,f;!this.blockRevealActiveTab&&c&&(g=c.offsetLeft,f=c.offsetWidth);let{width:v,scrollWidth:b}=o.getScrollDimensions();o.setScrollDimensions({width:n,scrollWidth:r});let S=v!==n||b!==r;if(this.blockRevealActiveTab||typeof g!="number"||typeof f!="number"||p||!S&&!e?.forceRevealActiveTab){this.blockRevealActiveTab=!1;return}let y=o.getScrollPosition().scrollLeft,w=f<=h,k=g-s;w&&y+h<k+f?o.setScrollPosition({scrollLeft:y+(k+f-(y+h))}):(y>k||!w)&&o.setScrollPosition({scrollLeft:k})}updateTabsControlVisibility(){Oi(this.tabsAndActionsContainer).classList.toggle("empty",!this.visible),!this.visible&&this.dimensions&&(this.dimensions.used=void 0)}get visible(){return this.tabsModel.count>0}getTabAndIndex(e){let t=this.tabsModel.indexOf(e),o=this.getTabAtIndex(t);if(o)return[o,t]}getTabAtIndex(e){if(e>=0)return Oi(this.tabsContainer).children[e]}getLastTab(){return this.getTabAtIndex(this.tabsModel.count-1)}blockRevealActiveTabOnce(){this.blockRevealActiveTab=!0}originatesFromTabActionBar(e){let t;return Vp(e)?t=e.target||e.srcElement:t=e.initialTarget,!!Nh(t,"action-item","tab")}async onDrop(e,t,o){$t.stop(e,!0),this.updateDropFeedback(o,!1,e,t),o.classList.remove("scroll");let n=this.tabsModel instanceof tDe?t+this.groupView.stickyCount:t,r={sticky:this.tabsModel instanceof eDe&&this.tabsModel.stickyCount===n,index:n};if(this.groupTransfer.hasData(rI.prototype)){let s=this.groupTransfer.getData(rI.prototype);if(Array.isArray(s)&&s.length>0){let l=this.editorPartsView.getGroup(s[0].identifier);if(l){let c={index:n};this.isMoveOperation(e,l.id)||(c.mode=0),this.groupsView.mergeGroup(l,this.groupView,c)}this.groupView.focus(),this.groupTransfer.clearData(rI.prototype)}}else if(this.editorTransfer.hasData(Wf.prototype)){let s=this.editorTransfer.getData(Wf.prototype);if(Array.isArray(s)&&s.length>0){let l=this.editorPartsView.getGroup(s[0].identifier.groupId);if(l)for(let c of s){let u=c.identifier.editor;if(l.id!==c.identifier.groupId)continue;let p=l.getIndexOfEditor(u);l===this.groupView&&p<n&&n--,this.isMoveOperation(e,c.identifier.groupId,u)?l.moveEditor(u,this.groupView,{...r,index:n}):l.copyEditor(u,this.groupView,{...r,index:n}),n++}}this.groupView.focus(),this.editorTransfer.clearData(Wf.prototype)}else if(this.treeItemsTransfer.hasData(sC.prototype)){let s=this.treeItemsTransfer.getData(sC.prototype);if(Array.isArray(s)&&s.length>0){let l=[];for(let c of s){let u=await this.treeViewsDragAndDropService.removeDragOperationTransfer(c.identifier);if(u){let p=await RRt(u);l.push(...p.map(h=>({...h,options:{...h.options,pinned:!0,index:n}})))}}this.editorService.openEditors(l,this.groupView,{validateTrust:!0})}this.treeItemsTransfer.clearData(sC.prototype)}else this.instantiationService.createInstance(sF,{allowWorkspaceOpen:!1}).handleDrop(e,Me(this.parent),()=>this.groupView,()=>this.groupView.focus(),r)}dispose(){super.dispose(),this.tabDisposables=Ue(this.tabDisposables)}};sI=I([m(5,ze),m(6,F),m(7,X),m(8,_e),m(9,Ne),m(10,Ge),m(11,De),m(12,ee),m(13,wn),m(14,Yq),m(15,ul),m(16,oi)],sI);is((a,i)=>{let e=a.getColor(h8e);e&&i.addRule(`
.monaco-workbench .part.editor > .content .editor-group-container > .title > .tabs-and-actions-container.wrapping .tabs-container > .tab {
border-bottom: 1px solid ${e};
}
`);let t=a.getColor(qs);t&&i.addRule(`
.monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab.active,
.monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab.active:hover {
outline: 1px solid;
outline-offset: -5px;
}
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.selected:not(.active):not(:hover) {
outline: 1px dotted;
outline-offset: -5px;
}
.monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab.active:focus {
outline-style: dashed;
}
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.active {
outline: 1px dotted;
outline-offset: -5px;
}
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab:hover {
outline: 1px dashed;
outline-offset: -5px;
}
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.active > .tab-actions .action-label,
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.active:hover > .tab-actions .action-label,
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.dirty > .tab-actions .action-label,
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sticky > .tab-actions .action-label,
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab:hover > .tab-actions .action-label {
opacity: 1 !important;
}
`);let o=a.getColor(gi);o&&i.addRule(`
.monaco-workbench .part.editor > .content .editor-group-container > .title .editor-actions {
outline: 1px solid ${o}
}
`);let n=a.getColor(dEt);n&&i.addRule(`
.monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab:not(.selected):hover {
background-color: ${n} !important;
}
`);let r=a.getColor(R9i);r&&i.addRule(`
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab:not(.selected):hover {
background-color: ${r} !important;
}
`);let s=a.getColor(uEt);s&&i.addRule(`
.monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab:not(.selected):hover {
color: ${s} !important;
}
`);let l=a.getColor(M9i);l&&i.addRule(`
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab:not(.selected):hover {
color: ${l} !important;
}
`);let c=a.getColor(pEt);c&&i.addRule(`
.monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab:hover > .tab-border-bottom-container {
display: block;
position: absolute;
left: 0;
pointer-events: none;
width: 100%;
z-index: 10;
bottom: 0;
height: 1px;
background-color: ${c};
}
`);let u=a.getColor(F9i);if(u&&i.addRule(`
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab:hover > .tab-border-bottom-container {
display: block;
position: absolute;
left: 0;
pointer-events: none;
width: 100%;
z-index: 10;
bottom: 0;
height: 1px;
background-color: ${u};
}
`),!Ug(a.type)&&!Vb&&!t){let p=DO(a),h=a.getColor(qo),g=a.getColor(fEt),f=a.getColor(_E),v;g&&h&&(v=g.flatten(h,h,p));let b;g&&h&&f&&h&&(b=g.flatten(h,f,h,p));let S=(O,V,U=!1)=>`
.monaco-workbench .part.editor > .content:not(.dragged-over) .editor-group-container${U?".active":""} > .title .tabs-container > .tab.sizing-shrink:not(.dragged):not(.sticky-compact):hover > .tab-label > .monaco-icon-label-container::after,
.monaco-workbench .part.editor > .content:not(.dragged-over) .editor-group-container${U?".active":""} > .title .tabs-container > .tab.sizing-fixed:not(.dragged):not(.sticky-compact):hover > .tab-label > .monaco-icon-label-container::after {
background: linear-gradient(to left, ${O}, transparent) !important;
}
.monaco-workbench .part.editor > .content.dragged-over .editor-group-container${U?".active":""} > .title .tabs-container > .tab.sizing-shrink:not(.dragged):not(.sticky-compact):hover > .tab-label > .monaco-icon-label-container::after,
.monaco-workbench .part.editor > .content.dragged-over .editor-group-container${U?".active":""} > .title .tabs-container > .tab.sizing-fixed:not(.dragged):not(.sticky-compact):hover > .tab-label > .monaco-icon-label-container::after {
background: linear-gradient(to left, ${V}, transparent) !important;
}
`;if(n&&v&&b){let O=n.flatten(v),V=n.flatten(b);i.addRule(S(O,V,!0))}if(r&&v&&b){let O=r.flatten(v),V=r.flatten(b);i.addRule(S(O,V))}if(f&&b){let O=f.flatten(b);i.addRule(`
.monaco-workbench .part.editor > .content.dragged-over .editor-group-container.active > .title .tabs-container > .tab.sizing-shrink.dragged-over:not(.active):not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after,
.monaco-workbench .part.editor > .content.dragged-over .editor-group-container:not(.active) > .title .tabs-container > .tab.sizing-shrink.dragged-over:not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after,
.monaco-workbench .part.editor > .content.dragged-over .editor-group-container.active > .title .tabs-container > .tab.sizing-fixed.dragged-over:not(.active):not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after,
.monaco-workbench .part.editor > .content.dragged-over .editor-group-container:not(.active) > .title .tabs-container > .tab.sizing-fixed.dragged-over:not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after {
background: linear-gradient(to left, ${O}, transparent) !important;
}
`)}let y=(O,V,U,G)=>`
.monaco-workbench .part.editor > .content:not(.dragged-over) .editor-group-container${U?".active":":not(.active)"} > .title .tabs-container > .tab.sizing-shrink${G?".active":""}:not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after,
.monaco-workbench .part.editor > .content:not(.dragged-over) .editor-group-container${U?".active":":not(.active)"} > .title .tabs-container > .tab.sizing-fixed${G?".active":""}:not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after {
background: linear-gradient(to left, ${O}, transparent);
}
.monaco-workbench .part.editor > .content.dragged-over .editor-group-container${U?".active":":not(.active)"} > .title .tabs-container > .tab.sizing-shrink${G?".active":""}:not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after,
.monaco-workbench .part.editor > .content.dragged-over .editor-group-container${U?".active":":not(.active)"} > .title .tabs-container > .tab.sizing-fixed${G?".active":""}:not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after {
background: linear-gradient(to left, ${V}, transparent);
}
`,w=a.getColor(gEt);if(w&&v&&b){let O=w.flatten(v),V=w.flatten(b);i.addRule(y(O,V,!0,!0))}let k=a.getColor(_9i);if(k&&v&&b){let O=k.flatten(v),V=k.flatten(b);i.addRule(y(O,V,!1,!0))}let T=a.getColor(Zci);if(T&&v&&b){let O=T.flatten(v),V=T.flatten(b);i.addRule(y(O,V,!0,!1))}let N=a.getColor(D9i);if(N&&v&&b){let O=N.flatten(v),V=N.flatten(b);i.addRule(y(O,V,!1,!1))}}});var uOt=class extends GP{constructor(){super(...arguments);this.activeLabel=Object.create(null)}get breadcrumbsControl(){return this.breadcrumbsControlFactory?.control}create(e){super.create(e);let t=this.titleContainer=e;t.draggable=!0,this.registerContainerListeners(t),this._register(ws.addTarget(t));let o=_(".label-container");return t.appendChild(o),this.editorLabel=this._register(this.instantiationService.createInstance(rk,o,{})).element,this._register(j(this.editorLabel.element,re.CLICK,n=>this.onTitleLabelClick(n))),this.breadcrumbsControlFactory=this._register(this.instantiationService.createInstance(RJ,o,this.groupView,{showFileIcons:!1,showSymbolIcons:!0,showDecorationColors:!1,widgetStyles:{...f1,breadcrumbsBackground:Oe.transparent.toString()},showPlaceholder:!1,dragEditor:!0})),this._register(this.breadcrumbsControlFactory.onDidEnablementChange(()=>this.handleBreadcrumbsEnablementChange())),t.classList.toggle("breadcrumbs",!!this.breadcrumbsControl),this._register(Z(()=>t.classList.remove("breadcrumbs"))),this.createEditorActionsToolBar(t,["title-actions"]),t}registerContainerListeners(e){let t,o=!1;this._register(new Om(e,{onDragStart:n=>{o=this.onGroupDragStart(n,e)},onDrag:n=>{t=n},onDragEnd:n=>{this.onGroupDragEnd(n,t,e,o)}})),this._register(j(e,re.DBLCLICK,n=>this.onTitleDoubleClick(n))),this._register(j(e,re.AUXCLICK,n=>this.onTitleAuxClick(n))),this._register(j(e,Gn.Tap,n=>this.onTitleTap(n)));for(let n of[re.CONTEXT_MENU,Gn.Contextmenu])this._register(j(e,n,r=>{this.tabsModel.activeEditor&&this.onTabContextMenu(this.tabsModel.activeEditor,r,e)}))}onTitleLabelClick(e){$t.stop(e,!1),setTimeout(()=>this.quickInputService.quickAccess.show())}onTitleDoubleClick(e){$t.stop(e),this.groupView.pinEditor()}onTitleAuxClick(e){e.button===1&&this.tabsModel.activeEditor&&($t.stop(e,!0),zxe(this.tabsModel,this.tabsModel.activeEditor,2,this.groupsView.partOptions)||this.groupView.closeEditor(this.tabsModel.activeEditor))}onTitleTap(e){let t=e.initialTarget;!Ao(t)||!this.editorLabel||!gs(t,this.editorLabel.element)||setTimeout(()=>this.quickInputService.quickAccess.show(),50)}openEditor(e){return this.doHandleOpenEditor()}openEditors(e){return this.doHandleOpenEditor()}doHandleOpenEditor(){let e=this.ifActiveEditorChanged(()=>this.redraw());return e||this.ifActiveEditorPropertiesChanged(()=>this.redraw()),e}beforeCloseEditor(e){}closeEditor(e){this.ifActiveEditorChanged(()=>this.redraw())}closeEditors(e){this.ifActiveEditorChanged(()=>this.redraw())}moveEditor(e,t,o){this.ifActiveEditorChanged(()=>this.redraw())}pinEditor(e){this.ifEditorIsActive(e,()=>this.redraw())}stickEditor(e){}unstickEditor(e){}setActive(e){this.redraw()}updateEditorSelections(){}updateEditorLabel(e){this.ifEditorIsActive(e,()=>this.redraw())}updateEditorDirty(e){this.ifEditorIsActive(e,()=>{let t=Oi(this.titleContainer);e.isDirty()&&!e.isSaving()?t.classList.add("dirty"):t.classList.remove("dirty")})}updateOptions(e,t){super.updateOptions(e,t),(e.labelFormat!==t.labelFormat||!uo(e.decorations,t.decorations))&&this.redraw()}updateStyles(){this.redraw()}handleBreadcrumbsEnablementChange(){Oi(this.titleContainer).classList.toggle("breadcrumbs",!!this.breadcrumbsControl),this.redraw()}ifActiveEditorChanged(e){return!this.activeLabel.editor&&this.tabsModel.activeEditor||this.activeLabel.editor&&!this.tabsModel.activeEditor||!this.activeLabel.editor||!this.tabsModel.isActive(this.activeLabel.editor)?(e(),!0):!1}ifActiveEditorPropertiesChanged(e){!this.activeLabel.editor||!this.tabsModel.activeEditor||this.activeLabel.pinned!==this.tabsModel.isPinned(this.tabsModel.activeEditor)&&e()}ifEditorIsActive(e,t){this.tabsModel.isActive(e)&&t()}redraw(){let e=this.tabsModel.activeEditor??void 0,t=this.groupsView.partOptions,o=e?this.tabsModel.isPinned(e):!1,n=this.groupsView.activeGroup===this.groupView;this.activeLabel={editor:e,pinned:o},this.breadcrumbsControl&&(n?(this.breadcrumbsControl.update(),this.breadcrumbsControl.domNode.classList.toggle("preview",!o)):this.breadcrumbsControl.hide());let[r,s]=_y(this.titleContainer,this.editorLabel);if(!e)r.classList.remove("dirty"),s.clear(),this.clearEditorActionsToolbar();else{this.updateEditorDirty(e);let{labelFormat:l}=this.groupsView.partOptions,c;this.breadcrumbsControl&&!this.breadcrumbsControl.isHidden()||l==="default"&&!n?c="":c=e.getDescription(this.getVerbosity(l))||"",s.setResource({resource:no.getOriginalUri(e,{supportSideBySide:3}),name:e.getName(),description:c},{title:this.getHoverTitle(e),italic:!o,extraClasses:["single-tab","title-label"].concat(e.getLabelExtraClasses()),fileDecorations:{colors:!!t.decorations?.colors,badges:!!t.decorations?.badges},icon:e.getIcon(),hideIcon:t.showIcons===!1}),n?r.style.color=this.getColor(ZW)||"":r.style.color=this.getColor(L9i)||"",this.updateEditorActionsToolbar()}}getVerbosity(e){switch(e){case"short":return 0;case"long":return 2;default:return 1}}prepareEditorActions(e){return this.groupsView.activeGroup===this.groupView?e:{primary:this.groupsView.partOptions.alwaysShowEditorActions?e.primary:e.primary.filter(o=>o.id===OC||o.id===H5),secondary:e.secondary}}getHeight(){return this.tabHeight}layout(e){return this.breadcrumbsControl?.layout(void 0),new ai(e.container.width,this.getHeight())}};var iDe=class extends C{constructor(e,t,o,n,r,s){super();this.parent=e;this.groupsView=o;this.groupView=n;this.model=r;this.instantiationService=s;let l=this._register(new eDe(this.model)),c=this._register(new tDe(this.model));this.stickyEditorTabsControl=this._register(this.instantiationService.createInstance(sI,this.parent,t,this.groupsView,this.groupView,l)),this.unstickyEditorTabsControl=this._register(this.instantiationService.createInstance(sI,this.parent,t,this.groupsView,this.groupView,c)),this.handleTabBarsStateChange()}handleTabBarsStateChange(){this.activeControl=this.model.activeEditor?this.getEditorTabsController(this.model.activeEditor):void 0,this.handleTabBarsLayoutChange()}handleTabBarsLayoutChange(){if(this.groupView.count===0)return;let e=this.parent.classList.contains("two-tab-bars"),t=this.groupView.count!==this.groupView.stickyCount&&this.groupView.stickyCount>0;this.parent.classList.toggle("two-tab-bars",t),e!==t&&this.groupView.relayout()}didActiveControlChange(){return this.activeControl!==(this.model.activeEditor?this.getEditorTabsController(this.model.activeEditor):void 0)}getEditorTabsController(e){return this.model.isSticky(e)?this.stickyEditorTabsControl:this.unstickyEditorTabsControl}openEditor(e,t){let o=this.didActiveControlChange(),r=this.getEditorTabsController(e).openEditor(e,t)||o;return r&&this.handleOpenedEditors(),r}openEditors(e){let t=e.filter(c=>this.model.isSticky(c)),o=e.filter(c=>!this.model.isSticky(c)),n=this.didActiveControlChange(),r=this.stickyEditorTabsControl.openEditors(t),s=this.unstickyEditorTabsControl.openEditors(o),l=r||s||n;return l&&this.handleOpenedEditors(),l}handleOpenedEditors(){this.handleTabBarsStateChange()}beforeCloseEditor(e){this.getEditorTabsController(e).beforeCloseEditor(e)}closeEditor(e){this.stickyEditorTabsControl.closeEditor(e),this.unstickyEditorTabsControl.closeEditor(e),this.handleClosedEditors()}closeEditors(e){let t=e.filter(n=>this.model.isSticky(n)),o=e.filter(n=>!this.model.isSticky(n));this.stickyEditorTabsControl.closeEditors(t),this.unstickyEditorTabsControl.closeEditors(o),this.handleClosedEditors()}handleClosedEditors(){this.handleTabBarsStateChange()}moveEditor(e,t,o,n){n?(this.model.isSticky(e)?(this.stickyEditorTabsControl.openEditor(e),this.unstickyEditorTabsControl.closeEditor(e)):(this.stickyEditorTabsControl.closeEditor(e),this.unstickyEditorTabsControl.openEditor(e)),this.handleTabBarsStateChange()):this.model.isSticky(e)?this.stickyEditorTabsControl.moveEditor(e,t,o,n):this.unstickyEditorTabsControl.moveEditor(e,t-this.model.stickyCount,o-this.model.stickyCount,n)}pinEditor(e){this.getEditorTabsController(e).pinEditor(e)}stickEditor(e){this.unstickyEditorTabsControl.closeEditor(e),this.stickyEditorTabsControl.openEditor(e),this.handleTabBarsStateChange()}unstickEditor(e){this.stickyEditorTabsControl.closeEditor(e),this.unstickyEditorTabsControl.openEditor(e),this.handleTabBarsStateChange()}setActive(e){this.stickyEditorTabsControl.setActive(e),this.unstickyEditorTabsControl.setActive(e)}updateEditorSelections(){this.stickyEditorTabsControl.updateEditorSelections(),this.unstickyEditorTabsControl.updateEditorSelections()}updateEditorLabel(e){this.getEditorTabsController(e).updateEditorLabel(e)}updateEditorDirty(e){this.getEditorTabsController(e).updateEditorDirty(e)}updateOptions(e,t){this.stickyEditorTabsControl.updateOptions(e,t),this.unstickyEditorTabsControl.updateOptions(e,t)}layout(e){let t=this.stickyEditorTabsControl.layout(e),o={container:e.container,available:new ai(e.available.width,e.available.height-t.height)},n=this.unstickyEditorTabsControl.layout(o);return new ai(e.container.width,t.height+n.height)}getHeight(){return this.stickyEditorTabsControl.getHeight()+this.unstickyEditorTabsControl.getHeight()}dispose(){this.parent.classList.toggle("two-tab-bars",!1),super.dispose()}};iDe=I([m(5,F)],iDe);var pOt=class extends GP{constructor(){super(...arguments);this.activeEditor=null}prepareEditorActions(e){return{primary:[],secondary:[]}}openEditor(e){return this.handleOpenedEditors()}openEditors(e){return this.handleOpenedEditors()}handleOpenedEditors(){let e=this.activeEditorChanged();return this.activeEditor=this.tabsModel.activeEditor,e}activeEditorChanged(){return!!(!this.activeEditor&&this.tabsModel.activeEditor||this.activeEditor&&!this.tabsModel.activeEditor||!this.activeEditor||!this.tabsModel.isActive(this.activeEditor))}beforeCloseEditor(e){}closeEditor(e){this.handleClosedEditors()}closeEditors(e){this.handleClosedEditors()}handleClosedEditors(){this.activeEditor=this.tabsModel.activeEditor}moveEditor(e,t,o){}pinEditor(e){}stickEditor(e){}unstickEditor(e){}setActive(e){}updateEditorSelections(){}updateEditorLabel(e){}updateEditorDirty(e){}getHeight(){return 0}layout(e){return new ai(e.container.width,this.getHeight())}};var oDe=class extends Jd{constructor(e,t,o,n,r,s,l){super(l);this.parent=e;this.editorPartsView=t;this.groupsView=o;this.groupView=n;this.model=r;this.instantiationService=s;this.editorTabsControlDisposable=this._register(new P);this.breadcrumbsControlDisposables=this._register(new P);this.editorTabsControl=this.createEditorTabsControl(),this.breadcrumbsControlFactory=this.createBreadcrumbsControl()}get breadcrumbsControl(){return this.breadcrumbsControlFactory?.control}createEditorTabsControl(){let e;switch(this.groupsView.partOptions.showTabs){case"none":e=pOt;break;case"single":e=uOt;break;default:e=this.groupsView.partOptions.pinnedTabsOnSeparateRow?iDe:sI;break}let t=this.instantiationService.createInstance(e,this.parent,this.editorPartsView,this.groupsView,this.groupView,this.model);return this.editorTabsControlDisposable.add(t)}createBreadcrumbsControl(){if(this.groupsView.partOptions.showTabs==="single")return;let e=_(".breadcrumbs-below-tabs");this.parent.appendChild(e);let t=this.breadcrumbsControlDisposables.add(this.instantiationService.createInstance(RJ,e,this.groupView,{showFileIcons:!0,showSymbolIcons:!0,showDecorationColors:!1,showPlaceholder:!0,dragEditor:!1}));return this.breadcrumbsControlDisposables.add(t.onDidEnablementChange(()=>this.groupView.relayout())),this.breadcrumbsControlDisposables.add(t.onDidVisibilityChange(()=>this.groupView.relayout())),t}openEditor(e,t){let o=this.editorTabsControl.openEditor(e,t);this.handleOpenedEditors(o)}openEditors(e){let t=this.editorTabsControl.openEditors(e);this.handleOpenedEditors(t)}handleOpenedEditors(e){e?this.breadcrumbsControl?.update():this.breadcrumbsControl?.revealLast()}beforeCloseEditor(e){return this.editorTabsControl.beforeCloseEditor(e)}closeEditor(e){this.editorTabsControl.closeEditor(e),this.handleClosedEditors()}closeEditors(e){this.editorTabsControl.closeEditors(e),this.handleClosedEditors()}handleClosedEditors(){this.groupView.activeEditor||this.breadcrumbsControl?.update()}moveEditor(e,t,o,n){return this.editorTabsControl.moveEditor(e,t,o,n)}pinEditor(e){return this.editorTabsControl.pinEditor(e)}stickEditor(e){return this.editorTabsControl.stickEditor(e)}unstickEditor(e){return this.editorTabsControl.unstickEditor(e)}setActive(e){return this.editorTabsControl.setActive(e)}updateEditorSelections(){this.editorTabsControl.updateEditorSelections()}updateEditorLabel(e){return this.editorTabsControl.updateEditorLabel(e)}updateEditorDirty(e){return this.editorTabsControl.updateEditorDirty(e)}updateOptions(e,t){e.showTabs!==t.showTabs||t.showTabs!=="single"&&e.pinnedTabsOnSeparateRow!==t.pinnedTabsOnSeparateRow?(this.editorTabsControlDisposable.clear(),this.breadcrumbsControlDisposables.clear(),Rt(this.parent),this.editorTabsControl=this.createEditorTabsControl(),this.breadcrumbsControlFactory=this.createBreadcrumbsControl()):this.editorTabsControl.updateOptions(e,t)}layout(e){let t=this.editorTabsControl.layout(e),o;return this.breadcrumbsControl?.isHidden()===!1&&(o=new ai(e.container.width,bc.HEIGHT),this.breadcrumbsControl.layout(o)),new ai(e.container.width,t.height+(o?o.height:0))}getHeight(){let e=this.editorTabsControl.getHeight(),t=this.breadcrumbsControl?.isHidden()===!1?bc.HEIGHT:0;return{total:e+t,offset:e}}};oDe=I([m(5,F),m(6,De)],oDe);var Uf=class extends Jd{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N,O){super(u);this.editorPartsView=t;this.groupsView=o;this.groupsLabel=n;this._index=r;this.instantiationService=l;this.contextKeyService=c;this.telemetryService=p;this.keybindingService=h;this.menuService=g;this.contextMenuService=f;this.fileDialogService=v;this.editorService=b;this.filesConfigurationService=S;this.uriIdentityService=y;this.logService=w;this.editorResolverService=k;this.hostService=T;this.dialogService=N;this.fileService=O;this._onDidFocus=this._register(new E);this.onDidFocus=this._onDidFocus.event;this._onWillDispose=this._register(new E);this.onWillDispose=this._onWillDispose.event;this._onDidModelChange=this._register(new E);this.onDidModelChange=this._onDidModelChange.event;this._onDidActiveEditorChange=this._register(new E);this.onDidActiveEditorChange=this._onDidActiveEditorChange.event;this._onDidOpenEditorFail=this._register(new E);this.onDidOpenEditorFail=this._onDidOpenEditorFail.event;this._onWillCloseEditor=this._register(new E);this.onWillCloseEditor=this._onWillCloseEditor.event;this._onDidCloseEditor=this._register(new E);this.onDidCloseEditor=this._onDidCloseEditor.event;this._onWillMoveEditor=this._register(new E);this.onWillMoveEditor=this._onWillMoveEditor.event;this._onWillOpenEditor=this._register(new E);this.onWillOpenEditor=this._onWillOpenEditor.event;this.disposedEditorsWorker=this._register(new wM(e=>this.handleDisposedEditors(e),0));this.mapEditorToPendingConfirmation=new Map;this.containerToolBarMenuDisposable=this._register(new me);this.whenRestoredPromise=new Go;this.whenRestored=this.whenRestoredPromise.p;this._disposed=!1;this.element=_("div");this._onDidChange=this._register(new Mh);this.onDidChange=this._onDidChange.event;e instanceof Uf?this.model=this._register(e.model.clone()):OQe(e)?this.model=this._register(l.createInstance(yP,e)):this.model=this._register(l.createInstance(yP,void 0)),this.scopedContextKeyService=this._register(this.contextKeyService.createScoped(this.element)),this.element.classList.add(...si(["editor-group-container",this.model.isLocked?"locked":void 0])),this.registerContainerListeners(),this.createContainerToolbar(),this.createContainerContextMenu(),this._register(this.instantiationService.createInstance(xR,this.element)),this.progressBar=this._register(new fb(this.element,kx)),this.progressBar.hide(),this.scopedInstantiationService=this._register(this.instantiationService.createChild(new Io([X,this.scopedContextKeyService],[rd,this._register(new uRt(this.progressBar,this))]))),this.resourceContext=this._register(this.scopedInstantiationService.createInstance(Fo)),this.handleGroupContextKeys(),this.titleContainer=_(".title"),this.element.appendChild(this.titleContainer),this.titleControl=this._register(this.scopedInstantiationService.createInstance(oDe,this.titleContainer,this.editorPartsView,this.groupsView,this,this.model)),this.editorContainer=_(".editor-container"),this.element.appendChild(this.editorContainer),this.editorPane=this._register(this.scopedInstantiationService.createInstance(j_e,this.element,this.editorContainer,this)),this._onDidChange.input=this.editorPane.onDidChangeSizeConstraints,this.doTrackFocus(),this.updateTitleContainer(),this.updateContainer(),this.updateStyles(),(this.restoreEditors(e,s)??Promise.resolve()).finally(()=>{this.whenRestoredPromise.complete()}),this.registerListeners()}static createNew(e,t,o,n,r,s){return r.createInstance(Uf,null,e,t,o,n,s)}static createFromSerialized(e,t,o,n,r,s,l){return s.createInstance(Uf,e,t,o,n,r,l)}static createCopy(e,t,o,n,r,s,l){return s.createInstance(Uf,e,t,o,n,r,l)}handleGroupContextKeys(){let e=this.editorPartsView.bind(bce,this),t=this.editorPartsView.bind(Zxe,this),o=this.editorPartsView.bind(QEt,this),n=this.editorPartsView.bind(Sce,this),r=this.editorPartsView.bind(ZL,this),s=this.editorPartsView.bind(JEt,this),l=this.editorPartsView.bind(ME,this),c=Oj.bindTo(this.scopedContextKeyService),u=ZEt.bindTo(this.scopedContextKeyService),p=eTt.bindTo(this.scopedContextKeyService),h=this.editorPartsView.bind(fr,this),g=this.editorPartsView.bind(eYi,this),f=this.editorPartsView.bind(XEt,this),v=this.editorPartsView.bind(YEt,this),b=this.editorPartsView.bind(eke,this),S=this.editorPartsView.bind(M8e,this),y=this.editorPartsView.bind(tS,this),w=this.editorPartsView.bind(AO,this),k=this.editorPartsView.bind(oV,this),T=this.editorPartsView.bind(hC,this),N=this._register(new me),O=()=>{N.clear(),this.scopedContextKeyService.bufferChangeEvents(()=>{let U=this.activeEditor,G=this.activeEditorPane;if(this.resourceContext.set(no.getOriginalUri(U,{supportSideBySide:1})),nTt(w,U,this.editorResolverService),U?(k.set(U.hasCapability(32)),T.set(U.typeId===ga.ID),e.set(U.isDirty()&&!U.isSaving()),N.value=U.onDidChangeDirty(()=>{e.set(U.isDirty()&&!U.isSaving())})):(k.set(!1),T.set(!1),e.set(!1)),G){h.set(G.getId()),f.set(!G.input.hasCapability(4)),g.set(!!G.input.isReadonly());let $=no.getOriginalUri(G.input,{supportSideBySide:1}),te=no.getOriginalUri(G.input,{supportSideBySide:2});b.set(G.input instanceof Fa&&!G.input.original.isReadonly()&&!!$&&(this.fileService.hasProvider($)||$.scheme===Y.untitled)&&!!te&&(this.fileService.hasProvider(te)||te.scheme===Y.untitled)),v.set(!!$&&this.fileService.hasProvider($)&&!this.fileService.hasCapability($,2048));let pe=G?.getId()===SY;y.set(pe),S.set(pe)}else h.reset(),f.reset(),g.reset(),b.reset(),v.reset()})},V=U=>{switch(U.kind){case 3:l.set(this.isLocked);break;case 8:o.set(this.model.isFirst(this.model.activeEditor)),n.set(this.model.isLast(this.model.activeEditor)),t.set(this.model.activeEditor?this.model.isPinned(this.model.activeEditor):!1),r.set(this.model.activeEditor?this.model.isSticky(this.model.activeEditor):!1);break;case 6:t.set(this.model.activeEditor?this.model.isPinned(this.model.activeEditor):!1),r.set(this.model.activeEditor?this.model.isSticky(this.model.activeEditor):!1);break;case 5:case 7:o.set(this.model.isFirst(this.model.activeEditor)),n.set(this.model.isLast(this.model.activeEditor));break;case 11:U.editor&&U.editor===this.model.activeEditor&&t.set(this.model.isPinned(this.model.activeEditor));break;case 13:U.editor&&U.editor===this.model.activeEditor&&r.set(this.model.isSticky(this.model.activeEditor));break;case 4:c.set(this.model.selectedEditors.length>1),u.set(this.model.selectedEditors.length===2),p.set(this.model.selectedEditors.every(G=>G.resource&&(this.fileService.hasProvider(G.resource)||G.resource.scheme===Y.untitled)));break}s.set(this.count)};this._register(this.onDidModelChange(U=>V(U))),this._register(this.onDidActiveEditorChange(()=>O())),O(),V({kind:8}),V({kind:3})}registerContainerListeners(){this._register(j(this.element,re.DBLCLICK,e=>{this.isEmpty&&($t.stop(e),this.editorService.openEditor({resource:void 0,options:{pinned:!0,override:Ys.id}},this.id))})),this._register(j(this.element,re.AUXCLICK,e=>{this.isEmpty&&e.button===1&&($t.stop(e,!0),this.groupsView.removeGroup(this))}))}createContainerToolbar(){let e=_(".editor-group-container-toolbar");this.element.appendChild(e);let t=this._register(new ji(e,{ariaLabel:d(3940,null),highlightToggledItems:!0})),o=this._register(this.menuService.createMenu(D.EmptyEditorGroup,this.scopedContextKeyService)),n=()=>{this.containerToolBarMenuDisposable.value=Z(()=>t.clear());let r=hl(o.getActions({arg:{groupId:this.id},shouldForwardArgs:!0}),"navigation");for(let s of[...r.primary,...r.secondary]){let l=this.keybindingService.lookupKeybinding(s.id);t.push(s,{icon:!0,label:!1,keybinding:l?.getLabel()})}};n(),this._register(o.onDidChange(n))}createContainerContextMenu(){this._register(j(this.element,re.CONTEXT_MENU,e=>this.onShowContainerContextMenu(e))),this._register(j(this.element,Gn.Contextmenu,()=>this.onShowContainerContextMenu()))}onShowContainerContextMenu(e){if(!this.isEmpty)return;let t=this.element;e&&(t=new yn(Me(this.element),e)),this.contextMenuService.showContextMenu({menuId:D.EmptyEditorGroupContext,contextKeyService:this.contextKeyService,getAnchor:()=>t,onHide:()=>this.focus()})}doTrackFocus(){let e=this._register(Vn(this.element));this._register(e.onDidFocus(()=>{this.isEmpty&&this._onDidFocus.fire()}));let t=o=>{let n;if(Vp(o)){if(o.button!==0||it&&o.ctrlKey)return;n=o.target}else n=o.initialTarget;Nh(n,"monaco-action-bar",this.titleContainer)||Nh(n,"monaco-breadcrumb-item",this.titleContainer)||setTimeout(()=>{this.focus()})};this._register(j(this.titleContainer,re.MOUSE_DOWN,o=>t(o))),this._register(j(this.titleContainer,Gn.Tap,o=>t(o))),this._register(this.editorPane.onDidFocus(()=>{this._onDidFocus.fire()}))}updateContainer(){this.isEmpty?(this.element.classList.add("empty"),this.element.tabIndex=0,this.element.setAttribute("aria-label",d(3941,null,this.ariaLabel))):(this.element.classList.remove("empty"),this.element.removeAttribute("tabIndex"),this.element.removeAttribute("aria-label")),this.updateStyles()}updateTitleContainer(){this.titleContainer.classList.toggle("tabs",this.groupsView.partOptions.showTabs==="multiple"),this.titleContainer.classList.toggle("show-file-icons",this.groupsView.partOptions.showIcons)}restoreEditors(e,t){if(this.count===0)return;let o;e instanceof Uf?o=uui(e):o=Object.create(null);let n=this.model.activeEditor;if(!n)return;o.pinned=this.model.isPinned(n),o.sticky=this.model.isSticky(n),o.preserveFocus=!0;let r={preserveWindowOrder:!0,skipTitleUpdate:!0},s=Pn(),l=this.doShowEditor(n,{active:!0,isNew:!1},o,r).then(()=>{this.groupsView.activeGroup===this&&s&&sa(s)&&!t?.preserveFocus&&this.focus()});return this.titleControl.openEditors(this.editors),l}registerListeners(){this._register(this.model.onDidModelChange(e=>this.onDidGroupModelChange(e))),this._register(this.groupsView.onDidChangeEditorPartOptions(e=>this.onDidChangeEditorPartOptions(e))),this._register(this.groupsView.onDidVisibilityChange(e=>this.onDidVisibilityChange(e))),this._register(this.onDidFocus(()=>this.onDidGainFocus()))}onDidGroupModelChange(e){switch(this._onDidModelChange.fire(e),e.kind){case 3:this.element.classList.toggle("locked",this.isLocked);break;case 4:this.onDidChangeEditorSelection();break}if(e.editor)switch(e.kind){case 5:kXi(e)&&this.onDidOpenEditor(e.editor,e.editorIndex);break;case 6:TXi(e)&&this.handleOnDidCloseEditor(e.editor,e.editorIndex,e.context,e.sticky);break;case 15:this.onWillDisposeEditor(e.editor);break;case 14:this.onDidChangeEditorDirty(e.editor);break;case 12:this.onDidChangeEditorTransient(e.editor);break;case 9:this.onDidChangeEditorLabel(e.editor);break}}onDidOpenEditor(e,t){this.telemetryService.publicLog("editorOpened",this.toEditorTelemetryDescriptor(e)),this.updateContainer()}handleOnDidCloseEditor(e,t,o,n){this._onWillCloseEditor.fire({groupId:this.id,editor:e,context:o,index:t,sticky:n});let r=[e];e instanceof ga&&r.push(e.primary,e.secondary);for(let s of r)this.canDispose(s)&&s.dispose();this.updateContainer(),this._onDidCloseEditor.fire({groupId:this.id,editor:e,context:o,index:t,sticky:n})}canDispose(e){for(let t of this.editorPartsView.groups)if(t instanceof Uf&&t.model.contains(e,{strictEquals:!0,supportSideBySide:4}))return!1;return!0}toResourceTelemetryDescriptor(e){if(!e)return;let t=e?e.scheme===Y.file?e.fsPath:e.path:void 0;if(!t)return;let o=ms(e),n=o.indexOf("?");return o=n!==-1?o.substr(0,n):o,{mimeType:new Im(JEe(e).join(", ")),scheme:e.scheme,ext:o,path:Ir(t)}}toEditorTelemetryDescriptor(e){let t=e.getTelemetryDescriptor(),o=no.getOriginalUri(e,{supportSideBySide:3});return A.isUri(o)?(t.resource=this.toResourceTelemetryDescriptor(o),t):(o&&(o.primary&&(t.resource=this.toResourceTelemetryDescriptor(o.primary)),o.secondary&&(t.resourceSecondary=this.toResourceTelemetryDescriptor(o.secondary))),t)}onWillDisposeEditor(e){this.disposedEditorsWorker.work(e)}handleDisposedEditors(e){let t,o=[];for(let n of e){let r=this.model.findEditor(n);if(!r)continue;let s=r[0];s.isDisposed()&&(this.model.isActive(s)?t=s:o.push(s))}for(let n of o)this.doCloseEditor(n,!0);t&&this.doCloseEditor(t,!0)}onDidChangeEditorPartOptions(e){this.updateTitleContainer(),this.titleControl.updateOptions(e.oldPartOptions,e.newPartOptions),(e.oldPartOptions.showTabs!==e.newPartOptions.showTabs||e.oldPartOptions.tabHeight!==e.newPartOptions.tabHeight||e.oldPartOptions.showTabs==="multiple"&&e.oldPartOptions.pinnedTabsOnSeparateRow!==e.newPartOptions.pinnedTabsOnSeparateRow)&&(this.relayout(),this.model.activeEditor&&this.titleControl.openEditors(this.model.getEditors(1))),this.updateStyles(),e.oldPartOptions.enablePreview&&!e.newPartOptions.enablePreview&&this.model.previewEditor&&this.pinEditor(this.model.previewEditor)}onDidChangeEditorDirty(e){this.pinEditor(e),this.titleControl.updateEditorDirty(e)}onDidChangeEditorTransient(e){!this.model.isTransient(e)&&!this.groupsView.partOptions.enablePreview&&this.pinEditor(e)}onDidChangeEditorLabel(e){this.titleControl.updateEditorLabel(e)}onDidChangeEditorSelection(){this.titleControl.updateEditorSelections()}onDidVisibilityChange(e){this.editorPane.setVisible(e)}onDidGainFocus(){this.activeEditor&&this.model.setTransient(this.activeEditor,!1)}get index(){return this._index}get label(){return this.groupsLabel?d(3945,null,this.groupsLabel,this._index+1):d(3944,null,this._index+1)}get ariaLabel(){return this.groupsLabel?d(3943,null,this.groupsLabel,this._index+1):d(3942,null,this._index+1)}get disposed(){return this._disposed}get isEmpty(){return this.count===0}get titleHeight(){return this.titleControl.getHeight()}notifyIndexChanged(e){this._index!==e&&(this._index=e,this.model.setIndex(e))}notifyLabelChanged(e){this.groupsLabel!==e&&(this.groupsLabel=e,this.model.setLabel(e))}setActive(e){this.active=e,!e&&this.activeEditor&&this.selectedEditors.length>1&&this.setSelection(this.activeEditor,[]),this.element.classList.toggle("active",e),this.element.classList.toggle("inactive",!e),this.titleControl.setActive(e),this.updateStyles(),this.model.setActive(void 0)}get id(){return this.model.id}get windowId(){return this.groupsView.windowId}get editors(){return this.model.getEditors(1)}get count(){return this.model.count}get stickyCount(){return this.model.stickyCount}get activeEditorPane(){return this.editorPane?this.editorPane.activeEditorPane??void 0:void 0}get activeEditor(){return this.model.activeEditor}get selectedEditors(){return this.model.selectedEditors}get previewEditor(){return this.model.previewEditor}isPinned(e){return this.model.isPinned(e)}isSticky(e){return this.model.isSticky(e)}isSelected(e){return this.model.isSelected(e)}isTransient(e){return this.model.isTransient(e)}isActive(e){return this.model.isActive(e)}async setSelection(e,t){this.isActive(e)?this.model.setSelection(e,t):await this.openEditor(e,{activation:1},{inactiveSelection:t})}contains(e,t){return this.model.contains(e,t)}getEditors(e,t){return this.model.getEditors(e,t)}findEditors(e,t){let o=this.uriIdentityService.asCanonicalUri(e);return this.getEditors(t?.order??1).filter(n=>{if(n.resource&&Xe(n.resource,o))return!0;if(t?.supportSideBySide===1||t?.supportSideBySide===4){let r=no.getCanonicalUri(n,{supportSideBySide:1});if(r&&Xe(r,o))return!0}if(t?.supportSideBySide===2||t?.supportSideBySide===4){let r=no.getCanonicalUri(n,{supportSideBySide:2});if(r&&Xe(r,o))return!0}return!1})}getEditorByIndex(e){return this.model.getEditorByIndex(e)}getIndexOfEditor(e){return this.model.indexOf(e)}isFirst(e){return this.model.isFirst(e)}isLast(e){return this.model.isLast(e)}focus(){this.activeEditorPane?this.activeEditorPane.focus():this.element.focus(),this._onDidFocus.fire()}pinEditor(e=this.activeEditor||void 0){if(e&&!this.model.isPinned(e)){let t=this.model.pin(e);t&&this.titleControl.pinEditor(t)}}stickEditor(e=this.activeEditor||void 0){this.doStickEditor(e,!0)}unstickEditor(e=this.activeEditor||void 0){this.doStickEditor(e,!1)}doStickEditor(e,t){if(e&&this.model.isSticky(e)!==t){let o=this.getIndexOfEditor(e),n=t?this.model.stick(e):this.model.unstick(e);if(!n)return;let r=this.getIndexOfEditor(n);r!==o&&this.titleControl.moveEditor(n,o,r,!0),t?this.titleControl.stickEditor(n):this.titleControl.unstickEditor(n)}}async openEditor(e,t,o){return this.doOpenEditor(e,t,{...o,supportSideBySide:3})}async doOpenEditor(e,t,o){if(!e||e.isDisposed())return;this._onWillOpenEditor.fire({editor:e,groupId:this.id});let n=t?.sticky||!this.groupsView.partOptions.enablePreview&&!t?.transient||e.isDirty()||(t?.pinned??typeof t?.index=="number")||typeof t?.index=="number"&&this.model.isSticky(t.index)||e.hasCapability(512),r={index:t?t.index:void 0,pinned:n,sticky:t?.sticky||typeof t?.index=="number"&&this.model.isSticky(t.index),transient:!!t?.transient,inactiveSelection:o?.inactiveSelection,active:this.count===0||!t?.inactive,supportSideBySide:o?.supportSideBySide};!r.active&&!r.pinned&&this.model.activeEditor&&!this.model.isPinned(this.model.activeEditor)&&(r.active=!0);let s=!1,l=!1;if(t?.activation===1?s=!0:t?.activation===2?l=!0:t?.activation===3?(s=!1,l=!1):r.active&&(s=!t?.preserveFocus,l=!s),typeof r.index=="number"){let h=this.model.indexOf(e);h!==-1&&h!==r.index&&this.doMoveEditorInsideGroup(e,r)}let{editor:c,isNew:u}=this.model.openEditor(e,r);u&&this.count===1&&this.editorPartsView.groups.length>1&&c.editorId&&this.groupsView.partOptions.autoLockGroups?.has(c.editorId)&&this.lock(!0);let p=this.doShowEditor(c,{active:!!r.active,isNew:u},t,o);return s?this.groupsView.activateGroup(this):l&&this.groupsView.restoreGroup(this),p}doShowEditor(e,t,o,n){let r;return t.active?r=(async()=>{let{pane:s,changed:l,cancelled:c,error:u}=await this.editorPane.openEditor(e,o,n,{newInGroup:t.isNew});if(!c)return l&&this._onDidActiveEditorChange.fire({editor:e}),u&&this._onDidOpenEditorFail.fire(e),!s&&this.activeEditor===e&&this.doCloseEditor(e,o?.preserveFocus,{fromError:!0}),s})():r=Promise.resolve(void 0),n?.skipTitleUpdate||this.titleControl.openEditor(e,n),r}async openEditors(e){let t=si(e).filter(({editor:l})=>!l.isDisposed()),o=t.at(0);if(!o)return;let n={supportSideBySide:3};await this.doOpenEditor(o.editor,o.options,n);let r=t.slice(1),s=this.getIndexOfEditor(o.editor)+1;return await fn.settled(r.map(({editor:l,options:c},u)=>this.doOpenEditor(l,{...c,inactive:!0,pinned:!0,index:s+u},{...n,skipTitleUpdate:!0}))),this.titleControl.openEditors(r.map(({editor:l})=>l)),this.editorPane.activeEditorPane??void 0}moveEditors(e,t){let o={skipTitleUpdate:this!==t},n=!1,r=new Set;for(let{editor:s,options:l}of e)this.moveEditor(s,t,l,o)?r.add(s):n=!0;return o.skipTitleUpdate&&(t.titleControl.openEditors(Array.from(r)),this.titleControl.closeEditors(Array.from(r))),!n}moveEditor(e,t,o,n){return this===t?(this.doMoveEditorInsideGroup(e,o),!0):this.doMoveOrCopyEditorAcrossGroups(e,t,o,{...n,keepCopy:!1})}doMoveEditorInsideGroup(e,t){let o=t?t.index:void 0;if(typeof o!="number")return;let n=this.model.indexOf(e),r=this.model.getEditorByIndex(n);if(r){if(n!==o){let s=this.model.stickyCount;this.model.moveEditor(r,o),this.model.pin(r),this.titleControl.moveEditor(r,n,o,s!==this.model.stickyCount),this.titleControl.pinEditor(r)}t?.sticky&&this.stickEditor(r)}}doMoveOrCopyEditorAcrossGroups(e,t,o,n){let r=n?.keepCopy;if(!r||e.hasCapability(8)){let l=e.canMove(this.id,t.id);if(typeof l=="string")return this.dialogService.error(l,d(3946,null)),!1}let s=uui(this,e,{...o,pinned:!0,sticky:o?.sticky??(!r&&this.model.isSticky(e))});return r||this._onWillMoveEditor.fire({groupId:this.id,editor:e,target:t.id}),t.doOpenEditor(r?e.copy():e,s,n),r||this.doCloseEditor(e,!0,{...n,context:2}),!0}copyEditors(e,t){let o={skipTitleUpdate:this!==t};for(let{editor:n,options:r}of e)this.copyEditor(n,t,r,o);if(o.skipTitleUpdate){let n=e.map(({editor:r})=>r);t.titleControl.openEditors(n)}}copyEditor(e,t,o,n){this===t?this.doMoveEditorInsideGroup(e,o):this.doMoveOrCopyEditorAcrossGroups(e,t,o,{...n,keepCopy:!0})}async closeEditor(e=this.activeEditor||void 0,t){return this.doCloseEditorWithConfirmationHandling(e,t)}async doCloseEditorWithConfirmationHandling(e=this.activeEditor||void 0,t,o){return!e||await this.handleCloseConfirmation([e])?!1:(this.doCloseEditor(e,t?.preserveFocus,o),!0)}doCloseEditor(e,t=this.groupsView.activeGroup!==this,o){o?.skipTitleUpdate||this.titleControl.beforeCloseEditor(e),this.model.isActive(e)?this.doCloseActiveEditor(t,o):this.doCloseInactiveEditor(e,o),o?.skipTitleUpdate||this.titleControl.closeEditor(e)}doCloseActiveEditor(e=this.groupsView.activeGroup!==this,t){let o=this.activeEditor,n=!e&&this.shouldRestoreFocus(this.element),r=this.groupsView.partOptions.closeEmptyGroups;if(r&&this.active&&this.count===1){let c=this.groupsView.getGroups(1)[1];c&&(n?c.focus():this.groupsView.activateGroup(c,!0))}o&&this.model.closeEditor(o,t?.context);let s=this.model.activeEditor;if(s){let l;e&&this.groupsView.activeGroup!==this&&(l=3);let c={preserveFocus:e,activation:l,ignoreError:t?.fromError},u={preserveWindowOrder:!0};this.doOpenEditor(s,c,u)}else o&&this.editorPane.closeEditor(o),n&&!r&&this.focus(),this._onDidActiveEditorChange.fire({editor:void 0}),r&&this.groupsView.removeGroup(this,e)}shouldRestoreFocus(e){let t=Pn();return t===e.ownerDocument.body?!0:gs(t,e)}doCloseInactiveEditor(e,t){this.model.closeEditor(e,t?.context)}async handleCloseConfirmation(e){if(!e.length)return!1;let t=e.shift(),o=this.mapEditorToPendingConfirmation.get(t);o||(o=this.doHandleCloseConfirmation(t),this.mapEditorToPendingConfirmation.set(t,o));let n;try{n=await o}finally{this.mapEditorToPendingConfirmation.delete(t)}return n||this.handleCloseConfirmation(e)}async doHandleCloseConfirmation(e,t){if(!this.shouldConfirmClose(e)||e instanceof ga&&this.model.contains(e.primary)||this.editorPartsView.groups.some(s=>{if(s===this)return!1;let l=s;return!!(l.contains(e,{supportSideBySide:3})||e instanceof ga&&l.contains(e.primary))}))return!1;let o=2,n=1,r=!1;if(!e.hasCapability(4)&&!t?.skipAutoSave&&!e.closeHandler&&(this.filesConfigurationService.getAutoSaveMode(e).mode===3?(r=!0,o=0,n=3):kr&&(ri||Wn)&&this.filesConfigurationService.getAutoSaveMode(e).mode===4&&(r=!0,o=0,n=4)),!r){this.activeEditor?.matches(e)||await this.doOpenEditor(e),await this.hostService.focus(Me(this.element));let s=!1;if(typeof e.closeHandler?.confirm=="function")try{o=await e.closeHandler.confirm([{editor:e,groupId:this.id}])}catch(l){this.logService.error(l),s=!0}if(typeof e.closeHandler?.confirm!="function"||s){let l;e instanceof ga?l=e.primary.getName():l=e.getName(),o=await this.fileDialogService.showSaveConfirm([l])}}if(!e.closeHandler&&!this.shouldConfirmClose(e))return o===2;switch(o){case 0:return!await e.save(this.id,{reason:n})&&r?this.doHandleCloseConfirmation(e,{skipAutoSave:!0}):e.isDirty();case 1:try{return await e.revert(this.id),e.isDirty()}catch(s){return this.logService.error(s),await e.revert(this.id,{soft:!0}),e.isDirty()}case 2:return!0}}shouldConfirmClose(e){if(e.closeHandler)try{return e.closeHandler.showConfirm()}catch(t){this.logService.error(t)}return e.isDirty()&&!e.isSaving()}async closeEditors(e,t){if(this.isEmpty)return!0;let o=this.doGetEditorsToClose(e);return await this.handleCloseConfirmation(o.slice(0))?!1:(this.doCloseEditors(o,t),!0)}doGetEditorsToClose(e){if(Array.isArray(e))return e;let t=e,o=typeof t.direction=="number",n=this.model.getEditors(o?1:0,t);return t.savedOnly?n=n.filter(r=>!r.isDirty()||r.isSaving()):o&&t.except?n=t.direction===0?n.slice(0,this.model.indexOf(t.except,n)):n.slice(this.model.indexOf(t.except,n)+1):t.except&&(n=n.filter(r=>t.except&&!r.matches(t.except))),n}doCloseEditors(e,t){let o=!1;for(let n of e)this.isActive(n)?o=!0:this.doCloseInactiveEditor(n);o&&this.doCloseActiveEditor(t?.preserveFocus),e.length&&this.titleControl.closeEditors(e)}closeAllEditors(e){return this.isEmpty?(this.groupsView.partOptions.closeEmptyGroups&&this.groupsView.removeGroup(this),!0):e?.excludeConfirming?(this.doCloseAllEditors(e),!0):this.handleCloseConfirmation(this.model.getEditors(0,e)).then(t=>t?!1:(this.doCloseAllEditors(e),!0))}doCloseAllEditors(e){let t=this.model.getEditors(1,e);e?.excludeConfirming&&(t=t.filter(n=>!this.shouldConfirmClose(n)));let o=[];for(let n of t)this.isActive(n)||this.doCloseInactiveEditor(n),o.push(n);this.activeEditor&&o.includes(this.activeEditor)&&this.doCloseActiveEditor(),o.length&&this.titleControl.closeEditors(o)}async replaceEditors(e){let t,o=[];for(let{editor:n,replacement:r,forceReplaceDirty:s,options:l}of e){let c=this.getIndexOfEditor(n);if(c>=0){let u=this.isActive(n);l?l.index=c:l={index:c},l.inactive=!u,l.pinned=l.pinned??!0;let p={editor:n,replacement:r,forceReplaceDirty:s,options:l};u?t=p:o.push(p)}}for(let{editor:n,replacement:r,forceReplaceDirty:s,options:l}of o)if(await this.doOpenEditor(r,l),!n.matches(r)){let c=!1;if(s?(this.doCloseEditor(n,!0,{context:1}),c=!0):c=await this.doCloseEditorWithConfirmationHandling(n,{preserveFocus:!0},{context:1}),!c)return}if(t){let n=this.doOpenEditor(t.replacement,t.options);t.editor.matches(t.replacement)||(t.forceReplaceDirty?this.doCloseEditor(t.editor,!0,{context:1}):await this.doCloseEditorWithConfirmationHandling(t.editor,{preserveFocus:!0},{context:1})),await n}}get isLocked(){return this.model.isLocked}lock(e){this.model.lock(e)}createEditorActions(e,t=D.EditorTitle){let o={primary:[],secondary:[]},n,r=this.activeEditorPane;if(r instanceof pa){let s=r.scopedContextKeyService??this.scopedContextKeyService,l=e.add(this.menuService.createMenu(t,s,{emitEventsForSubmenuChanges:!0,eventDebounceDelay:0}));n=l.onDidChange;let c=(u,p)=>p==="navigation"&&u.actions.length<=1;o=hl(l.getActions({arg:this.resourceContext.get(),shouldForwardArgs:!0,renderShortTitle:!0}),"navigation",c)}else{let s=e.add(new E);n=s.event,e.add(this.onDidActiveEditorChange(()=>s.fire()))}return{actions:o,onDidChange:n}}updateStyles(){let e=this.isEmpty;e?this.element.style.backgroundColor=this.getColor(B9i)||"":this.element.style.backgroundColor="";let t=this.getColor(z9i)||this.getColor(gi);!e&&t?(this.titleContainer.classList.add("title-border-bottom"),this.titleContainer.style.setProperty("--title-border-bottom-color",t)):(this.titleContainer.classList.remove("title-border-bottom"),this.titleContainer.style.removeProperty("--title-border-bottom-color"));let{showTabs:o}=this.groupsView.partOptions;this.titleContainer.style.backgroundColor=this.getColor(o==="multiple"?fEt:U9i)||"",this.editorContainer.style.backgroundColor=this.getColor(qo)||""}get minimumWidth(){return this.editorPane.minimumWidth}get minimumHeight(){return this.editorPane.minimumHeight}get maximumWidth(){return this.editorPane.maximumWidth}get maximumHeight(){return this.editorPane.maximumHeight}get proportionalLayout(){return this.lastLayout?!(this.lastLayout.width===this.minimumWidth||this.lastLayout.height===this.minimumHeight):!0}layout(e,t,o,n){this.lastLayout={width:e,height:t,top:o,left:n},this.element.classList.toggle("max-height-478px",t<=478);let r=this.titleControl.layout({container:new ai(e,t),available:new ai(e,t-this.editorPane.minimumHeight)});this.progressBar.getContainer().style.top=`${Math.max(this.titleHeight.offset-2,0)}px`;let s=Math.max(0,t-r.height);this.editorContainer.style.height=`${s}px`,this.editorPane.layout({width:e,height:s,top:o+r.height,left:n})}relayout(){if(this.lastLayout){let{width:e,height:t,top:o,left:n}=this.lastLayout;this.layout(e,t,o,n)}}setBoundarySashes(e){this.editorPane.setBoundarySashes(e)}toJSON(){return this.model.serialize()}dispose(){this._disposed=!0,this._onWillDispose.fire(),super.dispose()}};Uf=I([m(6,F),m(7,X),m(8,De),m(9,Te),m(10,_e),m(11,qt),m(12,ze),m(13,dn),m(14,ee),m(15,lr),m(16,dt),m(17,ne),m(18,ul),m(19,oi),m(20,ct),m(21,be)],Uf);function yno(a){return a.getValue("editor.dropIntoEditor.enabled")}function wno(a){return a.shiftKey}var kue=class extends Jd{constructor(e,t,o,n,r,s,l,c){super(t);this.groupView=e;this.configurationService=o;this.instantiationService=n;this.editorService=r;this.editorGroupService=s;this.treeViewsDragAndDropService=l;this.contextService=c;this.editorTransfer=VI.getInstance();this.groupTransfer=VI.getInstance();this.treeItemsTransfer=VI.getInstance();this.cleanupOverlayScheduler=this._register(new Dt(()=>this.dispose(),300)),this.enableDropIntoEditor=yno(this.configurationService)&&this.isDropIntoActiveEditorEnabled(),this.create()}static{this.OVERLAY_ID="monaco-workbench-editor-drop-overlay"}get disposed(){return!!this._disposed}create(){let e=this.getOverlayOffsetHeight(),t=this.container=_("div",{id:kue.OVERLAY_ID});t.style.top=`${e}px`,this.groupView.element.appendChild(t),this.groupView.element.classList.add("dragged-over"),this._register(Z(()=>{t.remove(),this.groupView.element.classList.remove("dragged-over")})),this.overlay=_(".editor-group-overlay-indicator"),t.appendChild(this.overlay),this.enableDropIntoEditor&&(this.dropIntoPromptElement=RL(d(3939,null,it?"\u21E7":"Shift"),{}),this.dropIntoPromptElement.classList.add("editor-group-overlay-drop-into-prompt"),this.overlay.appendChild(this.dropIntoPromptElement)),this.registerListeners(t),this.updateStyles()}updateStyles(){let e=Oi(this.overlay);e.style.backgroundColor=this.getColor(_E)||"";let t=this.getColor(qs);if(e.style.outlineColor=t||"",e.style.outlineOffset=t?"-2px":"",e.style.outlineStyle=t?"dashed":"",e.style.outlineWidth=t?"2px":"",this.dropIntoPromptElement){this.dropIntoPromptElement.style.backgroundColor=this.getColor(G9i)??"",this.dropIntoPromptElement.style.color=this.getColor(K9i)??"";let o=this.getColor($9i);o?(this.dropIntoPromptElement.style.borderWidth="1px",this.dropIntoPromptElement.style.borderStyle="solid",this.dropIntoPromptElement.style.borderColor=o):this.dropIntoPromptElement.style.borderWidth="0"}}registerListeners(e){this._register(new Om(e,{onDragOver:t=>{if(this.enableDropIntoEditor&&wno(t)){this.dispose();return}let o=this.groupTransfer.hasData(rI.prototype),n=this.editorTransfer.hasData(Wf.prototype);!n&&!o&&t.dataTransfer&&(t.dataTransfer.dropEffect="copy");let r=!0;if(o)r=this.isCopyOperation(t);else if(n){let l=this.editorTransfer.getData(Wf.prototype);Array.isArray(l)&&l.length>0&&(r=this.isCopyOperation(t,l[0].identifier))}if(!r){let l=this.findSourceGroupView();if(l===this.groupView&&(o||n&&l.count<2)){this.hideOverlay();return}}let s=!!this.groupView.groupsView.partOptions.splitOnDragAndDrop;this.isToggleSplitOperation(t)&&(s=!s),this.positionOverlay(t.offsetX,t.offsetY,o,s),this.cleanupOverlayScheduler.isScheduled()&&this.cleanupOverlayScheduler.cancel()},onDragLeave:t=>this.dispose(),onDragEnd:t=>this.dispose(),onDrop:t=>{$t.stop(t,!0),this.dispose(),this.currentDropOperation&&this.handleDrop(t,this.currentDropOperation.splitDirection)}})),this._register(j(e,re.MOUSE_OVER,()=>{this.cleanupOverlayScheduler.isScheduled()||this.cleanupOverlayScheduler.schedule()}))}isDropIntoActiveEditorEnabled(){return!!this.groupView.activeEditor?.hasCapability(128)}findSourceGroupView(){if(this.groupTransfer.hasData(rI.prototype)){let e=this.groupTransfer.getData(rI.prototype);if(Array.isArray(e)&&e.length>0)return this.editorGroupService.getGroup(e[0].identifier)}else if(this.editorTransfer.hasData(Wf.prototype)){let e=this.editorTransfer.getData(Wf.prototype);if(Array.isArray(e)&&e.length>0)return this.editorGroupService.getGroup(e[0].identifier.groupId)}}async handleDrop(e,t){let o=()=>{let n;return typeof t=="number"?n=this.editorGroupService.addGroup(this.groupView,t):n=this.groupView,n};if(this.groupTransfer.hasData(rI.prototype)){let n=this.groupTransfer.getData(rI.prototype);if(Array.isArray(n)&&n.length>0){let r=this.editorGroupService.getGroup(n[0].identifier);if(r){if(typeof t!="number"&&r===this.groupView)return;let s;if(typeof t=="number")this.isCopyOperation(e)?s=this.editorGroupService.copyGroup(r,this.groupView,t):s=this.editorGroupService.moveGroup(r,this.groupView,t);else{let l;this.isCopyOperation(e)&&(l={mode:0}),this.editorGroupService.mergeGroup(r,this.groupView,l)}s&&this.editorGroupService.activateGroup(s)}this.groupTransfer.clearData(rI.prototype)}}else if(this.editorTransfer.hasData(Wf.prototype)){let n=this.editorTransfer.getData(Wf.prototype);if(Array.isArray(n)&&n.length>0){let r=n,s=n[0].identifier,l=this.editorGroupService.getGroup(s.groupId);if(l){let c=this.isCopyOperation(e,s),u;if(this.groupView.groupsView.partOptions.closeEmptyGroups&&l.count===1&&typeof t=="number"&&!c)u=this.editorGroupService.moveGroup(l,this.groupView,t);else{if(u=o(),l===u)return;let p=ZY(this.groupView,r.map(h=>h.identifier.editor));c?l.copyEditors(p,u):l.moveEditors(p,u)}u.focus()}this.editorTransfer.clearData(Wf.prototype)}}else if(this.treeItemsTransfer.hasData(sC.prototype)){let n=this.treeItemsTransfer.getData(sC.prototype);if(Array.isArray(n)&&n.length>0){let r=[];for(let s of n){let l=await this.treeViewsDragAndDropService.removeDragOperationTransfer(s.identifier);if(l){let c=await RRt(l);r.push(...c.map(u=>({...u,options:{...u.options,pinned:!0}})))}}r.length&&this.editorService.openEditors(r,o(),{validateTrust:!0})}this.treeItemsTransfer.clearData(sC.prototype)}else this.instantiationService.createInstance(sF,{allowWorkspaceOpen:!Gt||xx(this.contextService.getWorkspace())}).handleDrop(e,Me(this.groupView.element),()=>o(),r=>r?.focus())}isCopyOperation(e,t){return t?.editor.hasCapability(8)?!1:e.ctrlKey&&!it||e.altKey&&it}isToggleSplitOperation(e){return e.altKey&&!it||e.shiftKey&&it}positionOverlay(e,t,o,n){let r=this.groupView.groupsView.partOptions.openSideBySideDirection==="right",s=this.groupView.element.clientWidth,l=this.groupView.element.clientHeight-this.getOverlayOffsetHeight(),c,u;n?(o?c=r?.3:.1:c=.1,o?u=r?.1:.3:u=.1):(c=0,u=0);let p=s*c,h=l*u,g=s/3,f=l/3,v;switch(e>p&&e<s-p&&t>h&&t<l-h?v=void 0:r?e<g?v=2:e>g*2?v=3:t<l/2?v=0:v=1:t<f?v=0:t>f*2?v=1:e<s/2?v=2:v=3,v){case 0:this.doPositionOverlay({top:"0",left:"0",width:"100%",height:"50%"}),this.toggleDropIntoPrompt(!1);break;case 1:this.doPositionOverlay({top:"50%",left:"0",width:"100%",height:"50%"}),this.toggleDropIntoPrompt(!1);break;case 2:this.doPositionOverlay({top:"0",left:"0",width:"50%",height:"100%"}),this.toggleDropIntoPrompt(!1);break;case 3:this.doPositionOverlay({top:"0",left:"50%",width:"50%",height:"100%"}),this.toggleDropIntoPrompt(!1);break;default:this.doPositionOverlay({top:"0",left:"0",width:"100%",height:"100%"}),this.toggleDropIntoPrompt(!0)}let b=Oi(this.overlay);b.style.opacity="1",setTimeout(()=>b.classList.add("overlay-move-transition"),0),this.currentDropOperation={splitDirection:v}}doPositionOverlay(e){let[t,o]=_y(this.container,this.overlay),n=this.getOverlayOffsetHeight();n?t.style.height=`calc(100% - ${n}px)`:t.style.height="100%",o.style.top=e.top,o.style.left=e.left,o.style.width=e.width,o.style.height=e.height}getOverlayOffsetHeight(){return!this.groupView.isEmpty&&this.groupView.groupsView.partOptions.showTabs==="multiple"?this.groupView.titleHeight.offset:0}hideOverlay(){let e=Oi(this.overlay);this.doPositionOverlay({top:"0",left:"0",width:"100%",height:"100%"}),e.style.opacity="0",e.classList.remove("overlay-move-transition"),this.currentDropOperation=void 0}toggleDropIntoPrompt(e){this.dropIntoPromptElement&&(this.dropIntoPromptElement.style.opacity=e?"1":"0")}contains(e){return e===this.container||e===this.overlay}dispose(){super.dispose(),this._disposed=!0}};kue=I([m(1,De),m(2,B),m(3,F),m(4,ee),m(5,Et),m(6,Yq),m(7,Pe)],kue);var nDe=class extends Jd{constructor(e,t,o,n,r,s,l){super(r);this.groupsView=e;this.container=t;this.delegate=o;this.editorGroupService=n;this.configurationService=s;this.instantiationService=l;this.counter=0;this.editorTransfer=VI.getInstance();this.groupTransfer=VI.getInstance();this.registerListeners()}get overlay(){if(this._overlay&&!this._overlay.disposed)return this._overlay}registerListeners(){this._register(j(this.container,re.DRAG_ENTER,e=>this.onDragEnter(e))),this._register(j(this.container,re.DRAG_LEAVE,()=>this.onDragLeave()));for(let e of[this.container,Me(this.container)])this._register(j(e,re.DRAG_END,()=>this.onDragEnd()))}onDragEnter(e){if(yno(this.configurationService)&&wno(e))return;if(this.counter++,!this.editorTransfer.hasData(Wf.prototype)&&!this.groupTransfer.hasData(rI.prototype)&&e.dataTransfer){let o=oe.as(mW.DragAndDropContribution).getAll(),n=Array.from(o).map(r=>r.dataFormatKey);if(!gu(e,Aa.FILES,Ll.FILES,Aa.RESOURCES,Ll.EDITORS,...n)){e.dataTransfer.dropEffect="none";return}}if(!this.groupsView.partOptions.allowDropIntoGroup){e.dataTransfer&&(e.dataTransfer.dropEffect="none");return}this.updateContainer(!0);let t=e.target;if(t&&(this.overlay&&!this.overlay.contains(t)&&this.disposeOverlay(),!this.overlay)){let o=this.findTargetGroupView(t);o&&(this._overlay=this.instantiationService.createInstance(kue,o))}}onDragLeave(){this.counter--,this.counter===0&&this.updateContainer(!1)}onDragEnd(){this.counter=0,this.updateContainer(!1),this.disposeOverlay()}findTargetGroupView(e){return this.editorGroupService.groups.find(o=>gs(e,o.element)||this.delegate.containsGroup?.(o))}updateContainer(e){this.container.classList.toggle("dragged-over",e)}dispose(){super.dispose(),this.disposeOverlay()}disposeOverlay(){this.overlay&&(this.overlay.dispose(),this._overlay=void 0)}};nDe=I([m(3,Et),m(4,De),m(5,B),m(6,F)],nDe);var bYe={targetWidth:900,leftMarginRatio:.1909,rightMarginRatio:.1909},ubi={type:"distribute"};function Cno(a){let i=_(".centered-layout-margin");return i.style.height="100%",a&&(i.style.backgroundColor=a.toString()),{element:i,layout:()=>{},minimumSize:60,maximumSize:Number.POSITIVE_INFINITY,onDidChange:H.None}}function Jqo(a,i){return{element:a.element,get maximumSize(){return a.maximumWidth},get minimumSize(){return a.minimumWidth},onDidChange:H.map(a.onDidChange,e=>e&&e.width),layout:(e,t,o)=>a.layout(e,i(),o?.top??0,(o?.left??0)+t)}}var mOt=class{constructor(i,e,t={...bYe},o=!1){this.container=i;this.view=e;this.state=t;this.centeredLayoutFixedWidth=o;this.lastLayoutPosition={width:0,height:0,left:0,top:0};this.didLayout=!1;this.splitViewDisposables=new P;this._boundarySashes={};this.container.appendChild(this.view.element),this.container.style.overflow="hidden"}get minimumWidth(){return this.splitView?this.splitView.minimumSize:this.view.minimumWidth}get maximumWidth(){return this.splitView?this.splitView.maximumSize:this.view.maximumWidth}get minimumHeight(){return this.view.minimumHeight}get maximumHeight(){return this.view.maximumHeight}get onDidChange(){return this.view.onDidChange}get boundarySashes(){return this._boundarySashes}set boundarySashes(i){this._boundarySashes=i,this.splitView&&(this.splitView.orthogonalStartSash=i.top,this.splitView.orthogonalEndSash=i.bottom)}layout(i,e,t,o){this.lastLayoutPosition={width:i,height:e,top:t,left:o},this.splitView?(this.splitView.layout(i,this.lastLayoutPosition),(!this.didLayout||this.centeredLayoutFixedWidth)&&this.resizeSplitViews()):this.view.layout(i,e,t,o),this.didLayout=!0}resizeSplitViews(){if(this.splitView)if(this.centeredLayoutFixedWidth){let i=Math.min(this.lastLayoutPosition.width,this.state.targetWidth),e=(this.lastLayoutPosition.width-i)/2;this.splitView.resizeView(0,Math.floor(e)),this.splitView.resizeView(1,i),this.splitView.resizeView(2,Math.ceil(e))}else{let i=this.state.leftMarginRatio*this.lastLayoutPosition.width,e=this.state.rightMarginRatio*this.lastLayoutPosition.width,t=this.lastLayoutPosition.width-i-e;this.splitView.resizeView(0,i),this.splitView.resizeView(1,t),this.splitView.resizeView(2,e)}}setFixedWidth(i){this.centeredLayoutFixedWidth=i,this.splitView&&(this.updateState(),this.resizeSplitViews())}updateState(){this.splitView&&(this.state.targetWidth=this.splitView.getViewSize(1),this.state.leftMarginRatio=this.splitView.getViewSize(0)/this.lastLayoutPosition.width,this.state.rightMarginRatio=this.splitView.getViewSize(2)/this.lastLayoutPosition.width)}isActive(){return!!this.splitView}styles(i){this.style=i,this.splitView&&this.emptyViews&&(this.splitView.style(this.style),this.emptyViews[0].element.style.backgroundColor=this.style.background.toString(),this.emptyViews[1].element.style.backgroundColor=this.style.background.toString())}activate(i){if(i!==this.isActive())if(i){this.view.element.remove(),this.splitView=new vu(this.container,{inverseAltBehavior:!0,orientation:1,styles:this.style}),this.splitView.orthogonalStartSash=this.boundarySashes.top,this.splitView.orthogonalEndSash=this.boundarySashes.bottom,this.splitViewDisposables.add(this.splitView.onDidSashChange(()=>{this.splitView&&this.updateState()})),this.splitViewDisposables.add(this.splitView.onDidSashReset(()=>{this.state={...bYe},this.resizeSplitViews()})),this.splitView.layout(this.lastLayoutPosition.width,this.lastLayoutPosition);let e=this.style?this.style.background:void 0;this.emptyViews=[Cno(e),Cno(e)],this.splitView.addView(this.emptyViews[0],ubi,0),this.splitView.addView(Jqo(this.view,()=>this.lastLayoutPosition.height),ubi,1),this.splitView.addView(this.emptyViews[1],ubi,2),this.resizeSplitViews()}else this.splitView?.el.remove(),this.splitViewDisposables.clear(),this.splitView?.dispose(),this.splitView=void 0,this.emptyViews=void 0,this.container.appendChild(this.view.element),this.view.layout(this.lastLayoutPosition.width,this.lastLayoutPosition.height,this.lastLayoutPosition.top,this.lastLayoutPosition.left)}isDefault(i){return this.centeredLayoutFixedWidth?i.targetWidth===bYe.targetWidth:i.leftMarginRatio===bYe.leftMarginRatio&&i.rightMarginRatio===bYe.rightMarginRatio}dispose(){this.splitViewDisposables.dispose(),this.splitView&&(this.splitView.dispose(),this.splitView=void 0)}};function Eue(a,i,e){let t=a.get(Et),o=a.get(B),n=tjo(i,e,t,o);return n instanceof Promise?n.then(r=>xno(r,i,e,t,o)):xno(n,i,e,t,o)}function xno(a,i,e,t,o){let n=t.activeModalEditorPart,r=o.getValue("workbench.editor.useModal");return n&&e!==ym&&r!=="all"&&(a=Zqo(a,i,n,t)),ejo(a,i,e,t)}function Zqo(a,i,e,t){let o=i.options;return e.groups.some(n=>n.id===a.id)&&(a=t.mainPart.activeGroup),o?.preserveFocus||e.close(),a}function ejo(a,i,e,t){let o;return t.activeGroup!==a&&i.options&&!i.options.inactive&&i.options.preserveFocus&&typeof i.options.activation!="number"&&e!==vn&&(o=1),[a,o]}function tjo(a,i,e,t){let o,n=tV(a)?a.editor:a,r=a.options;if(i&&typeof i!="number")o=i;else if(typeof i=="number"&&i>=0)o=e.getGroup(i);else if(i===vn){let s=pC(t),l=e.findGroup({direction:s});(!l||hOt(l,n))&&(l=e.addGroup(e.activeGroup,s)),o=l}else if(i===hg)o=e.createAuxiliaryEditorPart(r?.auxiliary).then(s=>s.activeGroup);else if(i===ym&&t.getValue("workbench.editor.useModal")!=="off")o=e.createModalEditorPart(r?.modal).then(s=>s.activeGroup);else if(!r||typeof r.index!="number"){let s=e.getGroups(1);if(r?.revealIfVisible){for(let l of s)if(ijo(l,n)){o=l;break}}if(!o&&(r?.revealIfOpened||t.getValue("workbench.editor.revealIfOpen")||Ta(n)&&(n.hasCapability(1024)||n.hasCapability(8)))){let l,c;for(let u of s)if(kno(u,n)&&(c||(c=u),!l&&u.isActive(n)&&(l=u)),c&&l)break;o=l||c}}if(!o&&t.getValue("workbench.editor.useModal")==="all"&&(o=e.createModalEditorPart(r?.modal).then(s=>s.activeGroup)),!o){let s=e.activeGroup;if(hOt(s,n)){for(let l of e.getGroups(1))if(!hOt(l,n)){s=l;break}hOt(s,n)?o=e.addGroup(s,pC(t)):o=s}else o=s}return o}function hOt(a,i){return!(!a.isLocked||kno(a,i))}function ijo(a,i){return a.activeEditor?a.activeEditor.matches(i):!1}function kno(a,i){for(let e of a.editors)if(e.matches(i))return!0;return!1}var pbi=class{constructor(){this.element=_(".grid-view-container");this._onDidChange=new Mh;this.onDidChange=this._onDidChange.event}get minimumWidth(){return this.gridWidget?this.gridWidget.minimumWidth:0}get maximumWidth(){return this.gridWidget?this.gridWidget.maximumWidth:Number.POSITIVE_INFINITY}get minimumHeight(){return this.gridWidget?this.gridWidget.minimumHeight:0}get maximumHeight(){return this.gridWidget?this.gridWidget.maximumHeight:Number.POSITIVE_INFINITY}get gridWidget(){return this._gridWidget}set gridWidget(i){this.element.textContent="",i?(this.element.appendChild(i.element),this._onDidChange.input=i.onDidChange):this._onDidChange.input=H.None,this._gridWidget=i}layout(i,e,t,o){this.gridWidget?.layout(i,e,t,o)}dispose(){this._onDidChange.dispose()}},ck=class extends cy{constructor(e,t,o,n,r,s,l,c,u,p,h){super(t,{hasTitle:!1},s,c,u);this.editorPartsView=e;this.groupsLabel=o;this.windowId=n;this.instantiationService=r;this.configurationService=l;this.hostService=p;this.contextKeyService=h;this._onDidFocus=this._register(new E);this.onDidFocus=this._onDidFocus.event;this._onDidLayout=this._register(new E);this.onDidLayout=this._onDidLayout.event;this._onDidChangeActiveGroup=this._register(new E);this.onDidChangeActiveGroup=this._onDidChangeActiveGroup.event;this._onDidChangeGroupIndex=this._register(new E);this.onDidChangeGroupIndex=this._onDidChangeGroupIndex.event;this._onDidChangeGroupLabel=this._register(new E);this.onDidChangeGroupLabel=this._onDidChangeGroupLabel.event;this._onDidChangeGroupLocked=this._register(new E);this.onDidChangeGroupLocked=this._onDidChangeGroupLocked.event;this._onDidChangeGroupMaximized=this._register(new E);this.onDidChangeGroupMaximized=this._onDidChangeGroupMaximized.event;this._onDidActivateGroup=this._register(new E);this.onDidActivateGroup=this._onDidActivateGroup.event;this._onDidAddGroup=this._register(new Pm);this.onDidAddGroup=this._onDidAddGroup.event;this._onDidRemoveGroup=this._register(new Pm);this.onDidRemoveGroup=this._onDidRemoveGroup.event;this._onDidMoveGroup=this._register(new E);this.onDidMoveGroup=this._onDidMoveGroup.event;this.onDidSetGridWidget=this._register(new E);this._onDidChangeSizeConstraints=this._register(new Mh);this.onDidChangeSizeConstraints=H.any(this.onDidSetGridWidget.event,this._onDidChangeSizeConstraints.event);this._onDidScroll=this._register(new Mh);this.onDidScroll=H.any(this.onDidSetGridWidget.event,this._onDidScroll.event);this._onDidChangeEditorPartOptions=this._register(new E);this.onDidChangeEditorPartOptions=this._onDidChangeEditorPartOptions.event;this._onWillDispose=this._register(new E);this.onWillDispose=this._onWillDispose.event;this.workspaceMemento=this.getMemento(1,0);this.profileMemento=this.getMemento(0,1);this.groupViews=new Map;this.mostRecentActiveGroups=[];this.container=_(".content");this.gridWidgetDisposables=this._register(new P);this.gridWidgetView=this._register(new pbi);this.enforcedPartOptions=[];this.top=0;this.left=0;this.sideGroup={openEditor:(e,t)=>{let[o]=this.scopedInstantiationService.invokeFunction(n=>Eue(n,{editor:e,options:t},vn));return o.openEditor(e,t)}};this._isReady=!1;this.whenReadyPromise=new Go;this.whenReady=this.whenReadyPromise.p;this.whenRestoredPromise=new Go;this.whenRestored=this.whenRestoredPromise.p;this._willRestoreState=!1;this.priority=2;this.scopedContextKeyService=this._register(this.contextKeyService.createScoped(this.container)),this.scopedInstantiationService=this._register(this.instantiationService.createChild(new Io([X,this.scopedContextKeyService]))),this._partOptions=dui(this.configurationService,this.themeService),this.registerListeners()}static{this.EDITOR_PART_UI_STATE_STORAGE_KEY="editorpart.state"}static{this.EDITOR_PART_CENTERED_VIEW_STORAGE_KEY="editorpart.centeredview"}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>this.onConfigurationUpdated(e))),this._register(this.themeService.onDidFileIconThemeChange(()=>this.handleChangedPartOptions())),this._register(this.onDidChangeMementoValue(1,this._store)(e=>this.onDidChangeMementoState(e)))}onConfigurationUpdated(e){xXi(e)&&this.handleChangedPartOptions()}handleChangedPartOptions(){let e=this._partOptions,t=dui(this.configurationService,this.themeService);for(let o of this.enforcedPartOptions)Object.assign(t,o);this._partOptions=t,this._onDidChangeEditorPartOptions.fire({oldPartOptions:e,newPartOptions:t})}get partOptions(){return this._partOptions}enforcePartOptions(e){return this.enforcedPartOptions.push(e),this.handleChangedPartOptions(),Z(()=>{this.enforcedPartOptions.splice(this.enforcedPartOptions.indexOf(e),1),this.handleChangedPartOptions()})}get contentDimension(){return this._contentDimension}get activeGroup(){return this._activeGroup}get groups(){return Array.from(this.groupViews.values())}get count(){return this.groupViews.size}get orientation(){return this.gridWidget&&this.gridWidget.orientation===0?1:0}get isReady(){return this._isReady}get hasRestorableState(){return!!this.workspaceMemento[ck.EDITOR_PART_UI_STATE_STORAGE_KEY]}get willRestoreState(){return this._willRestoreState}getGroups(e=0){switch(e){case 0:return this.groups;case 1:{let t=si(this.mostRecentActiveGroups.map(o=>this.getGroup(o)));return Uo([...t,...this.groups])}case 2:{let t=[];return this.gridWidget&&this.fillGridNodes(t,this.gridWidget.getViews()),t}}}fillGridNodes(e,t){oJ(t)?t.children.forEach(o=>this.fillGridNodes(e,o)):e.push(t.view)}hasGroup(e){return this.groupViews.has(e)}getGroup(e){return this.groupViews.get(e)}findGroup(e,t=this.activeGroup,o){if(typeof e.direction=="number")return this.doFindGroupByDirection(e.direction,t,o);if(typeof e.location=="number")return this.doFindGroupByLocation(e.location,t,o);throw new Error("invalid arguments")}doFindGroupByDirection(e,t,o){let n=this.assertGroupView(t),r=this.gridWidget.getNeighborViews(n,this.toGridViewDirection(e),o);return r.sort(((s,l)=>this.mostRecentActiveGroups.indexOf(s.id)-this.mostRecentActiveGroups.indexOf(l.id))),r[0]}doFindGroupByLocation(e,t,o){let n=this.assertGroupView(t),r=this.getGroups(2),s=r.indexOf(n);switch(e){case 0:return r[0];case 1:return r[r.length-1];case 2:{let l=r[s+1];return!l&&o&&(l=this.doFindGroupByLocation(0,t)),l}case 3:{let l=r[s-1];return!l&&o&&(l=this.doFindGroupByLocation(1,t)),l}}}activateGroup(e,t,o){let n=this.assertGroupView(e);return this.doSetGroupActive(n,o),t||this.hostService.moveTop(Me(this.element)),n}restoreGroup(e){let t=this.assertGroupView(e);return this.doRestoreGroup(t),t}getSize(e){let t=this.assertGroupView(e);return this.gridWidget.getViewSize(t)}setSize(e,t){let o=this.assertGroupView(e);this.gridWidget.resizeView(o,t)}arrangeGroups(e,t=this.activeGroup){if(this.count<2||!this.gridWidget)return;let o=this.assertGroupView(t);switch(e){case 2:this.gridWidget.distributeViewSizes();break;case 0:if(this.groups.length<2)return;this.gridWidget.maximizeView(o),o.focus();break;case 1:this.gridWidget.expandView(o);break}}toggleMaximizeGroup(e=this.activeGroup){this.hasMaximizedGroup()?this.unmaximizeGroup():this.arrangeGroups(0,e)}toggleExpandGroup(e=this.activeGroup){this.isGroupExpanded(this.activeGroup)?this.arrangeGroups(2):this.arrangeGroups(1,e)}unmaximizeGroup(){this.gridWidget.exitMaximizedView(),this._activeGroup.focus()}hasMaximizedGroup(){return this.gridWidget.hasMaximizedView()}isGroupMaximized(e){return this.gridWidget.isViewMaximized(e)}isGroupExpanded(e){return this.gridWidget.isViewExpanded(e)}setGroupOrientation(e){if(!this.gridWidget)return;let t=e===0?1:0;this.gridWidget.orientation!==t&&(this.gridWidget.orientation=t)}applyLayout(e){let t=this.shouldRestoreFocus(this.container),o=0;function n(c){for(let u of c)Array.isArray(u.groups)?n(u.groups):o++}n(e.groups);let r=this.getGroups(2);if(o<r.length){let c=r[o-1];r.forEach((u,p)=>{p>=o&&this.mergeGroup(u,c)}),r=this.getGroups(2)}let s=this.activeGroup,l=tfi({orientation:this.toGridViewOrientation(e.orientation,this.isTwoDimensionalGrid()?this.gridWidget.orientation:BP(this.gridWidget.orientation)),groups:e.groups});this.doApplyGridState(l,s.id,r),t&&this._activeGroup.focus()}getLayout(){let e=this.gridWidget.serialize(),t=e.orientation===1?0:1,o=this.serializedNodeToGroupLayoutArgument(e.root);return{orientation:t,groups:o.groups}}serializedNodeToGroupLayoutArgument(e){return e.type==="branch"?{size:e.size,groups:e.data.map(t=>this.serializedNodeToGroupLayoutArgument(t))}:{size:e.size}}shouldRestoreFocus(e){return e?Pn()===e.ownerDocument.body?!0:ts(e):!1}isTwoDimensionalGrid(){let e=this.gridWidget.getViews();return oJ(e)?e.children.some(t=>oJ(t)):!1}addGroup(e,t,o){let n=this.assertGroupView(e),r;if(n.groupsView===this){let s=this.shouldRestoreFocus(n.element),l=this.groupViews.size>1&&this.isGroupExpanded(n);r=this.doCreateGroupView(o),this.gridWidget.addView(r,this.getSplitSizingStyle(),n,this.toGridViewDirection(t)),this.updateContainer(),this._onDidAddGroup.fire(r),this.notifyGroupIndexChange(),l&&this.arrangeGroups(1,r),s&&n.focus()}else r=n.groupsView.addGroup(n,t,o);return r}getSplitSizingStyle(){switch(this._partOptions.splitSizing){case"distribute":return JTe.Distribute;case"split":return JTe.Split;default:return JTe.Auto}}doCreateGroupView(e,t){let o;e instanceof Uf?o=Uf.createCopy(e,this.editorPartsView,this,this.groupsLabel,this.count,this.scopedInstantiationService,t):OQe(e)?o=Uf.createFromSerialized(e,this.editorPartsView,this,this.groupsLabel,this.count,this.scopedInstantiationService,t):o=Uf.createNew(this.editorPartsView,this,this.groupsLabel,this.count,this.scopedInstantiationService,t),this.groupViews.set(o.id,o);let n=new P;return n.add(o.onDidFocus(()=>{this.doSetGroupActive(o),this._onDidFocus.fire()})),n.add(o.onDidModelChange(r=>{switch(r.kind){case 3:this._onDidChangeGroupLocked.fire(o);break;case 1:this._onDidChangeGroupIndex.fire(o);break;case 2:this._onDidChangeGroupLabel.fire(o);break}})),n.add(o.onDidActiveEditorChange(()=>{this.updateContainer()})),H.once(o.onWillDispose)(()=>{Ue(n),this.groupViews.delete(o.id),this.doUpdateMostRecentActive(o)}),o}doSetGroupActive(e,t=0){if(this._activeGroup!==e){let o=this._activeGroup;this._activeGroup=e,this.doUpdateMostRecentActive(e,!0),o&&!o.disposed&&o.setActive(!1),e.setActive(!0),this.doRestoreGroup(e),this._onDidChangeActiveGroup.fire(e)}this._onDidActivateGroup.fire({group:e,reason:t})}doRestoreGroup(e){if(this.gridWidget)try{this.hasMaximizedGroup()&&!this.isGroupMaximized(e)&&this.unmaximizeGroup();let t=this.gridWidget.getViewSize(e);(t.width===e.minimumWidth||t.height===e.minimumHeight)&&this.arrangeGroups(1,e)}catch{}}doUpdateMostRecentActive(e,t){let o=this.mostRecentActiveGroups.indexOf(e.id);o!==-1&&this.mostRecentActiveGroups.splice(o,1),t&&this.mostRecentActiveGroups.unshift(e.id)}toGridViewDirection(e){switch(e){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3}}toGridViewOrientation(e,t){return typeof e=="number"?e===0?1:0:t}removeGroup(e,t){let o=this.assertGroupView(e);this.count!==1&&(o.isEmpty?this.doRemoveEmptyGroup(o,t):this.doRemoveGroupWithEditors(o))}doRemoveGroupWithEditors(e){let t=this.getGroups(1),o;this._activeGroup===e?o=t[1]:o=t[0],this.mergeGroup(e,o)}doRemoveEmptyGroup(e,t){let o=!t&&this.shouldRestoreFocus(this.container);if(this._activeGroup===e){let r=this.getGroups(1)[1];this.doSetGroupActive(r)}this.gridWidget.removeView(e,this.getSplitSizingStyle()),e.dispose(),o&&this._activeGroup.focus(),this.notifyGroupIndexChange(),this.updateContainer(),this._onDidRemoveGroup.fire(e)}moveGroup(e,t,o){let n=this.assertGroupView(e),r=this.assertGroupView(t);if(n.id===r.id)throw new Error("Cannot move group into its own");let s=this.shouldRestoreFocus(n.element),l;return n.groupsView===r.groupsView?(this.gridWidget.moveView(n,this.getSplitSizingStyle(),r,this.toGridViewDirection(o)),l=n):(l=r.groupsView.addGroup(r,o,n),n.closeAllEditors(),this.removeGroup(n,s)),s&&l.focus(),this._onDidMoveGroup.fire(l),this.notifyGroupIndexChange(),l}copyGroup(e,t,o){let n=this.assertGroupView(e),r=this.assertGroupView(t),s=this.shouldRestoreFocus(n.element),l=this.addGroup(r,o,n);return s&&l.focus(),l}mergeGroup(e,t,o){let n=this.assertGroupView(e),r=this.assertGroupView(t),s=[],l=o&&typeof o.index=="number"?o.index:r.count;for(let u of n.editors){let p=!n.isActive(u)||this._activeGroup!==n,h;r.contains(u)&&(r.isSticky(u)||o?.preserveExistingIndex)||(h=l,l++),s.push({editor:u,options:{index:h,inactive:p,preserveFocus:p}})}let c=!0;return o?.mode===0?n.copyEditors(s,r):c=n.moveEditors(s,r),n.isEmpty&&!n.disposed&&this.removeGroup(n,!0),c}mergeAllGroups(e,t){let o=this.assertGroupView(e),n=!0;for(let r of this.getGroups(1)){if(r===o)continue;this.mergeGroup(r,o,t)||(n=!1)}return n}assertGroupView(e){let t;if(typeof e=="number"?t=this.editorPartsView.getGroup(e):t=e,!t)throw new Error("Invalid editor group provided!");return t}createEditorDropTarget(e,t){return So(Ao(e)),this.scopedInstantiationService.createInstance(nDe,this,e,t)}get minimumWidth(){return Math.min(this.centeredLayoutWidget.minimumWidth,this.layoutService.getMaximumEditorDimensions(this.layoutService.getContainer(Me(this.container))).width)}get maximumWidth(){return this.centeredLayoutWidget.maximumWidth}get minimumHeight(){return Math.min(this.centeredLayoutWidget.minimumHeight,this.layoutService.getMaximumEditorDimensions(this.layoutService.getContainer(Me(this.container))).height)}get maximumHeight(){return this.centeredLayoutWidget.maximumHeight}get snap(){return this.layoutService.getPanelAlignment()==="center"}get onDidChange(){return H.any(this.centeredLayoutWidget.onDidChange,this.onDidSetGridWidget.event)}get gridSeparatorBorder(){return this.theme.getColor(vEt)||this.theme.getColor(gi)||Oe.transparent}updateStyles(){this.container.style.backgroundColor=this.getColor(qo)||"";let e={separatorBorder:this.gridSeparatorBorder,background:this.theme.getColor(g8e)||Oe.transparent};this.gridWidget.style(e),this.centeredLayoutWidget.styles(e)}createContentArea(e,t){return this.element=e,this.windowId!==It.vscodeWindowId&&this.container.classList.add("auxiliary"),e.appendChild(this.container),this._willRestoreState=!t||t.restorePreviousState,this.doCreateGridControl(),this.centeredLayoutWidget=this._register(new mOt(this.container,this.gridWidgetView,this.profileMemento[ck.EDITOR_PART_CENTERED_VIEW_STORAGE_KEY],this._partOptions.centeredLayoutFixedWidth)),this._register(this.onDidChangeEditorPartOptions(o=>this.centeredLayoutWidget.setFixedWidth(o.newPartOptions.centeredLayoutFixedWidth??!1))),this.setupDragAndDropSupport(e,this.container),this.handleContextKeys(),this.whenReadyPromise.complete(),this._isReady=!0,fn.settled(this.groups.map(o=>o.whenRestored)).finally(()=>{this.whenRestoredPromise.complete()}),this.container}handleContextKeys(){let e=Fj.bindTo(this.scopedContextKeyService),t=nV.bindTo(this.scopedContextKeyService),o=dz.bindTo(this.scopedContextKeyService),n=()=>{this.count>1?e.set(!0):e.reset(),this.hasMaximizedGroup()?t.set(!0):t.reset()},r=()=>{o.set(this.partOptions.showTabs==="multiple")};n(),r(),this._register(this.onDidAddGroup(()=>n())),this._register(this.onDidRemoveGroup(()=>n())),this._register(this.onDidChangeGroupMaximized(()=>n())),this._register(this.onDidChangeEditorPartOptions(()=>r()))}setupDragAndDropSupport(e,t){this._register(this.createEditorDropTarget(t,Object.create(null)));let o=_(".drop-block-overlay");e.appendChild(o),this._register(C$(o,()=>o.classList.remove("visible"))),this._register(KE.INSTANCE.registerTarget(this.element,{onDragStart:p=>o.classList.add("visible"),onDragEnd:p=>o.classList.remove("visible")}));let n,r,s,l,c=p=>{!this.layoutService.isVisible("workbench.parts.panel")&&p===this.layoutService.getPanelPosition()?this.layoutService.setPartHidden(!1,"workbench.parts.panel"):!this.layoutService.isVisible("workbench.parts.auxiliarybar")&&p===(this.layoutService.getSideBarPosition()===1?0:1)&&this.layoutService.setPartHidden(!1,"workbench.parts.auxiliarybar")},u=()=>{n&&(clearTimeout(n),n=void 0),r&&(clearTimeout(r),r=void 0)};this._register(KE.INSTANCE.registerTarget(o,{onDragOver:p=>{$t.stop(p.eventData,!0),p.eventData.dataTransfer&&(p.eventData.dataTransfer.dropEffect="none");let h=o.getBoundingClientRect(),g,f,v=100;p.eventData.clientX<h.left+v&&(g=0),p.eventData.clientX>h.right-v&&(g=1),p.eventData.clientY>h.bottom-v&&(f=2),p.eventData.clientY<h.top+v&&(f=3),n&&g!==s&&(clearTimeout(n),n=void 0),r&&f!==l&&(clearTimeout(r),r=void 0),!n&&g!==void 0&&(s=g,n=setTimeout(()=>c(g),200)),!r&&f!==void 0&&(l=f,r=setTimeout(()=>c(f),200))},onDragLeave:()=>u(),onDragEnd:()=>u(),onDrop:()=>u()}))}centerLayout(e){this.centeredLayoutWidget.activate(e)}isLayoutCentered(){return this.centeredLayoutWidget?this.centeredLayoutWidget.isActive():!1}doCreateGridControl(){let e=!1;if(this._willRestoreState&&(e=!this.doCreateGridControlWithPreviousState()),!this.gridWidget||e){let t=this.doCreateGroupView();this.doSetGridWidget(new O5(t)),this.doSetGroupActive(t)}this.updateContainer(),this.notifyGroupIndexChange()}doCreateGridControlWithPreviousState(){let e=this.loadState();if(e?.serializedGrid)try{this.mostRecentActiveGroups=e.mostRecentActiveGroups,this.doCreateGridControlWithState(e.serializedGrid,e.activeGroup)}catch(t){return mt(new Error(`Error restoring editor grid widget: ${t} (with state: ${JSON.stringify(e)})`)),this.disposeGroups(),!1}return!0}doCreateGridControlWithState(e,t,o,n){let r;o?r=o.slice(0):r=[];let s=[],l=O5.deserialize(e,{fromJSON:c=>{let u;return r.length>0?u=r.shift():u=this.doCreateGroupView(c,n),s.push(u),u.id===t&&this.doSetGroupActive(u),u}},{styles:{separatorBorder:this.gridSeparatorBorder}});this._activeGroup||this.doSetGroupActive(s[0]),this.mostRecentActiveGroups.some(c=>!this.getGroup(c))&&(this.mostRecentActiveGroups=s.map(c=>c.id)),this.doSetGridWidget(l)}doSetGridWidget(e){let t={};this.gridWidget&&(t=this.gridWidget.boundarySashes,this.gridWidget.dispose()),this.gridWidget=e,this.gridWidget.boundarySashes=t,this.gridWidgetView.gridWidget=e,this._onDidChangeSizeConstraints.input=e.onDidChange,this._onDidScroll.input=e.onDidScroll,this.gridWidgetDisposables.clear(),this.gridWidgetDisposables.add(e.onDidChangeViewMaximized(o=>this._onDidChangeGroupMaximized.fire(o))),this.onDidSetGridWidget.fire(void 0)}updateContainer(){this.container.classList.toggle("empty",this.isEmpty)}notifyGroupIndexChange(){this.getGroups(2).forEach((e,t)=>e.notifyIndexChanged(t))}notifyGroupsLabelChange(e){for(let t of this.groups)t.notifyLabelChanged(e)}get isEmpty(){return this.count===1&&this._activeGroup.isEmpty}setBoundarySashes(e){this.gridWidget.boundarySashes=e,this.centeredLayoutWidget.boundarySashes=e}layout(e,t,o,n){this.top=o,this.left=n;let r=super.layoutContents(e,t).contentSize;this.doLayout(ai.lift(r),o,n)}doLayout(e,t=this.top,o=this.left){this._contentDimension=e,this.centeredLayoutWidget.layout(this._contentDimension.width,this._contentDimension.height,t,o),this._onDidLayout.fire(e)}saveState(){if(this.gridWidget&&(this.isEmpty?delete this.workspaceMemento[ck.EDITOR_PART_UI_STATE_STORAGE_KEY]:this.workspaceMemento[ck.EDITOR_PART_UI_STATE_STORAGE_KEY]=this.createState()),this.centeredLayoutWidget){let e=this.centeredLayoutWidget.state;this.centeredLayoutWidget.isDefault(e)?delete this.profileMemento[ck.EDITOR_PART_CENTERED_VIEW_STORAGE_KEY]:this.profileMemento[ck.EDITOR_PART_CENTERED_VIEW_STORAGE_KEY]=e}super.saveState()}loadState(){return this.workspaceMemento[ck.EDITOR_PART_UI_STATE_STORAGE_KEY]}createState(){return{serializedGrid:this.gridWidget.serialize(),activeGroup:this._activeGroup.id,mostRecentActiveGroups:this.mostRecentActiveGroups}}applyState(e,t){return e==="empty"?this.doApplyEmptyState():this.doApplyState(e,t)}async doApplyState(e,t){let o=await this.doPrepareApplyState();this._onDidAddGroup.pause(),this._onDidRemoveGroup.pause(),this.disposeGroups(),this.mostRecentActiveGroups=e.mostRecentActiveGroups;try{this.doApplyGridState(e.serializedGrid,e.activeGroup,void 0,t)}finally{this._onDidRemoveGroup.resume(),this._onDidAddGroup.resume()}await this.activeGroup.openEditors(o.flatMap(n=>n.editors).filter(n=>this.editorPartsView.groups.every(r=>!r.contains(n))).map(n=>({editor:n,options:{pinned:!0,preserveFocus:!0,inactive:!0}})))}async doApplyEmptyState(){await this.doPrepareApplyState(),this.mergeAllGroups(this.activeGroup)}async doPrepareApplyState(){let e=this.getGroups(1);for(let t of e)await t.closeAllEditors({excludeConfirming:!0});return e}doApplyGridState(e,t,o,n){this.doCreateGridControlWithState(e,t,o,n),this.doLayout(this._contentDimension),this.updateContainer();for(let r of this.getGroups(2))o?.includes(r)||this._onDidAddGroup.fire(r);this.notifyGroupIndexChange()}onDidChangeMementoState(e){if(e.external&&e.scope===1){this.reloadMemento(e.scope);let t=this.loadState();t&&this.applyState(t)}}toJSON(){return{type:"workbench.parts.editor"}}disposeGroups(){for(let e of this.groups)e.dispose(),this._onDidRemoveGroup.fire(e);this.groupViews.clear(),this.mostRecentActiveGroups=[]}dispose(){this._onWillDispose.fire(),this.disposeGroups(),this.gridWidget?.dispose(),super.dispose()}};ck=I([m(4,F),m(5,De),m(6,B),m(7,le),m(8,fi),m(9,oi),m(10,X)],ck);var rDe=class extends ck{constructor(i,e,t,o,n,r,s,l){super(i,"workbench.parts.editor","",It.vscodeWindowId,e,t,o,n,r,s,l)}};rDe=I([m(1,F),m(2,De),m(3,B),m(4,le),m(5,fi),m(6,oi),m(7,X)],rDe);async function Tno(a){let i=navigator.usb;if(!i)return;let e=await i.requestDevice({filters:a?.filters??[]});if(e)return{deviceClass:e.deviceClass,deviceProtocol:e.deviceProtocol,deviceSubclass:e.deviceSubclass,deviceVersionMajor:e.deviceVersionMajor,deviceVersionMinor:e.deviceVersionMinor,deviceVersionSubminor:e.deviceVersionSubminor,manufacturerName:e.manufacturerName,productId:e.productId,productName:e.productName,serialNumber:e.serialNumber,usbVersionMajor:e.usbVersionMajor,usbVersionMinor:e.usbVersionMinor,usbVersionSubminor:e.usbVersionSubminor,vendorId:e.vendorId}}async function _no(a){let i=navigator.serial;if(!i)return;let e=await i.requestPort({filters:a?.filters??[]});if(!e)return;let t=e.getInfo();return{usbVendorId:t.usbVendorId,usbProductId:t.usbProductId}}async function Dno(a){let i=navigator.hid;if(!i)return;let e=await i.requestDevice({filters:a?.filters??[]});if(!e.length)return;let t=e[0];return{opened:t.opened,vendorId:t.vendorId,productId:t.productId,productName:t.productName,collections:t.collections}}var ojo=d(2112,null),njo=d(2110,null),rjo=d(2111,null),gOt={open:ojo,close:njo,find:rjo};async function Lno(a,i){let e=[];return await Rno(a,e,i.logsHome,i.logsHome),e}async function Rno(a,i,e,t){let o=await a.resolve(e);for(let{resource:n,isDirectory:r}of o.children||[])if(r)await Rno(a,i,n,t);else{let s=(await a.readFile(n)).value.toString();if(s){let l=Fc(t,n);l&&i.push({relativePath:l,contents:s})}}}var SYe=class{constructor(i,e,t,o){this.fileService=i;this.environmentService=e;this.lifecycleService=t;this.logService=o}async getLogs(){return Lno(this.fileService,this.environmentService)}async whenWorkbenchRestored(){this.logService.info("[driver] Waiting for restored lifecycle phase..."),await this.lifecycleService.when(3),this.logService.info("[driver] Restored lifecycle phase reached. Waiting for contributions..."),await oe.as(Qi.Workbench).whenRestored,this.logService.info("[driver] Workbench contributions created.")}async setValue(i,e){let t=It.document.querySelector(i);if(!t)return Promise.reject(new Error(`Element not found: ${i}`));let o=t;o.value=e;let n=new Event("input",{bubbles:!0,cancelable:!0});o.dispatchEvent(n)}async isActiveElement(i){if(It.document.querySelector(i)!==It.document.activeElement){let t=[],o=It.document.activeElement;for(;o;){let n=o.tagName,r=o.id?`#${o.id}`:"",s=si(o.className.split(/\s+/g).map(l=>l.trim())).map(l=>`.${l}`).join("");t.unshift(`${n}${r}${s}`),o=o.parentElement}throw new Error(`Active element not found. Current active element is '${t.join(" > ")}'. Looking for ${i}`)}return!0}async getElements(i,e){let t=It.document.querySelectorAll(i),o=[];for(let n=0;n<t.length;n++){let r=t.item(n);o.push(this.serializeElement(r,e))}return o}serializeElement(i,e){let t=Object.create(null);for(let s=0;s<i.attributes.length;s++){let l=i.attributes.item(s);l&&(t[l.name]=l.value)}let o=[];if(e)for(let s=0;s<i.children.length;s++){let l=i.children.item(s);l&&o.push(this.serializeElement(l,!0))}let{left:n,top:r}=gN(i);return{tagName:i.tagName,className:i.className,textContent:i.textContent||"",attributes:t,children:o,left:n,top:r}}async getElementXY(i,e,t){let o=typeof e=="number"&&typeof t=="number"?{x:e,y:t}:void 0;return this._getElementXY(i,o)}async typeInEditor(i,e){let t=It.document.querySelector(i);if(!t)throw new Error(`Editor not found: ${i}`);if(r7t(t)){let o=t.editContext;if(!o)throw new Error(`Edit context not found: ${i}`);let n=o.selectionStart,r=o.selectionEnd,s=new TextUpdateEvent("textupdate",{updateRangeStart:n,updateRangeEnd:r,text:e,selectionStart:n+e.length,selectionEnd:n+e.length,compositionStart:0,compositionEnd:0});o.dispatchEvent(s)}else if(L6(t)){let o=t.selectionStart,n=o+e.length,r=t.value,s=r.substr(0,o)+e+r.substr(o);t.value=s,t.setSelectionRange(n,n);let l=new Event("input",{bubbles:!0,cancelable:!0});t.dispatchEvent(l)}}async getEditorSelection(i){let e=It.document.querySelector(i);if(!e)throw new Error(`Editor not found: ${i}`);if(r7t(e)){let t=e.editContext;if(!t)throw new Error(`Edit context not found: ${i}`);return{selectionStart:t.selectionStart,selectionEnd:t.selectionEnd}}else{if(L6(e))return{selectionStart:e.selectionStart,selectionEnd:e.selectionEnd};throw new Error(`Unknown type of element: ${i}`)}}async getTerminalBuffer(i){let e=It.document.querySelector(i);if(!e)throw new Error(`Terminal not found: ${i}`);let t=e.xterm;if(!t)throw new Error(`Xterm not found: ${i}`);let o=[];for(let n=0;n<t.buffer.active.length;n++)o.push(t.buffer.active.getLine(n).translateToString(!0));return o}async writeInTerminal(i,e){let t=It.document.querySelector(i);if(!t)throw new Error(`Element not found: ${i}`);let o=t.xterm;if(!o)throw new Error(`Xterm not found: ${i}`);o.input(e)}getLocaleInfo(){return Promise.resolve({language:Dr,locale:abe})}getLocalizedStrings(){return Promise.resolve({open:gOt.open,close:gOt.close,find:gOt.find})}async _getElementXY(i,e){let t=It.document.querySelector(i);if(!t)return Promise.reject(new Error(`Element not found: ${i}`));let{left:o,top:n}=gN(t),{width:r,height:s}=Fm(t),l,c;return e?(l=o+e.x,c=n+e.y):(l=o+r/2,c=n+s/2),l=Math.round(l),c=Math.round(c),{x:l,y:c}}};SYe=I([m(0,be),m(1,Co),m(2,ao),m(3,ne)],SYe);function fOt(a){Object.assign(It,{driver:a.createInstance(SYe)})}var tD=class extends C{constructor(e,t={getWindowsCount:Kbe,getWindows:Gw},o,n,r,s){super();this.hostService=o;this.environmentService=n;this.contextMenuService=r;this.layoutService=s;this.enableWindowFocusOnElementFocus(e),this.enableMultiWindowAwareTimeout(e,t),this.registerFullScreenListeners(e.vscodeWindowId),this.registerContextMenuListeners(e)}static{this.TIMEOUT_HANDLES=Number.MIN_SAFE_INTEGER}static{this.TIMEOUT_DISPOSABLES=new Map}enableWindowFocusOnElementFocus(e){let t=e.HTMLElement.prototype.focus,o=this;e.HTMLElement.prototype.focus=function(n){o.onElementFocus(Me(this)),t.apply(this,[n])}}onElementFocus(e){!e.document.hasFocus()&&wzi()&&(e.focus(),!this.environmentService.extensionTestsLocationURI&&!e.document.hasFocus()&&this.hostService.focus(e))}enableMultiWindowAwareTimeout(e,t={getWindowsCount:Kbe,getWindows:Gw}){let o=e.setTimeout;Object.defineProperty(e,"vscodeOriginalSetTimeout",{get:()=>o});let n=e.clearTimeout;Object.defineProperty(e,"vscodeOriginalClearTimeout",{get:()=>n}),e.setTimeout=function(r,s=0,...l){if(t.getWindowsCount()===1||typeof r=="string"||s===0)return o.apply(this,[r,s,...l]);let c=new Set,u=tD.TIMEOUT_HANDLES++;tD.TIMEOUT_DISPOSABLES.set(u,c);let p=wd(r,()=>{Ue(c),tD.TIMEOUT_DISPOSABLES.delete(u)});for(let{window:h,disposables:g}of t.getWindows()){if(Cy(h)&&h.document.visibilityState==="hidden")continue;let f=!1,v=h.vscodeOriginalSetTimeout?.apply(this,[(...S)=>{f||p(...S)},s,...l]),b=Z(()=>{f=!0,h.vscodeOriginalClearTimeout?.apply(this,[v]),c.delete(b)});g.add(b),c.add(b)}return u},e.clearTimeout=function(r){let s=typeof r=="number"?tD.TIMEOUT_DISPOSABLES.get(r):void 0;s?(Ue(s),tD.TIMEOUT_DISPOSABLES.delete(r)):n.apply(this,[r])}}static async confirmOnShutdown(e,t){let o=e.get(ct),n=e.get(B),r=t===2?it?d(4273,null):d(4272,null):d(4263,null),s=t===2?it?d(4271,null):d(4265,null):d(4262,null),l=await o.confirm({message:r,primaryButton:s,checkbox:{label:d(4264,null)}});return l.confirmed&&l.checkboxChecked&&await n.updateValue("window.confirmBeforeClose","never"),l.confirmed}registerFullScreenListeners(e){this._register(this.hostService.onDidChangeFullScreen(({windowId:t,fullscreen:o})=>{if(t===e){let n=qv(e);n&&s$(o,n.window)}}))}registerContextMenuListeners(e){if(e!==It)return;let t=o=>this.layoutService.activeContainer.classList.toggle("context-menu-visible",o);this._register(this.contextMenuService.onDidShowContextMenu(()=>t(!0))),this._register(this.contextMenuService.onDidHideContextMenu(()=>t(!1)))}};tD=I([m(2,oi),m(3,Vt),m(4,ze),m(5,fi)],tD);var vOt=class extends tD{constructor(e,t,o,n,r,s,l,c,u,p){super(It,void 0,u,s,p,l);this.openerService=e;this.lifecycleService=t;this.dialogService=o;this.labelService=n;this.productService=r;this.browserEnvironmentService=s;this.instantiationService=c;this.registerListeners(),this.create()}registerListeners(){this._register(this.lifecycleService.onWillShutdown(()=>this.onWillShutdown()));let e=Nc&&It.visualViewport?It.visualViewport:It;this._register(j(e,re.RESIZE,()=>{this.layoutService.layout(),Nc&&It.scrollTo(0,0)})),this._register(j(this.layoutService.mainContainer,re.WHEEL,t=>t.preventDefault(),{passive:!1})),this._register(j(this.layoutService.mainContainer,re.CONTEXT_MENU,t=>$t.stop(t,!0))),this._register(j(this.layoutService.mainContainer,re.DROP,t=>$t.stop(t,!0)))}onWillShutdown(){H.toPromise(H.any(H.once(new On(It.document.body,re.KEY_DOWN,!0).event),H.once(new On(It.document.body,re.MOUSE_DOWN,!0).event))).then(async()=>{await Pi(3e3),await this.dialogService.prompt({type:gt.Error,message:d(4276,null),detail:d(4277,null),buttons:[{label:d(4274,null),run:()=>It.location.reload()}]})})}create(){this.setupOpenHandlers(),this.registerLabelFormatters(),this.registerCommands(),this.setupDriver()}setupDriver(){this.environmentService.enableSmokeTestDriver&&fOt(this.instantiationService)}setupOpenHandlers(){this.openerService.setDefaultExternalOpener({openExternal:async e=>{let t=!1;if(this.browserEnvironmentService.options?.openerAllowedExternalUrlPrefixes){for(let o of this.browserEnvironmentService.options.openerAllowedExternalUrlPrefixes)if(e.startsWith(o)){t=!0;break}}if(jd(e,Y.http)||jd(e,Y.https))Vb?Pzi(e,!t)||await this.dialogService.prompt({type:gt.Warning,message:d(4278,null),custom:{markdownDetails:[{markdown:new xe(d(4279,null,"https://aka.ms/allow-vscode-popup"),!0)}]},buttons:[{label:d(4275,null),run:()=>t?l7t(e):PGe(e)}],cancelButton:!0}):t?l7t(e):PGe(e);else{let o=()=>{this.lifecycleService.withExpectedShutdown({disableShutdownHandling:!0},()=>It.location.href=e)};o();let n=async()=>{let{downloadUrl:r}=this.productService,s,l=[{label:d(4267,null),run:()=>o()}];r!==void 0?(s=d(4268,null,this.productService.nameLong,this.productService.nameLong),l.push({label:d(4266,null),run:async()=>{await this.openerService.open(A.parse(r)),n()}})):s=d(4269,null,this.productService.nameLong,this.productService.nameLong),await this.hostService.withExpectedShutdown(()=>this.dialogService.prompt({type:gt.Info,message:d(4270,null),detail:s,buttons:l,cancelButton:!0}))};jd(e,this.productService.urlProtocol)&&await n()}return!0}})}registerLabelFormatters(){this._register(this.labelService.registerFormatter({scheme:Y.vscodeUserData,priority:!0,formatting:{label:"(Settings) ${path}",separator:"/"}}))}registerCommands(){qe.registerCommand("workbench.experimental.requestUsbDevice",async(e,t)=>Tno(t)),qe.registerCommand("workbench.experimental.requestSerialPort",async(e,t)=>_no(t)),qe.registerCommand("workbench.experimental.requestHidDevice",async(e,t)=>Dno(t))}};vOt=I([m(0,Qe),m(1,ao),m(2,ct),m(3,ot),m(4,nt),m(5,ru),m(6,fi),m(7,F),m(8,oi),m(9,ze)],vOt);var $P=ae("auxiliaryWindowService");var sjo=new ai(FSt.width,FSt.height),Tue=class extends tD{constructor(e,t,o,n,r,s,l,c){super(e,void 0,r,s,l,c);this.window=e;this.container=t;this.configurationService=n;this._onWillLayout=this._register(new E);this.onWillLayout=this._onWillLayout.event;this._onDidLayout=this._register(new E);this.onDidLayout=this._onDidLayout.event;this._onBeforeUnload=this._register(new E);this.onBeforeUnload=this._onBeforeUnload.event;this._onUnload=this._register(new E);this.onUnload=this._onUnload.event;this._onWillDispose=this._register(new E);this.onWillDispose=this._onWillDispose.event;this.compact=!1;this.whenStylesHaveLoaded=o.wait().then(()=>{}),this.registerListeners()}updateOptions(e){this.compact=e.compact}registerListeners(){this._register(j(this.window,re.BEFORE_UNLOAD,e=>this.handleBeforeUnload(e))),this._register(j(this.window,re.UNLOAD,()=>this.handleUnload())),this._register(j(this.window,"unhandledrejection",e=>{mt(e.reason),e.preventDefault()})),this._register(j(this.window,re.RESIZE,()=>this.layout())),this._register(j(this.container,re.SCROLL,()=>this.container.scrollTop=0)),Gt?(this._register(j(this.container,re.DROP,e=>$t.stop(e,!0))),this._register(j(this.container,re.WHEEL,e=>e.preventDefault(),{passive:!1})),this._register(j(this.container,re.CONTEXT_MENU,e=>$t.stop(e,!0)))):(this._register(j(this.window.document.body,re.DRAG_OVER,e=>$t.stop(e))),this._register(j(this.window.document.body,re.DROP,e=>$t.stop(e))))}handleBeforeUnload(e){let t;if(this._onBeforeUnload.fire({veto(r){r&&(t=r)}}),t){this.handleVetoBeforeClose(e,t);return}let o=this.configurationService.getValue("window.confirmBeforeClose");(o==="always"||o==="keyboardOnly"&&bf.getInstance().isModifierPressed)&&this.confirmBeforeClose(e)}handleVetoBeforeClose(e,t){this.preventUnload(e)}preventUnload(e){e.preventDefault(),e.returnValue=d(16654,null)}confirmBeforeClose(e){this.preventUnload(e)}handleUnload(){this._onUnload.fire()}layout(){let e=Fm(this.window.document.body,sjo,this.container);this._onWillLayout.fire(e),this._onDidLayout.fire(e)}createState(){return{bounds:{x:this.window.screenX,y:this.window.screenY,width:this.window.outerWidth,height:this.window.outerHeight},zoomLevel:RT(this.window),compact:this.compact}}dispose(){this._store.isDisposed||(this._onWillDispose.fire(),super.dispose())}};Tue=I([m(3,B),m(4,oi),m(5,Vt),m(6,ze),m(7,fi)],Tue);var Z5=class extends C{constructor(e,t,o,n,r,s,l){super();this.layoutService=e;this.dialogService=t;this.configurationService=o;this.telemetryService=n;this.hostService=r;this.environmentService=s;this.contextMenuService=l;this._onDidOpenAuxiliaryWindow=this._register(new E);this.onDidOpenAuxiliaryWindow=this._onDidOpenAuxiliaryWindow.event;this.windows=new Map}static{this.WINDOW_IDS=sg(It)+1}async open(e){sn("code/auxiliaryWindow/willOpen");let t=await this.openWindow(e);if(!t)throw new Error(d(16658,null));let o=await this.resolveWindowId(t);_ut(t,o);let n=new P,{container:r,stylesLoaded:s}=this.createContainer(t,n,e),l=this.createAuxiliaryWindow(t,r,s);l.updateOptions({compact:e?.compact??!1});let c=new P;this.windows.set(t.vscodeWindowId,l),c.add(Z(()=>this.windows.delete(t.vscodeWindowId)));let u=new P;return H.once(l.onWillDispose)(()=>{t.close(),n.dispose(),c.dispose(),u.dispose()}),c.add(bzi(t)),this._onDidOpenAuxiliaryWindow.fire({window:l,disposables:u}),sn("code/auxiliaryWindow/didOpen"),this.telemetryService.publicLog2("auxiliaryWindowOpen",{bounds:!!e?.bounds}),l}createAuxiliaryWindow(e,t,o){return new Tue(e,t,o,this.configurationService,this.hostService,this.environmentService,this.contextMenuService,this.layoutService)}async openWindow(e){let t=Ki(),o={x:t.screenX,y:t.screenY,width:t.outerWidth,height:t.outerHeight},n=FSt,r=Math.max(e?.bounds?.width??n.width,owe.WIDTH),s=Math.max(e?.bounds?.height??n.height,owe.HEIGHT),l={x:e?.bounds?.x??Math.max(o.x+o.width/2-r/2,0),y:e?.bounds?.y??Math.max(o.y+o.height/2-s/2,0),width:r,height:s};!e?.bounds&&l.x===o.x&&l.y===o.y&&(l={...l,x:l.x+30,y:l.y+30});let c=si(["popup=yes",`left=${l.x}`,`top=${l.y}`,`width=${l.width}`,`height=${l.height}`,e?.nativeTitlebar?"window-native-titlebar=yes":void 0,e?.disableFullscreen?"window-disable-fullscreen=yes":void 0,e?.alwaysOnTop?"window-always-on-top=yes":void 0,e?.mode===0?"window-maximized=yes":void 0,e?.mode===2?"window-fullscreen=yes":void 0]),u=It.open(lbe?"":"about:blank",void 0,c.join(","));return!u&&Gt?(await this.dialogService.prompt({type:gt.Warning,message:d(16656,null),custom:{markdownDetails:[{markdown:new xe(d(16657,null,"https://aka.ms/allow-vscode-popup"),!0)}]},buttons:[{label:d(16655,null),run:()=>this.openWindow(e)}],cancelButton:!0})).result:u?.window}async resolveWindowId(e){return Z5.WINDOW_IDS++}createContainer(e,t,o){e.document.createElement=function(){throw new Error('Not allowed to create elements in child window JavaScript context. Always use the main window so that "xyz instanceof HTMLElement" continues to work.')},this.applyMeta(e);let{stylesLoaded:n}=this.applyCSS(e,t),r=this.applyHTML(e,t);return{stylesLoaded:n,container:r}}applyMeta(e){for(let o of['meta[charset="utf-8"]','meta[http-equiv="Content-Security-Policy"]','meta[name="viewport"]','meta[name="theme-color"]']){let n=It.document.querySelector(o);if(n){let r=Ypt(e.document.head);if(tmt(n,r),o==='meta[http-equiv="Content-Security-Policy"]'){let s=r.getAttribute("content");s&&r.setAttribute("content",s.replace(/(script-src[^\;]*)/,"script-src 'none'"))}}}let t=It.document.querySelector('link[rel="icon"]');if(t){let o=Xpt(e.document.head);tmt(t,o)}}applyCSS(e,t){sn("code/auxiliaryWindow/willApplyCSS");let o=new Map,n=new Np;n.wait().then(()=>sn("code/auxiliaryWindow/didLoadCSSStyles"));let r=t.add(new P),s=0;function l(){--s===0&&(r.dispose(),n.open())}function c(u){if(W2i(u))return;let p=e.document.head.appendChild(u.cloneNode(!0));u.tagName.toLowerCase()==="link"&&(s++,r.add(j(p,"load",l)),r.add(j(p,"error",l))),o.set(u,p)}s++;try{for(let u of It.document.head.querySelectorAll('link[rel="stylesheet"], style'))c(u)}finally{l()}return t.add(V2i(e)),t.add(MGe.observe(It.document.head,t,{childList:!0,subtree:!0})(u=>{for(let p of u)if(!(p.type!=="childList"||p.target.nodeName.toLowerCase()==="title"||p.target.nodeName.toLowerCase()==="script"||p.target.nodeName.toLowerCase()==="meta")){for(let h of p.addedNodes)if(Ao(h)&&(h.tagName.toLowerCase()==="style"||h.tagName.toLowerCase()==="link"))c(h);else if(h.nodeType===Node.TEXT_NODE&&h.parentNode){let g=o.get(h.parentNode);g&&(g.textContent=h.textContent)}for(let h of p.removedNodes){let g=o.get(h);g&&(g.parentNode?.removeChild(g),o.delete(h))}}})),sn("code/auxiliaryWindow/didApplyCSS"),{stylesLoaded:n}}applyHTML(e,t){sn("code/auxiliaryWindow/willApplyHTML");let o=_("div",{role:"application"});return Czi(o,0,0,0,0,"relative"),o.style.display="flex",o.style.height="100%",o.style.flexDirection="column",e.document.body.append(o),t.add(imt(It.document.documentElement,e.document.documentElement)),t.add(imt(It.document.body,e.document.body)),t.add(imt(this.layoutService.mainContainer,o,["class"])),sn("code/auxiliaryWindow/didApplyHTML"),o}getWindow(e){return this.windows.get(e)}};Z5=I([m(0,fi),m(1,ct),m(2,B),m(3,Te),m(4,oi),m(5,Vt),m(6,ze)],Z5);we($P,Z5,1);var qP=ae("titleService");var bOt=Mp(new E);W(class extends K{constructor(){super({id:"workbench.action.toggleCompactAuxiliaryWindow",title:L(3571,"Toggle Window Compact Mode"),category:We.View,f1:!0,precondition:sw})}async run(){bOt.fire({windowId:Ki().vscodeWindowId,compact:"toggle"})}});W(class extends K{constructor(){super({id:"workbench.action.enableCompactAuxiliaryWindow",title:d(3570,null),icon:M.screenFull,menu:{id:D.LayoutControlMenu,when:x.and(aV.toNegated(),Xc),order:0}})}async run(){bOt.fire({windowId:Ki().vscodeWindowId,compact:!0})}});W(class extends K{constructor(){super({id:"workbench.action.disableCompactAuxiliaryWindow",title:d(3569,null),icon:M.screenNormal,menu:{id:D.LayoutControlMenu,when:x.and(aV,Xc),order:0}})}async run(){bOt.fire({windowId:Ki().vscodeWindowId,compact:!1})}});var jV=class{constructor(i,e,t,o,n,r,s,l,c){this.editorPartsView=i;this.instantiationService=e;this.auxiliaryWindowService=t;this.lifecycleService=o;this.configurationService=n;this.statusbarService=r;this.titleService=s;this.editorService=l;this.layoutService=c}static{this.STATUS_BAR_VISIBILITY="workbench.statusBar.visible"}async create(i,e){let t=this,o=new P,n=!!e?.compact;function r(){let T=0;return y&&(T+=S.height),f&&v&&(T+=f.height),T}function s(T){y?bn(S.container):xo(S.container),T&&u.layout()}function l(T){f&&(v?bn(f.container):xo(f.container),T&&u.layout())}function c(T){if(T===n)return;n=T,u.updateOptions({compact:n}),f?.updateOptions({compact:n}),h.updateOptions({compact:n});let N=y;y=!n&&t.configurationService.getValue(jV.STATUS_BAR_VISIBILITY)!==!1,N!==y&&s(!0)}let u=o.add(await this.auxiliaryWindowService.open(e)),p=_(".part.editor",{role:"main"});p.style.position="relative",u.container.appendChild(p);let h=o.add(this.instantiationService.createInstance(_ue,u.window.vscodeWindowId,this.editorPartsView,e?.state,i));h.updateOptions({compact:n}),o.add(this.editorPartsView.registerPart(h)),h.create(p);let g=o.add(h.scopedInstantiationService.createChild(new Io([ee,this.editorService.createScoped(h,o)]))),f,v=!1;if(kr&&rwe(this.configurationService)){f=o.add(this.titleService.createAuxiliaryTitlebarPart(u.container,h,g)),f.updateOptions({compact:n}),v=kui(this.configurationService,u.window,void 0);let T=()=>{let N=v;v=kui(this.configurationService,u.window,void 0),N!==v&&l(!0)};o.add(f.onDidChange(()=>u.layout())),o.add(this.layoutService.onDidChangePartVisibility(()=>T())),o.add(Bk(N=>{N===u.window.vscodeWindowId&&T()})),l(!1)}else o.add(g.createInstance(VP,u.window));let S=o.add(this.statusbarService.createAuxiliaryStatusbarPart(u.container,g)),y=!n&&this.configurationService.getValue(jV.STATUS_BAR_VISIBILITY)!==!1;o.add(this.configurationService.onDidChangeConfiguration(T=>{T.affectsConfiguration(jV.STATUS_BAR_VISIBILITY)&&(y=!n&&this.configurationService.getValue(jV.STATUS_BAR_VISIBILITY)!==!1,s(!0))})),s(!1);let w=o.add(H.once(h.onWillClose)(()=>u.window.close()));o.add(H.once(u.onUnload)(()=>{o.isDisposed||(w.dispose(),h.close(),o.dispose())})),o.add(H.once(this.lifecycleService.onDidShutdown)(()=>o.dispose())),o.add(u.onBeforeUnload(T=>{for(let N of h.groups)for(let O of N.editors){let V=O.canMove(N.id,this.editorPartsView.mainPart.activeGroup.id);if(typeof V=="string"){N.openEditor(O),T.veto(V);return}}})),o.add(u.onWillLayout(T=>{let N=f?.height??0;f?.layout(T.width,N,0,0);let O=T.height-r();h.layout(T.width,O,N,0),S.layout(T.width,S.height,T.height-S.height,0)})),u.layout(),o.add(bOt.event(T=>{if(T.windowId===u.window.vscodeWindowId){let N;typeof T.compact=="boolean"?N=T.compact:N=!n,c(N)}})),o.add(h.onDidAddGroup(T=>{c(!1),o.add(T.onDidActiveEditorChange(()=>{T.count>1&&c(!1)}))})),o.add(h.activeGroup.onDidActiveEditorChange(()=>{h.activeGroup.count>1&&c(!1)}));let k=o.add(g.createChild(new Io([Tr,this.statusbarService.createScoped(S,o)])));return{part:h,instantiationService:k,disposables:o}}};jV=I([m(1,F),m(2,$P),m(3,ao),m(4,B),m(5,Tr),m(6,qP),m(7,ee),m(8,fi)],jV);var _ue=class extends ck{constructor(e,t,o,n,r,s,l,c,u,p,h){let g=_ue.COUNTER++;super(t,`workbench.parts.auxiliaryEditor.${g}`,n,e,r,s,l,c,u,p,h);this.state=o;this._onWillClose=this._register(new E);this.onWillClose=this._onWillClose.event;this.optionsDisposable=this._register(new me);this.isCompact=!1}static{this.COUNTER=1}handleContextKeys(){Xc.bindTo(this.scopedContextKeyService).set(!0),super.handleContextKeys()}updateOptions(e){this.isCompact=e.compact,e.compact?this.optionsDisposable.value||(this.optionsDisposable.value=this.enforcePartOptions({showTabs:"none",closeEmptyGroups:!0})):this.optionsDisposable.clear()}addGroup(e,t,o){return this.isCompact&&(e=this.editorPartsView.mainPart.activeGroup),super.addGroup(e,t,o)}removeGroup(e,t){let o=this.assertGroupView(e);this.count===1&&this.activeGroup===o?this.doRemoveLastGroup(t):super.removeGroup(e,t)}doRemoveLastGroup(e){let t=!e&&this.shouldRestoreFocus(this.container),n=this.editorPartsView.getGroups(1)[1];n&&n.groupsView.activateGroup(n,void 0,1),n&&t&&(n.groupsView===this.editorPartsView.mainPart&&!this.layoutService.isVisible("workbench.parts.editor",It)||n.focus()),this.doClose(!1)}loadState(){return this.state}saveState(){}close(){return this.doClose(!0)}doClose(e){let t=!0;if(e){for(let o of this.groups)o.closeAllEditors({excludeConfirming:!0});if(t=this.mergeGroupsToMainPart(),!t)return!1}return this._onWillClose.fire(),t}mergeGroupsToMainPart(){if(!this.groups.some(o=>o.count>0))return!0;let e;for(let o of this.editorPartsView.mainPart.getGroups(1))if(!o.isLocked){e=o;break}e||(e=this.editorPartsView.mainPart.addGroup(this.editorPartsView.mainPart.activeGroup,this.partOptions.openSideBySideDirection==="right"?3:1));let t=this.mergeAllGroups(e,{preserveExistingIndex:!0});return e.focus(),t}};_ue=I([m(4,F),m(5,De),m(6,B),m(7,le),m(8,fi),m(9,oi),m(10,X)],_ue);var ajo=new Set(["workbench.action.quit","workbench.action.reloadWindow","workbench.action.toggleFullScreen","workbench.action.gotoSymbol","workbench.action.gotoLine","workbench.action.zoomIn","workbench.action.zoomOut","workbench.action.zoomReset","workbench.action.files.save","workbench.action.files.saveAll","workbench.action.files.revert","workbench.action.closeActiveEditor","workbench.action.closeAllEditors","workbench.action.closeEditorsInGroup","workbench.action.closeUnmodifiedEditors","workbench.action.openSettings","workbench.action.openSettings2","workbench.action.openSettingsJson","workbench.action.openGlobalSettings","workbench.action.openApplicationSettingsJson","workbench.action.openRawDefaultSettings","workbench.action.openWorkspaceSettings","workbench.action.openWorkspaceSettingsFile","workbench.action.openFolderSettings","workbench.action.openFolderSettingsFile","workbench.action.openRemoteSettings","workbench.action.openRemoteSettingsFile","workbench.action.openAccessibilitySettings","workbench.action.configureLanguageBasedSettings","workbench.action.openGlobalKeybindings","workbench.action.openDefaultKeybindingsFile","workbench.action.openGlobalKeybindingsFile","workbench.action.openKeyboardLayoutPicker",Ufi,zfi,Kfi,Gfi,$fi,qfi]),sDe=class{constructor(i,e,t,o,n,r,s){this.editorPartsView=i;this.instantiationService=e;this.editorService=t;this.layoutService=o;this.keybindingService=n;this.hostService=r;this.configurationService=s}async create(i){let e=new P,t=_(".monaco-modal-editor-block");this.layoutService.mainContainer.appendChild(t),e.add(Z(()=>t.remove())),e.add(j(t,re.MOUSE_DOWN,k=>{k.target===t&&($t.stop(k,!0),v.close())}));let o=this.configurationService.getValue("workbench.editor.useModal");e.add(this.configurationService.onDidChangeConfiguration(k=>{k.affectsConfiguration("workbench.editor.useModal")&&(o=this.configurationService.getValue("workbench.editor.useModal"))})),e.add(j(t,re.KEY_DOWN,k=>{let T=new Ii(k);if(o!=="all"){let N=this.keybindingService.softDispatch(T,this.layoutService.mainContainer);N.kind===2&&N.commandId&&N.commandId.startsWith("workbench.")&&!ajo.has(N.commandId)&&$t.stop(T,!0)}}));let n=t.appendChild(_(".modal-editor-shadow")),r="modal-editor-title",s=_(".part.editor.modal-editor-part",{role:"dialog","aria-modal":"true","aria-labelledby":r});n.appendChild(s);let l=s.appendChild(_(".modal-editor-header")),c=R(l,_("div.modal-editor-title.show-file-icons"));c.id=r,c.textContent="";let u=R(l,_("div.modal-editor-navigation"));xo(u),e.add(j(u,re.DBLCLICK,k=>$t.stop(k,!0)));let p=e.add(new Mi(u,{title:d(4042,null)}));p.icon=M.chevronLeft,p.element.classList.add("modal-editor-nav-button"),e.add(p.onDidClick(()=>{let k=v.navigation;k&&k.current>0&&k.navigate(k.current-1)}));let h=R(u,_("span.modal-editor-nav-label"));h.setAttribute("aria-live","polite");let g=e.add(new Mi(u,{title:d(4041,null)}));g.icon=M.chevronRight,g.element.classList.add("modal-editor-nav-button"),e.add(g.onDidClick(()=>{let k=v.navigation;k&&k.current<k.total-1&&k.navigate(k.current+1)}));let f=R(l,_("div.modal-editor-action-container")),v=e.add(this.instantiationService.createInstance(Due,It.vscodeWindowId,this.editorPartsView,t,i));e.add(this.editorPartsView.registerPart(v)),v.create(s),e.add(H.once(v.onWillClose)(()=>e.dispose())),e.add(H.runAndSubscribe(v.onDidChangeNavigation,(k=>{k&&k.total>1?(bn(u),h.textContent=d(4040,null,k.current+1,k.total),p.enabled=k.current>0,g.enabled=k.current<k.total-1):xo(u)}),v.navigation));let b=this.editorService.createScoped(v,e),S=e.add(v.scopedInstantiationService.createChild(new Io([ee,b])));e.add(S.createInstance(Ln,f,D.ModalEditorTitle,{hiddenItemStrategy:-1,highlightToggledItems:!0,menuOptions:{shouldForwardArgs:!0}}));let y=e.add(S.createInstance(rk,c,{}));e.add(H.runAndSubscribe(b.onDidActiveEditorChange,()=>{let k=v.activeGroup.activeEditor;if(k){let{labelFormat:T}=v.partOptions;y.element.setResource({resource:no.getOriginalUri(k,{supportSideBySide:3}),name:k.getName(),description:k.getDescription(T==="short"?0:T==="long"?2:1)||""},{icon:k.getIcon(),extraClasses:k.getLabelExtraClasses()})}else y.element.clear();v.notifyActiveEditorChanged()})),e.add(j(l,re.DBLCLICK,k=>{$t.stop(k),v.toggleMaximized()})),e.add(j(l,re.CLICK,k=>{$t.stop(k),v.activeGroup.focus()}));let w=()=>{let k=this.layoutService.mainContainerDimension,T=this.layoutService.mainContainerOffset.top,N=Math.max(k.height-T,0),O,V;if(v.maximized){let te=Math.max(T,16);O=Math.max(k.width-16,0),V=Math.max(N-te,0)}else{let pe=k.width*.8,de=N*.8;O=Math.min(pe,1400,k.width),V=Math.min(de,900,N)}V=Math.min(V,N),s.style.width=`${O}px`,s.style.height=`${V}px`;let U=2;v.layout(O-U,V-U-33,0,0)};return e.add(H.runAndSubscribe(this.layoutService.onDidLayoutMainContainer,w)),e.add(v.onDidChangeMaximized(()=>w())),this.hostService.setWindowDimmed(It,!0),e.add(Z(()=>this.hostService.setWindowDimmed(It,!1))),v.activeGroup.focus(),{part:v,instantiationService:S,disposables:e}}};sDe=I([m(1,F),m(2,ee),m(3,fi),m(4,_e),m(5,oi),m(6,B)],sDe);var Due=class extends ck{constructor(e,t,o,n,r,s,l,c,u,p,h){let g=Due.COUNTER++;super(t,`workbench.parts.modalEditor.${g}`,d(4039,null),e,r,s,l,c,u,p,h);this.modalElement=o;this._onWillClose=this._register(new E);this.onWillClose=this._onWillClose.event;this._onDidChangeMaximized=this._register(new E);this.onDidChangeMaximized=this._onDidChangeMaximized.event;this._onDidChangeNavigation=this._register(new E);this.onDidChangeNavigation=this._onDidChangeNavigation.event;this.optionsDisposable=this._register(new me);this.previousMainWindowActiveElement=null;this._maximized=n?.maximized??!1,this._navigation=n?.navigation,this.enforceModalPartOptions()}static{this.COUNTER=1}get maximized(){return this._maximized}get navigation(){return this._navigation}create(e,t){this.previousMainWindowActiveElement=It.document.activeElement,super.create(e,t)}enforceModalPartOptions(){let e=this.groups.reduce((t,o)=>t+o.count,0);this.optionsDisposable.value=this.enforcePartOptions({showTabs:e>1?"multiple":"none",enablePreview:!0,closeEmptyGroups:!0,tabActionCloseVisibility:e>1,editorActionsLocation:"default",tabHeight:"default",wrapTabs:!1,allowDropIntoGroup:!1})}notifyActiveEditorChanged(){this.enforceModalPartOptions()}updateOptions(e){typeof e?.maximized=="boolean"&&e.maximized!==this._maximized&&this.toggleMaximized(),this._navigation=e?.navigation,this._onDidChangeNavigation.fire(e?.navigation)}toggleMaximized(){this._maximized=!this._maximized,this._onDidChangeMaximized.fire(this._maximized)}handleContextKeys(){rV.bindTo(this.scopedContextKeyService).set(!0);let t=tTt.bindTo(this.scopedContextKeyService);t.set(this._maximized),this._register(this.onDidChangeMaximized(n=>t.set(n)));let o=yce.bindTo(this.scopedContextKeyService);o.set(!!this._navigation&&this._navigation.total>1),this._register(this.onDidChangeNavigation(n=>o.set(!!n&&n.total>1))),super.handleContextKeys()}removeGroup(e,t){let o=this.assertGroupView(e);this.count===1&&this.activeGroup===o?this.doRemoveLastGroup():super.removeGroup(e,t)}doRemoveLastGroup(){let e=this.editorPartsView.mainPart.activeGroup;this.editorPartsView.mainPart.activateGroup(e,void 0,1);let t=this.layoutService.getContainer(It,"workbench.parts.editor");!Ao(this.previousMainWindowActiveElement)||!this.previousMainWindowActiveElement.isConnected||t?.contains(this.previousMainWindowActiveElement)?e.focus():this.previousMainWindowActiveElement.focus(),this.doClose({mergeConfirmingEditorsToMainPart:!1})}saveState(){}close(e){return this.doClose({...e,mergeConfirmingEditorsToMainPart:!0})}doClose(e){let t=!0;if(e?.mergeConfirmingEditorsToMainPart){if(!e.mergeAllEditorsToMainPart)for(let o of this.groups)o.closeAllEditors({excludeConfirming:!0});if(t=this.mergeGroupsToMainPart(),!t)return!1}return this._onWillClose.fire(),t}mergeGroupsToMainPart(){if(!this.groups.some(o=>o.count>0))return!0;let e;for(let o of this.editorPartsView.mainPart.getGroups(1))if(!o.isLocked){e=o;break}e||(e=this.editorPartsView.mainPart.addGroup(this.editorPartsView.mainPart.activeGroup,this.partOptions.openSideBySideDirection==="right"?3:1));let t=this.mergeAllGroups(e,{preserveExistingIndex:!0});return e.focus(),t}dispose(){this._navigation=void 0,super.dispose()}};Due=I([m(4,F),m(5,De),m(6,B),m(7,le),m(8,fi),m(9,oi),m(10,X)],Due);var QV=class extends TJ{constructor(e,t,o,n,r){super("workbench.editorParts",o,t);this.instantiationService=e;this.storageService=t;this.auxiliaryWindowService=n;this.contextKeyService=r;this.mapPartToInstantiationService=new Map;this._onDidCreateAuxiliaryEditorPart=this._register(new E);this.onDidCreateAuxiliaryEditorPart=this._onDidCreateAuxiliaryEditorPart.event;this.modalEditorMaximized=!1;this.workspaceMemento=this.getMemento(1,0);this._isReady=!1;this.whenReadyPromise=new Go;this.whenReady=this.whenReadyPromise.p;this.whenRestoredPromise=new Go;this.whenRestored=this.whenRestoredPromise.p;this._onDidActiveGroupChange=this._register(new E);this.onDidChangeActiveGroup=this._onDidActiveGroupChange.event;this._onDidAddGroup=this._register(new E);this.onDidAddGroup=this._onDidAddGroup.event;this._onDidRemoveGroup=this._register(new E);this.onDidRemoveGroup=this._onDidRemoveGroup.event;this._onDidMoveGroup=this._register(new E);this.onDidMoveGroup=this._onDidMoveGroup.event;this._onDidActivateGroup=this._register(new E);this.onDidActivateGroup=this._onDidActivateGroup.event;this._onDidChangeGroupIndex=this._register(new E);this.onDidChangeGroupIndex=this._onDidChangeGroupIndex.event;this._onDidChangeGroupLocked=this._register(new E);this.onDidChangeGroupLocked=this._onDidChangeGroupLocked.event;this._onDidChangeGroupMaximized=this._register(new E);this.onDidChangeGroupMaximized=this._onDidChangeGroupMaximized.event;this.globalContextKeys=new Map;this.scopedContextKeys=new Map;this.contextKeyProviders=new Map;this.registeredContextKeys=new Map;this.contextKeyProviderDisposables=this._register(new jt);this.editorWorkingSets=(()=>{let s=this.storageService.get(QV.EDITOR_WORKING_SETS_STORAGE_KEY,1);return s?JSON.parse(s):[]})(),this.mainPart=this._register(this.createMainEditorPart()),this._register(this.registerPart(this.mainPart)),this.mostRecentActiveParts=[this.mainPart],this.restoreParts(),this.registerListeners()}registerListeners(){this._register(this.onDidChangeMementoValue(1,this._store)(e=>this.onDidChangeMementoState(e))),this.whenReady.then(()=>this.registerGroupsContextKeyListeners())}createMainEditorPart(){return this.instantiationService.createInstance(rDe,this)}getScopedInstantiationService(e){if(e===this.mainPart){let t=this.mapPartToInstantiationService.get(e.windowId);return t||(t=this.instantiationService.invokeFunction(o=>{let n=o.get(ee),r=o.get(Tr),s=this._register(this.mainPart.scopedInstantiationService.createChild(new Io([ee,n.createScoped(this.mainPart,this._store)],[Tr,r.createScoped(r,this._store)])));return this.mapPartToInstantiationService.set(e.windowId,s),s})),t}return e===this.modalEditorPart&&this.modalPartInstantiationService?this.modalPartInstantiationService:this.mapPartToInstantiationService.get(e.windowId)??this.instantiationService}async createAuxiliaryEditorPart(e){let{part:t,instantiationService:o,disposables:n}=await this.instantiationService.createInstance(jV,this).create(this.getGroupsLabel(this._parts.size),e);return this.mapPartToInstantiationService.set(t.windowId,o),n.add(Z(()=>this.mapPartToInstantiationService.delete(t.windowId))),this._onDidAddGroup.fire(t.activeGroup),this._onDidCreateAuxiliaryEditorPart.fire(t),t}get activeModalEditorPart(){return this.modalEditorPart}async createModalEditorPart(e){if(this.modalEditorPart)return this.modalEditorPart.updateOptions(e),this.modalEditorPart;let{part:t,instantiationService:o,disposables:n}=await this.instantiationService.createInstance(sDe,this).create({...e,maximized:e?.maximized??this.modalEditorMaximized});return this.modalEditorPart=t,this.modalPartInstantiationService=o,n.add(Z(()=>{this.modalPartInstantiationService=void 0,this.modalEditorPart=void 0})),n.add(t.onDidChangeMaximized(r=>{this.modalEditorMaximized=r})),this._onDidAddGroup.fire(t.activeGroup),t}registerPart(e){let t=this._register(new P);return t.add(super.registerPart(e)),this.registerEditorPartListeners(e,t),t}unregisterPart(e){super.unregisterPart(e),this.parts.forEach((t,o)=>{t!==this.mainPart&&t.notifyGroupsLabelChange(this.getGroupsLabel(o))})}registerEditorPartListeners(e,t){t.add(e.onDidFocus(()=>{this.doUpdateMostRecentActive(e,!0),this._parts.size>1&&this._onDidActiveGroupChange.fire(this.activeGroup)})),t.add(Z(()=>{this.doUpdateMostRecentActive(e),e.windowId!==It.vscodeWindowId&&this._onDidActiveGroupChange.fire(this.activeGroup)})),t.add(e.onDidChangeActiveGroup(o=>this._onDidActiveGroupChange.fire(o))),t.add(e.onDidAddGroup(o=>this._onDidAddGroup.fire(o))),t.add(e.onDidRemoveGroup(o=>this._onDidRemoveGroup.fire(o))),t.add(e.onDidMoveGroup(o=>this._onDidMoveGroup.fire(o))),t.add(e.onDidActivateGroup(o=>this._onDidActivateGroup.fire(o))),t.add(e.onDidChangeGroupMaximized(o=>this._onDidChangeGroupMaximized.fire(o))),t.add(e.onDidChangeGroupIndex(o=>this._onDidChangeGroupIndex.fire(o))),t.add(e.onDidChangeGroupLocked(o=>this._onDidChangeGroupLocked.fire(o)))}doUpdateMostRecentActive(e,t){let o=this.mostRecentActiveParts.indexOf(e);o!==-1&&this.mostRecentActiveParts.splice(o,1),t&&this.mostRecentActiveParts.unshift(e)}getGroupsLabel(e){return d(3961,null,e+1)}getPartByDocument(e){if(this._parts.size>1){let t=Pn();for(let o of this._parts)if(o!==this.mainPart&&o.element?.ownerDocument===e){let n=o.getContainer();if(n&&gs(t,n))return o}}return super.getPartByDocument(e)}getPart(e){if(this._parts.size>1)if(Ao(e)){let t=e;return this.getPartByDocument(t.ownerDocument)}else{let t=e,o;typeof t=="number"?o=t:o=t.id;for(let n of this._parts)if(n.hasGroup(o))return n}return this.mainPart}static{this.EDITOR_PARTS_UI_STATE_STORAGE_KEY="editorparts.state"}get isReady(){return this._isReady}async restoreParts(){if(await this.mainPart.whenReady,this.mainPart.willRestoreState){let t=this.loadState();t&&await this.restoreState(t)}this.mostRecentActiveParts.at(0)?.activeGroup.focus(),this._isReady=!0,this.whenReadyPromise.complete(),await Promise.allSettled(this.parts.map(t=>t.whenRestored)),this.whenRestoredPromise.complete()}loadState(){return this.workspaceMemento[QV.EDITOR_PARTS_UI_STATE_STORAGE_KEY]}saveState(){let e=this.createState();e.auxiliary.length===0?delete this.workspaceMemento[QV.EDITOR_PARTS_UI_STATE_STORAGE_KEY]:this.workspaceMemento[QV.EDITOR_PARTS_UI_STATE_STORAGE_KEY]=e}createState(){return{auxiliary:this.parts.map(e=>({part:e,auxiliaryWindow:this.auxiliaryWindowService.getWindow(e.windowId)})).filter(({auxiliaryWindow:e})=>e!==void 0).map(({part:e,auxiliaryWindow:t})=>({state:e.createState(),...t.createState()})),mru:this.mostRecentActiveParts.map(e=>this.parts.indexOf(e))}}async restoreState(e){if(e.auxiliary.length){let t=[];for(let o of e.auxiliary)t.push(this.createAuxiliaryEditorPart(o));await Promise.allSettled(t),e.mru.length===this.parts.length?this.mostRecentActiveParts=e.mru.map(o=>this.parts[o]):this.mostRecentActiveParts=[...this.parts],await Promise.allSettled(this.parts.map(o=>o.whenReady))}}get hasRestorableState(){return this.parts.some(e=>e.hasRestorableState)}onDidChangeMementoState(e){if(e.external&&e.scope===1){this.reloadMemento(e.scope);let t=this.loadState();t&&this.applyState(t)}}async applyState(e){for(let t of this.parts){if(t===this.mainPart)continue;for(let n of t.getGroups(1))await n.closeAllEditors({excludeConfirming:!0});if(!t.close())return!1}return e!=="empty"&&await this.restoreState(e),!0}static{this.EDITOR_WORKING_SETS_STORAGE_KEY="editor.workingSets"}saveWorkingSet(e){let t={id:_t(),name:e,main:this.mainPart.createState(),auxiliary:this.createState()};return this.editorWorkingSets.push(t),this.saveWorkingSets(),{id:t.id,name:t.name}}getWorkingSets(){return this.editorWorkingSets.map(e=>({id:e.id,name:e.name}))}deleteWorkingSet(e){let t=this.indexOfWorkingSet(e);typeof t=="number"&&(this.editorWorkingSets.splice(t,1),this.saveWorkingSets())}async applyWorkingSet(e,t){let o;if(e==="empty"?o="empty":o=this.editorWorkingSets[this.indexOfWorkingSet(e)??-1],!o||!await this.applyState(o==="empty"?o:o.auxiliary))return!1;if(await this.mainPart.applyState(o==="empty"?o:o.main,t),!t?.preserveFocus){let r=this.mostRecentActiveParts.at(0);r&&(await r.whenReady,r.activeGroup.focus())}return!0}indexOfWorkingSet(e){for(let t=0;t<this.editorWorkingSets.length;t++)if(this.editorWorkingSets[t].id===e.id)return t}saveWorkingSets(){this.storageService.store(QV.EDITOR_WORKING_SETS_STORAGE_KEY,JSON.stringify(this.editorWorkingSets),1,1)}get activeGroup(){return this.activePart.activeGroup}get sideGroup(){return this.activePart.sideGroup}get groups(){return this.getGroups()}get count(){return this.groups.length}getGroups(e=0){if(this._parts.size>1){let t;switch(e){case 2:case 0:t=this.parts;break;case 1:t=Uo([...this.mostRecentActiveParts,...this.parts]);break}return t.flatMap(o=>o.getGroups(e))}return this.mainPart.getGroups(e)}getGroup(e){if(this._parts.size>1)for(let t of this._parts){let o=t.getGroup(e);if(o)return o}return this.mainPart.getGroup(e)}assertGroupView(e){let t;if(typeof e=="number"?t=this.getGroup(e):t=e,!t)throw new Error("Invalid editor group provided!");return t}activateGroup(e){return this.getPart(e).activateGroup(e)}getSize(e){return this.getPart(e).getSize(e)}setSize(e,t){this.getPart(e).setSize(e,t)}arrangeGroups(e,t=this.activePart.activeGroup){this.getPart(t).arrangeGroups(e,t)}toggleMaximizeGroup(e=this.activePart.activeGroup){this.getPart(e).toggleMaximizeGroup(e)}toggleExpandGroup(e=this.activePart.activeGroup){this.getPart(e).toggleExpandGroup(e)}restoreGroup(e){return this.getPart(e).restoreGroup(e)}applyLayout(e){this.activePart.applyLayout(e)}getLayout(){return this.activePart.getLayout()}get orientation(){return this.activePart.orientation}setGroupOrientation(e){this.activePart.setGroupOrientation(e)}findGroup(e,t=this.activeGroup,o){let n=this.getPart(t);if(this._parts.size>1){let r=this.getGroups(2);if(e.location===0||e.location===1)return e.location===0?r[0]:r[r.length-1];let s=n.findGroup(e,t,!1);if(s)return s;if(e.location===2||e.location===3){let l=this.assertGroupView(t),c=r.indexOf(l);if(e.location===2){let u=r[c+1];return!u&&o&&(u=r[0]),u}else{let u=r[c-1];return!u&&o&&(u=r[r.length-1]),u}}}return n.findGroup(e,t,o)}addGroup(e,t){return this.getPart(e).addGroup(e,t)}removeGroup(e){this.getPart(e).removeGroup(e)}moveGroup(e,t,o){return this.getPart(e).moveGroup(e,t,o)}mergeGroup(e,t,o){return this.getPart(e).mergeGroup(e,t,o)}mergeAllGroups(e,t){return this.activePart.mergeAllGroups(e,t)}copyGroup(e,t,o){return this.getPart(e).copyGroup(e,t,o)}createEditorDropTarget(e,t){return this.getPart(e).createEditorDropTarget(e,t)}registerGroupsContextKeyListeners(){this._register(this.onDidChangeActiveGroup(()=>this.updateGlobalContextKeys())),this.groups.forEach(e=>this.registerGroupContextKeyProvidersListeners(e)),this._register(this.onDidAddGroup(e=>this.registerGroupContextKeyProvidersListeners(e))),this._register(this.onDidRemoveGroup(e=>{this.scopedContextKeys.delete(e.id),this.registeredContextKeys.delete(e.id),this.contextKeyProviderDisposables.deleteAndDispose(e.id)}))}updateGlobalContextKeys(){let e=this.scopedContextKeys.get(this.activeGroup.id);if(e)for(let[t,o]of this.globalContextKeys){let n=e.get(t);n?o.set(n.get()):o.reset()}}bind(e,t){let o=this.globalContextKeys.get(e.key);o||(o=e.bindTo(this.contextKeyService),this.globalContextKeys.set(e.key,o));let n=this.scopedContextKeys.get(t.id);n||(n=new Map,this.scopedContextKeys.set(t.id,n));let r=n.get(e.key);r||(r=e.bindTo(t.scopedContextKeyService),n.set(e.key,r));let s=this;return{get(){return r.get()},set(l){s.activeGroup===t&&o.set(l),r.set(l)},reset(){s.activeGroup===t&&o.reset(),r.reset()}}}registerContextKeyProvider(e){if(this.contextKeyProviders.has(e.contextKey.key)||this.globalContextKeys.has(e.contextKey.key))throw new Error(`A context key provider for key ${e.contextKey.key} already exists.`);this.contextKeyProviders.set(e.contextKey.key,e);let t=()=>{for(let n of this.groups)this.updateRegisteredContextKey(n,e)};t();let o=e.onDidChange?.(()=>t());return Z(()=>{o?.dispose(),this.globalContextKeys.delete(e.contextKey.key),this.scopedContextKeys.forEach(n=>n.delete(e.contextKey.key)),this.contextKeyProviders.delete(e.contextKey.key),this.registeredContextKeys.forEach(n=>n.delete(e.contextKey.key))})}registerGroupContextKeyProvidersListeners(e){let t=e.onDidActiveEditorChange(()=>{for(let o of this.contextKeyProviders.values())this.updateRegisteredContextKey(e,o)});this.contextKeyProviderDisposables.set(e.id,t)}updateRegisteredContextKey(e,t){let o=this.registeredContextKeys.get(e.id);o||(o=new Map,this.registeredContextKeys.set(e.id,o));let n=o.get(t.contextKey.key);n||(n=this.bind(t.contextKey,e),o.set(t.contextKey.key,n)),n.set(t.getGroupContextKeyValue(e))}get partOptions(){return this.mainPart.partOptions}get onDidChangeEditorPartOptions(){return this.mainPart.onDidChangeEditorPartOptions}enforcePartOptions(e){return this.mainPart.enforcePartOptions(e)}};QV=I([m(0,F),m(1,le),m(2,De),m(3,$P),m(4,X)],QV);we(Et,QV,0);var jP=ae("bannerService");var IYe=class extends cy{constructor(e,t,o,n,r,s){super("workbench.parts.banner",{hasTitle:!1},e,o,t);this.contextKeyService=n;this.instantiationService=r;this.markdownRendererService=s;this.height=26;this.minimumWidth=0;this.maximumWidth=Number.POSITIVE_INFINITY;this._onDidChangeSize=this._register(new E);this.visible=!1;this.focusedActionIndex=-1}get minimumHeight(){return this.visible?this.height:0}get maximumHeight(){return this.visible?this.height:0}get onDidChange(){return this._onDidChangeSize.event}createContentArea(e){this.element=e,this.element.tabIndex=0,this._register(j(this.element,re.FOCUS,()=>{this.focusedActionIndex!==-1&&this.focusActionLink()}));let t=this._register(this.contextKeyService.createScoped(this.element));return A8e.bindTo(t).set(!0),this.element}close(e){this.setVisibility(!1),Rt(this.element),typeof e.onClose=="function"&&e.onClose(),this.item=void 0}focusActionLink(){let e=this.item?.actions?.length??0;if(this.focusedActionIndex<e){let t=this.messageActionsContainer?.children[this.focusedActionIndex];Ao(t)&&(this.actionBar?.setFocusable(!1),t.focus())}else this.actionBar?.focus(0)}getAriaLabel(e){if(e.ariaLabel)return e.ariaLabel;if(typeof e.message=="string")return e.message}getBannerMessage(e){if(typeof e=="string"){let t=_("span");return t.textContent=e,t}return this.markdownRendererService.render(e).element}setVisibility(e){e!==this.visible&&(this.visible=e,this.focusedActionIndex=-1,this.layoutService.setPartHidden(!e,"workbench.parts.banner"),this._onDidChangeSize.fire(void 0))}focus(){this.focusedActionIndex=-1,this.element.focus()}focusNextAction(){let e=this.item?.actions?.length??0;this.focusedActionIndex=this.focusedActionIndex<e?this.focusedActionIndex+1:0,this.focusActionLink()}focusPreviousAction(){let e=this.item?.actions?.length??0;this.focusedActionIndex=this.focusedActionIndex>0?this.focusedActionIndex-1:e,this.focusActionLink()}hide(e){this.item?.id===e&&this.setVisibility(!1)}show(e){if(e.id===this.item?.id){this.setVisibility(!0);return}Rt(this.element);let t=this.getAriaLabel(e);t&&this.element.setAttribute("aria-label",t);let o=R(this.element,_("div.icon-container"));o.setAttribute("aria-hidden","true"),q.isThemeIcon(e.icon)?o.appendChild(_(`div${q.asCSSSelector(e.icon)}`)):(o.classList.add("custom-icon"),A.isUri(e.icon)&&(o.style.backgroundImage=Na(e.icon)));let n=R(this.element,_("div.message-container"));if(n.setAttribute("aria-hidden","true"),n.appendChild(this.getBannerMessage(e.message)),this.messageActionsContainer=R(this.element,_("div.message-actions-container")),e.actions)for(let c of e.actions)this._register(this.instantiationService.createInstance(Xg,this.messageActionsContainer,{...c,tabIndex:-1},{}));let r=R(this.element,_("div.action-container"));this.actionBar=this._register(new ji(r));let s=e.closeLabel??d(3551,null),l=this._register(new st("banner.close",s,q.asClassName(lE),!0,()=>this.close(e)));this.actionBar.push(l,{icon:!0,label:!1}),this.actionBar.setFocusable(!1),this.setVisibility(!0),this.item=e}toJSON(){return{type:"workbench.parts.banner"}}};IYe=I([m(0,De),m(1,fi),m(2,le),m(3,X),m(4,F),m(5,Qn)],IYe);we(jP,IYe,0);yt.registerCommandAndKeybindingRule({id:"workbench.banner.focusBanner",weight:200,primary:9,when:A8e,handler:a=>{a.get(jP).focus()}});yt.registerCommandAndKeybindingRule({id:"workbench.banner.focusNextAction",weight:200,primary:17,secondary:[18],when:A8e,handler:a=>{a.get(jP).focusNextAction()}});yt.registerCommandAndKeybindingRule({id:"workbench.banner.focusPreviousAction",weight:200,primary:15,secondary:[16],when:A8e,handler:a=>{a.get(jP).focusPreviousAction()}});var mbi=class a extends K{static{this.ID="workbench.action.focusBanner"}static{this.LABEL=L(3552,"Focus Banner")}constructor(){super({id:a.ID,title:a.LABEL,category:We.View,f1:!0})}async run(i){i.get(fi).focusPart("workbench.parts.banner")}};W(mbi);var SOt=class extends st{constructor(e,t,o){super(e,t,void 0,!0);this.model=o;this.checked=!o.isHidden(e)}async run(){this.model.isHidden(this.id)?this.model.show(this.id):this.model.hide(this.id)}},IOt=class extends st{constructor(e,t,o){super(e,d(4189,null,t),void 0,!0);this.model=o}async run(){this.model.hide(this.id)}},aDe=class extends st{constructor(e,t){super("statusbar.manage.extension",d(4190,null));this.extensionId=e;this.commandService=t}run(){return this.commandService.executeCommand("_extensions.manage",this.extensionId)}};aDe=I([m(1,ge)],aDe);yt.registerCommandAndKeybindingRule({id:"workbench.statusBar.focusPrevious",weight:200,primary:15,secondary:[16],when:kY,handler:a=>{a.get(Tr).focusPreviousEntry()}});yt.registerCommandAndKeybindingRule({id:"workbench.statusBar.focusNext",weight:200,primary:17,secondary:[18],when:kY,handler:a=>{a.get(Tr).focusNextEntry()}});yt.registerCommandAndKeybindingRule({id:"workbench.statusBar.focusFirst",weight:200,primary:14,when:kY,handler:a=>{let i=a.get(Tr);i.focus(!1),i.focusNextEntry()}});yt.registerCommandAndKeybindingRule({id:"workbench.statusBar.focusLast",weight:200,primary:13,when:kY,handler:a=>{let i=a.get(Tr);i.focus(!1),i.focusPreviousEntry()}});yt.registerCommandAndKeybindingRule({id:"workbench.statusBar.clearFocus",weight:200,primary:9,when:kY,handler:a=>{let i=a.get(Tr),e=a.get(ee);i.isEntryFocused()?i.focus(!1):e.activeEditorPane&&e.activeEditorPane.focus()}});var hbi=class extends K{constructor(){super({id:"workbench.action.focusStatusBar",title:L(4188,"Focus Status Bar"),category:We.View,f1:!0})}async run(i){i.get(fi).focusPart("workbench.parts.statusbar",Ki())}};W(hbi);var yOt=class a extends C{constructor(e){super();this.storageService=e;this._onDidChangeEntryVisibility=this._register(new E);this.onDidChangeEntryVisibility=this._onDidChangeEntryVisibility.event;this._entries=[];this.hidden=new Set;this.restoreState(),this.registerListeners()}static{this.HIDDEN_ENTRIES_KEY="workbench.statusbar.hidden"}get entries(){return this._entries.slice(0)}get lastFocusedEntry(){return this._lastFocusedEntry&&!this.isHidden(this._lastFocusedEntry.id)?this._lastFocusedEntry:void 0}restoreState(){let e=this.storageService.get(a.HIDDEN_ENTRIES_KEY,0);if(e)try{this.hidden=new Set(JSON.parse(e))}catch{}}registerListeners(){this._register(this.storageService.onDidChangeValue(0,a.HIDDEN_ENTRIES_KEY,this._store)(()=>this.onDidStorageValueChange()))}onDidStorageValueChange(){let e=new Set(this.hidden);this.hidden.clear(),this.restoreState();let t=new Set;for(let o of e)this.hidden.has(o)||t.add(o);for(let o of this.hidden)e.has(o)||t.add(o);if(t.size>0)for(let o of this._entries)t.has(o.id)&&(this.updateVisibility(o.id,!0),t.delete(o.id))}add(e){this._entries.push(e),this.updateVisibility(e,!1),this.sort(),this.markFirstLastVisibleEntry()}remove(e){let t=this._entries.indexOf(e);t>=0&&(this._entries.splice(t,1),this._entries.some(o=>Jle(o.priority.primary)&&o.priority.primary.location.id===e.id)&&this.sort(),this.markFirstLastVisibleEntry())}isHidden(e){return this.hidden.has(e)}hide(e){this.hidden.has(e)||(this.hidden.add(e),this.updateVisibility(e,!0),this.saveState())}show(e){this.hidden.delete(e)&&(this.updateVisibility(e,!0),this.saveState())}findEntry(e){return this._entries.find(t=>t.container===e)}getEntries(e){return this._entries.filter(t=>t.alignment===e)}focusNextEntry(){this.focusEntry(1,0)}focusPreviousEntry(){this.focusEntry(-1,this.entries.length-1)}isEntryFocused(){return!!this.getFocusedEntry()}getFocusedEntry(){return this._entries.find(e=>ts(e.container))}focusEntry(e,t){let o=s=>{let l=s,c=l>=0&&l<this._entries.length?this._entries[l]:void 0;for(;c&&this.isHidden(c.id);)l+=e,c=l>=0&&l<this._entries.length?this._entries[l]:void 0;return c},n=this.getFocusedEntry();if(n){let s=o(this._entries.indexOf(n)+e);if(s){this._lastFocusedEntry=s,s.labelContainer.focus();return}}let r=o(t);r&&(this._lastFocusedEntry=r,r.labelContainer.focus())}updateVisibility(e,t){if(typeof e=="string"){let o=e;for(let n of this._entries)n.id===o&&this.updateVisibility(n,t)}else{let o=e,n=this.isHidden(o.id);n?xo(o.container):bn(o.container),t&&this._onDidChangeEntryVisibility.fire({id:o.id,visible:!n}),this.markFirstLastVisibleEntry()}}saveState(){this.hidden.size>0?this.storageService.store(a.HIDDEN_ENTRIES_KEY,JSON.stringify(Array.from(this.hidden.values())),0,0):this.storageService.remove(a.HIDDEN_ENTRIES_KEY,0)}sort(){let e=new Set(this._entries.map(s=>s.id)),t=new Map,o=new Map;for(let s=0;s<this._entries.length;s++){let l=this._entries[s];if(typeof l.priority.primary=="number"||!e.has(l.priority.primary.location.id))t.set(l,s);else{let c=l.priority.primary.location.id,u=o.get(c);if(!u){for(let p of o.values())if(p.has(c)){u=p;break}u||(u=new Map,o.set(c,u))}u.set(l.id,l)}}let n=Array.from(t.keys());n.sort((s,l)=>{if(s.alignment===l.alignment){let c=typeof s.priority.primary=="number"?s.priority.primary:s.priority.primary.location.priority,u=typeof l.priority.primary=="number"?l.priority.primary:l.priority.primary.location.priority;return c!==u?u-c:s.priority.secondary!==l.priority.secondary?l.priority.secondary-s.priority.secondary:t.get(s)-t.get(l)}return s.alignment===0?-1:l.alignment===0?1:0});let r;if(o.size>0){r=[];for(let s of n){let l=o.get(s.id),c=l?Array.from(l.values()):void 0;c&&r.push(...c.filter(u=>Jle(u.priority.primary)&&u.priority.primary.alignment===0).sort((u,p)=>p.priority.secondary-u.priority.secondary)),r.push(s),c&&r.push(...c.filter(u=>Jle(u.priority.primary)&&u.priority.primary.alignment===1).sort((u,p)=>p.priority.secondary-u.priority.secondary)),o.delete(s.id)}for(let[,s]of o)r.push(...Array.from(s.values()).sort((l,c)=>c.priority.secondary-l.priority.secondary))}else r=n;this._entries=r}markFirstLastVisibleEntry(){this.doMarkFirstLastVisibleStatusbarItem(this.getEntries(0)),this.doMarkFirstLastVisibleStatusbarItem(this.getEntries(1))}doMarkFirstLastVisibleStatusbarItem(e){let t,o;for(let n of e)n.container.classList.remove("first-visible-item","last-visible-item"),!this.isHidden(n.id)&&(t||(t=n),o=n);t?.container.classList.add("first-visible-item"),o?.container.classList.add("last-visible-item")}};var lDe=class extends C{constructor(e,t,o,n,r,s,l,c){super();this.container=e;this.hoverDelegate=o;this.commandService=n;this.hoverService=r;this.notificationService=s;this.telemetryService=l;this.themeService=c;this.entry=void 0;this.foregroundListener=this._register(new me);this.backgroundListener=this._register(new me);this.commandMouseListener=this._register(new me);this.commandTouchListener=this._register(new me);this.commandKeyboardListener=this._register(new me);this.hover=void 0;this.labelContainer=_("a.statusbar-item-label",{role:"button",tabIndex:-1}),this._register(ws.addTarget(this.labelContainer)),this.label=this._register(new gbi(this.labelContainer)),this.container.appendChild(this.labelContainer),this.beakContainer=_(".status-bar-item-beak-container"),this.container.appendChild(this.beakContainer),t.content&&this.container.appendChild(t.content),this.update(t)}get name(){return Oi(this.entry).name}get hasCommand(){return typeof this.entry?.command<"u"}update(e){if(this.label.showProgress=e.showProgress??!1,(!this.entry||e.text!==this.entry.text)&&(this.label.text=e.text,e.text?bn(this.labelContainer):xo(this.labelContainer)),(!this.entry||e.ariaLabel!==this.entry.ariaLabel)&&(this.container.setAttribute("aria-label",e.ariaLabel),this.labelContainer.setAttribute("aria-label",e.ariaLabel)),(!this.entry||e.role!==this.entry.role)&&this.labelContainer.setAttribute("role",e.role||"button"),!this.entry||!this.isEqualTooltip(this.entry,e)){let o,n;u9i(e.tooltip)?(n=e.tooltip.content,o={actions:e.tooltip.commands.map(s=>({commandId:s.id,label:s.title,run:()=>this.executeCommand(s)}))}):n=e.tooltip;let r=Mr(n)?{markdown:n,markdownNotSupportedFallback:void 0}:n;this.hover?this.hover.update(r,o):this.hover=this._register(this.hoverService.setupManagedHover(this.hoverDelegate,this.container,r,o))}if(!this.entry||e.command!==this.entry.command){this.commandMouseListener.clear(),this.commandTouchListener.clear(),this.commandKeyboardListener.clear();let o=e.command;o&&(o!==GL||this.hover)?(this.commandMouseListener.value=j(this.labelContainer,re.CLICK,()=>this.executeCommand(o)),this.commandTouchListener.value=j(this.labelContainer,Gn.Tap,()=>this.executeCommand(o)),this.commandKeyboardListener.value=j(this.labelContainer,re.KEY_DOWN,n=>{let r=new Ii(n);r.equals(10)||r.equals(3)?($t.stop(n),this.executeCommand(o)):(r.equals(9)||r.equals(15)||r.equals(17))&&($t.stop(n),this.hover?.hide())}),this.labelContainer.classList.remove("disabled")):this.labelContainer.classList.add("disabled")}(!this.entry||e.showBeak!==this.entry.showBeak)&&(e.showBeak?this.container.classList.add("has-beak"):this.container.classList.remove("has-beak"));let t=!!e.backgroundColor||e.kind&&e.kind!=="standard";if(!this.entry||e.kind!==this.entry.kind){for(let o of d9i)this.container.classList.remove(`${o}-kind`);e.kind&&e.kind!=="standard"&&this.container.classList.add(`${e.kind}-kind`),this.container.classList.toggle("has-background-color",t)}(!this.entry||e.color!==this.entry.color)&&this.applyColor(this.labelContainer,e.color),(!this.entry||e.backgroundColor!==this.entry.backgroundColor)&&(this.container.classList.toggle("has-background-color",t),this.applyColor(this.container,e.backgroundColor,!0)),this.entry=e}isEqualTooltip({tooltip:e},{tooltip:t}){return e===void 0?t===void 0:Mr(e)?Mr(t)&&nje(e,t):e===t}async executeCommand(e){if(e===GL)this.hover?.show(!0);else{let t=typeof e=="string"?e:e.id,o=typeof e=="string"?[]:e.arguments??[];this.telemetryService.publicLog2("workbenchActionExecuted",{id:t,from:"status bar"});try{await this.commandService.executeCommand(t,...o)}catch(n){this.notificationService.error(In(n))}}}applyColor(e,t,o){let n;if(o?this.backgroundListener.clear():this.foregroundListener.clear(),t)if(xSe(t)){n=this.themeService.getColorTheme().getColor(t.id)?.toString();let r=this.themeService.onDidColorThemeChange(s=>{let l=s.getColor(t.id)?.toString();o?e.style.backgroundColor=l??"":e.style.color=l??""});o?this.backgroundListener.value=r:this.foregroundListener.value=r}else n=t;o?e.style.backgroundColor=n??"":e.style.color=n??""}};lDe=I([m(3,ge),m(4,tt),m(5,Ne),m(6,Te),m(7,De)],lDe);var gbi=class extends BC{constructor(e){super(e);this.container=e;this.progressCodicon=Qo(xje);this.currentText="";this.currentShowProgress=!1}set showProgress(e){this.currentShowProgress!==e&&(this.currentShowProgress=e,this.progressCodicon=Qo(e==="syncing"?xje:cE),this.text=this.currentText)}set text(e){if(this.currentShowProgress){this.container.firstChild!==this.progressCodicon&&this.container.appendChild(this.progressCodicon);for(let o of Array.from(this.container.childNodes))o!==this.progressCodicon&&o.remove();let t=e??"";t&&(t=`\xA0${t}`),R(this.container,...Bn(t))}else super.text=e}};var SK=class extends cy{constructor(e,t,o,n,r,s,l,c){super(e,{hasTitle:!1},o,r,s);this.instantiationService=t;this.contextService=n;this.contextMenuService=l;this.contextKeyService=c;this.minimumWidth=0;this.maximumWidth=Number.POSITIVE_INFINITY;this.minimumHeight=SK.HEIGHT;this.maximumHeight=SK.HEIGHT;this.pendingEntries=[];this._onWillDispose=this._register(new E);this.onWillDispose=this._onWillDispose.event;this.onDidOverrideEntry=this._register(new E);this.entryOverrides=new Map;this.compactEntriesDisposable=this._register(new me);this.styleOverrides=new Set;this.viewModel=this._register(new yOt(r)),this.onDidChangeEntryVisibility=this.viewModel.onDidChangeEntryVisibility,this.hoverDelegate=this._register(this.instantiationService.createInstance(mv,"element",{instantHover:!0,dynamicDelay(u){if(typeof u=="function"||Ao(u)||Dwe(u)&&typeof u.markdown=="function"||T3i(u))return 500}},(u,p)=>({persistence:{hideOnKeyDown:!0,sticky:p},appearance:{maxHeightRatio:.9}}))),this.registerListeners()}static{this.HEIGHT=22}registerListeners(){this._register(this.onDidChangeEntryVisibility(()=>this.updateCompactEntries())),this._register(this.contextService.onDidChangeWorkbenchState(()=>this.updateStyles()))}overrideEntry(e,t){return this.entryOverrides.set(e,t),this.onDidOverrideEntry.fire(e),Z(()=>{this.entryOverrides.get(e)===t&&(this.entryOverrides.delete(e),this.onDidOverrideEntry.fire(e))})}withEntryOverride(e,t){let o=this.entryOverrides.get(t);return o&&(e={...e,...o}),e}addEntry(e,t,o,n=0){let r;return c9i(n)?r=n:r={primary:n,secondary:Ir(t)},this.element?this.doAddEntry(e,t,o,r):this.doAddPendingEntry(e,t,o,r)}doAddPendingEntry(e,t,o,n){let r={entry:e,id:t,alignment:o,priority:n};return this.pendingEntries.push(r),{update:l=>{r.accessor?r.accessor.update(l):r.entry=l},dispose:()=>{r.accessor?r.accessor.dispose():this.pendingEntries=this.pendingEntries.filter(l=>l!==r)}}}doAddEntry(e,t,o,n){let r=new P,s=this.doCreateStatusItem(t,o),l=r.add(this.instantiationService.createInstance(lDe,s,this.withEntryOverride(e,t),this.hoverDelegate)),c=new class{constructor(){this.id=t;this.extensionId=e.extensionId;this.alignment=o;this.priority=n;this.container=s;this.labelContainer=l.labelContainer}get name(){return l.name}get hasCommand(){return l.hasCommand}},{needsFullRefresh:u}=this.doAddOrRemoveModelEntry(c,!0);u?this.appendStatusbarEntries():this.appendStatusbarEntry(c);let p=e,h={update:g=>{p=g,l.update(this.withEntryOverride(g,t))},dispose:()=>{let{needsFullRefresh:g}=this.doAddOrRemoveModelEntry(c,!1);g?this.appendStatusbarEntries():(s.remove(),this.updateCompactEntries()),r.dispose()}};return r.add(this.onDidOverrideEntry.event(g=>{g===t&&h.update(p)})),h}doCreateStatusItem(e,t,...o){let n=_(".statusbar-item",{id:e});return o&&n.classList.add(...o),t===1?n.classList.add("right"):n.classList.add("left"),n}doAddOrRemoveModelEntry(e,t){let o=this.viewModel.entries;t?this.viewModel.add(e):this.viewModel.remove(e);let n=this.viewModel.entries;return t?o.splice(n.indexOf(e),0,e):o.splice(o.indexOf(e),1),{needsFullRefresh:!$i(o,n)}}isEntryVisible(e){return!this.viewModel.isHidden(e)}updateEntryVisibility(e,t){t?this.viewModel.show(e):this.viewModel.hide(e)}focusNextEntry(){this.viewModel.focusNextEntry()}focusPreviousEntry(){this.viewModel.focusPreviousEntry()}isEntryFocused(){return this.viewModel.isEntryFocused()}focus(e=!0){this.getContainer()?.focus();let t=this.viewModel.lastFocusedEntry;e&&t&&setTimeout(()=>t.labelContainer.focus(),0)}createContentArea(e){this.element=e;let t=this._register(this.contextKeyService.createScoped(this.element));return kY.bindTo(t).set(!0),this.leftItemsContainer=_(".left-items.items-container"),this.element.appendChild(this.leftItemsContainer),this.element.tabIndex=0,this.rightItemsContainer=_(".right-items.items-container"),this.element.appendChild(this.rightItemsContainer),this._register(j(e,re.CONTEXT_MENU,o=>this.showContextMenu(o))),this._register(ws.addTarget(e)),this._register(j(e,Gn.Contextmenu,o=>this.showContextMenu(o))),this.createInitialStatusbarEntries(),this.element}createInitialStatusbarEntries(){for(this.appendStatusbarEntries();this.pendingEntries.length;){let e=this.pendingEntries.shift();e&&(e.accessor=this.addEntry(e.entry,e.id,e.alignment,e.priority.primary))}}appendStatusbarEntries(){let e=Oi(this.leftItemsContainer),t=Oi(this.rightItemsContainer);Rt(e),Rt(t);for(let o of[...this.viewModel.getEntries(0),...this.viewModel.getEntries(1).reverse()])(o.alignment===0?e:t).appendChild(o.container);this.updateCompactEntries()}appendStatusbarEntry(e){let t=this.viewModel.getEntries(e.alignment);e.alignment===1&&t.reverse();let o=Oi(e.alignment===0?this.leftItemsContainer:this.rightItemsContainer),n=t.indexOf(e);n+1===t.length?o.appendChild(e.container):o.insertBefore(e.container,t[n+1].container),this.updateCompactEntries()}updateCompactEntries(){let e=this.viewModel.entries,t=new Map;for(let s of e)this.viewModel.isHidden(s.id)||t.set(s.id,s),s.container.classList.remove("compact-left","compact-right");let o=new Map;for(let s of t.values())if(Jle(s.priority.primary)&&s.priority.primary.compact){let l=s.priority.primary.location.id,c=t.get(l);if(!c)continue;let u=o.get(l);if(!u){for(let p of o.values())if(p.has(l)){u=p;break}u||(u=new Map,o.set(l,u))}u.set(s.id,s),u.set(c.id,c),s.priority.primary.alignment===0?(c.container.classList.add("compact-left"),s.container.classList.add("compact-right")):(c.container.classList.add("compact-right"),s.container.classList.add("compact-left"))}let n=this.getColor(JW),r=this.getColor(Z9i);if(this.compactEntriesDisposable.value=new P,n&&r&&!Ug(this.theme.type))for(let[,s]of o)for(let l of s.values())l.hasCommand&&(this.compactEntriesDisposable.value.add(j(l.labelContainer,re.MOUSE_OVER,()=>{s.forEach(c=>c.labelContainer.style.backgroundColor=n),l.labelContainer.style.backgroundColor=r})),this.compactEntriesDisposable.value.add(j(l.labelContainer,re.MOUSE_OUT,()=>{s.forEach(c=>c.labelContainer.style.backgroundColor="")})))}showContextMenu(e){$t.stop(e,!0);let t=new yn(Me(this.element),e),o;this.contextMenuService.showContextMenu({getAnchor:()=>t,getActions:()=>(o=this.getContextMenuActions(t),o),onHide:()=>{o&&jH(o)}})}getContextMenuActions(e){let t=[];t.push(pi({id:Cue.ID,label:d(4191,null),run:()=>this.instantiationService.invokeFunction(r=>new Cue().run(r))})),t.push(new li);let o=new Set;for(let r of this.viewModel.entries)o.has(r.id)||(t.push(new SOt(r.id,r.name,this.viewModel)),o.add(r.id));let n;for(let r=e.target;r;r=r.parentElement){let s=this.viewModel.findEntry(r);if(s){n=s;break}}return n&&(t.push(new li),n.extensionId&&t.push(this.instantiationService.createInstance(aDe,n.extensionId)),t.push(new IOt(n.id,n.name,this.viewModel))),t}updateStyles(){super.updateStyles();let e=Oi(this.getContainer()),t=[...this.styleOverrides].sort((c,u)=>c.priority-u.priority)[0],o=this.getColor(t?.background??(this.contextService.getWorkbenchState()!==1?bEt:SEt))||"";e.style.backgroundColor=o;let n=this.getColor(t?.foreground??(this.contextService.getWorkbenchState()!==1?jL:Q9i))||"";e.style.color=n;let r=this.getColor(J9i);this.updateCompactEntries();let s=this.getColor(t?.border??(this.contextService.getWorkbenchState()!==1?dce:X9i))||this.getColor(gi);s?(e.classList.add("status-border-top"),e.style.setProperty("--status-border-top-color",s)):(e.classList.remove("status-border-top"),e.style.removeProperty("--status-border-top-color"));let l=this.getColor(Y9i);this.styleElement||(this.styleElement=hr(e,void 0,this._store)),this.styleElement.textContent=`
/* Status bar focus outline */
.monaco-workbench .part.statusbar:focus {
outline-color: ${l};
}
/* Status bar item focus outline */
.monaco-workbench .part.statusbar > .items-container > .statusbar-item a:focus-visible {
outline: 1px solid ${this.getColor(qs)??r};
outline-offset: ${s?"-2px":"-1px"};
}
/* Notification Beak */
.monaco-workbench .part.statusbar > .items-container > .statusbar-item.has-beak > .status-bar-item-beak-container:before {
border-bottom-color: ${s??o};
}
`}layout(e,t,o,n){super.layout(e,t,o,n),super.layoutContents(e,t)}overrideStyle(e){return this.styleOverrides.add(e),this.updateStyles(),Z(()=>{this.styleOverrides.delete(e),this.updateStyles()})}toJSON(){return{type:"workbench.parts.statusbar"}}dispose(){this._onWillDispose.fire(),super.dispose()}};SK=I([m(1,F),m(2,De),m(3,Pe),m(4,le),m(5,fi),m(6,ze),m(7,X)],SK);var yYe=class extends SK{constructor(i,e,t,o,n,r,s){super("workbench.parts.statusbar",i,e,t,o,n,r,s)}};yYe=I([m(0,F),m(1,De),m(2,Pe),m(3,le),m(4,fi),m(5,ze),m(6,X)],yYe);var Lue=class extends SK{constructor(e,t,o,n,r,s,l,c){let u=Lue.COUNTER++;super(`workbench.parts.auxiliaryStatus.${u}`,t,o,n,r,s,l,c);this.container=e;this.height=SK.HEIGHT}static{this.COUNTER=1}};Lue=I([m(1,F),m(2,De),m(3,Pe),m(4,le),m(5,fi),m(6,ze),m(7,X)],Lue);var wYe=class extends TJ{constructor(e,t,o){super("workbench.statusBarService",o,t);this.instantiationService=e;this._onDidCreateAuxiliaryStatusbarPart=this._register(new E);this.onDidCreateAuxiliaryStatusbarPart=this._onDidCreateAuxiliaryStatusbarPart.event;this.mainPart=this._register(this.instantiationService.createInstance(yYe)),this._register(this.registerPart(this.mainPart)),this.onDidChangeEntryVisibility=this.mainPart.onDidChangeEntryVisibility}createAuxiliaryStatusbarPart(e,t){let o=_("footer.part.statusbar",{role:"status","aria-live":"off",tabIndex:"0"});o.style.position="relative",e.appendChild(o);let n=t.createInstance(Lue,o),r=this.registerPart(n);return n.create(o),H.once(n.onWillDispose)(()=>r.dispose()),this._onDidCreateAuxiliaryStatusbarPart.fire(n),n}createScoped(e,t){return t.add(this.instantiationService.createInstance(CYe,e))}addEntry(e,t,o,n=0){return e.showInAllWindows?this.doAddEntryToAllWindows(e,t,o,n):this.mainPart.addEntry(e,t,o,n)}doAddEntryToAllWindows(e,t,o,n=0){let r=new P,s=new Set,l=e;function c(u){let p=new P;p.add(u.onWillDispose(()=>p.dispose()));let h=p.add(u.addEntry(l,t,o,n));s.add(h),p.add(Z(()=>s.delete(h))),r.add(p),p.add(Z(()=>r.delete(p)))}for(let u of this.parts)c(u);return r.add(this.onDidCreateAuxiliaryStatusbarPart(u=>c(u))),{update:u=>{l=u;for(let p of s)p.update(u)},dispose:()=>r.dispose()}}isEntryVisible(e){return this.mainPart.isEntryVisible(e)}updateEntryVisibility(e,t){for(let o of this.parts)o.updateEntryVisibility(e,t)}overrideEntry(e,t){let o=new P;for(let n of this.parts)o.add(n.overrideEntry(e,t));return o}focus(e){this.activePart.focus(e)}focusNextEntry(){this.activePart.focusNextEntry()}focusPreviousEntry(){this.activePart.focusPreviousEntry()}isEntryFocused(){return this.activePart.isEntryFocused()}overrideStyle(e){let t=new P;for(let o of this.parts)t.add(o.overrideStyle(e));return t}};wYe=I([m(0,F),m(1,le),m(2,De)],wYe);var CYe=class extends C{constructor(e,t){super();this.statusbarEntryContainer=e;this.statusbarService=t;this.onDidChangeEntryVisibility=this.statusbarEntryContainer.onDidChangeEntryVisibility}createAuxiliaryStatusbarPart(e,t){return this.statusbarService.createAuxiliaryStatusbarPart(e,t)}createScoped(e,t){return this.statusbarService.createScoped(e,t)}getPart(){return this.statusbarEntryContainer}addEntry(e,t,o,n=0){return this.statusbarEntryContainer.addEntry(e,t,o,n)}isEntryVisible(e){return this.statusbarEntryContainer.isEntryVisible(e)}updateEntryVisibility(e,t){this.statusbarEntryContainer.updateEntryVisibility(e,t)}overrideEntry(e,t){return this.statusbarEntryContainer.overrideEntry(e,t)}focus(e){this.statusbarEntryContainer.focus(e)}focusNextEntry(){this.statusbarEntryContainer.focusNextEntry()}focusPreviousEntry(){this.statusbarEntryContainer.focusPreviousEntry()}isEntryFocused(){return this.statusbarEntryContainer.isEntryFocused()}overrideStyle(e){return this.statusbarEntryContainer.overrideStyle(e)}};CYe=I([m(1,Tr)],CYe);we(Tr,wYe,0);var wOt=class extends K{constructor(){super({id:"menu.resetHiddenStates",title:L(1809,"Reset All Menus"),category:We.View,f1:!0})}run(i){i.get(qt).resetHiddenStates(),i.get(ne).info("did RESET all menu hidden states")}};we(qt,awe,1);W(wOt);var cDe=!1;function COt(a){return a.scheme===Y.file?a.fsPath:a.path}var Mno=0,dDe=class{constructor(i,e,t,o,n,r,s){this.id=++Mno;this.type=0;this.actual=i,this.label=i.label,this.confirmBeforeUndo=i.confirmBeforeUndo||!1,this.resourceLabel=e,this.strResource=t,this.resourceLabels=[this.resourceLabel],this.strResources=[this.strResource],this.groupId=o,this.groupOrder=n,this.sourceId=r,this.sourceOrder=s,this.isValid=!0}setValid(i){this.isValid=i}toString(){return`[id:${this.id}] [group:${this.groupId}] [${this.isValid?" VALID":"INVALID"}] ${this.actual.constructor.name} - ${this.actual}`}};var xOt=class{constructor(i,e){this.resourceLabel=i;this.reason=e}},kOt=class{constructor(){this.elements=new Map}createMessage(){let i=[],e=[];for(let[,o]of this.elements)(o.reason===0?i:e).push(o.resourceLabel);let t=[];return i.length>0&&t.push(d(2667,null,i.join(", "))),e.length>0&&t.push(d(2669,null,e.join(", "))),t.join(`
`)}get size(){return this.elements.size}has(i){return this.elements.has(i)}set(i,e){this.elements.set(i,e)}delete(i){return this.elements.delete(i)}},fbi=class{constructor(i,e,t,o,n,r,s){this.id=++Mno;this.type=1;this.actual=i,this.label=i.label,this.confirmBeforeUndo=i.confirmBeforeUndo||!1,this.resourceLabels=e,this.strResources=t,this.groupId=o,this.groupOrder=n,this.sourceId=r,this.sourceOrder=s,this.removedResources=null,this.invalidatedResources=null}canSplit(){return typeof this.actual.split=="function"}removeResource(i,e,t){this.removedResources||(this.removedResources=new kOt),this.removedResources.has(e)||this.removedResources.set(e,new xOt(i,t))}setValid(i,e,t){t?this.invalidatedResources&&(this.invalidatedResources.delete(e),this.invalidatedResources.size===0&&(this.invalidatedResources=null)):(this.invalidatedResources||(this.invalidatedResources=new kOt),this.invalidatedResources.has(e)||this.invalidatedResources.set(e,new xOt(i,0)))}toString(){return`[id:${this.id}] [group:${this.groupId}] [${this.invalidatedResources?"INVALID":" VALID"}] ${this.actual.constructor.name} - ${this.actual}`}},EOt=class{constructor(i,e){this.resourceLabel=i,this.strResource=e,this._past=[],this._future=[],this.locked=!1,this.versionId=1}dispose(){for(let i of this._past)i.type===1&&i.removeResource(this.resourceLabel,this.strResource,0);for(let i of this._future)i.type===1&&i.removeResource(this.resourceLabel,this.strResource,0);this.versionId++}toString(){let i=[];i.push(`* ${this.strResource}:`);for(let e=0;e<this._past.length;e++)i.push(` * [UNDO] ${this._past[e]}`);for(let e=this._future.length-1;e>=0;e--)i.push(` * [REDO] ${this._future[e]}`);return i.join(`
`)}flushAllElements(){this._past=[],this._future=[],this.versionId++}setElementsIsValid(i){for(let e of this._past)e.type===1?e.setValid(this.resourceLabel,this.strResource,i):e.setValid(i);for(let e of this._future)e.type===1?e.setValid(this.resourceLabel,this.strResource,i):e.setValid(i)}_setElementValidFlag(i,e){i.type===1?i.setValid(this.resourceLabel,this.strResource,e):i.setValid(e)}setElementsValidFlag(i,e){for(let t of this._past)e(t.actual)&&this._setElementValidFlag(t,i);for(let t of this._future)e(t.actual)&&this._setElementValidFlag(t,i)}pushElement(i){for(let e of this._future)e.type===1&&e.removeResource(this.resourceLabel,this.strResource,1);this._future=[],this._past.push(i),this.versionId++}createSnapshot(i){let e=[];for(let t=0,o=this._past.length;t<o;t++)e.push(this._past[t].id);for(let t=this._future.length-1;t>=0;t--)e.push(this._future[t].id);return new gqe(i,e)}restoreSnapshot(i){let e=i.elements.length,t=!0,o=0,n=-1;for(let s=0,l=this._past.length;s<l;s++,o++){let c=this._past[s];t&&(o>=e||c.id!==i.elements[o])&&(t=!1,n=s),!t&&c.type===1&&c.removeResource(this.resourceLabel,this.strResource,0)}let r=-1;for(let s=this._future.length-1;s>=0;s--,o++){let l=this._future[s];t&&(o>=e||l.id!==i.elements[o])&&(t=!1,r=s),!t&&l.type===1&&l.removeResource(this.resourceLabel,this.strResource,0)}n!==-1&&(this._past=this._past.slice(0,n)),r!==-1&&(this._future=this._future.slice(r+1)),this.versionId++}getElements(){let i=[],e=[];for(let t of this._past)i.push(t.actual);for(let t of this._future)e.push(t.actual);return{past:i,future:e}}getClosestPastElement(){return this._past.length===0?null:this._past[this._past.length-1]}getSecondClosestPastElement(){return this._past.length<2?null:this._past[this._past.length-2]}getClosestFutureElement(){return this._future.length===0?null:this._future[this._future.length-1]}hasPastElements(){return this._past.length>0}hasFutureElements(){return this._future.length>0}splitPastWorkspaceElement(i,e){for(let t=this._past.length-1;t>=0;t--)if(this._past[t]===i){e.has(this.strResource)?this._past[t]=e.get(this.strResource):this._past.splice(t,1);break}this.versionId++}splitFutureWorkspaceElement(i,e){for(let t=this._future.length-1;t>=0;t--)if(this._future[t]===i){e.has(this.strResource)?this._future[t]=e.get(this.strResource):this._future.splice(t,1);break}this.versionId++}moveBackward(i){this._past.pop(),this._future.push(i),this.versionId++}moveForward(i){this._future.pop(),this._past.push(i),this.versionId++}},kYe=class{constructor(i){this.editStacks=i,this._versionIds=[];for(let e=0,t=this.editStacks.length;e<t;e++)this._versionIds[e]=this.editStacks[e].versionId}isValid(){for(let i=0,e=this.editStacks.length;i<e;i++)if(this._versionIds[i]!==this.editStacks[i].versionId)return!1;return!0}},Pno=new EOt("","");Pno.locked=!0;var xYe=class{constructor(i,e){this._dialogService=i;this._notificationService=e;this._editStacks=new Map,this._uriComparisonKeyComputers=[]}registerUriComparisonKeyComputer(i,e){return this._uriComparisonKeyComputers.push([i,e]),{dispose:()=>{for(let t=0,o=this._uriComparisonKeyComputers.length;t<o;t++)if(this._uriComparisonKeyComputers[t][1]===e){this._uriComparisonKeyComputers.splice(t,1);return}}}}getUriComparisonKey(i){for(let e of this._uriComparisonKeyComputers)if(e[0]===i.scheme)return e[1].getComparisonKey(i);return i.toString()}_print(i){console.log("------------------------------------"),console.log(`AFTER ${i}: `);let e=[];for(let t of this._editStacks)e.push(t[1].toString());console.log(e.join(`
`))}pushElement(i,e=R9.None,t=$U.None){if(i.type===0){let o=COt(i.resource),n=this.getUriComparisonKey(i.resource);this._pushElement(new dDe(i,o,n,e.id,e.nextOrder(),t.id,t.nextOrder()))}else{let o=new Set,n=[],r=[];for(let s of i.resources){let l=COt(s),c=this.getUriComparisonKey(s);o.has(c)||(o.add(c),n.push(l),r.push(c))}n.length===1?this._pushElement(new dDe(i,n[0],r[0],e.id,e.nextOrder(),t.id,t.nextOrder())):this._pushElement(new fbi(i,n,r,e.id,e.nextOrder(),t.id,t.nextOrder()))}cDe&&this._print("pushElement")}_pushElement(i){for(let e=0,t=i.strResources.length;e<t;e++){let o=i.resourceLabels[e],n=i.strResources[e],r;this._editStacks.has(n)?r=this._editStacks.get(n):(r=new EOt(o,n),this._editStacks.set(n,r)),r.pushElement(i)}}getLastElement(i){let e=this.getUriComparisonKey(i);if(this._editStacks.has(e)){let t=this._editStacks.get(e);if(t.hasFutureElements())return null;let o=t.getClosestPastElement();return o?o.actual:null}return null}_splitPastWorkspaceElement(i,e){let t=i.actual.split(),o=new Map;for(let n of t){let r=COt(n.resource),s=this.getUriComparisonKey(n.resource),l=new dDe(n,r,s,0,0,0,0);o.set(l.strResource,l)}for(let n of i.strResources){if(e&&e.has(n))continue;this._editStacks.get(n).splitPastWorkspaceElement(i,o)}}_splitFutureWorkspaceElement(i,e){let t=i.actual.split(),o=new Map;for(let n of t){let r=COt(n.resource),s=this.getUriComparisonKey(n.resource),l=new dDe(n,r,s,0,0,0,0);o.set(l.strResource,l)}for(let n of i.strResources){if(e&&e.has(n))continue;this._editStacks.get(n).splitFutureWorkspaceElement(i,o)}}removeElements(i){let e=typeof i=="string"?i:this.getUriComparisonKey(i);this._editStacks.has(e)&&(this._editStacks.get(e).dispose(),this._editStacks.delete(e)),cDe&&this._print("removeElements")}setElementsValidFlag(i,e,t){let o=this.getUriComparisonKey(i);this._editStacks.has(o)&&this._editStacks.get(o).setElementsValidFlag(e,t),cDe&&this._print("setElementsValidFlag")}hasElements(i){let e=this.getUriComparisonKey(i);if(this._editStacks.has(e)){let t=this._editStacks.get(e);return t.hasPastElements()||t.hasFutureElements()}return!1}createSnapshot(i){let e=this.getUriComparisonKey(i);return this._editStacks.has(e)?this._editStacks.get(e).createSnapshot(i):new gqe(i,[])}restoreSnapshot(i){let e=this.getUriComparisonKey(i.resource);if(this._editStacks.has(e)){let t=this._editStacks.get(e);t.restoreSnapshot(i),!t.hasPastElements()&&!t.hasFutureElements()&&(t.dispose(),this._editStacks.delete(e))}cDe&&this._print("restoreSnapshot")}getElements(i){let e=this.getUriComparisonKey(i);return this._editStacks.has(e)?this._editStacks.get(e).getElements():{past:[],future:[]}}_findClosestUndoElementWithSource(i){if(!i)return[null,null];let e=null,t=null;for(let[o,n]of this._editStacks){let r=n.getClosestPastElement();r&&r.sourceId===i&&(!e||r.sourceOrder>e.sourceOrder)&&(e=r,t=o)}return[e,t]}canUndo(i){if(i instanceof $U){let[,t]=this._findClosestUndoElementWithSource(i.id);return!!t}let e=this.getUriComparisonKey(i);return this._editStacks.has(e)?this._editStacks.get(e).hasPastElements():!1}_onError(i,e){mt(i);for(let t of e.strResources)this.removeElements(t);this._notificationService.error(i)}_acquireLocks(i){for(let e of i.editStacks)if(e.locked)throw new Error("Cannot acquire edit stack lock");for(let e of i.editStacks)e.locked=!0;return()=>{for(let e of i.editStacks)e.locked=!1}}_safeInvokeWithLocks(i,e,t,o,n){let r=this._acquireLocks(t),s;try{s=e()}catch(l){return r(),o.dispose(),this._onError(l,i)}return s?s.then(()=>(r(),o.dispose(),n()),l=>(r(),o.dispose(),this._onError(l,i))):(r(),o.dispose(),n())}async _invokeWorkspacePrepare(i){if(typeof i.actual.prepareUndoRedo>"u")return C.None;let e=i.actual.prepareUndoRedo();return typeof e>"u"?C.None:e}_invokeResourcePrepare(i,e){if(i.actual.type!==1||typeof i.actual.prepareUndoRedo>"u")return e(C.None);let t=i.actual.prepareUndoRedo();return t?Ac(t)?e(t):t.then(o=>e(o)):e(C.None)}_getAffectedEditStacks(i){let e=[];for(let t of i.strResources)e.push(this._editStacks.get(t)||Pno);return new kYe(e)}_tryToSplitAndUndo(i,e,t,o){if(e.canSplit())return this._splitPastWorkspaceElement(e,t),this._notificationService.warn(o),new uDe(this._undo(i,0,!0));for(let n of e.strResources)this.removeElements(n);return this._notificationService.warn(o),new uDe}_checkWorkspaceUndo(i,e,t,o){if(e.removedResources)return this._tryToSplitAndUndo(i,e,e.removedResources,d(2659,null,e.label,e.removedResources.createMessage()));if(o&&e.invalidatedResources)return this._tryToSplitAndUndo(i,e,e.invalidatedResources,d(2659,null,e.label,e.invalidatedResources.createMessage()));let n=[];for(let s of t.editStacks)s.getClosestPastElement()!==e&&n.push(s.resourceLabel);if(n.length>0)return this._tryToSplitAndUndo(i,e,null,d(2660,null,e.label,n.join(", ")));let r=[];for(let s of t.editStacks)s.locked&&r.push(s.resourceLabel);return r.length>0?this._tryToSplitAndUndo(i,e,null,d(2662,null,e.label,r.join(", "))):t.isValid()?null:this._tryToSplitAndUndo(i,e,null,d(2661,null,e.label))}_workspaceUndo(i,e,t){let o=this._getAffectedEditStacks(e),n=this._checkWorkspaceUndo(i,e,o,!1);return n?n.returnValue:this._confirmAndExecuteWorkspaceUndo(i,e,o,t)}_isPartOfUndoGroup(i){if(!i.groupId)return!1;for(let[,e]of this._editStacks){let t=e.getClosestPastElement();if(t){if(t===i){let o=e.getSecondClosestPastElement();if(o&&o.groupId===i.groupId)return!0}if(t.groupId===i.groupId)return!0}}return!1}async _confirmAndExecuteWorkspaceUndo(i,e,t,o){if(e.canSplit()&&!this._isPartOfUndoGroup(e)){let s;(g=>(g[g.All=0]="All",g[g.This=1]="This",g[g.Cancel=2]="Cancel"))(s||={});let{result:l}=await this._dialogService.prompt({type:gt.Info,message:d(2666,null,e.label),buttons:[{label:d(2670,null,t.editStacks.length),run:()=>0},{label:d(2668,null),run:()=>1}],cancelButton:{run:()=>2}});if(l===2)return;if(l===1)return this._splitPastWorkspaceElement(e,null),this._undo(i,0,!0);let c=this._checkWorkspaceUndo(i,e,t,!1);if(c)return c.returnValue;o=!0}let n;try{n=await this._invokeWorkspacePrepare(e)}catch(s){return this._onError(s,e)}let r=this._checkWorkspaceUndo(i,e,t,!0);if(r)return n.dispose(),r.returnValue;for(let s of t.editStacks)s.moveBackward(e);return this._safeInvokeWithLocks(e,()=>e.actual.undo(),t,n,()=>this._continueUndoInGroup(e.groupId,o))}_resourceUndo(i,e,t){if(!e.isValid){i.flushAllElements();return}if(i.locked){let o=d(2654,null,e.label);this._notificationService.warn(o);return}return this._invokeResourcePrepare(e,o=>(i.moveBackward(e),this._safeInvokeWithLocks(e,()=>e.actual.undo(),new kYe([i]),o,()=>this._continueUndoInGroup(e.groupId,t))))}_findClosestUndoElementInGroup(i){if(!i)return[null,null];let e=null,t=null;for(let[o,n]of this._editStacks){let r=n.getClosestPastElement();r&&r.groupId===i&&(!e||r.groupOrder>e.groupOrder)&&(e=r,t=o)}return[e,t]}_continueUndoInGroup(i,e){if(!i)return;let[,t]=this._findClosestUndoElementInGroup(i);if(t)return this._undo(t,0,e)}undo(i){if(i instanceof $U){let[,e]=this._findClosestUndoElementWithSource(i.id);return e?this._undo(e,i.id,!1):void 0}return typeof i=="string"?this._undo(i,0,!1):this._undo(this.getUriComparisonKey(i),0,!1)}_undo(i,e=0,t){if(!this._editStacks.has(i))return;let o=this._editStacks.get(i),n=o.getClosestPastElement();if(!n)return;if(n.groupId){let[s,l]=this._findClosestUndoElementInGroup(n.groupId);if(n!==s&&l)return this._undo(l,e,t)}if((n.sourceId!==e||n.confirmBeforeUndo)&&!t)return this._confirmAndContinueUndo(i,e,n);try{return n.type===1?this._workspaceUndo(i,n,t):this._resourceUndo(o,n,t)}finally{cDe&&this._print("undo")}}async _confirmAndContinueUndo(i,e,t){if((await this._dialogService.confirm({message:d(2663,null,t.label),primaryButton:d(2665,null),cancelButton:d(2664,null)})).confirmed)return this._undo(i,e,!0)}_findClosestRedoElementWithSource(i){if(!i)return[null,null];let e=null,t=null;for(let[o,n]of this._editStacks){let r=n.getClosestFutureElement();r&&r.sourceId===i&&(!e||r.sourceOrder<e.sourceOrder)&&(e=r,t=o)}return[e,t]}canRedo(i){if(i instanceof $U){let[,t]=this._findClosestRedoElementWithSource(i.id);return!!t}let e=this.getUriComparisonKey(i);return this._editStacks.has(e)?this._editStacks.get(e).hasFutureElements():!1}_tryToSplitAndRedo(i,e,t,o){if(e.canSplit())return this._splitFutureWorkspaceElement(e,t),this._notificationService.warn(o),new uDe(this._redo(i));for(let n of e.strResources)this.removeElements(n);return this._notificationService.warn(o),new uDe}_checkWorkspaceRedo(i,e,t,o){if(e.removedResources)return this._tryToSplitAndRedo(i,e,e.removedResources,d(2655,null,e.label,e.removedResources.createMessage()));if(o&&e.invalidatedResources)return this._tryToSplitAndRedo(i,e,e.invalidatedResources,d(2655,null,e.label,e.invalidatedResources.createMessage()));let n=[];for(let s of t.editStacks)s.getClosestFutureElement()!==e&&n.push(s.resourceLabel);if(n.length>0)return this._tryToSplitAndRedo(i,e,null,d(2656,null,e.label,n.join(", ")));let r=[];for(let s of t.editStacks)s.locked&&r.push(s.resourceLabel);return r.length>0?this._tryToSplitAndRedo(i,e,null,d(2658,null,e.label,r.join(", "))):t.isValid()?null:this._tryToSplitAndRedo(i,e,null,d(2657,null,e.label))}_workspaceRedo(i,e){let t=this._getAffectedEditStacks(e),o=this._checkWorkspaceRedo(i,e,t,!1);return o?o.returnValue:this._executeWorkspaceRedo(i,e,t)}async _executeWorkspaceRedo(i,e,t){let o;try{o=await this._invokeWorkspacePrepare(e)}catch(r){return this._onError(r,e)}let n=this._checkWorkspaceRedo(i,e,t,!0);if(n)return o.dispose(),n.returnValue;for(let r of t.editStacks)r.moveForward(e);return this._safeInvokeWithLocks(e,()=>e.actual.redo(),t,o,()=>this._continueRedoInGroup(e.groupId))}_resourceRedo(i,e){if(!e.isValid){i.flushAllElements();return}if(i.locked){let t=d(2653,null,e.label);this._notificationService.warn(t);return}return this._invokeResourcePrepare(e,t=>(i.moveForward(e),this._safeInvokeWithLocks(e,()=>e.actual.redo(),new kYe([i]),t,()=>this._continueRedoInGroup(e.groupId))))}_findClosestRedoElementInGroup(i){if(!i)return[null,null];let e=null,t=null;for(let[o,n]of this._editStacks){let r=n.getClosestFutureElement();r&&r.groupId===i&&(!e||r.groupOrder<e.groupOrder)&&(e=r,t=o)}return[e,t]}_continueRedoInGroup(i){if(!i)return;let[,e]=this._findClosestRedoElementInGroup(i);if(e)return this._redo(e)}redo(i){if(i instanceof $U){let[,e]=this._findClosestRedoElementWithSource(i.id);return e?this._redo(e):void 0}return typeof i=="string"?this._redo(i):this._redo(this.getUriComparisonKey(i))}_redo(i){if(!this._editStacks.has(i))return;let e=this._editStacks.get(i),t=e.getClosestFutureElement();if(t){if(t.groupId){let[o,n]=this._findClosestRedoElementInGroup(t.groupId);if(t!==o&&n)return this._redo(n)}try{return t.type===1?this._workspaceRedo(i,t):this._resourceRedo(e,t)}finally{cDe&&this._print("redo")}}}};xYe=I([m(0,ct),m(1,Ne)],xYe);var uDe=class{constructor(i){this.returnValue=i}};we(Cl,xYe,1);var MJ=ae("IMcpResourceScannerService"),EYe=class extends C{constructor(e,t){super();this.fileService=e;this.uriIdentityService=t;this.resourcesAccessQueueMap=new vt}async scanMcpServers(e,t){return this.withProfileMcpServers(e,t)}async addMcpServers(e,t,o){await this.withProfileMcpServers(t,o,n=>{let r=n.inputs??[],s=n.servers??{};for(let{name:l,config:c,inputs:u}of e)if(s[l]=c,u){let p=new Set(r.map(g=>g.id)),h=u.filter(g=>!p.has(g.id));r=[...r,...h]}return{servers:s,inputs:r,sandbox:n.sandbox}})}async updateSandboxConfig(e,t,o){await this.withProfileMcpServers(t,o,e)}async removeMcpServers(e,t,o){await this.withProfileMcpServers(t,o,n=>{for(let r of e)n.servers?.[r]&&delete n.servers[r];return n})}async withProfileMcpServers(e,t,o){return this.getResourceAccessQueue(e).queue(async()=>{t=t??2;let n={};try{let r=await this.fileService.readFile(e),s=[],l=Ur(r.value.toString(),s,{allowTrailingComma:!0,allowEmptyContent:!0})||{};if(s.length>0)throw new Error("Failed to parse scanned MCP servers: "+s.join(", "));if(t===2)n=this.fromUserMcpServers(l);else if(t===6)n=this.fromWorkspaceFolderMcpServers(l);else if(t===5){let c=l;c.settings?.mcp&&(n=this.fromWorkspaceFolderMcpServers(c.settings?.mcp))}}catch(r){if(hu(r)!==1)throw r}return o&&(n=o(n??{}),t===2?await this.writeScannedMcpServers(e,n):t===6?await this.writeScannedMcpServersToWorkspaceFolder(e,n):t===5?await this.writeScannedMcpServersToWorkspace(e,n):Hr(t,`Invalid Target: ${ise(t)}`)),n})}async writeScannedMcpServers(e,t){t.servers&&Object.keys(t.servers).length>0||t.inputs&&t.inputs.length>0||t.sandbox!==void 0?await this.fileService.writeFile(e,Je.fromString(JSON.stringify(t,null," "))):await this.fileService.del(e)}async writeScannedMcpServersToWorkspaceFolder(e,t){await this.fileService.writeFile(e,Je.fromString(JSON.stringify(t,null," ")))}async writeScannedMcpServersToWorkspace(e,t){let o;try{let n=await this.fileService.readFile(e),r=[];if(o=Ur(n.value.toString(),r,{allowTrailingComma:!0,allowEmptyContent:!0}),r.length>0)throw new Error("Failed to parse scanned MCP servers: "+r.join(", "))}catch(n){if(hu(n)!==1)throw n;o={settings:{}}}o.settings||(o.settings={}),o.settings.mcp=t,await this.fileService.writeFile(e,Je.fromString(JSON.stringify(o,null," ")))}fromUserMcpServers(e){let t={inputs:e.inputs,sandbox:e.sandbox},o=Object.entries(e.servers??{});if(o.length>0){t.servers={};for(let[n,r]of o)t.servers[n]=this.sanitizeServer(r)}return t}fromWorkspaceFolderMcpServers(e){let t={inputs:e.inputs,sandbox:e.sandbox},o=Object.entries(e.servers??{});if(o.length>0){t.servers={};for(let[n,r]of o){let s=this.sanitizeServer(r);t.servers[n]=s}}return t}sanitizeServer(e){let t;if(e.config){let o=e;t={...o.config,version:o.version,gallery:o.gallery}}else t=e;return(t.type===void 0||t.type!=="http"&&t.type!=="stdio")&&(t.type=t.command?"stdio":"http"),t}getResourceAccessQueue(e){let t=this.resourcesAccessQueueMap.get(e);return t||(t=new Op,this.resourcesAccessQueueMap.set(e,t)),t}};EYe=I([m(0,be),m(1,dt)],EYe);we(MJ,EYe,1);var TYe=class{constructor(i,e){this._extensionService=i;this._logService=e;this._editSessionIdentifierProviders=new Map;this._participants=[]}registerEditSessionIdentityProvider(i){if(this._editSessionIdentifierProviders.get(i.scheme))throw new Error(`A provider has already been registered for scheme ${i.scheme}`);return this._editSessionIdentifierProviders.set(i.scheme,i),Z(()=>{this._editSessionIdentifierProviders.delete(i.scheme)})}async getEditSessionIdentifier(i,e){let{scheme:t}=i.uri,o=await this.activateProvider(t);return this._logService.trace(`EditSessionIdentityProvider for scheme ${t} available: ${!!o}`),o?.getEditSessionIdentifier(i,e)}async provideEditSessionIdentityMatch(i,e,t,o){let{scheme:n}=i.uri,r=await this.activateProvider(n);return this._logService.trace(`EditSessionIdentityProvider for scheme ${n} available: ${!!r}`),r?.provideEditSessionIdentityMatch?.(i,e,t,o)}async onWillCreateEditSessionIdentity(i,e){this._logService.debug("Running onWillCreateEditSessionIdentity participants...");for(let t of this._participants)await t.participate(i,e);this._logService.debug(`Done running ${this._participants.length} onWillCreateEditSessionIdentity participants.`)}addEditSessionIdentityCreateParticipant(i){let e=Zm(this._participants,i);return Z(()=>e())}async activateProvider(i){let e=i==="vscode-remote"?"file":i,t=this._editSessionIdentifierProviders.get(i);return t||(await this._extensionService.activateByEvent(`onEditSession:${e}`),this._editSessionIdentifierProviders.get(i))}};TYe=I([m(0,lt),m(1,ne)],TYe);we(Wz,TYe,1);var vbi=class{constructor(){this._providers=new Map}registerCanonicalUriProvider(i){return this._providers.set(i.scheme,i),{dispose:()=>this._providers.delete(i.scheme)}}async provideCanonicalUri(i,e,t){let o=this._providers.get(i.scheme);if(o)return o.provideCanonicalUri(i,e,t)}};we(oRt,vbi,1);var bbi=ae("keybindingEditingService"),_Ye=class extends C{constructor(e,t,o,n){super();this.textModelResolverService=e;this.textFileService=t;this.fileService=o;this.userDataProfileService=n;this.queue=new Op}addKeybinding(e,t,o){return this.queue.queue(()=>this.doEditKeybinding(e,t,o,!0))}editKeybinding(e,t,o){return this.queue.queue(()=>this.doEditKeybinding(e,t,o,!1))}resetKeybinding(e){return this.queue.queue(()=>this.doResetKeybinding(e))}removeKeybinding(e){return this.queue.queue(()=>this.doRemoveKeybinding(e))}async doEditKeybinding(e,t,o,n){let r=await this.resolveAndValidate(),s=r.object.textEditorModel;if(n)this.updateKeybinding(e,t,o,s,-1);else{let l=Ur(s.getValue()),c=this.findUserKeybindingEntryIndex(e,l);this.updateKeybinding(e,t,o,s,c),e.isDefault&&e.resolvedKeybinding&&this.removeDefaultKeybinding(e,s)}try{await this.save()}finally{r.dispose()}}async doRemoveKeybinding(e){let t=await this.resolveAndValidate(),o=t.object.textEditorModel;e.isDefault?this.removeDefaultKeybinding(e,o):this.removeUserKeybinding(e,o);try{return await this.save()}finally{t.dispose()}}async doResetKeybinding(e){let t=await this.resolveAndValidate(),o=t.object.textEditorModel;e.isDefault||(this.removeUserKeybinding(e,o),this.removeUnassignedDefaultKeybinding(e,o));try{return await this.save()}finally{t.dispose()}}save(){return this.textFileService.save(this.userDataProfileService.currentProfile.keybindingsResource)}updateKeybinding(e,t,o,n,r){let{tabSize:s,insertSpaces:l}=n.getOptions(),c=n.getEOL();if(r!==-1){this.applyEditsToBuffer(Sb(n.getValue(),[r,"key"],t,{tabSize:s,insertSpaces:l,eol:c})[0],n);let u=Sb(n.getValue(),[r,"when"],o,{tabSize:s,insertSpaces:l,eol:c});u.length>0&&this.applyEditsToBuffer(u[0],n)}else this.applyEditsToBuffer(Sb(n.getValue(),[-1],this.asObject(t,e.command,o,!1),{tabSize:s,insertSpaces:l,eol:c})[0],n)}removeUserKeybinding(e,t){let{tabSize:o,insertSpaces:n}=t.getOptions(),r=t.getEOL(),s=Ur(t.getValue()),l=this.findUserKeybindingEntryIndex(e,s);l!==-1&&this.applyEditsToBuffer(Sb(t.getValue(),[l],void 0,{tabSize:o,insertSpaces:n,eol:r})[0],t)}removeDefaultKeybinding(e,t){let{tabSize:o,insertSpaces:n}=t.getOptions(),r=t.getEOL(),s=e.resolvedKeybinding?e.resolvedKeybinding.getUserSettingsLabel():null;if(s){let l=this.asObject(s,e.command,e.when?e.when.serialize():void 0,!0);Ur(t.getValue()).every(u=>!this.areSame(u,l))&&this.applyEditsToBuffer(Sb(t.getValue(),[-1],l,{tabSize:o,insertSpaces:n,eol:r})[0],t)}}removeUnassignedDefaultKeybinding(e,t){let{tabSize:o,insertSpaces:n}=t.getOptions(),r=t.getEOL(),s=Ur(t.getValue()),l=this.findUnassignedDefaultKeybindingEntryIndex(e,s).reverse();for(let c of l)this.applyEditsToBuffer(Sb(t.getValue(),[c],void 0,{tabSize:o,insertSpaces:n,eol:r})[0],t)}findUserKeybindingEntryIndex(e,t){for(let o=0;o<t.length;o++){let n=t[o];if(n.command===e.command){if(!n.when&&!e.when)return o;if(n.when&&e.when){let r=x.deserialize(n.when);if(r&&r.serialize()===e.when.serialize())return o}}}return-1}findUnassignedDefaultKeybindingEntryIndex(e,t){let o=[];for(let n=0;n<t.length;n++)t[n].command===`-${e.command}`&&o.push(n);return o}asObject(e,t,o,n){let r={key:e};return t&&(r.command=n?`-${t}`:t),o&&(r.when=o),r}areSame(e,t){if(e.command!==t.command||e.key!==t.key)return!1;let o=x.deserialize(e.when),n=x.deserialize(t.when);return!(o&&!n||!o&&n||o&&n&&!o.equals(n)||!uo(e.args,t.args))}applyEditsToBuffer(e,t){let o=t.getPositionAt(e.offset),n=t.getPositionAt(e.offset+e.length),r=new z(o.lineNumber,o.column,n.lineNumber,n.column),l=t.getValueInRange(r)?An.replace(r,e.content):An.insert(o,e.content);t.pushEditOperations([new Yt(o.lineNumber,o.column,o.lineNumber,o.column)],[l],()=>[])}async resolveModelReference(){return await this.fileService.exists(this.userDataProfileService.currentProfile.keybindingsResource)||await this.textFileService.write(this.userDataProfileService.currentProfile.keybindingsResource,this.getEmptyContent(),{encoding:"utf8"}),this.textModelResolverService.createModelReference(this.userDataProfileService.currentProfile.keybindingsResource)}async resolveAndValidate(){if(this.textFileService.isDirty(this.userDataProfileService.currentProfile.keybindingsResource))throw new Error(d(17081,null));let e=await this.resolveModelReference(),t=e.object.textEditorModel,o=t.getEOL();if(t.getValue()){let n=this.parse(t);if(n.parseErrors.length)throw e.dispose(),new Error(d(17082,null));if(n.result){if(!Array.isArray(n.result))throw e.dispose(),new Error(d(17080,null))}else{let r=o+"[]";this.applyEditsToBuffer({content:r,length:r.length,offset:t.getValue().length},t)}}else{let n=this.getEmptyContent();this.applyEditsToBuffer({content:n,length:n.length,offset:0},t)}return e}parse(e){let t=[];return{result:Ur(e.getValue(),t,{allowTrailingComma:!0,allowEmptyContent:!0}),parseErrors:t}}getEmptyContent(){return"// "+d(17079,null)+`
[
]`}};_Ye=I([m(0,Nt),m(1,Ho),m(2,be),m(3,mn)],_Ye);we(bbi,_Ye,1);var TOt=class a{constructor(i,e,t){this.themeService=i;this._refCounter=0;this.data=e;let o=Ir(t).toString(36);this.itemColorClassName=`${a._classNamesPrefix}-itemColor-${o}`,this.itemBadgeClassName=`${a._classNamesPrefix}-itemBadge-${o}`,this.bubbleBadgeClassName=`${a._classNamesPrefix}-bubbleBadge-${o}`,this.iconBadgeClassName=`${a._classNamesPrefix}-iconBadge-${o}`}static keyOf(i){if(Array.isArray(i))return i.map(a.keyOf).join(",");{let{color:e,letter:t}=i;return q.isThemeIcon(t)?`${e}+${t.id}`:`${e}/${t}`}}static{this._classNamesPrefix="monaco-decoration"}acquire(){this._refCounter+=1}release(){return--this._refCounter===0}appendCSSRules(i){Array.isArray(this.data)?this._appendForMany(this.data,i):this._appendForOne(this.data,i)}_appendForOne(i,e){let{color:t,letter:o}=i;Vh(`.${this.itemColorClassName}`,`color: ${Mue(t)};`,e),q.isThemeIcon(o)?this._createIconCSSRule(o,t,e):o&&Vh(`.${this.itemBadgeClassName}::after`,`content: "${o}"; color: ${Mue(t)};`,e)}_appendForMany(i,e){let{color:t}=i.find(r=>!!r.color)??i[0];Vh(`.${this.itemColorClassName}`,`color: ${Mue(t)};`,e);let o=[],n;for(let r of i)if(q.isThemeIcon(r.letter)){n=r.letter;break}else r.letter&&o.push(r.letter);n?this._createIconCSSRule(n,t,e):(o.length&&Vh(`.${this.itemBadgeClassName}::after`,`content: "${o.join(", ")}"; color: ${Mue(t)};`,e),Vh(`.${this.bubbleBadgeClassName}::after`,`content: "\uEA71"; color: ${Mue(t)}; font-family: codicon; font-size: 14px; margin-right: 14px; opacity: 0.4;`,e))}_createIconCSSRule(i,e,t){let o=q.getModifier(i);o&&(i=q.modify(i,void 0));let n=jy().getIcon(i.id);if(!n)return;let r=this.themeService.getProductIconTheme().getIcon(n);r&&Vh(`.${this.iconBadgeClassName}::after`,`content: '${r.fontCharacter}';
color: ${i.color?Mue(i.color.id):Mue(e)};
font-family: ${WS(r.font?.id??"codicon")};
font-size: 16px;
margin-right: 14px;
font-weight: normal;
${o==="spin"?"animation: codicon-spin 1.5s steps(30) infinite; font-style: normal !important; transform-origin: center center;":""};
`,t)}removeCSSRules(i){EN(this.itemColorClassName,i),EN(this.itemBadgeClassName,i),EN(this.bubbleBadgeClassName,i),EN(this.iconBadgeClassName,i)}},Sbi=class{constructor(i){this._themeService=i;this._dispoables=new P;this._styleElement=hr(void 0,void 0,this._dispoables);this._decorationRules=new Map}dispose(){this._dispoables.dispose()}asDecoration(i,e){i.sort((u,p)=>(p.weight||0)-(u.weight||0));let t=TOt.keyOf(i),o=this._decorationRules.get(t);o||(o=new TOt(this._themeService,i,t),this._decorationRules.set(t,o),o.appendCSSRules(this._styleElement)),o.acquire();let n=o.itemColorClassName,r=o.itemBadgeClassName,s=o.iconBadgeClassName,l=Uo(i.filter(u=>!Jl(u.tooltip)).map(u=>u.tooltip)).join(" \u2022 "),c=i.some(u=>u.strikethrough);return e&&(r=o.bubbleBadgeClassName,l=d(16757,null)),{labelClassName:n,badgeClassName:r,iconClassName:s,strikethrough:c,tooltip:l,dispose:()=>{o?.release()&&(this._decorationRules.delete(t),o.removeCSSRules(this._styleElement),o=void 0)}}}},Ibi=class{constructor(i){this._data=Yu.forUris(i=>!0);this._data.fill(!0,Yl(i))}affectsResource(i){return this._data.hasElementOrSubtree(i)}},pDe=class{constructor(i,e){this.source=i;this.thenable=e}};function Mue(a){return a?wt(a):"inherit"}var DYe=class{constructor(i,e){this._store=new P;this._onDidChangeDecorationsDelayed=this._store.add(new gbe({merge:i=>i.flat()}));this._onDidChangeDecorations=this._store.add(new E);this.onDidChangeDecorations=this._onDidChangeDecorations.event;this._provider=new Vs;this._decorationStyles=new Sbi(e),this._data=Yu.forUris(t=>i.extUri.ignorePathCasing(t)),this._store.add(this._onDidChangeDecorationsDelayed.event(t=>{this._onDidChangeDecorations.fire(new Ibi(t))}))}dispose(){this._store.dispose(),this._data.clear()}registerDecorationsProvider(i){let e=this._provider.unshift(i);this._onDidChangeDecorations.fire({affectsResource(){return!0}});let t=()=>{let n=[];for(let[r,s]of this._data)s.delete(i)&&n.push(r);n.length>0&&this._onDidChangeDecorationsDelayed.fire(n)},o=i.onDidChange(n=>{if(!n)t();else for(let r of n){let s=this._ensureEntry(r);this._fetchData(s,r,i)}});return Z(()=>{e(),o.dispose(),t()})}_ensureEntry(i){let e=this._data.get(i);return e||(e=new Map,this._data.set(i,e)),e}getDecoration(i,e){let t=[],o=!1,n=this._ensureEntry(i);for(let r of this._provider){let s=n.get(r);s===void 0&&(s=this._fetchData(n,i,r)),s&&!(s instanceof pDe)&&t.push(s)}if(e){let r=this._data.findSuperstr(i);if(r)for(let s of r)for(let l of s[1].values())l&&!(l instanceof pDe)&&l.bubble&&(t.push(l),o=!0)}return t.length===0?void 0:this._decorationStyles.asDecoration(t,o)}_fetchData(i,e,t){let o=i.get(t);o instanceof pDe&&(o.source.cancel(),i.delete(t));let n=new $e,r=t.provideDecorations(e,n.token);if(FT(r)){let s=new pDe(n,Promise.resolve(r).then(l=>{i.get(t)===s&&this._keepItem(i,t,e,l)}).catch(l=>{!so(l)&&i.get(t)===s&&i.delete(t)}).finally(()=>{n.dispose()}));return i.set(t,s),null}else return n.dispose(),this._keepItem(i,t,e,r)}_keepItem(i,e,t,o){let n=o||null,r=i.get(e);return i.set(e,n),(n||r)&&this._onDidChangeDecorationsDelayed.fire(t),n}};DYe=I([m(0,dt),m(1,De)],DYe);we(Cv,DYe,1);var _Ot=class extends C{constructor(){super(...arguments);this.dialogs=[];this._onWillShowDialog=this._register(new E);this.onWillShowDialog=this._onWillShowDialog.event;this._onDidShowDialog=this._register(new E);this.onDidShowDialog=this._onDidShowDialog.event}show(e){let t=new Go,o={args:e,close:n=>{this.dialogs.splice(0,1),n instanceof Error?t.error(n):t.complete(n),this._onDidShowDialog.fire()}};return this.dialogs.push(o),this._onWillShowDialog.fire(),{item:o,result:t.p}}};var LYe=class extends C{constructor(e,t){super();this.environmentService=e;this.logService=t;this.model=this._register(new _Ot);this.onWillShowDialog=this.model.onWillShowDialog;this.onDidShowDialog=this.model.onDidShowDialog}skipDialogs(){return this.environmentService.enableSmokeTestDriver&&this.logService.warn("DialogService: Dialog requested during smoke test."),this.environmentService.isExtensionDevelopment&&!!this.environmentService.extensionTestsLocationURI}async confirm(e){return this.skipDialogs()?(this.logService.trace("DialogService: refused to show confirmation dialog in tests."),{confirmed:!0}):await this.model.show({confirmArgs:{confirmation:e}}).result}async prompt(e){if(this.skipDialogs())throw new Error(`DialogService: refused to show dialog in tests. Contents: ${e.message}`);let o=await this.model.show({promptArgs:{prompt:e}}).result;return{result:await o.result,checkboxChecked:o.checkboxChecked}}async input(e){if(this.skipDialogs())throw new Error("DialogService: refused to show input dialog in tests.");return await this.model.show({inputArgs:{input:e}}).result}async info(e,t){await this.prompt({type:gt.Info,message:e,detail:t})}async warn(e,t){await this.prompt({type:gt.Warning,message:e,detail:t})}async error(e,t){await this.prompt({type:gt.Error,message:e,detail:t})}async about(){if(this.skipDialogs())throw new Error("DialogService: refused to show about dialog in tests.");await this.model.show({}).result}};LYe=I([m(0,Vt),m(1,ne)],LYe);we(ct,LYe,1);var PJ=class extends C{constructor(e,t,o,n){super();this.container=e;this.message=t;this.options=n;if(this.modalElement=this.container.appendChild(_(".monaco-dialog-modal-block.dimmed")),this._register(Vo(this.modalElement,re.CLICK,c=>{c.target===this.modalElement&&this.element.focus()})),this.shadowElement=this.modalElement.appendChild(_(".dialog-shadow")),this.element=this.shadowElement.appendChild(_(".monaco-dialog-box")),n.alignment===1&&this.element.classList.add("align-vertical"),n.extraClasses&&this.element.classList.add(...n.extraClasses),this.element.setAttribute("role","dialog"),this.element.tabIndex=-1,xo(this.element),this.options.renderFooter){this.footerContainer=this.element.appendChild(_(".dialog-footer-row"));let c=this.footerContainer.appendChild(_("#monaco-dialog-footer.dialog-footer"));this.options.renderFooter(c);for(let u of this.footerContainer.querySelectorAll("a"))u.tabIndex=0}this.buttonStyles=n.buttonStyles,Array.isArray(o)&&o.length>0?this.buttons=o:this.options.disableDefaultAction?this.buttons=[]:this.buttons=[d(7,null)];let r=this.element.appendChild(_(".dialog-buttons-row"));this.buttonsContainer=r.appendChild(_(".dialog-buttons"));let s=this.element.appendChild(_(".dialog-message-row"));if(this.iconElement=s.appendChild(_("#monaco-dialog-icon.dialog-icon")),this.iconElement.setAttribute("aria-label",this.getIconAriaLabel()),this.messageContainer=s.appendChild(_(".dialog-message-container")),this.options.detail||this.options.renderBody){let u=this.messageContainer.appendChild(_(".dialog-message")).appendChild(_("#monaco-dialog-message-text.dialog-message-text"));u.innerText=this.message}if(this.messageDetailElement=this.messageContainer.appendChild(_("#monaco-dialog-message-detail.dialog-message-detail")),this.options.detail||!this.options.renderBody?this.messageDetailElement.innerText=this.options.detail?this.options.detail:t:this.messageDetailElement.style.display="none",this.options.renderBody){let c=this.messageContainer.appendChild(_("#monaco-dialog-message-body.dialog-message-body"));this.options.renderBody(c);for(let u of this.messageContainer.querySelectorAll("a"))u.tabIndex=0}if(this.options.inputs?this.inputs=this.options.inputs.map(c=>{let u=this.messageContainer.appendChild(_(".dialog-message-input")),p=this._register(new Dc(u,void 0,{placeholder:c.placeholder,type:c.type??"text",inputBoxStyles:n.inputBoxStyles}));return c.value&&(p.value=c.value),p}):this.inputs=[],this.options.checkboxLabel){let c=this.messageContainer.appendChild(_(".dialog-checkbox-row")),u=this.checkbox=this._register(new hv(this.options.checkboxLabel,!!this.options.checkboxChecked,n.checkboxStyles));c.appendChild(u.domNode);let p=c.appendChild(_(".dialog-checkbox-message"));p.innerText=this.options.checkboxLabel,this._register(j(p,re.CLICK,()=>u.checked=!u.checked))}let l=this.element.appendChild(_(".dialog-toolbar-row"));this.toolbarContainer=l.appendChild(_(".dialog-toolbar")),this.applyStyles()}getIconAriaLabel(){let e=d(4,null);switch(this.options.type){case"error":e=d(3,null);break;case"warning":e=d(6,null);break;case"pending":e=d(5,null);break;default:break}return e}updateMessage(e){this.messageDetailElement.innerText=e}async show(){return this.focusToReturn=this.container.ownerDocument.activeElement,new Promise(e=>{Rt(this.buttonsContainer);let t=()=>{e({button:this.options.cancelId||0,checkboxChecked:this.checkbox?this.checkbox.checked:void 0})};this._register(Z(t));let o=this.buttonBar=this._register(new _x(this.buttonsContainer,{alignment:this.options?.alignment===1?1:0})),n=this.rearrangeButtons(this.buttons,this.options.cancelId),r=c=>{e({button:n[c].index,checkboxChecked:this.checkbox?this.checkbox.checked:void 0,values:this.inputs.length>0?this.inputs.map(u=>u.value):void 0})};n.forEach((c,u)=>{let p=n[u].index===0,h,g=this.options.buttonOptions?.[n[u]?.index];if(p&&this.options?.primaryButtonDropdown){let f=f4i(this.options.primaryButtonDropdown.actions)?this.options.primaryButtonDropdown.actions.getActions():this.options.primaryButtonDropdown.actions;h=this._register(o.addButtonWithDropdown({...this.options.primaryButtonDropdown,...this.buttonStyles,dropdownLayer:2600,actions:f.map(v=>pi({...v,run:async()=>{await v.run(),r(u)}}))}))}else g?.sublabel?h=this._register(o.addButtonWithDescription({secondary:!p,...this.buttonStyles})):h=this._register(o.addButton({secondary:!p,...this.buttonStyles}));g?.styleButton&&g.styleButton(h),h.label=$$(n[u].label,!0),h instanceof e5e&&g?.sublabel&&(h.description=g?.sublabel),this._register(h.onDidClick(f=>{f&&$t.stop(f),r(u)}))});let s=Me(this.container);this._register(j(s,"keydown",c=>{let u=new Ii(c);if(u.equals(512)&&u.preventDefault(),u.equals(3)){this.inputs.some(h=>h.hasFocus())&&($t.stop(c),e({button:n.find(h=>h.index!==this.options.cancelId)?.index??0,checkboxChecked:this.checkbox?this.checkbox.checked:void 0,values:this.inputs.length>0?this.inputs.map(h=>h.value):void 0}));return}if(it&&u.equals(2082)){$t.stop(c);let h=n.find(g=>g.index===1&&g.index!==this.options.cancelId);h&&e({button:h.index,checkboxChecked:this.checkbox?this.checkbox.checked:void 0,values:this.inputs.length>0?this.inputs.map(g=>g.value):void 0});return}if(u.equals(10))return;let p=!1;if(u.equals(2)||u.equals(17)||u.equals(1026)||u.equals(15)){let h=[],g=-1;if(this.messageContainer){let f=this.messageContainer.querySelectorAll("a");for(let v of f)h.push(v),sa(v)&&(g=h.length-1)}for(let f of this.inputs)h.push(f),f.hasFocus()&&(g=h.length-1);if(this.checkbox&&(h.push(this.checkbox),this.checkbox.hasFocus()&&(g=h.length-1)),this.buttonBar)for(let f of this.buttonBar.buttons)f instanceof $I?(h.push(f.primaryButton),f.primaryButton.hasFocus()&&(g=h.length-1),h.push(f.dropdownButton),f.dropdownButton.hasFocus()&&(g=h.length-1)):(h.push(f),f.hasFocus()&&(g=h.length-1));if(this.footerContainer){let f=this.footerContainer.querySelectorAll("a");for(let v of f)h.push(v),sa(v)&&(g=h.length-1)}if(u.equals(2)||u.equals(17)){let f=(g+1)%h.length;h[f].focus()}else{g===-1&&(g=h.length);let f=g-1;f===-1&&(f=h.length-1),h[f].focus()}p=!0}p?$t.stop(c,!0):this.options.keyEventProcessor&&this.options.keyEventProcessor(u)},!0)),this._register(j(s,"keyup",c=>{$t.stop(c,!0);let u=new Ii(c);!this.options.disableCloseAction&&u.equals(9)&&t()},!0)),this._register(j(this.element,"focusout",c=>{c.relatedTarget&&this.element&&(gs(c.relatedTarget,this.element)||(this.focusToReturn=c.relatedTarget,c.target&&(c.target.focus(),$t.stop(c,!0))))},!1));let l="codicon-modifier-spin";if(this.iconElement.classList.remove(...q.asClassNameArray(M.dialogError),...q.asClassNameArray(M.dialogWarning),...q.asClassNameArray(M.dialogInfo),...q.asClassNameArray(M.loading),l),this.options.icon)this.iconElement.classList.add(...q.asClassNameArray(this.options.icon));else switch(this.options.type){case"error":this.iconElement.classList.add(...q.asClassNameArray(M.dialogError));break;case"warning":this.iconElement.classList.add(...q.asClassNameArray(M.dialogWarning));break;case"pending":this.iconElement.classList.add(...q.asClassNameArray(M.loading),l);break;case"none":this.iconElement.classList.add("no-codicon");break;default:this.iconElement.classList.add(...q.asClassNameArray(M.dialogInfo));break}if(!this.options.disableCloseAction&&!this.options.disableCloseButton){let c=this._register(new ji(this.toolbarContainer,{})),u=this._register(new st("dialog.close",d(2,null),q.asClassName(M.dialogClose),!0,async()=>{e({button:this.options.cancelId||0,checkboxChecked:this.checkbox?this.checkbox.checked:void 0})}));c.push(u,{icon:!0,label:!1})}this.applyStyles(),this.element.setAttribute("aria-modal","true"),this.element.setAttribute("aria-labelledby","monaco-dialog-icon monaco-dialog-message-text"),this.element.setAttribute("aria-describedby","monaco-dialog-icon monaco-dialog-message-text monaco-dialog-message-detail monaco-dialog-message-body monaco-dialog-footer"),bn(this.element),this.options.onVisibilityChange?.(s,!0),this._register(Z(()=>this.options.onVisibilityChange?.(s,!1))),this.inputs.length>0?(this.inputs[0].focus(),this.inputs[0].select()):n.forEach((c,u)=>{c.index===0&&o.buttons[u].focus()})})}applyStyles(){let e=this.options.dialogStyles,t=e.dialogForeground,o=e.dialogBackground,n=e.dialogShadow?`0 0px 8px ${e.dialogShadow}`:"",r=e.dialogBorder?`1px solid ${e.dialogBorder}`:"",s=e.textLinkForeground;if(this.shadowElement.style.boxShadow=n,this.element.style.color=t??"",this.element.style.backgroundColor=o??"",this.element.style.border=r,s)for(let c of[...this.messageContainer.getElementsByTagName("a"),...this.footerContainer?.getElementsByTagName("a")??[]])c.style.color=s;let l;switch(this.options.type){case"none":break;case"error":l=e.errorIconForeground;break;case"warning":l=e.warningIconForeground;break;default:l=e.infoIconForeground;break}l&&(this.iconElement.style.color=l)}dispose(){super.dispose(),this.modalElement&&(this.modalElement.remove(),this.modalElement=void 0),this.focusToReturn&&gs(this.focusToReturn,this.container.ownerDocument.body)&&(this.focusToReturn.focus(),this.focusToReturn=void 0)}rearrangeButtons(e,t){let o=e.map((n,r)=>({label:n,index:r}));if(e.length<2||this.options.alignment===1)return o;if(it||Wn){if(typeof t=="number"&&o[t]){let n=o.splice(t,1)[0];o.splice(1,0,n)}o.reverse()}else if(ri&&typeof t=="number"&&o[t]){let n=o.splice(t,1)[0];o.push(n)}return o}};var ljo=new Set(["workbench.action.quit","workbench.action.reloadWindow","copy","cut","editor.action.selectAll","editor.action.clipboardCopyAction","editor.action.clipboardCutAction","editor.action.clipboardPasteAction"]);function mDe(a,i,e,t,o=ljo){return{keyEventProcessor:n=>{let r=i.softDispatch(n,e.activeContainer);r.kind===2&&r.commandId&&(o.has(r.commandId)||$t.stop(n,!0))},buttonStyles:Ko,checkboxStyles:kf,inputBoxStyles:pl,dialogStyles:C4i,onVisibilityChange:(n,r)=>t.setWindowDimmed(n,r),...a}}var RYe=class extends C{constructor(e,t,o,n,r,s,l,c,u,p){super();this.activityService=e;this.paneCompositeService=t;this.viewDescriptorService=o;this.viewsService=n;this.notificationService=r;this.statusbarService=s;this.layoutService=l;this.keybindingService=c;this.userActivityService=u;this.hostService=p;this.windowProgressStack=[];this.windowProgressStatusEntry=void 0}async withProgress(e,t,o){let{location:n}=e,r=async l=>{let c=this.userActivityService.markActive({extendOnly:!0,whenHeldFor:15e3});try{return await t(l)}finally{c.dispose()}},s=l=>{let c=this.viewDescriptorService.getViewContainerById(l);if(c){let u=this.viewDescriptorService.getViewContainerLocation(c);if(u!==null)return this.withPaneCompositeProgress(l,u,r,{...e,location:l})}if(this.viewDescriptorService.getViewDescriptorById(l)!==null)return this.withViewProgress(l,r,{...e,location:l});throw new Error(`Bad progress location: ${l}`)};if(typeof n=="string")return s(n);switch(n){case 15:{let l=e.priority;return l!==3&&(this.notificationService.getFilter()===1?l=2:C9(e.source)&&this.notificationService.getFilter(e.source)===1&&(l=2)),this.withNotificationProgress({...e,location:n,priority:l},r,o)}case 10:{let l=e.type;return e.command?this.withWindowProgress({...e,location:n,type:l},r):this.withNotificationProgress({delay:150,...e,priority:2,location:15,type:l},r,o)}case 1:return this.withPaneCompositeProgress("workbench.view.explorer",0,r,{...e,location:n});case 3:return s("workbench.scm");case 5:return this.withPaneCompositeProgress("workbench.view.extensions",0,r,{...e,location:n});case 20:return this.withDialogProgress(e,r,o);default:throw new Error(`Bad progress location: ${n}`)}}withWindowProgress(e,t){let o=[e,new bm(()=>this.updateWindowProgress())],n=t(o[1]),r=setTimeout(()=>{r=void 0,this.windowProgressStack.unshift(o),this.updateWindowProgress(),Promise.all([Pi(150),n]).finally(()=>{let s=this.windowProgressStack.indexOf(o);this.windowProgressStack.splice(s,1),this.updateWindowProgress()})},150);return n.finally(()=>clearTimeout(r))}updateWindowProgress(e=0){if(e<this.windowProgressStack.length){let[t,o]=this.windowProgressStack[e],n=t.title,r=o.value?.message,s=t.command,l,c,u=t.source&&typeof t.source!="string"?t.source.label:t.source;if(n&&r)l=d(17182,null,n,r),c=u?d(17184,null,u,n,r):l;else if(n)l=n,c=u?d(17183,null,u,n):l;else if(r)l=r,c=u?d(17183,null,u,r):l;else{this.updateWindowProgress(e+1);return}let p={name:d(17185,null),text:l,showProgress:t.type||!0,ariaLabel:l,tooltip:fu(c).trim(),command:s};this.windowProgressStatusEntry?this.windowProgressStatusEntry.update(p):this.windowProgressStatusEntry=this.statusbarService.addEntry(p,"status.progress",0,-Number.MAX_VALUE)}else this.windowProgressStatusEntry?.dispose(),this.windowProgressStatusEntry=void 0}withNotificationProgress(e,t,o){let n=new class extends C{constructor(){super();this._onDidReport=this._register(new E);this.onDidReport=this._onDidReport.event;this._onWillDispose=this._register(new E);this.onWillDispose=this._onWillDispose.event;this._step=void 0;this._done=!1;this.promise=t(this),this.promise.finally(()=>{this.dispose()})}get step(){return this._step}get done(){return this._done}report(v){this._step=v,this._onDidReport.fire(v)}cancel(v){o?.(v),this.dispose()}dispose(){this._done=!0,this._onWillDispose.fire(),super.dispose()}},r=()=>{let f=new Go;return this.withWindowProgress({location:10,title:e.title?lS(e.title).toString():void 0,command:"notifications.showList",type:e.type},v=>{function b(y){y.message&&v.report({message:lS(y.message).toString()})}n.step&&b(n.step);let S=n.onDidReport(y=>b(y));return f.p.finally(()=>S.dispose()),H.once(n.onWillDispose)(()=>f.complete()),f.p}),Z(()=>f.complete())},s=(f,v,b)=>{let S=new P,y=e.primaryActions?Array.from(e.primaryActions):[],w=e.secondaryActions?Array.from(e.secondaryActions):[];if(e.buttons&&e.buttons.forEach((O,V)=>{let U=new class extends st{constructor(){super(`progress.button.${O}`,O,void 0,!0)}async run(){n.cancel(V)}};S.add(U),y.push(U)}),e.cancellable){let O=new class extends st{constructor(){super("progress.cancel",typeof e.cancellable=="string"?e.cancellable:d(17180,null),void 0,!0)}async run(){n.cancel()}};S.add(O),y.push(O)}let k=this.notificationService.notify({severity:St.Info,message:fu(f),source:e.source,actions:{primary:y,secondary:w},progress:typeof b=="number"&&b>=0?{total:100,worked:b}:{infinite:!0},priority:v}),T,N=O=>{Ue(T),!O&&!n.done&&(T=r())};return S.add(k.onDidChangeVisibility(N)),v===2&&N(!1),H.once(k.onDidClose)(()=>{S.dispose(),Ue(T)}),k},l=(f,v)=>{typeof v=="number"&&v>=0?(f.progress.total(100),f.progress.worked(v)):f.progress.infinite()},c,u,p,h=f=>{f?.message&&e.title?p=`${e.title}: ${f.message}`:p=e.title||f?.message,!c&&p&&(typeof e.delay=="number"&&e.delay>0?u===void 0&&(u=setTimeout(()=>c=s(p,e.priority,f?.increment),e.delay)):c=s(p,e.priority,f?.increment)),c&&(p&&c.updateMessage(p),typeof f?.increment=="number"&&l(c,f.increment))};h(n.step);let g=n.onDidReport(f=>h(f));return H.once(n.onWillDispose)(()=>g.dispose()),(async()=>{try{typeof e.delay=="number"&&e.delay>0?await n.promise:await Promise.all([Pi(800),n.promise])}finally{clearTimeout(u),c?.close()}})(),n.promise}withPaneCompositeProgress(e,t,o,n){let r=this.paneCompositeService.getProgressIndicator(e,t),s=r?this.withCompositeProgress(r,o,n):o({report:()=>{}});return t===0&&this.showOnActivityBar(e,n,s),s}withViewProgress(e,t,o){let n=this.viewsService.getViewProgressIndicator(e),r=n?this.withCompositeProgress(n,t,o):t({report:()=>{}}),s=this.viewDescriptorService.getViewContainerByViewId(e)?.id;return s===void 0||this.showOnActivityBar(s,o,r),r}showOnActivityBar(e,t,o){let n,r=setTimeout(()=>{r=void 0;let s=this.activityService.showViewContainerActivity(e,{badge:new PC(()=>"")}),l=Date.now(),c=300;n={dispose(){let u=Date.now()-l;u<c?setTimeout(()=>s.dispose(),c-u):s.dispose()}}},t.delay||300);o.finally(()=>{clearTimeout(r),Ue(n)})}withCompositeProgress(e,t,o){let n;function r(l){let c,u;return typeof l<"u"&&(typeof l=="number"?c=l:typeof l.increment=="number"&&(c=l.total??100,u=l.increment)),typeof c=="number"?(n||(n=e.show(c,o.delay),s.catch(()=>{}).finally(()=>n?.done())),typeof u=="number"&&n.worked(u)):(n?.done(),e.showWhile(s,o.delay)),n}let s=t({report:l=>{r(l)}});return r(o.total),s}withDialogProgress(e,t,o){let n=new P,r,s=!1,l=f=>{let v=e.buttons||[];return e.sticky||v.push(e.cancellable?typeof e.cancellable=="boolean"?d(17180,null):e.cancellable:d(17181,null)),r=new PJ(this.layoutService.activeContainer,f,v,mDe({type:"pending",detail:e.detail,cancelId:v.length-1,disableCloseAction:e.sticky,disableDefaultAction:e.sticky},this.keybindingService,this.layoutService,this.hostService)),n.add(r),r.show().then(b=>{s||o?.(b.button),Ue(r)}),r},c=e.delay??0,u,p=n.add(new Dt(()=>{c=0,u&&!r?r=l(u):u&&r.updateMessage(u)},0)),h=function(f){u=f,p.isScheduled()||p.schedule(c)},g=t({report:f=>{h(f.message)}});return g.finally(()=>{s=!0,Ue(n)}),e.title&&h(e.title),g}};RYe=I([m(0,zl),m(1,ds),m(2,Ri),m(3,Ft),m(4,Ne),m(5,Tr),m(6,nc),m(7,_e),m(8,Cde),m(9,oi)],RYe);we(Bo,RYe,1);var hDe=class extends C{constructor(e){super();this._themeService=e;this._onWillCreateCodeEditor=this._register(new E);this.onWillCreateCodeEditor=this._onWillCreateCodeEditor.event;this._onCodeEditorAdd=this._register(new E);this.onCodeEditorAdd=this._onCodeEditorAdd.event;this._onCodeEditorRemove=this._register(new E);this.onCodeEditorRemove=this._onCodeEditorRemove.event;this._onWillCreateDiffEditor=this._register(new E);this.onWillCreateDiffEditor=this._onWillCreateDiffEditor.event;this._onDiffEditorAdd=this._register(new E);this.onDiffEditorAdd=this._onDiffEditorAdd.event;this._onDiffEditorRemove=this._register(new E);this.onDiffEditorRemove=this._onDiffEditorRemove.event;this._onDidChangeTransientModelProperty=this._register(new E);this.onDidChangeTransientModelProperty=this._onDidChangeTransientModelProperty.event;this._onDecorationTypeRegistered=this._register(new E);this.onDecorationTypeRegistered=this._onDecorationTypeRegistered.event;this._decorationOptionProviders=new Map;this._editorStyleSheets=new Map;this._codeEditorOpenHandlers=new Vs;this._transientWatchers=this._register(new jt);this._modelProperties=new Map;this._codeEditors=Object.create(null),this._diffEditors=Object.create(null),this._globalStyleSheet=null}willCreateCodeEditor(){this._onWillCreateCodeEditor.fire()}addCodeEditor(e){this._codeEditors[e.getId()]=e,this._onCodeEditorAdd.fire(e)}removeCodeEditor(e){delete this._codeEditors[e.getId()]&&this._onCodeEditorRemove.fire(e)}listCodeEditors(){return Object.keys(this._codeEditors).map(e=>this._codeEditors[e])}willCreateDiffEditor(){this._onWillCreateDiffEditor.fire()}addDiffEditor(e){this._diffEditors[e.getId()]=e,this._onDiffEditorAdd.fire(e)}removeDiffEditor(e){delete this._diffEditors[e.getId()]&&this._onDiffEditorRemove.fire(e)}listDiffEditors(){return Object.keys(this._diffEditors).map(e=>this._diffEditors[e])}getFocusedCodeEditor(){let e=null,t=this.listCodeEditors();for(let o of t){if(o.hasTextFocus())return o;o.hasWidgetFocus()&&(e=o)}return e}_getOrCreateGlobalStyleSheet(){return this._globalStyleSheet||(this._globalStyleSheet=this._createGlobalStyleSheet()),this._globalStyleSheet}_createGlobalStyleSheet(){return new Cbi(hr())}_getOrCreateStyleSheet(e){if(!e)return this._getOrCreateGlobalStyleSheet();let t=e.getContainerDomNode();if(!x$(t))return this._getOrCreateGlobalStyleSheet();let o=e.getId();if(!this._editorStyleSheets.has(o)){let n=new wbi(this,o,hr(t));this._editorStyleSheets.set(o,n)}return this._editorStyleSheets.get(o)}_removeEditorStyleSheets(e){this._editorStyleSheets.delete(e)}registerDecorationType(e,t,o,n,r){let s=this._decorationOptionProviders.get(t);if(!s){let l=this._getOrCreateStyleSheet(r),c={styleSheet:l,key:t,parentTypeKey:n,options:o||Object.create(null)};n?s=new xbi(this._themeService,l,c):s=new kbi(e,this._themeService,l,c),this._decorationOptionProviders.set(t,s),this._onDecorationTypeRegistered.fire(t)}return s.refCount++,{dispose:()=>{this.removeDecorationType(t)}}}listDecorationTypes(){return Array.from(this._decorationOptionProviders.keys())}removeDecorationType(e){let t=this._decorationOptionProviders.get(e);t&&(t.refCount--,t.refCount<=0&&(this._decorationOptionProviders.delete(e),t.dispose(),this.listCodeEditors().forEach(o=>o.removeDecorationsByType(e))))}resolveDecorationOptions(e,t){let o=this._decorationOptionProviders.get(e);if(!o)throw new Error("Unknown decoration type key: "+e);return o.getOptions(this,t)}resolveDecorationCSSRules(e){let t=this._decorationOptionProviders.get(e);return t?t.resolveDecorationCSSRules():null}setModelProperty(e,t,o){let n=e.toString(),r;this._modelProperties.has(n)?r=this._modelProperties.get(n):(r=new Map,this._modelProperties.set(n,r)),r.set(t,o)}getModelProperty(e,t){let o=e.toString();if(this._modelProperties.has(o))return this._modelProperties.get(o).get(t)}setTransientModelProperty(e,t,o){let n=e.uri.toString(),r=this._transientWatchers.get(n);r||(r=new ybi(n,e,this),this._transientWatchers.set(n,r)),r.get(t)!==o&&(r.set(t,o),this._onDidChangeTransientModelProperty.fire(e))}getTransientModelProperty(e,t){let o=e.uri.toString(),n=this._transientWatchers.get(o);if(n)return n.get(t)}getTransientModelProperties(e){let t=e.uri.toString(),o=this._transientWatchers.get(t);if(o)return o.keys().map(n=>[n,o.get(n)])}_removeWatcher(e){this._transientWatchers.deleteAndDispose(e.uri)}async openCodeEditor(e,t,o){for(let n of this._codeEditorOpenHandlers){let r=await n(e,t,o);if(r!==null)return r}return null}registerCodeEditorOpenHandler(e){let t=this._codeEditorOpenHandlers.unshift(e);return Z(t)}};hDe=I([m(0,De)],hDe);var ybi=class extends C{constructor(i,e,t){super(),this.uri=i,this._values={},this._register(e.onWillDispose(()=>t._removeWatcher(this)))}set(i,e){this._values[i]=e}get(i){return this._values[i]}keys(){return Object.keys(this._values)}},wbi=class{get sheet(){return this._styleSheet.sheet}constructor(i,e,t){this._parent=i,this._editorId=e,this._styleSheet=t,this._refCount=0}ref(){this._refCount++}unref(){this._refCount--,this._refCount===0&&(this._styleSheet.remove(),this._parent._removeEditorStyleSheets(this._editorId))}insertRule(i,e){Vh(i,e,this._styleSheet)}removeRulesContainingSelector(i){EN(i,this._styleSheet)}},Cbi=class{get sheet(){return this._styleSheet.sheet}constructor(i){this._styleSheet=i}ref(){}unref(){}insertRule(i,e){Vh(i,e,this._styleSheet)}removeRulesContainingSelector(i){EN(i,this._styleSheet)}},xbi=class{constructor(i,e,t){this._styleSheet=e,this._styleSheet.ref(),this._parentTypeKey=t.parentTypeKey,this.refCount=0,this._beforeContentRules=new gDe(3,t,i),this._afterContentRules=new gDe(4,t,i)}getOptions(i,e){let t=i.resolveDecorationOptions(this._parentTypeKey,!0);return this._beforeContentRules&&(t.beforeContentClassName=this._beforeContentRules.className),this._afterContentRules&&(t.afterContentClassName=this._afterContentRules.className),t}resolveDecorationCSSRules(){return this._styleSheet.sheet.cssRules}dispose(){this._beforeContentRules&&(this._beforeContentRules.dispose(),this._beforeContentRules=null),this._afterContentRules&&(this._afterContentRules.dispose(),this._afterContentRules=null),this._styleSheet.unref()}},kbi=class{constructor(i,e,t,o){this._disposables=new P;this.description=i,this._styleSheet=t,this._styleSheet.ref(),this.refCount=0;let n=p=>{let h=new gDe(p,o,e);if(this._disposables.add(h),h.hasContent)return h.className},r=p=>{let h=new gDe(p,o,e);return this._disposables.add(h),h.hasContent?{className:h.className,hasLetterSpacing:h.hasLetterSpacing}:null};this.className=n(0);let s=r(1);if(s&&(this.inlineClassName=s.className,this.inlineClassNameAffectsLetterSpacing=s.hasLetterSpacing),this.beforeContentClassName=n(3),this.afterContentClassName=n(4),o.options.beforeInjectedText&&o.options.beforeInjectedText.contentText){let p=r(5);this.beforeInjectedText={content:o.options.beforeInjectedText.contentText,inlineClassName:p?.className,inlineClassNameAffectsLetterSpacing:p?.hasLetterSpacing||o.options.beforeInjectedText.affectsLetterSpacing}}if(o.options.afterInjectedText&&o.options.afterInjectedText.contentText){let p=r(6);this.afterInjectedText={content:o.options.afterInjectedText.contentText,inlineClassName:p?.className,inlineClassNameAffectsLetterSpacing:p?.hasLetterSpacing||o.options.afterInjectedText.affectsLetterSpacing}}this.glyphMarginClassName=n(2);let l=o.options;this.isWholeLine=!!l.isWholeLine,this.lineHeight=l.lineHeight,this.fontFamily=l.fontFamily,this.fontSize=l.fontSize,this.fontWeight=l.fontWeight,this.fontStyle=l.fontStyle,this.stickiness=l.rangeBehavior;let c=l.light&&l.light.overviewRulerColor||l.overviewRulerColor,u=l.dark&&l.dark.overviewRulerColor||l.overviewRulerColor;(typeof c<"u"||typeof u<"u")&&(this.overviewRuler={color:c||u,darkColor:u||c,position:l.overviewRulerLane||2})}getOptions(i,e){return e?{description:this.description,inlineClassName:this.inlineClassName,beforeContentClassName:this.beforeContentClassName,afterContentClassName:this.afterContentClassName,className:this.className,glyphMarginClassName:this.glyphMarginClassName,isWholeLine:this.isWholeLine,lineHeight:this.lineHeight,fontFamily:this.fontFamily,fontSize:this.fontSize,fontWeight:this.fontWeight,fontStyle:this.fontStyle,overviewRuler:this.overviewRuler,stickiness:this.stickiness,before:this.beforeInjectedText,after:this.afterInjectedText}:this}resolveDecorationCSSRules(){return this._styleSheet.sheet.rules}dispose(){this._disposables.dispose(),this._styleSheet.unref()}},MYe={color:"color:{0} !important;",opacity:"opacity:{0};",backgroundColor:"background-color:{0};",outline:"outline:{0};",outlineColor:"outline-color:{0};",outlineStyle:"outline-style:{0};",outlineWidth:"outline-width:{0};",border:"border:{0};",borderColor:"border-color:{0};",borderRadius:"border-radius:{0};",borderSpacing:"border-spacing:{0};",borderStyle:"border-style:{0};",borderWidth:"border-width:{0};",fontStyle:"font-style:{0};",fontWeight:"font-weight:{0};",fontSize:"font-size:{0};",fontFamily:"font-family:{0};",textDecoration:"text-decoration:{0};",cursor:"cursor:{0};",letterSpacing:"letter-spacing:{0};",gutterIconPath:"background:{0} center center no-repeat;",gutterIconSize:"background-size:{0};",contentText:"content:'{0}';",contentIconPath:"content:{0};",margin:"margin:{0};",padding:"padding:{0};",width:"width:{0};",height:"height:{0};",verticalAlign:"vertical-align:{0};"},gDe=class{constructor(i,e,t){this._theme=t.getColorTheme(),this._ruleType=i,this._providerArgs=e,this._usesThemeColors=!1,this._hasContent=!1,this._hasLetterSpacing=!1;let o=PYe.getClassName(this._providerArgs.key,i);this._providerArgs.parentTypeKey&&(o=o+" "+PYe.getClassName(this._providerArgs.parentTypeKey,i)),this._className=o,this._unThemedSelector=PYe.getSelector(this._providerArgs.key,this._providerArgs.parentTypeKey,i),this._buildCSS(),this._usesThemeColors?this._themeListener=t.onDidColorThemeChange(n=>{this._theme=t.getColorTheme(),this._removeCSS(),this._buildCSS()}):this._themeListener=null}dispose(){this._hasContent&&(this._removeCSS(),this._hasContent=!1),this._themeListener&&(this._themeListener.dispose(),this._themeListener=null)}get hasContent(){return this._hasContent}get hasLetterSpacing(){return this._hasLetterSpacing}get className(){return this._className}_buildCSS(){let i=this._providerArgs.options,e,t,o;switch(this._ruleType){case 0:e=this.getCSSTextForModelDecorationClassName(i),t=this.getCSSTextForModelDecorationClassName(i.light),o=this.getCSSTextForModelDecorationClassName(i.dark);break;case 1:e=this.getCSSTextForModelDecorationInlineClassName(i),t=this.getCSSTextForModelDecorationInlineClassName(i.light),o=this.getCSSTextForModelDecorationInlineClassName(i.dark);break;case 2:e=this.getCSSTextForModelDecorationGlyphMarginClassName(i),t=this.getCSSTextForModelDecorationGlyphMarginClassName(i.light),o=this.getCSSTextForModelDecorationGlyphMarginClassName(i.dark);break;case 3:e=this.getCSSTextForModelDecorationContentClassName(i.before),t=this.getCSSTextForModelDecorationContentClassName(i.light&&i.light.before),o=this.getCSSTextForModelDecorationContentClassName(i.dark&&i.dark.before);break;case 4:e=this.getCSSTextForModelDecorationContentClassName(i.after),t=this.getCSSTextForModelDecorationContentClassName(i.light&&i.light.after),o=this.getCSSTextForModelDecorationContentClassName(i.dark&&i.dark.after);break;case 5:e=this.getCSSTextForModelDecorationContentClassName(i.beforeInjectedText),t=this.getCSSTextForModelDecorationContentClassName(i.light&&i.light.beforeInjectedText),o=this.getCSSTextForModelDecorationContentClassName(i.dark&&i.dark.beforeInjectedText);break;case 6:e=this.getCSSTextForModelDecorationContentClassName(i.afterInjectedText),t=this.getCSSTextForModelDecorationContentClassName(i.light&&i.light.afterInjectedText),o=this.getCSSTextForModelDecorationContentClassName(i.dark&&i.dark.afterInjectedText);break;default:throw new Error("Unknown rule type: "+this._ruleType)}let n=this._providerArgs.styleSheet,r=!1;e.length>0&&(n.insertRule(this._unThemedSelector,e),r=!0),t.length>0&&(n.insertRule(`.vs${this._unThemedSelector}, .hc-light${this._unThemedSelector}`,t),r=!0),o.length>0&&(n.insertRule(`.vs-dark${this._unThemedSelector}, .hc-black${this._unThemedSelector}`,o),r=!0),this._hasContent=r}_removeCSS(){this._providerArgs.styleSheet.removeRulesContainingSelector(this._unThemedSelector)}getCSSTextForModelDecorationClassName(i){if(!i)return"";let e=[];return this.collectCSSText(i,["backgroundColor"],e),this.collectCSSText(i,["outline","outlineColor","outlineStyle","outlineWidth"],e),this.collectBorderSettingsCSSText(i,e),e.join("")}getCSSTextForModelDecorationInlineClassName(i){if(!i)return"";let e=[];return this.collectCSSText(i,["fontStyle","fontWeight","fontFamily","fontSize","textDecoration","cursor","color","opacity","letterSpacing"],e),i.letterSpacing&&(this._hasLetterSpacing=!0),e.join("")}getCSSTextForModelDecorationContentClassName(i){if(!i)return"";let e=[];if(typeof i<"u"){if(this.collectBorderSettingsCSSText(i,e),typeof i.contentIconPath<"u"&&e.push(id(MYe.contentIconPath,Na(A.revive(i.contentIconPath)))),typeof i.contentText=="string"){let o=i.contentText.match(/^.*$/m)[0].replace(/['\\]/g,"\\$&");e.push(id(MYe.contentText,o))}this.collectCSSText(i,["verticalAlign","fontStyle","fontWeight","fontSize","fontFamily","textDecoration","color","opacity","backgroundColor","margin","padding"],e),this.collectCSSText(i,["width","height"],e)&&e.push("display:inline-block;")}return e.join("")}getCSSTextForModelDecorationGlyphMarginClassName(i){if(!i)return"";let e=[];return typeof i.gutterIconPath<"u"&&(e.push(id(MYe.gutterIconPath,Na(A.revive(i.gutterIconPath)))),typeof i.gutterIconSize<"u"&&e.push(id(MYe.gutterIconSize,i.gutterIconSize))),e.join("")}collectBorderSettingsCSSText(i,e){return this.collectCSSText(i,["border","borderColor","borderRadius","borderSpacing","borderStyle","borderWidth"],e)?(e.push(id("box-sizing: border-box;")),!0):!1}collectCSSText(i,e,t){let o=t.length;for(let n of e){let r=this.resolveValue(i[n]);typeof r=="string"&&t.push(id(MYe[n],r))}return t.length!==o}resolveValue(i){if(xSe(i)){this._usesThemeColors=!0;let e=this._theme.getColor(i.id);return e?e.toString():"transparent"}return i}};var PYe=class{static getClassName(i,e){return"ced-"+i+"-"+e}static getSelector(i,e,t){let o=".monaco-editor ."+this.getClassName(i,t);return e&&(o=o+"."+this.getClassName(e,t)),t===3?o+="::before":t===4&&(o+="::after"),o}};var AYe=class extends hDe{constructor(e,t,o){super(t);this.editorService=e;this.configurationService=o;this._register(this.registerCodeEditorOpenHandler(this.doOpenCodeEditor.bind(this))),this._register(this.registerCodeEditorOpenHandler(this.doOpenCodeEditorFromDiff.bind(this)))}getActiveCodeEditor(){let e=this.editorService.activeTextEditorControl;if(pn(e))return e;if(Ec(e))return e.getModifiedEditor();let t=this.editorService.activeEditorPane?.getControl();return MU(t)&&pn(t.activeCodeEditor)?t.activeCodeEditor:null}async doOpenCodeEditorFromDiff(e,t,o){let n=this.editorService.activeTextEditorControl;if(!o&&Ec(n)&&e.options&&e.resource&&t===n.getModifiedEditor()&&n.getModel()&&Xe(e.resource,n.getModel()?.modified.uri)){let r=n.getModifiedEditor();return QE(e.options,r,0),r}return null}async doOpenCodeEditor(e,t,o){if(!this.configurationService.getValue().workbench?.editor?.enablePreviewFromCodeNavigation&&t&&!e.options?.pinned&&!o&&!Xe(t.getModel()?.uri,e.resource)){for(let s of this.editorService.visibleEditorPanes)if(ca(s.getControl())===t){s.group.pinEditor();break}}let r=await this.editorService.openEditor(e,o?vn:Un);if(r){let s=r.getControl();if(pn(s))return s;if(MU(s)&&pn(s.activeCodeEditor))return s.activeCodeEditor}return null}};AYe=I([m(0,ee),m(1,De),m(2,B)],AYe);we(Kt,AYe,1);var zf=ae("jsonEditingService");var DOt=class extends Error{constructor(e,t){super(e);this.code=t}};var IK=class{constructor(i,e,t,o,n,r,s){this._resolvedKeybindingItemBrand=void 0;this.resolvedKeybinding=i,this.chords=i?fDe(i.getDispatchChords()):[],i&&this.chords.length===0&&(this.chords=fDe(i.getSingleModifierDispatchChords())),this.bubble=e?e.charCodeAt(0)===94:!1,this.command=this.bubble?e.substr(1):e,this.commandArgs=t,this.when=o,this.isDefault=n,this.extensionId=r,this.isBuiltinExtension=s}};function fDe(a){let i=[];for(let e=0,t=a.length;e<t;e++){let o=a[e];if(!o)return[];i.push(o)}return i}function LOt(a){let i=[],e=new Map,t=(o,n)=>{if(!e.has(o)&&(e.set(o,!0),!(o[0]==="_"||o.indexOf("vscode.")===0)&&a.get(o)!==!0)){if(!n){let r=qe.getCommand(o);if(r&&typeof r.metadata=="object"&&dr(r.metadata.args))return}i.push(o)}};for(let o of fe.getMenuItems(D.CommandPalette))Kk(o)&&t(o.command.id,!0);for(let o of aa.getEditorActions())t(o.id,!0);for(let o of qe.getCommands().keys())t(o,!1);return i}var e4="keybinding.entry.template",Ano=d(17135,null),Nno=d(17136,null),Ono=d(17139,null);function Vno(a,i){let e=i?` +when:${i}`:"";return`@command:${a}${e}`}var cjo=GN(z9,Gy),djo=/@command:\s*([^\+]+)/i,ujo=/\+when:\s*(.+)/i,Fno=/@source:\s*(user|default|system|extension)/i,Wno=/@ext:\s*((".+")|([^\s]+))/i,pjo=/@keybinding:\s*((\".+\")|(\S+))/i,dk=class extends gg{constructor(e,t,o){super();this.keybindingsService=t;this.extensionService=o;this._keybindingItems=[],this._keybindingItemsSortedByPrecedence=[],this.modifierLabels={ui:YN.modifierLabels[e],aria:_St.modifierLabels[e],user:Xye.modifierLabels[e]}}fetch(e,t=!1){let o=t?this._keybindingItemsSortedByPrecedence:this._keybindingItems,n=djo.exec(e);if(n&&n[1]){let r=n[1].trim(),s=o.filter(l=>l.command===r);if(s.length){let l=ujo.exec(e);if(l&&l[1]){let c=l[1].trim();s=this.filterByWhen(s,r,c)}}return s.map(l=>({id:dk.getId(l),keybindingItem:l,templateId:e4}))}if(Fno.test(e))o=this.filterBySource(o,e),e=e.replace(Fno,"");else{let r=Wno.exec(e);if(r&&(r[2]||r[3])){let s=r[2]?r[2].substring(1,r[2].length-1):r[3];o=this.filterByExtension(o,s),e=e.replace(Wno,"")}else{let s=pjo.exec(e);s&&(s[2]||s[3])&&(e=s[2]||`"${s[3]}"`)}}return e=e.trim(),e?this.filterByText(o,e):o.map(r=>({id:dk.getId(r),keybindingItem:r,templateId:e4}))}filterBySource(e,t){return/@source:\s*default/i.test(t)||/@source:\s*system/i.test(t)?e.filter(o=>o.source===Ano):/@source:\s*user/i.test(t)?e.filter(o=>o.source===Ono):/@source:\s*extension/i.test(t)?e.filter(o=>!Ae(o.source)||o.source===Nno):e}filterByExtension(e,t){return t=t.toLowerCase().trim(),e.filter(o=>!Ae(o.source)&&(Ei.equals(o.source.identifier,t)||o.source.displayName?.toLowerCase()===t.toLowerCase()))}filterByText(e,t){let o=t.charAt(0)==='"',n=t.charAt(t.length-1)==='"',r=o&&n;o&&(t=t.substring(1)),n&&(t=t.substring(0,t.length-1)),t=t.trim();let s=[],l=t.split(" "),c=this.splitKeybindingWords(l);for(let u of e){let p=new Ebi(this.modifierLabels,u,t,l,c,r);(p.commandIdMatches||p.commandLabelMatches||p.commandDefaultLabelMatches||p.sourceMatches||p.whenMatches||p.keybindingMatches||p.extensionIdMatches||p.extensionLabelMatches)&&s.push({id:dk.getId(u),templateId:e4,commandLabelMatches:p.commandLabelMatches||void 0,commandDefaultLabelMatches:p.commandDefaultLabelMatches||void 0,keybindingItem:u,keybindingMatches:p.keybindingMatches||void 0,commandIdMatches:p.commandIdMatches||void 0,sourceMatches:p.sourceMatches||void 0,whenMatches:p.whenMatches||void 0,extensionIdMatches:p.extensionIdMatches||void 0,extensionLabelMatches:p.extensionLabelMatches||void 0})}return s}filterByWhen(e,t,o){if(e.length===0)return[];let n=e.filter(c=>c.when===o);if(n.length)return n;let r=e[0].commandLabel,s=new IK(void 0,t,null,x.deserialize(o),!1,null,!1),l=new Map([[t,r]]);return[dk.toKeybindingEntry(t,s,l,this.getExtensionsMapping())]}splitKeybindingWords(e){let t=[];for(let o of e)t.push(...si(o.split("+")));return t}async resolve(e=new Map){let t=this.getExtensionsMapping();this._keybindingItemsSortedByPrecedence=[];let o=new Map;for(let r of this.keybindingsService.getKeybindings())r.command&&(this._keybindingItemsSortedByPrecedence.push(dk.toKeybindingEntry(r.command,r,e,t)),o.set(r.command,!0));let n=this.keybindingsService.getDefaultKeybindings().map(r=>r.command);for(let r of LOt(o)){let s=new IK(void 0,r,null,void 0,n.indexOf(r)===-1,null,!1);this._keybindingItemsSortedByPrecedence.push(dk.toKeybindingEntry(r,s,e,t))}return this._keybindingItemsSortedByPrecedence=Uo(this._keybindingItemsSortedByPrecedence,r=>dk.getId(r)),this._keybindingItems=this._keybindingItemsSortedByPrecedence.slice(0).sort((r,s)=>dk.compareKeybindingData(r,s)),super.resolve()}static getId(e){return e.command+(e?.keybinding?.getAriaLabel()??"")+e.when+(Ae(e.source)?e.source:e.source.identifier.value)}getExtensionsMapping(){let e=new Fd;for(let t of this.extensionService.extensions)e.set(t.identifier,t);return e}static compareKeybindingData(e,t){return e.keybinding&&!t.keybinding?-1:t.keybinding&&!e.keybinding?1:e.commandLabel&&!t.commandLabel?-1:t.commandLabel&&!e.commandLabel?1:e.commandLabel&&t.commandLabel&&e.commandLabel!==t.commandLabel?e.commandLabel.localeCompare(t.commandLabel):e.command===t.command?e.keybindingItem.isDefault?1:-1:e.command.localeCompare(t.command)}static toKeybindingEntry(e,t,o,n){let r=fe.getCommand(e),s=o.get(e),l=Ono;if(t.isDefault){let c=t.extensionId??(t.resolvedKeybinding?void 0:r?.source?.id);l=c?n.get(c)??Nno:Ano}return{keybinding:t.resolvedKeybinding,keybindingItem:t,command:e,commandLabel:dk.getCommandLabel(r,s),commandDefaultLabel:dk.getCommandDefaultLabel(r),when:t.when?t.when.serialize():"",source:l}}static getCommandDefaultLabel(e){if(!IS.isDefaultVariant()&&e&&e.title&&e.title.original){let t=e.category?e.category.original:void 0,o=e.title.original;return t?d(17134,null,t,o):o}return null}static getCommandLabel(e,t){if(e){let o=e.category?typeof e.category=="string"?e.category:e.category.value:void 0,n=typeof e.title=="string"?e.title:e.title.value;return o?d(17134,null,o,n):n}return t||""}};dk=I([m(1,_e),m(2,lt)],dk);var Ebi=class{constructor(i,e,t,o,n,r){this.modifierLabels=i;this.commandIdMatches=null;this.commandLabelMatches=null;this.commandDefaultLabelMatches=null;this.sourceMatches=null;this.whenMatches=null;this.keybindingMatches=null;this.extensionIdMatches=null;this.extensionLabelMatches=null;r||(this.commandIdMatches=this.matches(t,e.command,GN(Gy,K9),o),this.commandLabelMatches=e.commandLabel?this.matches(t,e.commandLabel,(s,l)=>Gy(s,e.commandLabel,!0),o):null,this.commandDefaultLabelMatches=e.commandDefaultLabel?this.matches(t,e.commandDefaultLabel,(s,l)=>Gy(s,e.commandDefaultLabel,!0),o):null,this.whenMatches=e.when?this.matches(null,e.when,GN(Gy,K9),o):null,Ae(e.source)?this.sourceMatches=this.matches(t,e.source,(s,l)=>Gy(s,e.source,!0),o):this.extensionLabelMatches=e.source.displayName?this.matches(t,e.source.displayName,(s,l)=>Gy(s,e.commandLabel,!0),o):null),this.keybindingMatches=e.keybinding?this.matchesKeybinding(e.keybinding,t,n,r):null}matches(i,e,t,o){let n=i?cjo(i,e):null;return n||(n=this.matchesWords(o,e,t)),n&&(n=this.filterAndSort(n)),n}matchesWords(i,e,t){let o=[];for(let n of i){let r=t(n,e);if(r)o=[...o||[],...r];else{o=null;break}}return o}filterAndSort(i){return Uo(i,(e=>e.start+"."+e.end)).filter(e=>!i.some(t=>!(t.start===e.start&&t.end===e.end)&&t.start<=e.start&&t.end>=e.end)).sort((e,t)=>e.start-t.start)}matchesKeybinding(i,e,t,o){let[n,r]=i.getChords(),s=i.getUserSettingsLabel(),l=i.getAriaLabel(),c=i.getLabel();if(s&&Uw(e,s)===0||l&&Uw(e,l)===0||c&&Uw(e,c)===0)return{firstPart:this.createCompleteMatch(n),chordPart:this.createCompleteMatch(r)};let u={},p={},h=[],g=[],f=[],v=!0;for(let b=0;b<t.length;b++){let S=t[b],y=!1,w=!1;v=v&&!u.keyCode;let k=!p.keyCode;if(v&&(y=this.matchPart(n,u,S,o),u.keyCode)){for(let T of f)g.indexOf(T)===-1&&h.splice(h.indexOf(T),1);p={},f=[],k=!1}k&&(w=this.matchPart(r,p,S,o)),y&&g.push(b),w&&f.push(b),(y||w)&&h.push(b),v=v&&this.isModifier(S)}return h.length!==t.length||o&&(!this.isCompleteMatch(n,u)||!mf(p)&&!this.isCompleteMatch(r,p))?null:this.hasAnyMatch(u)||this.hasAnyMatch(p)?{firstPart:u,chordPart:p}:null}matchPart(i,e,t,o){let n=!1;return this.matchesMetaModifier(i,t)&&(n=!0,e.metaKey=!0),this.matchesCtrlModifier(i,t)&&(n=!0,e.ctrlKey=!0),this.matchesShiftModifier(i,t)&&(n=!0,e.shiftKey=!0),this.matchesAltModifier(i,t)&&(n=!0,e.altKey=!0),this.matchesKeyCode(i,t,o)&&(e.keyCode=!0,n=!0),n}matchesKeyCode(i,e,t){if(!i)return!1;let o=i.keyAriaLabel||"";if(t||o.length===1||e.length===1){if(Uw(o,e)===0)return!0}else if(SW(e,o))return!0;return!1}matchesMetaModifier(i,e){return!i||!i.metaKey?!1:this.wordMatchesMetaModifier(e)}matchesCtrlModifier(i,e){return!i||!i.ctrlKey?!1:this.wordMatchesCtrlModifier(e)}matchesShiftModifier(i,e){return!i||!i.shiftKey?!1:this.wordMatchesShiftModifier(e)}matchesAltModifier(i,e){return!i||!i.altKey?!1:this.wordMatchesAltModifier(e)}hasAnyMatch(i){return!!i.altKey||!!i.ctrlKey||!!i.metaKey||!!i.shiftKey||!!i.keyCode}isCompleteMatch(i,e){return i?!(!e.keyCode||i.metaKey&&!e.metaKey||i.altKey&&!e.altKey||i.ctrlKey&&!e.ctrlKey||i.shiftKey&&!e.shiftKey):!0}createCompleteMatch(i){let e={};return i&&(e.keyCode=!0,i.metaKey&&(e.metaKey=!0),i.altKey&&(e.altKey=!0),i.ctrlKey&&(e.ctrlKey=!0),i.shiftKey&&(e.shiftKey=!0)),e}isModifier(i){return!!(this.wordMatchesAltModifier(i)||this.wordMatchesCtrlModifier(i)||this.wordMatchesMetaModifier(i)||this.wordMatchesShiftModifier(i))}wordMatchesAltModifier(i){return!!(mr(this.modifierLabels.ui.altKey,i)||mr(this.modifierLabels.aria.altKey,i)||mr(this.modifierLabels.user.altKey,i)||mr(d(17138,null),i))}wordMatchesCtrlModifier(i){return!!(mr(this.modifierLabels.ui.ctrlKey,i)||mr(this.modifierLabels.aria.ctrlKey,i)||mr(this.modifierLabels.user.ctrlKey,i))}wordMatchesMetaModifier(i){return!!(mr(this.modifierLabels.ui.metaKey,i)||mr(this.modifierLabels.aria.metaKey,i)||mr(this.modifierLabels.user.metaKey,i)||mr(d(17137,null),i))}wordMatchesShiftModifier(i){return!!(mr(this.modifierLabels.ui.shiftKey,i)||mr(this.modifierLabels.aria.shiftKey,i)||mr(this.modifierLabels.user.shiftKey,i))}};var mjo=Re("keybindings-editor-label-icon",M.keyboard,d(17132,null)),iD=class extends Us{constructor(e){super();this.searchOptions=null;this.resource=void 0;this.keybindingsModel=e.createInstance(dk,zo)}static{this.ID="workbench.input.keybindings"}get typeId(){return iD.ID}getName(){return d(17133,null)}getIcon(){return mjo}async resolve(){return this.keybindingsModel}matches(e){return e instanceof iD}dispose(){this.keybindingsModel.dispose(),super.dispose()}};iD=I([m(0,F)],iD);var hjo=Re("settings-editor-label-icon",M.settings,d(17147,null)),oD=class extends Us{constructor(e){super();this.resource=A.from({scheme:Y.vscodeSettings,path:"settingseditor"});this._settingsModel=e.createSettings2EditorModel()}static{this.ID="workbench.input.settings2"}matches(e){return super.matches(e)||e instanceof oD}get typeId(){return oD.ID}getName(){return d(17146,null)}getIcon(){return hjo}async resolve(){return this._settingsModel}dispose(){this._settingsModel.dispose(),super.dispose()}};oD=I([m(0,Po)],oD);var gjo=Re("preferences-editor-label-icon",M.settings,d(17145,null)),AJ=class a extends Us{constructor(){super(...arguments);this.resource=A.from({scheme:Y.vscodeSettings,path:"preferenceseditor"})}static{this.ID="workbench.input.preferences"}matches(e){return super.matches(e)||e instanceof a}get typeId(){return a.ID}getName(){return d(17144,null)}getIcon(){return gjo}async resolve(){return null}};function vDe(a,...i){return i.some(e=>a.includes(e))}function Bno(a){return a===""||Jn(a)}function Tbi(a){let i=Array.isArray(a.type)?a.type:[a.type],e=vDe(i,"null"),t=(vDe(i,"number")||vDe(i,"integer"))&&(i.length===1||i.length===2&&e),o=bjo(a),n=vjo(a),r=Sjo(a),s=Ijo(a);return l=>{if(e&&Bno(l))return"";let c=[];if(r){let u=r(l);u&&c.push(u)}if(s){let u=s(l);u&&c.push(u)}return a.type==="boolean"&&l!==!0&&l!==!1&&c.push(d(17153,null)),t&&(Bno(l)||typeof l=="boolean"||Array.isArray(l)||isNaN(+l)?c.push(d(17158,null)):c.push(...o.filter(u=>!u.isValid(+l)).map(u=>u.message))),a.type==="string"&&(a.enum&&!SS(a.enum)?c.push(d(17175,null)):Ae(l)?c.push(...n.filter(u=>!u.isValid(l)).map(u=>u.message)):c.push(d(17176,null))),c.length?a.errorMessage?[a.errorMessage,...c].join(" "):c.join(" "):""}}function _bi(a,i){if(typeof i>"u")return;if(!(Array.isArray(i)?i:[i]).some(t=>fjo(a,t)))return d(17150,null,JSON.stringify(i))}function fjo(a,i){let e=typeof a;return i==="boolean"?e==="boolean":i==="object"?a&&!Array.isArray(a)&&e==="object":i==="null"?a===null:i==="array"?Array.isArray(a):i==="string"?e==="string":i==="number"||i==="integer"?e==="number":!0}function MOt(a){try{return new RegExp(a,"u")}catch{try{return new RegExp(a)}catch{return console.error(d(17151,null),a),/.*/}}}function vjo(a){let i=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,e;return typeof a.pattern=="string"&&(e=MOt(a.pattern)),[{enabled:a.maxLength!==void 0,isValid:(t=>t.length<=a.maxLength),message:d(17161,null,a.maxLength)},{enabled:a.minLength!==void 0,isValid:(t=>t.length>=a.minLength),message:d(17163,null,a.minLength)},{enabled:e!==void 0,isValid:(t=>e.test(t)),message:a.patternErrorMessage||d(17168,null,a.pattern)},{enabled:a.format==="color-hex",isValid:(t=>Oe.Format.CSS.parseHex(t)),message:d(17154,null)},{enabled:a.format==="uri"||a.format==="uri-reference",isValid:(t=>!!t.length),message:d(17177,null)},{enabled:a.format==="uri"||a.format==="uri-reference",isValid:(t=>i.test(t)),message:d(17178,null)},{enabled:a.format==="uri",isValid:(t=>{let o=t.match(i);return!!(o&&o[2])}),message:d(17179,null)},{enabled:a.enum!==void 0,isValid:(t=>a.enum.includes(t)),message:d(17159,null,a.enum?a.enum.map(t=>`"${t}"`).join(", "):"[]")}].filter(t=>t.enabled)}function bjo(a){let i=Array.isArray(a.type)?a.type:[a.type],e=vDe(i,"null"),t=vDe(i,"integer")&&(i.length===1||i.length===2&&e);if(!(vDe(i,"number","integer")&&(i.length===1||i.length===2&&e)))return[];let n,r;return typeof a.exclusiveMaximum=="boolean"?n=a.exclusiveMaximum?a.maximum:void 0:n=a.exclusiveMaximum,typeof a.exclusiveMinimum=="boolean"?r=a.exclusiveMinimum?a.minimum:void 0:r=a.exclusiveMinimum,[{enabled:n!==void 0&&(a.maximum===void 0||n<=a.maximum),isValid:(s=>s<n),message:d(17155,null,n)},{enabled:r!==void 0&&(a.minimum===void 0||r>=a.minimum),isValid:(s=>s>r),message:d(17156,null,r)},{enabled:a.maximum!==void 0&&(n===void 0||n>a.maximum),isValid:(s=>s<=a.maximum),message:d(17160,null,a.maximum)},{enabled:a.minimum!==void 0&&(r===void 0||r<a.minimum),isValid:(s=>s>=a.minimum),message:d(17162,null,a.minimum)},{enabled:a.multipleOf!==void 0,isValid:(s=>s%a.multipleOf===0),message:d(17164,null,a.multipleOf)},{enabled:t,isValid:(s=>s%1===0),message:d(17157,null)}].filter(s=>s.enabled)}function Sjo(a){if(a.type==="array"&&a.items&&!Array.isArray(a.items)){let i=a.items;if(i&&!Array.isArray(i.type)){let e=t=>"'"+t+"'";return t=>{if(!t)return null;let o="";if(!Array.isArray(t))return o+=d(17152,null),o+=`
`,o;let n=t;if(a.uniqueItems&&new Set(n).size<n.length&&(o+=d(17174,null),o+=`
`),a.minItems&&n.length<a.minItems&&(o+=d(17173,null,a.minItems),o+=`
`),a.maxItems&&n.length>a.maxItems&&(o+=d(17172,null,a.maxItems),o+=`
`),i.type==="string"){if(!SS(n))return o+=d(17169,null),o+=`
`,o;if(typeof i.pattern=="string"){let s=MOt(i.pattern);n.forEach(l=>{s.test(l)||(o+=i.patternErrorMessage||d(17171,null,e(l),e(i.pattern)))})}let r=i.enum;r&&n.forEach(s=>{r.indexOf(s)===-1&&(o+=d(17170,null,e(s),"["+r.map(e).join(", ")+"]"),o+=`
`)})}else(i.type==="integer"||i.type==="number")&&n.forEach(r=>{let s=ROt(i,r);s&&(o+=`${r}: ${s}
`)});return o}}}return null}function Ijo(a){if(a.type==="object"){let{properties:i,patternProperties:e,additionalProperties:t,propertyNames:o}=a;return n=>{if(!n)return null;let r=[],s=!1;return yi(n)?Object.keys(n).forEach(l=>{let c=n[l];if(o?.pattern&&!s&&!MOt(o.pattern).test(l)){let p=o.patternErrorMessage||d(17167,null,o.pattern);r.push(p+`
`),s=!0}if(i&&l in i){let u=ROt(i[l],c);u&&r.push(`${l}: ${u}
`);return}if(e){for(let u in e)if(RegExp(u).test(l)){let p=ROt(e[u],c);p&&r.push(`${l}: ${p}
`);return}}if(t===!1)r.push(d(17166,null,l));else if(typeof t=="object"){let u=ROt(t,c);u&&r.push(`${l}: ${u}
`)}}):r.push(d(17165,null)),r.length?a.errorMessage?[a.errorMessage,...r].join(" "):r.join(" "):""}}return null}function Hno(a,i){return a?.pattern?MOt(a.pattern).test(i):!0}function ROt(a,i){return Tbi(a)(i)}var wg={startLineNumber:-1,startColumn:-1,endLineNumber:-1,endColumn:-1};function Dbi(a){return a.startLineNumber===-1&&a.startColumn===-1&&a.endLineNumber===-1&&a.endColumn===-1}var NYe=class extends gg{constructor(){super(...arguments);this._currentResultGroups=new Map}updateResultGroup(e,t){return t?this._currentResultGroups.set(e,t):this._currentResultGroups.delete(e),this.removeDuplicateResults(),this.update()}removeDuplicateResults(){let e=new Set;[...this._currentResultGroups.keys()].sort((t,o)=>this._currentResultGroups.get(t).order-this._currentResultGroups.get(o).order).forEach(t=>{let o=this._currentResultGroups.get(t);o.result.filterMatches=o.result.filterMatches.filter(n=>!e.has(n.setting.key)),o.result.filterMatches.forEach(n=>e.add(n.setting.key))})}filterSettings(e,t,o){let n=this.filterGroups,r=[];for(let s of n){let l=t(s);for(let c of s.sections)for(let u of c.settings){let p=o(u,s);(l||p)&&r.push({setting:u,matches:p&&p.matches,matchType:p?.matchType??0,keyMatchScore:p?.keyMatchScore??0,score:p?.score??0})}}return r}getPreference(e){for(let t of this.settingsGroups)for(let o of t.sections)for(let n of o.settings)if(e===n.key)return n}collectMetadata(e){let t=Object.create(null),o=!1;return e.forEach(n=>{n.result.metadata&&(t[n.id]=n.result.metadata,o=!0)}),o?t:null}get filterGroups(){return this.settingsGroups}},Pue=class extends NYe{constructor(e,t){super();this._configurationTarget=t;this._onDidChangeGroups=this._register(new E);this.onDidChangeGroups=this._onDidChangeGroups.event;this.settingsModel=e.object.textEditorModel,this._register(this.onWillDispose(()=>e.dispose())),this._register(this.settingsModel.onDidChangeContent(()=>{this._settingsGroups=void 0,this._onDidChangeGroups.fire()}))}get uri(){return this.settingsModel.uri}get configurationTarget(){return this._configurationTarget}get settingsGroups(){return this._settingsGroups||this.parse(),this._settingsGroups}get content(){return this.settingsModel.getValue()}isSettingsProperty(e,t){return t.length===0}parse(){this._settingsGroups=Uno(this.settingsModel,(e,t)=>this.isSettingsProperty(e,t))}update(){let e=[...this._currentResultGroups.values()];if(!e.length)return;let t=[],o=[];e.forEach(l=>{l.result.filterMatches.forEach(c=>{t.push(c.setting),c.matches&&o.push(...c.matches)})});let n,r=this.settingsGroups[0];r&&(n={id:r.id,range:r.range,sections:[{settings:t}],title:r.title,titleRange:r.titleRange,order:r.order,extensionInfo:r.extensionInfo});let s=this.collectMetadata(e);return{allGroups:this.settingsGroups,filteredGroups:n?[n]:[],matches:o,metadata:s??void 0}}},NJ=class extends NYe{constructor(e,t){super();this._defaultSettings=e;this._onDidChangeGroups=this._register(new E);this.onDidChangeGroups=this._onDidChangeGroups.event;this.additionalGroups=[];this.dirty=!1;this._register(t.onDidChangeConfiguration(o=>{o.source===7&&(this.dirty=!0,this._onDidChangeGroups.fire())})),this._register(oe.as(ii.Configuration).onDidSchemaChange(o=>{this.dirty=!0,this._onDidChangeGroups.fire()}))}get filterGroups(){return this.settingsGroups.slice(1)}get settingsGroups(){let e=this._defaultSettings.getSettingsGroups(this.dirty);return this.dirty=!1,[...e,...this.additionalGroups]}setAdditionalGroups(e){this.additionalGroups=e}update(){throw new Error("Not supported")}};NJ=I([m(1,B)],NJ);function Uno(a,i){let e=[],t=null,o=null,n=[],r=[],s=-1,l={startLineNumber:0,startColumn:0,endLineNumber:0,endColumn:0};function c(p,h,g){if(Array.isArray(n)?n.push(p):o&&(n[o]=p),r.length===s+1||r.length===s+2&&t!==null){let f=r.length===s+1?e[e.length-1]:t.overrides[t.overrides.length-1];if(f){let v=a.getPositionAt(h),b=a.getPositionAt(h+g);f.value=p,f.valueRange={startLineNumber:v.lineNumber,startColumn:v.column,endLineNumber:b.lineNumber,endColumn:b.column},f.range=Object.assign(f.range,{endLineNumber:b.lineNumber,endColumn:b.column})}}}let u={onObjectBegin:(p,h)=>{if(i(o,r)){s=r.length;let f=a.getPositionAt(p);l.startLineNumber=f.lineNumber,l.startColumn=f.column}let g={};c(g,p,h),n=g,o=null,r.push(n)},onObjectProperty:(p,h,g)=>{if(o=p,r.length===s+1||r.length===s+2&&t!==null){let f=a.getPositionAt(h),v={description:[],descriptionIsMarkdown:!1,key:p,keyRange:{startLineNumber:f.lineNumber,startColumn:f.column+1,endLineNumber:f.lineNumber,endColumn:f.column+g},range:{startLineNumber:f.lineNumber,startColumn:f.column,endLineNumber:0,endColumn:0},value:null,valueRange:wg,descriptionRanges:[],overrides:[],overrideOf:t??void 0};r.length===s+1?(e.push(v),lg.test(p)&&(t=v)):t.overrides.push(v)}},onObjectEnd:(p,h)=>{if(n=r.pop(),s!==-1&&(r.length===s+1||r.length===s+2&&t!==null)){let g=r.length===s+1?e[e.length-1]:t.overrides[t.overrides.length-1];if(g){let f=a.getPositionAt(p+h);g.valueRange=Object.assign(g.valueRange,{endLineNumber:f.lineNumber,endColumn:f.column}),g.range=Object.assign(g.range,{endLineNumber:f.lineNumber,endColumn:f.column})}r.length===s+1&&(t=null)}if(r.length===s){let g=a.getPositionAt(p);l.endLineNumber=g.lineNumber,l.endColumn=g.column,s=-1}},onArrayBegin:(p,h)=>{let g=[];c(g,p,h),r.push(n),n=g,o=null},onArrayEnd:(p,h)=>{if(n=r.pop(),r.length===s+1||r.length===s+2&&t!==null){let g=r.length===s+1?e[e.length-1]:t.overrides[t.overrides.length-1];if(g){let f=a.getPositionAt(p+h);g.valueRange=Object.assign(g.valueRange,{endLineNumber:f.lineNumber,endColumn:f.column}),g.range=Object.assign(g.range,{endLineNumber:f.lineNumber,endColumn:f.column})}}},onLiteralValue:c,onError:p=>{let h=e[e.length-1];h&&(Dbi(h.range)||Dbi(h.keyRange)||Dbi(h.valueRange))&&e.pop()}};return a.isDisposed()||Wx(a.getValue(),u),e.length>0?[{id:a.isDisposed()?"":a.id,sections:[{settings:e}],title:"",titleRange:wg,range:l}]:[]}var Aue=class extends Pue{constructor(){super(...arguments);this._configurationGroups=[]}get configurationGroups(){return this._configurationGroups}parse(){super.parse(),this._configurationGroups=Uno(this.settingsModel,(e,t)=>t.length===0)}isSettingsProperty(e,t){return e==="settings"&&t.length===1}},SDe=class extends C{constructor(e,t,o){super();this._mostCommonlyUsedSettingsKeys=e;this.target=t;this.configurationService=o;this._settingsByName=new Map;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._register(o.onDidChangeConfiguration(n=>{n.source===7&&(this.reset(),this._onDidChange.fire())}))}getContent(e=!1){return(!this._content||e)&&this.initialize(),this._content}getContentWithoutMostCommonlyUsed(e=!1){return(!this._contentWithoutMostCommonlyUsed||e)&&this.initialize(),this._contentWithoutMostCommonlyUsed}getSettingsGroups(e=!1){return(!this._allSettingsGroups||e)&&this.initialize(),this._allSettingsGroups}initialize(){this._allSettingsGroups=this.parse(),this._content=this.toContent(this._allSettingsGroups,0),this._contentWithoutMostCommonlyUsed=this.toContent(this._allSettingsGroups,1)}reset(){this._content=void 0,this._contentWithoutMostCommonlyUsed=void 0,this._allSettingsGroups=void 0}parse(){let e=this.getRegisteredGroups();return this.initAllSettingsMap(e),[this.getMostCommonlyUsedSettings(),...e]}getRegisteredGroups(){let e=oe.as(ii.Configuration),t={...e.getConfigurationProperties()},o=e.getExcludedConfigurationProperties();for(let r of this.configurationService.keys().policy??[]){let s=o[r];s&&(t[r]=s)}let n=this.removeEmptySettingsGroups(this.parseProperties(t).sort(this.compareGroups));return this.sortGroups(n)}sortGroups(e){return e.forEach(t=>{t.sections.forEach(o=>{o.settings.sort((n,r)=>n.key.localeCompare(r.key))})}),e}initAllSettingsMap(e){this._settingsByName=new Map;for(let t of e)for(let o of t.sections)for(let n of o.settings)this._settingsByName.set(n.key,n)}getMostCommonlyUsedSettings(){let e=si(this._mostCommonlyUsedSettingsKeys.map(t=>{let o=this._settingsByName.get(t);return o?{description:o.description,key:o.key,value:o.value,keyRange:wg,range:wg,valueRange:wg,overrides:[],scope:5,type:o.type,enum:o.enum,enumDescriptions:o.enumDescriptions,descriptionRanges:[]}:null}));return{id:"mostCommonlyUsed",range:wg,title:d(17148,null),titleRange:wg,sections:[{settings:e}]}}parseProperties(e){let t=[],o=new Map,n=new Map;for(let[r,s]of Object.entries(e)){if(!s.section)continue;let l;if(s.section.title){let u=o.get(s.section.title);if(u){let p=s.section.extensionInfo?.id;l=u.find(h=>h.extensionInfo?.id===p)}}if(!l&&s.section.id){let u=n.get(s.section.id);if(u){let p=s.section.extensionInfo?.id;l=u.find(h=>h.extensionInfo?.id===p&&!h.title)}if(l&&!l?.title&&s.section.title){l.title=s.section.title;let p=o.get(s.section.title);p?p.push(l):o.set(s.section.title,[l])}}if(!l){if(l={sections:[{title:s.section.title,settings:[]}],id:s.section.id||"",title:s.section.title??"",titleRange:wg,order:s.section.order,range:wg,extensionInfo:Ae(s.source)?void 0:s.source},t.push(l),s.section.title){let u=o.get(s.section.title);u?u.push(l):o.set(s.section.title,[l])}if(s.section.id){let u=n.get(s.section.id);u?u.push(l):n.set(s.section.id,[l])}}let c=this.parseSetting(r,s);c&&l.sections[0].settings.push(c)}return t}removeEmptySettingsGroups(e){let t=[];for(let o of e)o.sections=o.sections.filter(n=>n.settings.length>0),o.sections.length&&t.push(o);return t}parseSetting(e,t){if(!this.matchesScope(t))return;let o=t.default,n=t.markdownDescription||t.description||"";typeof n!="string"&&(n="");let r=n.split(`
`),s=lg.test(e)?this.parseOverrideSettings(t.default):[],l;t.type==="array"&&t.items&&!Array.isArray(t.items)&&t.items.type&&(t.items.enum?l="enum":Array.isArray(t.items.type)||(l=t.items.type));let c=t.type==="object"?t.properties:void 0,u=t.type==="object"?t.patternProperties:void 0,p=t.type==="object"?t.additionalProperties:void 0,h=t.type==="object"?t.propertyNames:void 0,g=t.enum,f=t.markdownEnumDescriptions??t.enumDescriptions,v=!!t.markdownEnumDescriptions;l==="enum"&&!Array.isArray(t.items)&&(g=t.items.enum,f=t.items.markdownEnumDescriptions??t.items.enumDescriptions,v=!!t.items.markdownEnumDescriptions);let b=!1;t.type==="object"&&!t.additionalProperties&&t.properties&&Object.keys(t.properties).length&&(b=Object.keys(t.properties).every(w=>t.properties[w].type==="boolean"));let S=!1;lg.test(e)&&(S=!0);let y;if(!S){let w=t;w&&w.defaultValueSource&&(y=w.defaultValueSource)}return!g&&(t.enumItemLabels||f||v)&&console.error(`The setting ${e} has enum-related fields, but doesn't have an enum field. This setting may render improperly in the Settings editor.`),{key:e,value:o,description:r,descriptionIsMarkdown:!!t.markdownDescription,keywords:t.keywords,range:wg,keyRange:wg,valueRange:wg,descriptionRanges:[],overrides:s,scope:t.scope,type:t.type,arrayItemType:l,objectProperties:c,objectPatternProperties:u,objectAdditionalProperties:p,propertyNames:h,enum:g,enumDescriptions:f,enumDescriptionsAreMarkdown:v,enumItemLabels:t.enumItemLabels,uniqueItems:t.uniqueItems,tags:t.tags,disallowSyncIgnore:t.disallowSyncIgnore,restricted:t.restricted,extensionInfo:Ae(t.source)?void 0:t.source,deprecationMessage:t.markdownDeprecationMessage||t.deprecationMessage,deprecationMessageIsMarkdown:!!t.markdownDeprecationMessage,validator:Tbi(t),allKeysAreBoolean:b,editPresentation:t.editPresentation,order:t.order,nonLanguageSpecificDefaultValueSource:y,isLanguageTagSetting:S,categoryLabel:(Ae(t.source)?void 0:t.source?.id)===t.section?.id?t.title:t.section?.id}}parseOverrideSettings(e){return Object.keys(e).map(t=>({key:t,value:e[t],description:[],descriptionIsMarkdown:!1,range:wg,keyRange:wg,valueRange:wg,descriptionRanges:[],overrides:[]}))}matchesScope(e){return e.scope?this.target===6?sJ.indexOf(e.scope)!==-1:this.target===5?a_e.indexOf(e.scope)!==-1:!0:!0}compareGroups(e,t){if(typeof e?.order!="number")return 1;if(typeof t?.order!="number")return-1;if(e.order===t.order){let o=e.title||"",n=t.title||"";return o.localeCompare(n)}return e.order-t.order}toContent(e,t){let o=new OYe;for(let n=t;n<e.length;n++)o.pushGroup(e[n],n===t,n===e.length-1);return o.getContent()}},IDe=class extends NYe{constructor(e,t,o){super();this._uri=e;this.defaultSettings=o;this._onDidChangeGroups=this._register(new E);this.onDidChangeGroups=this._onDidChangeGroups.event;this._register(o.onDidChange(()=>this._onDidChangeGroups.fire())),this._model=t.object.textEditorModel,this._register(this.onWillDispose(()=>t.dispose()))}get uri(){return this._uri}get target(){return this.defaultSettings.target}get settingsGroups(){return this.defaultSettings.getSettingsGroups()}get filterGroups(){return this.settingsGroups.slice(1)}update(){if(this._model.isDisposed())return;let e=[...this._currentResultGroups.values()].sort((l,c)=>l.order-c.order),t=e.filter(l=>l.result.filterMatches.length),o=this.settingsGroups.at(-1).range.endLineNumber+2,{settingsGroups:n,matches:r}=this.writeResultGroups(t,o),s=this.collectMetadata(e);return e.length?{allGroups:this.settingsGroups,filteredGroups:n,matches:r,metadata:s??void 0}:void 0}writeResultGroups(e,t){let o=t-1,n=new OYe(o),r=[],s=[];e.length&&(n.pushLine(","),e.forEach(g=>{let f=this.getGroup(g);r.push(f),s.push(...this.writeSettingsGroupToBuilder(n,f,g.result.filterMatches))}));let l=n.getContent()+`
`,c=this._model.getLineCount(),u=new Yt(t,1,t,1),p={text:l,forceMoveMarkers:!0,range:new z(t,1,c,1)};this._model.pushEditOperations([u],[p],()=>[u]);let h=Math.min(t+60,this._model.getLineCount());return this._model.tokenization.forceTokenization(h),{matches:s,settingsGroups:r}}writeSettingsGroupToBuilder(e,t,o){return o=o.map(r=>({setting:r.setting,score:r.score,matchType:r.matchType,keyMatchScore:r.keyMatchScore,matches:r.matches&&r.matches.map(s=>new z(s.startLineNumber-r.setting.range.startLineNumber,s.startColumn,s.endLineNumber-r.setting.range.startLineNumber,s.endColumn))})),e.pushGroup(t),o.map(r=>r.matches||[]).flatMap((r,s)=>{let l=t.sections[0].settings[s];return r.map(c=>new z(c.startLineNumber+l.range.startLineNumber,c.startColumn,c.endLineNumber+l.range.startLineNumber,c.endColumn))})}copySetting(e){return{description:e.description,scope:e.scope,type:e.type,enum:e.enum,enumDescriptions:e.enumDescriptions,key:e.key,value:e.value,range:e.range,overrides:[],overrideOf:e.overrideOf,tags:e.tags,deprecationMessage:e.deprecationMessage,keyRange:wg,valueRange:wg,descriptionIsMarkdown:void 0,descriptionRanges:[]}}getPreference(e){for(let t of this.settingsGroups)for(let o of t.sections)for(let n of o.settings)if(n.key===e)return n}getGroup(e){return{id:e.id,range:wg,title:e.label,titleRange:wg,sections:[{settings:e.result.filterMatches.map(t=>this.copySetting(t.setting))}]}}},OYe=class{constructor(i=0){this._rangeOffset=i;this._contentByLines=[]}get lineCountWithOffset(){return this._contentByLines.length+this._rangeOffset}get lastLine(){return this._contentByLines[this._contentByLines.length-1]||""}pushLine(...i){this._contentByLines.push(...i)}pushGroup(i,e,t){this._contentByLines.push(e?"[{":"{");let o=this._pushGroup(i," ");if(o){let n=o.range.endLineNumber-this._rangeOffset,r=this._contentByLines[n-2];this._contentByLines[n-2]=r.substring(0,r.length-1)}this._contentByLines.push(t?"}]":"},")}_pushGroup(i,e){let t=null,o=this.lineCountWithOffset+1;for(let n of i.sections)if(n.title&&this.addDescription([n.title],e,this._contentByLines),n.settings.length)for(let r of n.settings)this.pushSetting(r,e),t=r;return i.range={startLineNumber:o,startColumn:1,endLineNumber:this.lineCountWithOffset,endColumn:this.lastLine.length},t}getContent(){return this._contentByLines.join(`
`)}pushSetting(i,e){let t=this.lineCountWithOffset+1;this.pushSettingDescription(i,e);let o=e,n=JSON.stringify(i.key);o+=n,i.keyRange={startLineNumber:this.lineCountWithOffset+1,startColumn:o.indexOf(i.key)+1,endLineNumber:this.lineCountWithOffset+1,endColumn:i.key.length},o+=": ";let r=this.lineCountWithOffset+1;this.pushValue(i,o,e),i.valueRange={startLineNumber:r,startColumn:o.length+1,endLineNumber:this.lineCountWithOffset,endColumn:this.lastLine.length+1},this._contentByLines[this._contentByLines.length-1]+=",",this._contentByLines.push(""),i.range={startLineNumber:t,startColumn:1,endLineNumber:this.lineCountWithOffset,endColumn:this.lastLine.length}}pushSettingDescription(i,e){let t=r=>r.replace(/`#(.*)#`/g,(s,l)=>`\`${l}\``);i.descriptionRanges=[];let o=e+"// ",n=i.deprecationMessage?.split(/\n/g)??[];for(let r of[...n,...i.description])r=t(r),this._contentByLines.push(o+r),i.descriptionRanges.push({startLineNumber:this.lineCountWithOffset,startColumn:this.lastLine.indexOf(r)+1,endLineNumber:this.lineCountWithOffset,endColumn:this.lastLine.length});i.enum&&i.enumDescriptions?.some(r=>!!r)&&i.enumDescriptions.forEach((r,s)=>{let l=yjo(String(i.enum[s])),c=r?`${l}: ${t(r)}`:l,u=c.split(/\n/g);u[0]=" - "+u[0],this._contentByLines.push(...u.map(p=>`${e}// ${p}`)),i.descriptionRanges.push({startLineNumber:this.lineCountWithOffset,startColumn:this.lastLine.indexOf(c)+1,endLineNumber:this.lineCountWithOffset,endColumn:this.lastLine.length})})}pushValue(i,e,t){let o=JSON.stringify(i.value,null,t);if(o&&typeof i.value=="object")if(i.overrides&&i.overrides.length){this._contentByLines.push(e+" {");for(let s of i.overrides)this.pushSetting(s,t+t),this._contentByLines.pop();let n=i.overrides[i.overrides.length-1],r=this._contentByLines[n.range.endLineNumber-2];this._contentByLines[n.range.endLineNumber-2]=r.substring(0,r.length-1),this._contentByLines.push(t+"}")}else{let n=o.split(`
`);this._contentByLines.push(e+n[0]);for(let r=1;r<n.length;r++)this._contentByLines.push(t+n[r])}else this._contentByLines.push(e+o)}addDescription(i,e,t){for(let o of i)t.push(e+"// "+o)}},Lbi=class extends OYe{constructor(e=" "){super(0);this.indent=e}pushGroup(e){this._pushGroup(e,this.indent)}},POt=class extends C{constructor(e){super();this.defaultSettings=e;this._content=null;this._onDidContentChanged=this._register(new E);this.onDidContentChanged=this._onDidContentChanged.event;this._register(e.onDidChange(()=>{this._content=null,this._onDidContentChanged.fire()}))}get content(){if(this._content===null){let e=new Lbi;e.pushLine("{");for(let t of this.defaultSettings.getRegisteredGroups())e.pushGroup(t);e.pushLine("}"),this._content=e.getContent()}return this._content}};function yjo(a){return a&&a.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}function Mbi(a){return"// "+d(17149,null)+`
`+a.getDefaultKeybindingsContent()}var bDe=class{constructor(i,e){this._uri=i;this.keybindingService=e}get uri(){return this._uri}get content(){return this._content||(this._content=Mbi(this.keybindingService)),this._content}getPreference(){return null}dispose(){}};bDe=I([m(1,_e)],bDe);var wjo=`{
}`,FYe=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T){super();this.editorService=e;this.editorGroupService=t;this.textFileService=o;this.configurationService=n;this.notificationService=r;this.contextService=s;this.instantiationService=l;this.userDataProfileService=c;this.userDataProfilesService=u;this.textModelResolverService=p;this.jsonEditingService=f;this.labelService=v;this.remoteAgentService=b;this.textEditorService=S;this.extensionService=w;this.progressService=k;this.environmentService=T;this._onDispose=this._register(new E);this._onDidDefaultSettingsContentChanged=this._register(new E);this.onDidDefaultSettingsContentChanged=this._onDidDefaultSettingsContentChanged.event;this._requestedDefaultSettings=new Mn;this._settingsGroups=void 0;this._cachedSettingsEditor2Input=void 0;this.defaultKeybindingsResource=A.from({scheme:Y.vscode,authority:"defaultsettings",path:"/keybindings.json"});this.defaultSettingsRawResource=A.from({scheme:Y.vscode,authority:"defaultsettings",path:"/defaultSettings.jsonc"});this._register(h.onDidUpdateKeybindings(()=>{let N=g.getModel(this.defaultKeybindingsResource);N&&g.updateModel(N,Mbi(h))})),this._register(y.registerHandler(this))}get userSettingsResource(){return this.userDataProfileService.currentProfile.settingsResource}get workspaceSettingsResource(){if(this.contextService.getWorkbenchState()===1)return null;let e=this.contextService.getWorkspace();return e.configuration||e.folders[0].toResource(PEe)}createOrGetCachedSettingsEditor2Input(){return(!this._cachedSettingsEditor2Input||this._cachedSettingsEditor2Input.isDisposed())&&(this._cachedSettingsEditor2Input=new oD(this)),this._cachedSettingsEditor2Input}getFolderSettingsResource(e){let t=this.contextService.getWorkspaceFolder(e);return t?t.toResource(PEe):null}hasDefaultSettingsContent(e){return this.isDefaultSettingsResource(e)||Xe(e,this.defaultSettingsRawResource)||Xe(e,this.defaultKeybindingsResource)}getDefaultSettingsContent(e){if(this.isDefaultSettingsResource(e)){let t=this.getConfigurationTargetFromDefaultSettingsResource(e),o=this.getDefaultSettings(t);return this._requestedDefaultSettings.has(e)||(this._register(o.onDidChange(()=>this._onDidDefaultSettingsContentChanged.fire(e))),this._requestedDefaultSettings.add(e)),o.getContentWithoutMostCommonlyUsed(!0)}if(Xe(e,this.defaultSettingsRawResource))return this._defaultRawSettingsEditorModel||(this._defaultRawSettingsEditorModel=this._register(this.instantiationService.createInstance(POt,this.getDefaultSettings(3))),this._register(this._defaultRawSettingsEditorModel.onDidContentChanged(()=>this._onDidDefaultSettingsContentChanged.fire(e)))),this._defaultRawSettingsEditorModel.content;if(Xe(e,this.defaultKeybindingsResource))return this.instantiationService.createInstance(bDe,e).content}async createPreferencesEditorModel(e){if(this.isDefaultSettingsResource(e))return this.createDefaultSettingsEditorModel(e);if(this.userSettingsResource.toString()===e.toString()||this.userDataProfilesService.defaultProfile.settingsResource.toString()===e.toString())return this.createEditableSettingsEditorModel(3,e);let t=await this.getEditableSettingsURI(5);if(t&&t.toString()===e.toString())return this.createEditableSettingsEditorModel(5,t);if(this.contextService.getWorkbenchState()===3){let r=await this.getEditableSettingsURI(6,e);if(r&&r.toString()===e.toString())return this.createEditableSettingsEditorModel(6,e)}let o=await this.remoteAgentService.getEnvironment(),n=o?o.settingsPath:null;return n&&n.toString()===e.toString()?this.createEditableSettingsEditorModel(4,e):null}openRawDefaultSettings(){return this.editorService.openEditor({resource:this.defaultSettingsRawResource})}openRawUserSettings(){return this.editorService.openEditor({resource:this.userSettingsResource})}shouldOpenJsonByDefault(){return this.configurationService.getValue("workbench.settings.editor")==="json"}async openPreferences(){await this.editorService.openEditor(this.instantiationService.createInstance(AJ),void 0,ym)}openSettings(e={}){return e={...e,target:3},e.query&&(e.jsonEditor=!1),this.open(this.userSettingsResource,e)}openLanguageSpecificSettings(e,t={}){return this.shouldOpenJsonByDefault()?(t.query=void 0,t.revealSetting={key:`[${e}]`,edit:!0}):t.query=`@lang:${e}${t.query?` ${t.query}`:""}`,t.target=t.target??3,this.open(this.userSettingsResource,t)}open(e,t){if(t={...t,jsonEditor:t.jsonEditor??this.shouldOpenJsonByDefault()},t.jsonEditor&&t.query&&!t.revealSetting){let o=t.query.trim(),n=o.match(/^@id:(.+)$/),r;n?r=n[1].trim():oe.as(ii.Configuration).getConfigurationProperties()[o.trim()]&&(r=o.trim()),t.query=void 0,r&&(t.revealSetting={key:r})}return t.jsonEditor?this.openSettingsJson(e,t):this.openSettings2(t)}async openSettings2(e){let t=this.createOrGetCachedSettingsEditor2Input();e={...e,focusSearch:!0};let o=this.getEditorGroupFromOptions(e);return this.editorService.openEditor(t,MEe(e),o)}openApplicationSettings(e={}){return e={...e,target:3},this.open(this.userDataProfilesService.defaultProfile.settingsResource,e)}openUserSettings(e={}){return e={...e,target:3},this.open(this.userSettingsResource,e)}async openRemoteSettings(e={}){let t=await this.remoteAgentService.getEnvironment();t&&(e={...e,target:4},this.open(t.settingsPath,e))}openWorkspaceSettings(e={}){return this.workspaceSettingsResource?(e={...e,target:5},this.open(this.workspaceSettingsResource,e)):(this.notificationService.info(d(17143,null)),Promise.reject(null))}async openFolderSettings(e={}){if(e={...e,target:6},!e.folderUri)throw new Error("Missing folder URI");let t=await this.getEditableSettingsURI(6,e.folderUri);if(!t)throw new Error(`Invalid folder URI - ${e.folderUri.toString()}`);return this.open(t,e)}async openGlobalKeybindingSettings(e,t){if(t={pinned:!0,revealIfOpened:!0,...t},e){let o="// "+d(17141,null)+`
[
]`,n=this.userDataProfileService.currentProfile.keybindingsResource,r=!!this.configurationService.getValue("workbench.settings.openDefaultKeybindings");if(await this.createIfNotExists(n,o),r){let s=t.groupId??this.editorGroupService.activeGroup.id,l=this.editorGroupService.addGroup(s,3);await Promise.all([this.editorService.openEditor({resource:this.defaultKeybindingsResource,options:{pinned:!0,preserveFocus:!0,revealIfOpened:!0,override:Ys.id},label:d(17140,null),description:""},s),this.editorService.openEditor({resource:n,options:t},l.id)])}else await this.editorService.openEditor({resource:n,options:t},this.getEditorGroupFromOptions(t))}else{let o=this.getEditorGroupFromOptions(t),n=await this.editorService.openEditor(this.instantiationService.createInstance(iD),{...t},o);t.query&&n.search(t.query)}}openDefaultKeybindingsFile(){return this.editorService.openEditor({resource:this.defaultKeybindingsResource,label:d(17140,null)})}getEditorGroupFromOptions(e){return this.configurationService.getValue("workbench.editor.useModal")!=="off"&&!this.environmentService.enableSmokeTestDriver&&!this.environmentService.extensionTestsLocationURI?ym:e.openToSide?vn:e?.groupId!==void 0?this.editorGroupService.getGroup(e.groupId)??this.editorGroupService.activeGroup:Un}async openSettingsJson(e,t){let o=this.getEditorGroupFromOptions(t),n=await this.doOpenSettingsJson(e,t,o);return n&&t?.revealSetting&&await this.revealSetting(t.revealSetting.key,!!t.revealSetting.edit,n,e),n}async doOpenSettingsJson(e,t,o){let n=!!this.configurationService.getValue(o9e),r=!!this.configurationService.getValue(i9e);if(n||r)return this.doOpenSplitJSON(e,t,o);let s=t?.target??2,l=await this.getOrCreateEditableSettingsEditorInput(s,e);return t={...t,pinned:!0},await this.editorService.openEditor(l,{...MEe(t)},o)}async doOpenSplitJSON(e,t={},o){let n=t.target??2;await this.createSettingsIfNotExists(n,e);let r=this.createSplitJsonEditorInput(n,e);return t={...t,pinned:!0},this.editorService.openEditor(r,MEe(t),o)}createSplitJsonEditorInput(e,t){let o=this.textEditorService.createTextEditor({resource:t}),n=this.textEditorService.createTextEditor({resource:this.getDefaultSettingsResource(e)});return this.instantiationService.createInstance(ga,o.getName(),void 0,n,o)}createSettings2EditorModel(){return this.instantiationService.createInstance(NJ,this.getDefaultSettings(3))}getConfigurationTargetFromDefaultSettingsResource(e){return this.isDefaultWorkspaceSettingsResource(e)?5:this.isDefaultFolderSettingsResource(e)?6:3}isDefaultSettingsResource(e){return this.isDefaultUserSettingsResource(e)||this.isDefaultWorkspaceSettingsResource(e)||this.isDefaultFolderSettingsResource(e)}isDefaultUserSettingsResource(e){return e.authority==="defaultsettings"&&e.scheme===Y.vscode&&!!e.path.match(/\/(\d+\/)?settings\.json$/)}isDefaultWorkspaceSettingsResource(e){return e.authority==="defaultsettings"&&e.scheme===Y.vscode&&!!e.path.match(/\/(\d+\/)?workspaceSettings\.json$/)}isDefaultFolderSettingsResource(e){return e.authority==="defaultsettings"&&e.scheme===Y.vscode&&!!e.path.match(/\/(\d+\/)?resourceSettings\.json$/)}getDefaultSettingsResource(e){switch(e){case 5:return A.from({scheme:Y.vscode,authority:"defaultsettings",path:"/workspaceSettings.json"});case 6:return A.from({scheme:Y.vscode,authority:"defaultsettings",path:"/resourceSettings.json"})}return A.from({scheme:Y.vscode,authority:"defaultsettings",path:"/settings.json"})}async getOrCreateEditableSettingsEditorInput(e,t){return await this.createSettingsIfNotExists(e,t),this.textEditorService.createTextEditor({resource:t})}async createEditableSettingsEditorModel(e,t){let o=this.contextService.getWorkspace();if(o.configuration&&o.configuration.toString()===t.toString()){let r=await this.textModelResolverService.createModelReference(t);return this.instantiationService.createInstance(Aue,r,e)}let n=await this.textModelResolverService.createModelReference(t);return this.instantiationService.createInstance(Pue,n,e)}async createDefaultSettingsEditorModel(e){let t=await this.textModelResolverService.createModelReference(e),o=this.getConfigurationTargetFromDefaultSettingsResource(e);return this.instantiationService.createInstance(IDe,e,t,this.getDefaultSettings(o))}getDefaultSettings(e){return e===5?(this._defaultWorkspaceSettingsContentModel??=this._register(new SDe(this.getMostCommonlyUsedSettings(),e,this.configurationService)),this._defaultWorkspaceSettingsContentModel):e===6?(this._defaultFolderSettingsContentModel??=this._register(new SDe(this.getMostCommonlyUsedSettings(),e,this.configurationService)),this._defaultFolderSettingsContentModel):(this._defaultUserSettingsContentModel??=this._register(new SDe(this.getMostCommonlyUsedSettings(),e,this.configurationService)),this._defaultUserSettingsContentModel)}async getEditableSettingsURI(e,t){switch(e){case 1:return this.userDataProfilesService.defaultProfile.settingsResource;case 2:case 3:return this.userSettingsResource;case 4:{let o=await this.remoteAgentService.getEnvironment();return o?o.settingsPath:null}case 5:return this.workspaceSettingsResource;case 6:if(t)return this.getFolderSettingsResource(t)}return null}async createSettingsIfNotExists(e,t){if(this.contextService.getWorkbenchState()===3&&e===5){let o=this.contextService.getWorkspace().configuration;if(!o)return;let n=await this.textFileService.read(o);Object.keys(Ur(n.value)).indexOf("settings")===-1&&await this.jsonEditingService.write(t,[{path:["settings"],value:{}}],!0);return}await this.createIfNotExists(t,wjo)}async createIfNotExists(e,t){try{await this.textFileService.read(e,{acceptTextOnly:!0})}catch(o){if(o.fileOperationResult===1)try{await this.textFileService.write(e,t);return}catch(n){throw new Error(d(17142,null,this.labelService.getUriLabel(e,{relative:!0}),Cn(n)))}else throw o}}getMostCommonlyUsedSettings(){return["editor.fontSize","editor.formatOnSave","files.autoSave","editor.defaultFormatter","editor.fontFamily","editor.wordWrap","chat.agent.maxRequests","files.exclude","workbench.colorTheme","editor.tabSize","editor.mouseWheelZoom","editor.formatOnPaste"]}async revealSetting(e,t,o,n){let r=o?ca(o.getControl()):null;if(!r)return;let s=await this.createPreferencesEditorModel(n);if(!s)return;let l=await this.getPositionToReveal(e,t,s,r);l&&(r.setPosition(l),r.revealPositionNearTop(l),r.focus(),t&&El.get(r)?.triggerSuggest())}async getPositionToReveal(e,t,o,n){let r=n.getModel();if(!r)return null;let s=oe.as(ii.Configuration).getConfigurationProperties()[e],l=lg.test(e);if(!s&&!l)return null;let c=null,u=s?.type??"object",p=o.getPreference(e);if(!p&&t){let h=u==="object"||u==="array"?this.configurationService.inspect(e).defaultValue:r$e(u);if(h=h===void 0&&l?{}:h,h!==void 0){let g=o instanceof Aue?["settings",e]:[e];await this.jsonEditingService.write(o.uri,[{path:g,value:h}],!1),p=o.getPreference(e)}}if(p)if(t)if(yi(p.value)||Array.isArray(p.value)){c={lineNumber:p.valueRange.startLineNumber,column:p.valueRange.startColumn+1},n.setPosition(c),await this.instantiationService.invokeFunction(g=>rL.LineBreakInsert.runEditorCommand(g,n,null)),c={lineNumber:c.lineNumber+1,column:r.getLineMaxColumn(c.lineNumber+1)};let h=r.getLineFirstNonWhitespaceColumn(c.lineNumber);h&&(n.setPosition({lineNumber:c.lineNumber,column:h}),await this.instantiationService.invokeFunction(g=>rL.LineBreakInsert.runEditorCommand(g,n,null)),c={lineNumber:c.lineNumber,column:r.getLineMaxColumn(c.lineNumber)})}else c={lineNumber:p.valueRange.startLineNumber,column:p.valueRange.endColumn};else c={lineNumber:p.keyRange.startLineNumber,column:p.keyRange.startColumn};return c}getSetting(e){if(!this._settingsGroups){let t=this.getDefaultSettings(2),o=this._register(new me);o.value=t.onDidChange(()=>{this._settingsGroups=void 0,o.clear()}),this._settingsGroups=t.getSettingsGroups()}for(let t of this._settingsGroups)for(let o of t.sections)for(let n of o.settings)if(Uw(n.key,e)===0)return n}async handleURL(e){if(Uw(e.authority,AEe)!==0)return!1;let t=e.path.split("/").filter(s=>!!s),o=t.length>0?t[0]:void 0;if(!o)return this.openSettings(),!0;let n=this.getSetting(o);!n&&this.extensionService.extensions.length===0&&(await this.progressService.withProgress({location:10},()=>H.toPromise(this.extensionService.onDidRegisterExtensions)),n=this.getSetting(o));let r={};return n&&(r.query=o),this.openSettings(r),!0}dispose(){this._cachedSettingsEditor2Input&&!this._cachedSettingsEditor2Input.isDisposed()&&this._cachedSettingsEditor2Input.dispose(),this._onDispose.fire(),super.dispose()}};FYe=I([m(0,ee),m(1,Et),m(2,Ho),m(3,B),m(4,Ne),m(5,Pe),m(6,F),m(7,mn),m(8,an),m(9,Nt),m(10,_e),m(11,Ct),m(12,zf),m(13,ot),m(14,yo),m(15,lk),m(16,nI),m(17,lt),m(18,Bo),m(19,Vt)],FYe);we(Po,FYe,1);var WYe=class{constructor(i,e,t,o){this.fileService=i;this.textModelResolverService=e;this.textFileService=t;this.filesConfigurationService=o;this.queue=new Op}write(i,e){return Promise.resolve(this.queue.queue(()=>this.doWriteConfiguration(i,e)))}async doWriteConfiguration(i,e){let t=await this.resolveAndValidate(i,!0);try{await this.writeToBuffer(t.object.textEditorModel,e)}finally{t.dispose()}}async writeToBuffer(i,e){let t;try{t=this.filesConfigurationService.enableAutoSaveAfterShortDelay(i.uri);let o=!1;for(let n of e){let r=this.getEdits(i,n)[0];o=!!r&&this.applyEditsToBuffer(r,i)||o}if(o)return this.textFileService.save(i.uri)}finally{t?.dispose()}}applyEditsToBuffer(i,e){let t=e.getPositionAt(i.offset),o=e.getPositionAt(i.offset+i.length),n=new z(t.lineNumber,t.column,o.lineNumber,o.column),r=e.getValueInRange(n);if(i.content!==r){let s=r?An.replace(n,i.content):An.insert(t,i.content);return e.pushEditOperations([new Yt(t.lineNumber,t.column,t.lineNumber,t.column)],[s],()=>[]),!0}return!1}getEdits(i,e){let{tabSize:t,insertSpaces:o}=i.getOptions(),n=i.getEOL(),{path:r,value:s}=e;if(!r.length){let l=JSON.stringify(s,null,o?" ".repeat(t):" ");return[{content:l,length:l.length,offset:0}]}return Sb(i.getValue(),r,s,{tabSize:t,insertSpaces:o,eol:n})}async resolveModelReference(i){return await this.fileService.exists(i)||await this.textFileService.write(i,"{}",{encoding:"utf8"}),this.textModelResolverService.createModelReference(i)}hasParseErrors(i){let e=[];return Ur(i.getValue(),e,{allowTrailingComma:!0,allowEmptyContent:!0}),e.length>0}async resolveAndValidate(i,e){let t=await this.resolveModelReference(i),o=t.object.textEditorModel;return this.hasParseErrors(o)?(t.dispose(),this.reject(0)):t}reject(i){let e=this.toErrorMessage(i);return Promise.reject(new DOt(e,i))}toErrorMessage(i){if(i===0)return d(16718,null)}};WYe=I([m(0,be),m(1,Nt),m(2,Ho),m(3,lr)],WYe);we(zf,WYe,1);var bF=class extends rw{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super(r,n,f,v);this.resource=e;this.preferredEncoding=t;this.preferredLanguageId=o;this.fileService=s;this.textFileService=l;this.workingCopyBackupService=c;this.logService=u;this.workingCopyService=p;this.filesConfigurationService=h;this.labelService=g;this.pathService=b;this.extensionService=S;this.progressService=y;this._onDidChangeContent=this._register(new E);this.onDidChangeContent=this._onDidChangeContent.event;this._onDidResolve=this._register(new E);this.onDidResolve=this._onDidResolve.event;this._onDidChangeDirty=this._register(new E);this.onDidChangeDirty=this._onDidChangeDirty.event;this._onDidSaveError=this._register(new E);this.onDidSaveError=this._onDidSaveError.event;this._onDidSave=this._register(new E);this.onDidSave=this._onDidSave.event;this._onDidRevert=this._register(new E);this.onDidRevert=this._onDidRevert.event;this._onDidChangeEncoding=this._register(new E);this.onDidChangeEncoding=this._onDidChangeEncoding.event;this._onDidChangeOrphaned=this._register(new E);this.onDidChangeOrphaned=this._onDidChangeOrphaned.event;this._onDidChangeReadonly=this._register(new E);this.onDidChangeReadonly=this._onDidChangeReadonly.event;this.typeId=CP;this.capabilities=0;this.versionId=0;this.ignoreDirtyOnModelContentChange=!1;this.ignoreSaveFromSaveParticipants=!1;this.lastModelContentChangeFromUndoRedo=void 0;this.saveSequentializer=new Abe;this.dirty=!1;this.inConflictMode=!1;this.inOrphanMode=!1;this.inErrorMode=!1;this.hasEncodingSetExplicitly=!1;this.name=No(this.labelService.getUriLabel(this.resource)),this.resourceHasExtension=!!ar.extname(this.resource),this._register(this.workingCopyService.registerWorkingCopy(this)),this.registerListeners()}static{this.TEXTFILE_SAVE_ENCODING_SOURCE=ph.registerSource("textFileEncoding.source",d(17239,null))}static{this.UNDO_REDO_SAVE_PARTICIPANTS_AUTO_SAVE_THROTTLE_THRESHOLD=500}registerListeners(){this._register(this.fileService.onDidFilesChange(e=>this.onDidFilesChange(e))),this._register(this.filesConfigurationService.onDidChangeFilesAssociation(()=>this.onDidChangeFilesAssociation())),this._register(this.filesConfigurationService.onDidChangeReadonly(()=>this._onDidChangeReadonly.fire()))}async onDidFilesChange(e){let t=!1,o;if(this.inOrphanMode?e.contains(this.resource,1)&&(o=!1,t=!0):e.contains(this.resource,2)&&(o=!0,t=!0),t&&this.inOrphanMode!==o){let n=!1;o&&(await Pi(100,ve.None),this.isDisposed()?n=!0:n=!await this.fileService.exists(this.resource)),this.inOrphanMode!==n&&!this.isDisposed()&&this.setOrphaned(n)}}setOrphaned(e){this.inOrphanMode!==e&&(this.inOrphanMode=e,this._onDidChangeOrphaned.fire())}onDidChangeFilesAssociation(){if(!this.isResolved())return;let e=this.getFirstLineText(this.textEditorModel),t=this.getOrCreateLanguage(this.resource,this.languageService,this.preferredLanguageId,e);this.textEditorModel.setLanguage(t)}setLanguageId(e,t){super.setLanguageId(e,t),this.preferredLanguageId=e}async backup(e){let t;this.lastResolvedFileStat&&(t={mtime:this.lastResolvedFileStat.mtime,ctime:this.lastResolvedFileStat.ctime,size:this.lastResolvedFileStat.size,etag:this.lastResolvedFileStat.etag,orphaned:this.inOrphanMode});let o=await this.textFileService.getEncodedReadable(this.resource,this.createSnapshot()??void 0,{encoding:mb});return{meta:t,content:o}}async revert(e){if(!this.isResolved())return;let t=this.dirty,o=this.doSetDirty(!1);if(!e?.soft)try{await this.forceResolveFromFile()}catch(r){if(r.fileOperationResult!==1)throw o(),r}this._onDidRevert.fire(),t&&this._onDidChangeDirty.fire()}async resolve(e){if(this.trace("resolve() - enter"),sn("code/willResolveTextFileEditorModel"),this.isDisposed()){this.trace("resolve() - exit - without resolving because model is disposed");return}if(!e?.contents&&(this.dirty||this.saveSequentializer.isRunning())){this.trace("resolve() - exit - without resolving because model is dirty or being saved");return}await this.doResolve(e),sn("code/didResolveTextFileEditorModel")}async doResolve(e){if(e?.contents)return this.resolveFromBuffer(e.contents,e);if(!(!this.isResolved()&&await this.resolveFromBackup(e)))return this.resolveFromFile(e)}async resolveFromBuffer(e,t){this.trace("resolveFromBuffer()");let o,n,r,s;try{let c=await this.fileService.stat(this.resource);o=c.mtime,n=c.ctime,r=c.size,s=c.etag,this.setOrphaned(!1)}catch(c){o=Date.now(),n=Date.now(),r=0,s=gL,this.setOrphaned(c.fileOperationResult===1)}let l=await this.textFileService.encoding.getPreferredWriteEncoding(this.resource,this.preferredEncoding);this.resolveFromContent({resource:this.resource,name:this.name,mtime:o,ctime:n,size:r,etag:s,value:e,encoding:l.encoding,readonly:!1,locked:!1,executable:!1},!0,t)}async resolveFromBackup(e){let t=await this.workingCopyBackupService.resolve(this),o=mb;return t&&(o=(await this.textFileService.encoding.getPreferredWriteEncoding(this.resource,this.preferredEncoding)).encoding),!this.isResolved()?t?(await this.doResolveFromBackup(t,o,e),!0):!1:(this.trace("resolveFromBackup() - exit - without resolving because previously new model got created meanwhile"),!0)}async doResolveFromBackup(e,t,o){this.trace("doResolveFromBackup()"),this.resolveFromContent({resource:this.resource,name:this.name,mtime:e.meta?e.meta.mtime:Date.now(),ctime:e.meta?e.meta.ctime:Date.now(),size:e.meta?e.meta.size:0,etag:e.meta?e.meta.etag:gL,value:await W9(await this.textFileService.getDecodedStream(this.resource,e.value,{encoding:mb})),encoding:t,readonly:!1,locked:!1,executable:!1},!0,o),e.meta?.orphaned&&this.setOrphaned(!0)}async resolveFromFile(e){this.trace("resolveFromFile()");let t=e?.forceReadFromFile,o=this.isResolved()||e?.allowBinary,n;t?n=gL:this.lastResolvedFileStat&&(n=this.lastResolvedFileStat.etag);let r=this.versionId;try{let s=await this.textFileService.readStream(this.resource,{acceptTextOnly:!o,etag:n,encoding:this.preferredEncoding,limits:e?.limits});if(this.setOrphaned(!1),r!==this.versionId){this.trace("resolveFromFile() - exit - without resolving because model content changed");return}return this.resolveFromContent(s,!1,e)}catch(s){let l=s.fileOperationResult;if(this.setOrphaned(l===1),this.isResolved()&&l===2){s instanceof UU&&this.updateLastResolvedFileStat(s.stat);return}if(this.isResolved()&&l===1&&!t)return;throw s}}resolveFromContent(e,t,o){if(this.trace("resolveFromContent() - enter"),this.isDisposed()){this.trace("resolveFromContent() - exit - because model is disposed");return}this.updateLastResolvedFileStat({resource:this.resource,name:e.name,mtime:e.mtime,ctime:e.ctime,size:e.size,etag:e.etag,readonly:e.readonly,locked:e.locked,executable:!1,isFile:!0,isDirectory:!1,isSymbolicLink:!1,children:void 0});let n=this.contentEncoding;this.contentEncoding=e.encoding,this.preferredEncoding?this.updatePreferredEncoding(this.contentEncoding):n!==this.contentEncoding&&this._onDidChangeEncoding.fire(),this.textEditorModel?this.doUpdateTextModel(e.value,_c.reloadFromDisk()):this.doCreateTextModel(e.resource,e.value),this.setDirty(!!t),this._onDidResolve.fire(o?.reason??3)}doCreateTextModel(e,t){this.trace("doCreateTextModel()");let o=this.createTextEditorModel(t,e,this.preferredLanguageId);this.installModelListeners(o),this.autoDetectLanguage()}doUpdateTextModel(e,t){this.trace("doUpdateTextModel()"),this.ignoreDirtyOnModelContentChange=!0;try{this.updateTextEditorModel(e,this.preferredLanguageId,t)}finally{this.ignoreDirtyOnModelContentChange=!1}}installModelListeners(e){this._register(e.onDidChangeContent(t=>this.onModelContentChanged(e,t.isUndoing||t.isRedoing))),this._register(e.onDidChangeLanguage(()=>this.onMaybeShouldChangeEncoding())),super.installModelListeners(e)}onModelContentChanged(e,t){if(this.trace("onModelContentChanged() - enter"),this.versionId++,this.trace(`onModelContentChanged() - new versionId ${this.versionId}`),t&&(this.lastModelContentChangeFromUndoRedo=Date.now()),!this.ignoreDirtyOnModelContentChange&&!this.isReadonly())if(e.getAlternativeVersionId()===this.bufferSavedVersionId){this.trace("onModelContentChanged() - model content changed back to last saved version");let o=this.dirty;this.setDirty(!1),o&&this._onDidRevert.fire()}else this.trace("onModelContentChanged() - model content changed and marked as dirty"),this.setDirty(!0);this._onDidChangeContent.fire(),this.autoDetectLanguage()}async autoDetectLanguage(){await this.extensionService?.whenInstalledExtensionsRegistered();let e=this.getLanguageId();if(this.resource.scheme===this.pathService.defaultUriScheme&&(!e||e===Fr)&&!this.resourceHasExtension)return super.autoDetectLanguage()}async forceResolveFromFile(){this.isDisposed()||await this.textFileService.files.resolve(this.resource,{reload:{async:!1},forceReadFromFile:!0})}isDirty(){return this.dirty}isModified(){return this.isDirty()}setDirty(e){if(!this.isResolved())return;let t=this.dirty;this.doSetDirty(e),e!==t&&this._onDidChangeDirty.fire()}doSetDirty(e){let t=this.dirty,o=this.inConflictMode,n=this.inErrorMode,r=this.bufferSavedVersionId;return e?this.dirty=!0:(this.dirty=!1,this.inConflictMode=!1,this.inErrorMode=!1,this.updateSavedVersionId()),()=>{this.dirty=t,this.inConflictMode=o,this.inErrorMode=n,this.bufferSavedVersionId=r}}async save(e=Object.create(null)){return this.isResolved()?this.isReadonly()?(this.trace("save() - ignoring request for readonly resource"),!1):(this.hasState(3)||this.hasState(5))&&(e.reason===2||e.reason===3||e.reason===4)?(this.trace("save() - ignoring auto save request for model that is in conflict or error"),!1):(this.trace("save() - enter"),await this.doSave(e),this.trace("save() - exit"),this.hasState(0)):!1}async doSave(e){typeof e.reason!="number"&&(e.reason=1);let t=this.versionId;if(this.trace(`doSave(${t}) - enter with versionId ${t}`),this.ignoreSaveFromSaveParticipants){this.trace(`doSave(${t}) - exit - refusing to save() recursively from save participant`);return}if(this.saveSequentializer.isRunning(t))return this.trace(`doSave(${t}) - exit - found a running save for versionId ${t}`),this.saveSequentializer.running;if(!e.force&&!this.dirty){this.trace(`doSave(${t}) - exit - because not dirty and/or versionId is different (this.isDirty: ${this.dirty}, this.versionId: ${this.versionId})`);return}if(this.saveSequentializer.isRunning())return this.trace(`doSave(${t}) - exit - because busy saving`),this.saveSequentializer.cancelRunning(),this.saveSequentializer.queue(()=>this.doSave(e));this.isResolved()&&this.textEditorModel.pushStackElement();let o=new $e;return this.progressService.withProgress({title:d(17237,null,this.name),location:10,cancellable:!0,delay:this.isDirty()?3e3:5e3},n=>this.doSaveSequential(t,e,n,o),()=>{o.cancel()}).finally(()=>{o.dispose()})}doSaveSequential(e,t,o,n){return this.saveSequentializer.run(e,(async()=>{if(this.isResolved()&&!t.skipSaveParticipants)try{if(t.reason===2&&typeof this.lastModelContentChangeFromUndoRedo=="number"){let l=Date.now()-this.lastModelContentChangeFromUndoRedo;l<bF.UNDO_REDO_SAVE_PARTICIPANTS_AUTO_SAVE_THROTTLE_THRESHOLD&&await Pi(bF.UNDO_REDO_SAVE_PARTICIPANTS_AUTO_SAVE_THROTTLE_THRESHOLD-l)}if(!n.token.isCancellationRequested){this.ignoreSaveFromSaveParticipants=!0;try{await this.textFileService.files.runSaveParticipants(this,{reason:t.reason??1,savedFrom:t.from},o,n.token)}catch(l){so(l)&&!n.token.isCancellationRequested&&n.cancel()}finally{this.ignoreSaveFromSaveParticipants=!1}}}catch(l){this.logService.error(`[text file model] runSaveParticipants(${e}) - resulted in an error: ${l.toString()}`,this.resource.toString())}if(n.token.isCancellationRequested||(n.dispose(),this.isDisposed())||!this.isResolved())return;e=this.versionId,this.inErrorMode=!1,o.report({message:d(17238,null)}),this.trace(`doSave(${e}) - before write()`);let r=Oi(this.lastResolvedFileStat),s=this;return this.saveSequentializer.run(e,(async()=>{try{let l=await this.textFileService.write(r.resource,s.createSnapshot(),{mtime:r.mtime,encoding:this.getEncoding(),etag:t.ignoreModifiedSince||!this.filesConfigurationService.preventSaveConflicts(r.resource,s.getLanguageId())?gL:r.etag,unlock:t.writeUnlock,writeElevated:t.writeElevated});this.handleSaveSuccess(l,e,t)}catch(l){this.handleSaveError(l,e,t)}})())})(),()=>n.cancel())}handleSaveSuccess(e,t,o){this.updateLastResolvedFileStat(e),t===this.versionId?(this.trace(`handleSaveSuccess(${t}) - setting dirty to false because versionId did not change`),this.setDirty(!1)):this.trace(`handleSaveSuccess(${t}) - not setting dirty to false because versionId did change meanwhile`),this.setOrphaned(!1),this._onDidSave.fire({reason:o.reason,stat:e,source:o.source})}handleSaveError(e,t,o){if((o.ignoreErrorHandler?this.logService.trace:this.logService.error).apply(this.logService,[`[text file model] handleSaveError(${t}) - exit - resulted in a save error: ${e.toString()}`,this.resource.toString()]),o.ignoreErrorHandler)throw e;this.setDirty(!0),this.inErrorMode=!0,e.fileOperationResult===3&&(this.inConflictMode=!0),this.textFileService.files.saveErrorHandler.onSaveError(e,this,o),this._onDidSaveError.fire()}updateSavedVersionId(){this.isResolved()&&(this.bufferSavedVersionId=this.textEditorModel.getAlternativeVersionId())}updateLastResolvedFileStat(e){let t=this.isReadonly();this.lastResolvedFileStat?this.lastResolvedFileStat.mtime<=e.mtime?this.lastResolvedFileStat=e:this.lastResolvedFileStat={...this.lastResolvedFileStat,readonly:e.readonly,locked:e.locked}:this.lastResolvedFileStat=e,this.isReadonly()!==t&&this._onDidChangeReadonly.fire()}hasState(e){switch(e){case 3:return this.inConflictMode;case 1:return this.dirty;case 5:return this.inErrorMode;case 4:return this.inOrphanMode;case 2:return this.saveSequentializer.isRunning();case 0:return!this.dirty}}async joinState(e){return this.saveSequentializer.running}getLanguageId(){return this.textEditorModel?this.textEditorModel.getLanguageId():this.preferredLanguageId}async onMaybeShouldChangeEncoding(){if(this.hasEncodingSetExplicitly){this.trace("onMaybeShouldChangeEncoding() - ignoring because encoding was set explicitly");return}if(this.contentEncoding===vV||this.contentEncoding===n5||this.contentEncoding===r5){this.trace("onMaybeShouldChangeEncoding() - ignoring because content encoding has a BOM");return}let{encoding:e}=await this.textFileService.encoding.getPreferredReadEncoding(this.resource);if(typeof e!="string"||!this.isNewEncoding(e)){this.trace(`onMaybeShouldChangeEncoding() - ignoring because preferred encoding ${e} is not new`);return}if(this.isDirty()){this.trace("onMaybeShouldChangeEncoding() - ignoring because model is dirty");return}return this.logService.info(`Adjusting encoding based on configured language override to '${e}' for ${this.resource.toString(!0)}.`),this.forceResolveFromFile()}setEncoding(e,t){return this.hasEncodingSetExplicitly=!0,this.setEncodingInternal(e,t)}async setEncodingInternal(e,t){if(t===0)this.updatePreferredEncoding(e),this.isDirty()||(this.versionId++,this.setDirty(!0)),this.inConflictMode||await this.save({source:bF.TEXTFILE_SAVE_ENCODING_SOURCE});else{if(!this.isNewEncoding(e))return;if(this.isDirty())throw new Error("Cannot re-open a dirty text document with different encoding. Save it first.");this.updatePreferredEncoding(e),await this.forceResolveFromFile()}}updatePreferredEncoding(e){this.isNewEncoding(e)&&(this.preferredEncoding=e,this._onDidChangeEncoding.fire())}isNewEncoding(e){return!(this.preferredEncoding===e||!this.preferredEncoding&&this.contentEncoding===e)}getEncoding(){return this.preferredEncoding||this.contentEncoding}trace(e){this.logService.trace(`[text file model] ${e}`,this.resource.toString())}isResolved(){return!!this.textEditorModel}isReadonly(){return this.filesConfigurationService.isReadonly(this.resource,this.lastResolvedFileStat)}dispose(){this.trace("dispose()"),this.inConflictMode=!1,this.inOrphanMode=!1,this.inErrorMode=!1,super.dispose()}};bF=I([m(3,kt),m(4,Ct),m(5,be),m(6,Ho),m(7,Gm),m(8,ne),m(9,Wa),m(10,lr),m(11,ot),m(12,eS),m(13,Bi),m(14,wn),m(15,lt),m(16,Bo)],bF);var yDe=class extends C{constructor(e,t,o){super();this._modelService=e;this._textModelService=t;this._undoRedoService=o;this._register(this._modelService.onModelRemoved(n=>{let r=this._undoRedoService.getElements(n.uri);if(!(r.past.length===0&&r.future.length===0)){for(let s of r.past)s instanceof vW&&s.setDelegate(this);for(let s of r.future)s instanceof vW&&s.setDelegate(this)}}))}prepareUndoRedo(e){let t=e.getMissingModels();if(t.length===0)return C.None;let o=t.map(async n=>{try{return await this._textModelService.createModelReference(n)}catch{return C.None}});return Promise.all(o).then(n=>({dispose:()=>Ue(n)}))}};yDe=I([m(0,Ct),m(1,Nt),m(2,Cl)],yDe);var VYe=class extends Ww{constructor(e,t,o,n){super();this.instantiationService=e;this.textFileService=t;this.fileService=o;this.modelService=n;this.providers=new Map;this.modelsToDispose=new Set}createReferencedObject(e){return this.doCreateReferencedObject(e)}async doCreateReferencedObject(e,t){this.modelsToDispose.delete(e);let o=A.parse(e);if(o.scheme===Y.inMemory){if(!this.modelService.getModel(o))throw new Error(`Unable to resolve inMemory resource ${e}`);let r=this.instantiationService.createInstance(t5,o);if(this.ensureResolvedModel(r,e))return r}if(o.scheme===Y.untitled){let n=await this.textFileService.untitled.resolve({untitledResource:o});if(this.ensureResolvedModel(n,e))return n}if(this.fileService.hasProvider(o)){let n=await this.textFileService.files.resolve(o,{reason:2});if(this.ensureResolvedModel(n,e))return n}if(this.providers.has(o.scheme)){await this.resolveTextModelContent(e);let n=this.instantiationService.createInstance(t5,o);if(this.ensureResolvedModel(n,e))return n}if(!t)return await this.fileService.activateProvider(o.scheme),this.doCreateReferencedObject(e,!0);throw new Error(`Unable to resolve resource ${e}`)}ensureResolvedModel(e,t){if(Kzi(e))return!0;throw new Error(`Unable to resolve resource ${t}`)}destroyReferencedObject(e,t){A.parse(e).scheme!==Y.inMemory&&(this.modelsToDispose.add(e),(async()=>{try{let n=await t;if(!this.modelsToDispose.has(e)||(n instanceof bF?await this.textFileService.files.canDispose(n):n instanceof B_&&await this.textFileService.untitled.canDispose(n),!this.modelsToDispose.has(e)))return;n.dispose()}catch{}finally{this.modelsToDispose.delete(e)}})())}registerTextModelContentProvider(e,t){let o=this.providers.get(e);return o||(o=[],this.providers.set(e,o)),o.unshift(t),Z(()=>{let n=this.providers.get(e);if(!n)return;let r=n.indexOf(t);r!==-1&&(n.splice(r,1),n.length===0&&this.providers.delete(e))})}hasTextModelContentProvider(e){return this.providers.get(e)!==void 0}async resolveTextModelContent(e){let t=A.parse(e),o=this.providers.get(t.scheme)||[];for(let n of o){let r=await n.provideTextContent(t);if(r)return r}throw new Error(`Unable to resolve text model content for resource ${e}`)}};VYe=I([m(0,F),m(1,Ho),m(2,be),m(3,Ct)],VYe);var BYe=class extends C{constructor(e,t,o,n,r){super();this.instantiationService=e;this.fileService=t;this.undoRedoService=o;this.modelService=n;this.uriIdentityService=r;this._resourceModelCollection=void 0;this._asyncModelCollection=void 0;this._register(new yDe(this.modelService,this,this.undoRedoService))}get resourceModelCollection(){return this._resourceModelCollection||(this._resourceModelCollection=this.instantiationService.createInstance(VYe)),this._resourceModelCollection}get asyncModelCollection(){return this._asyncModelCollection||(this._asyncModelCollection=new tbe(this.resourceModelCollection)),this._asyncModelCollection}async createModelReference(e){return e=this.uriIdentityService.asCanonicalUri(e),await this.asyncModelCollection.acquire(e.toString())}registerTextModelContentProvider(e,t){return this.resourceModelCollection.registerTextModelContentProvider(e,t)}canHandleResource(e){return this.fileService.hasProvider(e)||e.scheme===Y.untitled||e.scheme===Y.inMemory?!0:this.resourceModelCollection.hasTextModelContentProvider(e.scheme)}};BYe=I([m(0,F),m(1,be),m(2,Cl),m(3,Ct),m(4,dt)],BYe);we(Nt,BYe,1);var yK=class extends C{constructor(e,t,o){super();this.editorGroupService=t;this.storageService=o;this.keyMap=new Map;this.mostRecentEditorsMap=new zH;this.editorsPerResourceCounter=new vt;this._onDidMostRecentlyActiveEditorsChange=this._register(new E);this.onDidMostRecentlyActiveEditorsChange=this._onDidMostRecentlyActiveEditorsChange.event;this.editorGroupsContainer=e??t,this.isScoped=!!e,this.registerListeners(),this.loadState()}static{this.STORAGE_KEY="editors.mru"}get count(){return this.mostRecentEditorsMap.size}get editors(){return[...this.mostRecentEditorsMap.values()]}hasEditor(e){return this.editorsPerResourceCounter.get(e.resource)?.has(this.toIdentifier(e))??!1}hasEditors(e){return this.editorsPerResourceCounter.has(e)}toIdentifier(e,t){return typeof e!="string"?this.toIdentifier(e.typeId,e.editorId):t?`${e}/${t}`:e}registerListeners(){this._register(this.editorGroupsContainer.onDidAddGroup(e=>this.onGroupAdded(e))),this._register(this.editorGroupService.onDidChangeEditorPartOptions(e=>this.onDidChangeEditorPartOptions(e))),this._register(this.storageService.onWillSaveState(()=>this.saveState()))}onGroupAdded(e){let t=e.getEditors(0);for(let o=t.length-1;o>=0;o--)this.addMostRecentEditor(e,t[o],!1,!0);this.editorGroupsContainer.activeGroup===e&&e.activeEditor&&this.addMostRecentEditor(e,e.activeEditor,!0,!1),this.registerGroupListeners(e)}registerGroupListeners(e){let t=new P;t.add(e.onDidModelChange(o=>{switch(o.kind){case 0:{this.editorGroupsContainer.activeGroup===e&&e.activeEditor&&this.addMostRecentEditor(e,e.activeEditor,!0,!1);break}case 5:{o.editor&&(this.addMostRecentEditor(e,o.editor,!1,!0),this.ensureOpenedEditorsLimit({groupId:e.id,editor:o.editor},e.id));break}}})),t.add(e.onDidCloseEditor(o=>{this.removeMostRecentEditor(e,o.editor)})),t.add(e.onDidActiveEditorChange(o=>{o.editor&&this.addMostRecentEditor(e,o.editor,this.editorGroupsContainer.activeGroup===e,!1)})),H.once(e.onWillDispose)(()=>Ue(t))}onDidChangeEditorPartOptions(e){if(!uo(e.newPartOptions.limit,e.oldPartOptions.limit)){let t=this.editorGroupsContainer.activeGroup,o;t.activeEditor&&(o={editor:t.activeEditor,groupId:t.id}),this.ensureOpenedEditorsLimit(o)}}addMostRecentEditor(e,t,o,n){let r=this.ensureKey(e,t),s=this.mostRecentEditorsMap.first;o||!s?this.mostRecentEditorsMap.set(r,r,s?1:void 0):(this.mostRecentEditorsMap.set(r,r,1),this.mostRecentEditorsMap.set(s,s,1)),n&&this.updateEditorResourcesMap(t,!0),this._onDidMostRecentlyActiveEditorsChange.fire()}updateEditorResourcesMap(e,t){let o,n,r;if(e instanceof ga?(o=e.primary.resource,n=e.primary.typeId,r=e.primary.editorId):(o=e.resource,n=e.typeId,r=e.editorId),!o)return;let s=this.toIdentifier(n,r);if(t){let l=this.editorsPerResourceCounter.get(o);l||(l=new Map,this.editorsPerResourceCounter.set(o,l)),l.set(s,(l.get(s)??0)+1)}else{let l=this.editorsPerResourceCounter.get(o);if(l){let c=l.get(s)??0;c>1?l.set(s,c-1):(l.delete(s),l.size===0&&this.editorsPerResourceCounter.delete(o))}}}removeMostRecentEditor(e,t){this.updateEditorResourcesMap(t,!1);let o=this.findKey(e,t);if(o){this.mostRecentEditorsMap.delete(o);let n=this.keyMap.get(e.id);n?.delete(o.editor)&&n.size===0&&this.keyMap.delete(e.id),this._onDidMostRecentlyActiveEditorsChange.fire()}}findKey(e,t){let o=this.keyMap.get(e.id);if(o)return o.get(t)}ensureKey(e,t){let o=this.keyMap.get(e.id);o||(o=new Map,this.keyMap.set(e.id,o));let n=o.get(t);return n||(n={groupId:e.id,editor:t},o.set(t,n)),n}async ensureOpenedEditorsLimit(e,t){if(!this.editorGroupService.partOptions.limit?.enabled||typeof this.editorGroupService.partOptions.limit.value!="number"||this.editorGroupService.partOptions.limit.value<=0)return;let o=this.editorGroupService.partOptions.limit.value;if(this.editorGroupService.partOptions.limit?.perEditorGroup)if(typeof t=="number"){let n=this.editorGroupsContainer.getGroup(t);n&&await this.doEnsureOpenedEditorsLimit(o,n.getEditors(0).map(r=>({editor:r,groupId:t})),e)}else for(let n of this.editorGroupsContainer.groups)await this.ensureOpenedEditorsLimit(e,n.id);else await this.doEnsureOpenedEditorsLimit(o,[...this.mostRecentEditorsMap.values()],e)}async doEnsureOpenedEditorsLimit(e,t,o){let n;if(this.editorGroupService.partOptions.limit?.excludeDirty?n=t.filter(({editor:c})=>!(c.isDirty()&&!c.isSaving()||c.hasCapability(512))):n=t,e>=n.length)return;let r=n.reverse().filter(({editor:c,groupId:u})=>!(c.isDirty()&&!c.isSaving()||c.hasCapability(512)||o&&c===o.editor&&u===o.groupId||this.editorGroupsContainer.getGroup(u)?.isSticky(c))),s=n.length-e,l=new Map;for(let{groupId:c,editor:u}of r){let p=l.get(c);if(p||(p=[],l.set(c,p)),p.push(u),s--,s===0)break}for(let[c,u]of l){let p=this.editorGroupsContainer.getGroup(c);p&&await p.closeEditors(u,{preserveFocus:!0})}}saveState(){this.isScoped||(this.mostRecentEditorsMap.isEmpty()?this.storageService.remove(yK.STORAGE_KEY,1):this.storageService.store(yK.STORAGE_KEY,JSON.stringify(this.serialize()),1,1))}serialize(){let e=oe.as(rn.EditorFactory),t=[...this.mostRecentEditorsMap.values()],o=new Map;return{entries:si(t.map(({editor:n,groupId:r})=>{let s=this.editorGroupsContainer.getGroup(r);if(!s)return;let l=o.get(s);l||(l=s.getEditors(1).filter(u=>e.getEditorSerializer(u)?.canSerialize(u)),o.set(s,l));let c=l.indexOf(n);if(c!==-1)return{groupId:r,index:c}}))}}async loadState(){(this.editorGroupsContainer===this.editorGroupService.mainPart||this.editorGroupsContainer===this.editorGroupService)&&await this.editorGroupService.whenReady;let e=!1;if(!this.isScoped){let t=this.storageService.get(yK.STORAGE_KEY,1);t&&(e=!0,this.deserialize(JSON.parse(t)))}if(!e){let t=this.editorGroupsContainer.getGroups(1);for(let o=t.length-1;o>=0;o--){let n=t[o],r=n.getEditors(0);for(let s=r.length-1;s>=0;s--)this.addMostRecentEditor(n,r[s],!0,!0)}}for(let t of this.editorGroupsContainer.groups)this.registerGroupListeners(t)}deserialize(e){let t=[];for(let{groupId:o,index:n}of e.entries){let r=this.editorGroupsContainer.getGroup(o);if(!r)continue;let s=r.getEditorByIndex(n);if(!s)continue;let l=this.ensureKey(r,s);t.push([l,l]),this.updateEditorResourcesMap(s,!0)}this.mostRecentEditorsMap.fromJSON(t)}};yK=I([m(1,Et),m(2,le)],yK);var Nue=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.editorGroupService=t;this.instantiationService=o;this.fileService=n;this.configurationService=r;this.contextService=s;this.uriIdentityService=l;this.editorResolverService=c;this.workspaceTrustRequestService=u;this.hostService=p;this.textEditorService=h;this._onDidActiveEditorChange=this._register(new E);this.onDidActiveEditorChange=this._onDidActiveEditorChange.event;this._onDidVisibleEditorsChange=this._register(new E);this.onDidVisibleEditorsChange=this._onDidVisibleEditorsChange.event;this._onDidEditorsChange=this._register(new E);this.onDidEditorsChange=this._onDidEditorsChange.event;this._onWillOpenEditor=this._register(new E);this.onWillOpenEditor=this._onWillOpenEditor.event;this._onDidCloseEditor=this._register(new E);this.onDidCloseEditor=this._onDidCloseEditor.event;this._onDidOpenEditorFail=this._register(new E);this.onDidOpenEditorFail=this._onDidOpenEditorFail.event;this._onDidMostRecentlyActiveEditorsChange=this._register(new E);this.onDidMostRecentlyActiveEditorsChange=this._onDidMostRecentlyActiveEditorsChange.event;this.lastActiveEditor=void 0;this.activeOutOfWorkspaceWatchers=new vt;this.closeOnFileDelete=!1;this.editorGroupsContainer=e??t,this.editorsObserver=this._register(this.instantiationService.createInstance(yK,this.editorGroupsContainer)),this.onConfigurationUpdated(),this.registerListeners()}createScoped(e,t){return t.add(new Nue(e,this.editorGroupService,this.instantiationService,this.fileService,this.configurationService,this.contextService,this.uriIdentityService,this.editorResolverService,this.workspaceTrustRequestService,this.hostService,this.textEditorService))}registerListeners(){this.editorGroupsContainer===this.editorGroupService.mainPart||this.editorGroupsContainer===this.editorGroupService?this.editorGroupService.whenReady.then(()=>this.onEditorGroupsReady()):this.onEditorGroupsReady(),this._register(this.editorGroupsContainer.onDidChangeActiveGroup(e=>this.handleActiveEditorChange(e))),this._register(this.editorGroupsContainer.onDidAddGroup(e=>this.registerGroupListeners(e))),this._register(this.editorsObserver.onDidMostRecentlyActiveEditorsChange(()=>this._onDidMostRecentlyActiveEditorsChange.fire())),this._register(this.onDidVisibleEditorsChange(()=>this.handleVisibleEditorsChange())),this._register(this.fileService.onDidRunOperation(e=>this.onDidRunFileOperation(e))),this._register(this.fileService.onDidFilesChange(e=>this.onDidFilesChange(e))),this._register(this.configurationService.onDidChangeConfiguration(e=>this.onConfigurationUpdated(e)))}onEditorGroupsReady(){for(let e of this.editorGroupsContainer.groups)this.registerGroupListeners(e);this.activeEditor&&(this.doHandleActiveEditorChangeEvent(),this._onDidVisibleEditorsChange.fire())}handleActiveEditorChange(e){e===this.editorGroupsContainer.activeGroup&&(!this.lastActiveEditor&&!e.activeEditor||this.doHandleActiveEditorChangeEvent())}doHandleActiveEditorChangeEvent(){let e=this.editorGroupsContainer.activeGroup;this.lastActiveEditor=e.activeEditor??void 0,this._onDidActiveEditorChange.fire()}registerGroupListeners(e){let t=new P;t.add(e.onDidModelChange(o=>{this._onDidEditorsChange.fire({groupId:e.id,event:o})})),t.add(e.onDidActiveEditorChange(()=>{this.handleActiveEditorChange(e),this._onDidVisibleEditorsChange.fire()})),t.add(e.onWillOpenEditor(o=>{this._onWillOpenEditor.fire(o)})),t.add(e.onDidCloseEditor(o=>{this._onDidCloseEditor.fire(o)})),t.add(e.onDidOpenEditorFail(o=>{this._onDidOpenEditorFail.fire({editor:o,groupId:e.id})})),H.once(e.onWillDispose)(()=>{Ue(t)})}handleVisibleEditorsChange(){let e=new Mn;for(let t of this.visibleEditors){let o=Uo(si([no.getCanonicalUri(t,{supportSideBySide:1}),no.getCanonicalUri(t,{supportSideBySide:2})]),n=>n.toString());for(let n of o)this.fileService.hasProvider(n)&&!this.contextService.isInsideWorkspace(n)&&e.add(n)}for(let t of this.activeOutOfWorkspaceWatchers.keys())e.has(t)||(Ue(this.activeOutOfWorkspaceWatchers.get(t)),this.activeOutOfWorkspaceWatchers.delete(t));for(let t of e.keys())if(!this.activeOutOfWorkspaceWatchers.get(t)){let o=this.fileService.watch(t);this.activeOutOfWorkspaceWatchers.set(t,o)}}async onDidRunFileOperation(e){e.isOperation(2)&&this.handleMovedFile(e.resource,e.target.resource),(e.isOperation(1)||e.isOperation(2))&&this.handleDeletedFile(e.resource,!1,e.target?e.target.resource:void 0)}onDidFilesChange(e){e.gotDeleted()&&this.handleDeletedFile(e,!0)}async handleMovedFile(e,t){for(let o of this.editorGroupsContainer.groups){let n=[];for(let r of o.editors){let s=r.resource;if(!s||!this.uriIdentityService.extUri.isEqualOrParent(s,e))continue;let l;if(this.uriIdentityService.extUri.isEqual(e,s))l=t;else{let p=Dbe(s.path,e.path,this.uriIdentityService.extUri.ignorePathCasing(s));l=je(t,s.path.substr(p+e.path.length+1))}let c=await r.rename(o.id,l);if(!c)return;let u={preserveFocus:!0,pinned:o.isPinned(r),sticky:o.isSticky(r),index:o.getIndexOfEditor(r),inactive:!o.isActive(r)};Ta(c.editor)?n.push({editor:r,replacement:c.editor,options:{...c.options,...u}}):n.push({editor:r,replacement:{...c.editor,options:{...c.editor.options,...u}}})}n.length&&this.replaceEditors(n,o)}}onConfigurationUpdated(e){if(e&&!e.affectsConfiguration("workbench.editor.closeOnFileDelete"))return;let t=this.configurationService.getValue();typeof t.workbench?.editor?.closeOnFileDelete=="boolean"?this.closeOnFileDelete=t.workbench.editor.closeOnFileDelete:this.closeOnFileDelete=!1}handleDeletedFile(e,t,o){for(let n of this.getAllNonDirtyEditors({includeUntitled:!1,supportSideBySide:!0}))(async()=>{let r=n.resource;if(r&&(this.closeOnFileDelete||!t)){if(o&&this.uriIdentityService.extUri.isEqualOrParent(r,o))return;let s=!1;if(e instanceof FN?s=e.contains(r,2):s=this.uriIdentityService.extUri.isEqualOrParent(r,e),!s)return;let l=!1;t&&this.fileService.hasProvider(r)&&(await Pi(100),l=await this.fileService.exists(r)),!l&&!n.isDisposed()&&n.dispose()}})()}getAllNonDirtyEditors(e){let t=[];function o(n){n.hasCapability(4)&&!e.includeUntitled||n.isDirty()||t.push(n)}for(let n of this.editors)e.supportSideBySide&&n instanceof ga?(o(n.primary),o(n.secondary)):o(n);return t}get activeEditorPane(){return this.editorGroupsContainer.activeGroup?.activeEditorPane}get activeTextEditorControl(){let e=this.activeEditorPane;if(e){let t=e.getControl();if(pn(t)||Ec(t))return t;if(MU(t)&&pn(t.activeCodeEditor))return t.activeCodeEditor}}get activeTextEditorLanguageId(){let e,t=this.activeTextEditorControl;return Ec(t)?e=t.getModifiedEditor():e=t,e?.getModel()?.getLanguageId()}get count(){return this.editorsObserver.count}get editors(){return this.getEditors(1).map(({editor:e})=>e)}getEditors(e,t){switch(e){case 0:return t?.excludeSticky?this.editorsObserver.editors.filter(({groupId:o,editor:n})=>!this.editorGroupsContainer.getGroup(o)?.isSticky(n)):this.editorsObserver.editors;case 1:{let o=[];for(let n of this.editorGroupsContainer.getGroups(2))o.push(...n.getEditors(1,t).map(r=>({editor:r,groupId:n.id})));return o}}}get activeEditor(){let e=this.editorGroupsContainer.activeGroup;return e?e.activeEditor??void 0:void 0}get visibleEditorPanes(){return si(this.editorGroupsContainer.groups.map(e=>e.activeEditorPane))}get visibleTextEditorControls(){return this.doGetVisibleTextEditorControls(this.visibleEditorPanes)}doGetVisibleTextEditorControls(e){let t=[];for(let o of e){let n=[];o instanceof of?(n.push(o.getPrimaryEditorPane()?.getControl()),n.push(o.getSecondaryEditorPane()?.getControl())):n.push(o.getControl());for(let r of n)(pn(r)||Ec(r))&&t.push(r)}return t}getVisibleTextEditorControls(e){return this.doGetVisibleTextEditorControls(si(this.editorGroupsContainer.getGroups(e===1?2:1).map(t=>t.activeEditorPane)))}get visibleEditors(){return si(this.editorGroupsContainer.groups.map(e=>e.activeEditor))}async openEditor(e,t,o){let n,r=Ta(e)?t:e.options,s;if(B7i(t)&&(o=t),!Ta(e)){let l=await this.editorResolverService.resolveEditor(e,o);if(l===1)return;Rj(l)&&(n=l.editor,r=l.options,s=l.group)}if(n||(n=Ta(e)?e:await this.textEditorService.resolveTextEditor(e)),!s){let l,c=this.instantiationService.invokeFunction(Eue,{editor:n,options:r},o);c instanceof Promise?[s,l]=await c:[s,l]=c,l&&(r={...r,activation:l})}return s.openEditor(n,r)}async openEditors(e,t,o){if(o?.validateTrust&&!await this.handleWorkspaceTrust(e))return[];let n=new Map;for(let s of e){let l,c;if(!tV(s)){let p=await this.editorResolverService.resolveEditor(s,t);if(p===1)continue;Rj(p)&&(l=p,c=p.group)}if(l||(l=tV(s)?s:{editor:await this.textEditorService.resolveTextEditor(s),options:s.options}),!c){let p=this.instantiationService.invokeFunction(Eue,l,t);p instanceof Promise?[c]=await p:[c]=p}let u=n.get(c);u||(u=[],n.set(c,u)),u.push(l)}let r=[];for(let[s,l]of n)r.push(s.openEditors(l));return si(await fn.settled(r))}async handleWorkspaceTrust(e){let{resources:t,diffMode:o,mergeMode:n}=this.extractEditorResources(e);switch(await this.workspaceTrustRequestService.requestOpenFilesTrust(t)){case 1:return!0;case 2:return await this.hostService.openWindow(t.map(s=>({fileUri:s})),{forceNewWindow:!0,diffMode:o,mergeMode:n}),!1;case 3:return!1}}extractEditorResources(e){let t=new Mn,o=!1,n=!1;for(let r of e)if(tV(r)){let s=no.getOriginalUri(r.editor,{supportSideBySide:3});A.isUri(s)?t.add(s):s&&(s.primary&&t.add(s.primary),s.secondary&&t.add(s.secondary),o=r.editor instanceof Fa)}else dC(r)&&(A.isUri(r.input1)&&t.add(r.input1.resource),A.isUri(r.input2)&&t.add(r.input2.resource),A.isUri(r.base)&&t.add(r.base.resource),A.isUri(r.result)&&t.add(r.result.resource),n=!0),db(r)?(A.isUri(r.original.resource)&&t.add(r.original.resource),A.isUri(r.modified.resource)&&t.add(r.modified.resource),o=!0):QS(r)&&t.add(r.resource);return{resources:Array.from(t.keys()),diffMode:o,mergeMode:n}}isOpened(e){return this.editorsObserver.hasEditor({resource:this.uriIdentityService.asCanonicalUri(e.resource),typeId:e.typeId,editorId:e.editorId})}isVisible(e){for(let t of this.editorGroupsContainer.groups)if(t.activeEditor?.matches(e))return!0;return!1}async closeEditor({editor:e,groupId:t},o){await this.editorGroupsContainer.getGroup(t)?.closeEditor(e,o)}async closeEditors(e,t){let o=new Map;for(let{editor:n,groupId:r}of e){let s=this.editorGroupsContainer.getGroup(r);if(!s)continue;let l=o.get(s);l||(l=[],o.set(s,l)),l.push(n)}for(let[n,r]of o)await n.closeEditors(r,t)}findEditors(e,t,o){let n=A.isUri(e)?e:e.resource,r=A.isUri(e)?void 0:e.typeId;if(t?.supportSideBySide!==4&&t?.supportSideBySide!==2&&!this.editorsObserver.hasEditors(n))return A.isUri(e)||cn(o)?[]:void 0;if(cn(o)){let s=[];for(let l of this.editorGroupsContainer.getGroups(t?.order===1?2:1)){let c=[];if(A.isUri(e))c.push(...this.findEditors(e,t,l));else{let u=this.findEditors(e,t,l);u&&c.push(u)}s.push(...c.map(u=>({editor:u,groupId:l.id})))}return s}else{let s=typeof o=="number"?this.editorGroupsContainer.getGroup(o):o;if(A.isUri(e))return s?s.findEditors(n,t):[];{if(!s)return;let l=s.findEditors(n,t);for(let c of l)if(c.typeId===r)return c;return}}}async replaceEditors(e,t){let o=typeof t=="number"?this.editorGroupsContainer.getGroup(t):t,n=[];for(let r of e){let s;if(!Ta(r.replacement)){let l=await this.editorResolverService.resolveEditor(r.replacement,o);if(l===1)continue;Rj(l)&&(s={editor:r.editor,replacement:l.editor,options:l.options,forceReplaceDirty:r.forceReplaceDirty})}s||(s={editor:r.editor,replacement:cdi(r)?r.replacement:await this.textEditorService.resolveTextEditor(r.replacement),options:cdi(r)?r.options:r.replacement.options,forceReplaceDirty:r.forceReplaceDirty}),n.push(s)}return o?.replaceEditors(n)}async save(e,t){Array.isArray(e)||(e=[e]);let o=this.getUniqueEditors(e),n=[],r=[];if(t?.saveAs)r.push(...o);else for(let{groupId:l,editor:c}of o)c.hasCapability(4)?r.push({groupId:l,editor:c}):n.push({groupId:l,editor:c});let s=await fn.settled(n.map(({groupId:l,editor:c})=>(t?.reason===1&&this.editorGroupsContainer.getGroup(l)?.pinEditor(c),c.save(l,t))));for(let{groupId:l,editor:c}of r){if(c.isDisposed())continue;let p={pinned:!0,viewState:(await this.openEditor(c,l))?.getViewState()},h=t?.saveAs?await c.saveAs(l,t):await c.save(l,t);if(s.push(h),!h)break;if(!c.matches(h)){let g=c.hasCapability(4)?this.editorGroupsContainer.groups.map(f=>f.id):[l];for(let f of g)h instanceof Us?await this.replaceEditors([{editor:c,replacement:h,options:p}],f):await this.replaceEditors([{editor:c,replacement:{...h,options:p}}],f)}}return{success:s.every(l=>!!l),editors:si(s)}}saveAll(e){return this.save(this.getAllModifiedEditors(e),e)}async revert(e,t){Array.isArray(e)||(e=[e]);let o=this.getUniqueEditors(e);return await fn.settled(o.map(async({groupId:n,editor:r})=>(this.editorGroupsContainer.getGroup(n)?.pinEditor(r),r.revert(n,t)))),!o.some(({editor:n})=>n.isDirty())}async revertAll(e){return this.revert(this.getAllModifiedEditors(e),e)}getAllModifiedEditors(e){let t=[];for(let o of this.editorGroupsContainer.getGroups(1))for(let n of o.getEditors(0))n.isModified()&&((typeof e?.includeUntitled=="boolean"||!e?.includeUntitled?.includeScratchpad)&&n.hasCapability(512)||!e?.includeUntitled&&n.hasCapability(4)||e?.excludeSticky&&o.isSticky(n)||t.push({groupId:o.id,editor:n}));return t}getUniqueEditors(e){let t=[];for(let{editor:o,groupId:n}of e)t.some(r=>r.editor.matches(o))||t.push({editor:o,groupId:n});return t}dispose(){super.dispose(),this.activeOutOfWorkspaceWatchers.forEach(e=>Ue(e)),this.activeOutOfWorkspaceWatchers.clear()}};Nue=I([m(1,Et),m(2,F),m(3,be),m(4,B),m(5,Pe),m(6,dt),m(7,ul),m(8,Vd),m(9,oi),m(10,lk)],Nue);we(ee,new Mt(Nue,[void 0],!1));var QP=class extends C{constructor(e,t,o,n,r,s,l,c){super();this.editorGroupService=e;this.instantiationService=t;this.configurationService=o;this.quickInputService=n;this.notificationService=r;this.storageService=s;this.extensionService=l;this.logService=c;this._onDidChangeEditorRegistrations=this._register(new Pm);this.onDidChangeEditorRegistrations=this._onDidChangeEditorRegistrations.event;this._editors=new Map;this._flattenedEditors=new Map;this._shouldReFlattenEditors=!0;this.cache=new Set(JSON.parse(this.storageService.get(QP.cacheStorageID,0,JSON.stringify([])))),this.storageService.remove(QP.cacheStorageID,0),this._register(this.storageService.onWillSaveState(()=>{this.cacheEditors()})),this._register(this.extensionService.onDidRegisterExtensions(()=>{this.cache=void 0}))}static{this.configureDefaultID="promptOpenWith.configureDefault"}static{this.cacheStorageID="editorOverrideService.cache"}static{this.conflictingDefaultsStorageID="editorOverrideService.conflictingDefaults"}resolveUntypedInputAndGroup(e,t){let o=e,n=this.instantiationService.invokeFunction(Eue,o,t);if(n instanceof Promise)return n.then(([r,s])=>[o,r,s]);{let[r,s]=n;return[o,r,s]}}async resolveEditor(e,t){if(this._flattenedEditors=this._flattenEditorsMap(),C_(e))return this.doResolveSideBySideEditor(e,t);let o,n=this.resolveUntypedInputAndGroup(e,t);if(n instanceof Promise?o=await n:o=n,!o)return 2;let[r,s,l]=o;l&&(r.options={...r.options,activation:l});let c=no.getCanonicalUri(r,{supportSideBySide:1});if(this.cache&&c&&this.resourceMatchesCache(c)&&await this.extensionService.whenInstalledExtensionsRegistered(),c===void 0)c=A.from({scheme:Y.untitled});else if(c.scheme===void 0||c===null)return 2;if(r.options?.override===0){let g=await this.doPickEditor(r);if(!g)return 1;r.options=g}let{editor:u,conflictingDefault:p}=this.getEditor(c,r.options?.override);if(!u&&(r.options?.override||tV(e)))return 2;if(!u){let g=this.getEditor(c,Ys.id);if(u=g?.editor,p=g?.conflictingDefault,!u)return 2}if(db(r)&&r.options?.override===void 0){let g=no.getCanonicalUri(r,{supportSideBySide:2});g||(g=A.from({scheme:Y.untitled}));let{editor:f}=this.getEditor(g,void 0);if(!f||u.editorInfo.id!==f.editorInfo.id){let{editor:v,conflictingDefault:b}=this.getEditor(c,Ys.id);u=v,p=b}if(!u)return 2}if(r.options={override:u.editorInfo.id,...r.options},u.editorFactoryObject.createDiffEditorInput===void 0&&db(r))return 2;let h=await this.doResolveEditor(r,s,u);return p&&h&&await this.doHandleConflictingDefaults(c,u.editorInfo.label,r,h.editor,s),h?(h.editor.editorId!==u.editorInfo.id&&this.logService.warn(`Editor ID Mismatch: ${h.editor.editorId} !== ${u.editorInfo.id}. This will cause bugs. Please ensure editorInput.editorId matches the registered id`),{...h,group:s}):1}async doResolveSideBySideEditor(e,t){let o=await this.resolveEditor(e.primary,t);if(!Rj(o))return 2;let n=await this.resolveEditor(e.secondary,o.group??t);return Rj(n)?{group:o.group??n.group,editor:this.instantiationService.createInstance(ga,e.label,e.description,n.editor,o.editor),options:e.options}:2}bufferChangeEvents(e){this._onDidChangeEditorRegistrations.pause();try{e()}finally{this._onDidChangeEditorRegistrations.resume()}}registerEditor(e,t,o,n){let r=this._editors.get(e);r===void 0&&(r=new Map,this._editors.set(e,r));let s=r.get(t.id);s===void 0&&(s=[]);let l=Zm(s,{globPattern:e,editorInfo:t,options:o,editorFactoryObject:n});return r.set(t.id,s),this._shouldReFlattenEditors=!0,this._onDidChangeEditorRegistrations.fire(),Z(()=>{l(),s&&s.length===0&&r?.delete(t.id),this._shouldReFlattenEditors=!0,this._onDidChangeEditorRegistrations.fire()})}getAssociationsForResource(e){let o=this.getAllUserAssociations().filter(r=>r.filenamePattern&&eX(r.filenamePattern,e));o=o.sort((r,s)=>(s.filenamePattern?.length??0)-(r.filenamePattern?.length??0));let n=this._registeredEditors;return o.filter(r=>n.find(s=>s.editorInfo.id===r.viewType))}getAllUserAssociations(){let e=this.configurationService.inspect(wui)||{},t=e.defaultValue??{},o=e.workspaceValue??{},n=e.userValue??{},r={...o};for(let[l,c]of Object.entries({...t,...n}))r[l]===void 0&&(r[l]=c);let s=[];for(let[l,c]of Object.entries(r)){let u={filenamePattern:l,viewType:c};s.push(u)}return s}_flattenEditorsMap(){if(!this._shouldReFlattenEditors)return this._flattenedEditors;this._shouldReFlattenEditors=!1;let e=new Map;for(let[t,o]of this._editors){let n=[];for(let r of o.values()){let s;for(let l of r)s||(s={editorInfo:l.editorInfo,globPattern:l.globPattern,options:{},editorFactoryObject:{}}),s.options={...s.options,...l.options},s.editorFactoryObject={...s.editorFactoryObject,...l.editorFactoryObject};s&&n.push(s)}e.set(t,n)}return e}get _registeredEditors(){return Array.from(this._flattenedEditors.values()).flat()}updateUserAssociations(e,t){let o={viewType:t,filenamePattern:e},n=this.getAllUserAssociations(),r=Object.create(null);for(let s of[...n,o])s.filenamePattern&&(r[s.filenamePattern]=s.viewType);this.configurationService.updateValue(wui,r)}findMatchingEditors(e){let t=this.getAssociationsForResource(e),o=[];for(let[n,r]of this._flattenedEditors)for(let s of r)(t.find(c=>c.viewType===s.editorInfo.id)&&s.editorInfo.priority!=="exclusive"||eX(n,e))&&o.push(s);return o.sort((n,r)=>lR(r.editorInfo.priority)===lR(n.editorInfo.priority)&&typeof r.globPattern=="string"&&typeof n.globPattern=="string"?r.globPattern.length-n.globPattern.length:lR(r.editorInfo.priority)-lR(n.editorInfo.priority))}getEditors(e){if(this._flattenedEditors=this._flattenEditorsMap(),A.isUri(e)){let t=this.findMatchingEditors(e);return t.find(o=>o.editorInfo.priority==="exclusive")?[]:t.map(o=>o.editorInfo)}return Uo(this._registeredEditors.map(t=>t.editorInfo),t=>t.id)}getEditor(e,t){let o=(p,h)=>p.find(g=>g.options?.canSupportResource!==void 0?g.editorInfo.id===h&&g.options.canSupportResource(e):g.editorInfo.id===h);if(t&&t!==1){let p=this._registeredEditors;return{editor:o(p,t),conflictingDefault:!1}}let n=this.findMatchingEditors(e),r=this.getAssociationsForResource(e),s=t===1?"exclusive":"builtin",l=n.filter(p=>lR(p.editorInfo.priority)>=lR(s)&&p.editorInfo.id!==Ys.id);if(l.length===0)return{editor:r[0]&&s!=="exclusive"?o(n,r[0].viewType):void 0,conflictingDefault:!1};let c=l[0].editorInfo.priority==="exclusive"?l[0].editorInfo.id:r[0]?.viewType||l.find(p=>!p.options?.canSupportResource||p.options.canSupportResource(e))?.editorInfo.id||l[0].editorInfo.id,u=!1;return l=l.filter(p=>p.editorInfo.priority!=="exclusive").filter(p=>!p.options?.canSupportResource||p.options.canSupportResource(e)),r.length===0&&l.length>1&&(u=!0),{editor:o(n,c),conflictingDefault:u}}async doResolveEditor(e,t,o){let n=e.options,r=no.getCanonicalUri(e,{supportSideBySide:1});if(n&&typeof n.activation>"u"&&(n={...n,activation:n.preserveFocus?2:void 0}),dC(e)){if(!o.editorFactoryObject.createMergeEditorInput)return;let u=await o.editorFactoryObject.createMergeEditorInput(e,t);return{editor:u.editor,options:u.options??n}}if(db(e)){if(!o.editorFactoryObject.createDiffEditorInput)return;let u=await o.editorFactoryObject.createDiffEditorInput(e,t);return{editor:u.editor,options:u.options??n}}if(bY(e)){if(!o.editorFactoryObject.createMultiDiffEditorInput)return;let u=await o.editorFactoryObject.createMultiDiffEditorInput(e,t);return{editor:u.editor,options:u.options??n}}if(C_(e))throw new Error("Untyped side by side editor input not supported here.");if(Hxe(e)){if(!o.editorFactoryObject.createUntitledEditorInput)return;let u=await o.editorFactoryObject.createUntitledEditorInput(e,t);return{editor:u.editor,options:u.options??n}}if(r===void 0)throw new Error("Undefined resource on non untitled editor input.");if(typeof o.options?.singlePerResource=="function"?o.options.singlePerResource():o.options?.singlePerResource){let u=this.findExistingEditorsForResource(r,o.editorInfo.id);if(u.length){let p=await this.moveExistingEditorForResource(u,t);return p?{editor:p,options:n}:void 0}}if(!o.editorFactoryObject.createEditorInput)return;let l=await o.editorFactoryObject.createEditorInput(e,t);return n=l.options??n,{editor:l.editor,options:n}}async moveExistingEditorForResource(e,t){let o=e[0];for(let{editor:n,group:r}of e)if(n!==o.editor&&!await r.closeEditor(n))return;if(!(t.id!==o.group.id&&!o.group.moveEditor(o.editor,t)))return o.editor}findExistingEditorsForResource(e,t){let o=[],n=Uo([...this.editorGroupService.groups]);for(let r of n)for(let s of r.editors)Xe(s.resource,e)&&s.editorId===t&&o.push({editor:s,group:r});return o}async doHandleConflictingDefaults(e,t,o,n,r){let s=this.findMatchingEditors(e),l=JSON.parse(this.storageService.get(QP.conflictingDefaultsStorageID,0,"{}")),c=`*${ms(e)}`,u=()=>{l[c]=[],s.forEach(g=>l[c].push(g.editorInfo.id)),this.storageService.store(QP.conflictingDefaultsStorageID,JSON.stringify(l),0,1)};if(l[c]?.find(g=>g===n.editorId))return;let h=this.notificationService.prompt(St.Warning,d(16795,null),[{label:d(16794,null),run:async()=>{let g=await this.doPickEditor(o,!0);if(!g)return;o.options=g;let f=await this.resolveEditor(o,r);f===1||f===2||r.replaceEditors([{editor:n,replacement:f.editor,options:f.options??g}])}},{label:d(16796,null,t),run:u}]).onDidClose(()=>{u(),h.dispose()})}mapEditorsToQuickPickEntry(e,t){let o=this.editorGroupService.activeGroup.findEditors(e).at(0),n=e.scheme===Y.untitled?this._registeredEditors.filter(h=>h.editorInfo.priority!=="exclusive"):this.findMatchingEditors(e);n=Uo(n,h=>h.editorInfo.id);let r=this.getAssociationsForResource(e)[0]?.viewType;n=n.sort((h,g)=>h.editorInfo.id===Ys.id?-1:g.editorInfo.id===Ys.id?1:lR(g.editorInfo.priority)-lR(h.editorInfo.priority));let s=[],l=d(16800,null),c=d(16798,null),u=d(16799,null),p=r;if(!p&&n.length>2&&n[1]?.editorInfo.priority!=="option"&&(p=n[1]?.editorInfo.id),p||(p=Ys.id),n.forEach(h=>{let g=o?.editorId??Ys.id,f=o?h.editorInfo.id===g:!1,v=h.editorInfo.id===p,b={id:h.editorInfo.id,label:h.editorInfo.label,description:f&&v?u:f?l:v?c:void 0,detail:h.editorInfo.detail??h.editorInfo.priority};s.push(b)}),!t&&ms(e)!==""){let h={type:"separator"};s.push(h);let g={id:QP.configureDefaultID,label:d(16797,null,`*${ms(e)}`)};s.push(g)}return s}async doPickEditor(e,t){let o=no.getOriginalUri(e,{supportSideBySide:1});o===void 0&&(o=A.from({scheme:Y.untitled}));let n=this.mapEditorsToQuickPickEntry(o,t),r=new P,s=r.add(this.quickInputService.createQuickPick({useSeparators:!0})),l=t?d(16802,null,`*${ms(o)}`):d(16801,null,Ye(o));s.placeholder=l,s.canAcceptInBackground=!0,s.items=n;let c=s.items.find(p=>p.type==="item");c&&(s.selectedItems=[c]);let u=await new Promise(p=>{r.add(s.onDidAccept(h=>{let g;s.selectedItems.length===1&&(g={item:s.selectedItems[0],keyMods:s.keyMods,openInBackground:h.inBackground}),o&&t&&g?.item.id&&this.updateUserAssociations(`*${ms(o)}`,g.item.id),p(g)})),r.add(s.onDidHide(()=>{r.dispose(),p(void 0)})),r.add(s.onDidTriggerItemButton(h=>{p({item:h.item,openInBackground:!1}),o&&h.item?.id&&this.updateUserAssociations(`*${ms(o)}`,h.item.id)})),s.show()});if(s.dispose(),u)return u.item.id===QP.configureDefaultID?this.doPickEditor(e,!0):{...e.options,override:u.item.id,preserveFocus:u.openInBackground||e.options?.preserveFocus}}cacheEditors(){let e=new Set;for(let[o,n]of this._flattenedEditors)n.find(s=>s.editorInfo.priority!=="option"&&s.editorInfo.id!==Ys.id)&&(eP(o)?e.add(`${o.pattern}`):e.add(o));let t=this.getAllUserAssociations();for(let o of t)o.filenamePattern&&e.add(o.filenamePattern);this.storageService.store(QP.cacheStorageID,JSON.stringify(Array.from(e)),0,1)}resourceMatchesCache(e){if(!this.cache)return!1;for(let t of this.cache)if(eX(t,e))return!0;return!1}};QP=I([m(0,Et),m(1,F),m(2,B),m(3,Ge),m(4,Ne),m(5,le),m(6,lt),m(7,ne)],QP);we(ul,QP,0);var Oue=class{constructor(i){this.logService=i;this._providers=new Map}static{this.DEFAULT_TIMEOUT=1e3*10}isEnabled(){return this._providers.size>0}registerAiRelatedInformationProvider(i,e){let t=this._providers.get(i)??[];return t.push(e),this._providers.set(i,t),{dispose:()=>{let o=this._providers.get(i)??[],n=o.indexOf(e);n!==-1&&o.splice(n,1),o.length===0&&this._providers.delete(i)}}}async getRelatedInformation(i,e,t){if(this._providers.size===0)throw new Error("No related information providers registered");let o=[];for(let s of e){let l=this._providers.get(s);l&&o.push(...l)}if(o.length===0)throw new Error("No related information providers registered for the given types");let n=En.create(),r=o.map(s=>xn(async l=>{try{return(await s.provideAiRelatedInformation(i,l)).filter(u=>e.includes(u.type))}catch{}return[]}));try{let s=await Wp(Promise.allSettled(r),Oue.DEFAULT_TIMEOUT,()=>{r.forEach(c=>c.cancel()),this.logService.warn("[AiRelatedInformationService]: Related information provider timed out")});return s?s.filter(c=>c.status==="fulfilled").flatMap(c=>c.value):[]}finally{n.stop(),this.logService.trace(`[AiRelatedInformationService]: getRelatedInformation took ${n.elapsed()}ms`)}}};Oue=I([m(0,ne)],Oue);we(FTe,Oue,1);var Pbi=class a extends C{constructor(){super(...arguments);this._providers=[];this._llmRankedResultsPromises=new Map;this._embeddingsResultsPromises=new Map;this._onProviderRegistered=this._register(new E);this.onProviderRegistered=this._onProviderRegistered.event}static{this.MAX_PICKS=5}isEnabled(){return this._providers.length>0}registerSettingsSearchProvider(e){return this._providers.push(e),this._onProviderRegistered.fire(),{dispose:()=>{let t=this._providers.indexOf(e);t!==-1&&this._providers.splice(t,1)}}}startSearch(e,t){if(!this.isEnabled())throw new Error("No settings search providers registered");this._embeddingsResultsPromises.delete(e),this._llmRankedResultsPromises.delete(e),this._providers.forEach(o=>o.searchSettings(e,{limit:a.MAX_PICKS,embeddingsOnly:!1},t))}async getEmbeddingsResults(e,t){if(!this.isEnabled())throw new Error("No settings search providers registered");let o=this._embeddingsResultsPromises.get(e);if(o)return await o.p??null;let n=new Go;return this._embeddingsResultsPromises.set(e,n),await wa(n.p,t)??null}async getLLMRankedResults(e,t){if(!this.isEnabled())throw new Error("No settings search providers registered");let o=this._llmRankedResultsPromises.get(e);if(o)return await o.p??null;let n=new Go;return this._llmRankedResultsPromises.set(e,n),await wa(n.p,t)??null}handleSearchResult(e){if(this.isEnabled()){if(e.kind===1){let t=this._embeddingsResultsPromises.get(e.query);if(t)t.complete(e.settings);else{let o=new Go;o.complete(e.settings),this._embeddingsResultsPromises.set(e.query,o)}}else if(e.kind===2){let t=this._llmRankedResultsPromises.get(e.query);if(t)t.complete(e.settings);else{let o=new Go;o.complete(e.settings),this._llmRankedResultsPromises.set(e.query,o)}}}}};we(dEe,Pbi,1);var ER=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.editorService=e;this.editorGroupService=t;this.contextService=o;this.storageService=n;this.configurationService=r;this.fileService=s;this.workspacesService=l;this.instantiationService=c;this.layoutService=u;this.contextKeyService=p;this.logService=h;this.activeEditorListeners=this._register(new P);this.lastActiveEditor=void 0;this._onDidChangeEditorNavigationStack=this._register(new E);this.onDidChangeEditorNavigationStack=this._onDidChangeEditorNavigationStack.event;this.defaultScopedEditorNavigationStack=void 0;this.editorGroupScopedNavigationStacks=new Map;this.editorScopedNavigationStacks=new Map;this.editorNavigationScope=0;this.recentlyUsedEditorsStack=void 0;this.recentlyUsedEditorsStackIndex=0;this.recentlyUsedEditorsInGroupStack=void 0;this.recentlyUsedEditorsInGroupStackIndex=0;this.navigatingInRecentlyUsedEditorsStack=!1;this.navigatingInRecentlyUsedEditorsInGroupStack=!1;this.recentlyClosedEditors=[];this.ignoreEditorCloseEvent=!1;this.history=void 0;this.editorHistoryListeners=this._register(new jt);this.resourceExcludeMatcher=this._register(new hN(It,()=>{let e=this._register(this.instantiationService.createInstance(YS,t=>MP(t?this.configurationService.getValue({resource:t}):this.configurationService.getValue())||Object.create(null),t=>t.affectsConfiguration(Xgt)||t.affectsConfiguration(_Lt)));return this._register(e.onExpressionChange(()=>this.removeExcludedFromHistory())),e}));this.editorHelper=this.instantiationService.createInstance(wDe),this.canNavigateBackContextKey=new Q("canNavigateBack",!1,d(17047,null)).bindTo(this.contextKeyService),this.canNavigateForwardContextKey=new Q("canNavigateForward",!1,d(17050,null)).bindTo(this.contextKeyService),this.canNavigateBackInNavigationsContextKey=new Q("canNavigateBackInNavigationLocations",!1,d(17049,null)).bindTo(this.contextKeyService),this.canNavigateForwardInNavigationsContextKey=new Q("canNavigateForwardInNavigationLocations",!1,d(17052,null)).bindTo(this.contextKeyService),this.canNavigateToLastNavigationLocationContextKey=new Q("canNavigateToLastNavigationLocation",!1,d(17054,null)).bindTo(this.contextKeyService),this.canNavigateBackInEditsContextKey=new Q("canNavigateBackInEditLocations",!1,d(17048,null)).bindTo(this.contextKeyService),this.canNavigateForwardInEditsContextKey=new Q("canNavigateForwardInEditLocations",!1,d(17051,null)).bindTo(this.contextKeyService),this.canNavigateToLastEditLocationContextKey=new Q("canNavigateToLastEditLocation",!1,d(17053,null)).bindTo(this.contextKeyService),this.canReopenClosedEditorContextKey=new Q("canReopenClosedEditor",!1,d(17055,null)).bindTo(this.contextKeyService),this.registerListeners(),this.editorService.activeEditorPane&&this.onDidActiveEditorChange()}static{this.MOUSE_NAVIGATION_SETTING="workbench.editor.mouseBackForwardToNavigate"}static{this.NAVIGATION_SCOPE_SETTING="workbench.editor.navigationScope"}registerListeners(){this.registerMouseNavigationListener(),this._register(this.editorService.onDidActiveEditorChange(()=>this.onDidActiveEditorChange())),this._register(this.editorService.onDidOpenEditorFail(e=>this.remove(e.editor))),this._register(this.editorService.onDidCloseEditor(e=>this.onDidCloseEditor(e))),this._register(this.editorService.onDidMostRecentlyActiveEditorsChange(()=>this.handleEditorEventInRecentEditorsStack())),this._register(this.editorGroupService.onDidRemoveGroup(e=>this.onDidRemoveGroup(e))),this._register(this.fileService.onDidFilesChange(e=>this.onDidFilesChange(e))),this._register(this.fileService.onDidRunOperation(e=>this.onDidFilesChange(e))),this._register(this.storageService.onWillSaveState(()=>this.saveState())),this.registerEditorNavigationScopeChangeListener(),this._register(this.onDidChangeEditorNavigationStack(()=>this.updateContextKeys())),this._register(this.editorGroupService.onDidChangeActiveGroup(()=>this.updateContextKeys()))}onDidCloseEditor(e){this.handleEditorCloseEventInHistory(e),this.handleEditorCloseEventInReopen(e)}registerMouseNavigationListener(){let e=this._register(new P),t=()=>{e.clear(),this.configurationService.getValue(ER.MOUSE_NAVIGATION_SETTING)&&this._register(H.runAndSubscribe(this.layoutService.onDidAddContainer,({container:o,disposables:n})=>{let r=n.add(new P);r.add(j(o,re.MOUSE_DOWN,s=>this.onMouseDownOrUp(s,!0))),r.add(j(o,re.MOUSE_UP,s=>this.onMouseDownOrUp(s,!1))),e.add(r)},{container:this.layoutService.mainContainer,disposables:this._store}))};this._register(this.configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration(ER.MOUSE_NAVIGATION_SETTING)&&t()})),t()}onMouseDownOrUp(e,t){switch(e.button){case 3:$t.stop(e),t&&this.goBack();break;case 4:$t.stop(e),t&&this.goForward();break}}onDidRemoveGroup(e){this.handleEditorGroupRemoveInNavigationStacks(e)}onDidActiveEditorChange(){let e=this.editorGroupService.activeGroup,t=e.activeEditorPane;if(!(this.lastActiveEditor&&this.editorHelper.matchesEditorIdentifier(this.lastActiveEditor,t))){if(this.lastActiveEditor=t?.input?{editor:t.input,groupId:t.group.id}:void 0,this.activeEditorListeners.clear(),!t?.group.isTransient(t.input))this.handleActiveEditorChange(e,t);else{this.logService.trace(`[History]: ignoring transient editor change until becoming non-transient (editor: ${t.input?.resource?.toString()}})`);let o=e.onDidModelChange(n=>{n.kind===12&&n.editor===t.input&&!t.group.isTransient(t.input)&&(o.dispose(),this.handleActiveEditorChange(e,t))});this.activeEditorListeners.add(o)}pce(t)&&this.activeEditorListeners.add(t.onDidChangeSelection(o=>{t.group.isTransient(t.input)?this.logService.trace(`[History]: ignoring transient editor selection change (editor: ${t.input?.resource?.toString()}})`):this.handleActiveEditorSelectionChangeEvent(e,t,o)})),this.updateContextKeys()}}onDidFilesChange(e){e instanceof FN?e.gotDeleted()&&this.remove(e):e.isOperation(1)?this.remove(e):e.isOperation(2)&&e.target.isFile&&this.move(e)}handleActiveEditorChange(e,t){this.handleActiveEditorChangeInHistory(t),this.handleActiveEditorChangeInNavigationStacks(e,t)}handleActiveEditorSelectionChangeEvent(e,t,o){this.handleActiveEditorSelectionChangeInNavigationStacks(e,t,o)}move(e){this.moveInHistory(e),this.moveInEditorNavigationStacks(e)}remove(e){this.removeFromHistory(e),this.removeFromEditorNavigationStacks(e),this.removeFromRecentlyClosedEditors(e),this.removeFromRecentlyOpened(e)}removeFromRecentlyOpened(e){let t;Ta(e)?t=no.getOriginalUri(e):e instanceof FN||(t=e.resource),t&&this.workspacesService.removeRecentlyOpened([t])}clear(){this.clearRecentlyOpened(),this.clearEditorNavigationStacks(),this.recentlyClosedEditors=[],this.updateContextKeys()}updateContextKeys(){this.contextKeyService.bufferChangeEvents(()=>{let e=this.getStack();this.canNavigateBackContextKey.set(e.canGoBack(0)),this.canNavigateForwardContextKey.set(e.canGoForward(0)),this.canNavigateBackInNavigationsContextKey.set(e.canGoBack(2)),this.canNavigateForwardInNavigationsContextKey.set(e.canGoForward(2)),this.canNavigateToLastNavigationLocationContextKey.set(e.canGoLast(2)),this.canNavigateBackInEditsContextKey.set(e.canGoBack(1)),this.canNavigateForwardInEditsContextKey.set(e.canGoForward(1)),this.canNavigateToLastEditLocationContextKey.set(e.canGoLast(1)),this.canReopenClosedEditorContextKey.set(this.recentlyClosedEditors.length>0)})}registerEditorNavigationScopeChangeListener(){let e=()=>{this.disposeEditorNavigationStacks();let t=this.configurationService.getValue(ER.NAVIGATION_SCOPE_SETTING);t==="editorGroup"?this.editorNavigationScope=1:t==="editor"?this.editorNavigationScope=2:this.editorNavigationScope=0};this._register(this.configurationService.onDidChangeConfiguration(t=>{t.affectsConfiguration(ER.NAVIGATION_SCOPE_SETTING)&&e()})),e()}getStack(e=this.editorGroupService.activeGroup,t=e.activeEditor){switch(this.editorNavigationScope){case 2:{if(!t)return new Abi;let o=this.editorScopedNavigationStacks.get(e.id);o||(o=new Map,this.editorScopedNavigationStacks.set(e.id,o));let n=o.get(t)?.stack;if(!n){let r=new P;n=r.add(this.instantiationService.createInstance(Fue,2)),r.add(n.onDidChange(()=>this._onDidChangeEditorNavigationStack.fire())),o.set(t,{stack:n,disposable:r})}return n}case 1:{let o=this.editorGroupScopedNavigationStacks.get(e.id)?.stack;if(!o){let n=new P;o=n.add(this.instantiationService.createInstance(Fue,1)),n.add(o.onDidChange(()=>this._onDidChangeEditorNavigationStack.fire())),this.editorGroupScopedNavigationStacks.set(e.id,{stack:o,disposable:n})}return o}case 0:return this.defaultScopedEditorNavigationStack||(this.defaultScopedEditorNavigationStack=this._register(this.instantiationService.createInstance(Fue,0)),this._register(this.defaultScopedEditorNavigationStack.onDidChange(()=>this._onDidChangeEditorNavigationStack.fire()))),this.defaultScopedEditorNavigationStack}}goForward(e){return this.getStack().goForward(e)}goBack(e){return this.getStack().goBack(e)}goPrevious(e){return this.getStack().goPrevious(e)}goLast(e){return this.getStack().goLast(e)}handleActiveEditorChangeInNavigationStacks(e,t){this.getStack(e,t?.input).handleActiveEditorChange(t)}handleActiveEditorSelectionChangeInNavigationStacks(e,t,o){this.getStack(e,t.input).handleActiveEditorSelectionChange(t,o)}handleEditorCloseEventInHistory(e){let t=this.editorScopedNavigationStacks.get(e.groupId);if(t){let o=t.get(e.editor);o&&(o.disposable.dispose(),t.delete(e.editor)),t.size===0&&this.editorScopedNavigationStacks.delete(e.groupId)}}handleEditorGroupRemoveInNavigationStacks(e){this.defaultScopedEditorNavigationStack?.remove(e.id);let t=this.editorGroupScopedNavigationStacks.get(e.id);t&&(t.disposable.dispose(),this.editorGroupScopedNavigationStacks.delete(e.id))}clearEditorNavigationStacks(){this.withEachEditorNavigationStack(e=>e.clear())}removeFromEditorNavigationStacks(e){this.withEachEditorNavigationStack(t=>t.remove(e))}moveInEditorNavigationStacks(e){this.withEachEditorNavigationStack(t=>t.move(e))}withEachEditorNavigationStack(e){this.defaultScopedEditorNavigationStack&&e(this.defaultScopedEditorNavigationStack);for(let[,t]of this.editorGroupScopedNavigationStacks)e(t.stack);for(let[,t]of this.editorScopedNavigationStacks)for(let[,o]of t)e(o.stack)}disposeEditorNavigationStacks(){this.defaultScopedEditorNavigationStack?.dispose(),this.defaultScopedEditorNavigationStack=void 0;for(let[,e]of this.editorGroupScopedNavigationStacks)e.disposable.dispose();this.editorGroupScopedNavigationStacks.clear();for(let[,e]of this.editorScopedNavigationStacks)for(let[,t]of e)t.disposable.dispose();this.editorScopedNavigationStacks.clear()}openNextRecentlyUsedEditor(e){let[t,o]=this.ensureRecentlyUsedStack(n=>n-1,e);return this.doNavigateInRecentlyUsedEditorsStack(t[o],e)}openPreviouslyUsedEditor(e){let[t,o]=this.ensureRecentlyUsedStack(n=>n+1,e);return this.doNavigateInRecentlyUsedEditorsStack(t[o],e)}async doNavigateInRecentlyUsedEditorsStack(e,t){if(e){let o=typeof t!="number"||!this.editorGroupService.getGroup(t);o?this.navigatingInRecentlyUsedEditorsStack=!0:this.navigatingInRecentlyUsedEditorsInGroupStack=!0;let n=this.editorGroupService.getGroup(e.groupId)??this.editorGroupService.activeGroup;try{await n.openEditor(e.editor)}finally{o?this.navigatingInRecentlyUsedEditorsStack=!1:this.navigatingInRecentlyUsedEditorsInGroupStack=!1}}}ensureRecentlyUsedStack(e,t){let o,n,r=typeof t=="number"?this.editorGroupService.getGroup(t):void 0;r?(o=this.recentlyUsedEditorsInGroupStack||r.getEditors(0).map(l=>({groupId:r.id,editor:l})),n=this.recentlyUsedEditorsInGroupStackIndex):(o=this.recentlyUsedEditorsStack||this.editorService.getEditors(0),n=this.recentlyUsedEditorsStackIndex);let s=e(n);return s<0?s=0:s>o.length-1&&(s=o.length-1),r?(this.recentlyUsedEditorsInGroupStack=o,this.recentlyUsedEditorsInGroupStackIndex=s):(this.recentlyUsedEditorsStack=o,this.recentlyUsedEditorsStackIndex=s),[o,s]}handleEditorEventInRecentEditorsStack(){this.navigatingInRecentlyUsedEditorsStack||(this.recentlyUsedEditorsStack=void 0,this.recentlyUsedEditorsStackIndex=0),this.navigatingInRecentlyUsedEditorsInGroupStack||(this.recentlyUsedEditorsInGroupStack=void 0,this.recentlyUsedEditorsInGroupStackIndex=0)}static{this.MAX_RECENTLY_CLOSED_EDITORS=20}handleEditorCloseEventInReopen(e){if(this.ignoreEditorCloseEvent)return;let{editor:t,context:o}=e;if(o===1||o===2||!t.canReopen())return;let n=t.toUntyped();if(!n)return;let r=[],s=no.getOriginalUri(t,{supportSideBySide:3});A.isUri(s)?r.push(s):s&&r.push(...si([s.primary,s.secondary])),this.removeFromRecentlyClosedEditors(t),this.recentlyClosedEditors.push({editorId:t.editorId,editor:n,resource:no.getOriginalUri(t),associatedResources:r,index:e.index,sticky:e.sticky}),this.recentlyClosedEditors.length>ER.MAX_RECENTLY_CLOSED_EDITORS&&this.recentlyClosedEditors.shift(),this.canReopenClosedEditorContextKey.set(!0)}async reopenLastClosedEditor(){let e=this.recentlyClosedEditors.pop(),t;return e&&(t=this.doReopenLastClosedEditor(e)),this.canReopenClosedEditorContextKey.set(this.recentlyClosedEditors.length>0),t}async doReopenLastClosedEditor(e){let t={pinned:!0,sticky:e.sticky,index:e.index,ignoreError:!0};(e.sticky&&!this.editorGroupService.activeGroup.isSticky(e.index)||!e.sticky&&this.editorGroupService.activeGroup.isSticky(e.index))&&(t.index=void 0);let o;if(!this.editorGroupService.activeGroup.contains(e.editor)){this.ignoreEditorCloseEvent=!0;try{o=await this.editorService.openEditor({...e.editor,options:{...e.editor.options,...t}})}finally{this.ignoreEditorCloseEvent=!1}}o||(tGe(this.recentlyClosedEditors,e),this.reopenLastClosedEditor())}removeFromRecentlyClosedEditors(e){this.recentlyClosedEditors=this.recentlyClosedEditors.filter(t=>Ta(e)&&t.editorId!==e.editorId?!0:!(t.resource&&this.editorHelper.matchesFile(t.resource,e)||t.associatedResources.some(o=>this.editorHelper.matchesFile(o,e)))),this.canReopenClosedEditorContextKey.set(this.recentlyClosedEditors.length>0)}static{this.MAX_HISTORY_ITEMS=200}static{this.HISTORY_STORAGE_KEY="history.entries"}handleActiveEditorChangeInHistory(e){let t=e?.input;!t||t.isDisposed()||!this.includeInHistory(t)||(this.removeFromHistory(t),this.addToHistory(t))}addToHistory(e,t=!0){this.ensureHistoryLoaded(this.history);let o=this.editorHelper.preferResourceEditorInput(e);o&&(t?this.history.unshift(o):this.history.push(o),this.history.length>ER.MAX_HISTORY_ITEMS&&this.editorHelper.clearOnEditorDispose(this.history.pop(),this.editorHistoryListeners),Ta(e)&&this.editorHelper.onEditorDispose(e,()=>this.updateHistoryOnEditorDispose(o),this.editorHistoryListeners))}updateHistoryOnEditorDispose(e){if(Ta(e))if(!ldi(e))this.removeFromHistory(e);else{let t=[],o=e.primary.matches(e.secondary)?[e.primary]:[e.primary,e.secondary];for(let n of o){let r=this.editorHelper.preferResourceEditorInput(n);QS(r)&&this.includeInHistory(r)&&t.push(r)}this.replaceInHistory(e,...t)}else this.includeInHistory(e)||this.removeFromHistory(e)}includeInHistory(e){return Ta(e)?!0:!this.resourceExcludeMatcher.value.matches(e.resource)}removeExcludedFromHistory(){this.ensureHistoryLoaded(this.history),this.history=this.history.filter(e=>{let t=this.includeInHistory(e);return t||this.editorHelper.clearOnEditorDispose(e,this.editorHistoryListeners),t})}moveInHistory(e){e.isOperation(2)&&this.removeFromHistory(e)&&this.addToHistory({resource:e.target.resource})}removeFromHistory(e){let t=!1;return this.ensureHistoryLoaded(this.history),this.history=this.history.filter(o=>{let n=this.editorHelper.matchesEditor(e,o);return n&&(this.editorHelper.clearOnEditorDispose(e,this.editorHistoryListeners),t=!0),!n}),t}replaceInHistory(e,...t){this.ensureHistoryLoaded(this.history);let o=!1,n=[];for(let r of this.history)this.editorHelper.matchesEditor(e,r)?(this.editorHelper.clearOnEditorDispose(e,this.editorHistoryListeners),o||(n.push(...t),o=!0)):t.some(s=>this.editorHelper.matchesEditor(s,r))||n.push(r);o||n.push(...t),this.history=n}clearRecentlyOpened(){this.history=[],this.editorHistoryListeners.clearAndDisposeAll()}getHistory(){return this.ensureHistoryLoaded(this.history),this.history}ensureHistoryLoaded(e){this.history||(this.history=[],this.editorGroupService.isReady?this.loadHistory():(async()=>(await this.editorGroupService.whenReady,this.loadHistory()))())}loadHistory(){this.history=[];let e=this.loadHistoryFromStorage(),t=[...this.editorService.getEditors(0)].reverse(),o=new Set;for(let{editor:n}of t)if(this.includeInHistory(n)){if(n.resource){let r=`${n.resource.toString()}/${n.editorId}`;if(o.has(r))continue;o.add(r)}this.addToHistory(n)}for(let n of e){let r=`${n.resource.toString()}/${n.options?.override}`;!o.has(r)&&this.includeInHistory(n)&&(o.add(r),this.addToHistory(n,!1))}}loadHistoryFromStorage(){let e=[],t=this.storageService.get(ER.HISTORY_STORAGE_KEY,1);if(t)try{let o=JSON.parse(t);for(let n of o)if(!(!n.editor||!n.editor.resource))try{e.push({...n.editor,resource:typeof n.editor.resource=="string"?A.parse(n.editor.resource):A.from(n.editor.resource)})}catch(r){mt(r)}}catch(o){mt(o)}return e}saveState(){if(!this.history)return;let e=[];for(let t of this.history)Ta(t)||!QS(t)||e.push({editor:{...t,resource:t.resource.toString()}});this.storageService.store(ER.HISTORY_STORAGE_KEY,JSON.stringify(e),1,1)}getLastActiveWorkspaceRoot(e,t){let o=this.contextService.getWorkspace().folders;if(o.length!==0){if(o.length===1){let n=o[0].uri;return(!e||n.scheme===e)&&(!t||n.authority===t)?n:void 0}for(let n of this.getHistory()){if(Ta(n)||e&&n.resource.scheme!==e||t&&n.resource.authority!==t)continue;let r=this.contextService.getWorkspaceFolder(n.resource);if(r)return r.uri}for(let n of o){let r=n.uri;if((!e||r.scheme===e)&&(!t||r.authority===t))return r}}}getLastActiveFile(e,t){for(let o of this.getHistory()){let n;if(Ta(o)?n=no.getOriginalUri(o,{filterByScheme:e}):n=o.resource,n&&n.scheme===e&&(!t||n.authority===t))return n}}dispose(){super.dispose();for(let[,e]of this.editorGroupScopedNavigationStacks)e.disposable.dispose();for(let[,e]of this.editorScopedNavigationStacks)for(let[,t]of e)t.disposable.dispose();for(let[,e]of this.editorHistoryListeners)e.dispose()}};ER=I([m(0,ee),m(1,Et),m(2,Pe),m(3,le),m(4,B),m(5,be),m(6,Ff),m(7,F),m(8,fi),m(9,X),m(10,ne)],ER);we(zs,ER,0);var AOt=class{constructor(i,e,t){this.editorIdentifier=i;this.selection=e;this.reason=t}justifiesNewNavigationEntry(i){if(this.editorIdentifier.groupId!==i.editorIdentifier.groupId||!this.editorIdentifier.editor.matches(i.editorIdentifier.editor)||!this.selection||!i.selection)return!0;let e=this.selection.compare(i.selection);return e===2&&(i.reason===4||i.reason===5)?!0:e===3}},Fue=class extends C{constructor(e,t){super();this.scope=e;this.instantiationService=t;this.selectionsStack=this._register(this.instantiationService.createInstance(t4,0,this.scope)),this.editsStack=this._register(this.instantiationService.createInstance(t4,1,this.scope)),this.navigationsStack=this._register(this.instantiationService.createInstance(t4,2,this.scope)),this.stacks=[this.selectionsStack,this.editsStack,this.navigationsStack],this.onDidChange=H.any(this.selectionsStack.onDidChange,this.editsStack.onDidChange,this.navigationsStack.onDidChange)}canGoForward(e){return this.getStack(e).canGoForward()}goForward(e){return this.getStack(e).goForward()}canGoBack(e){return this.getStack(e).canGoBack()}goBack(e){return this.getStack(e).goBack()}goPrevious(e){return this.getStack(e).goPrevious()}canGoLast(e){return this.getStack(e).canGoLast()}goLast(e){return this.getStack(e).goLast()}getStack(e=0){switch(e){case 0:return this.selectionsStack;case 1:return this.editsStack;case 2:return this.navigationsStack}}handleActiveEditorChange(e){this.selectionsStack.notifyNavigation(e)}handleActiveEditorSelectionChange(e,t){let o=this.selectionsStack.current;this.selectionsStack.notifyNavigation(e,t),t.reason===3?this.editsStack.notifyNavigation(e,t):(t.reason===4||t.reason===5)&&!this.selectionsStack.isNavigating()&&(t.reason===5&&!this.navigationsStack.isNavigating()&&o&&this.navigationsStack.addOrReplace(o.groupId,o.editor,o.selection),this.navigationsStack.notifyNavigation(e,t))}clear(){for(let e of this.stacks)e.clear()}remove(e){for(let t of this.stacks)t.remove(e)}move(e){for(let t of this.stacks)t.move(e)}};Fue=I([m(1,F)],Fue);var Abi=class{constructor(){this.onDidChange=H.None}canGoForward(){return!1}async goForward(){}canGoBack(){return!1}async goBack(){}async goPrevious(){}canGoLast(){return!1}async goLast(){}handleActiveEditorChange(){}handleActiveEditorSelectionChange(){}clear(){}remove(){}move(){}dispose(){}},t4=class extends C{constructor(e,t,o,n,r,s){super();this.filter=e;this.scope=t;this.editorService=n;this.editorGroupService=r;this.logService=s;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this.mapEditorToDisposable=this._register(new jt);this.mapGroupToDisposable=this._register(new jt);this.stack=[];this.index=-1;this.previousIndex=-1;this.navigating=!1;this.currentSelectionState=void 0;this.editorHelper=o.createInstance(wDe),this.registerListeners()}static{this.MAX_STACK_SIZE=50}get current(){return this.stack[this.index]}set current(e){e&&(this.stack[this.index]=e)}registerListeners(){this._register(this.onDidChange(()=>this.traceStack())),this._register(this.logService.onDidChangeLogLevel(()=>this.traceStack())),this._register(this.editorGroupService.onDidRemoveGroup(e=>{this.mapGroupToDisposable.deleteAndDispose(e.id)}))}traceStack(){if(this.logService.getLevel()!==1)return;let e=[];for(let t of this.stack)typeof t.selection?.log=="function"?e.push(`- group: ${t.groupId}, editor: ${t.editor.resource?.toString()}, selection: ${t.selection.log()}`):e.push(`- group: ${t.groupId}, editor: ${t.editor.resource?.toString()}, selection: <none>`);e.length===0?this.trace(`index: ${this.index}, navigating: ${this.isNavigating()}: <empty>`):this.trace(`index: ${this.index}, navigating: ${this.isNavigating()}
${e.join(`
`)}
`)}trace(e,t=null,o){if(this.logService.getLevel()!==1)return;let n;switch(this.filter){case 0:n="global";break;case 1:n="edits";break;case 2:n="navigation";break}let r;switch(this.scope){case 0:r="default";break;case 1:r="editorGroup";break;case 2:r="editor";break}t!==null?this.logService.trace(`[History stack ${n}-${r}]: ${e} (editor: ${t?.resource?.toString()}, event: ${this.traceEvent(o)})`):this.logService.trace(`[History stack ${n}-${r}]: ${e}`)}traceEvent(e){if(!e)return"<none>";switch(e.reason){case 3:return"edit";case 4:return"navigation";case 5:return"jump";case 1:return"programmatic";case 2:return"user"}}registerGroupListeners(e){if(!this.mapGroupToDisposable.has(e)){let t=this.editorGroupService.getGroup(e);t&&this.mapGroupToDisposable.set(e,t.onWillMoveEditor(o=>this.onWillMoveEditor(o)))}}onWillMoveEditor(e){if(this.trace("onWillMoveEditor()",e.editor),this.scope!==1)for(let t of this.stack)t.groupId===e.groupId&&this.editorHelper.matchesEditor(e.editor,t.editor)&&(t.groupId=e.target)}notifyNavigation(e,t){this.trace("notifyNavigation()",e?.input,t);let o=pce(e),n=e?.input&&!e.input.isDisposed();this.navigating?(this.trace("notifyNavigation() ignoring (navigating)",e?.input,t),o&&n?(this.trace("notifyNavigation() updating current selection state",e?.input,t),this.currentSelectionState=new AOt({groupId:e.group.id,editor:e.input},e.getSelection(),t?.reason)):(this.trace("notifyNavigation() dropping current selection state",e?.input,t),this.currentSelectionState=void 0)):(this.trace("notifyNavigation() not ignoring",e?.input,t),o&&n?this.onSelectionAwareEditorNavigation(e.group.id,e.input,e.getSelection(),t):(this.currentSelectionState=void 0,n&&this.onNonSelectionAwareEditorNavigation(e.group.id,e.input)))}onSelectionAwareEditorNavigation(e,t,o,n){if(this.current?.groupId===e&&!o&&this.editorHelper.matchesEditor(this.current.editor,t))return;this.trace("onSelectionAwareEditorNavigation()",t,n);let r=new AOt({groupId:e,editor:t},o,n?.reason);!this.currentSelectionState||this.currentSelectionState.justifiesNewNavigationEntry(r)?this.doAdd(e,t,r.selection):this.doReplace(e,t,r.selection),this.currentSelectionState=r}onNonSelectionAwareEditorNavigation(e,t){this.current?.groupId===e&&this.editorHelper.matchesEditor(this.current.editor,t)||(this.trace("onNonSelectionAwareEditorNavigation()",t),this.doAdd(e,t))}doAdd(e,t,o){this.navigating||this.addOrReplace(e,t,o)}doReplace(e,t,o){this.navigating||this.addOrReplace(e,t,o,!0)}addOrReplace(e,t,o,n){this.registerGroupListeners(e);let r=!1;this.current&&(n||this.shouldReplaceStackEntry(this.current,{groupId:e,editor:t,selection:o}))&&(r=!0);let s=this.editorHelper.preferResourceEditorInput(t);if(!s)return;r?this.trace("replace()",s):this.trace("add()",s);let l={groupId:e,editor:s,selection:o},c=[];if(r)this.current&&c.push(this.current),this.current=l;else{if(this.stack.length>this.index+1){for(let u=this.index+1;u<this.stack.length;u++)c.push(this.stack[u]);this.stack=this.stack.slice(0,this.index+1)}this.stack.splice(this.index+1,0,l),this.stack.length>t4.MAX_STACK_SIZE?(c.push(this.stack.shift()),this.previousIndex>=0&&this.previousIndex--):this.setIndex(this.index+1,!0)}for(let u of c)this.editorHelper.clearOnEditorDispose(u.editor,this.mapEditorToDisposable);Ta(s)&&this.editorHelper.onEditorDispose(s,()=>this.remove(s),this.mapEditorToDisposable),this._onDidChange.fire()}shouldReplaceStackEntry(e,t){return e.groupId!==t.groupId||!this.editorHelper.matchesEditor(e.editor,t.editor)?!1:e.selection?t.selection?e.selection.compare(t.selection)===1:!1:!0}move(e){if(e.isOperation(2))for(let t of this.stack)this.editorHelper.matchesEditor(e,t.editor)&&(t.editor={resource:e.target.resource})}remove(e){let t=this.stack.length;this.stack=this.stack.filter(o=>{let n=typeof e=="number"?o.groupId===e:this.editorHelper.matchesEditor(e,o.editor);return n&&this.editorHelper.clearOnEditorDispose(o.editor,this.mapEditorToDisposable),!n}),t!==this.stack.length&&(this.flatten(),this.index=this.stack.length-1,this.previousIndex=-1,typeof e=="number"&&this.mapGroupToDisposable.deleteAndDispose(e),this._onDidChange.fire())}flatten(){let e=[],t;for(let o of this.stack)t&&this.shouldReplaceStackEntry(o,t)||(t=o,e.push(o));this.stack=e}clear(){this.index=-1,this.previousIndex=-1,this.stack.splice(0),this.mapEditorToDisposable.clearAndDisposeAll(),this.mapGroupToDisposable.clearAndDisposeAll()}dispose(){this.clear(),super.dispose()}canGoForward(){return this.stack.length>this.index+1}async goForward(){if(!await this.maybeGoCurrent()&&this.canGoForward())return this.setIndex(this.index+1),this.navigate()}canGoBack(){return this.index>0}async goBack(){if(!await this.maybeGoCurrent()&&this.canGoBack())return this.setIndex(this.index-1),this.navigate()}async goPrevious(){if(!await this.maybeGoCurrent())return this.previousIndex===-1?this.goBack():(this.setIndex(this.previousIndex),this.navigate())}canGoLast(){return this.stack.length>0}async goLast(){if(this.canGoLast())return this.setIndex(this.stack.length-1),this.navigate()}async maybeGoCurrent(){return this.filter===0||this.isCurrentSelectionActive()?!1:(await this.navigate(),!0)}isCurrentSelectionActive(){if(!this.current?.selection)return!1;let e=this.editorService.activeEditorPane;if(!pce(e)||e.group.id!==this.current.groupId||!e.input||!this.editorHelper.matchesEditor(e.input,this.current.editor))return!1;let t=e.getSelection();return t?t.compare(this.current.selection)===1:!1}setIndex(e,t){this.previousIndex=this.index,this.index=e,t||this._onDidChange.fire()}async navigate(){this.navigating=!0;try{this.current&&await this.doNavigate(this.current)}finally{this.navigating=!1}}doNavigate(e){let t=Object.create(null);return e.selection&&(t=e.selection.restore(t)),Ta(e.editor)?this.editorService.openEditor(e.editor,t,e.groupId):this.editorService.openEditor({...e.editor,options:{...e.editor.options,...t}},e.groupId)}isNavigating(){return this.navigating}};t4=I([m(2,F),m(3,ee),m(4,Et),m(5,ne)],t4);var wDe=class{constructor(i,e,t,o){this.uriIdentityService=i;this.lifecycleService=e;this.fileService=t;this.pathService=o}preferResourceEditorInput(i){let e=no.getOriginalUri(i);if(e?.scheme===Y.file||e?.scheme===Y.vscodeRemote||e?.scheme===Y.vscodeUserData||e?.scheme===this.pathService.defaultUriScheme){if(Ta(i)){let o=i.toUntyped();if(QS(o))return o}return i}else return Ta(i)?i:void 0}matchesEditor(i,e){return i instanceof FN||i instanceof ON?Ta(e)?!1:i instanceof FN?i.contains(e.resource,2):this.matchesFile(e.resource,i):Ta(i)?Ta(e)?i.matches(e):this.matchesFile(e.resource,i):Ta(e)?this.matchesFile(i.resource,e):i&&e&&this.uriIdentityService.extUri.isEqual(i.resource,e.resource)}matchesFile(i,e){if(e instanceof FN)return e.contains(i,2);if(e instanceof ON)return this.uriIdentityService.extUri.isEqualOrParent(i,e.resource);if(Ta(e)){let t=e.resource;return!t||this.lifecycleService.phase>=3&&!this.fileService.hasProvider(t)?!1:this.uriIdentityService.extUri.isEqual(t,i)}return this.uriIdentityService.extUri.isEqual(e?.resource,i)}matchesEditorIdentifier(i,e){return!e?.group||i.groupId!==e.group.id?!1:e.input?i.editor.matches(e.input):!1}onEditorDispose(i,e,t){let o=H.once(i.onWillDispose)(()=>e()),n=t.get(i);n||(n=new P,t.set(i,n)),n.add(o)}clearOnEditorDispose(i,e){Ta(i)&&e.deleteAndDispose(i)}};wDe=I([m(0,dt),m(1,ao),m(2,be),m(3,wn)],wDe);var NOt="workbench.actions.manage",OOt="workbench.actions.accounts";var HYe=class extends C{constructor(e,t,o){super();this.viewId=e;this.viewDescriptorService=t;this.activityService=o;this.activity=void 0;this.activityDisposable=C.None;this._register(H.filter(this.viewDescriptorService.onDidChangeContainer,n=>n.views.some(r=>r.id===e))(()=>this.update())),this._register(H.filter(this.viewDescriptorService.onDidChangeLocation,n=>n.views.some(r=>r.id===e))(()=>this.update()))}setActivity(e){this.activity=e,this.update()}clearActivity(){this.activity=void 0,this.update()}update(){this.activityDisposable.dispose();let e=this.viewDescriptorService.getViewContainerByViewId(this.viewId);e&&this.activity&&(this.activityDisposable=this.activityService.showViewContainerActivity(e.id,this.activity))}dispose(){this.activityDisposable.dispose(),super.dispose()}};HYe=I([m(1,Ri),m(2,zl)],HYe);var UYe=class extends C{constructor(e,t){super();this.viewDescriptorService=e;this.instantiationService=t;this.viewActivities=new Map;this._onDidChangeActivity=this._register(new E);this.onDidChangeActivity=this._onDidChangeActivity.event;this.viewContainerActivities=new Map;this.globalActivities=new Map}showViewContainerActivity(e,t){let o=this.viewDescriptorService.getViewContainerById(e);if(!o)return C.None;let n=this.viewContainerActivities.get(e);return n||(n=[],this.viewContainerActivities.set(e,n)),n.push(t),this._onDidChangeActivity.fire(o),Z(()=>{n.splice(n.indexOf(t),1),n.length===0&&this.viewContainerActivities.delete(e),this._onDidChangeActivity.fire(o)})}getViewContainerActivities(e){return this.viewDescriptorService.getViewContainerById(e)?this.viewContainerActivities.get(e)??[]:[]}showViewActivity(e,t){let o=this.viewActivities.get(e);o?o.id++:(o={id:1,activity:this.instantiationService.createInstance(HYe,e)},this.viewActivities.set(e,o));let n=o.id;o.activity.setActivity(t);let r=o;return Z(()=>{r.id===n&&(r.activity.dispose(),this.viewActivities.delete(e))})}showAccountsActivity(e){return this.showActivity(OOt,e)}showGlobalActivity(e){return this.showActivity(NOt,e)}getActivity(e){return this.globalActivities.get(e)??[]}showActivity(e,t){let o=this.globalActivities.get(e);return o||(o=[],this.globalActivities.set(e,o)),o.push(t),this._onDidChangeActivity.fire(e),Z(()=>{o.splice(o.indexOf(t),1),o.length===0&&this.globalActivities.delete(e),this._onDidChangeActivity.fire(e)})}};UYe=I([m(0,Ri),m(1,F)],UYe);we(zl,UYe,1);var SF=class{static _readModifiers(i){i=i.toLowerCase().trim();let e=!1,t=!1,o=!1,n=!1,r;do r=!1,/^ctrl(\+|\-)/.test(i)&&(e=!0,i=i.substr(5),r=!0),/^shift(\+|\-)/.test(i)&&(t=!0,i=i.substr(6),r=!0),/^alt(\+|\-)/.test(i)&&(o=!0,i=i.substr(4),r=!0),/^meta(\+|\-)/.test(i)&&(n=!0,i=i.substr(5),r=!0),/^win(\+|\-)/.test(i)&&(n=!0,i=i.substr(4),r=!0),/^cmd(\+|\-)/.test(i)&&(n=!0,i=i.substr(4),r=!0);while(r);let s,l=i.indexOf(" ");return l>0?(s=i.substring(0,l),i=i.substring(l)):(s=i,i=""),{remains:i,ctrl:e,shift:t,alt:o,meta:n,key:s}}static parseChord(i){let e=this._readModifiers(i),t=e.key.match(/^\[([^\]]+)\]$/);if(t){let n=t[1],r=Bb.lowerCaseToEnum(n);return[new KD(e.ctrl,e.shift,e.alt,e.meta,r),e.remains]}let o=vp.fromUserSettings(e.key);return[new Hb(e.ctrl,e.shift,e.alt,e.meta,o),e.remains]}static parseKeybinding(i){if(!i)return null;let e=[],t;for(;i.length>0;)[t,i]=this.parseChord(i),e.push(t);return e.length>0?new tU(e):null}};var Cjo=/^(cursor|delete|undo|redo|tab|editor\.action\.clipboard)/,FOt=class extends C{constructor(e,t,o,n,r){super();this._contextKeyService=e;this._commandService=t;this._telemetryService=o;this._notificationService=n;this._logService=r;this._onDidUpdateKeybindings=this._register(new E);this._currentChords=[],this._currentChordChecker=new EI,this._currentChordStatusMessage=null,this._ignoreSingleModifiers=CDe.EMPTY,this._currentSingleModifier=null,this._currentSingleModifierClearTimeout=new Nl,this._currentlyDispatchingCommandId=null,this._logging=!1}get onDidUpdateKeybindings(){return this._onDidUpdateKeybindings?this._onDidUpdateKeybindings.event:H.None}get inChordMode(){return this._currentChords.length>0}dispose(){super.dispose()}getDefaultKeybindingsContent(){return""}toggleLogging(){return this._logging=!this._logging,this._logging}_log(e){this._logging&&this._logService.info(`[KeybindingService]: ${e}`)}getDefaultKeybindings(){return this._getResolver().getDefaultKeybindings()}getKeybindings(){return this._getResolver().getKeybindings()}customKeybindingsCount(){return 0}lookupKeybindings(e){return si(this._getResolver().lookupKeybindings(e).map(t=>t.resolvedKeybinding))}lookupKeybinding(e,t,o=!1){let n=this._getResolver().lookupPrimaryKeybinding(e,t||this._contextKeyService,o);if(n)return n.resolvedKeybinding}dispatchEvent(e,t){return this._dispatch(e,t)}softDispatch(e,t){this._log("/ Soft dispatching keyboard event");let o=this.resolveKeyboardEvent(e);if(o.hasMultipleChords())return console.warn("keyboard event should not be mapped to multiple chords"),m5e;let[n]=o.getDispatchChords();if(n===null)return this._log("\\ Keyboard event cannot be dispatched"),m5e;let r=this._contextKeyService.getContext(t),s=this._currentChords.map((({keypress:l})=>l));return this._getResolver().resolve(r,s,n)}_scheduleLeaveChordMode(){let e=Date.now();this._currentChordChecker.cancelAndSet(()=>{if(!this._documentHasFocus()){this._leaveChordMode();return}Date.now()-e>5e3&&this._leaveChordMode()},500)}_expectAnotherChord(e,t){switch(this._currentChords.push({keypress:e,label:t}),this._currentChords.length){case 0:throw Xve("impossible");case 1:this._currentChordStatusMessage=this._notificationService.status(d(2102,null,t));break;default:{let o=this._currentChords.map(({label:n})=>n).join(", ");this._currentChordStatusMessage=this._notificationService.status(d(2105,null,o))}}this._scheduleLeaveChordMode(),ZT.enabled&&ZT.disable()}_leaveChordMode(){this._currentChordStatusMessage&&(this._currentChordStatusMessage.close(),this._currentChordStatusMessage=null),this._currentChordChecker.cancel(),this._currentChords=[],ZT.enable()}dispatchByUserSettingsLabel(e,t){this._log(`/ Dispatching keybinding triggered via menu entry accelerator - ${e}`);let o=this.resolveUserBinding(e);o.length===0?this._log(`\\ Could not resolve - ${e}`):this._doDispatch(o[0],t,!1)}_dispatch(e,t){return this._doDispatch(this.resolveKeyboardEvent(e),t,!1)}_singleModifierDispatch(e,t){let o=this.resolveKeyboardEvent(e),[n]=o.getSingleModifierDispatchChords();if(n)return this._ignoreSingleModifiers.has(n)?(this._log(`+ Ignoring single modifier ${n} due to it being pressed together with other keys.`),this._ignoreSingleModifiers=CDe.EMPTY,this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,!1):(this._ignoreSingleModifiers=CDe.EMPTY,this._currentSingleModifier===null?(this._log(`+ Storing single modifier for possible chord ${n}.`),this._currentSingleModifier=n,this._currentSingleModifierClearTimeout.cancelAndSet(()=>{this._log("+ Clearing single modifier due to 300ms elapsed."),this._currentSingleModifier=null},300),!1):n===this._currentSingleModifier?(this._log(`/ Dispatching single modifier chord ${n} ${n}`),this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,this._doDispatch(o,t,!0)):(this._log(`+ Clearing single modifier due to modifier mismatch: ${this._currentSingleModifier} ${n}`),this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,!1));let[r]=o.getChords();return this._ignoreSingleModifiers=new CDe(r),this._currentSingleModifier!==null&&this._log("+ Clearing single modifier due to other key up."),this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,!1}_doDispatch(e,t,o=!1){let n=!1;if(e.hasMultipleChords())return console.warn("Unexpected keyboard event mapped to multiple chords"),!1;let r=null,s=null;if(o){let[p]=e.getSingleModifierDispatchChords();r=p,s=p?[p]:[]}else[r]=e.getDispatchChords(),s=this._currentChords.map(({keypress:p})=>p);if(r===null)return this._log("\\ Keyboard event cannot be dispatched in keydown phase."),n;let l=this._contextKeyService.getContext(t),c=e.getLabel(),u=this._getResolver().resolve(l,s,r);switch(u.kind){case 0:{if(this._logService.trace("KeybindingService#dispatch",c,"[ No matching keybinding ]"),this.inChordMode){let p=this._currentChords.map(({label:h})=>h).join(", ");this._log(`+ Leaving multi-chord mode: Nothing bound to "${p}, ${c}".`),this._notificationService.status(d(2104,null,p,c),{hideAfter:10*1e3}),this._leaveChordMode(),n=!0}return n}case 1:return this._logService.trace("KeybindingService#dispatch",c,"[ Several keybindings match - more chords needed ]"),n=!0,this._expectAnotherChord(r,c),this._log(this._currentChords.length===1?"+ Entering multi-chord mode...":"+ Continuing multi-chord mode..."),n;case 2:{if(this._logService.trace("KeybindingService#dispatch",c,`[ Will dispatch command ${u.commandId} ]`),u.commandId===null||u.commandId===""){if(this.inChordMode){let p=this._currentChords.map(({label:h})=>h).join(", ");this._log(`+ Leaving chord mode: Nothing bound to "${p}, ${c}".`),this._notificationService.status(d(2104,null,p,c),{hideAfter:10*1e3}),this._leaveChordMode(),n=!0}}else{this.inChordMode&&this._leaveChordMode(),u.isBubble||(n=!0),this._log(`+ Invoking command ${u.commandId}.`),this._currentlyDispatchingCommandId=u.commandId;try{typeof u.commandArgs>"u"?this._commandService.executeCommand(u.commandId).then(void 0,p=>this._notificationService.warn(p)):this._commandService.executeCommand(u.commandId,u.commandArgs).then(void 0,p=>this._notificationService.warn(p))}finally{this._currentlyDispatchingCommandId=null}Cjo.test(u.commandId)||this._telemetryService.publicLog2("workbenchActionExecuted",{id:u.commandId,from:"keybinding",detail:e.getUserSettingsLabel()??void 0})}return n}}}mightProducePrintableCharacter(e){return e.ctrlKey||e.metaKey?!1:e.keyCode>=31&&e.keyCode<=56||e.keyCode>=21&&e.keyCode<=30}appendKeybinding(e,t,o,n){if(t){let r=this.lookupKeybinding(t,o,n)?.getLabel();if(r)return d(2103,null,e,r)}return e}},CDe=class a{static{this.EMPTY=new a(null)}constructor(i){this._ctrlKey=i?i.ctrlKey:!1,this._shiftKey=i?i.shiftKey:!1,this._altKey=i?i.altKey:!1,this._metaKey=i?i.metaKey:!1}has(i){switch(i){case"ctrl":return this._ctrlKey;case"shift":return this._shiftKey;case"alt":return this._altKey;case"meta":return this._metaKey}}};var WOt=ae("keyboardLayoutService");function xjo(a,i){return!a&&!i?!0:!a||!i?!1:a.vkey===i.vkey&&a.value===i.value&&a.withShift===i.withShift&&a.withAltGr===i.withAltGr&&a.withShiftAltGr===i.withShiftAltGr}function Kno(a,i){if(!a&&!i)return!0;if(!a||!i)return!1;for(let e=0;e<193;e++){let t=Bb.toString(e),o=a[t],n=i[t];if(!xjo(o,n))return!1}return!0}function kjo(a,i){return!a&&!i?!0:!a||!i?!1:a.value===i.value&&a.withShift===i.withShift&&a.withAltGr===i.withAltGr&&a.withShiftAltGr===i.withShiftAltGr}function Gno(a,i){if(!a&&!i)return!0;if(!a||!i)return!1;for(let e=0;e<193;e++){let t=Bb.toString(e),o=a[t],n=i[t];if(!kjo(o,n))return!1}return!0}var zYe=class{static writeKeybindingItem(i,e){if(!e.resolvedKeybinding)return;let t=JSON.stringify(e.resolvedKeybinding.getUserSettingsLabel());i.write(`{ "key": ${Ejo(t+",",25)} "command": `);let o=e.when?JSON.stringify(e.when.serialize()):"",n=JSON.stringify(e.command);o.length>0?(i.write(`${n},`),i.writeLine(),i.write(` "when": ${o}`)):i.write(`${n}`),e.commandArgs&&(i.write(","),i.writeLine(),i.write(` "args": ${JSON.stringify(e.commandArgs)}`)),i.write(" }")}static readUserKeybindingItem(i){let e="key"in i&&typeof i.key=="string"?SF.parseKeybinding(i.key):null,t="when"in i&&typeof i.when=="string"?x.deserialize(i.when):void 0,o="command"in i&&typeof i.command=="string"?i.command:null,n="args"in i&&typeof i.args<"u"?i.args:void 0;return{keybinding:e,command:o,commandArgs:n,when:t,_sourceKey:"key"in i&&typeof i.key=="string"?i.key:void 0}}};function Ejo(a,i){return a.length<i?a+new Array(i-a.length).join(" "):a}var VOt=class{constructor(){this._lines=[];this._currentLine=""}write(i){this._currentLine+=i}writeLine(i=""){this._lines.push(this._currentLine+i),this._currentLine=""}toString(){return this.writeLine(),this._lines.join(`
`)}};function Tjo(a,i){return a?typeof a.command!="string"?(i.push(d(17069,null,"command")),!1):a.key&&typeof a.key!="string"?(i.push(d(17068,null,"key")),!1):a.when&&typeof a.when!="string"?(i.push(d(17068,null,"when")),!1):a.mac&&typeof a.mac!="string"?(i.push(d(17068,null,"mac")),!1):a.linux&&typeof a.linux!="string"?(i.push(d(17068,null,"linux")),!1):a.win&&typeof a.win!="string"?(i.push(d(17068,null,"win")),!1):!0:(i.push(d(17067,null)),!1)}var $no={type:"object",default:{command:"",key:""},required:["command","key"],properties:{command:{description:d(17073,null),type:"string"},args:{description:d(17072,null)},key:{description:d(17074,null),type:"string"},mac:{description:d(17076,null),type:"string"},linux:{description:d(17075,null),type:"string"},win:{description:d(17078,null),type:"string"},when:{description:d(17077,null),type:"string"}}},qno=Tn.registerExtensionPoint({extensionPoint:"keybindings",deps:[vfi],jsonSchema:{description:d(17071,null),oneOf:[$no,{type:"array",items:$no}]}}),_jo=[90,91,92,93,95,96,97,98,99,100,101,102,103,104,105],YV=new Map;YV.set(95,22);YV.set(96,23);YV.set(97,24);YV.set(98,25);YV.set(99,26);YV.set(100,27);YV.set(101,28);YV.set(102,29);YV.set(103,30);YV.set(104,21);var i4=class extends FOt{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,t,o,n,p);this.hostService=s;this.keyboardLayoutService=h;this._contributions=[];this.isComposingGlobalContextKey=e.createKey(ue.isComposing.key,!1),this.kbsJsonSchema=new Obi,this.updateKeybindingsJsonSchema(),this._keyboardMapper=this.keyboardLayoutService.getKeyboardMapper(),this._register(this.keyboardLayoutService.onDidChangeKeyboardLayout(()=>{this._keyboardMapper=this.keyboardLayoutService.getKeyboardMapper(),this.updateResolver()})),this._keybindingHoldMode=null,this._cachedResolver=null,this.userKeybindings=this._register(new Nbi(r,u,c,p)),this.userKeybindings.initialize().then(()=>{this.userKeybindings.keybindings.length&&this.updateResolver()}),this._register(this.userKeybindings.onDidChange(()=>{p.debug("User keybindings changed"),this.updateResolver()})),qno.setHandler(g=>{let f=[];for(let v of g)this._handleKeybindingsExtensionPointUser(v.description.identifier,v.description.isBuiltin,v.value,v.collector,f);yt.setExtensionKeybindings(f),this.updateResolver()}),this.updateKeybindingsJsonSchema(),this._register(l.onDidRegisterExtensions(()=>this.updateKeybindingsJsonSchema())),this._register(H.runAndSubscribe(Fg,({window:g,disposables:f})=>f.add(this._registerKeyListeners(g)),{window:It,disposables:this._store})),this._register(Bk(g=>{if(g!==It.vscodeWindowId)return;let f=navigator.keyboard;og.keyboard!==2&&(wS(It)?f?.lock(["Escape"]):f?.unlock(),this._cachedResolver=null,this._onDidUpdateKeybindings.fire())}))}dispose(){this._contributions.forEach(e=>e.listener?.dispose()),this._contributions.length=0,super.dispose()}_registerKeyListeners(e){let t=new P;return t.add(j(e,re.KEY_DOWN,o=>{if(this._keybindingHoldMode)return;this.isComposingGlobalContextKey.set(o.isComposing);let n=new Ii(o);this._log(`/ Received keydown event - ${ZUi(o)}`),this._log(`| Converted keydown event - ${e1i(n)}`),this._dispatch(n,n.target)&&n.preventDefault(),this.isComposingGlobalContextKey.set(!1)})),t.add(j(e,re.KEY_UP,o=>{this._resetKeybindingHoldMode(),this.isComposingGlobalContextKey.set(o.isComposing);let n=new Ii(o);this._singleModifierDispatch(n,n.target)&&n.preventDefault(),this.isComposingGlobalContextKey.set(!1)})),t}registerSchemaContribution(e){let t=e.onDidChange?.(()=>this.updateKeybindingsJsonSchema()),o={listener:t,contribution:e};return this._contributions.push(o),this.updateKeybindingsJsonSchema(),Z(()=>{t?.dispose(),tGe(this._contributions,o),this.updateKeybindingsJsonSchema()})}updateKeybindingsJsonSchema(){this.kbsJsonSchema.updateSchema(this._contributions.flatMap(e=>e.contribution.getSchemaAdditions()))}_printKeybinding(e){return Xye.toLabel(zo,e.chords,t=>t instanceof Hb?vp.toString(t.keyCode):Bb.toString(t.scanCode))||"[null]"}_printResolvedKeybinding(e){return e.getDispatchChords().map(t=>t||"[null]").join(" ")}_printResolvedKeybindings(e,t,o){let r=`${t.padStart(35," ")} => `;if(o.length===0){e.push(`${r}${"[NO BINDING]".padStart(35," ")}`);return}let s=r.length,l=!0;for(let c of o)l?e.push(`${r}${this._printResolvedKeybinding(c).padStart(35," ")}`):e.push(`${" ".repeat(s)}${this._printResolvedKeybinding(c).padStart(35," ")}`)}_dumpResolveKeybindingDebugInfo(){let e=new Set,t=[];t.push("Default Resolved Keybindings (unique only):");for(let o of yt.getDefaultKeybindings()){if(!o.keybinding)continue;let n=this._printKeybinding(o.keybinding);if(e.has(n))continue;e.add(n);let r=this._keyboardMapper.resolveKeybinding(o.keybinding);this._printResolvedKeybindings(t,n,r)}t.push("User Resolved Keybindings (unique only):");for(let o of this.userKeybindings.keybindings){if(!o.keybinding)continue;let n=o._sourceKey??"Impossible: missing source key, but has keybinding";if(e.has(n))continue;e.add(n);let r=this._keyboardMapper.resolveKeybinding(o.keybinding);this._printResolvedKeybindings(t,n,r)}return t.join(`
`)}_dumpDebugInfo(){let e=JSON.stringify(this.keyboardLayoutService.getCurrentKeyboardLayout(),null," "),t=this._keyboardMapper.dumpDebugInfo(),o=this._dumpResolveKeybindingDebugInfo(),n=JSON.stringify(this.keyboardLayoutService.getRawKeyboardMapping(),null," ");return`Layout info:
${e}
${o}
${t}
Raw mapping:
${n}`}_dumpDebugInfoJSON(){let e={layout:this.keyboardLayoutService.getCurrentKeyboardLayout(),rawMapping:this.keyboardLayoutService.getRawKeyboardMapping()};return JSON.stringify(e,null," ")}enableKeybindingHoldMode(e){if(this._currentlyDispatchingCommandId!==e)return;this._keybindingHoldMode=new Go;let t=Vn(Me(void 0)),o=t.onDidBlur(()=>this._resetKeybindingHoldMode());return this._keybindingHoldMode.p.finally(()=>{o.dispose(),t.dispose()}),this._log(`+ Enabled hold-mode for ${e}.`),this._keybindingHoldMode.p}_resetKeybindingHoldMode(){this._keybindingHoldMode&&(this._keybindingHoldMode?.complete(),this._keybindingHoldMode=null)}customKeybindingsCount(){return this.userKeybindings.keybindings.length}updateResolver(){this._cachedResolver=null,this._onDidUpdateKeybindings.fire()}_getResolver(){if(!this._cachedResolver){let e=this._resolveKeybindingItems(yt.getDefaultKeybindings(),!0),t=this._resolveUserKeybindingItems(this.userKeybindings.keybindings,!1);this._cachedResolver=new MIt(e,t,o=>this._log(o))}return this._cachedResolver}_documentHasFocus(){return this.hostService.hasFocus}_resolveKeybindingItems(e,t){let o=[],n=0;for(let r of e){let s=r.when||void 0,l=r.keybinding;if(!l)o[n++]=new IK(void 0,r.command,r.commandArgs,s,t,r.extensionId,r.isBuiltinExtension);else{if(this._assertBrowserConflicts(l))continue;let c=this._keyboardMapper.resolveKeybinding(l);for(let u=c.length-1;u>=0;u--){let p=c[u];o[n++]=new IK(p,r.command,r.commandArgs,s,t,r.extensionId,r.isBuiltinExtension)}}}return o}_resolveUserKeybindingItems(e,t){let o=[],n=0;for(let r of e){let s=r.when||void 0;if(!r.keybinding)o[n++]=new IK(void 0,r.command,r.commandArgs,s,t,null,!1);else{let l=this._keyboardMapper.resolveKeybinding(r.keybinding);for(let c of l)o[n++]=new IK(c,r.command,r.commandArgs,s,t,null,!1)}}return o}_assertBrowserConflicts(e){if(og.keyboard===0||og.keyboard===1&&wS(It))return!1;for(let t of e.chords){if(!t.metaKey&&!t.altKey&&!t.ctrlKey&&!t.shiftKey)continue;let o=3584,n=0;if(t.metaKey&&(n|=2048),t.shiftKey&&(n|=1024),t.altKey&&(n|=512),t.ctrlKey&&zo===2&&(n|=256),(n&o)===2560&&(t instanceof KD&&(t.scanCode===86||t.scanCode===85)||t instanceof Hb&&(t.keyCode===15||t.keyCode===17))||(n&o)===2048&&(t instanceof KD&&t.scanCode>=36&&t.scanCode<=45||t instanceof Hb&&t.keyCode>=21&&t.keyCode<=30))return!0}return!1}resolveKeybinding(e){return this._keyboardMapper.resolveKeybinding(e)}resolveKeyboardEvent(e){return this.keyboardLayoutService.validateCurrentKeyboardMapping(e),this._keyboardMapper.resolveKeyboardEvent(e)}resolveUserBinding(e){let t=SF.parseKeybinding(e);return t?this._keyboardMapper.resolveKeybinding(t):[]}_handleKeybindingsExtensionPointUser(e,t,o,n,r){if(Array.isArray(o))for(let s=0,l=o.length;s<l;s++)this._handleKeybinding(e,t,s+1,o[s],n,r);else this._handleKeybinding(e,t,1,o,n,r)}_handleKeybinding(e,t,o,n,r,s){let l=[];if(Tjo(n,l)){let c=this._asCommandRule(e,t,o++,n);c&&s.push(c)}l.length>0&&r.error(d(17059,null,qno.name,l.join(`
`)))}static bindToCurrentPlatform(e,t,o,n){if(zo===1&&n){if(n)return n}else if(zo===2){if(t)return t}else if(o)return o;return e}_asCommandRule(e,t,o,n){let{command:r,args:s,when:l,key:c,mac:u,linux:p,win:h}=n,g=i4.bindToCurrentPlatform(c,u,p,h);if(!g)return;let f;t?f=300+o:f=400+o;let v=fe.getCommand(r),b=v&&v.precondition,S;return l&&b?S=x.and(b,x.deserialize(l)):l?S=x.deserialize(l):b&&(S=b),{id:r,args:s,when:S,weight:f,keybinding:SF.parseKeybinding(g),extensionId:e.value,isBuiltinExtension:t}}getDefaultKeybindingsContent(){let e=this._getResolver(),t=e.getDefaultKeybindings(),o=e.getDefaultBoundCommands();return i4._getDefaultKeybindings(t)+`
`+i4._getAllCommandsAsComment(o)}static _getDefaultKeybindings(e){let t=new VOt;t.writeLine("[");let o=e.length-1;return e.forEach((n,r)=>{zYe.writeKeybindingItem(t,n),r!==o?t.writeLine(","):t.writeLine()}),t.writeLine("]"),t.toString()}static _getAllCommandsAsComment(e){let o=LOt(e).sort().join(`
// - `);return"// "+d(17070,null)+`
// - `+o}mightProducePrintableCharacter(e){if(e.ctrlKey||e.metaKey||e.altKey)return!1;let t=Bb.toEnum(e.code);if(_jo.indexOf(t)!==-1)return!!(e.keyCode===Dy[t]||it&&e.keyCode===YV.get(t));if(Dy[t]!==-1)return!1;let n=this.keyboardLayoutService.getRawKeyboardMapping();if(!n)return!1;let r=n[e.code];return!(!r||!r.value||/\s/.test(r.value))}};i4=I([m(0,X),m(1,ge),m(2,Te),m(3,Ne),m(4,mn),m(5,oi),m(6,lt),m(7,be),m(8,dt),m(9,ne),m(10,WOt)],i4);var Nbi=class extends C{constructor(e,t,o,n){super();this.userDataProfileService=e;this.uriIdentityService=t;this.fileService=o;this._rawKeybindings=[];this._keybindings=[];this.watchDisposables=this._register(new P);this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this.watch(),this.reloadConfigurationScheduler=this._register(new Dt(()=>this.reload().then(r=>{r&&this._onDidChange.fire()}),50)),this._register(H.filter(this.fileService.onDidFilesChange,r=>r.contains(this.userDataProfileService.currentProfile.keybindingsResource))(()=>{n.debug("Keybindings file changed"),this.reloadConfigurationScheduler.schedule()})),this._register(this.fileService.onDidRunOperation(r=>{r.operation===4&&r.resource.toString()===this.userDataProfileService.currentProfile.keybindingsResource.toString()&&(n.debug("Keybindings file written"),this.reloadConfigurationScheduler.schedule())})),this._register(e.onDidChangeCurrentProfile(r=>{this.uriIdentityService.extUri.isEqual(r.previous.keybindingsResource,r.profile.keybindingsResource)||r.join(this.whenCurrentProfileChanged())}))}get keybindings(){return this._keybindings}async whenCurrentProfileChanged(){this.watch(),this.reloadConfigurationScheduler.schedule()}watch(){this.watchDisposables.clear(),this.watchDisposables.add(this.fileService.watch(ci(this.userDataProfileService.currentProfile.keybindingsResource))),this.watchDisposables.add(this.fileService.watch(this.userDataProfileService.currentProfile.keybindingsResource))}async initialize(){await this.reload()}async reload(){let e=await this.readUserKeybindings();return uo(this._rawKeybindings,e)?!1:(this._rawKeybindings=e,this._keybindings=this._rawKeybindings.map(t=>zYe.readUserKeybindingItem(t)),!0)}async readUserKeybindings(){try{let e=await this.fileService.readFile(this.userDataProfileService.currentProfile.keybindingsResource),t=Ur(e.value.toString());return Array.isArray(t)?t.filter(o=>o&&typeof o=="object"):[]}catch{return[]}}},Obi=class a{constructor(){this.commandsSchemas=[];this.commandsEnum=[];this.removalCommandsEnum=[];this.commandsEnumDescriptions=[];this.schema={id:a.schemaId,type:"array",title:d(17065,null),allowTrailingCommas:!0,allowComments:!0,definitions:{editorGroupsSchema:{type:"array",items:{type:"object",properties:{groups:{$ref:"#/definitions/editorGroupsSchema",default:[{},{}]},size:{type:"number",default:.5}}}},commandNames:{type:"string",enum:this.commandsEnum,enumDescriptions:this.commandsEnumDescriptions,description:d(17062,null)},commandType:{anyOf:[{$ref:"#/definitions/commandNames"},{type:"string",enum:this.removalCommandsEnum,enumDescriptions:this.commandsEnumDescriptions,description:d(17064,null)},{type:"string"}]},commandsSchemas:{allOf:this.commandsSchemas}},items:{required:["key"],type:"object",defaultSnippets:[{body:{key:"$1",command:"$2",when:"$3"}}],properties:{key:{type:"string",description:d(17063,null)},command:{anyOf:[{if:{type:"array"},then:{not:{type:"array"},errorMessage:d(17060,null,"string")},else:{$ref:"#/definitions/commandType"}},{$ref:"#/definitions/commandType"}]},when:{type:"string",description:d(17066,null)},args:{description:d(17061,null)}},$ref:"#/definitions/commandsSchemas"}};this.schemaRegistry=oe.as(ea.JSONContribution);this.schemaRegistry.registerSchema(a.schemaId,this.schema)}static{this.schemaId="vscode://schemas/keybindings"}updateSchema(i){this.commandsSchemas.length=0,this.commandsEnum.length=0,this.removalCommandsEnum.length=0,this.commandsEnumDescriptions.length=0;let e=new Set,t=(r,s)=>{/^_/.test(r)||e.has(r)||(e.add(r),this.commandsEnum.push(r),this.commandsEnumDescriptions.push(s===void 0?"":xq(s)?s.value:s),this.removalCommandsEnum.push(`-${r}`))},o=qe.getCommands();for(let[r,s]of o){let l=s.metadata;if(t(r,l?.description??fe.getCommand(r)?.title),!l||!l.args||l.args.length!==1||!l.args[0].schema)continue;let c=l.args[0].schema,u=typeof l.args[0].isOptional<"u"?!l.args[0].isOptional:Array.isArray(c.required)&&c.required.length>0,p={if:{required:["command"],properties:{command:{const:r}}},then:{required:[].concat(u?["args"]:[]),properties:{args:c}}};this.commandsSchemas.push(p)}let n=fe.getCommands();for(let r of n.keys())t(r);this.commandsSchemas.push(...i),this.schemaRegistry.notifySchemaChanged(a.schemaId)}};we(_e,i4,0);var KYe=class{constructor(i,e,t,o){this.configurationService=i;this.environmentService=t;this.storageService=o;this.remoteEnvironment=null;e.getEnvironment().then(n=>this.remoteEnvironment=n)}getEOL(i,e){let t=this.configurationService.getValue("files.eol",{overrideIdentifier:e,resource:i});if(t&&typeof t=="string"&&t!=="auto")return t;let o=this.getOS(i);return o===3||o===2?`
`:`\r
`}getOS(i){let e=zo,t=this.environmentService.remoteAuthority;if(t&&i&&i.scheme!==Y.file){let o=`resource.authority.os.${t}`;e=this.remoteEnvironment?this.remoteEnvironment.os:this.storageService.getNumber(o,1,zo),this.storageService.store(o,e,1,1)}return e}};KYe=I([m(0,B),m(1,yo),m(2,Vt),m(3,le)],KYe);we(sL,KYe,1);function OJ(a){return a.toString()}var Fbi=class{constructor(i,e,t){this.model=i;this._modelEventListeners=new P;this.model=i,this._modelEventListeners.add(i.onWillDispose(()=>e(i))),this._modelEventListeners.add(i.onDidChangeLanguage(o=>t(i,o)))}dispose(){this._modelEventListeners.dispose()}},Djo=Wn||it?1:2,Wbi=class{constructor(i,e,t,o,n,r,s,l){this.uri=i;this.initialUndoRedoSnapshot=e;this.time=t;this.sharesUndoRedoStack=o;this.heapSize=n;this.sha1=r;this.versionId=s;this.alternativeVersionId=l}},IF=class extends C{constructor(e,t,o,n){super();this._configurationService=e;this._resourcePropertiesService=t;this._undoRedoService=o;this._instantiationService=n;this._onModelAdded=this._register(new E);this.onModelAdded=this._onModelAdded.event;this._onModelRemoved=this._register(new E);this.onModelRemoved=this._onModelRemoved.event;this._onModelModeChanged=this._register(new E);this.onModelLanguageChanged=this._onModelModeChanged.event;this._modelCreationOptionsByLanguageAndResource=Object.create(null),this._models={},this._disposedModels=new Map,this._disposedModelsHeapSize=0,this._register(this._configurationService.onDidChangeConfiguration(r=>this._updateModelOptions(r))),this._updateModelOptions(void 0)}static{this.MAX_MEMORY_FOR_CLOSED_FILES_UNDO_STACK=20*1024*1024}static _readModelOptions(e,t){let o=iv.tabSize;e.editor&&typeof e.editor.tabSize<"u"&&(o=oW(e.editor.tabSize,iv.tabSize,1,100));let n="tabSize";e.editor&&typeof e.editor.indentSize<"u"&&e.editor.indentSize!=="tabSize"&&(n=oW(e.editor.indentSize,"tabSize",1,100));let r=iv.insertSpaces;e.editor&&typeof e.editor.insertSpaces<"u"&&(r=e.editor.insertSpaces==="false"?!1:!!e.editor.insertSpaces);let s=Djo,l=e.eol;l===`\r
`?s=2:l===`
`&&(s=1);let c=iv.trimAutoWhitespace;e.editor&&typeof e.editor.trimAutoWhitespace<"u"&&(c=e.editor.trimAutoWhitespace==="false"?!1:!!e.editor.trimAutoWhitespace);let u=iv.detectIndentation;e.editor&&typeof e.editor.detectIndentation<"u"&&(u=e.editor.detectIndentation==="false"?!1:!!e.editor.detectIndentation);let p=iv.largeFileOptimizations;e.editor&&typeof e.editor.largeFileOptimizations<"u"&&(p=e.editor.largeFileOptimizations==="false"?!1:!!e.editor.largeFileOptimizations);let h=iv.bracketPairColorizationOptions;if(e.editor?.bracketPairColorization&&typeof e.editor.bracketPairColorization=="object"){let g=e.editor.bracketPairColorization;h={enabled:!!g.enabled,independentColorPoolPerBracketType:!!g.independentColorPoolPerBracketType}}return{isForSimpleWidget:t,tabSize:o,indentSize:n,insertSpaces:r,detectIndentation:u,defaultEOL:s,trimAutoWhitespace:c,largeFileOptimizations:p,bracketPairColorizationOptions:h}}_getEOL(e,t){if(e)return this._resourcePropertiesService.getEOL(e,t);let o=this._configurationService.getValue("files.eol",{overrideIdentifier:t});return o&&typeof o=="string"&&o!=="auto"?o:zo===3||zo===2?`
`:`\r
`}_shouldRestoreUndoStack(){let e=this._configurationService.getValue("files.restoreUndoStack");return typeof e=="boolean"?e:!0}getCreationOptions(e,t,o){let n=typeof e=="string"?e:e.languageId,r=this._modelCreationOptionsByLanguageAndResource[n+t];if(!r){let s=this._configurationService.getValue("editor",{overrideIdentifier:n,resource:t}),l=this._getEOL(t,n);r=IF._readModelOptions({editor:s,eol:l},o),this._modelCreationOptionsByLanguageAndResource[n+t]=r}return r}_updateModelOptions(e){let t=this._modelCreationOptionsByLanguageAndResource;this._modelCreationOptionsByLanguageAndResource=Object.create(null);let o=Object.keys(this._models);for(let n=0,r=o.length;n<r;n++){let s=o[n],l=this._models[s],c=l.model.getLanguageId(),u=l.model.uri;if(e&&!e.affectsConfiguration("editor",{overrideIdentifier:c,resource:u})&&!e.affectsConfiguration("files.eol",{overrideIdentifier:c,resource:u}))continue;let p=t[c+u],h=this.getCreationOptions(c,u,l.model.isForSimpleWidget);IF._setModelOptionsForModel(l.model,h,p)}}static _setModelOptionsForModel(e,t,o){o&&o.defaultEOL!==t.defaultEOL&&e.getLineCount()===1&&e.setEOL(t.defaultEOL===1?0:1),!(o&&o.detectIndentation===t.detectIndentation&&o.insertSpaces===t.insertSpaces&&o.tabSize===t.tabSize&&o.indentSize===t.indentSize&&o.trimAutoWhitespace===t.trimAutoWhitespace&&uo(o.bracketPairColorizationOptions,t.bracketPairColorizationOptions))&&(t.detectIndentation?(e.detectIndentation(t.insertSpaces,t.tabSize),e.updateOptions({trimAutoWhitespace:t.trimAutoWhitespace,bracketColorizationOptions:t.bracketPairColorizationOptions})):e.updateOptions({insertSpaces:t.insertSpaces,tabSize:t.tabSize,indentSize:t.indentSize,trimAutoWhitespace:t.trimAutoWhitespace,bracketColorizationOptions:t.bracketPairColorizationOptions}))}_insertDisposedModel(e){this._disposedModels.set(OJ(e.uri),e),this._disposedModelsHeapSize+=e.heapSize}_removeDisposedModel(e){let t=this._disposedModels.get(OJ(e));return t&&(this._disposedModelsHeapSize-=t.heapSize),this._disposedModels.delete(OJ(e)),t}_ensureDisposedModelsHeapSize(e){if(this._disposedModelsHeapSize>e){let t=[];for(this._disposedModels.forEach(o=>{o.sharesUndoRedoStack||t.push(o)}),t.sort((o,n)=>o.time-n.time);t.length>0&&this._disposedModelsHeapSize>e;){let o=t.shift();this._removeDisposedModel(o.uri),o.initialUndoRedoSnapshot!==null&&this._undoRedoService.restoreSnapshot(o.initialUndoRedoSnapshot)}}}_createModelData(e,t,o,n){let r=this.getCreationOptions(t,o,n),s=this._instantiationService.createInstance(Bu,e,t,r,o);if(o&&this._disposedModels.has(OJ(o))){let u=this._removeDisposedModel(o),p=this._undoRedoService.getElements(o),h=this._getSHA1Computer(),g=h.canComputeSHA1(s)?h.computeSHA1(s)===u.sha1:!1;if(g||u.sharesUndoRedoStack){for(let f of p.past)jU(f)&&f.matchesResource(o)&&f.setModel(s);for(let f of p.future)jU(f)&&f.matchesResource(o)&&f.setModel(s);this._undoRedoService.setElementsValidFlag(o,!0,f=>jU(f)&&f.matchesResource(o)),g&&(s._overwriteVersionId(u.versionId),s._overwriteAlternativeVersionId(u.alternativeVersionId),s._overwriteInitialUndoRedoSnapshot(u.initialUndoRedoSnapshot))}else u.initialUndoRedoSnapshot!==null&&this._undoRedoService.restoreSnapshot(u.initialUndoRedoSnapshot)}let l=OJ(s.uri);if(this._models[l])throw new Error("ModelService: Cannot add model because it already exists!");let c=new Fbi(s,u=>this._onWillDispose(u),(u,p)=>this._onDidChangeLanguage(u,p));return this._models[l]=c,c}updateModel(e,t,o=_c.unknown({name:"updateModel"})){let n=this.getCreationOptions(e.getLanguageId(),e.uri,e.isForSimpleWidget),{textBuffer:r,disposable:s}=n1(t,n.defaultEOL);if(e.equalsTextBuffer(r)){s.dispose();return}e.pushStackElement(),e.pushEOL(r.getEOL()===`\r
`?1:0),e.pushEditOperations([],IF._computeEdits(e,r),()=>[],void 0,o),e.pushStackElement(),s.dispose()}static _commonPrefix(e,t,o,n,r,s){let l=Math.min(t,r),c=0;for(let u=0;u<l&&e.getLineContent(o+u)===n.getLineContent(s+u);u++)c++;return c}static _commonSuffix(e,t,o,n,r,s){let l=Math.min(t,r),c=0;for(let u=0;u<l&&e.getLineContent(o+t-u)===n.getLineContent(s+r-u);u++)c++;return c}static _computeEdits(e,t){let o=e.getLineCount(),n=t.getLineCount(),r=this._commonPrefix(e,o,1,t,n,1);if(o===n&&r===o)return[];let s=this._commonSuffix(e,o-r,r,t,n-r,r),l,c;return s>0?(l=new z(r+1,1,o-s+1,1),c=new z(r+1,1,n-s+1,1)):r>0?(l=new z(r,e.getLineMaxColumn(r),o,e.getLineMaxColumn(o)),c=new z(r,1+t.getLineLength(r),n,1+t.getLineLength(n))):(l=new z(1,1,o,e.getLineMaxColumn(o)),c=new z(1,1,n,1+t.getLineLength(n))),[An.replaceMove(l,t.getValueInRange(c,0))]}createModel(e,t,o,n=!1){let r;return t?r=this._createModelData(e,t,o,n):r=this._createModelData(e,Fr,o,n),this._onModelAdded.fire(r.model),r.model}destroyModel(e){let t=this._models[OJ(e)];t&&t.model.dispose()}getModels(){let e=[],t=Object.keys(this._models);for(let o=0,n=t.length;o<n;o++){let r=t[o];e.push(this._models[r].model)}return e}getModel(e){let t=OJ(e),o=this._models[t];return o?o.model:null}_schemaShouldMaintainUndoRedoElements(e){return e.scheme===Y.file||e.scheme===Y.vscodeRemote||e.scheme===Y.vscodeUserData||e.scheme===Y.vscodeNotebookCell||e.scheme==="fake-fs"}_onWillDispose(e){let t=OJ(e.uri),o=this._models[t],n=this._undoRedoService.getUriComparisonKey(e.uri)!==e.uri.toString(),r=!1,s=0;if(n||this._shouldRestoreUndoStack()&&this._schemaShouldMaintainUndoRedoElements(e.uri)){let u=this._undoRedoService.getElements(e.uri);if(u.past.length>0||u.future.length>0){for(let p of u.past)jU(p)&&p.matchesResource(e.uri)&&(r=!0,s+=p.heapSize(e.uri),p.setModel(e.uri));for(let p of u.future)jU(p)&&p.matchesResource(e.uri)&&(r=!0,s+=p.heapSize(e.uri),p.setModel(e.uri))}}let l=IF.MAX_MEMORY_FOR_CLOSED_FILES_UNDO_STACK,c=this._getSHA1Computer();if(r)if(!n&&(s>l||!c.canComputeSHA1(e))){let u=o.model.getInitialUndoRedoSnapshot();u!==null&&this._undoRedoService.restoreSnapshot(u)}else this._ensureDisposedModelsHeapSize(l-s),this._undoRedoService.setElementsValidFlag(e.uri,!1,u=>jU(u)&&u.matchesResource(e.uri)),this._insertDisposedModel(new Wbi(e.uri,o.model.getInitialUndoRedoSnapshot(),Date.now(),n,s,c.computeSHA1(e),e.getVersionId(),e.getAlternativeVersionId()));else if(!n){let u=o.model.getInitialUndoRedoSnapshot();u!==null&&this._undoRedoService.restoreSnapshot(u)}delete this._models[t],o.dispose(),delete this._modelCreationOptionsByLanguageAndResource[e.getLanguageId()+e.uri],this._onModelRemoved.fire(e)}_onDidChangeLanguage(e,t){let o=t.oldLanguage,n=e.getLanguageId(),r=this.getCreationOptions(o,e.uri,e.isForSimpleWidget),s=this.getCreationOptions(n,e.uri,e.isForSimpleWidget);IF._setModelOptionsForModel(e,s,r),this._onModelModeChanged.fire({model:e,oldLanguageId:o})}_getSHA1Computer(){return new Wue}};IF=I([m(0,B),m(1,sL),m(2,Cl),m(3,F)],IF);var Wue=class a{static{this.MAX_MODEL_SIZE=10*1024*1024}canComputeSHA1(i){return i.getValueLength()<=a.MAX_MODEL_SIZE}computeSHA1(i){let e=new Ly,t=i.createSnapshot(),o;for(;o=t.read();)e.update(o);return e.digest()}};var GYe=class extends IF{constructor(e,t,o,n,r){super(e,t,o,r);this._pathService=n}_schemaShouldMaintainUndoRedoElements(e){return super._schemaShouldMaintainUndoRedoElements(e)||e.scheme===this._pathService.defaultUriScheme}};GYe=I([m(0,B),m(1,sL),m(2,Cl),m(3,wn),m(4,F)],GYe);we(Ct,GYe,1);var $Ye=class extends C{constructor(e,t,o){super();this._instantiationService=e;this._extensionService=t;this._logService=o;this._extensionHostIsReady=!1;this._onWillExecuteCommand=this._register(new E);this.onWillExecuteCommand=this._onWillExecuteCommand.event;this._onDidExecuteCommand=this._register(new E);this.onDidExecuteCommand=this._onDidExecuteCommand.event;this._extensionService.whenInstalledExtensionsRegistered().then(n=>this._extensionHostIsReady=n),this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=Dre([this._extensionService.activateByEvent("*"),Pi(3e4)])),L1i(this._starActivation)}async executeCommand(e,...t){this._logService.trace("CommandService#executeCommand",e);let o=`onCommand:${e}`;return qe.getCommand(e)?this._extensionService.activationEventIsDone(o)?this._tryExecuteCommand(e,t):this._extensionHostIsReady?(await this._extensionService.activateByEvent(o),this._tryExecuteCommand(e,t)):(this._extensionService.activateByEvent(o),this._tryExecuteCommand(e,t)):(await Promise.all([this._extensionService.activateByEvent(o),Dre([this._activateStar(),H.toPromise(H.filter(qe.onDidRegisterCommand,r=>r===e))])]),this._tryExecuteCommand(e,t))}_tryExecuteCommand(e,t){let o=qe.getCommand(e);if(!o)return Promise.reject(new Error(`command '${e}' not found`));try{this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this._instantiationService.invokeFunction(o.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),Promise.resolve(n)}catch(n){return Promise.reject(n)}}dispose(){super.dispose(),this._starActivation?.cancel()}};$Ye=I([m(0,F),m(1,lt),m(2,ne)],$Ye);we(ge,$Ye,1);var Vbi={};function dy(a,i){let e=Vbi[a];e||(Vbi[a]=e=[]),e.push(i)}function Bbi(a,i){for(let e of a)if(i.textMateRules.push(e),!e.scope){let t=e.settings;if(!t)e.settings={};else for(let o in t){let n=o,r=Vbi[n];if(r){let s=t[n];if(typeof s=="string"){let l=Oe.fromHex(s);for(let c of r)i.colors[c]=l}}n!=="foreground"&&n!=="background"&&n!=="fontStyle"&&delete t[n]}}}dy("background",qo);dy("foreground",od);dy("selection",sv);dy("inactiveSelection",rGi);dy("selectionHighlightColor",YSe);dy("findMatchHighlight",Kb);dy("currentFindMatchHighlight",Pse);dy("hoverHighlight",ogt);dy("wordHighlight","editor.wordHighlightBackground");dy("wordHighlightStrong","editor.wordHighlightStrongBackground");dy("findRangeHighlight",lGi);dy("findMatchHighlight","peekViewResult.matchHighlightBackground");dy("referenceHighlight","peekViewEditor.matchHighlightBackground");dy("lineHighlight",PIe);dy("rangeHighlight",j$i);dy("caret",I9);dy("invisibles",AIe);dy("guide",fft);dy("activeGuide",vft);var Ljo=["ansiBlack","ansiRed","ansiGreen","ansiYellow","ansiBlue","ansiMagenta","ansiCyan","ansiWhite","ansiBrightBlack","ansiBrightRed","ansiBrightGreen","ansiBrightYellow","ansiBrightBlue","ansiBrightMagenta","ansiBrightCyan","ansiBrightWhite"];for(let a of Ljo)dy(a,"terminal."+a);function jno(a){return Rjo(a,null,null)}function Rjo(a,i,e){let t=a.length,o=0,n=1,r=0;t>0&&a.charCodeAt(0)===65279&&(o=1);function s(Fe){if(e===null)o=o+Fe;else for(;Fe>0;)a.charCodeAt(o)===10?(o++,n++,r=0):(o++,r++),Fe--}function l(Fe){e===null?o=Fe:s(Fe-o)}function c(){for(;o<t;){let Fe=a.charCodeAt(o);if(Fe!==32&&Fe!==9&&Fe!==13&&Fe!==10)break;s(1)}}function u(Fe){return a.substr(o,Fe.length)===Fe?(s(Fe.length),!0):!1}function p(Fe){let Qt=a.indexOf(Fe,o);l(Qt!==-1?Qt+Fe.length:t)}function h(Fe){let Qt=a.indexOf(Fe,o);if(Qt!==-1){let Ze=a.substring(o,Qt);return l(Qt+Fe.length),Ze}else{let Ze=a.substr(o);return l(t),Ze}}let g=0,f=null,v=[],b=[],S=null;function y(Fe,Qt){v.push(g),b.push(f),g=Fe,f=Qt}function w(){if(v.length===0)return k("illegal state stack");g=v.pop(),f=b.pop()}function k(Fe){throw new Error("Near offset "+o+": "+Fe+" ~~~"+a.substr(o,50)+"~~~")}let T={enterDict:function(){if(S===null)return k("missing <key>");let Fe={};e!==null&&(Fe[e]={filename:i,line:n,char:r}),f[S]=Fe,S=null,y(1,Fe)},enterArray:function(){if(S===null)return k("missing <key>");let Fe=[];f[S]=Fe,S=null,y(2,Fe)}},N={enterDict:function(){let Fe={};e!==null&&(Fe[e]={filename:i,line:n,char:r}),f.push(Fe),y(1,Fe)},enterArray:function(){let Fe=[];f.push(Fe),y(2,Fe)}};function O(){g===1?T.enterDict():g===2?N.enterDict():(f={},e!==null&&(f[e]={filename:i,line:n,char:r}),y(1,f))}function V(){if(g===1)w();else return k("unexpected </dict>")}function U(){g===1?T.enterArray():g===2?N.enterArray():(f=[],y(2,f))}function G(){if(g===1)return k("unexpected </array>");if(g===2)w();else return k("unexpected </array>")}function $(Fe){if(g===1){if(S!==null)return k("too many <key>");S=Fe}else return k("unexpected <key>")}function te(Fe){if(g===1){if(S===null)return k("missing <key>");f[S]=Fe,S=null}else g===2?f.push(Fe):f=Fe}function pe(Fe){if(isNaN(Fe))return k("cannot parse float");if(g===1){if(S===null)return k("missing <key>");f[S]=Fe,S=null}else g===2?f.push(Fe):f=Fe}function de(Fe){if(isNaN(Fe))return k("cannot parse integer");if(g===1){if(S===null)return k("missing <key>");f[S]=Fe,S=null}else g===2?f.push(Fe):f=Fe}function se(Fe){if(g===1){if(S===null)return k("missing <key>");f[S]=Fe,S=null}else g===2?f.push(Fe):f=Fe}function Se(Fe){if(g===1){if(S===null)return k("missing <key>");f[S]=Fe,S=null}else g===2?f.push(Fe):f=Fe}function ke(Fe){if(g===1){if(S===null)return k("missing <key>");f[S]=Fe,S=null}else g===2?f.push(Fe):f=Fe}function Ee(Fe){return Fe.replace(/&#([0-9]+);/g,function(Qt,Ze){return String.fromCodePoint(parseInt(Ze,10))}).replace(/&#x([0-9a-f]+);/g,function(Qt,Ze){return String.fromCodePoint(parseInt(Ze,16))}).replace(/&|<|>|"|'/g,function(Qt){switch(Qt){case"&":return"&";case"<":return"<";case">":return">";case""":return'"';case"'":return"'"}return Qt})}function He(){let Fe=h(">"),Qt=!1;return Fe.charCodeAt(Fe.length-1)===47&&(Qt=!0,Fe=Fe.substring(0,Fe.length-1)),{name:Fe.trim(),isClosed:Qt}}function Ve(Fe){if(Fe.isClosed)return"";let Qt=h("</");return p(">"),Ee(Qt)}for(;o<t&&(c(),!(o>=t));){let Fe=a.charCodeAt(o);if(s(1),Fe!==60)return k("expected <");if(o>=t)return k("unexpected end of input");let Qt=a.charCodeAt(o);if(Qt===63){s(1),p("?>");continue}if(Qt===33){if(s(1),u("--")){p("-->");continue}p(">");continue}if(Qt===47){if(s(1),c(),u("plist")){p(">");continue}if(u("dict")){p(">"),V();continue}if(u("array")){p(">"),G();continue}return k("unexpected closed tag")}let Ze=He();switch(Ze.name){case"dict":O(),Ze.isClosed&&V();continue;case"array":U(),Ze.isClosed&&G();continue;case"key":$(Ve(Ze));continue;case"string":te(Ve(Ze));continue;case"real":pe(parseFloat(Ve(Ze)));continue;case"integer":de(parseInt(Ve(Ze),10));continue;case"date":se(new Date(Ve(Ze)));continue;case"data":Se(Ve(Ze));continue;case"true":Ve(Ze),ke(!0);continue;case"false":Ve(Ze),ke(!1);continue}if(!/^plist/.test(Ze.name))return k("unexpected opened tag "+Ze.name)}return f}function Hbi(a,i,e){let t=Mjo(a),o=t.next();for(;o!==null;){let l=0;if(o.length===2&&o.charAt(1)===":"){switch(o.charAt(0)){case"R":l=1;break;case"L":l=-1;break;default:console.log(`Unknown priority ${o} in scope selector`)}o=t.next()}let c=r();if(c&&e.push({matcher:c,priority:l}),o!==",")break;o=t.next()}function n(){if(o==="-"){o=t.next();let l=n();return l?c=>l(c)<0?0:-1:null}if(o==="("){o=t.next();let l=s();return o===")"&&(o=t.next()),l}if(Qno(o)){let l=[];do l.push(o),o=t.next();while(Qno(o));return c=>i(l,c)}return null}function r(){let l=n();if(!l)return null;let c=[];for(;l;)c.push(l),l=n();return u=>{let p=c[0](u);for(let h=1;p>=0&&h<c.length;h++)p=Math.min(p,c[h](u));return p}}function s(){let l=r();if(!l)return null;let c=[];for(;l&&(c.push(l),o==="|"||o===",");){do o=t.next();while(o==="|"||o===",");l=r()}return u=>{let p=c[0](u);for(let h=1;h<c.length;h++)p=Math.max(p,c[h](u));return p}}}function Qno(a){return!!a&&!!a.match(/[\w\.:]+/)}function Mjo(a){let i=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,e=i.exec(a);return{next:()=>{if(!e)return null;let t=e[0];return e=i.exec(a),t}}}var Pjo=oe.as(Tse.ColorContribution),BOt=zxt(),Yno={comments:["comment","punctuation.definition.comment"],strings:["string","meta.embedded.assembly"],keywords:["keyword - keyword.operator","keyword.control","storage","storage.type"],numbers:["constant.numeric"],types:["entity.name.type","entity.name.class","support.type","support.class"],functions:["entity.name.function","support.function"],variables:["variable","entity.name.variable"]},o4=class a{constructor(i,e,t){this.themeTokenColors=[];this.customTokenColors=[];this.colorMap={};this.customColorMap={};this.semanticTokenRules=[];this.customSemanticTokenRules=[];this.textMateThemingRules=void 0;this.tokenColorIndex=void 0;this.tokenFontIndex=void 0;this.id=i,this.label=e,this.settingsId=t,this.isLoaded=!1}static{this.STORAGE_KEY="colorThemeData"}get semanticHighlighting(){return this.customSemanticHighlighting!==void 0?this.customSemanticHighlighting:this.customSemanticHighlightingDeprecated!==void 0?this.customSemanticHighlightingDeprecated:!!this.themeSemanticHighlighting}get tokenColors(){if(!this.textMateThemingRules){let n=function(r){if(r.scope&&r.settings){r.scope==="token.info-token"&&(o=!0);let s=r.settings;i.push({scope:r.scope,settings:{foreground:xDe(s.foreground),background:xDe(s.background),fontStyle:s.fontStyle,fontSize:s.fontSize,fontFamily:s.fontFamily,lineHeight:s.lineHeight}})}},i=[],e=this.getColor(od)||this.getDefault(od),t=this.getColor(qo)||this.getDefault(qo);i.push({settings:{foreground:xDe(e),background:xDe(t)}});let o=!1;this.themeTokenColors.forEach(n),this.customTokenColors.forEach(n),o||Njo[this.type].forEach(n),this.textMateThemingRules=i}return this.textMateThemingRules}getColor(i,e){let t=this.customColorMap[i];if(t instanceof Oe)return t;if(t===void 0){let o=this.colorMap[i];if(o!==void 0)return o}if(e!==!1)return this.getDefault(i)}getTokenStyle(i,e,t,o=!0,n={}){let r={foreground:void 0,bold:void 0,underline:void 0,strikethrough:void 0,italic:void 0},s={foreground:-1,bold:-1,underline:-1,strikethrough:-1,italic:-1,fontFamily:-1,fontSize:-1,lineHeight:-1};function l(p,h,g){h.foreground&&s.foreground<=p&&(s.foreground=p,r.foreground=h.foreground,n.foreground=g);for(let f of["bold","underline","strikethrough","italic"]){let v=f,b=h[v];b!==void 0&&s[v]<=p&&(s[v]=p,r[v]=b,n[v]=g)}}function c(p){let h=p.selector.match(i,e,t);h>=0&&l(h,p.style,p)}this.semanticTokenRules.forEach(c),this.customSemanticTokenRules.forEach(c);let u=!1;for(let p in s){let h=p;s[h]===-1?u=!0:s[h]=Number.MAX_VALUE}if(u)for(let p of BOt.getTokenStylingDefaultRules()){let h=p.selector.match(i,e,t);if(h>=0){let g;if(p.defaults.scopesToProbe&&(g=this.resolveScopes(p.defaults.scopesToProbe),g&&l(h,g,p.defaults.scopesToProbe)),!g&&o!==!1){let f=p.defaults[this.type];g=this.resolveTokenStyleValue(f),g&&l(h,g,f)}}}return tP.fromData(r)}resolveTokenStyleValue(i){if(i!==void 0){if(typeof i=="string"){let{type:e,modifiers:t,language:o}=Hxt(i,"");return this.getTokenStyle(e,t,o)}else if(typeof i=="object")return i}}getTokenColorIndex(){if(!this.tokenColorIndex){let i=new Ubi;this.tokenColors.forEach(e=>{i.add(e.settings.foreground),i.add(e.settings.background)}),this.semanticTokenRules.forEach(e=>i.add(e.style.foreground)),BOt.getTokenStylingDefaultRules().forEach(e=>{let t=e.defaults[this.type];t&&typeof t=="object"&&i.add(t.foreground)}),this.customSemanticTokenRules.forEach(e=>i.add(e.style.foreground)),this.tokenColorIndex=i}return this.tokenColorIndex}getTokenFontIndex(){if(!this.tokenFontIndex){let i=new zbi;this.tokenColors.forEach(e=>i.add(e.settings.fontFamily,e.settings.fontSize,e.settings.lineHeight)),this.tokenFontIndex=i}return this.tokenFontIndex}get tokenColorMap(){return this.getTokenColorIndex().asArray()}get tokenFontMap(){return this.getTokenFontIndex().asArray()}getTokenStyleMetadata(i,e,t,o=!0,n={}){let{type:r,language:s}=Hxt(i,t),l=this.getTokenStyle(r,e,s,o,n);if(l)return{foreground:this.getTokenColorIndex().get(l.foreground),bold:l.bold,underline:l.underline,strikethrough:l.strikethrough,italic:l.italic}}getTokenStylingRuleScope(i){if(this.customSemanticTokenRules.indexOf(i)!==-1)return"setting";if(this.semanticTokenRules.indexOf(i)!==-1)return"theme"}getDefault(i){return Pjo.resolveDefaultColor(i,this)}resolveScopes(i,e){this.themeTokenScopeMatchers||(this.themeTokenScopeMatchers=this.themeTokenColors.map(ero)),this.customTokenScopeMatchers||(this.customTokenScopeMatchers=this.customTokenColors.map(ero));for(let t of i){let u=function(p,h){for(let g=0;g<p.length;g++){let f=p[g](t);if(f>=0){let v=h[g],b=h[g].settings;f>=r&&b.foreground&&(o=b.foreground,r=f,c=v),f>=s&&Ae(b.fontStyle)&&(n=b.fontStyle,s=f,l=v)}}},o,n,r=-1,s=-1,l,c;if(u(this.themeTokenScopeMatchers,this.themeTokenColors),u(this.customTokenScopeMatchers,this.customTokenColors),o!==void 0||n!==void 0)return e&&(e.foreground=c,e.bold=e.italic=e.underline=e.strikethrough=l,e.scope=t),tP.fromSettings(o,n)}}defines(i){let e=this.customColorMap[i];return e instanceof Oe?!0:e===void 0&&this.colorMap.hasOwnProperty(i)}setCustomizations(i){this.setCustomColors(i.colorCustomizations),this.setCustomTokenColors(i.tokenColorCustomizations),this.setCustomSemanticTokenColors(i.semanticTokenColorCustomizations)}setCustomColors(i){this.customColorMap={},this.overwriteCustomColors(i);let e=this.getThemeSpecificColors(i);yi(e)&&this.overwriteCustomColors(e),this.tokenColorIndex=void 0,this.tokenFontIndex=void 0,this.textMateThemingRules=void 0,this.customTokenScopeMatchers=void 0}overwriteCustomColors(i){for(let e in i){let t=i[e];t===M$e?this.customColorMap[e]=M$e:typeof t=="string"&&(this.customColorMap[e]=Oe.fromHex(t))}}setCustomTokenColors(i){this.customTokenColors=[],this.customSemanticHighlightingDeprecated=void 0,this.addCustomTokenColors(i);let e=this.getThemeSpecificColors(i);yi(e)&&this.addCustomTokenColors(e),this.tokenColorIndex=void 0,this.tokenFontIndex=void 0,this.textMateThemingRules=void 0,this.customTokenScopeMatchers=void 0}setCustomSemanticTokenColors(i){if(this.customSemanticTokenRules=[],this.customSemanticHighlighting=void 0,i){this.customSemanticHighlighting=i.enabled,i.rules&&this.readSemanticTokenRules(i.rules);let e=this.getThemeSpecificColors(i);yi(e)&&(e.enabled!==void 0&&(this.customSemanticHighlighting=e.enabled),e.rules&&this.readSemanticTokenRules(e.rules))}this.tokenColorIndex=void 0,this.tokenFontIndex=void 0,this.textMateThemingRules=void 0}isThemeScope(i){return i.charAt(0)===L7i&&i.charAt(i.length-1)===R7i}isThemeScopeMatch(i){let e=i.charAt(0),t=i.charAt(i.length-1),o=i.slice(0,-1),n=i.slice(1,-1),r=i.slice(1);return i===this.settingsId||this.settingsId.includes(n)&&e===S8e&&t===S8e||this.settingsId.startsWith(o)&&t===S8e||this.settingsId.endsWith(r)&&e===S8e}getThemeSpecificColors(i){let e;for(let t in i){let o=i[t];if(this.isThemeScope(t)&&o instanceof Object&&!Array.isArray(o)){let n=t.match(M7i)||[];for(let r of n){let s=r.substring(1,r.length-1);if(this.isThemeScopeMatch(s)){e||(e={});let l=o;for(let c in l){let u=e[c],p=l[c];Array.isArray(u)&&Array.isArray(p)?e[c]=u.concat(p):p&&(e[c]=p)}}}}}return e}readSemanticTokenRules(i){for(let e in i)if(!this.isThemeScope(e))try{let t=iro(e,i[e]);t&&this.customSemanticTokenRules.push(t)}catch{}}addCustomTokenColors(i){for(let e in Yno){let t=e,o=i[t];if(o){let n=typeof o=="string"?{foreground:o}:o,r=Yno[t];for(let s of r)this.customTokenColors.push({scope:s,settings:n})}}if(Array.isArray(i.textMateRules))for(let e of i.textMateRules)e.scope&&e.settings&&this.customTokenColors.push(e);i.semanticHighlighting!==void 0&&(this.customSemanticHighlightingDeprecated=i.semanticHighlighting)}ensureLoaded(i){return this.isLoaded?Promise.resolve(void 0):this.load(i)}reload(i){return this.load(i)}load(i){if(!this.location)return Promise.resolve(void 0);this.themeTokenColors=[],this.clearCaches();let e={colors:{},textMateRules:[],semanticTokenRules:[],semanticHighlighting:!1};return tro(i,this.location,e).then(t=>{this.isLoaded=!0,this.semanticTokenRules=e.semanticTokenRules,this.colorMap=e.colors,this.themeTokenColors=e.textMateRules,this.themeSemanticHighlighting=e.semanticHighlighting})}clearCaches(){this.tokenColorIndex=void 0,this.tokenFontIndex=void 0,this.textMateThemingRules=void 0,this.themeTokenScopeMatchers=void 0,this.customTokenScopeMatchers=void 0}toStorage(i){let e={};for(let o in this.colorMap)e[o]=Oe.Format.CSS.formatHexA(this.colorMap[o],!0);let t=JSON.stringify({id:this.id,label:this.label,settingsId:this.settingsId,themeTokenColors:this.themeTokenColors.map(o=>({settings:o.settings,scope:o.scope})),semanticTokenRules:this.semanticTokenRules.map(rxe.toJSONObject),extensionData:DE.toJSONObject(this.extensionData),themeSemanticHighlighting:this.themeSemanticHighlighting,colorMap:e,watch:this.watch});i.store(a.STORAGE_KEY,t,0,0)}get themeTypeSelector(){return this.classNames[0]}get classNames(){return this.id.split(" ")}get type(){switch(this.themeTypeSelector){case"vs":return"light";case"hc-black":return"hcDark";case"hc-light":return"hcLight";default:return"dark"}}static createUnloadedThemeForThemeType(i,e){return a.createUnloadedTheme(J$(i),e)}static createUnloadedTheme(i,e){let t=new a(i,"","__"+i);if(t.isLoaded=!1,t.themeTokenColors=[],t.watch=!1,e)for(let o in e)t.colorMap[o]=Oe.fromHex(e[o]);return t}static createLoadedEmptyTheme(i,e){let t=new a(i,"",e);return t.isLoaded=!0,t.themeTokenColors=[],t.watch=!1,t}static fromStorageData(i){let e=i.get(a.STORAGE_KEY,0);if(e)try{let t=JSON.parse(e),o=new a("","","");for(let n in t)switch(n){case"colorMap":{let r=t[n];for(let s in r)o.colorMap[s]=Oe.fromHex(r[s]);break}case"themeTokenColors":case"id":case"label":case"settingsId":case"watch":case"themeSemanticHighlighting":o[n]=t[n];break;case"semanticTokenRules":{let r=t[n];if(Array.isArray(r))for(let s of r){let l=rxe.fromJSONObject(BOt,s);l&&o.semanticTokenRules.push(l)}break}case"location":break;case"extensionData":o.extensionData=DE.fromJSONObject(t.extensionData);break}return!o.id||!o.settingsId?void 0:o}catch{return}}static fromExtensionTheme(i,e,t){let o=i.uiTheme||"vs-dark",n=Ajo(t.extensionId,i.path),r=`${o} ${n}`,s=i.label||No(i.path),l=i.id||s,c=new a(r,s,l);return c.description=i.description,c.watch=i._watch===!0,c.location=e,c.extensionData=t,c.isLoaded=!1,c}};function Ajo(a,i){i.startsWith("./")&&(i=i.substr(2));let e=`${a}-${i}`;return e=e.replace(/[^_a-zA-Z0-9-]/g,"-"),e.charAt(0).match(/[0-9-]/)&&(e="_"+e),e}async function tro(a,i,e){if(ms(i)===".json"){let t=await a.readExtensionResource(i),o=[],n=Ur(t,o);if(o.length>0)return Promise.reject(new Error(d(17308,null,o.map(c=>EO(c.error)).join(", "))));if(Vx(n)!=="object")return Promise.reject(new Error(d(17309,null)));if(n.include&&await tro(a,je(ci(i),n.include),e),Array.isArray(n.settings))return Bbi(n.settings,e),null;e.semanticHighlighting=e.semanticHighlighting||n.semanticHighlighting;let r=n.colors;if(r){if(typeof r!="object")return Promise.reject(new Error(d(17310,null,i.toString())));for(let c in r){let u=r[c];u===M$e?delete e.colors[c]:typeof u=="string"&&(e.colors[c]=Oe.fromHex(r[c]))}}let s=n.tokenColors;if(s)if(Array.isArray(s))e.textMateRules.push(...s);else if(typeof s=="string")await Xno(a,je(ci(i),s),e);else return Promise.reject(new Error(d(17312,null,i.toString())));let l=n.semanticTokenColors;if(l&&typeof l=="object")for(let c in l)try{let u=iro(c,l[c]);u&&e.semanticTokenRules.push(u)}catch{return Promise.reject(new Error(d(17311,null,i.toString())))}}else return Xno(a,i,e)}function Xno(a,i,e){return a.readExtensionResource(i).then(t=>{try{let n=jno(t).settings;return Array.isArray(n)?(Bbi(n,e),Promise.resolve(null)):Promise.reject(new Error(d(17313,null)))}catch(o){return Promise.reject(new Error(d(17307,null,o.message)))}},t=>Promise.reject(new Error(d(17306,null,i.toString(),t.message))))}var Njo={light:[{scope:"token.info-token",settings:{foreground:"#316bcd"}},{scope:"token.warn-token",settings:{foreground:"#cd9731"}},{scope:"token.error-token",settings:{foreground:"#cd3131"}},{scope:"token.debug-token",settings:{foreground:"#800080"}}],dark:[{scope:"token.info-token",settings:{foreground:"#6796e6"}},{scope:"token.warn-token",settings:{foreground:"#cd9731"}},{scope:"token.error-token",settings:{foreground:"#f44747"}},{scope:"token.debug-token",settings:{foreground:"#b267e6"}}],hcLight:[{scope:"token.info-token",settings:{foreground:"#316bcd"}},{scope:"token.warn-token",settings:{foreground:"#cd9731"}},{scope:"token.error-token",settings:{foreground:"#cd3131"}},{scope:"token.debug-token",settings:{foreground:"#800080"}}],hcDark:[{scope:"token.info-token",settings:{foreground:"#6796e6"}},{scope:"token.warn-token",settings:{foreground:"#008000"}},{scope:"token.error-token",settings:{foreground:"#FF0000"}},{scope:"token.debug-token",settings:{foreground:"#b267e6"}}]},Jno=a=>-1;function Zno(a,i){if(i.length<a.length)return-1;let e;return a.every(o=>{for(let n=i.length-1;n>=0;n--)if(Ojo(i[n],o))return e=(n+1)*65536+o.length,!0;return!1})&&e!==void 0?e:-1}function Ojo(a,i){if(!a)return!1;if(a===i)return!0;let e=i.length;return a.length>e&&a.substr(0,e)===i&&a[e]==="."}function ero(a){let i=a.scope;if(!i||!a.settings)return Jno;let e=[];if(Array.isArray(i))for(let t of i)Hbi(t,Zno,e);else Hbi(i,Zno,e);return e.length===0?Jno:t=>{let o=e[0].matcher(t);for(let n=1;n<e.length;n++)o=Math.max(o,e[n].matcher(t));return o}}function iro(a,i){let e=BOt.parseTokenSelector(a),t;if(typeof i=="string"?t=tP.fromSettings(i,void 0):Fjo(i)&&(t=tP.fromSettings(i.foreground,i.fontStyle,i.bold,i.underline,i.strikethrough,i.italic)),t)return{selector:e,style:t}}function Fjo(a){return a&&(Ae(a.foreground)||Ae(a.fontStyle)||Da(a.italic)||Da(a.underline)||Da(a.strikethrough)||Da(a.bold))}function HOt(a,i,e,t){let o=0;o|=e<<0;let n={},r=a.resolveScopes([i],n);if(i.length>0){let u=mji(i[i.length-1]);o|=u<<8}let s=n.foreground?.settings.fontStyle||n.bold?.settings.fontStyle;s?.includes("italic")&&(o|=2049),s?.includes("bold")&&(o|=4098),s?.includes("underline")&&(o|=8196),s?.includes("strikethrough")&&(o|=16392);let l=r?.foreground,c=l!==void 0?a.getTokenColorIndex().get(l):1;return o|=c<<15,t&&(o|=1024),o}var Ubi=class{constructor(){this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null)}add(i){if(i=xDe(i),i===void 0)return 0;let e=this._color2id[i];return e||(e=++this._lastColorId,this._color2id[i]=e,this._id2color[e]=i,e)}get(i){if(i=xDe(i),i===void 0)return 0;let e=this._color2id[i];return e||(console.log(`Color ${i} not in index.`),0)}asArray(){return this._id2color.slice(0)}},zbi=class{constructor(){this._lastFontId=0,this._id2font=[],this._font2id=new Map}add(i,e,t){let o={fontFamily:i,fontSizeMultiplier:e,lineHeightMultiplier:t},n=this._font2id.get(o);return n||(n=++this._lastFontId,this._font2id.set(o,n),this._id2font[n]=o,n)}get(i){let e=this._font2id.get(i);return e||0}asArray(){return this._id2font.slice(0)}};function xDe(a){if(!a)return;typeof a!="string"&&(a=Oe.Format.CSS.formatHexA(a,!0));let i=a.length;if(a.charCodeAt(0)!==35||i!==4&&i!==5&&i!==7&&i!==9)return;let e=[35];for(let t=1;t<i;t++){let o=Wjo(a.charCodeAt(t));if(!o)return;e.push(o),(i===4||i===5)&&e.push(o)}return e.length===9&&e[7]===70&&e[8]===70&&(e.length=7),String.fromCharCode(...e)}function Wjo(a){return a>=48&&a<=57||a>=65&&a<=70?a:a>=97&&a<=102?a-97+65:0}var Vjo="vscode://schemas/icon-theme",Bjo={type:"object",allowComments:!0,allowTrailingCommas:!0,definitions:{folderExpanded:{type:"string",description:d(17336,null)},folder:{type:"string",description:d(17335,null)},file:{type:"string",description:d(17330,null)},rootFolder:{type:"string",description:d(17360,null)},rootFolderExpanded:{type:"string",description:d(17361,null)},rootFolderNames:{type:"object",description:d(17363,null),additionalProperties:{type:"string",description:d(17337,null)}},rootFolderNamesExpanded:{type:"object",description:d(17364,null),additionalProperties:{type:"string",description:d(17362,null)}},folderNames:{type:"object",description:d(17339,null),additionalProperties:{type:"string",description:d(17337,null)}},folderNamesExpanded:{type:"object",description:d(17340,null),additionalProperties:{type:"string",description:d(17338,null)}},fileExtensions:{type:"object",description:d(17332,null),additionalProperties:{type:"string",description:d(17331,null)}},fileNames:{type:"object",description:d(17334,null),additionalProperties:{type:"string",description:d(17333,null)}},languageIds:{type:"object",description:d(17358,null),additionalProperties:{type:"string",description:d(17357,null)}},associations:{type:"object",properties:{folderExpanded:{$ref:"#/definitions/folderExpanded"},folder:{$ref:"#/definitions/folder"},file:{$ref:"#/definitions/file"},folderNames:{$ref:"#/definitions/folderNames"},folderNamesExpanded:{$ref:"#/definitions/folderNamesExpanded"},rootFolder:{$ref:"#/definitions/rootFolder"},rootFolderExpanded:{$ref:"#/definitions/rootFolderExpanded"},rootFolderNames:{$ref:"#/definitions/rootFolderNames"},rootFolderNamesExpanded:{$ref:"#/definitions/rootFolderNamesExpanded"},fileExtensions:{$ref:"#/definitions/fileExtensions"},fileNames:{$ref:"#/definitions/fileNames"},languageIds:{$ref:"#/definitions/languageIds"}}}},properties:{fonts:{type:"array",description:d(17349,null),items:{type:"object",properties:{id:{type:"string",description:d(17356,null),pattern:Q9.source,patternErrorMessage:Uye},src:{type:"array",description:d(17366,null),items:{type:"object",properties:{path:{type:"string",description:d(17342,null)},format:{type:"string",description:d(17341,null),enum:["woff","woff2","truetype","opentype","embedded-opentype","svg"]}},required:["path","format"]}},weight:{type:"string",description:d(17345,null),pattern:Hye.source},style:{type:"string",description:d(17344,null),pattern:Bye.source},size:{type:"string",description:d(17343,null),pattern:Cje.source}},required:["id","src"]}},iconDefinitions:{type:"object",description:d(17354,null),additionalProperties:{type:"object",description:d(17353,null),properties:{iconPath:{type:"string",description:d(17355,null)},fontCharacter:{type:"string",description:d(17346,null)},fontColor:{type:"string",format:"color-hex",description:d(17347,null),pattern:fSt.source},fontSize:{type:"string",description:d(17350,null),pattern:Cje.source},fontId:{type:"string",description:d(17348,null),pattern:Q9.source,patternErrorMessage:Uye}}}},folderExpanded:{$ref:"#/definitions/folderExpanded"},folder:{$ref:"#/definitions/folder"},file:{$ref:"#/definitions/file"},folderNames:{$ref:"#/definitions/folderNames"},folderNamesExpanded:{$ref:"#/definitions/folderNamesExpanded"},rootFolder:{$ref:"#/definitions/rootFolder"},rootFolderExpanded:{$ref:"#/definitions/rootFolderExpanded"},rootFolderNames:{$ref:"#/definitions/rootFolderNames"},rootFolderNamesExpanded:{$ref:"#/definitions/rootFolderNamesExpanded"},fileExtensions:{$ref:"#/definitions/fileExtensions"},fileNames:{$ref:"#/definitions/fileNames"},languageIds:{$ref:"#/definitions/languageIds"},light:{$ref:"#/definitions/associations",description:d(17359,null)},highContrast:{$ref:"#/definitions/associations",description:d(17352,null)},hidesExplorerArrows:{type:"boolean",description:d(17351,null)},showLanguageModeIcons:{type:"boolean",description:d(17365,null)}}};function oro(){oe.as(ea.JSONContribution).registerSchema(Vjo,Bjo)}var XV=class a{static{this.STORAGE_KEY="iconThemeData"}constructor(i,e,t){this.id=i,this.label=e,this.settingsId=t,this.isLoaded=!1,this.hasFileIcons=!1,this.hasFolderIcons=!1,this.hidesExplorerArrows=!1}ensureLoaded(i){return this.isLoaded?Promise.resolve(this.styleSheetContent):this.load(i)}reload(i){return this.load(i)}load(i){return i.load(this)}static fromExtensionTheme(i,e,t){let o=t.extensionId+"-"+i.id,n=i.label||No(i.path),r=i.id,s=new a(o,n,r);return s.description=i.description,s.location=e,s.extensionData=t,s.watch=i._watch,s.isLoaded=!1,s}static{this._noIconTheme=null}static get noIconTheme(){let i=a._noIconTheme;return i||(i=a._noIconTheme=new a("","",null),i.hasFileIcons=!1,i.hasFolderIcons=!1,i.hidesExplorerArrows=!1,i.isLoaded=!0,i.extensionData=void 0,i.watch=!1),i}static createUnloadedTheme(i){let e=new a(i,"","__"+i);return e.isLoaded=!1,e.hasFileIcons=!1,e.hasFolderIcons=!1,e.hidesExplorerArrows=!1,e.extensionData=void 0,e.watch=!1,e}static fromStorageData(i){let e=i.get(a.STORAGE_KEY,0);if(e)try{let t=JSON.parse(e),o=new a("","",null);for(let n in t)switch(n){case"id":case"label":case"description":case"settingsId":case"styleSheetContent":case"hasFileIcons":case"hidesExplorerArrows":case"hasFolderIcons":case"watch":o[n]=t[n];break;case"location":break;case"extensionData":o.extensionData=DE.fromJSONObject(t.extensionData);break}return o}catch{return}}toStorage(i){let e=JSON.stringify({id:this.id,label:this.label,description:this.description,settingsId:this.settingsId,styleSheetContent:this.styleSheetContent,hasFileIcons:this.hasFileIcons,hasFolderIcons:this.hasFolderIcons,hidesExplorerArrows:this.hidesExplorerArrows,extensionData:DE.toJSONObject(this.extensionData),watch:this.watch});i.store(a.STORAGE_KEY,e,0,1)}},zOt=class{constructor(i,e){this.fileService=i;this.languageService=e}load(i){return i.location?this.loadIconThemeDocument(i.location).then(e=>{let t=this.processIconThemeDocument(i.id,i.location,e);return i.styleSheetContent=t.content,i.hasFileIcons=t.hasFileIcons,i.hasFolderIcons=t.hasFolderIcons,i.hidesExplorerArrows=t.hidesExplorerArrows,i.isLoaded=!0,i.styleSheetContent}):Promise.resolve(i.styleSheetContent)}loadIconThemeDocument(i){return this.fileService.readExtensionResource(i).then(e=>{let t=[],o=Ur(e,t);return t.length>0?Promise.reject(new Error(d(17269,null,t.map(n=>EO(n.error)).join(", ")))):Vx(o)!=="object"?Promise.reject(new Error(d(17270,null))):Promise.resolve(o)})}processIconThemeDocument(i,e,t){let o={content:"",hasFileIcons:!1,hasFolderIcons:!1,hidesExplorerArrows:!!t.hidesExplorerArrows},n=!1;if(!t.iconDefinitions)return o;let r={},s={},l=ci(e);function c(b){return je(l,b)}function u(b,S){function y(w,k){if(k){let T=r[k];T||(T=r[k]=new o_),T.push(w)}}if(b){let w=Hs`.show-file-icons`;S&&(w=Hs`${S} ${w}`);let k=Hs`.monaco-tl-twistie.collapsible:not(.collapsed) + .monaco-tl-contents`;b.folder&&(y(Hs`${w} .folder-icon::before`,b.folder),o.hasFolderIcons=!0),b.folderExpanded&&(y(Hs`${w} ${k} .folder-icon::before`,b.folderExpanded),o.hasFolderIcons=!0);let T=b.rootFolder||b.folder,N=b.rootFolderExpanded||b.folderExpanded;T&&(y(Hs`${w} .rootfolder-icon::before`,T),o.hasFolderIcons=!0),N&&(y(Hs`${w} ${k} .rootfolder-icon::before`,N),o.hasFolderIcons=!0),b.file&&(y(Hs`${w} .file-icon::before`,b.file),o.hasFileIcons=!0);let O=b.folderNames;if(O)for(let de in O){let se=new o_,Se=UOt(de.toLowerCase(),se);se.push(Hs`.${wK(Se)}-name-folder-icon`),y(Hs`${w} ${se.join("")}.folder-icon::before`,O[de]),o.hasFolderIcons=!0}let V=b.folderNamesExpanded;if(V)for(let de in V){let se=new o_,Se=UOt(de.toLowerCase(),se);se.push(Hs`.${wK(Se)}-name-folder-icon`),y(Hs`${w} ${k} ${se.join("")}.folder-icon::before`,V[de]),o.hasFolderIcons=!0}let U=b.rootFolderNames;if(U)for(let de in U){let se=de.toLowerCase();y(Hs`${w} .${wK(se)}-root-name-folder-icon.rootfolder-icon::before`,U[de]),o.hasFolderIcons=!0}let G=b.rootFolderNamesExpanded;if(G)for(let de in G){let se=de.toLowerCase();y(Hs`${w} ${k} .${wK(se)}-root-name-folder-icon.rootfolder-icon::before`,G[de]),o.hasFolderIcons=!0}let $=b.languageIds;if($){!$.jsonc&&$.json&&($.jsonc=$.json);for(let de in $)y(Hs`${w} .${wK(de)}-lang-file-icon.file-icon::before`,$[de]),o.hasFileIcons=!0,n=!0,s[de]=!0}let te=b.fileExtensions;if(te)for(let de in te){let se=new o_,ke=UOt(de.toLowerCase(),se).split(".");if(ke.length){for(let Ee=0;Ee<ke.length;Ee++)se.push(Hs`.${wK(ke.slice(Ee).join("."))}-ext-file-icon`);se.push(Hs`.ext-file-icon`)}y(Hs`${w} ${se.join("")}.file-icon::before`,te[de]),o.hasFileIcons=!0,n=!0}let pe=b.fileNames;if(pe)for(let de in pe){let se=new o_,Se=UOt(de.toLowerCase(),se);se.push(Hs`.${wK(Se)}-name-file-icon`),se.push(Hs`.name-file-icon`);let ke=Se.split(".");if(ke.length){for(let Ee=1;Ee<ke.length;Ee++)se.push(Hs`.${wK(ke.slice(Ee).join("."))}-ext-file-icon`);se.push(Hs`.ext-file-icon`)}y(Hs`${w} ${se.join("")}.file-icon::before`,pe[de]),o.hasFileIcons=!0,n=!0}}}if(u(t),u(t.light,Hs`.vs`),u(t.highContrast,Hs`.hc-black`),u(t.highContrast,Hs`.hc-light`),!o.hasFileIcons&&!o.hasFolderIcons)return o;let p=t.showLanguageModeIcons===!0||n&&t.showLanguageModeIcons!==!1,h=new o_,g=t.fonts,f=new Map;if(Array.isArray(g)){let b=this.tryNormalizeFontSize(g[0].size)||"150%";g.forEach(S=>{let y=new o_;y.push(...S.src.map(k=>Hs`${Na(c(k.path))} format(${WS(k.format)})`)),h.push(Hs`@font-face { src: ${y.join(", ")}; font-family: ${WS(S.id)}; font-weight: ${Tye(S.weight)}; font-style: ${Tye(S.style)}; font-display: block; }`);let w=this.tryNormalizeFontSize(S.size);w!==void 0&&w!==b&&f.set(S.id,w)}),h.push(Hs`.show-file-icons .file-icon::before, .show-file-icons .folder-icon::before, .show-file-icons .rootfolder-icon::before { font-family: ${WS(g[0].id)}; font-size: ${Vei(b)}; }`)}let v=WS("\\2001");for(let b in r){let S=r[b],y=t.iconDefinitions[b];if(y){if(y.iconPath)h.push(Hs`${S.join(", ")} { content: ${v}; background-image: ${Na(c(y.iconPath))}; }`);else if(y.fontCharacter||y.fontColor){let w=new o_;y.fontColor&&y.fontColor.match(fSt)&&w.push(Hs`color: ${Oji(y.fontColor)};`),y.fontCharacter&&w.push(Hs`content: ${WS(y.fontCharacter)};`);let k=y.fontSize??(y.fontId?f.get(y.fontId):void 0);k&&k.match(Cje)&&w.push(Hs`font-size: ${Vei(k)};`),y.fontId&&w.push(Hs`font-family: ${WS(y.fontId)};`),p&&w.push(Hs`background-image: unset;`),h.push(Hs`${S.join(", ")} { ${w.join(" ")} }`)}}}if(p){for(let b of this.languageService.getRegisteredLanguageIds())if(!s[b]){let S=this.languageService.getIcon(b);if(S){let y=Hs`.show-file-icons .${wK(b)}-lang-file-icon.file-icon::before`;h.push(Hs`${y} { content: ${v}; background-image: ${Na(S.dark)}; }`),h.push(Hs`.vs ${y} { content: ${v}; background-image: ${Na(S.light)}; }`)}}}return o.content=h.join(`
`),o}tryNormalizeFontSize(i){if(!i)return;let e=13;if(i.endsWith("px")){let t=parseInt(i,10);if(!isNaN(t))return Math.round(t/e*100)+"%"}return i}};function UOt(a,i){let e=a.lastIndexOf("/");if(e>=0){let t=a.substring(0,e);return i.push(Hs`.${wK(t)}-name-dir-icon`),a.substring(e+1)}return a}function wK(a){return a=Tle(a),a1(a,!0)}var nro=["comment","comment.block","comment.block.documentation","comment.line","constant","constant.character","constant.character.escape","constant.numeric","constant.numeric.integer","constant.numeric.float","constant.numeric.hex","constant.numeric.octal","constant.other","constant.regexp","constant.rgb-value","emphasis","entity","entity.name","entity.name.class","entity.name.function","entity.name.method","entity.name.section","entity.name.selector","entity.name.tag","entity.name.type","entity.other","entity.other.attribute-name","entity.other.inherited-class","invalid","invalid.deprecated","invalid.illegal","keyword","keyword.control","keyword.operator","keyword.operator.new","keyword.operator.assignment","keyword.operator.arithmetic","keyword.operator.logical","keyword.other","markup","markup.bold","markup.changed","markup.deleted","markup.heading","markup.inline.raw","markup.inserted","markup.italic","markup.list","markup.list.numbered","markup.list.unnumbered","markup.other","markup.quote","markup.raw","markup.underline","markup.underline.link","meta","meta.block","meta.cast","meta.class","meta.function","meta.function-call","meta.preprocessor","meta.return-type","meta.selector","meta.tag","meta.type.annotation","meta.type","punctuation.definition.string.begin","punctuation.definition.string.end","punctuation.separator","punctuation.separator.continuation","punctuation.terminator","storage","storage.modifier","storage.type","string","string.interpolated","string.other","string.quoted","string.quoted.double","string.quoted.other","string.quoted.single","string.quoted.triple","string.regexp","string.unquoted","strong","support","support.class","support.constant","support.function","support.other","support.type","support.type.property-name","support.variable","variable","variable.language","variable.name","variable.other","variable.other.readwrite","variable.parameter"],qYe="vscode://schemas/textmate-colors",rro=`${qYe}#/definitions/colorGroup`,Hjo={type:"array",definitions:{colorGroup:{default:"#FF0000",anyOf:[{type:"string",format:"color-hex"},{$ref:"#/definitions/settings"}]},settings:{type:"object",description:d(17327,null),properties:{foreground:{type:"string",description:d(17325,null),format:"color-hex",default:"#ff0000"},background:{type:"string",deprecationMessage:d(17320,null)},fontStyle:{type:"string",description:d(17323,null),pattern:"^(\\s*\\b(italic|bold|underline|strikethrough))*\\s*$",patternErrorMessage:d(17315,null),defaultSnippets:[{label:d(17324,null),bodyText:'""'},{body:"italic"},{body:"bold"},{body:"underline"},{body:"strikethrough"},{body:"italic bold"},{body:"italic underline"},{body:"italic strikethrough"},{body:"bold underline"},{body:"bold strikethrough"},{body:"underline strikethrough"},{body:"italic bold underline"},{body:"italic bold strikethrough"},{body:"italic underline strikethrough"},{body:"bold underline strikethrough"},{body:"italic bold underline strikethrough"}]},fontFamily:{type:"string",description:d(17321,null)},fontSize:{type:"number",description:d(17322,null)},lineHeight:{type:"number",description:d(17326,null)}},additionalProperties:!1,defaultSnippets:[{body:{foreground:"${1:#FF0000}",fontStyle:"${2:bold}"}}]}},items:{type:"object",defaultSnippets:[{body:{scope:"${1:keyword.operator}",settings:{foreground:"${2:#FF0000}"}}}],properties:{name:{type:"string",description:d(17316,null)},scope:{description:d(17317,null),anyOf:[{enum:nro},{type:"string"},{type:"array",items:{enum:nro}},{type:"array",items:{type:"string"}}]},settings:{$ref:"#/definitions/settings"}},required:["settings"],additionalProperties:!1}},Kbi="vscode://schemas/color-theme",Ujo={type:"object",allowComments:!0,allowTrailingCommas:!0,properties:{colors:{description:d(17329,null),$ref:Lse,additionalProperties:!1},tokenColors:{anyOf:[{type:"string",description:d(17328,null)},{description:d(17314,null),$ref:qYe}]},semanticHighlighting:{type:"boolean",description:d(17319,null)},semanticTokenColors:{type:"object",description:d(17318,null),$ref:sxe}}};function sro(){let a=oe.as(ea.JSONContribution);a.registerSchema(Kbi,Ujo),a.registerSchema(qYe,Hjo)}function aro(){return Tn.registerExtensionPoint({extensionPoint:"themes",jsonSchema:{description:d(17435,null),type:"array",items:{type:"object",defaultSnippets:[{body:{label:"${1:label}",id:"${2:id}",uiTheme:"vs-dark",path:"./themes/${3:id}.tmTheme."}}],properties:{id:{description:d(17436,null),type:"string"},label:{description:d(17437,null),type:"string"},uiTheme:{description:d(17439,null),enum:["vs","vs-dark","hc-black","hc-light"]},path:{description:d(17438,null),type:"string"}},required:["path","uiTheme"]}}})}function lro(){return Tn.registerExtensionPoint({extensionPoint:"iconThemes",jsonSchema:{description:d(17427,null),type:"array",items:{type:"object",defaultSnippets:[{body:{id:"${1:id}",label:"${2:label}",path:"./fileicons/${3:id}-icon-theme.json"}}],properties:{id:{description:d(17428,null),type:"string"},label:{description:d(17429,null),type:"string"},path:{description:d(17430,null),type:"string"}},required:["path","id"]}}})}function cro(){return Tn.registerExtensionPoint({extensionPoint:"productIconThemes",jsonSchema:{description:d(17431,null),type:"array",items:{type:"object",defaultSnippets:[{body:{id:"${1:id}",label:"${2:label}",path:"./producticons/${3:id}-product-icon-theme.json"}}],properties:{id:{description:d(17432,null),type:"string"},label:{description:d(17433,null),type:"string"},path:{description:d(17434,null),type:"string"}},required:["path","id"]}}})}var Gbi=class extends C{constructor(){super(...arguments);this.type="markdown"}shouldRender(e){return!!e.contributes?.themes||!!e.contributes?.iconThemes||!!e.contributes?.productIconThemes}render(e){let t=new xe;if(e.contributes?.themes){t.appendMarkdown(`### ${d(17419,null)}
`);for(let o of e.contributes.themes)t.appendMarkdown(`- ${o.label}
`)}if(e.contributes?.iconThemes){t.appendMarkdown(`### ${d(17420,null)}
`);for(let o of e.contributes.iconThemes)t.appendMarkdown(`- ${o.label}
`)}if(e.contributes?.productIconThemes){t.appendMarkdown(`### ${d(17422,null)}
`);for(let o of e.contributes.productIconThemes)t.appendMarkdown(`- ${o.label}
`)}return{data:t,dispose:()=>{}}}};oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:"themes",label:d(17426,null),access:{canToggle:!1},renderer:new Mt(Gbi)});var kDe=class{constructor(i,e,t=!1,o=void 0){this.themesExtPoint=i;this.create=e;this.idRequired=t;this.builtInTheme=o;this.onDidChangeEmitter=new E;this.onDidChange=this.onDidChangeEmitter.event;this.extensionThemes=[],this.initialize()}dispose(){this.themesExtPoint.setHandler(()=>{}),this.onDidChangeEmitter.dispose()}initialize(){this.themesExtPoint.setHandler((i,e)=>{let t={},o=[];for(let r of this.extensionThemes)t[r.id]=r;this.extensionThemes.length=0;for(let r of i){let s=DE.fromName(r.description.publisher,r.description.name,r.description.isBuiltin);this.onThemes(s,r.description.extensionLocation,r.value,this.extensionThemes,r.collector)}for(let r of this.extensionThemes)t[r.id]?delete t[r.id]:o.push(r);let n=Object.values(t);this.onDidChangeEmitter.fire({themes:this.extensionThemes,added:o,removed:n})})}onThemes(i,e,t,o=[],n){return Array.isArray(t)?(t.forEach(r=>{if(!r.path||!Ae(r.path)){n?.error(d(17425,null,this.themesExtPoint.name,String(r.path)));return}if(this.idRequired&&(!r.id||!Ae(r.id))){n?.error(d(17424,null,this.themesExtPoint.name,String(r.id)));return}let s=je(e,r.path);La(s,e)||n?.warn(d(17421,null,this.themesExtPoint.name,s.path,e.path));let l=this.create(r,s,i);o.push(l)}),o):(n?.error(d(17423,null,this.themesExtPoint.name)),o)}findThemeById(i){if(this.builtInTheme&&this.builtInTheme.id===i)return this.builtInTheme;let e=this.getThemes();for(let t of e)if(t.id===i)return t}findThemeBySettingsId(i,e){if(this.builtInTheme&&this.builtInTheme.settingsId===i)return this.builtInTheme;let t=this.getThemes(),o;for(let n of t){if(n.settingsId===i)return n;n.settingsId===e&&(o=n)}return o}findThemeByExtensionLocation(i){return i?this.getThemes().filter(e=>e.location&&La(e.location,i)):[]}getThemes(){return this.extensionThemes}getMarketplaceThemes(i,e,t){let o=i?.contributes?.[this.themesExtPoint.name];return Array.isArray(o)?this.onThemes(t,e,o):[]}};var EDe=oe.as(ii.Configuration),Bue=[],Hue=[],Uue=[];function YP(a){return`\`#${a}#\``}var n4="colorThemeConfiguration",zjo={type:"string",markdownDescription:d(17388,null,YP("window.autoDetectColorScheme")),default:Gt?Bd.COLOR_THEME_LIGHT:Bd.COLOR_THEME_DARK,tags:[n4],enum:Bue,enumDescriptions:Uue,enumItemLabels:Hue,errorMessage:d(17389,null)},Kjo={type:"string",markdownDescription:d(17411,null,YP("window.autoDetectColorScheme")),default:Bd.COLOR_THEME_DARK,tags:[n4],enum:Bue,enumDescriptions:Uue,enumItemLabels:Hue,errorMessage:d(17389,null)},Gjo={type:"string",markdownDescription:d(17414,null,YP("window.autoDetectColorScheme")),default:Bd.COLOR_THEME_LIGHT,tags:[n4],enum:Bue,enumDescriptions:Uue,enumItemLabels:Hue,errorMessage:d(17389,null)},$jo={type:"string",markdownDescription:d(17412,null,YP("window.autoDetectHighContrast")),default:Bd.COLOR_THEME_HC_DARK,tags:[n4],enum:Bue,enumDescriptions:Uue,enumItemLabels:Hue,errorMessage:d(17389,null)},qjo={type:"string",markdownDescription:d(17413,null,YP("window.autoDetectHighContrast")),default:Bd.COLOR_THEME_HC_LIGHT,tags:[n4],enum:Bue,enumDescriptions:Uue,enumItemLabels:Hue,errorMessage:d(17389,null)},jjo={type:"boolean",markdownDescription:d(17392,null,YP("workbench.preferredDarkColorTheme"),YP("workbench.preferredLightColorTheme")),default:!1,tags:[n4]},dro={type:"object",description:d(17418,null),allOf:[{$ref:Lse}],default:{},defaultSnippets:[{body:{}}]},KOt={type:["string","null"],default:Bd.FILE_ICON_THEME,description:d(17407,null),enum:[null],enumItemLabels:[d(17410,null)],enumDescriptions:[d(17409,null)],errorMessage:d(17408,null)},GOt={type:["string","null"],default:Bd.PRODUCT_ICON_THEME,description:d(17415,null),enum:[Bd.PRODUCT_ICON_THEME],enumItemLabels:[d(17391,null)],enumDescriptions:[d(17390,null)],errorMessage:d(17416,null)},Qjo={type:"boolean",default:!0,markdownDescription:d(17387,null,YP("workbench.preferredHighContrastColorTheme"),YP("workbench.preferredHighContrastLightColorTheme")),scope:1,tags:[n4]},qOt={id:"workbench",order:7.1,type:"object",properties:{"workbench.colorTheme":zjo,"workbench.preferredDarkColorTheme":Kjo,"workbench.preferredLightColorTheme":Gjo,"workbench.preferredHighContrastColorTheme":$jo,"workbench.preferredHighContrastLightColorTheme":qjo,"workbench.iconTheme":KOt,"workbench.colorCustomizations":dro,"workbench.productIconTheme":GOt}};EDe.registerConfiguration(qOt);var Yjo={id:"window",order:8.1,type:"object",properties:{"window.autoDetectHighContrast":Qjo,"window.autoDetectColorScheme":jjo}};EDe.registerConfiguration(Yjo);function Vue(a){return{description:a,$ref:rro}}var $bi="^\\[[^\\]]*(\\]\\s*\\[[^\\]]*)*\\]$",uro={type:"object",properties:{comments:Vue(d(17394,null)),strings:Vue(d(17403,null)),keywords:Vue(d(17396,null)),numbers:Vue(d(17397,null)),types:Vue(d(17405,null)),functions:Vue(d(17395,null)),variables:Vue(d(17406,null)),textMateRules:{description:d(17404,null),$ref:qYe},semanticHighlighting:{description:d(17398,null),deprecationMessage:d(17399,null),markdownDeprecationMessage:d(17400,null,YP("editor.semanticTokenColorCustomizations")),type:"boolean"}},additionalProperties:!1},pro={description:d(17393,null),default:{},allOf:[{...uro,patternProperties:{"^\\[":{}}}]},qbi={type:"object",properties:{enabled:{type:"boolean",description:d(17401,null),suggestSortText:"0_enabled"},rules:{$ref:sxe,description:d(17402,null),suggestSortText:"0_rules"}},additionalProperties:!1},mro={description:d(17417,null),default:{},allOf:[{...qbi,patternProperties:{"^\\[":{}}}]},hro={id:"editor",order:7.2,type:"object",properties:{"editor.tokenColorCustomizations":pro,"editor.semanticTokenColorCustomizations":mro}};EDe.registerConfiguration(hro);function Qbi(a){a.sort((r,s)=>r.label.localeCompare(s.label)),Bue.splice(0,Bue.length,...a.map(r=>r.settingsId)),Uue.splice(0,Uue.length,...a.map(r=>r.description||"")),Hue.splice(0,Hue.length,...a.map(r=>r.label||""));let i={properties:{}},e={properties:{}},t={properties:{}},o={$ref:Lse,additionalProperties:!1},n={properties:uro.properties,additionalProperties:!1};for(let r of a){let s=`[${r.settingsId}]`;i.properties[s]=o,e.properties[s]=n,t.properties[s]=qbi}i.patternProperties={[$bi]:o},e.patternProperties={[$bi]:n},t.patternProperties={[$bi]:qbi},dro.allOf[1]=i,pro.allOf[1]=e,mro.allOf[1]=t,EDe.notifyConfigurationSchemaUpdated(qOt,hro)}function Ybi(a){KOt.enum.splice(1,Number.MAX_VALUE,...a.map(i=>i.settingsId)),KOt.enumItemLabels.splice(1,Number.MAX_VALUE,...a.map(i=>i.label)),KOt.enumDescriptions.splice(1,Number.MAX_VALUE,...a.map(i=>i.description||"")),EDe.notifyConfigurationSchemaUpdated(qOt)}function Xbi(a){GOt.enum.splice(1,Number.MAX_VALUE,...a.map(i=>i.settingsId)),GOt.enumItemLabels.splice(1,Number.MAX_VALUE,...a.map(i=>i.label)),GOt.enumDescriptions.splice(1,Number.MAX_VALUE,...a.map(i=>i.description||"")),EDe.notifyConfigurationSchemaUpdated(qOt)}var Xjo={dark:"workbench.preferredDarkColorTheme",light:"workbench.preferredLightColorTheme",hcDark:"workbench.preferredHighContrastColorTheme",hcLight:"workbench.preferredHighContrastLightColorTheme"},$Ot=class{constructor(i,e){this.configurationService=i;this.hostColorService=e}get colorTheme(){return this.configurationService.getValue(this.getColorThemeSettingId())}get fileIconTheme(){return this.configurationService.getValue("workbench.iconTheme")}get productIconTheme(){return this.configurationService.getValue("workbench.productIconTheme")}get colorCustomizations(){return this.configurationService.getValue("workbench.colorCustomizations")||{}}get tokenColorCustomizations(){let i=this.configurationService.getValue("editor.tokenColorCustomizations")||{},e=i.textMateRules;if(!e)return i;let t=e.map(n=>{let r=n.settings?.fontSize,s=n.settings?.lineHeight;return r!==void 0&&s===void 0?{...n,settings:{...n.settings,lineHeight:r}}:n});return{...i,textMateRules:t}}get semanticTokenColorCustomizations(){return this.configurationService.getValue("editor.semanticTokenColorCustomizations")}getPreferredColorScheme(){if(this.configurationService.getValue("window.autoDetectHighContrast")&&this.hostColorService.highContrast)return this.hostColorService.dark?"hcDark":"hcLight";if(this.configurationService.getValue("window.autoDetectColorScheme"))return this.hostColorService.dark?"dark":"light"}isDetectingColorScheme(){return this.configurationService.getValue("window.autoDetectColorScheme")}getColorThemeSettingId(){let i=this.getPreferredColorScheme();return i?Xjo[i]:"workbench.colorTheme"}async setColorTheme(i,e){return await this.writeConfiguration(this.getColorThemeSettingId(),i.settingsId,e),i}async setFileIconTheme(i,e){return await this.writeConfiguration("workbench.iconTheme",i.settingsId,e),i}async setProductIconTheme(i,e){return await this.writeConfiguration("workbench.productIconTheme",i.settingsId,e),i}isDefaultColorTheme(){let i=this.configurationService.inspect(this.getColorThemeSettingId());return i&&i.default?.value===i.value}findAutoConfigurationTarget(i){let e=this.configurationService.inspect(i);if(cn(e.workspaceFolderValue))if(cn(e.workspaceValue)){if(!cn(e.userRemote))return 4}else return 5;else return 6;return 2}async writeConfiguration(i,e,t){if(t===void 0||t==="preview")return;let o=this.configurationService.inspect(i);if(t==="auto")return this.configurationService.updateValue(i,e);if(t===2){if(e===o.userValue)return Promise.resolve(void 0);if(e===o.defaultValue){if(cn(o.userValue))return Promise.resolve(void 0);e=void 0}}else if((t===5||t===6||t===4)&&e===o.value)return Promise.resolve(void 0);return this.configurationService.updateValue(i,e,t)}};var zue="",JV=class a{constructor(i,e,t){this.iconThemeDocument={iconDefinitions:new Map};this.id=i,this.label=e,this.settingsId=t,this.isLoaded=!1}static{this.STORAGE_KEY="productIconThemeData"}getIcon(i){return e5o(i,this.iconThemeDocument)}ensureLoaded(i,e){return this.isLoaded?Promise.resolve(this.styleSheetContent):this.load(i,e)}reload(i,e){return this.load(i,e)}async load(i,e){let t=this.location;if(!t)return Promise.resolve(this.styleSheetContent);let o=[];return this.iconThemeDocument=await Jjo(i,t,o),this.isLoaded=!0,o.length&&e.error(d(17282,null,t.toString(),o.join(`
`))),this.styleSheetContent}static fromExtensionTheme(i,e,t){let o=t.extensionId+"-"+i.id,n=i.label||No(i.path),r=i.id,s=new a(o,n,r);return s.description=i.description,s.location=e,s.extensionData=t,s.watch=i._watch,s.isLoaded=!1,s}static createUnloadedTheme(i){let e=new a(i,"","__"+i);return e.isLoaded=!1,e.extensionData=void 0,e.watch=!1,e}static{this._defaultProductIconTheme=null}static get defaultTheme(){let i=a._defaultProductIconTheme;return i||(i=a._defaultProductIconTheme=new a(zue,d(17271,null),Bd.PRODUCT_ICON_THEME),i.isLoaded=!0,i.extensionData=void 0,i.watch=!1),i}static fromStorageData(i){let e=i.get(a.STORAGE_KEY,0);if(e)try{let t=JSON.parse(e),o=new a("","","");for(let s in t)switch(s){case"id":case"label":case"description":case"settingsId":case"styleSheetContent":case"watch":o[s]=t[s];break;case"location":break;case"extensionData":o.extensionData=DE.fromJSONObject(t.extensionData);break}let{iconDefinitions:n,iconFontDefinitions:r}=t;if(Array.isArray(n)&&yi(r)){let s=new Map;for(let l of n){let{id:c,fontCharacter:u,fontId:p}=l;if(Ae(c)&&Ae(u))if(Ae(p)){let h=gSt.fromJSONObject(r[p]);h&&s.set(c,{fontCharacter:u,font:{id:p,definition:h}})}else s.set(c,{fontCharacter:u})}o.iconThemeDocument={iconDefinitions:s}}return o}catch{return}}toStorage(i){let e=[],t={};for(let n of this.iconThemeDocument.iconDefinitions.entries()){let r=n[1].font;e.push({id:n[0],fontCharacter:n[1].fontCharacter,fontId:r?.id}),r&&t[r.id]===void 0&&(t[r.id]=gSt.toJSONObject(r.definition))}let o=JSON.stringify({id:this.id,label:this.label,description:this.description,settingsId:this.settingsId,styleSheetContent:this.styleSheetContent,watch:this.watch,extensionData:DE.toJSONObject(this.extensionData),iconDefinitions:e,iconFontDefinitions:t});i.store(a.STORAGE_KEY,o,0,1)}};function Jjo(a,i,e){return a.readExtensionResource(i).then(t=>{let o=[],n=Ur(t,o);if(o.length>0)return Promise.reject(new Error(d(17272,null,o.map(u=>EO(u.error)).join(", "))));if(Vx(n)!=="object")return Promise.reject(new Error(d(17279,null)));if(!n.iconDefinitions||!Array.isArray(n.fonts)||!n.fonts.length)return Promise.reject(new Error(d(17280,null)));let r=ci(i),s=new Map;for(let u of n.fonts){let p=u.id;if(Ae(p)&&p.match(Q9)){let h;Ae(u.weight)&&u.weight.match(Hye)?h=u.weight:e.push(d(17276,null,u.id));let g;Ae(u.style)&&u.style.match(Bye)?g=u.style:e.push(d(17275,null,u.id));let f=[];if(Array.isArray(u.src))for(let v of u.src)if(Ae(v.path)&&Ae(v.format)&&v.format.match(Y5i)){let b=je(r,v.path);f.push({location:b,format:v.format})}else e.push(d(17274,null,u.id));f.length?s.set(p,{weight:h,style:g,src:f}):e.push(d(17281,null,u.id))}else e.push(d(17273,null,u.id))}let l=new Map,c=n.fonts[0].id;for(let u in n.iconDefinitions){let p=n.iconDefinitions[u];if(Ae(p.fontCharacter)){let h=p.fontId??c,g=s.get(h);if(g){let f={id:`pi-${h}`,definition:g};l.set(u,{fontCharacter:p.fontCharacter,font:f})}else e.push(d(17277,null,u))}else e.push(d(17278,null,u))}return{iconDefinitions:l}})}var Zjo=jy();function e5o(a,i){let e=i.iconDefinitions,t=e.get(a.id),o=a.defaults;for(;!t&&q.isThemeIcon(o);){let n=Zjo.getIcon(o.id);if(n)t=e.get(n.id),o=n.defaults;else return}if(t)return t;if(!q.isThemeIcon(o))return o}var t5o="vscode://schemas/product-icon-theme",i5o={type:"object",allowComments:!0,allowTrailingCommas:!0,properties:{fonts:{type:"array",items:{type:"object",properties:{id:{type:"string",description:d(17385,null),pattern:Q9.source,patternErrorMessage:Uye},src:{type:"array",description:d(17386,null),items:{type:"object",properties:{path:{type:"string",description:d(17381,null)},format:{type:"string",description:d(17380,null),enum:["woff","woff2","truetype","opentype","embedded-opentype","svg"]}},required:["path","format"]}},weight:{type:"string",description:d(17383,null),anyOf:[{enum:["normal","bold","lighter","bolder"]},{type:"string",pattern:Hye.source}]},style:{type:"string",description:d(17382,null),anyOf:[{enum:["normal","italic","oblique"]},{type:"string",pattern:Bye.source}]}},required:["id","src"]}},iconDefinitions:{description:d(17384,null),$ref:vSt}}};function gro(){oe.as(ea.JSONContribution).registerSchema(t5o,i5o)}var jOt=ae("hostColorSchemeService");var r4=ae("IUserDataInitializationService"),QOt=class{constructor(i=[]){this.initializers=i}async whenInitializationFinished(){await this.requiresInitialization()&&await Promise.all(this.initializers.map(i=>i.whenInitializationFinished()))}async requiresInitialization(){return(await Promise.all(this.initializers.map(i=>i.requiresInitialization()))).some(i=>i)}async initializeRequiredResources(){await this.requiresInitialization()&&await Promise.all(this.initializers.map(i=>i.initializeRequiredResources()))}async initializeOtherResources(i){await this.requiresInitialization()&&await Promise.all(this.initializers.map(e=>e.initializeOtherResources(i)))}async initializeInstalledExtensions(i){await this.requiresInitialization()&&await Promise.all(this.initializers.map(e=>e.initializeInstalledExtensions(i)))}},jYe=class{constructor(i,e,t){t.whenInstalledExtensionsRegistered().then(()=>this.initializeOtherResource(i,e))}async initializeOtherResource(i,e){await i.requiresInitialization()&&(sn("code/willInitOtherUserData"),await i.initializeOtherResources(e),sn("code/didInitOtherUserData"))}};jYe=I([m(0,r4),m(1,F),m(2,lt)],jYe);Gt&&oe.as(Qi.Workbench).registerWorkbenchContribution(jYe,3);function YOt(a){let i=new P,e=i.add(new E),t=jy();return i.add(t.onDidChange(()=>e.fire())),a&&i.add(a.onDidProductIconThemeChange(()=>e.fire())),{dispose:()=>i.dispose(),onDidChange:e.event,getCSS(){let o=a?a.getProductIconTheme():new Jbi,n={},r=new o_,s=new o_;for(let l of t.getIcons()){let c=o.getIcon(l);if(!c)continue;let u=c.font,p=Hs`--vscode-icon-${a1(l.id)}-font-family`,h=Hs`--vscode-icon-${a1(l.id)}-content`;u?(n[u.id]=u.definition,s.push(Hs`${p}: ${WS(u.id)};`,Hs`${h}: ${WS(c.fontCharacter)};`),r.push(Hs`.codicon-${a1(l.id)}:before { content: ${WS(c.fontCharacter)}; font-family: ${WS(u.id)}; }`)):(s.push(Hs`${h}: ${WS(c.fontCharacter)}; ${p}: 'codicon';`),r.push(Hs`.codicon-${a1(l.id)}:before { content: ${WS(c.fontCharacter)}; }`))}for(let l in n){let c=n[l],u=c.weight?Hs`font-weight: ${Tye(c.weight)};`:Hs``,p=c.style?Hs`font-style: ${Tye(c.style)};`:Hs``,h=new o_;for(let g of c.src)h.push(Hs`${Na(g.location)} format(${WS(g.format)})`);r.push(Hs`@font-face { src: ${h.join(", ")}; font-family: ${WS(l)};${u}${p} font-display: block; }`)}return r.push(Hs`:root { ${s.join(" ")} }`),r.join(`
`)}}}var Jbi=class{getIcon(i){let e=jy(),t=i.defaults;for(;q.isThemeIcon(t);){let o=e.getIcon(t.id);if(!o)return;t=o.defaults}return t}};function vro(a){return`--vscode-${a.replace(/\./g,"-")}`}function o5o(a){return a!==null&&typeof a=="object"&&"light"in a&&"dark"in a}function n5o(a,i="px"){return{value:a,unit:i}}function yF(a,i="px"){let e=n5o(a,i);return{light:e,dark:e,hcDark:e,hcLight:e}}function QYe(a){return`${a.value}${a.unit}`}var r5o={SizeContribution:"base.contributions.sizes"};var Zbi=class extends C{constructor(){super();this._onDidChangeSchema=this._register(new E);this.onDidChangeSchema=this._onDidChangeSchema.event;this.sizeSchema={type:"object",properties:{}};this.sizeReferenceSchema={type:"string",enum:[],enumDescriptions:[]};this.sizesById={}}notifyThemeUpdate(e){for(let t of Object.keys(this.sizesById)){let o=this.resolveDefaultSize(t,e);o&&(this.sizeSchema.properties[t].default=QYe(o))}this._onDidChangeSchema.fire()}registerSize(e,t,o,n){let r={id:e,description:o,defaults:t,deprecationMessage:n};this.sizesById[e]=r;let s={type:"string",pattern:"^(\\d+(\\.\\d+)?(px|rem|em|%))|default$",patternErrorMessage:'Size must be a number followed by px, rem, em, or % (e.g., "12px", "1.5rem") or "default"'};return n&&(s.deprecationMessage=n),this.sizeSchema.properties[e]={description:o,...s},this.sizeReferenceSchema.enum.push(e),this.sizeReferenceSchema.enumDescriptions.push(o),this._onDidChangeSchema.fire(),e}deregisterSize(e){delete this.sizesById[e],delete this.sizeSchema.properties[e];let t=this.sizeReferenceSchema.enum.indexOf(e);t!==-1&&(this.sizeReferenceSchema.enum.splice(t,1),this.sizeReferenceSchema.enumDescriptions.splice(t,1)),this._onDidChangeSchema.fire()}getSizes(){return Object.keys(this.sizesById).map(e=>this.sizesById[e])}resolveDefaultSize(e,t){let o=this.sizesById[e];if(o?.defaults)return(o5o(o.defaults)?o.defaults[t.type]:o.defaults)??void 0}getSizeSchema(){return this.sizeSchema}getSizeReferenceSchema(){return this.sizeReferenceSchema}toString(){let e=(t,o)=>{let n=t.indexOf(".")===-1?0:1,r=o.indexOf(".")===-1?0:1;return n!==r?n-r:t.localeCompare(o)};return Object.keys(this.sizesById).sort(e).map(t=>`- \`${t}\`: ${this.sizesById[t].description}`).join(`
`)}},YYe=new Zbi;oe.add(r5o.SizeContribution,YYe);function wF(a,i,e,t){return YYe.registerSize(a,i,e,t)}function XYe(){return YYe}var bro="vscode://schemas/workbench-sizes",Sro=oe.as(ea.JSONContribution);Sro.registerSchema(bro,YYe.getSizeSchema());var fro=new Dt(()=>Sro.notifySchemaChanged(bro),200);YYe.onDidChangeSchema(()=>{fro.isScheduled()||fro.schedule()});var pKc=wF("bodyFontSize",yF(13,"px"),d(2600,null)),mKc=wF("bodyFontSize.small",yF(12,"px"),d(2601,null)),hKc=wF("bodyFontSize.xSmall",yF(11,"px"),d(2602,null)),gKc=wF("codiconFontSize",yF(16,"px"),d(2603,null)),fKc=wF("cornerRadius.medium",yF(6,"px"),d(2606,null)),vKc=wF("cornerRadius.xSmall",yF(2,"px"),d(2609,null)),bKc=wF("cornerRadius.small",yF(4,"px"),d(2607,null)),SKc=wF("cornerRadius.large",yF(8,"px"),d(2605,null)),IKc=wF("cornerRadius.xLarge",yF(12,"px"),d(2608,null)),yKc=wF("cornerRadius.circle",yF(9999,"px"),d(2604,null)),wKc=wF("strokeThickness",yF(1,"px"),d(2610,null));function Iro(a,i,e,t){let o=new Set,n={addRule:s=>{o.has(s)||o.add(s)}};if(n.addRule(`${i} { forced-color-adjust: none; }`),e&&t)for(let s of e)s(a,n,t);let r=[];for(let s of GSe().getColors()){let l=a.getColor(s.id,!0);l&&r.push(`${TN(s.id)}: ${l.toString()};`)}for(let s of XYe().getSizes()){let l=XYe().resolveDefaultSize(s.id,a);l&&r.push(`${vro(s.id)}: ${QYe(l)};`)}return n.addRule(`${i} { ${r.join(`
`)} }`),new eSi([...o].join(`
`))}var eSi=class{constructor(i){this.code=i}};var XOt="vscode-theme-defaults",tSi="vscode.vscode-theme-seti-vs-seti",yro="file-icons-enabled",s5o="contributedColorTheme",a5o="contributedFileIconTheme",l5o="contributedProductIconTheme",wro=oe.as(LJt.ThemingContribution);function c5o(a){switch(a){case"vs":return`vs ${XOt}-themes-light_vs-json`;case"vs-dark":return`vs-dark ${XOt}-themes-dark_vs-json`;case"hc-black":return`hc-black ${XOt}-themes-hc_black-json`;case"hc-light":return`hc-light ${XOt}-themes-hc_light-json`}return a}var d5o=aro(),u5o=lro(),p5o=cro(),JYe=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.storageService=t;this.configurationService=o;this.telemetryService=n;this.environmentService=r;this.extensionResourceLoaderService=l;this.logService=u;this.hostColorService=p;this.userDataInitializationService=h;this.languageService=g;this.themeExtensionsActivated=new Map;this.container=c.mainContainer,this.settings=new $Ot(o,p),this.colorThemeRegistry=this._register(new kDe(d5o,o4.fromExtensionTheme)),this.colorThemeWatcher=this._register(new ZYe(s,r,this.reloadCurrentColorTheme.bind(this))),this.onColorThemeChange=this._register(new E({leakWarningThreshold:400})),this.currentColorTheme=o4.createUnloadedTheme(""),this.colorThemeSequencer=new Nm,this.fileIconThemeWatcher=this._register(new ZYe(s,r,this.reloadCurrentFileIconTheme.bind(this))),this.fileIconThemeRegistry=this._register(new kDe(u5o,XV.fromExtensionTheme,!0,XV.noIconTheme)),this.fileIconThemeLoader=new zOt(l,g),this.onFileIconThemeChange=this._register(new E({leakWarningThreshold:400})),this.currentFileIconTheme=XV.createUnloadedTheme(""),this.fileIconThemeSequencer=new Nm,this.productIconThemeWatcher=this._register(new ZYe(s,r,this.reloadCurrentProductIconTheme.bind(this))),this.productIconThemeRegistry=this._register(new kDe(p5o,JV.fromExtensionTheme,!0,JV.defaultTheme)),this.onProductIconThemeChange=this._register(new E),this.currentProductIconTheme=JV.createUnloadedTheme(""),this.productIconThemeSequencer=new Nm,this._register(this.onDidColorThemeChange(O=>GSe().notifyThemeUpdate(O)));let f=o4.fromStorageData(this.storageService),v=this.settings.colorTheme;f&&v!==f.settingsId&&(f=void 0);let b=v===Bd.COLOR_THEME_LIGHT?A7i:v===Bd.COLOR_THEME_DARK?P7i:void 0;if(!f){let O=r.options?.initialColorTheme;O&&(f=o4.createUnloadedThemeForThemeType(O.themeType,O.colors??b))}if(!f){let O=this.settings.getPreferredColorScheme()??(Gt?"light":"dark");f=o4.createUnloadedThemeForThemeType(O,b)}f.setCustomizations(this.settings),this.applyTheme(f,void 0,!0);let S=XV.fromStorageData(this.storageService);S&&this.applyAndSetFileIconTheme(S,!0);let y=JV.fromStorageData(this.storageService);y&&this.applyAndSetProductIconTheme(y,!0),e.whenInstalledExtensionsRegistered().then(O=>{this.installConfigurationListener(),this.installPreferredSchemeListener(),this.installRegistryListeners(),this.initialize().catch(mt)});let w=hr();w.id="codiconStyles";let k=this._register(YOt(this));function T(){w.textContent=k.getCSS()}let N=this._register(new Dt(T,0));this._register(k.onDidChange(()=>N.schedule())),N.schedule()}initialize(){let e=this.environmentService.extensionDevelopmentLocationURI,t=e&&e.length===1?e[0]:void 0,o=async()=>{let s=this.colorThemeRegistry.findThemeByExtensionLocation(t);if(s.length){let c=s.find(u=>u.type===this.currentColorTheme.type);return this.setColorTheme(c?c.id:s[0].id,void 0)}let l=this.colorThemeRegistry.findThemeBySettingsId(this.settings.colorTheme,void 0);if(!l){await this.userDataInitializationService.whenInitializationFinished();let c=this.currentColorTheme.type==="light"?Bd.COLOR_THEME_LIGHT:Bd.COLOR_THEME_DARK;l=this.colorThemeRegistry.findThemeBySettingsId(this.settings.colorTheme,c)}return this.setColorTheme(l&&l.id,void 0)},n=async()=>{let s=this.fileIconThemeRegistry.findThemeByExtensionLocation(t);if(s.length)return this.setFileIconTheme(s[0].id,8);let l=this.fileIconThemeRegistry.findThemeBySettingsId(this.settings.fileIconTheme);return l||(await this.userDataInitializationService.whenInitializationFinished(),l=this.fileIconThemeRegistry.findThemeBySettingsId(this.settings.fileIconTheme)),this.setFileIconTheme(l?l.id:tSi,void 0)},r=async()=>{let s=this.productIconThemeRegistry.findThemeByExtensionLocation(t);if(s.length)return this.setProductIconTheme(s[0].id,8);let l=this.productIconThemeRegistry.findThemeBySettingsId(this.settings.productIconTheme);return l||(await this.userDataInitializationService.whenInitializationFinished(),l=this.productIconThemeRegistry.findThemeBySettingsId(this.settings.productIconTheme)),this.setProductIconTheme(l?l.id:zue,void 0)};return Promise.all([o(),n(),r()])}installConfigurationListener(){this._register(this.configurationService.onDidChangeConfiguration(e=>{if((e.affectsConfiguration("workbench.colorTheme")||e.affectsConfiguration("workbench.preferredDarkColorTheme")||e.affectsConfiguration("workbench.preferredLightColorTheme")||e.affectsConfiguration("workbench.preferredHighContrastColorTheme")||e.affectsConfiguration("workbench.preferredHighContrastLightColorTheme")||e.affectsConfiguration("window.autoDetectColorScheme")||e.affectsConfiguration("window.autoDetectHighContrast")||e.affectsConfiguration("window.systemColorTheme"))&&this.restoreColorTheme(),e.affectsConfiguration("workbench.iconTheme")&&this.restoreFileIconTheme(),e.affectsConfiguration("workbench.productIconTheme")&&this.restoreProductIconTheme(),this.currentColorTheme){let t=!1;e.affectsConfiguration("workbench.colorCustomizations")&&(this.currentColorTheme.setCustomColors(this.settings.colorCustomizations),t=!0),e.affectsConfiguration("editor.tokenColorCustomizations")&&(this.currentColorTheme.setCustomTokenColors(this.settings.tokenColorCustomizations),t=!0),e.affectsConfiguration("editor.semanticTokenColorCustomizations")&&(this.currentColorTheme.setCustomSemanticTokenColors(this.settings.semanticTokenColorCustomizations),t=!0),t&&(this.updateDynamicCSSRules(this.currentColorTheme),this.onColorThemeChange.fire(this.currentColorTheme))}}))}installRegistryListeners(){let e;this._register(this.colorThemeRegistry.onDidChange(async n=>{if(Qbi(n.themes),await this.restoreColorTheme())this.currentColorTheme.settingsId===Bd.COLOR_THEME_DARK&&!cn(e)&&await this.colorThemeRegistry.findThemeById(e)?(await this.setColorTheme(e,"auto"),e=void 0):n.added.some(r=>r.settingsId===this.currentColorTheme.settingsId)&&await this.reloadCurrentColorTheme();else if(n.removed.some(r=>r.settingsId===this.currentColorTheme.settingsId)){e=this.currentColorTheme.id;let r=this.colorThemeRegistry.findThemeBySettingsId(Bd.COLOR_THEME_DARK);await this.setColorTheme(r,"auto")}}));let t;this._register(this._register(this.fileIconThemeRegistry.onDidChange(async n=>{Ybi(n.themes),await this.restoreFileIconTheme()?this.currentFileIconTheme.id===tSi&&!cn(t)&&this.fileIconThemeRegistry.findThemeById(t)?(await this.setFileIconTheme(t,"auto"),t=void 0):n.added.some(r=>r.settingsId===this.currentFileIconTheme.settingsId)&&await this.reloadCurrentFileIconTheme():n.removed.some(r=>r.settingsId===this.currentFileIconTheme.settingsId)&&(t=this.currentFileIconTheme.id,await this.setFileIconTheme(tSi,"auto"))})));let o;return this._register(this.productIconThemeRegistry.onDidChange(async n=>{Xbi(n.themes),await this.restoreProductIconTheme()?this.currentProductIconTheme.id===zue&&!cn(o)&&this.productIconThemeRegistry.findThemeById(o)?(await this.setProductIconTheme(o,"auto"),o=void 0):n.added.some(r=>r.settingsId===this.currentProductIconTheme.settingsId)&&await this.reloadCurrentProductIconTheme():n.removed.some(r=>r.settingsId===this.currentProductIconTheme.settingsId)&&(o=this.currentProductIconTheme.id,await this.setProductIconTheme(zue,"auto"))})),this._register(this.languageService.onDidChange(()=>this.reloadCurrentFileIconTheme())),Promise.all([this.getColorThemes(),this.getFileIconThemes(),this.getProductIconThemes()]).then(([n,r,s])=>{Qbi(n),Ybi(r),Xbi(s)})}installPreferredSchemeListener(){this._register(this.hostColorService.onDidChangeColorScheme(()=>{this.settings.isDetectingColorScheme()&&this.restoreColorTheme()}))}getColorTheme(){return this.currentColorTheme}async getColorThemes(){return this.colorThemeRegistry.getThemes()}getPreferredColorScheme(){return this.settings.getPreferredColorScheme()}async getMarketplaceColorThemes(e,t,o){let n=await this.extensionResourceLoaderService.getExtensionGalleryResourceURL({publisher:e,name:t,version:o},"extension");if(n)try{let r=await this.extensionResourceLoaderService.readExtensionResource(je(n,"package.json"));return this.colorThemeRegistry.getMarketplaceThemes(JSON.parse(r),n,DE.fromName(e,t))}catch(r){this.logService.error("Problem loading themes from marketplace",r)}return[]}get onDidColorThemeChange(){return this.onColorThemeChange.event}setColorTheme(e,t){return this.colorThemeSequencer.queue(async()=>this.internalSetColorTheme(e,t))}async internalSetColorTheme(e,t){if(!e)return null;let o=Ae(e)?c5o(e):e.id;if(this.currentColorTheme.isLoaded&&o===this.currentColorTheme.id)return t!=="preview"&&this.currentColorTheme.toStorage(this.storageService),this.settings.setColorTheme(this.currentColorTheme,t);let n=this.colorThemeRegistry.findThemeById(o);if(!n)if(e instanceof o4)n=e;else return null;try{return await n.ensureLoaded(this.extensionResourceLoaderService),n.setCustomizations(this.settings),this.applyTheme(n,t)}catch(r){throw new Error(d(17283,null,n.location?.toString(),r.message))}}reloadCurrentColorTheme(){return this.colorThemeSequencer.queue(async()=>{try{let e=this.colorThemeRegistry.findThemeBySettingsId(this.currentColorTheme.settingsId)||this.currentColorTheme;await e.reload(this.extensionResourceLoaderService),e.setCustomizations(this.settings),await this.applyTheme(e,void 0,!1)}catch{this.logService.info("Unable to reload {0}: {1}",this.currentColorTheme.location?.toString())}})}async restoreColorTheme(){return this.colorThemeSequencer.queue(async()=>{let e=this.settings.colorTheme,t=this.colorThemeRegistry.findThemeBySettingsId(e);return t?(e!==this.currentColorTheme.settingsId?await this.internalSetColorTheme(t.id,void 0):t!==this.currentColorTheme&&(await t.ensureLoaded(this.extensionResourceLoaderService),t.setCustomizations(this.settings),await this.applyTheme(t,void 0,!0)),!0):!1})}updateDynamicCSSRules(e){let t=Iro(e,".monaco-workbench",wro.getThemingParticipants(),this.environmentService);iSi(t.code,s5o)}applyTheme(e,t,o=!1){return this.updateDynamicCSSRules(e),this.currentColorTheme.id?this.container.classList.remove(...this.currentColorTheme.classNames):this.container.classList.remove("vs","vs-dark","hc-black","hc-light"),this.container.classList.add(...e.classNames),this.currentColorTheme.clearCaches(),this.currentColorTheme=e,this.colorThemingParticipantChangeListener||(this.colorThemingParticipantChangeListener=wro.onThemingParticipantAdded(n=>this.updateDynamicCSSRules(this.currentColorTheme))),this.colorThemeWatcher.update(e),this.sendTelemetry(e.id,e.extensionData,"color"),o?Promise.resolve(null):(this.onColorThemeChange.fire(this.currentColorTheme),e.isLoaded&&t!=="preview"&&e.toStorage(this.storageService),this.settings.setColorTheme(this.currentColorTheme,t))}sendTelemetry(e,t,o){if(t){let n=o+t.extensionId;this.themeExtensionsActivated.get(n)||(this.telemetryService.publicLog2("activateThemeExtension",{id:t.extensionId,name:t.extensionName,isBuiltin:t.extensionIsBuiltin,publisherDisplayName:t.extensionPublisher,themeId:e}),this.themeExtensionsActivated.set(n,!0))}}async getFileIconThemes(){return this.fileIconThemeRegistry.getThemes()}getFileIconTheme(){return this.currentFileIconTheme}get onDidFileIconThemeChange(){return this.onFileIconThemeChange.event}async setFileIconTheme(e,t){return this.fileIconThemeSequencer.queue(async()=>this.internalSetFileIconTheme(e,t))}async internalSetFileIconTheme(e,t){e===void 0&&(e="");let o=Ae(e)?e:e.id;if(o!==this.currentFileIconTheme.id||!this.currentFileIconTheme.isLoaded){let r=this.fileIconThemeRegistry.findThemeById(o);!r&&e instanceof XV&&(r=e),r||(r=XV.noIconTheme),await r.ensureLoaded(this.fileIconThemeLoader),this.applyAndSetFileIconTheme(r)}let n=this.currentFileIconTheme;return n.isLoaded&&t!=="preview"&&(!n.location||!M7(n.location))&&n.toStorage(this.storageService),await this.settings.setFileIconTheme(this.currentFileIconTheme,t),n}async getMarketplaceFileIconThemes(e,t,o){let n=await this.extensionResourceLoaderService.getExtensionGalleryResourceURL({publisher:e,name:t,version:o},"extension");if(n)try{let r=await this.extensionResourceLoaderService.readExtensionResource(je(n,"package.json"));return this.fileIconThemeRegistry.getMarketplaceThemes(JSON.parse(r),n,DE.fromName(e,t))}catch(r){this.logService.error("Problem loading themes from marketplace",r)}return[]}async reloadCurrentFileIconTheme(){return this.fileIconThemeSequencer.queue(async()=>{await this.currentFileIconTheme.reload(this.fileIconThemeLoader),this.applyAndSetFileIconTheme(this.currentFileIconTheme)})}async restoreFileIconTheme(){return this.fileIconThemeSequencer.queue(async()=>{let e=this.settings.fileIconTheme,t=this.fileIconThemeRegistry.findThemeBySettingsId(e);return t?(e!==this.currentFileIconTheme.settingsId?await this.internalSetFileIconTheme(t.id,void 0):t!==this.currentFileIconTheme&&(await t.ensureLoaded(this.fileIconThemeLoader),this.applyAndSetFileIconTheme(t,!0)),!0):!1})}applyAndSetFileIconTheme(e,t=!1){this.currentFileIconTheme=e,iSi(e.styleSheetContent,a5o),e.id?this.container.classList.add(yro):this.container.classList.remove(yro),this.fileIconThemeWatcher.update(e),e.id&&this.sendTelemetry(e.id,e.extensionData,"fileIcon"),t||this.onFileIconThemeChange.fire(this.currentFileIconTheme)}async getProductIconThemes(){return this.productIconThemeRegistry.getThemes()}getProductIconTheme(){return this.currentProductIconTheme}get onDidProductIconThemeChange(){return this.onProductIconThemeChange.event}async setProductIconTheme(e,t){return this.productIconThemeSequencer.queue(async()=>this.internalSetProductIconTheme(e,t))}async internalSetProductIconTheme(e,t){e===void 0&&(e="");let o=Ae(e)?e:e.id;if(o!==this.currentProductIconTheme.id||!this.currentProductIconTheme.isLoaded){let r=this.productIconThemeRegistry.findThemeById(o);!r&&e instanceof JV&&(r=e),r||(r=JV.defaultTheme),await r.ensureLoaded(this.extensionResourceLoaderService,this.logService),this.applyAndSetProductIconTheme(r)}let n=this.currentProductIconTheme;return n.isLoaded&&t!=="preview"&&(!n.location||!M7(n.location))&&n.toStorage(this.storageService),await this.settings.setProductIconTheme(this.currentProductIconTheme,t),n}async getMarketplaceProductIconThemes(e,t,o){let n=await this.extensionResourceLoaderService.getExtensionGalleryResourceURL({publisher:e,name:t,version:o},"extension");if(n)try{let r=await this.extensionResourceLoaderService.readExtensionResource(je(n,"package.json"));return this.productIconThemeRegistry.getMarketplaceThemes(JSON.parse(r),n,DE.fromName(e,t))}catch(r){this.logService.error("Problem loading themes from marketplace",r)}return[]}async reloadCurrentProductIconTheme(){return this.productIconThemeSequencer.queue(async()=>{await this.currentProductIconTheme.reload(this.extensionResourceLoaderService,this.logService),this.applyAndSetProductIconTheme(this.currentProductIconTheme)})}async restoreProductIconTheme(){return this.productIconThemeSequencer.queue(async()=>{let e=this.settings.productIconTheme,t=this.productIconThemeRegistry.findThemeBySettingsId(e);return t?(e!==this.currentProductIconTheme.settingsId?await this.internalSetProductIconTheme(t.id,void 0):t!==this.currentProductIconTheme&&(await t.ensureLoaded(this.extensionResourceLoaderService,this.logService),this.applyAndSetProductIconTheme(t,!0)),!0):!1})}applyAndSetProductIconTheme(e,t=!1){this.currentProductIconTheme=e,iSi(e.styleSheetContent,l5o),this.productIconThemeWatcher.update(e),e.id&&this.sendTelemetry(e.id,e.extensionData,"productIcon"),t||this.onProductIconThemeChange.fire(this.currentProductIconTheme)}};JYe=I([m(0,lt),m(1,le),m(2,B),m(3,Te),m(4,ru),m(5,be),m(6,Bx),m(7,fi),m(8,ne),m(9,jOt),m(10,r4),m(11,kt)],JYe);var ZYe=class{constructor(i,e,t){this.fileService=i;this.environmentService=e;this.onUpdate=t;this.watcherDisposables=new P}update(i){Xe(i.location,this.watchedLocation)||(this.watchedLocation=void 0,this.watcherDisposables.clear(),i.location&&(i.watch||this.environmentService.isExtensionDevelopment)&&(this.watchedLocation=i.location,this.watcherDisposables.add(this.fileService.watch(i.location)),this.watcherDisposables.add(this.fileService.onDidFilesChange(e=>{this.watchedLocation&&e.contains(this.watchedLocation,0)&&this.onUpdate()}))))}dispose(){this.watcherDisposables.dispose(),this.watchedLocation=void 0}};function iSi(a,i){let e=It.document.head.getElementsByClassName(i);if(e.length===0){let t=hr();t.className=i,t.textContent=a}else e[0].textContent=a}sro();oro();gro();we(Gp,JYe,0);var m5o=Tn.registerExtensionPoint({extensionPoint:"resourceLabelFormatters",jsonSchema:{description:d(17085,null),type:"array",items:{type:"object",required:["scheme","formatting"],properties:{scheme:{type:"string",description:d(17090,null)},authority:{type:"string",description:d(17086,null)},formatting:{description:d(17087,null),type:"object",properties:{label:{type:"string",description:d(17089,null)},separator:{type:"string",description:d(17091,null)},stripPathStartingSeparator:{type:"boolean",description:d(17092,null)},tildify:{type:"boolean",description:d(17093,null)},workspaceSuffix:{type:"string",description:d(17088,null)}}}}}}}),h5o=/\//g,g5o=/[\\\/]/g,f5o=/\$\{(scheme|authoritySuffix|authority|path|(query)\.(.+?))\}/g;function v5o(a){return!!(a&&a[2]===":")}var eXe=class{constructor(i){this.formattersDisposables=new Map;m5o.setHandler((e,t)=>{for(let o of t.added)for(let n of o.value){let r={...n};typeof r.formatting.label!="string"&&(r.formatting.label="${authority}${path}"),typeof r.formatting.separator!="string"&&(r.formatting.separator=Rd),!Ea(o.description,"contribLabelFormatterWorkspaceTooltip")&&r.formatting.workspaceTooltip&&(r.formatting.workspaceTooltip=void 0),this.formattersDisposables.set(r,i.registerFormatter(r))}for(let o of t.removed)for(let n of o.value)Ue(this.formattersDisposables.get(n))})}};eXe=I([m(0,ot)],eXe);oe.as(Qi.Workbench).registerWorkbenchContribution(eXe,3);var Cro=50,tXe=class extends C{constructor(e,t,o,n,r,s){super();this.environmentService=e;this.contextService=t;this.pathService=o;this.remoteAgentService=n;this._onDidChangeFormatters=this._register(new E({leakWarningThreshold:400}));this.onDidChangeFormatters=this._onDidChangeFormatters.event;this.os=zo,this.userHome=o.defaultUriScheme===Y.file?this.pathService.userHome({preferLocal:!0}):void 0;let l=this.storedFormattersMemento=new Bl("cachedResourceLabelFormatters2",r);this.storedFormatters=l.getMemento(0,1),this.formatters=this.storedFormatters?.formatters?.slice()||[],this.resolveRemoteEnvironment()}async resolveRemoteEnvironment(){let e=await this.remoteAgentService.getEnvironment();this.os=e?.os??zo,this.userHome=await this.pathService.userHome()}findFormatting(e){let t;for(let o of this.formatters)if(o.scheme===e.scheme){if(!o.authority&&(!t||o.priority)){t=o;continue}if(!o.authority)continue;Cp(o.authority,e.authority,{ignoreCase:!0})&&(!t?.authority||o.authority.length>t.authority.length||o.authority.length===t.authority.length&&o.priority)&&(t=o)}return t?t.formatting:void 0}getUriLabel(e,t={}){let o=this.findFormatting(e);o&&t.separator&&(o={...o,separator:t.separator});let n=this.doGetUriLabel(e,o,t);return!o&&t.separator&&(n=this.adjustPathSeparators(n,t.separator)),t.appendWorkspaceSuffix&&o?.workspaceSuffix&&(n=this.appendWorkspaceSuffix(n,e)),n}doGetUriLabel(e,t,o={}){if(!t)return T$i(e,{os:this.os,tildify:this.userHome?{userHome:this.userHome}:void 0,relative:o.relative?{noPrefix:o.noPrefix,getWorkspace:()=>this.contextService.getWorkspace(),getWorkspaceFolder:n=>this.contextService.getWorkspaceFolder(n)}:void 0});if(o.relative&&this.contextService){let n=this.contextService.getWorkspaceFolder(e);if(!n){let s=this.contextService.getWorkspace().folders.at(0);s&&e.scheme!==s.uri.scheme&&e.path.startsWith(Lo.sep)&&(n=this.contextService.getWorkspaceFolder(s.uri.with({path:e.path})))}if(n){let r=this.formatUri(n.uri,t,o.noPrefix),s=this.formatUri(e,t,o.noPrefix),l=0;for(;s[l]&&s[l]===r[l];)l++;if(!s[l]||s[l]===t.separator?s=s.substring(1+l):l===r.length&&n.uri.path===Lo.sep&&(s=s.substring(l)),this.contextService.getWorkspace().folders.length>1&&!o.noPrefix){let u=n?.name??Ra(n.uri);s=s?`${u} \u2022 ${s}`:u}return s}}return this.formatUri(e,t,o.noPrefix)}getUriBasenameLabel(e){let t=this.findFormatting(e),o=this.doGetUriLabel(e,t),n;return t?.separator===Ms.sep?n=Ms:t?.separator===Lo.sep?n=Lo:n=this.os===1?Ms:Lo,n.basename(o)}getWorkspaceLabel(e,t){if(Tq(e)){let o=VS(e);return $g(o)||TL(o)?this.getWorkspaceLabel(o,t):""}return A.isUri(e)?this.doGetSingleFolderWorkspaceLabel(e,t):$g(e)?this.doGetSingleFolderWorkspaceLabel(e.uri,t):TL(e)?this.doGetWorkspaceLabel(e.configPath,t):""}doGetWorkspaceLabel(e,t){if(_q(e,this.environmentService))return d(17084,null);if(xx(e))return d(17083,null);let o=Ye(e);o.endsWith(JN)&&(o=o.substr(0,o.length-JN.length-1));let n;switch(t?.verbose){case 0:n=o;break;case 2:n=d(17095,null,this.getUriLabel(je(ci(e),o)));break;case 1:default:n=d(17094,null,o);break}return t?.verbose===0?n:this.appendWorkspaceSuffix(n,e)}doGetSingleFolderWorkspaceLabel(e,t){let o;switch(t?.verbose){case 2:o=this.getUriLabel(e);break;case 0:case 1:default:o=Ye(e)||Lo.sep;break}return t?.verbose===0?o:this.appendWorkspaceSuffix(o,e)}getSeparator(e,t){return this.findFormatting(A.from({scheme:e,authority:t}))?.separator||Lo.sep}getHostLabel(e,t){return this.findFormatting(A.from({scheme:e,authority:t}))?.workspaceSuffix||t||""}getHostTooltip(e,t){return this.findFormatting(A.from({scheme:e,authority:t}))?.workspaceTooltip}registerCachedFormatter(e){let t=this.storedFormatters.formatters??=[],o=t.findIndex(n=>n.scheme===e.scheme&&n.authority===e.authority);if(o===-1&&t.length>=Cro&&(o=Cro-1),o===-1)t.unshift(e);else{for(let n=o;n>0;n--)t[n]=t[n-1];t[0]=e}return this.storedFormattersMemento.saveMemento(),this.registerFormatter(e)}registerFormatter(e){return this.formatters.push(e),this._onDidChangeFormatters.fire({scheme:e.scheme}),{dispose:()=>{this.formatters=this.formatters.filter(t=>t!==e),this._onDidChangeFormatters.fire({scheme:e.scheme})}}}formatUri(e,t,o){let n=t.label.replace(f5o,(r,s,l,c)=>{switch(s){case"scheme":return e.scheme;case"authority":return e.authority;case"authoritySuffix":{let u=e.authority.indexOf("+");return u===-1?e.authority:e.authority.slice(u+1)}case"path":return t.stripPathStartingSeparator?e.path.slice(e.path[0]===t.separator?1:0):e.path;default:{if(l==="query"){let{query:u}=e;if(u&&u[0]==="{"&&u[u.length-1]==="}")try{return JSON.parse(u)[c]||""}catch{}}return""}}});return t.normalizeDriveLetter&&v5o(n)&&(n=n.charAt(1).toUpperCase()+n.substr(2)),t.tildify&&!o&&this.userHome&&(n=Z$e(n,this.userHome.fsPath,this.os)),t.authorityPrefix&&e.authority&&(n=t.authorityPrefix+n),this.adjustPathSeparators(n,t.separator)}adjustPathSeparators(e,t){return e.replace(this.os===1?g5o:h5o,t)}appendWorkspaceSuffix(e,t){let o=this.findFormatting(t),n=o&&typeof o.workspaceSuffix=="string"?o.workspaceSuffix:void 0;return n?`${e} [${n}]`:e}};tXe=I([m(0,Vt),m(1,Pe),m(2,wn),m(3,yo),m(4,le),m(5,ao)],tXe);we(ot,tXe,1);var oSi="Offline";function oXe(a){return a instanceof iXe?!0:a instanceof Error&&a.name===oSi&&a.message===oSi}var iXe=class extends Error{constructor(){super(oSi),this.name=this.message}};var xro=/^(\^|>=)?((\d+)|x)\.((\d+)|x)\.((\d+)|x)(\-.*)?$/,b5o=/^-(\d{4})(\d{2})(\d{2})(\d{2})?(\d{2})?$/;function S5o(a){return a=a.trim(),a==="*"||xro.test(a)}function rSi(a){if(!S5o(a))return null;if(a=a.trim(),a==="*")return{hasCaret:!1,hasGreaterEquals:!1,majorBase:0,majorMustEqual:!1,minorBase:0,minorMustEqual:!1,patchBase:0,patchMustEqual:!1,preRelease:null};let i=a.match(xro);return i?{hasCaret:i[1]==="^",hasGreaterEquals:i[1]===">=",majorBase:i[2]==="x"?0:parseInt(i[2],10),majorMustEqual:i[2]!=="x",minorBase:i[4]==="x"?0:parseInt(i[4],10),minorMustEqual:i[4]!=="x",patchBase:i[6]==="x"?0:parseInt(i[6],10),patchMustEqual:i[6]!=="x",preRelease:i[8]||null}:null}function sSi(a){if(!a)return null;let i=a.majorBase,e=a.majorMustEqual,t=a.minorBase,o=a.minorMustEqual,n=a.patchBase,r=a.patchMustEqual;a.hasCaret&&(i===0||(o=!1),r=!1);let s=0;if(a.preRelease){let l=b5o.exec(a.preRelease);if(l){let[,c,u,p,h,g]=l;s=Date.UTC(Number(c),Number(u)-1,Number(p),Number(h)||0,Number(g)||0)}}return{majorBase:i,majorMustEqual:e,minorBase:t,minorMustEqual:o,patchBase:n,patchMustEqual:r,isMinimum:a.hasGreaterEquals,notBefore:s}}function I5o(a,i,e){let t;typeof a=="string"?t=sSi(rSi(a)):t=a;let o;i instanceof Date?o=i.getTime():typeof i=="string"&&(o=new Date(i).getTime());let n;if(typeof e=="string"?n=sSi(rSi(e)):n=e,!t||!n)return!1;let r=t.majorBase,s=t.minorBase,l=t.patchBase,c=n.majorBase,u=n.minorBase,p=n.patchBase,h=n.notBefore,g=n.majorMustEqual,f=n.minorMustEqual,v=n.patchMustEqual;return n.isMinimum?r>c?!0:r<c?!1:s>u?!0:s<u||o&&o<h?!1:l>=p:(r===1&&c===0&&(!g||!f||!v)&&(c=1,u=0,p=0,g=!0,f=!1,v=!1),r<c?!1:r>c?!g:s<u?!1:s>u?!f:l<p?!1:l>p?!v:!(o&&o<h))}function kro(a,i,e,t,o,n){let r=[];if(typeof t.publisher<"u"&&typeof t.publisher!="string")return r.push([gt.Error,d(2042,null)]),r;if(typeof t.name!="string")return r.push([gt.Error,d(2041,null,"name")]),r;if(typeof t.version!="string")return r.push([gt.Error,d(2043,null,"version")]),r;if(!t.engines)return r.push([gt.Error,d(2034,null,"engines")]),r;if(typeof t.engines.vscode!="string")return r.push([gt.Error,d(2035,null,"engines.vscode")]),r;if(typeof t.extensionDependencies<"u"&&!nSi(t.extensionDependencies))return r.push([gt.Error,d(2037,null,"extensionDependencies")]),r;if(typeof t.extensionAffinity<"u"&&!nSi(t.extensionAffinity))return r.push([gt.Error,d(2036,null,"extensionAffinity")]),r;if(typeof t.activationEvents<"u"){if(!nSi(t.activationEvents))return r.push([gt.Error,d(2030,null,"activationEvents")]),r;if(typeof t.main>"u"&&typeof t.browser>"u")return r.push([gt.Error,d(2031,null,"activationEvents","main","browser")]),r}if(typeof t.extensionKind<"u"&&typeof t.main>"u"&&r.push([gt.Warning,d(2038,null,"extensionKind")]),typeof t.main<"u"){if(typeof t.main!="string")return r.push([gt.Error,d(2039,null,"main")]),r;{let c=je(e,t.main);La(c,e)||r.push([gt.Warning,d(2040,null,c.path,e.path)])}}if(typeof t.browser<"u"){if(typeof t.browser!="string")return r.push([gt.Error,d(2032,null,"browser")]),r;{let c=je(e,t.browser);La(c,e)||r.push([gt.Warning,d(2033,null,c.path,e.path)])}}if(!vke(t.version))return r.push([gt.Error,d(2044,null)]),r;let s=[];if(!y5o(a,i,t,o,s))for(let c of s)r.push([gt.Error,c]);if(n&&t.enabledApiProposals?.length){let c=[];if(!s4([...t.enabledApiProposals],c))for(let u of c)r.push([gt.Error,u])}return r}function y5o(a,i,e,t,o){return t||typeof e.main>"u"&&typeof e.browser>"u"?!0:Ero(a,i,e.engines.vscode,o)}function Kue(a,i,e){return a==="*"||Ero(i,e,a)}function s4(a,i){if(a.length===0)return!0;let e=Array.isArray(i)?i:void 0,t=(Array.isArray(i)?void 0:i)??rz,o=[],n=W8i(a);for(let{proposalName:r,version:s}of n){if(!s)continue;t[r]?.version!==s&&o.push(r)}return o.length?(e&&(o.length===1?e.push(d(2028,null,o[0])):e.push(d(2029,null,o.slice(0,o.length-1).map(r=>`'${r}'`).join(", "),o[o.length-1]))),!1):!0}function Ero(a,i,e,t=[]){let o=sSi(rSi(e));if(!o)return t.push(d(2048,null,e)),!1;if(o.majorBase===0){if(!o.majorMustEqual||!o.minorMustEqual)return t.push(d(2046,null,e)),!1}else if(!o.majorMustEqual)return t.push(d(2047,null,e)),!1;return I5o(a,i,o)?!0:(t.push(d(2045,null,a,e)),!1)}function nSi(a){if(!Array.isArray(a))return!1;for(let i=0,e=a.length;i<e;i++)if(typeof a[i]!="string")return!1;return!0}async function JOt(a,i,e,t,o,n,r){let s={"X-Market-Client-Id":`VSCode ${a}`,"User-Agent":`VSCode ${a} (${i.nameShort})`};if(KL(i,e)&&xO(t)===3){let l=await TO(e,o,n);s["X-Market-User-Id"]=l,s["VSCode-SessionId"]=r.machineId||l}return s}var ZOt=Gt?"web":Pxt(Pp,ube),oFt="X-Market-Search-Activity-Id",aSi="Activityid",lSi="Server",cSi="X-Vss-E2eid",fw={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"},eB={Dependency:"Microsoft.VisualStudio.Code.ExtensionDependencies",ExtensionPack:"Microsoft.VisualStudio.Code.ExtensionPack",Engine:"Microsoft.VisualStudio.Code.Engine",PreRelease:"Microsoft.VisualStudio.Code.PreRelease",EnabledApiProposals:"Microsoft.VisualStudio.Code.EnabledApiProposals",LocalizedLanguages:"Microsoft.VisualStudio.Code.LocalizedLanguages",WebExtension:"Microsoft.VisualStudio.Code.WebExtension",SponsorLink:"Microsoft.VisualStudio.Code.SponsorLink",SupportLink:"Microsoft.VisualStudio.Services.Links.Support",ExecutesCode:"Microsoft.VisualStudio.Code.ExecutesCode",Private:"PrivateMarketplace"},x5o=10,k5o={pageNumber:1,pageSize:x5o,sortBy:"NoneOrRelevance",sortOrder:0,flags:[],criteria:[],assetTypes:[]};var TDe=class a{constructor(i=k5o){this.state=i}get pageNumber(){return this.state.pageNumber}get pageSize(){return this.state.pageSize}get sortBy(){return this.state.sortBy}get sortOrder(){return this.state.sortOrder}get flags(){return this.state.flags}get criteria(){return this.state.criteria}get assetTypes(){return this.state.assetTypes}get source(){return this.state.source}get searchText(){let i=this.state.criteria.filter(e=>e.filterType==="SearchText")[0];return i&&i.value?i.value:""}withPage(i,e=this.state.pageSize){return new a({...this.state,pageNumber:i,pageSize:e})}withFilter(i,...e){let t=[...this.state.criteria,...e.length?e.map(o=>({filterType:i,value:o})):[{filterType:i}]];return new a({...this.state,criteria:t})}withSortBy(i){return new a({...this.state,sortBy:i})}withSortOrder(i){return new a({...this.state,sortOrder:i})}withFlags(...i){return new a({...this.state,flags:Uo(i)})}withAssetTypes(...i){return new a({...this.state,assetTypes:i})}withSource(i){return new a({...this.state,source:i})}};function dSi(a,i){let e=(a||[]).filter(t=>t.statisticName===i)[0];return e?e.value:0}function E5o(a){let i="Microsoft.VisualStudio.Code.Translation.";return a.files.filter(t=>t.assetType.indexOf(i)===0).reduce((t,o)=>{let n=ZV(a,o.assetType);return n&&t.push([o.assetType.substring(i.length),n]),t},[])}function T5o(a){if(a.properties){let i=a.properties.filter(o=>o.key===fw.Repository),e=new RegExp("((git|ssh|http(s)?)|(git@[\\w.]+))(:(//)?)([\\w.@:/\\-~]+)(.git)(/)?"),t=i.filter(o=>e.test(o.value))[0];return t?{uri:t.value,fallbackUri:t.value}:null}return ZV(a,fw.Repository)}function _5o(a){return{uri:`${a.fallbackAssetUri}/${fw.VSIX}?redirect=true${a.targetPlatform?`&targetPlatform=${a.targetPlatform}`:""}`,fallbackUri:`${a.fallbackAssetUri}/${fw.VSIX}${a.targetPlatform?`?targetPlatform=${a.targetPlatform}`:""}`}}function ZV(a,i){return a.files.filter(t=>t.assetType===i)[0]?{uri:`${a.assetUri}/${i}${a.targetPlatform?`?targetPlatform=${a.targetPlatform}`:""}`,fallbackUri:`${a.fallbackAssetUri}/${i}${a.targetPlatform?`?targetPlatform=${a.targetPlatform}`:""}`}:null}function Tro(a,i){let e=a.properties?a.properties.filter(o=>o.key===i):[],t=e.length>0&&e[0].value;return t?t.split(",").map(o=>jle(o)):[]}function nFt(a){let i=a.properties?a.properties.filter(e=>e.key===eB.Engine):[];return i.length>0&&i[0].value||""}function D5o(a,i){a.properties=a.properties??[],a.properties.push({key:eB.Engine,value:i})}function _De(a){let i=a.properties?a.properties.filter(e=>e.key===eB.PreRelease):[];return i.length>0&&i[0].value==="true"}function Rro(a,i){return i.extensionProperties?.[a.toLowerCase()]?.hasPrereleaseVersion}function L5o(a,i){return i.extensionProperties?.[a.toLowerCase()]?.excludeVersionRange}function R5o(a){let i=a.properties?a.properties.filter(e=>e.key===eB.Private):[];return i.length>0&&i[0].value==="true"}function M5o(a){let i=a.properties?a.properties.filter(e=>e.key===eB.ExecutesCode):[];return i.length>0?i[0].value==="true":void 0}function pSi(a){let i=a.properties?a.properties.filter(t=>t.key===eB.EnabledApiProposals):[],e=i.length>0&&i[0].value||"";return e?e.split(","):[]}function P5o(a){let i=a.properties?a.properties.filter(t=>t.key===eB.LocalizedLanguages):[],e=i.length>0&&i[0].value||"";return e?e.split(","):[]}function A5o(a){return a.properties?.find(i=>i.key===eB.SponsorLink)?.value}function N5o(a){return a.properties?.find(i=>i.key===eB.SupportLink)?.value}function O5o(a){return a.indexOf("preview")!==-1}function Gue(a){return a.targetPlatform?B6i(a.targetPlatform):"undefined"}function eFt(a){let i=Uo(a.versions.map(Gue)),e=!!a.tags?.includes(Rxt),t=i.indexOf("web");return e?t===-1&&i.push("web"):t!==-1&&i.splice(t,1),i}function _ro(a,i){for(let e=0;e<a.length;e++){let t=a[e];if(t.version===a[e-1]?.version){let o=e;if(Gue(t)===i)for(;o>0&&a[o-1].version===t.version;)o--;o!==e&&(a.splice(e,1),a.splice(o,0,t))}}return a}function F5o(a,i,e){let t=[],o=-1,n=-1;for(let r of a){let s=Gue(r);if(!zle(s,e,i)){t.push(r);continue}_De(r)?o===-1?(o=t.length,t.push(r)):s===i&&t[o].version===r.version&&(t[o]=r):n===-1?(n=t.length,t.push(r)):s===i&&t[n].version===r.version&&(t[n]=r)}return t}function Dro(a,i,e){a.telemetryData={index:i,querySource:e,queryActivityId:a.queryContext?.[oFt]}}function uSi(a,i,e,t,o,n){let r=a.versions[0],s={manifest:ZV(i,fw.Manifest),readme:ZV(i,fw.Details),changelog:ZV(i,fw.Changelog),license:ZV(i,fw.License),repository:T5o(i),download:_5o(i),icon:ZV(i,fw.Icon),signature:ZV(i,fw.Signature),coreTranslations:E5o(i)},l=oP(t,a.linkType??"ExtensionDetailsViewUriTemplate"),c=oP(t,a.publisher.linkType??"PublisherViewUriTemplate"),u=oP(t,a.ratingLinkType??"ExtensionRatingViewUriTemplate"),p=Df(a.publisher.publisherName,a.extensionName);return{type:"gallery",identifier:{id:p,uuid:a.extensionId},name:a.extensionName,version:i.version,displayName:a.displayName,publisherId:a.publisher.publisherId,publisher:a.publisher.publisherName,publisherDisplayName:a.publisher.displayName,publisherDomain:a.publisher.domain?{link:a.publisher.domain,verified:!!a.publisher.isDomainVerified}:void 0,publisherSponsorLink:A5o(r),description:a.shortDescription??"",installCount:dSi(a.statistics,"install"),rating:dSi(a.statistics,"averagerating"),ratingCount:dSi(a.statistics,"ratingcount"),categories:a.categories||[],tags:a.tags||[],releaseDate:Date.parse(a.releaseDate),lastUpdated:Date.parse(a.lastUpdated),allTargetPlatforms:e,assets:s,properties:{dependencies:Tro(i,eB.Dependency),extensionPack:Tro(i,eB.ExtensionPack),engine:nFt(i),enabledApiProposals:pSi(i),localizedLanguages:P5o(i),targetPlatform:Gue(i),isPreReleaseVersion:_De(i),executesCode:M5o(i)},hasPreReleaseVersion:Rro(p,o)??_De(r),hasReleaseVersion:!0,private:R5o(r),preview:O5o(a.flags),isSigned:!!s.signature,queryContext:n,supportLink:N5o(r),detailsLink:l?PT(l,{publisher:a.publisher.publisherName,name:a.extensionName}):void 0,publisherLink:c?PT(c,{publisher:a.publisher.publisherName}):void 0,ratingLink:u?PT(u,{publisher:a.publisher.publisherName,name:a.extensionName}):void 0}}var FJ=class{constructor(i,e,t,o,n,r,s,l,c,u){this.requestService=e;this.logService=t;this.environmentService=o;this.telemetryService=n;this.fileService=r;this.productService=s;this.configurationService=l;this.allowedExtensionsService=c;this.extensionGalleryManifestService=u;this.extensionsControlUrl=s.extensionsGallery?.controlUrl,this.unpkgResourceApi=s.extensionsGallery?.extensionUrlTemplate,this.extensionsEnabledWithApiProposalVersion=s.extensionsEnabledWithApiProposalVersion?.map(p=>p.toLowerCase())??[],this.commonHeadersPromise=JOt(s.version,s,this.environmentService,this.configurationService,this.fileService,i,this.telemetryService)}isEnabled(){return this.extensionGalleryManifestService.extensionGalleryManifestStatus==="available"}async getExtensions(i,e,t){let o=await this.extensionGalleryManifestService.getExtensionGalleryManifest();if(!o)throw new Error("No extension gallery service configured.");let n=ve.isCancellationToken(e)?{}:e,r=ve.isCancellationToken(e)?e:t,s=this.getResourceApi(o),l=s?await this.getExtensionsUsingResourceApi(i,n,s,o,r):await this.getExtensionsUsingQueryApi(i,n,o,r),c=l.map(p=>p.identifier.uuid),u=[];for(let p of i)p.uuid&&!c.includes(p.uuid)&&u.push({...p,uuid:void 0});if(u.length){this.telemetryService.publicLog2("galleryService:additionalQueryByName",{count:u.length});let p=await this.getExtensionsUsingQueryApi(u,n,o,r);l.push(...p)}return l}getResourceApi(i){let e=oP(i,"ExtensionLatestVersionUriTemplate");if(e)return{uri:e,fallback:this.unpkgResourceApi}}async getExtensionsUsingQueryApi(i,e,t,o){let n=[],r=[],s=[],l=[],c=!0;for(let h of i)h.uuid?r.push(h.uuid):n.push(h.id),h.version?l.push({id:h.id,uuid:h.uuid,version:h.version}):s.push({id:h.id,uuid:h.uuid,includePreRelease:!!h.preRelease}),c=c&&!!h.hasPreRelease&&!h.preRelease;if(!r.length&&!n.length)return[];let u=new TDe().withPage(1,i.length);r.length&&(u=u.withFilter("ExtensionId",...r)),n.length&&(u=u.withFilter("ExtensionName",...n)),e.queryAllVersions&&(u=u.withFlags(...u.flags,"IncludeVersions")),e.source&&(u=u.withSource(e.source));let{extensions:p}=await this.queryGalleryExtensions(u,{targetPlatform:e.targetPlatform??ZOt,includePreRelease:s,versions:l,compatible:!!e.compatible,productVersion:e.productVersion??{version:this.productService.version,date:this.productService.date},isQueryForReleaseVersionFromPreReleaseVersion:c},t,o);return e.source&&p.forEach((h,g)=>Dro(h,g,e.source)),p}async getExtensionsUsingResourceApi(i,e,t,o,n){let r=[],s=[],l=[];for(let c of i)mj.test(c.id)&&(c.version?s.push(c):l.push(c));if(await Promise.all(l.map(async c=>{let u;try{u=await this.getLatestGalleryExtension(c,e,t,o,n),Ae(u)?(this.telemetryService.publicLog2("galleryService:fallbacktoquery",{extension:c.id,preRelease:!!c.preRelease,compatible:!!e.compatible,errorCode:u}),s.push(c)):r.push(u)}catch(p){if(p instanceof xE)switch(p.code){case"Offline":case"Cancelled":case"Timeout":throw p}this.logService.error(`Error while getting the latest version for the extension ${c.id}.`,Cn(p)),this.telemetryService.publicLog2("galleryService:fallbacktoquery",{extension:c.id,preRelease:!!c.preRelease,compatible:!!e.compatible,errorCode:p instanceof xE?p.code:"Unknown"}),s.push(c)}})),s.length){let c=await this.getExtensionsUsingQueryApi(s,e,o,n);r.push(...c)}return r}async getLatestGalleryExtension(i,e,t,o,n){let r=await this.getLatestRawGalleryExtensionWithFallback(i,t,n);if(!r)return"NOT_FOUND";let s=eFt(r),l=await this.getValidRawGalleryExtensionVersionFromLatestVersions(r,r.versions,i,e,s);return l?uSi(r,l,s,o,this.productService):"NOT_COMPATIBLE"}async getValidRawGalleryExtensionVersionFromLatestVersions(i,e,t,o,n){let r=o.targetPlatform??ZOt,s=F5o(e,r,n),l=await this.getValidRawGalleryExtensionVersion(i,s,{targetPlatform:r,compatible:!!o.compatible,productVersion:o.productVersion??{version:this.productService.version,date:this.productService.date},version:t.preRelease?1:0},n);if(!t.preRelease)return l;let c=l,u=await this.getValidRawGalleryExtensionVersion(i,s,{targetPlatform:r,compatible:!!o.compatible,productVersion:o.productVersion??{version:this.productService.version,date:this.productService.date},version:0},n);if(c&&u)return iR(u.version,c.version)?u:c;if(o.compatible){if(u){let p=await this.getValidRawGalleryExtensionVersion(i,s,{targetPlatform:r,compatible:!1,productVersion:o.productVersion??{version:this.productService.version,date:this.productService.date},version:1},n);if(!p||iR(u.version,p.version))return u}return c}return c??u??null}async getCompatibleExtension(i,e,t,o={version:this.productService.version,date:this.productService.date}){return ixe(i.allTargetPlatforms,t)?null:await this.isExtensionCompatible(i,e,t)?i:this.allowedExtensionsService.isAllowed({id:i.identifier.id,publisherDisplayName:i.publisherDisplayName})!==!0?null:(await this.getExtensions([{...i.identifier,preRelease:e,hasPreRelease:i.hasPreReleaseVersion}],{compatible:!0,productVersion:o,queryAllVersions:!0,targetPlatform:t},ve.None))[0]??null}async isExtensionCompatible(i,e,t,o={version:this.productService.version,date:this.productService.date}){return this.isValidVersion({id:i.identifier.id,version:i.version,isPreReleaseVersion:i.properties.isPreReleaseVersion,targetPlatform:i.properties.targetPlatform,manifestAsset:i.assets.manifest,engine:i.properties.engine,enabledApiProposals:i.properties.enabledApiProposals},{targetPlatform:t,compatible:!0,productVersion:o,version:e?2:0},i.publisherDisplayName,i.allTargetPlatforms)}async isValidVersion(i,{targetPlatform:e,compatible:t,productVersion:o,version:n},r,s){let l=Rro(i.id,this.productService),c=L5o(i.id,this.productService);if(i.isPreReleaseVersion&&l===!1||c&&J8e(i.version,c))return!1;if(Ae(n)){if(i.version!==n)return!1}else if((n===0||n===1)&&i.isPreReleaseVersion!==(n===1))return!1;return!(e&&!zle(i.targetPlatform,s,e)||t&&(this.allowedExtensionsService.isAllowed({id:i.id,publisherDisplayName:r,version:i.version,prerelease:i.isPreReleaseVersion,targetPlatform:i.targetPlatform})!==!0||!this.areApiProposalsCompatible(i.id,i.enabledApiProposals)||!await this.isEngineValid(i.id,i.version,i.engine,i.manifestAsset,o)))}areApiProposalsCompatible(i,e){return!e||!this.extensionsEnabledWithApiProposalVersion.includes(i.toLowerCase())?!0:s4(e)}async isEngineValid(i,e,t,o,n){if(!t)try{t=await this.getEngine(i,e,o)}catch(r){return this.logService.error(`Error while getting the engine for the version ${e}.`,Cn(r)),!1}return t?Kue(t,n.version,n.date):(this.logService.error(`Missing engine for the extension ${i} with version ${e}`),!1)}async getEngine(i,e,t){if(!t){this.logService.error(`Missing engine and manifest asset for the extension ${i} with version ${e}`);return}try{this.telemetryService.publicLog2("galleryService:engineFallback",{extension:i,extensionVersion:e});let o={"Accept-Encoding":"gzip"},n=await this.getAsset(i,t,fw.Manifest,e,{headers:o}),r=await hh(n);if(!r){this.logService.error(`Manifest was not found for the extension ${i} with version ${e}`);return}return r.engines.vscode}catch(o){this.logService.error(`Error while getting the engine for the version ${e}.`,Cn(o));return}}async query(i,e){let t=await this.extensionGalleryManifestService.getExtensionGalleryManifest();if(!t)throw new Error("No extension gallery service configured.");let o=i.text||"",n=i.pageSize??50,r=new TDe().withPage(1,n);o?(o=o.replace(/\bcategory:("([^"]*)"|([^"]\S*))(\s+|\b|$)/g,(p,h,g)=>(r=r.withFilter("Category",g||h),"")),o=o.replace(/\btag:("([^"]*)"|([^"]\S*))(\s+|\b|$)/g,(p,h,g)=>(r=r.withFilter("Tag",g||h),"")),o=o.replace(/\bfeatured(\s+|\b|$)/g,()=>(r=r.withFilter("Featured"),"")),o=o.trim(),o&&(o=o.length<200?o:o.substring(0,200),r=r.withFilter("SearchText",o)),t.capabilities.extensionQuery.sorting?.some(p=>p.name==="NoneOrRelevance")&&(r=r.withSortBy("NoneOrRelevance"))):t.capabilities.extensionQuery.sorting?.some(p=>p.name==="InstallCount")&&(r=r.withSortBy("InstallCount")),i.sortBy&&t.capabilities.extensionQuery.sorting?.some(p=>p.name===i.sortBy)&&(r=r.withSortBy(i.sortBy)),typeof i.sortOrder=="number"&&(r=r.withSortOrder(i.sortOrder)),i.source&&(r=r.withSource(i.source));let s=async(p,h)=>{let{extensions:g,total:f}=await this.queryGalleryExtensions(p,{targetPlatform:ZOt,compatible:!1,includePreRelease:!!i.includePreRelease,productVersion:i.productVersion??{version:this.productService.version,date:this.productService.date}},t,h),v=[],b;for(let S=0;S<g.length;S++){let y=g[S];Dro(y,(p.pageNumber-1)*p.pageSize+S,i.source),Ot(y.identifier,{id:this.productService.defaultChatAgent.extensionId})?b=y:v.push(y)}return b&&v.push(b),{extensions:v,total:f}},{extensions:l,total:c}=await s(r,e),u=async(p,h)=>{if(h.isCancellationRequested)throw new ho;let{extensions:g}=await s(r.withPage(p+1),h);return g};return{firstPage:l,total:c,pageSize:r.pageSize,getPage:u}}async queryGalleryExtensions(i,e,t,o){let n=i.flags;i.flags.includes("IncludeLatestVersionOnly")&&i.flags.includes("IncludeVersions")&&(i=i.withFlags(...i.flags.filter(h=>h!=="IncludeVersions"))),!i.flags.includes("IncludeLatestVersionOnly")&&!i.flags.includes("IncludeVersions")&&(i=i.withFlags(...i.flags,"IncludeLatestVersionOnly")),(e.versions?.length||e.isQueryForReleaseVersionFromPreReleaseVersion)&&(i=i.withFlags(...i.flags.filter(h=>h!=="IncludeLatestVersionOnly"),"IncludeVersions")),i=i.withFlags(...i.flags,"IncludeAssetUri","IncludeCategoryAndTags","IncludeFiles","IncludeStatistics","IncludeVersionProperties");let{galleryExtensions:r,total:s,context:l}=await this.queryRawGalleryExtensions(i,t,o);if(!i.flags.includes("IncludeLatestVersionOnly")){let h=[];for(let g of r){let f=eFt(g),v={id:Df(g.publisher.publisherName,g.extensionName),uuid:g.extensionId},b=Da(e.includePreRelease)?e.includePreRelease:!!e.includePreRelease.find(y=>Ot(y,v))?.includePreRelease,S=await this.getValidRawGalleryExtensionVersion(g,g.versions,{compatible:e.compatible,targetPlatform:e.targetPlatform,productVersion:e.productVersion,version:e.versions?.find(y=>Ot(y,v))?.version??(b?2:0)},f);S&&h.push(uSi(g,S,f,t,this.productService,l))}return{extensions:h,total:s}}let u=[],p=new Map;for(let h=0;h<r.length;h++){let g=r[h],f={id:Df(g.publisher.publisherName,g.extensionName),uuid:g.extensionId},v=Da(e.includePreRelease)?e.includePreRelease:!!e.includePreRelease.find(w=>Ot(w,f))?.includePreRelease,b=eFt(g);if(e.compatible&&(ixe(b,e.targetPlatform)||this.allowedExtensionsService.isAllowed({id:f.id,publisherDisplayName:g.publisher.displayName})!==!0))continue;let S=await this.getValidRawGalleryExtensionVersion(g,g.versions,{compatible:e.compatible,targetPlatform:e.targetPlatform,productVersion:e.productVersion,version:e.versions?.find(w=>Ot(w,f))?.version??(v?2:0)},b),y=S?uSi(g,S,b,t,this.productService,l):null;!y||y.properties.isPreReleaseVersion&&(!v||!y.hasReleaseVersion)||!y.properties.isPreReleaseVersion&&y.properties.targetPlatform!==e.targetPlatform&&y.hasPreReleaseVersion?p.set(g.extensionId,h):u.push([h,y])}if(p.size){let h=new En,g=new TDe().withFlags(...n.filter(v=>v!=="IncludeLatestVersionOnly"),"IncludeVersions").withPage(1,p.size).withFilter("ExtensionId",...p.keys()),{extensions:f}=await this.queryGalleryExtensions(g,e,t,o);this.telemetryService.publicLog2("galleryService:additionalQuery",{duration:h.elapsed(),count:p.size});for(let v of f){let b=p.get(v.identifier.uuid);u.push([b,v])}}return{extensions:u.sort((h,g)=>h[0]-g[0]).map(([,h])=>h),total:s}}async getValidRawGalleryExtensionVersion(i,e,t,o){let n={id:Df(i.publisher.publisherName,i.extensionName),uuid:i.extensionId},r=_ro(e,t.targetPlatform);if(t.compatible&&ixe(o,t.targetPlatform))return null;let s=Ae(t.version)?t.version:void 0;for(let l=0;l<r.length;l++){let c=r[l];if(t.compatible&&await this.setEngineIfNotExists(n.id,c),await this.isValidVersion({id:n.id,version:c.version,isPreReleaseVersion:_De(c),targetPlatform:Gue(c),engine:nFt(c),manifestAsset:ZV(c,fw.Manifest),enabledApiProposals:pSi(c)},t,i.publisher.displayName,o))return c;if(s&&c.version===s)return null}return s||t.compatible?null:i.versions[0]}async setEngineIfNotExists(i,e){if(!nFt(e))try{let t=await this.getEngine(i,e.version,ZV(e,fw.Manifest));t&&D5o(e,t)}catch(t){this.logService.error(`Error while getting the engine for the version ${e.version}.`,Cn(t))}}async queryRawGalleryExtensions(i,e,t){let o=oP(e,"ExtensionQueryService");if(!o)throw new Error("No extension gallery query service configured.");i=i.withFlags(...i.flags,"ExcludeNonValidated").withFilter("Target","Microsoft.VisualStudio.Code");let n=e.capabilities.extensionQuery.flags?.find(g=>g.name==="Unpublished");n&&(i=i.withFilter("ExcludeWithFlags",String(n.value)));let r=JSON.stringify({filters:[{criteria:i.criteria.reduce((g,f)=>{let v=e.capabilities.extensionQuery.filtering?.find(b=>b.name===f.filterType);return v&&g.push({filterType:v.value,value:f.value}),g},[]),pageNumber:i.pageNumber,pageSize:i.pageSize,sortBy:e.capabilities.extensionQuery.sorting?.find(g=>g.name===i.sortBy)?.value,sortOrder:i.sortOrder}],assetTypes:i.assetTypes,flags:i.flags.reduce((g,f)=>{let v=e.capabilities.extensionQuery.flags?.find(b=>b.name===f);return v&&(g|=v.value),g},0)}),l={...await this.commonHeadersPromise,"Content-Type":"application/json",Accept:"application/json;api-version=3.0-preview.1","Accept-Encoding":"gzip","Content-Length":String(r.length)},c=new En,u,p,h=0;try{if(u=await this.requestService.request({type:"POST",url:o,data:r,headers:l},t),u.res.statusCode&&u.res.statusCode>=400&&u.res.statusCode<500)return{galleryExtensions:[],total:h};let g=await hh(u);if(g){let f=g.results[0],v=f.extensions,b=f.resultMetadata&&f.resultMetadata.filter(S=>S.metadataType==="ResultCount")[0];return h=b&&b.metadataItems.filter(S=>S.name==="TotalCount")[0].count||0,{galleryExtensions:v,total:h,context:u.res.headers.activityid?{[oFt]:u.res.headers.activityid}:{}}}return{galleryExtensions:[],total:h}}catch(g){if(so(g))throw p="Cancelled",g;{let f=Cn(g);throw p=oXe(g)?"Offline":f.startsWith("XHR timeout")?"Timeout":"Failed",new xE(f,p)}}finally{this.telemetryService.publicLog2("galleryService:query",{filterTypes:i.criteria.map(g=>g.filterType),flags:i.flags,sortBy:i.sortBy,sortOrder:String(i.sortOrder),pageNumber:String(i.pageNumber),source:i.source,searchTextLength:i.searchText.length,requestBodySize:String(r.length),duration:c.elapsed(),success:!!u&&aP(u),responseBodySize:u?.res.headers["Content-Length"],statusCode:u?String(u.res.statusCode):void 0,errorCode:p,count:String(h),server:this.getHeaderValue(u?.res.headers,lSi),activityId:this.getHeaderValue(u?.res.headers,aSi),endToEndId:this.getHeaderValue(u?.res.headers,cSi)})}}getHeaderValue(i,e){let t=i?.[e.toLowerCase()],o=Array.isArray(t)?t[0]:t;return o?new Im(o):void 0}async getLatestRawGalleryExtensionWithFallback(i,e,t){let[o,n]=i.id.split("."),r;try{let s=A.parse(PT(e.uri,{publisher:o,name:n}));return await this.getLatestRawGalleryExtension(i.id,s,t)}catch(s){if(s instanceof xE)switch(r=s.code,s.code){case"Offline":case"Cancelled":case"Timeout":case"ClientError":throw s}else r="Unknown";if(!e.fallback)throw s}finally{this.telemetryService.publicLog2("galleryService:getmarketplacelatest",{extension:i.id,errorCode:r})}this.logService.error(`Error while getting the latest version for the extension ${i.id} from ${e.uri}. Trying the fallback ${e.fallback}`,r);try{let s=A.parse(PT(e.fallback,{publisher:o,name:n}));return await this.getLatestRawGalleryExtension(i.id,s,t)}catch(s){throw r=s instanceof xE?s.code:"Unknown",s}finally{this.telemetryService.publicLog2("galleryService:fallbacktounpkg",{extension:i.id,errorCode:r})}}async getLatestRawGalleryExtension(i,e,t){let o,n,r=new En;try{let l={...await this.commonHeadersPromise,"Content-Type":"application/json",Accept:"application/json;api-version=7.2-preview","Accept-Encoding":"gzip"};if(o=await this.requestService.request({type:"GET",url:e.toString(!0),headers:l,timeout:this.getRequestTimeout()},t),o.res.statusCode===404)return n="NotFound",null;if(o.res.statusCode&&o.res.statusCode!==200)throw new Error("Unexpected HTTP response: "+o.res.statusCode);let c=await hh(o);return c||(n="NoData"),c}catch(s){let l;throw so(s)?l="Cancelled":oXe(s)?l="Offline":Cn(s).startsWith("XHR timeout")?l="Timeout":o&&UEt(o)?l="ClientError":o&&q7i(o)?l="ServerError":l="Failed",n=l,new xE(s,l)}finally{this.telemetryService.publicLog2("galleryService:getLatest",{extension:i,host:e.authority,duration:r.elapsed(),errorCode:n,statusCode:o?.res.statusCode&&o?.res.statusCode!==200?`${o.res.statusCode}`:void 0,server:this.getHeaderValue(o?.res.headers,lSi),activityId:this.getHeaderValue(o?.res.headers,aSi),endToEndId:this.getHeaderValue(o?.res.headers,cSi)})}}async reportStatistic(i,e,t,o){if(Gt){this.logService.info("ExtensionGalleryService#reportStatistic: Skipped in web");return}let n=await this.extensionGalleryManifestService.getExtensionGalleryManifest();if(!n)return;let r=oP(n,"ExtensionStatisticsUriTemplate");if(!r)return;let s=PT(r,{publisher:i,name:e,version:t,statTypeName:o}),u={...await this.commonHeadersPromise,Accept:"*/*;api-version=4.0-preview.1"};try{await this.requestService.request({type:"POST",url:s,headers:u},ve.None)}catch{}}async download(i,e,t){this.logService.trace("ExtensionGalleryService#download",i.identifier.id);let o=Qle(i),n=new Date().getTime(),r=t===2?"install":t===3?"update":"",s=r?{uri:`${i.assets.download.uri}${A.parse(i.assets.download.uri).query?"&":"?"}${r}=true`,fallbackUri:`${i.assets.download.fallbackUri}${A.parse(i.assets.download.fallbackUri).query?"&":"?"}${r}=true`}:i.assets.download,l=i.queryContext?.[oFt],c=l&&typeof l=="string"?{[oFt]:l}:void 0,u=await this.getAsset(i.identifier.id,s,fw.VSIX,i.version,c?{headers:c}:void 0);try{await this.fileService.writeFile(e,u.stream)}catch(p){try{await this.fileService.del(e)}catch(h){this.logService.warn(`Error while deleting the file ${e.toString()}`,Cn(h))}throw new xE(Cn(p),"DownloadFailedWriting")}this.telemetryService.publicLog("galleryService:downloadVSIX",{...o,duration:new Date().getTime()-n})}async downloadSignatureArchive(i,e){if(!i.assets.signature)throw new Error("No signature asset found");this.logService.trace("ExtensionGalleryService#downloadSignatureArchive",i.identifier.id);let t=await this.getAsset(i.identifier.id,i.assets.signature,fw.Signature,i.version);try{await this.fileService.writeFile(e,t.stream)}catch(o){try{await this.fileService.del(e)}catch(n){this.logService.warn(`Error while deleting the file ${e.toString()}`,Cn(n))}throw new xE(Cn(o),"DownloadFailedWriting")}}async getReadme(i,e){if(i.assets.readme){let t=await this.getAsset(i.identifier.id,i.assets.readme,fw.Details,i.version,{},e);return await Kx(t)||""}return""}async getManifest(i,e){if(i.assets.manifest){let t=await this.getAsset(i.identifier.id,i.assets.manifest,fw.Manifest,i.version,{},e),o=await Kx(t);return o?JSON.parse(o):null}return null}async getCoreTranslation(i,e){let t=i.assets.coreTranslations.filter(o=>o[0]===e.toUpperCase())[0];if(t){let o=await this.getAsset(i.identifier.id,t[1],t[0],i.version),n=await Kx(o);return n?JSON.parse(n):null}return null}async getChangelog(i,e){if(i.assets.changelog){let t=await this.getAsset(i.identifier.id,i.assets.changelog,fw.Changelog,i.version,{},e);return await Kx(t)||""}return""}async getAllVersions(i){return this.getVersions(i)}async getAllCompatibleVersions(i,e,t){return this.getVersions(i,{version:e?2:0,targetPlatform:t})}async getVersions(i,e){let t=await this.extensionGalleryManifestService.getExtensionGalleryManifest();if(!t)throw new Error("No extension gallery service configured.");let o=new TDe().withFlags("IncludeVersions","IncludeCategoryAndTags","IncludeFiles","IncludeVersionProperties").withPage(1,1);i.uuid?o=o.withFilter("ExtensionId",i.uuid):o=o.withFilter("ExtensionName",i.id);let{galleryExtensions:n}=await this.queryRawGalleryExtensions(o,t,ve.None);if(!n.length)return[];let r=eFt(n[0]);if(e&&ixe(r,e.targetPlatform))return[];let s=[],l={version:this.productService.version,date:this.productService.date};await Promise.all(n[0].versions.map(async p=>{try{await this.isValidVersion({id:i.id,version:p.version,isPreReleaseVersion:_De(p),targetPlatform:Gue(p),engine:nFt(p),manifestAsset:ZV(p,fw.Manifest),enabledApiProposals:pSi(p)},{compatible:!!e,productVersion:l,targetPlatform:e?.targetPlatform,version:e?.version??p.version},n[0].publisher.displayName,r)&&s.push(p)}catch{}}));let c=[],u=new Map;for(let p of _ro(s,e?.targetPlatform??ZOt)){let h=u.get(p.version),g=h!==void 0?c[h]:void 0,f=Gue(p);g?g.targetPlatforms.push(f):(u.set(p.version,c.length),c.push({version:p.version,date:p.lastUpdated,isPreReleaseVersion:_De(p),targetPlatforms:[f]}))}return c}async getAsset(i,e,t,o,n={},r=ve.None){let s=await this.commonHeadersPromise,l={type:"GET"},c={...s,...n.headers||{}};n={...n,...l,headers:c};let u=e.uri,p=e.fallbackUri,h={...n,url:u,timeout:this.getRequestTimeout()},g;try{if(g=await this.requestService.request(h,r),g.res.statusCode===200)return g;let f=await Kx(g);throw new Error(`Expected 200, got back ${g.res.statusCode} instead.
${f}`)}catch(f){if(so(f))throw f;let v=Cn(f);this.telemetryService.publicLog2("galleryService:cdnFallback",{extension:i,assetType:t,message:v,extensionVersion:o,server:this.getHeaderValue(g?.res.headers,lSi),activityId:this.getHeaderValue(g?.res.headers,aSi),endToEndId:this.getHeaderValue(g?.res.headers,cSi)});let b={...n,url:p,timeout:this.getRequestTimeout()};return this.requestService.request(b,r)}}async getExtensionsControlManifest(){if(!await this.extensionGalleryManifestService.getExtensionGalleryManifest())throw new Error("No extension gallery service configured.");if(!this.extensionsControlUrl)return{malicious:[],deprecated:{},search:[],autoUpdate:{}};let e=await this.requestService.request({type:"GET",url:this.extensionsControlUrl,timeout:this.getRequestTimeout()},ve.None);if(e.res.statusCode!==200)throw new Error("Could not get extensions report.");let t=await hh(e),o=[],n={},r=[],s=t?.autoUpdate??{};if(t){for(let l of t.malicious){if(!Ae(l))continue;let c=mj.test(l)?{id:l}:l;o.push({extensionOrPublisher:c,learnMoreLink:t.learnMoreLinks?.[l]})}if(t.migrateToPreRelease)for(let[l,c]of Object.entries(t.migrateToPreRelease))(!c.engine||Kue(c.engine,this.productService.version,this.productService.date))&&(n[l.toLowerCase()]={disallowInstall:!0,extension:{id:c.id,displayName:c.displayName,autoMigrate:{storage:!!c.migrateStorage},preRelease:!0}});if(t.deprecated)for(let[l,c]of Object.entries(t.deprecated))c&&(n[l.toLowerCase()]=Da(c)?{}:c);if(t.search)for(let l of t.search)r.push(l)}return n[this.productService.defaultChatAgent.extensionId.toLowerCase()]={disallowInstall:!0,extension:{id:this.productService.defaultChatAgent.chatExtensionId,displayName:"GitHub Copilot Chat",autoMigrate:{storage:!1,donotDisable:!0},preRelease:this.productService.quality!=="stable"}},{malicious:o,deprecated:n,search:r,autoUpdate:s}}getRequestTimeout(){let i=this.configurationService.getValue(Axt);return Xo(i)&&i>=0?i:6e4}};FJ=I([m(1,_a),m(2,ne),m(3,Co),m(4,Te),m(5,be),m(6,nt),m(7,B),m(8,zp),m(9,vv)],FJ);var tFt=class extends FJ{constructor(i,e,t,o,n,r,s,l,c,u){super(i,e,t,o,n,r,s,l,c,u)}};tFt=I([m(0,le),m(1,_a),m(2,ne),m(3,Co),m(4,Te),m(5,be),m(6,nt),m(7,B),m(8,zp),m(9,vv)],tFt);var iFt=class extends FJ{constructor(i,e,t,o,n,r,s,l,c){super(void 0,i,e,t,o,n,r,s,l,c)}};iFt=I([m(0,_a),m(1,ne),m(2,Co),m(3,Te),m(4,be),m(5,nt),m(6,B),m(7,zp),m(8,vv)],iFt);var rXe=class extends FJ{constructor(i,e,t,o,n,r,s,l,c,u){super(i,e,t,o,n,r,s,l,c,u)}};rXe=I([m(0,le),m(1,_a),m(2,ne),m(3,Co),m(4,Te),m(5,be),m(6,nt),m(7,B),m(8,zp),m(9,vv)],rXe);we(ta,rXe,1);var CK=class extends C{constructor(e,t){super();this._onDidChangeEnablement=this._register(new E);this.onDidChangeEnablement=this._onDidChangeEnablement.event;this.storageManager=this._register(new sXe(e)),this._register(this.storageManager.onDidChange(o=>this._onDidChangeEnablement.fire({extensions:o,source:"storage"}))),this._register(t.onDidInstallExtensions(o=>o.forEach(({local:n,operation:r})=>{n&&r===4&&this._removeFromDisabledExtensions(n.identifier)})))}async enableExtension(e,t){return this._removeFromDisabledExtensions(e)?(this._onDidChangeEnablement.fire({extensions:[e],source:t}),!0):!1}async disableExtension(e,t){return this._addToDisabledExtensions(e)?(this._onDidChangeEnablement.fire({extensions:[e],source:t}),!0):!1}getDisabledExtensions(){return this._getExtensions(nY)}async getDisabledExtensionsAsync(){return this.getDisabledExtensions()}_addToDisabledExtensions(e){let t=this.getDisabledExtensions();return t.every(o=>!Ot(o,e))?(t.push(e),this._setDisabledExtensions(t),!0):!1}_removeFromDisabledExtensions(e){let t=this.getDisabledExtensions();for(let o=0;o<t.length;o++){let n=t[o];if(Ot(n,e))return t.splice(o,1),this._setDisabledExtensions(t),!0}return!1}_setDisabledExtensions(e){this._setExtensions(nY,e)}_getExtensions(e){return this.storageManager.get(e,0)}_setExtensions(e,t){this.storageManager.set(e,t,0)}};CK=I([m(0,le),m(1,ls)],CK);var sXe=class extends C{constructor(e){super();this.storageService=e;this.storage=Object.create(null);this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._register(e.onDidChangeValue(0,void 0,this._store)(t=>this.onDidStorageChange(t)))}get(e,t){let o;return t===0?(Jn(this.storage[e])&&(this.storage[e]=this._get(e,t)),o=this.storage[e]):o=this._get(e,t),JSON.parse(o)}set(e,t,o){let n=JSON.stringify(t.map(({id:s,uuid:l})=>({id:s,uuid:l})));this._get(e,o)!==n&&(o===0&&(t.length?this.storage[e]=n:delete this.storage[e]),this._set(e,t.length?n:void 0,o))}onDidStorageChange(e){if(!Jn(this.storage[e.key])&&this._get(e.key,e.scope)!==this.storage[e.key]){let o=this.get(e.key,e.scope);delete this.storage[e.key];let n=this.get(e.key,e.scope),r=o.filter(l=>!n.some(c=>Ot(l,c))),s=n.filter(l=>!o.some(c=>Ot(c,l)));(r.length||s.length)&&this._onDidChange.fire([...r,...s])}}_get(e,t){return this.storageService.get(e,t,"[]")}_set(e,t,o){t?this.storageService.store(e,t,o,1):this.storageService.remove(e,o)}};function sFt(){let a=oe.as(ii.Configuration).getConfigurationProperties();return Object.keys(a).filter(i=>!!a[i].disallowSyncIgnore)}function WJ(a=!1){let i=oe.as(ii.Configuration).getConfigurationProperties(),e=W5o(i,a),t=sFt();return Uo([...e,...t])}function W5o(a,i){let e=new Set;for(let t in a){if(i&&a[t].source)continue;let o=Ae(a[t].scope)?qmt(a[t].scope):a[t].scope;(a[t].ignoreSync||o===2||o===7)&&e.add(t)}return[...e.values()]}var Mro="settingsSync",V5o="settingsSync.keybindingsPerPlatform";function Pro(){let a="vscode://schemas/ignoredSettings",i=oe.as(ii.Configuration);i.registerConfiguration({id:"settingsSync",order:30,title:d(2696,null),type:"object",properties:{[V5o]:{type:"boolean",description:d(2699,null),default:!0,scope:1,tags:["sync","usesOnlineServices"]},"settingsSync.ignoredExtensions":{type:"array",markdownDescription:d(2697,null),items:[{type:"string",pattern:CO,errorMessage:d(2695,null)}],default:[],scope:1,uniqueItems:!0,disallowSyncIgnore:!0,tags:["sync","usesOnlineServices"]},"settingsSync.ignoredSettings":{type:"array",description:d(2698,null),default:[],scope:1,$ref:a,additionalProperties:!0,uniqueItems:!0,disallowSyncIgnore:!0,tags:["sync","usesOnlineServices"]}}});let e=oe.as(ea.JSONContribution),t=()=>{let o=sFt(),n=WJ(),r=Object.keys(Qw.properties).filter(c=>!n.includes(c)),s=n.filter(c=>!o.includes(c)),l={items:{type:"string",enum:[...r,...s.map(c=>`-${c}`)]}};e.registerSchema(a,l)};return i.onDidUpdateConfiguration(()=>t())}var Aro="0";function Nro(a){return a&&yi(a)&&Ae(a.id)&&Array.isArray(a.scopes)}var $ue=["settings","keybindings","snippets","prompts","tasks","extensions","globalState","profiles","mcp"];function mSi(a,...i){return a?[a,...i]:i}function aXe(a,i,e,t){return t.joinPath(e.userDataSyncHome,...mSi(a,i,`lastSync${i}.json`))}var TR=ae("IUserDataSyncStoreManagementService"),CF=ae("IUserDataSyncStoreService"),VJ=ae("IUserDataSyncLocalStoreService"),tB="x-operation-id",hSi="X-Execution-Id";function lXe(a){let i={};return i[hSi]=a,i}var Cg=class extends Error{constructor(e,t,o,n){super(e);this.code=t;this.resource=o;this.operationId=n;this.name=`${this.code} (UserDataSyncError) syncResource:${this.resource||"unknown"} operationId:${this.operationId||"unknown"}`}},Em=class extends Cg{constructor(e,t,o,n,r){super(e,o,void 0,r);this.url=t;this.serverCode=n}};(i=>{function a(e){if(e instanceof i)return e;let t=/^(.+) \(UserDataSyncError\) syncResource:(.+) operationId:(.+)$/.exec(e.name);if(t&&t[1]){let o=t[2]==="unknown"?void 0:t[2],n=t[3]==="unknown"?void 0:t[3];return new i(e.message,t[1],o,n)}return new i(e.message,"Unknown")}i.toUserDataSyncError=a})(Cg||={});var iB="sync.store.url.type";function que(a){return`sync.enable.${a}`}var _l=ae("IUserDataSyncEnablementService"),aI=ae("IUserDataSyncService"),DDe=ae("IUserDataSyncResourceProviderService"),JE=ae("IUserDataAutoSyncService"),BJ=ae("IUserDataSyncUtilService"),uy=ae("IUserDataSyncLogService"),jue="userDataSync",HC="vscode-userdata-sync",Oro="preview";var LDe=ae("IUserDataSyncAccountService"),aFt=class extends C{constructor(e,t){super();this.userDataSyncStoreService=e;this.logService=t;this._onDidChangeAccount=this._register(new E);this.onDidChangeAccount=this._onDidChangeAccount.event;this._onTokenFailed=this._register(new E);this.onTokenFailed=this._onTokenFailed.event;this.wasTokenFailed=!1;this._register(e.onTokenFailed(o=>{this.logService.info("Settings Sync auth token failed",this.account?.authenticationProviderId,this.wasTokenFailed,o),this.updateAccount(void 0),o==="Forbidden"?this._onTokenFailed.fire(!0):this._onTokenFailed.fire(this.wasTokenFailed),this.wasTokenFailed=!0})),this._register(e.onTokenSucceed(()=>this.wasTokenFailed=!1))}get account(){return this._account}async updateAccount(e){(e&&this._account?e.token!==this._account.token||e.authenticationProviderId!==this._account.authenticationProviderId:e!==this._account)&&(this._account=e,this._account&&this.userDataSyncStoreService.setAuthToken(this._account.token,this._account.authenticationProviderId),this._onDidChangeAccount.fire(e))}};aFt=I([m(0,CF),m(1,uy)],aFt);var a4=ae("IExtensionBisectService"),cXe=class a{constructor(i,e,t,o=(e+t)/2|0){this.extensions=i;this.low=e;this.high=t;this.mid=o}static fromJSON(i){if(i)try{let e=JSON.parse(i);return new a(e.extensions,e.low,e.high,e.mid)}catch{return}}},xK=class{constructor(i,e,t){this._storageService=e;this._envService=t;this._disabled=new Map;let o=e.get(xK._storageKey,-1);if(this._state=cXe.fromJSON(o),this._state){let{mid:n,high:r}=this._state;for(let s=0;s<this._state.extensions.length;s++){let l=s>=n&&s<r;this._disabled.set(this._state.extensions[s],l)}i.warn("extension BISECT active",[...this._disabled])}}static{this._storageKey="extensionBisectState"}get isActive(){return!!this._state}get disabledCount(){return this._state?this._state.high-this._state.mid:-1}isDisabledByBisect(i){return!this._state||lCe(i.manifest,this._envService.remoteAuthority)||this._isEnabledInEnv(i)?!1:this._disabled.get(i.identifier.id)??!1}_isEnabledInEnv(i){return Array.isArray(this._envService.enableExtensions)&&this._envService.enableExtensions.some(e=>Ot({id:e},i.identifier))}async start(i){if(this._state)throw new Error("invalid state");let e=i.map(o=>o.identifier.id),t=new cXe(e,0,e.length,0);this._storageService.store(xK._storageKey,JSON.stringify(t),-1,1),await this._storageService.flush()}async next(i){if(!this._state)throw new Error("invalid state");if(i&&this._state.mid===0&&this._state.high===this._state.extensions.length)return{bad:!0,id:""};if(this._state.low===this._state.high-1)return await this.reset(),{id:this._state.extensions[this._state.low],bad:i};let e=new cXe(this._state.extensions,i?this._state.low:this._state.mid,i?this._state.mid:this._state.high);this._storageService.store(xK._storageKey,JSON.stringify(e),-1,1),await this._storageService.flush()}async reset(){this._storageService.remove(xK._storageKey,-1),await this._storageService.flush()}};xK=I([m(0,ne),m(1,le),m(2,Vt)],xK);we(a4,xK,1);var kK=class{constructor(i,e,t,o){this._extensionBisectService=e;this._notificationService=t;this._commandService=o;e.isActive&&(kK.ctxIsBisectActive.bindTo(i).set(!0),this._showBisectPrompt())}static{this.ctxIsBisectActive=new Q("isExtensionBisectActive",!1)}_showBisectPrompt(){let i={label:d(16813,null),run:()=>this._commandService.executeCommand("extension.bisect.next",!1)},e={label:d(16822,null),run:()=>this._commandService.executeCommand("extension.bisect.next",!0)},t={label:"Stop Bisect",run:()=>this._commandService.executeCommand("extension.bisect.stop")},o=this._extensionBisectService.disabledCount===1?d(16806,null):d(16805,null,this._extensionBisectService.disabledCount);this._notificationService.prompt(St.Info,o,[i,e,t],{sticky:!0,priority:3})}};kK=I([m(0,X),m(1,a4),m(2,Ne),m(3,ge)],kK);oe.as(Qi.Workbench).registerWorkbenchContribution(kK,3);W(class extends K{constructor(){super({id:"extension.bisect.start",title:L(16824,"Start Extension Bisect"),category:We.Help,f1:!0,precondition:kK.ctxIsBisectActive.negate(),menu:{id:D.ViewContainerTitle,when:x.equals("viewContainer","workbench.view.extensions"),group:"2_enablement",order:4}})}async run(a){let i=a.get(ct),e=a.get(oi),t=a.get(ls),o=a.get(Os),n=a.get(a4),r=(await t.getInstalled(1)).filter(l=>o.isEnabled(l));(await i.confirm({message:d(16815,null),detail:d(16808,null,2+Math.log2(r.length)|0),primaryButton:d(16816,null)})).confirmed&&(await n.start(r),e.reload())}});W(class extends K{constructor(){super({id:"extension.bisect.next",title:L(16823,"Continue Extension Bisect"),category:We.Help,f1:!0,precondition:kK.ctxIsBisectActive})}async run(a,i){let e=a.get(ct),t=a.get(oi),o=a.get(a4),n=a.get(nt),r=a.get(nz),s=a.get(ge);if(!o.isActive)return;if(i===void 0){let c=await this._checkForBad(e,o);if(c===null)return;i=c}if(i===void 0){await o.reset(),t.reload();return}let l=await o.next(i);if(!l){t.reload();return}if(l.bad)await e.info(d(16812,null),d(16810,null,n.nameShort));else{let c=await e.confirm({type:St.Info,message:d(16812,null),primaryButton:d(16821,null),cancelButton:d(16807,null),detail:d(16809,null,l.id),checkbox:{label:d(16811,null),checked:!0}});c.checkboxChecked&&await r.disableExtension({id:l.id},void 0),c.confirmed&&await s.executeCommand("workbench.action.openIssueReporter",l.id)}await o.reset(),t.reload()}async _checkForBad(a,i){let{result:e}=await a.prompt({type:St.Info,message:d(16814,null),detail:d(16804,null,i.disabledCount),buttons:[{label:d(16819,null),run:()=>!1},{label:d(16817,null),run:()=>!0},{label:d(16820,null),run:()=>{}}],cancelButton:{label:d(16818,null),run:()=>null}});return e}});W(class extends K{constructor(){super({id:"extension.bisect.stop",title:L(16825,"Stop Extension Bisect"),category:We.Help,f1:!0,precondition:kK.ctxIsBisectActive})}async run(a){let i=a.get(a4),e=a.get(oi);await i.reset(),e.reload()}});var gSi="IWorkbenchExtensionEnablementService",fSi="chat.extensionUnification.enabled",dXe=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T){super();this.storageService=e;this.globalExtensionEnablementService=t;this.contextService=o;this.environmentService=n;this.extensionManagementService=r;this.configurationService=s;this.extensionManagementServerService=l;this.userDataSyncEnablementService=c;this.userDataSyncAccountService=u;this.lifecycleService=p;this.notificationService=h;this.extensionBisectService=f;this.allowedExtensionsService=v;this.workspaceTrustManagementService=b;this.workspaceTrustRequestService=S;this.extensionManifestPropertiesService=y;this.logService=k;this._onEnablementChanged=this._register(new E);this.onEnablementChanged=this._onEnablementChanged.event;this.extensionsDisabledExtensions=[];this.delayer=this._register(new jo(0));this.storageManager=this._register(new sXe(e));let N=this._register(H.filter(r.onDidUninstallExtension,U=>!U.error)(({identifier:U})=>this._reset(U))),O=!1;this._register(Z(()=>O=!0)),this.extensionsManager=this._register(w.createInstance(uXe)),this.extensionsManager.whenInitialized().then(()=>{O||(N.dispose(),this._onDidChangeExtensions([],[],!1),this._register(this.extensionsManager.onDidChangeExtensions(({added:U,removed:G,isProfileSwitch:$})=>this._onDidChangeExtensions(U,G,$))),this.loopCheckForMaliciousExtensions())}),this._register(this.globalExtensionEnablementService.onDidChangeEnablement(({extensions:U,source:G})=>this._onDidChangeGloballyDisabledExtensions(U,G))),this._register(v.onDidChangeAllowedExtensionsConfigValue(()=>this._onDidChangeExtensions([],[],!1))),this._completionsExtensionId=T.defaultChatAgent?.extensionId.toLowerCase(),this._chatExtensionId=T.defaultChatAgent?.chatExtensionId.toLowerCase();let V=[this._completionsExtensionId,this._chatExtensionId].filter(U=>!!U);Gt&&this.environmentService.remoteAuthority===void 0?this._extensionUnificationEnabled=!1:this._extensionUnificationEnabled=this.configurationService.getValue(fSi),this._register(this.configurationService.onDidChangeConfiguration(U=>{U.affectsConfiguration(fSi)&&(this.configurationService.getValue(fSi)||(this._extensionUnificationEnabled=!1,this._onEnablementChanged.fire(this.extensionsManager.extensions.filter($=>V.includes($.identifier.id.toLowerCase())))))})),this.allUserExtensionsDisabled&&this.lifecycleService.when(4).then(()=>{this.notificationService.prompt(St.Info,d(16837,null),[{label:d(16839,null),run:()=>g.reload({disableExtensions:!1})}],{sticky:!0,priority:3})})}get hasWorkspace(){return this.contextService.getWorkbenchState()!==1}get allUserExtensionsDisabled(){return this.environmentService.disableExtensions===!0}getEnablementState(e){return this._computeEnablementState(e,this.extensionsManager.extensions,this.getWorkspaceType())}getEnablementStates(e,t={}){let o=new Map,n={...this.getWorkspaceType(),...t};return e.map(r=>this._computeEnablementState(r,e,n,o))}getDependenciesEnablementStates(e){return Yle(this.extensionsManager.extensions,e).map(t=>[t,this.getEnablementState(t)])}canChangeEnablement(e){try{return this.throwErrorIfCannotChangeEnablement(e),!0}catch{return!1}}canChangeWorkspaceEnablement(e){if(!this.canChangeEnablement(e))return!1;try{return this.throwErrorIfCannotChangeWorkspaceEnablement(e),!0}catch{return!1}}throwErrorIfCannotChangeEnablement(e,t){if(NL(e.manifest))throw new Error(d(16836,null,e.manifest.displayName||e.identifier.id));if(this.userDataSyncEnablementService.isEnabled()&&this.userDataSyncAccountService.account&&Kri(e.manifest)&&e.manifest.contributes.authentication.some(o=>o.id===this.userDataSyncAccountService.account.authenticationProviderId))throw new Error(d(16834,null,e.manifest.displayName||e.identifier.id));if(this._isEnabledInEnv(e))throw new Error(d(16829,null,e.manifest.displayName||e.identifier.id));this.throwErrorIfEnablementStateCannotBeChanged(e,this.getEnablementState(e),t)}throwErrorIfEnablementStateCannotBeChanged(e,t,o){switch(t){case 2:throw new Error(d(16826,null,e.manifest.displayName||e.identifier.id));case 4:throw new Error(d(16831,null,e.manifest.displayName||e.identifier.id));case 5:throw new Error(d(16832,null,e.manifest.displayName||e.identifier.id));case 1:throw new Error(d(16830,null,e.manifest.displayName||e.identifier.id));case 7:throw new Error(d(16827,null,e.manifest.displayName||e.identifier.id));case 6:throw new Error(d(16833,null,e.manifest.displayName||e.identifier.id));case 8:if(o)break;for(let n of Yle(this.extensionsManager.extensions,e))if(!this.isEnabled(n))throw new Error(d(16828,null,e.manifest.displayName||e.identifier.id,n.manifest.displayName||n.identifier.id))}}throwErrorIfCannotChangeWorkspaceEnablement(e){if(!this.hasWorkspace)throw new Error(d(16838,null));if(Kri(e.manifest))throw new Error(d(16835,null,e.manifest.displayName||e.identifier.id))}async setEnablement(e,t){await this.extensionsManager.whenInitialized(),(t===12||t===13)&&e.push(...this.getExtensionsToEnableRecursively(e,this.extensionsManager.extensions,t,{dependencies:!0,pack:!0}));let o=t===11||t===13;for(let s of e)o?this.throwErrorIfCannotChangeWorkspaceEnablement(s):this.throwErrorIfCannotChangeEnablement(s);let n=[];for(let s of e){let l=this.getEnablementState(s);if(l===0||l===8&&this.getDependenciesEnablementStates(s).every(([,c])=>this.isEnabledEnablementState(c)||c===0)){let c=await this.workspaceTrustRequestService.requestWorkspaceTrust();n.push(c??!1)}else n.push(await this._setUserEnablementState(s,t))}let r=e.filter((s,l)=>n[l]);return r.length&&this._onEnablementChanged.fire(r),n}getExtensionsToEnableRecursively(e,t,o,n,r=[]){if(!n.dependencies&&!n.pack)return[];let s=e.filter(c=>r.indexOf(c)===-1);if(!s.length)return[];for(let c of s)r.push(c);let l=[];for(let c of t){if(r.some(p=>Ot(p.identifier,c.identifier)))continue;let u=this.getEnablementState(c);if(!this.isEnabledEnablementState(u)&&u!==1&&e.some(p=>n.dependencies&&p.manifest.extensionDependencies?.some(h=>Ot({id:h},c.identifier))||n.pack&&p.manifest.extensionPack?.some(h=>Ot({id:h},c.identifier)))){let p=l.findIndex(h=>Ot(h.identifier,c.identifier));if(p===-1)l.push(c);else try{this.throwErrorIfEnablementStateCannotBeChanged(c,u,!0),l.splice(p,1,c)}catch{}}}return l.length&&l.push(...this.getExtensionsToEnableRecursively(l,t,o,n,r)),l}_setUserEnablementState(e,t){if(this._getUserEnablementState(e.identifier)===t)return Promise.resolve(!1);switch(t){case 12:this._enableExtension(e.identifier);break;case 10:this._disableExtension(e.identifier);break;case 13:this._enableExtensionInWorkspace(e.identifier);break;case 11:this._disableExtensionInWorkspace(e.identifier);break}return Promise.resolve(!0)}isEnabled(e){let t=this.getEnablementState(e);return this.isEnabledEnablementState(t)}isEnabledEnablementState(e){return e===3||e===13||e===12}isDisabledGlobally(e){return this._isDisabledGlobally(e.identifier)}_computeEnablementState(e,t,o,n){n=n??new Map;let r=n.get(e);if(r!==void 0)return r;r=this._getUserEnablementState(e.identifier);let s=this.isEnabledEnablementState(r);return Jxt(e.identifier,this.getMaliciousExtensions().map(l=>({extensionOrPublisher:l})))?r=4:s&&e.type===1&&this.allowedExtensionsService.isAllowed(e)!==!0?r=7:s&&!e.isValid?r=6:this.extensionBisectService.isDisabledByBisect(e)?r=2:this._isDisabledInEnv(e)?r=2:this._isDisabledByVirtualWorkspace(e,o)?r=5:s&&this._isDisabledByWorkspaceTrust(e,o)?r=0:this._isDisabledByExtensionKind(e)?r=1:s&&this._isDisabledByExtensionDependency(e,t,o,n)?r=8:this._isDisabledByUnification(e.identifier)?r=9:!s&&this._isEnabledInEnv(e)&&(r=3),n.set(e,r),r}_isDisabledInEnv(e){if(this.allUserExtensionsDisabled)return!e.isBuiltin&&!lCe(e.manifest,this.environmentService.remoteAuthority);let t=this.environmentService.disableExtensions;return Array.isArray(t)?t.some(o=>Ot({id:o},e.identifier)):!!Ot({id:s9i.value},e.identifier)}_isEnabledInEnv(e){let t=this.environmentService.enableExtensions;return Array.isArray(t)?t.some(o=>Ot({id:o},e.identifier)):!1}_isDisabledByVirtualWorkspace(e,t){return!(!t.virtual||this.extensionManifestPropertiesService.getExtensionVirtualWorkspaceSupportType(e.manifest)!==!1||this.extensionManagementServerService.getExtensionManagementServer(e)===this.extensionManagementServerService.webExtensionManagementServer&&this.extensionManifestPropertiesService.canExecuteOnWeb(e.manifest))}_isDisabledByExtensionKind(e){if(this.extensionManagementServerService.remoteExtensionManagementServer||this.extensionManagementServerService.webExtensionManagementServer){let t=this.extensionManagementServerService.getExtensionInstallLocation(e);for(let o of this.extensionManifestPropertiesService.getExtensionKind(e.manifest)){if(o==="ui"&&t===1||o==="workspace"&&t===2)return!1;if(o==="web"){if(this.extensionManagementServerService.webExtensionManagementServer){if(t===3||t===2)return!1}else if(t===1){let n=this.configurationService.getValue(ikt);if(n===!0||n==="auto")return!1}}}return!0}return!1}_isDisabledByWorkspaceTrust(e,t){return t.trusted?!1:this.contextService.isInsideWorkspace(e.location)?!0:this.extensionManifestPropertiesService.getExtensionUntrustedWorkspaceSupportType(e.manifest)===!1}_isDisabledByExtensionDependency(e,t,o,n){if(!e.manifest.extensionDependencies)return!1;let r=t.filter(l=>e.manifest.extensionDependencies?.some(c=>Ot(l.identifier,{id:c})&&(this.extensionManagementServerService.getExtensionManagementServer(l)===this.extensionManagementServerService.getExtensionManagementServer(e)||(l.manifest.main||l.manifest.browser)&&l.manifest.api==="none")));if(!r.length)return!1;let s=n.has(e);s||n.set(e,12);try{for(let l of r){let c=this._computeEnablementState(l,t,o,n);if(!this.isEnabledEnablementState(c)&&c!==1)return!0}}finally{s||n.delete(e)}return!1}_getUserEnablementState(e){if(this.hasWorkspace){if(this._getWorkspaceEnabledExtensions().filter(t=>Ot(t,e))[0])return 13;if(this._getWorkspaceDisabledExtensions().filter(t=>Ot(t,e))[0])return 11}return this._isDisabledGlobally(e)?10:12}_isDisabledGlobally(e){return this.globalExtensionEnablementService.getDisabledExtensions().some(t=>Ot(t,e))}_isDisabledByUnification(e){return this._extensionUnificationEnabled&&e.id.toLowerCase()===this._completionsExtensionId}_enableExtension(e){return this._removeFromWorkspaceDisabledExtensions(e),this._removeFromWorkspaceEnabledExtensions(e),this.globalExtensionEnablementService.enableExtension(e,gSi)}_disableExtension(e){return this._removeFromWorkspaceDisabledExtensions(e),this._removeFromWorkspaceEnabledExtensions(e),this.globalExtensionEnablementService.disableExtension(e,gSi)}_enableExtensionInWorkspace(e){this._removeFromWorkspaceDisabledExtensions(e),this._addToWorkspaceEnabledExtensions(e)}_disableExtensionInWorkspace(e){this._addToWorkspaceDisabledExtensions(e),this._removeFromWorkspaceEnabledExtensions(e)}_addToWorkspaceDisabledExtensions(e){if(!this.hasWorkspace)return Promise.resolve(!1);let t=this._getWorkspaceDisabledExtensions();return t.every(o=>!Ot(o,e))?(t.push(e),this._setDisabledExtensions(t),Promise.resolve(!0)):Promise.resolve(!1)}async _removeFromWorkspaceDisabledExtensions(e){if(!this.hasWorkspace)return!1;let t=this._getWorkspaceDisabledExtensions();for(let o=0;o<t.length;o++){let n=t[o];if(Ot(n,e))return t.splice(o,1),this._setDisabledExtensions(t),!0}return!1}_addToWorkspaceEnabledExtensions(e){if(!this.hasWorkspace)return!1;let t=this._getWorkspaceEnabledExtensions();return t.every(o=>!Ot(o,e))?(t.push(e),this._setEnabledExtensions(t),!0):!1}_removeFromWorkspaceEnabledExtensions(e){if(!this.hasWorkspace)return!1;let t=this._getWorkspaceEnabledExtensions();for(let o=0;o<t.length;o++){let n=t[o];if(Ot(n,e))return t.splice(o,1),this._setEnabledExtensions(t),!0}return!1}_getWorkspaceEnabledExtensions(){return this._getExtensions(Cci)}_setEnabledExtensions(e){this._setExtensions(Cci,e)}_getWorkspaceDisabledExtensions(){return this._getExtensions(nY)}_setDisabledExtensions(e){this._setExtensions(nY,e)}_getExtensions(e){return this.hasWorkspace?this.storageManager.get(e,1):[]}_setExtensions(e,t){this.storageManager.set(e,t,1)}async _onDidChangeGloballyDisabledExtensions(e,t){if(t!==gSi){await this.extensionsManager.whenInitialized();let o=this.extensionsManager.extensions.filter(n=>e.some(r=>Ot(r,n.identifier)));this._onEnablementChanged.fire(o)}}_onDidChangeExtensions(e,t,o){let n=e.filter(s=>!this.isEnabledEnablementState(this.getEnablementState(s))),r=this.extensionsDisabledExtensions;this.extensionsDisabledExtensions=this.extensionsManager.extensions.filter(s=>{let l=this.getEnablementState(s);return l===8||l===7||l===4});for(let s of r)this.extensionsDisabledExtensions.every(l=>!Ot(l.identifier,s.identifier))&&n.push(s);for(let s of this.extensionsDisabledExtensions)r.every(l=>!Ot(l.identifier,s.identifier))&&n.push(s);n.length&&this._onEnablementChanged.fire(n),o||t.forEach(({identifier:s})=>this._reset(s))}async updateExtensionsEnablementsWhenWorkspaceTrustChanges(){await this.extensionsManager.whenInitialized();let e=s=>{let l=new Map;return this.extensionsManager.extensions.map(c=>[c,this._computeEnablementState(c,this.extensionsManager.extensions,s,l)])},t=this.getWorkspaceType(),o=e({...t,trusted:!0}),n=e({...t,trusted:!1}),r=o.filter(([,s],l)=>s!==n[l][1]).map(([s])=>s);r.length&&this._onEnablementChanged.fire(r)}getWorkspaceType(){return{trusted:this.workspaceTrustManagementService.isWorkspaceTrusted(),virtual:LO(this.contextService.getWorkspace())}}_reset(e){this._removeFromWorkspaceDisabledExtensions(e),this._removeFromWorkspaceEnabledExtensions(e),this.globalExtensionEnablementService.enableExtension(e)}loopCheckForMaliciousExtensions(){this.checkForMaliciousExtensions().then(()=>this.delayer.trigger(()=>{},1e3*60*5)).then(()=>this.loopCheckForMaliciousExtensions())}async checkForMaliciousExtensions(){try{let e=await this.extensionManagementService.getExtensionsControlManifest();this.storeMaliciousExtensions(e.malicious.map(({extensionOrPublisher:o})=>o))&&this._onDidChangeExtensions([],[],!1)}catch(e){this.logService.error(e)}}getMaliciousExtensions(){return this.storageService.getObject("extensionsEnablement/malicious",-1,[])}storeMaliciousExtensions(e){let t=this.getMaliciousExtensions();return $i(t,e,(o,n)=>!Ae(o)&&!Ae(n)?Ot(o,n):o===n)?!1:(this.storageService.store("extensionsEnablement/malicious",JSON.stringify(e),-1,1),!0)}};dXe=I([m(0,le),m(1,nz),m(2,Pe),m(3,Vt),m(4,ls),m(5,B),m(6,Gc),m(7,_l),m(8,LDe),m(9,ao),m(10,Ne),m(11,oi),m(12,a4),m(13,zp),m(14,ns),m(15,Vd),m(16,xp),m(17,F),m(18,ne),m(19,nt)],dXe);var uXe=class extends C{constructor(e,t,o){super();this.extensionManagementService=e;this.extensionManagementServerService=t;this.logService=o;this._extensions=[];this._onDidChangeExtensions=this._register(new E);this.onDidChangeExtensions=this._onDidChangeExtensions.event;this.disposed=!1;this._register(Z(()=>this.disposed=!0)),this.initializePromise=this.initialize()}get extensions(){return this._extensions}whenInitialized(){return this.initializePromise}async initialize(){try{if(this._extensions=[...await this.extensionManagementService.getInstalled(),...await this.extensionManagementService.getInstalledWorkspaceExtensions(!0)],this.disposed)return;this._onDidChangeExtensions.fire({added:this.extensions,removed:[],isProfileSwitch:!1})}catch(e){this.logService.error(e)}this._register(this.extensionManagementService.onDidInstallExtensions(e=>this.updateExtensions(e.reduce((t,{local:o,operation:n})=>(o&&n!==4&&t.push(o),t),[]),[],void 0,!1))),this._register(H.filter(this.extensionManagementService.onDidUninstallExtension,(e=>!e.error))(e=>this.updateExtensions([],[e.identifier],e.server,!1))),this._register(this.extensionManagementService.onDidChangeProfile(({added:e,removed:t,server:o})=>{this.updateExtensions(e,t.map(({identifier:n})=>n),o,!0)}))}updateExtensions(e,t,o,n){if(e.length){for(let s of e){let l=this.extensionManagementServerService.getExtensionManagementServer(s),c=this._extensions.findIndex(u=>Ot(u.identifier,s.identifier)&&this.extensionManagementServerService.getExtensionManagementServer(u)===l);c!==-1&&this._extensions.splice(c,1)}this._extensions.push(...e)}let r=[];for(let s of t){let l=this._extensions.findIndex(c=>Ot(c.identifier,s)&&this.extensionManagementServerService.getExtensionManagementServer(c)===o);l!==-1&&r.push(...this._extensions.splice(l,1))}(e.length||r.length)&&this._onDidChangeExtensions.fire({added:e,removed:r,isProfileSwitch:n})}};uXe=I([m(0,Hd),m(1,Gc),m(2,ne)],uXe);we(Os,dXe,1);function RDe(a,i,e,t){try{H5o(a,i,e,t)}catch(o){a.error(o?.message??o)}return i}function H5o(a,i,e,t){let o=(n,r,s)=>{let l=n[r];if(Ae(l)){let c=l,u=c.length;if(u>1&&c[0]==="%"&&c[u-1]==="%"){let p=c.substr(1,u-2),h=e[p];h===void 0&&t&&(h=t[p]);let g=typeof h=="string"?h:h?.message,f=t?.[p],v=typeof f=="string"?f:f?.message;if(!g){v||a.warn(`[${i.name}]: ${d(2013,null,p)}`);return}if(s&&(r==="title"||r==="category")&&v&&v!==g){let b={value:g,original:v};n[r]=b}else n[r]=g}}else if(yi(l))for(let c in l)l.hasOwnProperty(c)&&(c==="commands"?o(l,c,!0):o(l,c,s));else if(Array.isArray(l))for(let c=0;c<l.length;c++)o(l,c,s)};for(let n in i)i.hasOwnProperty(n)&&o(i,n)}var pXe=class{constructor(i,e,t,o,n){this.extensionResourceLoaderService=t;this.logService=n;this.builtinExtensionsPromises=[];if(Gt){let r=o.extensionsGallery?.nlsBaseUrl;r&&o.commit&&!IS.isDefaultVariant()&&(this.nlsUrl=A.joinPath(A.parse(r),o.commit,o.version,IS.value()));let s=gn.asBrowserUri(D1i);if(s){let l=[];if(i.isBuilt)l=[{extensionPath:"bat",packageJSON:{name:"bat",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"^1.52.0"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin mmims/language-batchfile grammars/batchfile.cson ./syntaxes/batchfile.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"bat",extensions:[".bat",".cmd"],aliases:["Batch","bat"],configuration:"./language-configuration.json"}],grammars:[{language:"bat",scopeName:"source.batchfile",path:"./syntaxes/batchfile.tmLanguage.json"}],snippets:[{language:"bat",path:"./snippets/batchfile.code-snippets"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Windows Bat Language Basics",description:"Provides snippets, syntax highlighting, bracket matching and folding in Windows batch files."}},{extensionPath:"clojure",packageJSON:{name:"clojure",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin atom/language-clojure grammars/clojure.cson ./syntaxes/clojure.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"clojure",aliases:["Clojure","clojure"],extensions:[".clj",".cljs",".cljc",".cljx",".clojure",".edn"],configuration:"./language-configuration.json"}],grammars:[{language:"clojure",scopeName:"source.clojure",path:"./syntaxes/clojure.tmLanguage.json"}],configurationDefaults:{"[clojure]":{"diffEditor.ignoreTrimWhitespace":!1}}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Clojure Language Basics",description:"Provides syntax highlighting and bracket matching in Clojure files."}},{extensionPath:"coffeescript",packageJSON:{name:"coffeescript",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin atom/language-coffee-script grammars/coffeescript.cson ./syntaxes/coffeescript.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"coffeescript",extensions:[".coffee",".cson",".iced"],aliases:["CoffeeScript","coffeescript","coffee"],configuration:"./language-configuration.json"}],grammars:[{language:"coffeescript",scopeName:"source.coffee",path:"./syntaxes/coffeescript.tmLanguage.json"}],breakpoints:[{language:"coffeescript"}],snippets:[{language:"coffeescript",path:"./snippets/coffeescript.code-snippets"}],configurationDefaults:{"[coffeescript]":{"diffEditor.ignoreTrimWhitespace":!1,"editor.defaultColorDecorators":"never"}}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"CoffeeScript Language Basics",description:"Provides snippets, syntax highlighting, bracket matching and folding in CoffeeScript files."}},{extensionPath:"configuration-editing",packageJSON:{name:"configuration-editing",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"^1.0.0"},icon:"images/icon.png",activationEvents:["onProfile","onProfile:github","onLanguage:json","onLanguage:jsonc"],enabledApiProposals:["profileContentHandlers"],main:"./dist/configurationEditingMain",browser:"./dist/browser/configurationEditingMain",capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},contributes:{languages:[{id:"jsonc",extensions:[".code-workspace","language-configuration.json","icon-theme.json","color-theme.json"],filenames:["settings.json","launch.json","tasks.json","mcp.json","keybindings.json","extensions.json","argv.json","profiles.json","devcontainer.json",".devcontainer.json"]},{id:"json",extensions:[".code-profile"]}],jsonValidation:[{fileMatch:"vscode://defaultsettings/keybindings.json",url:"vscode://schemas/keybindings"},{fileMatch:"%APP_SETTINGS_HOME%/keybindings.json",url:"vscode://schemas/keybindings"},{fileMatch:"%APP_SETTINGS_HOME%/profiles/*/keybindings.json",url:"vscode://schemas/keybindings"},{fileMatch:"vscode://defaultsettings/*.json",url:"vscode://schemas/settings/default"},{fileMatch:"%APP_SETTINGS_HOME%/settings.json",url:"vscode://schemas/settings/user"},{fileMatch:"%APP_SETTINGS_HOME%/profiles/*/settings.json",url:"vscode://schemas/settings/profile"},{fileMatch:"%MACHINE_SETTINGS_HOME%/settings.json",url:"vscode://schemas/settings/machine"},{fileMatch:"%APP_WORKSPACES_HOME%/*/workspace.json",url:"vscode://schemas/workspaceConfig"},{fileMatch:"**/*.code-workspace",url:"vscode://schemas/workspaceConfig"},{fileMatch:"**/argv.json",url:"vscode://schemas/argv"},{fileMatch:"/.vscode/settings.json",url:"vscode://schemas/settings/folder"},{fileMatch:"/.vscode/launch.json",url:"vscode://schemas/launch"},{fileMatch:"/.vscode/tasks.json",url:"vscode://schemas/tasks"},{fileMatch:"/.vscode/mcp.json",url:"vscode://schemas/mcp"},{fileMatch:"%APP_SETTINGS_HOME%/tasks.json",url:"vscode://schemas/tasks"},{fileMatch:"%APP_SETTINGS_HOME%/snippets/*.json",url:"vscode://schemas/snippets"},{fileMatch:"%APP_SETTINGS_HOME%/prompts/*.toolsets.jsonc",url:"vscode://schemas/toolsets"},{fileMatch:"%APP_SETTINGS_HOME%/profiles/*/snippets/.json",url:"vscode://schemas/snippets"},{fileMatch:"%APP_SETTINGS_HOME%/sync/snippets/preview/*.json",url:"vscode://schemas/snippets"},{fileMatch:"**/*.code-snippets",url:"vscode://schemas/global-snippets"},{fileMatch:"/.vscode/extensions.json",url:"vscode://schemas/extensions"},{fileMatch:"devcontainer.json",url:"https://raw.githubusercontent.com/devcontainers/spec/main/schemas/devContainer.schema.json"},{fileMatch:".devcontainer.json",url:"https://raw.githubusercontent.com/devcontainers/spec/main/schemas/devContainer.schema.json"},{fileMatch:"%APP_SETTINGS_HOME%/globalStorage/ms-vscode-remote.remote-containers/nameConfigs/*.json",url:"./schemas/attachContainer.schema.json"},{fileMatch:"%APP_SETTINGS_HOME%/globalStorage/ms-vscode-remote.remote-containers/imageConfigs/*.json",url:"./schemas/attachContainer.schema.json"},{fileMatch:"**/quality/*/product.json",url:"vscode://schemas/vscode-product"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Configuration Editing",description:"Provides capabilities (advanced IntelliSense, auto-fixing) in configuration files like settings, launch, and extension recommendation files."}},{extensionPath:"cpp",packageJSON:{name:"cpp",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ./build/update-grammars.js"},categories:["Programming Languages"],contributes:{languages:[{id:"c",extensions:[".c",".i"],aliases:["C","c"],configuration:"./language-configuration.json"},{id:"cpp",extensions:[".cpp",".cppm",".cc",".ccm",".cxx",".cxxm",".c++",".c++m",".hpp",".hh",".hxx",".h++",".h",".ii",".ino",".inl",".ipp",".ixx",".tpp",".txx",".hpp.in",".h.in"],aliases:["C++","Cpp","cpp"],configuration:"./language-configuration.json"},{id:"cuda-cpp",extensions:[".cu",".cuh"],aliases:["CUDA C++"],configuration:"./language-configuration.json"}],grammars:[{language:"c",scopeName:"source.c",path:"./syntaxes/c.tmLanguage.json"},{language:"cpp",scopeName:"source.cpp.embedded.macro",path:"./syntaxes/cpp.embedded.macro.tmLanguage.json"},{language:"cpp",scopeName:"source.cpp",path:"./syntaxes/cpp.tmLanguage.json"},{scopeName:"source.c.platform",path:"./syntaxes/platform.tmLanguage.json"},{language:"cuda-cpp",scopeName:"source.cuda-cpp",path:"./syntaxes/cuda-cpp.tmLanguage.json"}],problemPatterns:[{name:"nvcc-location",regexp:"^(.*)\\((\\d+)\\):\\s+(warning|error):\\s+(.*)",kind:"location",file:1,location:2,severity:3,message:4}],problemMatchers:[{name:"nvcc",owner:"cuda-cpp",fileLocation:["relative","${workspaceFolder}"],pattern:"$nvcc-location"}],snippets:[{language:"c",path:"./snippets/c.code-snippets"},{language:"cpp",path:"./snippets/cpp.code-snippets"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"C/C++ Language Basics",description:"Provides snippets, syntax highlighting, bracket matching and folding in C/C++ files."}},{extensionPath:"csharp",packageJSON:{name:"csharp",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"0.10.x"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin dotnet/csharp-tmLanguage grammars/csharp.tmLanguage ./syntaxes/csharp.tmLanguage.json"},categories:["Programming Languages"],contributes:{configurationDefaults:{"[csharp]":{"editor.maxTokenizationLineLength":2500}},languages:[{id:"csharp",extensions:[".cs",".csx",".cake"],aliases:["C#","csharp"],configuration:"./language-configuration.json"}],grammars:[{language:"csharp",scopeName:"source.cs",path:"./syntaxes/csharp.tmLanguage.json",tokenTypes:{"meta.interpolation":"other"},unbalancedBracketScopes:["keyword.operator.relational.cs","keyword.operator.arrow.cs","punctuation.accessor.pointer.cs","keyword.operator.bitwise.shift.cs","keyword.operator.assignment.compound.bitwise.cs"]}],snippets:[{language:"csharp",path:"./snippets/csharp.code-snippets"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"C# Language Basics",description:"Provides snippets, syntax highlighting, bracket matching and folding in C# files."}},{extensionPath:"css",packageJSON:{name:"css",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"0.10.x"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin microsoft/vscode-css grammars/css.cson ./syntaxes/css.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"css",aliases:["CSS","css"],extensions:[".css"],mimetypes:["text/css"],configuration:"./language-configuration.json"}],grammars:[{language:"css",scopeName:"source.css",path:"./syntaxes/css.tmLanguage.json",tokenTypes:{"meta.function.url string.quoted":"other"}}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"CSS Language Basics",description:"Provides syntax highlighting and bracket matching for CSS, LESS and SCSS files."}},{extensionPath:"css-language-features",packageJSON:{name:"css-language-features",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"^1.77.0"},icon:"icons/css.png",activationEvents:["onLanguage:css","onLanguage:less","onLanguage:scss","onCommand:_css.applyCodeAction"],main:"./client/dist/node/cssClientMain",browser:"./client/dist/browser/cssClientMain",capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},categories:["Programming Languages"],contributes:{configuration:[{order:22,id:"css",title:"%css.title%",properties:{"css.customData":{type:"array",markdownDescription:"%css.customData.desc%",default:[],items:{type:"string"},scope:"resource"},"css.completion.triggerPropertyValueCompletion":{type:"boolean",scope:"resource",default:!0,description:"%css.completion.triggerPropertyValueCompletion.desc%"},"css.completion.completePropertyWithSemicolon":{type:"boolean",scope:"resource",default:!0,description:"%css.completion.completePropertyWithSemicolon.desc%"},"css.validate":{type:"boolean",scope:"resource",default:!0,description:"%css.validate.desc%"},"css.hover.documentation":{type:"boolean",scope:"resource",default:!0,description:"%css.hover.documentation%"},"css.hover.references":{type:"boolean",scope:"resource",default:!0,description:"%css.hover.references%"},"css.lint.compatibleVendorPrefixes":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%css.lint.compatibleVendorPrefixes.desc%"},"css.lint.vendorPrefix":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",description:"%css.lint.vendorPrefix.desc%"},"css.lint.duplicateProperties":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%css.lint.duplicateProperties.desc%"},"css.lint.emptyRules":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",description:"%css.lint.emptyRules.desc%"},"css.lint.importStatement":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%css.lint.importStatement.desc%"},"css.lint.boxModel":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",markdownDescription:"%css.lint.boxModel.desc%"},"css.lint.universalSelector":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",markdownDescription:"%css.lint.universalSelector.desc%"},"css.lint.zeroUnits":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%css.lint.zeroUnits.desc%"},"css.lint.fontFaceProperties":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",markdownDescription:"%css.lint.fontFaceProperties.desc%"},"css.lint.hexColorLength":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"error",description:"%css.lint.hexColorLength.desc%"},"css.lint.argumentsInColorFunction":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"error",description:"%css.lint.argumentsInColorFunction.desc%"},"css.lint.unknownProperties":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",description:"%css.lint.unknownProperties.desc%"},"css.lint.validProperties":{type:"array",uniqueItems:!0,items:{type:"string"},scope:"resource",default:[],description:"%css.lint.validProperties.desc%"},"css.lint.ieHack":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%css.lint.ieHack.desc%"},"css.lint.unknownVendorSpecificProperties":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%css.lint.unknownVendorSpecificProperties.desc%"},"css.lint.propertyIgnoredDueToDisplay":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",markdownDescription:"%css.lint.propertyIgnoredDueToDisplay.desc%"},"css.lint.important":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",markdownDescription:"%css.lint.important.desc%"},"css.lint.float":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",markdownDescription:"%css.lint.float.desc%"},"css.lint.idSelector":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%css.lint.idSelector.desc%"},"css.lint.unknownAtRules":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",description:"%css.lint.unknownAtRules.desc%"},"css.trace.server":{type:"string",scope:"window",enum:["off","messages","verbose"],default:"off",description:"%css.trace.server.desc%"},"css.format.enable":{type:"boolean",scope:"window",default:!0,description:"%css.format.enable.desc%"},"css.format.newlineBetweenSelectors":{type:"boolean",scope:"resource",default:!0,markdownDescription:"%css.format.newlineBetweenSelectors.desc%"},"css.format.newlineBetweenRules":{type:"boolean",scope:"resource",default:!0,markdownDescription:"%css.format.newlineBetweenRules.desc%"},"css.format.spaceAroundSelectorSeparator":{type:"boolean",scope:"resource",default:!1,markdownDescription:"%css.format.spaceAroundSelectorSeparator.desc%"},"css.format.braceStyle":{type:"string",scope:"resource",default:"collapse",enum:["collapse","expand"],markdownDescription:"%css.format.braceStyle.desc%"},"css.format.preserveNewLines":{type:"boolean",scope:"resource",default:!0,markdownDescription:"%css.format.preserveNewLines.desc%"},"css.format.maxPreserveNewLines":{type:["number","null"],scope:"resource",default:null,markdownDescription:"%css.format.maxPreserveNewLines.desc%"}}},{id:"scss",order:24,title:"%scss.title%",properties:{"scss.completion.triggerPropertyValueCompletion":{type:"boolean",scope:"resource",default:!0,description:"%scss.completion.triggerPropertyValueCompletion.desc%"},"scss.completion.completePropertyWithSemicolon":{type:"boolean",scope:"resource",default:!0,description:"%scss.completion.completePropertyWithSemicolon.desc%"},"scss.validate":{type:"boolean",scope:"resource",default:!0,description:"%scss.validate.desc%"},"scss.hover.documentation":{type:"boolean",scope:"resource",default:!0,description:"%scss.hover.documentation%"},"scss.hover.references":{type:"boolean",scope:"resource",default:!0,description:"%scss.hover.references%"},"scss.lint.compatibleVendorPrefixes":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%scss.lint.compatibleVendorPrefixes.desc%"},"scss.lint.vendorPrefix":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",description:"%scss.lint.vendorPrefix.desc%"},"scss.lint.duplicateProperties":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%scss.lint.duplicateProperties.desc%"},"scss.lint.emptyRules":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",description:"%scss.lint.emptyRules.desc%"},"scss.lint.importStatement":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%scss.lint.importStatement.desc%"},"scss.lint.boxModel":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",markdownDescription:"%scss.lint.boxModel.desc%"},"scss.lint.universalSelector":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",markdownDescription:"%scss.lint.universalSelector.desc%"},"scss.lint.zeroUnits":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%scss.lint.zeroUnits.desc%"},"scss.lint.fontFaceProperties":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",markdownDescription:"%scss.lint.fontFaceProperties.desc%"},"scss.lint.hexColorLength":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"error",description:"%scss.lint.hexColorLength.desc%"},"scss.lint.argumentsInColorFunction":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"error",description:"%scss.lint.argumentsInColorFunction.desc%"},"scss.lint.unknownProperties":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",description:"%scss.lint.unknownProperties.desc%"},"scss.lint.validProperties":{type:"array",uniqueItems:!0,items:{type:"string"},scope:"resource",default:[],description:"%scss.lint.validProperties.desc%"},"scss.lint.ieHack":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%scss.lint.ieHack.desc%"},"scss.lint.unknownVendorSpecificProperties":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%scss.lint.unknownVendorSpecificProperties.desc%"},"scss.lint.propertyIgnoredDueToDisplay":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",markdownDescription:"%scss.lint.propertyIgnoredDueToDisplay.desc%"},"scss.lint.important":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",markdownDescription:"%scss.lint.important.desc%"},"scss.lint.float":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",markdownDescription:"%scss.lint.float.desc%"},"scss.lint.idSelector":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%scss.lint.idSelector.desc%"},"scss.lint.unknownAtRules":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",description:"%scss.lint.unknownAtRules.desc%"},"scss.format.enable":{type:"boolean",scope:"window",default:!0,description:"%scss.format.enable.desc%"},"scss.format.newlineBetweenSelectors":{type:"boolean",scope:"resource",default:!0,markdownDescription:"%scss.format.newlineBetweenSelectors.desc%"},"scss.format.newlineBetweenRules":{type:"boolean",scope:"resource",default:!0,markdownDescription:"%scss.format.newlineBetweenRules.desc%"},"scss.format.spaceAroundSelectorSeparator":{type:"boolean",scope:"resource",default:!1,markdownDescription:"%scss.format.spaceAroundSelectorSeparator.desc%"},"scss.format.braceStyle":{type:"string",scope:"resource",default:"collapse",enum:["collapse","expand"],markdownDescription:"%scss.format.braceStyle.desc%"},"scss.format.preserveNewLines":{type:"boolean",scope:"resource",default:!0,markdownDescription:"%scss.format.preserveNewLines.desc%"},"scss.format.maxPreserveNewLines":{type:["number","null"],scope:"resource",default:null,markdownDescription:"%scss.format.maxPreserveNewLines.desc%"}}},{id:"less",order:23,type:"object",title:"%less.title%",properties:{"less.completion.triggerPropertyValueCompletion":{type:"boolean",scope:"resource",default:!0,description:"%less.completion.triggerPropertyValueCompletion.desc%"},"less.completion.completePropertyWithSemicolon":{type:"boolean",scope:"resource",default:!0,description:"%less.completion.completePropertyWithSemicolon.desc%"},"less.validate":{type:"boolean",scope:"resource",default:!0,description:"%less.validate.desc%"},"less.hover.documentation":{type:"boolean",scope:"resource",default:!0,description:"%less.hover.documentation%"},"less.hover.references":{type:"boolean",scope:"resource",default:!0,description:"%less.hover.references%"},"less.lint.compatibleVendorPrefixes":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%less.lint.compatibleVendorPrefixes.desc%"},"less.lint.vendorPrefix":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",description:"%less.lint.vendorPrefix.desc%"},"less.lint.duplicateProperties":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%less.lint.duplicateProperties.desc%"},"less.lint.emptyRules":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",description:"%less.lint.emptyRules.desc%"},"less.lint.importStatement":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%less.lint.importStatement.desc%"},"less.lint.boxModel":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",markdownDescription:"%less.lint.boxModel.desc%"},"less.lint.universalSelector":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",markdownDescription:"%less.lint.universalSelector.desc%"},"less.lint.zeroUnits":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%less.lint.zeroUnits.desc%"},"less.lint.fontFaceProperties":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",markdownDescription:"%less.lint.fontFaceProperties.desc%"},"less.lint.hexColorLength":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"error",description:"%less.lint.hexColorLength.desc%"},"less.lint.argumentsInColorFunction":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"error",description:"%less.lint.argumentsInColorFunction.desc%"},"less.lint.unknownProperties":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",description:"%less.lint.unknownProperties.desc%"},"less.lint.validProperties":{type:"array",uniqueItems:!0,items:{type:"string"},scope:"resource",default:[],description:"%less.lint.validProperties.desc%"},"less.lint.ieHack":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%less.lint.ieHack.desc%"},"less.lint.unknownVendorSpecificProperties":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%less.lint.unknownVendorSpecificProperties.desc%"},"less.lint.propertyIgnoredDueToDisplay":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",markdownDescription:"%less.lint.propertyIgnoredDueToDisplay.desc%"},"less.lint.important":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",markdownDescription:"%less.lint.important.desc%"},"less.lint.float":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",markdownDescription:"%less.lint.float.desc%"},"less.lint.idSelector":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%less.lint.idSelector.desc%"},"less.lint.unknownAtRules":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",description:"%less.lint.unknownAtRules.desc%"},"less.format.enable":{type:"boolean",scope:"window",default:!0,description:"%less.format.enable.desc%"},"less.format.newlineBetweenSelectors":{type:"boolean",scope:"resource",default:!0,markdownDescription:"%less.format.newlineBetweenSelectors.desc%"},"less.format.newlineBetweenRules":{type:"boolean",scope:"resource",default:!0,markdownDescription:"%less.format.newlineBetweenRules.desc%"},"less.format.spaceAroundSelectorSeparator":{type:"boolean",scope:"resource",default:!1,markdownDescription:"%less.format.spaceAroundSelectorSeparator.desc%"},"less.format.braceStyle":{type:"string",scope:"resource",default:"collapse",enum:["collapse","expand"],markdownDescription:"%less.format.braceStyle.desc%"},"less.format.preserveNewLines":{type:"boolean",scope:"resource",default:!0,markdownDescription:"%less.format.preserveNewLines.desc%"},"less.format.maxPreserveNewLines":{type:["number","null"],scope:"resource",default:null,markdownDescription:"%less.format.maxPreserveNewLines.desc%"}}}],configurationDefaults:{"[css]":{"editor.suggest.insertMode":"replace"},"[scss]":{"editor.suggest.insertMode":"replace"},"[less]":{"editor.suggest.insertMode":"replace"}},jsonValidation:[{fileMatch:"*.css-data.json",url:"https://raw.githubusercontent.com/microsoft/vscode-css-languageservice/master/docs/customData.schema.json"},{fileMatch:"package.json",url:"./schemas/package.schema.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"CSS Language Features",description:"Provides rich language support for CSS, LESS and SCSS files.","css.title":"CSS","css.customData.desc":`A list of relative file paths pointing to JSON files following the [custom data format](https://github.com/microsoft/vscode-css-languageservice/blob/master/docs/customData.md).
VS Code loads custom data on startup to enhance its CSS support for CSS custom properties (variables), at-rules, pseudo-classes, and pseudo-elements you specify in the JSON files.
The file paths are relative to workspace and only workspace folder settings are considered.`,"css.completion.triggerPropertyValueCompletion.desc":"By default, VS Code triggers property value completion after selecting a CSS property. Use this setting to disable this behavior.","css.completion.completePropertyWithSemicolon.desc":"Insert semicolon at end of line when completing CSS properties.","css.lint.argumentsInColorFunction.desc":"Invalid number of parameters.","css.lint.boxModel.desc":"Do not use `width` or `height` when using `padding` or `border`.","css.lint.compatibleVendorPrefixes.desc":"When using a vendor-specific prefix make sure to also include all other vendor-specific properties.","css.lint.duplicateProperties.desc":"Do not use duplicate style definitions.","css.lint.emptyRules.desc":"Do not use empty rulesets.","css.lint.float.desc":"Avoid using `float`. Floats lead to fragile CSS that is easy to break if one aspect of the layout changes.","css.lint.fontFaceProperties.desc":"`@font-face` rule must define `src` and `font-family` properties.","css.lint.hexColorLength.desc":"Hex colors must consist of 3, 4, 6 or 8 hex numbers.","css.lint.idSelector.desc":"Selectors should not contain IDs because these rules are too tightly coupled with the HTML.","css.lint.ieHack.desc":"IE hacks are only necessary when supporting IE7 and older.","css.lint.important.desc":"Avoid using `!important`. It is an indication that the specificity of the entire CSS has gotten out of control and needs to be refactored.","css.lint.importStatement.desc":"Import statements do not load in parallel.","css.lint.propertyIgnoredDueToDisplay.desc":"Property is ignored due to the display. E.g. with `display: inline`, the `width`, `height`, `margin-top`, `margin-bottom`, and `float` properties have no effect.","css.lint.universalSelector.desc":"The universal selector (`*`) is known to be slow.","css.lint.unknownAtRules.desc":"Unknown at-rule.","css.lint.unknownProperties.desc":"Unknown property.","css.lint.validProperties.desc":"A list of properties that are not validated against the `unknownProperties` rule.","css.lint.unknownVendorSpecificProperties.desc":"Unknown vendor specific property.","css.lint.vendorPrefix.desc":"When using a vendor-specific prefix, also include the standard property.","css.lint.zeroUnits.desc":"No unit for zero needed.","css.trace.server.desc":"Traces the communication between VS Code and the CSS language server.","css.validate.title":"Controls CSS validation and problem severities.","css.validate.desc":"Enables or disables all validations.","css.hover.documentation":"Show property and value documentation in CSS hovers.","css.hover.references":"Show references to MDN in CSS hovers.","css.format.enable.desc":"Enable/disable default CSS formatter.","css.format.newlineBetweenSelectors.desc":"Separate selectors with a new line.","css.format.newlineBetweenRules.desc":"Separate rulesets by a blank line.","css.format.spaceAroundSelectorSeparator.desc":"Ensure a space character around selector separators '>', '+', '~' (e.g. `a > b`).","css.format.braceStyle.desc":"Put braces on the same line as rules (`collapse`) or put braces on own line (`expand`).","css.format.preserveNewLines.desc":"Whether existing line breaks before rules and declarations should be preserved.","css.format.maxPreserveNewLines.desc":"Maximum number of line breaks to be preserved in one chunk, when `#css.format.preserveNewLines#` is enabled.","less.title":"LESS","less.completion.triggerPropertyValueCompletion.desc":"By default, VS Code triggers property value completion after selecting a CSS property. Use this setting to disable this behavior.","less.completion.completePropertyWithSemicolon.desc":"Insert semicolon at end of line when completing CSS properties.","less.lint.argumentsInColorFunction.desc":"Invalid number of parameters.","less.lint.boxModel.desc":"Do not use `width` or `height` when using `padding` or `border`.","less.lint.compatibleVendorPrefixes.desc":"When using a vendor-specific prefix make sure to also include all other vendor-specific properties.","less.lint.duplicateProperties.desc":"Do not use duplicate style definitions.","less.lint.emptyRules.desc":"Do not use empty rulesets.","less.lint.float.desc":"Avoid using `float`. Floats lead to fragile CSS that is easy to break if one aspect of the layout changes.","less.lint.fontFaceProperties.desc":"`@font-face` rule must define `src` and `font-family` properties.","less.lint.hexColorLength.desc":"Hex colors must consist of 3, 4, 6 or 8 hex numbers.","less.lint.idSelector.desc":"Selectors should not contain IDs because these rules are too tightly coupled with the HTML.","less.lint.ieHack.desc":"IE hacks are only necessary when supporting IE7 and older.","less.lint.important.desc":"Avoid using `!important`. It is an indication that the specificity of the entire CSS has gotten out of control and needs to be refactored.","less.lint.importStatement.desc":"Import statements do not load in parallel.","less.lint.propertyIgnoredDueToDisplay.desc":"Property is ignored due to the display. E.g. with `display: inline`, the `width`, `height`, `margin-top`, `margin-bottom`, and `float` properties have no effect.","less.lint.universalSelector.desc":"The universal selector (`*`) is known to be slow.","less.lint.unknownAtRules.desc":"Unknown at-rule.","less.lint.unknownProperties.desc":"Unknown property.","less.lint.validProperties.desc":"A list of properties that are not validated against the `unknownProperties` rule.","less.lint.unknownVendorSpecificProperties.desc":"Unknown vendor specific property.","less.lint.vendorPrefix.desc":"When using a vendor-specific prefix, also include the standard property.","less.lint.zeroUnits.desc":"No unit for zero needed.","less.validate.title":"Controls LESS validation and problem severities.","less.validate.desc":"Enables or disables all validations.","less.hover.documentation":"Show property and value documentation in LESS hovers.","less.hover.references":"Show references to MDN in LESS hovers.","less.format.enable.desc":"Enable/disable default LESS formatter.","less.format.newlineBetweenSelectors.desc":"Separate selectors with a new line.","less.format.newlineBetweenRules.desc":"Separate rulesets by a blank line.","less.format.spaceAroundSelectorSeparator.desc":"Ensure a space character around selector separators '>', '+', '~' (e.g. `a > b`).","less.format.braceStyle.desc":"Put braces on the same line as rules (`collapse`) or put braces on own line (`expand`).","less.format.preserveNewLines.desc":"Whether existing line breaks before rules and declarations should be preserved.","less.format.maxPreserveNewLines.desc":"Maximum number of line breaks to be preserved in one chunk, when `#less.format.preserveNewLines#` is enabled.","scss.title":"SCSS (Sass)","scss.completion.triggerPropertyValueCompletion.desc":"By default, VS Code triggers property value completion after selecting a CSS property. Use this setting to disable this behavior.","scss.completion.completePropertyWithSemicolon.desc":"Insert semicolon at end of line when completing CSS properties.","scss.lint.argumentsInColorFunction.desc":"Invalid number of parameters.","scss.lint.boxModel.desc":"Do not use `width` or `height` when using `padding` or `border`.","scss.lint.compatibleVendorPrefixes.desc":"When using a vendor-specific prefix make sure to also include all other vendor-specific properties.","scss.lint.duplicateProperties.desc":"Do not use duplicate style definitions.","scss.lint.emptyRules.desc":"Do not use empty rulesets.","scss.lint.float.desc":"Avoid using `float`. Floats lead to fragile CSS that is easy to break if one aspect of the layout changes.","scss.lint.fontFaceProperties.desc":"`@font-face` rule must define `src` and `font-family` properties.","scss.lint.hexColorLength.desc":"Hex colors must consist of 3, 4, 6 or 8 hex numbers.","scss.lint.idSelector.desc":"Selectors should not contain IDs because these rules are too tightly coupled with the HTML.","scss.lint.ieHack.desc":"IE hacks are only necessary when supporting IE7 and older.","scss.lint.important.desc":"Avoid using `!important`. It is an indication that the specificity of the entire CSS has gotten out of control and needs to be refactored.","scss.lint.importStatement.desc":"Import statements do not load in parallel.","scss.lint.propertyIgnoredDueToDisplay.desc":"Property is ignored due to the display. E.g. with `display: inline`, the `width`, `height`, `margin-top`, `margin-bottom`, and `float` properties have no effect.","scss.lint.universalSelector.desc":"The universal selector (`*`) is known to be slow.","scss.lint.unknownAtRules.desc":"Unknown at-rule.","scss.lint.unknownProperties.desc":"Unknown property.","scss.lint.validProperties.desc":"A list of properties that are not validated against the `unknownProperties` rule.","scss.lint.unknownVendorSpecificProperties.desc":"Unknown vendor specific property.","scss.lint.vendorPrefix.desc":"When using a vendor-specific prefix, also include the standard property.","scss.lint.zeroUnits.desc":"No unit for zero needed.","scss.validate.title":"Controls SCSS validation and problem severities.","scss.validate.desc":"Enables or disables all validations.","scss.hover.documentation":"Show property and value documentation in SCSS hovers.","scss.hover.references":"Show references to MDN in SCSS hovers.","scss.format.enable.desc":"Enable/disable default SCSS formatter.","scss.format.newlineBetweenSelectors.desc":"Separate selectors with a new line.","scss.format.newlineBetweenRules.desc":"Separate rulesets by a blank line.","scss.format.spaceAroundSelectorSeparator.desc":"Ensure a space character around selector separators '>', '+', '~' (e.g. `a > b`).","scss.format.braceStyle.desc":"Put braces on the same line as rules (`collapse`) or put braces on own line (`expand`).","scss.format.preserveNewLines.desc":"Whether existing line breaks before rules and declarations should be preserved.","scss.format.maxPreserveNewLines.desc":"Maximum number of line breaks to be preserved in one chunk, when `#scss.format.preserveNewLines#` is enabled.","css.colorDecorators.enable.deprecationMessage":"The setting `css.colorDecorators.enable` has been deprecated in favor of `editor.colorDecorators`.","scss.colorDecorators.enable.deprecationMessage":"The setting `scss.colorDecorators.enable` has been deprecated in favor of `editor.colorDecorators`.","less.colorDecorators.enable.deprecationMessage":"The setting `less.colorDecorators.enable` has been deprecated in favor of `editor.colorDecorators`."},readmePath:"css-language-features\\README.md"},{extensionPath:"dart",packageJSON:{name:"dart",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"0.10.x"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin dart-lang/dart-syntax-highlight grammars/dart.json ./syntaxes/dart.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"dart",extensions:[".dart"],aliases:["Dart"],configuration:"./language-configuration.json"}],grammars:[{language:"dart",scopeName:"source.dart",path:"./syntaxes/dart.tmLanguage.json"}]}},packageNLS:{displayName:"Dart Language Basics",description:"Provides syntax highlighting & bracket matching in Dart files."}},{extensionPath:"diff",packageJSON:{name:"diff",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"0.10.x"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin textmate/diff.tmbundle Syntaxes/Diff.plist ./syntaxes/diff.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"diff",aliases:["Diff","diff"],extensions:[".diff",".patch",".rej"],configuration:"./language-configuration.json"}],grammars:[{language:"diff",scopeName:"source.diff",path:"./syntaxes/diff.tmLanguage.json"}]}},packageNLS:{displayName:"Diff Language Basics",description:"Provides syntax highlighting & bracket matching in Diff files."}},{extensionPath:"docker",packageJSON:{name:"docker",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{},categories:["Programming Languages"],contributes:{languages:[{id:"dockerfile",extensions:[".dockerfile",".containerfile"],filenames:["Dockerfile","Containerfile"],filenamePatterns:["Dockerfile.*","Containerfile.*"],aliases:["Docker","Dockerfile","Containerfile"],configuration:"./language-configuration.json"}],grammars:[{language:"dockerfile",scopeName:"source.dockerfile",path:"./syntaxes/docker.tmLanguage.json"}],configurationDefaults:{"[dockerfile]":{"editor.quickSuggestions":{strings:!0}}}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Docker Language Basics",description:"Provides syntax highlighting and bracket matching in Docker files."}},{extensionPath:"dotenv",packageJSON:{name:"dotenv",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin dotenv-org/dotenv-vscode syntaxes/dotenv.tmLanguage.json ./syntaxes/dotenv.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"dotenv",extensions:[".env"],filenames:[".env",".flaskenv","user-dirs.dirs"],filenamePatterns:[".env.*"],aliases:["Dotenv"],configuration:"./language-configuration.json"}],grammars:[{language:"dotenv",scopeName:"source.dotenv",path:"./syntaxes/dotenv.tmLanguage.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Dotenv Language Basics",description:"Provides syntax highlighting and bracket matching in dotenv files."}},{extensionPath:"emmet",packageJSON:{name:"emmet",displayName:"Emmet",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"^1.13.0"},icon:"images/icon.png",categories:["Other"],repository:{type:"git",url:"https://github.com/microsoft/vscode.git"},activationEvents:["onCommand:emmet.expandAbbreviation","onLanguage"],main:"./dist/node/emmetNodeMain",browser:"./dist/browser/emmetBrowserMain",contributes:{configuration:{type:"object",title:"Emmet",properties:{"emmet.showExpandedAbbreviation":{type:["string"],enum:["never","always","inMarkupAndStylesheetFilesOnly"],default:"always",markdownDescription:"%emmetShowExpandedAbbreviation%"},"emmet.showAbbreviationSuggestions":{type:"boolean",default:!0,scope:"language-overridable",markdownDescription:"%emmetShowAbbreviationSuggestions%"},"emmet.includeLanguages":{type:"object",additionalProperties:{type:"string"},default:{},markdownDescription:"%emmetIncludeLanguages%"},"emmet.variables":{type:"object",properties:{lang:{type:"string",default:"en"},charset:{type:"string",default:"UTF-8"}},additionalProperties:{type:"string"},default:{},markdownDescription:"%emmetVariables%"},"emmet.syntaxProfiles":{type:"object",default:{},markdownDescription:"%emmetSyntaxProfiles%"},"emmet.excludeLanguages":{type:"array",items:{type:"string"},default:["markdown"],markdownDescription:"%emmetExclude%"},"emmet.extensionsPath":{type:"array",items:{type:"string",markdownDescription:"%emmetExtensionsPathItem%"},default:[],scope:"machine-overridable",markdownDescription:"%emmetExtensionsPath%"},"emmet.triggerExpansionOnTab":{type:"boolean",default:!1,scope:"language-overridable",markdownDescription:"%emmetTriggerExpansionOnTab%"},"emmet.useInlineCompletions":{type:"boolean",default:!1,markdownDescription:"%emmetUseInlineCompletions%"},"emmet.preferences":{type:"object",default:{},markdownDescription:"%emmetPreferences%",properties:{"css.intUnit":{type:"string",default:"px",markdownDescription:"%emmetPreferencesIntUnit%"},"css.floatUnit":{type:"string",default:"em",markdownDescription:"%emmetPreferencesFloatUnit%"},"css.propertyEnd":{type:"string",default:";",markdownDescription:"%emmetPreferencesCssAfter%"},"sass.propertyEnd":{type:"string",default:"",markdownDescription:"%emmetPreferencesSassAfter%"},"stylus.propertyEnd":{type:"string",default:"",markdownDescription:"%emmetPreferencesStylusAfter%"},"css.valueSeparator":{type:"string",default:": ",markdownDescription:"%emmetPreferencesCssBetween%"},"sass.valueSeparator":{type:"string",default:": ",markdownDescription:"%emmetPreferencesSassBetween%"},"stylus.valueSeparator":{type:"string",default:" ",markdownDescription:"%emmetPreferencesStylusBetween%"},"bem.elementSeparator":{type:"string",default:"__",markdownDescription:"%emmetPreferencesBemElementSeparator%"},"bem.modifierSeparator":{type:"string",default:"_",markdownDescription:"%emmetPreferencesBemModifierSeparator%"},"filter.commentBefore":{type:"string",default:"",markdownDescription:"%emmetPreferencesFilterCommentBefore%"},"filter.commentAfter":{type:"string",default:`
<!-- /[#ID][.CLASS] -->`,markdownDescription:"%emmetPreferencesFilterCommentAfter%"},"filter.commentTrigger":{type:"array",default:["id","class"],markdownDescription:"%emmetPreferencesFilterCommentTrigger%"},"format.noIndentTags":{type:"array",default:["html"],markdownDescription:"%emmetPreferencesFormatNoIndentTags%"},"format.forceIndentationForTags":{type:"array",default:["body"],markdownDescription:"%emmetPreferencesFormatForceIndentTags%"},"profile.allowCompactBoolean":{type:"boolean",default:!1,markdownDescription:"%emmetPreferencesAllowCompactBoolean%"},"css.webkitProperties":{type:"string",default:null,markdownDescription:"%emmetPreferencesCssWebkitProperties%"},"css.mozProperties":{type:"string",default:null,markdownDescription:"%emmetPreferencesCssMozProperties%"},"css.oProperties":{type:"string",default:null,markdownDescription:"%emmetPreferencesCssOProperties%"},"css.msProperties":{type:"string",default:null,markdownDescription:"%emmetPreferencesCssMsProperties%"},"css.fuzzySearchMinScore":{type:"number",default:.3,markdownDescription:"%emmetPreferencesCssFuzzySearchMinScore%"},"output.inlineBreak":{type:"number",default:0,markdownDescription:"%emmetPreferencesOutputInlineBreak%"},"output.reverseAttributes":{type:"boolean",default:!1,markdownDescription:"%emmetPreferencesOutputReverseAttributes%"},"output.selfClosingStyle":{type:"string",enum:["html","xhtml","xml"],default:"html",markdownDescription:"%emmetPreferencesOutputSelfClosingStyle%"},"css.color.short":{type:"boolean",default:!0,markdownDescription:"%emmetPreferencesCssColorShort%"}}},"emmet.showSuggestionsAsSnippets":{type:"boolean",default:!1,markdownDescription:"%emmetShowSuggestionsAsSnippets%"},"emmet.optimizeStylesheetParsing":{type:"boolean",default:!0,markdownDescription:"%emmetOptimizeStylesheetParsing%"}}},commands:[{command:"editor.emmet.action.wrapWithAbbreviation",title:"%command.wrapWithAbbreviation%",category:"Emmet"},{command:"editor.emmet.action.removeTag",title:"%command.removeTag%",category:"Emmet"},{command:"editor.emmet.action.updateTag",title:"%command.updateTag%",category:"Emmet"},{command:"editor.emmet.action.matchTag",title:"%command.matchTag%",category:"Emmet"},{command:"editor.emmet.action.balanceIn",title:"%command.balanceIn%",category:"Emmet"},{command:"editor.emmet.action.balanceOut",title:"%command.balanceOut%",category:"Emmet"},{command:"editor.emmet.action.prevEditPoint",title:"%command.prevEditPoint%",category:"Emmet"},{command:"editor.emmet.action.nextEditPoint",title:"%command.nextEditPoint%",category:"Emmet"},{command:"editor.emmet.action.mergeLines",title:"%command.mergeLines%",category:"Emmet"},{command:"editor.emmet.action.selectPrevItem",title:"%command.selectPrevItem%",category:"Emmet"},{command:"editor.emmet.action.selectNextItem",title:"%command.selectNextItem%",category:"Emmet"},{command:"editor.emmet.action.splitJoinTag",title:"%command.splitJoinTag%",category:"Emmet"},{command:"editor.emmet.action.toggleComment",title:"%command.toggleComment%",category:"Emmet"},{command:"editor.emmet.action.evaluateMathExpression",title:"%command.evaluateMathExpression%",category:"Emmet"},{command:"editor.emmet.action.updateImageSize",title:"%command.updateImageSize%",category:"Emmet"},{command:"editor.emmet.action.incrementNumberByOneTenth",title:"%command.incrementNumberByOneTenth%",category:"Emmet"},{command:"editor.emmet.action.incrementNumberByOne",title:"%command.incrementNumberByOne%",category:"Emmet"},{command:"editor.emmet.action.incrementNumberByTen",title:"%command.incrementNumberByTen%",category:"Emmet"},{command:"editor.emmet.action.decrementNumberByOneTenth",title:"%command.decrementNumberByOneTenth%",category:"Emmet"},{command:"editor.emmet.action.decrementNumberByOne",title:"%command.decrementNumberByOne%",category:"Emmet"},{command:"editor.emmet.action.decrementNumberByTen",title:"%command.decrementNumberByTen%",category:"Emmet"},{command:"editor.emmet.action.reflectCSSValue",title:"%command.reflectCSSValue%",category:"Emmet"},{command:"workbench.action.showEmmetCommands",title:"%command.showEmmetCommands%",category:""}],menus:{commandPalette:[{command:"editor.emmet.action.wrapWithAbbreviation",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.removeTag",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.updateTag",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.matchTag",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.balanceIn",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.balanceOut",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.prevEditPoint",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.nextEditPoint",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.mergeLines",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.selectPrevItem",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.selectNextItem",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.splitJoinTag",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.toggleComment",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.evaluateMathExpression",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.updateImageSize",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.incrementNumberByOneTenth",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.incrementNumberByOne",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.incrementNumberByTen",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.decrementNumberByOneTenth",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.decrementNumberByOne",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.decrementNumberByTen",when:"!activeEditorIsReadonly"},{command:"editor.emmet.action.reflectCSSValue",when:"!activeEditorIsReadonly"}]}},capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}}},packageNLS:{description:"Emmet support for VS Code","command.wrapWithAbbreviation":"Wrap with Abbreviation","command.removeTag":"Remove Tag","command.updateTag":"Update Tag","command.matchTag":"Go to Matching Pair","command.balanceIn":"Balance (inward)","command.balanceOut":"Balance (outward)","command.prevEditPoint":"Go to Previous Edit Point","command.nextEditPoint":"Go to Next Edit Point","command.mergeLines":"Merge Lines","command.selectPrevItem":"Select Previous Item","command.selectNextItem":"Select Next Item","command.splitJoinTag":"Split/Join Tag","command.toggleComment":"Toggle Comment","command.evaluateMathExpression":"Evaluate Math Expression","command.updateImageSize":"Update Image Size","command.reflectCSSValue":"Reflect CSS Value","command.incrementNumberByOne":"Increment by 1","command.decrementNumberByOne":"Decrement by 1","command.incrementNumberByOneTenth":"Increment by 0.1","command.decrementNumberByOneTenth":"Decrement by 0.1","command.incrementNumberByTen":"Increment by 10","command.decrementNumberByTen":"Decrement by 10","command.showEmmetCommands":"Show Emmet Commands",emmetSyntaxProfiles:"Define profile for specified syntax or use your own profile with specific rules.",emmetExclude:"An array of languages where Emmet abbreviations should not be expanded.",emmetExtensionsPath:`An array of paths, where each path can contain Emmet syntaxProfiles and/or snippet files.
In case of conflicts, the profiles/snippets of later paths will override those of earlier paths.
See https://code.visualstudio.com/docs/editor/emmet for more information and an example snippet file.`,emmetExtensionsPathItem:"A path containing Emmet syntaxProfiles and/or snippets.",emmetShowExpandedAbbreviation:'Shows expanded Emmet abbreviations as suggestions.\nThe option `"inMarkupAndStylesheetFilesOnly"` applies to html, haml, jade, slim, xml, xsl, css, scss, sass, less and stylus.\nThe option `"always"` applies to all parts of the file regardless of markup/css.',emmetShowAbbreviationSuggestions:'Shows possible Emmet abbreviations as suggestions. Not applicable in stylesheets or when emmet.showExpandedAbbreviation is set to `"never"`.',emmetIncludeLanguages:'Enable Emmet abbreviations in languages that are not supported by default. Add a mapping here between the language and Emmet supported language.\n For example: `{"vue-html": "html", "javascript": "javascriptreact"}`',emmetVariables:"Variables to be used in Emmet snippets.",emmetTriggerExpansionOnTab:"When enabled, Emmet abbreviations are expanded when pressing TAB, even when completions do not show up. When disabled, completions that show up can still be accepted by pressing TAB.",emmetPreferences:"Preferences used to modify behavior of some actions and resolvers of Emmet.",emmetPreferencesIntUnit:"Default unit for integer values.",emmetPreferencesFloatUnit:"Default unit for float values.",emmetPreferencesCssAfter:"Symbol to be placed at the end of CSS property when expanding CSS abbreviations.",emmetPreferencesSassAfter:"Symbol to be placed at the end of CSS property when expanding CSS abbreviations in Sass files.",emmetPreferencesStylusAfter:"Symbol to be placed at the end of CSS property when expanding CSS abbreviations in Stylus files.",emmetPreferencesCssBetween:"Symbol to be placed at the between CSS property and value when expanding CSS abbreviations.",emmetPreferencesSassBetween:"Symbol to be placed at the between CSS property and value when expanding CSS abbreviations in Sass files.",emmetPreferencesStylusBetween:"Symbol to be placed at the between CSS property and value when expanding CSS abbreviations in Stylus files.",emmetShowSuggestionsAsSnippets:"If `true`, then Emmet suggestions will show up as snippets allowing you to order them as per `#editor.snippetSuggestions#` setting.",emmetPreferencesBemElementSeparator:"Element separator used for classes when using the BEM filter.",emmetPreferencesBemModifierSeparator:"Modifier separator used for classes when using the BEM filter.",emmetPreferencesFilterCommentBefore:"A definition of comment that should be placed before matched element when comment filter is applied.",emmetPreferencesFilterCommentAfter:"A definition of comment that should be placed after matched element when comment filter is applied.",emmetPreferencesFilterCommentTrigger:"A comma-separated list of attribute names that should exist in the abbreviation for the comment filter to be applied.",emmetPreferencesFormatNoIndentTags:"An array of tag names that should never get inner indentation.",emmetPreferencesFormatForceIndentTags:"An array of tag names that should always get inner indentation.",emmetPreferencesAllowCompactBoolean:"If `true`, compact notation of boolean attributes are produced.",emmetPreferencesCssWebkitProperties:"Comma separated CSS properties that get the 'webkit' vendor prefix when used in Emmet abbreviation that starts with `-`. Set to empty string to always avoid the 'webkit' prefix.",emmetPreferencesCssMozProperties:"Comma separated CSS properties that get the 'moz' vendor prefix when used in Emmet abbreviation that starts with `-`. Set to empty string to always avoid the 'moz' prefix.",emmetPreferencesCssOProperties:"Comma separated CSS properties that get the 'o' vendor prefix when used in Emmet abbreviation that starts with `-`. Set to empty string to always avoid the 'o' prefix.",emmetPreferencesCssMsProperties:"Comma separated CSS properties that get the 'ms' vendor prefix when used in Emmet abbreviation that starts with `-`. Set to empty string to always avoid the 'ms' prefix.",emmetPreferencesCssFuzzySearchMinScore:"The minimum score (from 0 to 1) that fuzzy-matched abbreviation should achieve. Lower values may produce many false-positive matches, higher values may reduce possible matches.",emmetOptimizeStylesheetParsing:"When set to `false`, the whole file is parsed to determine if current position is valid for expanding Emmet abbreviations. When set to `true`, only the content around the current position in CSS/SCSS/Less files is parsed.",emmetPreferencesOutputInlineBreak:"The number of sibling inline elements needed for line breaks to be placed between those elements. If `0`, inline elements are always expanded onto a single line.",emmetPreferencesOutputReverseAttributes:"If `true`, reverses attribute merging directions when resolving snippets.",emmetPreferencesOutputSelfClosingStyle:"Style of self-closing tags: html (`<br>`), xml (`<br/>`) or xhtml (`<br />`).",emmetPreferencesCssColorShort:"If `true`, color values like `#f` will be expanded to `#fff` instead of `#ffffff`.",emmetUseInlineCompletions:"If `true`, Emmet will use inline completions to suggest expansions. To prevent the non-inline completion item provider from showing up as often while this setting is `true`, turn `#editor.quickSuggestions#` to `inline` or `off` for the `other` item."},readmePath:"emmet\\README.md"},{extensionPath:"extension-editing",packageJSON:{name:"extension-editing",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"^1.4.0"},icon:"images/icon.png",activationEvents:["onLanguage:json","onLanguage:markdown"],main:"./dist/extensionEditingMain",browser:"./dist/browser/extensionEditingBrowserMain",capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},contributes:{jsonValidation:[{fileMatch:"package.json",url:"vscode://schemas/vscode-extensions"},{fileMatch:"*language-configuration.json",url:"vscode://schemas/language-configuration"},{fileMatch:["*icon-theme.json","!*product-icon-theme.json"],url:"vscode://schemas/icon-theme"},{fileMatch:"*product-icon-theme.json",url:"vscode://schemas/product-icon-theme"},{fileMatch:"*color-theme.json",url:"vscode://schemas/color-theme"}],languages:[{id:"ignore",filenames:[".vscodeignore"]}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Extension Authoring",description:"Provides linting capabilities for authoring extensions."}},{extensionPath:"fsharp",packageJSON:{name:"fsharp",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin ionide/ionide-fsgrammar grammars/fsharp.json ./syntaxes/fsharp.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"fsharp",extensions:[".fs",".fsi",".fsx",".fsscript"],aliases:["F#","FSharp","fsharp"],configuration:"./language-configuration.json"}],grammars:[{language:"fsharp",scopeName:"source.fsharp",path:"./syntaxes/fsharp.tmLanguage.json"}],snippets:[{language:"fsharp",path:"./snippets/fsharp.code-snippets"}],configurationDefaults:{"[fsharp]":{"diffEditor.ignoreTrimWhitespace":!1}}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"F# Language Basics",description:"Provides snippets, syntax highlighting, bracket matching and folding in F# files."}},{extensionPath:"git-base",packageJSON:{name:"git-base",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"0.10.x"},categories:["Other"],activationEvents:["*"],main:"./dist/extension.js",browser:"./dist/browser/extension.js",icon:"resources/icons/git.png",capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},contributes:{commands:[{command:"git-base.api.getRemoteSources",title:"%command.api.getRemoteSources%",category:"Git Base API"}],menus:{commandPalette:[{command:"git-base.api.getRemoteSources",when:"false"}]},languages:[{id:"git-commit",aliases:["Git Commit Message","git-commit"],filenames:["COMMIT_EDITMSG","MERGE_MSG"],configuration:"./languages/git-commit.language-configuration.json"},{id:"git-rebase",aliases:["Git Rebase Message","git-rebase"],filenames:["git-rebase-todo"],filenamePatterns:["**/rebase-merge/done"],configuration:"./languages/git-rebase.language-configuration.json"},{id:"ignore",aliases:["Ignore","ignore"],extensions:[".gitignore_global",".gitignore",".git-blame-ignore-revs"],configuration:"./languages/ignore.language-configuration.json"}],grammars:[{language:"git-commit",scopeName:"text.git-commit",path:"./syntaxes/git-commit.tmLanguage.json"},{language:"git-rebase",scopeName:"text.git-rebase",path:"./syntaxes/git-rebase.tmLanguage.json"},{language:"ignore",scopeName:"source.ignore",path:"./syntaxes/ignore.tmLanguage.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Git Base",description:"Git static contributions and pickers.","command.api.getRemoteSources":"Get Remote Sources"},readmePath:"git-base\\README.md"},{extensionPath:"github-authentication",packageJSON:{name:"github-authentication",displayName:"%displayName%",description:"%description%",publisher:"vscode",license:"MIT",version:"0.0.2",engines:{vscode:"^1.41.0"},icon:"images/icon.png",categories:["Other"],api:"none",extensionKind:["ui","workspace"],enabledApiProposals:["authIssuers","authProviderSpecific","agentSessionsWorkspace"],activationEvents:[],capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:"limited",restrictedConfigurations:["github-enterprise.uri"]}},contributes:{authentication:[{label:"GitHub",id:"github",authorizationServerGlobs:["https://github.com/login/oauth"]},{label:"GitHub Enterprise Server",id:"github-enterprise",authorizationServerGlobs:["*"]}],configuration:[{title:"%config.github-enterprise.title%",properties:{"github-enterprise.uri":{type:"string",markdownDescription:"%config.github-enterprise.uri.description%",pattern:"^(?:$|(https?)://(?!github\\.com).*)"},"github-authentication.useElectronFetch":{type:"boolean",default:!0,scope:"application",markdownDescription:"%config.github-authentication.useElectronFetch.description%"},"github-authentication.preferDeviceCodeFlow":{type:"boolean",default:!1,scope:"application",markdownDescription:"%config.github-authentication.preferDeviceCodeFlow.description%"}}}]},aiKey:"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",main:"./dist/extension.js",browser:"./dist/browser/extension.js",repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"GitHub Authentication",description:"GitHub Authentication Provider","config.github-enterprise.title":"GHE.com & GitHub Enterprise Server Authentication","config.github-enterprise.uri.description":`The URI for your GHE.com or GitHub Enterprise Server instance.
Examples:
* GHE.com: \`https://octocat.ghe.com\`
* GitHub Enterprise Server: \`https://github.octocat.com\`
> **Note:** This should _not_ be set to a GitHub.com URI. If your account exists on GitHub.com or is a GitHub Enterprise Managed User, you do not need any additional configuration and can simply log in to GitHub.`,"config.github-authentication.useElectronFetch.description":"When true, uses Electron's built-in fetch function for HTTP requests. When false, uses the Node.js global fetch function. This setting only applies when running in the Electron environment. **Note:** A restart is required for this setting to take effect.","config.github-authentication.preferDeviceCodeFlow.description":"When true, prioritize the device code flow for authentication instead of other available flows. This is useful for environments like WSL where the local server or URL handler flows may not work as expected."},readmePath:"github-authentication\\README.md"},{extensionPath:"go",packageJSON:{name:"go",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin worlpaker/go-syntax syntaxes/go.tmLanguage.json ./syntaxes/go.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"go",extensions:[".go"],aliases:["Go"],configuration:"./language-configuration.json"}],grammars:[{language:"go",scopeName:"source.go",path:"./syntaxes/go.tmLanguage.json"}],configurationDefaults:{"[go]":{"editor.insertSpaces":!1}}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Go Language Basics",description:"Provides syntax highlighting and bracket matching in Go files."}},{extensionPath:"groovy",packageJSON:{name:"groovy",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin textmate/groovy.tmbundle Syntaxes/Groovy.tmLanguage ./syntaxes/groovy.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"groovy",aliases:["Groovy","groovy"],extensions:[".groovy",".gvy",".gradle",".jenkinsfile",".nf"],filenames:["Jenkinsfile"],filenamePatterns:["Jenkinsfile*"],firstLine:"^#!.*\\bgroovy\\b",configuration:"./language-configuration.json"}],grammars:[{language:"groovy",scopeName:"source.groovy",path:"./syntaxes/groovy.tmLanguage.json"}],snippets:[{language:"groovy",path:"./snippets/groovy.code-snippets"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Groovy Language Basics",description:"Provides snippets, syntax highlighting and bracket matching in Groovy files."}},{extensionPath:"handlebars",packageJSON:{name:"handlebars",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"0.10.x"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin daaain/Handlebars grammars/Handlebars.json ./syntaxes/Handlebars.tmLanguage.json"},categories:["Programming Languages"],extensionKind:["ui","workspace"],contributes:{languages:[{id:"handlebars",extensions:[".handlebars",".hbs",".hjs"],aliases:["Handlebars","handlebars"],mimetypes:["text/x-handlebars-template"],configuration:"./language-configuration.json"}],grammars:[{language:"handlebars",scopeName:"text.html.handlebars",path:"./syntaxes/Handlebars.tmLanguage.json"}],htmlLanguageParticipants:[{languageId:"handlebars",autoInsert:!0}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Handlebars Language Basics",description:"Provides syntax highlighting and bracket matching in Handlebars files."}},{extensionPath:"hlsl",packageJSON:{name:"hlsl",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin tgjones/shaders-tmLanguage grammars/hlsl.json ./syntaxes/hlsl.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"hlsl",extensions:[".hlsl",".hlsli",".fx",".fxh",".vsh",".psh",".cginc",".compute"],aliases:["HLSL","hlsl"],configuration:"./language-configuration.json"}],grammars:[{language:"hlsl",path:"./syntaxes/hlsl.tmLanguage.json",scopeName:"source.hlsl"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"HLSL Language Basics",description:"Provides syntax highlighting and bracket matching in HLSL files."}},{extensionPath:"html",packageJSON:{name:"html",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"0.10.x"},scripts:{"update-grammar":"node ./build/update-grammar.mjs"},categories:["Programming Languages"],contributes:{languages:[{id:"html",extensions:[".html",".htm",".shtml",".xhtml",".xht",".mdoc",".jsp",".asp",".aspx",".jshtm",".volt",".ejs",".rhtml"],aliases:["HTML","htm","html","xhtml"],mimetypes:["text/html","text/x-jshtm","text/template","text/ng-template","application/xhtml+xml"],configuration:"./language-configuration.json"}],grammars:[{scopeName:"text.html.basic",path:"./syntaxes/html.tmLanguage.json",embeddedLanguages:{"text.html":"html","source.css":"css","source.js":"javascript","source.python":"python","source.smarty":"smarty"},tokenTypes:{"meta.tag string.quoted":"other"}},{language:"html",scopeName:"text.html.derivative",path:"./syntaxes/html-derivative.tmLanguage.json",embeddedLanguages:{"text.html":"html","source.css":"css","source.js":"javascript","source.python":"python","source.smarty":"smarty"},tokenTypes:{"meta.tag string.quoted":"other"}}],snippets:[{language:"html",path:"./snippets/html.code-snippets"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"HTML Language Basics",description:"Provides syntax highlighting, bracket matching & snippets in HTML files."}},{extensionPath:"html-language-features",packageJSON:{name:"html-language-features",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",aiKey:"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",engines:{vscode:"^1.77.0"},icon:"icons/html.png",activationEvents:["onLanguage:html","onLanguage:handlebars"],enabledApiProposals:["extensionsAny"],main:"./client/dist/node/htmlClientMain",browser:"./client/dist/browser/htmlClientMain",capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},categories:["Programming Languages"],contributes:{configuration:{id:"html",order:20,type:"object",title:"HTML",properties:{"html.completion.attributeDefaultValue":{type:"string",scope:"resource",enum:["doublequotes","singlequotes","empty"],enumDescriptions:["%html.completion.attributeDefaultValue.doublequotes%","%html.completion.attributeDefaultValue.singlequotes%","%html.completion.attributeDefaultValue.empty%"],default:"doublequotes",markdownDescription:"%html.completion.attributeDefaultValue%"},"html.customData":{type:"array",markdownDescription:"%html.customData.desc%",default:[],items:{type:"string"},scope:"resource"},"html.format.enable":{type:"boolean",scope:"window",default:!0,description:"%html.format.enable.desc%"},"html.format.wrapLineLength":{type:"integer",scope:"resource",default:120,description:"%html.format.wrapLineLength.desc%"},"html.format.unformatted":{type:["string","null"],scope:"resource",default:"wbr",markdownDescription:"%html.format.unformatted.desc%"},"html.format.contentUnformatted":{type:["string","null"],scope:"resource",default:"pre,code,textarea",markdownDescription:"%html.format.contentUnformatted.desc%"},"html.format.indentInnerHtml":{type:"boolean",scope:"resource",default:!1,markdownDescription:"%html.format.indentInnerHtml.desc%"},"html.format.preserveNewLines":{type:"boolean",scope:"resource",default:!0,description:"%html.format.preserveNewLines.desc%"},"html.format.maxPreserveNewLines":{type:["number","null"],scope:"resource",default:null,markdownDescription:"%html.format.maxPreserveNewLines.desc%"},"html.format.indentHandlebars":{type:"boolean",scope:"resource",default:!1,markdownDescription:"%html.format.indentHandlebars.desc%"},"html.format.extraLiners":{type:["string","null"],scope:"resource",default:"head, body, /html",markdownDescription:"%html.format.extraLiners.desc%"},"html.format.wrapAttributes":{type:"string",scope:"resource",default:"auto",enum:["auto","force","force-aligned","force-expand-multiline","aligned-multiple","preserve","preserve-aligned"],enumDescriptions:["%html.format.wrapAttributes.auto%","%html.format.wrapAttributes.force%","%html.format.wrapAttributes.forcealign%","%html.format.wrapAttributes.forcemultiline%","%html.format.wrapAttributes.alignedmultiple%","%html.format.wrapAttributes.preserve%","%html.format.wrapAttributes.preservealigned%"],description:"%html.format.wrapAttributes.desc%"},"html.format.wrapAttributesIndentSize":{type:["number","null"],scope:"resource",default:null,markdownDescription:"%html.format.wrapAttributesIndentSize.desc%"},"html.format.templating":{type:"boolean",scope:"resource",default:!1,description:"%html.format.templating.desc%"},"html.format.unformattedContentDelimiter":{type:"string",scope:"resource",default:"",markdownDescription:"%html.format.unformattedContentDelimiter.desc%"},"html.suggest.html5":{type:"boolean",scope:"resource",default:!0,description:"%html.suggest.html5.desc%"},"html.suggest.hideEndTagSuggestions":{type:"boolean",scope:"resource",default:!1,description:"%html.suggest.hideEndTagSuggestions.desc%"},"html.validate.scripts":{type:"boolean",scope:"resource",default:!0,description:"%html.validate.scripts%"},"html.validate.styles":{type:"boolean",scope:"resource",default:!0,description:"%html.validate.styles%"},"html.autoCreateQuotes":{type:"boolean",scope:"resource",default:!0,markdownDescription:"%html.autoCreateQuotes%"},"html.autoClosingTags":{type:"boolean",scope:"resource",default:!0,description:"%html.autoClosingTags%"},"html.hover.documentation":{type:"boolean",scope:"resource",default:!0,description:"%html.hover.documentation%"},"html.hover.references":{type:"boolean",scope:"resource",default:!0,description:"%html.hover.references%"},"html.mirrorCursorOnMatchingTag":{type:"boolean",scope:"resource",default:!1,description:"%html.mirrorCursorOnMatchingTag%",deprecationMessage:"%html.mirrorCursorOnMatchingTagDeprecationMessage%"},"html.trace.server":{type:"string",scope:"window",enum:["off","messages","verbose"],default:"off",description:"%html.trace.server.desc%"}}},configurationDefaults:{"[html]":{"editor.suggest.insertMode":"replace"},"[handlebars]":{"editor.suggest.insertMode":"replace"}},jsonValidation:[{fileMatch:"*.html-data.json",url:"https://raw.githubusercontent.com/microsoft/vscode-html-languageservice/master/docs/customData.schema.json"},{fileMatch:"package.json",url:"./schemas/package.schema.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"HTML Language Features",description:"Provides rich language support for HTML and Handlebar files","html.customData.desc":`A list of relative file paths pointing to JSON files following the [custom data format](https://github.com/microsoft/vscode-html-languageservice/blob/master/docs/customData.md).
VS Code loads custom data on startup to enhance its HTML support for the custom HTML tags, attributes and attribute values you specify in the JSON files.
The file paths are relative to workspace and only workspace folder settings are considered.`,"html.format.enable.desc":"Enable/disable default HTML formatter.","html.format.wrapLineLength.desc":"Maximum amount of characters per line (0 = disable).","html.format.unformatted.desc":"List of tags, comma separated, that shouldn't be reformatted. `null` defaults to all tags listed at https://www.w3.org/TR/html5/dom.html#phrasing-content.","html.format.contentUnformatted.desc":"List of tags, comma separated, where the content shouldn't be reformatted. `null` defaults to the `pre` tag.","html.format.indentInnerHtml.desc":"Indent `<head>` and `<body>` sections.","html.format.preserveNewLines.desc":"Controls whether existing line breaks before elements should be preserved. Only works before elements, not inside tags or for text.","html.format.maxPreserveNewLines.desc":"Maximum number of line breaks to be preserved in one chunk. Use `null` for unlimited.","html.format.indentHandlebars.desc":"Format and indent `{{#foo}}` and `{{/foo}}`.","html.format.extraLiners.desc":'List of tags, comma separated, that should have an extra newline before them. `null` defaults to `"head, body, /html"`.',"html.format.wrapAttributes.desc":"Wrap attributes.","html.format.wrapAttributes.auto":"Wrap attributes only when line length is exceeded.","html.format.wrapAttributes.force":"Wrap each attribute except first.","html.format.wrapAttributes.forcealign":"Wrap each attribute except first and keep aligned.","html.format.wrapAttributes.forcemultiline":"Wrap each attribute.","html.format.wrapAttributes.alignedmultiple":"Wrap when line length is exceeded, align attributes vertically.","html.format.wrapAttributes.preserve":"Preserve wrapping of attributes.","html.format.wrapAttributes.preservealigned":"Preserve wrapping of attributes but align.","html.format.templating.desc":"Honor django, erb, handlebars and php templating language tags.","html.format.unformattedContentDelimiter.desc":"Keep text content together between this string.","html.format.wrapAttributesIndentSize.desc":"Indent wrapped attributes to after N characters. Use `null` to use the default indent size. Ignored if `#html.format.wrapAttributes#` is set to `aligned`.","html.suggest.html5.desc":"Controls whether the built-in HTML language support suggests HTML5 tags, properties and values.","html.suggest.hideEndTagSuggestions.desc":"Controls whether the built-in HTML language support suggests closing tags. When disabled, end tag completions like `</div>` will not be shown.","html.trace.server.desc":"Traces the communication between VS Code and the HTML language server.","html.validate.scripts":"Controls whether the built-in HTML language support validates embedded scripts.","html.validate.styles":"Controls whether the built-in HTML language support validates embedded styles.","html.autoCreateQuotes":"Enable/disable auto creation of quotes for HTML attribute assignment. The type of quotes can be configured by `#html.completion.attributeDefaultValue#`.","html.autoClosingTags":"Enable/disable autoclosing of HTML tags.","html.completion.attributeDefaultValue":"Controls the default value for attributes when completion is accepted.","html.completion.attributeDefaultValue.doublequotes":'Attribute value is set to "".',"html.completion.attributeDefaultValue.singlequotes":"Attribute value is set to ''.","html.completion.attributeDefaultValue.empty":"Attribute value is not set.","html.mirrorCursorOnMatchingTag":"Enable/disable mirroring cursor on matching HTML tag.","html.mirrorCursorOnMatchingTagDeprecationMessage":"Deprecated in favor of `editor.linkedEditing`","html.hover.documentation":"Show tag and attribute documentation in hover.","html.hover.references":"Show references to MDN in hover."},readmePath:"html-language-features\\README.md"},{extensionPath:"ini",packageJSON:{name:"ini",displayName:"%displayName%",description:"%description%",version:"10.0.0",private:!0,publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin textmate/ini.tmbundle Syntaxes/Ini.plist ./syntaxes/ini.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"ini",extensions:[".ini"],aliases:["Ini","ini"],configuration:"./ini.language-configuration.json"},{id:"properties",extensions:[".conf",".properties",".cfg",".directory",".gitattributes",".gitconfig",".gitmodules",".editorconfig",".repo"],filenames:["gitconfig"],filenamePatterns:["**/.config/git/config","**/.git/config"],aliases:["Properties","properties"],configuration:"./properties.language-configuration.json"}],grammars:[{language:"ini",scopeName:"source.ini",path:"./syntaxes/ini.tmLanguage.json"},{language:"properties",scopeName:"source.ini",path:"./syntaxes/ini.tmLanguage.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Ini Language Basics",description:"Provides syntax highlighting and bracket matching in Ini files."}},{extensionPath:"ipynb",packageJSON:{name:"ipynb",displayName:"%displayName%",description:"%description%",publisher:"vscode",version:"10.0.0",license:"MIT",icon:"media/icon.png",engines:{vscode:"^1.57.0"},enabledApiProposals:["diffContentOptions"],activationEvents:["onNotebook:jupyter-notebook","onNotebookSerializer:interactive","onNotebookSerializer:repl"],extensionKind:["workspace","ui"],main:"./dist/ipynbMain.node.js",browser:"./dist/browser/ipynbMain.browser.js",capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},contributes:{configuration:[{properties:{"ipynb.pasteImagesAsAttachments.enabled":{type:"boolean",scope:"resource",markdownDescription:"%ipynb.pasteImagesAsAttachments.enabled%",default:!0},"ipynb.experimental.serialization":{type:"boolean",scope:"resource",markdownDescription:"%ipynb.experimental.serialization%",default:!0,tags:["experimental"]}}}],commands:[{command:"ipynb.newUntitledIpynb",title:"%newUntitledIpynb.title%",shortTitle:"%newUntitledIpynb.shortTitle%",category:"Create"},{command:"ipynb.openIpynbInNotebookEditor",title:"%openIpynbInNotebookEditor.title%"},{command:"ipynb.cleanInvalidImageAttachment",title:"%cleanInvalidImageAttachment.title%"},{command:"notebook.cellOutput.copy",title:"%copyCellOutput.title%",category:"Notebook"},{command:"notebook.cellOutput.addToChat",title:"%addCellOutputToChat.title%",category:"Notebook",enablement:"chatIsEnabled"},{command:"notebook.cellOutput.openInTextEditor",title:"%openCellOutput.title%",category:"Notebook"}],notebooks:[{type:"jupyter-notebook",displayName:"Jupyter Notebook",selector:[{filenamePattern:"*.ipynb"}],priority:"default"}],notebookRenderer:[{id:"vscode.markdown-it-cell-attachment-renderer",displayName:"%markdownAttachmentRenderer.displayName%",entrypoint:{extends:"vscode.markdown-it-renderer",path:"./notebook-out/cellAttachmentRenderer.js"}}],menus:{"file/newFile":[{command:"ipynb.newUntitledIpynb",group:"notebook"}],commandPalette:[{command:"ipynb.newUntitledIpynb"},{command:"ipynb.openIpynbInNotebookEditor",when:"false"},{command:"ipynb.cleanInvalidImageAttachment",when:"false"},{command:"notebook.cellOutput.copy",when:"notebookCellHasOutputs"},{command:"notebook.cellOutput.openInTextEditor",when:"false"}],"webview/context":[{command:"notebook.cellOutput.copy",when:"webviewId == 'notebook.output' && webviewSection == 'image'",group:"context@1"},{command:"notebook.cellOutput.copy",when:"webviewId == 'notebook.output' && webviewSection == 'text'"},{command:"notebook.cellOutput.addToChat",when:"webviewId == 'notebook.output' && (webviewSection == 'text' || webviewSection == 'image')",group:"context@2"},{command:"notebook.cellOutput.openInTextEditor",when:"webviewId == 'notebook.output' && webviewSection == 'text'"}]}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:".ipynb Support",description:"Provides basic support for opening and reading Jupyter's .ipynb notebook files","ipynb.pasteImagesAsAttachments.enabled":"Enable/disable pasting of images into Markdown cells in ipynb notebook files. Pasted images are inserted as attachments to the cell.","ipynb.experimental.serialization":"Experimental feature to serialize the Jupyter notebook in a worker thread.","newUntitledIpynb.title":"New Jupyter Notebook","newUntitledIpynb.shortTitle":"Jupyter Notebook","openIpynbInNotebookEditor.title":"Open IPYNB File In Notebook Editor","cleanInvalidImageAttachment.title":"Clean Invalid Image Attachment Reference","copyCellOutput.title":"Copy Cell Output","addCellOutputToChat.title":"Add Cell Output to Chat","openCellOutput.title":"Open Cell Output in Text Editor","markdownAttachmentRenderer.displayName":{message:"Markdown-It ipynb Cell Attachment renderer",comment:["Markdown-It is a product name and should not be translated"]}},readmePath:"ipynb\\README.md"},{extensionPath:"java",packageJSON:{name:"java",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin redhat-developer/vscode-java language-support/java/java.tmLanguage.json ./syntaxes/java.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"java",extensions:[".java",".jav"],aliases:["Java","java"],configuration:"./language-configuration.json"}],grammars:[{language:"java",scopeName:"source.java",path:"./syntaxes/java.tmLanguage.json"}],snippets:[{language:"java",path:"./snippets/java.code-snippets"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Java Language Basics",description:"Provides snippets, syntax highlighting, bracket matching and folding in Java files."}},{extensionPath:"javascript",packageJSON:{name:"javascript",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"0.10.x"},categories:["Programming Languages"],contributes:{configurationDefaults:{"[javascript]":{"editor.maxTokenizationLineLength":2500}},languages:[{id:"javascriptreact",aliases:["JavaScript JSX","JavaScript React","jsx"],extensions:[".jsx"],configuration:"./javascript-language-configuration.json"},{id:"javascript",aliases:["JavaScript","javascript","js"],extensions:[".js",".es6",".mjs",".cjs",".pac"],filenames:["jakefile"],firstLine:"^#!.*\\bnode",mimetypes:["text/javascript"],configuration:"./javascript-language-configuration.json"},{id:"jsx-tags",aliases:[],configuration:"./tags-language-configuration.json"}],grammars:[{language:"javascriptreact",scopeName:"source.js.jsx",path:"./syntaxes/JavaScriptReact.tmLanguage.json",embeddedLanguages:{"meta.tag.js":"jsx-tags","meta.tag.without-attributes.js":"jsx-tags","meta.tag.attributes.js.jsx":"javascriptreact","meta.embedded.expression.js":"javascriptreact"},tokenTypes:{"punctuation.definition.template-expression":"other","entity.name.type.instance.jsdoc":"other","entity.name.function.tagged-template":"other","meta.import string.quoted":"other","variable.other.jsdoc":"other"}},{language:"javascript",scopeName:"source.js",path:"./syntaxes/JavaScript.tmLanguage.json",embeddedLanguages:{"meta.tag.js":"jsx-tags","meta.tag.without-attributes.js":"jsx-tags","meta.tag.attributes.js":"javascript","meta.embedded.expression.js":"javascript"},tokenTypes:{"punctuation.definition.template-expression":"other","entity.name.type.instance.jsdoc":"other","entity.name.function.tagged-template":"other","meta.import string.quoted":"other","variable.other.jsdoc":"other"}},{scopeName:"source.js.regexp",path:"./syntaxes/Regular Expressions (JavaScript).tmLanguage"}],semanticTokenScopes:[{language:"javascript",scopes:{property:["variable.other.property.js"],"property.readonly":["variable.other.constant.property.js"],variable:["variable.other.readwrite.js"],"variable.readonly":["variable.other.constant.object.js"],function:["entity.name.function.js"],namespace:["entity.name.type.module.js"],"variable.defaultLibrary":["support.variable.js"],"function.defaultLibrary":["support.function.js"]}},{language:"javascriptreact",scopes:{property:["variable.other.property.jsx"],"property.readonly":["variable.other.constant.property.jsx"],variable:["variable.other.readwrite.jsx"],"variable.readonly":["variable.other.constant.object.jsx"],function:["entity.name.function.jsx"],namespace:["entity.name.type.module.jsx"],"variable.defaultLibrary":["support.variable.js"],"function.defaultLibrary":["support.function.js"]}}],snippets:[{language:"javascript",path:"./snippets/javascript.code-snippets"},{language:"javascriptreact",path:"./snippets/javascript.code-snippets"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"JavaScript Language Basics",description:"Provides snippets, syntax highlighting, bracket matching and folding in JavaScript files."}},{extensionPath:"json",packageJSON:{name:"json",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"0.10.x"},scripts:{"update-grammar":"node ./build/update-grammars.js"},categories:["Programming Languages"],contributes:{languages:[{id:"json",aliases:["JSON","json"],extensions:[".json",".bowerrc",".jscsrc",".webmanifest",".js.map",".css.map",".ts.map",".har",".jslintrc",".jsonld",".geojson",".ipynb",".vuerc"],filenames:["composer.lock",".watchmanconfig"],mimetypes:["application/json","application/manifest+json"],configuration:"./language-configuration.json"},{id:"jsonc",aliases:["JSON with Comments"],extensions:[".jsonc",".eslintrc",".eslintrc.json",".jsfmtrc",".jshintrc",".swcrc",".hintrc",".babelrc",".toolset.jsonc"],filenames:["babel.config.json","bun.lock",".babelrc.json",".ember-cli","typedoc.json"],filenamePatterns:["**/.github/hooks/*.json"],configuration:"./language-configuration.json"},{id:"jsonl",aliases:["JSON Lines"],extensions:[".jsonl",".ndjson"],filenames:[],configuration:"./language-configuration.json"},{id:"snippets",aliases:["Code Snippets"],extensions:[".code-snippets"],filenamePatterns:["**/User/snippets/*.json","**/User/profiles/*/snippets/*.json","**/snippets*.json"],configuration:"./language-configuration.json"}],grammars:[{language:"json",scopeName:"source.json",path:"./syntaxes/JSON.tmLanguage.json"},{language:"jsonc",scopeName:"source.json.comments",path:"./syntaxes/JSONC.tmLanguage.json"},{language:"jsonl",scopeName:"source.json.lines",path:"./syntaxes/JSONL.tmLanguage.json"},{language:"snippets",scopeName:"source.json.comments.snippets",path:"./syntaxes/snippets.tmLanguage.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"JSON Language Basics",description:"Provides syntax highlighting & bracket matching in JSON files."}},{extensionPath:"json-language-features",packageJSON:{name:"json-language-features",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",aiKey:"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",engines:{vscode:"^1.77.0"},enabledApiProposals:["extensionsAny"],icon:"icons/json.png",activationEvents:["onLanguage:json","onLanguage:jsonc","onLanguage:snippets","onCommand:json.validate"],main:"./client/dist/node/jsonClientMain",browser:"./client/dist/browser/jsonClientMain",capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:"limited",description:"%json.workspaceTrust%"}},categories:["Programming Languages"],contributes:{configuration:{id:"json",order:20,type:"object",title:"JSON",properties:{"json.schemas":{type:"array",scope:"resource",description:"%json.schemas.desc%",items:{type:"object",default:{fileMatch:["/myfile"],url:"schemaURL"},properties:{url:{type:"string",default:"/user.schema.json",description:"%json.schemas.url.desc%"},fileMatch:{type:"array",items:{type:"string",default:"MyFile.json",description:"%json.schemas.fileMatch.item.desc%"},minItems:1,description:"%json.schemas.fileMatch.desc%"},schema:{$ref:"http://json-schema.org/draft-07/schema#",description:"%json.schemas.schema.desc%"}}}},"json.validate.enable":{type:"boolean",scope:"window",default:!0,description:"%json.validate.enable.desc%"},"json.format.enable":{type:"boolean",scope:"window",default:!0,description:"%json.format.enable.desc%"},"json.format.keepLines":{type:"boolean",scope:"window",default:!1,description:"%json.format.keepLines.desc%"},"json.trace.server":{type:"string",scope:"window",enum:["off","messages","verbose"],default:"off",description:"%json.tracing.desc%"},"json.colorDecorators.enable":{type:"boolean",scope:"window",default:!0,description:"%json.colorDecorators.enable.desc%",deprecationMessage:"%json.colorDecorators.enable.deprecationMessage%"},"json.maxItemsComputed":{type:"number",default:5e3,description:"%json.maxItemsComputed.desc%"},"json.schemaDownload.enable":{type:"boolean",default:!0,description:"%json.enableSchemaDownload.desc%",tags:["usesOnlineServices"]},"json.schemaDownload.trustedDomains":{type:"object",default:{"https://schemastore.azurewebsites.net/":!0,"https://raw.githubusercontent.com/microsoft/vscode/":!0,"https://raw.githubusercontent.com/devcontainers/spec/":!0,"https://www.schemastore.org/":!0,"https://json.schemastore.org/":!0,"https://json-schema.org/":!0,"https://developer.microsoft.com/json-schemas/":!0},additionalProperties:{type:"boolean"},description:"%json.schemaDownload.trustedDomains.desc%",tags:["usesOnlineServices"]}}},configurationDefaults:{"[json]":{"editor.quickSuggestions":{strings:!0},"editor.suggest.insertMode":"replace"},"[jsonc]":{"editor.quickSuggestions":{strings:!0},"editor.suggest.insertMode":"replace"},"[snippets]":{"editor.quickSuggestions":{strings:!0},"editor.suggest.insertMode":"replace"}},jsonValidation:[{fileMatch:"*.schema.json",url:"http://json-schema.org/draft-07/schema#"}],commands:[{command:"json.clearCache",title:"%json.command.clearCache%",category:"JSON"},{command:"json.sort",title:"%json.command.sort%",category:"JSON"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"JSON Language Features",description:"Provides rich language support for JSON files.","json.schemas.desc":"Associate schemas to JSON files in the current project.","json.schemas.url.desc":"A URL or absolute file path to a schema. Can be a relative path (starting with './') in workspace and workspace folder settings.","json.schemas.fileMatch.desc":"An array of file patterns to match against when resolving JSON files to schemas. `*` and '**' can be used as a wildcard. Exclusion patterns can also be defined and start with '!'. A file matches when there is at least one matching pattern and the last matching pattern is not an exclusion pattern.","json.schemas.fileMatch.item.desc":"A file pattern that can contain '*' and '**' to match against when resolving JSON files to schemas. When beginning with '!', it defines an exclusion pattern.","json.schemas.schema.desc":"The schema definition for the given URL. The schema only needs to be provided to avoid accesses to the schema URL.","json.format.enable.desc":"Enable/disable default JSON formatter","json.format.keepLines.desc":"Keep all existing new lines when formatting.","json.validate.enable.desc":"Enable/disable JSON validation.","json.tracing.desc":"Traces the communication between VS Code and the JSON language server.","json.colorDecorators.enable.desc":"Enables or disables color decorators","json.colorDecorators.enable.deprecationMessage":"The setting `json.colorDecorators.enable` has been deprecated in favor of `editor.colorDecorators`.","json.schemaResolutionErrorMessage":"Unable to resolve schema.","json.clickToRetry":"Click to retry.","json.maxItemsComputed.desc":"The maximum number of outline symbols and folding regions computed (limited for performance reasons).","json.maxItemsExceededInformation.desc":"Show notification when exceeding the maximum number of outline symbols and folding regions.","json.enableSchemaDownload.desc":"When enabled, JSON schemas can be fetched from http and https locations.","json.command.clearCache":"Clear Schema Cache","json.command.sort":"Sort Document","json.workspaceTrust":"The extension requires workspace trust to load schemas from http and https.","json.schemaDownload.trustedDomains.desc":"List of trusted domains for downloading JSON schemas over http(s). Use '*' to trust all domains. '*' can also be used as a wildcard in domain names."},readmePath:"json-language-features\\README.md"},{extensionPath:"julia",packageJSON:{name:"julia",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"0.10.x"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin JuliaEditorSupport/atom-language-julia variants/julia_vscode.json ./syntaxes/julia.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"julia",aliases:["Julia","julia"],extensions:[".jl"],firstLine:"^#!\\s*/.*\\bjulia[0-9.-]*\\b",configuration:"./language-configuration.json"},{id:"juliamarkdown",aliases:["Julia Markdown","juliamarkdown"],extensions:[".jmd"]}],grammars:[{language:"julia",scopeName:"source.julia",path:"./syntaxes/julia.tmLanguage.json",embeddedLanguages:{"meta.embedded.inline.cpp":"cpp","meta.embedded.inline.javascript":"javascript","meta.embedded.inline.python":"python","meta.embedded.inline.r":"r","meta.embedded.inline.sql":"sql"}}],configurationDefaults:{"[julia]":{"editor.defaultColorDecorators":"never"}}}},packageNLS:{displayName:"Julia Language Basics",description:"Provides syntax highlighting & bracket matching in Julia files."}},{extensionPath:"latex",packageJSON:{name:"latex",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ./build/update-grammars.js"},categories:["Programming Languages"],contributes:{languages:[{id:"tex",aliases:["TeX","tex"],extensions:[".sty",".cls",".bbx",".cbx"],configuration:"latex-language-configuration.json"},{id:"latex",aliases:["LaTeX","latex"],extensions:[".tex",".ltx",".ctx"],configuration:"latex-language-configuration.json"},{id:"bibtex",aliases:["BibTeX","bibtex"],extensions:[".bib"]},{id:"cpp_embedded_latex",configuration:"latex-cpp-embedded-language-configuration.json",aliases:[]},{id:"markdown_latex_combined",configuration:"markdown-latex-combined-language-configuration.json",aliases:[]}],grammars:[{language:"tex",scopeName:"text.tex",path:"./syntaxes/TeX.tmLanguage.json",unbalancedBracketScopes:["keyword.control.ifnextchar.tex","punctuation.math.operator.tex"]},{language:"latex",scopeName:"text.tex.latex",path:"./syntaxes/LaTeX.tmLanguage.json",unbalancedBracketScopes:["keyword.control.ifnextchar.tex","punctuation.math.operator.tex"],embeddedLanguages:{"source.cpp":"cpp_embedded_latex","source.css":"css","text.html":"html","source.java":"java","source.js":"javascript","source.julia":"julia","source.lua":"lua","source.python":"python","source.ruby":"ruby","source.ts":"typescript","text.xml":"xml","source.yaml":"yaml","meta.embedded.markdown_latex_combined":"markdown_latex_combined"}},{language:"bibtex",scopeName:"text.bibtex",path:"./syntaxes/Bibtex.tmLanguage.json"},{language:"markdown_latex_combined",scopeName:"text.tex.markdown_latex_combined",path:"./syntaxes/markdown-latex-combined.tmLanguage.json"},{language:"cpp_embedded_latex",scopeName:"source.cpp.embedded.latex",path:"./syntaxes/cpp-grammar-bailout.tmLanguage.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"LaTeX Language Basics",description:"Provides syntax highlighting and bracket matching for TeX, LaTeX and BibTeX."}},{extensionPath:"less",packageJSON:{name:"less",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ./build/update-grammar.js"},categories:["Programming Languages"],contributes:{languages:[{id:"less",aliases:["Less","less"],extensions:[".less"],mimetypes:["text/x-less","text/less"],configuration:"./language-configuration.json"}],grammars:[{language:"less",scopeName:"source.css.less",path:"./syntaxes/less.tmLanguage.json"}],problemMatchers:[{name:"lessc",label:"Lessc compiler",owner:"lessc",source:"less",fileLocation:"absolute",pattern:{regexp:"(.*)\\sin\\s(.*)\\son line\\s(\\d+),\\scolumn\\s(\\d+)",message:1,file:2,line:3,column:4}}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Less Language Basics",description:"Provides syntax highlighting, bracket matching and folding in Less files."}},{extensionPath:"log",packageJSON:{name:"log",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin emilast/vscode-logfile-highlighter syntaxes/log.tmLanguage ./syntaxes/log.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"log",extensions:[".log","*.log.?"],aliases:["Log"]}],grammars:[{language:"log",scopeName:"text.log",path:"./syntaxes/log.tmLanguage.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Log",description:"Provides syntax highlighting for files with .log extension."}},{extensionPath:"lua",packageJSON:{name:"lua",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin sumneko/lua.tmbundle Syntaxes/Lua.plist ./syntaxes/lua.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"lua",extensions:[".lua"],aliases:["Lua","lua"],configuration:"./language-configuration.json"}],grammars:[{language:"lua",scopeName:"source.lua",path:"./syntaxes/lua.tmLanguage.json",tokenTypes:{"comment.line.double-dash.doc.lua":"other"}}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Lua Language Basics",description:"Provides syntax highlighting and bracket matching in Lua files."}},{extensionPath:"make",packageJSON:{name:"make",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin fadeevab/make.tmbundle Syntaxes/Makefile.plist ./syntaxes/make.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"makefile",aliases:["Makefile","makefile"],extensions:[".mak",".mk"],filenames:["Makefile","makefile","GNUmakefile","OCamlMakefile"],firstLine:"^#!\\s*/usr/bin/make",configuration:"./language-configuration.json"}],grammars:[{language:"makefile",scopeName:"source.makefile",path:"./syntaxes/make.tmLanguage.json",tokenTypes:{"string.interpolated":"other"}}],configurationDefaults:{"[makefile]":{"editor.insertSpaces":!1}}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Make Language Basics",description:"Provides syntax highlighting and bracket matching in Make files."}},{extensionPath:"markdown-basics",packageJSON:{name:"markdown",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"^1.20.0"},categories:["Programming Languages"],contributes:{languages:[{id:"markdown",aliases:["Markdown","markdown"],extensions:[".litcoffee",".md",".mkd",".mkdn",".mdwn",".mdown",".markdown",".markdn",".mdtxt",".mdtext",".ron",".ronn",".workbook"],filenamePatterns:["**/.cursor/**/*.mdc"],configuration:"./language-configuration.json"}],grammars:[{language:"markdown",scopeName:"text.html.markdown",path:"./syntaxes/markdown.tmLanguage.json",embeddedLanguages:{"meta.embedded.block.html":"html","source.js":"javascript","source.css":"css","meta.embedded.block.frontmatter":"yaml","meta.embedded.block.css":"css","meta.embedded.block.ini":"ini","meta.embedded.block.java":"java","meta.embedded.block.lua":"lua","meta.embedded.block.makefile":"makefile","meta.embedded.block.perl":"perl","meta.embedded.block.r":"r","meta.embedded.block.ruby":"ruby","meta.embedded.block.php":"php","meta.embedded.block.sql":"sql","meta.embedded.block.vs_net":"vs_net","meta.embedded.block.xml":"xml","meta.embedded.block.xsl":"xsl","meta.embedded.block.yaml":"yaml","meta.embedded.block.dosbatch":"dosbatch","meta.embedded.block.clojure":"clojure","meta.embedded.block.coffee":"coffee","meta.embedded.block.c":"c","meta.embedded.block.cpp":"cpp","meta.embedded.block.diff":"diff","meta.embedded.block.dockerfile":"dockerfile","meta.embedded.block.go":"go","meta.embedded.block.groovy":"groovy","meta.embedded.block.pug":"jade","meta.embedded.block.ignore":"ignore","meta.embedded.block.javascript":"javascript","meta.embedded.block.json":"json","meta.embedded.block.jsonc":"jsonc","meta.embedded.block.jsonl":"jsonl","meta.embedded.block.latex":"latex","meta.embedded.block.less":"less","meta.embedded.block.objc":"objc","meta.embedded.block.scss":"scss","meta.embedded.block.perl6":"perl6","meta.embedded.block.powershell":"powershell","meta.embedded.block.python":"python","meta.embedded.block.restructuredtext":"restructuredtext","meta.embedded.block.rust":"rust","meta.embedded.block.scala":"scala","meta.embedded.block.shellscript":"shellscript","meta.embedded.block.typescript":"typescript","meta.embedded.block.typescriptreact":"typescriptreact","meta.embedded.block.csharp":"csharp","meta.embedded.block.fsharp":"fsharp"},unbalancedBracketScopes:["markup.underline.link.markdown","punctuation.definition.list.begin.markdown"]}],snippets:[{language:"markdown",path:"./snippets/markdown.code-snippets"}],configurationDefaults:{"[markdown]":{"editor.unicodeHighlight.ambiguousCharacters":!1,"editor.unicodeHighlight.invisibleCharacters":!1,"diffEditor.ignoreTrimWhitespace":!1}}},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin microsoft/vscode-markdown-tm-grammar syntaxes/markdown.tmLanguage ./syntaxes/markdown.tmLanguage.json"},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Markdown Language Basics",description:"Provides snippets and syntax highlighting for Markdown."}},{extensionPath:"markdown-language-features",packageJSON:{name:"markdown-language-features",displayName:"%displayName%",description:"%description%",version:"10.0.0",icon:"icon.png",publisher:"vscode",license:"MIT",aiKey:"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",engines:{vscode:"^1.70.0"},main:"./dist/extension",browser:"./dist/browser/extension",categories:["Programming Languages"],activationEvents:["onLanguage:markdown","onLanguage:prompt","onLanguage:instructions","onLanguage:chatagent","onLanguage:skill","onCommand:markdown.api.render","onCommand:markdown.api.reloadPlugins","onWebviewPanel:markdown.preview"],capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:"limited",description:"%workspaceTrust%",restrictedConfigurations:["markdown.styles"]}},contributes:{notebookRenderer:[{id:"vscode.markdown-it-renderer",displayName:"Markdown it renderer",entrypoint:"./notebook-out/index.js",mimeTypes:["text/markdown","text/latex","text/x-css","text/x-html","text/x-json","text/x-typescript","text/x-abap","text/x-apex","text/x-azcli","text/x-bat","text/x-cameligo","text/x-clojure","text/x-coffee","text/x-cpp","text/x-csharp","text/x-csp","text/x-css","text/x-dart","text/x-dockerfile","text/x-ecl","text/x-fsharp","text/x-go","text/x-graphql","text/x-handlebars","text/x-hcl","text/x-html","text/x-ini","text/x-java","text/x-javascript","text/x-julia","text/x-kotlin","text/x-less","text/x-lexon","text/x-lua","text/x-m3","text/x-markdown","text/x-mips","text/x-msdax","text/x-mysql","text/x-objective-c/objective","text/x-pascal","text/x-pascaligo","text/x-perl","text/x-pgsql","text/x-php","text/x-postiats","text/x-powerquery","text/x-powershell","text/x-pug","text/x-python","text/x-r","text/x-razor","text/x-redis","text/x-redshift","text/x-restructuredtext","text/x-ruby","text/x-rust","text/x-sb","text/x-scala","text/x-scheme","text/x-scss","text/x-shell","text/x-solidity","text/x-sophia","text/x-sql","text/x-st","text/x-swift","text/x-systemverilog","text/x-tcl","text/x-twig","text/x-typescript","text/x-vb","text/x-xml","text/x-yaml","application/json"]}],commands:[{command:"_markdown.copyImage",title:"%markdown.copyImage.title%",category:"Markdown"},{command:"_markdown.openImage",title:"%markdown.openImage.title%",category:"Markdown"},{command:"markdown.showPreview",title:"%markdown.preview.title%",category:"Markdown",icon:{light:"./media/preview-light.svg",dark:"./media/preview-dark.svg"}},{command:"markdown.showPreviewToSide",title:"%markdown.previewSide.title%",category:"Markdown",icon:"$(open-preview)"},{command:"markdown.showLockedPreviewToSide",title:"%markdown.showLockedPreviewToSide.title%",category:"Markdown",icon:"$(open-preview)"},{command:"markdown.showSource",title:"%markdown.showSource.title%",category:"Markdown",icon:"$(go-to-file)"},{command:"markdown.showPreviewSecuritySelector",title:"%markdown.showPreviewSecuritySelector.title%",category:"Markdown"},{command:"markdown.preview.refresh",title:"%markdown.preview.refresh.title%",category:"Markdown"},{command:"markdown.preview.toggleLock",title:"%markdown.preview.toggleLock.title%",category:"Markdown"},{command:"markdown.findAllFileReferences",title:"%markdown.findAllFileReferences%",category:"Markdown"},{command:"markdown.editor.insertLinkFromWorkspace",title:"%markdown.editor.insertLinkFromWorkspace%",category:"Markdown",enablement:"editorLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !activeEditorIsReadonly"},{command:"markdown.editor.insertImageFromWorkspace",title:"%markdown.editor.insertImageFromWorkspace%",category:"Markdown",enablement:"editorLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !activeEditorIsReadonly"}],menus:{"webview/context":[{command:"_markdown.copyImage",when:"webviewId == 'markdown.preview' && (webviewSection == 'image' || webviewSection == 'localImage')"},{command:"_markdown.openImage",when:"webviewId == 'markdown.preview' && webviewSection == 'localImage'"}],"editor/title":[{command:"markdown.showPreviewToSide",when:"editorLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !notebookEditorFocused && !hasCustomMarkdownPreview",alt:"markdown.showPreview",group:"navigation"},{command:"markdown.showSource",when:"activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",group:"navigation"},{command:"markdown.preview.refresh",when:"activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",group:"1_markdown"},{command:"markdown.preview.toggleLock",when:"activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",group:"1_markdown"},{command:"markdown.showPreviewSecuritySelector",when:"activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",group:"1_markdown"}],"explorer/context":[{command:"markdown.showPreview",when:"resourceLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !hasCustomMarkdownPreview",group:"navigation"},{command:"markdown.findAllFileReferences",when:"resourceLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/",group:"4_search"}],"editor/title/context":[{command:"markdown.showPreview",when:"resourceLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !hasCustomMarkdownPreview",group:"1_open"},{command:"markdown.findAllFileReferences",when:"resourceLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/"}],commandPalette:[{command:"_markdown.openImage",when:"false"},{command:"_markdown.copyImage",when:"false"},{command:"markdown.showPreview",when:"editorLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !notebookEditorFocused",group:"navigation"},{command:"markdown.showPreviewToSide",when:"editorLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !notebookEditorFocused",group:"navigation"},{command:"markdown.showLockedPreviewToSide",when:"editorLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !notebookEditorFocused",group:"navigation"},{command:"markdown.showSource",when:"activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",group:"navigation"},{command:"markdown.showPreviewSecuritySelector",when:"editorLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !notebookEditorFocused"},{command:"markdown.showPreviewSecuritySelector",when:"activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'"},{command:"markdown.preview.toggleLock",when:"activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'"},{command:"markdown.preview.refresh",when:"editorLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !notebookEditorFocused"},{command:"markdown.preview.refresh",when:"activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'"},{command:"markdown.findAllFileReferences",when:"editorLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/"}]},keybindings:[{command:"markdown.showPreview",key:"shift+ctrl+v",mac:"shift+cmd+v",when:"editorLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !notebookEditorFocused"},{command:"markdown.showPreviewToSide",key:"ctrl+k v",mac:"cmd+k v",when:"editorLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !notebookEditorFocused"}],configuration:{type:"object",title:"Markdown",order:20,properties:{"markdown.styles":{type:"array",items:{type:"string"},default:[],description:"%markdown.styles.dec%",scope:"resource"},"markdown.preview.breaks":{type:"boolean",default:!1,markdownDescription:"%markdown.preview.breaks.desc%",scope:"resource"},"markdown.preview.linkify":{type:"boolean",default:!0,description:"%markdown.preview.linkify%",scope:"resource"},"markdown.preview.typographer":{type:"boolean",default:!1,description:"%markdown.preview.typographer%",scope:"resource"},"markdown.preview.fontFamily":{type:"string",default:"-apple-system, BlinkMacSystemFont, 'Segoe WPC', 'Segoe UI', system-ui, 'Ubuntu', 'Droid Sans', sans-serif",description:"%markdown.preview.fontFamily.desc%",scope:"resource"},"markdown.preview.fontSize":{type:"number",default:14,description:"%markdown.preview.fontSize.desc%",scope:"resource"},"markdown.preview.lineHeight":{type:"number",default:1.6,description:"%markdown.preview.lineHeight.desc%",scope:"resource"},"markdown.preview.scrollPreviewWithEditor":{type:"boolean",default:!0,description:"%markdown.preview.scrollPreviewWithEditor.desc%",scope:"resource"},"markdown.preview.markEditorSelection":{type:"boolean",default:!0,description:"%markdown.preview.markEditorSelection.desc%",scope:"resource"},"markdown.preview.scrollEditorWithPreview":{type:"boolean",default:!0,description:"%markdown.preview.scrollEditorWithPreview.desc%",scope:"resource"},"markdown.preview.doubleClickToSwitchToEditor":{type:"boolean",default:!0,description:"%markdown.preview.doubleClickToSwitchToEditor.desc%",scope:"resource"},"markdown.preview.openMarkdownLinks":{type:"string",default:"inPreview",description:"%configuration.markdown.preview.openMarkdownLinks.description%",scope:"resource",enum:["inPreview","inEditor"],enumDescriptions:["%configuration.markdown.preview.openMarkdownLinks.inPreview%","%configuration.markdown.preview.openMarkdownLinks.inEditor%"]},"markdown.links.openLocation":{type:"string",default:"currentGroup",description:"%configuration.markdown.links.openLocation.description%",scope:"resource",enum:["currentGroup","beside"],enumDescriptions:["%configuration.markdown.links.openLocation.currentGroup%","%configuration.markdown.links.openLocation.beside%"]},"markdown.suggest.paths.enabled":{type:"boolean",default:!0,description:"%configuration.markdown.suggest.paths.enabled.description%",scope:"resource"},"markdown.suggest.paths.includeWorkspaceHeaderCompletions":{type:"string",default:"onDoubleHash",scope:"resource",markdownDescription:"%configuration.markdown.suggest.paths.includeWorkspaceHeaderCompletions%",enum:["never","onDoubleHash","onSingleOrDoubleHash"],markdownEnumDescriptions:["%configuration.markdown.suggest.paths.includeWorkspaceHeaderCompletions.never%","%configuration.markdown.suggest.paths.includeWorkspaceHeaderCompletions.onDoubleHash%","%configuration.markdown.suggest.paths.includeWorkspaceHeaderCompletions.onSingleOrDoubleHash%"]},"markdown.trace.server":{type:"string",scope:"window",enum:["off","messages","verbose"],default:"off",description:"%markdown.trace.server.desc%"},"markdown.server.log":{type:"string",scope:"window",enum:["off","debug","trace"],default:"off",description:"%markdown.server.log.desc%"},"markdown.editor.drop.enabled":{type:"string",scope:"resource",markdownDescription:"%configuration.markdown.editor.drop.enabled%",default:"smart",enum:["always","smart","never"],markdownEnumDescriptions:["%configuration.markdown.editor.drop.enabled.always%","%configuration.markdown.editor.drop.enabled.smart%","%configuration.markdown.editor.drop.enabled.never%"]},"markdown.editor.drop.copyIntoWorkspace":{type:"string",markdownDescription:"%configuration.markdown.editor.drop.copyIntoWorkspace%",default:"mediaFiles",enum:["mediaFiles","never"],markdownEnumDescriptions:["%configuration.copyIntoWorkspace.mediaFiles%","%configuration.copyIntoWorkspace.never%"]},"markdown.editor.filePaste.enabled":{type:"string",scope:"resource",markdownDescription:"%configuration.markdown.editor.filePaste.enabled%",default:"smart",enum:["always","smart","never"],markdownEnumDescriptions:["%configuration.markdown.editor.filePaste.enabled.always%","%configuration.markdown.editor.filePaste.enabled.smart%","%configuration.markdown.editor.filePaste.enabled.never%"]},"markdown.editor.filePaste.copyIntoWorkspace":{type:"string",markdownDescription:"%configuration.markdown.editor.filePaste.copyIntoWorkspace%",default:"mediaFiles",enum:["mediaFiles","never"],markdownEnumDescriptions:["%configuration.copyIntoWorkspace.mediaFiles%","%configuration.copyIntoWorkspace.never%"]},"markdown.editor.filePaste.videoSnippet":{type:"string",markdownDescription:"%configuration.markdown.editor.filePaste.videoSnippet%",default:'<video controls src="${src}" title="${title}"></video>'},"markdown.editor.filePaste.audioSnippet":{type:"string",markdownDescription:"%configuration.markdown.editor.filePaste.audioSnippet%",default:'<audio controls src="${src}" title="${title}"></audio>'},"markdown.editor.pasteUrlAsFormattedLink.enabled":{type:"string",scope:"resource",markdownDescription:"%configuration.markdown.editor.pasteUrlAsFormattedLink.enabled%",default:"smartWithSelection",enum:["always","smart","smartWithSelection","never"],markdownEnumDescriptions:["%configuration.pasteUrlAsFormattedLink.always%","%configuration.pasteUrlAsFormattedLink.smart%","%configuration.pasteUrlAsFormattedLink.smartWithSelection%","%configuration.pasteUrlAsFormattedLink.never%"]},"markdown.validate.enabled":{type:"boolean",scope:"resource",description:"%configuration.markdown.validate.enabled.description%",default:!1},"markdown.validate.referenceLinks.enabled":{type:"string",scope:"resource",markdownDescription:"%configuration.markdown.validate.referenceLinks.enabled.description%",default:"warning",enum:["ignore","warning","error"]},"markdown.validate.fragmentLinks.enabled":{type:"string",scope:"resource",markdownDescription:"%configuration.markdown.validate.fragmentLinks.enabled.description%",default:"warning",enum:["ignore","warning","error"]},"markdown.validate.fileLinks.enabled":{type:"string",scope:"resource",markdownDescription:"%configuration.markdown.validate.fileLinks.enabled.description%",default:"warning",enum:["ignore","warning","error"]},"markdown.validate.fileLinks.markdownFragmentLinks":{type:"string",scope:"resource",markdownDescription:"%configuration.markdown.validate.fileLinks.markdownFragmentLinks.description%",default:"inherit",enum:["inherit","ignore","warning","error"]},"markdown.validate.ignoredLinks":{type:"array",scope:"resource",markdownDescription:"%configuration.markdown.validate.ignoredLinks.description%",items:{type:"string"}},"markdown.validate.unusedLinkDefinitions.enabled":{type:"string",scope:"resource",markdownDescription:"%configuration.markdown.validate.unusedLinkDefinitions.description%",default:"hint",enum:["ignore","hint","warning","error"]},"markdown.validate.duplicateLinkDefinitions.enabled":{type:"string",scope:"resource",markdownDescription:"%configuration.markdown.validate.duplicateLinkDefinitions.description%",default:"warning",enum:["ignore","warning","error"]},"markdown.updateLinksOnFileMove.enabled":{type:"string",enum:["prompt","always","never"],markdownEnumDescriptions:["%configuration.markdown.updateLinksOnFileMove.enabled.prompt%","%configuration.markdown.updateLinksOnFileMove.enabled.always%","%configuration.markdown.updateLinksOnFileMove.enabled.never%"],default:"never",markdownDescription:"%configuration.markdown.updateLinksOnFileMove.enabled%",scope:"window"},"markdown.updateLinksOnFileMove.include":{type:"array",markdownDescription:"%configuration.markdown.updateLinksOnFileMove.include%",scope:"window",items:{type:"string",description:"%configuration.markdown.updateLinksOnFileMove.include.property%"},default:["**/*.{md,mkd,mdwn,mdown,markdown,markdn,mdtxt,mdtext,workbook}","**/*.{jpg,jpe,jpeg,png,bmp,gif,ico,webp,avif,tiff,svg,mp4}"]},"markdown.updateLinksOnFileMove.enableForDirectories":{type:"boolean",default:!0,description:"%configuration.markdown.updateLinksOnFileMove.enableForDirectories%",scope:"window"},"markdown.occurrencesHighlight.enabled":{type:"boolean",default:!1,description:"%configuration.markdown.occurrencesHighlight.enabled%",scope:"resource"},"markdown.copyFiles.destination":{type:"object",markdownDescription:"%configuration.markdown.copyFiles.destination%",additionalProperties:{type:"string"}},"markdown.copyFiles.overwriteBehavior":{type:"string",markdownDescription:"%configuration.markdown.copyFiles.overwriteBehavior%",default:"nameIncrementally",enum:["nameIncrementally","overwrite"],markdownEnumDescriptions:["%configuration.markdown.copyFiles.overwriteBehavior.nameIncrementally%","%configuration.markdown.copyFiles.overwriteBehavior.overwrite%"]},"markdown.preferredMdPathExtensionStyle":{type:"string",default:"auto",markdownDescription:"%configuration.markdown.preferredMdPathExtensionStyle%",enum:["auto","includeExtension","removeExtension"],markdownEnumDescriptions:["%configuration.markdown.preferredMdPathExtensionStyle.auto%","%configuration.markdown.preferredMdPathExtensionStyle.includeExtension%","%configuration.markdown.preferredMdPathExtensionStyle.removeExtension%"]},"markdown.editor.updateLinksOnPaste.enabled":{type:"boolean",markdownDescription:"%configuration.markdown.editor.updateLinksOnPaste.enabled%",scope:"resource",default:!0}}},configurationDefaults:{"[markdown]":{"editor.wordWrap":"on","editor.quickSuggestions":{comments:"off",strings:"off",other:"off"}}},jsonValidation:[{fileMatch:"package.json",url:"./schemas/package.schema.json"}],"markdown.previewStyles":["./media/markdown.css","./media/highlight.css"],"markdown.previewScripts":["./media/index.js"],customEditors:[{viewType:"vscode.markdown.preview.editor",displayName:"Markdown Preview",priority:"option",selector:[{filenamePattern:"*.md"}]}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Markdown Language Features",description:"Provides rich language support for Markdown.","markdown.copyImage.title":"Copy Image","markdown.openImage.title":"Open Image","markdown.preview.breaks.desc":"Sets how line-breaks are rendered in the Markdown preview. Setting it to `true` creates a `<br>` for newlines inside paragraphs.","markdown.preview.linkify":"Convert URL-like text to links in the Markdown preview.","markdown.preview.typographer":"Enable some language-neutral replacement and quotes beautification in the Markdown preview.","markdown.preview.doubleClickToSwitchToEditor.desc":"Double-click in the Markdown preview to switch to the editor.","markdown.preview.fontFamily.desc":"Controls the font family used in the Markdown preview.","markdown.preview.fontSize.desc":"Controls the font size in pixels used in the Markdown preview.","markdown.preview.lineHeight.desc":"Controls the line height used in the Markdown preview. This number is relative to the font size.","markdown.preview.markEditorSelection.desc":"Mark the current editor selection in the Markdown preview.","markdown.preview.scrollEditorWithPreview.desc":"When a Markdown preview is scrolled, update the view of the editor.","markdown.preview.scrollPreviewWithEditor.desc":"When a Markdown editor is scrolled, update the view of the preview.","markdown.preview.title":"Open Preview","markdown.previewSide.title":"Open Preview to the Side","markdown.showLockedPreviewToSide.title":"Open Locked Preview to the Side","markdown.showSource.title":"Show Source","markdown.styles.dec":"A list of URLs or local paths to CSS style sheets to use from the Markdown preview. Relative paths are interpreted relative to the folder open in the Explorer. If there is no open folder, they are interpreted relative to the location of the Markdown file. All '\\' need to be written as '\\\\'.","markdown.showPreviewSecuritySelector.title":"Change Preview Security Settings","markdown.trace.extension.desc":"Enable debug logging for the Markdown extension.","markdown.trace.server.desc":"Traces the communication between VS Code and the Markdown language server.","markdown.server.log.desc":"Controls the logging level of the Markdown language server.","markdown.preview.refresh.title":"Refresh Preview","markdown.preview.toggleLock.title":"Toggle Preview Locking","markdown.findAllFileReferences":"Find File References","markdown.editor.insertLinkFromWorkspace":"Insert Link to File in Workspace","markdown.editor.insertImageFromWorkspace":"Insert Image from Workspace","configuration.markdown.preview.openMarkdownLinks.description":"Controls how links to other Markdown files in the Markdown preview should be opened.","configuration.markdown.preview.openMarkdownLinks.inEditor":"Try to open links in the editor.","configuration.markdown.preview.openMarkdownLinks.inPreview":"Try to open links in the Markdown preview.","configuration.markdown.links.openLocation.description":"Controls where links in Markdown files should be opened.","configuration.markdown.links.openLocation.currentGroup":"Open links in the active editor group.","configuration.markdown.links.openLocation.beside":"Open links beside the active editor.","configuration.markdown.suggest.paths.enabled.description":"Enable path suggestions while writing links in Markdown files.","configuration.markdown.suggest.paths.includeWorkspaceHeaderCompletions":"Enable suggestions for headers in other Markdown files in the current workspace. Accepting one of these suggestions inserts the full path to header in that file, for example: `[link text](/path/to/file.md#header)`.","configuration.markdown.suggest.paths.includeWorkspaceHeaderCompletions.never":"Disable workspace header suggestions.","configuration.markdown.suggest.paths.includeWorkspaceHeaderCompletions.onDoubleHash":"Enable workspace header suggestions after typing `##` in a path, for example: `[link text](##`.","configuration.markdown.suggest.paths.includeWorkspaceHeaderCompletions.onSingleOrDoubleHash":"Enable workspace header suggestions after typing either `##` or `#` in a path, for example: `[link text](#` or `[link text](##`.","configuration.markdown.editor.drop.enabled":"Enable dropping files into a Markdown editor while holding Shift. Requires enabling `#editor.dropIntoEditor.enabled#`.","configuration.markdown.editor.drop.enabled.always":"Always insert Markdown links.","configuration.markdown.editor.drop.enabled.smart":"Smartly create Markdown links by default when not dropping into a code block or other special element. Use the drop widget to switch between pasting as plain text or as Markdown links.","configuration.markdown.editor.drop.enabled.never":"Never create Markdown links.","configuration.markdown.editor.drop.copyIntoWorkspace":"Controls if files outside of the workspace that are dropped into a Markdown editor should be copied into the workspace.\n\nUse `#markdown.copyFiles.destination#` to configure where copied dropped files should be created","configuration.markdown.editor.filePaste.enabled":"Enable pasting files into a Markdown editor to create Markdown links. Requires enabling `#editor.pasteAs.enabled#`.","configuration.markdown.editor.filePaste.enabled.always":"Always insert Markdown links.","configuration.markdown.editor.filePaste.enabled.smart":"Smartly create Markdown links by default when not pasting into a code block or other special element. Use the paste widget to switch between pasting as plain text or as Markdown links.","configuration.markdown.editor.filePaste.enabled.never":"Never create Markdown links.","configuration.markdown.editor.filePaste.copyIntoWorkspace":"Controls if files outside of the workspace that are pasted into a Markdown editor should be copied into the workspace.\n\nUse `#markdown.copyFiles.destination#` to configure where copied files should be created.","configuration.copyIntoWorkspace.mediaFiles":"Try to copy external image and video files into the workspace.","configuration.copyIntoWorkspace.never":"Do not copy external files into the workspace.","configuration.markdown.editor.pasteUrlAsFormattedLink.enabled":"Controls if Markdown links are created when URLs are pasted into a Markdown editor. Requires enabling `#editor.pasteAs.enabled#`.","configuration.pasteUrlAsFormattedLink.always":"Always insert Markdown links.","configuration.pasteUrlAsFormattedLink.smart":"Smartly create Markdown links by default when not pasting into a code block or other special element. Use the paste widget to switch between pasting as plain text or as Markdown links.","configuration.pasteUrlAsFormattedLink.smartWithSelection":"Smartly create Markdown links by default when you have selected text and are not pasting into a code block or other special element. Use the paste widget to switch between pasting as plain text or as Markdown links.","configuration.pasteUrlAsFormattedLink.never":"Never create Markdown links.","configuration.markdown.validate.enabled.description":"Enable all error reporting in Markdown files.","configuration.markdown.validate.referenceLinks.enabled.description":"Validate reference links in Markdown files, for example: `[link][ref]`. Requires enabling `#markdown.validate.enabled#`.","configuration.markdown.validate.fragmentLinks.enabled.description":"Validate fragment links to headers in the current Markdown file, for example: `[link](#header)`. Requires enabling `#markdown.validate.enabled#`.","configuration.markdown.validate.fileLinks.enabled.description":"Validate links to other files in Markdown files, for example `[link](/path/to/file.md)`. This checks that the target files exists. Requires enabling `#markdown.validate.enabled#`.","configuration.markdown.validate.fileLinks.markdownFragmentLinks.description":"Validate the fragment part of links to headers in other files in Markdown files, for example: `[link](/path/to/file.md#header)`. Inherits the setting value from `#markdown.validate.fragmentLinks.enabled#` by default.","configuration.markdown.validate.ignoredLinks.description":"Configure links that should not be validated. For example adding `/about` would not validate the link `[about](/about)`, while the glob `/assets/**/*.svg` would let you skip validation for any link to `.svg` files under the `assets` directory.","configuration.markdown.validate.unusedLinkDefinitions.description":"Validate link definitions that are unused in the current file.","configuration.markdown.validate.duplicateLinkDefinitions.description":"Validate duplicated definitions in the current file.","configuration.markdown.updateLinksOnFileMove.enabled":"Try to update links in Markdown files when a file is renamed/moved in the workspace. Use `#markdown.updateLinksOnFileMove.include#` to configure which files trigger link updates.","configuration.markdown.updateLinksOnFileMove.enabled.prompt":"Prompt on each file move.","configuration.markdown.updateLinksOnFileMove.enabled.always":"Always update links automatically.","configuration.markdown.updateLinksOnFileMove.enabled.never":"Never try to update link and don't prompt.","configuration.markdown.updateLinksOnFileMove.include":"Glob patterns that specifies files that trigger automatic link updates. See `#markdown.updateLinksOnFileMove.enabled#` for details about this feature.","configuration.markdown.updateLinksOnFileMove.include.property":"The glob pattern to match file paths against. Set to true to enable the pattern.","configuration.markdown.updateLinksOnFileMove.enableForDirectories":"Enable updating links when a directory is moved or renamed in the workspace.","configuration.markdown.occurrencesHighlight.enabled":"Enable highlighting link occurrences in the current document.","configuration.markdown.copyFiles.destination":{message:"Configures the path and file name of files created by copy/paste or drag and drop. This is a map of globs that match against a Markdown document path to the destination path where the new file should be created.\n\nThe destination path may use the following variables:\n\n- `${documentDirName}` \u2014 Absolute parent directory path of the Markdown document, e.g. `/Users/me/myProject/docs`.\n- `${documentRelativeDirName}` \u2014 Relative parent directory path of the Markdown document, e.g. `docs`. This is the same as `${documentDirName}` if the file is not part of a workspace.\n- `${documentFileName}` \u2014 The full filename of the Markdown document, e.g. `README.md`.\n- `${documentBaseName}` \u2014 The basename of the Markdown document, e.g. `README`.\n- `${documentExtName}` \u2014 The extension of the Markdown document, e.g. `md`.\n- `${documentFilePath}` \u2014 Absolute path of the Markdown document, e.g. `/Users/me/myProject/docs/README.md`.\n- `${documentRelativeFilePath}` \u2014 Relative path of the Markdown document, e.g. `docs/README.md`. This is the same as `${documentFilePath}` if the file is not part of a workspace.\n- `${documentWorkspaceFolder}` \u2014 The workspace folder for the Markdown document, e.g. `/Users/me/myProject`. This is the same as `${documentDirName}` if the file is not part of a workspace.\n- `${fileName}` \u2014 The file name of the dropped file, e.g. `image.png`.\n- `${fileExtName}` \u2014 The extension of the dropped file, e.g. `png`.\n- `${unixTime}` \u2014 The current Unix timestamp in milliseconds.\n- `${isoTime}` \u2014 The current time in ISO 8601 format, e.g. '2025-06-06T08:40:32.123Z'.",comment:["This setting is use the user drops or pastes image data into the editor. In this case, VS Code automatically creates a new image file in the workspace containing the dropped/pasted image.","It's easier to explain this setting with an example. For example, let's say the setting value was:","","{ 'docs/*.md': '${documentDirName}/images/${fileName}' }","","Here the setting is an object mapping from a set of globs to a set of file destinations.","The left hand side ('docs/*.md') is a glob that matches against a markdown document. If the glob, matches then we use the right hand side to compute the new file's path and name. The right hand side can also use the special variables document in this setting description."]},"configuration.markdown.copyFiles.overwriteBehavior":"Controls if files created by drop or paste should overwrite existing files.","configuration.markdown.copyFiles.overwriteBehavior.nameIncrementally":"If a file with the same name already exists, append a number to the file name, for example: `image.png` becomes `image-1.png`.","configuration.markdown.copyFiles.overwriteBehavior.overwrite":"If a file with the same name already exists, overwrite it.","configuration.markdown.preferredMdPathExtensionStyle":"Controls if file extensions (for example `.md`) are added or not for links to Markdown files. This setting is used when file paths are added by tooling such as path completions or file renames.","configuration.markdown.preferredMdPathExtensionStyle.auto":"For existing paths, try to maintain the file extension style. For new paths, add file extensions.","configuration.markdown.preferredMdPathExtensionStyle.includeExtension":"Prefer including the file extension. For example, path completions to a file named `file.md` will insert `file.md`.","configuration.markdown.preferredMdPathExtensionStyle.removeExtension":"Prefer removing the file extension. For example, path completions to a file named `file.md` will insert `file` without the `.md`.","configuration.markdown.editor.filePaste.videoSnippet":"Snippet used when adding videos to Markdown. This snippet can use the following variables:\n- `${src}` \u2014 The resolved path of the video file.\n- `${title}` \u2014 The title used for the video. A snippet placeholder will automatically be created for this variable.","configuration.markdown.editor.filePaste.audioSnippet":"Snippet used when adding audio to Markdown. This snippet can use the following variables:\n- `${src}` \u2014 The resolved path of the audio file.\n- `${title}` \u2014 The title used for the audio. A snippet placeholder will automatically be created for this variable.","configuration.markdown.editor.updateLinksOnPaste.enabled":"Enable/disable a paste option that updates links and reference in text that is copied and pasted between Markdown editors.\n\nTo use this feature, after pasting text that contains updatable links, just click on the Paste Widget and select `Paste and update pasted links`.",workspaceTrust:"Required for loading styles configured in the workspace."},readmePath:"markdown-language-features\\README.md"},{extensionPath:"markdown-math",packageJSON:{name:"markdown-math",displayName:"%displayName%",description:"%description%",version:"10.0.0",icon:"icon.png",publisher:"vscode",license:"MIT",aiKey:"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",engines:{vscode:"^1.54.0"},categories:["Other","Programming Languages"],capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},main:"./dist/extension",browser:"./dist/browser/extension",activationEvents:[],contributes:{languages:[{id:"markdown-math",aliases:[]}],grammars:[{language:"markdown-math",scopeName:"text.html.markdown.math",path:"./syntaxes/md-math.tmLanguage.json"},{scopeName:"markdown.math.block",path:"./syntaxes/md-math-block.tmLanguage.json",injectTo:["text.html.markdown"],embeddedLanguages:{"meta.embedded.math.markdown":"latex"}},{scopeName:"markdown.math.inline",path:"./syntaxes/md-math-inline.tmLanguage.json",injectTo:["text.html.markdown"],embeddedLanguages:{"meta.embedded.math.markdown":"latex","punctuation.definition.math.end.markdown":"latex"}},{scopeName:"markdown.math.codeblock",path:"./syntaxes/md-math-fence.tmLanguage.json",injectTo:["text.html.markdown"],embeddedLanguages:{"meta.embedded.math.markdown":"latex"}}],notebookRenderer:[{id:"vscode.markdown-it-katex-extension",displayName:"Markdown it KaTeX renderer",entrypoint:{extends:"vscode.markdown-it-renderer",path:"./notebook-out/katex.js"}}],"markdown.markdownItPlugins":!0,"markdown.previewStyles":["./notebook-out/katex.min.css","./preview-styles/index.css"],configuration:[{title:"Markdown Math",properties:{"markdown.math.enabled":{type:"boolean",default:!0,description:"%config.markdown.math.enabled%"},"markdown.math.macros":{type:"object",additionalProperties:{type:"string"},default:{},description:"%config.markdown.math.macros%",scope:"resource"}}}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Markdown Math",description:"Adds math support to Markdown in notebooks.","config.markdown.math.enabled":"Enable/disable rendering math in the built-in Markdown preview.","config.markdown.math.macros":"A collection of custom macros. Each macro is a key-value pair where the key is a new command name and the value is the expansion of the macro."},readmePath:"markdown-math\\README.md"},{extensionPath:"media-preview",packageJSON:{name:"media-preview",displayName:"%displayName%",description:"%description%",extensionKind:["ui","workspace"],version:"10.0.0",publisher:"vscode",icon:"icon.png",license:"MIT",aiKey:"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",engines:{vscode:"^1.70.0"},main:"./dist/extension",browser:"./dist/browser/extension.js",categories:["Other"],activationEvents:[],capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},contributes:{configuration:{type:"object",title:"Media Previewer",properties:{"mediaPreview.video.autoPlay":{type:"boolean",default:!1,markdownDescription:"%videoPreviewerAutoPlay%"},"mediaPreview.video.loop":{type:"boolean",default:!1,markdownDescription:"%videoPreviewerLoop%"}}},customEditors:[{viewType:"imagePreview.previewEditor",displayName:"%customEditor.imagePreview.displayName%",priority:"builtin",selector:[{filenamePattern:"*.{jpg,jpe,jpeg,png,bmp,gif,ico,webp,avif,svg}"}]},{viewType:"vscode.audioPreview",displayName:"%customEditor.audioPreview.displayName%",priority:"builtin",selector:[{filenamePattern:"*.{mp3,wav,ogg,oga}"}]},{viewType:"vscode.videoPreview",displayName:"%customEditor.videoPreview.displayName%",priority:"builtin",selector:[{filenamePattern:"*.{mp4,webm}"}]}],commands:[{command:"imagePreview.zoomIn",title:"%command.zoomIn%",category:"Image Preview"},{command:"imagePreview.zoomOut",title:"%command.zoomOut%",category:"Image Preview"},{command:"imagePreview.copyImage",title:"%command.copyImage%",category:"Image Preview"},{command:"imagePreview.reopenAsPreview",title:"%command.reopenAsPreview%",category:"Image Preview",icon:"$(preview)"},{command:"imagePreview.reopenAsText",title:"%command.reopenAsText%",category:"Image Preview",icon:"$(go-to-file)"}],menus:{commandPalette:[{command:"imagePreview.zoomIn",when:"activeCustomEditorId == 'imagePreview.previewEditor'",group:"1_imagePreview"},{command:"imagePreview.zoomOut",when:"activeCustomEditorId == 'imagePreview.previewEditor'",group:"1_imagePreview"},{command:"imagePreview.copyImage",when:"false"},{command:"imagePreview.reopenAsPreview",when:"activeEditor == workbench.editors.files.textFileEditor && resourceExtname == '.svg'",group:"navigation"},{command:"imagePreview.reopenAsText",when:"activeCustomEditorId == 'imagePreview.previewEditor' && resourceExtname == '.svg'",group:"navigation"}],"webview/context":[{command:"imagePreview.copyImage",when:"webviewId == 'imagePreview.previewEditor'"}],"editor/title":[{command:"imagePreview.reopenAsPreview",when:"editorFocus && resourceExtname == '.svg'",group:"navigation"},{command:"imagePreview.reopenAsText",when:"activeCustomEditorId == 'imagePreview.previewEditor' && resourceExtname == '.svg'",group:"navigation"}]}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Media Preview",description:"Provides VS Code's built-in previews for images, audio, and video","customEditor.audioPreview.displayName":"Audio Preview","customEditor.imagePreview.displayName":"Image Preview","customEditor.videoPreview.displayName":"Video Preview",videoPreviewerAutoPlay:"Start playing videos on mute automatically.",videoPreviewerLoop:"Loop videos over again automatically.","command.zoomIn":"Zoom in","command.zoomOut":"Zoom out","command.copyImage":"Copy","command.reopenAsPreview":"Reopen as image preview","command.reopenAsText":"Reopen as source text"},readmePath:"media-preview\\README.md"},{extensionPath:"merge-conflict",packageJSON:{name:"merge-conflict",publisher:"vscode",displayName:"%displayName%",description:"%description%",icon:"media/icon.png",version:"10.0.0",license:"MIT",aiKey:"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",engines:{vscode:"^1.5.0"},categories:["Other"],capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},activationEvents:["onStartupFinished"],main:"./dist/mergeConflictMain",browser:"./dist/browser/mergeConflictMain",contributes:{commands:[{category:"%command.category%",title:"%command.accept.all-current%",original:"Accept All Current",command:"merge-conflict.accept.all-current",enablement:"!isMergeEditor"},{category:"%command.category%",title:"%command.accept.all-incoming%",original:"Accept All Incoming",command:"merge-conflict.accept.all-incoming",enablement:"!isMergeEditor"},{category:"%command.category%",title:"%command.accept.all-both%",original:"Accept All Both",command:"merge-conflict.accept.all-both",enablement:"!isMergeEditor"},{category:"%command.category%",title:"%command.accept.current%",original:"Accept Current",command:"merge-conflict.accept.current",enablement:"!isMergeEditor"},{category:"%command.category%",title:"%command.accept.incoming%",original:"Accept Incoming",command:"merge-conflict.accept.incoming",enablement:"!isMergeEditor"},{category:"%command.category%",title:"%command.accept.selection%",original:"Accept Selection",command:"merge-conflict.accept.selection",enablement:"!isMergeEditor"},{category:"%command.category%",title:"%command.accept.both%",original:"Accept Both",command:"merge-conflict.accept.both",enablement:"!isMergeEditor"},{category:"%command.category%",title:"%command.next%",original:"Next Conflict",command:"merge-conflict.next",enablement:"!isMergeEditor",icon:"$(arrow-down)"},{category:"%command.category%",title:"%command.previous%",original:"Previous Conflict",command:"merge-conflict.previous",enablement:"!isMergeEditor",icon:"$(arrow-up)"},{category:"%command.category%",title:"%command.compare%",original:"Compare Current Conflict",command:"merge-conflict.compare",enablement:"!isMergeEditor"}],menus:{"scm/resourceState/context":[{command:"merge-conflict.accept.all-current",when:"scmProvider == git && scmResourceGroup == merge",group:"1_modification"},{command:"merge-conflict.accept.all-incoming",when:"scmProvider == git && scmResourceGroup == merge",group:"1_modification"}],"editor/title":[{command:"merge-conflict.previous",group:"navigation@1",when:"!isMergeEditor && mergeConflictsCount && mergeConflictsCount != 0"},{command:"merge-conflict.next",group:"navigation@2",when:"!isMergeEditor && mergeConflictsCount && mergeConflictsCount != 0"}]},configuration:{title:"%config.title%",properties:{"merge-conflict.codeLens.enabled":{type:"boolean",description:"%config.codeLensEnabled%",default:!0},"merge-conflict.decorators.enabled":{type:"boolean",description:"%config.decoratorsEnabled%",default:!0},"merge-conflict.autoNavigateNextConflict.enabled":{type:"boolean",description:"%config.autoNavigateNextConflictEnabled%",default:!1},"merge-conflict.diffViewPosition":{type:"string",enum:["Current","Beside","Below"],description:"%config.diffViewPosition%",enumDescriptions:["%config.diffViewPosition.current%","%config.diffViewPosition.beside%","%config.diffViewPosition.below%"],default:"Current"}}}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Merge Conflict",description:"Highlighting and commands for inline merge conflicts.","command.category":"Merge Conflict","command.accept.all-current":"Accept All Current","command.accept.all-incoming":"Accept All Incoming","command.accept.all-both":"Accept All Both","command.accept.current":"Accept Current","command.accept.incoming":"Accept Incoming","command.accept.selection":"Accept Selection","command.accept.both":"Accept Both","command.next":"Next Conflict","command.previous":"Previous Conflict","command.compare":"Compare Current Conflict","config.title":"Merge Conflict","config.autoNavigateNextConflictEnabled":"Whether to automatically navigate to the next merge conflict after resolving a merge conflict.","config.codeLensEnabled":"Create a CodeLens for merge conflict blocks within editor.","config.decoratorsEnabled":"Create decorators for merge conflict blocks within editor.","config.diffViewPosition":"Controls where the diff view should be opened when comparing changes in merge conflicts.","config.diffViewPosition.current":"Open the diff view in the current editor group.","config.diffViewPosition.beside":"Open the diff view next to the current editor group.","config.diffViewPosition.below":"Open the diff view below the current editor group."},readmePath:"merge-conflict\\README.md"},{extensionPath:"mermaid-chat-features",packageJSON:{name:"mermaid-chat-features",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",repository:{type:"git",url:"https://github.com/microsoft/vscode.git"},aiKey:"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",engines:{vscode:"^1.104.0"},enabledApiProposals:["chatOutputRenderer"],capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},main:"./dist/extension",browser:"./dist/browser/extension",activationEvents:["onWebviewPanel:vscode.chat-mermaid-features.preview"],contributes:{commands:[{command:"_mermaid-chat.resetPanZoom",title:"Reset Pan and Zoom"},{command:"_mermaid-chat.openInEditor",title:"Open Diagram in Editor"},{command:"_mermaid-chat.copySource",title:"Copy Diagram Source"}],menus:{commandPalette:[{command:"_mermaid-chat.resetPanZoom",when:"false"},{command:"_mermaid-chat.openInEditor",when:"false"},{command:"_mermaid-chat.copySource",when:"false"}],"webview/context":[{command:"_mermaid-chat.resetPanZoom",when:"webviewId == 'vscode.chat-mermaid-features.chatOutputItem'"},{command:"_mermaid-chat.copySource",when:"webviewId == 'vscode.chat-mermaid-features.chatOutputItem' || webviewId == 'vscode.chat-mermaid-features.preview'"}]},configuration:{title:"Mermaid Chat Features",properties:{"mermaid-chat.enabled":{type:"boolean",default:!0,description:"%config.enabled.description%",scope:"application"}}},chatOutputRenderers:[{viewType:"vscode.chat-mermaid-features.chatOutputItem",mimeTypes:["text/vnd.mermaid"]}],languageModelTools:[{name:"renderMermaidDiagram",displayName:"Mermaid Renderer",toolReferenceName:"renderMermaidDiagram",canBeReferencedInPrompt:!0,modelDescription:"Renders a Mermaid diagram from Mermaid.js markup.",userDescription:"Render a Mermaid.js diagrams from markup.",when:"config.mermaid-chat.enabled",inputSchema:{type:"object",properties:{markup:{type:"string",description:"The mermaid diagram markup to render as a Mermaid diagram. This should only be the markup of the diagram. Do not include a wrapping code block."},title:{type:"string",description:"A short title that describes the diagram."}}}}]}},packageNLS:{displayName:"Mermaid Chat Features",description:"Adds Mermaid diagram support to built-in chats.","config.enabled.description":"Enable a tool for Mermaid diagram rendering in chat responses."},readmePath:"mermaid-chat-features\\README.md"},{extensionPath:"ms-vscode.vscode-js-profile-table",packageJSON:{name:"vscode-js-profile-table",version:"1.0.10",displayName:"Table Visualizer for JavaScript Profiles",description:"Text visualizer for profiles taken from the JavaScript debugger",author:"Connor Peet <connor@peet.io>",homepage:"https://github.com/microsoft/vscode-js-profile-visualizer#readme",license:"MIT",main:"out/extension.js",browser:"out/extension.web.js",repository:{type:"git",url:"https://github.com/microsoft/vscode-js-profile-visualizer.git"},capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},icon:"resources/icon.png",publisher:"ms-vscode",sideEffects:!1,engines:{vscode:"^1.74.0"},contributes:{customEditors:[{viewType:"jsProfileVisualizer.cpuprofile.table",displayName:"CPU Profile Table Visualizer",priority:"default",selector:[{filenamePattern:"*.cpuprofile"}]},{viewType:"jsProfileVisualizer.heapprofile.table",displayName:"Heap Profile Table Visualizer",priority:"default",selector:[{filenamePattern:"*.heapprofile"}]},{viewType:"jsProfileVisualizer.heapsnapshot.table",displayName:"Heap Snapshot Table Visualizer",priority:"default",selector:[{filenamePattern:"*.heapsnapshot"}]}],commands:[{command:"extension.jsProfileVisualizer.table.clearCodeLenses",title:"Clear Profile Code Lenses"}],menus:{commandPalette:[{command:"extension.jsProfileVisualizer.table.clearCodeLenses",when:"jsProfileVisualizer.hasCodeLenses == true"}]}},bugs:{url:"https://github.com/microsoft/vscode-js-profile-visualizer/issues"},__metadata:{id:"7e52b41b-71ad-457b-ab7e-0620f1fc4feb",publisherId:{publisherId:"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee",publisherName:"ms-vscode",displayName:"Microsoft",flags:"verified"},publisherDisplayName:"Microsoft"}},readmePath:"ms-vscode.vscode-js-profile-table\\README.md"},{extensionPath:"notebook-renderers",packageJSON:{name:"builtin-notebook-renderers",displayName:"%displayName%",description:"%description%",publisher:"vscode",version:"10.0.0",license:"MIT",icon:"media/icon.png",engines:{vscode:"^1.57.0"},capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},contributes:{notebookRenderer:[{id:"vscode.builtin-renderer",entrypoint:"./renderer-out/index.js",displayName:"VS Code Builtin Notebook Output Renderer",requiresMessaging:"never",mimeTypes:["image/gif","image/png","image/jpeg","image/git","image/svg+xml","text/html","application/javascript","application/vnd.code.notebook.error","application/vnd.code.notebook.stdout","application/x.notebook.stdout","application/x.notebook.stream","application/vnd.code.notebook.stderr","application/x.notebook.stderr","text/plain"]}]},scripts:{compile:"npx gulp compile-extension:notebook-renderers && npm run build-notebook",watch:"npx gulp compile-watch:notebook-renderers","build-notebook":"node ./esbuild.notebook.mts"},devDependencies:{"@types/jsdom":"^21.1.0","@types/node":"^22.18.10","@types/vscode-notebook-renderer":"^1.60.0",jsdom:"^28.1.0"},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Builtin Notebook Output Renderers",description:"Provides basic output renderers for notebooks"},readmePath:"notebook-renderers\\README.md"},{extensionPath:"npm",packageJSON:{name:"npm",publisher:"vscode",displayName:"%displayName%",description:"%description%",version:"1.0.1",private:!0,license:"MIT",engines:{vscode:"0.10.x"},icon:"images/npm_icon.png",categories:["Other"],enabledApiProposals:["terminalQuickFixProvider"],main:"./dist/npmMain",browser:"./dist/browser/npmBrowserMain",activationEvents:["onTaskType:npm","onLanguage:json","workspaceContains:package.json"],capabilities:{virtualWorkspaces:{supported:"limited",description:"%virtualWorkspaces%"},untrustedWorkspaces:{supported:"limited",description:"%workspaceTrust%"}},contributes:{languages:[{id:"ignore",extensions:[".npmignore"]},{id:"properties",extensions:[".npmrc"]}],views:{explorer:[{id:"npm",name:"%view.name%",when:"npm:showScriptExplorer",icon:"$(json)",visibility:"hidden",contextualTitle:"%view.name%"}]},commands:[{command:"npm.runScript",title:"%command.run%",icon:"$(run)"},{command:"npm.debugScript",title:"%command.debug%",icon:"$(debug)"},{command:"npm.openScript",title:"%command.openScript%"},{command:"npm.runInstall",title:"%command.runInstall%"},{command:"npm.refresh",title:"%command.refresh%",icon:"$(refresh)"},{command:"npm.runSelectedScript",title:"%command.runSelectedScript%"},{command:"npm.runScriptFromFolder",title:"%command.runScriptFromFolder%"},{command:"npm.packageManager",title:"%command.packageManager%"}],menus:{commandPalette:[{command:"npm.refresh",when:"false"},{command:"npm.runScript",when:"false"},{command:"npm.debugScript",when:"false"},{command:"npm.openScript",when:"false"},{command:"npm.runInstall",when:"false"},{command:"npm.runSelectedScript",when:"false"},{command:"npm.runScriptFromFolder",when:"false"},{command:"npm.packageManager",when:"false"}],"editor/context":[{command:"npm.runSelectedScript",when:"resourceFilename == 'package.json' && resourceScheme == file",group:"navigation@+1"}],"view/title":[{command:"npm.refresh",when:"view == npm",group:"navigation"}],"view/item/context":[{command:"npm.openScript",when:"view == npm && viewItem == packageJSON",group:"navigation@1"},{command:"npm.runInstall",when:"view == npm && viewItem == packageJSON",group:"navigation@2"},{command:"npm.openScript",when:"view == npm && viewItem == script",group:"navigation@1"},{command:"npm.runScript",when:"view == npm && viewItem == script",group:"navigation@2"},{command:"npm.runScript",when:"view == npm && viewItem == script",group:"inline"},{command:"npm.debugScript",when:"view == npm && viewItem == script",group:"inline"},{command:"npm.debugScript",when:"view == npm && viewItem == script",group:"navigation@3"}],"explorer/context":[{when:"config.npm.enableRunFromFolder && explorerViewletVisible && explorerResourceIsFolder && resourceScheme == file",command:"npm.runScriptFromFolder",group:"2_workspace"}]},configuration:{id:"npm",type:"object",title:"Npm",properties:{"npm.autoDetect":{type:"string",enum:["off","on"],default:"on",scope:"resource",description:"%config.npm.autoDetect%"},"npm.runSilent":{type:"boolean",default:!1,scope:"resource",markdownDescription:"%config.npm.runSilent%"},"npm.packageManager":{scope:"resource",type:"string",enum:["auto","npm","yarn","pnpm","bun"],enumDescriptions:["%config.npm.packageManager.auto%","%config.npm.packageManager.npm%","%config.npm.packageManager.yarn%","%config.npm.packageManager.pnpm%","%config.npm.packageManager.bun%"],default:"auto",description:"%config.npm.packageManager%"},"npm.scriptRunner":{scope:"resource",type:"string",enum:["auto","npm","yarn","pnpm","bun","node"],enumDescriptions:["%config.npm.scriptRunner.auto%","%config.npm.scriptRunner.npm%","%config.npm.scriptRunner.yarn%","%config.npm.scriptRunner.pnpm%","%config.npm.scriptRunner.bun%","%config.npm.scriptRunner.node%"],default:"auto",description:"%config.npm.scriptRunner%"},"npm.exclude":{type:["string","array"],items:{type:"string"},description:"%config.npm.exclude%",scope:"resource"},"npm.enableScriptExplorer":{type:"boolean",default:!1,scope:"resource",deprecationMessage:"The NPM Script Explorer is now available in 'Views' menu in the Explorer in all folders.",description:"%config.npm.enableScriptExplorer%"},"npm.enableRunFromFolder":{type:"boolean",default:!1,scope:"resource",description:"%config.npm.enableRunFromFolder%"},"npm.scriptExplorerAction":{type:"string",enum:["open","run"],markdownDescription:"%config.npm.scriptExplorerAction%",scope:"window",default:"open"},"npm.scriptExplorerExclude":{type:"array",items:{type:"string"},markdownDescription:"%config.npm.scriptExplorerExclude%",scope:"resource",default:[]},"npm.fetchOnlinePackageInfo":{type:"boolean",description:"%config.npm.fetchOnlinePackageInfo%",default:!0,scope:"window",tags:["usesOnlineServices"]},"npm.scriptHover":{type:"boolean",description:"%config.npm.scriptHover%",default:!0,scope:"window"}}},jsonValidation:[{fileMatch:"package.json",url:"https://www.schemastore.org/package"},{fileMatch:"bower.json",url:"https://www.schemastore.org/bower"}],taskDefinitions:[{type:"npm",required:["script"],properties:{script:{type:"string",description:"%taskdef.script%"},path:{type:"string",description:"%taskdef.path%"}},when:"shellExecutionSupported"}],terminalQuickFixes:[{id:"ms-vscode.npm-command",commandLineMatcher:"npm",commandExitResult:"error",outputMatcher:{anchor:"bottom",length:8,lineMatcher:"Did you mean (?:this|one of these)\\?((?:\\n.+?npm .+ #.+)+)",offset:2}}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{description:"Extension to add task support for npm scripts.",displayName:"NPM support for VS Code",workspaceTrust:"This extension executes tasks, which require trust to run.",virtualWorkspaces:"Functionality that requires running the 'npm' command is not available in virtual workspaces.","config.npm.autoDetect":"Controls whether npm scripts should be automatically detected.","config.npm.runSilent":"Run npm commands with the `--silent` option.","config.npm.packageManager":"The package manager used to install dependencies.","config.npm.packageManager.npm":"Use npm as the package manager.","config.npm.packageManager.yarn":"Use yarn as the package manager.","config.npm.packageManager.pnpm":"Use pnpm as the package manager.","config.npm.packageManager.bun":"Use bun as the package manager.","config.npm.packageManager.auto":"Auto-detect which package manager to use based on lock files and installed package managers.","config.npm.scriptRunner":"The script runner used to run scripts.","config.npm.scriptRunner.npm":"Use npm as the script runner.","config.npm.scriptRunner.yarn":"Use yarn as the script runner.","config.npm.scriptRunner.pnpm":"Use pnpm as the script runner.","config.npm.scriptRunner.bun":"Use bun as the script runner.","config.npm.scriptRunner.node":"Use Node.js as the script runner.","config.npm.scriptRunner.auto":"Auto-detect which script runner to use based on lock files and installed package managers.","config.npm.exclude":"Configure glob patterns for folders that should be excluded from automatic script detection.","config.npm.enableScriptExplorer":"Enable an explorer view for npm scripts when there is no top-level 'package.json' file.","config.npm.scriptExplorerAction":"The default click action used in the NPM Scripts Explorer: `open` or `run`, the default is `open`.","config.npm.scriptExplorerExclude":"An array of regular expressions that indicate which scripts should be excluded from the NPM Scripts view.","config.npm.enableRunFromFolder":"Enable running npm scripts contained in a folder from the Explorer context menu.","config.npm.fetchOnlinePackageInfo":"Fetch data from https://registry.npmjs.org and https://registry.bower.io to provide auto-completion and information on hover features on npm dependencies.","config.npm.scriptHover":"Display hover with 'Run' and 'Debug' commands for scripts.","npm.parseError":"Npm task detection: failed to parse the file {0}","taskdef.script":"The npm script to customize.","taskdef.path":"The path to the folder of the package.json file that provides the script. Can be omitted.","view.name":"NPM Scripts","command.refresh":"Refresh","command.run":"Run","command.debug":"Debug","command.openScript":"Open","command.runInstall":"Run Install","command.runSelectedScript":"Run Script","command.runScriptFromFolder":"Run NPM Script in Folder...","command.packageManager":"Get Configured Package Manager"},readmePath:"npm\\README.md"},{extensionPath:"objective-c",packageJSON:{name:"objective-c",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ./build/update-grammars.js"},categories:["Programming Languages"],contributes:{languages:[{id:"objective-c",extensions:[".m"],aliases:["Objective-C"],configuration:"./language-configuration.json"},{id:"objective-cpp",extensions:[".mm"],aliases:["Objective-C++"],configuration:"./language-configuration.json"}],grammars:[{language:"objective-c",scopeName:"source.objc",path:"./syntaxes/objective-c.tmLanguage.json"},{language:"objective-cpp",scopeName:"source.objcpp",path:"./syntaxes/objective-c++.tmLanguage.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Objective-C Language Basics",description:"Provides syntax highlighting and bracket matching in Objective-C files."}},{extensionPath:"perl",packageJSON:{name:"perl",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin textmate/perl.tmbundle Syntaxes/Perl.plist ./syntaxes/perl.tmLanguage.json Syntaxes/Perl%206.tmLanguage ./syntaxes/perl6.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"perl",aliases:["Perl","perl"],extensions:[".pl",".pm",".pod",".t",".PL",".psgi"],firstLine:"^#!.*\\bperl\\b",configuration:"./perl.language-configuration.json"},{id:"raku",aliases:["Raku","Perl6","perl6"],extensions:[".raku",".rakumod",".rakutest",".rakudoc",".nqp",".p6",".pl6",".pm6"],firstLine:"(^#!.*\\bperl6\\b)|use\\s+v6|raku|=begin\\spod|my\\sclass",configuration:"./perl6.language-configuration.json"}],grammars:[{language:"perl",scopeName:"source.perl",path:"./syntaxes/perl.tmLanguage.json",unbalancedBracketScopes:["variable.other.predefined.perl"]},{language:"raku",scopeName:"source.perl.6",path:"./syntaxes/perl6.tmLanguage.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Perl Language Basics",description:"Provides syntax highlighting and bracket matching in Perl files."}},{extensionPath:"php",packageJSON:{name:"php",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"0.10.x"},categories:["Programming Languages"],contributes:{languages:[{id:"php",extensions:[".php",".php4",".php5",".phtml",".ctp"],aliases:["PHP","php"],firstLine:"^#!\\s*/.*\\bphp\\b",mimetypes:["application/x-php"],configuration:"./language-configuration.json"}],grammars:[{language:"php",scopeName:"source.php",path:"./syntaxes/php.tmLanguage.json"},{language:"php",scopeName:"text.html.php",path:"./syntaxes/html.tmLanguage.json",embeddedLanguages:{"text.html":"html","source.php":"php","source.sql":"sql","text.xml":"xml","source.js":"javascript","source.json":"json","source.css":"css"}}],snippets:[{language:"php",path:"./snippets/php.code-snippets"}]},scripts:{"update-grammar":"node ./build/update-grammar.mjs"},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"PHP Language Basics",description:"Provides syntax highlighting and bracket matching for PHP files."}},{extensionPath:"powershell",packageJSON:{name:"powershell",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},categories:["Programming Languages"],contributes:{languages:[{id:"powershell",extensions:[".ps1",".psm1",".psd1",".pssc",".psrc"],aliases:["PowerShell","powershell","ps","ps1","pwsh"],firstLine:"^#!\\s*/.*\\bpwsh\\b",configuration:"./language-configuration.json"}],grammars:[{language:"powershell",scopeName:"source.powershell",path:"./syntaxes/powershell.tmLanguage.json"}]},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin PowerShell/EditorSyntax PowerShellSyntax.tmLanguage ./syntaxes/powershell.tmLanguage.json"},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Powershell Language Basics",description:"Provides snippets, syntax highlighting, bracket matching and folding in Powershell files."}},{extensionPath:"prompt-basics",packageJSON:{name:"prompt",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"^1.20.0"},categories:["Programming Languages"],contributes:{languages:[{id:"prompt",aliases:["Prompt","prompt"],extensions:[".prompt.md"],configuration:"./language-configuration.json"},{id:"instructions",aliases:["Instructions","instructions"],extensions:[".instructions.md","copilot-instructions.md"],filenamePatterns:["**/.claude/rules/**/*.md"],configuration:"./language-configuration.json"},{id:"chatagent",aliases:["Agent","chat agent"],extensions:[".agent.md",".chatmode.md"],filenamePatterns:["**/.github/agents/*.md","**/.claude/agents/*.md"],configuration:"./language-configuration.json"},{id:"skill",aliases:["Skill","skill"],filenames:["SKILL.md"],configuration:"./language-configuration.json"}],grammars:[{language:"prompt",path:"./syntaxes/prompt.tmLanguage.json",scopeName:"text.html.markdown.prompt",unbalancedBracketScopes:["markup.underline.link.markdown","punctuation.definition.list.begin.markdown"]},{language:"instructions",path:"./syntaxes/prompt.tmLanguage.json",scopeName:"text.html.markdown.prompt",unbalancedBracketScopes:["markup.underline.link.markdown","punctuation.definition.list.begin.markdown"]},{language:"chatagent",path:"./syntaxes/prompt.tmLanguage.json",scopeName:"text.html.markdown.prompt",unbalancedBracketScopes:["markup.underline.link.markdown","punctuation.definition.list.begin.markdown"]},{language:"skill",path:"./syntaxes/prompt.tmLanguage.json",scopeName:"text.html.markdown.prompt",unbalancedBracketScopes:["markup.underline.link.markdown","punctuation.definition.list.begin.markdown"]}],configurationDefaults:{"[prompt]":{"editor.insertSpaces":!0,"editor.tabSize":2,"editor.autoIndent":"advanced","editor.unicodeHighlight.ambiguousCharacters":!1,"editor.unicodeHighlight.invisibleCharacters":!1,"diffEditor.ignoreTrimWhitespace":!1,"editor.wordWrap":"on","editor.quickSuggestions":{comments:"off",strings:"on",other:"on"},"editor.wordBasedSuggestions":"off"},"[instructions]":{"editor.insertSpaces":!0,"editor.tabSize":2,"editor.autoIndent":"advanced","editor.unicodeHighlight.ambiguousCharacters":!1,"editor.unicodeHighlight.invisibleCharacters":!1,"diffEditor.ignoreTrimWhitespace":!1,"editor.wordWrap":"on","editor.quickSuggestions":{comments:"off",strings:"on",other:"on"},"editor.wordBasedSuggestions":"off"},"[chatagent]":{"editor.insertSpaces":!0,"editor.tabSize":2,"editor.autoIndent":"advanced","editor.unicodeHighlight.ambiguousCharacters":!1,"editor.unicodeHighlight.invisibleCharacters":!1,"diffEditor.ignoreTrimWhitespace":!1,"editor.wordWrap":"on","editor.quickSuggestions":{comments:"off",strings:"on",other:"on"},"editor.wordBasedSuggestions":"off"},"[skill]":{"editor.insertSpaces":!0,"editor.tabSize":2,"editor.autoIndent":"advanced","editor.unicodeHighlight.ambiguousCharacters":!1,"editor.unicodeHighlight.invisibleCharacters":!1,"diffEditor.ignoreTrimWhitespace":!1,"editor.wordWrap":"on","editor.quickSuggestions":{comments:"off",strings:"on",other:"on"},"editor.wordBasedSuggestions":"off"}}},scripts:{},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Prompt Language Basics",description:"Syntax highlighting for Prompt and Instructions documents."}},{extensionPath:"pug",packageJSON:{name:"pug",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin davidrios/pug-tmbundle Syntaxes/Pug.JSON-tmLanguage ./syntaxes/pug.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"jade",extensions:[".pug",".jade"],aliases:["Pug","Jade","jade"],configuration:"./language-configuration.json"}],grammars:[{language:"jade",scopeName:"text.pug",path:"./syntaxes/pug.tmLanguage.json"}],configurationDefaults:{"[jade]":{"diffEditor.ignoreTrimWhitespace":!1}}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Pug Language Basics",description:"Provides syntax highlighting and bracket matching in Pug files."}},{extensionPath:"python",packageJSON:{name:"python",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},categories:["Programming Languages"],contributes:{languages:[{id:"python",extensions:[".py",".rpy",".pyw",".cpy",".gyp",".gypi",".pyi",".ipy",".pyt"],aliases:["Python","py"],filenames:["SConstruct","SConscript"],firstLine:"^#!\\s*/?.*\\bpython[0-9.-]*\\b",configuration:"./language-configuration.json"}],grammars:[{language:"python",scopeName:"source.python",path:"./syntaxes/MagicPython.tmLanguage.json"},{scopeName:"source.regexp.python",path:"./syntaxes/MagicRegExp.tmLanguage.json"}],configurationDefaults:{"[python]":{"diffEditor.ignoreTrimWhitespace":!1,"editor.defaultColorDecorators":"never"}}},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin MagicStack/MagicPython grammars/MagicPython.tmLanguage ./syntaxes/MagicPython.tmLanguage.json grammars/MagicRegExp.tmLanguage ./syntaxes/MagicRegExp.tmLanguage.json"},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Python Language Basics",description:"Provides syntax highlighting, bracket matching and folding in Python files."}},{extensionPath:"r",packageJSON:{name:"r",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin REditorSupport/vscode-R-syntax syntaxes/r.json ./syntaxes/r.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"r",extensions:[".R",".Rhistory",".Rprofile",".rt"],aliases:["R","r"],configuration:"./language-configuration.json"}],grammars:[{language:"r",scopeName:"source.r",path:"./syntaxes/r.tmLanguage.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"R Language Basics",description:"Provides syntax highlighting and bracket matching in R files."}},{extensionPath:"razor",packageJSON:{name:"razor",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"0.10.x"},scripts:{"update-grammar":"node ./build/update-grammar.mjs"},categories:["Programming Languages"],contributes:{languages:[{id:"razor",extensions:[".cshtml",".razor"],aliases:["Razor","razor"],mimetypes:["text/x-cshtml"],configuration:"./language-configuration.json"}],grammars:[{language:"razor",scopeName:"text.html.cshtml",path:"./syntaxes/cshtml.tmLanguage.json",embeddedLanguages:{"section.embedded.source.cshtml":"csharp","source.css":"css","source.js":"javascript"}}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Razor Language Basics",description:"Provides syntax highlighting, bracket matching and folding in Razor files."}},{extensionPath:"references-view",packageJSON:{name:"references-view",displayName:"%displayName%",description:"%description%",icon:"media/icon.png",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"^1.67.0"},capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},repository:{type:"git",url:"https://github.com/Microsoft/vscode-references-view"},bugs:{url:"https://github.com/Microsoft/vscode-references-view/issues"},activationEvents:["onCommand:references-view.find","onCommand:editor.action.showReferences"],main:"./dist/extension",browser:"./dist/browser/extension",contributes:{configuration:{properties:{"references.preferredLocation":{description:"%config.references.preferredLocation%",type:"string",default:"peek",enum:["peek","view"],enumDescriptions:["%config.references.preferredLocation.peek%","%config.references.preferredLocation.view%"]}}},viewsContainers:{activitybar:[{id:"references-view",icon:"$(references)",title:"%container.title%"}]},views:{"references-view":[{id:"references-view.tree",name:"%view.title%",when:"reference-list.isActive"}]},commands:[{command:"references-view.findReferences",title:"%cmd.references-view.findReferences%",category:"%cmd.category.references%"},{command:"references-view.findImplementations",title:"%cmd.references-view.findImplementations%",category:"%cmd.category.references%"},{command:"references-view.clearHistory",title:"%cmd.references-view.clearHistory%",category:"%cmd.category.references%",icon:"$(clear-all)"},{command:"references-view.clear",title:"%cmd.references-view.clear%",category:"%cmd.category.references%",icon:"$(clear-all)"},{command:"references-view.refresh",title:"%cmd.references-view.refresh%",category:"%cmd.category.references%",icon:"$(refresh)"},{command:"references-view.pickFromHistory",title:"%cmd.references-view.pickFromHistory%",category:"%cmd.category.references%"},{command:"references-view.removeReferenceItem",title:"%cmd.references-view.removeReferenceItem%",icon:"$(close)"},{command:"references-view.copy",title:"%cmd.references-view.copy%"},{command:"references-view.copyAll",title:"%cmd.references-view.copyAll%"},{command:"references-view.copyPath",title:"%cmd.references-view.copyPath%"},{command:"references-view.refind",title:"%cmd.references-view.refind%",icon:"$(refresh)"},{command:"references-view.showCallHierarchy",title:"%cmd.references-view.showCallHierarchy%",category:"Calls"},{command:"references-view.showOutgoingCalls",title:"%cmd.references-view.showOutgoingCalls%",category:"Calls",icon:"$(call-incoming)"},{command:"references-view.showIncomingCalls",title:"%cmd.references-view.showIncomingCalls%",category:"Calls",icon:"$(call-outgoing)"},{command:"references-view.removeCallItem",title:"%cmd.references-view.removeCallItem%",icon:"$(close)"},{command:"references-view.next",title:"%cmd.references-view.next%",enablement:"references-view.canNavigate"},{command:"references-view.prev",title:"%cmd.references-view.prev%",enablement:"references-view.canNavigate"},{command:"references-view.showTypeHierarchy",title:"%cmd.references-view.showTypeHierarchy%",category:"Types"},{command:"references-view.showSupertypes",title:"%cmd.references-view.showSupertypes%",category:"Types",icon:"$(type-hierarchy-super)"},{command:"references-view.showSubtypes",title:"%cmd.references-view.showSubtypes%",category:"Types",icon:"$(type-hierarchy-sub)"},{command:"references-view.removeTypeItem",title:"%cmd.references-view.removeTypeItem%",icon:"$(close)"}],menus:{"editor/context":[{command:"references-view.findReferences",when:"editorHasReferenceProvider",group:"0_navigation@1"},{command:"references-view.findImplementations",when:"editorHasImplementationProvider",group:"0_navigation@2"},{command:"references-view.showCallHierarchy",when:"editorHasCallHierarchyProvider",group:"0_navigation@3"},{command:"references-view.showTypeHierarchy",when:"editorHasTypeHierarchyProvider",group:"0_navigation@4"}],"view/title":[{command:"references-view.clear",group:"navigation@3",when:"view == references-view.tree && reference-list.hasResult"},{command:"references-view.clearHistory",group:"navigation@3",when:"view == references-view.tree && reference-list.hasHistory && !reference-list.hasResult"},{command:"references-view.refresh",group:"navigation@2",when:"view == references-view.tree && reference-list.hasResult"},{command:"references-view.showOutgoingCalls",group:"navigation@1",when:"view == references-view.tree && reference-list.hasResult && reference-list.source == callHierarchy && references-view.callHierarchyMode == showIncoming"},{command:"references-view.showIncomingCalls",group:"navigation@1",when:"view == references-view.tree && reference-list.hasResult && reference-list.source == callHierarchy && references-view.callHierarchyMode == showOutgoing"},{command:"references-view.showSupertypes",group:"navigation@1",when:"view == references-view.tree && reference-list.hasResult && reference-list.source == typeHierarchy && references-view.typeHierarchyMode != supertypes"},{command:"references-view.showSubtypes",group:"navigation@1",when:"view == references-view.tree && reference-list.hasResult && reference-list.source == typeHierarchy && references-view.typeHierarchyMode != subtypes"}],"view/item/context":[{command:"references-view.removeReferenceItem",group:"inline",when:"view == references-view.tree && viewItem == file-item || view == references-view.tree && viewItem == reference-item"},{command:"references-view.removeCallItem",group:"inline",when:"view == references-view.tree && viewItem == call-item"},{command:"references-view.removeTypeItem",group:"inline",when:"view == references-view.tree && viewItem == type-item"},{command:"references-view.refind",group:"inline",when:"view == references-view.tree && viewItem == history-item"},{command:"references-view.removeReferenceItem",group:"1",when:"view == references-view.tree && viewItem == file-item || view == references-view.tree && viewItem == reference-item"},{command:"references-view.removeCallItem",group:"1",when:"view == references-view.tree && viewItem == call-item"},{command:"references-view.removeTypeItem",group:"1",when:"view == references-view.tree && viewItem == type-item"},{command:"references-view.refind",group:"1",when:"view == references-view.tree && viewItem == history-item"},{command:"references-view.copy",group:"2@1",when:"view == references-view.tree && viewItem == file-item || view == references-view.tree && viewItem == reference-item"},{command:"references-view.copyPath",group:"2@2",when:"view == references-view.tree && viewItem == file-item"},{command:"references-view.copyAll",group:"2@3",when:"view == references-view.tree && viewItem == file-item || view == references-view.tree && viewItem == reference-item"},{command:"references-view.showOutgoingCalls",group:"1",when:"view == references-view.tree && viewItem == call-item"},{command:"references-view.showIncomingCalls",group:"1",when:"view == references-view.tree && viewItem == call-item"},{command:"references-view.showSupertypes",group:"1",when:"view == references-view.tree && viewItem == type-item"},{command:"references-view.showSubtypes",group:"1",when:"view == references-view.tree && viewItem == type-item"}],commandPalette:[{command:"references-view.removeReferenceItem",when:"never"},{command:"references-view.removeCallItem",when:"never"},{command:"references-view.removeTypeItem",when:"never"},{command:"references-view.copy",when:"never"},{command:"references-view.copyAll",when:"never"},{command:"references-view.copyPath",when:"never"},{command:"references-view.refind",when:"never"},{command:"references-view.findReferences",when:"editorHasReferenceProvider"},{command:"references-view.clear",when:"reference-list.hasResult"},{command:"references-view.clearHistory",when:"reference-list.isActive && !reference-list.hasResult"},{command:"references-view.refresh",when:"reference-list.hasResult"},{command:"references-view.pickFromHistory",when:"reference-list.isActive"},{command:"references-view.next",when:"never"},{command:"references-view.prev",when:"never"}]},keybindings:[{command:"references-view.findReferences",when:"editorHasReferenceProvider",key:"shift+alt+f12"},{command:"references-view.next",when:"reference-list.hasResult",key:"f4"},{command:"references-view.prev",when:"reference-list.hasResult",key:"shift+f4"},{command:"references-view.showCallHierarchy",when:"editorHasCallHierarchyProvider",key:"shift+alt+h"}]}},packageNLS:{displayName:"Reference Search View",description:"Reference Search results as separate, stable view in the sidebar","config.references.preferredLocation":"Controls whether 'Peek References' or 'Find References' is invoked when selecting CodeLens references.","config.references.preferredLocation.peek":"Show references in peek editor.","config.references.preferredLocation.view":"Show references in separate view.","container.title":"References","view.title":"Reference Search Results","cmd.category.references":"References","cmd.references-view.findReferences":"Find All References","cmd.references-view.findImplementations":"Find All Implementations","cmd.references-view.clearHistory":"Clear History","cmd.references-view.clear":"Clear","cmd.references-view.refresh":"Refresh","cmd.references-view.pickFromHistory":"Show History","cmd.references-view.removeReferenceItem":"Dismiss","cmd.references-view.copy":"Copy","cmd.references-view.copyAll":"Copy All","cmd.references-view.copyPath":"Copy Path","cmd.references-view.refind":"Rerun","cmd.references-view.showCallHierarchy":"Show Call Hierarchy","cmd.references-view.showOutgoingCalls":"Show Outgoing Calls","cmd.references-view.showIncomingCalls":"Show Incoming Calls","cmd.references-view.removeCallItem":"Dismiss","cmd.references-view.next":"Go to Next Reference","cmd.references-view.prev":"Go to Previous Reference","cmd.references-view.showTypeHierarchy":"Show Type Hierarchy","cmd.references-view.showSupertypes":"Show Supertypes","cmd.references-view.showSubtypes":"Show Subtypes","cmd.references-view.removeTypeItem":"Dismiss"},readmePath:"references-view\\README.md"},{extensionPath:"restructuredtext",packageJSON:{name:"restructuredtext",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin trond-snekvik/vscode-rst syntaxes/rst.tmLanguage.json ./syntaxes/rst.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"restructuredtext",aliases:["reStructuredText"],configuration:"./language-configuration.json",extensions:[".rst"]}],grammars:[{language:"restructuredtext",scopeName:"source.rst",path:"./syntaxes/rst.tmLanguage.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"reStructuredText Language Basics",description:"Provides syntax highlighting in reStructuredText files."}},{extensionPath:"ruby",packageJSON:{name:"ruby",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin Shopify/ruby-lsp vscode/grammars/ruby.cson.json ./syntaxes/ruby.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"ruby",extensions:[".rb",".rbx",".rjs",".gemspec",".rake",".ru",".erb",".podspec",".rbi"],filenames:["rakefile","gemfile","guardfile","podfile","capfile","cheffile","hobofile","vagrantfile","appraisals","rantfile","berksfile","berksfile.lock","thorfile","puppetfile","dangerfile","brewfile","fastfile","appfile","deliverfile","matchfile","scanfile","snapfile","gymfile"],aliases:["Ruby","rb"],firstLine:"^#!\\s*/.*\\bruby\\b",configuration:"./language-configuration.json"}],grammars:[{language:"ruby",scopeName:"source.ruby",path:"./syntaxes/ruby.tmLanguage.json"}],configurationDefaults:{"[ruby]":{"editor.defaultColorDecorators":"never"}}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Ruby Language Basics",description:"Provides syntax highlighting and bracket matching in Ruby files."}},{extensionPath:"rust",packageJSON:{name:"rust",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ./build/update-grammar.mjs"},categories:["Programming Languages"],contributes:{languages:[{id:"rust",extensions:[".rs"],aliases:["Rust","rust"],configuration:"./language-configuration.json"}],grammars:[{language:"rust",path:"./syntaxes/rust.tmLanguage.json",scopeName:"source.rust"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Rust Language Basics",description:"Provides syntax highlighting and bracket matching in Rust files."}},{extensionPath:"scss",packageJSON:{name:"scss",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin atom/language-sass grammars/scss.cson ./syntaxes/scss.tmLanguage.json grammars/sassdoc.cson ./syntaxes/sassdoc.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"scss",aliases:["SCSS","scss"],extensions:[".scss"],mimetypes:["text/x-scss","text/scss"],configuration:"./language-configuration.json"}],grammars:[{language:"scss",scopeName:"source.css.scss",path:"./syntaxes/scss.tmLanguage.json"},{scopeName:"source.sassdoc",path:"./syntaxes/sassdoc.tmLanguage.json"}],problemMatchers:[{name:"node-sass",label:"Node Sass Compiler",owner:"node-sass",fileLocation:"absolute",pattern:[{regexp:"^{$"},{regexp:'\\s*"status":\\s\\d+,'},{regexp:'\\s*"file":\\s"(.*)",',file:1},{regexp:'\\s*"line":\\s(\\d+),',line:1},{regexp:'\\s*"column":\\s(\\d+),',column:1},{regexp:'\\s*"message":\\s"(.*)",',message:1},{regexp:'\\s*"formatted":\\s(.*)'},{regexp:"^}$"}]}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"SCSS Language Basics",description:"Provides syntax highlighting, bracket matching and folding in SCSS files."}},{extensionPath:"search-result",packageJSON:{name:"search-result",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",icon:"images/icon.png",engines:{vscode:"^1.39.0"},main:"./dist/extension.js",browser:"./dist/browser/extension",activationEvents:["onLanguage:search-result"],capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},enabledApiProposals:["documentFiltersExclusive"],contributes:{configurationDefaults:{"[search-result]":{"editor.lineNumbers":"off"}},languages:[{id:"search-result",extensions:[".code-search"],aliases:["Search Result"]}],grammars:[{language:"search-result",scopeName:"text.searchResult",path:"./syntaxes/searchResult.tmLanguage.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Search Result",description:"Provides syntax highlighting and language features for tabbed search results."},readmePath:"search-result\\README.md"},{extensionPath:"shaderlab",packageJSON:{name:"shaderlab",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin tgjones/shaders-tmLanguage grammars/shaderlab.json ./syntaxes/shaderlab.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"shaderlab",extensions:[".shader"],aliases:["ShaderLab","shaderlab"],configuration:"./language-configuration.json"}],grammars:[{language:"shaderlab",path:"./syntaxes/shaderlab.tmLanguage.json",scopeName:"source.shaderlab"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Shaderlab Language Basics",description:"Provides syntax highlighting and bracket matching in Shaderlab files."}},{extensionPath:"shellscript",packageJSON:{name:"shellscript",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin jeff-hykin/better-shell-syntax autogenerated/shell.tmLanguage.json ./syntaxes/shell-unix-bash.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"shellscript",aliases:["Shell Script","shellscript","bash","fish","sh","zsh","ksh","csh"],extensions:[".sh",".bash",".bashrc",".bash_aliases",".bash_profile",".bash_login",".ebuild",".eclass",".profile",".bash_logout",".xprofile",".xsession",".xsessionrc",".Xsession",".zsh",".zshrc",".zprofile",".zlogin",".zlogout",".zshenv",".zsh-theme",".fish",".ksh",".csh",".cshrc",".tcshrc",".yashrc",".yash_profile"],filenames:["APKBUILD","PKGBUILD",".envrc",".hushlogin","zshrc","zshenv","zlogin","zprofile","zlogout","bashrc_Apple_Terminal","zshrc_Apple_Terminal"],firstLine:"^#!.*\\b(bash|fish|zsh|sh|ksh|dtksh|pdksh|mksh|ash|dash|yash|sh|csh|jcsh|tcsh|itcsh).*|^#\\s*-\\*-[^*]*mode:\\s*shell-script[^*]*-\\*-",configuration:"./language-configuration.json",mimetypes:["text/x-shellscript"]}],grammars:[{language:"shellscript",scopeName:"source.shell",path:"./syntaxes/shell-unix-bash.tmLanguage.json",balancedBracketScopes:["*"],unbalancedBracketScopes:["meta.scope.case-pattern.shell"]}],configurationDefaults:{"[shellscript]":{"files.eol":`
`,"editor.defaultColorDecorators":"never"}}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Shell Script Language Basics",description:"Provides syntax highlighting and bracket matching in Shell Script files."}},{extensionPath:"simple-browser",packageJSON:{name:"simple-browser",displayName:"%displayName%",description:"%description%",enabledApiProposals:["externalUriOpener"],version:"10.0.0",icon:"media/icon.png",publisher:"vscode",license:"MIT",aiKey:"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",engines:{vscode:"^1.70.0"},main:"./dist/extension",browser:"./dist/browser/extension",categories:["Other"],extensionKind:["ui","workspace"],activationEvents:["onCommand:simpleBrowser.api.open","onOpenExternalUri:http","onOpenExternalUri:https","onWebviewPanel:simpleBrowser.view"],capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},contributes:{commands:[{command:"simpleBrowser.show",title:"Show",category:"Simple Browser"}],configuration:[{title:"Simple Browser",properties:{"simpleBrowser.focusLockIndicator.enabled":{type:"boolean",default:!0,title:"Focus Lock Indicator Enabled",description:"%configuration.focusLockIndicator.enabled.description%"},"simpleBrowser.useIntegratedBrowser":{type:"boolean",default:!0,markdownDescription:"%configuration.useIntegratedBrowser.description%",scope:"application"}}}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Simple Browser",description:"A very basic built-in webview for displaying web content.","configuration.focusLockIndicator.enabled.description":"Enable/disable the floating indicator that shows when focused in the simple browser.","configuration.useIntegratedBrowser.description":"When enabled, the `simpleBrowser.show` command will open URLs in the integrated browser instead of the Simple Browser webview. **Note:** This setting is only available on desktop."},readmePath:"simple-browser\\README.md"},{extensionPath:"sql",packageJSON:{name:"sql",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ./build/update-grammar.mjs"},categories:["Programming Languages"],contributes:{languages:[{id:"sql",extensions:[".sql",".dsql"],aliases:["MS SQL","T-SQL"],configuration:"./language-configuration.json"}],grammars:[{language:"sql",scopeName:"source.sql",path:"./syntaxes/sql.tmLanguage.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"SQL Language Basics",description:"Provides syntax highlighting and bracket matching in SQL files."}},{extensionPath:"swift",packageJSON:{name:"swift",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin jtbandes/swift-tmlanguage Swift.tmLanguage.json ./syntaxes/swift.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"swift",aliases:["Swift","swift"],extensions:[".swift"],configuration:"./language-configuration.json"}],grammars:[{language:"swift",scopeName:"source.swift",path:"./syntaxes/swift.tmLanguage.json"}],snippets:[{language:"swift",path:"./snippets/swift.code-snippets"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Swift Language Basics",description:"Provides snippets, syntax highlighting and bracket matching in Swift files."}},{extensionPath:"theme-2026",packageJSON:{name:"theme-2026",displayName:"2026 Themes",description:"Modern, minimal light and dark themes for 2026 with consistent neutral palette and accessible color contrast",version:"0.1.0",publisher:"vscode",license:"MIT",engines:{vscode:"^1.85.0"},categories:["Themes"],contributes:{themes:[{id:"Experimental Light",label:"VS Code Light",uiTheme:"vs",path:"./themes/2026-light.json"},{id:"Experimental Dark",label:"VS Code Dark",uiTheme:"vs-dark",path:"./themes/2026-dark.json"}]}},packageNLS:{displayName:"2026 Themes",description:"Modern, minimal light and dark themes for 2026 with consistent neutral palette and accessible color contrast","2026-light-label":"2026 Light","2026-dark-label":"2026 Dark"}},{extensionPath:"theme-abyss",packageJSON:{name:"theme-abyss",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},categories:["Themes"],contributes:{themes:[{id:"Abyss",label:"%themeLabel%",uiTheme:"vs-dark",path:"./themes/abyss-color-theme.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Abyss Theme",description:"Abyss theme for Visual Studio Code",themeLabel:"Abyss"}},{extensionPath:"theme-defaults",packageJSON:{name:"theme-defaults",displayName:"%displayName%",description:"%description%",categories:["Themes"],version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},contributes:{themes:[{id:"Default Dark+",label:"%darkPlusColorThemeLabel%",uiTheme:"vs-dark",path:"./themes/dark_plus.json"},{id:"Default Dark Modern",label:"%darkModernThemeLabel%",uiTheme:"vs-dark",path:"./themes/dark_modern.json"},{id:"Default Light+",label:"%lightPlusColorThemeLabel%",uiTheme:"vs",path:"./themes/light_plus.json"},{id:"Default Light Modern",label:"%lightModernThemeLabel%",uiTheme:"vs",path:"./themes/light_modern.json"},{id:"Visual Studio Dark",label:"%darkColorThemeLabel%",uiTheme:"vs-dark",path:"./themes/dark_vs.json"},{id:"Visual Studio Light",label:"%lightColorThemeLabel%",uiTheme:"vs",path:"./themes/light_vs.json"},{id:"Default High Contrast",label:"%hcColorThemeLabel%",uiTheme:"hc-black",path:"./themes/hc_black.json"},{id:"Default High Contrast Light",label:"%lightHcColorThemeLabel%",uiTheme:"hc-light",path:"./themes/hc_light.json"}],iconThemes:[{id:"vs-minimal",label:"%minimalIconThemeLabel%",path:"./fileicons/vs_minimal-icon-theme.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Default Themes",description:"The default Visual Studio light and dark themes",darkPlusColorThemeLabel:"Dark+",darkModernThemeLabel:"Dark Modern",lightPlusColorThemeLabel:"Light+",lightModernThemeLabel:"Light Modern",darkColorThemeLabel:"Dark (Visual Studio)",lightColorThemeLabel:"Light (Visual Studio)",hcColorThemeLabel:"Dark High Contrast",lightHcColorThemeLabel:"Light High Contrast",minimalIconThemeLabel:"Minimal (Visual Studio Code)"}},{extensionPath:"theme-kimbie-dark",packageJSON:{name:"theme-kimbie-dark",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},categories:["Themes"],contributes:{themes:[{id:"Kimbie Dark",label:"%themeLabel%",uiTheme:"vs-dark",path:"./themes/kimbie-dark-color-theme.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Kimbie Dark Theme",description:"Kimbie dark theme for Visual Studio Code",themeLabel:"Kimbie Dark"}},{extensionPath:"theme-monokai",packageJSON:{name:"theme-monokai",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},categories:["Themes"],contributes:{themes:[{id:"Monokai",label:"%themeLabel%",uiTheme:"vs-dark",path:"./themes/monokai-color-theme.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Monokai Theme",description:"Monokai theme for Visual Studio Code",themeLabel:"Monokai"}},{extensionPath:"theme-monokai-dimmed",packageJSON:{name:"theme-monokai-dimmed",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},categories:["Themes"],contributes:{themes:[{id:"Monokai Dimmed",label:"%themeLabel%",uiTheme:"vs-dark",path:"./themes/dimmed-monokai-color-theme.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Monokai Dimmed Theme",description:"Monokai dimmed theme for Visual Studio Code",themeLabel:"Monokai Dimmed"}},{extensionPath:"theme-quietlight",packageJSON:{name:"theme-quietlight",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},categories:["Themes"],contributes:{themes:[{id:"Quiet Light",label:"%themeLabel%",uiTheme:"vs",path:"./themes/quietlight-color-theme.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Quiet Light Theme",description:"Quiet light theme for Visual Studio Code",themeLabel:"Quiet Light"}},{extensionPath:"theme-red",packageJSON:{name:"theme-red",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},categories:["Themes"],contributes:{themes:[{id:"Red",label:"%themeLabel%",uiTheme:"vs-dark",path:"./themes/Red-color-theme.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Red Theme",description:"Red theme for Visual Studio Code",themeLabel:"Red"}},{extensionPath:"theme-seti",packageJSON:{name:"vscode-theme-seti",private:!0,version:"10.0.0",displayName:"%displayName%",description:"%description%",publisher:"vscode",license:"MIT",icon:"icons/seti-circular-128x128.png",scripts:{update:"node ./build/update-icon-theme.js"},engines:{vscode:"*"},categories:["Themes"],contributes:{iconThemes:[{id:"vs-seti",label:"%themeLabel%",path:"./icons/vs-seti-icon-theme.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Seti File Icon Theme",description:"A file icon theme made out of the Seti UI file icons",themeLabel:"Seti (Visual Studio Code)"},readmePath:"theme-seti\\README.md"},{extensionPath:"theme-solarized-dark",packageJSON:{name:"theme-solarized-dark",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},categories:["Themes"],contributes:{themes:[{id:"Solarized Dark",label:"%themeLabel%",uiTheme:"vs-dark",path:"./themes/solarized-dark-color-theme.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Solarized Dark Theme",description:"Solarized dark theme for Visual Studio Code",themeLabel:"Solarized Dark"}},{extensionPath:"theme-solarized-light",packageJSON:{name:"theme-solarized-light",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},categories:["Themes"],contributes:{themes:[{id:"Solarized Light",label:"%themeLabel%",uiTheme:"vs",path:"./themes/solarized-light-color-theme.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Solarized Light Theme",description:"Solarized light theme for Visual Studio Code",themeLabel:"Solarized Light"}},{extensionPath:"theme-tomorrow-night-blue",packageJSON:{name:"theme-tomorrow-night-blue",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},categories:["Themes"],contributes:{themes:[{id:"Tomorrow Night Blue",label:"%themeLabel%",uiTheme:"vs-dark",path:"./themes/tomorrow-night-blue-color-theme.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Tomorrow Night Blue Theme",description:"Tomorrow night blue theme for Visual Studio Code",themeLabel:"Tomorrow Night Blue"}},{extensionPath:"typescript-basics",packageJSON:{name:"typescript",description:"%description%",displayName:"%displayName%",version:"10.0.0",author:"vscode",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ./build/update-grammars.mjs"},categories:["Programming Languages"],contributes:{languages:[{id:"typescript",aliases:["TypeScript","ts","typescript"],extensions:[".ts",".cts",".mts"],firstLine:"^#!.*\\b(deno|bun|ts-node)\\b",configuration:"./language-configuration.json"},{id:"typescriptreact",aliases:["TypeScript JSX","TypeScript React","tsx"],extensions:[".tsx"],configuration:"./language-configuration.json"},{id:"jsonc",filenames:["tsconfig.json","jsconfig.json"],filenamePatterns:["tsconfig.*.json","jsconfig.*.json","tsconfig-*.json","jsconfig-*.json"]},{id:"json",extensions:[".tsbuildinfo"]}],grammars:[{language:"typescript",scopeName:"source.ts",path:"./syntaxes/TypeScript.tmLanguage.json",unbalancedBracketScopes:["keyword.operator.relational","storage.type.function.arrow","keyword.operator.bitwise.shift","meta.brace.angle","punctuation.definition.tag","keyword.operator.assignment.compound.bitwise.ts"],tokenTypes:{"punctuation.definition.template-expression":"other","entity.name.type.instance.jsdoc":"other","entity.name.function.tagged-template":"other","meta.import string.quoted":"other","variable.other.jsdoc":"other"}},{language:"typescriptreact",scopeName:"source.tsx",path:"./syntaxes/TypeScriptReact.tmLanguage.json",unbalancedBracketScopes:["keyword.operator.relational","storage.type.function.arrow","keyword.operator.bitwise.shift","punctuation.definition.tag","keyword.operator.assignment.compound.bitwise.ts"],embeddedLanguages:{"meta.tag.tsx":"jsx-tags","meta.tag.without-attributes.tsx":"jsx-tags","meta.tag.attributes.tsx":"typescriptreact","meta.embedded.expression.tsx":"typescriptreact"},tokenTypes:{"punctuation.definition.template-expression":"other","entity.name.type.instance.jsdoc":"other","entity.name.function.tagged-template":"other","meta.import string.quoted":"other","variable.other.jsdoc":"other"}},{scopeName:"documentation.injection.ts",path:"./syntaxes/jsdoc.ts.injection.tmLanguage.json",injectTo:["source.ts","source.tsx"]},{scopeName:"documentation.injection.js.jsx",path:"./syntaxes/jsdoc.js.injection.tmLanguage.json",injectTo:["source.js","source.js.jsx"]}],semanticTokenScopes:[{language:"typescript",scopes:{property:["variable.other.property.ts"],"property.readonly":["variable.other.constant.property.ts"],variable:["variable.other.readwrite.ts"],"variable.readonly":["variable.other.constant.object.ts"],function:["entity.name.function.ts"],namespace:["entity.name.type.module.ts"],"variable.defaultLibrary":["support.variable.ts"],"function.defaultLibrary":["support.function.ts"]}},{language:"typescriptreact",scopes:{property:["variable.other.property.tsx"],"property.readonly":["variable.other.constant.property.tsx"],variable:["variable.other.readwrite.tsx"],"variable.readonly":["variable.other.constant.object.tsx"],function:["entity.name.function.tsx"],namespace:["entity.name.type.module.tsx"],"variable.defaultLibrary":["support.variable.tsx"],"function.defaultLibrary":["support.function.tsx"]}}],snippets:[{language:"typescript",path:"./snippets/typescript.code-snippets"},{language:"typescriptreact",path:"./snippets/typescript.code-snippets"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"TypeScript Language Basics",description:"Provides snippets, syntax highlighting, bracket matching and folding in TypeScript files."}},{extensionPath:"typescript-language-features",packageJSON:{name:"typescript-language-features",description:"%description%",displayName:"%displayName%",version:"10.0.0",author:"vscode",publisher:"vscode",license:"MIT",aiKey:"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",enabledApiProposals:["workspaceTrust","multiDocumentHighlightProvider","codeActionAI","codeActionRanges","editorHoverVerbosityLevel"],capabilities:{virtualWorkspaces:{supported:"limited",description:"%virtualWorkspaces%"},untrustedWorkspaces:{supported:"limited",description:"%workspaceTrust%",restrictedConfigurations:["typescript.tsdk","js/ts.tsdk.path","typescript.tsserver.pluginPaths","js/ts.tsserver.pluginPaths","typescript.npm","js/ts.tsserver.npm.path","typescript.tsserver.nodePath","js/ts.tsserver.node.path","js/ts.tsserver.diagnosticDir","js/ts.tsserver.heapProfile"]}},engines:{vscode:"^1.30.0"},icon:"media/icon.png",categories:["Programming Languages"],activationEvents:["onLanguage:javascript","onLanguage:javascriptreact","onLanguage:typescript","onLanguage:typescriptreact","onLanguage:jsx-tags","onCommand:typescript.tsserverRequest","onCommand:_typescript.configurePlugin","onCommand:_typescript.learnMoreAboutRefactorings","onCommand:typescript.fileReferences","onTaskType:typescript","onLanguage:jsonc","onWalkthrough:nodejsWelcome"],main:"./dist/extension",browser:"./dist/browser/extension",contributes:{jsonValidation:[{fileMatch:"package.json",url:"./schemas/package.schema.json"},{fileMatch:"tsconfig.json",url:"https://www.schemastore.org/tsconfig"},{fileMatch:"tsconfig.json",url:"./schemas/tsconfig.schema.json"},{fileMatch:"tsconfig.*.json",url:"https://www.schemastore.org/tsconfig"},{fileMatch:"tsconfig-*.json",url:"./schemas/tsconfig.schema.json"},{fileMatch:"tsconfig-*.json",url:"https://www.schemastore.org/tsconfig"},{fileMatch:"tsconfig.*.json",url:"./schemas/tsconfig.schema.json"},{fileMatch:"typings.json",url:"https://www.schemastore.org/typings"},{fileMatch:".bowerrc",url:"https://www.schemastore.org/bowerrc"},{fileMatch:".babelrc",url:"https://www.schemastore.org/babelrc"},{fileMatch:".babelrc.json",url:"https://www.schemastore.org/babelrc"},{fileMatch:"babel.config.json",url:"https://www.schemastore.org/babelrc"},{fileMatch:"jsconfig.json",url:"https://www.schemastore.org/jsconfig"},{fileMatch:"jsconfig.json",url:"./schemas/jsconfig.schema.json"},{fileMatch:"jsconfig.*.json",url:"https://www.schemastore.org/jsconfig"},{fileMatch:"jsconfig.*.json",url:"./schemas/jsconfig.schema.json"},{fileMatch:".swcrc",url:"https://swc.rs/schema.json"},{fileMatch:"typedoc.json",url:"https://typedoc.org/schema.json"}],configuration:[{type:"object",properties:{"js/ts.tsdk.path":{type:"string",markdownDescription:"%typescript.tsdk.desc%",scope:"window",order:1,keywords:["TypeScript"]},"typescript.tsdk":{type:"string",markdownDescription:"%typescript.tsdk.desc%",markdownDeprecationMessage:"%typescript.tsdk.unifiedDeprecationMessage%",scope:"window",order:1},"js/ts.experimental.useTsgo":{type:"boolean",default:!1,markdownDescription:"%typescript.useTsgo%",scope:"window",order:2,keywords:["TypeScript","experimental"]},"typescript.experimental.useTsgo":{type:"boolean",default:!1,markdownDescription:"%typescript.useTsgo%",markdownDeprecationMessage:"%typescript.useTsgo.unifiedDeprecationMessage%",scope:"window",order:2,keywords:["experimental"]},"js/ts.locale":{type:"string",default:"auto",enum:["auto","de","es","en","fr","it","ja","ko","ru","zh-CN","zh-TW"],enumDescriptions:["%typescript.locale.auto%","Deutsch","espa\xF1ol","English","fran\xE7ais","italiano","\u65E5\u672C\u8A9E","\uD55C\uAD6D\uC5B4","\u0440\u0443\u0441\u0441\u043A\u0438\u0439","\u4E2D\u6587(\u7B80\u4F53)","\u4E2D\u6587(\u7E41\u9AD4)"],markdownDescription:"%typescript.locale%",scope:"window",order:3,keywords:["TypeScript"]},"typescript.locale":{type:"string",default:"auto",enum:["auto","de","es","en","fr","it","ja","ko","ru","zh-CN","zh-TW"],enumDescriptions:["%typescript.locale.auto%","Deutsch","espa\xF1ol","English","fran\xE7ais","italiano","\u65E5\u672C\u8A9E","\uD55C\uAD6D\uC5B4","\u0440\u0443\u0441\u0441\u043A\u0438\u0439","\u4E2D\u6587(\u7B80\u4F53)","\u4E2D\u6587(\u7E41\u9AD4)"],markdownDescription:"%typescript.locale%",markdownDeprecationMessage:"%typescript.locale.unifiedDeprecationMessage%",scope:"window",order:3},"js/ts.tsc.autoDetect":{type:"string",default:"on",enum:["on","off","build","watch"],markdownEnumDescriptions:["%typescript.tsc.autoDetect.on%","%typescript.tsc.autoDetect.off%","%typescript.tsc.autoDetect.build%","%typescript.tsc.autoDetect.watch%"],description:"%typescript.tsc.autoDetect%",scope:"window",order:4,keywords:["TypeScript"]},"typescript.tsc.autoDetect":{type:"string",default:"on",enum:["on","off","build","watch"],markdownEnumDescriptions:["%typescript.tsc.autoDetect.on%","%typescript.tsc.autoDetect.off%","%typescript.tsc.autoDetect.build%","%typescript.tsc.autoDetect.watch%"],description:"%typescript.tsc.autoDetect%",markdownDeprecationMessage:"%typescript.tsc.autoDetect.unifiedDeprecationMessage%",scope:"window",order:4}}},{type:"object",title:"%configuration.preferences%",properties:{"js/ts.preferences.quoteStyle":{type:"string",enum:["auto","single","double"],default:"auto",markdownDescription:"%typescript.preferences.quoteStyle%",markdownEnumDescriptions:["%typescript.preferences.quoteStyle.auto%","%typescript.preferences.quoteStyle.single%","%typescript.preferences.quoteStyle.double%"],scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.preferences.quoteStyle":{type:"string",enum:["auto","single","double"],default:"auto",markdownDescription:"%typescript.preferences.quoteStyle%",markdownEnumDescriptions:["%typescript.preferences.quoteStyle.auto%","%typescript.preferences.quoteStyle.single%","%typescript.preferences.quoteStyle.double%"],markdownDeprecationMessage:"%configuration.preferences.quoteStyle.unifiedDeprecationMessage%",scope:"language-overridable"},"typescript.preferences.quoteStyle":{type:"string",enum:["auto","single","double"],default:"auto",markdownDescription:"%typescript.preferences.quoteStyle%",markdownEnumDescriptions:["%typescript.preferences.quoteStyle.auto%","%typescript.preferences.quoteStyle.single%","%typescript.preferences.quoteStyle.double%"],markdownDeprecationMessage:"%configuration.preferences.quoteStyle.unifiedDeprecationMessage%",scope:"language-overridable"},"js/ts.preferences.importModuleSpecifier":{type:"string",enum:["shortest","relative","non-relative","project-relative"],markdownEnumDescriptions:["%typescript.preferences.importModuleSpecifier.shortest%","%typescript.preferences.importModuleSpecifier.relative%","%typescript.preferences.importModuleSpecifier.nonRelative%","%typescript.preferences.importModuleSpecifier.projectRelative%"],default:"shortest",description:"%typescript.preferences.importModuleSpecifier%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.preferences.importModuleSpecifier":{type:"string",enum:["shortest","relative","non-relative","project-relative"],markdownEnumDescriptions:["%typescript.preferences.importModuleSpecifier.shortest%","%typescript.preferences.importModuleSpecifier.relative%","%typescript.preferences.importModuleSpecifier.nonRelative%","%typescript.preferences.importModuleSpecifier.projectRelative%"],default:"shortest",description:"%typescript.preferences.importModuleSpecifier%",markdownDeprecationMessage:"%configuration.preferences.importModuleSpecifier.unifiedDeprecationMessage%",scope:"language-overridable"},"typescript.preferences.importModuleSpecifier":{type:"string",enum:["shortest","relative","non-relative","project-relative"],markdownEnumDescriptions:["%typescript.preferences.importModuleSpecifier.shortest%","%typescript.preferences.importModuleSpecifier.relative%","%typescript.preferences.importModuleSpecifier.nonRelative%","%typescript.preferences.importModuleSpecifier.projectRelative%"],default:"shortest",description:"%typescript.preferences.importModuleSpecifier%",markdownDeprecationMessage:"%configuration.preferences.importModuleSpecifier.unifiedDeprecationMessage%",scope:"language-overridable"},"js/ts.preferences.importModuleSpecifierEnding":{type:"string",enum:["auto","minimal","index","js"],enumItemLabels:[null,null,null,"%typescript.preferences.importModuleSpecifierEnding.label.js%"],markdownEnumDescriptions:["%typescript.preferences.importModuleSpecifierEnding.auto%","%typescript.preferences.importModuleSpecifierEnding.minimal%","%typescript.preferences.importModuleSpecifierEnding.index%","%typescript.preferences.importModuleSpecifierEnding.js%"],default:"auto",description:"%typescript.preferences.importModuleSpecifierEnding%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.preferences.importModuleSpecifierEnding":{type:"string",enum:["auto","minimal","index","js"],enumItemLabels:[null,null,null,"%typescript.preferences.importModuleSpecifierEnding.label.js%"],markdownEnumDescriptions:["%typescript.preferences.importModuleSpecifierEnding.auto%","%typescript.preferences.importModuleSpecifierEnding.minimal%","%typescript.preferences.importModuleSpecifierEnding.index%","%typescript.preferences.importModuleSpecifierEnding.js%"],default:"auto",description:"%typescript.preferences.importModuleSpecifierEnding%",markdownDeprecationMessage:"%configuration.preferences.importModuleSpecifierEnding.unifiedDeprecationMessage%",scope:"language-overridable"},"typescript.preferences.importModuleSpecifierEnding":{type:"string",enum:["auto","minimal","index","js"],enumItemLabels:[null,null,null,"%typescript.preferences.importModuleSpecifierEnding.label.js%"],markdownEnumDescriptions:["%typescript.preferences.importModuleSpecifierEnding.auto%","%typescript.preferences.importModuleSpecifierEnding.minimal%","%typescript.preferences.importModuleSpecifierEnding.index%","%typescript.preferences.importModuleSpecifierEnding.js%"],default:"auto",description:"%typescript.preferences.importModuleSpecifierEnding%",markdownDeprecationMessage:"%configuration.preferences.importModuleSpecifierEnding.unifiedDeprecationMessage%",scope:"language-overridable"},"js/ts.preferences.jsxAttributeCompletionStyle":{type:"string",enum:["auto","braces","none"],markdownEnumDescriptions:["%configuration.preferences.jsxAttributeCompletionStyle.auto%","%typescript.preferences.jsxAttributeCompletionStyle.braces%","%typescript.preferences.jsxAttributeCompletionStyle.none%"],default:"auto",description:"%typescript.preferences.jsxAttributeCompletionStyle%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.preferences.jsxAttributeCompletionStyle":{type:"string",enum:["auto","braces","none"],markdownEnumDescriptions:["%javascript.preferences.jsxAttributeCompletionStyle.auto%","%typescript.preferences.jsxAttributeCompletionStyle.braces%","%typescript.preferences.jsxAttributeCompletionStyle.none%"],default:"auto",description:"%typescript.preferences.jsxAttributeCompletionStyle%",markdownDeprecationMessage:"%configuration.preferences.jsxAttributeCompletionStyle.unifiedDeprecationMessage%",scope:"language-overridable"},"typescript.preferences.jsxAttributeCompletionStyle":{type:"string",enum:["auto","braces","none"],markdownEnumDescriptions:["%typescript.preferences.jsxAttributeCompletionStyle.auto%","%typescript.preferences.jsxAttributeCompletionStyle.braces%","%typescript.preferences.jsxAttributeCompletionStyle.none%"],default:"auto",description:"%typescript.preferences.jsxAttributeCompletionStyle%",markdownDeprecationMessage:"%configuration.preferences.jsxAttributeCompletionStyle.unifiedDeprecationMessage%",scope:"language-overridable"},"js/ts.preferences.includePackageJsonAutoImports":{type:"string",enum:["auto","on","off"],enumDescriptions:["%typescript.preferences.includePackageJsonAutoImports.auto%","%typescript.preferences.includePackageJsonAutoImports.on%","%typescript.preferences.includePackageJsonAutoImports.off%"],default:"auto",markdownDescription:"%typescript.preferences.includePackageJsonAutoImports%",scope:"window",keywords:["TypeScript"]},"typescript.preferences.includePackageJsonAutoImports":{type:"string",enum:["auto","on","off"],enumDescriptions:["%typescript.preferences.includePackageJsonAutoImports.auto%","%typescript.preferences.includePackageJsonAutoImports.on%","%typescript.preferences.includePackageJsonAutoImports.off%"],default:"auto",markdownDescription:"%typescript.preferences.includePackageJsonAutoImports%",markdownDeprecationMessage:"%configuration.preferences.includePackageJsonAutoImports.unifiedDeprecationMessage%",scope:"window"},"js/ts.preferences.autoImportFileExcludePatterns":{type:"array",items:{type:"string"},markdownDescription:"%typescript.preferences.autoImportFileExcludePatterns%",scope:"resource",keywords:["JavaScript","TypeScript"]},"javascript.preferences.autoImportFileExcludePatterns":{type:"array",items:{type:"string"},markdownDescription:"%typescript.preferences.autoImportFileExcludePatterns%",markdownDeprecationMessage:"%configuration.preferences.autoImportFileExcludePatterns.unifiedDeprecationMessage%",scope:"resource"},"typescript.preferences.autoImportFileExcludePatterns":{type:"array",items:{type:"string"},markdownDescription:"%typescript.preferences.autoImportFileExcludePatterns%",markdownDeprecationMessage:"%configuration.preferences.autoImportFileExcludePatterns.unifiedDeprecationMessage%",scope:"resource"},"js/ts.preferences.autoImportSpecifierExcludeRegexes":{type:"array",items:{type:"string"},markdownDescription:"%typescript.preferences.autoImportSpecifierExcludeRegexes%",scope:"resource",keywords:["JavaScript","TypeScript"]},"javascript.preferences.autoImportSpecifierExcludeRegexes":{type:"array",items:{type:"string"},markdownDescription:"%typescript.preferences.autoImportSpecifierExcludeRegexes%",markdownDeprecationMessage:"%configuration.preferences.autoImportSpecifierExcludeRegexes.unifiedDeprecationMessage%",scope:"resource"},"typescript.preferences.autoImportSpecifierExcludeRegexes":{type:"array",items:{type:"string"},markdownDescription:"%typescript.preferences.autoImportSpecifierExcludeRegexes%",markdownDeprecationMessage:"%configuration.preferences.autoImportSpecifierExcludeRegexes.unifiedDeprecationMessage%",scope:"resource"},"js/ts.preferences.preferTypeOnlyAutoImports":{type:"boolean",default:!1,markdownDescription:"%typescript.preferences.preferTypeOnlyAutoImports%",scope:"resource",keywords:["TypeScript"]},"typescript.preferences.preferTypeOnlyAutoImports":{type:"boolean",default:!1,markdownDescription:"%typescript.preferences.preferTypeOnlyAutoImports%",markdownDeprecationMessage:"%configuration.preferences.preferTypeOnlyAutoImports.unifiedDeprecationMessage%",scope:"resource"},"js/ts.preferences.useAliasesForRenames":{type:"boolean",default:!0,description:"%typescript.preferences.useAliasesForRenames%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.preferences.useAliasesForRenames":{type:"boolean",default:!0,description:"%typescript.preferences.useAliasesForRenames%",markdownDeprecationMessage:"%configuration.preferences.useAliasesForRenames.unifiedDeprecationMessage%",scope:"language-overridable"},"typescript.preferences.useAliasesForRenames":{type:"boolean",default:!0,description:"%typescript.preferences.useAliasesForRenames%",markdownDeprecationMessage:"%configuration.preferences.useAliasesForRenames.unifiedDeprecationMessage%",scope:"language-overridable"},"js/ts.preferences.renameMatchingJsxTags":{type:"boolean",default:!0,description:"%typescript.preferences.renameMatchingJsxTags%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.preferences.renameMatchingJsxTags":{type:"boolean",default:!0,description:"%typescript.preferences.renameMatchingJsxTags%",markdownDeprecationMessage:"%configuration.preferences.renameMatchingJsxTags.unifiedDeprecationMessage%",scope:"language-overridable"},"typescript.preferences.renameMatchingJsxTags":{type:"boolean",default:!0,description:"%typescript.preferences.renameMatchingJsxTags%",markdownDeprecationMessage:"%configuration.preferences.renameMatchingJsxTags.unifiedDeprecationMessage%",scope:"language-overridable"},"js/ts.preferences.organizeImports":{type:"object",markdownDescription:"%typescript.preferences.organizeImports%",properties:{caseSensitivity:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.caseSensitivity%",enum:["auto","caseInsensitive","caseSensitive"],markdownEnumDescriptions:["%typescript.preferences.organizeImports.caseSensitivity.auto%","%typescript.preferences.organizeImports.caseSensitivity.insensitive%","%typescript.preferences.organizeImports.caseSensitivity.sensitive%"],default:"auto"},typeOrder:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.typeOrder%",enum:["auto","last","inline","first"],default:"auto",markdownEnumDescriptions:["%typescript.preferences.organizeImports.typeOrder.auto%","%typescript.preferences.organizeImports.typeOrder.last%","%typescript.preferences.organizeImports.typeOrder.inline%","%typescript.preferences.organizeImports.typeOrder.first%"]},unicodeCollation:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.unicodeCollation%",enum:["ordinal","unicode"],markdownEnumDescriptions:["%typescript.preferences.organizeImports.unicodeCollation.ordinal%","%typescript.preferences.organizeImports.unicodeCollation.unicode%"],default:"ordinal"},locale:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.locale%"},numericCollation:{type:"boolean",markdownDescription:"%typescript.preferences.organizeImports.numericCollation%"},accentCollation:{type:"boolean",markdownDescription:"%typescript.preferences.organizeImports.accentCollation%"},caseFirst:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.caseFirst%",enum:["default","upper","lower"],markdownEnumDescriptions:["%typescript.preferences.organizeImports.caseFirst.default%","%typescript.preferences.organizeImports.caseFirst.upper%","%typescript.preferences.organizeImports.caseFirst.lower%"],default:"default"}},keywords:["JavaScript","TypeScript"]},"javascript.preferences.organizeImports":{type:"object",markdownDescription:"%typescript.preferences.organizeImports%",markdownDeprecationMessage:"%configuration.preferences.organizeImports.unifiedDeprecationMessage%",properties:{caseSensitivity:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.caseSensitivity%",enum:["auto","caseInsensitive","caseSensitive"],markdownEnumDescriptions:["%typescript.preferences.organizeImports.caseSensitivity.auto%","%typescript.preferences.organizeImports.caseSensitivity.insensitive%","%typescript.preferences.organizeImports.caseSensitivity.sensitive%"],default:"auto"},typeOrder:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.typeOrder%",enum:["auto","last","inline","first"],default:"auto",markdownEnumDescriptions:["%typescript.preferences.organizeImports.typeOrder.auto%","%typescript.preferences.organizeImports.typeOrder.last%","%typescript.preferences.organizeImports.typeOrder.inline%","%typescript.preferences.organizeImports.typeOrder.first%"]},unicodeCollation:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.unicodeCollation%",enum:["ordinal","unicode"],markdownEnumDescriptions:["%typescript.preferences.organizeImports.unicodeCollation.ordinal%","%typescript.preferences.organizeImports.unicodeCollation.unicode%"],default:"ordinal"},locale:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.locale%"},numericCollation:{type:"boolean",markdownDescription:"%typescript.preferences.organizeImports.numericCollation%"},accentCollation:{type:"boolean",markdownDescription:"%typescript.preferences.organizeImports.accentCollation%"},caseFirst:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.caseFirst%",enum:["default","upper","lower"],markdownEnumDescriptions:["%typescript.preferences.organizeImports.caseFirst.default%","%typescript.preferences.organizeImports.caseFirst.upper%","%typescript.preferences.organizeImports.caseFirst.lower%"],default:"default"}}},"typescript.preferences.organizeImports":{type:"object",markdownDescription:"%typescript.preferences.organizeImports%",markdownDeprecationMessage:"%configuration.preferences.organizeImports.unifiedDeprecationMessage%",properties:{caseSensitivity:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.caseSensitivity%",enum:["auto","caseInsensitive","caseSensitive"],markdownEnumDescriptions:["%typescript.preferences.organizeImports.caseSensitivity.auto%","%typescript.preferences.organizeImports.caseSensitivity.insensitive","%typescript.preferences.organizeImports.caseSensitivity.sensitive%"],default:"auto"},typeOrder:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.typeOrder%",enum:["auto","last","inline","first"],default:"auto",markdownEnumDescriptions:["%typescript.preferences.organizeImports.typeOrder.auto%","%typescript.preferences.organizeImports.typeOrder.last%","%typescript.preferences.organizeImports.typeOrder.inline%","%typescript.preferences.organizeImports.typeOrder.first%"]},unicodeCollation:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.unicodeCollation%",enum:["ordinal","unicode"],markdownEnumDescriptions:["%typescript.preferences.organizeImports.unicodeCollation.ordinal%","%typescript.preferences.organizeImports.unicodeCollation.unicode%"],default:"ordinal"},locale:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.locale%"},numericCollation:{type:"boolean",markdownDescription:"%typescript.preferences.organizeImports.numericCollation%"},accentCollation:{type:"boolean",markdownDescription:"%typescript.preferences.organizeImports.accentCollation%"},caseFirst:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.caseFirst%",enum:["default","upper","lower"],markdownEnumDescriptions:["%typescript.preferences.organizeImports.caseFirst.default%","%typescript.preferences.organizeImports.caseFirst.upper%","%typescript.preferences.organizeImports.caseFirst.lower%"],default:"default"}}}}},{type:"object",title:"%configuration.format%",properties:{"js/ts.format.enabled":{type:"boolean",default:!0,description:"%format.enable%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.enable":{type:"boolean",default:!0,description:"%javascript.format.enable%",markdownDeprecationMessage:"%configuration.format.enable.unifiedDeprecationMessage%",scope:"window"},"typescript.format.enable":{type:"boolean",default:!0,description:"%typescript.format.enable%",markdownDeprecationMessage:"%configuration.format.enable.unifiedDeprecationMessage%",scope:"window"},"js/ts.format.insertSpaceAfterCommaDelimiter":{type:"boolean",default:!0,description:"%format.insertSpaceAfterCommaDelimiter%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceAfterCommaDelimiter":{type:"boolean",default:!0,description:"%format.insertSpaceAfterCommaDelimiter%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterCommaDelimiter.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceAfterCommaDelimiter":{type:"boolean",default:!0,description:"%format.insertSpaceAfterCommaDelimiter%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterCommaDelimiter.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceAfterConstructor":{type:"boolean",default:!1,description:"%format.insertSpaceAfterConstructor%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceAfterConstructor":{type:"boolean",default:!1,description:"%format.insertSpaceAfterConstructor%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterConstructor.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceAfterConstructor":{type:"boolean",default:!1,description:"%format.insertSpaceAfterConstructor%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterConstructor.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceAfterSemicolonInForStatements":{type:"boolean",default:!0,description:"%format.insertSpaceAfterSemicolonInForStatements%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceAfterSemicolonInForStatements":{type:"boolean",default:!0,description:"%format.insertSpaceAfterSemicolonInForStatements%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterSemicolonInForStatements.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceAfterSemicolonInForStatements":{type:"boolean",default:!0,description:"%format.insertSpaceAfterSemicolonInForStatements%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterSemicolonInForStatements.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceBeforeAndAfterBinaryOperators":{type:"boolean",default:!0,description:"%format.insertSpaceBeforeAndAfterBinaryOperators%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceBeforeAndAfterBinaryOperators":{type:"boolean",default:!0,description:"%format.insertSpaceBeforeAndAfterBinaryOperators%",markdownDeprecationMessage:"%configuration.format.insertSpaceBeforeAndAfterBinaryOperators.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceBeforeAndAfterBinaryOperators":{type:"boolean",default:!0,description:"%format.insertSpaceBeforeAndAfterBinaryOperators%",markdownDeprecationMessage:"%configuration.format.insertSpaceBeforeAndAfterBinaryOperators.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceAfterKeywordsInControlFlowStatements":{type:"boolean",default:!0,description:"%format.insertSpaceAfterKeywordsInControlFlowStatements%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceAfterKeywordsInControlFlowStatements":{type:"boolean",default:!0,description:"%format.insertSpaceAfterKeywordsInControlFlowStatements%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterKeywordsInControlFlowStatements.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceAfterKeywordsInControlFlowStatements":{type:"boolean",default:!0,description:"%format.insertSpaceAfterKeywordsInControlFlowStatements%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterKeywordsInControlFlowStatements.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions":{type:"boolean",default:!0,description:"%format.insertSpaceAfterFunctionKeywordForAnonymousFunctions%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions":{type:"boolean",default:!0,description:"%format.insertSpaceAfterFunctionKeywordForAnonymousFunctions%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions":{type:"boolean",default:!0,description:"%format.insertSpaceAfterFunctionKeywordForAnonymousFunctions%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceBeforeFunctionParenthesis":{type:"boolean",default:!1,description:"%format.insertSpaceBeforeFunctionParenthesis%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceBeforeFunctionParenthesis":{type:"boolean",default:!1,description:"%format.insertSpaceBeforeFunctionParenthesis%",markdownDeprecationMessage:"%configuration.format.insertSpaceBeforeFunctionParenthesis.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceBeforeFunctionParenthesis":{type:"boolean",default:!1,description:"%format.insertSpaceBeforeFunctionParenthesis%",markdownDeprecationMessage:"%configuration.format.insertSpaceBeforeFunctionParenthesis.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis":{type:"boolean",default:!1,description:"%format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis":{type:"boolean",default:!1,description:"%format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis":{type:"boolean",default:!1,description:"%format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets":{type:"boolean",default:!1,description:"%format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets":{type:"boolean",default:!1,description:"%format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets":{type:"boolean",default:!1,description:"%format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces":{type:"boolean",default:!0,description:"%format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces":{type:"boolean",default:!0,description:"%format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces":{type:"boolean",default:!0,description:"%format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces":{type:"boolean",default:!0,description:"%format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces":{type:"boolean",default:!0,description:"%format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces":{type:"boolean",default:!0,description:"%format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces":{type:"boolean",default:!1,description:"%format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces":{type:"boolean",default:!1,description:"%format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces":{type:"boolean",default:!1,description:"%format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces":{type:"boolean",default:!1,description:"%format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces":{type:"boolean",default:!1,description:"%format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces":{type:"boolean",default:!1,description:"%format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceAfterTypeAssertion":{type:"boolean",default:!1,description:"%format.insertSpaceAfterTypeAssertion%",scope:"language-overridable",keywords:["TypeScript"]},"typescript.format.insertSpaceAfterTypeAssertion":{type:"boolean",default:!1,description:"%format.insertSpaceAfterTypeAssertion%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterTypeAssertion.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.placeOpenBraceOnNewLineForFunctions":{type:"boolean",default:!1,description:"%format.placeOpenBraceOnNewLineForFunctions%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.placeOpenBraceOnNewLineForFunctions":{type:"boolean",default:!1,description:"%format.placeOpenBraceOnNewLineForFunctions%",markdownDeprecationMessage:"%configuration.format.placeOpenBraceOnNewLineForFunctions.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.placeOpenBraceOnNewLineForFunctions":{type:"boolean",default:!1,description:"%format.placeOpenBraceOnNewLineForFunctions%",markdownDeprecationMessage:"%configuration.format.placeOpenBraceOnNewLineForFunctions.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.placeOpenBraceOnNewLineForControlBlocks":{type:"boolean",default:!1,description:"%format.placeOpenBraceOnNewLineForControlBlocks%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.placeOpenBraceOnNewLineForControlBlocks":{type:"boolean",default:!1,description:"%format.placeOpenBraceOnNewLineForControlBlocks%",markdownDeprecationMessage:"%configuration.format.placeOpenBraceOnNewLineForControlBlocks.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.placeOpenBraceOnNewLineForControlBlocks":{type:"boolean",default:!1,description:"%format.placeOpenBraceOnNewLineForControlBlocks%",markdownDeprecationMessage:"%configuration.format.placeOpenBraceOnNewLineForControlBlocks.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.semicolons":{type:"string",default:"ignore",description:"%format.semicolons%",scope:"language-overridable",enum:["ignore","insert","remove"],enumDescriptions:["%format.semicolons.ignore%","%format.semicolons.insert%","%format.semicolons.remove%"],keywords:["JavaScript","TypeScript"]},"javascript.format.semicolons":{type:"string",default:"ignore",description:"%format.semicolons%",markdownDeprecationMessage:"%configuration.format.semicolons.unifiedDeprecationMessage%",scope:"resource",enum:["ignore","insert","remove"],enumDescriptions:["%format.semicolons.ignore%","%format.semicolons.insert%","%format.semicolons.remove%"]},"typescript.format.semicolons":{type:"string",default:"ignore",description:"%format.semicolons%",markdownDeprecationMessage:"%configuration.format.semicolons.unifiedDeprecationMessage%",scope:"resource",enum:["ignore","insert","remove"],enumDescriptions:["%format.semicolons.ignore%","%format.semicolons.insert%","%format.semicolons.remove%"]},"js/ts.format.indentSwitchCase":{type:"boolean",default:!0,description:"%format.indentSwitchCase%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.indentSwitchCase":{type:"boolean",default:!0,description:"%format.indentSwitchCase%",markdownDeprecationMessage:"%configuration.format.indentSwitchCase.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.indentSwitchCase":{type:"boolean",default:!0,description:"%format.indentSwitchCase%",markdownDeprecationMessage:"%configuration.format.indentSwitchCase.unifiedDeprecationMessage%",scope:"resource"}}},{type:"object",title:"%configuration.validation%",properties:{"js/ts.validate.enabled":{type:"boolean",default:!0,description:"%configuration.validate.enable%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"typescript.validate.enable":{type:"boolean",default:!0,description:"%typescript.validate.enable%",markdownDeprecationMessage:"%configuration.validate.enable.unifiedDeprecationMessage%",scope:"window"},"javascript.validate.enable":{type:"boolean",default:!0,description:"%javascript.validate.enable%",markdownDeprecationMessage:"%configuration.validate.enable.unifiedDeprecationMessage%",scope:"window"},"js/ts.reportStyleChecksAsWarnings":{type:"boolean",default:!0,description:"%typescript.reportStyleChecksAsWarnings%",scope:"window",keywords:["TypeScript"]},"typescript.reportStyleChecksAsWarnings":{type:"boolean",default:!0,description:"%typescript.reportStyleChecksAsWarnings%",markdownDeprecationMessage:"%configuration.reportStyleChecksAsWarnings.unifiedDeprecationMessage%",scope:"window"},"js/ts.suggestionActions.enabled":{type:"boolean",default:!0,description:"%configuration.suggestionActions.enabled%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.suggestionActions.enabled":{type:"boolean",default:!0,description:"%javascript.suggestionActions.enabled%",markdownDeprecationMessage:"%configuration.suggestionActions.enabled.unifiedDeprecationMessage%",scope:"resource"},"typescript.suggestionActions.enabled":{type:"boolean",default:!0,description:"%typescript.suggestionActions.enabled%",markdownDeprecationMessage:"%configuration.suggestionActions.enabled.unifiedDeprecationMessage%",scope:"resource"},"js/ts.tsserver.experimental.enableProjectDiagnostics":{type:"boolean",default:!1,description:"%configuration.tsserver.experimental.enableProjectDiagnostics%",scope:"window",keywords:["JavaScript","TypeScript","experimental"]},"typescript.tsserver.experimental.enableProjectDiagnostics":{type:"boolean",default:!1,description:"%configuration.tsserver.experimental.enableProjectDiagnostics%",markdownDeprecationMessage:"%configuration.tsserver.experimental.enableProjectDiagnostics.unifiedDeprecationMessage%",scope:"window",keywords:["experimental"]}}},{type:"object",title:"%configuration.implicitProjectConfig%",properties:{"js/ts.implicitProjectConfig.module":{type:"string",markdownDescription:"%configuration.implicitProjectConfig.module%",default:"ESNext",enum:["CommonJS","AMD","System","UMD","ES6","ES2015","ES2020","ESNext","None","ES2022","Node12","NodeNext"],scope:"window"},"js/ts.implicitProjectConfig.target":{type:"string",default:"ES2024",markdownDescription:"%configuration.implicitProjectConfig.target%",enum:["ES3","ES5","ES6","ES2015","ES2016","ES2017","ES2018","ES2019","ES2020","ES2021","ES2022","ES2023","ES2024","ESNext"],scope:"window"},"js/ts.implicitProjectConfig.checkJs":{type:"boolean",default:!1,markdownDescription:"%configuration.implicitProjectConfig.checkJs%",scope:"window"},"js/ts.implicitProjectConfig.experimentalDecorators":{type:"boolean",default:!1,markdownDescription:"%configuration.implicitProjectConfig.experimentalDecorators%",scope:"window"},"js/ts.implicitProjectConfig.strictNullChecks":{type:"boolean",default:!0,markdownDescription:"%configuration.implicitProjectConfig.strictNullChecks%",scope:"window"},"js/ts.implicitProjectConfig.strictFunctionTypes":{type:"boolean",default:!0,markdownDescription:"%configuration.implicitProjectConfig.strictFunctionTypes%",scope:"window"},"js/ts.implicitProjectConfig.strict":{type:"boolean",default:!0,markdownDescription:"%configuration.implicitProjectConfig.strict%",scope:"window"}}},{type:"object",title:"%configuration.languageFeatures%",properties:{"js/ts.updateImportsOnFileMove.enabled":{type:"string",enum:["prompt","always","never"],markdownEnumDescriptions:["%typescript.updateImportsOnFileMove.enabled.prompt%","%typescript.updateImportsOnFileMove.enabled.always%","%typescript.updateImportsOnFileMove.enabled.never%"],default:"prompt",description:"%typescript.updateImportsOnFileMove.enabled%",scope:"resource",keywords:["JavaScript","TypeScript"]},"typescript.updateImportsOnFileMove.enabled":{type:"string",enum:["prompt","always","never"],markdownEnumDescriptions:["%typescript.updateImportsOnFileMove.enabled.prompt%","%typescript.updateImportsOnFileMove.enabled.always%","%typescript.updateImportsOnFileMove.enabled.never%"],default:"prompt",description:"%typescript.updateImportsOnFileMove.enabled%",markdownDeprecationMessage:"%configuration.updateImportsOnFileMove.enabled.unifiedDeprecationMessage%",scope:"resource"},"javascript.updateImportsOnFileMove.enabled":{type:"string",enum:["prompt","always","never"],markdownEnumDescriptions:["%typescript.updateImportsOnFileMove.enabled.prompt%","%typescript.updateImportsOnFileMove.enabled.always%","%typescript.updateImportsOnFileMove.enabled.never%"],default:"prompt",description:"%typescript.updateImportsOnFileMove.enabled%",markdownDeprecationMessage:"%configuration.updateImportsOnFileMove.enabled.unifiedDeprecationMessage%",scope:"resource"},"js/ts.autoClosingTags.enabled":{type:"boolean",default:!0,description:"%typescript.autoClosingTags%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"typescript.autoClosingTags":{type:"boolean",default:!0,description:"%typescript.autoClosingTags%",markdownDeprecationMessage:"%configuration.autoClosingTags.enabled.unifiedDeprecationMessage%",scope:"language-overridable"},"javascript.autoClosingTags":{type:"boolean",default:!0,description:"%typescript.autoClosingTags%",markdownDeprecationMessage:"%configuration.autoClosingTags.enabled.unifiedDeprecationMessage%",scope:"language-overridable"},"js/ts.workspaceSymbols.scope":{type:"string",enum:["allOpenProjects","currentProject"],enumDescriptions:["%typescript.workspaceSymbols.scope.allOpenProjects%","%typescript.workspaceSymbols.scope.currentProject%"],default:"allOpenProjects",markdownDescription:"%typescript.workspaceSymbols.scope%",scope:"window",keywords:["TypeScript"]},"typescript.workspaceSymbols.scope":{type:"string",enum:["allOpenProjects","currentProject"],enumDescriptions:["%typescript.workspaceSymbols.scope.allOpenProjects%","%typescript.workspaceSymbols.scope.currentProject%"],default:"allOpenProjects",markdownDescription:"%typescript.workspaceSymbols.scope%",markdownDeprecationMessage:"%configuration.workspaceSymbols.scope.unifiedDeprecationMessage%",scope:"window"},"js/ts.preferGoToSourceDefinition":{type:"boolean",default:!1,description:"%configuration.preferGoToSourceDefinition%",scope:"window",keywords:["JavaScript","TypeScript"]},"typescript.preferGoToSourceDefinition":{type:"boolean",default:!1,description:"%configuration.preferGoToSourceDefinition%",markdownDeprecationMessage:"%configuration.preferGoToSourceDefinition.unifiedDeprecationMessage%",scope:"window"},"javascript.preferGoToSourceDefinition":{type:"boolean",default:!1,description:"%configuration.preferGoToSourceDefinition%",markdownDeprecationMessage:"%configuration.preferGoToSourceDefinition.unifiedDeprecationMessage%",scope:"window"},"js/ts.workspaceSymbols.excludeLibrarySymbols":{type:"boolean",default:!0,markdownDescription:"%typescript.workspaceSymbols.excludeLibrarySymbols%",scope:"window",keywords:["TypeScript"]},"typescript.workspaceSymbols.excludeLibrarySymbols":{type:"boolean",default:!0,markdownDescription:"%typescript.workspaceSymbols.excludeLibrarySymbols%",markdownDeprecationMessage:"%configuration.workspaceSymbols.excludeLibrarySymbols.unifiedDeprecationMessage%",scope:"window"},"js/ts.updateImportsOnPaste.enabled":{scope:"window",type:"boolean",default:!0,markdownDescription:"%configuration.updateImportsOnPaste%",keywords:["JavaScript","TypeScript"]},"javascript.updateImportsOnPaste.enabled":{scope:"window",type:"boolean",default:!0,markdownDescription:"%configuration.updateImportsOnPaste%",markdownDeprecationMessage:"%configuration.updateImportsOnPaste.enabled.unifiedDeprecationMessage%"},"typescript.updateImportsOnPaste.enabled":{scope:"window",type:"boolean",default:!0,markdownDescription:"%configuration.updateImportsOnPaste%",markdownDeprecationMessage:"%configuration.updateImportsOnPaste.enabled.unifiedDeprecationMessage%"},"js/ts.hover.maximumLength":{type:"number",default:500,description:"%configuration.hover.maximumLength%",scope:"resource"}}},{type:"object",title:"%configuration.suggest%",properties:{"js/ts.suggest.enabled":{type:"boolean",default:!0,description:"%typescript.suggest.enabled%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.suggest.enabled":{type:"boolean",default:!0,description:"%typescript.suggest.enabled%",markdownDeprecationMessage:"%configuration.suggest.enabled.unifiedDeprecationMessage%",scope:"language-overridable"},"typescript.suggest.enabled":{type:"boolean",default:!0,description:"%typescript.suggest.enabled%",markdownDeprecationMessage:"%configuration.suggest.enabled.unifiedDeprecationMessage%",scope:"language-overridable"},"js/ts.suggest.autoImports":{type:"boolean",default:!0,description:"%configuration.suggest.autoImports%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.suggest.autoImports":{type:"boolean",default:!0,description:"%configuration.suggest.autoImports%",markdownDeprecationMessage:"%configuration.suggest.autoImports.unifiedDeprecationMessage%",scope:"resource"},"typescript.suggest.autoImports":{type:"boolean",default:!0,description:"%configuration.suggest.autoImports%",markdownDeprecationMessage:"%configuration.suggest.autoImports.unifiedDeprecationMessage%",scope:"resource"},"js/ts.suggest.names":{type:"boolean",default:!0,markdownDescription:"%configuration.suggest.names%",scope:"language-overridable",keywords:["JavaScript"]},"javascript.suggest.names":{type:"boolean",default:!0,markdownDescription:"%configuration.suggest.names%",markdownDeprecationMessage:"%configuration.suggest.names.unifiedDeprecationMessage%",scope:"resource"},"js/ts.suggest.completeFunctionCalls":{type:"boolean",default:!1,description:"%configuration.suggest.completeFunctionCalls%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.suggest.completeFunctionCalls":{type:"boolean",default:!1,description:"%configuration.suggest.completeFunctionCalls%",markdownDeprecationMessage:"%configuration.suggest.completeFunctionCalls.unifiedDeprecationMessage%",scope:"resource"},"typescript.suggest.completeFunctionCalls":{type:"boolean",default:!1,description:"%configuration.suggest.completeFunctionCalls%",markdownDeprecationMessage:"%configuration.suggest.completeFunctionCalls.unifiedDeprecationMessage%",scope:"resource"},"js/ts.suggest.paths":{type:"boolean",default:!0,description:"%configuration.suggest.paths%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.suggest.paths":{type:"boolean",default:!0,description:"%configuration.suggest.paths%",markdownDeprecationMessage:"%configuration.suggest.paths.unifiedDeprecationMessage%",scope:"resource"},"typescript.suggest.paths":{type:"boolean",default:!0,description:"%configuration.suggest.paths%",markdownDeprecationMessage:"%configuration.suggest.paths.unifiedDeprecationMessage%",scope:"resource"},"js/ts.suggest.jsdoc.enabled":{type:"boolean",default:!0,description:"%configuration.suggest.jsdoc.enabled%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.suggest.completeJSDocs":{type:"boolean",default:!0,description:"%configuration.suggest.jsdoc.enabled%",markdownDeprecationMessage:"%configuration.suggest.completeJSDocs.unifiedDeprecationMessage%",scope:"language-overridable"},"typescript.suggest.completeJSDocs":{type:"boolean",default:!0,description:"%configuration.suggest.jsdoc.enabled%",markdownDeprecationMessage:"%configuration.suggest.completeJSDocs.unifiedDeprecationMessage%",scope:"language-overridable"},"js/ts.suggest.jsdoc.generateReturns":{type:"boolean",default:!0,markdownDescription:"%configuration.suggest.jsdoc.generateReturns%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.suggest.jsdoc.generateReturns":{type:"boolean",default:!0,markdownDescription:"%configuration.suggest.jsdoc.generateReturns%",markdownDeprecationMessage:"%configuration.suggest.jsdoc.generateReturns.unifiedDeprecationMessage%",scope:"language-overridable"},"typescript.suggest.jsdoc.generateReturns":{type:"boolean",default:!0,markdownDescription:"%configuration.suggest.jsdoc.generateReturns%",markdownDeprecationMessage:"%configuration.suggest.jsdoc.generateReturns.unifiedDeprecationMessage%",scope:"language-overridable"},"js/ts.suggest.includeAutomaticOptionalChainCompletions":{type:"boolean",default:!0,description:"%configuration.suggest.includeAutomaticOptionalChainCompletions%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.suggest.includeAutomaticOptionalChainCompletions":{type:"boolean",default:!0,description:"%configuration.suggest.includeAutomaticOptionalChainCompletions%",markdownDeprecationMessage:"%configuration.suggest.includeAutomaticOptionalChainCompletions.unifiedDeprecationMessage%",scope:"resource"},"typescript.suggest.includeAutomaticOptionalChainCompletions":{type:"boolean",default:!0,description:"%configuration.suggest.includeAutomaticOptionalChainCompletions%",markdownDeprecationMessage:"%configuration.suggest.includeAutomaticOptionalChainCompletions.unifiedDeprecationMessage%",scope:"resource"},"js/ts.suggest.includeCompletionsForImportStatements":{type:"boolean",default:!0,description:"%configuration.suggest.includeCompletionsForImportStatements%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.suggest.includeCompletionsForImportStatements":{type:"boolean",default:!0,description:"%configuration.suggest.includeCompletionsForImportStatements%",markdownDeprecationMessage:"%configuration.suggest.includeCompletionsForImportStatements.unifiedDeprecationMessage%",scope:"resource"},"typescript.suggest.includeCompletionsForImportStatements":{type:"boolean",default:!0,description:"%configuration.suggest.includeCompletionsForImportStatements%",markdownDeprecationMessage:"%configuration.suggest.includeCompletionsForImportStatements.unifiedDeprecationMessage%",scope:"resource"},"js/ts.suggest.classMemberSnippets.enabled":{type:"boolean",default:!0,description:"%configuration.suggest.classMemberSnippets.enabled%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.suggest.classMemberSnippets.enabled":{type:"boolean",default:!0,description:"%configuration.suggest.classMemberSnippets.enabled%",markdownDeprecationMessage:"%configuration.suggest.classMemberSnippets.enabled.unifiedDeprecationMessage%",scope:"resource"},"typescript.suggest.classMemberSnippets.enabled":{type:"boolean",default:!0,description:"%configuration.suggest.classMemberSnippets.enabled%",markdownDeprecationMessage:"%configuration.suggest.classMemberSnippets.enabled.unifiedDeprecationMessage%",scope:"resource"},"js/ts.suggest.objectLiteralMethodSnippets.enabled":{type:"boolean",default:!0,description:"%configuration.suggest.objectLiteralMethodSnippets.enabled%",scope:"language-overridable",keywords:["TypeScript"]},"typescript.suggest.objectLiteralMethodSnippets.enabled":{type:"boolean",default:!0,description:"%configuration.suggest.objectLiteralMethodSnippets.enabled%",markdownDeprecationMessage:"%configuration.suggest.objectLiteralMethodSnippets.enabled.unifiedDeprecationMessage%",scope:"resource"}}},{type:"object",title:"%configuration.codeLens%",properties:{"js/ts.referencesCodeLens.enabled":{type:"boolean",default:!1,description:"%configuration.referencesCodeLens.enabled%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.referencesCodeLens.enabled":{type:"boolean",default:!1,description:"%configuration.referencesCodeLens.enabled%",markdownDeprecationMessage:"%configuration.referencesCodeLens.enabled.unifiedDeprecationMessage%",scope:"window"},"typescript.referencesCodeLens.enabled":{type:"boolean",default:!1,description:"%configuration.referencesCodeLens.enabled%",markdownDeprecationMessage:"%configuration.referencesCodeLens.enabled.unifiedDeprecationMessage%",scope:"window"},"js/ts.referencesCodeLens.showOnAllFunctions":{type:"boolean",default:!1,markdownDescription:"%configuration.referencesCodeLens.showOnAllFunctions%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.referencesCodeLens.showOnAllFunctions":{type:"boolean",default:!1,markdownDescription:"%configuration.referencesCodeLens.showOnAllFunctions%",markdownDeprecationMessage:"%configuration.referencesCodeLens.showOnAllFunctions.unifiedDeprecationMessage%",scope:"window"},"typescript.referencesCodeLens.showOnAllFunctions":{type:"boolean",default:!1,markdownDescription:"%configuration.referencesCodeLens.showOnAllFunctions%",markdownDeprecationMessage:"%configuration.referencesCodeLens.showOnAllFunctions.unifiedDeprecationMessage%",scope:"window"},"js/ts.implementationsCodeLens.enabled":{type:"boolean",default:!1,description:"%configuration.implementationsCodeLens.enabled%",scope:"language-overridable",keywords:["TypeScript"]},"typescript.implementationsCodeLens.enabled":{type:"boolean",default:!1,description:"%configuration.implementationsCodeLens.enabled%",markdownDeprecationMessage:"%configuration.implementationsCodeLens.enabled.unifiedDeprecationMessage%",scope:"window"},"js/ts.implementationsCodeLens.showOnInterfaceMethods":{type:"boolean",default:!1,markdownDescription:"%configuration.implementationsCodeLens.showOnInterfaceMethods%",scope:"language-overridable",keywords:["TypeScript"]},"typescript.implementationsCodeLens.showOnInterfaceMethods":{type:"boolean",default:!1,markdownDescription:"%configuration.implementationsCodeLens.showOnInterfaceMethods%",markdownDeprecationMessage:"%configuration.implementationsCodeLens.showOnInterfaceMethods.unifiedDeprecationMessage%",scope:"window"},"js/ts.implementationsCodeLens.showOnAllClassMethods":{type:"boolean",default:!1,markdownDescription:"%configuration.implementationsCodeLens.showOnAllClassMethods%",scope:"language-overridable",keywords:["TypeScript"]},"typescript.implementationsCodeLens.showOnAllClassMethods":{type:"boolean",default:!1,markdownDescription:"%configuration.implementationsCodeLens.showOnAllClassMethods%",markdownDeprecationMessage:"%configuration.implementationsCodeLens.showOnAllClassMethods.unifiedDeprecationMessage%",scope:"window"}}},{type:"object",title:"%configuration.inlayHints%",properties:{"js/ts.inlayHints.parameterNames.enabled":{type:"string",enum:["none","literals","all"],enumDescriptions:["%inlayHints.parameterNames.none%","%inlayHints.parameterNames.literals%","%inlayHints.parameterNames.all%"],default:"none",markdownDescription:"%configuration.inlayHints.parameterNames.enabled%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.inlayHints.parameterNames.enabled":{type:"string",enum:["none","literals","all"],enumDescriptions:["%inlayHints.parameterNames.none%","%inlayHints.parameterNames.literals%","%inlayHints.parameterNames.all%"],default:"none",markdownDescription:"%configuration.inlayHints.parameterNames.enabled%",markdownDeprecationMessage:"%configuration.inlayHints.parameterNames.enabled.unifiedDeprecationMessage%",scope:"resource"},"typescript.inlayHints.parameterNames.enabled":{type:"string",enum:["none","literals","all"],enumDescriptions:["%inlayHints.parameterNames.none%","%inlayHints.parameterNames.literals%","%inlayHints.parameterNames.all%"],default:"none",markdownDescription:"%configuration.inlayHints.parameterNames.enabled%",markdownDeprecationMessage:"%configuration.inlayHints.parameterNames.enabled.unifiedDeprecationMessage%",scope:"resource"},"js/ts.inlayHints.parameterNames.suppressWhenArgumentMatchesName":{type:"boolean",default:!0,markdownDescription:"%configuration.inlayHints.parameterNames.suppressWhenArgumentMatchesName%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.inlayHints.parameterNames.suppressWhenArgumentMatchesName":{type:"boolean",default:!0,markdownDescription:"%configuration.inlayHints.parameterNames.suppressWhenArgumentMatchesName%",markdownDeprecationMessage:"%configuration.inlayHints.parameterNames.suppressWhenArgumentMatchesName.unifiedDeprecationMessage%",scope:"resource"},"typescript.inlayHints.parameterNames.suppressWhenArgumentMatchesName":{type:"boolean",default:!0,markdownDescription:"%configuration.inlayHints.parameterNames.suppressWhenArgumentMatchesName%",markdownDeprecationMessage:"%configuration.inlayHints.parameterNames.suppressWhenArgumentMatchesName.unifiedDeprecationMessage%",scope:"resource"},"js/ts.inlayHints.parameterTypes.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.parameterTypes.enabled%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.inlayHints.parameterTypes.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.parameterTypes.enabled%",markdownDeprecationMessage:"%configuration.inlayHints.parameterTypes.enabled.unifiedDeprecationMessage%",scope:"resource"},"typescript.inlayHints.parameterTypes.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.parameterTypes.enabled%",markdownDeprecationMessage:"%configuration.inlayHints.parameterTypes.enabled.unifiedDeprecationMessage%",scope:"resource"},"js/ts.inlayHints.variableTypes.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.variableTypes.enabled%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.inlayHints.variableTypes.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.variableTypes.enabled%",markdownDeprecationMessage:"%configuration.inlayHints.variableTypes.enabled.unifiedDeprecationMessage%",scope:"resource"},"typescript.inlayHints.variableTypes.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.variableTypes.enabled%",markdownDeprecationMessage:"%configuration.inlayHints.variableTypes.enabled.unifiedDeprecationMessage%",scope:"resource"},"js/ts.inlayHints.variableTypes.suppressWhenTypeMatchesName":{type:"boolean",default:!0,markdownDescription:"%configuration.inlayHints.variableTypes.suppressWhenTypeMatchesName%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.inlayHints.variableTypes.suppressWhenTypeMatchesName":{type:"boolean",default:!0,markdownDescription:"%configuration.inlayHints.variableTypes.suppressWhenTypeMatchesName%",markdownDeprecationMessage:"%configuration.inlayHints.variableTypes.suppressWhenTypeMatchesName.unifiedDeprecationMessage%",scope:"resource"},"typescript.inlayHints.variableTypes.suppressWhenTypeMatchesName":{type:"boolean",default:!0,markdownDescription:"%configuration.inlayHints.variableTypes.suppressWhenTypeMatchesName%",markdownDeprecationMessage:"%configuration.inlayHints.variableTypes.suppressWhenTypeMatchesName.unifiedDeprecationMessage%",scope:"resource"},"js/ts.inlayHints.propertyDeclarationTypes.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.propertyDeclarationTypes.enabled%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.inlayHints.propertyDeclarationTypes.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.propertyDeclarationTypes.enabled%",markdownDeprecationMessage:"%configuration.inlayHints.propertyDeclarationTypes.enabled.unifiedDeprecationMessage%",scope:"resource"},"typescript.inlayHints.propertyDeclarationTypes.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.propertyDeclarationTypes.enabled%",markdownDeprecationMessage:"%configuration.inlayHints.propertyDeclarationTypes.enabled.unifiedDeprecationMessage%",scope:"resource"},"js/ts.inlayHints.functionLikeReturnTypes.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.functionLikeReturnTypes.enabled%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.inlayHints.functionLikeReturnTypes.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.functionLikeReturnTypes.enabled%",markdownDeprecationMessage:"%configuration.inlayHints.functionLikeReturnTypes.enabled.unifiedDeprecationMessage%",scope:"resource"},"typescript.inlayHints.functionLikeReturnTypes.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.functionLikeReturnTypes.enabled%",markdownDeprecationMessage:"%configuration.inlayHints.functionLikeReturnTypes.enabled.unifiedDeprecationMessage%",scope:"resource"},"js/ts.inlayHints.enumMemberValues.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.enumMemberValues.enabled%",scope:"language-overridable",keywords:["TypeScript"]},"typescript.inlayHints.enumMemberValues.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.enumMemberValues.enabled%",markdownDeprecationMessage:"%configuration.inlayHints.enumMemberValues.enabled.unifiedDeprecationMessage%",scope:"resource"}}},{type:"object",title:"%configuration.serverAdvanced%",properties:{"js/ts.tsdk.promptToUseWorkspaceVersion":{type:"boolean",default:!1,description:"%typescript.enablePromptUseWorkspaceTsdk%",scope:"window",keywords:["TypeScript"]},"typescript.enablePromptUseWorkspaceTsdk":{type:"boolean",default:!1,description:"%typescript.enablePromptUseWorkspaceTsdk%",markdownDeprecationMessage:"%typescript.enablePromptUseWorkspaceTsdk.unifiedDeprecationMessage%",scope:"window"},"js/ts.tsserver.automaticTypeAcquisition.enabled":{type:"boolean",default:!0,markdownDescription:"%configuration.automaticTypeAcquisition.enabled%",scope:"window",keywords:["TypeScript","usesOnlineServices"]},"typescript.disableAutomaticTypeAcquisition":{type:"boolean",default:!1,markdownDescription:"%typescript.disableAutomaticTypeAcquisition%",markdownDeprecationMessage:"%typescript.disableAutomaticTypeAcquisition.unifiedDeprecationMessage%",scope:"window",keywords:["usesOnlineServices"]},"js/ts.tsserver.node.path":{type:"string",description:"%configuration.tsserver.nodePath%",scope:"window",keywords:["TypeScript"]},"typescript.tsserver.nodePath":{type:"string",description:"%configuration.tsserver.nodePath%",markdownDeprecationMessage:"%configuration.tsserver.nodePath.unifiedDeprecationMessage%",scope:"window"},"js/ts.tsserver.npm.path":{type:"string",markdownDescription:"%typescript.npm%",scope:"machine",keywords:["TypeScript"]},"typescript.npm":{type:"string",markdownDescription:"%typescript.npm%",markdownDeprecationMessage:"%typescript.npm.unifiedDeprecationMessage%",scope:"machine"},"js/ts.tsserver.checkNpmIsInstalled":{type:"boolean",default:!0,markdownDescription:"%typescript.check.npmIsInstalled%",scope:"window",keywords:["TypeScript"]},"typescript.check.npmIsInstalled":{type:"boolean",default:!0,markdownDescription:"%typescript.check.npmIsInstalled%",markdownDeprecationMessage:"%typescript.check.npmIsInstalled.unifiedDeprecationMessage%",scope:"window"},"js/ts.tsserver.web.projectWideIntellisense.enabled":{type:"boolean",default:!0,description:"%configuration.tsserver.web.projectWideIntellisense.enabled%",scope:"window",keywords:["TypeScript"]},"typescript.tsserver.web.projectWideIntellisense.enabled":{type:"boolean",default:!0,description:"%configuration.tsserver.web.projectWideIntellisense.enabled%",markdownDeprecationMessage:"%configuration.tsserver.web.projectWideIntellisense.enabled.unifiedDeprecationMessage%",scope:"window"},"js/ts.tsserver.web.projectWideIntellisense.suppressSemanticErrors":{type:"boolean",default:!1,description:"%configuration.tsserver.web.projectWideIntellisense.suppressSemanticErrors%",scope:"window",keywords:["TypeScript"]},"typescript.tsserver.web.projectWideIntellisense.suppressSemanticErrors":{type:"boolean",default:!1,description:"%configuration.tsserver.web.projectWideIntellisense.suppressSemanticErrors%",markdownDeprecationMessage:"%configuration.tsserver.web.projectWideIntellisense.suppressSemanticErrors.unifiedDeprecationMessage%",scope:"window"},"js/ts.tsserver.web.typeAcquisition.enabled":{type:"boolean",default:!0,description:"%configuration.tsserver.web.typeAcquisition.enabled%",scope:"window",keywords:["TypeScript"]},"typescript.tsserver.web.typeAcquisition.enabled":{type:"boolean",default:!0,description:"%configuration.tsserver.web.typeAcquisition.enabled%",markdownDeprecationMessage:"%configuration.tsserver.web.typeAcquisition.enabled.unifiedDeprecationMessage%",scope:"window"},"js/ts.tsserver.useSyntaxServer":{type:"string",scope:"window",description:"%configuration.tsserver.useSyntaxServer%",default:"auto",enum:["always","never","auto"],enumDescriptions:["%configuration.tsserver.useSyntaxServer.always%","%configuration.tsserver.useSyntaxServer.never%","%configuration.tsserver.useSyntaxServer.auto%"],keywords:["TypeScript"]},"typescript.tsserver.useSyntaxServer":{type:"string",scope:"window",description:"%configuration.tsserver.useSyntaxServer%",default:"auto",enum:["always","never","auto"],enumDescriptions:["%configuration.tsserver.useSyntaxServer.always%","%configuration.tsserver.useSyntaxServer.never%","%configuration.tsserver.useSyntaxServer.auto%"],markdownDeprecationMessage:"%configuration.tsserver.useSyntaxServer.unifiedDeprecationMessage%"},"js/ts.tsserver.maxMemory":{type:"number",default:3072,markdownDescription:"%configuration.tsserver.maxMemory%",scope:"window",keywords:["TypeScript"]},"js/ts.tsserver.diagnosticDir":{type:"string",markdownDescription:"%configuration.tsserver.diagnosticDir%",scope:"machine",keywords:["TypeScript","diagnostic","memory"]},"typescript.tsserver.maxTsServerMemory":{type:"number",default:3072,markdownDescription:"%configuration.tsserver.maxTsServerMemory%",markdownDeprecationMessage:"%configuration.tsserver.maxTsServerMemory.unifiedDeprecationMessage%",scope:"window"},"js/ts.tsserver.heapSnapshot":{type:"number",default:0,minimum:0,markdownDescription:"%configuration.tsserver.heapSnapshot%",scope:"window",keywords:["TypeScript","memory","diagnostics"]},"js/ts.tsserver.heapProfile":{type:"object",default:{enabled:!1},markdownDescription:"%configuration.tsserver.heapProfile%",scope:"machine",properties:{enabled:{type:"boolean",default:!1,description:"%configuration.tsserver.heapProfile.enabled%"},dir:{type:"string",description:"%configuration.tsserver.heapProfile.dir%"},interval:{type:"number",minimum:1,description:"%configuration.tsserver.heapProfile.interval%"}},keywords:["TypeScript","memory","heap","profile"]},"js/ts.tsserver.watchOptions":{description:"%configuration.tsserver.watchOptions%",scope:"window",default:"vscode",oneOf:[{type:"string",const:"vscode",description:"%configuration.tsserver.watchOptions.vscode%"},{type:"object",properties:{watchFile:{type:"string",description:"%configuration.tsserver.watchOptions.watchFile%",enum:["fixedChunkSizePolling","fixedPollingInterval","priorityPollingInterval","dynamicPriorityPolling","useFsEvents","useFsEventsOnParentDirectory"],enumDescriptions:["%configuration.tsserver.watchOptions.watchFile.fixedChunkSizePolling%","%configuration.tsserver.watchOptions.watchFile.fixedPollingInterval%","%configuration.tsserver.watchOptions.watchFile.priorityPollingInterval%","%configuration.tsserver.watchOptions.watchFile.dynamicPriorityPolling%","%configuration.tsserver.watchOptions.watchFile.useFsEvents%","%configuration.tsserver.watchOptions.watchFile.useFsEventsOnParentDirectory%"],default:"useFsEvents"},watchDirectory:{type:"string",description:"%configuration.tsserver.watchOptions.watchDirectory%",enum:["fixedChunkSizePolling","fixedPollingInterval","dynamicPriorityPolling","useFsEvents"],enumDescriptions:["%configuration.tsserver.watchOptions.watchDirectory.fixedChunkSizePolling%","%configuration.tsserver.watchOptions.watchDirectory.fixedPollingInterval%","%configuration.tsserver.watchOptions.watchDirectory.dynamicPriorityPolling%","%configuration.tsserver.watchOptions.watchDirectory.useFsEvents%"],default:"useFsEvents"},fallbackPolling:{type:"string",description:"%configuration.tsserver.watchOptions.fallbackPolling%",enum:["fixedPollingInterval","priorityPollingInterval","dynamicPriorityPolling"],enumDescriptions:["configuration.tsserver.watchOptions.fallbackPolling.fixedPollingInterval","configuration.tsserver.watchOptions.fallbackPolling.priorityPollingInterval","configuration.tsserver.watchOptions.fallbackPolling.dynamicPriorityPolling"]},synchronousWatchDirectory:{type:"boolean",description:"%configuration.tsserver.watchOptions.synchronousWatchDirectory%"}}}],keywords:["TypeScript"]},"typescript.tsserver.watchOptions":{description:"%configuration.tsserver.watchOptions%",scope:"window",default:"vscode",markdownDeprecationMessage:"%configuration.tsserver.watchOptions.unifiedDeprecationMessage%",oneOf:[{type:"string",const:"vscode",description:"%configuration.tsserver.watchOptions.vscode%"},{type:"object",properties:{watchFile:{type:"string",description:"%configuration.tsserver.watchOptions.watchFile%",enum:["fixedChunkSizePolling","fixedPollingInterval","priorityPollingInterval","dynamicPriorityPolling","useFsEvents","useFsEventsOnParentDirectory"],enumDescriptions:["%configuration.tsserver.watchOptions.watchFile.fixedChunkSizePolling%","%configuration.tsserver.watchOptions.watchFile.fixedPollingInterval%","%configuration.tsserver.watchOptions.watchFile.priorityPollingInterval%","%configuration.tsserver.watchOptions.watchFile.dynamicPriorityPolling%","%configuration.tsserver.watchOptions.watchFile.useFsEvents%","%configuration.tsserver.watchOptions.watchFile.useFsEventsOnParentDirectory%"],default:"useFsEvents"},watchDirectory:{type:"string",description:"%configuration.tsserver.watchOptions.watchDirectory%",enum:["fixedChunkSizePolling","fixedPollingInterval","dynamicPriorityPolling","useFsEvents"],enumDescriptions:["%configuration.tsserver.watchOptions.watchDirectory.fixedChunkSizePolling%","%configuration.tsserver.watchOptions.watchDirectory.fixedPollingInterval%","%configuration.tsserver.watchOptions.watchDirectory.dynamicPriorityPolling%","%configuration.tsserver.watchOptions.watchDirectory.useFsEvents%"],default:"useFsEvents"},fallbackPolling:{type:"string",description:"%configuration.tsserver.watchOptions.fallbackPolling%",enum:["fixedPollingInterval","priorityPollingInterval","dynamicPriorityPolling"],enumDescriptions:["configuration.tsserver.watchOptions.fallbackPolling.fixedPollingInterval","configuration.tsserver.watchOptions.fallbackPolling.priorityPollingInterval","configuration.tsserver.watchOptions.fallbackPolling.dynamicPriorityPolling"]},synchronousWatchDirectory:{type:"boolean",description:"%configuration.tsserver.watchOptions.synchronousWatchDirectory%"}}}]},"js/ts.tsserver.tracing.enabled":{type:"boolean",default:!1,description:"%typescript.tsserver.enableTracing%",scope:"window",keywords:["TypeScript"]},"typescript.tsserver.enableTracing":{type:"boolean",default:!1,description:"%typescript.tsserver.enableTracing%",markdownDeprecationMessage:"%typescript.tsserver.enableTracing.unifiedDeprecationMessage%",scope:"window"},"js/ts.tsserver.log":{type:"string",enum:["off","terse","normal","verbose","requestTime"],default:"off",description:"%typescript.tsserver.log%",scope:"window",keywords:["TypeScript"]},"typescript.tsserver.log":{type:"string",enum:["off","terse","normal","verbose","requestTime"],default:"off",description:"%typescript.tsserver.log%",markdownDeprecationMessage:"%typescript.tsserver.log.unifiedDeprecationMessage%",scope:"window"},"js/ts.tsserver.pluginPaths":{type:"array",items:{type:"string",description:"%typescript.tsserver.pluginPaths.item%"},default:[],description:"%typescript.tsserver.pluginPaths%",scope:"machine",keywords:["TypeScript"]},"typescript.tsserver.pluginPaths":{type:"array",items:{type:"string",description:"%typescript.tsserver.pluginPaths.item%"},default:[],description:"%typescript.tsserver.pluginPaths%",markdownDeprecationMessage:"%typescript.tsserver.pluginPaths.unifiedDeprecationMessage%",scope:"machine"}}}],commands:[{command:"typescript.reloadProjects",title:"%reloadProjects.title%",category:"TypeScript"},{command:"javascript.reloadProjects",title:"%reloadProjects.title%",category:"JavaScript"},{command:"typescript.selectTypeScriptVersion",title:"%typescript.selectTypeScriptVersion.title%",category:"TypeScript"},{command:"typescript.goToProjectConfig",title:"%typescript.goToProjectConfig.title%",category:"TypeScript"},{command:"javascript.goToProjectConfig",title:"%javascript.goToProjectConfig.title%",category:"JavaScript"},{command:"typescript.openTsServerLog",title:"%typescript.openTsServerLog.title%",category:"TypeScript"},{command:"typescript.restartTsServer",title:"%typescript.restartTsServer%",category:"TypeScript"},{command:"typescript.findAllFileReferences",title:"%typescript.findAllFileReferences%",category:"TypeScript"},{command:"typescript.goToSourceDefinition",title:"%typescript.goToSourceDefinition%",category:"TypeScript"},{command:"typescript.sortImports",title:"%typescript.sortImports%",category:"TypeScript"},{command:"javascript.sortImports",title:"%typescript.sortImports%",category:"JavaScript"},{command:"typescript.removeUnusedImports",title:"%typescript.removeUnusedImports%",category:"TypeScript"},{command:"javascript.removeUnusedImports",title:"%typescript.removeUnusedImports%",category:"JavaScript"},{command:"typescript.experimental.enableTsgo",title:"Use TypeScript Go (Experimental)",category:"TypeScript",enablement:"!config.js/ts.experimental.useTsgo && !config.typescript.experimental.useTsgo && config.typescript-go.executablePath"},{command:"typescript.experimental.disableTsgo",title:"Stop using TypeScript Go (Experimental)",category:"TypeScript",enablement:"config.js/ts.experimental.useTsgo || config.typescript.experimental.useTsgo"}],menus:{commandPalette:[{command:"typescript.reloadProjects",when:"editorLangId == typescript && typescript.isManagedFile"},{command:"typescript.reloadProjects",when:"editorLangId == typescriptreact && typescript.isManagedFile"},{command:"javascript.reloadProjects",when:"editorLangId == javascript && typescript.isManagedFile"},{command:"javascript.reloadProjects",when:"editorLangId == javascriptreact && typescript.isManagedFile"},{command:"typescript.goToProjectConfig",when:"editorLangId == typescript && typescript.isManagedFile"},{command:"typescript.goToProjectConfig",when:"editorLangId == typescriptreact && typescript.isManagedFile"},{command:"javascript.goToProjectConfig",when:"editorLangId == javascript && typescript.isManagedFile"},{command:"javascript.goToProjectConfig",when:"editorLangId == javascriptreact && typescript.isManagedFile"},{command:"typescript.selectTypeScriptVersion",when:"typescript.isManagedFile"},{command:"typescript.openTsServerLog",when:"typescript.isManagedFile"},{command:"typescript.restartTsServer",when:"typescript.isManagedFile"},{command:"typescript.findAllFileReferences",when:"tsSupportsFileReferences && typescript.isManagedFile"},{command:"typescript.goToSourceDefinition",when:"tsSupportsSourceDefinition && typescript.isManagedFile"},{command:"typescript.sortImports",when:"supportedCodeAction =~ /(\\s|^)source\\.sortImports\\b/ && editorLangId =~ /^typescript(react)?$/"},{command:"javascript.sortImports",when:"supportedCodeAction =~ /(\\s|^)source\\.sortImports\\b/ && editorLangId =~ /^javascript(react)?$/"},{command:"typescript.removeUnusedImports",when:"supportedCodeAction =~ /(\\s|^)source\\.removeUnusedImports\\b/ && editorLangId =~ /^typescript(react)?$/"},{command:"javascript.removeUnusedImports",when:"supportedCodeAction =~ /(\\s|^)source\\.removeUnusedImports\\b/ && editorLangId =~ /^javascript(react)?$/"}],"editor/context":[{command:"typescript.goToSourceDefinition",when:"!config.js/ts.experimental.useTsgo && !config.typescript.experimental.useTsgo && tsSupportsSourceDefinition && (resourceLangId == typescript || resourceLangId == typescriptreact || resourceLangId == javascript || resourceLangId == javascriptreact)",group:"navigation@1.41"}],"explorer/context":[{command:"typescript.findAllFileReferences",when:"tsSupportsFileReferences && resourceLangId == typescript",group:"4_search"},{command:"typescript.findAllFileReferences",when:"tsSupportsFileReferences && resourceLangId == typescriptreact",group:"4_search"},{command:"typescript.findAllFileReferences",when:"tsSupportsFileReferences && resourceLangId == javascript",group:"4_search"},{command:"typescript.findAllFileReferences",when:"tsSupportsFileReferences && resourceLangId == javascriptreact",group:"4_search"}],"editor/title/context":[{command:"typescript.findAllFileReferences",when:"tsSupportsFileReferences && resourceLangId == javascript"},{command:"typescript.findAllFileReferences",when:"tsSupportsFileReferences && resourceLangId == javascriptreact"},{command:"typescript.findAllFileReferences",when:"tsSupportsFileReferences && resourceLangId == typescript"},{command:"typescript.findAllFileReferences",when:"tsSupportsFileReferences && resourceLangId == typescriptreact"}]},breakpoints:[{language:"typescript"},{language:"typescriptreact"}],taskDefinitions:[{type:"typescript",required:["tsconfig"],properties:{tsconfig:{type:"string",description:"%taskDefinition.tsconfig.description%"},option:{type:"string"}},when:"shellExecutionSupported"}],problemPatterns:[{name:"tsc",regexp:"^([^\\s].*)[\\(:](\\d+)[,:](\\d+)(?:\\):\\s+|\\s+-\\s+)(error|warning|info)\\s+TS(\\d+)\\s*:\\s*(.*)$",file:1,line:2,column:3,severity:4,code:5,message:6}],problemMatchers:[{name:"tsc",label:"%typescript.problemMatchers.tsc.label%",owner:"typescript",source:"ts",applyTo:"closedDocuments",fileLocation:["relative","${cwd}"],pattern:"$tsc"},{name:"tsgo-watch",label:"%typescript.problemMatchers.tsgo-watch.label%",owner:"typescript",source:"ts",applyTo:"closedDocuments",fileLocation:["relative","${cwd}"],pattern:"$tsc",background:{activeOnStart:!0,beginsPattern:{regexp:"^build starting at .*$"},endsPattern:{regexp:"^build finished in .*$"}}},{name:"tsc-watch",label:"%typescript.problemMatchers.tscWatch.label%",owner:"typescript",source:"ts",applyTo:"closedDocuments",fileLocation:["relative","${cwd}"],pattern:"$tsc",background:{activeOnStart:!0,beginsPattern:{regexp:"^\\s*(?:message TS6032:|\\[?\\D*.{1,2}[:.].{1,2}[:.].{1,2}\\D*(\u251C\\D*\\d{1,2}\\D+\u2524)?(?:\\]| -)) (Starting compilation in watch mode|File change detected\\. Starting incremental compilation)\\.\\.\\."},endsPattern:{regexp:"^\\s*(?:message TS6042:|\\[?\\D*.{1,2}[:.].{1,2}[:.].{1,2}\\D*(\u251C\\D*\\d{1,2}\\D+\u2524)?(?:\\]| -)) (?:Compilation complete\\.|Found \\d+ errors?\\.) Watching for file changes\\."}}}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"JavaScript and TypeScript Language Features",description:"Provides rich language support for JavaScript and TypeScript.",workspaceTrust:"The extension requires workspace trust when the workspace version is used because it executes code specified by the workspace.",virtualWorkspaces:"In virtual workspaces, resolving and finding references across files is not supported.","reloadProjects.title":"Reload Project","configuration.codeLens":"CodeLens","configuration.format":"Formatting","configuration.languageFeatures":"Language Features","configuration.implicitProjectConfig":"Implicit Project Config","configuration.inlayHints":"Inlay Hints","configuration.preferences":"Preferences","configuration.serverAdvanced":"TS Server Advanced Settings","configuration.suggest":"Suggestions","configuration.validation":"Validation","configuration.suggest.completeFunctionCalls":"Complete functions with their parameter signature.","configuration.suggest.completeFunctionCalls.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.suggest.completeFunctionCalls#` instead.","configuration.suggest.includeAutomaticOptionalChainCompletions":"Enable/disable showing completions on potentially undefined values that insert an optional chain call. Requires strict null checks to be enabled.","configuration.suggest.includeAutomaticOptionalChainCompletions.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.suggest.includeAutomaticOptionalChainCompletions#` instead.","configuration.suggest.includeCompletionsForImportStatements":"Enable/disable auto-import-style completions on partially-typed import statements.","configuration.suggest.includeCompletionsForImportStatements.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.suggest.includeCompletionsForImportStatements#` instead.","typescript.useTsgo":"Disables TypeScript and JavaScript language features to allow usage of the TypeScript Go experimental extension. Requires TypeScript Go to be installed and configured. Requires reloading extensions after changing this setting.","typescript.useTsgo.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.experimental.useTsgo#` instead.","typescript.tsdk.desc":"Specifies the folder path to the tsserver and `lib*.d.ts` files under a TypeScript install to use for IntelliSense, for example: `./node_modules/typescript/lib`.\n\n- When specified as a user setting, the TypeScript version from `typescript.tsdk` automatically replaces the built-in TypeScript version.\n- When specified as a workspace setting, `typescript.tsdk` allows you to switch to use that workspace version of TypeScript for IntelliSense with the `TypeScript: Select TypeScript version` command.\n\nSee the [TypeScript documentation](https://code.visualstudio.com/docs/typescript/typescript-compiling#_using-newer-typescript-versions) for more detail about managing TypeScript versions.","typescript.tsdk.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsdk.path#` instead.","typescript.disableAutomaticTypeAcquisition":"Disables [automatic type acquisition](https://code.visualstudio.com/docs/nodejs/working-with-javascript#_typings-and-automatic-type-acquisition). Automatic type acquisition fetches `@types` packages from npm to improve IntelliSense for external libraries.","typescript.disableAutomaticTypeAcquisition.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.automaticTypeAcquisition.enabled#` instead.","configuration.automaticTypeAcquisition.enabled":"Enable [automatic type acquisition](https://code.visualstudio.com/docs/nodejs/working-with-javascript#_typings-and-automatic-type-acquisition). Automatic type acquisition fetches `@types` packages from npm to improve IntelliSense for external libraries.","typescript.enablePromptUseWorkspaceTsdk":"Enables prompting of users to use the TypeScript version configured in the workspace for Intellisense.","typescript.enablePromptUseWorkspaceTsdk.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsdk.promptToUseWorkspaceVersion#` instead.","typescript.tsserver.enableTracing":"Enables tracing TS server performance to a directory. These trace files can be used to diagnose TS Server performance issues. The log may contain file paths, source code, and other potentially sensitive information from your project.","typescript.tsserver.enableTracing.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.tracing.enabled#` instead.","typescript.tsserver.log":"Enables logging of the TS server to a file. This log can be used to diagnose TS Server issues. The log may contain file paths, source code, and other potentially sensitive information from your project.","typescript.tsserver.log.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.log#` instead.","typescript.tsserver.pluginPaths":"Additional paths to discover TypeScript Language Service plugins.","typescript.tsserver.pluginPaths.item":"Either an absolute or relative path. Relative path will be resolved against workspace folder(s).","typescript.tsserver.pluginPaths.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.pluginPaths#` instead.","typescript.tsserver.trace":"Enables tracing of messages sent to the TS server. This trace can be used to diagnose TS Server issues. The trace may contain file paths, source code, and other potentially sensitive information from your project.","typescript.validate.enable":"Enable/disable TypeScript validation.","javascript.validate.enable":"Enable/disable JavaScript validation.","configuration.validate.enable":"Enable/disable JavaScript and TypeScript validation.","configuration.validate.enable.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.validate.enabled#` instead.","typescript.format.enable":"Enable/disable default TypeScript formatter.","javascript.format.enable":"Enable/disable default JavaScript formatter.","format.insertSpaceAfterCommaDelimiter":"Defines space handling after a comma delimiter.","format.insertSpaceAfterConstructor":"Defines space handling after the constructor keyword.","format.insertSpaceAfterSemicolonInForStatements":"Defines space handling after a semicolon in a for statement.","format.insertSpaceBeforeAndAfterBinaryOperators":"Defines space handling after a binary operator.","format.insertSpaceAfterKeywordsInControlFlowStatements":"Defines space handling after keywords in a control flow statement.","format.insertSpaceAfterFunctionKeywordForAnonymousFunctions":"Defines space handling after function keyword for anonymous functions.","format.insertSpaceBeforeFunctionParenthesis":"Defines space handling before function argument parentheses.","format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis":"Defines space handling after opening and before closing non-empty parenthesis.","format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets":"Defines space handling after opening and before closing non-empty brackets.","format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces":"Defines space handling after opening and before closing non-empty braces.","format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces":"Defines space handling after opening and before closing empty braces.","format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces":"Defines space handling after opening and before closing template string braces.","format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces":"Defines space handling after opening and before closing JSX expression braces.","format.insertSpaceAfterTypeAssertion":"Defines space handling after type assertions in TypeScript.","format.placeOpenBraceOnNewLineForFunctions":"Defines whether an open brace is put onto a new line for functions or not.","format.placeOpenBraceOnNewLineForControlBlocks":"Defines whether an open brace is put onto a new line for control blocks or not.","format.semicolons":"Defines handling of optional semicolons.","format.semicolons.ignore":"Don't insert or remove any semicolons.","format.semicolons.insert":"Insert semicolons at statement ends.","format.semicolons.remove":"Remove unnecessary semicolons.","format.indentSwitchCase":"Indent case clauses in switch statements. Requires using TypeScript 5.1+ in the workspace.","format.enable":"Enable/disable the default JavaScript and TypeScript formatter.","configuration.format.enable.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.enable#` instead.","configuration.format.insertSpaceAfterCommaDelimiter.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceAfterCommaDelimiter#` instead.","configuration.format.insertSpaceAfterConstructor.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceAfterConstructor#` instead.","configuration.format.insertSpaceAfterSemicolonInForStatements.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceAfterSemicolonInForStatements#` instead.","configuration.format.insertSpaceBeforeAndAfterBinaryOperators.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceBeforeAndAfterBinaryOperators#` instead.","configuration.format.insertSpaceAfterKeywordsInControlFlowStatements.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceAfterKeywordsInControlFlowStatements#` instead.","configuration.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions#` instead.","configuration.format.insertSpaceBeforeFunctionParenthesis.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceBeforeFunctionParenthesis#` instead.","configuration.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis#` instead.","configuration.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets#` instead.","configuration.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces#` instead.","configuration.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces#` instead.","configuration.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces#` instead.","configuration.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces#` instead.","configuration.format.insertSpaceAfterTypeAssertion.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceAfterTypeAssertion#` instead.","configuration.format.placeOpenBraceOnNewLineForFunctions.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.placeOpenBraceOnNewLineForFunctions#` instead.","configuration.format.placeOpenBraceOnNewLineForControlBlocks.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.placeOpenBraceOnNewLineForControlBlocks#` instead.","configuration.format.semicolons.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.semicolons#` instead.","configuration.format.indentSwitchCase.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.indentSwitchCase#` instead.","javascript.goToProjectConfig.title":"Go to Project Configuration (jsconfig / tsconfig)","typescript.goToProjectConfig.title":"Go to Project Configuration (tsconfig)","configuration.referencesCodeLens.enabled":"Enable/disable references CodeLens in JavaScript and TypeScript files. This CodeLens shows the number of references for classes and exported functions and allows you to peek or navigate to them.","configuration.referencesCodeLens.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.referencesCodeLens.enabled#` instead.","configuration.referencesCodeLens.showOnAllFunctions":"Enable/disable the [references CodeLens](#js/ts.referencesCodeLens.enabled) on all functions in JavaScript and TypeScript files.","configuration.referencesCodeLens.showOnAllFunctions.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.referencesCodeLens.showOnAllFunctions#` instead.","configuration.implementationsCodeLens.enabled":"Enable/disable implementations CodeLens in TypeScript files. This CodeLens shows the implementers of TypeScript interfaces.","configuration.implementationsCodeLens.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.implementationsCodeLens.enabled#` instead.","configuration.implementationsCodeLens.showOnInterfaceMethods":"Enable/disable [implementations CodeLens](#js/ts.implementationsCodeLens.enabled) on TypeScript interface methods.","configuration.implementationsCodeLens.showOnInterfaceMethods.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.implementationsCodeLens.showOnInterfaceMethods#` instead.","configuration.implementationsCodeLens.showOnAllClassMethods":"Enable/disable showing [implementations CodeLens](#js/ts.implementationsCodeLens.enabled) above all TypeScript class methods instead of only on abstract methods.","configuration.implementationsCodeLens.showOnAllClassMethods.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.implementationsCodeLens.showOnAllClassMethods#` instead.","typescript.openTsServerLog.title":"Open TS Server log","typescript.restartTsServer":"Restart TS Server","typescript.selectTypeScriptVersion.title":"Select TypeScript Version...","typescript.reportStyleChecksAsWarnings":"Report style checks as warnings.","configuration.reportStyleChecksAsWarnings.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.reportStyleChecksAsWarnings#` instead.","typescript.npm":"Specifies the path to the npm executable used for [Automatic Type Acquisition](https://code.visualstudio.com/docs/nodejs/working-with-javascript#_typings-and-automatic-type-acquisition).","typescript.npm.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.npm.path#` instead.","typescript.check.npmIsInstalled":"Check if npm is installed for [Automatic Type Acquisition](https://code.visualstudio.com/docs/nodejs/working-with-javascript#_typings-and-automatic-type-acquisition).","typescript.check.npmIsInstalled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.checkNpmIsInstalled#` instead.","configuration.suggest.names":"Enable/disable including unique names from the file in JavaScript suggestions. Note that name suggestions are always disabled in JavaScript code that is semantically checked using `@ts-check` or `checkJs`.","configuration.suggest.names.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.suggest.names#` instead.","typescript.tsc.autoDetect":"Controls auto detection of tsc tasks.","typescript.tsc.autoDetect.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsc.autoDetect#` instead.","typescript.tsc.autoDetect.off":"Disable this feature.","typescript.tsc.autoDetect.on":"Create both build and watch tasks.","typescript.tsc.autoDetect.build":"Only create single run compile tasks.","typescript.tsc.autoDetect.watch":"Only create compile and watch tasks.","typescript.problemMatchers.tsc.label":"TypeScript problems","typescript.problemMatchers.tsgo-watch.label":"TypeScript problems (watch mode)","typescript.problemMatchers.tscWatch.label":"TypeScript problems (watch mode)","configuration.suggest.paths":"Enable/disable suggestions for paths in import statements and require calls.","configuration.suggest.paths.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.suggest.paths#` instead.","configuration.tsserver.useSeparateSyntaxServer":"Enable/disable spawning a separate TypeScript server that can more quickly respond to syntax related operations, such as calculating folding or computing document symbols.","configuration.tsserver.useSyntaxServer":"Controls if TypeScript launches a dedicated server to more quickly handle syntax related operations, such as computing code folding.","configuration.tsserver.useSyntaxServer.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.useSyntaxServer#` instead.","configuration.tsserver.useSyntaxServer.always":"Use a lighter weight syntax server to handle all IntelliSense operations. This disables project-wide features including auto-imports, cross-file completions, and go to definition for symbols in other files. Only use this for very large projects where performance is critical.","configuration.tsserver.useSyntaxServer.never":"Don't use a dedicated syntax server. Use a single server to handle all IntelliSense operations.","configuration.tsserver.useSyntaxServer.auto":"Spawn both a full server and a lighter weight server dedicated to syntax operations. The syntax server is used to speed up syntax operations and provide IntelliSense while projects are loading.","configuration.tsserver.maxTsServerMemory":"The maximum amount of memory (in MB) to allocate to the TypeScript server process. To use a memory limit greater than 4 GB, use `#js/ts.tsserver.node.path#` to run TS Server with a custom Node installation.","configuration.tsserver.maxTsServerMemory.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.maxMemory#` instead.","configuration.tsserver.maxMemory":"The maximum amount of memory (in MB) to allocate to the TypeScript server process. To use a memory limit greater than 4 GB, use `#js/ts.tsserver.node.path#` to run TS Server with a custom Node installation.","configuration.tsserver.diagnosticDir":"Directory where TypeScript server writes Node diagnostic output by passing `--diagnostic-dir`.","configuration.tsserver.heapSnapshot":"Controls how many near-heap-limit snapshots TypeScript server writes by passing `--heapsnapshot-near-heap-limit`. Set to `0` to disable.","configuration.tsserver.heapProfile":"Configures heap profiling for TypeScript server.","configuration.tsserver.heapProfile.enabled":"Enable heap profiling for TypeScript server by passing `--heap-prof`.","configuration.tsserver.heapProfile.dir":"Directory where TypeScript server writes heap profiles by passing `--heap-prof-dir`.","configuration.tsserver.heapProfile.interval":"Sampling interval in bytes for TypeScript server heap profiling by passing `--heap-prof-interval`.","configuration.tsserver.experimental.enableProjectDiagnostics":"Enables project wide error reporting.","configuration.tsserver.experimental.enableProjectDiagnostics.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.experimental.enableProjectDiagnostics#` instead.","typescript.locale":"Sets the locale used to report JavaScript and TypeScript errors. Defaults to use VS Code's locale.","typescript.locale.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.locale#` instead.","typescript.locale.auto":"Use VS Code's configured display language.","configuration.implicitProjectConfig.module":"Sets the module system for the program. See more: https://www.typescriptlang.org/tsconfig#module.","configuration.implicitProjectConfig.target":"Set target JavaScript language version for emitted JavaScript and include library declarations. See more: https://www.typescriptlang.org/tsconfig#target.","configuration.implicitProjectConfig.checkJs":"Enable/disable semantic checking of JavaScript files. Existing `jsconfig.json` or `tsconfig.json` files override this setting.","configuration.implicitProjectConfig.experimentalDecorators":"Enable/disable `experimentalDecorators` in JavaScript files that are not part of a project. Existing `jsconfig.json` or `tsconfig.json` files override this setting.","configuration.implicitProjectConfig.strictNullChecks":"Enable/disable [strict null checks](https://www.typescriptlang.org/tsconfig#strictNullChecks) in JavaScript and TypeScript files that are not part of a project. Existing `jsconfig.json` or `tsconfig.json` files override this setting.","configuration.implicitProjectConfig.strictFunctionTypes":"Enable/disable [strict function types](https://www.typescriptlang.org/tsconfig#strictFunctionTypes) in JavaScript and TypeScript files that are not part of a project. Existing `jsconfig.json` or `tsconfig.json` files override this setting.","configuration.implicitProjectConfig.strict":"Enable/disable [strict mode](https://www.typescriptlang.org/tsconfig#strict) in JavaScript and TypeScript files that are not part of a project. Existing `jsconfig.json` or `tsconfig.json` files override this setting.","configuration.suggest.jsdoc.generateReturns":"Enable/disable generating `@returns` annotations for JSDoc templates.","configuration.suggest.jsdoc.generateReturns.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.suggest.jsdoc.generateReturns#` instead.","configuration.suggest.autoImports":"Enable/disable auto import suggestions.","configuration.suggest.autoImports.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.suggest.autoImports#` instead.","configuration.preferGoToSourceDefinition":"Makes `Go to Definition` avoid type declaration files when possible by triggering `Go to Source Definition` instead. This allows `Go to Source Definition` to be triggered with the mouse gesture.","configuration.preferGoToSourceDefinition.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.preferGoToSourceDefinition#` instead.","inlayHints.parameterNames.none":"Disable parameter name hints.","inlayHints.parameterNames.literals":"Enable parameter name hints only for literal arguments.","inlayHints.parameterNames.all":"Enable parameter name hints for literal and non-literal arguments.","configuration.inlayHints.parameterNames.enabled":{message:"Enable/disable inlay hints for parameter names:\n```typescript\n\nparseInt(/* str: */ '123', /* radix: */ 8)\n \n```",comment:["The text inside the ``` block is code and should not be localized."]},"configuration.inlayHints.parameterNames.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.inlayHints.parameterNames.enabled#` instead.","configuration.inlayHints.parameterNames.suppressWhenArgumentMatchesName":"Suppress parameter name hints on arguments whose text is identical to the parameter name.","configuration.inlayHints.parameterNames.suppressWhenArgumentMatchesName.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.inlayHints.parameterNames.suppressWhenArgumentMatchesName#` instead.","configuration.inlayHints.parameterTypes.enabled":{message:"Enable/disable inlay hints for implicit parameter types:\n```typescript\n\nel.addEventListener('click', e /* :MouseEvent */ => ...)\n \n```",comment:["The text inside the ``` block is code and should not be localized."]},"configuration.inlayHints.parameterTypes.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.inlayHints.parameterTypes.enabled#` instead.","configuration.inlayHints.variableTypes.enabled":{message:"Enable/disable inlay hints for implicit variable types:\n```typescript\n\nconst foo /* :number */ = Date.now();\n \n```",comment:["The text inside the ``` block is code and should not be localized."]},"configuration.inlayHints.variableTypes.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.inlayHints.variableTypes.enabled#` instead.","configuration.inlayHints.variableTypes.suppressWhenTypeMatchesName":"Suppress type hints on variables whose name is identical to the type name.","configuration.inlayHints.variableTypes.suppressWhenTypeMatchesName.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.inlayHints.variableTypes.suppressWhenTypeMatchesName#` instead.","configuration.inlayHints.propertyDeclarationTypes.enabled":{message:`Enable/disable inlay hints for implicit types on property declarations:
\`\`\`typescript
class Foo {
prop /* :number */ = Date.now();
}
\`\`\``,comment:["The text inside the ``` block is code and should not be localized."]},"configuration.inlayHints.propertyDeclarationTypes.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.inlayHints.propertyDeclarationTypes.enabled#` instead.","configuration.inlayHints.functionLikeReturnTypes.enabled":{message:`Enable/disable inlay hints for implicit return types on function signatures:
\`\`\`typescript
function foo() /* :number */ {
return Date.now();
}
\`\`\``,comment:["The text inside the ``` block is code and should not be localized."]},"configuration.inlayHints.functionLikeReturnTypes.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.inlayHints.functionLikeReturnTypes.enabled#` instead.","configuration.inlayHints.enumMemberValues.enabled":{message:`Enable/disable inlay hints for member values in enum declarations:
\`\`\`typescript
enum MyValue {
A /* = 0 */;
B /* = 1 */;
}
\`\`\``,comment:["The text inside the ``` block is code and should not be localized."]},"configuration.inlayHints.enumMemberValues.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.inlayHints.enumMemberValues.enabled#` instead.","taskDefinition.tsconfig.description":"The tsconfig file that defines the TS build.","javascript.suggestionActions.enabled":"Enable/disable suggestion diagnostics for JavaScript files in the editor.","typescript.suggestionActions.enabled":"Enable/disable suggestion diagnostics for TypeScript files in the editor.","configuration.suggestionActions.enabled":"Enable/disable suggestion diagnostics for JavaScript and TypeScript files in the editor.","configuration.suggestionActions.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.suggestionActions.enabled#` instead.","configuration.preferences.quoteStyle.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.preferences.quoteStyle#` instead.","configuration.preferences.importModuleSpecifier.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.preferences.importModuleSpecifier#` instead.","configuration.preferences.importModuleSpecifierEnding.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.preferences.importModuleSpecifierEnding#` instead.","configuration.preferences.jsxAttributeCompletionStyle.auto":'Insert `={}` or `=""` after attribute names based on the prop type. See `#js/ts.preferences.quoteStyle#` to control the type of quotes used for string attributes.',"configuration.preferences.jsxAttributeCompletionStyle.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.preferences.jsxAttributeCompletionStyle#` instead.","configuration.preferences.includePackageJsonAutoImports.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.preferences.includePackageJsonAutoImports#` instead.","configuration.preferences.autoImportFileExcludePatterns.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.preferences.autoImportFileExcludePatterns#` instead.","configuration.preferences.autoImportSpecifierExcludeRegexes.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.preferences.autoImportSpecifierExcludeRegexes#` instead.","configuration.preferences.preferTypeOnlyAutoImports.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.preferences.preferTypeOnlyAutoImports#` instead.","configuration.preferences.useAliasesForRenames.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.preferences.useAliasesForRenames#` instead.","configuration.preferences.renameMatchingJsxTags.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.preferences.renameMatchingJsxTags#` instead.","configuration.preferences.organizeImports.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.preferences.organizeImports#` instead.","typescript.preferences.quoteStyle":"Preferred quote style to use for Quick Fixes.","typescript.preferences.quoteStyle.single":"Always use single quotes: `'`","typescript.preferences.quoteStyle.double":'Always use double quotes: `"`',"typescript.preferences.quoteStyle.auto":"Infer quote type from existing code","typescript.preferences.importModuleSpecifier":"Preferred path style for auto imports.","typescript.preferences.importModuleSpecifier.shortest":"Prefers a non-relative import only if one is available that has fewer path segments than a relative import.","typescript.preferences.importModuleSpecifier.relative":"Prefers a relative path to the imported file location.","typescript.preferences.importModuleSpecifier.nonRelative":"Prefers a non-relative import based on the `baseUrl` or `paths` configured in your `jsconfig.json` / `tsconfig.json`.","typescript.preferences.importModuleSpecifier.projectRelative":"Prefers a non-relative import only if the relative import path would leave the package or project directory.","typescript.preferences.importModuleSpecifierEnding":"Preferred path ending for auto imports.","typescript.preferences.importModuleSpecifierEnding.label.js":".js / .ts","typescript.preferences.importModuleSpecifierEnding.auto":"Use project settings to select a default.","typescript.preferences.importModuleSpecifierEnding.minimal":"Shorten `./component/index.js` to `./component`.","typescript.preferences.importModuleSpecifierEnding.index":"Shorten `./component/index.js` to `./component/index`.","typescript.preferences.importModuleSpecifierEnding.js":"Do not shorten path endings; include the `.js` or `.ts` extension.","typescript.preferences.jsxAttributeCompletionStyle":"Preferred style for JSX attribute completions.","javascript.preferences.jsxAttributeCompletionStyle.auto":'Insert `={}` or `=""` after attribute names based on the prop type. See `#javascript.preferences.quoteStyle#` to control the type of quotes used for string attributes.',"typescript.preferences.jsxAttributeCompletionStyle.auto":'Insert `={}` or `=""` after attribute names based on the prop type. See `#typescript.preferences.quoteStyle#` to control the type of quotes used for string attributes.',"typescript.preferences.jsxAttributeCompletionStyle.braces":"Insert `={}` after attribute names.","typescript.preferences.jsxAttributeCompletionStyle.none":"Only insert attribute names.","typescript.preferences.includePackageJsonAutoImports":"Enable/disable searching `package.json` dependencies for available auto imports.","typescript.preferences.includePackageJsonAutoImports.auto":"Search dependencies based on estimated performance impact.","typescript.preferences.includePackageJsonAutoImports.on":"Always search dependencies.","typescript.preferences.includePackageJsonAutoImports.off":"Never search dependencies.","typescript.preferences.autoImportFileExcludePatterns":"Specify glob patterns of files to exclude from auto imports. Relative paths are resolved relative to the workspace root. Patterns are evaluated using tsconfig.json [`exclude`](https://www.typescriptlang.org/tsconfig#exclude) semantics.","typescript.preferences.autoImportSpecifierExcludeRegexes":"Specify regular expressions to exclude auto imports with matching import specifiers. Examples:\n\n- `^node:`\n- `lib/internal` (slashes don't need to be escaped...)\n- `/lib\\/internal/i` (...unless including surrounding slashes for `i` or `u` flags)\n- `^lodash$` (only allow subpath imports from lodash)","typescript.preferences.preferTypeOnlyAutoImports":"Include the `type` keyword in auto-imports whenever possible. Requires using TypeScript 5.3+ in the workspace.","typescript.workspaceSymbols.excludeLibrarySymbols":"Exclude symbols that come from library files in `Go to Symbol in Workspace` results. Requires using TypeScript 5.3+ in the workspace.","configuration.workspaceSymbols.excludeLibrarySymbols.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.workspaceSymbols.excludeLibrarySymbols#` instead.","typescript.updateImportsOnFileMove.enabled":"Enable/disable automatic updating of import paths when you rename or move a file in VS Code.","typescript.updateImportsOnFileMove.enabled.prompt":"Prompt on each rename.","typescript.updateImportsOnFileMove.enabled.always":"Always update paths automatically.","typescript.updateImportsOnFileMove.enabled.never":"Never rename paths and don't prompt.","configuration.updateImportsOnFileMove.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.updateImportsOnFileMove.enabled#` instead.","typescript.autoClosingTags":"Enable/disable automatic closing of JSX tags.","configuration.autoClosingTags.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.autoClosingTags.enabled#` instead.","typescript.suggest.enabled":"Enable/disable autocomplete suggestions.","configuration.suggest.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.suggest.enabled#` instead.","configuration.suggest.jsdoc.enabled":"Enable/disable suggestion to complete JSDoc comments.","configuration.suggest.completeJSDocs.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.suggest.jsdoc.enabled#` instead.","configuration.tsserver.useVsCodeWatcher":"Use VS Code's file watchers instead of TypeScript's. Requires using TypeScript 5.4+ in the workspace.","configuration.tsserver.watchOptions":"Configure which watching strategies should be used to keep track of files and directories.","configuration.tsserver.watchOptions.vscode":"Use VS Code's file watchers instead of TypeScript's. Requires using TypeScript 5.4+ in the workspace.","configuration.tsserver.watchOptions.watchFile":"Strategy for how individual files are watched.","configuration.tsserver.watchOptions.watchFile.fixedChunkSizePolling":"Polls files in chunks at regular interval.","configuration.tsserver.watchOptions.watchFile.fixedPollingInterval":"Check every file for changes several times a second at a fixed interval.","configuration.tsserver.watchOptions.watchFile.priorityPollingInterval":"Check every file for changes several times a second, but use heuristics to check certain types of files less frequently than others.","configuration.tsserver.watchOptions.watchFile.dynamicPriorityPolling":"Use a dynamic queue where less-frequently modified files will be checked less often.","configuration.tsserver.watchOptions.watchFile.useFsEvents":"Attempt to use the operating system/file system's native events for file changes.","configuration.tsserver.watchOptions.watchFile.useFsEventsOnParentDirectory":"Attempt to use the operating system/file system's native events to listen for changes on a file's containing directories. This can use fewer file watchers, but might be less accurate.","configuration.tsserver.watchOptions.watchDirectory":"Strategy for how entire directory trees are watched under systems that lack recursive file-watching functionality.","configuration.tsserver.watchOptions.watchDirectory.fixedChunkSizePolling":"Polls directories in chunks at regular interval.","configuration.tsserver.watchOptions.watchDirectory.fixedPollingInterval":"Check every directory for changes several times a second at a fixed interval.","configuration.tsserver.watchOptions.watchDirectory.dynamicPriorityPolling":"Use a dynamic queue where less-frequently modified directories will be checked less often.","configuration.tsserver.watchOptions.watchDirectory.useFsEvents":"Attempt to use the operating system/file system's native events for directory changes.","configuration.tsserver.watchOptions.fallbackPolling":"When using file system events, this option specifies the polling strategy that gets used when the system runs out of native file watchers and/or doesn't support native file watchers.","configuration.tsserver.watchOptions.fallbackPolling.fixedPollingInterval":"Check every file for changes several times a second at a fixed interval.","configuration.tsserver.watchOptions.fallbackPolling.priorityPollingInterval":"Check every file for changes several times a second, but use heuristics to check certain types of files less frequently than others.","configuration.tsserver.watchOptions.fallbackPolling.dynamicPriorityPolling ":"Use a dynamic queue where less-frequently modified files will be checked less often.","configuration.tsserver.watchOptions.synchronousWatchDirectory":"Disable deferred watching on directories. Deferred watching is useful when lots of file changes might occur at once (e.g. a change in node_modules from running npm install), but you might want to disable it with this flag for some less-common setups.","typescript.preferences.useAliasesForRenames":"Enable/disable introducing aliases for object shorthand properties during renames.","typescript.preferences.renameMatchingJsxTags":"When on a JSX tag, try to rename the matching tag instead of renaming the symbol. Requires using TypeScript 5.1+ in the workspace.","typescript.preferences.organizeImports":"Advanced preferences that control how imports are ordered.","javascript.preferences.organizeImports":"Advanced preferences that control how imports are ordered.","typescript.preferences.organizeImports.caseSensitivity":"Specifies how imports should be sorted with regards to case-sensitivity. If `auto` or unspecified, we will detect the case-sensitivity per file","typescript.preferences.organizeImports.caseSensitivity.auto":"Detect case-sensitivity for import sorting.","typescript.preferences.organizeImports.caseSensitivity.insensitive":"Sort imports case-insensitively.","typescript.preferences.organizeImports.caseSensitivity.sensitive":"Sort imports case-sensitively.","typescript.preferences.organizeImports.typeOrder":"Specify how type-only named imports should be sorted.","typescript.preferences.organizeImports.typeOrder.auto":"Detect where type-only named imports should be sorted.","typescript.preferences.organizeImports.typeOrder.last":"Type only named imports are sorted to the end of the import list. E.g. `import { B, Z, type A, type Y } from 'module';`","typescript.preferences.organizeImports.typeOrder.inline":"Named imports are sorted by name only. E.g. `import { type A, B, type Y, Z } from 'module';`","typescript.preferences.organizeImports.typeOrder.first":"Type only named imports are sorted to the beginning of the import list. E.g. `import { type A, type Y, B, Z } from 'module';`","typescript.preferences.organizeImports.unicodeCollation":"Specify whether to sort imports using Unicode or Ordinal collation.","typescript.preferences.organizeImports.unicodeCollation.ordinal":"Sort imports using the numeric value of each code point.","typescript.preferences.organizeImports.unicodeCollation.unicode":"Sort imports using the Unicode code collation.","typescript.preferences.organizeImports.locale":"Requires `organizeImports.unicodeCollation: 'unicode'`. Overrides the locale used for collation. Specify `auto` to use the UI locale.","typescript.preferences.organizeImports.caseFirst":"Requires `organizeImports.unicodeCollation: 'unicode'`, and `organizeImports.caseSensitivity` is not `caseInsensitive`. Indicates whether upper-case will sort before lower-case.","typescript.preferences.organizeImports.caseFirst.default":"Default order given by `locale`.","typescript.preferences.organizeImports.caseFirst.lower":"Lower-case comes before upper-case. E.g.` a, A, z, Z`.","typescript.preferences.organizeImports.caseFirst.upper":"Upper-case comes before lower-case. E.g. ` A, a, B, b`.","typescript.preferences.organizeImports.numericCollation":"Requires `organizeImports.unicodeCollation: 'unicode'`. Sort numeric strings by integer value.","typescript.preferences.organizeImports.accentCollation":"Requires `organizeImports.unicodeCollation: 'unicode'`. Compare characters with diacritical marks as unequal to base character.","typescript.workspaceSymbols.scope":"Controls which files are searched by [Go to Symbol in Workspace](https://code.visualstudio.com/docs/editor/editingevolved#_open-symbol-by-name).","typescript.workspaceSymbols.scope.allOpenProjects":"Search all open JavaScript or TypeScript projects for symbols.","typescript.workspaceSymbols.scope.currentProject":"Only search for symbols in the current JavaScript or TypeScript project.","configuration.workspaceSymbols.scope.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.workspaceSymbols.scope#` instead.","typescript.sortImports":"Sort Imports","typescript.removeUnusedImports":"Remove Unused Imports","typescript.findAllFileReferences":"Find File References","typescript.goToSourceDefinition":"Go to Source Definition","configuration.suggest.classMemberSnippets.enabled":"Enable/disable snippet completions for class members.","configuration.suggest.classMemberSnippets.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.suggest.classMemberSnippets.enabled#` instead.","configuration.suggest.objectLiteralMethodSnippets.enabled":"Enable/disable snippet completions for methods in object literals.","configuration.suggest.objectLiteralMethodSnippets.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.suggest.objectLiteralMethodSnippets.enabled#` instead.","configuration.tsserver.web.projectWideIntellisense.enabled":"Enable/disable project-wide IntelliSense on web. Requires that VS Code is running in a trusted context.","configuration.tsserver.web.projectWideIntellisense.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.web.projectWideIntellisense.enabled#` instead.","configuration.tsserver.web.projectWideIntellisense.suppressSemanticErrors":"Suppresses semantic errors on web even when project wide IntelliSense is enabled. This is always on when project wide IntelliSense is not enabled or available. See `#js/ts.tsserver.web.projectWideIntellisense.enabled#`","configuration.tsserver.web.projectWideIntellisense.suppressSemanticErrors.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.web.projectWideIntellisense.suppressSemanticErrors#` instead.","configuration.tsserver.web.typeAcquisition.enabled":"Enable/disable package acquisition on the web. This enables IntelliSense for imported packages. Requires `#js/ts.tsserver.web.projectWideIntellisense.enabled#`. Currently not supported for Safari.","configuration.tsserver.web.typeAcquisition.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.web.typeAcquisition.enabled#` instead.","configuration.tsserver.nodePath":"Run TS Server on a custom Node installation. This can be a path to a Node executable, or 'node' if you want VS Code to detect a Node installation.","configuration.tsserver.nodePath.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.node.path#` instead.","configuration.tsserver.watchOptions.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.watchOptions#` instead.","configuration.updateImportsOnPaste":"Automatically update imports when pasting code. Requires TypeScript 5.6+.","configuration.updateImportsOnPaste.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.updateImportsOnPaste.enabled#` instead.","configuration.hover.maximumLength":"The maximum number of characters in a hover. If the hover is longer than this, it will be truncated. Requires TypeScript 5.9+.","walkthroughs.nodejsWelcome.title":"Get started with JavaScript and Node.js","walkthroughs.nodejsWelcome.description":"Make the most of Visual Studio Code's first-class JavaScript experience.","walkthroughs.nodejsWelcome.downloadNode.forMacOrWindows.title":"Install Node.js","walkthroughs.nodejsWelcome.downloadNode.forMacOrWindows.description":`Node.js is an easy way to run JavaScript code. You can use it to quickly build command-line apps and servers. It also comes with npm, a package manager which makes reusing and sharing JavaScript code easy.
[Install Node.js](https://nodejs.org/en/download/)`,"walkthroughs.nodejsWelcome.downloadNode.forLinux.title":"Install Node.js","walkthroughs.nodejsWelcome.downloadNode.forLinux.description":`Node.js is an easy way to run JavaScript code. You can use it to quickly build command-line apps and servers. It also comes with npm, a package manager which makes reusing and sharing JavaScript code easy.
[Install Node.js](https://nodejs.org/en/download/package-manager/)`,"walkthroughs.nodejsWelcome.makeJsFile.title":"Create a JavaScript File","walkthroughs.nodejsWelcome.makeJsFile.description":"Let's write our first JavaScript file. We'll have to create a new file and save it with the ``.js`` extension at the end of the file name.\n[Create a JavaScript File](command:javascript-walkthrough.commands.createJsFile)","walkthroughs.nodejsWelcome.debugJsFile.title":"Run and Debug your JavaScript","walkthroughs.nodejsWelcome.debugJsFile.description":"Once you've installed Node.js, you can run JavaScript programs at a terminal by entering ``node your-file-name.js``\nAnother easy way to run Node.js programs is by using VS Code's debugger which lets you run your code, pause at different points, and help you understand what's going on step-by-step.\n[Start Debugging](command:javascript-walkthrough.commands.debugJsFile)","walkthroughs.nodejsWelcome.debugJsFile.altText":"Debug and run your JavaScript code in Node.js with Visual Studio Code.","walkthroughs.nodejsWelcome.learnMoreAboutJs.title":"Explore More","walkthroughs.nodejsWelcome.learnMoreAboutJs.description":`Want to get more comfortable with JavaScript, Node.js, and VS Code? Be sure to check out our docs!
We've got lots of resources for learning [JavaScript](https://code.visualstudio.com/docs/nodejs/working-with-javascript) and [Node.js](https://code.visualstudio.com/docs/nodejs/nodejs-tutorial).
[Learn More](https://code.visualstudio.com/docs/nodejs/nodejs-tutorial)`,"walkthroughs.nodejsWelcome.learnMoreAboutJs.altText":"Learn more about JavaScript and Node.js in Visual Studio Code."},readmePath:"typescript-language-features\\README.md"},{extensionPath:"vb",packageJSON:{name:"vb",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin textmate/asp.vb.net.tmbundle Syntaxes/ASP%20VB.net.plist ./syntaxes/asp-vb-net.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"vb",extensions:[".vb",".brs",".vbs",".bas",".vba"],aliases:["Visual Basic","vb"],configuration:"./language-configuration.json"}],grammars:[{language:"vb",scopeName:"source.asp.vb.net",path:"./syntaxes/asp-vb-net.tmLanguage.json"}],snippets:[{language:"vb",path:"./snippets/vb.code-snippets"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Visual Basic Language Basics",description:"Provides snippets, syntax highlighting, bracket matching and folding in Visual Basic files."}},{extensionPath:"xml",packageJSON:{name:"xml",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},categories:["Programming Languages"],contributes:{languages:[{id:"xml",extensions:[".xml",".xsd",".ascx",".atom",".axml",".axaml",".bpmn",".cpt",".csl",".csproj",".csproj.user",".dita",".ditamap",".dtd",".ent",".mod",".dtml",".fsproj",".fxml",".iml",".isml",".jmx",".launch",".menu",".mxml",".nuspec",".opml",".owl",".proj",".props",".pt",".publishsettings",".pubxml",".pubxml.user",".rbxlx",".rbxmx",".rdf",".rng",".rss",".shproj",".slnx",".storyboard",".svg",".targets",".tld",".tmx",".vbproj",".vbproj.user",".vcxproj",".vcxproj.filters",".wsdl",".wxi",".wxl",".wxs",".xaml",".xbl",".xib",".xlf",".xliff",".xpdl",".xul",".xoml"],firstLine:"(\\<\\?xml.*)|(\\<svg)|(\\<\\!doctype\\s+svg)",aliases:["XML","xml"],configuration:"./xml.language-configuration.json"},{id:"xsl",extensions:[".xsl",".xslt"],aliases:["XSL","xsl"],configuration:"./xsl.language-configuration.json"}],grammars:[{language:"xml",scopeName:"text.xml",path:"./syntaxes/xml.tmLanguage.json"},{language:"xsl",scopeName:"text.xml.xsl",path:"./syntaxes/xsl.tmLanguage.json"}]},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin atom/language-xml grammars/xml.cson ./syntaxes/xml.tmLanguage.json grammars/xsl.cson ./syntaxes/xsl.tmLanguage.json"},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"XML Language Basics",description:"Provides syntax highlighting and bracket matching in XML files."}},{extensionPath:"yaml",packageJSON:{name:"yaml",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ./build/update-grammar.js"},categories:["Programming Languages"],contributes:{languages:[{id:"dockercompose",aliases:["Compose","compose"],filenamePatterns:["compose.yml","compose.yaml","compose.*.yml","compose.*.yaml","*docker*compose*.yml","*docker*compose*.yaml"],configuration:"./language-configuration.json"},{id:"yaml",aliases:["YAML","yaml"],extensions:[".yaml",".yml",".eyaml",".eyml",".cff",".yaml-tmlanguage",".yaml-tmpreferences",".yaml-tmtheme",".winget"],firstLine:"^#cloud-config",configuration:"./language-configuration.json"}],grammars:[{language:"dockercompose",scopeName:"source.yaml",path:"./syntaxes/yaml.tmLanguage.json"},{scopeName:"source.yaml.1.3",path:"./syntaxes/yaml-1.3.tmLanguage.json"},{scopeName:"source.yaml.1.2",path:"./syntaxes/yaml-1.2.tmLanguage.json"},{scopeName:"source.yaml.1.1",path:"./syntaxes/yaml-1.1.tmLanguage.json"},{scopeName:"source.yaml.1.0",path:"./syntaxes/yaml-1.0.tmLanguage.json"},{scopeName:"source.yaml.embedded",path:"./syntaxes/yaml-embedded.tmLanguage.json"},{language:"yaml",scopeName:"source.yaml",path:"./syntaxes/yaml.tmLanguage.json",unbalancedBracketScopes:["invalid.illegal","meta.scalar.yaml","storage.type.tag.shorthand.yaml","keyword.control.flow"]}],configurationDefaults:{"[yaml]":{"editor.insertSpaces":!0,"editor.tabSize":2,"editor.autoIndent":"advanced","diffEditor.ignoreTrimWhitespace":!1,"editor.defaultColorDecorators":"never","editor.quickSuggestions":{strings:"on"}},"[dockercompose]":{"editor.insertSpaces":!0,"editor.tabSize":2,"editor.autoIndent":"advanced"}}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"YAML Language Basics",description:"Provides syntax highlighting and bracket matching in YAML files."}}];else{let c=It.document.getElementById("vscode-workbench-builtin-extensions"),u=c?c.getAttribute("data-settings"):void 0;if(u)try{l=JSON.parse(u)}catch{}}this.builtinExtensionsPromises=l.map(async c=>{let u=Df(c.packageJSON.publisher,c.packageJSON.name);return{identifier:{id:u},location:e.extUri.joinPath(s,c.extensionPath),type:0,isBuiltin:!0,manifest:c.packageNLS?await this.localizeManifest(u,c.packageJSON,c.packageNLS):c.packageJSON,readmeUrl:c.readmePath?e.extUri.joinPath(s,c.readmePath):void 0,changelogUrl:c.changelogPath?e.extUri.joinPath(s,c.changelogPath):void 0,targetPlatform:"web",validations:[],isValid:!0,preRelease:!1}})}}}async scanBuiltinExtensions(){return[...await Promise.all(this.builtinExtensionsPromises)]}async localizeManifest(i,e,t){if(!this.nlsUrl)return RDe(this.logService,e,t);let o=A.joinPath(this.nlsUrl,i,"package");try{let n=await this.extensionResourceLoaderService.readExtensionResource(o),r=JSON.parse(n.toString());return RDe(this.logService,e,r,t)}catch(n){return this.logService.error(n),RDe(this.logService,e,t)}}};pXe=I([m(0,Vt),m(1,dt),m(2,Bx),m(3,nt),m(4,ne)],pXe);we(B8i,pXe,1);var nD=ae("extensionRecommendationsService"),uk=ae("IExtensionIgnoredRecommendationsService");var Yue=".vscode/extensions.json",EK=ae("IWorkspaceExtensionsConfigService"),mXe=class extends C{constructor(e,t,o,n,r,s){super();this.workspaceContextService=e;this.fileService=t;this.quickInputService=o;this.modelService=n;this.languageService=r;this.jsonEditingService=s;this._onDidChangeExtensionsConfigs=this._register(new E);this.onDidChangeExtensionsConfigs=this._onDidChangeExtensionsConfigs.event;this._register(e.onDidChangeWorkspaceFolders(l=>this._onDidChangeExtensionsConfigs.fire())),this._register(t.onDidFilesChange(l=>{let c=e.getWorkspace();(c.configuration&&l.affects(c.configuration)||c.folders.some(u=>l.affects(u.toResource(Yue))))&&this._onDidChangeExtensionsConfigs.fire()}))}async getExtensionsConfigs(){let e=this.workspaceContextService.getWorkspace(),t=[],o=e.configuration?await this.resolveWorkspaceExtensionConfig(e.configuration):void 0;return o&&t.push(o),t.push(...await Promise.all(e.folders.map(n=>this.resolveWorkspaceFolderExtensionConfig(n)))),t}async getRecommendations(){let e=await this.getExtensionsConfigs();return Uo(e.flatMap(t=>t.recommendations?t.recommendations.map(o=>o.toLowerCase()):[]))}async getUnwantedRecommendations(){let e=await this.getExtensionsConfigs();return Uo(e.flatMap(t=>t.unwantedRecommendations?t.unwantedRecommendations.map(o=>o.toLowerCase()):[]))}async toggleRecommendation(e){e=e.toLowerCase();let t=this.workspaceContextService.getWorkspace(),o=t.configuration?await this.resolveWorkspaceExtensionConfig(t.configuration):void 0,n=new vt;await Promise.all(t.folders.map(async u=>{let p=await this.resolveWorkspaceFolderExtensionConfig(u);n.set(u.uri,p)}));let r=o&&o.recommendations?.some(u=>u.toLowerCase()===e),s=t.folders.filter(u=>n.get(u.uri)?.recommendations?.some(p=>p.toLowerCase()===e)),l=r||s.length>0,c=l?await this.pickWorkspaceOrFolders(s,r?t:void 0,d(16897,null)):await this.pickWorkspaceOrFolders(t.folders,t.configuration?t:void 0,d(16896,null));for(let u of c)Tq(u)?await this.addOrRemoveWorkspaceRecommendation(e,u,o,!l):await this.addOrRemoveWorkspaceFolderRecommendation(e,u,n.get(u.uri),!l)}async toggleUnwantedRecommendation(e){let t=this.workspaceContextService.getWorkspace(),o=t.configuration?await this.resolveWorkspaceExtensionConfig(t.configuration):void 0,n=new vt;await Promise.all(t.folders.map(async u=>{let p=await this.resolveWorkspaceFolderExtensionConfig(u);n.set(u.uri,p)}));let r=o&&o.unwantedRecommendations?.some(u=>u===e),s=t.folders.filter(u=>n.get(u.uri)?.unwantedRecommendations?.some(p=>p===e)),l=r||s.length>0,c=l?await this.pickWorkspaceOrFolders(s,r?t:void 0,d(16897,null)):await this.pickWorkspaceOrFolders(t.folders,t.configuration?t:void 0,d(16896,null));for(let u of c)Tq(u)?await this.addOrRemoveWorkspaceUnwantedRecommendation(e,u,o,!l):await this.addOrRemoveWorkspaceFolderUnwantedRecommendation(e,u,n.get(u.uri),!l)}async addOrRemoveWorkspaceFolderRecommendation(e,t,o,n){let r=[];if(n){Array.isArray(o.recommendations)?r.push({path:["recommendations",-1],value:e}):r.push({path:["recommendations"],value:[e]});let s=this.getEditToRemoveValueFromArray(["unwantedRecommendations"],o.unwantedRecommendations,e);s&&r.push(s)}else if(o.recommendations){let s=this.getEditToRemoveValueFromArray(["recommendations"],o.recommendations,e);s&&r.push(s)}if(r.length)return this.jsonEditingService.write(t.toResource(Yue),r,!0)}async addOrRemoveWorkspaceRecommendation(e,t,o,n){let r=[];if(o){if(n){let s=["extensions","recommendations"];Array.isArray(o.recommendations)?r.push({path:[...s,-1],value:e}):r.push({path:s,value:[e]});let l=this.getEditToRemoveValueFromArray(["extensions","unwantedRecommendations"],o.unwantedRecommendations,e);l&&r.push(l)}else if(o.recommendations){let s=this.getEditToRemoveValueFromArray(["extensions","recommendations"],o.recommendations,e);s&&r.push(s)}}else n&&r.push({path:["extensions"],value:{recommendations:[e]}});if(r.length)return this.jsonEditingService.write(t.configuration,r,!0)}async addOrRemoveWorkspaceFolderUnwantedRecommendation(e,t,o,n){let r=[];if(n){let s=["unwantedRecommendations"];Array.isArray(o.unwantedRecommendations)?r.push({path:[...s,-1],value:e}):r.push({path:s,value:[e]});let l=this.getEditToRemoveValueFromArray(["recommendations"],o.recommendations,e);l&&r.push(l)}else if(o.unwantedRecommendations){let s=this.getEditToRemoveValueFromArray(["unwantedRecommendations"],o.unwantedRecommendations,e);s&&r.push(s)}if(r.length)return this.jsonEditingService.write(t.toResource(Yue),r,!0)}async addOrRemoveWorkspaceUnwantedRecommendation(e,t,o,n){let r=[];if(o){if(n){let s=["extensions","unwantedRecommendations"];Array.isArray(o.recommendations)?r.push({path:[...s,-1],value:e}):r.push({path:s,value:[e]});let l=this.getEditToRemoveValueFromArray(["extensions","recommendations"],o.recommendations,e);l&&r.push(l)}else if(o.unwantedRecommendations){let s=this.getEditToRemoveValueFromArray(["extensions","unwantedRecommendations"],o.unwantedRecommendations,e);s&&r.push(s)}}else n&&r.push({path:["extensions"],value:{unwantedRecommendations:[e]}});if(r.length)return this.jsonEditingService.write(t.configuration,r,!0)}async pickWorkspaceOrFolders(e,t,o){let n=t?[...e,t]:[...e];if(n.length===1)return n;let r=e.map(l=>({label:l.name,description:d(16899,null),workspaceOrFolder:l,iconClasses:js(this.modelService,this.languageService,l.uri,2)}));return t&&(r.push({type:"separator"}),r.push({label:d(16898,null),workspaceOrFolder:t})),(await this.quickInputService.pick(r,{placeHolder:o,canPickMany:!0})||[]).map(l=>l.workspaceOrFolder)}async resolveWorkspaceExtensionConfig(e){try{let t=await this.fileService.readFile(e),o=Ur(t.value.toString()).extensions;return o?this.parseExtensionConfig(o):void 0}catch{}}async resolveWorkspaceFolderExtensionConfig(e){try{let t=await this.fileService.readFile(e.toResource(Yue)),o=Ur(t.value.toString());return this.parseExtensionConfig(o)}catch{}return{}}parseExtensionConfig(e){return{recommendations:Uo((e.recommendations||[]).map(t=>t.toLowerCase())),unwantedRecommendations:Uo((e.unwantedRecommendations||[]).map(t=>t.toLowerCase()))}}getEditToRemoveValueFromArray(e,t,o){let n=t?.indexOf(o);if(n!==void 0&&n!==-1)return{path:[...e,n],value:void 0}}};mXe=I([m(0,Pe),m(1,be),m(2,Ge),m(3,Ct),m(4,kt),m(5,zf)],mXe);we(EK,mXe,1);var vSi="extensionsAssistant/ignored_recommendations",hXe=class extends C{constructor(e,t){super();this.workspaceExtensionsConfigService=e;this.storageService=t;this._onDidChangeIgnoredRecommendations=this._register(new E);this.onDidChangeIgnoredRecommendations=this._onDidChangeIgnoredRecommendations.event;this._globalIgnoredRecommendations=[];this._onDidChangeGlobalIgnoredRecommendation=this._register(new E);this.onDidChangeGlobalIgnoredRecommendation=this._onDidChangeGlobalIgnoredRecommendation.event;this.ignoredWorkspaceRecommendations=[];this._globalIgnoredRecommendations=this.getCachedIgnoredRecommendations(),this._register(this.storageService.onDidChangeValue(0,vSi,this._store)(()=>this.onDidStorageChange())),this.initIgnoredWorkspaceRecommendations()}get globalIgnoredRecommendations(){return[...this._globalIgnoredRecommendations]}get ignoredRecommendations(){return Uo([...this.globalIgnoredRecommendations,...this.ignoredWorkspaceRecommendations])}async initIgnoredWorkspaceRecommendations(){this.ignoredWorkspaceRecommendations=await this.workspaceExtensionsConfigService.getUnwantedRecommendations(),this._onDidChangeIgnoredRecommendations.fire(),this._register(this.workspaceExtensionsConfigService.onDidChangeExtensionsConfigs(async()=>{this.ignoredWorkspaceRecommendations=await this.workspaceExtensionsConfigService.getUnwantedRecommendations(),this._onDidChangeIgnoredRecommendations.fire()}))}toggleGlobalIgnoredRecommendation(e,t){e=e.toLowerCase(),this._globalIgnoredRecommendations.indexOf(e)!==-1!==t&&(this._globalIgnoredRecommendations=t?[...this._globalIgnoredRecommendations,e]:this._globalIgnoredRecommendations.filter(n=>n!==e),this.storeCachedIgnoredRecommendations(this._globalIgnoredRecommendations),this._onDidChangeGlobalIgnoredRecommendation.fire({extensionId:e,isRecommended:!t}),this._onDidChangeIgnoredRecommendations.fire())}getCachedIgnoredRecommendations(){return JSON.parse(this.ignoredRecommendationsValue).map(t=>t.toLowerCase())}onDidStorageChange(){this.ignoredRecommendationsValue!==this.getStoredIgnoredRecommendationsValue()&&(this._ignoredRecommendationsValue=void 0,this._globalIgnoredRecommendations=this.getCachedIgnoredRecommendations(),this._onDidChangeIgnoredRecommendations.fire())}storeCachedIgnoredRecommendations(e){this.ignoredRecommendationsValue=JSON.stringify(e)}get ignoredRecommendationsValue(){return this._ignoredRecommendationsValue||(this._ignoredRecommendationsValue=this.getStoredIgnoredRecommendationsValue()),this._ignoredRecommendationsValue}set ignoredRecommendationsValue(e){this.ignoredRecommendationsValue!==e&&(this._ignoredRecommendationsValue=e,this.setStoredIgnoredRecommendationsValue(e))}getStoredIgnoredRecommendationsValue(){return this.storageService.get(vSi,0,"[]")}setStoredIgnoredRecommendationsValue(e){this.storageService.store(vSi,e,0,0)}};hXe=I([m(0,EK),m(1,le)],hXe);we(uk,hXe,1);var bSi="extension.features.state",gXe=class extends C{constructor(e,t,o){super();this.storageService=e;this.dialogService=t;this.extensionService=o;this._onDidChangeEnablement=this._register(new E);this.onDidChangeEnablement=this._onDidChangeEnablement.event;this._onDidChangeAccessData=this._register(new E);this.onDidChangeAccessData=this._onDidChangeAccessData.event;this.extensionFeaturesState=new Map;this.registry=oe.as(Ds.ExtensionFeaturesRegistry),this.extensionFeaturesState=this.loadState(),this.garbageCollectOldRequests(),this._register(e.onDidChangeValue(0,bSi,this._store)(n=>this.onDidStorageChange(n)))}isEnabled(e,t){let o=this.registry.getExtensionFeature(t);if(!o)return!1;let n=this.getExtensionFeatureState(e,t)?.disabled;if(Da(n))return!n;let r=o.access.extensionsList?.[e._lower];return Da(r)?r:!o.access.requireUserConsent}setEnablement(e,t,o){if(!this.registry.getExtensionFeature(t))throw new Error(`No feature with id '${t}'`);let r=this.getAndSetIfNotExistsExtensionFeatureState(e,t);r.disabled!==!o&&(r.disabled=!o,this._onDidChangeEnablement.fire({extension:e,featureId:t,enabled:o}),this.saveState())}getEnablementData(e){let t=[];if(this.registry.getExtensionFeature(e))for(let[n,r]of this.extensionFeaturesState){let s=r.get(e);s?.disabled!==void 0&&t.push({extension:new Ei(n),enabled:!s.disabled})}return t}async getAccess(e,t,o){let n=this.registry.getExtensionFeature(t);if(!n)return!1;let r=this.getAndSetIfNotExistsExtensionFeatureState(e,t);if(r.disabled)return!1;if(r.disabled===void 0){let l=!0;if(n.access.requireUserConsent){let c=this.extensionService.extensions.find(p=>Ei.equals(p.identifier,e));l=(await this.dialogService.confirm({title:d(16840,null,n.label),message:d(16841,null,c?.displayName??e._lower,n.label),detail:o??n.description,custom:!0,primaryButton:d(16842,null),cancelButton:d(16843,null)})).confirmed}if(this.setEnablement(e,t,l),!l)return!1}let s=new Date;return r.accessData.current={accessTimes:[s].concat(r.accessData.current?.accessTimes??[]),lastAccessed:s,status:r.accessData.current?.status},r.accessData.accessTimes=(r.accessData.accessTimes??[]).concat(s),this.saveState(),this._onDidChangeAccessData.fire({extension:e,featureId:t,accessData:r.accessData}),!0}getAllAccessDataForExtension(e){let t=new Map,o=this.extensionFeaturesState.get(e._lower);if(o)for(let[n,r]of o)t.set(n,r.accessData);return t}getAccessData(e,t){if(this.registry.getExtensionFeature(t))return this.getExtensionFeatureState(e,t)?.accessData}setStatus(e,t,o){if(!this.registry.getExtensionFeature(t))throw new Error(`No feature with id '${t}'`);let r=this.getAndSetIfNotExistsExtensionFeatureState(e,t);r.accessData.current={accessTimes:r.accessData.current?.accessTimes??[],lastAccessed:r.accessData.current?.lastAccessed??new Date,status:o},this._onDidChangeAccessData.fire({extension:e,featureId:t,accessData:this.getAccessData(e,t)})}getExtensionFeatureState(e,t){return this.extensionFeaturesState.get(e._lower)?.get(t)}getAndSetIfNotExistsExtensionFeatureState(e,t){let o=this.extensionFeaturesState.get(e._lower);o||(o=new Map,this.extensionFeaturesState.set(e._lower,o));let n=o.get(t);return n||(n={accessData:{accessTimes:[]}},o.set(t,n)),n}onDidStorageChange(e){if(e.external){let t=this.extensionFeaturesState;this.extensionFeaturesState=this.loadState();for(let o of Uo([...t.keys(),...this.extensionFeaturesState.keys()])){let n=new Ei(o),r=t.get(o),s=this.extensionFeaturesState.get(o);for(let l of Uo([...r?.keys()??[],...s?.keys()??[]])){let c=this.isEnabled(n,l),u=!r?.get(l)?.disabled;c!==u&&this._onDidChangeEnablement.fire({extension:n,featureId:l,enabled:c});let p=this.getAccessData(n,l),h=r?.get(l)?.accessData;uo(p,h)||this._onDidChangeAccessData.fire({extension:n,featureId:l,accessData:p??{accessTimes:[]}})}}}}loadState(){let e={},t=this.storageService.get(bSi,0,"{}");try{e=JSON.parse(t)}catch{}let o=new Map;for(let n in e){let r=new Map,s=e[n];for(let l in s){let c=s[l];r.set(l,{disabled:c.disabled,accessData:{accessTimes:(c.accessTimes??[]).map(u=>new Date(u))}})}o.set(n.toLowerCase(),r)}return o}saveState(){let e={};this.extensionFeaturesState.forEach((t,o)=>{let n={};t.forEach((r,s)=>{n[s]={disabled:r.disabled,accessTimes:r.accessData.accessTimes.map(l=>l.getTime())}}),e[o]=n}),this.storageService.store(bSi,JSON.stringify(e),0,0)}garbageCollectOldRequests(){let e=new Date,t=new Date(e.setDate(e.getDate()-30)),o=!1;for(let[,n]of this.extensionFeaturesState)for(let[,r]of n){let s=r.accessData.accessTimes.length;r.accessData.accessTimes=r.accessData.accessTimes.filter(l=>l>t),r.accessData.accessTimes.length!==s&&(o=!0)}o&&this.saveState()}};gXe=I([m(0,le),m(1,ct),m(2,lt)],gXe);we(YI,gXe,1);var TK=class extends C{constructor(e){super();this.storageService=e;this.model=this._register(new KMt);this._onDidChangeFilter=this._register(new E);this.onDidChangeFilter=this._onDidChangeFilter.event;this.mapSourceToFilter=(()=>{let t=new Map;for(let o of this.storageService.getObject(TK.PER_SOURCE_FILTER_SETTINGS_KEY,-1,[]))t.set(o.id,o);return t})(),this.globalFilterEnabled=this.storageService.getBoolean(TK.GLOBAL_FILTER_SETTINGS_KEY,-1,!1),this.updateFilters(),this.registerListeners()}registerListeners(){this._register(this.model.onDidChangeNotification(e=>{if(e.kind===0){let t=typeof e.item.sourceId=="string"&&typeof e.item.source=="string"?{id:e.item.sourceId,label:e.item.source}:e.item.source;C9(t)&&(this.mapSourceToFilter.has(t.id)?this.updateSourceFilter(t):this.setFilter({...t,filter:0}))}}))}static{this.GLOBAL_FILTER_SETTINGS_KEY="notifications.doNotDisturbMode"}static{this.PER_SOURCE_FILTER_SETTINGS_KEY="notifications.perSourceDoNotDisturbMode"}setFilter(e){if(typeof e=="number"){if(this.globalFilterEnabled===(e===1))return;this.globalFilterEnabled=e===1,this.storageService.store(TK.GLOBAL_FILTER_SETTINGS_KEY,this.globalFilterEnabled,-1,1),this.updateFilters(),this._onDidChangeFilter.fire()}else{let t=this.mapSourceToFilter.get(e.id);if(t?.filter===e.filter&&t.label===e.label)return;this.mapSourceToFilter.set(e.id,{id:e.id,label:e.label,filter:e.filter}),this.saveSourceFilters(),this.updateFilters()}}getFilter(e){return e?this.mapSourceToFilter.get(e.id)?.filter??0:this.globalFilterEnabled?1:0}updateSourceFilter(e){let t=this.mapSourceToFilter.get(e.id);t&&t.label!==e.label&&(this.mapSourceToFilter.set(e.id,{id:e.id,label:e.label,filter:t.filter}),this.saveSourceFilters())}saveSourceFilters(){this.storageService.store(TK.PER_SOURCE_FILTER_SETTINGS_KEY,JSON.stringify([...this.mapSourceToFilter.values()]),-1,1)}getFilters(){return[...this.mapSourceToFilter.values()]}updateFilters(){this.model.setFilter({global:this.globalFilterEnabled?1:0,sources:new Map([...this.mapSourceToFilter.values()].map(e=>[e.id,e.filter]))})}removeFilter(e){this.mapSourceToFilter.delete(e)&&(this.saveSourceFilters(),this.updateFilters())}info(e){if(Array.isArray(e)){for(let t of e)this.info(t);return}this.model.addNotification({severity:St.Info,message:e})}warn(e){if(Array.isArray(e)){for(let t of e)this.warn(t);return}this.model.addNotification({severity:St.Warning,message:e})}error(e){if(Array.isArray(e)){for(let t of e)this.error(t);return}this.model.addNotification({severity:St.Error,message:e})}notify(e){let t=new P;if(e.neverShowAgain){let n=this.toStorageScope(e.neverShowAgain),r=e.neverShowAgain.id;if(this.storageService.getBoolean(r,n))return new tae;let s=t.add(new st("workbench.notification.neverShowAgain",d(17131,null),void 0,!0,async()=>{o.close(),this.storageService.store(r,!0,n,0)})),l={primary:e.actions?.primary||[],secondary:e.actions?.secondary||[]};e.neverShowAgain.isSecondary?l.secondary=[...l.secondary,s]:l.primary=[s,...l.primary],e.actions=l}let o=this.model.addNotification(e);return H.once(o.onDidClose)(()=>t.dispose()),o}toStorageScope(e){switch(e.scope){case 2:return-1;case 1:return 0;case 0:return 1;default:return-1}}prompt(e,t,o,n){if(n?.neverShowAgain){let h=this.toStorageScope(n.neverShowAgain),g=n.neverShowAgain.id;if(this.storageService.getBoolean(g,h))return new tae;let f={label:d(17131,null),run:()=>this.storageService.store(g,!0,h,0),isSecondary:n.neverShowAgain.isSecondary};n.neverShowAgain.isSecondary?o=[...o,f]:o=[f,...o]}let r=!1,s=new P,l=[],c=[];o.forEach((h,g)=>{let f=new Jde(`workbench.dialog.choice.${g}`,h);h.isSecondary?c.push(f):l.push(f),s.add(f.onDidRun(()=>{r=!0,h.keepOpen||p.close()})),s.add(f)});let u={primary:l,secondary:c},p=this.notify({severity:e,message:t,actions:u,sticky:n?.sticky,priority:n?.priority});return H.once(p.onDidClose)(()=>{s.dispose(),n&&typeof n.onCancel=="function"&&!r&&n.onCancel()}),p}status(e,t){return this.model.showStatusMessage(e,t)}};TK=I([m(0,le)],TK);we(Ne,TK,1);var fXe=class{constructor(i,e,t,o){this.keybindingsService=i;this.textModelService=e;this.textResourcePropertiesService=t;this.textResourceConfigurationService=o}async resolveDefaultCoreIgnoredSettings(){return WJ(!0)}async resolveUserBindings(i){let e={};for(let t of i)e[t]=this.keybindingsService.resolveUserBinding(t).map(o=>o.getUserSettingsLabel()).join(" ");return e}async resolveFormattingOptions(i){try{let e=await this.textModelService.createModelReference(i),{insertSpaces:t,tabSize:o}=e.object.textEditorModel.getOptions(),n=e.object.textEditorModel.getEOL();return e.dispose(),{eol:n,insertSpaces:t,tabSize:o}}catch{}return{eol:this.textResourcePropertiesService.getEOL(i),insertSpaces:!!this.textResourceConfigurationService.getValue(i,"editor.insertSpaces"),tabSize:this.textResourceConfigurationService.getValue(i,"editor.tabSize")}}};fXe=I([m(0,_e),m(1,Nt),m(2,sL),m(3,Nn)],fXe);we(BJ,fXe,1);function PDe(a,i,e,t){let o=Sb(a,i,e,t)[0];return o&&(a=a.substring(0,o.offset)+o.content+a.substring(o.offset+o.length)),a}function uFt(a,i,e){let t=[];e?t=K5o(e):t=z5o(i);let o=[],n=[...sFt()];if(Array.isArray(t))for(let r of t)r.startsWith("-")?n.push(r.substring(1)):o.push(r);return Uo([...a,...o].filter(r=>!n.includes(r)))}function z5o(a){let i=a.inspect("settingsSync.ignoredSettings").userValue;return i!==void 0||(i=a.inspect("sync.ignoredSettings").userValue,i!==void 0)?i:a.getValue("settingsSync.ignoredSettings")||[]}function K5o(a){let i=Ur(a);return i?i["settingsSync.ignoredSettings"]||i["sync.ignoredSettings"]||[]:[]}function ySi(a,i,e,t){if(e.length){let o=ISi(i),n=Ur(i)||{},r=Ur(a);if(!r)return a;let s=[];for(let l of e){let c=n[l],u=r[l];c===void 0?a=PDe(a,[l],void 0,t):u!==void 0?a=PDe(a,[l],c,t):s.push(vXe(l,o))}s.sort((l,c)=>l.startOffset-c.startOffset),s.forEach(l=>a=G5o(l.setting.key,i,a,t))}return a}function G5o(a,i,e,t){let o=Ur(i),n=ISi(i),r=ISi(e),s=$5o(a,n,r);return q5o(e,a,o[a],s,r,t)}function $5o(a,i,e){let t=i.findIndex(n=>n.setting?.key===a),o=i[t-1];if(o){if(o.setting){let r=vXe(o.setting.key,e);if(r)return{index:e.indexOf(r),insertAfter:!0}}else{let r=SSi(t,i);if(r){let s=vXe(r.setting.key,e);if(s){let l=dFt(e.indexOf(s),e),c=ADe(i,r,i[t]);if(l){let u=ADe(e,s,l),p=cFt(c,u);return p?{index:e.indexOf(p),insertAfter:!0}:{index:e.indexOf(l),insertAfter:!1}}else{let u=ADe(e,s,e[e.length-1]),p=cFt(c,u);return p?{index:e.indexOf(p),insertAfter:!0}:{index:e.length-1,insertAfter:!0}}}}}let n=i[t+1];if(n)if(n.setting){let r=vXe(n.setting.key,e);if(r)return{index:e.indexOf(r),insertAfter:!1}}else{let r=dFt(t,i);if(r){let s=vXe(r.setting.key,e);if(s){let l=SSi(e.indexOf(s),e),c=ADe(i,i[t],r);if(l){let u=ADe(e,l,s),p=cFt(c.reverse(),u.reverse());return p?{index:e.indexOf(p),insertAfter:!1}:{index:e.indexOf(l),insertAfter:!0}}else{let u=ADe(e,e[0],s),p=cFt(c.reverse(),u.reverse());return p?{index:e.indexOf(p),insertAfter:!1}:{index:0,insertAfter:!1}}}}}}return{index:e.length-1,insertAfter:!0}}function q5o(a,i,e,t,o,n){let r;return t.index===-1?r=Sb(a,[i],e,n):r=j5o(a,i,e,t,o,n).map(s=>GX(a,s,n)[0]),Nde(a,r)}function j5o(a,i,e,t,o,n){let r=`${JSON.stringify(i)}: ${JSON.stringify(e)}`,s=Vhi(n,a),l=o[t.index];if(t.insertAfter){let c=[];if(l.setting)c.push({offset:l.endOffset,length:0,content:","+r});else{let u=dFt(t.index,o),p=SSi(t.index,o),h=p?.setting?.commaOffset;p&&h===void 0&&c.push({offset:p.endOffset,length:0,content:","});let g=h!==void 0&&h>l.endOffset;c.push({offset:g?h+1:l.endOffset,length:0,content:u?s+r+",":s+r})}return c}else{if(l.setting)return[{offset:l.startOffset,length:0,content:r+","}];let c=(o[t.index-1]&&!o[t.index-1].setting?s:"")+r+(dFt(t.index,o)?",":"")+s;return[{offset:l.startOffset,length:0,content:c}]}}function vXe(a,i){return i.filter(e=>e.setting?.key===a)[0]}function SSi(a,i){for(let e=a-1;e>=0;e--)if(i[e].setting)return i[e]}function dFt(a,i){for(let e=a+1;e<i.length;e++)if(i[e].setting)return i[e]}function ADe(a,i,e){let t=a.indexOf(i),o=a.indexOf(e);return a.filter((n,r)=>t<r&&r<o)}function cFt(a,i){if(a.length&&i.length){let e=0;for(;e<i.length&&e<a.length;e++)if(a[e].value!==i[e].value)return i[e-1];return i[e-1]}}function ISi(a){let i=[],e=-1,t,o;return Wx(a,{onObjectBegin:r=>{e++},onObjectProperty:(r,s,l)=>{e===0&&(t=s,o=r)},onObjectEnd:(r,s)=>{e--,e===0&&i.push({startOffset:t,endOffset:r+s,value:a.substring(t,r+s),setting:{key:o,commaOffset:void 0}})},onArrayBegin:(r,s)=>{e++},onArrayEnd:(r,s)=>{e--,e===0&&i.push({startOffset:t,endOffset:r+s,value:a.substring(t,r+s),setting:{key:o,commaOffset:void 0}})},onLiteralValue:(r,s,l)=>{e===0&&i.push({startOffset:t,endOffset:s+l,value:a.substring(t,s+l),setting:{key:o,commaOffset:void 0}})},onSeparator:(r,s,l)=>{if(e===0&&r===","){let c=i.length-1;for(;c>=0&&!i[c].setting;c--);let u=i[c];u&&i.splice(c,1,{startOffset:u.startOffset,endOffset:u.endOffset,value:u.value,setting:{key:u.setting.key,commaOffset:s}})}},onComment:(r,s)=>{e===0&&i.push({startOffset:r,endOffset:r+s,value:a.substring(r,r+s)})}}),i}var pFt=class{constructor(i,e,t){this.userDataProfileService=i;this.fileService=e;this.logService=t}async initialize(i){let e=JSON.parse(i);if(e.settings===null){this.logService.info("Initializing Profile: No settings to apply...");return}await this.fileService.writeFile(this.userDataProfileService.currentProfile.settingsResource,Je.fromString(e.settings))}};pFt=I([m(0,mn),m(1,be),m(2,ne)],pFt);var xF=class{constructor(i,e,t){this.fileService=i;this.userDataSyncUtilService=e;this.logService=t}async getContent(i){let e=await this.getSettingsContent(i);return JSON.stringify(e)}async getSettingsContent(i){let e=await this.getLocalFileContent(i);if(e===null)return{settings:null};{let t=this.getIgnoredSettings(),o=await this.userDataSyncUtilService.resolveFormattingOptions(i.settingsResource);return{settings:ySi(e||"{}","{}",t,o)}}}async apply(i,e){let t=JSON.parse(i);if(t.settings===null){this.logService.info(`Importing Profile (${e.name}): No settings to apply...`);return}let o=await this.getLocalFileContent(e),n=await this.userDataSyncUtilService.resolveFormattingOptions(e.settingsResource),r=ySi(t.settings,o||"{}",this.getIgnoredSettings(),n);await this.fileService.writeFile(e.settingsResource,Je.fromString(r))}getIgnoredSettings(){let i=oe.as(ii.Configuration).getConfigurationProperties();return Object.keys(i).filter(t=>i[t]?.scope===2||i[t]?.scope===3||i[t]?.scope===7)}async getLocalFileContent(i){try{return(await this.fileService.readFile(i.settingsResource)).value.toString()}catch(e){if(e instanceof As&&e.fileOperationResult===1)return null;throw e}}};xF=I([m(0,be),m(1,BJ),m(2,ne)],xF);var l4=class{constructor(i,e,t){this.profile=i;this.uriIdentityService=e;this.instantiationService=t;this.type="settings";this.handle="settings";this.label={label:d(17476,null)};this.collapsibleState=2}async getChildren(){return[{handle:this.profile.settingsResource.toString(),resourceUri:this.profile.settingsResource,collapsibleState:0,parent:this,accessibilityInformation:{label:this.uriIdentityService.extUri.basename(this.profile.settingsResource)},command:{id:Zh,title:"",arguments:[this.profile.settingsResource,void 0,void 0]}}]}async hasContent(){return(await this.instantiationService.createInstance(xF).getSettingsContent(this.profile)).settings!==null}async getContent(){return this.instantiationService.createInstance(xF).getContent(this.profile)}isFromDefaultProfile(){return!this.profile.isDefault&&!!this.profile.useDefaultFlags?.settings}};l4=I([m(1,dt),m(2,F)],l4);var mFt=class{constructor(i,e,t){this.userDataProfileService=i;this.fileService=e;this.logService=t}async initialize(i){let e=JSON.parse(i);if(e.keybindings===null){this.logService.info("Initializing Profile: No keybindings to apply...");return}await this.fileService.writeFile(this.userDataProfileService.currentProfile.keybindingsResource,Je.fromString(e.keybindings))}};mFt=I([m(0,mn),m(1,be),m(2,ne)],mFt);var kF=class{constructor(i,e){this.fileService=i;this.logService=e}async getContent(i){let e=await this.getKeybindingsResourceContent(i);return JSON.stringify(e)}async getKeybindingsResourceContent(i){return{keybindings:await this.getKeybindingsContent(i),platform:Pp}}async apply(i,e){let t=JSON.parse(i);if(t.keybindings===null){this.logService.info(`Importing Profile (${e.name}): No keybindings to apply...`);return}await this.fileService.writeFile(e.keybindingsResource,Je.fromString(t.keybindings))}async getKeybindingsContent(i){try{return(await this.fileService.readFile(i.keybindingsResource)).value.toString()}catch(e){if(e instanceof As&&e.fileOperationResult===1)return null;throw e}}};kF=I([m(0,be),m(1,ne)],kF);var c4=class{constructor(i,e,t){this.profile=i;this.uriIdentityService=e;this.instantiationService=t;this.type="keybindings";this.handle="keybindings";this.label={label:d(17474,null)};this.collapsibleState=2}isFromDefaultProfile(){return!this.profile.isDefault&&!!this.profile.useDefaultFlags?.keybindings}async getChildren(){return[{handle:this.profile.keybindingsResource.toString(),resourceUri:this.profile.keybindingsResource,collapsibleState:0,parent:this,accessibilityInformation:{label:this.uriIdentityService.extUri.basename(this.profile.settingsResource)},command:{id:Zh,title:"",arguments:[this.profile.keybindingsResource,void 0,void 0]}}]}async hasContent(){return(await this.instantiationService.createInstance(kF).getKeybindingsResourceContent(this.profile)).keybindings!==null}async getContent(){return this.instantiationService.createInstance(kF).getContent(this.profile)}};c4=I([m(1,dt),m(2,F)],c4);var hFt=class{constructor(i,e,t){this.userDataProfileService=i;this.fileService=e;this.uriIdentityService=t}async initialize(i){let e=JSON.parse(i);for(let t in e.snippets){let o=this.uriIdentityService.extUri.joinPath(this.userDataProfileService.currentProfile.snippetsHome,t);await this.fileService.writeFile(o,Je.fromString(e.snippets[t]))}}};hFt=I([m(0,mn),m(1,be),m(2,dt)],hFt);var XP=class{constructor(i,e){this.fileService=i;this.uriIdentityService=e}async getContent(i,e){let t=await this.getSnippets(i,e);return JSON.stringify({snippets:t})}async apply(i,e){let t=JSON.parse(i);for(let o in t.snippets){let n=this.uriIdentityService.extUri.joinPath(e.snippetsHome,o);await this.fileService.writeFile(n,Je.fromString(t.snippets[o]))}}async getSnippets(i,e){let t={},o=await this.getSnippetsResources(i,e);for(let n of o){let r=this.uriIdentityService.extUri.relativePath(i.snippetsHome,n),s=await this.fileService.readFile(n);t[r]=s.value.toString()}return t}async getSnippetsResources(i,e){let t=[],o;try{o=await this.fileService.resolve(i.snippetsHome)}catch(n){if(n instanceof As&&n.fileOperationResult===1)return t;throw n}for(let{resource:n}of o.children||[]){if(e?.has(n))continue;let r=this.uriIdentityService.extUri.extname(n);(r===".json"||r===".code-snippets")&&t.push(n)}return t}};XP=I([m(0,be),m(1,dt)],XP);var d4=class{constructor(i,e,t){this.profile=i;this.instantiationService=e;this.uriIdentityService=t;this.type="snippets";this.label={label:d(17478,null)};this.collapsibleState=1;this.excludedSnippets=new Mn;this.handle=this.profile.snippetsHome.toString()}async getChildren(){let i=await this.instantiationService.createInstance(XP).getSnippetsResources(this.profile),e=this;return i.map(t=>({handle:t.toString(),parent:e,resourceUri:t,collapsibleState:0,accessibilityInformation:{label:this.uriIdentityService.extUri.basename(t)},checkbox:e.checkbox?{get isChecked(){return!e.excludedSnippets.has(t)},set isChecked(o){o?e.excludedSnippets.delete(t):e.excludedSnippets.add(t)},accessibilityInformation:{label:d(17477,null,this.uriIdentityService.extUri.basename(t))}}:void 0,command:{id:Zh,title:"",arguments:[t,void 0,void 0]}}))}async hasContent(){return(await this.instantiationService.createInstance(XP).getSnippetsResources(this.profile)).length>0}async getContent(){return this.instantiationService.createInstance(XP).getContent(this.profile,this.excludedSnippets)}isFromDefaultProfile(){return!this.profile.isDefault&&!!this.profile.useDefaultFlags?.snippets}};d4=I([m(1,F),m(2,dt)],d4);var gFt=class{constructor(i,e,t){this.userDataProfileService=i;this.fileService=e;this.logService=t}async initialize(i){let e=JSON.parse(i);if(!e.tasks){this.logService.info("Initializing Profile: No tasks to apply...");return}await this.fileService.writeFile(this.userDataProfileService.currentProfile.tasksResource,Je.fromString(e.tasks))}};gFt=I([m(0,mn),m(1,be),m(2,ne)],gFt);var EF=class{constructor(i,e){this.fileService=i;this.logService=e}async getContent(i){let e=await this.getTasksResourceContent(i);return JSON.stringify(e)}async getTasksResourceContent(i){return{tasks:await this.getTasksContent(i)}}async apply(i,e){let t=JSON.parse(i);if(!t.tasks){this.logService.info(`Importing Profile (${e.name}): No tasks to apply...`);return}await this.fileService.writeFile(e.tasksResource,Je.fromString(t.tasks))}async getTasksContent(i){try{return(await this.fileService.readFile(i.tasksResource)).value.toString()}catch(e){if(e instanceof As&&e.fileOperationResult===1)return null;throw e}}};EF=I([m(0,be),m(1,ne)],EF);var u4=class{constructor(i,e,t){this.profile=i;this.uriIdentityService=e;this.instantiationService=t;this.type="tasks";this.handle="tasks";this.label={label:d(17479,null)};this.collapsibleState=2}async getChildren(){return[{handle:this.profile.tasksResource.toString(),resourceUri:this.profile.tasksResource,collapsibleState:0,parent:this,accessibilityInformation:{label:this.uriIdentityService.extUri.basename(this.profile.settingsResource)},command:{id:Zh,title:"",arguments:[this.profile.tasksResource,void 0,void 0]}}]}async hasContent(){return(await this.instantiationService.createInstance(EF).getTasksResourceContent(this.profile)).tasks!==null}async getContent(){return this.instantiationService.createInstance(EF).getContent(this.profile)}isFromDefaultProfile(){return!this.profile.isDefault&&!!this.profile.useDefaultFlags?.tasks}};u4=I([m(1,dt),m(2,F)],u4);var fFt=class extends C{constructor(e,t,o){super();this.channel=e;this.profile=t;this.workspace=o}async getItems(){let e={profile:this.profile,workspace:this.workspace},t=await this.channel.call("getItems",e);return new Map(t)}updateItems(e){let t={profile:this.profile,workspace:this.workspace};return e.insert&&(t.insert=Array.from(e.insert.entries())),e.delete&&(t.delete=Array.from(e.delete.values())),this.channel.call("updateItems",t)}optimize(){let e={profile:this.profile,workspace:this.workspace};return this.channel.call("optimize",e)}},vFt=class extends fFt{constructor(e,t){super(e,t,void 0);this._onDidChangeItemsExternal=this._register(new E);this.onDidChangeItemsExternal=this._onDidChangeItemsExternal.event;this.registerListeners()}registerListeners(){this._register(this.channel.listen("onDidChangeStorage",{profile:this.profile})(e=>this.onDidChangeStorage(e)))}onDidChangeStorage(e){(Array.isArray(e.changed)||Array.isArray(e.deleted))&&this._onDidChangeItemsExternal.fire({changed:e.changed?new Map(e.changed):void 0,deleted:e.deleted?new Set(e.deleted):void 0})}},NDe=class extends vFt{constructor(i){super(i,void 0)}async close(){this.dispose()}},ODe=class extends vFt{async close(){this.dispose()}},bFt=class extends fFt{constructor(e,t){super(e,void 0,t);this.onDidChangeItemsExternal=H.None}async close(){this.dispose()}};var TF=ae("IUserDataProfileStorageService"),bXe=class extends C{constructor(e,t){super();this.storageService=t;e&&(this.storageServicesMap=this._register(new jt))}async readStorageData(e){return this.withProfileScopedStorageService(e,async t=>this.getItems(t))}async updateStorageData(e,t,o){return this.withProfileScopedStorageService(e,async n=>this.writeItems(n,t,o))}async withProfileScopedStorageService(e,t){if(this.storageService.hasScope(e))return t(this.storageService);let o=this.storageServicesMap?.get(e.id);if(!o){o=new wSi(this.createStorageDatabase(e)),this.storageServicesMap?.set(e.id,o);try{await o.initialize()}catch(n){throw this.storageServicesMap?.has(e.id)?this.storageServicesMap.deleteAndDispose(e.id):o.dispose(),n}}try{let n=await t(o);return await o.flush(),n}finally{this.storageServicesMap?.has(e.id)||o.dispose()}}getItems(e){let t=new Map,o=n=>{for(let r of e.keys(0,n))t.set(r,{value:e.get(r,0),target:n})};return o(0),o(1),t}writeItems(e,t,o){e.storeAll(Array.from(t.entries()).map(([n,r])=>({key:n,value:r,scope:0,target:o})),!0)}};bXe=I([m(1,le)],bXe);var SFt=class extends bXe{constructor(e,t,o,n,r){super(e,n);this.remoteService=t;let s=t.getChannel("profileStorageListener"),l=this._register(new me);this._onDidChange=this._register(new E({onWillAddFirstListener:()=>{l.value=s.listen("onDidChange")(c=>{r.trace("profile storage changes",c),this._onDidChange.fire({targetChanges:c.targetChanges.map(u=>Qy(u,o.profilesHome.scheme)),valueChanges:c.valueChanges.map(u=>({...u,profile:Qy(u.profile,o.profilesHome.scheme)}))})})},onDidRemoveLastListener:()=>l.value=void 0})),this.onDidChange=this._onDidChange.event}async createStorageDatabase(e){let t=this.remoteService.getChannel("storage");return iwe(e)?new NDe(t):new ODe(t,e)}},wSi=class extends Rae{constructor(e){super({flushInterval:100});this.profileStorageDatabase=e}async doInitialize(){let e=await this.profileStorageDatabase,t=new XN(e);return this._register(t.onDidChangeStorage(o=>{this.emitDidChangeValue(0,o)})),this._register(Z(()=>{t.close(),t.dispose(),Ac(e)&&e.dispose()})),this.profileStorage=t,this.profileStorage.init()}getStorage(e){return e===0?this.profileStorage:void 0}getLogDetails(){}async switchToProfile(){}async switchToWorkspace(){}hasScope(){return!1}};var IFt=class{constructor(i,e,t,o,n){this.userDataProfileService=i;this.extensionManagementService=e;this.extensionGalleryService=t;this.extensionEnablementService=o;this.logService=n}async initialize(i){let e=JSON.parse(i),t=await this.extensionManagementService.getInstalled(void 0,this.userDataProfileService.currentProfile.extensionsResource),o=[],n=[];for(let s of e){let l=this.extensionEnablementService.getDisabledExtensions().some(u=>Ot(u,s.identifier)),c=t.find(u=>Ot(u.identifier,s.identifier));(!c||!c.isBuiltin&&c.preRelease!==s.preRelease)&&n.push(s),l!==!!s.disabled&&o.push({extension:s.identifier,enable:!s.disabled})}let r=t.filter(s=>!s.isBuiltin&&!e.some(({identifier:l})=>Ot(l,s.identifier)));for(let{extension:s,enable:l}of o)l?(this.logService.trace("Initializing Profile: Enabling extension...",s.id),await this.extensionEnablementService.enableExtension(s),this.logService.info("Initializing Profile: Enabled extension...",s.id)):(this.logService.trace("Initializing Profile: Disabling extension...",s.id),await this.extensionEnablementService.disableExtension(s),this.logService.info("Initializing Profile: Disabled extension...",s.id));if(n.length){let s=await this.extensionGalleryService.getExtensions(n.map(l=>({...l.identifier,version:l.version,hasPreRelease:l.version?void 0:l.preRelease})),ve.None);await Promise.all(n.map(async l=>{let c=s.find(u=>Ot(u.identifier,l.identifier));c&&(await this.extensionManagementService.canInstall(c)===!0?(this.logService.trace("Initializing Profile: Installing extension...",c.identifier.id,c.version),await this.extensionManagementService.installFromGallery(c,{isMachineScoped:!1,donotIncludePackAndDependencies:!0,installGivenVersion:!!l.version,installPreReleaseVersion:l.preRelease,profileLocation:this.userDataProfileService.currentProfile.extensionsResource,context:{[hj]:!0,[UL]:!0}}),this.logService.info("Initializing Profile: Installed extension...",c.identifier.id,c.version)):this.logService.info("Initializing Profile: Skipped installing extension because it cannot be installed.",c.identifier.id))}))}r.length&&await Promise.all(r.map(s=>this.extensionManagementService.uninstall(s)))}};IFt=I([m(0,mn),m(1,ls),m(2,ta),m(3,nz),m(4,ne)],IFt);var JP=class{constructor(i,e,t,o,n){this.extensionManagementService=i;this.extensionGalleryService=e;this.userDataProfileStorageService=t;this.instantiationService=o;this.logService=n}async getContent(i,e){let t=await this.getLocalExtensions(i);return this.toContent(t,e)}toContent(i,e){return JSON.stringify(e?.length?i.filter(t=>!e.includes(t.identifier.id.toLowerCase())):i)}async apply(i,e,t,o){return this.withProfileScopedServices(e,async n=>{let r=await this.getProfileExtensions(i),s=await this.extensionManagementService.getInstalled(void 0,e.extensionsResource),l=[],c=[];for(let p of r){let h=n.getDisabledExtensions().some(f=>Ot(f,p.identifier)),g=s.find(f=>Ot(f.identifier,p.identifier));(!g||!g.isBuiltin&&g.preRelease!==p.preRelease)&&c.push(p),h!==!!p.disabled&&l.push({extension:p.identifier,enable:!p.disabled})}let u=s.filter(p=>!p.isBuiltin&&!r.some(({identifier:h})=>Ot(h,p.identifier))&&!p.isApplicationScoped);for(let{extension:p,enable:h}of l)h?(this.logService.trace(`Importing Profile (${e.name}): Enabling extension...`,p.id),await n.enableExtension(p),this.logService.info(`Importing Profile (${e.name}): Enabled extension...`,p.id)):(this.logService.trace(`Importing Profile (${e.name}): Disabling extension...`,p.id),await n.disableExtension(p),this.logService.info(`Importing Profile (${e.name}): Disabled extension...`,p.id));if(c.length){this.logService.info(`Importing Profile (${e.name}): Started installing extensions.`);let p=await this.extensionGalleryService.getExtensions(c.map(g=>({...g.identifier,version:g.version,hasPreRelease:g.version?void 0:g.preRelease})),ve.None),h=[];if(await Promise.all(c.map(async g=>{let f=p.find(v=>Ot(v.identifier,g.identifier));f&&(await this.extensionManagementService.canInstall(f)===!0?h.push({extension:f,options:{isMachineScoped:!1,donotIncludePackAndDependencies:!0,installGivenVersion:!!g.version,installPreReleaseVersion:g.preRelease,profileLocation:e.extensionsResource,context:{[hj]:!0}}}):this.logService.info(`Importing Profile (${e.name}): Skipped installing extension because it cannot be installed.`,f.identifier.id))})),h.length)if(o){await this.extensionManagementService.requestPublisherTrust(h);for(let g of h){if(o.isCancellationRequested)return;t?.(d(17472,null,g.extension.displayName??g.extension.identifier.id)),await this.extensionManagementService.installFromGallery(g.extension,g.options)}}else await this.extensionManagementService.installGalleryExtensions(h);this.logService.info(`Importing Profile (${e.name}): Finished installing extensions.`)}u.length&&await Promise.all(u.map(p=>this.extensionManagementService.uninstall(p)))})}async copy(i,e,t){await this.extensionManagementService.copyExtensions(i.extensionsResource,e.extensionsResource);let o=await this.withProfileScopedServices(i,async n=>n.getDisabledExtensions());if(t){let n=await this.extensionManagementService.getInstalled(1,e.extensionsResource);for(let r of n)o.push(r.identifier)}await this.withProfileScopedServices(e,async n=>Promise.all(o.map(r=>n.disableExtension(r))))}async getLocalExtensions(i){return this.withProfileScopedServices(i,async e=>{let t=new Map,o=await this.extensionManagementService.getInstalled(void 0,i.extensionsResource),n=e.getDisabledExtensions();for(let r of o){let{identifier:s,preRelease:l}=r,c=n.some(h=>Ot(h,s));if(r.isBuiltin&&!c||!r.isBuiltin&&!r.identifier.uuid)continue;t.get(s.id.toLowerCase())?.disabled&&t.delete(s.id.toLowerCase());let p={identifier:s,displayName:r.manifest.displayName};c&&(p.disabled=!0),!r.isBuiltin&&r.pinned&&(p.version=r.manifest.version),!p.version&&l&&(p.preRelease=!0),p.applicationScoped=r.isApplicationScoped,t.set(p.identifier.id.toLowerCase(),p)}return[...t.values()]})}async getProfileExtensions(i){return JSON.parse(i)}async withProfileScopedServices(i,e){return this.userDataProfileStorageService.withProfileScopedStorageService(i,async t=>{let o=new P,n=o.add(this.instantiationService.createChild(new Io([le,t]))),r=o.add(n.createInstance(CK));try{return await e(r)}finally{o.dispose()}})}};JP=I([m(0,Hd),m(1,ta),m(2,TF),m(3,F),m(4,ne)],JP);var WDe=class{constructor(){this.type="extensions";this.handle="extensions";this.label={label:d(17471,null)};this.collapsibleState=2;this.contextValue="extensions";this.excludedExtensions=new Set}async getChildren(){let i=(await this.getExtensions()).sort((t,o)=>(t.displayName??t.identifier.id).localeCompare(o.displayName??o.identifier.id)),e=this;return i.map(t=>({...t,handle:t.identifier.id.toLowerCase(),parent:this,label:{label:t.displayName||t.identifier.id},description:t.applicationScoped?d(17469,null):void 0,collapsibleState:0,checkbox:e.checkbox?{get isChecked(){return!e.excludedExtensions.has(t.identifier.id.toLowerCase())},set isChecked(o){o?e.excludedExtensions.delete(t.identifier.id.toLowerCase()):e.excludedExtensions.add(t.identifier.id.toLowerCase())},tooltip:d(17470,null,t.displayName||t.identifier.id),accessibilityInformation:{label:d(17470,null,t.displayName||t.identifier.id)}}:void 0,themeIcon:M.extensions,command:{id:"extension.open",title:"",arguments:[t.identifier.id,void 0,!0]}}))}async hasContent(){return(await this.getExtensions()).length>0}},p4=class extends WDe{constructor(e,t){super();this.profile=e;this.instantiationService=t}isFromDefaultProfile(){return!this.profile.isDefault&&!!this.profile.useDefaultFlags?.extensions}getExtensions(){return this.instantiationService.createInstance(JP).getLocalExtensions(this.profile)}async getContent(){return this.instantiationService.createInstance(JP).getContent(this.profile,[...this.excludedExtensions.values()])}};p4=I([m(1,F)],p4);var FDe=class extends WDe{constructor(e,t){super();this.content=e;this.instantiationService=t}isFromDefaultProfile(){return!1}getExtensions(){return this.instantiationService.createInstance(JP).getProfileExtensions(this.content)}async getContent(){let e=this.instantiationService.createInstance(JP),t=await e.getProfileExtensions(this.content);return e.toContent(t,[...this.excludedExtensions.values()])}};FDe=I([m(1,F)],FDe);var yFt=class{constructor(i){this.storageService=i}async initialize(i){let e=JSON.parse(i),t=Object.keys(e.storage);if(t.length){let o=[];for(let n of t)o.push({key:n,value:e.storage[n],scope:0,target:0});this.storageService.storeAll(o,!0)}}};yFt=I([m(0,le)],yFt);var m4=class{constructor(i,e,t){this.storageService=i;this.userDataProfileStorageService=e;this.logService=t}async getContent(i){let e=await this.getGlobalState(i);return JSON.stringify(e)}async apply(i,e){let t=JSON.parse(i);await this.writeGlobalState(t,e)}async getGlobalState(i){let e={},t=await this.userDataProfileStorageService.readStorageData(i);for(let[o,n]of t)n.value!==void 0&&n.target===0&&(e[o]=n.value);return{storage:e}}async writeGlobalState(i,e){let t=Object.keys(i.storage);if(t.length){let o=new Map,n=[...this.storageService.keys(-1,1),...this.storageService.keys(1,0),...this.storageService.keys(1,1)];for(let r of t)n.includes(r)?this.logService.info(`Importing Profile (${e.name}): Ignoring global state key '${r}' because it is not a profile key.`):o.set(r,i.storage[r]);await this.userDataProfileStorageService.updateStorageData(e,o,0)}}};m4=I([m(0,le),m(1,TF),m(2,ne)],m4);var BDe=class{constructor(i,e){this.resource=i;this.uriIdentityService=e;this.type="globalState";this.handle="globalState";this.label={label:d(17473,null)};this.collapsibleState=1}async getChildren(){return[{handle:this.resource.toString(),resourceUri:this.resource,collapsibleState:0,accessibilityInformation:{label:this.uriIdentityService.extUri.basename(this.resource)},parent:this,command:{id:Zh,title:"",arguments:[this.resource,void 0,void 0]}}]}},VDe=class extends BDe{constructor(e,t,o,n){super(t,o);this.profile=e;this.instantiationService=n}async hasContent(){let e=await this.instantiationService.createInstance(m4).getGlobalState(this.profile);return Object.keys(e.storage).length>0}async getContent(){return this.instantiationService.createInstance(m4).getContent(this.profile)}isFromDefaultProfile(){return!this.profile.isDefault&&!!this.profile.useDefaultFlags?.globalState}};VDe=I([m(2,dt),m(3,F)],VDe);var wFt=class extends BDe{constructor(e,t,o){super(t,o);this.content=e}async getContent(){return this.content}isFromDefaultProfile(){return!1}};wFt=I([m(2,dt)],wFt);var SXe=class{constructor(i){this.type=1,this.ctime=Date.now(),this.mtime=Date.now(),this.size=0,this.name=i}},UJ=class{constructor(i){this.type=2,this.ctime=Date.now(),this.mtime=Date.now(),this.size=0,this.name=i,this.entries=new Map}},Xue=class extends C{constructor(){super(...arguments);this.memoryFdCounter=0;this.fdMemory=new Map;this._onDidChangeCapabilities=this._register(new E);this.onDidChangeCapabilities=this._onDidChangeCapabilities.event;this._capabilities=525318;this.root=new UJ("");this._onDidChangeFile=this._register(new E);this.onDidChangeFile=this._onDidChangeFile.event;this._bufferedChanges=[]}get capabilities(){return this._capabilities}setReadOnly(e){let t=!!(this._capabilities&2048);e!==t&&(this._capabilities=525314|(e?2048:0),this._onDidChangeCapabilities.fire())}async stat(e){return this._lookup(e,!1)}async readdir(e){let t=this._lookupAsDirectory(e,!1),o=[];return t.entries.forEach((n,r)=>o.push([r,n.type])),o}async readFile(e){let t=this._lookupAsFile(e,!1).data;if(t)return t;throw Jr("file not found","EntryNotFound")}readFileStream(e){let t=this._lookupAsFile(e,!1).data,o=_I(n=>Je.concat(n.map(r=>Je.wrap(r))).buffer);return o.end(t),o}async writeFile(e,t,o){let n=Ye(e),r=this._lookupParentDirectory(e),s=r.entries.get(n);if(s instanceof UJ)throw Jr("file is directory","EntryIsADirectory");if(!s&&!o.create)throw Jr("file not found","EntryNotFound");if(s&&o.create&&!o.overwrite)throw Jr("file exists already","EntryExists");if(s||(s=new SXe(n),r.entries.set(n,s),this._fireSoon({type:1,resource:e})),s.mtime=Date.now(),o.append){s.size+=t.byteLength;let l=s.data??new Uint8Array(0),c=new Uint8Array(l.byteLength+t.byteLength);c.set(l,0),c.set(t,l.byteLength),s.data=c}else s.size=t.byteLength,s.data=t;this._fireSoon({type:0,resource:e})}open(e,t){let o=this._lookup(e,!0),n=D$i(t),r=n&&!!t.append;if(o){if(o instanceof UJ)throw Jr("file is directory","EntryIsADirectory")}else{if(!n)throw Jr("file not found","EntryNotFound");let l=Ye(e),c=this._lookupParentDirectory(e);o=new SXe(l),o.data=new Uint8Array(0),c.entries.set(l,o),this._fireSoon({type:1,resource:e})}o.data||(o.data=new Uint8Array(0));let s=this.memoryFdCounter++;return this.fdMemory.set(s,{file:o,resource:e,write:n,append:r}),Promise.resolve(s)}close(e){let t=this.fdMemory.get(e);return t?.write&&(t.file.mtime=Date.now(),t.file.size=t.file.data?.byteLength??0,this._fireSoon({type:0,resource:t.resource})),this.fdMemory.delete(e),Promise.resolve()}read(e,t,o,n,r){let s=this.fdMemory.get(e);if(!s)throw Jr("No file with that descriptor open","Unavailable");if(!s.file.data)return Promise.resolve(0);let l=Je.wrap(s.file.data).slice(t,t+r);return o.set(l.buffer,n),Promise.resolve(l.byteLength)}write(e,t,o,n,r){let s=this.fdMemory.get(e);if(!s)throw Jr("No file with that descriptor open","Unavailable");let l=Je.wrap(o).slice(n,n+r);s.file.data??=new Uint8Array(0);let c=s.append?s.file.data.byteLength:t,u=c+l.byteLength;if(u>s.file.data.byteLength){let p=new Uint8Array(u);p.set(s.file.data,0),s.file.data=p}return s.file.data.set(l.buffer,c),Promise.resolve(l.byteLength)}async rename(e,t,o){if(!o.overwrite&&this._lookup(t,!0))throw Jr("file exists already","EntryExists");let n=this._lookup(e,!1),r=this._lookupParentDirectory(e),s=this._lookupParentDirectory(t),l=Ye(t);r.entries.delete(n.name),n.name=l,s.entries.set(l,n),this._fireSoon({type:2,resource:e},{type:1,resource:t})}async delete(e,t){let o=ci(e),n=Ye(e),r=this._lookupAsDirectory(o,!1);r.entries.delete(n)&&(r.mtime=Date.now(),r.size-=1,this._fireSoon({type:0,resource:o},{resource:e,type:2}))}async mkdir(e){if(this._lookup(e,!0))throw Jr("file exists already","EntryExists");let t=Ye(e),o=ci(e),n=this._lookupAsDirectory(o,!1),r=new UJ(t);n.entries.set(r.name,r),n.mtime=Date.now(),n.size+=1,this._fireSoon({type:0,resource:o},{type:1,resource:e})}_lookup(e,t){let o=e.path.split("/"),n=this.root;for(let r of o){if(!r)continue;let s;if(n instanceof UJ&&(s=n.entries.get(r)),!s){if(t)return;throw Jr("file not found","EntryNotFound")}n=s}return n}_lookupAsDirectory(e,t){let o=this._lookup(e,t);if(o instanceof UJ)return o;throw Jr("file not a directory","EntryNotADirectory")}_lookupAsFile(e,t){let o=this._lookup(e,t);if(o instanceof SXe)return o;throw Jr("file is a directory","EntryIsADirectory")}_lookupParentDirectory(e){let t=ci(e);return this._lookupAsDirectory(t,!1)}watch(e,t){return C.None}_fireSoon(...e){this._bufferedChanges.push(...e),this._fireSoonHandle&&clearTimeout(this._fireSoonHandle),this._fireSoonHandle=setTimeout(()=>{this._onDidChangeFile.fire(this._bufferedChanges),this._bufferedChanges.length=0},5)}dispose(){super.dispose(),this.fdMemory.clear()}};function Q5o(a){let i=a;return!!(i&&typeof i=="object"&&i.name&&typeof i.name=="string"&&(cn(i.icon)||typeof i.icon=="string")&&(cn(i.settings)||typeof i.settings=="string")&&(cn(i.globalState)||typeof i.globalState=="string")&&(cn(i.extensions)||typeof i.extensions=="string"))}var IXe=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.instantiationService=e;this.userDataProfileService=t;this.userDataProfileManagementService=o;this.userDataProfilesService=n;this.extensionService=r;this.quickInputService=s;this.progressService=l;this.dialogService=c;this.clipboardService=u;this.openerService=p;this.requestService=h;this.productService=g;this.uriIdentityService=f;this.profileContentHandlers=new Map;this.registerProfileContentHandler(Y.file,this.fileUserDataProfileContentHandler=e.createInstance(yXe))}registerProfileContentHandler(e,t){if(this.profileContentHandlers.has(e))throw new Error(`Profile content handler with id '${e}' already registered.`);return this.profileContentHandlers.set(e,t),Z(()=>this.unregisterProfileContentHandler(e))}unregisterProfileContentHandler(e){this.profileContentHandlers.delete(e)}async createFromProfile(e,t,o){let n=new P,r;n.add(o.onCancellationRequested(()=>r.cancel()));let s;return this.progressService.withProgress({location:15,delay:500,sticky:!0,cancellable:!0},async l=>{let c=u=>l.report({message:d(17483,null,u)});r=xn(async u=>{let h=await n.add(this.instantiationService.createInstance(Zue,e,{...t?.resourceTypeFlags,extensions:!1})).getProfileTemplate(t.name??e.name,t?.icon);s=await this.getProfileToImport({...h,name:t.name??h.name},!!t.transient,t),s&&(u.isCancellationRequested||await this.applyProfileTemplate(h,s,t,c,u))});try{await r,s&&(t?.resourceTypeFlags?.extensions??!0)&&(c(d(17494,null)),await this.instantiationService.createInstance(JP).copy(e,s,!1))}catch{s&&(await this.userDataProfilesService.removeProfile(s),s=void 0)}return s},()=>r.cancel()).finally(()=>n.dispose())}async createProfileFromTemplate(e,t,o){let n=new P,r;n.add(o.onCancellationRequested(()=>r.cancel()));let s;return this.progressService.withProgress({location:15,delay:500,sticky:!0,cancellable:!0},async l=>{let c=u=>l.report({message:d(17483,null,u)});r=xn(async u=>{s=await this.getProfileToImport({...e,name:t.name??e.name},!!t.transient,t),s&&(u.isCancellationRequested||await this.applyProfileTemplate(e,s,t,c,u))});try{await r}catch{s&&(await this.userDataProfilesService.removeProfile(s),s=void 0)}return s},()=>r.cancel()).finally(()=>n.dispose())}async applyProfileTemplate(e,t,o,n,r){e.settings&&(o.resourceTypeFlags?.settings??!0)&&!t.useDefaultFlags?.settings&&(n(d(17487,null)),await this.instantiationService.createInstance(xF).apply(e.settings,t)),!r.isCancellationRequested&&(e.keybindings&&(o.resourceTypeFlags?.keybindings??!0)&&!t.useDefaultFlags?.keybindings&&(n(d(17484,null)),await this.instantiationService.createInstance(kF).apply(e.keybindings,t)),!r.isCancellationRequested&&(e.tasks&&(o.resourceTypeFlags?.tasks??!0)&&!t.useDefaultFlags?.tasks&&(n(d(17486,null)),await this.instantiationService.createInstance(EF).apply(e.tasks,t)),!r.isCancellationRequested&&(e.snippets&&(o.resourceTypeFlags?.snippets??!0)&&!t.useDefaultFlags?.snippets&&(n(d(17485,null)),await this.instantiationService.createInstance(XP).apply(e.snippets,t)),!r.isCancellationRequested&&(e.globalState&&!t.useDefaultFlags?.globalState&&(n(d(17480,null)),await this.instantiationService.createInstance(m4).apply(e.globalState,t)),!r.isCancellationRequested&&e.extensions&&(o.resourceTypeFlags?.extensions??!0)&&!t.useDefaultFlags?.extensions&&(n(d(17494,null)),await this.instantiationService.createInstance(JP).apply(e.extensions,t,n,r))))))}async exportProfile(e,t){let o=new P;try{let n=o.add(this.instantiationService.createInstance(Zue,e,t));await this.doExportProfile(n,15)}finally{o.dispose()}}async createTroubleshootProfile(){let e=this.instantiationService.createInstance(Zue,this.userDataProfileService.currentProfile,void 0);try{let t=await e.getProfileTemplate(d(17513,null),void 0);await this.progressService.withProgress({location:15,delay:1e3,sticky:!0},async o=>{let n=s=>o.report({message:d(17514,null,s)}),r=await this.doCreateProfile(t,!0,!1,{useDefaultFlags:this.userDataProfileService.currentProfile.useDefaultFlags},n);r&&(n(d(17503,null)),await this.instantiationService.createInstance(JP).copy(this.userDataProfileService.currentProfile,r,!0),n(d(17512,null)),await this.userDataProfileManagementService.switchProfile(r))})}finally{e.dispose()}}async doExportProfile(e,t){let o=await e.getProfileToExport();if(!o)return;let n=new P;try{await this.progressService.withProgress({location:t,title:d(17502,null,oF.value)},async r=>{let s=await this.pickProfileContentHandler(o.name);if(!s)return;let l=this.profileContentHandlers.get(s);if(!l)return;let c=await l.saveProfile(o.name.replace("/","-"),JSON.stringify(o),ve.None);if(!c)return;let u=d(17491,null,o.name);if(l.extensionId){let p=[],h=this.productService.webUrl?`${this.productService.webUrl}/${v9e}/${s}/${c.id}`:uto(`/${s}/${c.id}`,this.productService).toString();p.push({label:d(17482,null),run:()=>this.clipboardService.writeText(h)}),this.productService.webUrl?p.push({label:d(17497,null),run:async()=>{await this.openerService.open(h)}}):p.push({label:d(17498,null,l.name),run:async()=>{await this.openerService.open(c.link.toString())}}),await this.dialogService.prompt({type:gt.Info,message:u,buttons:p,cancelButton:d(17481,null)})}else await this.dialogService.info(u)})}finally{n.dispose()}}async resolveProfileTemplate(e,t){let o=await this.resolveProfileContent(e);if(o===null)return null;let n;try{n=JSON.parse(o)}catch{throw new Error(d(17495,null))}return Q5o(n)?(t?.name&&(n.name=t.name),t?.icon&&(n.icon=t.icon),t?.resourceTypeFlags?.settings===!1&&(n.settings=void 0),t?.resourceTypeFlags?.keybindings===!1&&(n.keybindings=void 0),t?.resourceTypeFlags?.snippets===!1&&(n.snippets=void 0),t?.resourceTypeFlags?.tasks===!1&&(n.tasks=void 0),t?.resourceTypeFlags?.globalState===!1&&(n.globalState=void 0),t?.resourceTypeFlags?.extensions===!1&&(n.extensions=void 0),n):null}async doCreateProfile(e,t,o,n,r){let s=await this.getProfileToImport(e,t,n);if(s)return e.settings&&!s.useDefaultFlags?.settings&&(r(d(17506,null)),await this.instantiationService.createInstance(xF).apply(e.settings,s)),e.keybindings&&!s.useDefaultFlags?.keybindings&&(r(d(17505,null)),await this.instantiationService.createInstance(kF).apply(e.keybindings,s)),e.tasks&&!s.useDefaultFlags?.tasks&&(r(d(17508,null)),await this.instantiationService.createInstance(EF).apply(e.tasks,s)),e.snippets&&!s.useDefaultFlags?.snippets&&(r(d(17507,null)),await this.instantiationService.createInstance(XP).apply(e.snippets,s)),e.globalState&&!s.useDefaultFlags?.globalState&&(r(d(17504,null)),await this.instantiationService.createInstance(m4).apply(e.globalState,s)),e.extensions&&o&&!s.useDefaultFlags?.extensions&&(r(d(17503,null)),await this.instantiationService.createInstance(JP).apply(e.extensions,s)),s}async resolveProfileContent(e){if(await this.fileUserDataProfileContentHandler.canHandle(e))return this.fileUserDataProfileContentHandler.readProfile(e,ve.None);if(eTe(e)){let o,n;e.authority===v9e?(n=this.uriIdentityService.extUri.basename(e),o=this.uriIdentityService.extUri.basename(this.uriIdentityService.extUri.dirname(e))):(o=e.authority.substring(vhi.length),n=A.parse(e.path.substring(1))),await this.extensionService.activateByEvent(`onProfile:${o}`);let r=this.profileContentHandlers.get(o);if(r)return r.readProfile(n,ve.None)}await this.extensionService.activateByEvent("onProfile");for(let o of this.profileContentHandlers.values()){let n=await o.readProfile(e,ve.None);if(n!==null)return n}let t=await this.requestService.request({type:"GET",url:e.toString(!0)},ve.None);if(t.res.statusCode===200)return await E_(t);{let o=await E_(t);throw new Error(`Failed to get profile from URL: ${e.toString()}. Status code: ${t.res.statusCode}. Message: ${o}`)}}async pickProfileContentHandler(e){if(await this.extensionService.activateByEvent("onProfile"),this.profileContentHandlers.size===1)return this.profileContentHandlers.keys().next().value;let t=[];for(let[n,r]of this.profileContentHandlers)t.push({id:n,label:r.name,description:r.description});return(await this.quickInputService.pick(t.reverse(),{title:d(17511,null,e),hideInput:!0}))?.id}async getProfileToImport(e,t,o){let n=e.name,r=this.userDataProfilesService.profiles.find(s=>s.name===n);if(r){if(t)return this.userDataProfilesService.createNamedProfile(`${n} ${this.getProfileNameIndex(n)}`,{...o,transient:t});let{confirmed:s}=await this.dialogService.confirm({type:gt.Info,message:d(17500,null,n),primaryButton:d(17499,null)});return s?r.isDefault?r:this.userDataProfilesService.updateProfile(r,o):void 0}else return this.userDataProfilesService.createNamedProfile(n,{...o,transient:t})}getProfileNameIndex(e){let t=new RegExp(`${Yr(e)}\\s(\\d+)`),o=0;for(let n of this.userDataProfilesService.profiles){let r=t.exec(n.name),s=r?parseInt(r[1]):0;o=s>o?s:o}return o+1}};IXe=I([m(0,F),m(1,mn),m(2,UE),m(3,an),m(4,lt),m(5,Ge),m(6,Bo),m(7,ct),m(8,Wi),m(9,Qe),m(10,_a),m(11,nt),m(12,dt)],IXe);var yXe=class{constructor(i,e,t,o,n){this.fileDialogService=i;this.uriIdentityService=e;this.fileService=t;this.productService=o;this.textFileService=n;this.name=d(17496,null);this.description=d(17492,null)}async saveProfile(i,e,t){let o=await this.fileDialogService.showSaveDialog({title:d(17488,null),filters:S9e,defaultUri:this.uriIdentityService.extUri.joinPath(await this.fileDialogService.defaultFilePath(),`${i}.${b9e}`)});return o?(await this.textFileService.create([{resource:o,value:e,options:{overwrite:!0}}]),{link:o,id:o.toString()}):null}async canHandle(i){return i.scheme!==Y.http&&i.scheme!==Y.https&&i.scheme!==this.productService.urlProtocol&&await this.fileService.canHandleResource(i)}async readProfile(i,e){return await this.canHandle(i)?(await this.fileService.readFile(i,void 0,e)).value.toString():null}async selectProfile(){let i=await this.fileDialogService.showOpenDialog({canSelectFolders:!1,canSelectFiles:!0,canSelectMany:!1,filters:S9e,title:d(17510,null)});return i?i[0]:null}};yXe=I([m(0,dn),m(1,dt),m(2,be),m(3,nt),m(4,Ho)],yXe);var Jue="userdataprofileexport",Fro="userdataprofileexportpreview",wXe=class extends C{constructor(e){super();this.quickInputService=e;this._onDidChangeRoots=this._register(new E);this.onDidChangeRoots=this._onDidChangeRoots.event;this.roots=[]}async getChildren(e){if(e){let t=await e.getChildren();if(t)for(let o of t)o.parent.checkbox&&o.checkbox&&(o.checkbox.isChecked=o.parent.checkbox.isChecked&&o.checkbox.isChecked);return t}else return this.rootsPromise=void 0,this._onDidChangeRoots.fire(),this.getRoots()}getRoots(){return this.rootsPromise||(this.rootsPromise=(async()=>{this.roots=await this.fetchRoots();for(let e of this.roots){let t=Mr(e.label.label)?e.label.label.value:e.label.label;e.checkbox={isChecked:!e.isFromDefaultProfile(),tooltip:d(17509,null,t),accessibilityInformation:{label:d(17509,null,t)}},e.isFromDefaultProfile()&&(e.description=d(17493,null))}return this.roots})()),this.rootsPromise}isEnabled(e){return e!==void 0?this.roots.some(t=>t.type===e&&this.isSelected(t)):this.roots.some(t=>this.isSelected(t))}async getProfileTemplate(e,t){let o=await this.getRoots(),n,r,s,l,c,u;for(let p of o)this.isSelected(p)&&(p instanceof l4?n=await p.getContent():p instanceof c4?r=await p.getContent():p instanceof u4?s=await p.getContent():p instanceof d4?l=await p.getContent():p instanceof WDe?c=await p.getContent():p instanceof BDe&&(u=await p.getContent()));return{name:e,icon:t,settings:n,keybindings:r,tasks:s,snippets:l,extensions:c,globalState:u}}isSelected(e){return e.checkbox?e.checkbox.isChecked||!!e.children?.some(t=>t.checkbox?.isChecked):!0}};wXe=I([m(0,Ge)],wXe);var Zue=class extends wXe{constructor(e,t,o,n,r){super(o);this.profile=e;this.exportFlags=t;this.fileService=n;this.instantiationService=r;this.disposables=this._register(new P)}async fetchRoots(){this.disposables.clear(),this.disposables.add(this.fileService.registerProvider(Jue,this._register(new Xue)));let e=this._register(new Xue);this.disposables.add(this.fileService.registerProvider(Fro,e));let t=[],o=this.createExportPreviewProfile(this.profile);if(this.exportFlags?.settings??!0){let n=this.instantiationService.createInstance(xF),r=await n.getContent(this.profile);await n.apply(r,o);let s=this.instantiationService.createInstance(l4,o);await s.hasContent()&&t.push(s)}if(this.exportFlags?.keybindings??!0){let n=this.instantiationService.createInstance(kF),r=await n.getContent(this.profile);await n.apply(r,o);let s=this.instantiationService.createInstance(c4,o);await s.hasContent()&&t.push(s)}if(this.exportFlags?.snippets??!0){let n=this.instantiationService.createInstance(XP),r=await n.getContent(this.profile);await n.apply(r,o);let s=this.instantiationService.createInstance(d4,o);await s.hasContent()&&t.push(s)}if(this.exportFlags?.tasks??!0){let n=this.instantiationService.createInstance(EF),r=await n.getContent(this.profile);await n.apply(r,o);let s=this.instantiationService.createInstance(u4,o);await s.hasContent()&&t.push(s)}if(this.exportFlags?.globalState??!0){let n=je(o.globalStorageHome,"globalState.json").with({scheme:Fro}),r=this.instantiationService.createInstance(VDe,o,n),s=await r.getContent();s&&(await this.fileService.writeFile(n,Je.fromString(JSON.stringify(JSON.parse(s),null," "))),t.push(r))}if(this.exportFlags?.extensions??!0){let n=this.instantiationService.createInstance(p4,o);await n.hasContent()&&t.push(n)}return e.setReadOnly(!0),t}createExportPreviewProfile(e){return{id:e.id,name:e.name,location:e.location,isDefault:e.isDefault,icon:e.icon,globalStorageHome:e.globalStorageHome,settingsResource:e.settingsResource.with({scheme:Jue}),keybindingsResource:e.keybindingsResource.with({scheme:Jue}),tasksResource:e.tasksResource.with({scheme:Jue}),mcpResource:e.mcpResource.with({scheme:Jue}),snippetsHome:e.snippetsHome.with({scheme:Jue}),promptsHome:e.promptsHome.with({scheme:Jue}),extensionsResource:e.extensionsResource,cacheHome:e.cacheHome,useDefaultFlags:e.useDefaultFlags,isTransient:e.isTransient}}async getProfileToExport(){let e=this.profile.name;return this.profile.isDefault&&(e=await this.quickInputService.input({placeHolder:d(17489,null),title:d(17490,null),async validateInput(t){if(!t.trim())return d(17501,null)}}),!e)?null:super.getProfileTemplate(e,this.profile.icon)}};Zue=I([m(2,Ge),m(3,be),m(4,F)],Zue);we(PV,IXe,1);var CXe=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.userDataProfilesService=e;this.userDataProfileService=t;this.hostService=o;this.dialogService=n;this.workspaceContextService=r;this.extensionService=s;this.environmentService=l;this.productService=c;this.requestService=u;this.configurationService=p;this.uriIdentityService=h;this.logService=g;this._register(t.onDidChangeCurrentProfile(f=>this.onDidChangeCurrentProfile(f))),this._register(e.onDidChangeProfiles(f=>{if(f.removed.some(b=>b.id===this.userDataProfileService.currentProfile.id)){let b=this.getProfileToUseForCurrentWorkspace();this.switchProfile(b),this.changeCurrentProfile(b,d(17519,null));return}let v=f.updated.find(b=>this.userDataProfileService.currentProfile.id===b.id);if(v){let b=this.getProfileToUseForCurrentWorkspace();b?.id!==v.id?(this.switchProfile(b),this.changeCurrentProfile(b,d(17520,null))):this.changeCurrentProfile(v,d(17521,null))}}))}async onDidChangeCurrentProfile(e){e.previous.isTransient&&await this.userDataProfilesService.cleanUpTransientProfiles()}getWorkspaceUri(){let e=this.workspaceContextService.getWorkspace();return e.configuration??e.folders[0]?.uri}getProfileToUseForCurrentWorkspace(){let e=this.getWorkspaceUri();if(e){let t=this.userDataProfilesService.profiles.find(o=>o.workspaces?.some(n=>this.uriIdentityService.extUri.isEqual(n,e)));if(t)return t}else{let t=this.userDataProfilesService.profiles.find(o=>o.id===this.userDataProfileService.currentProfile.id);if(t)return t}return this.getDefaultProfileToUse()}getDefaultProfileToUse(){let e=this.configurationService.getValue(wP);if(e){let t=this.userDataProfilesService.profiles.find(o=>o.name===e);if(t)return t}return this.userDataProfilesService.defaultProfile}async createProfile(e,t){return this.userDataProfilesService.createNamedProfile(e,t)}async createAndEnterProfile(e,t){let o=await this.userDataProfilesService.createNamedProfile(e,t,VS(this.workspaceContextService.getWorkspace()));return await this.changeCurrentProfile(o),o}async createAndEnterTransientProfile(){let e=await this.userDataProfilesService.createTransientProfile(VS(this.workspaceContextService.getWorkspace()));return await this.changeCurrentProfile(e),e}async updateProfile(e,t){if(!this.userDataProfilesService.profiles.some(n=>n.id===e.id))throw new Error(`Profile ${e.name} does not exist`);if(e.isDefault)throw new Error(d(17516,null));return await this.userDataProfilesService.updateProfile(e,t)}async removeProfile(e){if(!this.userDataProfilesService.profiles.some(t=>t.id===e.id))throw new Error(`Profile ${e.name} does not exist`);if(e.isDefault)throw new Error(d(17515,null));await this.userDataProfilesService.removeProfile(e)}async switchProfile(e){if(!this.userDataProfilesService.profiles.some(n=>n.id===e.id))throw new Error(`Profile ${e.name} does not exist`);if(this.userDataProfileService.currentProfile.id===e.id)return;let t=this.getWorkspaceUri();if(t&&e.workspaces?.some(n=>this.uriIdentityService.extUri.isEqual(n,t)))return;let o=VS(this.workspaceContextService.getWorkspace());await this.userDataProfilesService.setProfileForWorkspace(o,e),Eq(o)&&await this.changeCurrentProfile(e)}async getBuiltinProfileTemplates(){if(this.productService.profileTemplatesUrl)try{let e=await this.requestService.request({type:"GET",url:this.productService.profileTemplatesUrl},ve.None);if(e.res.statusCode===200)return await hh(e)||[];this.logService.error("Could not get profile templates.",e.res.statusCode)}catch(e){this.logService.error(e)}return[]}async changeCurrentProfile(e,t){let o=!!this.environmentService.remoteAuthority,n=this.userDataProfileService.currentProfile.id!==e.id||!uo(this.userDataProfileService.currentProfile.useDefaultFlags,e.useDefaultFlags);if(n&&!o&&!await this.extensionService.stopExtensionHosts(d(17522,null)))throw this.userDataProfilesService.profiles.some(r=>r.id===this.userDataProfileService.currentProfile.id)&&await this.userDataProfilesService.setProfileForWorkspace(VS(this.workspaceContextService.getWorkspace()),this.userDataProfileService.currentProfile),new ho;if(await this.userDataProfileService.updateCurrentProfile(e),n)if(o){let{confirmed:r}=await this.dialogService.confirm({message:t??d(17518,null),primaryButton:d(17517,null)});r&&await this.hostService.reload()}else await this.extensionService.startExtensionHosts()}};CXe=I([m(0,an),m(1,mn),m(2,oi),m(3,ct),m(4,Pe),m(5,lt),m(6,Vt),m(7,nt),m(8,_a),m(9,B),m(10,dt),m(11,ne)],CXe);we(UE,CXe,0);function Wro(a){return a.toJSON()}var CFt=class{constructor(i){this._uriTransformer=i}transformIncoming(i){let e=this._uriTransformer.transformIncoming(i);return e===i?i:Wro(A.from(e))}transformOutgoing(i){let e=this._uriTransformer.transformOutgoing(i);return e===i?i:Wro(A.from(e))}transformOutgoingURI(i){let e=this._uriTransformer.transformOutgoing(i);return e===i?i:A.from(e)}transformOutgoingScheme(i){return this._uriTransformer.transformOutgoingScheme(i)}},xFt=new class{transformIncoming(a){return a}transformOutgoing(a){return a}transformOutgoingURI(a){return a}transformOutgoingScheme(a){return a}};function CSi(a,i,e,t){if(!a||t>200)return null;if(typeof a=="object"){if(a.$mid===1)return e?A.revive(i.transformIncoming(a)):i.transformIncoming(a);if(a instanceof Je)return null;for(let o in a)if(Object.hasOwnProperty.call(a,o)){let n=CSi(a[o],i,e,t+1);n!==null&&(a[o]=n)}}return null}function epe(a,i){let e=CSi(a,i,!1,0);return e===null?a:e}function kFt(a,i){let e=CSi(a,i,!0,0);return e===null?a:e}var HDe=class extends C{constructor(e,t,o){super();this.profilesHome=t;this.channel=o;this._profiles=[];this._onDidChangeProfiles=this._register(new E);this.onDidChangeProfiles=this._onDidChangeProfiles.event;this._profiles=e.map(n=>Qy(n,this.profilesHome.scheme)),this._register(this.channel.listen("onDidChangeProfiles")(n=>{let r=n.added.map(c=>Qy(c,this.profilesHome.scheme)),s=n.removed.map(c=>Qy(c,this.profilesHome.scheme)),l=n.updated.map(c=>Qy(c,this.profilesHome.scheme));this._profiles=n.all.map(c=>Qy(c,this.profilesHome.scheme)),this._onDidChangeProfiles.fire({added:r,removed:s,updated:l,all:this.profiles})})),this.onDidResetWorkspaces=this.channel.listen("onDidResetWorkspaces")}get defaultProfile(){return this.profiles[0]}get profiles(){return this._profiles}async createNamedProfile(e,t,o){let n=await this.channel.call("createNamedProfile",[e,t,o]);return Qy(n,this.profilesHome.scheme)}async createProfile(e,t,o,n){let r=await this.channel.call("createProfile",[e,t,o,n]);return Qy(r,this.profilesHome.scheme)}async createTransientProfile(e){let t=await this.channel.call("createTransientProfile",[e]);return Qy(t,this.profilesHome.scheme)}async setProfileForWorkspace(e,t){await this.channel.call("setProfileForWorkspace",[e,t])}removeProfile(e){return this.channel.call("removeProfile",[e])}async updateProfile(e,t){let o=await this.channel.call("updateProfile",[e,t]);return Qy(o,this.profilesHome.scheme)}resetWorkspaces(){return this.channel.call("resetWorkspaces")}cleanUp(){return this.channel.call("cleanUp")}cleanUpTransientProfiles(){return this.channel.call("cleanUpTransientProfiles")}};var xSi="associatedRemoteProfiles",ZP=ae("IRemoteUserDataProfilesService"),xXe=class extends C{constructor(e,t,o,n,r,s){super();this.environmentService=e;this.remoteAgentService=t;this.userDataProfilesService=o;this.userDataProfileService=n;this.storageService=r;this.logService=s;this.initPromise=this.init()}async init(){let e=this.remoteAgentService.getConnection();if(!e)return;let t=await this.remoteAgentService.getEnvironment();if(!t)return;this.remoteUserDataProfilesService=new HDe(t.profiles.all,t.profiles.home,e.getChannel("userDataProfiles")),this._register(this.userDataProfilesService.onDidChangeProfiles(n=>this.onDidChangeLocalProfiles(n)));let o=await this.getAssociatedRemoteProfile(this.userDataProfileService.currentProfile,this.remoteUserDataProfilesService);o.isDefault||this.setAssociatedRemoteProfiles([...this.getAssociatedRemoteProfiles(),o.id]),this.cleanUp()}async onDidChangeLocalProfiles(e){for(let t of e.removed){let o=this.remoteUserDataProfilesService?.profiles.find(n=>n.id===t.id);o&&await this.remoteUserDataProfilesService?.removeProfile(o)}}async getRemoteProfiles(){if(await this.initPromise,!this.remoteUserDataProfilesService)throw new Zs("Remote profiles service not available in the current window");return this.remoteUserDataProfilesService.profiles}async getRemoteProfile(e){if(await this.initPromise,!this.remoteUserDataProfilesService)throw new Zs("Remote profiles service not available in the current window");return this.getAssociatedRemoteProfile(e,this.remoteUserDataProfilesService)}async getAssociatedRemoteProfile(e,t){if(e.isDefault)return t.defaultProfile;let o=t.profiles.find(n=>n.id===e.id);return o||(o=await t.createProfile(e.id,e.name,{transient:e.isTransient,useDefaultFlags:e.useDefaultFlags}),this.setAssociatedRemoteProfiles([...this.getAssociatedRemoteProfiles(),this.userDataProfileService.currentProfile.id])),o}getAssociatedRemoteProfiles(){return this.environmentService.remoteAuthority?this.parseAssociatedRemoteProfiles()[this.environmentService.remoteAuthority]??[]:[]}setAssociatedRemoteProfiles(e){if(this.environmentService.remoteAuthority){let t=this.parseAssociatedRemoteProfiles();e=Uo(e),e.length?t[this.environmentService.remoteAuthority]=e:delete t[this.environmentService.remoteAuthority],Object.keys(t).length?this.storageService.store(xSi,JSON.stringify(t),-1,1):this.storageService.remove(xSi,-1)}}parseAssociatedRemoteProfiles(){if(this.environmentService.remoteAuthority){let e=this.storageService.get(xSi,-1);try{return e?JSON.parse(e):{}}catch(t){this.logService.error(t)}}return{}}async cleanUp(){let e=[];for(let t of this.getAssociatedRemoteProfiles()){let o=this.remoteUserDataProfilesService?.profiles.find(r=>r.id===t);if(!o)continue;let n=this.userDataProfilesService.profiles.find(r=>r.id===t);if(n){n.name!==o.name&&await this.remoteUserDataProfilesService?.updateProfile(o,{name:n.name}),e.push(t);continue}o&&await this.remoteUserDataProfilesService?.removeProfile(o)}this.setAssociatedRemoteProfiles(e)}};xXe=I([m(0,Vt),m(1,yo),m(2,an),m(3,mn),m(4,le),m(5,ne)],xXe);we(ZP,xXe,1);var _K=ae("IRemoteExtensionsScannerService"),Vro="remoteExtensionsScanner";var oB=ae("localizationService"),EFt=ae("activeLanguageService");var kXe=class{constructor(i,e,t,o,n,r,s){this.remoteAgentService=i;this.environmentService=e;this.userDataProfileService=t;this.remoteUserDataProfilesService=o;this.activeLanguagePackService=n;this.extensionManagementService=r;this.logService=s}whenExtensionsReady(){return this.withChannel(i=>i.call("whenExtensionsReady"),{failed:[]})}async scanExtensions(){try{let i=await this.activeLanguagePackService.getExtensionIdProvidingCurrentLocale();return await this.withChannel(async e=>{let t=this.userDataProfileService.currentProfile.isDefault?void 0:(await this.remoteUserDataProfilesService.getRemoteProfile(this.userDataProfileService.currentProfile)).extensionsResource,o=await e.call("scanExtensions",[Dr,t,this.extensionManagementService.getInstalledWorkspaceExtensionLocations(),this.environmentService.extensionDevelopmentLocationURI,i]);return o.forEach(n=>{n.extensionLocation=A.revive(n.extensionLocation)}),o},[])}catch(i){return this.logService.error(i),[]}}withChannel(i,e){let t=this.remoteAgentService.getConnection();return t?t.withChannel(Vro,o=>i(o)):Promise.resolve(e)}};kXe=I([m(0,yo),m(1,Vt),m(2,mn),m(3,ZP),m(4,EFt),m(5,Hd),m(6,ne)],kXe);we(_K,kXe,1);var TSi=ae("embedderTerminalService"),kSi=class{constructor(){this._onDidCreateTerminal=new E;this.onDidCreateTerminal=H.buffer(this._onDidCreateTerminal.event,"onDidCreateTerminal")}createTerminal(i){let e={name:i.name,isFeatureTerminal:!0,customPtyImplementation(t,o,n){return new ESi(t,i.pty)}};this._onDidCreateTerminal.fire(e)}},ESi=class extends C{constructor(e,t){super();this.id=e;this.shouldPersist=!1;this._onProcessReady=this._register(new E);this.onProcessReady=this._onProcessReady.event;this._onDidChangeProperty=this._register(new E);this.onDidChangeProperty=this._onDidChangeProperty.event;this._onProcessExit=this._register(new E);this.onProcessExit=this._onProcessExit.event;this._pty=t,this.onProcessData=this._pty.onDidWrite,this._pty.onDidClose&&this._register(this._pty.onDidClose(o=>this._onProcessExit.fire(o||void 0))),this._pty.onDidChangeName&&this._register(this._pty.onDidChangeName(o=>this._onDidChangeProperty.fire({type:"title",value:o})))}async start(){this._onProcessReady.fire({pid:-1,cwd:"",windowsPty:void 0}),this._pty.open()}shutdown(){this._pty.close()}input(){}sendSignal(){}async processBinary(){}resize(){}clearBuffer(){}acknowledgeDataEvent(){}async setUnicodeVersion(){}async getInitialCwd(){return""}async getCwd(){return""}refreshProperty(e){throw new Error(`refreshProperty is not suppported in EmbedderTerminalProcess. property: ${e}`)}updateProperty(e,t){throw new Error(`updateProperty is not suppported in EmbedderTerminalProcess. property: ${e}, value: ${t}`)}};we(TSi,kSi,1);function _Si(a){return`${a}.hidden`}var EXe=class extends C{constructor(e,t,o,n){super();this.viewContainerName=t;this.storageService=o;this._onDidChangeStoredState=this._register(new E);this.onDidChangeStoredState=this._onDidChangeStoredState.event;this.logger=new co(()=>n.createLogger(RQe,{name:MQe,group:vR})),this.globalViewsStateStorageId=_Si(e),this.workspaceViewsStateStorageId=e,this._register(this.storageService.onDidChangeValue(0,this.globalViewsStateStorageId,this._store)(()=>this.onDidStorageChange())),this.state=this.initialize()}set(e,t){this.state.set(e,t)}get(e){return this.state.get(e)}updateState(e){this.updateWorkspaceState(e),this.updateGlobalState(e)}updateWorkspaceState(e){let t=this.getStoredWorkspaceState();for(let o of e){let n=this.get(o.id);n&&(t[o.id]={collapsed:!!n.collapsed,isHidden:!n.visibleWorkspace,size:n.size,order:o.workspace&&n?n.order:void 0})}Object.keys(t).length>0?this.storageService.store(this.workspaceViewsStateStorageId,JSON.stringify(t),1,1):this.storageService.remove(this.workspaceViewsStateStorageId,1)}updateGlobalState(e){let t=this.getStoredGlobalState();for(let o of e){let n=this.get(o.id);t.set(o.id,{id:o.id,isHidden:n&&o.canToggleVisibility?!n.visibleGlobal:!1,order:!o.workspace&&n?n.order:void 0})}this.setStoredGlobalState(t)}onDidStorageChange(){if(this.globalViewsStatesValue!==this.getStoredGlobalViewsStatesValue()){this._globalViewsStatesValue=void 0;let e=this.getStoredGlobalState(),t=this.getStoredWorkspaceState(),o=[];for(let[n,r]of e){let s=this.get(n);if(s)s.visibleGlobal!==!r.isHidden&&(r.isHidden||this.logger.value.trace(`View visibility state changed: ${n} is now visible`,this.viewContainerName),o.push({id:n,visible:!r.isHidden}));else{let l=t[n];this.set(n,{active:!1,visibleGlobal:!r.isHidden,visibleWorkspace:cn(l?.isHidden)?void 0:!l?.isHidden,collapsed:l?.collapsed,order:l?.order,size:l?.size})}}if(o.length){this._onDidChangeStoredState.fire(o);for(let n of o){let r=this.get(n.id);r&&(r.visibleGlobal=n.visible)}}}}initialize(){let e=new Map,t=this.getStoredWorkspaceState();for(let l of Object.keys(t)){let c=t[l];e.set(l,{active:!1,visibleGlobal:void 0,visibleWorkspace:cn(c.isHidden)?void 0:!c.isHidden,collapsed:c.collapsed,order:c.order,size:c.size})}let o=this.storageService.get(this.globalViewsStateStorageId,1,"[]"),{state:n}=this.parseStoredGlobalState(o);if(n.size>0){for(let{id:l,isHidden:c}of n.values()){let u=e.get(l);u?cn(u.visibleWorkspace)&&(u.visibleWorkspace=!c):e.set(l,{active:!1,collapsed:void 0,visibleGlobal:void 0,visibleWorkspace:!c})}this.storageService.remove(this.globalViewsStateStorageId,1)}let{state:r,hasDuplicates:s}=this.parseStoredGlobalState(this.globalViewsStatesValue);s&&this.setStoredGlobalState(r);for(let{id:l,isHidden:c,order:u}of r.values()){let p=e.get(l);p?(p.visibleGlobal=!c,cn(u)||(p.order=u)):e.set(l,{active:!1,visibleGlobal:!c,order:u,collapsed:void 0,visibleWorkspace:void 0})}return e}getStoredWorkspaceState(){return JSON.parse(this.storageService.get(this.workspaceViewsStateStorageId,1,"{}"))}getStoredGlobalState(){return this.parseStoredGlobalState(this.globalViewsStatesValue).state}setStoredGlobalState(e){this.globalViewsStatesValue=JSON.stringify([...e.values()])}parseStoredGlobalState(e){let t=JSON.parse(e),o=!1;return{state:t.reduce((r,s)=>(typeof s=="string"?(o=o||r.has(s),r.set(s,{id:s,isHidden:!0})):(o=o||r.has(s.id),r.set(s.id,s)),r),new Map),hasDuplicates:o}}get globalViewsStatesValue(){return this._globalViewsStatesValue||(this._globalViewsStatesValue=this.getStoredGlobalViewsStatesValue()),this._globalViewsStatesValue}set globalViewsStatesValue(e){this.globalViewsStatesValue!==e&&(this._globalViewsStatesValue=e,this.setStoredGlobalViewsStatesValue(e))}getStoredGlobalViewsStatesValue(){return this.storageService.get(this.globalViewsStateStorageId,0,"[]")}setStoredGlobalViewsStatesValue(e){this.storageService.store(this.globalViewsStateStorageId,e,0,0)}};EXe=I([m(2,le),m(3,ol)],EXe);var UDe=class extends C{constructor(e,t,o,n){super();this.viewContainer=e;this.contextKeyService=o;this.contextKeys=new ebe;this.viewDescriptorItems=[];this._onDidChangeContainerInfo=this._register(new E);this.onDidChangeContainerInfo=this._onDidChangeContainerInfo.event;this._onDidChangeAllViewDescriptors=this._register(new E);this.onDidChangeAllViewDescriptors=this._onDidChangeAllViewDescriptors.event;this._onDidChangeActiveViewDescriptors=this._register(new E);this.onDidChangeActiveViewDescriptors=this._onDidChangeActiveViewDescriptors.event;this._onDidAddVisibleViewDescriptors=this._register(new E);this.onDidAddVisibleViewDescriptors=this._onDidAddVisibleViewDescriptors.event;this._onDidRemoveVisibleViewDescriptors=this._register(new E);this.onDidRemoveVisibleViewDescriptors=this._onDidRemoveVisibleViewDescriptors.event;this._onDidMoveVisibleViewDescriptors=this._register(new E);this.onDidMoveVisibleViewDescriptors=this._onDidMoveVisibleViewDescriptors.event;this.logger=new co(()=>n.createLogger(RQe,{name:MQe,group:vR})),this._register(H.filter(o.onDidChangeContext,r=>r.affectsSome(this.contextKeys))(()=>this.onDidChangeContext())),this.viewDescriptorsState=this._register(t.createInstance(EXe,e.storageId||`${e.id}.state`,typeof e.title=="string"?e.title:e.title.original)),this._register(this.viewDescriptorsState.onDidChangeStoredState(r=>this.updateVisibility(r))),this.updateContainerInfo()}get title(){return this._title}get icon(){return this._icon}get keybindingId(){return this._keybindingId}get allViewDescriptors(){return this.viewDescriptorItems.map(e=>e.viewDescriptor)}get activeViewDescriptors(){return this.viewDescriptorItems.filter(e=>e.state.active).map(e=>e.viewDescriptor)}get visibleViewDescriptors(){return this.viewDescriptorItems.filter(e=>this.isViewDescriptorVisible(e)).map(e=>e.viewDescriptor)}updateContainerInfo(){let e=this.viewContainer.alwaysUseContainerInfo||this.visibleViewDescriptors.length===0||this.visibleViewDescriptors.some(c=>oe.as(on.ViewsRegistry).getViewContainer(c.id)===this.viewContainer),t=e?typeof this.viewContainer.title=="string"?this.viewContainer.title:this.viewContainer.title.value:this.visibleViewDescriptors[0]?.containerTitle||this.visibleViewDescriptors[0]?.name?.value||"",o=!1;this._title!==t&&(this._title=t,o=!0);let n=e?this.viewContainer.icon:this.visibleViewDescriptors[0]?.containerIcon||Bke,r=!1;this.isEqualIcon(n)||(this._icon=n,r=!0);let s=this.viewContainer.openCommandActionDescriptor?.id??this.activeViewDescriptors.find(c=>c.openCommandActionDescriptor)?.openCommandActionDescriptor?.id,l=!1;this._keybindingId!==s&&(this._keybindingId=s,l=!0),(o||r||l)&&this._onDidChangeContainerInfo.fire({title:o,icon:r,keybindingId:l})}isEqualIcon(e){return A.isUri(e)?A.isUri(this._icon)&&Xe(e,this._icon):q.isThemeIcon(e)?q.isThemeIcon(this._icon)&&q.isEqual(e,this._icon):e===this._icon}isVisible(e){let t=this.viewDescriptorItems.find(o=>o.viewDescriptor.id===e);if(!t)throw new Error(`Unknown view ${e}`);return this.isViewDescriptorVisible(t)}setVisible(e,t){this.updateVisibility([{id:e,visible:t}])}updateVisibility(e){let t=si(e.filter(({visible:r})=>!r).map(({id:r})=>this.findAndIgnoreIfNotFound(r))),o=[];for(let{viewDescriptorItem:r,visibleIndex:s}of t)this.updateViewDescriptorItemVisibility(r,!1)&&o.push({viewDescriptor:r.viewDescriptor,index:s});o.length&&this.broadCastRemovedVisibleViewDescriptors(o);let n=[];for(let{id:r,visible:s}of e){if(!s)continue;let l=this.findAndIgnoreIfNotFound(r);if(!l)continue;let{viewDescriptorItem:c,visibleIndex:u}=l;this.updateViewDescriptorItemVisibility(c,!0)&&n.push({index:u,viewDescriptor:c.viewDescriptor,size:c.state.size,collapsed:!!c.state.collapsed})}n.length&&this.broadCastAddedVisibleViewDescriptors(n)}updateViewDescriptorItemVisibility(e,t){return!e.viewDescriptor.canToggleVisibility||this.isViewDescriptorVisibleWhenActive(e)===t?!1:(e.viewDescriptor.workspace?e.state.visibleWorkspace=t:(e.state.visibleGlobal=t,t&&this.logger.value.trace(`Showing view ${e.viewDescriptor.id} in the container ${this.viewContainer.id}`)),this.isViewDescriptorVisible(e)===t)}isCollapsed(e){return!!this.find(e).viewDescriptorItem.state.collapsed}setCollapsed(e,t){let{viewDescriptorItem:o}=this.find(e);o.state.collapsed!==t&&(o.state.collapsed=t),this.viewDescriptorsState.updateState(this.allViewDescriptors)}getSize(e){return this.find(e).viewDescriptorItem.state.size}setSizes(e){for(let{id:t,size:o}of e){let{viewDescriptorItem:n}=this.find(t);n.state.size!==o&&(n.state.size=o)}this.viewDescriptorsState.updateState(this.allViewDescriptors)}move(e,t){let o=this.viewDescriptorItems.findIndex(l=>l.viewDescriptor.id===e),n=this.viewDescriptorItems.findIndex(l=>l.viewDescriptor.id===t),r=this.viewDescriptorItems[o],s=this.viewDescriptorItems[n];lUi(this.viewDescriptorItems,o,n);for(let l=0;l<this.viewDescriptorItems.length;l++)this.viewDescriptorItems[l].state.order=l;this.broadCastMovedViewDescriptors({index:o,viewDescriptor:r.viewDescriptor},{index:n,viewDescriptor:s.viewDescriptor})}add(e){let t=[];for(let r of e){let s=r.viewDescriptor;if(s.when)for(let c of s.when.keys())this.contextKeys.add(c);let l=this.viewDescriptorsState.get(s.id);if(l){if(s.workspace)l.visibleWorkspace=Jn(r.visible)?Jn(l.visibleWorkspace)?!s.hideByDefault:l.visibleWorkspace:r.visible;else{let c=l.visibleGlobal;l.visibleGlobal=Jn(r.visible)?Jn(l.visibleGlobal)?!s.hideByDefault:l.visibleGlobal:r.visible,l.visibleGlobal&&!c&&this.logger.value.trace(`Added view ${s.id} in the container ${this.viewContainer.id} and showing it.`,`${c}`,`${s.hideByDefault}`,`${r.visible}`)}l.collapsed=Jn(r.collapsed)?Jn(l.collapsed)?!!s.collapsed:l.collapsed:r.collapsed}else l={active:!1,visibleGlobal:Jn(r.visible)?!s.hideByDefault:r.visible,visibleWorkspace:Jn(r.visible)?!s.hideByDefault:r.visible,collapsed:Jn(r.collapsed)?!!s.collapsed:r.collapsed};this.viewDescriptorsState.set(s.id,l),l.active=this.contextKeyService.contextMatchesRules(s.when),t.push({viewDescriptor:s,state:l})}this.viewDescriptorItems.push(...t),this.viewDescriptorItems.sort(this.compareViewDescriptors.bind(this)),this._onDidChangeAllViewDescriptors.fire({added:t.map(({viewDescriptor:r})=>r),removed:[]});let o=[];for(let r of t)r.state.active&&o.push({viewDescriptorItem:r,visible:this.isViewDescriptorVisible(r)});o.length&&this._onDidChangeActiveViewDescriptors.fire({added:o.map(({viewDescriptorItem:r})=>r.viewDescriptor),removed:[]});let n=[];for(let{viewDescriptorItem:r,visible:s}of o)if(s&&this.isViewDescriptorVisible(r)){let{visibleIndex:l}=this.find(r.viewDescriptor.id);n.push({index:l,viewDescriptor:r.viewDescriptor,size:r.state.size,collapsed:!!r.state.collapsed})}this.broadCastAddedVisibleViewDescriptors(n)}remove(e){let t=[],o=[],n=[],r=[];for(let s of e){if(s.when)for(let c of s.when.keys())this.contextKeys.delete(c);let l=this.viewDescriptorItems.findIndex(c=>c.viewDescriptor.id===s.id);if(l!==-1){t.push(s);let c=this.viewDescriptorItems[l];if(c.state.active&&n.push(c.viewDescriptor),this.isViewDescriptorVisible(c)){let{visibleIndex:u}=this.find(c.viewDescriptor.id);r.push({index:u,viewDescriptor:c.viewDescriptor})}o.push(c)}}o.forEach(s=>this.viewDescriptorItems.splice(this.viewDescriptorItems.indexOf(s),1)),this.broadCastRemovedVisibleViewDescriptors(r),n.length&&this._onDidChangeActiveViewDescriptors.fire({added:[],removed:n}),t.length&&this._onDidChangeAllViewDescriptors.fire({added:[],removed:t})}onDidChangeContext(){let e=[],t=[];for(let r of this.viewDescriptorItems){let s=r.state.active,l=this.contextKeyService.contextMatchesRules(r.viewDescriptor.when);s!==l&&(l?e.push({item:r,visibleWhenActive:this.isViewDescriptorVisibleWhenActive(r)}):t.push(r))}let o=[];for(let r of t)if(this.isViewDescriptorVisible(r)){let{visibleIndex:s}=this.find(r.viewDescriptor.id);o.push({index:s,viewDescriptor:r.viewDescriptor})}t.forEach(r=>r.state.active=!1),e.forEach(({item:r})=>r.state.active=!0),this.broadCastRemovedVisibleViewDescriptors(o),(e.length||t.length)&&this._onDidChangeActiveViewDescriptors.fire({added:e.map(({item:r})=>r.viewDescriptor),removed:t.map(r=>r.viewDescriptor)});let n=[];for(let{item:r,visibleWhenActive:s}of e)if(s&&this.isViewDescriptorVisible(r)){let{visibleIndex:l}=this.find(r.viewDescriptor.id);n.push({index:l,viewDescriptor:r.viewDescriptor,size:r.state.size,collapsed:!!r.state.collapsed})}this.broadCastAddedVisibleViewDescriptors(n)}broadCastAddedVisibleViewDescriptors(e){e.length&&(this._onDidAddVisibleViewDescriptors.fire(e.sort((t,o)=>t.index-o.index)),this.updateState(`Added views:${e.map(t=>t.viewDescriptor.id).join(",")} in ${this.viewContainer.id}`))}broadCastRemovedVisibleViewDescriptors(e){e.length&&(this._onDidRemoveVisibleViewDescriptors.fire(e.sort((t,o)=>o.index-t.index)),this.updateState(`Removed views:${e.map(t=>t.viewDescriptor.id).join(",")} from ${this.viewContainer.id}`))}broadCastMovedViewDescriptors(e,t){this._onDidMoveVisibleViewDescriptors.fire({from:e,to:t}),this.updateState(`Moved view ${e.viewDescriptor.id} to ${t.viewDescriptor.id} in ${this.viewContainer.id}`)}updateState(e){this.logger.value.trace(e),this.viewDescriptorsState.updateState(this.allViewDescriptors),this.updateContainerInfo()}isViewDescriptorVisible(e){return e.state.active?this.isViewDescriptorVisibleWhenActive(e):!1}isViewDescriptorVisibleWhenActive(e){return e.viewDescriptor.workspace?!!e.state.visibleWorkspace:!!e.state.visibleGlobal}find(e){let t=this.findAndIgnoreIfNotFound(e);if(t)return t;throw new Error(`view descriptor ${e} not found`)}findAndIgnoreIfNotFound(e){for(let t=0,o=0;t<this.viewDescriptorItems.length;t++){let n=this.viewDescriptorItems[t];if(n.viewDescriptor.id===e)return{index:t,visibleIndex:o,viewDescriptorItem:n};this.isViewDescriptorVisible(n)&&o++}}compareViewDescriptors(e,t){return e.viewDescriptor.id===t.viewDescriptor.id?0:this.getViewOrder(e)-this.getViewOrder(t)||this.getGroupOrderResult(e.viewDescriptor,t.viewDescriptor)}getViewOrder(e){let t=typeof e.state.order=="number"?e.state.order:e.viewDescriptor.order;return typeof t=="number"?t:Number.MAX_VALUE}getGroupOrderResult(e,t){return!e.group||!t.group||e.group===t.group?0:e.group<t.group?-1:1}};UDe=I([m(1,F),m(2,X),m(3,ol)],UDe);function Bro(a){return`${a}.state`}var _R=class extends C{constructor(e,t,o,n,r,s,l){super();this.instantiationService=e;this.contextKeyService=t;this.storageService=o;this.extensionService=n;this.telemetryService=r;this._onDidChangeContainer=this._register(new E);this.onDidChangeContainer=this._onDidChangeContainer.event;this._onDidChangeLocation=this._register(new E);this.onDidChangeLocation=this._onDidChangeLocation.event;this._onDidChangeContainerLocation=this._register(new E);this.onDidChangeContainerLocation=this._onDidChangeContainerLocation.event;this.viewContainerModels=this._register(new jt);this.viewsVisibilityActionDisposables=this._register(new jt);this.canRegisterViewsVisibilityActions=!1;this._onDidChangeViewContainers=this._register(new E);this.onDidChangeViewContainers=this._onDidChangeViewContainers.event;this.logger=new co(()=>s.createLogger(RQe,{name:MQe,group:vR})),this.isSessionsWindow=l.isSessionsWindow,this.activeViewContextKeys=new Map,this.movableViewContextKeys=new Map,this.defaultViewLocationContextKeys=new Map,this.defaultViewContainerLocationContextKeys=new Map,this.viewContainersRegistry=oe.as(on.ViewContainersRegistry),this.viewsRegistry=oe.as(on.ViewsRegistry),this.migrateToViewsCustomizationsStorage(),this.viewContainersCustomLocations=new Map(Object.entries(this.viewCustomizations.viewContainerLocations)),this.viewDescriptorsCustomLocations=new Map(Object.entries(this.viewCustomizations.viewLocations)),this.viewContainerBadgeEnablementStates=new Map(Object.entries(this.viewCustomizations.viewContainerBadgeEnablementStates)),this.viewContainers.forEach(c=>this.onDidRegisterViewContainer(c)),this._register(this.viewsRegistry.onViewsRegistered(c=>this.onDidRegisterViews(c))),this._register(this.viewsRegistry.onViewsDeregistered(({views:c,viewContainer:u})=>this.onDidDeregisterViews(c,u))),this._register(this.viewsRegistry.onDidChangeContainer(({views:c,from:u,to:p})=>this.onDidChangeDefaultContainer(c,u,p))),this._register(this.viewContainersRegistry.onDidRegister(({viewContainer:c})=>{this.onDidRegisterViewContainer(c),this._onDidChangeViewContainers.fire({added:[{container:c,location:this.getViewContainerLocation(c)}],removed:[]})})),this._register(this.viewContainersRegistry.onDidDeregister(({viewContainer:c,viewContainerLocation:u})=>{this.onDidDeregisterViewContainer(c),this._onDidChangeViewContainers.fire({removed:[{container:c,location:u}],added:[]})})),this._register(this.storageService.onDidChangeValue(0,_R.VIEWS_CUSTOMIZATIONS,this._store)(()=>this.onDidStorageChange())),this.extensionService.whenInstalledExtensionsRegistered().then(()=>this.whenExtensionsRegistered())}static{this.VIEWS_CUSTOMIZATIONS="views.customizations"}static{this.COMMON_CONTAINER_ID_PREFIX="workbench.views.service"}get viewContainers(){return this.viewContainersRegistry.all}migrateToViewsCustomizationsStorage(){if(this.storageService.get(_R.VIEWS_CUSTOMIZATIONS,0))return;let e=this.storageService.get("views.cachedViewContainerLocations",0),t=this.storageService.get("views.cachedViewPositions",0);if(!e&&!t)return;let o=e?JSON.parse(e):[],n=t?JSON.parse(t):[],r={viewContainerLocations:o.reduce((s,[l,c])=>(s[l]=c,s),{}),viewLocations:n.reduce((s,[l,{containerId:c}])=>(s[l]=c,s),{}),viewContainerBadgeEnablementStates:{}};this.storageService.store(_R.VIEWS_CUSTOMIZATIONS,JSON.stringify(r),0,0),this.storageService.remove("views.cachedViewContainerLocations",0),this.storageService.remove("views.cachedViewPositions",0)}registerGroupedViews(e){for(let[t,o]of e.entries()){let n=this.viewContainersRegistry.get(t);if(!n||!this.viewContainerModels.has(n)){if(this.isGeneratedContainerId(t)){let s=this.viewContainersCustomLocations.get(t);s!==void 0&&this.registerGeneratedViewContainer(s,t)}continue}let r=o.filter(s=>this.getViewContainerModel(n).allViewDescriptors.filter(l=>l.id===s.id).length===0);this.addViews(n,r)}}deregisterGroupedViews(e){for(let[t,o]of e.entries()){let n=this.viewContainersRegistry.get(t);!n||!this.viewContainerModels.has(n)||this.removeViews(n,o)}}moveOrphanViewsToDefaultLocation(){for(let[e,t]of this.viewDescriptorsCustomLocations.entries()){if(this.viewContainersRegistry.get(t))continue;let o=this.viewsRegistry.getViewContainer(e),n=this.getViewDescriptorById(e);o&&n&&this.addViews(o,[n])}}whenExtensionsRegistered(){this.moveOrphanViewsToDefaultLocation();for(let e of[...this.viewContainersCustomLocations.keys()])this.cleanUpGeneratedViewContainer(e);this.saveViewCustomizations();for(let[e,t]of this.viewContainerModels)this.registerViewsVisibilityActions(e,t);this.canRegisterViewsVisibilityActions=!0}onDidRegisterViews(e){this.contextKeyService.bufferChangeEvents(()=>{e.forEach(({views:t,viewContainer:o})=>{let n=this.regroupViews(o.id,t);this.registerGroupedViews(n),t.forEach(r=>this.getOrCreateMovableViewContextKey(r).set(!!r.canMoveView))})})}isGeneratedContainerId(e){return e.startsWith(_R.COMMON_CONTAINER_ID_PREFIX)}onDidDeregisterViews(e,t){let o=this.regroupViews(t.id,e);this.deregisterGroupedViews(o),this.contextKeyService.bufferChangeEvents(()=>{e.forEach(n=>this.getOrCreateMovableViewContextKey(n).set(!1))})}regroupViews(e,t){let o=new Map;for(let n of t){let r=this.viewDescriptorsCustomLocations.get(n.id)??e,s=o.get(r);s||o.set(r,s=[]),s.push(n)}return o}getViewDescriptorById(e){let t=this.viewsRegistry.getView(e);return t&&!this.isViewVisible(t)?null:t}getViewLocationById(e){let t=this.getViewContainerByViewId(e);return t===null?null:this.getViewContainerLocation(t)}getViewContainerByViewId(e){let t=this.viewsRegistry.getView(e);if(t&&!this.isViewVisible(t))return null;let o=this.viewDescriptorsCustomLocations.get(e);return o?this.viewContainersRegistry.get(o)??null:this.getDefaultContainerById(e)}getViewContainerLocation(e){let t=this.viewContainersCustomLocations.get(e.id)??this.getDefaultViewContainerLocation(e);return this.getEffectiveViewContainerLocation(t)}getDefaultViewContainerLocation(e){return this.getEffectiveViewContainerLocation(this.viewContainersRegistry.getViewContainerLocation(e))}getEffectiveViewContainerLocation(e){return!this.isSessionsWindow&&e===3?2:e}getDefaultContainerById(e){return this.viewsRegistry.getViewContainer(e)??null}getViewContainerModel(e){return this.getOrRegisterViewContainerModel(e)}getViewContainerById(e){let t=this.viewContainersRegistry.get(e)||null;return t&&!this.isViewContainerVisible(t)?null:t}getViewContainersByLocation(e){return this.viewContainers.filter(t=>this.getViewContainerLocation(t)===e&&this.isViewContainerVisible(t))}isViewContainerVisible(e){let t=e.windowVisibility;return this.isSessionsWindow?t===2||t===3:!t||t===1||t===3}isViewVisible(e){let t=e.windowVisibility;return this.isSessionsWindow?t===2||t===3:!t||t===1||t===3}getDefaultViewContainer(e){return this.viewContainersRegistry.getDefaultViewContainers(e).find(o=>this.isViewContainerVisible(o))}canMoveViews(){return!this.isSessionsWindow}moveViewContainerToLocation(e,t,o,n){this.canMoveViews()&&(this.logger.value.trace(`moveViewContainerToLocation: viewContainer:${e.id} location:${t} reason:${n}`),this.moveViewContainerToLocationWithoutSaving(e,t,o),this.saveViewCustomizations())}getViewContainerBadgeEnablementState(e){return this.viewContainerBadgeEnablementStates.get(e)??!0}setViewContainerBadgeEnablementState(e,t){this.viewContainerBadgeEnablementStates.set(e,t),this.saveViewCustomizations()}moveViewToLocation(e,t,o){if(!this.canMoveViews())return;this.logger.value.trace(`moveViewToLocation: view:${e.id} location:${t} reason:${o}`);let n=this.registerGeneratedViewContainer(t);this.moveViewsToContainer([e],n)}moveViewsToContainer(e,t,o,n){if(!e.length||!this.canMoveViews())return;this.logger.value.trace(`moveViewsToContainer: views:${e.map(l=>l.id).join(",")} viewContainer:${t.id} reason:${n}`);let r=this.getViewContainerByViewId(e[0].id),s=t;r&&s&&r!==s&&(this.moveViewsWithoutSaving(e,r,s,o),this.cleanUpGeneratedViewContainer(r.id),this.saveViewCustomizations(),this.reportMovedViews(e,r,s))}reset(){for(let e of this.viewContainers){let t=this.getViewContainerModel(e);for(let r of t.allViewDescriptors){let s=this.getDefaultContainerById(r.id),l=this.getViewContainerByViewId(r.id);l&&s&&l!==s&&this.moveViewsWithoutSaving([r],l,s)}let o=this.getDefaultViewContainerLocation(e),n=this.getViewContainerLocation(e);o!==null&&n!==o&&this.moveViewContainerToLocationWithoutSaving(e,o),this.cleanUpGeneratedViewContainer(e.id)}this.viewContainersCustomLocations.clear(),this.viewDescriptorsCustomLocations.clear(),this.saveViewCustomizations()}isViewContainerRemovedPermanently(e){return this.isGeneratedContainerId(e)&&!this.viewContainersCustomLocations.has(e)}onDidChangeDefaultContainer(e,t,o){let n=e.filter(r=>!this.viewDescriptorsCustomLocations.has(r.id)||!this.viewContainers.includes(t)&&this.viewDescriptorsCustomLocations.get(r.id)===t.id);n.length&&this.moveViewsWithoutSaving(n,t,o)}reportMovedViews(e,t,o){let n=g=>g.id.startsWith(_R.COMMON_CONTAINER_ID_PREFIX)?"custom":g.extensionId?"extension":g.id,r=this.getViewContainerLocation(t),s=this.getViewContainerLocation(o),l=e.length,c=n(t),u=n(o),p=r===1?"panel":"sidebar",h=s===1?"panel":"sidebar";this.telemetryService.publicLog2("viewDescriptorService.moveViews",{viewCount:l,fromContainer:c,toContainer:u,fromLocation:p,toLocation:h})}moveViewsWithoutSaving(e,t,o,n=1){this.removeViews(t,e),this.addViews(o,e,n);let r=this.getViewContainerLocation(t),s=this.getViewContainerLocation(o);r!==s&&this._onDidChangeLocation.fire({views:e,from:r,to:s}),this._onDidChangeContainer.fire({views:e,from:t,to:o})}moveViewContainerToLocationWithoutSaving(e,t,o){let n=this.getViewContainerLocation(e),r=t;if(n!==r){let s=this.isGeneratedContainerId(e.id),l=r===this.getDefaultViewContainerLocation(e);s||!l?this.viewContainersCustomLocations.set(e.id,r):this.viewContainersCustomLocations.delete(e.id),this.getOrCreateDefaultViewContainerLocationContextKey(e).set(s||l),e.requestedIndex=o,this._onDidChangeContainerLocation.fire({viewContainer:e,from:n,to:r});let c=this.getViewsByContainer(e);this._onDidChangeLocation.fire({views:c,from:n,to:r})}}cleanUpGeneratedViewContainer(e){if(!this.isGeneratedContainerId(e))return;let t=this.getViewContainerById(e);t&&this.getViewContainerModel(t)?.allViewDescriptors.length||[...this.viewDescriptorsCustomLocations.values()].includes(e)||(t&&this.viewContainersRegistry.deregisterViewContainer(t),this.viewContainersCustomLocations.delete(e),this.viewContainerBadgeEnablementStates.delete(e),this.storageService.remove(_Si(t?.storageId||Bro(e)),0))}registerGeneratedViewContainer(e,t){let o=t||this.generateContainerId(e),n=this.viewContainersRegistry.registerViewContainer({id:o,ctorDescriptor:new Mt(Ha,[o,{mergeViewWithContainerWhenSingleView:!0}]),title:{value:d(17573,null),original:"User View Container"},icon:e===0?Bke:void 0,storageId:Bro(o),hideIfEmpty:!0},e,{doNotRegisterOpenCommand:!0});return this.viewContainersCustomLocations.get(n.id)!==e&&this.viewContainersCustomLocations.set(n.id,e),this.getOrCreateDefaultViewContainerLocationContextKey(n).set(!0),n}onDidStorageChange(){JSON.stringify(this.viewCustomizations)!==this.getStoredViewCustomizationsValue()&&this.onDidViewCustomizationsStorageChange()}onDidViewCustomizationsStorageChange(){this._viewCustomizations=void 0;let e=new Map(Object.entries(this.viewCustomizations.viewContainerLocations)),t=new Map(Object.entries(this.viewCustomizations.viewLocations)),o=[],n=[];for(let[r,s]of e.entries()){let l=this.getViewContainerById(r);l?s!==this.getViewContainerLocation(l)&&o.push([l,s]):this.isGeneratedContainerId(r)&&this.registerGeneratedViewContainer(s,r)}for(let r of this.viewContainers)if(!e.has(r.id)){let s=this.getViewContainerLocation(r),l=this.getDefaultViewContainerLocation(r);s!==l&&o.push([r,l])}for(let[r,s]of t.entries()){let l=this.getViewDescriptorById(r);if(l){let c=this.getViewContainerByViewId(r),u=this.viewContainersRegistry.get(s);c&&u&&u!==c&&n.push({views:[l],from:c,to:u})}}for(let r of this.viewContainers){let s=this.getViewContainerModel(r);for(let l of s.allViewDescriptors)if(!t.has(l.id)){let c=this.getViewContainerByViewId(l.id),u=this.getDefaultContainerById(l.id);c&&u&&c!==u&&n.push({views:[l],from:c,to:u})}}for(let[r,s]of o)this.moveViewContainerToLocationWithoutSaving(r,s);for(let{views:r,from:s,to:l}of n)this.moveViewsWithoutSaving(r,s,l,0);this.viewContainersCustomLocations=e,this.viewDescriptorsCustomLocations=t}generateContainerId(e){return`${_R.COMMON_CONTAINER_ID_PREFIX}.${WE(e)}.${_t()}`}saveViewCustomizations(){let e={viewContainerLocations:{},viewLocations:{},viewContainerBadgeEnablementStates:{}};for(let[t,o]of this.viewContainersCustomLocations){let n=this.getViewContainerById(t);n&&!this.isGeneratedContainerId(t)&&o===this.getDefaultViewContainerLocation(n)||(e.viewContainerLocations[t]=o)}for(let[t,o]of this.viewDescriptorsCustomLocations){let n=this.getViewContainerById(o);n&&this.getDefaultContainerById(t)?.id===n.id||(e.viewLocations[t]=o)}for(let[t,o]of this.viewContainerBadgeEnablementStates)o===!1&&(e.viewContainerBadgeEnablementStates[t]=o);this.viewCustomizations=e}get viewCustomizations(){return this._viewCustomizations||(this._viewCustomizations=JSON.parse(this.getStoredViewCustomizationsValue()),this._viewCustomizations.viewContainerLocations=this._viewCustomizations.viewContainerLocations??{},this._viewCustomizations.viewLocations=this._viewCustomizations.viewLocations??{},this._viewCustomizations.viewContainerBadgeEnablementStates=this._viewCustomizations.viewContainerBadgeEnablementStates??{}),this._viewCustomizations}set viewCustomizations(e){let t=JSON.stringify(e);JSON.stringify(this.viewCustomizations)!==t&&(this._viewCustomizations=e,this.setStoredViewCustomizationsValue(t))}getStoredViewCustomizationsValue(){return this.isSessionsWindow?"{}":this.storageService.get(_R.VIEWS_CUSTOMIZATIONS,0,"{}")}setStoredViewCustomizationsValue(e){this.isSessionsWindow||this.storageService.store(_R.VIEWS_CUSTOMIZATIONS,e,0,0)}getViewsByContainer(e){let t=this.viewsRegistry.getViews(e).filter(o=>(this.viewDescriptorsCustomLocations.get(o.id)??e.id)===e.id);for(let[o,n]of this.viewDescriptorsCustomLocations.entries()){if(n!==e.id||this.viewsRegistry.getViewContainer(o)===e)continue;let r=this.getViewDescriptorById(o);r&&t.push(r)}return t}onDidRegisterViewContainer(e){let t=this.isGeneratedContainerId(e.id)?!0:this.getViewContainerLocation(e)===this.getDefaultViewContainerLocation(e);this.getOrCreateDefaultViewContainerLocationContextKey(e).set(t),this.getOrRegisterViewContainerModel(e)}getOrRegisterViewContainerModel(e){let t=this.viewContainerModels.get(e)?.viewContainerModel;if(!t){let o=new P;t=o.add(this.instantiationService.createInstance(UDe,e)),this.onDidChangeActiveViews({added:t.activeViewDescriptors,removed:[]}),t.onDidChangeActiveViewDescriptors(s=>this.onDidChangeActiveViews(s),this,o),this.onDidChangeVisibleViews({added:[...t.visibleViewDescriptors],removed:[]}),t.onDidAddVisibleViewDescriptors(s=>this.onDidChangeVisibleViews({added:s.map(({viewDescriptor:l})=>l),removed:[]}),this,o),t.onDidRemoveVisibleViewDescriptors(s=>this.onDidChangeVisibleViews({added:[],removed:s.map(({viewDescriptor:l})=>l)}),this,o),o.add(Z(()=>this.viewsVisibilityActionDisposables.deleteAndDispose(e))),o.add(this.registerResetViewContainerAction(e));let n={viewContainerModel:t,disposables:o,dispose:()=>o.dispose()};this.viewContainerModels.set(e,n),this.onDidRegisterViews([{views:this.viewsRegistry.getViews(e),viewContainer:e}]);let r=this.getViewsByContainer(e).filter(s=>this.getDefaultContainerById(s.id)!==e);r.length&&(this.addViews(e,r),this.contextKeyService.bufferChangeEvents(()=>{r.forEach(s=>this.getOrCreateMovableViewContextKey(s).set(!!s.canMoveView))})),this.canRegisterViewsVisibilityActions&&this.registerViewsVisibilityActions(e,n)}return t}onDidDeregisterViewContainer(e){this.viewContainerModels.deleteAndDispose(e),this.viewsVisibilityActionDisposables.deleteAndDispose(e)}onDidChangeActiveViews({added:e,removed:t}){this.contextKeyService.bufferChangeEvents(()=>{e.forEach(o=>this.getOrCreateActiveViewContextKey(o).set(!0)),t.forEach(o=>this.getOrCreateActiveViewContextKey(o).set(!1))})}onDidChangeVisibleViews({added:e,removed:t}){this.contextKeyService.bufferChangeEvents(()=>{e.forEach(o=>this.getOrCreateVisibleViewContextKey(o).set(!0)),t.forEach(o=>this.getOrCreateVisibleViewContextKey(o).set(!1))})}registerViewsVisibilityActions(e,{viewContainerModel:t,disposables:o}){this.viewsVisibilityActionDisposables.deleteAndDispose(e),this.viewsVisibilityActionDisposables.set(e,this.registerViewsVisibilityActionsForContainer(t)),o.add(H.any(t.onDidChangeActiveViewDescriptors,t.onDidAddVisibleViewDescriptors,t.onDidRemoveVisibleViewDescriptors,t.onDidMoveVisibleViewDescriptors)(n=>{this.viewsVisibilityActionDisposables.deleteAndDispose(e),this.viewsVisibilityActionDisposables.set(e,this.registerViewsVisibilityActionsForContainer(t))}))}registerViewsVisibilityActionsForContainer(e){let t=new P;return e.activeViewDescriptors.forEach((o,n)=>{o.remoteAuthority||(t.add(W(class extends R9e{constructor(){super({id:`${o.id}.toggleVisibility`,viewPaneContainerId:e.viewContainer.id,precondition:o.canToggleVisibility&&(!e.isVisible(o.id)||e.visibleViewDescriptors.length>1)?x.true():x.false(),toggled:x.has(`${o.id}.visible`),title:o.name,metadata:{description:L(17572,"Toggles the visibility of the {0} view if the view container it is located in is visible",o.name.value)},menu:[{id:T5,when:x.equals("viewContainer",e.viewContainer.id),order:n},{id:D.ViewContainerTitleContext,when:x.equals("viewContainer",e.viewContainer.id),order:n,group:"1_toggleVisibility"},{id:D.ViewTitleContext,when:x.or(...e.visibleViewDescriptors.map(r=>x.equals("view",r.id))),order:n,group:"2_toggleVisibility"}]})}async runInViewPaneContainer(r,s){s.toggleViewVisibility(o.id)}})),t.add(W(class extends R9e{constructor(){super({id:`${o.id}.removeView`,viewPaneContainerId:e.viewContainer.id,title:d(17569,null,o.name.value),metadata:{description:L(17570,"Hides the {0} view if it is visible and the view container it is located in is visible",o.name.value)},precondition:o.canToggleVisibility&&(!e.isVisible(o.id)||e.visibleViewDescriptors.length>1)?x.true():x.false(),menu:[{id:D.ViewTitleContext,when:x.and(x.equals("view",o.id),x.has(`${o.id}.visible`)),group:"1_hide",order:1}]})}async runInViewPaneContainer(r,s){s.getView(o.id)?.isVisible()&&s.toggleViewVisibility(o.id)}})))}),t}registerResetViewContainerAction(e){let t=this;return W(class extends K{constructor(){super({id:`${e.id}.resetViewContainerLocation`,title:L(17571,"Reset Location"),menu:[{id:D.ViewContainerTitleContext,group:"1_viewActions",when:x.or(x.and(x.equals("viewContainer",e.id),x.equals(`${e.id}.defaultViewContainerLocation`,!1)))}]})}run(n){t.moveViewContainerToLocation(e,t.getDefaultViewContainerLocation(e),void 0,this.desc.id),n.get(Ft).openViewContainer(e.id,!0)}})}addViews(e,t,o=0){this.contextKeyService.bufferChangeEvents(()=>{t.forEach(n=>{let r=this.getDefaultContainerById(n.id)===e;this.getOrCreateDefaultViewLocationContextKey(n).set(r),r?this.viewDescriptorsCustomLocations.delete(n.id):this.viewDescriptorsCustomLocations.set(n.id,e.id)})}),this.getViewContainerModel(e).add(t.map(n=>({viewDescriptor:n,collapsed:o===0?void 0:!1,visible:o===0?void 0:!0})))}removeViews(e,t){this.contextKeyService.bufferChangeEvents(()=>{t.forEach(o=>{this.viewDescriptorsCustomLocations.get(o.id)===e.id&&this.viewDescriptorsCustomLocations.delete(o.id),this.getOrCreateDefaultViewLocationContextKey(o).set(!1)})}),this.getViewContainerModel(e).remove(t)}getOrCreateActiveViewContextKey(e){let t=`${e.id}.active`,o=this.activeViewContextKeys.get(t);return o||(o=new Q(t,!1).bindTo(this.contextKeyService),this.activeViewContextKeys.set(t,o)),o}getOrCreateVisibleViewContextKey(e){let t=`${e.id}.visible`,o=this.activeViewContextKeys.get(t);return o||(o=new Q(t,!1).bindTo(this.contextKeyService),this.activeViewContextKeys.set(t,o)),o}getOrCreateMovableViewContextKey(e){let t=`${e.id}.canMove`,o=this.movableViewContextKeys.get(t);return o||(o=new Q(t,!1).bindTo(this.contextKeyService),this.movableViewContextKeys.set(t,o)),o}getOrCreateDefaultViewLocationContextKey(e){let t=`${e.id}.defaultViewLocation`,o=this.defaultViewLocationContextKeys.get(t);return o||(o=new Q(t,!1).bindTo(this.contextKeyService),this.defaultViewLocationContextKeys.set(t,o)),o}getOrCreateDefaultViewContainerLocationContextKey(e){let t=`${e.id}.defaultViewContainerLocation`,o=this.defaultViewContainerLocationContextKeys.get(t);return o||(o=new Q(t,!1).bindTo(this.contextKeyService),this.defaultViewContainerLocationContextKeys.set(t,o)),o}};_R=I([m(0,F),m(1,X),m(2,le),m(3,lt),m(4,Te),m(5,ol),m(6,Vt)],_R);we(Ri,_R,1);var zJ=class extends Ha{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(e,{mergeViewWithContainerWhenSingleView:!1},l,o,n,u,r,p,c,s,h,g,f);this.constantViewDescriptors=new Map;this.allViews=new Map;this._register(t(v=>{this.filterValue=v,this.onFilterChanged(v)})),this._register(this.viewContainerModel.onDidChangeActiveViewDescriptors(()=>{this.updateAllViews(this.viewContainerModel.activeViewDescriptors)}))}updateAllViews(e){e.forEach(t=>{let o=this.getFilterOn(t);o&&(this.allViews.has(o)||this.allViews.set(o,new Map),this.allViews.get(o).set(t.id,t),this.filterValue&&!this.filterValue.includes(o)&&this.panes.find(n=>n.id===t.id)&&this.viewContainerModel.setVisible(t.id,!1))})}addConstantViewDescriptors(e){e.forEach(t=>this.constantViewDescriptors.set(t.id,t))}onFilterChanged(e){this.allViews.size===0&&this.updateAllViews(this.viewContainerModel.activeViewDescriptors),this.getViewsNotForTarget(e).forEach(t=>this.viewContainerModel.setVisible(t.id,!1)),this.getViewsForTarget(e).forEach(t=>this.viewContainerModel.setVisible(t.id,!0))}getViewsForTarget(e){let t=[];for(let o=0;o<e.length;o++)this.allViews.has(e[o])&&t.push(...Array.from(this.allViews.get(e[o]).values()));return t}getViewsNotForTarget(e){let t=this.allViews.keys(),o=t.next(),n=[];for(;!o.done;){let r=!1;e.forEach(s=>{o.value===s&&(r=!0)}),r||(n=n.concat(this.getViewsForTarget([o.value]))),o=t.next()}return n}onDidAddViewDescriptors(e){let t=super.onDidAddViewDescriptors(e);for(let o=0;o<e.length;o++)this.constantViewDescriptors.has(e[o].viewDescriptor.id)&&t[o].setExpanded(!1);return this.allViews.size===0&&this.updateAllViews(this.viewContainerModel.activeViewDescriptors),t}openView(e,t){let o=super.openView(e,t);if(o){let n=Array.from(this.allViews.entries()).find(r=>r[1].has(e));n&&!this.filterValue?.includes(n[0])&&this.setFilter(n[1].get(e))}return o}};zJ=I([m(2,B),m(3,fi),m(4,Te),m(5,le),m(6,F),m(7,De),m(8,ze),m(9,lt),m(10,Pe),m(11,Ri),m(12,ne)],zJ);var TXe=class extends C{constructor(e,t,o,n,r){super();this.viewDescriptorService=e;this.paneCompositeService=t;this.contextKeyService=o;this.layoutService=n;this.editorService=r;this._onDidChangeViewVisibility=this._register(new E);this.onDidChangeViewVisibility=this._onDidChangeViewVisibility.event;this._onDidChangeViewContainerVisibility=this._register(new E);this.onDidChangeViewContainerVisibility=this._onDidChangeViewContainerVisibility.event;this._onDidChangeFocusedView=this._register(new E);this.onDidChangeFocusedView=this._onDidChangeFocusedView.event;this.viewContainerDisposables=this._register(new jt);this.viewDisposable=new Map,this.enabledViewContainersContextKeys=new Map,this.visibleViewContextKeys=new Map,this.viewPaneContainers=new Map,this._register(Z(()=>{this.viewDisposable.forEach(s=>s.dispose()),this.viewDisposable.clear()})),this.viewDescriptorService.viewContainers.forEach(s=>this.onDidRegisterViewContainer(s,this.viewDescriptorService.getViewContainerLocation(s))),this._register(this.viewDescriptorService.onDidChangeViewContainers(({added:s,removed:l})=>this.onDidChangeContainers(s,l))),this._register(this.viewDescriptorService.onDidChangeContainerLocation(({viewContainer:s,from:l,to:c})=>this.onDidChangeContainerLocation(s,l,c))),this._register(this.paneCompositeService.onDidPaneCompositeOpen(s=>this._onDidChangeViewContainerVisibility.fire({id:s.composite.getId(),visible:!0,location:s.viewContainerLocation}))),this._register(this.paneCompositeService.onDidPaneCompositeClose(s=>this._onDidChangeViewContainerVisibility.fire({id:s.composite.getId(),visible:!1,location:s.viewContainerLocation}))),this.focusedViewContextKey=Vl.bindTo(o)}onViewsAdded(e){for(let t of e)this.onViewsVisibilityChanged(t,t.isBodyVisible())}onViewsVisibilityChanged(e,t){this.getOrCreateActiveViewContextKey(e).set(t),this._onDidChangeViewVisibility.fire({id:e.id,visible:t})}onViewsRemoved(e){for(let t of e)this.onViewsVisibilityChanged(t,!1)}getOrCreateActiveViewContextKey(e){let t=O8e(e.id),o=this.visibleViewContextKeys.get(t);return o||(o=new Q(t,!1).bindTo(this.contextKeyService),this.visibleViewContextKeys.set(t,o)),o}onDidChangeContainers(e,t){for(let{container:o,location:n}of t)this.onDidDeregisterViewContainer(o,n);for(let{container:o,location:n}of e)this.onDidRegisterViewContainer(o,n)}onDidRegisterViewContainer(e,t){this.registerPaneComposite(e,t);let o=new P,n=this.viewDescriptorService.getViewContainerModel(e);this.onViewDescriptorsAdded(n.allViewDescriptors,e),o.add(n.onDidChangeAllViewDescriptors(({added:r,removed:s})=>{this.onViewDescriptorsAdded(r,e),this.onViewDescriptorsRemoved(s)})),this.updateViewContainerEnablementContextKey(e),o.add(n.onDidChangeActiveViewDescriptors(()=>this.updateViewContainerEnablementContextKey(e))),o.add(this.registerOpenViewContainerAction(e)),this.viewContainerDisposables.set(e.id,o)}onDidDeregisterViewContainer(e,t){this.deregisterPaneComposite(e,t),this.viewContainerDisposables.deleteAndDispose(e.id)}onDidChangeContainerLocation(e,t,o){this.deregisterPaneComposite(e,t),this.registerPaneComposite(e,o),this.layoutService.isVisible(this.paneCompositeService.getPartId(o))&&this.viewDescriptorService.getViewContainersByLocation(o).filter(n=>this.isViewContainerActive(n.id)).length===1&&this.openViewContainer(e.id)}onViewDescriptorsAdded(e,t){if(this.viewDescriptorService.getViewContainerLocation(t)!==null)for(let n of e){let r=new P;r.add(this.registerOpenViewAction(n)),r.add(this.registerFocusViewAction(n,t.title)),r.add(this.registerResetViewLocationAction(n)),this.viewDisposable.set(n,r)}}onViewDescriptorsRemoved(e){for(let t of e){let o=this.viewDisposable.get(t);o&&(o.dispose(),this.viewDisposable.delete(t))}}updateViewContainerEnablementContextKey(e){let t=this.enabledViewContainersContextKeys.get(e.id);t||(t=this.contextKeyService.createKey(DSi(e.id),!1),this.enabledViewContainersContextKeys.set(e.id,t)),t.set(!(e.hideIfEmpty&&this.viewDescriptorService.getViewContainerModel(e).activeViewDescriptors.length===0))}async openComposite(e,t,o){return this.paneCompositeService.openPaneComposite(e,t,o)}getComposite(e,t){return this.paneCompositeService.getPaneComposite(e,t)}isViewContainerVisible(e){let t=this.viewDescriptorService.getViewContainerById(e);if(!t)return!1;let o=this.viewDescriptorService.getViewContainerLocation(t);return o===null?!1:this.paneCompositeService.getActivePaneComposite(o)?.getId()===e}isViewContainerActive(e){let t=this.viewDescriptorService.getViewContainerById(e);return t?t.hideIfEmpty?this.viewDescriptorService.getViewContainerModel(t).activeViewDescriptors.length>0:!0:!1}getVisibleViewContainer(e){let t=this.paneCompositeService.getActivePaneComposite(e)?.getId();return t?this.viewDescriptorService.getViewContainerById(t):null}getActiveViewPaneContainerWithId(e){let t=this.viewDescriptorService.getViewContainerById(e);return t?this.getActiveViewPaneContainer(t):null}async openViewContainer(e,t){let o=this.viewDescriptorService.getViewContainerById(e);if(o){let n=this.viewDescriptorService.getViewContainerLocation(o);if(n!==null)return await this.paneCompositeService.openPaneComposite(e,n,t)||null}return null}async closeViewContainer(e){let t=this.viewDescriptorService.getViewContainerById(e);if(t){let o=this.viewDescriptorService.getViewContainerLocation(t),n=o!==null&&this.paneCompositeService.getActivePaneComposite(o);if(o!==null)return n?this.layoutService.setPartHidden(!0,this.paneCompositeService.getPartId(o)):void 0}}isViewVisible(e){return this.getActiveViewWithId(e)?.isBodyVisible()||!1}getActiveViewWithId(e){let t=this.viewDescriptorService.getViewContainerByViewId(e);if(t){let o=this.getActiveViewPaneContainer(t);if(o)return o.getView(e)}return null}getViewWithId(e){let t=this.viewDescriptorService.getViewContainerByViewId(e);if(t){let o=this.viewPaneContainers.get(t.id);if(o)return o.getView(e)}return null}getFocusedView(){let e=this.contextKeyService.getContextKeyValue(Vl.key)??"";return this.viewDescriptorService.getViewDescriptorById(e.toString())}getFocusedViewName(){let e=this.editorService.activeTextEditorControl?.hasTextFocus()?d(17574,null):void 0;return this.getFocusedView()?.name?.value??e??""}async openView(e,t){let o=this.viewDescriptorService.getViewContainerByViewId(e);if(!o||!this.viewDescriptorService.getViewContainerModel(o).activeViewDescriptors.some(s=>s.id===e))return null;let n=this.viewDescriptorService.getViewContainerLocation(o),r=this.getComposite(o.id,n);if(r){let s=await this.openComposite(r.id,n);if(s?.openView)return s.openView(e,t)||null;t&&s?.focus()}return null}closeView(e){let t=this.viewDescriptorService.getViewContainerByViewId(e);if(t){let o=this.getActiveViewPaneContainer(t);if(o){let n=o.getView(e);if(n)if(o.views.length===1){let r=this.viewDescriptorService.getViewContainerLocation(t);r===0?this.layoutService.setPartHidden(!0,"workbench.parts.sidebar"):(r===1||r===2)&&this.paneCompositeService.hideActivePaneComposite(r),this.focusedViewContextKey.get()===e&&this.focusedViewContextKey.reset()}else n.setExpanded(!1)}}}getActiveViewPaneContainer(e){let t=this.viewDescriptorService.getViewContainerLocation(e);if(t===null)return null;let o=this.paneCompositeService.getActivePaneComposite(t);return o?.getId()===e.id&&o.getViewPaneContainer()||null}getViewProgressIndicator(e){let t=this.viewDescriptorService.getViewContainerByViewId(e);if(!t)return;let o=this.viewPaneContainers.get(t.id);if(!o)return;let n=o.getView(e);if(n)return o.isViewMergedWithContainer()?this.getViewContainerProgressIndicator(t):n.getProgressIndicator()}getViewContainerProgressIndicator(e){let t=this.viewDescriptorService.getViewContainerLocation(e);if(t!==null)return this.paneCompositeService.getProgressIndicator(e.id,t)}registerOpenViewContainerAction(e){let t=new P;if(e.openCommandActionDescriptor){let{id:o,mnemonicTitle:n,keybindings:r,order:s}=e.openCommandActionDescriptor??{id:e.id},l=e.openCommandActionDescriptor.title??e.title,c=this;if(t.add(W(class extends K{constructor(){super({id:o,get title(){let p=c.viewDescriptorService.getViewContainerLocation(e),h=typeof l=="string"?l:l.value,g=typeof l=="string"?l:l.original;return p===0?{value:d(17579,null,h),original:`Show ${g}`}:{value:d(17580,null,h),original:`Toggle ${g}`}},category:We.View,precondition:x.has(DSi(e.id)),keybinding:r?{...r,weight:200}:void 0,f1:!0})}async run(p){let h=p.get(Et),g=p.get(Ri),f=p.get(fi),v=p.get(Ft),b=g.getViewContainerLocation(e);switch(b){case 2:case 0:{let S=b===0?"workbench.parts.sidebar":"workbench.parts.auxiliarybar";!v.isViewContainerVisible(e.id)||!f.hasFocus(S)?await v.openViewContainer(e.id,!0):h.activeGroup.focus();break}case 1:!v.isViewContainerVisible(e.id)||!f.hasFocus("workbench.parts.panel")?await v.openViewContainer(e.id,!0):v.closeViewContainer(e.id);break}}})),n){let u=this.viewDescriptorService.getDefaultViewContainerLocation(e);t.add(fe.appendMenuItem(D.MenubarViewMenu,{command:{id:o,title:n},group:u===0?"3_sidebar":u===2?"4_auxbar":"5_panel",when:x.has(DSi(e.id)),order:s??Number.MAX_VALUE}))}}return t}registerOpenViewAction(e){let t=new P,o=e.openCommandActionDescriptor?.title??e.name,n=e.openCommandActionDescriptor?.id??`${e.id}.open`,r=this;if(t.add(W(class extends K{constructor(){super({id:n,get title(){let l=r.viewDescriptorService.getViewLocationById(e.id),c=typeof o=="string"?o:o.value,u=typeof o=="string"?o:o.original;return l===0?{value:d(17579,null,c),original:`Show ${u}`}:{value:d(17580,null,c),original:`Toggle ${u}`}},category:We.View,precondition:x.has(`${e.id}.active`),keybinding:e.openCommandActionDescriptor?.keybindings?{...e.openCommandActionDescriptor.keybindings,weight:200}:void 0,f1:e.openCommandActionDescriptor?!0:void 0,metadata:{description:d(17576,null,e.name.value),args:[{name:"options",schema:{type:"object",properties:{preserveFocus:{type:"boolean",default:!1,description:d(17577,null)}}}}]}})}async run(l,c){let u=l.get(Et),p=l.get(Ri),h=l.get(fi),g=l.get(Ft),f=l.get(X);if(Vl.getValue(f)===e.id&&!c?.preserveFocus){let b=p.getViewLocationById(e.id);p.getViewLocationById(e.id)===0?u.activeGroup.focus():b!==null&&h.setPartHidden(!0,r.paneCompositeService.getPartId(b))}else await g.openView(e.id,!c?.preserveFocus)}})),e.openCommandActionDescriptor?.mnemonicTitle){let s=this.viewDescriptorService.getDefaultContainerById(e.id);if(s){let l=this.viewDescriptorService.getDefaultViewContainerLocation(s);t.add(fe.appendMenuItem(D.MenubarViewMenu,{command:{id:n,title:e.openCommandActionDescriptor.mnemonicTitle},group:l===0?"3_sidebar":l===2?"4_auxbar":"5_panel",when:x.has(`${e.id}.active`),order:e.openCommandActionDescriptor.order??Number.MAX_VALUE}))}}return t}registerFocusViewAction(e,t){return W(class extends K{constructor(){let n=L(17575,"Focus on {0} View",e.name.value);super({id:e.focusCommand?e.focusCommand.id:`${e.id}.focus`,title:n,category:t,menu:[{id:D.CommandPalette,when:e.when}],keybinding:{when:x.has(`${e.id}.active`),weight:200,primary:e.focusCommand?.keybindings?.primary,secondary:e.focusCommand?.keybindings?.secondary,linux:e.focusCommand?.keybindings?.linux,mac:e.focusCommand?.keybindings?.mac,win:e.focusCommand?.keybindings?.win},metadata:{description:n.value,args:[{name:"focusOptions",description:"Focus Options",schema:{type:"object",properties:{preserveFocus:{type:"boolean",default:!1}}}}]}})}run(n,r){n.get(Ft).openView(e.id,!r?.preserveFocus)}})}registerResetViewLocationAction(e){return W(class extends K{constructor(){super({id:`${e.id}.resetViewLocation`,title:L(17578,"Reset Location"),menu:[{id:D.ViewTitleContext,when:x.or(x.and(x.equals("view",e.id),x.equals(`${e.id}.defaultViewLocation`,!1))),group:"1_hide",order:2}]})}run(o){let n=o.get(Ri),r=n.getDefaultContainerById(e.id),s=n.getViewContainerModel(r);if(r.hideIfEmpty&&s.visibleViewDescriptors.length===0){let l=n.getDefaultViewContainerLocation(r);n.moveViewContainerToLocation(r,l,void 0,this.desc.id)}n.moveViewsToContainer([e],r,void 0,this.desc.id),o.get(Ft).openView(e.id,!0)}})}registerPaneComposite(e,t){let o=this,n=class extends l_e{constructor(s,l,c,u,p,h,g){super(e.id,s,c,u,p,h,g,l)}createViewPaneContainer(s){let l=this._register(new P),c=o.createViewPaneContainer(s,e,t,l,this.instantiationService);return c instanceof zJ||l.add(H.any(c.onDidAddViews,c.onDidRemoveViews,c.onTitleAreaUpdate)(()=>{this.updateTitleArea()})),c}};n=I([m(0,Te),m(1,Pe),m(2,le),m(3,F),m(4,De),m(5,ze),m(6,lt)],n),oe.as(this.paneCompositeService.getRegistryId(t)).registerPaneComposite(gPt.create(n,e.id,typeof e.title=="string"?e.title:e.title.value,Ae(e.icon)?e.icon:void 0,e.order,e.requestedIndex,e.icon instanceof A?e.icon:void 0))}deregisterPaneComposite(e,t){oe.as(this.paneCompositeService.getRegistryId(t)).deregisterPaneComposite(e.id)}createViewPaneContainer(e,t,o,n,r){let s=r.createInstance(t.ctorDescriptor.ctor,...t.ctorDescriptor.staticArguments||[]);return this.viewPaneContainers.set(s.getId(),s),n.add(Z(()=>this.viewPaneContainers.delete(s.getId()))),n.add(s.onDidAddViews(l=>this.onViewsAdded(l))),n.add(s.onDidChangeViewVisibility(l=>this.onViewsVisibilityChanged(l,l.isBodyVisible()))),n.add(s.onDidRemoveViews(l=>this.onViewsRemoved(l))),n.add(s.onDidFocusView(l=>{this.focusedViewContextKey.get()!==l.id&&(this.focusedViewContextKey.set(l.id),this._onDidChangeFocusedView.fire())})),n.add(s.onDidBlurView(l=>{this.focusedViewContextKey.get()===l.id&&(this.focusedViewContextKey.reset(),this._onDidChangeFocusedView.fire())})),s}};TXe=I([m(0,Ri),m(1,ds),m(2,X),m(3,fi),m(4,ee)],TXe);function DSi(a){return`viewContainer.${a}.enabled`}we(Ft,TXe,0);var KDe=class extends C{constructor(e,t,o){super();this.quickInputService=e;this.instantiationService=t;this.contextKeyService=o;this.registry=oe.as(Tu.Quickaccess);this.mapProviderToDescriptor=new Map;this.lastAcceptedPickerValues=new Map;this.visibleQuickAccess=void 0;this._register(Z(()=>{for(let n of this.mapProviderToDescriptor.values())Ac(n)&&n.dispose();this.visibleQuickAccess?.picker.dispose()}))}pick(e="",t){return this.doShowOrPick(e,!0,t)}show(e="",t){this.doShowOrPick(e,!1,t)}doShowOrPick(e,t,o){let[n,r]=this.getOrInstantiateProvider(e,o?.enabledProviderPrefixes),s=this.visibleQuickAccess,l=s?.descriptor;if(s&&r&&l===r){e!==r.prefix&&!o?.preserveValue&&(s.picker.value=e),this.adjustValueSelection(s.picker,r,o);return}if(r&&!o?.preserveValue){let v;if(s&&l&&l!==r){let b=s.value.substr(l.prefix.length);b&&(v=`${r.prefix}${b}`)}if(!v){let b=n?.defaultFilterValue;b===1?v=this.lastAcceptedPickerValues.get(r):typeof b=="string"&&(v=`${r.prefix}${b}`)}typeof v=="string"&&(e=v)}let c=s?.picker?.valueSelection,u=s?.picker?.value,p=new P,h=p.add(this.quickInputService.createQuickPick({useSeparators:!0}));h.value=e,this.adjustValueSelection(h,r,o),h.placeholder=o?.placeholder??r?.placeholder,h.quickNavigate=o?.quickNavigateConfiguration,h.hideInput=!!h.quickNavigate&&!s,(typeof o?.itemActivation=="number"||o?.quickNavigateConfiguration)&&(h.itemActivation=o?.itemActivation??2),h.contextKey=r?.contextKey,h.filterValue=v=>v.substring(r?r.prefix.length:0);let g;t&&(g=new Go,p.add(H.once(h.onWillAccept)(v=>{v.veto(),h.hide()}))),p.add(this.registerPickerListeners(h,n,r,e,o));let f=p.add(new $e);if(n&&p.add(n.provide(h,f.token,o?.providerOptions)),H.once(h.onDidHide)(()=>{h.selectedItems.length===0&&f.cancel(),p.dispose(),g?.complete(h.selectedItems.slice(0))}),h.show(),c&&u===e&&(h.valueSelection=c),t)return g?.p}adjustValueSelection(e,t,o){let n;o?.preserveValue?n=[e.value.length,e.value.length]:n=[t?.prefix.length??0,e.value.length],e.valueSelection=n}registerPickerListeners(e,t,o,n,r){let s=new P,l=this.visibleQuickAccess={picker:e,descriptor:o,value:n};return s.add(Z(()=>{l===this.visibleQuickAccess&&(this.visibleQuickAccess=void 0)})),s.add(e.onDidChangeValue(c=>{let[u]=this.getOrInstantiateProvider(c,r?.enabledProviderPrefixes);u!==t?this.show(c,{enabledProviderPrefixes:r?.enabledProviderPrefixes,preserveValue:!0,providerOptions:r?.providerOptions}):l.value=c})),o&&s.add(e.onDidAccept(()=>{this.lastAcceptedPickerValues.set(o,e.value)})),s}getOrInstantiateProvider(e,t){let o=this.registry.getQuickAccessProvider(e,this.contextKeyService);if(!o||t&&!t?.includes(o.prefix))return[void 0,void 0];let n=this.mapProviderToDescriptor.get(o);return n||(n=this.instantiationService.createInstance(o.ctor),this.mapProviderToDescriptor.set(o,n)),[n,o]}};KDe=I([m(0,Ge),m(1,F),m(2,X)],KDe);var Y5o=_,_Ft=class extends C{constructor(e,t,o){super();this.parent=e;this._listFocusMode=!1;this.onDidChange=e=>this.findInput.onDidChange(e);this.container=R(this.parent,Y5o(".quick-input-box")),this.findInput=this._register(new _1(this.container,void 0,{label:"",inputBoxStyles:t,toggleStyles:o,actionViewItemProvider:T1(o),hideHoverOnValueChange:!0}))}get onKeyDown(){return this.findInput.onKeyDown}get onMouseDown(){return this.findInput.onMouseDown}get value(){return this.findInput.getValue()}set value(e){this.findInput.setValue(e)}select(e=null){this.findInput.inputBox.select(e)}getSelection(){return this.findInput.inputBox.getSelection()}isSelectionAtEnd(){return this.findInput.inputBox.isSelectionAtEnd()}setPlaceholder(e){this.findInput.inputBox.setPlaceHolder(e)}get placeholder(){return this.findInput.inputBox.inputElement.getAttribute("placeholder")||""}set placeholder(e){this.findInput.inputBox.setPlaceHolder(e)}get password(){return this.findInput.inputBox.inputElement.type==="password"}set password(e){this.findInput.inputBox.inputElement.type=e?"password":"text"}set enabled(e){this.findInput.inputBox.inputElement.toggleAttribute("readonly",!e)}set toggles(e){this.findInput.setAdditionalToggles(e)}set actions(e){this.setActions(e)}setActions(e,t){this.findInput.setActions(e,t)}get ariaLabel(){return this.findInput.inputBox.inputElement.getAttribute("aria-label")||""}set ariaLabel(e){this.findInput.inputBox.inputElement.setAttribute("aria-label",e)}hasFocus(){return this.findInput.inputBox.hasFocus()}setAttribute(e,t){this.findInput.inputBox.inputElement.setAttribute(e,t)}removeAttribute(e){this.findInput.inputBox.inputElement.removeAttribute(e)}setListFocusMode(e){if(this._listFocusMode===e)return;this._listFocusMode=e;let t=this.findInput.inputBox.inputElement;e?(t.setAttribute("aria-haspopup","listbox"),t.setAttribute("aria-autocomplete","list")):(t.removeAttribute("aria-haspopup"),t.removeAttribute("aria-autocomplete"))}showDecoration(e){e===gt.Ignore?this.findInput.clearMessage():this.findInput.showMessage({type:e===gt.Info?1:e===gt.Warning?2:3,content:""})}stylesForType(e){return this.findInput.inputBox.stylesForType(e===gt.Info?1:e===gt.Warning?2:3)}setFocus(){this.findInput.focus()}layout(){this.findInput.inputBox.layout()}};var DK=_,DFt=class{constructor(i,e,t){this.index=i;this.hasCheckbox=e;this._hidden=!1;this._init=new co(()=>{let o=t.label??"",n=IW(o).text.trim(),r=t.ariaLabel||[o,this.saneDescription,this.saneDetail].map(s=>m1(s)).filter(s=>!!s).join(", ");return{saneLabel:o,saneSortLabel:n,saneAriaLabel:r}}),this._saneDescription=t.description,this._saneTooltip=t.tooltip}get saneLabel(){return this._init.value.saneLabel}get saneSortLabel(){return this._init.value.saneSortLabel}get saneAriaLabel(){return this._init.value.saneAriaLabel}get element(){return this._element}set element(i){this._element=i}get hidden(){return this._hidden}set hidden(i){this._hidden=i}get saneDescription(){return this._saneDescription}set saneDescription(i){this._saneDescription=i}get saneDetail(){return this._saneDetail}set saneDetail(i){this._saneDetail=i}get saneTooltip(){return this._saneTooltip}set saneTooltip(i){this._saneTooltip=i}get labelHighlights(){return this._labelHighlights}set labelHighlights(i){this._labelHighlights=i}get descriptionHighlights(){return this._descriptionHighlights}set descriptionHighlights(i){this._descriptionHighlights=i}get detailHighlights(){return this._detailHighlights}set detailHighlights(i){this._detailHighlights=i}},pS=class extends DFt{constructor(e,t,o,n,r,s,l){super(e,o,s);this.childIndex=t;this.fireButtonTriggered=n;this._onChecked=r;this.item=s;this._separator=l;this._checked=!1;this.onChecked=o?H.map(H.filter(this._onChecked.event,c=>c.element===this),c=>c.checked):H.None,this._saneDetail=s.detail,this._labelHighlights=s.highlights?.label,this._descriptionHighlights=s.highlights?.description,this._detailHighlights=s.highlights?.detail}get separator(){return this._separator}set separator(e){this._separator=e}get checked(){return this._checked}set checked(e){e!==this._checked&&(this._checked=e,this._onChecked.fire({element:this,checked:e}))}get checkboxDisabled(){return!!this.item.disabled}};var h4=class extends DFt{constructor(e,t,o){super(e,!1,o);this.fireSeparatorButtonTriggered=t;this.separator=o;this.children=new Array;this.focusInsideSeparator=0}},LSi=class{getHeight(i){return i instanceof h4?30:i.saneDetail?44:22}getTemplateId(i){return i instanceof pS?GJ.ID:$J.ID}},RSi=class{getWidgetAriaLabel(){return d(2248,null)}getAriaLabel(i){return i.separator?.label?`${i.saneAriaLabel}, ${i.separator.label}`:i.saneAriaLabel}getWidgetRole(){return"listbox"}getRole(i){return i.hasCheckbox?"checkbox":"option"}isChecked(i){if(!(!i.hasCheckbox||!(i instanceof pS)))return{get value(){return i.checked},onDidChange:e=>i.onChecked(()=>e())}}},LFt=class{constructor(i,e,t){this.hoverDelegate=i;this.toggleStyles=e;this.contextMenuService=t}renderTemplate(i){let e=Object.create(null);e.toDisposeElement=new P,e.toDisposeTemplate=new P,e.entry=R(i,DK(".quick-input-list-entry"));let t=R(e.entry,DK("label.quick-input-list-label"));e.outerLabel=t,e.checkbox=e.toDisposeTemplate.add(new me),e.toDisposeTemplate.add(Vo(t,re.CLICK,c=>{if(e.checkbox.value&&!c.defaultPrevented&&e.checkbox.value.enabled){let u=!e.checkbox.value.checked;e.checkbox.value.checked=u,e.element.checked=u}}));let o=R(t,DK(".quick-input-list-rows")),n=R(o,DK(".quick-input-list-row")),r=R(o,DK(".quick-input-list-row"));e.label=new Lc(n,{supportHighlights:!0,supportDescriptionHighlights:!0,supportIcons:!0,hoverDelegate:this.hoverDelegate}),e.toDisposeTemplate.add(e.label),e.icon=Sf(e.label.element,DK(".quick-input-list-icon"));let s=R(n,DK(".quick-input-list-entry-keybinding"));e.keybinding=new ah(s,zo),e.toDisposeTemplate.add(e.keybinding);let l=R(r,DK(".quick-input-list-label-meta"));return e.detail=new Lc(l,{supportHighlights:!0,supportIcons:!0,hoverDelegate:this.hoverDelegate}),e.toDisposeTemplate.add(e.detail),e.separator=R(e.entry,DK(".quick-input-list-separator")),e.toolBar=new Ju(e.entry,this.contextMenuService,{...this.hoverDelegate?{hoverDelegate:this.hoverDelegate}:void 0,actionViewItemProvider:T1(this.toggleStyles),icon:!0,label:!1}),e.toolBar.getElement().classList.add("quick-input-list-entry-action-bar"),e.toDisposeTemplate.add(e.toolBar),e}disposeTemplate(i){i.toDisposeElement.dispose(),i.toDisposeTemplate.dispose()}disposeElement(i,e,t){t.toDisposeElement.clear(),t.toolBar.setActions([])}},GJ=class extends LFt{constructor(e,t,o,n){super(e,t,o);this.themeService=n;this._itemsWithSeparatorsFrequency=new Map}static{this.ID="quickpickitem"}get templateId(){return GJ.ID}ensureCheckbox(e,t){if(!e.hasCheckbox){t.checkbox.value?.domNode.remove(),t.checkbox.clear();return}let o=t.checkbox.value;o?o.setTitle(e.saneLabel):(o=new hv(e.saneLabel,e.checked,{...kf,size:15}),t.checkbox.value=o,t.outerLabel.prepend(o.domNode),o.domNode.tabIndex=-1),e.checkboxDisabled?o.disable():o.enable(),o.checked=e.checked,t.toDisposeElement.add(e.onChecked(n=>o.checked=n)),t.toDisposeElement.add(o.onChange(()=>e.checked=o.checked))}renderElement(e,t,o){let n=e.element;o.element=n,n.element=o.entry??void 0;let r=n.item;n.element.classList.toggle("not-pickable",n.item.pickable===!1),this.ensureCheckbox(n,o);let{labelHighlights:s,descriptionHighlights:l,detailHighlights:c}=n;if(r.iconPath){let g=Ip(this.themeService.getColorTheme().type)?r.iconPath.dark:r.iconPath.light??r.iconPath.dark,f=A.revive(g);o.icon.className="quick-input-list-icon",o.icon.style.backgroundImage=Na(f)}else o.icon.style.backgroundImage="",o.icon.className=r.iconClass?`quick-input-list-icon ${r.iconClass}`:"";let u;!n.saneTooltip&&n.saneDescription&&(u={markdown:{value:ur(n.saneDescription),supportThemeIcons:!0},markdownNotSupportedFallback:n.saneDescription});let p={matches:s||[],descriptionTitle:u,descriptionMatches:l||[],labelEscapeNewLines:!0};if(p.extraClasses=r.iconClasses,p.italic=r.italic,p.strikethrough=r.strikethrough,o.entry.classList.remove("quick-input-list-separator-as-item"),o.label.setLabel(n.saneLabel,n.saneDescription,p),o.keybinding.set(r.keybinding),n.saneDetail){let g;n.saneTooltip||(g={markdown:{value:ur(n.saneDetail),supportThemeIcons:!0},markdownNotSupportedFallback:n.saneDetail}),o.detail.element.style.display="",o.detail.setLabel(n.saneDetail,void 0,{matches:c,title:g,labelEscapeNewLines:!0})}else o.detail.element.style.display="none";n.separator?.label?(o.separator.textContent=n.separator.label,o.separator.style.display="",this.addItemWithSeparator(n)):o.separator.style.display="none",o.entry.classList.toggle("quick-input-list-separator-border",!!n.separator&&n.childIndex!==0);let h=r.buttons;if(h&&h.length){let{primary:g,secondary:f}=X5(h,"quick-input-item",v=>n.fireButtonTriggered({button:v,item:n.item}));o.toolBar.setActions(g,f),o.entry.classList.add("has-actions")}else o.toolBar.setActions([]),o.entry.classList.remove("has-actions")}disposeElement(e,t,o){this.removeItemWithSeparator(e.element),super.disposeElement(e,t,o)}isItemWithSeparatorVisible(e){return this._itemsWithSeparatorsFrequency.has(e)}addItemWithSeparator(e){this._itemsWithSeparatorsFrequency.set(e,(this._itemsWithSeparatorsFrequency.get(e)||0)+1)}removeItemWithSeparator(e){let t=this._itemsWithSeparatorsFrequency.get(e)||0;t>1?this._itemsWithSeparatorsFrequency.set(e,t-1):this._itemsWithSeparatorsFrequency.delete(e)}};GJ=I([m(2,ze),m(3,De)],GJ);var $J=class extends LFt{constructor(e,t,o){super(e,t,o);this._visibleSeparatorsFrequency=new Map}static{this.ID="quickpickseparator"}get templateId(){return $J.ID}get visibleSeparators(){return[...this._visibleSeparatorsFrequency.keys()]}isSeparatorVisible(e){return this._visibleSeparatorsFrequency.has(e)}renderElement(e,t,o){let n=e.element;o.element=n,n.element=o.entry??void 0,n.element.classList.toggle("focus-inside",!!n.focusInsideSeparator);let r=n.separator,{labelHighlights:s,descriptionHighlights:l}=n;o.icon.style.backgroundImage="",o.icon.className="";let c;!n.saneTooltip&&n.saneDescription&&(c={markdown:{value:ur(n.saneDescription),supportThemeIcons:!0},markdownNotSupportedFallback:n.saneDescription});let u={matches:s||[],descriptionTitle:c,descriptionMatches:l||[],labelEscapeNewLines:!0};o.entry.classList.add("quick-input-list-separator-as-item"),o.label.setLabel(n.saneLabel,n.saneDescription,u),o.separator.style.display="none",o.entry.classList.add("quick-input-list-separator-border");let p=r.buttons;if(p&&p.length){let{primary:h,secondary:g}=X5(p,"quick-input-separator",f=>n.fireSeparatorButtonTriggered({button:f,separator:n.separator}));o.toolBar.setActions(h,g),o.entry.classList.add("has-actions")}else o.toolBar.setActions([]),o.entry.classList.remove("has-actions");this.addSeparator(n)}disposeElement(e,t,o){this.removeSeparator(e.element),this.isSeparatorVisible(e.element)||e.element.element?.classList.remove("focus-inside"),super.disposeElement(e,t,o)}addSeparator(e){this._visibleSeparatorsFrequency.set(e,(this._visibleSeparatorsFrequency.get(e)||0)+1)}removeSeparator(e){let t=this._visibleSeparatorsFrequency.get(e)||0;t>1?this._visibleSeparatorsFrequency.set(e,t-1):this._visibleSeparatorsFrequency.delete(e)}};$J=I([m(2,ze)],$J);var KJ=class extends C{constructor(e,t,o,n,r,s,l){super();this.parent=e;this.hoverDelegate=t;this.linkOpenerDelegate=o;this.styles=r;this.accessibilityService=l;this._onKeyDown=this._register(new E);this.onKeyDown=this._onKeyDown.event;this._onLeave=this._register(new E);this.onLeave=this._onLeave.event;this._visibleCountObservable=Le("VisibleCount",0);this.onChangedVisibleCount=H.fromObservable(this._visibleCountObservable,this._store);this._allVisibleCheckedObservable=Le("AllVisibleChecked",!1);this.onChangedAllVisibleChecked=H.fromObservable(this._allVisibleCheckedObservable,this._store);this._checkedCountObservable=Le("CheckedCount",0);this.onChangedCheckedCount=H.fromObservable(this._checkedCountObservable,this._store);this._checkedElementsObservable=rg({equalsFn:$i},new Array);this.onChangedCheckedElements=H.fromObservable(this._checkedElementsObservable,this._store);this._onButtonTriggered=this._register(new E);this.onButtonTriggered=this._onButtonTriggered.event;this._onSeparatorButtonTriggered=this._register(new E);this.onSeparatorButtonTriggered=this._onSeparatorButtonTriggered.event;this._elementChecked=this._register(new E);this._elementCheckedEventBufferer=new eN;this._hasCheckboxes=!1;this._inputElements=new Array;this._elementTree=new Array;this._itemElements=new Array;this._elementDisposable=this._register(new P);this._matchOnDescription=!1;this._matchOnDetail=!1;this._matchOnLabel=!0;this._matchOnLabelMode="fuzzy";this._matchOnMeta=!0;this._sortByLabel=!0;this._shouldLoop=!0;this._container=R(this.parent,DK(".quick-input-list")),this._separatorRenderer=s.createInstance($J,t,this.styles.toggle),this._itemRenderer=s.createInstance(GJ,t,this.styles.toggle),this._tree=this._register(s.createInstance(mg,"QuickInput",this._container,new LSi,[this._itemRenderer,this._separatorRenderer],{filter:{filter(c){return c.hidden?0:c instanceof h4?2:1}},sorter:{compare:(c,u)=>{if(!this.sortByLabel||!this._lastQueryString)return 0;let p=this._lastQueryString.toLowerCase();return J5o(c,u,p)}},accessibilityProvider:new RSi,setRowLineHeight:!1,multipleSelectionSupport:!1,hideTwistiesOfChildlessElements:!0,renderIndentGuides:"none",findWidgetEnabled:!1,indent:0,horizontalScrolling:!1,allowNonCollapsibleParents:!0,alwaysConsumeMouseWheel:!0})),this._tree.getHTMLElement().id=n,this._registerListeners()}get onDidChangeFocus(){return H.map(this._tree.onDidChangeFocus,e=>e.elements.filter(t=>t instanceof pS).map(t=>t.item),this._store)}get onDidChangeSelection(){return H.map(this._tree.onDidChangeSelection,e=>({items:e.elements.filter(t=>t instanceof pS).map(t=>t.item),event:e.browserEvent}),this._store)}get displayed(){return this._container.style.display!=="none"}set displayed(e){this._container.style.display=e?"":"none"}get scrollTop(){return this._tree.scrollTop}set scrollTop(e){this._tree.scrollTop=e}get ariaLabel(){return this._tree.ariaLabel}set ariaLabel(e){this._tree.ariaLabel=e??""}set enabled(e){this._tree.getHTMLElement().style.pointerEvents=e?"":"none"}get matchOnDescription(){return this._matchOnDescription}set matchOnDescription(e){this._matchOnDescription=e}get matchOnDetail(){return this._matchOnDetail}set matchOnDetail(e){this._matchOnDetail=e}get matchOnLabel(){return this._matchOnLabel}set matchOnLabel(e){this._matchOnLabel=e}get matchOnLabelMode(){return this._matchOnLabelMode}set matchOnLabelMode(e){this._matchOnLabelMode=e}get matchOnMeta(){return this._matchOnMeta}set matchOnMeta(e){this._matchOnMeta=e}get sortByLabel(){return this._sortByLabel}set sortByLabel(e){this._sortByLabel=e}get shouldLoop(){return this._shouldLoop}set shouldLoop(e){this._shouldLoop=e}_registerListeners(){this._registerOnContainerClick(),this._registerOnMouseMiddleClick(),this._registerOnTreeModelChanged(),this._registerOnElementChecked(),this._registerOnContextMenu(),this._registerHoverListeners(),this._registerSelectionChangeListener(),this._registerSeparatorActionShowingListeners()}_registerOnContainerClick(){this._register(j(this._container,re.CLICK,e=>{(e.x||e.y)&&this._onLeave.fire()}))}_registerOnMouseMiddleClick(){this._register(j(this._container,re.AUXCLICK,e=>{e.button===1&&this._onLeave.fire()}))}_registerOnTreeModelChanged(){this._register(this._tree.onDidChangeModel(()=>{let e=this._itemElements.filter(t=>!t.hidden).length;this._visibleCountObservable.set(e,void 0),this._hasCheckboxes&&this._updateCheckedObservables()}))}_registerOnElementChecked(){this._register(this._elementCheckedEventBufferer.wrapEvent(this._elementChecked.event,(e,t)=>t)(e=>this._updateCheckedObservables()))}_registerOnContextMenu(){this._register(this._tree.onContextMenu(e=>{e.element&&(e.browserEvent.preventDefault(),this._tree.setSelection([e.element]))}))}_registerHoverListeners(){let e=this._register(new ya(typeof this.hoverDelegate.delay=="function"?this.hoverDelegate.delay():this.hoverDelegate.delay));this._register(this._tree.onMouseOver(async t=>{if(n7t(t.browserEvent.target)){e.cancel();return}if(!(!n7t(t.browserEvent.relatedTarget)&&gs(t.browserEvent.relatedTarget,t.element?.element)))try{await e.trigger(async()=>{t.element instanceof pS&&this.showHover(t.element)})}catch(o){if(!so(o))throw o}})),this._register(this._tree.onMouseOut(t=>{gs(t.browserEvent.relatedTarget,t.element?.element)||e.cancel()}))}_registerSeparatorActionShowingListeners(){this._register(this._tree.onDidChangeFocus(e=>{let t=e.elements[0]?this._tree.getParentElement(e.elements[0]):null;for(let o of this._separatorRenderer.visibleSeparators){let n=o===t;!!(o.focusInsideSeparator&2)!==n&&(n?o.focusInsideSeparator|=2:o.focusInsideSeparator&=-3,this._tree.rerender(o))}})),this._register(this._tree.onMouseOver(e=>{let t=e.element?this._tree.getParentElement(e.element):null;for(let o of this._separatorRenderer.visibleSeparators){if(o!==t)continue;o.focusInsideSeparator&1||(o.focusInsideSeparator|=1,this._tree.rerender(o))}})),this._register(this._tree.onMouseOut(e=>{let t=e.element?this._tree.getParentElement(e.element):null;for(let o of this._separatorRenderer.visibleSeparators){if(o!==t)continue;o.focusInsideSeparator&1&&(o.focusInsideSeparator&=-2,this._tree.rerender(o))}}))}_registerSelectionChangeListener(){this._register(this._tree.onDidChangeSelection(e=>{let t=e.elements.filter(o=>o instanceof pS);t.length!==e.elements.length&&(e.elements.length===1&&e.elements[0]instanceof h4&&(this._tree.setFocus([e.elements[0].children[0]]),this._tree.reveal(e.elements[0],0)),this._tree.setSelection(t))}))}setAllVisibleChecked(e){this._elementCheckedEventBufferer.bufferEvents(()=>{this._itemElements.forEach(t=>{!t.hidden&&!t.checkboxDisabled&&t.item.pickable!==!1&&(t.checked=e)})})}setElements(e){this._elementDisposable.clear(),this._lastQueryString=void 0,this._inputElements=e,this._hasCheckboxes=this.parent.classList.contains("show-checkboxes");let t;this._itemElements=new Array,this._elementTree=e.reduce((o,n,r)=>{let s;if(n.type==="separator"){if(!n.buttons)return o;t=new h4(r,l=>this._onSeparatorButtonTriggered.fire(l),n),s=t}else{let l=r>0?e[r-1]:void 0,c;l&&l.type==="separator"&&!l.buttons&&(c=l);let u=new pS(r,t?.children?t.children.length:r,this._hasCheckboxes&&n.pickable!==!1,p=>this._onButtonTriggered.fire(p),this._elementChecked,n,c);if(this._itemElements.push(u),t)return t.children.push(u),o;s=u}return o.push(s),o},new Array),this._setElementsToTree(this._elementTree),this.accessibilityService.isScreenReaderOptimized()&&setTimeout(()=>{let o=this._tree.getHTMLElement().querySelector(".monaco-list-row.focused"),n=o?.parentNode;if(o&&n){let r=o.nextSibling;o.remove(),n.insertBefore(o,r)}},0)}setFocusedElements(e){let t=e.map(o=>this._itemElements.find(n=>n.item===o)).filter(o=>!!o).filter(o=>!o.hidden);if(this._tree.setFocus(t),e.length>0){let o=this._tree.getFocus()[0];o&&this._tree.reveal(o)}}getActiveDescendant(){return this._tree.getHTMLElement().getAttribute("aria-activedescendant")}setSelectedElements(e){let t=e.map(o=>this._itemElements.find(n=>n.item===o)).filter(o=>!!o);this._tree.setSelection(t)}getCheckedElements(){return this._itemElements.filter(e=>e.checked).map(e=>e.item)}setCheckedElements(e){this._elementCheckedEventBufferer.bufferEvents(()=>{let t=new Set;for(let o of e)t.add(o);for(let o of this._itemElements)o.checked=t.has(o.item)})}focus(e){if(this._itemElements.length)switch(e===2&&this._itemElements.length<2&&(e=1),e){case 1:this._tree.scrollTop=0,this._tree.focusFirst(void 0,t=>t.element instanceof pS);break;case 2:{this._tree.scrollTop=0;let t=!1;this._tree.focusFirst(void 0,o=>o.element instanceof pS?t?!0:(t=!t,!1):!1);break}case 3:this._tree.scrollTop=this._tree.scrollHeight,this._tree.focusLast(void 0,t=>t.element instanceof pS);break;case 4:{let t=this._tree.getFocus();this._tree.focusNext(void 0,this._shouldLoop,void 0,n=>n.element instanceof pS?(this._tree.reveal(n.element),!0):!1);let o=this._tree.getFocus();t.length&&t[0]===o[0]&&this._onLeave.fire();break}case 5:{let t=this._tree.getFocus();this._tree.focusPrevious(void 0,this._shouldLoop,void 0,n=>{if(!(n.element instanceof pS))return!1;let r=this._tree.getParentElement(n.element);return r===null||r.children[0]!==n.element?this._tree.reveal(n.element):this._tree.reveal(r),!0});let o=this._tree.getFocus();t.length&&t[0]===o[0]&&this._onLeave.fire();break}case 6:this._tree.focusNextPage(void 0,t=>t.element instanceof pS?(this._tree.reveal(t.element),!0):!1);break;case 7:this._tree.focusPreviousPage(void 0,t=>{if(!(t.element instanceof pS))return!1;let o=this._tree.getParentElement(t.element);return o===null||o.children[0]!==t.element?this._tree.reveal(t.element):this._tree.reveal(o),!0});break;case 8:{let t=!1,o=this._tree.getFocus()[0];this._tree.focusNext(void 0,!0,void 0,r=>{if(t)return!0;if(r.element instanceof h4)t=!0,this._separatorRenderer.isSeparatorVisible(r.element)?this._tree.reveal(r.element.children[0]):this._tree.reveal(r.element,0);else if(r.element instanceof pS){if(r.element.separator)return this._itemRenderer.isItemWithSeparatorVisible(r.element)?this._tree.reveal(r.element):this._tree.reveal(r.element,0),!0;if(r.element===this._elementTree[0])return this._tree.reveal(r.element,0),!0}return!1});let n=this._tree.getFocus()[0];o===n&&(this._tree.scrollTop=this._tree.scrollHeight,this._tree.focusLast(void 0,r=>r.element instanceof pS));break}case 9:{let t,o=!!this._tree.getFocus()[0]?.separator;this._tree.focusPrevious(void 0,!0,void 0,n=>{if(n.element instanceof h4)o?t||(this._separatorRenderer.isSeparatorVisible(n.element)?this._tree.reveal(n.element):this._tree.reveal(n.element,0),t=n.element.children[0]):o=!0;else if(n.element instanceof pS&&!t){if(n.element.separator)this._itemRenderer.isItemWithSeparatorVisible(n.element)?this._tree.reveal(n.element):this._tree.reveal(n.element,0),t=n.element;else if(n.element===this._elementTree[0])return this._tree.reveal(n.element,0),!0}return!1}),t&&this._tree.setFocus([t]);break}}}clearFocus(){this._tree.setFocus([])}domFocus(){this._tree.domFocus()}layout(e){this._tree.getHTMLElement().style.maxHeight=e?`${Math.floor(e/44)*44+6}px`:"",this._tree.layout()}filter(e){if(this._lastQueryString=e,!(this._sortByLabel||this._matchOnLabel||this._matchOnDescription||this._matchOnDetail))return this._tree.layout(),!1;let t=e;if(e=e.trim(),!e||!(this.matchOnLabel||this.matchOnDescription||this.matchOnDetail))this._itemElements.forEach(o=>{o.labelHighlights=void 0,o.descriptionHighlights=void 0,o.detailHighlights=void 0,o.hidden=!1;let n=o.index&&this._inputElements[o.index-1];o.item&&(o.separator=n&&n.type==="separator"&&!n.buttons?n:void 0)});else{let o;this._itemElements.forEach(n=>{let r;this.matchOnLabelMode==="fuzzy"?r=this.matchOnLabel?gq(e,IW(n.saneLabel))??void 0:void 0:r=this.matchOnLabel?X5o(t,IW(n.saneLabel))??void 0:void 0;let s=this.matchOnDescription?gq(e,IW(n.saneDescription||""))??void 0:void 0,l=this.matchOnDetail?gq(e,IW(n.saneDetail||""))??void 0:void 0;if(r||s||l?(n.labelHighlights=r,n.descriptionHighlights=s,n.detailHighlights=l,n.hidden=!1):(n.labelHighlights=void 0,n.descriptionHighlights=void 0,n.detailHighlights=void 0,n.hidden=n.item?!n.item.alwaysShow:!0),n.item?n.separator=void 0:n.separator&&(n.hidden=!0),!this.sortByLabel){let c=n.index&&this._inputElements[n.index-1]||void 0;c?.type==="separator"&&!c.buttons&&(o=c),o&&!n.hidden&&(n.separator=o,o=void 0)}})}return this._setElementsToTree(this._sortByLabel&&e?this._itemElements:this._elementTree),this._tree.layout(),!0}toggleCheckbox(){this._elementCheckedEventBufferer.bufferEvents(()=>{let e=this._tree.getFocus().filter(o=>o instanceof pS),t=this._allVisibleChecked(e);for(let o of e)o.checkboxDisabled||(o.checked=!t)})}style(e){this._tree.style(e)}toggleHover(){let e=this._tree.getFocus()[0];if(!e?.saneTooltip||!(e instanceof pS))return;if(this._lastHover&&!this._lastHover.isDisposed){this._lastHover.dispose();return}this.showHover(e);let t=new P;t.add(this._tree.onDidChangeFocus(o=>{o.elements[0]instanceof pS&&this.showHover(o.elements[0])})),this._lastHover&&t.add(this._lastHover),this._elementDisposable.add(t)}_setElementsToTree(e){let t=new Array;for(let o of e)o instanceof h4?t.push({element:o,collapsible:!1,collapsed:!1,children:o.children.map(n=>({element:n,collapsible:!1,collapsed:!1}))}):t.push({element:o,collapsible:!1,collapsed:!1});this._tree.setChildren(null,t)}_allVisibleChecked(e,t=!0){for(let o=0,n=e.length;o<n;o++){let r=e[o];if(!r.hidden&&r.item.pickable!==!1)if(r.checked)t=!0;else return!1}return t}_updateCheckedObservables(){Ui(e=>{this._allVisibleCheckedObservable.set(this._allVisibleChecked(this._itemElements,!1),e);let t=this._itemElements.filter(o=>o.checked).length;this._checkedCountObservable.set(t,e),this._checkedElementsObservable.set(this.getCheckedElements(),e)})}showHover(e){this._lastHover&&!this._lastHover.isDisposed&&(this.hoverDelegate.onDidHideHover?.(),this._lastHover?.dispose()),!(!e.element||!e.saneTooltip)&&(this._lastHover=this.hoverDelegate.showHover({content:e.saneTooltip,target:e.element,linkHandler:t=>{this.linkOpenerDelegate(t)},appearance:{showPointer:!0},container:this._container,position:{hoverPosition:1}},!1))}};I([mi],KJ.prototype,"onDidChangeFocus",1),I([mi],KJ.prototype,"onDidChangeSelection",1),KJ=I([m(5,F),m(6,Bi)],KJ);function X5o(a,i){let{text:e,iconOffsets:t}=i;if(!t||t.length===0)return Hro(a,e);let o=Hw(e," "),n=e.length-o.length,r=Hro(a,o);if(r)for(let s of r){let l=t[s.start+n]+n;s.start+=l,s.end+=l}return r}function Hro(a,i){let e=i.toLowerCase().indexOf(a.toLowerCase());return e!==-1?[{start:e,end:e+a.length}]:null}function J5o(a,i,e){let t=a.labelHighlights||[],o=i.labelHighlights||[];return t.length&&!o.length?-1:!t.length&&o.length?1:t.length===0&&o.length===0?0:p_e(a.saneSortLabel,i.saneSortLabel,e)}function Z5o(a,i={}){yt.registerCommandAndKeybindingRule({weight:200,when:G_e,metadata:{description:d(2237,null)},...a,secondary:MSi(a.primary,a.secondary??[],i)})}function pk(a,i={}){yt.registerCommandAndKeybindingRule({weight:200,when:x.and(x.or(x.equals(kJ,"quickPick"),x.equals(kJ,"quickTree")),G_e),metadata:{description:d(2240,null)},...a,secondary:MSi(a.primary,a.secondary??[],i)})}var _Xe=it?256:2048;function MSi(a,i,e={}){return e.withAltMod&&i.push(512+a),e.withCtrlMod&&(i.push(_Xe+a),e.withAltMod&&i.push(512+_Xe+a)),e.withCmdMod&&it&&(i.push(2048+a),e.withCtrlMod&&i.push(2304+a),e.withAltMod&&(i.push(2560+a),e.withCtrlMod&&i.push(2816+a))),i}function DR(a,i){return e=>{let t=e.get(Ge).currentQuickInput;if(t)return i&&t.quickNavigate?t.focus(i):t.focus(a)}}pk({id:"quickInput.pageNext",primary:12,handler:DR(6)},{withAltMod:!0,withCtrlMod:!0,withCmdMod:!0});pk({id:"quickInput.pagePrevious",primary:11,handler:DR(7)},{withAltMod:!0,withCtrlMod:!0,withCmdMod:!0});pk({id:"quickInput.first",primary:_Xe+14,handler:DR(1)},{withAltMod:!0,withCmdMod:!0});pk({id:"quickInput.last",primary:_Xe+13,handler:DR(3)},{withAltMod:!0,withCmdMod:!0});pk({id:"quickInput.next",primary:18,handler:DR(4)},{withCtrlMod:!0});pk({id:"quickInput.previous",primary:16,handler:DR(5)},{withCtrlMod:!0});var Uro=d(2238,null),zro=d(2239,null);it?(pk({id:"quickInput.nextSeparatorWithQuickAccessFallback",primary:2066,handler:DR(8,4),metadata:{description:Uro}}),pk({id:"quickInput.nextSeparator",primary:2578,secondary:[2322],handler:DR(8)},{withCtrlMod:!0}),pk({id:"quickInput.previousSeparatorWithQuickAccessFallback",primary:2064,handler:DR(9,5),metadata:{description:zro}}),pk({id:"quickInput.previousSeparator",primary:2576,secondary:[2320],handler:DR(9)},{withCtrlMod:!0})):(pk({id:"quickInput.nextSeparatorWithQuickAccessFallback",primary:530,handler:DR(8,4),metadata:{description:Uro}}),pk({id:"quickInput.nextSeparator",primary:2578,handler:DR(8)}),pk({id:"quickInput.previousSeparatorWithQuickAccessFallback",primary:528,handler:DR(9,5),metadata:{description:zro}}),pk({id:"quickInput.previousSeparator",primary:2576,handler:DR(9)}));yt.registerCommandAndKeybindingRule({id:"quickInput.accept",primary:3,weight:200,when:x.and(x.notEquals(kJ,"quickWidget"),G_e,x.not("isComposing")),metadata:{description:d(2236,null)},handler:a=>{a.get(Ge).currentQuickInput?.accept()},secondary:MSi(3,[],{withAltMod:!0,withCtrlMod:!0,withCmdMod:!0})});pk({id:"quickInput.acceptInBackground",when:x.and(G_e,x.equals(kJ,"quickPick"),x.or($h.negate(),ono)),primary:17,weight:250,handler:a=>{a.get(Ge).currentQuickInput?.accept(!0)}},{withAltMod:!0,withCtrlMod:!0,withCmdMod:!0});Z5o({id:"quickInput.hide",primary:9,handler:a=>{a.get(Ge).currentQuickInput?.hide()}},{withAltMod:!0,withCtrlMod:!0,withCmdMod:!0});pk({id:"quickInput.toggleCheckbox",when:x.and(G_e,x.or(x.equals(kJ,"quickPick"),x.equals(kJ,"quickTree")),$h.negate()),primary:10,handler:a=>{a.get(Ge).toggle()}});pk({id:"quickInput.toggleHover",primary:_Xe|10,handler:a=>{a.get(Ge).toggleHover()}});var DXe=_,RFt=class extends C{constructor(){super(...arguments);this._onDidChangeCheckboxState=this._register(new E);this.onDidChangeCheckboxState=this._onDidChangeCheckboxState.event}setCheckboxState(e,t){this._onDidChangeCheckboxState.fire({item:e,checked:t})}},LK=class extends C{constructor(e,t,o,n,r,s,l){super();this._hoverDelegate=e;this._buttonTriggeredEmitter=t;this.onCheckedEvent=o;this._checkboxStateHandler=n;this._toggleStyles=r;this._contextMenuService=s;this._themeService=l;this.templateId=LK.ID}static{this.ID="quickInputTreeElement"}renderTemplate(e){let t=new P,o=R(e,DXe(".quick-input-tree-entry")),n=t.add(new v7("",!1,{...kf,size:15}));o.appendChild(n.domNode);let r=R(o,DXe("label.quick-input-tree-label")),s=R(r,DXe(".quick-input-tree-rows")),l=R(s,DXe(".quick-input-tree-row")),c=Sf(l,DXe(".quick-input-tree-icon")),u=t.add(new Lc(l,{supportHighlights:!0,supportDescriptionHighlights:!0,supportIcons:!0,hoverDelegate:this._hoverDelegate})),p=t.add(new Ju(o,this._contextMenuService,{actionViewItemProvider:T1(this._toggleStyles),hoverDelegate:this._hoverDelegate,icon:!0,label:!1}));return p.getElement().classList.add("quick-input-tree-entry-action-bar"),{toDisposeTemplate:t,entry:o,checkbox:n,icon:c,label:u,actionBar:p,toDisposeElement:new P}}renderElement(e,t,o,n){let r=o.toDisposeElement,s=e.element;if(s.pickable===!1)o.checkbox.domNode.style.display="none";else{let h=o.checkbox;h.domNode.style.display="",h.checked=s.checked??!1,r.add(H.filter(this.onCheckedEvent,g=>g.item===s)(g=>h.checked=g.checked)),s.disabled&&h.disable(),r.add(h.onChange(g=>this._checkboxStateHandler.setCheckboxState(s,h.checked)))}if(s.iconPath){let h=Ip(this._themeService.getColorTheme().type)?s.iconPath.dark:s.iconPath.light??s.iconPath.dark,g=A.revive(h);o.icon.className="quick-input-tree-icon",o.icon.style.backgroundImage=Na(g)}else o.icon.style.backgroundImage="",o.icon.className=s.iconClass?`quick-input-tree-icon ${s.iconClass}`:"";let{labelHighlights:l,descriptionHighlights:c}=e.filterData||{},u;s.description&&(u={markdown:{value:ur(s.description),supportThemeIcons:!0},markdownNotSupportedFallback:s.description}),o.label.setLabel(s.label,s.description,{matches:l,descriptionMatches:c,extraClasses:s.iconClasses,italic:s.italic,strikethrough:s.strikethrough,labelEscapeNewLines:!0,descriptionTitle:u});let p=s.buttons;if(p&&p.length){let{primary:h,secondary:g}=X5(p,"quick-input-tree",f=>this._buttonTriggeredEmitter.fire({item:s,button:f}));o.actionBar.setActions(h,g),o.entry.classList.add("has-actions")}else o.actionBar.setActions([]),o.entry.classList.remove("has-actions")}disposeElement(e,t,o,n){o.toDisposeElement.clear(),o.actionBar.setActions([])}disposeTemplate(e){e.toDisposeElement.dispose(),e.toDisposeTemplate.dispose()}};LK=I([m(5,ze),m(6,De)],LK);var MFt=class{getHeight(i){return 22}getTemplateId(i){return LK.ID}};function $De(a){let i=!1,e=!1,t=!1;for(let n of a){switch(n.element?.checked){case"mixed":t=!0;break;case!0:i=!0;break;default:e=!0;break}if(i&&e&&t)break}return e?t||i?"mixed":!1:t?"mixed":i}var PFt=class{constructor(i){this.onCheckedEvent=i}getWidgetAriaLabel(){return d(2253,null)}getAriaLabel(i){return i.ariaLabel||[i.label,i.description].map(e=>m1(e)).filter(e=>!!e).join(", ")}getWidgetRole(){return"tree"}getRole(i){return"checkbox"}isChecked(i){return{get value(){return i.checked==="mixed"?"mixed":!!i.checked},onDidChange:e=>H.filter(this.onCheckedEvent,t=>t.item===i)(t=>e())}}};var AFt=class{constructor(){this.filterValue="";this.matchOnLabel=!0;this.matchOnDescription=!1}filter(i,e){if(!this.filterValue||!(this.matchOnLabel||this.matchOnDescription))return i.children?{visibility:2,data:{}}:{visibility:1,data:{}};let t=this.matchOnLabel?gq(this.filterValue,IW(i.label))??void 0:void 0,o=this.matchOnDescription?gq(this.filterValue,IW(i.description||""))??void 0:void 0;return{visibility:e===1?1:t||o?1:i.children?2:0,data:{labelHighlights:t,descriptionHighlights:o}}}};var NFt=class extends C{constructor(){super(...arguments);this._sortByLabel=!0}get sortByLabel(){return this._sortByLabel}set sortByLabel(e){this._sortByLabel=e}compare(e,t){if(!this._sortByLabel)return 0;if(e.label<t.label)return-1;if(e.label>t.label)return 1;if(e.description&&t.description){if(e.description<t.description)return-1;if(e.description>t.description)return 1}else{if(e.description)return-1;if(t.description)return 1}return 0}};var e4o=_,t4o="quick-input-tree-flat",PSi=class{constructor(){this._elementIds=new WeakMap;this._counter=0}getId(i){let e=i.id;return e!==void 0||(e=this._elementIds.get(i),e!==void 0)||(e=`__generated_${this._counter++}`,this._elementIds.set(i,e)),e}},qDe=class extends C{constructor(e,t,o,n){super();this.instantiationService=n;this._onDidTriggerButton=this._register(new E);this.onDidTriggerButton=this._onDidTriggerButton.event;this._onDidChangeCheckboxState=this._register(new E);this.onDidChangeCheckboxState=this._onDidChangeCheckboxState.event;this._onDidCheckedLeafItemsChange=this._register(new E);this.onDidChangeCheckedLeafItems=this._onDidCheckedLeafItemsChange.event;this._onLeave=this._register(new E);this.onLeave=this._onLeave.event;this._onDidAccept=this._register(new E);this.onDidAccept=this._onDidAccept.event;this._container=R(e,e4o(".quick-input-tree")),this._checkboxStateHandler=this._register(new RFt),this._renderer=this._register(this.instantiationService.createInstance(LK,t,this._onDidTriggerButton,this.onDidChangeCheckboxState,this._checkboxStateHandler,o.toggle)),this._filter=this.instantiationService.createInstance(AFt),this._sorter=this._register(new NFt),this._tree=this._register(this.instantiationService.createInstance(mg,"QuickInputTree",this._container,new MFt,[this._renderer],{accessibilityProvider:new PFt(this.onDidChangeCheckboxState),horizontalScrolling:!1,multipleSelectionSupport:!1,findWidgetEnabled:!1,alwaysConsumeMouseWheel:!0,hideTwistiesOfChildlessElements:!0,renderIndentGuides:"none",expandOnDoubleClick:!0,expandOnlyOnTwistieClick:!0,disableExpandOnSpacebar:!0,sorter:this._sorter,filter:this._filter,identityProvider:new PSi})),this.registerCheckboxStateListeners(),this.registerOnDidChangeFocus()}get tree(){return this._tree}get renderer(){return this._renderer}get displayed(){return this._container.style.display!=="none"}set displayed(e){this._container.style.display=e?"":"none"}get sortByLabel(){return this._sorter.sortByLabel}set sortByLabel(e){this._sorter.sortByLabel=e,this._tree.resort(null,!0)}getActiveDescendant(){return this._tree.getHTMLElement().getAttribute("aria-activedescendant")}filter(e){this._filter.filterValue=e,this._tree.refilter()}updateFilterOptions(e){e.matchOnLabel!==void 0&&(this._filter.matchOnLabel=e.matchOnLabel),e.matchOnDescription!==void 0&&(this._filter.matchOnDescription=e.matchOnDescription),this._tree.refilter()}setTreeData(e){let t=!1,o=r=>{let s;return r.children&&r.children.length>0&&(t=!0,s=r.children.map(l=>o(l)),r.checked=$De(s)),{element:r,children:s,collapsible:!!s,collapsed:r.collapsed?3:2}},n=e.map(r=>o(r));this._tree.setChildren(null,n),this._container.classList.toggle(t4o,!t)}layout(e){this._tree.getHTMLElement().style.maxHeight=e?`${Math.floor(e/44)*44+6}px`:"",this._tree.layout()}focus(e){switch(e){case 1:this._tree.scrollTop=0,this._tree.focusFirst();break;case 2:{this._tree.scrollTop=0;let t=!1;this._tree.focusFirst(void 0,o=>t?!0:(t=!t,!1));break}case 3:this._tree.scrollTop=this._tree.scrollHeight,this._tree.focusLast();break;case 4:{let t=this._tree.getFocus();this._tree.focusNext(void 0,!1,void 0,n=>(this._tree.reveal(n.element),!0));let o=this._tree.getFocus();t.length&&t[0]===o[0]&&this._onLeave.fire();break}case 5:{let t=this._tree.getFocus();this._tree.focusPrevious(void 0,!1,void 0,n=>(this._tree.reveal(n.element),!0));let o=this._tree.getFocus();t.length&&t[0]===o[0]&&this._onLeave.fire();break}case 6:this._tree.focusNextPage(void 0,t=>(this._tree.reveal(t.element),!0));break;case 7:this._tree.focusPreviousPage(void 0,t=>(this._tree.reveal(t.element),!0));break;case 8:case 9:return}}registerCheckboxStateListeners(){this._register(this._tree.onDidOpen(e=>{let t=e.element;if(!t||t.disabled)return;if(t.pickable===!1){this._tree.setFocus([t]),this._onDidAccept.fire();return}let o=e.browserEvent?.target;o&&o.classList.contains(hv.CLASS_NAME)||this.updateCheckboxState(t,t.checked===!0)})),this._register(this._checkboxStateHandler.onDidChangeCheckboxState(e=>{this.updateCheckboxState(e.item,e.checked===!0)}))}updateCheckboxState(e,t){if((e.checked??!1)===t)return;e.checked=t,this._tree.rerender(e);let o=new Set,n=[...this._tree.getNode(e).children];for(;n.length;){let s=n.shift();s?.element&&!o.has(s.element)&&(o.add(s.element),(s.element.checked??!1)!==e.checked&&(s.element.checked=e.checked,this._tree.rerender(s.element)),n.push(...s.children))}let r=this._tree.getParentElement(e);for(;r;){let s=[...this._tree.getNode(r).children],l=$De(s);(r.checked??!1)!==l&&(r.checked=l,this._tree.rerender(r)),r=this._tree.getParentElement(r)}this._onDidChangeCheckboxState.fire({item:e,checked:e.checked??!1}),this._onDidCheckedLeafItemsChange.fire(this.getCheckedLeafItems())}registerOnDidChangeFocus(){this._register(this._tree.onDidChangeFocus(e=>{let t=this._tree.getFocus().findLast(o=>o!==null);this._tree.setSelection(t?[t]:[],e.browserEvent)}))}getCheckedLeafItems(){let e=new Set,t=[...this._tree.getNode().children],o=new Array;for(;t.length;){let n=t.shift();!n?.element||e.has(n.element)||n.element.checked&&(e.add(n.element),t.push(...n.children),n.element.children||o.push(n.element))}return o}getActiveItems(){return this._tree.getFocus().filter(e=>e!==null)}toggleCheckbox(){for(let e of this.getActiveItems())e.pickable!==!1&&!e.disabled&&this.updateCheckboxState(e,e.checked!==!0)}checkAll(e){let t=new Set,o=[...this._tree.getNode().children],n=!1;for(;o.length;){let r=o.shift();!r?.element||t.has(r.element)||r.element.checked!==e&&(n=!0,r.element.checked=e,o.push(...r.children),t.add(r.element),this._tree.rerender(r.element),this._onDidChangeCheckboxState.fire({item:r.element,checked:r.element.checked}))}n&&this._onDidCheckedLeafItemsChange.fire(this.getCheckedLeafItems())}};qDe=I([m(3,F)],qDe);var LXe=class a extends CJ{constructor(e){super(e);this.type="quickTree";this._value=Le("value","");this._ariaLabel=Le("ariaLabel",void 0);this._placeholder=Le("placeholder",void 0);this._matchOnDescription=Le("matchOnDescription",!1);this._matchOnLabel=Le("matchOnLabel",!0);this._sortByLabel=Le("sortByLabel",!0);this._activeItems=Le("activeItems",[]);this._itemTree=Le("itemTree",[]);this.onDidChangeValue=H.fromObservable(this._value,this._store);this.onDidChangeActive=H.fromObservable(this._activeItems,this._store);this._onDidChangeCheckedLeafItems=this._register(new E);this.onDidChangeCheckedLeafItems=this._onDidChangeCheckedLeafItems.event;this._onDidChangeCheckboxState=this._register(new E);this.onDidChangeCheckboxState=this._onDidChangeCheckboxState.event;this._onDidAcceptEmitter=this._register(new E);this.onDidAccept=H.any(e.onDidAccept,this._onDidAcceptEmitter.event),this._registerAutoruns(),this._register(e.tree.onDidChangeCheckedLeafItems(t=>this._onDidChangeCheckedLeafItems.fire(t))),this._register(e.tree.onDidChangeCheckboxState(t=>this._onDidChangeCheckboxState.fire(t.item))),this._register(e.tree.tree.onDidChangeFocus(t=>{this._activeItems.set(e.tree.getActiveItems(),void 0)}))}static{this.DEFAULT_ARIA_LABEL=d(2254,null)}get value(){return this._value.get()}set value(e){this._value.set(e,void 0)}get ariaLabel(){return this._ariaLabel.get()}set ariaLabel(e){this._ariaLabel.set(e,void 0)}get placeholder(){return this._placeholder.get()}set placeholder(e){this._placeholder.set(e,void 0)}get matchOnDescription(){return this._matchOnDescription.get()}set matchOnDescription(e){this._matchOnDescription.set(e,void 0)}get matchOnLabel(){return this._matchOnLabel.get()}set matchOnLabel(e){this._matchOnLabel.set(e,void 0)}get sortByLabel(){return this._sortByLabel.get()}set sortByLabel(e){this._sortByLabel.set(e,void 0)}get activeItems(){return this._activeItems.get()}set activeItems(e){this._activeItems.set(e,void 0)}get itemTree(){return this._itemTree.get()}get onDidTriggerItemButton(){return this.ui.tree.onDidTriggerButton}get checkedLeafItems(){return this.ui.tree.getCheckedLeafItems()}setItemTree(e){this._itemTree.set(e,void 0)}getParent(e){return this.ui.tree.tree.getParentElement(e)??void 0}expand(e){this.ui.tree.tree.expand(e)}collapse(e){this.ui.tree.tree.collapse(e)}isCollapsed(e){return this.ui.tree.tree.isCollapsed(e)}focusOnInput(){this.ui.inputBox.setFocus()}reveal(e){this.ui.tree.tree.reveal(e),this.ui.tree.tree.setFocus([e])}show(){if(!this.visible){let t={title:!!this.title||!!this.step||!!this.titleButtons.length,description:!!this.description,checkAll:!0,checkBox:!0,inputBox:!0,progressBar:!0,visibleCount:!0,count:!0,ok:!0,list:!1,tree:!0,message:!!this.validationMessage,customButton:!1};this.ui.setVisibilities(t),this.visibleDisposables.add(this.ui.inputBox.onDidChange(o=>{this._value.set(o,void 0)})),this.visibleDisposables.add(this.ui.tree.onDidChangeCheckboxState(o=>{let n=$De([...this.ui.tree.tree.getNode().children]);this.ui.checkAll.checked!==n&&(this.ui.checkAll.checked=n)})),this.visibleDisposables.add(this.ui.checkAll.onChange(o=>{let n=this.ui.checkAll.checked;this.ui.tree.checkAll(n)})),this.visibleDisposables.add(this.ui.tree.onDidChangeCheckedLeafItems(o=>{this.ui.count.setCount(o.length)}))}super.show(),Vw(()=>this.ui.count.setCount(this.ui.tree.getCheckedLeafItems().length));let e=$De([...this.ui.tree.tree.getNode().children]);this.ui.checkAll.checked!==e&&(this.ui.checkAll.checked=e)}update(){if(!this.visible)return;let e={title:!!this.title||!!this.step||!!this.titleButtons.length,description:!!this.description,checkAll:!0,checkBox:!0,inputBox:!0,progressBar:!0,visibleCount:!0,count:!0,ok:!0,tree:!0,message:!!this.validationMessage};this.ui.setVisibilities(e),super.update()}_registerListeners(){}_registerAutoruns(){this.registerVisibleAutorun(e=>{let t=this._value.read(e);this.ui.inputBox.value=t,this.ui.tree.filter(t)}),this.registerVisibleAutorun(e=>{let t=this._ariaLabel.read(e);t||(t=this.placeholder||a.DEFAULT_ARIA_LABEL,this.title&&(t+=` - ${this.title}`)),this.ui.list.ariaLabel!==t&&(this.ui.list.ariaLabel=t??null),this.ui.inputBox.ariaLabel!==t&&(this.ui.inputBox.ariaLabel=t??"input")}),this.registerVisibleAutorun(e=>{let t=this._placeholder.read(e);this.ui.inputBox.placeholder!==t&&(this.ui.inputBox.placeholder=t??"")}),this.registerVisibleAutorun(e=>{let t=this._matchOnLabel.read(e),o=this._matchOnDescription.read(e);this.ui.tree.updateFilterOptions({matchOnLabel:t,matchOnDescription:o})}),this.registerVisibleAutorun(e=>{let t=this._sortByLabel.read(e);this.ui.tree.sortByLabel=t}),this.registerVisibleAutorun(e=>{let t=this._itemTree.read(e);this.ui.tree.setTreeData(t)})}registerVisibleAutorun(e){this._register(he(t=>{this._visible.read(t)&&e(t)}))}focus(e){this.ui.tree.focus(e),this.ui.tree.tree.domFocus()}accept(e){this._onDidAcceptEmitter.fire()}};var LR=_,ASi="workbench.quickInput.viewState",qJ=class extends C{constructor(e,t,o,n,r,s){super();this.options=e;this.layoutService=t;this.instantiationService=o;this.storageService=r;this.contextMenuService=s;this.enabled=!0;this.onDidAcceptEmitter=this._register(new E);this.onDidCustomEmitter=this._register(new E);this.onDidTriggerButtonEmitter=this._register(new E);this.keyMods={ctrlCmd:!1,alt:!1};this.controller=null;this.onShowEmitter=this._register(new E);this.onShow=this.onShowEmitter.event;this.onHideEmitter=this._register(new E);this.onHide=this.onHideEmitter.event;this.backButton=eOt;this.inQuickInputContext=Zoo.bindTo(n),this.quickInputTypeContext=eno.bindTo(n),this.endOfQuickInputBoxContext=ino.bindTo(n),this.idPrefix=e.idPrefix,this._container=e.container,this.styles=e.styles,this._register(H.runAndSubscribe(Fg,({window:l,disposables:c})=>this.registerKeyModsListeners(l,c),{window:It,disposables:this._store})),this._register(Szi(l=>{this.ui&&Me(this.ui.container)===l&&(this.reparentUI(this.layoutService.mainContainer),this.layout(this.layoutService.mainContainerDimension,this.layoutService.mainContainerOffset.quickPickTop))})),this.viewState=this.loadViewState()}static{this.MAX_WIDTH=600}get currentQuickInput(){return this.controller??void 0}get container(){return this._container}registerKeyModsListeners(e,t){let o=n=>{this.keyMods.ctrlCmd=n.ctrlKey||n.metaKey,this.keyMods.alt=n.altKey};for(let n of[re.KEY_DOWN,re.KEY_UP,re.MOUSE_DOWN])t.add(j(e,n,o,!0))}getUI(e){if(this.ui)return e&&Me(this._container)!==Me(this.layoutService.activeContainer)&&(this.reparentUI(this.layoutService.activeContainer),this.layout(this.layoutService.activeContainerDimension,this.layoutService.activeContainerOffset.quickPickTop)),this.ui;let t=R(this._container,LR(".quick-input-widget.show-file-icons"));t.tabIndex=-1,t.style.display="none";let o=hr(t),n=R(t,LR(".quick-input-titlebar")),r=this._register(new Ju(n,this.contextMenuService,{hoverDelegate:this.options.hoverDelegate,actionViewItemProvider:T1(this.styles.toggle),icon:!0,label:!1}));r.getElement().classList.add("quick-input-left-action-bar");let s=R(n,LR(".quick-input-title")),l=this._register(new Ju(n,this.contextMenuService,{hoverDelegate:this.options.hoverDelegate,actionViewItemProvider:T1(this.styles.toggle),icon:!0,label:!1}));l.getElement().classList.add("quick-input-right-action-bar");let c=R(t,LR(".quick-input-header")),u=this._register(new v7(d(2245,null),!1,{...kf,size:15}));R(c,u.domNode),this._register(u.onChange(()=>{let Se=u.checked;pe.setAllVisibleChecked(Se===!0)})),this._register(j(u.domNode,re.CLICK,Se=>{(Se.x||Se.y)&&f.setFocus()}));let p=R(c,LR(".quick-input-description")),h=R(c,LR(".quick-input-and-message")),g=R(h,LR(".quick-input-filter")),f=this._register(new _Ft(g,this.styles.inputBox,this.styles.toggle));f.setAttribute("aria-describedby",`${this.idPrefix}message`);let v=R(g,LR(".quick-input-visible-count"));v.setAttribute("aria-live","polite"),v.setAttribute("aria-atomic","true");let b=this._register(new fv(v,{countFormat:d(2247,null)},this.styles.countBadge)),S=R(g,LR(".quick-input-count"));S.setAttribute("aria-live","polite");let y=this._register(new fv(S,{countFormat:d(2246,null)},this.styles.countBadge)),w=this._register(new Ju(c,this.contextMenuService,{hoverDelegate:this.options.hoverDelegate,actionViewItemProvider:T1(this.styles.toggle),icon:!0,label:!1}));w.getElement().classList.add("quick-input-inline-action-bar");let k=R(c,LR(".quick-input-action")),T=this._register(new Mi(k,this.styles.button));T.label=d(2242,null),this._register(T.onDidClick(Se=>{this.onDidAcceptEmitter.fire()}));let N=R(c,LR(".quick-input-action")),O=this._register(new Mi(N,{...this.styles.button,supportIcons:!0}));O.label=d(2241,null),this._register(O.onDidClick(Se=>{this.onDidCustomEmitter.fire()}));let V=R(h,LR(`#${this.idPrefix}message.quick-input-message`)),U=this._register(new fb(t,this.styles.progressBar));U.getContainer().classList.add("quick-input-progress");let G=R(t,LR(".quick-input-html-widget"));G.tabIndex=-1;let $=R(t,LR(".quick-input-description")),te=this.idPrefix+"list",pe=this._register(this.instantiationService.createInstance(KJ,t,this.options.hoverDelegate,this.options.linkOpenerDelegate,te,this.styles));f.setAttribute("aria-controls",te),this._register(pe.onDidChangeFocus(()=>{if(f.hasFocus()){let Se=pe.getActiveDescendant();Se?(f.setAttribute("aria-activedescendant",Se),f.setListFocusMode(!0)):(f.removeAttribute("aria-activedescendant"),f.setListFocusMode(!1))}})),this._register(pe.onChangedAllVisibleChecked(Se=>{u.checked=Se})),this._register(pe.onChangedVisibleCount(Se=>{b.setCount(Se)})),this._register(pe.onChangedCheckedCount(Se=>{Vw(()=>y.setCount(Se))})),this._register(pe.onLeave(()=>{setTimeout(()=>{this.controller&&(f.setFocus(),this.controller instanceof xJ&&this.controller.canSelectMany&&pe.clearFocus())},0)}));let de=this._register(this.instantiationService.createInstance(qDe,t,this.options.hoverDelegate,this.styles));this._register(de.tree.onDidChangeFocus(()=>{if(f.hasFocus()){let Se=de.getActiveDescendant();Se?(f.setAttribute("aria-activedescendant",Se),f.setListFocusMode(!0)):(f.removeAttribute("aria-activedescendant"),f.setListFocusMode(!1))}})),this._register(de.onLeave(()=>{setTimeout(()=>{this.controller&&(f.setFocus(),de.tree.setFocus([]))},0)})),this._register(de.onDidAccept(()=>{this.onDidAcceptEmitter.fire()})),this._register(de.tree.onDidChangeContentHeight(()=>this.updateLayout()));let se=Vn(t);return this._register(se),this._register(j(t,re.FOCUS,Se=>{let ke=this.getUI();if(gs(Se.relatedTarget,ke.inputContainer)){let Ee=ke.inputBox.isSelectionAtEnd();this.endOfQuickInputBoxContext.get()!==Ee&&this.endOfQuickInputBoxContext.set(Ee)}gs(Se.relatedTarget,ke.container)||(this.inQuickInputContext.set(!0),this.previousFocusElement=Ao(Se.relatedTarget)?Se.relatedTarget:void 0)},!0)),this._register(se.onDidBlur(()=>{!this.getUI().ignoreFocusOut&&!this.options.ignoreFocusOut()&&this.hide(1),this.inQuickInputContext.set(!1),this.endOfQuickInputBoxContext.set(!1),this.previousFocusElement=void 0})),this._register(f.onKeyDown(Se=>{let ke=this.getUI().inputBox.isSelectionAtEnd();this.endOfQuickInputBoxContext.get()!==ke&&this.endOfQuickInputBoxContext.set(ke),tN(Se.keyCode)||(f.removeAttribute("aria-activedescendant"),f.setListFocusMode(!1))})),this._register(j(t,re.FOCUS,Se=>{f.setFocus()})),this.dndController=this._register(this.instantiationService.createInstance(RXe,this._container,t,[{node:n,includeChildren:!0,excludeNodes:[r.getElement(),l.getElement()]},{node:c,includeChildren:!1}],this.viewState)),this._register(he(Se=>{let ke=this.dndController?.dndViewState.read(Se);ke&&(ke.top!==void 0&&ke.left!==void 0?this.viewState={...this.viewState,top:ke.top,left:ke.left}:this.viewState=void 0,this.updateLayout(),ke.done&&this.saveViewState(this.viewState))})),this.ui={container:t,styleSheet:o,leftActionBar:r,titleBar:n,title:s,description1:$,description2:p,widget:G,rightActionBar:l,inlineActionBar:w,checkAll:u,inputContainer:h,filterContainer:g,inputBox:f,visibleCountContainer:v,visibleCount:b,countContainer:S,count:y,okContainer:k,ok:T,message:V,customButtonContainer:N,customButton:O,list:pe,tree:de,progressBar:U,onDidAccept:this.onDidAcceptEmitter.event,onDidCustom:this.onDidCustomEmitter.event,onDidTriggerButton:this.onDidTriggerButtonEmitter.event,ignoreFocusOut:!1,keyMods:this.keyMods,show:Se=>this.show(Se),hide:()=>this.hide(),setVisibilities:Se=>this.setVisibilities(Se),setEnabled:Se=>this.setEnabled(Se),setContextKey:Se=>this.options.setContextKey(Se),linkOpenerDelegate:Se=>this.options.linkOpenerDelegate(Se)},this.updateStyles(),this.ui}reparentUI(e){this.ui&&(this._container=e,R(this._container,this.ui.container),this.dndController?.reparentUI(this._container))}pick(e,t={},o=ve.None){return new Promise((n,r)=>{let s=p=>{s=n,t.onKeyMods?.(l.keyMods),n(p)};if(o.isCancellationRequested){s(void 0);return}let l=this.createQuickPick({useSeparators:!0}),c,u=[l,l.onDidAccept(()=>{if(l.canSelectMany)s(l.selectedItems.slice()),l.hide();else{let p=l.activeItems[0];p&&(s(p),l.hide())}}),l.onDidChangeActive(p=>{let h=p[0];h&&t.onDidFocus&&t.onDidFocus(h)}),l.onDidChangeSelection(p=>{if(!l.canSelectMany){let h=p[0];h&&(s(h),l.hide())}}),l.onDidTriggerItemButton(p=>t.onDidTriggerItemButton&&t.onDidTriggerItemButton({...p,removeItem:()=>{let h=l.items.indexOf(p.item);if(h!==-1){let g=l.items.slice(),f=g.splice(h,1),v=l.activeItems.filter(S=>S!==f[0]),b=l.keepScrollPosition;l.keepScrollPosition=!0,l.items=g,v&&(l.activeItems=v),l.keepScrollPosition=b}}})),l.onDidTriggerSeparatorButton(p=>t.onDidTriggerSeparatorButton?.(p)),l.onDidChangeValue(p=>{c&&!p&&(l.activeItems.length!==1||l.activeItems[0]!==c)&&(l.activeItems=[c])}),o.onCancellationRequested(()=>{l.hide()}),l.onDidHide(()=>{Ue(u),s(void 0)})];l.title=t.title,t.value&&(l.value=t.value),l.canSelectMany=!!t.canPickMany,l.placeholder=t.placeHolder,l.prompt=t.prompt,l.ignoreFocusOut=!!t.ignoreFocusLost,l.matchOnDescription=!!t.matchOnDescription,l.matchOnDetail=!!t.matchOnDetail,t.sortByLabel!==void 0&&(l.sortByLabel=t.sortByLabel),l.matchOnLabel=t.matchOnLabel===void 0||t.matchOnLabel,l.quickNavigate=t.quickNavigate,l.hideInput=!!t.hideInput,l.contextKey=t.contextKey,l.anchor=t.anchor,l.busy=!0,Promise.all([e,t.activeItem]).then(([p,h])=>{c=h,l.busy=!1,l.items=p,l.canSelectMany&&(l.selectedItems=p.filter(g=>g.type!=="separator"&&g.picked)),c&&(l.activeItems=[c])}),l.show(),Promise.resolve(e).then(void 0,p=>{r(p),l.hide()})})}setValidationOnInput(e,t){t&&Ae(t)?(e.severity=gt.Error,e.validationMessage=t):t&&!Ae(t)?(e.severity=t.severity,e.validationMessage=t.content):(e.severity=gt.Ignore,e.validationMessage=void 0)}input(e={},t=ve.None){return new Promise(o=>{if(t.isCancellationRequested){o(void 0);return}let n=this.createInputBox(),r=e.validateInput||(()=>Promise.resolve(void 0)),s=H.debounce(n.onDidChangeValue,(p,h)=>h,100),l=e.value||"",c=Promise.resolve(r(l)),u=[n,s(p=>{p!==l&&(c=Promise.resolve(r(p)),l=p),c.then(h=>{p===l&&this.setValidationOnInput(n,h)})}),n.onDidAccept(()=>{let p=n.value;p!==l&&(c=Promise.resolve(r(p)),l=p),c.then(h=>{!h||!Ae(h)&&h.severity!==gt.Error?(o(p),n.hide()):p===l&&this.setValidationOnInput(n,h)})}),t.onCancellationRequested(()=>{n.hide()}),n.onDidHide(()=>{Ue(u),o(void 0)})];n.title=e.title,n.value=e.value||"",n.valueSelection=e.valueSelection,n.prompt=e.prompt,n.placeholder=e.placeHolder,n.password=!!e.password,n.ignoreFocusOut=!!e.ignoreFocusLost,n.show()})}createQuickPick(e={useSeparators:!1}){let t=this.getUI(!0);return new xJ(t)}createInputBox(){let e=this.getUI(!0);return new XNt(e)}setAlignment(e){this.dndController?.setAlignment(e)}createQuickWidget(){let e=this.getUI(!0);return new JNt(e)}createQuickTree(){let e=this.getUI(!0);return new LXe(e)}show(e){let t=this.getUI(!0);this.onShowEmitter.fire();let o=this.controller;this.controller=e,o?.didHide(),this.setEnabled(!0),t.leftActionBar.setActions([]),t.title.textContent="",t.description1.textContent="",t.description2.textContent="",Fi(t.widget),t.rightActionBar.setActions([]),t.inlineActionBar.setActions([]),t.checkAll.checked=!1,t.inputBox.placeholder="",t.inputBox.password=!1,t.inputBox.showDecoration(gt.Ignore),t.visibleCount.setCount(0),t.count.setCount(0),t.countContainer.style.right="4px",Fi(t.message),t.progressBar.stop(),t.progressBar.getContainer().setAttribute("aria-hidden","true"),t.list.setElements([]),t.list.matchOnDescription=!1,t.list.matchOnDetail=!1,t.list.matchOnLabel=!0,t.list.sortByLabel=!0,t.tree.updateFilterOptions({matchOnDescription:!1,matchOnLabel:!0}),t.tree.sortByLabel=!0,t.ignoreFocusOut=!1,t.inputBox.toggles=void 0,t.inputBox.actions=void 0;let n=this.options.backKeybindingLabel();eOt.tooltip=n?d(2244,null,n):d(2243,null),t.container.style.display="",this.updateLayout(),this.dndController?.setEnabled(!e.anchor),this.dndController?.layoutContainer(),t.inputBox.setFocus(),this.quickInputTypeContext.set(e.type)}isVisible(){return!!this.ui&&this.ui.container.style.display!=="none"}setVisibilities(e){let t=this.getUI();t.title.style.display=e.title?"":"none",t.description1.style.display=e.description&&(e.inputBox||e.checkAll)?"":"none",t.description2.style.display=e.description&&!(e.inputBox||e.checkAll)?"":"none",t.checkAll.domNode.style.display=e.checkAll?"":"none",t.inputContainer.style.display=e.inputBox?"":"none",t.filterContainer.style.display=e.inputBox?"":"none",t.visibleCountContainer.style.display=e.visibleCount?"":"none",t.countContainer.style.display=e.count?"":"none",t.okContainer.style.display=e.ok?"":"none",t.customButtonContainer.style.display=e.customButton?"":"none",t.message.style.display=e.message?"":"none",t.progressBar.getContainer().style.display=e.progressBar?"":"none",t.list.displayed=!!e.list,t.tree.displayed=!!e.tree,t.container.classList.toggle("show-checkboxes",!!e.checkBox),t.container.classList.toggle("hidden-input",!e.inputBox&&!e.description),this.updateLayout()}setEnabled(e){if(e!==this.enabled){this.enabled=e;let t=this.getUI();for(let o=0;o<t.leftActionBar.getItemsLength();o++){let n=t.leftActionBar.getItemAction(o);n&&(n.enabled=e)}for(let o=0;o<t.rightActionBar.getItemsLength();o++){let n=t.rightActionBar.getItemAction(o);n&&(n.enabled=e)}e?t.checkAll.enable():t.checkAll.disable(),t.inputBox.enabled=e,t.ok.enabled=e,t.list.enabled=e}}hide(e){let t=this.controller;if(!t)return;t.willHide(e);let o=this.ui?.container,n=o&&!ts(o);if(this.controller=null,this.onHideEmitter.fire(),o&&(o.style.display="none"),!n){let r=this.previousFocusElement;for(;r&&!r.offsetParent;)r=r.parentElement??void 0;r?.offsetParent?(r.focus(),this.previousFocusElement=void 0):this.options.returnFocus()}t.didHide(e)}focus(){if(this.isVisible()){let e=this.getUI();e.inputBox.enabled?e.inputBox.setFocus():e.list.domFocus()}}toggle(){this.isVisible()&&(this.controller instanceof xJ&&this.controller.canSelectMany?this.getUI().list.toggleCheckbox():this.controller instanceof LXe&&this.getUI().tree.toggleCheckbox())}toggleHover(){this.isVisible()&&this.controller instanceof xJ&&this.getUI().list.toggleHover()}navigate(e,t){this.isVisible()&&this.getUI().list.displayed&&(this.getUI().list.focus(e?4:5),t&&this.controller instanceof xJ&&(this.controller.quickNavigate=t))}async accept(e={alt:!1,ctrlCmd:!1}){this.keyMods.alt=e.alt,this.keyMods.ctrlCmd=e.ctrlCmd,this.onDidAcceptEmitter.fire()}async back(){this.onDidTriggerButtonEmitter.fire(this.backButton)}async cancel(e){this.hide(e)}layout(e,t){this.dimension=e,this.titleBarOffset=t,this.updateLayout()}updateLayout(){if(this.ui&&this.isVisible()){let e=this.ui.container.style,t=Math.min(this.dimension.width*.62,qJ.MAX_WIDTH);e.width=t+"px";let o=this.dimension&&this.dimension.height*.4;if(this.controller?.anchor){let n=this.layoutService.getContainer(Ki()).getBoundingClientRect(),r=yje(this.controller.anchor);t=380,o=this.dimension?Math.min(this.dimension.height*.2,200):200;let s=Math.floor(o)+6+26+16,{top:l,left:c,right:u,bottom:p,anchorAlignment:h,anchorPosition:g}=uSt(n,{width:t,height:s},r,{anchorPosition:1});h===1?(e.right=`${u}px`,e.left="initial"):(e.left=`${c}px`,e.right="initial"),g===1?(e.bottom=`${p}px`,e.top="initial"):(e.top=`${l}px`,e.bottom="initial"),e.width=`${t}px`,e.height=""}else e.top=`${this.viewState?.top?Math.round(this.dimension.height*this.viewState.top):this.titleBarOffset}px`,e.left=`${Math.round(this.dimension.width*(this.viewState?.left??.5)-t/2)}px`,e.right="",e.bottom="",e.height="";this.ui.inputBox.layout(),this.ui.list.layout(o),this.ui.tree.layout(o)}}applyStyles(e){this.styles=e,this.updateStyles()}updateStyles(){if(this.ui){let{quickInputTitleBackground:e,quickInputBackground:t,quickInputForeground:o,widgetBorder:n}=this.styles.widget;this.ui.titleBar.style.backgroundColor=e??"",this.ui.container.style.backgroundColor=t??"",this.ui.container.style.color=o??"",this.ui.container.style.border=n?`1px solid ${n}`:"",this.ui.list.style(this.styles.list),this.ui.tree.tree.style(this.styles.list);let r=[];this.styles.pickerGroup.pickerGroupBorder&&r.push(`.quick-input-list .quick-input-list-entry { border-top-color: ${this.styles.pickerGroup.pickerGroupBorder}; }`),this.styles.pickerGroup.pickerGroupForeground&&r.push(`.quick-input-list .quick-input-list-separator { color: ${this.styles.pickerGroup.pickerGroupForeground}; }`),this.styles.pickerGroup.pickerGroupForeground&&r.push(".quick-input-list .quick-input-list-separator-as-item { color: var(--vscode-descriptionForeground); }"),(this.styles.keybindingLabel.keybindingLabelBackground||this.styles.keybindingLabel.keybindingLabelBorder||this.styles.keybindingLabel.keybindingLabelBottomBorder||this.styles.keybindingLabel.keybindingLabelShadow||this.styles.keybindingLabel.keybindingLabelForeground)&&(r.push(".quick-input-list .monaco-keybinding > .monaco-keybinding-key {"),this.styles.keybindingLabel.keybindingLabelBackground&&r.push(`background-color: ${this.styles.keybindingLabel.keybindingLabelBackground};`),this.styles.keybindingLabel.keybindingLabelBorder&&r.push(`border-color: ${this.styles.keybindingLabel.keybindingLabelBorder};`),this.styles.keybindingLabel.keybindingLabelBottomBorder&&r.push(`border-bottom-color: ${this.styles.keybindingLabel.keybindingLabelBottomBorder};`),this.styles.keybindingLabel.keybindingLabelShadow&&r.push(`box-shadow: inset 0 -1px 0 ${this.styles.keybindingLabel.keybindingLabelShadow};`),this.styles.keybindingLabel.keybindingLabelForeground&&r.push(`color: ${this.styles.keybindingLabel.keybindingLabelForeground};`),r.push("}"));let s=r.join(`
`);s!==this.ui.styleSheet.textContent&&(this.ui.styleSheet.textContent=s)}}loadViewState(){try{let e=JSON.parse(this.storageService.get(ASi,-1,"{}"));if(e.top!==void 0||e.left!==void 0)return e}catch{}}saveViewState(e){this.layoutService.activeContainer===this.layoutService.mainContainer&&(e!==void 0?this.storageService.store(ASi,JSON.stringify(e),-1,1):this.storageService.remove(ASi,-1))}};qJ=I([m(1,nc),m(2,F),m(3,X),m(4,le),m(5,ze)],qJ);var RXe=class extends C{constructor(e,t,o,n,r,s,l){super();this._container=e;this._quickInputContainer=t;this._quickInputDragAreas=o;this._layoutService=r;this.configurationService=l;this.dndViewState=Le(this,void 0);this._enabled=!0;this._snapThreshold=20;this._snapLineHorizontalRatio=.25;this._quickInputAlignmentContext=tYe.bindTo(s);let c=Uje(this.configurationService)==="custom";this._controlsOnLeft=c&&Pp===1,this._controlsOnRight=c&&(Pp===3||Pp===2),this._registerLayoutListener(),this.registerMouseListeners(),this.dndViewState.set({...n,done:!0},void 0)}reparentUI(e){this._container=e}layoutContainer(e=this._layoutService.activeContainerDimension){if(!this._enabled)return;let t=this.dndViewState.get(),o=this._quickInputContainer.getBoundingClientRect();if(t?.top&&t?.left){let n=Math.round(t.left*100)/100,r=e.width,s=o.width,l=n*r-s/2;this._layout(t.top*e.height,l)}}setEnabled(e){this._enabled=e,this._quickInputContainer.classList.toggle("no-drag",!e)}setAlignment(e,t=!0){e==="top"?(this.dndViewState.set({top:this._getTopSnapValue()/this._container.clientHeight,left:(this._getCenterXSnapValue()+this._quickInputContainer.clientWidth/2)/this._container.clientWidth,done:t},void 0),this._quickInputAlignmentContext.set("top")):e==="center"?(this.dndViewState.set({top:this._getCenterYSnapValue()/this._container.clientHeight,left:(this._getCenterXSnapValue()+this._quickInputContainer.clientWidth/2)/this._container.clientWidth,done:t},void 0),this._quickInputAlignmentContext.set("center")):(this.dndViewState.set({top:e.top,left:e.left,done:t},void 0),this._quickInputAlignmentContext.set(void 0))}_registerLayoutListener(){this._register(H.filter(this._layoutService.onDidLayoutContainer,e=>e.container===this._container)(e=>this.layoutContainer(e.dimension)))}registerMouseListeners(){let e=this._quickInputContainer;this._register(Fre(e,t=>{if(!this._enabled)return;let o=new yn(Me(e),t);if(o.detail!==2)return;let n=this._quickInputDragAreas.find(({node:r,includeChildren:s})=>s?gs(o.target,r):o.target===r);!n||n.excludeNodes?.some(r=>gs(o.target,r))||this.dndViewState.set({top:void 0,left:void 0,done:!0},void 0)})),this._register(C$(e,t=>{if(!this._enabled)return;let o=Me(this._layoutService.activeContainer),n=new yn(o,t),r=this._quickInputDragAreas.find(({node:g,includeChildren:f})=>f?gs(n.target,g):n.target===g);if(!r||r.excludeNodes?.some(g=>gs(n.target,g)))return;let s=this._quickInputContainer.getBoundingClientRect(),l=n.browserEvent.clientX-s.left,c=n.browserEvent.clientY-s.top,u=!1,p=$be(o,g=>{new yn(o,g).preventDefault(),u||(u=!0),this._layout(g.clientY-c,g.clientX-l)}),h=Fre(o,g=>{if(u){let f=this.dndViewState.get();this.dndViewState.set({top:f?.top,left:f?.left,done:!0},void 0)}p.dispose(),h.dispose()})}))}_layout(e,t){let o=this._getTopSnapValue(),n=this._getCenterYSnapValue(),r=this._getCenterXSnapValue();e=Math.max(0,Math.min(e,this._container.clientHeight-this._quickInputContainer.clientHeight)),e<this._layoutService.activeContainerOffset.top&&(this._controlsOnLeft?t=Math.max(t,80/yS(Ki())):this._controlsOnRight&&(t=Math.min(t,this._container.clientWidth-this._quickInputContainer.clientWidth-140/yS(Ki()))));let s=Math.abs(e-o)<this._snapThreshold;e=s?o:e;let l=Math.abs(e-n)<this._snapThreshold;e=l?n:e;let c=e/this._container.clientHeight;t=Math.max(0,Math.min(t,this._container.clientWidth-this._quickInputContainer.clientWidth));let u=Math.abs(t-r)<this._snapThreshold;t=u?r:t;let p=this._container.clientWidth,h=this._quickInputContainer.clientWidth,f=(t+h/2)/p;if(this.dndViewState.set({top:c,left:f,done:!1},void 0),u){if(s){this._quickInputAlignmentContext.set("top");return}else if(l){this._quickInputAlignmentContext.set("center");return}}this._quickInputAlignmentContext.set(void 0)}_getTopSnapValue(){return this._layoutService.activeContainerOffset.quickPickTop}_getCenterYSnapValue(){return Math.round(this._container.clientHeight*this._snapLineHorizontalRatio)}_getCenterXSnapValue(){return Math.round(this._container.clientWidth/2)-Math.round(this._quickInputContainer.clientWidth/2)}};RXe=I([m(4,nc),m(5,X),m(6,B)],RXe);var jDe=class extends Jd{constructor(e,t,o,n,r){super(o);this.instantiationService=e;this.contextKeyService=t;this.layoutService=n;this.configurationService=r;this._onShow=this._register(new E);this.onShow=this._onShow.event;this._onHide=this._register(new E);this.onHide=this._onHide.event;this.contexts=new Map}get backButton(){return this.controller.backButton}get controller(){return this._controller||(this._controller=this._register(this.createController())),this._controller}get hasController(){return!!this._controller}get currentQuickInput(){return this.controller.currentQuickInput}get quickAccess(){return this._quickAccess||(this._quickAccess=this._register(this.instantiationService.createInstance(KDe))),this._quickAccess}createController(e=this.layoutService,t){let o={idPrefix:"quickInput_",container:e.activeContainer,ignoreFocusOut:()=>!1,backKeybindingLabel:()=>{},setContextKey:r=>this.setContextKey(r),linkOpenerDelegate:r=>{this.instantiationService.invokeFunction(s=>{s.get(Qe).open(r,{allowCommands:!0,fromUserGesture:!0})})},returnFocus:()=>e.focus(),styles:this.computeStyles(),hoverDelegate:this._register(this.instantiationService.createInstance(K_e))},n=this._register(this.instantiationService.createInstance(qJ,{...o,...t}));return n.layout(e.activeContainerDimension,e.activeContainerOffset.quickPickTop),this._register(e.onDidLayoutActiveContainer(r=>{Me(e.activeContainer)===Me(n.container)&&n.layout(r,e.activeContainerOffset.quickPickTop)})),this._register(e.onDidChangeActiveContainer(()=>{n.isVisible()||n.layout(e.activeContainerDimension,e.activeContainerOffset.quickPickTop)})),this._register(n.onShow(()=>{this.resetContextKeys(),this._onShow.fire()})),this._register(n.onHide(()=>{this.resetContextKeys(),this._onHide.fire()})),n}setContextKey(e){let t;e&&(t=this.contexts.get(e),t||(t=new Q(e,!1).bindTo(this.contextKeyService),this.contexts.set(e,t))),!(t&&t.get())&&(this.resetContextKeys(),t?.set(!0))}resetContextKeys(){this.contexts.forEach(e=>{e.get()&&e.reset()})}pick(e,t,o=ve.None){return this.controller.pick(e,t,o)}input(e={},t=ve.None){return this.controller.input(e,t)}createQuickPick(e={useSeparators:!1}){return this.controller.createQuickPick(e)}createInputBox(){return this.controller.createInputBox()}createQuickWidget(){return this.controller.createQuickWidget()}createQuickTree(){return this.controller.createQuickTree()}focus(){this.controller.focus()}toggle(){this.controller.toggle()}navigate(e,t){this.controller.navigate(e,t)}accept(e){return this.controller.accept(e)}back(){return this.controller.back()}cancel(e){return this.controller.cancel(e)}setAlignment(e){this.controller.setAlignment(e)}toggleHover(){this.hasController&&this.controller.toggleHover()}updateStyles(){this.hasController&&this.controller.applyStyles(this.computeStyles())}computeStyles(){return{widget:{quickInputBackground:wt(sIe),quickInputForeground:wt(Sgt),quickInputTitleBackground:wt(p$i),widgetBorder:wt(jT),widgetShadow:wt(RN)},inputBox:pl,toggle:qg,countBadge:BS,button:Ko,progressBar:kx,keybindingLabel:l_,list:GI({listBackground:sIe,listFocusBackground:VU,listFocusForeground:WU,listInactiveFocusForeground:WU,listInactiveSelectionIconForeground:aIe,listInactiveFocusBackground:VU,listInactiveSelectionBackground:VU,listInactiveSelectionForeground:WU,listFocusOutline:qs,listInactiveFocusOutline:qs,treeStickyScrollBackground:sIe}),pickerGroup:{pickerGroupBorder:wt(m$i),pickerGroupForeground:wt(Igt)}}}};jDe=I([m(0,F),m(1,X),m(2,De),m(3,nc),m(4,B)],jDe);var MXe=class extends jDe{constructor(e,t,o,n,r,s){super(t,n,r,s,e);this.keybindingService=o;this.inQuickInputContext=bio.bindTo(this.contextKeyService);this.registerListeners()}registerListeners(){this._register(this.onShow(()=>this.inQuickInputContext.set(!0))),this._register(this.onHide(()=>this.inQuickInputContext.set(!1)))}createController(){return super.createController(this.layoutService,{ignoreFocusOut:()=>!this.configurationService.getValue("workbench.quickOpen.closeOnFocusLost"),backKeybindingLabel:()=>this.keybindingService.lookupKeybinding("workbench.action.quickInputBack")?.getLabel()||void 0})}};MXe=I([m(0,B),m(1,F),m(2,_e),m(3,X),m(4,De),m(5,nc)],MXe);we(Ge,MXe,1);var lI=ae("IUserDataSyncWorkbenchService");function Rv(a){switch(a){case"settings":return d(17562,null);case"keybindings":return d(17558,null);case"snippets":return d(17563,null);case"prompts":return d(17561,null);case"tasks":return d(17566,null);case"mcp":return d(17559,null);case"extensions":return d(17557,null);case"globalState":return d(17567,null);case"profiles":return d(17560,null);case"workspaceState":return d(17568,null)}}var Ch=L(17564,"Settings Sync"),Kro=Re("settings-sync-view-icon",M.sync,d(17565,null)),py=new Q("syncStatus","uninitialized"),rD=new Q("syncEnabled",!1),nB=new Q("userDataSyncAccountStatus","uninitialized"),tpe=new Q("enableSyncActivityViews",!1),OFt=new Q("enableSyncConflictsView",!1),jJ=new Q("hasConflicts",!1),PXe="workbench.userDataSync.actions.configure",DF="workbench.userDataSync.actions.showLog",rB="workbench.view.sync",QJ="workbench.views.sync.conflicts",FFt={id:"workbench.userDataSync.actions.downloadSyncActivity",title:L(17556,"Download Settings Sync Activity"),category:We.Developer,f1:!0,precondition:x.and(nB.isEqualTo("available"),py.notEqualsTo("uninitialized"))};var Gro="configurationSync.store",NSi="sync.previous.store",OSi="sync.donot-make-requests-until",WFt="sync.user-session-id",FSi="sync.machine-session-id",o4o=100,n4o=1e3*60*5,ipe=class extends C{constructor(e,t,o){super();this.productService=e;this.configurationService=t;this.storageService=o;this._onDidChangeUserDataSyncStore=this._register(new E);this.onDidChangeUserDataSyncStore=this._onDidChangeUserDataSyncStore.event;this.updateUserDataSyncStore();let n=this._register(new P);this._register(H.filter(o.onDidChangeValue(-1,iB,n),()=>this.userDataSyncStoreType!==this.userDataSyncStore?.type,n)(()=>this.updateUserDataSyncStore()))}get userDataSyncStore(){return this._userDataSyncStore}get userDataSyncStoreType(){return this.storageService.get(iB,-1)}set userDataSyncStoreType(e){this.storageService.store(iB,e,-1,Gt?0:1)}updateUserDataSyncStore(){this._userDataSyncStore=this.toUserDataSyncStore(this.productService[Gro]),this._onDidChangeUserDataSyncStore.fire()}toUserDataSyncStore(e){if(e&&(e=Gt&&e.web?{...e,...e.web}:e,Ae(e.url)&&yi(e.authenticationProviders)&&Object.keys(e.authenticationProviders).every(t=>Array.isArray(e.authenticationProviders[t].scopes)))){let t=e,o=!!t.canSwitch,n=t.url===t.insidersUrl?"insiders":"stable",r=(o?this.userDataSyncStoreType:void 0)||n,s=r==="insiders"?t.insidersUrl:r==="stable"?t.stableUrl:t.url;return{url:A.parse(s),type:r,defaultType:n,defaultUrl:A.parse(t.url),stableUrl:A.parse(t.stableUrl),insidersUrl:A.parse(t.insidersUrl),canSwitch:o,authenticationProviders:Object.keys(t.authenticationProviders).reduce((l,c)=>(l.push({id:c,scopes:t.authenticationProviders[c].scopes}),l),[])}}}};ipe=I([m(0,nt),m(1,B),m(2,le)],ipe);var VFt=class extends ipe{constructor(i,e,t){super(i,e,t);let o=this.storageService.get(NSi,-1);o&&(this.previousConfigurationSyncStore=JSON.parse(o));let n=this.productService[Gro];n?this.storageService.store(NSi,JSON.stringify(n),-1,1):this.storageService.remove(NSi,-1)}async switch(i){i!==this.userDataSyncStoreType&&(this.userDataSyncStoreType=i,this.updateUserDataSyncStore())}async getPreviousUserDataSyncStore(){return this.toUserDataSyncStore(this.previousConfigurationSyncStore)}};VFt=I([m(0,nt),m(1,B),m(2,le)],VFt);var sB=class extends C{constructor(e,t,o,n,r,s,l){super();this.requestService=o;this.logService=n;this.storageService=l;this._onTokenFailed=this._register(new E);this.onTokenFailed=this._onTokenFailed.event;this._onTokenSucceed=this._register(new E);this.onTokenSucceed=this._onTokenSucceed.event;this._donotMakeRequestsUntil=void 0;this._onDidChangeDonotMakeRequestsUntil=this._register(new E);this.onDidChangeDonotMakeRequestsUntil=this._onDidChangeDonotMakeRequestsUntil.event;this.resetDonotMakeRequestsUntilPromise=void 0;this.updateUserDataSyncStoreUrl(e),this.commonHeadersPromise=TO(r,s,l).then(c=>{let u={"X-Client-Name":`${t.applicationName}${Gt?"-web":""}`,"X-Client-Version":t.version};return t.commit&&(u["X-Client-Commit"]=t.commit),u}),this.session=new WSi(o4o,n4o,this.requestService,this.logService),this.initDonotMakeRequestsUntil(),this._register(Z(()=>{this.resetDonotMakeRequestsUntilPromise&&(this.resetDonotMakeRequestsUntilPromise.cancel(),this.resetDonotMakeRequestsUntilPromise=void 0)}))}get donotMakeRequestsUntil(){return this._donotMakeRequestsUntil}setAuthToken(e,t){this.authToken={token:e,type:t}}updateUserDataSyncStoreUrl(e){this.userDataSyncStoreUrl=e?je(e,"v1"):void 0}initDonotMakeRequestsUntil(){let e=this.storageService.getNumber(OSi,-1);e&&Date.now()<e&&this.setDonotMakeRequestsUntil(new Date(e))}setDonotMakeRequestsUntil(e){this._donotMakeRequestsUntil?.getTime()!==e?.getTime()&&(this._donotMakeRequestsUntil=e,this.resetDonotMakeRequestsUntilPromise&&(this.resetDonotMakeRequestsUntilPromise.cancel(),this.resetDonotMakeRequestsUntilPromise=void 0),this._donotMakeRequestsUntil?(this.storageService.store(OSi,this._donotMakeRequestsUntil.getTime(),-1,1),this.resetDonotMakeRequestsUntilPromise=xn(t=>Pi(this._donotMakeRequestsUntil.getTime()-Date.now(),t).then(()=>this.setDonotMakeRequestsUntil(void 0))),this.resetDonotMakeRequestsUntilPromise.then(null,t=>null)):this.storageService.remove(OSi,-1),this._onDidChangeDonotMakeRequestsUntil.fire())}async getAllCollections(e={}){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let t=je(this.userDataSyncStoreUrl,"collection").toString();e={...e},e["Content-Type"]="application/json";let o=await this.request(t,{type:"GET",headers:e},[],ve.None);return(await hh(o))?.map(({id:n})=>n)||[]}async createCollection(e={}){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let t=je(this.userDataSyncStoreUrl,"collection").toString();e={...e},e["Content-Type"]=Zn.text;let o=await this.request(t,{type:"POST",headers:e},[],ve.None),n=await Kx(o);if(!n)throw new Em("Server did not return the collection id",t,"NoCollection",o.res.statusCode,o.res.headers[tB]);return n}async deleteCollection(e,t={}){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let o=e?je(this.userDataSyncStoreUrl,"collection",e).toString():je(this.userDataSyncStoreUrl,"collection").toString();t={...t},await this.request(o,{type:"DELETE",headers:t},[],ve.None)}async getAllResourceRefs(e,t){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let o=this.getResourceUrl(this.userDataSyncStoreUrl,t,e),n={},r=await this.request(o.toString(),{type:"GET",headers:n},[],ve.None);return(await hh(r)||[]).map(({url:l,created:c})=>({ref:Fc(o,o.with({path:l})),created:c*1e3}))}async resolveResourceContent(e,t,o,n={}){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let r=je(this.getResourceUrl(this.userDataSyncStoreUrl,o,e),t).toString();n={...n},n["Cache-Control"]="no-cache";let s=await this.request(r,{type:"GET",headers:n},[],ve.None);return await Kx(s)}async deleteResource(e,t,o){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let n=t!==null?je(this.getResourceUrl(this.userDataSyncStoreUrl,o,e),t).toString():this.getResourceUrl(this.userDataSyncStoreUrl,o,e).toString(),r={};await this.request(n,{type:"DELETE",headers:r},[],ve.None)}async deleteResources(){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let e=je(this.userDataSyncStoreUrl,"resource").toString(),t={"Content-Type":Zn.text};await this.request(e,{type:"DELETE",headers:t},[],ve.None)}async readResource(e,t,o,n={}){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let r=je(this.getResourceUrl(this.userDataSyncStoreUrl,o,e),"latest").toString();n={...n},n["Cache-Control"]="no-cache",t&&(n["If-None-Match"]=t.ref);let s=await this.request(r,{type:"GET",headers:n},[304],ve.None),l=null;if(s.res.statusCode===304&&(l=t),l===null){let c=s.res.headers.etag;if(!c)throw new Em("Server did not return the ref",r,"NoRef",s.res.statusCode,s.res.headers[tB]);let u=await Kx(s);if(!u&&s.res.statusCode===304)throw new Em("Empty response",r,"EmptyResponse",s.res.statusCode,s.res.headers[tB]);l={ref:c,content:u}}return l}async writeResource(e,t,o,n,r={}){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let s=this.getResourceUrl(this.userDataSyncStoreUrl,n,e).toString();r={...r},r["Content-Type"]=Zn.text,o&&(r["If-Match"]=o);let l=await this.request(s,{type:"POST",data:t,headers:r},[],ve.None),c=l.res.headers.etag;if(!c)throw new Em("Server did not return the ref",s,"NoRef",l.res.statusCode,l.res.headers[tB]);return c}async manifest(e,t={}){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let o=je(this.userDataSyncStoreUrl,"manifest").toString();t={...t},t["Content-Type"]="application/json",e&&(t["If-None-Match"]=e.ref);let n=await this.request(o,{type:"GET",headers:t},[304],ve.None),r=null;if(n.res.statusCode===304&&(r=e),!r){let l=n.res.headers.etag;if(!l)throw new Em("Server did not return the ref",o,"NoRef",n.res.statusCode,n.res.headers[tB]);let c=await Kx(n);if(!c&&n.res.statusCode===304)throw new Em("Empty response",o,"EmptyResponse",n.res.statusCode,n.res.headers[tB]);c&&(r={...JSON.parse(c),ref:l})}let s=this.storageService.get(WFt,-1);return s&&r&&s!==r.session&&this.clearSession(),r===null&&s&&this.clearSession(),r&&this.storageService.store(WFt,r.session,-1,1),r}async clear(){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");await this.deleteCollection(),await this.deleteResources(),this.clearSession()}async getLatestData(e={}){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let t=je(this.userDataSyncStoreUrl,"download","latest").toString();e={...e},e["Content-Type"]="application/json";let o=await this.request(t,{type:"GET",headers:e},[],ve.None);if(!aP(o))throw new Em("Server returned "+o.res.statusCode,t,"EmptyResponse",o.res.statusCode,o.res.headers[tB]);let n=await hh(o);if(!n)return null;let r={};if(n.resources){r.resources={};for(let s in n.resources){let[l]=n.resources[s];r.resources[s]={content:l.content,ref:l.ref}}}if(n.collections){r.collections={};for(let s in n.collections){let l={};r.collections[s]={resources:l};for(let c in n.collections[s].resources){let[u]=n.collections[s].resources[c];l[c]={content:u.content,ref:u.ref}}}}return r}async getActivityData(){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let e=je(this.userDataSyncStoreUrl,"download").toString(),t={},o=await this.request(e,{type:"GET",headers:t},[],ve.None);if(!aP(o))throw new Em("Server returned "+o.res.statusCode,e,"EmptyResponse",o.res.statusCode,o.res.headers[tB]);if(zEt(o))throw new Em("Empty response",e,"EmptyResponse",o.res.statusCode,o.res.headers[tB]);return o.stream}getResourceUrl(e,t,o){return t?je(e,"collection",t,"resource",o):je(e,"resource",o)}clearSession(){this.storageService.remove(WFt,-1),this.storageService.remove(FSi,-1)}async request(e,t,o,n){if(!this.authToken)throw new Em("No Auth Token Available",e,"Unauthorized",void 0,void 0);if(this._donotMakeRequestsUntil&&Date.now()<this._donotMakeRequestsUntil.getTime())throw new Em(`${t.type} request '${e}' failed because of too many requests (429).`,e,"TooManyRequestsAndRetryAfter",void 0,void 0);this.setDonotMakeRequestsUntil(void 0);let r=await this.commonHeadersPromise;t.headers={...t.headers||{},...r,"X-Account-Type":this.authToken.type,authorization:`Bearer ${this.authToken.token}`},this.addSessionHeaders(t.headers),this.logService.trace("Sending request to server",{url:e,type:t.type,headers:{...t.headers,authorization:void 0}});let s;try{s=await this.session.request(e,t,n)}catch(h){if(!(h instanceof Em)){let g="RequestFailed",f=Cn(h).toLowerCase();f.includes("xhr timeout")?g="RequestTimeout":f.includes("protocol")&&f.includes("not supported")?g="RequestProtocolNotSupported":f.includes("request path contains unescaped characters")?g="RequestPathNotEscaped":f.includes("headers must be an object")?g="RequestHeadersNotObject":so(h)&&(g="RequestCanceled"),h=new Em(`Connection refused for the request '${e}'.`,e,g,void 0,void 0)}throw this.logService.info("Request failed",e),h}let l=s.res.headers[tB],c={url:e,status:s.res.statusCode,"execution-id":t.headers[hSi],"operation-id":l},u=aP(s)||s.res.statusCode&&o.includes(s.res.statusCode),p="";if(u?this.logService.trace("Request succeeded",c):(p=await E_(s)||"",this.logService.info("Request failed",c,p)),s.res.statusCode===401||s.res.statusCode===403){if(this.authToken=void 0,s.res.statusCode===401)throw this._onTokenFailed.fire("Unauthorized"),new Em(`${t.type} request '${e}' failed because of Unauthorized (401).`,e,"Unauthorized",s.res.statusCode,l);if(s.res.statusCode===403)throw this._onTokenFailed.fire("Forbidden"),new Em(`${t.type} request '${e}' failed because the access is forbidden (403).`,e,"Forbidden",s.res.statusCode,l)}if(this._onTokenSucceed.fire(),s.res.statusCode===404)throw new Em(`${t.type} request '${e}' failed because the requested resource is not found (404).`,e,"NotFound",s.res.statusCode,l);if(s.res.statusCode===405)throw new Em(`${t.type} request '${e}' failed because the requested endpoint is not found (405). ${p}`,e,"MethodNotFound",s.res.statusCode,l);if(s.res.statusCode===409)throw new Em(`${t.type} request '${e}' failed because of Conflict (409). There is new data for this resource. Make the request again with latest data.`,e,"Conflict",s.res.statusCode,l);if(s.res.statusCode===410)throw new Em(`${t.type} request '${e}' failed because the requested resource is not longer available (410).`,e,"Gone",s.res.statusCode,l);if(s.res.statusCode===412)throw new Em(`${t.type} request '${e}' failed because of Precondition Failed (412). There is new data for this resource. Make the request again with latest data.`,e,"PreconditionFailed",s.res.statusCode,l);if(s.res.statusCode===413)throw new Em(`${t.type} request '${e}' failed because of too large payload (413).`,e,"TooLarge",s.res.statusCode,l);if(s.res.statusCode===426)throw new Em(`${t.type} request '${e}' failed with status Upgrade Required (426). Please upgrade the client and try again.`,e,"UpgradeRequired",s.res.statusCode,l);if(s.res.statusCode===429){let h=s.res.headers["retry-after"];throw h?(this.setDonotMakeRequestsUntil(new Date(Date.now()+parseInt(h)*1e3)),new Em(`${t.type} request '${e}' failed because of too many requests (429).`,e,"TooManyRequestsAndRetryAfter",s.res.statusCode,l)):new Em(`${t.type} request '${e}' failed because of too many requests (429).`,e,"RemoteTooManyRequests",s.res.statusCode,l)}if(!u)throw new Em("Server returned "+s.res.statusCode,e,"Unknown",s.res.statusCode,l);return s}addSessionHeaders(e){let t=this.storageService.get(FSi,-1);t===void 0&&(t=_t(),this.storageService.store(FSi,t,-1,1)),e["X-Machine-Session-Id"]=t;let o=this.storageService.get(WFt,-1);o!==void 0&&(e["X-User-Session-Id"]=o)}};sB=I([m(1,nt),m(2,_a),m(3,uy),m(4,Co),m(5,be),m(6,le)],sB);var BFt=class extends sB{constructor(i,e,t,o,n,r,s){super(i.userDataSyncStore?.url,e,t,o,n,r,s),this._register(i.onDidChangeUserDataSyncStore(()=>this.updateUserDataSyncStoreUrl(i.userDataSyncStore?.url)))}};BFt=I([m(0,TR),m(1,nt),m(2,_a),m(3,uy),m(4,Co),m(5,be),m(6,le)],BFt);var WSi=class{constructor(i,e,t,o){this.limit=i;this.interval=e;this.requestService=t;this.logService=o;this.requests=[];this.startTime=void 0}request(i,e,t){if(this.isExpired()&&this.reset(),e.url=i,this.requests.length>=this.limit)throw this.logService.info("Too many requests",...this.requests),new Em(`Too many requests. Only ${this.limit} requests allowed in ${this.interval/(1e3*60)} minutes.`,i,"LocalTooManyRequests",void 0,void 0);return this.startTime=this.startTime||new Date,this.requests.push(i),this.requestService.request(e,t)}isExpired(){return this.startTime!==void 0&&new Date().getTime()-this.startTime.getTime()>this.interval}reset(){this.requests=[],this.startTime=void 0}};function s4o(a){return!!(a&&a.ref!==void 0&&typeof a.ref=="string"&&a.ref!==""&&a.syncData!==void 0&&(a.syncData===null||NXe(a.syncData)))}function NXe(a){return!!(a&&a.version!==void 0&&typeof a.version=="number"&&a.content!==void 0&&typeof a.content=="string"&&(Object.keys(a).length===2||Object.keys(a).length===3&&a.machineId!==void 0&&typeof a.machineId=="string"))}function QDe(a,i){return`${Cre(a)}${i.isDefault?"":` (${i.name})`}`}var aB=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.syncResource=e;this.collection=t;this.fileService=o;this.environmentService=n;this.storageService=r;this.userDataSyncStoreService=s;this.userDataSyncLocalStoreService=l;this.userDataSyncEnablementService=c;this.telemetryService=u;this.logService=p;this.configurationService=h;this.syncPreviewPromise=null;this._status="idle";this._onDidChangStatus=this._register(new E);this.onDidChangeStatus=this._onDidChangStatus.event;this._conflicts=[];this._onDidChangeConflicts=this._register(new E);this.onDidChangeConflicts=this._onDidChangeConflicts.event;this.localChangeTriggerThrottler=this._register(new ya(50));this._onDidChangeLocal=this._register(new E);this.onDidChangeLocal=this._onDidChangeLocal.event;this.hasSyncResourceStateVersionChanged=!1;this.syncHeaders={};this.lastSyncUserDataStateKey=`${t?`${t}.`:""}${e.syncResource}.lastSyncUserData`,this.resource=e.syncResource,this.syncResourceLogLabel=QDe(e.syncResource,e.profile),this.extUri=g.extUri,this.syncFolder=this.extUri.joinPath(n.userDataSyncHome,...mSi(e.profile.isDefault?void 0:e.profile.id,e.syncResource)),this.syncPreviewFolder=this.extUri.joinPath(this.syncFolder,Oro),this.lastSyncResource=aXe(e.profile.isDefault?void 0:e.profile.id,e.syncResource,n,this.extUri),this.currentMachineIdPromise=TO(n,o,r)}get status(){return this._status}get conflicts(){return{...this.syncResource,conflicts:this._conflicts}}triggerLocalChange(){this.localChangeTriggerThrottler.trigger(()=>this.doTriggerLocalChange())}async doTriggerLocalChange(){if(this.status==="hasConflicts"){this.logService.info(`${this.syncResourceLogLabel}: In conflicts state and local change detected. Syncing again...`);let e=await this.syncPreviewPromise;this.syncPreviewPromise=null;let t=await this.performSync(e.remoteUserData,e.lastSyncUserData,"merge",this.getUserDataSyncConfiguration());this.setStatus(t)}else{this.logService.trace(`${this.syncResourceLogLabel}: Checking for local changes...`);let e=await this.getLastSyncUserData();(!e||await this.hasRemoteChanged(e))&&this._onDidChangeLocal.fire()}}setStatus(e){this._status!==e&&(this._status=e,this._onDidChangStatus.fire(e))}async sync(e,t=!1,o=this.getUserDataSyncConfiguration(),n={}){try{if(this.syncHeaders={...n},this.status==="hasConflicts")return this.logService.info(`${this.syncResourceLogLabel}: Skipped synchronizing ${this.resource.toLowerCase()} as there are conflicts.`),this.syncPreviewPromise;if(this.status==="syncing")return this.logService.info(`${this.syncResourceLogLabel}: Skipped synchronizing ${this.resource.toLowerCase()} as it is running already.`),this.syncPreviewPromise;this.logService.trace(`${this.syncResourceLogLabel}: Started synchronizing ${this.resource.toLowerCase()}...`),this.setStatus("syncing");let r="idle";try{let s=await this.getLastSyncUserData(),l=await this.getLatestRemoteUserData(e,s);return r=await this.performSync(l,s,t?"preview":"merge",o),r==="hasConflicts"?this.logService.info(`${this.syncResourceLogLabel}: Detected conflicts while synchronizing ${this.resource.toLowerCase()}.`):r==="idle"&&this.logService.trace(`${this.syncResourceLogLabel}: Finished synchronizing ${this.resource.toLowerCase()}.`),this.syncPreviewPromise||null}finally{this.setStatus(r)}}finally{this.syncHeaders={}}}async apply(e,t={}){try{this.syncHeaders={...t};let o=await this.doApply(e);return this.setStatus(o),this.syncPreviewPromise}finally{this.syncHeaders={}}}async replace(e){let t=this.parseSyncData(e);if(!t)return!1;await this.stop();try{this.logService.trace(`${this.syncResourceLogLabel}: Started resetting ${this.resource.toLowerCase()}...`),this.setStatus("syncing");let o=await this.getLastSyncUserData(),n=await this.getLatestRemoteUserData(null,o),r=await this.isRemoteDataFromCurrentMachine(n),s=await this.generateSyncPreview({ref:n.ref,syncData:t},o,r,this.getUserDataSyncConfiguration(),ve.None),l=[];for(let c of s){let u=await this.getAcceptResult(c,c.remoteResource,void 0,ve.None),{remoteChange:p}=await this.getAcceptResult(c,c.previewResource,c.remoteContent,ve.None);l.push([c,{...u,remoteChange:p!==0?p:2}])}await this.applyResult(n,o,l,!1),this.logService.info(`${this.syncResourceLogLabel}: Finished resetting ${this.resource.toLowerCase()}.`)}finally{this.setStatus("idle")}return!0}async isRemoteDataFromCurrentMachine(e){let t=await this.currentMachineIdPromise;return!!e.syncData?.machineId&&e.syncData.machineId===t}async getLatestRemoteUserData(e,t){return e===null?{ref:Aro,syncData:null}:Ae(e)?t?.ref===e?t:this.getRemoteUserData(t):this.toRemoteUserData(e)}async performSync(e,t,o,n){if(e.syncData&&e.syncData.version>this.version)throw new Cg(d(2686,null,this.resource,this.version,e.syncData.version),"IncompatibleLocalContent",this.resource);try{return await this.doSync(e,t,o,n)}catch(r){if(r instanceof Cg)switch(r.code){case"LocalPreconditionFailed":return this.logService.info(`${this.syncResourceLogLabel}: Failed to synchronize ${this.syncResourceLogLabel} as there is a new local version available. Synchronizing again...`),this.performSync(e,t,o,n);case"Conflict":case"PreconditionFailed":return this.logService.info(`${this.syncResourceLogLabel}: Failed to synchronize as there is a new remote version available. Synchronizing again...`),e=await this.getRemoteUserData(null),t=await this.getLastSyncUserData(),this.performSync(e,t,"merge",n)}throw r}}async doSync(e,t,o,n){try{let r=await this.isRemoteDataFromCurrentMachine(e),s=!r&&t===null&&this.getStoredLastSyncUserDataStateContent()!==void 0,l=o==="preview"||o==="merge"&&!s,c=o==="merge"||o==="pull-push";this.syncPreviewPromise||(this.syncPreviewPromise=xn(p=>this.doGenerateSyncResourcePreview(e,t,r,l,n,p)));let u=await this.syncPreviewPromise;if(o==="merge"&&s){this.logService.info(`${this.syncResourceLogLabel}: Accepting remote because it was synced before and the last sync data is not available.`);for(let p of u.resourcePreviews)u=await this.accept(p.remoteResource)||u}else if(o==="pull-push")for(let p of u.resourcePreviews)p.mergeState!=="accepted"&&(e.ref===t?.ref||r?u=await this.accept(p.localResource)??u:u=await this.accept(p.remoteResource)??u);return this.updateConflicts(u.resourcePreviews),u.resourcePreviews.some(({mergeState:p})=>p==="conflict")?"hasConflicts":c?await this.doApply(!1):"syncing"}catch(r){throw this.syncPreviewPromise=null,r}}async accept(e,t){return await this.updateSyncResourcePreview(e,async o=>{let n=await this.getAcceptResult(o,e,t,ve.None);return o.acceptResult=n,o.mergeState="accepted",o.localChange=n.localChange,o.remoteChange=n.remoteChange,o}),this.syncPreviewPromise}async discard(e){return await this.updateSyncResourcePreview(e,async t=>{let o=await this.getMergeResult(t,ve.None);return await this.fileService.writeFile(t.previewResource,Je.fromString(o.content||"")),t.acceptResult=void 0,t.mergeState="preview",t.localChange=o.localChange,t.remoteChange=o.remoteChange,t}),this.syncPreviewPromise}async updateSyncResourcePreview(e,t){if(!this.syncPreviewPromise)return;let o=await this.syncPreviewPromise,n=o.resourcePreviews.findIndex(({localResource:r,remoteResource:s,previewResource:l})=>this.extUri.isEqual(r,e)||this.extUri.isEqual(s,e)||this.extUri.isEqual(l,e));n!==-1&&(this.syncPreviewPromise=xn(async r=>{let s=[...o.resourcePreviews];return s[n]=await t(s[n]),{...o,resourcePreviews:s}}),o=await this.syncPreviewPromise,this.updateConflicts(o.resourcePreviews),o.resourcePreviews.some(({mergeState:r})=>r==="conflict")?this.setStatus("hasConflicts"):this.setStatus("syncing"))}async doApply(e){if(!this.syncPreviewPromise)return"idle";let t=await this.syncPreviewPromise;return t.resourcePreviews.some(({mergeState:o})=>o==="conflict")?"hasConflicts":t.resourcePreviews.some(({mergeState:o})=>o!=="accepted")?"syncing":(await this.applyResult(t.remoteUserData,t.lastSyncUserData,t.resourcePreviews.map(o=>[o,o.acceptResult]),e),this.syncPreviewPromise=null,await this.clearPreviewFolder(),"idle")}async clearPreviewFolder(){try{await this.fileService.del(this.syncPreviewFolder,{recursive:!0})}catch{}}updateConflicts(e){let t=e.filter(({mergeState:o})=>o==="conflict");$i(this._conflicts,t,(o,n)=>this.extUri.isEqual(o.previewResource,n.previewResource))||(this._conflicts=t,this._onDidChangeConflicts.fire(this.conflicts))}async hasPreviouslySynced(){let e=await this.getLastSyncUserData();return!!e&&e.syncData!==null}async resolvePreviewContent(e){let t=this.syncPreviewPromise?await this.syncPreviewPromise:null;if(t)for(let o of t.resourcePreviews){if(this.extUri.isEqual(o.acceptedResource,e))return o.acceptResult?o.acceptResult.content:null;if(this.extUri.isEqual(o.remoteResource,e))return o.remoteContent;if(this.extUri.isEqual(o.localResource,e))return o.localContent;if(this.extUri.isEqual(o.baseResource,e))return o.baseContent}return null}async resetLocal(){this.storageService.remove(this.lastSyncUserDataStateKey,-1);try{await this.fileService.del(this.lastSyncResource)}catch(e){hu(e)!==1&&this.logService.error(e)}}async doGenerateSyncResourcePreview(e,t,o,n,r,s){let l=await this.generateSyncPreview(e,t,o,r,s),c=[];for(let u of l){let p=u.previewResource.with({scheme:HC,authority:"accepted"});if(u.localChange===0&&u.remoteChange===0)c.push({...u,acceptedResource:p,acceptResult:{content:null,localChange:0,remoteChange:0},mergeState:"accepted"});else{let h=n?await this.getMergeResult(u,s):void 0;if(s.isCancellationRequested)break;await this.fileService.writeFile(u.previewResource,Je.fromString(h?.content||""));let g=h&&!h.hasConflicts?await this.getAcceptResult(u,u.previewResource,void 0,s):void 0;c.push({...u,acceptResult:g,mergeState:h?.hasConflicts?"conflict":g?"accepted":"preview",localChange:g?g.localChange:h?h.localChange:u.localChange,remoteChange:g?g.remoteChange:h?h.remoteChange:u.remoteChange})}}return{syncResource:this.resource,profile:this.syncResource.profile,remoteUserData:e,lastSyncUserData:t,resourcePreviews:c,isLastSyncFromCurrentMachine:o}}async getLastSyncUserData(){let e=this.getStoredLastSyncUserDataStateContent();if(!e)return this.logService.info(`${this.syncResourceLogLabel}: Last sync data state does not exist.`),null;let t=JSON.parse(e),o=this.userDataSyncEnablementService.getResourceSyncStateVersion(this.resource);if(this.hasSyncResourceStateVersionChanged=!!t.version&&!!o&&t.version!==o,this.hasSyncResourceStateVersionChanged)return this.logService.info(`${this.syncResourceLogLabel}: Reset last sync state because last sync state version ${t.version} is not compatible with current sync state version ${o}.`),await this.resetLocal(),null;let n,r=1;for(;n===void 0&&r++<6;)try{let s=await this.readLastSyncStoredRemoteUserData();s&&(s.ref===t.ref?n=s.syncData:this.logService.info(`${this.syncResourceLogLabel}: Last sync data stored locally is not same as the last sync state.`));break}catch(s){if(s instanceof As&&s.fileOperationResult===1){this.logService.info(`${this.syncResourceLogLabel}: Last sync resource does not exist locally.`);break}else{if(s instanceof Cg)throw s;this.logService.error(s,r)}}if(n===void 0)try{let s=await this.userDataSyncStoreService.resolveResourceContent(this.resource,t.ref,this.collection,this.syncHeaders);n=s===null?null:this.parseSyncData(s),await this.writeLastSyncStoredRemoteUserData({ref:t.ref,syncData:n})}catch(s){if(s instanceof Cg&&s.code==="NotFound")this.logService.info(`${this.syncResourceLogLabel}: Last sync resource does not exist remotely.`);else throw s}return n===void 0?null:{...t,syncData:n}}async updateLastSyncUserData(e,t={}){if(t.ref||t.version)throw new Error("Cannot have core properties as additional");let o=this.userDataSyncEnablementService.getResourceSyncStateVersion(this.resource),n={ref:e.ref,version:o,...t};this.storageService.store(this.lastSyncUserDataStateKey,JSON.stringify(n),-1,1),await this.writeLastSyncStoredRemoteUserData(e)}getStoredLastSyncUserDataStateContent(){return this.storageService.get(this.lastSyncUserDataStateKey,-1)}async readLastSyncStoredRemoteUserData(){let e=(await this.fileService.readFile(this.lastSyncResource)).value.toString();try{let t=e?JSON.parse(e):void 0;if(s4o(t))return t}catch(t){this.logService.error(t)}}async writeLastSyncStoredRemoteUserData(e){await this.fileService.writeFile(this.lastSyncResource,Je.fromString(JSON.stringify(e)))}async getRemoteUserData(e){let t=await this.getUserData(e);return this.toRemoteUserData(t)}toRemoteUserData({ref:e,content:t}){let o=null;return t!==null&&(o=this.parseSyncData(t)),{ref:e,syncData:o}}parseSyncData(e){try{let t=JSON.parse(e);if(NXe(t))return t}catch(t){this.logService.error(t)}throw new Cg(d(2687,null),"IncompatibleRemoteContent",this.resource)}async getUserData(e){let t=e?{ref:e.ref,content:e.syncData?JSON.stringify(e.syncData):null}:null;return this.userDataSyncStoreService.readResource(this.resource,t,this.collection,this.syncHeaders)}async updateRemoteUserData(e,t){let o=await this.currentMachineIdPromise,n={version:this.version,machineId:o,content:e};try{return t=await this.userDataSyncStoreService.writeResource(this.resource,JSON.stringify(n),t,this.collection,this.syncHeaders),{ref:t,syncData:n}}catch(r){throw r instanceof Cg&&r.code==="TooLarge"&&(r=new Cg(r.message,r.code,this.resource)),r}}async backupLocal(e){let t={version:this.version,content:e};return this.userDataSyncLocalStoreService.writeResource(this.resource,JSON.stringify(t),new Date,this.syncResource.profile.isDefault?void 0:this.syncResource.profile.id)}async stop(){this.status!=="idle"&&(this.logService.trace(`${this.syncResourceLogLabel}: Stopping synchronizing ${this.resource.toLowerCase()}.`),this.syncPreviewPromise&&(this.syncPreviewPromise.cancel(),this.syncPreviewPromise=null),this.updateConflicts([]),await this.clearPreviewFolder(),this.setStatus("idle"),this.logService.info(`${this.syncResourceLogLabel}: Stopped synchronizing ${this.resource.toLowerCase()}.`))}getUserDataSyncConfiguration(){return this.configurationService.getValue(Mro)}};aB=I([m(2,be),m(3,Co),m(4,le),m(5,CF),m(6,VJ),m(7,_l),m(8,Te),m(9,uy),m(10,B),m(11,dt)],aB);var AXe=class extends aB{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(t,o,n,r,s,l,c,u,p,h,g,f);this.file=e;this._register(this.fileService.watch(this.extUri.dirname(e))),this._register(this.fileService.onDidFilesChange(v=>this.onFileChanges(v)))}async getLocalFileContent(){try{return await this.fileService.readFile(this.file)}catch{return null}}async updateLocalFileContent(e,t,o){try{t?await this.fileService.writeFile(this.file,Je.fromString(e),o?void 0:t):await this.fileService.createFile(this.file,Je.fromString(e),{overwrite:o})}catch(n){throw n instanceof As&&n.fileOperationResult===1||n instanceof As&&n.fileOperationResult===3?new Cg(n.message,"LocalPreconditionFailed"):n}}async deleteLocalFile(){try{await this.fileService.del(this.file)}catch(e){if(!(e instanceof As&&e.fileOperationResult===1))throw e}}onFileChanges(e){e.contains(this.file)&&this.triggerLocalChange()}};AXe=I([m(3,be),m(4,Co),m(5,le),m(6,CF),m(7,VJ),m(8,_l),m(9,Te),m(10,uy),m(11,B),m(12,dt)],AXe);var HFt=class extends AXe{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super(e,t,o,n,r,s,l,c,u,p,h,f,v);this.userDataSyncUtilService=g;this._formattingOptions=void 0}hasErrors(e,t){let o=[],n=Ur(e,o,{allowEmptyContent:!0,allowTrailingComma:!0});return o.length>0||!cn(n)&&t!==Array.isArray(n)}getFormattingOptions(){return this._formattingOptions||(this._formattingOptions=this.userDataSyncUtilService.resolveFormattingOptions(this.file)),this._formattingOptions}};HFt=I([m(3,be),m(4,Co),m(5,le),m(6,CF),m(7,VJ),m(8,_l),m(9,Te),m(10,uy),m(11,BJ),m(12,B),m(13,dt)],HFt);var YJ=class{constructor(i,e,t,o,n,r,s){this.resource=i;this.userDataProfilesService=e;this.environmentService=t;this.logService=o;this.fileService=n;this.storageService=r;this.extUri=s.extUri,this.lastSyncResource=aXe(void 0,this.resource,t,this.extUri)}async initialize({ref:i,content:e}){if(!e){this.logService.info("Remote content does not exist.",this.resource);return}let t=this.parseSyncData(e);if(t)try{await this.doInitialize({ref:i,syncData:t})}catch(o){this.logService.error(o)}}parseSyncData(i){try{let e=JSON.parse(i);if(NXe(e))return e}catch(e){this.logService.error(e)}this.logService.info("Cannot parse sync data as it is not compatible with the current version.",this.resource)}async updateLastSyncUserData(i,e={}){if(e.ref||e.version)throw new Error("Cannot have core properties as additional");let t={ref:i.ref,version:void 0,...e};this.storageService.store(`${this.resource}.lastSyncUserData`,JSON.stringify(t),-1,1),await this.fileService.writeFile(this.lastSyncResource,Je.fromString(JSON.stringify(i)))}};YJ=I([m(1,an),m(2,Co),m(3,ne),m(4,be),m(5,le),m(6,dt)],YJ);function OXe(a,i,e,t,o){if(!i)return{remote:{added:Object.keys(a),removed:[],updated:[],all:Object.keys(a).length>0?a:null},local:{added:{},removed:[],updated:{}}};let n=UFt(a,i);if(n.added.size===0&&n.removed.size===0&&n.updated.size===0)return{remote:{added:[],removed:[],updated:[],all:null},local:{added:{},removed:[],updated:{}}};let r=e?UFt(e,i):{added:Object.keys(i).reduce((h,g)=>(h.add(g),h),new Set),removed:new Set,updated:new Set},s=e?UFt(e,a):{added:Object.keys(a).reduce((h,g)=>(h.add(g),h),new Set),removed:new Set,updated:new Set},l={added:{},removed:[],updated:{}},c=Xi(i),u=!e;for(let h of s.added.values())h!==iB&&u&&r.added.has(h)||(c[h]=a[h]);for(let h of s.updated.values())c[h]=a[h];for(let h of s.removed.values())t.unregistered.includes(h)||delete c[h];for(let h of r.added.values()){let g=i[h];if(t.machine.includes(h)){o.info(`GlobalState: Skipped adding ${h} in local storage because it is declared as machine scoped.`);continue}if(e&&s.added.has(h))continue;let f=a[h];f&&f.value===g.value||h===iB&&u&&s.added.has(h)||(f?l.updated[h]=g:l.added[h]=g)}for(let h of r.updated.values()){let g=i[h];if(t.machine.includes(h)){o.info(`GlobalState: Skipped updating ${h} in local storage because it is declared as machine scoped.`);continue}if(s.updated.has(h)||s.removed.has(h))continue;let f=a[h];f&&f.value===g.value||(l.updated[h]=g)}for(let h of r.removed.values()){if(t.machine.includes(h)){o.trace(`GlobalState: Skipped removing ${h} in local storage because it is declared as machine scoped.`);continue}s.updated.has(h)||s.removed.has(h)||l.removed.push(h)}let p=UFt(i,c);return{local:l,remote:{added:[...p.added],updated:[...p.updated],removed:[...p.removed],all:p.added.size===0&&p.removed.size===0&&p.updated.size===0?null:c}}}function UFt(a,i){let e=Object.keys(a),t=Object.keys(i),o=t.filter(s=>!e.includes(s)).reduce((s,l)=>(s.add(l),s),new Set),n=e.filter(s=>!t.includes(s)).reduce((s,l)=>(s.add(l),s),new Set),r=new Set;for(let s of e){if(n.has(s))continue;let l=a[s],c=i[s];uo(l,c)||r.add(s)}return{added:o,removed:n,updated:r}}var ope="globalState.argv.",a4o=["locale"];function FXe(a,i){let e=a.storage?Object.keys(a.storage).sort():[],t={};return e.forEach(o=>t[o]=a.storage[o]),a.storage=t,i?rF(a,{}):JSON.stringify(a)}var BSi=1,zFt=class extends aB{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super({syncResource:"globalState",profile:e},t,n,c,g,r,s,u,p,l,h,f);this.userDataProfileStorageService=o;this.version=BSi;this.previewResource=this.extUri.joinPath(this.syncPreviewFolder,"globalState.json");this.baseResource=this.previewResource.with({scheme:HC,authority:"base"});this.localResource=this.previewResource.with({scheme:HC,authority:"local"});this.remoteResource=this.previewResource.with({scheme:HC,authority:"remote"});this.acceptedResource=this.previewResource.with({scheme:HC,authority:"accepted"});this.localGlobalStateProvider=v.createInstance(WXe),this._register(n.watch(this.extUri.dirname(this.environmentService.argvResource))),this._register(H.any(H.filter(n.onDidFilesChange,b=>b.contains(this.environmentService.argvResource)),H.filter(o.onDidChange,b=>!!(b.targetChanges.some(S=>this.syncResource.profile.id===S.id)||b.valueChanges.some(({profile:S,changes:y})=>this.syncResource.profile.id===S.id&&y.some(w=>w.target===0)))))((()=>this.triggerLocalChange())))}async generateSyncPreview(e,t,o){let n=e.syncData?JSON.parse(e.syncData.content):null;t=t===null&&o?e:t;let r=t&&t.syncData?JSON.parse(t.syncData.content):null,s=await this.localGlobalStateProvider.getLocalGlobalState(this.syncResource.profile);n?this.logService.trace(`${this.syncResourceLogLabel}: Merging remote ui state with local ui state...`):this.logService.trace(`${this.syncResourceLogLabel}: Remote ui state does not exist. Synchronizing ui state for the first time.`);let l=await this.getStorageKeys(r),{local:c,remote:u}=OXe(s.storage,n?n.storage:null,r?r.storage:null,l,this.logService),p={content:null,local:c,remote:u,localChange:Object.keys(c.added).length>0||Object.keys(c.updated).length>0||c.removed.length>0?2:0,remoteChange:u.all!==null?2:0},h=FXe(s,!1);return[{baseResource:this.baseResource,baseContent:r?FXe(r,!1):h,localResource:this.localResource,localContent:h,localUserData:s,remoteResource:this.remoteResource,remoteContent:n?FXe(n,!1):null,previewResource:this.previewResource,previewResult:p,localChange:p.localChange,remoteChange:p.remoteChange,acceptedResource:this.acceptedResource,storageKeys:l}]}async hasRemoteChanged(e){let t=e.syncData?JSON.parse(e.syncData.content):null;if(t===null)return!0;let o=await this.localGlobalStateProvider.getLocalGlobalState(this.syncResource.profile),n=await this.getStorageKeys(t),{remote:r}=OXe(o.storage,t.storage,t.storage,n,this.logService);return r.all!==null}async getMergeResult(e,t){return{...e.previewResult,hasConflicts:!1}}async getAcceptResult(e,t,o,n){if(this.extUri.isEqual(t,this.localResource))return this.acceptLocal(e);if(this.extUri.isEqual(t,this.remoteResource))return this.acceptRemote(e);if(this.extUri.isEqual(t,this.previewResource))return e.previewResult;throw new Error(`Invalid Resource: ${t.toString()}`)}async acceptLocal(e){if(e.remoteContent!==null){let t=JSON.parse(e.remoteContent),{local:o,remote:n}=OXe(e.localUserData.storage,t.storage,t.storage,e.storageKeys,this.logService);return{content:e.remoteContent,local:o,remote:n,localChange:0,remoteChange:n.all!==null?2:0}}else return{content:e.localContent,local:{added:{},removed:[],updated:{}},remote:{added:Object.keys(e.localUserData.storage),removed:[],updated:[],all:e.localUserData.storage},localChange:0,remoteChange:2}}async acceptRemote(e){if(e.remoteContent!==null){let t=JSON.parse(e.remoteContent),{local:o,remote:n}=OXe(e.localUserData.storage,t.storage,e.localUserData.storage,e.storageKeys,this.logService);return{content:e.remoteContent,local:o,remote:n,localChange:Object.keys(o.added).length>0||Object.keys(o.updated).length>0||o.removed.length>0?2:0,remoteChange:0}}else return{content:e.remoteContent,local:{added:{},removed:[],updated:{}},remote:{added:[],removed:[],updated:[],all:null},localChange:0,remoteChange:0}}async applyResult(e,t,o,n){let{localUserData:r}=o[0][0],{local:s,remote:l,localChange:c,remoteChange:u}=o[0][1];if(c===0&&u===0&&this.logService.info(`${this.syncResourceLogLabel}: No changes found during synchronizing ui state.`),c!==0&&(this.logService.trace(`${this.syncResourceLogLabel}: Updating local ui state...`),await this.backupLocal(JSON.stringify(r)),await this.localGlobalStateProvider.writeLocalGlobalState(s,this.syncResource.profile),this.logService.info(`${this.syncResourceLogLabel}: Updated local ui state`)),u!==0){this.logService.trace(`${this.syncResourceLogLabel}: Updating remote ui state...`);let p=JSON.stringify({storage:l.all});e=await this.updateRemoteUserData(p,n?null:e.ref),this.logService.info(`${this.syncResourceLogLabel}: Updated remote ui state.${l.added.length?` Added: ${l.added}.`:""}${l.updated.length?` Updated: ${l.updated}.`:""}${l.removed.length?` Removed: ${l.removed}.`:""}`)}t?.ref!==e.ref&&(this.logService.trace(`${this.syncResourceLogLabel}: Updating last synchronized ui state...`),await this.updateLastSyncUserData(e),this.logService.info(`${this.syncResourceLogLabel}: Updated last synchronized ui state`))}async resolveContent(e){if(this.extUri.isEqual(this.remoteResource,e)||this.extUri.isEqual(this.baseResource,e)||this.extUri.isEqual(this.localResource,e)||this.extUri.isEqual(this.acceptedResource,e)){let t=await this.resolvePreviewContent(e);return t&&FXe(JSON.parse(t),!0)}return null}async hasLocalData(){try{let{storage:e}=await this.localGlobalStateProvider.getLocalGlobalState(this.syncResource.profile);if(Object.keys(e).length>1||e[`${ope}.locale`]?.value!=="en")return!0}catch{}return!1}async getStorageKeys(e){let t=await this.userDataProfileStorageService.readStorageData(this.syncResource.profile),o=[],n=[];for(let[l,c]of t)c.target===0?o.push(l):c.target===1&&n.push(l);let r=[...o,...n],s=e?.storage?Object.keys(e.storage).filter(l=>!l.startsWith(ope)&&!r.includes(l)&&t.get(l)!==void 0):[];if(!Gt){let l=[...$ue.map(c=>que(c)),iB];s.push(...l),n.push(...l)}return{user:o,machine:n,unregistered:s}}};zFt=I([m(2,TF),m(3,be),m(4,CF),m(5,VJ),m(6,uy),m(7,Co),m(8,_l),m(9,Te),m(10,B),m(11,le),m(12,dt),m(13,F)],zFt);var WXe=class{constructor(i,e,t,o){this.fileService=i;this.environmentService=e;this.userDataProfileStorageService=t;this.logService=o}async getLocalGlobalState(i){let e={};if(i.isDefault){let o=await this.getLocalArgvContent(),n=Ur(o);for(let r of a4o)n[r]!==void 0&&(e[`${ope}${r}`]={version:1,value:n[r]})}let t=await this.userDataProfileStorageService.readStorageData(i);for(let[o,n]of t)n.value&&n.target===0&&(e[o]={version:1,value:n.value});return{storage:e}}async getLocalArgvContent(){try{this.logService.debug("GlobalStateSync#getLocalArgvContent",this.environmentService.argvResource);let i=await this.fileService.readFile(this.environmentService.argvResource);return this.logService.debug("GlobalStateSync#getLocalArgvContent - Resolved",this.environmentService.argvResource),i.value.toString()}catch(i){this.logService.debug(Cn(i))}return"{}"}async writeLocalGlobalState({added:i,removed:e,updated:t},o){let n=QDe("globalState",o),r={},s=new Map,l=await this.userDataProfileStorageService.readStorageData(o),c=(u,p)=>{for(let h of u){if(h.startsWith(ope)){r[h.substring(ope.length)]=p?p[h].value:void 0;continue}if(p){let g=p[h];g.value!==l.get(h)?.value&&s.set(h,g.value)}else l.get(h)!==void 0&&s.set(h,void 0)}};if(c(Object.keys(i),i),c(Object.keys(t),t),c(e),Object.keys(r).length){this.logService.trace(`${n}: Updating locale...`);let u=await this.getLocalArgvContent(),p=u;for(let h of Object.keys(r))p=PDe(p,[h],r[h],{});u!==p&&(this.logService.trace(`${n}: Updating locale...`),await this.fileService.writeFile(this.environmentService.argvResource,Je.fromString(p)),this.logService.info(`${n}: Updated locale.`)),this.logService.info(`${n}: Updated locale`)}s.size&&(this.logService.trace(`${n}: Updating global state...`),await this.userDataProfileStorageService.updateStorageData(o,s,0),this.logService.info(`${n}: Updated global state`,[...s.keys()]))}};WXe=I([m(0,be),m(1,Co),m(2,TF),m(3,uy)],WXe);var KFt=class extends YJ{constructor(i,e,t,o,n,r){super("globalState",t,o,n,e,i,r)}async doInitialize(i){let e=i.syncData?JSON.parse(i.syncData.content):null;if(!e){this.logService.info("Skipping initializing global state because remote global state does not exist.");return}let t={},o={};for(let n of Object.keys(e.storage))n.startsWith(ope)?t[n.substring(ope.length)]=e.storage[n].value:this.storageService.get(n,0)===void 0&&(o[n]=e.storage[n].value);if(Object.keys(t).length){let n="{}";try{n=(await this.fileService.readFile(this.environmentService.argvResource)).value.toString()}catch{}for(let r of Object.keys(t))n=PDe(n,[r],t[r],{});await this.fileService.writeFile(this.environmentService.argvResource,Je.fromString(n))}if(Object.keys(o).length){let n=[];for(let r of Object.keys(o))n.push({key:r,value:o[r],scope:0,target:0});this.storageService.storeAll(n,!0)}}};KFt=I([m(0,le),m(1,be),m(2,an),m(3,Co),m(4,uy),m(5,dt)],KFt);var YDe=class{constructor(i,e,t,o,n){this.userDataSyncStoreClient=i;this.storageService=e;this.environmentService=t;this.fileService=o;this.logService=n}getSyncStoreType(i){return this.parseGlobalState(i)?.storage[iB]?.value}async sync(i){let e=lXe(_t());try{return await this.doSync(i,e)}catch(t){if(t instanceof Cg&&t.code==="PreconditionFailed")return this.logService.info("Failed to synchronize UserDataSyncStoreType as there is a new remote version available. Synchronizing again..."),this.doSync(i,e);throw t}}async doSync(i,e){let t=await this.userDataSyncStoreClient.readResource("globalState",null,void 0,e),o=this.parseGlobalState(t)||{storage:{}};o.storage[iB]={value:i,version:BSi};let n=await TO(this.environmentService,this.fileService,this.storageService),r={version:BSi,machineId:n,content:FXe(o,!1)};await this.userDataSyncStoreClient.writeResource("globalState",JSON.stringify(r),t.ref,void 0,e)}parseGlobalState({content:i}){if(!i)return null;let e=JSON.parse(i);if(NXe(e))return e?JSON.parse(e.content):null;throw new Error("Invalid remote data")}};YDe=I([m(1,le),m(2,Co),m(3,be),m(4,ne)],YDe);var XJ=ae("IUserDataSyncMachinesService"),HSi="sync.currentMachineName",qro="Safari",jro="Chrome",Qro="Edge",Yro="Firefox",Xro="Android";function Jro(a){switch(a){case qro:case jro:case Qro:case Yro:case Xro:case LT(0):return!0}return!1}function $ro(){return cbe?qro:XH?jro:dbe?Qro:lbe?Yro:Jut?Xro:LT(Gt?0:Pp)}var LF=class extends C{constructor(e,t,o,n,r,s){super();this.storageService=o;this.userDataSyncStoreService=n;this.logService=r;this.productService=s;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this.userData=null;this.currentMachineIdPromise=TO(e,t,o)}static{this.VERSION=1}static{this.RESOURCE="machines"}async getMachines(e){let t=await this.currentMachineIdPromise;return(await this.readMachinesData(e)).machines.map(n=>({...n,isCurrent:n.id===t}))}async addCurrentMachine(e){let t=await this.currentMachineIdPromise,o=await this.readMachinesData(e);o.machines.some(({id:n})=>n===t)||(o.machines.push({id:t,name:this.computeCurrentMachineName(o.machines),platform:$ro()}),await this.writeMachinesData(o))}async removeCurrentMachine(e){let t=await this.currentMachineIdPromise,o=await this.readMachinesData(e),n=o.machines.filter(({id:r})=>r!==t);n.length!==o.machines.length&&(o.machines=n,await this.writeMachinesData(o))}async renameMachine(e,t,o){let n=await this.readMachinesData(o),r=n.machines.find(({id:s})=>s===e);if(r){r.name=t,await this.writeMachinesData(n);let s=await this.currentMachineIdPromise;e===s&&this.storageService.store(HSi,t,-1,1)}}async setEnablements(e){let t=await this.readMachinesData();for(let[o,n]of e){let r=t.machines.find(s=>s.id===o);r&&(r.disabled=n?void 0:!0)}await this.writeMachinesData(t)}computeCurrentMachineName(e){let t=this.storageService.get(HSi,-1);if(t){if(!e.some(s=>s.name===t))return t;this.storageService.remove(HSi,-1)}let o=`${this.productService.embedderIdentifier?`${this.productService.embedderIdentifier} - `:""}${$ro()} (${this.productService.nameShort})`,n=new RegExp(`${Yr(o)}\\s#(\\d+)`),r=0;for(let s of e){let l=n.exec(s.name),c=l?parseInt(l[1]):0;r=c>r?c:r}return`${o} #${r+1}`}async readMachinesData(e){this.userData=await this.readUserData(e);let t=this.parse(this.userData);if(t.version!==LF.VERSION)throw new Error(d(2701,null,this.productService.nameLong));return t}async writeMachinesData(e){let t=JSON.stringify(e),o=await this.userDataSyncStoreService.writeResource(LF.RESOURCE,t,this.userData?.ref||null);this.userData={ref:o,content:t},this._onDidChange.fire()}async readUserData(e){if(this.userData){let t=e&&e.latest?e.latest[LF.RESOURCE]:void 0;if(this.userData.ref===t)return this.userData;if(t===void 0&&this.userData.content===null)return this.userData}return this.userDataSyncStoreService.readResource(LF.RESOURCE,this.userData)}parse(e){if(e.content!==null)try{return JSON.parse(e.content)}catch(t){this.logService.error(t)}return{version:LF.VERSION,machines:[]}}};LF=I([m(0,Co),m(1,be),m(2,le),m(3,CF),m(4,uy),m(5,nt)],LF);var GFt=class{constructor(i,e){this.authenticationProviderId=i;this.session=e}get sessionId(){return this.session.id}get accountName(){return this.session.account.label}get accountId(){return this.session.account.id}get token(){return this.session.idToken||this.session.accessToken}};function l4o(a){let i=a;return A.isUri(i?.base)&&A.isUri(i?.input1?.uri)&&A.isUri(i?.input2?.uri)&&A.isUri(i?.result)}var sD=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N,O,V,U,G,$,te){super();this.userDataSyncService=e;this.uriIdentityService=t;this.authenticationService=o;this.userDataSyncAccountService=n;this.quickInputService=r;this.storageService=s;this.userDataSyncEnablementService=l;this.userDataAutoSyncService=c;this.logService=u;this.productService=p;this.extensionService=h;this.environmentService=g;this.secretStorageService=f;this.notificationService=v;this.progressService=b;this.dialogService=S;this.viewsService=w;this.viewDescriptorService=k;this.userDataSyncStoreManagementService=T;this.lifecycleService=N;this.instantiationService=O;this.editorService=V;this.userDataInitializationService=U;this.fileService=G;this.fileDialogService=$;this.userDataSyncMachinesService=te;this._authenticationProviders=[];this._accountStatus="uninitialized";this._onDidChangeAccountStatus=this._register(new E);this.onDidChangeAccountStatus=this._onDidChangeAccountStatus.event;this._onDidTurnOnSync=this._register(new E);this.onDidTurnOnSync=this._onDidTurnOnSync.event;this.turnOnSyncCancellationToken=void 0;this._cachedCurrentAuthenticationProviderId=null;this._cachedCurrentSessionId=null;this.syncEnablementContext=rD.bindTo(y),this.syncStatusContext=py.bindTo(y),this.accountStatusContext=nB.bindTo(y),this.activityViewsEnablementContext=tpe.bindTo(y),this.hasConflicts=jJ.bindTo(y),this.enableConflictsViewContext=OFt.bindTo(y),this.userDataSyncStoreManagementService.userDataSyncStore&&(this.syncStatusContext.set(this.userDataSyncService.status),this._register(e.onDidChangeStatus(pe=>this.syncStatusContext.set(pe))),this.syncEnablementContext.set(l.isEnabled()),this._register(l.onDidChangeEnablement(pe=>this.syncEnablementContext.set(pe))),this.waitAndInitialize())}static{this.DONOT_USE_WORKBENCH_SESSION_STORAGE_KEY="userDataSyncAccount.donotUseWorkbenchSession"}static{this.CACHED_AUTHENTICATION_PROVIDER_KEY="userDataSyncAccountProvider"}static{this.CACHED_SESSION_STORAGE_KEY="userDataSyncAccountPreference"}get enabled(){return!!this.userDataSyncStoreManagementService.userDataSyncStore}get authenticationProviders(){return this._authenticationProviders}get accountStatus(){return this._accountStatus}get current(){return this._current}updateAuthenticationProviders(){let e=this._authenticationProviders;return this._authenticationProviders=(this.userDataSyncStoreManagementService.userDataSyncStore?.authenticationProviders||[]).filter(({id:t})=>this.authenticationService.declaredProviders.some(o=>o.id===t)),this.logService.trace("Settings Sync: Authentication providers updated",this._authenticationProviders.map(({id:t})=>t)),$i(e,this._authenticationProviders,(t,o)=>t.id===o.id)}isSupportedAuthenticationProviderId(e){return this.authenticationProviders.some(({id:t})=>t===e)}async waitAndInitialize(){try{await Promise.all([this.extensionService.whenInstalledExtensionsRegistered(),this.userDataInitializationService.whenInitializationFinished()]),await this.initialize()}catch(e){this.environmentService.extensionTestsLocationURI||this.logService.error(e)}}async initialize(){if(Gt){let t=await RTe(this.secretStorageService,this.productService);this.currentSessionId===void 0&&t?.id&&(this.environmentService.options?.settingsSyncOptions?.authenticationProvider&&this.environmentService.options.settingsSyncOptions.enabled?this.currentSessionId=t.id:this.useWorkbenchSessionId&&(this.currentSessionId=t.id),this.useWorkbenchSessionId=!1)}let e=this.update("initialize");this._register(this.authenticationService.onDidChangeDeclaredProviders(()=>{this.updateAuthenticationProviders()&&e.finally(()=>this.update("declared authentication providers changed"))})),await e,this._register(H.filter(H.any(this.authenticationService.onDidRegisterAuthenticationProvider,this.authenticationService.onDidUnregisterAuthenticationProvider),t=>this.isSupportedAuthenticationProviderId(t.id))(()=>this.update("authentication provider change"))),this._register(H.filter(this.userDataSyncAccountService.onTokenFailed,t=>!t)(()=>this.update("token failure"))),this._register(H.filter(this.authenticationService.onDidChangeSessions,t=>this.isSupportedAuthenticationProviderId(t.providerId))(({event:t})=>this.onDidChangeSessions(t))),this._register(this.storageService.onDidChangeValue(-1,sD.CACHED_SESSION_STORAGE_KEY,this._store)(()=>this.onDidChangeStorage())),this._register(H.filter(this.userDataSyncAccountService.onTokenFailed,t=>t)(()=>this.onDidAuthFailure())),this.hasConflicts.set(this.userDataSyncService.conflicts.length>0),this._register(this.userDataSyncService.onDidChangeConflicts(t=>{this.hasConflicts.set(t.length>0),t.length||this.enableConflictsViewContext.reset(),this.editorService.editors.filter(o=>(Lj(o)?o.original.resource:l4o(o)?o.input1.uri:void 0)?.scheme!==HC?!1:!this.userDataSyncService.conflicts.some(({conflicts:r})=>r.some(({previewResource:s})=>this.uriIdentityService.extUri.isEqual(s,o.resource)))).forEach(o=>o.dispose())}))}async update(e){this.logService.trace(`Settings Sync: Updating due to ${e}`),this.updateAuthenticationProviders(),await this.updateCurrentAccount(),this._current&&(this.currentAuthenticationProviderId=this._current.authenticationProviderId),await this.updateToken(this._current),this.updateAccountStatus(this._current?"available":"unavailable")}async updateCurrentAccount(){this.logService.trace("Settings Sync: Updating the current account");let e=this.currentSessionId,t=this.currentAuthenticationProviderId;if(e){let o=t?this.authenticationProviders.filter(({id:n})=>n===t):this.authenticationProviders;for(let{id:n,scopes:r}of o){let s=await this.authenticationService.getSessions(n,r)||[];for(let l of s)if(l.id===e){this._current=new GFt(n,l),this.logService.trace("Settings Sync: Updated the current account",this._current.accountName);return}}}this._current=void 0}async updateToken(e){let t;if(e)try{t={token:e.token,authenticationProviderId:e.authenticationProviderId}}catch(o){this.logService.error(o)}await this.userDataSyncAccountService.updateAccount(t)}updateAccountStatus(e){if(this.logService.trace(`Settings Sync: Updating the account status to ${e}`),this._accountStatus!==e){let o=`Settings Sync: Account status changed from ${this._accountStatus} to ${e}`;fp.VSCODE_DEV?this.logService.trace(o):this.logService.info(o),this._accountStatus=e,this.accountStatusContext.set(e),this._onDidChangeAccountStatus.fire(e)}}async turnOn(){if(!this.authenticationProviders.length)throw new Error(d(17535,null));if(this.userDataSyncEnablementService.isEnabled())return;if(this.userDataSyncService.status!=="idle")throw new Error("Cannot turn on sync while syncing");if(!await this.pick())throw new ho;if(this.accountStatus!=="available")throw new Error(d(17534,null));let t=this.turnOnSyncCancellationToken=new $e,o=Gt?C.None:this.lifecycleService.onBeforeShutdown(n=>n.veto((async()=>{let{confirmed:r}=await this.dialogService.confirm({type:"warning",message:d(17551,null),title:d(17547,null),primaryButton:d(17555,null),cancelButton:d(17533,null)});return r&&t.cancel(),!r})(),"veto.settingsSync"));try{await this.doTurnOnSync(t.token)}finally{o.dispose(),this.turnOnSyncCancellationToken=void 0}await this.userDataAutoSyncService.turnOn(),this.userDataSyncStoreManagementService.userDataSyncStore?.canSwitch&&await this.synchroniseUserDataSyncStoreType(),this.currentAuthenticationProviderId=this.current?.authenticationProviderId,this.environmentService.options?.settingsSyncOptions?.enablementHandler&&this.currentAuthenticationProviderId&&this.environmentService.options.settingsSyncOptions.enablementHandler(!0,this.currentAuthenticationProviderId),this.notificationService.info(d(17552,null,Ch.value)),this._onDidTurnOnSync.fire()}async turnoff(e){this.userDataSyncEnablementService.isEnabled()&&(await this.userDataAutoSyncService.turnOff(e),this.environmentService.options?.settingsSyncOptions?.enablementHandler&&this.currentAuthenticationProviderId&&this.environmentService.options.settingsSyncOptions.enablementHandler(!1,this.currentAuthenticationProviderId)),this.turnOnSyncCancellationToken&&this.turnOnSyncCancellationToken.cancel()}async synchroniseUserDataSyncStoreType(){if(!this.userDataSyncAccountService.account)throw new Error("Cannot update because you are signed out from settings sync. Please sign in and try again.");if(!Gt||!this.userDataSyncStoreManagementService.userDataSyncStore)return;let e=this.userDataSyncStoreManagementService.userDataSyncStore.type==="insiders"?this.userDataSyncStoreManagementService.userDataSyncStore.stableUrl:this.userDataSyncStoreManagementService.userDataSyncStore.insidersUrl,t=this.instantiationService.createInstance(sB,e);t.setAuthToken(this.userDataSyncAccountService.account.token,this.userDataSyncAccountService.account.authenticationProviderId),await this.instantiationService.createInstance(YDe,t).sync(this.userDataSyncStoreManagementService.userDataSyncStore.type)}syncNow(){return this.userDataAutoSyncService.triggerSync(["Sync Now"],{immediately:!0,disableCache:!0})}async doTurnOnSync(e){let t=new P,o=await this.userDataSyncService.createManualSyncTask();try{await this.progressService.withProgress({location:10,title:Ch.value,command:DF,delay:500},async n=>{n.report({message:d(17554,null)}),t.add(this.userDataSyncService.onDidChangeStatus(r=>{r==="hasConflicts"?n.report({message:d(17546,null)}):n.report({message:d(17553,null)})})),await o.merge(),this.userDataSyncService.status==="hasConflicts"&&await this.handleConflictsWhileTurningOn(e),await o.apply()})}catch(n){throw await o.stop(),n}finally{t.dispose()}}async handleConflictsWhileTurningOn(e){let t=this.userDataSyncService.conflicts,o=d(17527,null),n="";for(let s=0;s<t.length;s++)s===t.length-1&&s!==0?n+=o:s!==0&&(n+=", "),n+=Rv(t[s].syncResource);let r=t.length===1?Rv(t[0].syncResource):void 0;await this.dialogService.prompt({type:St.Warning,message:d(17529,null,n),detail:d(17545,null),buttons:[{label:d(17548,null),run:async()=>{let s=pm(H.toPromise(H.filter(this.userDataSyncService.onDidChangeConflicts,l=>l.length===0)),e);await this.showConflicts(this.userDataSyncService.conflicts[0]?.conflicts[0]),await s}},{label:r?d(17539,null,r):d(17538,null),run:async()=>this.replace(!0)},{label:r?d(17541,null,r):d(17540,null),run:()=>this.replace(!1)}],cancelButton:{run:()=>{throw new ho}}})}async replace(e){for(let t of this.userDataSyncService.conflicts)for(let o of t.conflicts)await this.accept({syncResource:t.syncResource,profile:t.profile},e?o.remoteResource:o.localResource,void 0,{force:!0})}async accept(e,t,o,n){return this.userDataSyncService.accept(e,t,o,n)}async showConflicts(e){if(!this.userDataSyncService.conflicts.length)return;this.enableConflictsViewContext.set(!0);let t=await this.viewsService.openView(QJ);t&&e&&await t.open(e)}async resetSyncedData(){let{confirmed:e}=await this.dialogService.confirm({type:"info",message:d(17542,null),title:d(17543,null),primaryButton:d(17544,null)});e&&await this.userDataSyncService.resetRemote()}async getAllLogResources(){let e=[],t=await this.fileService.resolve(this.uriIdentityService.extUri.dirname(this.environmentService.logsHome));t.children&&e.push(...t.children.filter(n=>n.isDirectory&&/^\d{8}T\d{6}$/.test(n.name)).sort().reverse().map(n=>n.resource));let o=[];for(let n of e){let s=(await this.fileService.resolve(n)).children?.find(l=>this.uriIdentityService.extUri.basename(l.resource).startsWith(`${jue}.`));s&&o.push(s.resource)}return o}async showSyncActivity(){this.activityViewsEnablementContext.set(!0),await this.waitForActiveSyncViews(),await this.viewsService.openViewContainer(rB)}async downloadSyncActivity(){let e=await this.fileDialogService.showOpenDialog({title:d(17531,null),canSelectFiles:!1,canSelectFolders:!0,canSelectMany:!1,openLabel:d(17530,null)});if(e?.[0])return this.progressService.withProgress({location:10},async()=>{let o=(await this.userDataSyncMachinesService.getMachines()).find(u=>u.isCurrent),n=(o?o.name+" - ":"")+"Settings Sync Activity",r=await this.fileService.resolve(e[0]),s=new RegExp(`${Yr(n)}\\s(\\d+)`),l=[];for(let u of r.children??[])if(u.name===n)l.push(0);else{let p=s.exec(u.name);p&&l.push(parseInt(p[1]))}l.sort((u,p)=>u-p);let c=this.uriIdentityService.extUri.joinPath(e[0],l[0]!==0?n:`${n} ${l[l.length-1]+1}`);return await Promise.all([this.userDataSyncService.saveRemoteActivityData(this.uriIdentityService.extUri.joinPath(c,"remoteActivity.json")),(async()=>{let u=await this.getAllLogResources();await Promise.all(u.map(async p=>this.fileService.copy(p,this.uriIdentityService.extUri.joinPath(c,"logs",`${this.uriIdentityService.extUri.basename(this.uriIdentityService.extUri.dirname(p))}.log`))))})(),this.fileService.copy(this.environmentService.userDataSyncHome,this.uriIdentityService.extUri.joinPath(c,"localActivity"))]),c})}async waitForActiveSyncViews(){let e=this.viewDescriptorService.getViewContainerById(rB);if(e){let t=this.viewDescriptorService.getViewContainerModel(e);t.activeViewDescriptors.length||await H.toPromise(H.filter(t.onDidChangeActiveViewDescriptors,o=>t.activeViewDescriptors.length>0))}}async signIn(){let e=this.currentAuthenticationProviderId,t=e?this.authenticationProviders.find(o=>o.id===e):void 0;if(t)await this.doSignIn(t);else{if(!this.authenticationProviders.length)throw new Error(d(17536,null));await this.pick()}}async pick(){let e=await this.doPick();return e?(await this.doSignIn(e),!0):!1}async doPick(){if(this.authenticationProviders.length===0)return;let e=[...this.authenticationProviders].sort(({id:l})=>l===this.currentAuthenticationProviderId?-1:1),t=new Map;if(e.length===1){let l=await this.getAccounts(e[0].id,e[0].scopes);if(l.length)t.set(e[0].id,l);else return e[0]}let o,n=new P,r=n.add(this.quickInputService.createQuickPick({useSeparators:!0})),s=new Promise(l=>{n.add(r.onDidHide(()=>{n.dispose(),l(o)}))});if(r.title=Ch.value,r.ok=!1,r.ignoreFocusOut=!0,r.placeholder=d(17528,null),r.show(),e.length>1){r.busy=!0;for(let{id:l,scopes:c}of e){let u=await this.getAccounts(l,c);u.length&&t.set(l,u)}r.busy=!1}return r.items=this.createQuickpickItems(e,t),n.add(r.onDidAccept(()=>{o=r.selectedItems[0]?.account?r.selectedItems[0]?.account:r.selectedItems[0]?.authenticationProvider,r.hide()})),s}async getAccounts(e,t){let o=new Map,n=null,r=await this.authenticationService.getSessions(e,t)||[];for(let s of r){let l=new GFt(e,s);o.set(l.accountId,l),l.sessionId===this.currentSessionId&&(n=l)}return n&&o.set(n.accountId,n),n?[...o.values()]:[...o.values()].sort(({sessionId:s})=>s===this.currentSessionId?-1:1)}createQuickpickItems(e,t){let o=[];if(t.size){o.push({type:"separator",label:d(17550,null)});for(let n of e){let r=(t.get(n.id)||[]).sort(({sessionId:l})=>l===this.currentSessionId?-1:1),s=this.authenticationService.getProvider(n.id).label;for(let l of r)o.push({label:`${l.accountName} (${s})`,description:l.sessionId===this.current?.sessionId?d(17532,null):void 0,account:l,authenticationProvider:n})}o.push({type:"separator",label:d(17537,null)})}for(let n of e){let r=this.authenticationService.getProvider(n.id);if(!t.has(n.id)||r.supportsMultipleAccounts){let s=r.label;o.push({label:d(17549,null,s),authenticationProvider:n})}}return o}async doSignIn(e){let t;Nro(e)?(this.environmentService.options?.settingsSyncOptions?.authenticationProvider?.id===e.id?t=await this.environmentService.options?.settingsSyncOptions?.authenticationProvider?.signIn():t=(await this.authenticationService.createSession(e.id,e.scopes)).id,this.currentAuthenticationProviderId=e.id):(this.environmentService.options?.settingsSyncOptions?.authenticationProvider?.id===e.authenticationProviderId?t=await this.environmentService.options?.settingsSyncOptions?.authenticationProvider?.signIn():t=e.sessionId,this.currentAuthenticationProviderId=e.authenticationProviderId),this.currentSessionId=t,await this.update("sign in")}async onDidAuthFailure(){this.currentSessionId=void 0,await this.update("auth failure")}onDidChangeSessions(e){this.currentSessionId&&e.removed?.find(t=>t.id===this.currentSessionId)&&(this.currentSessionId=void 0),this.update("change in sessions")}onDidChangeStorage(){this.currentSessionId!==this.getStoredCachedSessionId()&&(this._cachedCurrentSessionId=null,this.update("change in storage"))}get currentAuthenticationProviderId(){return this._cachedCurrentAuthenticationProviderId===null&&(this._cachedCurrentAuthenticationProviderId=this.storageService.get(sD.CACHED_AUTHENTICATION_PROVIDER_KEY,-1)),this._cachedCurrentAuthenticationProviderId}set currentAuthenticationProviderId(e){this._cachedCurrentAuthenticationProviderId!==e&&(this._cachedCurrentAuthenticationProviderId=e,e===void 0?this.storageService.remove(sD.CACHED_AUTHENTICATION_PROVIDER_KEY,-1):this.storageService.store(sD.CACHED_AUTHENTICATION_PROVIDER_KEY,e,-1,1))}get currentSessionId(){return this._cachedCurrentSessionId===null&&(this._cachedCurrentSessionId=this.getStoredCachedSessionId()),this._cachedCurrentSessionId}set currentSessionId(e){this._cachedCurrentSessionId!==e&&(this._cachedCurrentSessionId=e,e===void 0?(this.logService.info("Settings Sync: Reset current session"),this.storageService.remove(sD.CACHED_SESSION_STORAGE_KEY,-1)):(this.logService.info("Settings Sync: Updated current session",e),this.storageService.store(sD.CACHED_SESSION_STORAGE_KEY,e,-1,1)))}getStoredCachedSessionId(){return this.storageService.get(sD.CACHED_SESSION_STORAGE_KEY,-1)}get useWorkbenchSessionId(){return!this.storageService.getBoolean(sD.DONOT_USE_WORKBENCH_SESSION_STORAGE_KEY,-1,!1)}set useWorkbenchSessionId(e){this.storageService.store(sD.DONOT_USE_WORKBENCH_SESSION_STORAGE_KEY,!e,-1,1)}};sD=I([m(0,aI),m(1,dt),m(2,Cs),m(3,LDe),m(4,Ge),m(5,le),m(6,_l),m(7,JE),m(8,ne),m(9,nt),m(10,lt),m(11,ru),m(12,LE),m(13,Ne),m(14,Bo),m(15,ct),m(16,X),m(17,Ft),m(18,Ri),m(19,TR),m(20,ao),m(21,F),m(22,ee),m(23,r4),m(24,be),m(25,dn),m(26,XJ)],sD);we(lI,sD,0);var XDe=" ",VXe=class extends C{constructor(e,t,o,n,r,s,l,c){super();this.activityService=e;this.storageService=t;this.dialogService=o;this.quickInputService=n;this._productService=r;this._authenticationService=s;this._authenticationUsageService=l;this._authenticationAccessService=c;this._signInRequestItems=new Map;this._sessionAccessRequestItems=new Map;this._accountBadgeDisposable=this._register(new me);this._onDidAccountPreferenceChange=this._register(new E);this.onDidChangeAccountPreference=this._onDidAccountPreferenceChange.event;this._inheritAuthAccountPreferenceParentToChildren=this._productService.inheritAuthAccountPreference||{},this._inheritAuthAccountPreferenceChildToParent=Object.entries(this._inheritAuthAccountPreferenceParentToChildren).reduce((u,[p,h])=>(h.forEach(g=>{u[g]=p}),u),{}),this.registerListeners()}registerListeners(){this._register(this._authenticationService.onDidChangeSessions(e=>{e.event.added?.length&&this.updateNewSessionRequests(e.providerId,e.event.added),e.event.removed?.length&&this.updateAccessRequests(e.providerId,e.event.removed)})),this._register(this._authenticationService.onDidUnregisterAuthenticationProvider(e=>{let t=this._sessionAccessRequestItems.get(e.id)||{};Object.keys(t).forEach(o=>{this.removeAccessRequest(e.id,o)})}))}updateNewSessionRequests(e,t){let o=this._signInRequestItems.get(e);o&&Object.keys(o).forEach(n=>{let r=n.split(XDe);t.some(s=>cMt(s.scopes,r))&&(o[n]?.disposables.forEach(l=>l.dispose()),delete o[n],Object.keys(o).length===0?this._signInRequestItems.delete(e):this._signInRequestItems.set(e,o),this.updateBadgeCount())})}updateAccessRequests(e,t){let o=this._sessionAccessRequestItems.get(e);o&&Object.keys(o).forEach(n=>{t.forEach(r=>{let s=o[n].possibleSessions.findIndex(l=>l.id===r.id);s&&o[n].possibleSessions.splice(s,1)}),o[n].possibleSessions.length||this.removeAccessRequest(e,n)})}updateBadgeCount(){this._accountBadgeDisposable.clear();let e=0;if(this._signInRequestItems.forEach(t=>{Object.keys(t).forEach(o=>{e+=t[o].requestingExtensionIds.length})}),this._sessionAccessRequestItems.forEach(t=>{e+=Object.keys(t).length}),e>0){let t=new qc(e,()=>d(16634,null));this._accountBadgeDisposable.value=this.activityService.showAccountsActivity({badge:t})}}removeAccessRequest(e,t){let o=this._sessionAccessRequestItems.get(e)||{};o[t]&&(Ue(o[t].disposables),delete o[t],this.updateBadgeCount())}updateAccountPreference(e,t,o){let n=Ei.toKey(e),r=this._inheritAuthAccountPreferenceChildToParent[n]??n,s=this._getKey(r,t);this.storageService.store(s,o.label,1,1),this.storageService.store(s,o.label,-1,1);let l=this._inheritAuthAccountPreferenceParentToChildren[r],c=l?[r,...l]:[r];this._onDidAccountPreferenceChange.fire({extensionIds:c,providerId:t})}getAccountPreference(e,t){let o=Ei.toKey(e),n=this._getKey(this._inheritAuthAccountPreferenceChildToParent[o]??o,t);return this.storageService.get(n,1)??this.storageService.get(n,-1)}removeAccountPreference(e,t){let o=Ei.toKey(e),n=this._getKey(this._inheritAuthAccountPreferenceChildToParent[o]??o,t);this.storageService.remove(n,1),this.storageService.remove(n,-1)}_getKey(e,t){return`${e}-${t}`}updateSessionPreference(e,t,o){let r=`${Ei.toKey(t)}-${e}-${o.scopes.join(XDe)}`;this.storageService.store(r,o.id,1,1),this.storageService.store(r,o.id,-1,1)}getSessionPreference(e,t,o){let r=`${Ei.toKey(t)}-${e}-${o.join(XDe)}`;return this.storageService.get(r,1)??this.storageService.get(r,-1)}removeSessionPreference(e,t,o){let r=`${Ei.toKey(t)}-${e}-${o.join(XDe)}`;this.storageService.remove(r,1),this.storageService.remove(r,-1)}_updateAccountAndSessionPreferences(e,t,o){this.updateAccountPreference(t,e,o.account),this.updateSessionPreference(e,t,o)}async showGetSessionPrompt(e,t,o,n){let r;(p=>(p[p.Allow=0]="Allow",p[p.Deny=1]="Deny",p[p.Cancel=2]="Cancel"))(r||={});let{result:s}=await this.dialogService.prompt({type:St.Info,message:d(16630,null,n,e.label,t),buttons:[{label:d(16629,null),run:()=>0},{label:d(16631,null),run:()=>1}],cancelButton:{run:()=>2}});return s!==2&&(this._authenticationAccessService.updateAllowedExtensions(e.id,t,[{id:o,name:n,allowed:s===0}]),this.removeAccessRequest(e.id,o)),s===0}async selectSession(e,t,o,n,r){let s=await this._authenticationService.getAccounts(e);if(!s.length)throw new Error("No accounts available");let l=new P,c=l.add(this.quickInputService.createQuickPick());c.ignoreFocusOut=!0;let u=new Set,p=r.filter(h=>!u.has(h.account.label)&&u.add(h.account.label)).map(h=>({label:h.account.label,session:h}));return s.forEach(h=>{u.has(h.label)||p.push({label:h.label,account:h})}),p.push({label:d(16636,null)}),c.items=p,c.title=d(16633,null,o,this._authenticationService.getProvider(e).label),c.placeholder=d(16632,null,o),await new Promise((h,g)=>{l.add(c.onDidAccept(async f=>{c.dispose();let v=c.selectedItems[0].session;if(!v){let S=c.selectedItems[0].account;try{v=await this._authenticationService.createSession(e,n,{account:S})}catch(y){g(y);return}}let b=v.account.label;this._authenticationAccessService.updateAllowedExtensions(e,b,[{id:t,name:o,allowed:!0}]),this._updateAccountAndSessionPreferences(e,t,v),this.removeAccessRequest(e,t),h(v)})),l.add(c.onDidHide(f=>{c.selectedItems[0]||g("User did not consent to account access"),l.dispose()})),c.show()})}async completeSessionAccessRequest(e,t,o,n){let s=(this._sessionAccessRequestItems.get(e.id)||{})[t];if(!s||!e)return;let l=s.possibleSessions,c;if(e.supportsMultipleAccounts)try{c=await this.selectSession(e.id,t,o,n,l)}catch{}else await this.showGetSessionPrompt(e,l[0].account.label,t,o)&&(c=l[0]);c&&this._authenticationUsageService.addAccountUsage(e.id,c.account.label,c.scopes,t,o)}requestSessionAccess(e,t,o,n,r){let s=this._sessionAccessRequestItems.get(e)||{};if(s[t])return;let c=this._authenticationService.getProvider(e),u=fe.appendMenuItem(D.AccountsContext,{group:"3_accessRequests",command:{id:`${e}${t}Access`,title:d(16628,null,c.label,o)}}),p=qe.registerCommand({id:`${e}${t}Access`,handler:async h=>{this.completeSessionAccessRequest(c,t,o,n)}});s[t]={possibleSessions:r,disposables:[u,p]},this._sessionAccessRequestItems.set(e,s),this.updateBadgeCount()}async requestNewSession(e,t,o,n){this._authenticationService.isAuthenticationProviderRegistered(e)||await new Promise((g,f)=>{let v=this._authenticationService.onDidRegisterAuthenticationProvider(b=>{b.id===e&&(v.dispose(),g())})});let r;try{r=this._authenticationService.getProvider(e)}catch{return}let s=this._signInRequestItems.get(e),l=Ece(t)?`${t.wwwAuthenticate}:${t.fallbackScopes?.join(XDe)??""}`:`${t.join(XDe)}`;if(s&&s[l]&&s[l].requestingExtensionIds.includes(o))return;let u=`${e}:${o}:signIn${Object.keys(s||[]).length}`,p=fe.appendMenuItem(D.AccountsContext,{group:"2_signInRequests",command:{id:u,title:d(16635,null,r.label,n)}}),h=qe.registerCommand({id:u,handler:async g=>{let v=await g.get(Cs).createSession(e,t);this._authenticationAccessService.updateAllowedExtensions(e,v.account.label,[{id:o,name:n,allowed:!0}]),this._updateAccountAndSessionPreferences(e,o,v)}});if(s){let g=s[l]||{disposables:[],requestingExtensionIds:[]};s[l]={disposables:[...g.disposables,p,h],requestingExtensionIds:[...g.requestingExtensionIds,o]},this._signInRequestItems.set(e,s)}else this._signInRequestItems.set(e,{[l]:{disposables:[p,h],requestingExtensionIds:[o]}});this.updateBadgeCount()}};VXe=I([m(0,zl),m(1,le),m(2,ct),m(3,Ge),m(4,nt),m(5,Cs),m(6,OP),m(7,Gx)],VXe);we(DY,VXe,1);var JJ=class extends C{constructor(e,t,o){super();this.storageService=e;this.secretStorageService=t;this.logService=o;this._onDidChangeTokens=this._register(new E);this.onDidChangeTokens=this._onDidChangeTokens.event;let n=new Op;this._register(this.secretStorageService.onDidChangeSecret(async r=>{let s;try{s=JSON.parse(r)}catch{}s?.isDynamicAuthProvider&&n.queue(async()=>{let l=await this.getSessionsForDynamicAuthProvider(s.authProviderId,s.clientId);this._onDidChangeTokens.fire({authProviderId:s.authProviderId,clientId:s.clientId,tokens:l})})}))}static{this.PROVIDERS_STORAGE_KEY="dynamicAuthProviders"}async getClientRegistration(e){let t=`dynamicAuthProvider:clientRegistration:${e}`,o=await this.secretStorageService.get(t);if(o)try{let s=JSON.parse(o);if(s&&(s.clientId||s.clientSecret))return s}catch{await this.secretStorageService.delete(t)}let r=this._getStoredProviders().find(s=>s.providerId===e);return r?.clientId?{clientId:r.clientId}:void 0}getClientId(e){return this._getStoredProviders().find(n=>n.providerId===e)?.clientId}async storeClientRegistration(e,t,o,n,r){this._trackProvider(e,t,o,r);let s=`dynamicAuthProvider:clientRegistration:${e}`,l={clientId:o,clientSecret:n};await this.secretStorageService.set(s,JSON.stringify(l))}_trackProvider(e,t,o,n){let r=this._getStoredProviders(),s=r.findIndex(l=>l.providerId===e);if(s===-1){let l={providerId:e,label:n||e,authorizationServer:t,clientId:o};r.push(l),this._storeProviders(r)}else{let l=r[s],c={providerId:e,label:n||l.label,authorizationServer:t,clientId:o};r[s]=c,this._storeProviders(r)}}_getStoredProviders(){let e=this.storageService.get(JJ.PROVIDERS_STORAGE_KEY,-1,"[]");try{let t=JSON.parse(e);for(let o of t)o.authorizationServer||(o.authorizationServer=o.issuer);return t}catch{return[]}}_storeProviders(e){this.storageService.store(JJ.PROVIDERS_STORAGE_KEY,JSON.stringify(e),-1,1)}getInteractedProviders(){return this._getStoredProviders()}async removeDynamicProvider(e){let t=this._getStoredProviders(),o=t.find(s=>s.providerId===e),n=t.filter(s=>s.providerId!==e);if(this._storeProviders(n),o){let s=JSON.stringify({isDynamicAuthProvider:!0,authProviderId:e,clientId:o.clientId});await this.secretStorageService.delete(s)}let r=`dynamicAuthProvider:clientRegistration:${e}`;await this.secretStorageService.delete(r)}async getSessionsForDynamicAuthProvider(e,t){let o=JSON.stringify({isDynamicAuthProvider:!0,authProviderId:e,clientId:t}),n=await this.secretStorageService.get(o);if(n){let r=JSON.parse(n);if(!Array.isArray(r)||!r.every(s=>typeof s.created_at=="number"&&Hto(s))){this.logService.error(`Invalid session data for ${e} (${t}) in secret storage:`,r),await this.secretStorageService.delete(o);return}return r}}async setSessionsForDynamicAuthProvider(e,t,o){let n=JSON.stringify({isDynamicAuthProvider:!0,authProviderId:e,clientId:t}),r=JSON.stringify(o);await this.secretStorageService.set(n,r),this.logService.trace(`Set session data for ${e} (${t}) in secret storage:`,o)}};JJ=I([m(0,le),m(1,LE),m(2,ne)],JJ);we(YX,JJ,1);var RR=ae("IAuthenticationQueryService");var lB=class{constructor(i,e){this.providerId=i;this.queryService=e}},HXe=class extends lB{constructor(e,t,o,n){super(e,n);this.accountName=t;this.extensionId=o}isAccessAllowed(){return this.queryService.authenticationAccessService.isAccessAllowed(this.providerId,this.accountName,this.extensionId)}setAccessAllowed(e,t){this.queryService.authenticationAccessService.updateAllowedExtensions(this.providerId,this.accountName,[{id:this.extensionId,name:t||this.extensionId,allowed:e}])}addUsage(e,t){this.queryService.authenticationUsageService.addAccountUsage(this.providerId,this.accountName,e,this.extensionId,t)}getUsage(){return this.queryService.authenticationUsageService.readAccountUsages(this.providerId,this.accountName).filter(t=>t.extensionId===Ei.toKey(this.extensionId)).map(t=>({extensionId:t.extensionId,extensionName:t.extensionName,scopes:t.scopes||[],lastUsed:t.lastUsed}))}removeUsage(){let t=this.queryService.authenticationUsageService.readAccountUsages(this.providerId,this.accountName).filter(o=>o.extensionId!==this.extensionId);this.queryService.authenticationUsageService.removeAccountUsage(this.providerId,this.accountName);for(let o of t)this.queryService.authenticationUsageService.addAccountUsage(this.providerId,this.accountName,o.scopes||[],o.extensionId,o.extensionName)}setAsPreferred(){this.queryService.authenticationExtensionsService.updateAccountPreference(this.extensionId,this.providerId,{label:this.accountName,id:this.accountName})}isPreferred(){return this.queryService.authenticationExtensionsService.getAccountPreference(this.extensionId,this.providerId)===this.accountName}isTrusted(){return this.queryService.authenticationAccessService.readAllowedExtensions(this.providerId,this.accountName).find(o=>o.id===this.extensionId)?.trusted===!0}},$Ft=class extends lB{constructor(e,t,o,n){super(e,n);this.accountName=t;this.mcpServerId=o}isAccessAllowed(){return this.queryService.authenticationMcpAccessService.isAccessAllowed(this.providerId,this.accountName,this.mcpServerId)}setAccessAllowed(e,t){this.queryService.authenticationMcpAccessService.updateAllowedMcpServers(this.providerId,this.accountName,[{id:this.mcpServerId,name:t||this.mcpServerId,allowed:e}])}addUsage(e,t){this.queryService.authenticationMcpUsageService.addAccountUsage(this.providerId,this.accountName,e,this.mcpServerId,t)}getUsage(){return this.queryService.authenticationMcpUsageService.readAccountUsages(this.providerId,this.accountName).filter(t=>t.mcpServerId===this.mcpServerId).map(t=>({mcpServerId:t.mcpServerId,mcpServerName:t.mcpServerName,scopes:t.scopes||[],lastUsed:t.lastUsed}))}removeUsage(){let t=this.queryService.authenticationMcpUsageService.readAccountUsages(this.providerId,this.accountName).filter(o=>o.mcpServerId!==this.mcpServerId);this.queryService.authenticationMcpUsageService.removeAccountUsage(this.providerId,this.accountName);for(let o of t)this.queryService.authenticationMcpUsageService.addAccountUsage(this.providerId,this.accountName,o.scopes||[],o.mcpServerId,o.mcpServerName)}setAsPreferred(){this.queryService.authenticationMcpService.updateAccountPreference(this.mcpServerId,this.providerId,{label:this.accountName,id:this.accountName})}isPreferred(){return this.queryService.authenticationMcpService.getAccountPreference(this.mcpServerId,this.providerId)===this.accountName}isTrusted(){return this.queryService.authenticationMcpAccessService.readAllowedMcpServers(this.providerId,this.accountName).find(o=>o.id===this.mcpServerId)?.trusted===!0}},UXe=class extends lB{constructor(e,t,o){super(e,o);this.accountName=t}getAllowedExtensions(){let e=this.queryService.authenticationAccessService.readAllowedExtensions(this.providerId,this.accountName),t=this.queryService.authenticationUsageService.readAccountUsages(this.providerId,this.accountName);return e.filter(o=>o.allowed!==!1).map(o=>{let n=t.filter(c=>c.extensionId===o.id),r=n.length>0?Math.max(...n.map(c=>c.lastUsed)):void 0,l=new HXe(this.providerId,this.accountName,o.id,this.queryService).isTrusted();return{id:o.id,name:o.name,allowed:o.allowed,lastUsed:r,trusted:l}})}allowAccess(e){let t=e.map(o=>({id:o,name:o,allowed:!0}));this.queryService.authenticationAccessService.updateAllowedExtensions(this.providerId,this.accountName,t)}removeAccess(e){let t=e.map(o=>({id:o,name:o,allowed:!1}));this.queryService.authenticationAccessService.updateAllowedExtensions(this.providerId,this.accountName,t)}forEach(e){let t=this.queryService.authenticationUsageService.readAccountUsages(this.providerId,this.accountName),o=this.queryService.authenticationAccessService.readAllowedExtensions(this.providerId,this.accountName),n=new Set;t.forEach(r=>n.add(r.extensionId)),o.forEach(r=>n.add(r.id));for(let r of n){let s=new HXe(this.providerId,this.accountName,r,this.queryService);e(s)}}},zXe=class extends lB{constructor(e,t,o){super(e,o);this.accountName=t}getAllowedMcpServers(){return this.queryService.authenticationMcpAccessService.readAllowedMcpServers(this.providerId,this.accountName).filter(e=>e.allowed!==!1)}allowAccess(e){let t=e.map(o=>({id:o,name:o,allowed:!0}));this.queryService.authenticationMcpAccessService.updateAllowedMcpServers(this.providerId,this.accountName,t)}removeAccess(e){let t=e.map(o=>({id:o,name:o,allowed:!1}));this.queryService.authenticationMcpAccessService.updateAllowedMcpServers(this.providerId,this.accountName,t)}forEach(e){let t=this.queryService.authenticationMcpUsageService.readAccountUsages(this.providerId,this.accountName),o=this.queryService.authenticationMcpAccessService.readAllowedMcpServers(this.providerId,this.accountName),n=new Set;t.forEach(r=>n.add(r.mcpServerId)),o.forEach(r=>n.add(r.id));for(let r of n){let s=new $Ft(this.providerId,this.accountName,r,this.queryService);e(s)}}},USi=class extends lB{constructor(e,t,o){super(e,o);this.accountName=t}hasAnyUsage(){return!!(this.queryService.authenticationUsageService.readAccountUsages(this.providerId,this.accountName).length>0||this.queryService.authenticationMcpUsageService.readAccountUsages(this.providerId,this.accountName).length>0||this.queryService.authenticationAccessService.readAllowedExtensions(this.providerId,this.accountName).some(r=>r.allowed!==!1)||this.queryService.authenticationMcpAccessService.readAllowedMcpServers(this.providerId,this.accountName).some(r=>r.allowed!==!1))}getEntityCount(){let e=this.queryService.authenticationUsageService.readAccountUsages(this.providerId,this.accountName),t=this.queryService.authenticationAccessService.readAllowedExtensions(this.providerId,this.accountName).filter(u=>u.allowed),o=new Set;e.forEach(u=>o.add(u.extensionId)),t.forEach(u=>o.add(u.id));let n=this.queryService.authenticationMcpUsageService.readAccountUsages(this.providerId,this.accountName),r=this.queryService.authenticationMcpAccessService.readAllowedMcpServers(this.providerId,this.accountName).filter(u=>u.allowed),s=new Set;n.forEach(u=>s.add(u.mcpServerId)),r.forEach(u=>s.add(u.id));let l=o.size,c=s.size;return{extensions:l,mcpServers:c,total:l+c}}removeAllAccess(){let e=new UXe(this.providerId,this.accountName,this.queryService),o=e.getAllowedExtensions().map(l=>l.id);o.length>0&&e.removeAccess(o);let n=new zXe(this.providerId,this.accountName,this.queryService),s=n.getAllowedMcpServers().map(l=>l.id);s.length>0&&n.removeAccess(s)}forEach(e){new UXe(this.providerId,this.accountName,this.queryService).forEach(n=>{e(n.extensionId,"extension")}),new zXe(this.providerId,this.accountName,this.queryService).forEach(n=>{e(n.mcpServerId,"mcpServer")})}},qFt=class extends lB{constructor(e,t,o){super(e,o);this.accountName=t}extension(e){return new HXe(this.providerId,this.accountName,e,this.queryService)}mcpServer(e){return new $Ft(this.providerId,this.accountName,e,this.queryService)}extensions(){return new UXe(this.providerId,this.accountName,this.queryService)}mcpServers(){return new zXe(this.providerId,this.accountName,this.queryService)}entities(){return new USi(this.providerId,this.accountName,this.queryService)}remove(){this.queryService.authenticationAccessService.removeAllowedExtensions(this.providerId,this.accountName),this.queryService.authenticationUsageService.removeAccountUsage(this.providerId,this.accountName),this.queryService.authenticationMcpAccessService.removeAllowedMcpServers(this.providerId,this.accountName),this.queryService.authenticationMcpUsageService.removeAccountUsage(this.providerId,this.accountName)}},jFt=class extends lB{constructor(e,t,o){super(e,o);this.extensionId=t}getPreferredAccount(){return this.queryService.authenticationExtensionsService.getAccountPreference(this.extensionId,this.providerId)}setPreferredAccount(e){this.queryService.authenticationExtensionsService.updateAccountPreference(this.extensionId,this.providerId,e)}removeAccountPreference(){this.queryService.authenticationExtensionsService.removeAccountPreference(this.extensionId,this.providerId)}},QFt=class extends lB{constructor(e,t,o){super(e,o);this.mcpServerId=t}async getLastUsedAccount(){try{let e=await this.queryService.authenticationService.getAccounts(this.providerId),t,o=0;for(let n of e){let s=this.queryService.authenticationMcpUsageService.readAccountUsages(this.providerId,n.label).filter(l=>l.mcpServerId===this.mcpServerId);for(let l of s)l.lastUsed>o&&(o=l.lastUsed,t=n.label)}return t}catch{return}}getPreferredAccount(){return this.queryService.authenticationMcpService.getAccountPreference(this.mcpServerId,this.providerId)}setPreferredAccount(e){this.queryService.authenticationMcpService.updateAccountPreference(this.mcpServerId,this.providerId,e)}removeAccountPreference(){this.queryService.authenticationMcpService.removeAccountPreference(this.mcpServerId,this.providerId)}async getUsedAccounts(){try{let e=await this.queryService.authenticationService.getAccounts(this.providerId),t=[];for(let o of e)this.queryService.authenticationMcpUsageService.readAccountUsages(this.providerId,o.label).some(r=>r.mcpServerId===this.mcpServerId)&&t.push(o.label);return t}catch{return[]}}},zSi=class extends lB{constructor(i,e){super(i,e)}account(i){return new qFt(this.providerId,i,this.queryService)}extension(i){return new jFt(this.providerId,i,this.queryService)}mcpServer(i){return new QFt(this.providerId,i,this.queryService)}async getActiveEntities(){let i=[],e=[];try{let t=await this.queryService.authenticationService.getAccounts(this.providerId);for(let o of t){let n=this.queryService.authenticationUsageService.readAccountUsages(this.providerId,o.label);for(let s of n)i.includes(s.extensionId)||i.push(s.extensionId);let r=this.queryService.authenticationMcpUsageService.readAccountUsages(this.providerId,o.label);for(let s of r)e.includes(s.mcpServerId)||e.push(s.mcpServerId)}}catch{}return{extensions:i,mcpServers:e}}async getAccountNames(){try{return(await this.queryService.authenticationService.getAccounts(this.providerId)).map(e=>e.label)}catch{return[]}}async getUsageStats(){let i=[],e=0,t=0;try{let o=await this.queryService.authenticationService.getAccounts(this.providerId);t=o.length;for(let n of o){let r=this.queryService.authenticationUsageService.readAccountUsages(this.providerId,n.label),s=this.queryService.authenticationMcpUsageService.readAccountUsages(this.providerId,n.label),l=[...r,...s],c=l.length,u=Math.max(...l.map(p=>p.lastUsed),0);c>0&&i.push({accountName:n.label,lastUsed:u,usageCount:c})}i.sort((n,r)=>r.lastUsed-n.lastUsed),e=i.reduce((n,r)=>n+r.usageCount,0)}catch{}return{totalSessions:e,totalAccounts:t,recentActivity:i}}async forEachAccount(i){try{let e=await this.queryService.authenticationService.getAccounts(this.providerId);for(let t of e){let o=new qFt(this.providerId,t.label,this.queryService);i(o)}}catch{}}},KSi=class{constructor(i,e){this.extensionId=i;this.queryService=e}async getProvidersWithAccess(i){let e=[],t=this.queryService.authenticationService.getProviderIds();for(let o of t)if(!(!i&&o.startsWith(dV)))try{(await this.queryService.authenticationService.getAccounts(o)).some(s=>this.queryService.authenticationAccessService.isAccessAllowed(o,s.label,this.extensionId)===!0)&&e.push(o)}catch{}return e}getAllAccountPreferences(i){let e=new Map,t=this.queryService.authenticationService.getProviderIds();for(let o of t){if(!i&&o.startsWith(dV))continue;let n=this.queryService.authenticationExtensionsService.getAccountPreference(this.extensionId,o);n&&e.set(o,n)}return e}provider(i){return new jFt(i,this.extensionId,this.queryService)}},GSi=class{constructor(i,e){this.mcpServerId=i;this.queryService=e}async getProvidersWithAccess(i){let e=[],t=this.queryService.authenticationService.getProviderIds();for(let o of t)if(!(!i&&o.startsWith(dV)))try{(await this.queryService.authenticationService.getAccounts(o)).some(s=>this.queryService.authenticationMcpAccessService.isAccessAllowed(o,s.label,this.mcpServerId)===!0)&&e.push(o)}catch{}return e}getAllAccountPreferences(i){let e=new Map,t=this.queryService.authenticationService.getProviderIds();for(let o of t){if(!i&&o.startsWith(dV))continue;let n=this.queryService.authenticationMcpService.getAccountPreference(this.mcpServerId,o);n&&e.set(o,n)}return e}provider(i){return new QFt(i,this.mcpServerId,this.queryService)}},BXe=class extends C{constructor(e,t,o,n,r,s,l,c){super();this.authenticationService=e;this.authenticationUsageService=t;this.authenticationMcpUsageService=o;this.authenticationAccessService=n;this.authenticationMcpAccessService=r;this.authenticationExtensionsService=s;this.authenticationMcpService=l;this.logService=c;this._onDidChangePreferences=this._register(new E);this.onDidChangePreferences=this._onDidChangePreferences.event;this._onDidChangeAccess=this._register(new E);this.onDidChangeAccess=this._onDidChangeAccess.event;this._register(this.authenticationExtensionsService.onDidChangeAccountPreference(u=>{this._onDidChangePreferences.fire({providerId:u.providerId,entityType:"extension",entityIds:u.extensionIds})})),this._register(this.authenticationMcpService.onDidChangeAccountPreference(u=>{this._onDidChangePreferences.fire({providerId:u.providerId,entityType:"mcpServer",entityIds:u.mcpServerIds})})),this._register(this.authenticationAccessService.onDidChangeExtensionSessionAccess(u=>{this._onDidChangeAccess.fire({providerId:u.providerId,accountName:u.accountName})})),this._register(this.authenticationMcpAccessService.onDidChangeMcpSessionAccess(u=>{this._onDidChangeAccess.fire({providerId:u.providerId,accountName:u.accountName})}))}provider(e){return new zSi(e,this)}extension(e){return new KSi(e,this)}mcpServer(e){return new GSi(e,this)}getProviderIds(e){return this.authenticationService.getProviderIds().filter(t=>e||!t.startsWith(dV))}async clearAllData(e,t=!0){if(e!=="CLEAR_ALL_AUTH_DATA")throw new Error("Must provide confirmation string to clear all authentication data");let o=this.getProviderIds(t);for(let n of o)try{let r=await this.authenticationService.getAccounts(n);for(let s of r)this.authenticationAccessService.removeAllowedExtensions(n,s.label),this.authenticationUsageService.removeAccountUsage(n,s.label),this.authenticationMcpAccessService.removeAllowedMcpServers(n,s.label),this.authenticationMcpUsageService.removeAccountUsage(n,s.label)}catch(r){this.logService.error(`Error clearing data for provider ${n}:`,r)}this.logService.info("All authentication data cleared")}};BXe=I([m(0,Cs),m(1,OP),m(2,Yde),m(3,Gx),m(4,Qde),m(5,DY),m(6,i7e),m(7,ne)],BXe);we(RR,BXe,1);var RK=_;var JDe=class extends Ma{constructor(e,t,o,n,r){super();this._keybindingService=t;this._configurationService=o;this._markdownRenderer=n;this._accessibilityService=r;this._messageListeners=new P;this._isDisposed=!1;this._forcePosition=!1;this._x=0;this._y=0;this._isLocked=!1;this._enableFocusTraps=!1;this._addedFocusTrap=!1;this._maxHeightRatioRelativeToWindow=.5;this._onDispose=this._register(new E);this._onRequestLayout=this._register(new E);if(this._linkHandler=e.linkHandler,this._target="targetElements"in e.target?e.target:new $Si(e.target),e.style)switch(e.style){case 1:{e.appearance??={},e.appearance.compact??=!0,e.appearance.showPointer??=!0;break}case 2:{e.appearance??={},e.appearance.compact??=!0;break}}this._hoverPointer=e.appearance?.showPointer?RK("div.workbench-hover-pointer"):void 0,this._hover=this._register(new e7(!e.appearance?.skipFadeInAnimation)),this._hover.containerDomNode.classList.add("workbench-hover"),e.appearance?.compact&&this._hover.containerDomNode.classList.add("workbench-hover","compact"),e.additionalClasses&&this._hover.containerDomNode.classList.add(...e.additionalClasses),e.position?.forcePosition&&(this._forcePosition=!0),e.trapFocus&&(this._enableFocusTraps=!0);let s=e.appearance?.maxHeightRatio;s!==void 0&&s>0&&s<=1&&(this._maxHeightRatioRelativeToWindow=s),this._hoverPosition=e.position?.hoverPosition===void 0?3:Xo(e.position.hoverPosition)?e.position.hoverPosition:2,this.onmousedown(this._hover.containerDomNode,g=>g.stopPropagation()),this.onkeydown(this._hover.containerDomNode,g=>{g.equals(9)&&this.dispose()}),this._register(j(this._targetWindow,"blur",()=>this.dispose()));let l=RK("div.hover-row.markdown-hover"),c=RK("div.hover-contents");if(typeof e.content=="string")c.textContent=e.content,c.style.whiteSpace="pre-wrap";else if(Ao(e.content))c.appendChild(e.content),c.classList.add("html-hover-contents");else{let g=e.content,{element:f}=this._register(this._markdownRenderer.render(g,{actionHandler:this._linkHandler,asyncRenderCallback:()=>{c.classList.add("code-hover-contents"),this.layout(),this._onRequestLayout.fire()}}));c.appendChild(f)}if(l.appendChild(c),this._hover.contentsDomNode.appendChild(l),e.actions&&e.actions.length>0){let g=RK("div.hover-row.status-bar"),f=RK("div.actions");e.actions.forEach(v=>{let b=this._keybindingService.lookupKeybinding(v.commandId),S=b?b.getLabel():null;this._register(t7.render(f,{label:v.label,commandId:v.commandId,run:y=>{v.run(y),this.dispose()},iconClass:v.iconClass},S))}),g.appendChild(f),this._hover.containerDomNode.appendChild(g)}this._hoverContainer=RK("div.workbench-hover-container"),this._hoverPointer&&this._hoverContainer.appendChild(this._hoverPointer),this._hoverContainer.appendChild(this._hover.containerDomNode);let u;if(e.actions&&e.actions.length>0?u=!1:e.persistence?.hideOnHover===void 0?u=typeof e.content=="string"||Mr(e.content)&&!e.content.value.includes("](")&&!e.content.value.includes("</a>"):u=e.persistence.hideOnHover,e.appearance?.showHoverHint){let g=RK("div.hover-row.status-bar"),f=RK("div.info");f.textContent=d(2100,null,it?"Option":"Alt"),g.appendChild(f),this._hover.containerDomNode.appendChild(g)}let p=[...this._target.targetElements];u||p.push(this._hoverContainer);let h=this._register(new YFt(p));if(this._register(h.onMouseOut(()=>{this._isLocked||this.dispose()})),u){let g=[...this._target.targetElements,this._hoverContainer];this._lockMouseTracker=this._register(new YFt(g)),this._register(this._lockMouseTracker.onMouseOut(()=>{this._isLocked||this.dispose()}))}else this._lockMouseTracker=h}get _targetWindow(){return Me(this._target.targetElements[0])}get _targetDocumentElement(){return Me(this._target.targetElements[0]).document.documentElement}get isDisposed(){return this._isDisposed}get isMouseIn(){return this._lockMouseTracker.isMouseIn}get domNode(){return this._hover.containerDomNode}get onDispose(){return this._onDispose.event}get onRequestLayout(){return this._onRequestLayout.event}get anchor(){return this._hoverPosition===2?0:1}get x(){return this._x}get y(){return this._y}get isLocked(){return this._isLocked}set isLocked(e){this._isLocked!==e&&(this._isLocked=e,this._hoverContainer.classList.toggle("locked",this._isLocked))}addMouseTrackingElement(e){return this._lockMouseTracker.addElement(e)}addFocusTrap(){if(!this._enableFocusTraps||this._addedFocusTrap)return;this._addedFocusTrap=!0;let e=this._hover.containerDomNode,t=this.findLastFocusableChild(this._hover.containerDomNode);if(t){let o=Sf(this._hoverContainer,RK("div")),n=R(this._hoverContainer,RK("div"));o.tabIndex=0,n.tabIndex=0,this._register(j(n,"focus",r=>{e.focus(),r.preventDefault()})),this._register(j(o,"focus",r=>{t.focus(),r.preventDefault()}))}}findLastFocusableChild(e){if(e.hasChildNodes())for(let t=0;t<e.childNodes.length;t++){let o=e.childNodes.item(e.childNodes.length-t-1);if(o.nodeType===o.ELEMENT_NODE){let r=o;if(typeof r.tabIndex=="number"&&r.tabIndex>=0)return r}let n=this.findLastFocusableChild(o);if(n)return n}}render(e){e.appendChild(this._hoverContainer);let o=this._hoverContainer.contains(this._hoverContainer.ownerDocument.activeElement)&&ESt(this._configurationService.getValue("accessibility.verbosity.hover")===!0&&this._accessibilityService.isScreenReaderOptimized(),this._keybindingService.lookupKeybinding("editor.action.accessibleView")?.getAriaLabel());o&&Or(o),this.layout(),this.addFocusTrap()}layout(){this._hover.containerDomNode.classList.remove("right-aligned"),this._hover.contentsDomNode.style.maxHeight="";let e=p=>{let h=_6(p),g=p.getBoundingClientRect();return{top:g.top*h,bottom:g.bottom*h,right:g.right*h,left:g.left*h}},t=this._target.targetElements.map(p=>e(p)),{top:o,right:n,bottom:r,left:s}=t[0],l=n-s,c=r-o,u={top:o,right:n,bottom:r,left:s,width:l,height:c,center:{x:s+l/2,y:o+c/2}};if(this.adjustHorizontalHoverPosition(u),this.adjustVerticalHoverPosition(u),this.adjustHoverMaxHeight(u),this._hoverContainer.style.padding="",this._hoverContainer.style.margin="",this._hoverPointer){switch(this._hoverPosition){case 1:u.left+=3,u.right+=3,this._hoverContainer.style.paddingLeft="3px",this._hoverContainer.style.marginLeft="-3px";break;case 0:u.left-=3,u.right-=3,this._hoverContainer.style.paddingRight="3px",this._hoverContainer.style.marginRight="-3px";break;case 2:u.top+=3,u.bottom+=3,this._hoverContainer.style.paddingTop="3px",this._hoverContainer.style.marginTop="-3px";break;case 3:u.top-=3,u.bottom-=3,this._hoverContainer.style.paddingBottom="3px",this._hoverContainer.style.marginBottom="-3px";break}u.center.x=u.left+l/2,u.center.y=u.top+c/2}this.computeXCordinate(u),this.computeYCordinate(u),this._hoverPointer&&(this._hoverPointer.classList.remove("top"),this._hoverPointer.classList.remove("left"),this._hoverPointer.classList.remove("right"),this._hoverPointer.classList.remove("bottom"),this.setHoverPointerPosition(u)),this._hover.onContentsChanged()}computeXCordinate(e){let t=this._hover.containerDomNode.clientWidth+2;this._target.x!==void 0?this._x=this._target.x:this._hoverPosition===1?this._x=e.right:this._hoverPosition===0?this._x=e.left-t:(this._hoverPointer?this._x=e.center.x-this._hover.containerDomNode.clientWidth/2:this._x=e.left,this._x+t>=this._targetDocumentElement.clientWidth&&(this._hover.containerDomNode.classList.add("right-aligned"),this._x=Math.max(this._targetDocumentElement.clientWidth-t-2,this._targetDocumentElement.clientLeft))),this._x<this._targetDocumentElement.clientLeft&&(this._x=e.left+2)}computeYCordinate(e){this._target.y!==void 0?this._y=this._target.y:this._hoverPosition===3?this._y=e.top:this._hoverPosition===2?this._y=e.bottom-2:this._hoverPointer?this._y=e.center.y+this._hover.containerDomNode.clientHeight/2:this._y=e.bottom,this._y>this._targetWindow.innerHeight&&(this._y=e.bottom)}adjustHorizontalHoverPosition(e){if(this._target.x!==void 0)return;let t=this._hoverPointer?3:0;if(this._forcePosition){let o=t+2;this._hoverPosition===1?this._hover.containerDomNode.style.maxWidth=`${this._targetDocumentElement.clientWidth-e.right-o}px`:this._hoverPosition===0&&(this._hover.containerDomNode.style.maxWidth=`${e.left-o}px`);return}this._hoverPosition===1?this._targetDocumentElement.clientWidth-e.right<this._hover.containerDomNode.clientWidth+t&&(e.left>=this._hover.containerDomNode.clientWidth+t?this._hoverPosition=0:this._hoverPosition=2):this._hoverPosition===0&&(e.left<this._hover.containerDomNode.clientWidth+t&&(this._targetDocumentElement.clientWidth-e.right>=this._hover.containerDomNode.clientWidth+t?this._hoverPosition=1:this._hoverPosition=2),e.left-this._hover.containerDomNode.clientWidth-t<=this._targetDocumentElement.clientLeft&&(this._hoverPosition=1))}adjustVerticalHoverPosition(e){if(this._target.y!==void 0||this._forcePosition)return;let t=this._hoverPointer?3:0;this._hoverPosition===3?e.top-this._hover.containerDomNode.clientHeight-t<0&&(this._hoverPosition=2):this._hoverPosition===2&&e.bottom+this._hover.containerDomNode.offsetHeight+t>this._targetWindow.innerHeight&&(this._hoverPosition=3)}adjustHoverMaxHeight(e){let t=this._targetWindow.innerHeight*this._maxHeightRatioRelativeToWindow;if(this._forcePosition){let o=(this._hoverPointer?3:0)+2;this._hoverPosition===3?t=Math.min(t,e.top-o):this._hoverPosition===2&&(t=Math.min(t,this._targetWindow.innerHeight-e.bottom-o))}if(this._hover.containerDomNode.style.maxHeight=`${t}px`,this._hover.contentsDomNode.clientHeight<this._hover.contentsDomNode.scrollHeight){let o=`${this._hover.scrollbar.options.verticalScrollbarSize}px`;this._hover.contentsDomNode.style.paddingRight!==o&&(this._hover.contentsDomNode.style.paddingRight=o)}}setHoverPointerPosition(e){if(this._hoverPointer)switch(this._hoverPosition){case 0:case 1:{this._hoverPointer.classList.add(this._hoverPosition===0?"right":"left");let t=this._hover.containerDomNode.clientHeight;t>e.height?this._hoverPointer.style.top=`${e.center.y-(this._y-t)-3}px`:this._hoverPointer.style.top=`${Math.round(t/2)-3}px`;break}case 3:case 2:{this._hoverPointer.classList.add(this._hoverPosition===3?"bottom":"top");let t=this._hover.containerDomNode.clientWidth,o=Math.round(t/2)-3,n=this._x+o;(n<e.left||n>e.right)&&(o=e.center.x-this._x-3),this._hoverPointer.style.left=`${o}px`;break}}}focus(){this._hover.containerDomNode.focus()}hide(){this.dispose()}dispose(){this._isDisposed||(this._onDispose.fire(),this._target.dispose?.(),this._hoverContainer.remove(),this._messageListeners.dispose(),super.dispose()),this._isDisposed=!0}};JDe=I([m(1,_e),m(2,B),m(3,Qn),m(4,Bi)],JDe);var YFt=class extends Ma{constructor(e,t=200){super();this._elements=e;this._eventDebounceDelay=t;this._isMouseIn=!0;this._mouseTimer=this._register(new me);this._onMouseOut=this._register(new E);for(let o of this._elements)this.onmouseover(o,()=>this._onTargetMouseOver()),this.onmouseleave(o,()=>this._onTargetMouseLeave())}get onMouseOut(){return this._onMouseOut.event}get isMouseIn(){return this._isMouseIn}_onTargetMouseOver(){this._isMouseIn=!0,this._mouseTimer.clear()}_onTargetMouseLeave(){this._isMouseIn=!1,this._mouseTimer.value=new Nl(()=>this._fireIfMouseOutside(),this._eventDebounceDelay)}_fireIfMouseOutside(){this._isMouseIn||this._onMouseOut.fire()}addElement(e){if(this._elements.includes(e))return C.None;this._elements.push(e);let t=new P;return t.add(j(e,re.MOUSE_OVER,()=>this._onTargetMouseOver())),t.add(j(e,re.MOUSE_LEAVE,()=>this._onTargetMouseLeave())),t.add(Z(()=>{let o=this._elements.indexOf(e);o>=0&&this._elements.splice(o,1)})),t}},$Si=class{constructor(i){this._element=i;this.targetElements=[this._element]}dispose(){}};var XFt=class{constructor(i,e,t){this.hoverDelegate=i;this.target=e;this.fadeInAnimation=t}onDidHide(){this._cancellationTokenSource&&(this._cancellationTokenSource.dispose(!0),this._cancellationTokenSource=void 0)}async update(i,e,t){if(this._cancellationTokenSource&&(this._cancellationTokenSource.dispose(!0),this._cancellationTokenSource=void 0),this.isDisposed)return;let o;if(Ae(i)||Ao(i)||i===void 0)o=i;else{this._cancellationTokenSource=new $e;let n=this._cancellationTokenSource.token,r;if(Dwe(i)?HD(i.markdown)?r=i.markdown(n).then(s=>s??i.markdownNotSupportedFallback):r=i.markdown??i.markdownNotSupportedFallback:r=i.element(n),r instanceof Promise?(this._hoverWidget||this.show(d(2101,null),e,t),o=await r):o=r,this.isDisposed||n.isCancellationRequested)return}this.show(o,e,t)}show(i,e,t){let o=this._hoverWidget;if(this.hasContent(i)){let n={content:i,target:this.target,actions:t?.actions,linkHandler:t?.linkHandler,trapFocus:t?.trapFocus,appearance:{showPointer:this.hoverDelegate.placement==="element",skipFadeInAnimation:!this.fadeInAnimation||!!o,showHoverHint:t?.appearance?.showHoverHint},position:{hoverPosition:2}};this._hoverWidget=this.hoverDelegate.showHover(n,e)}o?.dispose()}hasContent(i){return i?Mr(i)?!!i.value:!0:!1}get isDisposed(){return this._hoverWidget?.isDisposed}dispose(){this._hoverWidget?.dispose(),this._cancellationTokenSource?.dispose(!0),this._cancellationTokenSource=void 0}};var d4o=3,KXe=class extends C{constructor(e,t,o,n,r,s){super();this._instantiationService=e;this._configurationService=t;this._keybindingService=n;this._layoutService=r;this._accessibilityService=s;this._hoverStack=[];this._currentDelayedHoverWasShown=!1;this._delayedHovers=new Map;this._managedHovers=new Map;this._register(o.onDidShowContextMenu(()=>this.hideHover())),this._register(yt.registerCommandAndKeybindingRule({id:"workbench.action.showHover",weight:0,primary:Ai(2089,2087),handler:()=>{this._showAndFocusHoverForActiveElement()}}))}get _currentHover(){return this._hoverStack.at(-1)?.hover}get _currentHoverOptions(){return this._hoverStack.at(-1)?.options}_getContainingHoverIndex(e){let t=Ao(e)?[e]:e.targetElements;for(let o=this._hoverStack.length-1;o>=0;o--)for(let n of t)if(gs(n,this._hoverStack[o].hover.domNode))return o;return-1}showInstantHover(e,t,o,n){let r=this._createHover(e,o);if(r)return this._showHover(r,e,t),r.hover}showDelayedHover(e,t){if(e.id===void 0&&(e.id=eso(e.content)),!this._currentDelayedHover||this._currentDelayedHoverWasShown){if(this._currentHover?.isLocked)return;if(ZDe(this._currentHoverOptions)===ZDe(e))return this._currentHover;if(this._currentHover&&!this._currentHover.isDisposed&&this._currentDelayedHoverGroupId!==void 0&&this._currentDelayedHoverGroupId===t?.groupId)return this.showInstantHover({...e,appearance:{...e.appearance,skipFadeInAnimation:!0}})}else if(this._currentDelayedHover&&ZDe(this._currentHoverOptions)===ZDe(e))return this._currentDelayedHover;let o=this._createHover(e,void 0);if(!o){this._currentDelayedHover=void 0,this._currentDelayedHoverWasShown=!1,this._currentDelayedHoverGroupId=void 0;return}this._currentDelayedHover=o.hover,this._currentDelayedHoverWasShown=!1,this._currentDelayedHoverGroupId=t?.groupId;let n=t?.reducedDelay?this._configurationService.getValue("workbench.hover.reducedDelay"):this._configurationService.getValue("workbench.hover.delay");return Pi(n).then(()=>{o.hover&&!o.hover.isDisposed&&(this._currentDelayedHoverWasShown=!0,this._showHover(o,e))}),o.hover}setupDelayedHover(e,t,o){let n=r=>{let s={...typeof t=="function"?t():t,target:e};return s.style===2&&r&&(s.target=iso(e,r)),s};return this._setupDelayedHover(e,n,o)}setupDelayedHoverAtMouse(e,t,o){let n=r=>({...typeof t=="function"?t():t,target:r?iso(e,r):e});return this._setupDelayedHover(e,n,o)}_setupDelayedHover(e,t,o){let n=new P;return n.add(j(e,re.MOUSE_OVER,r=>{this.showDelayedHover(t(r),{groupId:o?.groupId,reducedDelay:o?.reducedDelay})})),o?.setupKeyboardEvents&&n.add(j(e,re.KEY_DOWN,r=>{let s=new Ii(r);(s.equals(10)||s.equals(3))&&this.showInstantHover(t(),!0)})),this._delayedHovers.set(e,{show:r=>{this.showInstantHover(t(),r)}}),n.add(Z(()=>this._delayedHovers.delete(e))),n}_createHover(e,t){if(this._currentDelayedHover?.dispose(),this._currentDelayedHover=void 0,e.content==="")return;if(e.id===void 0&&(e.id=eso(e.content)),this._getContainingHoverIndex(e.target)>=0){if(this._hoverStack.length>=d4o)return}else if(this._currentHover?.isLocked||ZDe(this._currentHoverOptions)===ZDe(e))return;this._lastHoverOptions=e;let r=e.trapFocus||this._accessibilityService.isScreenReaderOptimized(),s=Pn(),l;t||r&&s&&(s.classList.contains("monaco-hover")||(l=s));let c=new P,u=this._instantiationService.createInstance(JDe,e);if(e.persistence?.sticky&&(u.isLocked=!0),e.position?.hoverPosition&&!Xo(e.position.hoverPosition)&&(e.target={targetElements:Ao(e.target)?[e.target]:e.target.targetElements,x:e.position.hoverPosition.x+10}),u.onDispose(()=>{let p=this._hoverStack.findIndex(h=>h.hover===u);if(p>=0){let h=this._hoverStack[p];for(ts(u.domNode)&&h.lastFocusedElementBeforeOpen&&h.lastFocusedElementBeforeOpen.focus();this._hoverStack.length>p+1;){let f=this._hoverStack.pop();f.contextView.dispose(),f.hover.dispose()}this._hoverStack.splice(p,1),h.contextView.dispose()}c.dispose()},void 0,c),!e.container){let p=Ao(e.target)?e.target:e.target.targetElements[0];e.container=this._layoutService.getContainer(Me(p))}if(e.persistence?.sticky)c.add(j(Me(e.container).document,re.MOUSE_DOWN,p=>{gs(p.target,u.domNode)||this._hideHoverAndDescendants(u)}));else{if("targetElements"in e.target)for(let h of e.target.targetElements)c.add(j(h,re.CLICK,()=>this._hideHoverAndDescendants(u)));else c.add(j(e.target,re.CLICK,()=>this._hideHoverAndDescendants(u)));let p=Pn();if(p){let h=Me(p).document;c.add(j(p,re.KEY_DOWN,g=>this._keyDown(g,u,!!e.persistence?.hideOnKeyDown))),c.add(j(h,re.KEY_DOWN,g=>this._keyDown(g,u,!!e.persistence?.hideOnKeyDown))),c.add(j(p,re.KEY_UP,g=>this._keyUp(g,u))),c.add(j(h,re.KEY_UP,g=>this._keyUp(g,u)))}}if("IntersectionObserver"in It){let p=new IntersectionObserver(g=>this._intersectionChange(g,u),{threshold:0}),h="targetElements"in e.target?e.target.targetElements[0]:e.target;p.observe(h),c.add(Z(()=>p.disconnect()))}return{hover:u,lastFocusedElementBeforeOpen:l,store:c}}_showHover(e,t,o){let{hover:n,lastFocusedElementBeforeOpen:r,store:s}=e,l=this._getContainingHoverIndex(t.target),c=l>=0;if(!c)this._hideAllHovers();else{for(let f=this._hoverStack.length-1;f>l;f--)this._hoverStack[f].hover.dispose();this._hoverStack.length=l+1}if(c)for(let f=0;f<=l;f++)s.add(this._hoverStack[f].hover.addMouseTrackingElement(n.domNode));let u=t.container??this._layoutService.getContainer(Me(Ao(t.target)?t.target:t.target.targetElements[0])),p=new Oye(u,1),h={hover:n,options:t,contextView:p,lastFocusedElementBeforeOpen:r};this._hoverStack.push(h);let g=new jSi(n,o,this._hoverStack.length);p.show(g),s.add(n.onRequestLayout(()=>p.layout())),t.onDidShow?.()}_hideHoverAndDescendants(e){let t=this._hoverStack.findIndex(o=>o.hover===e);if(!(t<0)){for(let o=this._hoverStack.length-1;o>=t;o--)this._hoverStack[o].hover.dispose();this._hoverStack.length=t}}_hideAllHovers(){for(let e=this._hoverStack.length-1;e>=0;e--)this._hoverStack[e].hover.dispose();this._hoverStack.length=0}hideHover(e){this._hoverStack.length!==0&&(!e&&this._currentHover?.isLocked||this.doHideHover())}doHideHover(){let e=this._hoverStack.length;this._hoverStack[e-1]?.hover.dispose(),this._hoverStack.length=e-1}_intersectionChange(e,t){e[e.length-1].isIntersecting||t.dispose()}showAndFocusLastHover(){this._lastHoverOptions&&this.showInstantHover(this._lastHoverOptions,!0,!0)}_showAndFocusHoverForActiveElement(){let e=Pn();for(;e;){let t=this._delayedHovers.get(e)??this._managedHovers.get(e);if(t){t.show(!0);return}e=e.parentElement}}_keyDown(e,t,o){if(e.key==="Alt"){for(let s of this._hoverStack)s.hover.isLocked=!0;return}let n=new Ii(e);if(!(this._keybindingService.resolveKeyboardEvent(n).getSingleModifierDispatchChords().some(s=>!!s)||this._keybindingService.softDispatch(n,n.target).kind!==0)&&o&&(!this._currentHoverOptions?.trapFocus||e.key!=="Tab")){let s=this._hoverStack.find(l=>l.hover===t);this._hideHoverAndDescendants(t),s?.lastFocusedElementBeforeOpen?.focus()}}_keyUp(e,t){if(e.key==="Alt"){for(let n of this._hoverStack)n.options.persistence?.sticky||(n.hover.isLocked=!1);if(!this._hoverStack.some(n=>n.hover.isMouseIn)){let n=this._hoverStack[this._hoverStack.length-1];this._hideAllHovers(),n?.lastFocusedElementBeforeOpen?.focus()}}}setupManagedHover(e,t,o,n){if(e.showNativeHover)return u4o(t,o);t.setAttribute("custom-hover","true"),t.title!==""&&(console.warn("HTML element already has a title attribute, which will conflict with the custom hover. Please remove the title attribute."),t.title="");let r,s,l=(f,v)=>{let b=s!==void 0;f&&(s?.dispose(),s=void 0),v&&(r?.dispose(),r=void 0),b&&(e.onDidHideHover?.(),s=void 0)},c=(f,v,b,S)=>new Nl(async()=>{(!s||s.isDisposed)&&(s=new XFt(e,b||t,f>0),await s.update(typeof o=="function"?o():o,v,{...n,trapFocus:S}))},f),u=new P,p=!1;u.add(j(t,re.MOUSE_DOWN,()=>{p=!0,l(!0,!0)},!0)),u.add(j(t,re.MOUSE_UP,()=>{p=!1},!0)),u.add(j(t,re.MOUSE_LEAVE,f=>{p=!1,l(!1,f.fromElement===t)},!0)),u.add(j(t,re.MOUSE_OVER,f=>{if(r)return;let v=new P,b={targetElements:[t],dispose:()=>{}};if(e.placement===void 0||e.placement==="mouse"){let S=y=>{b.x=y.x+10,qSi(y,t)||l(!0,!0)};v.add(j(t,re.MOUSE_MOVE,S,!0))}r=v,qSi(f,t)&&v.add(c(typeof e.delay=="function"?e.delay(o):e.delay,!1,b))},!0));let h=f=>{if(p||r||!qSi(f,t))return;let v={targetElements:[t],dispose:()=>{}},b=new P,S=()=>l(!0,!0);b.add(j(t,re.BLUR,S,!0)),b.add(c(typeof e.delay=="function"?e.delay(o):e.delay,!1,v)),r=b};Oh(t)||u.add(j(t,re.FOCUS,h,!0));let g={show:f=>{l(!1,!0),c(0,f,void 0,f)},hide:()=>{l(!0,!0)},update:async(f,v)=>{o=f,await s?.update(o,void 0,v)},dispose:()=>{this._managedHovers.delete(t),u.dispose(),l(!0,!0)}};return this._managedHovers.set(t,g),g}showManagedHover(e){let t=this._managedHovers.get(e);t&&t.show(!0)}dispose(){this._managedHovers.forEach(e=>e.dispose()),super.dispose()}};KXe=I([m(0,F),m(1,B),m(2,ze),m(3,_e),m(4,nc),m(5,Bi)],KXe);function ZDe(a){if(a!==void 0)return a?.id??a}function eso(a){if(!Ao(a))return typeof a=="string"?a.toString():a.value}function tso(a){let i=typeof a=="function"?a():a;if(Ae(i))return fu(i);if(Dwe(i))return i.markdownNotSupportedFallback}function u4o(a,i){function e(t){t?a.setAttribute("title",t):a.removeAttribute("title")}return e(tso(i)),{update:t=>e(tso(t)),show:()=>{},hide:()=>{},dispose:()=>e(void 0)}}var jSi=class{constructor(i,e=!1,t=1){this._hover=i;this._focus=e;this.layer=t}get anchorPosition(){return this._hover.anchor}render(i){return this._hover.render(i),this._focus&&this._hover.focus(),this._hover}getAnchor(){return{x:this._hover.x,y:this._hover.y}}layout(){this._hover.layout()}};function qSi(a,i){return Ao(a.target)&&p4o(a.target,i)===i}function p4o(a,i){for(i=i??Me(a).document.body;!a.hasAttribute("custom-hover")&&a!==i;)a=a.parentElement;return a}function iso(a,i){return{targetElements:[a],x:i.x+10}}we(tt,KXe,1);is((a,i)=>{let e=a.getColor(OU);e&&(i.addRule(`.monaco-hover.workbench-hover .hover-row:not(:first-child):not(:empty) { border-top: 1px solid ${e.transparent(.5)}; }`),i.addRule(`.monaco-hover.workbench-hover hr { border-top: 1px solid ${e.transparent(.5)}; }`))});var QSi=class{constructor(){this._modifierObservables=new WeakMap}readModifierKeyStatus(i,e){let t=i instanceof Window?i:Me(i),o=this._modifierObservables.get(t);if(!o){let n=bf.getInstance();o=ui(this,n.event,()=>({ctrlKey:n.keyStatus.ctrlKey,shiftKey:n.keyStatus.shiftKey,altKey:n.keyStatus.altKey,metaKey:n.keyStatus.metaKey})),this._modifierObservables.set(t,o)}return o.read(e)}createFocusTracker(i,e){let t=e.add(Vn(i)),n=Le("isFocused",(r=>{if(r instanceof Window)return r.document.hasFocus();let s=r.getRootNode()instanceof ShadowRoot?r.getRootNode():null,l=s?s.activeElement:r.ownerDocument.activeElement;return r.contains(l)})(i));return e.add(t.onDidFocus(()=>n.set(!0,void 0))),e.add(t.onDidBlur(()=>n.set(!1,void 0))),n}createHoverTracker(i,e){let t=Le("isHovered",!1),o=()=>t.set(!0,void 0),n=()=>t.set(!1,void 0);return i.addEventListener("mouseenter",o),i.addEventListener("mouseleave",n),e.add({dispose:()=>{i.removeEventListener("mouseenter",o),i.removeEventListener("mouseleave",n)}}),t}createDomFocusTracker(i){return Vn(i)}};we(eC,QSi,1);var YSi=class{constructor(){this._factories=new Vs;this._onDidChange=new E;this.onDidChange=this._onDidChange.event}canCreateOutline(i){for(let e of this._factories)if(e.matches(i))return!0;return!1}async createOutline(i,e,t){for(let o of this._factories)if(o.matches(i))return await o.createOutline(i,e,t)}registerOutlineCreator(i){let e=this._factories.push(i);return this._onDidChange.fire(),Z(()=>{e(),this._onDidChange.fire()})}};we(kR,YSi,1);var m4o="diagnosticsService",eLe=ae(m4o);function RF(a){let i=a;return!!i?.hostName&&!!i?.errorMessage}var JFt=class a{static{this.CHANNEL_NAME="languageDetectionWorkerHost"}static getChannel(i){return i.getChannel(a.CHANNEL_NAME)}static setChannel(i,e){i.setChannel(a.CHANNEL_NAME,e)}};var ZFt=12,h4o=`${sN}/vscode-regexp-languagedetection`,g4o=`${b6}/vscode-regexp-languagedetection`,XSi=`${sN}/@vscode/vscode-languagedetection`,JSi=`${b6}/@vscode/vscode-languagedetection`,eA=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this._environmentService=e;this._configurationService=o;this._diagnosticsService=n;this._workspaceContextService=r;this._editorService=l;this._logService=p;this.hasResolvedWorkspaceLanguageIds=!1;this.workspaceLanguageIds=new Set;this.sessionOpenedLanguageIds=new Set;this.historicalGlobalOpenedLanguageIds=new il(ZFt);this.historicalWorkspaceOpenedLanguageIds=new il(ZFt);this.dirtyBiases=!0;this.langBiases={};let g=Dz&&this._environmentService.isBuilt&&!Gt;this._languageDetectionWorkerClient=this._register(new ZSi(s,t,c,h,g?gn.asBrowserUri(`${JSi}/dist/lib/index.js`).toString(!0):gn.asBrowserUri(`${XSi}/dist/lib/index.js`).toString(!0),g?gn.asBrowserUri(`${JSi}/model/model.json`).toString(!0):gn.asBrowserUri(`${XSi}/model/model.json`).toString(!0),g?gn.asBrowserUri(`${JSi}/model/group1-shard1of1.bin`).toString(!0):gn.asBrowserUri(`${XSi}/model/group1-shard1of1.bin`).toString(!0),g?gn.asBrowserUri(`${g4o}/dist/index.js`).toString(!0):gn.asBrowserUri(`${h4o}/dist/index.js`).toString(!0))),this.initEditorOpenedListeners(u)}static{this.enablementSettingKey="workbench.editor.languageDetection"}static{this.historyBasedEnablementConfig="workbench.editor.historyBasedLanguageDetection"}static{this.preferHistoryConfig="workbench.editor.preferHistoryBasedLanguageDetection"}static{this.workspaceOpenedLanguagesStorageKey="workbench.editor.languageDetectionOpenedLanguages.workspace"}static{this.globalOpenedLanguagesStorageKey="workbench.editor.languageDetectionOpenedLanguages.global"}async resolveWorkspaceLanguageIds(){if(this.hasResolvedWorkspaceLanguageIds)return;this.hasResolvedWorkspaceLanguageIds=!0;let e=await this._diagnosticsService.getWorkspaceFileExtensions(this._workspaceContextService.getWorkspace()),t=0;for(let o of e.extensions){let n=this._languageDetectionWorkerClient.getLanguageId(o);if(n&&t<ZFt&&(this.workspaceLanguageIds.add(n),t++,t>ZFt))break}this.dirtyBiases=!0}isEnabledForLanguage(e){return!!e&&this._configurationService.getValue(eA.enablementSettingKey,{overrideIdentifier:e})}getLanguageBiases(){if(!this.dirtyBiases)return this.langBiases;let e={};return this.sessionOpenedLanguageIds.forEach(t=>e[t]=(e[t]??0)+7),this.workspaceLanguageIds.forEach(t=>e[t]=(e[t]??0)+5),[...this.historicalWorkspaceOpenedLanguageIds.keys()].forEach(t=>e[t]=(e[t]??0)+3),[...this.historicalGlobalOpenedLanguageIds.keys()].forEach(t=>e[t]=(e[t]??0)+1),this._logService.trace("Session Languages:",JSON.stringify([...this.sessionOpenedLanguageIds])),this._logService.trace("Workspace Languages:",JSON.stringify([...this.workspaceLanguageIds])),this._logService.trace("Historical Workspace Opened Languages:",JSON.stringify([...this.historicalWorkspaceOpenedLanguageIds.keys()])),this._logService.trace("Historical Globally Opened Languages:",JSON.stringify([...this.historicalGlobalOpenedLanguageIds.keys()])),this._logService.trace("Computed Language Detection Biases:",JSON.stringify(e)),this.dirtyBiases=!1,this.langBiases=e,e}async detectLanguage(e,t){let o=this._configurationService.getValue(eA.historyBasedEnablementConfig),n=this._configurationService.getValue(eA.preferHistoryConfig);o&&await this.resolveWorkspaceLanguageIds();let r=o?this.getLanguageBiases():void 0;return this._languageDetectionWorkerClient.detectLanguage(e,r,n,t)}initEditorOpenedListeners(e){try{let t=JSON.parse(e.get(eA.globalOpenedLanguagesStorageKey,0,"[]"));this.historicalGlobalOpenedLanguageIds.fromJSON(t)}catch(t){console.error(t)}try{let t=JSON.parse(e.get(eA.workspaceOpenedLanguagesStorageKey,1,"[]"));this.historicalWorkspaceOpenedLanguageIds.fromJSON(t)}catch(t){console.error(t)}this._register(this._editorService.onDidActiveEditorChange(()=>{let t=this._editorService.activeTextEditorLanguageId;t&&this._editorService.activeEditor?.resource?.scheme!==Y.untitled&&(this.sessionOpenedLanguageIds.add(t),this.historicalGlobalOpenedLanguageIds.set(t,!0),this.historicalWorkspaceOpenedLanguageIds.set(t,!0),e.store(eA.globalOpenedLanguagesStorageKey,JSON.stringify(this.historicalGlobalOpenedLanguageIds.toJSON()),0,1),e.store(eA.workspaceOpenedLanguagesStorageKey,JSON.stringify(this.historicalWorkspaceOpenedLanguageIds.toJSON()),1,1),this.dirtyBiases=!0)}))}};eA=I([m(0,Vt),m(1,kt),m(2,B),m(3,eLe),m(4,Pe),m(5,Ct),m(6,ee),m(7,Te),m(8,le),m(9,ne),m(10,Ay)],eA);var ZSi=class extends C{constructor(e,t,o,n,r,s,l,c){super();this._modelService=e;this._languageService=t;this._telemetryService=o;this._webWorkerService=n;this._indexJsUri=r;this._modelJsonUri=s;this._weightsUri=l;this._regexpModelUri=c}_getOrCreateLanguageDetectionWorker(){if(!this.worker){let e=this._register(this._webWorkerService.createWorkerClient(new gx({esmModuleLocation:gn.asBrowserUri("vs/workbench/services/languageDetection/browser/languageDetectionWebWorkerMain.js"),label:"LanguageDetectionWorker"})));JFt.setChannel(e,{$getIndexJsUri:async()=>this.getIndexJsUri(),$getLanguageId:async o=>this.getLanguageId(o),$sendTelemetryEvent:async(o,n,r)=>this.sendTelemetryEvent(o,n,r),$getRegexpModelUri:async()=>this.getRegexpModelUri(),$getModelJsonUri:async()=>this.getModelJsonUri(),$getWeightsUri:async()=>this.getWeightsUri()});let t=this._register(Z6.create(e,this._modelService));this.worker={workerClient:e,workerTextModelSyncClient:t}}return this.worker}_guessLanguageIdByUri(e){let t=this._languageService.guessLanguageIdByFilepathOrFirstLine(e);if(t&&t!=="unknown")return t}async getIndexJsUri(){return this._indexJsUri}getLanguageId(e){if(!e)return;if(this._languageService.isRegisteredLanguageId(e))return e;let t=this._guessLanguageIdByUri(A.file(`file.${e}`));if(!(!t||t==="unknown"))return t}async getModelJsonUri(){return this._modelJsonUri}async getWeightsUri(){return this._weightsUri}async getRegexpModelUri(){return this._regexpModelUri}async sendTelemetryEvent(e,t,o){this._telemetryService.publicLog2(J7i,{languages:e.join(","),confidences:t.join(","),timeSpent:o})}async detectLanguage(e,t,o,n){let r=Date.now(),s=this._guessLanguageIdByUri(e);if(s)return s;let{workerClient:l,workerTextModelSyncClient:c}=this._getOrCreateLanguageDetectionWorker();c.ensureSyncedResources([e]);let u=await l.proxy.$detectLanguage(e.toString(),t,o,n),p=this.getLanguageId(u);return this._telemetryService.publicLog2("automaticlanguagedetection.perf",{timeSpent:Date.now()-r,detection:p||"unknown"}),p}};we(eS,eA,0);var eIi=class{constructor(){this.referenceProvider=new cd(this._score.bind(this));this.renameProvider=new cd(this._score.bind(this));this.newSymbolNamesProvider=new cd(this._score.bind(this));this.codeActionProvider=new cd(this._score.bind(this));this.definitionProvider=new cd(this._score.bind(this));this.typeDefinitionProvider=new cd(this._score.bind(this));this.declarationProvider=new cd(this._score.bind(this));this.implementationProvider=new cd(this._score.bind(this));this.documentSymbolProvider=new cd(this._score.bind(this));this.inlayHintsProvider=new cd(this._score.bind(this));this.colorProvider=new cd(this._score.bind(this));this.codeLensProvider=new cd(this._score.bind(this));this.documentFormattingEditProvider=new cd(this._score.bind(this));this.documentRangeFormattingEditProvider=new cd(this._score.bind(this));this.onTypeFormattingEditProvider=new cd(this._score.bind(this));this.signatureHelpProvider=new cd(this._score.bind(this));this.hoverProvider=new cd(this._score.bind(this));this.documentHighlightProvider=new cd(this._score.bind(this));this.multiDocumentHighlightProvider=new cd(this._score.bind(this));this.selectionRangeProvider=new cd(this._score.bind(this));this.foldingRangeProvider=new cd(this._score.bind(this));this.linkProvider=new cd(this._score.bind(this));this.inlineCompletionsProvider=new cd(this._score.bind(this));this.completionProvider=new cd(this._score.bind(this));this.linkedEditingRangeProvider=new cd(this._score.bind(this));this.inlineValuesProvider=new cd(this._score.bind(this));this.evaluatableExpressionProvider=new cd(this._score.bind(this));this.documentRangeSemanticTokensProvider=new cd(this._score.bind(this));this.documentSemanticTokensProvider=new cd(this._score.bind(this));this.documentDropEditProvider=new cd(this._score.bind(this));this.documentPasteEditProvider=new cd(this._score.bind(this))}setNotebookTypeResolver(i){this._notebookTypeResolver=i}_score(i){return this._notebookTypeResolver?.(i)}};we(zt,eIi,1);var GXe=class extends C{constructor(e,t,o){super();this._themeService=e;this._logService=t;this._languageService=o;this._caches=new WeakMap,this._register(this._themeService.onDidColorThemeChange(()=>{this._caches=new WeakMap}))}getStyling(e){return this._caches.has(e)||this._caches.set(e,new JCe(e.getLegend(),this._themeService,this._languageService,this._logService)),this._caches.get(e)}};GXe=I([m(0,De),m(1,ne),m(2,kt)],GXe);we(Ale,GXe,1);var f4=ae("textMateTokenizationFeature");var e0t=class extends C{constructor(e,t,o,n,r,s,l){super();this._grammar=e;this._initialState=t;this._containsEmbeddedLanguages=o;this._createBackgroundTokenizer=n;this._backgroundTokenizerShouldOnlyVerifyTokens=r;this._reportTokenizationTime=s;this._reportSlowTokenization=l;this._seenLanguages=[];this._onDidEncounterLanguage=this._register(new E)}get onDidEncounterLanguage(){return this._onDidEncounterLanguage.event}get backgroundTokenizerShouldOnlyVerifyTokens(){return this._backgroundTokenizerShouldOnlyVerifyTokens()}getInitialState(){return this._initialState}tokenize(e,t,o){throw new Error("Not supported!")}createBackgroundTokenizer(e,t){if(this._createBackgroundTokenizer)return this._createBackgroundTokenizer(e,t)}tokenizeEncoded(e,t,o){let n=Math.random()*1e4<1,r=this._reportSlowTokenization||n,s=r?new En(!0):void 0,l=this._grammar.tokenizeLine2(e,o,500);if(r){let u=s.elapsed();(n||u>32)&&this._reportTokenizationTime(u,e.length,n)}if(l.stoppedEarly)return console.warn(`Time limit reached when tokenizing line: ${e.substring(0,100)}`),new fse(l.tokens,l.fonts,o);if(this._containsEmbeddedLanguages){let u=this._seenLanguages,p=l.tokens;for(let h=0,g=p.length>>>1;h<g;h++){let f=p[(h<<1)+1],v=Qu.getLanguageId(f);u[v]||(u[v]=!0,this._onDidEncounterLanguage.fire(v))}}let c;return o.equals(l.ruleStack)?c=o:c=l.ruleStack,new fse(l.tokens,l.fonts,c)}};var t0t=class extends C{constructor(e,t,o,n){super();this._encodedLanguageId=e;this._actual=t;this._maxTokenizationLineLength=n;this._register(lU(this._maxTokenizationLineLength)),this._register(o)}get backgroundTokenizerShouldOnlyVerifyTokens(){return this._actual.backgroundTokenizerShouldOnlyVerifyTokens}getInitialState(){return this._actual.getInitialState()}tokenize(e,t,o){throw new Error("Not supported!")}tokenizeEncoded(e,t,o){return e.length>=this._maxTokenizationLineLength.get()?bye(this._encodedLanguageId,o):this._actual.tokenizeEncoded(e,t,o)}createBackgroundTokenizer(e,t){if(this._actual.createBackgroundTokenizer)return this._actual.createBackgroundTokenizer(e,t)}};var i0t=class a{static{this.CHANNEL_NAME="textMateWorkerHost"}static getChannel(i){return i.getChannel(a.CHANNEL_NAME)}static setChannel(i,e){i.setChannel(a.CHANNEL_NAME,e)}};var $Xe=class a{constructor(i){this.transformation=i;this.idx=0;this.offset=0}static fromMany(i){let e=i.map(t=>new a(t));return new tIi(e)}transform(i){let e=this.transformation.replacements.at(this.idx);for(;e&&e.replaceRange.endExclusive<=i;)this.offset+=e.getLengthDelta(),this.idx++,e=this.transformation.replacements.at(this.idx);if(!(e&&e.replaceRange.start<=i))return i+this.offset}},tIi=class{constructor(i){this.transformers=i}transform(i){for(let e of this.transformers){let t=e.transform(i);if(t===void 0)return;i=t}return i}};var o0t=class a extends C{constructor(e,t,o,n,r,s){super();this._model=e;this._worker=t;this._languageIdCodec=o;this._backgroundTokenizationStore=n;this._configurationService=r;this._maxTokenizationLineLength=s;this.controllerId=a._id++,this._pendingChanges=[],this._states=new Oqe,this._loggingEnabled=pr("editor.experimental.asyncTokenizationLogging",!1,this._configurationService),this._register(lU(this._loggingEnabled)),this._register(this._model.onDidChangeContent(u=>{this._shouldLog&&console.log("model change",{fileName:this._model.uri.fsPath.split("\\").pop(),changes:iIi(u.changes)}),this._worker.$acceptModelChanged(this.controllerId,u),this._pendingChanges.push(u)})),this._register(this._model.onDidChangeLanguage(u=>{let p=this._model.getLanguageId(),h=this._languageIdCodec.encodeLanguageId(p);this._worker.$acceptModelLanguageChanged(this.controllerId,p,h)}));let l=this._model.getLanguageId(),c=this._languageIdCodec.encodeLanguageId(l);this._worker.$acceptNewModel({uri:this._model.uri,versionId:this._model.getVersionId(),lines:this._model.getLinesContent(),EOL:this._model.getEOL(),languageId:l,encodedLanguageId:c,maxTokenizationLineLength:this._maxTokenizationLineLength.get(),controllerId:this.controllerId}),this._register(he(u=>{let p=this._maxTokenizationLineLength.read(u);this._worker.$acceptMaxTokenizationLineLength(this.controllerId,p)}))}static{this._id=0}dispose(){super.dispose(),this._worker.$acceptRemovedModel(this.controllerId)}requestTokens(e,t){this._worker.$retokenize(this.controllerId,e,t)}async setTokensAndStates(e,t,o,n,r){if(this.controllerId!==e)return;let s=t1.deserialize(new Uint8Array(o)),l=fye.deserialize(n,Vqi());if(this._shouldLog&&console.log("received background tokenization result",{fileName:this._model.uri.fsPath.split("\\").pop(),updatedTokenLines:s.map(u=>u.getLineRange()).join(" & "),updatedStateLines:r.map(u=>new ro(u.startLineNumber,u.startLineNumber+u.stateDeltas.length).toString()).join(" & ")}),this._shouldLog){let u=this._pendingChanges.filter(p=>p.versionId<=t).map(p=>p.changes).map(p=>iIi(p)).join(" then ");console.log("Applying changes to local states",u)}for(;this._pendingChanges.length>0&&this._pendingChanges[0].versionId<=t;){let u=this._pendingChanges.shift();this._states.acceptChanges(u.changes)}if(this._pendingChanges.length>0){if(this._shouldLog){let h=this._pendingChanges.map(g=>g.changes).map(g=>iIi(g)).join(" then ");console.log("Considering non-processed changes",h)}let u=$Xe.fromMany(this._pendingChanges.map(h=>tei(h.changes))),p=new t1;for(let h of s)for(let g=h.startLineNumber;g<=h.endLineNumber;g++)u.transform(g-1)!==void 0&&p.add(g,h.getLineTokens(g));s=p.finalize();for(let h of this._pendingChanges)for(let g of h.changes)for(let f=0;f<s.length;f++)s[f].applyEdit(g.range,g.text);l.rebase(this._stringEditFromChanges(this._model,this._pendingChanges))}let c=$Xe.fromMany(this._pendingChanges.map(u=>tei(u.changes)));if(!this._applyStateStackDiffFn||!this._initialState){let{applyStateStackDiff:u,INITIAL:p}=await bg("vscode-textmate","release/main.js");this._applyStateStackDiffFn=u,this._initialState=p}for(let u of r){let p=u.startLineNumber<=1?this._initialState:this._states.getEndState(u.startLineNumber-1);for(let h=0;h<u.stateDeltas.length;h++){let g=u.stateDeltas[h],f;g?(f=this._applyStateStackDiffFn(p,g),this._states.setEndState(u.startLineNumber+h,f)):f=this._states.getEndState(u.startLineNumber+h);let v=c.transform(u.startLineNumber+h-1);v!==void 0&&this._backgroundTokenizationStore.setEndState(v+1,f),u.startLineNumber+h>=this._model.getLineCount()-1&&this._backgroundTokenizationStore.backgroundTokenizationFinished(),p=f}}this._backgroundTokenizationStore.setTokens(s),this._backgroundTokenizationStore.setFontInfo(l)}_stringEditFromChanges(e,t){let o=[];for(let n of t)for(let r of n.changes){let s=z.lift(r.range),l=r.text,c=e.getOffsetAt(s.getStartPosition()),u=e.getOffsetAt(s.getEndPosition());o.push(Qc.replace(new di(c,u),l))}return Qc.compose(o)}get _shouldLog(){return this._loggingEnabled.get()}};function iIi(a){return a.map(i=>z.lift(i.range).toString()+" => "+i.text).join(" & ")}var v4=class{constructor(i,e,t,o,n,r,s,l,c){this._reportTokenizationTime=i;this._shouldTokenizeAsync=e;this._extensionResourceLoaderService=t;this._configurationService=o;this._languageService=n;this._environmentService=r;this._notificationService=s;this._telemetryService=l;this._webWorkerService=c;this._workerProxyPromise=null;this._worker=null;this._workerProxy=null;this._workerTokenizerControllers=new Map;this._currentTheme=null;this._currentTokenColorMap=null;this._grammarDefinitions=[]}static{this._reportedMismatchingTokens=!1}dispose(){this._disposeWorker()}createBackgroundTokenizer(i,e,t){if(!this._shouldTokenizeAsync()||i.isTooLargeForSyncing())return;let o=new P,n=this._getWorkerProxy().then(r=>{if(o.isDisposed||!r)return;let s={controller:void 0,worker:this._worker};return o.add(f4o(i,()=>{let l=new o0t(i,r,this._languageService.languageIdCodec,e,this._configurationService,t);return s.controller=l,this._workerTokenizerControllers.set(l.controllerId,l),Z(()=>{s.controller=void 0,this._workerTokenizerControllers.delete(l.controllerId),l.dispose()})})),s});return{dispose(){o.dispose()},requestTokens:async(r,s)=>{let l=await n;l?.controller&&l.worker===this._worker&&l.controller.requestTokens(r,s)},reportMismatchingTokens:r=>{v4._reportedMismatchingTokens||(v4._reportedMismatchingTokens=!0,this._notificationService.error({message:"Async Tokenization Token Mismatch in line "+r,name:"Async Tokenization Token Mismatch"}),this._telemetryService.publicLog2("asyncTokenizationMismatchingTokens",{}))}}}setGrammarDefinitions(i){this._grammarDefinitions=i,this._disposeWorker()}acceptTheme(i,e){this._currentTheme=i,this._currentTokenColorMap=e,this._currentTheme&&this._currentTokenColorMap&&this._workerProxy&&this._workerProxy.$acceptTheme(this._currentTheme,this._currentTokenColorMap)}_getWorkerProxy(){return this._workerProxyPromise||(this._workerProxyPromise=this._createWorkerProxy()),this._workerProxyPromise}async _createWorkerProxy(){let i=`${sN}/vscode-oniguruma`,e=`${b6}/vscode-oniguruma`,n=`${Dz&&this._environmentService.isBuilt&&!Gt?e:i}/release/onig.wasm`,r={grammarDefinitions:this._grammarDefinitions,onigurumaWASMUri:gn.asBrowserUri(n).toString(!0)},s=this._worker=this._webWorkerService.createWorkerClient(new gx({esmModuleLocation:gn.asBrowserUri("vs/workbench/services/textMate/browser/backgroundTokenization/worker/textMateTokenizationWorker.workerMain.js"),label:"TextMateWorker"}));return i0t.setChannel(s,{$readFile:async l=>{let c=A.revive(l);return this._extensionResourceLoaderService.readExtensionResource(c)},$setTokensAndStates:async(l,c,u,p,h)=>{let g=this._workerTokenizerControllers.get(l);g&&g.setTokensAndStates(l,c,u,p,h)},$reportTokenizationTime:(l,c,u,p,h)=>{this._reportTokenizationTime(l,c,u,p,h)}}),await s.proxy.$init(r),this._worker!==s?null:(this._workerProxy=s.proxy,this._currentTheme&&this._currentTokenColorMap&&this._workerProxy.$acceptTheme(this._currentTheme,this._currentTokenColorMap),s.proxy)}_disposeWorker(){for(let i of this._workerTokenizerControllers.values())i.dispose();this._workerTokenizerControllers.clear(),this._worker&&(this._worker.dispose(),this._worker=null),this._workerProxy=null,this._workerProxyPromise=null}};v4=I([m(2,Bx),m(3,B),m(4,kt),m(5,Co),m(6,Ne),m(7,Te),m(8,Ay)],v4);function f4o(a,i){let e=new P,t=e.add(new P);function o(){a.isAttachedToEditor()?t.add(i()):t.clear()}return o(),e.add(a.onDidChangeAttached(()=>{o()})),e}var n0t=class{constructor(){this._scopeNameToLanguageRegistration=Object.create(null)}reset(){this._scopeNameToLanguageRegistration=Object.create(null)}register(i){if(this._scopeNameToLanguageRegistration[i.scopeName]){let e=this._scopeNameToLanguageRegistration[i.scopeName];Xe(e.location,i.location)||console.warn(`Overwriting grammar scope name to file mapping for scope ${i.scopeName}.
Old grammar file: ${e.location.toString()}.
New grammar file: ${i.location.toString()}`)}this._scopeNameToLanguageRegistration[i.scopeName]=i}getGrammarDefinition(i){return this._scopeNameToLanguageRegistration[i]||null}};var qXe="No TM Grammar registered for this language.",r0t=class extends C{constructor(i,e,t,o){super(),this._host=i,this._initialState=t.INITIAL,this._scopeRegistry=new n0t,this._injections={},this._injectedEmbeddedLanguages={},this._languageToScope=new Map,this._grammarRegistry=this._register(new t.Registry({onigLib:o,loadGrammar:async n=>{let r=this._scopeRegistry.getGrammarDefinition(n);if(!r)return this._host.logTrace(`No grammar found for scope ${n}`),null;let s=r.location;try{let l=await this._host.readFile(s);return t.parseRawGrammar(l,s.path)}catch(l){return this._host.logError(`Unable to load and parse grammar for scope ${n} from ${s}`,l),null}},getInjections:n=>{let r=n.split("."),s=[];for(let l=1;l<=r.length;l++){let c=r.slice(0,l).join(".");s=[...s,...this._injections[c]||[]]}return s}}));for(let n of e){if(this._scopeRegistry.register(n),n.injectTo){for(let r of n.injectTo){let s=this._injections[r];s||(this._injections[r]=s=[]),s.push(n.scopeName)}if(n.embeddedLanguages)for(let r of n.injectTo){let s=this._injectedEmbeddedLanguages[r];s||(this._injectedEmbeddedLanguages[r]=s=[]),s.push(n.embeddedLanguages)}}n.language&&this._languageToScope.set(n.language,n.scopeName)}}has(i){return this._languageToScope.has(i)}setTheme(i,e){this._grammarRegistry.setTheme(i,e)}getColorMap(){return this._grammarRegistry.getColorMap()}async createGrammar(i,e){let t=this._languageToScope.get(i);if(typeof t!="string")throw new Error(qXe);let o=this._scopeRegistry.getGrammarDefinition(t);if(!o)throw new Error(qXe);let n=o.embeddedLanguages;if(this._injectedEmbeddedLanguages[t]){let l=this._injectedEmbeddedLanguages[t];for(let c of l)for(let u of Object.keys(c))n[u]=c[u]}let r=Object.keys(n).length>0,s;try{s=await this._grammarRegistry.loadGrammarWithConfiguration(t,e,{embeddedLanguages:n,tokenTypes:o.tokenTypes,balancedBracketSelectors:o.balancedBracketSelectors,unbalancedBracketSelectors:o.unbalancedBracketSelectors})}catch(l){throw l.message&&l.message.startsWith("No grammar provided for")?new Error(qXe):l}return{languageId:i,grammar:s,initialState:this._initialState,containsEmbeddedLanguages:r,sourceExtensionId:o.sourceExtensionId}}};var cB=Tn.registerExtensionPoint({extensionPoint:"grammars",deps:[C5],jsonSchema:{description:d(17255,null),type:"array",defaultSnippets:[{body:[{language:"${1:id}",scopeName:"source.${2:id}",path:"./syntaxes/${3:id}.tmLanguage."}]}],items:{type:"object",defaultSnippets:[{body:{language:"${1:id}",scopeName:"source.${2:id}",path:"./syntaxes/${3:id}.tmLanguage."}}],properties:{language:{description:d(17259,null),type:"string"},scopeName:{description:d(17261,null),type:"string"},path:{description:d(17260,null),type:"string"},embeddedLanguages:{description:d(17257,null),type:"object"},tokenTypes:{description:d(17262,null),type:"object",additionalProperties:{enum:["string","comment","other"]}},injectTo:{description:d(17258,null),type:"array",items:{type:"string"}},balancedBracketScopes:{description:d(17256,null),type:"array",items:{type:"string"},default:["*"]},unbalancedBracketScopes:{description:d(17263,null),type:"array",items:{type:"string"},default:[]}},required:["scopeName","path"]}}});var dB=class extends C{constructor(e,t,o,n,r,s,l,c,u,p){super();this._languageService=e;this._themeService=t;this._extensionResourceLoaderService=o;this._notificationService=n;this._logService=r;this._configurationService=s;this._progressService=l;this._environmentService=c;this._instantiationService=u;this._telemetryService=p;this._createdModes=[],this._encounteredLanguages=[],this._debugMode=!1,this._debugModePrintFunc=()=>{},this._grammarDefinitions=null,this._grammarFactory=null,this._tokenizersRegistrations=this._register(new P),this._currentTheme=null,this._currentTokenColorMap=null,this._currentTokenFontMap=null,this._threadedBackgroundTokenizerFactory=this._instantiationService.createInstance(v4,(h,g,f,v,b)=>this._reportTokenizationTime(h,g,f,v,!0,b),()=>this.getAsyncTokenizationEnabled()),this._vscodeOniguruma=null,this._styleElement=hr(),this._styleElement.className="vscode-tokens-styles",cB.setHandler(h=>this._handleGrammarsExtPoint(h)),this._updateTheme(this._themeService.getColorTheme(),!0),this._register(this._themeService.onDidColorThemeChange(()=>{this._updateTheme(this._themeService.getColorTheme(),!1)})),this._register(this._languageService.onDidRequestRichLanguageFeatures(h=>{this._createdModes.push(h)}))}static{this.reportTokenizationTimeCounter={sync:0,async:0}}getAsyncTokenizationEnabled(){return!!this._configurationService.getValue("editor.experimental.asyncTokenization")}getAsyncTokenizationVerification(){return!!this._configurationService.getValue("editor.experimental.asyncTokenizationVerification")}_handleGrammarsExtPoint(e){this._grammarDefinitions=null,this._grammarFactory&&(this._grammarFactory.dispose(),this._grammarFactory=null),this._tokenizersRegistrations.clear(),this._grammarDefinitions=[];for(let t of e){let o=t.value;for(let n of o){let r=this._validateGrammarDefinition(t,n);if(r&&(this._grammarDefinitions.push(r),r.language)){let s=new Nht(()=>this._createTokenizationSupport(r.language));this._tokenizersRegistrations.add(s),this._tokenizersRegistrations.add(kc.registerFactory(r.language,s))}}}this._threadedBackgroundTokenizerFactory.setGrammarDefinitions(this._grammarDefinitions);for(let t of this._createdModes)kc.getOrCreate(t)}_validateGrammarDefinition(e,t){if(!S4o(e.description.extensionLocation,t,e.collector,this._languageService))return null;let o=je(e.description.extensionLocation,t.path),n=Object.create(null);if(t.embeddedLanguages){let c=Object.keys(t.embeddedLanguages);for(let u=0,p=c.length;u<p;u++){let h=c[u],g=t.embeddedLanguages[h];typeof g=="string"&&this._languageService.isRegisteredLanguageId(g)&&(n[h]=this._languageService.languageIdCodec.encodeLanguageId(g))}}let r=Object.create(null);if(t.tokenTypes){let c=Object.keys(t.tokenTypes);for(let u of c)switch(t.tokenTypes[u]){case"string":r[u]=2;break;case"other":r[u]=0;break;case"comment":r[u]=1;break}}let s=t.language&&this._languageService.isRegisteredLanguageId(t.language)?t.language:void 0;function l(c,u){return!Array.isArray(c)||!c.every(p=>typeof p=="string")?u:c}return{location:o,language:s,scopeName:t.scopeName,embeddedLanguages:n,tokenTypes:r,injectTo:t.injectTo,balancedBracketSelectors:l(t.balancedBracketScopes,["*"]),unbalancedBracketSelectors:l(t.unbalancedBracketScopes,[]),sourceExtensionId:e.description.id}}startDebugMode(e,t){if(this._debugMode){this._notificationService.error(d(17244,null));return}this._debugModePrintFunc=e,this._debugMode=!0,this._debugMode&&this._progressService.withProgress({location:15,buttons:[d(17254,null)]},o=>(o.report({message:d(17252,null)}),this._getVSCodeOniguruma().then(n=>(n.setDefaultDebugCall(!0),o.report({message:d(17253,null)}),new Promise((r,s)=>{})))),o=>{this._getVSCodeOniguruma().then(n=>{this._debugModePrintFunc=()=>{},this._debugMode=!1,n.setDefaultDebugCall(!1),t()})})}_canCreateGrammarFactory(){return!!this._grammarDefinitions}async _getOrCreateGrammarFactory(){if(this._grammarFactory)return this._grammarFactory;let[e,t]=await Promise.all([bg("vscode-textmate","release/main.js"),this._getVSCodeOniguruma()]),o=Promise.resolve({createOnigScanner:n=>t.createOnigScanner(n),createOnigString:n=>t.createOnigString(n)});return this._grammarFactory?this._grammarFactory:(this._grammarFactory=new r0t({logTrace:n=>this._logService.trace(n),logError:(n,r)=>this._logService.error(n,r),readFile:n=>this._extensionResourceLoaderService.readExtensionResource(n)},this._grammarDefinitions||[],e,o),this._updateTheme(this._themeService.getColorTheme(),!0),this._grammarFactory)}async _createTokenizationSupport(e){if(!this._languageService.isRegisteredLanguageId(e)||!this._canCreateGrammarFactory())return null;try{let t=await this._getOrCreateGrammarFactory();if(!t.has(e))return null;let o=this._languageService.languageIdCodec.encodeLanguageId(e),n=await t.createGrammar(e,o);if(!n.grammar)return null;let r=I4o("editor.maxTokenizationLineLength",e,-1,this._configurationService),s=new P,l=s.add(new e0t(n.grammar,n.initialState,n.containsEmbeddedLanguages,(c,u)=>this._threadedBackgroundTokenizerFactory.createBackgroundTokenizer(c,u,r),()=>this.getAsyncTokenizationVerification(),(c,u,p)=>{this._reportTokenizationTime(c,e,n.sourceExtensionId,u,!1,p)},!0));return s.add(l.onDidEncounterLanguage(c=>{if(!this._encounteredLanguages[c]){let u=this._languageService.languageIdCodec.decodeLanguageId(c);this._encounteredLanguages[c]=!0,this._languageService.requestBasicLanguageFeatures(u)}})),new t0t(o,l,s,r)}catch(t){return t.message&&t.message===qXe||mt(t),null}}_updateTheme(e,t){if(!t&&this._currentTheme&&this._currentTokenColorMap&&b4o(this._currentTheme.settings,e.tokenColors)&&$i(this._currentTokenColorMap,e.tokenColorMap)&&this._currentTokenFontMap&&$i(this._currentTokenFontMap,e.tokenFontMap))return;this._currentTheme={name:e.label,settings:e.tokenColors},this._currentTokenColorMap=e.tokenColorMap,this._currentTokenFontMap=e.tokenFontMap,this._grammarFactory?.setTheme(this._currentTheme,this._currentTokenColorMap);let o=v4o(this._currentTokenColorMap),n=KN(o),r=hji(this._currentTokenFontMap);this._styleElement.textContent=n+r,kc.setColorMap(o),this._currentTheme&&this._currentTokenColorMap&&this._threadedBackgroundTokenizerFactory.acceptTheme(this._currentTheme,this._currentTokenColorMap)}async createTokenizer(e){if(!this._languageService.isRegisteredLanguageId(e))return null;let t=await this._getOrCreateGrammarFactory();if(!t.has(e))return null;let o=this._languageService.languageIdCodec.encodeLanguageId(e),{grammar:n}=await t.createGrammar(e,o);return n}_getVSCodeOniguruma(){return this._vscodeOniguruma||(this._vscodeOniguruma=(async()=>{let[e,t]=await Promise.all([bg("vscode-oniguruma","release/main.js"),this._loadVSCodeOnigurumaWASM()]);return await e.loadWASM({data:t,print:o=>{this._debugModePrintFunc(o)}}),e})()),this._vscodeOniguruma}async _loadVSCodeOnigurumaWASM(){return Gt?await(await fetch(H_t("vscode-oniguruma","release/onig.wasm"))).arrayBuffer():await fetch(Dz&&this._environmentService.isBuilt?gn.asBrowserUri(`${ypt}/vscode-oniguruma/release/onig.wasm`).toString(!0):gn.asBrowserUri(`${sN}/vscode-oniguruma/release/onig.wasm`).toString(!0))}_reportTokenizationTime(e,t,o,n,r,s){let l=r?"async":"sync";dB.reportTokenizationTimeCounter[l]>50||(dB.reportTokenizationTimeCounter[l]===0&&setTimeout(()=>{dB.reportTokenizationTimeCounter[l]=0},1e3*60*60),dB.reportTokenizationTimeCounter[l]++,this._telemetryService.publicLog2("editor.tokenizedLine",{timeMs:e,languageId:t,lineLength:n,fromWorker:r,sourceExtensionId:o,isRandomSample:s,tokenizationSetting:this.getAsyncTokenizationEnabled()?this.getAsyncTokenizationVerification()?2:1:0}))}};dB=I([m(0,kt),m(1,Gp),m(2,Bx),m(3,Ne),m(4,ne),m(5,B),m(6,Bo),m(7,Vt),m(8,F),m(9,Te)],dB);function v4o(a){let i=[null];for(let e=1,t=a.length;e<t;e++)i[e]=Oe.fromHex(a[e]);return i}function b4o(a,i){if(!i||!a||i.length!==a.length)return!1;for(let e=i.length-1;e>=0;e--){let t=i[e],o=a[e];if(t.scope!==o.scope)return!1;let n=t.settings,r=o.settings;if(n&&r){if(n.fontStyle!==r.fontStyle||n.foreground!==r.foreground||n.background!==r.background||n.lineHeight!==r.lineHeight||n.fontSize!==r.fontSize||n.fontFamily!==r.fontFamily)return!1}else if(!n||!r)return!1}return!0}function S4o(a,i,e,t){if(i.language&&(typeof i.language!="string"||!t.isRegisteredLanguageId(i.language)))return e.error(d(17247,null,cB.name,String(i.language))),!1;if(!i.scopeName||typeof i.scopeName!="string")return e.error(d(17250,null,cB.name,String(i.scopeName))),!1;if(!i.path||typeof i.path!="string")return e.error(d(17248,null,cB.name,String(i.path))),!1;if(i.injectTo&&(!Array.isArray(i.injectTo)||i.injectTo.some(n=>typeof n!="string")))return e.error(d(17246,null,cB.name,JSON.stringify(i.injectTo))),!1;if(i.embeddedLanguages&&!yi(i.embeddedLanguages))return e.error(d(17245,null,cB.name,JSON.stringify(i.embeddedLanguages))),!1;if(i.tokenTypes&&!yi(i.tokenTypes))return e.error(d(17251,null,cB.name,JSON.stringify(i.tokenTypes))),!1;let o=je(a,i.path);return La(o,a)||e.warn(d(17249,null,cB.name,o.path,a.path)),!0}function I4o(a,i,e,t){return ui(o=>t.onDidChangeConfiguration(n=>{n.affectsConfiguration(a,{overrideIdentifier:i})&&o(n)}),()=>t.getValue(a,{overrideIdentifier:i})??e)}var tLe=class{static{this.ID="workbench.contrib.textMateTokenizationInstantiator"}constructor(i){}};tLe=I([m(0,f4)],tLe);we(f4,dB,0);pt(tLe.ID,tLe,ut.BlockRestore);qe.registerCommand("_workbench.colorizeTextMateTokens",async(a,i)=>{let e=a.get(Ho),t=i?(await e.files.resolve(i)).textEditorModel:void 0;if(!t)throw new Error(`Cannot resolve text model for resource ${i}`);let o=await kc.getOrCreate(t.getLanguageId());if(!o)throw new Error(`Cannot resolve tokenizer for language ${t.getLanguageId()}`);let n=new En,r=o.getInitialState();for(let s=1;s<=t.getLineCount();s++)r=o.tokenizeEncoded(t.getLineContent(s),!0,r).endState;return n.stop(),{tokenizeTime:n.elapsed()}});var y4o="editor.experimental.preferTreeSitter";var w4o="@vscode/tree-sitter-wasm/wasm",C4o="tree-sitter.wasm";function oso(a){return`${Dz&&a.isBuilt?ypt:sN}/${w4o}`}var iLe=class extends C{constructor(e,t,o){super();this._configurationService=e;this._fileService=t;this._environmentService=o;this.isTest=!1;this._treeSitterImport=new co(async()=>{let e=await bg("@vscode/tree-sitter-wasm","wasm/tree-sitter.js"),t=this._environmentService,o=this.isTest;return await e.Parser.init({locateFile(n,r){let s=`${oso(t)}/${C4o}`;return o?gn.asFileUri(s).toString(!0):gn.asBrowserUri(s).toString(!0)}}),e});this._supportsLanguage=new kI(e=>pr(`${y4o}.${e}`,!1,this._configurationService));this._languagesCache=new kI(e=>Au.fromFn(async()=>{let t=oso(this._environmentService),o=`tree-sitter-${e}`,n=`${t}/${o}.wasm`,[r,s]=await Promise.all([this._treeSitterImport.value,this._fileService.readFile(gn.asFileUri(n))]);return await r.Language.load(s.value.buffer)}));this._injectionQueries=new kI({getCacheKey:JSON.stringify},e=>{let t=async()=>{let o=`vs/editor/common/languages/${e.kind}/${e.languageId}.scm`,n=gn.asFileUri(o);if(!this._fileService.hasProvider(n))return;let r=await x4o(this._fileService,n);if(r!==void 0)return r.value.toString()};return Au.fromFn(async()=>{let[o,n,r]=await Promise.all([t(),this._languagesCache.get(e.languageId).promise,this._treeSitterImport.value]);if(o===void 0)return null;let s=r.Query;return new s(n,o)}).resolvedValue})}supportsLanguage(e,t){return this._supportsLanguage.get(e).read(t)}async getParserClass(){return(await this._treeSitterImport.value).Parser}getLanguage(e,t,o){return!t&&!this.supportsLanguage(e,o)?void 0:this._languagesCache.get(e).resolvedValue.read(o)}async getLanguagePromise(e){return this._languagesCache.get(e).promise}getInjectionQueries(e,t){return this.supportsLanguage(e,t)?this._injectionQueries.get({languageId:e,kind:"injections"}).read(t):void 0}getHighlightingQueries(e,t){return this.supportsLanguage(e,t)?this._injectionQueries.get({languageId:e,kind:"highlights"}).read(t):void 0}async createQuery(e,t){let o=await this._treeSitterImport.value;return new o.Query(e,t)}};iLe=I([m(0,B),m(1,be),m(2,Co)],iLe);async function x4o(a,i){try{return await a.readFile(i)}catch(e){if(hu(e)===1)return;throw e}}var oLe=class{constructor(i){this._themeService=i;this._colorTheme=ui(this._themeService.onDidColorThemeChange,()=>this._themeService.getColorTheme()),this.onChange=Ce(this,e=>{this._colorTheme.read(e),e.reportChange(void 0)})}findMetadata(i,e,t,o){return HOt(this._colorTheme.read(o),i,e,t)}};oLe=I([m(0,Gp)],oLe);we(F9,iLe,0);we(ebt,oLe,0);var k4o=3e4,oIi=2,nIi={passive:!0,capture:!0},s0t=class extends C{constructor(i){super();let e=oIi,t=this._register(new ZD),o=this._register(new me);o.value=i.markActive();let n=()=>{++e===oIi&&(o.clear(),t.cancel())},r=s=>{e===oIi&&(o.value=i.markActive(),t.cancelAndSet(n,k4o,s)),e=0};this._register(H.runAndSubscribe(Fg,({window:s,disposables:l})=>{l.add(j(s.document,"touchstart",()=>r(s),nIi)),l.add(j(s.document,"mousedown",()=>r(s),nIi)),l.add(j(s.document,"keydown",()=>r(s),nIi))},{window:It,disposables:this._store})),r(It)}};QLt.add(s0t);var a0t=class extends C{constructor(e){super();this.value=e;this._totalTime=0;this._startTime=void 0;this._register(he(t=>{if(this.value.read(t))this._startTime=Date.now();else if(this._startTime!==void 0){let n=Date.now()-this._startTime;this._totalTime+=n,this._startTime=void 0}}))}totalTimeMs(){return this._startTime!==void 0?this._totalTime+(Date.now()-this._startTime):this._totalTime}fireWhenTimeIncreasedBy(e,t){let o=new P,n=0,r;return o.add(he(s=>{if(this.value.read(s)){r=Date.now();let c=e-n;if(c<=0){t(),o.dispose();return}let u=setTimeout(()=>{n+=Date.now()-r,r=void 0,t(),o.dispose()},c);s.store.add(Z(()=>{clearTimeout(u),r!==void 0&&(n+=Date.now()-r,r=void 0)}))}})),o}};function nso(a,i,e){let t=Le("wasTrueRecently",!1),o;return e.add(he(n=>{a.read(n)?(t.set(!0,void 0),o!==void 0&&(clearTimeout(o),o=void 0)):o=setTimeout(()=>{t.set(!1,void 0),o=void 0},i)})),e.add(Z(()=>{o!==void 0&&clearTimeout(o)})),t}var l0t=ae("userAttentionService");var E4o=6e4,jXe=class extends C{constructor(e,t){super();this._logService=t;let o=this._register(e.createInstance(QXe));this.isVsCodeFocused=o.isVsCodeFocused,this.isUserActive=o.isUserActive,this._isTracingEnabled=ui(this,this._logService.onDidChangeLogLevel,()=>this._logService.getLevel()===1);let n=nso(this.isUserActive,E4o,this._store);this.hasUserAttention=Ce(this,r=>n.read(r)),this._timeKeeper=this._register(new a0t(this.hasUserAttention)),this._register(he(r=>{this._isTracingEnabled.read(r)&&(r.store.add(he(s=>{let l=this.isVsCodeFocused.read(s);this._logService.trace(`[UserAttentionService] VS Code focus changed: ${l}`)})),r.store.add(he(s=>{let l=this.hasUserAttention.read(s);this._logService.trace(`[UserAttentionService] User attention changed: ${l}`)})))}))}fireAfterGivenFocusTimePassed(e,t){return this._timeKeeper.fireWhenTimeIncreasedBy(e,t)}get totalFocusTimeMs(){return this._timeKeeper.totalTimeMs()}};jXe=I([m(0,F),m(1,ne)],jXe);var QXe=class extends C{constructor(e,t){super();this._hostService=e;this._logService=t;this._isUserActive=Le(this,!1);this.isVsCodeFocused=ui(this,this._hostService.onDidChangeFocus,()=>this._hostService.hasFocus),this.isUserActive=this._isUserActive;let o=()=>{this._markUserActivity()};this._register(H.runAndSubscribe(Fg,({window:n,disposables:r})=>{r.add(j(n.document,"keydown",o,c0t)),r.add(j(n.document,"mousemove",o,c0t)),r.add(j(n.document,"mousedown",o,c0t)),r.add(j(n.document,"touchstart",o,c0t))},{window:It,disposables:this._store})),this._hostService.hasFocus&&this._markUserActivity()}_markUserActivity(){this._activityDebounceTimeout!==void 0?clearTimeout(this._activityDebounceTimeout):(this._logService.trace("[UserAttentionService] User activity detected"),this._isUserActive.set(!0,void 0)),this._activityDebounceTimeout=setTimeout(()=>{this._isUserActive.set(!1,void 0),this._activityDebounceTimeout=void 0},500)}};QXe=I([m(0,oi),m(1,ne)],QXe);var c0t={passive:!0,capture:!0};we(l0t,jXe,1);var rIi=class{constructor(){this.onWillInstantiateEditorPane=ys.onWillInstantiateEditorPane}didInstantiateEditorPane(i){return ys.didInstantiateEditorPane(i)}};we(Lxt,rIi,1);var sIi=class extends C{constructor(){super();this._onDidSendData=this._register(new E);this.onDidSendData=this._onDidSendData.event}getDataChannel(e){return new aIi(e,this._onDidSendData)}},aIi=class{constructor(i,e){this.channelId=i;this._onDidSendData=e}sendData(i){this._onDidSendData.fire({channelId:this.channelId,data:i})}};we(O7,sIi,1);var aD=ae("IDefaultLogLevelsService"),YXe=class extends C{constructor(e,t,o,n,r){super();this.environmentService=e;this.fileService=t;this.jsonEditingService=o;this.logService=n;this.loggerService=r;this._onDidChangeDefaultLogLevels=this._register(new E);this.onDidChangeDefaultLogLevels=this._onDidChangeDefaultLogLevels.event;this._defaultLogLevels={default:this._getDefaultLogLevelFromEnv(),extensions:this._getExtensionsDefaultLogLevelsFromEnv()},this._register(this.fileService.onDidFilesChange(s=>{s.contains(this.environmentService.argvResource)&&this.onDidChangeArgv()}))}async onDidChangeArgv(){let e=await this._parseLogLevelsFromArgv();this.updateDefaultLogLevels(e)}get defaultLogLevels(){return this._defaultLogLevels}updateDefaultLogLevels(e){let t={default:e?.default??this._getDefaultLogLevelFromEnv(),extensions:e?.extensions??this._getExtensionsDefaultLogLevelsFromEnv()};uo(this._defaultLogLevels,t)||(this._defaultLogLevels=t,this._onDidChangeDefaultLogLevels.fire(this._defaultLogLevels))}getDefaultLogLevel(e){return e?(e=e.toLowerCase(),this._getDefaultLogLevel(this._defaultLogLevels,e)):this._getDefaultLogLevel(this._defaultLogLevels)}async setDefaultLogLevel(e,t){let o=await this._parseLogLevelsFromArgv()??{};if(t){t=t.toLowerCase();let n=this._getDefaultLogLevel(o,t);o.extensions=o.extensions??[];let r=o.extensions.find(([l])=>l===t);r?r[1]=e:o.extensions.push([t,e]),await this._writeLogLevelsToArgv(o);let s=[...this.loggerService.getRegisteredLoggers()].filter(l=>l.extensionId&&l.extensionId.toLowerCase()===t);for(let{resource:l}of s)this.loggerService.getLogLevel(l)===n&&this.loggerService.setLogLevel(l,e)}else{let n=this._getDefaultLogLevel(o);o.default=e,await this._writeLogLevelsToArgv(o),this.loggerService.getLogLevel()===n&&this.loggerService.setLogLevel(e)}this.updateDefaultLogLevels(o)}_getDefaultLogLevel(e,t){if(t){let o=e.extensions?.find(([n])=>n===t);if(o)return o[1]}return e.default??S7t(this.environmentService)}async _writeLogLevelsToArgv(e){let t=[];cn(e.default)||t.push($w(e.default));for(let[o,n]of e.extensions??[])t.push(`${o}=${$w(n)}`);await this.jsonEditingService.write(this.environmentService.argvResource,[{path:["log-level"],value:t.length?t:void 0}],!0)}async _parseLogLevelsFromArgv(){let e={extensions:[]},t=await this._readLogLevelsFromArgv();for(let o of t){let n=uce.exec(o);if(n&&n[1]&&n[2]){let r=Gre(n[2]);cn(r)||e.extensions?.push([n[1].toLowerCase(),r])}else{let r=Gre(o);cn(r)||(e.default=r)}}return!cn(e.default)||e.extensions?.length?e:void 0}async _readLogLevelsFromArgv(){try{let e=await this.fileService.readFile(this.environmentService.argvResource),t=Ur(e.value.toString());return Ae(t["log-level"])?[t["log-level"]]:Array.isArray(t["log-level"])?t["log-level"]:[]}catch(e){hu(e)!==1&&this.logService.error(e)}return[]}_getDefaultLogLevelFromEnv(){return S7t(this.environmentService)}_getExtensionsDefaultLogLevelsFromEnv(){let e=[];for(let[t,o]of this.environmentService.extensionLogLevel??[]){let n=Gre(o);cn(n)||e.push([t,n])}return e}};YXe=I([m(0,Vt),m(1,be),m(2,zf),m(3,ne),m(4,ol)],YXe);we(aD,YXe,1);var XXe=class extends C{constructor(e){super();this.layoutService=e;this.contextView=this._register(new Oye(this.layoutService.mainContainer,1)),this.layout(),this._register(e.onDidLayoutContainer(()=>this.layout()))}showContextView(e,t,o){let n;t?t===this.layoutService.getContainer(Me(t))?n=1:o?n=3:n=2:n=1,this.contextView.setContainer(t??this.layoutService.activeContainer,n),this.contextView.show(e);let r={close:()=>{this.openContextView===r&&this.hideContextView()}};return this.openContextView=r,r}layout(){this.contextView.layout()}hideContextView(e){this.contextView.hide(e),this.openContextView=void 0}};XXe=I([m(0,nc)],XXe);var d0t=class extends XXe{getContextViewElement(){return this.contextView.getViewElement()}};var nLe=class extends C{constructor(e,t){super();this._markerService=t;this._onDidChangeMarker=this._register(new E);this.onDidChangeMarker=this._onDidChangeMarker.event;this._suppressedRanges=new vt;this._markerDecorations=new vt;e.getModels().forEach(o=>this._onModelAdded(o)),this._register(e.onModelAdded(this._onModelAdded,this)),this._register(e.onModelRemoved(this._onModelRemoved,this)),this._register(this._markerService.onMarkerChanged(this._handleMarkerChange,this))}dispose(){super.dispose(),this._markerDecorations.forEach(e=>e.dispose()),this._markerDecorations.clear()}getMarker(e,t){let o=this._markerDecorations.get(e);return o&&o.getMarker(t)||null}getLiveMarkers(e){let t=this._markerDecorations.get(e);return t?t.getMarkers():[]}addMarkerSuppression(e,t){let o=this._suppressedRanges.get(e);return o||(o=new Set,this._suppressedRanges.set(e,o)),o.add(t),this._handleMarkerChange([e]),Z(()=>{let n=this._suppressedRanges.get(e);n&&(n.delete(t),n.size===0&&this._suppressedRanges.delete(e),this._handleMarkerChange([e]))})}_handleMarkerChange(e){e.forEach(t=>{let o=this._markerDecorations.get(t);o&&this._updateDecorations(o)})}_onModelAdded(e){let t=new lIi(e);this._markerDecorations.set(e.uri,t),this._updateDecorations(t)}_onModelRemoved(e){let t=this._markerDecorations.get(e.uri);t&&(t.dispose(),this._markerDecorations.delete(e.uri)),(e.uri.scheme===Y.inMemory||e.uri.scheme===Y.internal||e.uri.scheme===Y.vscode)&&this._markerService?.read({resource:e.uri}).map(o=>o.owner).forEach(o=>this._markerService.remove(o,[e.uri]))}_updateDecorations(e){let t=this._markerService.read({resource:e.model.uri,take:500}),o=this._suppressedRanges.get(e.model.uri);o&&(t=t.filter(n=>!ht.some(o,r=>z.areIntersectingOrTouching(r,n)))),e.update(t)&&this._onDidChangeMarker.fire(e.model)}};nLe=I([m(0,Ct),m(1,Ns)],nLe);var lIi=class extends C{constructor(e){super();this.model=e;this._map=new Uut;this._register(Z(()=>{this.model.deltaDecorations([...this._map.values()],[]),this._map.clear()}))}update(e){let{added:t,removed:o}=HH(new Set(this._map.keys()),new Set(e));if(t.length===0&&o.length===0)return!1;let n=o.map(l=>this._map.get(l)),r=t.map(l=>({range:this._createDecorationRange(this.model,l),options:this._createDecorationOption(l)})),s=this.model.deltaDecorations(n,r);for(let l of o)this._map.delete(l);for(let l=0;l<s.length;l++)this._map.set(t[l],s[l]);return!0}getMarker(e){return this._map.getKey(e.id)}getMarkers(){let e=[];return this._map.forEach((t,o)=>{let n=this.model.getDecorationRange(t);n&&e.push([n,o])}),e}_createDecorationRange(e,t){let o=z.lift(t);if(t.severity===1&&!this._hasMarkerTag(t,1)&&!this._hasMarkerTag(t,2)&&(o=o.setEndPosition(o.startLineNumber,o.startColumn+2)),o=e.validateRange(o),o.isEmpty()){let n=e.getLineLastNonWhitespaceColumn(o.startLineNumber)||e.getLineMaxColumn(o.startLineNumber);if(n===1||o.endColumn>=n)return o;let r=e.getWordAtPosition(o.getStartPosition());r&&(o=new z(o.startLineNumber,r.startColumn,o.endLineNumber,r.endColumn))}else if(t.endColumn===Number.MAX_VALUE&&t.startColumn===1&&o.startLineNumber===o.endLineNumber){let n=e.getLineFirstNonWhitespaceColumn(t.startLineNumber);n<o.endColumn&&(o=new z(o.startLineNumber,n,o.endLineNumber,o.endColumn),t.startColumn=n)}return o}_createDecorationOption(e){let t,o,n,r,s;switch(e.severity){case 1:this._hasMarkerTag(e,2)?t=void 0:this._hasMarkerTag(e,1)?t="squiggly-unnecessary":t="squiggly-hint",n=0;break;case 2:t="squiggly-info",o=Ss(w9),n=10,s={color:Ss(wGi),position:1};break;case 4:t="squiggly-warning",o=Ss(hqi),n=20,s={color:Ss(CGi),position:1};break;case 8:default:t="squiggly-error",o=Ss(NIe),n=30,s={color:Ss(xGi),position:1};break}return e.tags&&(e.tags.indexOf(1)!==-1&&(r="squiggly-inline-unnecessary"),e.tags.indexOf(2)!==-1&&(r="squiggly-inline-deprecated")),{description:"marker-decoration",stickiness:1,className:t,showIfCollapsed:!0,overviewRuler:{color:o,position:4},minimap:s,zIndex:n,inlineClassName:r}}_hasMarkerTag(e,t){return e.tags?e.tags.indexOf(t)>=0:!1}};var npe=new Set([Y.inMemory,Y.vscodeSourceControl,Y.walkThrough,Y.walkThroughSnippet,Y.vscodeChatCodeBlock,Y.vscodeTerminal]),cIi=class{constructor(){this._byResource=new vt;this._byOwner=new Map}set(i,e,t){let o=this._byResource.get(i);o||(o=new Map,this._byResource.set(i,o)),o.set(e,t);let n=this._byOwner.get(e);n||(n=new vt,this._byOwner.set(e,n)),n.set(i,t)}get(i,e){return this._byResource.get(i)?.get(e)}delete(i,e){let t=!1,o=!1,n=this._byResource.get(i);n&&(t=n.delete(e));let r=this._byOwner.get(e);if(r&&(o=r.delete(i)),t!==o)throw new Error("illegal state");return t&&o}values(i){return typeof i=="string"?this._byOwner.get(i)?.values()??ht.empty():A.isUri(i)?this._byResource.get(i)?.values()??ht.empty():ht.map(ht.concat(...this._byOwner.values()),e=>e[1])}},dIi=class{constructor(i){this.errors=0;this.infos=0;this.warnings=0;this.unknowns=0;this._data=new vt;this._service=i,this._subscription=i.onMarkerChanged(this._update,this)}dispose(){this._subscription.dispose()}_update(i){for(let e of i){let t=this._data.get(e);t&&this._substract(t);let o=this._resourceStats(e);this._add(o),this._data.set(e,o)}}_resourceStats(i){let e={errors:0,warnings:0,infos:0,unknowns:0};if(npe.has(i.scheme))return e;for(let{severity:t}of this._service.read({resource:i}))t===8?e.errors+=1:t===4?e.warnings+=1:t===2?e.infos+=1:e.unknowns+=1;return e}_substract(i){this.errors-=i.errors,this.warnings-=i.warnings,this.infos-=i.infos,this.unknowns-=i.unknowns}_add(i){this.errors+=i.errors,this.warnings+=i.warnings,this.infos+=i.infos,this.unknowns+=i.unknowns}},u0t=class a{constructor(){this._onMarkerChanged=new d6({merge:a._merge});this.onMarkerChanged=this._onMarkerChanged.event;this._data=new cIi;this._stats=new dIi(this);this._filteredResources=new vt}dispose(){this._stats.dispose(),this._onMarkerChanged.dispose()}getStatistics(){return this._stats}remove(i,e){for(let t of e||[])this.changeOne(i,t,[])}changeOne(i,e,t){if(JA(t))this._data.delete(e,i)&&this._onMarkerChanged.fire([e]);else{let o=[];for(let n of t){let r=a._toMarker(i,e,n);r&&o.push(r)}this._data.set(e,i,o),this._onMarkerChanged.fire([e])}}installResourceFilter(i,e){let t=this._filteredResources.get(i);return t||(t=[],this._filteredResources.set(i,t)),t.push(e),this._onMarkerChanged.fire([i]),Z(()=>{let o=this._filteredResources.get(i);if(!o)return;let n=o.indexOf(e);n!==-1&&(o.splice(n,1),o.length===0&&this._filteredResources.delete(i),this._onMarkerChanged.fire([i]))})}static _toMarker(i,e,t){let{code:o,severity:n,message:r,source:s,startLineNumber:l,startColumn:c,endLineNumber:u,endColumn:p,relatedInformation:h,modelVersionId:g,tags:f,origin:v}=t;if(r)return l=l>0?l:1,c=c>0?c:1,u=u>=l?u:l,p=p>0?p:c,{resource:e,owner:i,code:o,severity:n,message:r,source:s,startLineNumber:l,startColumn:c,endLineNumber:u,endColumn:p,relatedInformation:h,modelVersionId:g,tags:f,origin:v}}changeAll(i,e){let t=[],o=this._data.values(i);if(o)for(let n of o){let r=ht.first(n);r&&(t.push(r.resource),this._data.delete(r.resource,i))}if(dr(e)){let n=new vt;for(let{resource:r,marker:s}of e){let l=a._toMarker(i,r,s);if(!l)continue;let c=n.get(r);c?c.push(l):(n.set(r,[l]),t.push(r))}for(let[r,s]of n)this._data.set(r,i,s)}t.length>0&&this._onMarkerChanged.fire(t)}_createFilteredMarker(i,e){let t=e.length===1?d(2152,null,e[0]):d(2153,null,e[0],e.length-1);return{owner:"markersFilter",resource:i,severity:2,message:t,startLineNumber:1,startColumn:1,endLineNumber:1,endColumn:1}}read(i=Object.create(null)){let{owner:e,resource:t,severities:o,take:n}=i;if((!n||n<0)&&(n=-1),e&&t){let r=i.ignoreResourceFilters?void 0:this._filteredResources.get(t);if(r?.length)return[this._createFilteredMarker(t,r)];let s=this._data.get(t,e);if(!s)return[];let l=[];for(let c of s){if(n>0&&l.length===n)break;let u=i.ignoreResourceFilters?void 0:this._filteredResources.get(t);u?.length?l.push(this._createFilteredMarker(t,u)):a._accept(c,o)&&l.push(c)}return l}else{let r=!e&&!t?this._data.values():this._data.values(t??e),s=[],l=new Mn;for(let c of r)for(let u of c){if(l.has(u.resource))continue;if(n>0&&s.length===n)break;let p=i.ignoreResourceFilters?void 0:this._filteredResources.get(u.resource);p?.length?(s.push(this._createFilteredMarker(u.resource,p)),l.add(u.resource)):a._accept(u,o)&&s.push(u)}return s}}static _accept(i,e){return e===void 0||(e&i.severity)===i.severity}static _merge(i){let e=new vt;for(let t of i)for(let o of t)e.set(o,!0);return Array.from(e.keys())}};var JXe="data-keybinding-context",ZXe=class{constructor(i,e){this._id=i,this._parent=e,this._value=Object.create(null),this._value._contextId=i}get value(){return{...this._value}}setValue(i,e){return uo(this._value[i],e)?!1:(this._value[i]=e,!0)}removeValue(i){return i in this._value?(delete this._value[i],!0):!1}getValue(i){let e=this._value[i];return typeof e>"u"&&this._parent?this._parent.getValue(i):e}updateParent(i){this._parent=i}collectAllValues(){let i=this._parent?this._parent.collectAllValues():Object.create(null);return i={...i,...this._value},delete i._contextId,i}},sLe=class a extends ZXe{static{this.INSTANCE=new a}constructor(){super(-1,null)}setValue(i,e){return!1}removeValue(i){return!1}getValue(i){}collectAllValues(){return Object.create(null)}},uIi=class a extends ZXe{constructor(e,t,o){super(e,null);this._configurationService=t;this._values=Yu.forConfigKeys();this._listener=this._configurationService.onDidChangeConfiguration(n=>{if(n.source===7){let r=Array.from(this._values,([s])=>s);this._values.clear(),o.fire(new eJe(r))}else{let r=[];for(let s of n.affectedKeys){let l=`config.${s}`,c=this._values.findSuperstr(l);c!==void 0&&(r.push(...ht.map(c,([u])=>u)),this._values.deleteSuperstr(l)),this._values.has(l)&&(r.push(l),this._values.delete(l))}o.fire(new eJe(r))}})}static{this._keyPrefix="config."}dispose(){this._listener.dispose()}getValue(e){if(e.indexOf(a._keyPrefix)!==0)return super.getValue(e);if(this._values.has(e))return this._values.get(e);let t=e.substr(a._keyPrefix.length),o=this._configurationService.getValue(t),n;switch(typeof o){case"number":case"boolean":case"string":n=o;break;default:Array.isArray(o)?n=JSON.stringify(o):n=o}return this._values.set(e,n),n}setValue(e,t){return super.setValue(e,t)}removeValue(e){return super.removeValue(e)}collectAllValues(){let e=Object.create(null);return this._values.forEach((t,o)=>e[o]=t),{...e,...super.collectAllValues()}}},pIi=class{constructor(i,e,t){this._service=i,this._key=e,this._defaultValue=t,this.reset()}set(i){this._service.setContext(this._key,i)}reset(){typeof this._defaultValue>"u"?this._service.removeContext(this._key):this._service.setContext(this._key,this._defaultValue)}get(){return this._service.getContextKeyValue(this._key)}},p0t=class{constructor(i){this.key=i}affectsSome(i){return i.has(this.key)}allKeysContainedIn(i){return this.affectsSome(i)}},eJe=class{constructor(i){this.keys=i}affectsSome(i){for(let e of this.keys)if(i.has(e))return!0;return!1}allKeysContainedIn(i){return this.keys.every(e=>i.has(e))}},mIi=class{constructor(i){this.events=i}affectsSome(i){for(let e of this.events)if(e.affectsSome(i))return!0;return!1}allKeysContainedIn(i){return this.events.every(e=>e.allKeysContainedIn(i))}};function T4o(a,i){return a.allKeysContainedIn(new Set(Object.keys(i)))}var m0t=class extends C{constructor(e){super();this._onDidChangeContext=this._register(new Pm({merge:e=>new mIi(e)}));this._isDisposed=!1,this._myContextId=e}get onDidChangeContext(){return this._onDidChangeContext.event}get contextId(){return this._myContextId}createKey(e,t){if(this._isDisposed)throw new Error("AbstractContextKeyService has been disposed");return new pIi(this,e,t)}bufferChangeEvents(e){this._onDidChangeContext.pause();try{e()}finally{this._onDidChangeContext.resume()}}createScoped(e){if(this._isDisposed)throw new Error("AbstractContextKeyService has been disposed");return new hIi(this,e)}createOverlay(e=ht.empty()){if(this._isDisposed)throw new Error("AbstractContextKeyService has been disposed");return new gIi(this,e)}contextMatchesRules(e){if(this._isDisposed)throw new Error("AbstractContextKeyService has been disposed");let t=this.getContextValuesContainer(this._myContextId);return e?e.evaluate(t):!0}getContextKeyValue(e){if(!this._isDisposed)return this.getContextValuesContainer(this._myContextId).getValue(e)}setContext(e,t){if(this._isDisposed)return;let o=this.getContextValuesContainer(this._myContextId);o&&o.setValue(e,t)&&this._onDidChangeContext.fire(new p0t(e))}removeContext(e){this._isDisposed||this.getContextValuesContainer(this._myContextId).removeValue(e)&&this._onDidChangeContext.fire(new p0t(e))}getContext(e){return this._isDisposed?sLe.INSTANCE:this.getContextValuesContainer(_4o(e))}dispose(){super.dispose(),this._isDisposed=!0}},rLe=class extends m0t{constructor(e){super(0);this._contexts=new Map;this._lastContextId=0,this.inputFocusedContext=$h.bindTo(this);let t=this._register(new uIi(this._myContextId,e,this._onDidChangeContext));this._contexts.set(this._myContextId,t),this._register(H.runAndSubscribe(Fg,({window:o,disposables:n})=>{let r=n.add(new me);n.add(j(o,re.FOCUS_IN,()=>{r.value=new P,this.updateInputContextKeys(o.document,r.value)},!0))},{window:It,disposables:this._store}))}updateInputContextKeys(e,t){function o(){return!!e.activeElement&&Oh(e.activeElement)}let n=o();if(this.inputFocusedContext.set(n),n){let r=t.add(Vn(e.activeElement));H.once(r.onDidBlur)(()=>{Ki().document===e&&this.inputFocusedContext.set(o()),r.dispose()},void 0,t)}}getContextValuesContainer(e){return this._isDisposed?sLe.INSTANCE:this._contexts.get(e)||sLe.INSTANCE}createChildContext(e=this._myContextId){if(this._isDisposed)throw new Error("ContextKeyService has been disposed");let t=++this._lastContextId;return this._contexts.set(t,new ZXe(t,this.getContextValuesContainer(e))),t}disposeContext(e){this._isDisposed||this._contexts.delete(e)}updateParent(e){throw new Error("Cannot update parent of root ContextKeyService")}};rLe=I([m(0,B)],rLe);var hIi=class extends m0t{constructor(e,t){super(e.createChildContext());this._parentChangeListener=this._register(new me);if(this._parent=e,this._updateParentChangeListener(),this._domNode=t,this._domNode.hasAttribute(JXe)){let o="";this._domNode.classList&&(o=Array.from(this._domNode.classList.values()).join(", ")),console.error(`Element already has context attribute${o?": "+o:""}`)}this._domNode.setAttribute(JXe,String(this._myContextId))}_updateParentChangeListener(){this._parentChangeListener.value=this._parent.onDidChangeContext(e=>{let o=this._parent.getContextValuesContainer(this._myContextId).value;T4o(e,o)||this._onDidChangeContext.fire(e)})}dispose(){this._isDisposed||(this._parent.disposeContext(this._myContextId),this._domNode.removeAttribute(JXe),super.dispose())}getContextValuesContainer(e){return this._isDisposed?sLe.INSTANCE:this._parent.getContextValuesContainer(e)}createChildContext(e=this._myContextId){if(this._isDisposed)throw new Error("ScopedContextKeyService has been disposed");return this._parent.createChildContext(e)}disposeContext(e){this._isDisposed||this._parent.disposeContext(e)}updateParent(e){if(this._parent===e)return;let t=this._parent.getContextValuesContainer(this._myContextId),o=t.collectAllValues();this._parent=e,this._updateParentChangeListener();let n=this._parent.getContextValuesContainer(this._parent.contextId);t.updateParent(n);let r=t.collectAllValues(),s={...$Ge(o,r),...$Ge(r,o)},l=Object.keys(s);this._onDidChangeContext.fire(new eJe(l))}},h0t=class{constructor(i,e){this.parent=i;this.overlay=e}getValue(i){return this.overlay.has(i)?this.overlay.get(i):this.parent.getValue(i)}},gIi=class a{constructor(i,e){this.parent=i;this.overlay=new Map(e)}get contextId(){return this.parent.contextId}get onDidChangeContext(){return this.parent.onDidChangeContext}bufferChangeEvents(i){this.parent.bufferChangeEvents(i)}createKey(){throw new Error("Not supported.")}getContext(i){return new h0t(this.parent.getContext(i),this.overlay)}getContextValuesContainer(i){let e=this.parent.getContextValuesContainer(i);return new h0t(e,this.overlay)}contextMatchesRules(i){let e=this.getContextValuesContainer(this.contextId);return i?i.evaluate(e):!0}getContextKeyValue(i){return this.overlay.has(i)?this.overlay.get(i):this.parent.getContextKeyValue(i)}createScoped(){throw new Error("Not supported.")}createOverlay(i=ht.empty()){return new a(this,i)}updateParent(){throw new Error("Not supported.")}};function _4o(a){for(;a;){if(a.hasAttribute(JXe)){let i=a.getAttribute(JXe);return i?parseInt(i,10):NaN}a=a.parentElement}return 0}function D4o(a,i,e){a.get(X).createKey(String(i),L4o(e))}function L4o(a){return Gk(a,i=>{if(typeof i=="object"&&i.$mid===1)return A.revive(i).toString();if(i instanceof A)return i.toString()})}qe.registerCommand("_setContext",D4o);qe.registerCommand({id:"getContextKeyInfo",handler(){return[...Q.all()].sort((a,i)=>a.key.localeCompare(i.key))},metadata:{description:d(1839,null),args:[]}});qe.registerCommand("_generateContextKeyInfo",function(){let a=[],i=new Set;for(let e of Q.all())i.has(e.key)||(i.add(e.key),a.push(e));a.sort((e,t)=>e.key.localeCompare(t.key)),console.log(JSON.stringify(a,void 0,2))});var aLe=class extends C{constructor(e,t,o){super();this.configurationService=e;this.modelService=t;this.languageService=o;this._onDidChangeConfiguration=this._register(new E);this.onDidChangeConfiguration=this._onDidChangeConfiguration.event;this._register(this.configurationService.onDidChangeConfiguration(n=>this._onDidChangeConfiguration.fire(this.toResourceConfigurationChangeEvent(n))))}getValue(e,t,o){return typeof o=="string"?this._getValue(e,Ie.isIPosition(t)?t:null,o):this._getValue(e,null,typeof t=="string"?t:void 0)}updateValue(e,t,o,n){let r=e?this.getLanguage(e,null):null,s=this.configurationService.inspect(t,{resource:e,overrideIdentifier:r});n===void 0&&(n=this.deriveConfigurationTarget(s,r));let l=r&&s.overrideIdentifiers?.includes(r)?r:void 0;return this.configurationService.updateValue(t,o,{resource:e,overrideIdentifier:l},n)}deriveConfigurationTarget(e,t){if(t){if(e.memory?.override!==void 0)return 8;if(e.workspaceFolder?.override!==void 0)return 6;if(e.workspace?.override!==void 0)return 5;if(e.userRemote?.override!==void 0)return 4;if(e.userLocal?.override!==void 0)return 3}return e.memory?.value!==void 0?8:e.workspaceFolder?.value!==void 0?6:e.workspace?.value!==void 0?5:e.userRemote?.value!==void 0?4:3}_getValue(e,t,o){let n=e?this.getLanguage(e,t):void 0;return typeof o>"u"?this.configurationService.getValue({resource:e,overrideIdentifier:n}):this.configurationService.getValue(o,{resource:e,overrideIdentifier:n})}inspect(e,t,o){let n=e?this.getLanguage(e,t):void 0;return this.configurationService.inspect(o,{resource:e,overrideIdentifier:n})}getLanguage(e,t){let o=this.modelService.getModel(e);return o?t?o.getLanguageIdAtPosition(t.lineNumber,t.column):o.getLanguageId():this.languageService.guessLanguageIdByFilepathOrFirstLine(e)}toResourceConfigurationChangeEvent(e){return{affectedKeys:e.affectedKeys,affectsConfiguration:(t,o)=>{let n=t?this.getLanguage(t,null):void 0;return e.affectsConfiguration(o,{resource:t,overrideIdentifier:n})?!0:n?e.affectedKeys.has(`[${n}]`):!1}}}};aLe=I([m(0,B),m(1,Ct),m(2,kt)],aLe);var lLe=class{constructor(i,e){this.requestService=i;this.fileService=e}async download(i,e,t=ve.None){if(i.scheme===Y.file||i.scheme===Y.vscodeRemote){await this.fileService.copy(i,e);return}let o={type:"GET",url:i.toString(!0)},n=await this.requestService.request(o,t);if(n.res.statusCode===200)await this.fileService.writeFile(e,n.stream);else{let r=await Kx(n);throw new Error(`Expected 200, got back ${n.res.statusCode} instead.
${r}`)}}};lLe=I([m(0,_a),m(1,be)],lLe);var tJe=class{constructor(i){this._commandService=i}async open(i,e){if(!jd(i,Y.command))return!1;if(!e?.allowCommands||(typeof i=="string"&&(i=A.parse(i)),Array.isArray(e.allowCommands)&&!e.allowCommands.includes(i.path)))return!0;let t=[];try{t=zg(decodeURIComponent(i.query))}catch{try{t=zg(i.query)}catch{}}return Array.isArray(t)||(t=[t]),await this._commandService.executeCommand(i.path,...t),!0}};tJe=I([m(0,ge)],tJe);var iJe=class{constructor(i){this._editorService=i}async open(i,e){typeof i=="string"&&(i=A.parse(i));let{selection:t,uri:o}=EIe(i);return i=o,i.scheme===Y.file&&(i=_re(i)),await this._editorService.openCodeEditor({resource:i,options:{selection:t,source:e?.fromUserGesture?1:0,...e?.editorOptions}},this._editorService.getFocusedCodeEditor(),e?.openToSide),!0}};iJe=I([m(0,Kt)],iJe);var cLe=class{constructor(i,e){this._openers=new Vs;this._validators=new Vs;this._resolvers=new Vs;this._resolvedUriTargets=new vt(i=>i.with({path:null,fragment:null,query:null}).toString());this._externalOpeners=new Vs;this._defaultExternalOpener={openExternal:async t=>($0(t,Y.http,Y.https)?PGe(t):It.location.href=t,!0)},this._openers.push({open:async(t,o)=>o?.openExternal||$0(t,Y.mailto,Y.http,Y.https,Y.vsls)?(await this._doOpenExternal(t,o),!0):!1}),this._openers.push(new tJe(e)),this._openers.push(new iJe(i))}registerOpener(i){return{dispose:this._openers.unshift(i)}}registerValidator(i){return{dispose:this._validators.push(i)}}registerExternalUriResolver(i){return{dispose:this._resolvers.push(i)}}setDefaultExternalOpener(i){this._defaultExternalOpener=i}registerExternalOpener(i){return{dispose:this._externalOpeners.push(i)}}async open(i,e){let t=typeof i=="string"?A.parse(i):i;if(t.scheme===Y.internal)return!1;if(!e?.skipValidation){let o=this._resolvedUriTargets.get(t)??i;for(let n of this._validators)if(!await n.shouldOpen(o,e))return!1}for(let o of this._openers)if(await o.open(i,e))return!0;return!1}async resolveExternalUri(i,e){for(let t of this._resolvers)try{let o=await t.resolveExternalUri(i,e);if(o)return this._resolvedUriTargets.has(o.resolved)||this._resolvedUriTargets.set(o.resolved,i),o}catch{}throw new Error("Could not resolve external URI: "+i.toString())}async _doOpenExternal(i,e){let t=typeof i=="string"?A.parse(i):i,o;try{o=(await this.resolveExternalUri(t,e)).resolved}catch{o=t}let n;if(typeof i=="string"&&t.toString()===o.toString()?n=i:n=encodeURI(o.toString(!0)),e?.allowContributedOpeners){let r=typeof e?.allowContributedOpeners=="string"?e?.allowContributedOpeners:void 0;for(let s of this._externalOpeners)if(await s.openExternal(n,{sourceUri:t,preferredOpenerId:r},ve.None))return!0}return this._defaultExternalOpener.openExternal(n,{sourceUri:t},ve.None)}dispose(){this._validators.clear()}};cLe=I([m(0,Kt),m(1,ge)],cLe);var MK=ae("IIgnoredExtensionsManagementService"),dLe=class{constructor(i){this.configurationService=i}hasToNeverSyncExtension(i){return this.getConfiguredIgnoredExtensions().includes(i.toLowerCase())}hasToAlwaysSyncExtension(i){return this.getConfiguredIgnoredExtensions().includes(`-${i.toLowerCase()}`)}updateIgnoredExtensions(i,e){let t=[...this.configurationService.getValue("settingsSync.ignoredExtensions")].map(o=>o.toLowerCase());return t=t.filter(o=>o!==i&&o!==`-${i}`),e&&t.push(i.toLowerCase()),this.configurationService.updateValue("settingsSync.ignoredExtensions",t.length?t:void 0,2)}updateSynchronizedExtensions(i,e){let t=[...this.configurationService.getValue("settingsSync.ignoredExtensions")].map(o=>o.toLowerCase());return t=t.filter(o=>o!==i&&o!==`-${i}`),e&&t.push(`-${i.toLowerCase()}`),this.configurationService.updateValue("settingsSync.ignoredExtensions",t.length?t:void 0,2)}getIgnoredExtensions(i){let e=i.filter(r=>r.isMachineScoped).map(r=>r.identifier.id.toLowerCase()),t=this.getConfiguredIgnoredExtensions().map(r=>r.toLowerCase()),o=[],n=[];if(Array.isArray(t))for(let r of t)r.startsWith("-")?n.push(r.substring(1)):o.push(r);return Uo([...e,...o].filter(r=>!n.includes(r)))}getConfiguredIgnoredExtensions(){return(this.configurationService.getValue("settingsSync.ignoredExtensions")||[]).map(i=>i.toLowerCase())}};dLe=I([m(0,B)],dLe);var uLe=class extends uU{constructor(i,e){super(),this.logger=this._register(i.createLogger(je(e.logsHome,`${jue}.log`),{id:jue,name:d(2700,null)}))}trace(i,...e){this.logger.trace(i,...e)}debug(i,...e){this.logger.debug(i,...e)}info(i,...e){this.logger.info(i,...e)}warn(i,...e){this.logger.warn(i,...e)}error(i,...e){this.logger.error(i,...e)}flush(){this.logger.flush()}};uLe=I([m(0,ol),m(1,Co)],uLe);function R4o(a){return a.type==="gallery"}function M4o(a){return a.type===1||a.type===0}var P4o=/^(?<version>\d+\.\d+\.\d+(-.*)?)(@(?<platform>.+))?$/,pLe=class extends C{constructor(e,t){super();this.configurationService=t;this._onDidChangeAllowedExtensions=this._register(new E);this.onDidChangeAllowedExtensionsConfigValue=this._onDidChangeAllowedExtensions.event;this.publisherOrgs=e.extensionPublisherOrgs?.map(o=>o.toLowerCase())??[],this._allowedExtensionsConfigValue=this.getAllowedExtensionsValue(),this._register(this.configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration(Kle)&&(this._allowedExtensionsConfigValue=this.getAllowedExtensionsValue(),this._onDidChangeAllowedExtensions.fire())}))}get allowedExtensionsConfigValue(){return this._allowedExtensionsConfigValue}getAllowedExtensionsValue(){let e=this.configurationService.getValue(Kle);if(!yi(e)||Array.isArray(e))return;let t=Object.entries(e).map(([o,n])=>[o.toLowerCase(),n]);if(!(t.length===1&&t[0][0]==="*"&&t[0][1]===!0))return Object.fromEntries(t)}isAllowed(e){if(!this._allowedExtensionsConfigValue)return!0;let t,o,n,r,s,l;R4o(e)?(t=e.identifier.id.toLowerCase(),o=e.version,r=e.properties.isPreReleaseVersion,s=e.publisher.toLowerCase(),l=e.publisherDisplayName.toLowerCase(),n=e.properties.targetPlatform):M4o(e)?(t=e.identifier.id.toLowerCase(),o=e.manifest.version,r=e.preRelease,s=e.manifest.publisher.toLowerCase(),l=e.publisherDisplayName?.toLowerCase(),n=e.targetPlatform):(t=e.id.toLowerCase(),o=e.version??"*",n=e.targetPlatform??"universal",r=e.prerelease??!1,s=e.id.substring(0,e.id.indexOf(".")).toLowerCase(),l=e.publisherDisplayName?.toLowerCase());let c=ic("workbench.action.openSettings",{query:`@id:${Kle}`}).toString(),u=this._allowedExtensionsConfigValue[t],p=new xe(d(1961,null,c));if(!cn(u))return Da(u)?u?!0:p:u==="stable"&&r?new xe(d(1958,null,c)):o!=="*"&&Array.isArray(u)&&!u.some(f=>{let v=P4o.exec(f);if(v&&v.groups){let{platform:b,version:S}=v.groups;return!(S!==o||n!=="universal"&&b&&n!==b)}return!1})?new xe(d(1962,null,o,c)):!0;let h=l&&this.publisherOrgs.includes(l)?l:s,g=this._allowedExtensionsConfigValue[h];return cn(g)?this._allowedExtensionsConfigValue["*"]===!0?!0:p:Da(g)?g?!0:new xe(d(1960,null,h,c)):g==="stable"&&r?new xe(d(1959,null,h,c)):!0}};pLe=I([m(0,nt),m(1,B)],pLe);var PK=ae("IMcpGalleryService"),rso=ae("IMcpManagementService"),MR=ae("IAllowedMcpServersService"),mk="chat.mcp.access",b4="chat.mcp.gallery.serviceUrl",AK="chat.mcp.gallery.enabled",ZJ="chat.mcp.autostart",g0t="chat.mcp.apps.enabled";var aso;(o=>{o.VERSION="v0-2025-07-09",o.SCHEMA="https://static.modelcontextprotocol.io/schemas/2025-07-09/server.schema.json";class e{toRawGalleryMcpServerResult(r){if(!r||typeof r!="object"||!Array.isArray(r.servers))return;let s=r,l=[];for(let c of s.servers){let u=this.toRawGalleryMcpServer(c);if(!u)return;l.push(u)}return{metadata:{count:s.metadata.count??0,nextCursor:s.metadata?.next_cursor},servers:l}}toRawGalleryMcpServer(r){if(!r||typeof r!="object")return;let s=r;if(!s.name||!Ae(s.name)||!s.description||!Ae(s.description)||!s.version||!Ae(s.version)||s.$schema&&s.$schema!==o.SCHEMA)return;let l=s._meta?.["io.modelcontextprotocol.registry/official"];function c(b){return{...b,isRequired:b.is_required,isSecret:b.is_secret}}function u(b){let S={};for(let[y,w]of Object.entries(b))S[y]=c(w);return S}function p(b){return b.type==="positional"?{...b,valueHint:b.value_hint,isRepeated:b.is_repeated,isRequired:b.is_required,isSecret:b.is_secret,variables:b.variables?u(b.variables):void 0}:{...b,isRepeated:b.is_repeated,isRequired:b.is_required,isSecret:b.is_secret,variables:b.variables?u(b.variables):void 0}}function h(b){return{...b,isRequired:b.is_required,isSecret:b.is_secret,variables:b.variables?u(b.variables):void 0}}function g(b){switch(b.type){case"stdio":return{type:"stdio"};case"streamable-http":return{type:"streamable-http",url:b.url,headers:b.headers?.map(h)};case"sse":return{type:"sse",url:b.url,headers:b.headers?.map(h)};default:return{type:"stdio"}}}function f(b){switch(b){case"npm":return"npm";case"docker":case"docker-hub":case"oci":return"oci";case"pypi":return"pypi";case"nuget":return"nuget";case"mcpb":return"mcpb";default:return"npm"}}let v=s._meta["io.modelcontextprotocol.registry/publisher-provided"]?.github;return{id:l.id,name:s.name,description:s.description,repository:s.repository?{url:s.repository.url,source:s.repository.source,id:s.repository.id}:void 0,readme:s.repository?.readme,version:s.version,createdAt:s.created_at,updatedAt:s.updated_at,packages:s.packages?.map(b=>({identifier:b.identifier??b.name,registryType:f(b.registry_type??b.registry_name),version:b.version,fileSha256:b.file_sha256,registryBaseUrl:b.registry_base_url,transport:b.transport?g(b.transport):{type:"stdio"},packageArguments:b.package_arguments?.map(p),runtimeHint:b.runtime_hint,runtimeArguments:b.runtime_arguments?.map(p),environmentVariables:b.environment_variables?.map(h)})),remotes:s.remotes?.map(b=>({type:(b.type??b.transport_type??b.transport)==="sse"?"sse":"streamable-http",url:b.url,headers:b.headers?.map(h)})),registryInfo:{isLatest:l.is_latest,publishedAt:l.published_at,updatedAt:l.updated_at},githubInfo:v?{name:v.name,nameWithOwner:v.name_with_owner,displayName:v.display_name,isInOrganization:v.is_in_organization,license:v.license,opengraphImageUrl:v.opengraph_image_url,ownerAvatarUrl:v.owner_avatar_url,primaryLanguage:v.primary_language,primaryLanguageColor:v.primary_language_color,pushedAt:v.pushed_at,stargazerCount:v.stargazer_count,topics:v.topics,usesCustomOpengraphImage:v.uses_custom_opengraph_image}:void 0}}}o.SERIALIZER=new e})(aso||={});var f0t;(t=>{t.VERSION="v0.1";class i{toRawGalleryMcpServerResult(n){if(!n||typeof n!="object"||!Array.isArray(n.servers))return;let r=n,s=[];for(let l of r.servers){let c=this.toRawGalleryMcpServer(l);if(!c){if(s.length===0)return;continue}s.push(c)}return{metadata:r.metadata,servers:s}}toRawGalleryMcpServer(n){if(!n||typeof n!="object")return;let r=n;if(!r.server||!yi(r.server)||!r.server.name||!Ae(r.server.name)||!r.server.description||!Ae(r.server.description)||!r.server.version||!Ae(r.server.version))return;let{"io.modelcontextprotocol.registry/official":s,...l}=r._meta,c=r.server._meta?.["io.modelcontextprotocol.registry/publisher-provided"]?.github;return{name:r.server.name,description:r.server.description,version:r.server.version,title:r.server.title,repository:r.server.repository?{url:r.server.repository.url,source:r.server.repository.source,id:r.server.repository.id}:void 0,readme:c?.readme,icons:r.server.icons,websiteUrl:r.server.websiteUrl,packages:r.server.packages,remotes:r.server.remotes,status:s?.status,registryInfo:s,githubInfo:c,apicInfo:l}}}t.SERIALIZER=new i})(f0t||={});var fIi;(t=>{t.VERSION="v0";class i{constructor(){this.galleryMcpServerDataSerializers=[];this.galleryMcpServerDataSerializers.push(f0t.SERIALIZER),this.galleryMcpServerDataSerializers.push(aso.SERIALIZER)}toRawGalleryMcpServerResult(n){for(let r of this.galleryMcpServerDataSerializers){let s=r.toRawGalleryMcpServerResult(n);if(s)return s}}toRawGalleryMcpServer(n){for(let r of this.galleryMcpServerDataSerializers){let s=r.toRawGalleryMcpServer(n);if(s)return s}}}t.SERIALIZER=new i})(fIi||={});var A4o=50,N4o={pageSize:A4o},vIi=class a{constructor(i=N4o){this.state=i}get pageSize(){return this.state.pageSize}get searchText(){return this.state.searchText}get cursor(){return this.state.cursor}withPage(i,e=this.pageSize){return new a({...this.state,pageSize:e,cursor:i})}withSearchText(i){return new a({...this.state,searchText:i})}},mLe=class extends C{constructor(e,t,o,n){super();this.requestService=e;this.fileService=t;this.logService=o;this.mcpGalleryManifestService=n;this.galleryMcpServerDataSerializers=new Map,this.galleryMcpServerDataSerializers.set(fIi.VERSION,fIi.SERIALIZER),this.galleryMcpServerDataSerializers.set(f0t.VERSION,f0t.SERIALIZER)}isEnabled(){return this.mcpGalleryManifestService.mcpGalleryManifestStatus==="available"}async query(e,t=ve.None){let o=await this.mcpGalleryManifestService.getMcpGalleryManifest();if(!o)return{firstPage:{items:[],hasMore:!1},getNextPage:async()=>({items:[],hasMore:!1})};let n=new vIi;e?.text&&(n=n.withSearchText(e.text.trim()));let{servers:r,metadata:s}=await this.queryGalleryMcpServers(n,o,t),l=s.nextCursor;return{firstPage:{items:r,hasMore:!!s.nextCursor},getNextPage:async c=>{if(c.isCancellationRequested)throw new ho;if(!l)return{items:[],hasMore:!1};let{servers:u,metadata:p}=await this.queryGalleryMcpServers(n.withPage(l).withSearchText(void 0),o,c);return l=p.nextCursor,{items:u,hasMore:!!p.nextCursor}}}}async getMcpServersFromGallery(e){let t=await this.mcpGalleryManifestService.getMcpGalleryManifest();if(!t)return[];let o=[];return await Promise.allSettled(e.map(async n=>{let r=await this.getMcpServerByName(n,t);r&&o.push(r)})),o}async getMcpServerByName({name:e,id:t},o){let n=this.getLatestServerVersionUrl(e,o);if(n){let l=await this.getMcpServer(n);if(l)return l}let r=this.getNamedServerUrl(e,o);if(r){let l=await this.getMcpServer(r);if(l)return l}let s=t?this.getServerIdUrl(t,o):void 0;if(s){let l=await this.getMcpServer(s);if(l)return l}}async getReadme(e,t){let o=e.readmeUrl;if(!o)return Promise.resolve(d(2155,null));let n=A.parse(o);if(n.scheme===Y.file)try{return(await this.fileService.readFile(n)).value.toString()}catch(l){this.logService.error(`Failed to read file from ${n}: ${l}`)}if(n.authority!=="raw.githubusercontent.com")return new xe(d(2156,null,o)).value;let r=await this.requestService.request({type:"GET",url:o},t),s=await E_(r);if(!s)throw new Error(`Failed to fetch README from ${o}`);return s}toGalleryMcpServer(e,t){let o="",n=e.title;if(e.githubInfo?.name)n||(n=e.githubInfo.name.split("-").map(c=>c.toLowerCase()==="mcp"?"MCP":c.toLowerCase()==="github"?"GitHub":Cre(c)).join(" ")),o=e.githubInfo.nameWithOwner.split("/")[0];else{let c=e.name.split("/");if(c.length>0){let u=c[0].split(".");u.length>0&&(o=u[u.length-1])}n||(n=c[c.length-1].split("-").map(u=>Cre(u)).join(" "))}e.githubInfo?.displayName&&(n=e.githubInfo.displayName);let r;if(e.githubInfo?.preferredImage)r={light:e.githubInfo.preferredImage,dark:e.githubInfo.preferredImage};else if(e.githubInfo?.ownerAvatarUrl)r={light:e.githubInfo.ownerAvatarUrl,dark:e.githubInfo.ownerAvatarUrl};else if(e.apicInfo?.["x-ms-icon"])r={light:e.apicInfo["x-ms-icon"],dark:e.apicInfo["x-ms-icon"]};else if(e.icons&&e.icons.length>0){let c=e.icons.find(p=>p.theme==="light")??e.icons[0],u=e.icons.find(p=>p.theme==="dark")??c;r={light:c.src,dark:u.src}}let s=t?this.getWebUrl(e.name,t):void 0,l=t?this.getPublisherUrl(o,t):void 0;return{id:e.id,name:e.name,displayName:n,galleryUrl:t?.url,webUrl:s,description:e.description,status:e.status??"active",version:e.version,isLatest:e.registryInfo?.isLatest??!0,publishDate:e.registryInfo?.publishedAt?Date.parse(e.registryInfo.publishedAt):void 0,lastUpdated:e.githubInfo?.pushedAt?Date.parse(e.githubInfo.pushedAt):e.registryInfo?.updatedAt?Date.parse(e.registryInfo.updatedAt):void 0,repositoryUrl:e.repository?.url,readme:e.readme,icon:r,publisher:o,publisherUrl:l,license:e.githubInfo?.license,starsCount:e.githubInfo?.stargazerCount,topics:e.githubInfo?.topics,configuration:{packages:e.packages,remotes:e.remotes}}}async queryGalleryMcpServers(e,t,o){let{servers:n,metadata:r}=await this.queryRawGalleryMcpServers(e,t,o);return{servers:n.map(s=>this.toGalleryMcpServer(s,t)),metadata:r}}async queryRawGalleryMcpServers(e,t,o){let n=this.getMcpGalleryUrl(t);if(!n)return{servers:[],metadata:{count:0}};let r=A.parse(n);if(r.scheme===Y.file)try{let h=(await this.fileService.readFile(r)).value.toString();return JSON.parse(h)}catch(p){this.logService.error(`Failed to read file from ${r}: ${p}`)}let s=`${n}?limit=${e.pageSize}&version=latest`;if(e.cursor&&(s+=`&cursor=${e.cursor}`),e.searchText){let p=encodeURIComponent(e.searchText);s+=`&search=${p}`}let l=await this.requestService.request({type:"GET",url:s},o),c=await hh(l);if(!c)return{servers:[],metadata:{count:0}};let u=this.serializeMcpServersResult(c,t);if(!u)throw new Error(`Failed to serialize MCP servers result from ${n}`,c);return u}async getMcpServer(e,t){let o=await this.requestService.request({type:"GET",url:e},ve.None);if(o.res.statusCode&&o.res.statusCode>=400&&o.res.statusCode<500)return;let n=await hh(o);if(!n)return;t||(t=await this.mcpGalleryManifestService.getMcpGalleryManifest()),t=t&&e.startsWith(t.url)?t:null;let r=this.serializeMcpServer(n,t);if(!r)throw new Error(`Failed to serialize MCP server from ${e}`,n);return this.toGalleryMcpServer(r,t)}serializeMcpServer(e,t){return this.getSerializer(t)?.toRawGalleryMcpServer(e)}serializeMcpServersResult(e,t){return this.getSerializer(t)?.toRawGalleryMcpServerResult(e)}getSerializer(e){let t=e?.version??"v0";return this.galleryMcpServerDataSerializers.get(t)}getNamedServerUrl(e,t){let o=m5(t,"McpServerNamedResourceUriTemplate");if(o)return PT(o,{name:e})}getServerIdUrl(e,t){let o=m5(t,"McpServerIdUriTemplate");if(o)return PT(o,{id:e})}getLatestServerVersionUrl(e,t){let o=m5(t,"McpServerLatestVersionUriTemplate");if(o)return PT(o,{name:encodeURIComponent(e)})}getWebUrl(e,t){let o=m5(t,"McpServerWebUriTemplate");if(o)return PT(o,{name:e})}getPublisherUrl(e,t){let o=m5(t,"PublisherUriTemplate");if(o)return PT(o,{name:e})}getMcpGalleryUrl(e){return m5(e,"McpServersQueryService")}};mLe=I([m(0,_a),m(1,be),m(2,ne),m(3,wV)],mLe);var hLe=class extends C{constructor(e){super();this.configurationService=e;this._onDidChangeAllowedMcpServers=this._register(new E);this.onDidChangeAllowedMcpServers=this._onDidChangeAllowedMcpServers.event;this._register(this.configurationService.onDidChangeConfiguration(t=>{t.affectsConfiguration(mk)&&this._onDidChangeAllowedMcpServers.fire()}))}isAllowed(e){if(this.configurationService.getValue(mk)!=="none")return!0;let t=ic("workbench.action.openSettings",{query:`@id:${mk}`}).toString();return new xe(d(2154,null,t))}};hLe=I([m(0,B)],hLe);var rJe="workbench.actions.accounts.signIn";var O4o=new Q("defaultAccountStatus","uninitialized"),v0t="defaultAccount.cachedPolicyData",SIi=3600*1e3;function lso(a){return{preferredExtensions:[a.chatExtensionId,a.extensionId],authenticationProvider:{default:{id:a.provider.default.id,name:a.provider.default.name},enterprise:{id:a.provider.enterprise.id,name:a.provider.enterprise.name},enterpriseProviderConfig:`${a.completionsAdvancedSetting}.authProvider`,enterpriseProviderUriSetting:a.providerUriSetting,scopes:a.providerScopes},entitlementUrl:a.entitlementUrl,tokenEntitlementUrl:a.tokenEntitlementUrl,mcpRegistryDataUrl:a.mcpRegistryDataUrl}}var gLe=class extends C{constructor(e){super();this.defaultAccount=null;this.initBarrier=new Np;this._onDidChangeDefaultAccount=this._register(new E);this.onDidChangeDefaultAccount=this._onDidChangeDefaultAccount.event;this._onDidChangePolicyData=this._register(new E);this.onDidChangePolicyData=this._onDidChangePolicyData.event;this._onDidChangeCopilotTokenInfo=this._register(new E);this.onDidChangeCopilotTokenInfo=this._onDidChangeCopilotTokenInfo.event;this.defaultAccountProvider=null;this.defaultAccountConfig=lso(e.defaultChatAgent)}get policyData(){return this.defaultAccountProvider?.policyData??null}get copilotTokenInfo(){return this.defaultAccountProvider?.copilotTokenInfo??null}async getDefaultAccount(){return await this.initBarrier.wait(),this.defaultAccount}getDefaultAccountAuthenticationProvider(){return this.defaultAccountProvider?this.defaultAccountProvider.getDefaultAccountAuthenticationProvider():{...this.defaultAccountConfig.authenticationProvider.default,enterprise:!1}}setDefaultAccountProvider(e){if(this.defaultAccountProvider)throw new Error("Default account provider is already set");this.defaultAccountProvider=e,this.defaultAccountProvider.policyData&&this._onDidChangePolicyData.fire(this.defaultAccountProvider.policyData),e.refresh().then(t=>{this.defaultAccount=t}).finally(()=>{this.initBarrier.open(),this._register(e.onDidChangeDefaultAccount(t=>this.setDefaultAccount(t))),this._register(e.onDidChangePolicyData(t=>this._onDidChangePolicyData.fire(t))),this._register(e.onDidChangeCopilotTokenInfo(t=>this._onDidChangeCopilotTokenInfo.fire(t)))})}async refresh(){await this.initBarrier.wait();let e=await this.defaultAccountProvider?.refresh();return this.setDefaultAccount(e??null),this.defaultAccount}async signIn(e){return await this.initBarrier.wait(),this.defaultAccountProvider?.signIn(e)??null}async signOut(){await this.initBarrier.wait(),await this.defaultAccountProvider?.signOut()}setDefaultAccount(e){uo(this.defaultAccount,e)||(this.defaultAccount=e,this._onDidChangeDefaultAccount.fire(this.defaultAccount))}};gLe=I([m(0,nt)],gLe);var nJe=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.defaultAccountConfig=e;this.configurationService=t;this.authenticationService=o;this.authenticationExtensionsService=n;this.telemetryService=r;this.extensionService=s;this.requestService=l;this.logService=c;this.environmentService=u;this.storageService=h;this.hostService=g;this.commandService=f;this._defaultAccount=null;this._policyData=null;this._copilotTokenInfo=null;this._onDidChangeDefaultAccount=this._register(new E);this.onDidChangeDefaultAccount=this._onDidChangeDefaultAccount.event;this._onDidChangePolicyData=this._register(new E);this.onDidChangePolicyData=this._onDidChangePolicyData.event;this._onDidChangeCopilotTokenInfo=this._register(new E);this.onDidChangeCopilotTokenInfo=this._onDidChangeCopilotTokenInfo.event;this.initialized=!1;this.updateThrottler=this._register(new ya(100));this.accountDataPollScheduler=this._register(new Dt(()=>this.refetchDefaultAccount(),SIi));this.accountStatusContext=O4o.bindTo(p);let v=this.getCachedAccountData();this._policyData=v?.accountPolicyData??null,this._copilotTokenInfo=v?.copilotTokenInfo??null,this.initPromise=this.init().finally(()=>{this.telemetryService.publicLog2("defaultaccount:status",{status:this.defaultAccount?"available":"unavailable",initial:!0}),this.initialized=!0})}get defaultAccount(){return this._defaultAccount?.defaultAccount??null}get policyData(){return this._policyData?.policyData??null}get copilotTokenInfo(){return this._copilotTokenInfo}getCachedAccountData(){let e=this.storageService.get(v0t,-1);if(e)try{let t=JSON.parse(e),{accountId:o,policyData:n,tokenEntitlementsFetchedAt:r,mcpRegistryDataFetchedAt:s,copilotTokenInfo:l}=t;if(o&&n){this.logService.debug("[DefaultAccount] Initializing with cached policy data (migrating old format)");let p={accountPolicyData:{accountId:o,policyData:n,tokenEntitlementsFetchedAt:r,mcpRegistryDataFetchedAt:s},copilotTokenInfo:l};return this.storageService.store(v0t,JSON.stringify(p),-1,1),p}let{accountPolicyData:c,copilotTokenInfo:u}=t;if(c?.accountId&&c?.policyData)return this.logService.debug("[DefaultAccount] Initializing with cached policy data"),{accountPolicyData:c,copilotTokenInfo:u}}catch(t){this.logService.error("[DefaultAccount] Failed to parse cached policy data",Cn(t))}return null}async init(){if(Gt&&!this.environmentService.remoteAuthority){this.logService.debug("[DefaultAccount] Running in web without remote, skipping initialization");return}try{await this.extensionService.whenInstalledExtensionsRegistered(),this.logService.debug("[DefaultAccount] Installed extensions registered.")}catch(e){this.logService.error("[DefaultAccount] Error while waiting for installed extensions to be registered",Cn(e))}this.logService.debug("[DefaultAccount] Starting initialization"),await this.doUpdateDefaultAccount(),this.logService.debug("[DefaultAccount] Initialization complete"),this._register(this.onDidChangeDefaultAccount(e=>{this.telemetryService.publicLog2("defaultaccount:status",{status:e?"available":"unavailable",initial:!1})})),this._register(this.authenticationService.onDidChangeSessions(e=>{let t=this.getDefaultAccountAuthenticationProvider();e.providerId===t.id&&(this.defaultAccount&&e.event.removed?.some(o=>o.id===this.defaultAccount?.sessionId)?this.setDefaultAccount(null):(this.logService.debug("[DefaultAccount] Sessions changed for default account provider, updating default account"),this.updateDefaultAccount()))})),this._register(this.authenticationExtensionsService.onDidChangeAccountPreference(async e=>{let t=this.getDefaultAccountAuthenticationProvider();e.providerId===t.id&&(this.logService.debug("[DefaultAccount] Account preference changed for default account provider, updating default account"),this.updateDefaultAccount())})),this._register(this.authenticationService.onDidRegisterAuthenticationProvider(e=>{let t=this.getDefaultAccountAuthenticationProvider();e.id===t.id&&(this.logService.debug("[DefaultAccount] Default account provider registered, updating default account"),this.updateDefaultAccount())})),this._register(this.authenticationService.onDidUnregisterAuthenticationProvider(e=>{let t=this.getDefaultAccountAuthenticationProvider();e.id===t.id&&(this.logService.debug("[DefaultAccount] Default account provider unregistered, updating default account"),this.updateDefaultAccount())})),this._register(this.hostService.onDidChangeFocus(e=>{e&&this.refetchDefaultAccount(!0)}))}async refresh(){return this.initialized?(this.logService.debug("[DefaultAccount] Refreshing default account"),await this.updateDefaultAccount(),this.defaultAccount):(await this.initPromise,this.defaultAccount)}async refetchDefaultAccount(e){if(this.accountDataPollScheduler.isScheduled()&&this.accountDataPollScheduler.cancel(),!this.hostService.hasFocus||!this._defaultAccount){this.scheduleAccountDataPoll(),this.logService.debug("[DefaultAccount] Skipping refetching default account. Host is not focused or default account is not set");return}this.logService.debug("[DefaultAccount] Refetching default account"),await this.updateDefaultAccount(e)}async updateDefaultAccount(e){await this.updateThrottler.trigger(()=>this.doUpdateDefaultAccount(e))}async doUpdateDefaultAccount(e=!1){try{let t=await this.fetchDefaultAccount(e);this.setDefaultAccount(t),this.scheduleAccountDataPoll()}catch(t){this.logService.error("[DefaultAccount] Error while updating default account",Cn(t))}}async fetchDefaultAccount(e){let t=this.getDefaultAccountAuthenticationProvider();return this.logService.debug("[DefaultAccount] Default account provider ID:",t.id),this.authenticationService.declaredProviders.find(n=>n.id===t.id)?await this.getDefaultAccountForAuthenticationProvider(t,e):(this.logService.info("[DefaultAccount] Authentication provider is not declared.",t),null)}setDefaultAccount(e){uo(this._defaultAccount,e)||(this.logService.trace("[DefaultAccount] Updating default account:",e),e?(this._defaultAccount=e,this.setCopilotTokenInfo(e.copilotTokenInfo),this.setPolicyData(e.policyData),this._onDidChangeDefaultAccount.fire(this._defaultAccount.defaultAccount),this.accountStatusContext.set("available"),this.logService.debug("[DefaultAccount] Account status set to Available")):(this._defaultAccount=null,this.setPolicyData(null),this.setCopilotTokenInfo(null),this._onDidChangeDefaultAccount.fire(null),this.accountDataPollScheduler.cancel(),this.accountStatusContext.set("unavailable"),this.logService.debug("[DefaultAccount] Account status set to Unavailable")))}setPolicyData(e){uo(this._policyData,e)||(this._policyData=e,this.cachePolicyData(e),this._onDidChangePolicyData.fire(this._policyData?.policyData??null))}setCopilotTokenInfo(e){uo(this._copilotTokenInfo,e)||(this._copilotTokenInfo=e,this._onDidChangeCopilotTokenInfo.fire(this._copilotTokenInfo))}cachePolicyData(e){if(e){this.logService.debug("[DefaultAccount] Caching policy data for account:",e.accountId);let t={accountPolicyData:e,copilotTokenInfo:this._copilotTokenInfo??void 0};this.storageService.store(v0t,JSON.stringify(t),-1,1)}else this.logService.debug("[DefaultAccount] Removing cached policy data"),this.storageService.remove(v0t,-1)}scheduleAccountDataPoll(){this._defaultAccount&&this.accountDataPollScheduler.schedule(SIi)}extractFromToken(e){let t=new Map,n=e?.split(":")[0]?.split(";");for(let r of n){let[s,l]=r.split("=");t.set(s,l)}return this.logService.debug(`[DefaultAccount] extractFromToken: ${JSON.stringify(Object.fromEntries(t))}`),t}async getDefaultAccountForAuthenticationProvider(e,t){try{this.logService.debug("[DefaultAccount] Getting Default Account from authenticated sessions for provider:",e.id);let o=await this.findMatchingProviderSession(e.id,this.defaultAccountConfig.authenticationProvider.scopes);return o?.length?this.getDefaultAccountFromAuthenticatedSessions(e,o,t):(this.logService.debug("[DefaultAccount] No matching session found for provider:",e.id),null)}catch(o){return this.logService.error("[DefaultAccount] Failed to get default account for provider:",e.id,Cn(o)),null}}async getDefaultAccountFromAuthenticatedSessions(e,t,o){try{let n=t[0].account.id,r=this._defaultAccount?.accountId===n?this._defaultAccount?.defaultAccount.entitlementsData:void 0,s=this._policyData?.accountId===n?this._policyData:void 0,[l,c]=await Promise.all([o&&r?r:this.getEntitlements(t),this.getTokenEntitlements(t,s)]),u,p,h=s?.policyData?{...s.policyData}:void 0;if(c){u=c.fetchedAt;let f=c.data;if(h=h??{},h.chat_agent_enabled=f.policyData.chat_agent_enabled,h.chat_preview_features_enabled=f.policyData.chat_preview_features_enabled,h.mcp=f.policyData.mcp,h.mcp){let v=await this.getMcpRegistryProvider(t,s);p=v?.fetchedAt,h.mcpRegistryUrl=v?.data?.url,h.mcpAccess=v?.data?.registry_access}else h.mcpRegistryUrl=void 0,h.mcpAccess=void 0}let g={authenticationProvider:e,accountName:t[0].account.label,sessionId:t[0].id,enterprise:e.enterprise||t[0].account.label.includes("_"),entitlementsData:l};return this.logService.debug("[DefaultAccount] Successfully created default account for provider:",e.id),{defaultAccount:g,accountId:n,policyData:h?{accountId:n,policyData:h,tokenEntitlementsFetchedAt:u,mcpRegistryDataFetchedAt:p}:null,copilotTokenInfo:c?.data.copilotTokenInfo??null}}catch(n){return this.logService.error("[DefaultAccount] Failed to create default account for provider:",e.id,Cn(n)),null}}async findMatchingProviderSession(e,t){let o=await this.getSessions(e),n=[];for(let r of o){this.logService.debug("[DefaultAccount] Checking session with scopes",r.scopes);for(let s of t)this.scopesMatch(r.scopes,s)&&n.push(r)}return n.length>0?n:void 0}async getSessions(e){for(let t=1;t<=3;t++)try{let o,n;for(let r of this.defaultAccountConfig.preferredExtensions)if(n=this.authenticationExtensionsService.getAccountPreference(r,e),n)break;for(let r of await this.authenticationService.getAccounts(e))if(r.label===n){o=r;break}return await this.authenticationService.getSessions(e,void 0,{account:o},!0)}catch(o){if(this.logService.warn(`[DefaultAccount] Attempt ${t} to get sessions failed:`,Cn(o)),t===3)throw o;await Pi(500)}throw new Error("Unable to get sessions after multiple attempts")}scopesMatch(e,t){return t.every(o=>e.includes(o))}async getTokenEntitlements(e,t){if(t?.tokenEntitlementsFetchedAt&&!this.isDataStale(t.tokenEntitlementsFetchedAt))return this.logService.debug("[DefaultAccount] Using last fetched token entitlements data"),{data:{policyData:t.policyData,copilotTokenInfo:this._copilotTokenInfo??{}},fetchedAt:t.tokenEntitlementsFetchedAt};let o=await this.requestTokenEntitlements(e);return o?{data:o,fetchedAt:Date.now()}:void 0}async requestTokenEntitlements(e){let t=this.getTokenEntitlementUrl();if(!t){this.logService.debug("[DefaultAccount] No token entitlements URL found");return}this.logService.debug("[DefaultAccount] Fetching token entitlements from:",t);let o=await this.request(t,"GET",void 0,e,ve.None);if(o){if(o.res.statusCode&&o.res.statusCode!==200){this.logService.trace(`[DefaultAccount] unexpected status code ${o.res.statusCode} while fetching token entitlements`);return}try{let n=await hh(o);if(n){let r=this.extractFromToken(n.token);return{policyData:{chat_preview_features_enabled:r.get("editor_preview_features")!=="0",chat_agent_enabled:r.get("agent_mode")!=="0",mcp:r.get("mcp")!=="0"},copilotTokenInfo:{sn:r.get("sn"),fcv1:r.get("fcv1")}}}this.logService.error("Failed to fetch token entitlements","No data returned")}catch(n){this.logService.error("Failed to fetch token entitlements",Cn(n))}}}async getEntitlements(e){let t=this.getEntitlementUrl();if(!t){this.logService.debug("[DefaultAccount] No chat entitlements URL found");return}this.logService.debug("[DefaultAccount] Fetching entitlements from:",t);let o=await this.request(t,"GET",void 0,e,ve.None);if(o){if(o.res.statusCode&&o.res.statusCode!==200)return this.logService.trace(`[DefaultAccount] unexpected status code ${o.res.statusCode} while fetching entitlements`),o.res.statusCode===401||o.res.statusCode===404?null:void 0;try{let n=await hh(o);if(n)return n;this.logService.error("[DefaultAccount] Failed to fetch entitlements","No data returned")}catch(n){this.logService.error("[DefaultAccount] Failed to fetch entitlements",Cn(n))}}}async getMcpRegistryProvider(e,t){if(t?.mcpRegistryDataFetchedAt&&!this.isDataStale(t.mcpRegistryDataFetchedAt))return this.logService.debug("[DefaultAccount] Using last fetched MCP registry data"),{data:t.policyData.mcpRegistryUrl&&t.policyData.mcpAccess?{url:t.policyData.mcpRegistryUrl,registry_access:t.policyData.mcpAccess}:null,fetchedAt:t.mcpRegistryDataFetchedAt};let o=await this.requestMcpRegistryProvider(e);return cn(o)?void 0:{data:o,fetchedAt:Date.now()}}async requestMcpRegistryProvider(e){let t=this.getMcpRegistryDataUrl();if(!t)return this.logService.debug("[DefaultAccount] No MCP registry data URL found"),null;this.logService.debug("[DefaultAccount] Fetching MCP registry data from:",t);let o=await this.request(t,"GET",void 0,e,ve.None);if(o){if(!aP(o)){if(UEt(o))return this.logService.debug(`[DefaultAccount] Received ${o.res.statusCode} for MCP registry data, treating as no registry available.`),null;this.logService.debug(`[DefaultAccount] unexpected status code ${o.res.statusCode} while fetching MCP registry data`);return}try{let n=await hh(o);return n?(this.logService.debug("Fetched MCP registry providers",n.mcp_registries),n.mcp_registries[0]??null):(this.logService.debug("No MCP registry providers content found in response"),null)}catch(n){this.logService.error("Failed to fetch MCP registry providers",Cn(n));return}}}async request(e,t,o,n,r){let s;for(let l of n){if(r.isCancellationRequested)return s;try{let c=await this.requestService.request({type:t,url:e,data:t==="POST"?JSON.stringify(o):void 0,disableCache:!0,headers:{Authorization:`Bearer ${l.accessToken}`}},r),u=c.res.statusCode;if(u===401||u===404){this.logService.debug(`[DefaultAccount] Received ${u} for URL ${e} with session ${l.id}, likely due to expired/revoked token or insufficient permissions.`,"Trying next session if available."),s=c;continue}return c}catch(c){r.isCancellationRequested||this.logService.error(`[DefaultAccount] request: error ${c}`,e)}}if(!s){this.logService.trace("[DefaultAccount]: No response received for request",e);return}return s}isDataStale(e){return Date.now()-e>=SIi}getEntitlementUrl(){if(this.getDefaultAccountAuthenticationProvider().enterprise)try{let e=this.getEnterpriseUrl();return e?`${e.protocol}//api.${e.hostname}${e.port?":"+e.port:""}/copilot_internal/user`:void 0}catch(e){this.logService.error(e)}return this.defaultAccountConfig.entitlementUrl}getTokenEntitlementUrl(){if(this.getDefaultAccountAuthenticationProvider().enterprise)try{let e=this.getEnterpriseUrl();return e?`${e.protocol}//api.${e.hostname}${e.port?":"+e.port:""}/copilot_internal/v2/token`:void 0}catch(e){this.logService.error(e)}return this.defaultAccountConfig.tokenEntitlementUrl}getMcpRegistryDataUrl(){if(this.getDefaultAccountAuthenticationProvider().enterprise)try{let e=this.getEnterpriseUrl();return e?`${e.protocol}//api.${e.hostname}${e.port?":"+e.port:""}/copilot/mcp_registry`:void 0}catch(e){this.logService.error(e)}return this.defaultAccountConfig.mcpRegistryDataUrl}getDefaultAccountAuthenticationProvider(){return this.configurationService.getValue(this.defaultAccountConfig.authenticationProvider.enterpriseProviderConfig)===this.defaultAccountConfig.authenticationProvider.enterprise.id?{...this.defaultAccountConfig.authenticationProvider.enterprise,enterprise:!0}:{...this.defaultAccountConfig.authenticationProvider.default,enterprise:!1}}getEnterpriseUrl(){let e=this.configurationService.getValue(this.defaultAccountConfig.authenticationProvider.enterpriseProviderUriSetting);if(Ae(e))return new URL(e)}async signIn(e){let t=this.getDefaultAccountAuthenticationProvider();if(!t)throw new Error("No default account provider configured");let{additionalScopes:o,...n}=e??{},r=this.defaultAccountConfig.authenticationProvider.scopes[0],s=o?Uo([...r,...o]):r,l=await this.authenticationService.createSession(t.id,s,n);for(let c of this.defaultAccountConfig.preferredExtensions)this.authenticationExtensionsService.updateAccountPreference(c,t.id,l.account);return await this.updateDefaultAccount(),this.defaultAccount}async signOut(){this.defaultAccount&&this.commandService.executeCommand("_signOutOfAccount",{providerId:this.defaultAccount.authenticationProvider.id,accountLabel:this.defaultAccount.accountName})}};nJe=I([m(1,B),m(2,Cs),m(3,DY),m(4,Te),m(5,lt),m(6,_a),m(7,ne),m(8,Vt),m(9,X),m(10,le),m(11,oi),m(12,ge)],nJe);var fLe=class extends C{static{this.ID="workbench.contributions.defaultAccountProvider"}constructor(i,e,t){super();let o=this._register(e.createInstance(nJe,lso(i.defaultChatAgent)));t.setDefaultAccountProvider(o)}};fLe=I([m(0,nt),m(1,F),m(2,Um)],fLe);W(class extends K{constructor(){super({id:rJe,title:L(16492,"Sign In")})}async run(a){await a.get(Um).signIn()}});pt(fLe.ID,fLe,ut.BlockStartup);var cso;(i=>{function a(e,t){return e.callstack<t.callstack?-1:e.callstack>t.callstack?1:0}i.compare=a})(cso||={});var sJe=class a{constructor(i,e=a.ERROR_FLUSH_TIMEOUT){this._flushHandle=void 0;this._buffer=[];this._disposables=new P;this._telemetryService=i,this._flushDelay=e;let t=i6.addListener(o=>this._onErrorEvent(o));this._disposables.add(Z(t)),this.installErrorListeners()}static{this.ERROR_FLUSH_TIMEOUT=5*1e3}dispose(){clearTimeout(this._flushHandle),this._flushBuffer(),this._disposables.dispose()}installErrorListeners(){}_onErrorEvent(i){if(!i||i.code||(i.detail&&i.detail.stack&&(i=i.detail),Zs.isErrorNoTelemetry(i)||i instanceof As||Lut.is(i)||typeof i?.message=="string"&&i.message.includes("Unable to read file")))return;let e=Array.isArray(i.stack)?i.stack.join(`
`):i.stack,t=i.message?i.message:pU(i);e&&this._enqueue({msg:t,callstack:e})}_enqueue(i){let e=cx(this._buffer,i,cso.compare);e<0?(i.count=1,this._buffer.splice(~e,0,i)):(this._buffer[e].count||(this._buffer[e].count=0),this._buffer[e].count+=1),this._flushHandle===void 0&&(this._flushHandle=setTimeout(()=>{this._flushBuffer(),this._flushHandle=void 0},this._flushDelay))}_flushBuffer(){for(let i of this._buffer)this._telemetryService.publicLogError2("UnhandledError",i);this._buffer.length=0}};var aJe=class extends sJe{installErrorListeners(){let i,e=this;typeof It.onerror=="function"&&(i=It.onerror),It.onerror=function(t,o,n,r,s){e._onUncaughtError(t,o,n,r,s),i?.apply(this,[t,o,n,r,s])},this._disposables.add(Z(()=>{i&&(It.onerror=i)}))}_onUncaughtError(i,e,t,o,n){let r={callstack:i,msg:i,file:e,line:t,column:o};if(n){if(Zs.isErrorNoTelemetry(n))return;let{name:s,message:l,stack:c}=n;r.uncaught_error_name=s,l&&(r.uncaught_error_msg=l),c&&(r.callstack=Array.isArray(n.stack)?n.stack=n.stack.join(`
`):n.stack)}this._enqueue(r)}};var eZ=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.telemetryService=e;this.contextService=t;this.userDataProfileService=c;this.loggerService=h;this.outputService=g;let{filesToOpenOrCreate:v,filesToDiff:b,filesToMerge:S}=l,y=u.getActivePaneComposite(0);e.publicLog2("workspaceLoad",{windowSize:{innerHeight:It.innerHeight,innerWidth:It.innerWidth,outerHeight:It.outerHeight,outerWidth:It.outerWidth},emptyWorkbench:t.getWorkbenchState()===1,"workbench.filesToOpenOrCreate":v&&v.length||0,"workbench.filesToDiff":b&&b.length||0,"workbench.filesToMerge":S&&S.length||0,customKeybindingsCount:r.customKeybindingsCount(),theme:s.getColorTheme().id,language:Dr,pinnedViewlets:u.getPinnedPaneCompositeIds(0),restoredViewlet:y?y.getId():void 0,restoredEditors:n.visibleEditors.length,startupKind:o.startupKind}),this._register(new aJe(e)),this._register(f.files.onDidResolve(w=>this.onTextFileModelResolved(w))),this._register(f.files.onDidSave(w=>this.onTextFileModelSaved(w))),this._register(o.onDidShutdown(()=>this.dispose())),KL(p,l)&&this.handleTelemetryOutputVisibility()}static{this.ALLOWLIST_JSON=["package.json","package-lock.json","tsconfig.json","jsconfig.json","bower.json",".eslintrc.json","tslint.json","composer.json"]}static{this.ALLOWLIST_WORKSPACE_JSON=["settings.json","extensions.json","tasks.json","launch.json"]}onTextFileModelResolved(e){this.getTypeIfSettings(e.model.resource)||this.telemetryService.publicLog2("fileGet",this.getTelemetryData(e.model.resource,e.reason))}onTextFileModelSaved(e){this.getTypeIfSettings(e.model.resource)||this.telemetryService.publicLog2("filePUT",this.getTelemetryData(e.model.resource,e.reason))}getTypeIfSettings(e){if(ms(e)!==".json")return"";if(Xe(e,this.userDataProfileService.currentProfile.settingsResource))return"global-settings";if(Xe(e,this.userDataProfileService.currentProfile.keybindingsResource))return"keybindings";if(La(e,this.userDataProfileService.currentProfile.snippetsHome))return"snippets";let t=this.contextService.getWorkspace().folders;for(let o of t)if(La(e,o.toResource(".vscode"))){let n=Ye(e);if(eZ.ALLOWLIST_WORKSPACE_JSON.indexOf(n)>-1)return`.vscode/${n}`}return""}getTelemetryData(e,t){let o=ms(e),n=o.indexOf("?");o=n!==-1?o.substr(0,n):o;let r=Ye(e),s=e.scheme===Y.file?e.fsPath:e.path,l={mimeType:new Im(JEe(e).join(", ")),ext:o,path:Ir(s),reason:t,allowlistedjson:void 0};return o===".json"&&eZ.ALLOWLIST_JSON.indexOf(r)>-1&&(l.allowlistedjson=r),l}async handleTelemetryOutputVisibility(){let e=this;this._register(W(class extends K{constructor(){super({id:"workbench.action.showTelemetry",title:L(14049,"Show Telemetry"),category:We.Developer,f1:!0})}async run(){for(let o of e.loggerService.getRegisteredLoggers())o.group?.id===qxt.id&&(e.loggerService.setLogLevel(o.resource,1),e.loggerService.setVisibility(o.resource,!0));e.outputService.showChannel(qxt.id)}})),[...this.loggerService.getRegisteredLoggers()].find(o=>o.id===qle)||await H.toPromise(H.filter(this.loggerService.onDidChangeLoggers,o=>[...o.added].some(n=>n.id===qle)));let t=!1;for(let o of this.loggerService.getRegisteredLoggers())if(o.id===qle){t=this.loggerService.getLogLevel()===1||!o.hidden,t&&this.loggerService.setVisibility(o.id,!0);break}if(t){let o=n=>{for(let r of n)r.group?.id===qxt.id&&(e.loggerService.setLogLevel(r.resource,1),this.loggerService.setVisibility(r.id,!0))};o(this.loggerService.getRegisteredLoggers()),this._register(this.loggerService.onDidChangeLoggers(n=>o(n.added)))}}};eZ=I([m(0,Te),m(1,Pe),m(2,ao),m(3,ee),m(4,_e),m(5,Gp),m(6,Vt),m(7,mn),m(8,ds),m(9,nt),m(10,ol),m(11,Ml),m(12,Ho)],eZ);var lJe=class extends C{constructor(e,t,o){super();this.configurationService=e;this.userDataProfilesService=t;this.telemetryService=o;this.configurationRegistry=oe.as(ii.Configuration);let{user:n,workspace:r}=e.keys();for(let s of n)this.reportTelemetry(s,3);for(let s of r)this.reportTelemetry(s,5)}getValueToReport(e,t){let o=this.configurationService.inspect(e),n=t===3?o.user?.value:o.workspace?.value;if(Xo(n)||Da(n))return n.toString();let r=this.configurationRegistry.getConfigurationProperties()[e];if(Ae(n))return r?.enum?.includes(n)?n:void 0;if(Array.isArray(n)&&n.every(s=>Xo(s)||Da(s)||Ae(s)&&r?.enum?.includes(s)))return JSON.stringify(n)}reportTelemetry(e,t){let o=ise(t);switch(e){case"workbench.activityBar.location":this.telemetryService.publicLog2("workbench.activityBar.location",{settingValue:this.getValueToReport(e,t),source:o});return;case VE:this.telemetryService.publicLog2("extensions.autoUpdate",{settingValue:this.getValueToReport(e,t),source:o});return;case"editor.stickyScroll.enabled":this.telemetryService.publicLog2("editor.stickyScroll.enabled",{settingValue:this.getValueToReport(e,t),source:o});return;case"typescript.experimental.expandableHover":this.telemetryService.publicLog2("typescript.experimental.expandableHover",{settingValue:this.getValueToReport(e,t),source:o});return;case"window.titleBarStyle":this.telemetryService.publicLog2("window.titleBarStyle",{settingValue:this.getValueToReport(e,t),source:o});return;case"workbench.secondarySideBar.defaultVisibility":this.telemetryService.publicLog2("workbench.secondarySideBar.defaultVisibility",{settingValue:this.getValueToReport(e,t),source:o});return;case nxe:this.telemetryService.publicLog2("extensions.verifySignature",{settingValue:this.getValueToReport(e,t),source:o});return;case"window.newWindowProfile":{let n=this.getValueToReport(e,t),r=n===null?"null":n===this.userDataProfilesService.defaultProfile.name?"default":"custom";this.telemetryService.publicLog2("window.newWindowProfile",{settingValue:r,source:o});return}case IV:this.telemetryService.publicLog2("extensions.autoRestart",{settingValue:this.getValueToReport(e,t),source:o});return;case ty.OutputLocation:this.telemetryService.publicLog2("terminal.integrated.chatAgentTools.outputLocation",{settingValue:this.getValueToReport(e,t),source:o});return;case ty.SuggestEnabled:this.telemetryService.publicLog2("terminal.integrated.suggest.enabled",{settingValue:this.getValueToReport(e,t),source:o});return}}};lJe=I([m(0,B),m(1,an),m(2,Te)],lJe);var dso=oe.as(Qi.Workbench);dso.registerWorkbenchContribution(eZ,3);dso.registerWorkbenchContribution(lJe,4);var S0t=ae("preferencesSearchService");var uso=new Q("inPreferencesSearch",!1),I0t="settings.action.clearSearchResults",pso="settings.action.showAIResults",y0t="settings.action.toggleAiSearch",w0t="settings.action.showContextMenu",mso="settings.action.suggestFilters",lD=new Q("inSettingsEditor",!1),IIi=new Q("inSettingsJSONEditor",!1),rpe=new Q("inSettingsSearch",!1),C0t=new Q("settingsTocRowFocus",!1),cJe=new Q("settingRowFocus",!1),nf=new Q("inKeybindings",!1),vLe=new Q("inKeybindingsSearch",!1),x0t=new Q("keybindingsSearchHasValue",!1),MF=new Q("keybindingFocus",!1),spe=new Q("whenFocus",!1),k0t=new Q("aiSettingResultsAvailable",!1),hso="keybindings.editor.searchKeybindings",E0t="keybindings.editor.clearSearchResults",gso="keybindings.editor.clearSearchHistory",T0t="keybindings.editor.recordSearchKeys",_0t="keybindings.editor.toggleSortByPrecedence",bLe="keybindings.editor.defineKeybinding",D0t="keybindings.editor.addKeybinding",L0t="keybindings.editor.defineWhenExpression",fso="keybindings.editor.acceptWhenExpression",vso="keybindings.editor.rejectWhenExpression",R0t="keybindings.editor.removeKeybinding",M0t="keybindings.editor.resetKeybinding",P0t="keybindings.editor.copyKeybindingEntry",A0t="keybindings.editor.copyCommandKeybindingEntry",N0t="keybindings.editor.copyCommandTitle",O0t="keybindings.editor.showConflicts",bso="keybindings.editor.focusKeybindings",Sso="keybindings.editor.showDefaultKeybindings",Iso="keybindings.editor.showUserKeybindings",yso="keybindings.editor.showExtensionKeybindings",NK="modified",SLe="ext:",hk="feature:",dJe="id:",PF="lang:",wso="tag:",uB="hasPolicy",S4="workspaceTrust",ILe="requireTrustedWorkspace",I4="advanced";var F0t=!0,yIi=!0,wIi=1e3,W0t="local",V0t="tfIdf",Cso="filterModel",B0t="embeddingsFull",H0t="llmRanked";var b0t;async function xso(a,i,e){if(yIi&&i.isEnabled()&&!(a.sentiment.hidden||a.sentiment.disabled)){if(b0t)return b0t;if(e.extensionRecommendations){let t={};Object.keys(e.extensionRecommendations).forEach(n=>{let r=e.extensionRecommendations[n];r.onSettingsEditorOpen&&(t[n]=r)});let o={};for(let n in t){let r=n,s=e.quality==="stable";try{let l=await Wp(i.getExtensions([{id:r,preRelease:!s}],ve.None),wIi);if(l?.length===1)o[n]=l[0];else return}catch{return}}return b0t={settingsEditorRecommendedExtensions:t,recommendedExtensionsGalleryInfo:o},b0t}}}function ape(a,i){let e=a??Number.MAX_SAFE_INTEGER,t=i??Number.MAX_SAFE_INTEGER;return e<t?-1:e>t?1:0}var U0t=d(12590,null),z0t=d(12589,null),kso=d(12588,null),Eso=new Set;["css","html","scss","less","json","js","ts","ie","id","php","scm"].forEach(a=>Eso.add(a));var OK=new Map;OK.set("power shell","PowerShell");OK.set("powershell","PowerShell");OK.set("javascript","JavaScript");OK.set("typescript","TypeScript");OK.set("github","GitHub");OK.set("jet brains","JetBrains");OK.set("jetbrains","JetBrains");OK.set("re sharper","ReSharper");OK.set("resharper","ReSharper");function CIi(a){a=a.replace(/\.([a-z0-9])/g,(i,e)=>` \u203A ${e.toUpperCase()}`).replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]{1,})([A-Z][a-z])/g,"$1 $2").replace(/^[a-z]/g,i=>i.toUpperCase()).replace(/\b\w+\b/g,i=>Eso.has(i.toLowerCase())?i.toUpperCase():i);for(let[i,e]of OK)a=a.replace(new RegExp(`\\b${i}\\b`,"gi"),e);return a}var yLe=oe.as(ea.JSONContribution),AF=class extends C{constructor(e,t){super();this.preferencesService=e;this.logService=t;this._onDidChangeFile=this._register(new E);this.onDidChangeFile=this._onDidChangeFile.event;this.capabilities=2050;this.onDidChangeCapabilities=H.None;this._register(yLe.onDidChangeSchema(o=>{this._onDidChangeFile.fire([{resource:A.parse(o),type:0}])})),this._register(yLe.onDidChangeSchemaAssociations(()=>{this._onDidChangeFile.fire([{resource:AF.SCHEMA_ASSOCIATIONS,type:0}])})),this._register(e.onDidDefaultSettingsContentChanged(o=>{this._onDidChangeFile.fire([{resource:o,type:0}])}))}static{this.SCHEMA=Y.vscode}static{this.SCHEMA_ASSOCIATIONS=A.parse(`${Y.vscode}://schemas-associations/schemas-associations.json`)}async readFile(e){if(e.scheme!==AF.SCHEMA)throw new jG;let t;if(e.authority==="schemas"?t=this.getSchemaContent(e):e.authority===AF.SCHEMA_ASSOCIATIONS.authority?t=JSON.stringify(yLe.getSchemaAssociations()):e.authority==="defaultsettings"&&(t=this.preferencesService.getDefaultSettingsContent(e)),t)return Je.fromString(t).buffer;throw"EntryNotFound"}async stat(e){if(yLe.hasSchemaContent(e.toString())||this.preferencesService.hasDefaultSettingsContent(e)){let t=Date.now();return{type:1,permissions:1,mtime:t,ctime:t,size:0}}if(Xe(e,AF.SCHEMA_ASSOCIATIONS)){let t=Date.now();return{type:1,permissions:1,mtime:t,ctime:t,size:0}}throw"EntryNotFound"}watch(e,t){return C.None}async mkdir(e){}async readdir(e){return[]}async rename(e,t,o){}async delete(e,t){}async writeFile(){throw new jG}getSchemaContent(e){let t=Date.now(),o=yLe.getSchemaContent(e.toString())??"{}",n=this.logService.getLevel();if(n===2||n===1){let r=Date.now(),s=JSON.stringify(yLe.getSchemaContributions().schemas[e.toString()]);this.logService.debug(`${e.toString()}: ${s.length} -> ${o.length} (${Math.round((s.length-o.length)/s.length*100)}%) Took ${r-t}ms`)}return o}};AF=I([m(0,Po),m(1,ne)],AF);var lpe=class extends C{constructor(e,t,o,n,r,s,l,c){super();this.instantiationService=t;this.preferencesService=o;this.userDataProfileService=n;this.workspaceService=r;this.configurationService=s;this.editorResolverService=l;this.textEditorService=c;this._register(this.configurationService.onDidChangeConfiguration(p=>{(p.affectsConfiguration(o9e)||p.affectsConfiguration(i9e))&&this.handleSettingsEditorRegistration()})),this.handleSettingsEditorRegistration();let u=this._register(this.instantiationService.createInstance(AF));this._register(e.registerProvider(AF.SCHEMA,u))}static{this.ID="workbench.contrib.preferences"}handleSettingsEditorRegistration(){Ue(this.editorOpeningListener),(this.configurationService.getValue(o9e)||this.configurationService.getValue(i9e))&&(this.editorOpeningListener=this.editorResolverService.registerEditor("**/settings.json",{id:ga.ID,label:d(12595,null),priority:"builtin"},{},{createEditorInput:({resource:e,options:t})=>{if(Xe(e,this.userDataProfileService.currentProfile.settingsResource))return{editor:this.preferencesService.createSplitJsonEditorInput(3,e),options:t};let o=this.workspaceService.getWorkbenchState();if(o===2){let n=this.workspaceService.getWorkspace().folders;if(Xe(e,n[0].toResource(PEe)))return{editor:this.preferencesService.createSplitJsonEditorInput(5,e),options:t}}else if(o===3){let n=this.workspaceService.getWorkspace().folders;for(let r of n)if(Xe(e,r.toResource(PEe)))return{editor:this.preferencesService.createSplitJsonEditorInput(6,e),options:t}}return{editor:this.textEditorService.createTextEditor({resource:e}),options:t}}}))}dispose(){Ue(this.editorOpeningListener),super.dispose()}};lpe=I([m(0,be),m(1,F),m(2,Po),m(3,mn),m(4,Pe),m(5,B),m(6,ul),m(7,lk)],lpe);var F4o=oe.as(ii.Configuration);F4o.registerConfiguration({...Cm,properties:{"workbench.settings.enableNaturalLanguageSearch":{type:"boolean",description:d(12591,null),default:!0,scope:4,tags:["usesOnlineServices"]},"workbench.settings.settingsSearchTocBehavior":{type:"string",enum:["hide","filter"],enumDescriptions:[d(12594,null),d(12593,null)],description:d(12592,null),default:"filter",scope:4}}});var Tso=Re("settings-folder-dropdown",M.chevronDown,d(12377,null)),_so=Re("settings-more-action",M.gear,d(12375,null)),Dso=Re("keybindings-record-keys",M.recordKeys,d(12367,null)),Lso=Re("keybindings-sort",M.sortPrecedence,d(12368,null)),Rso=Re("keybindings-edit",M.edit,d(12366,null)),Mso=Re("keybindings-add",M.add,d(12365,null)),cpe=Re("settings-edit",M.edit,d(12373,null)),xIi=Re("settings-remove",M.close,d(12376,null)),Pso=Re("settings-discard",M.discard,d(12371,null)),wLe=Re("preferences-clear-input",M.clearAll,d(12370,null)),Aso=Re("preferences-ai-results",M.sparkle,d(12369,null)),Nso=Re("preferences-filter",M.filter,d(12374,null)),dpe=Re("preferences-open-settings",M.goToFile,d(12372,null));var uJe=class extends oc{constructor(e,t,o,n){super(null,e);this.contextService=t;this.contextMenuService=o;this.hoverService=n;this._folderSettingCounts=new Map;let r=this.contextService.getWorkspace();this._folder=r.folders.length===1?r.folders[0]:null,this._register(this.contextService.onDidChangeWorkspaceFolders(()=>this.onWorkspaceFoldersChanged()))}get folder(){return this._folder}set folder(e){this._folder=e,this.update()}setCount(e,t){let o=this.contextService.getWorkspaceFolder(e);if(!o)throw new Error("unknown folder");let n=o.uri;this._folderSettingCounts.set(n.toString(),t),this.update()}render(e){this.element=e,this.container=e,this.labelElement=_(".action-title"),this.detailsElement=_(".action-details"),this.dropDownElement=_(".dropdown-icon.hide"+q.asCSSSelector(Tso)),this.anchorElement=_("a.action-label.folder-settings",{role:"button","aria-haspopup":"true",tabindex:"0"},this.labelElement,this.detailsElement,this.dropDownElement),this.anchorElementHover=this._register(this.hoverService.setupManagedHover(Ni("mouse"),this.anchorElement,"")),this._register(j(this.anchorElement,re.MOUSE_DOWN,t=>$t.stop(t))),this._register(j(this.anchorElement,re.CLICK,t=>this.onClick(t))),this._register(j(this.container,re.KEY_UP,t=>this.onKeyUp(t))),R(this.container,this.anchorElement),this.update()}onKeyUp(e){switch(new Ii(e).keyCode){case 3:case 10:this.onClick(e);return}}onClick(e){$t.stop(e,!0),!this.folder||this._action.checked?this.showMenu():this._action.run(this._folder)}updateEnabled(){this.update()}updateChecked(){this.update()}onWorkspaceFoldersChanged(){let e=this._folder,t=this.contextService.getWorkspace();e&&(this._folder=t.folders.filter(o=>Xe(o.uri,e.uri))[0]||t.folders[0]),this._folder=this._folder?this._folder:t.folders.length===1?t.folders[0]:null,this.update(),this._action.checked&&this._action.run(this._folder)}update(){let e=0;this._folderSettingCounts.forEach(o=>e+=o);let t=this.contextService.getWorkspace();if(this._folder){this.labelElement.textContent=this._folder.name,this.anchorElementHover.update(this._folder.name);let o=this.labelWithCount(this._action.label,e);this.detailsElement.textContent=o,this.dropDownElement.classList.toggle("hide",t.folders.length===1||!this._action.checked)}else{let o=this.labelWithCount(this._action.label,e);this.labelElement.textContent=o,this.detailsElement.textContent="",this.anchorElementHover.update(this._action.label),this.dropDownElement.classList.remove("hide")}this.anchorElement.classList.toggle("checked",this._action.checked),this.container.classList.toggle("disabled",!this._action.enabled)}showMenu(){this.contextMenuService.showContextMenu({getAnchor:()=>this.container,getActions:()=>this.getDropdownMenuActions(),getActionViewItem:()=>{},onHide:()=>{this.anchorElement.blur()}})}getDropdownMenuActions(){let e=[],t=this.contextService.getWorkspace().folders;return this.contextService.getWorkbenchState()===3&&t.length>0&&e.push(...t.map((o,n)=>{let r=this._folderSettingCounts.get(o.uri.toString());return{id:"folderSettingsTarget"+n,label:this.labelWithCount(o.name,r),tooltip:this.labelWithCount(o.name,r),checked:!!this.folder&&Xe(this.folder.uri,o.uri),enabled:!0,class:void 0,run:()=>this._action.run(o)}})),e}labelWithCount(e,t){return t&&(e+=` (${t})`),e}};uJe=I([m(1,Pe),m(2,ze),m(3,tt)],uJe);var CLe=class extends Ma{constructor(e,t,o,n,r,s,l){super();this.contextService=o;this.instantiationService=n;this.environmentService=r;this.labelService=s;this.languageService=l;this._settingsTarget=null;this._onDidTargetChange=this._register(new E);this.onDidTargetChange=this._onDidTargetChange.event;this.options=t??{},this.create(e),this._register(this.contextService.onDidChangeWorkbenchState(()=>this.onWorkbenchStateChanged())),this._register(this.contextService.onDidChangeWorkspaceFolders(()=>this.update()))}resetLabels(){let e=this.environmentService.remoteAuthority,t=e&&this.labelService.getHostLabel(Y.vscodeRemote,e);this.userLocalSettings.label=d(12399,null),this.userRemoteSettings.label=d(12400,null)+(t?` [${t}]`:""),this.workspaceSettings.label=d(12401,null),this.folderSettingsAction.label=d(12397,null)}create(e){let t=R(e,_(".settings-tabs-widget"));this.settingsSwitcherBar=this._register(new ji(t,{orientation:0,focusOnlyEnabledItems:!0,ariaLabel:d(12398,null),ariaRole:"tablist",actionViewItemProvider:(r,s)=>r.id==="folderSettings"?this.folderSettings:void 0})),this.userLocalSettings=this._register(new st("userSettings","",".settings-tab",!0,()=>this.updateTarget(3))),this.userLocalSettings.tooltip=d(12399,null),this.userRemoteSettings=this._register(new st("userSettingsRemote","",".settings-tab",!0,()=>this.updateTarget(4)));let o=this.environmentService.remoteAuthority,n=o&&this.labelService.getHostLabel(Y.vscodeRemote,o);this.userRemoteSettings.tooltip=d(12400,null)+(n?` [${n}]`:""),this.workspaceSettings=this._register(new st("workspaceSettings","",".settings-tab",!1,()=>this.updateTarget(5))),this.folderSettingsAction=this._register(new st("folderSettings","",".settings-tab",!1,async r=>{this.updateTarget(oC(r)?r.uri:3)})),this.folderSettings=this._register(this.instantiationService.createInstance(uJe,this.folderSettingsAction)),this.resetLabels(),this.update(),this.settingsSwitcherBar.push([this.userLocalSettings,this.userRemoteSettings,this.workspaceSettings,this.folderSettingsAction])}get settingsTarget(){return this._settingsTarget}set settingsTarget(e){this._settingsTarget=e,this.userLocalSettings.checked=3===this.settingsTarget,this.userRemoteSettings.checked=4===this.settingsTarget,this.workspaceSettings.checked=5===this.settingsTarget,this.settingsTarget instanceof A?(this.folderSettings.action.checked=!0,this.folderSettings.folder=this.contextService.getWorkspaceFolder(this.settingsTarget)):this.folderSettings.action.checked=!1}setResultCount(e,t){if(e===5){let o=d(12401,null);t&&(o+=` (${t})`),this.workspaceSettings.label=o}else if(e===3){let o=d(12399,null);t&&(o+=` (${t})`),this.userLocalSettings.label=o}else e instanceof A&&this.folderSettings.setCount(e,t)}updateLanguageFilterIndicators(e){if(this.resetLabels(),e){let t=this.languageService.getLanguageName(e);if(t){let o=` [${t}]`;this.userLocalSettings.label+=o,this.userRemoteSettings.label+=o,this.workspaceSettings.label+=o,this.folderSettingsAction.label+=o}}}onWorkbenchStateChanged(){this.folderSettings.folder=null,this.update(),this.settingsTarget===5&&this.contextService.getWorkbenchState()===3&&this.updateTarget(3)}updateTarget(e){return this.settingsTarget===e||e instanceof A&&this.settingsTarget instanceof A&&Xe(this.settingsTarget,e)||(this.settingsTarget=e,this._onDidTargetChange.fire(this.settingsTarget)),Promise.resolve(void 0)}async update(){this.settingsSwitcherBar.domNode.classList.toggle("empty-workbench",this.contextService.getWorkbenchState()===1),this.userRemoteSettings.enabled=!!(this.options.enableRemoteSettings&&this.environmentService.remoteAuthority),this.workspaceSettings.enabled=this.contextService.getWorkbenchState()!==1&&!this.environmentService.isSessionsWindow,this.folderSettings.action.enabled=this.contextService.getWorkbenchState()===3&&this.contextService.getWorkspace().folders.length>0,this.workspaceSettings.tooltip=d(12401,null)}};CLe=I([m(2,Pe),m(3,F),m(4,Vt),m(5,ot),m(6,kt)],CLe);var tZ=class extends Ma{constructor(e,t,o,n,r,s){super();this.options=t;this.contextViewService=o;this.instantiationService=n;this.contextKeyService=r;this.keybindingService=s;this._onDidChange=this._register(new E);this._onFocus=this._register(new E);this.create(e)}get onDidChange(){return this._onDidChange.event}get onFocus(){return this._onFocus.event}create(e){this.domNode=R(e,_("div.settings-header-widget")),this.createSearchContainer(R(this.domNode,_("div.settings-search-container"))),this.controlsDiv=R(this.domNode,_("div.settings-search-controls")),this.options.showResultCount&&(this.countElement=R(this.controlsDiv,_(".settings-count-widget")),this.countElement.style.backgroundColor=wt(rv),this.countElement.style.color=wt(Yw),this.countElement.style.border=`1px solid ${wt(gi)}`),this.inputBox.inputElement.setAttribute("aria-live",this.options.ariaLive||"off"),this.options.ariaLabelledBy&&this.inputBox.inputElement.setAttribute("aria-labelledBy",this.options.ariaLabelledBy);let t=this._register(Vn(this.inputBox.inputElement));this._register(t.onDidFocus(()=>this._onFocus.fire()));let o=this.options.focusKey;o&&(this._register(t.onDidFocus(()=>o.set(!0))),this._register(t.onDidBlur(()=>o.set(!1))))}createSearchContainer(e){this.searchContainer=e;let t=R(this.searchContainer,_("div.settings-search-input"));this.inputBox=this._register(this.createInputBox(t)),this._register(this.inputBox.onDidChange(o=>this._onDidChange.fire(o)))}createInputBox(e){let t=()=>ML(this.keybindingService);return new D1(e,this.contextViewService,{...this.options,showHistoryHint:t},this.contextKeyService)}showMessage(e){this.countElement&&e!==this.countElement.textContent&&(this.countElement.textContent=e,this.inputBox.inputElement.setAttribute("aria-label",e),this.inputBox.inputElement.style.paddingRight=this.getControlsWidth()+"px")}layout(e){e.width<400?(this.countElement?.classList.add("hide"),this.inputBox.inputElement.style.paddingRight="0px"):(this.countElement?.classList.remove("hide"),this.inputBox.inputElement.style.paddingRight=this.getControlsWidth()+"px")}getControlsWidth(){return(this.countElement?yl(this.countElement):0)+20}focus(){this.inputBox.focus(),this.getValue()&&this.inputBox.select()}hasFocus(){return this.inputBox.hasFocus()}clear(){this.inputBox.value=""}getValue(){return this.inputBox.value}setValue(e){return this.inputBox.value=e}dispose(){this.options.focusKey?.set(!1),super.dispose()}};tZ=I([m(2,_n),m(3,F),m(4,X),m(5,_e)],tZ);var pJe=class extends C{constructor(e){super();this.editor=e;this._line=-1;this._preferences=[];this._onClick=this._register(new E);this.onClick=this._onClick.event;this._editPreferenceDecoration=this.editor.createDecorationsCollection(),this._register(this.editor.onMouseDown(t=>{t.target.type!==2||t.target.detail.isAfterLines||!this.isVisible()||this._onClick.fire(t)}))}get preferences(){return this._preferences}getLine(){return this._line}show(e,t,o){this._preferences=o;let n=[];this._line=e,n.push({options:{description:"edit-preference-widget-decoration",glyphMarginClassName:q.asClassName(cpe),glyphMarginHoverMessage:new xe().appendText(t),stickiness:1},range:{startLineNumber:e,startColumn:1,endLineNumber:e,endColumn:1}}),this._editPreferenceDecoration.set(n)}hide(){this._editPreferenceDecoration.clear()}isVisible(){return this._editPreferenceDecoration.length>0}dispose(){this.hide(),super.dispose()}};var upe=class extends tZ{constructor(e,t,o,n,r,s){super(e,t,o,n,r,s);this.recordDisposables=this._register(new P);this._onKeybinding=this._register(new E);this.onKeybinding=this._onKeybinding.event;this._onEnter=this._register(new E);this.onEnter=this._onEnter.event;this._onEscape=this._register(new E);this.onEscape=this._onEscape.event;this._onBlur=this._register(new E);this.onBlur=this._onBlur.event;this._register(Z(()=>this.stopRecordingKeys())),this._chords=null,this._inputValue=""}clear(){this._chords=null,super.clear()}startRecordingKeys(){this.recordDisposables.add(j(this.inputBox.inputElement,re.KEY_DOWN,e=>this._onKeyDown(new Ii(e)))),this.recordDisposables.add(j(this.inputBox.inputElement,re.BLUR,()=>this._onBlur.fire())),this.recordDisposables.add(j(this.inputBox.inputElement,re.INPUT,()=>{this.setInputValue(this._inputValue)}))}stopRecordingKeys(){this._chords=null,this.recordDisposables.clear()}setInputValue(e){this._inputValue=e,this.inputBox.value=this._inputValue}_onKeyDown(e){if(e.preventDefault(),e.stopPropagation(),!this.options.recordEnter&&e.equals(3)){this._onEnter.fire();return}if(e.equals(9)){this._onEscape.fire();return}this.printKeybinding(e)}printKeybinding(e){let t=this.keybindingService.resolveKeyboardEvent(e),o=`code: ${e.browserEvent.code}, keyCode: ${e.browserEvent.keyCode}, key: ${e.browserEvent.key} => UI: ${t.getAriaLabel()}, user settings: ${t.getUserSettingsLabel()}, dispatch: ${t.getDispatchChords()[0]}`,n=this.options;this._chords||(this._chords=[]),this._chords.length>0&&this._chords[this._chords.length-1].getDispatchChords()[0]===null?this._chords[this._chords.length-1]=t:(this._chords.length===2&&(this._chords=[]),this._chords.push(t));let s=this._chords.map(l=>l.getUserSettingsLabel()||"").join(" ");this.setInputValue(n.quoteRecordedKeys?`"${s}"`:s),this.inputBox.inputElement.title=o,this._onKeybinding.fire(this._chords)}};upe=I([m(2,_n),m(3,F),m(4,X),m(5,_e)],upe);var NF=class extends Ma{constructor(e,t){super();this.instantiationService=t;this._keybindingDisposables=this._register(new P);this._chords=null;this._isVisible=!1;this._onHide=this._register(new E);this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._onShowExistingKeybindings=this._register(new E);this.onShowExistingKeybidings=this._onShowExistingKeybindings.event;this._domNode=or(document.createElement("div")),this._domNode.setDisplay("none"),this._domNode.setClassName("defineKeybindingWidget"),this._domNode.setWidth(NF.WIDTH),this._domNode.setHeight(NF.HEIGHT);let o=d(12314,null);R(this._domNode.domNode,_(".message",void 0,o)),this._domNode.domNode.style.backgroundColor=wt(gm),this._domNode.domNode.style.color=wt(dL),this._keybindingInputWidget=this._register(this.instantiationService.createInstance(upe,this._domNode.domNode,{ariaLabel:o,history:new Set([]),inputBoxStyles:pl})),this._keybindingInputWidget.startRecordingKeys(),this._register(this._keybindingInputWidget.onKeybinding(n=>this.onKeybinding(n))),this._register(this._keybindingInputWidget.onEnter(()=>this.hide())),this._register(this._keybindingInputWidget.onEscape(()=>this.clearOrHide())),this._register(this._keybindingInputWidget.onBlur(()=>this.onCancel())),this._outputNode=R(this._domNode.domNode,_(".output")),this._showExistingKeybindingsNode=R(this._domNode.domNode,_(".existing")),e&&R(e,this._domNode.domNode)}static{this.WIDTH=400}static{this.HEIGHT=110}get domNode(){return this._domNode.domNode}define(){return this._keybindingInputWidget.clear(),fn.withAsyncBody(async e=>{this._isVisible||(this._isVisible=!0,this._domNode.setDisplay("block"),this._chords=null,this._keybindingInputWidget.setInputValue(""),Rt(this._outputNode),Rt(this._showExistingKeybindingsNode),await Pi(0),this._keybindingInputWidget.focus());let t=this._onHide.event(()=>{e(this.getUserSettingsLabel()),t.dispose()})})}layout(e){let t=Math.round((e.height-NF.HEIGHT)/2);this._domNode.setTop(t);let o=Math.round((e.width-NF.WIDTH)/2);this._domNode.setLeft(o)}printExisting(e){if(e>0){let t=_("span.existingText"),o=e===1?d(12315,null,e):d(12313,null,e);R(t,document.createTextNode(o)),Jo(o),this._showExistingKeybindingsNode.appendChild(t),t.onmousedown=n=>{n.preventDefault()},t.onmouseup=n=>{n.preventDefault()},t.onclick=()=>{this._onShowExistingKeybindings.fire(this.getUserSettingsLabel())}}}onKeybinding(e){if(this._keybindingDisposables.clear(),this._chords=e,Rt(this._outputNode),Rt(this._showExistingKeybindingsNode),this._keybindingDisposables.add(new ah(this._outputNode,zo,l_)).set(this._chords?.[0]??void 0),this._chords)for(let n=1;n<this._chords.length;n++)this._outputNode.appendChild(document.createTextNode(d(12312,null))),this._keybindingDisposables.add(new ah(this._outputNode,zo,l_)).set(this._chords[n]);let o=this.getUserSettingsLabel();o&&this._onDidChange.fire(o)}getUserSettingsLabel(){let e=null;return this._chords&&(e=this._chords.map(t=>t.getUserSettingsLabel()).join(" ")),e}onCancel(){this._chords=null,this.hide()}clearOrHide(){this._chords===null?this.hide():(this._chords=null,this._keybindingInputWidget.clear(),Rt(this._outputNode),Rt(this._showExistingKeybindingsNode))}hide(){this._domNode.setDisplay("none"),this._isVisible=!1,this._onHide.fire()}};NF=I([m(1,F)],NF);var iZ=class extends C{constructor(e,t){super();this._editor=e;this._widget=this._register(t.createInstance(NF,null)),this._editor.addOverlayWidget(this)}static{this.ID="editor.contrib.defineKeybindingWidget"}getId(){return iZ.ID}getDomNode(){return this._widget.domNode}getPosition(){return{preference:null}}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}start(){this._editor.hasModel()&&this._editor.revealPositionInCenterIfOutsideViewport(this._editor.getPosition(),0);let e=this._editor.getLayoutInfo();return this._widget.layout(new ai(e.width,e.height)),this._widget.define()}};iZ=I([m(1,F)],iZ);function Kf(a){return{wordWrap:"on",overviewRulerLanes:0,glyphMargin:!1,lineNumbers:"off",folding:!1,selectOnLineNumbers:!1,hideCursorInOverviewRuler:!0,selectionHighlight:!1,scrollbar:{horizontal:"hidden",alwaysConsumeMouseWheel:!1},lineDecorationsWidth:0,overviewRulerBorder:!1,scrollBeyondLastLine:!1,renderLineHighlight:"none",fixedOverflowWidgets:!0,acceptSuggestionOnEnter:"smart",dragAndDrop:!1,revealHorizontalRightPadding:5,minimap:{enabled:!1},guides:{indentation:!1},wordSegmenterLocales:a.getValue("editor.wordSegmenterLocales"),accessibilitySupport:a.getValue("editor.accessibilitySupport"),cursorBlinking:a.getValue("editor.cursorBlinking"),editContext:a.getValue("editor.editContext"),defaultColorDecorators:"never",allowVariableLineHeights:!1,allowVariableFonts:!1,allowVariableFontsInAccessibilityMode:!1}}function xLe(){return{isSimpleWidget:!0,contributions:aa.getSomeEditorContributions([ry.ID,ly,Hm.ID,El.ID,Qr.ID,ay.ID])}}function kLe(a){return is((i,e)=>{let t=i.getColor(tgt);if(t){let o=i.getColor(Gb);o&&(e.addRule(`${a} .monaco-editor-background { background-color: ${o}; } `),e.addRule(`${a} .monaco-editor .selected-text { background-color: ${o.transparent(.4)}; }`));let n=i.getColor(pL);n&&e.addRule(`${a} .monaco-editor .view-line span.inline-selected-text { color: ${n}; }`),e.addRule(`${a} .monaco-editor .focused .selected-text { background-color: ${t}; }`)}else e.addRule(`${a} .monaco-editor .focused .selected-text { background-color: ${i.getColor(sv)}; }`)})}var tA=class extends Ma{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this._onShouldFocusResults=this._register(new E);this.onShouldFocusResults=this._onShouldFocusResults.event;this._onInputDidChange=this._register(new E);this.onInputDidChange=this._onInputDidChange.event;this._onDidFocus=this._register(new E);this.onDidFocus=this._onDidFocus.event;this._onDidBlur=this._register(new E);this.onDidBlur=this._onDidBlur.event;this.stylingContainer=R(t,_(".suggest-input-container")),this.element=t,this.placeholderText=R(this.stylingContainer,_(".suggest-input-placeholder",void 0,s.placeholderText||""));let g=Nu(Kf(h),W4o(n));g.overflowWidgetsDomNode=s.overflowWidgetsDomNode;let f=this.getScopedContextKeyService(u),v=f?this._register(l.createChild(new Io([X,f]))):l;this.inputWidget=this._register(v.createInstance(jr,this.stylingContainer,g,{contributions:aa.getSomeEditorContributions([El.ID,Qr.ID,Hm.ID,ry.ID,ly]),isSimpleWidget:!0})),this._register(h.onDidChangeConfiguration(k=>{if(k.affectsConfiguration("editor.accessibilitySupport")||k.affectsConfiguration("editor.cursorBlinking")){let T=h.getValue("editor.accessibilitySupport"),N=h.getValue("editor.cursorBlinking");this.inputWidget.updateOptions({accessibilitySupport:T,cursorBlinking:N})}})),this._register(this.inputWidget.onDidFocusEditorText(()=>this._onDidFocus.fire())),this._register(this.inputWidget.onDidBlurEditorText(()=>this._onDidBlur.fire()));let b=A.parse(r);this.inputModel=c.createModel("",null,b,!0),this._register(this.inputModel),this.inputWidget.setModel(this.inputModel),this._register(this.inputWidget.onDidPaste(()=>this.setValue(this.getValue()))),this._register(this.inputWidget.onDidFocusEditorText(()=>{s.focusContextKey&&s.focusContextKey.set(!0),this.stylingContainer.classList.add("synthetic-focus")})),this._register(this.inputWidget.onDidBlurEditorText(()=>{s.focusContextKey&&s.focusContextKey.set(!1),this.stylingContainer.classList.remove("synthetic-focus")})),this._register(H.chain(this.inputWidget.onKeyDown,k=>k.filter(T=>T.keyCode===3))(k=>{k.preventDefault()},this)),this._register(H.chain(this.inputWidget.onKeyDown,k=>k.filter(T=>T.keyCode===18&&(it?T.metaKey:T.ctrlKey)))(()=>this._onShouldFocusResults.fire(),this));let S=this.getValue(),y=this.inputWidget.getModel();y&&this._register(y.onDidChangeContent(()=>{let k=this.getValue();this.placeholderText.style.visibility=k?"hidden":"visible",S.trim()!==k.trim()&&(this._onInputDidChange.fire(void 0),S=k)}));let w={provideResults:o.provideResults,sortKey:o.sortKey||(k=>k),triggerCharacters:o.triggerCharacters||[],wordDefinition:o.wordDefinition?E$(o.wordDefinition):void 0,alwaysShowSuggestions:!!o.alwaysShowSuggestions};this.setValue(s.value||""),this._register(p.completionProvider.register({scheme:b.scheme,pattern:"**/"+b.path,hasAccessToAllModels:!0},{_debugDisplayName:`suggestEnabledInput/${e}`,triggerCharacters:w.triggerCharacters,provideCompletionItems:(k,T,N)=>{let O=k.getValue(),V=T.column-1,U=0,G=0;if(w.wordDefinition){let $=My(T.column,w.wordDefinition,O,0);U=$?.word.length??0,G=$?$.startColumn-1:0}else G=O.lastIndexOf(" ",V-1)+1,U=V-G;return!w.alwaysShowSuggestions&&U>0&&w.triggerCharacters?.indexOf(O[G])===-1?{suggestions:[]}:{suggestions:o.provideResults(O).map($=>{let te,pe;return typeof $=="string"?te=$:(te=$.label,pe=$),{label:te,insertText:te,range:z.fromPositions(T.delta(0,-U),T),sortText:w.sortKey(te),kind:17,...pe}})}}})),this.style(s.styleOverrides||{})}getScopedContextKeyService(e){}updateAriaLabel(e){this.inputWidget.updateOptions({ariaLabel:e})}setValue(e){e=e.replace(/\s/g," ");let t=this.inputModel.getFullModelRange();this.inputWidget.executeEdits("suggestEnabledInput.setValue",[An.replace(t,e)]),this.inputWidget.setScrollTop(0),this.inputWidget.setPosition(new Ie(1,e.length+1))}getValue(){return this.inputWidget.getValue()}style(e){this.stylingContainer.style.backgroundColor=wt(e.inputBackground??Gb),this.stylingContainer.style.color=wt(e.inputForeground??pL),this.placeholderText.style.color=wt(e.inputPlaceholderForeground??u9),this.stylingContainer.style.borderWidth="1px",this.stylingContainer.style.borderStyle="solid",this.stylingContainer.style.borderColor=Ese(e.inputBorder??Vy,"transparent");let t=this.stylingContainer.getElementsByClassName("cursor")[0];t&&(t.style.backgroundColor=wt(e.inputForeground??pL))}focus(e){this.inputWidget.focus(),e&&this.inputWidget.getValue()&&this.selectAll()}onHide(){this.inputWidget.onHide()}layout(e){this.inputWidget.layout(e),this.placeholderText.style.width=`${e.width-2}px`}selectAll(){this.inputWidget.setSelection(new z(1,1,1,this.getValue().length+1))}};tA=I([m(6,F),m(7,Ct),m(8,X),m(9,zt),m(10,B)],tA);var mJe=class extends tA{constructor({id:i,parent:e,ariaLabel:t,suggestionProvider:o,resourceHandle:n,suggestOptions:r,history:s},l,c,u,p,h){super(i,e,o,t,n,r,l,c,u,p,h),this.history=this._register(new I7(new Set(s),100))}addToHistory(){let i=this.getValue();i&&i!==this.getCurrentValue()&&this.history.add(i)}getHistory(){return this.history.getHistory()}showNextValue(){this.history.has(this.getValue())||this.addToHistory();let i=this.getNextValue();i&&(i=i===this.getValue()?this.getNextValue():i),this.setValue(i??"")}showPreviousValue(){this.history.has(this.getValue())||this.addToHistory();let i=this.getPreviousValue();i&&(i=i===this.getValue()?this.getPreviousValue():i),i&&(this.setValue(i),this.inputWidget.setPosition({lineNumber:0,column:0}))}clearHistory(){this.history.clear()}getCurrentValue(){let i=this.history.current();return i||(i=this.history.last(),this.history.next()),i}getPreviousValue(){return this.history.previous()||this.history.first()}getNextValue(){return this.history.next()}};mJe=I([m(1,F),m(2,Ct),m(3,X),m(4,zt),m(5,B)],mJe);var ELe=class extends mJe{constructor(i,e,t,o,n,r){super(i,e,t,o,n,r);let{historyNavigationBackwardsEnablement:s,historyNavigationForwardsEnablement:l}=this.historyContext;this._register(this.inputWidget.onDidChangeCursorPosition(({position:c})=>{let u=this.inputWidget._getViewModel(),p=u.getLineCount(),h=u.getLineLength(p)+1,g=u.coordinatesConverter.convertModelPositionToViewPosition(c);s.set(g.lineNumber===1&&g.column===1),l.set(g.lineNumber===p&&g.column===h)}))}getScopedContextKeyService(i){let e=this._register(i.createScoped(this.element));return this.historyContext=this._register(qM(e,this)),e}};ELe=I([m(1,F),m(2,Ct),m(3,X),m(4,zt),m(5,B)],ELe);kLe(".suggest-input-container");function W4o(a){return{fontSize:13,lineHeight:20,wordWrap:"off",scrollbar:{vertical:"hidden"},roundedSelection:!1,guides:{indentation:!1},cursorWidth:1,fontFamily:HN,ariaLabel:a||"",snippetSuggestions:"none",suggest:{filterGraceful:!1,showIcons:!1},autoClosingBrackets:"never"}}var hJe=J("settings.headerForeground",{light:"#444444",dark:"#e7e7e7",hcDark:"#ffffff",hcLight:"#292929"},d(12597,null)),kIi=J("settings.settingsHeaderHoverForeground",ei(hJe,.7),d(12612,null)),zId=J("settings.modifiedItemIndicator",{light:new Oe(new Bt(102,175,224)),dark:new Oe(new Bt(12,125,157)),hcDark:new Oe(new Bt(0,73,122)),hcLight:new Oe(new Bt(102,175,224))},d(12598,null)),Oso=J("settings.headerBorder",cb,d(12611,null)),gJe=J("settings.sashBorder",cb,d(12613,null)),K0t=J("settings.dropdownBackground",FU,d(12607,null)),G0t=J("settings.dropdownForeground",Ose,d(12609,null)),$0t=J("settings.dropdownBorder",PN,d(12608,null)),q0t=J("settings.dropdownListBorder",DN,d(12610,null)),KId=J("settings.checkboxBackground",nIe,d(12604,null)),GId=J("settings.checkboxForeground",rIe,d(12606,null)),$Id=J("settings.checkboxBorder",bgt,d(12605,null)),TLe=J("settings.textInputBackground",Gb,d(12614,null)),_Le=J("settings.textInputForeground",pL,d(12616,null)),ZE=J("settings.textInputBorder",Vy,d(12615,null)),Fso=J("settings.numberInputBackground",Gb,d(12599,null)),Wso=J("settings.numberInputForeground",pL,d(12601,null)),Vso=J("settings.numberInputBorder",Vy,d(12600,null)),qId=J("settings.focusedRowBackground",{dark:ei(Xk,.6),light:ei(Xk,.6),hcDark:null,hcLight:null},d(12596,null)),jId=J("settings.rowHoverBackground",{dark:ei(Xk,.3),light:ei(Xk,.3),hcDark:null,hcLight:null},d(12603,null)),QId=J("settings.focusedRowBorder",Ad,d(12602,null));var Mv=_,xh=class extends pa{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super(xh.ID,e,t,o,g);this.keybindingsService=n;this.contextMenuService=r;this.keybindingEditingService=s;this.contextKeyService=l;this.notificationService=c;this.clipboardService=u;this.instantiationService=p;this.editorService=h;this.configurationService=f;this.accessibilityService=v;this.preferencesService=b;this._onDefineWhenExpression=this._register(new E);this.onDefineWhenExpression=this._onDefineWhenExpression.event;this._onRejectWhenExpression=this._register(new E);this.onRejectWhenExpression=this._onRejectWhenExpression.event;this._onAcceptWhenExpression=this._register(new E);this.onAcceptWhenExpression=this._onAcceptWhenExpression.event;this._onLayout=this._register(new E);this.onLayout=this._onLayout.event;this.keybindingsEditorModel=null;this.unAssignedKeybindingItemToRevealAndFocus=null;this.tableEntries=[];this.dimension=null;this.latestEmptyFilters=[];this.delayedFiltering=this._register(new jo(300)),this._register(n.onDidUpdateKeybindings(()=>this.render(!!this.keybindingFocusContextKey.get()))),this.keybindingsEditorContextKey=nf.bindTo(this.contextKeyService),this.searchFocusContextKey=vLe.bindTo(this.contextKeyService),this.keybindingFocusContextKey=MF.bindTo(this.contextKeyService),this.searchHasValueContextKey=x0t.bindTo(this.contextKeyService),this.searchHistoryDelayer=this._register(new jo(500)),this.recordKeysAction=this._register(new st(T0t,d(12297,null),q.asClassName(Dso))),this.recordKeysAction.checked=!1,this.sortByPrecedenceAction=this._register(new st(_0t,d(12305,null),q.asClassName(Lso))),this.sortByPrecedenceAction.checked=!1,this.overflowWidgetsDomNode=Mv(".keybindings-overflow-widgets-container.monaco-editor")}static{this.ID="workbench.editor.keybindings"}create(e){super.create(e),this._register(zE({name:"keybindingsEditor",focusNotifiers:[this],focusNextWidget:()=>{this.searchWidget.hasFocus()&&this.focusKeybindings()},focusPreviousWidget:()=>{this.searchWidget.hasFocus()||this.focusSearch()}}))}createEditor(e){let t=R(e,Mv("div",{class:"keybindings-editor"}));this.createAriaLabelElement(t),this.createOverlayContainer(t),this.createHeader(t),this.createBody(t)}setInput(e,t,o,n){return this.keybindingsEditorContextKey.set(!0),super.setInput(e,t,o,n).then(()=>this.render(!!(t&&t.preserveFocus)))}clearInput(){super.clearInput(),this.keybindingsEditorContextKey.reset(),this.keybindingFocusContextKey.reset()}layout(e){this.dimension=e,this.layoutSearchWidget(e),this.overlayContainer.style.width=e.width+"px",this.overlayContainer.style.height=e.height+"px",this.defineKeybindingWidget.layout(this.dimension),this.layoutKeybindingsTable(),this._onLayout.fire()}focus(){super.focus();let e=this.activeKeybindingEntry;e?this.selectEntry(e):Nc||this.searchWidget.focus()}get activeKeybindingEntry(){let e=this.keybindingsTable.getFocusedElements()[0];return e&&e.templateId===e4?e:null}async defineKeybinding(e,t){this.selectEntry(e),this.showOverlayContainer();try{let o=await this.defineKeybindingWidget.define();o&&await this.updateKeybinding(e,o,e.keybindingItem.when,t)}catch(o){this.onKeybindingEditingError(o)}finally{this.hideOverlayContainer(),this.selectEntry(e)}}defineWhenExpression(e){e.keybindingItem.keybinding&&(this.selectEntry(e),this._onDefineWhenExpression.fire(e))}rejectWhenExpression(e){this._onRejectWhenExpression.fire(e)}acceptWhenExpression(e){this._onAcceptWhenExpression.fire(e)}async updateKeybinding(e,t,o,n){((e.keybindingItem.keybinding?e.keybindingItem.keybinding.getUserSettingsLabel():"")!==t||e.keybindingItem.when!==o)&&(n?await this.keybindingEditingService.addKeybinding(e.keybindingItem.keybindingItem,t,o||void 0):await this.keybindingEditingService.editKeybinding(e.keybindingItem.keybindingItem,t,o||void 0),e.keybindingItem.keybinding||(this.unAssignedKeybindingItemToRevealAndFocus=e))}async removeKeybinding(e){if(this.selectEntry(e),e.keybindingItem.keybinding)try{await this.keybindingEditingService.removeKeybinding(e.keybindingItem.keybindingItem),this.focus()}catch(t){this.onKeybindingEditingError(t),this.selectEntry(e)}}async resetKeybinding(e){this.selectEntry(e);try{await this.keybindingEditingService.resetKeybinding(e.keybindingItem.keybindingItem),e.keybindingItem.keybinding||(this.unAssignedKeybindingItemToRevealAndFocus=e),this.selectEntry(e)}catch(t){this.onKeybindingEditingError(t),this.selectEntry(e)}}async copyKeybinding(e){this.selectEntry(e);let t={key:e.keybindingItem.keybinding&&e.keybindingItem.keybinding.getUserSettingsLabel()||"",command:e.keybindingItem.command};e.keybindingItem.when&&(t.when=e.keybindingItem.when),await this.clipboardService.writeText(JSON.stringify(t,null," "))}async copyKeybindingCommand(e){this.selectEntry(e),await this.clipboardService.writeText(e.keybindingItem.command)}async copyKeybindingCommandTitle(e){this.selectEntry(e),await this.clipboardService.writeText(e.keybindingItem.commandLabel)}focusSearch(){this.searchWidget.focus()}search(e){this.focusSearch(),this.searchWidget.setValue(e),this.selectEntry(0)}clearSearchResults(){this.searchWidget.clear(),this.searchHasValueContextKey.set(!1)}showSimilarKeybindings(e){let t=`"${e.keybindingItem.keybinding.getAriaLabel()}"`;t!==this.searchWidget.getValue()&&this.searchWidget.setValue(t)}createAriaLabelElement(e){this.ariaLabelElement=R(e,_("")),this.ariaLabelElement.setAttribute("id","keybindings-editor-aria-label-element"),this.ariaLabelElement.setAttribute("aria-live","assertive")}createOverlayContainer(e){this.overlayContainer=R(e,Mv(".overlay-container")),this.overlayContainer.style.position="absolute",this.overlayContainer.style.zIndex="40",this.defineKeybindingWidget=this._register(this.instantiationService.createInstance(NF,this.overlayContainer)),this._register(this.defineKeybindingWidget.onDidChange(t=>this.defineKeybindingWidget.printExisting(this.keybindingsEditorModel.fetch(`"${t}"`).length))),this._register(this.defineKeybindingWidget.onShowExistingKeybidings(t=>this.searchWidget.setValue(`"${t}"`))),this.hideOverlayContainer()}showOverlayContainer(){this.overlayContainer.style.display="block"}hideOverlayContainer(){this.overlayContainer.style.display="none"}createHeader(e){this.headerContainer=R(e,Mv(".keybindings-header"));let t=d(12300,null),o=d(12301,null),n=this._register(new st(E0t,d(12280,null),q.asClassName(wLe),!1,async()=>this.clearSearchResults())),r=R(this.headerContainer,Mv(".search-row-container")),s=R(r,Mv(".search-container"));this.searchWidget=this._register(this.instantiationService.createInstance(upe,s,{ariaLabel:t,placeholder:t,focusKey:this.searchFocusContextKey,ariaLabelledBy:"keybindings-editor-aria-label-element",recordEnter:!0,quoteRecordedKeys:!0,history:new Set(this.getMemento(0,0).searchHistory??[]),inputBoxStyles:c_({inputBorder:ZE})})),this._register(this.searchWidget.onDidChange(g=>{let f=!!g;n.enabled=f,this.searchHasValueContextKey.set(f),this.delayedFiltering.trigger(()=>this.filterKeybindings()),this.updateSearchOptions()})),this._register(this.searchWidget.onEscape(()=>this.recordKeysAction.checked=!1)),this.actionsContainer=R(s,_(".keybindings-search-actions-container"));let l=this.createRecordingBadge(this.actionsContainer);this._register(this.sortByPrecedenceAction.onDidChange(g=>{g.checked!==void 0&&this.renderKeybindingsEntries(!1),this.updateSearchOptions()})),this._register(this.recordKeysAction.onDidChange(g=>{g.checked!==void 0&&(l.classList.toggle("disabled",!g.checked),g.checked?(this.searchWidget.inputBox.setPlaceHolder(o),this.searchWidget.inputBox.setAriaLabel(o),this.searchWidget.startRecordingKeys(),this.searchWidget.focus()):(this.searchWidget.inputBox.setPlaceHolder(t),this.searchWidget.inputBox.setAriaLabel(t),this.searchWidget.stopRecordingKeys(),this.searchWidget.focus()),this.updateSearchOptions())}));let c=[this.recordKeysAction,this.sortByPrecedenceAction,n],u=this._register(new Ju(this.actionsContainer,this.contextMenuService,{actionViewItemProvider:(g,f)=>{if(g.id===this.sortByPrecedenceAction.id||g.id===this.recordKeysAction.id)return new Gae(null,g,{...f,keybinding:this.keybindingsService.lookupKeybinding(g.id)?.getLabel(),toggleStyles:qg})},getKeyBinding:g=>this.keybindingsService.lookupKeybinding(g.id)}));u.setActions(c),this._register(this.keybindingsService.onDidUpdateKeybindings(()=>u.setActions(c)));let p=R(r,Mv(".open-keybindings-json")),h=this._register(new Mi(p,{secondary:!0,title:!0,...Ko}));h.label=d(12295,null),this._register(h.onDidClick(()=>this.preferencesService.openGlobalKeybindingSettings(!0,{groupId:this.group.id})))}updateSearchOptions(){let e=this.input;e&&(e.searchOptions={searchValue:this.searchWidget.getValue(),recordKeybindings:!!this.recordKeysAction.checked,sortByPrecedence:!!this.sortByPrecedenceAction.checked})}createRecordingBadge(e){let t=R(e,_(".recording-badge.monaco-count-badge.long.disabled"));return t.textContent=d(12296,null),t.style.backgroundColor=wt(rv),t.style.color=wt(Yw),t.style.border=`1px solid ${wt(gi)}`,t}layoutSearchWidget(e){this.searchWidget.layout(e),this.headerContainer.classList.toggle("small",e.width<400),this.searchWidget.inputBox.inputElement.style.paddingRight=`${yl(this.actionsContainer)+12}px`}createBody(e){let t=R(e,Mv(".keybindings-body"));this.createTable(t)}createTable(e){this.keybindingsTableContainer=R(e,Mv(".keybindings-table-container")),this.keybindingsTable=this._register(this.instantiationService.createInstance(rC,"KeybindingsEditor",this.keybindingsTableContainer,new EIi,[{label:"",tooltip:"",weight:0,minimumWidth:40,maximumWidth:40,templateId:oZ.TEMPLATE_ID,project(t){return t}},{label:d(12281,null),tooltip:"",weight:.3,templateId:nZ.TEMPLATE_ID,project(t){return t}},{label:d(12290,null),tooltip:"",weight:.2,templateId:j0t.TEMPLATE_ID,project(t){return t}},{label:d(12308,null),tooltip:"",weight:.35,templateId:sZ.TEMPLATE_ID,project(t){return t}},{label:d(12306,null),tooltip:"",weight:.15,templateId:rZ.TEMPLATE_ID,project(t){return t}}],[this.instantiationService.createInstance(oZ,this),this.instantiationService.createInstance(nZ),this.instantiationService.createInstance(j0t),this.instantiationService.createInstance(sZ,this),this.instantiationService.createInstance(rZ)],{identityProvider:{getId:t=>t.id},horizontalScrolling:!1,accessibilityProvider:new TIi(this.configurationService),keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:t=>t.keybindingItem.commandLabel||t.keybindingItem.command},overrideStyles:{listBackground:qo},multipleSelectionSupport:!1,setRowLineHeight:!1,openOnSingleClick:!1,transformOptimization:!1})),this._register(this.keybindingsTable.onContextMenu(t=>this.onContextMenu(t))),this._register(this.keybindingsTable.onDidChangeFocus(t=>this.onFocusChange())),this._register(this.keybindingsTable.onDidFocus(()=>{this.keybindingsTable.getHTMLElement().classList.add("focused"),this.onFocusChange()})),this._register(this.keybindingsTable.onDidBlur(()=>{this.keybindingsTable.getHTMLElement().classList.remove("focused"),this.keybindingFocusContextKey.reset()})),this._register(this.keybindingsTable.onDidOpen(t=>{if(t.browserEvent?.defaultPrevented)return;let o=this.activeKeybindingEntry;o&&this.defineKeybinding(o,!1)})),R(this.keybindingsTableContainer,this.overflowWidgetsDomNode)}async render(e){if(this.input){let t=this.input;this.keybindingsEditorModel=await t.resolve(),await this.keybindingsEditorModel.resolve(this.getActionsLabels()),this.renderKeybindingsEntries(!1,e),t.searchOptions?(this.recordKeysAction.checked=t.searchOptions.recordKeybindings,this.sortByPrecedenceAction.checked=t.searchOptions.sortByPrecedence,this.searchWidget.setValue(t.searchOptions.searchValue)):this.updateSearchOptions()}}getActionsLabels(){let e=new Map;for(let t of aa.getEditorActions())e.set(t.id,t.label);for(let t of fe.getMenuItems(D.CommandPalette))if(Kk(t)){let o=typeof t.command.title=="string"?t.command.title:t.command.title.value,n=t.command.category?typeof t.command.category=="string"?t.command.category:t.command.category.value:void 0;e.set(t.command.id,n?`${n}: ${o}`:o)}return e}filterKeybindings(){this.renderKeybindingsEntries(this.searchWidget.hasFocus()),this.searchHistoryDelayer.trigger(()=>{this.searchWidget.inputBox.addToHistory(),this.getMemento(0,0).searchHistory=this.searchWidget.inputBox.getHistory(),this.saveState()})}clearKeyboardShortcutSearchHistory(){this.searchWidget.inputBox.clearHistory(),this.getMemento(0,0).searchHistory=this.searchWidget.inputBox.getHistory(),this.saveState()}renderKeybindingsEntries(e,t){if(this.keybindingsEditorModel){let o=this.searchWidget.getValue(),n=this.keybindingsEditorModel.fetch(o,this.sortByPrecedenceAction.checked);this.accessibilityService.alert(d(12289,null,n.length)),this.ariaLabelElement.setAttribute("aria-label",this.getAriaLabel(n)),n.length===0&&this.latestEmptyFilters.push(o);let r=this.keybindingsTable.getSelection()[0];if(this.tableEntries=n,this.keybindingsTable.splice(0,this.keybindingsTable.length,this.tableEntries),this.layoutKeybindingsTable(),e)this.keybindingsTable.setSelection([]),this.keybindingsTable.setFocus([]);else if(this.unAssignedKeybindingItemToRevealAndFocus){let s=this.getNewIndexOfUnassignedKeybinding(this.unAssignedKeybindingItemToRevealAndFocus);s!==-1&&(this.keybindingsTable.reveal(s,.2),this.selectEntry(s)),this.unAssignedKeybindingItemToRevealAndFocus=null}else r!==-1&&r<this.tableEntries.length?this.selectEntry(r,t):this.editorService.activeEditorPane===this&&!t&&this.focus()}}getAriaLabel(e){return this.sortByPrecedenceAction.checked?d(12303,null,e.length):d(12302,null,e.length)}layoutKeybindingsTable(){if(!this.dimension)return;let e=this.dimension.height-(Yn(this.headerContainer).height+12);this.keybindingsTableContainer.style.height=`${e}px`,this.keybindingsTable.layout(e)}getIndexOf(e){let t=this.tableEntries.indexOf(e);if(t===-1){for(let o=0;o<this.tableEntries.length;o++)if(this.tableEntries[o].id===e.id)return o}return t}getNewIndexOfUnassignedKeybinding(e){for(let t=0;t<this.tableEntries.length;t++){let o=this.tableEntries[t];if(o.templateId===e4&&o.keybindingItem.command===e.keybindingItem.command)return t}return-1}selectEntry(e,t=!0){let o=typeof e=="number"?e:this.getIndexOf(e);o!==-1&&o<this.keybindingsTable.length&&(t&&(this.keybindingsTable.domFocus(),this.keybindingsTable.setFocus([o])),this.keybindingsTable.setSelection([o]))}focusKeybindings(){this.keybindingsTable.domFocus();let e=this.keybindingsTable.getFocus();this.keybindingsTable.setFocus([e.length?e[0]:0])}selectKeybinding(e){this.selectEntry(e)}recordSearchKeys(){this.recordKeysAction.checked=!0}toggleSortByPrecedence(){this.sortByPrecedenceAction.checked=!this.sortByPrecedenceAction.checked}onContextMenu(e){if(e.element&&e.element.templateId===e4){let t=e.element;this.selectEntry(t),this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>[this.createCopyAction(t),this.createCopyCommandAction(t),this.createCopyCommandTitleAction(t),new li,...t.keybindingItem.keybinding?[this.createDefineKeybindingAction(t),this.createAddKeybindingAction(t)]:[this.createDefineKeybindingAction(t)],new li,this.createRemoveAction(t),this.createResetAction(t),new li,this.createDefineWhenExpressionAction(t),new li,this.createShowConflictsAction(t)]})}}onFocusChange(){this.keybindingFocusContextKey.reset();let e=this.keybindingsTable.getFocusedElements()[0];e&&e.templateId===e4&&this.keybindingFocusContextKey.set(!0)}createDefineKeybindingAction(e){return{label:e.keybindingItem.keybinding?d(12279,null):d(12278,null),enabled:!0,id:bLe,run:()=>this.defineKeybinding(e,!1)}}createAddKeybindingAction(e){return{label:d(12278,null),enabled:!0,id:D0t,run:()=>this.defineKeybinding(e,!0)}}createDefineWhenExpressionAction(e){return{label:d(12286,null),enabled:!!e.keybindingItem.keybinding,id:L0t,run:()=>this.defineWhenExpression(e)}}createRemoveAction(e){return{label:d(12298,null),enabled:!!e.keybindingItem.keybinding,id:R0t,run:()=>this.removeKeybinding(e)}}createResetAction(e){return{label:d(12299,null),enabled:!e.keybindingItem.keybindingItem.isDefault,id:M0t,run:()=>this.resetKeybinding(e)}}createShowConflictsAction(e){return{label:d(12304,null),enabled:!!e.keybindingItem.keybinding,id:O0t,run:()=>this.showSimilarKeybindings(e)}}createCopyAction(e){return{label:d(12284,null),enabled:!0,id:P0t,run:()=>this.copyKeybinding(e)}}createCopyCommandAction(e){return{label:d(12282,null),enabled:!0,id:A0t,run:()=>this.copyKeybindingCommand(e)}}createCopyCommandTitleAction(e){return{label:d(12283,null),enabled:!!e.keybindingItem.commandLabel,id:N0t,run:()=>this.copyKeybindingCommandTitle(e)}}onKeybindingEditingError(e){this.notificationService.error(typeof e=="string"?e:d(12287,null,`${e}`))}};xh=I([m(1,Te),m(2,De),m(3,_e),m(4,ze),m(5,bbi),m(6,X),m(7,Ne),m(8,Wi),m(9,F),m(10,ee),m(11,le),m(12,B),m(13,Bi),m(14,Po)],xh);var EIi=class{constructor(){this.headerRowHeight=30}getHeight(i){if(i.templateId===e4){let e=i.keybindingItem.commandLabel&&i.commandIdMatches,t=!!i.commandDefaultLabelMatches,o=!!i.extensionIdMatches;if(e&&t)return 60;if(o||e||t)return 40}return 24}},oZ=class{constructor(i,e){this.keybindingsEditor=i;this.keybindingsService=e;this.templateId=oZ.TEMPLATE_ID}static{this.TEMPLATE_ID="actions"}renderTemplate(i){let e=R(i,Mv(".actions"));return{actionBar:new ji(e)}}renderElement(i,e,t){t.actionBar.clear();let o=[];i.keybindingItem.keybinding?o.push(this.createEditAction(i)):o.push(this.createAddAction(i)),t.actionBar.push(o,{icon:!0})}createEditAction(i){return{class:q.asClassName(Rso),enabled:!0,id:"editKeybinding",tooltip:this.keybindingsService.appendKeybinding(d(12285,null),bLe),run:()=>this.keybindingsEditor.defineKeybinding(i,!1)}}createAddAction(i){return{class:q.asClassName(Mso),enabled:!0,id:"addKeybinding",tooltip:this.keybindingsService.appendKeybinding(d(12277,null),bLe),run:()=>this.keybindingsEditor.defineKeybinding(i,!1)}}disposeTemplate(i){i.actionBar.dispose()}};oZ=I([m(1,_e)],oZ);var nZ=class{constructor(i){this._hoverService=i;this.templateId=nZ.TEMPLATE_ID}static{this.TEMPLATE_ID="commands"}renderTemplate(i){let e=R(i,Mv(".command")),t=this._hoverService.setupManagedHover(Ni("mouse"),e,""),o=R(e,Mv(".command-label")),n=new Oa(o),r=R(e,Mv(".command-default-label")),s=new Oa(r),l=R(e,Mv(".command-id.code")),c=new Oa(l);return{commandColumn:e,commandColumnHover:t,commandLabelContainer:o,commandLabel:n,commandDefaultLabelContainer:r,commandDefaultLabel:s,commandIdLabelContainer:l,commandIdLabel:c}}renderElement(i,e,t){let o=i.keybindingItem,n=!!(o.commandLabel&&i.commandIdMatches),r=!!i.commandDefaultLabelMatches;t.commandColumn.classList.toggle("vertical-align-column",n||r);let s=o.commandLabel?d(12307,null,o.commandLabel,o.command):o.command;t.commandColumn.setAttribute("aria-label",s),t.commandColumnHover.update(s),o.commandLabel?(t.commandLabelContainer.classList.remove("hide"),t.commandLabel.set(o.commandLabel,i.commandLabelMatches)):(t.commandLabelContainer.classList.add("hide"),t.commandLabel.set(void 0)),i.commandDefaultLabelMatches?(t.commandDefaultLabelContainer.classList.remove("hide"),t.commandDefaultLabel.set(o.commandDefaultLabel,i.commandDefaultLabelMatches)):(t.commandDefaultLabelContainer.classList.add("hide"),t.commandDefaultLabel.set(void 0)),i.commandIdMatches||!o.commandLabel?(t.commandIdLabelContainer.classList.remove("hide"),t.commandIdLabel.set(o.command,i.commandIdMatches)):(t.commandIdLabelContainer.classList.add("hide"),t.commandIdLabel.set(void 0))}disposeTemplate(i){i.commandColumnHover.dispose(),i.commandDefaultLabel.dispose(),i.commandIdLabel.dispose(),i.commandLabel.dispose()}};nZ=I([m(0,tt)],nZ);var j0t=class a{constructor(){this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="keybindings"}renderTemplate(i){let e=R(i,Mv(".keybinding"));return{keybindingLabel:new ah(R(e,Mv("div.keybinding-label")),zo,l_)}}renderElement(i,e,t){i.keybindingItem.keybinding?t.keybindingLabel.set(i.keybindingItem.keybinding,i.keybindingMatches):t.keybindingLabel.set(void 0,void 0)}disposeTemplate(i){i.keybindingLabel.dispose()}};function V4o(a,i){let e=new P;return e.add(j(a,re.CLICK,Ybe(i))),e.add(j(a,re.KEY_UP,t=>{let o=new Ii(t);(o.equals(10)||o.equals(3))&&(t.preventDefault(),t.stopPropagation(),i())})),e}var rZ=class{constructor(i,e){this.extensionsWorkbenchService=i;this.hoverService=e;this.templateId=rZ.TEMPLATE_ID}static{this.TEMPLATE_ID="source"}renderTemplate(i){let e=R(i,Mv(".source")),t=this.hoverService.setupManagedHover(Ni("mouse"),e,""),o=new Oa(R(e,Mv(".source-label"))),n=R(e,Mv(".extension-container")),r=R(n,Mv("a.extension-label",{tabindex:0})),s=new Oa(R(n,Mv(".extension-id-container.code")));return{sourceColumn:e,sourceColumnHover:t,sourceLabel:o,extensionLabel:r,extensionContainer:n,extensionId:s,disposables:new P}}renderElement(i,e,t){if(t.disposables.clear(),Ae(i.keybindingItem.source))t.extensionContainer.classList.add("hide"),t.sourceLabel.element.classList.remove("hide"),t.sourceColumnHover.update(""),t.sourceLabel.set(i.keybindingItem.source||"-",i.sourceMatches);else{t.extensionContainer.classList.remove("hide"),t.sourceLabel.element.classList.add("hide");let o=i.keybindingItem.source,n=o.displayName??o.identifier.value;t.sourceColumnHover.update(d(12288,null,n)),t.extensionLabel.textContent=n,t.disposables.add(V4o(t.extensionLabel,()=>{this.extensionsWorkbenchService.open(o.identifier.value)})),i.extensionIdMatches?(t.extensionId.element.classList.remove("hide"),t.extensionId.set(o.identifier.value,i.extensionIdMatches)):(t.extensionId.element.classList.add("hide"),t.extensionId.set(void 0))}}disposeTemplate(i){i.sourceColumnHover.dispose(),i.disposables.dispose(),i.sourceLabel.dispose(),i.extensionId.dispose()}};rZ=I([m(0,zi),m(1,tt)],rZ);var fJe=class extends C{constructor(e,t,o,n){super();this._onDidAccept=this._register(new E);this.onDidAccept=this._onDidAccept.event;this._onDidReject=this._register(new E);this.onDidReject=this._onDidReject.event;let r=spe.bindTo(n);this.input=this._register(o.createInstance(tA,"keyboardshortcutseditor#wheninput",e,{provideResults:()=>{let s=[];for(let l of Q.all())s.push({label:l.key,documentation:l.description,detail:l.type,kind:14});return s},triggerCharacters:["!"," "],wordDefinition:/[a-zA-Z.]+/,alwaysShowSuggestions:!0},"","keyboardshortcutseditor#wheninput",{focusContextKey:r,overflowWidgetsDomNode:t.overflowWidgetsDomNode})),this._register(j(this.input.element,re.DBLCLICK,s=>$t.stop(s))),this._register(Z(()=>r.reset())),this._register(t.onAcceptWhenExpression(()=>this._onDidAccept.fire(this.input.getValue()))),this._register(H.any(t.onRejectWhenExpression,this.input.onDidBlur)(()=>this._onDidReject.fire()))}layout(e){this.input.layout(e)}show(e){this.input.setValue(e),this.input.focus(!0)}};fJe=I([m(2,F),m(3,X)],fJe);var sZ=class{constructor(i,e,t){this.keybindingsEditor=i;this.hoverService=e;this.instantiationService=t;this.templateId=sZ.TEMPLATE_ID}static{this.TEMPLATE_ID="when"}renderTemplate(i){let e=R(i,Mv(".when")),t=R(e,Mv("div.when-label")),o=new Oa(t),n=R(e,Mv("div.when-input-container"));return{element:e,whenLabelContainer:t,whenLabel:o,whenInputContainer:n,disposables:new P}}renderElement(i,e,t){t.disposables.clear();let o=t.disposables.add(new P);t.disposables.add(this.keybindingsEditor.onDefineWhenExpression(n=>{if(i===n){t.element.classList.add("input-mode");let r=o.add(this.instantiationService.createInstance(fJe,t.whenInputContainer,this.keybindingsEditor));r.layout(new ai(t.element.parentElement.clientWidth,18)),r.show(i.keybindingItem.when||"");let s=()=>{o.clear(),t.element.classList.remove("input-mode"),t.element.parentElement.style.paddingLeft="10px",Rt(t.whenInputContainer)};o.add(r.onDidAccept(l=>{s(),this.keybindingsEditor.updateKeybinding(i,i.keybindingItem.keybinding&&i.keybindingItem.keybinding.getUserSettingsLabel()||"",l),this.keybindingsEditor.selectKeybinding(i)})),o.add(r.onDidReject(()=>{s(),this.keybindingsEditor.selectKeybinding(i)})),t.element.parentElement.style.paddingLeft="0px"}})),t.whenLabelContainer.classList.toggle("code",!!i.keybindingItem.when),t.whenLabelContainer.classList.toggle("empty",!i.keybindingItem.when),i.keybindingItem.when?(t.whenLabel.set(i.keybindingItem.when,i.whenMatches,i.keybindingItem.when),t.disposables.add(this.hoverService.setupManagedHover(Ni("mouse"),t.element,i.keybindingItem.when))):t.whenLabel.set("-")}disposeTemplate(i){i.disposables.dispose(),i.whenLabel.dispose()}};sZ=I([m(1,tt),m(2,F)],sZ);var TIi=class{constructor(i){this.configurationService=i}getWidgetAriaLabel(){return d(12291,null)}getAriaLabel({keybindingItem:i}){let e=[i.commandLabel?i.commandLabel:i.command,i.keybinding?.getAriaLabel()||d(12293,null),i.when?i.when:d(12294,null),Ae(i.source)?i.source:i.source.description??i.source.identifier.value];if(this.configurationService.getValue("accessibility.verbosity.keybindingsEditor")){let t=d(12292,null);e.push(t)}return e.join(", ")}};J("keybindingTable.headerBackground",U$e,"Background color for the keyboard shortcuts table header.");J("keybindingTable.rowsBackground",U$e,"Background color for the keyboard shortcuts table alternating rows.");is((a,i)=>{let e=a.getColor(ko);if(e){let p=e.transparent(.8).makeOpaque(DO(a));i.addRule(`.keybindings-editor > .keybindings-body > .keybindings-table-container .monaco-table .monaco-table-tr .monaco-table-td .code { color: ${p}; }`)}let t=a.getColor(QT),o=a.getColor(Wy);if(t&&o){let p=t.transparent(.8).makeOpaque(o);i.addRule(`.keybindings-editor > .keybindings-body > .keybindings-table-container .monaco-table.focused .monaco-list-row.selected .monaco-table-tr .monaco-table-td .code { color: ${p}; }`)}let n=a.getColor(ugt),r=a.getColor(xf);if(n&&r){let p=n.transparent(.8).makeOpaque(r);i.addRule(`.keybindings-editor > .keybindings-body > .keybindings-table-container .monaco-table .monaco-list-row.selected .monaco-table-tr .monaco-table-td .code { color: ${p}; }`)}let s=a.getColor(ZSe),l=a.getColor(c9);if(s&&l){let p=s.transparent(.8).makeOpaque(l);i.addRule(`.keybindings-editor > .keybindings-body > .keybindings-table-container .monaco-table.focused .monaco-list-row.focused .monaco-table-tr .monaco-table-td .code { color: ${p}; }`)}let c=a.getColor(eIe),u=a.getColor(Xk);if(c&&u){let p=c.transparent(.8).makeOpaque(u);i.addRule(`.keybindings-editor > .keybindings-body > .keybindings-table-container .monaco-table.focused .monaco-list-row:hover:not(.focused):not(.selected) .monaco-table-tr .monaco-table-td .code { color: ${p}; }`)}});var FK=class extends st{constructor(e,t,o,n,r,s){super(e,t);this.modelService=o;this.languageService=n;this.quickInputService=r;this.preferencesService=s}static{this.ID="workbench.action.configureLanguageBasedSettings"}static{this.LABEL=L(12360,"Configure Language Specific Settings...")}async run(){let t=this.languageService.getSortedRegisteredLanguageNames().map(({languageName:o,languageId:n})=>{let r=d(12361,null,n),s,l=this.languageService.getExtensions(n);if(l.length)s=A.file(l[0]);else{let c=this.languageService.getFilenames(n);c.length&&(s=A.file(c[0]))}return{label:o,iconClasses:js(this.modelService,this.languageService,s),description:r}});await this.quickInputService.pick(t,{placeHolder:d(12362,null)}).then(o=>{if(o){let n=this.languageService.getLanguageIdByLanguageName(o.label);if(typeof n=="string")return this.preferencesService.openLanguageSpecificSettings(n)}})}};FK=I([m(2,Ct),m(3,kt),m(4,Ge),m(5,Po)],FK);qe.registerCommand({id:"_getAllSettings",handler:()=>oe.as(ii.Configuration).getConfigurationProperties()});qe.registerCommand("_getAllCommands",function(a,i){let e=a.get(_e),t=a.get(X),o=[];for(let n of aa.getEditorActions()){let r=e.lookupKeybinding(n.id);i&&!t.contextMatchesRules(n.precondition)||o.push({command:n.id,label:n.label,description:xq(n.metadata?.description)?n.metadata.description.value:n.metadata?.description,precondition:n.precondition?.serialize(),keybinding:r?.getLabel()??"Not set"})}for(let n of fe.getMenuItems(D.CommandPalette))if(Kk(n)){if(i&&!t.contextMatchesRules(n.when))continue;let r=typeof n.command.title=="string"?n.command.title:n.command.title.value,s=n.command.category?typeof n.command.category=="string"?n.command.category:n.command.category.value:void 0,l=s?`${s}: ${r}`:r,c=xq(n.command.metadata?.description)?n.command.metadata.description.value:n.command.metadata?.description,u=e.lookupKeybinding(n.command.id);o.push({command:n.command.id,label:l,description:c,precondition:n.when?.serialize(),keybinding:u?.getLabel()??"Not set"})}return o});var Q0t;(i=>i.PreferencesEditorPane="workbench.registry.preferences.editorPanes")(Q0t||={});var _Ii=class extends C{constructor(){super();this.descriptors=new Map;this._onDidRegisterPreferencesEditorPanes=this._register(new E);this.onDidRegisterPreferencesEditorPanes=this._onDidRegisterPreferencesEditorPanes.event;this._onDidDeregisterPreferencesEditorPanes=this._register(new E);this.onDidDeregisterPreferencesEditorPanes=this._onDidDeregisterPreferencesEditorPanes.event}registerPreferencesEditorPane(e){if(this.descriptors.has(e.id))throw new Error(`PreferencesEditorPane with id ${e.id} already registered`);return this.descriptors.set(e.id,e),this._onDidRegisterPreferencesEditorPanes.fire([e]),{dispose:()=>{this.descriptors.delete(e.id)&&this._onDidDeregisterPreferencesEditorPanes.fire([e])}}}getPreferencesEditorPanes(){return[...this.descriptors.values()].sort((e,t)=>e.order-t.order)}};oe.add(Q0t.PreferencesEditorPane,new _Ii);var DIi=class extends st{constructor(e,t){super(e.id,e.title,"",!0,t);this.descriptor=e}},y4=class extends pa{constructor(e,t,o,n,r,s){super(y4.ID,e,t,o,n);this.instantiationService=r;this.editorPanesRegistry=oe.as(Q0t.PreferencesEditorPane);this.preferencesTabActions=[];this.preferencesEditorPane=this._register(new me);this.searchFocusContextKey=uso.bindTo(s),this.element=_(".preferences-editor");let l=R(this.element,_(".preferences-editor-header")),c=R(l,_(".search-container"));this.searchWidget=this._register(this.instantiationService.createInstance(tZ,c,{focusKey:this.searchFocusContextKey,inputBoxStyles:c_({inputBorder:ZE})})),this._register(H.debounce(this.searchWidget.onDidChange,()=>{},300)(()=>{this.preferencesEditorPane.value?.search(this.searchWidget.getValue())}));let u=R(l,_(".preferences-tabs-container"));this.preferencesTabActionBar=this._register(new ji(u,{orientation:0,focusOnlyEnabledItems:!0,ariaLabel:d(12364,null),ariaRole:"tablist"})),this.onDidChangePreferencesEditorPane(this.editorPanesRegistry.getPreferencesEditorPanes(),[]),this._register(this.editorPanesRegistry.onDidRegisterPreferencesEditorPanes(p=>this.onDidChangePreferencesEditorPane(p,[]))),this._register(this.editorPanesRegistry.onDidDeregisterPreferencesEditorPanes(p=>this.onDidChangePreferencesEditorPane([],p))),this.bodyElement=R(this.element,_(".preferences-editor-body"))}static{this.ID="workbench.editor.preferences"}createEditor(e){R(e,this.element)}layout(e){this.dimension=e,this.searchWidget.layout(e),this.searchWidget.inputBox.inputElement.style.paddingRight="12px",this.preferencesEditorPane.value?.layout(new ai(this.bodyElement.clientWidth,e.height-87))}async setInput(e,t,o,n){await super.setInput(e,t,o,n),this.preferencesTabActions.length&&this.onDidSelectPreferencesEditorPane(this.preferencesTabActions[0].id)}onDidChangePreferencesEditorPane(e,t){for(let o of t){let n=this.preferencesTabActions.findIndex(r=>r.id===o.id);n!==-1&&(this.preferencesTabActionBar.pull(n),this.preferencesTabActions[n].dispose(),this.preferencesTabActions.splice(n,1))}if(e.length>0){let o=this.editorPanesRegistry.getPreferencesEditorPanes();for(let n of e){let r=o.findIndex(s=>s.id===n.id);if(r!==-1){let s=new DIi(n,()=>this.onDidSelectPreferencesEditorPane(n.id));this.preferencesTabActions.splice(r,0,s),this.preferencesTabActionBar.push(s,{index:r})}}}}onDidSelectPreferencesEditorPane(e){let t;for(let o of this.preferencesTabActions)o.id===e?(o.checked=!0,t=o):o.checked=!1;t&&(this.searchWidget.inputBox.setPlaceHolder(d(12363,null,t.descriptor.title)),this.searchWidget.inputBox.setAriaLabel(d(12363,null,t.descriptor.title))),this.renderBody(t?.descriptor),this.dimension&&this.layout(this.dimension)}renderBody(e){if(this.preferencesEditorPane.value=void 0,Rt(this.bodyElement),e){let t=this.instantiationService.createInstance(e.ctorDescriptor.ctor);this.preferencesEditorPane.value=t,this.bodyElement.appendChild(t.getDomNode())}}dispose(){super.dispose(),this.preferencesTabActions.forEach(e=>e.dispose())}};y4=I([m(1,Te),m(2,De),m(3,le),m(4,F),m(5,X)],y4);var vJe=class extends Ma{constructor(e){super();this.label=e;this._onClick=this._register(new E);this.onClick=this._onClick.event;this._domNode=_(".floating-click-widget"),this._domNode.style.padding="6px 11px",this._domNode.style.borderRadius="2px",this._domNode.style.cursor="pointer",this._domNode.style.zIndex="1"}getDomNode(){return this._domNode}render(){Rt(this._domNode),this._domNode.style.backgroundColor=Ese(MS,wt(qo)),this._domNode.style.color=Ese(YT,wt(od)),this._domNode.style.border=`1px solid ${wt(gi)}`,R(this._domNode,_("")).textContent=this.label,this.onclick(this._domNode,()=>this._onClick.fire())}},ppe=class extends C{constructor(e,t,o){super();this.renderEmitter=this._register(new E);this.menu=this._register(t.createMenu(e,o))}get onDidRender(){return this.renderEmitter.event}render(){let e=this._register(new P),t=()=>{if(e.clear(),!this.isVisible())return;let o=Vm(this.menu.getActions({renderShortTitle:!0,shouldForwardArgs:!0}));if(o.length===0)return;let[n]=o,r=this.createWidget(n,e);e.add(r),e.add(r.onClick(()=>n.run(this.getActionArg()))),r.render()};this._register(this.menu.onDidChange(t)),t()}getActionArg(){}isVisible(){return!0}};ppe=I([m(1,qt),m(2,X)],ppe);var DLe=class extends ppe{constructor(e,t,o,n){super(e.menuId,o,n);this.options=e;this.instantiationService=t;this.render()}createWidget(e,t){let o=this.instantiationService.createInstance(vJe,e.label),n=o.getDomNode();return this.options.container.appendChild(n),t.add(Z(()=>n.remove())),o}getActionArg(){return this.options.getActionArg()}};DLe=I([m(1,F),m(2,qt),m(3,X)],DLe);var OF=class extends C{constructor(e){super();this.editorService=e;this._onHighlightRemoved=this._register(new E);this.onHighlightRemoved=this._onHighlightRemoved.event;this.rangeHighlightDecorationId=null;this.editor=null;this.editorDisposables=this._register(new P)}removeHighlightRange(){if(this.editor&&this.rangeHighlightDecorationId){let e=this.rangeHighlightDecorationId;this.editor.changeDecorations(t=>{t.removeDecoration(e)}),this._onHighlightRemoved.fire()}this.rangeHighlightDecorationId=null}highlightRange(e,t){t=t??this.getEditor(e),pn(t)?this.doHighlightRange(t,e):MU(t)&&pn(t.activeCodeEditor)&&this.doHighlightRange(t.activeCodeEditor,e)}doHighlightRange(e,t){this.removeHighlightRange(),e.changeDecorations(o=>{this.rangeHighlightDecorationId=o.addDecoration(t.range,this.createRangeHighlightDecoration(t.isWholeLine))}),this.setEditor(e)}getEditor(e){let t=this.editorService.activeEditor?.resource;if(t&&Xe(t,e.resource)&&pn(this.editorService.activeTextEditorControl))return this.editorService.activeTextEditorControl}setEditor(e){this.editor!==e&&(this.editorDisposables.clear(),this.editor=e,this.editorDisposables.add(this.editor.onDidChangeCursorPosition(t=>{(t.reason===0||t.reason===3||t.reason===5||t.reason===6)&&this.removeHighlightRange()})),this.editorDisposables.add(this.editor.onDidChangeModel(()=>{this.removeHighlightRange()})),this.editorDisposables.add(this.editor.onDidDispose(()=>{this.removeHighlightRange(),this.editor=null})))}static{this._WHOLE_LINE_RANGE_HIGHLIGHT=po.register({description:"codeeditor-range-highlight-whole",stickiness:1,className:"rangeHighlight",isWholeLine:!0})}static{this._RANGE_HIGHLIGHT=po.register({description:"codeeditor-range-highlight",stickiness:1,className:"rangeHighlight"})}createRangeHighlightDecoration(e=!0){return e?OF._WHOLE_LINE_RANGE_HIGHLIGHT:OF._RANGE_HIGHLIGHT}dispose(){super.dispose(),this.editor?.getModel()&&(this.removeHighlightRange(),this.editor=null)}};OF=I([m(0,ee)],OF);var mpe=class extends vJe{constructor(e,t,o,n){super(n.appendKeybinding(t,o));this.editor=e}getId(){return"editor.overlayWidget.floatingClickWidget"}getPosition(){return{preference:1}}render(){super.render(),this.editor.addOverlayWidget(this)}dispose(){this.editor.removeOverlayWidget(this),super.dispose()}};mpe=I([m(3,_e)],mpe);var aZ=class extends ppe{constructor(e,t,o,n){super(D.EditorContent,o,n);this.editor=e;this.instantiationService=t;this.render()}static{this.ID="editor.contrib.floatingClickMenu"}createWidget(e){return this.instantiationService.createInstance(mpe,this.editor,e.label,e.id)}isVisible(){return!(this.editor instanceof zc)&&this.editor?.hasModel()&&!this.editor.getOption(70)}getActionArg(){return this.editor.getModel()?.uri}};aZ=I([m(1,F),m(2,qt),m(3,X)],aZ);var LIi=d(16730,null),RIi=d(16735,null),Bso=d(16729,null),Hso=d(16728,null),LLe={definitions:{inputs:{type:"array",description:d(16739,null),items:{oneOf:[{type:"object",required:["id","type","description"],additionalProperties:!1,properties:{id:{type:"string",description:LIi},type:{type:"string",description:RIi,enum:["promptString"],enumDescriptions:[d(16738,null)]},description:{type:"string",description:Bso},default:{type:"string",description:Hso},password:{type:"boolean",description:d(16732,null)}}},{type:"object",required:["id","type","description","options"],additionalProperties:!1,properties:{id:{type:"string",description:LIi},type:{type:"string",description:RIi,enum:["pickString"],enumDescriptions:[d(16737,null)]},description:{type:"string",description:Bso},default:{type:"string",description:Hso},options:{type:"array",description:d(16731,null),items:{oneOf:[{type:"string"},{type:"object",required:["value"],additionalProperties:!1,properties:{label:{type:"string",description:d(16733,null)},value:{type:"string",description:d(16734,null)}}}]}}}},{type:"object",required:["id","type","command"],additionalProperties:!1,properties:{id:{type:"string",description:LIi},type:{type:"string",description:RIi,enum:["command"],enumDescriptions:[d(16736,null)]},command:{type:"string",description:d(16727,null)},args:{oneOf:[{type:"object",description:d(16726,null)},{type:"array",description:d(16726,null)},{type:"string",description:d(16726,null)}]}}}]}}}};var B4o="onMcpCollection:",bJe=a=>B4o+a;var RLe=Object.keys({"claude-desktop":!0,windsurf:!0,"cursor-global":!0,"cursor-workspace":!0}),zso={"claude-desktop":d(11375,null),windsurf:d(11381,null),"cursor-global":d(11377,null),"cursor-workspace":d(11379,null)},Kso={"claude-desktop":d(11376,null),windsurf:d(11382,null),"cursor-global":d(11378,null),"cursor-workspace":d(11380,null)},FF="mcp",lZ="chat.mcp.discovery.enabled",SJe="chat.mcp.serverSampling",Gso={"mcp-server-time":{command:"python",args:["-m","mcp_server_time","--local-timezone=America/Los_Angeles"],env:{}}},Uso={"my-mcp-server":{url:"http://localhost:3001/mcp",headers:{}}},$so=a=>({dev:{type:"object",markdownDescription:d(11350,null),examples:[{watch:"src/**/*.ts",debug:{type:"node"}}],properties:{watch:{description:d(11355,null),examples:["src/**/*.ts"],oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]},...a&&{debug:{markdownDescription:d(11351,null),oneOf:[{type:"object",required:["type"],properties:{type:{type:"string",enum:["node"],description:d(11353,null)}},additionalProperties:!1},{type:"object",required:["type"],properties:{type:{type:"string",enum:["debugpy"],description:d(11354,null)},debugpyPath:{type:"string",description:d(11352,null)}},additionalProperties:!1}]}}}}}),IJe={type:"object",additionalProperties:!1,examples:[Gso["mcp-server-time"]],properties:{type:{type:"string",enum:["stdio"],description:d(11371,null)},sandboxEnabled:{type:"boolean",default:!1,description:d(11369,null)},command:{type:"string",description:d(11358,null)},cwd:{type:"string",description:d(11359,null),examples:["${workspaceFolder}"]},args:{type:"array",description:d(11349,null),items:{type:"string"}},envFile:{type:"string",description:d(11357,null),examples:["${workspaceFolder}/.env"]},env:{description:d(11356,null),additionalProperties:{anyOf:[{type:"null"},{type:"string"},{type:"number"}]}},...$so(!0)}},qso={id:s_e,type:"object",title:d(11370,null),allowTrailingCommas:!0,allowComments:!0,additionalProperties:!1,properties:{sandbox:{description:d(11361,null),type:"object",additionalProperties:!1,properties:{network:{description:d(11366,null),type:"object",additionalProperties:!1,properties:{allowedDomains:{description:d(11367,null),type:"array",items:{type:"string"},default:[]},deniedDomains:{description:d(11368,null),type:"array",items:{type:"string"},default:[]}}},filesystem:{description:d(11362,null),type:"object",additionalProperties:!1,properties:{denyRead:{description:d(11364,null),type:"array",items:{type:"string"},default:[]},allowWrite:{description:d(11363,null),type:"array",items:{type:"string"},default:[]},denyWrite:{description:d(11365,null),type:"array",items:{type:"string"},default:[]}}}}},servers:{examples:[Gso,Uso],additionalProperties:{oneOf:[IJe,{type:"object",additionalProperties:!1,required:["url"],examples:[Uso["my-mcp-server"]],properties:{type:{type:"string",enum:["http","sse"],description:d(11371,null)},url:{type:"string",format:"uri",pattern:"^https?:\\/\\/.+",patternErrorMessage:d(11373,null),description:d(11372,null)},headers:{type:"object",description:d(11360,null),additionalProperties:{type:"string"}},...$so(!1)}}]}},inputs:LLe.definitions.inputs}},jso={extensionPoint:"mcpServerDefinitionProviders",activationEventsGenerator:function*(a){for(let i of a)i.id&&(yield bJe(i.id))},jsonSchema:{description:d(11385,null),type:"array",defaultSnippets:[{body:[{id:"",label:""}]}],items:{additionalProperties:!1,type:"object",defaultSnippets:[{body:{id:"",label:""}}],properties:{id:{description:d(11386,null),type:"string"},label:{description:d(11387,null),type:"string"},when:{description:d(11388,null),type:"string"}}}}},MIi=class extends C{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.mcpServerDefinitionProviders&&Array.isArray(e.contributes.mcpServerDefinitionProviders)&&e.contributes.mcpServerDefinitionProviders.length>0}render(e){let t=e.contributes?.mcpServerDefinitionProviders??[],o=[d(11374,null),d(11384,null)],n=t.map(r=>[new xe().appendMarkdown(`\`${r.id}\``),r.label]);return{data:{headers:o,rows:n},dispose:()=>{}}}};oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:FF,label:d(11383,null),access:{canToggle:!1},renderer:new Mt(MIi)});var hpe=class extends C{constructor(e,t,o,n,r){super();this.editor=e;this.preferencesModel=t;this.preferencesService=o;this.configurationService=n;this.instantiationService=r;this.modelChangeDelayer=this._register(new jo(200));this.settingHighlighter=this._register(r.createInstance(wJe,e)),this.editSettingActionRenderer=this._register(this.instantiationService.createInstance(yJe,this.editor,this.preferencesModel,this.settingHighlighter)),this._register(this.editSettingActionRenderer.onUpdateSetting(({key:s,value:l,source:c})=>this.updatePreference(s,l,c))),this._register(this.editor.getModel().onDidChangeContent(()=>this.modelChangeDelayer.trigger(()=>this.onModelChanged()))),this.unsupportedSettingsRenderer=this._register(r.createInstance(CJe,e,t)),this.mcpSettingsRenderer=this._register(r.createInstance(xJe,e,t))}render(){this.editSettingActionRenderer.render(this.preferencesModel.settingsGroups,this.associatedPreferencesModel),this.unsupportedSettingsRenderer.render(),this.mcpSettingsRenderer.render()}updatePreference(e,t,o){let n=o.overrideOf?yU(o.overrideOf.key):null,r=this.preferencesModel.uri;this.configurationService.updateValue(e,t,{overrideIdentifiers:n,resource:r},this.preferencesModel.configurationTarget).then(()=>this.onSettingUpdated(o))}onModelChanged(){this.editor.hasModel()&&this.render()}onSettingUpdated(e){this.editor.focus(),e=this.getSetting(e),e&&(this.editor.setSelection(e.valueRange),this.settingHighlighter.highlight(e,!0))}getSetting(e){let{key:t,overrideOf:o}=e;if(o){let n=this.getSetting(o);for(let r of n.overrides)if(r.key===t)return r;return}return this.preferencesModel.getPreference(t)}focusPreference(e){let t=this.getSetting(e);t?(this.settingHighlighter.highlight(t,!0),this.editor.setPosition({lineNumber:t.keyRange.startLineNumber,column:t.keyRange.startColumn})):this.settingHighlighter.clear(!0)}clearFocus(e){this.settingHighlighter.clear(!0)}editPreference(e){let t=this.getSetting(e);return!!(t&&this.editSettingActionRenderer.activateOnSetting(t))}};hpe=I([m(2,Po),m(3,B),m(4,F)],hpe);var MLe=class extends hpe{constructor(i,e,t,o,n){super(i,e,t,o,n),this.workspaceConfigurationRenderer=this._register(n.createInstance(cZ,i,e))}render(){super.render(),this.workspaceConfigurationRenderer.render()}};MLe=I([m(2,Po),m(3,B),m(4,F)],MLe);var yJe=class extends C{constructor(e,t,o,n,r,s){super();this.editor=e;this.primarySettingsModel=t;this.settingHighlighter=o;this.configurationService=n;this.instantiationService=r;this.contextMenuService=s;this.settingsGroups=[];this._onUpdateSetting=this._register(new E);this.onUpdateSetting=this._onUpdateSetting.event;this.editPreferenceWidgetForCursorPosition=this._register(this.instantiationService.createInstance(pJe,e)),this.editPreferenceWidgetForMouseMove=this._register(this.instantiationService.createInstance(pJe,e)),this.toggleEditPreferencesForMouseMoveDelayer=this._register(new jo(75)),this._register(this.editPreferenceWidgetForCursorPosition.onClick(l=>this.onEditSettingClicked(this.editPreferenceWidgetForCursorPosition,l))),this._register(this.editPreferenceWidgetForMouseMove.onClick(l=>this.onEditSettingClicked(this.editPreferenceWidgetForMouseMove,l))),this._register(this.editor.onDidChangeCursorPosition(l=>this.onPositionChanged(l))),this._register(this.editor.onMouseMove(l=>this.onMouseMoved(l))),this._register(this.editor.onDidChangeConfiguration(()=>this.onConfigurationChanged()))}render(e,t){this.editPreferenceWidgetForCursorPosition.hide(),this.editPreferenceWidgetForMouseMove.hide(),this.settingsGroups=e,this.associatedPreferencesModel=t;let o=this.getSettings(this.editor.getPosition().lineNumber);o.length&&this.showEditPreferencesWidget(this.editPreferenceWidgetForCursorPosition,o)}isDefaultSettings(){return this.primarySettingsModel instanceof IDe}onConfigurationChanged(){this.editor.getOption(66)||(this.editPreferenceWidgetForCursorPosition.hide(),this.editPreferenceWidgetForMouseMove.hide())}onPositionChanged(e){this.editPreferenceWidgetForMouseMove.hide();let t=this.getSettings(e.position.lineNumber);t.length?this.showEditPreferencesWidget(this.editPreferenceWidgetForCursorPosition,t):this.editPreferenceWidgetForCursorPosition.hide()}onMouseMoved(e){let t=this.getEditPreferenceWidgetUnderMouse(e);if(t){this.onMouseOver(t);return}this.settingHighlighter.clear(),this.toggleEditPreferencesForMouseMoveDelayer.trigger(()=>this.toggleEditPreferenceWidgetForMouseMove(e))}getEditPreferenceWidgetUnderMouse(e){if(e.target.type===2){let t=e.target.position.lineNumber;if(this.editPreferenceWidgetForMouseMove.getLine()===t&&this.editPreferenceWidgetForMouseMove.isVisible())return this.editPreferenceWidgetForMouseMove;if(this.editPreferenceWidgetForCursorPosition.getLine()===t&&this.editPreferenceWidgetForCursorPosition.isVisible())return this.editPreferenceWidgetForCursorPosition}}toggleEditPreferenceWidgetForMouseMove(e){let t=e.target.position?this.getSettings(e.target.position.lineNumber):null;t&&t.length?this.showEditPreferencesWidget(this.editPreferenceWidgetForMouseMove,t):this.editPreferenceWidgetForMouseMove.hide()}showEditPreferencesWidget(e,t){let o=t[0].valueRange.startLineNumber;this.editor.getOption(66)&&this.marginFreeFromOtherDecorations(o)&&(e.show(o,d(12381,null),t),(e===this.editPreferenceWidgetForCursorPosition?this.editPreferenceWidgetForMouseMove:this.editPreferenceWidgetForCursorPosition).hide())}marginFreeFromOtherDecorations(e){let t=this.editor.getLineDecorations(e);if(t){for(let{options:o}of t)if(o.glyphMarginClassName&&o.glyphMarginClassName.indexOf(q.asClassName(cpe))===-1)return!1}return!0}getSettings(e){let t=this.getConfigurationsMap();return this.getSettingsAtLineNumber(e).filter(o=>{let n=t[o.key];if(n){if(n.policy&&this.configurationService.inspect(o.key).policyValue!==void 0)return!1;if(this.isDefaultSettings())return o.key!=="launch";if((n.type==="boolean"||n.enum)&&(this.primarySettingsModel.configurationTarget!==6||n.scope===5||n.scope===6))return!0}return!1})}getSettingsAtLineNumber(e){let t=0,o=[];for(let n of this.settingsGroups){if(n.range.startLineNumber>e)break;if(e>=n.range.startLineNumber&&e<=n.range.endLineNumber)for(let r of n.sections)for(let s of r.settings){if(s.range.startLineNumber>e)break;if(e>=s.range.startLineNumber&&e<=s.range.endLineNumber)if(!this.isDefaultSettings()&&s.overrides.length)for(let l of s.overrides)e>=l.range.startLineNumber&&e<=l.range.endLineNumber&&o.push({...l,index:t,groupId:n.id});else o.push({...s,index:t,groupId:n.id});t++}}return o}onMouseOver(e){this.settingHighlighter.highlight(e.preferences[0])}onEditSettingClicked(e,t){$t.stop(t.event,!0);let o=this.getSettings(e.getLine()).length===1?this.getActions(e.preferences[0],this.getConfigurationsMap()[e.preferences[0].key]):e.preferences.map(n=>new $l(`preferences.submenu.${n.key}`,n.key,this.getActions(n,this.getConfigurationsMap()[n.key])));this.contextMenuService.showContextMenu({getAnchor:()=>t.event,getActions:()=>o})}activateOnSetting(e){let t=e.keyRange.startLineNumber,o=this.getSettings(t);if(!o.length)return!1;this.editPreferenceWidgetForMouseMove.show(t,"",o);let n=this.getActions(this.editPreferenceWidgetForMouseMove.preferences[0],this.getConfigurationsMap()[this.editPreferenceWidgetForMouseMove.preferences[0].key]);return this.contextMenuService.showContextMenu({getAnchor:()=>this.toAbsoluteCoords(new Ie(t,1)),getActions:()=>n}),!0}toAbsoluteCoords(e){let t=this.editor.getScrolledVisiblePosition(e),o=Yn(this.editor.getDomNode()),n=o.left+t.left,r=o.top+t.top+t.height;return{x:n,y:r+10}}getConfigurationsMap(){return oe.as(ii.Configuration).getConfigurationProperties()}getActions(e,t){return t.type==="boolean"?[{id:"truthyValue",label:"true",tooltip:"true",enabled:!0,run:()=>this.updateSetting(e.key,!0,e),class:void 0},{id:"falsyValue",label:"false",tooltip:"false",enabled:!0,run:()=>this.updateSetting(e.key,!1,e),class:void 0}]:t.enum?t.enum.map(o=>({id:o,label:JSON.stringify(o),tooltip:JSON.stringify(o),enabled:!0,run:()=>this.updateSetting(e.key,o,e),class:void 0})):this.getDefaultActions(e)}getDefaultActions(e){if(this.isDefaultSettings()){let t=this.associatedPreferencesModel.getPreference(e.key);return[{id:"setDefaultValue",label:t?d(12387,null):d(12379,null),tooltip:t?d(12387,null):d(12379,null),enabled:!0,run:()=>this.updateSetting(e.key,e.value,e),class:void 0}]}return[]}updateSetting(e,t,o){this._onUpdateSetting.fire({key:e,value:t,source:o})}};yJe=I([m(3,B),m(4,F),m(5,ze)],yJe);var wJe=class extends C{constructor(e,t){super();this.editor=e;this.fixedHighlighter=this._register(t.createInstance(OF)),this.volatileHighlighter=this._register(t.createInstance(OF))}highlight(e,t=!1){this.volatileHighlighter.removeHighlightRange(),this.fixedHighlighter.removeHighlightRange(),(t?this.fixedHighlighter:this.volatileHighlighter).highlightRange({range:e.valueRange,resource:this.editor.getModel().uri},this.editor),this.editor.revealLineInCenterIfOutsideViewport(e.valueRange.startLineNumber,0)}clear(e=!1){this.volatileHighlighter.removeHighlightRange(),e&&this.fixedHighlighter.removeHighlightRange()}};wJe=I([m(1,F)],wJe);var CJe=class extends C{constructor(e,t,o,n,r,s,l,c,u,p){super();this.editor=e;this.settingsEditorModel=t;this.markerService=o;this.environmentService=n;this.configurationService=r;this.workspaceTrustManagementService=s;this.uriIdentityService=l;this.userDataProfileService=u;this.userDataProfilesService=p;this.renderingDelayer=this._register(new jo(200));this.codeActions=new vt(e=>this.uriIdentityService.extUri.getComparisonKey(e));this._register(this.editor.getModel().onDidChangeContent(()=>this.delayedRender())),this._register(H.filter(this.configurationService.onDidChangeConfiguration,h=>h.source===7)(()=>this.delayedRender())),this._register(c.codeActionProvider.register({pattern:t.uri.path},this)),this._register(u.onDidChangeCurrentProfile(()=>this.delayedRender()))}delayedRender(){this.renderingDelayer.trigger(()=>this.render())}render(){this.codeActions.clear();let e=this.generateMarkerData();e.length?this.markerService.changeOne("UnsupportedSettingsRenderer",this.settingsEditorModel.uri,e):this.markerService.remove("UnsupportedSettingsRenderer",[this.settingsEditorModel.uri])}async provideCodeActions(e,t,o,n){let r=[],s=this.codeActions.get(e.uri);if(s)for(let[l,c]of s)l.containsRange(t)&&r.push(...c);return{actions:r,dispose:()=>{}}}generateMarkerData(){let e=[],t=oe.as(ii.Configuration).getConfigurationProperties();for(let o of this.settingsEditorModel.settingsGroups)for(let n of o.sections)for(let r of n.settings){if(lg.test(r.key)){r.overrides&&this.handleOverrides(r.overrides,t,e);continue}let s=t[r.key];if(s){if(this.handleUnstableSettingConfiguration(r,s,e),this.handlePolicyConfiguration(r,s,e))continue;switch(this.settingsEditorModel.configurationTarget){case 3:this.handleLocalUserConfiguration(r,s,e);break;case 4:this.handleRemoteUserConfiguration(r,s,e);break;case 5:this.handleWorkspaceConfiguration(r,s,e);break;case 6:this.handleWorkspaceFolderConfiguration(r,s,e);break}}else e.push(this.generateUnknownConfigurationMarker(r))}return e}handlePolicyConfiguration(e,t,o){return!t.policy||this.configurationService.inspect(e.key).policyValue===void 0||this.settingsEditorModel.configurationTarget===7?!1:(o.push({severity:1,tags:[1],...e.range,message:d(12391,null)}),!0)}handleOverrides(e,t,o){for(let n of e||[]){let r=t[n.key];r?r.scope!==6&&o.push({severity:1,tags:[1],...n.range,message:d(12395,null)}):o.push(this.generateUnknownConfigurationMarker(n))}}handleLocalUserConfiguration(e,t,o){!this.userDataProfileService.currentProfile.isDefault&&!this.userDataProfileService.currentProfile.useDefaultFlags?.settings&&(Xe(this.userDataProfilesService.defaultProfile.settingsResource,this.settingsEditorModel.uri)&&!this.configurationService.isSettingAppliedForAllProfiles(e.key)?o.push({severity:1,tags:[1],...e.range,message:d(12380,null)}):Xe(this.userDataProfileService.currentProfile.settingsResource,this.settingsEditorModel.uri)&&(t.scope&&AC.includes(t.scope)?o.push(this.generateUnsupportedApplicationSettingMarker(e)):this.configurationService.isSettingAppliedForAllProfiles(e.key)&&o.push({severity:1,tags:[1],...e.range,message:d(12378,null,IR)}))),this.environmentService.remoteAuthority&&(t.scope===2||t.scope===3||t.scope===7)&&o.push({severity:1,tags:[1],...e.range,message:d(12393,null)})}handleRemoteUserConfiguration(e,t,o){t.scope===1&&o.push(this.generateUnsupportedApplicationSettingMarker(e))}handleWorkspaceConfiguration(e,t,o){if(t.scope&&AC.includes(t.scope)&&o.push(this.generateUnsupportedApplicationSettingMarker(e)),t.scope===2&&o.push(this.generateUnsupportedMachineSettingMarker(e)),!this.workspaceTrustManagementService.isWorkspaceTrusted()&&t.restricted){let n=this.generateUntrustedSettingMarker(e);o.push(n);let r=this.generateUntrustedSettingCodeActions([n]);this.addCodeActions(n,r)}}handleWorkspaceFolderConfiguration(e,t,o){if(t.scope&&AC.includes(t.scope)&&o.push(this.generateUnsupportedApplicationSettingMarker(e)),t.scope===2&&o.push(this.generateUnsupportedMachineSettingMarker(e)),t.scope===4&&o.push({severity:1,tags:[1],...e.range,message:d(12394,null)}),!this.workspaceTrustManagementService.isWorkspaceTrusted()&&t.restricted){let n=this.generateUntrustedSettingMarker(e);o.push(n);let r=this.generateUntrustedSettingCodeActions([n]);this.addCodeActions(n,r)}}handleUnstableSettingConfiguration(e,t,o){t.tags?.includes("preview")?o.push(this.generatePreviewSettingMarker(e)):t.tags?.includes("experimental")&&o.push(this.generateExperimentalSettingMarker(e))}generateUnsupportedApplicationSettingMarker(e){return{severity:1,tags:[1],...e.range,message:d(12389,null)}}generateUnsupportedMachineSettingMarker(e){return{severity:1,tags:[1],...e.range,message:d(12390,null)}}generateUntrustedSettingMarker(e){return{severity:4,...e.range,message:d(12396,null)}}generateUnknownConfigurationMarker(e){return{severity:1,tags:[1],...e.range,message:d(12388,null)}}generateUntrustedSettingCodeActions(e){return[{title:d(12382,null),command:{id:"workbench.trust.manage",title:d(12382,null)},diagnostics:e,kind:gr.QuickFix.value}]}generatePreviewSettingMarker(e){return{severity:1,...e.range,message:U0t}}generateExperimentalSettingMarker(e){return{severity:1,...e.range,message:z0t}}addCodeActions(e,t){let o=this.codeActions.get(this.settingsEditorModel.uri);o||(o=[],this.codeActions.set(this.settingsEditorModel.uri,o)),o.push([z.lift(e),t])}dispose(){this.markerService.remove("UnsupportedSettingsRenderer",[this.settingsEditorModel.uri]),this.codeActions.clear(),super.dispose()}};CJe=I([m(2,Ns),m(3,Vt),m(4,Lv),m(5,ns),m(6,dt),m(7,zt),m(8,mn),m(9,an)],CJe);var xJe=class extends C{constructor(e,t,o,n,r){super();this.editor=e;this.settingsEditorModel=t;this.markerService=o;this.uriIdentityService=n;this.renderingDelayer=this._register(new jo(200));this.codeActions=new vt(e=>this.uriIdentityService.extUri.getComparisonKey(e));this._register(this.editor.getModel().onDidChangeContent(()=>this.delayedRender())),this._register(r.codeActionProvider.register({pattern:t.uri.path},this))}delayedRender(){this.renderingDelayer.trigger(()=>this.render())}render(){this.codeActions.clear();let e=this.generateMarkerData();e.length?this.markerService.changeOne("McpSettingsRenderer",this.settingsEditorModel.uri,e):this.markerService.remove("McpSettingsRenderer",[this.settingsEditorModel.uri])}async provideCodeActions(e,t,o,n){let r=[],s=this.codeActions.get(e.uri);if(s)for(let[l,c]of s)l.containsRange(t)&&r.push(...c);return{actions:r,dispose:()=>{}}}generateMarkerData(){let e=[];if(this.settingsEditorModel.configurationTarget!==3&&this.settingsEditorModel.configurationTarget!==4)return e;for(let t of this.settingsEditorModel.settingsGroups)for(let o of t.sections)for(let n of o.settings)if(n.key===FF){let r=this.generateMcpConfigurationMarker(n);e.push(r);let s=this.generateMcpConfigurationCodeActions([r]);this.addCodeActions(n.range,s)}return e}generateMcpConfigurationMarker(e){let o=this.settingsEditorModel.configurationTarget===4?d(12385,null):d(12386,null);return{severity:4,...e.range,message:o}}generateMcpConfigurationCodeActions(e){let t=this.settingsEditorModel.configurationTarget===4,o=t?d(12383,null):d(12384,null),n=t?"workbench.mcp.openRemoteUserMcpJson":"workbench.mcp.openUserMcpJson";return[{title:o,command:{id:n,title:o},diagnostics:e,kind:gr.QuickFix.value}]}addCodeActions(e,t){let o=this.codeActions.get(this.settingsEditorModel.uri);o||(o=[],this.codeActions.set(this.settingsEditorModel.uri,o)),o.push([z.lift(e),t])}dispose(){this.markerService.remove("McpSettingsRenderer",[this.settingsEditorModel.uri]),this.codeActions.clear(),super.dispose()}};xJe=I([m(2,Ns),m(3,dt),m(4,zt)],xJe);var cZ=class extends C{constructor(e,t,o,n){super();this.editor=e;this.workspaceSettingsEditorModel=t;this.workspaceContextService=o;this.markerService=n;this.renderingDelayer=this._register(new jo(200));this.decorations=this.editor.createDecorationsCollection(),this._register(this.editor.getModel().onDidChangeContent(()=>this.renderingDelayer.trigger(()=>this.render())))}static{this.supportedKeys=["folders","tasks","launch","extensions","settings","remoteAuthority","transient"]}render(){let e=[];if(this.workspaceContextService.getWorkbenchState()===3&&this.workspaceSettingsEditorModel instanceof Aue){let t=[];for(let o of this.workspaceSettingsEditorModel.configurationGroups)for(let n of o.sections)for(let r of n.settings)cZ.supportedKeys.includes(r.key)||e.push({severity:1,tags:[1],...r.range,message:d(12392,null)});this.decorations.set(t.map(o=>this.createDecoration(o)))}e.length?this.markerService.changeOne("WorkspaceConfigurationRenderer",this.workspaceSettingsEditorModel.uri,e):this.markerService.remove("WorkspaceConfigurationRenderer",[this.workspaceSettingsEditorModel.uri])}static{this._DIM_CONFIGURATION_=po.register({description:"dim-configuration",stickiness:1,inlineClassName:"dim-configuration"})}createDecoration(e){return{range:e,options:cZ._DIM_CONFIGURATION_}}dispose(){this.markerService.remove("WorkspaceConfigurationRenderer",[this.workspaceSettingsEditorModel.uri]),this.decorations.clear(),super.dispose()}};cZ=I([m(2,Pe),m(3,Ns)],cZ);var H4o=["editor.fontSize","editor.formatOnSave","files.autoSave","GitHub.copilot-chat.manageExtension","editor.defaultFormatter","editor.fontFamily","editor.wordWrap","chat.agent.maxRequests","files.exclude","workbench.colorTheme","editor.tabSize","editor.mouseWheelZoom","editor.formatOnPaste"];function Qso(a){let i=new Map;for(let t of a)for(let o of t.sections)for(let n of o.settings)i.set(n.key,n);let e=[];for(let t of H4o){let o=i.get(t);o&&e.push(o)}return{id:"commonlyUsed",label:d(12470,null),settings:e}}var kJe={id:"root",label:"root",children:[{id:"editor",label:d(12507,null),settings:["editor.*"],children:[{id:"editor/cursor",label:d(12471,null),settings:["editor.cursor*"]},{id:"editor/find",label:d(12480,null),settings:["editor.find.*"]},{id:"editor/font",label:d(12481,null),settings:["editor.font*"]},{id:"editor/format",label:d(12482,null),settings:["editor.format*"]},{id:"editor/diffEditor",label:d(12473,null),settings:["diffEditor.*"]},{id:"editor/multiDiffEditor",label:d(12487,null),settings:["multiDiffEditor.*"]},{id:"editor/minimap",label:d(12486,null),settings:["editor.minimap.*"]},{id:"editor/suggestions",label:d(12502,null),settings:["editor.*suggest*"]},{id:"editor/files",label:d(12479,null),settings:["files.*"]}]},{id:"workbench",label:d(12511,null),settings:["workbench.*"],children:[{id:"workbench/appearance",label:d(12457,null),settings:["workbench.activityBar.*","workbench.*color*","workbench.fontAliasing","workbench.iconTheme","workbench.sidebar.location","workbench.*.visible","workbench.tips.enabled","workbench.tree.*","workbench.view.*"]},{id:"workbench/breadcrumbs",label:d(12459,null),settings:["breadcrumbs.*"]},{id:"workbench/editor",label:d(12474,null),settings:["workbench.editor.*"]},{id:"workbench/settings",label:d(12500,null),settings:["workbench.settings.*"]},{id:"workbench/zenmode",label:d(12513,null),settings:["zenmode.*"]},{id:"workbench/screencastmode",label:d(12497,null),settings:["screencastMode.*"]}]},{id:"window",label:d(12510,null),settings:["window.*"],children:[{id:"window/newWindow",label:d(12489,null),settings:["window.*newwindow*"]}]},{id:"chat",label:d(12460,null),children:[{id:"chat/agent",label:d(12461,null),settings:["chat.agent.*","chat.checkpoints.*","chat.editRequests","chat.requestQueuing.*","chat.undoRequests.*","chat.customAgentInSubagent.*","chat.editing.autoAcceptDelay","chat.editing.confirmEditRequest*","chat.planAgent.defaultModel"]},{id:"chat/appearance",label:d(12462,null),settings:["chat.editor.*","chat.fontFamily","chat.fontSize","chat.math.*","chat.agentsControl.*","chat.alternativeToolAction.*","chat.codeBlock.*","chat.editing.explainChanges.enabled","chat.editMode.hidden","chat.editorAssociations","chat.extensionUnification.*","chat.inlineReferences.*","chat.notifyWindow*","chat.statusWidget.*","chat.tips.*","chat.unifiedAgentsBar.*","accessibility.signals.chatUserActionRequired","accessibility.signals.chatResponseReceived"]},{id:"chat/sessions",label:d(12467,null),settings:["chat.agentSessionProjection.*","chat.sessions.*","chat.viewProgressBadge.*","chat.viewSessions.*","chat.restoreLastPanelSession","chat.exitAfterDelegation","chat.repoInfo.*"]},{id:"chat/tools",label:d(12468,null),settings:["chat.tools.*","chat.extensionTools.*"]},{id:"chat/mcp",label:d(12465,null),settings:["mcp","chat.mcp.*","mcp.*"]},{id:"chat/context",label:d(12463,null),settings:["chat.detectParticipant.*","chat.experimental.detectParticipant.*","chat.implicitContext.*","chat.promptFilesLocations","chat.instructionsFilesLocations","chat.modeFilesLocations","chat.agentFilesLocations","chat.agentSkillsLocations","chat.hookFilesLocations","chat.promptFilesRecommendations","chat.useAgentsMdFile","chat.useNestedAgentsMdFiles","chat.useAgentSkills","chat.experimental.useSkillAdherencePrompt","chat.useHooks","chat.includeApplyingInstructions","chat.includeReferencedInstructions","chat.sendElementsToChat.*","chat.useClaudeMdFile"]},{id:"chat/inlineChat",label:d(12464,null),settings:["inlineChat.*"]},{id:"chat/miscellaneous",label:d(12466,null),settings:["chat.disableAIFeatures","chat.allowAnonymousAccess"]}]},{id:"features",label:d(12477,null),children:[{id:"features/accessibilitySignals",label:d(12456,null),settings:["accessibility.signal*"]},{id:"features/accessibility",label:d(12455,null),settings:["accessibility.*"]},{id:"features/explorer",label:d(12478,null),settings:["explorer.*","outline.*"]},{id:"features/search",label:d(12498,null),settings:["search.*"]},{id:"features/debug",label:d(12472,null),settings:["debug.*","launch"]},{id:"features/testing",label:d(12506,null),settings:["testing.*"]},{id:"features/scm",label:d(12496,null),settings:["scm.*"]},{id:"features/extensions",label:d(12476,null),settings:["extensions.*"]},{id:"features/terminal",label:d(12505,null),settings:["terminal.*"]},{id:"features/task",label:d(12503,null),settings:["task.*"]},{id:"features/problems",label:d(12493,null),settings:["problems.*"]},{id:"features/output",label:d(12492,null),settings:["output.*"]},{id:"features/comments",label:d(12469,null),settings:["comments.*"]},{id:"features/remote",label:d(12495,null),settings:["remote.*"]},{id:"features/timeline",label:d(12508,null),settings:["timeline.*"]},{id:"features/notebook",label:d(12490,null),settings:["notebook.*","interactiveWindow.*"]},{id:"features/mergeEditor",label:d(12485,null),settings:["mergeEditor.*"]},{id:"features/issueReporter",label:d(12483,null),settings:["issueReporter.*"],hide:!Gt}]},{id:"application",label:d(12458,null),children:[{id:"application/http",label:d(12494,null),settings:["http.*"]},{id:"application/keyboard",label:d(12484,null),settings:["keyboard.*"]},{id:"application/update",label:d(12509,null),settings:["update.*"]},{id:"application/telemetry",label:d(12504,null),settings:["telemetry.*"]},{id:"application/settingsSync",label:d(12501,null),settings:["settingsSync.*"]},{id:"application/network",label:d(12488,null),settings:["network.*"]},{id:"application/experimental",label:d(12475,null),settings:["application.experimental.*"]},{id:"application/other",label:d(12491,null),settings:["application.*"],hide:ri}]},{id:"security",label:d(12499,null),settings:["security.*"],children:[{id:"security/workspace",label:d(12512,null),settings:["security.workspace.*"]}]}]};var PLe=class extends wp{constructor(e,t,o,n,r){super(e,{getActions:()=>this.getActions()},r,{...t,actionRunner:o,classNames:e.class,anchorAlignmentProvider:()=>1,menuAsChild:!0});this.searchWidget=n;this.suggestController=El.get(this.searchWidget.inputWidget)}render(e){super.render(e)}doSearchWidgetAction(e,t){this.searchWidget.setValue(this.searchWidget.getValue().trimEnd()+" "+e),this.searchWidget.focus(),t&&this.suggestController&&this.suggestController.triggerSuggest()}createAction(e,t,o,n,r){return{id:e,label:t,tooltip:o,class:void 0,enabled:!0,run:()=>{this.doSearchWidgetAction(n,r)}}}createToggleAction(e,t,o,n){let s=this.searchWidget.getValue().split(" ").includes(n);return{id:e,label:t,tooltip:o,class:void 0,enabled:!0,checked:s,run:()=>{if(s){let l=this.searchWidget.getValue().split(" ").filter(c=>c!==n).join(" ");this.searchWidget.setValue(l)}else{let l=this.searchWidget.getValue().trimEnd(),c=l?l+" "+n:n;this.searchWidget.setValue(c)}this.searchWidget.focus()}}}createMutuallyExclusiveToggleAction(e,t,o,n,r){let s=this.searchWidget.getValue().split(" ").includes(n);return{id:e,label:t,tooltip:o,class:void 0,enabled:!0,checked:s,run:()=>{if(s){let l=this.searchWidget.getValue().split(" ").filter(c=>c!==n).join(" ");this.searchWidget.setValue(l)}else{let l=this.searchWidget.getValue().split(" ").filter(c=>!r.includes(c)&&c!==n).join(" ").trimEnd();l=l?l+" "+n:n,this.searchWidget.setValue(l)}this.searchWidget.focus()}}}getActions(){return[this.createToggleAction("modifiedSettingsSearch",d(12526,null),d(12527,null),`@${NK}`),new li,this.createAction("extSettingsSearch",d(12518,null),d(12519,null),`@${SLe}`,!0),this.createAction("featuresSettingsSearch",d(12520,null),d(12521,null),`@${hk}`,!0),this.createAction("tagSettingsSearch",d(12536,null),d(12537,null),`@${wso}`,!0),this.createAction("langSettingsSearch",d(12524,null),d(12525,null),`@${PF}`,!0),this.createAction("idSettingsSearch",d(12522,null),d(12523,null),`@${dJe}`,!1),new li,this.createToggleAction("onlineSettingsSearch",d(12528,null),d(12529,null),"@tag:usesOnlineServices"),this.createToggleAction("policySettingsSearch",d(12530,null),d(12531,null),`@${uB}`),new li,this.createMutuallyExclusiveToggleAction("stableSettingsSearch",d(12534,null),d(12535,null),"@stable",["@tag:preview","@tag:experimental"]),this.createMutuallyExclusiveToggleAction("previewSettingsSearch",d(12532,null),d(12533,null),"@tag:preview",["@stable","@tag:experimental"]),this.createMutuallyExclusiveToggleAction("experimentalSettingsSearch",d(12516,null),d(12517,null),"@tag:experimental",["@stable","@tag:preview"]),new li,this.createToggleAction("advancedSettingsSearch",d(12514,null),d(12515,null),`@tag:${I4}`)]}};PLe=I([m(4,ze)],PLe);var pB=_,Yso=new Set,PIi=[],gpe=class{constructor(i,e,t,o,n,r){this.configurationService=e;this.hoverService=t;this.userDataSyncEnablementService=o;this.languageService=n;this.commandService=r;this.isolatedIndicators=[];this.keybindingListeners=new P;this.focusedIndex=0;this.defaultHoverOptions={trapFocus:!0,style:1,position:{hoverPosition:2}};this.indicatorsContainerElement=R(i,pB(".setting-indicators-container")),this.indicatorsContainerElement.style.display="inline",this.previewIndicator=this.createPreviewIndicator(),this.advancedIndicator=this.createAdvancedIndicator(),this.isolatedIndicators=[this.previewIndicator,this.advancedIndicator],this.workspaceTrustIndicator=this.createWorkspaceTrustIndicator(),this.scopeOverridesIndicator=this.createScopeOverridesIndicator(),this.syncIgnoredIndicator=this.createSyncIgnoredIndicator(),this.defaultOverrideIndicator=this.createDefaultOverrideIndicator(),this.parenthesizedIndicators=[this.workspaceTrustIndicator,this.scopeOverridesIndicator,this.syncIgnoredIndicator,this.defaultOverrideIndicator]}addHoverDisposables(i,e,t){i.clear();let o=i.add(new Dt(()=>{let n=t(!1);n&&i.add(n)},this.configurationService.getValue("workbench.hover.delay")));i.add(j(e,re.MOUSE_OVER,()=>{o.isScheduled()||o.schedule()})),i.add(j(e,re.MOUSE_LEAVE,()=>{o.cancel()})),i.add(j(e,re.KEY_DOWN,n=>{let r=new Ii(n);if(r.equals(10)||r.equals(3)){let s=t(!0);s&&i.add(s),n.preventDefault()}}))}createWorkspaceTrustIndicator(){let i=new P,e=pB("span.setting-indicator.setting-item-workspace-trust"),t=i.add(new BC(e));t.text="$(shield) "+d(12454,null);let o=d(12450,null),n=r=>this.hoverService.showInstantHover({...this.defaultHoverOptions,content:o,target:e,actions:[{label:d(12436,null),commandId:"workbench.trust.manage",run:s=>{this.commandService.executeCommand("workbench.trust.manage")}}]},r);return this.addHoverDisposables(i,e,n),{element:e,label:t,disposables:i}}createScopeOverridesIndicator(){let i=new P,e=pB("span.setting-item-overrides"),t=i.add(new BC(e));return{element:e,label:t,disposables:i}}createSyncIgnoredIndicator(){let i=new P,e=pB("span.setting-indicator.setting-item-ignored"),t=i.add(new BC(e));t.text=d(12434,null);let o=d(12449,null),n=r=>this.hoverService.showInstantHover({...this.defaultHoverOptions,content:o,target:e},r);return this.addHoverDisposables(i,e,n),{element:e,label:t,disposables:i}}createDefaultOverrideIndicator(){let i=new P,e=pB("span.setting-indicator.setting-item-default-overridden"),t=i.add(new BC(e));return t.text=d(12431,null),{element:e,label:t,disposables:i}}createPreviewIndicator(){let i=new P,e=pB("span.setting-indicator.setting-item-preview"),t=i.add(new BC(e));return{element:e,label:t,disposables:i}}createAdvancedIndicator(){let i=new P,e=pB("span.setting-indicator.setting-item-preview"),t=i.add(new BC(e));t.text=d(12420,null);let o=n=>this.hoverService.showInstantHover({...this.defaultHoverOptions,content:kso,target:e},n);return this.addHoverDisposables(i,e,o),{element:e,label:t,disposables:i}}render(){this.indicatorsContainerElement.innerText="",this.indicatorsContainerElement.style.display="none";let i=this.isolatedIndicators.filter(t=>t.element.style.display!=="none");if(i.length){this.indicatorsContainerElement.style.display="inline";for(let t=0;t<i.length;t++)R(this.indicatorsContainerElement,i[t].element)}let e=this.parenthesizedIndicators.filter(t=>t.element.style.display!=="none");if(e.length){this.indicatorsContainerElement.style.display="inline",R(this.indicatorsContainerElement,pB("span",void 0,"("));for(let t=0;t<e.length-1;t++)R(this.indicatorsContainerElement,e[t].element),R(this.indicatorsContainerElement,pB("span.comma",void 0," \u2022 "));R(this.indicatorsContainerElement,e[e.length-1].element),R(this.indicatorsContainerElement,pB("span",void 0,")"))}this.resetIndicatorNavigationKeyBindings([...i,...e])}resetIndicatorNavigationKeyBindings(i){if(this.keybindingListeners.clear(),this.indicatorsContainerElement.role=i.length>=1?"toolbar":"button",!i.length)return;let e=i[0].focusElement??i[0].element;e.tabIndex=0,this.keybindingListeners.add(j(this.indicatorsContainerElement,"keydown",t=>{let o=new Ii(t),n=!0;if(o.equals(14))this.focusIndicatorAt(i,0);else if(o.equals(13))this.focusIndicatorAt(i,i.length-1);else if(o.equals(17)){let r=(this.focusedIndex+1)%i.length;this.focusIndicatorAt(i,r)}else if(o.equals(15)){let r=this.focusedIndex?this.focusedIndex-1:i.length-1;this.focusIndicatorAt(i,r)}else n=!1;n&&(t.preventDefault(),t.stopPropagation())}))}focusIndicatorAt(i,e){if(e===this.focusedIndex)return;let t=i[e],o=t.focusElement??t.element;o.tabIndex=0,o.focus();let n=i[this.focusedIndex],r=n.focusElement??n.element;r.tabIndex=-1,this.focusedIndex=e}updateWorkspaceTrust(i){this.workspaceTrustIndicator.element.style.display=i.isUntrusted?"inline":"none",this.render()}updateSyncIgnored(i,e){this.syncIgnoredIndicator.element.style.display=this.userDataSyncEnablementService.isEnabled()&&e.includes(i.setting.key)?"inline":"none",this.render(),PIi!==e&&(PIi=e,Yso=new Set(PIi))}updatePreviewIndicator(i){let e=i.tags?.has("preview"),t=i.tags?.has("experimental");this.previewIndicator.element.style.display=e||t?"inline":"none",this.previewIndicator.label.text=e?d(12446,null):d(12433,null);let o=e?U0t:z0t,n=r=>this.hoverService.showInstantHover({...this.defaultHoverOptions,content:o,target:this.previewIndicator.element},r);this.addHoverDisposables(this.previewIndicator.disposables,this.previewIndicator.element,n),this.render()}updateAdvancedIndicator(i){let e=i.tags?.has("advanced");this.advancedIndicator.element.style.display=e?"inline":"none",this.render()}getInlineScopeDisplayText(i){let[e,t]=i.split(":"),o=e==="user"?d(12451,null):e==="workspace"?d(12452,null):d(12447,null);return t?`${this.languageService.getLanguageName(t)} > ${o}`:o}dispose(){this.keybindingListeners.dispose();for(let i of this.isolatedIndicators)i.disposables.dispose();for(let i of this.parenthesizedIndicators)i.disposables.dispose()}updateScopeOverrides(i,e,t){if(this.scopeOverridesIndicator.disposables.clear(),this.scopeOverridesIndicator.element.innerText="",this.scopeOverridesIndicator.element.style.display="none",this.scopeOverridesIndicator.focusElement=this.scopeOverridesIndicator.element,i.hasPolicyValue){this.scopeOverridesIndicator.element.style.display="inline",this.scopeOverridesIndicator.element.classList.add("setting-indicator"),this.scopeOverridesIndicator.label.text="$(briefcase) "+d(12445,null);let o=d(12442,null),n=r=>this.hoverService.showInstantHover({...this.defaultHoverOptions,content:o,actions:[{label:d(12444,null),commandId:"_settings.action.viewPolicySettings",run:s=>{t.fire(`@${uB}`)}}],target:this.scopeOverridesIndicator.element},r);this.addHoverDisposables(this.scopeOverridesIndicator.disposables,this.scopeOverridesIndicator.element,n)}else if(i.settingsTarget===3&&this.configurationService.isSettingAppliedForAllProfiles(i.setting.key)){this.scopeOverridesIndicator.element.style.display="inline",this.scopeOverridesIndicator.element.classList.add("setting-indicator"),this.scopeOverridesIndicator.label.text=d(12424,null);let o=d(12425,null),n=r=>this.hoverService.showInstantHover({...this.defaultHoverOptions,content:o,target:this.scopeOverridesIndicator.element},r);this.addHoverDisposables(this.scopeOverridesIndicator.disposables,this.scopeOverridesIndicator.element,n)}else if(i.overriddenScopeList.length||i.overriddenDefaultsLanguageList.length)if(i.overriddenScopeList.length===1&&!i.overriddenDefaultsLanguageList.length){this.scopeOverridesIndicator.element.style.display="inline",this.scopeOverridesIndicator.element.classList.remove("setting-indicator");let o=i.isConfigured?d(12422,null):d(12428,null);this.scopeOverridesIndicator.label.text=`${o} `;let n=i.overriddenScopeList[0],r=R(this.scopeOverridesIndicator.element,pB("a.modified-scope",void 0,this.getInlineScopeDisplayText(n)));r.tabIndex=-1,this.scopeOverridesIndicator.focusElement=r;let s=l=>{let[c,u]=n.split(":");e.fire({settingKey:i.setting.key,scope:c,language:u}),l.preventDefault(),l.stopPropagation()};this.scopeOverridesIndicator.disposables.add(j(r,re.CLICK,l=>{s(l)})),this.scopeOverridesIndicator.disposables.add(j(r,re.KEY_DOWN,l=>{let c=new Ii(l);(c.equals(10)||c.equals(3))&&s(l)}))}else{this.scopeOverridesIndicator.element.style.display="inline",this.scopeOverridesIndicator.element.classList.add("setting-indicator");let o=i.isConfigured?d(12421,null):d(12427,null);this.scopeOverridesIndicator.label.text=o;let n="";if(i.overriddenScopeList.length){n=i.isConfigured?d(12423,null):d(12439,null);for(let l of i.overriddenScopeList){let c=this.getInlineScopeDisplayText(l);n+=`
- `+oSt(c,Y0t.create(l).toString(),U4o(l,this.languageService))}}if(i.overriddenDefaultsLanguageList.length){n&&(n+=`
`);let s=d(12435,null);n+=s;for(let l of i.overriddenDefaultsLanguageList){let c=this.languageService.getLanguageName(l);n+=`
- `+oSt(c??l,Y0t.create(`default:${l}`).toString())}}let r={value:n,isTrusted:!1,supportHtml:!1};this.scopeOverridesIndicator.disposables.add(this.hoverService.setupDelayedHover(this.scopeOverridesIndicator.element,()=>({...this.defaultHoverOptions,content:r,linkHandler:s=>{let[l,c]=Y0t.parse(s).split(":");e.fire({settingKey:i.setting.key,scope:l,language:c})}}),{setupKeyboardEvents:!0}))}this.render()}updateDefaultOverrideIndicator(i){this.defaultOverrideIndicator.element.style.display="none";let e=Xso(i);if(e!==void 0){this.defaultOverrideIndicator.element.style.display="inline",this.defaultOverrideIndicator.disposables.clear(),Array.isArray(e)&&e.length===1&&(e=e[0]);let t;Array.isArray(e)?(e=e.map(n=>`\`${n}\``),t=d(12440,null,e.slice(0,-1).join(", ")+" & "+e.slice(-1))):t=d(12429,null,e);let o=n=>this.hoverService.showInstantHover({content:new xe().appendMarkdown(t),target:this.defaultOverrideIndicator.element,style:1,position:{hoverPosition:2}},n);this.addHoverDisposables(this.defaultOverrideIndicator.disposables,this.defaultOverrideIndicator.element,o)}this.render()}};gpe=I([m(1,Lv),m(2,tt),m(3,_l),m(4,kt),m(5,ge)],gpe);function Xso(a){let i,e=a.defaultValueSource;if(e)if(e instanceof Map){i=[];for(let[,t]of e){let o=typeof t!="string"?t.displayName??t.id:t;i.includes(o)||i.push(o)}}else typeof e=="string"?i=e:i=e.displayName??e.id;return i}function U4o(a,i){let[e,t]=a.split(":"),o=e==="user"?d(12451,null):e==="workspace"?d(12452,null):d(12447,null);return t?d(12437,null,o,i.getLanguageName(t)):o}function z4o(a,i){let[e,t]=a.split(":"),o=e==="user"?d(12451,null):e==="workspace"?d(12452,null):d(12447,null);return t?d(12438,null,o.toLowerCase(),i.getLanguageName(t)):o}function Jso(a,i,e,t){let o=[];if(a.tags?.has("preview")?o.push(d(12446,null)):a.tags?.has("experimental")&&o.push(d(12433,null)),a.tags?.has("advanced")&&o.push(d(12420,null)),a.isUntrusted&&o.push(d(12453,null)),a.hasPolicyValue)o.push(d(12443,null));else if(a.settingsTarget===3&&i.isSettingAppliedForAllProfiles(a.setting.key))o.push(d(12426,null));else{let l=a.isConfigured?d(12422,null):d(12428,null),c=a.overriddenScopeList.map(u=>z4o(u,t)).join(", ");a.overriddenScopeList.length&&o.push(`${l} ${c}`)}Yso.has(a.setting.key)&&o.push(d(12448,null));let n=Xso(a);if(n!==void 0){Array.isArray(n)&&n.length===1&&(n=n[0]);let l;Array.isArray(n)?l=d(12441,null,n.slice(0,-1).join(", ")+" & "+n.slice(-1)):l=d(12430,null,n),o.push(l)}let r=a.overriddenDefaultsLanguageList.map(l=>t.getLanguageName(l)).join(", ");if(a.overriddenDefaultsLanguageList.length){let l=d(12432,null,r);o.push(l)}return o.join(". ")}var Y0t;(e=>{function a(t){return A.from({scheme:Y.internal,path:"/",query:encodeURIComponent(t)})}e.create=a;function i(t){let o=A.parse(t);return decodeURIComponent(o.query)}e.parse=i})(Y0t||={});var EJe=class extends C{constructor(e){super();this._tabbable=!1;this._onDidChangeTabbable=this._register(new E);this.id=e}get onDidChangeTabbable(){return this._onDidChangeTabbable.event}get tabbable(){return this._tabbable}set tabbable(e){this._tabbable=e,this._onDidChangeTabbable.fire()}},Gf=class extends EJe{constructor(e,t,o,n,r){super(e);this._childSettingKeys=new Set;this._children=[];this.count=t,this.label=o,this.level=n,this.isFirstGroup=r}get children(){return this._children}set children(e){this._children=e,this._childSettingKeys=new Set,this._children.forEach(t=>{t instanceof vw&&this._childSettingKeys.add(t.setting.key)})}containsSetting(e){return this._childSettingKeys.has(e)}},ALe=class extends EJe{constructor(e,t){super(e);this.extensionIds=t}},vw=class a extends EJe{constructor(e,t,o,n,r,s,l,c,u){super(K4o(t.id+"_"+e.key));this.settingsTarget=o;this.isWorkspaceTrusted=n;this.languageFilter=r;this.languageService=s;this.productService=l;this.userDataProfileService=c;this.configurationService=u;this._displayCategory=null;this._displayLabel=null;this.isConfigured=!1;this.isUntrusted=!1;this.hasPolicyValue=!1;this.overriddenScopeList=[];this.overriddenDefaultsLanguageList=[];this.languageOverrideValues=new Map;this.setting=e,this.parent=t,this.initSettingDescription(),this.initSettingValueType()}static{this.MAX_DESC_LINES=20}get displayCategory(){return this._displayCategory||this.initLabels(),this._displayCategory}get displayLabel(){return this._displayLabel||this.initLabels(),this._displayLabel}initLabels(){if(this.setting.title){this._displayLabel=this.setting.title,this._displayCategory=this.setting.categoryLabel??null;return}let e=w4(this.setting.key,this.parent.id,this.setting.isLanguageTagSetting);this._displayLabel=e.label,this._displayCategory=e.category}initSettingDescription(){if(this.setting.description.length>a.MAX_DESC_LINES){let e=this.setting.description.slice(0,a.MAX_DESC_LINES);e.push("[...]"),this.description=e.join(`
`)}else this.description=this.setting.description.join(`
`)}initSettingValueType(){if($4o(this.setting,this.productService))this.valueType="extension-toggle";else if(this.setting.enum&&(!this.setting.type||X4o(this.setting.type)))this.valueType="enum";else if(this.setting.type==="string")this.setting.editPresentation==="multilineText"?this.valueType="multiline-string":this.valueType="string";else if(q4o(this.setting))this.valueType="exclude";else if(j4o(this.setting))this.valueType="include";else if(this.setting.type==="integer")this.valueType="integer";else if(this.setting.type==="number")this.valueType="number";else if(this.setting.type==="boolean")this.valueType="boolean";else if(this.setting.type==="array"&&this.setting.arrayItemType&&["string","enum","number","integer"].includes(this.setting.arrayItemType))this.valueType="array";else if(Array.isArray(this.setting.type)&&this.setting.type.includes("null")&&this.setting.type.length===2)this.setting.type.includes("integer")?this.valueType="nullable-integer":this.setting.type.includes("number")?this.valueType="nullable-number":this.valueType="complex";else{let e=Y4o(this.setting);e?this.setting.allKeysAreBoolean?this.valueType="boolean-object":e==="simple"?this.valueType="object":this.valueType="complex-object":this.setting.isLanguageTagSetting?this.valueType="language-tag":this.valueType="complex"}}inspectSelf(){let e=this.getTargetToInspect(this.setting),t=AIi(this.setting.key,e,this.languageFilter,this.configurationService);this.update(t,this.isWorkspaceTrusted)}getTargetToInspect(e){if(!this.userDataProfileService.currentProfile.isDefault&&!this.userDataProfileService.currentProfile.useDefaultFlags?.settings){if(e.scope===1)return 1;if(this.configurationService.isSettingAppliedForAllProfiles(e.key)&&this.settingsTarget===3)return 1}return this.settingsTarget}update(e,t){let{isConfigured:o,inspected:n,targetSelector:r,inspectedLanguageOverrides:s,languageSelector:l}=e;switch(r){case"workspaceFolderValue":case"workspaceValue":this.isUntrusted=!!this.setting.restricted&&!t;break}let c=o?n[r]:n.defaultValue,u=[],p=[];if((l||r!=="workspaceValue")&&typeof n.workspaceValue<"u"&&u.push("workspace:"),(l||r!=="userRemoteValue")&&typeof n.userRemoteValue<"u"&&u.push("remote:"),(l||r!=="userLocalValue")&&typeof n.userLocalValue<"u"&&u.push("user:"),n.overrideIdentifiers)for(let h of n.overrideIdentifiers){let g=s.get(h);g&&(this.languageService.isRegisteredLanguageId(h)&&(l!==h&&typeof g.default?.override<"u"&&p.push(h),(l!==h||r!=="workspaceValue")&&typeof g.workspace?.override<"u"&&u.push(`workspace:${h}`),(l!==h||r!=="userRemoteValue")&&typeof g.userRemote?.override<"u"&&u.push(`remote:${h}`),(l!==h||r!=="userLocalValue")&&typeof g.userLocal?.override<"u"&&u.push(`user:${h}`)),this.languageOverrideValues.set(h,g))}if(this.overriddenScopeList=u,this.overriddenDefaultsLanguageList=p,this.defaultValueSource=this.setting.nonLanguageSpecificDefaultValueSource,n.policyValue!==void 0)this.hasPolicyValue=!0,o=!1,c=n.policyValue,this.scopeValue=n.policyValue,this.defaultValue=n.defaultValue;else if(l&&this.languageOverrideValues.has(l)){let h=this.languageOverrideValues.get(l);c=(o?h[r]:h.defaultValue)??c,this.scopeValue=o&&h[r],this.defaultValue=h.defaultValue??n.defaultValue;let f=oe.as(ii.Configuration).getConfigurationDefaultsOverrides().get(`[${l}]`)?.source,v=f instanceof Map?f.get(this.setting.key):void 0;v&&(this.defaultValueSource=v)}else this.scopeValue=o&&n[r],this.defaultValue=n.defaultValue;this.value=c,this.isConfigured=o,(o||this.setting.tags||this.tags||this.setting.restricted||this.hasPolicyValue)&&(this.tags=new Set,o&&this.tags.add(NK),this.setting.tags?.forEach(h=>this.tags.add(h)),this.setting.restricted&&this.tags.add(ILe),this.hasPolicyValue&&this.tags.add(uB))}matchesAllTags(e){if(!e?.size)return!0;if(this.tags||this.inspectSelf(),e.has("stable")){if(this.tags?.has("preview")||this.tags?.has("experimental"))return!1;let t=new Set(Array.from(e).filter(o=>o!=="stable"));return t.size===0?!0:!!this.tags?.size&&Array.from(t).every(o=>this.tags.has(o))}return!!this.tags?.size&&Array.from(e).every(t=>this.tags.has(t))}matchesScope(e,t){let o=A.isUri(e)?6:e;return this.setting.scope?o===1?AC.includes(this.setting.scope):o===6?sJ.includes(this.setting.scope):o===5?a_e.includes(this.setting.scope):o===4?Sfi.includes(this.setting.scope)||vdi.includes(this.setting.key):o===3&&t?bfi.includes(this.setting.scope)||vdi.includes(this.setting.key):!0:!0}matchesAnyExtension(e){return!e||!e.size?!0:this.setting.extensionInfo?Array.from(e).some(t=>t.toLowerCase()===this.setting.extensionInfo.id.toLowerCase()):!1}matchesAnyFeature(e){if(!e||!e.size)return!0;if(this.setting.extensionInfo)return!1;if(e.has("chat")){let o=kJe.children.find(n=>n.id==="chat");if(o?.children&&o.children.flatMap(r=>r.settings??[]).map(r=>Zso(r)).some(r=>r.test(this.setting.key)))return!0}let t=kJe.children.find(o=>o.id==="features");return Array.from(e).some(o=>{if(t?.children){let n=t.children.find(r=>"features/"+o===r.id);return n?.settings?n.settings.map(s=>Zso(s)).some(s=>s.test(this.setting.key)):!1}else return!1})}matchesAnyId(e){if(!e||!e.size||e.has(this.setting.key))return!0;for(let t of e)if(t.endsWith("*")){let o=t.slice(0,-1);if(this.setting.key.startsWith(o))return!0}return!1}matchesAllLanguages(e){return e?this.languageService.isRegisteredLanguageId(e)?this.setting.scope===6:!1:!0}};function Zso(a){return a=Yr(a).replace(/\\\*/g,".*"),new RegExp(`^${a}$`,"i")}var fpe=class{constructor(i,e,t,o,n,r){this._viewState=i;this._isWorkspaceTrusted=e;this._configurationService=t;this._languageService=o;this._userDataProfileService=n;this._productService=r;this._treeElementsBySettingName=new Map}get root(){return this._root}update(i=this._tocRoot){this._treeElementsBySettingName.clear();let e=this.createSettingsTreeGroupElement(i);e.children[0]instanceof Gf&&(e.children[0].isFirstGroup=!0),this._root?(this.disposeChildren(this._root.children),this._root.children=e.children,e.dispose()):this._root=e}updateWorkspaceTrust(i){this._isWorkspaceTrusted=i,this.updateRequireTrustedTargetElements()}disposeChildren(i){for(let e of i)this.disposeChildAndRecurse(e)}disposeChildAndRecurse(i){i instanceof Gf&&this.disposeChildren(i.children),i.dispose()}getElementsByName(i){return this._treeElementsBySettingName.get(i)??null}updateElementsByName(i){this._treeElementsBySettingName.has(i)&&this.reinspectSettings(this._treeElementsBySettingName.get(i))}updateRequireTrustedTargetElements(){this.reinspectSettings([...this._treeElementsBySettingName.values()].flat().filter(i=>i.isUntrusted))}reinspectSettings(i){for(let e of i)e.inspectSelf()}createSettingsTreeGroupElement(i,e){let t=e?this.getDepth(e)+1:0,o=new Gf(i.id,void 0,i.label,t,!1);o.parent=e;let n=[];if(i.settings){let r=i.settings.map(s=>this.createSettingsTreeSettingElement(s,o));for(let s of r)s.setting.deprecationMessage?(s.inspectSelf(),s.isConfigured?n.push(s):s.dispose()):n.push(s)}if(i.children){let r=i.children.map(s=>this.createSettingsTreeGroupElement(s,o));n.push(...r)}return o.children=n,o}getDepth(i){return i.parent?1+this.getDepth(i.parent):0}createSettingsTreeSettingElement(i,e){let t=new vw(i,e,this._viewState.settingsTarget,this._isWorkspaceTrusted,this._viewState.languageFilter,this._languageService,this._productService,this._userDataProfileService,this._configurationService),o=this._treeElementsBySettingName.get(i.key)??[];return o.push(t),this._treeElementsBySettingName.set(i.key,o),t}dispose(){this._treeElementsBySettingName.clear(),this.disposeChildAndRecurse(this._root)}};fpe=I([m(2,Lv),m(3,kt),m(4,mn),m(5,nt)],fpe);function AIi(a,i,e,t){let o=A.isUri(i)?{resource:i}:void 0,n=t.inspect(a,o),r=i===1?"applicationValue":i===3?"userLocalValue":i===4?"userRemoteValue":i===5?"workspaceValue":"workspaceFolderValue",s=i===1?"application":i===3?"userLocal":i===4?"userRemote":i===5?"workspace":"workspaceFolder",l=typeof n[r]<"u",c=n.overrideIdentifiers,u=new Map;if(e&&(l=!1),c){for(let p of c)u.set(p,t.inspect(a,{overrideIdentifier:p}));e&&u.has(e)&&typeof u.get(e)[s]?.override<"u"&&(l=!0)}return{isConfigured:l,inspected:n,targetSelector:r,inspectedLanguageOverrides:u,languageSelector:e}}function K4o(a){return a.replace(/[\.\/]/,"_")}function w4(a,i="",e=!1){let t=a.lastIndexOf("."),o="";t>=0&&(o=a.substring(0,t),a=a.substring(t+1)),i=i.replace(/\//g,"."),o=G4o(o,i),o=CIi(o),e&&(a=gSe(a),a="$(bracket) "+a);let n=CIi(a);return{category:o,label:n}}function G4o(a,i){let e=o=>{/insiders$/i.test(a)||(i=i.replace(/-?insiders$/i,""));let n=i.split(".").map(r=>r.replace(/-/g,"").toLowerCase()===a.toLowerCase()?r.replace(/-/g,""):r);for(;n.length;){let r=new RegExp(`^${n.join("\\.")}(\\.|$)`,"i");if(r.test(a))return a.replace(r,"");o?n.pop():n.shift()}return null},t=e(!0);return t===null&&(t=e(!1)),t===null&&(t=a),t}function $4o(a,i){return yIi&&!!i.extensionRecommendations&&!!a.displayExtensionId}function q4o(a){return a.key==="files.exclude"||a.key==="search.exclude"||a.key==="workbench.localHistory.exclude"||a.key==="explorer.autoRevealExclude"||a.key==="files.readonlyExclude"||a.key==="files.watcherExclude"}function j4o(a){return a.key==="files.readonlyInclude"}function J0t(a){return a==="workbench.editor.customLabels.patterns"}function X0t(a){return a==="string"||a==="boolean"||a==="integer"||a==="number"}function Q4o(a,i){let{type:e}=a;if(Array.isArray(e)){if(J0t(i)&&e.length===2&&e.includes("null")&&(e.includes("string")||e.includes("boolean")||e.includes("integer")||e.includes("number")))return"simple";for(let t of e)if(!X0t(t))return!1;return"complex"}if(X0t(e))return"simple";if(e==="array"){if(a.items){let t=Array.isArray(a.items)?a.items:[a.items];for(let{type:o}of t){if(Array.isArray(o)){for(let n of o)if(!X0t(n))return!1;return"complex"}return X0t(o)?"complex":!1}}return!1}return!1}function Y4o({key:a,type:i,objectProperties:e,objectPatternProperties:t,objectAdditionalProperties:o}){if(i!=="object"||Jn(e)&&Jn(t)&&Jn(o)||(o===!0||o===void 0)&&!Object.keys(t??{}).includes(".*"))return!1;let n=[...Object.values(e??{}),...Object.values(t??{})];o&&typeof o=="object"&&n.push(o);let r="simple";for(let s of n)for(let l of Array.isArray(s.anyOf)?s.anyOf:[s]){let c=Q4o(l,a);if(c===!1)return!1;c==="complex"&&(r="complex")}return r}function X4o(a){let i=["string","boolean","null","integer","number"];return(Array.isArray(a)?a:[a]).every(t=>i.includes(t))}var vpe=class extends fpe{constructor(e,t,o,n,r,s,l,c){super(e,o,n,s,l,c);this.environmentService=r;this.rawSearchResults=null;this.newExtensionSearchResults=null;this.searchResultCount=null;this.aiFilterEnabled=!1;this.id="searchResultModel";this.settingsOrderByTocIndex=t,this.cachedUniqueSearchResults=new Map,this.update({id:"searchResultModel",label:""})}set showAiResults(e){this.aiFilterEnabled=e,this.updateChildren()}sortResults(e){if(this.settingsOrderByTocIndex)for(let t of e)t.setting.internalOrder=this.settingsOrderByTocIndex.get(t.setting.key);return this._viewState.query?(e.sort((t,o)=>t.matchType!==o.matchType?o.matchType-t.matchType:t.matchType&16||t.matchType&32?o.keyMatchScore-t.keyMatchScore||ape(t.setting.internalOrder,o.setting.internalOrder):t.matchType===2?o.score-t.score:ape(t.setting.internalOrder,o.setting.internalOrder)),Uo(e,t=>t.setting.key)):e.sort((t,o)=>ape(t.setting.internalOrder,o.setting.internalOrder))}getUniqueSearchResults(){let e=this.cachedUniqueSearchResults.get(this.aiFilterEnabled);if(e)return e;if(!this.rawSearchResults)return null;let t=[];if(this.aiFilterEnabled){let l=new Set,c=this.rawSearchResults[4];c&&(c.filterMatches.forEach(h=>l.add(h.setting.key)),t=c.filterMatches);let u=this.rawSearchResults[3];u&&(u.filterMatches=u.filterMatches.filter(h=>!l.has(h.setting.key)),t=t.concat(u.filterMatches));let p={filterMatches:t,exactMatch:!1};return this.cachedUniqueSearchResults.set(!0,p),p}let o=new Set,n=this.rawSearchResults[0];n&&(n.filterMatches.forEach(l=>o.add(l.setting.key)),t=n.filterMatches);let r=this.rawSearchResults[1];r&&(r.filterMatches=r.filterMatches.filter(l=>!o.has(l.setting.key)),t=t.concat(r.filterMatches),this.newExtensionSearchResults=this.rawSearchResults[2]),t=this.sortResults(t);let s={filterMatches:t,exactMatch:n.exactMatch};return this.cachedUniqueSearchResults.set(!1,s),s}getRawResults(){return this.rawSearchResults??[]}getUniqueSearchResultSettings(){return this.getUniqueSearchResults()?.filterMatches.map(e=>e.setting)??[]}updateChildren(){this.update({id:"searchResultModel",label:"searchResultModel",settings:this.getUniqueSearchResultSettings()});let e=!!this.environmentService.remoteAuthority,t=[];for(let o of this.root.children)o instanceof vw&&o.matchesAllTags(this._viewState.tagFilters)&&o.matchesScope(this._viewState.settingsTarget,e)&&o.matchesAnyExtension(this._viewState.extensionFilters)&&o.matchesAnyId(this._viewState.idFilters)&&o.matchesAnyFeature(this._viewState.featureFilters)&&o.matchesAllLanguages(this._viewState.languageFilter)?t.push(o):o.dispose();if(this.root.children=t,this.searchResultCount=this.root.children.length,this.newExtensionSearchResults?.filterMatches.length){let o=this.newExtensionSearchResults.filterMatches.map(n=>n.setting).filter(n=>n.extensionName&&n.extensionPublisher).map(n=>`${n.extensionPublisher}.${n.extensionName}`);if(o=Uo(o),o.length){let n=new ALe("newExtensions",o);n.parent=this._root,this._root.children.push(n)}}}setResult(e,t){if(this.cachedUniqueSearchResults.clear(),this.newExtensionSearchResults=null,this.rawSearchResults&&e===0&&delete this.rawSearchResults[1],this.rawSearchResults??=[],!t){delete this.rawSearchResults[e];return}this.rawSearchResults[e]=t,this.updateChildren()}getUniqueResultsCount(){return this.searchResultCount??0}};vpe=I([m(3,Lv),m(4,Vt),m(5,kt),m(6,mn),m(7,nt)],vpe);var J4o=/(^|\s)@tag:("([^"]*)"|[^"]\S*)/g,Z4o=/(^|\s)@ext:("([^"]*)"|[^"]\S*)?/g,e3o=/(^|\s)@feature:("([^"]*)"|[^"]\S*)?/g,t3o=/(^|\s)@id:("([^"]*)"|[^"]\S*)?/g,i3o=/(^|\s)@lang:("([^"]*)"|[^"]\S*)?/g;function Z0t(a){function i(s,l,c){return s.replace(l,(u,p,h,g)=>{let f=g||h;return f&&c.push(...f.split(",").map(v=>v.trim()).filter(v=>!Jl(v))),""})}let e=[];a=a.replace(J4o,(s,l,c,u)=>(e.push(u||c),"")),a=a.replace(`@${NK}`,()=>(e.push(NK),"")),a=a.replace(`@${uB}`,()=>(e.push(uB),"")),a=a.replace(/@stable/g,()=>(e.push("stable"),""));let t=[],o=[],n=[],r=[];return a=i(a,Z4o,t),a=i(a,e3o,o),a=i(a,t3o,n),F0t&&(a=i(a,i3o,r)),a=a.trim(),{tags:e,extensionFilters:t,featureFilters:o,idFilters:n,languageFilter:r.length?r[0]:void 0,query:a}}var xb=_,NIi=class{constructor(i){this._dataItems=[];this._editKey=null;this._selectedIdx=null;this._newDataItem=i}get items(){let i=this._dataItems.map((e,t)=>{let o=typeof this._editKey=="number"&&this._editKey===t;return{...e,editing:o,selected:t===this._selectedIdx||o}});return this._editKey==="create"&&i.push({editing:!0,selected:!0,...this._newDataItem}),i}setEditKey(i){this._editKey=i}setValue(i){this._dataItems=i}select(i){this._selectedIdx=i}getSelected(){return this._selectedIdx}selectNext(){typeof this._selectedIdx=="number"?this._selectedIdx=Math.min(this._selectedIdx+1,this._dataItems.length-1):this._selectedIdx=0}selectPrevious(){typeof this._selectedIdx=="number"?this._selectedIdx=Math.max(this._selectedIdx-1,0):this._selectedIdx=0}},bpe=class extends C{constructor(e,t,o,n){super();this.container=e;this.themeService=t;this.contextViewService=o;this.configurationService=n;this.rowElements=[];this._onDidChangeList=this._register(new E);this.model=new NIi(this.getEmptyItem());this.listDisposables=this._register(new P);this.onDidChangeList=this._onDidChangeList.event;this.listElement=R(e,xb("div")),this.listElement.setAttribute("role","list"),this.getContainerClasses().forEach(r=>this.listElement.classList.add(r)),R(e,this.renderAddButton()),this.renderList(),this._register(j(this.listElement,re.POINTER_DOWN,r=>this.onListClick(r))),this._register(j(this.listElement,re.DBLCLICK,r=>this.onListDoubleClick(r))),this._register(Vo(this.listElement,"keydown",r=>{if(r.equals(16))this.selectPreviousRow();else if(r.equals(18))this.selectNextRow();else return;r.preventDefault(),r.stopPropagation()}))}get domNode(){return this.listElement}get items(){return this.model.items}get isReadOnly(){return!1}setValue(e){this.model.setValue(e),this.renderList()}renderHeader(){}isAddButtonVisible(){return!0}renderList(){let e=ts(this.listElement);Rt(this.listElement),this.listDisposables.clear();let t=this.model.items.some(n=>!!(n.editing&&this.isItemNew(n)));this.container.classList.toggle("setting-list-hide-add-button",!this.isAddButtonVisible()||t),this.model.items.length?this.listElement.tabIndex=0:this.listElement.removeAttribute("tabIndex");let o=this.renderHeader();o&&this.listElement.appendChild(o),this.rowElements=this.model.items.map((n,r)=>this.renderDataOrEditItem(n,r,e)),this.rowElements.forEach(n=>this.listElement.appendChild(n))}createBasicSelectBox(e){let t=e.options.map(({value:s,description:l})=>({text:s,description:l})),o=e.options.findIndex(s=>e.data===s.value),n=MSt({selectBackground:K0t,selectForeground:G0t,selectBorder:$0t,selectListBorder:q0t});return new aE(t,o,this.contextViewService,n,{useCustomDrawn:!HS(this.configurationService)||!(Nc&&og.pointerEvents)})}editSetting(e){this.model.setEditKey(e),this.renderList()}cancelEdit(){this.model.setEditKey("none"),this.renderList()}handleItemChange(e,t,o){this.model.setEditKey("none"),this.isItemNew(e)?this._onDidChangeList.fire({type:"add",newItem:t,targetIndex:o}):this._onDidChangeList.fire({type:"change",originalItem:e,newItem:t,targetIndex:o}),this.renderList()}renderDataOrEditItem(e,t,o){let n=e.editing?this.renderEdit(e,t):this.renderDataItem(e,t,o);return n.setAttribute("role","listitem"),n}renderDataItem(e,t,o){let n=this.renderItem(e,t),r=n.rowElement;r.setAttribute("data-index",t+""),r.setAttribute("tabindex",e.selected?"0":"-1"),r.classList.toggle("selected",e.selected);let s=new ji(r);return this.listDisposables.add(s),s.push(this.getActionsForItem(e,t),{icon:!0,label:!0}),this.addTooltipsToRow(n,e),e.selected&&o&&nn(()=>r.focus(),void 0,this.listDisposables),this.listDisposables.add(j(r,"click",l=>{l.stopPropagation()})),r}renderAddButton(){let e=xb(".setting-list-new-row"),t=this._register(new Mi(e,Ko));return t.label=this.getLocalizedStrings().addButtonLabel,t.element.classList.add("setting-list-addButton"),this._register(t.onDidClick(()=>{this.model.setEditKey("create"),this.renderList()})),e}onListClick(e){let t=this.getClickedItemIndex(e);t<0||(e.preventDefault(),e.stopImmediatePropagation(),this.model.getSelected()!==t&&this.selectRow(t))}onListDoubleClick(e){let t=this.getClickedItemIndex(e);if(t<0||this.isReadOnly)return;this.model.items[t]&&(this.editSetting(t),e.preventDefault(),e.stopPropagation())}getClickedItemIndex(e){if(!e.target||Nh(e.target,"monaco-action-bar"))return-1;let o=Nh(e.target,"setting-list-row");if(!o)return-1;let n=o.getAttribute("data-index");return n?parseInt(n):-1}selectRow(e){this.model.select(e),this.rowElements.forEach(o=>o.classList.remove("selected"));let t=this.rowElements[this.model.getSelected()];t.classList.add("selected"),t.focus()}selectNextRow(){this.model.selectNext(),this.selectRow(this.model.getSelected())}selectPreviousRow(){this.model.selectPrevious(),this.selectRow(this.model.getSelected())}};bpe=I([m(1,De),m(2,_n),m(3,B)],bpe);var dZ=class extends bpe{constructor(e,t,o,n,r){super(e,t,o,r);this.hoverService=n;this.showAddButton=!0;this.isEditable=!0}setValue(e,t){this.keyValueSuggester=t?.keySuggester,this.isEditable=t?.isReadOnly===void 0?!0:!t.isReadOnly,this.showAddButton=this.isEditable?t?.showAddButton??!0:!1,super.setValue(e)}getEmptyItem(){return{value:{type:"string",data:""}}}isAddButtonVisible(){return this.showAddButton}getContainerClasses(){return["setting-list-widget"]}getActionsForItem(e,t){return this.isReadOnly?[]:[{class:q.asClassName(cpe),enabled:!0,id:"workbench.action.editListItem",tooltip:this.getLocalizedStrings().editActionTooltip,run:()=>this.editSetting(t)},{class:q.asClassName(xIi),enabled:!0,id:"workbench.action.removeListItem",tooltip:this.getLocalizedStrings().deleteActionTooltip,run:()=>this._onDidChangeList.fire({type:"remove",originalItem:e,targetIndex:t})}]}renderItem(e,t){let o=xb(".setting-list-row"),n=R(o,xb(".setting-list-value")),r=R(o,xb(".setting-list-sibling"));return n.textContent=e.value.data.toString(),e.sibling?r.textContent=`when: ${e.sibling}`:(r.textContent=null,n.classList.add("no-sibling")),this.addDragAndDrop(o,e,t),{rowElement:o,keyElement:n,valueElement:r}}addDragAndDrop(e,t,o){this.model.items.every(r=>!r.editing)?(e.draggable=!0,e.classList.add("draggable")):(e.draggable=!1,e.classList.remove("draggable")),this.listDisposables.add(j(e,re.DRAG_START,r=>{this.dragDetails={element:e,item:t,itemIndex:o},$N(r,e,t.value.data)})),this.listDisposables.add(j(e,re.DRAG_OVER,r=>this.dragDetails?(r.preventDefault(),r.dataTransfer&&(r.dataTransfer.dropEffect="move"),!0):!1));let n=0;this.listDisposables.add(j(e,re.DRAG_ENTER,r=>{n++,e.classList.add("drag-hover")})),this.listDisposables.add(j(e,re.DRAG_LEAVE,r=>{n--,n||e.classList.remove("drag-hover")})),this.listDisposables.add(j(e,re.DROP,r=>this.dragDetails?(r.preventDefault(),n=0,this.dragDetails.element!==e&&this._onDidChangeList.fire({type:"move",originalItem:this.dragDetails.item,sourceIndex:this.dragDetails.itemIndex,newItem:t,targetIndex:o}),!0):!1)),this.listDisposables.add(j(e,re.DRAG_END,r=>{n=0,e.classList.remove("drag-hover"),r.dataTransfer?.clearData(),this.dragDetails&&(this.dragDetails=void 0)}))}renderEdit(e,t){let o=xb(".setting-list-edit-row"),n,r,s;if(this.keyValueSuggester){let f=this.keyValueSuggester(this.model.items.map(({value:{data:v}})=>v),t);e={...e,value:{type:"enum",data:e.value.data,options:f?f.options:[]}}}switch(e.value.type){case"string":n=this.renderInputBox(e.value,o);break;case"enum":n=this.renderDropdown(e.value,o),s=e.value.options,e.value.options.length&&(r=this.isItemNew(e)?s[0].value:e.value.data);break}let l=()=>({value:{type:"string",data:n.value},sibling:p?.value}),c=f=>({value:{type:"enum",data:f,options:s??[]}}),u=f=>{f.equals(3)?this.handleItemChange(e,l(),t):f.equals(9)&&(this.cancelEdit(),f.preventDefault(),f.stopPropagation()),o?.focus()};if(e.value.type!=="string"){let f=n;this.listDisposables.add(f.onDidSelect(({selected:v})=>{r=v}))}else{let f=n;this.listDisposables.add(Vo(f.inputElement,re.KEY_DOWN,u))}let p;Jn(e.sibling)?n instanceof Dc&&n.element.classList.add("no-sibling"):(p=new Dc(o,this.contextViewService,{placeholder:this.getLocalizedStrings().siblingInputPlaceholder,inputBoxStyles:c_({inputBackground:TLe,inputForeground:_Le,inputBorder:ZE})}),p.element.classList.add("setting-list-siblingInput"),this.listDisposables.add(p),p.value=e.sibling,this.listDisposables.add(Vo(p.inputElement,re.KEY_DOWN,u)));let h=this.listDisposables.add(new Mi(o,Ko));h.label=d(12581,null),h.element.classList.add("setting-list-ok-button"),this.listDisposables.add(h.onDidClick(()=>{e.value.type==="string"?this.handleItemChange(e,l(),t):this.handleItemChange(e,c(r),t)}));let g=this.listDisposables.add(new Mi(o,{secondary:!0,...Ko}));return g.label=d(12558,null),g.element.classList.add("setting-list-cancel-button"),this.listDisposables.add(g.onDidClick(()=>this.cancelEdit())),this.listDisposables.add(nn(()=>{n.focus(),n instanceof Dc&&n.select()})),o}isItemNew(e){return e.value.data===""}addTooltipsToRow(e,{value:t,sibling:o}){let n=Jn(o)?d(12574,null,t.data):d(12572,null,t.data,o),{rowElement:r}=e;this.listDisposables.add(this.hoverService.setupDelayedHover(r,{content:n})),r.setAttribute("aria-label",n)}getLocalizedStrings(){return{deleteActionTooltip:d(12584,null),editActionTooltip:d(12561,null),addButtonLabel:d(12556,null),inputPlaceholder:d(12571,null),siblingInputPlaceholder:d(12573,null)}}renderInputBox(e,t){let o=new Dc(t,this.contextViewService,{placeholder:this.getLocalizedStrings().inputPlaceholder,inputBoxStyles:c_({inputBackground:TLe,inputForeground:_Le,inputBorder:ZE})});return o.element.classList.add("setting-list-valueInput"),this.listDisposables.add(o),o.value=e.data.toString(),o}renderDropdown(e,t){if(e.type!=="enum")throw new Error("Valuetype must be enum.");let o=this.createBasicSelectBox(e),n=xb(".setting-list-object-list-row");return o.render(n),t.appendChild(n),o}};dZ=I([m(1,De),m(2,_n),m(3,tt),m(4,B)],dZ);var eWt=class extends dZ{getContainerClasses(){return["setting-list-include-exclude-widget"]}addDragAndDrop(i,e,t){}addTooltipsToRow(i,e){let t=Jn(e.sibling)?d(12563,null,e.value.data):d(12565,null,e.value.data,e.sibling);e.source&&(t+=d(12562,null,e.source));let o=new xe().appendMarkdown(t),{rowElement:n}=i;this.listDisposables.add(this.hoverService.setupDelayedHover(n,{content:o})),n.setAttribute("aria-label",t)}getLocalizedStrings(){return{deleteActionTooltip:d(12582,null),editActionTooltip:d(12559,null),addButtonLabel:d(12557,null),inputPlaceholder:d(12564,null),siblingInputPlaceholder:d(12566,null)}}},tWt=class extends dZ{getContainerClasses(){return["setting-list-include-exclude-widget"]}addDragAndDrop(i,e,t){}addTooltipsToRow(i,e){let t=Jn(e.sibling)?d(12567,null,e.value.data):d(12569,null,e.value.data,e.sibling);e.source&&(t+=d(12562,null,e.source));let o=new xe().appendMarkdown(t),{rowElement:n}=i;this.listDisposables.add(this.hoverService.setupDelayedHover(n,{content:o})),n.setAttribute("aria-label",t)}getLocalizedStrings(){return{deleteActionTooltip:d(12583,null),editActionTooltip:d(12560,null),addButtonLabel:d(12557,null),inputPlaceholder:d(12568,null),siblingInputPlaceholder:d(12570,null)}}},Spe=class extends bpe{constructor(e,t,o,n,r){super(e,t,o,r);this.hoverService=n;this.editable=!0;this.currentSettingKey="";this.showAddButton=!0;this.keySuggester=()=>{};this.valueSuggester=()=>{}}setValue(e,t){this.editable=!t?.isReadOnly,this.showAddButton=t?.showAddButton??this.showAddButton,this.keySuggester=t?.keySuggester??this.keySuggester,this.valueSuggester=t?.valueSuggester??this.valueSuggester,this.propertyNames=t?.propertyNames,mo(t)&&t.settingKey!==this.currentSettingKey&&(this.model.setEditKey("none"),this.model.select(null),this.currentSettingKey=t.settingKey),super.setValue(e)}isItemNew(e){return e.key.data===""&&e.value.data===""}isAddButtonVisible(){return this.showAddButton}get isReadOnly(){return!this.editable}getEmptyItem(){return{key:{type:"string",data:""},value:{type:"string",data:""},removable:!0,resetable:!1}}getContainerClasses(){return["setting-list-object-widget"]}getActionsForItem(e,t){if(this.isReadOnly)return[];let o=[{class:q.asClassName(cpe),enabled:!0,id:"workbench.action.editListItem",label:"",tooltip:this.getLocalizedStrings().editActionTooltip,run:()=>this.editSetting(t)}];return e.resetable&&o.push({class:q.asClassName(Pso),enabled:!0,id:"workbench.action.resetListItem",label:"",tooltip:this.getLocalizedStrings().resetActionTooltip,run:()=>this._onDidChangeList.fire({type:"reset",originalItem:e,targetIndex:t})}),e.removable&&o.push({class:q.asClassName(xIi),enabled:!0,id:"workbench.action.removeListItem",label:"",tooltip:this.getLocalizedStrings().deleteActionTooltip,run:()=>this._onDidChangeList.fire({type:"remove",originalItem:e,targetIndex:t})}),o}renderHeader(){let e=xb(".setting-list-row-header"),t=R(e,xb(".setting-list-object-key")),o=R(e,xb(".setting-list-object-value")),{keyHeaderText:n,valueHeaderText:r}=this.getLocalizedStrings();return t.textContent=n,o.textContent=r,e}renderItem(e,t){let o=xb(".setting-list-row");o.classList.add("setting-list-object-row"),this.propertyNames&&e.key.data&&!Hno(this.propertyNames,e.key.data)&&o.classList.add("invalid-key");let n=R(o,xb(".setting-list-object-key")),r=R(o,xb(".setting-list-object-value"));return n.textContent=e.key.data,r.textContent=e.value.data.toString(),{rowElement:o,keyElement:n,valueElement:r}}renderEdit(e,t){let o=xb(".setting-list-edit-row.setting-list-object-row"),n={...e},r=v=>{n.key=v,g.enabled=v.data!=="";let b=this.valueSuggester(v.data)??e.value;this.shouldUseSuggestion(e.value,n.value,b)&&(s(b),h())},s=v=>{n.value=v},l,c;if(this.showAddButton){if(this.isItemNew(e)){let S=this.keySuggester(this.model.items.map(({key:{data:y}})=>y));if(mo(S)){n.key=S;let y=this.valueSuggester(n.key.data);s(y??n.value)}}let{widget:v,element:b}=this.renderEditWidget(n.key,{idx:t,isKey:!0,originalItem:e,changedItem:n,update:r});l=v,c=b}else c=xb(".setting-list-object-key"),c.textContent=e.key.data;let u,p=xb(".setting-list-object-value-container"),h=()=>{let{widget:v,element:b}=this.renderEditWidget(n.value,{idx:t,isKey:!1,originalItem:e,changedItem:n,update:s});u=v,Rt(p),p.append(b)};h(),o.append(c,p);let g=this.listDisposables.add(new Mi(o,Ko));g.enabled=n.key.data!=="",g.label=d(12581,null),g.element.classList.add("setting-list-ok-button"),this.listDisposables.add(g.onDidClick(()=>this.handleItemChange(e,n,t)));let f=this.listDisposables.add(new Mi(o,{secondary:!0,...Ko}));return f.label=d(12558,null),f.element.classList.add("setting-list-cancel-button"),this.listDisposables.add(f.onDidClick(()=>this.cancelEdit())),this.listDisposables.add(nn(()=>{let v=l??u;v.focus(),v instanceof Dc&&v.select()})),o}renderEditWidget(e,t){switch(e.type){case"string":return this.renderStringEditWidget(e,t);case"enum":return this.renderEnumEditWidget(e,t);case"boolean":return this.renderEnumEditWidget({type:"enum",data:e.data.toString(),options:[{value:"true"},{value:"false"}]},t)}}renderStringEditWidget(e,{idx:t,isKey:o,originalItem:n,changedItem:r,update:s}){let l=xb(o?".setting-list-object-input-key":".setting-list-object-input-value"),c=new Dc(l,this.contextViewService,{placeholder:o?d(12576,null):d(12580,null),inputBoxStyles:c_({inputBackground:TLe,inputForeground:_Le,inputBorder:ZE})});c.element.classList.add("setting-list-object-input"),this.listDisposables.add(c),c.value=e.data,this.listDisposables.add(c.onDidChange(p=>s({...e,data:p})));let u=p=>{p.equals(3)?this.handleItemChange(n,r,t):p.equals(9)&&(this.cancelEdit(),p.preventDefault(),p.stopPropagation())};return this.listDisposables.add(Vo(c.inputElement,re.KEY_DOWN,u)),{widget:c,element:l}}renderEnumEditWidget(e,{isKey:t,changedItem:o,update:n}){let r=this.createBasicSelectBox(e),s=t?o.key:o.value;this.listDisposables.add(r.onDidSelect(({selected:u})=>n(s.type==="boolean"?{...s,data:u==="true"}:{...s,data:u})));let l=xb(".setting-list-object-input");return l.classList.add(t?"setting-list-object-input-key":"setting-list-object-input-value"),r.render(l),e.options.findIndex(u=>e.data===u.value)===-1&&e.options.length?n(s.type==="boolean"?{...s,data:!0}:{...s,data:e.options[0].value}):s.type==="boolean"&&n({...s,data:e.data==="true"}),{widget:r,element:l}}shouldUseSuggestion(e,t,o){if(o.type!=="enum"&&o.type===t.type&&o.data===t.data)return!1;if(e.data==="")return!0;if(t.type===o.type&&o.type!=="enum")return!1;if(t.type==="enum"&&o.type==="enum"){let n=new Set(t.options.map(({value:r})=>r));if(o.options.forEach(({value:r})=>n.delete(r)),n.size===0)return!1}return!0}addTooltipsToRow(e,t){let{keyElement:o,valueElement:n,rowElement:r}=e,s;t.source?s=d(12578,null,t.key.data,t.value.data,t.source):s=d(12577,null,t.key.data,t.value.data);let l=new xe().appendMarkdown(s),c=this.getEnumDescription(t.key)??t.keyDescription??l;this.listDisposables.add(this.hoverService.setupDelayedHover(o,{content:c}));let u=this.getEnumDescription(t.value)??l;this.listDisposables.add(this.hoverService.setupDelayedHover(n,{content:u})),r.setAttribute("aria-label",s)}getEnumDescription(e){return e.type==="enum"?e.options.find(({value:o})=>e.data===o)?.description:void 0}getLocalizedStrings(){return{deleteActionTooltip:d(12584,null),resetActionTooltip:d(12585,null),editActionTooltip:d(12561,null),addButtonLabel:d(12556,null),keyHeaderText:d(12575,null),valueHeaderText:d(12579,null)}}};Spe=I([m(1,De),m(2,_n),m(3,tt),m(4,B)],Spe);var Ipe=class extends bpe{constructor(e,t,o,n,r){super(e,t,o,r);this.hoverService=n;this.currentSettingKey=""}setValue(e,t){mo(t)&&t.settingKey!==this.currentSettingKey&&(this.model.setEditKey("none"),this.model.select(null),this.currentSettingKey=t.settingKey),super.setValue(e)}isItemNew(e){return!e.key.data&&!e.value.data}getEmptyItem(){return{key:{type:"string",data:""},value:{type:"boolean",data:!1},removable:!1,resetable:!0}}getContainerClasses(){return["setting-list-object-widget"]}getActionsForItem(e,t){return[]}isAddButtonVisible(){return!1}renderHeader(){}renderDataOrEditItem(e,t,o){let n=this.renderEdit(e,t);return n.setAttribute("role","listitem"),n}renderItem(e,t){let o=xb(".blank-row"),n=xb(".blank-row-key");return{rowElement:o,keyElement:n}}renderEdit(e,t){let o=xb(".setting-list-edit-row.setting-list-object-row.setting-item-bool"),n={...e},r=h=>{n.value.data=h,this.handleItemChange(e,n,t)},s=e.keyDescription?`${e.keyDescription} (${e.key.data})`:e.key.data,{element:l,widget:c}=this.renderEditWidget(n.value.data,s,r);o.appendChild(l);let u=R(o,xb(".setting-list-object-value"));u.textContent=s;let p={rowElement:o,keyElement:u,valueElement:c.domNode};return this.addTooltipsToRow(p,e),this._register(j(u,re.MOUSE_DOWN,h=>{h.target.tagName.toLowerCase()!=="a"&&(c.checked=!c.checked,r(c.checked)),$t.stop(h)})),o}renderEditWidget(e,t,o){let n=new Kh({icon:M.check,actionClassName:"setting-value-checkbox",isChecked:e,title:t,...b7});this.listDisposables.add(n);let r=xb(".setting-list-object-input");return r.classList.add("setting-list-object-input-key-checkbox"),n.domNode.classList.add("setting-value-checkbox"),r.appendChild(n.domNode),this._register(j(r,re.MOUSE_DOWN,s=>{n.checked=!n.checked,o(n.checked),s.stopImmediatePropagation()})),{widget:n,element:r}}addTooltipsToRow(e,t){let o=d(12577,null,t.key.data,t.value.data),n=t.keyDescription??o,{rowElement:r,keyElement:s,valueElement:l}=e;this.listDisposables.add(this.hoverService.setupDelayedHover(s,{content:n})),l.setAttribute("aria-label",o),r.setAttribute("aria-label",o)}getLocalizedStrings(){return{deleteActionTooltip:d(12584,null),resetActionTooltip:d(12585,null),editActionTooltip:d(12561,null),addButtonLabel:d(12556,null),keyHeaderText:d(12575,null),valueHeaderText:d(12579,null)}}};Ipe=I([m(1,De),m(2,_n),m(3,tt),m(4,B)],Ipe);var _p=_,o3o=new Set(["accessibility.signals.chatUserActionRequired","accessibility.signals.chatResponseReceived"]);function n3o(a){let i=typeof a.defaultValue=="object"?a.defaultValue??{}:{},e=a.isConfigured?{...i,...a.scopeValue}:i;return Object.keys(e).filter(t=>!!e[t]).map(t=>{let o=i[t],n;if(o===e[t]&&a.setting.type==="object"&&a.defaultValueSource instanceof Map){let l=a.defaultValueSource.get(`${a.setting.key}.${t}`);n=typeof l=="string"?l:l?.displayName}let r=e[t],s=typeof r=="boolean"?void 0:r.when;return{value:{type:"string",data:t},sibling:s,elementType:a.valueType,source:n}})}function r3o(a,i){let e=new Set(a);return i.forEach(({key:t})=>e.delete(t.data)),e.size===0}function _Je(a){if(a.anyOf)return a.anyOf.map(_Je).flat();let i=a.enumDescriptions??[];return(a.enum??[]).map((e,t)=>{let o=t<i.length?i[t]:void 0;return{value:e,description:o}})}function DJe(a){return a.anyOf?a.anyOf.map(DJe).some(e=>e==="enum")?"enum":"string":a.type==="boolean"?"boolean":a.type==="string"&&mo(a.enum)&&a.enum.length>0?"enum":"string"}function OIi(a,i,e){return a==="boolean"?{type:a,data:!!i}:a==="enum"?{type:a,data:""+i,options:e}:{type:a,data:""+i}}function nao(a){let i=typeof a.defaultValue=="object"?a.defaultValue??{}:{},e=typeof a.scopeValue=="object"?a.scopeValue??{}:{},t=a.isConfigured?{...i,...e}:a.hasPolicyValue?a.scopeValue:i,{objectProperties:o,objectPatternProperties:n,objectAdditionalProperties:r}=a.setting,s=Object.entries(n??{}).map(([c,u])=>({pattern:new RegExp(c),schema:u})),l=Object.entries(o??{}).map(([c,u])=>({value:c,description:u.description}));return Object.keys(t).map(c=>{let u=i[c],p;if(u===t[c]&&a.setting.type==="object"&&a.defaultValueSource instanceof Map){let b=a.defaultValueSource.get(`${a.setting.key}.${c}`);p=typeof b=="string"?b:b?.displayName}if(mo(o)&&c in o){let b=_Je(o[c]);return{key:{type:"enum",data:c,options:l},value:OIi(DJe(o[c]),t[c],b),keyDescription:o[c].description,removable:Jn(u),resetable:!Jn(u),source:p}}let h=u===void 0||J0t(a.setting.key),g=!!u&&u!==t[c],f=s.find(({pattern:b})=>b.test(c))?.schema;if(f){let b=_Je(f);return{key:{type:"string",data:c},value:OIi(DJe(f),t[c],b),keyDescription:f.description,removable:h,resetable:g,source:p}}let v=_Je(typeof r=="boolean"?{}:r??{});return{key:{type:"string",data:c},value:OIi(typeof r=="object"?DJe(r):"string",t[c],v),keyDescription:typeof r=="object"?r.description:void 0,removable:h,resetable:g,source:p}}).filter(c=>!Jn(c.value.data))}function s3o(a){let i=typeof a.defaultValue=="object"?a.defaultValue??{}:{},e=typeof a.scopeValue=="object"?a.scopeValue??{}:{},t=a.isConfigured?{...i,...e}:i,{objectProperties:o}=a.setting,n=[];for(let r in o){let s=i[r],l;if(s===t[r]&&a.setting.type==="object"&&a.defaultValueSource instanceof Map){let c=a.defaultValueSource.get(r);l=typeof c=="string"?c:c?.displayName}n.push({key:{type:"string",data:r},value:{type:"boolean",data:!!t[r]},keyDescription:o[r].description,removable:!1,resetable:!0,source:l})}return n}function a3o(a){return(i,e)=>{let t=[];return a.setting.enum&&a.setting.enum.forEach((o,n)=>{if(!a.setting.uniqueItems||e!==void 0&&o===i[e]||!i.includes(o)){let r=a.setting.enumDescriptions?.[n];t.push({value:o,description:r})}}),t.length>0?{type:"enum",data:t[0].value,options:t}:void 0}}function l3o(a){let{objectProperties:i}=a.setting,e=Object.keys(i??{});return t=>{let o=new Set(t),n=[];return e.forEach(r=>{o.has(r)||n.push({value:r,description:i[r].description})}),n.length>0?{type:"enum",data:n[0].value,options:n}:void 0}}function c3o(a){let{objectProperties:i,objectPatternProperties:e,objectAdditionalProperties:t}=a.setting,o=Object.entries(e??{}).map(([n,r])=>({pattern:new RegExp(n),schema:r}));return n=>{let r;mo(i)&&n in i&&(r=i[n]);let s=r??o.find(({pattern:l})=>l.test(n))?.schema;if(mo(s)?r=s:mo(t)&&typeof t=="object"&&(r=t),mo(r)){let l=DJe(r);if(l==="boolean")return{type:l,data:r.default??!0};if(l==="enum"){let c=_Je(r);return{type:l,data:r.default??c[0].value,options:c}}else return{type:l,data:r.default??""}}}}function iWt(a){return a==="number"||a==="integer"}function d3o(a,i){let e={};for(let t in i){let o,n=a.setting.objectPatternProperties,r=a.setting.objectProperties,s=a.setting.objectAdditionalProperties;if(r){for(let l in r)if(l===t){o=iWt(r[l].type);break}}if(o===void 0&&n){for(let l in n)if(t.match(l)){o=iWt(n[l].type);break}}o===void 0&&s&&typeof s!="boolean"&&iWt(s.type)&&(o=!0),e[t]=o?Number(i[t]):i[t]}return e}function u3o(a){if(!a.value||!Array.isArray(a.value))return[];if(a.setting.arrayItemType==="enum"){let i=[];return a.setting.enum&&(i=a.setting.enum.map((e,t)=>({value:e,description:a.setting.enumDescriptions?.[t]}))),a.value.map(e=>({value:{type:"enum",data:e,options:i}}))}else return a.value.map(i=>({value:{type:"string",data:i}}))}function p3o(a,i){return a.setting.enum&&a.setting.uniqueItems?a.setting.enum.length-i.length>0:!0}function rao(a,i,e,t){let o=uao(i);return{tree:lao(a,o,e,t),leftoverSettings:o}}function sao(a,i,e,t){return[...uao(a)].filter(n=>n.restricted&&AIi(n.key,i,e,t).isConfigured)}async function aao(a,i,e){let t=new Map,o=(s,l,c)=>{if(!t.has(s)){let u={id:s,label:l,children:[]};t.set(s,u)}t.get(s).children.push(c)},n=async s=>{let l=s.sections.map(v=>v.settings).flat(),c=e?dao(new Set(l),e):l;cao(c);let u=s.extensionInfo.id,p=await a.getExtension(u),h=p?.displayName??p?.name??u,f={id:s.id&&s.id!==u?s.id:s.title,label:s.title,order:s.order,settings:c};o(u,h,f)},r=i.map(s=>n(s));return Promise.all(r).then(()=>{let s=[];for(let l of t.values())if(l.children.length===1)s.push({id:l.id,label:l.children[0].label,settings:l.children[0].settings});else{l.children.sort((u,p)=>ape(u.order,p.order));let c=l.children.find(u=>u.label===l.label);if(c&&!c.children){let u=l.children.filter(p=>p!==c);s.push({id:l.id,label:l.label,settings:c.settings,children:u})}else s.push(l)}return s.sort((l,c)=>l.label.localeCompare(c.label)),{id:"extensions",label:d(12545,null),children:s}})}function lao(a,i,e,t){let o;a.children&&(o=a.children.filter(r=>r.hide!==!0).map(r=>lao(r,i,e,t)).filter(r=>r.children?.length||r.settings?.length));let n;if((e||a.settings)&&(n=dao(i,{include:{keyPatterns:[...e?.include?.keyPatterns??[],...a.settings??[]],tags:e?.include?.tags?[...e.include.tags]:[]},exclude:e?.exclude??{}}),cao(n)),!o&&!n)throw new Error(`TOC node has no child groups or settings: ${a.id}`);return{id:a.id,label:a.label,children:o,settings:n}}function cao(a){let o=n=>n.tags?.includes("experimental")?2:n.tags?.includes("preview")?1:0;a.sort((n,r)=>{let s=o(n),l=o(r);if(s!==l)return s-l;let c=ape(n.order,r.order);return c!==0?c:n.key.localeCompare(r.key)})}function dao(a,i){let e=[];return a.forEach(t=>{let o=!1,n=!1;i.include?.keyPatterns?o=i.include.keyPatterns.some(r=>{if(r.startsWith("@tag:")){let s=r.substring(5);return t.tags?.includes(s)}else return iao(t,r)}):o=!0,o&&i.include?.tags?.length&&(o=i.include.tags.some(r=>t.tags?.includes(r))),i.exclude?.keyPatterns&&(n=i.exclude.keyPatterns.some(r=>{if(r.startsWith("@tag:")){let s=r.substring(5);return t.tags?.includes(s)}else return iao(t,r)})),!n&&i.exclude?.tags?.length&&(n=i.exclude.tags.some(r=>t.tags?.includes(r))),o&&!n&&(e.push(t),o3o.has(t.key)||a.delete(t))}),e}var tao=new Map;function m3o(a){return a=Yr(a).replace(/\\\*/g,".*"),new RegExp(`^${a}$`,"i")}function iao(a,i){let e=tao.get(i);return e||(e=m3o(i),tao.set(i,e)),e.test(a.key)}function uao(a){let i=new Set;for(let e of a)for(let t of e.sections)for(let o of t.settings)(!o.overrides||!o.overrides.length)&&i.add(o);return i}var pao="settings.text.template",mao="settings.multilineText.template",hao="settings.number.template",gao="settings.enum.template",fao="settings.bool.template",vao="settings.array.template",bao="settings.exclude.template",Sao="settings.include.template",Iao="settings.object.template",yao="settings.boolObject.template",oWt="settings.complex.template",wao="settings.complexObject.template",Cao="settings.newExtensions.template",xao="settings.group.template",kao="settings.extensionToggle.template";function h3o(a){a.querySelectorAll(`
[tabindex="0"],
input:not([tabindex="-1"]),
select:not([tabindex="-1"]),
textarea:not([tabindex="-1"]),
a:not([tabindex="-1"]),
button:not([tabindex="-1"]),
area:not([tabindex="-1"])
`).forEach(e=>{e.setAttribute(hd.ELEMENT_FOCUSABLE_ATTR,"true"),e.setAttribute("tabindex","-1")})}function g3o(a){a.querySelectorAll(`[${hd.ELEMENT_FOCUSABLE_ATTR}="true"]`).forEach(e=>{e.removeAttribute(hd.ELEMENT_FOCUSABLE_ATTR),e.setAttribute("tabindex","0")})}var hd=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super();this.settingActions=e;this.disposableActionFactory=t;this._themeService=o;this._contextViewService=n;this._openerService=r;this._instantiationService=s;this._commandService=l;this._contextMenuService=c;this._keybindingService=u;this._configService=p;this._extensionsService=h;this._extensionsWorkbenchService=g;this._productService=f;this._telemetryService=v;this._hoverService=b;this._markdownRendererService=S;this._onDidClickOverrideElement=this._register(new E);this.onDidClickOverrideElement=this._onDidClickOverrideElement.event;this._onDidChangeSetting=this._register(new E);this.onDidChangeSetting=this._onDidChangeSetting.event;this._onDidOpenSettings=this._register(new E);this.onDidOpenSettings=this._onDidOpenSettings.event;this._onDidClickSettingLink=this._register(new E);this.onDidClickSettingLink=this._onDidClickSettingLink.event;this._onDidFocusSetting=this._register(new E);this.onDidFocusSetting=this._onDidFocusSetting.event;this._onDidChangeIgnoredSettings=this._register(new E);this.onDidChangeIgnoredSettings=this._onDidChangeIgnoredSettings.event;this._onDidChangeSettingHeight=this._register(new E);this.onDidChangeSettingHeight=this._onDidChangeSettingHeight.event;this._onApplyFilter=this._register(new E);this.onApplyFilter=this._onApplyFilter.event;this.ignoredSettings=uFt(WJ(),this._configService),this._register(this._configService.onDidChangeConfiguration(y=>{this.ignoredSettings=uFt(WJ(),this._configService),this._onDidChangeIgnoredSettings.fire()}))}static{this.CONTROL_CLASS="setting-control-focus-target"}static{this.CONTROL_SELECTOR="."+this.CONTROL_CLASS}static{this.CONTENTS_CLASS="setting-item-contents"}static{this.CONTENTS_SELECTOR="."+this.CONTENTS_CLASS}static{this.ALL_ROWS_SELECTOR=".monaco-list-row"}static{this.SETTING_KEY_ATTR="data-key"}static{this.SETTING_ID_ATTR="data-id"}static{this.ELEMENT_FOCUSABLE_ATTR="data-focusable"}renderCommonTemplate(e,t,o){t.classList.add("setting-item"),t.classList.add("setting-item-"+o);let n=new P,r=R(t,_p(hd.CONTENTS_SELECTOR));r.classList.add("settings-row-inner-container");let s=R(r,_p(".setting-item-title")),l=R(s,_p(".setting-item-cat-label-container")),c=R(l,_p("span.setting-item-category")),u=R(l,_p("span.setting-item-label")),p=n.add(new BC(u)),h=n.add(this._instantiationService.createInstance(gpe,s)),g=R(r,_p(".setting-item-description")),f=R(r,_p(".setting-item-modified-indicator"));n.add(this._hoverService.setupDelayedHover(f,{content:d(12546,null)}));let v=R(r,_p(".setting-item-value")),b=R(v,_p("div.setting-item-control")),S=R(r,_p(".setting-item-deprecation-message")),y=R(r,_p(".setting-toolbar-container")),w=this.renderSettingToolbar(y),k={toDispose:n,elementDisposables:n.add(new P),containerElement:r,categoryElement:c,labelElement:p,descriptionElement:g,controlElement:b,deprecationWarningElement:S,indicatorsLabel:h,toolbar:w};return n.add(j(b,re.MOUSE_DOWN,T=>T.stopPropagation())),n.add(j(s,re.MOUSE_ENTER,T=>r.classList.add("mouseover"))),n.add(j(s,re.MOUSE_LEAVE,T=>r.classList.remove("mouseover"))),k}addSettingElementFocusHandler(e){let t=Vn(e.containerElement);e.toDispose.add(t),e.toDispose.add(t.onDidBlur(()=>{e.containerElement.classList.contains("focused")&&e.containerElement.classList.remove("focused")})),e.toDispose.add(t.onDidFocus(()=>{e.containerElement.classList.add("focused"),e.context&&this._onDidFocusSetting.fire(e.context)}))}renderSettingToolbar(e){let t=this._keybindingService.appendKeybinding(d(12552,null),w0t);return new Ju(e,this._contextMenuService,{toggleMenuTitle:t,renderDropdownAsChildElement:!Nc,moreIcon:_so})}renderSettingElement(e,t,o){let n=e.element;n.inspectSelf(),o.context=n,o.toolbar.context=n;let r=this.disposableActionFactory(n.setting,n.settingsTarget);r.forEach(p=>Ac(p)&&o.elementDisposables.add(p)),o.toolbar.setActions([],[...this.settingActions,...r]);let s=n.setting;o.containerElement.classList.toggle("is-configured",n.isConfigured),o.containerElement.setAttribute(hd.SETTING_KEY_ATTR,n.setting.key),o.containerElement.setAttribute(hd.SETTING_ID_ATTR,n.id);let l=s.key+(n.isConfigured?" - Modified":"");if(o.categoryElement.textContent=n.displayCategory?n.displayCategory+": ":"",o.elementDisposables.add(this._hoverService.setupDelayedHover(o.categoryElement,{content:l})),o.labelElement.text=n.displayLabel,o.labelElement.title=l,o.descriptionElement.innerText="",n.setting.descriptionIsMarkdown){let p=this.renderSettingMarkdown(n,o.containerElement,n.description,o.elementDisposables);o.descriptionElement.appendChild(p)}else o.descriptionElement.innerText=n.description;o.indicatorsLabel.updateScopeOverrides(n,this._onDidClickOverrideElement,this._onApplyFilter),o.elementDisposables.add(this._configService.onDidChangeConfiguration(p=>{p.affectsConfiguration(IR)&&o.indicatorsLabel.updateScopeOverrides(n,this._onDidClickOverrideElement,this._onApplyFilter)}));let c=p=>this._onDidChangeSetting.fire({key:n.setting.key,value:p,type:o.context.valueType,manualReset:!1,scope:n.setting.scope}),u=n.setting.deprecationMessage||"";u&&n.setting.deprecationMessageIsMarkdown?(o.deprecationWarningElement.innerText="",o.deprecationWarningElement.appendChild(this.renderSettingMarkdown(n,o.containerElement,n.setting.deprecationMessage,o.elementDisposables))):o.deprecationWarningElement.innerText=u,o.deprecationWarningElement.prepend(_p(".codicon.codicon-error")),o.containerElement.classList.toggle("is-deprecated",!!u),this.renderValue(n,o,c),o.indicatorsLabel.updateWorkspaceTrust(n),o.indicatorsLabel.updateSyncIgnored(n,this.ignoredSettings),o.indicatorsLabel.updateDefaultOverrideIndicator(n),o.indicatorsLabel.updatePreviewIndicator(n),o.indicatorsLabel.updateAdvancedIndicator(n),o.elementDisposables.add(this.onDidChangeIgnoredSettings(()=>{o.indicatorsLabel.updateSyncIgnored(n,this.ignoredSettings)})),this.updateSettingTabbable(n,o),o.elementDisposables.add(n.onDidChangeTabbable(()=>{this.updateSettingTabbable(n,o)}))}updateSettingTabbable(e,t){e.tabbable?g3o(t.containerElement):h3o(t.containerElement)}renderSettingMarkdown(e,t,o,n){o=ZIi(o);let r=n.add(this._markdownRendererService.render({value:o,isTrusted:!0},{actionHandler:s=>{if(s.startsWith("#")){let l={source:e,targetKey:s.substring(1)};this._onDidClickSettingLink.fire(l)}else this._openerService.open(s,{allowCommands:!0}).catch(mt)},asyncRenderCallback:()=>{let s=t.clientHeight;s&&this._onDidChangeSettingHeight.fire({element:e,height:s})}}));return r.element.classList.add("setting-item-markdown"),Eao(r.element),r.element}disposeTemplate(e){e.toDispose.dispose()}disposeElement(e,t,o){o.elementDisposables?.clear()}};hd=I([m(2,De),m(3,_n),m(4,Qe),m(5,F),m(6,ge),m(7,ze),m(8,_e),m(9,B),m(10,lt),m(11,zi),m(12,nt),m(13,Te),m(14,tt),m(15,Qn)],hd);var FIi=class{constructor(){this.templateId=xao}renderTemplate(i){return i.classList.add("group-title"),{parent:i,toDispose:new P}}renderElement(i,e,t){t.parent.innerText="";let o=R(t.parent,_p("div.settings-group-title-label.settings-row-inner-container"));o.classList.add(`settings-group-level-${i.element.level}`),o.textContent=i.element.label,i.element.isFirstGroup&&o.classList.add("settings-group-first")}disposeTemplate(i){i.toDispose.dispose()}},TJe=class{constructor(i){this._commandService=i;this.templateId=Cao}renderTemplate(i){let e=new P;i.classList.add("setting-item-new-extensions");let t=new Mi(i,{title:!0,...Ko});e.add(t),e.add(t.onDidClick(()=>{o.context&&this._commandService.executeCommand("workbench.extensions.action.showExtensionsWithIds",o.context.extensionIds)})),t.label=d(12547,null),t.element.classList.add("settings-new-extensions-button");let o={button:t,toDispose:e};return o}renderElement(i,e,t){t.context=i.element}disposeTemplate(i){i.toDispose.dispose()}};TJe=I([m(0,ge)],TJe);var nWt=class a extends hd{constructor(){super(...arguments);this.templateId=oWt}static{this.EDIT_IN_JSON_LABEL=d(12543,null)}renderTemplate(e){let t=this.renderCommonTemplate(null,e,"complex"),o=R(t.controlElement,_p("a.edit-in-settings-button"));o.classList.add(hd.CONTROL_CLASS),o.role="button";let n=_p(".setting-item-validation-message");t.containerElement.appendChild(n);let r={...t,button:o,validationErrorMessageElement:n};return this.addSettingElementFocusHandler(r),r}renderElement(e,t,o){super.renderSettingElement(e,t,o)}renderValue(e,t,o){let n=gSe(e.setting.key),r=d(12544,null,n),s=e.setting.isLanguageTagSetting;t.button.textContent=s?r:a.EDIT_IN_JSON_LABEL;let l=c=>{s?this._onApplyFilter.fire(`@${PF}${n.replaceAll(" ","")}`):this._onDidOpenSettings.fire(e.setting.key),c.preventDefault(),c.stopPropagation()};t.elementDisposables.add(j(t.button,re.CLICK,c=>{l(c)})),t.elementDisposables.add(j(t.button,re.KEY_DOWN,c=>{let u=new Ii(c);(u.equals(10)||u.equals(3))&&l(c)})),this.renderValidations(e,t),s?t.button.setAttribute("aria-label",r):t.button.setAttribute("aria-label",`${a.EDIT_IN_JSON_LABEL}: ${e.setting.key}`)}renderValidations(e,t){let o=e.isConfigured&&_bi(e.value,e.setting.type);if(o){t.containerElement.classList.add("invalid-input"),t.validationErrorMessageElement.innerText=o;return}t.containerElement.classList.remove("invalid-input")}},WIi=class extends nWt{constructor(){super(...arguments);this.templateId=wao}renderTemplate(e){let t=this.renderCommonTemplate(null,e,"list"),o=t.toDispose.add(this._instantiationService.createInstance(Spe,t.controlElement));o.domNode.classList.add(hd.CONTROL_CLASS);let n=R(R(t.controlElement,_p(".complex-object-edit-in-settings-button-container")),_p("a.complex-object.edit-in-settings-button"));n.classList.add(hd.CONTROL_CLASS),n.role="button";let r=_p(".setting-item-validation-message");t.containerElement.appendChild(r);let s={...t,button:n,validationErrorMessageElement:r,objectSettingWidget:o};return this.addSettingElementFocusHandler(s),s}renderValue(e,t,o){let n=nao(e);t.objectSettingWidget.setValue(n,{settingKey:e.setting.key,showAddButton:!1,isReadOnly:!0}),t.button.parentElement?.classList.toggle("hide",e.hasPolicyValue),super.renderValue(e,t,o)}},VIi=class extends hd{constructor(){super(...arguments);this.templateId=vao}renderTemplate(e){let t=this.renderCommonTemplate(null,e,"list"),o=t.containerElement.querySelector(".setting-item-description"),n=_p(".setting-item-validation-message");o.after(n);let r=this._instantiationService.createInstance(dZ,t.controlElement);r.domNode.classList.add(hd.CONTROL_CLASS),t.toDispose.add(r);let s={...t,listWidget:r,validationErrorMessageElement:n};return this.addSettingElementFocusHandler(s),t.toDispose.add(r.onDidChangeList(l=>{let c=this.computeNewList(s,l);s.onChange?.(c)})),s}computeNewList(e,t){if(e.context){let o=[];if(Array.isArray(e.context.scopeValue)?o=[...e.context.scopeValue]:Array.isArray(e.context.value)&&(o=[...e.context.value]),t.type==="move"){let n=t.sourceIndex,r=t.targetIndex,s=o.splice(n,1)[0];o.splice(r,0,s)}else if(t.type==="remove"||t.type==="reset")o.splice(t.targetIndex,1);else if(t.type==="change"){let n=t.newItem.value.data.toString();t.targetIndex>-1?o[t.targetIndex]=n:o.push(n)}else t.type==="add"&&o.push(t.newItem.value.data.toString());return e.context.defaultValue&&Array.isArray(e.context.defaultValue)&&e.context.defaultValue.length===o.length&&e.context.defaultValue.join()===o.join()?void 0:o}}renderElement(e,t,o){super.renderSettingElement(e,t,o)}renderValue(e,t,o){let n=u3o(e),r=e.setting.enum?a3o(e):void 0;t.listWidget.setValue(n,{showAddButton:p3o(e,n),keySuggester:r}),t.context=e,t.elementDisposables.add(Z(()=>{t.listWidget.cancelEdit()})),t.onChange=s=>{if(s&&!cWt(e,t,s,!1)){let l=e.setting.arrayItemType,c=iWt(l)?s.map(u=>+u):s;o(c)}else o(s)},cWt(e,t,n.map(s=>s.value.data.toString()),!0)}},rWt=class extends hd{renderTemplateWithWidget(i,e){e.domNode.classList.add(hd.CONTROL_CLASS),i.toDispose.add(e);let t=i.containerElement.querySelector(".setting-item-description"),o=_p(".setting-item-validation-message");t.after(o);let n={...i,validationErrorMessageElement:o};return e instanceof Ipe?n.objectCheckboxWidget=e:n.objectDropdownWidget=e,this.addSettingElementFocusHandler(n),n}renderElement(i,e,t){super.renderSettingElement(i,e,t)}},BIi=class extends rWt{constructor(){super(...arguments);this.templateId=Iao}renderTemplate(e){let t=this.renderCommonTemplate(null,e,"list"),o=this._instantiationService.createInstance(Spe,t.controlElement),n=this.renderTemplateWithWidget(t,o);return t.toDispose.add(o.onDidChangeList(r=>{this.onDidChangeObject(n,r)})),n}onDidChangeObject(e,t){let o=e.objectDropdownWidget;if(e.context){let n=J0t(e.context.setting.key),r=typeof e.context.defaultValue=="object"?e.context.defaultValue??{}:{},s=typeof e.context.scopeValue=="object"?e.context.scopeValue??{}:{},l={...e.context.scopeValue},c=[];if(o.items.forEach((p,h)=>{(t.type==="change"||t.type==="move")&&t.targetIndex===h?(t.originalItem.key.data!==t.newItem.key.data&&n&&t.originalItem.key.data in r?l[t.originalItem.key.data]=null:delete l[t.originalItem.key.data],l[t.newItem.key.data]=t.newItem.value.data,c.push(t.newItem)):(t.type!=="change"&&t.type!=="move"||t.newItem.key.data!==p.key.data)&&(l[p.key.data]=p.value.data,c.push(p))}),t.type==="remove"||t.type==="reset"){let p=t.originalItem.key.data,h=t.type==="remove"&&n&&r[p]===t.originalItem.value.data;h?l[p]=null:delete l[p];let g=c.findIndex(v=>v.key.data===p),f=r[p];h||Jn(r[p])&&g>-1?c.splice(g,1):!h&&g>-1&&(c[g].value.data=f)}else t.type==="add"&&(l[t.newItem.key.data]=t.newItem.value.data,c.push(t.newItem));Object.entries(l).forEach(([p,h])=>{s[p]!==h&&r[p]===h&&!(n&&h===null)&&delete l[p]});let u=Object.keys(l).length===0?void 0:l;e.objectDropdownWidget.setValue(c),e.onChange?.(u)}}renderValue(e,t,o){let n=nao(e),{key:r,objectProperties:s,objectPatternProperties:l,objectAdditionalProperties:c,propertyNames:u}=e.setting;t.objectDropdownWidget.setValue(n,{settingKey:r,showAddButton:c===!1?!r3o(Object.keys(s??{}),n)||mo(l):!0,keySuggester:l3o(e),valueSuggester:c3o(e),propertyNames:u}),t.context=e,t.elementDisposables.add(Z(()=>{t.objectDropdownWidget.cancelEdit()})),t.onChange=p=>{if(p&&!cWt(e,t,p,!1)){let h=d3o(e,p);o(h)}else o(p)},cWt(e,t,e.value,!0)}},HIi=class extends rWt{constructor(){super(...arguments);this.templateId=yao}renderTemplate(e){let t=this.renderCommonTemplate(null,e,"list"),o=this._instantiationService.createInstance(Ipe,t.controlElement),n=this.renderTemplateWithWidget(t,o);return t.toDispose.add(o.onDidChangeList(r=>{this.onDidChangeObject(n,r)})),n}onDidChangeObject(e,t){if(e.context){let o=e.objectCheckboxWidget,n=typeof e.context.defaultValue=="object"?e.context.defaultValue??{}:{},r=typeof e.context.scopeValue=="object"?e.context.scopeValue??{}:{},s={...e.context.scopeValue},l=[];if(t.type!=="change"){console.warn("Unexpected event type",t.type,"for bool object setting",e.context.setting.key);return}o.items.forEach((u,p)=>{t.targetIndex===p?(s[t.newItem.key.data]=t.newItem.value.data,l.push(t.newItem)):t.newItem.key.data!==u.key.data&&(s[u.key.data]=u.value.data,l.push(u))}),Object.entries(s).forEach(([u,p])=>{r[u]!==p&&n[u]===p&&delete s[u]});let c=Object.keys(s).length===0?void 0:s;e.objectCheckboxWidget.setValue(l),e.onChange?.(c),this._onDidFocusSetting.fire(e.context)}}renderValue(e,t,o){let n=s3o(e),{key:r}=e.setting;t.objectCheckboxWidget.setValue(n,{settingKey:r}),t.context=e,t.onChange=s=>{o(s)}}},sWt=class extends hd{renderTemplate(i){let e=this.renderCommonTemplate(null,i,"list"),t=this._instantiationService.createInstance(this.isExclude()?eWt:tWt,e.controlElement);t.domNode.classList.add(hd.CONTROL_CLASS),e.toDispose.add(t);let o={...e,includeExcludeWidget:t};return this.addSettingElementFocusHandler(o),e.toDispose.add(t.onDidChangeList(n=>this.onDidChangeIncludeExclude(o,n))),o}onDidChangeIncludeExclude(i,e){if(i.context){let o=function(n){let r=Object.keys(n).sort((l,c)=>l.localeCompare(c)),s={};for(let l of r)s[l]=n[l];return s},t={...i.context.scopeValue};e.type!=="add"&&(e.originalItem.value.data.toString()in i.context.defaultValue?t[e.originalItem.value.data.toString()]=!1:delete t[e.originalItem.value.data.toString()]),(e.type==="change"||e.type==="add"||e.type==="move")&&(e.newItem.value.data.toString()in i.context.defaultValue&&!e.newItem.sibling?delete t[e.newItem.value.data.toString()]:t[e.newItem.value.data.toString()]=e.newItem.sibling?{when:e.newItem.sibling}:!0),this._onDidChangeSetting.fire({key:i.context.setting.key,value:Object.keys(t).length===0?void 0:o(t),type:i.context.valueType,manualReset:!1,scope:i.context.setting.scope})}}renderElement(i,e,t){super.renderSettingElement(i,e,t)}renderValue(i,e,t){let o=n3o(i);e.includeExcludeWidget.setValue(o,{isReadOnly:i.hasPolicyValue}),e.context=i,e.elementDisposables.add(Z(()=>{e.includeExcludeWidget.cancelEdit()}))}},UIi=class extends sWt{constructor(){super(...arguments);this.templateId=bao}isExclude(){return!0}},zIi=class extends sWt{constructor(){super(...arguments);this.templateId=Sao}isExclude(){return!1}},f3o=c_({inputBackground:TLe,inputForeground:_Le,inputBorder:ZE}),aWt=class extends hd{constructor(){super(...arguments);this.MULTILINE_MAX_HEIGHT=150}renderTemplate(e,t){let o=this.renderCommonTemplate(null,e,"text"),n=R(o.containerElement,_p(".setting-item-validation-message")),r={flexibleHeight:t,flexibleWidth:!1,flexibleMaxHeight:this.MULTILINE_MAX_HEIGHT,inputBoxStyles:f3o},s=new Dc(o.controlElement,this._contextViewService,r);o.toDispose.add(s),o.toDispose.add(s.onDidChange(c=>{l.onChange?.(c)})),o.toDispose.add(s),s.inputElement.classList.add(hd.CONTROL_CLASS),s.inputElement.tabIndex=0;let l={...o,inputBox:s,validationErrorMessageElement:n};return this.addSettingElementFocusHandler(l),l}renderElement(e,t,o){super.renderSettingElement(e,t,o)}renderValue(e,t,o){t.onChange=void 0,t.inputBox.value=e.value,t.inputBox.setEnabled(!e.hasPolicyValue),t.inputBox.setAriaLabel(e.setting.key),t.onChange=n=>{lWt(e,t,!1)||o(n)},lWt(e,t,!0)}},KIi=class extends aWt{constructor(){super(...arguments);this.templateId=pao}renderTemplate(e){let t=super.renderTemplate(e,!1);return t.toDispose.add(Vo(t.inputBox.inputElement,re.KEY_DOWN,o=>{(o.equals(16)||o.equals(18))&&o.preventDefault()})),t}},GIi=class extends aWt{constructor(){super(...arguments);this.templateId=mao}renderTemplate(e){return super.renderTemplate(e,!0)}renderValue(e,t,o){let n=r=>{e.value=r,o(r)};super.renderValue(e,t,n),t.elementDisposables.add(t.inputBox.onDidHeightChange(r=>{t.containerElement.clientHeight&&this._onDidChangeSettingHeight.fire({element:e,height:t.containerElement.clientHeight})})),t.inputBox.layout()}},$Ii=class extends hd{constructor(){super(...arguments);this.templateId=gao}renderTemplate(e){let t=this.renderCommonTemplate(null,e,"enum"),o=MSt({selectBackground:K0t,selectForeground:G0t,selectBorder:$0t,selectListBorder:q0t}),n=new aE([],0,this._contextViewService,o,{useCustomDrawn:!HS(this._configService)||!(Nc&&og.pointerEvents)});t.toDispose.add(n),n.render(t.controlElement);let r=t.controlElement.querySelector("select");r&&(r.classList.add(hd.CONTROL_CLASS),r.tabIndex=0),t.toDispose.add(n.onDidSelect(c=>{l.onChange?.(c.index)}));let s=t.containerElement.insertBefore(_p(".setting-item-enumDescription"),t.descriptionElement.nextSibling),l={...t,selectBox:n,selectElement:r,enumDescriptionElement:s};return this.addSettingElementFocusHandler(l),l}renderElement(e,t,o){super.renderSettingElement(e,t,o)}renderValue(e,t,o){let n=e.setting.enumItemLabels?[...e.setting.enumItemLabels]:[],r=e.setting.enumDescriptions?[...e.setting.enumDescriptions]:[],s=[...e.setting.enum],l=e.setting.enumDescriptionsAreMarkdown,c=new P;t.elementDisposables.add(c);let u=!1;s.includes(e.defaultValue)||(s.unshift(e.defaultValue),r.unshift(""),n.unshift(""),u=!0);let p=oao(String(e.defaultValue)),h=s.map(String).map(oao).map((f,v)=>{let b=r[v]&&(l?ZIi(r[v],!1):r[v]);return{text:n[v]?n[v]:f,detail:n[v]?f:"",description:b,descriptionIsMarkdown:l,descriptionMarkdownActionHandler:S=>{this._openerService.open(S).catch(mt)},decoratorRight:f===p||u&&v===0?d(12550,null):""}});t.selectBox.setOptions(h),t.selectBox.setAriaLabel(e.setting.key),t.selectBox.setEnabled(!e.hasPolicyValue);let g=s.indexOf(e.value);g===-1&&(g=0),t.onChange=void 0,t.selectBox.select(g),t.onChange=f=>{o(u&&f===0?e.defaultValue:s[f])},t.enumDescriptionElement.innerText=""}},v3o=c_({inputBackground:Fso,inputForeground:Wso,inputBorder:Vso}),qIi=class extends hd{constructor(){super(...arguments);this.templateId=hao}renderTemplate(e){let t=super.renderCommonTemplate(null,e,"number"),o=R(t.containerElement,_p(".setting-item-validation-message")),n=new Dc(t.controlElement,this._contextViewService,{type:"number",inputBoxStyles:v3o});t.toDispose.add(n),t.toDispose.add(n.onDidChange(s=>{r.onChange?.(s)})),t.toDispose.add(n),n.inputElement.classList.add(hd.CONTROL_CLASS),n.inputElement.tabIndex=0;let r={...t,inputBox:n,validationErrorMessageElement:o};return this.addSettingElementFocusHandler(r),r}renderElement(e,t,o){super.renderSettingElement(e,t,o)}renderValue(e,t,o){let n=e.valueType==="integer"||e.valueType==="nullable-integer"?parseInt:parseFloat,r=e.valueType==="nullable-integer"||e.valueType==="nullable-number"?(s=>s===""?null:n(s)):n;t.onChange=void 0,t.inputBox.value=typeof e.value=="number"?e.value.toString():"",t.inputBox.step=e.valueType.includes("integer")?"1":"any",t.inputBox.setAriaLabel(e.setting.key),t.inputBox.setEnabled(!e.hasPolicyValue),t.onChange=s=>{lWt(e,t,!1)||o(r(s))},lWt(e,t,!0)}},jIi=class extends hd{constructor(){super(...arguments);this.templateId=fao}renderTemplate(e){e.classList.add("setting-item"),e.classList.add("setting-item-bool");let t=new P,o=R(e,_p(hd.CONTENTS_SELECTOR));o.classList.add("settings-row-inner-container");let n=R(o,_p(".setting-item-title")),r=R(n,_p("span.setting-item-category")),s=R(n,_p("span.setting-item-label")),l=t.add(new BC(s)),c=t.add(this._instantiationService.createInstance(gpe,n)),u=R(o,_p(".setting-item-value-description")),p=R(u,_p(".setting-item-bool-control")),h=R(u,_p(".setting-item-description")),g=R(o,_p(".setting-item-modified-indicator"));t.add(this._hoverService.setupDelayedHover(g,{content:d(12546,null)}));let f=R(o,_p(".setting-item-deprecation-message")),v=new Kh({icon:M.check,actionClassName:"setting-value-checkbox",isChecked:!0,title:"",...b7});p.appendChild(v.domNode),t.add(v),t.add(v.onChange(()=>{y.onChange(v.checked)})),v.domNode.classList.add(hd.CONTROL_CLASS);let b=R(o,_p(".setting-toolbar-container")),S=this.renderSettingToolbar(b);t.add(S);let y={toDispose:t,elementDisposables:t.add(new P),containerElement:o,categoryElement:r,labelElement:l,controlElement:p,checkbox:v,descriptionElement:h,deprecationWarningElement:f,indicatorsLabel:c,toolbar:S};return this.addSettingElementFocusHandler(y),t.add(j(p,"mousedown",w=>w.stopPropagation())),t.add(j(n,re.MOUSE_ENTER,w=>o.classList.add("mouseover"))),t.add(j(n,re.MOUSE_LEAVE,w=>o.classList.remove("mouseover"))),y}renderElement(e,t,o){super.renderSettingElement(e,t,o)}renderValue(e,t,o){t.onChange=void 0,t.checkbox.checked=e.value,e.hasPolicyValue?(t.checkbox.disable(),t.descriptionElement.classList.add("disabled")):(t.checkbox.enable(),t.descriptionElement.classList.remove("disabled"),t.elementDisposables.add(j(t.descriptionElement,re.MOUSE_DOWN,n=>{n.target.tagName.toLowerCase()!=="a"&&(t.checkbox.checked=!t.checkbox.checked,t.onChange(t.checkbox.checked)),$t.stop(n)}))),t.checkbox.setTitle(e.setting.key),t.onChange=o}},QIi=class extends hd{constructor(){super(...arguments);this.templateId=kao;this._onDidDismissExtensionSetting=this._register(new E);this.onDidDismissExtensionSetting=this._onDidDismissExtensionSetting.event}renderTemplate(e){let t=super.renderCommonTemplate(null,e,"extension-toggle"),o=new Mi(t.containerElement,{title:!1,...Ko});o.element.classList.add("setting-item-extension-toggle-button"),o.label=d(12553,null);let n=new Mi(t.containerElement,{title:!1,secondary:!0,...Ko});n.element.classList.add("setting-item-extension-dismiss-button"),n.label=d(12542,null);let r={...t,actionButton:o,dismissButton:n};return this.addSettingElementFocusHandler(r),r}renderElement(e,t,o){super.renderSettingElement(e,t,o)}renderValue(e,t,o){t.elementDisposables.clear();let n=e.setting.displayExtensionId;t.elementDisposables.add(t.actionButton.onDidClick(async()=>{this._telemetryService.publicLog2("ManageExtensionClick",{extensionId:n}),this._commandService.executeCommand("extension.open",n)})),t.elementDisposables.add(t.dismissButton.onDidClick(async()=>{this._telemetryService.publicLog2("DismissExtensionClick",{extensionId:n}),this._onDidDismissExtensionSetting.fire(n)}))}},NLe=class extends C{constructor(e,t,o,n){super();this._instantiationService=e;this._contextMenuService=t;this._contextViewService=o;this._userDataSyncEnablementService=n;this._onDidChangeSetting=this._register(new E);this.settingActions=[new st("settings.resetSetting",d(12548,null),void 0,void 0,async u=>{u instanceof vw&&(u.isUntrusted||this._onDidChangeSetting.fire({key:u.setting.key,value:void 0,type:u.setting.type,manualReset:!0,scope:u.setting.scope}))}),new li,this._instantiationService.createInstance(uZ),this._instantiationService.createInstance(pZ),this._instantiationService.createInstance(mZ)];let r=(u,p)=>this.getActionsForSetting(u,p),s=u=>[],l=this._instantiationService.createInstance(QIi,[],s),c=[this._instantiationService.createInstance(jIi,this.settingActions,r),this._instantiationService.createInstance(qIi,this.settingActions,r),this._instantiationService.createInstance(VIi,this.settingActions,r),this._instantiationService.createInstance(nWt,this.settingActions,r),this._instantiationService.createInstance(WIi,this.settingActions,r),this._instantiationService.createInstance(KIi,this.settingActions,r),this._instantiationService.createInstance(GIi,this.settingActions,r),this._instantiationService.createInstance(UIi,this.settingActions,r),this._instantiationService.createInstance(zIi,this.settingActions,r),this._instantiationService.createInstance($Ii,this.settingActions,r),this._instantiationService.createInstance(BIi,this.settingActions,r),this._instantiationService.createInstance(HIi,this.settingActions,r),l];this.onDidClickOverrideElement=H.any(...c.map(u=>u.onDidClickOverrideElement)),this.onDidChangeSetting=H.any(...c.map(u=>u.onDidChangeSetting),this._onDidChangeSetting.event),this.onDidDismissExtensionSetting=l.onDidDismissExtensionSetting,this.onDidOpenSettings=H.any(...c.map(u=>u.onDidOpenSettings)),this.onDidClickSettingLink=H.any(...c.map(u=>u.onDidClickSettingLink)),this.onDidFocusSetting=H.any(...c.map(u=>u.onDidFocusSetting)),this.onDidChangeSettingHeight=H.any(...c.map(u=>u.onDidChangeSettingHeight)),this.onApplyFilter=H.any(...c.map(u=>u.onApplyFilter)),this.allRenderers=[...c,this._instantiationService.createInstance(FIi),this._instantiationService.createInstance(TJe)]}getActionsForSetting(e,t){let o=[];return!(e.scope&&AC.includes(e.scope))&&t===3&&o.push(this._instantiationService.createInstance(gZ,e)),this._userDataSyncEnablementService.isEnabled()&&!e.disallowSyncIgnore&&o.push(this._instantiationService.createInstance(hZ,e)),o.length&&o.splice(0,0,new li),o}cancelSuggesters(){this._contextViewService.hideContextView()}showContextMenu(e,t){let o=t.querySelector(".monaco-toolbar");o&&this._contextMenuService.showContextMenu({getActions:()=>this.settingActions,getAnchor:()=>o,getActionsContext:()=>e})}getSettingDOMElementForDOMElement(e){let t=Nh(e,hd.CONTENTS_CLASS);return t||null}getDOMElementsForSettingKey(e,t){return e.querySelectorAll(`[${hd.SETTING_KEY_ATTR}="${t}"]`)}getKeyForDOMElementInSetting(e){let t=this.getSettingDOMElementForDOMElement(e);return t&&t.getAttribute(hd.SETTING_KEY_ATTR)}getIdForDOMElementInSetting(e){let t=this.getSettingDOMElementForDOMElement(e);return t&&t.getAttribute(hd.SETTING_ID_ATTR)}dispose(){super.dispose(),this.settingActions.forEach(e=>{Ac(e)&&e.dispose()}),this.allRenderers.forEach(e=>{Ac(e)&&e.dispose()})}};NLe=I([m(0,F),m(1,ze),m(2,_n),m(3,_l)],NLe);function lWt(a,i,e){if(a.setting.validator){let t=a.setting.validator(i.inputBox.value);if(t){i.containerElement.classList.add("invalid-input"),i.validationErrorMessageElement.innerText=t;let o=d(12555,null);return i.inputBox.inputElement.parentElement.setAttribute("aria-label",[o,t].join(" ")),e||Or(o+" "+t),!0}else i.inputBox.inputElement.parentElement.removeAttribute("aria-label")}return i.containerElement.classList.remove("invalid-input"),!1}function cWt(a,i,e,t){if(i.containerElement.classList.add("invalid-input"),a.setting.validator){let o=a.setting.validator(e);if(o&&o!==""){i.containerElement.classList.add("invalid-input"),i.validationErrorMessageElement.innerText=o;let n=d(12555,null);return i.containerElement.setAttribute("aria-label",[a.setting.key,n,o].join(" ")),t||Or(n+" "+o),!0}else i.containerElement.setAttribute("aria-label",a.setting.key),i.containerElement.classList.remove("invalid-input")}return!1}function Eao(a){for(let i=0;i<a.childNodes.length;i++){let e=a.childNodes.item(i);(e.tagName&&e.tagName.toLowerCase())==="img"?e.remove():Eao(e)}}function ZIi(a,i=!0){return a.replace(/`#([^#\s`]+)#`|'#([^#\s']+)#'/g,(e,t,o)=>{let n=t??o,r=w4(n),s=`${r.category}: ${r.label}`;return i?`[${s}](#${n} "${n}")`:`"${s}"`})}function oao(a){return a&&a.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}var ype=class{constructor(i,e,t){this.viewState=i;this.isFilteringGroups=e;this.environmentService=t}filter(i,e){if(this.viewState.categoryFilter&&i instanceof vw&&!this.settingContainedInGroup(i.setting,this.viewState.categoryFilter))return!1;if(i instanceof vw&&this.viewState.settingsTarget!==3){let t=!!this.environmentService.remoteAuthority;if(!i.matchesScope(this.viewState.settingsTarget,t))return!1}return i instanceof Gf?this.isFilteringGroups&&this.viewState.categoryFilter?this.groupIsRelatedToCategory(i,this.viewState.categoryFilter)?2:!1:typeof i.count=="number"?i.count>0:2:!(i instanceof ALe&&(this.viewState.tagFilters?.size||this.viewState.categoryFilter))}settingContainedInGroup(i,e){return e.children.some(t=>t instanceof Gf?this.settingContainedInGroup(i,t):t instanceof vw?t.setting.key===i.key:!1)}groupIsRelatedToCategory(i,e){if(i.id===e.id)return!0;let t=i.parent;for(;t;){if(t.id===e.id)return!0;t=t.parent}let o=e.parent;for(;o;){if(o.id===i.id)return!0;o=o.parent}return!1}};ype=I([m(2,Vt)],ype);var YIi=class extends d1{getTemplateId(i){if(i instanceof Gf)return xao;if(i instanceof vw)return i.valueType==="extension-toggle"?kao:i.isConfigured&&_bi(i.value,i.setting.type)?oWt:i.valueType==="boolean"?fao:i.valueType==="integer"||i.valueType==="number"||i.valueType==="nullable-integer"||i.valueType==="nullable-number"?hao:i.valueType==="multiline-string"?mao:i.valueType==="string"?pao:i.valueType==="enum"?gao:i.valueType==="array"?vao:i.valueType==="exclude"?bao:i.valueType==="include"?Sao:i.valueType==="object"?Iao:i.valueType==="boolean-object"?yao:i.valueType==="complex-object"?wao:(i.valueType==="language-tag",oWt);if(i instanceof ALe)return Cao;throw new Error("unknown element type: "+i)}hasDynamicHeight(i){return!(i instanceof Gf)}estimateHeight(i){return i instanceof Gf?42:i instanceof vw&&i.valueType==="boolean"?78:104}},XIi=class extends O1{isCollapsible(i){return!1}setCollapsed(i,e,t){return!1}},JIi=class{constructor(i,e,t){this.configurationService=i;this.languageService=e;this.userDataProfilesService=t}getAriaLabel(i){if(i instanceof vw){let e=[];if(e.push(`${i.displayCategory} ${i.displayLabel}.`),i.isConfigured){let n=d(12551,null);e.push(n)}let t=Jso(i,this.configurationService,this.userDataProfilesService,this.languageService);t.length&&e.push(`${t}.`);let o=qa({value:ZIi(i.description,!1)});return o.length&&e.push(o),e.join(" ")}else return i instanceof Gf?i.label:i.id}getWidgetAriaLabel(){return d(12549,null)}},OLe=class extends mg{constructor(i,e,t,o,n,r,s,l,c){super("SettingsTree",i,new YIi,t,{horizontalScrolling:!1,supportDynamicHeights:!0,scrollToActiveElement:!0,identityProvider:{getId(u){return u.id}},accessibilityProvider:new JIi(r,l,c),styleController:u=>new fae(hr(i),u),filter:s.createInstance(ype,e,!0),smoothScrolling:r.getValue("workbench.list.smoothScrolling"),multipleSelectionSupport:!1,findWidgetEnabled:!1,renderIndentGuides:"none",transformOptimization:!1},s,o,n,r),this.getHTMLElement().classList.add("settings-editor-tree"),this.style(GI({listBackground:qo,listActiveSelectionBackground:qo,listActiveSelectionForeground:ko,listFocusAndSelectionBackground:qo,listFocusAndSelectionForeground:ko,listFocusBackground:qo,listFocusForeground:ko,listHoverForeground:ko,listHoverBackground:qo,listHoverOutline:qo,listFocusOutline:qo,listInactiveSelectionBackground:qo,listInactiveSelectionForeground:ko,listInactiveFocusBackground:qo,listInactiveFocusOutline:qo,treeIndentGuidesStroke:void 0,treeInactiveIndentGuidesStroke:void 0})),this.disposables.add(r.onDidChangeConfiguration(u=>{u.affectsConfiguration("workbench.list.smoothScrolling")&&this.updateOptions({smoothScrolling:r.getValue("workbench.list.smoothScrolling")})}))}createModel(i,e){return new XIi(i,e)}};OLe=I([m(3,X),m(4,fo),m(5,Lv),m(6,F),m(7,kt),m(8,an)],OLe);var uZ=class extends st{constructor(e){super(uZ.ID,uZ.LABEL);this.clipboardService=e}static{this.ID="settings.copySettingId"}static{this.LABEL=d(12541,null)}async run(e){return e&&await this.clipboardService.writeText(e.setting.key),Promise.resolve(void 0)}};uZ=I([m(0,Wi)],uZ);var pZ=class extends st{constructor(e){super(pZ.ID,pZ.LABEL);this.clipboardService=e}static{this.ID="settings.copySettingAsJSON"}static{this.LABEL=d(12539,null)}async run(e){if(e){let t=`"${e.setting.key}": ${JSON.stringify(e.value,void 0," ")}`;await this.clipboardService.writeText(t)}return Promise.resolve(void 0)}};pZ=I([m(0,Wi)],pZ);var mZ=class extends st{constructor(e,t){super(mZ.ID,mZ.LABEL);this.clipboardService=e;this.productService=t}static{this.ID="settings.copySettingAsURL"}static{this.LABEL=d(12540,null)}async run(e){if(e){let t=e.setting.key,o=this.productService.urlProtocol,n=A.from({scheme:o,authority:AEe,path:`/${t}`},!0);await this.clipboardService.writeText(n.toString())}return Promise.resolve(void 0)}};mZ=I([m(0,Wi),m(1,nt)],mZ);var hZ=class extends st{constructor(e,t){super(hZ.ID,hZ.LABEL);this.setting=e;this.configService=t;this._register(H.filter(t.onDidChangeConfiguration,o=>o.affectsConfiguration("settingsSync.ignoredSettings"))(()=>this.update())),this.update()}static{this.ID="settings.stopSyncingSetting"}static{this.LABEL=d(12554,null)}async update(){let e=uFt(WJ(),this.configService);this.checked=!e.includes(this.setting.key)}async run(){let e=[...this.configService.getValue("settingsSync.ignoredSettings")];e=e.filter(r=>r!==this.setting.key&&r!==`-${this.setting.key}`);let o=WJ().includes(this.setting.key),n=!this.checked;return n&&o&&e.push(`-${this.setting.key}`),!n&&!o&&e.push(this.setting.key),this.configService.updateValue("settingsSync.ignoredSettings",e.length?e:void 0,2),Promise.resolve(void 0)}};hZ=I([m(1,B)],hZ);var gZ=class extends st{constructor(e,t){super(gZ.ID,gZ.LABEL);this.setting=e;this.configService=t;this._register(H.filter(t.onDidChangeConfiguration,o=>o.affectsConfiguration(IR))(()=>this.update())),this.update()}static{this.ID="settings.applyToAllProfiles"}static{this.LABEL=d(12538,null)}update(){let e=this.configService.getValue(IR);this.checked=e.includes(this.setting.key)}async run(){let e=this.configService.getValue(IR)??[];this.checked?e.splice(e.indexOf(this.setting.key),1):e.push(this.setting.key);let t=Uo(e);this.checked?(await this.configService.updateValue(this.setting.key,this.configService.inspect(this.setting.key).application?.value,3),await this.configService.updateValue(IR,t.length?t:void 0,3)):(await this.configService.updateValue(IR,t.length?t:void 0,3),await this.configService.updateValue(this.setting.key,this.configService.inspect(this.setting.key).userLocal?.value,3))}};gZ=I([m(1,Lv)],gZ);var Tao=_,FLe=class{constructor(i,e){this._viewState=i;this.environmentService=e;this._currentSearchModel=null}get settingsTreeRoot(){return this._settingsTreeRoot}set settingsTreeRoot(i){this._settingsTreeRoot=i,this.update()}get currentSearchModel(){return this._currentSearchModel}set currentSearchModel(i){this._currentSearchModel=i,this.update()}get children(){return this._settingsTreeRoot.children}update(){this._settingsTreeRoot&&this.updateGroupCount(this._settingsTreeRoot)}updateGroupCount(i){i.children.forEach(t=>{t instanceof Gf&&this.updateGroupCount(t)});let e=i.children.filter(t=>t instanceof Gf).reduce((t,o)=>t+o.count,0);i.count=e+this.getGroupCount(i)}getGroupCount(i){return i.children.filter(e=>{if(!(e instanceof vw)||this._currentSearchModel&&!this._currentSearchModel.root.containsSetting(e.setting.key))return!1;let t=!!this.environmentService.remoteAuthority;return e.matchesScope(this._viewState.settingsTarget,t)&&e.matchesAllTags(this._viewState.tagFilters)&&e.matchesAnyFeature(this._viewState.featureFilters)&&e.matchesAnyExtension(this._viewState.extensionFilters)&&e.matchesAnyId(this._viewState.idFilters)}).length}};FLe=I([m(1,Vt)],FLe);var _ao="settings.toc.entry",eyi=class{constructor(i){this._hoverService=i;this.templateId=_ao}renderTemplate(i){return{labelElement:R(i,Tao(".settings-toc-entry")),countElement:R(i,Tao(".settings-toc-count")),elementDisposables:new P}}renderElement(i,e,t){t.elementDisposables.clear();let o=i.element,n=o.count,r=o.label;t.labelElement.textContent=r,t.elementDisposables.add(this._hoverService.setupDelayedHover(t.labelElement,{content:r})),n?t.countElement.textContent=` (${n})`:t.countElement.textContent=""}disposeTemplate(i){i.elementDisposables.dispose()}},tyi=class{getTemplateId(i){return _ao}getHeight(i){return 22}};function oyi(a,i){let e=a.children.filter(t=>t instanceof Gf);return ht.map(e,t=>{let o=t.children.some(n=>n instanceof Gf);return{element:t,collapsed:void 0,collapsible:o,children:t instanceof Gf?oyi(t,i):void 0}})}var iyi=class{getWidgetAriaLabel(){return d(12587,null)}getAriaLabel(i){return i&&i instanceof Gf?d(12586,null,i.label):""}getAriaLevel(i){let e=1;for(;i instanceof Gf&&i.parent;)e++,i=i.parent;return e}},WLe=class extends mg{constructor(i,e,t,o,n,r,s){let c={filter:s.createInstance(ype,e,!1),multipleSelectionSupport:!1,identityProvider:{getId(u){return u.id}},styleController:u=>new fae(hr(i),u),accessibilityProvider:s.createInstance(iyi),collapseByDefault:!0,horizontalScrolling:!1,hideTwistiesOfChildlessElements:!0,renderIndentGuides:"none"};super("SettingsTOC",i,new tyi,[new eyi(r)],c,s,t,o,n),this.style(GI({listBackground:qo,listFocusOutline:Ad,listActiveSelectionBackground:qo,listActiveSelectionForeground:hJe,listFocusAndSelectionBackground:qo,listFocusAndSelectionForeground:hJe,listFocusBackground:qo,listFocusForeground:kIi,listHoverForeground:kIi,listHoverBackground:qo,listInactiveSelectionBackground:qo,listInactiveSelectionForeground:hJe,listInactiveFocusBackground:qo,listInactiveFocusOutline:qo,treeIndentGuidesStroke:void 0,treeInactiveIndentGuidesStroke:void 0}))}};WLe=I([m(2,X),m(3,fo),m(4,B),m(5,tt),m(6,F)],WLe);function Rao(a){return ht.map(a.children,i=>({element:i,children:i instanceof Gf?Rao(i):void 0}))}var eT=_,nyi=d(12414,null),Dao="workbench.settings.settingsSearchTocBehavior",b3o=d(12418,null),Lao=d(12417,null),S3o="settingsEditorState",td=class extends pa{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N,O,V,U){super(td.ID,e,t,r,h);this.configurationService=o;this.preferencesService=s;this.instantiationService=l;this.preferencesSearchService=c;this.logService=u;this.storageService=h;this.editorGroupService=g;this.userDataSyncWorkbenchService=f;this.userDataSyncEnablementService=v;this.workspaceTrustManagementService=b;this.extensionService=S;this.languageService=y;this.extensionManagementService=w;this.productService=k;this.extensionGalleryService=T;this.editorProgressService=N;this.keybindingService=V;this.chatEntitlementService=U;this.searchContainer=null;this.settingsTreeModel=this._register(new me);this.searchInProgress=null;this.aiSearchPromise=null;this.showAiResultsAction=null;this.pendingSettingUpdate=null;this._searchResultModel=this._register(new me);this.searchResultLabel=null;this.lastSyncedLabel=null;this.settingsOrderByTocIndex=null;this._currentFocusContext=0;this.hasWarnedMissingSettings=!1;this.tocTreeDisposed=!1;this.tocFocusedElement=null;this.treeFocusedElement=null;this.settingsTreeScrollTop=0;this.installedExtensionIds=[];this.dismissedExtensionSettings=[];this.DISMISSED_EXTENSION_SETTINGS_STORAGE_KEY="settingsEditor2.dismissedExtensionSettings";this.DISMISSED_EXTENSION_SETTINGS_DELIMITER=" ";this.searchInputActionBar=null;this.searchDelayer=this._register(new jo(200)),this.viewState={settingsTarget:3},this.settingFastUpdateDelayer=this._register(new jo(td.SETTING_UPDATE_FAST_DEBOUNCE)),this.settingSlowUpdateDelayer=this._register(new jo(td.SETTING_UPDATE_SLOW_DEBOUNCE)),this.searchInputDelayer=this._register(new jo(td.SEARCH_DEBOUNCE)),this.updatedConfigSchemaDelayer=this._register(new jo(td.CONFIG_SCHEMA_UPDATE_DELAYER)),this.inSettingsEditorContextKey=lD.bindTo(p),this.searchFocusContextKey=rpe.bindTo(p),this.tocRowFocused=C0t.bindTo(p),this.settingRowFocused=cJe.bindTo(p),this.aiResultsAvailable=k0t.bindTo(p),this.scheduledRefreshes=new Map,this.stopWatch=new En(!1),this.editorMemento=this.getEditorMemento(g,n,S3o),this.dismissedExtensionSettings=this.storageService.get(this.DISMISSED_EXTENSION_SETTINGS_STORAGE_KEY,0,"").split(this.DISMISSED_EXTENSION_SETTINGS_DELIMITER),this._register(o.onDidChangeConfiguration(G=>{(G.affectedKeys.has("workbench.settings.showAISearchToggle")||G.affectedKeys.has("workbench.settings.enableNaturalLanguageSearch"))&&this.updateAiSearchToggleVisibility(),G.affectsConfiguration(Umi)&&this.onConfigUpdate(void 0,!0,!0),G.source!==7&&this.onConfigUpdate(G.affectedKeys)})),this._register(U.onDidChangeSentiment(()=>{this.updateAiSearchToggleVisibility()})),this._register(O.onDidChangeCurrentProfile(G=>{G.join(this.whenCurrentProfileChanged())})),this._register(b.onDidChangeTrust(()=>{this.searchResultModel?.updateWorkspaceTrust(b.isWorkspaceTrusted()),this.settingsTreeModel.value&&(this.settingsTreeModel.value.updateWorkspaceTrust(b.isWorkspaceTrusted()),this.renderTree())})),this._register(o.onDidChangeRestrictedSettings(G=>{G.default.length&&this.currentSettingsModel&&this.updateElementsByKey(new Set(G.default))})),this._register(w.onDidInstallExtensions(()=>{this.refreshInstalledExtensionsList()})),this._register(w.onDidUninstallExtension(()=>{this.refreshInstalledExtensionsList()})),this.modelDisposables=this._register(new P),F0t&&!td.SUGGESTIONS.includes(`@${PF}`)&&td.SUGGESTIONS.push(`@${PF}`),this.inputChangeListener=this._register(new me)}static{this.ID="workbench.editor.settings2"}static{this.NUM_INSTANCES=0}static{this.SEARCH_DEBOUNCE=200}static{this.SETTING_UPDATE_FAST_DEBOUNCE=200}static{this.SETTING_UPDATE_SLOW_DEBOUNCE=1e3}static{this.CONFIG_SCHEMA_UPDATE_DELAYER=500}static{this.TOC_MIN_WIDTH=100}static{this.TOC_RESET_WIDTH=200}static{this.EDITOR_MIN_WIDTH=500}static{this.NARROW_TOTAL_WIDTH=this.TOC_RESET_WIDTH+this.EDITOR_MIN_WIDTH}static{this.SUGGESTIONS=[`@${NK}`,"@tag:notebookLayout","@tag:notebookOutputLayout",`@tag:${ILe}`,`@tag:${S4}`,"@tag:sync","@tag:usesOnlineServices","@tag:telemetry","@tag:accessibility","@tag:preview","@tag:experimental",`@tag:${I4}`,`@${dJe}`,`@${SLe}`,`@${hk}scm`,`@${hk}explorer`,`@${hk}search`,`@${hk}debug`,`@${hk}extensions`,`@${hk}terminal`,`@${hk}task`,`@${hk}problems`,`@${hk}output`,`@${hk}comments`,`@${hk}remote`,`@${hk}timeline`,`@${hk}notebook`,`@${hk}chat`,`@${uB}`]}static shouldSettingUpdateFast(e){return Array.isArray(e)?!1:e==="enum"||e==="array"||e==="boolean-object"||e==="object"||e==="complex"||e==="boolean"||e==="exclude"||e==="include"}async whenCurrentProfileChanged(){this.updatedConfigSchemaDelayer.trigger(()=>{this.dismissedExtensionSettings=this.storageService.get(this.DISMISSED_EXTENSION_SETTINGS_STORAGE_KEY,0,"").split(this.DISMISSED_EXTENSION_SETTINGS_DELIMITER),this.onConfigUpdate(void 0,!0)})}canShowAdvancedSettings(){return this.configurationService.getValue(Umi)??!1?!0:this.viewState.tagFilters?.has(I4)??!1}shouldShowSetting(e){return!!(!e.tags?.includes(I4)||this.viewState.idFilters?.has(e.key)||this.viewState.query?.toLowerCase().includes(e.key.toLowerCase())||this.viewState.tagFilters?.has(uB))}disableAiSearchToggle(){this.showAiResultsAction&&(this.showAiResultsAction.checked=!1,this.showAiResultsAction.enabled=!1,this.aiResultsAvailable.set(!1),this.showAiResultsAction.label=Lao)}updateAiSearchToggleVisibility(){if(!this.searchContainer||!this.showAiResultsAction||!this.searchInputActionBar)return;let e=this.configurationService.getValue("workbench.settings.showAISearchToggle"),t=this.configurationService.getValue("workbench.settings.enableNaturalLanguageSearch"),o=this.chatEntitlementService.sentiment.hidden||this.chatEntitlementService.sentiment.disabled,n=e&&t&&!o,r=this.searchInputActionBar.hasAction(this.showAiResultsAction);!r&&n?(this.searchInputActionBar.push(this.showAiResultsAction,{index:0,label:!1,icon:!0}),this.searchContainer.classList.add("with-ai-toggle")):r&&(this.searchInputActionBar.pull(0),this.searchContainer.classList.remove("with-ai-toggle"),this.showAiResultsAction.checked=!1)}get minimumWidth(){return td.EDITOR_MIN_WIDTH}get maximumWidth(){return Number.POSITIVE_INFINITY}get minimumHeight(){return 180}set minimumWidth(e){}set maximumWidth(e){}get currentSettingsModel(){return this.searchResultModel||this.settingsTreeModel.value}get searchResultModel(){return this._searchResultModel.value??null}set searchResultModel(e){this._searchResultModel.value=e??void 0,this.rootElement.classList.toggle("search-mode",!!this._searchResultModel.value)}get focusedSettingDOMElement(){let e=this.settingsTree.getFocus()[0];if(e instanceof vw)return this.settingRenderers.getDOMElementsForSettingKey(this.settingsTree.getHTMLElement(),e.setting.key)[0]}get currentFocusContext(){return this._currentFocusContext}createEditor(e){e.setAttribute("tabindex","-1"),this.rootElement=R(e,eT(".settings-editor",{tabindex:"-1"})),this.createHeader(this.rootElement),this.createBody(this.rootElement),this.addCtrlAInterceptor(this.rootElement),this.updateStyles(),this._register(zE({name:"settingsEditor2",focusNotifiers:[this],focusNextWidget:()=>{this.searchWidget.inputWidget.hasWidgetFocus()&&this.focusTOC()},focusPreviousWidget:()=>{this.searchWidget.inputWidget.hasWidgetFocus()||this.focusSearch()}}))}async setInput(e,t,o,n){if(this.inSettingsEditorContextKey.set(!0),await super.setInput(e,t,o,n),!this.input)return;let r=await this.input.resolve();if(!(n.isCancellationRequested||!(r instanceof NJ))){if(this.modelDisposables.clear(),this.modelDisposables.add(r.onDidChangeGroups(()=>{this.updatedConfigSchemaDelayer.trigger(()=>{this.onConfigUpdate(void 0,!1,!0)})})),this.defaultSettingsEditorModel=r,t=t||MEe({}),!this.viewState.settingsTarget||!this.settingsTargetsWidget.settingsTarget){let s=t.viewState&&t.viewState.settingsTarget;!t.target&&!s&&(t.target=3)}this._setOptions(t),this.onConfigUpdate(void 0,!0).then(()=>{this.inputChangeListener.value=e.onWillDispose(()=>{this.searchWidget.setValue("")}),this.updateTreeScrollSync()}),await this.refreshInstalledExtensionsList()}}async refreshInstalledExtensionsList(){let e=await this.extensionManagementService.getInstalled();this.installedExtensionIds=e.filter(t=>t.manifest.contributes?.configuration).map(t=>t.identifier.id)}restoreCachedState(){let e=this.input&&this.editorMemento.loadEditorState(this.group,this.input);if(e&&typeof e.target=="object"&&(e.target=A.revive(e.target)),e){let t=e.target;this.settingsTargetsWidget.settingsTarget=t,this.viewState.settingsTarget=t,this.searchWidget.getValue()||this.searchWidget.setValue(e.searchQuery)}return this.input&&this.editorMemento.clearEditorState(this.input,this.group),e??null}getViewState(){return this.viewState}setOptions(e){super.setOptions(e),e&&this._setOptions(e)}_setOptions(e){e.focusSearch&&!Nc&&this.focusSearch();let t=e.viewState?e.viewState:void 0,o=t?.query??e.query;o!==void 0&&(this.searchWidget.setValue(o),this.viewState.query=o);let n=e.folderUri??t?.settingsTarget??e.target;n&&this.settingsTargetsWidget.updateTarget(n)}clearInput(){this.inSettingsEditorContextKey.set(!1),super.clearInput()}layout(e){if(this.dimension=e,!this.isVisible())return;this.layoutSplitView(e);let o=Math.min(this.headerContainer.clientWidth,e.width)-48-10-this.controlsElement.clientWidth-12;this.searchWidget.layout(new ai(o,20)),this.rootElement.classList.toggle("narrow-width",e.width<td.NARROW_TOTAL_WIDTH)}focus(){if(super.focus(),this._currentFocusContext===0)Nc||this.focusSearch();else if(this._currentFocusContext===3){let e=this.focusedSettingDOMElement;if(e){let t=e.querySelector(hd.CONTROL_SELECTOR);if(t){t.focus();return}}}else this._currentFocusContext===2?this.settingsTree.domFocus():this._currentFocusContext===1&&this.tocTree.domFocus()}setEditorVisible(e){super.setEditorVisible(e),e||setTimeout(()=>{this.searchWidget.onHide(),this.settingRenderers.cancelSuggesters()},0)}focusSettings(e=!1){if(this.settingsTree.getFocus().length||this.settingsTree.focusFirst(),this.settingsTree.domFocus(),e){let o=this.settingsTree.getHTMLElement().querySelector(`.focused ${hd.CONTROL_SELECTOR}`);o&&o.focus()}}focusTOC(){this.tocTree.domFocus()}showContextMenu(){let e=this.settingsTree.getFocus()[0],t=this.focusedSettingDOMElement;t&&e instanceof vw&&this.settingRenderers.showContextMenu(e,t)}focusSearch(e,t=!0){e&&this.searchWidget&&this.searchWidget.setValue(e),this.searchWidget.focus(t&&!this.searchInputDelayer.isTriggered)}clearSearchResults(){this.disableAiSearchToggle(),this.searchWidget.setValue(""),this.focusSearch()}clearSearchFilters(){let t=this.searchWidget.getValue().split(" ").filter(o=>o.length&&!td.SUGGESTIONS.some(n=>o.startsWith(n)));this.searchWidget.setValue(t.join(" "))}updateInputAriaLabel(){let e=nyi;this.searchResultLabel&&(e+=`. ${this.searchResultLabel}`),this.lastSyncedLabel&&(e+=`. ${this.lastSyncedLabel}`),this.searchWidget.updateAriaLabel(e)}createHeader(e){this.headerContainer=R(e,eT(".settings-header")),this.searchContainer=R(this.headerContainer,eT(".search-container"));let t=this._register(new st(I0t,d(12402,null),q.asClassName(wLe),!1,async()=>this.clearSearchResults())),o=["action-label",q.asClassName(Aso)];this.showAiResultsAction=this._register(new st(pso,Lao,o.join(" "),!0)),this._register(this.showAiResultsAction.onDidChange(async()=>{await this.onDidToggleAiSearch()}));let n=this._register(new st(mso,d(12404,null),q.asClassName(Nso)));this.searchWidget=this._register(this.instantiationService.createInstance(tA,`${td.ID}.searchbox`,this.searchContainer,{triggerCharacters:["@",":"],provideResults:h=>{let g=h.split(/\s/g);return g[g.length-1].startsWith(`@${PF}`)?this.languageService.getRegisteredLanguageIds().map(v=>`@${PF}${v} `).sort().filter(v=>!h.includes(v)):g[g.length-1].startsWith(`@${SLe}`)?this.installedExtensionIds.map(v=>`@${SLe}${v} `).sort().filter(v=>!h.includes(v)):h===""||g[g.length-1].startsWith("@")?td.SUGGESTIONS.filter(f=>!h.includes(f)).map(f=>f.endsWith(":")?f:f+" "):[]}},nyi,"settingseditor:searchinput"+td.NUM_INSTANCES++,{placeholderText:nyi,focusContextKey:this.searchFocusContextKey,styleOverrides:{inputBorder:ZE}})),this._register(this.searchWidget.onDidFocus(()=>{this._currentFocusContext=0})),this._register(this.searchWidget.onInputDidChange(()=>{let h=this.searchWidget.getValue();t.enabled=!!h,this.searchInputDelayer.trigger(()=>this.onSearchInputChanged(!0))}));let r=R(this.headerContainer,eT(".settings-header-controls"));r.style.borderColor=wt(Oso);let s=R(r,eT(".settings-target-container"));this.settingsTargetsWidget=this._register(this.instantiationService.createInstance(CLe,s,{enableRemoteSettings:!0})),this.settingsTargetsWidget.settingsTarget=3,this._register(this.settingsTargetsWidget.onDidTargetChange(h=>this.onDidSettingsTargetChange(h))),this._register(j(s,re.KEY_DOWN,h=>{new Ii(h).keyCode===18&&this.focusSettings()}));let l=R(r,eT(".settings-right-controls")),c=R(l,eT(".open-settings-json")),u=this._register(new Mi(c,{secondary:!0,title:!0,...Ko}));if(u.label=d(12413,null),this._register(u.onDidClick(()=>this.openSettingsFile())),this.userDataSyncWorkbenchService.enabled&&this.userDataSyncEnablementService.canToggleEnablement()){let h=this._register(this.instantiationService.createInstance(LJe,this.window,l));this._register(h.onDidChangeLastSyncedLabel(g=>{this.lastSyncedLabel=g,this.updateInputAriaLabel()}))}this.controlsElement=R(this.searchContainer,_(".search-container-widgets")),this.countElement=R(this.controlsElement,_(".settings-count-widget.monaco-count-badge.long")),this.searchInputActionBar=this._register(new ji(this.controlsElement,{actionViewItemProvider:(h,g)=>{if(h.id===n.id)return this.instantiationService.createInstance(PLe,h,g,this.actionRunner,this.searchWidget);if(this.showAiResultsAction&&h.id===this.showAiResultsAction.id){let f=this.keybindingService.lookupKeybinding(y0t)?.getLabel();return new Gae(null,h,{...g,keybinding:f,toggleStyles:qg})}}}));let p=[t,n];this.searchInputActionBar.push(p,{label:!1,icon:!0}),this.disableAiSearchToggle(),this.updateAiSearchToggleVisibility()}toggleAiSearch(){this.searchInputActionBar&&this.showAiResultsAction&&this.searchInputActionBar.hasAction(this.showAiResultsAction)&&(this.showAiResultsAction.enabled||Or(d(12408,null)),this.showAiResultsAction.checked=!this.showAiResultsAction.checked)}async onDidToggleAiSearch(){this.searchResultModel&&this.showAiResultsAction&&(this.searchResultModel.showAiResults=this.showAiResultsAction.checked??!1,this.renderResultCountMessages(!1),this.onDidFinishSearch(!0,void 0))}onDidSettingsTargetChange(e){this.viewState.settingsTarget=e,this.onConfigUpdate(void 0,!0)}onDidDismissExtensionSetting(e){this.dismissedExtensionSettings.includes(e)||this.dismissedExtensionSettings.push(e),this.storageService.store(this.DISMISSED_EXTENSION_SETTINGS_STORAGE_KEY,this.dismissedExtensionSettings.join(this.DISMISSED_EXTENSION_SETTINGS_DELIMITER),0,0),this.onConfigUpdate(void 0,!0)}onDidClickSetting(e,t){let o=this.currentSettingsModel?.getElementsByName(e.targetKey)?.[0],n=!1;if(o){let r=.5;try{let s=this.settingsTree.getRelativeTop(e.source);s!==null&&(r=s)}catch{}this.viewState.categoryFilter&&e.source.displayCategory!==o.displayCategory&&this.tocTree.setFocus([]);try{this.settingsTree.reveal(o,r)}catch{n=!0}if(!n){setTimeout(()=>{this.settingsTree.setFocus([o])},50);let s=this.settingRenderers.getDOMElementsForSettingKey(this.settingsTree.getHTMLElement(),e.targetKey);if(s&&s[0]){let l=s[0].querySelector(hd.CONTROL_SELECTOR);l&&l.focus()}}}if(!t&&(!o||n)){let r=`@id:${e.targetKey}`;this.searchWidget.setValue(r),this.searchInputDelayer.cancel(),this.triggerSearch(r,!0).then(()=>{this.onDidClickSetting(e,!0)})}}switchToSettingsFile(){let e=Z0t(this.searchWidget.getValue()).query;return this.openSettingsFile({query:e})}async openSettingsFile(e){let t=this.settingsTargetsWidget.settingsTarget,o={jsonEditor:!0,groupId:this.group.id,...e};if(t===3){if(e?.revealSetting){let r=oe.as(ii.Configuration).getConfigurationProperties()[e?.revealSetting.key]?.scope;if(r&&AC.includes(r))return this.preferencesService.openApplicationSettings(o)}return this.preferencesService.openUserSettings(o)}else{if(t===4)return this.preferencesService.openRemoteSettings(o);if(t===5)return this.preferencesService.openWorkspaceSettings(o);if(A.isUri(t))return this.preferencesService.openFolderSettings({folderUri:t,...o})}}createBody(e){this.bodyContainer=R(e,eT(".settings-body")),this.noResultsMessage=R(this.bodyContainer,eT(".no-results-message")),this.noResultsMessage.innerText=d(12409,null),this.clearFilterLinkContainer=eT("span.clear-search-filters"),this.clearFilterLinkContainer.textContent=" - ";let t=R(this.clearFilterLinkContainer,eT("a.pointer.prominent",{tabindex:0},d(12403,null)));this._register(j(t,re.CLICK,r=>{$t.stop(r,!1),this.clearSearchFilters()})),R(this.noResultsMessage,this.clearFilterLinkContainer),this.noResultsMessage.style.color=wt(od),this.tocTreeContainer=eT(".settings-toc-container"),this.settingsTreeContainer=eT(".settings-tree-container"),this.createTOC(this.tocTreeContainer),this.createSettingsTree(this.settingsTreeContainer),this.splitView=this._register(new vu(this.bodyContainer,{orientation:1,proportionalLayout:!0}));let o=this.storageService.getNumber("settingsEditor2.splitViewWidth",0,td.TOC_RESET_WIDTH);this.splitView.addView({onDidChange:H.None,element:this.tocTreeContainer,minimumSize:td.TOC_MIN_WIDTH,maximumSize:Number.POSITIVE_INFINITY,layout:(r,s,l)=>{this.tocTreeContainer.style.width=`${r}px`,this.tocTree.layout(l,r)}},o,void 0,!0),this.splitView.addView({onDidChange:H.None,element:this.settingsTreeContainer,minimumSize:td.EDITOR_MIN_WIDTH,maximumSize:Number.POSITIVE_INFINITY,layout:(r,s,l)=>{this.settingsTreeContainer.style.width=`${r}px`,this.settingsTree.layout(l,r)}},Wl.Distribute,void 0,!0),this._register(this.splitView.onDidSashReset(()=>{let r=this.splitView.getViewSize(0)+this.splitView.getViewSize(1);this.splitView.resizeView(0,td.TOC_RESET_WIDTH),this.splitView.resizeView(1,r-td.TOC_RESET_WIDTH)})),this._register(this.splitView.onDidSashChange(()=>{let r=this.splitView.getViewSize(0);this.storageService.store("settingsEditor2.splitViewWidth",r,0,0)}));let n=this.theme.getColor(gJe);this.splitView.style({separatorBorder:n})}addCtrlAInterceptor(e){this._register(Vo(e,re.KEY_DOWN,t=>{t.keyCode===31&&(it?t.metaKey:t.ctrlKey)&&!Oh(t.target)&&(t.browserEvent.stopPropagation(),t.browserEvent.preventDefault())}))}createTOC(e){this.tocTreeModel=this.instantiationService.createInstance(FLe,this.viewState),this.tocTree=this._register(this.instantiationService.createInstance(WLe,R(e,eT(".settings-toc-wrapper",{role:"navigation","aria-label":d(12415,null)})),this.viewState)),this.tocTreeDisposed=!1,this._register(this.tocTree.onDidFocus(()=>{this._currentFocusContext=1})),this._register(this.tocTree.onDidChangeFocus(t=>{let o=t.elements?.[0]??null;this.tocFocusedElement!==o&&(this.tocFocusedElement=o,this.tocTree.setSelection(o?[o]:[]),this.viewState.categoryFilter!==o&&(this.viewState.categoryFilter=o??void 0,this.renderTree(void 0,!0),this.settingsTree.scrollTop=0))})),this._register(this.tocTree.onDidFocus(()=>{this.tocRowFocused.set(!0)})),this._register(this.tocTree.onDidBlur(()=>{this.tocRowFocused.set(!1)})),this._register(this.tocTree.onDidDispose(()=>{this.tocTreeDisposed=!0}))}applyFilter(e){if(this.searchWidget&&!this.searchWidget.getValue().includes(e)){let t=`${e} ${this.searchWidget.getValue().trimStart()}`;this.focusSearch(t,!1)}}removeLanguageFilters(){if(this.searchWidget&&this.searchWidget.getValue().includes(`@${PF}`)){let t=this.searchWidget.getValue().split(" ").filter(o=>!o.startsWith(`@${PF}`)).join(" ");this.focusSearch(t,!1)}}createSettingsTree(e){this.settingRenderers=this._register(this.instantiationService.createInstance(NLe)),this._register(this.settingRenderers.onDidChangeSetting(t=>this.onDidChangeSetting(t.key,t.value,t.type,t.manualReset,t.scope))),this._register(this.settingRenderers.onDidDismissExtensionSetting(t=>this.onDidDismissExtensionSetting(t))),this._register(this.settingRenderers.onDidOpenSettings(t=>{this.openSettingsFile({revealSetting:{key:t,edit:!0}})})),this._register(this.settingRenderers.onDidClickSettingLink(t=>this.onDidClickSetting(t))),this._register(this.settingRenderers.onDidFocusSetting(t=>{this.settingsTree.setFocus([t]),this._currentFocusContext=3,this.settingRowFocused.set(!1)})),this._register(this.settingRenderers.onDidChangeSettingHeight(t=>{let{element:o,height:n}=t;try{this.settingsTree.updateElementHeight(o,n)}catch{}})),this._register(this.settingRenderers.onApplyFilter(t=>this.applyFilter(t))),this._register(this.settingRenderers.onDidClickOverrideElement(t=>{this.removeLanguageFilters(),t.language&&this.applyFilter(`@${PF}${t.language}`),t.scope==="workspace"?this.settingsTargetsWidget.updateTarget(5):t.scope==="user"?this.settingsTargetsWidget.updateTarget(3):t.scope==="remote"&&this.settingsTargetsWidget.updateTarget(4),this.applyFilter(`@${dJe}${t.settingKey}`)})),this.settingsTree=this._register(this.instantiationService.createInstance(OLe,e,this.viewState,this.settingRenderers.allRenderers)),this._register(this.settingsTree.onDidScroll(()=>{this.settingsTree.scrollTop!==this.settingsTreeScrollTop&&(this.settingsTreeScrollTop=this.settingsTree.scrollTop,setTimeout(()=>{this.updateTreeScrollSync()},0))})),this._register(this.settingsTree.onDidFocus(()=>{let t=e.ownerDocument.activeElement?.classList;t&&t.contains("monaco-list")&&t.contains("settings-editor-tree")&&(this._currentFocusContext=2,this.settingRowFocused.set(!0),this.treeFocusedElement??=this.settingsTree.firstVisibleElement??null,this.treeFocusedElement&&(this.treeFocusedElement.tabbable=!0))})),this._register(this.settingsTree.onDidBlur(()=>{this.settingRowFocused.set(!1),this.treeFocusedElement=null})),this._register(this.settingsTree.onDidChangeFocus(t=>{let o=t.elements[0];this.treeFocusedElement!==o&&(this.treeFocusedElement&&(this.treeFocusedElement.tabbable=!1),this.treeFocusedElement=o,this.treeFocusedElement&&(this.treeFocusedElement.tabbable=!0),this.settingsTree.setSelection(o?[o]:[]))}))}onDidChangeSetting(e,t,o,n,r){let l=Z0t(this.searchWidget.getValue()).languageFilter;(n||this.pendingSettingUpdate&&this.pendingSettingUpdate.key!==e)&&this.updateChangedSetting(e,t,n,l,r),this.pendingSettingUpdate={key:e,value:t,languageFilter:l},td.shouldSettingUpdateFast(o)?this.settingFastUpdateDelayer.trigger(()=>this.updateChangedSetting(e,t,n,l,r)):this.settingSlowUpdateDelayer.trigger(()=>this.updateChangedSetting(e,t,n,l,r))}updateTreeScrollSync(){this.settingRenderers.cancelSuggesters()}updateChangedSetting(e,t,o,n,r){let s=this.settingsTargetsWidget.settingsTarget,l=A.isUri(s)?s:void 0,c=(l?6:s)??3,u={resource:l,overrideIdentifiers:n?[n]:void 0},h=c===5||c===6||!!n,g=h?o:t===void 0,f=this.configurationService.inspect(e,u);return!h&&f.defaultValue===t&&(t=void 0),this.configurationService.updateValue(e,t,u,c,{handleDirtyFile:"save"}).then(()=>{let v=this.searchWidget.getValue();v.includes(`@${NK}`)&&this.refreshTOCTree(),this.renderTree(e,g),this.pendingSettingUpdate=null;let b={key:e,query:v,searchResults:this.searchResultModel?.getUniqueSearchResults()??null,rawResults:this.searchResultModel?.getRawResults()??null,showConfiguredOnly:!!this.viewState.tagFilters&&this.viewState.tagFilters.has(NK),isReset:typeof t>"u",settingsTarget:this.settingsTargetsWidget.settingsTarget};return this.reportModifiedSetting(b)})}reportModifiedSetting(e){let t,o,n,r;if(e.searchResults&&(r=e.searchResults.filterMatches.findIndex(c=>c.setting.key===e.key),this.searchResultModel)){o=e.searchResults.filterMatches.find(u=>u.setting.key===e.key)?.providerName;let c=this.searchResultModel.getRawResults();if(c[0]&&r>=0&&(t=c[0].filterMatches.some(p=>p.setting.key===e.key)?"local":"remote"),c[1]){let u=c[1].filterMatches.findIndex(p=>p.setting.key===e.key);n=u>=0?u:void 0}}let s=e.settingsTarget===3?"user":e.settingsTarget===4?"user_remote":e.settingsTarget===5?"workspace":"folder",l={key:e.key,groupId:t,providerName:o,nlpIndex:n,displayIndex:r,showConfiguredOnly:e.showConfiguredOnly,isReset:e.isReset,target:s};this.telemetryService.publicLog2("settingsEditor.settingModified",l)}scheduleRefresh(e,t=""){if(t&&this.scheduledRefreshes.has(t))return;t||(Ue(this.scheduledRefreshes.values()),this.scheduledRefreshes.clear());let o=new P,n=Vn(e);o.add(n),o.add(n.onDidBlur(()=>{this.scheduledRefreshes.get(t)?.dispose(),this.scheduledRefreshes.delete(t),this.onConfigUpdate(new Set([t]))})),this.scheduledRefreshes.set(t,o)}createSettingsOrderByTocIndex(e){let t=new Map;function o(n,r=0){if(n.settings)for(let s of n.settings)t.has(s.key)||t.set(s.key,r++);if(n.children)for(let s of n.children)r=o(s,r);return r}return o(e),t}refreshModels(e){this.settingsTreeModel.value.update(e),this.tocTreeModel.settingsTreeRoot=this.settingsTreeModel.value.root,this.settingsOrderByTocIndex=this.createSettingsOrderByTocIndex(e)}async onConfigUpdate(e,t=!1,o=!1){if(e&&this.settingsTreeModel)return this.updateElementsByKey(e);if(!this.defaultSettingsEditorModel)return;let n=this.defaultSettingsEditorModel.settingsGroups.slice(1),r=[],s=[];for(let b of n)b.extensionInfo?s.push(b):r.push(b);let l=this.canShowAdvancedSettings()?void 0:{exclude:{tags:[I4]}},c=rao(kJe,r,l,this.logService),u=c.tree;if(c.leftoverSettings.size&&!this.hasWarnedMissingSettings){let b=[];c.leftoverSettings.forEach(S=>{b.push(S.key)}),this.logService.warn(`SettingsEditor2: Settings not included in settingsLayout.ts: ${b.join(", ")}`),this.hasWarnedMissingSettings=!0}let p=[],h=!1,g=await xso(this.chatEntitlementService,this.extensionGalleryService,this.productService);if(g&&n.filter(b=>b.extensionInfo).length)for(let b in g.settingsEditorRecommendedExtensions){let S=g.recommendedExtensionsGalleryInfo[b];if(!S)continue;let y=S.identifier.id;await this.refreshInstalledExtensionsList();let w=this.installedExtensionIds.includes(y),k=n.findIndex(pe=>pe.extensionInfo&&pe.extensionInfo.id.toLowerCase()===y.toLowerCase()&&pe.sections.length===1&&pe.sections[0].settings.length===1&&pe.sections[0].settings[0].displayExtensionId);if(w||this.dismissedExtensionSettings.includes(y)){k!==-1&&(n.splice(k,1),h=!0);continue}if(k!==-1)continue;let T=null;try{T=await Wp(this.extensionGalleryService.getManifest(S,ve.None),wIi)??null}catch{continue}if(T===null)continue;let N=T?.contributes?.configuration,O;Array.isArray(N)?N.length===1&&(O=N[0].title):O=N?.title;let V=g.settingsEditorRecommendedExtensions[b],U=S.displayName??S.name??y,G=`${b}.manageExtension`,$={range:wg,key:G,keyRange:wg,value:null,valueRange:wg,description:[V.onSettingsEditorOpen?.descriptionOverride??S.description],descriptionIsMarkdown:!1,descriptionRanges:[],scope:4,type:"null",displayExtensionId:y,extensionGroupTitle:O??U,categoryLabel:"Extensions",title:U},te={sections:[{settings:[$]}],id:y,title:$.extensionGroupTitle,titleRange:wg,range:wg,extensionInfo:{id:y,displayName:S.displayName}};n.push(te),p.push(te),h=!0}if(u.children.push(await aao(this.extensionService,s,l)),u.children.unshift(Qso(n)),g&&h&&this.defaultSettingsEditorModel.setAdditionalGroups(p),!this.workspaceTrustManagementService.isWorkspaceTrusted()&&(this.viewState.settingsTarget instanceof A||this.viewState.settingsTarget===5)){let b=sao(n,this.viewState.settingsTarget,this.viewState.languageFilter,this.configurationService);b.length&&u.children.unshift({id:"workspaceTrust",label:d(12416,null),settings:b})}this.searchResultModel?.updateChildren();let f=this.settingsTree.firstVisibleElement,v;if(f instanceof vw?v=f.setting.key:f instanceof Gf&&(v=f.id),this.settingsTreeModel.value){if(this.refreshModels(u),o&&this.searchResultModel)return await this.onSearchInputChanged(!1);if(this.refreshTOCTree(),this.renderTree(void 0,t),v){let b=this.settingsTreeModel.value,S,y=b.getElementsByName(v);if(y&&y.length>0)S=y[0];else{let w=k=>{for(let T of k){if(T.id===v)return T;if(T.children){for(let N of T.children)if(N instanceof Gf){let O=w([N]);if(O)return O}}}};S=w([b.root])}if(S)try{this.settingsTree.reveal(S,0)}catch{}}}else if(this.settingsTreeModel.value=this.instantiationService.createInstance(fpe,this.viewState,this.workspaceTrustManagementService.isWorkspaceTrusted()),this.refreshModels(u),(this.viewState.query?void 0:this.restoreCachedState())?.searchQuery||this.searchWidget.getValue())await this.onSearchInputChanged(!0);else{this.refreshTOCTree();let S=this.settingsTreeModel.value.root.children;if(Array.isArray(S)&&S.length>0){let y=S[0];y instanceof Gf&&(this.viewState.categoryFilter=y,this.tocTree.setFocus([y]),this.tocTree.setSelection([y]))}this.refreshTree(),this.tocTree.collapseAll()}}updateElementsByKey(e){e.size?(this.searchResultModel&&e.forEach(t=>this.searchResultModel.updateElementsByName(t)),this.settingsTreeModel.value&&e.forEach(t=>this.settingsTreeModel.value.updateElementsByName(t)),e.forEach(t=>this.renderTree(t))):this.renderTree()}getActiveControlInSettingsTree(){let e=this.settingsTree.getHTMLElement(),t=e.ownerDocument.activeElement;return t&&ts(e)?t:null}renderTree(e,t=!1){if(!t&&e&&this.scheduledRefreshes.has(e)){this.updateModifiedLabelForKey(e);return}if(this.contextViewFocused()){let r=this.window.document.querySelector(".context-view");r&&this.scheduleRefresh(r,e);return}let o=this.getActiveControlInSettingsTree(),n=o&&this.settingRenderers.getSettingDOMElementForDOMElement(o);if(n&&!t)if(e){if(n.getAttribute(hd.SETTING_KEY_ATTR)===e&&n.parentElement&&!n.parentElement.classList.contains("setting-item-list")){this.updateModifiedLabelForKey(e),this.scheduleRefresh(n,e);return}}else{this.scheduleRefresh(n);return}if(this.renderResultCountMessages(!1),e){let r=this.currentSettingsModel?.getElementsByName(e);if(r?.length)r.length>=2&&console.warn("More than one setting with key "+e+" found"),this.refreshSingleElement(r[0]);else return}else this.refreshTree()}contextViewFocused(){return!!Nh(this.rootElement.ownerDocument.activeElement,"context-view")}refreshSingleElement(e){this.isVisible()&&this.settingsTree.hasElement(e)&&(!e.setting.deprecationMessage||e.isConfigured)&&this.settingsTree.rerender(e)}refreshTree(){this.isVisible()&&this.currentSettingsModel&&this.settingsTree.setChildren(null,Rao(this.currentSettingsModel.root))}refreshTOCTree(){this.isVisible()&&(this.tocTreeModel.update(),this.tocTree.setChildren(null,oyi(this.tocTreeModel,this.tocTree)))}updateModifiedLabelForKey(e){if(!this.currentSettingsModel)return;let t=this.currentSettingsModel.getElementsByName(e),o=t&&t[0]&&t[0].isConfigured,n=this.settingRenderers.getDOMElementsForSettingKey(this.settingsTree.getHTMLElement(),e);n&&n[0]&&n[0].classList.toggle("is-configured",!!o)}async onSearchInputChanged(e){if(!this.currentSettingsModel)return;let t=this.searchWidget.getValue().trim();this.viewState.query=t,await this.triggerSearch(t.replace(/\u203A/g," "),e)}parseSettingFromJSON(e){let t=e.match(/"([a-zA-Z.]+)": /);return t&&t[1]}toggleTocBySearchBehaviorType(){this.configurationService.getValue(Dao)==="hide"?(this.splitView.setViewVisible(0,!1),this.splitView.style({separatorBorder:Oe.transparent})):this.layoutSplitView(this.dimension)}async triggerSearch(e,t){let o=this.editorProgressService.show(!0,800),n=this.viewState.tagFilters?.has(I4);if(this.viewState.tagFilters=new Set,this.viewState.extensionFilters=new Set,this.viewState.featureFilters=new Set,this.viewState.idFilters=new Set,this.viewState.languageFilter=void 0,e){let r=Z0t(e);e=r.query,r.tags.forEach(s=>this.viewState.tagFilters.add(s)),r.extensionFilters.forEach(s=>this.viewState.extensionFilters.add(s)),r.featureFilters.forEach(s=>this.viewState.featureFilters.add(s)),r.idFilters.forEach(s=>this.viewState.idFilters.add(s)),this.viewState.languageFilter=r.languageFilter}n!==this.viewState.tagFilters?.has(I4)&&await this.onConfigUpdate(),this.settingsTargetsWidget.updateLanguageFilterIndicators(this.viewState.languageFilter),e&&e!=="@"?(e=this.parseSettingFromJSON(e)||e,await this.triggerFilterPreferences(e,t,o),this.toggleTocBySearchBehaviorType()):(this.viewState.tagFilters.size||this.viewState.extensionFilters.size||this.viewState.featureFilters.size||this.viewState.idFilters.size||this.viewState.languageFilter?this.searchResultModel=this.createFilterModel():this.searchResultModel=null,this.searchDelayer.cancel(),this.searchInProgress&&(this.searchInProgress.dispose(!0),this.searchInProgress=null),t&&(this.tocTree.setFocus([]),this.viewState.categoryFilter=void 0),this.tocTreeModel.currentSearchModel=this.searchResultModel,this.searchResultModel?(t&&(this.tocTree.setSelection([]),this.tocTree.expandAll()),this.refreshTOCTree(),this.renderResultCountMessages(!1),this.refreshTree(),this.toggleTocBySearchBehaviorType()):this.tocTreeDisposed||(this.tocTree.collapseAll(),this.refreshTOCTree(),this.renderResultCountMessages(!1),this.refreshTree(),this.layoutSplitView(this.dimension)),o.done())}createFilterModel(){let e=this.instantiationService.createInstance(vpe,this.viewState,this.settingsOrderByTocIndex,this.workspaceTrustManagementService.isWorkspaceTrusted()),t={filterMatches:[],exactMatch:!1},o=this.canShowAdvancedSettings();for(let n of this.defaultSettingsEditorModel.settingsGroups.slice(1))for(let r of n.sections)for(let s of r.settings)!o&&!this.shouldShowSetting(s)||t.filterMatches.push({setting:s,matches:[],matchType:0,keyMatchScore:0,score:0,providerName:Cso});return e.setResult(0,t),e}async triggerFilterPreferences(e,t,o){this.searchInProgress&&(this.searchInProgress.dispose(!0),this.searchInProgress=null);let n=this.searchInProgress=new $e;return this.searchDelayer.trigger(async()=>{if(n.token.isCancellationRequested)return;this.disableAiSearchToggle();let r=await this.doLocalSearch(e,n.token);!this.searchResultModel||n.token.isCancellationRequested||(this.searchResultModel.showAiResults=!1,r&&r.filterMatches.length>0&&this.onDidFinishSearch(t,void 0),(!r||!r.exactMatch)&&await this.doRemoteSearch(e,n.token),!n.token.isCancellationRequested&&(this.aiSearchPromise&&this.aiSearchPromise.cancel(),this.searchInputActionBar&&this.showAiResultsAction&&this.searchInputActionBar.hasAction(this.showAiResultsAction)&&(this.aiSearchPromise=xn(s=>this.doAiSearch(e,s).then(l=>{l&&this.showAiResultsAction&&(this.showAiResultsAction.enabled=!0,this.aiResultsAvailable.set(!0),this.showAiResultsAction.label=b3o,this.renderResultCountMessages(!0))}).catch(l=>{so(l)||this.logService.trace("Error during AI settings search:",l)}))),this.onDidFinishSearch(t,o)))})}onDidFinishSearch(e,t){this.tocTreeModel.currentSearchModel=this.searchResultModel,e&&(this.tocTree.setFocus([]),this.viewState.categoryFilter=void 0,this.tocTree.expandAll(),this.settingsTree.scrollTop=0),this.refreshTOCTree(),this.renderTree(void 0,!0),t?.done()}doLocalSearch(e,t){let o=this.preferencesSearchService.getLocalSearchProvider(e);return this.searchWithProvider(0,o,W0t,t)}doRemoteSearch(e,t){let o=this.preferencesSearchService.getRemoteSearchProvider(e);return o?this.searchWithProvider(1,o,V0t,t):Promise.resolve(null)}async doAiSearch(e,t){let o=this.preferencesSearchService.getAiSearchProvider(e);if(!o)return null;let n=await this.searchWithProvider(3,o,B0t,t);if(!n||t.isCancellationRequested)return null;let r=await this.getLLMRankedResults(e,t);return t.isCancellationRequested?null:{filterMatches:n.filterMatches.concat(r?.filterMatches??[]),exactMatch:!1}}async getLLMRankedResults(e,t){let o=this.preferencesSearchService.getAiSearchProvider(e);if(!o)return null;this.stopWatch.reset();let n=await o.getLLMRankedResults(t);if(this.stopWatch.stop(),t.isCancellationRequested)return null;if(n&&n.filterMatches.length>0){let r=this.stopWatch.elapsed();this.logSearchPerformance(H0t,r)}return this.searchResultModel.setResult(4,n),n}async searchWithProvider(e,t,o,n){this.stopWatch.reset();let r=await this._searchPreferencesModel(this.defaultSettingsEditorModel,t,n);if(this.stopWatch.stop(),n.isCancellationRequested)return null;if(r&&!this.canShowAdvancedSettings()&&(r.filterMatches=r.filterMatches.filter(s=>this.shouldShowSetting(s.setting))),r&&r.filterMatches.length>0){let s=this.stopWatch.elapsed();this.logSearchPerformance(o,s)}return this.searchResultModel??=this.instantiationService.createInstance(vpe,this.viewState,this.settingsOrderByTocIndex,this.workspaceTrustManagementService.isWorkspaceTrusted()),this.searchResultModel.setResult(e,r),r}logSearchPerformance(e,t){this.telemetryService.publicLog2("settingsEditor.searchPerformance",{providerName:e,elapsedMs:t})}renderResultCountMessages(e){if(this.currentSettingsModel)if(this.clearFilterLinkContainer.style.display=this.viewState.tagFilters&&this.viewState.tagFilters.size>0?"initial":"none",this.searchResultModel){let t=this.searchResultModel.getUniqueResultsCount(),o;if(e)switch(t){case 0:o=d(12410,null);break;case 1:o=d(12412,null);break;default:o=d(12407,null,t)}else switch(t){case 0:o=d(12409,null);break;case 1:o=d(12411,null);break;default:o=d(12406,null,t)}this.searchResultLabel=o,this.updateInputAriaLabel(),this.countElement.innerText=o,Or(o),this.countElement.style.display!=="block"&&(this.countElement.style.display="block"),this.layout(this.dimension),this.rootElement.classList.toggle("no-results",t===0),this.splitView.el.style.visibility=t===0?"hidden":"visible"}else{this.countElement.style.display!=="none"&&(this.searchResultLabel=null,this.updateInputAriaLabel(),this.countElement.style.display="none",this.countElement.innerText="",this.layout(this.dimension)),this.rootElement.classList.remove("no-results"),this.splitView.el.style.visibility="visible";return}}async _searchPreferencesModel(e,t,o){try{return await t.searchModel(e,o)}catch(n){return so(n)?Promise.reject(n):null}}layoutSplitView(e){if(!this.isVisible())return;let t=e.height-97;if(this.splitView.el.style.height=`${t}px`,this.splitView.layout(this.bodyContainer.clientWidth,t),!(this.configurationService.getValue(Dao)==="hide"&&this.searchResultModel)){let r=this.splitView.isViewVisible(0),s=this.bodyContainer.clientWidth>=td.NARROW_TOTAL_WIDTH;this.splitView.setViewVisible(0,s),!r&&s&&this.bodyContainer.clientWidth>=td.EDITOR_MIN_WIDTH+td.TOC_RESET_WIDTH&&this.splitView.resizeView(0,td.TOC_RESET_WIDTH),this.splitView.style({separatorBorder:s?this.theme.getColor(gJe):Oe.transparent})}}saveState(){if(this.isVisible()){let e=this.searchWidget.getValue().trim(),t=this.settingsTargetsWidget.settingsTarget;this.input&&this.editorMemento.saveEditorState(this.group,this.input,{searchQuery:e,target:t})}else this.input&&this.editorMemento.clearEditorState(this.input,this.group);super.saveState()}};td=I([m(1,Te),m(2,Lv),m(3,Nn),m(4,De),m(5,Po),m(6,F),m(7,S0t),m(8,ne),m(9,X),m(10,le),m(11,Et),m(12,lI),m(13,_l),m(14,ns),m(15,lt),m(16,kt),m(17,ls),m(18,nt),m(19,ta),m(20,rd),m(21,mn),m(22,_e),m(23,vr)],td);var LJe=class extends C{constructor(e,t,o,n,r,s){super();this.commandService=o;this.userDataSyncService=n;this.userDataSyncEnablementService=r;this._onDidChangeLastSyncedLabel=this._register(new E);this.onDidChangeLastSyncedLabel=this._onDidChangeLastSyncedLabel.event;let l=R(t,eT(".turn-on-sync"));this.turnOnSyncButton=this._register(new Mi(l,{title:!0,...Ko})),this.lastSyncedLabel=R(t,eT(".last-synced-label")),xo(this.lastSyncedLabel),this.turnOnSyncButton.enabled=!0,this.turnOnSyncButton.label=d(12419,null),xo(this.turnOnSyncButton.element),this._register(this.turnOnSyncButton.onDidClick(async()=>{await this.commandService.executeCommand("workbench.userDataSync.actions.turnOn")})),this.updateLastSyncedTime(),this._register(this.userDataSyncService.onDidChangeLastSyncTime(()=>{this.updateLastSyncedTime()})),this._register(new ZD).cancelAndSet(()=>this.updateLastSyncedTime(),60*1e3,e),this.update(),this._register(this.userDataSyncService.onDidChangeStatus(()=>{this.update()})),this._register(this.userDataSyncEnablementService.onDidChangeEnablement(()=>{this.update()}))}updateLastSyncedTime(){let e=this.userDataSyncService.lastSyncTime,t;if(typeof e=="number"){let o=Bs(e,!0,void 0,!0);t=d(12405,null,o)}else t="";this.lastSyncedLabel.textContent=t,this._onDidChangeLastSyncedLabel.fire(t)}update(){this.userDataSyncService.status!=="uninitialized"&&(this.userDataSyncEnablementService.isEnabled()||this.userDataSyncService.status!=="idle"?(bn(this.lastSyncedLabel),xo(this.turnOnSyncButton.element)):(xo(this.lastSyncedLabel),bn(this.turnOnSyncButton.element)))}};LJe=I([m(2,ge),m(3,aI),m(4,_l),m(5,Te)],LJe);var I3o="settings.action.search",y3o="settings.action.focusSettingsFile",w3o="settings.action.focusSettingsFromSearch",C3o="settings.action.focusSettingsList",x3o="settings.action.focusTOC",k3o="settings.action.focusSettingControl",E3o="settings.action.focusLevelUp",T3o="settings.switchToJSON",_3o="settings.filterByOnline",D3o="settings.filterUntrusted",L3o="workbench.action.openSettings",R3o="settings.filterByTelemetry";oe.as(rn.EditorPane).registerEditorPane(ys.create(td,td.ID,d(12355,null)),[new Mt(oD)]);oe.as(rn.EditorPane).registerEditorPane(ys.create(y4,y4.ID,d(12344,null)),[new Mt(AJ)]);var syi=class{canSerialize(i){return!0}serialize(i){return""}deserialize(i){return i.createInstance(AJ)}};oe.as(rn.EditorPane).registerEditorPane(ys.create(xh,xh.ID,d(12320,null)),[new Mt(iD)]);var ayi=class{canSerialize(i){return!0}serialize(i){return""}deserialize(i){return i.createInstance(iD)}},lyi=class{canSerialize(i){return!0}serialize(i){return""}deserialize(i){return i.createInstance(oD)}};oe.as(rn.EditorFactory).registerEditorSerializer(AJ.ID,syi);oe.as(rn.EditorFactory).registerEditorSerializer(iD.ID,ayi);oe.as(rn.EditorFactory).registerEditorSerializer(oD.ID,lyi);var cyi=L(12338,"Open Settings (UI)"),M3o=L(12340,"Open User Settings (JSON)"),P3o=L(12327,"Open Application Settings (JSON)"),my=We.Preferences;function ryi(a){return Da(a)?a:void 0}function A3o(a){return Ae(a)?a:void 0}function WF(a){yi(a)||(a={});let i={focusSearch:ryi(a?.focusSearch),openToSide:ryi(a?.openToSide),query:A3o(a?.query)};return Ae(a?.revealSetting?.key)&&(i={...i,revealSetting:{key:a.revealSetting.key,edit:ryi(a.revealSetting?.edit)}}),i}var VLe=class extends C{constructor(e,t,o,n,r,s,l){super();this.environmentService=e;this.userDataProfileService=t;this.preferencesService=o;this.workspaceContextService=n;this.labelService=r;this.extensionService=s;this.userDataProfilesService=l;this.registerSettingsActions(),this.registerKeybindingsActions(),this.updatePreferencesEditorMenuItem(),this._register(n.onDidChangeWorkbenchState(()=>this.updatePreferencesEditorMenuItem())),this._register(n.onDidChangeWorkspaceFolders(()=>this.updatePreferencesEditorMenuItemForWorkspaceFolders()))}static{this.ID="workbench.contrib.preferencesActions"}registerSettingsActions(){this._register(W(class extends K{constructor(){super({id:L3o,title:{...L(12345,"Settings"),mnemonicTitle:d(12323,null)},keybinding:{weight:200,when:null,primary:2135},menu:[{id:D.GlobalActivity,group:"2_configuration",order:2},{id:D.MenubarPreferencesMenu,group:"2_configuration",order:2}]})}run(t,o){let n=typeof o=="string"?{query:o}:WF(o);return t.get(Po).openSettings({...n})}})),this._register(W(class extends K{constructor(){super({id:"workbench.action.openSettings2",title:L(12338,"Open Settings (UI)"),category:my,f1:!0})}run(t,o){return o=WF(o),t.get(Po).openSettings({jsonEditor:!1,...o})}})),this._register(W(class extends K{constructor(){super({id:"workbench.action.openSettingsJson",title:M3o,metadata:{description:L(12359,"Opens the JSON file containing the current user profile settings")},category:my,f1:!0})}run(t,o){return o=WF(o),t.get(Po).openSettings({jsonEditor:!0,...o})}}));let e=this;this._register(W(class extends K{constructor(){super({id:"workbench.action.openApplicationSettingsJson",title:P3o,category:my,menu:{id:D.CommandPalette,when:x.notEquals(I9e.key,e.userDataProfilesService.defaultProfile.id)}})}run(t,o){return o=WF(o),t.get(Po).openApplicationSettings({jsonEditor:!0,...o})}})),this._register(W(class extends K{constructor(){super({id:"workbench.action.openGlobalSettings",title:L(12334,"Open User Settings"),category:my,f1:!0})}run(t,o){return o=WF(o),t.get(Po).openUserSettings(o)}})),this._register(W(class extends K{constructor(){super({id:"workbench.action.openRawDefaultSettings",title:L(12335,"Open Default Settings (JSON)"),category:my,f1:!0})}run(t){return t.get(Po).openRawDefaultSettings()}})),this._register(W(class extends K{constructor(){super({id:FK.ID,title:FK.LABEL,category:my,f1:!0})}run(t){return t.get(F).createInstance(FK,FK.ID,FK.LABEL.value).run()}})),this._register(W(class extends K{constructor(){super({id:"workbench.action.openWorkspaceSettings",title:L(12341,"Open Workspace Settings"),category:my,menu:{id:D.CommandPalette,when:Qa.notEqualsTo("empty")}})}run(t,o){return o=typeof o=="string"?{query:o}:WF(o),t.get(Po).openWorkspaceSettings(o)}})),this._register(W(class extends K{constructor(){super({id:"workbench.action.openAccessibilitySettings",title:L(12326,"Open Accessibility Settings"),category:my,menu:{id:D.CommandPalette,when:Qa.notEqualsTo("empty")}})}async run(t){await t.get(Po).openSettings({jsonEditor:!1,query:"@tag:accessibility"})}})),this._register(W(class extends K{constructor(){super({id:"workbench.action.openWorkspaceSettingsFile",title:L(12342,"Open Workspace Settings (JSON)"),category:my,menu:{id:D.CommandPalette,when:Qa.notEqualsTo("empty")}})}run(t,o){return o=WF(o),t.get(Po).openWorkspaceSettings({jsonEditor:!0,...o})}})),this._register(W(class extends K{constructor(){super({id:"workbench.action.openFolderSettings",title:L(12329,"Open Folder Settings"),category:my,menu:{id:D.CommandPalette,when:Qa.isEqualTo("workspace")}})}async run(t,o){let n=t.get(ge),r=t.get(Po),s=await n.executeCommand(SR);s&&(o=WF(o),await r.openFolderSettings({folderUri:s.uri,...o}))}})),this._register(W(class extends K{constructor(){super({id:"workbench.action.openFolderSettingsFile",title:L(12331,"Open Folder Settings (JSON)"),category:my,menu:{id:D.CommandPalette,when:Qa.isEqualTo("workspace")}})}async run(t,o){let n=t.get(ge),r=t.get(Po),s=await n.executeCommand(SR);s&&(o=WF(o),await r.openFolderSettings({folderUri:s.uri,jsonEditor:!0,...o}))}})),this._register(W(class extends K{constructor(){super({id:"_workbench.action.openFolderSettings",title:d(12330,null),category:my,menu:{id:D.ExplorerContext,group:"2_workspace",order:20,when:x.and(FC,lu)}})}async run(t,o){if(A.isUri(o))await t.get(Po).openFolderSettings({folderUri:o});else{let n=t.get(ge),r=t.get(Po),s=await n.executeCommand(SR);s&&await r.openFolderSettings({folderUri:s.uri})}}})),this._register(W(class extends K{constructor(){super({id:_3o,title:d(12322,null),menu:{id:D.MenubarPreferencesMenu,group:"3_settings",order:1}})}run(t){let o=t.get(ee).activeEditorPane;o instanceof td?o.focusSearch("@tag:usesOnlineServices"):t.get(Po).openSettings({jsonEditor:!1,query:"@tag:usesOnlineServices"})}})),this._register(W(class extends K{constructor(){super({id:y0t,precondition:lD,keybinding:{primary:2087,weight:100,when:k0t},category:my,f1:!0,title:L(12354,"Toggle AI Settings Search")})}run(t){let o=t.get(ee).activeEditorPane;o instanceof td&&o.toggleAiSearch()}})),this._register(W(class extends K{constructor(){super({id:D3o,title:L(12319,"Show untrusted workspace settings")})}run(t){t.get(Po).openWorkspaceSettings({jsonEditor:!1,query:`@tag:${ILe}`})}})),this._register(W(class extends K{constructor(){super({id:R3o,title:d(12324,null)})}run(t){let o=t.get(ee).activeEditorPane;o instanceof td?o.focusSearch("@tag:telemetry"):t.get(Po).openSettings({jsonEditor:!1,query:"@tag:telemetry"})}})),this.registerSettingsEditorActions(),this.extensionService.whenInstalledExtensionsRegistered().then(()=>{let t=this.environmentService.remoteAuthority,o=this.labelService.getHostLabel(Y.vscodeRemote,t)||t;this._register(W(class extends K{constructor(){super({id:"workbench.action.openRemoteSettings",title:L(12336,"Open Remote Settings ({0})",o),category:my,menu:{id:D.CommandPalette,when:ub.notEqualsTo("")}})}run(n,r){return r=WF(r),n.get(Po).openRemoteSettings(r)}})),this._register(W(class extends K{constructor(){super({id:"workbench.action.openRemoteSettingsFile",title:L(12337,"Open Remote Settings (JSON) ({0})",o),category:my,menu:{id:D.CommandPalette,when:ub.notEqualsTo("")}})}run(n,r){return r=WF(r),n.get(Po).openRemoteSettings({jsonEditor:!0,...r})}}))})}registerSettingsEditorActions(){function e(o){let n=o.get(ee).activeEditorPane;return n instanceof td?n:null}function t(o){e(o)?.focusSearch()}this._register(W(class extends K{constructor(){super({id:I3o,precondition:lD,keybinding:{primary:2084,weight:100,when:null},category:my,f1:!0,title:L(12349,"Focus Settings Search")})}run(o){t(o)}})),this._register(W(class extends K{constructor(){super({id:I0t,precondition:lD,keybinding:{primary:9,weight:100,when:rpe},category:my,f1:!0,title:L(12346,"Clear Settings Search Results")})}run(o){e(o)?.clearSearchResults()}})),this._register(W(class extends K{constructor(){super({id:y3o,precondition:x.and(rpe,$n.Visible.toNegated()),keybinding:{primary:18,weight:100,when:null},title:d(12347,null)})}run(o){e(o)?.focusSettings()}})),this._register(W(class extends K{constructor(){super({id:w3o,precondition:x.and(rpe,$n.Visible.toNegated()),keybinding:{primary:18,weight:200,when:null},title:d(12347,null)})}run(o){e(o)?.focusSettings()}})),this._register(W(class extends K{constructor(){super({id:C3o,precondition:x.and(lD,C0t),keybinding:{primary:3,weight:200,when:null},title:d(12351,null)})}run(o){let n=e(o);n instanceof td&&n.focusSettings()}})),this._register(W(class extends K{constructor(){super({id:x3o,precondition:lD,f1:!0,keybinding:[{primary:15,weight:200,when:cJe}],category:my,title:L(12352,"Focus Settings Table of Contents")})}run(o){let n=e(o);n instanceof td&&n.focusTOC()}})),this._register(W(class extends K{constructor(){super({id:k3o,precondition:x.and(lD,cJe),keybinding:{primary:3,weight:200},title:d(12350,null)})}run(o){let n=e(o);if(!(n instanceof td))return;n.getContainer()?.ownerDocument.activeElement?.classList.contains("monaco-list")&&n.focusSettings(!0)}})),this._register(W(class extends K{constructor(){super({id:w0t,precondition:lD,keybinding:{primary:1091,weight:200,when:null},f1:!0,category:my,title:L(12353,"Show Setting Context Menu")})}run(o){let n=e(o);n instanceof td&&n.showContextMenu()}})),this._register(W(class extends K{constructor(){super({id:E3o,precondition:x.and(lD,rpe.toNegated(),IIi.toNegated()),keybinding:{primary:9,weight:200,when:null},f1:!0,category:my,title:L(12348,"Move Focus Up One Level")})}run(o){let n=e(o);n instanceof td&&(n.currentFocusContext===3?n.focusSettings():n.currentFocusContext===2?n.focusTOC():n.currentFocusContext===1&&n.focusSearch())}}))}registerKeybindingsActions(){let e=this,t=L(12343,"Preferences"),o="workbench.action.openGlobalKeybindings";this._register(W(class extends K{constructor(){super({id:o,title:L(12332,"Open Keyboard Shortcuts"),shortTitle:d(12321,null),category:t,icon:dpe,keybinding:{when:null,weight:200,primary:Ai(2089,2097)},menu:[{id:D.CommandPalette},{id:D.EditorTitle,when:Fo.Resource.isEqualTo(e.userDataProfileService.currentProfile.keybindingsResource.toString()),group:"navigation",order:1},{id:D.GlobalActivity,group:"2_configuration",order:4}]})}run(n,...r){let s=typeof r[0]=="string"?r[0]:void 0,l=fZ(n,r)?.id;return n.get(Po).openGlobalKeybindingSettings(!1,{query:s,groupId:l})}})),this._register(fe.appendMenuItem(D.MenubarPreferencesMenu,{command:{id:o,title:d(12321,null)},group:"2_configuration",order:4})),this._register(W(class extends K{constructor(){super({id:"workbench.action.openDefaultKeybindingsFile",title:L(12328,"Open Default Keyboard Shortcuts (JSON)"),category:t,menu:{id:D.CommandPalette}})}run(n){return n.get(Po).openDefaultKeybindingsFile()}})),this._register(W(class extends K{constructor(){super({id:"workbench.action.openGlobalKeybindingsFile",title:L(12333,"Open Keyboard Shortcuts (JSON)"),category:t,icon:dpe,menu:[{id:D.CommandPalette},{id:D.EditorTitle,when:x.and(nf),group:"navigation"}]})}run(n,...r){let s=fZ(n,r)?.id;return n.get(Po).openGlobalKeybindingSettings(!0,{groupId:s})}})),this._register(W(class extends K{constructor(){super({id:Sso,title:L(12356,"Show System Keybindings"),menu:[{id:D.EditorTitle,when:x.and(nf),group:"1_keyboard_preferences_actions"}]})}run(n,...r){let l=fZ(n,r)?.activeEditorPane;l instanceof xh&&l.search("@source:system")}})),this._register(W(class extends K{constructor(){super({id:yso,title:L(12357,"Show Extension Keybindings"),menu:[{id:D.EditorTitle,when:x.and(nf),group:"1_keyboard_preferences_actions"}]})}run(n,...r){let l=fZ(n,r)?.activeEditorPane;l instanceof xh&&l.search("@source:extension")}})),this._register(W(class extends K{constructor(){super({id:Iso,title:L(12358,"Show User Keybindings"),menu:[{id:D.EditorTitle,when:x.and(nf),group:"1_keyboard_preferences_actions"}]})}run(n,...r){let l=fZ(n,r)?.activeEditorPane;l instanceof xh&&l.search("@source:user")}})),this._register(W(class extends K{constructor(){super({id:E0t,title:d(12316,null),keybinding:{weight:200,when:x.and(nf,vLe,x0t),primary:9}})}run(n){let r=n.get(ee).activeEditorPane;r instanceof xh&&r.clearSearchResults()}})),this._register(W(class extends K{constructor(){super({id:gso,title:d(12317,null),category:t,menu:[{id:D.CommandPalette,when:x.and(nf)}]})}run(n){let r=n.get(ee).activeEditorPane;r instanceof xh&&r.clearKeyboardShortcutSearchHistory()}})),this.registerKeybindingEditorActions()}registerKeybindingEditorActions(){let e=this;yt.registerCommandAndKeybindingRule({id:bLe,weight:200,when:x.and(nf,MF,spe.toNegated()),primary:3,handler:(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof xh&&s.defineKeybinding(s.activeKeybindingEntry,!1)}}),yt.registerCommandAndKeybindingRule({id:D0t,weight:200,when:x.and(nf,MF),primary:Ai(2089,2079),handler:(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof xh&&s.defineKeybinding(s.activeKeybindingEntry,!0)}}),yt.registerCommandAndKeybindingRule({id:L0t,weight:200,when:x.and(nf,MF),primary:Ai(2089,2083),handler:(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof xh&&s.activeKeybindingEntry.keybindingItem.keybinding&&s.defineWhenExpression(s.activeKeybindingEntry)}}),yt.registerCommandAndKeybindingRule({id:R0t,weight:200,when:x.and(nf,MF,$h.toNegated()),primary:20,mac:{primary:2049},handler:(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof xh&&s.removeKeybinding(s.activeKeybindingEntry)}}),yt.registerCommandAndKeybindingRule({id:M0t,weight:200,when:x.and(nf,MF),primary:0,handler:(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof xh&&s.resetKeybinding(s.activeKeybindingEntry)}}),yt.registerCommandAndKeybindingRule({id:hso,weight:200,when:x.and(nf),primary:2084,handler:(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof xh&&s.focusSearch()}}),yt.registerCommandAndKeybindingRule({id:T0t,weight:200,when:x.and(nf,vLe),primary:553,mac:{primary:2601},handler:(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof xh&&s.recordSearchKeys()}}),yt.registerCommandAndKeybindingRule({id:_0t,weight:200,when:x.and(nf),primary:558,mac:{primary:2606},handler:(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof xh&&s.toggleSortByPrecedence()}}),yt.registerCommandAndKeybindingRule({id:O0t,weight:200,when:x.and(nf,MF),primary:0,handler:(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof xh&&s.showSimilarKeybindings(s.activeKeybindingEntry)}}),yt.registerCommandAndKeybindingRule({id:P0t,weight:200,when:x.and(nf,MF,spe.negate()),primary:2081,handler:async(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof xh&&await s.copyKeybinding(s.activeKeybindingEntry)}}),yt.registerCommandAndKeybindingRule({id:A0t,weight:200,when:x.and(nf,MF),primary:0,handler:async(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof xh&&await s.copyKeybindingCommand(s.activeKeybindingEntry)}}),yt.registerCommandAndKeybindingRule({id:N0t,weight:200,when:x.and(nf,MF),primary:0,handler:async(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof xh&&await s.copyKeybindingCommandTitle(s.activeKeybindingEntry)}}),yt.registerCommandAndKeybindingRule({id:bso,weight:200,when:x.and(nf,vLe),primary:2066,handler:(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof xh&&s.focusKeybindings()}}),yt.registerCommandAndKeybindingRule({id:vso,weight:200,when:x.and(nf,spe,$n.Visible.toNegated()),primary:9,handler:async(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof xh&&s.rejectWhenExpression(s.activeKeybindingEntry)}}),yt.registerCommandAndKeybindingRule({id:fso,weight:200,when:x.and(nf,spe,$n.Visible.toNegated()),primary:3,handler:async(n,r)=>{let s=n.get(ee).activeEditorPane;s instanceof xh&&s.acceptWhenExpression(s.activeKeybindingEntry)}});let t=this._register(new P),o=()=>{t.clear(),t.add(W(class extends K{constructor(){let r=Fo.Resource.isEqualTo(e.userDataProfileService.currentProfile.keybindingsResource.toString());super({id:"editor.action.defineKeybinding",title:L(12318,"Define Keybinding"),f1:!0,precondition:r,keybinding:{weight:200,when:r,primary:Ai(2089,2089)},menu:{id:D.EditorContent,when:r}})}async run(r){let s=r.get(ee).activeTextEditorControl;pn(s)&&s.getContribution(qLt)?.showDefineKeybindingWidget()}}))};o(),this._register(this.userDataProfileService.onDidChangeCurrentProfile(()=>o()))}updatePreferencesEditorMenuItem(){let e="_workbench.openWorkspaceSettingsEditor";this.workspaceContextService.getWorkbenchState()===3&&!qe.getCommand(e)&&(qe.registerCommand(e,()=>this.preferencesService.openWorkspaceSettings({jsonEditor:!1})),fe.appendMenuItem(D.EditorTitle,{command:{id:e,title:cyi,icon:dpe},when:x.and(Fo.Resource.isEqualTo(this.preferencesService.workspaceSettingsResource.toString()),Qa.isEqualTo("workspace"),x.not("isInDiffEditor")),group:"navigation",order:1})),this.updatePreferencesEditorMenuItemForWorkspaceFolders()}updatePreferencesEditorMenuItemForWorkspaceFolders(){for(let e of this.workspaceContextService.getWorkspace().folders){let t=`_workbench.openFolderSettings.${e.uri.toString()}`;qe.getCommand(t)||(qe.registerCommand(t,(o,...n)=>{let r=fZ(o,n)?.id;return this.workspaceContextService.getWorkbenchState()===2?this.preferencesService.openWorkspaceSettings({jsonEditor:!1,groupId:r}):this.preferencesService.openFolderSettings({folderUri:e.uri,jsonEditor:!1,groupId:r})}),fe.appendMenuItem(D.EditorTitle,{command:{id:t,title:cyi,icon:dpe},when:x.and(Fo.Resource.isEqualTo(this.preferencesService.getFolderSettingsResource(e.uri).toString()),x.not("isInDiffEditor")),group:"navigation",order:1}))}}};VLe=I([m(0,Vt),m(1,mn),m(2,Po),m(3,Pe),m(4,ot),m(5,lt),m(6,an)],VLe);var BLe=class extends C{constructor(e,t){super();this.userDataProfileService=e;this.userDataProfilesService=t;this.registerSettingsEditorTitleActions()}static{this.ID="workbench.contrib.settingsEditorTitleBarActions"}registerSettingsEditorTitleActions(){let e=this._register(new me),t=()=>{let n=x.and(lD.toNegated(),x.or(Fo.Resource.isEqualTo(this.userDataProfileService.currentProfile.settingsResource.toString()),Fo.Resource.isEqualTo(this.userDataProfilesService.defaultProfile.settingsResource.toString())),x.not("isInDiffEditor"));e.clear(),e.value=W(class extends K{constructor(){super({id:"_workbench.openUserSettingsEditor",title:cyi,icon:dpe,menu:[{id:D.EditorTitle,when:n,group:"navigation",order:1}]})}run(r,...s){let l=WF(s[0]),c=fZ(r,s)?.id;return r.get(Po).openUserSettings({jsonEditor:!1,...l,groupId:c})}})};t(),this._register(this.userDataProfileService.onDidChangeCurrentProfile(()=>{t()}));let o=x.and(IIi.toNegated(),lD);this._register(W(class extends K{constructor(){super({id:T3o,title:L(12339,"Open Settings (JSON)"),icon:dpe,menu:[{id:D.EditorTitle,when:o,group:"navigation",order:1}]})}run(n,...r){let l=fZ(n,r)?.activeEditorPane;return l instanceof td?l.switchToSettingsFile():null}}))}};BLe=I([m(0,mn),m(1,an)],BLe);var HLe=class extends C{constructor(e,t,o,n){super();this.editor=e;this.instantiationService=t;this.preferencesService=o;this.workspaceContextService=n;this.disposables=this._register(new P);this._createPreferencesRenderer(),this._register(this.editor.onDidChangeModel(r=>this._createPreferencesRenderer())),this._register(this.workspaceContextService.onDidChangeWorkbenchState(()=>this._createPreferencesRenderer()))}static{this.ID="editor.contrib.settings"}async _createPreferencesRenderer(){this.disposables.clear(),this.currentRenderer=void 0;let e=this.editor.getModel();if(e&&/\.(json|code-workspace)$/.test(e.uri.path)){let t=await this.preferencesService.createPreferencesEditorModel(e.uri);t instanceof Pue&&this.editor.getModel()&&(this.disposables.add(t),t.configurationTarget===5?this.currentRenderer=this.disposables.add(this.instantiationService.createInstance(MLe,this.editor,t)):this.currentRenderer=this.disposables.add(this.instantiationService.createInstance(hpe,this.editor,t))),this.currentRenderer?.render()}}};HLe=I([m(1,F),m(2,Po),m(3,Pe)],HLe);function fZ(a,i){return lp(i,a.get(ee),a.get(Et),a.get(fo)).groupedEditors[0]?.group}pt(VLe.ID,VLe,ut.BlockStartup);pt(lpe.ID,lpe,ut.BlockStartup);pt(BLe.ID,BLe,ut.AfterRestored);go(HLe.ID,HLe,1);fe.appendMenuItem(D.MenubarFileMenu,{title:d(12325,null),submenu:D.MenubarPreferencesMenu,group:"5_autosave",order:2,when:Mx.toNegated()});var dWt=class{static hasOpenBrace(i){for(;i.scan()!==17;)if(i.getToken()===1)return!0;return!1}static offsetToPosition(i,e){let t=0,o=i.getEOL().length,n=i.getLineCount();for(let r=1;r<=n;r++){let s=i.getLineLength(r)+o,l=t+s;if(l>e)return new Ie(r,e-t+1);t=l}return new Ie(n,i.getLineMaxColumn(n))}static insertSnippet(i,e){let t=i.getValueLengthInRange(new z(1,1,e.lineNumber,e.column)),o;(b=>(b[b.INVALID=0]="INVALID",b[b.AFTER_OBJECT=1]="AFTER_OBJECT",b[b.BEFORE_OBJECT=2]="BEFORE_OBJECT"))(o||={});let n=0,r=-1,s=0,l=$le(i.getValue()),c=0,u=0,p=(g,f)=>{f!==0&&c===1&&u===0?(n=f,r=g,s=f):n!==0&&(n=0,r=l.getTokenOffset())};for(;l.scan()!==17;){let g=l.getPosition(),f=l.getToken(),v=!1;switch(f){case 3:v=!0,c++,p(g,2);break;case 4:v=!0,c--,p(g,0);break;case 5:v=!0,p(g,2);break;case 1:v=!0,u++,p(g,0);break;case 2:v=!0,u--,p(g,1);break;case 15:case 14:v=!0}if(g>=t&&(n!==0||r!==-1)){let b,S;return n!==0?(b=v?g:l.getTokenOffset(),S=n):(b=r,S=s),S===1?{position:this.offsetToPosition(i,b),prepend:",",append:""}:(l.setPosition(b),{position:this.offsetToPosition(i,b),prepend:"",append:this.hasOpenBrace(l)?",":""})}}let h=i.getLineCount();return{position:new Ie(h,i.getLineMaxColumn(h)),prepend:`
[`,append:"]"}}};var vZ=class extends Ibe{constructor(i,e){if(super(),e.length===0)throw Br("chords");this._os=i,this._chords=e}getLabel(){return YN.toLabel(this._os,this._chords,i=>this._getLabel(i))}getAriaLabel(){return _St.toLabel(this._os,this._chords,i=>this._getAriaLabel(i))}getElectronAccelerator(){return this._chords.length>1||this._chords[0].isDuplicateModifierCase()?null:v4i.toLabel(this._os,this._chords,i=>this._getElectronAccelerator(i))}getUserSettingsLabel(){return Xye.toLabel(this._os,this._chords,i=>this._getUserSettingsLabel(i))}isWYSIWYG(){return this._chords.every(i=>this._isWYSIWYG(i))}hasMultipleChords(){return this._chords.length>1}getChords(){return this._chords.map(i=>this._getChord(i))}_getChord(i){return new rpt(i.ctrlKey,i.shiftKey,i.altKey,i.metaKey,this._getLabel(i),this._getAriaLabel(i))}getDispatchChords(){return this._chords.map(i=>this._getChordDispatch(i))}getSingleModifierDispatchChords(){return this._chords.map(i=>this._getSingleModifierChordDispatch(i))}};var N3o=!1;function O3o(a){N3o&&console.info(a)}var bZ=class extends vZ{constructor(i,e){super(1,e),this._mapper=i}_getLabel(i){return i.isDuplicateModifierCase()?"":this._mapper.getUILabelForKeyCode(i.keyCode)}_getUSLabelForKeybinding(i){return i.isDuplicateModifierCase()?"":vp.toString(i.keyCode)}getUSLabel(){return YN.toLabel(this._os,this._chords,i=>this._getUSLabelForKeybinding(i))}_getAriaLabel(i){return i.isDuplicateModifierCase()?"":this._mapper.getAriaLabelForKeyCode(i.keyCode)}_getElectronAccelerator(i){return this._mapper.getElectronAcceleratorForKeyBinding(i)}_getUserSettingsLabel(i){if(i.isDuplicateModifierCase())return"";let e=this._mapper.getUserSettingsLabelForKeyCode(i.keyCode);return e&&e.toLowerCase()}_isWYSIWYG(i){return this.__isWYSIWYG(i.keyCode)}__isWYSIWYG(i){if(i===15||i===16||i===17||i===18)return!0;let e=this._mapper.getAriaLabelForKeyCode(i),t=this._mapper.getUserSettingsLabelForKeyCode(i);return e===t}_getChordDispatch(i){if(i.isModifierKey())return null;let e="";return i.ctrlKey&&(e+="ctrl+"),i.shiftKey&&(e+="shift+"),i.altKey&&(e+="alt+"),i.metaKey&&(e+="meta+"),e+=vp.toString(i.keyCode),e}_getSingleModifierChordDispatch(i){return i.keyCode===5&&!i.shiftKey&&!i.altKey&&!i.metaKey?"ctrl":i.keyCode===4&&!i.ctrlKey&&!i.altKey&&!i.metaKey?"shift":i.keyCode===6&&!i.ctrlKey&&!i.shiftKey&&!i.metaKey?"alt":i.keyCode===57&&!i.ctrlKey&&!i.shiftKey&&!i.altKey?"meta":null}static getProducedCharCode(i,e){return e?i.ctrlKey&&i.shiftKey&&i.altKey?e.withShiftAltGr:i.ctrlKey&&i.altKey?e.withAltGr:i.shiftKey?e.withShift:e.value:null}static getProducedChar(i,e){let t=this.getProducedCharCode(i,e);return t===null||t.length===0?" --- ":" "+t+" "}},uWt=class{constructor(i,e,t){this._isUSStandard=i;this._mapAltGrToCtrlAlt=t;this._keyCodeToLabel=[];this._scanCodeToKeyCode=[],this._keyCodeToLabel=[],this._keyCodeExists=[],this._keyCodeToLabel[0]=vp.toString(0);for(let s=0;s<193;s++){let l=Dy[s];l!==-1&&(this._scanCodeToKeyCode[s]=l,this._keyCodeToLabel[l]=vp.toString(l),this._keyCodeExists[l]=!0)}let o=[],n=!1;this._codeInfo=[];for(let s in e)if(e.hasOwnProperty(s)){let l=Bb.toEnum(s);if(l===0){O3o(`Unknown scanCode ${s} in mapping.`);continue}let c=e[s],u=Dy[l];if(u!==-1){let S=opt[c.vkey]||0;if(S===0||u===S||l!==134)continue}let p=c.value,h=c.withShift,g=c.withAltGr,f=c.withShiftAltGr,v=opt[c.vkey]||0,b={scanCode:l,keyCode:v,value:p,withShift:h,withAltGr:g,withShiftAltGr:f};if(this._codeInfo[l]=b,this._scanCodeToKeyCode[l]=v,v===0)continue;if(this._keyCodeExists[v]=!0,p.length===0)this._keyCodeToLabel[v]=null;else if(p.length>1)this._keyCodeToLabel[v]=p;else{let S=p.charCodeAt(0);if(S>=97&&S<=122){let y=65+(S-97);o[y]=!0,n=!0,this._keyCodeToLabel[v]=String.fromCharCode(65+(S-97))}else S>=65&&S<=90?(o[S]=!0,n=!0,this._keyCodeToLabel[v]=p):this._keyCodeToLabel[v]=p}}let r=(s,l)=>{o[s]||(this._keyCodeToLabel[l]=String.fromCharCode(s))};if(r(65,31),r(66,32),r(67,33),r(68,34),r(69,35),r(70,36),r(71,37),r(72,38),r(73,39),r(74,40),r(75,41),r(76,42),r(77,43),r(78,44),r(79,45),r(80,46),r(81,47),r(82,48),r(83,49),r(84,50),r(85,51),r(86,52),r(87,53),r(88,54),r(89,55),r(90,56),!n){let s=(l,c)=>{this._keyCodeToLabel[l]=String.fromCharCode(c)};s(85,59),s(86,61),s(87,44),s(88,45),s(89,46),s(90,47),s(91,96),s(92,91),s(93,92),s(94,93),s(95,39)}}dumpDebugInfo(){let i=[],e=[88,104],t=0;i.push("-----------------------------------------------------------------------------------------------------------------------------------------");for(let o=0;o<193;o++){if(Dy[o]!==-1&&e.indexOf(o)===-1)continue;t%6===0&&(i.push("| HW Code combination | Key | KeyCode combination | UI label | User settings | WYSIWYG |"),i.push("-----------------------------------------------------------------------------------------------------------------------------------------")),t++;let n=this._codeInfo[o],r=Bb.toString(o),s=[0,2,5,7];for(let l of s){let c=!!(l&1),u=!!(l&2),p=!!(l&4),h=new KD(c,u,p,!1,o),g=this._resolveChord(h),f=g?vp.toString(g.keyCode):null,v=g?new bZ(this,[g]):null,b=`${c?"Ctrl+":""}${u?"Shift+":""}${p?"Alt+":""}${r}`,S=v?v.getAriaLabel():null,y=S?S.replace(/Control\+/,"Ctrl+"):null,w=v?v.getUserSettingsLabel():null,k=bZ.getProducedChar(h,n),T=f?`${c?"Ctrl+":""}${u?"Shift+":""}${p?"Alt+":""}${f}`:null,O=(v?v.isWYSIWYG():!1)?" ":" NO ";i.push(`| ${this._leftPad(b,30)} | ${k} | ${this._leftPad(T,25)} | ${this._leftPad(y,25)} | ${this._leftPad(w,25)} | ${O} |`)}i.push("-----------------------------------------------------------------------------------------------------------------------------------------")}return i.join(`
`)}_leftPad(i,e){for(i===null&&(i="null");i.length<e;)i=" "+i;return i}getUILabelForKeyCode(i){return this._getLabelForKeyCode(i)}getAriaLabelForKeyCode(i){return this._getLabelForKeyCode(i)}getUserSettingsLabelForKeyCode(i){return this._isUSStandard?vp.toUserSettingsUS(i):vp.toUserSettingsGeneral(i)}getElectronAcceleratorForKeyBinding(i){return vp.toElectronAccelerator(i.keyCode)}_getLabelForKeyCode(i){return this._keyCodeToLabel[i]||vp.toString(0)}resolveKeyboardEvent(i){let e=i.ctrlKey||this._mapAltGrToCtrlAlt&&i.altGraphKey,t=i.altKey||this._mapAltGrToCtrlAlt&&i.altGraphKey,o=new Hb(e,i.shiftKey,t,i.metaKey,i.keyCode);return new bZ(this,[o])}_resolveChord(i){if(!i)return null;if(i instanceof Hb)return this._keyCodeExists[i.keyCode]?i:null;let e=this._scanCodeToKeyCode[i.scanCode]||0;return e===0||!this._keyCodeExists[e]?null:new Hb(i.ctrlKey,i.shiftKey,i.altKey,i.metaKey,e)}resolveKeybinding(i){let e=fDe(i.chords.map(t=>this._resolveChord(t)));return e.length>0?[new bZ(this,e)]:[]}};var F3o=d(12309,null),RJe=class extends C{constructor(e,t,o){super();this._editor=e;this._instantiationService=t;this._userDataProfileService=o;this._keybindingDecorationRenderer=this._register(new me);this._defineWidget=this._register(this._instantiationService.createInstance(iZ,this._editor)),this._register(this._editor.onDidChangeModel(n=>this._update())),this._update()}_update(){this._keybindingDecorationRenderer.value=Mao(this._editor,this._userDataProfileService)?this._instantiationService.createInstance(wpe,this._editor):void 0}showDefineKeybindingWidget(){Mao(this._editor,this._userDataProfileService)&&this._defineWidget.start().then(e=>this._onAccepted(e))}_onAccepted(e){if(this._editor.focus(),e&&this._editor.hasModel()){new RegExp(/\\/g).test(e)&&(e=e.slice(0,-1)+"\\\\");let n=["{",' "key": '+JSON.stringify(e)+",",' "command": "${1:commandId}",',' "when": "${2:editorTextFocus}"',"}$0"].join(`
`),r=dWt.insertSnippet(this._editor.getModel(),this._editor.getPosition());n=r.prepend+n+r.append,this._editor.setPosition(r.position),Qr.get(this._editor)?.insert(n,{overwriteBefore:0,overwriteAfter:0})}}};RJe=I([m(1,F),m(2,mn)],RJe);var wpe=class extends C{constructor(e,t){super();this._editor=e;this._keybindingService=t;this._dec=this._editor.createDecorationsCollection(),this._updateDecorations=this._register(new Dt(()=>this._updateDecorationsNow(),500));let o=Oi(this._editor.getModel());this._register(o.onDidChangeContent(()=>this._updateDecorations.schedule())),this._register(this._keybindingService.onDidUpdateKeybindings(()=>this._updateDecorations.schedule())),this._register({dispose:()=>{this._dec.clear(),this._updateDecorations.cancel()}}),this._updateDecorations.schedule()}_updateDecorationsNow(){let e=Oi(this._editor.getModel()),t=[],o=zL(e.getValue());if(o&&Array.isArray(o.children))for(let n=0,r=o.children.length;n<r;n++){let s=o.children[n],l=this._getDecorationForEntry(e,s);l!==null&&t.push(l)}this._dec.set(t)}_getDecorationForEntry(e,t){if(!Array.isArray(t.children))return null;for(let o=0,n=t.children.length;o<n;o++){let r=t.children[o];if(r.type!=="property"||!Array.isArray(r.children)||r.children.length!==2||r.children[0].value!=="key")continue;let l=r.children[1];if(l.type!=="string")continue;let c=this._keybindingService.resolveUserBinding(l.value);if(c.length===0)return this._createDecoration(!0,null,null,e,l);let u=c[0],p=null;if(u instanceof bZ&&(p=u.getUSLabel()),!u.isWYSIWYG()){let g=u.getLabel();return typeof g=="string"&&l.value.toLowerCase()===g.toLowerCase()?null:this._createDecoration(!1,u.getLabel(),p,e,l)}if(/abnt_|oem_/.test(l.value))return this._createDecoration(!1,u.getLabel(),p,e,l);let h=u.getUserSettingsLabel();return typeof h=="string"&&!wpe._userSettingsFuzzyEquals(l.value,h)?this._createDecoration(!1,u.getLabel(),p,e,l):null}return null}static _userSettingsFuzzyEquals(e,t){if(e=e.trim().toLowerCase(),t=t.trim().toLowerCase(),e===t)return!0;let o=SF.parseKeybinding(e),n=SF.parseKeybinding(t);return o===null&&n===null?!0:!o||!n?!1:o.equals(n)}_createDecoration(e,t,o,n,r){let s,l,c;e?(s=new xe().appendText(F3o),l="keybindingError",c=Ss(NIe)):(o&&t!==o?s=new xe(d(12310,null,t,o)):s=new xe(d(12311,null,t)),l="keybindingInfo",c=Ss(w9));let u=n.getPositionAt(r.offset),p=n.getPositionAt(r.offset+r.length);return{range:new z(u.lineNumber,u.column,p.lineNumber,p.column),options:{description:"keybindings-widget",stickiness:1,className:l,hoverMessage:s,overviewRuler:{color:c,position:4}}}}};wpe=I([m(1,_e)],wpe);function Mao(a,i){let e=a.getModel();return e?Xe(e.uri,i.currentProfile.keybindingsResource):!1}go(qLt,RJe,1);function W3o(a){let i=new Map;for(let e of a)i.set(e,(i.get(e)??0)+1);return i}var ULe=class a{constructor(){this.chunkCount=0;this.chunkOccurrences=new Map;this.documents=new Map}calculateScores(i,e){let t=this.computeEmbedding(i),o=new Map,n=[];for(let[r,s]of this.documents){if(e.isCancellationRequested)return[];for(let l of s.chunks){let c=this.computeSimilarityScore(l,t,o);c>0&&n.push({key:r,score:c})}}return n}static termFrequencies(i){return W3o(a.splitTerms(i))}static*splitTerms(i){let e=t=>t.toLowerCase();for(let[t]of i.matchAll(/\b\p{Letter}[\p{Letter}\d]{2,}\b/gu)){yield e(t);let o=t.replace(/([a-z])([A-Z])/g,"$1 $2").split(/\s+/g);if(o.length>1)for(let n of o)n.length>2&&/\p{Letter}{3,}/gu.test(n)&&(yield e(n))}}updateDocuments(i){for(let{key:e}of i)this.deleteDocument(e);for(let e of i){let t=[];for(let o of e.textChunks){let n=a.termFrequencies(o);for(let r of n.keys())this.chunkOccurrences.set(r,(this.chunkOccurrences.get(r)??0)+1);t.push({text:o,tf:n})}this.chunkCount+=t.length,this.documents.set(e.key,{chunks:t})}return this}deleteDocument(i){let e=this.documents.get(i);if(e){this.documents.delete(i),this.chunkCount-=e.chunks.length;for(let t of e.chunks)for(let o of t.tf.keys()){let n=this.chunkOccurrences.get(o);if(typeof n=="number"){let r=n-1;r<=0?this.chunkOccurrences.delete(o):this.chunkOccurrences.set(o,r)}}}}computeSimilarityScore(i,e,t){let o=0;for(let[n,r]of Object.entries(e)){let s=i.tf.get(n);if(!s)continue;let l=t.get(n);typeof l!="number"&&(l=this.computeIdf(n),t.set(n,l));let c=s*l;o+=c*r}return o}computeEmbedding(i){let e=a.termFrequencies(i);return this.computeTfidf(e)}computeIdf(i){let e=this.chunkOccurrences.get(i)??0;return e>0?Math.log((this.chunkCount+1)/e):0}computeTfidf(i){let e=Object.create(null);for(let[t,o]of i){let n=this.computeIdf(t);n>0&&(e[t]=o*n)}return e}};function Pao(a){let i=a.slice(0);i.sort((t,o)=>o.score-t.score);let e=i[0]?.score??0;if(e>0)for(let t of i)t.score/=e;return i}var MJe=class extends C{constructor(e,t){super();this.instantiationService=e;this.configurationService=t}getLocalSearchProvider(e){return this.instantiationService.createInstance(PJe,e)}get remoteSearchAllowed(){return this.configurationService.getValue().workbench.settings.enableNaturalLanguageSearch}getRemoteSearchProvider(e){if(this.remoteSearchAllowed)return this._remoteSearchProvider??=this.instantiationService.createInstance(myi),this._remoteSearchProvider.setFilter(e),this._remoteSearchProvider}getAiSearchProvider(e){if(this.remoteSearchAllowed)return this._aiSearchProvider??=this.instantiationService.createInstance(AJe),this._aiSearchProvider.setFilter(e),this._aiSearchProvider}};MJe=I([m(0,F),m(1,B)],MJe);function hyi(a){return a.replace(/[":]/g," ").replace(/ /g," ").trim()}var PJe=class{constructor(i,e){this._filter=i;this.configurationService=e;this._filter=hyi(this._filter)}searchModel(i,e){if(!this._filter)return Promise.resolve(null);let t=l=>{let{matches:c,matchType:u,keyMatchScore:p}=new dyi(this._filter,l,!0,this.configurationService);return u===0||c.length===0?null:(mr(this._filter,l.key)&&(u=256),{matches:c,matchType:u,keyMatchScore:p,score:0})},o=i.filterSettings(this._filter,this.getGroupFilter(this._filter),t),n=Math.max(...o.map(l=>l.matchType&Aeo)),r=9,s=o.filter(l=>l.matchType&n||l.matchType&r||l.matchType===256).map(l=>({...l,providerName:W0t}));return Promise.resolve({filterMatches:s,exactMatch:s.some(l=>l.matchType===256)})}getGroupFilter(i){let e=u$(i,!1,{global:!0});return t=>t.id!=="defaultOverrides"&&e.test(t.title)}};PJe=I([m(1,B)],PJe);var dyi=class{constructor(i,e,t,o){this.searchDescription=t;this.configurationService=o;this.matchType=0;this.keyMatchScore=0;this.matches=Uo(this._findMatchesInSetting(i,e),n=>`${n.startLineNumber}_${n.startColumn}_${n.endLineNumber}_${n.endColumn}_`)}_findMatchesInSetting(i,e){return this._doFindMatchesInSetting(i,e)}_keyToLabel(i){return i.replace(/[-._]/g," ").replace(/([a-z]+)([A-Z])/g,"$1 $2").replace(/([A-Za-z]+)(\d+)/g,"$1 $2").replace(/(\d+)([A-Za-z]+)/g,"$1 $2").toLowerCase()}_toAlphaNumeric(i){return i.replace(/[^\p{L}\p{N}]+/gu,"")}_doFindMatchesInSetting(i,e){let t=new Map,o=new Map,n=new Map,r=this._keyToLabel(e.key),s=new Set(i.split(" "));for(let v of s){let b=Gy(v,r,!0);b?.length&&o.set(v,b.map(S=>this.toKeyRange(e,S)))}o.size===s.size?this.matchType|=128:o.size>=2&&(this.matchType|=32,this.keyMatchScore=o.size);let l=this._toAlphaNumeric(i),c=this._toAlphaNumeric(e.key),u=SW(l,c);if(u?.length&&(o.set(e.key,u.map(v=>this.toKeyRange(e,v))),this.matchType|=64),this.matchType===0){o.clear();for(let v of s){let b=Gy(v,r,!1);b?.length&&o.set(v,b.map(S=>this.toKeyRange(e,S)))}if(o.size>=2||o.size===1&&s.size===1)this.matchType|=16,this.keyMatchScore=o.size;else{let v=Xqe(l,c);v?.length&&(o.set(e.key,v.map(b=>this.toKeyRange(e,b))),this.matchType|=4)}}if(e.overrides?.length&&this.matchType!==0)return this.matchType=1,[...o.size?Array.from(o.values()).flat():[]];let p=this.matchType>=32;if(this.searchDescription&&!p){let v=e.keywords?.length?[...e.description,e.keywords.join(" ")]:e.description;for(let b of s)for(let S=0;S<v.length;S++){let y=z9(b,v[S]);y?.length&&t.set(b,y.map(w=>this.toDescriptionRange(e,w,S)))}t.size===s.size?this.matchType|=8:t.clear()}if(!p)if(e.enum?.length){for(let v of e.enum)if(typeof v=="string"){n.clear();for(let b of s){let S=SW(b,v);S?.length&&n.set(b,S.map(y=>this.toValueRange(e,y)))}if(n.size===s.size){this.matchType|=8;break}else n.clear()}}else{let v=this.configurationService.getValue(e.key);if(typeof v=="string"){for(let b of s){let S=SW(b,v);S?.length&&n.set(b,S.map(y=>this.toValueRange(e,y)))}n.size===s.size?this.matchType|=8:n.clear()}}let h=t.size?Array.from(t.values()).flat():[],g=o.size?Array.from(o.values()).flat():[],f=n.size?Array.from(n.values()).flat():[];return[...h,...g,...f]}toKeyRange(i,e){return{startLineNumber:i.keyRange.startLineNumber,startColumn:i.keyRange.startColumn+e.start,endLineNumber:i.keyRange.startLineNumber,endColumn:i.keyRange.startColumn+e.end}}toDescriptionRange(i,e,t){let o=i.descriptionRanges[t];return o?{startLineNumber:o.startLineNumber,startColumn:o.startColumn+e.start,endLineNumber:o.endLineNumber,endColumn:o.startColumn+e.end}:wg}toValueRange(i,e){return{startLineNumber:i.valueRange.startLineNumber,startColumn:i.valueRange.startColumn+e.start+1,endLineNumber:i.valueRange.startLineNumber,endColumn:i.valueRange.startColumn+e.end+1}}},pWt=class{constructor(){this._settingsRecord={}}updateModel(i){i!==this._currentPreferencesModel&&(this._currentPreferencesModel=i,this.refresh())}refresh(){if(this._settingsRecord={},!!this._currentPreferencesModel){for(let i of this._currentPreferencesModel.settingsGroups)if(i.id!=="mostCommonlyUsed")for(let e of i.sections)for(let t of e.settings)this._settingsRecord[t.key]=t}}getSettingsRecord(){return this._settingsRecord}},uyi=class a{constructor(i){this._aiSettingsSearchService=i;this._filter="";this._recordProvider=new pWt}static{this.EMBEDDINGS_SETTINGS_SEARCH_MAX_PICKS=10}setFilter(i){this._filter=hyi(i)}async searchModel(i,e){return!this._filter||!this._aiSettingsSearchService.isEnabled()?null:(this._recordProvider.updateModel(i),this._aiSettingsSearchService.startSearch(this._filter,e),{filterMatches:await this.getEmbeddingsItems(e),exactMatch:!1})}async getEmbeddingsItems(i){let e=this._recordProvider.getSettingsRecord(),t=[],o=await this._aiSettingsSearchService.getEmbeddingsResults(this._filter,i);if(!o)return[];let n=B0t;for(let r of o){if(t.length===a.EMBEDDINGS_SETTINGS_SEARCH_MAX_PICKS)break;t.push({setting:e[r],matches:[e[r].range],matchType:2,keyMatchScore:0,score:0,providerName:n})}return t}},pyi=class a{constructor(){this._filter="";this._documents=[];this._settingsRecord={}}static{this.TF_IDF_PRE_NORMALIZE_THRESHOLD=50}static{this.TF_IDF_POST_NORMALIZE_THRESHOLD=.7}static{this.TF_IDF_MAX_PICKS=5}setFilter(i){this._filter=hyi(i)}keyToLabel(i){return i.replace(/[-._]/g," ").replace(/([a-z]+)([A-Z])/g,"$1 $2").replace(/([A-Za-z]+)(\d+)/g,"$1 $2").replace(/(\d+)([A-Za-z]+)/g,"$1 $2").toLowerCase()}settingItemToEmbeddingString(i){let e=`Setting Id: ${i.key}
`;return e+=`Label: ${this.keyToLabel(i.key)}
`,e+=`Description: ${i.description}
`,e}async searchModel(i,e){if(!this._filter)return null;if(this._currentPreferencesModel!==i){this._currentPreferencesModel=i,this._documents=[],this._settingsRecord={};for(let t of i.settingsGroups)if(t.id!=="mostCommonlyUsed")for(let o of t.sections)for(let n of o.settings)this._documents.push({key:n.key,textChunks:[this.settingItemToEmbeddingString(n)]}),this._settingsRecord[n.key]=n}return{filterMatches:await this.getTfIdfItems(e),exactMatch:!1}}async getTfIdfItems(i){let e=[],t=new ULe;t.updateDocuments(this._documents);let o=t.calculateScores(this._filter,i);o.sort((r,s)=>s.score-r.score);let n=o[0].score;if(n<a.TF_IDF_PRE_NORMALIZE_THRESHOLD)return[];for(let r of o){if(r.score/n<a.TF_IDF_POST_NORMALIZE_THRESHOLD||e.length===a.TF_IDF_MAX_PICKS)break;let s=r.key;e.push({setting:this._settingsRecord[s],matches:[this._settingsRecord[s].range],matchType:2,keyMatchScore:0,score:r.score,providerName:V0t})}return e}},myi=class{constructor(){this._filter="";this._tfIdfSearchProvider=new pyi}setFilter(i){this._filter=i,this._tfIdfSearchProvider.setFilter(i)}async searchModel(i,e){return this._filter?await this._tfIdfSearchProvider.searchModel(i,e):null}},AJe=class{constructor(i){this.aiSettingsSearchService=i;this._filter="";this._embeddingsSearchProvider=new uyi(this.aiSettingsSearchService),this._recordProvider=new pWt}setFilter(i){this._filter=i,this._embeddingsSearchProvider.setFilter(i)}async searchModel(i,e){return!this._filter||!this.aiSettingsSearchService.isEnabled()?null:(this._recordProvider.updateModel(i),await this._embeddingsSearchProvider.searchModel(i,e))}async getLLMRankedResults(i){return!this._filter||!this.aiSettingsSearchService.isEnabled()?null:{filterMatches:await this.getLLMRankedItems(i),exactMatch:!1}}async getLLMRankedItems(i){let e=this._recordProvider.getSettingsRecord(),t=[],o=await this.aiSettingsSearchService.getLLMRankedResults(this._filter,i);if(!o)return[];for(let n of o)e[n]&&t.push({setting:e[n],matches:[e[n].range],matchType:2,keyMatchScore:0,score:0,providerName:H0t});return t}};AJe=I([m(0,dEe)],AJe);we(S0t,MJe,1);var Aao="transientWordWrapState",fyi="isWordWrapMinified",vyi="isDominatedByLongLines",Nao=new Q("canToggleWordWrap",!1,!0),Oao=new Q("editorWordWrap",!1,d(8349,null));function iA(a,i,e){e.setTransientModelProperty(a,Aao,i)}function SZ(a,i){return i.getTransientModelProperty(a,Aao)}var mWt="editor.action.toggleWordWrap",gyi=class extends xi{constructor(){super({id:mWt,label:L(8351,"View: Toggle Word Wrap"),precondition:void 0,kbOpts:{kbExpr:null,primary:568,weight:100}})}run(i,e){let t=i.get(Kt),o=i.get(F);if(!$Le(t,e))return;let n=e.getModel(),r=SZ(n,t),s;r?s=null:s={wordWrapOverride:e.getOption(166).wrappingColumn===-1?"on":"off"},iA(n,s,t);let l=o.invokeFunction(JSt,e);if(l){let c=l.getOriginalEditor(),u=l.getModifiedEditor(),p=c===e?u:c;$Le(t,p)&&(iA(p.getModel(),s,t),l.updateOptions({}))}}},zLe=class extends C{constructor(e,t,o){super();this._editor=e;this._contextKeyService=t;this._codeEditorService=o;let r=this._editor.getOptions().get(166),s=this._contextKeyService.createKey(fyi,r.isWordWrapMinified),l=this._contextKeyService.createKey(vyi,r.isDominatedByLongLines),c=!1;this._register(e.onDidChangeConfiguration(p=>{if(!p.hasChanged(166))return;let g=this._editor.getOptions().get(166);s.set(g.isWordWrapMinified),l.set(g.isDominatedByLongLines),c||u()})),this._register(e.onDidChangeModel(p=>{u()})),this._register(o.onDidChangeTransientModelProperty(()=>{u()}));let u=()=>{if(!$Le(this._codeEditorService,this._editor))return;let p=SZ(this._editor.getModel(),this._codeEditorService);try{c=!0,this._applyWordWrapState(p)}finally{c=!1}}}static{this.ID="editor.contrib.toggleWordWrapController"}_applyWordWrapState(e){let t=e?e.wordWrapOverride:"inherit";this._editor.updateOptions({wordWrapOverride2:t})}};zLe=I([m(1,X),m(2,Kt)],zLe);var KLe=class extends C{constructor(e,t){super();this._diffEditor=e;this._codeEditorService=t;this._register(this._diffEditor.onDidChangeModel(()=>{this._ensureSyncedWordWrapToggle()}))}static{this.ID="diffeditor.contrib.toggleWordWrapController"}_ensureSyncedWordWrapToggle(){let e=this._diffEditor.getOriginalEditor(),t=this._diffEditor.getModifiedEditor();if(!e.hasModel()||!t.hasModel())return;let o=SZ(e.getModel(),this._codeEditorService),n=SZ(t.getModel(),this._codeEditorService);o&&!n&&$Le(this._codeEditorService,e)&&(iA(t.getModel(),o,this._codeEditorService),this._diffEditor.updateOptions({})),!o&&n&&$Le(this._codeEditorService,t)&&(iA(e.getModel(),n,this._codeEditorService),this._diffEditor.updateOptions({}))}};KLe=I([m(1,Kt)],KLe);function $Le(a,i){if(!i||i.isSimpleWidget||!i.getModel())return!1;if(i.getOption(70)){for(let t of a.listDiffEditors())if(t.getOriginalEditor()===i&&!t.renderSideBySide)return!1}return!0}var GLe=class extends C{constructor(e,t,o){super();this._editorService=e;this._codeEditorService=t;this._contextService=o;this._register(H.runAndSubscribe(Fg,({window:n,disposables:r})=>{r.add(j(n,"focus",()=>this._update(),!0)),r.add(j(n,"blur",()=>this._update(),!0))},{window:It,disposables:this._store})),this._register(this._editorService.onDidActiveEditorChange(()=>this._update())),this._canToggleWordWrap=Nao.bindTo(this._contextService),this._editorWordWrap=Oao.bindTo(this._contextService),this._activeEditor=null,this._activeEditorListener=this._register(new P),this._update()}static{this.ID="workbench.contrib.editorWordWrapContextKeyTracker"}_update(){let e=this._codeEditorService.getFocusedCodeEditor()||this._codeEditorService.getActiveCodeEditor();this._activeEditor!==e&&(this._activeEditorListener.clear(),this._activeEditor=e,e&&(this._activeEditorListener.add(e.onDidChangeModel(()=>this._updateFromCodeEditor())),this._activeEditorListener.add(e.onDidChangeConfiguration(t=>{t.hasChanged(166)&&this._updateFromCodeEditor()})),this._updateFromCodeEditor()))}_updateFromCodeEditor(){if($Le(this._codeEditorService,this._activeEditor)){let e=this._activeEditor.getOption(166);this._setValues(!0,e.wrappingColumn!==-1)}else return this._setValues(!1,!1)}_setValues(e,t){this._canToggleWordWrap.set(e),this._editorWordWrap.set(t)}};GLe=I([m(0,ee),m(1,Kt),m(2,X)],GLe);pt(GLe.ID,GLe,ut.AfterRestored);go(zLe.ID,zLe,0);Imt(KLe.ID,KLe);Jt(gyi);fe.appendMenuItem(D.EditorTitle,{command:{id:mWt,title:d(8352,null),icon:M.wordWrap},group:"navigation",order:1,when:x.and(x.has(vyi),x.has(fyi))});fe.appendMenuItem(D.EditorTitle,{command:{id:mWt,title:d(8353,null),icon:M.wordWrap},group:"navigation",order:1,when:x.and(ue.inDiffEditor.negate(),x.has(vyi),x.not(fyi))});fe.appendMenuItem(D.MenubarViewMenu,{command:{id:mWt,title:d(8350,null),toggled:Oao,precondition:Nao},order:1,group:"6_editor"});var oA=class{constructor(i,e){this._instaService=i;this._inputUri=A.from({scheme:"perf",path:"Startup Performance"});this._registration=e.registerTextModelContentProvider("perf",i.createInstance(NJe))}static get(){return Ule(oA.ID)}static{this.ID="workbench.contrib.perfview"}dispose(){this._registration.dispose()}getInputUri(){return this._inputUri}getEditorInput(){return this._instaService.createInstance(VK)}};oA=I([m(0,F),m(1,Nt)],oA);var VK=class extends IC{static{this.Id="PerfviewInput"}get typeId(){return VK.Id}constructor(i,e,t,o,n,r,s,l){super(oA.get().getInputUri(),d(12268,null),void 0,void 0,void 0,i,e,t,o,n,r,s,l)}};VK=I([m(0,Nt),m(1,Ho),m(2,ee),m(3,be),m(4,ot),m(5,lr),m(6,Nn),m(7,Sv)],VK);var NJe=class{constructor(i,e,t,o,n,r,s,l,c){this._modelService=i;this._languageService=e;this._editorService=t;this._lifecycleService=o;this._timerService=n;this._extensionService=r;this._productService=s;this._remoteAgentService=l;this._terminalService=c;this._modelDisposables=[]}provideTextContent(i){if(!this._model||this._model.isDisposed()){Ue(this._modelDisposables);let e=this._languageService.createById("markdown");this._model=this._modelService.getModel(i)||this._modelService.createModel("Loading...",e,i),this._modelDisposables.push(e.onDidChange(t=>{this._model?.setLanguage(t)})),this._modelDisposables.push(this._extensionService.onDidChangeExtensionsStatus(this._updateModel,this)),iA(this._model,{wordWrapOverride:"off"},this._editorService)}return this._updateModel(),Promise.resolve(this._model)}_updateModel(){Promise.all([this._timerService.whenReady(),this._lifecycleService.when(4),this._extensionService.whenInstalledExtensionsRegistered(),Gt&&!this._remoteAgentService.getConnection()?.remoteAuthority?Promise.resolve():this._terminalService.whenConnected]).then(()=>{if(this._model&&!this._model.isDisposed()){let i=new byi;this._addSummary(i),i.blank(),this._addSummaryTable(i),i.blank(),this._addExtensionsTable(i),i.blank(),this._addPerfMarksTable("Terminal Stats",i,this._timerService.getPerformanceMarks().find(e=>e[0]==="renderer")?.[1].filter(e=>e.name.startsWith("code/terminal/"))),i.blank(),this._addWorkbenchContributionsPerfMarksTable(i),i.blank(),this._addRawPerfMarks(i),i.blank(),this._addResourceTimingStats(i),this._model.setValue(i.value)}})}_addSummary(i){let e=this._timerService.startupMetrics;i.heading(2,"System Info"),i.li(`${this._productService.nameShort}: ${this._productService.version} (${this._productService.commit||"0000000"})`),i.li(`OS: ${e.platform}(${e.release})`),e.cpus&&i.li(`CPUs: ${e.cpus.model}(${e.cpus.count} x ${e.cpus.speed})`),typeof e.totalmem=="number"&&typeof e.freemem=="number"&&i.li(`Memory(System): ${(e.totalmem/ll.GB).toFixed(2)} GB(${(e.freemem/ll.GB).toFixed(2)}GB free)`),e.meminfo&&i.li(`Memory(Process): ${(e.meminfo.workingSetSize/ll.KB).toFixed(2)} MB working set(${(e.meminfo.privateBytes/ll.KB).toFixed(2)}MB private, ${(e.meminfo.sharedBytes/ll.KB).toFixed(2)}MB shared)`),i.li(`VM(likelihood): ${e.isVMLikelyhood}%`),i.li(`Initial Startup: ${e.initialStartup}`),i.li(`Has ${e.windowCount-1} other windows`),i.li(`Screen Reader Active: ${e.hasAccessibilitySupport}`),i.li(`Empty Workspace: ${e.emptyWorkbench}`)}_addSummaryTable(i){let e=this._timerService.startupMetrics,t=oe.as(Qi.Workbench).timings,o=[];o.push(["import(main.js)",e.timers.ellapsedLoadMainBundle,"[main]",`initial startup: ${e.initialStartup}`]),o.push(["start => app.isReady",e.timers.ellapsedAppReady,"[main]",`initial startup: ${e.initialStartup}`]),o.push(["nls:start => nls:end",e.timers.ellapsedNlsGeneration,"[main]",`initial startup: ${e.initialStartup}`]),o.push(["run main.js",e.timers.ellapsedRunMainBundle,"[main]",`initial startup: ${e.initialStartup}`]),o.push(["start crash reporter",e.timers.ellapsedCrashReporter,"[main]",`initial startup: ${e.initialStartup}`]),o.push(["serve main IPC handle",e.timers.ellapsedMainServer,"[main]",`initial startup: ${e.initialStartup}`]),o.push(["create window",e.timers.ellapsedWindowCreate,"[main]",`initial startup: ${e.initialStartup}, ${e.initialStartup?`state: ${e.timers.ellapsedWindowRestoreState}ms, widget: ${e.timers.ellapsedBrowserWindowCreate}ms, show: ${e.timers.ellapsedWindowMaximize}ms`:""}`]),o.push(["app.isReady => window.loadUrl()",e.timers.ellapsedWindowLoad,"[main]",`initial startup: ${e.initialStartup}`]),o.push(["window.loadUrl() => begin to import(workbench.desktop.main.js)",e.timers.ellapsedWindowLoadToRequire,"[main->renderer]",Dxt(e.windowKind)]),o.push(["import(workbench.desktop.main.js)",e.timers.ellapsedRequire,"[renderer]",`cached data: ${e.didUseCachedData?"YES":"NO"}`]),o.push(["wait for window config",e.timers.ellapsedWaitForWindowConfig,"[renderer]",void 0]),o.push(["init storage (global & workspace)",e.timers.ellapsedStorageInit,"[renderer]",void 0]),o.push(["init workspace service",e.timers.ellapsedWorkspaceServiceInit,"[renderer]",void 0]),Gt&&(o.push(["init settings and global state from settings sync service",e.timers.ellapsedRequiredUserDataInit,"[renderer]",void 0]),o.push(["init keybindings, snippets & extensions from settings sync service",e.timers.ellapsedOtherUserDataInit,"[renderer]",void 0])),o.push(["register extensions & spawn extension host",e.timers.ellapsedExtensions,"[renderer]",void 0]),o.push(["restore primary viewlet",e.timers.ellapsedViewletRestore,"[renderer]",e.viewletId]),o.push(["restore secondary viewlet",e.timers.ellapsedAuxiliaryViewletRestore,"[renderer]",e.auxiliaryViewletId]),o.push(["restore panel",e.timers.ellapsedPanelRestore,"[renderer]",e.panelId]),o.push(["restore & resolve visible editors",e.timers.ellapsedEditorRestore,"[renderer]",`${e.editorIds.length}: ${e.editorIds.join(", ")}`]),o.push(["create workbench contributions",e.timers.ellapsedWorkbenchContributions,"[renderer]",`${(t.get(1)?.length??0)+(t.get(1)?.length??0)} blocking startup`]),o.push(["overall workbench load",e.timers.ellapsedWorkbench,"[renderer]",void 0]),o.push(["workbench ready",e.ellapsed,"[main->renderer]",void 0]),o.push(["renderer ready",e.timers.ellapsedRenderer,"[renderer]",void 0]),o.push(["shared process connection ready",e.timers.ellapsedSharedProcesConnected,"[renderer->sharedprocess]",void 0]),o.push(["extensions registered",e.timers.ellapsedExtensionsReady,"[renderer]",void 0]),i.heading(2,"Performance Marks"),i.table(["What","Duration","Process","Info"],o)}_addExtensionsTable(i){let e=[],t=[],o=this._extensionService.getExtensionsStatus();for(let r in o){let{activationTimes:s}=o[r];s&&(s.activationReason.startup?e.push([r,s.activationReason.startup,s.codeLoadingTime,s.activateCallTime,s.activateResolvedTime,s.activationReason.activationEvent,s.activationReason.extensionId.value]):t.push([r,s.activationReason.startup,s.codeLoadingTime,s.activateCallTime,s.activateResolvedTime,s.activationReason.activationEvent,s.activationReason.extensionId.value]))}let n=e.concat(t);n.length>0&&(i.heading(2,"Extension Activation Stats"),i.table(["Extension","Eager","Load Code","Call Activate","Finish Activate","Event","By"],n))}_addPerfMarksTable(i,e,t){if(!t)return;let o=[],n=-1,r=0;for(let{name:s,startTime:l}of t){let c=n!==-1?l-n:0;r+=c,o.push([s,Math.round(l),Math.round(c),Math.round(r)]),n=l}i&&e.heading(2,i),e.table(["Name","Timestamp","Delta","Total"],o)}_addWorkbenchContributionsPerfMarksTable(i){i.heading(2,"Workbench Contributions Blocking Restore");let e=oe.as(Qi.Workbench).timings;i.li(`Total (LifecyclePhase.Starting): ${e.get(1)?.length} (${e.get(1)?.reduce((o,n)=>o+n[1],0)}ms)`),i.li(`Total (LifecyclePhase.Ready): ${e.get(2)?.length} (${e.get(2)?.reduce((o,n)=>o+n[1],0)}ms)`),i.blank();let t=this._timerService.getPerformanceMarks().find(o=>o[0]==="renderer")?.[1].filter(o=>o.name.startsWith("code/willCreateWorkbenchContribution/1")||o.name.startsWith("code/didCreateWorkbenchContribution/1")||o.name.startsWith("code/willCreateWorkbenchContribution/2")||o.name.startsWith("code/didCreateWorkbenchContribution/2"));this._addPerfMarksTable(void 0,i,t)}_addRawPerfMarks(i){for(let[e,t]of this._timerService.getPerformanceMarks()){i.heading(2,`Raw Perf Marks: ${e}`),i.value+="```\n",i.value+=`Name Timestamp Delta Total
`;let o=-1,n=0;for(let{name:r,startTime:s}of t){let l=o!==-1?s-o:0;n+=l,i.value+=`${r} ${s} ${l} ${n}
`,o=s}i.value+="```\n"}}_addResourceTimingStats(i){let e=performance.getEntriesByType("resource").map(t=>[t.name,t.duration]);e.length&&(i.heading(2,"Resource Timing Stats"),i.table(["Name","Duration"],e))}};NJe=I([m(0,Ct),m(1,kt),m(2,Kt),m(3,ao),m(4,wC),m(5,lt),m(6,nt),m(7,yo),m(8,Yo)],NJe);var byi=class{constructor(){this.value=""}heading(i,e){return this.value+=`${"#".repeat(i)} ${e}
`,this}blank(){return this.value+=`
`,this}li(i){return this.value+=`* ${i}
`,this}table(i,e){this.value+=this.toMarkdownTable(i,e)}toMarkdownTable(i,e){let t="",o=[];return i.forEach((n,r)=>{o[r]=n.length}),e.forEach(n=>{n.forEach((r,s)=>{typeof r>"u"&&(r=n[s]="-");let l=r.toString().length;o[s]=Math.max(l,o[s])})}),i.forEach((n,r)=>{t+=`| ${n+" ".repeat(o[r]-n.toString().length)} `}),t+=`|
`,i.forEach((n,r)=>{t+=`| ${"-".repeat(o[r])} `}),t+=`|
`,e.forEach(n=>{n.forEach((r,s)=>{typeof r<"u"&&(t+=`| ${r+" ".repeat(o[s]-r.toString().length)} `)}),t+=`|
`}),t}};var Syi=class{constructor(i,e){this.key=i;this.data=e;this.incoming=new Map;this.outgoing=new Map}},OJe=class{constructor(i){this._hashFn=i;this._nodes=new Map}roots(){let i=[];for(let e of this._nodes.values())e.outgoing.size===0&&i.push(e);return i}insertEdge(i,e){let t=this.lookupOrInsertNode(i),o=this.lookupOrInsertNode(e);t.outgoing.set(o.key,o),o.incoming.set(t.key,t)}removeNode(i){let e=this._hashFn(i);this._nodes.delete(e);for(let t of this._nodes.values())t.outgoing.delete(e),t.incoming.delete(e)}lookupOrInsertNode(i){let e=this._hashFn(i),t=this._nodes.get(e);return t||(t=new Syi(e,i),this._nodes.set(e,t)),t}lookup(i){return this._nodes.get(this._hashFn(i))}isEmpty(){return this._nodes.size===0}toString(){let i=[];for(let[e,t]of this._nodes)i.push(`${e}
(-> incoming)[${[...t.incoming.keys()].join(", ")}]
(outgoing ->)[${[...t.outgoing.keys()].join(",")}]
`);return i.join(`
`)}findCycleSlow(){for(let[i,e]of this._nodes){let t=new Set([i]),o=this._findCycle(e,t);if(o)return o}}_findCycle(i,e){for(let[t,o]of i.outgoing){if(e.has(t))return[...e,t].join(" -> ");e.add(t);let n=this._findCycle(o,e);if(n)return n;e.delete(t)}}};var V3o=!1,hWt=class extends Error{constructor(i){super("cyclic dependency between services"),this.message=i.findCycleSlow()??`UNABLE to detect cycle, dumping graph:
${i.toString()}`}},qLe=class a{constructor(i=new Io,e=!1,t,o=V3o){this._services=i;this._strict=e;this._parent=t;this._enableTracing=o;this._isDisposed=!1;this._servicesToMaybeDispose=new Set;this._children=new Set;this._activeInstantiations=new Set;this._services.set(F,this),this._globalGraph=o?t?._globalGraph??new OJe(n=>n):void 0}dispose(){if(!this._isDisposed){this._isDisposed=!0,Ue(this._children),this._children.clear();for(let i of this._servicesToMaybeDispose)Ac(i)&&i.dispose();this._servicesToMaybeDispose.clear()}}_throwIfDisposed(){if(this._isDisposed)throw new Error("InstantiationService has been disposed")}createChild(i,e){this._throwIfDisposed();let t=this,o=new class extends a{dispose(){t._children.delete(o),super.dispose()}}(i,this._strict,this,this._enableTracing);return this._children.add(o),e?.add(o),o}invokeFunction(i,...e){this._throwIfDisposed();let t=IZ.traceInvocation(this._enableTracing,i),o=!1;try{return i({get:r=>{if(o)throw Xve("service accessor is only valid during the invocation of its target method");let s=this._getOrCreateServiceInstance(r,t);return s||this._throwIfStrict(`[invokeFunction] unknown service '${r}'`,!1),s}},...e)}finally{o=!0,t.stop()}}createInstance(i,...e){this._throwIfDisposed();let t,o;return i instanceof Mt?(t=IZ.traceCreation(this._enableTracing,i.ctor),o=this._createInstance(i.ctor,i.staticArguments.concat(e),t)):(t=IZ.traceCreation(this._enableTracing,i),o=this._createInstance(i,e,t)),t.stop(),o}_createInstance(i,e=[],t){let o=Z0.getServiceDependencies(i).sort((s,l)=>s.index-l.index),n=[];for(let s of o){let l=this._getOrCreateServiceInstance(s.id,t);l||this._throwIfStrict(`[createInstance] ${i.name} depends on UNKNOWN service ${s.id}.`,!1),n.push(l)}let r=o.length>0?o[0].index:e.length;if(e.length!==r){console.trace(`[createInstance] First service dependency of ${i.name} at position ${r+1} conflicts with ${e.length} static arguments`);let s=r-e.length;s>0?e=e.concat(new Array(s)):e=e.slice(0,r)}return Reflect.construct(i,e.concat(n))}_setCreatedServiceInstance(i,e){if(this._services.get(i)instanceof Mt)this._services.set(i,e);else if(this._parent)this._parent._setCreatedServiceInstance(i,e);else throw new Error("illegalState - setting UNKNOWN service instance")}_getServiceInstanceOrDescriptor(i){let e=this._services.get(i);return!e&&this._parent?this._parent._getServiceInstanceOrDescriptor(i):e}_getOrCreateServiceInstance(i,e){this._globalGraph&&this._globalGraphImplicitDependency&&this._globalGraph.insertEdge(this._globalGraphImplicitDependency,String(i));let t=this._getServiceInstanceOrDescriptor(i);return t instanceof Mt?this._safeCreateAndCacheServiceInstance(i,t,e.branch(i,!0)):(e.branch(i,!1),t)}_safeCreateAndCacheServiceInstance(i,e,t){if(this._activeInstantiations.has(i))throw new Error(`illegal state - RECURSIVELY instantiating service '${i}'`);this._activeInstantiations.add(i);try{return this._createAndCacheServiceInstance(i,e,t)}finally{this._activeInstantiations.delete(i)}}_createAndCacheServiceInstance(i,e,t){let o=new OJe(l=>l.id.toString()),n=0,r=[{id:i,desc:e,_trace:t}],s=new Set;for(;r.length;){let l=r.pop();if(!s.has(String(l.id))){if(s.add(String(l.id)),o.lookupOrInsertNode(l),n++>1e3)throw new hWt(o);for(let c of Z0.getServiceDependencies(l.desc.ctor)){let u=this._getServiceInstanceOrDescriptor(c.id);if(u||this._throwIfStrict(`[createInstance] ${i} depends on ${c.id} which is NOT registered.`,!0),this._globalGraph?.insertEdge(String(l.id),String(c.id)),u instanceof Mt){let p={id:c.id,desc:u,_trace:l._trace.branch(c.id,!0)};o.insertEdge(l,p),r.push(p)}}}}for(;;){let l=o.roots();if(l.length===0){if(!o.isEmpty())throw new hWt(o);break}for(let{data:c}of l){if(this._getServiceInstanceOrDescriptor(c.id)instanceof Mt){let p=this._createServiceInstanceWithOwner(c.id,c.desc.ctor,c.desc.staticArguments,c.desc.supportsDelayedInstantiation,c._trace);this._setCreatedServiceInstance(c.id,p)}o.removeNode(c)}}return this._getServiceInstanceOrDescriptor(i)}_createServiceInstanceWithOwner(i,e,t=[],o,n){if(this._services.get(i)instanceof Mt)return this._createServiceInstance(i,e,t,o,n,this._servicesToMaybeDispose);if(this._parent)return this._parent._createServiceInstanceWithOwner(i,e,t,o,n);throw new Error(`illegalState - creating UNKNOWN service instance ${e.name}`)}_createServiceInstance(i,e,t=[],o,n,r){if(o){let s=new a(void 0,this._strict,this,this._enableTracing);s._globalGraphImplicitDependency=String(i);let l=new Map,c=new v$(()=>{let u=s._createInstance(e,t,n);for(let[p,h]of l){let g=u[p];if(typeof g=="function")for(let f of h)f.disposable=g.apply(u,f.listener)}return l.clear(),r.add(u),u});return new Proxy(Object.create(null),{get(u,p){if(!c.isInitialized&&typeof p=="string"&&(p.startsWith("onDid")||p.startsWith("onWill"))){let f=l.get(p);return f||(f=new Vs,l.set(p,f)),(b,S,y)=>{if(c.isInitialized)return c.value[p](b,S,y);{let w={listener:[b,S,y],disposable:void 0},k=f.push(w);return Z(()=>{k(),w.disposable?.dispose()})}}}if(p in u)return u[p];let h=c.value,g=h[p];return typeof g!="function"||(g=g.bind(h),u[p]=g),g},set(u,p,h){return c.value[p]=h,!0},getPrototypeOf(u){return e.prototype}})}else{let s=this._createInstance(e,t,n);return r.add(s),s}}_throwIfStrict(i,e){if(e&&console.warn(i),this._strict)throw new Error(i)}};var IZ=class a{constructor(i,e){this.type=i;this.name=e;this._start=Date.now();this._dep=[]}static{this.all=new Set}static{this._None=new class extends a{constructor(){super(0,null)}stop(){}branch(){return this}}}static traceInvocation(i,e){return i?new a(2,e.name||new Error().stack.split(`
`).slice(3,4).join(`
`)):a._None}static traceCreation(i,e){return i?new a(1,e.name):a._None}static{this._totals=0}branch(i,e){let t=new a(3,i.toString());return this._dep.push([i,e,t]),t}stop(){let i=Date.now()-this._start;a._totals+=i;let e=!1;function t(n,r){let s=[],l=new Array(n+1).join(" ");for(let[c,u,p]of r._dep)if(u&&p){e=!0,s.push(`${l}CREATES -> ${c}`);let h=t(n+1,p);h&&s.push(h)}else s.push(`${l}uses -> ${c}`);return s.join(`
`)}let o=[`${this.type===1?"CREATE":"CALL"} ${this.name}`,`${t(1,this)}`,`DONE, took ${i.toFixed(2)}ms (grand total ${a._totals.toFixed(2)}ms)`];(i>2||e)&&a.all.add(o.join(`
`))}};var jLe=class extends C{constructor(e,t,o){super();this._configurationService=e;this._editorService=t;this._telemetryService=o;this._listener=this._register(new me);this._scheduler=this._register(new Dt(()=>{this._logSamples(),this._setupListener()},6e4)),(Math.random()<=.01||this._configurationService.getValue("editor.experimentalGpuAcceleration")==="on")&&this._setupListener()}_setupListener(){this._listener.value=H.once(this._editorService.onDidActiveEditorChange)(()=>this._scheduler.schedule())}_logSamples(){let e=vx.getAndClearMeasurements();e&&this._telemetryService.publicLog2("performance.inputLatency",{keydown:e.keydown,input:e.input,render:e.render,total:e.total,sampleCount:e.sampleCount,gpuAcceleration:this._configurationService.getValue("editor.experimentalGpuAcceleration")==="on"})}};jLe=I([m(0,B),m(1,ee),m(2,Te)],jLe);pt(oA.ID,oA,{lazy:!0});oe.as(rn.EditorFactory).registerEditorSerializer(VK.Id,class{canSerialize(){return!0}serialize(){return""}deserialize(a){return a.createInstance(VK)}});W(class extends K{constructor(){super({id:"perfview.show",title:L(12267,"Startup Performance"),category:We.Developer,f1:!0})}run(a){let i=a.get(ee),e=oA.get();return i.openEditor(e.getEditorInput(),{pinned:!0})}});W(class extends K{constructor(){super({id:"perf.insta.printAsyncCycles",title:L(12264,"Print Service Cycles"),category:We.Developer,f1:!0})}run(i){let e=i.get(F);if(e instanceof qLe){let t=e._globalGraph?.findCycleSlow();t?console.warn("CYCLE",t):console.warn("YEAH, no more cycles")}}});W(class extends K{constructor(){super({id:"perf.insta.printTraces",title:L(12266,"Print Service Traces"),category:We.Developer,f1:!0})}run(){if(IZ.all.size===0){console.log("Enable via `instantiationService.ts#_enableAllTracing`");return}for(let i of IZ.all)console.log(i)}});W(class extends K{constructor(){super({id:"perf.event.profiling",title:L(12265,"Print Emitter Profiles"),category:We.Developer,f1:!0})}run(){if(mbe.all.size===0){console.log("USE `EmitterOptions._profName` to enable profiling");return}for(let i of mbe.all)console.log(`${i.name}: ${i.invocationCount} invocations COST ${i.elapsedOverall}ms, ${i.listenerCount} listeners, avg cost is ${i.durations.reduce((e,t)=>e+t,0)/i.durations.length}ms`)}});oe.as(Qi.Workbench).registerWorkbenchContribution(jLe,4);var QLe=class{static{this.Id="perf.disposableTracking"}constructor(i){!i.isBuilt&&!i.extensionTestsLocationURI&&obe(new Kut)}};QLe=I([m(0,Co)],QLe);pt(QLe.Id,QLe,ut.Eventually);var Fao=new Q("userHasOpenedNotebook",!1),gWt=new Q("notebookFindWidgetFocused",!1),fWt=new Q("interactiveWindowOpen",!1),C4=new Q("mostRecentReplEditor",void 0),Ua=x.equals("activeEditor",qL),FJe=x.equals("activeEditor",cY),Iyi=x.equals("activeEditor",uxe),Wao=x.or(Ua,FJe,Iyi),mS=new Q("isCompositeNotebook",!1),rr=new Q("notebookEditorFocused",!1),$u=new Q("notebookCellListFocused",!1),PR=new Q("notebookOutputFocused",!1),yZ=new Q("notebookOutputInputFocused",!1),Kl=new Q("notebookEditable",!0),x4=new Q("notebookHasRunningCell",!1),mB=new Q("notebookHasSomethingRunning",!1),WJe=new Q("notebookUseConsolidatedOutputButton",!1),RNd=new Q("notebookBreakpointMargin",!1),Vao=new Q("notebookCellToolbarLocation","left"),VJe=new Q("notebookCursorNavigationMode",!1),YLe=new Q("notebookLastCellFailed",!1),Bao=new Q("notebookType",void 0),hS=new Q("notebookCellType",void 0),bw=new Q("notebookCellEditable",!1),Cpe=new Q("notebookCellFocused",!1),AR=new Q("notebookCellEditorFocused",!1),wZ=new Q("notebookCellMarkdownEditMode",!1),BJe=new Q("notebookCellLineNumbers","inherit"),xpe=new Q("notebookCellExecutionState",void 0),vWt=new Q("notebookCellExecuting",!1),gk=new Q("notebookCellHasOutputs",!1),bWt=new Q("notebookCellIsFirstOutput",!1),SWt=new Q("hasHiddenOutputs",!1),XLe=new Q("notebookCellOutputMimeType",void 0),JLe=new Q("notebookCellInputIsCollapsed",!1),HJe=new Q("notebookCellOutputIsCollapsed",!1),Hao=new Q("notebookCellResource",""),kpe=new Q("notebookCellHasErrorDiagnostics",!1),yyi=new Q("notebookCellOutputMimeTypeListForChat",[]),ZLe=new Q("notebookKernel",void 0),CZ=new Q("notebookKernelCount",0),eRe=new Q("notebookKernelSourceCount",0),Uao=new Q("notebookKernelSelected",!1),hB=new Q("notebookInterruptibleKernel",!1),IWt=new Q("notebookMissingKernelExtension",!1),yWt=new Q("notebookHasOutputs",!1),tRe=new Q("kernelHasVariableProvider",!1);var tT="_notebook.selectKernel",jm=L(11771,"Notebook"),VF="inline/cell",zao="inline/output",rf=100,Kao=201;function Epe(a){let i=qn(a.activeEditorPane);if(!i||!i.hasModel())return;let e=i.getActiveCell(),t=i.getSelectionViewModels();return{cell:e,selectedCells:t,notebookEditor:i}}function B3o(a,i){let t=a.get(Zc).listNotebookEditors().find(o=>o.hasModel()&&o.textModel.uri.toString()===i.toString());if(t&&t.hasModel())return t}function wWt(a,i){let e=A.revive(i);if(e){let t=B3o(a,e);if(t)return{notebookEditor:t}}}function xZ(a,i){let e;for(let[,t]of a.notebookEditor.codeEditors)if(Xe(t.getModel()?.uri,i.uri)){e=t;break}return e}var qu=class extends K{constructor(i){if(i.f1!==!1){i.f1=!1;let e={id:D.CommandPalette,when:x.or(Ua,FJe,Iyi)};i.menu?Array.isArray(i.menu)||(i.menu=[i.menu]):i.menu=[],i.menu=[...i.menu,e]}i.category=jm,super(i)}async run(i,e,...t){if(Cyi(i,this.desc.id,e),!(!this.isNotebookActionContext(e)&&(e=this.getEditorContextFromArgsOrActive(i,e,...t),!e)))return this.runWithContext(i,e)}isNotebookActionContext(i){return!!i&&!!i.notebookEditor}getEditorContextFromArgsOrActive(i,e,...t){return Epe(i.get(ee))}},xg=class extends K{constructor(i){if(i.f1!==!1){i.f1=!1;let e={id:D.CommandPalette,when:Ua};i.menu?Array.isArray(i.menu)||(i.menu=[i.menu]):i.menu=[],i.menu=[...i.menu,e]}i.category=jm,super(i)}parseArgs(i,...e){}async run(i,...e){let t=e[0];if(Cyi(i,this.desc.id,t),Gao(t))return this.runWithContext(i,t);let n=this.parseArgs(i,...e);if(n)return this.runWithContext(i,n);let r=iRe(i);if(r){let s=r.getSelections().length===0?[r.getFocus()]:r.getSelections();return this.runWithContext(i,{ui:!1,notebookEditor:r,selectedCells:_8e(r,s)})}}},gd=class extends qu{isCellActionContext(i){return!!i&&!!i.notebookEditor&&!!i.cell}getCellContextFromArgs(i,e,...t){}async run(i,e,...t){if(Cyi(i,this.desc.id,e),this.isCellActionContext(e))return this.runWithContext(i,e);let o=this.getCellContextFromArgs(i,e,...t);if(o)return this.runWithContext(i,o);let n=this.getEditorContextFromArgsOrActive(i);if(this.isCellActionContext(n))return this.runWithContext(i,n)}},wyi=x.or(x.greater(CZ.key,0),x.greater(eRe.key,0));function Cyi(a,i,e){if(e){let t=a.get(Te);if(e.source)t.publicLog2("workbenchActionExecuted",{id:i,from:e.source});else if(A.isUri(e))t.publicLog2("workbenchActionExecuted",{id:i,from:"cellEditorContextMenu"});else if(e&&"from"in e&&e.from==="cellContainer")t.publicLog2("workbenchActionExecuted",{id:i,from:"cellContainer"});else{let o=Gao(e)?"cellToolbar":mce(e)?"editorToolbar":"other";t.publicLog2("workbenchActionExecuted",{id:i,from:o})}}}function Gao(a){return!!a&&!!a.notebookEditor&&a.$mid===13}function H3o(a){if(a===void 0)return!1;let i=a.ranges;return!(!i||!Array.isArray(i)||i.some(e=>!ddi(e))||a.document&&!A.revive(a.document))}function iRe(a,i){let e=wWt(a,i)?.notebookEditor;if(e)return e;let t=qn(a.get(ee).activeEditorPane);if(!(!t||!t.hasModel()))return t}function BK(a,...i){let e=i[0];if(H3o(e)){let o=iRe(a,e.document);if(!o)return;let r=e.ranges.map(l=>o.getCellsInRange(l).slice(0)).flat(),s=e.autoReveal;return{ui:!1,notebookEditor:o,selectedCells:r,autoReveal:s}}if(ddi(e)){let o=i[1],n=iRe(a,o);return n?{ui:!1,notebookEditor:n,selectedCells:n.getCellsInRange(e)}:void 0}let t=Epe(a.get(ee));return t?{ui:!1,notebookEditor:t.notebookEditor,selectedCells:t.selectedCells??[],cell:t.cell}:void 0}var UJe=[{isOptional:!0,name:"options",description:"The cell range options",schema:{type:"object",required:["ranges"],properties:{ranges:{type:"array",items:[{type:"object",required:["start","end"],properties:{start:{type:"number"},end:{type:"number"}}}]},document:{type:"object",description:"The document uri"},autoReveal:{type:"boolean",description:"Whether the cell should be revealed into view automatically"}}}}];fe.appendMenuItem(D.NotebookCellTitle,{submenu:D.NotebookCellInsert,title:d(11773,null),group:"2_insert",when:Kl.isEqualTo(!0)});fe.appendMenuItem(D.EditorContext,{submenu:D.NotebookCellTitle,title:d(11772,null),group:"2_insert",when:rr});fe.appendMenuItem(D.NotebookCellTitle,{title:d(11770,null),submenu:D.EditorContextShare,group:"4_share"});var Tpe=Re("notebook-kernel-select",M.serverEnvironment,d(12079,null)),HK=Re("notebook-execute",M.play,d(12066,null)),$ao=Re("notebook-execute-above",M.runAbove,d(12063,null)),qao=Re("notebook-execute-below",M.runBelow,d(12065,null)),CWt=Re("notebook-stop",M.primitiveSquare,d(12082,null)),jao=Re("notebook-delete-cell",M.trash,d(12060,null)),Qao=Re("notebook-execute-all",M.runAll,d(12064,null)),Yao=Re("notebook-edit",M.pencil,d(12061,null)),Xao=Re("notebook-stop-edit",M.check,d(12081,null)),Jao=Re("notebook-move-up",M.arrowUp,d(12071,null)),Zao=Re("notebook-move-down",M.arrowDown,d(12070,null)),xyi=Re("notebook-clear",M.clearAll,d(12057,null)),elo=Re("notebook-split-cell",M.splitVertical,d(12080,null)),xWt=Re("notebook-state-success",M.check,d(12083,null)),oRe=Re("notebook-state-error",M.error,d(12062,null)),kWt=Re("notebook-state-pending",M.clock,d(12074,null)),Sw=Re("notebook-state-executing",M.sync,d(12067,null)),EWt=Re("notebook-collapsed",M.chevronRight,d(12058,null)),TWt=Re("notebook-expanded",M.chevronDown,d(12068,null)),tlo=Re("notebook-open-as-text",M.fileCode,d(12073,null)),kZ=Re("notebook-revert",M.discard,d(12077,null)),ilo=Re("notebook-diff-cell-toggle-whitespace",M.whitespace,d(12084,null)),olo=Re("notebook-render-output",M.preview,d(12076,null)),_Wt=Re("notebook-mimetype",M.code,d(12069,null)),zJe=Re("notebook-copy",M.copy,d(12059,null)),nlo=Re("notebook-save",M.save,d(12078,null)),rlo=Re("notebook-diff-editor-previous-change",M.arrowUp,d(12075,null)),slo=Re("notebook-diff-editor-next-change",M.arrowDown,d(12072,null)),DWt=Re("variables-view-icon",M.variableGroup,d(12085,null));function KJe(a){return"kernel"in a}function U3o(a){return"kernels"in a}function LWt(a){return"action"in a}function llo(a){return a.id==="installSuggested"&&"extensionIds"in a}function clo(a){return a.id==="install"}function alo(a){return"command"in a}function z3o(a){return"autoRun"in a&&!!a.autoRun}var dlo=200;function kyi(a,i){let e={kernel:a,picked:a.id===i?.id,label:a.label,description:a.description,detail:a.detail};return a.id===i?.id&&(e.description?e.description=d(12131,null,e.description):e.description=d(12130,null)),e}var Eyi=class{constructor(i,e,t,o,n,r,s,l,c){this._notebookKernelService=i;this._productService=e;this._quickInputService=t;this._labelService=o;this._logService=n;this._extensionWorkbenchService=r;this._extensionService=s;this._commandService=l;this._extensionManagementServerService=c}async showQuickPick(i,e,t){let o=i.textModel,n=i.scopedContextKeyService,r=this._getMatchingResult(o),{selected:s,all:l}=r,c;if(e){for(let S of l)if(S.id===e){c=S;break}if(!c)return this._logService.warn(`wanted kernel DOES NOT EXIST, wanted: ${e}, all: ${l.map(S=>S.id)}`),!1}if(c)return this._selecteKernel(o,c),!0;let u=new P,p=u.add(this._quickInputService.createQuickPick({useSeparators:!0})),h=this._getKernelPickerQuickPickItems(o,r,this._notebookKernelService,n);if(h.length===1&&z3o(h[0])&&!t){let S=await this._handleQuickPick(i,h[0],h);return u.dispose(),S}p.items=h,p.canSelectMany=!1,p.placeholder=s?d(12136,null,this._labelService.getUriLabel(o.uri,{relative:!0})):d(12137,null,this._labelService.getUriLabel(o.uri,{relative:!0})),p.busy=this._notebookKernelService.getKernelDetectionTasks(o).length>0;let g=this._notebookKernelService.onDidChangeKernelDetectionTasks(()=>{p.busy=this._notebookKernelService.getKernelDetectionTasks(o).length>0}),f=h.length===0?xn(S=>this._showInstallKernelExtensionRecommendation(o,p,this._extensionWorkbenchService,S)):void 0,v=H.debounce(H.any(this._notebookKernelService.onDidChangeSourceActions,this._notebookKernelService.onDidAddKernel,this._notebookKernelService.onDidRemoveKernel,this._notebookKernelService.onDidChangeNotebookAffinity),(S,y)=>S,dlo)(async()=>{p.busy=!1,f?.cancel();let S=p.activeItems,y=this._getMatchingResult(o),w=this._getKernelPickerQuickPickItems(o,y,this._notebookKernelService,n);p.keepScrollPosition=!0;let k=[];for(let T of S)if(KJe(T)){let N=T.kernel.id,O=w.find(V=>KJe(V)&&V.kernel.id===N);O&&k.push(O)}else if(LWt(T)){let N=w.find(O=>LWt(O)&&O.action.action.id===T.action.action.id);N&&k.push(N)}p.items=w,p.activeItems=k},this),b=await new Promise((S,y)=>{u.add(p.onDidAccept(()=>{let w=p.selectedItems[0];S(w?{selected:w,items:p.items}:{selected:void 0,items:p.items}),p.hide()})),u.add(p.onDidHide(()=>{g.dispose(),v.dispose(),p.dispose(),S({selected:void 0,items:p.items})})),p.show()});return u.dispose(),b.selected?await this._handleQuickPick(i,b.selected,b.items):!1}_getMatchingResult(i){return this._notebookKernelService.getMatchingKernel(i)}async _handleQuickPick(i,e,t){if(KJe(e)){let o=e.kernel;return this._selecteKernel(i.textModel,o),!0}return clo(e)?await this._showKernelExtension(this._extensionWorkbenchService,this._extensionService,this._extensionManagementServerService,i.textModel.viewType,[]):llo(e)?await this._showKernelExtension(this._extensionWorkbenchService,this._extensionService,this._extensionManagementServerService,i.textModel.viewType,e.extensionIds,this._productService.quality!=="stable"):LWt(e)&&e.action.runAction(),!0}_selecteKernel(i,e){this._notebookKernelService.selectKernelForNotebook(e,i)}async _showKernelExtension(i,e,t,o,n,r){let s=[],l=[],c=[];for(let p of n){let h=(await i.getExtensions([{id:p}],ve.None))[0];if(h.enablementState===10||h.enablementState===11||h.enablementState===2)c.push(h);else if(!i.installed.some(g=>Ot(g.identifier,h.identifier)))await i.canInstall(h)===!0&&s.push(h);else if(t.remoteExtensionManagementServer){if(i.installed.some(g=>Ot(g.identifier,h.identifier)&&g.server===t.remoteExtensionManagementServer))continue;await i.canInstall(h)&&l.push(h)}}if(s.length||c.length||l.length){await Promise.all([...s.map(async p=>{await i.install(p,{installPreReleaseVersion:r??!1,context:{skipWalkthrough:!0}},15)}),...c.map(async p=>{switch(p.enablementState){case 11:await i.setEnablement([p],13);return;case 10:await i.setEnablement([p],12);return;case 2:await i.setEnablement([p],3);return;default:break}}),...l.map(async p=>{await i.installInServer(p,this._extensionManagementServerService.remoteExtensionManagementServer)})]),await e.activateByEvent(`onNotebook:${o}`);return}let u=o.split(/[^a-z0-9]/ig).map(Cre).join("");await i.openSearch(`@tag:notebookKernel${u}`)}async _showInstallKernelExtensionRecommendation(i,e,t,o){e.busy=!0;let n=await this._getKernelRecommendationsQuickPickItems(i,t);e.busy=!1,!o.isCancellationRequested&&n&&e.items.length===0&&(e.items=n)}async _getKernelRecommendationsQuickPickItems(i,e){let t=[],o=this.getSuggestedLanguage(i),n=o?this.getSuggestedKernelFromLanguage(i.viewType,o):void 0;if(n){if(await e.queryLocal(),e.installed.filter(s=>(s.enablementState===3||s.enablementState===12||s.enablementState===13)&&n.extensionIds.includes(s.identifier.id)).length===n.extensionIds.length)return;t.push({id:"installSuggested",description:n.displayName??n.extensionIds.join(", "),label:`$(${M.lightbulb.id}) `+d(12132,null),extensionIds:n.extensionIds})}return t.push({id:"install",label:d(12138,null)}),t}getSuggestedLanguage(i){let o=i.metadata?.metadata?.language_info?.name;if(!o){let n=i.cells.map(r=>r.language).filter(r=>r!=="markdown");if(n.length>1){let r=n[0];n.every(s=>s===r)&&(o=r)}}return o}getSuggestedKernelFromLanguage(i,e){return OEt.get(i)?.get(e)}},E4=class extends Eyi{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,t,o,n,r,s,l,u,c);this._notebookKernelHistoryService=p;this._openerService=h}_getKernelPickerQuickPickItems(e,t,o,n){let r=[];if(t.selected){let l=kyi(t.selected,t.selected);r.push(l)}t.suggestions.filter(l=>l.id!==t.selected?.id).map(l=>kyi(l,t.selected)).forEach(l=>{r.push(l)});let s=r.length===0;return r.length>0&&r.push({type:"separator"}),r.push({id:"selectAnother",label:d(12141,null),autoRun:s}),r}_selecteKernel(e,t){let o=this._notebookKernelService.getMatchingKernel(e);o.selected&&this._notebookKernelHistoryService.addMostRecentKernel(o.selected),super._selecteKernel(e,t),this._notebookKernelHistoryService.addMostRecentKernel(t)}_getMatchingResult(e){let{selected:t,all:o}=this._notebookKernelHistoryService.getKernels(e),n=this._notebookKernelService.getMatchingKernel(e);return{selected:t,all:n.all,suggestions:o,hidden:[]}}async _handleQuickPick(e,t,o){return t.id==="selectAnother"?this.displaySelectAnotherQuickPick(e,o.length===1&&o[0]===t):super._handleQuickPick(e,t,o)}async displaySelectAnotherQuickPick(e,t){let o=e.textModel,n=new P,r=n.add(this._quickInputService.createQuickPick({useSeparators:!0})),s=await new Promise(l=>{r.title=t?d(12139,null):d(12140,null),r.placeholder=d(12142,null),r.busy=!0,r.buttons=[this._quickInputService.backButton],r.show(),n.add(r.onDidTriggerButton(c=>{c===this._quickInputService.backButton&&l(c)})),n.add(r.onDidTriggerItemButton(async c=>{if(alo(c.item)&&c.item.documentation!==void 0){let u=A.isUri(c.item.documentation)?A.parse(c.item.documentation):await this._commandService.executeCommand(c.item.documentation);u&&this._openerService.open(u,{openExternal:!0})}})),n.add(r.onDidAccept(async()=>{l(r.selectedItems[0])})),n.add(r.onDidHide(()=>{l(void 0)})),this._calculdateKernelSources(e).then(c=>{r.items=c,r.items.length>0&&(r.busy=!1)}),n.add(H.debounce(H.any(this._notebookKernelService.onDidChangeSourceActions,this._notebookKernelService.onDidAddKernel,this._notebookKernelService.onDidRemoveKernel),(c,u)=>c,dlo)(async()=>{r.busy=!0;let c=await this._calculdateKernelSources(e);r.items=c,r.busy=!1}))});if(r.hide(),n.dispose(),s===this._quickInputService.backButton)return this.showQuickPick(e,void 0,!0);if(s){let l=s;if(alo(l))try{let c=await this._executeCommand(o,l.command);if(c){let{all:u}=await this._getMatchingResult(o),p=u.find(h=>h.id===`ms-toolsai.jupyter/${c}`);return p&&await this._selecteKernel(o,p),!0}else return this.displaySelectAnotherQuickPick(e,!1)}catch{return!1}else{if(KJe(l))return await this._selecteKernel(o,l.kernel),!0;if(U3o(l))return await this._selectOneKernel(o,l.label,l.kernels),!0;if(LWt(l))try{return await l.action.runAction(),!0}catch{return!1}else{if(clo(l))return await this._showKernelExtension(this._extensionWorkbenchService,this._extensionService,this._extensionManagementServerService,e.textModel.viewType,[]),!0;if(llo(l))return await this._showKernelExtension(this._extensionWorkbenchService,this._extensionService,this._extensionManagementServerService,e.textModel.viewType,l.extensionIds,this._productService.quality!=="stable"),this.displaySelectAnotherQuickPick(e,!1)}}}return!1}async _calculdateKernelSources(e){let t=e.textModel,o=this._notebookKernelService.getSourceActions(t,e.scopedContextKeyService),n=await this._notebookKernelService.getKernelSourceActions2(t),r=this._getMatchingResult(t);if(o.length===0&&r.all.length===0&&n.length===0)return await this._getKernelRecommendationsQuickPickItems(t,this._extensionWorkbenchService)??[];let s=r.all.filter(u=>u.extension.value!==Gxe),l=[];for(let u of Pg(s,(p,h)=>p.extension.value===h.extension.value?0:1)){let p=this._extensionService.extensions.find(g=>g.identifier.value===u[0].extension.value),h=p?.displayName??p?.description??u[0].extension.value;u.length>1?l.push({label:h,kernels:u}):l.push({label:u[0].label,kernel:u[0]})}let c=n.filter(u=>u.command);l.push(...c.map(u=>{let p=u.documentation?[{iconClass:q.asClassName(M.info),tooltip:d(12135,null)}]:[];return{id:typeof u.command=="string"?u.command:u.command.id,label:u.label,description:u.description,command:u.command,documentation:u.documentation,buttons:p}}));for(let u of o){let p={action:u,picked:!1,label:u.action.label,tooltip:u.action.tooltip};l.push(p)}return l}async _selectOneKernel(e,t,o){let n=o.map(l=>kyi(l,void 0)),r=new P,s=r.add(this._quickInputService.createQuickPick({useSeparators:!0}));s.items=n,s.canSelectMany=!1,s.title=d(12143,null,t),r.add(s.onDidAccept(async()=>{s.selectedItems&&s.selectedItems.length>0&&KJe(s.selectedItems[0])&&await this._selecteKernel(e,s.selectedItems[0].kernel),s.hide(),s.dispose()})),r.add(s.onDidHide(()=>{r.dispose()})),s.show()}async _executeCommand(e,t){let o=typeof t=="string"?t:t.id,n=typeof t=="string"?[]:t.arguments??[];return(typeof t=="string"||!t.arguments||!Array.isArray(t.arguments)||t.arguments.length===0)&&n.unshift({uri:e.uri,$mid:14}),typeof t=="string"?this._commandService.executeCommand(o):this._commandService.executeCommand(o,...n)}static updateKernelStatusAction(e,t,o,n){if(o.getKernelDetectionTasks(e).length){let u=o.getMatchingKernel(e);if(t.enabled=!0,t.class=q.asClassName(q.modify(Sw,"spin")),u.selected){t.label=u.selected.label;let p=u.selected.description??u.selected.detail;t.tooltip=p?d(12134,null,p):d(12133,null)}else t.label=d(12133,null);return}let s=o.getRunningSourceActions(e),l=(u,p)=>{let h=u.action;t.class=p?q.asClassName(q.modify(Sw,"spin")):q.asClassName(Tpe),t.label=h.label,t.enabled=!0};if(s.length)return l(s[0],!0);let{selected:c}=n.getKernels(e);c?(t.label=c.label,t.class=q.asClassName(Tpe),t.tooltip=c.description??c.detail??""):(t.label=d(12139,null),t.class=q.asClassName(Tpe),t.tooltip="")}static async resolveKernel(e,t,o,n){let r=o.getKernels(e);if(r.selected)return r.selected;await n.executeCommand(tT);let{selected:s}=o.getKernels(e);return s}};E4=I([m(0,Tl),m(1,nt),m(2,Ge),m(3,ot),m(4,ne),m(5,zi),m(6,lt),m(7,Gc),m(8,ge),m(9,mR),m(10,Qe)],E4);function K3o(a,i){let e;if(i!==void 0&&"notebookEditorId"in i){let t=i.notebookEditorId,o=a.visibleEditorPanes.find(n=>qn(n)?.getId()===t);e=qn(o)}else i!==void 0&&"notebookEditor"in i?e=i?.notebookEditor:e=qn(a.activeEditorPane);return e}function G3o(a,i,e,t){return!!(a&&(t&&"skipIfAlreadySelected"in t&&t.skipIfAlreadySelected||i&&a.id===i&&Ei.equals(a.extension,e)))}W(class extends K{constructor(){super({id:tT,category:jm,title:L(12144,"Select Notebook Kernel"),icon:Tpe,f1:!0,precondition:Ua,menu:[{id:D.EditorTitle,when:x.and(Ua,x.notEquals("config.notebook.globalToolbar",!0)),group:"navigation",order:-10},{id:D.NotebookToolbar,when:x.equals("config.notebook.globalToolbar",!0),group:"status",order:-10},{id:D.InteractiveToolbar,when:CZ.notEqualsTo(0),group:"status",order:-10}],metadata:{description:d(12145,null),args:[{name:"kernelInfo",description:"The kernel info",schema:{type:"object",required:["id","extension"],properties:{id:{type:"string"},extension:{type:"string"},notebookEditorId:{type:"string"}}}}]}})}async run(a,i){let e=a.get(F),t=a.get(ee),o=K3o(t,i);if(!o||!o.hasModel())return!1;let n=i&&"id"in i?i.id:void 0,r=i&&"extension"in i?i.extension:void 0;n&&(typeof n!="string"||typeof r!="string")&&(n=void 0,r=void 0);let s=o.textModel,l=a.get(Tl),{selected:c}=l.getMatchingKernel(s);if(G3o(c,n,r,i))return!0;let u=n?`${r}/${n}`:void 0;return e.createInstance(E4).showQuickPick(o,u)}});var gB=class extends Lr{constructor(e,t,o,n,r){let s=new st("fakeAction",void 0,q.asClassName(Tpe),!0,l=>e.run(l));super(void 0,s,{...o,label:!1,icon:!0});this._editor=t;this._notebookKernelService=n;this._notebookKernelHistoryService=r;this._register(s),this._register(t.onDidChangeModel(this._update,this)),this._register(n.onDidAddKernel(this._update,this)),this._register(n.onDidRemoveKernel(this._update,this)),this._register(n.onDidChangeNotebookAffinity(this._update,this)),this._register(n.onDidChangeSelectedNotebooks(this._update,this)),this._register(n.onDidChangeSourceActions(this._update,this)),this._register(n.onDidChangeKernelDetectionTasks(this._update,this))}render(e){this._update(),super.render(e),e.classList.add("kernel-action-view-item"),this._kernelLabel=document.createElement("a"),e.appendChild(this._kernelLabel),this.updateLabel()}updateLabel(){this._kernelLabel&&(this._kernelLabel.classList.add("kernel-label"),this._kernelLabel.innerText=this._action.label)}_update(){let e=this._editor.textModel;if(!e){this._resetAction();return}E4.updateKernelStatusAction(e,this._action,this._notebookKernelService,this._notebookKernelHistoryService),this.updateClass()}_resetAction(){this._action.enabled=!1,this._action.label="",this._action.class=""}};gB=I([m(3,Tl),m(4,mR)],gB);var RWt=class{constructor(){this._marks={}}get value(){return{...this._marks}}mark(i){if(this._marks[i]){console.error(`Skipping overwrite of notebook perf value: ${i}`);return}this._marks[i]=Date.now()}};var Tyi="vscode://schemas/extensions",ulo={id:Tyi,allowComments:!0,allowTrailingCommas:!0,type:"object",title:d(10073,null),additionalProperties:!1,properties:{recommendations:{type:"array",description:d(10072,null),items:{type:"string",pattern:CO,errorMessage:d(10071,null)}},unwantedRecommendations:{type:"array",description:d(10074,null),items:{type:"string",pattern:CO,errorMessage:d(10071,null)}}}},_yi=["{"," // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations."," // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp",""," // List of extensions which should be recommended for users of this workspace.",' "recommendations": ['," "," ],"," // List of extensions recommended by VS Code that should not be recommended for users of this workspace.",' "unwantedRecommendations": ['," "," ]","}"].join(`
`);var plo=Re("extensions-view-icon",M.extensions,d(9873,null)),_pe=Re("extensions-manage",M.gear,d(9880,null)),mlo=Re("extensions-clear-search-results",M.clearAll,d(9870,null)),hlo=Re("extensions-refresh",M.refresh,d(9883,null)),MWt=Re("extensions-filter",M.filter,d(9874,null)),glo=Re("extensions-install-local-in-remote",M.cloudDownload,d(9877,null)),Dyi=Re("extensions-install-workspace-recommended",M.cloudDownload,d(9878,null)),flo=Re("extensions-configure-recommended",M.pencil,d(9871,null)),vlo=Re("extensions-sync-enabled",M.sync,d(9890,null)),GJe=Re("extensions-sync-ignored",M.syncIgnored,d(9891,null)),blo=Re("extensions-remote",M.remote,d(9884,null)),Lyi=Re("extensions-install-count",M.cloudDownload,d(9876,null)),Ryi=Re("extensions-private",M.lock,d(9879,null)),Slo=Re("extensions-rating",M.star,d(9882,null)),Myi=Re("extensions-pre-release",M.versions,d(9881,null)),$Je=Re("extensions-sponsor",M.heartFilled,d(9886,null)),qJe=Re("extensions-star-full",M.starFull,d(9888,null)),Ilo=Re("extensions-star-half",M.starHalf,d(9889,null)),PWt=Re("extensions-star-empty",M.starEmpty,d(9887,null)),gS=Re("extensions-error-message",M.error,d(9872,null)),_u=Re("extensions-warning-message",M.warning,d(9893,null)),kg=Re("extensions-info-message",M.info,d(9875,null)),NR=Re("extension-workspace-trust",M.shield,d(9892,null)),ylo=Re("extension-activation-time",M.history,d(9869,null)),wlo=Re("extension-restart-required",M.refresh,d(9885,null));var UK=ae("issueFormService"),UC=ae("workbenchIssueService");var EZ=class extends st{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super("extension.promptExtensionInstallFailure");this.extension=e;this.options=t;this.version=o;this.installOperation=n;this.error=r;this.productService=s;this.openerService=l;this.notificationService=c;this.dialogService=u;this.commandService=p;this.logService=h;this.extensionManagementServerService=g;this.instantiationService=f;this.galleryService=v;this.extensionManifestPropertiesService=b;this.workbenchIssueService=S}async run(){if(so(this.error))return;if(this.logService.error(this.error),this.error.name==="Unsupported"){let s=Gt?d(9854,null,this.productService.nameLong):this.productService.nameLong,l=d(9710,null,this.extension.displayName||this.extension.identifier.id,s),{confirmed:c}=await this.dialogService.confirm({type:St.Info,message:l,primaryButton:d(9803,null),cancelButton:d(9712,null)});c&&this.openerService.open(Gt?A.parse("https://aka.ms/vscode-web-extensions-guide"):A.parse("https://aka.ms/vscode-remote"));return}if("ReleaseVersionNotFound"===this.error.name){await this.dialogService.prompt({type:"error",message:Cn(this.error),buttons:[{label:d(9782,null),run:()=>{let s=this.instantiationService.createInstance(Iw,{installPreReleaseVersion:!0});return s.extension=this.extension,s.run()}}],cancelButton:d(9708,null)});return}if(["Incompatible","IncompatibleApi","IncompatibleTargetPlatform","Malicious","Deprecated"].includes(this.error.name)){await this.dialogService.info(Cn(this.error));return}if("PackageNotSigned"===this.error.name){await this.dialogService.prompt({type:"error",message:d(9806,null,this.extension.displayName),detail:Cn(this.error),buttons:[{label:d(9768,null),run:()=>{let s=this.instantiationService.createInstance(Iw,{...this.options,donotVerifySignature:!0});return s.extension=this.extension,s.run()}}],cancelButton:!0});return}if("SignatureVerificationFailed"===this.error.name){await this.dialogService.prompt({type:"error",message:d(9853,null,this.extension.displayName,this.productService.nameLong),detail:Cn(this.error),buttons:[{label:d(9795,null),run:()=>this.openerService.open("https://code.visualstudio.com/docs/editor/extension-marketplace#_the-extension-signature-cannot-be-verified-by-vs-code")},{label:d(9771,null),run:()=>{let s=this.instantiationService.createInstance(Iw,{...this.options,donotVerifySignature:!0});return s.extension=this.extension,s.run()}}],cancelButton:!0});return}if("SignatureVerificationInternal"===this.error.name){await this.dialogService.prompt({type:"error",message:d(9853,null,this.extension.displayName,this.productService.nameLong),detail:Cn(this.error),buttons:[{label:d(9795,null),run:()=>this.openerService.open("https://code.visualstudio.com/docs/editor/extension-marketplace#_the-extension-signature-cannot-be-verified-by-vs-code")},{label:d(9812,null),run:()=>this.workbenchIssueService.openReporter({issueTitle:d(9814,null,this.extension.displayName),issueBody:d(9813,null)})},{label:d(9771,null),run:()=>{let s=this.instantiationService.createInstance(Iw,{...this.options,donotVerifySignature:!0});return s.extension=this.extension,s.run()}}],cancelButton:!0});return}let e=this.installOperation===3?d(9845,null,this.extension.displayName||this.extension.identifier.id):d(9779,null,this.extension.displayName||this.extension.identifier.id),t,o=[],n=await this.getDownloadUrl();n&&(t=d(9711,null,ic(iK).toString()),o.push({label:d(9735,null),run:()=>this.openerService.open(n).then(()=>{this.notificationService.prompt(St.Info,d(9786,null,this.extension.identifier.id),[{label:d(9794,null),run:()=>this.commandService.executeCommand(vDt)}])})}));let r=`${e}${t?` ${t}`:""}`;this.notificationService.prompt(St.Error,r,o)}async getDownloadUrl(){if(Nc||!this.extension.gallery||!this.extensionManagementServerService.localExtensionManagementServer&&!this.extensionManagementServerService.remoteExtensionManagementServer)return;let e=this.extension.gallery.properties.targetPlatform;if(e!=="universal"&&e!=="undefined"&&this.extensionManagementServerService.remoteExtensionManagementServer)try{let o=await this.galleryService.getManifest(this.extension.gallery,ve.None);o&&this.extensionManifestPropertiesService.prefersExecuteOnWorkspace(o)&&(e=await this.extensionManagementServerService.remoteExtensionManagementServer.extensionManagementService.getTargetPlatform())}catch(o){this.logService.error(o);return}if(e==="unknown")return;let[t]=await this.galleryService.getExtensions([{...this.extension.identifier,version:this.version}],{targetPlatform:e},ve.None);if(t)return A.parse(t.assets.download.uri)}};EZ=I([m(5,nt),m(6,Qe),m(7,Ne),m(8,ct),m(9,ge),m(10,ne),m(11,Gc),m(12,F),m(13,ta),m(14,xp),m(15,UC)],EZ);var oa=class a extends st{constructor(){super(...arguments);this._onDidChange=this._register(new E);this._extension=null;this._hidden=!1;this.hideOnDisabled=!0}get onDidChange(){return this._onDidChange.event}static{this.EXTENSION_ACTION_CLASS="extension-action"}static{this.TEXT_ACTION_CLASS=`${a.EXTENSION_ACTION_CLASS} text`}static{this.LABEL_ACTION_CLASS=`${a.EXTENSION_ACTION_CLASS} label`}static{this.ICON_ACTION_CLASS=`${a.EXTENSION_ACTION_CLASS} icon`}get extension(){return this._extension}set extension(e){this._extension=e,this.update()}get hidden(){return this._hidden}set hidden(e){this._hidden!==e&&(this._hidden=e,this._onDidChange.fire({hidden:e}))}_setEnabled(e){super._setEnabled(e),this.hideOnDisabled&&(this.hidden=!e)}},qK=class extends oa{constructor(e,t,o){t=`${t} action-dropdown`;super(e,void 0,t);this.actionsGroups=o;this.menuActionClassNames=[];this._menuActions=[];this.menuActionClassNames=t.split(" "),this.hideOnDisabled=!1,this.extensionActions=o.flat(),this.update(),this._register(H.any(...this.extensionActions.map(n=>n.onDidChange))(()=>this.update(!0))),this.extensionActions.forEach(n=>this._register(n))}get menuActions(){return[...this._menuActions]}get extension(){return super.extension}set extension(e){this.extensionActions.forEach(t=>t.extension=e),super.extension=e}update(e){e||this.extensionActions.forEach(n=>n.update());let t=this.actionsGroups.map(n=>n.filter(r=>!r.hidden)),o=[];for(let n of t)n.length&&(o=[...o,...n,new li]);o=o.length?o.slice(0,o.length-1):o,this.primaryAction=o[0],this._menuActions=o.length>1?o:[],this._onDidChange.fire({menuActions:this._menuActions}),this.primaryAction?(this.hidden=!1,this.enabled=this.primaryAction.enabled,this.label=this.getLabel(this.primaryAction),this.tooltip=this.primaryAction.tooltip):(this.hidden=!0,this.enabled=!1)}async run(){this.enabled&&await this.primaryAction?.run()}getLabel(e){return e.label}},dRe=class extends jye{constructor(i,e,t){super(null,i,e,t),this._register(i.onDidChange(o=>{(o.hidden!==void 0||o.menuActions!==void 0)&&this.updateClass()}))}render(i){super.render(i),this.updateClass()}updateClass(){if(super.updateClass(),this.element&&this.dropdownMenuActionViewItem?.element){this.element.classList.toggle("hide",this._action.hidden);let i=this._action.menuActions.length===0;this.element.classList.toggle("empty",i),this.dropdownMenuActionViewItem.element.classList.toggle("hide",i)}}},Iw=class extends oa{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super("extensions.install",d(9766,null),Iw.CLASS,!1);this.extensionsWorkbenchService=t;this.instantiationService=o;this.runtimeExtensionService=n;this.workbenchThemeService=r;this.labelService=s;this.dialogService=l;this.preferencesService=c;this.telemetryService=u;this.contextService=p;this.allowedExtensionsService=h;this.extensionGalleryManifestService=g;this._manifest=null;this.updateThrottler=this._register(new um);this.hideOnDisabled=!1,this.options={isMachineScoped:!1,...e},this.update(),this._register(h.onDidChangeAllowedExtensionsConfigValue(()=>this.update())),this._register(this.labelService.onDidChangeFormatters(()=>this.updateLabel(),this))}static{this.CLASS=`${this.LABEL_ACTION_CLASS} prominent install`}static{this.HIDE=`${this.CLASS} hide`}set manifest(e){this._manifest=e,this.updateLabel()}update(){this.updateThrottler.queue(()=>this.computeAndUpdateEnablement())}async computeAndUpdateEnablement(){this.enabled=!1,this.class=Iw.HIDE,this.hidden=!0,this.extension&&(this.extension.isBuiltin||this.extensionsWorkbenchService.canSetLanguage(this.extension)||this.extension.state===3&&(this.options.installPreReleaseVersion&&(!this.extension.hasPreReleaseVersion||this.allowedExtensionsService.isAllowed({id:this.extension.identifier.id,publisherDisplayName:this.extension.publisherDisplayName,prerelease:!0})!==!0)||!this.options.installPreReleaseVersion&&!this.extension.hasReleaseVersion||(this.hidden=!1,this.class=Iw.CLASS,await this.extensionsWorkbenchService.canInstall(this.extension)===!0&&(this.enabled=!0,this.updateLabel()))))}async run(){if(!this.extension)return;if(this.extension.gallery&&!this.extension.gallery.isSigned&&L3e(this.extension.private,await this.extensionGalleryManifestService.getExtensionGalleryManifest())){let{result:t}=await this.dialogService.prompt({type:St.Warning,message:d(9806,null,this.extension.displayName),detail:d(9807,null),buttons:[{label:d(9768,null),run:()=>(this.options.donotVerifySignature=!0,!0)}],cancelButton:{run:()=>!1}});if(!t)return}if(this.extension.deprecationInfo){let t=d(9719,null),o;(p=>(p[p.InstallAnyway=0]="InstallAnyway",p[p.ShowAlternateExtension=1]="ShowAlternateExtension",p[p.ConfigureSettings=2]="ConfigureSettings",p[p.Cancel=3]="Cancel"))(o||={});let n=[{label:d(9768,null),run:()=>0}];if(this.extension.deprecationInfo.extension){t=d(9721,null,this.extension.deprecationInfo.extension.displayName);let s=this.extension.deprecationInfo.extension;n.push({label:d(9827,null,this.extension.deprecationInfo.extension.displayName),run:async()=>{let[l]=await this.extensionsWorkbenchService.getExtensions([{id:s.id,preRelease:s.preRelease}],ve.None);return await this.extensionsWorkbenchService.open(l),1}})}else if(this.extension.deprecationInfo.settings){t=d(9723,null);let s=this.extension.deprecationInfo.settings;n.push({label:d(9713,null),run:async()=>(await this.preferencesService.openSettings({query:s.map(l=>`@id:${l}`).join(" ")}),2)})}else this.extension.deprecationInfo.additionalInfo&&(t=new xe(`${t} ${this.extension.deprecationInfo.additionalInfo}`));let{result:r}=await this.dialogService.prompt({type:St.Warning,message:d(9770,null,this.extension.displayName),detail:Ae(t)?t:void 0,custom:Ae(t)?void 0:{markdownDetails:[{markdown:t}]},buttons:n,cancelButton:{run:()=>3}});if(r!==0)return}this.extensionsWorkbenchService.open(this.extension,{showPreReleaseVersion:this.options.installPreReleaseVersion}),Jo(d(9790,null,this.extension.displayName)),this.telemetryService.publicLog("extensions:action:install",{...this.extension.telemetryData,actionId:this.id});let e=await this.install(this.extension);if(e?.local){Jo(d(9789,null,this.extension.displayName));let t=await this.getRunningExtension(e.local);if(t&&!(t.activationEvents&&t.activationEvents.some(o=>o.startsWith("onLanguage")))){let o=await this.getThemeAction(e);if(o){o.extension=e;try{return o.run({showCurrentTheme:!0,ignoreFocusLost:!0})}finally{o.dispose()}}}}}async getThemeAction(e){if((await this.workbenchThemeService.getColorThemes()).some(r=>$K(r,e)))return this.instantiationService.createInstance(fk);if((await this.workbenchThemeService.getFileIconThemes()).some(r=>$K(r,e)))return this.instantiationService.createInstance(vk);if((await this.workbenchThemeService.getProductIconThemes()).some(r=>$K(r,e)))return this.instantiationService.createInstance(bk)}async install(e){try{return await this.extensionsWorkbenchService.install(e,this.options)}catch(t){await this.instantiationService.createInstance(EZ,e,this.options,e.latestVersion,2,t).run();return}}async getRunningExtension(e){let t=await this.runtimeExtensionService.getExtension(e.identifier.id);return t||(this.runtimeExtensionService.canAddExtension(kO(e))?new Promise((o,n)=>{let r=this.runtimeExtensionService.onDidChangeExtensions(async()=>{let s=await this.runtimeExtensionService.getExtension(e.identifier.id);s&&(r.dispose(),o(s))})}):null)}updateLabel(){this.label=this.getLabel()}getLabel(e){return this.extension?.isWorkspaceScoped&&this.extension.resourceExtension&&this.contextService.isInsideWorkspace(this.extension.resourceExtension.location)?d(9787,null):this.options.installPreReleaseVersion&&this.extension?.hasPreReleaseVersion?e?d(9780,null):d(9781,null):this.extension?.hasPreReleaseVersion?e?d(9766,null):d(9784,null):d(9766,null)}};Iw=I([m(1,zi),m(2,F),m(3,lt),m(4,Gp),m(5,ot),m(6,ct),m(7,Po),m(8,Te),m(9,Pe),m(10,zp),m(11,vv)],Iw);var TZ=class extends qK{set manifest(i){this.extensionActions.forEach(e=>e.manifest=i),this.update()}constructor(i,e){super("extensions.installActions",Iw.CLASS,[[i.createInstance(Iw,{installPreReleaseVersion:e.preferPreReleases}),i.createInstance(Iw,{installPreReleaseVersion:!e.preferPreReleases})]])}getLabel(i){return i.getLabel(!0)}};TZ=I([m(0,F),m(1,Hd)],TZ);var uRe=class a extends oa{static{this.LABEL=d(9791,null)}static{this.CLASS=`${oa.LABEL_ACTION_CLASS} install installing`}constructor(){super("extension.installing",a.LABEL,a.CLASS,!1)}update(){this.class=`${a.CLASS}${this.extension&&this.extension.state===0?"":" hide"}`}},OR=class extends oa{constructor(e,t,o,n,r,s){super(e,OR.INSTALL_LABEL,OR.Class,!1);this.server=t;this.canInstallAnyWhere=o;this.extensionsWorkbenchService=n;this.extensionManagementServerService=r;this.extensionManifestPropertiesService=s;this.updateWhenCounterExtensionChanges=!0;this.update()}static{this.INSTALL_LABEL=d(9766,null)}static{this.INSTALLING_LABEL=d(9791,null)}static{this.Class=`${oa.LABEL_ACTION_CLASS} prominent install-other-server`}static{this.InstallingClass=`${oa.LABEL_ACTION_CLASS} install-other-server installing`}update(){if(this.enabled=!1,this.class=OR.Class,this.canInstall()){let e=this.extensionsWorkbenchService.installed.filter(t=>Ot(t.identifier,this.extension.identifier)&&t.server===this.server)[0];e?e.state===0&&!e.local&&(this.enabled=!0,this.label=OR.INSTALLING_LABEL,this.class=OR.InstallingClass):(this.enabled=!0,this.label=this.getInstallLabel())}}canInstall(){return!this.extension||!this.server||!this.extension.local||this.extension.state!==1||this.extension.type!==1||this.extension.enablementState===2||this.extension.enablementState===0||this.extension.enablementState===5?!1:!!(NL(this.extension.local.manifest)||this.server===this.extensionManagementServerService.localExtensionManagementServer&&this.extensionManifestPropertiesService.prefersExecuteOnUI(this.extension.local.manifest)||this.server===this.extensionManagementServerService.remoteExtensionManagementServer&&this.extensionManifestPropertiesService.prefersExecuteOnWorkspace(this.extension.local.manifest)||this.server===this.extensionManagementServerService.webExtensionManagementServer&&this.extensionManifestPropertiesService.prefersExecuteOnWeb(this.extension.local.manifest)||this.canInstallAnyWhere&&(this.server===this.extensionManagementServerService.localExtensionManagementServer&&this.extensionManifestPropertiesService.canExecuteOnUI(this.extension.local.manifest)||this.server===this.extensionManagementServerService.remoteExtensionManagementServer&&this.extensionManifestPropertiesService.canExecuteOnWorkspace(this.extension.local.manifest)))}async run(){if(this.extension?.local&&this.extension?.server&&this.server)return this.extensionsWorkbenchService.open(this.extension),Jo(d(9790,null,this.extension.displayName)),this.extensionsWorkbenchService.installInServer(this.extension,this.server)}};OR=I([m(3,zi),m(4,Gc),m(5,xp)],OR);var T4=class extends OR{constructor(i,e,t,o){super("extensions.remoteinstall",t.remoteExtensionManagementServer,i,e,t,o)}getInstallLabel(){return this.extensionManagementServerService.remoteExtensionManagementServer?d(9773,null,this.extensionManagementServerService.remoteExtensionManagementServer.label):OR.INSTALL_LABEL}};T4=I([m(1,zi),m(2,Gc),m(3,xp)],T4);var _Z=class extends OR{constructor(i,e,t){super("extensions.localinstall",e.localExtensionManagementServer,!1,i,e,t)}getInstallLabel(){return d(9778,null)}};_Z=I([m(0,zi),m(1,Gc),m(2,xp)],_Z);var DZ=class extends OR{constructor(i,e,t){super("extensions.webInstall",e.webExtensionManagementServer,!1,i,e,t)}getInstallLabel(){return d(9769,null)}};DZ=I([m(0,zi),m(1,Gc),m(2,xp)],DZ);var iT=class extends oa{constructor(e,t,o){super("extensions.uninstall",iT.UninstallLabel,iT.UninstallClass,!1);this.extensionsWorkbenchService=e;this.userDataProfilesService=t;this.dialogService=o;this.update()}static{this.UninstallLabel=d(9838,null)}static{this.UninstallingLabel=d(9843,null)}static{this.UninstallClass=`${oa.LABEL_ACTION_CLASS} uninstall`}static{this.UnInstallingClass=`${oa.LABEL_ACTION_CLASS} uninstall uninstalling`}update(){if(!this.extension){this.enabled=!1;return}let e=this.extension.state;if(e===2){this.label=iT.UninstallingLabel,this.class=iT.UnInstallingClass,this.enabled=!1;return}if(this.label=this.extension.local?.isApplicationScoped&&this.userDataProfilesService.profiles.length>1?d(9839,null):iT.UninstallLabel,this.class=iT.UninstallClass,this.tooltip=iT.UninstallLabel,e!==1){this.enabled=!1;return}if(this.extension.isBuiltin){this.enabled=!1;return}this.enabled=!0}async run(){if(this.extension){Jo(d(9842,null,this.extension.displayName));try{await this.extensionsWorkbenchService.uninstall(this.extension),Jo(d(9841,null,this.extension.displayName))}catch(e){so(e)||this.dialogService.error(Cn(e))}}}};iT=I([m(0,zi),m(1,an),m(2,ct)],iT);var nA=class extends oa{constructor(e,t,o,n,r){super("extensions.update",d(9844,null),nA.DisabledClass,!1);this.verbose=e;this.extensionsWorkbenchService=t;this.dialogService=o;this.openerService=n;this.instantiationService=r;this.updateThrottler=this._register(new um);this.update()}static{this.EnabledClass=`${this.LABEL_ACTION_CLASS} update`}static{this.DisabledClass=`${this.EnabledClass} disabled`}update(){this.updateThrottler.queue(()=>this.computeAndUpdateEnablement()),this.extension&&(this.label=this.verbose?d(9847,null,this.extension.latestVersion):d(9844,null))}async computeAndUpdateEnablement(){if(this.enabled=!1,this.class=nA.DisabledClass,!this.extension||this.extension.deprecationInfo)return;let e=await this.extensionsWorkbenchService.canInstall(this.extension),t=this.extension.state===1;this.enabled=e===!0&&t&&this.extension.outdated,this.class=this.enabled?nA.EnabledClass:nA.DisabledClass}async run(){if(!this.extension)return;let e=await this.extensionsWorkbenchService.shouldRequireConsentToUpdate(this.extension);if(e){let{result:o}=await this.dialogService.prompt({type:"warning",title:d(9851,null,this.extension.displayName),message:d(9850,null,e),buttons:[{label:d(9844,null),run:()=>"update"},{label:d(9817,null),run:()=>"review"},{label:d(9708,null),run:()=>"cancel"}]});if(o==="cancel")return;if(o==="review")return this.extension.hasChangelog()?this.extensionsWorkbenchService.open(this.extension,{tab:"changelog"}):this.extension.repository?this.openerService.open(this.extension.repository):this.extensionsWorkbenchService.open(this.extension)}let t={};this.extension.local?.source==="vsix"&&this.extension.local.pinned&&(t.pinned=!1),this.extension.local?.preRelease&&(t.installPreReleaseVersion=!0);try{Jo(d(9852,null,this.extension.displayName,this.extension.latestVersion)),await this.extensionsWorkbenchService.install(this.extension,t),Jo(d(9849,null,this.extension.displayName,this.extension.latestVersion))}catch(o){this.instantiationService.createInstance(EZ,this.extension,t,this.extension.latestVersion,3,o).run()}}};nA=I([m(1,zi),m(2,ct),m(3,Qe),m(4,F)],nA);var zC=class extends oa{constructor(e,t,o,n){super(zC.ID,zC.LABEL.value,zC.DisabledClass);this.extensionsWorkbenchService=e;this.extensionEnablementService=t;this.allowedExtensionsService=o;this._register(n.onDidChangeConfiguration(r=>{r.affectsConfiguration(VE)&&this.update()})),this._register(o.onDidChangeAllowedExtensionsConfigValue(r=>this.update())),this.update()}static{this.ID="workbench.extensions.action.toggleAutoUpdateForExtension"}static{this.LABEL=L(9737,"Auto Update")}static{this.EnabledClass=`${oa.EXTENSION_ACTION_CLASS} auto-update`}static{this.DisabledClass=`${this.EnabledClass} hide`}update(){if(this.enabled=!1,this.class=zC.DisabledClass,!this.extension||this.extension.isBuiltin||this.extension.deprecationInfo?.disallowInstall)return;let e=this.extension.local??this.extension.gallery;e&&this.allowedExtensionsService.isAllowed(e)!==!0||this.extensionsWorkbenchService.getAutoUpdateValue()==="onlyEnabledExtensions"&&!this.extensionEnablementService.isEnabledEnablementState(this.extension.enablementState)||(this.enabled=!0,this.class=zC.EnabledClass,this.checked=this.extensionsWorkbenchService.isAutoUpdateEnabledFor(this.extension))}async run(){if(!this.extension)return;let e=!this.extensionsWorkbenchService.isAutoUpdateEnabledFor(this.extension);await this.extensionsWorkbenchService.updateAutoUpdateEnablementFor(this.extension,e),e?Jo(d(9736,null,this.extension.displayName)):Jo(d(9725,null,this.extension.displayName))}};zC=I([m(0,zi),m(1,Os),m(2,zp),m(3,B)],zC);var BF=class extends oa{constructor(e){super(BF.ID,BF.LABEL);this.extensionsWorkbenchService=e}static{this.ID="workbench.extensions.action.toggleAutoUpdatesForPublisher"}static{this.LABEL=d(9833,null)}update(){}async run(){if(!this.extension)return;Jo(d(9765,null,this.extension.publisherDisplayName));let e=!this.extensionsWorkbenchService.isAutoUpdateEnabledFor(this.extension.publisher);await this.extensionsWorkbenchService.updateAutoUpdateEnablementFor(this.extension.publisher,e),e?Jo(d(9736,null,this.extension.displayName)):Jo(d(9725,null,this.extension.displayName))}};BF=I([m(0,zi)],BF);var HF=class extends oa{constructor(e,t){super("extensionsAction.migrateDeprecatedExtension",d(9801,null),HF.DisabledClass,!1);this.small=e;this.extensionsWorkbenchService=t;this.update()}static{this.EnabledClass=`${oa.LABEL_ACTION_CLASS} migrate`}static{this.DisabledClass=`${this.EnabledClass} disabled`}update(){if(this.enabled=!1,this.class=HF.DisabledClass,!this.extension?.local||this.extension.state!==1||!this.extension.deprecationInfo?.extension)return;let e=this.extension.deprecationInfo.extension.id;this.extensionsWorkbenchService.local.some(t=>Ot(t.identifier,{id:e}))||(this.enabled=!0,this.class=HF.EnabledClass,this.tooltip=d(9800,null,this.extension.deprecationInfo.extension.displayName),this.label=this.small?d(9799,null):this.tooltip)}async run(){if(!this.extension?.deprecationInfo?.extension)return;let e=this.extension.local;await this.extensionsWorkbenchService.uninstall(this.extension);let[t]=await this.extensionsWorkbenchService.getExtensions([{id:this.extension.deprecationInfo.extension.id,preRelease:this.extension.deprecationInfo?.extension?.preRelease}],ve.None);await this.extensionsWorkbenchService.install(t,{isMachineScoped:e?.isMachineScoped})}};HF=I([m(1,zi)],HF);var fB=class extends oa{constructor(e,t,o,n,r){super(e,t,o,n);this.instantiationService=r;this._actionViewItem=null}createActionViewItem(e){return this._actionViewItem=this.instantiationService.createInstance(jJe,this,e),this._actionViewItem}run(e){return this._actionViewItem?.showMenu(e),Promise.resolve()}};fB=I([m(4,F)],fB);var jJe=class extends Lr{constructor(e,t,o){super(null,e,{...t,icon:!0,label:!0});this.contextMenuService=o}showMenu(e){if(this.element){let t=this.getActions(e),o=Yn(this.element),n={x:o.left,y:o.top+o.height+10};this.contextMenuService.showContextMenu({getAnchor:()=>n,getActions:()=>t,actionRunner:this.actionRunner,onHide:()=>jH(t)})}}getActions(e){let t=[];for(let o of e)t=[...t,...o,new li];return t.length?t.slice(0,t.length-1):t}};jJe=I([m(2,ze)],jJe);async function Clo(a,i,e){return e.invokeFunction(async t=>{let o=t.get(zi),n=t.get(Os),r=t.get(qt),s=t.get(nD),l=t.get(uk),c=t.get(Gp),u=t.get(OP),p=t.get(zp),h=[];if(a){switch(h.push(["extension",a.identifier.id]),h.push(["isBuiltinExtension",a.isBuiltin]),h.push(["isDefaultApplicationScopedExtension",a.local&&Xq(a.local.manifest)]),h.push(["isApplicationScopedExtension",a.local&&a.local.isApplicationScoped]),h.push(["isWorkspaceScopedExtension",a.isWorkspaceScoped]),h.push(["isGalleryExtension",!!a.identifier.uuid]),a.local&&h.push(["extensionSource",a.local.source]),h.push(["extensionHasConfiguration",a.local&&!!a.local.manifest.contributes&&!!a.local.manifest.contributes.configuration]),h.push(["extensionHasKeybindings",a.local&&!!a.local.manifest.contributes&&!!a.local.manifest.contributes.keybindings]),h.push(["extensionHasCommands",a.local&&!!a.local.manifest.contributes&&!!a.local.manifest.contributes?.commands]),h.push(["isExtensionRecommended",!!s.getAllRecommendationsWithReason()[a.identifier.id.toLowerCase()]]),h.push(["isExtensionWorkspaceRecommended",s.getAllRecommendationsWithReason()[a.identifier.id.toLowerCase()]?.reasonId===0]),h.push(["isUserIgnoredRecommendation",l.globalIgnoredRecommendations.some(y=>y===a.identifier.id.toLowerCase())]),h.push(["isExtensionPinned",a.pinned]),h.push(["isExtensionEnabled",n.isEnabledEnablementState(a.enablementState)]),a.state){case 0:h.push(["extensionStatus","installing"]);break;case 1:h.push(["extensionStatus","installed"]);break;case 2:h.push(["extensionStatus","uninstalling"]);break;case 3:h.push(["extensionStatus","uninstalled"]);break}h.push(["installedExtensionIsPreReleaseVersion",!!a.local?.isPreReleaseVersion]),h.push(["installedExtensionIsOptedToPreRelease",!!a.local?.preRelease]),h.push(["galleryExtensionIsPreReleaseVersion",!!a.gallery?.properties.isPreReleaseVersion]),h.push(["galleryExtensionHasPreReleaseVersion",a.gallery?.hasPreReleaseVersion]),h.push(["extensionHasPreReleaseVersion",a.hasPreReleaseVersion]),h.push(["extensionHasReleaseVersion",a.hasReleaseVersion]),h.push(["extensionDisallowInstall",a.isMalicious||a.deprecationInfo?.disallowInstall]),h.push(["isExtensionAllowed",p.isAllowed({id:a.identifier.id,publisherDisplayName:a.publisherDisplayName})===!0]),h.push(["isPreReleaseExtensionAllowed",p.isAllowed({id:a.identifier.id,publisherDisplayName:a.publisherDisplayName,prerelease:!0})===!0]),h.push(["extensionIsUnsigned",a.gallery&&!a.gallery.isSigned]),h.push(["extensionIsPrivate",a.gallery?.private]);let[f,v,b,S]=await Promise.all([c.getColorThemes(),c.getFileIconThemes(),c.getProductIconThemes(),u.extensionUsesAuth(a.identifier.id.toLowerCase())]);h.push(["extensionHasColorThemes",f.some(y=>$K(y,a))]),h.push(["extensionHasFileIconThemes",v.some(y=>$K(y,a))]),h.push(["extensionHasProductIconThemes",b.some(y=>$K(y,a))]),h.push(["extensionHasAccountPreferences",S]),h.push(["canSetLanguage",o.canSetLanguage(a)]),h.push(["isActiveLanguagePackExtension",a.gallery&&Dr===vY(a.gallery)])}return r.getMenuActions(D.ExtensionContext,i.createOverlay(h),{shouldForwardArgs:!0})})}function QJe(a,i){let e=[];for(let[,t]of a)e.push(t.map(o=>o instanceof $l?o:i.createInstance(YJe,o)));return e}async function Nyi(a,i,e){let t=await Clo(a,i,e);return QJe(t,e)}var rA=class extends fB{constructor(e,t,o){super(rA.ID,"","",!0,e);this.extensionService=t;this.contextKeyService=o;this.tooltip=d(9797,null),this.update()}static{this.ID="extensions.manage"}static{this.Class=`${oa.ICON_ACTION_CLASS} manage `+q.asClassName(_pe)}static{this.HideManageExtensionClass=`${this.Class} hide`}async getActionGroups(){let e=[],t=await Clo(this.extension,this.contextKeyService,this.instantiationService),o=[],n=[],r=[],s=[];for(let[l,c]of t)l===pX?n.push(...QJe([[l,c]],this.instantiationService)[0]):l===r6e?r.push(...QJe([[l,c]],this.instantiationService)[0]):l===oEe?o.push(...QJe([[l,c]],this.instantiationService)[0]):s.push(...QJe([[l,c]],this.instantiationService));return o.length&&e.push(o),e.push([this.instantiationService.createInstance(D4),this.instantiationService.createInstance(_4)]),e.push([this.instantiationService.createInstance(R4),this.instantiationService.createInstance(L4)]),r.length&&e.push(r),e.push([...n.length?n:[],this.instantiationService.createInstance(oT,this.extension,!1),this.instantiationService.createInstance(iT)]),s.forEach(l=>e.push(l)),e.forEach(l=>l.forEach(c=>{c instanceof oa&&(c.extension=this.extension)})),e}async run(){return await this.extensionService.whenInstalledExtensionsRegistered(),super.run(await this.getActionGroups())}update(){if(this.class=rA.HideManageExtensionClass,this.enabled=!1,this.extension){let e=this.extension.state;this.enabled=e===1,this.class=this.enabled||e===2?rA.Class:rA.HideManageExtensionClass}}};rA=I([m(0,F),m(1,lt),m(2,X)],rA);var AWt=class extends fB{constructor(e,t){super("extensionEditor.manageExtension","",`${oa.ICON_ACTION_CLASS} manage ${q.asClassName(_pe)}`,!0,t);this.contextKeyService=e;this.tooltip=d(9797,null)}update(){}async run(){let e=[];return(await Nyi(this.extension,this.contextKeyService,this.instantiationService)).forEach(t=>e.push(t)),e.forEach(t=>t.forEach(o=>{o instanceof oa&&(o.extension=this.extension)})),super.run(e)}},YJe=class extends oa{constructor(e,t){super(e.id,e.label);this.action=e;this.extensionsWorkbenchService=t}get enabled(){return this.action.enabled}set enabled(e){this.action.enabled=e}update(){this.extension&&(this.action.id===fDt?this.checked=!this.extensionsWorkbenchService.isExtensionIgnoredToSync(this.extension):this.action.id===zC.ID?this.checked=this.extensionsWorkbenchService.isAutoUpdateEnabledFor(this.extension):this.action.id===BF.ID?this.checked=this.extensionsWorkbenchService.isAutoUpdateEnabledFor(this.extension.publisher):this.checked=this.action.checked)}async run(){if(this.extension){let e=this.extension.local?Jb(this.extension.local.manifest.publisher,this.extension.local.manifest.name):this.extension.gallery?Jb(this.extension.gallery.publisher,this.extension.gallery.name):this.extension.identifier.id,t={id:this.extension.identifier.id,version:this.extension.version,location:this.extension.local?.location,galleryLink:this.extension.url};await this.action.run(e,t)}}};YJe=I([m(1,zi)],YJe);var dD=class extends oa{constructor(e,t){super(dD.ID,dD.LABEL,dD.DisabledClass);this.extensionsWorkbenchService=e;this.allowedExtensionsService=t;this._register(t.onDidChangeAllowedExtensionsConfigValue(()=>this.update())),this.update()}static{this.ID="workbench.extensions.action.togglePreRlease"}static{this.LABEL=d(9836,null)}static{this.EnabledClass=`${oa.LABEL_ACTION_CLASS} prominent pre-release`}static{this.DisabledClass=`${this.EnabledClass} hide`}update(){this.enabled=!1,this.class=dD.DisabledClass,this.extension&&(this.extension.isBuiltin||this.extension.state===1&&this.extension.hasPreReleaseVersion&&this.extension.gallery&&(this.extension.preRelease&&(!this.extension.isPreReleaseVersion||this.allowedExtensionsService.isAllowed({id:this.extension.identifier.id,publisherDisplayName:this.extension.publisherDisplayName})!==!0)||!this.extension.preRelease&&(!this.extension.gallery.hasPreReleaseVersion||this.allowedExtensionsService.isAllowed(this.extension.gallery)!==!0)||(this.enabled=!0,this.class=dD.EnabledClass,this.extension.preRelease?(this.label=d(9834,null),this.tooltip=d(9835,null)):(this.label=d(9829,null),this.tooltip=d(9830,null)))))}async run(){this.extension&&(this.extensionsWorkbenchService.open(this.extension,{showPreReleaseVersion:!this.extension.preRelease}),await this.extensionsWorkbenchService.togglePreRelease(this.extension))}};dD=I([m(0,zi),m(1,zp)],dD);var oT=class extends oa{constructor(e,t,o,n,r,s,l,c,u){super(oT.ID,oT.LABEL,oa.LABEL_ACTION_CLASS);this.whenInstalled=t;this.extensionsWorkbenchService=o;this.extensionManagementService=n;this.extensionGalleryService=r;this.quickInputService=s;this.instantiationService=l;this.dialogService=c;this.allowedExtensionsService=u;this._register(u.onDidChangeAllowedExtensionsConfigValue(()=>this.update())),this.extension=e,this.update()}static{this.ID="workbench.extensions.action.install.anotherVersion"}static{this.LABEL=d(9767,null)}update(){this.enabled=!!this.extension&&!this.extension.isBuiltin&&!!this.extension.identifier.uuid&&!this.extension.deprecationInfo&&this.allowedExtensionsService.isAllowed({id:this.extension.identifier.id,publisherDisplayName:this.extension.publisherDisplayName})===!0,this.enabled&&this.whenInstalled&&(this.enabled=!!this.extension?.local&&!!this.extension.server&&this.extension.state===1)}async run(){if(!this.enabled||!this.extension)return;let e=this.extension.server?await this.extension.server.extensionManagementService.getTargetPlatform():await this.extensionManagementService.getTargetPlatform(),t=await this.extensionGalleryService.getAllCompatibleVersions(this.extension.identifier,this.extension.local?.preRelease??this.extension.gallery?.properties.isPreReleaseVersion??!1,e);if(!t.length){await this.dialogService.info(d(9805,null));return}let o=t.map((r,s)=>({id:r.version,label:r.version,description:`${Bs(new Date(Date.parse(r.date)),!0)}${r.isPreReleaseVersion?` (${d(9810,null)})`:""}${r.version===this.extension?.local?.manifest.version?` (${d(9716,null)})`:""}`,ariaLabel:`${r.isPreReleaseVersion?"Pre-Release version":"Release version"} ${r.version}`,isPreReleaseVersion:r.isPreReleaseVersion})),n=await this.quickInputService.pick(o,{placeHolder:d(9825,null),matchOnDetail:!0});if(n){if(this.extension.local?.manifest.version===n.id)return;let r={installPreReleaseVersion:n.isPreReleaseVersion,version:n.id};try{await this.extensionsWorkbenchService.install(this.extension,r)}catch(s){this.instantiationService.createInstance(EZ,this.extension,r,n.id,2,s).run()}}return null}};oT=I([m(2,zi),m(3,Hd),m(4,ta),m(5,Ge),m(6,F),m(7,ct),m(8,zp)],oT);var _4=class extends oa{constructor(e,t){super(_4.ID,_4.LABEL,oa.LABEL_ACTION_CLASS);this.extensionsWorkbenchService=e;this.extensionEnablementService=t;this.tooltip=d(9744,null),this.update()}static{this.ID="extensions.enableForWorkspace"}static{this.LABEL=d(9743,null)}update(){this.enabled=!1,this.extension&&this.extension.local&&!this.extension.isWorkspaceScoped&&(this.enabled=this.extension.state===1&&!this.extensionEnablementService.isEnabled(this.extension.local)&&this.extensionEnablementService.canChangeWorkspaceEnablement(this.extension.local))}async run(){if(this.extension)return this.extensionsWorkbenchService.setEnablement(this.extension,13)}};_4=I([m(0,zi),m(1,Os)],_4);var D4=class extends oa{constructor(e,t){super(D4.ID,D4.LABEL,oa.LABEL_ACTION_CLASS);this.extensionsWorkbenchService=e;this.extensionEnablementService=t;this.tooltip=d(9746,null),this.update()}static{this.ID="extensions.enableGlobally"}static{this.LABEL=d(9745,null)}update(){this.enabled=!1,this.extension&&this.extension.local&&!this.extension.isWorkspaceScoped&&(this.enabled=this.extension.state===1&&this.extensionEnablementService.isDisabledGlobally(this.extension.local)&&this.extensionEnablementService.canChangeEnablement(this.extension.local))}async run(){if(this.extension)return this.extensionsWorkbenchService.setEnablement(this.extension,12)}};D4=I([m(0,zi),m(1,Os)],D4);var L4=class extends oa{constructor(e,t,o,n){super(L4.ID,L4.LABEL,oa.LABEL_ACTION_CLASS);this.workspaceContextService=e;this.extensionsWorkbenchService=t;this.extensionEnablementService=o;this.extensionService=n;this.tooltip=d(9731,null),this.update(),this._register(this.extensionService.onDidChangeExtensions(()=>this.update()))}static{this.ID="extensions.disableForWorkspace"}static{this.LABEL=d(9730,null)}update(){this.enabled=!1,this.extension&&this.extension.local&&!this.extension.isWorkspaceScoped&&this.extensionService.extensions.some(e=>Ot({id:e.identifier.value,uuid:e.uuid},this.extension.identifier)&&this.workspaceContextService.getWorkbenchState()!==1)&&(this.enabled=this.extension.state===1&&(this.extension.enablementState===12||this.extension.enablementState===13)&&this.extensionEnablementService.canChangeWorkspaceEnablement(this.extension.local))}async run(){if(this.extension)return this.extensionsWorkbenchService.setEnablement(this.extension,11)}};L4=I([m(0,Pe),m(1,zi),m(2,Os),m(3,lt)],L4);var R4=class extends oa{constructor(e,t,o){super(R4.ID,R4.LABEL,oa.LABEL_ACTION_CLASS);this.extensionsWorkbenchService=e;this.extensionEnablementService=t;this.extensionService=o;this.tooltip=d(9733,null),this.update(),this._register(this.extensionService.onDidChangeExtensions(()=>this.update()))}static{this.ID="extensions.disableGlobally"}static{this.LABEL=d(9732,null)}update(){this.enabled=!1,this.extension&&this.extension.local&&!this.extension.isWorkspaceScoped&&this.extensionService.extensions.some(e=>Ot({id:e.identifier.value,uuid:e.uuid},this.extension.identifier))&&(this.enabled=this.extension.state===1&&(this.extension.enablementState===12||this.extension.enablementState===13)&&this.extensionEnablementService.canChangeEnablement(this.extension.local))}async run(){if(this.extension)return this.extensionsWorkbenchService.setEnablement(this.extension,10)}};R4=I([m(0,zi),m(1,Os),m(2,lt)],R4);var nRe=class extends qK{constructor(i){super("extensions.enable",oa.LABEL_ACTION_CLASS,[[i.createInstance(D4),i.createInstance(_4)]])}};nRe=I([m(0,F)],nRe);var rRe=class extends qK{constructor(i){super("extensions.disable",oa.LABEL_ACTION_CLASS,[[i.createInstance(R4),i.createInstance(L4)]])}};rRe=I([m(0,F)],rRe);var zK=class extends oa{constructor(e,t,o,n,r,s){super("extensions.runtimeState","",zK.DisabledClass,!1);this.hostService=e;this.extensionsWorkbenchService=t;this.updateService=o;this.extensionService=n;this.productService=r;this.telemetryService=s;this.updateWhenCounterExtensionChanges=!0;this._register(this.extensionService.onDidChangeExtensions(()=>this.update())),this.update()}static{this.EnabledClass=`${oa.LABEL_ACTION_CLASS} prominent reload`}static{this.DisabledClass=`${this.EnabledClass} disabled`}update(){if(this.enabled=!1,this.tooltip="",this.class=zK.DisabledClass,!this.extension)return;let e=this.extension.state;if(e===0||e===2||this.extension.local&&this.extension.local.manifest&&this.extension.local.manifest.contributes&&this.extension.local.manifest.contributes.localizations&&this.extension.local.manifest.contributes.localizations.length>0)return;let t=this.extension.runtimeState;t&&(this.enabled=!0,this.class=zK.EnabledClass,this.tooltip=t.reason,this.label=t.action==="reloadWindow"?d(9811,null):t.action==="restartExtensions"?d(9815,null):t.action==="quitAndInstall"?d(9816,null):t.action==="applyUpdate"||t.action==="downloadUpdate"?d(9846,null,this.productService.nameShort):"")}async run(){let e=this.extension?.runtimeState;if(e?.action){if(this.telemetryService.publicLog2("extensions:runtimestate:action",{action:e.action}),e?.action==="reloadWindow")return this.hostService.reload();if(e?.action==="restartExtensions")return this.extensionsWorkbenchService.updateRunningExtensions();if(e?.action==="downloadUpdate")return this.updateService.downloadUpdate(!0);if(e?.action==="applyUpdate")return this.updateService.applyUpdate();if(e?.action==="quitAndInstall")return this.updateService.quitAndInstall()}}};zK=I([m(0,oi),m(1,zi),m(2,zd),m(3,lt),m(4,nt),m(5,Te)],zK);function $K(a,i){return!!(i&&a.extensionData&&Ei.equals(a.extensionData.extensionId,i.identifier.id))}function Oyi(a,i,e,t){let o=[];for(let n of a)$K(n,e)&&!(t&&n===i)&&o.push({label:n.label,id:n.id});return t&&(o.push({type:"separator",label:d(9716,null)}),o.push({label:i.label,id:i.id})),o}var fk=class extends oa{constructor(e,t,o,n){super(fk.ID,fk.TITLE.value,fk.DisabledClass,!1);this.workbenchThemeService=t;this.quickInputService=o;this.extensionEnablementService=n;this._register(H.any(e.onDidChangeExtensions,t.onDidColorThemeChange)(()=>this.update(),this)),this.update()}static{this.ID="workbench.extensions.action.setColorTheme"}static{this.TITLE=L(9856,"Set Color Theme")}static{this.EnabledClass=`${oa.LABEL_ACTION_CLASS} theme`}static{this.DisabledClass=`${this.EnabledClass} disabled`}update(){this.workbenchThemeService.getColorThemes().then(e=>{this.enabled=this.computeEnablement(e),this.class=this.enabled?fk.EnabledClass:fk.DisabledClass})}computeEnablement(e){return!!this.extension&&this.extension.state===1&&this.extensionEnablementService.isEnabledEnablementState(this.extension.enablementState)&&e.some(t=>$K(t,this.extension))}async run({showCurrentTheme:e,ignoreFocusLost:t}={showCurrentTheme:!1,ignoreFocusLost:!1}){let o=await this.workbenchThemeService.getColorThemes();if(!this.computeEnablement(o))return;let n=this.workbenchThemeService.getColorTheme(),r=new jo(100),s=Oyi(o,n,this.extension,e),l=await this.quickInputService.pick(s,{placeHolder:d(9820,null),onDidFocus:c=>r.trigger(()=>this.workbenchThemeService.setColorTheme(c.id,void 0)),ignoreFocusLost:t});return this.workbenchThemeService.setColorTheme(l?l.id:n.id,"auto")}};fk=I([m(0,lt),m(1,Gp),m(2,Ge),m(3,Os)],fk);var vk=class extends oa{constructor(e,t,o,n){super(vk.ID,vk.TITLE.value,vk.DisabledClass,!1);this.workbenchThemeService=t;this.quickInputService=o;this.extensionEnablementService=n;this._register(H.any(e.onDidChangeExtensions,t.onDidFileIconThemeChange)(()=>this.update(),this)),this.update()}static{this.ID="workbench.extensions.action.setFileIconTheme"}static{this.TITLE=L(9858,"Set File Icon Theme")}static{this.EnabledClass=`${oa.LABEL_ACTION_CLASS} theme`}static{this.DisabledClass=`${this.EnabledClass} disabled`}update(){this.workbenchThemeService.getFileIconThemes().then(e=>{this.enabled=this.computeEnablement(e),this.class=this.enabled?vk.EnabledClass:vk.DisabledClass})}computeEnablement(e){return!!this.extension&&this.extension.state===1&&this.extensionEnablementService.isEnabledEnablementState(this.extension.enablementState)&&e.some(t=>$K(t,this.extension))}async run({showCurrentTheme:e,ignoreFocusLost:t}={showCurrentTheme:!1,ignoreFocusLost:!1}){let o=await this.workbenchThemeService.getFileIconThemes();if(!this.computeEnablement(o))return;let n=this.workbenchThemeService.getFileIconTheme(),r=new jo(100),s=Oyi(o,n,this.extension,e),l=await this.quickInputService.pick(s,{placeHolder:d(9822,null),onDidFocus:c=>r.trigger(()=>this.workbenchThemeService.setFileIconTheme(c.id,void 0)),ignoreFocusLost:t});return this.workbenchThemeService.setFileIconTheme(l?l.id:n.id,"auto")}};vk=I([m(0,lt),m(1,Gp),m(2,Ge),m(3,Os)],vk);var bk=class extends oa{constructor(e,t,o,n){super(bk.ID,bk.TITLE.value,bk.DisabledClass,!1);this.workbenchThemeService=t;this.quickInputService=o;this.extensionEnablementService=n;this._register(H.any(e.onDidChangeExtensions,t.onDidProductIconThemeChange)(()=>this.update(),this)),this.update()}static{this.ID="workbench.extensions.action.setProductIconTheme"}static{this.TITLE=L(9859,"Set Product Icon Theme")}static{this.EnabledClass=`${oa.LABEL_ACTION_CLASS} theme`}static{this.DisabledClass=`${this.EnabledClass} disabled`}update(){this.workbenchThemeService.getProductIconThemes().then(e=>{this.enabled=this.computeEnablement(e),this.class=this.enabled?bk.EnabledClass:bk.DisabledClass})}computeEnablement(e){return!!this.extension&&this.extension.state===1&&this.extensionEnablementService.isEnabledEnablementState(this.extension.enablementState)&&e.some(t=>$K(t,this.extension))}async run({showCurrentTheme:e,ignoreFocusLost:t}={showCurrentTheme:!1,ignoreFocusLost:!1}){let o=await this.workbenchThemeService.getProductIconThemes();if(!this.computeEnablement(o))return;let n=this.workbenchThemeService.getProductIconTheme(),r=new jo(100),s=Oyi(o,n,this.extension,e),l=await this.quickInputService.pick(s,{placeHolder:d(9823,null),onDidFocus:c=>r.trigger(()=>this.workbenchThemeService.setProductIconTheme(c.id,void 0)),ignoreFocusLost:t});return this.workbenchThemeService.setProductIconTheme(l?l.id:n.id,"auto")}};bk=I([m(0,lt),m(1,Gp),m(2,Ge),m(3,Os)],bk);var FR=class extends oa{constructor(e){super(FR.ID,FR.TITLE.value,FR.DisabledClass,!1);this.extensionsWorkbenchService=e;this.update()}static{this.ID="workbench.extensions.action.setDisplayLanguage"}static{this.TITLE=L(9857,"Set Display Language")}static{this.EnabledClass=`${oa.LABEL_ACTION_CLASS} language`}static{this.DisabledClass=`${this.EnabledClass} disabled`}update(){this.enabled=!1,this.class=FR.DisabledClass,this.extension&&this.extensionsWorkbenchService.canSetLanguage(this.extension)&&(this.extension.gallery&&Dr===vY(this.extension.gallery)||(this.enabled=!0,this.class=FR.EnabledClass))}async run(){return this.extension&&this.extensionsWorkbenchService.setLanguage(this.extension)}};FR=I([m(0,zi)],FR);var KC=class extends oa{constructor(e,t){super(KC.ID,KC.TITLE.value,KC.DisabledClass,!1);this.extensionsWorkbenchService=e;this.localeService=t;this.update()}static{this.ID="workbench.extensions.action.clearLanguage"}static{this.TITLE=L(9855,"Clear Display Language")}static{this.EnabledClass=`${oa.LABEL_ACTION_CLASS} language`}static{this.DisabledClass=`${this.EnabledClass} disabled`}update(){this.enabled=!1,this.class=KC.DisabledClass,this.extension&&this.extensionsWorkbenchService.canSetLanguage(this.extension)&&(this.extension.gallery&&Dr!==vY(this.extension.gallery)||(this.enabled=!0,this.class=KC.EnabledClass))}async run(){return this.extension&&this.localeService.clearLocalePreference()}};KC=I([m(0,zi),m(1,oB)],KC);var Dpe=class extends st{constructor(e,t){super(Dpe.ID,Dpe.LABEL,void 0,!1);this.extensionWorkbenchService=t;this.extensionId=e}static{this.ID="workbench.extensions.action.showRecommendedExtension"}static{this.LABEL=d(9828,null)}async run(){await this.extensionWorkbenchService.openSearch(`@id:${this.extensionId}`);let[e]=await this.extensionWorkbenchService.getExtensions([{id:this.extensionId}],{source:"install-recommendation"},ve.None);return e?this.extensionWorkbenchService.open(e):null}};Dpe=I([m(1,zi)],Dpe);var sA=class extends st{constructor(e,t,o){super(sA.ID,sA.LABEL,void 0,!1);this.instantiationService=t;this.extensionWorkbenchService=o;this.extensionId=e}static{this.ID="workbench.extensions.action.installRecommendedExtension"}static{this.LABEL=d(9793,null)}async run(){await this.extensionWorkbenchService.openSearch(`@id:${this.extensionId}`);let[e]=await this.extensionWorkbenchService.getExtensions([{id:this.extensionId}],{source:"install-recommendation"},ve.None);if(e){await this.extensionWorkbenchService.open(e);try{await this.extensionWorkbenchService.install(e)}catch(t){this.instantiationService.createInstance(EZ,e,void 0,e.latestVersion,2,t).run()}}}};sA=I([m(1,F),m(2,zi)],sA);var Lpe=class extends st{constructor(e,t){super(Lpe.ID,"Ignore Recommendation");this.extension=e;this.extensionRecommendationsManagementService=t;this.class=Lpe.Class,this.tooltip=d(9764,null),this.enabled=!0}static{this.ID="extensions.ignore"}static{this.Class=`${oa.LABEL_ACTION_CLASS} ignore`}run(){return this.extensionRecommendationsManagementService.toggleGlobalIgnoredRecommendation(this.extension.identifier.id,!0),Promise.resolve()}};Lpe=I([m(1,uk)],Lpe);var Rpe=class extends st{constructor(e,t){super(Rpe.ID,"Undo");this.extension=e;this.extensionRecommendationsManagementService=t;this.class=Rpe.Class,this.tooltip=d(9837,null),this.enabled=!0}static{this.ID="extensions.ignore"}static{this.Class=`${oa.LABEL_ACTION_CLASS} undo-ignore`}run(){return this.extensionRecommendationsManagementService.toggleGlobalIgnoredRecommendation(this.extension.identifier.id,!1),Promise.resolve()}};Rpe=I([m(1,uk)],Rpe);var sRe=class extends st{constructor(e,t,o,n,r,s,l,c){super(e,t);this.contextService=o;this.fileService=n;this.textFileService=r;this.editorService=s;this.jsonEditingService=l;this.textModelResolverService=c}openExtensionsFile(e){return this.getOrCreateExtensionsFile(e).then(({created:t,content:o})=>this.getSelectionPosition(o,e,["recommendations"]).then(n=>this.editorService.openEditor({resource:e,options:{pinned:t,selection:n}})),t=>Promise.reject(new Error(d(9809,null,t))))}openWorkspaceConfigurationFile(e){return this.getOrUpdateWorkspaceConfigurationFile(e).then(t=>this.getSelectionPosition(t.value.toString(),t.resource,["extensions","recommendations"])).then(t=>this.editorService.openEditor({resource:e,options:{selection:t,forceReload:!0}}))}getOrUpdateWorkspaceConfigurationFile(e){return Promise.resolve(this.fileService.readFile(e)).then(t=>{let o=Ur(t.value.toString()).extensions;return!o||!o.recommendations?this.jsonEditingService.write(e,[{path:["extensions"],value:{recommendations:[]}}],!0).then(()=>this.fileService.readFile(e)):t})}getSelectionPosition(e,t,o){let n=zL(e),r=lC(n,o);if(r&&r.parent&&r.parent.children){let s=r.parent.children[1],l=s.children&&s.children.length?s.children[s.children.length-1]:null,c=l?l.offset+l.length:s.offset+1;return Promise.resolve(this.textModelResolverService.createModelReference(t)).then(u=>{let p=u.object.textEditorModel.getPositionAt(c);return u.dispose(),{startLineNumber:p.lineNumber,startColumn:p.column,endLineNumber:p.lineNumber,endColumn:p.column}})}return Promise.resolve(void 0)}getOrCreateExtensionsFile(e){return Promise.resolve(this.fileService.readFile(e)).then(t=>({created:!1,extensionsFileResource:e,content:t.value.toString()}),t=>this.textFileService.write(e,_yi).then(()=>({created:!0,extensionsFileResource:e,content:_yi})))}};sRe=I([m(2,Pe),m(3,be),m(4,Ho),m(5,ee),m(6,zf),m(7,Nt)],sRe);var KK=class extends sRe{static{this.ID="workbench.extensions.action.configureWorkspaceRecommendedExtensions"}static{this.LABEL=d(9715,null)}constructor(i,e,t,o,n,r,s,l){super(i,e,n,t,o,r,s,l),this._register(this.contextService.onDidChangeWorkbenchState(()=>this.update(),this)),this.update()}update(){this.enabled=this.contextService.getWorkbenchState()!==1}run(){switch(this.contextService.getWorkbenchState()){case 2:return this.openExtensionsFile(this.contextService.getWorkspace().folders[0].toResource(Yue));case 3:return this.openWorkspaceConfigurationFile(this.contextService.getWorkspace().configuration)}return Promise.resolve()}};KK=I([m(2,be),m(3,Ho),m(4,Pe),m(5,ee),m(6,zf),m(7,Nt)],KK);var GK=class extends sRe{constructor(e,t,o,n,r,s,l,c,u){super(e,t,r,o,n,s,l,c);this.commandService=u}static{this.ID="workbench.extensions.action.configureWorkspaceFolderRecommendedExtensions"}static{this.LABEL=d(9714,null)}run(){let t=this.contextService.getWorkspace().folders.length===1?Promise.resolve(this.contextService.getWorkspace().folders[0]):this.commandService.executeCommand(SR);return Promise.resolve(t).then(o=>o?this.openExtensionsFile(o.toResource(Yue)):null)}};GK=I([m(2,be),m(3,Ho),m(4,Pe),m(5,ee),m(6,zf),m(7,Nt),m(8,ge)],GK);var UF=class extends st{constructor(e,t,o){super("extensions.action.statusLabel","",UF.DISABLED_CLASS,!1);this.extensionService=e;this.extensionManagementServerService=t;this.extensionEnablementService=o;this.initialStatus=null;this.status=null;this.version=null;this.enablementState=null;this._extension=null}static{this.ENABLED_CLASS=`${oa.TEXT_ACTION_CLASS} extension-status-label`}static{this.DISABLED_CLASS=`${this.ENABLED_CLASS} hide`}get extension(){return this._extension}set extension(e){this._extension&&e&&Ot(this._extension.identifier,e.identifier)||(this.initialStatus=null,this.status=null,this.enablementState=null),this._extension=e,this.update()}update(){let e=this.computeLabel();this.label=e||"",this.class=e?UF.ENABLED_CLASS:UF.DISABLED_CLASS}computeLabel(){if(!this.extension)return null;let e=this.status,t=this.version,o=this.enablementState;this.status=this.extension.state,this.version=this.extension.version,this.initialStatus===null&&(this.initialStatus=this.status),this.enablementState=this.extension.enablementState;let n=()=>{let s=this.extensionService.extensions.filter(l=>Ot({id:l.identifier.value,uuid:l.uuid},this.extension.identifier))[0];return this.extension.local?s&&this.extension.version===s.version?!0:this.extensionService.canAddExtension(kO(this.extension.local)):!1},r=()=>this.extension.local?this.extensionService.extensions.every(s=>!(Ot({id:s.identifier.value,uuid:s.uuid},this.extension.identifier)&&this.extension.server===this.extensionManagementServerService.getExtensionManagementServer(kE(s))))?!0:this.extensionService.canRemoveExtension(kO(this.extension.local)):!1;if(e!==null){if(e===0&&this.status===1)return this.initialStatus===3&&n()?d(9788,null):this.initialStatus===1&&this.version!==t&&n()?d(9848,null):null;if(e===2&&this.status===3)return this.initialStatus=this.status,r()?d(9840,null):null}if(o!==null){let s=this.extensionEnablementService.isEnabledEnablementState(o),l=this.extensionEnablementService.isEnabledEnablementState(this.enablementState);if(!s&&l)return n()?d(9738,null):null;if(s&&!l)return r()?d(9726,null):null}return null}run(){return Promise.resolve()}};UF=I([m(0,lt),m(1,Gc),m(2,Os)],UF);var LZ=class extends fB{constructor(e,t,o,n){super("extensions.sync","",LZ.SYNC_CLASS,!1,n);this.configurationService=e;this.extensionsWorkbenchService=t;this.userDataSyncEnablementService=o;this._register(H.filter(this.configurationService.onDidChangeConfiguration,r=>r.affectsConfiguration("settingsSync.ignoredExtensions"))(()=>this.update())),this._register(o.onDidChangeEnablement(()=>this.update())),this.update()}static{this.IGNORED_SYNC_CLASS=`${oa.ICON_ACTION_CLASS} extension-sync ${q.asClassName(GJe)}`}static{this.SYNC_CLASS=`${this.ICON_ACTION_CLASS} extension-sync ${q.asClassName(vlo)}`}update(){if(this.enabled=!!this.extension&&this.userDataSyncEnablementService.isEnabled()&&this.extension.state===1,this.extension){let e=this.extensionsWorkbenchService.isExtensionIgnoredToSync(this.extension);this.class=e?LZ.IGNORED_SYNC_CLASS:LZ.SYNC_CLASS,this.tooltip=e?d(9763,null):d(9832,null)}}async run(){return super.run([[new st("extensions.syncignore",this.extensionsWorkbenchService.isExtensionIgnoredToSync(this.extension)?d(9831,null):d(9734,null),void 0,!0,()=>this.extensionsWorkbenchService.toggleExtensionIgnoredToSync(this.extension))]])}};LZ=I([m(0,B),m(1,zi),m(2,_l),m(3,F)],LZ);var cD=class extends oa{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super("extensions.status","",`${cD.CLASS} hide`,!1);this.extensionManagementServerService=e;this.labelService=t;this.commandService=o;this.workspaceTrustEnablementService=n;this.workspaceTrustService=r;this.extensionsWorkbenchService=s;this.extensionService=l;this.extensionManifestPropertiesService=c;this.contextService=u;this.productService=p;this.allowedExtensionsService=h;this.workbenchExtensionEnablementService=g;this.extensionFeaturesManagementService=f;this.extensionGalleryManifestService=v;this.updateWhenCounterExtensionChanges=!0;this._status=[];this._onDidChangeStatus=this._register(new E);this.onDidChangeStatus=this._onDidChangeStatus.event;this.updateThrottler=this._register(new um);this._register(this.labelService.onDidChangeFormatters(()=>this.update(),this)),this._register(this.extensionService.onDidChangeExtensions(()=>this.update())),this._register(this.extensionFeaturesManagementService.onDidChangeAccessData(()=>this.update())),this._register(h.onDidChangeAllowedExtensionsConfigValue(()=>this.update())),this.update()}static{this.CLASS=`${oa.ICON_ACTION_CLASS} extension-status`}get status(){return this._status}update(){this.updateThrottler.queue(()=>this.computeAndUpdateStatus())}async computeAndUpdateStatus(){if(this.updateStatus(void 0,!0),this.enabled=!1,!this.extension)return;if(this.extension.isMalicious){this.updateStatus({icon:_u,message:new xe(d(9796,null))},!0);return}if(this.extension.state===3&&this.extension.gallery&&!this.extension.gallery.isSigned&&L3e(this.extension.private,await this.extensionGalleryManifestService.getExtensionGalleryManifest())){this.updateStatus({icon:_u,message:new xe(d(9808,null))},!0);return}if(this.extension.deprecationInfo){if(this.extension.deprecationInfo.extension){let r=`[${this.extension.deprecationInfo.extension.displayName}](${ic("extension.open",this.extension.deprecationInfo.extension.id)})`;this.updateStatus({icon:_u,message:new xe(d(9722,null,r))},!0)}else if(this.extension.deprecationInfo.settings){let r=`[${d(9826,null)}](${ic("workbench.action.openSettings",this.extension.deprecationInfo.settings.map(s=>`@id:${s}`).join(" "))}})`;this.updateStatus({icon:_u,message:new xe(d(9724,null,r))},!0)}else{let r=new xe(d(9720,null));this.extension.deprecationInfo.additionalInfo&&r.appendMarkdown(` ${this.extension.deprecationInfo.additionalInfo}`),this.updateStatus({icon:_u,message:r},!0)}return}if(this.extension.missingFromGallery){this.updateStatus({icon:_u,message:new xe(d(9802,null))},!0);return}if(this.extensionsWorkbenchService.canSetLanguage(this.extension))return;if(this.extension.outdated){let r=await this.extensionsWorkbenchService.shouldRequireConsentToUpdate(this.extension);if(r){let s=new xe;s.appendMarkdown(`${r} `),s.appendMarkdown(d(9707,null,this.extension.hasChangelog()?ic("extension.open",this.extension.identifier.id,"changelog").toString():this.extension.repository?this.extension.repository:ic("extension.open",this.extension.identifier.id).toString())),this.updateStatus({icon:_u,message:s},!0)}}if(this.extension.gallery&&this.extension.state===3){let r=await this.extensionsWorkbenchService.canInstall(this.extension);if(r!==!0){this.updateStatus({icon:_u,message:r},!0);return}}if(!this.extension.local||!this.extension.server||this.extension.state!==1)return;if(this.extension.enablementState===7){let r=this.allowedExtensionsService.isAllowed(this.extension.local);if(r!==!0){this.updateStatus({icon:_u,message:new xe(d(9727,null,r.value))},!0);return}}if(this.extension.enablementState===2){this.updateStatus({message:new xe(d(9729,null))},!0);return}if(this.extension.enablementState===3){this.updateStatus({message:new xe(d(9739,null))},!0);return}if(this.extension.enablementState===5){let r=hle(this.extension.local.manifest.capabilities?.virtualWorkspaces);this.updateStatus({icon:kg,message:new xe(r?BM(r):d(9728,null))},!0);return}if(LO(this.contextService.getWorkspace())){let r=this.extensionManifestPropertiesService.getExtensionVirtualWorkspaceSupportType(this.extension.local.manifest),s=hle(this.extension.local.manifest.capabilities?.virtualWorkspaces);if(r==="limited"||s){this.updateStatus({icon:_u,message:new xe(s?BM(s):d(9752,null))},!0);return}}if(this.extension.enablementState===9){this.updateStatus({icon:kg,message:new xe(d(9749,null,"`chat.extensionUnification.enabled`"))},!0);return}if(!this.workspaceTrustService.isWorkspaceTrusted()&&(this.extension.enablementState===0||this.extension.enablementState===8&&this.workbenchExtensionEnablementService.getDependenciesEnablementStates(this.extension.local).every(([,r])=>this.workbenchExtensionEnablementService.isEnabledEnablementState(r)||r===0))){this.enabled=!0;let r=hle(this.extension.local.manifest.capabilities?.untrustedWorkspaces);this.updateStatus({icon:NR,message:new xe(r?BM(r):d(9748,null))},!0);return}if(this.workspaceTrustEnablementService.isWorkspaceTrustEnabled()&&!this.workspaceTrustService.isWorkspaceTrusted()){let r=this.extensionManifestPropertiesService.getExtensionUntrustedWorkspaceSupportType(this.extension.local.manifest),s=hle(this.extension.local.manifest.capabilities?.untrustedWorkspaces);if(r==="limited"||s){this.enabled=!0,this.updateStatus({icon:NR,message:new xe(s?BM(s):d(9751,null))},!0);return}}if(this.extension.enablementState===1&&!this.extensionsWorkbenchService.installed.some(r=>Ot(r.identifier,this.extension.identifier)&&r.server!==this.extension.server)){let r;this.extensionManagementServerService.localExtensionManagementServer===this.extension.server?this.extensionManifestPropertiesService.prefersExecuteOnWorkspace(this.extension.local.manifest)&&this.extensionManagementServerService.remoteExtensionManagementServer&&(r=new xe(`${d(9774,null,this.extensionManagementServerService.remoteExtensionManagementServer.label)} [${d(9795,null)}](https://code.visualstudio.com/api/advanced-topics/remote-extensions#architecture-and-extension-kinds)`)):this.extensionManagementServerService.remoteExtensionManagementServer===this.extension.server?this.extensionManifestPropertiesService.prefersExecuteOnUI(this.extension.local.manifest)&&(this.extensionManagementServerService.localExtensionManagementServer?r=new xe(`${d(9772,null,this.extensionManagementServerService.remoteExtensionManagementServer.label)} [${d(9795,null)}](https://code.visualstudio.com/api/advanced-topics/remote-extensions#architecture-and-extension-kinds)`):Gt&&(r=new xe(`${d(9717,null,this.productService.nameLong)} [${d(9795,null)}](https://code.visualstudio.com/api/advanced-topics/remote-extensions#architecture-and-extension-kinds)`))):this.extensionManagementServerService.webExtensionManagementServer===this.extension.server&&(r=new xe(`${d(9709,null,this.productService.nameLong)} [${d(9795,null)}](https://code.visualstudio.com/api/advanced-topics/remote-extensions#architecture-and-extension-kinds)`)),r&&this.updateStatus({icon:_u,message:r},!0);return}let e=new Ei(this.extension.identifier.id),t=oe.as(Ds.ExtensionFeaturesRegistry).getExtensionFeatures();for(let r of t){let s=this.extensionFeaturesManagementService.getAccessData(e,r.id)?.current?.status,l=`[${d(9798,null)}](${ic("extension.open",this.extension.identifier.id,"features",!1,r.id)})`;if(s?.severity===St.Error){this.updateStatus({icon:gS,message:new xe().appendText(s.message).appendMarkdown(` ${l}`)},!0);return}if(s?.severity===St.Warning){this.updateStatus({icon:_u,message:new xe().appendText(s.message).appendMarkdown(` ${l}`)},!0);return}}if(this.extensionManagementServerService.remoteExtensionManagementServer){if(NL(this.extension.local.manifest)){if(!this.extensionsWorkbenchService.installed.some(l=>Ot(l.identifier,this.extension.identifier)&&l.server!==this.extension.server)){let l=this.extension.server===this.extensionManagementServerService.localExtensionManagementServer?new xe(d(9775,null,this.extensionManagementServerService.remoteExtensionManagementServer.label)):new xe(d(9776,null));this.updateStatus({icon:kg,message:l},!0)}return}let r=this.extensionService.extensions.filter(l=>Ot({id:l.identifier.value,uuid:l.uuid},this.extension.identifier))[0],s=r?this.extensionManagementServerService.getExtensionManagementServer(kE(r)):null;if(this.extension.server===this.extensionManagementServerService.localExtensionManagementServer&&s===this.extensionManagementServerService.remoteExtensionManagementServer){this.extensionManifestPropertiesService.prefersExecuteOnWorkspace(this.extension.local.manifest)&&this.updateStatus({icon:kg,message:new xe(`${d(9742,null)} [${d(9795,null)}](https://code.visualstudio.com/api/advanced-topics/remote-extensions#architecture-and-extension-kinds)`)},!0);return}if(this.extension.server===this.extensionManagementServerService.remoteExtensionManagementServer&&s===this.extensionManagementServerService.localExtensionManagementServer){this.extensionManifestPropertiesService.prefersExecuteOnUI(this.extension.local.manifest)&&this.updateStatus({icon:kg,message:new xe(`${d(9741,null)} [${d(9795,null)}](https://code.visualstudio.com/api/advanced-topics/remote-extensions#architecture-and-extension-kinds)`)},!0);return}if(this.extension.server===this.extensionManagementServerService.remoteExtensionManagementServer&&s===this.extensionManagementServerService.webExtensionManagementServer){this.extensionManifestPropertiesService.canExecuteOnWeb(this.extension.local.manifest)&&this.updateStatus({icon:kg,message:new xe(`${d(9740,null)} [${d(9795,null)}](https://code.visualstudio.com/api/advanced-topics/remote-extensions#architecture-and-extension-kinds)`)},!0);return}}if(this.extension.enablementState===8){this.updateStatus({icon:_u,message:new xe(d(9747,null)).appendMarkdown(` [${d(9718,null)}](${ic("extension.open",this.extension.identifier.id,"dependencies")})`)},!0);return}if(!this.extension.local.isValid){let r=this.extension.local.validations.filter(([s])=>s===St.Error).map(([,s])=>s);this.updateStatus({icon:_u,message:new xe(r.join(" ").trim())},!0);return}let o=this.workbenchExtensionEnablementService.isEnabled(this.extension.local),n=this.extensionService.extensions.some(r=>Ot({id:r.identifier.value,uuid:r.uuid},this.extension.identifier));if(!this.extension.isWorkspaceScoped&&o&&n){if(this.extension.enablementState===13){this.updateStatus({message:new xe(d(9861,null))},!0);return}if(this.extensionManagementServerService.localExtensionManagementServer&&this.extensionManagementServerService.remoteExtensionManagementServer&&this.extension.server===this.extensionManagementServerService.remoteExtensionManagementServer){this.updateStatus({message:new xe(d(9750,null,this.extension.server.label))},!0);return}if(this.extension.enablementState===12)return}if(!o&&!n){if(this.extension.enablementState===10){this.updateStatus({message:new xe(d(9762,null))},!0);return}if(this.extension.enablementState===11){this.updateStatus({message:new xe(d(9860,null))},!0);return}}}updateStatus(e,t){if(e){if(this._status.some(o=>o.message.value===e.message.value&&o.icon?.id===e.icon?.id))return}else{if(this._status.length===0)return;this._status=[]}e&&(this._status.push(e),this._status.sort((o,n)=>n.icon===NR?-1:o.icon===NR?1:n.icon===gS?-1:o.icon===gS?1:n.icon===_u?-1:o.icon===_u?1:n.icon===kg?-1:o.icon===kg?1:0)),t&&(e?.icon===gS?this.class=`${cD.CLASS} extension-status-error ${q.asClassName(gS)}`:e?.icon===_u?this.class=`${cD.CLASS} extension-status-warning ${q.asClassName(_u)}`:e?.icon===kg?this.class=`${cD.CLASS} extension-status-info ${q.asClassName(kg)}`:e?.icon===NR?this.class=`${cD.CLASS} ${q.asClassName(NR)}`:this.class=`${cD.CLASS} hide`),this._onDidChangeStatus.fire()}async run(){if(this._status[0]?.icon===NR)return this.commandService.executeCommand("workbench.trust.manage")}};cD=I([m(0,Gc),m(1,ot),m(2,ge),m(3,BL),m(4,ns),m(5,zi),m(6,lt),m(7,xp),m(8,Pe),m(9,nt),m(10,zp),m(11,Os),m(12,YI),m(13,vv)],cD);var aA=class extends st{constructor(e=aA.ID,t=aA.LABEL,o,n,r,s){super(e,t);this.extensionsWorkbenchService=o;this.quickInputService=n;this.instantiationService=r;this.extensionEnablementService=s}static{this.ID="workbench.extensions.action.install.specificVersion"}static{this.LABEL=d(9783,null)}get enabled(){return this.extensionsWorkbenchService.local.some(e=>this.isEnabled(e))}async run(){let e=await this.quickInputService.pick(this.getExtensionEntries(),{placeHolder:d(9824,null),matchOnDetail:!0});e&&e.extension&&(await this.instantiationService.createInstance(oT,e.extension,!0).run(),await this.extensionsWorkbenchService.openSearch(e.extension.identifier.id))}isEnabled(e){return this.instantiationService.createInstance(oT,e,!0).enabled&&!!e.local&&this.extensionEnablementService.isEnabled(e.local)}async getExtensionEntries(){let e=await this.extensionsWorkbenchService.queryLocal(),t=[];for(let o of e)this.isEnabled(o)&&t.push({id:o.identifier.id,label:o.displayName||o.identifier.id,description:o.identifier.id,extension:o});return t.sort((o,n)=>o.extension.displayName.localeCompare(n.extension.displayName))}};aA=I([m(2,zi),m(3,Ge),m(4,F),m(5,Os)],aA);var aRe=class extends st{constructor(e,t,o,n,r){super(e);this.extensionsWorkbenchService=t;this.quickInputService=o;this.notificationService=n;this.progressService=r;this.extensions=void 0;this.update(),this.extensionsWorkbenchService.queryLocal().then(()=>this.updateExtensions()),this._register(this.extensionsWorkbenchService.onChange(()=>{this.extensions&&this.updateExtensions()}))}updateExtensions(){this.extensions=this.extensionsWorkbenchService.local,this.update()}update(){this.enabled=!!this.extensions&&this.getExtensionsToInstall(this.extensions).length>0,this.tooltip=this.label}async run(){return this.selectAndInstallExtensions()}async queryExtensionsToInstall(){let e=await this.extensionsWorkbenchService.queryLocal();return this.getExtensionsToInstall(e)}async selectAndInstallExtensions(){let e=this.quickInputService.createQuickPick();e.busy=!0;let t=e.onDidAccept(()=>{t.dispose(),e.hide(),e.dispose(),this.onDidAccept(e.selectedItems)});e.show();let o=await this.queryExtensionsToInstall();e.busy=!1,o.length?(e.title=this.getQuickPickTitle(),e.placeholder=d(9821,null),e.canSelectMany=!0,o.sort((n,r)=>n.displayName.localeCompare(r.displayName)),e.items=o.map(n=>({extension:n,label:n.displayName,description:n.version}))):(e.hide(),e.dispose(),this.notificationService.notify({severity:St.Info,message:d(9804,null)}))}async onDidAccept(e){if(e.length){let t=e.filter(o=>!!o.extension).map(o=>o.extension);t.length&&(await this.progressService.withProgress({location:15,title:d(9792,null)},()=>this.installExtensions(t)),this.notificationService.info(d(9761,null)))}}};aRe=I([m(1,zi),m(2,Ge),m(3,Ne),m(4,Bo)],aRe);var lRe=class extends aRe{constructor(e,t,o,n,r,s,l,c,u){super("workbench.extensions.actions.installLocalExtensionsInRemote",e,t,n,o);this.extensionManagementServerService=r;this.extensionGalleryService=s;this.instantiationService=l;this.fileService=c;this.logService=u}get label(){return this.extensionManagementServerService&&this.extensionManagementServerService.remoteExtensionManagementServer?d(9818,null,this.extensionManagementServerService.remoteExtensionManagementServer.label):""}getQuickPickTitle(){return d(9777,null,this.extensionManagementServerService.remoteExtensionManagementServer.label)}getExtensionsToInstall(e){return e.filter(t=>{let o=this.instantiationService.createInstance(T4,!0);return o.extension=t,o.enabled})}async installExtensions(e){let t=[],o=[],n=await this.extensionManagementServerService.remoteExtensionManagementServer.extensionManagementService.getTargetPlatform();await fn.settled(e.map(async r=>{if(this.extensionGalleryService.isEnabled()){let l=(await this.extensionGalleryService.getExtensions([{...r.identifier,preRelease:!!r.local?.preRelease}],{targetPlatform:n,compatible:!0},ve.None))[0];if(l){t.push(l);return}}let s=await this.extensionManagementServerService.localExtensionManagementServer.extensionManagementService.zip(r.local);o.push(s)})),await fn.settled(t.map(r=>this.extensionManagementServerService.remoteExtensionManagementServer.extensionManagementService.installFromGallery(r)));try{await fn.settled(o.map(r=>this.extensionManagementServerService.remoteExtensionManagementServer.extensionManagementService.install(r)))}finally{try{await Promise.allSettled(o.map(r=>this.fileService.del(r)))}catch(r){this.logService.error(r)}}}};lRe=I([m(0,zi),m(1,Ge),m(2,Bo),m(3,Ne),m(4,Gc),m(5,ta),m(6,F),m(7,be),m(8,ne)],lRe);var cRe=class extends aRe{constructor(e,t,o,n,r,s,l,c,u){super(e,t,o,r,n);this.extensionManagementServerService=s;this.extensionGalleryService=l;this.fileService=c;this.logService=u}get label(){return d(9819,null)}getQuickPickTitle(){return d(9785,null)}getExtensionsToInstall(e){return e.filter(t=>t.type===1&&t.server!==this.extensionManagementServerService.localExtensionManagementServer&&!this.extensionsWorkbenchService.installed.some(o=>o.server===this.extensionManagementServerService.localExtensionManagementServer&&Ot(o.identifier,t.identifier)))}async installExtensions(e){let t=[],o=[],n=await this.extensionManagementServerService.localExtensionManagementServer.extensionManagementService.getTargetPlatform();await fn.settled(e.map(async r=>{if(this.extensionGalleryService.isEnabled()){let l=(await this.extensionGalleryService.getExtensions([{...r.identifier,preRelease:!!r.local?.preRelease}],{targetPlatform:n,compatible:!0},ve.None))[0];if(l){t.push(l);return}}let s=await this.extensionManagementServerService.remoteExtensionManagementServer.extensionManagementService.zip(r.local);o.push(s)})),await fn.settled(t.map(r=>this.extensionManagementServerService.localExtensionManagementServer.extensionManagementService.installFromGallery(r)));try{await fn.settled(o.map(r=>this.extensionManagementServerService.localExtensionManagementServer.extensionManagementService.install(r)))}finally{try{await Promise.allSettled(o.map(r=>this.fileService.del(r)))}catch(r){this.logService.error(r)}}}};cRe=I([m(1,zi),m(2,Ge),m(3,Bo),m(4,Ne),m(5,Gc),m(6,ta),m(7,be),m(8,ne)],cRe);qe.registerCommand("workbench.extensions.action.showExtensionsForLanguage",function(a,i){return a.get(zi).openSearch(`ext:${i.replace(/^\./,"")}`)});var mRe="workbench.extensions.action.showExtensionsWithIds";qe.registerCommand(mRe,function(a,i){return a.get(zi).openSearch(i.map(t=>`@id:${t}`).join(" "))});J("extensionButton.background",{dark:H$,light:H$,hcDark:null,hcLight:null},d(9753,null));J("extensionButton.foreground",{dark:Fse,light:Fse,hcDark:null,hcLight:null},d(9755,null));J("extensionButton.hoverBackground",{dark:Wse,light:Wse,hcDark:null,hcLight:null},d(9756,null));J("extensionButton.border",{dark:oIe,light:oIe,hcDark:gi,hcLight:gi},d(9754,null));J("extensionButton.separator",vgt,d(9760,null));var xlo=J("extensionButton.prominentBackground",{dark:MS,light:MS,hcDark:null,hcLight:null},d(9757,null));J("extensionButton.prominentForeground",{dark:YT,light:YT,hcDark:null,hcLight:null},d(9758,null));J("extensionButton.prominentHoverBackground",{dark:B$,light:B$,hcDark:null,hcLight:null},d(9759,null));is((a,i)=>{let e=a.getColor(av);e&&(i.addRule(`.extension-editor .header .actions-status-container > .status ${q.asCSSSelector(gS)} { color: ${e}; }`),i.addRule(`.extension-editor .body .subcontent .runtime-status ${q.asCSSSelector(gS)} { color: ${e}; }`),i.addRule(`.monaco-hover.extension-hover .markdown-hover .hover-contents ${q.asCSSSelector(gS)} { color: ${e}; }`));let t=a.getColor(Bh);t&&(i.addRule(`.extension-editor .header .actions-status-container > .status ${q.asCSSSelector(_u)} { color: ${t}; }`),i.addRule(`.extension-editor .body .subcontent .runtime-status ${q.asCSSSelector(_u)} { color: ${t}; }`),i.addRule(`.monaco-hover.extension-hover .markdown-hover .hover-contents ${q.asCSSSelector(_u)} { color: ${t}; }`));let o=a.getColor(fm);o&&(i.addRule(`.extension-editor .header .actions-status-container > .status ${q.asCSSSelector(kg)} { color: ${o}; }`),i.addRule(`.extension-editor .body .subcontent .runtime-status ${q.asCSSSelector(kg)} { color: ${o}; }`),i.addRule(`.monaco-hover.extension-hover .markdown-hover .hover-contents ${q.asCSSSelector(kg)} { color: ${o}; }`))});var $3o="NotebookEditorViewState",uD=class extends pa{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super(uD.ID,e,t,o,r);this._instantiationService=n;this._editorService=s;this._editorGroupService=l;this._notebookWidgetService=c;this._contextKeyService=u;this._fileService=p;this._editorProgressService=g;this._notebookService=f;this._extensionsWorkbenchService=v;this._workingCopyBackupService=b;this.logService=S;this._preferencesService=y;this._groupListener=this._register(new P);this._widgetDisposableStore=this._register(new P);this._widget={value:void 0};this._inputListener=this._register(new me);this._onDidFocusWidget=this._register(new E);this._onDidBlurWidget=this._register(new E);this._onDidChangeModel=this._register(new E);this.onDidChangeModel=this._onDidChangeModel.event;this._onDidChangeSelection=this._register(new E);this.onDidChangeSelection=this._onDidChangeSelection.event;this._onDidChangeScroll=this._register(new E);this.onDidChangeScroll=this._onDidChangeScroll.event;this._editorMemento=this.getEditorMemento(l,h,$3o),this._register(this._fileService.onDidChangeFileSystemProviderCapabilities(w=>this._onDidChangeFileSystemProvider(w.scheme))),this._register(this._fileService.onDidChangeFileSystemProviderRegistrations(w=>this._onDidChangeFileSystemProvider(w.scheme)))}static{this.ID=qL}get onDidFocus(){return this._onDidFocusWidget.event}get onDidBlur(){return this._onDidBlurWidget.event}_onDidChangeFileSystemProvider(e){this.input instanceof ha&&this.input.resource?.scheme===e&&this._updateReadonly(this.input)}_onDidChangeInputCapabilities(e){this.input===e&&this._updateReadonly(e)}_updateReadonly(e){this._widget.value?.setOptions({isReadOnly:!!e.isReadonly()})}get textModel(){return this._widget.value?.textModel}get minimumWidth(){return 220}get maximumWidth(){return Number.POSITIVE_INFINITY}set minimumWidth(e){}set maximumWidth(e){}get scopedContextKeyService(){return this._widget.value?.scopedContextKeyService}createEditor(e){this._rootElement=R(e,_(".notebook-editor")),this._rootElement.id=`notebook-editor-element-${_t()}`}getActionViewItem(e,t){if(e.id===tT)return this._register(this._instantiationService.createInstance(gB,e,this,t))}getControl(){return this._widget.value}setVisible(e){super.setVisible(e),e||this._widget.value?.onWillHide()}setEditorVisible(e){super.setEditorVisible(e),this._groupListener.clear(),this._groupListener.add(this.group.onWillCloseEditor(t=>this._saveEditorViewState(t.editor))),this._groupListener.add(this.group.onDidModelChange(()=>{this._editorGroupService.activeGroup!==this.group&&this._widget?.value?.updateEditorFocus()})),e||(this._saveEditorViewState(this.input),this.input&&this._widget.value&&this._widget.value.onWillHide())}focus(){super.focus(),this._widget.value?.focus()}hasFocus(){let e=this._widget.value;return e?!!e&&ts(e.getDomNode()||ts(e.getOverflowContainerDomNode())):!1}async setInput(e,t,o,n,r){try{let s=!1,l=Pi(1e4);l.then(()=>{s=!0,this._handlePerfMark(c,e)});let c=new RWt;c.mark("startTime"),this._inputListener.value=e.onDidChangeCapabilities(()=>this._onDidChangeInputCapabilities(e)),this._widgetDisposableStore.clear(),this._widget.value?.onWillHide(),this._widget=this._instantiationService.invokeFunction(this._notebookWidgetService.retrieveWidget,this.group.id,e,void 0,this._pagePosition?.dimension,this.window),this._rootElement&&this._widget.value.getDomNode()&&(this._rootElement.setAttribute("aria-flowto",this._widget.value.getDomNode().id||""),vN(this._widget.value.getDomNode(),this._rootElement)),this._widgetDisposableStore.add(this._widget.value.onDidChangeModel(()=>this._onDidChangeModel.fire())),this._widgetDisposableStore.add(this._widget.value.onDidChangeActiveCell(()=>this._onDidChangeSelection.fire({reason:2}))),this._pagePosition&&this._widget.value.layout(this._pagePosition.dimension,this._rootElement,this._pagePosition.position),await super.setInput(e,t,o,n);let u=await e.resolve(t,c);if(c.mark("inputLoaded"),n.isCancellationRequested)return;if(!this._widget.value)return r?void 0:this.setInput(e,t,o,n,!0);if(u===null){let g=this._notebookService.getViewTypeProvider(e.viewType);if(!g)throw new Error(d(11994,null,e.viewType));await this._extensionsWorkbenchService.whenInitialized;let f=this._extensionsWorkbenchService.local.find(v=>v.identifier.id===g);throw Aj(new Error(d(11995,null,e.viewType)),[pi({id:"workbench.notebook.action.installOrEnableMissing",label:f?d(11997,null,e.viewType):d(11998,null,e.viewType),run:async()=>{let v=this._notebookService.onAddViewType(S=>{S===e.viewType&&(this._editorService.openEditor({resource:e.resource}),v.dispose())}),b=this._extensionsWorkbenchService.local.find(S=>S.identifier.id===g);try{b?await this._extensionsWorkbenchService.setEnablement(b,b.enablementState===11?13:12):await this._instantiationService.createInstance(sA,g).run()}catch(S){this.logService.error(`Failed to install or enable extension ${g}`,S),v.dispose()}}}),pi({id:"workbench.notebook.action.openAsText",label:d(11996,null),run:async()=>{let v=await this._workingCopyBackupService.resolve({resource:e.resource,typeId:_O.create(e.viewType)});if(v){let b=await Kv(v.value);this._editorService.openEditor({resource:void 0,contents:b.toString()})}else this._editorService.openEditor({resource:e.resource,options:{override:Ys.id,pinned:!0}})}})],{allowDialog:!0})}this._widgetDisposableStore.add(u.notebook.onDidChangeContent(()=>this._onDidChangeSelection.fire({reason:3})));let p=t?.viewState??this._loadNotebookEditorViewState(e);this._widget.value.setParentContextKeyService(this._contextKeyService),this._widget.value.setEditorProgressService(this._editorProgressService),await this._widget.value.setModel(u.notebook,p,c);let h=!!e.isReadonly();if(await this._widget.value.setOptions({...t,isReadOnly:h}),this._widgetDisposableStore.add(this._widget.value.onDidFocusWidget(()=>this._onDidFocusWidget.fire())),this._widgetDisposableStore.add(this._widget.value.onDidBlurWidget(()=>this._onDidBlurWidget.fire())),this._widgetDisposableStore.add(this._editorGroupService.createEditorDropTarget(this._widget.value.getDomNode(),{containsGroup:g=>this.group.id===g.id})),this._widgetDisposableStore.add(this._widget.value.onDidScroll(()=>{this._onDidChangeScroll.fire()})),c.mark("editorLoaded"),l.cancel(),s)return;this._handlePerfMark(c,e,u.notebook),this._onDidChangeControl.fire()}catch(s){if(this.logService.warn("NotebookEditorWidget#setInput failed",s),Pj(s))throw s;if(s.fileOperationResult===7){let c;throw s instanceof WN?c=d(12001,null,ll.formatSize(s.size)):c=d(12000,null),Uxe(this.group,e,t,c,this._preferencesService)}throw Aj(s instanceof Error?s:new Error(s?s.message:""),[pi({id:"workbench.notebook.action.openInTextEditor",label:d(11999,null),run:async()=>{let c=this._editorService.activeEditorPane;if(!c)return;let u=no.getCanonicalUri(c.input);if(u&&u.toString()===e.resource?.toString())return this._editorService.openEditor({resource:u,options:{override:Ys.id,pinned:!0}})}})],{allowDialog:!0})}}_handlePerfMark(e,t,o){let n=e.value,r=n.startTime,s=n.extensionActivated,l=n.inputLoaded,c=n.webviewCommLoaded,u=n.customMarkdownLoaded,p=n.editorLoaded,h=-1,g=-1,f=-1,v=-1,b=-1;r!==void 0&&s!==void 0&&(h=s-r,l!==void 0&&(g=l-s),c!==void 0&&(f=c-s),u!==void 0&&(v=u-r),p!==void 0&&(b=p-r));let S,y,w,k,T,N,O;if(o){let V=new En;for(let U of o.cells)U.cellKind===2?(S=(S||0)+1,T=(T||0)+U.getTextLength(),w=(w||0)+U.outputs.length,k=(k||0)+U.outputs.reduce((G,$)=>G+$.outputs.reduce((te,pe)=>te+pe.data.byteLength,0),0)):(y=(y||0)+1,N=(T||0)+U.getTextLength());O=V.elapsed()}this.logService.trace(`[NotebookEditor] open notebook perf ${o?.uri.toString()??""} - extensionActivation: ${h}, inputLoad: ${g}, webviewComm: ${f}, customMarkdown: ${v}, editorLoad: ${b}`),this.telemetryService.publicLog2("notebook/editorOpenPerf",{scheme:t.resource.scheme,ext:ms(t.resource),viewType:t.viewType,extensionActivated:h,inputLoaded:g,webviewCommLoaded:f,customMarkdownLoaded:v,editorLoaded:b,codeCellCount:S,mdCellCount:y,outputCount:w,outputBytes:k,codeLength:T,markdownLength:N,notebookStatsLoaded:O})}clearInput(){this._inputListener.clear(),this._widget.value&&(this._saveEditorViewState(this.input),this._widget.value.onWillHide()),super.clearInput()}setOptions(e){this._widget.value?.setOptions(e),super.setOptions(e)}saveState(){this._saveEditorViewState(this.input),super.saveState()}getViewState(){let e=this.input;if(e instanceof ha)return this._saveEditorViewState(e),this._loadNotebookEditorViewState(e)}getSelection(){if(this._widget.value){let e=this._widget.value.getActiveCell();if(e){let t=e.uri;return new Fyi(t,e.getSelections())}}}getScrollPosition(){let e=this.getControl();if(!e)throw new Error("Notebook widget has not yet been initialized");return{scrollTop:e.scrollTop,scrollLeft:0}}setScrollPosition(e){let t=this.getControl();if(!t)throw new Error("Control has not yet been initialized");t.setScrollTop(e.scrollTop)}_saveEditorViewState(e){if(this._widget.value&&e instanceof ha){if(this._widget.value.isDisposed)return;let t=this._widget.value.getEditorViewState();this._editorMemento.saveEditorState(this.group,e.resource,t)}}_loadNotebookEditorViewState(e){let t=this._editorMemento.loadEditorState(this.group,e.resource);if(t)return t;for(let o of this._editorGroupService.getGroups(1))if(o.activeEditorPane!==this&&o.activeEditorPane instanceof uD&&o.activeEditor?.matches(e))return o.activeEditorPane._widget.value?.getEditorViewState()}layout(e,t){this._rootElement.classList.toggle("mid-width",e.width<1e3&&e.width>=600),this._rootElement.classList.toggle("narrow-width",e.width<600),this._pagePosition={dimension:e,position:t},!(!this._widget.value||!(this.input instanceof ha))&&(this.input.resource.toString()!==this.textModel?.uri.toString()&&this._widget.value?.hasModel()||this.isVisible()&&this._widget.value.layout(e,this._rootElement,t))}};uD=I([m(1,Te),m(2,De),m(3,F),m(4,le),m(5,ee),m(6,Et),m(7,Zc),m(8,X),m(9,be),m(10,Nn),m(11,rd),m(12,un),m(13,zi),m(14,Gm),m(15,ne),m(16,Po)],uD);var Fyi=class a{constructor(i,e){this.cellUri=i;this.selections=e}compare(i){return i instanceof a?Xe(this.cellUri,i.cellUri)?1:3:3}restore(i){let e={cellOptions:{resource:this.cellUri,options:{selection:this.selections[0]}}};return Object.assign(e,i),e}log(){return this.cellUri.fragment}};function klo(a,i){if(a?.getId()===uD.ID){let e=a.getControl();if(e){for(let[t,o]of e.codeEditors)if(o===i)return!0}}return!1}var Mpe=Object.freeze({type:"type",displayName:"displayName",selector:"selector",priority:"priority"}),lA=Object.freeze({id:"id",displayName:"displayName",mimeTypes:"mimeTypes",entrypoint:"entrypoint",hardDependencies:"dependencies",optionalDependencies:"optionalDependencies",requiresMessaging:"requiresMessaging"}),JJe=Object.freeze({type:"type",entrypoint:"entrypoint",localResourceRoots:"localResourceRoots"}),j3o={description:d(12026,null),type:"array",defaultSnippets:[{body:[{type:"",displayName:"",selector:[{filenamePattern:""}]}]}],items:{type:"object",required:[Mpe.type,Mpe.displayName,Mpe.selector],properties:{[Mpe.type]:{type:"string",description:d(12030,null)},[Mpe.displayName]:{type:"string",description:d(12027,null)},[Mpe.selector]:{type:"array",description:d(12028,null),items:{type:"object",properties:{filenamePattern:{type:"string",description:d(12029,null)},excludeFileNamePattern:{type:"string",description:d(12043,null)}}}},[Mpe.priority]:{type:"string",markdownDeprecationMessage:d(12048,null),enum:["default","option"],markdownEnumDescriptions:[d(12049,null),d(12050,null)],default:"default"}}}},Elo=Object.freeze({id:"",displayName:"",mimeTypes:[""],entrypoint:""}),Q3o={description:d(12031,null),type:"array",defaultSnippets:[{body:[Elo]}],items:{defaultSnippets:[{body:Elo}],allOf:[{type:"object",required:[lA.id,lA.displayName],properties:{[lA.id]:{type:"string",description:d(12041,null)},[lA.displayName]:{type:"string",description:d(12032,null)},[lA.hardDependencies]:{type:"array",uniqueItems:!0,items:{type:"string"},markdownDescription:d(12035,null)},[lA.optionalDependencies]:{type:"array",uniqueItems:!0,items:{type:"string"},markdownDescription:d(12036,null)},[lA.requiresMessaging]:{default:"never",enum:["always","optional","never"],enumDescriptions:[d(12038,null),d(12040,null),d(12039,null)],description:d(12037,null)}}},{oneOf:[{required:[lA.entrypoint,lA.mimeTypes],properties:{[lA.mimeTypes]:{type:"array",description:d(12042,null),items:{type:"string"}},[lA.entrypoint]:{description:d(12033,null),type:"string"}}},{required:[lA.entrypoint],properties:{[lA.entrypoint]:{description:d(12033,null),type:"object",required:["extends","path"],properties:{extends:{type:"string",description:d(12034,null)},path:{type:"string",description:d(12033,null)}}}}}]}]}},Y3o={description:d(12046,null),type:"array",defaultSnippets:[{body:[{type:"",entrypoint:""}]}],items:{type:"object",required:[JJe.type,JJe.entrypoint],properties:{[JJe.type]:{type:"string",description:d(12047,null)},[JJe.entrypoint]:{type:"string",description:d(12044,null)},[JJe.localResourceRoots]:{type:"array",items:{type:"string"},description:d(12045,null)}}}},Tlo=Tn.registerExtensionPoint({extensionPoint:"notebooks",jsonSchema:j3o,activationEventsGenerator:function*(a){for(let i of a)i.type&&(yield`onNotebookSerializer:${i.type}`)}}),_lo=Tn.registerExtensionPoint({extensionPoint:"notebookRenderer",jsonSchema:Q3o,activationEventsGenerator:function*(a){for(let i of a)i.id&&(yield`onRenderer:${i.id}`)}}),Dlo=Tn.registerExtensionPoint({extensionPoint:"notebookPreload",jsonSchema:Y3o}),Wyi=class extends C{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.notebooks}render(e){let t=e.contributes?.notebooks||[];if(!t.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let o=[d(12051,null),d(12053,null)],n=t.sort((r,s)=>r.type.localeCompare(s.type)).map(r=>[r.type,r.displayName]);return{data:{headers:o,rows:n},dispose:()=>{}}}},Vyi=class extends C{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.notebookRenderer}render(e){let t=e.contributes?.notebookRenderer||[];if(!t.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let o=[d(12054,null),d(12052,null)],n=t.sort((r,s)=>r.displayName.localeCompare(s.displayName)).map(r=>[r.displayName,r.mimeTypes.join(",")]);return{data:{headers:o,rows:n},dispose:()=>{}}}};oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:"notebooks",label:d(12056,null),access:{canToggle:!1},renderer:new Mt(Wyi)});oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:"notebookRenderer",label:d(12055,null),access:{canToggle:!1},renderer:new Mt(Vyi)});var Byi=class extends gg{constructor(e,t){super();this.original=e;this.modified=t}},yw=class extends Fa{constructor(e,t,o,n,r,s){super(e,t,o,n,void 0,s);this.original=o;this.modified=n;this.viewType=r;this._modifiedTextModel=null;this._originalTextModel=null;this._cachedModel=void 0}static create(e,t,o,n,r,s){let l=ha.getOrCreate(e,r,void 0,s),c=ha.getOrCreate(e,t,void 0,s);return e.createInstance(yw,o,n,l,c,s)}static{this.ID="workbench.input.diffNotebookInput"}get resource(){return this.modified.resource}get editorId(){return this.viewType}get typeId(){return yw.ID}async resolve(){let[e,t]=await Promise.all([this.original.resolve(),this.modified.resolve()]);if(this._cachedModel?.dispose(),!t)throw new Error(`Fail to resolve modified editor model for resource ${this.modified.resource} with notebookType ${this.viewType}`);if(!e)throw new Error(`Fail to resolve original editor model for resource ${this.original.resource} with notebookType ${this.viewType}`);return this._originalTextModel=e,this._modifiedTextModel=t,this._cachedModel=new Byi(this._originalTextModel,this._modifiedTextModel),this._cachedModel}toUntyped(){let e={resource:this.original.resource},t={resource:this.resource};return{original:e,modified:t,primary:t,secondary:e,options:{override:this.viewType}}}matches(e){return this===e?!0:e instanceof yw?this.modified.matches(e.modified)&&this.original.matches(e.original)&&this.viewType===e.viewType:db(e)?this.modified.matches(e.modified)&&this.original.matches(e.original)&&this.editorId!==void 0&&(this.editorId===e.options?.override||e.options?.override===void 0):!1}dispose(){super.dispose(),this._cachedModel?.dispose(),this._cachedModel=void 0,this.original.dispose(),this.modified.dispose(),this._originalTextModel=null,this._modifiedTextModel=null}};yw=I([m(5,ee)],yw);var NWt=class{constructor(i,e,t,o,n,r,s){this.resource=i;this.fromIndex=e;this.length=t;this.toIndex=o;this.editingDelegate=n;this.beforedSelections=r;this.endSelections=s;this.type=0;this.code="undoredo.textBufferEdit"}get label(){return this.length===1?"Move Cell":"Move Cells"}undo(){if(!this.editingDelegate.moveCell)throw new Error("Notebook Move Cell not implemented for Undo/Redo");this.editingDelegate.moveCell(this.toIndex,this.length,this.fromIndex,this.endSelections,this.beforedSelections)}redo(){if(!this.editingDelegate.moveCell)throw new Error("Notebook Move Cell not implemented for Undo/Redo");this.editingDelegate.moveCell(this.fromIndex,this.length,this.toIndex,this.beforedSelections,this.endSelections)}},OWt=class{constructor(i,e,t,o,n){this.resource=i;this.diffs=e;this.editingDelegate=t;this.beforeHandles=o;this.endHandles=n;this.type=0;this.code="undoredo.textBufferEdit"}get label(){return this.diffs.length===1&&this.diffs[0][1].length===0?this.diffs[0][2].length>1?"Insert Cells":"Insert Cell":this.diffs.length===1&&this.diffs[0][2].length===0?this.diffs[0][1].length>1?"Delete Cells":"Delete Cell":"Insert Cell"}undo(){if(!this.editingDelegate.replaceCell)throw new Error("Notebook Replace Cell not implemented for Undo/Redo");this.diffs.forEach(i=>{this.editingDelegate.replaceCell(i[0],i[2].length,i[1],this.beforeHandles)})}redo(){if(!this.editingDelegate.replaceCell)throw new Error("Notebook Replace Cell not implemented for Undo/Redo");this.diffs.reverse().forEach(i=>{this.editingDelegate.replaceCell(i[0],i[1].length,i[2],this.endHandles)})}},FWt=class{constructor(i,e,t,o,n){this.resource=i;this.index=e;this.oldMetadata=t;this.newMetadata=o;this.editingDelegate=n;this.type=0;this.label="Update Cell Metadata";this.code="undoredo.textBufferEdit"}undo(){this.editingDelegate.updateCellMetadata&&this.editingDelegate.updateCellMetadata(this.index,this.oldMetadata)}redo(){this.editingDelegate.updateCellMetadata&&this.editingDelegate.updateCellMetadata(this.index,this.newMetadata)}};var MZ=class extends C{constructor(e){super();this._rawOutput=e;this._onDidChangeData=this._register(new E);this.onDidChangeData=this._onDidChangeData.event;this._versionId=0;this.versionedBufferLengths={};this._alternativeOutputId=this._rawOutput.outputId}get outputs(){return this._rawOutput.outputs||[]}get metadata(){return this._rawOutput.metadata}get outputId(){return this._rawOutput.outputId}get alternativeOutputId(){return this._alternativeOutputId}get versionId(){return this._versionId}replaceData(e){this.versionedBufferLengths={},this._rawOutput=e,this.optimizeOutputItems(),this._versionId=this._versionId+1,this._onDidChangeData.fire()}appendData(e){this.trackBufferLengths(),this._rawOutput.outputs.push(...e),this.optimizeOutputItems(),this._versionId=this._versionId+1,this._onDidChangeData.fire()}trackBufferLengths(){this.outputs.forEach(e=>{oL(e.mime)&&(this.versionedBufferLengths[e.mime]||(this.versionedBufferLengths[e.mime]={}),this.versionedBufferLengths[e.mime][this.versionId]=e.data.byteLength)})}appendedSinceVersion(e,t){let o=this.versionedBufferLengths[t]?.[e],n=this.outputs.find(r=>r.mime===t);if(o&&n)return n.data.slice(o)}optimizeOutputItems(){if(this.outputs.length>1&&this.outputs.every(e=>oL(e.mime))){let e=new Map,t=[];this.outputs.forEach(o=>{let n;e.has(o.mime)?n=e.get(o.mime):(n=[],e.set(o.mime,n),t.push(o.mime)),n.push(o.data.buffer)}),this.outputs.length=0,t.forEach(o=>{let n=I9i(e.get(o));this.outputs.push({mime:o,data:n.data}),n.didCompression&&(this.versionedBufferLengths={})})}}asDto(){return{metadata:this._rawOutput.metadata,outputs:this._rawOutput.outputs,outputId:this._rawOutput.outputId}}bumpVersion(){this._versionId=this._versionId+1}};var M4=class a extends C{constructor(e,t,o,n,r,s,l,c=void 0,u){super();this.uri=e;this.handle=t;this.transientOptions=n;this._languageService=r;this._defaultEOL=s;this._languageDetectionService=c;this._notebookLoggingService=u;this._onDidChangeTextModel=this._register(new E);this.onDidChangeTextModel=this._onDidChangeTextModel.event;this._onDidChangeOutputs=this._register(new E);this.onDidChangeOutputs=this._onDidChangeOutputs.event;this._onDidChangeOutputItems=this._register(new E);this.onDidChangeOutputItems=this._onDidChangeOutputItems.event;this._onDidChangeContent=this._register(new E);this.onDidChangeContent=this._onDidChangeContent.event;this._onDidChangeMetadata=this._register(new E);this.onDidChangeMetadata=this._onDidChangeMetadata.event;this._onDidChangeInternalMetadata=this._register(new E);this.onDidChangeInternalMetadata=this._onDidChangeInternalMetadata.event;this._onDidChangeLanguage=this._register(new E);this.onDidChangeLanguage=this._onDidChangeLanguage.event;this._textBufferHash=null;this._hash=null;this._versionId=1;this._alternativeId=1;this._textModelDisposables=this._register(new P);this._textModel=void 0;this.autoDetectLanguageThrottler=this._register(new ya(a.AUTO_DETECT_LANGUAGE_THROTTLE_DELAY));this._autoLanguageDetectionEnabled=!1;this._hasLanguageSetExplicitly=!1;this._source=o.source,this._language=o.language,this._mime=o.mime,this.cellKind=o.cellKind;let p=o.cellKind===2?l?.codeCell:l?.markupCell;this.collapseState=o.collapseState??p??void 0,this._outputs=o.outputs.map(h=>new MZ(h)),this._metadata=o.metadata??{},this._internalMetadata=o.internalMetadata??{}}get outputs(){return this._outputs}get metadata(){return this._metadata}set metadata(e){this._metadata=e,this._hash=null,this._onDidChangeMetadata.fire()}get internalMetadata(){return this._internalMetadata}set internalMetadata(e){let t=this._internalMetadata.lastRunSuccess!==e.lastRunSuccess;e={...e,runStartTimeAdjustment:X3o(this._internalMetadata,e)},this._internalMetadata=e,this._hash=null,this._onDidChangeInternalMetadata.fire({lastRunSuccessChanged:t})}get language(){return this._language}set language(e){this._textModel&&this._textModel.getLanguageId()===this._languageService.getLanguageIdByLanguageName(e)&&this._textModel.getLanguageId()===this._languageService.getLanguageIdByLanguageName(this.language)||(this._hasLanguageSetExplicitly=!0,this._setLanguageInternal(e))}get mime(){return this._mime}set mime(e){this._mime!==e&&(this._mime=e,this._hash=null,this._onDidChangeContent.fire("mime"))}get textBuffer(){return this._textBuffer?this._textBuffer:(this._textBuffer=this._register(n1(this._source,this._defaultEOL).textBuffer),this._register(this._textBuffer.onDidChangeContent(()=>{this._hash=null,this._textModel||this._onDidChangeContent.fire("content"),this.autoDetectLanguage()})),this._textBuffer)}get alternativeId(){return this._alternativeId}get textModel(){return this._textModel}set textModel(e){this._textModel!==e&&(this._textModelDisposables.clear(),this._textModel=e,this._textModel&&(this.setRegisteredLanguage(this._languageService,this._textModel.getLanguageId(),this.language),this._textModelDisposables.add(this._textModel.onDidChangeLanguage(t=>this.setRegisteredLanguage(this._languageService,t.newLanguage,this.language))),this._textModelDisposables.add(this._textModel.onWillDispose(()=>this.textModel=void 0)),this._textModelDisposables.add(this._textModel.onDidChangeContent(t=>{this._textModel&&(this._versionId=this._textModel.getVersionId(),this._alternativeId=this._textModel.getAlternativeVersionId()),this._textBufferHash=null,this._onDidChangeContent.fire("content"),this._onDidChangeContent.fire({type:"model",event:t})})),this._textModel._overwriteVersionId(this._versionId),this._textModel._overwriteAlternativeVersionId(this._versionId),this._onDidChangeTextModel.fire()))}setRegisteredLanguage(e,t,o){let n=t===Fr||t==="jupyter";!e.isRegisteredLanguageId(o)&&n?this._onDidChangeLanguage.fire(o):this.language=t}static{this.AUTO_DETECT_LANGUAGE_THROTTLE_DELAY=600}get hasLanguageSetExplicitly(){return this._hasLanguageSetExplicitly}enableAutoLanguageDetection(){this._autoLanguageDetectionEnabled=!0,this.autoDetectLanguage()}async autoDetectLanguage(){this._autoLanguageDetectionEnabled&&this.autoDetectLanguageThrottler.trigger(()=>this._doAutoDetectLanguage())}async _doAutoDetectLanguage(){if(this.hasLanguageSetExplicitly)return;let e=await this._languageDetectionService?.detectLanguage(this.uri);e&&(this._textModel&&this._textModel.getLanguageId()===this._languageService.getLanguageIdByLanguageName(e)&&this._textModel.getLanguageId()===this._languageService.getLanguageIdByLanguageName(this.language)||this._setLanguageInternal(e))}_setLanguageInternal(e){let t=this._languageService.getLanguageIdByLanguageName(e);if(t!==null){if(this._textModel){let o=this._languageService.createById(t);this._textModel.setLanguage(o.languageId)}this._language!==e&&(this._language=e,this._hash=null,this._onDidChangeLanguage.fire(e),this._onDidChangeContent.fire("language"))}}resetTextBuffer(e){this._textBuffer=e}getValue(){let e=this.getFullModelRange();return this.textBuffer.getEOL()===`
`?this.textBuffer.getValueInRange(e,1):this.textBuffer.getValueInRange(e,2)}getTextBufferHash(){if(this._textBufferHash!==null)return this._textBufferHash;let e=new Ly,t=this.textBuffer.createSnapshot(!1),o;for(;o=t.read();)e.update(o);return this._textBufferHash=e.digest(),this._textBufferHash}getHashValue(){return this._hash!==null?this._hash:(this._hash=Ir([Ir(this.language),this.getTextBufferHash(),this._getPersisentMetadata(),this.transientOptions.transientOutputs?[]:this._outputs.map(e=>({outputs:e.outputs.map(t=>({mime:t.mime,data:Array.from(t.data.buffer)})),metadata:e.metadata}))]),this._hash)}_getPersisentMetadata(){return QK(this.transientOptions.transientCellMetadata,this.metadata,this.language)}getTextLength(){return this.textBuffer.getLength()}getFullModelRange(){let e=this.textBuffer.getLineCount();return new z(1,1,e,this.textBuffer.getLineLength(e)+1)}spliceNotebookCellOutputs(e){if(this._notebookLoggingService.trace("textModelEdits",`splicing outputs at ${e.start} length: ${e.deleteCount} with ${e.newOutputs.length} new outputs`),e.deleteCount>0&&e.newOutputs.length>0){let t=Math.min(e.deleteCount,e.newOutputs.length);for(let n=0;n<t;n++){let r=this.outputs[e.start+n],s=e.newOutputs[n];this.replaceOutput(r.outputId,s)}this.outputs.splice(e.start+t,e.deleteCount-t,...e.newOutputs.slice(t)).forEach(n=>n.dispose()),this._onDidChangeOutputs.fire({start:e.start+t,deleteCount:e.deleteCount-t,newOutputs:e.newOutputs.slice(t)})}else this.outputs.splice(e.start,e.deleteCount,...e.newOutputs).forEach(o=>o.dispose()),this._onDidChangeOutputs.fire(e)}replaceOutput(e,t){let o=this.outputs.findIndex(r=>r.outputId===e);return o<0?!1:(this._notebookLoggingService.trace("textModelEdits",`replacing an output item at index ${o}`),this.outputs[o].replaceData({outputs:t.outputs,outputId:t.outputId,metadata:t.metadata}),t.dispose(),this._onDidChangeOutputItems.fire(),!0)}changeOutputItems(e,t,o){let n=this.outputs.findIndex(s=>s.outputId===e);if(n<0)return!1;let r=this.outputs[n];return this._notebookLoggingService.trace("textModelEdits",`${t?"appending":"replacing"} ${o.length} output items to for output index ${n}`),t?r.appendData(o):r.replaceData({outputId:e,outputs:o,metadata:r.metadata}),this._onDidChangeOutputItems.fire(),!0}_outputNotEqualFastCheck(e,t){if(e.length!==t.length)return!1;for(let o=0;o<this.outputs.length;o++){let n=e[o],r=t[o];if(n.outputs.length!==r.outputs.length)return!1;for(let s=0;s<n.outputs.length;s++)if(n.outputs[s].mime!==r.outputs[s].mime||n.outputs[s].data.byteLength!==r.outputs[s].data.byteLength)return!1}return!0}equal(e){return this.language!==e.language||this.outputs.length!==e.outputs.length||this.getTextLength()!==e.getTextLength()||!this.transientOptions.transientOutputs&&!this._outputNotEqualFastCheck(this.outputs,e.outputs)?!1:this.getHashValue()===e.getHashValue()}fastEqual(e,t){if(this.language!==e.language||this.mime!==e.mime||this.cellKind!==e.cellKind||!t&&(this.internalMetadata?.executionOrder!==e.internalMetadata?.executionOrder||this.internalMetadata?.lastRunSuccess!==e.internalMetadata?.lastRunSuccess||this.internalMetadata?.runStartTime!==e.internalMetadata?.runStartTime||this.internalMetadata?.runStartTimeAdjustment!==e.internalMetadata?.runStartTimeAdjustment||this.internalMetadata?.runEndTime!==e.internalMetadata?.runEndTime))return!1;if(this._textBuffer){if(!a.linesAreEqual(this.textBuffer.getLinesContent(),e.source))return!1}else if(this._source!==e.source)return!1;return!0}static linesAreEqual(e,t){let o=mc(t);if(e.length!==o.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==o[n])return!1;return!0}dispose(){Ue(this._outputs);let e=new N9([],"",`
`,!1,!1,!0,!0);e.dispose(),this._textBuffer=e,super.dispose()}};function jK(a){return{source:a.getValue(),language:a.language,mime:a.mime,cellKind:a.cellKind,outputs:a.outputs.map(i=>({outputs:i.outputs,outputId:_t()})),metadata:{}}}function X3o(a,i){if(a.runStartTime!==i.runStartTime&&typeof i.runStartTime=="number"){let e=Date.now()-i.runStartTime;return e<0?Math.abs(e):0}else return i.runStartTimeAdjustment}function QK(a,i,e,t){let o={};if(a){let s=new Set([...Object.keys(i)]);for(let l of s)a[l]||(o[l]=i[l])}else o=i;let n={language:e,...o};return e&&(n.language=e),rF(t?Hyi(n):n,{})}function Hyi(a){return Array.isArray(a)?a.map(Hyi):a!=null&&typeof a=="object"&&Object.keys(a).length>0?Object.keys(a).sort().reduce((i,e)=>(i[e]=Hyi(a[e]),i),{}):a}var Uyi=class{constructor(i,e,t,o,n,r){this.textModel=i;this.undoRedoGroup=e;this._pauseableEmitter=t;this._postUndoRedo=o;this.tag="notebookUndoRedoElement";this._operations=[];this._beginSelectionState=void 0;this._resultSelectionState=void 0;this.type=1,this._beginSelectionState=n,this._beginAlternativeVersionId=r,this._resultAlternativeVersionId=r}get code(){return this._operations.length===1?this._operations[0].code:"undoredo.notebooks.stackOperation"}get label(){return this._operations.length===1?this._operations[0].label:"edit"}get resources(){return[this.textModel.uri]}get isEmpty(){return this._operations.length===0}pushEndState(i,e){this._resultAlternativeVersionId=i,this._resultSelectionState=e||this._resultSelectionState}pushEditOperation(i,e,t,o){this._operations.length===0&&(this._beginSelectionState=this._beginSelectionState??e),this._operations.push(i),this._resultSelectionState=t,this._resultAlternativeVersionId=o}async undo(){this._pauseableEmitter.pause();try{for(let i=this._operations.length-1;i>=0;i--)await this._operations[i].undo();this._postUndoRedo(this._beginAlternativeVersionId),this._pauseableEmitter.fire({rawEvents:[],synchronous:void 0,versionId:this.textModel.versionId,endSelectionState:this._beginSelectionState})}finally{this._pauseableEmitter.resume()}}async redo(){this._pauseableEmitter.pause();try{for(let i=0;i<this._operations.length;i++)await this._operations[i].redo();this._postUndoRedo(this._resultAlternativeVersionId),this._pauseableEmitter.fire({rawEvents:[],synchronous:void 0,versionId:this.textModel.versionId,endSelectionState:this._resultSelectionState})}finally{this._pauseableEmitter.resume()}}},zyi=class{constructor(i,e,t,o){this._textModel=i;this._undoService=e;this._pauseableEmitter=t;this._postUndoRedo=o;this._pendingStackOperation=null;this._isAppending=!1}isUndoStackEmpty(){return this._pendingStackOperation===null||this._pendingStackOperation.isEmpty}pushStackElement(i,e){this._pendingStackOperation&&!this._pendingStackOperation.isEmpty&&(this._pendingStackOperation.pushEndState(i,e),this._isAppending||this._undoService.pushElement(this._pendingStackOperation,this._pendingStackOperation.undoRedoGroup)),this._isAppending=!1,this._pendingStackOperation=null}_getOrCreateEditStackElement(i,e,t){return this._pendingStackOperation??=new Uyi(this._textModel,e,this._pauseableEmitter,this._postUndoRedo,i,t||"")}appendPreviousOperation(){let i=this._undoService.getLastElement(this._textModel.uri);return i&&i.tag==="notebookUndoRedoElement"?(this._pendingStackOperation=i,this._isAppending=!0,!0):!1}pushEditOperation(i,e,t,o,n){this._getOrCreateEditStackElement(e,n,o).pushEditOperation(i,e,t,o)}},Kyi=class extends Pm{get isEmpty(){return this._eventQueue.isEmpty()}isDirtyEvent(){for(let i of this._eventQueue)for(let e=0;e<i.rawEvents.length;e++)if(!i.rawEvents[e].transient)return!0;return!1}},PZ=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.viewType=e;this.uri=t;this._undoService=s;this._modelService=l;this._languageService=c;this._languageDetectionService=u;this._notebookExecutionStateService=p;this._notebookLoggingService=h;this._isDisposed=!1;this._onWillDispose=this._register(new E);this._onWillAddRemoveCells=this._register(new E);this._onDidChangeContent=this._register(new E);this.onWillDispose=this._onWillDispose.event;this.onWillAddRemoveCells=this._onWillAddRemoveCells.event;this.onDidChangeContent=this._onDidChangeContent.event;this._cellhandlePool=0;this._cellListeners=new Map;this._cells=[];this.metadata={};this.transientOptions={transientCellMetadata:{},transientDocumentMetadata:{},transientOutputs:!1,cellContentMetadata:{}};this._versionId=0;this._notebookSpecificAlternativeId=0;this._alternativeVersionId="1";this.newCellsFromLastEdit=new Set;this.transientOptions=r,this.metadata=n,this._initialize(o);let g=f=>{if(f.uri.scheme===Y.vscodeNotebookCell&&f instanceof Bu){let v=Zo.parse(f.uri);if(v&&Xe(v.notebook,this.uri)){let b=this._getCellIndexByHandle(v.handle);if(b>=0){let S=this.cells[b];S&&(S.textModel=f)}}}};this._register(l.onModelAdded(f=>g(f))),this._pauseableEmitter=this._register(new Kyi({merge:f=>{let v=f[0],b=v.rawEvents,S=v.versionId,y=v.endSelectionState,w=v.synchronous;for(let k=1;k<f.length;k++)b.push(...f[k].rawEvents),S=f[k].versionId,y=f[k].endSelectionState!==void 0?f[k].endSelectionState:y,w=f[k].synchronous!==void 0?f[k].synchronous:w;return{rawEvents:b,versionId:S,endSelectionState:y,synchronous:w}}})),this._register(this._pauseableEmitter.event(f=>{f.rawEvents.length&&this._onDidChangeContent.fire(f)})),this._operationManager=new zyi(this,this._undoService,this._pauseableEmitter,f=>{this._increaseVersionId(!0),this._overwriteAlternativeVersionId(f)}),this._notebookLoggingService.trace("notebookTextModel",`Initialized notebook text model for ${t.toString()}`)}get length(){return this._cells.length}get cells(){return this._cells}get versionId(){return this._versionId}get alternativeVersionId(){return this._alternativeVersionId}get notebookType(){return this.viewType}setCellCollapseDefault(e){this._defaultCollapseConfig=e}_initialize(e,t){this._cells=[],this._versionId=0,this._notebookSpecificAlternativeId=0;let o=e.map(n=>{let r=this._cellhandlePool++,s=Zo.generate(this.uri,r);return new M4(s,r,n,this.transientOptions,this._languageService,this._modelService.getCreationOptions(n.language,s,!1).defaultEOL,this._defaultCollapseConfig,this._languageDetectionService,this._notebookLoggingService)});for(let n=0;n<o.length;n++){let r=o[n].onDidChangeContent(s=>{this._bindCellContentHandler(o[n],s)});this._cellListeners.set(o[n].handle,r),this._register(o[n])}this._cells.splice(0,0,...o),this._alternativeVersionId=this._generateAlternativeId(),t&&this._pauseableEmitter.fire({rawEvents:[{kind:100,transient:!1}],versionId:this.versionId,synchronous:!0,endSelectionState:void 0})}_bindCellContentHandler(e,t){switch(this._increaseVersionId(t==="content"||typeof t=="object"&&t.type==="model"),t){case"content":this._pauseableEmitter.fire({rawEvents:[{kind:10,index:this._getCellIndexByHandle(e.handle),transient:!1}],versionId:this.versionId,synchronous:!0,endSelectionState:void 0});break;case"language":this._pauseableEmitter.fire({rawEvents:[{kind:5,index:this._getCellIndexByHandle(e.handle),language:e.language,transient:!1}],versionId:this.versionId,synchronous:!0,endSelectionState:void 0});break;case"mime":this._pauseableEmitter.fire({rawEvents:[{kind:13,index:this._getCellIndexByHandle(e.handle),mime:e.mime,transient:!1}],versionId:this.versionId,synchronous:!0,endSelectionState:void 0});break;default:typeof t=="object"&&t.type==="model"&&this._pauseableEmitter.fire({rawEvents:[{kind:10,index:this._getCellIndexByHandle(e.handle),transient:!1}],versionId:this.versionId,synchronous:!0,endSelectionState:void 0});break}}_generateAlternativeId(){return`${this._notebookSpecificAlternativeId}_`+this.cells.map(e=>e.handle+","+e.alternativeId).join(";")}dispose(){this._isDisposed||(this._isDisposed=!0,this._onWillDispose.fire(),this._undoService.removeElements(this.uri),Ue(this._cellListeners.values()),this._cellListeners.clear(),Ue(this._cells),this._cells=[],super.dispose())}pushStackElement(){}_getCellIndexByHandle(e){return this.cells.findIndex(t=>t.handle===e)}_getCellIndexWithOutputIdHandleFromEdits(e,t){let o=t.find(n=>Wo(n,{outputs:!0})&&n.outputs.some(r=>r.outputId===e));if(o){if(Wo(o,{index:!0}))return o.index;if(Wo(o,{handle:!0})){let n=this._getCellIndexByHandle(o.handle);return this._assertIndex(n),n}}return-1}_getCellIndexWithOutputIdHandle(e){return this.cells.findIndex(t=>!!t.outputs.find(o=>o.outputId===e))}reset(e,t,o){this.transientOptions=o;let r=this._notebookExecutionStateService.getCellExecutionsForNotebook(this.uri).filter(l=>l.state===3).map(l=>l.cellHandle),s=PZ.computeEdits(this,e,r);this.applyEdits([...s,{editType:5,metadata:t}],!0,void 0,()=>{},void 0,!1)}createSnapshot(e){let t=e.transientOptions??this.transientOptions,o={metadata:DM(this.metadata,r=>!t.transientDocumentMetadata[r]),cells:[]},n=0;for(let r of this.cells){let s={cellKind:r.cellKind,language:r.language,mime:r.mime,source:r.getValue(),outputs:[],internalMetadata:r.internalMetadata};if(e.context===2&&e.outputSizeLimit>0&&(r.outputs.forEach(l=>{l.outputs.forEach(c=>{n+=c.data.byteLength})}),n>e.outputSizeLimit))throw new Error("Notebook too large to backup");s.outputs=t.transientOutputs?[]:r.outputs,s.metadata=DM(r.metadata,l=>!t.transientCellMetadata[l]),o.cells.push(s)}return o}restoreSnapshot(e,t){this.reset(e.cells,e.metadata,t??this.transientOptions)}static computeEdits(e,t,o=[]){let n=[],r=c=>o.includes(c.handle),s=this._commonPrefix(e.cells,e.cells.length,0,t,t.length,0,r);if(s>0)for(let c=0;c<s;c++)n.push({editType:3,index:c,metadata:t[c].metadata??{}},...this._computeOutputEdit(c,e.cells[c].outputs,t[c].outputs));if(e.cells.length===t.length&&s===e.cells.length)return n;let l=this._commonSuffix(e.cells,e.cells.length-s,s,t,t.length-s,s,r);if(l>0?n.push({editType:1,index:s,count:e.cells.length-s-l,cells:t.slice(s,t.length-l)}):s>0?n.push({editType:1,index:s,count:e.cells.length-s,cells:t.slice(s)}):n.push({editType:1,index:0,count:e.cells.length,cells:t}),l>0)for(let c=l;c>0;c--)n.push({editType:3,index:e.cells.length-c,metadata:t[t.length-c].metadata??{}},...this._computeOutputEdit(e.cells.length-c,e.cells[e.cells.length-c].outputs,t[t.length-c].outputs));return n}static _computeOutputEdit(e,t,o){return t.length!==o.length?[{editType:2,index:e,outputs:o,append:!1}]:t.length===0?[]:o.map((n,r)=>({editType:7,outputId:t[r].outputId,items:n.outputs,append:!1}))}static _commonPrefix(e,t,o,n,r,s,l){let c=Math.min(t,r),u=0;for(let p=0;p<c&&e[o+p].fastEqual(n[s+p],l(e[o+p]));p++)u++;return u}static _commonSuffix(e,t,o,n,r,s,l){let c=Math.min(t,r),u=0;for(let p=0;p<c&&e[o+t-p-1].fastEqual(n[s+r-p-1],l(e[o+t-p-1]));p++)u++;return u}isOnlyEditingMetadataOnNewCells(e){for(let t of e)if(t.editType!==9&&(t.editType!==3&&t.editType!==8||Wo(t,{index:!0})&&!this.newCellsFromLastEdit.has(this.cells[t.index].handle)||Wo(t,{handle:!0})&&!this.newCellsFromLastEdit.has(t.handle)))return!1;return!0}applyEdits(e,t,o,n,r,s){this._notebookLoggingService.trace("textModelEdits",`Begin applying ${e.length} raw edits`),this._pauseableEmitter.pause();try{this._operationManager.pushStackElement(this._alternativeVersionId,void 0),s&&this.isOnlyEditingMetadataOnNewCells(e)?this._operationManager.appendPreviousOperation()||(s=!1):s&&this.newCellsFromLastEdit.clear();try{return this._doApplyEdits(e,t,s,o,r),!0}catch(l){throw this._notebookLoggingService.error("textModelEdits",`Error while applying edits: ${l}`),l}finally{if(!this._pauseableEmitter.isEmpty){let l=n();this._increaseVersionId(this._operationManager.isUndoStackEmpty()&&!this._pauseableEmitter.isDirtyEvent()),this._operationManager.pushStackElement(this._alternativeVersionId,l),this._pauseableEmitter.fire({rawEvents:[],versionId:this.versionId,synchronous:t,endSelectionState:l}),this._notebookLoggingService.trace("textModelEdits",`End applying ${e.length} raw edits`)}}}finally{this._pauseableEmitter.resume()}}_doApplyEdits(e,t,o,n,r){let s=e.map((u,p)=>{let h=-1;if(Wo(u,{index:!0}))h=u.index;else if(Wo(u,{handle:!0}))h=this._getCellIndexByHandle(u.handle),this._assertIndex(h);else if(Wo(u,{outputId:!0})){if(h=this._getCellIndexWithOutputIdHandle(u.outputId),this._indexIsInvalid(h)&&(h=this._getCellIndexWithOutputIdHandleFromEdits(u.outputId,e.slice(0,p))),this._indexIsInvalid(h))return null}else if(u.editType!==5)throw new Error("Invalid cell edit: "+JSON.stringify(u));return{edit:u,cellIndex:h,end:u.editType===5?void 0:u.editType===1?u.index+u.count:h,originalIndex:p}}).filter(mo),c=this._mergeCellEdits(s).sort((u,p)=>u.end===void 0||p.end===void 0?-1:p.end-u.end||p.originalIndex-u.originalIndex).reduce((u,p)=>{if(!u.length)u.push([p]);else{let h=u[u.length-1],g=h[0].cellIndex;p.cellIndex===g?h.push(p):u.push([p])}return u},[]).map(u=>{let p=[],h=[];return u.forEach(g=>{g.edit.editType===1?p.push(g):h.push(g)}),[...h.reverse(),...p]}).flat();for(let{edit:u,cellIndex:p}of c)switch(u.editType){case 1:this._replaceCells(u.index,u.count,u.cells,t,o,n,r);break;case 2:{this._assertIndex(p);let h=this._cells[p];u.append?this._spliceNotebookCellOutputs(h,{start:h.outputs.length,deleteCount:0,newOutputs:u.outputs.map(g=>new MZ(g))},!0,o):this._spliceNotebookCellOutputs2(h,u.outputs,o);break}case 7:{this._assertIndex(p);let h=this._cells[p];u.append?this._appendNotebookCellOutputItems(h,u.outputId,u.items):this._replaceNotebookCellOutputItems(h,u.outputId,u.items)}break;case 3:this._assertIndex(u.index),this._changeCellMetadata(this._cells[u.index],u.metadata,o,n,r);break;case 8:this._assertIndex(p),this._changeCellMetadataPartial(this._cells[p],u.metadata,o,n,r);break;case 9:this._assertIndex(p),this._changeCellInternalMetadataPartial(this._cells[p],u.internalMetadata);break;case 4:this._assertIndex(u.index),this._changeCellLanguage(this._cells[u.index],u.language,o,n,r);break;case 5:this._updateNotebookCellMetadata(u.metadata,o,n,r);break;case 6:this._moveCellToIdx(u.index,u.length,u.newIdx,t,o,n,void 0,r);break}}_mergeCellEdits(e){let t=[];return e.forEach(o=>{if(t.length){let n=t[t.length-1];n.edit.editType===2&&n.edit.append&&o.edit.editType===2&&o.edit.append&&n.cellIndex===o.cellIndex?n.edit.outputs=[...n.edit.outputs,...o.edit.outputs]:n.edit.editType===2&&!n.edit.append&&n.edit.outputs.length===0&&o.edit.editType===2&&o.edit.append&&n.cellIndex===o.cellIndex?(n.edit.append=!1,n.edit.outputs=o.edit.outputs):t.push(o)}else t.push(o)}),t}_replaceCells(e,t,o,n,r,s,l){if(t===0&&o.length===0)return;let c=this._cells.slice(0),u=new Set;c.forEach(v=>{u.add(v.handle)});for(let v=e;v<Math.min(e+t,this._cells.length);v++){let b=this._cells[v];this._cellListeners.get(b.handle)?.dispose(),this._cellListeners.delete(b.handle)}let p=o.map(v=>{let b=this._cellhandlePool++,S=Zo.generate(this.uri,b);v.outputs||(v.outputs=[]);let y=new M4(S,b,v,this.transientOptions,this._languageService,this._modelService.getCreationOptions(v.language,S,!1).defaultEOL,this._defaultCollapseConfig,this._languageDetectionService,this._notebookLoggingService),w=this._modelService.getModel(S);w&&w instanceof Bu&&(y.textModel=w,y.language=v.language,y.textModel.setValue(v.source),y.resetTextBuffer(y.textModel.getTextBuffer()));let k=y.onDidChangeContent(T=>{this._bindCellContentHandler(y,T)});return this.newCellsFromLastEdit.add(y.handle),this._cellListeners.set(y.handle,k),this._register(y),y}),h=this._cells.slice(0);h.splice(e,t,...p);let g=H3e(this._cells,h,v=>u.has(v.handle)).map(v=>[v.start,v.deleteCount,v.toInsert]);this._onWillAddRemoveCells.fire({rawEvent:{kind:1,changes:g}}),this._cells=h;let f=g.map(v=>{let b=c.slice(v[0],v[0]+v[1]);return[v[0],b,v[2]]});r&&this._operationManager.pushEditOperation(new OWt(this.uri,f,{insertCell:(v,b,S)=>{this._insertNewCell(v,[b],!0,S)},deleteCell:(v,b)=>{this._removeCell(v,1,!0,b)},replaceCell:(v,b,S,y)=>{this._replaceNewCells(v,b,S,!0,y)}},void 0,void 0),s,void 0,this._alternativeVersionId,l),this._pauseableEmitter.fire({rawEvents:[{kind:1,changes:g,transient:!1}],versionId:this.versionId,synchronous:n,endSelectionState:void 0})}_increaseVersionId(e){this._versionId=this._versionId+1,e||(this._notebookSpecificAlternativeId=this._versionId),this._alternativeVersionId=this._generateAlternativeId()}_overwriteAlternativeVersionId(e){this._alternativeVersionId=e,this._notebookSpecificAlternativeId=Number(e.substring(0,e.indexOf("_")))}_updateNotebookCellMetadata(e,t,o,n){let r=this.metadata,s=this._isDocumentMetadataChanged(this.metadata,e);if(s&&t){let l=this;this._operationManager.pushEditOperation(new class{constructor(){this.type=0;this.label="Update Cell Metadata";this.code="undoredo.textBufferEdit"}get resource(){return l.uri}undo(){l._updateNotebookCellMetadata(r,!1,o,n)}redo(){l._updateNotebookCellMetadata(e,!1,o,n)}},o,void 0,this._alternativeVersionId,n)}this.metadata=e,this._pauseableEmitter.fire({rawEvents:[{kind:11,metadata:this.metadata,transient:!s}],versionId:this.versionId,synchronous:!0,endSelectionState:void 0})}_insertNewCell(e,t,o,n){for(let s=0;s<t.length;s++){let l=t[s].onDidChangeContent(c=>{this._bindCellContentHandler(t[s],c)});this._cellListeners.set(t[s].handle,l)}let r=[[e,0,t]];this._onWillAddRemoveCells.fire({rawEvent:{kind:1,changes:r}}),this._cells.splice(e,0,...t),this._pauseableEmitter.fire({rawEvents:[{kind:1,changes:r,transient:!1}],versionId:this.versionId,synchronous:o,endSelectionState:n})}_removeCell(e,t,o,n){for(let s=e;s<e+t;s++){let l=this._cells[s];this._cellListeners.get(l.handle)?.dispose(),this._cellListeners.delete(l.handle)}let r=[[e,t,[]]];this._onWillAddRemoveCells.fire({rawEvent:{kind:1,changes:r}}),this._cells.splice(e,t),this._pauseableEmitter.fire({rawEvents:[{kind:1,changes:r,transient:!1}],versionId:this.versionId,synchronous:o,endSelectionState:n})}_replaceNewCells(e,t,o,n,r){for(let l=e;l<e+t;l++){let c=this._cells[l];this._cellListeners.get(c.handle)?.dispose(),this._cellListeners.delete(c.handle)}for(let l=0;l<o.length;l++){let c=o[l].onDidChangeContent(u=>{this._bindCellContentHandler(o[l],u)});this._cellListeners.set(o[l].handle,c)}let s=[[e,t,o]];this._onWillAddRemoveCells.fire({rawEvent:{kind:1,changes:s}}),this._cells.splice(e,t,...o),this._pauseableEmitter.fire({rawEvents:[{kind:1,changes:s,transient:!1}],versionId:this.versionId,synchronous:n,endSelectionState:r})}_isDocumentMetadataChanged(e,t){let o=new Set([...Object.keys(e||{}),...Object.keys(t||{})]);for(let n of o)if(n==="custom"){if(!this._customMetadataEqual(e[n],t[n])&&!this.transientOptions.transientDocumentMetadata[n])return!0}else if(e[n]!==t[n]&&!this.transientOptions.transientDocumentMetadata[n])return!0;return!1}_isCellMetadataChanged(e,t){let o=new Set([...Object.keys(e||{}),...Object.keys(t||{})]);for(let n of o)if(e[n]!==t[n]&&!this.transientOptions.transientCellMetadata[n])return!0;return!1}_customMetadataEqual(e,t){if(!e&&!t)return!0;if(!e||!t)return!1;let o=Object.getOwnPropertyNames(e),n=Object.getOwnPropertyNames(t);if(o.length!==n.length)return!1;for(let r=0;r<o.length;r++){let s=o[r];if(e[s]!==t[s])return!1}return!0}_changeCellMetadataPartial(e,t,o,n,r){let s={...e.metadata},l;for(l in t){let c=t[l]??void 0;s[l]=c}return this._changeCellMetadata(e,s,o,n,r)}_changeCellMetadata(e,t,o,n,r){let s=this._isCellMetadataChanged(e.metadata,t);if(s&&o){let l=this._cells.indexOf(e);this._operationManager.pushEditOperation(new FWt(this.uri,l,Object.freeze(e.metadata),Object.freeze(t),{updateCellMetadata:(c,u)=>{let p=this._cells[c];p&&this._changeCellMetadata(p,u,!1,n,r)}}),n,void 0,this._alternativeVersionId,r)}e.metadata=t,this._pauseableEmitter.fire({rawEvents:[{kind:7,index:this._cells.indexOf(e),metadata:e.metadata,transient:!s}],versionId:this.versionId,synchronous:!0,endSelectionState:void 0})}_changeCellInternalMetadataPartial(e,t){let o={...e.internalMetadata},n;for(n in t){let r=t[n]??void 0;o[n]=r}e.internalMetadata=o,this._pauseableEmitter.fire({rawEvents:[{kind:12,index:this._cells.indexOf(e),internalMetadata:e.internalMetadata,transient:!0}],versionId:this.versionId,synchronous:!0,endSelectionState:void 0})}_changeCellLanguage(e,t,o,n,r){if(e.language===t)return;let s=e.language;if(e.language=t,o){let l=this;this._operationManager.pushEditOperation(new class{constructor(){this.type=0;this.label="Update Cell Language";this.code="undoredo.textBufferEdit"}get resource(){return l.uri}undo(){l._changeCellLanguage(e,s,!1,n,r)}redo(){l._changeCellLanguage(e,t,!1,n,r)}},n,void 0,this._alternativeVersionId,r)}this._pauseableEmitter.fire({rawEvents:[{kind:5,index:this._cells.indexOf(e),language:t,transient:!1}],versionId:this.versionId,synchronous:!0,endSelectionState:void 0})}_spliceNotebookCellOutputs2(e,t,o){if(t.length===0&&e.outputs.length===0)return;if(t.length<=1){this._spliceNotebookCellOutputs(e,{start:0,deleteCount:e.outputs.length,newOutputs:t.map(l=>new MZ(l))},!1,o);return}new MM(new WWt(e.outputs),new WWt(t)).ComputeDiff(!1).changes.map(l=>({start:l.originalStart,deleteCount:l.originalLength,newOutputs:t.slice(l.modifiedStart,l.modifiedStart+l.modifiedLength).map(c=>new MZ(c))})).reverse().forEach(l=>{this._spliceNotebookCellOutputs(e,l,!1,o)})}_spliceNotebookCellOutputs(e,t,o,n){e.spliceNotebookCellOutputs(t),this._pauseableEmitter.fire({rawEvents:[{kind:8,index:this._cells.indexOf(e),outputs:e.outputs.map(r=>r.asDto())??[],append:o,transient:this.transientOptions.transientOutputs}],versionId:this.versionId,synchronous:!0,endSelectionState:void 0})}_appendNotebookCellOutputItems(e,t,o){e.changeOutputItems(t,!0,o)&&this._pauseableEmitter.fire({rawEvents:[{kind:9,index:this._cells.indexOf(e),outputId:t,outputItems:o,append:!0,transient:this.transientOptions.transientOutputs}],versionId:this.versionId,synchronous:!0,endSelectionState:void 0})}_replaceNotebookCellOutputItems(e,t,o){e.changeOutputItems(t,!1,o)&&this._pauseableEmitter.fire({rawEvents:[{kind:9,index:this._cells.indexOf(e),outputId:t,outputItems:o,append:!1,transient:this.transientOptions.transientOutputs}],versionId:this.versionId,synchronous:!0,endSelectionState:void 0})}_moveCellToIdx(e,t,o,n,r,s,l,c){r&&this._operationManager.pushEditOperation(new NWt(this.uri,e,t,o,{moveCell:(p,h,g,f,v)=>{this._moveCellToIdx(p,h,g,!0,!1,f,v,c)}},s,l),s,l,this._alternativeVersionId,c),this._assertIndex(e),this._assertIndex(o);let u=this._cells.splice(e,t);return this._cells.splice(o,0,...u),this._pauseableEmitter.fire({rawEvents:[{kind:2,index:e,length:t,newIdx:o,cells:u,transient:!1}],versionId:this.versionId,synchronous:n,endSelectionState:l}),!0}_assertIndex(e){if(this._indexIsInvalid(e))throw new Error(`model index out of range ${e}`)}_indexIsInvalid(e){return e<0||e>=this._cells.length}findNextMatch(e,t,o,n,r,s){this._assertIndex(t.cellIndex);let c=new Oy(e,o,n,r).parseSearchRequest();if(!c)return null;let u=t.cellIndex,p=t.position,h=this._cells.length;for(;u<h;){let g=this._cells[u],f=s&&u===s.cellIndex&&p.isBefore(s.position),v=new z(p.lineNumber,p.column,f?s.position.lineNumber:g.textBuffer.getLineCount(),f?s.position.column:g.textBuffer.getLineMaxColumn(g.textBuffer.getLineCount())),b=g.textBuffer.findMatchesLineByLine(v,c,!1,1);if(b.length>0)return{cell:g,match:b[0]};if(f)break;u++,s&&u>=this._cells.length&&(u=0,h=s.cellIndex+1),p=new Ie(1,1)}return null}findMatches(e,t,o,n){let s=new Oy(e,t,o,n).parseSearchRequest();if(!s)return[];let l=[];for(let c of this._cells){let u=new z(1,1,c.textBuffer.getLineCount(),c.textBuffer.getLineMaxColumn(c.textBuffer.getLineCount())),p=c.textBuffer.findMatchesLineByLine(u,s,!1,1e3);p.length>0&&l.push({cell:c,matches:p})}return l}};PZ=I([m(5,Cl),m(6,Ct),m(7,kt),m(8,eS),m(9,rs),m(10,_v)],PZ);var WWt=class{constructor(i){this.outputs=i}getElements(){return this.outputs.map(i=>Ir(i.outputs.map(e=>({mime:e.mime,data:e.data}))))}};var VWt=class{constructor(i){this.value=new Set(i),this.defined=this.value.size>0}matches(i){return i.some(e=>this.value.has(e))}},BWt=class{constructor(i){this.id=i.id,this.extensionId=i.extension.identifier,this.extensionLocation=i.extension.extensionLocation,this.isBuiltin=i.extension.isBuiltin,typeof i.entrypoint=="string"?this.entrypoint={extends:void 0,path:je(this.extensionLocation,i.entrypoint)}:this.entrypoint={extends:i.entrypoint.extends,path:je(this.extensionLocation,i.entrypoint.path)},this.displayName=i.displayName,this.mimeTypes=i.mimeTypes,this.mimeTypeGlobs=this.mimeTypes.map(e=>zm(e,{ignoreCase:!0})),this.hardDependencies=new VWt(i.dependencies??ht.empty()),this.optionalDependencies=new VWt(i.optionalDependencies??ht.empty()),this.messaging=i.requiresMessaging??"never"}matchesWithoutKernel(i){return this.matchesMimeTypeOnly(i)?this.hardDependencies.defined?0:this.optionalDependencies.defined?1:2:3}matches(i,e){return this.matchesMimeTypeOnly(i)?this.hardDependencies.defined?this.hardDependencies.matches(e)?0:3:this.optionalDependencies.matches(e)?1:2:3}matchesMimeTypeOnly(i){return this.entrypoint.extends?!1:this.mimeTypeGlobs.some(e=>e(i))||this.mimeTypes.some(e=>e===i)}},HWt=class{constructor(i){this.type=i.type,this.entrypoint=je(i.extension.extensionLocation,i.entrypoint),this.extensionLocation=i.extension.extensionLocation,this.localResourceRoots=i.localResourceRoots.map(e=>je(i.extension.extensionLocation,e))}};var AZ=class a{get selectors(){return this._selectors}get options(){return this._options}constructor(i){this.extension=i.extension,this.id=i.id,this.displayName=i.displayName,this._selectors=i.selectors?.map(e=>({include:e.filenamePattern,exclude:e.excludeFileNamePattern||""}))||i._selectors||[],this.priority=i.priority,this.providerDisplayName=i.providerDisplayName,this._options={transientCellMetadata:{},transientDocumentMetadata:{},transientOutputs:!1,cellContentMetadata:{}}}update(i){i.selectors&&(this._selectors=i.selectors),i.options&&(this._options=i.options)}matches(i){return this.selectors?.some(e=>a.selectorMatches(e,i))}static selectorMatches(i,e){if((typeof i=="string"||eP(i))&&Cp(i,No(e.fsPath),{ignoreCase:!0}))return!0;if(!pkt(i))return!1;let t=i.include,o=i.exclude;return Cp(t,No(e.fsPath),{ignoreCase:!0})?!(o&&Cp(o,No(e.fsPath),{ignoreCase:!0})):!1}static possibleFileEnding(i){for(let e of i){let t=a._possibleFileEnding(e);if(t)return t}}static _possibleFileEnding(i){let e=/^.*(\.[a-zA-Z0-9_-]+)$/,t;if(typeof i=="string")t=i;else if(eP(i))t=i.pattern;else if(i.include)return a._possibleFileEnding(i.include);if(t){let o=e.exec(t);if(o)return o[1]}}};var e8o="multi-cell-notebook-diff-editor",Ppe=class a extends yw{static{this.ID="workbench.input.multiDiffNotebookInput"}static create(i,e,t,o,n,r){let s=ha.getOrCreate(i,n,void 0,r),l=ha.getOrCreate(i,e,void 0,r);return i.createInstance(a,t,o,s,l,r)}},NZ=class extends xu{constructor(e,t,o,n,r,s,l){super(e,void 0,void 0,!0,o,n,r,s,l);this.notebookDiffViewModel=t;this._register(s.registerResolver(this))}static createInput(e,t){let o=A.parse(`${e8o}:${new Date().getMilliseconds().toString()+Math.random().toString()}`);return t.createInstance(NZ,o,e)}canHandleUri(e){return e.toString()===this.multiDiffSource.toString()}async resolveDiffSource(e){return{resources:this.notebookDiffViewModel}}};NZ=I([m(2,Nt),m(3,Nn),m(4,F),m(5,Rz),m(6,Ho)],NZ);var dA=class extends C{constructor(e,t,o,n,r,s,l,c,u){super();this._editorResolverService=o;this._configurationService=n;this._accessibilityService=r;this._instantiationService=s;this._fileService=l;this._notebookEditorModelResolverService=c;this.uriIdentService=u;this._handled=!1;this._contributedEditors=new Map;this._contributedEditorDisposables=this._register(new P);this._memento=new Bl(dA.CUSTOM_EDITORS_STORAGE_ID,e);let p=this._memento.getMemento(0,1);this._editorResolverService.bufferChangeEvents(()=>{for(let h of p[dA.CUSTOM_EDITORS_ENTRY_ID]||[])this.add(new AZ(h),!1)}),this._register(t.onDidRegisterExtensions(()=>{this._handled||(this._clear(),p[dA.CUSTOM_EDITORS_ENTRY_ID]=[],this._memento.saveMemento())})),Tlo.setHandler(h=>this._setupHandler(h))}static{this.CUSTOM_EDITORS_STORAGE_ID="notebookEditors"}static{this.CUSTOM_EDITORS_ENTRY_ID="editors"}dispose(){this._clear(),super.dispose()}_setupHandler(e){this._handled=!0;let t=[...this._contributedEditors.values()].filter(r=>!r.extension);this._clear();let o=new Map;t.forEach(r=>{o.set(r.id,this.add(r))});for(let r of e)for(let s of r.value){if(!s.type){r.collector.error("Notebook does not specify type-property");continue}let l=this.get(s.type);if(l)if(!l.extension&&r.description.isBuiltin&&t.find(c=>c.id===s.type))o.get(s.type)?.dispose();else{r.collector.error(`Notebook type '${s.type}' already used`);continue}this.add(new AZ({extension:r.description.identifier,id:s.type,displayName:s.displayName,selectors:s.selector||[],priority:this._convertPriority(s.priority),providerDisplayName:r.description.displayName??r.description.identifier.value}))}let n=this._memento.getMemento(0,1);n[dA.CUSTOM_EDITORS_ENTRY_ID]=Array.from(this._contributedEditors.values()),this._memento.saveMemento()}clearEditorCache(){let e=this._memento.getMemento(0,1);e[dA.CUSTOM_EDITORS_ENTRY_ID]=[],this._memento.saveMemento()}_convertPriority(e){return e?e==="default"?"default":"option":"default"}_registerContributionPoint(e){let t=new P;for(let o of e.selectors){let n=o.include||o,r={id:e.id,label:e.displayName,detail:e.providerDisplayName,priority:e.priority},s={canHandleDiff:()=>!!this._configurationService.getValue(ft.textDiffEditorPreview)&&!this._accessibilityService.isScreenReaderOptimized(),canSupportResource:f=>f.scheme===Y.vscodeNotebookCellOutput?new URLSearchParams(f.query).get("openIn")==="notebook":f.scheme===Y.untitled||f.scheme===Y.vscodeNotebookCell||this._fileService.hasProvider(f)},l=async({resource:f,options:v})=>{let b;if(f.scheme===Y.vscodeNotebookCellOutput){let N=Zo.parseCellOutputUri(f);if(!N||!N.notebook||N.cellHandle===void 0)throw new Error("Invalid cell output uri");b={notebook:N.notebook,handle:N.cellHandle}}else b=Zo.parse(f);let S,y;b?(S=this.uriIdentService.asCanonicalUri(b.notebook),y={resource:f,options:v}):S=this.uriIdentService.asCanonicalUri(f),y||(y=v?.cellOptions);let w;if(f.scheme===Y.vscodeNotebookCellOutput){if(b?.handle===void 0||!b?.notebook)throw new Error("Invalid cell handle");y={resource:Zo.generate(b.notebook,b.handle),options:v};let O=await this._notebookEditorModelResolverService.resolve(S).then(U=>U.object.notebook.cells.findIndex(G=>G.handle===b?.handle)).then(U=>U>=0?U:0),V=[{start:O,end:O+1}];w={...v,cellOptions:y,viewState:void 0,cellSelections:V}}else w={...v,cellOptions:y,viewState:void 0};let k=y?.resource;return{editor:ha.getOrCreate(this._instantiationService,S,k,e.id),options:w}},c=async({resource:f,options:v})=>{let b=await this._notebookEditorModelResolverService.resolve({untitledResource:f},e.id);return H.once(b.object.notebook.onWillDispose)(()=>{b.dispose()}),{editor:ha.getOrCreate(this._instantiationService,b.object.resource,void 0,e.id),options:v}},u=(f,v)=>{let{modified:b,original:S,label:y,description:w}=f;return this._configurationService.getValue("notebook.experimental.enableNewDiffEditor")?{editor:Ppe.create(this._instantiationService,b.resource,y,w,S.resource,e.id)}:{editor:yw.create(this._instantiationService,b.resource,y,w,S.resource,e.id)}},h={createEditorInput:l,createDiffEditorInput:u,createUntitledEditorInput:c,createMergeEditorInput:f=>({editor:this._instantiationService.createInstance(hb,f.base.resource,{uri:f.input1.resource,title:f.input1.label??Ye(f.input1.resource),description:f.input1.description??"",detail:f.input1.detail},{uri:f.input2.resource,title:f.input2.label??Ye(f.input2.resource),description:f.input2.description??"",detail:f.input2.detail},f.result.resource)})},g={createEditorInput:l,createDiffEditorInput:u};t.add(this._configurationService.onDidChangeConfiguration(f=>{f.affectsConfiguration(ft.textDiffEditorPreview)&&(!!this._configurationService.getValue(ft.textDiffEditorPreview)&&!this._accessibilityService.isScreenReaderOptimized()?(h.createDiffEditorInput=u,g.createDiffEditorInput=u):(h.createDiffEditorInput=void 0,g.createDiffEditorInput=void 0))})),t.add(this._accessibilityService.onDidChangeScreenReaderOptimized(()=>{!!this._configurationService.getValue(ft.textDiffEditorPreview)&&!this._accessibilityService.isScreenReaderOptimized()?(h.createDiffEditorInput=u,g.createDiffEditorInput=u):(h.createDiffEditorInput=void 0,g.createDiffEditorInput=void 0)})),t.add(this._editorResolverService.registerEditor(n,r,s,h)),t.add(this._editorResolverService.registerEditor(`${Y.vscodeNotebookCell}:/**/${n}`,{...r,priority:"exclusive"},s,g))}return t}_clear(){this._contributedEditors.clear(),this._contributedEditorDisposables.clear()}get(e){return this._contributedEditors.get(e)}add(e,t=!0){if(this._contributedEditors.has(e.id))throw new Error(`notebook type '${e.id}' ALREADY EXISTS`);this._contributedEditors.set(e.id,e);let o;if(e.extension&&(o=this._registerContributionPoint(e),this._contributedEditorDisposables.add(o)),t){let n=this._memento.getMemento(0,1);n[dA.CUSTOM_EDITORS_ENTRY_ID]=Array.from(this._contributedEditors.values()),this._memento.saveMemento()}return this._register(Z(()=>{let n=this._memento.getMemento(0,1);n[dA.CUSTOM_EDITORS_ENTRY_ID]=Array.from(this._contributedEditors.values()),this._memento.saveMemento(),o?.dispose(),this._contributedEditors.delete(e.id)}))}getContributedNotebook(e){let t=[];for(let o of this._contributedEditors.values())o.matches(e)&&t.push(o);return t.length===0&&e.scheme===Y.untitled?Array.from(this._contributedEditors.values()):t}[Symbol.iterator](){return this._contributedEditors.values()}};dA=I([m(0,le),m(1,lt),m(2,ul),m(3,B),m(4,Bi),m(5,F),m(6,be),m(7,mh),m(8,dt)],dA);var ZJe=class{constructor(i){this.contributedRenderers=new Map;this.preferredMimetype=new co(()=>this.preferredMimetypeMemento.getMemento(1,1));this.preferredMimetypeMemento=new Bl("workbench.editor.notebook.preferredRenderer2",i)}clear(){this.contributedRenderers.clear()}get(i){return this.contributedRenderers.get(i)}getAll(){return Array.from(this.contributedRenderers.values())}add(i){this.contributedRenderers.has(i.id)||this.contributedRenderers.set(i.id,i)}setPreferred(i,e,t){let o=this.preferredMimetype.value,n=o[i.id];n?n[e]=t:o[i.id]={[e]:t},this.preferredMimetypeMemento.saveMemento()}findBestRenderers(i,e,t){let o;(g=>(g[g.PreviouslySelected=256]="PreviouslySelected",g[g.SameExtensionAsNotebook=512]="SameExtensionAsNotebook",g[g.OtherRenderer=768]="OtherRenderer",g[g.BuiltIn=1024]="BuiltIn"))(o||={});let n=i&&this.preferredMimetype.value[i.id]?.[e],r=i?.extension?.value,s=i?.id,l=Array.from(this.contributedRenderers.values()).map(c=>{let u=t===void 0?c.matchesWithoutKernel(e):c.matches(e,t);if(u===3)return;let p=c.extensionId.value,h=n===c.id?256:p===r||S9i.get(p)?.has(s)?512:c.isBuiltin?1024:768;return{ordered:{mimeType:e,rendererId:c.id,isTrusted:!0},score:h|u}}).filter(mo);return l.length===0?[{mimeType:e,rendererId:az,isTrusted:!0}]:l.sort((c,u)=>c.score-u.score).map(c=>c.ordered)}};ZJe=I([m(0,le)],ZJe);var Gyi=class{constructor(i,e){this.model=i;this._modelEventListeners=new P;this._modelEventListeners.add(i.onWillDispose(()=>e(i)))}get uri(){return this.model.uri}getCellIndex(i){return this.model.cells.findIndex(e=>Xe(e.uri,i))}dispose(){this._modelEventListeners.dispose()}},OZ=class extends C{constructor(e,t,o,n,r,s){super();this._extensionService=e;this._configurationService=t;this._accessibilityService=o;this._instantiationService=n;this._storageService=r;this._notebookDocumentService=s;this._notebookProviders=new Map,this._notebookProviderInfoStore=void 0,this._notebookRenderersInfoStore=this._instantiationService.createInstance(ZJe),this._onDidChangeOutputRenderers=this._register(new E),this.onDidChangeOutputRenderers=this._onDidChangeOutputRenderers.event,this._notebookStaticPreloadInfoStore=new Set,this._models=new vt,this._onWillAddNotebookDocument=this._register(new E),this._onDidAddNotebookDocument=this._register(new E),this._onWillRemoveNotebookDocument=this._register(new E),this._onDidRemoveNotebookDocument=this._register(new E),this.onWillAddNotebookDocument=this._onWillAddNotebookDocument.event,this.onDidAddNotebookDocument=this._onDidAddNotebookDocument.event,this.onDidRemoveNotebookDocument=this._onDidRemoveNotebookDocument.event,this.onWillRemoveNotebookDocument=this._onWillRemoveNotebookDocument.event,this._onAddViewType=this._register(new E),this.onAddViewType=this._onAddViewType.event,this._onWillRemoveViewType=this._register(new E),this.onWillRemoveViewType=this._onWillRemoveViewType.event,this._onDidChangeEditorTypes=this._register(new E),this.onDidChangeEditorTypes=this._onDidChangeEditorTypes.event,this._lastClipboardIsCopy=!0,_lo.setHandler(c=>{this._notebookRenderersInfoStore.clear();for(let u of c)for(let p of u.value){if(!p.entrypoint){u.collector.error("Notebook renderer does not specify entry point");continue}let h=p.id;if(!h){u.collector.error("Notebook renderer does not specify id-property");continue}this._notebookRenderersInfoStore.add(new BWt({id:h,extension:u.description,entrypoint:p.entrypoint,displayName:p.displayName,mimeTypes:p.mimeTypes||[],dependencies:p.dependencies,optionalDependencies:p.optionalDependencies,requiresMessaging:p.requiresMessaging}))}this._onDidChangeOutputRenderers.fire()}),Dlo.setHandler(c=>{this._notebookStaticPreloadInfoStore.clear();for(let u of c)if(Ea(u.description,"contribNotebookStaticPreloads"))for(let p of u.value){if(!p.entrypoint){u.collector.error("Notebook preload does not specify entry point");continue}let h=p.type;if(!h){u.collector.error("Notebook preload does not specify type-property");continue}this._notebookStaticPreloadInfoStore.add(new HWt({type:h,extension:u.description,entrypoint:p.entrypoint,localResourceRoots:p.localResourceRoots??[]}))}});let l=()=>{this._displayOrder=new ukt(this._configurationService.getValue(ft.displayOrder)||[],this._accessibilityService.isScreenReaderOptimized()?b9i:jci)};l(),this._register(this._configurationService.onDidChangeConfiguration(c=>{c.affectsConfiguration(ft.displayOrder)&&l()})),this._register(this._accessibilityService.onDidChangeScreenReaderOptimized(()=>{l()})),this._memento=new Bl(OZ._storageNotebookViewTypeProvider,this._storageService),this._viewTypeCache=this._memento.getMemento(1,1)}static{this._storageNotebookViewTypeProvider="notebook.viewTypeProvider"}get notebookProviderInfoStore(){return this._notebookProviderInfoStore||(this._notebookProviderInfoStore=this._register(this._instantiationService.createInstance(dA))),this._notebookProviderInfoStore}getEditorTypes(){return[...this.notebookProviderInfoStore].map(e=>({id:e.id,displayName:e.displayName,providerDisplayName:e.providerDisplayName}))}clearEditorCache(){this.notebookProviderInfoStore.clearEditorCache()}_postDocumentOpenActivation(e){this._extensionService.activateByEvent(`onNotebook:${e}`),this._extensionService.activateByEvent("onNotebook:*")}async canResolve(e){return this._notebookProviders.has(e)?!0:(await this._extensionService.whenInstalledExtensionsRegistered(),await this._extensionService.activateByEvent(`onNotebookSerializer:${e}`),this._notebookProviders.has(e))}registerContributedNotebookType(e,t){let o=new AZ({extension:t.extension,id:e,displayName:t.displayName,providerDisplayName:t.providerDisplayName,priority:t.priority||"default",selectors:[]});o.update({selectors:t.filenamePattern});let n=this.notebookProviderInfoStore.add(o);return this._onDidChangeEditorTypes.fire(),Z(()=>{n.dispose(),this._onDidChangeEditorTypes.fire()})}_registerProviderData(e,t){if(this._notebookProviders.has(e))throw new Error(`notebook provider for viewtype '${e}' already exists`);return this._notebookProviders.set(e,t),this._onAddViewType.fire(e),Z(()=>{this._onWillRemoveViewType.fire(e),this._notebookProviders.delete(e)})}registerNotebookSerializer(e,t,o){return this.notebookProviderInfoStore.get(e)?.update({options:o.options}),this._viewTypeCache[e]=t.id.value,this._persistMementos(),this._registerProviderData(e,new YL(e,o,t))}async withNotebookDataProvider(e){let t=this.notebookProviderInfoStore.get(e);if(!t){let n=this.getViewTypeProvider(e),r=n?[pi({id:"workbench.notebook.action.installMissingViewType",label:d(12096,null,e),run:async()=>{await this._instantiationService.createInstance(sA,n).run()}})]:[];throw dU(`UNKNOWN notebook type '${e}'`,r)}await this.canResolve(t.id);let o=this._notebookProviders.get(t.id);if(!o)throw new Error(`NO provider registered for view type: '${t.id}'`);return o}tryGetDataProviderSync(e){let t=this.notebookProviderInfoStore.get(e);if(t)return this._notebookProviders.get(t.id)}_persistMementos(){this._memento.saveMemento()}getViewTypeProvider(e){return this._viewTypeCache[e]}getRendererInfo(e){return this._notebookRenderersInfoStore.get(e)}updateMimePreferredRenderer(e,t,o,n){let r=this.notebookProviderInfoStore.get(e);r&&this._notebookRenderersInfoStore.setPreferred(r,t,o),this._displayOrder.prioritize(t,n)}saveMimeDisplayOrder(e){this._configurationService.updateValue(ft.displayOrder,this._displayOrder.toArray(),e)}getRenderers(){return this._notebookRenderersInfoStore.getAll()}*getStaticPreloads(e){for(let t of this._notebookStaticPreloadInfoStore)t.type===e&&(yield t)}async createNotebookTextModel(e,t,o){if(this._models.has(t))throw new Error(`notebook for ${t} already exists`);let n=await this.withNotebookDataProvider(e);if(!(n instanceof YL))throw new Error("CANNOT open file notebook with this provider");let r=o?await Kv(o):Je.fromByteArray([]),s=await n.serializer.dataToNotebook(r),l=this._instantiationService.createInstance(PZ,n.viewType,t,s.cells,s.metadata,n.serializer.options),c=new Gyi(l,this._onWillDisposeDocument.bind(this));return this._models.set(t,c),this._notebookDocumentService.addNotebookDocument(c),this._onWillAddNotebookDocument.fire(l),this._onDidAddNotebookDocument.fire(l),this._postDocumentOpenActivation(n.viewType),l}async createNotebookTextDocumentSnapshot(e,t,o){let n=this.getNotebookTextModel(e);if(!n)throw new Error(`notebook for ${e} doesn't exist`);let r=await this.withNotebookDataProvider(n.viewType);if(!(r instanceof YL))throw new Error("CANNOT open file notebook with this provider");let s=r.serializer,l=this._configurationService.getValue(ft.outputBackupSizeLimit)*1024,c=n.createSnapshot({context:t,outputSizeLimit:l,transientOptions:s.options}),u=n.metadata.indentAmount;typeof u=="string"&&u&&(c.metadata.indentAmount=u);let p=await s.notebookToData(c);if(o.isCancellationRequested)throw new ho;return WT(p)}async restoreNotebookTextModelFromSnapshot(e,t,o){let n=this.getNotebookTextModel(e);if(!n)throw new Error(`notebook for ${e} doesn't exist`);let r=await this.withNotebookDataProvider(n.viewType);if(!(r instanceof YL))throw new Error("CANNOT open file notebook with this provider");let s=r.serializer,l=await Kv(o),c=await r.serializer.dataToNotebook(l);return n.restoreSnapshot(c,s.options),n}getNotebookTextModel(e){return this._models.get(e)?.model}getNotebookTextModels(){return ht.map(this._models.values(),e=>e.model)}listNotebookDocuments(){return[...this._models].map(e=>e[1].model)}_onWillDisposeDocument(e){let t=this._models.get(e.uri);t&&(this._onWillRemoveNotebookDocument.fire(t.model),this._models.delete(e.uri),this._notebookDocumentService.removeNotebookDocument(t),t.dispose(),this._onDidRemoveNotebookDocument.fire(t.model))}getOutputMimeTypeInfo(e,t,o){let n=this._displayOrder.sort(new Set(o.outputs.map(s=>s.mime))),r=this.notebookProviderInfoStore.get(e.viewType);return n.flatMap(s=>this._notebookRenderersInfoStore.findBestRenderers(r,s,t)).sort((s,l)=>(s.rendererId===az?1:0)-(l.rendererId===az?1:0))}getContributedNotebookTypes(e){return e?this.notebookProviderInfoStore.getContributedNotebook(e):[...this.notebookProviderInfoStore]}hasSupportedNotebooks(e){if(this._models.has(e))return!0;let t=this.notebookProviderInfoStore.getContributedNotebook(e);return t.length?t.some(o=>o.matches(e)&&(o.priority==="default"||o.priority==="exclusive")):!1}getContributedNotebookType(e){return this.notebookProviderInfoStore.get(e)}getNotebookProviderResourceRoots(){let e=[];return this._notebookProviders.forEach(t=>{t.extensionData.location&&e.push(A.revive(t.extensionData.location))}),e}setToCopy(e,t){this._cutItems=e,this._lastClipboardIsCopy=t}getToCopy(){if(this._cutItems)return{items:this._cutItems,isCopy:this._lastClipboardIsCopy}}};OZ=I([m(0,lt),m(1,B),m(2,Bi),m(3,F),m(4,le),m(5,Ij)],OZ);var UWt=(c=>(c[c.Base=0]="Base",c[c.Sash=35]="Sash",c[c.SuggestWidget=40]="SuggestWidget",c[c.Hover=50]="Hover",c[c.DragImage=1e3]="DragImage",c[c.MenubarMenuItemsHolder=2e3]="MenubarMenuItemsHolder",c[c.ContextView=2500]="ContextView",c[c.ModalDialog=2600]="ModalDialog",c[c.PaneDropOverlay=1e4]="PaneDropOverlay",c))(UWt||{}),t8o=Object.keys(UWt).filter(a=>!isNaN(Number(a))).map(a=>Number(a)).sort((a,i)=>i-a);function i8o(a){for(let i of t8o)if(a>=i)return i;return-1}var $yi=class{constructor(){this.styleSheet=hr(),this.zIndexMap=new Map,this.scheduler=new Dt(()=>this.updateStyleElement(),200)}registerZIndex(i,e,t){if(this.zIndexMap.get(t))throw new Error(`z-index with name ${t} has already been registered.`);let o=i+e;if(i8o(o)!==i)throw new Error(`Relative layer: ${i} + z-index: ${e} exceeds next layer ${o}.`);return this.zIndexMap.set(t,o),this.scheduler.schedule(),this.getVarName(t)}getVarName(i){return`--z-index-${i}`}updateStyleElement(){Rt(this.styleSheet);let i="";this.zIndexMap.forEach((e,t)=>{i+=`${this.getVarName(t)}: ${e};
`}),Vh(":root",i,this.styleSheet)}},o8o=new $yi;function Sk(a,i,e){return o8o.registerZIndex(a,i,e)}var qyi=Re("debug-console-view-icon",M.debugConsole,d(8982,null)),jyi=Re("run-view-icon",M.debugAlt,d(9002,null)),Llo=Re("variables-view-icon",M.debugAlt,d(9003,null)),Rlo=Re("watch-view-icon",M.debugAlt,d(9009,null)),Mlo=Re("callstack-view-icon",M.debugAlt,d(8956,null)),zWt=Re("breakpoints-view-icon",M.debugAlt,d(8955,null)),Plo=Re("loaded-scripts-view-icon",M.debugAlt,d(9001,null)),zF={regular:Re("debug-breakpoint",M.debugBreakpoint,d(8958,null)),disabled:Re("debug-breakpoint-disabled",M.debugBreakpointDisabled,d(8965,null)),unverified:Re("debug-breakpoint-unverified",M.debugBreakpointUnverified,d(8975,null)),pending:Re("debug-breakpoint-pending",M.debugBreakpointPending,d(8973,null))},Qyi={regular:Re("debug-breakpoint-function",M.debugBreakpointFunction,d(8966,null)),disabled:Re("debug-breakpoint-function-disabled",M.debugBreakpointFunctionDisabled,d(8967,null)),unverified:Re("debug-breakpoint-function-unverified",M.debugBreakpointFunctionUnverified,d(8968,null))},Yyi={regular:Re("debug-breakpoint-conditional",M.debugBreakpointConditional,d(8959,null)),disabled:Re("debug-breakpoint-conditional-disabled",M.debugBreakpointConditionalDisabled,d(8960,null)),unverified:Re("debug-breakpoint-conditional-unverified",M.debugBreakpointConditionalUnverified,d(8961,null))},Xyi={regular:Re("debug-breakpoint-data",M.debugBreakpointData,d(8962,null)),disabled:Re("debug-breakpoint-data-disabled",M.debugBreakpointDataDisabled,d(8963,null)),unverified:Re("debug-breakpoint-data-unverified",M.debugBreakpointDataUnverified,d(8964,null))},KWt={regular:Re("debug-breakpoint-log",M.debugBreakpointLog,d(8970,null)),disabled:Re("debug-breakpoint-log-disabled",M.debugBreakpointLogDisabled,d(8971,null)),unverified:Re("debug-breakpoint-log-unverified",M.debugBreakpointLogUnverified,d(8972,null))},eZe=Re("debug-hint",M.debugHint,d(8969,null)),GWt=Re("debug-breakpoint-unsupported",M.debugBreakpointUnsupported,d(8974,null)),$Wt=[zF,Qyi,Yyi,Xyi,KWt],Ape=Re("debug-stackframe",M.debugStackframe,d(8993,null)),Npe=Re("debug-stackframe-focused",M.debugStackframeFocused,d(8994,null)),Alo=Re("debug-gripper",M.gripper,d(8985,null)),tZe=Re("debug-restart-frame",M.debugRestartFrame,d(8990,null)),P4=Re("debug-stop",M.debugStop,d(9000,null)),KF=Re("debug-disconnect",M.debugDisconnect,d(8984,null)),Ope=Re("debug-restart",M.debugRestart,d(8989,null)),Fpe=Re("debug-step-over",M.debugStepOver,d(8999,null)),FZ=Re("debug-step-into",M.debugStepInto,d(8997,null)),WZ=Re("debug-step-out",M.debugStepOut,d(8998,null)),iZe=Re("debug-step-back",M.debugStepBack,d(8996,null)),Wpe=Re("debug-pause",M.debugPause,d(8987,null)),Vpe=Re("debug-continue",M.debugContinue,d(8983,null)),oZe=Re("debug-reverse-continue",M.debugReverseContinue,d(8991,null)),Nlo=Re("debug-run",M.run,d(8992,null)),qWt=Re("debug-start",M.debugStart,d(8995,null)),hRe=Re("debug-configure",M.gear,d(8977,null)),F1d=Re("debug-console",M.gear,d(8978,null)),Olo=Re("debug-remove-config",M.trash,d(8988,null)),W1d=Re("debug-collapse-all",M.collapseAll,d(8976,null)),Flo=Re("callstack-view-session",M.bug,d(8957,null)),Wlo=Re("debug-console-clear-all",M.clearAll,d(8979,null)),Vlo=Re("watch-expressions-remove-all",M.closeAll,d(9008,null)),Blo=Re("watch-expression-remove",M.removeClose,d(9004,null)),Hlo=Re("watch-expressions-add",M.add,d(9005,null)),Ulo=Re("watch-expressions-add-function-breakpoint",M.add,d(9007,null)),zlo=Re("watch-expressions-add-data-breakpoint",M.variableGroup,d(9006,null)),Klo=Re("breakpoints-remove-all",M.closeAll,d(8954,null)),Glo=Re("breakpoints-activate",M.activateBreakpoints,d(8953,null)),$lo=Re("debug-console-evaluation-input",M.arrowSmallRight,d(8980,null)),qlo=Re("debug-console-evaluation-prompt",M.chevronRight,d(8981,null)),jWt=Re("debug-inspect-memory",M.fileBinary,d(8986,null));var jlo=J("debugToolBar.background",{dark:"#333333",light:"#F3F3F3",hcDark:"#000000",hcLight:"#FFFFFF"},d(8877,null)),Qlo=J("debugToolBar.border",null,d(8878,null)),gRe=J("debugIcon.startForeground",{dark:"#89D185",light:"#388A34",hcDark:"#89D185",hcLight:"#388A34"},d(8871,null));function Ylo(){let a=J("debugTokenExpression.name",{dark:"#c586c0",light:"#9b46b0",hcDark:ko,hcLight:ko},"Foreground color for the token names shown in the debug views (ie. the Variables or Watch view)."),i=J("debugTokenExpression.type",{dark:"#4A90E2",light:"#4A90E2",hcDark:ko,hcLight:ko},"Foreground color for the token types shown in the debug views (ie. the Variables or Watch view)."),e=J("debugTokenExpression.value",{dark:"#cccccc99",light:"#6c6c6ccc",hcDark:ko,hcLight:ko},"Foreground color for the token values shown in the debug views (ie. the Variables or Watch view)."),t=J("debugTokenExpression.string",{dark:"#ce9178",light:"#a31515",hcDark:"#f48771",hcLight:"#a31515"},"Foreground color for strings in the debug views (ie. the Variables or Watch view)."),o=J("debugTokenExpression.boolean",{dark:"#4e94ce",light:"#0000ff",hcDark:"#75bdfe",hcLight:"#0000ff"},"Foreground color for booleans in the debug views (ie. the Variables or Watch view)."),n=J("debugTokenExpression.number",{dark:"#b5cea8",light:"#098658",hcDark:"#89d185",hcLight:"#098658"},"Foreground color for numbers in the debug views (ie. the Variables or Watch view)."),r=J("debugTokenExpression.error",{dark:"#f48771",light:"#e51400",hcDark:"#f48771",hcLight:"#e51400"},"Foreground color for expression errors in the debug views (ie. the Variables or Watch view) and for error logs shown in the debug console."),s=J("debugView.exceptionLabelForeground",{dark:ko,light:"#FFF",hcDark:ko,hcLight:ko},"Foreground color for a label shown in the CALL STACK view when the debugger breaks on an exception."),l=J("debugView.exceptionLabelBackground",{dark:"#6C2022",light:"#A31515",hcDark:"#6C2022",hcLight:"#A31515"},"Background color for a label shown in the CALL STACK view when the debugger breaks on an exception."),c=J("debugView.stateLabelForeground",ko,"Foreground color for a label in the CALL STACK view showing the current session's or thread's state."),u=J("debugView.stateLabelBackground","#88888844","Background color for a label in the CALL STACK view showing the current session's or thread's state."),p=J("debugView.valueChangedHighlight","#569CD6","Color used to highlight value changes in the debug views (ie. in the Variables view)."),h=J("debugConsole.infoForeground",{dark:fm,light:fm,hcDark:ko,hcLight:ko},"Foreground color for info messages in debug REPL console."),g=J("debugConsole.warningForeground",{dark:Bh,light:Bh,hcDark:"#008000",hcLight:Bh},"Foreground color for warning messages in debug REPL console."),f=J("debugConsole.errorForeground",Rse,"Foreground color for error messages in debug REPL console."),v=J("debugConsole.sourceForeground",ko,"Foreground color for source filenames in debug REPL console."),b=J("debugConsoleInputIcon.foreground",ko,"Foreground color for debug console input marker icon."),S=J("debugIcon.pauseForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(8869,null)),y=J("debugIcon.stopForeground",{dark:"#F48771",light:"#A1260D",hcDark:"#F48771",hcLight:"#A1260D"},d(8876,null)),w=J("debugIcon.disconnectForeground",{dark:"#F48771",light:"#A1260D",hcDark:"#F48771",hcLight:"#A1260D"},d(8868,null)),k=J("debugIcon.restartForeground",{dark:"#89D185",light:"#388A34",hcDark:"#89D185",hcLight:"#388A34"},d(8870,null)),T=J("debugIcon.stepOverForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(8875,null)),N=J("debugIcon.stepIntoForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(8873,null)),O=J("debugIcon.stepOutForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(8874,null)),V=J("debugIcon.continueForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(8867,null)),U=J("debugIcon.stepBackForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(8872,null));is((G,$)=>{let te=G.getColor(rv),pe=G.getColor(Yw),de=G.getColor(hgt),se=G.getColor(s),Se=G.getColor(l),ke=G.getColor(c),Ee=G.getColor(u),He=G.getColor(p),Ve=G.getColor(Mse);$.addRule(`
/* Text colour of the call stack row's filename */
.debug-pane .debug-call-stack .monaco-list-row:not(.selected) .stack-frame > .file .file-name {
color: ${de}
}
/* Line & column number "badge" for selected call stack row */
.debug-pane .monaco-list-row.selected .line-number {
background-color: ${te};
color: ${pe};
}
/* Line & column number "badge" for unselected call stack row (basically all other rows) */
.debug-pane .line-number {
background-color: ${te.transparent(.6)};
color: ${pe.transparent(.6)};
}
/* State "badge" displaying the active session's current state.
* Only visible when there are more active debug sessions/threads running.
*/
.debug-pane .debug-call-stack .thread > .state.label,
.debug-pane .debug-call-stack .session > .state.label {
background-color: ${Ee};
color: ${ke};
}
/* State "badge" displaying the active session's current state.
* Only visible when there are more active debug sessions/threads running
* and thread paused due to a thrown exception.
*/
.debug-pane .debug-call-stack .thread > .state.label.exception,
.debug-pane .debug-call-stack .session > .state.label.exception {
background-color: ${Se};
color: ${se};
}
/* Info "badge" shown when the debugger pauses due to a thrown exception. */
.debug-pane .call-stack-state-message > .label.exception {
background-color: ${Se};
color: ${se};
}
/* Animation of changed values in Debug viewlet */
@keyframes debugViewletValueChanged {
0% { background-color: ${He.transparent(0)} }
5% { background-color: ${He.transparent(.9)} }
100% { background-color: ${He.transparent(.3)} }
}
.debug-pane .monaco-list-row .expression .value.changed {
background-color: ${He.transparent(.3)};
animation-name: debugViewletValueChanged;
animation-duration: 1s;
animation-fill-mode: forwards;
}
.monaco-list-row .expression .lazy-button:hover {
background-color: ${Ve}
}
`);let Fe=G.getColor(gi);Fe&&$.addRule(`
.debug-pane .line-number {
border: 1px solid ${Fe};
}
`),Ug(G.type)&&$.addRule(`
.debug-pane .line-number {
background-color: ${te};
color: ${pe};
}`);let Qt=G.getColor(a),Ze=G.getColor(i),Ti=G.getColor(e),ti=G.getColor(t),bo=G.getColor(o),Ro=G.getColor(r),_o=G.getColor(n);$.addRule(`
.monaco-workbench .monaco-list-row .expression .name {
color: ${Qt};
}
.monaco-workbench .monaco-list-row .expression .type {
color: ${Ze};
}
.monaco-workbench .monaco-list-row .expression .value,
.monaco-workbench .debug-hover-widget .value {
color: ${Ti};
}
.monaco-workbench .monaco-list-row .expression .value.string,
.monaco-workbench .debug-hover-widget .value.string {
color: ${ti};
}
.monaco-workbench .monaco-list-row .expression .value.boolean,
.monaco-workbench .debug-hover-widget .value.boolean {
color: ${bo};
}
.monaco-workbench .monaco-list-row .expression .error,
.monaco-workbench .debug-hover-widget .error,
.monaco-workbench .debug-pane .debug-variables .scope .error {
color: ${Ro};
}
.monaco-workbench .monaco-list-row .expression .value.number,
.monaco-workbench .debug-hover-widget .value.number {
color: ${_o};
}
`);let sr=G.getColor(Vy)||Oe.fromHex("#80808060"),ln=G.getColor(h),en=G.getColor(g),Ws=G.getColor(f),ba=G.getColor(v),Id=G.getColor(b);$.addRule(`
.repl .repl-input-wrapper {
border-top: 1px solid ${sr};
}
.monaco-workbench .repl .repl-tree .output .expression .value.info {
color: ${ln};
}
.monaco-workbench .repl .repl-tree .output .expression .value.warn {
color: ${en};
}
.monaco-workbench .repl .repl-tree .output .expression .value.error {
color: ${Ws};
}
.monaco-workbench .repl .repl-tree .output .expression .source {
color: ${ba};
}
.monaco-workbench .repl .repl-tree .monaco-tl-contents .arrow {
color: ${Id};
}
`),G.defines(b)||$.addRule(`
.monaco-workbench.vs .repl .repl-tree .monaco-tl-contents .arrow {
opacity: 0.25;
}
.monaco-workbench.vs-dark .repl .repl-tree .monaco-tl-contents .arrow {
opacity: 0.4;
}
.monaco-workbench.hc-black .repl .repl-tree .monaco-tl-contents .arrow,
.monaco-workbench.hc-light .repl .repl-tree .monaco-tl-contents .arrow {
opacity: 1;
}
`);let Dg=G.getColor(gRe);Dg&&$.addRule(`.monaco-workbench ${q.asCSSSelector(qWt)} { color: ${Dg}; }`);let yd=G.getColor(S);yd&&$.addRule(`.monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(Wpe)}, .monaco-workbench ${q.asCSSSelector(Wpe)} { color: ${yd}; }`);let uu=G.getColor(y);uu&&$.addRule(`.monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(P4)},.monaco-workbench ${q.asCSSSelector(P4)} { color: ${uu}; }`);let Jm=G.getColor(w);Jm&&$.addRule(`.monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(KF)},.monaco-workbench .debug-view-content ${q.asCSSSelector(KF)}, .monaco-workbench .debug-toolbar ${q.asCSSSelector(KF)}, .monaco-workbench .command-center-center ${q.asCSSSelector(KF)} { color: ${Jm}; }`);let Dh=G.getColor(k);Dh&&$.addRule(`.monaco-workbench ${q.asCSSSelector(Ope)}, .monaco-workbench ${q.asCSSSelector(tZe)}, .monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(Ope)}, .monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(tZe)} { color: ${Dh}; }`);let Rp=G.getColor(T);Rp&&$.addRule(`.monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(Fpe)}, .monaco-workbench ${q.asCSSSelector(Fpe)} { color: ${Rp}; }`);let Uv=G.getColor(N);Uv&&$.addRule(`.monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(FZ)}, .monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(FZ)}, .monaco-workbench ${q.asCSSSelector(FZ)} { color: ${Uv}; }`);let Cr=G.getColor(O);Cr&&$.addRule(`.monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(WZ)}, .monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(WZ)}, .monaco-workbench ${q.asCSSSelector(WZ)} { color: ${Cr}; }`);let sx=G.getColor(V);sx&&$.addRule(`.monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(Vpe)}, .monaco-workbench ${q.asCSSSelector(Vpe)}, .monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(oZe)}, .monaco-workbench ${q.asCSSSelector(oZe)} { color: ${sx}; }`);let Lg=G.getColor(U);Lg&&$.addRule(`.monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(iZe)}, .monaco-workbench ${q.asCSSSelector(iZe)} { color: ${Lg}; }`)})}var nZe=class a{static{this.INSTANCE=new a}constructor(){this.editorContributions=[]}registerEditorContribution(i,e){this.editorContributions.push({id:i,ctor:e})}getEditorContributions(){return this.editorContributions.slice(0)}};function tm(a,i){nZe.INSTANCE.registerEditorContribution(a,i)}var A4;(e=>{function a(){return nZe.INSTANCE.getEditorContributions()}e.getEditorContributions=a;function i(t){return nZe.INSTANCE.getEditorContributions().filter(o=>t.indexOf(o.id)>=0)}e.getSomeEditorContributions=i})(A4||={});var Jyi=class{constructor(){this._frameId=0;this._domFrameLog()}_domFrameLog(){}debug(...i){let e=new Date;console.log(`${e.getSeconds()}:${e.getMilliseconds().toString().padStart(3,"0")}`,`frame #${this._frameId}: `,...i)}},n8o=new Jyi;function Xlo(...a){n8o.debug(...a)}var rZe=class{constructor(i,e){this.source=i;this.value=e;this.type=1}},QWt=class{constructor(i){this.source=i;this.type=2}},YWt=class{constructor(i,e){this.source=i;this.cell=e;this.type=3}};var dp=class extends C{constructor(){super();this.cellDisposables=this._register(new P)}prepareRenderCell(e){}renderCell(e){this.currentCell=e,WR(()=>this.didRenderCell(e))}didRenderCell(e){}unrenderCell(e){this.currentCell=void 0,this.cellDisposables.clear()}prepareLayout(){}updateInternalLayoutNow(e){}updateState(e,t){}updateForExecutionState(e,t){}},sZe=class extends C{constructor(){super();this.cellDisposables=this._register(new P)}prepareRenderCell(e){}renderCell(e){this.currentCell=e,this.didRenderCell(e)}didRenderCell(e){}unrenderCell(e){this.currentCell=void 0,this.cellDisposables.clear()}updateInternalLayoutNow(e){}updateState(e,t){}updateForExecutionState(e,t){}};function WR(a){try{return a()}catch(i){return mt(i),null}}var aZe=class a extends C{constructor(e,t,o){super();this.targetWindow=e;this.contentParts=t;this.overlayParts=o;this._scheduledOverlayRendering=this._register(new me);this._scheduledOverlayUpdateState=this._register(new me);this._scheduledOverlayUpdateExecutionState=this._register(new me)}concatContentPart(e,t){return new a(t,this.contentParts.concat(e),this.overlayParts)}concatOverlayPart(e,t){return new a(t,this.contentParts,this.overlayParts.concat(e))}scheduleRenderCell(e){for(let t of this.contentParts)WR(()=>t.prepareRenderCell(e));for(let t of this.overlayParts)WR(()=>t.prepareRenderCell(e));for(let t of this.contentParts)WR(()=>t.renderCell(e));this._scheduledOverlayRendering.value=T6(this.targetWindow,()=>{for(let t of this.overlayParts)WR(()=>t.renderCell(e))})}unrenderCell(e){for(let t of this.contentParts)WR(()=>t.unrenderCell(e));this._scheduledOverlayRendering.value=void 0,this._scheduledOverlayUpdateState.value=void 0,this._scheduledOverlayUpdateExecutionState.value=void 0;for(let t of this.overlayParts)WR(()=>t.unrenderCell(e))}updateInternalLayoutNow(e){for(let t of this.contentParts)WR(()=>t.updateInternalLayoutNow(e));for(let t of this.overlayParts)WR(()=>t.updateInternalLayoutNow(e))}prepareLayout(){for(let e of this.contentParts)WR(()=>e.prepareLayout())}updateState(e,t){for(let o of this.contentParts)WR(()=>o.updateState(e,t));this._scheduledOverlayUpdateState.value=T6(this.targetWindow,()=>{for(let o of this.overlayParts)WR(()=>o.updateState(e,t))})}updateForExecutionState(e,t){for(let o of this.contentParts)WR(()=>o.updateForExecutionState(e,t));this._scheduledOverlayUpdateExecutionState.value=T6(this.targetWindow,()=>{for(let o of this.overlayParts)WR(()=>o.updateForExecutionState(e,t))})}};var r8o=0,VZ=class extends C{constructor(e,t,o){super();this.cellViewModel=e;this._outputRawData=t;this._notebookService=o;this._onDidResetRendererEmitter=this._register(new E);this.onDidResetRenderer=this._onDidResetRendererEmitter.event;this.alwaysShow=!1;this.visible=Le("outputVisible",!1);this.outputHandle=r8o++}setVisible(e=!0,t=!1){!e&&this.alwaysShow||(t&&e&&(this.alwaysShow=!0),this.visible.set(e,void 0))}get model(){return this._outputRawData}get pickedMimeType(){return this._pickedMimeType}set pickedMimeType(e){this._pickedMimeType=e}hasMultiMimeType(){if(this._outputRawData.outputs.length<2)return!1;let e=this._outputRawData.outputs[0].mime;return this._outputRawData.outputs.some(t=>t.mime!==e)}resolveMimeTypes(e,t){let o=this._notebookService.getOutputMimeTypeInfo(e,t,this.model),n=o.findIndex(r=>r.rendererId!==az&&r.isTrusted);return[o,Math.max(n,0)]}resetRenderer(){this._pickedMimeType=void 0,this.model.bumpVersion(),this._onDidResetRendererEmitter.fire()}toRawJSON(){return{outputs:this._outputRawData.outputs}}};var fRe=class extends C{constructor(e,t,o,n,r,s,l,c,u){super();this.viewType=e;this.model=t;this.id=o;this._viewContext=n;this._configurationService=r;this._modelService=s;this._undoRedoService=l;this._codeEditorService=c;this._inlineChatSessionService=u;this._onDidChangeEditorAttachState=this._register(new E);this.onDidChangeEditorAttachState=this._onDidChangeEditorAttachState.event;this._onDidChangeState=this._register(new E);this.onDidChangeState=this._onDidChangeState.event;this._editState=0;this._lineNumbers="inherit";this._focusMode=0;this._editorListeners=[];this._editorViewStates=null;this._editorTransientState=null;this._resolvedCellDecorations=new Map;this._textModelRefChangeDisposable=this._register(new me);this._cellDecorationsChanged=this._register(new E);this.onCellDecorationsChanged=this._cellDecorationsChanged.event;this._resolvedDecorations=new Map;this._lastDecorationId=0;this._cellStatusBarItems=new Map;this._onDidChangeCellStatusBarItems=this._register(new E);this.onDidChangeCellStatusBarItems=this._onDidChangeCellStatusBarItems.event;this._lastStatusBarId=0;this._dragging=!1;this._inputCollapsed=!1;this._outputCollapsed=!1;this._commentHeight=0;this._isDisposed=!1;this._isReadonly=!1;this._editStateSource="";this._register(t.onDidChangeMetadata(()=>{this._onDidChangeState.fire({metadataChanged:!0})})),this._register(t.onDidChangeInternalMetadata(p=>{this._onDidChangeState.fire({internalMetadataChanged:!0}),p.lastRunSuccessChanged&&this.layoutChange({})})),this._register(this._configurationService.onDidChangeConfiguration(p=>{p.affectsConfiguration("notebook.lineNumbers")&&(this.lineNumbers="inherit")})),this.model.collapseState?.inputCollapsed&&(this._inputCollapsed=!0),this.model.collapseState?.outputCollapsed&&(this._outputCollapsed=!0),this._commentOptions=this._configurationService.getValue("editor.comments",{overrideIdentifier:this.language}),this._register(this._configurationService.onDidChangeConfiguration(p=>{p.affectsConfiguration("editor.comments")&&(this._commentOptions=this._configurationService.getValue("editor.comments",{overrideIdentifier:this.language}))}))}get handle(){return this.model.handle}get uri(){return this.model.uri}get lineCount(){return this.model.textBuffer.getLineCount()}get metadata(){return this.model.metadata}get internalMetadata(){return this.model.internalMetadata}get language(){return this.model.language}get mime(){return typeof this.model.mime=="string"?this.model.mime:this.language==="markdown"?Zn.markdown:Zn.text}get lineNumbers(){return this._lineNumbers}set lineNumbers(e){e!==this._lineNumbers&&(this._lineNumbers=e,this._onDidChangeState.fire({cellLineNumberChanged:!0}))}get commentOptions(){return this._commentOptions}set commentOptions(e){this._commentOptions=e}get focusMode(){return this._focusMode}set focusMode(e){this._focusMode!==e&&(this._focusMode=e,this._onDidChangeState.fire({focusModeChanged:!0}))}get editorAttached(){return!!this._textEditor}get textModel(){return this.model.textModel}hasModel(){return!!this.textModel}get dragging(){return this._dragging}set dragging(e){this._dragging=e,this._onDidChangeState.fire({dragStateChanged:!0})}get isInputCollapsed(){return this._inputCollapsed}set isInputCollapsed(e){this._inputCollapsed=e,this._onDidChangeState.fire({inputCollapsedChanged:!0})}get isOutputCollapsed(){return this._outputCollapsed}set isOutputCollapsed(e){this._outputCollapsed=e,this._onDidChangeState.fire({outputCollapsedChanged:!0})}set commentHeight(e){this._commentHeight!==e&&(this._commentHeight=e,this.layoutChange({commentHeight:!0},"BaseCellViewModel#commentHeight"))}updateOptions(e){this._textEditor&&typeof e.readonly=="boolean"&&this._textEditor.updateOptions({readOnly:e.readonly}),typeof e.readonly=="boolean"&&(this._isReadonly=e.readonly)}assertTextModelAttached(){return!!(this.textModel&&this._textEditor&&this._textEditor.getModel()===this.textModel)}attachTextEditor(e,t){if(!e.hasModel())throw new Error("Invalid editor: model is missing");if(this._textEditor===e){this._editorListeners.length===0&&(this._editorListeners.push(this._textEditor.onDidChangeCursorSelection(()=>{this._onDidChangeState.fire({selectionChanged:!0})})),this._onDidChangeState.fire({selectionChanged:!0}));return}this._textEditor=e,this._isReadonly&&e.updateOptions({readOnly:this._isReadonly}),this._editorViewStates?this._restoreViewState(this._editorViewStates):t&&this._restoreViewState({contributionsState:{},cursorState:[],viewState:{scrollLeft:0,firstPosition:{lineNumber:1,column:1},firstPositionDeltaTop:this._viewContext.notebookOptions.getLayoutConfiguration().editorTopPadding}}),this._editorTransientState&&iA(e.getModel(),this._editorTransientState,this._codeEditorService),!this._isDisposed&&(e.changeDecorations(o=>{this._resolvedDecorations.forEach((n,r)=>{if(r.startsWith("_lazy_")){let s=o.addDecoration(n.options.range,n.options.options);this._resolvedDecorations.get(r).id=s}else{let s=o.addDecoration(n.options.range,n.options.options);this._resolvedDecorations.get(r).id=s}})}),this._editorListeners.push(e.onDidChangeCursorSelection(()=>{this._onDidChangeState.fire({selectionChanged:!0})})),this._editorListeners.push(this._inlineChatSessionService.onWillStartSession(o=>{o===this._textEditor&&this.textBuffer.getLength()===0&&this.enableAutoLanguageDetection()})),this._onDidChangeState.fire({selectionChanged:!0}),this._onDidChangeEditorAttachState.fire())}detachTextEditor(){this.saveViewState(),this.saveTransientState(),this._textEditor?.changeDecorations(e=>{this._resolvedDecorations.forEach(t=>{let o=t.id;o&&e.removeDecoration(o)})}),this._textEditor=void 0,Ue(this._editorListeners),this._editorListeners=[],this._onDidChangeEditorAttachState.fire(),this._textModelRef&&(this._textModelRef.dispose(),this._textModelRef=void 0),this._textModelRefChangeDisposable.clear()}getText(){return this.model.getValue()}getAlternativeId(){return this.model.alternativeId}getTextLength(){return this.model.getTextLength()}enableAutoLanguageDetection(){this.model.enableAutoLanguageDetection()}saveViewState(){this._textEditor&&(this._editorViewStates=this._textEditor.saveViewState())}saveTransientState(){!this._textEditor||!this._textEditor.hasModel()||(this._editorTransientState=SZ(this._textEditor.getModel(),this._codeEditorService))}saveEditorViewState(){return this._textEditor&&(this._editorViewStates=this._textEditor.saveViewState()),this._editorViewStates}restoreEditorViewState(e,t){this._editorViewStates=e}_restoreViewState(e){e&&this._textEditor?.restoreViewState(e)}addModelDecoration(e){if(!this._textEditor){let o=++this._lastDecorationId,n=`_lazy_${this.id};${o}`;return this._resolvedDecorations.set(n,{options:e}),n}let t;return this._textEditor.changeDecorations(o=>{t=o.addDecoration(e.range,e.options),this._resolvedDecorations.set(t,{id:t,options:e})}),t}removeModelDecoration(e){let t=this._resolvedDecorations.get(e);this._textEditor&&t&&t.id!==void 0&&this._textEditor.changeDecorations(o=>{o.removeDecoration(t.id)}),this._resolvedDecorations.delete(e)}deltaModelDecorations(e,t){return e.forEach(n=>{this.removeModelDecoration(n)}),t.map(n=>this.addModelDecoration(n))}_removeCellDecoration(e){let t=this._resolvedCellDecorations.get(e);if(this._resolvedCellDecorations.delete(e),t){for(let o of this._resolvedCellDecorations.values())t.className===o.className&&(t.className=void 0),t.outputClassName===o.outputClassName&&(t.outputClassName=void 0),t.gutterClassName===o.gutterClassName&&(t.gutterClassName=void 0),t.topClassName===o.topClassName&&(t.topClassName=void 0);this._cellDecorationsChanged.fire({added:[],removed:[t]})}}_addCellDecoration(e){let t=++this._lastDecorationId,o=`_cell_${this.id};${t}`;return this._resolvedCellDecorations.set(o,e),this._cellDecorationsChanged.fire({added:[e],removed:[]}),o}getCellDecorations(){return[...this._resolvedCellDecorations.values()]}getCellDecorationRange(e){return this._textEditor?this._textEditor.getModel()?.getDecorationRange(e)??null:null}deltaCellDecorations(e,t){return e.forEach(n=>{this._removeCellDecoration(n)}),t.map(n=>this._addCellDecoration(n))}deltaCellStatusBarItems(e,t){e.forEach(n=>{this._cellStatusBarItems.get(n)&&this._cellStatusBarItems.delete(n)});let o=t.map(n=>{let r=++this._lastStatusBarId,s=`_cell_${this.id};${r}`;return this._cellStatusBarItems.set(s,n),s});return this._onDidChangeCellStatusBarItems.fire(),o}getCellStatusBarItems(){return Array.from(this._cellStatusBarItems.values())}revealRangeInCenter(e){this._textEditor?.revealRangeInCenter(e,1)}setSelection(e){this._textEditor?.setSelection(e)}setSelections(e){e.length&&(this._textEditor?this._textEditor?.setSelections(e):this._editorViewStates&&(this._editorViewStates.cursorState=e.map(t=>({inSelectionMode:!t.isEmpty(),selectionStart:t.getStartPosition(),position:t.getEndPosition()}))))}getSelections(){return this._textEditor?.getSelections()??this._editorViewStates?.cursorState.map(e=>new Yt(e.selectionStart.lineNumber,e.selectionStart.column,e.position.lineNumber,e.position.column))??[]}getSelectionsStartPosition(){return this._textEditor?this._textEditor.getSelections()?.map(t=>t.getStartPosition()):this._editorViewStates?.cursorState?.map(t=>t.selectionStart)}getLineScrollTopOffset(e){if(!this._textEditor)return 0;let t=this._viewContext.notebookOptions.computeEditorPadding(this.internalMetadata,this.uri);return this._textEditor.getTopForLineNumber(e)+t.top}getPositionScrollTopOffset(e){if(!this._textEditor)return 0;let t=e instanceof Yt?e.getPosition():e.getStartPosition(),o=this._viewContext.notebookOptions.computeEditorPadding(this.internalMetadata,this.uri);return this._textEditor.getTopForPosition(t.lineNumber,t.column)+o.top}cursorAtLineBoundary(){if(!this._textEditor||!this.textModel||!this._textEditor.hasTextFocus())return 0;let e=this._textEditor.getSelection();if(!e||!e.isEmpty())return 0;let t=this.textModel.getLineLength(e.startLineNumber);if(t===0)return 3;switch(e.startColumn){case 1:return 1;case t+1:return 2;default:return 0}}cursorAtBoundary(){if(!this._textEditor)return 0;if(!this.textModel)return 0;let e=this._textEditor.getSelection();if(!e||!e.isEmpty())return 0;let t=this._textEditor.getTopForPosition(1,1),o=this._textEditor.getTopForPosition(this.textModel.getLineCount(),this.textModel.getLineLength(this.textModel.getLineCount())),n=this._textEditor.getTopForPosition(e.startLineNumber,e.startColumn);return n===o?n===t?3:2:n===t?1:0}get editStateSource(){return this._editStateSource}updateEditState(e,t){e!==this._editState&&(this._editStateSource=t,this._editState=e,this._onDidChangeState.fire({editStateChanged:!0}),this._editState===0&&(this.focusMode=0))}getEditState(){return this._editState}get textBuffer(){return this.model.textBuffer}async resolveTextModel(){if(!this._textModelRef||!this.textModel){if(this._textModelRef=await this._modelService.createModelReference(this.uri),this._isDisposed)return this.textModel;if(!this._textModelRef)throw new Error(`Cannot resolve text model for ${this.uri}`);this._textModelRefChangeDisposable.value=this.textModel.onDidChangeContent(()=>this.onDidChangeTextModelContent())}return this.textModel}cellStartFind(e,t){let o=[],n=this.textBuffer.getLineCount(),r=t.findScope?.selectedTextRanges??[new z(1,1,n,this.textBuffer.getLineLength(n)+1)];if(this.assertTextModelAttached())o=this.textModel.findMatches(e,r,t.regex||!1,t.caseSensitive||!1,t.wholeWord&&t.wordSeparators||null,t.regex||!1);else{let l=new Oy(e,t.regex||!1,t.caseSensitive||!1,t.wholeWord&&t.wordSeparators||null).parseSearchRequest();if(!l)return null;r.forEach(c=>{o.push(...this.textBuffer.findMatchesLineByLine(new z(c.startLineNumber,c.startColumn,c.endLineNumber,c.endColumn),l,t.regex||!1,1e3))})}return o}dispose(){this._isDisposed=!0,super.dispose(),Ue(this._editorListeners),this._undoRedoService.getUriComparisonKey(this.uri)===this.uri.toString()&&this._undoRedoService.removeElements(this.uri),this._textModelRef?.dispose()}toJSON(){return{handle:this.handle}}};var Ik=ae("IInlineChatSessionService");var vRe=500,Qm=class extends fRe{constructor(e,t,o,n,r,s,l,c,u,p){super(e,t,_t(),n,r,l,c,u,p);this.viewContext=n;this._notebookService=s;this.cellKind=2;this._onLayoutInfoRead=this._register(new E);this.onLayoutInfoRead=this._onLayoutInfoRead.event;this._onDidStartExecution=this._register(new E);this.onDidStartExecution=this._onDidStartExecution.event;this._onDidStopExecution=this._register(new E);this.onDidStopExecution=this._onDidStopExecution.event;this._onDidChangeOutputs=this._register(new E);this.onDidChangeOutputs=this._onDidChangeOutputs.event;this._onDidRemoveOutputs=this._register(new E);this.onDidRemoveOutputs=this._onDidRemoveOutputs.event;this._outputCollection=[];this._outputsTop=null;this._pauseableEmitter=this._register(new Pm);this.onDidChangeLayout=this._pauseableEmitter.event;this._editorHeight=0;this._chatHeight=0;this._hoveringOutput=!1;this._focusOnOutput=!1;this._focusInputInOutput=!1;this._outputMinHeight=0;this.executionErrorDiagnostic=Le("excecutionError",void 0);this._hasFindResult=this._register(new E);this.hasFindResult=this._hasFindResult.event;this._outputViewModels=this.model.outputs.map(g=>new VZ(this,g,this._notebookService)),this._register(this.model.onDidChangeOutputs(g=>{let f=[],v=!1;for(let b=g.start;b<g.start+g.deleteCount;b++)this._outputCollection[b]!==void 0&&this._outputCollection[b]!==0&&(v=!0);this._outputCollection.splice(g.start,g.deleteCount,...g.newOutputs.map(()=>0)),f.push(...this._outputViewModels.splice(g.start,g.deleteCount,...g.newOutputs.map(b=>new VZ(this,b,this._notebookService)))),this._outputsTop=null,this._onDidChangeOutputs.fire(g),this._onDidRemoveOutputs.fire(f),v&&this.layoutChange({outputHeight:!0},"CodeCellViewModel#model.onDidChangeOutputs"),this._outputCollection.length||this.executionErrorDiagnostic.set(void 0,void 0),Ue(f)})),this._outputCollection=new Array(this.model.outputs.length);let h=this.viewContext.notebookOptions.getLayoutConfiguration();this._layoutInfo={fontInfo:o?.fontInfo||null,editorHeight:0,editorWidth:o?this.viewContext.notebookOptions.computeCodeCellEditorWidth(o.width):0,chatHeight:0,statusBarHeight:0,commentOffset:0,commentHeight:0,outputContainerOffset:0,outputTotalHeight:0,outputShowMoreContainerHeight:0,outputShowMoreContainerOffset:0,totalHeight:this.computeTotalHeight(17,0,0,0),codeIndicatorHeight:0,outputIndicatorHeight:0,bottomToolbarOffset:0,layoutState:0,estimatedHasHorizontalScrolling:!1,outlineWidth:1,topMargin:h.cellTopMargin,bottomMargin:h.cellBottomMargin}}set editorHeight(e){this._editorHeight!==e&&(this._editorHeight=e,this.layoutChange({editorHeight:!0},"CodeCellViewModel#editorHeight"))}get editorHeight(){throw new Error("editorHeight is write-only")}set chatHeight(e){this._chatHeight!==e&&(this._chatHeight=e,this.layoutChange({chatHeight:!0},"CodeCellViewModel#chatHeight"))}get chatHeight(){return this._chatHeight}get outputIsHovered(){return this._hoveringOutput}set outputIsHovered(e){this._hoveringOutput=e,this._onDidChangeState.fire({outputIsHoveredChanged:!0})}get outputIsFocused(){return this._focusOnOutput}set outputIsFocused(e){this._focusOnOutput=e,this._onDidChangeState.fire({outputIsFocusedChanged:!0})}get inputInOutputIsFocused(){return this._focusInputInOutput}set inputInOutputIsFocused(e){this._focusInputInOutput=e}get outputMinHeight(){return this._outputMinHeight}set outputMinHeight(e){this._outputMinHeight=e}get layoutInfo(){return this._layoutInfo}get outputsViewModels(){return this._outputViewModels}updateExecutionState(e){e.changed?(this.executionErrorDiagnostic.set(void 0,void 0),this._onDidStartExecution.fire(e)):this._onDidStopExecution.fire(e)}updateOptions(e){super.updateOptions(e),(e.cellStatusBarVisibility||e.insertToolbarPosition||e.cellToolbarLocation)&&this.layoutChange({})}pauseLayout(){this._pauseableEmitter.pause()}resumeLayout(){this._pauseableEmitter.resume()}layoutChange(e,t){this._ensureOutputsTop();let o=this.viewContext.notebookOptions.getLayoutConfiguration(),n=this.viewContext.notebookOptions.computeBottomToolbarDimensions(this.viewType),r=e.outputShowMoreContainerHeight?e.outputShowMoreContainerHeight:this._layoutInfo.outputShowMoreContainerHeight,s=Math.max(this._outputMinHeight,this.isOutputCollapsed?o.collapsedIndicatorHeight:this._outputsTop.getTotalSum()),l=e.commentHeight?this._commentHeight:this._layoutInfo.commentHeight,c=this.layoutInfo;if(this.isInputCollapsed){let u=o.collapsedIndicatorHeight,p=s+r,h=e.chatHeight?this._chatHeight:this._layoutInfo.chatHeight,g=o.cellTopMargin+o.collapsedIndicatorHeight,f=o.cellTopMargin+o.collapsedIndicatorHeight+o.cellBottomMargin+n.bottomToolbarGap+h+l+s+r,v=f-n.bottomToolbarGap-n.bottomToolbarHeight/2-r,b=this.viewContext.notebookOptions.computeBottomToolbarOffset(f,this.viewType),S=e.outerWidth!==void 0?this.viewContext.notebookOptions.computeCodeCellEditorWidth(e.outerWidth):this._layoutInfo?.editorWidth;this._layoutInfo={fontInfo:e.font??this._layoutInfo.fontInfo??null,editorHeight:this._layoutInfo.editorHeight,editorWidth:S,chatHeight:h,statusBarHeight:0,outputContainerOffset:g,outputTotalHeight:s,outputShowMoreContainerHeight:r,outputShowMoreContainerOffset:v,commentOffset:g+s,commentHeight:l,totalHeight:f,codeIndicatorHeight:u,outputIndicatorHeight:p,bottomToolbarOffset:b,layoutState:this._layoutInfo.layoutState,estimatedHasHorizontalScrolling:!1,outlineWidth:1,topMargin:o.cellTopMargin,bottomMargin:o.cellBottomMargin}}else{let u,p,h,g=!1,f=e.chatHeight?this._chatHeight:this._layoutInfo.chatHeight;if(!e.editorHeight&&this._layoutInfo.layoutState===2&&!e.outputHeight){let N=this.estimateEditorHeight(e.font?.lineHeight??this._layoutInfo.fontInfo?.lineHeight);p=N.editorHeight,g=N.hasHorizontalScrolling,h=this._layoutInfo.totalHeight,u=2}else if(e.editorHeight||this._layoutInfo.layoutState===3)p=this._editorHeight,h=this.computeTotalHeight(this._editorHeight,s,r,f),u=3,g=this._layoutInfo.estimatedHasHorizontalScrolling;else{let N=this.estimateEditorHeight(e.font?.lineHeight??this._layoutInfo.fontInfo?.lineHeight);p=N.editorHeight,g=N.hasHorizontalScrolling,h=this.computeTotalHeight(p,s,r,f),u=1}let v=this.viewContext.notebookOptions.computeEditorStatusbarHeight(this.internalMetadata,this.uri),b=p+v,S=s+r,y=o.editorToolbarHeight+o.cellTopMargin+f+p+v,w=h-n.bottomToolbarGap-n.bottomToolbarHeight/2-r,k=this.viewContext.notebookOptions.computeBottomToolbarOffset(h,this.viewType),T=e.outerWidth!==void 0?this.viewContext.notebookOptions.computeCodeCellEditorWidth(e.outerWidth):this._layoutInfo?.editorWidth;this._layoutInfo={fontInfo:e.font??this._layoutInfo.fontInfo??null,chatHeight:f,editorHeight:p,editorWidth:T,statusBarHeight:v,outputContainerOffset:y,outputTotalHeight:s,outputShowMoreContainerHeight:r,outputShowMoreContainerOffset:w,commentOffset:y+s,commentHeight:l,totalHeight:h,codeIndicatorHeight:b,outputIndicatorHeight:S,bottomToolbarOffset:k,layoutState:u,estimatedHasHorizontalScrolling:g,topMargin:o.cellTopMargin,bottomMargin:o.cellBottomMargin,outlineWidth:1}}this._fireOnDidChangeLayout({...e,totalHeight:this.layoutInfo.totalHeight!==c.totalHeight,source:t})}_fireOnDidChangeLayout(e){this._pauseableEmitter.fire(e)}restoreEditorViewState(e,t){super.restoreEditorViewState(e),t!==void 0&&this._layoutInfo.layoutState!==3&&(this._layoutInfo={...this._layoutInfo,totalHeight:t,layoutState:2})}getDynamicHeight(){return this._onLayoutInfoRead.fire(),this._layoutInfo.totalHeight}getHeight(e){if(this._layoutInfo.layoutState===0){let t=this.estimateEditorHeight(e);return this.computeTotalHeight(t.editorHeight,0,0,0)}else return this._layoutInfo.totalHeight}estimateEditorHeight(e=20){let t=!1,o=this.viewContext.getBaseCellEditorOptions(this.language);if(this.layoutInfo.fontInfo&&o.value.wordWrap==="off"){for(let l=0;l<this.lineCount;l++)if(this.textBuffer.getLineLastNonWhitespaceColumn(l+1)*(this.layoutInfo.fontInfo.typicalHalfwidthCharacterWidth+this.layoutInfo.fontInfo.letterSpacing)>this.layoutInfo.editorWidth){t=!0;break}}let n=t?12:0,r=this.viewContext.notebookOptions.computeEditorPadding(this.internalMetadata,this.uri);return{editorHeight:this.lineCount*e+r.top+r.bottom+n,hasHorizontalScrolling:t}}computeTotalHeight(e,t,o,n){let r=this.viewContext.notebookOptions.getLayoutConfiguration(),{bottomToolbarGap:s}=this.viewContext.notebookOptions.computeBottomToolbarDimensions(this.viewType);return r.editorToolbarHeight+r.cellTopMargin+n+e+this.viewContext.notebookOptions.computeEditorStatusbarHeight(this.internalMetadata,this.uri)+this._commentHeight+t+o+s+r.cellBottomMargin}onDidChangeTextModelContent(){this.getEditState()!==1&&(this.updateEditState(1,"onDidChangeTextModelContent"),this._onDidChangeState.fire({contentChanged:!0}))}onDeselect(){this.updateEditState(0,"onDeselect")}updateOutputShowMoreContainerHeight(e){this.layoutChange({outputShowMoreContainerHeight:e},"CodeCellViewModel#updateOutputShowMoreContainerHeight")}updateOutputMinHeight(e){this.outputMinHeight=e}unlockOutputHeight(){this.outputMinHeight=0,this.layoutChange({outputHeight:!0})}updateOutputHeight(e,t,o){if(e>=this._outputCollection.length)throw new Error("Output index out of range!");this._ensureOutputsTop();try{e===0||t>0?this._outputViewModels[e].setVisible(!0):t===0&&this._outputViewModels[e].setVisible(!1)}catch(n){let r=`Failed to update output height for cell ${this.handle}, output ${e}. this.outputCollection.length: ${this._outputCollection.length}, this._outputViewModels.length: ${this._outputViewModels.length}`;throw new Error(`${r}.
Error: ${n.message}`)}this._outputViewModels[e].visible.get()&&t<28&&(t=28),this._outputCollection[e]=t,this._outputsTop.setValue(e,t)&&this.layoutChange({outputHeight:!0},o)}getOutputOffsetInContainer(e){if(this._ensureOutputsTop(),e>=this._outputCollection.length)throw new Error("Output index out of range!");return this._outputsTop.getPrefixSum(e-1)}getOutputOffset(e){return this.layoutInfo.outputContainerOffset+this.getOutputOffsetInContainer(e)}spliceOutputHeights(e,t,o){if(this._ensureOutputsTop(),this._outputsTop.removeValues(e,t),o.length){let n=new Uint32Array(o.length);for(let r=0;r<o.length;r++)n[r]=o[r];this._outputsTop.insertValues(e,n)}this.layoutChange({outputHeight:!0},"CodeCellViewModel#spliceOutputs")}_ensureOutputsTop(){if(!this._outputsTop){let e=new Uint32Array(this._outputCollection.length);for(let t=0;t<this._outputCollection.length;t++)e[t]=this._outputCollection[t];this._outputsTop=new KT(e)}}startFind(e,t){let o=super.cellStartFind(e,t);return o===null?null:{cell:this,contentMatches:o}}dispose(){super.dispose(),this._outputCollection=[],this._outputsTop=null,Ue(this._outputViewModels)}};Qm=I([m(4,B),m(5,un),m(6,Nt),m(7,Cl),m(8,Kt),m(9,Ik)],Qm);var kb=class extends fRe{constructor(e,t,o,n,r,s,l,c,u,p){super(e,t,_t(),r,s,l,c,u,p);this.foldingDelegate=n;this.viewContext=r;this.cellKind=1;this._previewHeight=0;this._chatHeight=0;this._editorHeight=0;this._statusBarHeight=0;this._onDidChangeLayout=this._register(new E);this.onDidChangeLayout=this._onDidChangeLayout.event;this._hoveringOutput=!1;this._focusOnOutput=!1;this._hoveringCell=!1;this.outputsViewModels=[];this._hasFindResult=this._register(new E);this.hasFindResult=this._hasFindResult.event;let{bottomToolbarGap:h}=this.viewContext.notebookOptions.computeBottomToolbarDimensions(this.viewType),g=this.viewContext.notebookOptions.getLayoutConfiguration();this._layoutInfo={chatHeight:0,editorHeight:0,previewHeight:0,fontInfo:o?.fontInfo||null,editorWidth:o?.width?this.viewContext.notebookOptions.computeMarkdownCellEditorWidth(o.width):0,commentOffset:0,commentHeight:0,bottomToolbarOffset:h,totalHeight:100,layoutState:0,foldHintHeight:0,statusBarHeight:0,outlineWidth:1,bottomMargin:g.markdownCellBottomMargin,topMargin:g.markdownCellTopMargin},this._register(this.onDidChangeState(f=>{this.viewContext.eventDispatcher.emit([new YWt(f,this.model)]),f.foldingStateChanged&&this._updateTotalHeight(this._computeTotalHeight(),0)}))}get renderedHtml(){return this._renderedHtml}set renderedHtml(e){this._renderedHtml!==e&&(this._renderedHtml=e,this._onDidChangeState.fire({contentChanged:!0}))}get layoutInfo(){return this._layoutInfo}set renderedMarkdownHeight(e){this._previewHeight=e,this._updateTotalHeight(this._computeTotalHeight())}set chatHeight(e){this._chatHeight=e,this._updateTotalHeight(this._computeTotalHeight())}get chatHeight(){return this._chatHeight}set editorHeight(e){this._editorHeight=e,this._statusBarHeight=this.viewContext.notebookOptions.computeStatusBarHeight(),this._updateTotalHeight(this._computeTotalHeight())}get editorHeight(){throw new Error("MarkdownCellViewModel.editorHeight is write only")}get foldingState(){return this.foldingDelegate.getFoldingState(this.foldingDelegate.getCellIndex(this))}get outputIsHovered(){return this._hoveringOutput}set outputIsHovered(e){this._hoveringOutput=e}get outputIsFocused(){return this._focusOnOutput}set outputIsFocused(e){this._focusOnOutput=e}get inputInOutputIsFocused(){return!1}set inputInOutputIsFocused(e){}get cellIsHovered(){return this._hoveringCell}set cellIsHovered(e){this._hoveringCell=e,this._onDidChangeState.fire({cellIsHoveredChanged:!0})}_computeTotalHeight(){let e=this.viewContext.notebookOptions.getLayoutConfiguration(),{bottomToolbarGap:t}=this.viewContext.notebookOptions.computeBottomToolbarDimensions(this.viewType),o=this._computeFoldHintHeight();return this.getEditState()===1?this._editorHeight+e.markdownCellTopMargin+e.markdownCellBottomMargin+t+this._statusBarHeight+this._commentHeight:Math.max(1,this._previewHeight+t+o+this._commentHeight)}_computeFoldHintHeight(){return this.getEditState()===1||this.foldingState!==2?0:this.viewContext.notebookOptions.getLayoutConfiguration().markdownFoldHintHeight}updateOptions(e){super.updateOptions(e),(e.cellStatusBarVisibility||e.insertToolbarPosition||e.cellToolbarLocation)&&this._updateTotalHeight(this._computeTotalHeight())}getOutputOffset(e){return-1}updateOutputHeight(e,t){}triggerFoldingStateChange(){this._onDidChangeState.fire({foldingStateChanged:!0})}_updateTotalHeight(e,t){e!==this.layoutInfo.totalHeight&&this.layoutChange({totalHeight:e,context:t})}layoutChange(e){let t,o;this.isInputCollapsed?(t=this.viewContext.notebookOptions.computeCollapsedMarkdownCellHeight(this.viewType),e.totalHeight=t,o=0):(t=e.totalHeight===void 0?this._layoutInfo.layoutState===0?100:this._layoutInfo.totalHeight:e.totalHeight,o=this._computeFoldHintHeight());let n,r=this.viewContext.notebookOptions.getLayoutConfiguration();this.getEditState()===1?n=r.editorToolbarHeight+r.cellTopMargin+this._chatHeight+this._editorHeight+this._statusBarHeight:n=this._previewHeight,this._layoutInfo={fontInfo:e.font||this._layoutInfo.fontInfo,editorWidth:e.outerWidth!==void 0?this.viewContext.notebookOptions.computeMarkdownCellEditorWidth(e.outerWidth):this._layoutInfo.editorWidth,chatHeight:this._chatHeight,editorHeight:this._editorHeight,statusBarHeight:this._statusBarHeight,previewHeight:this._previewHeight,bottomToolbarOffset:this.viewContext.notebookOptions.computeBottomToolbarOffset(t,this.viewType),totalHeight:t,layoutState:3,foldHintHeight:o,commentOffset:n,commentHeight:e.commentHeight?this._commentHeight:this._layoutInfo.commentHeight,outlineWidth:1,bottomMargin:r.markdownCellBottomMargin,topMargin:r.markdownCellTopMargin},this._onDidChangeLayout.fire(e)}restoreEditorViewState(e,t){super.restoreEditorViewState(e),t!==void 0&&this.layoutInfo.layoutState===0&&(this._layoutInfo={...this.layoutInfo,totalHeight:t,chatHeight:this._chatHeight,editorHeight:this._editorHeight,statusBarHeight:this._statusBarHeight,layoutState:2},this.layoutChange({}))}getDynamicHeight(){return null}getHeight(e){return this._layoutInfo.layoutState===0?100:this._layoutInfo.totalHeight}onDidChangeTextModelContent(){this._onDidChangeState.fire({contentChanged:!0})}onDeselect(){}startFind(e,t){let o=super.cellStartFind(e,t);return o===null?null:{cell:this,contentMatches:o}}dispose(){super.dispose(),this.foldingDelegate=null}};kb=I([m(5,B),m(6,Nt),m(7,Cl),m(8,Kt),m(9,Ik)],kb);var Upe=class extends dp{constructor(e,t){super();this.instantiationService=t;this.cellContextKeyManager=this._register(this.instantiationService.createInstance(zpe,e,void 0))}didRenderCell(e){this.cellContextKeyManager.updateForElement(e)}};Upe=I([m(1,F)],Upe);var zpe=class extends C{constructor(e,t,o,n){super();this.notebookEditor=e;this.element=t;this._contextKeyService=o;this._notebookExecutionStateService=n;this.elementDisposables=this._register(new P);this._contextKeyService.bufferChangeEvents(()=>{this.cellType=hS.bindTo(this._contextKeyService),this.cellEditable=bw.bindTo(this._contextKeyService),this.cellFocused=Cpe.bindTo(this._contextKeyService),this.cellEditorFocused=AR.bindTo(this._contextKeyService),this.markdownEditMode=wZ.bindTo(this._contextKeyService),this.cellRunState=xpe.bindTo(this._contextKeyService),this.cellExecuting=vWt.bindTo(this._contextKeyService),this.cellHasOutputs=gk.bindTo(this._contextKeyService),this.cellContentCollapsed=JLe.bindTo(this._contextKeyService),this.cellOutputCollapsed=HJe.bindTo(this._contextKeyService),this.cellLineNumbers=BJe.bindTo(this._contextKeyService),this.cellResource=Hao.bindTo(this._contextKeyService),this.cellHasErrorDiagnostics=kpe.bindTo(this._contextKeyService),t&&this.updateForElement(t)}),this._register(this._notebookExecutionStateService.onDidChangeExecution(r=>{r.type===0&&this.element&&r.affectsCell(this.element.uri)&&this.updateForExecutionState()}))}updateForElement(e){this.elementDisposables.clear(),this.element=e,e&&(this.elementDisposables.add(e.onDidChangeState(t=>this.onDidChangeState(t))),e instanceof Qm&&(this.elementDisposables.add(e.onDidChangeOutputs(()=>this.updateForOutputs())),this.elementDisposables.add(he(t=>{this.cellHasErrorDiagnostics.set(!!t.readObservable(e.executionErrorDiagnostic))}))),this.elementDisposables.add(this.notebookEditor.onDidChangeActiveCell(()=>this.updateForFocusState())),this.element instanceof kb?this.cellType.set("markup"):this.element instanceof Qm&&this.cellType.set("code"),this._contextKeyService.bufferChangeEvents(()=>{this.updateForFocusState(),this.updateForExecutionState(),this.updateForEditState(),this.updateForCollapseState(),this.updateForOutputs(),this.cellLineNumbers.set(this.element.lineNumbers),this.cellResource.set(this.element.uri.toString())}))}onDidChangeState(e){this._contextKeyService.bufferChangeEvents(()=>{e.internalMetadataChanged&&this.updateForExecutionState(),e.editStateChanged&&this.updateForEditState(),e.focusModeChanged&&this.updateForFocusState(),e.cellLineNumberChanged&&this.cellLineNumbers.set(this.element.lineNumbers),(e.inputCollapsedChanged||e.outputCollapsedChanged)&&this.updateForCollapseState()})}updateForFocusState(){if(!this.element)return;let e=this.notebookEditor.getActiveCell();this.cellFocused.set(this.notebookEditor.getActiveCell()===this.element),e===this.element?this.cellEditorFocused.set(this.element.focusMode===1):this.cellEditorFocused.set(!1)}updateForExecutionState(){if(!this.element)return;let e=this.element.internalMetadata;this.cellEditable.set(!this.notebookEditor.isReadOnly);let t=this._notebookExecutionStateService.getCellExecution(this.element.uri);this.element instanceof kb?(this.cellRunState.reset(),this.cellExecuting.reset()):t?.state===3?(this.cellRunState.set("executing"),this.cellExecuting.set(!0)):t?.state===2||t?.state===1?(this.cellRunState.set("pending"),this.cellExecuting.set(!0)):e.lastRunSuccess===!0?(this.cellRunState.set("succeeded"),this.cellExecuting.set(!1)):e.lastRunSuccess===!1?(this.cellRunState.set("failed"),this.cellExecuting.set(!1)):(this.cellRunState.set("idle"),this.cellExecuting.set(!1))}updateForEditState(){this.element&&(this.element instanceof kb?this.markdownEditMode.set(this.element.getEditState()===1):this.markdownEditMode.set(!1))}updateForCollapseState(){this.element&&(this.cellContentCollapsed.set(!!this.element.isInputCollapsed),this.cellOutputCollapsed.set(!!this.element.isOutputCollapsed))}updateForOutputs(){this.element instanceof Qm?this.cellHasOutputs.set(this.element.outputsViewModels.length>0):this.cellHasOutputs.set(!1)}};zpe=I([m(2,X),m(3,rs)],zpe);var l8o=_,Zlo="cell-dragging",Zyi="global-drag-active",lZe=class extends dp{constructor(e){super();this.container=e}didRenderCell(e){this.update(e)}updateState(e,t){t.dragStateChanged&&this.update(e)}update(e){this.container.classList.toggle(Zlo,e.dragging)}},XWt=class extends C{constructor(e,t){super();this.notebookEditor=e;this.notebookListContainer=t;this.draggedCells=[];this.isScrolling=!1;this.listOnWillScrollListener=this._register(new me);this.listInsertionIndicator=R(t,l8o(".cell-list-insertion-indicator")),this._register(j(t.ownerDocument.body,re.DRAG_START,this.onGlobalDragStart.bind(this),!0)),this._register(j(t.ownerDocument.body,re.DRAG_END,this.onGlobalDragEnd.bind(this),!0));let o=(n,r,s=!1)=>{this._register(j(e.getDomNode(),n,l=>{let c=this.toCellDragEvent(l);c&&r(c)},s))};o(re.DRAG_OVER,n=>{this.currentDraggedCell&&(n.browserEvent.preventDefault(),this.onCellDragover(n))},!0),o(re.DROP,n=>{this.currentDraggedCell&&(n.browserEvent.preventDefault(),this.onCellDrop(n))}),o(re.DRAG_LEAVE,n=>{n.browserEvent.preventDefault(),this.onCellDragLeave(n)}),this.scrollingDelayer=this._register(new jo(200))}setList(e){this.list=e,this.listOnWillScrollListener.value=this.list.onWillScroll(t=>{t.scrollTopChanged&&(this.setInsertIndicatorVisibility(!1),this.isScrolling=!0,this.scrollingDelayer.trigger(()=>{this.isScrolling=!1}))})}setInsertIndicatorVisibility(e){this.listInsertionIndicator.style.opacity=e?"1":"0"}toCellDragEvent(e){let t=this.notebookListContainer.getBoundingClientRect().top,o=this.list.scrollTop+e.clientY-t,n=this.list.elementAt(o);if(!n)return;let r=this.list.getCellViewScrollTop(n),s=this.list.elementHeight(n),c=(o-r)/s;return{browserEvent:e,draggedOverCell:n,cellTop:r,cellHeight:s,dragPosRatio:c}}clearGlobalDragState(){this.notebookEditor.getDomNode().classList.remove(Zyi)}onGlobalDragStart(){this.notebookEditor.getDomNode().classList.add(Zyi)}onGlobalDragEnd(){this.notebookEditor.getDomNode().classList.remove(Zyi)}onCellDragover(e){if(!e.browserEvent.dataTransfer)return;if(!this.currentDraggedCell){e.browserEvent.dataTransfer.dropEffect="none";return}if(this.isScrolling||this.currentDraggedCell===e.draggedOverCell){this.setInsertIndicatorVisibility(!1);return}let t=this.getDropInsertDirection(e.dragPosRatio),o=t==="above"?e.cellTop:e.cellTop+e.cellHeight;this.updateInsertIndicator(t,o)}updateInsertIndicator(e,t){let{bottomToolbarGap:o}=this.notebookEditor.notebookOptions.computeBottomToolbarDimensions(this.notebookEditor.textModel?.viewType),n=t-this.list.scrollTop+o/2;n>=0?(this.listInsertionIndicator.style.top=`${n}px`,this.setInsertIndicatorVisibility(!0)):this.setInsertIndicatorVisibility(!1)}getDropInsertDirection(e){return e<.5?"above":"below"}onCellDrop(e){let t=this.currentDraggedCell;if(this.isScrolling||this.currentDraggedCell===e.draggedOverCell)return;this.dragCleanup();let o=this.getDropInsertDirection(e.dragPosRatio);this._dropImpl(t,o,e.browserEvent,e.draggedOverCell)}getCellRangeAroundDragTarget(e){let t=this.notebookEditor.getSelections(),n=wY(this.notebookEditor,t).find(r=>r.start<=e&&e<r.end);return n||{start:e,end:e+1}}_dropImpl(e,t,o,n){let r=this.list.getCellViewScrollTop(n),s=this.list.elementHeight(n),l=t==="above"?r:r+s,{bottomToolbarGap:c}=this.notebookEditor.notebookOptions.computeBottomToolbarDimensions(this.notebookEditor.textModel?.viewType),u=l-this.list.scrollTop+c/2,p=this.notebookEditor.getDomNode().getBoundingClientRect().height;if(u<0||u>p)return;let h=o.ctrlKey&&!it||o.altKey&⁢if(!this.notebookEditor.hasModel())return;let g=this.notebookEditor.textModel;if(h){let f=this.notebookEditor.getCellIndex(e),v=this.getCellRangeAroundDragTarget(f),b=this.notebookEditor.getCellIndex(n);if(t==="below"){let w=this.notebookEditor.getCellIndex(n);b=this.notebookEditor.getNextVisibleCellIndex(w)}let S,y;if(b<=v.start)S={start:b,end:b+v.end-v.start},y={start:b+f-v.start,end:b+f-v.start+1};else{let w=b-v.start;S={start:v.start+w,end:v.end+w},y={start:f+w,end:f+w+1}}g.applyEdits([{editType:1,index:b,count:0,cells:Lf([v]).map(w=>jK(this.notebookEditor.cellAt(w).model))}],!0,{kind:1,focus:this.notebookEditor.getFocus(),selections:this.notebookEditor.getSelections()},()=>({kind:1,focus:y,selections:[S]}),void 0,!0),this.notebookEditor.revealCellRangeInView(S)}else c8o(this.notebookEditor,e,t,n)}onCellDragLeave(e){(!e.browserEvent.relatedTarget||!gs(e.browserEvent.relatedTarget,this.notebookEditor.getDomNode()))&&this.setInsertIndicatorVisibility(!1)}dragCleanup(){this.currentDraggedCell&&(this.draggedCells.forEach(e=>e.dragging=!1),this.currentDraggedCell=void 0,this.draggedCells=[]),this.setInsertIndicatorVisibility(!1)}registerDragHandle(e,t,o,n){let r=e.container;for(let c of o)c.setAttribute("draggable","true");let s=()=>{!this.notebookEditor.notebookOptions.getDisplayOptions().dragAndDropEnabled||this.notebookEditor.isReadOnly||(r.classList.remove(Zlo),this.dragCleanup())};for(let c of o)e.templateDisposables.add(j(c,re.DRAG_END,s));let l=c=>{if(!c.dataTransfer||!this.notebookEditor.notebookOptions.getDisplayOptions().dragAndDropEnabled||this.notebookEditor.isReadOnly)return;this.currentDraggedCell=e.currentRenderedCell,this.draggedCells=this.notebookEditor.getSelections().map(p=>this.notebookEditor.getCellsInRange(p)).flat(),this.draggedCells.forEach(p=>p.dragging=!0);let u=n();t.parentElement.appendChild(u),c.dataTransfer.setDragImage(u,0,0),setTimeout(()=>u.remove(),0)};for(let c of o)e.templateDisposables.add(j(c,re.DRAG_START,l))}startExplicitDrag(e,t){!this.notebookEditor.notebookOptions.getDisplayOptions().dragAndDropEnabled||this.notebookEditor.isReadOnly||(this.currentDraggedCell=e,this.setInsertIndicatorVisibility(!0))}explicitDrag(e,t){if(!this.notebookEditor.notebookOptions.getDisplayOptions().dragAndDropEnabled||this.notebookEditor.isReadOnly)return;let o=this.list.elementAt(t);if(o&&o!==e){let u=this.list.getCellViewScrollTop(o),p=this.list.elementHeight(o),h=this.getExplicitDragDropDirection(t,u,p),g=h==="above"?u:u+p;this.updateInsertIndicator(h,g)}if(this.currentDraggedCell!==e)return;let n=this.notebookEditor.getDomNode().getBoundingClientRect(),r=t-this.list.scrollTop,s=.2,l=20,c=r/n.height;c<s?this.list.scrollTop-=l*(1-c/s):c>1-s&&(this.list.scrollTop+=l*(1-(1-c)/s))}endExplicitDrag(e){this.setInsertIndicatorVisibility(!1)}explicitDrop(e,t){this.currentDraggedCell=void 0,this.setInsertIndicatorVisibility(!1);let o=this.list.elementAt(t.dragOffsetY);if(!o||o===e)return;let n=this.list.getCellViewScrollTop(o),r=this.list.elementHeight(o),s=this.getExplicitDragDropDirection(t.dragOffsetY,n,r);this._dropImpl(e,s,t,o)}getExplicitDragDropDirection(e,t,o){let r=(e-t)/o;return this.getDropInsertDirection(r)}dispose(){this.notebookEditor=null,super.dispose()}};function c8o(a,i,e,t){let o=a.getCellIndex(i),n=a.getCellIndex(t);if(typeof o!="number"||typeof n!="number")return;e==="below"&&(n=a.getNextVisibleCellIndex(n)??n);let r=a.getSelections();r.length||(r=[a.getFocus()]);let s=a.getFocus().start;r.some(b=>b.start<=o&&b.end>o)||(r=[{start:o,end:o+1}],s=o);let l=r.find(b=>b.start<=n&&b.end>n);l&&(n=l.start);let c=0,u=n,p=n;r.sort((b,S)=>S.start-b.start);let h=r.map(b=>{let S=b.end-b.start,y=0;b.end<=p&&(y=-S);let w=p+y;if(s>=b.start&&s<=b.end){let N=s-b.start;u=w+N}let k=b.start>=n?c:0,T={editType:6,index:b.start+k,length:S,newIdx:w};return c+=S,b.end<p&&(p-=S),T}),g=h[h.length-1],f={start:g.newIdx,end:g.newIdx+c},v={start:u,end:u+1};a.textModel.applyEdits(h,!0,{kind:1,focus:a.getFocus(),selections:a.getSelections()},()=>({kind:1,focus:v,selections:[f]}),void 0,!0),a.revealCellRangeInView(f)}var JWt=class{constructor(i){this._items=[];this._whitespace=[];this._prefixSumComputer=new VSe([]);this._size=0;this._paddingTop=0;this._paddingTop=i??0,this._size=this._paddingTop}get paddingTop(){return this._paddingTop}set paddingTop(i){this._size=this._size+i-this._paddingTop,this._paddingTop=i}get count(){return this._items.length}get size(){return this._size}getWhitespaces(){return this._whitespace}restoreWhitespace(i){this._whitespace=i,this._size=this._paddingTop+this._items.reduce((e,t)=>e+t.size,0)+this._whitespace.reduce((e,t)=>e+t.size,0)}splice(i,e,t){let o=t??[];this._items.splice(i,e,...o),this._size=this._paddingTop+this._items.reduce((r,s)=>r+s.size,0)+this._whitespace.reduce((r,s)=>r+s.size,0),this._prefixSumComputer.removeValues(i,e);let n=[];for(let r=0;r<o.length;r++){let s=r+i,l=this._whitespace.filter(c=>c.afterPosition===s+1);l.length>0?n.push(o[r].size+l.reduce((c,u)=>c+u.size,0)):n.push(o[r].size)}this._prefixSumComputer.insertValues(i,n);for(let r=i;r<this._items.length;r++){let s=this._whitespace.filter(l=>l.afterPosition===r+1);s.length>0?this._prefixSumComputer.setValue(r,this._items[r].size+s.reduce((l,c)=>l+c.size,0)):this._prefixSumComputer.setValue(r,this._items[r].size)}}insertWhitespace(i,e,t){let o=0,n=this._whitespace.filter(r=>r.afterPosition===e);if(n.length>0&&(o=Math.max(...n.map(r=>r.priority))+1),this._whitespace.push({id:i,afterPosition:e,size:t,priority:o}),this._size+=t,this._whitespace.sort((r,s)=>r.afterPosition===s.afterPosition?r.priority-s.priority:r.afterPosition-s.afterPosition),e>0){let r=e-1,l=this._items[r].size+t;this._prefixSumComputer.setValue(r,l)}}changeOneWhitespace(i,e,t){let o=this._whitespace.findIndex(n=>n.id===i);if(o!==-1){let n=this._whitespace[o],r=n.afterPosition;n.afterPosition=e;let s=n.size,l=t-s;if(n.size=t,this._size+=l,r>0&&r<=this._items.length){let c=r-1,p=this._items[c].size;this._prefixSumComputer.setValue(c,p)}if(e>0&&e<=this._items.length){let c=e-1,p=this._items[c].size+t;this._prefixSumComputer.setValue(c,p)}}}removeWhitespace(i){let e=this._whitespace.findIndex(t=>t.id===i);if(e!==-1){let t=this._whitespace[e];if(this._whitespace.splice(e,1),this._size-=t.size,t.afterPosition>0){let o=t.afterPosition-1,n=this._items[o].size,r=this._whitespace.filter(l=>l.afterPosition===t.afterPosition),s=n+r.reduce((l,c)=>l+c.size,0);this._prefixSumComputer.setValue(o,s)}}}getWhitespacePosition(i){let e=this._whitespace.find(l=>l.id===i);if(!e)throw new Error("Whitespace not found");let t=e.afterPosition;if(t===0)return this._whitespace.filter(c=>c.afterPosition===t&&c.priority<e.priority).reduce((c,u)=>c+u.size,0)+this.paddingTop;let o=this._whitespace.filter(l=>l.afterPosition===0).reduce((l,c)=>l+c.size,0),n=t-1,r=this._prefixSumComputer.getPrefixSum(n),s=this._items[n].size;return r+s+o+this.paddingTop}indexAt(i){if(i<0)return-1;let e=this._whitespace.filter(o=>o.afterPosition===0).reduce((o,n)=>o+n.size,0),t=i-(this._paddingTop+e);return t<=0?0:t>=this._size-this._paddingTop-e?this.count:this._prefixSumComputer.getIndexOf(Math.trunc(t)).index}indexAfter(i){let e=this.indexAt(i);return Math.min(e+1,this._items.length)}positionAt(i){if(i<0||this.count===0||i>=this.count)return-1;let e=this._whitespace.filter(t=>t.afterPosition===0).reduce((t,o)=>t+o.size,0);return this._prefixSumComputer.getPrefixSum(i)+this._paddingTop+e}},ZWt=class extends Lye{constructor(){super(...arguments);this._lastWhitespaceId=0;this._renderingStack=0}get inRenderingTransaction(){return this._renderingStack>0}get notebookRangeMap(){return this.rangeMap}render(e,t,o,n,r,s){this._renderingStack++,super.render(e,t,o,n,r,s),this._renderingStack--}_rerender(e,t,o){this._renderingStack++,super._rerender(e,t,o),this._renderingStack--}createRangeMap(e){let t=this.rangeMap;if(t){let o=new JWt(e);return o.restoreWhitespace(t.getWhitespaces()),o}else return new JWt(e)}insertWhitespace(e,t){let o=this.scrollTop,n=`${++this._lastWhitespaceId}`,r=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),s=this.elementTop(e),l=o>s;this.notebookRangeMap.insertWhitespace(n,e,t);let c=l?o+t:o;return this.render(r,c,this.lastRenderHeight,void 0,void 0,!1),this._rerender(c,this.renderHeight,!1),this.eventuallyUpdateScrollDimensions(),n}changeOneWhitespace(e,t,o){let n=this.scrollTop,r=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight);this.notebookRangeMap.getWhitespacePosition(e)>n?(this.notebookRangeMap.changeOneWhitespace(e,t,o),this.render(r,n,this.lastRenderHeight,void 0,void 0,!1),this._rerender(n,this.renderHeight,!1),this.eventuallyUpdateScrollDimensions()):(this.notebookRangeMap.changeOneWhitespace(e,t,o),this.eventuallyUpdateScrollDimensions())}removeWhitespace(e){let t=this.scrollTop,o=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight);this.notebookRangeMap.removeWhitespace(e),this.render(o,t,this.lastRenderHeight,void 0,void 0,!1),this._rerender(t,this.renderHeight,!1),this.eventuallyUpdateScrollDimensions()}getWhitespacePosition(e){return this.notebookRangeMap.getWhitespacePosition(e)}};var eVt=class{constructor(i,e,t){this.notebookExecutionStateService=i;this.configurationService=e;this.scrollEvent=t;this.stopAnchoring=!1}shouldAnchor(i,e,t,o){if(i.element(e).focusMode===1)return!0;if(this.stopAnchoring)return!1;let n=i.elementTop(e)+i.elementHeight(e)+t,s=i.renderHeight+i.getScrollTop()>n,l=this.configurationService.getValue(ft.scrollToRevealCell)!=="none",c=t>0;return l&&c&&!s?(this.watchAchorDuringExecution(o),!0):!1}watchAchorDuringExecution(i){if(!this.executionWatcher&&i.cellKind===2){let e=this.notebookExecutionStateService.getCellExecution(i.uri);e&&e.state===3&&(this.executionWatcher=i.onDidStopExecution(()=>{this.executionWatcher?.dispose(),this.executionWatcher=void 0,this.scrollWatcher?.dispose(),this.stopAnchoring=!1}),this.scrollWatcher=this.scrollEvent(t=>{t.scrollTop<t.oldScrollTop&&(this.stopAnchoring=!0,this.scrollWatcher?.dispose())}))}}dispose(){this.executionWatcher?.dispose(),this.scrollWatcher?.dispose()}};var ewi=()=>{throw new Error("Invalid notebook view zone change accessor")},tVt=class extends C{constructor(e,t){super();this.listView=e;this.coordinator=t;this.domNode=or(document.createElement("div")),this.domNode.setClassName("view-zones"),this.domNode.setPosition("absolute"),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this.domNode.setWidth("100%"),this._zones={},this.listView.containerDomNode.appendChild(this.domNode.domNode)}changeViewZones(e){let t=!1,o={addZone:n=>(t=!0,this._addZone(n)),removeZone:n=>{t=!0,this._removeZone(n)},layoutZone:n=>{t=!0,this._layoutZone(n)}};return d8o(e,o),o.addZone=ewi,o.removeZone=ewi,o.layoutZone=ewi,t}getViewZoneLayoutInfo(e){let t=this._zones[e];if(!t)return null;let o=this.listView.getWhitespacePosition(t.whitespaceId);return{height:t.zone.heightInPx,top:o}}onCellsChanged(e){e.splices.slice().reverse().forEach(o=>{let[n,r,s]=o,l=n,c=n+r;for(let u in this._zones){let p=this._zones[u].zone,h=p.afterModelPosition-1;if(h>=l&&h<c)p.afterModelPosition=l,this._updateWhitespace(this._zones[u]);else if(h>=c){let f=s.length-r;p.afterModelPosition+=f,this._updateWhitespace(this._zones[u])}}})}onHiddenRangesChange(){for(let e in this._zones)this._updateWhitespace(this._zones[e])}_updateWhitespace(e){let t=e.whitespaceId,o=this.coordinator.convertModelIndexToViewIndex(e.zone.afterModelPosition),n=this._isInHiddenRanges(e.zone);e.isInHiddenArea=n,this.listView.changeOneWhitespace(t,o,n?0:e.zone.heightInPx)}layout(){for(let e in this._zones)this._layoutZone(e)}_addZone(e){let t=this.coordinator.convertModelIndexToViewIndex(e.afterModelPosition),o=this.listView.insertWhitespace(t,e.heightInPx),n=this._isInHiddenRanges(e),r={whitespaceId:o,zone:e,domNode:or(e.domNode),isInHiddenArea:n};return this._zones[o]=r,r.domNode.setPosition("absolute"),r.domNode.domNode.style.width="100%",r.domNode.setDisplay("none"),r.domNode.setAttribute("notebook-view-zone",o),this.domNode.appendChild(r.domNode),o}_removeZone(e){this.listView.removeWhitespace(e);let t=this._zones[e];if(t)try{this.domNode.removeChild(t.domNode)}catch{}delete this._zones[e]}_layoutZone(e){let t=this._zones[e];if(!t)return;if(this._updateWhitespace(this._zones[e]),this._isInHiddenRanges(t.zone))t.domNode.setDisplay("none");else{let n=this.listView.getWhitespacePosition(t.whitespaceId);t.domNode.setTop(n),t.domNode.setDisplay("block"),t.domNode.setHeight(t.zone.heightInPx)}}_isInHiddenRanges(e){let t=e.afterModelPosition;return!this.coordinator.modelIndexIsVisible(t)}dispose(){super.dispose(),this._zones={}}};function d8o(a,i){try{a(i)}catch(e){mt(e)}}var twi=class a extends K{static{this.viewZoneIds=[]}constructor(){super({id:"notebook.developer.addViewZones",title:L(12146,"Toggle Notebook View Zones"),category:We.Developer,precondition:Gq,f1:!0})}async run(i){let e=i.get(ee),t=qn(e.activeEditorPane);t&&(a.viewZoneIds.length>0?t.changeViewZones(o=>{a.viewZoneIds.reverse().forEach(n=>{o.removeZone(n)}),a.viewZoneIds=[]}):t.changeViewZones(o=>{let n=t.getCellsInRange();if(n.length===0)return;let r=[];for(let s=0;s<n.length;s++){let l=document.createElement("div");l.innerText=`View Zone ${s}`,l.style.backgroundColor="rgba(0, 255, 0, 0.5)";let c=o.addZone({afterModelPosition:s,heightInPx:200,domNode:l});r.push(c)}a.viewZoneIds=r}))}};W(twi);var iVt=class extends C{constructor(e){super();this.listView=e;this._lastOverlayId=0;this._overlays=Object.create(null);this.domNode=or(document.createElement("div")),this.domNode.setClassName("cell-overlays"),this.domNode.setPosition("absolute"),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this.domNode.setWidth("100%"),this.listView.containerDomNode.appendChild(this.domNode.domNode)}changeCellOverlays(e){let t=!1;return e({addOverlay:n=>(t=!0,this._addOverlay(n)),removeOverlay:n=>{t=!0,this._removeOverlay(n)},layoutOverlay:n=>{t=!0,this._layoutOverlay(n)}}),t}onCellsChanged(e){this.layout()}onHiddenRangesChange(){this.layout()}layout(){for(let e in this._overlays)this._layoutOverlay(e)}_addOverlay(e){let t=`${++this._lastOverlayId}`,o={overlayId:t,overlay:e,domNode:or(e.domNode)};return this._overlays[t]=o,o.domNode.setClassName("cell-overlay"),o.domNode.setPosition("absolute"),this.domNode.appendChild(o.domNode),t}_removeOverlay(e){let t=this._overlays[e];if(t){try{this.domNode.removeChild(t.domNode)}catch{}delete this._overlays[e]}}_layoutOverlay(e){let t=this._overlays[e];if(!t)return;if(this._isInHiddenRanges(t)){t.domNode.setDisplay("none");return}t.domNode.setDisplay("block");let n=this.listView.indexOf(t.overlay.cell);if(n===-1)return;let r=this.listView.elementTop(n);t.domNode.setTop(r)}_isInHiddenRanges(e){return this.listView.indexOf(e.overlay.cell)===-1}};function iwi(a,i){if(!i.length)return a;let e=0,t=0,o=[];for(;e<a.length&&t<i.length;)e<i[t].start&&o.push(...a.slice(e,i[t].start)),e=i[t].end+1,t++;return e<a.length&&o.push(...a.slice(e)),o}var Kpe=5e3;function p8o(a){let i=0-(parseInt(a.style.top,10)||0);return i>=0&&i<=Kpe*2}var bRe=class extends Rl{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,t,n,r,l,s,c,u,p);this.listUser=e;this.notebookOptions=o;this._previousFocusedElements=[];this._localDisposableStore=new P;this._viewModelStore=new P;this._onDidRemoveOutputs=this._localDisposableStore.add(new E);this.onDidRemoveOutputs=this._onDidRemoveOutputs.event;this._onDidHideOutputs=this._localDisposableStore.add(new E);this.onDidHideOutputs=this._onDidHideOutputs.event;this._onDidRemoveCellsFromView=this._localDisposableStore.add(new E);this.onDidRemoveCellsFromView=this._onDidRemoveCellsFromView.event;this._viewModel=null;this._hiddenRangeIds=[];this.hiddenRangesPrefixSum=null;this._onDidChangeVisibleRanges=this._localDisposableStore.add(new E);this.onDidChangeVisibleRanges=this._onDidChangeVisibleRanges.event;this._visibleRanges=[];this._isDisposed=!1;this._isInLayout=!1;this._webviewElement=null;$u.bindTo(this.contextKeyService).set(!0),this._previousFocusedElements=this.getFocusedElements(),this._localDisposableStore.add(this.onDidChangeFocus(w=>{this._previousFocusedElements.forEach(k=>{w.elements.indexOf(k)<0&&k.onDeselect()}),this._previousFocusedElements=w.elements}));let g=tce.bindTo(s);g.set("none");let f=ice.bindTo(s);f.set("none");let v=this._localDisposableStore.add(new me),b=this._localDisposableStore.add(new me);this._notebookCellAnchor=new eVt(h,u,this.onDidScroll);let S=w=>{switch(w.cursorAtBoundary()){case 3:g.set("both");break;case 1:g.set("top");break;case 2:g.set("bottom");break;default:g.set("none");break}switch(w.cursorAtLineBoundary()){case 3:f.set("both");break;case 1:f.set("start");break;case 2:f.set("end");break;default:f.set("none");break}};this._localDisposableStore.add(this.onDidChangeFocus(w=>{if(w.elements.length){let k=w.elements[0];v.value=k.onDidChangeState(T=>{T.selectionChanged&&S(k)}),b.value=k.onDidChangeEditorAttachState(()=>{k.editorAttached&&S(k)}),S(k);return}g.set("none")}));let y=()=>{if(!this.view.length)return;let w=this.getViewScrollTop(),k=this.getViewScrollBottom();if(w>=k)return;let T=Kn(this.view.indexAt(w),0,this.view.length-1),N=this.view.element(T),O=this._viewModel.getCellIndex(N),V=Kn(this.view.indexAt(k),0,this.view.length-1),U=this.view.element(V),G=this._viewModel.getCellIndex(U);G-O===V-T?this.visibleRanges=[{start:O,end:G+1}]:this.visibleRanges=this._getVisibleRangesFromIndex(T,O,V,G)};this._localDisposableStore.add(this.view.onDidChangeContentHeight(()=>{this._isInLayout&&$r(Me(t),()=>{y()}),y()})),this._localDisposableStore.add(this.view.onDidScroll(()=>{this._isInLayout&&$r(Me(t),()=>{y()}),y()}))}get onWillScroll(){return this.view.onWillScroll}get rowsContainer(){return this.view.containerDomNode}get scrollableElement(){return this.view.scrollableElementDomNode}get viewModel(){return this._viewModel}get visibleRanges(){return this._visibleRanges}set visibleRanges(e){E8e(this._visibleRanges,e)||(this._visibleRanges=e,this._onDidChangeVisibleRanges.fire())}get isDisposed(){return this._isDisposed}get webviewElement(){return this._webviewElement}get inRenderingTransaction(){return this.view.inRenderingTransaction}createListView(e,t,o,n){let r=new ZWt(e,t,o,n);return this.viewZones=new tVt(r,this),this.cellOverlays=new iVt(r),r}_getView(){return this.view}attachWebview(e){e.style.top=`-${Kpe}px`,this.rowsContainer.insertAdjacentElement("afterbegin",e),this._webviewElement=new Bg(e)}elementAt(e){if(!this.view.length)return;let t=this.view.indexAt(e),o=Kn(t,0,this.view.length-1);return this.element(o)}elementHeight(e){let t=this._getViewIndexUpperBound(e);if(t===void 0||t<0||t>=this.length)throw this._getViewIndexUpperBound(e),new CL(this.listUser,`Invalid index ${t}`);return this.view.elementHeight(t)}detachViewModel(){this._viewModelStore.clear(),this._viewModel=null,this.hiddenRangesPrefixSum=null}attachViewModel(e){this._viewModel=e,this._viewModelStore.add(e.onDidChangeViewCells(r=>{if(this._isDisposed)return;this.viewZones.onCellsChanged(r),this.cellOverlays.onCellsChanged(r);let s=this._hiddenRangeIds.map(h=>this._viewModel.getTrackedRange(h)).filter(h=>h!==null),l=iwi(this._viewModel.viewCells,s),c=[],u=new Set;for(let h=0;h<this.length;h++)c.push(this.element(h)),u.add(this.element(h).uri.toString());let p=H3e(c,l,h=>u.has(h.uri.toString()));r.synchronous?this._updateElementsInWebview(p):this._viewModelStore.add($r(Me(this.rowsContainer),()=>{this._isDisposed||this._updateElementsInWebview(p)}))})),this._viewModelStore.add(e.onDidChangeSelection(r=>{if(r==="view")return;let s=Lf(e.getSelections()).map(c=>e.cellAt(c)).filter(c=>!!c).map(c=>this._getViewIndexUpperBound(c));this.setSelection(s,void 0,!0);let l=Lf([e.getFocus()]).map(c=>e.cellAt(c)).filter(c=>!!c).map(c=>this._getViewIndexUpperBound(c));l.length&&this.setFocus(l,void 0,!0)}));let t=e.getHiddenRanges();this.setHiddenAreas(t,!1);let o=MO(t),n=e.viewCells.slice(0);o.reverse().forEach(r=>{let s=n.splice(r.start,r.end-r.start+1);this._onDidRemoveCellsFromView.fire(s)}),this.splice2(0,0,n)}_updateElementsInWebview(e){e.reverse().forEach(t=>{let o=[],n=[],r=[];for(let s=t.start;s<t.start+t.deleteCount;s++){let l=this.element(s);l.cellKind===2?this._viewModel.hasCell(l)?o.push(...l?.outputsViewModels):n.push(...l?.outputsViewModels):r.push(l)}this.splice2(t.start,t.deleteCount,t.toInsert),this._onDidHideOutputs.fire(o),this._onDidRemoveOutputs.fire(n),this._onDidRemoveCellsFromView.fire(r)})}clear(){super.splice(0,this.length)}setHiddenAreas(e,t){if(!this._viewModel)return!1;let o=MO(e),n=this._hiddenRangeIds.map(s=>this._viewModel.getTrackedRange(s)).filter(s=>s!==null);if(o.length===n.length){let s=!1;for(let l=0;l<o.length;l++)if(!(o[l].start===n[l].start&&o[l].end===n[l].end)){s=!0;break}if(!s)return this._updateHiddenRangePrefixSum(o),this.viewZones.onHiddenRangesChange(),this.viewZones.layout(),this.cellOverlays.onHiddenRangesChange(),this.cellOverlays.layout(),!1}this._hiddenRangeIds.forEach(s=>this._viewModel.setTrackedRange(s,null,3));let r=o.map(s=>this._viewModel.setTrackedRange(null,s,3)).filter(s=>s!==null);return this._hiddenRangeIds=r,this._updateHiddenRangePrefixSum(o),this.viewZones.onHiddenRangesChange(),this.cellOverlays.onHiddenRangesChange(),t&&this.updateHiddenAreasInView(n,o),this.viewZones.layout(),this.cellOverlays.layout(),!0}_updateHiddenRangePrefixSum(e){let t=0,o=0,n=[];for(;o<e.length;){for(let s=t;s<e[o].start-1;s++)n.push(1);n.push(e[o].end-e[o].start+1+1),t=e[o].end+1,o++}for(let s=t;s<this._viewModel.length;s++)n.push(1);let r=new Uint32Array(n.length);for(let s=0;s<n.length;s++)r[s]=n[s];this.hiddenRangesPrefixSum=new KT(r)}updateHiddenAreasInView(e,t){let o=iwi(this._viewModel.viewCells,e),n=new Set;o.forEach(l=>{n.add(l.uri.toString())});let r=iwi(this._viewModel.viewCells,t),s=H3e(o,r,l=>n.has(l.uri.toString()));this._updateElementsInWebview(s)}splice2(e,t,o=[]){if(e<0||e>this.view.length)return;let n=ts(this.rowsContainer);super.splice(e,t,o),n&&this.domFocus();let r=[];this.getSelectedElements().forEach(s=>{this._viewModel.hasCell(s)&&r.push(s.handle)}),!r.length&&this._viewModel.viewCells.length&&this._viewModel.updateSelectionsState({kind:1,focus:{start:0,end:1},selections:[{start:0,end:1}]}),this.viewZones.layout(),this.cellOverlays.layout()}getModelIndex(e){let t=this.indexOf(e);return this.getModelIndex2(t)}getModelIndex2(e){return this.hiddenRangesPrefixSum?this.hiddenRangesPrefixSum.getPrefixSum(e-1):e}getViewIndex(e){let t=this._viewModel.getCellIndex(e);return this.getViewIndex2(t)}getViewIndex2(e){if(!this.hiddenRangesPrefixSum)return e;let t=this.hiddenRangesPrefixSum.getIndexOf(e);return t.remainder!==0?e>=this.hiddenRangesPrefixSum.getTotalSum()?e-(this.hiddenRangesPrefixSum.getTotalSum()-this.hiddenRangesPrefixSum.getCount()):void 0:t.index}convertModelIndexToViewIndex(e){return this.hiddenRangesPrefixSum?e>=this.hiddenRangesPrefixSum.getTotalSum()?Math.min(this.length,this.hiddenRangesPrefixSum.getTotalSum()):this.hiddenRangesPrefixSum.getIndexOf(e).index:e}modelIndexIsVisible(e){return this.hiddenRangesPrefixSum&&this.hiddenRangesPrefixSum.getIndexOf(e).remainder!==0?e>=this.hiddenRangesPrefixSum.getTotalSum():!0}_getVisibleRangesFromIndex(e,t,o,n){let r=[],s=[],l=e,c=t;for(;l<=o;){let u=this.hiddenRangesPrefixSum.getPrefixSum(l);u===c+1?(r.length&&(r[r.length-1]===c-1?s.push({start:r[r.length-1],end:c+1}):s.push({start:r[r.length-1],end:r[r.length-1]+1})),r.push(c),l++,c++):(r.length&&(r[r.length-1]===c-1?s.push({start:r[r.length-1],end:c+1}):s.push({start:r[r.length-1],end:r[r.length-1]+1})),r.push(c),l++,c=u)}return r.length&&s.push({start:r[r.length-1],end:r[r.length-1]+1}),MO(s)}getVisibleRangesPlusViewportAboveAndBelow(){if(this.view.length<=0)return[];let e=Math.max(this.getViewScrollTop()-this.renderHeight,0),t=this.view.indexAt(e),o=this.view.element(t),n=this._viewModel.getCellIndex(o),r=Kn(this.getViewScrollBottom()+this.renderHeight,0,this.scrollHeight),s=Kn(this.view.indexAt(r),0,this.view.length-1),l=this.view.element(s),c=this._viewModel.getCellIndex(l);return c-n===s-t?[{start:n,end:c}]:this._getVisibleRangesFromIndex(t,n,s,c)}_getViewIndexUpperBound(e){if(!this._viewModel)return-1;let t=this._viewModel.getCellIndex(e);if(t===-1)return-1;if(!this.hiddenRangesPrefixSum)return t;let o=this.hiddenRangesPrefixSum.getIndexOf(t);return o.remainder!==0&&t>=this.hiddenRangesPrefixSum.getTotalSum()?t-(this.hiddenRangesPrefixSum.getTotalSum()-this.hiddenRangesPrefixSum.getCount()):o.index}_getViewIndexUpperBound2(e){if(!this.hiddenRangesPrefixSum)return e;let t=this.hiddenRangesPrefixSum.getIndexOf(e);return t.remainder!==0&&e>=this.hiddenRangesPrefixSum.getTotalSum()?e-(this.hiddenRangesPrefixSum.getTotalSum()-this.hiddenRangesPrefixSum.getCount()):t.index}focusElement(e){let t=this._getViewIndexUpperBound(e);if(t>=0&&this._viewModel){let o=this.element(t).handle;this._viewModel.updateSelectionsState({kind:0,primary:o,selections:[o]},"view"),this.setFocus([t],void 0,!1)}}selectElements(e){let t=e.map(o=>this._getViewIndexUpperBound(o)).filter(o=>o>=0);this.setSelection(t)}getCellViewScrollTop(e){let t=this._getViewIndexUpperBound(e);if(t===void 0||t<0||t>=this.length)throw new CL(this.listUser,`Invalid index ${t}`);return this.view.elementTop(t)}getCellViewScrollBottom(e){let t=this._getViewIndexUpperBound(e);if(t===void 0||t<0||t>=this.length)throw new CL(this.listUser,`Invalid index ${t}`);let o=this.view.elementTop(t),n=this.view.elementHeight(t);return o+n}setFocus(e,t,o){if(o){super.setFocus(e,t);return}if(e.length){if(this._viewModel){let n=this.element(e[0]).handle;this._viewModel.updateSelectionsState({kind:0,primary:n,selections:this.getSelection().map(r=>this.element(r).handle)},"view")}}else if(this._viewModel){if(this.length)return;this._viewModel.updateSelectionsState({kind:0,primary:null,selections:[]},"view")}super.setFocus(e,t)}setSelection(e,t,o){if(o){super.setSelection(e,t);return}e.length?this._viewModel&&this._viewModel.updateSelectionsState({kind:0,primary:this.getFocusedElements()[0]?.handle??null,selections:e.map(n=>this.element(n)).map(n=>n.handle)},"view"):this._viewModel&&this._viewModel.updateSelectionsState({kind:0,primary:this.getFocusedElements()[0]?.handle??null,selections:[]},"view"),super.setSelection(e,t)}revealCells(e){let t=this._getViewIndexUpperBound2(e.start);if(t<0)return;let o=this._getViewIndexUpperBound2(e.end-1),n=this.getViewScrollTop(),r=this.getViewScrollBottom(),s=this.view.elementTop(t);if(s>=n&&s<r){let l=this.view.elementTop(o),c=this.view.elementHeight(o);if(l+c<=r)return;if(l>=r)return this._revealInternal(o,!1,2);if(l<r)return l+c-r<s-n?this.view.setScrollTop(n+l+c-r):this._revealInternal(t,!1,0)}this._revealInViewWithMinimalScrolling(t)}_revealInViewWithMinimalScrolling(e,t){let o=this.view.firstMostlyVisibleIndex,n=this.view.elementHeight(e);e<=o||!t&&n>=this.view.renderHeight?this._revealInternal(e,!0,0):this._revealInternal(e,!0,2,t)}scrollToBottom(){let e=this.view.scrollHeight,t=this.getViewScrollTop(),o=this.getViewScrollBottom();this.view.setScrollTop(e-(o-t))}async revealCell(e,t){let o=this._getViewIndexUpperBound(e);if(!(o<0)){switch(t){case 2:this._revealInternal(o,!1,0);break;case 3:this._revealInternal(o,!1,1);break;case 4:this._revealInternal(o,!0,1);break;case 5:this._revealInternal(o,!0,3);break;case 6:this._revealInViewWithMinimalScrolling(o,!0);break;case 1:this._revealInViewWithMinimalScrolling(o);break}if((e.getEditState()===1||t===6&&e.cellKind===2)&&!e.editorAttached)return cZe(e)}}_revealInternal(e,t,o,n){if(e>=this.view.length)return;let r=this.getViewScrollTop(),s=this.getViewScrollBottom(),l=this.view.elementTop(e),c=this.view.elementHeight(e)+l;if(!(t&&l>=r&&c<s))switch(o){case 0:this.view.setScrollTop(l),this.view.setScrollTop(this.view.elementTop(e));break;case 1:case 3:{this.view.setScrollTop(l-this.view.renderHeight/2);let u=this.view.elementTop(e),p=this.view.elementHeight(e),h=this.getViewScrollBottom()-this.getViewScrollTop();p>=h?this.view.setScrollTop(u):o===1?this.view.setScrollTop(u+p/2-h/2):o===3&&this.view.setScrollTop(u-h/5)}break;case 2:if(n){let u=this.viewModel?.layoutInfo?.fontInfo.lineHeight??15,p=this.notebookOptions.getLayoutConfiguration().cellTopMargin+this.notebookOptions.getLayoutConfiguration().editorTopPadding,h=l+u+p;if(h<s)return;this.view.setScrollTop(this.scrollTop+(h-s));break}this.view.setScrollTop(this.scrollTop+(c-s)),this.view.setScrollTop(this.scrollTop+(this.view.elementTop(e)+this.view.elementHeight(e)-this.getViewScrollBottom()));break;default:break}}async revealRangeInCell(e,t,o){let n=this._getViewIndexUpperBound(e);if(!(n<0))switch(o){case 1:return this._revealRangeInternalAsync(n,t);case 2:return this._revealRangeInCenterInternalAsync(n,t);case 3:return this._revealRangeInCenterIfOutsideViewportInternalAsync(n,t)}}async _revealRangeInternalAsync(e,t){let o=this.getViewScrollTop(),n=this.getViewScrollBottom(),r=this.view.elementTop(e),s=this.view.element(e);if(s.editorAttached)this._revealRangeCommon(e,t);else{let l=this.view.elementHeight(e),c;return r+l<=o?(this.view.setScrollTop(r),c="top"):r>=n&&(this.view.setScrollTop(r-this.view.renderHeight/2),c="bottom"),new Promise((p,h)=>{H.once(s.onDidChangeEditorAttachState)(()=>{s.editorAttached?p():h()})}).then(()=>{this._revealRangeCommon(e,t,c)})}}async _revealRangeInCenterInternalAsync(e,t){let o=(l,c)=>{let u=this.view.element(l),p=u.getPositionScrollTopOffset(c),h=this.view.elementTop(l)+p;this.view.setScrollTop(h-this.view.renderHeight/2),u.revealRangeInCenter(c)},r=this.view.elementTop(e);this.view.setScrollTop(r-this.view.renderHeight/2);let s=this.view.element(e);if(s.editorAttached)o(e,t);else return cZe(s).then(()=>o(e,t))}async _revealRangeInCenterIfOutsideViewportInternalAsync(e,t){let o=(p,h)=>{let g=this.view.element(p),f=g.getPositionScrollTopOffset(h),v=this.view.elementTop(p)+f;this.view.setScrollTop(v-this.view.renderHeight/2),g.revealRangeInCenter(h)},n=this.getViewScrollTop(),r=this.getViewScrollBottom(),l=this.view.elementTop(e),c=this.view.element(e),u=l+c.getPositionScrollTopOffset(t);if(u<n||u>r){this.view.setScrollTop(u-this.view.renderHeight/2);let p=this.view.elementTop(e)+c.getPositionScrollTopOffset(t);if(this.view.setScrollTop(p-this.view.renderHeight/2),!c.editorAttached)return cZe(c).then(()=>o(e,t))}else if(c.editorAttached)c.revealRangeInCenter(t);else return cZe(c).then(()=>o(e,t))}_revealRangeCommon(e,t,o){let n=this.view.element(e),r=this.getViewScrollTop(),s=this.getViewScrollBottom(),l=n.getPositionScrollTopOffset(t),c=this.view.elementHeight(e);if(l>=c){let h=n.layoutInfo.totalHeight;this.updateElementHeight(e,h)}let p=this.view.elementTop(e)+l;p<r?this.view.setScrollTop(p-30):p>s?this.view.setScrollTop(r+p-s+30):o==="bottom"?this.view.setScrollTop(r+p-s+30):o==="top"&&this.view.setScrollTop(p-30)}revealCellOffsetInCenter(e,t){let o=this._getViewIndexUpperBound(e);if(o>=0){let n=this.view.element(o),r=this.view.elementTop(o);if(n instanceof kb)return this._revealInCenterIfOutsideViewport(o);{let s=n.layoutInfo.outputContainerOffset+Math.min(t,n.layoutInfo.outputTotalHeight);this.view.setScrollTop(r-this.view.renderHeight/2),this.view.setScrollTop(r+s-this.view.renderHeight/2)}}}revealOffsetInCenterIfOutsideViewport(e){let t=this.getViewScrollTop(),o=this.getViewScrollBottom();if(e<t||e>o){let n=Math.max(0,e-this.view.renderHeight/2);this.view.setScrollTop(n)}}_revealInCenterIfOutsideViewport(e){this._revealInternal(e,!0,1)}domElementOfElement(e){let t=this._getViewIndexUpperBound(e);return t>=0&&t<this.length?this.view.domElement(t):null}focusView(){this.view.domNode.focus()}triggerScrollFromMouseWheelEvent(e){this.view.delegateScrollFromMouseWheelEvent(e)}delegateVerticalScrollbarPointerDown(e){this.view.delegateVerticalScrollbarPointerDown(e)}isElementAboveViewport(e){return this.view.elementTop(e)+this.view.elementHeight(e)<this.scrollTop}updateElementHeight2(e,t,o=null){let n=this._getViewIndexUpperBound(e);if(n===void 0||n<0||n>=this.length)return;if(this.isElementAboveViewport(n)){let c=this.elementHeight(e)-t;this._webviewElement&&H.once(this.view.onWillScroll)(()=>{let u=parseInt(this._webviewElement.domNode.style.top,10);p8o(this._webviewElement.domNode)?this._webviewElement.setTop(u-c):this._webviewElement.setTop(-Kpe)}),this.view.updateElementHeight(n,t,o),this.viewZones.layout(),this.cellOverlays.layout();return}if(o!==null){this.view.updateElementHeight(n,t,o),this.viewZones.layout(),this.cellOverlays.layout();return}let r=this.getFocus(),s=r.length?r[0]:null;if(s){let l=t-this.view.elementHeight(n);if(this._notebookCellAnchor.shouldAnchor(this.view,s,l,this.element(n))){this.view.updateElementHeight(n,t,s),this.viewZones.layout(),this.cellOverlays.layout();return}}this.view.updateElementHeight(n,t,null),this.viewZones.layout(),this.cellOverlays.layout()}changeViewZones(e){this.viewZones.changeViewZones(e)&&this.viewZones.layout()}changeCellOverlays(e){this.cellOverlays.changeCellOverlays(e)&&this.cellOverlays.layout()}getViewZoneLayoutInfo(e){return this.viewZones.getViewZoneLayoutInfo(e)}domFocus(){let e=this.getFocusedElements()[0],t=e&&this.domElementOfElement(e);this.view.domNode.ownerDocument.activeElement&&t&&t.contains(this.view.domNode.ownerDocument.activeElement)||!it&&this.view.domNode.ownerDocument.activeElement&&Nh(this.view.domNode.ownerDocument.activeElement,"context-view")||super.domFocus()}focusContainer(e){e&&(this._viewModel?.updateSelectionsState({kind:0,primary:null,selections:[]},"view"),this.setFocus([],void 0,!0),this.setSelection([],void 0,!0)),super.domFocus()}getViewScrollTop(){return this.view.getScrollTop()}getViewScrollBottom(){return this.getViewScrollTop()+this.view.renderHeight}setCellEditorSelection(e,t){let o=e;o.editorAttached?o.setSelection(t):cZe(o).then(()=>{o.setSelection(t)})}style(e){let t=this.view.domId;this.styleElement||(this.styleElement=hr(this.view.domNode));let o=t&&`.${t}`,n=[];e.listBackground&&n.push(`.monaco-list${o} > div.monaco-scrollable-element > .monaco-list-rows { background: ${e.listBackground}; }`),e.listFocusBackground&&(n.push(`.monaco-list${o}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { background-color: ${e.listFocusBackground}; }`),n.push(`.monaco-list${o}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused:hover { background-color: ${e.listFocusBackground}; }`)),e.listFocusForeground&&n.push(`.monaco-list${o}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { color: ${e.listFocusForeground}; }`),e.listActiveSelectionBackground&&(n.push(`.monaco-list${o}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { background-color: ${e.listActiveSelectionBackground}; }`),n.push(`.monaco-list${o}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected:hover { background-color: ${e.listActiveSelectionBackground}; }`)),e.listActiveSelectionForeground&&n.push(`.monaco-list${o}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { color: ${e.listActiveSelectionForeground}; }`),e.listFocusAndSelectionBackground&&n.push(`
.monaco-drag-image${o},
.monaco-list${o}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected.focused { background-color: ${e.listFocusAndSelectionBackground}; }
`),e.listFocusAndSelectionForeground&&n.push(`
.monaco-drag-image${o},
.monaco-list${o}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected.focused { color: ${e.listFocusAndSelectionForeground}; }
`),e.listInactiveFocusBackground&&(n.push(`.monaco-list${o} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { background-color: ${e.listInactiveFocusBackground}; }`),n.push(`.monaco-list${o} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused:hover { background-color: ${e.listInactiveFocusBackground}; }`)),e.listInactiveSelectionBackground&&(n.push(`.monaco-list${o} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { background-color: ${e.listInactiveSelectionBackground}; }`),n.push(`.monaco-list${o} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected:hover { background-color: ${e.listInactiveSelectionBackground}; }`)),e.listInactiveSelectionForeground&&n.push(`.monaco-list${o} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { color: ${e.listInactiveSelectionForeground}; }`),e.listHoverBackground&&n.push(`.monaco-list${o}:not(.drop-target) > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row:hover:not(.selected):not(.focused) { background-color: ${e.listHoverBackground}; }`),e.listHoverForeground&&n.push(`.monaco-list${o} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row:hover:not(.selected):not(.focused) { color: ${e.listHoverForeground}; }`),e.listSelectionOutline&&n.push(`.monaco-list${o} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { outline: 1px dotted ${e.listSelectionOutline}; outline-offset: -1px; }`),e.listFocusOutline&&n.push(`
.monaco-drag-image${o},
.monaco-list${o}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { outline: 1px solid ${e.listFocusOutline}; outline-offset: -1px; }
`),e.listInactiveFocusOutline&&n.push(`.monaco-list${o} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { outline: 1px dotted ${e.listInactiveFocusOutline}; outline-offset: -1px; }`),e.listHoverOutline&&n.push(`.monaco-list${o} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row:hover { outline: 1px dashed ${e.listHoverOutline}; outline-offset: -1px; }`),e.listDropOverBackground&&n.push(`
.monaco-list${o}.drop-target,
.monaco-list${o} > div.monaco-scrollable-element > .monaco-list-rows.drop-target,
.monaco-list${o} > div.monaco-scrollable-element > .monaco-list-row.drop-target { background-color: ${e.listDropOverBackground} !important; color: inherit !important; }
`);let r=n.join(`
`);r!==this.styleElement.textContent&&(this.styleElement.textContent=r)}getRenderHeight(){return this.view.renderHeight}getScrollHeight(){return this.view.scrollHeight}layout(e,t){this._isInLayout=!0,super.layout(e,t),this.renderHeight===0?this.view.domNode.style.visibility="hidden":this.view.domNode.style.visibility="initial",this._isInLayout=!1}dispose(){this._isDisposed=!0,this._viewModelStore.dispose(),this._localDisposableStore.dispose(),this._notebookCellAnchor.dispose(),this.viewZones.dispose(),this.cellOverlays.dispose(),super.dispose(),this._previousFocusedElements=[],this._viewModel=null,this._hiddenRangeIds=[],this.hiddenRangesPrefixSum=null,this._visibleRanges=[]}};bRe=I([m(7,fo),m(8,B),m(9,F),m(10,rs)],bRe);var oVt=class extends C{constructor(e){super();this.list=e}getViewIndex(e){return this.list.getViewIndex(e)??-1}getViewHeight(e){return this.list.viewModel?this.list.elementHeight(e):-1}getCellRangeFromViewRange(e,t){if(!this.list.viewModel)return;let o=this.list.getModelIndex2(e);if(o===void 0)throw new Error(`startIndex ${e} out of boundary`);if(t>=this.list.length){let n=this.list.viewModel.length;return{start:o,end:n}}else{let n=this.list.getModelIndex2(t);if(n===void 0)throw new Error(`endIndex ${t} out of boundary`);return{start:o,end:n}}}getCellsFromViewRange(e,t){if(!this.list.viewModel)return[];let o=this.getCellRangeFromViewRange(e,t);return o?this.list.viewModel.getCellsInRange(o):[]}getCellsInRange(e){return this.list.viewModel?.getCellsInRange(e)??[]}getVisibleRangesPlusViewportAboveAndBelow(){return this.list?.getVisibleRangesPlusViewportAboveAndBelow()??[]}};function cZe(a){return new Promise((i,e)=>{H.once(a.onDidChangeEditorAttachState)(()=>a.editorAttached?i():e())})}async function m8o(a){let e=navigator.userAgent.indexOf("Chrome")>=0,t=new TextEncoder,o=new TextDecoder;function n(){let Ke,ye;return{promise:new Promise((Tt,Ht)=>{Ke=Tt,ye=Ht}),resolve:Ke,reject:ye}}let r=a.options,s=a.isWorkspaceTrusted,l=a.renderOptions,c=sr(),u=globalThis.acquireVsCodeApi,p=u();delete globalThis.acquireVsCodeApi;let h=new CSSStyleSheet;h.replaceSync(a.style.tokenizationCss);let g=typeof requestIdleCallback!="function"||typeof cancelIdleCallback!="function"?Ke=>{setTimeout(()=>{if(ye)return;let Be=Date.now()+15;Ke(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,Be-Date.now())}}))});let ye=!1;return{dispose(){ye||(ye=!0)}}}:(Ke,ye)=>{let Be=requestIdleCallback(Ke,typeof ye=="number"?{timeout:ye}:void 0),Tt=!1;return{dispose(){Tt||(Tt=!0,cancelIdleCallback(Be))}}};function f(Ke){for(let ye of Ke.composedPath())if(ye instanceof HTMLElement&&ye.classList.contains("output"))return{id:ye.id}}let v,b=Ke=>{let ye=Ke&&f(Ke);ye&&(v=void 0,setTimeout(()=>{v?.id!==ye.id&&wo("outputBlur",ye)},0))},S=(Ke,ye=document)=>{let Be=ye.activeElement;return!!(Be&&Ke.contains(Be)&&(Be.matches(":read-write")||Be.tagName.toLowerCase()==="select"||Be.shadowRoot&&S(Be.shadowRoot,Be.shadowRoot)))},y=Ke=>{v=f(Ke);let ye=window.document.activeElement;if(!ye)return;let Be=v?.id;Be&&S(ye,window.document)&&(wo("outputInputFocus",{inputFocused:!0,id:Be}),ye.addEventListener("blur",()=>{wo("outputInputFocus",{inputFocused:!1,id:Be})},{once:!0}))},w=Ke=>{if(!Ke||!Ke.view||!Ke.view.document)return;let ye=v=f(Ke);for(let Be of Ke.composedPath())if(Be instanceof HTMLAnchorElement&&Be.href){if(Be.href.startsWith("blob:"))ye&&wo("outputFocus",ye),G(Be.href,Be.download);else if(Be.href.startsWith("data:"))ye&&wo("outputFocus",ye),U(Be.href,Be.download);else if(Be.getAttribute("href")?.trim().startsWith("#")){if(!Be.hash){wo("scroll-to-reveal",{scrollTop:0});return}let Tt=Be.hash.substring(1),Ht=Ke.view.document.getElementById(Tt);if(!Ht){for(let Do of Ke.view.document.querySelectorAll(".preview"))if(Ht=Do.shadowRoot?.getElementById(Tt),Ht)break}if(Ht){let Do=Ht.getBoundingClientRect().top+Ke.view.scrollY;wo("scroll-to-reveal",{scrollTop:Do});return}}else{let Tt=Be.getAttribute("href");Tt&&(Tt.startsWith("command:")&&ye&&wo("outputFocus",ye),wo("clicked-link",{href:Tt}))}Ke.preventDefault(),Ke.stopPropagation();return}ye&&wo("outputFocus",ye)},k=()=>{let Ke=window.getSelection();Ke&&Ke.removeAllRanges()},T=Ke=>{let ye=window.getSelection();if(!ye)return;let Be=window.document.getElementById(Ke);if(!Be)return;ye.removeAllRanges();let Tt=document.createRange();Tt.selectNode(Be),ye.addRange(Tt)},N=Ke=>{if(!window.document.getElementById(Ke))return;let Be=window.document.activeElement;Be&&S(Be,window.document)&&Be.select()},O=Ke=>{if(!v?.id||!Ke.shiftKey)return;if(Ke.shiftKey&&(Ke.code==="ArrowUp"||Ke.code==="ArrowDown")){Ke.stopPropagation();return}if(!(Ke.code==="PageUp"||Ke.code==="PageDown")&&!(Ke.metaKey&&(Ke.code==="ArrowDown"||Ke.code==="ArrowUp")))return;let ye=window.document.getElementById(v.id),Be=window.getSelection();if(!ye||!Be?.anchorNode)return;let Tt=window.document.activeElement;if(Tt&&S(Tt,window.document))return;Ke.stopPropagation(),Ke.preventDefault();let{anchorNode:Ht,anchorOffset:Do}=Be,io=document.createRange();Ke.code==="PageDown"||Ke.code==="ArrowDown"?(io.setStart(Ht,Do),io.setEnd(ye,1)):(io.setStart(ye,0),io.setEnd(Ht,Do)),Be.removeAllRanges(),Be.addRange(io)},V=Ke=>{if(!v?.id)return;let ye=window.document.activeElement;if(!(ye&&S(ye,window.document))&&(Ke.key==="a"&&Ke.ctrlKey||Ke.metaKey&&Ke.key==="a")){Ke.preventDefault();return}},U=async(Ke,ye)=>{wo("clicked-data-url",{data:Ke,downloadName:ye})},G=async(Ke,ye)=>{try{let Tt=await(await fetch(Ke)).blob(),Ht=new FileReader;Ht.addEventListener("load",()=>{U(Ht.result,ye)}),Ht.readAsDataURL(Tt)}catch(Be){console.error(Be.message)}};window.document.body.addEventListener("click",w),window.document.body.addEventListener("focusin",y),window.document.body.addEventListener("focusout",b),window.document.body.addEventListener("keydown",O),window.document.body.addEventListener("keydown",V);function $(){return Object.freeze({onDidReceiveKernelMessage:Id.event,postKernelMessage:Ke=>wo("customKernelMessage",{message:Ke})})}async function te(Ke){try{return await pe(Ke)}catch(ye){throw console.error(ye),ye}}async function pe(Ke){let ye=await __import(Ke);if(!ye.activate){console.error(`Notebook preload '${Ke}' was expected to be a module but it does not export an 'activate' function`);return}return ye.activate($())}let de=new class{constructor(){this.pending=new Map}updateHeight(Ke,ye,Be){this.pending.size||setTimeout(()=>{this.updateImmediately()},0);let Tt=this.pending.get(Ke);Tt&&Tt.isOutput?this.pending.set(Ke,{id:Ke,height:ye,init:Tt.init,isOutput:Tt.isOutput}):this.pending.set(Ke,{id:Ke,height:ye,...Be})}updateImmediately(){this.pending.size&&(wo("dimension",{updates:Array.from(this.pending.values())}),this.pending.clear())}};function se(Ke){return Ke>2.1}let Se=new class{constructor(){this._observedElements=new WeakMap;this._observer=new ResizeObserver(Ke=>{for(let ye of Ke){if(!window.document.body.contains(ye.target))continue;let Be=this._observedElements.get(ye.target);if(!Be||(this.postResizeMessage(Be.cellId),ye.target.id!==Be.id)||!ye.contentRect)continue;if(!Be.output){this.updateHeight(Be,ye.target.offsetHeight);continue}let Tt=se(ye.contentRect.height);Tt&&Be.lastKnownPadding===0||!Tt&&Be.lastKnownPadding!==0?window.requestAnimationFrame(()=>{Tt?ye.target.style.padding=`${a.style.outputNodePadding}px ${a.style.outputNodePadding}px ${a.style.outputNodePadding}px ${a.style.outputNodeLeftPadding}px`:ye.target.style.padding="0px",this.updateHeight(Be,Tt?ye.target.offsetHeight:0)}):this.updateHeight(Be,Tt?ye.target.offsetHeight:0)}})}updateHeight(Ke,ye){Ke.lastKnownHeight!==ye&&(Ke.lastKnownHeight=ye,de.updateHeight(Ke.id,ye,{isOutput:Ke.output}))}observe(Ke,ye,Be,Tt){this._observedElements.has(Ke)||(this._observedElements.set(Ke,{id:ye,output:Be,lastKnownPadding:a.style.outputNodePadding,lastKnownHeight:-1,cellId:Tt}),this._observer.observe(Ke))}postResizeMessage(Ke){clearTimeout(this._outputResizeTimer),this._outputResizeTimer=setTimeout(()=>{wo("outputResized",{cellId:Ke})},250)}},ke,Ee,He,Ve;function Fe(Ke,ye){if(He=Ke,ye===void 0)return Ve=Date.now(),ke=void 0,Ke.setAttribute("recentlyScrolled","true"),clearTimeout(Ee),Ee=setTimeout(()=>{He?.removeAttribute("recentlyScrolled")},300),!0;if(Ke.hasAttribute("recentlyScrolled")){if(Ve&&Date.now()-Ve>400){if(ke&&ye<0&&ye<ke-8)return clearTimeout(Ee),He?.removeAttribute("recentlyScrolled"),!1;if(ke&&ye>0&&ye>ke+8)return clearTimeout(Ee),He?.removeAttribute("recentlyScrolled"),!1;clearTimeout(Ee),Ee=setTimeout(()=>{He?.removeAttribute("recentlyScrolled")},50)}else clearTimeout(Ee),Ee=setTimeout(()=>{He?.removeAttribute("recentlyScrolled")},300);return ke=ye,!0}return!1}function Qt(Ke){for(let ye=Ke.target;ye;ye=ye.parentNode){if(!(ye instanceof Element)||ye.id==="container"||ye.classList.contains("cell_container")||ye.classList.contains("markup")||ye.classList.contains("output_container"))return!1;if(Ke.deltaY<0&&ye.scrollTop>0)return Fe(ye),!0;if(Ke.deltaY>0&&ye.scrollTop+ye.clientHeight<ye.scrollHeight){if(ye.scrollHeight-ye.scrollTop-ye.clientHeight<2||window.getComputedStyle(ye).overflowY==="hidden"||window.getComputedStyle(ye).overflowY==="visible")continue;return Fe(ye),!0}if(Fe(ye,Ke.deltaY))return!0}return!1}let Ze=Ke=>{Ke.defaultPrevented||Qt(Ke)||wo("did-scroll-wheel",{payload:{deltaMode:Ke.deltaMode,deltaX:Ke.deltaX,deltaY:Ke.deltaY,deltaZ:Ke.deltaZ,wheelDelta:Ke.wheelDelta&&e?Ke.wheelDelta/window.devicePixelRatio:Ke.wheelDelta,wheelDeltaX:Ke.wheelDeltaX&&e?Ke.wheelDeltaX/window.devicePixelRatio:Ke.wheelDeltaX,wheelDeltaY:Ke.wheelDeltaY&&e?Ke.wheelDeltaY/window.devicePixelRatio:Ke.wheelDeltaY,detail:Ke.detail,shiftKey:Ke.shiftKey,type:Ke.type}})};function Ti(Ke,ye){let Be=window.document.getElementById(Ke)??(ye?window.document.getElementById(ye):void 0);if(Be){if(Be.contains(window.document.activeElement))return;let Tt=Be.querySelector('[tabindex="0"], [href], button, input, option, select, textarea');Tt||(Tt=Be,Tt.tabIndex=-1),v?.id!==Be.id&&(v=Be,wo("outputFocus",{id:Be.id})),Tt.focus()}}function ti(Ke,ye){let Be=document.createElement("div");return Be.id=`focus-sink-${Ke}`,Be.tabIndex=0,Be.addEventListener("focus",()=>{wo("focus-editor",{cellId:Ke,focusNext:ye})}),Be}function bo(Ke,ye="mark",Be={}){function Tt(_r){if(!_r.startContainer.ownerDocument)return[];if(_r.startContainer.nodeType===Node.TEXT_NODE&&_r.startOffset>0){let Ow=_r.startContainer,sre=_r.endOffset,GG=Ow.splitText(_r.startOffset);_r.endContainer===Ow&&_r.setEnd(GG,sre-_r.startOffset),_r.setStart(GG,0)}_r.endContainer.nodeType===Node.TEXT_NODE&&_r.endOffset<_r.endContainer.length&&_r.endContainer.splitText(_r.endOffset);let sl=_r.startContainer.ownerDocument.createTreeWalker(_r.commonAncestorContainer,NodeFilter.SHOW_TEXT,Ow=>_r.intersectsNode(Ow)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT);sl.currentNode=_r.startContainer;let Dd=[];for(sl.currentNode.nodeType===Node.TEXT_NODE&&Dd.push(sl.currentNode);sl.nextNode()&&_r.comparePoint(sl.currentNode,0)!==1;)sl.currentNode.nodeType===Node.TEXT_NODE&&Dd.push(sl.currentNode);return Dd}function Ht(_r,sl,Dd){let Ow=_r.ownerDocument.createElement(sl);Object.keys(Dd).forEach(GG=>{Ow.setAttribute(GG,Dd[GG])});let sre=_r.ownerDocument.createRange();return sre.selectNode(_r),sre.surroundContents(Ow),Ow}if(Ke.collapsed)return{remove:()=>{},update:()=>{}};let Do=Tt(Ke),io=[];for(let _r in Do){let sl=Ht(Do[_r],ye,Be);io.push(sl)}function xr(_r){if(_r.childNodes.length===1)_r.replaceWith(_r.firstChild);else{for(;_r.firstChild;)_r.parentNode?.insertBefore(_r.firstChild,_r);_r.remove()}}function oo(){for(let _r in io)xr(io[_r])}function Gr(_r,sl={}){Object.keys(sl).forEach(Dd=>{_r.setAttribute(Dd,sl[Dd])})}function Sa(_r){for(let sl in io)Gr(io[sl],_r)}return{remove:oo,update:Sa}}function Ro(Ke){let ye=window.getSelection();if(ye)try{ye.removeAllRanges();let Be=document.createRange();Be.setStart(Ke.startContainer,Ke.startOffset),Be.setEnd(Ke.endContainer,Ke.endOffset),ye.addRange(Be)}catch(Be){console.log(Be)}}function _o(Ke,ye,Be="mark",Tt={}){if(ye){let Ht=bo(Ke,Be,Tt);return{range:Ke,dispose:Ht.remove,update:(Do,io)=>{io===void 0?Ht.update({style:`background-color: ${Do}`}):Ht.update({class:io})}}}else{window.document.execCommand("hiliteColor",!1,yd);let Ht=window.getSelection().getRangeAt(0).cloneRange(),Do={collapsed:Ht.collapsed,commonAncestorContainer:Ht.commonAncestorContainer,endContainer:Ht.endContainer,endOffset:Ht.endOffset,startContainer:Ht.startContainer,startOffset:Ht.startOffset};return{range:Do,dispose:()=>{Ro(Do);try{document.designMode="On",window.document.execCommand("removeFormat",!1,void 0),document.designMode="Off",window.getSelection()?.removeAllRanges()}catch(io){console.log(io)}},update:(io,xr)=>{Ro(Do);try{document.designMode="On",window.document.execCommand("removeFormat",!1,void 0),window.document.execCommand("hiliteColor",!1,io),document.designMode="Off",window.getSelection()?.removeAllRanges()}catch(oo){console.log(oo)}}}}}function sr(Ke=()=>{}){let ye=new Set;return{fire(Be){for(let Tt of[...ye])Tt.fn.call(Tt.thisArg,Be)},event(Be,Tt,Ht){let Do={fn:Be,thisArg:Tt},io={dispose:()=>{ye.delete(Do),Ke(ye)}};return ye.add(Do),Ke(ye),Ht instanceof Array?Ht.push(io):Ht&&Ht.add(io),io}}}function ln(Ke,ye,Be){ye.innerText=Ke;let Tt=document.createElement("ul");for(let Ht of Be){console.error(Ht);let Do=document.createElement("li");Do.innerText=Ht.message,Tt.appendChild(Do)}ye.appendChild(Tt)}let en=new class{constructor(){this._requestPool=0;this._requests=new Map}getOutputItem(Ke,ye){let Be=this._requestPool++,{promise:Tt,resolve:Ht}=n();return this._requests.set(Be,{resolve:Ht}),wo("getOutputItem",{requestId:Be,outputId:Ke,mime:ye}),Tt}resolveOutputItem(Ke,ye){let Be=this._requests.get(Ke);Be&&(this._requests.delete(Ke),Be.resolve(ye))}},Ws=!1;function ba(Ke,ye,Be,Tt,Ht,Do){function io(Sa,_r,sl,Dd,Ow){return Object.freeze({id:Sa,mime:_r,metadata:sl,appendedText(){if(Ow)return o.decode(Ow.valueBytes)},data(){return Dd},text(){return o.decode(Dd)},json(){return JSON.parse(this.text())},blob(){return new Blob([Dd],{type:this.mime})},get _allOutputItems(){return Ws||(Ws=!0,console.warn("'_allOutputItems' is proposed API. DO NOT ship an extension that depends on it!")),oo}})}let xr=new Map,oo=Object.freeze(Ht.map(Sa=>{let _r=Sa.mime;return Object.freeze({mime:_r,getItem(){let sl=xr.get(_r);if(sl)return sl;let Dd=en.getOutputItem(Ke,_r).then(Ow=>Ow?io(Ke,Ow.mime,Be,Ow.valueBytes):void 0);return xr.set(_r,Dd),Dd}})})),Gr=io(Ke,ye,Be,Tt,Do);return xr.set(ye,Promise.resolve(Gr)),Gr}let Id=sr(),Dg=window.trustedTypes?.createPolicy("notebookRenderer",{createHTML:Ke=>Ke,createScript:Ke=>Ke});window.addEventListener("wheel",Ze);let yd=window.getComputedStyle(window.document.getElementById("_defaultColorPalatte")).color,uu=window.getComputedStyle(window.document.getElementById("_defaultColorPalatte")).backgroundColor;class Jm{constructor(){this._activeHighlightInfo=new Map}addHighlights(ye,Be){for(let Ht=ye.length-1;Ht>=0;Ht--){let Do=ye[Ht],io=_o(Do.originalRange,!0,"mark",Do.isShadow?{style:"background-color: "+yd+";"}:{class:"find-match"});Do.highlightResult=io}let Tt={matches:ye,currentMatchIndex:-1};this._activeHighlightInfo.set(Be,Tt)}removeHighlights(ye){this._activeHighlightInfo.get(ye)?.matches.forEach(Be=>{Be.highlightResult?.dispose()}),this._activeHighlightInfo.delete(ye)}highlightCurrentMatch(ye,Be){let Tt=this._activeHighlightInfo.get(Be);if(!Tt){console.error("Modified current highlight match before adding highlight list.");return}let Ht=Tt.matches[Tt.currentMatchIndex];Ht?.highlightResult?.update(yd,Ht.isShadow?void 0:"find-match");let Do=Tt.matches[ye];Tt.currentMatchIndex=ye;let io=window.getSelection();if(Do&&io&&Do.highlightResult){let xr=0;try{let oo=window.document.getElementById(Do.id).getBoundingClientRect().top,Gr=document.createRange();Gr.selectNode(Do.highlightResult.range.startContainer),Do.highlightResult.range.startContainer.parentElement?.scrollIntoView({behavior:"auto",block:"end",inline:"nearest"});let Sa=Gr.getBoundingClientRect().top;Gr.detach(),xr=Sa-oo}catch(oo){console.error(oo)}Do.highlightResult?.update(uu,Do.isShadow?void 0:"current-find-match"),window.document.getSelection()?.removeAllRanges(),wo("didFindHighlightCurrent",{offset:xr})}}unHighlightCurrentMatch(ye,Be){let Tt=this._activeHighlightInfo.get(Be);if(!Tt)return;let Ht=Tt.matches[ye];Ht&&Ht.highlightResult&&Ht.highlightResult.update(yd,Ht.isShadow?void 0:"find-match")}dispose(){window.document.getSelection()?.removeAllRanges(),this._activeHighlightInfo.forEach(ye=>{ye.matches.forEach(Be=>{Be.highlightResult?.dispose()})})}}class Dh{constructor(){this._activeHighlightInfo=new Map,this._matchesHighlight=new Highlight,this._matchesHighlight.priority=1,this._currentMatchesHighlight=new Highlight,this._currentMatchesHighlight.priority=2,CSS.highlights?.set("find-highlight",this._matchesHighlight),CSS.highlights?.set("current-find-highlight",this._currentMatchesHighlight)}_refreshRegistry(ye=!0){ye&&this._matchesHighlight.clear(),this._currentMatchesHighlight.clear(),this._activeHighlightInfo.forEach(Be=>{if(ye)for(let Tt=0;Tt<Be.matches.length;Tt++)this._matchesHighlight.add(Be.matches[Tt].originalRange);Be.currentMatchIndex<Be.matches.length&&Be.currentMatchIndex>=0&&this._currentMatchesHighlight.add(Be.matches[Be.currentMatchIndex].originalRange)})}addHighlights(ye,Be){for(let Ht=0;Ht<ye.length;Ht++)this._matchesHighlight.add(ye[Ht].originalRange);let Tt={matches:ye,currentMatchIndex:-1};this._activeHighlightInfo.set(Be,Tt)}highlightCurrentMatch(ye,Be){let Tt=this._activeHighlightInfo.get(Be);if(!Tt){console.error("Modified current highlight match before adding highlight list.");return}Tt.currentMatchIndex=ye;let Ht=Tt.matches[ye];if(Ht){let Do=0;try{let io=window.document.getElementById(Ht.id).getBoundingClientRect().top;Ht.originalRange.startContainer.parentElement?.scrollIntoView({behavior:"auto",block:"end",inline:"nearest"}),Do=Ht.originalRange.getBoundingClientRect().top-io,wo("didFindHighlightCurrent",{offset:Do})}catch(io){console.error(io)}}this._refreshRegistry(!1)}unHighlightCurrentMatch(ye,Be){let Tt=this._activeHighlightInfo.get(Be);Tt&&(Tt.currentMatchIndex=-1)}removeHighlights(ye){this._activeHighlightInfo.delete(ye),this._refreshRegistry()}dispose(){window.document.getSelection()?.removeAllRanges(),this._currentMatchesHighlight.clear(),this._matchesHighlight.clear()}}let Rp=CSS.highlights?new Dh:new Jm;function Uv(Ke){let Be=Ke.getRangeAt(0).cloneRange(),Tt=Ke.toString().length;Ke.collapseToStart(),Ke.modify("move","backward","lineboundary"),Ke.modify("extend","forward","lineboundary");let Ht=Ke.toString(),Do=Cr(Ke.getRangeAt(0),Be),io={start:Do,end:Do+Tt};return Ke.removeAllRanges(),Ke.addRange(Be),{line:Ht,range:io}}function Cr(Ke,ye){let Be=sx(Ke.startContainer,ye.startContainer),Tt=Nw(Be,Ke.startContainer)+Ke.startOffset;return Nw(Be,ye.startContainer)+ye.startOffset-Tt}function sx(Ke,ye){let Be=new Range;return Be.setStart(Ke,0),Be.setEnd(ye,0),Be.commonAncestorContainer}function Lg(Ke){let ye=0;if(Ke.nodeType===Node.TEXT_NODE)ye+=Ke.textContent?.length||0;else for(let Be of Ke.childNodes)ye+=Lg(Be);return ye}function Nw(Ke,ye){if(!ye)return 0;let Be=0;if(ye===Ke||!Ke.contains(ye))return Be;let Tt=ye.previousSibling;for(;Tt;)Be+=Lg(Tt),Tt=Tt.previousSibling;return Be+Nw(Ke,ye.parentNode)}let gp=(Ke,ye)=>{let Be=!0,Tt=[],Ht=document.createRange();Ht.selectNodeContents(window.document.getElementById("findStart"));let Do=window.getSelection();Do?.removeAllRanges(),Do?.addRange(Ht),_i.toggleDragDropEnabled(!1);try{for(document.designMode="On";Be&&Tt.length<500;)if(Be=window.find(Ke,!!ye.caseSensitive,!1,!1,!!ye.wholeWord,!0,!1),Be){let io=window.getSelection();if(!io){console.log("no selection");break}if(ye.includeMarkup&&io.rangeCount>0&&io.getRangeAt(0).startContainer.nodeType===1&&io.getRangeAt(0).startContainer.classList.contains("markup")){let oo=io.anchorNode?.firstChild,Gr=oo.shadowRoot,Sa=Gr?.getSelection?Gr?.getSelection():null;Sa&&Sa.anchorNode&&Tt.push({type:"preview",id:oo.id,cellId:oo.id,container:oo,isShadow:!0,originalRange:Sa.getRangeAt(0),searchPreviewInfo:ye.shouldGetSearchPreviewInfo?Uv(Sa):void 0})}if(ye.includeOutput&&io.rangeCount>0&&io.getRangeAt(0).startContainer.nodeType===1&&io.getRangeAt(0).startContainer.classList.contains("output_container")){let oo=io.getRangeAt(0).startContainer.parentElement.id,Gr=io.anchorNode?.firstChild,Sa=Gr.shadowRoot,_r=Sa?.getSelection?Sa?.getSelection():null;_r&&_r.anchorNode&&Tt.push({type:"output",id:Gr.id,cellId:oo,container:Gr,isShadow:!0,originalRange:_r.getRangeAt(0),searchPreviewInfo:ye.shouldGetSearchPreviewInfo?Uv(_r):void 0})}let xr=io.anchorNode?.parentElement;if(xr){let oo=Tt.length?Tt[Tt.length-1]:null;if(oo&&oo.container.contains(xr)&&ye.includeOutput)Tt.push({type:oo.type,id:oo.id,cellId:oo.cellId,container:oo.container,isShadow:!1,originalRange:io.getRangeAt(0),searchPreviewInfo:ye.shouldGetSearchPreviewInfo?Uv(io):void 0});else for(let Gr=xr;Gr&&Gr instanceof Element;Gr=Gr.parentElement){if(Gr.classList.contains("output")&&ye.includeOutput){let Sa=Gr.parentElement?.parentElement?.id;Sa&&Tt.push({type:"output",id:Gr.id,cellId:Sa,container:Gr,isShadow:!1,originalRange:io.getRangeAt(0),searchPreviewInfo:ye.shouldGetSearchPreviewInfo?Uv(io):void 0});break}if(Gr.id==="container"||Gr===window.document.body)break}}else break}}catch(io){console.log(io)}Tt=Tt.filter(io=>ye.findIds.length?ye.findIds.includes(io.cellId):!0),Rp.addHighlights(Tt,ye.ownerID),window.document.getSelection()?.removeAllRanges(),_i.toggleDragDropEnabled(r.dragAndDropEnabled),document.designMode="Off",wo("didFind",{matches:Tt.map((io,xr)=>({type:io.type,id:io.id,cellId:io.cellId,index:xr,searchPreviewInfo:io.searchPreviewInfo}))})},uf=async(Ke,ye,Be,Tt=5)=>{if(!window.document.hasFocus()&&Tt>0){setTimeout(()=>{uf(Ke,ye,Be,Tt-1)},50);return}try{let Ht=window.document.getElementById(Ke)??window.document.getElementById(ye),Do=Ht?.querySelector("img");if(!Do){let io=Ht?.querySelector("svg.output-image")??Ht?.querySelector("div.svgContainerStyle > svg");io&&(Do=new Image,Do.src="data:image/svg+xml,"+encodeURIComponent(io.outerHTML))}if(Do){let xr=await(Gr=>new Promise((Sa,_r)=>{Gr.complete&&Gr.naturalWidth>0?Sa(Gr):(Gr.onload=()=>Sa(Gr),Gr.onerror=()=>_r(new Error("Failed to load image")),setTimeout(()=>_r(new Error("Image load timeout")),5e3))}))(Do),oo={"image/png":new Promise(Gr=>{let Sa=document.createElement("canvas");Sa.width=xr.naturalWidth,Sa.height=xr.naturalHeight,Sa.getContext("2d").drawImage(xr,0,0),Sa.toBlob(sl=>{sl?Gr(sl):console.error("No blob data to write to clipboard"),Sa.remove()},"image/png")})};if(Be)for(let Gr of Be)oo[Gr.mimeType]=Gr.content;await navigator.clipboard.write([new ClipboardItem(oo)])}else console.error("Could not find image element to copy for output with id",Ke)}catch(Ht){console.error("Could not copy image:",Ht)}};window.addEventListener("message",async Ke=>{let ye=Ke;switch(ye.data.type){case"initializeMarkup":{try{await Promise.all(ye.data.cells.map(Be=>_i.ensureMarkupCell(Be)))}finally{de.updateImmediately(),wo("initializedMarkup",{requestId:ye.data.requestId})}break}case"createMarkupCell":_i.ensureMarkupCell(ye.data.cell);break;case"showMarkupCell":_i.showMarkupCell(ye.data.id,ye.data.top,ye.data.content,ye.data.metadata);break;case"hideMarkupCells":for(let Be of ye.data.ids)_i.hideMarkupCell(Be);break;case"unhideMarkupCells":for(let Be of ye.data.ids)_i.unhideMarkupCell(Be);break;case"deleteMarkupCell":for(let Be of ye.data.ids)_i.deleteMarkupCell(Be);break;case"updateSelectedMarkupCells":_i.updateSelectedCells(ye.data.selectedCellIds);break;case"html":{let Be=ye.data;Be.createOnIdle?II.enqueueIdle(Be.outputId,Tt=>_i.renderOutputCell(Be,Tt)):II.enqueue(Be.outputId,Tt=>_i.renderOutputCell(Be,Tt));break}case"view-scroll":{ye.data.widgets.forEach(Be=>{II.enqueue(Be.outputId,()=>{_i.updateOutputsScroll([Be])})}),_i.updateMarkupScrolls(ye.data.markupCells);break}case"clear":Ut.clearAll(),_i.clearAll(),window.document.getElementById("container").innerText="";break;case"clearOutput":{let{cellId:Be,rendererId:Tt,outputId:Ht}=ye.data;II.cancelOutput(Ht),_i.clearOutput(Be,Ht,Tt);break}case"hideOutput":{let{cellId:Be,outputId:Tt}=ye.data;II.enqueue(Tt,()=>{_i.hideOutput(Be)});break}case"showOutput":{let{outputId:Be,cellTop:Tt,cellId:Ht,content:Do}=ye.data;II.enqueue(Be,()=>{_i.showOutput(Ht,Be,Tt),Do&&_i.updateAndRerender(Ht,Be,Do)});break}case"copyImage":{await uf(ye.data.outputId,ye.data.altOutputId,ye.data.textAlternates);break}case"ack-dimension":{for(let{cellId:Be,outputId:Tt,height:Ht}of ye.data.updates)_i.updateOutputHeight(Be,Tt,Ht);break}case"preload":{let Be=ye.data.resources;for(let{uri:Tt}of Be)ax.load(Tt);break}case"updateRenderers":{let{rendererData:Be}=ye.data;Ut.updateRendererData(Be);break}case"focus-output":Ti(ye.data.cellOrOutputId,ye.data.alternateId);break;case"blur-output":k();break;case"select-output-contents":T(ye.data.cellOrOutputId);break;case"select-input-contents":N(ye.data.cellOrOutputId);break;case"decorations":{let Be=window.document.getElementById(ye.data.cellId);Be||(_i.ensureOutputCell(ye.data.cellId,-1e5,!0),Be=window.document.getElementById(ye.data.cellId)),Be?.classList.add(...ye.data.addedClassNames),Be?.classList.remove(...ye.data.removedClassNames);break}case"markupDecorations":{let Be=window.document.getElementById(ye.data.cellId);Be&&(Be?.classList.add(...ye.data.addedClassNames),Be?.classList.remove(...ye.data.removedClassNames));break}case"customKernelMessage":Id.fire(ye.data.message);break;case"customRendererMessage":Ut.getRenderer(ye.data.rendererId)?.receiveMessage(ye.data.message);break;case"notebookStyles":{let Be=window.document.documentElement.style;for(let Tt=Be.length-1;Tt>=0;Tt--){let Ht=Be[Tt];Ht&&Ht.startsWith("--notebook-")&&Be.removeProperty(Ht)}for(let[Tt,Ht]of Object.entries(ye.data.styles))Be.setProperty(`--${Tt}`,Ht);break}case"notebookOptions":r=ye.data.options,_i.toggleDragDropEnabled(r.dragAndDropEnabled),l=ye.data.renderOptions,c.fire(l);break;case"tokenizedCodeBlock":{let{codeBlockId:Be,html:Tt}=ye.data;eo.highlightCodeBlock(Be,Tt);break}case"tokenizedStylesChanged":{h.replaceSync(ye.data.css);break}case"find":{Rp.removeHighlights(ye.data.options.ownerID),gp(ye.data.query,ye.data.options);break}case"findHighlightCurrent":{Rp?.highlightCurrentMatch(ye.data.index,ye.data.ownerID);break}case"findUnHighlightCurrent":{Rp?.unHighlightCurrentMatch(ye.data.index,ye.data.ownerID);break}case"findStop":{Rp.removeHighlights(ye.data.ownerID);break}case"returnOutputItem":en.resolveOutputItem(ye.data.requestId,ye.data.output)}});let KG="vscode.fallbackToNextRenderer";class e6{constructor(ye){this.data=ye;this._onMessageEvent=sr()}receiveMessage(ye){this._onMessageEvent.fire(ye)}async renderOutputItem(ye,Be,Tt){try{await this.load()}catch(Ht){Tt.aborted||ln(`Error loading renderer '${this.data.id}'`,Be,Ht instanceof Error?[Ht]:[]);return}if(!this._api){Tt.aborted||ln(`Renderer '${this.data.id}' does not implement renderOutputItem`,Be,[]);return}try{let Ht=performance.now();await this._api.renderOutputItem(ye,Be,Tt),this.postDebugMessage("Rendered output item",{id:ye.id,duration:`${performance.now()-Ht}ms`})}catch(Ht){if(Tt.aborted)return;if(Ht instanceof Error&&Ht.name===KG)throw Ht;ln(`Error rendering output item using '${this.data.id}'`,Be,Ht instanceof Error?[Ht]:[]),this.postDebugMessage("Rendering output item failed",{id:ye.id,error:Ht+""})}}disposeOutputItem(ye){this._api?.disposeOutputItem?.(ye)}createRendererContext(){let{id:ye,messaging:Be}=this.data,Tt={setState:Ht=>p.setState({...p.getState(),[ye]:Ht}),getState:()=>{let Ht=p.getState();return typeof Ht=="object"&&Ht?Ht[ye]:void 0},getRenderer:async Ht=>{let Do=Ut.getRenderer(Ht);if(Do)return Do._api?Do._api:Do.load()},workspace:{get isTrusted(){return s}},settings:{get lineLimit(){return l.lineLimit},get outputScrolling(){return l.outputScrolling},get outputWordWrap(){return l.outputWordWrap},get linkifyFilePaths(){return l.linkifyFilePaths},get minimalError(){return l.minimalError}},get onDidChangeSettings(){return c.event}};return Be&&(Tt.onDidReceiveMessage=this._onMessageEvent.event,Tt.postMessage=Ht=>wo("customRendererMessage",{rendererId:ye,message:Ht})),Object.freeze(Tt)}load(){return this._loadPromise??=this._load(),this._loadPromise}async _load(){this.postDebugMessage("Start loading renderer");try{await ax.waitForAllCurrent();let ye=performance.now(),Be=await __import(this.data.entrypoint.path);if(this.postDebugMessage("Imported renderer",{duration:`${performance.now()-ye}ms`}),!Be)return;this._api=await Be.activate(this.createRendererContext()),this.postDebugMessage("Activated renderer",{duration:`${performance.now()-ye}ms`});let Tt=a.rendererData.filter(Ht=>Ht.entrypoint.extends===this.data.id);return Tt.length&&this.postDebugMessage("Activating dependant renderers",{dependents:Tt.map(Ht=>Ht.id).join(", ")}),await Promise.all(Tt.map(async Ht=>{let Do=Ut.getRenderer(Ht.id);if(!Do)throw new Error(`Could not find extending renderer: ${Ht.id}`);try{return await Do.load()}catch(io){console.error(io),this.postDebugMessage("Activating dependant renderer failed",{dependent:Ht.id,error:io+""});return}})),this._api}catch(ye){throw this.postDebugMessage("Loading renderer failed"),ye}}postDebugMessage(ye,Be){wo("logRendererDebugMessage",{message:`[renderer ${this.data.id}] - ${ye}`,data:Be})}}let ax=new class{constructor(){this.preloads=new Map}waitFor(Ke){return this.preloads.get(Ke)||Promise.resolve(new Error(`Preload not ready: ${Ke}`))}load(Ke){let ye=Promise.all([te(Ke),this.waitForAllCurrent()]);return this.preloads.set(Ke,ye),ye}waitForAllCurrent(){return Promise.all([...this.preloads.values()].map(Ke=>Ke.catch(ye=>ye)))}},II=new class{constructor(){this.outputs=new Map;this.pendingOutputCreationRequest=new Map}enqueue(Ke,ye){this.pendingOutputCreationRequest.get(Ke)?.dispose(),this.pendingOutputCreationRequest.delete(Ke);let Be=this.outputs.get(Ke);if(Be)Be.queue=Be.queue.then(async Tt=>{Be.abort.signal.aborted||await ye(Be.abort.signal)});else{let Tt=new AbortController;this.outputs.set(Ke,{abort:Tt,queue:new Promise(Ht=>Ht(ye(Tt.signal)))})}}enqueueIdle(Ke,ye){this.pendingOutputCreationRequest.get(Ke)?.dispose(),II.pendingOutputCreationRequest.set(Ke,g(()=>{II.enqueue(Ke,ye),II.pendingOutputCreationRequest.delete(Ke)}))}cancelAll(){this.pendingOutputCreationRequest.forEach(Ke=>Ke.dispose()),this.pendingOutputCreationRequest.clear();for(let{abort:Ke}of this.outputs.values())Ke.abort();this.outputs.clear()}cancelOutput(Ke){this.pendingOutputCreationRequest.get(Ke)?.dispose(),this.pendingOutputCreationRequest.delete(Ke);let ye=this.outputs.get(Ke);ye&&(ye.abort.abort(),this.outputs.delete(Ke))}},Ut=new class{constructor(){this._renderers=new Map;for(let Ke of a.rendererData)this.addRenderer(Ke)}getRenderer(Ke){return this._renderers.get(Ke)}rendererEqual(Ke,ye){if(Ke.id!==ye.id||Ke.entrypoint.path!==ye.entrypoint.path||Ke.entrypoint.extends!==ye.entrypoint.extends||Ke.messaging!==ye.messaging||Ke.mimeTypes.length!==ye.mimeTypes.length)return!1;for(let Be=0;Be<Ke.mimeTypes.length;Be++)if(Ke.mimeTypes[Be]!==ye.mimeTypes[Be])return!1;return!0}updateRendererData(Ke){let ye=new Set(this._renderers.keys()),Be=new Set(Ke.map(Tt=>Tt.id));for(let Tt of Ke){let Ht=this._renderers.get(Tt.id);Ht&&this.rendererEqual(Ht.data,Tt)||this.addRenderer(Tt)}for(let Tt of ye)Be.has(Tt)||this._renderers.delete(Tt)}addRenderer(Ke){this._renderers.set(Ke.id,new e6(Ke))}clearAll(){II.cancelAll();for(let Ke of this._renderers.values())Ke.disposeOutputItem()}clearOutput(Ke,ye){II.cancelOutput(ye),this._renderers.get(Ke)?.disposeOutputItem(ye)}async render(Ke,ye,Be,Tt){let Ht=this.findRenderer(ye,Ke);if(!Ht){let io=(window.document.documentElement.style.getPropertyValue("--notebook-cell-renderer-not-found-error")||"").replace("$0",()=>Ke.mime);this.showRenderError(Ke,Be,io);return}if(!(await this._doRender(Ke,Be,Ht,Tt)).continue)return;for(let io of Ke._allOutputItems){if(io.mime===Ke.mime)continue;let xr=await io.getItem();if(Tt.aborted)return;if(xr){let oo=this.findRenderer(void 0,xr);if(oo&&!(await this._doRender(xr,Be,oo,Tt)).continue)return}}let Do=(window.document.documentElement.style.getPropertyValue("--notebook-cell-renderer-fallbacks-exhausted")||"").replace("$0",()=>Ke.mime);this.showRenderError(Ke,Be,Do)}async _doRender(Ke,ye,Be,Tt){try{return await Be.renderOutputItem(Ke,ye,Tt),{continue:!1}}catch(Ht){if(Tt.aborted)return{continue:!1};if(Ht instanceof Error&&Ht.name===KG)return{continue:!0};throw Ht}}findRenderer(Ke,ye){let Be;if(typeof Ke=="string")Be=Array.from(this._renderers.values()).find(Tt=>Tt.data.id===Ke);else{let Tt=Array.from(this._renderers.values()).filter(Ht=>Ht.data.mimeTypes.includes(ye.mime)&&!Ht.data.entrypoint.extends);Tt.length&&(Tt.sort((Ht,Do)=>+Ht.data.isBuiltin-+Do.data.isBuiltin),Be=Tt[0])}return Be}showRenderError(Ke,ye,Be){let Tt=document.createElement("div"),Ht=document.createElement("div");Ht.className="no-renderer-error",Ht.innerText=Be;let Do=document.createElement("div");Do.innerText=Ke.text(),Tt.appendChild(Ht),Tt.appendChild(Do),ye.innerText="",ye.appendChild(Tt)}},_i=new class{constructor(){this._markupCells=new Map;this._outputCells=new Map}clearAll(){for(let ye of this._markupCells.values())ye.dispose();this._markupCells.clear();for(let ye of this._outputCells.values())ye.dispose();this._outputCells.clear()}async createMarkupCell(ye,Be,Tt){let Ht=this._markupCells.get(ye.cellId);if(Ht)return console.error(`Trying to create markup that already exists: ${ye.cellId}`),Ht;let Do=new Ar(ye.cellId,ye.mime,ye.content,Be,ye.metadata);return Do.element.style.visibility=Tt?"":"hidden",this._markupCells.set(ye.cellId,Do),await Do.ready,Do}async ensureMarkupCell(ye){let Be=this._markupCells.get(ye.cellId);Be?(Be.element.style.visibility=ye.visible?"":"hidden",await Be.updateContentAndRender(ye.content,ye.metadata)):Be=await this.createMarkupCell(ye,ye.offset,ye.visible)}deleteMarkupCell(ye){let Be=this.getExpectedMarkupCell(ye);Be&&(Be.remove(),Be.dispose(),this._markupCells.delete(ye))}async updateMarkupContent(ye,Be,Tt){await this.getExpectedMarkupCell(ye)?.updateContentAndRender(Be,Tt)}showMarkupCell(ye,Be,Tt,Ht){this.getExpectedMarkupCell(ye)?.show(Be,Tt,Ht)}hideMarkupCell(ye){this.getExpectedMarkupCell(ye)?.hide()}unhideMarkupCell(ye){this.getExpectedMarkupCell(ye)?.unhide()}getExpectedMarkupCell(ye){let Be=this._markupCells.get(ye);if(!Be){console.log(`Could not find markup cell '${ye}'`);return}return Be}updateSelectedCells(ye){let Be=new Set(ye);for(let Tt of this._markupCells.values())Tt.setSelected(Be.has(Tt.id))}toggleDragDropEnabled(ye){for(let Be of this._markupCells.values())Be.toggleDragDropEnabled(ye)}updateMarkupScrolls(ye){for(let{id:Be,top:Tt}of ye){let Ht=this._markupCells.get(Be);Ht&&(Ht.element.style.top=`${Tt}px`)}}async renderOutputCell(ye,Be){let Tt=await Promise.all(ye.requiredPreloads.map(Do=>ax.waitFor(Do.uri).then(()=>{},io=>io)));return Be.aborted?void 0:this.ensureOutputCell(ye.cellId,ye.cellTop,!1).renderOutputElement(ye,Tt,Be)}ensureOutputCell(ye,Be,Tt){let Ht=this._outputCells.get(ye),Do=!!Ht;return Ht||(Ht=new na(ye),this._outputCells.set(ye,Ht)),Do&&Tt||(Ht.element.style.top=Be+"px"),Ht}clearOutput(ye,Be,Tt){this._outputCells.get(ye)?.clearOutput(Be,Tt)}showOutput(ye,Be,Tt){this._outputCells.get(ye)?.show(Be,Tt)}updateAndRerender(ye,Be,Tt){this._outputCells.get(ye)?.updateContentAndRerender(Be,Tt)}hideOutput(ye){this._outputCells.get(ye)?.hide()}updateOutputHeight(ye,Be,Tt){this._outputCells.get(ye)?.updateOutputHeight(Be,Tt)}updateOutputsScroll(ye){for(let Be of ye)this._outputCells.get(Be.cellId)?.updateScroll(Be)}};class eo{static{this.pendingCodeBlocksToHighlight=new Map}static highlightCodeBlock(ye,Be){let Tt=eo.pendingCodeBlocksToHighlight.get(ye);if(!Tt)return;let Ht=Dg?.createHTML(Be)??Be;Tt.innerHTML=Ht;let Do=Tt.getRootNode();Do instanceof ShadowRoot&&(Do.adoptedStyleSheets.includes(h)||Do.adoptedStyleSheets.push(h))}static requestHighlightCodeBlock(ye){let Be=[],Tt=0;for(let Ht of ye.querySelectorAll(".vscode-code-block")){let Do=Ht.getAttribute("data-vscode-code-block-lang");if(Ht.textContent&&Do){let io=`${Date.now()}-${Tt++}`;Be.push({value:Ht.textContent,lang:Do,id:io}),eo.pendingCodeBlocksToHighlight.set(io,Ht)}}return Be}}class Ar{constructor(ye,Be,Tt,Ht,Do){this._isDisposed=!1;let io=this;this.id=ye,this._content={value:Tt,version:0,metadata:Do};let{promise:xr,resolve:oo,reject:Gr}=n();this.ready=xr;let Sa;this.outputItem=Object.freeze({id:ye,mime:Be,get metadata(){return io._content.metadata},text:()=>this._content.value,json:()=>{},data:()=>{if(Sa?.version===this._content.version)return Sa.value;let Dd=t.encode(this._content.value);return Sa={version:this._content.version,value:Dd},Dd},blob(){return new Blob([this.data()],{type:this.mime})},_allOutputItems:[{mime:Be,getItem:async()=>this.outputItem}]});let _r=window.document.getElementById("container"),sl=document.createElement("div");sl.className="markup",sl.style.position="absolute",sl.style.width="100%",this.element=document.createElement("div"),this.element.id=this.id,this.element.classList.add("preview"),this.element.style.position="absolute",this.element.style.top=Ht+"px",this.toggleDragDropEnabled(r.dragAndDropEnabled),sl.appendChild(this.element),_r.appendChild(sl),this.addEventListeners(),this.updateContentAndRender(this._content.value,this._content.metadata).then(()=>{this._isDisposed||Se.observe(this.element,this.id,!1,this.id),oo()},()=>Gr())}dispose(){this._isDisposed=!0,this.renderTaskAbort?.abort(),this.renderTaskAbort=void 0}addEventListeners(){this.element.addEventListener("dblclick",()=>{wo("toggleMarkupPreview",{cellId:this.id})}),this.element.addEventListener("click",ye=>{wo("clickMarkupCell",{cellId:this.id,altKey:ye.altKey,ctrlKey:ye.ctrlKey,metaKey:ye.metaKey,shiftKey:ye.shiftKey})}),this.element.addEventListener("contextmenu",ye=>{wo("contextMenuMarkupCell",{cellId:this.id,clientX:ye.clientX,clientY:ye.clientY})}),this.element.addEventListener("mouseenter",()=>{wo("mouseEnterMarkupCell",{cellId:this.id})}),this.element.addEventListener("mouseleave",()=>{wo("mouseLeaveMarkupCell",{cellId:this.id})}),this.element.addEventListener("dragstart",ye=>{Pt.startDrag(ye,this.id)}),this.element.addEventListener("drag",ye=>{Pt.updateDrag(ye,this.id)}),this.element.addEventListener("dragend",ye=>{Pt.endDrag(ye,this.id)})}async updateContentAndRender(ye,Be){this._content={value:ye,version:this._content.version+1,metadata:Be},this.renderTaskAbort?.abort();let Tt=new AbortController;this.renderTaskAbort=Tt;try{await Ut.render(this.outputItem,void 0,this.element,this.renderTaskAbort.signal)}finally{this.renderTaskAbort===Tt&&(this.renderTaskAbort=void 0)}let Ht=this.element.shadowRoot??this.element,Do=[];for(let xr of Ht.children)switch(xr.tagName){case"LINK":case"SCRIPT":case"STYLE":break;default:Do.push(xr.outerHTML);break}let io=eo.requestHighlightCodeBlock(Ht);wo("renderedMarkup",{cellId:this.id,html:Do.join(""),codeBlocks:io}),de.updateHeight(this.id,this.element.offsetHeight,{isOutput:!1})}show(ye,Be,Tt){this.element.style.visibility="",this.element.style.top=`${ye}px`,typeof Be=="string"||Tt?this.updateContentAndRender(Be??this._content.value,Tt??this._content.metadata):this.updateMarkupDimensions()}hide(){this.element.style.visibility="hidden"}unhide(){this.element.style.visibility="",this.updateMarkupDimensions()}remove(){this.element.remove()}async updateMarkupDimensions(){de.updateHeight(this.id,this.element.offsetHeight,{isOutput:!1})}setSelected(ye){this.element.classList.toggle("selected",ye)}toggleDragDropEnabled(ye){ye?(this.element.classList.add("draggable"),this.element.setAttribute("draggable","true")):(this.element.classList.remove("draggable"),this.element.removeAttribute("draggable"))}}class na{constructor(ye){this.outputElements=new Map;let Be=window.document.getElementById("container"),Tt=ti(ye);Be.appendChild(Tt),this.element=document.createElement("div"),this.element.style.position="absolute",this.element.style.outline="0",this.element.id=ye,this.element.classList.add("cell_container"),Be.appendChild(this.element),this.element=this.element;let Ht=ti(ye,!0);Be.appendChild(Ht)}dispose(){for(let ye of this.outputElements.values())ye.dispose();this.outputElements.clear()}createOutputElement(ye){let Be=this.outputElements.get(ye.outputId);return Be||(Be=new Rg(ye.outputId),this.element.appendChild(Be.element),this.outputElements.set(ye.outputId,Be)),Be.createOutputElement(ye.outputId,ye.outputOffset,ye.left,ye.cellId)}async renderOutputElement(ye,Be,Tt){let Ht=Date.now(),Do=this.createOutputElement(ye);if(await Do.render(ye.content,ye.rendererId,Be,Tt),Do.element.style.visibility=ye.initiallyHidden?"hidden":"",ye.executionId&&ye.rendererId){let io;ye.content.type===1&&(io=ye.content.output.valueBytes.length),io!==void 0&&io>0&&io<100*1024&&wo("notebookPerformanceMessage",{cellId:ye.cellId,executionId:ye.executionId,duration:Date.now()-Ht,rendererId:ye.rendererId,outputSize:io})}}clearOutput(ye,Be){let Tt=this.outputElements.get(ye);Tt?.clear(Be),Tt?.dispose(),this.outputElements.delete(ye)}show(ye,Be){this.outputElements.get(ye)&&(this.element.style.visibility="",this.element.style.top=`${Be}px`)}hide(){this.element.style.visibility="hidden"}updateContentAndRerender(ye,Be){this.outputElements.get(ye)?.updateContentAndRender(Be)}updateOutputHeight(ye,Be){this.outputElements.get(ye)?.updateHeight(Be)}updateScroll(ye){this.element.style.top=`${ye.cellTop}px`;let Be=this.outputElements.get(ye.outputId);Be&&(Be.updateScroll(ye.outputOffset),ye.forceDisplay&&Be.outputNode&&(Be.outputNode.element.style.visibility="")),ye.forceDisplay&&(this.element.style.visibility="")}}class Rg{constructor(ye){this.outputId=ye;this.element=document.createElement("div"),this.element.classList.add("output_container"),this.element.setAttribute("data-vscode-context",JSON.stringify({preventDefaultContextMenuItems:!0})),this.element.style.position="absolute",this.element.style.overflow="hidden"}get outputNode(){return this._outputNode}dispose(){this._outputNode?.dispose()}clear(ye){ye&&Ut.clearOutput(ye,this.outputId),this.element.remove()}updateHeight(ye){this.element.style.maxHeight=`${ye}px`,this.element.style.height=`${ye}px`}updateScroll(ye){this.element.style.top=`${ye}px`}createOutputElement(ye,Be,Tt,Ht){return this.element.innerText="",this.element.style.maxHeight="0px",this.element.style.top=`${Be}px`,this._outputNode?.dispose(),this._outputNode=new tn(ye,Tt,Ht),this.element.appendChild(this._outputNode.element),this._outputNode}updateContentAndRender(ye){this._outputNode?.updateAndRerender(ye)}}p.postMessage({__vscode_notebook_message:!0,type:"initialized"});for(let Ke of a.staticPreloadsData)ax.load(Ke.entrypoint);function wo(Ke,ye){p.postMessage({__vscode_notebook_message:!0,type:Ke,...ye})}class tn{constructor(ye,Be,Tt){this.outputId=ye;this.cellId=Tt;this.hasResizeObserver=!1;this.isImageOutput=!1;this.element=document.createElement("div"),this.element.id=ye,this.element.classList.add("output"),this.element.style.position="absolute",this.element.style.top="0px",this.element.style.left=Be+"px",this.element.style.padding=`${a.style.outputNodePadding}px ${a.style.outputNodePadding}px ${a.style.outputNodePadding}px ${a.style.outputNodeLeftPadding}`,this.element.addEventListener("mouseenter",()=>{wo("mouseenter",{id:ye})}),this.element.addEventListener("mouseleave",()=>{wo("mouseleave",{id:ye})}),this.element.addEventListener("dragstart",Ht=>{if(!Ht.dataTransfer)return;let Do={outputId:this.outputId};Ht.dataTransfer.setData("notebook-cell-output",JSON.stringify(Do))}),window.addEventListener("keydown",Ht=>{Ht.altKey&&(this.element.draggable=!0)}),window.addEventListener("keyup",Ht=>{Ht.altKey||(this.element.draggable=this.isImageOutput)}),window.addEventListener("blur",()=>{this.element.draggable=this.isImageOutput})}dispose(){this.renderTaskAbort?.abort(),this.renderTaskAbort=void 0}async render(ye,Be,Tt,Ht){if(this.renderTaskAbort?.abort(),this.renderTaskAbort=void 0,this._content={preferredRendererId:Be,preloadErrors:Tt},ye.type===0){let _r=Dg?.createHTML(ye.htmlContent)??ye.htmlContent;this.element.innerHTML=_r}else if(Tt.some(_r=>_r instanceof Error)){let _r=Tt.filter(sl=>sl instanceof Error);ln("Error loading preloads",this.element,_r)}else{let _r=["image/png","image/jpeg","image/svg"];this.isImageOutput=_r.includes(ye.output.mime),this.element.draggable=this.isImageOutput;let sl=ba(this.outputId,ye.output.mime,ye.metadata,ye.output.valueBytes,ye.allOutputs,ye.output.appended),Dd=new AbortController;this.renderTaskAbort=Dd,Ht?.addEventListener("abort",()=>Dd.abort());try{await Ut.render(sl,Be,this.element,Dd.signal)}finally{this.renderTaskAbort===Dd&&(this.renderTaskAbort=void 0)}}this.hasResizeObserver||(this.hasResizeObserver=!0,Se.observe(this.element,this.outputId,!0,this.cellId));let Do=this.element.offsetHeight,io=document.defaultView.getComputedStyle(this.element),xr=parseFloat(io.paddingTop)+parseFloat(io.paddingBottom),oo=Do-xr;se(oo)&&io.padding==="0px"?(de.updateHeight(this.outputId,Do+a.style.outputNodePadding*2,{isOutput:!0,init:!0}),this.element.style.padding=`${a.style.outputNodePadding}px ${a.style.outputNodePadding}px ${a.style.outputNodePadding}px ${a.style.outputNodeLeftPadding}`):se(oo)?(de.updateHeight(this.outputId,this.element.offsetHeight,{isOutput:!0,init:!0}),this.element.style.padding=`0 ${a.style.outputNodePadding}px 0 ${a.style.outputNodeLeftPadding}`):de.updateHeight(this.outputId,0,{isOutput:!0,init:!0});let Gr=this.element.shadowRoot??this.element,Sa=eo.requestHighlightCodeBlock(Gr);Sa.length>0&&wo("renderedCellOutput",{codeBlocks:Sa})}updateAndRerender(ye){this._content&&this.render(ye,this._content.preferredRendererId,this._content.preloadErrors)}}let Pt=new class{constructor(){window.document.addEventListener("dragover",ye=>{ye.preventDefault()}),window.document.addEventListener("drop",ye=>{ye.preventDefault();let Be=this.currentDrag;Be&&(this.currentDrag=void 0,wo("cell-drop",{cellId:Be.cellId,ctrlKey:ye.ctrlKey,altKey:ye.altKey,dragOffsetY:ye.clientY}))})}startDrag(ye,Be){if(!ye.dataTransfer||!r.dragAndDropEnabled)return;this.currentDrag={cellId:Be,clientY:ye.clientY};let Tt=9999;this.dragOverlay||(this.dragOverlay=document.createElement("div"),this.dragOverlay.style.position="absolute",this.dragOverlay.style.top="0",this.dragOverlay.style.left="0",this.dragOverlay.style.zIndex=`${Tt}`,this.dragOverlay.style.width="100%",this.dragOverlay.style.height="100%",this.dragOverlay.style.background="transparent",window.document.body.appendChild(this.dragOverlay)),ye.target.style.zIndex=`${Tt+1}`,ye.target.classList.add("dragging"),wo("cell-drag-start",{cellId:Be,dragOffsetY:ye.clientY});let Ht=()=>{this.currentDrag?.cellId===Be&&(wo("cell-drag",{cellId:Be,dragOffsetY:this.currentDrag.clientY}),window.requestAnimationFrame(Ht))};window.requestAnimationFrame(Ht)}updateDrag(ye,Be){Be!==this.currentDrag?.cellId?this.currentDrag=void 0:this.currentDrag={cellId:Be,clientY:ye.clientY}}endDrag(ye,Be){this.currentDrag=void 0,ye.target.classList.remove("dragging"),wo("cell-drag-end",{cellId:Be}),this.dragOverlay&&(this.dragOverlay.remove(),this.dragOverlay=void 0),ye.target.style.zIndex=""}}}function tco(a,i,e,t,o,n,r){return`
const __import = (x) => import(x);
(${m8o})(
JSON.parse(decodeURIComponent("${encodeURIComponent(JSON.stringify({style:a,options:i,renderOptions:e,rendererData:t,staticPreloadsData:o,isWorkspaceTrusted:n,nonce:r}))}"))
)
//# sourceURL=notebookWebviewPreloads.js
`}var h8o=new Map([["theme-font-family","vscode-font-family"],["theme-font-weight","vscode-font-weight"],["theme-font-size","vscode-font-size"],["theme-code-font-family","vscode-editor-font-family"],["theme-code-font-weight","vscode-editor-font-weight"],["theme-code-font-size","vscode-editor-font-size"],["theme-scrollbar-background","vscode-scrollbarSlider-background"],["theme-scrollbar-hover-background","vscode-scrollbarSlider-hoverBackground"],["theme-scrollbar-active-background","vscode-scrollbarSlider-activeBackground"],["theme-quote-background","vscode-textBlockQuote-background"],["theme-quote-border","vscode-textBlockQuote-border"],["theme-code-foreground","vscode-textPreformat-foreground"],["theme-code-background","vscode-textPreformat-background"],["theme-background","vscode-editor-background"],["theme-foreground","vscode-editor-foreground"],["theme-ui-foreground","vscode-foreground"],["theme-link","vscode-textLink-foreground"],["theme-link-active","vscode-textLink-activeForeground"],["theme-button-background","vscode-button-background"],["theme-button-hover-background","vscode-button-hoverBackground"],["theme-button-foreground","vscode-button-foreground"],["theme-button-secondary-background","vscode-button-secondaryBackground"],["theme-button-secondary-hover-background","vscode-button-secondaryHoverBackground"],["theme-button-secondary-foreground","vscode-button-secondaryForeground"],["theme-button-hover-foreground","vscode-button-foreground"],["theme-button-focus-foreground","vscode-button-foreground"],["theme-button-secondary-hover-foreground","vscode-button-secondaryForeground"],["theme-button-secondary-focus-foreground","vscode-button-secondaryForeground"],["theme-input-background","vscode-input-background"],["theme-input-foreground","vscode-input-foreground"],["theme-input-placeholder-foreground","vscode-input-placeholderForeground"],["theme-input-focus-border-color","vscode-focusBorder"],["theme-menu-background","vscode-menu-background"],["theme-menu-foreground","vscode-menu-foreground"],["theme-menu-hover-background","vscode-menu-selectionBackground"],["theme-menu-focus-background","vscode-menu-selectionBackground"],["theme-menu-hover-foreground","vscode-menu-selectionForeground"],["theme-menu-focus-foreground","vscode-menu-selectionForeground"],["theme-error-background","vscode-inputValidation-errorBackground"],["theme-error-foreground","vscode-foreground"],["theme-warning-background","vscode-inputValidation-warningBackground"],["theme-warning-foreground","vscode-foreground"],["theme-info-background","vscode-inputValidation-infoBackground"],["theme-info-foreground","vscode-foreground"],["theme-notebook-output-background","vscode-notebook-outputContainerBackgroundColor"],["theme-notebook-output-border","vscode-notebook-outputContainerBorderColor"],["theme-notebook-cell-selected-background","vscode-notebook-selectedCellBackground"],["theme-notebook-symbol-highlight-background","vscode-notebook-symbolHighlightBackground"],["theme-notebook-diff-removed-background","vscode-diffEditor-removedTextBackground"],["theme-notebook-diff-inserted-background","vscode-diffEditor-insertedTextBackground"]]),g8o={"theme-input-border-width":"1px","theme-button-primary-hover-shadow":"none","theme-button-secondary-hover-shadow":"none","theme-input-border-color":"transparent"},ico=a=>{let i={...a,...g8o};for(let[e,t]of h8o)i[e]=a[t];return i};var oco="vscode-cdn.net",owi=`vscode-resource.${oco}`,Gpe=`'self' https://*.${oco}`;function SRe(a,i){return a.scheme===Y.http||a.scheme===Y.https?a:(i&&i.authority&&i.isRemote&&a.scheme===Y.file&&(a=A.from({scheme:Y.vscodeRemote,authority:i.authority,path:a.path})),A.from({scheme:Y.https,authority:`${a.scheme}+${f8o(a.authority)}.${owi}`,path:a.path,fragment:a.fragment,query:a.query}))}function f8o(a){return a.replace(/./g,i=>{let e=i.charCodeAt(0);return e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57?i:"-"+e.toString(16).padStart(4,"0")})}function nco(a){return a.replace(/-([0-9a-f]{4})/g,(i,e)=>String.fromCharCode(parseInt(e,16)))}function yRe(a,i,e=!1){let t=[];for(let n=0;n<i.outputsViewModels.length;n++){let r=i.outputsViewModels[n],s=i.model.outputs[n],[l,c]=r.resolveMimeTypes(a,void 0),u=l[c].mimeType,p=s.outputs.find(g=>g.mime===u);if((!p||u.startsWith("image"))&&(p=s.outputs.find(g=>!g.mime.startsWith("image"))),!p)continue;let h="";if(oL(u)){let{text:g,count:f}=nVt(r);h=g,f>1&&(n+=f-1)}else h=rVt(u,p,e);t.push(h)}let o;return t.length>1?o=t.map((n,r)=>`Cell output ${r+1} of ${t.length}
${n}`).join(`
`):o=t[0]??"",o}function nVt(a){let i="",e=a.cellViewModel,t=e.outputsViewModels.indexOf(a),o=0;for(;t<e.model.outputs.length;){let r=e.model.outputs[t].outputs.find(s=>oL(s.mime));if(!r)break;i=i+rco.decode(r.data.buffer),t=t+1,o++}return{text:i.trim(),count:o}}var rco=new TextDecoder;function rVt(a,i,e=!1){let t=`${a}`,o=1e5;if(t=rco.decode(i.data.slice(0,o).buffer),i.data.byteLength>o)t=t+"...(truncated)";else if(a==="application/vnd.code.notebook.error"){t=t.replace(/\\u001b\[[0-9;]*m/gi,"");try{let n=JSON.parse(t);!n.stack||e?t=`${n.name}: ${n.message}`:t=n.stack}catch{}}return t.trim()}async function sco(a,i,e,t){let o=i.model,n=a&&IRe.includes(a)?o.outputs.find(s=>s.mime===a):o.outputs.find(s=>IRe.includes(s.mime));if(a=n?.mime,!a||!n)return;let r=oL(a)?nVt(i).text:rVt(a,n);try{await e.writeText(r)}catch(s){t.error(`Failed to copy content: ${s}`)}}var IRe=["text/latex","text/html","application/vnd.code.notebook.error","application/vnd.code.notebook.stdout","application/x.notebook.stdout","application/x.notebook.stream","application/vnd.code.notebook.stderr","application/x.notebook.stderr","text/plain","text/markdown","application/json"];var v8o=/:([\d]+)(?::([\d]+))?$/,b8o=/line=(\d+)$/,S8o=/^(.*)#([^#]*)$/,uA=class extends Jd{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N,O,V,U,G){super(U);this.notebookEditor=e;this.id=t;this.notebookViewType=o;this.documentUri=n;this.options=r;this.rendererMessaging=s;this.webviewService=l;this.openerService=c;this.notebookService=u;this.contextService=p;this.environmentService=h;this.fileDialogService=g;this.fileService=f;this.contextMenuService=v;this.contextKeyService=b;this.workspaceTrustManagementService=S;this.configurationService=y;this.languageService=w;this.workspaceContextService=k;this.editorGroupService=T;this.storageService=N;this.pathService=O;this.notebookLogService=V;this.telemetryService=G;this.webview=void 0;this.insetMapping=new Map;this.pendingWebviewIdleCreationRequest=new Map;this.pendingWebviewIdleInsetMapping=new Map;this.reversedPendingWebviewIdleInsetMapping=new Map;this.markupPreviewMapping=new Map;this.hiddenInsetMapping=new Set;this.reversedInsetMapping=new Map;this.localResourceRootsCache=void 0;this._onMessage=this._register(new E);this._preloadsCache=new Set;this.onMessage=this._onMessage.event;this._disposed=!1;this.firstInit=!0;this.nonce=_t();this._logRendererDebugMessage("Creating backlayer webview for notebook"),this.element=document.createElement("div"),this.element.style.height="1400px",this.element.style.position="absolute",s&&(this._register(s),s.receiveMessageHandler=($,te)=>!this.webview||this._disposed?Promise.resolve(!1):(this._sendMessageToWebview({__vscode_notebook_message:!0,type:"customRendererMessage",rendererId:$,message:te}),Promise.resolve(!0))),this._register(S.onDidChangeTrust($=>{let te=this.asWebviewUri(this.getNotebookBaseUri(),void 0),pe=this.generateContent(te.toString());this.webview?.setHtml(pe)})),this._register(kc.onDidChange(()=>{this._sendMessageToWebview({type:"tokenizedStylesChanged",css:lco()})}))}static getOriginStore(e){return this._originStore??=new $j("notebook.backlayerWebview.origins",e),this._originStore}updateOptions(e){this.options=e,this._updateStyles(),this._updateOptions()}_logRendererDebugMessage(e){this.notebookLogService.debug("BacklayerWebview",`${this.documentUri} (${this.id}) - ${e}`)}_updateStyles(){this._sendMessageToWebview({type:"notebookStyles",styles:this._generateStyles()})}_updateOptions(){this._sendMessageToWebview({type:"notebookOptions",options:{dragAndDropEnabled:this.options.dragAndDropEnabled},renderOptions:{lineLimit:this.options.outputLineLimit,outputScrolling:this.options.outputScrolling,outputWordWrap:this.options.outputWordWrap,linkifyFilePaths:this.options.outputLinkifyFilePaths,minimalError:this.options.minimalError}})}_generateStyles(){return{"notebook-output-left-margin":`${this.options.leftMargin+this.options.runGutter}px`,"notebook-output-width":`calc(100% - ${this.options.leftMargin+this.options.rightMargin+this.options.runGutter}px)`,"notebook-output-node-padding":`${this.options.outputNodePadding}px`,"notebook-run-gutter":`${this.options.runGutter}px`,"notebook-preview-node-padding":`${this.options.previewNodePadding}px`,"notebook-markdown-left-margin":`${this.options.markdownLeftMargin}px`,"notebook-output-node-left-padding":`${this.options.outputNodeLeftPadding}px`,"notebook-markdown-min-height":`${this.options.previewNodePadding*2}px`,"notebook-markup-font-size":typeof this.options.markupFontSize=="number"&&this.options.markupFontSize>0?`${this.options.markupFontSize}px`:`calc(${this.options.fontSize}px * 1.2)`,"notebook-markdown-line-height":typeof this.options.markdownLineHeight=="number"&&this.options.markdownLineHeight>0?`${this.options.markdownLineHeight}px`:"normal","notebook-cell-output-font-size":`${this.options.outputFontSize||this.options.fontSize}px`,"notebook-cell-output-line-height":`${this.options.outputLineHeight}px`,"notebook-cell-output-max-height":`${this.options.outputLineHeight*this.options.outputLineLimit+2}px`,"notebook-cell-output-font-family":this.options.outputFontFamily||this.options.fontFamily,"notebook-cell-markup-empty-content":d(12124,null),"notebook-cell-renderer-not-found-error":d(12126,null),"notebook-cell-renderer-fallbacks-exhausted":d(12125,null),"notebook-markup-font-family":this.options.markupFontFamily}}generateContent(e){let t=this.getRendererData(),o=this.getStaticPreloadsData(),n={lineLimit:this.options.outputLineLimit,outputScrolling:this.options.outputScrolling,outputWordWrap:this.options.outputWordWrap,linkifyFilePaths:this.options.outputLinkifyFilePaths,minimalError:this.options.minimalError},r=tco({...this.options,tokenizationCss:lco()},{dragAndDropEnabled:this.options.dragAndDropEnabled},n,t,o,this.workspaceTrustManagementService.isWorkspaceTrusted(),this.nonce),s=this.configurationService.getValue("notebook.experimental.enableCsp"),l=this.getColor(Pse),c=this.getColor(Kb);return`
<html lang="en">
<head>
<meta charset="UTF-8">
<base href="${e}/" />
${s?`<meta http-equiv="Content-Security-Policy" content="
default-src 'none';
script-src ${Gpe} 'unsafe-inline' 'unsafe-eval';
style-src ${Gpe} 'unsafe-inline';
img-src ${Gpe} https: http: data:;
font-src ${Gpe} https:;
connect-src https:;
child-src https: data:;
">`:""}
<style nonce="${this.nonce}">
::highlight(find-highlight) {
background-color: var(--vscode-editor-findMatchBackground, ${c});
}
::highlight(current-find-highlight) {
background-color: var(--vscode-editor-findMatchHighlightBackground, ${l});
}
#container .cell_container {
width: 100%;
}
#container .output_container {
width: 100%;
}
#container .cell_container.nb-insertHighlight div.output_container div.output {
background-color: var(--vscode-diffEditor-insertedLineBackground, var(--vscode-diffEditor-insertedTextBackground));
}
#container > div > div > div.output {
font-size: var(--notebook-cell-output-font-size);
width: var(--notebook-output-width);
margin-left: var(--notebook-output-left-margin);
background-color: var(--theme-notebook-output-background);
padding-top: var(--notebook-output-node-padding);
padding-right: var(--notebook-output-node-padding);
padding-bottom: var(--notebook-output-node-padding);
padding-left: var(--notebook-output-node-left-padding);
box-sizing: border-box;
border-top: none;
}
/* markdown */
#container div.preview {
width: 100%;
padding-right: var(--notebook-preview-node-padding);
padding-left: var(--notebook-markdown-left-margin);
padding-top: var(--notebook-preview-node-padding);
padding-bottom: var(--notebook-preview-node-padding);
box-sizing: border-box;
white-space: nowrap;
overflow: hidden;
white-space: initial;
font-size: var(--notebook-markup-font-size);
line-height: var(--notebook-markdown-line-height);
color: var(--theme-ui-foreground);
font-family: var(--notebook-markup-font-family);
}
#container div.preview.draggable {
user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
cursor: grab;
}
#container div.preview.selected {
background: var(--theme-notebook-cell-selected-background);
}
#container div.preview.dragging {
background-color: var(--theme-background);
opacity: 0.5 !important;
}
.monaco-workbench.vs-dark .notebookOverlay .cell.markdown .latex img,
.monaco-workbench.vs-dark .notebookOverlay .cell.markdown .latex-block img {
filter: brightness(0) invert(1)
}
#container .markup > div.nb-symbolHighlight {
background-color: var(--theme-notebook-symbol-highlight-background);
}
#container .markup > div.nb-insertHighlight {
background-color: var(--vscode-diffEditor-insertedLineBackground, var(--vscode-diffEditor-insertedTextBackground));
}
#container .nb-symbolHighlight .output_container .output {
background-color: var(--theme-notebook-symbol-highlight-background);
}
#container .markup > div.nb-multiCellHighlight {
background-color: var(--theme-notebook-symbol-highlight-background);
}
#container .nb-multiCellHighlight .output_container .output {
background-color: var(--theme-notebook-symbol-highlight-background);
}
#container .nb-chatGenerationHighlight .output_container .output {
background-color: var(--vscode-notebook-selectedCellBackground);
}
#container > div.nb-cellDeleted .output_container {
background-color: var(--theme-notebook-diff-removed-background);
}
#container > div.nb-cellAdded .output_container {
background-color: var(--theme-notebook-diff-inserted-background);
}
#container > div > div:not(.preview) > div {
overflow-x: auto;
}
#container .no-renderer-error {
color: var(--vscode-editorError-foreground);
}
body {
padding: 0px;
height: 100%;
width: 100%;
}
table, thead, tr, th, td, tbody {
border: none;
border-color: transparent;
border-spacing: 0;
border-collapse: collapse;
}
table, th, tr {
vertical-align: middle;
text-align: right;
}
thead {
font-weight: bold;
background-color: rgba(130, 130, 130, 0.16);
}
th, td {
padding: 4px 8px;
}
tr:nth-child(even) {
background-color: rgba(130, 130, 130, 0.08);
}
tbody th {
font-weight: normal;
}
.find-match {
background-color: var(--vscode-editor-findMatchHighlightBackground);
}
.current-find-match {
background-color: var(--vscode-editor-findMatchBackground);
}
#_defaultColorPalatte {
color: var(--vscode-editor-findMatchHighlightBackground);
background-color: var(--vscode-editor-findMatchBackground);
}
</style>
</head>
<body style="overflow: hidden;">
<div id='findStart' tabIndex=-1></div>
<div id='container' class="widgetarea" style="position: absolute;width:100%;top: 0px"></div>
<div id="_defaultColorPalatte"></div>
<script type="module">${r}</script>
</body>
</html>`}getRendererData(){return this.notebookService.getRenderers().map(e=>{let t={extends:e.entrypoint.extends,path:this.asWebviewUri(e.entrypoint.path,e.extensionLocation).toString()};return{id:e.id,entrypoint:t,mimeTypes:e.mimeTypes,messaging:e.messaging!=="never"&&!!this.rendererMessaging,isBuiltin:e.isBuiltin}})}getStaticPreloadsData(){return Array.from(this.notebookService.getStaticPreloads(this.notebookViewType),e=>({entrypoint:this.asWebviewUri(e.entrypoint,e.extensionLocation).toString().toString()}))}asWebviewUri(e,t){return SRe(e,t?.scheme===Y.vscodeRemote?{isRemote:!0,authority:t.authority}:void 0)}postKernelMessage(e){this._sendMessageToWebview({__vscode_notebook_message:!0,type:"customKernelMessage",message:e})}resolveOutputId(e){let t=this.reversedInsetMapping.get(e);return t?{cellInfo:this.insetMapping.get(t).cellInfo,output:t}:void 0}isResolved(){return!!this.webview}createWebview(e){let t=this.asWebviewUri(this.getNotebookBaseUri(),void 0),o=this.generateContent(t.toString());return this._initialize(o,e)}getNotebookBaseUri(){if(this.documentUri.scheme===Y.untitled){let e=this.workspaceContextService.getWorkspaceFolder(this.documentUri);if(e)return e.uri;let t=this.workspaceContextService.getWorkspace().folders;if(t.length)return t[0].uri}return ci(this.documentUri)}getBuiltinLocalResourceRoots(){return this.documentUri.path.toLowerCase().endsWith(".ipynb")?Gt?[]:[ci(gn.asFileUri("vs/nls.js"))]:[]}_initialize(e,t){if(!Me(this.element).document.body.contains(this.element))throw new Error("Element is already detached from the DOM tree");this.webview=this._createInset(this.webviewService,e),this.webview.mountTo(this.element,t),this._register(this.webview),this._register(new iX(t,()=>this.webview));let o=new Go;return this._register(this.webview.onFatalError(n=>{o.error(new Error(`Could not initialize webview: ${n.message}}`))})),this._register(this.webview.onMessage(async n=>{let r=n.message;if(!this._disposed&&r.__vscode_notebook_message)switch(r.type){case"initialized":{o.complete(),this.initializeWebViewState();break}case"initializedMarkup":{this.initializeMarkupPromise?.requestId===r.requestId&&(this.initializeMarkupPromise?.p.complete(),this.initializeMarkupPromise=void 0);break}case"dimension":{for(let s of r.updates){let l=s.height;if(s.isOutput){let c=this.resolveOutputId(s.id);if(c){let{cellInfo:u,output:p}=c;this.notebookEditor.updateOutputHeight(u,p,l,!!s.init,"webview#dimension"),this.notebookEditor.scheduleOutputHeightAck(u,s.id,l)}else if(s.init){let u=this.reversedPendingWebviewIdleInsetMapping.get(s.id);if(u){let p=this.pendingWebviewIdleInsetMapping.get(u);this.pendingWebviewIdleCreationRequest.delete(u),this.pendingWebviewIdleCreationRequest.delete(u);let h=p.cellInfo;this.reversedInsetMapping.set(s.id,u),this.insetMapping.set(u,p),this.notebookEditor.updateOutputHeight(h,u,l,!!s.init,"webview#dimension"),this.notebookEditor.scheduleOutputHeightAck(h,s.id,l)}this.reversedPendingWebviewIdleInsetMapping.delete(s.id)}{if(!s.init)continue;let u=this.reversedInsetMapping.get(s.id);if(!u)continue;let p=this.insetMapping.get(u);p.initialized=!0}}else this.notebookEditor.updateMarkupCellHeight(s.id,l,!!s.init)}break}case"mouseenter":{let s=this.resolveOutputId(r.id);if(s){let l=this.notebookEditor.getCellByInfo(s.cellInfo);l&&(l.outputIsHovered=!0)}break}case"mouseleave":{let s=this.resolveOutputId(r.id);if(s){let l=this.notebookEditor.getCellByInfo(s.cellInfo);l&&(l.outputIsHovered=!1)}break}case"outputFocus":{let s=this.resolveOutputId(r.id);if(s){let l=this.notebookEditor.getCellByInfo(s.cellInfo);l&&(l.outputIsFocused=!0,this.notebookEditor.focusNotebookCell(l,"output",{outputId:s.output.model.outputId,skipReveal:!0,outputWebviewFocused:!0}))}break}case"outputBlur":{let s=this.resolveOutputId(r.id);if(s){let l=this.notebookEditor.getCellByInfo(s.cellInfo);l&&(l.outputIsFocused=!1,l.inputInOutputIsFocused=!1)}break}case"scroll-ack":break;case"scroll-to-reveal":{this.notebookEditor.setScrollTop(r.scrollTop-Kpe);break}case"did-scroll-wheel":{this.notebookEditor.triggerScroll({...r.payload,preventDefault:()=>{},stopPropagation:()=>{}});break}case"focus-editor":{let s=this.notebookEditor.getCellById(r.cellId);s&&(r.focusNext?this.notebookEditor.focusNextNotebookCell(s,"editor"):await this.notebookEditor.focusNotebookCell(s,"editor"));break}case"clicked-data-url":{this._onDidClickDataLink(r);break}case"clicked-link":{if(jd(r.href,Y.command)){let s=A.parse(r.href);if(s.path==="workbench.action.openLargeOutput"){let l=s.query,c=this.editorGroupService.activeGroup;c&&c.activeEditor&&c.pinEditor(c.activeEditor),this.openerService.open(Zo.generateCellOutputUriWithId(this.documentUri,l));return}if(s.path==="cellOutput.enableScrolling"){let l=s.query,c=this.reversedInsetMapping.get(l);c&&(this.telemetryService.publicLog2("workbenchActionExecuted",{id:"notebook.cell.toggleOutputScrolling",from:"inlineLink"}),c.cellViewModel.outputsViewModels.forEach(u=>{u.model.metadata&&(u.model.metadata.scrollable=!0,u.resetRenderer())}));return}this.openerService.open(r.href,{fromUserGesture:!0,fromWorkspace:!0,allowCommands:["github-issues.authNow","workbench.extensions.search","workbench.action.openSettings","_notebook.selectKernel","jupyter.viewOutput","jupyter.createPythonEnvAndSelectController"]});return}if($0(r.href,Y.http,Y.https,Y.mailto))this.openerService.open(r.href,{fromUserGesture:!0,fromWorkspace:!0});else if(jd(r.href,Y.vscodeNotebookCell)){let s=A.parse(r.href);await this._handleNotebookCellResource(s)}else/^[\w\-]+:/.test(r.href)?Xl(r.href)?this._openUri(A.file(r.href)):this._openUri(A.parse(r.href)):await this._handleResourceOpening(I8o(r.href));break}case"customKernelMessage":{this._onMessage.fire({message:r.message});break}case"customRendererMessage":{this.rendererMessaging?.postMessage(r.rendererId,r.message);break}case"clickMarkupCell":{let s=this.notebookEditor.getCellById(r.cellId);s&&(r.shiftKey||(it?r.metaKey:r.ctrlKey)?this.notebookEditor.toggleNotebookCellSelection(s,r.shiftKey):await this.notebookEditor.focusNotebookCell(s,"container",{skipReveal:!0}));break}case"contextMenuMarkupCell":{let s=this.notebookEditor.getCellById(r.cellId);if(s){await this.notebookEditor.focusNotebookCell(s,"container",{skipReveal:!0});let l=this.element.getBoundingClientRect();this.contextMenuService.showContextMenu({menuId:D.NotebookCellTitle,contextKeyService:this.contextKeyService,getAnchor:()=>({x:l.x+r.clientX,y:l.y+r.clientY})})}break}case"toggleMarkupPreview":{let s=this.notebookEditor.getCellById(r.cellId);s&&!this.notebookEditor.creationOptions.isReadOnly&&(this.notebookEditor.setMarkupCellEditState(r.cellId,1),await this.notebookEditor.focusNotebookCell(s,"editor",{skipReveal:!0}));break}case"mouseEnterMarkupCell":{let s=this.notebookEditor.getCellById(r.cellId);s instanceof kb&&(s.cellIsHovered=!0);break}case"mouseLeaveMarkupCell":{let s=this.notebookEditor.getCellById(r.cellId);s instanceof kb&&(s.cellIsHovered=!1);break}case"cell-drag-start":{this.notebookEditor.didStartDragMarkupCell(r.cellId,r);break}case"cell-drag":{this.notebookEditor.didDragMarkupCell(r.cellId,r);break}case"cell-drop":{this.notebookEditor.didDropMarkupCell(r.cellId,{dragOffsetY:r.dragOffsetY,ctrlKey:r.ctrlKey,altKey:r.altKey});break}case"cell-drag-end":{this.notebookEditor.didEndDragMarkupCell(r.cellId);break}case"renderedMarkup":{let s=this.notebookEditor.getCellById(r.cellId);s instanceof kb&&(s.renderedHtml=r.html),this._handleHighlightCodeBlock(r.codeBlocks);break}case"renderedCellOutput":{this._handleHighlightCodeBlock(r.codeBlocks);break}case"outputResized":{this.notebookEditor.didResizeOutput(r.cellId);break}case"getOutputItem":{let l=this.resolveOutputId(r.outputId)?.output.model.outputs.find(c=>c.mime===r.mime);this._sendMessageToWebview({type:"returnOutputItem",requestId:r.requestId,output:l?{mime:l.mime,valueBytes:l.data.buffer}:void 0});break}case"logRendererDebugMessage":{this._logRendererDebugMessage(`${r.message}${r.data?" "+JSON.stringify(r.data,null,4):""}`);break}case"notebookPerformanceMessage":{this.notebookEditor.updatePerformanceMetadata(r.cellId,r.executionId,r.duration,r.rendererId),r.outputSize&&r.rendererId==="vscode.builtin-renderer"&&this._sendPerformanceData(r.outputSize,r.duration);break}case"outputInputFocus":{let s=this.resolveOutputId(r.id);if(s){let l=this.notebookEditor.getCellByInfo(s.cellInfo);l&&(l.inputInOutputIsFocused=r.inputFocused)}this.notebookEditor.didFocusOutputInputChange(r.inputFocused)}}})),o.p}_sendPerformanceData(e,t){let o={outputSize:e,renderTime:t};this.telemetryService.publicLog2("NotebookCellOutputRender",o)}_handleNotebookCellResource(e){let t=e.path.length>0?e:this.documentUri,o=/(?:^|&)line=([^&]+)/.exec(e.query),n;if(o){let l=parseInt(o[1],10);isNaN(l)||(n={selection:{startLineNumber:l,startColumn:1}})}let r=/(?:^|&)execution_count=([^&]+)/.exec(e.query);if(r){let l=parseInt(r[1],10);if(!isNaN(l)){let u=this.notebookService.getNotebookTextModel(t)?.cells.slice().reverse().find(p=>p.internalMetadata.executionOrder===l);if(u?.uri)return this.openerService.open(u.uri,{fromUserGesture:!0,fromWorkspace:!0,editorOptions:n})}}let s=/\?line=(\d+)$/.exec(e.fragment);if(s){let l=parseInt(s[1],10);if(!isNaN(l)){let c=l+1,u=e.fragment.substring(0,s.index),p={selection:{startLineNumber:c,startColumn:1,endLineNumber:c,endColumn:1}};return this.openerService.open(t.with({fragment:u}),{fromUserGesture:!0,fromWorkspace:!0,editorOptions:p})}}return this.openerService.open(t,{fromUserGesture:!0,fromWorkspace:!0})}async _handleResourceOpening(e){let t,o,n=S8o.exec(e);if(n&&(e=n[1],o=n[2]),e.startsWith("/")){t=await this.pathService.fileURI(e);let r=this.workspaceContextService.getWorkspace().folders;r.length&&(t=t.with({scheme:r[0].uri.scheme,authority:r[0].uri.authority}))}else if(e.startsWith("~")){let r=await this.pathService.userHome();r&&(t=A.joinPath(r,e.substring(2)))}else if(this.documentUri.scheme===Y.untitled){let r=this.workspaceContextService.getWorkspace().folders;if(!r.length)return;t=A.joinPath(r[0].uri,e)}else t=A.joinPath(ci(this.documentUri),e);t&&(o&&(t=t.with({fragment:o})),this._openUri(t))}_openUri(e){let t,o,n=v8o.exec(e.path);n&&(e=e.with({path:e.path.slice(0,n.index),fragment:`L${n[0].slice(1)}`}),t=parseInt(n[1],10),o=parseInt(n[2],10));let r=b8o.exec(e.query);if(r){let l=parseInt(r[1],10);isNaN(l)||(t=l+1,o=1,e=e.with({fragment:`L${t}`}))}e=e.with({query:null});let s;for(let l of this.editorGroupService.groups){let c=l.editors.find(u=>u.resource&&Xe(u.resource,e,!0));if(c){s={group:l,editor:c};break}}if(s){let l=t!==void 0&&o!==void 0?{startLineNumber:t,startColumn:o}:void 0,c={selection:l};s.group.openEditor(s.editor,l?c:void 0)}else this.openerService.open(e,{fromUserGesture:!0,fromWorkspace:!0})}_handleHighlightCodeBlock(e){for(let{id:t,value:o,lang:n}of e){let r=this.languageService.getLanguageIdByLanguageName(n);r&&bW(this.languageService,o,r).then(s=>{this._disposed||this._sendMessageToWebview({type:"tokenizedCodeBlock",html:s,codeBlockId:t})})}}async _onDidClickDataLink(e){if(typeof e.data!="string")return;let[t,o]=e.data.split(";base64,");if(!o||!t)return;let n=ms(this.documentUri)===".interactive"?this.workspaceContextService.getWorkspace().folders[0]?.uri??await this.fileDialogService.defaultFilePath():ci(this.documentUri),r;if(e.downloadName)r=e.downloadName;else{let u=t.replace(/^data:/,""),p=u&&K6(u);r=p?`download${p}`:"download"}let s=je(n,r),l=await this.fileDialogService.showSaveDialog({defaultUri:s});if(!l)return;let c=Sl(o);await this.fileService.writeFile(l,c),await this.openerService.open(l)}_createInset(e,t){this.localResourceRootsCache=this._getResourceRootsCache();let o=e.createWebviewElement({origin:uA.getOriginStore(this.storageService).getOrigin(this.notebookViewType,void 0),title:d(12127,null),options:{purpose:"notebookRenderer",enableFindWidget:!1,transformCssVariables:ico},contentOptions:{allowMultipleAPIAcquire:!0,allowScripts:!0,localResourceRoots:this.localResourceRootsCache},extension:void 0,providedViewType:"notebook.output"});return o.setHtml(t),o.setContextKeyService(this.contextKeyService),o}_getResourceRootsCache(){let e=this.contextService.getWorkspace().folders.map(o=>o.uri),t=this.getNotebookBaseUri();return[this.notebookService.getNotebookProviderResourceRoots(),this.notebookService.getRenderers().map(o=>ci(o.entrypoint.path)),...Array.from(this.notebookService.getStaticPreloads(this.notebookViewType),o=>[ci(o.entrypoint),...o.localResourceRoots]),e,t,this.getBuiltinLocalResourceRoots()].flat()}initializeWebViewState(){this._preloadsCache.clear(),this._currentKernel&&this._updatePreloadsFromKernel(this._currentKernel);for(let[e,t]of this.insetMapping.entries())this._sendMessageToWebview({...t.cachedCreation,initiallyHidden:this.hiddenInsetMapping.has(e)});if(!this.initializeMarkupPromise?.isFirstInit){let e=[...this.markupPreviewMapping.values()];this.markupPreviewMapping.clear(),this.initializeMarkup(e)}this._updateStyles(),this._updateOptions()}shouldUpdateInset(e,t,o,n){if(this._disposed||"isOutputCollapsed"in e&&e.isOutputCollapsed)return!1;if(this.hiddenInsetMapping.has(t))return!0;let r=this.insetMapping.get(t);return!(!r||n===r.cachedCreation.outputOffset&&o===r.cachedCreation.cellTop)}ackHeight(e){this._sendMessageToWebview({type:"ack-dimension",updates:e})}updateScrollTops(e,t){if(this._disposed)return;let o=si(e.map(n=>{let r=this.insetMapping.get(n.output);if(!r||!n.forceDisplay&&!this.shouldUpdateInset(n.cell,n.output,n.cellTop,n.outputOffset))return;let s=r.outputId;return r.cachedCreation.cellTop=n.cellTop,r.cachedCreation.outputOffset=n.outputOffset,this.hiddenInsetMapping.delete(n.output),{cellId:n.cell.id,outputId:s,cellTop:n.cellTop,outputOffset:n.outputOffset,forceDisplay:n.forceDisplay}}));!o.length&&!t.length||this._sendMessageToWebview({type:"view-scroll",widgets:o,markupCells:t})}async createMarkupPreview(e){if(!this._disposed){if(this.markupPreviewMapping.has(e.cellId)){console.error("Trying to create markup preview that already exists");return}this.markupPreviewMapping.set(e.cellId,e),this._sendMessageToWebview({type:"createMarkupCell",cell:e})}}async showMarkupPreview(e){if(this._disposed)return;let t=this.markupPreviewMapping.get(e.cellId);if(!t)return this.createMarkupPreview(e);let o=e.content===t.content,n=uo(e.metadata,t.metadata);(!o||!n||!t.visible)&&this._sendMessageToWebview({type:"showMarkupCell",id:e.cellId,handle:e.cellHandle,content:o?void 0:e.content,top:e.offset,metadata:n?void 0:e.metadata}),t.metadata=e.metadata,t.content=e.content,t.offset=e.offset,t.visible=!0}async hideMarkupPreviews(e){if(this._disposed)return;let t=[];for(let o of e){let n=this.markupPreviewMapping.get(o);n&&n.visible&&(t.push(o),n.visible=!1)}t.length&&this._sendMessageToWebview({type:"hideMarkupCells",ids:t})}async unhideMarkupPreviews(e){if(this._disposed)return;let t=[];for(let o of e){let n=this.markupPreviewMapping.get(o);n?n.visible||(n.visible=!0,t.push(o)):console.error(`Trying to unhide a preview that does not exist: ${o}`)}this._sendMessageToWebview({type:"unhideMarkupCells",ids:t})}async deleteMarkupPreviews(e){if(!this._disposed){for(let t of e)this.markupPreviewMapping.has(t)||console.error(`Trying to delete a preview that does not exist: ${t}`),this.markupPreviewMapping.delete(t);e.length&&this._sendMessageToWebview({type:"deleteMarkupCell",ids:e})}}async updateMarkupPreviewSelections(e){this._disposed||this._sendMessageToWebview({type:"updateSelectedMarkupCells",selectedCellIds:e.filter(t=>this.markupPreviewMapping.has(t))})}async initializeMarkup(e){if(this._disposed)return;this.initializeMarkupPromise?.p.complete();let t=_t();this.initializeMarkupPromise={p:new Go,requestId:t,isFirstInit:this.firstInit},this.firstInit=!1;for(let o of e)this.markupPreviewMapping.set(o.cellId,o);return this._sendMessageToWebview({type:"initializeMarkup",cells:e,requestId:t}),this.initializeMarkupPromise.p.p}_cachedInsetEqual(e,t){return t.type===1?e.renderer?.id===t.renderer.id:e.cachedCreation.type==="html"}requestCreateOutputWhenWebviewIdle(e,t,o,n){this._disposed||this.insetMapping.has(t.source)||this.pendingWebviewIdleCreationRequest.has(t.source)||this.pendingWebviewIdleInsetMapping.has(t.source)||this.pendingWebviewIdleCreationRequest.set(t.source,aN(()=>{let{message:r,renderer:s,transfer:l}=this._createOutputCreationMessage(e,t,o,n,!0,!0);this._sendMessageToWebview(r,l),this.pendingWebviewIdleInsetMapping.set(t.source,{outputId:r.outputId,versionId:t.source.model.versionId,cellInfo:e,renderer:s,cachedCreation:r}),this.reversedPendingWebviewIdleInsetMapping.set(r.outputId,t.source),this.pendingWebviewIdleCreationRequest.delete(t.source)}))}createOutput(e,t,o,n){if(this._disposed)return;let r=this.insetMapping.get(t.source);if(this.pendingWebviewIdleCreationRequest.get(t.source)?.dispose(),this.pendingWebviewIdleCreationRequest.delete(t.source),this.pendingWebviewIdleInsetMapping.delete(t.source),r&&this.reversedPendingWebviewIdleInsetMapping.delete(r.outputId),r&&this._cachedInsetEqual(r,t)){this.hiddenInsetMapping.delete(t.source),this._sendMessageToWebview({type:"showOutput",cellId:r.cellInfo.cellId,outputId:r.outputId,cellTop:o,outputOffset:n});return}let{message:s,renderer:l,transfer:c}=this._createOutputCreationMessage(e,t,o,n,!1,!1);this._sendMessageToWebview(s,c),this.insetMapping.set(t.source,{outputId:s.outputId,versionId:t.source.model.versionId,cellInfo:e,renderer:l,cachedCreation:s}),this.hiddenInsetMapping.delete(t.source),this.reversedInsetMapping.set(s.outputId,t.source)}createMetadata(e,t){if(t.startsWith("image")){let o=e.outputs.find(n=>n.mime==="text/plain")?.data.buffer;if(o?.length&&o?.length>0){let n=new TextDecoder().decode(o);return{...e.metadata,vscode_altText:n}}}return e.metadata}_createOutputCreationMessage(e,t,o,n,r,s){let l={type:"html",executionId:e.executionId,cellId:e.cellId,cellTop:o,outputOffset:n,left:0,requiredPreloads:[],createOnIdle:r},c=[],u,p;if(t.type===1){let h=t.source.model;p=t.renderer;let g=h.outputs.find(b=>b.mime===t.mimeType),f=this.createMetadata(h,t.mimeType),v=aco(g.data.buffer,c);u={...l,outputId:h.outputId,rendererId:t.renderer.id,content:{type:1,outputId:h.outputId,metadata:f,output:{mime:g.mime,valueBytes:v},allOutputs:h.outputs.map(b=>({mime:b.mime}))},initiallyHidden:s}}else u={...l,outputId:_t(),content:{type:t.type,htmlContent:t.htmlContent},initiallyHidden:s};return{message:u,renderer:p,transfer:c}}updateOutput(e,t,o,n){if(this._disposed)return;if(!this.insetMapping.has(t.source)){this.createOutput(e,t,o,n);return}let r=this.insetMapping.get(t.source);if(r.versionId===t.source.model.versionId)return;this.hiddenInsetMapping.delete(t.source);let s,l=[];if(t.type===1){let c=t.source.model,u=c.outputs.find(f=>f.mime===t.mimeType),p=c.appendedSinceVersion(r.versionId,t.mimeType),h=p?{valueBytes:p.buffer,previousVersion:r.versionId}:void 0,g=aco(u.data.buffer,l);s={type:1,outputId:r.outputId,metadata:c.metadata,output:{mime:t.mimeType,valueBytes:g,appended:h},allOutputs:c.outputs.map(f=>({mime:f.mime}))}}this._sendMessageToWebview({type:"showOutput",cellId:r.cellInfo.cellId,outputId:r.outputId,cellTop:o,outputOffset:n,content:s},l),r.versionId=t.source.model.versionId}async copyImage(e){let t=[],o=e.model;for(let n of o.outputs)if(IRe.includes(n.mime)){let r=oL(n.mime)?nVt(e).text:rVt(n.mime,n);t.push({mimeType:n.mime,content:r})}this._sendMessageToWebview({type:"copyImage",outputId:e.model.outputId,altOutputId:e.model.alternativeOutputId,textAlternates:t.length>0?t:void 0})}removeInsets(e){if(!this._disposed)for(let t of e){let o=this.insetMapping.get(t);if(!o)continue;let n=o.outputId;this._sendMessageToWebview({type:"clearOutput",rendererId:o.cachedCreation.rendererId,cellUri:o.cellInfo.cellUri.toString(),outputId:n,cellId:o.cellInfo.cellId}),this.insetMapping.delete(t),this.pendingWebviewIdleCreationRequest.get(t)?.dispose(),this.pendingWebviewIdleCreationRequest.delete(t),this.pendingWebviewIdleInsetMapping.delete(t),this.reversedPendingWebviewIdleInsetMapping.delete(n),this.reversedInsetMapping.delete(n)}}hideInset(e){if(this._disposed)return;let t=this.insetMapping.get(e);t&&(this.hiddenInsetMapping.add(e),this._sendMessageToWebview({type:"hideOutput",outputId:t.outputId,cellId:t.cellInfo.cellId}))}focusWebview(){this._disposed||this.webview?.focus()}selectOutputContents(e){if(this._disposed)return;let t=e.outputsViewModels.find(n=>n.model.outputId===e.focusedOutputId),o=t?this.insetMapping.get(t)?.outputId:void 0;this._sendMessageToWebview({type:"select-output-contents",cellOrOutputId:o||e.id})}selectInputContents(e){if(this._disposed)return;let t=e.outputsViewModels.find(n=>n.model.outputId===e.focusedOutputId),o=t?this.insetMapping.get(t)?.outputId:void 0;this._sendMessageToWebview({type:"select-input-contents",cellOrOutputId:o||e.id})}focusOutput(e,t,o){this._disposed||(o||this.webview?.focus(),this._sendMessageToWebview({type:"focus-output",cellOrOutputId:e,alternateId:t}))}blurOutput(){this._disposed||this._sendMessageToWebview({type:"blur-output"})}async find(e,t){if(e==="")return this._sendMessageToWebview({type:"findStop",ownerID:t.ownerID}),[];let o=new Promise(r=>{let s=this.webview?.onMessage(l=>{l.message.type==="didFind"&&(r(l.message.matches),s?.dispose())})});return this._sendMessageToWebview({type:"find",query:e,options:t}),await o}findStop(e){this._sendMessageToWebview({type:"findStop",ownerID:e})}async findHighlightCurrent(e,t){let o=new Promise(r=>{let s=this.webview?.onMessage(l=>{l.message.type==="didFindHighlightCurrent"&&(r(l.message.offset),s?.dispose())})});return this._sendMessageToWebview({type:"findHighlightCurrent",index:e,ownerID:t}),await o}async findUnHighlightCurrent(e,t){this._sendMessageToWebview({type:"findUnHighlightCurrent",index:e,ownerID:t})}deltaCellOutputContainerClassNames(e,t,o){this._sendMessageToWebview({type:"decorations",cellId:e,addedClassNames:t,removedClassNames:o})}deltaMarkupPreviewClassNames(e,t,o){this.markupPreviewMapping.get(e)&&this._sendMessageToWebview({type:"markupDecorations",cellId:e,addedClassNames:t,removedClassNames:o})}updateOutputRenderers(){if(!this.webview)return;let e=this.getRendererData();this.localResourceRootsCache=this._getResourceRootsCache();let t=[...this.localResourceRootsCache||[],...this._currentKernel?[this._currentKernel.localResourceRoot]:[]];this.webview.localResourcesRoot=t,this._sendMessageToWebview({type:"updateRenderers",rendererData:e})}async updateKernelPreloads(e){if(this._disposed||e===this._currentKernel)return;let t=this._currentKernel;this._currentKernel=e,t&&t.preloadUris.length>0?this.webview?.reload():e&&this._updatePreloadsFromKernel(e)}_updatePreloadsFromKernel(e){let t=[];for(let o of e.preloadUris){let n=this.environmentService.isExtensionDevelopment&&(o.scheme==="http"||o.scheme==="https")?o:this.asWebviewUri(o,void 0);this._preloadsCache.has(n.toString())||(t.push({uri:n.toString(),originalUri:o.toString()}),this._preloadsCache.add(n.toString()))}t.length&&this._updatePreloads(t)}_updatePreloads(e){if(!this.webview)return;let t=[...this.localResourceRootsCache||[],...this._currentKernel?[this._currentKernel.localResourceRoot]:[]];this.webview.localResourcesRoot=t,this._sendMessageToWebview({type:"preload",resources:e})}_sendMessageToWebview(e,t){this._disposed||this.webview?.postMessage(e,t)}dispose(){this._disposed=!0,this.webview?.dispose(),this.webview=void 0,this.notebookEditor=null,this.insetMapping.clear(),this.pendingWebviewIdleCreationRequest.clear(),super.dispose()}};uA=I([m(6,wm),m(7,Qe),m(8,un),m(9,Pe),m(10,Vt),m(11,dn),m(12,be),m(13,ze),m(14,X),m(15,ns),m(16,B),m(17,kt),m(18,Pe),m(19,Et),m(20,le),m(21,wn),m(22,_v),m(23,De),m(24,Te)],uA);function aco(a,i){if(a.byteLength===a.buffer.byteLength)return a;{let e=new Uint8Array(a);return i.push(e.buffer),e}}function lco(){let a=kc.getColorMap();return a?KN(a):""}function I8o(a){try{return decodeURIComponent(a)}catch{return a}}var uZe=class extends dp{get activeCell(){return this.currentCell}constructor(i,e){super()}didRenderCell(i){super.didRenderCell(i)}unrenderCell(i){super.unrenderCell(i)}updateInternalLayoutNow(i){}dispose(){super.dispose()}};var $pe=class extends dp{constructor(e,t,o,n,r,s){super();this.notebookEditor=e;this.container=t;this.contextKeyService=o;this.themeService=n;this.commentService=r;this.instantiationService=s;this.container.classList.add("review-widget"),this._register(this._commentThreadWidgets=new jt),this._register(this.themeService.onDidColorThemeChange(this._applyTheme,this)),this._applyTheme()}async initialize(e){this.currentElement!==e&&(this.currentElement=e,await this._updateThread())}async _createCommentTheadWidget(e,t){let o=new P,n=this.instantiationService.createInstance(zX,this.container,this.notebookEditor,e,this.notebookEditor.textModel.uri,this.contextKeyService,this.instantiationService,t,void 0,void 0,{},void 0,{actionRunner:()=>{},collapse:async()=>!0});o.add(n),this._commentThreadWidgets.set(t.threadId,{widget:n,dispose:()=>o.dispose()});let r=this.notebookEditor.getLayoutInfo();await n.display(r.fontInfo.lineHeight,!0),this._applyTheme(),o.add(n.onDidResize(()=>{this.currentElement&&(this.currentElement.commentHeight=this._calculateCommentThreadHeight(n.getDimensions().height))}))}_bindListeners(){this.cellDisposables.add(this.commentService.onDidUpdateCommentThreads(async()=>this._updateThread()))}async _updateThread(){if(!this.currentElement)return;let e=await this._getCommentThreadsForCell(this.currentElement),t=new Set(this._commentThreadWidgets.keys()),o=this.currentElement.layoutInfo;this.container.style.top=`${o.commentOffset}px`;for(let n of e)if(n)for(let r of n.threads){t.delete(r.threadId);let s=this._commentThreadWidgets.get(r.threadId)?.widget;s?await s.updateCommentThread(r):await this._createCommentTheadWidget(n.uniqueOwner,r)}for(let n of t)this._commentThreadWidgets.deleteAndDispose(n);this._updateHeight()}_calculateCommentThreadHeight(e){let t=this.notebookEditor.getLayoutInfo(),o=Math.ceil(t.fontInfo.lineHeight*1.2),n=t.fontInfo.lineHeight,r=Math.round(n/3),s=Math.round(n/9)*2;return o+e+r+s+8}_updateHeight(){if(!this.currentElement)return;let e=0;for(let{widget:t}of this._commentThreadWidgets.values())e+=this._calculateCommentThreadHeight(t.getDimensions().height);this.currentElement.commentHeight=e}async _getCommentThreadsForCell(e){return this.notebookEditor.hasModel()?si(await this.commentService.getNotebookComments(e.uri)):[]}_applyTheme(){let e=this.notebookEditor.getLayoutInfo().fontInfo;for(let{widget:t}of this._commentThreadWidgets.values())t.applyTheme(e)}didRenderCell(e){this.initialize(e),this._bindListeners()}prepareLayout(){this._updateHeight()}updateInternalLayoutNow(e){this.currentElement&&(this.container.style.top=`${e.layoutInfo.commentOffset}px`)}};$pe=I([m(2,X),m(3,De),m(4,km),m(5,F)],$pe);var pZe=class extends dp{constructor(e,t,o){super();this.notebookEditor=e;this.rootContainer=t;this.decorationContainer=o}didRenderCell(e){let t=[];this.rootContainer.classList.forEach(n=>{/^nb\-.*$/.test(n)&&t.push(n)}),t.forEach(n=>{this.rootContainer.classList.remove(n)}),this.decorationContainer.innerText="";let o=()=>{this.decorationContainer.innerText="",e.getCellDecorations().filter(n=>n.topClassName!==void 0).forEach(n=>{this.decorationContainer.append(_(`.${n.topClassName}`))})};this.cellDisposables.add(e.onCellDecorationsChanged(n=>{(n.added.find(s=>s.topClassName)||n.removed.find(s=>s.topClassName))&&o()})),o(),this.registerDecorations()}registerDecorations(){this.currentCell&&(this.cellDisposables.add(this.currentCell.onCellDecorationsChanged(e=>{e.added.forEach(t=>{t.className&&this.currentCell&&this.rootContainer.classList.add(t.className)}),e.removed.forEach(t=>{t.className&&this.currentCell&&this.rootContainer.classList.remove(t.className)})})),this.currentCell.getCellDecorations().forEach(e=>{e.className&&this.currentCell&&(this.rootContainer.classList.add(e.className),this.notebookEditor.deltaCellContainerClassNames(this.currentCell.id,[e.className],[],this.currentCell.cellKind)),e.outputClassName&&this.currentCell&&this.notebookEditor.deltaCellContainerClassNames(this.currentCell.id,[e.outputClassName],[],this.currentCell.cellKind)}))}};var nwi=class a{static{this._ttPolicy=Kg("cellRendererEditorText",{createHTML(i){return i}})}getRichText(i,e){let t=i.getModel();if(!t)return null;let o=this.getDefaultColorMap(),n=i.getOptions().get(59),r="--notebook-editor-font-family",s="--notebook-editor-font-size",l="--notebook-editor-font-weight",c=`color: ${o[1]};background-color: ${o[2]};font-family: var(${r});font-weight: var(${l});font-size: var(${s});line-height: ${n.lineHeight}px;white-space: pre;`,u=_("div",{style:c}),p=n.fontSize,h=n.fontWeight;u.style.setProperty(r,n.fontFamily),u.style.setProperty(s,`${p}px`),u.style.setProperty(l,h);let g=this.getRichTextLinesAsHtml(t,e,o);return u.innerHTML=g,u}getRichTextLinesAsHtml(i,e,t){let o=e.startLineNumber,n=e.startColumn,r=e.endLineNumber,s=e.endColumn,l=i.getOptions().tabSize,c="";for(let u=o;u<=r;u++){let p=i.tokenization.getLineTokens(u),h=p.getLineContent(),g=u===o?n-1:0,f=u===r?s-1:h.length;h===""?c+="<br>":c+=Ebt(h,p.inflate(),t,g,f,l,ri)}return a._ttPolicy?.createHTML(c)??c}getDefaultColorMap(){let i=kc.getColorMap(),e=["#000000"];if(i)for(let t=1,o=i.length;t<o;t++)e[t]=Oe.Format.CSS.formatHex(i[t]);return e}},sVt=class{getDragImage(i,e,t){let o=this.getDragImageImpl(i,e,t);return o||(o=document.createElement("div"),o.textContent="1 cell"),o}getDragImageImpl(i,e,t){let o=i.container.cloneNode(!0);o.classList.forEach(s=>o.classList.remove(s)),o.classList.add("cell-drag-image","monaco-list-row","focused",`${t}-cell-row`);let n=o.querySelector(".cell-editor-container");if(!n)return null;let r=new nwi().getRichText(e,new z(1,1,1,1e3));return r?(Fi(n,r),o):null}};var $F=class extends dp{constructor(e,t,o){super();this.base=e;this.notebookOptions=t;this.configurationService=o;this._lineNumbers="inherit";this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._register(e.onDidChange(()=>{this._recomputeOptions()})),this._value=this._computeEditorOptions()}set tabSize(e){this._tabSize!==e&&(this._tabSize=e,this._onDidChange.fire())}get tabSize(){return this._tabSize}set indentSize(e){this._indentSize!==e&&(this._indentSize=e,this._onDidChange.fire())}get indentSize(){return this._indentSize}set insertSpaces(e){this._insertSpaces!==e&&(this._insertSpaces=e,this._onDidChange.fire())}get insertSpaces(){return this._insertSpaces}updateState(e,t){t.cellLineNumberChanged&&this.setLineNumbers(e.lineNumbers)}_recomputeOptions(){this._value=this._computeEditorOptions(),this._onDidChange.fire()}_computeEditorOptions(){let e=this.base.value,t=this.notebookOptions.getDisplayOptions().editorOptionsCustomizations,o=t?.["editor.indentSize"];o!==void 0&&(this.indentSize=o);let n=t?.["editor.insertSpaces"];n!==void 0&&(this.insertSpaces=n);let r=t?.["editor.tabSize"];r!==void 0&&(this.tabSize=r);let s=e.lineNumbers;switch(this._lineNumbers){case"inherit":this.configurationService.getValue("notebook.lineNumbers")==="on"?e.lineNumbers==="off"&&(s="on"):s="off";break;case"on":e.lineNumbers==="off"&&(s="on");break;case"off":s="off";break}let l={};return e.lineNumbers!==s&&(l.lineNumbers=s),this.notebookOptions.getLayoutConfiguration().disableRulers&&(l.rulers=[]),{...e,...l}}getUpdatedValue(e,t){let o=this.getValue(e,t);return delete o.hover,o}getValue(e,t){return{...this._value,padding:this.notebookOptions.computeEditorPadding(e,t)}}getDefaultValue(){return{...this._value,padding:{top:12,bottom:12}}}setLineNumbers(e){this._lineNumbers=e,this._recomputeOptions()}};oe.as(ii.Configuration).registerConfiguration({id:"notebook",order:100,type:"object",properties:{"notebook.lineNumbers":{type:"string",enum:["off","on"],default:"off",markdownDescription:d(12098,null)}}});W(class extends K{constructor(){super({id:"notebook.toggleLineNumbers",title:L(12100,"Toggle Notebook Line Numbers"),shortTitle:L(12101,"Line Numbers"),precondition:rr,menu:[{id:D.NotebookToolbar,group:"notebookLayout",order:2,when:x.equals("config.notebook.globalToolbar",!0)}],category:jm,f1:!0,toggled:{condition:x.notEquals("config.notebook.lineNumbers","off"),title:d(12099,null)}})}async run(i){let e=i.get(B);e.getValue("notebook.lineNumbers")==="on"?e.updateValue("notebook.lineNumbers","off"):e.updateValue("notebook.lineNumbers","on")}});W(class extends xg{constructor(){super({id:"notebook.cell.toggleLineNumbers",title:d(12097,null),precondition:fr.isEqualTo(qL),menu:[{id:D.NotebookCellTitle,group:"View",order:1}],toggled:x.or(BJe.isEqualTo("on"),x.and(BJe.isEqualTo("inherit"),x.equals("config.notebook.lineNumbers","on")))})}async runWithContext(i,e){if(e.ui)this.updateCell(i.get(B),e.cell);else{let t=i.get(B);e.selectedCells.forEach(o=>{this.updateCell(t,o)})}}updateCell(i,e){let t=i.getValue("notebook.lineNumbers")==="on",o=e.lineNumbers;o==="on"||o==="inherit"&&t?e.lineNumbers="off":e.lineNumbers="on"}});var y8o=200,wRe=class extends dp{constructor(e,t,o){super();this._notebookEditor=e;this._executionOrderLabel=t;this._notebookExecutionStateService=o;this.kernelDisposables=this._register(new P);this._executionOrderLabel.classList.add("cell-execution-order"),this._executionOrderContent=R(this._executionOrderLabel,_("div")),this._register(this._notebookExecutionStateService.onDidChangeExecution(n=>{this.currentCell&&Wo(n,{affectsCell:!0})&&n.affectsCell(this.currentCell.uri)&&this._updatePosition()})),this._register(this._notebookEditor.onDidChangeActiveKernel(()=>{this.currentCell&&(this.kernelDisposables.clear(),this._notebookEditor.activeKernel&&this.kernelDisposables.add(this._notebookEditor.activeKernel.onDidChange(()=>{this.currentCell&&this.updateExecutionOrder(this.currentCell.internalMetadata)})),this.updateExecutionOrder(this.currentCell.internalMetadata))})),this._register(this._notebookEditor.onDidScroll(()=>{this._updatePosition()}))}didRenderCell(e){this.updateExecutionOrder(e.internalMetadata,!0)}updateState(e,t){t.internalMetadataChanged&&this.updateExecutionOrder(e.internalMetadata)}updateExecutionOrder(e,t=!1){if(this._notebookEditor.activeKernel?.implementsExecutionOrder||!this._notebookEditor.activeKernel&&typeof e.executionOrder=="number"){if(typeof e.executionOrder!="number"&&!t&&this._notebookExecutionStateService.getCellExecution(this.currentCell.uri)){let n=this.currentCell;nn(()=>{this.currentCell===n&&(this.updateExecutionOrder(this.currentCell.internalMetadata,!0),this._updatePosition())},y8o,this.cellDisposables);return}let o=typeof e.executionOrder=="number"?`[${e.executionOrder}]`:"[ ]";this._executionOrderContent.innerText=o,this._updatePosition()}else this._executionOrderContent.innerText=""}updateInternalLayoutNow(e){this._updatePosition()}_updatePosition(){if(!this.currentCell)return;if(this.currentCell.isInputCollapsed){xo(this._executionOrderLabel);return}let e=!!this._notebookExecutionStateService.getCellExecution(this.currentCell.uri),t=this._executionOrderLabel.classList.contains("sticky");if(!e&&(this._executionOrderLabel.classList.remove("sticky"),t)){let n=this.currentCell.internalMetadata.executionOrder,r=typeof n=="number"?`[${n}]`:"[ ]";this._executionOrderContent.innerText=r}bn(this._executionOrderLabel);let o=this.currentCell.layoutInfo.editorHeight-22+this.currentCell.layoutInfo.statusBarHeight;if(this.currentCell instanceof Qm){let r=this._notebookEditor.getAbsoluteTopOfElement(this.currentCell)+this.currentCell.layoutInfo.outputContainerOffset,s=this._notebookEditor.scrollBottom,l=22,c=this.currentCell.layoutInfo.statusBarHeight>0,u=r-s;if(o-=u,o=Kn(o,l+12,this.currentCell.layoutInfo.editorHeight-l+this.currentCell.layoutInfo.statusBarHeight),s<=r&&e){if(!this._executionOrderContent.classList.contains("sticky-spinner")){this._executionOrderLabel.classList.add("sticky-spinner"),Rt(this._executionOrderContent);let h=q.modify(Sw,"spin");R(this._executionOrderContent,...Bn(`$(${h.id})`))}}else if(!c&&e){let p=this._executionOrderLabel.classList.contains("sticky");this._executionOrderLabel.classList.remove("sticky"),o=this.currentCell.layoutInfo.editorHeight-l;let h=this._executionOrderContent.querySelector(".codicon")!==null;if(p||h){let g=this.currentCell.internalMetadata.executionOrder,f=typeof g=="number"?`[${g}]`:"[ ]";this._executionOrderContent.innerText=f}}else{let p=this._executionOrderLabel.classList.contains("sticky");if(this._executionOrderLabel.classList.remove("sticky"),p){let h=this.currentCell.internalMetadata.executionOrder,g=typeof h=="number"?`[${h}]`:"[ ]";this._executionOrderContent.innerText=g}}}this._executionOrderLabel.style.top=`${o}px`}};wRe=I([m(2,rs)],wRe);var mZe=class extends dp{constructor(i,e,t){super(),this._register(j(i,re.FOCUS,()=>{this.currentCell&&t.focusElement(this.currentCell)},!0)),e&&this._register(j(e,re.FOCUS,()=>{this.currentCell&&this.currentCell.outputsViewModels.length&&t.focusNotebookCell(this.currentCell,"output")}))}};var hZe=class extends dp{constructor(e,t,o,n,r,s){super();this.notebookEditor=e;this.titleToolbar=t;this.top=o;this.left=n;this.right=r;this.bottom=s;this.codeFocusIndicator=new Bg(R(this.left.domNode,_(".codeOutput-focus-indicator-container",void 0,_(".codeOutput-focus-indicator.code-focus-indicator")))),this.outputFocusIndicator=new Bg(R(this.left.domNode,_(".codeOutput-focus-indicator-container",void 0,_(".codeOutput-focus-indicator.output-focus-indicator")))),this._register(j(this.codeFocusIndicator.domNode,re.CLICK,()=>{this.currentCell&&(this.currentCell.isInputCollapsed=!this.currentCell.isInputCollapsed)})),this._register(j(this.outputFocusIndicator.domNode,re.CLICK,()=>{this.currentCell&&(this.currentCell.isOutputCollapsed=!this.currentCell.isOutputCollapsed)})),this._register(j(this.left.domNode,re.DBLCLICK,l=>{if(!this.currentCell||!this.notebookEditor.hasModel()||l.target!==this.left.domNode)return;l.offsetY<this.currentCell.layoutInfo.outputContainerOffset?this.currentCell.isInputCollapsed=!this.currentCell.isInputCollapsed:this.currentCell.isOutputCollapsed=!this.currentCell.isOutputCollapsed})),this._register(this.titleToolbar.onDidUpdateActions(()=>{this.updateFocusIndicatorsForTitleMenu()}))}updateInternalLayoutNow(e){if(e.cellKind===1){let t=this.notebookEditor.notebookOptions.computeIndicatorPosition(e.layoutInfo.totalHeight,e.layoutInfo.foldHintHeight,this.notebookEditor.textModel?.viewType);this.bottom.domNode.style.transform=`translateY(${t.bottomIndicatorTop+6}px)`,this.left.setHeight(t.verticalIndicatorHeight),this.right.setHeight(t.verticalIndicatorHeight),this.codeFocusIndicator.setHeight(t.verticalIndicatorHeight-this.getIndicatorTopMargin()*2-e.layoutInfo.chatHeight)}else{let t=e,o=this.notebookEditor.notebookOptions.getLayoutConfiguration(),n=this.notebookEditor.notebookOptions.computeBottomToolbarDimensions(this.notebookEditor.textModel?.viewType),r=t.layoutInfo.codeIndicatorHeight+t.layoutInfo.outputIndicatorHeight+t.layoutInfo.commentHeight;this.left.setHeight(r),this.right.setHeight(r),this.codeFocusIndicator.setHeight(t.layoutInfo.codeIndicatorHeight),this.outputFocusIndicator.setHeight(Math.max(t.layoutInfo.outputIndicatorHeight-t.viewContext.notebookOptions.getLayoutConfiguration().focusIndicatorGap,0)),this.bottom.domNode.style.transform=`translateY(${t.layoutInfo.totalHeight-n.bottomToolbarGap-o.cellBottomMargin}px)`}this.updateFocusIndicatorsForTitleMenu()}updateFocusIndicatorsForTitleMenu(){let e=(this.currentCell?.layoutInfo.chatHeight??0)+this.getIndicatorTopMargin();this.left.domNode.style.transform=`translateY(${e}px)`,this.right.domNode.style.transform=`translateY(${e}px)`}getIndicatorTopMargin(){let e=this.notebookEditor.notebookOptions.getLayoutConfiguration();return this.titleToolbar.hasActions?e.editorToolbarHeight+e.cellTopMargin:e.cellTopMargin}};var CRe=class extends dp{constructor(e,t,o){super();this._notebookExecutionStateService=o;this._progressBar=this._register(new fb(e,kx)),this._progressBar.hide(),this._collapsedProgressBar=this._register(new fb(t,kx)),this._collapsedProgressBar.hide()}didRenderCell(e){this._updateForExecutionState(e)}updateForExecutionState(e,t){this._updateForExecutionState(e,t)}updateState(e,t){if((t.metadataChanged||t.internalMetadataChanged)&&this._updateForExecutionState(e),t.inputCollapsedChanged){let o=this._notebookExecutionStateService.getCellExecution(e.uri);e.isInputCollapsed?(this._progressBar.hide(),o?.state===3&&this._updateForExecutionState(e)):(this._collapsedProgressBar.hide(),o?.state===3&&this._updateForExecutionState(e))}}_updateForExecutionState(e,t){let o=t?.changed??this._notebookExecutionStateService.getCellExecution(e.uri),n=e.isInputCollapsed?this._collapsedProgressBar:this._progressBar;o?.state===3&&(!o.didPause||e.isInputCollapsed)?w8o(n):n.hide()}};CRe=I([m(2,rs)],CRe);function w8o(a){a.infinite().show(500)}var xRe=_,qpe=class extends dp{constructor(e,t,o,n,r,s,l,c){super();this._notebookEditor=e;this._cellContainer=t;this._editor=n;this._instantiationService=r;this._themeService=c;this.leftItems=[];this.rightItems=[];this.width=0;this._onDidClick=this._register(new E);this.onDidClick=this._onDidClick.event;this.statusBarContainer=R(o,xRe(".cell-statusbar-container")),this.statusBarContainer.tabIndex=-1;let u=R(this.statusBarContainer,xRe(".cell-status-left")),p=R(this.statusBarContainer,xRe(".cell-status-right"));this.leftItemsContainer=R(u,xRe(".cell-contributed-items.cell-contributed-items-left")),this.rightItemsContainer=R(p,xRe(".cell-contributed-items.cell-contributed-items-right")),this.itemsDisposable=this._register(new P),this.hoverDelegate=new class{constructor(){this._lastHoverHideTime=0;this.showHover=h=>(h.position=h.position??{},h.position.hoverPosition=3,s.showInstantHover(h));this.placement="element"}get delay(){return Date.now()-this._lastHoverHideTime<200?0:l.getValue("workbench.hover.delay")}onDidHideHover(){this._lastHoverHideTime=Date.now()}},this._register(this._themeService.onDidColorThemeChange(()=>this.currentContext&&this.updateContext(this.currentContext))),this._register(j(this.statusBarContainer,re.CLICK,h=>{if(h.target===u||h.target===p||h.target===this.statusBarContainer)this._onDidClick.fire({type:0,event:h});else{let g=h.target,f=!1;if(g&&Ao(g)){let v=g;(v.classList.contains("cell-status-item-has-command")||v.parentElement&&v.parentElement.classList.contains("cell-status-item-has-command"))&&(f=!0)}f?this._onDidClick.fire({type:2,event:h}):this._onDidClick.fire({type:1,event:h})}}))}didRenderCell(e){if(this._notebookEditor.hasModel()){let t={ui:!0,cell:e,notebookEditor:this._notebookEditor,$mid:13};this.updateContext(t)}if(this._editor){let t=()=>{if(this._editor&&(this._editor.hasWidgetFocus()||this.statusBarContainer.ownerDocument.activeElement&&this.statusBarContainer.contains(this.statusBarContainer.ownerDocument.activeElement)))e.focusMode=1;else{let o=e.focusMode;o===3?e.focusMode=3:o===2&&this._notebookEditor.hasWebviewFocus()?e.focusMode=2:e.focusMode=0}};this.cellDisposables.add(this._editor.onDidFocusEditorWidget(()=>{t()})),this.cellDisposables.add(this._editor.onDidBlurEditorWidget(()=>{this._notebookEditor.hasEditorFocus()&&!(this.statusBarContainer.ownerDocument.activeElement&&this.statusBarContainer.contains(this.statusBarContainer.ownerDocument.activeElement))&&t()})),this.cellDisposables.add(this.onDidClick(o=>{if(this.currentCell instanceof Qm&&o.type!==2&&this._editor){let n=this._editor.getTargetAtClientPoint(o.event.clientX,o.event.clientY-this._notebookEditor.notebookOptions.computeEditorStatusbarHeight(this.currentCell.internalMetadata,this.currentCell.uri));n?.position&&(this._editor.setPosition(n.position),this._editor.focus())}}))}}updateInternalLayoutNow(e){this._cellContainer.classList.toggle("cell-statusbar-hidden",this._notebookEditor.notebookOptions.computeEditorStatusbarHeight(e.internalMetadata,e.uri)===0);let o=e.layoutInfo.editorWidth;if(!o)return;this.width=o,this.statusBarContainer.style.width=`${o}px`;let n=this.getMaxItemWidth();this.leftItems.forEach(r=>r.maxWidth=n),this.rightItems.forEach(r=>r.maxWidth=n)}getMaxItemWidth(){return this.width/2}updateContext(e){this.currentContext=e,this.itemsDisposable.clear(),this.currentContext&&(this.itemsDisposable.add(this.currentContext.cell.onDidChangeLayout(()=>{this.currentContext&&this.updateInternalLayoutNow(this.currentContext.cell)})),this.itemsDisposable.add(this.currentContext.cell.onDidChangeCellStatusBarItems(()=>this.updateRenderedItems())),this.itemsDisposable.add(this.currentContext.notebookEditor.onDidChangeActiveCell(()=>this.updateActiveCell())),this.updateInternalLayoutNow(this.currentContext.cell),this.updateActiveCell(),this.updateRenderedItems())}updateActiveCell(){let e=this.currentContext.notebookEditor.getActiveCell()===this.currentContext?.cell;this.statusBarContainer.classList.toggle("is-active-cell",e)}updateRenderedItems(){let e=this.currentContext.cell.getCellStatusBarItems();e.sort((s,l)=>(l.priority??0)-(s.priority??0));let t=this.getMaxItemWidth(),o=e.filter(s=>s.alignment===1),n=e.filter(s=>s.alignment===2).reverse(),r=(s,l,c)=>{if(s.length>l.length){let u=s.splice(l.length,s.length-l.length);for(let p of u)p.container.remove(),p.dispose()}l.forEach((u,p)=>{let h=s[p];if(h)h.updateItem(u,t);else{let g=this._instantiationService.createInstance(gZe,this.currentContext,this.hoverDelegate,this._editor,u,t);s.push(g),c.appendChild(g.container)}})};r(this.leftItems,o,this.leftItemsContainer),r(this.rightItems,n,this.rightItemsContainer)}dispose(){super.dispose(),Ue(this.leftItems),Ue(this.rightItems)}};qpe=I([m(4,F),m(5,tt),m(6,B),m(7,De)],qpe);var gZe=class extends C{constructor(e,t,o,n,r,s,l,c,u,p){super();this._context=e;this._hoverDelegate=t;this._editor=o;this._telemetryService=s;this._commandService=l;this._notificationService=c;this._themeService=u;this._hoverService=p;this.container=xRe(".cell-status-item");this._itemDisposables=this._register(new P);this.updateItem(n,r)}set maxWidth(e){this.container.style.maxWidth=e+"px"}updateItem(e,t){this._itemDisposables.clear(),(!this._currentItem||this._currentItem.text!==e.text)&&(this._itemDisposables.add(new BC(this.container)).text=e.text.replace(/\n/g," "));let o=s=>xSe(s)?this._themeService.getColorTheme().getColor(s.id)?.toString()||"":s;this.container.style.color=e.color?o(e.color):"",this.container.style.backgroundColor=e.backgroundColor?o(e.backgroundColor):"",this.container.style.opacity=e.opacity?e.opacity:"",this.container.classList.toggle("cell-status-item-show-when-active",!!e.onlyShowWhenActive),typeof t=="number"&&(this.maxWidth=t);let n,r;if(e.accessibilityInformation?(n=e.accessibilityInformation.label,r=e.accessibilityInformation.role):n=e.text?fu(e.text).trim():"",this.container.setAttribute("aria-label",n),this.container.setAttribute("role",r||""),e.tooltip){let s=typeof e.tooltip=="string"?e.tooltip:{markdown:e.tooltip,markdownNotSupportedFallback:void 0};this._itemDisposables.add(this._hoverService.setupManagedHover(this._hoverDelegate,this.container,s))}this.container.classList.toggle("cell-status-item-has-command",!!e.command),e.command?(this.container.tabIndex=0,this._itemDisposables.add(j(this.container,re.CLICK,s=>{this.executeCommand()})),this._itemDisposables.add(j(this.container,re.KEY_DOWN,s=>{let l=new Ii(s);(l.equals(10)||l.equals(3))&&this.executeCommand()}))):this.container.removeAttribute("tabIndex"),this._currentItem=e}async executeCommand(){let e=this._currentItem.command;if(!e)return;let t=typeof e=="string"?e:e.id,o=typeof e=="string"?[]:e.arguments??[];(typeof e=="string"||!e.arguments||!Array.isArray(e.arguments)||e.arguments.length===0)&&o.unshift(this._context),this._telemetryService.publicLog2("workbenchActionExecuted",{id:t,from:"cell status bar"});try{this._editor?.focus(),await this._commandService.executeCommand(t,...o)}catch(n){this._notificationService.error(In(n))}}};gZe=I([m(5,Te),m(6,ge),m(7,Ne),m(8,De),m(9,tt)],gZe);var VR=class extends ml{updateLabel(){this.options.label&&this.label&&Fi(this.label,...Bn(this._commandAction.label??""))}},kRe=class extends ml{render(i){super.render(i),i.classList.add("notebook-action-view-item"),this._actionLabel=document.createElement("a"),i.appendChild(this._actionLabel),this.updateLabel()}updateLabel(){this._actionLabel&&(this._actionLabel.classList.add("notebook-label"),this._actionLabel.innerText=this._action.label)}},N4=class extends mE{constructor(e,t,o,n,r,s,l,c,u){super(e,{...t,hoverDelegate:t?.hoverDelegate??Ni("element")},s,l,c);this._renderLabel=o;this.subActionProvider=n;this.subActionViewItemProvider=r;this._hoverService=u}render(e){super.render(e),e.classList.add("notebook-action-view-item"),e.classList.add("notebook-action-view-item-unified"),this._actionLabel=document.createElement("a"),e.appendChild(this._actionLabel),this._hover=this._register(this._hoverService.setupManagedHover(this.options.hoverDelegate??Ni("element"),this._actionLabel,"")),this.updateLabel();for(let t of[re.CLICK,re.MOUSE_DOWN,Gn.Tap])this._register(j(e,t,o=>this.onClick(o,!0)))}onClick(e,t=!1){$t.stop(e,!0);let o=Jn(this._context)?this.options?.useEventAsContext?e:{preserveFocus:t}:this._context;this.actionRunner.run(this._primaryAction??this._action,o)}updateLabel(){let e=this.subActionProvider.getActions();if(this._actionLabel){let t=e[0];if(this._primaryAction=t,t&&t instanceof Eo){let o=this.element;if(o&&t.item.icon&&q.isThemeIcon(t.item.icon)){let n=q.asClassNameArray(t.item.icon);o.classList.forEach(r=>{r.startsWith("codicon-")&&o.classList.remove(r)}),o.classList.add(...n)}this._renderLabel&&(this._actionLabel.classList.add("notebook-label"),this._actionLabel.innerText=this._action.label,this._hover?.update(t.tooltip.length?t.tooltip:t.label))}else this._renderLabel&&(this._actionLabel.classList.add("notebook-label"),this._actionLabel.innerText=this._action.label,this._hover?.update(this._action.tooltip.length?this._action.tooltip:this._action.label))}}};N4=I([m(5,_e),m(6,ze),m(7,De),m(8,tt)],N4);function aVt(a,i,e,t){let o=t?.extraOffset??0,n=t?.min??0,r=()=>{if(i.isInputCollapsed)e.style.top="";else{let l=a.scrollTop,c=a.getAbsoluteTopOfElement(i),u=l-c+o,p=i.layoutInfo.editorHeight+i.layoutInfo.statusBarHeight-45,h=p>20?Kn(n,u,p):n;e.style.top=`${h}px`}};r();let s=[];return s.push(a.onDidScroll(()=>r()),a.onDidChangeLayout(()=>r())),hn(...s)}var jpe=class extends sZe{constructor(e,t,o,n,r,s,l){super();this._notebookEditor=e;this._bottomCellToolbarContainer=o;this.instantiationService=n;this.contextMenuService=r;this.contextKeyService=s;this.menuService=l}_initialize(){if(this._betweenCellToolbar)return this._betweenCellToolbar;let e=this._register(new Ju(this._bottomCellToolbarContainer,this.contextMenuService,{actionViewItemProvider:(n,r)=>{if(n instanceof Eo)return this._notebookEditor.notebookOptions.getDisplayOptions().insertToolbarAlignment==="center"?this.instantiationService.createInstance(VR,n,{hoverDelegate:r.hoverDelegate}):this.instantiationService.createInstance(ml,n,{hoverDelegate:r.hoverDelegate})}}));this._betweenCellToolbar=e;let t=this._register(this.menuService.createMenu(this._notebookEditor.creationOptions.menuIds.cellInsertToolbar,this.contextKeyService)),o=()=>{let n=fZe(t);e.setActions(n.primary,n.secondary)};return this._register(t.onDidChange(()=>o())),this._register(this._notebookEditor.notebookOptions.onDidChangeOptions(n=>{n.insertToolbarAlignment&&o()})),o(),e}didRenderCell(e){let t=this._initialize();this._notebookEditor.hasModel()&&(t.context={ui:!0,cell:e,notebookEditor:this._notebookEditor,source:"insertToolbar",$mid:13}),this.updateInternalLayoutNow(e)}updateInternalLayoutNow(e){let t=e.layoutInfo.bottomToolbarOffset;this._bottomCellToolbarContainer.style.transform=`translateY(${t}px)`}};jpe=I([m(3,F),m(4,ze),m(5,X),m(6,qt)],jpe);var Qpe=class extends sZe{constructor(e,t,o,n,r,s,l,c){super();this.toolbarContainer=e;this._rootClassDelegate=t;this.toolbarId=o;this.deleteToolbarId=n;this._notebookEditor=r;this.contextKeyService=s;this.menuService=l;this.instantiationService=c;this._onDidUpdateActions=this._register(new E);this.onDidUpdateActions=this._onDidUpdateActions.event}get hasActions(){return this._model?this._model.actions.primary.length+this._model.actions.secondary.length+this._model.deleteActions.primary.length+this._model.deleteActions.secondary.length>0:!1}_initializeModel(){if(this._model)return this._model;let e=this._register(this.menuService.createMenu(this.toolbarId,this.contextKeyService)),t=this._register(this.menuService.createMenu(this.deleteToolbarId,this.contextKeyService)),o=fZe(e),n=fZe(t);return this._model={titleMenu:e,actions:o,deleteMenu:t,deleteActions:n},this._model}_initialize(e,t){if(this._view)return this._view;let o=this._register(Gg()),n=this._register(this.instantiationService.createInstance(Ol,this.toolbarContainer,{actionViewItemProvider:(s,l)=>Ca(this.instantiationService,s,l),renderDropdownAsChildElement:!0,hoverDelegate:o})),r=this._register(this.instantiationService.invokeFunction(s=>C8o(s,this.toolbarContainer,o,"cell-delete-toolbar")));return(e.deleteActions.primary.length!==0||e.deleteActions.secondary.length!==0)&&r.setActions(e.deleteActions.primary,e.deleteActions.secondary),this.setupChangeListeners(n,e.titleMenu,e.actions),this.setupChangeListeners(r,e.deleteMenu,e.deleteActions),this._view={toolbar:n,deleteToolbar:r},this._view}prepareRenderCell(e){this._initializeModel()}didRenderCell(e){let t=this._initializeModel(),o=this._initialize(t,e);if(this.cellDisposables.add(aVt(this._notebookEditor,e,this.toolbarContainer,{extraOffset:4,min:-14})),this._notebookEditor.hasModel()){let n={ui:!0,cell:e,notebookEditor:this._notebookEditor,source:"cellToolbar",$mid:13};this.updateContext(o,n)}}updateContext(e,t){e.toolbar.context=t,e.deleteToolbar.context=t}setupChangeListeners(e,t,o){let n=!1,r;this.updateActions(e,o),this._register(t.onDidChange(()=>{if(n){let l=fZe(t);r=()=>this.updateActions(e,l);return}let s=fZe(t);this.updateActions(e,s)})),this._rootClassDelegate.toggle("cell-toolbar-dropdown-active",!1),this._register(e.onDidChangeDropdownVisibility(s=>{n=s,this._rootClassDelegate.toggle("cell-toolbar-dropdown-active",s),r&&!s&&(nn(()=>{r?.()},0,this._store),r=void 0)}))}updateActions(e,t){let o=ts(e.getElement());e.setActions(t.primary,t.secondary),o&&this._notebookEditor.focus(),t.primary.length||t.secondary.length?(this._rootClassDelegate.toggle("cell-has-toolbar-actions",!0),this._onDidUpdateActions.fire()):(this._rootClassDelegate.toggle("cell-has-toolbar-actions",!1),this._onDidUpdateActions.fire())}};Qpe=I([m(5,X),m(6,qt),m(7,F)],Qpe);function fZe(a){return hl(a.getActions({shouldForwardArgs:!0}),i=>/^inline/.test(i))}function C8o(a,i,e,t){let o=a.get(ze),n=a.get(_e),r=a.get(F),s=new Ju(i,o,{getKeyBinding:l=>n.lookupKeybinding(l.id),actionViewItemProvider:(l,c)=>Ca(r,l,c),renderDropdownAsChildElement:!0,hoverDelegate:e});return t&&s.getElement().classList.add(t),s}var vZe=Kg("collapsedCellPreview",{createHTML:a=>a});var rwi="notebook.cellOutput.copy";W(class extends K{constructor(){super({id:"notebook.cellOuput.showEmptyOutputs",title:d(11755,null),menu:{id:D.NotebookOutputToolbar,when:x.and(gk,SWt)},f1:!1,category:jm})}run(i,e){let t=e.cell;if(t&&t.cellKind===2)for(let o=1;o<t.outputsViewModels.length;o++)t.outputsViewModels[o].visible.get()||(t.outputsViewModels[o].setVisible(!0,!0),t.updateOutputHeight(o,1,"command"))}});W(class extends K{constructor(){super({id:rwi,title:d(11751,null),menu:{id:D.NotebookOutputToolbar,when:gk},category:jm,icon:zJe})}async run(i,e){let t=i.get(ee),o=i.get(Wi),n=i.get(ne),r=lVt(t,e);if(!r)return;let s=cVt(e,r);if(!s)return;let l=s.pickedMimeType?.mimeType;if(l?.startsWith("image/")){let c={skipReveal:!0,outputId:s.model.outputId,altOutputId:s.model.alternativeOutputId};await r.focusNotebookCell(s.cellViewModel,"output",c),r.copyOutputImage(s)}else sco(l,s,o,n)}});function bZe(a,i){let e=i.getViewModel();if(e){let t=e.viewCells.filter(o=>o.cellKind===2);for(let o of t){let n=o.outputsViewModels.find(r=>r.model.outputId===a||r.model.alternativeOutputId===a);if(n)return n}}}function lVt(a,i){return i&&"notebookEditor"in i?i.notebookEditor:qn(a.activeEditorPane)}function cVt(a,i){let e;if(a&&"outputId"in a&&typeof a.outputId=="string"?e=bZe(a.outputId,i):a&&"outputViewModel"in a&&(e=a.outputViewModel),!e){let t=i.getActiveCell();if(!t)return;t.focusedOutputId!==void 0?e=t.outputsViewModels.find(o=>o.model.outputId===t.focusedOutputId):e=t.outputsViewModels.find(o=>o.pickedMimeType?.isTrusted)}return e}var x8o="notebook.cellOutput.openInTextEditor";W(class extends K{constructor(){super({id:x8o,title:d(11752,null),f1:!1,category:jm,icon:zJe})}async run(i,e){let t=i.get(ee),o=i.get(mh),n=i.get(Qe),r=lVt(t,e);if(!r)return;let s=cVt(e,r);if(s?.model.outputId&&r.textModel?.uri){let l=await o.resolve(r.textModel.uri);await n.open(Zo.generateCellOutputUriWithId(r.textModel.uri,s.model.outputId)),l.dispose()}}});var k8o="notebook.cellOutput.saveImage";W(class extends K{constructor(){super({id:k8o,title:d(11754,null),menu:{id:D.NotebookOutputToolbar,when:x.regex(XLe.key,/^image\//)},f1:!1,category:jm,icon:nlo})}async run(i,e){let t=i.get(ee),o=i.get(dn),n=i.get(be),r=i.get(ne),s=lVt(t,e);if(!s)return;let l=cVt(e,s);if(!l)return;let c=l.pickedMimeType?.mimeType;if(!c?.startsWith("image/"))return;let u=l.model.outputs.find(b=>b.mime===c);if(!u){r.error("Could not find output item with mime type",c);return}let h={"image/png":"png","image/jpeg":"jpg","image/jpg":"jpg","image/gif":"gif","image/svg+xml":"svg","image/webp":"webp","image/bmp":"bmp","image/tiff":"tiff"}[c]||"png",g=`image.${h}`,f=s.textModel?.uri?A.joinPath(A.file(s.textModel.uri.fsPath),"..",g):void 0,v=await o.showSaveDialog({defaultUri:f,filters:[{name:d(11750,null),extensions:[h]}]});if(v)try{let b=u.data;await n.writeFile(v,b),r.info("Saved image output to",v.toString())}catch(b){r.error("Failed to save image output",b)}}});var E8o="notebook.cellOutput.openInOutputPreview";W(class extends K{constructor(){super({id:E8o,title:d(11753,null),menu:{id:D.NotebookOutputToolbar,when:x.and(gk,x.equals("config.notebook.output.openInPreviewEditor.enabled",!0))},f1:!1,category:jm})}async run(i,e){let t=i.get(ee),o=i.get(Qe),n=lVt(t,e);if(!n)return;let r=cVt(e,n);if(!r)return;let s=r.cellViewModel;if(!s)return;let l=n.getCellByHandle(s.handle);if(!l)return;let c=n.getCellIndex(l);if(c===void 0)return;let u=s.outputsViewModels.indexOf(r);if(u===-1||!n.textModel)return;let p=Zo.generateOutputEditorUri(n.textModel.uri,l.id,c,r.model.outputId,u);o.open(p,{openToSide:!0})}});var O4=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.notebookEditor=e;this.viewCell=t;this.cellOutputContainer=o;this.outputContainer=n;this.output=r;this.notebookService=s;this.quickInputService=l;this.menuService=u;this.extensionsWorkbenchService=p;this.instantiationService=h;this.toolbarDisposables=this._register(new P);this.toolbarAttached=!1;this._outputHeightTimer=null;this.contextKeyService=c,this._register(this.output.model.onDidChangeData(()=>{this.rerender()})),this._register(this.output.onDidResetRenderer(()=>{this.rerender()}))}detach(){this.renderedOutputContainer?.remove();let e=0;if(this.innerContainer){for(let t=0;t<this.innerContainer.childNodes.length&&(this.innerContainer.childNodes[t].className==="rendered-output"&&e++,!(e>1));t++);e===0&&this.innerContainer.remove()}this.notebookEditor.removeInset(this.output)}updateDOMTop(e){this.innerContainer&&(this.innerContainer.style.top=`${e}px`)}rerender(){if(this.notebookEditor.hasModel()&&this.innerContainer&&this.renderResult&&this.renderResult.type===1){let[e,t]=this.output.resolveMimeTypes(this.notebookEditor.textModel,this.notebookEditor.activeKernel?.preloadProvides),o=e[t];if(o.mimeType===this.renderResult.mimeType&&o.rendererId===this.renderResult.renderer.id){let n=this.viewCell.outputsViewModels.indexOf(this.output);this.notebookEditor.updateOutput(this.viewCell,this.renderResult,this.viewCell.getOutputOffset(n));return}}if(this.innerContainer){let e=this.innerContainer.nextElementSibling;this.toolbarDisposables.clear();let t=this.innerContainer;t&&(t.remove(),this.notebookEditor.removeInset(this.output)),this.render(e)}else{let e=this.cellOutputContainer.renderedOutputEntries.findIndex(o=>o.element===this),t=e>0&&this.cellOutputContainer.renderedOutputEntries[e-1].element.innerContainer?.parentElement?this.cellOutputContainer.renderedOutputEntries[e-1].element.innerContainer:void 0;this.render(t)}this._relayoutCell()}_generateInnerOutputContainer(e,t){return this.innerContainer=_(".output-inner-container"),e&&e.nextElementSibling?this.outputContainer.domNode.insertBefore(this.innerContainer,e.nextElementSibling):this.outputContainer.domNode.appendChild(this.innerContainer),this.innerContainer.setAttribute("output-mime-type",t.mimeType),this.innerContainer}render(e){let t=this.viewCell.outputsViewModels.indexOf(this.output);if(this.viewCell.isOutputCollapsed||!this.notebookEditor.hasModel()){this.cellOutputContainer.flagAsStale();return}if(!Zo.parse(this.viewCell.uri)?.notebook)return;let n=this.notebookEditor.textModel,[r,s]=this.output.resolveMimeTypes(n,this.notebookEditor.activeKernel?.preloadProvides),l=r[s];if(!r.find(h=>h.isTrusted)||r.length===0){this.viewCell.updateOutputHeight(t,0,"CellOutputElement#noMimeType");return}let c=r[s],u=this.notebookService.getRendererInfo(c.rendererId);!u&&c.mimeType.indexOf("text/")>-1&&(u=this.notebookService.getRendererInfo("vscode.builtin-renderer"));let p=this._generateInnerOutputContainer(e,c);if(t===0||this.output.visible.get()?this._attachToolbar(p,n,this.notebookEditor.activeKernel,t,l,r):(this._register(he(h=>{let g=h.readObservable(this.output.visible);g&&!this.toolbarAttached?this._attachToolbar(p,n,this.notebookEditor.activeKernel,t,l,r):g||this.toolbarDisposables.clear(),this.cellOutputContainer.checkForHiddenOutputs()})),this.cellOutputContainer.hasHiddenOutputs.set(!0,void 0)),this.renderedOutputContainer=R(p,_(".rendered-output")),this.renderResult=u?{type:1,renderer:u,source:this.output,mimeType:c.mimeType}:this._renderMissingRenderer(this.output,c.mimeType),this.output.pickedMimeType=c,!this.renderResult){this.viewCell.updateOutputHeight(t,0,"CellOutputElement#renderResultUndefined");return}return this.notebookEditor.createOutput(this.viewCell,this.renderResult,this.viewCell.getOutputOffset(t),!1),p.classList.add("background"),{initRenderIsSynchronous:!1}}_renderMissingRenderer(e,t){if(!e.model.outputs.length)return this._renderMessage(e,d(12103,null));if(!t){let n=e.model.outputs.map(r=>r.mime).join(", ");return this._renderMessage(e,d(12105,null,n))}return this._renderSearchForMimetype(e,t)}_renderSearchForMimetype(e,t){let o=`@tag:notebookRenderer ${t}`,n=_("p",void 0,`No renderer could be found for mimetype "${t}", but one might be available on the Marketplace.`),r=_("a",{href:`command:workbench.extensions.search?%22${o}%22`,class:"monaco-button monaco-text-button",tabindex:0,role:"button",style:"padding: 8px; text-decoration: none; color: rgb(255, 255, 255); background-color: rgb(14, 99, 156); max-width: 200px;"},"Search Marketplace");return{type:0,source:e,htmlContent:n.outerHTML+r.outerHTML}}_renderMessage(e,t){let o=_("p",void 0,t);return{type:0,source:e,htmlContent:o.outerHTML}}shouldEnableCopy(e){if(!e.find(t=>IRe.indexOf(t.mimeType)||t.mimeType.startsWith("image/")))return!1;if(oL(e[0].mimeType)){let t=this.output.cellViewModel,o=t.outputsViewModels.indexOf(this.output);if(o>0){let n=t.model.outputs[o-1];return!oL(n.outputs[0].mime)}}return!0}async _attachToolbar(e,t,o,n,r,s){let l=s.filter(w=>w.isTrusted).length>1,c=this.shouldEnableCopy(s);if(n>0&&!l&&!c||!this.notebookEditor.hasModel())return;e.style.position="relative";let u=_(".cell-output-toolbar");e.appendChild(u);let p=this.toolbarDisposables.add(this.instantiationService.createInstance(Ol,u,{renderDropdownAsChildElement:!1}));p.context={ui:!0,cell:this.output.cellViewModel,outputViewModel:this.output,notebookEditor:this.notebookEditor,$mid:13};let h=this.toolbarDisposables.add(new st("notebook.output.pickMimetype",d(12106,null),q.asClassName(_Wt),void 0,async w=>this._pickActiveMimeTypeRenderer(e,t,o,this.output))),g=this.toolbarDisposables.add(this.contextKeyService.createScoped(e)),f=SWt.bindTo(g),v=bWt.bindTo(g),b=XLe.bindTo(g);v.set(n===0),b.set(r.mimeType),this.toolbarDisposables.add(he(w=>{f.set(this.cellOutputContainer.hasHiddenOutputs.read(w))}));let S=this.toolbarDisposables.add(this.menuService.createMenu(D.NotebookOutputToolbar,g)),y=()=>{let{secondary:w}=hl(S.getActions({shouldForwardArgs:!0}),()=>!1);c||(w=w.filter(k=>k.id!==rwi)),l&&(w=[h,...w]),p.setActions([],w)};y(),this.toolbarDisposables.add(S.onDidChange(y))}async _pickActiveMimeTypeRenderer(e,t,o,n){let[r,s]=n.resolveMimeTypes(t,o?.preloadProvides),l=[],c=[];r.forEach((S,y)=>{S.isTrusted&&(S.rendererId===az?c:l).push({label:S.mimeType,id:S.mimeType,index:y,picked:y===s,detail:this._generateRendererInfo(S.rendererId),description:y===s?d(12102,null):void 0})}),c.some(S=>T8o.includes(S.id))&&c.push({label:d(12104,null),id:"installRenderers",index:r.length});let u=new P,p=u.add(this.quickInputService.createQuickPick({useSeparators:!0}));p.items=[...l,{type:"separator"},...c],p.activeItems=l.filter(S=>!!S.picked),p.placeholder=l.length!==r.length?d(12108,null):d(12107,null);let h=await new Promise(S=>{u.add(p.onDidAccept(()=>{S(p.selectedItems.length===1?p.selectedItems[0]:void 0),u.dispose()})),p.show()});if(h===void 0||h.index===s)return;if(h.id==="installRenderers"){this._showJupyterExtension();return}let g=e.nextElementSibling;this.toolbarDisposables.clear();let f=this.innerContainer;f&&(f.remove(),this.notebookEditor.removeInset(n)),n.pickedMimeType=r[h.index],this.viewCell.updateOutputMinHeight(this.viewCell.layoutInfo.outputTotalHeight);let{mimeType:v,rendererId:b}=r[h.index];this.notebookService.updateMimePreferredRenderer(t.viewType,v,b,r.map(S=>S.mimeType)),this.render(g),this._validateFinalOutputHeight(!1),this._relayoutCell()}async _showJupyterExtension(){await this.extensionsWorkbenchService.openSearch(`@id:${Gxe}`)}_generateRendererInfo(e){let t=this.notebookService.getRendererInfo(e);return t?`${t.displayName!==""?t.displayName:t.id} (${t.extensionId.value})`:d(12109,null)}_validateFinalOutputHeight(e){this._outputHeightTimer!==null&&clearTimeout(this._outputHeightTimer),e?this.viewCell.unlockOutputHeight():this._outputHeightTimer=setTimeout(()=>{this.viewCell.unlockOutputHeight()},1e3)}_relayoutCell(){this.notebookEditor.layoutNotebookCell(this.viewCell,this.viewCell.layoutInfo.totalHeight)}dispose(){this._outputHeightTimer&&(this.viewCell.unlockOutputHeight(),clearTimeout(this._outputHeightTimer)),super.dispose()}};O4=I([m(5,un),m(6,Ge),m(7,X),m(8,qt),m(9,zi),m(10,F)],O4);var Ype=class{constructor(i,e){this.model=i;this.element=e}};var ERe=class extends dp{constructor(e,t,o,n,r,s,l){super();this.notebookEditor=e;this.viewCell=t;this.templateData=o;this.options=n;this.openerService=r;this._notebookExecutionStateService=s;this.instantiationService=l;this._outputEntries=[];this._hasStaleOutputs=!1;this.hasHiddenOutputs=Le("hasHiddenOutputs",!1);this._outputHeightTimer=null;this._register(t.onDidStartExecution(()=>{t.updateOutputMinHeight(t.layoutInfo.outputTotalHeight)})),this._register(t.onDidStopExecution(()=>{this._validateFinalOutputHeight(!1)})),this._register(t.onDidChangeOutputs(c=>{let p=this._notebookExecutionStateService.getCellExecution(t.uri)?1:2;this._updateOutputs(c,p)})),this._register(t.onDidChangeLayout(()=>{this.updateInternalLayoutNow(t)}))}checkForHiddenOutputs(){this._outputEntries.find(e=>!e.model.visible.get())?this.hasHiddenOutputs.set(!0,void 0):this.hasHiddenOutputs.set(!1,void 0)}get renderedOutputEntries(){return this._outputEntries}updateInternalLayoutNow(e){this.templateData.outputContainer.setTop(e.layoutInfo.outputContainerOffset),this.templateData.outputShowMoreContainer.setTop(e.layoutInfo.outputShowMoreContainerOffset),this._outputEntries.forEach(t=>{let o=this.viewCell.outputsViewModels.indexOf(t.model);if(o>=0){let n=this.viewCell.getOutputOffsetInContainer(o);t.element.updateDOMTop(n)}})}render(){try{this._doRender()}finally{this._relayoutCell()}}flagAsStale(){this._hasStaleOutputs=!0}_doRender(){if(this.viewCell.outputsViewModels.length>0){this.viewCell.layoutInfo.outputTotalHeight!==0&&this.viewCell.updateOutputMinHeight(this.viewCell.layoutInfo.outputTotalHeight),bn(this.templateData.outputContainer.domNode);for(let e=0;e<Math.min(this.options.limit,this.viewCell.outputsViewModels.length);e++){let t=this.viewCell.outputsViewModels[e],o=this.instantiationService.createInstance(O4,this.notebookEditor,this.viewCell,this,this.templateData.outputContainer,t);this._outputEntries.push(new Ype(t,o)),o.render(void 0)}this.viewCell.outputsViewModels.length>this.options.limit&&(bn(this.templateData.outputShowMoreContainer.domNode),this.viewCell.updateOutputShowMoreContainerHeight(46)),this._validateFinalOutputHeight(!1)}else xo(this.templateData.outputContainer.domNode);this.templateData.outputShowMoreContainer.domNode.innerText="",this.viewCell.outputsViewModels.length>this.options.limit?this.templateData.outputShowMoreContainer.domNode.appendChild(this._generateShowMoreElement(this.templateData.templateDisposables)):(xo(this.templateData.outputShowMoreContainer.domNode),this.viewCell.updateOutputShowMoreContainerHeight(0))}viewUpdateShowOutputs(e){this._hasStaleOutputs&&(this._hasStaleOutputs=!1,this._outputEntries.forEach(t=>{t.element.rerender()}));for(let t=0;t<this._outputEntries.length;t++){let n=this._outputEntries[t].element;n.renderResult?this.notebookEditor.createOutput(this.viewCell,n.renderResult,this.viewCell.getOutputOffset(t),!1):n.render(void 0)}this._relayoutCell()}viewUpdateHideOuputs(){for(let e=0;e<this._outputEntries.length;e++)this.notebookEditor.hideInset(this._outputEntries[e].model)}_validateFinalOutputHeight(e){this._outputHeightTimer!==null&&clearTimeout(this._outputHeightTimer);let t=this._notebookExecutionStateService.getCellExecution(this.viewCell.uri);e?this.viewCell.unlockOutputHeight():t?.state!==3&&(this._outputHeightTimer=setTimeout(()=>{this.viewCell.unlockOutputHeight()},200))}_updateOutputs(e,t=2){let o=this.viewCell.layoutInfo.outputTotalHeight;this.viewCell.updateOutputMinHeight(o),this.viewCell.outputsViewModels.length?bn(this.templateData.outputContainer.domNode):xo(this.templateData.outputContainer.domNode),this.viewCell.spliceOutputHeights(e.start,e.deleteCount,e.newOutputs.map(n=>0)),this._renderNow(e,t)}_renderNow(e,t){if(e.start>=this.options.limit)return;let o=this._outputEntries.slice(0,e.start),n=this._outputEntries.slice(e.start,e.start+e.deleteCount),r=this._outputEntries.slice(e.start+e.deleteCount),s=this.viewCell.outputsViewModels.slice(e.start,e.start+e.newOutputs.length);if(o.length+s.length+r.length>this.options.limit)if(o.length+s.length>this.options.limit){[...n,...r].forEach(c=>{c.element.detach(),c.element.dispose()}),s=s.slice(0,this.options.limit-o.length);let l=s.map(c=>new Ype(c,this.instantiationService.createInstance(O4,this.notebookEditor,this.viewCell,this,this.templateData.outputContainer,c)));this._outputEntries=[...o,...l];for(let c=o.length;c<this._outputEntries.length;c++)this._outputEntries[c].element.render(void 0)}else{let l=r.slice(this.options.limit-o.length-s.length);[...n,...l].forEach(p=>{p.element.detach(),p.element.dispose()});let c=o.length+s.length,u=s.map(p=>new Ype(p,this.instantiationService.createInstance(O4,this.notebookEditor,this.viewCell,this,this.templateData.outputContainer,p)));this._outputEntries=[...o,...u,...r.slice(0,this.options.limit-o.length-s.length)];for(let p=o.length;p<c;p++){let h=p-1>=0&&this._outputEntries[p-1]&&this._outputEntries[p-1].element.innerContainer?.parentElement?this._outputEntries[p-1].element.innerContainer:void 0;this._outputEntries[p].element.render(h)}}else{n.forEach(p=>{p.element.detach(),p.element.dispose()});let l=o.length+s.length,c=s.map(p=>new Ype(p,this.instantiationService.createInstance(O4,this.notebookEditor,this.viewCell,this,this.templateData.outputContainer,p))),u=[];if(o.length+c.length+r.length<this.viewCell.outputsViewModels.length){let p=Math.min(this.options.limit,this.viewCell.outputsViewModels.length);u=this.viewCell.outputsViewModels.slice(o.length+c.length+r.length,p).map(h=>new Ype(h,this.instantiationService.createInstance(O4,this.notebookEditor,this.viewCell,this,this.templateData.outputContainer,h)))}this._outputEntries=[...o,...c,...r,...u];for(let p=o.length;p<l;p++){let h=p-1>=0&&this._outputEntries[p-1]&&this._outputEntries[p-1].element.innerContainer?.parentElement?this._outputEntries[p-1].element.innerContainer:void 0;this._outputEntries[p].element.render(h)}for(let p=0;p<u.length;p++)this._outputEntries[o.length+s.length+r.length+p].element.render(void 0)}this.viewCell.outputsViewModels.length>this.options.limit?(bn(this.templateData.outputShowMoreContainer.domNode),this.templateData.outputShowMoreContainer.domNode.hasChildNodes()||this.templateData.outputShowMoreContainer.domNode.appendChild(this._generateShowMoreElement(this.templateData.templateDisposables)),this.viewCell.updateOutputShowMoreContainerHeight(46)):xo(this.templateData.outputShowMoreContainer.domNode),this._relayoutCell(),this._validateFinalOutputHeight(t===2&&this.viewCell.outputsViewModels.length===0)}_generateShowMoreElement(e){let t={value:`There are more than ${this.options.limit} outputs, [show more (open the raw output data in a text editor) ...](command:workbench.action.openLargeOutput)`,isTrusted:!0,supportThemeIcons:!0},o=e.add(nb(t,{actionHandler:n=>{n==="command:workbench.action.openLargeOutput"&&this.openerService.open(Zo.generateCellOutputUriWithId(this.notebookEditor.textModel.uri))}}));return o.element.classList.add("output-show-more"),o.element}_relayoutCell(){this.notebookEditor.layoutNotebookCell(this.viewCell,this.viewCell.layoutInfo.totalHeight)}dispose(){this.viewCell.updateOutputMinHeight(0),this._outputHeightTimer&&clearTimeout(this._outputHeightTimer),this._outputEntries.forEach(e=>{e.element.dispose()}),super.dispose()}};ERe=I([m(4,Qe),m(5,rs),m(6,F)],ERe);var T8o=["application/geo+json","application/vdom.v1+json","application/vnd.dataresource+json","application/vnd.plotly.v1+json","application/vnd.vega.v2+json","application/vnd.vega.v3+json","application/vnd.vega.v4+json","application/vnd.vega.v5+json","application/vnd.vegalite.v1+json","application/vnd.vegalite.v2+json","application/vnd.vegalite.v3+json","application/vnd.vegalite.v4+json","application/x-nteract-model-debug+json","image/svg+xml","text/latex","text/vnd.plotly.v1+html","application/vnd.jupyter.widget-view+json","application/vnd.code.notebook.error"];var TRe=class extends C{constructor(e,t,o,n){super();this._cell=t;this._element=o;this._executionStateService=n;this._visible=!1;this._update(),this._register(this._executionStateService.onDidChangeExecution(r=>{r.type===0&&r.affectsCell(this._cell.uri)&&this._update()})),this._register(this._cell.model.onDidChangeInternalMetadata(()=>this._update()))}setVisibility(e){this._visible=e,this._update()}_update(){if(!this._visible)return;let e=this._executionStateService.getCellExecution(this._cell.uri),t=this._getItemForState(e,this._cell.model.internalMetadata);t?(this._element.style.display="",Fi(this._element,...Bn(t.text)),this._element.title=t.tooltip??""):(this._element.style.display="none",Fi(this._element))}_getItemForState(e,t){let o=e?.state,{lastRunSuccess:n}=t;if(!o&&n)return{text:`$(${xWt.id})`,tooltip:d(12115,null)};if(!o&&n===!1)return{text:`$(${oRe.id})`,tooltip:d(12113,null)};if(o===2||o===1)return{text:`$(${kWt.id})`,tooltip:d(12114,null)};if(o===3)return{text:`$(${q.modify(Sw,"spin").id})`,tooltip:d(12112,null)}}};TRe=I([m(3,rs)],TRe);var _Re=class extends C{constructor(e,t,o,n,r,s,l,c,u,p){super();this.notebookEditor=e;this.viewCell=t;this.templateData=o;this.editorPool=n;this.instantiationService=r;this.keybindingService=s;this.languageService=l;this.configurationService=c;this._isDisposed=!1;this._useNewApproachForEditorLayout=!0;this._pointerDownInEditor=!1;this._pointerDraggingInEditor=!1;let g=`[Cell ${this.notebookEditor.getCellIndex(this.viewCell)}]`,f=this._debug=S=>{p.debug("CellLayout",`${g} ${S}`)};this._cellEditorOptions=this._register(new $F(this.notebookEditor.getBaseCellEditorOptions(t.language),this.notebookEditor.notebookOptions,this.configurationService)),this._outputContainerRenderer=this.instantiationService.createInstance(ERe,e,t,o,{limit:vRe}),this.cellParts=this._register(o.cellParts.concatContentPart([this._cellEditorOptions,this._outputContainerRenderer],Me(e.getDomNode())));let v={height:this.calculateInitEditorHeight(),width:this.viewCell.layoutInfo.editorWidth};this._cellLayout=new swi(this._useNewApproachForEditorLayout,e,t,o,{debug:f},v),this.initializeEditor(v),this._renderedInputCollapseState=!1,this.registerNotebookEditorListeners(),this.registerViewCellLayoutChange(),this.registerCellEditorEventListeners(),this.registerMouseListener(),this._register(H.any(this.viewCell.onDidStartExecution,this.viewCell.onDidStopExecution)(S=>{this.cellParts.updateForExecutionState(this.viewCell,S)})),this._register(this.viewCell.onDidChangeState(S=>{if(this.cellParts.updateState(this.viewCell,S),S.outputIsHoveredChanged&&this.updateForOutputHover(),S.outputIsFocusedChanged&&this.updateForOutputFocus(),(S.metadataChanged||S.internalMetadataChanged)&&this.updateEditorOptions(),S.inputCollapsedChanged||S.outputCollapsedChanged){this.viewCell.pauseLayout();let y=this.updateForCollapseState();this.viewCell.resumeLayout(),y&&this.relayoutCell()}S.focusModeChanged&&this.updateEditorForFocusModeChange(!0)})),this.updateEditorOptions(),this.updateEditorForFocusModeChange(!1),this.updateForOutputHover(),this.updateForOutputFocus(),this.cellParts.scheduleRenderCell(this.viewCell),this._register(Z(()=>{this.cellParts.unrenderCell(this.viewCell)})),this.viewCell.editorHeight=v.height,this._outputContainerRenderer.render(),this._renderedOutputCollapseState=!1,this.initialViewUpdateExpanded(),this._register(this.viewCell.onLayoutInfoRead(()=>{this.cellParts.prepareLayout()}));let b=R(this.templateData.cellInputCollapsedContainer,_(".collapsed-execution-icon"));this._register(Z(()=>{b.remove()})),this._collapsedExecutionIcon=this._register(this.instantiationService.createInstance(TRe,this.notebookEditor,this.viewCell,b)),this.updateForCollapseState(),this._register(H.runAndSubscribe(t.onDidChangeOutputs,this.updateForOutputs.bind(this))),this._register(H.runAndSubscribe(t.onDidChangeLayout,this.updateForLayout.bind(this))),this._cellEditorOptions.setLineNumbers(this.viewCell.lineNumbers),o.editor.updateOptions(this._cellEditorOptions.getUpdatedValue(this.viewCell.internalMetadata,this.viewCell.uri))}updateCodeCellOptions(e){e.editor.updateOptions(this._cellEditorOptions.getUpdatedValue(this.viewCell.internalMetadata,this.viewCell.uri));let t=new $e;this._register({dispose(){t.dispose(!0)}}),wa(this.viewCell.resolveTextModel(),t.token).then(o=>{this._isDisposed||o&&o.updateOptions({indentSize:this._cellEditorOptions.indentSize,tabSize:this._cellEditorOptions.tabSize,insertSpaces:this._cellEditorOptions.insertSpaces})})}updateForLayout(){this._pendingLayout?.dispose(),this._pendingLayout=T6(Me(this.notebookEditor.getDomNode()),()=>{this.cellParts.updateInternalLayoutNow(this.viewCell)})}updateForOutputHover(){this.templateData.container.classList.toggle("cell-output-hover",this.viewCell.outputIsHovered)}updateForOutputFocus(){this.templateData.container.classList.toggle("cell-output-focus",this.viewCell.outputIsFocused)}calculateInitEditorHeight(){let e=this.viewCell.lineCount,t=this.viewCell.layoutInfo.fontInfo?.lineHeight||17,o=this.notebookEditor.notebookOptions.computeEditorPadding(this.viewCell.internalMetadata,this.viewCell.uri);return this.viewCell.layoutInfo.editorHeight===0?e*t+o.top+o.bottom:this.viewCell.layoutInfo.editorHeight}initializeEditor(e){this._debug(`Initialize Editor ${e.height} x ${e.width}, Scroll Top = ${this.notebookEditor.scrollTop}`),this._cellLayout.layoutEditor("init"),this.layoutEditor(e);let t=new $e;this._register({dispose(){t.dispose(!0)}}),wa(this.viewCell.resolveTextModel(),t.token).then(o=>{if(!(this._isDisposed||o?.isDisposed())){if(o&&this.templateData.editor){if(this._reigsterModelListeners(o),this.templateData.editor.setModel(o),this._isDisposed)return;o.updateOptions({indentSize:this._cellEditorOptions.indentSize,tabSize:this._cellEditorOptions.tabSize,insertSpaces:this._cellEditorOptions.insertSpaces}),this.viewCell.attachTextEditor(this.templateData.editor,this.viewCell.layoutInfo.estimatedHasHorizontalScrolling);let n=()=>{this.notebookEditor.getActiveCell()===this.viewCell&&this.viewCell.focusMode===1&&(this.notebookEditor.hasEditorFocus()||this.notebookEditor.getDomNode().ownerDocument.activeElement===this.notebookEditor.getDomNode().ownerDocument.body)&&this.templateData.editor.focus()};if(n(),this.templateData.editor.getContentHeight()!==e.height&&this.onCellEditorHeightChange("onDidResolveTextModel"),this._isDisposed)return;n()}this._register(this._cellEditorOptions.onDidChange(()=>this.updateCodeCellOptions(this.templateData)))}})}updateForOutputs(){mm(this.viewCell.outputsViewModels.length>0,this.templateData.focusSinkElement)}updateEditorOptions(){let e=this.templateData.editor;if(!e)return;let t=this.notebookEditor.isReadOnly,o=this.notebookEditor.notebookOptions.computeEditorPadding(this.viewCell.internalMetadata,this.viewCell.uri),n=e.getOptions();(n.get(104)!==t||n.get(96)!==o)&&e.updateOptions({readOnly:this.notebookEditor.isReadOnly,padding:this.notebookEditor.notebookOptions.computeEditorPadding(this.viewCell.internalMetadata,this.viewCell.uri)})}registerNotebookEditorListeners(){this._register(this.notebookEditor.onDidScroll(()=>{this.adjustEditorPosition(),this._cellLayout.layoutEditor("nbDidScroll")})),this._register(this.notebookEditor.onDidChangeLayout(()=>{this.adjustEditorPosition(),this.onCellWidthChange("nbLayoutChange")}))}adjustEditorPosition(){if(this._useNewApproachForEditorLayout)return;let e=-7,t=0,o=this.notebookEditor.scrollTop,n=this.notebookEditor.getAbsoluteTopOfElement(this.viewCell),r=o-n+e,s=this.notebookEditor.getLayoutInfo(),l=s.height-s.stickyHeight-26,c=this.viewCell.layoutInfo.editorHeight-l,u=c>20?Kn(t,r,c):t;this.templateData.editorPart.style.top=`${u}px`,this.templateData.editor.setScrollTop(u)}registerViewCellLayoutChange(){this._register(this.viewCell.onDidChangeLayout(e=>{e.outerWidth!==void 0&&this.templateData.editor.getLayoutInfo().width!==this.viewCell.layoutInfo.editorWidth&&(this.onCellWidthChange("viewCellLayoutChange"),this.adjustEditorPosition())}))}registerCellEditorEventListeners(){this._register(this.templateData.editor.onDidContentSizeChange(e=>{e.contentHeightChanged&&this.viewCell.layoutInfo.editorHeight!==e.contentHeight&&(this.onCellEditorHeightChange("onDidContentSizeChange"),this.adjustEditorPosition())})),this._useNewApproachForEditorLayout&&this._register(this.templateData.editor.onDidScrollChange(e=>{if(this._pointerDownInEditor||this._pointerDraggingInEditor||this._cellLayout.editorVisibility==="Invisible"||!this.templateData.editor.hasTextFocus()||this._cellLayout._lastChangedEditorScrolltop===e.scrollTop||this._cellLayout.isUpdatingLayout)return;let t=this.notebookEditor.scrollTop,o=e.scrollTop-(this._cellLayout._lastChangedEditorScrolltop??0);if(this._cellLayout.editorVisibility==="Full (Small Viewport)"&&typeof this._cellLayout._lastChangedEditorScrolltop=="number")this._debug(`Scroll Change (1) = ${e.scrollTop} changed by ${o} (notebook scrollTop: ${t}, setEditorScrollTop: ${e.scrollTop})`);else if(this._cellLayout.editorVisibility==="Bottom Clipped"&&typeof this._cellLayout._lastChangedEditorScrolltop=="number")this._debug(`Scroll Change (2) = ${e.scrollTop} changed by ${o} (notebook scrollTop: ${t}, setNotebookScrollTop: ${t+e.scrollTop})`),this.notebookEditor.setScrollTop(t+e.scrollTop);else if(this._cellLayout.editorVisibility==="Top Clipped"&&typeof this._cellLayout._lastChangedEditorScrolltop=="number"){let n=t+o-1;this._debug(`Scroll Change (3) = ${e.scrollTop} changed by ${o} (notebook scrollTop: ${t}, setNotebookScrollTop?: ${n})`),t!==n&&this.notebookEditor.setScrollTop(n)}else this._debug(`Scroll Change (4) = ${e.scrollTop} changed by ${o} (notebook scrollTop: ${t})`),this._cellLayout._lastChangedEditorScrolltop=void 0})),this._register(this.templateData.editor.onDidChangeCursorSelection(e=>{if(e.source==="restoreState"||e.oldModelVersionId===0||!this.templateData.editor.hasTextFocus()||(this._pointerDownInEditor||this._pointerDraggingInEditor)&&this._useNewApproachForEditorLayout)return;let t=this.templateData.editor.getSelections();if(t?.length){let o=this.templateData.editor.getContentHeight(),n=this.viewCell.layoutInfo.editorHeight;if(o!==n&&(this._useNewApproachForEditorLayout||(this._debug("onDidChangeCursorSelection"),this.onCellEditorHeightChange("onDidChangeCursorSelection")),this._isDisposed))return;let r=t[t.length-1];this.notebookEditor.revealRangeInViewAsync(this.viewCell,r)}})),this._register(this.templateData.editor.onDidBlurEditorWidget(()=>{Zu.get(this.templateData.editor)?.hideLightBulbWidget()}))}_reigsterModelListeners(e){this._register(e.onDidChangeTokens(()=>{if(this.viewCell.isInputCollapsed&&this._inputCollapseElement){let t=this._getRichTextFromLineTokens(e);this._inputCollapseElement.innerHTML=vZe?.createHTML(t)??t,this._attachInputExpandButton(this._inputCollapseElement)}}))}registerMouseListener(){let e=()=>{this._pointerDownInEditor=!1,this._pointerDraggingInEditor=!1,this._cellLayout.setPointerDown(!1)};if(this._register(this.templateData.editor.onMouseDown(t=>{t.event.rightButton&&t.event.preventDefault(),this._useNewApproachForEditorLayout&&t.event.leftButton&&(this._pointerDownInEditor=!0,this._pointerDraggingInEditor=!1,this._cellLayout.setPointerDown(!1))})),this._useNewApproachForEditorLayout&&this._register(this.templateData.editor.onMouseMove(t=>{if(this._pointerDownInEditor){if(!t.event.leftButton){e();return}this._pointerDraggingInEditor||(this._pointerDraggingInEditor=!0,this._cellLayout.setPointerDown(!0))}})),this._useNewApproachForEditorLayout){let t=Me(this.notebookEditor.getDomNode());this._register(j(t,"mouseup",e)),this._register(j(t,"pointerup",e)),this._register(j(t,"pointercancel",e)),this._register(j(t,"blur",e)),this._register(j(t,"keydown",o=>{o.key==="Escape"&&(this._pointerDownInEditor||this._pointerDraggingInEditor)&&e()}))}}shouldPreserveEditor(){return this.notebookEditor.getActiveCell()===this.viewCell&&this.viewCell.focusMode===1&&(this.notebookEditor.hasEditorFocus()||this.notebookEditor.getDomNode().ownerDocument.activeElement===this.notebookEditor.getDomNode().ownerDocument.body)}updateEditorForFocusModeChange(e){this.shouldPreserveEditor()&&(e?this.templateData.editor.focus():this._register(Ah(Me(this.templateData.container),()=>{this.templateData.editor.focus()}))),this.templateData.container.classList.toggle("cell-editor-focus",this.viewCell.focusMode===1),this.templateData.container.classList.toggle("cell-output-focus",this.viewCell.focusMode===2)}updateForCollapseState(){return this.viewCell.isOutputCollapsed===this._renderedOutputCollapseState&&this.viewCell.isInputCollapsed===this._renderedInputCollapseState?!1:(this.viewCell.layoutChange({editorHeight:!0}),this.viewCell.isInputCollapsed?this._collapseInput():this._showInput(),this.viewCell.isOutputCollapsed?this._collapseOutput():this._showOutput(!1),this.relayoutCell(),this._renderedOutputCollapseState=this.viewCell.isOutputCollapsed,this._renderedInputCollapseState=this.viewCell.isInputCollapsed,!0)}_collapseInput(){xo(this.templateData.editorPart),this.templateData.container.classList.toggle("input-collapsed",!0),this._removeInputCollapsePreview(),this._collapsedExecutionIcon.setVisibility(!0);let e=this.templateData.editor.hasModel()?this._getRichTextFromLineTokens(this.templateData.editor.getModel()):this._getRichText(this.viewCell.textBuffer,this.viewCell.language),t=_("div.cell-collapse-preview");t.innerHTML=vZe?.createHTML(e)??e,this._inputCollapseElement=t,this.templateData.cellInputCollapsedContainer.appendChild(t),this._attachInputExpandButton(t),bn(this.templateData.cellInputCollapsedContainer)}_attachInputExpandButton(e){let t=_("span.expandInputIcon"),o=this.keybindingService.lookupKeybinding(Kxe);o&&(e.title=d(12111,null,o.getLabel()),t.title=d(12110,null,o.getLabel())),t.classList.add(...q.asClassNameArray(M.more)),e.appendChild(t)}_showInput(){this._collapsedExecutionIcon.setVisibility(!1),bn(this.templateData.editorPart),xo(this.templateData.cellInputCollapsedContainer)}_getRichText(e,t){return kbt(this.languageService,e.getLineContent(1),t)}_getRichTextFromLineTokens(e){let t='<div class="monaco-tokenized-source">',n=e.tokenization.getLineTokens(1).inflate(),r=e.getLineContent(1),s=0;for(let l=0,c=n.getCount();l<c;l++){let u=n.getClassName(l),p=n.getEndOffset(l);t+=`<span class="${u}">${ur(r.substring(s,p))}</span>`,s=p}return t+="</div>",t}_removeInputCollapsePreview(){let e=this.templateData.cellInputCollapsedContainer.children,t=[];for(let o=0;o<e.length;o++)e[o].classList.contains("cell-collapse-preview")&&t.push(e[o]);t.forEach(o=>{o.remove()})}_updateOutputInnerContainer(e){let t=this.templateData.outputContainer.domNode.children;for(let o=0;o<t.length;o++)t[o].classList.contains("output-inner-container")&&mm(!e,t[o])}_collapseOutput(){this.templateData.container.classList.toggle("output-collapsed",!0),bn(this.templateData.cellOutputCollapsedContainer),this._updateOutputInnerContainer(!0),this._outputContainerRenderer.viewUpdateHideOuputs()}_showOutput(e){this.templateData.container.classList.toggle("output-collapsed",!1),xo(this.templateData.cellOutputCollapsedContainer),this._updateOutputInnerContainer(!1),this._outputContainerRenderer.viewUpdateShowOutputs(e)}initialViewUpdateExpanded(){this.templateData.container.classList.toggle("input-collapsed",!1),bn(this.templateData.editorPart),xo(this.templateData.cellInputCollapsedContainer),this.templateData.container.classList.toggle("output-collapsed",!1),this._showOutput(!0)}layoutEditor(e){if(this._useNewApproachForEditorLayout)return;let t=this.notebookEditor.getLayoutInfo(),o=Math.min(t.height-t.stickyHeight-26,e.height);this._debug(`Layout Editor: Width = ${e.width}, Height = ${o} (Requested: ${e.height}, Editor Layout Height: ${t.height}, Sticky: ${t.stickyHeight})`),this.templateData.editor.layout({width:e.width,height:o},!0)}onCellWidthChange(e){this._debug(`Cell Editor Width Change, ${e}, Content Height = ${this.templateData.editor.getContentHeight()}`);let t=this.templateData.editor.getContentHeight();this.templateData.editor.hasModel()?(this._debug(`**** Updating Cell Editor Height (1), ContentHeight: ${t}, CodeCellLayoutInfo.EditorWidth ${this.viewCell.layoutInfo.editorWidth}, EditorLayoutInfo ${this.templateData.editor.getLayoutInfo().height} ****`),this.viewCell.editorHeight=t,this.relayoutCell(),this.layoutEditor({width:this.viewCell.layoutInfo.editorWidth,height:t})):this._debug(`Cell Editor Width Change without model, return (1), ContentHeight: ${t}, CodeCellLayoutInfo.EditorWidth ${this.viewCell.layoutInfo.editorWidth}, EditorLayoutInfo ${this.templateData.editor.getLayoutInfo().height}`),this._cellLayout.layoutEditor(e)}onCellEditorHeightChange(e){let t=this.templateData.editor.getContentHeight();this.templateData.editor.hasModel()||this._debug(`Cell Editor Height Change without model, return (2), ContentHeight: ${t}, CodeCellLayoutInfo.EditorWidth ${this.viewCell.layoutInfo.editorWidth}, EditorLayoutInfo ${this.templateData.editor.getLayoutInfo()}`),this._debug(`Cell Editor Height Change (${e}): ${t}`),this._debug(`**** Updating Cell Editor Height (2), ContentHeight: ${t}, CodeCellLayoutInfo.EditorWidth ${this.viewCell.layoutInfo.editorWidth}, EditorLayoutInfo ${this.templateData.editor.getLayoutInfo().height} ****`);let o=this.templateData.editor.getLayoutInfo();this.viewCell.editorHeight=t,this.relayoutCell(),this.layoutEditor({width:o.width,height:t}),this._cellLayout.layoutEditor(e)}relayoutCell(){this.notebookEditor.layoutNotebookCell(this.viewCell,this.viewCell.layoutInfo.totalHeight)}dispose(){this._isDisposed=!0,this.shouldPreserveEditor()&&this.editorPool.preserveFocusedEditor(this.viewCell),this.viewCell.detachTextEditor(),this._removeInputCollapsePreview(),this._outputContainerRenderer.dispose(),this._pendingLayout?.dispose(),super.dispose()}};_Re=I([m(4,F),m(5,_e),m(6,kt),m(7,B),m(8,rs),m(9,_v)],_Re);var swi=class{constructor(i,e,t,o,n,r){this._enabled=i;this.notebookEditor=e;this.viewCell=t;this.templateData=o;this._logService=n;this._initialEditorDimension=r;this._initialized=!1;this._pointerDown=!1}get editorVisibility(){return this._editorVisibility}get isUpdatingLayout(){return this._isUpdatingLayout}setPointerDown(i){this._pointerDown=i}layoutEditor(i){if(!this._enabled)return;let e=this.templateData.editorPart;if(this.viewCell.isInputCollapsed){e.style.top="";return}let t=this.notebookEditor.getLayoutInfo().fontInfo.lineHeight,o=this.viewCell.layoutInfo.topMargin,n=this.viewCell.layoutInfo.outlineWidth,r=this.viewCell.layoutInfo.statusBarHeight,s=this.templateData.editor,l=this.templateData.editor.getLayoutInfo(),c=this._initialized&&(i==="nbLayoutChange"||i==="viewCellLayoutChange")?this.viewCell.layoutInfo.editorWidth:l.width,u=this.viewCell.layoutInfo.editorHeight,p=this.notebookEditor.scrollTop,h=this.notebookEditor.getAbsoluteTopOfElement(this.viewCell),g=this.notebookEditor.getAbsoluteBottomOfElement(this.viewCell),f=this.notebookEditor.getHeightOfElement(this.viewCell),v;if(!this._initialized&&i==="init")v=this._initialEditorDimension.height,this._establishedContentHeight=v;else{let G=s.getContentHeight(),$=G===-1?Math.max(s.getLayoutInfo().height,this._initialEditorDimension.height):G;!this._initialized||i==="onDidContentSizeChange"||i==="viewCellLayoutChange"||i==="nbLayoutChange"?(v=$,this._establishedContentHeight=v):v=this._establishedContentHeight??$}let S=h+this.viewCell.layoutInfo.outputContainerOffset,y=this.notebookEditor.scrollBottom,w=y-p===0?this.notebookEditor.getLayoutInfo().height:y-p,k=this.viewCell.layoutInfo.outputContainerOffset,T=typeof this._previousScrollBottom=="number"&&y<this._previousScrollBottom?"up":"down";this._previousScrollBottom=y;let N=Math.max(0,p-h-o-n),O=u-N;O<t&&(N=N-(t-O)-n);let V=v,U=0;if(p<=h+o){let G=t+this.notebookEditor.notebookOptions.getLayoutConfiguration().editorTopPadding;y>=S?(V=Kn(v,G,v),this._editorVisibility="Full"):(V=Kn(y-(h+o)-r,G,v)+2*n,this._editorVisibility="Bottom Clipped",U=0)}else if(w<=v&&y<=S){let G=t+this.notebookEditor.notebookOptions.getLayoutConfiguration().editorTopPadding;V=Kn(w-r,G,v-r)+2*n,this._editorVisibility="Full (Small Viewport)",U=N}else{let G=t;V=Kn(v-(p-(h+o)),G,v),p>S?this._editorVisibility="Invisible":this._editorVisibility="Top Clipped",U=v-V}this._logService.debug(`${i} (${this._editorVisibility}, ${this._initialized})`),this._logService.debug(`=> Editor Top = ${N}px (editHeight = ${u}, editContentHeight: ${v})`),this._logService.debug(`=> eleTop = ${h}, eleBottom = ${g}, eleHeight = ${f}`),this._logService.debug(`=> scrollTop = ${p}, top = ${N}`),this._logService.debug(`=> cellTopMargin = ${o}, cellBottomMargin = ${this.viewCell.layoutInfo.topMargin}, cellOutline = ${n}`),this._logService.debug(`=> scrollBottom: ${y}, editBottom: ${S}, viewport: ${w}, scroll: ${T}, contOffset: ${k})`),this._logService.debug(`=> Editor Height = ${V}px, Width: ${c}px, Initial Width: ${this._initialEditorDimension.width}, EditorScrollTop = ${U}px, StatusbarHeight = ${r}, lineHeight = ${this.notebookEditor.getLayoutInfo().fontInfo.lineHeight}`);try{this._isUpdatingLayout=!0,e.style.top=`${N}px`,s.layout({width:this._initialized?c:this._initialEditorDimension.width,height:V},!0),!this._pointerDown&&U>=0&&(this._lastChangedEditorScrolltop=U,s.setScrollTop(U))}finally{this._initialized=!0,this._isUpdatingLayout=!1,this._logService.debug("Updated Editor Layout")}}};var dI=class extends oc{constructor(e,t,o,n,r,s,l,c,u,p,h){super(null,e,{hoverDelegate:r?.hoverDelegate});this._options=r;this._contextMenuProvider=s;this._container=null;this._dropdownContainer=null;this._primaryAction=new ml(e,{hoverDelegate:r?.hoverDelegate},l,c,u,p,s,h),r?.actionRunner&&(this._primaryAction.actionRunner=r.actionRunner),this._dropdown=new wp(t,o,this._contextMenuProvider,{menuAsChild:r?.menuAsChild??!0,classNames:n?["codicon","codicon-chevron-down",n]:["codicon","codicon-chevron-down"],actionRunner:this._options?.actionRunner,keybindingProvider:this._options?.getKeyBinding??(g=>l.lookupKeybinding(g.id)),hoverDelegate:r?.hoverDelegate,skipTelemetry:r?.skipTelemetry})}get onDidChangeDropdownVisibility(){return this._dropdown.onDidChangeVisibility}set actionRunner(e){super.actionRunner=e,this._primaryAction.actionRunner=e,this._dropdown.actionRunner=e}get actionRunner(){return super.actionRunner}setActionContext(e){super.setActionContext(e),this._primaryAction.setActionContext(e),this._dropdown.setActionContext(e)}render(e){this._container=e,super.render(this._container),this._container.classList.add("monaco-dropdown-with-primary");let t=_(".action-container");t.role="button",t.ariaDisabled=String(!this.action.enabled),this._primaryAction.render(R(this._container,t)),this._dropdownContainer=_(".dropdown-action-container"),this._dropdown.render(R(this._container,this._dropdownContainer)),this._register(j(t,re.KEY_DOWN,o=>{if(!this.action.enabled)return;let n=new Ii(o);n.equals(17)&&(this._primaryAction.element.tabIndex=-1,this._dropdown.focus(),n.stopPropagation())})),this._register(j(this._dropdownContainer,re.KEY_DOWN,o=>{if(!this.action.enabled)return;let n=new Ii(o);n.equals(15)&&(this._primaryAction.element.tabIndex=0,this._dropdown.setFocusable(!1),this._primaryAction.element?.focus(),n.stopPropagation())})),this.updateEnabled()}focus(e){e?this._dropdown.focus():(this._primaryAction.element.tabIndex=0,this._primaryAction.element.focus())}blur(){this._primaryAction.element.tabIndex=-1,this._dropdown.blur(),this._container.blur()}setFocusable(e){e?this._primaryAction.element.tabIndex=0:(this._primaryAction.element.tabIndex=-1,this._dropdown.setFocusable(!1))}updateEnabled(){let e=!this.action.enabled;this.element?.classList.toggle("disabled",e)}update(e,t,o){this._dropdown.dispose(),this._dropdown=new wp(e,t,this._contextMenuProvider,{menuAsChild:this._options?.menuAsChild??!0,classNames:["codicon",o||"codicon-chevron-down"],actionRunner:this._options?.actionRunner,hoverDelegate:this._options?.hoverDelegate,keybindingProvider:this._options?.getKeyBinding}),this._dropdownContainer&&this._dropdown.render(this._dropdownContainer)}showDropdown(){this._dropdown.show()}dispose(){this._primaryAction.dispose(),this._dropdown.dispose(),super.dispose()}};dI=I([m(5,ze),m(6,_e),m(7,Ne),m(8,X),m(9,De),m(10,Bi)],dI);var DRe=class extends dp{constructor(e,t,o,n,r,s,l,c,u,p){super();this.notebookEditor=e;this.contextKeyService=t;this.cellContainer=o;this.runButtonContainer=n;this.keybindingService=c;this.contextMenuService=u;this.instantiationService=p;this.primaryMenu=this._register(l.createMenu(r,t)),this.secondaryMenu=this._register(l.createMenu(s,t)),this.createRunCellToolbar(n,o,t);let h=()=>{let f=this.getCellToolbarActions(this.primaryMenu).primary[0];this.toolbar.setActions(f?[f]:[])};h(),this._register(this.primaryMenu.onDidChange(h)),this._register(this.secondaryMenu.onDidChange(h)),this._register(this.notebookEditor.notebookOptions.onDidChangeOptions(h))}didRenderCell(e){if(this.cellDisposables.add(aVt(this.notebookEditor,e,this.runButtonContainer)),this.notebookEditor.hasModel()){let t={ui:!0,cell:e,notebookEditor:this.notebookEditor,$mid:13};this.toolbar.context=t}}getCellToolbarActions(e){return hl(e.getActions({shouldForwardArgs:!0}),t=>/^inline/.test(t))}createRunCellToolbar(e,t,o){let n=this._register(new P),r=this._register(new st("notebook.moreRunActions",d(12116,null),"codicon-chevron-down",!0)),s=c=>this.keybindingService.lookupKeybinding(c.id,l),l=this._register(_8o(o));this.toolbar=this._register(new Ju(e,this.contextMenuService,{getKeyBinding:s,actionViewItemProvider:(c,u)=>{n.clear();let p=this.getCellToolbarActions(this.primaryMenu).primary[0];if(!(p instanceof Eo))return;let h=this.getCellToolbarActions(this.secondaryMenu).secondary;if(!h.length)return;let g=this.instantiationService.createInstance(dI,p,r,h,"notebook-cell-run-toolbar",{...u,getKeyBinding:s});return n.add(g.onDidChangeDropdownVisibility(f=>{t.classList.toggle("cell-run-toolbar-dropdown-active",f)})),g},renderDropdownAsChildElement:!0}))}};DRe=I([m(6,qt),m(7,_e),m(8,ze),m(9,F)],DRe);function _8o(a){let i=a.createScoped(document.createElement("div"));return $h.bindTo(i).set(!0),ue.editorTextFocus.bindTo(i).set(!0),ue.focus.bindTo(i).set(!0),ue.textInputFocus.bindTo(i).set(!0),xpe.bindTo(i).set("idle"),$u.bindTo(i).set(!0),rr.bindTo(i).set(!0),hS.bindTo(i).set("code"),i}var SZe=class extends dp{constructor(e,t){super();this.notebookEditor=e;this._register(j(t,re.DBLCLICK,o=>{!this.currentCell||!this.notebookEditor.hasModel()||(this.currentCell.isInputCollapsed?this.currentCell.isInputCollapsed=!1:this.currentCell.isOutputCollapsed=!1)})),this._register(j(t,re.CLICK,o=>{if(!this.currentCell||!this.notebookEditor.hasModel())return;let n=o.target;n&&n.classList&&n.classList.contains("expandInputIcon")&&(this.currentCell.isInputCollapsed=!1)}))}};var cco=_,LRe=class extends dp{constructor(e,t,o){super();this.notebookEditor=e;let n=R(t,cco("span.expandOutputPlaceholder"));n.textContent=d(12119,null);let r=R(t,cco("span.expandOutputIcon"));r.classList.add(...q.asClassNameArray(M.more));let s=o.lookupKeybinding(NEt);s&&(n.title=d(12118,null,s.getLabel()),t.title=d(12117,null,s.getLabel())),xo(t),this._register(j(r,re.CLICK,()=>this.expand())),this._register(j(t,re.DBLCLICK,()=>this.expand()))}expand(){!this.currentCell||!this.currentCell||this.notebookEditor.textModel.cells.indexOf(this.currentCell.model)<0||(this.currentCell.isOutputCollapsed=!this.currentCell.isOutputCollapsed)}};LRe=I([m(2,_e)],LRe);var D8o={limit:5e3,update:()=>{}},dVt=class{constructor(){this._viewModel=null;this._viewModelStore=new P;this._onDidFoldingRegionChanges=new E;this.onDidFoldingRegionChanged=this._onDidFoldingRegionChanges.event;this._foldingRangeDecorationIds=[];this._regions=new jI(new Uint32Array(0),new Uint32Array(0))}get regions(){return this._regions}dispose(){this._onDidFoldingRegionChanges.dispose(),this._viewModelStore.dispose()}detachViewModel(){this._viewModelStore.clear(),this._viewModel=null}attachViewModel(i){this._viewModel=i,this._viewModelStore.add(this._viewModel.onDidChangeViewCells(()=>{this.recompute()})),this._viewModelStore.add(this._viewModel.onDidChangeSelection(()=>{if(!this._viewModel)return;let e=Lf(this._viewModel.getSelections()),t=!1;e.forEach(o=>{let n=this.regions.findRange(o+1);for(;n!==-1;)this._regions.isCollapsed(n)&&o>this._regions.getStartLineNumber(n)-1&&(this._regions.setCollapsed(n,!1),t=!0),n=this._regions.getParentIndex(n)}),t&&this._onDidFoldingRegionChanges.fire()})),this.recompute()}getRegionAtLine(i){if(this._regions){let e=this._regions.findRange(i);if(e>=0)return this._regions.toRegion(e)}return null}getRegionsInside(i,e){let t=[],o=i?i.regionIndex+1:0,n=i?i.endLineNumber:Number.MAX_VALUE;if(e&&e.length===2){let r=[];for(let s=o,l=this._regions.length;s<l;s++){let c=this._regions.toRegion(s);if(this._regions.getStartLineNumber(s)<n){for(;r.length>0&&!c.containedBy(r[r.length-1]);)r.pop();r.push(c),e(c,r.length)&&t.push(c)}else break}}else for(let r=o,s=this._regions.length;r<s;r++){let l=this._regions.toRegion(r);if(this._regions.getStartLineNumber(r)<n)(!e||e(l))&&t.push(l);else break}return t}getAllRegionsAtLine(i,e){let t=[];if(this._regions){let o=this._regions.findRange(i),n=1;for(;o>=0;){let r=this._regions.toRegion(o);(!e||e(r,n))&&t.push(r),n++,o=r.parentIndex}}return t}setCollapsed(i,e){this._regions.setCollapsed(i,e)}recompute(){if(!this._viewModel)return;let i=this._viewModel,e=i.viewCells,t=[];for(let p=0;p<e.length;p++){let h=e[p];if(h.cellKind!==1||h.language!=="markdown")continue;let g=Math.min(7,...Array.from(awi(h.getText()),f=>f.depth));g<7&&t.push({index:p,level:g,endIndex:0})}let o=t.map((p,h)=>{let g;for(let v=h+1;v<t.length;++v)if(t[v].level<=p.level){g=t[v].index-1;break}let f=g!==void 0?g:e.length-1;return{start:p.index+1,end:f+1,rank:1}}).filter(p=>p.start!==p.end),n=yri(o,D8o),r=0,s=()=>{for(;r<this._regions.length;){let p=this._regions.isCollapsed(r);if(r++,p)return r-1}return-1},l=0,c=s();for(;c!==-1&&l<n.length;){let p=i.getTrackedRange(this._foldingRangeDecorationIds[c]);if(p){let h=p.start;for(;l<n.length;){let g=n.getStartLineNumber(l)-1;if(h>=g)n.setCollapsed(l,h===g),l++;else break}}c=s()}for(;l<n.length;)n.setCollapsed(l,!1),l++;let u=[];for(let p=0;p<n.length;p++){let h=n.toRegion(p);u.push({start:h.startLineNumber-1,end:h.endLineNumber-1})}this._foldingRangeDecorationIds.forEach(p=>i.setTrackedRange(p,null,3)),this._foldingRangeDecorationIds=u.map(p=>i.setTrackedRange(null,p,3)).filter(p=>p!==null),this._regions=n,this._onDidFoldingRegionChanges.fire()}getMemento(){let i=[],e=0;for(;e<this._regions.length;){if(this._regions.isCollapsed(e)){let o=this._regions.toRegion(e);i.push({start:o.startLineNumber-1,end:o.endLineNumber-1})}e++}return i}applyMemento(i){if(!this._viewModel)return!1;let e=0,t=0;for(;t<i.length&&e<this._regions.length;){if(this._viewModel.getTrackedRange(this._foldingRangeDecorationIds[e])){let n=i[t].start;for(;e<this._regions.length;){let r=this._regions.getStartLineNumber(e)-1;if(n>=r)this._regions.setCollapsed(e,n===r),e++;else break}}t++}for(;e<this._regions.length;)this._regions.setCollapsed(e,!1),e++;return!0}};function*awi(a){for(let i of Yc.lexer(a,{gfm:!0}))i.type==="heading"&&(yield{depth:i.depth,text:qa({value:i.raw}).trim()})}var BR=class extends C{constructor(e){super();this._notebookEditor=e;this._foldingModel=null;this._localStore=this._register(new P);this._register(this._notebookEditor.onMouseUp(t=>{this.onMouseUp(t)})),this._register(this._notebookEditor.onDidChangeModel(()=>{this._localStore.clear(),this._notebookEditor.hasModel()&&(this._localStore.add(this._notebookEditor.onDidChangeCellState(t=>{t.source.editStateChanged&&t.cell.cellKind===1&&this._foldingModel?.recompute()})),this._foldingModel=new dVt,this._localStore.add(this._foldingModel),this._foldingModel.attachViewModel(this._notebookEditor.getViewModel()),this._localStore.add(this._foldingModel.onDidFoldingRegionChanged(()=>{this._updateEditorFoldingRanges()})))}))}static{this.id="workbench.notebook.foldingController"}saveViewState(){return this._foldingModel?.getMemento()||[]}restoreViewState(e){this._foldingModel?.applyMemento(e||[]),this._updateEditorFoldingRanges()}setFoldingStateDown(e,t,o){let n=t===2,r=this._foldingModel.getRegionAtLine(e+1),s=[];if(r&&(r.isCollapsed!==n&&s.push(r),o>1)){let l=this._foldingModel.getRegionsInside(r,(c,u)=>c.isCollapsed!==n&&u<o);s.push(...l)}s.forEach(l=>this._foldingModel.setCollapsed(l.regionIndex,t===2)),this._updateEditorFoldingRanges()}setFoldingStateUp(e,t,o){if(!this._foldingModel)return;this._foldingModel.getAllRegionsAtLine(e+1,(r,s)=>r.isCollapsed!==(t===2)&&s<=o).forEach(r=>this._foldingModel.setCollapsed(r.regionIndex,t===2)),this._updateEditorFoldingRanges()}_updateEditorFoldingRanges(){if(!this._foldingModel||!this._notebookEditor.hasModel())return;let e=this._notebookEditor.getViewModel();e.updateFoldingRanges(this._foldingModel.regions);let t=e.getHiddenRanges();this._notebookEditor.setHiddenAreas(t)}onMouseUp(e){if(!e.event.target||!this._notebookEditor.hasModel())return;let t=this._notebookEditor.getViewModel(),o=e.event.target;if(o.classList.contains("codicon-notebook-collapsed")||o.classList.contains("codicon-notebook-expanded")){if(!o.parentElement.classList.contains("notebook-folding-indicator"))return;let r=e.target,s=t.getCellIndex(r),l=t.getFoldingState(s);if(l===0)return;this.setFoldingStateUp(s,l===2?1:2,1),this._notebookEditor.focusElement(r)}}recompute(){this._foldingModel?.recompute()}};tm(BR.id,BR);var L8o=d(11813,null),dco=L(11815,"Unfold Cell"),uco={args:[{isOptional:!0,name:"index",description:"The cell index",schema:{type:"object",required:["index","direction"],properties:{index:{type:"number"},direction:{type:"string",enum:["up","down"],default:"down"},levels:{type:"number",default:1}}}}]};W(class extends K{constructor(){super({id:"notebook.fold",title:L(11814,"Fold Cell"),category:jm,keybinding:{when:x.and(rr,x.not(Uu)),primary:3164,mac:{primary:2652,secondary:[15]},secondary:[15],weight:200},metadata:{description:L8o,args:uco.args},precondition:Ua,f1:!0})}async run(a,i){let e=a.get(ee),t=qn(e.activeEditorPane);if(!t||!t.hasModel())return;let o=i&&i.levels||1,n=i&&i.direction==="up"?"up":"down",r;if(i)r=i.index;else{let l=t.getActiveCell();if(!l)return;r=t.getCellIndex(l)}let s=t.getContribution(BR.id);if(r!==void 0){if((r<0||r>=t.getLength()?void 0:t.cellAt(r))?.cellKind===2&&n==="down")return;n==="up"?s.setFoldingStateUp(r,2,o):s.setFoldingStateDown(r,2,o);let c=t.getViewModel().getNearestVisibleCellIndexUpwards(r);t.focusElement(t.cellAt(c))}}});W(class extends K{constructor(){super({id:"notebook.unfold",title:dco,category:jm,keybinding:{when:x.and(rr,x.not(Uu)),primary:3166,mac:{primary:2654,secondary:[17]},secondary:[17],weight:200},metadata:{description:dco,args:uco.args},precondition:Ua,f1:!0})}async run(a,i){let e=a.get(ee),t=qn(e.activeEditorPane);if(!t)return;let o=i&&i.levels||1,n=i&&i.direction==="up"?"up":"down",r;if(i)r=i.index;else{let l=t.getActiveCell();if(!l)return;r=t.getCellIndex(l)}let s=t.getContribution(BR.id);r!==void 0&&(n==="up"?s.setFoldingStateUp(r,1,o):s.setFoldingStateDown(r,1,o))}});var RRe=class extends dp{constructor(e,t,o){super();this._notebookEditor=e;this._container=t;this._notebookExecutionStateService=o;this._runButtonListener=this._register(new me);this._cellExecutionListener=this._register(new me)}didRenderCell(e){this.update(e)}update(e){if(!this._notebookEditor.hasModel()){this._cellExecutionListener.clear(),this._runButtonListener.clear();return}if(e.isInputCollapsed||e.getEditState()===1)this._cellExecutionListener.clear(),this._runButtonListener.clear(),xo(this._container);else if(e.foldingState===2){let t=this._notebookEditor.getViewModel().getCellIndex(e),o=this._notebookEditor.getViewModel().getFoldedLength(t),n=this.getRunFoldedSectionButton({start:t,end:t+o+1});n?Fi(this._container,n,this.getHiddenCellsLabel(o),this.getHiddenCellHintButton(e)):Fi(this._container,this.getHiddenCellsLabel(o),this.getHiddenCellHintButton(e)),bn(this._container);let r=e.layoutInfo.previewHeight;this._container.style.top=`${r}px`}else this._cellExecutionListener.clear(),this._runButtonListener.clear(),xo(this._container)}getHiddenCellsLabel(e){let t=e===1?d(12120,null):d(12121,null,e);return _("span.notebook-folded-hint-label",void 0,t)}getHiddenCellHintButton(e){let t=_("span.cell-expand-part-button");return t.classList.add(...q.asClassNameArray(M.more)),this._register(j(t,re.CLICK,()=>{let o=this._notebookEditor.getContribution(BR.id),n=this._notebookEditor.getCellIndex(e);typeof n=="number"&&o.setFoldingStateDown(n,1,1)})),t}getRunFoldedSectionButton(e){let t=_("span.folded-cell-run-section-button"),o=this._notebookEditor.getCellsInRange(e);if(!o.some(l=>l.cellKind===2))return;let s=o.some(l=>{let c=this._notebookExecutionStateService.getCellExecution(l.uri);return c&&c.state===3})?q.modify(Sw,"spin"):M.play;return t.classList.add(...q.asClassNameArray(s)),this._runButtonListener.value=j(t,re.CLICK,()=>{this._notebookEditor.executeNotebookCells(o)}),this._cellExecutionListener.value=this._notebookExecutionStateService.onDidChangeExecution(()=>{let c=o.some(u=>{let p=this._notebookExecutionStateService.getCellExecution(u.uri);return p&&p.state===3})?q.modify(Sw,"spin"):M.play;t.className="",t.classList.add("folded-cell-run-section-button",...q.asClassNameArray(c))}),t}updateInternalLayoutNow(e){this.update(e)}};RRe=I([m(2,rs)],RRe);var MRe=class extends C{constructor(e,t,o,n,r,s,l,c,u,p){super();this.notebookEditor=e;this.viewCell=t;this.templateData=o;this.renderedEditors=n;this.accessibilityService=r;this.contextKeyService=s;this.instantiationService=l;this.languageService=c;this.configurationService=u;this.keybindingService=p;this.editor=null;this.localDisposables=this._register(new P);this.focusSwitchDisposable=this._register(new me);this.editorDisposables=this._register(new P);this._isDisposed=!1;this.constructDOM(),this.editorPart=o.editorPart,this.cellEditorOptions=this._register(new $F(this.notebookEditor.getBaseCellEditorOptions(t.language),this.notebookEditor.notebookOptions,this.configurationService)),this.cellEditorOptions.setLineNumbers(this.viewCell.lineNumbers),this.editorOptions=this.cellEditorOptions.getValue(this.viewCell.internalMetadata,this.viewCell.uri),this._register(Z(()=>n.delete(this.viewCell))),this.registerListeners(),this.templateData.cellParts.scheduleRenderCell(this.viewCell),this._register(Z(()=>{this.templateData.cellParts.unrenderCell(this.viewCell)})),this._register(this.accessibilityService.onDidChangeScreenReaderOptimized(()=>{this.viewUpdate()})),this.updateForHover(),this.updateForFocusModeChange(),this.foldingState=t.foldingState,this.layoutFoldingIndicator(),this.updateFoldingIconShowClass(),this.viewCell.layoutInfo.totalHeight>0&&this.relayoutCell(),this.viewUpdate(),this.layoutCellParts(),this._register(this.viewCell.onDidChangeLayout(()=>{this.layoutCellParts()}))}layoutCellParts(){this.templateData.cellParts.updateInternalLayoutNow(this.viewCell)}constructDOM(){let e=`aria-markup-cell-${this.viewCell.id}`;this.markdownAccessibilityContainer=this.templateData.cellContainer,this.markdownAccessibilityContainer.id=e,this.markdownAccessibilityContainer.style.height="1px",this.markdownAccessibilityContainer.style.overflow="hidden",this.markdownAccessibilityContainer.style.position="absolute",this.markdownAccessibilityContainer.style.top="100000px",this.markdownAccessibilityContainer.style.left="10000px",this.markdownAccessibilityContainer.ariaHidden="false",this.templateData.rootContainer.setAttribute("aria-describedby",e),this.templateData.container.classList.toggle("webview-backed-markdown-cell",!0)}registerListeners(){this._register(this.viewCell.onDidChangeState(e=>{this.templateData.cellParts.updateState(this.viewCell,e)})),this._register(this.viewCell.model.onDidChangeMetadata(()=>{this.viewUpdate()})),this._register(this.viewCell.onDidChangeState(e=>{if((e.editStateChanged||e.contentChanged)&&this.viewUpdate(),e.focusModeChanged&&this.updateForFocusModeChange(),e.foldingStateChanged){let t=this.viewCell.foldingState;t!==this.foldingState&&(this.foldingState=t,this.layoutFoldingIndicator())}e.cellIsHoveredChanged&&this.updateForHover(),e.inputCollapsedChanged&&(this.updateCollapsedState(),this.viewUpdate()),e.cellLineNumberChanged&&this.cellEditorOptions.setLineNumbers(this.viewCell.lineNumbers)})),this._register(this.notebookEditor.notebookOptions.onDidChangeOptions(e=>{e.showFoldingControls&&this.updateFoldingIconShowClass()})),this._register(this.viewCell.onDidChangeLayout(e=>{let t=this.editor?.getLayoutInfo();e.outerWidth&&this.viewCell.getEditState()===1&&t&&t.width!==this.viewCell.layoutInfo.editorWidth&&this.onCellEditorWidthChange()})),this._register(this.cellEditorOptions.onDidChange(()=>this.updateMarkupCellOptions()))}updateMarkupCellOptions(){if(this.updateEditorOptions(this.cellEditorOptions.getUpdatedValue(this.viewCell.internalMetadata,this.viewCell.uri)),this.editor){this.editor.updateOptions(this.cellEditorOptions.getUpdatedValue(this.viewCell.internalMetadata,this.viewCell.uri));let e=new $e;this._register({dispose(){e.dispose(!0)}}),wa(this.viewCell.resolveTextModel(),e.token).then(t=>{this._isDisposed||t&&t.updateOptions({indentSize:this.cellEditorOptions.indentSize,tabSize:this.cellEditorOptions.tabSize,insertSpaces:this.cellEditorOptions.insertSpaces})})}}updateCollapsedState(){this.viewCell.isInputCollapsed?this.notebookEditor.hideMarkupPreviews([this.viewCell]):this.notebookEditor.unhideMarkupPreviews([this.viewCell])}updateForHover(){this.templateData.container.classList.toggle("markdown-cell-hover",this.viewCell.cellIsHovered)}updateForFocusModeChange(){this.viewCell.focusMode===1&&this.focusEditorIfNeeded(),this.templateData.container.classList.toggle("cell-editor-focus",this.viewCell.focusMode===1)}dispose(){this._isDisposed=!0,this.notebookEditor.getActiveCell()===this.viewCell&&this.viewCell.focusMode===1&&(this.notebookEditor.hasEditorFocus()||this.notebookEditor.getDomNode().ownerDocument.activeElement===this.notebookEditor.getDomNode().ownerDocument.body)&&this.notebookEditor.focusContainer(),this.viewCell.detachTextEditor(),super.dispose()}updateFoldingIconShowClass(){let e=this.notebookEditor.notebookOptions.getDisplayOptions().showFoldingControls;this.templateData.foldingIndicator.classList.remove("mouseover","always"),this.templateData.foldingIndicator.classList.add(e)}viewUpdate(){this.viewCell.isInputCollapsed?this.viewUpdateCollapsed():this.viewCell.getEditState()===1?this.viewUpdateEditing():this.viewUpdatePreview()}viewUpdateCollapsed(){bn(this.templateData.cellInputCollapsedContainer),xo(this.editorPart),this.templateData.cellInputCollapsedContainer.innerText="",R(this.templateData.cellInputCollapsedContainer,_("span")).classList.add(...q.asClassNameArray(M.markdown));let t=_("div");t.classList.add("cell-collapse-preview");let o=this.getRichText(this.viewCell.textBuffer,this.viewCell.language);t.innerText=o,t.innerHTML=vZe?.createHTML(o)??o,this.templateData.cellInputCollapsedContainer.appendChild(t);let n=R(t,_("span.expandInputIcon"));n.classList.add(...q.asClassNameArray(M.more));let r=this.keybindingService.lookupKeybinding(Kxe);r&&(t.title=d(12123,null,r.getLabel()),n.title=d(12122,null,r.getLabel())),this.markdownAccessibilityContainer.ariaHidden="true",this.templateData.container.classList.toggle("input-collapsed",!0),this.viewCell.renderedMarkdownHeight=0,this.viewCell.layoutChange({})}getRichText(e,t){return kbt(this.languageService,e.getLineContent(1),t)}viewUpdateEditing(){let e;if(bn(this.editorPart),this.markdownAccessibilityContainer.ariaHidden="true",xo(this.templateData.cellInputCollapsedContainer),this.notebookEditor.hideMarkupPreviews([this.viewCell]),this.templateData.container.classList.toggle("input-collapsed",!1),this.templateData.container.classList.toggle("markdown-cell-edit-mode",!0),this.editor&&this.editor.hasModel())e=this.editor.getContentHeight(),this.viewCell.attachTextEditor(this.editor),this.focusEditorIfNeeded(),this.bindEditorListeners(this.editor),this.editor.layout({width:this.viewCell.layoutInfo.editorWidth,height:e});else{this.editorDisposables.clear();let t=this.notebookEditor.notebookOptions.computeMarkdownCellEditorWidth(this.notebookEditor.getLayoutInfo().width),o=this.viewCell.lineCount,n=this.viewCell.layoutInfo.fontInfo?.lineHeight||17,r=this.notebookEditor.notebookOptions.computeEditorPadding(this.viewCell.internalMetadata,this.viewCell.uri);e=Math.max(o,1)*n+r.top+r.bottom,this.templateData.editorContainer.innerText="";let s=this.contextKeyService.createScoped(this.templateData.editorPart);ue.inCompositeEditor.bindTo(s).set(!0);let l=this.editorDisposables.add(this.instantiationService.createChild(new Io([X,s])));this.editorDisposables.add(s),this.editor=this.editorDisposables.add(l.createInstance(jr,this.templateData.editorContainer,{...this.editorOptions,dimension:{width:t,height:e},allowVariableLineHeights:!1},{contributions:this.notebookEditor.creationOptions.cellEditorContributions})),this.templateData.currentEditor=this.editor,this.editorDisposables.add(this.editor.onDidBlurEditorWidget(()=>{this.editor&&Xb.get(this.editor)?.stopHighlighting()})),this.editorDisposables.add(this.editor.onDidFocusEditorWidget(()=>{this.editor&&Xb.get(this.editor)?.restoreViewState(!0)}));let c=new $e;this.editorDisposables.add({dispose(){c.dispose(!0)}}),wa(this.viewCell.resolveTextModel(),c.token).then(u=>{if(!u)return;this.editor.setModel(u),u.updateOptions({indentSize:this.cellEditorOptions.indentSize,tabSize:this.cellEditorOptions.tabSize,insertSpaces:this.cellEditorOptions.insertSpaces});let p=this.editor.getContentHeight();p!==e&&(this.editor.layout({width:t,height:p}),e=p),this.viewCell.attachTextEditor(this.editor),this.viewCell.getEditState()===1&&this.focusEditorIfNeeded(),this.bindEditorListeners(this.editor),this.viewCell.editorHeight=e})}this.viewCell.editorHeight=e,this.focusEditorIfNeeded(),this.renderedEditors.set(this.viewCell,this.editor)}viewUpdatePreview(){this.viewCell.detachTextEditor(),xo(this.editorPart),xo(this.templateData.cellInputCollapsedContainer),this.markdownAccessibilityContainer.ariaHidden="false",this.templateData.container.classList.toggle("input-collapsed",!1),this.templateData.container.classList.toggle("markdown-cell-edit-mode",!1),this.renderedEditors.delete(this.viewCell),this.markdownAccessibilityContainer.innerText="",this.viewCell.renderedHtml&&(this.accessibilityService.isScreenReaderOptimized()?Iq(this.markdownAccessibilityContainer,this.viewCell.renderedHtml):Rt(this.markdownAccessibilityContainer)),this.notebookEditor.createMarkupPreview(this.viewCell)}focusEditorIfNeeded(){if(this.viewCell.focusMode===1&&(this.notebookEditor.hasEditorFocus()||this.notebookEditor.getDomNode().ownerDocument.activeElement===this.notebookEditor.getDomNode().ownerDocument.body)){if(!this.editor)return;this.editor.focus();let e=this.editor.getSelection();if(!e)return;this.notebookEditor.revealRangeInViewAsync(this.viewCell,e)}}layoutEditor(e){this.editor?.layout(e)}onCellEditorWidthChange(){let e=this.editor.getContentHeight();this.layoutEditor({width:this.viewCell.layoutInfo.editorWidth,height:e})}relayoutCell(){this.notebookEditor.layoutNotebookCell(this.viewCell,this.viewCell.layoutInfo.totalHeight),this.layoutFoldingIndicator()}updateEditorOptions(e){this.editorOptions=e,this.editor?.updateOptions(this.editorOptions)}layoutFoldingIndicator(){switch(this.foldingState){case 0:this.templateData.foldingIndicator.style.display="none",this.templateData.foldingIndicator.innerText="";break;case 2:this.templateData.foldingIndicator.style.display="",Fi(this.templateData.foldingIndicator,Qo(EWt));break;case 1:this.templateData.foldingIndicator.style.display="",Fi(this.templateData.foldingIndicator,Qo(TWt));break;default:break}}bindEditorListeners(e){this.localDisposables.clear(),this.focusSwitchDisposable.clear(),this.localDisposables.add(e.onDidContentSizeChange(o=>{o.contentHeightChanged&&this.onCellEditorHeightChange(e,o.contentHeight)})),this.localDisposables.add(e.onDidChangeCursorSelection(o=>{if(o.source==="restoreState")return;let n=e.getSelections();if(n?.length){let r=e.getContentHeight(),s=this.viewCell.layoutInfo.editorHeight;r!==s&&this.onCellEditorHeightChange(e,r);let l=n[n.length-1];this.notebookEditor.revealRangeInViewAsync(this.viewCell,l)}}));let t=()=>this.viewCell.focusMode=e.hasWidgetFocus()?1:0;this.localDisposables.add(e.onDidFocusEditorWidget(()=>{t()})),this.localDisposables.add(e.onDidBlurEditorWidget(()=>{this.templateData.container.ownerDocument.activeElement?.contains(this.templateData.container)?this.focusSwitchDisposable.value=nn(()=>t(),300):t()})),t()}onCellEditorHeightChange(e,t){let o=e.getLayoutInfo();this.viewCell.editorHeight=t,e.layout({width:o.width,height:t})}};MRe=I([m(4,Bi),m(5,X),m(6,F),m(7,kt),m(8,B),m(9,_e)],MRe);var Ym=_,PRe=class extends C{constructor(e,t){super();this.configurationService=t;let o=this.configurationService.getValue("editor");this.lineHeight=LS(o,Xd.getInstance(e).value).lineHeight}getHeight(e){return e.getHeight(this.lineHeight)}getDynamicHeight(e){return e.getDynamicHeight()}getTemplateId(e){return e.cellKind===1?F4.TEMPLATE_ID:W4.TEMPLATE_ID}};PRe=I([m(1,B)],PRe);var uVt=class extends C{constructor(e,t,o,n,r,s,l,c,u,p){super();this.instantiationService=e;this.notebookEditor=t;this.contextMenuService=o;this.menuService=n;this.keybindingService=s;this.notificationService=l;this.contextKeyServiceProvider=c;this.dndController=p;this.editorOptions=this._register(new $F(this.notebookEditor.getBaseCellEditorOptions(u),this.notebookEditor.notebookOptions,r))}dispose(){super.dispose(),this.dndController=void 0}},F4=class extends uVt{constructor(e,t,o,n,r,s,l,c,u,p,h){super(s,e,l,c,r,u,p,n,"markdown",t);this.renderedEditors=o;this._notebookExecutionStateService=h}static{this.TEMPLATE_ID="markdown_cell"}get templateId(){return F4.TEMPLATE_ID}renderTemplate(e){e.classList.add("markdown-cell-row");let t=R(e,_(".cell-inner-container")),o=new P,n=o.add(this.contextKeyServiceProvider(t)),r=R(e,Ym(".cell-decoration")),s=R(t,Ym(".cell-title-toolbar")),l=new Bg(R(t,Ym(".cell-focus-indicator.cell-focus-indicator-top"))),c=new Bg(R(t,_(".cell-focus-indicator.cell-focus-indicator-side.cell-focus-indicator-left"))),u=R(c.domNode,_(".notebook-folding-indicator")),p=new Bg(R(t,_(".cell-focus-indicator.cell-focus-indicator-side.cell-focus-indicator-right"))),h=R(t,Ym(".cell.code")),g=R(h,Ym(".cell-editor-part")),f=R(g,Ym(".cell-chat-part")),v=R(h,Ym(".input-collapse-container"));v.style.display="none";let b=R(g,Ym(".cell-editor-container"));g.style.display="none";let S=R(t,Ym(".cell-comment-container")),y=R(t,Ym(".cell.markdown")),w=R(t,Ym(".cell-bottom-toolbar-container")),k=o.add(this.instantiationService.createChild(new Io([X,n]))),T={toggle:(G,$)=>t.classList.toggle(G,$)},N=o.add(k.createInstance(Qpe,s,T,this.notebookEditor.creationOptions.menuIds.cellTitleToolbar,this.notebookEditor.creationOptions.menuIds.cellDeleteToolbar,this.notebookEditor)),O=new Bg(R(t,Ym(".cell-focus-indicator.cell-focus-indicator-bottom"))),V=new aZe(Me(e),[o.add(k.createInstance(uZe,this.notebookEditor,f)),o.add(k.createInstance(qpe,this.notebookEditor,t,g,void 0)),o.add(new hZe(this.notebookEditor,N,l,c,p,O)),o.add(new RRe(this.notebookEditor,R(t,Ym(".notebook-folded-hint")),this._notebookExecutionStateService)),o.add(new pZe(this.notebookEditor,e,r)),o.add(k.createInstance($pe,this.notebookEditor,S)),o.add(new SZe(this.notebookEditor,v)),o.add(new mZe(t,void 0,this.notebookEditor)),o.add(new lZe(t)),o.add(k.createInstance(Upe,this.notebookEditor))],[N,o.add(k.createInstance(jpe,this.notebookEditor,s,w))]);return o.add(V),{rootContainer:e,cellInputCollapsedContainer:v,instantiationService:k,container:t,cellContainer:y,editorPart:g,editorContainer:b,foldingIndicator:u,templateDisposables:o,elementDisposables:o.add(new P),cellParts:V,toJSON:()=>({})}}renderElement(e,t,o,n){if(!this.notebookEditor.hasModel())throw new Error("The notebook editor is not attached with view model yet.");o.currentRenderedCell=e,o.currentEditor=void 0,o.editorPart.style.display="none",o.cellContainer.innerText="",n?.height!==void 0&&o.elementDisposables.add(o.instantiationService.createInstance(MRe,this.notebookEditor,e,o,this.renderedEditors))}disposeTemplate(e){e.templateDisposables.dispose()}disposeElement(e,t,o){o.elementDisposables.clear()}};F4=I([m(4,B),m(5,F),m(6,ze),m(7,qt),m(8,_e),m(9,Ne),m(10,rs)],F4);var W4=class extends uVt{constructor(e,t,o,n,r,s,l,c,u,p,h){super(u,e,l,c,s,p,h,r,Fr,n);this.renderedEditors=t;this.editorPool=o}static{this.TEMPLATE_ID="code_cell"}get templateId(){return W4.TEMPLATE_ID}renderTemplate(e){e.classList.add("code-cell-row");let t=R(e,_(".cell-inner-container")),o=new P,n=o.add(this.contextKeyServiceProvider(t)),r=R(e,Ym(".cell-decoration")),s=new Bg(R(t,Ym(".cell-focus-indicator.cell-focus-indicator-top"))),l=R(t,Ym(".cell-title-toolbar")),c=new Bg(R(t,_(".cell-focus-indicator.cell-focus-indicator-side.cell-focus-indicator-left"))),u=R(t,Ym(".cell-chat-part")),p=R(t,Ym(".cell.code")),h=R(p,Ym(".run-button-container")),g=R(p,Ym(".input-collapse-container"));g.style.display="none";let f=R(c.domNode,Ym("div.execution-count-label"));f.title=d(12128,null);let v=R(p,Ym(".cell-editor-part")),b=R(v,Ym(".cell-editor-container")),S=R(t,Ym(".cell-comment-container")),y=o.add(this.contextKeyServiceProvider(v)),w=o.add(this.instantiationService.createChild(new Io([X,y])));ue.inCompositeEditor.bindTo(y).set(!0);let k=w.createInstance(jr,b,{...this.editorOptions.getDefaultValue(),allowVariableLineHeights:!1,dimension:{width:0,height:0},scrollbar:{vertical:"hidden",horizontal:"auto",handleMouseWheel:!1,useShadows:!1}},{contributions:this.notebookEditor.creationOptions.cellEditorContributions});o.add(k);let T=new Bg(R(t,Ym(".output"))),N=R(T.domNode,Ym(".output-collapse-container")),O=new Bg(R(t,Ym(".output-show-more-container"))),V=new Bg(R(t,_(".cell-focus-indicator.cell-focus-indicator-side.cell-focus-indicator-right"))),U=R(t,Ym(".cell-editor-focus-sink"));U.setAttribute("tabindex","0");let G=R(t,Ym(".cell-bottom-toolbar-container")),$=new Bg(R(t,Ym(".cell-focus-indicator.cell-focus-indicator-bottom"))),te=o.add(this.instantiationService.createChild(new Io([X,n]))),pe={toggle:(Qt,Ze)=>t.classList.toggle(Qt,Ze)},de=o.add(te.createInstance(Qpe,l,pe,this.notebookEditor.creationOptions.menuIds.cellTitleToolbar,this.notebookEditor.creationOptions.menuIds.cellDeleteToolbar,this.notebookEditor)),se=o.add(new hZe(this.notebookEditor,de,s,c,V,$)),Se=[se,o.add(te.createInstance(uZe,this.notebookEditor,u)),o.add(te.createInstance(qpe,this.notebookEditor,t,v,k)),o.add(te.createInstance(CRe,v,g)),o.add(new pZe(this.notebookEditor,e,r)),o.add(te.createInstance($pe,this.notebookEditor,S)),o.add(te.createInstance(wRe,this.notebookEditor,f)),o.add(te.createInstance(LRe,this.notebookEditor,N)),o.add(new SZe(this.notebookEditor,g)),o.add(new mZe(t,U,this.notebookEditor)),o.add(new lZe(t)),o.add(te.createInstance(Upe,this.notebookEditor))],{cellExecutePrimary:ke,cellExecuteToolbar:Ee}=this.notebookEditor.creationOptions.menuIds;ke&&Ee&&Se.push(o.add(te.createInstance(DRe,this.notebookEditor,n,t,h,ke,Ee)));let He=new aZe(Me(e),Se,[de,o.add(te.createInstance(jpe,this.notebookEditor,l,G))]);o.add(He);let Ve={rootContainer:e,editorPart:v,cellInputCollapsedContainer:g,cellOutputCollapsedContainer:N,instantiationService:te,container:t,cellContainer:p,focusSinkElement:U,outputContainer:T,outputShowMoreContainer:O,editor:k,templateDisposables:o,elementDisposables:o.add(new P),cellParts:He,toJSON:()=>({})},Fe=[c.domNode,se.codeFocusIndicator.domNode,se.outputFocusIndicator.domNode];return this.dndController?.registerDragHandle(Ve,e,Fe,()=>new sVt().getDragImage(Ve,Ve.editor,"code")),Ve}renderElement(e,t,o,n){if(!this.notebookEditor.hasModel())throw new Error("The notebook editor is not attached with view model yet.");o.currentRenderedCell=e,n?.height!==void 0&&(o.outputContainer.domNode.innerText="",o.outputContainer.domNode.appendChild(o.cellOutputCollapsedContainer),o.elementDisposables.add(o.instantiationService.createInstance(_Re,this.notebookEditor,e,o,this.editorPool)),this.renderedEditors.set(e,o.editor))}disposeTemplate(e){e.templateDisposables.dispose()}disposeElement(e,t,o){o.elementDisposables.clear(),this.renderedEditors.delete(e)}};W4=I([m(5,B),m(6,ze),m(7,qt),m(8,F),m(9,_e),m(10,Ne)],W4);var ARe=class extends C{constructor(){super(...arguments);this._onDidChangeLayout=this._register(new E);this.onDidChangeLayout=this._onDidChangeLayout.event;this._onDidChangeMetadata=this._register(new E);this.onDidChangeMetadata=this._onDidChangeMetadata.event;this._onDidChangeCellState=this._register(new E);this.onDidChangeCellState=this._onDidChangeCellState.event}emit(e){for(let t=0,o=e.length;t<o;t++){let n=e[t];switch(n.type){case 1:this._onDidChangeLayout.fire(n);break;case 2:this._onDidChangeMetadata.fire(n);break;case 3:this._onDidChangeCellState.fire(n);break}}}};var NRe=class extends C{constructor(e,t){super();this._notebookEditor=e;this.ownerID=t;this._allMatchesDecorations=[];this._currentMatchCellDecorations=[];this._allMatchesCellDecorations=[];this._currentMatchDecorations=null}get currentMatchDecorations(){return this._currentMatchDecorations}clearDecorations(){this.clearCurrentFindMatchDecoration(),this.setAllFindMatchesDecorations([])}async highlightCurrentFindMatchDecorationInCell(e,t){return this.clearCurrentFindMatchDecoration(),this._notebookEditor.changeModelDecorations(o=>{let n=Vq._CURRENT_FIND_MATCH_DECORATION,r=[{range:t,options:n}],s={ownerId:e.handle,decorations:r};this._currentMatchDecorations={kind:"input",decorations:o.deltaDecorations(this._currentMatchDecorations?.kind==="input"?this._currentMatchDecorations.decorations:[],[s])}}),this._currentMatchCellDecorations=this._notebookEditor.deltaCellDecorations(this._currentMatchCellDecorations,[{handle:e.handle,options:{overviewRuler:{color:XSe,modelRanges:[t],includeOutput:!1,position:2}}}]),null}async highlightCurrentFindMatchDecorationInWebview(e,t){this.clearCurrentFindMatchDecoration();let o=await this._notebookEditor.findHighlightCurrent(t,this.ownerID);return this._currentMatchDecorations={kind:"output",index:t},this._currentMatchCellDecorations=this._notebookEditor.deltaCellDecorations(this._currentMatchCellDecorations,[{handle:e.handle,options:{overviewRuler:{color:XSe,modelRanges:[],includeOutput:!0,position:2}}}]),o}clearCurrentFindMatchDecoration(){this._currentMatchDecorations?.kind==="input"?this._notebookEditor.changeModelDecorations(e=>{e.deltaDecorations(this._currentMatchDecorations?.kind==="input"?this._currentMatchDecorations.decorations:[],[]),this._currentMatchDecorations=null}):this._currentMatchDecorations?.kind==="output"&&this._notebookEditor.findUnHighlightCurrent(this._currentMatchDecorations.index,this.ownerID),this._currentMatchCellDecorations=this._notebookEditor.deltaCellDecorations(this._currentMatchCellDecorations,[])}setAllFindMatchesDecorations(e){this._notebookEditor.changeModelDecorations(t=>{let o=Vq._FIND_MATCH_DECORATION,n=e.map(r=>{let s=new Array(r.contentMatches.length);for(let l=0;l<r.contentMatches.length;l++)s[l]={range:r.contentMatches[l].range,options:o};return{ownerId:r.cell.handle,decorations:s}});this._allMatchesDecorations=t.deltaDecorations(this._allMatchesDecorations,n)}),this._allMatchesCellDecorations=this._notebookEditor.deltaCellDecorations(this._allMatchesCellDecorations,e.map(t=>({ownerId:t.cell.handle,handle:t.cell.handle,options:{overviewRuler:{color:MN,modelRanges:t.contentMatches.map(o=>o.range),includeOutput:t.webviewMatches.length>0,position:2}}})))}stopWebviewFind(){this._notebookEditor.findStop(this.ownerID)}dispose(){this.clearDecorations(),super.dispose()}};var V4=class{get length(){return this._contentMatches.length+this._webviewMatches.length}get contentMatches(){return this._contentMatches}get webviewMatches(){return this._webviewMatches}constructor(i,e,t,o){this.cell=i,this.index=e,this._contentMatches=t,this._webviewMatches=o}getMatch(i){if(i>=this.length)throw new Error("NotebookCellFindMatch: index out of range");return i<this._contentMatches.length?this._contentMatches[i]:this._webviewMatches[i-this._contentMatches.length]}},FRe=class extends C{constructor(e,t,o){super();this._notebookEditor=e;this._state=t;this._configurationService=o;this._findMatches=[];this._findMatchesStarts=null;this._currentMatch=-1;this._computePromise=null;this._modelDisposable=this._register(new P);this._throttledDelayer=this._register(new jo(20)),this._computePromise=null,this._register(t.onFindReplaceStateChange(n=>{this._updateCellStates(n),(n.searchString||n.isRegex||n.matchCase||n.searchScope||n.wholeWord||n.isRevealed&&this._state.isRevealed||n.filters||n.isReplaceRevealed)&&this.research(),n.isRevealed&&!this._state.isRevealed&&this.clear()})),this._register(this._notebookEditor.onDidChangeModel(n=>{this._registerModelListener(n)})),this._register(this._notebookEditor.onDidChangeCellState(n=>{n.cell.cellKind===1&&n.source.editStateChanged&&this.research()})),this._notebookEditor.hasModel()&&this._registerModelListener(this._notebookEditor.textModel),this._findMatchDecorationModel=new NRe(this._notebookEditor,this._notebookEditor.getId())}get findMatches(){return this._findMatches}get currentMatch(){return this._currentMatch}_updateCellStates(e){if(!this._state.filters?.markupInput||!this._state.filters?.markupPreview||!this._state.filters?.findScope)return;let t=()=>{let o=this._notebookEditor.getViewModel();if(!o)return;let n=this._configurationService.inspect("editor.wordSeparators").value,r={regex:this._state.isRegex,wholeWord:this._state.wholeWord,caseSensitive:this._state.matchCase,wordSeparators:n,includeMarkupInput:!0,includeCodeInput:!1,includeMarkupPreview:!1,includeOutput:!1,findScope:this._state.filters?.findScope},s=o.find(this._state.searchString,r);for(let l=0;l<o.length;l++){let c=o.cellAt(l);if(c&&c.cellKind===1){let p=s.find(g=>g.cell.handle===c.handle&&g.contentMatches.length>0)?1:0,h=c.getEditState();if(h===1&&c.editStateSource!=="find")continue;h!==p&&c.updateEditState(p,"find")}}};if(e.isReplaceRevealed&&!this._state.isReplaceRevealed){let o=this._notebookEditor.getViewModel();if(!o)return;for(let n=0;n<o.length;n++){let r=o.cellAt(n);r&&r.cellKind===1&&r.getEditState()===1&&r.editStateSource==="find"&&r.updateEditState(0,"find")}return}(e.isReplaceRevealed||(e.filters||e.isRevealed||e.searchString||e.replaceString)&&this._state.isRevealed&&this._state.isReplaceRevealed)&&t()}ensureFindMatches(){this._findMatchesStarts||this.set(this._findMatches,!0)}getCurrentMatch(){let e=this._findMatchesStarts.getIndexOf(this._currentMatch),t=this._findMatches[e.index].cell,o=this._findMatches[e.index].getMatch(e.remainder);return{cell:t,match:o,isModelMatch:e.remainder<this._findMatches[e.index].contentMatches.length}}refreshCurrentMatch(e){let t=this.findMatches.findIndex(s=>s.cell===e.cell);if(t===-1)return;let n=this.findMatches[t].contentMatches.findIndex(s=>s.range.intersectRanges(e.range)!==null);if(n===void 0)return;let r=t===0?0:this._findMatchesStarts?.getPrefixSum(t-1)??0;this._currentMatch=r+n,this.highlightCurrentFindMatchDecoration(t,n).then(async s=>{await this.revealCellRange(t,n,s),this._state.changeMatchInfo(this._currentMatch,this._findMatches.reduce((l,c)=>l+c.length,0),void 0)})}find(e){if(!this.findMatches.length)return;if(!this._findMatchesStarts)this.set(this._findMatches,!0),Wo(e,{index:!0})&&(this._currentMatch=e.index);else{let o=this._findMatchesStarts.getTotalSum();if(Wo(e,{index:!0}))this._currentMatch=e.index;else if(this._currentMatch===-1)this._currentMatch=e.previous?o-1:0;else{let n=(this._currentMatch+(e.previous?-1:1)+o)%o;this._currentMatch=n}}let t=this._findMatchesStarts.getIndexOf(this._currentMatch);this.highlightCurrentFindMatchDecoration(t.index,t.remainder).then(async o=>{await this.revealCellRange(t.index,t.remainder,o),this._state.changeMatchInfo(this._currentMatch,this._findMatches.reduce((n,r)=>n+r.length,0),void 0)})}async revealCellRange(e,t,o){let n=this._findMatches[e];if(t>=n.contentMatches.length)this._notebookEditor.focusElement(n.cell),this._notebookEditor.getCellIndex(n.cell)!==void 0&&this._notebookEditor.revealCellOffsetInCenter(n.cell,o??0);else{let r=n.getMatch(t);n.cell.getEditState()!==1&&n.cell.updateEditState(1,"find"),n.cell.isInputCollapsed=!1,this._notebookEditor.focusElement(n.cell),this._notebookEditor.setCellEditorSelection(n.cell,r.range),await this._notebookEditor.revealInView(n.cell),this._notebookEditor.revealRangeInCenterIfOutsideViewportAsync(n.cell,r.range)}}_registerModelListener(e){this._modelDisposable.clear(),e&&this._modelDisposable.add(e.onDidChangeContent(t=>{t.rawEvents.some(o=>o.kind===10||o.kind===1)&&this.research()})),this.research()}async research(){return this._throttledDelayer.trigger(async()=>{this._state.change({isSearching:!0},!1),await this._research(),this._state.change({isSearching:!1},!1)})}async _research(){if(this._computePromise?.cancel(),!this._state.isRevealed||!this._notebookEditor.hasModel()){this.set([],!1);return}this._computePromise=xn(l=>this._compute(l));let e=await this._computePromise;if(!e){this.set([],!1);return}if(e.length===0){this.set([],!1);return}let t=l=>{let c=xy(e.map(u=>u.index),u=>u>=l);this._updateCurrentMatch(e,this._matchesCountBeforeIndex(e,c))};if(this._currentMatch===-1)if(this._notebookEditor.getLength()===0){this.set(e,!1);return}else{let l=this._notebookEditor.getFocus().start;t(l),this.set(e,!1);return}let o=this._findMatchesStarts.getIndexOf(this._currentMatch),n=this._findMatches[o.index].cell,r=this._notebookEditor.getCellIndex(n);if(r<0){if(this._notebookEditor.getLength()===0){this.set(e,!1);return}t(r);return}let s=this._notebookEditor.cellAt(r);if(s.cellKind===1&&s.getEditState()===0){t(r);return}if(!this._findMatchDecorationModel.currentMatchDecorations){t(r);return}if(this._findMatchDecorationModel.currentMatchDecorations.kind==="input"){let l=this._findMatchDecorationModel.currentMatchDecorations.decorations.find(u=>u.ownerId===s.handle);if(!l){t(r);return}let c=xy(e,u=>u.index>=r)%e.length;if(e[c].index>r){this._updateCurrentMatch(e,this._matchesCountBeforeIndex(e,c));return}else{let u=s.editorAttached&&l.decorations[0]?s.getCellDecorationRange(l.decorations[0]):null;if(u===null&&o.remainder<this._findMatches[o.index].contentMatches.length&&(u=this._findMatches[o.index].getMatch(o.remainder).range),u!==null){let p=e[c],h=xy(p.contentMatches,g=>z.compareRangesUsingStarts(g.range,u)>=0);this._updateCurrentMatch(e,this._matchesCountBeforeIndex(e,c)+h)}else{this._updateCurrentMatch(e,this._matchesCountBeforeIndex(e,c));return}}}else{let l=xy(e.map(c=>c.index),c=>c>=r)%e.length;this._updateCurrentMatch(e,this._matchesCountBeforeIndex(e,l))}}set(e,t){if(!e||!e.length){this._findMatches=[],this._findMatchDecorationModel.setAllFindMatchesDecorations([]),this.constructFindMatchesStarts(),this._currentMatch=-1,this._findMatchDecorationModel.clearCurrentFindMatchDecoration(),this._state.changeMatchInfo(this._currentMatch,this._findMatches.reduce((o,n)=>o+n.length,0),void 0);return}this._findMatches=e,this._findMatchDecorationModel.setAllFindMatchesDecorations(e||[]),this.constructFindMatchesStarts(),t&&(this._currentMatch=0,this.highlightCurrentFindMatchDecoration(0,0)),this._state.changeMatchInfo(this._currentMatch,this._findMatches.reduce((o,n)=>o+n.length,0),void 0)}async _compute(e){if(!this._notebookEditor.hasModel())return null;let t=null,o=this._state.searchString,n=this._configurationService.inspect("editor.wordSeparators").value,r={regex:this._state.isRegex,wholeWord:this._state.wholeWord,caseSensitive:this._state.matchCase,wordSeparators:n,includeMarkupInput:this._state.filters?.markupInput??!0,includeCodeInput:this._state.filters?.codeInput??!0,includeMarkupPreview:!!this._state.filters?.markupPreview,includeOutput:!!this._state.filters?.codeOutput,findScope:this._state.filters?.findScope};return t=await this._notebookEditor.find(o,r,e),e.isCancellationRequested?null:t}_updateCurrentMatch(e,t){this._currentMatch=t%e.length,this.set(e,!1);let o=this._findMatchesStarts.getIndexOf(this._currentMatch);this.highlightCurrentFindMatchDecoration(o.index,o.remainder),this._state.changeMatchInfo(this._currentMatch,this._findMatches.reduce((n,r)=>n+r.length,0),void 0)}_matchesCountBeforeIndex(e,t){let o=0;for(let n=0;n<t;n++)o+=e[n].length;return o}constructFindMatchesStarts(){if(this._findMatches&&this._findMatches.length){let e=new Uint32Array(this._findMatches.length);for(let t=0;t<this._findMatches.length;t++)e[t]=this._findMatches[t].length;this._findMatchesStarts=new KT(e)}else this._findMatchesStarts=null}async highlightCurrentFindMatchDecoration(e,t){let o=this._findMatches[e].cell,n=this._findMatches[e].getMatch(t);return t<this._findMatches[e].contentMatches.length?this._findMatchDecorationModel.highlightCurrentFindMatchDecorationInCell(o,n.range):this._findMatchDecorationModel.highlightCurrentFindMatchDecorationInWebview(o,n.index)}clear(){this._computePromise?.cancel(),this._throttledDelayer.cancel(),this.set([],!1)}dispose(){this._findMatchDecorationModel.dispose(),super.dispose()}};FRe=I([m(2,B)],FRe);var pVt=class extends C{constructor(){super(...arguments);this._onDidChangeSelection=this._register(new E);this._primary={start:0,end:0};this._selections=[{start:0,end:0}]}get onDidChangeSelection(){return this._onDidChangeSelection.event}get selections(){return this._selections}get focus(){return this._primary}setState(e,t,o,n){let r=e??{start:0,end:0},s=t.length>0?t:[{start:0,end:0}],l=!E8e([r],[this._primary])||!E8e(this._selections,s);this._primary=r,this._selections=s,(l||o)&&this._onDidChangeSelection.fire(n)}setSelections(e,t,o){this.setState(this._primary,e,t,o)}};var R8o=()=>{throw new Error("Invalid change accessor")},cwi=class{constructor(){this._decorationsTree=new L9}intervalSearch(i,e,t,o,n,r,s=!1){return this._decorationsTree.intervalSearch(i,e,t,o,n,r,s)}search(i,e,t,o,n,r){return this._decorationsTree.search(i,e,t,n,r)}collectNodesFromOwner(i){return this._decorationsTree.collectNodesFromOwner(i)}collectNodesPostOrder(){return this._decorationsTree.collectNodesPostOrder()}insert(i){this._decorationsTree.insert(i)}delete(i){this._decorationsTree.delete(i)}resolveNode(i,e){this._decorationsTree.resolveNode(i,e)}acceptReplace(i,e,t,o){this._decorationsTree.acceptReplace(i,e,t,o)}},pco=[po.register({description:"notebook-view-model-tracked-range-always-grows-when-typing-at-edges",stickiness:0}),po.register({description:"notebook-view-model-tracked-range-never-grows-when-typing-at-edges",stickiness:1}),po.register({description:"notebook-view-model-tracked-range-grows-only-when-typing-before",stickiness:2}),po.register({description:"notebook-view-model-tracked-range-grows-only-when-typing-after",stickiness:3})];function M8o(a){return a instanceof po?a:po.createDynamic(a)}var lwi=0,BZ=class extends C{constructor(e,t,o,n,r,s,l,c,u,p){super();this.viewType=e;this._notebook=t;this._viewContext=o;this._layoutInfo=n;this._options=r;this._instantiationService=s;this._bulkEditService=l;this._undoService=c;this._textModelService=u;this.notebookExecutionStateService=p;this._localStore=this._register(new P);this._handleToViewCellMapping=new Map;this._onDidChangeOptions=this._register(new E);this._viewCells=[];this._onDidChangeViewCells=this._register(new E);this._lastNotebookEditResource=[];this._onDidChangeSelection=this._register(new E);this._selectionCollection=this._register(new pVt);this._decorationsTree=new cwi;this._decorations=Object.create(null);this._lastDecorationId=0;this._foldingRanges=null;this._onDidFoldingStateChanged=this._register(new E);this.onDidFoldingStateChanged=this._onDidFoldingStateChanged.event;this._hiddenRanges=[];this._focused=!0;this._decorationIdToCellMap=new Map;this._statusBarItemIdToCellMap=new Map;this._lastOverviewRulerDecorationId=0;this._overviewRulerDecorations=new Map;lwi++,this.id="$notebookViewModel"+lwi,this._instanceId=_be(lwi);let h=(f,v)=>{let b=f.map(k=>[k[0],k[1],k[2].map(T=>mco(this._instantiationService,this,T,this._viewContext))]);b.reverse().forEach(k=>{let T=this._viewCells.splice(k[0],k[1],...k[2]);this._decorationsTree.acceptReplace(k[0],k[1],k[2].length,!0),T.forEach(N=>{this._handleToViewCellMapping.delete(N.handle),N.dispose()}),k[2].forEach(N=>{this._handleToViewCellMapping.set(N.handle,N),this._localStore.add(N)})});let S=this.selectionHandles;this._onDidChangeViewCells.fire({synchronous:v,splices:b});let y=[];if(S.length){let k=S[0],T=this._viewCells.indexOf(this.getCellByHandle(k));y=[k];let N=0;for(let O=0;O<b.length;O++){let V=b[0];if(V[0]+V[1]<=T){N+=V[2].length-V[1];continue}if(V[0]>T){y=[k];break}if(V[0]+V[1]>T){y=[this._viewCells[V[0]+N].handle];break}}}let w=y.map(k=>this._viewCells.findIndex(T=>T.handle===k));this._selectionCollection.setState(fce([w[0]])[0],fce(w),!0,"model")};this._register(this._notebook.onDidChangeContent(f=>{for(let v=0;v<f.rawEvents.length;v++){let b=f.rawEvents[v],S=[],y=f.synchronous??!0;if(b.kind===1||b.kind===6){S=b.changes,h(S,y);continue}else if(b.kind===2)h([[b.index,b.length,[]]],y),h([[b.newIdx,0,b.cells]],y);else continue}})),this._register(this._notebook.onDidChangeContent(f=>{f.rawEvents.forEach(v=>{v.kind===11&&this._viewContext.eventDispatcher.emit([new QWt(this._notebook.metadata)])}),f.endSelectionState&&this.updateSelectionsState(f.endSelectionState)})),this._register(this._viewContext.eventDispatcher.onDidChangeLayout(f=>{this._layoutInfo=f.value,this._viewCells.forEach(v=>{v.cellKind===1?(f.source.width||f.source.fontInfo)&&v.layoutChange({outerWidth:f.value.width,font:f.value.fontInfo}):f.source.width!==void 0&&v.layoutChange({outerWidth:f.value.width,font:f.value.fontInfo})})})),this._register(this._viewContext.notebookOptions.onDidChangeOptions(f=>{for(let v=0;v<this.length;v++)this._viewCells[v].updateOptions(f)})),this._register(p.onDidChangeExecution(f=>{if(f.type!==0)return;let v=this.getCellByHandle(f.cellHandle);v instanceof Qm&&v.updateExecutionState(f)})),this._register(this._selectionCollection.onDidChangeSelection(f=>{this._onDidChangeSelection.fire(f)}));let g=this.isRepl?this._notebook.cells.length-1:this._notebook.cells.length;for(let f=0;f<g;f++)this._viewCells.push(mco(this._instantiationService,this,this._notebook.cells[f],this._viewContext));this._viewCells.forEach(f=>{this._handleToViewCellMapping.set(f.handle,f)})}get options(){return this._options}get onDidChangeOptions(){return this._onDidChangeOptions.event}get viewCells(){return this._viewCells}get length(){return this._viewCells.length}get notebookDocument(){return this._notebook}get uri(){return this._notebook.uri}get metadata(){return this._notebook.metadata}get isRepl(){return this.viewType==="repl"}get onDidChangeViewCells(){return this._onDidChangeViewCells.event}get lastNotebookEditResource(){return this._lastNotebookEditResource.length?this._lastNotebookEditResource[this._lastNotebookEditResource.length-1]:null}get layoutInfo(){return this._layoutInfo}get onDidChangeSelection(){return this._onDidChangeSelection.event}get selectionHandles(){let e=new Set,t=[];return Lf(this._selectionCollection.selections).map(o=>o<this.length?this.cellAt(o):void 0).forEach(o=>{o&&!e.has(o.handle)&&t.push(o.handle)}),t}set selectionHandles(e){let t=e.map(o=>this._viewCells.findIndex(n=>n.handle===o));this._selectionCollection.setSelections(fce(t),!0,"model")}get focused(){return this._focused}updateOptions(e){this._options={...this._options,...e},this._viewCells.forEach(t=>t.updateOptions({readonly:this._options.isReadOnly})),this._onDidChangeOptions.fire()}getFocus(){return this._selectionCollection.focus}getSelections(){return this._selectionCollection.selections}getMostRecentlyExecutedCell(){let e=this.notebookExecutionStateService.getLastCompletedCellForNotebook(this._notebook.uri);return e!==void 0?this.getCellByHandle(e):void 0}setEditorFocus(e){this._focused=e}validateRange(e){if(!e)return null;let t=Kn(e.start,0,this.length),o=Kn(e.end,0,this.length);return t<=o?{start:t,end:o}:{start:o,end:t}}updateSelectionsState(e,t="model"){if(this._focused||t==="model")if(e.kind===0){let o=e.primary!==null?this.getCellIndexByHandle(e.primary):null,n=o!==null?this.validateRange({start:o,end:o+1}):null,r=fce(e.selections.map(s=>this.getCellIndexByHandle(s))).map(s=>this.validateRange(s)).filter(s=>s!==null);this._selectionCollection.setState(n,MO(r),!0,t)}else{let o=this.validateRange(e.focus),n=e.selections.map(r=>this.validateRange(r)).filter(r=>r!==null);this._selectionCollection.setState(o,MO(n),!0,t)}}getFoldingStartIndex(e){if(!this._foldingRanges)return-1;let t=this._foldingRanges.findRange(e+1);return this._foldingRanges.getStartLineNumber(t)-1}getFoldingState(e){if(!this._foldingRanges)return 0;let t=this._foldingRanges.findRange(e+1);return this._foldingRanges.getStartLineNumber(t)-1!==e?0:this._foldingRanges.isCollapsed(t)?2:1}getFoldedLength(e){if(!this._foldingRanges)return 0;let t=this._foldingRanges.findRange(e+1),o=this._foldingRanges.getStartLineNumber(t)-1;return this._foldingRanges.getEndLineNumber(t)-1-o}updateFoldingRanges(e){this._foldingRanges=e;let t=!1,o=[],n=0,r=0,s=Number.MAX_VALUE,l=-1;for(;n<e.length;n++){if(!e.isCollapsed(n))continue;let c=e.getStartLineNumber(n)+1,u=e.getEndLineNumber(n);s<=c&&u<=l||(!t&&r<this._hiddenRanges.length&&this._hiddenRanges[r].start+1===c&&this._hiddenRanges[r].end+1===u?(o.push(this._hiddenRanges[r]),r++):(t=!0,o.push({start:c-1,end:u-1})),s=c,l=u)}(t||r<this._hiddenRanges.length)&&(this._hiddenRanges=o,this._onDidFoldingStateChanged.fire()),this._viewCells.forEach(c=>{c.cellKind===1&&c.triggerFoldingStateChange()})}getHiddenRanges(){return this._hiddenRanges}getOverviewRulerDecorations(){return Array.from(this._overviewRulerDecorations.values())}getCellByHandle(e){return this._handleToViewCellMapping.get(e)}getCellIndexByHandle(e){return this._viewCells.findIndex(t=>t.handle===e)}getCellIndex(e){return this._viewCells.indexOf(e)}cellAt(e){return this._viewCells[e]}getCellsInRange(e){if(!e)return this._viewCells.slice(0);let t=this.validateRange(e);if(t){let o=[];for(let n=t.start;n<t.end;n++)o.push(this._viewCells[n]);return o}return[]}getNearestVisibleCellIndexUpwards(e){for(let t=this._hiddenRanges.length-1;t>=0;t--){let o=this._hiddenRanges[t],n=o.start-1,r=o.end;if(!(n>e)){if(n<=e&&r>=e)return e;break}}return e}getNextVisibleCellIndex(e){for(let t=0;t<this._hiddenRanges.length;t++){let o=this._hiddenRanges[t],n=o.start-1,r=o.end;if(!(r<e)){if(n<=e)return r+1;break}}return e+1}getPreviousVisibleCellIndex(e){for(let t=this._hiddenRanges.length-1;t>=0;t--){let o=this._hiddenRanges[t],n=o.start-1;if(o.end<e)return e;if(n<=e)return n}return e}hasCell(e){return this._handleToViewCellMapping.has(e.handle)}getVersionId(){return this._notebook.versionId}getAlternativeId(){return this._notebook.alternativeVersionId}getTrackedRange(e){return this._getDecorationRange(e)}_getDecorationRange(e){let t=this._decorations[e];if(!t)return null;let o=this.getVersionId();return t.cachedVersionId!==o&&this._decorationsTree.resolveNode(t,o),t.range===null?{start:t.cachedAbsoluteStart-1,end:t.cachedAbsoluteEnd-1}:{start:t.range.startLineNumber-1,end:t.range.endLineNumber-1}}setTrackedRange(e,t,o){let n=e?this._decorations[e]:null;return n?t?(this._decorationsTree.delete(n),n.reset(this.getVersionId(),t.start,t.end+1,new z(t.start+1,1,t.end+1,1)),n.setOptions(pco[o]),this._decorationsTree.insert(n),n.id):(this._decorationsTree.delete(n),delete this._decorations[n.id],null):t?this._deltaCellDecorationsImpl(0,[],[{range:new z(t.start+1,1,t.end+1,1),options:pco[o]}])[0]:null}_deltaCellDecorationsImpl(e,t,o){let n=this.getVersionId(),r=t.length,s=0,l=o.length,c=0,u=new Array(l);for(;s<r||c<l;){let p=null;if(s<r){do p=this._decorations[t[s++]];while(!p&&s<r);p&&this._decorationsTree.delete(p)}if(c<l){if(!p){let v=++this._lastDecorationId,b=`${this._instanceId};${v}`;p=new rae(b,0,0),this._decorations[b]=p}let h=o[c],g=h.range,f=M8o(h.options);p.ownerId=e,p.reset(n,g.startLineNumber,g.endLineNumber,z.lift(g)),p.setOptions(f),this._decorationsTree.insert(p),u[c]=p.id,c++}else p&&delete this._decorations[p.id]}return u}deltaCellDecorations(e,t){e.forEach(n=>{let r=this._decorationIdToCellMap.get(n);r!==void 0&&(this.getCellByHandle(r)?.deltaCellDecorations([n],[]),this._decorationIdToCellMap.delete(n)),this._overviewRulerDecorations.delete(n)});let o=[];return t.forEach(n=>{if(K7i(n)){let s=this.getCellByHandle(n.handle)?.deltaCellDecorations([],[n.options])||[];s.forEach(l=>{this._decorationIdToCellMap.set(l,n.handle)}),o.push(...s)}else{let r=++this._lastOverviewRulerDecorationId,s=`_overview_${this.id};${r}`;this._overviewRulerDecorations.set(s,n),o.push(s)}}),o}deltaCellStatusBarItems(e,t){let o=wI(e,r=>this._statusBarItemIdToCellMap.get(r)??-1),n=[];t.forEach(r=>{let s=this.getCellByHandle(r.handle),l=o[r.handle]??[];delete o[r.handle],l.forEach(u=>this._statusBarItemIdToCellMap.delete(u));let c=s?.deltaCellStatusBarItems(l,r.items)||[];c.forEach(u=>{this._statusBarItemIdToCellMap.set(u,r.handle)}),n.push(...c)});for(let r in o){let s=parseInt(r),l=o[s];this.getCellByHandle(s)?.deltaCellStatusBarItems(l,[]),l.forEach(u=>this._statusBarItemIdToCellMap.delete(u))}return n}nearestCodeCellIndex(e){let t=this.viewCells.slice(0,e).reverse().findIndex(o=>o.cellKind===2);if(t>-1)return e-t-1;{let o=this.viewCells.slice(e+1).findIndex(n=>n.cellKind===2);return o>-1?e+1+o:-1}}getEditorViewState(){let e={},t={},o={},n={};this._viewCells.forEach((s,l)=>{s.getEditState()===1&&(e[l]=!0),s.isInputCollapsed&&(t[l]=!0),s instanceof Qm&&s.isOutputCollapsed&&(o[l]=!0),s.lineNumbers!=="inherit"&&(n[l]=s.lineNumbers)});let r={};return this._viewCells.map(s=>({handle:s.model.handle,state:s.saveEditorViewState()})).forEach((s,l)=>{s.state&&(r[l]=s.state)}),{editingCells:e,editorViewStates:r,cellLineNumberStates:n,collapsedInputCells:t,collapsedOutputCells:o}}restoreEditorViewState(e){e&&this._viewCells.forEach((t,o)=>{let n=e.editingCells&&e.editingCells[o],r=e.editorViewStates&&e.editorViewStates[o];t.updateEditState(n?1:0,"viewState");let s=e.cellTotalHeights?e.cellTotalHeights[o]:void 0;t.restoreEditorViewState(r,s),e.collapsedInputCells&&e.collapsedInputCells[o]&&(t.isInputCollapsed=!0),e.collapsedOutputCells&&e.collapsedOutputCells[o]&&t instanceof Qm&&(t.isOutputCollapsed=!0),e.cellLineNumberStates&&e.cellLineNumberStates[o]&&(t.lineNumbers=e.cellLineNumberStates[o])})}changeModelDecorations(e){let t={deltaDecorations:(n,r)=>this._deltaModelDecorationsImpl(n,r)},o=null;try{o=e(t)}catch(n){mt(n)}return t.deltaDecorations=R8o,o}_deltaModelDecorationsImpl(e,t){let o=new Map;e.forEach(r=>{let s=r.ownerId;if(!o.has(s)){let c=this._viewCells.find(u=>u.handle===s);c&&o.set(s,{cell:c,oldDecorations:[],newDecorations:[]})}let l=o.get(s);l&&(l.oldDecorations=r.decorations)}),t.forEach(r=>{let s=r.ownerId;if(!o.has(s)){let c=this._viewCells.find(u=>u.handle===s);c&&o.set(s,{cell:c,oldDecorations:[],newDecorations:[]})}let l=o.get(s);l&&(l.newDecorations=r.decorations)});let n=[];return o.forEach((r,s)=>{let l=r.cell.deltaModelDecorations(r.oldDecorations,r.newDecorations);n.push({ownerId:s,decorations:l})}),n}find(e,t){let o=[],n=[];if(t.findScope&&(t.findScope.findScopeType==="cells"||t.findScope.findScopeType==="text")){let r=t.findScope.selectedCellRanges?.map(l=>this.validateRange(l)).filter(l=>!!l)??[];n=Lf(r).map(l=>this._viewCells[l])}else n=this._viewCells;return n.forEach((r,s)=>{let l=r.startFind(e,t);l&&o.push(new V4(l.cell,s,l.contentMatches,[]))}),o.filter(r=>r.cell.cellKind===2?t.includeCodeInput:(r.cell.getEditState()===1||!t.includeMarkupPreview)&&t.includeMarkupInput)}replaceOne(e,t,o){let n=e;return this._lastNotebookEditResource.push(n.uri),n.resolveTextModel().then(()=>{this._bulkEditService.apply([new ja(e.uri,{range:t,text:o})],{quotableLabel:"Notebook Replace"})})}async replaceAll(e,t){if(!e.length)return;let o=[];return this._lastNotebookEditResource.push(e[0].cell.uri),e.forEach(n=>{n.contentMatches.forEach((r,s)=>{o.push({versionId:void 0,textEdit:{range:r.range,text:t[s]},resource:n.cell.uri})})}),Promise.all(e.map(n=>n.cell.resolveTextModel())).then(async()=>{this._bulkEditService.apply({edits:o},{quotableLabel:"Notebook Replace All"})})}async _withElement(e,t){let o=this._viewCells.filter(r=>e.matchesResource(r.uri)),n=await Promise.all(o.map(r=>this._textModelService.createModelReference(r.uri)));await t(),n.forEach(r=>r.dispose())}async undo(){let e=this._undoService.getElements(this.uri),t=e.past.length?e.past[e.past.length-1]:void 0;return t&&t instanceof IL||t instanceof vW?(await this._withElement(t,async()=>{await this._undoService.undo(this.uri)}),t instanceof IL?[t.resource]:t.resources):(await this._undoService.undo(this.uri),[])}async redo(){let t=this._undoService.getElements(this.uri).future[0];return t&&t instanceof IL||t instanceof vW?(await this._withElement(t,async()=>{await this._undoService.redo(this.uri)}),t instanceof IL?[t.resource]:t.resources):(await this._undoService.redo(this.uri),[])}equal(e){return this._notebook===e}dispose(){this._localStore.clear(),this._viewCells.forEach(e=>{e.dispose()}),super.dispose()}};BZ=I([m(5,F),m(6,ma),m(7,Cl),m(8,Nt),m(9,rs)],BZ);function mco(a,i,e,t){return e.cellKind===2?a.createInstance(Qm,i.viewType,e,i.layoutInfo,t):a.createInstance(kb,i.viewType,e,i.layoutInfo,i,t)}var WRe=class{constructor(i,e,t){this.notebookOptions=i;this.eventDispatcher=e;this.getBaseCellEditorOptions=t}};var dwi=21,P8o=21,B4=8,uwi=class{constructor(i,e,t,o){this.notebookEditor=i;this.editorToolbar=e;this.goToMenu=t;this.instantiationService=o}actionProvider(i,e){if(i.id===tT)return this.instantiationService.createInstance(gB,i,this.notebookEditor,e);if(i instanceof Eo)return this.instantiationService.createInstance(kRe,i,{hoverDelegate:e.hoverDelegate});if(i instanceof Cc&&i.item.submenu.id===D.NotebookCellExecuteGoTo.id)return this.instantiationService.createInstance(N4,i,{hoverDelegate:e.hoverDelegate},!0,{getActions:()=>this.goToMenu.getActions().find(([t])=>t==="navigation/execute")?.[1]??[]},this.actionProvider.bind(this))}calculateActions(i){let e=this.editorToolbar.primaryActions,t=this.editorToolbar.secondaryActions,o=hco(e,t,i);return{primaryActions:o.primaryActions.map(n=>n.action),secondaryActions:o.secondaryActions}}},pwi=class{constructor(i,e,t,o){this.notebookEditor=i;this.editorToolbar=e;this.goToMenu=t;this.instantiationService=o}actionProvider(i,e){if(i.id===tT)return this.instantiationService.createInstance(gB,i,this.notebookEditor,e);if(i instanceof Eo)return this.instantiationService.createInstance(ml,i,{hoverDelegate:e.hoverDelegate});if(i instanceof Cc)return i.item.submenu.id===D.NotebookCellExecuteGoTo.id?this.instantiationService.createInstance(N4,i,{hoverDelegate:e.hoverDelegate},!1,{getActions:()=>this.goToMenu.getActions().find(([t])=>t==="navigation/execute")?.[1]??[]},this.actionProvider.bind(this)):this.instantiationService.createInstance(mE,i,{hoverDelegate:e.hoverDelegate})}calculateActions(i){let e=this.editorToolbar.primaryActions,t=this.editorToolbar.secondaryActions,o=hco(e,t,i);return{primaryActions:o.primaryActions.map(n=>n.action),secondaryActions:o.secondaryActions}}},mwi=class{constructor(i,e,t,o){this.notebookEditor=i;this.editorToolbar=e;this.goToMenu=t;this.instantiationService=o}actionProvider(i,e){if(i.id===tT)return this.instantiationService.createInstance(gB,i,this.notebookEditor,e);let t=this.editorToolbar.primaryActions.find(o=>o.action.id===i.id);return!t||t.renderLabel?i instanceof Eo?this.instantiationService.createInstance(kRe,i,{hoverDelegate:e.hoverDelegate}):i instanceof Cc&&i.item.submenu.id===D.NotebookCellExecuteGoTo.id?this.instantiationService.createInstance(N4,i,{hoverDelegate:e.hoverDelegate},!0,{getActions:()=>this.goToMenu.getActions().find(([o])=>o==="navigation/execute")?.[1]??[]},this.actionProvider.bind(this)):void 0:i instanceof Eo?this.instantiationService.createInstance(ml,i,{hoverDelegate:e.hoverDelegate}):i instanceof Cc?i.item.submenu.id===D.NotebookCellExecuteGoTo.id?this.instantiationService.createInstance(N4,i,{hoverDelegate:e.hoverDelegate},!1,{getActions:()=>this.goToMenu.getActions().find(([o])=>o==="navigation/execute")?.[1]??[]},this.actionProvider.bind(this)):this.instantiationService.createInstance(mE,i,{hoverDelegate:e.hoverDelegate}):void 0}calculateActions(i){let e=this.editorToolbar.primaryActions,t=this.editorToolbar.secondaryActions,o=A8o(e,t,i);return{primaryActions:o.primaryActions.map(n=>n.action),secondaryActions:o.secondaryActions}}},VRe=class extends C{constructor(e,t,o,n,r,s,l,c,u,p){super();this.notebookEditor=e;this.contextKeyService=t;this.notebookOptions=o;this.domNode=n;this.instantiationService=r;this.configurationService=s;this.contextMenuService=l;this.menuService=c;this.editorService=u;this.keybindingService=p;this._useGlobalToolbar=!1;this._renderLabel=0;this._visible=!1;this._onDidChangeVisibility=this._register(new E);this.onDidChangeVisibility=this._onDidChangeVisibility.event;this._dimension=null;this._primaryActions=[],this._secondaryActions=[],this._buildBody(),this._register(H.debounce(this.editorService.onDidActiveEditorChange,(h,g)=>h,200)(this._updatePerEditorChange,this)),this._registerNotebookActionsToolbar(),this._register(j(this.domNode,re.CONTEXT_MENU,h=>{let g=new yn(Me(this.domNode),h);this.contextMenuService.showContextMenu({menuId:D.NotebookToolbarContext,getAnchor:()=>g,menuActionOptions:{renderShortTitle:!0}})}))}get primaryActions(){return this._primaryActions}get secondaryActions(){return this._secondaryActions}set visible(e){this._visible!==e&&(this._visible=e,this._onDidChangeVisibility.fire(e))}get useGlobalToolbar(){return this._useGlobalToolbar}_buildBody(){this._notebookTopLeftToolbarContainer=document.createElement("div"),this._notebookTopLeftToolbarContainer.classList.add("notebook-toolbar-left"),this._leftToolbarScrollable=new Pa(this._notebookTopLeftToolbarContainer,{vertical:2,horizontal:3,horizontalScrollbarSize:3,useShadows:!1,scrollYToX:!0}),this._register(this._leftToolbarScrollable),R(this.domNode,this._leftToolbarScrollable.getDomNode()),this._notebookTopRightToolbarContainer=document.createElement("div"),this._notebookTopRightToolbarContainer.classList.add("notebook-toolbar-right"),R(this.domNode,this._notebookTopRightToolbarContainer)}_updatePerEditorChange(){if(this.editorService.activeEditorPane?.getId()===qL&&this.editorService.activeEditorPane.getControl()===this.notebookEditor){this._showNotebookActionsinEditorToolbar();return}}_registerNotebookActionsToolbar(){this._notebookGlobalActionsMenu=this._register(this.menuService.createMenu(this.notebookEditor.creationOptions.menuIds.notebookToolbar,this.contextKeyService)),this._executeGoToActionsMenu=this._register(this.menuService.createMenu(D.NotebookCellExecuteGoTo,this.contextKeyService)),this._useGlobalToolbar=this.notebookOptions.getDisplayOptions().globalToolbar,this._renderLabel=this._convertConfiguration(this.configurationService.getValue(ft.globalToolbarShowLabel)),this._updateStrategy();let e={ui:!0,notebookEditor:this.notebookEditor,source:"notebookToolbar"},t=(l,c)=>{if(l.id===tT)return this.instantiationService.createInstance(gB,l,this.notebookEditor,c);if(this._renderLabel!==1){let u=this._primaryActions.find(p=>p.action.id===l.id);return u&&u.renderLabel?l instanceof Eo?this.instantiationService.createInstance(kRe,l,{hoverDelegate:c.hoverDelegate}):void 0:l instanceof Eo?this.instantiationService.createInstance(ml,l,{hoverDelegate:c.hoverDelegate}):void 0}else return l instanceof Eo?this.instantiationService.createInstance(ml,l,{hoverDelegate:c.hoverDelegate}):void 0},o=this._register(this.instantiationService.createInstance(mv,"element",{instantHover:!0},{}));o.setInstantHoverTimeLimit(600);let n={hiddenItemStrategy:1,resetMenu:D.NotebookToolbar,actionViewItemProvider:(l,c)=>this._strategy.actionProvider(l,c),getKeyBinding:l=>this.keybindingService.lookupKeybinding(l.id),renderDropdownAsChildElement:!0,hoverDelegate:o};this._notebookLeftToolbar=this.instantiationService.createInstance(Ol,this._notebookTopLeftToolbarContainer,n),this._register(this._notebookLeftToolbar),this._notebookLeftToolbar.context=e,this._notebookRightToolbar=new Ju(this._notebookTopRightToolbarContainer,this.contextMenuService,{getKeyBinding:l=>this.keybindingService.lookupKeybinding(l.id),actionViewItemProvider:t,renderDropdownAsChildElement:!0,hoverDelegate:o}),this._register(this._notebookRightToolbar),this._notebookRightToolbar.context=e,this._showNotebookActionsinEditorToolbar();let r=!1,s;this._register(this._notebookGlobalActionsMenu.onDidChange(()=>{if(r){s=()=>this._showNotebookActionsinEditorToolbar();return}this.notebookEditor.isVisible&&this._showNotebookActionsinEditorToolbar()})),this._register(this._notebookLeftToolbar.onDidChangeDropdownVisibility(l=>{r=l,s&&!l&&(setTimeout(()=>{s?.()},0),s=void 0)})),this._register(this.notebookOptions.onDidChangeOptions(l=>{l.globalToolbar!==void 0&&(this._useGlobalToolbar=this.notebookOptions.getDisplayOptions().globalToolbar,this._showNotebookActionsinEditorToolbar())})),this._register(this.configurationService.onDidChangeConfiguration(l=>{if(l.affectsConfiguration(ft.globalToolbarShowLabel)){this._renderLabel=this._convertConfiguration(this.configurationService.getValue(ft.globalToolbarShowLabel)),this._updateStrategy(),this._notebookLeftToolbar.getElement().remove(),this._notebookLeftToolbar.dispose(),this._notebookLeftToolbar=this.instantiationService.createInstance(Ol,this._notebookTopLeftToolbarContainer,n),this._register(this._notebookLeftToolbar),this._notebookLeftToolbar.context=e,this._showNotebookActionsinEditorToolbar();return}}))}_updateStrategy(){switch(this._renderLabel){case 0:this._strategy=new uwi(this.notebookEditor,this,this._executeGoToActionsMenu,this.instantiationService);break;case 1:this._strategy=new pwi(this.notebookEditor,this,this._executeGoToActionsMenu,this.instantiationService);break;case 2:this._strategy=new mwi(this.notebookEditor,this,this._executeGoToActionsMenu,this.instantiationService);break}}_convertConfiguration(e){switch(e){case!0:return 0;case!1:return 1;case"always":return 0;case"never":return 1;case"dynamic":return 2}}_showNotebookActionsinEditorToolbar(){if(!this.notebookEditor.hasModel()){this._deferredActionUpdate?.dispose(),this._deferredActionUpdate=void 0,this.visible=!1;return}this._deferredActionUpdate||(this._useGlobalToolbar?this._deferredActionUpdate=nn(async()=>{await this._setNotebookActions(),this.visible=!0,this._deferredActionUpdate?.dispose(),this._deferredActionUpdate=void 0},50):(this.domNode.style.display="none",this._deferredActionUpdate=void 0,this.visible=!1))}async _setNotebookActions(){let e=this._notebookGlobalActionsMenu.getActions({shouldForwardArgs:!0,renderShortTitle:!0});this.domNode.style.display="flex";let t=e.filter(l=>/^navigation/.test(l[0])),o=[];t.sort((l,c)=>l[0]==="navigation"?1:c[0]==="navigation"?-1:0).forEach((l,c)=>{o.push(...l[1]),c<t.length-1&&o.push(new li)});let n=e.find(l=>/^status/.test(l[0])),r=n?n[1]:[],s=e.filter(l=>!/^navigation/.test(l[0])&&!/^status/.test(l[0])).reduce((l,c)=>(l.push(...c[1]),l),[]);this._notebookLeftToolbar.setActions([],[]),this._primaryActions=o.map(l=>({action:l,size:l instanceof li?1:0,renderLabel:!0,visible:!0})),this._notebookLeftToolbar.setActions(o,s),this._secondaryActions=s,this._notebookRightToolbar.setActions(r,[]),this._secondaryActions=s,this._dimension&&this._dimension.width>=0&&this._dimension.height>=0&&this._cacheItemSizes(this._notebookLeftToolbar),this._computeSizes()}_cacheItemSizes(e){for(let t=0;t<e.getItemsLength();t++){let o=e.getItemAction(t);if(o&&o.id!=="toolbar.toggle.more"){let n=this._primaryActions.find(r=>r.action.id===o.id);n&&(n.size=e.getItemWidth(t))}}}_computeSizes(){let e=this._notebookLeftToolbar,t=this._notebookRightToolbar;if(e&&t&&this._dimension&&this._dimension.height>=0&&this._dimension.width>=0){if(this._primaryActions.length===0&&e.getItemsLength()!==this._primaryActions.length&&this._cacheItemSizes(this._notebookLeftToolbar),this._primaryActions.length===0)return;let o=(t.getItemsLength()?t.getItemWidth(0):0)+B4,n=this._dimension.width-o-(B4+P8o)-B4-B4,r=this._strategy.calculateActions(n);this._notebookLeftToolbar.setActions(r.primaryActions,r.secondaryActions)}}layout(e){this._dimension=e,this._useGlobalToolbar?this.domNode.style.display="flex":this.domNode.style.display="none",this._computeSizes()}dispose(){this._notebookLeftToolbar.context=void 0,this._notebookRightToolbar.context=void 0,this._notebookLeftToolbar.dispose(),this._notebookRightToolbar.dispose(),this._notebookLeftToolbar=null,this._notebookRightToolbar=null,this._deferredActionUpdate?.dispose(),this._deferredActionUpdate=void 0,super.dispose()}};VRe=I([m(4,F),m(5,B),m(6,ze),m(7,qt),m(8,ee),m(9,_e)],VRe);function hco(a,i,e){return mVt(a,i,e,!1)}function A8o(a,i,e){if(a.length===0)return{primaryActions:[],secondaryActions:i};let t=a.filter(s=>s.size!==0).length;if(a.map(s=>s.size).reduce((s,l)=>s+l,0)+(t-1)*B4<=e)return a.forEach(s=>{s.renderLabel=!0}),mVt(a,i,e,!1);if(t*dwi+(t-1)*B4>e)return a.forEach(s=>{s.renderLabel=!1}),mVt(a,i,e,!0);let n=0,r=-1;for(let s=0;s<a.length;s++)if(n+=a[s].size+B4,a[s].action instanceof li){let l=a.slice(s+1).filter(u=>u.size!==0);n+(l.length===0?0:l.length*dwi+(l.length-1)*B4)<=e&&(r=s)}else continue;return r<0?(a.forEach(s=>{s.renderLabel=!1}),mVt(a,i,e,!0)):(a.slice(0,r+1).forEach(s=>{s.renderLabel=!0}),a.slice(r+1).forEach(s=>{s.renderLabel=!1}),{primaryActions:a,secondaryActions:i})}function mVt(a,i,e,t){let o=[],n=[],r=0,s=!1,l=!1;if(a.length===0)return{primaryActions:[],secondaryActions:i};for(let c=0;c<a.length;c++){let u=a[c],p=t?u.size===0?0:dwi:u.size;if(!(u.action instanceof li&&o.length>0&&o[o.length-1].action instanceof li)&&!(u.action instanceof li&&!s))if(r+p<=e&&!l)r+=B4+p,o.push(u),p!==0&&(s=!0),u.action instanceof li&&(s=!1);else if(l=!0,p===0)o.push(u);else{if(u.action instanceof li)continue;n.push(u.action)}}for(let c=o.length-1;c>0;c--){let u=o[c];if(u.size!==0){u.action instanceof li&&o.splice(c,1);break}}if(o.length&&o[o.length-1].action instanceof li&&o.pop(),n.length!==0&&n.push(new li),t){let c=o.findIndex(u=>u.action.id==="notebook.cell.insertMarkdownCellBelow");c!==-1&&o.splice(c,1)}return{primaryActions:o,secondaryActions:[...n,...i]}}var BRe=class{constructor(i,e,t,o,n){this._editor=i;this._notebookKernelService=e;this._extensionService=o;this._notebookExecutionStateService=n;this._disposables=new P;this._viewModelDisposables=new P;this._cellOutputsListeners=[];this._selectedKernelDisposables=new P;this._notebookKernel=ZLe.bindTo(t),this._notebookKernelCount=CZ.bindTo(t),this._notebookKernelSelected=Uao.bindTo(t),this._interruptibleKernel=hB.bindTo(t),this._hasVariableProvider=tRe.bindTo(t),this._someCellRunning=x4.bindTo(t),this._kernelRunning=mB.bindTo(t),this._useConsolidatedOutputButton=WJe.bindTo(t),this._hasOutputs=yWt.bindTo(t),this._viewType=Bao.bindTo(t),this._missingKernelExtension=IWt.bindTo(t),this._notebookKernelSourceCount=eRe.bindTo(t),this._cellToolbarLocation=Vao.bindTo(t),this._lastCellFailed=YLe.bindTo(t),this._handleDidChangeModel(),this._updateForNotebookOptions(),this._disposables.add(i.onDidChangeModel(this._handleDidChangeModel,this)),this._disposables.add(e.onDidAddKernel(this._updateKernelContext,this)),this._disposables.add(e.onDidChangeSelectedNotebooks(this._updateKernelContext,this)),this._disposables.add(e.onDidChangeSourceActions(this._updateKernelContext,this)),this._disposables.add(i.notebookOptions.onDidChangeOptions(this._updateForNotebookOptions,this)),this._disposables.add(o.onDidChangeExtensions(this._updateForInstalledExtension,this)),this._disposables.add(n.onDidChangeExecution(this._updateForExecution,this)),this._disposables.add(n.onDidChangeLastRunFailState(this._updateForLastRunFailState,this))}dispose(){this._disposables.dispose(),this._viewModelDisposables.dispose(),this._selectedKernelDisposables.dispose(),this._notebookKernelCount.reset(),this._notebookKernelSourceCount.reset(),this._interruptibleKernel.reset(),this._hasVariableProvider.reset(),this._someCellRunning.reset(),this._kernelRunning.reset(),this._viewType.reset(),Ue(this._cellOutputsListeners),this._cellOutputsListeners.length=0}_handleDidChangeModel(){if(this._updateKernelContext(),this._updateForNotebookOptions(),this._viewModelDisposables.clear(),Ue(this._cellOutputsListeners),this._cellOutputsListeners.length=0,!this._editor.hasModel())return;let i=()=>{let o=!1;if(this._editor.hasModel()){for(let n=0;n<this._editor.getLength();n++)if(this._editor.cellAt(n).outputsViewModels.length>0){o=!0;break}}this._hasOutputs.set(o)},e=this._viewModelDisposables.add(new P),t=o=>o.model.onDidChangeOutputs(()=>{e.clear(),e.add($r(Me(this._editor.getDomNode()),()=>{i()}))});for(let o=0;o<this._editor.getLength();o++){let n=this._editor.cellAt(o);this._cellOutputsListeners.push(t(n))}i(),this._updateForInstalledExtension(),this._viewModelDisposables.add(this._editor.onDidChangeViewCells(o=>{[...o.splices].reverse().forEach(n=>{let[r,s,l]=n,c=this._cellOutputsListeners.splice(r,s,...l.map(t));Ue(c)})})),this._viewType.set(this._editor.textModel.viewType)}_updateForExecution(i){if(this._editor.textModel){let e=this._notebookExecutionStateService.getExecution(this._editor.textModel.uri),t=this._notebookExecutionStateService.getCellExecutionsForNotebook(this._editor.textModel.uri);this._kernelRunning.set(t.length>0||!!e),i.type===0&&this._someCellRunning.set(t.length>0)}else this._kernelRunning.set(!1),i.type===0&&this._someCellRunning.set(!1)}_updateForLastRunFailState(i){i.notebook===this._editor.textModel?.uri&&this._lastCellFailed.set(i.visible)}async _updateForInstalledExtension(){if(!this._editor.hasModel())return;let i=this._editor.textModel.viewType,e=z7i.get(i);this._missingKernelExtension.set(!!e&&!await this._extensionService.getExtension(e))}_updateKernelContext(){if(!this._editor.hasModel()){this._notebookKernelCount.reset(),this._notebookKernelSourceCount.reset(),this._interruptibleKernel.reset(),this._hasVariableProvider.reset();return}let{selected:i,all:e}=this._notebookKernelService.getMatchingKernel(this._editor.textModel),t=this._notebookKernelService.getSourceActions(this._editor.textModel,this._editor.scopedContextKeyService);this._notebookKernelCount.set(e.length),this._notebookKernelSourceCount.set(t.length),this._interruptibleKernel.set(i?.implementsInterrupt??!1),this._hasVariableProvider.set(i?.hasVariableProvider??!1),this._notebookKernelSelected.set(!!i),this._notebookKernel.set(i?.id??""),this._selectedKernelDisposables.clear(),i&&this._selectedKernelDisposables.add(i.onDidChange(()=>{this._interruptibleKernel.set(i?.implementsInterrupt??!1)}))}_updateForNotebookOptions(){let i=this._editor.notebookOptions.getDisplayOptions();this._useConsolidatedOutputButton.set(i.consolidatedOutputButton),this._cellToolbarLocation.set(this._editor.notebookOptions.computeCellToolbarLocation(this._editor.textModel?.viewType))}};BRe=I([m(1,Tl),m(2,X),m(3,lt),m(4,rs)],BRe);var HRe=class extends Jd{constructor(e,t,o){super(o);this.notebookEditor=e;this._lanes=3;this._domNode=or(document.createElement("canvas")),this._domNode.setPosition("relative"),this._domNode.setLayerHinting(!0),this._domNode.setContain("strict"),t.appendChild(this._domNode.domNode),this._register(e.onDidChangeDecorations(()=>{this.layout()})),this._register(Xd.getInstance(Me(this._domNode.domNode)).onDidChange(()=>{this.layout()}))}layout(){let t=this.notebookEditor.getLayoutInfo(),o=t.scrollHeight,n=t.height,r=Xd.getInstance(Me(this._domNode.domNode)).value;this._domNode.setWidth(10),this._domNode.setHeight(n),this._domNode.domNode.width=10*r,this._domNode.domNode.height=n*r;let s=this._domNode.domNode.getContext("2d");s.clearRect(0,0,10*r,n*r),this._render(s,10*r,n*r,o*r,r)}_render(e,t,o,n,r){let s=this.notebookEditor.getViewModel(),l=this.notebookEditor.getLayoutInfo().fontInfo,c=t/this._lanes,u=0;if(s){for(let h=0;h<s.viewCells.length;h++){let g=s.viewCells[h],f=g.textBuffer,v=g.getCellDecorations(),b=g.layoutInfo.totalHeight/n*r*o;v.filter(S=>S.overviewRuler).forEach(S=>{let y=S.overviewRuler,w=this.getColor(y.color)??"#000000",k=Math.min(l.lineHeight,g.layoutInfo.editorHeight/n/f.getLineCount()*r*o),T=y.modelRanges.map(V=>V.startLineNumber).reduce((V,U)=>((V.length===0||V[V.length-1]!==U)&&V.push(U),V),[]),N=0;switch(y.position){case 1:N=0;break;case 2:N=c;break;case 4:N=c*2;break;default:break}let O=y.position===7?c*3:c;for(let V=0;V<T.length;V++){e.fillStyle=w;let G=(T[V]-1)*k;e.fillRect(N,u+G,O,k)}if(y.includeOutput){e.fillStyle=w;let V=g.layoutInfo.editorHeight/n*r*o,U=l.lineHeight/n*r*o;e.fillRect(c,u+V,c,U)}}),u+=b}let p=s.getOverviewRulerDecorations();for(let h=0;h<p.length;h++){let g=p[h];if(!g.options.overviewRuler)continue;let f=this.notebookEditor.getViewZoneLayoutInfo(g.viewZoneId);if(!f)continue;let v=this.getColor(g.options.overviewRuler.color)??"#000000",b=0;switch(g.options.overviewRuler.position){case 1:b=0;break;case 2:b=c;break;case 4:b=c*2;break;default:break}let S=g.options.overviewRuler.position===7?c*3:c;e.fillStyle=v;let y=f.height/n*r*o,w=f.top/n*r*o;e.fillRect(b,w,S,y)}}}};HRe=I([m(2,De)],HRe);var URe=class extends C{constructor(e,t,o,n,r){super();this.notebookEditor=e;this.notebookOptions=t;this.instantiationService=o;this.contextMenuService=n;this.menuService=r;this.viewZone=this._register(new me);this._modelDisposables=this._register(new P);this.topCellToolbarContainer=_("div"),this.topCellToolbar=_(".cell-list-top-cell-toolbar-container"),this.topCellToolbarContainer.appendChild(this.topCellToolbar),this._register(this.notebookEditor.onDidAttachViewModel(()=>{this.updateTopToolbar()})),this._register(this.notebookOptions.onDidChangeOptions(s=>{(s.insertToolbarAlignment||s.insertToolbarPosition||s.cellToolbarLocation)&&this.updateTopToolbar()}))}updateTopToolbar(){let e=this.notebookOptions.getLayoutConfiguration();if(this.viewZone.value=new P,e.insertToolbarPosition==="hidden"||e.insertToolbarPosition==="notebookToolbar"){let t=this.notebookOptions.computeTopInsertToolbarHeight(this.notebookEditor.textModel?.viewType);t!==0&&this.notebookEditor.changeViewZones(o=>{let n=o.addZone({afterModelPosition:0,heightInPx:t,domNode:_("div")});o.layoutZone(n),this.viewZone.value?.add({dispose:()=>{this.notebookEditor.isDisposed||this.notebookEditor.changeViewZones(r=>{r.removeZone(n)})}})});return}this.notebookEditor.changeViewZones(t=>{let o=this.notebookOptions.computeTopInsertToolbarHeight(this.notebookEditor.textModel?.viewType),n=t.addZone({afterModelPosition:0,heightInPx:o,domNode:this.topCellToolbarContainer});t.layoutZone(n),this.viewZone.value?.add({dispose:()=>{this.notebookEditor.isDisposed||this.notebookEditor.changeViewZones(s=>{s.removeZone(n)})}}),Rt(this.topCellToolbar);let r=this.instantiationService.createInstance(Ln,this.topCellToolbar,this.notebookEditor.creationOptions.menuIds.cellTopInsertToolbar,{actionViewItemProvider:(s,l)=>{if(s instanceof Eo)return this.instantiationService.createInstance(VR,s,{hoverDelegate:l.hoverDelegate})},menuOptions:{shouldForwardArgs:!0},toolbarOptions:{primaryGroup:s=>/^inline/.test(s)},hiddenItemStrategy:0});this.notebookEditor.hasModel()&&(r.context={notebookEditor:this.notebookEditor}),this.viewZone.value?.add(r),this.viewZone.value?.add(this.notebookEditor.onDidChangeModel(()=>{this._modelDisposables.clear(),this.notebookEditor.hasModel()&&(this._modelDisposables.add(this.notebookEditor.onDidChangeViewCells(()=>{this.updateClass()})),this.updateClass())})),this.updateClass()})}updateClass(){this.notebookEditor.hasModel()&&this.notebookEditor.getLength()===0?this.topCellToolbar.classList.add("emptyNotebook"):this.topCellToolbar.classList.remove("emptyNotebook")}};URe=I([m(2,F),m(3,ze),m(4,qt)],URe);var gco=18,hwi=4,fco=Object.freeze({codeCellLeftMargin:28,cellRunGutter:32,markdownCellTopMargin:8,markdownCellBottomMargin:8,markdownCellLeftMargin:0,markdownCellGutter:32,focusIndicatorLeftMargin:4}),vco=Object.freeze({codeCellLeftMargin:8,cellRunGutter:36,markdownCellTopMargin:6,markdownCellBottomMargin:6,markdownCellLeftMargin:8,markdownCellGutter:36,focusIndicatorLeftMargin:4}),nT=class extends C{constructor(e,t,o,n,r,s){super();this.targetWindow=e;this.isReadonly=t;this.overrides=o;this.configurationService=n;this.notebookExecutionStateService=r;this.codeEditorService=s;this._onDidChangeOptions=this._register(new E);this.onDidChangeOptions=this._onDidChangeOptions.event;this._editorTopPadding=12;this.previousModelToCompare=Le("previousModelToCompare",void 0);let l=this.configurationService.getValue(ft.showCellStatusBar),c=o?.globalToolbar??this.configurationService.getValue(ft.globalToolbar)??!0,u=o?.stickyScrollEnabled??this.configurationService.getValue(ft.stickyScrollEnabled)??!1,p=this._computeStickyScrollModeOption(),h=this.configurationService.getValue(ft.consolidatedOutputButton)??!0,g=this.configurationService.getValue(ft.consolidatedRunButton)??!1,f=o?.dragAndDropEnabled??this.configurationService.getValue(ft.dragAndDropEnabled)??!0,v=this.configurationService.getValue(ft.cellToolbarLocation)??{default:"right"},b=o?.cellToolbarInteraction??this.configurationService.getValue(ft.cellToolbarVisibility),S=this.configurationService.getValue(ft.compactView)??!0,y=this._computeFocusIndicatorOption(),w=this._computeInsertToolbarPositionOption(this.isReadonly),k=this._computeInsertToolbarAlignmentOption(),T=this._computeShowFoldingControlsOption(),N=this.configurationService.getValue("editor.fontSize"),O=this.configurationService.getValue(ft.markupFontSize),V=this.configurationService.getValue(ft.markdownLineHeight),U=this.configurationService.getValue(ft.cellEditorOptionsCustomizations)??{};U=yi(U)?U:{};let G=this.configurationService.getValue(ft.interactiveWindowCollapseCodeCells),$,te=this.configurationService.getValue(ft.outputLineHeightDeprecated);te!==void 0?(this._migrateDeprecatedSetting(ft.outputLineHeightDeprecated,ft.outputLineHeight),$=te):$=this.configurationService.getValue(ft.outputLineHeight);let pe,de=this.configurationService.getValue(ft.outputFontSizeDeprecated);de!==void 0?(this._migrateDeprecatedSetting(ft.outputFontSizeDeprecated,ft.outputFontSize),pe=de):pe=this.configurationService.getValue(ft.outputFontSize)||N;let se,Se=this.configurationService.getValue(ft.outputFontFamilyDeprecated);Se!==void 0?(this._migrateDeprecatedSetting(ft.outputFontFamilyDeprecated,ft.outputFontFamily),se=Se):se=this.configurationService.getValue(ft.outputFontFamily);let ke,Ee=this.configurationService.getValue(ft.outputScrollingDeprecated);Ee!==void 0?(this._migrateDeprecatedSetting(ft.outputScrollingDeprecated,ft.outputScrolling),ke=Ee):ke=this.configurationService.getValue(ft.outputScrolling);let He=this._computeOutputLineHeight($,pe),Ve=this.configurationService.getValue(ft.outputWordWrap),Fe=this.configurationService.getValue(ft.textOutputLineLimit)??30,Qt=this.configurationService.getValue(ft.LinkifyOutputFilePaths)??!0,Ze=this.configurationService.getValue(ft.minimalErrorRendering),Ti=this.configurationService.getValue(ft.markupFontFamily),ti=this._computeEditorTopPadding();this._layoutConfiguration={...S?vco:fco,cellTopMargin:6,cellBottomMargin:6,cellRightMargin:16,cellStatusBarHeight:22,cellOutputPadding:8,markdownPreviewPadding:8,editorToolbarHeight:0,editorTopPadding:ti,editorBottomPadding:4,editorBottomPaddingWithoutStatusBar:12,collapsedIndicatorHeight:28,showCellStatusBar:l,globalToolbar:c,stickyScrollEnabled:u,stickyScrollMode:p,consolidatedOutputButton:h,consolidatedRunButton:g,dragAndDropEnabled:f,cellToolbarLocation:v,cellToolbarInteraction:b,compactView:S,focusIndicator:y,insertToolbarPosition:w,insertToolbarAlignment:k,showFoldingControls:T,fontSize:N,outputFontSize:pe,outputFontFamily:se,outputLineHeight:He,markupFontSize:O,markdownLineHeight:V,editorOptionsCustomizations:U,focusIndicatorGap:3,interactiveWindowCollapseCodeCells:G,markdownFoldHintHeight:22,outputScrolling:ke,outputWordWrap:Ve,outputLineLimit:Fe,outputLinkifyFilePaths:Qt,outputMinimalError:Ze,markupFontFamily:Ti,disableRulers:o?.disableRulers},this._register(this.configurationService.onDidChangeConfiguration(bo=>{this._updateConfiguration(bo)}))}updateOptions(e){this.isReadonly!==e&&(this.isReadonly=e,this._updateConfiguration({affectsConfiguration(t){return t===ft.insertToolbarLocation},source:7,affectedKeys:new Set([ft.insertToolbarLocation]),change:{keys:[ft.insertToolbarLocation],overrides:[]}}))}_computeEditorTopPadding(){let e=!1,t=r=>{this._editorTopPadding=r;let s=Object.assign({},this._layoutConfiguration);s.editorTopPadding=this._editorTopPadding,this._layoutConfiguration=s,this._onDidChangeOptions.fire({editorTopPadding:!0})},o=new Set,n=r=>{if(!e&&!o.has(r))try{let s=this.codeEditorService.resolveDecorationOptions(r,!0);if(s.afterContentClassName||s.beforeContentClassName){let l=this.codeEditorService.resolveDecorationCSSRules(r);if(l!==null){for(let c=0;c<l.length;c++)if((l[c].selectorText.endsWith("::after")||l[c].selectorText.endsWith("::after"))&&l[c].cssText.indexOf("top:")>-1){let u=this.configurationService.getValue("editor");t(LS(u,Xd.getInstance(this.targetWindow).value).lineHeight+2),e=!0;break}}}o.add(r)}catch{}};return this._register(this.codeEditorService.onDecorationTypeRegistered(n)),this.codeEditorService.listDecorationTypes().forEach(n),this._editorTopPadding}_migrateDeprecatedSetting(e,t){let o=this.configurationService.inspect(e);o.application!==void 0&&(this.configurationService.updateValue(e,void 0,1),this.configurationService.updateValue(t,o.application.value,1)),o.user!==void 0&&(this.configurationService.updateValue(e,void 0,2),this.configurationService.updateValue(t,o.user.value,2)),o.userLocal!==void 0&&(this.configurationService.updateValue(e,void 0,3),this.configurationService.updateValue(t,o.userLocal.value,3)),o.userRemote!==void 0&&(this.configurationService.updateValue(e,void 0,4),this.configurationService.updateValue(t,o.userRemote.value,4)),o.workspace!==void 0&&(this.configurationService.updateValue(e,void 0,5),this.configurationService.updateValue(t,o.workspace.value,5)),o.workspaceFolder!==void 0&&(this.configurationService.updateValue(e,void 0,6),this.configurationService.updateValue(t,o.workspaceFolder.value,6))}_computeOutputLineHeight(e,t){if(e===0){let n=this.configurationService.getValue("editor");e=Fy.readFontInfo(this.targetWindow,LS(n,Xd.getInstance(this.targetWindow).value)).lineHeight}else if(e<9){let n=t;n===0&&(n=this.configurationService.getValue("editor.fontSize")),e=e*n}return e=Math.round(e),e<9&&(e=9),e}_updateConfiguration(e){let t=e.affectsConfiguration(ft.showCellStatusBar),o=e.affectsConfiguration(ft.cellToolbarLocation),n=e.affectsConfiguration(ft.cellToolbarVisibility),r=e.affectsConfiguration(ft.compactView),s=e.affectsConfiguration(ft.focusIndicator),l=e.affectsConfiguration(ft.insertToolbarLocation),c=e.affectsConfiguration(ft.experimentalInsertToolbarAlignment),u=e.affectsConfiguration(ft.globalToolbar),p=e.affectsConfiguration(ft.stickyScrollEnabled),h=e.affectsConfiguration(ft.stickyScrollMode),g=e.affectsConfiguration(ft.consolidatedOutputButton),f=e.affectsConfiguration(ft.consolidatedRunButton),v=e.affectsConfiguration(ft.showFoldingControls),b=e.affectsConfiguration(ft.dragAndDropEnabled),S=e.affectsConfiguration("editor.fontSize"),y=e.affectsConfiguration(ft.outputFontSize),w=e.affectsConfiguration(ft.markupFontSize),k=e.affectsConfiguration(ft.markdownLineHeight),T=e.affectsConfiguration("editor.fontFamily"),N=e.affectsConfiguration(ft.outputFontFamily),O=e.affectsConfiguration(ft.cellEditorOptionsCustomizations),V=e.affectsConfiguration(ft.interactiveWindowCollapseCodeCells),U=e.affectsConfiguration(ft.outputLineHeight),G=e.affectsConfiguration(ft.outputScrolling),$=e.affectsConfiguration(ft.outputWordWrap),te=e.affectsConfiguration(ft.LinkifyOutputFilePaths),pe=e.affectsConfiguration(ft.minimalErrorRendering),de=e.affectsConfiguration(ft.markupFontFamily);if(!t&&!o&&!n&&!r&&!s&&!l&&!c&&!u&&!p&&!h&&!g&&!f&&!v&&!b&&!S&&!y&&!w&&!k&&!T&&!N&&!O&&!V&&!U&&!G&&!$&&!te&&!pe&&!de)return;let se=Object.assign({},this._layoutConfiguration);if(t&&(se.showCellStatusBar=this.configurationService.getValue(ft.showCellStatusBar)),o&&(se.cellToolbarLocation=this.configurationService.getValue(ft.cellToolbarLocation)??{default:"right"}),n&&!this.overrides?.cellToolbarInteraction&&(se.cellToolbarInteraction=this.configurationService.getValue(ft.cellToolbarVisibility)),s&&(se.focusIndicator=this._computeFocusIndicatorOption()),r){let Se=this.configurationService.getValue(ft.compactView)??!0;se=Object.assign(se,{...Se?vco:fco}),se.compactView=Se}if(c&&(se.insertToolbarAlignment=this._computeInsertToolbarAlignmentOption()),l&&(se.insertToolbarPosition=this._computeInsertToolbarPositionOption(this.isReadonly)),u&&this.overrides?.globalToolbar===void 0&&(se.globalToolbar=this.configurationService.getValue(ft.globalToolbar)??!0),p&&this.overrides?.stickyScrollEnabled===void 0&&(se.stickyScrollEnabled=this.configurationService.getValue(ft.stickyScrollEnabled)??!1),h&&(se.stickyScrollMode=this.configurationService.getValue(ft.stickyScrollMode)??"flat"),g&&(se.consolidatedOutputButton=this.configurationService.getValue(ft.consolidatedOutputButton)??!0),f&&(se.consolidatedRunButton=this.configurationService.getValue(ft.consolidatedRunButton)??!0),v&&(se.showFoldingControls=this._computeShowFoldingControlsOption()),b&&(se.dragAndDropEnabled=this.configurationService.getValue(ft.dragAndDropEnabled)??!0),S&&(se.fontSize=this.configurationService.getValue("editor.fontSize")),(y||S)&&(se.outputFontSize=this.configurationService.getValue(ft.outputFontSize)||se.fontSize),w&&(se.markupFontSize=this.configurationService.getValue(ft.markupFontSize)),k&&(se.markdownLineHeight=this.configurationService.getValue(ft.markdownLineHeight)),N&&(se.outputFontFamily=this.configurationService.getValue(ft.outputFontFamily)),O&&(se.editorOptionsCustomizations=this.configurationService.getValue(ft.cellEditorOptionsCustomizations)),V&&(se.interactiveWindowCollapseCodeCells=this.configurationService.getValue(ft.interactiveWindowCollapseCodeCells)),U||S||y){let Se=this.configurationService.getValue(ft.outputLineHeight);se.outputLineHeight=this._computeOutputLineHeight(Se,se.outputFontSize)}$&&(se.outputWordWrap=this.configurationService.getValue(ft.outputWordWrap)),G&&(se.outputScrolling=this.configurationService.getValue(ft.outputScrolling)),te&&(se.outputLinkifyFilePaths=this.configurationService.getValue(ft.LinkifyOutputFilePaths)),pe&&(se.outputMinimalError=this.configurationService.getValue(ft.minimalErrorRendering)),de&&(se.markupFontFamily=this.configurationService.getValue(ft.markupFontFamily)),this._layoutConfiguration=Object.freeze(se),this._onDidChangeOptions.fire({cellStatusBarVisibility:t,cellToolbarLocation:o,cellToolbarInteraction:n,compactView:r,focusIndicator:s,insertToolbarPosition:l,insertToolbarAlignment:c,globalToolbar:u,stickyScrollEnabled:p,stickyScrollMode:h,showFoldingControls:v,consolidatedOutputButton:g,consolidatedRunButton:f,dragAndDropEnabled:b,fontSize:S,outputFontSize:y,markupFontSize:w,markdownLineHeight:k,fontFamily:T,outputFontFamily:N,editorOptionsCustomizations:O,interactiveWindowCollapseCodeCells:V,outputLineHeight:U,outputScrolling:G,outputWordWrap:$,outputLinkifyFilePaths:te,minimalError:pe,markupFontFamily:de})}_computeInsertToolbarPositionOption(e){return e?"hidden":this.configurationService.getValue(ft.insertToolbarLocation)??"both"}_computeInsertToolbarAlignmentOption(){return this.configurationService.getValue(ft.experimentalInsertToolbarAlignment)??"center"}_computeShowFoldingControlsOption(){return this.configurationService.getValue(ft.showFoldingControls)??"mouseover"}_computeFocusIndicatorOption(){return this.configurationService.getValue(ft.focusIndicator)??"gutter"}_computeStickyScrollModeOption(){return this.configurationService.getValue(ft.stickyScrollMode)??"flat"}getCellCollapseDefault(){return this._layoutConfiguration.interactiveWindowCollapseCodeCells==="never"?{codeCell:{inputCollapsed:!1}}:{codeCell:{inputCollapsed:!0}}}getLayoutConfiguration(){return this._layoutConfiguration}getDisplayOptions(){return this._layoutConfiguration}getCellEditorContainerLeftMargin(){let{codeCellLeftMargin:e,cellRunGutter:t}=this._layoutConfiguration;return e+t}computeCollapsedMarkdownCellHeight(e){let{bottomToolbarGap:t}=this.computeBottomToolbarDimensions(e);return this._layoutConfiguration.markdownCellTopMargin+this._layoutConfiguration.collapsedIndicatorHeight+t+this._layoutConfiguration.markdownCellBottomMargin}computeBottomToolbarOffset(e,t){let{bottomToolbarGap:o,bottomToolbarHeight:n}=this.computeBottomToolbarDimensions(t);return e-o-n/2}computeCodeCellEditorWidth(e){return e-(this._layoutConfiguration.codeCellLeftMargin+this._layoutConfiguration.cellRunGutter+this._layoutConfiguration.cellRightMargin)}computeMarkdownCellEditorWidth(e){return e-this._layoutConfiguration.markdownCellGutter-this._layoutConfiguration.markdownCellLeftMargin-this._layoutConfiguration.cellRightMargin}computeStatusBarHeight(){return this._layoutConfiguration.cellStatusBarHeight}_computeBottomToolbarDimensions(e,t,o,n){return o==="left"||n!=="hidden"?{bottomToolbarGap:18,bottomToolbarHeight:18}:t==="betweenCells"||t==="both"?e?{bottomToolbarGap:12,bottomToolbarHeight:20}:{bottomToolbarGap:20,bottomToolbarHeight:20}:{bottomToolbarGap:0,bottomToolbarHeight:0}}computeBottomToolbarDimensions(e){let t=this._layoutConfiguration,o=this.computeCellToolbarLocation(e),{bottomToolbarGap:n,bottomToolbarHeight:r}=this._computeBottomToolbarDimensions(t.compactView,t.insertToolbarPosition,t.insertToolbarAlignment,o);return{bottomToolbarGap:n,bottomToolbarHeight:r}}computeCellToolbarLocation(e){let t=this._layoutConfiguration.cellToolbarLocation;if(typeof t=="string"){if(t==="left"||t==="right"||t==="hidden")return t}else if(e){let o=t[e]??t.default,n="right";switch(o){case"left":n="left";break;case"right":n="right";break;case"hidden":n="hidden";break;default:n="right";break}return n}return"right"}computeTopInsertToolbarHeight(e){if(this._layoutConfiguration.insertToolbarPosition==="betweenCells"||this._layoutConfiguration.insertToolbarPosition==="both")return gco;let t=this.computeCellToolbarLocation(e);return t==="left"||t==="right"?gco:0}computeEditorPadding(e,t){return{top:this._editorTopPadding,bottom:this.statusBarIsVisible(e,t)?this._layoutConfiguration.editorBottomPadding:this._layoutConfiguration.editorBottomPaddingWithoutStatusBar}}computeEditorStatusbarHeight(e,t){return this.statusBarIsVisible(e,t)?this.computeStatusBarHeight():0}statusBarIsVisible(e,t){let o=this.notebookExecutionStateService.getCellExecution(t);return this._layoutConfiguration.showCellStatusBar==="visible"?!0:this._layoutConfiguration.showCellStatusBar==="visibleAfterExecute"?typeof e.lastRunSuccess=="boolean"||o!==void 0:!1}computeWebviewOptions(){return{outputNodePadding:this._layoutConfiguration.cellOutputPadding,outputNodeLeftPadding:this._layoutConfiguration.cellOutputPadding,previewNodePadding:this._layoutConfiguration.markdownPreviewPadding,markdownLeftMargin:this._layoutConfiguration.markdownCellGutter+this._layoutConfiguration.markdownCellLeftMargin,leftMargin:this._layoutConfiguration.codeCellLeftMargin,rightMargin:this._layoutConfiguration.cellRightMargin,runGutter:this._layoutConfiguration.cellRunGutter,dragAndDropEnabled:this._layoutConfiguration.dragAndDropEnabled,fontSize:this._layoutConfiguration.fontSize,outputFontSize:this._layoutConfiguration.outputFontSize,outputFontFamily:this._layoutConfiguration.outputFontFamily,markupFontSize:this._layoutConfiguration.markupFontSize,markdownLineHeight:this._layoutConfiguration.markdownLineHeight,outputLineHeight:this._layoutConfiguration.outputLineHeight,outputScrolling:this._layoutConfiguration.outputScrolling,outputWordWrap:this._layoutConfiguration.outputWordWrap,outputLineLimit:this._layoutConfiguration.outputLineLimit,outputLinkifyFilePaths:this._layoutConfiguration.outputLinkifyFilePaths,minimalError:this._layoutConfiguration.outputMinimalError,markupFontFamily:this._layoutConfiguration.markupFontFamily}}computeDiffWebviewOptions(){return{outputNodePadding:this._layoutConfiguration.cellOutputPadding,outputNodeLeftPadding:0,previewNodePadding:this._layoutConfiguration.markdownPreviewPadding,markdownLeftMargin:0,leftMargin:32,rightMargin:0,runGutter:0,dragAndDropEnabled:!1,fontSize:this._layoutConfiguration.fontSize,outputFontSize:this._layoutConfiguration.outputFontSize,outputFontFamily:this._layoutConfiguration.outputFontFamily,markupFontSize:this._layoutConfiguration.markupFontSize,markdownLineHeight:this._layoutConfiguration.markdownLineHeight,outputLineHeight:this._layoutConfiguration.outputLineHeight,outputScrolling:this._layoutConfiguration.outputScrolling,outputWordWrap:this._layoutConfiguration.outputWordWrap,outputLineLimit:this._layoutConfiguration.outputLineLimit,outputLinkifyFilePaths:!1,minimalError:!1,markupFontFamily:this._layoutConfiguration.markupFontFamily}}computeIndicatorPosition(e,t,o){let{bottomToolbarGap:n}=this.computeBottomToolbarDimensions(o);return{bottomIndicatorTop:e-n-this._layoutConfiguration.cellBottomMargin-t,verticalIndicatorHeight:e-n-t}}};nT=I([m(3,B),m(4,rs),m(5,Kt)],nT);var hVt=class a extends C{constructor(e,t,o,n){super();this.notebookEditor=e;this.notebookOptions=t;this.configurationService=o;this.language=n;this._localDisposableStore=this._register(new P);this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._register(o.onDidChangeConfiguration(r=>{(r.affectsConfiguration("editor")||r.affectsConfiguration("notebook"))&&this._recomputeOptions()})),this._register(t.onDidChangeOptions(r=>{(r.cellStatusBarVisibility||r.editorTopPadding||r.editorOptionsCustomizations)&&this._recomputeOptions()})),this._register(this.notebookEditor.onDidChangeModel(()=>{this._localDisposableStore.clear(),this.notebookEditor.hasModel()&&(this._localDisposableStore.add(this.notebookEditor.onDidChangeOptions(()=>{this._recomputeOptions()})),this._recomputeOptions())})),this.notebookEditor.hasModel()&&this._localDisposableStore.add(this.notebookEditor.onDidChangeOptions(()=>{this._recomputeOptions()})),this._value=this._computeEditorOptions()}static{this.fixedEditorOptions={scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:14,horizontal:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,alwaysConsumeMouseWheel:!1},renderLineHighlightOnlyWhenFocus:!0,overviewRulerLanes:0,lineDecorationsWidth:0,folding:!0,fixedOverflowWidgets:!0,minimap:{enabled:!1},renderValidationDecorations:"on",lineNumbersMinChars:3}}get value(){return this._value}_recomputeOptions(){this._value=this._computeEditorOptions(),this._onDidChange.fire()}_computeEditorOptions(){let e=Xi(this.configurationService.getValue("editor",{overrideIdentifier:this.language})),t=this.notebookOptions.getDisplayOptions().editorOptionsCustomizations,o={};if(t)for(let r in t)r.indexOf("editor.")===0&&(o[r.substring(7)]=t[r]);return Object.freeze({...e,...a.fixedEditorOptions,...o,padding:{top:12,bottom:12},readOnly:this.notebookEditor.isReadOnly})}};var Xpe=class{constructor(i,e,t,o,n,r,s,l){this.index=i;this.level=e;this.cell=t;this.label=o;this.isExecuting=n;this.isPaused=r;this.range=s;this.symbolKind=l;this._children=[]}get icon(){return this.symbolKind?sh.toIcon(this.symbolKind):this.isExecuting&&this.isPaused?Sw:this.isExecuting?q.modify(Sw,"spin"):this.cell.cellKind===1?M.markdown:M.code}addChild(i){this._children.push(i),i._parent=this}get parent(){return this._parent}get children(){return this._children}get markerInfo(){return this._markerInfo}get position(){if(this.range)return{startLineNumber:this.range.startLineNumber,startColumn:this.range.startColumn}}updateMarkers(i){if(this.cell.cellKind===2){let e=i.read({resource:this.cell.uri,severities:12});if(e.length===0)this._markerInfo=void 0;else{let t=e.find(o=>o.severity===8)?.severity??4;this._markerInfo={topSev:t,count:e.length}}}else{let e;for(let t of this.children)t.updateMarkers(i),t.markerInfo&&(e=e?Math.max(t.markerInfo.topSev,e):t.markerInfo.topSev);this._markerInfo=e&&{topSev:e,count:0}}}clearMarkers(){this._markerInfo=void 0;for(let i of this.children)i.clearMarkers()}find(i,e){if(i.id===this.cell.id)return this;e.push(this);for(let t of this.children){let o=t.find(i,e);if(o)return o}e.pop()}asFlatList(i){i.push(this);for(let e of this.children)e.asFlatList(i)}};function N8o(a){let i=Array.from(awi(a));if(i.length)return i;let e=a.match(/<h([1-6]).*>(.*)<\/h\1>/i);if(e){let t=parseInt(e[1]),o=e[2].trim();i.push({depth:t,text:o})}return i}var gVt=ae("INotebookOutlineEntryFactory"),zRe=class{constructor(i,e,t){this.executionStateService=i;this.outlineModelService=e;this.textModelService=t;this.cellOutlineEntryCache={};this.cachedMarkdownOutlineEntries=new WeakMap}getOutlineEntries(i,e){let t=[],o=i.cellKind===1,n=O8o(i),r=!1;if(o){let s=i.getText().substring(0,1e4),l=this.cachedMarkdownOutlineEntries.get(i),c=l?.alternativeId===i.getAlternativeId()?l.headers:Array.from(N8o(s));this.cachedMarkdownOutlineEntries.set(i,{alternativeId:i.getAlternativeId(),headers:c});for(let{depth:u,text:p}of c)r=!0,t.push(new Xpe(e++,u,i,p,!1,!1));r||(n=qa({value:n}))}if(!r){let s=!o&&this.executionStateService.getCellExecution(i.uri),l=n.trim();if(!o){let c=this.cellOutlineEntryCache[i.id];c&&(t.push(new Xpe(e++,7,i,l,!!s,s?s.isPaused:!1)),c.forEach(u=>{t.push(new Xpe(e++,u.level,i,u.name,!1,!1,u.range,u.kind))}))}t.length===0&&(l.length===0&&(l=d(12129,null)),t.push(new Xpe(e++,7,i,l,!!s,s?s.isPaused:!1)))}return t}async cacheSymbols(i,e){if(i.cellKind===1)return;let t=await this.textModelService.createModelReference(i.uri);try{let o=t.object.textEditorModel,n=await this.outlineModelService.getOrCreate(o,e),r=bco(n.getTopLevelSymbols(),8);this.cellOutlineEntryCache[i.id]=r}finally{t.dispose()}}};zRe=I([m(0,rs),m(1,f_),m(2,Nt)],zRe);function bco(a,i){let e=[];return a.forEach(t=>{e.push({name:t.name,range:t.range,level:i,kind:t.kind}),t.children&&e.push(...bco(t.children,i+1))}),e}function O8o(a){let i=a.textBuffer;for(let e=0;e<i.getLineCount();e++){let t=i.getLineFirstNonWhitespaceColumn(e+1),o=i.getLineLength(e+1);if(t<o)return i.getLineContent(e+1)}return a.getText().substring(0,100)}var KRe=class{constructor(i,e,t,o){this._editor=i;this._markerService=e;this._configurationService=t;this._outlineEntryFactory=o;this._disposables=new P;this._onDidChange=new E;this.onDidChange=this._onDidChange.event;this._entries=[];this.recomputeState()}get activeElement(){return this._activeEntry}get entries(){return this._entries}get isEmpty(){return this._entries.length===0}get uri(){return this._uri}async computeFullSymbols(i){try{let t=this._editor?.getViewModel()?.viewCells.filter(o=>o.cellKind===2);if(t){let o=[];for(let n of t.slice(0,50))o.push(this._outlineEntryFactory.cacheSymbols(n,i));await Promise.allSettled(o)}this.recomputeState()}catch(e){console.error("Failed to compute notebook outline symbols:",e),this.recomputeState()}}recomputeState(){if(this._disposables.clear(),this._activeEntry=void 0,this._uri=void 0,!this._editor.hasModel())return;this._uri=this._editor.textModel.uri;let i=this._editor;if(i.getLength()===0)return;let e=i.getViewModel().viewCells,t=[];for(let s of e)t.push(...this._outlineEntryFactory.getOutlineEntries(s,t.length));if(t.length>0){let s=[t[0]],l=[t[0]];for(let c=1;c<t.length;c++){let u=t[c];for(;;){let p=l.length;if(p===0){s.push(u),l.push(u);break}else{let h=l[p-1];if(h.level<u.level){h.addChild(u),l.push(u);break}else l.pop()}}}this._entries=s}let o=new me;this._disposables.add(o);let n=()=>{if(i.isDisposed)return;let s=u=>{for(let p of this._entries)u?p.clearMarkers():p.updateMarkers(this._markerService)},l=this._configurationService.getValue("problems.visibility");if(l===void 0)return;let c=this._configurationService.getValue("outline.problems.enabled");l&&c?(o.value=this._markerService.onMarkerChanged(u=>{if(i.isDisposed){console.error("notebook editor is disposed");return}u.some(p=>i.getCellsInRange().some(h=>Xe(h.uri,p)))&&(s(!1),this._onDidChange.fire({}))}),s(!1)):(o.clear(),s(!0))};n(),this._disposables.add(this._configurationService.onDidChangeConfiguration(s=>{(s.affectsConfiguration("problems.visibility")||s.affectsConfiguration("outline.problems.enabled"))&&(n(),this._onDidChange.fire({}))}));let{changeEventTriggered:r}=this.recomputeActive();r||this._onDidChange.fire({})}recomputeActive(){let i,e=this._editor;if(e&&e.hasModel()&&e.getLength()>0){let t=e.cellAt(e.getFocus().start);if(t){for(let o of this._entries)if(i=o.find(t,[]),i)break}}return i!==this._activeEntry?(this._activeEntry=i,this._onDidChange.fire({affectOnlyActiveElement:!0}),{changeEventTriggered:!0}):{changeEventTriggered:!1}}dispose(){this._entries.length=0,this._activeEntry=void 0,this._disposables.dispose(),this._onDidChange.dispose()}};KRe=I([m(1,Ns),m(2,B),m(3,gVt)],KRe);var yZe=class extends Ww{constructor(e){super();this.instantiationService=e}createReferencedObject(e,t){return this.instantiationService.createInstance(KRe,t)}destroyReferencedObject(e,t){t.dispose()}};yZe=I([m(0,F)],yZe);var $Re=ae("INotebookCellOutlineDataSourceFactory"),GRe=class{constructor(i){this._data=i.createInstance(yZe)}getOrCreate(i){return this._data.acquire(i.getId(),i)}};GRe=I([m(0,F)],GRe);var vVt=class a extends C{constructor(e,t,o,n,r){super();this.element=e;this.foldingIcon=t;this.header=o;this.entry=n;this.notebookEditor=r;this._register(j(this.header,re.CLICK||Gn.Tap,()=>{this.focusCell()})),this._register(j(this.foldingIcon.domNode,re.CLICK||Gn.Tap,()=>{if(this.entry.cell.cellKind===1){let s=this.entry.cell.foldingState;this.toggleFoldRange(s)}}))}toggleFoldRange(e){let t=this.notebookEditor.getContribution(BR.id),o=this.entry.index,n=this.entry.level,r=e===2?1:2;t.setFoldingStateDown(o,r,n),this.focusCell()}focusCell(){this.notebookEditor.focusNotebookCell(this.entry.cell,"container");let e=this.notebookEditor.getAbsoluteTopOfElement(this.entry.cell),t=a.getParentCount(this.entry);this.notebookEditor.setScrollTop(e-(t+1.1)*22)}static getParentCount(e){let t=0;for(;e.parent;)t++,e=e.parent;return t}},gwi=class{constructor(i,e){this.isCollapsed=i;this.dimension=e;this.domNode=document.createElement("div"),this.domNode.style.width=`${e}px`,this.domNode.style.height=`${e}px`,this.domNode.className=q.asClassName(i?ule:dle)}setVisible(i){this.domNode.style.cursor=i?"pointer":"default",this.domNode.style.opacity=i?"1":"0"}},hy=class extends C{constructor(e,t,o,n,r,s){super();this.domNode=e;this.notebookEditor=t;this.notebookCellList=o;this.layoutFn=n;this._contextMenuService=r;this.instantiationService=s;this._disposables=new P;this.currentStickyLines=new Map;this._onDidChangeNotebookStickyScroll=this._register(new E);this.onDidChangeNotebookStickyScroll=this._onDidChangeNotebookStickyScroll.event;this._layoutDisposableStore=this._register(new P);this.notebookEditor.notebookOptions.getDisplayOptions().stickyScrollEnabled&&this.init().catch(console.error),this._register(this.notebookEditor.notebookOptions.onDidChangeOptions(l=>{(l.stickyScrollEnabled||l.stickyScrollMode)&&this.updateConfig(l)})),this._register(j(this.domNode,re.CONTEXT_MENU,async l=>{this.onContextMenu(l)})),this._register(j(this.domNode,re.WHEEL,l=>{this.notebookCellList.triggerScrollFromMouseWheelEvent(l)}))}getDomNode(){return this.domNode}getCurrentStickyHeight(){let e=0;return this.currentStickyLines.forEach(t=>{t.rendered&&(e+=22)}),e}setCurrentStickyLines(e){this.currentStickyLines=e}compareStickyLineMaps(e,t){if(e.size!==t.size)return!1;for(let[o,n]of e){let r=t.get(o);if(!r||n.rendered!==r.rendered)return!1}return!0}onContextMenu(e){let t=new yn(Me(this.domNode),e),o=t.target.parentElement,n=Array.from(this.currentStickyLines.values()).find(s=>s.line.element.contains(o))?.line.entry;if(!n)return;let r={outlineEntry:n,notebookEditor:this.notebookEditor};this._contextMenuService.showContextMenu({menuId:D.NotebookStickyScrollContext,getAnchor:()=>t,menuActionOptions:{shouldForwardArgs:!0,arg:r,renderShortTitle:!0}})}updateConfig(e){e.stickyScrollEnabled?this.notebookEditor.notebookOptions.getDisplayOptions().stickyScrollEnabled?this.init().catch(console.error):(this._disposables.clear(),this.notebookCellOutlineReference?.dispose(),this.disposeCurrentStickyLines(),Rt(this.domNode),this.updateDisplay()):e.stickyScrollMode&&this.notebookEditor.notebookOptions.getDisplayOptions().stickyScrollEnabled&&this.notebookCellOutlineReference?.object&&this.updateContent(wZe(this.notebookEditor,this.notebookCellList,this.notebookCellOutlineReference?.object?.entries,this.getCurrentStickyHeight()))}async init(){let{object:e}=this.notebookCellOutlineReference=this.instantiationService.invokeFunction(o=>o.get($Re).getOrCreate(this.notebookEditor));this._register(this.notebookCellOutlineReference),await e.computeFullSymbols(ve.None);let t=wZe(this.notebookEditor,this.notebookCellList,e.entries,this.getCurrentStickyHeight());this.updateContent(t),this._disposables.add(e.onDidChange(()=>{let o=wZe(this.notebookEditor,this.notebookCellList,e.entries,this.getCurrentStickyHeight());this.compareStickyLineMaps(o,this.currentStickyLines)?this.disposeStickyLineMap(o):this.updateContent(o)})),this._disposables.add(this.notebookEditor.onDidAttachViewModel(async()=>{await e.computeFullSymbols(ve.None);let o=wZe(this.notebookEditor,this.notebookCellList,e.entries,this.getCurrentStickyHeight());this.updateContent(o)})),this._disposables.add(this.notebookEditor.onDidScroll(()=>{let o=new jo(100);o.trigger(()=>{o.dispose();let n=wZe(this.notebookEditor,this.notebookCellList,e.entries,this.getCurrentStickyHeight());this.compareStickyLineMaps(n,this.currentStickyLines)?this.disposeStickyLineMap(n):this.updateContent(n)})}))}disposeStickyLineMap(e){e.forEach(t=>{t.line&&t.line.dispose()})}static getVisibleOutlineEntry(e,t){let o=0,n=t.length-1;for(;o<=n;){let r=Math.floor((o+n)/2);if(t[r].index===e){let s=t[r],l=[];return s.asFlatList(l),l.find(c=>c.index===e)}else t[r].index<e?o=r+1:n=r-1}if(n>=0){let r=t[n],s=[];return r.asFlatList(s),s.find(l=>l.index===e)}}updateContent(e){Rt(this.domNode),this.disposeCurrentStickyLines(),this.renderStickyLines(e,this.domNode);let t=this.getCurrentStickyHeight();this.setCurrentStickyLines(e);let o=this.getCurrentStickyHeight()-t;if(o!==0){this._onDidChangeNotebookStickyScroll.fire(o);let n=this._layoutDisposableStore.add($r(Me(this.getDomNode()),()=>{this.layoutFn(o),this.updateDisplay(),this._layoutDisposableStore.delete(n)}))}else this.updateDisplay()}updateDisplay(){this.getCurrentStickyHeight()>0?this.domNode.style.display="block":this.domNode.style.display="none"}static computeStickyHeight(e){let t=0;for(e.cell.cellKind===1&&e.level<7&&(t+=22);e.parent;)t+=22,e=e.parent;return t}static checkCollapsedStickyLines(e,t,o){let n=e,r=new Map,s=[];for(;n;){if(n.level>=7){n=n.parent;continue}let l=hy.createStickyElement(n,o);r.set(n,{line:l,rendered:!1}),s.unshift(l),n=n.parent}for(let l=0;l<s.length&&!(l>=t);l++)r.set(s[l].entry,{line:s[l],rendered:!0});return r}renderStickyLines(e,t){let o=Array.from(e.entries()).reverse();for(let[,n]of o)n.rendered&&t.append(n.line.element)}static createStickyElement(e,t){let o=document.createElement("div");o.classList.add("notebook-sticky-scroll-element"),t.notebookOptions.getLayoutConfiguration().stickyScrollMode==="indented"&&(o.style.paddingLeft=vVt.getParentCount(e)*10+"px");let r=!1;e.cell.cellKind===1&&(r=e.cell.foldingState===2);let s=new gwi(r,16);s.domNode.classList.add("notebook-sticky-scroll-folding-icon"),s.setVisible(!0);let l=document.createElement("div");return l.classList.add("notebook-sticky-scroll-header"),l.innerText=e.label,o.append(s.domNode,l),new vVt(o,s,l,e,t)}disposeCurrentStickyLines(){this.currentStickyLines.forEach(e=>{e.line.dispose()})}dispose(){this._disposables.dispose(),this.disposeCurrentStickyLines(),this.notebookCellOutlineReference?.dispose(),super.dispose()}};hy=I([m(4,ze),m(5,F)],hy);function wZe(a,i,e,t){let o=a.scrollTop-t,n=a.visibleRanges[0];if(!n)return new Map;if(n.start===0){let h=a.cellAt(0),g=hy.getVisibleOutlineEntry(0,e);if(h&&g&&h.cellKind===1&&g.level<7&&a.scrollTop>22)return hy.checkCollapsedStickyLines(g,100,a)}let r,s,l=n.start-1;for(let h=l;h<n.end;h++){if(r=a.cellAt(h),!r)return new Map;if(s=hy.getVisibleOutlineEntry(h,e),!s)continue;let g=a.cellAt(h+1);if(!g){let v=a.getLayoutInfo().scrollHeight,b=Math.floor(v/22);return hy.checkCollapsedStickyLines(s,b,a)}let f=hy.getVisibleOutlineEntry(h+1,e);if(f&&g.cellKind===1&&f.level<7){let v=i.getCellViewScrollTop(g),b=hy.computeStickyHeight(s),S=hy.computeStickyHeight(f);if(o+b<v){let y=Math.floor((v-o)/22);return hy.checkCollapsedStickyLines(s,y,a)}else{if(S>=b)return hy.checkCollapsedStickyLines(f,100,a);if(S<b){let y=v-o;if(y>=S){let w=Math.floor(y/22);return hy.checkCollapsedStickyLines(s,w,a)}else return hy.checkCollapsedStickyLines(f,100,a)}}}}let c=a.getLayoutInfo().scrollHeight,u=Math.floor((c-o)/22);return hy.checkCollapsedStickyLines(s,u,a)}var bVt=class{constructor(){this.priority=105;this.name="webview-find";this.type="help";this.when=bz}getProvider(i){return new fwi}},fwi=class extends C{constructor(){super(...arguments);this.id="webviewFindHelp";this.verbositySettingKey="accessibility.verbosity.find";this.options={type:"help"}}onClose(){}provideContent(){let e=[];return e.push(d(15858,null)),e.push(d(15853,null)),e.push(""),e.push(d(15880,null)),e.push(d(15879,null)),e.push(""),e.push(d(15867,null)),e.push(d(15866,null)),e.push(""),e.push(d(15863,null)),e.push(d(15862,null)),e.push(d(15859,null)),e.push(d(15860,null)),e.push(d(15861,null)),e.push(""),e.push(d(15857,null)),e.push(d(15854,null)),e.push(d(15855,null)),e.push(d(15856,null)),e.push(""),e.push(d(15868,null)),e.push(""),e.push(d(15870,null)),e.push(d(15869,null)),e.push(d(15871,null)),e.push(""),e.push(d(15874,null)),e.push(d(15872,null)),e.push(d(15875,null)),e.push(d(15873,null)),e.push(""),e.push(d(15865,null)),e.push(d(15864,null)),e.push(""),e.push(d(15877,null,"<keybinding:workbench.action.openSettings>")),e.push(d(15876,null)),e.push(d(15878,null)),e.push(""),e.push(d(15852,null)),e.push(d(15851,null)),e.join(`
`)}};var F8o=100;function qRe(a,i){a?.addImplementation(F8o,"webview",e=>{let o=e.get(wm).activeWebview;if(o?.isFocused)return i(o),!0;if(Pn()?.classList.contains("action-menu-item")){let n=e.get(ee);if(n.activeEditor instanceof wu)return i(n.activeEditor.webview),!0}return!1})}qRe(BT,a=>a.undo());qRe(HT,a=>a.redo());qRe(ymt,a=>a.selectAll());qRe($M,a=>a.copy());qRe(GM,a=>a.paste());qRe(EW,a=>a.cut());var CZe="preventDefaultContextMenuItems";EW&&fe.appendMenuItem(D.WebviewContext,{command:{id:EW.id,title:d(15848,null)},group:"5_cutcopypaste",order:1,when:x.not(CZe)});$M&&fe.appendMenuItem(D.WebviewContext,{command:{id:$M.id,title:d(15847,null)},group:"5_cutcopypaste",order:2,when:x.not(CZe)});GM&&fe.appendMenuItem(D.WebviewContext,{command:{id:GM.id,title:d(15849,null)},group:"5_cutcopypaste",order:3,when:x.not(CZe)});xa.register(new bVt);var jRe=class extends C{constructor(e,t,o,n,r,s){super();this.viewModel=e;this.isReplHistory=t;this.notebookExecutionStateService=o;this.keybindingService=n;this.configurationService=r;this.accessibilityService=s;this._onDidAriaLabelChange=this._register(new E);this.onDidAriaLabelChange=this._onDidAriaLabelChange.event;this._register(H.debounce(this.notebookExecutionStateService.onDidChangeExecution,(l,c)=>this.mergeEvents(l,c),100)(l=>{if(!l.length)return;let c=this.viewModel();if(c){for(let p of l){let h=c.getCellByHandle(p.cellHandle);h&&this._onDidAriaLabelChange.fire(h)}let u=l[l.length-1];if(this.shouldReadCellOutputs(u.state)){let p=c.getCellByHandle(u.cellHandle);if(p&&p.outputsViewModels.length){let h=yRe(c.notebookDocument,p,!0);Jo(h)}}}},this))}shouldReadCellOutputs(e){return e===void 0&&this.isReplHistory&&this.accessibilityService.isScreenReaderOptimized()&&this.configurationService.getValue("accessibility.replEditor.readLastExecutionOutput")}get verbositySettingId(){return this.isReplHistory?"accessibility.verbosity.replEditor":"accessibility.verbosity.notebook"}getAriaLabel(e){let t=H.filter(this.onDidAriaLabelChange,o=>o===e);return ui(this,t,()=>{let o=this.viewModel();return o&&o.getCellIndex(e)>=0?this.getLabel(e):""})}createItemLabel(e,t){return this.isReplHistory?`cell${e}`:`${t===1?"markdown":"code"} cell${e}`}getLabel(e){let t=this.notebookExecutionStateService.getCellExecution(e.uri)?.state,o=t===3?", executing":t===2?", pending":"";return this.createItemLabel(o,e.cellKind)}get widgetAriaLabelName(){return this.isReplHistory?d(11993,null):d(11990,null)}getWidgetAriaLabel(){let e=this.keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getLabel();return this.configurationService.getValue(this.verbositySettingId)?e?d(11991,null,this.widgetAriaLabelName,e):d(11992,null,this.widgetAriaLabelName):this.widgetAriaLabelName}mergeEvents(e,t){let o=this.viewModel(),n=e||[];if(o&&t.type===0&&t.affectsNotebook(o.uri)){let r=n.findIndex(s=>s.cellHandle===t.cellHandle);r>=0&&n.splice(r,1),n.push({cellHandle:t.cellHandle,state:t.changed?.state})}return n}};jRe=I([m(2,rs),m(3,_e),m(4,B),m(5,Bi)],jRe);var SVt=class extends C{constructor(e,t){super();this._notebookEditor=e;this._listViewScrollablement=t;this._register(j(this._listViewScrollablement,re.MOUSE_WHEEL,o=>{let n=o.deltaX,r=o.deltaY,s=o.wheelDeltaX,l=o.wheelDeltaY,c=o.wheelDelta;if(!it&&o.shiftKey&&!n&&(n=r,r=0,s=l,l=0),n===0)return;let p=this._notebookEditor.codeEditors.find(f=>{let v=f[1].getLayoutInfo();if(v.contentWidth===v.width)return!1;let b=f[1].getDomNode();return!!(b&&b.contains(o.target))});if(!p)return;let h=Me(o),g={deltaMode:o.deltaMode,deltaX:n,deltaY:0,deltaZ:0,wheelDelta:c&&XH?c/h.devicePixelRatio:c,wheelDeltaX:s&&XH?s/h.devicePixelRatio:s,wheelDeltaY:0,detail:o.detail,shiftKey:o.shiftKey,type:o.type,defaultPrevented:!1,preventDefault:()=>{},stopPropagation:()=>{}};p[1].delegateScrollFromMouseWheelEvent(g)}))}};var QRe=class extends C{constructor(e,t,o,n,r){super();this.notebookEditor=e;this.contextKeyServiceProvider=t;this.textModelService=o;this._configurationService=n;this._instantiationService=r;this._editorDisposable=this._register(new me);this._isInitialized=!1;this._isDisposed=!1;this._focusedEditorDOM=this.notebookEditor.getDomNode().appendChild(_(".cell-editor-part-cache")),this._focusedEditorDOM.style.position="absolute",this._focusedEditorDOM.style.top="-50000px",this._focusedEditorDOM.style.width="1px",this._focusedEditorDOM.style.height="1px"}_initializeEditor(e){this._editorContextKeyService=this._register(this.contextKeyServiceProvider(this._focusedEditorDOM));let t=Sf(this._focusedEditorDOM,_(".cell-editor-container")),o=this._register(this._instantiationService.createChild(new Io([X,this._editorContextKeyService])));ue.inCompositeEditor.bindTo(this._editorContextKeyService).set(!0);let n=new $F(this.notebookEditor.getBaseCellEditorOptions(e.language),this.notebookEditor.notebookOptions,this._configurationService);this._editor=this._register(o.createInstance(jr,t,{...n.getDefaultValue(),dimension:{width:0,height:0},scrollbar:{vertical:"hidden",horizontal:"auto",handleMouseWheel:!1,useShadows:!1},allowVariableLineHeights:!1},{contributions:this.notebookEditor.creationOptions.cellEditorContributions})),n.dispose(),this._isInitialized=!0}preserveFocusedEditor(e){this._isInitialized||this._initializeEditor(e),this._editorDisposable.clear(),this._focusEditorCancellablePromise?.cancel(),this._focusEditorCancellablePromise=xn(async t=>{let o=await this.textModelService.createModelReference(e.uri);if(this._isDisposed||t.isCancellationRequested){o.dispose();return}let n=new P;n.add(o),this._editor.setModel(o.object.textEditorModel),this._editor.setSelections(e.getSelections()),this._editor.focus();let r=()=>{let s=this._editor.getSelections();s&&e.setSelections(s),this.notebookEditor.revealInView(e),this._editor.setModel(null),o.dispose()};n.add(this._editor.onDidChangeModelContent(s=>{r()})),n.add(this._editor.onDidChangeCursorSelection(s=>{(s.source==="keyboard"||s.source==="mouse")&&r()})),n.add(this.notebookEditor.onDidChangeActiveEditor(()=>{let s=this.notebookEditor.getActiveCell();(s!==e||s.focusMode!==1)&&(this._editorDisposable.clear(),this._editor.setModel(null),o.dispose())})),this._editorDisposable.value=n})}dispose(){this._isDisposed=!0,this._focusEditorCancellablePromise?.cancel(),super.dispose()}};QRe=I([m(2,Nt),m(3,B),m(4,F)],QRe);var IVt=class extends C{constructor(e,t,o){super();this.notebookWidget=e;this._list=t;this.loggingService=o;this._pendingLayouts=new WeakMap;this._layoutDisposables=new Set;this._layoutStack=[];this._isDisposed=!1}checkStackDepth(){if(this._layoutStack.length>30){let e=this._layoutStack.join(" -> ");throw new Error("NotebookCellLayoutManager: layout stack is too deep: "+e)}}async layoutNotebookCell(e,t){let o=`cell:${e.handle}, height:${t}`;if(this.loggingService.debug("cell layout",o),this._list.getViewIndex(e)===void 0)return;if(this._pendingLayouts?.has(e)){let l=this._pendingLayouts.get(e);l.dispose(),this._layoutDisposables.delete(l)}let r=new Go,s=()=>{let l=this._pendingLayouts?.get(e);this._pendingLayouts?.delete(e),this._layoutStack.push(o);try{if(this._isDisposed||!this.notebookWidget.viewModel?.hasCell(e)||this._list.getViewIndex(e)===void 0||this._list.elementHeight(e)===t)return;if(this.checkStackDepth(),!this.notebookWidget.hasEditorFocus()){let c=this.notebookWidget.viewModel?.getCellIndex(e),u=this.notebookWidget.visibleRanges;if(c!==void 0&&u&&u.length&&u[0].start===c&&this._list.scrollTop>this.notebookWidget.getAbsoluteTopOfElement(e))return this._list.updateElementHeight2(e,t,Math.min(c+1,this.notebookWidget.getLength()-1))}this._list.updateElementHeight2(e,t)}finally{this._layoutStack.pop(),r.complete(void 0),l&&(l.dispose(),this._layoutDisposables.delete(l))}};if(this._list.inRenderingTransaction){let l=$r(Me(this.notebookWidget.getDomNode()),s),c=Z(()=>{l.dispose(),r.complete(void 0)});this._pendingLayouts?.set(e,c),this._layoutDisposables.add(c)}else s();return r.p}dispose(){super.dispose(),this._isDisposed=!0,this._layoutDisposables.forEach(e=>e.dispose())}};var V8o=_;function UZ(){let a=["editor.contrib.review",aZ.ID,QW.ID,"editor.contrib.dirtydiff","editor.contrib.testingOutputPeek","editor.contrib.testingDecorations","store.contrib.stickyScrollController","editor.contrib.findController","editor.contrib.emptyTextEditorHint"],i=aa.getEditorContributions().filter(e=>a.indexOf(e.id)===-1);return{menuIds:{notebookToolbar:D.NotebookToolbar,cellTitleToolbar:D.NotebookCellTitle,cellDeleteToolbar:D.NotebookCellDelete,cellInsertToolbar:D.NotebookCellBetween,cellTopInsertToolbar:D.NotebookCellListTop,cellExecuteToolbar:D.NotebookCellExecute,cellExecutePrimary:D.NotebookCellExecutePrimary},cellEditorContributions:i}}var XK=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super();this.creationOptions=e;this.notebookRendererMessaging=r;this.notebookEditorService=s;this.notebookKernelService=l;this._notebookService=c;this.configurationService=u;this.layoutService=h;this.contextMenuService=g;this.telemetryService=f;this.notebookExecutionService=v;this.editorProgressService=b;this.logService=S;this._onDidChangeCellState=this._register(new E);this.onDidChangeCellState=this._onDidChangeCellState.event;this._onDidChangeViewCells=this._register(new E);this.onDidChangeViewCells=this._onDidChangeViewCells.event;this._onWillChangeModel=this._register(new E);this.onWillChangeModel=this._onWillChangeModel.event;this._onDidChangeModel=this._register(new E);this.onDidChangeModel=this._onDidChangeModel.event;this._onDidAttachViewModel=this._register(new E);this.onDidAttachViewModel=this._onDidAttachViewModel.event;this._onDidChangeOptions=this._register(new E);this.onDidChangeOptions=this._onDidChangeOptions.event;this._onDidChangeDecorations=this._register(new E);this.onDidChangeDecorations=this._onDidChangeDecorations.event;this._onDidScroll=this._register(new E);this.onDidScroll=this._onDidScroll.event;this._onDidChangeLayout=this._register(new E);this.onDidChangeLayout=this._onDidChangeLayout.event;this._onDidChangeActiveCell=this._register(new E);this.onDidChangeActiveCell=this._onDidChangeActiveCell.event;this._onDidChangeFocus=this._register(new E);this.onDidChangeFocus=this._onDidChangeFocus.event;this._onDidChangeSelection=this._register(new E);this.onDidChangeSelection=this._onDidChangeSelection.event;this._onDidChangeVisibleRanges=this._register(new E);this.onDidChangeVisibleRanges=this._onDidChangeVisibleRanges.event;this._onDidFocusEmitter=this._register(new E);this.onDidFocusWidget=this._onDidFocusEmitter.event;this._onDidBlurEmitter=this._register(new E);this.onDidBlurWidget=this._onDidBlurEmitter.event;this._onDidChangeActiveEditor=this._register(new E);this.onDidChangeActiveEditor=this._onDidChangeActiveEditor.event;this._onDidChangeActiveKernel=this._register(new E);this.onDidChangeActiveKernel=this._onDidChangeActiveKernel.event;this._onMouseUp=this._register(new E);this.onMouseUp=this._onMouseUp.event;this._onMouseDown=this._register(new E);this.onMouseDown=this._onMouseDown.event;this._onDidReceiveMessage=this._register(new E);this.onDidReceiveMessage=this._onDidReceiveMessage.event;this._onDidRenderOutput=this._register(new E);this.onDidRenderOutput=this._onDidRenderOutput.event;this._onDidRemoveOutput=this._register(new E);this.onDidRemoveOutput=this._onDidRemoveOutput.event;this._onDidResizeOutputEmitter=this._register(new E);this.onDidResizeOutput=this._onDidResizeOutputEmitter.event;this._webview=null;this._webviewResolvePromise=null;this._webviewTransparentCover=null;this._listDelegate=null;this._dndController=null;this._listTopCellToolbar=null;this._renderedEditors=new Map;this._localStore=this._register(new P);this._localCellStateListeners=[];this._shadowElementViewInfo=null;this._contributions=new Map;this._insetModifyQueueByOutputId=new NT;this._cellContextKeyManager=null;this._uuid=_t();this._webviewFocused=!1;this._isVisible=!1;this._isDisposed=!1;this._baseCellEditorOptions=new Map;this._debugFlag=!1;this._backgroundMarkdownRenderRunning=!1;this._lastCellWithEditorFocus=null;this._pendingOutputHeightAcks=new Map;this._dimension=t,this.isReplHistory=e.isReplHistory??!1,this._readOnly=e.isReadOnly??!1,this._overlayContainer=document.createElement("div"),this.scopedContextKeyService=this._register(p.createScoped(this._overlayContainer)),this.instantiationService=this._register(o.createChild(new Io([X,this.scopedContextKeyService]))),this._notebookOptions=e.options??this.instantiationService.createInstance(nT,this.creationOptions?.codeWindow??It,this._readOnly,void 0),this._register(this._notebookOptions);let y=this._register(new ARe);this._viewContext=new WRe(this._notebookOptions,y,N=>this.getBaseCellEditorOptions(N)),this._register(this._viewContext.eventDispatcher.onDidChangeLayout(()=>{this._onDidChangeLayout.fire()})),this._register(this._viewContext.eventDispatcher.onDidChangeCellState(N=>{this._onDidChangeCellState.fire(N)})),this._register(c.onDidChangeOutputRenderers(()=>{this._updateOutputRenderers()})),this._register(this.instantiationService.createInstance(BRe,this)),this._register(l.onDidChangeSelectedNotebooks(N=>{Xe(N.notebook,this.viewModel?.uri)&&(this._loadKernelPreloads(),this._onDidChangeActiveKernel.fire())})),this._scrollBeyondLastLine=this.configurationService.getValue("editor.scrollBeyondLastLine"),this._register(this.configurationService.onDidChangeConfiguration(N=>{N.affectsConfiguration("editor.scrollBeyondLastLine")&&(this._scrollBeyondLastLine=this.configurationService.getValue("editor.scrollBeyondLastLine"),this._dimension&&this._isVisible&&this.layout(this._dimension))})),this._register(this._notebookOptions.onDidChangeOptions(N=>{(N.cellStatusBarVisibility||N.cellToolbarLocation||N.cellToolbarInteraction)&&this._updateForNotebookConfiguration(),N.fontFamily&&this._generateFontInfo(),(N.compactView||N.focusIndicator||N.insertToolbarPosition||N.cellToolbarLocation||N.dragAndDropEnabled||N.fontSize||N.markupFontSize||N.markdownLineHeight||N.fontFamily||N.insertToolbarAlignment||N.outputFontSize||N.outputLineHeight||N.outputFontFamily||N.outputWordWrap||N.outputScrolling||N.outputLinkifyFilePaths||N.minimalError)&&(this._styleElement?.remove(),this._createLayoutStyles(),this._webview?.updateOptions({...this.notebookOptions.computeWebviewOptions(),fontFamily:this._generateFontFamily()})),this._dimension&&this._isVisible&&this.layout(this._dimension)}));let w=e.codeWindow?this.layoutService.getContainer(e.codeWindow):this.layoutService.mainContainer;this._register(n.getPart(w).onDidScroll(N=>{!this._shadowElement||!this._isVisible||(this.updateShadowElement(this._shadowElement,this._dimension),this.layoutContainerOverShadowElement(this._dimension,this._position))})),this.notebookEditorService.addNotebookEditor(this);let k=_t();this._overlayContainer.id=`notebook-${k}`,this._overlayContainer.className="notebookOverlay",this._overlayContainer.classList.add("notebook-editor"),this._overlayContainer.inert=!0,this._overlayContainer.style.visibility="hidden",w.appendChild(this._overlayContainer),this._createBody(this._overlayContainer),this._generateFontInfo(),this._isVisible=!0,this._editorFocus=rr.bindTo(this.scopedContextKeyService),this._outputFocus=PR.bindTo(this.scopedContextKeyService),this._outputInputFocus=yZ.bindTo(this.scopedContextKeyService),this._editorEditable=Kl.bindTo(this.scopedContextKeyService),this._cursorNavMode=VJe.bindTo(this.scopedContextKeyService),new Q(CZe,!1).bindTo(this.scopedContextKeyService).set(!0),this._editorEditable.set(!e.isReadOnly);let T;Array.isArray(this.creationOptions.contributions)?T=this.creationOptions.contributions:T=A4.getEditorContributions();for(let N of T){let O;try{O=this.instantiationService.createInstance(N.ctor,this)}catch(V){mt(V)}if(O)if(!this._contributions.has(N.id))this._contributions.set(N.id,O);else throw O.dispose(),new Error(`DUPLICATE notebook editor contribution: '${N.id}'`)}this._updateForNotebookConfiguration()}get isVisible(){return this._isVisible}get isDisposed(){return this._isDisposed}set viewModel(e){this._onWillChangeModel.fire(this._notebookViewModel?.notebookDocument),this._notebookViewModel=e,this._onDidChangeModel.fire(e?.notebookDocument)}get viewModel(){return this._notebookViewModel}get textModel(){return this._notebookViewModel?.notebookDocument}get isReadOnly(){return this._notebookViewModel?.options.isReadOnly??!1}get activeCodeEditor(){if(this._isDisposed)return;let[e]=this._list.getFocusedElements();return this._renderedEditors.get(e)}get activeCellAndCodeEditor(){if(this._isDisposed)return;let[e]=this._list.getFocusedElements(),t=this._renderedEditors.get(e);if(t)return[e,t]}get codeEditors(){return[...this._renderedEditors]}get visibleRanges(){return this._list?this._list.visibleRanges||[]:[]}get notebookOptions(){return this._notebookOptions}_debug(...e){this._debugFlag&&Xlo(...e)}getId(){return this._uuid}getViewModel(){return this.viewModel}getLength(){return this.viewModel?.length??0}getSelections(){return this.viewModel?.getSelections()??[{start:0,end:0}]}setSelections(e){if(!this.viewModel)return;let t=this.viewModel.getFocus();this.viewModel.updateSelectionsState({kind:1,focus:t,selections:e})}getFocus(){return this.viewModel?.getFocus()??{start:0,end:0}}setFocus(e){if(!this.viewModel)return;let t=this.viewModel.getSelections();this.viewModel.updateSelectionsState({kind:1,focus:e,selections:t})}getSelectionViewModels(){if(!this.viewModel)return[];let e=new Set;return this.viewModel.getSelections().map(t=>this.viewModel.viewCells.slice(t.start,t.end)).reduce((t,o)=>(o.forEach(n=>{e.has(n.handle)||(e.add(n.handle),t.push(n))}),t),[])}hasModel(){return!!this._notebookViewModel}showProgress(){this._currentProgress=this.editorProgressService.show(!0)}hideProgress(){this._currentProgress&&(this._currentProgress.done(),this._currentProgress=void 0)}getBaseCellEditorOptions(e){let t=this._baseCellEditorOptions.get(e);if(t)return t;{let o=new hVt(this,this.notebookOptions,this.configurationService,e);return this._baseCellEditorOptions.set(e,o),o}}_updateForNotebookConfiguration(){if(!this._overlayContainer)return;this._overlayContainer.classList.remove("cell-title-toolbar-left"),this._overlayContainer.classList.remove("cell-title-toolbar-right"),this._overlayContainer.classList.remove("cell-title-toolbar-hidden");let e=this._notebookOptions.computeCellToolbarLocation(this.viewModel?.viewType);this._overlayContainer.classList.add(`cell-title-toolbar-${e}`);let t=this._notebookOptions.getDisplayOptions().cellToolbarInteraction,o="hover";this._overlayContainer.classList.remove("cell-toolbar-hover"),this._overlayContainer.classList.remove("cell-toolbar-click"),(t==="hover"||t==="click")&&(o=t),this._overlayContainer.classList.add(`cell-toolbar-${o}`)}_generateFontInfo(){let e=this.configurationService.getValue("editor"),t=Me(this.getDomNode());this._fontInfo=Fy.readFontInfo(t,LS(e,Xd.getInstance(t).value))}_createBody(e){this._notebookTopToolbarContainer=document.createElement("div"),this._notebookTopToolbarContainer.classList.add("notebook-toolbar-container"),this._notebookTopToolbarContainer.style.display="none",R(e,this._notebookTopToolbarContainer),this._notebookStickyScrollContainer=document.createElement("div"),this._notebookStickyScrollContainer.classList.add("notebook-sticky-scroll-container"),R(e,this._notebookStickyScrollContainer),this._body=document.createElement("div"),R(e,this._body),this._body.classList.add("cell-list-container"),this._createLayoutStyles(),this._createCellList(),this._notebookOverviewRulerContainer=document.createElement("div"),this._notebookOverviewRulerContainer.classList.add("notebook-overview-ruler-container"),this._list.scrollableElement.appendChild(this._notebookOverviewRulerContainer),this._registerNotebookOverviewRuler(),this._register(this.instantiationService.createInstance(SVt,this,this._list.scrollableElement)),this._overflowContainer=document.createElement("div"),this._overflowContainer.classList.add("notebook-overflow-widget-container","monaco-editor"),R(e,this._overflowContainer)}_generateFontFamily(){return this._fontInfo?.fontFamily??'"SF Mono", Monaco, Menlo, Consolas, "Ubuntu Mono", "Liberation Mono", "DejaVu Sans Mono", "Courier New", monospace'}_createLayoutStyles(){this._styleElement=hr(this._body);let{cellRightMargin:e,cellTopMargin:t,cellRunGutter:o,cellBottomMargin:n,codeCellLeftMargin:r,markdownCellGutter:s,markdownCellLeftMargin:l,markdownCellBottomMargin:c,markdownCellTopMargin:u,collapsedIndicatorHeight:p,focusIndicator:h,insertToolbarPosition:g,outputFontSize:f,focusIndicatorLeftMargin:v,focusIndicatorGap:b}=this._notebookOptions.getLayoutConfiguration(),{insertToolbarAlignment:S,compactView:y,fontSize:w}=this._notebookOptions.getDisplayOptions(),k=this._notebookOptions.getCellEditorContainerLeftMargin(),{bottomToolbarGap:T,bottomToolbarHeight:N}=this._notebookOptions.computeBottomToolbarDimensions(this.viewModel?.viewType),O=[];this._fontInfo||this._generateFontInfo();let V=this._generateFontFamily();O.push(`
.notebook-editor {
--notebook-cell-output-font-size: ${f}px;
--notebook-cell-input-preview-font-size: ${w}px;
--notebook-cell-input-preview-font-family: ${V};
}
`),y?O.push(`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .markdown-cell-row div.cell.code { margin-left: ${k}px; }`):O.push(`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .markdown-cell-row div.cell.code { margin-left: ${r}px; }`),h==="border"?(O.push(`
.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-top:before,
.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-bottom:before,
.monaco-workbench .notebookOverlay .monaco-list .markdown-cell-row .cell-inner-container:before,
.monaco-workbench .notebookOverlay .monaco-list .markdown-cell-row .cell-inner-container:after {
content: "";
position: absolute;
width: 100%;
height: 1px;
}
.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-left:before,
.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-right:before {
content: "";
position: absolute;
width: 1px;
height: 100%;
z-index: 10;
}
/* top border */
.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-top:before {
border-top: 1px solid transparent;
}
/* left border */
.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-left:before {
border-left: 1px solid transparent;
}
/* bottom border */
.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-bottom:before {
border-bottom: 1px solid transparent;
}
/* right border */
.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-right:before {
border-right: 1px solid transparent;
}
`),O.push(`
.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.code-cell-row.focused .cell-focus-indicator-left:before,
.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.code-cell-row.focused .cell-focus-indicator-right:before,
.monaco-workbench .notebookOverlay .monaco-list.selection-multiple .monaco-list-row.code-cell-row.selected .cell-focus-indicator-left:before,
.monaco-workbench .notebookOverlay .monaco-list.selection-multiple .monaco-list-row.code-cell-row.selected .cell-focus-indicator-right:before {
top: -${t}px; height: calc(100% + ${t+n}px)
}`)):(O.push(`
.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-left .codeOutput-focus-indicator {
border-left: 3px solid transparent;
border-radius: 4px;
width: 0px;
margin-left: ${v}px;
border-color: var(--vscode-notebook-inactiveFocusedCellBorder) !important;
}
.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.focused .cell-focus-indicator-left .codeOutput-focus-indicator-container,
.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-output-hover .cell-focus-indicator-left .codeOutput-focus-indicator-container,
.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .markdown-cell-hover .cell-focus-indicator-left .codeOutput-focus-indicator-container,
.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row:hover .cell-focus-indicator-left .codeOutput-focus-indicator-container {
display: block;
}
.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-left .codeOutput-focus-indicator-container:hover .codeOutput-focus-indicator {
border-left: 5px solid transparent;
margin-left: ${v-1}px;
}
`),O.push(`
.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.focused .cell-inner-container.cell-output-focus .cell-focus-indicator-left .codeOutput-focus-indicator,
.monaco-workbench .notebookOverlay .monaco-list:focus-within .monaco-list-row.focused .cell-inner-container .cell-focus-indicator-left .codeOutput-focus-indicator {
border-color: var(--vscode-notebook-focusedCellBorder) !important;
}
.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-inner-container .cell-focus-indicator-left .output-focus-indicator {
margin-top: ${b}px;
}
`)),g==="betweenCells"||g==="both"?(O.push(".monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-bottom-toolbar-container { display: flex; }"),O.push(".monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .view-zones .cell-list-top-cell-toolbar-container { display: flex; }")):(O.push(".monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-bottom-toolbar-container { display: none; }"),O.push(".monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .view-zones .cell-list-top-cell-toolbar-container { display: none; }")),S==="left"&&(O.push(`
.monaco-workbench .notebookOverlay .cell-list-top-cell-toolbar-container .action-item:first-child,
.monaco-workbench .notebookOverlay .cell-list-top-cell-toolbar-container .action-item:first-child, .monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-bottom-toolbar-container .action-item:first-child {
margin-right: 0px !important;
}`),O.push(`
.monaco-workbench .notebookOverlay .cell-list-top-cell-toolbar-container .monaco-toolbar .action-label,
.monaco-workbench .notebookOverlay .cell-list-top-cell-toolbar-container .monaco-toolbar .action-label, .monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-bottom-toolbar-container .monaco-toolbar .action-label {
padding: 0px !important;
justify-content: center;
border-radius: 4px;
}`),O.push(`
.monaco-workbench .notebookOverlay .cell-list-top-cell-toolbar-container,
.monaco-workbench .notebookOverlay .cell-list-top-cell-toolbar-container, .monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-bottom-toolbar-container {
align-items: flex-start;
justify-content: left;
margin: 0 16px 0 ${8+r}px;
}`),O.push(`
.monaco-workbench .notebookOverlay .cell-list-top-cell-toolbar-container,
.notebookOverlay .cell-bottom-toolbar-container .action-item {
border: 0px;
}`)),O.push(`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .code-cell-row div.cell.code { margin-left: ${k}px; }`),O.push(`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .view-zones .code-cell-row div.cell.code { margin-left: ${k}px; }`),O.push(`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .view-zones .code-cell-row div.cell { margin-right: ${e}px; }`),O.push(`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row div.cell { margin-right: ${e}px; }`),O.push(`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row > .cell-inner-container { padding-top: ${t}px; }`),O.push(`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .markdown-cell-row > .cell-inner-container { padding-bottom: ${c}px; padding-top: ${u}px; }`),O.push(".notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .markdown-cell-row > .cell-inner-container.webview-backed-markdown-cell { padding: 0; }"),O.push(`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .markdown-cell-row > .webview-backed-markdown-cell.markdown-cell-edit-mode .cell.code { padding-bottom: ${c}px; padding-top: ${u}px; }`),O.push(`.notebookOverlay .output { margin: 0px ${e}px 0px ${k}px; }`),O.push(`.notebookOverlay .output { width: calc(100% - ${k+e}px); }`),O.push(`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-comment-container { left: ${k}px; }`),O.push(`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-comment-container { width: calc(100% - ${k+e}px); }`),O.push(`.monaco-workbench .notebookOverlay .output .output-collapse-container .expandButton { left: -${o}px; }`),O.push(`.monaco-workbench .notebookOverlay .output .output-collapse-container .expandButton {
position: absolute;
width: ${o}px;
padding: 6px 0px;
}`),O.push(`.notebookOverlay .output-show-more-container { margin: 0px ${e}px 0px ${k}px; }`),O.push(`.notebookOverlay .output-show-more-container { width: calc(100% - ${k+e}px); }`),O.push(`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row div.cell.markdown { padding-left: ${o}px; }`),O.push(`.monaco-workbench .notebookOverlay > .cell-list-container .notebook-folding-indicator { left: ${(s-20)/2+l}px; }`),O.push(`.notebookOverlay > .cell-list-container .notebook-folded-hint { left: ${s+l+8}px; }`),O.push(`.notebookOverlay .monaco-list .monaco-list-row :not(.webview-backed-markdown-cell) .cell-focus-indicator-top { height: ${t}px; }`),O.push(`.notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-side { bottom: ${T}px; }`),O.push(`.notebookOverlay .monaco-list .monaco-list-row.code-cell-row .cell-focus-indicator-left { width: ${k}px; }`),O.push(`.notebookOverlay .monaco-list .monaco-list-row.markdown-cell-row .cell-focus-indicator-left { width: ${r}px; }`),O.push(`.notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator.cell-focus-indicator-right { width: ${e}px; }`),O.push(`.notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-bottom { height: ${n}px; }`),O.push(`.notebookOverlay .monaco-list .monaco-list-row .cell-shadow-container-bottom { top: ${n}px; }`),O.push(`
.notebookOverlay .monaco-list.selection-multiple .monaco-list-row:has(+ .monaco-list-row.selected) .cell-focus-indicator-bottom {
height: ${T+n}px;
}
`),O.push(`
.notebookOverlay .monaco-list .monaco-list-row.code-cell-row.nb-multiCellHighlight:has(+ .monaco-list-row.nb-multiCellHighlight) .cell-focus-indicator-bottom {
height: ${T+n}px;
background-color: var(--vscode-notebook-symbolHighlightBackground) !important;
}
.notebookOverlay .monaco-list .monaco-list-row.markdown-cell-row.nb-multiCellHighlight:has(+ .monaco-list-row.nb-multiCellHighlight) .cell-focus-indicator-bottom {
height: ${T+n-6}px;
background-color: var(--vscode-notebook-symbolHighlightBackground) !important;
}
`),O.push(`
.monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .input-collapse-container .cell-collapse-preview {
line-height: ${p}px;
}
.monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .input-collapse-container .cell-collapse-preview .monaco-tokenized-source {
max-height: ${p}px;
}
`),O.push(`.monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-bottom-toolbar-container .monaco-toolbar { height: ${N}px }`),O.push(`.monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .view-zones .cell-list-top-cell-toolbar-container .monaco-toolbar { height: ${N}px }`),O.push(`.monaco-workbench .notebookOverlay.cell-title-toolbar-right > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-title-toolbar {
right: ${e+26}px;
}
.monaco-workbench .notebookOverlay.cell-title-toolbar-left > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-title-toolbar {
left: ${k+16}px;
}
.monaco-workbench .notebookOverlay.cell-title-toolbar-hidden > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-title-toolbar {
display: none;
}`),O.push(`
.monaco-workbench .notebookOverlay .output > div.foreground.output-inner-container {
padding: ${hwi}px 8px;
}
.monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .output-collapse-container {
padding: ${hwi}px 8px;
}
`),O.push(`
.monaco-workbench .notebookOverlay .cell-chat-part {
margin: 0 ${e}px 6px 4px;
}
`),this._styleElement.textContent=O.join(`
`)}_createCellList(){this._body.classList.add("cell-list-container"),this._dndController=this._register(new XWt(this,this._body));let e=n=>this._list.contextKeyService.createScoped(n);this._editorPool=this._register(this.instantiationService.createInstance(QRe,this,e));let t=[this.instantiationService.createInstance(W4,this,this._renderedEditors,this._editorPool,this._dndController,e),this.instantiationService.createInstance(F4,this,this._dndController,this._renderedEditors,e)];t.forEach(n=>{this._register(n)}),this._listDelegate=this.instantiationService.createInstance(PRe,Me(this.getDomNode())),this._register(this._listDelegate);let o=this.instantiationService.createInstance(jRe,()=>this.viewModel,this.isReplHistory);this._register(o),this._list=this.instantiationService.createInstance(bRe,"NotebookCellList",this._body,this._viewContext.notebookOptions,this._listDelegate,t,this.scopedContextKeyService,{setRowLineHeight:!1,setRowHeight:!1,supportDynamicHeights:!0,horizontalScrolling:!1,keyboardSupport:!1,mouseSupport:!0,multipleSelectionSupport:!0,selectionNavigation:!0,typeNavigationEnabled:!0,paddingTop:0,paddingBottom:0,transformOptimization:!1,initialSize:this._dimension,styleController:n=>this._list,overrideStyles:{listBackground:HZ,listActiveSelectionBackground:HZ,listActiveSelectionForeground:ko,listFocusAndSelectionBackground:HZ,listFocusAndSelectionForeground:ko,listFocusBackground:HZ,listFocusForeground:ko,listHoverForeground:ko,listHoverBackground:HZ,listHoverOutline:Ad,listFocusOutline:Ad,listInactiveSelectionBackground:HZ,listInactiveSelectionForeground:ko,listInactiveFocusBackground:HZ,listInactiveFocusOutline:HZ},accessibilityProvider:o}),this._cellLayoutManager=new IVt(this,this._list,this.logService),this._dndController.setList(this._list),this._register(this._list),this._listViewInfoAccessor=new oVt(this._list),this._register(this._listViewInfoAccessor),this._register(hn(...t)),this._listTopCellToolbar=this._register(this.instantiationService.createInstance(URe,this,this.notebookOptions)),this._webviewTransparentCover=R(this._list.rowsContainer,V8o(".webview-cover")),this._webviewTransparentCover.style.display="none",this._register(Gbe(this._overlayContainer,n=>{n.target.classList.contains("slider")&&this._webviewTransparentCover&&(this._webviewTransparentCover.style.display="block")})),this._register(Qpt(this._overlayContainer,()=>{this._webviewTransparentCover&&(this._webviewTransparentCover.style.display="none")})),this._register(this._list.onMouseDown(n=>{n.element&&this._onMouseDown.fire({event:n.browserEvent,target:n.element})})),this._register(this._list.onMouseUp(n=>{n.element&&this._onMouseUp.fire({event:n.browserEvent,target:n.element})})),this._register(this._list.onDidChangeFocus(n=>{this._onDidChangeActiveEditor.fire(this),this._onDidChangeActiveCell.fire(),this._onDidChangeFocus.fire(),this._cursorNavMode.set(!1)})),this._register(this._list.onContextMenu(n=>{this.showListContextMenu(n)})),this._register(this._list.onDidChangeVisibleRanges(()=>{this._onDidChangeVisibleRanges.fire()})),this._register(this._list.onDidScroll(n=>{n.scrollTop!==n.oldScrollTop&&(this._onDidScroll.fire(),this.clearActiveCellWidgets()),n.scrollTop===n.oldScrollTop&&n.scrollHeightChanged&&this._onDidChangeLayout.fire()})),this._focusTracker=this._register(Vn(this.getDomNode())),this._register(this._focusTracker.onDidBlur(()=>{this._editorFocus.set(!1),this.viewModel?.setEditorFocus(!1),this._onDidBlurEmitter.fire()})),this._register(this._focusTracker.onDidFocus(()=>{this._editorFocus.set(!0),this.viewModel?.setEditorFocus(!0),this._onDidFocusEmitter.fire()})),this._registerNotebookActionsToolbar(),this._registerNotebookStickyScroll(),this._register(this.configurationService.onDidChangeConfiguration(n=>{n.affectsConfiguration(o.verbositySettingId)&&(this._list.ariaLabel=o?.getWidgetAriaLabel())}))}showListContextMenu(e){this.contextMenuService.showContextMenu({menuId:D.NotebookCellTitle,menuActionOptions:{shouldForwardArgs:!0},contextKeyService:this.scopedContextKeyService,getAnchor:()=>e.anchor,getActionsContext:()=>({from:"cellContainer"})})}_registerNotebookOverviewRuler(){this._notebookOverviewRuler=this._register(this.instantiationService.createInstance(HRe,this,this._notebookOverviewRulerContainer))}_registerNotebookActionsToolbar(){this._notebookTopToolbar=this._register(this.instantiationService.createInstance(VRe,this,this.scopedContextKeyService,this._notebookOptions,this._notebookTopToolbarContainer)),this._register(this._notebookTopToolbar.onDidChangeVisibility(()=>{this._dimension&&this._isVisible&&this.layout(this._dimension)}))}_registerNotebookStickyScroll(){this._notebookStickyScroll=this._register(this.instantiationService.createInstance(hy,this._notebookStickyScrollContainer,this,this._list,e=>{this.isDisposed||(this._dimension&&this._isVisible&&(e>0?(this.layout(this._dimension),this.setScrollTop(this.scrollTop+e)):e<0&&(this.setScrollTop(this.scrollTop+e),this.layout(this._dimension))),this._onDidScroll.fire())}))}_updateOutputRenderers(){!this.viewModel||!this._webview||(this._webview.updateOutputRenderers(),this.viewModel.viewCells.forEach(e=>{e.outputsViewModels.forEach(t=>{t.pickedMimeType?.rendererId===az&&t.resetRenderer()})}))}getDomNode(){return this._overlayContainer}getOverflowContainerDomNode(){return this._overflowContainer}getInnerWebview(){return this._webview?.webview}setEditorProgressService(e){this.editorProgressService=e}setParentContextKeyService(e){this.scopedContextKeyService.updateParent(e)}async setModel(e,t,o,n){if(this.viewModel===void 0||!this.viewModel.equal(e)){let r=this._notebookOptions.computeBottomToolbarDimensions(this.viewModel?.viewType);this._detachModel(),await this._attachModel(e,n??e.viewType,t,o);let s=this._notebookOptions.computeBottomToolbarDimensions(this.viewModel?.viewType);(r.bottomToolbarGap!==s.bottomToolbarGap||r.bottomToolbarHeight!==s.bottomToolbarHeight)&&(this._styleElement?.remove(),this._createLayoutStyles(),this._webview?.updateOptions({...this.notebookOptions.computeWebviewOptions(),fontFamily:this._generateFontFamily()})),this.telemetryService.publicLog2("notebook/editorOpened",{scheme:e.uri.scheme,ext:ms(e.uri),viewType:e.viewType,isRepl:this.isReplHistory})}else this.restoreListViewState(t);this._restoreSelectedKernel(t),this._loadKernelPreloads(),this._dndController?.clearGlobalDragState(),this._localStore.add(this._list.onDidChangeFocus(()=>{this.updateContextKeysOnFocusChange()})),this.updateContextKeysOnFocusChange(),this._backgroundMarkdownRendering()}_backgroundMarkdownRendering(){this._backgroundMarkdownRenderRunning||(this._backgroundMarkdownRenderRunning=!0,jv(Me(this.getDomNode()),e=>{this._backgroundMarkdownRenderingWithDeadline(e)}))}_backgroundMarkdownRenderingWithDeadline(e){let t=Date.now()+e.timeRemaining(),o=()=>{try{if(this._backgroundMarkdownRenderRunning=!0,this._isDisposed||!this.viewModel)return;let n=this.viewModel.viewCells.find(r=>r.cellKind===1&&!this._webview?.markupPreviewMapping.has(r.id)&&!this.cellIsHidden(r));if(!n)return;this.createMarkupPreview(n)}finally{this._backgroundMarkdownRenderRunning=!1}Date.now()<t?Vw(o):this._backgroundMarkdownRendering()};o()}updateContextKeysOnFocusChange(){if(!this.viewModel)return;let e=this._list.getFocusedElements()[0];e&&(this._cellContextKeyManager||(this._cellContextKeyManager=this._localStore.add(this.instantiationService.createInstance(zpe,this,e))),this._cellContextKeyManager.updateForElement(e))}async setOptions(e){if(e?.isReadOnly!==void 0&&(this._readOnly=e?.isReadOnly),!this.viewModel)return;this.viewModel.updateOptions({isReadOnly:this._readOnly}),this.notebookOptions.updateOptions(this._readOnly);let t=e?.cellOptions??this._parseIndexedCellOptions(e);if(t){let o=this.viewModel.viewCells.find(n=>n.uri.toString()===t.resource.toString());if(o){this.focusElement(o);let n=t.options?.selection;n?(o.updateEditState(1,"setOptions"),o.focusMode=1,await this.revealRangeInCenterIfOutsideViewportAsync(o,new z(n.startLineNumber,n.startColumn,n.endLineNumber||n.startLineNumber,n.endColumn||n.startColumn))):this._list.revealCell(o,e?.cellRevealType??4);let r=this._renderedEditors.get(o);if(r){if(t.options?.selection){let{selection:s}=t.options,l=new z(s.startLineNumber,s.startColumn,s.endLineNumber||s.startLineNumber,s.endColumn||s.startColumn);r.setSelection(l),r.revealPositionInCenterIfOutsideViewport({lineNumber:s.startLineNumber,column:s.startColumn}),await this.revealRangeInCenterIfOutsideViewportAsync(o,l)}t.options?.preserveFocus||r.focus()}}}if(e?.cellSelections){let o=e.cellSelections[0].start,n=this.viewModel.cellAt(o);n&&(this.viewModel.updateSelectionsState({kind:1,focus:{start:o,end:o+1},selections:e.cellSelections}),this.revealInCenterIfOutsideViewport(n))}this._updateForOptions(),this._onDidChangeOptions.fire()}_parseIndexedCellOptions(e){if(e?.indexedCellOptions){let t=this.cellAt(e.indexedCellOptions.index);if(t)return{resource:t.uri,options:{selection:e.indexedCellOptions.selection,preserveFocus:!1}}}}_detachModel(){this._localStore.clear(),Ue(this._localCellStateListeners),this._list.detachViewModel(),this.viewModel?.dispose(),this.viewModel=void 0,this._webview?.dispose(),this._webview?.element.remove(),this._webview=null,this._list.clear()}_updateForOptions(){this.viewModel&&(this._editorEditable.set(!this.viewModel.options.isReadOnly),this._overflowContainer.classList.toggle("notebook-editor-editable",!this.viewModel.options.isReadOnly),this.getDomNode().classList.toggle("notebook-editor-editable",!this.viewModel.options.isReadOnly))}async _resolveWebview(){return this.textModel?this._webviewResolvePromise?this._webviewResolvePromise:(this._webview||this._ensureWebview(this.getId(),this.textModel.viewType,this.textModel.uri),this._webviewResolvePromise=(async()=>{if(!this._webview)throw new Error("Notebook output webview object is not created successfully.");if(await this._webview.createWebview(this.creationOptions.codeWindow??It),!this._webview.webview)throw new Error("Notebook output webview element was not created successfully.");return this._localStore.add(this._webview.webview.onDidBlur(()=>{this._outputFocus.set(!1),this._webviewFocused=!1,this.updateEditorFocus(),this.updateCellFocusMode()})),this._localStore.add(this._webview.webview.onDidFocus(()=>{this._outputFocus.set(!0),this.updateEditorFocus(),this._webviewFocused=!0})),this._localStore.add(this._webview.onMessage(e=>{this._onDidReceiveMessage.fire(e)})),this._webview})(),this._webviewResolvePromise):null}_ensureWebview(e,t,o){if(this._webview)return;let n=this;this._webview=this.instantiationService.createInstance(uA,{get creationOptions(){return n.creationOptions},setScrollTop(r){n._list.scrollTop=r},triggerScroll(r){n._list.triggerScrollFromMouseWheelEvent(r)},getCellByInfo:n.getCellByInfo.bind(n),getCellById:n._getCellById.bind(n),toggleNotebookCellSelection:n._toggleNotebookCellSelection.bind(n),focusNotebookCell:n.focusNotebookCell.bind(n),focusNextNotebookCell:n.focusNextNotebookCell.bind(n),updateOutputHeight:n._updateOutputHeight.bind(n),scheduleOutputHeightAck:n._scheduleOutputHeightAck.bind(n),updateMarkupCellHeight:n._updateMarkupCellHeight.bind(n),setMarkupCellEditState:n._setMarkupCellEditState.bind(n),didStartDragMarkupCell:n._didStartDragMarkupCell.bind(n),didDragMarkupCell:n._didDragMarkupCell.bind(n),didDropMarkupCell:n._didDropMarkupCell.bind(n),didEndDragMarkupCell:n._didEndDragMarkupCell.bind(n),didResizeOutput:n._didResizeOutput.bind(n),updatePerformanceMetadata:n._updatePerformanceMetadata.bind(n),didFocusOutputInputChange:n._didFocusOutputInputChange.bind(n)},e,t,o,{...this._notebookOptions.computeWebviewOptions(),fontFamily:this._generateFontFamily()},this.notebookRendererMessaging.getScoped(this._uuid)),this._webview.element.style.width="100%",this._list.attachWebview(this._webview.element)}async _attachModel(e,t,o,n){this._ensureWebview(this.getId(),e.viewType,e.uri),this.viewModel=this.instantiationService.createInstance(BZ,t,e,this._viewContext,this.getLayoutInfo(),{isReadOnly:this._readOnly}),this._viewContext.eventDispatcher.emit([new rZe({width:!0,fontInfo:!0},this.getLayoutInfo())]),this.notebookOptions.updateOptions(this._readOnly),this._updateForOptions(),this._updateForNotebookConfiguration();{this.viewModel.restoreEditorViewState(o);let l=o?.contributionsState||{};for(let[c,u]of this._contributions)typeof u.restoreViewState=="function"&&u.restoreViewState(l[c])}this._localStore.add(this.viewModel.onDidChangeViewCells(l=>{this._onDidChangeViewCells.fire(l)})),this._localStore.add(this.viewModel.onDidChangeSelection(()=>{this._onDidChangeSelection.fire(),this.updateSelectedMarkdownPreviews()})),this._localStore.add(this._list.onWillScroll(l=>{this._webview?.isResolved()&&(this._webviewTransparentCover.style.transform=`translateY(${l.scrollTop})`)}));let r=!1,s=this._localStore.add(new me);this._localStore.add(this._list.onDidChangeContentHeight(()=>{r||(r=!0,s.value=$r(Me(this.getDomNode()),()=>{r=!1,this._updateScrollHeight()},100))})),this._localStore.add(this._list.onDidRemoveOutputs(l=>{l.forEach(c=>this.removeInset(c))})),this._localStore.add(this._list.onDidHideOutputs(l=>{l.forEach(c=>this.hideInset(c))})),this._localStore.add(this._list.onDidRemoveCellsFromView(l=>{let c=[],u=[];for(let p of l)if(p.cellKind===1){let h=p;this.viewModel?.viewCells.find(g=>g.handle===h.handle)?c.push(h):u.push(h)}this.hideMarkupPreviews(c),this.deleteMarkupPreviews(u)})),await this._warmupWithMarkdownRenderer(this.viewModel,o,n),n?.mark("customMarkdownLoaded"),this._localCellStateListeners=this.viewModel.viewCells.map(l=>this._bindCellListener(l)),this._lastCellWithEditorFocus=this.viewModel.viewCells.find(l=>this.getActiveCell()===l&&l.focusMode===1)??null,this._localStore.add(this.viewModel.onDidChangeViewCells(l=>{this._isDisposed||([...l.splices].reverse().forEach(c=>{let[u,p,h]=c,g=this._localCellStateListeners.splice(u,p,...h.map(f=>this._bindCellListener(f)));Ue(g)}),l.splices.some(c=>c[2].some(u=>u.cellKind===1))&&this._backgroundMarkdownRendering())})),this._dimension?this._list.layout(this.getBodyHeight(this._dimension.height),this._dimension.width):this._list.layout(),this._dndController?.clearGlobalDragState(),this.restoreListViewState(o)}_bindCellListener(e){let t=new P;return t.add(e.onDidChangeLayout(o=>{(o.totalHeight||o.outerWidth)&&this.layoutNotebookCell(e,e.layoutInfo.totalHeight,o.context)})),e.cellKind===2&&t.add(e.onDidRemoveOutputs(o=>{o.forEach(n=>this.removeInset(n))})),t.add(e.onDidChangeState(o=>{o.inputCollapsedChanged&&e.isInputCollapsed&&e.cellKind===1&&this.hideMarkupPreviews([e]),o.outputCollapsedChanged&&e.isOutputCollapsed&&e.cellKind===2&&e.outputsViewModels.forEach(n=>this.hideInset(n)),o.focusModeChanged&&this._validateCellFocusMode(e)})),t.add(e.onCellDecorationsChanged(o=>{o.added.forEach(n=>{n.className&&this.deltaCellContainerClassNames(e.id,[n.className],[],e.cellKind),n.outputClassName&&this.deltaCellContainerClassNames(e.id,[n.outputClassName],[],e.cellKind)}),o.removed.forEach(n=>{n.className&&this.deltaCellContainerClassNames(e.id,[],[n.className],e.cellKind),n.outputClassName&&this.deltaCellContainerClassNames(e.id,[],[n.outputClassName],e.cellKind)})})),t}_validateCellFocusMode(e){e.focusMode===1&&(this._lastCellWithEditorFocus&&this._lastCellWithEditorFocus!==e&&(this._lastCellWithEditorFocus.focusMode=0),this._lastCellWithEditorFocus=e)}async _warmupWithMarkdownRenderer(e,t,o){this.logService.debug("NotebookEditorWidget","warmup "+this.viewModel?.uri.toString()),await this._resolveWebview(),o?.mark("webviewCommLoaded"),this.logService.debug("NotebookEditorWidget","warmup - webview resolved"),this._webview.element.style.visibility="hidden",await this._warmupViewportMarkdownCells(e,t),this.logService.debug("NotebookEditorWidget","warmup - viewport warmed up"),this._list.layout(0,0),this._list.attachViewModel(e),this._list.scrollTop=t?.scrollPosition?.top??0,this._debug("finish initial viewport warmup and view state restore."),this._webview.element.style.visibility="visible",this.logService.debug("NotebookEditorWidget","warmup - list view model attached, set to visible"),this._onDidAttachViewModel.fire()}async _warmupViewportMarkdownCells(e,t){if(t&&t.cellTotalHeights){let o=t.cellTotalHeights,n=t.scrollPosition?.top??0,r=n+Math.max(this._dimension?.height??0,1080),s=0,l=[];for(let c=0;c<e.length;c++){let u=e.cellAt(c),p=o[c]??0;if(s+p<n){s+=p;continue}if(u.cellKind===1&&l.push([u,s]),s+=p,s>r)break}await this._webview.initializeMarkup(l.map(([c,u])=>this.createMarkupCellInitialization(c,u)))}else{let o=e.viewCells.filter(l=>l.cellKind===1).slice(0,5).map(l=>this.createMarkupCellInitialization(l,-1e4));await this._webview.initializeMarkup(o);let n=0,r=[],s=Math.max(this._dimension?.height??0,1080);for(let l of e.viewCells)if(l.cellKind===1&&r.push({id:l.id,top:n}),n+=l.getHeight(this.getLayoutInfo().fontInfo.lineHeight),n>s)break;this._webview?.updateScrollTops([],r)}}createMarkupCellInitialization(e,t){return{mime:e.mime,cellId:e.id,cellHandle:e.handle,content:e.getText(),offset:t,visible:!1,metadata:e.metadata}}restoreListViewState(e){if(!this.viewModel)return;e?.scrollPosition!==void 0?(this._list.scrollTop=e.scrollPosition.top,this._list.scrollLeft=e.scrollPosition.left):(this._list.scrollTop=0,this._list.scrollLeft=0);let t=typeof e?.focus=="number"?e.focus:0;if(t<this.viewModel.length){let o=this.viewModel.cellAt(t);o&&this.viewModel?.updateSelectionsState({kind:0,primary:o.handle,selections:[o.handle]})}else this._list.length>0&&this.viewModel.updateSelectionsState({kind:1,focus:{start:0,end:1},selections:[{start:0,end:1}]});if(e?.editorFocused){let o=this.viewModel.cellAt(t);o&&(o.focusMode=1)}}_restoreSelectedKernel(e){if(e?.selectedKernelId&&this.textModel){let t=this.notebookKernelService.getMatchingKernel(this.textModel),o=t.all.find(n=>n.id===e.selectedKernelId);o&&!t.selected&&this.notebookKernelService.selectKernelForNotebook(o,this.textModel)}}getEditorViewState(){let e=this.viewModel?.getEditorViewState();if(!e)return{editingCells:{},cellLineNumberStates:{},editorViewStates:{},collapsedInputCells:{},collapsedOutputCells:{}};if(this._list){e.scrollPosition={left:this._list.scrollLeft,top:this._list.scrollTop};let o={};for(let n=0;n<this.viewModel.length;n++){let r=this.viewModel.cellAt(n);o[n]=r.layoutInfo.totalHeight}if(e.cellTotalHeights=o,this.viewModel){let n=this.viewModel.getFocus(),r=this.viewModel.cellAt(n.start);if(r){let s=this._list.domElementOfElement(r),l=r.getEditState()===1&&!!(s&&s.ownerDocument.activeElement&&s.contains(s.ownerDocument.activeElement));e.editorFocused=l,e.focus=n.start}}}let t={};for(let[o,n]of this._contributions)typeof n.saveViewState=="function"&&(t[o]=n.saveViewState());return e.contributionsState=t,this.textModel?.uri.scheme===Y.untitled&&(e.selectedKernelId=this.activeKernel?.id),e}_allowScrollBeyondLastLine(){return this._scrollBeyondLastLine&&!this.isReplHistory}getBodyHeight(e){return Math.max(e-(this._notebookTopToolbar?.useGlobalToolbar?26:0),0)}layout(e,t,o){if(!t&&this._shadowElementViewInfo===null){this._dimension=e,this._position=o;return}if(e.width<=0||e.height<=0){this.onWillHide();return}let n=this.layoutService.whenContainerStylesLoaded(Me(this.getDomNode()));n?n.then(()=>this.layoutNotebook(e,t,o)):this.layoutNotebook(e,t,o)}layoutNotebook(e,t,o){if(t&&this.updateShadowElement(t,e,o),this._shadowElementViewInfo&&this._shadowElementViewInfo.width<=0&&this._shadowElementViewInfo.height<=0){this.onWillHide();return}this._dimension=e,this._position=o;let n=this.getBodyHeight(e.height)-this.getLayoutInfo().stickyHeight;fN(this._body,e.width,n);let r=n;this._list.getRenderHeight()<r?(this._list.updateOptions({paddingBottom:this._allowScrollBeyondLastLine()?Math.max(0,r-50):0,paddingTop:0}),this._list.layout(r,e.width)):(this._list.layout(r,e.width),this._list.updateOptions({paddingBottom:this._allowScrollBeyondLastLine()?Math.max(0,r-50):0,paddingTop:0})),this._overlayContainer.inert=!1,this._overlayContainer.style.visibility="visible",this._overlayContainer.style.display="block",this._overlayContainer.style.position="absolute",this._overlayContainer.style.overflow="hidden",this.layoutContainerOverShadowElement(e,o),this._webviewTransparentCover&&(this._webviewTransparentCover.style.height=`${e.height}px`,this._webviewTransparentCover.style.width=`${e.width}px`),this._notebookTopToolbar.layout(this._dimension),this._notebookOverviewRuler.layout(),this._viewContext?.eventDispatcher.emit([new rZe({width:!0,fontInfo:!0},this.getLayoutInfo())])}updateShadowElement(e,t,o){if(this._shadowElement=e,t&&o)this._shadowElementViewInfo={height:t.height,width:t.width,top:o.top,left:o.left};else{let n=e.getBoundingClientRect();this._shadowElementViewInfo={height:n.height,width:n.width,top:n.top,left:n.left}}}layoutContainerOverShadowElement(e,t){if(e&&t){this._overlayContainer.style.top=`${t.top}px`,this._overlayContainer.style.left=`${t.left}px`,this._overlayContainer.style.width=`${e.width}px`,this._overlayContainer.style.height=`${e.height}px`;return}if(!this._shadowElementViewInfo)return;let o=this._overlayContainer.parentElement?.getBoundingClientRect();this._overlayContainer.style.top=`${this._shadowElementViewInfo.top-(o?.top||0)}px`,this._overlayContainer.style.left=`${this._shadowElementViewInfo.left-(o?.left||0)}px`,this._overlayContainer.style.width=`${e?e.width:this._shadowElementViewInfo.width}px`,this._overlayContainer.style.height=`${e?e.height:this._shadowElementViewInfo.height}px`}focus(){if(this._isVisible=!0,this._editorFocus.set(!0),this._webviewFocused)this._webview?.focusWebview();else{if(this.viewModel){let e=this.viewModel.getFocus(),t=this.viewModel.cellAt(e.start);if(this.hasEditorFocus()||(this.focusContainer(),this.updateEditorFocus()),t&&t.focusMode===1){t.updateEditState(1,"editorWidget.focus"),t.focusMode=1,this.focusEditor(t);return}}this._list.domFocus()}this._currentProgress&&this.showProgress()}onShow(){this._isVisible=!0}focusEditor(e){for(let[t,o]of this._renderedEditors.entries())if(t===e){o.focus();return}}focusContainer(e=!1){this._webviewFocused?this._webview?.focusWebview():this._list.focusContainer(e)}selectOutputContent(e){this._webview?.selectOutputContents(e)}selectInputContents(e){this._webview?.selectInputContents(e)}onWillHide(){this._isVisible=!1,this._editorFocus.set(!1),this._overlayContainer.inert=!0,this._overlayContainer.style.visibility="hidden",this._overlayContainer.style.left="-50000px",this._notebookTopToolbarContainer.style.display="none",this.clearActiveCellWidgets()}clearActiveCellWidgets(){this._renderedEditors.forEach((e,t)=>{this.getActiveCell()===t&&e&&(El.get(e)?.cancelSuggestWidget(),lh.get(e)?.clearWidgets(),ou.get(e)?.clearWidgets())}),this._renderedEditors.forEach((e,t)=>{Rc.get(e)?.model.get()?.inlineEditState.get()&&e.render(!0)})}editorHasDomFocus(){return ts(this.getDomNode())}updateEditorFocus(){this._focusTracker.refreshState();let e=this.editorHasDomFocus();this._editorFocus.set(e),this.viewModel?.setEditorFocus(e)}updateCellFocusMode(){let e=this.getActiveCell();e?.focusMode===2&&!this._webviewFocused&&(e.focusMode=0)}hasEditorFocus(){return this.updateEditorFocus(),this.editorHasDomFocus()}hasWebviewFocus(){return this._webviewFocused}hasOutputTextSelection(){if(!this.hasEditorFocus())return!1;let e=Me(this.getDomNode()).getSelection();if(e?.rangeCount!==1)return!1;let t=e.getRangeAt(0);if(t.startContainer===t.endContainer&&t.endOffset-t.startOffset===0)return!1;let o=t.commonAncestorContainer;if(!this._body.contains(o))return!1;for(;o&&o!==this._body;){if(o.classList&&o.classList.contains("output"))return!0;o=o.parentNode}return!1}_didFocusOutputInputChange(e){this._outputInputFocus.set(e)}focusElement(e){this.viewModel?.updateSelectionsState({kind:0,primary:e.handle,selections:[e.handle]})}get scrollTop(){return this._list.scrollTop}get scrollBottom(){return this._list.scrollTop+this._list.getRenderHeight()}getAbsoluteTopOfElement(e){return this._list.getCellViewScrollTop(e)}getAbsoluteBottomOfElement(e){return this._list.getCellViewScrollBottom(e)}getHeightOfElement(e){return this._list.elementHeight(e)}scrollToBottom(){this._list.scrollToBottom()}setScrollTop(e){this._list.scrollTop=e}revealCellRangeInView(e){return this._list.revealCells(e)}revealInView(e){return this._list.revealCell(e,1)}revealInViewAtTop(e){this._list.revealCell(e,2)}revealInCenter(e){this._list.revealCell(e,3)}async revealInCenterIfOutsideViewport(e){await this._list.revealCell(e,4)}async revealFirstLineIfOutsideViewport(e){await this._list.revealCell(e,6)}async revealLineInViewAsync(e,t){return this._list.revealRangeInCell(e,new z(t,1,t,1),1)}async revealLineInCenterAsync(e,t){return this._list.revealRangeInCell(e,new z(t,1,t,1),2)}async revealLineInCenterIfOutsideViewportAsync(e,t){return this._list.revealRangeInCell(e,new z(t,1,t,1),3)}async revealRangeInViewAsync(e,t){return this._list.revealRangeInCell(e,t,1)}async revealRangeInCenterAsync(e,t){return this._list.revealRangeInCell(e,t,2)}async revealRangeInCenterIfOutsideViewportAsync(e,t){return this._list.revealRangeInCell(e,t,3)}revealCellOffsetInCenter(e,t){return this._list.revealCellOffsetInCenter(e,t)}revealOffsetInCenterIfOutsideViewport(e){return this._list.revealOffsetInCenterIfOutsideViewport(e)}getViewIndexByModelIndex(e){if(!this._listViewInfoAccessor)return-1;let t=this.viewModel?.viewCells[e];return t?this._listViewInfoAccessor.getViewIndex(t):-1}getViewHeight(e){return this._listViewInfoAccessor?this._listViewInfoAccessor.getViewHeight(e):-1}getCellRangeFromViewRange(e,t){return this._listViewInfoAccessor.getCellRangeFromViewRange(e,t)}getCellsInRange(e){return this._listViewInfoAccessor.getCellsInRange(e)}setCellEditorSelection(e,t){this._list.setCellEditorSelection(e,t)}setHiddenAreas(e){return this._list.setHiddenAreas(e,!0)}getVisibleRangesPlusViewportAboveAndBelow(){return this._listViewInfoAccessor.getVisibleRangesPlusViewportAboveAndBelow()}deltaCellDecorations(e,t){let o=this.viewModel?.deltaCellDecorations(e,t)||[];return this._onDidChangeDecorations.fire(),o}deltaCellContainerClassNames(e,t,o,n){n===1?this._webview?.deltaMarkupPreviewClassNames(e,t,o):this._webview?.deltaCellOutputContainerClassNames(e,t,o)}changeModelDecorations(e){return this.viewModel?.changeModelDecorations(e)||null}changeViewZones(e){this._list.changeViewZones(e),this._onDidChangeLayout.fire()}getViewZoneLayoutInfo(e){return this._list.getViewZoneLayoutInfo(e)}changeCellOverlays(e){this._list.changeCellOverlays(e)}async _loadKernelPreloads(){if(!this.hasModel())return;let{selected:e}=this.notebookKernelService.getMatchingKernel(this.textModel);this._webview?.isResolved()||await this._resolveWebview(),this._webview?.updateKernelPreloads(e)}get activeKernel(){return this.textModel&&this.notebookKernelService.getSelectedOrSuggestedKernel(this.textModel)}async cancelNotebookCells(e){if(!(!this.viewModel||!this.hasModel()))return e||(e=this.viewModel.viewCells),this.notebookExecutionService.cancelNotebookCellHandles(this.textModel,Array.from(e).map(t=>t.handle))}async executeNotebookCells(e){if(!this.viewModel||!this.hasModel()){this.logService.info("notebookEditorWidget","No NotebookViewModel, cannot execute cells");return}return e||(e=this.viewModel.viewCells),this.notebookExecutionService.executeNotebookCells(this.textModel,Array.from(e).map(t=>t.model),this.scopedContextKeyService)}async layoutNotebookCell(e,t,o){return this._cellLayoutManager?.layoutNotebookCell(e,t)}getActiveCell(){let e=this._list.getFocusedElements();if(e&&e.length)return e[0]}_toggleNotebookCellSelection(e,t){let o=this._list.getSelectedElements(),n=o.includes(e),r=t?o[o.length-1]??e:e,s=this._list.getViewIndex(e),l=this._list.getViewIndex(r),c=this.getCellsInViewRange(s,l);n?this._list.selectElements(o.filter(u=>!c.includes(u))):(this.focusElement(e),this._list.selectElements([...o.filter(u=>!c.includes(u)),...c]))}getCellsInViewRange(e,t){let o=[];for(let n=0;n<this._list.length;++n){let r=this._list.element(n);r&&(n>=e&&n<=t||n>=t&&n<=e)&&o.push(r)}return o}async focusNotebookCell(e,t,o){if(!this._isDisposed)if(e.focusedOutputId=void 0,t==="editor"){if(e.isInputCollapsed=!1,this.focusElement(e),this._list.focusView(),e.updateEditState(1,"focusNotebookCell"),e.focusMode=1,!o?.skipReveal)if(typeof o?.focusEditorLine=="number"){this._cursorNavMode.set(!0),await this.revealLineInViewAsync(e,o.focusEditorLine);let n=this._renderedEditors.get(e),r=o.focusEditorLine;n?.setSelection({startLineNumber:r,startColumn:1,endLineNumber:r,endColumn:1})}else{let n=e.getSelectionsStartPosition();if(n?.length){let r=n[0];await this.revealRangeInViewAsync(e,z.fromPositions(r,r))}else await this.revealInView(e)}}else if(t==="output"){if(this.focusElement(e),this.hasEditorFocus()||this._list.focusView(),!this._webview)return;let n=e.outputsViewModels.find(s=>s.model.alternativeOutputId)?.model.alternativeOutputId,r=o?.outputId??n??e.id;this._webview.focusOutput(r,o?.altOutputId,o?.outputWebviewFocused||this._webviewFocused),e.updateEditState(0,"focusNotebookCell"),e.focusMode=2,e.focusedOutputId=o?.outputId,this._outputFocus.set(!0),o?.skipReveal||this.revealInCenterIfOutsideViewport(e)}else{let n=this._list.domElementOfElement(e);n&&n.ownerDocument.activeElement&&n.contains(n.ownerDocument.activeElement)&&n.ownerDocument.activeElement.blur(),this._webview?.blurOutput(),e.updateEditState(0,"focusNotebookCell"),e.focusMode=0,this.focusElement(e),o?.skipReveal||(typeof o?.focusEditorLine=="number"?(this._cursorNavMode.set(!0),await this.revealInView(e)):o?.revealBehavior===1?await this.revealFirstLineIfOutsideViewport(e):o?.revealBehavior===0?await this.revealInView(e):await this.revealInCenterIfOutsideViewport(e)),this._list.focusView(),this.updateEditorFocus()}}async focusNextNotebookCell(e,t){let o=this.viewModel?.getCellIndex(e);if(typeof o!="number")return;let n=this.viewModel?.cellAt(o+1);n&&await this.focusNotebookCell(n,t)}async _warmupCell(e){if(e.isOutputCollapsed)return;let t=e.outputsViewModels;for(let o of t.slice(0,vRe)){let[n,r]=o.resolveMimeTypes(this.textModel,void 0);if(!n.find(p=>p.isTrusted)||n.length===0)continue;let s=n[r];if(!s)return;let l=this._notebookService.getRendererInfo(s.rendererId);if(!l)return;let c={type:1,renderer:l,source:o,mimeType:s.mimeType},u=this._webview?.insetMapping.get(c.source);if(!u||!u.initialized){let p=new Promise(h=>{this._register(H.any(this.onDidRenderOutput,this.onDidRemoveOutput)(g=>{g.model===c.source.model&&h()}))});this.createOutput(e,c,0,!1),await p}else this.createOutput(e,c,0,!1);return}}async _warmupAll(e){if(!this.hasModel()||!this.viewModel)return;let t=this.viewModel.viewCells,o=[];for(let n=0;n<t.length;n++)t[n].cellKind===1&&!this._webview.markupPreviewMapping.has(t[n].id)&&o.push(this.createMarkupPreview(t[n]));if(e&&this._list)for(let n=0;n<this._list.length;n++){let r=this._list.element(n);r?.cellKind===2&&o.push(this._warmupCell(r))}return Promise.all(o)}async _warmupSelection(e,t){if(!this.hasModel()||!this.viewModel)return;let o=this.viewModel.viewCells,n=[];for(let r of t)for(let s=r.start;s<r.end;s++)o[s].cellKind===1&&!this._webview.markupPreviewMapping.has(o[s].id)&&n.push(this.createMarkupPreview(o[s]));if(e&&this._list)for(let r of t)for(let s=r.start;s<r.end;s++){let l=this._list.element(s);l?.cellKind===2&&n.push(this._warmupCell(l))}return Promise.all(n)}async find(e,t,o,n=!1,r=!1,s){if(!this._notebookViewModel)return[];s||(s=this.getId());let l=this._notebookViewModel.find(e,t).filter(p=>p.length>0);if(!t.includeMarkupPreview&&!t.includeOutput||t.findScope?.findScopeType==="text")return this._webview?.findStop(s),l;let c={};if(l.forEach(p=>{c[p.cell.id]=p}),this._webview){let p=Date.now();t.findScope&&t.findScope.findScopeType==="cells"&&t.findScope.selectedCellRanges?await this._warmupSelection(!!t.includeOutput,t.findScope.selectedCellRanges):await this._warmupAll(!!t.includeOutput);let h=Date.now();if(this.logService.debug("Find",`Warmup time: ${h-p}ms`),o.isCancellationRequested)return[];let g=[];t.findScope&&t.findScope.findScopeType==="cells"&&t.findScope.selectedCellRanges&&(g=Lf(t.findScope.selectedCellRanges).map(b=>this._notebookViewModel?.viewCells[b].id??""));let f=await this._webview.find(e,{caseSensitive:t.caseSensitive,wholeWord:t.wholeWord,includeMarkup:!!t.includeMarkupPreview,includeOutput:!!t.includeOutput,shouldGetSearchPreviewInfo:r,ownerID:s,findIds:g});if(o.isCancellationRequested)return[];f.forEach(v=>{let b=this._notebookViewModel.viewCells.find(y=>y.id===v.cellId);if(!b)return;if(v.type==="preview"){if(b.getEditState()===0&&!t.includeMarkupPreview||b.getEditState()===1&&t.includeMarkupInput)return}else if(!t.includeOutput)return;let S=c[v.cellId];S?S.webviewMatches.push(v):c[v.cellId]=new V4(this._notebookViewModel.viewCells.find(y=>y.id===v.cellId),this._notebookViewModel.viewCells.findIndex(y=>y.id===v.cellId),[],[v])})}let u=[];return this._notebookViewModel.viewCells.forEach((p,h)=>{c[p.id]&&u.push(new V4(p,h,c[p.id].contentMatches,c[p.id].webviewMatches))}),u}async findHighlightCurrent(e,t){return this._webview?this._webview?.findHighlightCurrent(e,t??this.getId()):0}async findUnHighlightCurrent(e,t){if(this._webview)return this._webview?.findUnHighlightCurrent(e,t??this.getId())}findStop(e){this._webview?.findStop(e??this.getId())}getLayoutInfo(){if(!this._list)throw new Error("Editor is not initalized successfully");this._fontInfo||this._generateFontInfo();let e=0;return this._dimension&&(e=(this._notebookTopToolbar?.useGlobalToolbar?26:0)+(this._notebookStickyScroll?.getCurrentStickyHeight()??0)),{width:this._dimension?.width??0,height:this._dimension?.height??0,scrollHeight:this._list?.getScrollHeight()??0,fontInfo:this._fontInfo,stickyHeight:this._notebookStickyScroll?.getCurrentStickyHeight()??0,listViewOffsetTop:e}}async createMarkupPreview(e){if(!this._webview||(this._webview.isResolved()||await this._resolveWebview(),!this._webview||!this._list.webviewElement)||!this.viewModel||!this._list.viewModel||this.viewModel.getCellIndex(e)===-1||this.cellIsHidden(e))return;let t=parseInt(this._list.webviewElement.domNode.style.top,10),o=t?0-t:0,n=this._list.getCellViewScrollTop(e);await this._webview.showMarkupPreview({mime:e.mime,cellHandle:e.handle,cellId:e.id,content:e.getText(),offset:n+o,visible:!0,metadata:e.metadata})}cellIsHidden(e){let t=this.viewModel.getCellIndex(e);return this.viewModel.getHiddenRanges().some(n=>t>=n.start&&t<=n.end)}async unhideMarkupPreviews(e){this._webview&&(this._webview.isResolved()||await this._resolveWebview(),await this._webview?.unhideMarkupPreviews(e.map(t=>t.id)))}async hideMarkupPreviews(e){!this._webview||!e.length||(this._webview.isResolved()||await this._resolveWebview(),await this._webview?.hideMarkupPreviews(e.map(t=>t.id)))}async deleteMarkupPreviews(e){this._webview&&(this._webview.isResolved()||await this._resolveWebview(),await this._webview?.deleteMarkupPreviews(e.map(t=>t.id)))}async updateSelectedMarkdownPreviews(){if(!this._webview)return;this._webview.isResolved()||await this._resolveWebview();let e=this.getSelectionViewModels().map(t=>t.id);await this._webview?.updateMarkupPreviewSelections(e.length>1?e:[])}async createOutput(e,t,o,n){this._insetModifyQueueByOutputId.queue(t.source.model.outputId,async()=>{if(this._isDisposed||!this._webview||(this._webview.isResolved()||await this._resolveWebview(),!this._webview)||!this._list.webviewElement)return;t.type===1&&this.notebookRendererMessaging.prepare(t.renderer.id);let r=parseInt(this._list.webviewElement.domNode.style.top,10),s=r?0-r:0,l=this._list.getCellViewScrollTop(e)+s,c=this._webview.insetMapping.get(t.source);if(!c||!c.renderer&&t.type===1)n?this._webview.requestCreateOutputWhenWebviewIdle({cellId:e.id,cellHandle:e.handle,cellUri:e.uri,executionId:e.internalMetadata.executionId},t,l,o):this._webview.createOutput({cellId:e.id,cellHandle:e.handle,cellUri:e.uri,executionId:e.internalMetadata.executionId},t,l,o);else if(c.renderer&&t.type===1&&c.renderer.id!==t.renderer.id)this._webview.removeInsets([t.source]),this._webview.createOutput({cellId:e.id,cellHandle:e.handle,cellUri:e.uri},t,l,o);else if(c.versionId!==t.source.model.versionId)this._webview.updateOutput({cellId:e.id,cellHandle:e.handle,cellUri:e.uri,executionId:e.internalMetadata.executionId},t,l,o);else{let u=e.outputsViewModels.indexOf(t.source),p=e.getOutputOffset(u);this._webview.updateScrollTops([{cell:e,output:t.source,cellTop:l,outputOffset:p,forceDisplay:!e.isOutputCollapsed}],[])}})}async updateOutput(e,t,o){this._insetModifyQueueByOutputId.queue(t.source.model.outputId,async()=>{if(this._isDisposed||!this._webview||e.isOutputCollapsed||(this._webview.isResolved()||await this._resolveWebview(),!this._webview||!this._list.webviewElement))return;if(!this._webview.insetMapping.has(t.source))return this.createOutput(e,t,o,!1);t.type===1&&this.notebookRendererMessaging.prepare(t.renderer.id);let n=parseInt(this._list.webviewElement.domNode.style.top,10),r=n?0-n:0,s=this._list.getCellViewScrollTop(e)+r;this._webview.updateOutput({cellId:e.id,cellHandle:e.handle,cellUri:e.uri},t,s,o)})}async copyOutputImage(e){this._webview?.copyImage(e)}removeInset(e){this._insetModifyQueueByOutputId.queue(e.model.outputId,async()=>{this._isDisposed||!this._webview||(this._webview?.isResolved()&&this._webview.removeInsets([e]),this._onDidRemoveOutput.fire(e))})}hideInset(e){this._insetModifyQueueByOutputId.queue(e.model.outputId,async()=>{this._isDisposed||!this._webview||this._webview?.isResolved()&&this._webview.hideInset(e)})}postMessage(e){this._webview?.isResolved()&&this._webview.postKernelMessage(e)}addClassName(e){this._overlayContainer.classList.add(e)}removeClassName(e){this._overlayContainer.classList.remove(e)}cellAt(e){return this.viewModel?.cellAt(e)}getCellByInfo(e){let{cellHandle:t}=e;return this.viewModel?.viewCells.find(o=>o.handle===t)}getCellByHandle(e){return this.viewModel?.getCellByHandle(e)}getCellIndex(e){return this.viewModel?.getCellIndexByHandle(e.handle)}getNextVisibleCellIndex(e){return this.viewModel?.getNextVisibleCellIndex(e)}getPreviousVisibleCellIndex(e){return this.viewModel?.getPreviousVisibleCellIndex(e)}_updateScrollHeight(){if(this._isDisposed||!this._webview?.isResolved()||!this._list.webviewElement)return;let e=this._list.scrollHeight;this._webview.element.style.height=`${e+Kpe*2}px`;let t=parseInt(this._list.webviewElement.domNode.style.top,10),o=t?0-t:0,n=[],r=[];this._webview?.insetMapping.forEach((l,c)=>{let u=this.viewModel?.getCellByHandle(l.cellInfo.cellHandle);if(!u||!(u instanceof Qm)||(this.viewModel?.viewCells.find(v=>v.handle===l.cellInfo.cellHandle),this._list.getViewIndex(u)===void 0))return;u.outputsViewModels.indexOf(c)<0&&r.push(c);let h=this._list.getCellViewScrollTop(u),g=u.outputsViewModels.indexOf(c),f=u.getOutputOffset(g);n.push({cell:u,output:c,cellTop:h+o,outputOffset:f,forceDisplay:!1})}),this._webview.removeInsets(r);let s=[];for(let l of this._webview.markupPreviewMapping.keys()){let c=this.viewModel?.viewCells.find(u=>u.id===l);if(c){let u=this._list.getCellViewScrollTop(c);s.push({id:l,top:u+o})}}(s.length||n.length)&&(this._debug("_list.onDidChangeContentHeight/markdown",s),this._webview?.updateScrollTops(n,s))}_updateOutputHeight(e,t,o,n,r){let s=this.viewModel?.viewCells.find(l=>l.handle===e.cellHandle);if(s&&s instanceof Qm){let l=s.outputsViewModels.indexOf(t);l>-1?(this._debug("update cell output",s.handle,o),s.updateOutputHeight(l,o,r),this.layoutNotebookCell(s,s.layoutInfo.totalHeight),n&&this._onDidRenderOutput.fire(t)):this._debug("tried to update cell output that does not exist")}}_scheduleOutputHeightAck(e,t,o){let n=this._pendingOutputHeightAcks.size===0;this._pendingOutputHeightAcks.set(t,{cellId:e.cellId,outputId:t,height:o}),n&&$r(Me(this.getDomNode()),()=>{this._debug("ack height"),this._updateScrollHeight(),this._webview?.ackHeight([...this._pendingOutputHeightAcks.values()]),this._pendingOutputHeightAcks.clear()},-1)}_getCellById(e){return this.viewModel?.viewCells.find(t=>t.id===e)}_updateMarkupCellHeight(e,t,o){let n=this._getCellById(e);if(n&&n instanceof kb){let{bottomToolbarGap:r}=this._notebookOptions.computeBottomToolbarDimensions(this.viewModel?.viewType);this._debug("updateMarkdownCellHeight",n.handle,t+r,o),n.renderedMarkdownHeight=t}}_setMarkupCellEditState(e,t){let o=this._getCellById(e);o instanceof kb&&(this.revealInView(o),o.updateEditState(t,"setMarkdownCellEditState"))}_didStartDragMarkupCell(e,t){let o=this._getCellById(e);if(o instanceof kb){let n=this._list.webviewElement?-parseInt(this._list.webviewElement.domNode.style.top,10):0;this._dndController?.startExplicitDrag(o,t.dragOffsetY-n)}}_didDragMarkupCell(e,t){let o=this._getCellById(e);if(o instanceof kb){let n=this._list.webviewElement?-parseInt(this._list.webviewElement.domNode.style.top,10):0;this._dndController?.explicitDrag(o,t.dragOffsetY-n)}}_didDropMarkupCell(e,t){let o=this._getCellById(e);if(o instanceof kb){let n=this._list.webviewElement?-parseInt(this._list.webviewElement.domNode.style.top,10):0;t.dragOffsetY-=n,this._dndController?.explicitDrop(o,t)}}_didEndDragMarkupCell(e){let t=this._getCellById(e);t instanceof kb&&this._dndController?.endExplicitDrag(t)}_didResizeOutput(e){let t=this._getCellById(e);t&&this._onDidResizeOutputEmitter.fire(t)}_updatePerformanceMetadata(e,t,o,n){if(!this.hasModel())return;let r=this._getCellById(e),s=r?this.getCellIndex(r):void 0;if(r?.internalMetadata.executionId===t&&s!==void 0){let l=r.internalMetadata.renderDuration||{};l[n]=(l[n]??0)+o,this.textModel.applyEdits([{editType:9,index:s,internalMetadata:{executionId:t,renderDuration:l}}],!0,void 0,()=>{},void 0,!1)}}getContribution(e){return this._contributions.get(e)||null}dispose(){this._isDisposed=!0,this._webview?.dispose(),this._webview=null,this.notebookEditorService.removeNotebookEditor(this),Ue(this._contributions.values()),this._contributions.clear(),this._localStore.clear(),Ue(this._localCellStateListeners),this._list.dispose(),this._cellLayoutManager?.dispose(),this._listTopCellToolbar?.dispose(),this._overlayContainer.remove(),this.viewModel?.dispose(),this._renderedEditors.clear(),this._baseCellEditorOptions.forEach(e=>e.dispose()),this._baseCellEditorOptions.clear(),this._notebookOverviewRulerContainer.remove(),super.dispose(),this._webview=null,this._webviewResolvePromise=null,this._webviewTransparentCover=null,this._dndController=null,this._listTopCellToolbar=null,this._notebookViewModel=void 0,this._cellContextKeyManager=null,this._notebookTopToolbar=null,this._list=null,this._listViewInfoAccessor=null,this._listDelegate=null}toJSON(){return{notebookUri:this.viewModel?.uri}}};XK=I([m(2,F),m(3,Et),m(4,fTe),m(5,Zc),m(6,Tl),m(7,un),m(8,B),m(9,X),m(10,nc),m(11,ze),m(12,Te),m(13,AY),m(14,rd),m(15,_v)],XK);Sk(0,5,"notebook-progress-bar");Sk(0,10,"notebook-list-insertion-indicator");Sk(0,20,"notebook-cell-editor-outline");Sk(0,25,"notebook-scrollbar");Sk(0,26,"notebook-cell-status");Sk(0,26,"notebook-folding-indicator");Sk(0,27,"notebook-output");Sk(0,28,"notebook-cell-bottom-toolbar-container");Sk(0,29,"notebook-run-button-container");Sk(0,29,"notebook-input-collapse-condicon");Sk(0,30,"notebook-cell-output-toolbar");Sk(35,1,"notebook-cell-expand-part-button");Sk(35,2,"notebook-cell-toolbar");Sk(35,3,"notebook-cell-toolbar-dropdown-active");var vwi=J("notebook.cellBorderColor",{dark:ei(xf,1),light:ei(xf,1),hcDark:cb,hcLight:cb},d(12003,null)),_eu=J("notebook.focusedEditorBorder",Ad,d(12011,null)),Ico=J("notebookStatusSuccessIcon.foreground",gRe,d(12024,null)),yco=J("notebookEditorOverviewRuler.runningCellForeground",gRe,d(12018,null)),wco=J("notebookStatusErrorIcon.foreground",Rse,d(12022,null)),Deu=J("notebookStatusRunningIcon.foreground",ko,d(12023,null)),Leu=J("notebook.outputContainerBorderColor",null,d(12015,null)),Reu=J("notebook.outputContainerBackgroundColor",null,d(12014,null)),Meu=J("notebook.cellToolbarSeparator",{dark:Oe.fromHex("#808080").transparent(.35),light:Oe.fromHex("#808080").transparent(.35),hcDark:gi,hcLight:gi},d(12008,null)),Sco=J("notebook.focusedCellBackground",null,d(12002,null)),Peu=J("notebook.selectedCellBackground",{dark:xf,light:xf,hcDark:null,hcLight:null},d(12025,null)),Aeu=J("notebook.cellHoverBackground",{dark:ei(Sco,.5),light:ei(Sco,.7),hcDark:null,hcLight:null},d(12005,null)),Neu=J("notebook.selectedCellBorder",{dark:vwi,light:vwi,hcDark:gi,hcLight:gi},d(12016,null)),Oeu=J("notebook.inactiveSelectedCellBorder",{dark:null,light:null,hcDark:Ad,hcLight:Ad},d(12013,null)),Feu=J("notebook.focusedCellBorder",Ad,d(12010,null)),Weu=J("notebook.inactiveFocusedCellBorder",vwi,d(12012,null)),Veu=J("notebook.cellStatusBarItemHoverBackground",{light:new Oe(new Bt(0,0,0,.08)),dark:new Oe(new Bt(255,255,255,.15)),hcDark:new Oe(new Bt(255,255,255,.15)),hcLight:new Oe(new Bt(0,0,0,.08))},d(12007,null)),Beu=J("notebook.cellInsertionIndicator",Ad,d(12006,null)),Heu=J("notebookScrollbarSlider.background",o9,d(12020,null)),Ueu=J("notebookScrollbarSlider.hoverBackground",AU,d(12021,null)),zeu=J("notebookScrollbarSlider.activeBackground",NU,d(12019,null)),Keu=J("notebook.symbolHighlightBackground",{dark:Oe.fromHex("#ffffff0b"),light:Oe.fromHex("#fdff0033"),hcDark:null,hcLight:null},d(12017,null)),Geu=J("notebook.cellEditorBackground",{light:op,dark:op,hcDark:null,hcLight:null},d(12004,null)),HZ=J("notebook.editorBackground",{light:g8e,dark:g8e,hcDark:null,hcLight:null},d(12009,null));var B8o={top:24,bottom:24},Cco={top:12,bottom:12};function pA(a){return a===1?B8o:Cco}var YRe={padding:Cco,scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:14,horizontal:"auto",vertical:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,alwaysConsumeMouseWheel:!1},renderLineHighlightOnlyWhenFocus:!0,overviewRulerLanes:0,overviewRulerBorder:!1,selectOnLineNumbers:!1,wordWrap:"off",lineNumbers:"off",glyphMargin:!0,fixedOverflowWidgets:!0,minimap:{enabled:!1},renderValidationDecorations:"on",renderLineHighlight:"none",readOnly:!0},XRe={...YRe,glyphMargin:!0,enableSplitViewResizing:!1,renderIndicators:!0,renderMarginRevertIcon:!1,readOnly:!1,isInEmbeddedEditor:!0,renderOverviewRuler:!1,wordWrap:"off",diffWordWrap:"off",diffAlgorithm:"advanced",renderSideBySide:!0,useInlineViewWhenSpaceIsLimited:!1};var Jpe=class extends C{constructor(e,t){super();this.textModel=e;this._notebookService=t;this._onDidChangeState=this._register(new E);this._hoveringOutput=!1;this._focusOnOutput=!1;this._focusInputInOutput=!1;this._outputCollection=[];this._outputsTop=null;this._onDidChangeOutputLayout=this._register(new E);this.onDidChangeOutputLayout=this._onDidChangeOutputLayout.event;this._id=_t(),this._outputViewModels=this.textModel.outputs.map(o=>new VZ(this,o,this._notebookService)),this._register(this.textModel.onDidChangeOutputs(o=>{this._outputCollection.splice(o.start,o.deleteCount,...o.newOutputs.map(()=>0)),this._outputViewModels.splice(o.start,o.deleteCount,...o.newOutputs.map(r=>new VZ(this,r,this._notebookService))).forEach(r=>r.dispose()),this._outputsTop=null,this._onDidChangeOutputLayout.fire()})),this._outputCollection=new Array(this.textModel.outputs.length)}get id(){return this._id}get outputs(){return this.textModel.outputs}get language(){return this.textModel.language}get metadata(){return this.textModel.metadata}get uri(){return this.textModel.uri}get handle(){return this.textModel.handle}get outputIsHovered(){return this._hoveringOutput}set outputIsHovered(e){this._hoveringOutput=e,this._onDidChangeState.fire({outputIsHoveredChanged:!0})}get outputIsFocused(){return this._focusOnOutput}set outputIsFocused(e){this._focusOnOutput=e,this._onDidChangeState.fire({outputIsFocusedChanged:!0})}get inputInOutputIsFocused(){return this._focusInputInOutput}set inputInOutputIsFocused(e){this._focusInputInOutput=e}get outputsViewModels(){return this._outputViewModels}_ensureOutputsTop(){if(!this._outputsTop){let e=new Uint32Array(this._outputCollection.length);for(let t=0;t<this._outputCollection.length;t++)e[t]=this._outputCollection[t];this._outputsTop=new KT(e)}}getOutputOffset(e){if(this._ensureOutputsTop(),e>=this._outputCollection.length)throw new Error("Output index out of range!");return this._outputsTop.getPrefixSum(e-1)}updateOutputHeight(e,t){if(e>=this._outputCollection.length)throw new Error("Output index out of range!");this._ensureOutputsTop(),this._outputCollection[e]=t,this._outputsTop.setValue(e,t)&&this._onDidChangeOutputLayout.fire()}getOutputTotalHeight(){return this._ensureOutputsTop(),this._outputsTop?.getTotalSum()??0}dispose(){super.dispose(),this._outputViewModels.forEach(e=>{e.dispose()})}};Jpe=I([m(1,un)],Jpe);var yVt=class{constructor(i,e){this.source=i;this.value=e;this.type=1}};var JRe=class extends C{constructor(){super(...arguments);this._onDidChangeLayout=this._register(new E);this.onDidChangeLayout=this._onDidChangeLayout.event;this._onDidChangeCellLayout=this._register(new E);this.onDidChangeCellLayout=this._onDidChangeCellLayout.event}emit(e){for(let t=0,o=e.length;t<o;t++){let n=e[t];switch(n.type){case 1:this._onDidChangeLayout.fire(n);break;case 2:this._onDidChangeCellLayout.fire(n);break}}}};var pD=16,Zpe=new Q("notebook.diffEditor.cell.inputChanged",!1),xZe=new Q("notebook.diffEditor.metadataChanged",!1),bwi="notebook.diffEditor.cell.ignoreWhitespace",xco=new Q(bwi,!1),eme=new Q("notebook.diffEditor.cell.property.changed",!1),wVt=new Q("notebook.diffEditor.cell.property.expanded",!1),kco=new Q("notebook.diffEditor.allCollapsed",void 0,d(11903,null)),tme=new Q("notebook.diffEditor.hasUnchangedCells",void 0,d(11904,null)),kZe=new Q("notebook.diffEditor.unchangedCellsAreHidden",void 0,d(11907,null)),H4=new Q("notebook.diffEditor.item.kind",void 0,d(11905,null)),U4=new Q("notebook.diffEditor.item.state",void 0,d(11906,null));function CVt(a,i){let e={};if(a){let o=new Set([...Object.keys(i)]);for(let n of o)a[n]||(e[n]=i[n])}else e=i;return rF(e,{})}var EZe=class extends C{constructor(e){super();this.notebookModel=e;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._textBufferHash=null;this.uri=B3e.generate(this.notebookModel.uri),this._register(this.notebookModel.onDidChangeContent(t=>{t.rawEvents.some(o=>o.kind===11||o.kind===1)&&(this._textBuffer?.dispose(),this._textBuffer=void 0,this._textBufferHash=null,this._onDidChange.fire())}))}get metadata(){return this.notebookModel.metadata}get textBuffer(){if(this._textBuffer)return this._textBuffer;let e=CVt(this.notebookModel.transientOptions.transientDocumentMetadata,this.metadata);return this._textBuffer=this._register(n1(e,1).textBuffer),this._register(this._textBuffer.onDidChangeContent(()=>{this._onDidChange.fire()})),this._textBuffer}getHash(){if(this._textBufferHash!==null)return this._textBufferHash;let e=new Ly,t=this.textBuffer.createSnapshot(!1),o;for(;o=t.read();)e.update(o);return this._textBufferHash=e.digest(),this._textBufferHash}getValue(){let e=this.getFullModelRange();return this.textBuffer.getEOL()===`
`?this.textBuffer.getValueInRange(e,1):this.textBuffer.getValueInRange(e,2)}getFullModelRange(){let e=this.textBuffer.getLineCount();return new z(1,1,e,this.textBuffer.getLineLength(e)+1)}};var xVt=25,Eco=24,Tco=17;var DZe=1440,TZe=class extends C{constructor(e,t,o){super();this.mainDocumentTextModel=e;this.editorEventDispatcher=t;this.initData=o;this._layoutInfoEmitter=this._register(new E);this.onDidLayoutChange=this._layoutInfoEmitter.event;this._register(this.editorEventDispatcher.onDidChangeLayout(n=>this._layoutInfoEmitter.fire({outerWidth:!0})))}},kVt=class extends TZe{constructor(e,t,o){super(e,t,o);this.type="placeholder";this.hiddenCells=[];this._unfoldHiddenCells=this._register(new E);this.onUnfoldHiddenCells=this._unfoldHiddenCells.event;this.renderOutput=!1}get totalHeight(){return 24+2*pD}getHeight(e){return this.totalHeight}layoutChange(){}showHiddenCells(){this._unfoldHiddenCells.fire()}},ZRe=class extends TZe{constructor(e,t,o,n,r,s,l){super(e,n,r);this.originalDocumentTextModel=e;this.modifiedDocumentTextModel=t;this.type=o;this.editorHeightCalculator=l;this.renderOutput=!1;this._sourceEditorViewState=null;let c=xVt;this._layoutInfo={width:0,editorHeight:0,editorMargin:0,metadataHeight:0,cellStatusHeight:c,metadataStatusHeight:0,rawOutputHeight:0,outputTotalHeight:0,outputStatusHeight:0,outputMetadataHeight:0,bodyMargin:32,totalHeight:82+c+0,layoutState:0},this.cellFoldingState=o==="modifiedMetadata"?0:1,this.originalMetadata=this._register(new EZe(e)),this.modifiedMetadata=this._register(new EZe(t))}set editorHeight(e){this._layout({editorHeight:e})}get editorHeight(){throw new Error("Use Cell.layoutInfo.editorHeight")}set editorMargin(e){this._layout({editorMargin:e})}get editorMargin(){throw new Error("Use Cell.layoutInfo.editorMargin")}get layoutInfo(){return this._layoutInfo}get totalHeight(){return this.layoutInfo.totalHeight}async computeHeights(){if(this.type==="unchangedMetadata")this.editorHeight=this.editorHeightCalculator.computeHeightFromLines(this.originalMetadata.textBuffer.getLineCount());else{let e=this.originalMetadata.uri,t=this.modifiedMetadata.uri;this.editorHeight=await this.editorHeightCalculator.diffAndComputeHeight(e,t)}}layoutChange(){this._layout({recomputeOutput:!0})}_layout(e){let t=e.width!==void 0?e.width:this._layoutInfo.width,o=e.editorHeight!==void 0?e.editorHeight:this._layoutInfo.editorHeight,n=e.editorMargin!==void 0?e.editorMargin:this._layoutInfo.editorMargin,r=e.cellStatusHeight!==void 0?e.cellStatusHeight:this._layoutInfo.cellStatusHeight,s=e.bodyMargin!==void 0?e.bodyMargin:this._layoutInfo.bodyMargin,l=o+n+r+s,c={width:t,editorHeight:o,editorMargin:n,metadataHeight:0,cellStatusHeight:r,metadataStatusHeight:0,outputTotalHeight:0,outputStatusHeight:0,bodyMargin:s,rawOutputHeight:0,outputMetadataHeight:0,totalHeight:l,layoutState:3},u=!1,p={};c.width!==this._layoutInfo.width&&(p.width=!0,u=!0),c.editorHeight!==this._layoutInfo.editorHeight&&(p.editorHeight=!0,u=!0),c.editorMargin!==this._layoutInfo.editorMargin&&(p.editorMargin=!0,u=!0),c.cellStatusHeight!==this._layoutInfo.cellStatusHeight&&(p.cellStatusHeight=!0,u=!0),c.bodyMargin!==this._layoutInfo.bodyMargin&&(p.bodyMargin=!0,u=!0),c.totalHeight!==this._layoutInfo.totalHeight&&(p.totalHeight=!0,u=!0),u&&(this._layoutInfo=c,this._fireLayoutChangeEvent(p))}getHeight(e){if(this._layoutInfo.layoutState===0){let t=this.cellFoldingState===1?0:this.computeInputEditorHeight(e);return this._computeTotalHeight(t)}else return this._layoutInfo.totalHeight}_computeTotalHeight(e){return e+this._layoutInfo.editorMargin+this._layoutInfo.metadataHeight+this._layoutInfo.cellStatusHeight+this._layoutInfo.metadataStatusHeight+this._layoutInfo.outputTotalHeight+this._layoutInfo.outputStatusHeight+this._layoutInfo.outputMetadataHeight+this._layoutInfo.bodyMargin}computeInputEditorHeight(e){return this.editorHeightCalculator.computeHeightFromLines(Math.max(this.originalMetadata.textBuffer.getLineCount(),this.modifiedMetadata.textBuffer.getLineCount()))}_fireLayoutChangeEvent(e){this._layoutInfoEmitter.fire(e),this.editorEventDispatcher.emit([{type:2,source:this._layoutInfo}])}getComputedCellContainerWidth(e,t,o){return o?e.width-2*pD+(t?Hu.ENTIRE_DIFF_OVERVIEW_WIDTH:0)-2:(e.width-2*pD+(t?Hu.ENTIRE_DIFF_OVERVIEW_WIDTH:0))/2-18-2}getSourceEditorViewState(){return this._sourceEditorViewState}saveSpirceEditorViewState(e){this._sourceEditorViewState=e}},EVt=class extends TZe{constructor(e,t,o,n,r,s,l,c,u,p){super(e,r,s);this.type=n;this.index=c;this.configurationService=u;this.diffEditorHeightCalculator=p;this._stateChangeEmitter=this._register(new E);this.onDidStateChange=this._stateChangeEmitter.event;this._hideUnchangedCells=this._register(new E);this.onHideUnchangedCells=this._hideUnchangedCells.event;this._renderOutput=!0;this._sourceEditorViewState=null;this._outputEditorViewState=null;this._metadataEditorViewState=null;this.original=t?this._register(new Jpe(t,l)):void 0,this.modified=o?this._register(new Jpe(o,l)):void 0;let h=this._estimateEditorHeight(s.fontInfo),g=xVt;this._layoutInfo={width:0,editorHeight:h,editorMargin:0,metadataHeight:0,cellStatusHeight:g,metadataStatusHeight:this.ignoreMetadata?0:xVt,rawOutputHeight:0,outputTotalHeight:0,outputStatusHeight:this.ignoreOutputs?0:xVt,outputMetadataHeight:0,bodyMargin:32,totalHeight:82+g+h,layoutState:0},this.cellFoldingState=o?.getTextBufferHash()!==t?.getTextBufferHash()?0:1,this.metadataFoldingState=1,this.outputFoldingState=1}hideUnchangedCells(){this._hideUnchangedCells.fire()}set rawOutputHeight(e){this._layout({rawOutputHeight:Math.min(DZe,e)})}get rawOutputHeight(){throw new Error("Use Cell.layoutInfo.rawOutputHeight")}set outputStatusHeight(e){this._layout({outputStatusHeight:e})}get outputStatusHeight(){throw new Error("Use Cell.layoutInfo.outputStatusHeight")}set outputMetadataHeight(e){this._layout({outputMetadataHeight:e})}get outputMetadataHeight(){throw new Error("Use Cell.layoutInfo.outputStatusHeight")}set editorHeight(e){this._layout({editorHeight:e})}get editorHeight(){throw new Error("Use Cell.layoutInfo.editorHeight")}set editorMargin(e){this._layout({editorMargin:e})}get editorMargin(){throw new Error("Use Cell.layoutInfo.editorMargin")}set metadataStatusHeight(e){this._layout({metadataStatusHeight:e})}get metadataStatusHeight(){throw new Error("Use Cell.layoutInfo.outputStatusHeight")}set metadataHeight(e){this._layout({metadataHeight:e})}get metadataHeight(){throw new Error("Use Cell.layoutInfo.metadataHeight")}set renderOutput(e){this._renderOutput=e,this._layout({recomputeOutput:!0}),this._stateChangeEmitter.fire({renderOutput:this._renderOutput})}get renderOutput(){return this._renderOutput}get layoutInfo(){return this._layoutInfo}get totalHeight(){return this.layoutInfo.totalHeight}get ignoreOutputs(){return this.configurationService.getValue("notebook.diff.ignoreOutputs")||!!this.mainDocumentTextModel?.transientOptions.transientOutputs}get ignoreMetadata(){return this.configurationService.getValue("notebook.diff.ignoreMetadata")}layoutChange(){this._layout({recomputeOutput:!0})}_estimateEditorHeight(e){let t=e?.lineHeight??17;switch(this.type){case"unchanged":case"insert":{let o=this.modified.textModel.textBuffer.getLineCount();return o*t+pA(o).top+pA(o).bottom}case"delete":case"modified":{let o=this.original.textModel.textBuffer.getLineCount();return o*t+pA(o).top+pA(o).bottom}}}_layout(e){let t=e.width!==void 0?e.width:this._layoutInfo.width,o=e.editorHeight!==void 0?e.editorHeight:this._layoutInfo.editorHeight,n=e.editorMargin!==void 0?e.editorMargin:this._layoutInfo.editorMargin,r=e.metadataHeight!==void 0?e.metadataHeight:this._layoutInfo.metadataHeight,s=e.cellStatusHeight!==void 0?e.cellStatusHeight:this._layoutInfo.cellStatusHeight,l=e.metadataStatusHeight!==void 0?e.metadataStatusHeight:this._layoutInfo.metadataStatusHeight,c=e.rawOutputHeight!==void 0?e.rawOutputHeight:this._layoutInfo.rawOutputHeight,u=e.outputStatusHeight!==void 0?e.outputStatusHeight:this._layoutInfo.outputStatusHeight,p=e.bodyMargin!==void 0?e.bodyMargin:this._layoutInfo.bodyMargin,h=e.outputMetadataHeight!==void 0?e.outputMetadataHeight:this._layoutInfo.outputMetadataHeight,g=this.ignoreOutputs?0:e.recomputeOutput||e.rawOutputHeight!==void 0||e.outputMetadataHeight!==void 0?this._getOutputTotalHeight(c,h):this._layoutInfo.outputTotalHeight,f=o+n+s+r+l+g+u+p,v={width:t,editorHeight:o,editorMargin:n,metadataHeight:r,cellStatusHeight:s,metadataStatusHeight:l,outputTotalHeight:g,outputStatusHeight:u,bodyMargin:p,rawOutputHeight:c,outputMetadataHeight:h,totalHeight:f,layoutState:3},b=!1,S={};v.width!==this._layoutInfo.width&&(S.width=!0,b=!0),v.editorHeight!==this._layoutInfo.editorHeight&&(S.editorHeight=!0,b=!0),v.editorMargin!==this._layoutInfo.editorMargin&&(S.editorMargin=!0,b=!0),v.metadataHeight!==this._layoutInfo.metadataHeight&&(S.metadataHeight=!0,b=!0),v.cellStatusHeight!==this._layoutInfo.cellStatusHeight&&(S.cellStatusHeight=!0,b=!0),v.metadataStatusHeight!==this._layoutInfo.metadataStatusHeight&&(S.metadataStatusHeight=!0,b=!0),v.outputTotalHeight!==this._layoutInfo.outputTotalHeight&&(S.outputTotalHeight=!0,b=!0),v.outputStatusHeight!==this._layoutInfo.outputStatusHeight&&(S.outputStatusHeight=!0,b=!0),v.bodyMargin!==this._layoutInfo.bodyMargin&&(S.bodyMargin=!0,b=!0),v.outputMetadataHeight!==this._layoutInfo.outputMetadataHeight&&(S.outputMetadataHeight=!0,b=!0),v.totalHeight!==this._layoutInfo.totalHeight&&(S.totalHeight=!0,b=!0),b&&(this._layoutInfo=v,this._fireLayoutChangeEvent(S))}getHeight(e){if(this._layoutInfo.layoutState===0){let t=this.cellFoldingState===1?0:this.computeInputEditorHeight(e);return this._computeTotalHeight(t)}else return this._layoutInfo.totalHeight}_computeTotalHeight(e){return e+this._layoutInfo.editorMargin+this._layoutInfo.metadataHeight+this._layoutInfo.cellStatusHeight+this._layoutInfo.metadataStatusHeight+this._layoutInfo.outputTotalHeight+this._layoutInfo.outputStatusHeight+this._layoutInfo.outputMetadataHeight+this._layoutInfo.bodyMargin}computeInputEditorHeight(e){let t=Math.max(this.original?.textModel.textBuffer.getLineCount()??1,this.modified?.textModel.textBuffer.getLineCount()??1);return this.diffEditorHeightCalculator.computeHeightFromLines(t)}_getOutputTotalHeight(e,t){return this.outputFoldingState===1?0:this.renderOutput?this.isOutputEmpty()?24:this.getRichOutputTotalHeight()+t:e}_fireLayoutChangeEvent(e){this._layoutInfoEmitter.fire(e),this.editorEventDispatcher.emit([{type:2,source:this._layoutInfo}])}getComputedCellContainerWidth(e,t,o){return o?e.width-2*pD+(t?Hu.ENTIRE_DIFF_OVERVIEW_WIDTH:0)-2:(e.width-2*pD+(t?Hu.ENTIRE_DIFF_OVERVIEW_WIDTH:0))/2-18-2}getOutputEditorViewState(){return this._outputEditorViewState}saveOutputEditorViewState(e){this._outputEditorViewState=e}getMetadataEditorViewState(){return this._metadataEditorViewState}saveMetadataEditorViewState(e){this._metadataEditorViewState=e}getSourceEditorViewState(){return this._sourceEditorViewState}saveSpirceEditorViewState(e){this._sourceEditorViewState=e}},GC=class extends EVt{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,o,n,r,s,l,c,p,u,h);this.otherDocumentTextModel=t;this.type=r,this.cellFoldingState=this.modified.textModel.getValue()!==this.original.textModel.getValue()?0:1,this.metadataFoldingState=1,this.outputFoldingState=1,this.checkMetadataIfModified()&&(this.metadataFoldingState=0),this.checkIfOutputsModified()&&(this.outputFoldingState=0),this._register(this.original.onDidChangeOutputLayout(()=>{this._layout({recomputeOutput:!0})})),this._register(this.modified.onDidChangeOutputLayout(()=>{this._layout({recomputeOutput:!0})})),this._register(this.modified.textModel.onDidChangeContent(()=>{if(e.transientOptions.cellContentMetadata){let g=[...Object.keys(e.transientOptions.cellContentMetadata)],f=Object.assign({},this.modified.metadata),v=this.original.metadata;for(let b of g)Object.hasOwn(v,b)&&(f[b]=v[b]);this.modified.textModel.metadata=f}}))}get originalDocument(){return this.otherDocumentTextModel}get modifiedDocument(){return this.mainDocumentTextModel}checkIfInputModified(){return this.original.textModel.getTextBufferHash()===this.modified.textModel.getTextBufferHash()?!1:{reason:"Cell content has changed"}}checkIfOutputsModified(){if(this.mainDocumentTextModel.transientOptions.transientOutputs||this.ignoreOutputs)return!1;let e=H8o(this.original?.outputs??[],this.modified?.outputs??[]);return e===0?!1:{reason:e===1?"Output metadata has changed":void 0,kind:e}}checkMetadataIfModified(){return this.ignoreMetadata?!1:Ir(QK(this.mainDocumentTextModel.transientOptions.transientCellMetadata,this.original?.metadata||{},this.original?.language))!==Ir(QK(this.mainDocumentTextModel.transientOptions.transientCellMetadata,this.modified?.metadata??{},this.modified?.language))?{reason:void 0}:!1}updateOutputHeight(e,t,o){e===0?this.original.updateOutputHeight(t,o):this.modified.updateOutputHeight(t,o)}getOutputOffsetInContainer(e,t){return e===0?this.original.getOutputOffset(t):this.modified.getOutputOffset(t)}getOutputOffsetInCell(e,t){let o=this.getOutputOffsetInContainer(e,t);return this._layoutInfo.editorHeight+this._layoutInfo.editorMargin+this._layoutInfo.metadataHeight+this._layoutInfo.cellStatusHeight+this._layoutInfo.metadataStatusHeight+this._layoutInfo.outputStatusHeight+this._layoutInfo.bodyMargin/2+o}isOutputEmpty(){return this.mainDocumentTextModel.transientOptions.transientOutputs?!0:this.checkIfOutputsModified()?!1:(this.original?.outputs||[]).length===0}getRichOutputTotalHeight(){return Math.max(this.original.getOutputTotalHeight(),this.modified.getOutputTotalHeight())}getNestedCellViewModel(e){return e===0?this.original:this.modified}getCellByUri(e){return e.toString()===this.original.uri.toString()?this.original:this.modified}computeInputEditorHeight(e){return this.type==="modified"&&typeof this.editorHeightWithUnchangedLinesCollapsed=="number"&&this.checkIfInputModified()?this.editorHeightWithUnchangedLinesCollapsed:super.computeInputEditorHeight(e)}async computeModifiedInputEditorHeight(){this.checkIfInputModified()&&(this.editorHeightWithUnchangedLinesCollapsed=this._layoutInfo.editorHeight=await this.diffEditorHeightCalculator.diffAndComputeHeight(this.original.uri,this.modified.uri))}async computeModifiedMetadataEditorHeight(){if(this.checkMetadataIfModified()){let e=Zo.generateCellPropertyUri(this.originalDocument.uri,this.original.handle,Y.vscodeNotebookCellMetadata),t=Zo.generateCellPropertyUri(this.modifiedDocument.uri,this.modified.handle,Y.vscodeNotebookCellMetadata);this._layoutInfo.metadataHeight=await this.diffEditorHeightCalculator.diffAndComputeHeight(e,t)}}async computeEditorHeights(){this.type!=="unchanged"&&await Promise.all([this.computeModifiedInputEditorHeight(),this.computeModifiedMetadataEditorHeight()])}},_Ze=class extends EVt{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,o,n,r,s,l,c,h,u,p);this.otherDocumentTextModel=t;this.type=r,this._register(this.cellViewModel.onDidChangeOutputLayout(()=>{this._layout({recomputeOutput:!0})}))}get cellViewModel(){return this.type==="insert"?this.modified:this.original}get originalDocument(){return this.type==="insert"?this.otherDocumentTextModel:this.mainDocumentTextModel}get modifiedDocument(){return this.type==="insert"?this.mainDocumentTextModel:this.otherDocumentTextModel}checkIfInputModified(){return{reason:"Cell content has changed"}}getNestedCellViewModel(e){return this.type==="insert"?this.modified:this.original}checkIfOutputsModified(){return!1}checkMetadataIfModified(){return!1}updateOutputHeight(e,t,o){this.cellViewModel?.updateOutputHeight(t,o)}getOutputOffsetInContainer(e,t){return this.cellViewModel.getOutputOffset(t)}getOutputOffsetInCell(e,t){let o=this.cellViewModel.getOutputOffset(t);return this._layoutInfo.editorHeight+this._layoutInfo.editorMargin+this._layoutInfo.metadataHeight+this._layoutInfo.cellStatusHeight+this._layoutInfo.metadataStatusHeight+this._layoutInfo.outputStatusHeight+this._layoutInfo.bodyMargin/2+o}isOutputEmpty(){return this.mainDocumentTextModel.transientOptions.transientOutputs?!0:(this.original?.outputs||this.modified?.outputs||[]).length===0}getRichOutputTotalHeight(){return this.cellViewModel?.getOutputTotalHeight()??0}getCellByUri(e){return this.cellViewModel}};function _co(a,i){if(Ir(a.metadata)===Ir(i.metadata))return 2;for(let e=0;e<a.outputs.length;e++){let t=a.outputs[e],o=i.outputs[e];if(t.mime!==o.mime||t.data.buffer.length!==o.data.buffer.length)return 2;for(let n=0;n<t.data.buffer.length;n++)if(t.data.buffer[n]!==o.data.buffer[n])return 2}return 1}function H8o(a,i){if(a.length!==i.length)return 2;let e=a.length;for(let t=0;t<e;t++){let o=a[t],n=i[t];if(Ir(o.metadata)!==Ir(n.metadata))return 1;if(o.outputs.length!==n.outputs.length)return 2;for(let r=0;r<o.outputs.length;r++){let s=o.outputs[r],l=n.outputs[r];if(s.mime!==l.mime||s.data.buffer.length!==l.data.buffer.length)return 2;for(let c=0;c<s.data.buffer.length;c++)if(s.data.buffer[c]!==l.data.buffer[c])return 2}}return 0}function Iwi(a){if(!a.length)return null;let e=a[0].mime;return a.find(o=>o.mime!==e)?null:a.map(o=>o.data.toString()).join("")}function zZ(a){if(a.length===1){let i=Iwi(a[0].outputs);if(i)return i}return JSON.stringify(a.map(i=>({metadata:i.metadata,outputItems:i.outputs.map(e=>({mimeType:e.mime,data:e.data.toString()}))})),void 0," ")}var ywi=class extends C{constructor(e,t,o,n,r,s,l,c,u){super();this._notebookEditor=e;this._notebookTextModel=t;this._notebookService=o;this._quickInputService=n;this._diffElementViewModel=r;this._diffSide=s;this._nestedCell=l;this._outputContainer=c;this.output=u;this.resizeListener=this._register(new P)}render(e,t){let o=document.createElement("div"),n,[r,s]=this.output.resolveMimeTypes(this._notebookTextModel,void 0),l=this.output.pickedMimeType||r[s];if(r.length>1){o.style.position="relative";let u=_(".multi-mimetype-output");u.classList.add(...q.asClassNameArray(_Wt)),u.tabIndex=0,u.title=d(11878,null,r.map(p=>p.mimeType).join(", ")),o.appendChild(u),this.resizeListener.add(Vo(u,"mousedown",async p=>{p.leftButton&&(p.preventDefault(),p.stopPropagation(),await this.pickActiveMimeTypeRenderer(this._notebookTextModel,this.output))})),this.resizeListener.add(j(u,re.KEY_DOWN,async p=>{let h=new Ii(p);(h.equals(3)||h.equals(10))&&(p.preventDefault(),p.stopPropagation(),await this.pickActiveMimeTypeRenderer(this._notebookTextModel,this.output))}))}let c=_(".output-inner-container");if(R(o,c),r.length!==0){let u=this._notebookService.getRendererInfo(l.rendererId);n=u?{type:1,renderer:u,source:this.output,mimeType:l.mimeType}:this._renderMissingRenderer(this.output,l.mimeType),this.output.pickedMimeType=l}this.domNode=o,this.renderResult=n,n&&(t?this._outputContainer.insertBefore(o,t):this._outputContainer.appendChild(o),this._notebookEditor.createOutput(this._diffElementViewModel,this._nestedCell,n,()=>this.getOutputOffsetInCell(e),this._diffElementViewModel instanceof GC?this._diffSide:this._diffElementViewModel.type==="insert"?1:0))}_renderMissingRenderer(e,t){if(!e.model.outputs.length)return this._renderMessage(e,d(11877,null));if(!t){let n=e.model.outputs.map(r=>r.mime).join(", ");return this._renderMessage(e,d(11879,null,n))}return this._renderSearchForMimetype(e,t)}_renderSearchForMimetype(e,t){let o=`@tag:notebookRenderer ${t}`,n=_("p",void 0,`No renderer could be found for mimetype "${t}", but one might be available on the Marketplace.`),r=_("a",{href:`command:workbench.extensions.search?%22${o}%22`,class:"monaco-button monaco-text-button",tabindex:0,role:"button",style:"padding: 8px; text-decoration: none; color: rgb(255, 255, 255); background-color: rgb(14, 99, 156); max-width: 200px;"},"Search Marketplace");return{type:0,source:e,htmlContent:n.outerHTML+r.outerHTML}}_renderMessage(e,t){let o=_("p",void 0,t);return{type:0,source:e,htmlContent:o.outerHTML}}async pickActiveMimeTypeRenderer(e,t){let[o,n]=t.resolveMimeTypes(e,void 0),r=o.filter(u=>u.isTrusted).map((u,p)=>({label:u.mimeType,id:u.mimeType,index:p,picked:p===n,detail:this.generateRendererInfo(u.rendererId),description:p===n?d(11876,null):void 0})),s=new P,l=s.add(this._quickInputService.createQuickPick());l.items=r,l.activeItems=r.filter(u=>!!u.picked),l.placeholder=r.length!==o.length?d(11881,null):d(11880,null);let c=await new Promise(u=>{s.add(l.onDidAccept(()=>{u(l.selectedItems.length===1?l.selectedItems[0].index:void 0),s.dispose()})),l.show()});if(c!==void 0&&c!==n){let u=this._nestedCell.outputsViewModels.indexOf(t),p=this.domNode.nextElementSibling;this.resizeListener.clear();let h=this.domNode;h&&(h.remove(),this._notebookEditor.removeInset(this._diffElementViewModel,this._nestedCell,t,this._diffSide)),t.pickedMimeType=o[c],this.render(u,p)}}generateRendererInfo(e){let t=this._notebookService.getRendererInfo(e);return t?`${t.displayName!==""?t.displayName:t.id} (${t.extensionId.value})`:d(11875,null)}getCellOutputCurrentIndex(){return this._diffElementViewModel.getNestedCellViewModel(this._diffSide).outputs.indexOf(this.output.model)}updateHeight(e,t){this._diffElementViewModel.updateOutputHeight(this._diffSide,e,t)}getOutputOffsetInContainer(e){return this._diffElementViewModel.getOutputOffsetInContainer(this._diffSide,e)}getOutputOffsetInCell(e){return this._diffElementViewModel.getOutputOffsetInCell(this._diffSide,e)}},z4=class extends C{constructor(e,t,o,n,r,s,l,c){super();this._editor=e;this._notebookTextModel=t;this._diffElementViewModel=o;this._nestedCellViewModel=n;this._diffSide=r;this._outputContainer=s;this._notebookService=l;this._quickInputService=c;this._outputEntries=new Map;this._register(this._diffElementViewModel.onDidLayoutChange(()=>{this._outputEntries.forEach((u,p)=>{let h=n.outputs.indexOf(p.model);if(h>=0){let g=this._diffElementViewModel.getOutputOffsetInContainer(this._diffSide,h);u.domNode.style.top=`${g}px`}})})),this._register(this._nestedCellViewModel.textModel.onDidChangeOutputs(u=>{this._updateOutputs(u)}))}_updateOutputs(e){let t=[];this._outputEntries.forEach((r,s)=>{this._nestedCellViewModel.outputsViewModels.indexOf(s)<0&&(t.push(s),r.domNode.remove(),this._editor.removeInset(this._diffElementViewModel,this._nestedCellViewModel,s,this._diffSide))}),t.forEach(r=>{this._outputEntries.get(r)?.dispose(),this._outputEntries.delete(r)});let o;this._nestedCellViewModel.outputsViewModels.reverse().forEach(r=>{if(this._outputEntries.has(r)){o=this._outputEntries.get(r).domNode;return}let s=this._nestedCellViewModel.outputsViewModels.indexOf(r);this._renderOutput(r,s,o),o=this._outputEntries.get(r)?.domNode})}render(){for(let e=0;e<this._nestedCellViewModel.outputsViewModels.length;e++){let t=this._nestedCellViewModel.outputsViewModels[e];this._renderOutput(t,e,void 0)}}showOutputs(){for(let e=0;e<this._nestedCellViewModel.outputsViewModels.length;e++){let t=this._nestedCellViewModel.outputsViewModels[e];this._editor.showInset(this._diffElementViewModel,t.cellViewModel,t,this._diffSide)}}hideOutputs(){this._outputEntries.forEach((e,t)=>{this._editor.hideInset(this._diffElementViewModel,this._nestedCellViewModel,t)})}_renderOutput(e,t,o){this._outputEntries.has(e)||this._outputEntries.set(e,new ywi(this._editor,this._notebookTextModel,this._notebookService,this._quickInputService,this._diffElementViewModel,this._diffSide,this._nestedCellViewModel,this._outputContainer,e)),this._outputEntries.get(e).render(t,o)}};z4=I([m(6,un),m(7,Ge)],z4);function TVt(a){return U8o(a)}function U8o(a){let i=new P,e=i.add(new E),t={options:{enabled:a.getValue("diffEditor.hideUnchangedRegions.enabled"),minimumLineCount:a.getValue("diffEditor.hideUnchangedRegions.minimumLineCount"),contextLineCount:a.getValue("diffEditor.hideUnchangedRegions.contextLineCount"),revealLineCount:a.getValue("diffEditor.hideUnchangedRegions.revealLineCount")},onDidChangeEnablement:e.event.bind(e),dispose:()=>i.dispose()};return i.add(a.onDidChangeConfiguration(o=>{o.affectsConfiguration("diffEditor.hideUnchangedRegions.minimumLineCount")&&(t.options.minimumLineCount=a.getValue("diffEditor.hideUnchangedRegions.minimumLineCount")),o.affectsConfiguration("diffEditor.hideUnchangedRegions.contextLineCount")&&(t.options.contextLineCount=a.getValue("diffEditor.hideUnchangedRegions.contextLineCount")),o.affectsConfiguration("diffEditor.hideUnchangedRegions.revealLineCount")&&(t.options.revealLineCount=a.getValue("diffEditor.hideUnchangedRegions.revealLineCount")),o.affectsConfiguration("diffEditor.hideUnchangedRegions.enabled")&&(t.options.enabled=a.getValue("diffEditor.hideUnchangedRegions.enabled"),e.fire(t.options.enabled))})),t}function K4(){return{isSimpleWidget:!1,contributions:aa.getSomeEditorContributions([ry.ID,ly,Hm.ID,El.ID,Qr.ID,ay.ID])}}var _Vt=class extends C{constructor(i,e){super(),e.body.classList.remove("left","right","full");let t=i.hiddenCells.length===1?d(11871,null,i.hiddenCells.length):d(11872,null,i.hiddenCells.length);e.placeholder.innerText=t,this._register(j(e.placeholder,"dblclick",o=>{o.button===0&&(o.preventDefault(),i.showHiddenCells())})),this._register(e.marginOverlay.onAction(()=>i.showHiddenCells())),e.marginOverlay.show()}},vB=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.cell=e;this.propertyHeaderContainer=t;this.notebookEditor=o;this.accessor=n;this.contextMenuService=r;this.keybindingService=s;this.commandService=l;this.notificationService=c;this.menuService=u;this.contextKeyService=p;this.themeService=h;this.telemetryService=g;this.accessibilityService=f}buildHeader(){this._foldingIndicator=R(this.propertyHeaderContainer,_(".property-folding-indicator")),this._foldingIndicator.classList.add(this.accessor.prefix);let e=R(this.propertyHeaderContainer,_("div.property-status"));this._statusSpan=R(e,_("span")),this._description=R(e,_("span.property-description"));let t=R(this.propertyHeaderContainer,_("div.property-toolbar"));this._toolbar=this._register(new Ol(t,{actionViewItemProvider:(n,r)=>{if(n instanceof Eo)return new VR(n,{hoverDelegate:r.hoverDelegate},this.keybindingService,this.notificationService,this.contextKeyService,this.themeService,this.contextMenuService,this.accessibilityService)}},this.menuService,this.contextKeyService,this.contextMenuService,this.keybindingService,this.commandService,this.telemetryService)),this._toolbar.context=this.cell;let o=this.contextKeyService.createScoped(t);this._register(o),this._propertyChanged=eme.bindTo(o),this._propertyExpanded=wVt.bindTo(o),this._menu=this._register(this.menuService.createMenu(this.accessor.menuId,o)),this._register(this._menu.onDidChange(()=>this.updateMenu())),this._register(this.notebookEditor.onMouseUp(n=>{if(!n.event.target||n.target!==this.cell)return;let r=n.event.target;if(r===this.propertyHeaderContainer||r===this._foldingIndicator||this._foldingIndicator.contains(r)||r===e||e.contains(r)){let s=this.accessor.getFoldingState();this.accessor.updateFoldingState(s===0?1:0),this._updateFoldingIcon(),this.accessor.updateInfoRendering(this.cell.renderOutput)}})),this.refresh(),this.accessor.updateInfoRendering(this.cell.renderOutput)}refresh(){this.updateMenu(),this._updateFoldingIcon();let e=this.accessor.checkIfModified();this._propertyChanged&&this._propertyChanged.set(!!e),e?(this._statusSpan.textContent=this.accessor.changedLabel,this._statusSpan.style.fontWeight="bold",e.reason&&(this._description.textContent=e.reason),this.propertyHeaderContainer.classList.add("modified")):(this._statusSpan.textContent=this.accessor.unChangedLabel,this._statusSpan.style.fontWeight="normal",this._description.textContent="",this.propertyHeaderContainer.classList.remove("modified"))}updateMenu(){if(this.accessor.checkIfModified()){let t=Vm(this._menu.getActions({shouldForwardArgs:!0}));this._toolbar.setActions(t)}else this._toolbar.setActions([])}_updateFoldingIcon(){this.accessor.getFoldingState()===1?(Fi(this._foldingIndicator,Qo(EWt)),this._propertyExpanded?.set(!1)):(Fi(this._foldingIndicator,Qo(TWt)),this._propertyExpanded?.set(!0))}};vB=I([m(4,ze),m(5,_e),m(6,ge),m(7,Ne),m(8,qt),m(9,X),m(10,De),m(11,Te),m(12,Bi)],vB);var eMe=class extends C{constructor(e,t,o,n,r,s,l,c,u){super();this.notebookEditor=e;this.viewModel=t;this.templateData=o;this.instantiationService=n;this.textModelService=r;this.menuService=s;this.contextKeyService=l;this.textConfigurationService=c;this.configurationService=u;this._editor=o.sourceEditor,this._cellHeaderContainer=this.templateData.cellHeaderContainer,this._editorContainer=this.templateData.editorContainer,this._diffEditorContainer=this.templateData.diffEditorContainer,this._editorViewStateChanged=!1,this._register(t.onDidLayoutChange(p=>{this.layout(p),this.updateBorders()})),this.buildBody(),this.updateBorders()}buildBody(){let e=this.templateData.body;e.classList.remove("full"),e.classList.add("full"),this.updateSourceEditor(),this.viewModel instanceof ZRe&&this._register(this.viewModel.modifiedMetadata.onDidChange(t=>{this._cellHeader.refresh()}))}layoutNotebookCell(){this.notebookEditor.layoutNotebookCell(this.viewModel,this.viewModel.layoutInfo.totalHeight)}updateBorders(){this.templateData.leftBorder.style.height=`${this.viewModel.layoutInfo.totalHeight-32}px`,this.templateData.rightBorder.style.height=`${this.viewModel.layoutInfo.totalHeight-32}px`,this.templateData.bottomBorder.style.top=`${this.viewModel.layoutInfo.totalHeight-32}px`}updateSourceEditor(){this._cellHeaderContainer.style.display="flex",this._cellHeaderContainer.innerText="",this._editorContainer.classList.add("diff");let e=()=>{if(this.viewModel.cellFoldingState===1){this._editorContainer.style.display="none",this.viewModel.editorHeight=0;return}let s=this.notebookEditor.getLayoutInfo().fontInfo.lineHeight||17,l=this.viewModel.layoutInfo.editorHeight!==0?this.viewModel.layoutInfo.editorHeight:this.viewModel.computeInputEditorHeight(s);this._editorContainer.style.height=`${l}px`,this._editorContainer.style.display="block";let c=this._editor.getContentHeight();return c>=0&&(this.viewModel.editorHeight=c),l},t=()=>{let s=e();if(!s)return;let l=this.viewModel.modifiedMetadata.textBuffer.getLineCount(),c={padding:pA(l)},u=this._register(TVt(this.configurationService));u.options.enabled&&(c.hideUnchangedRegions=u.options),this._editor.updateOptions(c),this._register(u.onDidChangeEnablement(()=>{c.hideUnchangedRegions=u.options,this._editor.updateOptions(c)})),this._editor.layout({width:this.notebookEditor.getLayoutInfo().width-2*pD,height:s}),this._register(this._editor.onDidContentSizeChange(p=>{this.viewModel.cellFoldingState===0&&p.contentHeightChanged&&this.viewModel.layoutInfo.editorHeight!==p.contentHeight&&(this.viewModel.editorHeight=p.contentHeight)})),this._initializeSourceDiffEditor()};this._cellHeader=this._register(this.instantiationService.createInstance(vB,this.viewModel,this._cellHeaderContainer,this.notebookEditor,{updateInfoRendering:()=>t(),checkIfModified:()=>this.viewModel.originalMetadata.getHash()!==this.viewModel.modifiedMetadata.getHash()?{reason:void 0}:!1,getFoldingState:()=>this.viewModel.cellFoldingState,updateFoldingState:s=>this.viewModel.cellFoldingState=s,unChangedLabel:"Notebook Metadata",changedLabel:"Notebook Metadata changed",prefix:"metadata",menuId:D.NotebookDiffDocumentMetadata})),this._cellHeader.buildHeader(),t();let o=this.contextKeyService.createScoped(this.templateData.inputToolbarContainer);this._register(o);let n=xZe.bindTo(o);n.set(this.viewModel.originalMetadata.getHash()!==this.viewModel.modifiedMetadata.getHash()),this._toolbar=this.templateData.toolbar,this._toolbar.context=this.viewModel;let r=()=>{let s=this.viewModel.originalMetadata.getHash()!==this.viewModel.modifiedMetadata.getHash();if(n.set(s),s){let l=this.menuService.getMenuActions(D.NotebookDiffDocumentMetadata,o,{shouldForwardArgs:!0}),c=Vm(l);this._toolbar.setActions(c)}else this._toolbar.setActions([])};this._register(this.viewModel.modifiedMetadata.onDidChange(()=>{r()})),r()}async _initializeSourceDiffEditor(){let[e,t]=await Promise.all([this.textModelService.createModelReference(this.viewModel.originalMetadata.uri),this.textModelService.createModelReference(this.viewModel.modifiedMetadata.uri)]);if(this._store.isDisposed){e.dispose(),t.dispose();return}this._register(e),this._register(t);let o=this._register(this._editor.createViewModel({original:e.object.textEditorModel,modified:t.object.textEditorModel}));await o.waitForDiff(),this._editor.setModel(o);let n=()=>{this._editorViewStateChanged=!0},r=c=>{(c.scrollTopChanged||c.scrollLeftChanged)&&(this._editorViewStateChanged=!0)};this.updateEditorOptionsForWhitespace(),this._register(this._editor.getOriginalEditor().onDidChangeCursorSelection(n)),this._register(this._editor.getOriginalEditor().onDidScrollChange(r)),this._register(this._editor.getModifiedEditor().onDidChangeCursorSelection(n)),this._register(this._editor.getModifiedEditor().onDidScrollChange(r));let s=this.viewModel.getSourceEditorViewState();s&&this._editor.restoreViewState(s);let l=this._editor.getContentHeight();this.viewModel.editorHeight=l}updateEditorOptionsForWhitespace(){let e=this._editor,t=e.getModel()?.modified.uri||e.getModel()?.original.uri;if(!t)return;let o=this.textConfigurationService.getValue(t,"diffEditor.ignoreTrimWhitespace");e.updateOptions({ignoreTrimWhitespace:o}),this._register(this.textConfigurationService.onDidChangeConfiguration(n=>{if(n.affectsConfiguration(t,"diffEditor")&&n.affectedKeys.has("diffEditor.ignoreTrimWhitespace")){let r=this.textConfigurationService.getValue(t,"diffEditor.ignoreTrimWhitespace");e.updateOptions({ignoreTrimWhitespace:r})}}))}layout(e){$r(Me(this._diffEditorContainer),()=>{e.editorHeight&&(this._editorContainer.style.height=`${this.viewModel.layoutInfo.editorHeight}px`,this._editor.layout({width:this._editor.getViewWidth(),height:this.viewModel.layoutInfo.editorHeight})),e.outerWidth&&(this._editorContainer.style.height=`${this.viewModel.layoutInfo.editorHeight}px`,this._editor.layout()),this.layoutNotebookCell()})}dispose(){this._editor.setModel(null),this._editorViewStateChanged&&this.viewModel.saveSpirceEditorViewState(this._editor.saveViewState()),super.dispose()}};eMe=I([m(3,F),m(4,Nt),m(5,qt),m(6,X),m(7,Nn),m(8,B)],eMe);var DVt=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super();this.notebookEditor=e;this.cell=t;this.templateData=o;this.style=n;this.instantiationService=r;this.languageService=s;this.modelService=l;this.textModelService=c;this.contextMenuService=u;this.keybindingService=p;this.notificationService=h;this.menuService=g;this.contextKeyService=f;this.configurationService=v;this.textConfigurationService=b;this._metadataLocalDisposable=this._register(new P);this._outputLocalDisposable=this._register(new P);this._ignoreMetadata=!1;this._ignoreOutputs=!1;this._isDisposed=!1,this._metadataEditorDisposeStore=this._register(new P),this._outputEditorDisposeStore=this._register(new P),this._register(t.onDidLayoutChange(S=>{this.layout(S)})),this._register(t.onDidLayoutChange(S=>this.updateBorders())),this.init(),this.buildBody(),this._register(t.onDidStateChange(()=>{this.updateOutputRendering(this.cell.renderOutput)}))}buildBody(){let e=this.templateData.body;switch(this._diffEditorContainer=this.templateData.diffEditorContainer,e.classList.remove("left","right","full"),this.style){case"left":e.classList.add("left");break;case"right":e.classList.add("right");break;default:e.classList.add("full");break}this.styleContainer(this._diffEditorContainer),this.updateSourceEditor(),this.cell.modified&&this._register(this.cell.modified.textModel.onDidChangeContent(()=>this._cellHeader.refresh())),this._ignoreMetadata=this.configurationService.getValue("notebook.diff.ignoreMetadata"),this._ignoreMetadata?this._disposeMetadata():this._buildMetadata(),this._ignoreOutputs=this.configurationService.getValue("notebook.diff.ignoreOutputs")||!!this.notebookEditor.textModel?.transientOptions.transientOutputs,this._ignoreOutputs?this._disposeOutput():this._buildOutput(),this._register(this.configurationService.onDidChangeConfiguration(t=>{let o=!1,n=!1;if(t.affectsConfiguration("notebook.diff.ignoreMetadata")){let r=this.configurationService.getValue("notebook.diff.ignoreMetadata");r!==void 0&&this._ignoreMetadata!==r&&(this._ignoreMetadata=r,this._metadataLocalDisposable.clear(),this.configurationService.getValue("notebook.diff.ignoreMetadata")?this._disposeMetadata():(this.cell.metadataStatusHeight=25,this._buildMetadata(),this.updateMetadataRendering(),o=!0))}if(t.affectsConfiguration("notebook.diff.ignoreOutputs")){let r=this.configurationService.getValue("notebook.diff.ignoreOutputs");r!==void 0&&this._ignoreOutputs!==(r||this.notebookEditor.textModel?.transientOptions.transientOutputs)&&(this._ignoreOutputs=r||!!this.notebookEditor.textModel?.transientOptions.transientOutputs,this._outputLocalDisposable.clear(),this._ignoreOutputs?(this._disposeOutput(),this.cell.layoutChange()):(this.cell.outputStatusHeight=25,this._buildOutput(),n=!0))}(o||n)&&this.layout({metadataHeight:o,outputTotalHeight:n})}))}updateMetadataRendering(){this.cell.metadataFoldingState===0?(this._metadataInfoContainer.style.display="block",!this._metadataEditorContainer||!this._metadataEditor?(this._metadataEditorContainer=R(this._metadataInfoContainer,_(".metadata-editor-container")),this._buildMetadataEditor()):this.cell.metadataHeight=this._metadataEditor.getContentHeight()):(this._metadataInfoContainer.style.display="none",this.cell.metadataHeight=0)}updateOutputRendering(e){this.cell.outputFoldingState===0?(this._outputInfoContainer.style.display="block",e?(this._hideOutputsRaw(),this._buildOutputRendererContainer(),this._showOutputsRenderer(),this._showOutputsEmptyView()):(this._hideOutputsRenderer(),this._buildOutputRawContainer(),this._showOutputsRaw())):(this._outputInfoContainer.style.display="none",this._hideOutputsRaw(),this._hideOutputsRenderer(),this._hideOutputsEmptyView())}_buildOutputRawContainer(){this._outputEditorContainer||(this._outputEditorContainer=R(this._outputInfoContainer,_(".output-editor-container")),this._buildOutputEditor())}_showOutputsRaw(){this._outputEditorContainer&&(this._outputEditorContainer.style.display="block",this.cell.rawOutputHeight=this._outputEditor.getContentHeight())}_showOutputsEmptyView(){this.cell.layoutChange()}_hideOutputsRaw(){this._outputEditorContainer&&(this._outputEditorContainer.style.display="none",this.cell.rawOutputHeight=0)}_hideOutputsEmptyView(){this.cell.layoutChange()}_applySanitizedMetadataChanges(e,t){let o={};try{let n=JSON.parse(t),r=new Set([...Object.keys(n)]);for(let l of r)switch(l){case"inputCollapsed":case"outputCollapsed":typeof n[l]=="boolean"?o[l]=n[l]:o[l]=e[l];break;default:o[l]=n[l];break}let s=this.notebookEditor.textModel.cells.indexOf(this.cell.modified.textModel);if(s<0)return;this.notebookEditor.textModel.applyEdits([{editType:3,index:s,metadata:o}],!0,void 0,()=>{},void 0,!0)}catch{}}async _buildMetadataEditor(){if(this._metadataEditorDisposeStore.clear(),this.cell instanceof GC){this._metadataEditor=this.instantiationService.createInstance(Hu,this._metadataEditorContainer,{...XRe,overflowWidgetsDomNode:this.notebookEditor.getOverflowContainerDomNode(),readOnly:!1,originalEditable:!1,ignoreTrimWhitespace:!1,automaticLayout:!1,dimension:{height:this.cell.layoutInfo.metadataHeight,width:this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!0,!0)}},{originalEditor:K4(),modifiedEditor:K4()});let e=this._register(TVt(this.configurationService));e.options.enabled&&this._metadataEditor.updateOptions({hideUnchangedRegions:e.options}),this._metadataEditorDisposeStore.add(e.onDidChangeEnablement(()=>{this._metadataEditor&&this._metadataEditor.updateOptions({hideUnchangedRegions:e.options})})),this.layout({metadataHeight:!0}),this._metadataEditorDisposeStore.add(this._metadataEditor),this._metadataEditorContainer?.classList.add("diff");let[t,o]=await Promise.all([this.textModelService.createModelReference(Zo.generateCellPropertyUri(this.cell.originalDocument.uri,this.cell.original.handle,Y.vscodeNotebookCellMetadata)),this.textModelService.createModelReference(Zo.generateCellPropertyUri(this.cell.modifiedDocument.uri,this.cell.modified.handle,Y.vscodeNotebookCellMetadata))]);if(this._isDisposed){t.dispose(),o.dispose();return}this._metadataEditorDisposeStore.add(t),this._metadataEditorDisposeStore.add(o);let n=this._metadataEditor.createViewModel({original:t.object.textEditorModel,modified:o.object.textEditorModel});if(this._metadataEditor.setModel(n),await n.waitForDiff(),this._isDisposed)return;this.cell.metadataHeight=this._metadataEditor.getContentHeight(),this._metadataEditorDisposeStore.add(this._metadataEditor.onDidContentSizeChange(s=>{s.contentHeightChanged&&this.cell.metadataFoldingState===0&&(this.cell.metadataHeight=s.contentHeight)}));let r=!1;this._metadataEditorDisposeStore.add(o.object.textEditorModel.onDidChangeContent(()=>{r=!0;let s=o.object.textEditorModel.getValue();this._applySanitizedMetadataChanges(this.cell.modified.metadata,s),this._metadataHeader.refresh(),r=!1})),this._metadataEditorDisposeStore.add(this.cell.modified.textModel.onDidChangeMetadata(()=>{if(r)return;let s=QK(this.notebookEditor.textModel?.transientOptions.transientCellMetadata,this.cell.modified?.metadata||{},this.cell.modified?.language,!0);o.object.textEditorModel.setValue(s)}));return}else{this._metadataEditor=this.instantiationService.createInstance(jr,this._metadataEditorContainer,{...YRe,dimension:{width:this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!0),height:this.cell.layoutInfo.metadataHeight},overflowWidgetsDomNode:this.notebookEditor.getOverflowContainerDomNode(),readOnly:!1,allowVariableLineHeights:!1},{}),this.layout({metadataHeight:!0}),this._metadataEditorDisposeStore.add(this._metadataEditor);let e=this.languageService.createById("jsonc"),t=QK(this.notebookEditor.textModel?.transientOptions.transientCellMetadata,this.cell.type==="insert"?this.cell.modified.metadata||{}:this.cell.original.metadata||{},void 0,!0),o=this.cell.type==="insert"?this.cell.modified.uri:this.cell.original.uri,n=this.cell.type==="insert"?this.cell.modified.handle:this.cell.original.handle,r=Zo.generateCellPropertyUri(o,n,Y.vscodeNotebookCellMetadata),s=this.modelService.createModel(t,e,r,!1);this._metadataEditor.setModel(s),this._metadataEditorDisposeStore.add(s),this.cell.metadataHeight=this._metadataEditor.getContentHeight(),this._metadataEditorDisposeStore.add(this._metadataEditor.onDidContentSizeChange(l=>{l.contentHeightChanged&&this.cell.metadataFoldingState===0&&(this.cell.metadataHeight=l.contentHeight)}))}}_buildOutputEditor(){if(this._outputEditorDisposeStore.clear(),(this.cell.type==="modified"||this.cell.type==="unchanged")&&!this.notebookEditor.textModel.transientOptions.transientOutputs){let n=zZ(this.cell.original?.outputs||[]),r=zZ(this.cell.modified?.outputs||[]);if(n!==r){let s=this.languageService.createById("json"),l=this.modelService.createModel(n,s,void 0,!0),c=this.modelService.createModel(r,s,void 0,!0);this._outputEditorDisposeStore.add(l),this._outputEditorDisposeStore.add(c);let u=this.notebookEditor.getLayoutInfo().fontInfo.lineHeight||17,p=Math.max(l.getLineCount(),c.getLineCount());this._outputEditor=this.instantiationService.createInstance(Hu,this._outputEditorContainer,{...XRe,overflowWidgetsDomNode:this.notebookEditor.getOverflowContainerDomNode(),readOnly:!0,ignoreTrimWhitespace:!1,automaticLayout:!1,dimension:{height:Math.min(DZe,this.cell.layoutInfo.rawOutputHeight||u*p),width:this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!0)},accessibilityVerbose:this.configurationService.getValue("accessibility.verbosity.diffEditor")??!1},{originalEditor:K4(),modifiedEditor:K4()}),this._outputEditorDisposeStore.add(this._outputEditor),this._outputEditorContainer?.classList.add("diff"),this._outputEditor.setModel({original:l,modified:c}),this._outputEditor.restoreViewState(this.cell.getOutputEditorViewState()),this.cell.rawOutputHeight=this._outputEditor.getContentHeight(),this._outputEditorDisposeStore.add(this._outputEditor.onDidContentSizeChange(h=>{h.contentHeightChanged&&this.cell.outputFoldingState===0&&(this.cell.rawOutputHeight=h.contentHeight)})),this._outputEditorDisposeStore.add(this.cell.modified.textModel.onDidChangeOutputs(()=>{let h=zZ(this.cell.modified?.outputs||[]);c.setValue(h),this._outputHeader.refresh()}));return}}this._outputEditor=this.instantiationService.createInstance(jr,this._outputEditorContainer,{...YRe,dimension:{width:Math.min(DZe,this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,this.cell.type==="unchanged"||this.cell.type==="modified")-32),height:this.cell.layoutInfo.rawOutputHeight},overflowWidgetsDomNode:this.notebookEditor.getOverflowContainerDomNode(),allowVariableLineHeights:!1},{}),this._outputEditorDisposeStore.add(this._outputEditor);let e=this.languageService.createById("json"),t=zZ(this.notebookEditor.textModel.transientOptions.transientOutputs?[]:this.cell.type==="insert"?this.cell.modified?.outputs||[]:this.cell.original?.outputs||[]),o=this.modelService.createModel(t,e,void 0,!0);this._outputEditorDisposeStore.add(o),this._outputEditor.setModel(o),this._outputEditor.restoreViewState(this.cell.getOutputEditorViewState()),this.cell.rawOutputHeight=this._outputEditor.getContentHeight(),this._outputEditorDisposeStore.add(this._outputEditor.onDidContentSizeChange(n=>{n.contentHeightChanged&&this.cell.outputFoldingState===0&&(this.cell.rawOutputHeight=n.contentHeight)}))}layoutNotebookCell(){this.notebookEditor.layoutNotebookCell(this.cell,this.cell.layoutInfo.totalHeight)}updateBorders(){this.templateData.leftBorder.style.height=`${this.cell.layoutInfo.totalHeight-32}px`,this.templateData.rightBorder.style.height=`${this.cell.layoutInfo.totalHeight-32}px`,this.templateData.bottomBorder.style.top=`${this.cell.layoutInfo.totalHeight-32}px`}dispose(){this._outputEditor&&this.cell.saveOutputEditorViewState(this._outputEditor.saveViewState()),this._metadataEditor&&this.cell.saveMetadataEditorViewState(this._metadataEditor.saveViewState()),this._metadataEditorDisposeStore.dispose(),this._outputEditorDisposeStore.dispose(),this._isDisposed=!0,super.dispose()}},LVt=class extends DVt{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v){super(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v),this.cell=e,this.templateData=t,this.updateBorders()}init(){this._diagonalFill=this.templateData.diagonalFill}buildBody(){let i=this.templateData.body;switch(this._diffEditorContainer=this.templateData.diffEditorContainer,i.classList.remove("left","right","full"),this.style){case"left":i.classList.add("left");break;case"right":i.classList.add("right");break;default:i.classList.add("full");break}this.styleContainer(this._diffEditorContainer),this.updateSourceEditor(),this.configurationService.getValue("notebook.diff.ignoreMetadata")?this._disposeMetadata():this._buildMetadata(),this.configurationService.getValue("notebook.diff.ignoreOutputs")||this.notebookEditor.textModel?.transientOptions.transientOutputs?this._disposeOutput():this._buildOutput(),this._register(this.configurationService.onDidChangeConfiguration(e=>{let t=!1,o=!1;e.affectsConfiguration("notebook.diff.ignoreMetadata")&&(this._metadataLocalDisposable.clear(),this.configurationService.getValue("notebook.diff.ignoreMetadata")?this._disposeMetadata():(this.cell.metadataStatusHeight=25,this._buildMetadata(),this.updateMetadataRendering(),t=!0)),e.affectsConfiguration("notebook.diff.ignoreOutputs")&&(this._outputLocalDisposable.clear(),this.configurationService.getValue("notebook.diff.ignoreOutputs")||this.notebookEditor.textModel?.transientOptions.transientOutputs?this._disposeOutput():(this.cell.outputStatusHeight=25,this._buildOutput(),o=!0)),(t||o)&&this.layout({metadataHeight:t,outputTotalHeight:o})}))}updateSourceEditor(){this._cellHeaderContainer=this.templateData.cellHeaderContainer,this._cellHeaderContainer.style.display="flex",this._cellHeaderContainer.innerText="",this._editorContainer=this.templateData.editorContainer,this._editorContainer.classList.add("diff");let i=()=>{if(this.cell.cellFoldingState===1){this._editorContainer.style.display="none",this.cell.editorHeight=0;return}let e=this.notebookEditor.getLayoutInfo().fontInfo.lineHeight||17,t=this.cell.computeInputEditorHeight(e);if(this._editorContainer.style.height=`${t}px`,this._editorContainer.style.display="block",this._editor){let o=this._editor.getContentHeight();o>=0&&(this.cell.editorHeight=o);return}this._editor=this.templateData.sourceEditor,this._editor.layout({width:(this.notebookEditor.getLayoutInfo().width-2*pD)/2-18,height:t}),this._editor.updateOptions({readOnly:this.readonly}),this.cell.editorHeight=t,this._register(this._editor.onDidContentSizeChange(o=>{this.cell.cellFoldingState===0&&o.contentHeightChanged&&this.cell.layoutInfo.editorHeight!==o.contentHeight&&(this.cell.editorHeight=o.contentHeight)})),this._initializeSourceDiffEditor(this.nestedCellViewModel)};this._cellHeader=this._register(this.instantiationService.createInstance(vB,this.cell,this._cellHeaderContainer,this.notebookEditor,{updateInfoRendering:()=>i(),checkIfModified:()=>({reason:void 0}),getFoldingState:()=>this.cell.cellFoldingState,updateFoldingState:e=>this.cell.cellFoldingState=e,unChangedLabel:"Input",changedLabel:"Input",prefix:"input",menuId:D.NotebookDiffCellInputTitle})),this._cellHeader.buildHeader(),i(),this._initializeSourceDiffEditor(this.nestedCellViewModel)}calculateDiagonalFillHeight(){return this.cell.layoutInfo.cellStatusHeight+this.cell.layoutInfo.editorHeight+this.cell.layoutInfo.editorMargin+this.cell.layoutInfo.metadataStatusHeight+this.cell.layoutInfo.metadataHeight+this.cell.layoutInfo.outputTotalHeight+this.cell.layoutInfo.outputStatusHeight}async _initializeSourceDiffEditor(i){let e=await this.textModelService.createModelReference(i.uri);if(this._isDisposed)return;let t=e.object.textEditorModel;this._register(e),this._editor.setModel(t);let o=this.cell.getSourceEditorViewState();o&&this._editor.restoreViewState(o);let n=this._editor.getContentHeight();this.cell.editorHeight=n;let r=`${this.calculateDiagonalFillHeight()}px`;this._diagonalFill.style.height!==r&&(this._diagonalFill.style.height=r)}_disposeMetadata(){this.cell.metadataStatusHeight=0,this.cell.metadataHeight=0,this.templateData.cellHeaderContainer.style.display="none",this.templateData.metadataHeaderContainer.style.display="none",this.templateData.metadataInfoContainer.style.display="none",this._metadataEditor=void 0}_buildMetadata(){this._metadataHeaderContainer=this.templateData.metadataHeaderContainer,this._metadataInfoContainer=this.templateData.metadataInfoContainer,this._metadataHeaderContainer.style.display="flex",this._metadataInfoContainer.style.display="block",this._metadataHeaderContainer.innerText="",this._metadataInfoContainer.innerText="",this._metadataHeader=this.instantiationService.createInstance(vB,this.cell,this._metadataHeaderContainer,this.notebookEditor,{updateInfoRendering:this.updateMetadataRendering.bind(this),checkIfModified:()=>this.cell.checkMetadataIfModified(),getFoldingState:()=>this.cell.metadataFoldingState,updateFoldingState:i=>{this.cell.metadataFoldingState=i},unChangedLabel:"Metadata",changedLabel:"Metadata changed",prefix:"metadata",menuId:D.NotebookDiffCellMetadataTitle}),this._metadataLocalDisposable.add(this._metadataHeader),this._metadataHeader.buildHeader()}_buildOutput(){this.templateData.outputHeaderContainer.style.display="flex",this.templateData.outputInfoContainer.style.display="block",this._outputHeaderContainer=this.templateData.outputHeaderContainer,this._outputInfoContainer=this.templateData.outputInfoContainer,this._outputHeaderContainer.innerText="",this._outputInfoContainer.innerText="",this._outputHeader=this.instantiationService.createInstance(vB,this.cell,this._outputHeaderContainer,this.notebookEditor,{updateInfoRendering:this.updateOutputRendering.bind(this),checkIfModified:()=>this.cell.checkIfOutputsModified(),getFoldingState:()=>this.cell.outputFoldingState,updateFoldingState:i=>{this.cell.outputFoldingState=i},unChangedLabel:"Outputs",changedLabel:"Outputs changed",prefix:"output",menuId:D.NotebookDiffCellOutputsTitle}),this._outputLocalDisposable.add(this._outputHeader),this._outputHeader.buildHeader()}_disposeOutput(){this._hideOutputsRaw(),this._hideOutputsRenderer(),this._hideOutputsEmptyView(),this.cell.rawOutputHeight=0,this.cell.outputMetadataHeight=0,this.cell.outputStatusHeight=0,this.templateData.outputHeaderContainer.style.display="none",this.templateData.outputInfoContainer.style.display="none",this._outputViewContainer=void 0}},tMe=class extends LVt{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f){super(i,e,t,"left",s,o,n,r,l,c,u,p,h,g,f)}get nestedCellViewModel(){return this.cell.original}get readonly(){return!0}styleContainer(i){i.classList.remove("inserted"),i.classList.add("removed")}layout(i){$r(Me(this._diffEditorContainer),()=>{(i.editorHeight||i.outerWidth)&&this._editor&&(this._editorContainer.style.height=`${this.cell.layoutInfo.editorHeight}px`,this._editor.layout({width:this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!1),height:this.cell.layoutInfo.editorHeight})),i.outerWidth&&this._editor&&(this._editorContainer.style.height=`${this.cell.layoutInfo.editorHeight}px`,this._editor.layout()),(i.metadataHeight||i.outerWidth)&&this._metadataEditor?.layout({width:this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!1),height:this.cell.layoutInfo.metadataHeight}),(i.outputTotalHeight||i.outerWidth)&&this._outputEditor?.layout({width:this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!1),height:this.cell.layoutInfo.outputTotalHeight}),this._diagonalFill&&(this._diagonalFill.style.height=`${this.calculateDiagonalFillHeight()}px`),this.layoutNotebookCell()})}_buildOutputRendererContainer(){if(!this._outputViewContainer){this._outputViewContainer=R(this._outputInfoContainer,_(".output-view-container")),this._outputEmptyElement=R(this._outputViewContainer,_(".output-empty-view"));let i=R(this._outputEmptyElement,_("span"));i.innerText="No outputs to render",this.cell.original?.outputs.length?this._outputEmptyElement.style.display="none":this._outputEmptyElement.style.display="block",this.cell.layoutChange(),this._outputLeftView=this.instantiationService.createInstance(z4,this.notebookEditor,this.notebookEditor.textModel,this.cell,this.cell.original,0,this._outputViewContainer),this._register(this._outputLeftView),this._outputLeftView.render();let e=this.notebookEditor.onDidDynamicOutputRendered(t=>{t.cell.uri.toString()===this.cell.original.uri.toString()&&(this.notebookEditor.deltaCellOutputContainerClassNames(0,this.cell.original.id,["nb-cellDeleted"],[]),e.dispose())});this._register(e)}this._outputViewContainer.style.display="block"}_decorate(){this.notebookEditor.deltaCellOutputContainerClassNames(0,this.cell.original.id,["nb-cellDeleted"],[])}_showOutputsRenderer(){this._outputViewContainer&&(this._outputViewContainer.style.display="block",this._outputLeftView?.showOutputs(),this._decorate())}_hideOutputsRenderer(){this._outputViewContainer&&(this._outputViewContainer.style.display="none",this._outputLeftView?.hideOutputs())}dispose(){this._editor&&this.cell.saveSpirceEditorViewState(this._editor.saveViewState()),super.dispose()}};tMe=I([m(3,kt),m(4,Ct),m(5,Nt),m(6,F),m(7,ze),m(8,_e),m(9,Ne),m(10,qt),m(11,X),m(12,B),m(13,Nn)],tMe);var iMe=class extends LVt{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f){super(i,e,t,"right",o,n,r,s,l,c,u,p,h,g,f)}get nestedCellViewModel(){return this.cell.modified}get readonly(){return!1}styleContainer(i){i.classList.remove("removed"),i.classList.add("inserted")}_buildOutputRendererContainer(){if(!this._outputViewContainer){this._outputViewContainer=R(this._outputInfoContainer,_(".output-view-container")),this._outputEmptyElement=R(this._outputViewContainer,_(".output-empty-view")),this._outputEmptyElement.innerText="No outputs to render",this.cell.modified?.outputs.length?this._outputEmptyElement.style.display="none":this._outputEmptyElement.style.display="block",this.cell.layoutChange(),this._outputRightView=this.instantiationService.createInstance(z4,this.notebookEditor,this.notebookEditor.textModel,this.cell,this.cell.modified,1,this._outputViewContainer),this._register(this._outputRightView),this._outputRightView.render();let i=this.notebookEditor.onDidDynamicOutputRendered(e=>{e.cell.uri.toString()===this.cell.modified.uri.toString()&&(this.notebookEditor.deltaCellOutputContainerClassNames(1,this.cell.modified.id,["nb-cellAdded"],[]),i.dispose())});this._register(i)}this._outputViewContainer.style.display="block"}_decorate(){this.notebookEditor.deltaCellOutputContainerClassNames(1,this.cell.modified.id,["nb-cellAdded"],[])}_showOutputsRenderer(){this._outputViewContainer&&(this._outputViewContainer.style.display="block",this._outputRightView?.showOutputs(),this._decorate())}_hideOutputsRenderer(){this._outputViewContainer&&(this._outputViewContainer.style.display="none",this._outputRightView?.hideOutputs())}layout(i){$r(Me(this._diffEditorContainer),()=>{(i.editorHeight||i.outerWidth)&&this._editor&&(this._editorContainer.style.height=`${this.cell.layoutInfo.editorHeight}px`,this._editor.layout({width:this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!1),height:this.cell.layoutInfo.editorHeight})),i.outerWidth&&this._editor&&(this._editorContainer.style.height=`${this.cell.layoutInfo.editorHeight}px`,this._editor.layout()),(i.metadataHeight||i.outerWidth)&&this._metadataEditor?.layout({width:this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!0),height:this.cell.layoutInfo.metadataHeight}),(i.outputTotalHeight||i.outerWidth)&&this._outputEditor?.layout({width:this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!1),height:this.cell.layoutInfo.outputTotalHeight}),this.layoutNotebookCell(),this._diagonalFill&&(this._diagonalFill.style.height=`${this.calculateDiagonalFillHeight()}px`)})}dispose(){this._editor&&this.cell.saveSpirceEditorViewState(this._editor.saveViewState()),super.dispose()}};iMe=I([m(3,F),m(4,kt),m(5,Ct),m(6,Nt),m(7,ze),m(8,_e),m(9,Ne),m(10,qt),m(11,X),m(12,B),m(13,Nn)],iMe);var ime=class extends DVt{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f){super(i,e,t,"full",o,n,r,s,l,c,u,p,h,g,f),this.cell=e,this.templateData=t,this._editorViewStateChanged=!1,this.updateBorders()}init(){}styleContainer(i){i.classList.remove("inserted","removed")}buildBody(){super.buildBody(),this.cell.displayIconToHideUnmodifiedCells?(this._register(this.templateData.marginOverlay.onAction(()=>this.cell.hideUnchangedCells())),this.templateData.marginOverlay.show()):this.templateData.marginOverlay.hide()}_disposeMetadata(){this.cell.metadataStatusHeight=0,this.cell.metadataHeight=0,this.templateData.metadataHeaderContainer.style.display="none",this.templateData.metadataInfoContainer.style.display="none",this._metadataEditor=void 0}_buildMetadata(){this._metadataHeaderContainer=this.templateData.metadataHeaderContainer,this._metadataInfoContainer=this.templateData.metadataInfoContainer,this._metadataHeaderContainer.style.display="flex",this._metadataInfoContainer.style.display="block",this._metadataHeaderContainer.innerText="",this._metadataInfoContainer.innerText="",this._metadataHeader=this.instantiationService.createInstance(vB,this.cell,this._metadataHeaderContainer,this.notebookEditor,{updateInfoRendering:this.updateMetadataRendering.bind(this),checkIfModified:()=>this.cell.checkMetadataIfModified(),getFoldingState:()=>this.cell.metadataFoldingState,updateFoldingState:i=>{this.cell.metadataFoldingState=i},unChangedLabel:"Metadata",changedLabel:"Metadata changed",prefix:"metadata",menuId:D.NotebookDiffCellMetadataTitle}),this._metadataLocalDisposable.add(this._metadataHeader),this._metadataHeader.buildHeader()}_disposeOutput(){this._hideOutputsRaw(),this._hideOutputsRenderer(),this._hideOutputsEmptyView(),this.cell.rawOutputHeight=0,this.cell.outputMetadataHeight=0,this.cell.outputStatusHeight=0,this.templateData.outputHeaderContainer.style.display="none",this.templateData.outputInfoContainer.style.display="none",this._outputViewContainer=void 0}_buildOutput(){this.templateData.outputHeaderContainer.style.display="flex",this.templateData.outputInfoContainer.style.display="block",this._outputHeaderContainer=this.templateData.outputHeaderContainer,this._outputInfoContainer=this.templateData.outputInfoContainer,this._outputHeaderContainer.innerText="",this._outputInfoContainer.innerText="",this.cell.checkIfOutputsModified()?this._outputInfoContainer.classList.add("modified"):this._outputInfoContainer.classList.remove("modified"),this._outputHeader=this.instantiationService.createInstance(vB,this.cell,this._outputHeaderContainer,this.notebookEditor,{updateInfoRendering:this.updateOutputRendering.bind(this),checkIfModified:()=>this.cell.checkIfOutputsModified(),getFoldingState:()=>this.cell.outputFoldingState,updateFoldingState:i=>{this.cell.outputFoldingState=i},unChangedLabel:"Outputs",changedLabel:"Outputs changed",prefix:"output",menuId:D.NotebookDiffCellOutputsTitle}),this._outputLocalDisposable.add(this._outputHeader),this._outputHeader.buildHeader()}_buildOutputRendererContainer(){if(!this._outputViewContainer){this._outputViewContainer=R(this._outputInfoContainer,_(".output-view-container")),this._outputEmptyElement=R(this._outputViewContainer,_(".output-empty-view")),this._outputEmptyElement.innerText="No outputs to render",!this.cell.checkIfOutputsModified()&&this.cell.modified.outputs.length===0?this._outputEmptyElement.style.display="block":this._outputEmptyElement.style.display="none",this.cell.layoutChange(),this._register(this.cell.modified.textModel.onDidChangeOutputs(()=>{!this.cell.checkIfOutputsModified()&&this.cell.modified.outputs.length===0?this._outputEmptyElement.style.display="block":this._outputEmptyElement.style.display="none",this._decorate()})),this._outputLeftContainer=R(this._outputViewContainer,_(".output-view-container-left")),this._outputRightContainer=R(this._outputViewContainer,_(".output-view-container-right")),this._outputMetadataContainer=R(this._outputViewContainer,_(".output-view-container-metadata"));let i=this.cell.checkIfOutputsModified(),e=i&&i.kind===1&&this.cell.original.outputs.length===1&&this.cell.modified.outputs.length===1&&_co(this.cell.original.outputs[0],this.cell.modified.outputs[0])===1;if(i&&!e){let t=this.notebookEditor.onDidDynamicOutputRendered(n=>{n.cell.uri.toString()===this.cell.original.uri.toString()&&this.cell.checkIfOutputsModified()&&(this.notebookEditor.deltaCellOutputContainerClassNames(0,this.cell.original.id,["nb-cellDeleted"],[]),t.dispose())}),o=this.notebookEditor.onDidDynamicOutputRendered(n=>{n.cell.uri.toString()===this.cell.modified.uri.toString()&&this.cell.checkIfOutputsModified()&&(this.notebookEditor.deltaCellOutputContainerClassNames(1,this.cell.modified.id,["nb-cellAdded"],[]),o.dispose())});this._register(t),this._register(o)}if(this._outputLeftView=this.instantiationService.createInstance(z4,this.notebookEditor,this.notebookEditor.textModel,this.cell,this.cell.original,0,this._outputLeftContainer),this._outputLeftView.render(),this._register(this._outputLeftView),this._outputRightView=this.instantiationService.createInstance(z4,this.notebookEditor,this.notebookEditor.textModel,this.cell,this.cell.modified,1,this._outputRightContainer),this._outputRightView.render(),this._register(this._outputRightView),i&&!e&&this._decorate(),e){this._outputMetadataContainer.style.top=`${this.cell.layoutInfo.rawOutputHeight}px`,this._outputMetadataEditor=this.instantiationService.createInstance(Hu,this._outputMetadataContainer,{...XRe,overflowWidgetsDomNode:this.notebookEditor.getOverflowContainerDomNode(),readOnly:!0,ignoreTrimWhitespace:!1,automaticLayout:!1,dimension:{height:DZe,width:this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!0)}},{originalEditor:K4(),modifiedEditor:K4()}),this._register(this._outputMetadataEditor);let t=JSON.stringify(this.cell.original.outputs[0].metadata??{},void 0," "),o=JSON.stringify(this.cell.modified.outputs[0].metadata??{},void 0," "),n=this.languageService.createById("json"),r=this.modelService.createModel(t,n,void 0,!0),s=this.modelService.createModel(o,n,void 0,!0);this._outputMetadataEditor.setModel({original:r,modified:s}),this.cell.outputMetadataHeight=this._outputMetadataEditor.getContentHeight(),this._register(this._outputMetadataEditor.onDidContentSizeChange(l=>{this.cell.outputMetadataHeight=l.contentHeight}))}}this._outputViewContainer.style.display="block"}_decorate(){this.cell.checkIfOutputsModified()?(this.notebookEditor.deltaCellOutputContainerClassNames(0,this.cell.original.id,["nb-cellDeleted"],[]),this.notebookEditor.deltaCellOutputContainerClassNames(1,this.cell.modified.id,["nb-cellAdded"],[])):(this.notebookEditor.deltaCellOutputContainerClassNames(0,this.cell.original.id,[],["nb-cellDeleted"]),this.notebookEditor.deltaCellOutputContainerClassNames(1,this.cell.modified.id,[],["nb-cellAdded"]))}_showOutputsRenderer(){this._outputViewContainer&&(this._outputViewContainer.style.display="block",this._outputLeftView?.showOutputs(),this._outputRightView?.showOutputs(),this._outputMetadataEditor?.layout({width:this._editor?.getViewWidth()||this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!0),height:this.cell.layoutInfo.outputMetadataHeight}),this._decorate())}_hideOutputsRenderer(){this._outputViewContainer&&(this._outputViewContainer.style.display="none",this._outputLeftView?.hideOutputs(),this._outputRightView?.hideOutputs())}updateSourceEditor(){this._cellHeaderContainer=this.templateData.cellHeaderContainer,this._cellHeaderContainer.style.display="flex",this._cellHeaderContainer.innerText="";let i=this.cell.modified;this._editorContainer=this.templateData.editorContainer,this._editorContainer.classList.add("diff");let e=()=>{if(this.cell.cellFoldingState===1){this._editorContainer.style.display="none",this.cell.editorHeight=0;return}let l=i.textModel.textBuffer.getLineCount(),c=this.notebookEditor.getLayoutInfo().fontInfo.lineHeight||17,u=this.cell.layoutInfo.editorHeight!==0?this.cell.layoutInfo.editorHeight:this.cell.computeInputEditorHeight(c);if(this._editorContainer.style.height=`${u}px`,this._editorContainer.style.display="block",this._editor){let g=this._editor.getContentHeight();g>=0&&(this.cell.editorHeight=g);return}this._editor=this.templateData.sourceEditor;let p={padding:pA(l)},h=this._register(TVt(this.configurationService));h.options.enabled&&(p.hideUnchangedRegions=h.options),this._editor.updateOptions(p),this._register(h.onDidChangeEnablement(()=>{p.hideUnchangedRegions=h.options,this._editor?.updateOptions(p)})),this._editor.layout({width:this.notebookEditor.getLayoutInfo().width-2*pD,height:u}),this._register(this._editor.onDidContentSizeChange(g=>{this.cell.cellFoldingState===0&&g.contentHeightChanged&&this.cell.layoutInfo.editorHeight!==g.contentHeight&&(this.cell.editorHeight=g.contentHeight)})),this._initializeSourceDiffEditor()};this._cellHeader=this._register(this.instantiationService.createInstance(vB,this.cell,this._cellHeaderContainer,this.notebookEditor,{updateInfoRendering:()=>e(),checkIfModified:()=>this.cell.modified?.textModel.getTextBufferHash()!==this.cell.original?.textModel.getTextBufferHash()?{reason:void 0}:!1,getFoldingState:()=>this.cell.cellFoldingState,updateFoldingState:l=>this.cell.cellFoldingState=l,unChangedLabel:"Input",changedLabel:"Input changed",prefix:"input",menuId:D.NotebookDiffCellInputTitle})),this._cellHeader.buildHeader(),e();let t=this.contextKeyService.createScoped(this.templateData.inputToolbarContainer);this._register(t);let o=Zpe.bindTo(t);o.set(this.cell.modified.textModel.getTextBufferHash()!==this.cell.original.textModel.getTextBufferHash());let n=xco.bindTo(t),r=this.textConfigurationService.getValue(this.cell.modified.uri,"diffEditor.ignoreTrimWhitespace");n.set(r),this._toolbar=this.templateData.toolbar,this._toolbar.context=this.cell;let s=()=>{let l=this.textConfigurationService.getValue(this.cell.modified.uri,"diffEditor.ignoreTrimWhitespace");n.set(l);let c=this.cell.modified.textModel.getTextBufferHash()!==this.cell.original.textModel.getTextBufferHash();if(o.set(c),c){let u=this.menuService.getMenuActions(D.NotebookDiffCellInputTitle,t,{shouldForwardArgs:!0}),p=Vm(u);this._toolbar.setActions(p)}else this._toolbar.setActions([])};this._register(this.cell.modified.textModel.onDidChangeContent(()=>s())),this._register(this.textConfigurationService.onDidChangeConfiguration(l=>{l.affectsConfiguration(this.cell.modified.uri,"diffEditor")&&l.affectedKeys.has("diffEditor.ignoreTrimWhitespace")&&s()})),s()}async _initializeSourceDiffEditor(){let[i,e]=await Promise.all([this.textModelService.createModelReference(this.cell.original.uri),this.textModelService.createModelReference(this.cell.modified.uri)]);if(this._register(i),this._register(e),this._isDisposed){i.dispose(),e.dispose();return}let t=this._register(this._editor.createViewModel({original:i.object.textEditorModel,modified:e.object.textEditorModel}));await t.waitForDiff(),this._editor.setModel(t);let o=()=>{this._editorViewStateChanged=!0},n=l=>{(l.scrollTopChanged||l.scrollLeftChanged)&&(this._editorViewStateChanged=!0)};this.updateEditorOptionsForWhitespace(),this._register(this._editor.getOriginalEditor().onDidChangeCursorSelection(o)),this._register(this._editor.getOriginalEditor().onDidScrollChange(n)),this._register(this._editor.getModifiedEditor().onDidChangeCursorSelection(o)),this._register(this._editor.getModifiedEditor().onDidScrollChange(n));let r=this.cell.getSourceEditorViewState();r&&this._editor.restoreViewState(r);let s=this._editor.getContentHeight();this.cell.editorHeight=s}updateEditorOptionsForWhitespace(){let i=this._editor;if(!i)return;let e=i.getModel()?.modified.uri||i.getModel()?.original.uri;if(!e)return;let t=this.textConfigurationService.getValue(e,"diffEditor.ignoreTrimWhitespace");i.updateOptions({ignoreTrimWhitespace:t}),this._register(this.textConfigurationService.onDidChangeConfiguration(o=>{if(o.affectsConfiguration(e,"diffEditor")&&o.affectedKeys.has("diffEditor.ignoreTrimWhitespace")){let n=this.textConfigurationService.getValue(e,"diffEditor.ignoreTrimWhitespace");i.updateOptions({ignoreTrimWhitespace:n})}}))}layout(i){$r(Me(this._diffEditorContainer),()=>{i.editorHeight&&this._editor&&(this._editorContainer.style.height=`${this.cell.layoutInfo.editorHeight}px`,this._editor.layout({width:this._editor.getViewWidth(),height:this.cell.layoutInfo.editorHeight})),i.outerWidth&&this._editor&&(this._editorContainer.style.height=`${this.cell.layoutInfo.editorHeight}px`,this._editor.layout()),(i.metadataHeight||i.outerWidth)&&this._metadataEditorContainer&&(this._metadataEditorContainer.style.height=`${this.cell.layoutInfo.metadataHeight}px`,this._metadataEditor?.layout({width:this._editor?.getViewWidth()||this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!0),height:this.cell.layoutInfo.metadataHeight})),(i.outputTotalHeight||i.outerWidth)&&(this._outputEditorContainer&&(this._outputEditorContainer.style.height=`${this.cell.layoutInfo.outputTotalHeight}px`,this._outputEditor?.layout({width:this._editor?.getViewWidth()||this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!0),height:this.cell.layoutInfo.outputTotalHeight})),this._outputMetadataContainer&&(this._outputMetadataContainer.style.height=`${this.cell.layoutInfo.outputMetadataHeight}px`,this._outputMetadataContainer.style.top=`${this.cell.layoutInfo.outputTotalHeight-this.cell.layoutInfo.outputMetadataHeight}px`,this._outputMetadataEditor?.layout({width:this._editor?.getViewWidth()||this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!0),height:this.cell.layoutInfo.outputMetadataHeight}))),this.layoutNotebookCell()})}dispose(){this._editor&&this._editor.setModel(null),this._editor&&this._editorViewStateChanged&&this.cell.saveSpirceEditorViewState(this._editor.saveViewState()),super.dispose()}};ime=I([m(3,F),m(4,kt),m(5,Ct),m(6,Nt),m(7,ze),m(8,_e),m(9,Ne),m(10,qt),m(11,X),m(12,B),m(13,Nn)],ime);var RVt=class extends C{constructor(e){super();this.container=e;this._nodes=bt("div.diff-hidden-cells",[bt("div.center@content",{style:{display:"flex"}},[_("a",{title:d(11874,null),role:"button",onclick:()=>{this._action.fire()}},...Bn("$(unfold)"))])]);this._action=this._register(new E);this.onAction=this._action.event;this._nodes.root.style.display="none",e.appendChild(this._nodes.root)}show(){this._nodes.root.style.display="block"}hide(){this._nodes.root.style.display="none"}dispose(){this.hide(),this.container.removeChild(this._nodes.root),Fi(this._nodes.root),super.dispose()}},LZe=class extends C{constructor(e){super();this.container=e;this._nodes=bt("div.diff-hidden-cells",[bt("div.center@content",{style:{display:"flex"}},[_("a",{title:d(11873,null),role:"button",onclick:()=>{this._action.fire()}},...Bn("$(fold)"))])]);this._action=this._register(new E);this.onAction=this._action.event;this._nodes.root.style.display="none",e.appendChild(this._nodes.root)}show(){this._nodes.root.style.display="block"}hide(){this._nodes.root.style.display="none"}dispose(){this.hide(),this.container.removeChild(this._nodes.root),Fi(this._nodes.root),super.dispose()}};var oMe=class{constructor(i,e){this.configurationService=e;let t=this.configurationService.getValue("editor");this.lineHeight=LS(t,Xd.getInstance(i).value).lineHeight}getHeight(i){return i.getHeight(this.lineHeight)}hasDynamicHeight(i){return!1}getTemplateId(i){switch(i.type){case"delete":case"insert":return q4.TEMPLATE_ID;case"modified":case"unchanged":return j4.TEMPLATE_ID;case"placeholder":return G4.TEMPLATE_ID;case"modifiedMetadata":case"unchangedMetadata":return $4.TEMPLATE_ID}}};oMe=I([m(1,B)],oMe);var G4=class{constructor(i,e){this.notebookEditor=i;this.instantiationService=e}static{this.TEMPLATE_ID="cell_diff_placeholder"}get templateId(){return G4.TEMPLATE_ID}renderTemplate(i){let e=_(".cell-placeholder-body");R(i,e);let t=new P,o=new RVt(e),n=R(e,_(".contents")),r=R(n,_("span.text",{title:d(11908,null)}));return{body:e,container:i,placeholder:r,marginOverlay:o,elementDisposables:t}}renderElement(i,e,t){t.body.classList.remove("left","right","full"),t.elementDisposables.add(this.instantiationService.createInstance(_Vt,i,t))}disposeTemplate(i){i.container.innerText=""}disposeElement(i,e,t){t.elementDisposables.clear()}};G4=I([m(1,F)],G4);var $4=class{constructor(i,e,t,o,n,r,s,l,c){this.notebookEditor=i;this.instantiationService=e;this.contextMenuService=t;this.keybindingService=o;this.menuService=n;this.contextKeyService=r;this.notificationService=s;this.themeService=l;this.accessibilityService=c}static{this.TEMPLATE_ID="notebook_metadata_diff_side_by_side"}get templateId(){return $4.TEMPLATE_ID}renderTemplate(i){let e=_(".cell-body");R(i,e);let t=_(".cell-diff-editor-container");R(e,t);let o=R(t,_(".input-header-container")),n=R(t,_(".source-container")),{editor:r,editorContainer:s}=this._buildSourceEditor(n),l=R(n,_(".editor-input-toolbar-container")),c=R(l,_("div.property-toolbar")),u=this.instantiationService.createInstance(Ol,c,{actionViewItemProvider:(y,w)=>{if(y instanceof Eo)return new VR(y,{hoverDelegate:w.hoverDelegate},this.keybindingService,this.notificationService,this.contextKeyService,this.themeService,this.contextMenuService,this.accessibilityService)},highlightToggledItems:!0}),p=R(e,_(".border-container")),h=R(p,_(".left-border")),g=R(p,_(".right-border")),f=R(p,_(".top-border")),v=R(p,_(".bottom-border")),b=new LZe(e),S=new P;return{body:e,container:i,diffEditorContainer:t,cellHeaderContainer:o,sourceEditor:r,editorContainer:s,inputToolbarContainer:l,toolbar:u,leftBorder:h,rightBorder:g,topBorder:f,bottomBorder:v,marginOverlay:b,elementDisposables:S}}_buildSourceEditor(i){return Dco(this.instantiationService,this.notebookEditor,i,{readOnly:!0})}renderElement(i,e,t){t.body.classList.remove("full"),t.elementDisposables.add(this.instantiationService.createInstance(eMe,this.notebookEditor,i,t))}disposeTemplate(i){i.container.innerText="",i.sourceEditor.dispose(),i.toolbar?.dispose(),i.elementDisposables.dispose()}disposeElement(i,e,t){t.toolbar&&(t.toolbar.context=void 0),t.elementDisposables.clear()}};$4=I([m(1,F),m(2,ze),m(3,_e),m(4,qt),m(5,X),m(6,Ne),m(7,De),m(8,Bi)],$4);var q4=class{constructor(i,e){this.notebookEditor=i;this.instantiationService=e}static{this.TEMPLATE_ID="cell_diff_single"}get templateId(){return q4.TEMPLATE_ID}renderTemplate(i){let e=_(".cell-body");R(i,e);let t=_(".cell-diff-editor-container");R(e,t);let o=R(e,_(".diagonal-fill")),n=R(t,_(".input-header-container")),r=R(t,_(".source-container")),{editor:s,editorContainer:l}=this._buildSourceEditor(r),c=R(t,_(".metadata-header-container")),u=R(t,_(".metadata-info-container")),p=R(t,_(".output-header-container")),h=R(t,_(".output-info-container")),g=R(e,_(".border-container")),f=R(g,_(".left-border")),v=R(g,_(".right-border")),b=R(g,_(".top-border")),S=R(g,_(".bottom-border"));return{body:e,container:i,editorContainer:l,diffEditorContainer:t,diagonalFill:o,cellHeaderContainer:n,sourceEditor:s,metadataHeaderContainer:c,metadataInfoContainer:u,outputHeaderContainer:p,outputInfoContainer:h,leftBorder:f,rightBorder:v,topBorder:b,bottomBorder:S,elementDisposables:new P}}_buildSourceEditor(i){return z8o(this.instantiationService,this.notebookEditor,i)}renderElement(i,e,t){switch(t.body.classList.remove("left","right","full"),i.type){case"delete":t.elementDisposables.add(this.instantiationService.createInstance(tMe,this.notebookEditor,i,t));return;case"insert":t.elementDisposables.add(this.instantiationService.createInstance(iMe,this.notebookEditor,i,t));return;default:break}}disposeTemplate(i){i.container.innerText="",i.sourceEditor.dispose(),i.elementDisposables.dispose()}disposeElement(i,e,t){t.elementDisposables.clear()}};q4=I([m(1,F)],q4);var j4=class{constructor(i,e,t,o,n,r,s,l,c){this.notebookEditor=i;this.instantiationService=e;this.contextMenuService=t;this.keybindingService=o;this.menuService=n;this.contextKeyService=r;this.notificationService=s;this.themeService=l;this.accessibilityService=c}static{this.TEMPLATE_ID="cell_diff_side_by_side"}get templateId(){return j4.TEMPLATE_ID}renderTemplate(i){let e=_(".cell-body");R(i,e);let t=_(".cell-diff-editor-container");R(e,t);let o=R(t,_(".input-header-container")),n=R(t,_(".source-container")),{editor:r,editorContainer:s}=this._buildSourceEditor(n),l=R(n,_(".editor-input-toolbar-container")),c=R(l,_("div.property-toolbar")),u=this.instantiationService.createInstance(Ol,c,{actionViewItemProvider:(N,O)=>{if(N instanceof Eo)return new VR(N,{hoverDelegate:O.hoverDelegate},this.keybindingService,this.notificationService,this.contextKeyService,this.themeService,this.contextMenuService,this.accessibilityService)},highlightToggledItems:!0}),p=R(t,_(".metadata-header-container")),h=R(t,_(".metadata-info-container")),g=R(t,_(".output-header-container")),f=R(t,_(".output-info-container")),v=R(e,_(".border-container")),b=R(v,_(".left-border")),S=R(v,_(".right-border")),y=R(v,_(".top-border")),w=R(v,_(".bottom-border")),k=new LZe(e),T=new P;return{body:e,container:i,diffEditorContainer:t,cellHeaderContainer:o,sourceEditor:r,editorContainer:s,inputToolbarContainer:l,toolbar:u,metadataHeaderContainer:p,metadataInfoContainer:h,outputHeaderContainer:g,outputInfoContainer:f,leftBorder:b,rightBorder:S,topBorder:y,bottomBorder:w,marginOverlay:k,elementDisposables:T}}_buildSourceEditor(i){return Dco(this.instantiationService,this.notebookEditor,i)}renderElement(i,e,t){switch(t.body.classList.remove("left","right","full"),i.type){case"unchanged":t.elementDisposables.add(this.instantiationService.createInstance(ime,this.notebookEditor,i,t));return;case"modified":t.elementDisposables.add(this.instantiationService.createInstance(ime,this.notebookEditor,i,t));return;default:break}}disposeTemplate(i){i.container.innerText="",i.sourceEditor.dispose(),i.toolbar?.dispose(),i.elementDisposables.dispose()}disposeElement(i,e,t){t.toolbar&&(t.toolbar.context=void 0),t.elementDisposables.clear()}};j4=I([m(1,F),m(2,ze),m(3,_e),m(4,qt),m(5,X),m(6,Ne),m(7,De),m(8,Bi)],j4);var wwi=class extends gae{onViewPointer(i){if(G9(i.browserEvent.target)){let e=typeof i.index>"u"?[]:[i.index];this.list.setFocus(e,i.browserEvent)}else super.onViewPointer(i)}},nMe=class extends Rl{get rowsContainer(){return this.view.containerDomNode}constructor(i,e,t,o,n,r,s,l,c){super(i,e,t,o,r,n,s,l,c)}createMouseController(i){return new wwi(this)}getCellViewScrollTop(i){let e=this.indexOf(i);return this.view.elementTop(e)}getScrollHeight(){return this.view.scrollHeight}triggerScrollFromMouseWheelEvent(i){this.view.delegateScrollFromMouseWheelEvent(i)}delegateVerticalScrollbarPointerDown(i){this.view.delegateVerticalScrollbarPointerDown(i)}clear(){super.splice(0,this.length)}updateElementHeight2(i,e){let t=this.indexOf(i),o=this.getFocus();this.view.updateElementHeight(t,e,o.length?o[0]:null)}style(i){let e=this.view.domId;this.styleElement||(this.styleElement=hr(this.view.domNode));let t=e&&`.${e}`,o=[];i.listBackground&&o.push(`.monaco-list${t} > div.monaco-scrollable-element > .monaco-list-rows { background: ${i.listBackground}; }`),i.listFocusBackground&&(o.push(`.monaco-list${t}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { background-color: ${i.listFocusBackground}; }`),o.push(`.monaco-list${t}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused:hover { background-color: ${i.listFocusBackground}; }`)),i.listFocusForeground&&o.push(`.monaco-list${t}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { color: ${i.listFocusForeground}; }`),i.listActiveSelectionBackground&&(o.push(`.monaco-list${t}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { background-color: ${i.listActiveSelectionBackground}; }`),o.push(`.monaco-list${t}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected:hover { background-color: ${i.listActiveSelectionBackground}; }`)),i.listActiveSelectionForeground&&o.push(`.monaco-list${t}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { color: ${i.listActiveSelectionForeground}; }`),i.listFocusAndSelectionBackground&&o.push(`
.monaco-drag-image${t},
.monaco-list${t}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected.focused { background-color: ${i.listFocusAndSelectionBackground}; }
`),i.listFocusAndSelectionForeground&&o.push(`
.monaco-drag-image${t},
.monaco-list${t}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected.focused { color: ${i.listFocusAndSelectionForeground}; }
`),i.listInactiveFocusBackground&&(o.push(`.monaco-list${t} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { background-color: ${i.listInactiveFocusBackground}; }`),o.push(`.monaco-list${t} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused:hover { background-color: ${i.listInactiveFocusBackground}; }`)),i.listInactiveSelectionBackground&&(o.push(`.monaco-list${t} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { background-color: ${i.listInactiveSelectionBackground}; }`),o.push(`.monaco-list${t} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected:hover { background-color: ${i.listInactiveSelectionBackground}; }`)),i.listInactiveSelectionForeground&&o.push(`.monaco-list${t} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { color: ${i.listInactiveSelectionForeground}; }`),i.listHoverBackground&&o.push(`.monaco-list${t}:not(.drop-target) > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row:hover:not(.selected):not(.focused) { background-color: ${i.listHoverBackground}; }`),i.listHoverForeground&&o.push(`.monaco-list${t} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row:hover:not(.selected):not(.focused) { color: ${i.listHoverForeground}; }`),i.listSelectionOutline&&o.push(`.monaco-list${t} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { outline: 1px dotted ${i.listSelectionOutline}; outline-offset: -1px; }`),i.listFocusOutline&&o.push(`
.monaco-drag-image${t},
.monaco-list${t}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { outline: 1px solid ${i.listFocusOutline}; outline-offset: -1px; }
`),i.listInactiveFocusOutline&&o.push(`.monaco-list${t} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { outline: 1px dotted ${i.listInactiveFocusOutline}; outline-offset: -1px; }`),i.listHoverOutline&&o.push(`.monaco-list${t} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row:hover { outline: 1px dashed ${i.listHoverOutline}; outline-offset: -1px; }`),i.listDropOverBackground&&o.push(`
.monaco-list${t}.drop-target,
.monaco-list${t} > div.monaco-scrollable-element > .monaco-list-rows.drop-target,
.monaco-list${t} > div.monaco-scrollable-element > .monaco-list-row.drop-target { background-color: ${i.listDropOverBackground} !important; color: inherit !important; }
`);let n=o.join(`
`);n!==this.styleElement.textContent&&(this.styleElement.textContent=n)}};nMe=I([m(6,fo),m(7,B),m(8,F)],nMe);function Dco(a,i,e,t={}){let o=R(e,_(".editor-container"));return{editor:a.createInstance(Hu,o,{...XRe,overflowWidgetsDomNode:i.getOverflowContainerDomNode(),originalEditable:!1,ignoreTrimWhitespace:!1,automaticLayout:!1,dimension:{height:0,width:0},renderSideBySide:!0,useInlineViewWhenSpaceIsLimited:!1,...t},{originalEditor:K4(),modifiedEditor:K4()}),editorContainer:o}}function z8o(a,i,e,t={}){let o=R(e,_(".editor-container")),n=["editor.contrib.emptyTextEditorHint"];return{editor:a.createInstance(jr,o,{...YRe,glyphMargin:!1,dimension:{width:(i.getLayoutInfo().width-2*pD)/2-18,height:0},automaticLayout:!1,overflowWidgetsDomNode:i.getOverflowContainerDomNode(),allowVariableLineHeights:!1,readOnly:!0},{contributions:aa.getEditorContributions().filter(s=>n.indexOf(s.id)===-1)}),editorContainer:o}}var K8o="notebookEditorWorkerService",JK=ae(K8o);var G8o=20,rMe=class extends Jd{constructor(e,t,o,n){super(n);this.notebookEditor=e;this.width=t;this._diffElementViewModels=[];this._lanes=2;this._insertColor=null,this._removeColor=null,this._insertColorHex=null,this._removeColorHex=null,this._disposables=this._register(new P),this._renderAnimationFrame=null,this._domNode=or(document.createElement("canvas")),this._domNode.setPosition("relative"),this._domNode.setLayerHinting(!0),this._domNode.setContain("strict"),o.appendChild(this._domNode.domNode),this._overviewViewportDomElement=or(document.createElement("div")),this._overviewViewportDomElement.setClassName("diffViewport"),this._overviewViewportDomElement.setPosition("absolute"),this._overviewViewportDomElement.setWidth(t),o.appendChild(this._overviewViewportDomElement.domNode),this._register(Xd.getInstance(Me(this._domNode.domNode)).onDidChange(()=>{this._scheduleRender()})),this._register(this.themeService.onDidColorThemeChange(r=>{this.applyColors(r)&&this._scheduleRender()})),this.applyColors(this.themeService.getColorTheme()),this._register(this.notebookEditor.onDidScroll(()=>{this._renderOverviewViewport()})),this._register(Vo(o,re.POINTER_DOWN,r=>{this.notebookEditor.delegateVerticalScrollbarPointerDown(r)}))}applyColors(e){let t=e.getColor(sgt)||(e.getColor(Hg)||$Se).transparent(2),o=e.getColor(agt)||(e.getColor(Cf)||qSe).transparent(2),n=!t.equals(this._insertColor)||!o.equals(this._removeColor);return this._insertColor=t,this._removeColor=o,this._insertColor&&(this._insertColorHex=Oe.Format.CSS.formatHexA(this._insertColor)),this._removeColor&&(this._removeColorHex=Oe.Format.CSS.formatHexA(this._removeColor)),n}layout(){this._layoutNow()}updateViewModels(e,t){this._disposables.clear(),this._diffElementViewModels=e,t&&(this._disposables.add(t.onDidChangeLayout(()=>{this._scheduleRender()})),this._disposables.add(t.onDidChangeCellLayout(()=>{this._scheduleRender()}))),this._scheduleRender()}_scheduleRender(){this._renderAnimationFrame===null&&(this._renderAnimationFrame=Ah(Me(this._domNode.domNode),this._onRenderScheduled.bind(this),16))}_onRenderScheduled(){this._renderAnimationFrame=null,this._layoutNow()}_layoutNow(){let t=this.notebookEditor.getLayoutInfo().height,o=this._diffElementViewModels.map(s=>s.totalHeight).reduce((s,l)=>s+l,0),n=Xd.getInstance(Me(this._domNode.domNode)).value;this._domNode.setWidth(this.width),this._domNode.setHeight(t),this._domNode.domNode.width=this.width*n,this._domNode.domNode.height=t*n;let r=this._domNode.domNode.getContext("2d");r.clearRect(0,0,this.width*n,t*n),this._renderCanvas(r,this.width*n,t*n,o*n,n),this._renderOverviewViewport()}_renderOverviewViewport(){let e=this._computeOverviewViewport();e?(this._overviewViewportDomElement.setTop(e.top),this._overviewViewportDomElement.setHeight(e.height)):(this._overviewViewportDomElement.setTop(0),this._overviewViewportDomElement.setHeight(0))}_computeOverviewViewport(){let e=this.notebookEditor.getLayoutInfo();if(!e)return null;let t=this.notebookEditor.getScrollTop(),o=this.notebookEditor.getScrollHeight(),n=Math.max(0,e.height),r=Math.max(0,n-0),s=e.height,l=Math.round(Math.max(G8o,Math.floor(s*r/o))),c=(r-l)/(o-s),u=Math.round(t*c);return{height:l,top:u}}_renderCanvas(e,t,o,n,r){if(!this._insertColorHex||!this._removeColorHex)return;let s=t/this._lanes,l=0;for(let c=0;c<this._diffElementViewModels.length;c++){let u=this._diffElementViewModels[c],p=Math.round(u.totalHeight/n*r*o);switch(u.type){case"insert":e.fillStyle=this._insertColorHex,e.fillRect(s,l,s,p);break;case"delete":e.fillStyle=this._removeColorHex,e.fillRect(0,l,s,p);break;case"unchanged":case"unchangedMetadata":break;case"modified":case"modifiedMetadata":e.fillStyle=this._removeColorHex,e.fillRect(0,l,s,p),e.fillStyle=this._insertColorHex,e.fillRect(s,l,s,p);break}l+=p}}dispose(){this._renderAnimationFrame!==null&&(this._renderAnimationFrame.dispose(),this._renderAnimationFrame=null),super.dispose()}};rMe=I([m(3,De)],rMe);function sMe(a,i,e){let t=e.cellsDiff.changes,o=[],n=0,r=0,s=-1;for(let l=0;l<t.length;l++){let c=t[l];for(let p=0;p<c.originalStart-n;p++){let h=a.cells[n+p],g=i.cells[r+p];h.getHashValue()===g.getHashValue()?o.push({originalCellIndex:n+p,modifiedCellIndex:r+p,type:"unchanged"}):(s===-1&&(s=o.length),o.push({originalCellIndex:n+p,modifiedCellIndex:r+p,type:"modified"}))}let u=$8o(c,a,i);u.length&&s===-1&&(s=o.length),o.push(...u),n=c.originalStart+c.originalLength,r=c.modifiedStart+c.modifiedLength}for(let l=n;l<a.cells.length;l++)o.push({originalCellIndex:l,modifiedCellIndex:l-n+r,type:"unchanged"});return{cellDiffInfo:o,firstChangeIndex:s}}function $8o(a,i,e){let t=[],o=Math.min(a.originalLength,a.modifiedLength);for(let n=0;n<o;n++){let r=i.cells[a.originalStart+n],s=e.cells[a.modifiedStart+n];if(r.cellKind!==s.cellKind)t.push({originalCellIndex:a.originalStart+n,type:"delete"}),t.push({modifiedCellIndex:a.modifiedStart+n,type:"insert"});else{let l=r.equal(s);t.push({originalCellIndex:a.originalStart+n,modifiedCellIndex:a.modifiedStart+n,type:l?"unchanged":"modified"})}}for(let n=o;n<a.originalLength;n++)t.push({originalCellIndex:a.originalStart+n,type:"delete"});for(let n=o;n<a.modifiedLength;n++)t.push({modifiedCellIndex:a.modifiedStart+n,type:"insert"});return t}var aMe=class extends C{constructor(e,t,o,n,r,s,l,c){super();this.model=e;this.notebookEditorWorkerService=t;this.configurationService=o;this.eventDispatcher=n;this.notebookService=r;this.diffEditorHeightCalculator=s;this.fontInfo=l;this.excludeUnchangedPlaceholder=c;this.placeholderAndRelatedCells=new Map;this._items=[];this._onDidChangeItems=this._register(new E);this.onDidChangeItems=this._onDidChangeItems.event;this.disposables=this._register(new P);this._onDidChange=this._register(new E);this.diffEditorItems=[];this.onDidChange=this._onDidChange.event;this.originalCellViewModels=[];this.hideOutput=this.model.modified.notebook.transientOptions.transientOutputs||this.configurationService.getValue("notebook.diff.ignoreOutputs"),this.ignoreMetadata=this.configurationService.getValue("notebook.diff.ignoreMetadata"),this._register(this.configurationService.onDidChangeConfiguration(u=>{let p=!1,h=!1;if(u.affectsConfiguration("notebook.diff.ignoreMetadata")){let g=this.configurationService.getValue("notebook.diff.ignoreMetadata");g!==void 0&&this.ignoreMetadata!==g&&(this.ignoreMetadata=g,p=!0,h=!0)}if(u.affectsConfiguration("notebook.diff.ignoreOutputs")){let g=this.configurationService.getValue("notebook.diff.ignoreOutputs");g!==void 0&&this.hideOutput!==(g||this.model.modified.notebook.transientOptions.transientOutputs)&&(this.hideOutput=g||!!this.model.modified.notebook.transientOptions.transientOutputs,p=!0)}h&&this.toggleNotebookMetadata(),p&&this._onDidChange.fire()}))}get items(){return this._items}get value(){return this.diffEditorItems.filter(e=>e.type!=="placeholder").filter(e=>this._includeUnchanged?!0:e instanceof ome||e instanceof KZ||e instanceof GZ?!(e.type==="unchanged"&&e.containerType==="unchanged"):!0).filter(e=>e instanceof GZ?!this.hideOutput:!0).filter(e=>e instanceof KZ?!this.ignoreMetadata:!0)}get hasUnchangedCells(){return this._hasUnchangedCells===!0}get includeUnchanged(){return this._includeUnchanged===!0}set includeUnchanged(e){this._includeUnchanged=e,this._onDidChange.fire()}dispose(){this.clear(),super.dispose()}clear(){this.disposables.clear(),Ue(Array.from(this.placeholderAndRelatedCells.keys())),this.placeholderAndRelatedCells.clear(),Ue(this.originalCellViewModels),this.originalCellViewModels=[],Ue(this._items),this._items.splice(0,this._items.length)}async computeDiff(e){let t=await wa(this.notebookEditorWorkerService.computeDiff(this.model.original.resource,this.model.modified.resource),e);if(!t||e.isCancellationRequested)return;q8o(this.model.original.notebook,this.model.modified.notebook,t.cellsDiff);let{cellDiffInfo:o,firstChangeIndex:n}=sMe(this.model.original.notebook,this.model.modified.notebook,t);if(!j8o(o,this.originalCellViewModels,this.model)){if(await wa(this.updateViewModels(o,t.metadataChanged,n),e),e.isCancellationRequested)return;this.updateDiffEditorItems()}}toggleNotebookMetadata(){this.notebookMetadataViewModel&&(this.ignoreMetadata?this._items.length&&this._items[0]===this.notebookMetadataViewModel&&(this._items.splice(0,1),this._onDidChangeItems.fire({start:0,deleteCount:1,elements:[]})):(!this._items.length||this._items[0]!==this.notebookMetadataViewModel)&&(this._items.splice(0,0,this.notebookMetadataViewModel),this._onDidChangeItems.fire({start:0,deleteCount:0,elements:[this.notebookMetadataViewModel]})))}updateDiffEditorItems(){this.diffEditorItems=[];let e=this.model.original.resource,t=this.model.modified.resource;this._hasUnchangedCells=!1,this.items.forEach(o=>{switch(o.type){case"delete":{this.diffEditorItems.push(new ome(o.original.uri,void 0,o.type,o.type));let n=Zo.generateCellPropertyUri(e,o.original.handle,Y.vscodeNotebookCellMetadata);this.diffEditorItems.push(new KZ(n,void 0,o.type,o.type));let r=Zo.generateCellPropertyUri(e,o.original.handle,Y.vscodeNotebookCellOutput);this.diffEditorItems.push(new GZ(r,void 0,o.type,o.type));break}case"insert":{this.diffEditorItems.push(new ome(void 0,o.modified.uri,o.type,o.type));let n=Zo.generateCellPropertyUri(t,o.modified.handle,Y.vscodeNotebookCellMetadata);this.diffEditorItems.push(new KZ(void 0,n,o.type,o.type));let r=Zo.generateCellPropertyUri(t,o.modified.handle,Y.vscodeNotebookCellOutput);this.diffEditorItems.push(new GZ(void 0,r,o.type,o.type));break}case"modified":{let n=o.checkIfInputModified()?o.type:"unchanged",r=o.checkIfInputModified()||o.checkMetadataIfModified()||o.checkIfOutputsModified()?o.type:"unchanged";this.diffEditorItems.push(new ome(o.original.uri,o.modified.uri,n,r));let s=Zo.generateCellPropertyUri(e,o.original.handle,Y.vscodeNotebookCellMetadata),l=Zo.generateCellPropertyUri(t,o.modified.handle,Y.vscodeNotebookCellMetadata);this.diffEditorItems.push(new KZ(s,l,o.checkMetadataIfModified()?o.type:"unchanged",r));let c=Zo.generateCellPropertyUri(e,o.original.handle,Y.vscodeNotebookCellOutput),u=Zo.generateCellPropertyUri(t,o.modified.handle,Y.vscodeNotebookCellOutput);this.diffEditorItems.push(new GZ(c,u,o.checkIfOutputsModified()?o.type:"unchanged",r));break}case"unchanged":{this._hasUnchangedCells=!0,this.diffEditorItems.push(new ome(o.original.uri,o.modified.uri,o.type,o.type));let n=Zo.generateCellPropertyUri(e,o.original.handle,Y.vscodeNotebookCellMetadata),r=Zo.generateCellPropertyUri(t,o.modified.handle,Y.vscodeNotebookCellMetadata);this.diffEditorItems.push(new KZ(n,r,o.type,o.type));let s=Zo.generateCellPropertyUri(e,o.original.handle,Y.vscodeNotebookCellOutput),l=Zo.generateCellPropertyUri(t,o.modified.handle,Y.vscodeNotebookCellOutput);this.diffEditorItems.push(new GZ(s,l,o.type,o.type));break}}}),this._onDidChange.fire()}async updateViewModels(e,t,o){let n=await this.createDiffViewModels(e,t),r=this._items.length;this.clear(),this._items.splice(0,r);let s;this.originalCellViewModels=n,n.forEach((l,c)=>{if(l.type==="unchanged"&&!this.excludeUnchangedPlaceholder){if(!s){l.displayIconToHideUnmodifiedCells=!0,s=new kVt(l.mainDocumentTextModel,l.editorEventDispatcher,l.initData),this._items.push(s);let p=s;this.disposables.add(p.onUnfoldHiddenCells(()=>{let h=this.placeholderAndRelatedCells.get(p);if(!Array.isArray(h))return;let g=this._items.indexOf(p);this._items.splice(g,1,...h),this._onDidChangeItems.fire({start:g,deleteCount:1,elements:h})})),this.disposables.add(l.onHideUnchangedCells(()=>{let h=this.placeholderAndRelatedCells.get(p);if(!Array.isArray(h))return;let g=this._items.indexOf(l);this._items.splice(g,h.length,p),this._onDidChangeItems.fire({start:g,deleteCount:h.length,elements:[p]})}))}let u=this.placeholderAndRelatedCells.get(s)||[];u.push(l),this.placeholderAndRelatedCells.set(s,u),s.hiddenCells.push(l)}else s=void 0,this._items.push(l)}),this._onDidChangeItems.fire({start:0,deleteCount:r,elements:this._items,firstChangeIndex:o})}async createDiffViewModels(e,t){let o=this.model.original.notebook,n=this.model.modified.notebook,r={metadataStatusHeight:this.configurationService.getValue("notebook.diff.ignoreMetadata")?0:25,outputStatusHeight:this.configurationService.getValue("notebook.diff.ignoreOutputs")||n.transientOptions.transientOutputs?0:25,fontInfo:this.fontInfo},s=[];return this.notebookMetadataViewModel=this._register(new ZRe(this.model.original.notebook,this.model.modified.notebook,t?"modifiedMetadata":"unchangedMetadata",this.eventDispatcher,r,this.notebookService,this.diffEditorHeightCalculator)),this.ignoreMetadata||(t&&await this.notebookMetadataViewModel.computeHeights(),s.push(this.notebookMetadataViewModel)),(await Promise.all(e.map(async c=>{switch(c.type){case"delete":return new _Ze(o,n,o.cells[c.originalCellIndex],void 0,"delete",this.eventDispatcher,r,this.notebookService,this.configurationService,this.diffEditorHeightCalculator,c.originalCellIndex);case"insert":return new _Ze(n,o,void 0,n.cells[c.modifiedCellIndex],"insert",this.eventDispatcher,r,this.notebookService,this.configurationService,this.diffEditorHeightCalculator,c.modifiedCellIndex);case"modified":{let u=new GC(this.model.modified.notebook,this.model.original.notebook,o.cells[c.originalCellIndex],n.cells[c.modifiedCellIndex],"modified",this.eventDispatcher,r,this.notebookService,this.configurationService,c.originalCellIndex,this.diffEditorHeightCalculator);return await u.computeEditorHeights(),u}case"unchanged":return new GC(this.model.modified.notebook,this.model.original.notebook,o.cells[c.originalCellIndex],n.cells[c.modifiedCellIndex],"unchanged",this.eventDispatcher,r,this.notebookService,this.configurationService,c.originalCellIndex,this.diffEditorHeightCalculator)}}))).forEach(c=>s.push(c)),s}};function q8o(a,i,e){let t=e.changes;for(let o=0;o<e.changes.length-1;o++){let n=t[o],r=t[o+1],s=n.originalStart,l=n.modifiedStart;n.originalLength===1&&n.modifiedLength===0&&r.originalStart===s+2&&r.originalLength===0&&r.modifiedStart===l+1&&r.modifiedLength===1&&a.cells[s].getHashValue()===i.cells[l+1].getHashValue()&&a.cells[s+1].getHashValue()===i.cells[l].getHashValue()&&(n.originalStart=s,n.originalLength=0,n.modifiedStart=l,n.modifiedLength=1,r.originalStart=s+1,r.originalLength=1,r.modifiedStart=l+2,r.modifiedLength=0,o++)}}function j8o(a,i,e){if(a.length!==i.length)return!1;let t=e.original.notebook,o=e.modified.notebook;for(let n=0;n<i.length;n++){let r=a[n],s=i[n];if(r.type!==s.type)return!1;switch(r.type){case"delete":{if(t.cells[r.originalCellIndex].handle!==s.original?.handle)return!1;continue}case"insert":{if(o.cells[r.modifiedCellIndex].handle!==s.modified?.handle)return!1;continue}default:{if(t.cells[r.originalCellIndex].handle!==s.original?.handle||o.cells[r.modifiedCellIndex].handle!==s.modified?.handle)return!1;continue}}}return!0}var RZe=class extends ik{constructor(e,t,o,n,r,s,l){super(e,t,o,void 0,l);this.type=n;this.containerType=r;this.kind=s}},ome=class extends RZe{constructor(i,e,t,o){super(i,e,e||i,t,o,"Cell",{[H4.key]:"Cell",[U4.key]:t})}},KZ=class extends RZe{constructor(i,e,t,o){super(i,e,e||i,t,o,"Metadata",{[H4.key]:"Metadata",[U4.key]:t})}},GZ=class extends RZe{constructor(i,e,t,o){super(i,e,e||i,t,o,"Output",{[H4.key]:"Output",[U4.key]:t})}};var $Z=class{constructor(i,e,t,o){this.lineHeight=i;this.textModelResolverService=e;this.editorWorkerService=t;this.configurationService=o}async diffAndComputeHeight(i,e){let[t,o]=await Promise.all([this.textModelResolverService.createModelReference(i),this.textModelResolverService.createModelReference(e)]);try{let n=await this.editorWorkerService.computeDiff(i,e,{ignoreTrimWhitespace:!0,maxComputationTimeMs:0,computeMoves:!1},"advanced").then(y=>y?.changes||[]),r=this.configurationService.getValue("diffEditor.hideUnchangedRegions.enabled"),s=this.configurationService.getValue("diffEditor.hideUnchangedRegions.minimumLineCount"),l=this.configurationService.getValue("diffEditor.hideUnchangedRegions.contextLineCount"),c=t.object.textEditorModel.getLineCount(),u=o.object.textEditorModel.getLineCount(),p=r?X9.fromDiffs(n,c,u,s??3,l??3):[],h=n.reduce((y,w)=>w.original.isEmpty&&!w.modified.isEmpty?y+w.modified.length:!w.original.isEmpty&&!w.modified.isEmpty&&w.modified.length>w.original.length?y+w.modified.length-w.original.length:y,0),g=t.object.textEditorModel.getLineCount(),f=p.reduce((y,w)=>y+w.lineCount,0),b=p.length*Eco,S=g+h-f;return S*this.lineHeight+pA(S).top+pA(S).bottom+b}finally{t.dispose(),o.dispose()}}computeHeightFromLines(i){return i*this.lineHeight+pA(i).top+pA(i).bottom}};$Z=I([m(1,Nt),m(2,$s),m(3,B)],$Z);var MVt=ae("INotebookOriginalCellModelFactory"),MZe=class extends Ww{constructor(e,t){super();this.modelService=e;this._languageService=t}createReferencedObject(e,t,o,n,r){let s=`${t.scheme}-chat-edit`,l=A.from({scheme:s,fragment:t.fragment,path:t.path}),c=this._languageService.getLanguageIdByLanguageName(n)?this._languageService.createById(n):r===1?this._languageService.createById("markdown"):null;return this.modelService.createModel(o,c,l)}destroyReferencedObject(e,t){t.dispose()}};MZe=I([m(0,Ct),m(1,kt)],MZe);var lMe=class{constructor(i){this._data=i.createInstance(MZe)}getOrCreate(i,e,t,o){return this._data.acquire(i.toString(),i,e,t,o)}};lMe=I([m(0,F)],lMe);var cMe=class extends P{constructor(e,t,o,n,r,s){super();this.modifiedCell=t;this.originalCell=o;this.editor=n;this._editorWorkerService=r;this.originalCellModelFactory=s;this._viewZones=[];this.throttledDecorator=this.add(new ya(50));this.perEditorDisposables=this.add(new P);let l=ui(e.onDidChangeVisibleRanges,()=>e.visibleRanges),c=Ce(u=>{if(!l.read(u).map(f=>e.getCellsInRange(f)).flat().map(f=>f.handle).includes(t.handle))return;let g=e.codeEditors.find(f=>f[0].handle===t.handle)?.[1];if(g?.getModel()===this.modifiedCell.textModel)return g});this.add(Ga((u,p)=>{let h=c.read(u);this.perEditorDisposables.clear(),h&&(p.add(h.onDidChangeModel(()=>{this.perEditorDisposables.clear()})),p.add(h.onDidChangeModelContent(()=>{this.update(h)})),p.add(h.onDidChangeConfiguration(g=>{(g.hasChanged(59)||g.hasChanged(75))&&this.update(h)})),this.update(h))}))}update(e){this.throttledDecorator.trigger(()=>this._updateImpl(e))}async _updateImpl(e){if(this.isDisposed)return;if(e.getOption(70)){this.perEditorDisposables.clear();return}let t=e.getModel();if(!t||t!==this.modifiedCell.textModel){this.perEditorDisposables.clear();return}let o=this.getOrCreateOriginalModel(e);if(!o){this.perEditorDisposables.clear();return}let n=t.getVersionId(),r=await this._editorWorkerService.computeDiff(o.uri,t.uri,{computeMoves:!0,ignoreTrimWhitespace:!1,maxComputationTimeMs:Number.MAX_SAFE_INTEGER},"advanced");this.isDisposed||(r&&!r.identical&&this.modifiedCell.textModel&&o&&t===e.getModel()&&e.getModel()?.getVersionId()===n?this._updateWithDiff(e,o,r,this.modifiedCell.textModel):this.perEditorDisposables.clear())}getOrCreateOriginalModel(e){if(!this._originalModel){let t=e.getModel();if(!t)return;this._originalModel=this.add(this.originalCellModelFactory.getOrCreate(t.uri,this.originalCell.getValue(),t.getLanguageId(),this.modifiedCell.cellKind)).object}return this._originalModel}_updateWithDiff(e,t,o,n){if(Q8o(o,this.diffForPreviouslyAppliedDecorators))return;this.perEditorDisposables.clear();let r=e.createDecorationsCollection();this.perEditorDisposables.add(Z(()=>{e.changeViewZones(g=>{for(let f of this._viewZones)g.removeZone(f)}),this._viewZones=[],r.clear(),this.diffForPreviouslyAppliedDecorators=void 0})),this.diffForPreviouslyAppliedDecorators=o;let s=po.createDynamic({...Eae,stickiness:1}),l=po.createDynamic({...zye,stickiness:1}),c=(g,f)=>po.createDynamic({description:"chat-editing-decoration",overviewRuler:{color:If(g),position:1},minimap:{color:If(f),position:2}}),u=c(jY,Pke),p=c(QY,Ake),h=c(YY,Nke);e.changeViewZones(g=>{for(let w of this._viewZones)g.removeZone(w);this._viewZones=[];let f=[],v=t.mightContainNonBasicASCII(),b=t.mightContainRTL(),S=uE.fromEditor(this.editor),y=n.getLineCount();for(let w of o.changes){let k=w.original;t.tokenization.forceTokenization(Math.max(1,k.endLineNumberExclusive-1));let T=new dE(k.mapToLineArray(G=>t.tokenization.getLineTokens(G)),[],v,b),N=[];for(let G of w.innerChanges||[])N.push(new Zk(G.originalRange.delta(-(w.original.startLineNumber-1)),Cq.className,0)),!(G.originalRange.isEmpty()&&G.originalRange.startLineNumber===1&&G.modifiedRange.endLineNumber===y)&&!G.modifiedRange.isEmpty()&&f.push({range:G.modifiedRange,options:s});let O=N.length===1&&N[0].range.isEmpty()&&w.original.startLineNumber===1;!w.modified.isEmpty&&!(O&&w.modified.endLineNumberExclusive-1===y)&&f.push({range:w.modified.toInclusiveRange(),options:l}),w.original.isEmpty?f.push({range:w.modified.toInclusiveRange(),options:p}):w.modified.isEmpty?f.push({range:new z(w.modified.startLineNumber-1,1,w.modified.startLineNumber,1),options:h}):f.push({range:w.modified.toInclusiveRange(),options:u});let V=document.createElement("div");V.className="chat-editing-original-zone view-lines line-delete monaco-mouse-cursor-text";let U=EL(T,S,N,V);if(!O){let G={afterLineNumber:w.modified.startLineNumber-1,heightInLines:U.heightInLines,domNode:V,ordinal:50002};this._viewZones.push(g.addZone(G))}}r.set(f)})}};cMe=I([m(4,$s),m(5,MVt)],cMe);function Q8o(a,i){return a&&i?!(a.changes.length!==i.changes.length||a.moves.length!==i.moves.length||!Lco(a.changes,i.changes)||!a.moves.some((e,t)=>{let o=i.moves[t];return!Lco(e.changes,o.changes)||e.lineRangeMapping.changedLineCount!==o.lineRangeMapping.changedLineCount||!e.lineRangeMapping.modified.equals(o.lineRangeMapping.modified)||!e.lineRangeMapping.original.equals(o.lineRangeMapping.original)})):!a&&!i}function Lco(a,i){return!(a.length!==i.length||a.some((e,t)=>{let o=i[t];return!!(e.changedLineCount!==o.changedLineCount||(e.innerChanges||[]).length!==(o.innerChanges||[]).length||(e.innerChanges||[]).some((n,r)=>{let s=o.innerChanges[r];return!n.modifiedRange.equalsRange(s.modifiedRange)||!n.originalRange.equalsRange(s.originalRange)}))}))}var Y8o=Kg("notebookRenderer",{createHTML:a=>a}),qZ=class extends C{constructor(e,t,o,n){super();this._notebookEditor=e;this.toolbar=t;this.languageService=o;this.instantiationService=n;this.zoneRemover=this._register(new P);this.createdViewZones=new Map;this.deletedCellInfos=new Map}getTop(e){let t=this.deletedCellInfos.get(e);if(!t)return;if(t.previousIndex===-1)return 0;let o=this._notebookEditor.getCellsInRange({start:t.previousIndex,end:t.previousIndex+1});if(!o.length)return this._notebookEditor.getLayoutInfo().height+t.offset;let n=o[0],r=this._notebookEditor.getHeightOfElement(n);return this._notebookEditor.getAbsoluteTopOfElement(n)+r+t.offset}reveal(e){let t=this.getTop(e);if(typeof t=="number"){this._notebookEditor.focusContainer(),this._notebookEditor.revealOffsetInCenterIfOutsideViewport(t);let o=this.deletedCellInfos.get(e);if(o){let n=o.previousIndex===-1?0:o.previousIndex;this._notebookEditor.setFocus({start:n,end:n}),this._notebookEditor.setSelections([{start:n,end:n}])}}}apply(e,t){this.clear();let o=-1,n={cells:[],index:0};e.forEach(r=>{if(r.type==="delete"){let s=t.cells[r.originalCellIndex];s&&(n.cells.push({cell:s,originalIndex:r.originalCellIndex,previousIndex:o}),n.index=o)}else n.cells.length&&(this._createWidget(n.index+1,n.cells),n.cells.length=0),o=r.modifiedCellIndex}),n.cells.length&&this._createWidget(n.index+1,n.cells)}clear(){this.deletedCellInfos.clear(),this.zoneRemover.clear()}_createWidget(e,t){this._createWidgetImpl(e,t)}async _createWidgetImpl(e,t){let o=document.createElement("div"),n=[],r=await Promise.all(t.map(async l=>{let c=new PZe(this._notebookEditor,this.toolbar,l.cell.getValue(),l.cell.language,o,l.originalIndex,this.languageService,this.instantiationService);n.push(c);let u=await c.render();return this.deletedCellInfos.set(l.originalIndex,{height:u,previousIndex:l.previousIndex,offset:0}),u}));Array.from(this.deletedCellInfos.keys()).sort((l,c)=>l-c).forEach(l=>{let c=this.deletedCellInfos.get(l-1);if(c){let u=this.deletedCellInfos.get(l);u&&(u.offset=c.height+c.offset)}});let s=r.reduce((l,c)=>l+c,0);this._notebookEditor.changeViewZones(l=>{let c={afterModelPosition:e,heightInPx:s+4,domNode:o},u=l.addZone(c);l.layoutZone(u),this.createdViewZones.set(e,u);let p=this._notebookEditor.deltaCellDecorations([],[{viewZoneId:u,options:{overviewRuler:{color:YY,position:2}}}]);this.zoneRemover.add(Z(()=>{this.createdViewZones.get(e)===u&&this.createdViewZones.delete(e),this._notebookEditor.isDisposed||(this._notebookEditor.changeViewZones(h=>{h.removeZone(u),Ue(n)}),this._notebookEditor.deltaCellDecorations(p,[]))}))})}};qZ=I([m(2,kt),m(3,F)],qZ);var PZe=class extends C{constructor(e,t,o,n,r,s,l,c){super();this._notebookEditor=e;this._toolbarOptions=t;this.code=o;this.language=n;this._originalIndex=s;this.languageService=l;this.instantiationService=c;this.container=R(r,document.createElement("div")),this._register(Z(()=>{r.removeChild(this.container)}))}async render(){let e=this.code,t=this.language,o=await bW(this.languageService,e,t),n=this._notebookEditor.getBaseCellEditorOptions(t).value,r="--notebook-editor-font-family",s="--notebook-editor-font-size",l="--notebook-editor-font-weight",u=this._notebookEditor.codeEditors.map(T=>T[1]).find(T=>T)?.getOptions().get(165),p=`font-family: var(${r});font-weight: var(${l});font-size: var(${s});`+n.lineHeight?`line-height: ${n.lineHeight}px;`:""+u?.contentLeft?`margin-left: ${u}px;`:"white-space: pre;",h=this.container;if(h.classList.add("code-cell-row"),this._toolbarOptions){let T=document.createElement("div");T.className=this._toolbarOptions.className,h.appendChild(T);let O=this._register(this.instantiationService.createChild(new Io([X,this._notebookEditor.scopedContextKeyService]))).createInstance(Ln,T,this._toolbarOptions.menuId,{telemetrySource:this._toolbarOptions.telemetrySource,hiddenItemStrategy:-1,toolbarOptions:{primaryGroup:()=>!0},menuOptions:{renderShortTitle:!0,arg:this._toolbarOptions.argFactory(this._originalIndex)},actionViewItemProvider:this._toolbarOptions.actionViewItemProvider});this._store.add(O),T.style.position="absolute",T.style.right="40px",T.style.zIndex="10",T.classList.add("hover")}let g=R(h,_(".cell-inner-container"));g.style.position="relative";let f=R(g,_(".cell-focus-indicator.cell-focus-indicator-side.cell-focus-indicator-left")),v=R(g,_(".cell.code"));R(f,_("div.execution-count-label"));let b=R(v,_(".cell-editor-part")),S=R(b,_(".cell-editor-container"));return S=R(S,_(".code",{style:p})),n.fontFamily&&S.style.setProperty(r,n.fontFamily),n.fontSize&&S.style.setProperty(s,`${n.fontSize}px`),n.fontWeight&&S.style.setProperty(l,n.fontWeight),S.innerHTML=Y8o?.createHTML(o)||o,mc(e).length*(n.lineHeight||Tco)+12+12+16+16}};PZe=I([m(6,kt),m(7,F)],PZe);var dMe=class extends C{constructor(e){super();this.notebookEditor=e;this.decorators=this._register(new P)}apply(e){let t=this.notebookEditor.textModel;if(!t)return;let o=e.filter(r=>r.type==="insert").map(r=>t.cells[r.modifiedCellIndex]),n=this.notebookEditor.deltaCellDecorations([],o.map(r=>({handle:r.handle,options:{className:"nb-insertHighlight",outputClassName:"nb-insertHighlight",overviewRuler:{color:QY,modelRanges:[],includeOutput:!0,position:7}}})));this.clear(),this.decorators.add(Z(()=>{this.notebookEditor.isDisposed||this.notebookEditor.deltaCellDecorations(n,[])}))}clear(){this.decorators.clear()}};var Rco=ae("INotebookOriginalModelReferenceFactory"),AZe=class extends Ww{constructor(e,t){super();this.notebookService=e;this.modelService=t;this.modelsToDispose=new Set}async createReferencedObject(e,t,o){this.modelsToDispose.delete(e);let n=t.originalURI,r=this.notebookService.getNotebookTextModel(n);if(r)return r;let s=await this.modelService.createModelReference(n),l=Je.fromString(s.object.textEditorModel.getValue()),c=WT(l);return s.dispose(),this.notebookService.createNotebookTextModel(o,n,c)}destroyReferencedObject(e,t){this.modelsToDispose.add(e),(async()=>{try{let o=await t;if(!this.modelsToDispose.has(e))return;o.dispose()}catch{}finally{this.modelsToDispose.delete(e)}})()}};AZe=I([m(0,un),m(1,Nt)],AZe);var uMe=class{constructor(i){this.instantiationService=i;this._resourceModelCollection=void 0;this._asyncModelCollection=void 0}get resourceModelCollection(){return this._resourceModelCollection||(this._resourceModelCollection=this.instantiationService.createInstance(AZe)),this._resourceModelCollection}get asyncModelCollection(){return this._asyncModelCollection||(this._asyncModelCollection=new tbe(this.resourceModelCollection)),this._asyncModelCollection}getOrCreate(i,e){return this.asyncModelCollection.acquire(i.originalURI.toString(),i,e)}};uMe=I([m(0,F)],uMe);var jZ=class extends C{constructor(e,t,o,n){super();this.notebookEditor=e;this.notebookEditorWorkerService=t;this.instantiationService=o;this.logService=n;this.cellDecorators=new Map;this.listeners=[];this.logService.debug("inlineDiff","Watching for previous model"),this._register(he(r=>{this.previous=this.notebookEditor.notebookOptions.previousModelToCompare.read(r),this.previous&&(this.logService.debug("inlineDiff","Previous model set"),this.notebookEditor.hasModel()?this.initialize():(this.logService.debug("inlineDiff","Waiting for model to attach"),this.listeners.push(H.once(this.notebookEditor.onDidAttachViewModel)(()=>this.initialize()))))}))}static{this.ID="workbench.notebook.inlineDiffDecoration"}clear(){this.listeners.forEach(e=>e.dispose()),this.cellDecorators.forEach((e,t)=>{e.dispose(),this.cellDecorators.delete(t)}),this.insertedCellDecorator?.dispose(),this.deletedCellDecorator?.dispose(),this.cachedNotebookDiff=void 0,this.listeners=[],this.logService.debug("inlineDiff","Cleared decorations and listeners")}dispose(){this.logService.debug("inlineDiff","Disposing"),this.clear(),super.dispose()}initialize(){if(this.clear(),!this.previous)return;this.insertedCellDecorator=this.instantiationService.createInstance(dMe,this.notebookEditor),this.deletedCellDecorator=this.instantiationService.createInstance(qZ,this.notebookEditor,void 0),this._update();let e=H.debounce(this.notebookEditor.onDidChangeVisibleRanges,t=>t,100,void 0,void 0,void 0,this._store);if(this.listeners.push(e(()=>this._update())),this.listeners.push(this.notebookEditor.onDidChangeModel(()=>this._update())),this.notebookEditor.textModel){let t=H.debounce(this.notebookEditor.textModel.onDidChangeContent,(n,r)=>r,100,void 0,void 0,void 0,this._store),o=H.debounce(this.previous.onDidChangeContent,(n,r)=>r,100,void 0,void 0,void 0,this._store);this.listeners.push(t(()=>this._update())),this.listeners.push(o(()=>this._update()))}this.logService.debug("inlineDiff","Initialized")}async _update(){let e=this.notebookEditor.getViewModel()?.notebookDocument;if(!this.previous||!e){this.logService.debug("inlineDiff","Update skipped - no original or current document");return}if(!this.cachedNotebookDiff||this.cachedNotebookDiff.originalVersion!==this.previous.versionId||this.cachedNotebookDiff.version!==e.versionId){let t={cellDiffInfo:[]};try{let o=await this.notebookEditorWorkerService.computeDiff(this.previous.uri,e.uri);t=sMe(this.previous,e,o)}catch(o){this.logService.error("inlineDiff",`Error computing diff:
`+o);return}this.cachedNotebookDiff={cellDiffInfo:t.cellDiffInfo,originalVersion:this.previous.versionId,version:e.versionId},this.insertedCellDecorator?.apply(t.cellDiffInfo),this.deletedCellDecorator?.apply(t.cellDiffInfo,this.previous)}await this.updateCells(this.previous,e,this.cachedNotebookDiff.cellDiffInfo)}async updateCells(e,t,o){let n=new Set;o.forEach(r=>{if(r.type==="modified"){let s=t.cells[r.modifiedCellIndex],l=e.cells[r.originalCellIndex],c=this.notebookEditor.codeEditors.find(([u])=>u.handle===s.handle)?.[1];if(c){let u=this.cellDecorators.get(s);if(u?.modifiedCell!==s||u?.originalCell!==l){u?.dispose();let p=this.instantiationService.createInstance(cMe,this.notebookEditor,s,l,c);this.cellDecorators.set(s,p),n.add(p),this._register(c.onDidDispose(()=>{p.dispose(),this.cellDecorators.get(s)===p&&this.cellDecorators.delete(s)}))}else u&&n.add(u)}}}),this.cellDecorators.forEach((r,s)=>{n.has(r)||(r.dispose(),this.cellDecorators.delete(s))})}};jZ=I([m(1,JK),m(2,F),m(3,_v)],jZ);tm(jZ.ID,jZ);we(Rco,uMe,1);we(MVt,lMe,1);var pMe=class extends C{constructor(e,t,o,n,r,s,l){super();this.rootElement=e;this.groupId=t;this.window=o;this.options=n;this.dimension=r;this.instantiationService=s;this.widgetService=l;this.widget={value:void 0}}get editorWidget(){return this.widget.value}async show(e,t,o,n){this.widget.value||this.createNotebookWidget(e,this.groupId,this.rootElement),this.dimension&&this.widget.value?.layout(this.dimension,this.rootElement,this.position),t&&(await this.widget.value?.setOptions({...n}),this.widget.value?.notebookOptions.previousModelToCompare.set(o,void 0),await this.widget.value.setModel(t,n?.viewState))}hide(){this.widget.value&&(this.widget.value.notebookOptions.previousModelToCompare.set(void 0,void 0),this.widget.value.onWillHide())}setLayout(e,t){this.dimension=e,this.position=t}createNotebookWidget(e,t,o){let n=A4.getSomeEditorContributions([jZ.ID]),r={notebookToolbar:D.NotebookToolbar,cellTitleToolbar:D.NotebookCellTitle,cellDeleteToolbar:D.NotebookCellDelete,cellInsertToolbar:D.NotebookCellBetween,cellTopInsertToolbar:D.NotebookCellListTop,cellExecuteToolbar:D.NotebookCellExecute,cellExecutePrimary:void 0},s=["editor.contrib.review","editor.contrib.floatingClickMenu","editor.contrib.dirtydiff","editor.contrib.testingOutputPeek","editor.contrib.testingDecorations","store.contrib.stickyScrollController","editor.contrib.findController","editor.contrib.emptyTextEditorHint"],l=aa.getEditorContributions().filter(c=>s.indexOf(c.id)===-1);this.widget=this.instantiationService.invokeFunction(this.widgetService.retrieveWidget,t,e,{contributions:n,menuIds:r,cellEditorContributions:l,options:this.options},this.dimension,this.window),this.rootElement&&this.widget.value.getDomNode()&&(this.rootElement.setAttribute("aria-flowto",this.widget.value.getDomNode().id||""),vN(this.widget.value.getDomNode(),this.rootElement))}dispose(){super.dispose(),this.widget.value&&this.widget.value.dispose()}};pMe=I([m(5,F),m(6,Zc)],pMe);var X8o=_,Cwi=class a{constructor(i){this.selections=i}compare(i){if(!(i instanceof a))return 3;if(this.selections.length!==i.selections.length)return 3;for(let e=0;e<this.selections.length;e++)if(this.selections[e]!==i.selections[e])return 3;return 1}restore(i){let e={cellSelections:fce(this.selections)};return Object.assign(e,i),e}},Xm=class extends pa{constructor(e,t,o,n,r,s,l,c,u,p){super(Xm.ID,e,l,o,c);this.instantiationService=t;this.contextKeyService=n;this.notebookEditorWorkerService=r;this.configurationService=s;this.notebookService=u;this.editorService=p;this.creationOptions=UZ();this._dimension=void 0;this._modifiedWebview=null;this._originalWebview=null;this._webviewTransparentCover=null;this._inlineView=!1;this._onMouseUp=this._register(new E);this.onMouseUp=this._onMouseUp.event;this._onDidScroll=this._register(new E);this.onDidScroll=this._onDidScroll.event;this.onDidChangeScroll=this._onDidScroll.event;this._model=null;this._modifiedResourceDisposableStore=this._register(new P);this._insetModifyQueueByOutputId=new NT;this._onDidDynamicOutputRendered=this._register(new E);this.onDidDynamicOutputRendered=this._onDidDynamicOutputRendered.event;this._localStore=this._register(new P);this._onDidChangeSelection=this._register(new E);this.onDidChangeSelection=this._onDidChangeSelection.event;this._isDisposed=!1;this._currentChangedIndex=Le(this,-1);this.currentChangedIndex=this._currentChangedIndex;this.pendingLayouts=new WeakMap;this.diffEditorCalcuator=this.instantiationService.createInstance($Z,this.fontInfo.lineHeight),this._notebookOptions=t.createInstance(nT,this.window,!1,void 0),this._register(this._notebookOptions),this._revealFirst=!0}static{this.ENTIRE_DIFF_OVERVIEW_WIDTH=30}static{this.ID=lY}get textModel(){return this._model?.modified.notebook}get inlineNotebookEditor(){if(this._inlineView)return this.inlineDiffWidget?.editorWidget}get notebookOptions(){return this._notebookOptions}get isDisposed(){return this._isDisposed}get fontInfo(){return this._fontInfo||(this._fontInfo=this.createFontInfo()),this._fontInfo}createFontInfo(){let e=this.configurationService.getValue("editor");return Fy.readFontInfo(this.window,LS(e,Xd.getInstance(this.window).value))}isOverviewRulerEnabled(){return this.configurationService.getValue(ft.diffOverviewRuler)??!1}getSelection(){let e=this._list.getFocus();return new Cwi(e)}toggleNotebookCellSelection(e){}updatePerformanceMetadata(e,t,o,n){}async focusNotebookCell(e,t){}async focusNextNotebookCell(e,t){}didFocusOutputInputChange(e){}getScrollTop(){return this._list?.scrollTop??0}getScrollHeight(){return this._list?.scrollHeight??0}getScrollPosition(){return{scrollTop:this.getScrollTop(),scrollLeft:this._list?.scrollLeft??0}}setScrollPosition(e){this._list&&(this._list.scrollTop=e.scrollTop,e.scrollLeft!==void 0&&(this._list.scrollLeft=e.scrollLeft))}delegateVerticalScrollbarPointerDown(e){this._list?.delegateVerticalScrollbarPointerDown(e)}updateOutputHeight(e,t,o,n){let r=e.diffElement,s=this.getCellByInfo(e),l=s.outputsViewModels.indexOf(t);if(r instanceof GC){let c=Zo.parse(e.cellUri);if(!c)return;r.updateOutputHeight(c.notebook.toString()===this._model?.original.resource.toString()?0:1,l,o)}else r.updateOutputHeight(r.type==="insert"?1:0,l,o);n&&this._onDidDynamicOutputRendered.fire({cell:s,output:t})}setMarkupCellEditState(e,t){}didStartDragMarkupCell(e,t){}didDragMarkupCell(e,t){}didEndDragMarkupCell(e){}didDropMarkupCell(e){}didResizeOutput(e){}async toggleInlineView(){this._layoutCancellationTokenSource?.dispose(),this._inlineView=!this._inlineView,this._lastLayoutProperties&&(this._inlineView?(this.layout(this._lastLayoutProperties?.dimension,this._lastLayoutProperties?.position),this.inlineDiffWidget?.show(this.input,this._model?.modified.notebook,this._model?.original.notebook,this._options)):(this.layout(this._lastLayoutProperties?.dimension,this._lastLayoutProperties?.position),this.inlineDiffWidget?.hide()),this._layoutCancellationTokenSource=new $e,this.updateLayout(this._layoutCancellationTokenSource.token))}createEditor(e){this._rootElement=R(e,_(".notebook-text-diff-editor")),this._overflowContainer=document.createElement("div"),this._overflowContainer.classList.add("notebook-overflow-widget-container","monaco-editor"),R(e,this._overflowContainer);let t=[this.instantiationService.createInstance(q4,this),this.instantiationService.createInstance(j4,this),this.instantiationService.createInstance(G4,this),this.instantiationService.createInstance($4,this)];this._listViewContainer=R(this._rootElement,_(".notebook-diff-list-view")),this._list=this.instantiationService.createInstance(nMe,"NotebookTextDiff",this._listViewContainer,this.instantiationService.createInstance(oMe,this.window),t,this.contextKeyService,{setRowLineHeight:!1,setRowHeight:!1,supportDynamicHeights:!0,horizontalScrolling:!1,keyboardSupport:!1,mouseSupport:!0,multipleSelectionSupport:!1,typeNavigationEnabled:!0,paddingBottom:0,styleController:o=>this._list,overrideStyles:{listBackground:qo,listActiveSelectionBackground:qo,listActiveSelectionForeground:ko,listFocusAndSelectionBackground:qo,listFocusAndSelectionForeground:ko,listFocusBackground:qo,listFocusForeground:ko,listHoverForeground:ko,listHoverBackground:qo,listHoverOutline:Ad,listFocusOutline:Ad,listInactiveSelectionBackground:qo,listInactiveSelectionForeground:ko,listInactiveFocusBackground:qo,listInactiveFocusOutline:qo},accessibilityProvider:{getAriaLabel(){return null},getWidgetAriaLabel(){return d(11902,null)}}}),this.inlineDiffWidget=this._register(this.instantiationService.createInstance(pMe,this._rootElement,this.group.id,this.window,this.notebookOptions,this._dimension)),this._register(this._list),this._register(this._list.onMouseUp(o=>{o.element&&(typeof o.index=="number"&&this._list.setFocus([o.index]),this._onMouseUp.fire({event:o.browserEvent,target:o.element}))})),this._register(this._list.onDidScroll(()=>{this._onDidScroll.fire()})),this._register(this._list.onDidChangeFocus(()=>this._onDidChangeSelection.fire({reason:2}))),this._overviewRulerContainer=document.createElement("div"),this._overviewRulerContainer.classList.add("notebook-overview-ruler-container"),this._rootElement.appendChild(this._overviewRulerContainer),this._registerOverviewRuler(),this._webviewTransparentCover=R(this._list.rowsContainer,X8o(".webview-cover")),this._webviewTransparentCover.style.display="none",this._register(Gbe(this._overflowContainer,o=>{o.target.classList.contains("slider")&&this._webviewTransparentCover&&(this._webviewTransparentCover.style.display="block")})),this._register(Qpt(this._overflowContainer,()=>{this._webviewTransparentCover&&(this._webviewTransparentCover.style.display="none")})),this._register(this._list.onDidScroll(o=>{this._webviewTransparentCover.style.top=`${o.scrollTop}px`}))}_registerOverviewRuler(){this._overviewRuler=this._register(this.instantiationService.createInstance(rMe,this,Xm.ENTIRE_DIFF_OVERVIEW_WIDTH,this._overviewRulerContainer))}_updateOutputsOffsetsInWebview(e,t,o,n,r){if(o.element.style.height=`${t}px`,o.insetMapping){let s=[],l=[];o.insetMapping.forEach((c,u)=>{let p=n(c.cellInfo.diffElement);if(!(!p||this._list.indexOf(c.cellInfo.diffElement)===void 0))if(p.outputsViewModels.indexOf(u)<0)l.push(u);else{let g=this._list.getCellViewScrollTop(c.cellInfo.diffElement),f=p.outputsViewModels.indexOf(u),v=c.cellInfo.diffElement.getOutputOffsetInCell(r,f);s.push({cell:p,output:u,cellTop:g,outputOffset:v,forceDisplay:!1})}}),o.removeInsets(l),s.length&&o.updateScrollTops(s,[])}}async setInput(e,t,o,n){this.inlineDiffWidget?.hide(),await super.setInput(e,t,o,n);let r=await e.resolve();this._model!==r&&(this._detachModel(),this._attachModel(r)),this._model=r,this._model!==null&&(this._inlineView?(this._listViewContainer.style.display="none",this.inlineDiffWidget?.show(e,r.modified.notebook,r.original.notebook,t)):(this._listViewContainer.style.display="block",this.inlineDiffWidget?.hide()),this._revealFirst=!0,this._modifiedResourceDisposableStore.clear(),this._layoutCancellationTokenSource=new $e,this._modifiedResourceDisposableStore.add(H.any(this._model.original.notebook.onDidChangeContent,this._model.modified.notebook.onDidChangeContent)(s=>{this._model!==null&&this.editorService.activeEditor!==e&&(this._layoutCancellationTokenSource?.dispose(),this._layoutCancellationTokenSource=new $e,this.updateLayout(this._layoutCancellationTokenSource.token))})),await this._createOriginalWebview(_t(),this._model.original.viewType,this._model.original.resource),this._originalWebview&&this._modifiedResourceDisposableStore.add(this._originalWebview),await this._createModifiedWebview(_t(),this._model.modified.viewType,this._model.modified.resource),this._modifiedWebview&&this._modifiedResourceDisposableStore.add(this._modifiedWebview),await this.updateLayout(this._layoutCancellationTokenSource.token,t?.cellSelections?Lf(t.cellSelections):void 0))}setVisible(e){super.setVisible(e),e||this.inlineDiffWidget?.hide()}_detachModel(){this._localStore.clear(),this._originalWebview?.dispose(),this._originalWebview?.element.remove(),this._originalWebview=null,this._modifiedWebview?.dispose(),this._modifiedWebview?.element.remove(),this._modifiedWebview=null,this.notebookDiffViewModel?.dispose(),this.notebookDiffViewModel=void 0,this._modifiedResourceDisposableStore.clear(),this._list.clear()}_attachModel(e){this._model=e,this._eventDispatcher=new JRe;let t=()=>{$r(this.window,()=>{this._isDisposed||(this._modifiedWebview&&this._updateOutputsOffsetsInWebview(this._list.scrollTop,this._list.scrollHeight,this._modifiedWebview,n=>n.modified,1),this._originalWebview&&this._updateOutputsOffsetsInWebview(this._list.scrollTop,this._list.scrollHeight,this._originalWebview,n=>n.original,0))})};this._localStore.add(this._list.onDidChangeContentHeight(()=>{t()})),this._localStore.add(this._list.onDidChangeFocus(n=>{if(n.indexes.length&&this.notebookDiffViewModel&&n.indexes[0]<this.notebookDiffViewModel.items.length){let r=this.notebookDiffViewModel.items[n.indexes[0]],s=this.notebookDiffViewModel.items.filter(l=>l.type!=="unchanged"&&l.type!=="unchangedMetadata"&&l.type!=="placeholder");if(r&&r?.type!=="placeholder"&&r?.type!=="unchanged"&&r?.type!=="unchangedMetadata")return this._currentChangedIndex.set(s.indexOf(r),void 0)}return this._currentChangedIndex.set(-1,void 0)})),this._localStore.add(this._eventDispatcher.onDidChangeCellLayout(()=>{t()}));let o=this.notebookDiffViewModel=this._register(new aMe(this._model,this.notebookEditorWorkerService,this.configurationService,this._eventDispatcher,this.notebookService,this.diffEditorCalcuator,this.fontInfo,void 0));this._localStore.add(this.notebookDiffViewModel.onDidChangeItems(n=>{this._originalWebview?.removeInsets([...this._originalWebview?.insetMapping.keys()]),this._modifiedWebview?.removeInsets([...this._modifiedWebview?.insetMapping.keys()]),this._revealFirst&&typeof n.firstChangeIndex=="number"&&n.firstChangeIndex>-1&&n.firstChangeIndex<this._list.length&&(this._revealFirst=!1,this._list.setFocus([n.firstChangeIndex]),this._list.reveal(n.firstChangeIndex,.3)),this._list.splice(n.start,n.deleteCount,n.elements),this.isOverviewRulerEnabled()&&this._overviewRuler.updateViewModels(o.items,this._eventDispatcher)}))}async _createModifiedWebview(e,t,o){this._modifiedWebview?.dispose(),this._modifiedWebview=this.instantiationService.createInstance(uA,this,e,t,o,{...this._notebookOptions.computeDiffWebviewOptions(),fontFamily:this._generateFontFamily()},void 0),this._list.rowsContainer.insertAdjacentElement("afterbegin",this._modifiedWebview.element),this._modifiedWebview.createWebview(this.window),this._modifiedWebview.element.style.width="calc(50% - 16px)",this._modifiedWebview.element.style.left="calc(50%)"}_generateFontFamily(){return this.fontInfo.fontFamily??'"SF Mono", Monaco, Menlo, Consolas, "Ubuntu Mono", "Liberation Mono", "DejaVu Sans Mono", "Courier New", monospace'}async _createOriginalWebview(e,t,o){this._originalWebview?.dispose(),this._originalWebview=this.instantiationService.createInstance(uA,this,e,t,o,{...this._notebookOptions.computeDiffWebviewOptions(),fontFamily:this._generateFontFamily()},void 0),this._list.rowsContainer.insertAdjacentElement("afterbegin",this._originalWebview.element),this._originalWebview.createWebview(this.window),this._originalWebview.element.style.width="calc(50% - 16px)",this._originalWebview.element.style.left="16px"}setOptions(e){let t=e?.cellSelections?Lf(e.cellSelections):void 0;t&&this._list.setFocus(t)}async updateLayout(e,t){!this._model||!this.notebookDiffViewModel||(await this.notebookDiffViewModel.computeDiff(e),!e.isCancellationRequested&&t&&this._list.setFocus(t))}scheduleOutputHeightAck(e,t,o){let n=e.diffElement,r=0;if(n instanceof GC){let l=Zo.parse(e.cellUri);if(!l)return;r=l.notebook.toString()===this._model?.original.resource.toString()?0:1}else r=n.type==="insert"?1:0;let s=r===1?this._modifiedWebview:this._originalWebview;$r(this.window,()=>{s?.ackHeight([{cellId:e.cellId,outputId:t,height:o}])},10)}layoutNotebookCell(e,t){let o=(l,c)=>{this._list.updateElementHeight2(l,c)},n=this.pendingLayouts.get(e);n&&this._localStore.delete(n);let r,s=$r(this.window,()=>{this.pendingLayouts.delete(e),o(e,t),r()});return n=Z(()=>{s.dispose(),r()}),this._localStore.add(n),this.pendingLayouts.set(e,n),new Promise(l=>{r=l})}setScrollTop(e){this._list.scrollTop=e}triggerScroll(e){this._list.triggerScrollFromMouseWheelEvent(e)}firstChange(){if(!this.notebookDiffViewModel)return;let t=this.notebookDiffViewModel.items.findIndex(o=>o.type!=="unchanged"&&o.type!=="unchangedMetadata"&&o.type!=="placeholder");t>=0&&(this._list.setFocus([t]),this._list.reveal(t))}lastChange(){if(!this.notebookDiffViewModel)return;let e=this.notebookDiffViewModel.items,t=e.slice().reverse().find(n=>n.type!=="unchanged"&&n.type!=="unchangedMetadata"&&n.type!=="placeholder"),o=t?e.indexOf(t):-1;o>=0&&(this._list.setFocus([o]),this._list.reveal(o))}previousChange(){if(!this.notebookDiffViewModel)return;let e=this._list.getFocus()[0];(isNaN(e)||e<0)&&(e=0);let t=e-1,o=this.notebookDiffViewModel.items;for(;t>=0;){let n=o[t];if(n.type!=="unchanged"&&n.type!=="unchangedMetadata"&&n.type!=="placeholder")break;t--}if(t>=0)this._list.setFocus([t]),this._list.reveal(t);else{let n=o.findLastIndex(r=>r.type!=="unchanged"&&r.type!=="unchangedMetadata"&&r.type!=="placeholder");n>=0&&(this._list.setFocus([n]),this._list.reveal(n))}}nextChange(){if(!this.notebookDiffViewModel)return;let e=this._list.getFocus()[0];(isNaN(e)||e<0)&&(e=0);let t=e+1,o=this.notebookDiffViewModel.items;for(;t<o.length;){let n=o[t];if(n.type!=="unchanged"&&n.type!=="unchangedMetadata"&&n.type!=="placeholder")break;t++}if(t<o.length)this._list.setFocus([t]),this._list.reveal(t);else{let n=o.findIndex(r=>r.type!=="unchanged"&&r.type!=="unchangedMetadata"&&r.type!=="placeholder");n>=0&&(this._list.setFocus([n]),this._list.reveal(n))}}createOutput(e,t,o,n,r){this._insetModifyQueueByOutputId.queue(o.source.model.outputId+(r===1?"-right":"left"),async()=>{let s=r===1?this._modifiedWebview:this._originalWebview;if(s)if(s.insetMapping.has(o.source)){let l=this._list.getCellViewScrollTop(e),c=t.outputsViewModels.indexOf(o.source),u=e.getOutputOffsetInCell(r,c);s.updateScrollTops([{cell:t,output:o.source,cellTop:l,outputOffset:u,forceDisplay:!0}],[])}else{let l=this._list.getCellViewScrollTop(e);await s.createOutput({diffElement:e,cellHandle:t.handle,cellId:t.id,cellUri:t.uri},o,l,n())}})}updateMarkupCellHeight(){}getCellByInfo(e){return e.diffElement.getCellByUri(e.cellUri)}getCellById(e){throw new Error("Not implemented")}removeInset(e,t,o,n){this._insetModifyQueueByOutputId.queue(o.model.outputId+(n===1?"-right":"left"),async()=>{let r=n===1?this._modifiedWebview:this._originalWebview;r&&r.insetMapping.has(o)&&r.removeInsets([o])})}showInset(e,t,o,n){this._insetModifyQueueByOutputId.queue(o.model.outputId+(n===1?"-right":"left"),async()=>{let r=n===1?this._modifiedWebview:this._originalWebview;if(!r||!r.insetMapping.has(o))return;let s=this._list.getCellViewScrollTop(e),l=t.outputsViewModels.indexOf(o),c=e.getOutputOffsetInCell(n,l);r.updateScrollTops([{cell:t,output:o,cellTop:s,outputOffset:c,forceDisplay:!0}],[])})}hideInset(e,t,o){this._modifiedWebview?.hideInset(o),this._originalWebview?.hideInset(o)}getDomNode(){return this._rootElement}getOverflowContainerDomNode(){return this._overflowContainer}getControl(){return this}clearInput(){this.inlineDiffWidget?.hide(),super.clearInput(),this._modifiedResourceDisposableStore.clear(),this._list?.splice(0,this._list?.length||0),this._model=null,this.notebookDiffViewModel?.dispose(),this.notebookDiffViewModel=void 0}deltaCellOutputContainerClassNames(e,t,o,n){e===0?this._originalWebview?.deltaCellOutputContainerClassNames(t,o,n):this._modifiedWebview?.deltaCellOutputContainerClassNames(t,o,n)}getLayoutInfo(){if(!this._list)throw new Error("Editor is not initalized successfully");return{width:this._dimension.width,height:this._dimension.height,fontInfo:this.fontInfo,scrollHeight:this._list?.getScrollHeight()??0,stickyHeight:0,listViewOffsetTop:0}}layout(e,t){this._rootElement.classList.toggle("mid-width",e.width<1e3&&e.width>=600),this._rootElement.classList.toggle("narrow-width",e.width<600);let o=this.isOverviewRulerEnabled();this._dimension=e.with(e.width-(o?Xm.ENTIRE_DIFF_OVERVIEW_WIDTH:0)),this._listViewContainer.style.height=`${e.height}px`,this._listViewContainer.style.width=`${this._dimension.width}px`,this._inlineView?(this._listViewContainer.style.display="none",this.inlineDiffWidget?.setLayout(e,t)):(this.inlineDiffWidget?.hide(),this._listViewContainer.style.display="block",this._list?.layout(this._dimension.height,this._dimension.width),this._modifiedWebview&&(this._modifiedWebview.element.style.width="calc(50% - 16px)",this._modifiedWebview.element.style.left="calc(50%)"),this._originalWebview&&(this._originalWebview.element.style.width="calc(50% - 16px)",this._originalWebview.element.style.left="16px"),this._webviewTransparentCover&&(this._webviewTransparentCover.style.height=`${this._dimension.height}px`,this._webviewTransparentCover.style.width=`${this._dimension.width}px`),o&&this._overviewRuler.layout()),this._lastLayoutProperties={dimension:e,position:t},this._eventDispatcher?.emit([new yVt({width:!0,fontInfo:!0},this.getLayoutInfo())])}dispose(){this._isDisposed=!0,this._layoutCancellationTokenSource?.dispose(),this._detachModel(),super.dispose()}};Xm=I([m(1,F),m(2,De),m(3,X),m(4,JK),m(5,B),m(6,Te),m(7,le),m(8,un),m(9,ee)],Xm);Sk(0,10,"notebook-diff-view-viewport-slider");is((a,i)=>{let e=a.getColor(hGi);i.addRule(`
.notebook-text-diff-editor .diagonal-fill {
background-image: linear-gradient(
-45deg,
${e} 12.5%,
#0000 12.5%, #0000 50%,
${e} 50%, ${e} 62.5%,
#0000 62.5%, #0000 100%
);
background-size: 8px 8px;
}
`),i.addRule(`.notebook-text-diff-editor .cell-body { margin: ${pD}px; }`),i.addRule(`.notebook-text-diff-editor .cell-placeholder-body { margin: ${pD}px 0; }`)});var mMe=class extends C{constructor(i,e,t){super(),this._workerManager=this._register(new xwi(i,e,t))}canComputeDiff(i,e){throw new Error("Method not implemented.")}computeDiff(i,e){return this._workerManager.withWorker().then(t=>t.computeDiff(i,e))}canPromptRecommendation(i){return this._workerManager.withWorker().then(e=>e.canPromptRecommendation(i))}};mMe=I([m(0,un),m(1,Ct),m(2,Ay)],mMe);var xwi=class extends C{constructor(e,t,o){super();this._notebookService=e;this._modelService=t;this._webWorkerService=o;this._editorWorkerClient=null}withWorker(){return this._editorWorkerClient||(this._editorWorkerClient=new Ewi(this._notebookService,this._modelService,this._webWorkerService),this._register(this._editorWorkerClient)),Promise.resolve(this._editorWorkerClient)}},kwi=class extends C{constructor(e,t,o){super();this._proxy=e;this._notebookService=t;this._modelService=o;this._syncedModels=Object.create(null);this._syncedModelsLastUsedTime=Object.create(null)}ensureSyncedResources(e){for(let t of e){let o=t.toString();this._syncedModels[o]||this._beginModelSync(t),this._syncedModels[o]&&(this._syncedModelsLastUsedTime[o]=new Date().getTime())}}_beginModelSync(e){let t=this._notebookService.listNotebookDocuments().find(c=>c.uri.toString()===e.toString());if(!t)return;let o=e.toString();this._proxy.$acceptNewModel(t.uri.toString(),t.metadata,t.transientOptions.transientDocumentMetadata,t.cells.map(c=>({handle:c.handle,url:c.uri.toString(),source:c.textBuffer.getLinesContent(),eol:c.textBuffer.getEOL(),versionId:c.textModel?.getVersionId()??0,language:c.language,mime:c.mime,cellKind:c.cellKind,outputs:c.outputs.map(u=>({outputId:u.outputId,outputs:u.outputs})),metadata:c.metadata,internalMetadata:c.internalMetadata})));let n=new P,r=c=>({handle:c.handle,url:c.uri.toString(),source:c.textBuffer.getLinesContent(),eol:c.textBuffer.getEOL(),versionId:0,language:c.language,cellKind:c.cellKind,outputs:c.outputs.map(u=>({outputId:u.outputId,outputs:u.outputs})),metadata:c.metadata,internalMetadata:c.internalMetadata}),s=new Set,l=c=>{s.add(c),n.add(c.onDidChangeContent(u=>{typeof u=="object"&&u.type==="model"&&this._proxy.$acceptCellModelChanged(o,c.handle,u.event)}))};t.cells.forEach(c=>l(c)),t.cells.length!==s.size&&n.add(this._modelService.onModelAdded(c=>{if(c.uri.scheme!==Y.vscodeNotebookCell||!(c instanceof Bu))return;let u=Zo.parse(c.uri);if(!u||!Xe(u.notebook,t.uri))return;let p=t.cells.find(h=>h.handle===u.handle);p&&l(p)})),n.add(t.onDidChangeContent(c=>{let u=[];c.rawEvents.forEach(p=>{switch(p.kind){case 1:case 6:{u.push({kind:p.kind,changes:p.changes.map(h=>[h[0],h[1],h[2].map(g=>r(g))])});for(let h of p.changes)for(let g of h[2])l(g);break}case 2:{u.push({kind:2,index:p.index,length:p.length,newIdx:p.newIdx,cells:p.cells.map(h=>r(h))});break}case 10:break;case 11:u.push({kind:p.kind,metadata:p.metadata});default:u.push(p)}}),this._proxy.$acceptModelChanged(o.toString(),{rawEvents:u,versionId:c.versionId})})),n.add(t.onWillDispose(()=>{this._stopModelSync(o)})),n.add(Z(()=>{this._proxy.$acceptRemovedModel(o)})),this._syncedModels[o]=n}_stopModelSync(e){let t=this._syncedModels[e];delete this._syncedModels[e],delete this._syncedModelsLastUsedTime[e],Ue(t)}},Ewi=class extends C{constructor(e,t,o){super();this._notebookService=e;this._modelService=t;this._webWorkerService=o;this._worker=null,this._modelManager=null}computeDiff(e,t){return this._ensureSyncedResources([e,t]).$computeDiff(e.toString(),t.toString())}canPromptRecommendation(e){return this._ensureSyncedResources([e]).$canPromptRecommendation(e.toString())}_getOrCreateModelManager(e){return this._modelManager||(this._modelManager=this._register(new kwi(e,this._notebookService,this._modelService))),this._modelManager}_ensureSyncedResources(e){let t=this._getOrCreateWorker().proxy;return this._getOrCreateModelManager(t).ensureSyncedResources(e),t}_getOrCreateWorker(){if(!this._worker)try{this._worker=this._register(this._webWorkerService.createWorkerClient(new gx({esmModuleLocation:gn.asBrowserUri("vs/workbench/contrib/notebook/common/services/notebookWebWorkerMain.js"),label:"NotebookEditorWorker"})))}catch(e){throw e}return this._worker}};var PVt=class extends C{constructor(){super(...arguments);this._onDidChangeProviders=this._register(new E);this.onDidChangeProviders=this._onDidChangeProviders.event;this._onDidChangeItems=this._register(new E);this.onDidChangeItems=this._onDidChangeItems.event;this._providers=[]}registerCellStatusBarItemProvider(e){this._providers.push(e);let t;return e.onDidChangeStatusBarItems&&(t=e.onDidChangeStatusBarItems(()=>this._onDidChangeItems.fire())),this._onDidChangeProviders.fire(),Z(()=>{t?.dispose();let o=this._providers.findIndex(n=>n===e);this._providers.splice(o,1)})}async getStatusBarItemsForCell(e,t,o,n){let r=this._providers.filter(s=>s.viewType===o||s.viewType==="*");return await Promise.all(r.map(async s=>{try{return await s.provideCellStatusBarItems(e,t,n)??{items:[]}}catch(l){return ss(l),{items:[]}}}))}};var hMe=class{constructor(i,e,t,o){this.editorGroupService=i;this.instantiationService=o;this._tokenPool=1;this._disposables=new P;this._notebookEditors=new Map;this.groupListener=new Map;this._onNotebookEditorAdd=new E;this._onNotebookEditorsRemove=new E;this.onDidAddNotebookEditor=this._onNotebookEditorAdd.event;this.onDidRemoveNotebookEditor=this._onNotebookEditorsRemove.event;this._borrowableEditors=new Map;let n=s=>{let{id:l}=s,c=[];c.push(s.onDidCloseEditor(u=>{let p=this._borrowableEditors.get(s.id);if(!p)return;(u.editor instanceof ha||u.editor instanceof yw?[u.editor]:Nj(u.editor)?u.editor.editorInputs:[]).forEach(g=>{let f=p.get(g.resource),v=f?.findIndex(S=>S.editorType===g.typeId);if(!f||v===void 0||v===-1)return;let b=f.splice(v,1)[0];b.token=void 0,this._disposeWidget(b.widget),b.disposableStore.dispose(),b.widget=void 0})})),c.push(s.onWillMoveEditor(u=>{k8e(u.editor)&&this._allowWidgetMove(u.editor,u.groupId,u.target),Nj(u.editor)&&u.editor.editorInputs.forEach(p=>{this._allowWidgetMove(p,u.groupId,u.target)})})),this.groupListener.set(l,c)};this._disposables.add(i.onDidAddGroup(n)),i.whenReady.then(()=>i.groups.forEach(n)),this._disposables.add(i.onDidRemoveGroup(s=>{let l=this.groupListener.get(s.id);l&&(l.forEach(u=>u.dispose()),this.groupListener.delete(s.id));let c=this._borrowableEditors.get(s.id);if(this._borrowableEditors.delete(s.id),c)for(let u of c.values())for(let p of u)p.token=void 0,this._disposeWidget(p.widget),p.disposableStore.dispose()})),this._mostRecentRepl=C4.bindTo(t);let r=fWt.bindTo(t);this._disposables.add(e.onDidEditorsChange(s=>{s.event.kind===5&&!r.get()?e.editors.find(l=>Nj(l))&&r.set(!0):s.event.kind===6&&r.get()&&(e.editors.find(l=>Nj(l))||r.set(!1))}))}dispose(){this._disposables.dispose(),this._onNotebookEditorAdd.dispose(),this._onNotebookEditorsRemove.dispose(),this.groupListener.forEach(i=>{i.forEach(e=>e.dispose())}),this.groupListener.clear(),this._borrowableEditors.forEach(i=>{i.forEach(e=>{e.forEach(t=>t.disposableStore.dispose())})})}_disposeWidget(i){i.onWillHide();let e=i.getDomNode();i.dispose(),e.remove()}_allowWidgetMove(i,e,t){let o=this.editorGroupService.getPart(e),n=this.editorGroupService.getPart(t);if(o.windowId!==n.windowId)return;let r=this._borrowableEditors.get(t)?.get(i.resource)?.findIndex(p=>p.editorType===i.typeId);if(r!==void 0&&r!==-1)return;let s=this._borrowableEditors.get(e)?.get(i.resource)?.find(p=>p.editorType===i.typeId);if(!s)throw new Error("no widget at source group");let l=this._borrowableEditors.get(e)?.get(i.resource);if(l){let p=l.findIndex(h=>h.editorType===i.typeId);p!==-1&&l.splice(p,1)}let c=this._borrowableEditors.get(t);c||(c=new vt,this._borrowableEditors.set(t,c));let u=c.get(i.resource)??[];u?.push(s),c.set(i.resource,u)}retrieveExistingWidgetFromURI(i){for(let e of this._borrowableEditors.values()){let t=e.get(i);if(t&&t.length>0)return this._createBorrowValue(t[0].token,t[0])}}retrieveAllExistingWidgets(){let i=[];for(let e of this._borrowableEditors.values())for(let t of e.values())for(let o of t)i.push(this._createBorrowValue(o.token,o));return i}retrieveWidget(i,e,t,o,n,r){let s=this._borrowableEditors.get(e)?.get(t.resource)?.find(l=>l.editorType===t.typeId);if(s)s.token=this._tokenPool++;else{let l=i.get(X),c=i.get(rd),u=new P,p=this.createWidget(l,u,c,o,r,n),h=this._tokenPool++;s={widget:p,editorType:t.typeId,token:h,disposableStore:u};let g=this._borrowableEditors.get(e);g||(g=new vt,this._borrowableEditors.set(e,g));let f=g.get(t.resource)??[];f.push(s),g.set(t.resource,f)}return this._createBorrowValue(s.token,s)}createWidget(i,e,t,o,n,r){let s=e.add(this.instantiationService.createChild(new Io([X,i],[rd,t]))),l=o??UZ();return s.createInstance(XK,{...l,codeWindow:n??l.codeWindow},r)}_createBorrowValue(i,e){return{get value(){return e.token===i?e.widget:void 0}}}addNotebookEditor(i){this._notebookEditors.set(i.getId(),i),this._onNotebookEditorAdd.fire(i)}removeNotebookEditor(i){let e=i.getViewModel()?.notebookDocument.uri;this._notebookEditors.delete(i.getId())&&this._onNotebookEditorsRemove.fire(i),this._mostRecentRepl.get()===e?.toString()&&this._mostRecentRepl.reset()}getNotebookEditor(i){return this._notebookEditors.get(i)}listNotebookEditors(){return[...this._notebookEditors].map(i=>i[1])}getNotebookForPossibleCell(i){for(let e of this._notebookEditors.values())for(let[,t]of e.codeEditors)if(t===i)return e}updateReplContextKey(i){this._mostRecentRepl.set(i)}};hMe=I([m(0,Et),m(1,ee),m(2,X),m(3,F)],hMe);var QZ=class extends C{constructor(e,t,o){super();this.fileService=e;this.logService=t;this.workingCopyBackupService=o;this._onDidCreate=this._register(new E);this.onDidCreate=this._onDidCreate.event;this.mapResourceToWorkingCopy=new vt;this.mapResourceToDisposeListener=new vt}has(e){return this.mapResourceToWorkingCopy.has(e)}add(e,t){this.get(e)!==t&&(this.mapResourceToWorkingCopy.set(e,t),this.mapResourceToDisposeListener.get(e)?.dispose(),this.mapResourceToDisposeListener.set(e,t.onWillDispose(()=>this.remove(e))),this._onDidCreate.fire(t))}remove(e){let t=this.mapResourceToDisposeListener.get(e);return t&&(Ue(t),this.mapResourceToDisposeListener.delete(e)),this.mapResourceToWorkingCopy.delete(e)}get workingCopies(){return[...this.mapResourceToWorkingCopy.values()]}get(e){return this.mapResourceToWorkingCopy.get(e)}dispose(){super.dispose(),this.mapResourceToWorkingCopy.clear(),Ue(this.mapResourceToDisposeListener.values()),this.mapResourceToDisposeListener.clear()}async destroy(){try{await fn.settled(this.workingCopies.map(async e=>{e.isDirty()&&await this.saveWithFallback(e)}))}catch(e){this.logService.error(e)}Ue(this.mapResourceToWorkingCopy.values()),this.dispose()}async saveWithFallback(e){let t=!1;try{t=await e.save()}catch{}if(!t||e.isDirty()){let o=await this.workingCopyBackupService.resolve(e);o&&await this.fileService.writeFile(e.resource,o.value,{unlock:!0})}}};QZ=I([m(0,be),m(1,ne),m(2,Gm)],QZ);var gMe=class extends QZ{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super(o,s,c);this.workingCopyTypeId=e;this.modelFactory=t;this.lifecycleService=n;this.labelService=r;this.workingCopyFileService=l;this.uriIdentityService=u;this.filesConfigurationService=p;this.workingCopyService=h;this.notificationService=g;this.workingCopyEditorService=f;this.editorService=v;this.elevatedFileService=b;this.progressService=S;this._onDidResolve=this._register(new E);this.onDidResolve=this._onDidResolve.event;this._onDidChangeDirty=this._register(new E);this.onDidChangeDirty=this._onDidChangeDirty.event;this._onDidChangeReadonly=this._register(new E);this.onDidChangeReadonly=this._onDidChangeReadonly.event;this._onDidChangeOrphaned=this._register(new E);this.onDidChangeOrphaned=this._onDidChangeOrphaned.event;this._onDidSaveError=this._register(new E);this.onDidSaveError=this._onDidSaveError.event;this._onDidSave=this._register(new E);this.onDidSave=this._onDidSave.event;this._onDidRevert=this._register(new E);this.onDidRevert=this._onDidRevert.event;this._onDidRemove=this._register(new E);this.onDidRemove=this._onDidRemove.event;this.mapResourceToWorkingCopyListeners=new vt;this.mapResourceToPendingWorkingCopyResolve=new vt;this.workingCopyResolveQueue=this._register(new sU);this.mapCorrelationIdToWorkingCopiesToRestore=new Map;this.registerListeners()}registerListeners(){this._register(this.fileService.onDidFilesChange(e=>this.onDidFilesChange(e))),this._register(this.fileService.onDidChangeFileSystemProviderCapabilities(e=>this.onDidChangeFileSystemProviderCapabilities(e))),this._register(this.fileService.onDidChangeFileSystemProviderRegistrations(e=>this.onDidChangeFileSystemProviderRegistrations(e))),this._register(this.workingCopyFileService.onWillRunWorkingCopyFileOperation(e=>this.onWillRunWorkingCopyFileOperation(e))),this._register(this.workingCopyFileService.onDidFailWorkingCopyFileOperation(e=>this.onDidFailWorkingCopyFileOperation(e))),this._register(this.workingCopyFileService.onDidRunWorkingCopyFileOperation(e=>this.onDidRunWorkingCopyFileOperation(e))),Gt?this._register(this.lifecycleService.onBeforeShutdown(e=>e.veto(this.onBeforeShutdownWeb(),"veto.fileWorkingCopyManager"))):this._register(this.lifecycleService.onWillShutdown(e=>e.join(this.onWillShutdownDesktop(),{id:"join.fileWorkingCopyManager",label:d(17610,null)})))}onBeforeShutdownWeb(){return!!this.workingCopies.some(e=>e.hasState(2))}async onWillShutdownDesktop(){let e;for(;(e=this.workingCopies.filter(t=>t.hasState(2))).length>0;)await fn.settled(e.map(t=>t.joinState(2)))}onDidChangeFileSystemProviderCapabilities(e){this.queueWorkingCopyReloads(e.scheme)}onDidChangeFileSystemProviderRegistrations(e){e.added&&this.queueWorkingCopyReloads(e.scheme)}onDidFilesChange(e){this.queueWorkingCopyReloads(e)}queueWorkingCopyReloads(e){for(let t of this.workingCopies){if(t.isDirty())continue;let o=!1;typeof e=="string"?o=e===t.resource.scheme:o=e.contains(t.resource,0,1),o&&this.queueWorkingCopyReload(t)}}queueWorkingCopyReload(e){this.workingCopyResolveQueue.queueSize(e.resource)<=1&&this.workingCopyResolveQueue.queueFor(e.resource,async()=>{try{await this.reload(e)}catch(o){this.logService.error(o)}})}onWillRunWorkingCopyFileOperation(e){(e.operation===2||e.operation===3)&&e.waitUntil((async()=>{let t=[];for(let{source:o,target:n}of e.files)if(o){if(this.uriIdentityService.extUri.isEqual(o,n))continue;let r=[];for(let s of this.workingCopies)this.uriIdentityService.extUri.isEqualOrParent(s.resource,o)&&r.push(s);for(let s of r){let l=s.resource,c;this.uriIdentityService.extUri.isEqual(l,o)?c=n:c=je(n,l.path.substr(o.path.length+1)),t.push({source:l,target:c,snapshot:s.isDirty()?await s.model?.snapshot(1,ve.None):void 0})}}this.mapCorrelationIdToWorkingCopiesToRestore.set(e.correlationId,t)})())}onDidFailWorkingCopyFileOperation(e){if(e.operation===2||e.operation===3){let t=this.mapCorrelationIdToWorkingCopiesToRestore.get(e.correlationId);if(t){this.mapCorrelationIdToWorkingCopiesToRestore.delete(e.correlationId);for(let o of t)o.snapshot&&this.get(o.source)?.markModified()}}}onDidRunWorkingCopyFileOperation(e){switch(e.operation){case 0:e.waitUntil((async()=>{for(let{target:t}of e.files){let o=this.get(t);o&&!o.isDisposed()&&await o.revert()}})());break;case 2:case 3:e.waitUntil((async()=>{let t=this.mapCorrelationIdToWorkingCopiesToRestore.get(e.correlationId);t&&(this.mapCorrelationIdToWorkingCopiesToRestore.delete(e.correlationId),await fn.settled(t.map(async o=>{let n=this.uriIdentityService.asCanonicalUri(o.target);await this.resolve(n,{reload:{async:!1},contents:o.snapshot})})))})());break}}async reload(e){await this.joinPendingResolves(e.resource),!(e.isDirty()||e.isDisposed()||!this.has(e.resource))&&await this.doResolve(e,{reload:{async:!1}})}async resolve(e,t){let o=this.joinPendingResolves(e);return o&&await o,this.doResolve(e,t)}async doResolve(e,t){let o,n;A.isUri(e)?(n=e,o=this.get(n)):(n=e.resource,o=e);let r,s=!1,l={contents:t?.contents,forceReadFromFile:t?.reload?.force,limits:t?.limits};o?t?.contents?r=o.resolve(l):t?.reload?t.reload.async?(r=Promise.resolve(),(async()=>{try{await o.resolve(l)}catch(c){o.isDisposed()||mt(c)}})()):r=o.resolve(l):r=Promise.resolve():(s=!0,o=new _5(this.workingCopyTypeId,n,this.labelService.getUriBasenameLabel(n),this.modelFactory,async c=>{await this.resolve(n,{...c,reload:{async:!1}})},this.fileService,this.logService,this.workingCopyFileService,this.filesConfigurationService,this.workingCopyBackupService,this.workingCopyService,this.notificationService,this.workingCopyEditorService,this.editorService,this.elevatedFileService,this.progressService),r=o.resolve(l),this.registerWorkingCopy(o)),this.mapResourceToPendingWorkingCopyResolve.set(n,r),this.add(n,o),s&&o.isDirty()&&this._onDidChangeDirty.fire(o);try{await r}catch(c){throw s&&o.dispose(),c}finally{this.mapResourceToPendingWorkingCopyResolve.delete(n)}return s&&o.isDirty()&&this._onDidChangeDirty.fire(o),o}joinPendingResolves(e){if(this.mapResourceToPendingWorkingCopyResolve.get(e))return this.doJoinPendingResolves(e)}async doJoinPendingResolves(e){let t;for(;this.mapResourceToPendingWorkingCopyResolve.has(e);){let o=this.mapResourceToPendingWorkingCopyResolve.get(e);if(o===t)return;t=o;try{await o}catch{}}}registerWorkingCopy(e){let t=new P;t.add(e.onDidResolve(()=>this._onDidResolve.fire(e))),t.add(e.onDidChangeDirty(()=>this._onDidChangeDirty.fire(e))),t.add(e.onDidChangeReadonly(()=>this._onDidChangeReadonly.fire(e))),t.add(e.onDidChangeOrphaned(()=>this._onDidChangeOrphaned.fire(e))),t.add(e.onDidSaveError(()=>this._onDidSaveError.fire(e))),t.add(e.onDidSave(o=>this._onDidSave.fire({workingCopy:e,...o}))),t.add(e.onDidRevert(()=>this._onDidRevert.fire(e))),this.mapResourceToWorkingCopyListeners.set(e.resource,t)}remove(e){let t=super.remove(e),o=this.mapResourceToWorkingCopyListeners.get(e);return o&&(Ue(o),this.mapResourceToWorkingCopyListeners.delete(e)),t&&this._onDidRemove.fire(e),t}canDispose(e){return e.isDisposed()||!this.mapResourceToPendingWorkingCopyResolve.has(e.resource)&&!e.isDirty()?!0:this.doCanDispose(e)}async doCanDispose(e){let t=this.joinPendingResolves(e.resource);return t?(await t,this.canDispose(e)):e.isDirty()?(await H.toPromise(e.onDidChangeDirty),this.canDispose(e)):!0}dispose(){super.dispose(),this.mapResourceToPendingWorkingCopyResolve.clear(),Ue(this.mapResourceToWorkingCopyListeners.values()),this.mapResourceToWorkingCopyListeners.clear()}};gMe=I([m(2,be),m(3,ao),m(4,ot),m(5,ne),m(6,kp),m(7,Gm),m(8,dt),m(9,lr),m(10,Wa),m(11,Ne),m(12,Vf),m(13,ee),m(14,aF),m(15,Bo)],gMe);var ZK=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.typeId=e;this.resource=t;this.name=o;this.hasAssociatedFilePath=n;this.isScratchpad=r;this.initialContents=s;this.modelFactory=l;this.saveDelegate=c;this.workingCopyBackupService=p;this.logService=h;this._model=void 0;this._onDidChangeContent=this._register(new E);this.onDidChangeContent=this._onDidChangeContent.event;this._onDidChangeDirty=this._register(new E);this.onDidChangeDirty=this._onDidChangeDirty.event;this._onDidSave=this._register(new E);this.onDidSave=this._onDidSave.event;this._onDidRevert=this._register(new E);this.onDidRevert=this._onDidRevert.event;this._onWillDispose=this._register(new E);this.onWillDispose=this._onWillDispose.event;this.capabilities=this.isScratchpad?6:2,this.modified=this.hasAssociatedFilePath||!!(this.initialContents&&this.initialContents.markModified!==!1),this._register(u.registerWorkingCopy(this))}get model(){return this._model}isDirty(){return this.modified&&!this.isScratchpad}isModified(){return this.modified}setModified(e){this.modified!==e&&(this.modified=e,this.isScratchpad||this._onDidChangeDirty.fire())}async resolve(){if(this.trace("resolve()"),this.isResolved()){this.trace("resolve() - exit (already resolved)");return}let e,t=await this.workingCopyBackupService.resolve(this);t?(this.trace("resolve() - with backup"),e=t.value):this.initialContents?.value?(this.trace("resolve() - with initial contents"),e=this.initialContents.value):(this.trace("resolve() - empty"),e=O1i()),await this.doCreateModel(e),this.setModified(this.hasAssociatedFilePath||!!t||!!(this.initialContents&&this.initialContents.markModified!==!1)),(t||this.initialContents)&&this._onDidChangeContent.fire()}async doCreateModel(e){this.trace("doCreateModel()"),this._model=this._register(await this.modelFactory.createModel(this.resource,e,ve.None)),this.installModelListeners(this._model)}installModelListeners(e){this._register(e.onDidChangeContent(t=>this.onModelContentChanged(t))),this._register(e.onWillDispose(()=>this.dispose()))}onModelContentChanged(e){!this.hasAssociatedFilePath&&e.isInitial?this.setModified(!1):this.setModified(!0),this._onDidChangeContent.fire()}isResolved(){return!!this.model}get backupDelay(){return this.model?.configuration?.backupDelay}async backup(e){let t;return this.isResolved()?t=await wa(this.model.snapshot(2,e),e):this.initialContents&&(t=this.initialContents.value),{content:t}}async save(e){this.trace("save()");let t=await this.saveDelegate(this,e);return t&&this._onDidSave.fire({reason:e?.reason,source:e?.source}),t}async revert(){this.trace("revert()"),this.setModified(!1),this._onDidRevert.fire(),this.dispose()}dispose(){this.trace("dispose()"),this._onWillDispose.fire(),super.dispose()}trace(e){this.logService.trace(`[untitled file working copy] ${e}`,this.resource.toString(),this.typeId)}};ZK=I([m(8,Wa),m(9,Gm),m(10,ne)],ZK);var fMe=class extends QZ{constructor(e,t,o,n,r,s,l,c){super(n,s,l);this.workingCopyTypeId=e;this.modelFactory=t;this.saveDelegate=o;this.labelService=r;this.workingCopyService=c;this._onDidSave=this._register(new E);this.onDidSave=this._onDidSave.event;this._onDidChangeDirty=this._register(new E);this.onDidChangeDirty=this._onDidChangeDirty.event;this._onWillDispose=this._register(new E);this.onWillDispose=this._onWillDispose.event;this.mapResourceToWorkingCopyListeners=new vt}async resolve(e){let t=this.doCreateOrGet(e);return await t.resolve(),t}doCreateOrGet(e=Object.create(null)){let t=this.massageOptions(e);if(t.untitledResource){let o=this.get(t.untitledResource);if(o)return o}return this.doCreate(t)}massageOptions(e){let t=Object.create(null);return e.associatedResource?(t.untitledResource=A.from({scheme:Y.untitled,authority:e.associatedResource.authority,fragment:e.associatedResource.fragment,path:e.associatedResource.path,query:e.associatedResource.query}),t.associatedResource=e.associatedResource):(e.untitledResource?.scheme===Y.untitled&&(t.untitledResource=e.untitledResource),t.isScratchpad=e.isScratchpad),t.contents=e.contents,t}doCreate(e){let t=e.untitledResource;if(!t){let n=1;do t=A.from({scheme:Y.untitled,path:e.isScratchpad?`Scratchpad-${n}`:`Untitled-${n}`,query:this.workingCopyTypeId?`typeId=${this.workingCopyTypeId}`:void 0}),n++;while(this.has(t))}let o=new ZK(this.workingCopyTypeId,t,this.labelService.getUriBasenameLabel(t),!!e.associatedResource,!!e.isScratchpad,e.contents,this.modelFactory,this.saveDelegate,this.workingCopyService,this.workingCopyBackupService,this.logService);return this.registerWorkingCopy(o),o}registerWorkingCopy(e){let t=new P;t.add(e.onDidChangeDirty(()=>this._onDidChangeDirty.fire(e))),t.add(e.onWillDispose(()=>this._onWillDispose.fire(e))),this.mapResourceToWorkingCopyListeners.set(e.resource,t),this.add(e.resource,e),e.isDirty()&&this._onDidChangeDirty.fire(e)}remove(e){let t=super.remove(e),o=this.mapResourceToWorkingCopyListeners.get(e);return o&&(Ue(o),this.mapResourceToWorkingCopyListeners.delete(e)),t}dispose(){super.dispose(),Ue(this.mapResourceToWorkingCopyListeners.values()),this.mapResourceToWorkingCopyListeners.clear()}notifyDidSave(e,t){this._onDidSave.fire({source:e,target:t})}};fMe=I([m(3,be),m(4,ot),m(5,ne),m(6,Gm),m(7,Wa)],fMe);var Q4=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N,O){super();this.workingCopyTypeId=e;this.storedWorkingCopyModelFactory=t;this.untitledWorkingCopyModelFactory=o;this.fileService=n;this.logService=l;this.workingCopyFileService=c;this.uriIdentityService=p;this.fileDialogService=h;this.filesConfigurationService=g;this.pathService=w;this.environmentService=k;this.dialogService=T;this.decorationsService=N;this.stored=this._register(new gMe(this.workingCopyTypeId,this.storedWorkingCopyModelFactory,n,r,s,l,c,u,p,g,f,v,b,S,y,O)),this.untitled=this._register(new fMe(this.workingCopyTypeId,this.untitledWorkingCopyModelFactory,async(V,U)=>!!await this.saveAs(V.resource,void 0,U),n,s,l,u,f)),this.onDidCreate=H.any(this.stored.onDidCreate,this.untitled.onDidCreate),this.provideDecorations()}static{this.FILE_WORKING_COPY_SAVE_CREATE_SOURCE=ph.registerSource("fileWorkingCopyCreate.source",d(17585,null))}static{this.FILE_WORKING_COPY_SAVE_REPLACE_SOURCE=ph.registerSource("fileWorkingCopyReplace.source",d(17587,null))}provideDecorations(){let e=this._register(new class extends C{constructor(o){super();this.stored=o;this.label=d(17586,null);this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this.registerListeners()}registerListeners(){this._register(this.stored.onDidResolve(o=>{(o.isReadonly()||o.hasState(4))&&this._onDidChange.fire([o.resource])})),this._register(this.stored.onDidRemove(o=>this._onDidChange.fire([o]))),this._register(this.stored.onDidChangeReadonly(o=>this._onDidChange.fire([o.resource]))),this._register(this.stored.onDidChangeOrphaned(o=>this._onDidChange.fire([o.resource])))}provideDecorations(o){let n=this.stored.get(o);if(!n||n.isDisposed())return;let r=n.isReadonly(),s=n.hasState(4);if(r&&s)return{color:uL,letter:M.lockSmall,strikethrough:!0,tooltip:d(17591,null)};if(r)return{letter:M.lockSmall,tooltip:d(17590,null)};if(s)return{color:uL,strikethrough:!0,tooltip:d(17584,null)}}}(this.stored));this._register(this.decorationsService.registerDecorationsProvider(e))}get workingCopies(){return[...this.stored.workingCopies,...this.untitled.workingCopies]}get(e){return this.stored.get(e)??this.untitled.get(e)}resolve(e,t){return A.isUri(e)?e.scheme===Y.untitled?this.untitled.resolve({untitledResource:e}):this.stored.resolve(e,t):this.untitled.resolve(e)}async saveAs(e,t,o){if(!t){let n=this.get(e);n instanceof ZK&&n.hasAssociatedFilePath?t=await this.suggestSavePath(e):t=await this.fileDialogService.pickFileToSave(await this.suggestSavePath(o?.suggestedTarget??e),o?.availableFileSystems)}if(t){if(this.filesConfigurationService.isReadonly(t))if(await this.confirmMakeWriteable(t))this.filesConfigurationService.updateReadonly(t,!1);else return;return this.fileService.hasProvider(e)&&Xe(e,t)?this.doSave(e,{...o,force:!0}):this.fileService.hasProvider(e)&&this.uriIdentityService.extUri.isEqual(e,t)&&await this.fileService.exists(e)?(await this.workingCopyFileService.move([{file:{source:e,target:t}}],ve.None),await this.doSave(e,o)??await this.doSave(t,o)):this.doSaveAs(e,t,o)}}async doSave(e,t){let o=this.stored.get(e);if(o&&await o.save(t))return o}async doSaveAs(e,t,o){let n,r=this.get(e);r?.isResolved()?n=await r.model.snapshot(1,ve.None):n=(await this.fileService.readFileStream(e)).value;let{targetFileExists:s,targetStoredFileWorkingCopy:l}=await this.doResolveSaveTarget(e,t);if(!(r instanceof ZK&&r.hasAssociatedFilePath&&s&&this.uriIdentityService.extUri.isEqual(t,Og(r.resource,this.environmentService.remoteAuthority,this.pathService.defaultUriScheme))&&!await this.confirmOverwrite(t)||(await l.model?.update(n,ve.None),o?.source||(o={...o,source:s?Q4.FILE_WORKING_COPY_SAVE_REPLACE_SOURCE:Q4.FILE_WORKING_COPY_SAVE_CREATE_SOURCE}),!await l.save({...o,from:e,force:!0})))){try{await r?.revert()}catch(u){this.logService.error(u)}return e.scheme===Y.untitled&&this.untitled.notifyDidSave(e,t),l}}async doResolveSaveTarget(e,t){let o=!1,n=this.stored.get(t);return n?.isResolved()?o=!0:(o=await this.fileService.exists(t),o||await this.workingCopyFileService.create([{resource:t}],ve.None),this.uriIdentityService.extUri.isEqual(e,t)&&this.get(e)?n=await this.stored.resolve(e):n=await this.stored.resolve(t)),{targetFileExists:o,targetStoredFileWorkingCopy:n}}async confirmOverwrite(e){let{confirmed:t}=await this.dialogService.confirm({type:"warning",message:d(17583,null,Ye(e)),detail:d(17589,null,Ye(e),Ye(ci(e))),primaryButton:d(17592,null)});return t}async confirmMakeWriteable(e){let{confirmed:t}=await this.dialogService.confirm({type:"warning",message:d(17581,null,Ye(e)),detail:d(17582,null),primaryButton:d(17588,null)});return t}async suggestSavePath(e){if(this.fileService.hasProvider(e))return e;let t=this.get(e);if(t instanceof ZK&&t.hasAssociatedFilePath)return Og(e,this.environmentService.remoteAuthority,this.pathService.defaultUriScheme);let o=await this.fileDialogService.defaultFilePath();if(t){let n=je(o,t.name);if(await this.pathService.hasValidBasename(n,t.name))return n}return je(o,Ye(e))}async destroy(){await fn.settled([this.stored.destroy(),this.untitled.destroy()])}};Q4=I([m(3,be),m(4,ao),m(5,ot),m(6,ne),m(7,kp),m(8,Gm),m(9,dt),m(10,dn),m(11,lr),m(12,Wa),m(13,Ne),m(14,Vf),m(15,ee),m(16,aF),m(17,wn),m(18,Vt),m(19,ct),m(20,Cv),m(21,Bo)],Q4);var NZe=class extends Ww{constructor(e,t,o,n,r){super();this._instantiationService=e;this._notebookService=t;this._configurationService=o;this._telemetryService=n;this._notebookLoggingService=r;this._disposables=new P;this._workingCopyManagers=new Map;this._modelListener=new Map;this._onDidSaveNotebook=new E;this.onDidSaveNotebook=this._onDidSaveNotebook.event;this._onDidChangeDirty=new E;this.onDidChangeDirty=this._onDidChangeDirty.event;this._dirtyStates=new vt;this.modelsToDispose=new Set}dispose(){this._disposables.dispose(),this._onDidSaveNotebook.dispose(),this._onDidChangeDirty.dispose(),Ue(this._modelListener.values()),Ue(this._workingCopyManagers.values())}isDirty(e){return this._dirtyStates.get(e)??!1}isListeningToModel(e){for(let t of this._modelListener.keys())if(t.resource.toString()===e.toString())return!0;return!1}async createReferencedObject(e,t,o,n,r,s){this.modelsToDispose.delete(e);let l=A.parse(e),c=_O.create(t,s),u=this._workingCopyManagers.get(c);if(!u){let v=new bTe(t,this._notebookService,this._configurationService,this._telemetryService,this._notebookLoggingService);u=this._instantiationService.createInstance(Q4,c,v,v),this._workingCopyManagers.set(c,u)}let p=r||t==="interactive"&&this._configurationService.getValue(ft.InteractiveWindowPromptToSave)!==!0,g=await this._instantiationService.createInstance(lF,l,o,t,u,p).load({limits:n}),f;return this._modelListener.set(g,hn(g.onDidSave(()=>this._onDidSaveNotebook.fire(g.resource)),g.onDidChangeDirty(()=>{let v=g.isDirty();this._dirtyStates.set(g.resource,v),v&&!f?f=this.acquire(e,t):f&&(f.dispose(),f=void 0),this._onDidChangeDirty.fire(g)}),Z(()=>f?.dispose()))),g}destroyReferencedObject(e,t){this.modelsToDispose.add(e),(async()=>{try{let o=await t;if(!this.modelsToDispose.has(e)||(o instanceof lF&&await o.canDispose(),!this.modelsToDispose.has(e)))return;this._modelListener.get(o)?.dispose(),this._modelListener.delete(o),o.dispose()}catch(o){this._notebookLoggingService.error("NotebookModelCollection","FAILED to destory notebook - "+o)}finally{this.modelsToDispose.delete(e)}})()}};NZe=I([m(0,F),m(1,un),m(2,B),m(3,Te),m(4,_v)],NZe);var vMe=class{constructor(i,e,t,o){this._notebookService=e;this._extensionService=t;this._uriIdentService=o;this._onWillFailWithConflict=new JH;this.onWillFailWithConflict=this._onWillFailWithConflict.event;this._data=i.createInstance(NZe),this.onDidSaveNotebook=this._data.onDidSaveNotebook,this.onDidChangeDirty=this._data.onDidChangeDirty}dispose(){this._data.dispose()}isDirty(i){return this._data.isDirty(i)}createUntitledUri(i){let e=this._notebookService.getContributedNotebookType(Oi(i));if(!e)throw new Error("UNKNOWN notebook type: "+i);let t=AZ.possibleFileEnding(e.selectors)??"";for(let o=1;;o++){let n=A.from({scheme:Y.untitled,path:`Untitled-${o}${t}`,query:i});if(!this._notebookService.getNotebookTextModel(n)&&!this._data.isListeningToModel(n))return n}}async validateResourceViewType(i,e){if(!i&&!e)throw new Error("Must provide at least one of resource or viewType");if(i?.scheme===Zo.scheme){let n=i;if(i=dxe(i)?.notebook,!i)throw new Error(`CANNOT open a cell-uri as notebook. Tried with ${n.toString()}`)}let t=this._uriIdentService.asCanonicalUri(i??this.createUntitledUri(e)),o=this._notebookService.getNotebookTextModel(t);if(!e)if(o)e=o.viewType;else{await this._extensionService.whenInstalledExtensionsRegistered();let n=this._notebookService.getContributedNotebookTypes(t);e=n.find(r=>r.priority==="exclusive")?.id??n.find(r=>r.priority==="default")?.id??n[0]?.id}if(!e)throw new Error(`Missing viewType for '${t}'`);if(o&&o.viewType!==e){await this._onWillFailWithConflict.fireAsync({resource:t,viewType:e},ve.None);let n=this._notebookService.getNotebookTextModel(t)?.viewType;if(n&&n!==e)throw new Error(`A notebook with view type '${n}' already exists for '${t}', CANNOT create another notebook with view type ${e}`)}return{resource:t,viewType:e}}async createUntitledNotebookTextModel(i){let e=this._uriIdentService.asCanonicalUri(this.createUntitledUri(i));return await this._notebookService.createNotebookTextModel(i,e)}async resolve(i,e,t){let o,n;A.isUri(i)?o=i:i.untitledResource&&(i.untitledResource.scheme===Y.untitled?o=i.untitledResource:(o=i.untitledResource.with({scheme:Y.untitled}),n=!0));let r=await this.validateResourceViewType(o,e),s=this._data.acquire(r.resource.toString(),r.viewType,n,t?.limits,t?.scratchpad,t?.viewType);try{return{object:await s.object,dispose(){s.dispose()}}}catch(l){throw s.dispose(),l}}};vMe=I([m(0,F),m(1,un),m(2,lt),m(3,dt)],vMe);var Twi=class a{constructor(i){this.notebookPriorities=new vt;this.kernel=i,this.score=-1,this.time=a._logicClock++}static{this._logicClock=0}},e2=class{static str(i){return`${i.notebookType}/${i.uri.toString()}`}static obj(i){let e=i.indexOf("/");return{notebookType:i.substring(0,e),uri:A.parse(i.substring(e+1))}}},_wi=class extends C{constructor(e,t,o){super();this.action=e;this.model=t;this.isPrimary=o;this._onDidChangeState=this._register(new E);this.onDidChangeState=this._onDidChangeState.event}async runAction(){if(this.execution)return this.execution;this.execution=this._runAction(),this._onDidChangeState.fire(),await this.execution,this.execution=void 0,this._onDidChangeState.fire()}async _runAction(){try{await this.action.run({uri:this.model.uri,$mid:14})}catch(e){console.warn(`Kernel source command failed: ${e}`)}}},bB=class extends C{constructor(e,t,o,n){super();this._notebookService=e;this._storageService=t;this._menuService=o;this._contextKeyService=n;this._kernels=new Map;this._notebookBindings=new il(1e3,.7);this._onDidChangeNotebookKernelBinding=this._register(new E);this._onDidAddKernel=this._register(new E);this._onDidRemoveKernel=this._register(new E);this._onDidChangeNotebookAffinity=this._register(new E);this._onDidChangeSourceActions=this._register(new E);this._onDidNotebookVariablesChange=this._register(new E);this._kernelSources=new Map;this._kernelSourceActionsUpdates=new Map;this._kernelDetectionTasks=new Map;this._onDidChangeKernelDetectionTasks=this._register(new E);this._kernelSourceActionProviders=new Map;this.onDidChangeSelectedNotebooks=this._onDidChangeNotebookKernelBinding.event;this.onDidAddKernel=this._onDidAddKernel.event;this.onDidRemoveKernel=this._onDidRemoveKernel.event;this.onDidChangeNotebookAffinity=this._onDidChangeNotebookAffinity.event;this.onDidChangeSourceActions=this._onDidChangeSourceActions.event;this.onDidChangeKernelDetectionTasks=this._onDidChangeKernelDetectionTasks.event;this.onDidNotebookVariablesUpdate=this._onDidNotebookVariablesChange.event;this._register(e.onDidAddNotebookDocument(this._tryAutoBindNotebook,this)),this._register(e.onWillRemoveNotebookDocument(r=>{let s=e2.str(r);this._notebookBindings.get(s)&&r.uri.scheme===Y.untitled&&this.selectKernelForNotebook(void 0,r),this._kernelSourceActionsUpdates.get(s)?.dispose(),this._kernelSourceActionsUpdates.delete(s)}));try{let r=JSON.parse(this._storageService.get(bB._storageNotebookBinding,1,"[]"));this._notebookBindings.fromJSON(r)}catch{}}static{this._storageNotebookBinding="notebook.controller2NotebookBindings"}dispose(){this._kernels.clear(),this._kernelSources.forEach(e=>{e.menu.dispose(),e.actions.forEach(t=>t[1].dispose())}),this._kernelSourceActionsUpdates.forEach(e=>{e.dispose()}),this._kernelSourceActionsUpdates.clear(),super.dispose()}_persistMementos(){this._persistSoonHandle?.dispose(),this._persistSoonHandle=jv(Ki(),()=>{this._storageService.store(bB._storageNotebookBinding,JSON.stringify(this._notebookBindings),1,1)},100)}static _score(e,t){return e.viewType==="*"?5:e.viewType===t.notebookType?10:0}_tryAutoBindNotebook(e,t){let o=this._notebookBindings.get(e2.str(e));if(!o)return;let n=this._kernels.get(o);!n||!bB._score(n.kernel,e)||(!t||n.kernel===t)&&this._onDidChangeNotebookKernelBinding.fire({notebook:e.uri,oldKernel:void 0,newKernel:n.kernel.id})}notifyVariablesChange(e){this._onDidNotebookVariablesChange.fire(e)}registerKernel(e){if(this._kernels.has(e.id))throw new Error(`NOTEBOOK CONTROLLER with id '${e.id}' already exists`);this._kernels.set(e.id,new Twi(e)),this._onDidAddKernel.fire(e);for(let t of this._notebookService.getNotebookTextModels())this._tryAutoBindNotebook(t,e);return Z(()=>{this._kernels.delete(e.id)&&this._onDidRemoveKernel.fire(e);for(let[t,o]of Array.from(this._notebookBindings))o===e.id&&this._onDidChangeNotebookKernelBinding.fire({notebook:e2.obj(t).uri,oldKernel:e.id,newKernel:void 0})})}getMatchingKernel(e){let t=[];for(let c of this._kernels.values()){let u=bB._score(c.kernel,e);u&&t.push({score:u,kernel:c.kernel,instanceAffinity:c.notebookPriorities.get(e.uri)??1})}t.sort((c,u)=>u.instanceAffinity-c.instanceAffinity||c.score-u.score||c.kernel.label.localeCompare(u.kernel.label));let o=t.map(c=>c.kernel),n=this._notebookBindings.get(e2.str(e)),r=n?this._kernels.get(n)?.kernel:void 0,s=t.filter(c=>c.instanceAffinity>1).map(c=>c.kernel),l=t.filter(c=>c.instanceAffinity<0).map(c=>c.kernel);return{all:o,selected:r,suggestions:s,hidden:l}}getSelectedOrSuggestedKernel(e){let t=this.getMatchingKernel(e);if(t.selected)return t.selected;let o=t.all.filter(n=>this._kernels.get(n.id)?.notebookPriorities.get(e.uri)===2);return o.length===1?o[0]:t.all.length===1?t.all[0]:void 0}selectKernelForNotebook(e,t){let o=e2.str(t),n=this._notebookBindings.get(o);n!==e?.id&&(e?this._notebookBindings.set(o,e.id):this._notebookBindings.delete(o),this._onDidChangeNotebookKernelBinding.fire({notebook:t.uri,oldKernel:n,newKernel:e?.id}),this._persistMementos())}preselectKernelForNotebook(e,t){let o=e2.str(t);this._notebookBindings.get(o)!==e?.id&&(this._notebookBindings.set(o,e.id),this._persistMementos())}updateKernelNotebookAffinity(e,t,o){let n=this._kernels.get(e.id);if(!n)throw new Error(`UNKNOWN kernel '${e.id}'`);o===void 0?n.notebookPriorities.delete(t):n.notebookPriorities.set(t,o),this._onDidChangeNotebookAffinity.fire()}getRunningSourceActions(e){let t=e2.str(e),o=this._kernelSources.get(t);return o?o.actions.filter(n=>n[0].execution).map(n=>n[0]):[]}getSourceActions(e,t){t=t??this._contextKeyService;let o=e2.str(e),n=this._kernelSources.get(o);if(n)return n.actions.map(c=>c[0]);let r=this._register(this._menuService.createMenu(D.NotebookKernelSource,t)),s={menu:r,actions:[]},l=(c,u)=>{let p=c.getActions({shouldForwardArgs:!0}),h=[];p.forEach(g=>{let f=/^primary/.test(g[0]);g[1].forEach(v=>{let b=new _wi(v,u,f),S=b.onDidChangeState(()=>{this._onDidChangeSourceActions.fire({notebook:u.uri,viewType:u.notebookType})});h.push([b,S])})}),s.actions=h,this._kernelSources.set(o,s),this._onDidChangeSourceActions.fire({notebook:u.uri,viewType:u.notebookType})};return this._kernelSourceActionsUpdates.get(o)?.dispose(),this._kernelSourceActionsUpdates.set(o,r.onDidChange(()=>{l(r,e)})),l(r,e),s.actions.map(c=>c[0])}registerNotebookKernelDetectionTask(e){let t=e.notebookType,o=this._kernelDetectionTasks.get(t)??[];return o.push(e),this._kernelDetectionTasks.set(t,o),this._onDidChangeKernelDetectionTasks.fire(t),Z(()=>{let n=this._kernelDetectionTasks.get(t)??[],r=n.indexOf(e);r>=0&&(n.splice(r,1),this._kernelDetectionTasks.set(t,n),this._onDidChangeKernelDetectionTasks.fire(t))})}getKernelDetectionTasks(e){return this._kernelDetectionTasks.get(e.notebookType)??[]}registerKernelSourceActionProvider(e,t){let o=this._kernelSourceActionProviders.get(e)??[];o.push(t),this._kernelSourceActionProviders.set(e,o),this._onDidChangeSourceActions.fire({viewType:e});let n=t.onDidChangeSourceActions?.(()=>{this._onDidChangeSourceActions.fire({viewType:e})});return Z(()=>{let r=this._kernelSourceActionProviders.get(e)??[],s=r.indexOf(t);s>=0&&(r.splice(s,1),this._kernelSourceActionProviders.set(e,r)),n?.dispose()})}getKernelSourceActions2(e){let t=e.notebookType,n=(this._kernelSourceActionProviders.get(t)??[]).map(r=>r.provideKernelSourceActions());return Promise.all(n).then(r=>r.reduce((s,l)=>s.concat(l),[]))}};bB=I([m(0,un),m(1,le),m(2,qt),m(3,X)],bB);var bMe=class extends C{constructor(e){super();this.extensionService=e;this.activations=new Map;this.scopedMessaging=new Map;this.postMessageEmitter=this._register(new E);this.onShouldPostMessage=this.postMessageEmitter.event}receiveMessage(e,t,o){if(e===void 0){let n=[...this.scopedMessaging.values()].map(r=>r.receiveMessageHandler?.(t,o));return Promise.all(n).then(r=>r.some(s=>!!s))}return this.scopedMessaging.get(e)?.receiveMessageHandler?.(t,o)??Promise.resolve(!1)}prepare(e){if(this.activations.has(e))return;let t=[];this.activations.set(e,t),this.extensionService.activateByEvent(`onRenderer:${e}`).then(()=>{for(let o of t)this.postMessageEmitter.fire(o);this.activations.set(e,void 0)})}getScoped(e){let t=this.scopedMessaging.get(e);if(t)return t;let o={postMessage:(n,r)=>this.postMessage(e,n,r),dispose:()=>this.scopedMessaging.delete(e)};return this.scopedMessaging.set(e,o),o}postMessage(e,t,o){this.activations.has(t)||this.prepare(t);let n=this.activations.get(t),r={rendererId:t,editorId:e,message:o};n===void 0?this.postMessageEmitter.fire(r):n.push(r)}};bMe=I([m(0,lt)],bMe);async function SMe(a,i,e,t){let{notebookEditor:o}=i;if(o.hasModel()&&!o.isReadOnly){if(i.ui&&i.cell){let{cell:n}=i;if(n.cellKind===a)return;let r=n.getText(),s=o.getCellIndex(n);e===void 0&&(e=(o.activeKernel?.supportedLanguages??[])[0]??Fr),o.textModel.applyEdits([{editType:1,index:s,count:1,cells:[{cellKind:a,source:r,language:e,mime:t??n.mime,outputs:n.model.outputs,metadata:n.metadata}]}],!0,{kind:1,focus:o.getFocus(),selections:o.getSelections()},()=>({kind:1,focus:o.getFocus(),selections:o.getSelections()}),void 0,!0);let l=o.cellAt(s);await o.focusNotebookCell(l,n.getEditState()===1?"editor":"container")}else if(i.selectedCells){let n=i.selectedCells,r=[];n.forEach(s=>{if(s.cellKind===a)return;let l=s.getText(),c=o.getCellIndex(s);e===void 0&&(e=(o.activeKernel?.supportedLanguages??[])[0]??Fr),r.push({editType:1,index:c,count:1,cells:[{cellKind:a,source:l,language:e,mime:t??s.mime,outputs:s.model.outputs,metadata:s.metadata}]})}),o.textModel.applyEdits(r,!0,{kind:1,focus:o.getFocus(),selections:o.getSelections()},()=>({kind:1,focus:o.getFocus(),selections:o.getSelections()}),void 0,!0)}}}function Pco(a,i){let e=a.textModel,t=a.getSelections(),o=a.getCellIndex(i),n=t.find(s=>s.start<=o&&o<s.end),r=!a.isReadOnly||e.viewType==="interactive";if(n){let s=t.reverse().map(c=>({editType:1,index:c.start,count:c.end-c.start,cells:[]})),l=n.end>=a.getLength()?void 0:a.cellAt(n.end);e.applyEdits(s,!0,{kind:1,focus:a.getFocus(),selections:a.getSelections()},()=>{if(l){let c=e.cells.findIndex(u=>u.handle===l.handle);return{kind:1,focus:{start:c,end:c+1},selections:[{start:c,end:c+1}]}}else if(e.length){let c=e.length-1;return{kind:1,focus:{start:c,end:c+1},selections:[{start:c,end:c+1}]}}else return{kind:1,focus:{start:0,end:0},selections:[{start:0,end:0}]}},void 0,r)}else{let s=a.getFocus(),l=[{editType:1,index:o,count:1,cells:[]}],c=[];for(let u=0;u<t.length;u++){let p=t[u];p.end<=o?c.push(p):p.start>o?c.push({start:p.start-1,end:p.end-1}):c.push({start:o,end:o+1})}if(a.cellAt(s.start)===i){let u=s.end===e.length?{start:s.start-1,end:s.end-1}:s;e.applyEdits(l,!0,{kind:1,focus:a.getFocus(),selections:a.getSelections()},()=>({kind:1,focus:u,selections:c}),void 0,r)}else{let u=s.start>o?{start:s.start-1,end:s.end-1}:s;e.applyEdits(l,!0,{kind:1,focus:a.getFocus(),selections:a.getSelections()},()=>({kind:1,focus:u,selections:c}),void 0,r)}}}async function Dwi(a,i){if(!a.notebookEditor.hasModel())return;let e=a.notebookEditor,t=e.textModel;if(e.isReadOnly)return;let o;if(a.cell){let n=e.getCellIndex(a.cell);o={start:n,end:n+1}}else{let n=e.getSelections();o=wY(e,n)[0]}if(!(!o||o.start===o.end))if(i==="up"){if(o.start===0)return;let n=o.start-1,r={start:o.start-1,end:o.end-1},s=a.notebookEditor.getFocus(),l=PEt(o,s)?{start:s.start-1,end:s.end-1}:{start:o.start-1,end:o.start};t.applyEdits([{editType:6,index:n,length:1,newIdx:o.end-1}],!0,{kind:1,focus:e.getFocus(),selections:e.getSelections()},()=>({kind:1,focus:l,selections:[r]}),void 0,!0);let c=e.getSelections()[0]??e.getFocus();e.revealCellRangeInView(c)}else{if(o.end>=t.length)return;let n=o.end,r={start:o.start+1,end:o.end+1},s=e.getFocus(),l=PEt(o,s)?{start:s.start+1,end:s.end+1}:{start:o.start+1,end:o.start+2};t.applyEdits([{editType:6,index:n,length:1,newIdx:o.start}],!0,{kind:1,focus:e.getFocus(),selections:e.getSelections()},()=>({kind:1,focus:l,selections:[r]}),void 0,!0);let c=e.getSelections()[0]??e.getFocus();e.revealCellRangeInView(c)}}async function Lwi(a,i){let e=a.notebookEditor;if(!e.hasModel())return;let t=e.textModel;if(e.isReadOnly)return;let o;if(a.ui){let n=a.cell,r=e.getCellIndex(n);o={start:r,end:r+1}}else{let n=e.getSelections();o=wY(e,n)[0]}if(!(!o||o.start===o.end))if(i==="up"){let n=e.getFocus(),r=e.getSelections();t.applyEdits([{editType:1,index:o.end,count:0,cells:Lf([o]).map(s=>jK(e.cellAt(s).model))}],!0,{kind:1,focus:n,selections:r},()=>({kind:1,focus:n,selections:r}),void 0,!0)}else{let n=e.getFocus(),r=e.getSelections(),l=Lf([o]).map(h=>jK(e.cellAt(h).model)).length,c=a.ui?n:{start:n.start+l,end:n.end+l},u=a.ui?r:[{start:o.start+l,end:o.end+l}];t.applyEdits([{editType:1,index:o.end,count:0,cells:Lf([o]).map(h=>jK(e.cellAt(h).model))}],!0,{kind:1,focus:n,selections:r},()=>({kind:1,focus:c,selections:u}),void 0,!0);let p=e.getSelections()[0]??e.getFocus();e.revealCellRangeInView(p)}}async function Aco(a,i,e){let t=e.notebookEditor;if(t.isReadOnly)return;let o=[],n=[];for(let p of t.getSelections())n.push(...t.getCellsInRange(p));if(n.length<=1)return;let r=n[0].cellKind;if(!n.every(p=>p.cellKind===r)){let p=d(11748,null);return i.warn(p)}let l=n[0],c=n.map(p=>p.getText()).join(l.textBuffer.getEOL()),u=t.getSelections()[0];o.push(new Iv(t.textModel.uri,{editType:1,index:u.start,count:u.end-u.start,cells:[{cellKind:l.cellKind,source:c,language:l.language,mime:l.mime,outputs:l.model.outputs,metadata:l.metadata}]}));for(let p of t.getSelections().slice(1))o.push(new Iv(t.textModel.uri,{editType:1,index:p.start,count:p.end-p.start,cells:[]}));o.length&&await a.apply(o,{quotableLabel:d(11749,null)})}async function Mco(a,i,e,t){if(a.isReadOnly)return null;let o=a.textModel,n=a.getCellsInRange(i);if(!n.length||i.start===0&&e==="above"||i.end===o.length&&e==="below")return null;for(let r=0;r<n.length;r++){let s=n[r];if(t&&s.cellKind!==t)return null}if(e==="above"){let r=a.cellAt(i.start-1);if(t&&r.cellKind!==t)return null;let s=n.map(u=>(u.textBuffer.getEOL()??"")+u.getText()).join(""),l=r.textBuffer.getLineCount(),c=r.textBuffer.getLineLength(l);return{edits:[new ja(r.uri,{range:new z(l,c+1,l,c+1),text:s}),new Iv(o.uri,{editType:1,index:i.start,count:i.end-i.start,cells:[]})],cell:r,endFocus:{start:i.start-1,end:i.start},endSelections:[{start:i.start-1,end:i.start}]}}else{let r=a.cellAt(i.end);if(t&&r.cellKind!==t)return null;let s=n[0],c=[...n.slice(1),r].map(h=>(h.textBuffer.getEOL()??"")+h.getText()).join(""),u=s.textBuffer.getLineCount(),p=s.textBuffer.getLineLength(u);return{edits:[new ja(s.uri,{range:new z(u,p+1,u,p+1),text:c}),new Iv(o.uri,{editType:1,index:i.start+1,count:i.end-i.start,cells:[]})],cell:s,endFocus:{start:i.start,end:i.start+1},endSelections:[{start:i.start,end:i.start+1}]}}}async function Rwi(a,i,e){let t=i.notebookEditor,o=t.textModel,n=t.getViewModel(),r=null;if(i.ui){let s=i.cell.focusMode,l=t.getCellIndex(i.cell);if(r=await Mco(t,{start:l,end:l+1},e),!r)return;await a.apply(r?.edits,{quotableLabel:"Join Notebook Cells"}),n.updateSelectionsState({kind:1,focus:r.endFocus,selections:r.endSelections}),r.cell.updateEditState(1,"joinCellsWithSurrounds"),t.revealCellRangeInView(t.getFocus()),s===1&&(r.cell.focusMode=1)}else{let s=t.getSelections();if(!s.length)return;let l=t.getFocus(),c=t.cellAt(l.start)?.focusMode,u=[],p=null,h=[];for(let f=s.length-1;f>=0;f--){let v=s[f],b=PEt(v,l);if(v.end>=o.length&&e==="below"||v.start===0&&e==="above"){b&&(p=t.cellAt(l.start)),h.push(...t.getCellsInRange(v));continue}let S=await Mco(t,v,e);if(!S)return;u.push(...S.edits),h.push(S.cell),b&&(p=S.cell)}if(!u.length||!p||!h.length)return;await a.apply(u,{quotableLabel:"Join Notebook Cells"}),h.forEach(f=>{f.updateEditState(1,"joinCellsWithSurrounds")}),n.updateSelectionsState({kind:0,primary:p.handle,selections:h.map(f=>f.handle)}),t.revealCellRangeInView(t.getFocus());let g=t.cellAt(t.getFocus().start);c===1&&g&&(g.focusMode=1)}}function J8o(a,i){let e=[],t=i.getLineCount(),o=s=>i.getLineLength(s);a=a.sort((s,l)=>{let c=s.lineNumber-l.lineNumber,u=s.column-l.column;return c!==0?c:u});for(let s of a)o(s.lineNumber)+1===s.column&&s.column!==1&&s.lineNumber<t&&(s=new Ie(s.lineNumber+1,1)),Z8o(e,s);if(e.length===0)return null;let n=new Ie(1,1),r=new Ie(t,o(t)+1);return[n,...e,r]}function Z8o(a,i){let e=a.length>0?a[a.length-1]:void 0;(!e||e.lineNumber!==i.lineNumber||e.column!==i.column)&&a.push(i)}function Nco(a,i){let e=J8o(i,a.textBuffer);if(!e)return null;let t=[];for(let o=1;o<e.length;o++){let n=e[o-1],r=e[o];t.push(a.textBuffer.getValueInRange(new z(n.lineNumber,n.column,r.lineNumber,r.column),0))}return t}function SB(a,i,e,t,o="above",n="",r=!1,s){let l=i.getViewModel(),c=i.activeKernel;if(l.options.isReadOnly)return null;let u=i.cellAt(e),p=r?l.getNextVisibleCellIndex(e):e+1,h;if(t===2){let f=c?.supportedLanguages??a.getRegisteredLanguageIds(),v=f[0]||Fr;if(u?.cellKind===2)h=u.language;else if(u?.cellKind===1){let b=l.nearestCodeCellIndex(e);b>-1?h=l.cellAt(b).language:h=v}else if(!u&&l.length===0){let b=s?.getKernels(l.notebookDocument);b?.all.length?h=b.all[0].supportedLanguages[0]||v:h=v}else u===void 0&&o==="above"?h=l.viewCells.find(b=>b.cellKind===2)?.language||v:h=v;f.includes(h)||(h=v)}else h="markdown";return eQo(l,u?o==="above"?e:p:e,n,h,t,void 0,[],!0,!0)}function eQo(a,i,e,t,o,n,r,s,l){let c={kind:1,focus:{start:i,end:i+1},selections:[{start:i,end:i+1}]};return a.notebookDocument.applyEdits([{editType:1,index:i,count:0,cells:[{cellKind:o,language:t,mime:void 0,outputs:r,metadata:n,source:e}]}],s,{kind:1,focus:a.getFocus(),selections:a.getSelections()},()=>c,void 0,l&&!a.options.isReadOnly),a.cellAt(i)}var tQo="notebook.cell.insertCodeCellAbove",AVt="notebook.cell.insertCodeCellBelow",iQo="notebook.cell.insertCodeCellAboveAndFocusContainer",oQo="notebook.cell.insertCodeCellBelowAndFocusContainer",Mwi="notebook.cell.insertCodeCellAtTop",nQo="notebook.cell.insertMarkdownCellAbove",Pwi="notebook.cell.insertMarkdownCellBelow",Oco="notebook.cell.insertMarkdownCellAtTop";function Awi(a,i,e,t,o){let n=null;i.ui&&i.notebookEditor.focus();let r=a.get(kt),s=a.get(mR);if(i.cell){let l=i.notebookEditor.getCellIndex(i.cell);n=SB(r,i.notebookEditor,l,e,t,void 0,!0,s)}else{let l=i.notebookEditor.getFocus(),c=Math.max(l.end-1,0);n=SB(r,i.notebookEditor,c,e,t,void 0,!0,s)}return n}var YZ=class extends qu{constructor(e,t,o,n){super(e);this.kind=t;this.direction=o;this.focusEditor=n}async runWithContext(e,t){let o=await Awi(e,t,this.kind,this.direction,this.focusEditor);o&&await t.notebookEditor.focusNotebookCell(o,this.focusEditor?"editor":"container")}};W(class extends YZ{constructor(){super({id:tQo,title:d(11816,null),keybinding:{primary:3075,when:x.and($u,$h.toNegated()),weight:200},menu:{id:D.NotebookCellInsert,order:0}},2,"above",!0)}});W(class extends YZ{constructor(){super({id:iQo,title:d(11817,null)},2,"above",!1)}});W(class extends YZ{constructor(){super({id:AVt,title:d(11819,null),keybinding:{primary:2051,when:x.and($u,$h.toNegated()),weight:200},menu:{id:D.NotebookCellInsert,order:1}},2,"below",!0)}});W(class extends YZ{constructor(){super({id:oQo,title:d(11820,null)},2,"below",!1)}});W(class extends YZ{constructor(){super({id:nQo,title:d(11821,null),menu:{id:D.NotebookCellInsert,order:2}},1,"above",!0)}});W(class extends YZ{constructor(){super({id:Pwi,title:d(11823,null),menu:{id:D.NotebookCellInsert,order:3}},1,"below",!0)}});W(class extends qu{constructor(){super({id:Mwi,title:d(11818,null),f1:!1})}async run(i,e){e=e??this.getEditorContextFromArgsOrActive(i),e&&this.runWithContext(i,e)}async runWithContext(i,e){let t=i.get(kt),o=i.get(mR),n=SB(t,e.notebookEditor,0,2,"above",void 0,!0,o);n&&await e.notebookEditor.focusNotebookCell(n,"editor")}});W(class extends qu{constructor(){super({id:Oco,title:d(11822,null),f1:!1})}async run(i,e){e=e??this.getEditorContextFromArgsOrActive(i),e&&this.runWithContext(i,e)}async runWithContext(i,e){let t=i.get(kt),o=i.get(mR),n=SB(t,e.notebookEditor,0,1,"above",void 0,!0,o);n&&await e.notebookEditor.focusNotebookCell(n,"editor")}});fe.appendMenuItem(D.NotebookCellBetween,{command:{id:AVt,title:"$(add) "+d(11824,null),tooltip:d(11828,null)},order:0,group:"inline",when:x.and(Kl.isEqualTo(!0),x.notEquals("config.notebook.experimental.insertToolbarAlignment","left"))});fe.appendMenuItem(D.NotebookCellBetween,{command:{id:AVt,title:d(11826,null),icon:M.add,tooltip:d(11828,null)},order:0,group:"inline",when:x.and(Kl.isEqualTo(!0),x.equals("config.notebook.experimental.insertToolbarAlignment","left"))});fe.appendMenuItem(D.NotebookToolbar,{command:{id:AVt,icon:M.add,title:d(11827,null),tooltip:d(11828,null)},order:-5,group:"navigation/add",when:x.and(Kl.isEqualTo(!0),x.notEquals("config.notebook.insertToolbarLocation","betweenCells"),x.notEquals("config.notebook.insertToolbarLocation","hidden"))});fe.appendMenuItem(D.NotebookCellListTop,{command:{id:Mwi,title:"$(add) "+d(11824,null),tooltip:d(11828,null)},order:0,group:"inline",when:x.and(Kl.isEqualTo(!0),x.notEquals("config.notebook.experimental.insertToolbarAlignment","left"))});fe.appendMenuItem(D.NotebookCellListTop,{command:{id:Mwi,title:d(11825,null),icon:M.add,tooltip:d(11828,null)},order:0,group:"inline",when:x.and(Kl.isEqualTo(!0),x.equals("config.notebook.experimental.insertToolbarAlignment","left"))});fe.appendMenuItem(D.NotebookCellBetween,{command:{id:Pwi,title:"$(add) "+d(11829,null),tooltip:d(11831,null)},order:1,group:"inline",when:x.and(Kl.isEqualTo(!0),x.notEquals("config.notebook.experimental.insertToolbarAlignment","left"))});fe.appendMenuItem(D.NotebookToolbar,{command:{id:Pwi,icon:M.add,title:d(11830,null),tooltip:d(11831,null)},order:-5,group:"navigation/add",when:x.and(Kl.isEqualTo(!0),x.notEquals("config.notebook.insertToolbarLocation","betweenCells"),x.notEquals("config.notebook.insertToolbarLocation","hidden"),x.notEquals(`config.${ft.globalToolbarShowLabel}`,!1),x.notEquals(`config.${ft.globalToolbarShowLabel}`,"never"))});fe.appendMenuItem(D.NotebookCellListTop,{command:{id:Oco,title:"$(add) "+d(11829,null),tooltip:d(11831,null)},order:1,group:"inline",when:x.and(Kl.isEqualTo(!0),x.notEquals("config.notebook.experimental.insertToolbarAlignment","left"))});oe.as(ii.Configuration).registerConfiguration({id:"editor",properties:{"inlineChat.finishOnType":{description:d(10623,null),default:!1,type:"boolean"},"inlineChat.enableV2":{description:d(10622,null),default:!1,type:"boolean",tags:["preview"],experiment:{mode:"auto"}},"inlineChat.notebookAgent":{markdownDescription:d(10657,null),default:!1,type:"boolean",tags:["experimental"],experiment:{mode:"startup"}},"inlineChat.affordance":{description:d(10615,null),default:"off",type:"string",enum:["off","gutter","editor"],enumDescriptions:[d(10618,null),d(10617,null),d(10616,null)],experiment:{mode:"auto"},tags:["experimental"]},"inlineChat.renderMode":{description:d(10658,null),default:"zone",type:"string",enum:["zone","hover"],enumDescriptions:[d(10660,null),d(10659,null)],experiment:{mode:"auto"},tags:["experimental"]},"inlineChat.fixDiagnostics":{description:d(10624,null),default:!0,type:"boolean",experiment:{mode:"auto"},tags:["experimental"]}}});var NVt="interactiveEditor";var Fco=new Q("inlineChatPossible",!1,d(10641,null)),rQo=new Q("inlineChatHasEditsAgent",!1,d(10638,null)),sQo=new Q("inlineChatHasNotebookInline",!1,d(10640,null)),aQo=new Q("inlineChatHasNotebookAgent",!1,d(10639,null)),OZe=new Q("inlineChatVisible",!1,d(10656,null)),Y4=new Q("inlineChatFocused",!1,d(10637,null)),Vpu=new Q("inlineChatEditing",!0,d(10634,null)),Wco=new Q("inlineChatResponseFocused",!1,d(10654,null)),Bpu=new Q("inlineChatEmpty",!1,d(10635,null)),Nwi=new Q("inlineChatInputHasText",!1,d(10649,null)),Owi=new Q("inlineChatInputWidgetFocused",!1,d(10650,null)),Hpu=new Q("inlineChatInnerCursorFirst",!1,d(10643,null)),Upu=new Q("inlineChatInnerCursorLast",!1,d(10644,null)),Fwi=new Q("inlineChatOuterCursorPosition","",d(10651,null)),zpu=new Q("inlineChatHasStashedSession",!1,d(10642,null)),Kpu=new Q("inlineChatChangeHasDiff",!1,d(10630,null)),Gpu=new Q("inlineChatChangeShowsDiff",!1,d(10631,null)),Vco=new Q("inlineChatRequestInProgress",!1,d(10653,null)),Bco=new Q("inlineChatResponseType","none",d(10655,null)),OVt=new Q("inlineChatFileBelongsToChat",!1,d(10636,null)),Wwi=new Q("inlineChatPendingConfirmation",!1,d(10652,null)),Vwi=new Q("inlineChatAffordanceVisible",!1,d(10629,null)),Hco=x.or(x.and(Ua,sQo)),nme=x.or(rQo,x.and(Ua,aQo)),FZe=x.equals("config.inlineChat.renderMode","hover"),lQo=x.equals("config.inlineChat.fixDiagnostics",!0),XZ="inlineChat.start",Bwi="inlineChat.askInChat",Uco="inlineChat.acceptChanges";var zco="inlineChat.regenerate";var Kco="inlineChat.toggleDiff",Gco="inlineChat.reportIssue",FVt=D.for("inlineChatWidget.status"),IB=D.for("inlineChatWidget.secondary"),$pu=D.for("inlineChatWidget.changesZone"),$co=D.for("inlineChatWidget.side"),qco=J("inlineChat.foreground",dL,d(10627,null)),Hwi=J("inlineChat.background",gm,d(10625,null)),qpu=J("inlineChat.border",DN,d(10626,null)),jpu=J("inlineChat.shadow",RN,d(10628,null)),Qpu=J("inlineChatInput.border",DN,d(10646,null)),Ypu=J("inlineChatInput.focusBorder",Ad,d(10647,null)),Xpu=J("inlineChatInput.placeholderForeground",u9,d(10648,null)),Jpu=J("inlineChatInput.background",Gb,d(10645,null)),Zpu=J("inlineChatDiff.inserted",ei(Hg,.5),d(10632,null)),emu=J("editorOverviewRuler.inlineChatInserted",{dark:ei(Hg,.6),light:ei(Hg,.8),hcDark:ei(Hg,.6),hcLight:ei(Hg,.8)},d(10620,null)),tmu=J("editorMinimap.inlineChatInserted",{dark:ei(Hg,.6),light:ei(Hg,.8),hcDark:ei(Hg,.6),hcLight:ei(Hg,.8)},d(10619,null)),imu=J("inlineChatDiff.removed",ei(Cf,.5),d(10633,null)),omu=J("editorOverviewRuler.inlineChatRemoved",{dark:ei(Cf,.6),light:ei(Cf,.8),hcDark:ei(Cf,.6),hcLight:ei(Cf,.8)},d(10621,null));var cQo="notebook.execute",dQo="notebook.cancelExecution",uQo="notebook.interruptExecution",pQo="notebook.cell.cancelExecution",mQo="notebook.cell.executeAndFocusContainer",jco="notebook.cell.executeAndSelectBelow",Qco="notebook.cell.executeAndInsertBelow",hQo="notebook.cell.executeCellAndBelow",gQo="notebook.cell.executeCellsAbove",fQo="notebook.renderAllMarkdownCells",vQo="notebook.revealRunningCell",bQo="notebook.revealLastFailedCell",rme=x.and(hS.isEqualTo("code"),x.or(x.greater(CZ.key,0),x.greater(eRe.key,0),IWt)),WZe=x.and(rme,vWt.toNegated()),Jco=x.and(hS.isEqualTo("markup"));function Zco(a){for(let i=0;i<a.notebookEditor.getLength();i++){let e=a.notebookEditor.cellAt(i);e.cellKind===1&&e.updateEditState(0,"renderAllMarkdownCells")}}async function VVt(a,i,e){let t=a.activeGroup;if(t&&t.activeEditor&&t.pinEditor(t.activeEditor),i.autoReveal&&(i.cell||i.selectedCells?.length)&&e&&e.openEditor({resource:i.notebookEditor.textModel.uri,options:{revealIfOpened:!0}}),i.ui&&i.cell)i.autoReveal&&Yco(i.cell,i.notebookEditor),await i.notebookEditor.executeNotebookCells(ht.single(i.cell));else if(i.selectedCells?.length||i.cell){let n=i.selectedCells?.length?i.selectedCells:[i.cell],r=n[0];r&&i.autoReveal&&Yco(r,i.notebookEditor),await i.notebookEditor.executeNotebookCells(n)}let o;for(let[,n]of i.notebookEditor.codeEditors)if(Xe(n.getModel()?.uri,(i.cell??i.selectedCells?.[0])?.uri)){o=n;break}}var SQo=20,IQo=60;function Yco(a,i){if(i.focusNotebookCell(a,"container",{skipReveal:!0}),a.cellKind===1){let v=i.getCellIndex(a);i.revealCellRangeInView({start:v,end:v+1});return}if(!(a instanceof Qm))return;let e=i.getAbsoluteTopOfElement(a),t=e+a.layoutInfo.outputContainerOffset,o=a.layoutInfo.outputTotalHeight,n=i.getAbsoluteBottomOfElement(a),r=i.getLayoutInfo().height,s=r*.34,l=r*.66,c=a.layoutInfo.totalHeight,u=e>=i.scrollTop&&n<=i.scrollBottom,p=t-25>=i.scrollTop&&t+25<=i.scrollBottom,h=v=>{i.setScrollTop(v-SQo)},g=v=>{i.setScrollTop(v)},f=v=>{i.setScrollTop(v+IQo)};if(!u){if(c<=r&&!p){h(e);return}c>r&&!p&&(o>0&&o>=l?g(t-s):o>0?f(n-r):g(t-l))}}W(class extends qu{constructor(){super({id:fQo,title:d(11808,null)})}async runWithContext(i,e){Zco(e)}});W(class extends qu{constructor(){super({id:cQo,title:d(11806,null),icon:Qao,metadata:{description:d(11806,null),args:[{name:"uri",description:"The document uri"}]},menu:[{id:D.EditorTitle,order:-1,group:"navigation",when:x.and(Ua,x.or(hB.toNegated(),mB.toNegated()),x.notEquals("config.notebook.globalToolbar",!0))},{id:D.NotebookToolbar,order:-1,group:"navigation/execute",when:x.and(x.or(hB.toNegated(),mB.toNegated()),x.and(mB,hB.toNegated())?.negate(),x.equals("config.notebook.globalToolbar",!0))}]})}getEditorContextFromArgsOrActive(i,e){return wWt(i,e)??Epe(i.get(ee))}async runWithContext(i,e){Zco(e);let o=i.get(ee).findEditors({resource:e.notebookEditor.textModel.uri,typeId:ha.ID,editorId:e.notebookEditor.textModel.viewType}).at(0),n=i.get(Et);return o&&n.getGroup(o.groupId)?.pinEditor(o.editor),e.notebookEditor.executeNotebookCells()}});W(class extends xg{constructor(){super({id:U7i,precondition:WZe,title:d(11800,null),keybinding:{when:$u,primary:259,win:{primary:2563},weight:rf},menu:{id:D.NotebookCellExecutePrimary,when:WZe,group:"inline"},metadata:{description:d(11800,null),args:UJe},icon:HK})}parseArgs(i,...e){return BK(i,...e)}async runWithContext(i,e){let t=i.get(Et),o=i.get(ee);e.ui&&await e.notebookEditor.focusNotebookCell(e.cell,"container",{skipReveal:!0}),await VVt(t,e,o)}});W(class extends xg{constructor(){super({id:gQo,precondition:rme,title:d(11801,null),menu:[{id:D.NotebookCellExecute,when:x.and(rme,x.equals(`config.${ft.consolidatedRunButton}`,!0))},{id:D.NotebookCellTitle,order:2,group:VF,when:x.and(rme,x.equals(`config.${ft.consolidatedRunButton}`,!1))}],icon:$ao})}parseArgs(i,...e){return BK(i,...e)}async runWithContext(i,e){let t;if(e.ui?(t=e.notebookEditor.getCellIndex(e.cell),await e.notebookEditor.focusNotebookCell(e.cell,"container",{skipReveal:!0})):t=Math.min(...e.selectedCells.map(o=>e.notebookEditor.getCellIndex(o))),typeof t=="number"){let o={start:0,end:t},n=e.notebookEditor.getCellsInRange(o);e.notebookEditor.executeNotebookCells(n)}}});W(class extends xg{constructor(){super({id:hQo,precondition:rme,title:d(11805,null),menu:[{id:D.NotebookCellExecute,when:x.and(rme,x.equals(`config.${ft.consolidatedRunButton}`,!0))},{id:D.NotebookCellTitle,order:3,group:VF,when:x.and(rme,x.equals(`config.${ft.consolidatedRunButton}`,!1))}],icon:qao})}parseArgs(i,...e){return BK(i,...e)}async runWithContext(i,e){let t;if(e.ui?(t=e.notebookEditor.getCellIndex(e.cell),await e.notebookEditor.focusNotebookCell(e.cell,"container",{skipReveal:!0})):t=Math.min(...e.selectedCells.map(o=>e.notebookEditor.getCellIndex(o))),typeof t=="number"){let o={start:t,end:e.notebookEditor.getLength()},n=e.notebookEditor.getCellsInRange(o);e.notebookEditor.executeNotebookCells(n)}}});W(class extends xg{constructor(){super({id:mQo,precondition:WZe,title:d(11802,null),metadata:{description:d(11802,null),args:UJe},icon:HK})}parseArgs(i,...e){return BK(i,...e)}async runWithContext(i,e){let t=i.get(Et),o=i.get(ee);if(e.ui)await e.notebookEditor.focusNotebookCell(e.cell,"container",{skipReveal:!0});else{let n=e.selectedCells[0];n&&await e.notebookEditor.focusNotebookCell(n,"container",{skipReveal:!0})}await VVt(t,e,o)}});var Xco=x.or(x.equals(xpe.key,"executing"),x.equals(xpe.key,"pending"));W(class extends xg{constructor(){super({id:pQo,precondition:Xco,title:d(11798,null),icon:CWt,menu:{id:D.NotebookCellExecutePrimary,when:Xco,group:"inline"},metadata:{description:d(11798,null),args:[{name:"options",description:"The cell range options",schema:{type:"object",required:["ranges"],properties:{ranges:{type:"array",items:[{type:"object",required:["start","end"],properties:{start:{type:"number"},end:{type:"number"}}}]},document:{type:"object",description:"The document uri"}}}}]}})}parseArgs(i,...e){return BK(i,...e)}async runWithContext(i,e){return e.ui?(await e.notebookEditor.focusNotebookCell(e.cell,"container",{skipReveal:!0}),e.notebookEditor.cancelNotebookCells(ht.single(e.cell))):e.notebookEditor.cancelNotebookCells(e.selectedCells)}});W(class extends gd{constructor(){super({id:jco,precondition:x.or(WZe,hS.isEqualTo("markup")),title:d(11804,null),keybinding:{when:x.and($u,Y4.negate()),primary:1027,weight:rf}})}async runWithContext(i,e){let t=i.get(Et),o=i.get(ee),n=e.notebookEditor.getCellIndex(e.cell);if(typeof n!="number")return;let r=i.get(kt),l=i.get(B).getValue(ft.scrollToRevealCell),c;if(l==="none"?c={skipReveal:!0}:c={revealBehavior:l==="fullCell"?0:1},e.cell.cellKind===1){let u=e.notebookEditor.cellAt(n+1);if(e.cell.updateEditState(0,jco),u)await e.notebookEditor.focusNotebookCell(u,"container",c);else{let p=SB(r,e.notebookEditor,n,1,"below");p&&await e.notebookEditor.focusNotebookCell(p,"editor",c)}return}else{let u=e.notebookEditor.cellAt(n+1);if(u)await e.notebookEditor.focusNotebookCell(u,"container",c);else{let p=SB(r,e.notebookEditor,n,2,"below");p&&await e.notebookEditor.focusNotebookCell(p,"editor",c)}return VVt(t,e,o)}}});W(class extends gd{constructor(){super({id:Qco,precondition:x.or(WZe,hS.isEqualTo("markup")),title:d(11803,null),keybinding:{when:$u,primary:515,weight:rf}})}async runWithContext(i,e){let t=i.get(Et),o=i.get(ee),n=e.notebookEditor.getCellIndex(e.cell),r=i.get(kt),s=e.cell.focusMode===1?"editor":"container",l=SB(r,e.notebookEditor,n,e.cell.cellKind,"below");l&&await e.notebookEditor.focusNotebookCell(l,s),e.cell.cellKind===1?e.cell.updateEditState(0,Qco):VVt(t,e,o)}});var WVt=class extends qu{getEditorContextFromArgsOrActive(i,e){return wWt(i,e)??Epe(i.get(ee))}async runWithContext(i,e){return e.notebookEditor.cancelNotebookCells()}};W(class extends WVt{constructor(){super({id:dQo,title:L(11799,"Stop Execution"),icon:CWt,menu:[{id:D.EditorTitle,order:-1,group:"navigation",when:x.and(Ua,mB,hB.toNegated(),x.notEquals("config.notebook.globalToolbar",!0))},{id:D.NotebookToolbar,order:-1,group:"navigation/execute",when:x.and(mB,hB.toNegated(),x.equals("config.notebook.globalToolbar",!0))}]})}});W(class extends WVt{constructor(){super({id:uQo,title:L(11807,"Interrupt"),precondition:x.and(mB,hB),icon:CWt,menu:[{id:D.EditorTitle,order:-1,group:"navigation",when:x.and(Ua,mB,hB,x.notEquals("config.notebook.globalToolbar",!0))},{id:D.NotebookToolbar,order:-1,group:"navigation/execute",when:x.and(mB,hB,x.equals("config.notebook.globalToolbar",!0))},{id:D.InteractiveToolbar,group:"navigation/execute"}]})}});fe.appendMenuItem(D.NotebookToolbar,{title:d(11812,null),submenu:D.NotebookCellExecuteGoTo,group:"navigation/execute",order:20,icon:q.modify(Sw,"spin")});W(class extends qu{constructor(){super({id:vQo,title:d(11811,null),tooltip:d(11811,null),shortTitle:d(11811,null),precondition:x4,menu:[{id:D.EditorTitle,when:x.and(Ua,x4,x.notEquals("config.notebook.globalToolbar",!0)),group:"navigation",order:0},{id:D.NotebookCellExecuteGoTo,when:x.and(Ua,x4,x.equals("config.notebook.globalToolbar",!0)),group:"navigation/execute",order:20},{id:D.InteractiveToolbar,when:x.and(x4,x.equals("activeEditor","workbench.editor.interactive")),group:"navigation",order:10}],icon:q.modify(Sw,"spin")})}async runWithContext(i,e){let t=i.get(rs),o=e.notebookEditor.textModel.uri,n=t.getCellExecutionsForNotebook(o);if(n[0]){let s=this.findCellAtTopFrame(i,o)??n[0].cellHandle,l=e.notebookEditor.getCellByHandle(s);l&&e.notebookEditor.focusNotebookCell(l,"container")}}findCellAtTopFrame(i,e){let t=i.get(Li);for(let o of t.getModel().getSessions())for(let n of o.getAllThreads()){let r=n.getTopStackFrame();if(r){let s=Zo.parse(r.source.uri);if(s&&s.notebook.toString()===e.toString())return s.handle}}}});W(class extends qu{constructor(){super({id:bQo,title:d(11809,null),tooltip:d(11809,null),shortTitle:d(11810,null),precondition:YLe,menu:[{id:D.EditorTitle,when:x.and(Ua,YLe,x4.toNegated(),x.notEquals("config.notebook.globalToolbar",!0)),group:"navigation",order:0},{id:D.NotebookCellExecuteGoTo,when:x.and(Ua,YLe,x4.toNegated(),x.equals("config.notebook.globalToolbar",!0)),group:"navigation/execute",order:20}],icon:oRe})}async runWithContext(i,e){let t=i.get(rs),o=e.notebookEditor.textModel.uri,n=t.getLastFailedCellForNotebook(o);if(n!==void 0){let r=e.notebookEditor.getCellByHandle(n);r&&e.notebookEditor.focusNotebookCell(r,"container")}}});var gy;(i=>i.Id="outline")(gy||={});var BVt=new Q("outlineFollowsCursor",!1),HVt=new Q("outlineFiltersOnType",!1),IMe=new Q("outlineSortMode",0),VZe=new Q("outlineAllCollapsed",!1),edo=new Q("outlineFocused",!0);var GZe=class{constructor(i,e,t,o,n,r){this.container=i;this.iconClass=e;this.iconLabel=t;this.decoration=o;this.actionMenu=n;this.elementDisposables=r}static{this.templateId="NotebookOutlineRenderer"}},BZe=class{constructor(i,e,t,o,n,r,s,l){this._editor=i;this._target=e;this._themeService=t;this._configurationService=o;this._contextMenuService=n;this._contextKeyService=r;this._menuService=s;this._instantiationService=l;this.templateId=GZe.templateId}renderTemplate(i){let e=new P;i.classList.add("notebook-outline-element","show-file-icons");let t=document.createElement("div");i.append(t);let o=new Lc(i,{supportHighlights:!0}),n=document.createElement("div");n.className="element-decoration",i.append(n);let r=document.createElement("div");return r.className="action-menu",i.append(r),new GZe(i,t,o,n,r,e)}renderElement(i,e,t){let o=[],n={matches:ua(i.filterData),labelEscapeNewLines:!0,extraClasses:o},r=i.element.cell.cellKind===2;i.element.level>=8?t.iconClass.className="element-icon "+q.asClassNameArray(i.element.icon).join(" "):r&&this._themeService.getFileIconTheme().hasFileIcons&&!i.element.isExecuting?(t.iconClass.className="",o.push(...Y1(i.element.cell.language??""))):t.iconClass.className="element-icon "+q.asClassNameArray(i.element.icon).join(" "),t.iconLabel.setLabel(" "+i.element.label,void 0,n);let{markerInfo:s}=i.element;if(t.container.style.removeProperty("--outline-element-color"),t.decoration.innerText="",s){let l=this._configurationService.getValue("problems.visibility");!this._configurationService.getValue("outline.problems.badges")||!l?(t.decoration.classList.remove("bubble"),t.decoration.innerText=""):s.count===0?(t.decoration.classList.add("bubble"),t.decoration.innerText="\uEA71"):(t.decoration.classList.remove("bubble"),t.decoration.innerText=s.count>9?"9+":String(s.count));let u=this._themeService.getColorTheme().getColor(s.topSev===8?uL:d9);if(l===void 0)return;!this._configurationService.getValue("outline.problems.colors")||!l?(t.container.style.removeProperty("--outline-element-color"),t.decoration.style.setProperty("--outline-element-color",u?.toString()??"inherit")):t.container.style.setProperty("--outline-element-color",u?.toString()??"inherit")}if(this._target===1){if(!this._editor)return;let l=i.element.cell,c=this._editor.getViewModel();if(!c)return;let u=c.getCellIndex(l),p=r?0:c.getFoldedLength(u),h=t.elementDisposables.add(this._contextKeyService.createScoped(t.container));$f.CellKind.bindTo(h).set(r?2:1),$f.CellHasChildren.bindTo(h).set(p>0),$f.CellHasHeader.bindTo(h).set(i.element.level!==7),$f.OutlineElementTarget.bindTo(h).set(this._target),this.setupFolding(r,c,h,t,l);let g=t.elementDisposables.add(new Ju(t.actionMenu,this._contextMenuService,{actionViewItemProvider:b=>{if(b instanceof Eo)return this._instantiationService.createInstance(ml,b,void 0)}})),f=t.elementDisposables.add(this._menuService.createMenu(D.NotebookOutlineActionMenu,h)),v=zwi(f,{notebookEditor:this._editor,outlineEntry:i.element});g.setActions(v.primary,v.secondary),this.setupToolbarListeners(this._editor,g,f,v,i.element,t),t.actionMenu.style.padding="0 0.8em 0 0.4em"}}disposeTemplate(i){i.iconLabel.dispose(),i.elementDisposables.dispose()}disposeElement(i,e,t){t.elementDisposables.clear(),Rt(t.actionMenu)}setupFolding(i,e,t,o,n){let r=i?0:n.foldingState,s=$f.CellFoldingState.bindTo(t);s.set(r),i||o.elementDisposables.add(e.onDidFoldingStateChanged(()=>{let l=n.foldingState;$f.CellFoldingState.bindTo(t).set(l),s.set(l)}))}setupToolbarListeners(i,e,t,o,n,r){let s=!1,l;e.setActions(o.primary,o.secondary),r.elementDisposables.add(t.onDidChange(()=>{if(s){let u=zwi(t,{notebookEditor:i,outlineEntry:n});l=()=>e.setActions(u.primary,u.secondary);return}let c=zwi(t,{notebookEditor:i,outlineEntry:n});e.setActions(c.primary,c.secondary)})),r.container.classList.remove("notebook-outline-toolbar-dropdown-active"),r.elementDisposables.add(e.onDidChangeDropdownVisibility(c=>{s=c,c?r.container.classList.add("notebook-outline-toolbar-dropdown-active"):r.container.classList.remove("notebook-outline-toolbar-dropdown-active"),l&&!c&&(nn(()=>{l?.()},0,r.elementDisposables),l=void 0)}))}};BZe=I([m(2,De),m(3,B),m(4,ze),m(5,X),m(6,qt),m(7,F)],BZe);function zwi(a,i){return hl(a.getActions({shouldForwardArgs:!0,arg:i}),e=>/^inline/.test(e))}var Kwi=class{getAriaLabel(i){return i.label}getWidgetAriaLabel(){return""}},Gwi=class{getKeyboardNavigationLabel(i){return i.label}},$wi=class{getHeight(i){return 22}getTemplateId(i){return GZe.templateId}},HZe=class{constructor(i,e,t){this.notebookCellOutlineDataSourceRef=i;this._configurationService=e;this._themeService=t;this._disposables=new P;this.gotoShowCodeCellSymbols=this._configurationService.getValue(ft.gotoSymbolsAllSymbols),this._disposables.add(this._configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration(ft.gotoSymbolsAllSymbols)&&(this.gotoShowCodeCellSymbols=this._configurationService.getValue(ft.gotoSymbolsAllSymbols))}))}getQuickPickElements(){let i=[];for(let r of this.notebookCellOutlineDataSourceRef?.object?.entries??[])r.asFlatList(i);let e=[],{hasFileIcons:t}=this._themeService.getFileIconTheme(),o=r=>!!r.symbolKind,n=r=>r.cell.cellKind===2&&r.level===7;for(let r=0;r<i.length;r++){let s=i[r],l=i[r+1];if(!this.gotoShowCodeCellSymbols&&o(s)||this.gotoShowCodeCellSymbols&&n(s)&&l&&o(l))continue;let c=t&&!s.symbolKind;e.push({element:s,label:c?s.label:`$(${s.icon.id}) ${s.label}`,ariaLabel:s.label,iconClasses:c?Y1(s.cell.language??""):void 0})}return e}dispose(){this._disposables.dispose()}};HZe=I([m(1,B),m(2,De)],HZe);function qwi(a,i,e,t){return!!(i&&a.cell.cellKind===1&&a.level===7||!e&&a.cell.cellKind===2||!t&&a.cell.cellKind===2&&a.level>7)}var UZe=class{constructor(i,e){this.outlineDataSourceRef=i;this._configurationService=e;this._disposables=new P;this.showCodeCells=this._configurationService.getValue(ft.outlineShowCodeCells),this.showCodeCellSymbols=this._configurationService.getValue(ft.outlineShowCodeCellSymbols),this.showMarkdownHeadersOnly=this._configurationService.getValue(ft.outlineShowMarkdownHeadersOnly),this._disposables.add(this._configurationService.onDidChangeConfiguration(t=>{t.affectsConfiguration(ft.outlineShowCodeCells)&&(this.showCodeCells=this._configurationService.getValue(ft.outlineShowCodeCells)),t.affectsConfiguration(ft.outlineShowCodeCellSymbols)&&(this.showCodeCellSymbols=this._configurationService.getValue(ft.outlineShowCodeCellSymbols)),t.affectsConfiguration(ft.outlineShowMarkdownHeadersOnly)&&(this.showMarkdownHeadersOnly=this._configurationService.getValue(ft.outlineShowMarkdownHeadersOnly))}))}getActiveEntry(){let i=this.outlineDataSourceRef?.object?.activeElement;if(!i)return;if(!qwi(i,this.showMarkdownHeadersOnly,this.showCodeCells,this.showCodeCellSymbols))return i;let e=i.parent;for(;e;)if(qwi(e,this.showMarkdownHeadersOnly,this.showCodeCells,this.showCodeCellSymbols))e=e.parent;else return e}*getChildren(i){let t=i instanceof yMe?this.outlineDataSourceRef?.object?.entries??[]:i.children;for(let o of t)o.cell.cellKind===1?this.showMarkdownHeadersOnly?o.level<7&&(yield o):yield o:this.showCodeCells&&o.cell.cellKind===2&&(this.showCodeCellSymbols?yield o:o.level===7&&(yield o))}dispose(){this._disposables.dispose()}};UZe=I([m(1,B)],UZe);var zZe=class{constructor(i,e){this.outlineDataSourceRef=i;this._configurationService=e;this._disposables=new P;this.showCodeCells=this._configurationService.getValue(ft.breadcrumbsShowCodeCells),this._disposables.add(this._configurationService.onDidChangeConfiguration(t=>{t.affectsConfiguration(ft.breadcrumbsShowCodeCells)&&(this.showCodeCells=this._configurationService.getValue(ft.breadcrumbsShowCodeCells))}))}getBreadcrumbElements(){let i=[],e=this.outlineDataSourceRef?.object?.activeElement;for(;e;)(this.showCodeCells||e.cell.cellKind!==2)&&i.unshift({element:e,label:e.label}),e=e.parent;return i}dispose(){this._disposables.dispose()}};zZe=I([m(1,B)],zZe);var jwi=class{constructor(){this._collator=Wu.Collator(void 0,{numeric:!0})}compareByPosition(i,e){return i.index-e.index}compareByType(i,e){return i.cell.cellKind-e.cell.cellKind||this._collator.value.compare(i.label,e.label)}compareByName(i,e){return this._collator.value.compare(i.label,e.label)}},yMe=class{constructor(i,e,t,o,n,r,s,l){this._editor=i;this._target=e;this._themeService=t;this._editorService=o;this._instantiationService=n;this._configurationService=r;this._languageFeaturesService=s;this._notebookExecutionStateService=l;this.outlineKind="notebookCells";this._disposables=new P;this._modelDisposables=new P;this._dataSourceDisposables=new P;this._onDidChange=new E;this.onDidChange=this._onDidChange.event;this.delayerRecomputeState=this._disposables.add(new jo(300));this.delayerRecomputeActive=this._disposables.add(new jo(200));this.delayerRecomputeSymbols=this._disposables.add(new jo(2e3));this.outlineShowCodeCells=this._configurationService.getValue(ft.outlineShowCodeCells),this.outlineShowCodeCellSymbols=this._configurationService.getValue(ft.outlineShowCodeCellSymbols),this.outlineShowMarkdownHeadersOnly=this._configurationService.getValue(ft.outlineShowMarkdownHeadersOnly),this.initializeOutline();let c=new $wi,u=[this._instantiationService.createInstance(BZe,this._editor.getControl(),this._target)],p=new jwi,h={collapseByDefault:this._target===2||this._target===1&&this._configurationService.getValue("outline.collapseItems")==="alwaysCollapse",expandOnlyOnTwistieClick:!0,multipleSelectionSupport:!1,accessibilityProvider:new Kwi,identityProvider:{getId:g=>g.cell.uri.toString()},keyboardNavigationLabelProvider:new Gwi};this.config={treeDataSource:this._treeDataSource,quickPickDataSource:this._quickPickDataSource,breadcrumbsDataSource:this._breadcrumbsDataSource,delegate:c,renderers:u,comparator:p,options:h}}get activeElement(){if(this.checkDelayer(),this._target===1)return this.config.treeDataSource.getActiveEntry();console.error("activeElement should not be called outside of the OutlinePane")}get entries(){return this.checkDelayer(),this._outlineDataSourceReference?.object?.entries??[]}get uri(){return this._outlineDataSourceReference?.object?.uri}get isEmpty(){return this._outlineDataSourceReference?.object?.entries?!this._outlineDataSourceReference.object.entries.some(i=>!qwi(i,this.outlineShowMarkdownHeadersOnly,this.outlineShowCodeCells,this.outlineShowCodeCellSymbols)):!0}checkDelayer(){this.delayerRecomputeState.isTriggered()&&(this.delayerRecomputeState.cancel(),this.recomputeState())}initializeOutline(){this.setDataSources(),this.setModelListeners(),this._disposables.add(this._editor.onDidChangeModel(()=>{this.setDataSources(),this.setModelListeners(),this.computeSymbols()})),this._disposables.add(this._languageFeaturesService.documentSymbolProvider.onDidChange(()=>{this.delayedComputeSymbols()})),this._disposables.add(this._editor.onDidChangeSelection(()=>{this.delayedRecomputeActive()})),this._disposables.add(this._configurationService.onDidChangeConfiguration(i=>{(i.affectsConfiguration(ft.outlineShowMarkdownHeadersOnly)||i.affectsConfiguration(ft.outlineShowCodeCells)||i.affectsConfiguration(ft.outlineShowCodeCellSymbols)||i.affectsConfiguration(ft.breadcrumbsShowCodeCells))&&(this.outlineShowCodeCells=this._configurationService.getValue(ft.outlineShowCodeCells),this.outlineShowCodeCellSymbols=this._configurationService.getValue(ft.outlineShowCodeCellSymbols),this.outlineShowMarkdownHeadersOnly=this._configurationService.getValue(ft.outlineShowMarkdownHeadersOnly),this.delayedRecomputeState())})),this._disposables.add(this._notebookExecutionStateService.onDidChangeExecution(i=>{i.type===0&&this._editor.textModel&&i.affectsNotebook(this._editor.textModel?.uri)&&this.delayedRecomputeState()})),this._disposables.add(this._configurationService.onDidChangeConfiguration(i=>{i.affectsConfiguration(ft.outlineShowCodeCellSymbols)&&(this.outlineShowCodeCellSymbols=this._configurationService.getValue(ft.outlineShowCodeCellSymbols),this.computeSymbols())})),this._disposables.add(this._themeService.onDidFileIconThemeChange(()=>{this._onDidChange.fire({})})),this.recomputeState()}setDataSources(){let i=this._editor.getControl();this._outlineDataSourceReference?.dispose(),this._dataSourceDisposables.clear(),i?.hasModel()?(this._outlineDataSourceReference=this._dataSourceDisposables.add(this._instantiationService.invokeFunction(e=>e.get($Re).getOrCreate(i))),this._dataSourceDisposables.add(this._outlineDataSourceReference.object.onDidChange(()=>{this._onDidChange.fire({})}))):this._outlineDataSourceReference=void 0,this._treeDataSource=this._dataSourceDisposables.add(this._instantiationService.createInstance(UZe,this._outlineDataSourceReference)),this._quickPickDataSource=this._dataSourceDisposables.add(this._instantiationService.createInstance(HZe,this._outlineDataSourceReference)),this._breadcrumbsDataSource=this._dataSourceDisposables.add(this._instantiationService.createInstance(zZe,this._outlineDataSourceReference))}setModelListeners(){this._modelDisposables.clear(),this._editor.textModel&&(this.entries.length||this.computeSymbols(),this._modelDisposables.add(this._editor.textModel.onDidChangeContent(i=>{i.rawEvents.some(e=>e.kind===10||e.kind===12||e.kind===2||e.kind===1)&&this.delayedRecomputeState()})))}async computeSymbols(i=ve.None){this._target===1&&this.outlineShowCodeCellSymbols&&this.doComputeSymbols(i)}async doComputeSymbols(i){await this._outlineDataSourceReference?.object?.computeFullSymbols(i)}async delayedComputeSymbols(){this.delayerRecomputeState.cancel(),this.delayerRecomputeActive.cancel(),this.delayerRecomputeSymbols.trigger(()=>{this.computeSymbols()})}recomputeState(){this._outlineDataSourceReference?.object?.recomputeState()}delayedRecomputeState(){this.delayerRecomputeActive.cancel(),this.delayerRecomputeState.trigger(()=>{this.recomputeState()})}recomputeActive(){this._outlineDataSourceReference?.object?.recomputeActive()}delayedRecomputeActive(){this.delayerRecomputeActive.trigger(()=>{this.recomputeActive()})}async reveal(i,e,t){let o={...e,override:this._editor.input?.editorId,cellRevealType:2,selection:i.position,viewState:void 0};await this._editorService.openEditor({resource:i.cell.uri,options:o},t?vn:void 0)}preview(i){let e=this._editor.getControl();if(!e)return C.None;if(i.range){let n=z.lift(i.range);e.revealRangeInCenterIfOutsideViewportAsync(i.cell,n)}else e.revealInCenterIfOutsideViewport(i.cell);let t=e.deltaCellDecorations([],[{handle:i.cell.handle,options:{className:"nb-symbolHighlight",outputClassName:"nb-symbolHighlight"}}]),o;return e.changeModelDecorations(n=>{if(i.range){let r=[{range:i.range,options:{description:"document-symbols-outline-range-highlight",className:"rangeHighlight",isWholeLine:!0}}],s={ownerId:i.cell.handle,decorations:r};o=n.deltaDecorations([],[s])}}),Z(()=>{e.deltaCellDecorations(t,[]),o?.length&&e.changeModelDecorations(n=>{n.deltaDecorations(o,[])})})}captureViewState(){let i=this._editor.getControl(),e=i?.getEditorViewState();return Z(()=>{e&&i?.restoreListViewState(e)})}dispose(){this._onDidChange.dispose(),this._disposables.dispose(),this._modelDisposables.dispose(),this._dataSourceDisposables.dispose(),this._outlineDataSourceReference?.dispose()}};yMe=I([m(2,De),m(3,ee),m(4,F),m(5,B),m(6,zt),m(7,rs)],yMe);var KZe=class{constructor(i,e){this._instantiationService=e;let t=i.registerOutlineCreator(this);this.dispose=()=>t.dispose()}matches(i){return i.getId()===uD.ID}async createOutline(i,e,t){let o=this._instantiationService.createInstance(yMe,i,e);return e===4&&await o.doComputeSymbols(t),o}};KZe=I([m(0,kR),m(1,F)],KZe);var $f={CellKind:new Q("notebookCellKind",void 0),CellHasChildren:new Q("notebookCellHasChildren",!1),CellHasHeader:new Q("notebookCellHasHeader",!1),CellFoldingState:new Q("notebookCellFoldingState",0),OutlineElementTarget:new Q("notebookOutlineElementTarget",void 0)};oe.as(Qi.Workbench).registerWorkbenchContribution(KZe,4);oe.as(ii.Configuration).registerConfiguration({id:"notebook",order:100,type:"object",properties:{[ft.outlineShowMarkdownHeadersOnly]:{type:"boolean",default:!0,markdownDescription:d(11730,null)},[ft.outlineShowCodeCells]:{type:"boolean",default:!1,markdownDescription:d(11728,null)},[ft.outlineShowCodeCellSymbols]:{type:"boolean",default:!0,markdownDescription:d(11729,null)},[ft.breadcrumbsShowCodeCells]:{type:"boolean",default:!0,markdownDescription:d(11725,null)},[ft.gotoSymbolsAllSymbols]:{type:"boolean",default:!0,markdownDescription:d(11727,null)}}});fe.appendMenuItem(D.ViewTitle,{submenu:D.NotebookOutlineFilter,title:d(11726,null),icon:M.filter,group:"navigation",order:-1,when:x.and(x.equals("view",gy.Id),Ua)});W(class extends K{constructor(){super({id:"notebook.outline.toggleShowMarkdownHeadersOnly",title:d(11733,null),f1:!1,toggled:{condition:x.equals("config.notebook.outline.showMarkdownHeadersOnly",!0)},menu:{id:D.NotebookOutlineFilter,group:"0_markdown_cells"}})}run(i,...e){let t=i.get(B),o=t.getValue(ft.outlineShowMarkdownHeadersOnly);t.updateValue(ft.outlineShowMarkdownHeadersOnly,!o)}});W(class extends K{constructor(){super({id:"notebook.outline.toggleCodeCells",title:d(11731,null),f1:!1,toggled:{condition:x.equals("config.notebook.outline.showCodeCells",!0)},menu:{id:D.NotebookOutlineFilter,order:1,group:"1_code_cells"}})}run(i,...e){let t=i.get(B),o=t.getValue(ft.outlineShowCodeCells);t.updateValue(ft.outlineShowCodeCells,!o)}});W(class extends K{constructor(){super({id:"notebook.outline.toggleCodeCellSymbols",title:d(11732,null),f1:!1,toggled:{condition:x.equals("config.notebook.outline.showCodeCellSymbols",!0)},menu:{id:D.NotebookOutlineFilter,order:2,group:"1_code_cells"}})}run(i,...e){let t=i.get(B),o=t.getValue(ft.outlineShowCodeCellSymbols);t.updateValue(ft.outlineShowCodeCellSymbols,!o)}});var Qwi=class extends K{constructor(){super({id:"notebook.section.runSingleCell",title:{...L(11866,"Run Cell"),mnemonicTitle:d(11864,null)},shortTitle:d(11867,null),icon:HK,menu:[{id:D.NotebookOutlineActionMenu,group:"inline",order:1,when:x.and($f.CellKind.isEqualTo(2),$f.OutlineElementTarget.isEqualTo(1),$f.CellHasChildren.toNegated(),$f.CellHasHeader.toNegated())}]})}async run(i,e){UVt(e)&&e.notebookEditor.executeNotebookCells([e.outlineEntry.cell])}},Ywi=class extends K{constructor(){super({id:"notebook.section.runCells",title:{...L(11868,"Run Cells In Section"),mnemonicTitle:d(11865,null)},shortTitle:d(11869,null),icon:HK,menu:[{id:D.NotebookStickyScrollContext,group:"notebookExecution",order:1},{id:D.NotebookOutlineActionMenu,group:"inline",order:1,when:x.and($f.CellKind.isEqualTo(1),$f.OutlineElementTarget.isEqualTo(1),$f.CellHasChildren,$f.CellHasHeader)},{id:D.NotebookCellTitle,order:0,group:VF,when:Jco}]})}async run(i,e){let t;if(UVt(e))t=e.outlineEntry.cell;else if(wQo(e))t=e.cell;else return;t.getEditState()===1&&e.notebookEditor.getContribution(BR.id).recompute();let o=e.notebookEditor.getViewModel()?.getCellIndex(t);if(o===void 0)return;let n=e.notebookEditor.getViewModel()?.getFoldingStartIndex(o);if(n===void 0)return;let r=e.notebookEditor.getViewModel()?.getFoldedLength(n);if(r===void 0)return;let s=e.notebookEditor.getCellsInRange({start:n,end:n+r+1});e.notebookEditor.executeNotebookCells(s)}},Xwi=class extends K{constructor(){super({id:"notebook.section.foldSection",title:{...L(11860,"Fold Section"),mnemonicTitle:d(11863,null)},shortTitle:d(11861,null),menu:[{id:D.NotebookOutlineActionMenu,group:"notebookFolding",order:2,when:x.and($f.CellKind.isEqualTo(1),$f.OutlineElementTarget.isEqualTo(1),$f.CellHasChildren,$f.CellHasHeader,$f.CellFoldingState.isEqualTo(1))}]})}async run(i,e){UVt(e)&&this.toggleFoldRange(e.outlineEntry,e.notebookEditor)}toggleFoldRange(i,e){let t=e.getContribution(BR.id),o=i.index,n=i.level,r=2;t.setFoldingStateDown(o,r,n)}},Jwi=class extends K{constructor(){super({id:"notebook.section.expandSection",title:{...L(11858,"Expand Section"),mnemonicTitle:d(11862,null)},shortTitle:d(11859,null),menu:[{id:D.NotebookOutlineActionMenu,group:"notebookFolding",order:2,when:x.and($f.CellKind.isEqualTo(1),$f.OutlineElementTarget.isEqualTo(1),$f.CellHasChildren,$f.CellHasHeader,$f.CellFoldingState.isEqualTo(2))}]})}async run(i,e){UVt(e)&&this.toggleFoldRange(e.outlineEntry,e.notebookEditor)}toggleFoldRange(i,e){let t=e.getContribution(BR.id),o=i.index,n=i.level,r=1;t.setFoldingStateDown(o,r,n)}};function UVt(a){return!!(a&&a.notebookEditor&&a.outlineEntry)}function wQo(a){return!!(a&&a.notebookEditor&&a.cell)}W(Qwi);W(Ywi);W(Xwi);W(Jwi);W(class extends K{constructor(){super({id:"workbench.notebook.layout.select",title:L(11849,"Select between Notebook Layouts"),f1:!0,precondition:x.equals(`config.${ft.openGettingStarted}`,!0),category:jm,menu:[{id:D.EditorTitle,group:"notebookLayout",when:x.and(Ua,x.notEquals("config.notebook.globalToolbar",!0),x.equals(`config.${ft.openGettingStarted}`,!0)),order:0},{id:D.NotebookToolbar,group:"notebookLayout",when:x.and(x.equals("config.notebook.globalToolbar",!0),x.equals(`config.${ft.openGettingStarted}`,!0)),order:0}]})}run(i){i.get(ge).executeCommand("workbench.action.openWalkthrough",{category:"notebooks",step:"notebookProfile"},!0)}});W(class extends K{constructor(){super({id:"workbench.notebook.layout.configure",title:L(11848,"Customize Notebook Layout"),f1:!0,category:jm,menu:[{id:D.NotebookToolbar,group:"notebookLayout",when:x.equals("config.notebook.globalToolbar",!0),order:1}]})}run(i){i.get(Po).openSettings({jsonEditor:!1,query:"@tag:notebookLayout"})}});W(class extends K{constructor(){super({id:"workbench.notebook.layout.configure.editorTitle",title:L(11848,"Customize Notebook Layout"),f1:!1,category:jm,menu:[{id:D.NotebookEditorLayoutConfigure,group:"notebookLayout",when:Ua,order:1}]})}run(i){i.get(Po).openSettings({jsonEditor:!1,query:"@tag:notebookLayout"})}});fe.appendMenuItem(D.EditorTitle,{submenu:D.NotebookEditorLayoutConfigure,title:L(11833,"Customize Notebook..."),icon:M.gear,group:"navigation",order:-1,when:Ua});W(class extends K{constructor(){super({id:"notebook.toggleLineNumbersFromEditorTitle",title:L(11841,"Toggle Notebook Line Numbers"),shortTitle:L(11842,"Line Numbers"),precondition:rr,menu:[{id:D.NotebookEditorLayoutConfigure,group:"notebookLayoutDetails",order:1,when:Ua}],category:jm,f1:!0,toggled:{condition:x.notEquals("config.notebook.lineNumbers","off"),title:d(11837,null)}})}async run(i){return i.get(ge).executeCommand("notebook.toggleLineNumbers")}});W(class extends K{constructor(){super({id:"notebook.toggleCellToolbarPositionFromEditorTitle",title:L(11840,"Toggle Cell Toolbar Position"),menu:[{id:D.NotebookEditorLayoutConfigure,group:"notebookLayoutDetails",order:3}],category:jm,f1:!1})}async run(i,...e){return i.get(ge).executeCommand("notebook.toggleCellToolbarPosition",...e)}});W(class extends K{constructor(){super({id:"breadcrumbs.toggleFromEditorTitle",title:L(11838,"Toggle Breadcrumbs"),shortTitle:L(11839,"Breadcrumbs"),toggled:{condition:x.equals("config.breadcrumbs.enabled",!0),title:d(11832,null)},menu:[{id:D.NotebookEditorLayoutConfigure,group:"notebookLayoutDetails",order:2}],category:jm,f1:!1})}async run(i){return i.get(ge).executeCommand("breadcrumbs.toggle")}});W(class extends K{constructor(){super({id:"notebook.saveMimeTypeOrder",title:L(11836,"Save Mimetype Display Order"),f1:!0,category:jm,precondition:Ua})}run(i){let e=i.get(un),t=new P,o=t.add(i.get(Ge).createQuickPick());o.placeholder=d(11835,null),o.items=[{target:2,label:d(11844,null)},{target:5,label:d(11845,null)}],t.add(o.onDidAccept(()=>{let n=o.selectedItems[0]?.target;n!==void 0&&e.saveMimeDisplayOrder(n),o.dispose()})),t.add(o.onDidHide(()=>t.dispose())),o.show()}});W(class extends K{constructor(){super({id:"workbench.notebook.layout.webview.reset",title:L(11850,"Reset Notebook Webview"),f1:!1,category:jm})}run(i,e){let t=i.get(ee);if(e){let o=A.revive(e),r=i.get(Zc).listNotebookEditors().filter(s=>s.hasModel()&&s.textModel.uri.toString()===o.toString());for(let s of r)s.hasModel()&&s.getInnerWebview()?.reload()}else{let o=qn(t.activeEditorPane);if(!o)return;o.getInnerWebview()?.reload()}}});W(class extends K{constructor(){super({id:"notebook.action.toggleNotebookStickyScroll",title:{...L(11846,"Toggle Notebook Sticky Scroll"),mnemonicTitle:d(11834,null)},shortTitle:L(11847,"Sticky Scroll"),category:We.View,toggled:{condition:x.equals("config.notebook.stickyScroll.enabled",!0),title:d(11843,null),mnemonicTitle:d(11834,null)},menu:[{id:D.CommandPalette},{id:D.NotebookStickyScrollContext,group:"notebookView",order:2},{id:D.NotebookToolbarContext,group:"notebookView",order:2}]})}async run(i){let e=i.get(B),t=!e.getValue("notebook.stickyScroll.enabled");return e.updateValue("notebook.stickyScroll.enabled",t)}});var wMe=ae("IWebContentExtractorService"),t2=ae("ISharedWebContentExtractorService");var $Ze=["text/plain","text/html","application/vnd.code.notebook.error","application/vnd.code.notebook.stdout","application/x.notebook.stdout","application/x.notebook.stream","application/vnd.code.notebook.stderr","application/x.notebook.stderr","image/png","image/jpeg","image/svg"];function zVt(a,i,e){let t=a.cellViewModel.handle,o=e.textModel,n=e.getCellByHandle(t);if(!n||n.outputsViewModels.length===0||!o)return;let r=o.uri,s=n.uri,l=o.cells.indexOf(n.model),c=a?.model.outputId,u=0;c!==void 0&&(u=n.outputsViewModels.findIndex(f=>f.model.outputId===c));let p=Zo.generateCellOutputUriWithIndex(r,s,u),h=Hp(Ra(r));return{value:p,id:p.toString(),name:d(11653,null,h,`${l+1}`,`${u+1}`),icon:i==="application/vnd.code.notebook.error"?q.fromId("error"):void 0,kind:"notebookOutput",outputIndex:u,mimeType:i}}var JZ=class a{constructor(i,e,t,o,n,r={},s){this.toolCallId=t;this.kind="toolInvocation";this._progress=Le(this,{progress:0});this._partialInput=Le(this,void 0);this._streamingMessage=Le(this,void 0);let l="";r.startInStreaming?l=d(7628,null,e.displayName):r.startInCancelled&&(l=r.cancelReasonMessage??d(7627,null,e.displayName)),this.invocationMessage=i?.invocationMessage??l,this.pastTenseMessage=i?.pastTenseMessage,this.originMessage=i?.originMessage,this.confirmationMessages=i?.confirmationMessages,this.presentation=i?.presentation,this.toolSpecificData=i?.toolSpecificData,this.toolId=e.id,this.source=e.source,this.subAgentInvocationId=o,this.parameters=n,this.chatRequestId=s,r.startInCancelled?this._state=Le(this,{type:lo.StateKind.Cancelled,reason:r.cancelReason??0,reasonMessage:r.cancelReasonMessage,parameters:this.parameters,confirmationMessages:this.confirmationMessages}):r.startInStreaming?this._state=Le(this,{type:lo.StateKind.Streaming,partialInput:this._partialInput,streamingMessage:this._streamingMessage}):this.confirmationMessages?.title?this._state=Le(this,{type:lo.StateKind.WaitingForConfirmation,parameters:this.parameters,confirmationMessages:this.confirmationMessages,confirm:c=>{c.type===0||c.type===5?this._state.set({type:lo.StateKind.Cancelled,reason:c.type,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0):this._state.set({type:lo.StateKind.Executing,confirmed:c,progress:this._progress,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0)}}):this._state=Le(this,{type:lo.StateKind.Executing,confirmed:{type:1,reason:this.confirmationMessages?.confirmationNotNeededReason},progress:this._progress,parameters:this.parameters,confirmationMessages:this.confirmationMessages})}get state(){return this._state}static createStreaming(i){return new a(void 0,i.toolData,i.toolCallId,i.subagentInvocationId,void 0,{startInStreaming:!0},i.chatRequestId)}static createCancelled(i,e,t,o){return new a(void 0,i.toolData,i.toolCallId,i.subagentInvocationId,e,{startInCancelled:!0,cancelReason:t,cancelReasonMessage:o},i.chatRequestId)}updatePartialInput(i){this._state.get().type===lo.StateKind.Streaming&&this._partialInput.set(i,void 0)}updateStreamingMessage(i){this._state.get().type===lo.StateKind.Streaming&&this._streamingMessage.set(i,void 0)}cancelFromStreaming(i,e){return this._state.get().type!==lo.StateKind.Streaming?!1:(this._state.set({type:lo.StateKind.Cancelled,reason:i,reasonMessage:e,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0),!0)}transitionFromStreaming(i,e,t){if(this._state.get().type!==lo.StateKind.Streaming)return;let n=this._streamingMessage.get();n&&!i?.invocationMessage&&(this.invocationMessage=n),this.parameters=e,i&&(i.invocationMessage&&(this.invocationMessage=i.invocationMessage),this.pastTenseMessage=i.pastTenseMessage,this.confirmationMessages=i.confirmationMessages,this.presentation=i.presentation,this.toolSpecificData=i.toolSpecificData);let r=s=>{s.type===0||s.type===5?this._state.set({type:lo.StateKind.Cancelled,reason:s.type,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0):this._state.set({type:lo.StateKind.Executing,confirmed:s,progress:this._progress,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0)};t?r(t):this.confirmationMessages?.title?this._state.set({type:lo.StateKind.WaitingForConfirmation,parameters:this.parameters,confirmationMessages:this.confirmationMessages,confirm:r},void 0):this._state.set({type:lo.StateKind.Executing,confirmed:{type:1,reason:this.confirmationMessages?.confirmationNotNeededReason},progress:this._progress,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0)}_setCompleted(i,e){if(e&&(e.type===0||e.type===5)){this._state.set({type:lo.StateKind.Cancelled,reason:e.type,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0);return}this._state.set({type:lo.StateKind.Completed,confirmed:lo.executionConfirmedOrDenied(this)||{type:1},resultDetails:i?.toolResultDetails,postConfirmed:e,contentForModel:i?.content||[],parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0)}async didExecuteTool(i,e,t){if(i?.toolResultMessage?this.pastTenseMessage=i.toolResultMessage:this._progress.get().message&&(this.pastTenseMessage=this._progress.get().message),this.confirmationMessages?.confirmResults&&!i?.toolResultError&&i?.confirmResults!==!1&&!e){let o=await t?.();o?this._setCompleted(i,o):this._state.set({type:lo.StateKind.WaitingForPostApproval,confirmed:lo.executionConfirmedOrDenied(this)||{type:1},resultDetails:i?.toolResultDetails,contentForModel:i?.content||[],confirm:n=>this._setCompleted(i,n),parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0)}else this._setCompleted(i);return this._state.get()}acceptProgress(i){let e=this._progress.get();this._progress.set({progress:i.progress||e.progress||0,message:i.message},void 0)}toJSON(){let i=this.state.get().type===lo.StateKind.WaitingForPostApproval,e=i?void 0:lo.resultDetails(this);return{kind:"toolInvocationSerialized",presentation:this.presentation,invocationMessage:this.invocationMessage,pastTenseMessage:this.pastTenseMessage,originMessage:this.originMessage,isConfirmed:i?{type:5}:lo.executionConfirmedOrDenied(this),isComplete:!0,source:this.source,resultDetails:zj(e)?{output:{type:"data",mimeType:e.output.mimeType,base64Data:Qd(e.output.value)}}:e,toolSpecificData:this.toolSpecificData,toolCallId:this.toolCallId,toolId:this.toolId,subAgentInvocationId:this.subAgentInvocationId,generatedTitle:this.generatedTitle}}};var $Vt={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp"};function X4(a){return Object.entries($Vt).find(([i,e])=>e===a)?.[0]}var tdo;(i=>{function a(e){return{variables:e.variables.map(uV.toExport)}}i.toExport=a})(tdo||={});function CQo(a){let i=a;return!!i&&!!i.edit&&!!i.uri&&A.isUri(i.uri)}function xMe(a){return a.some(CQo)}var xQo=new Set(["toolInvocation","toolInvocationSerialized","undoStop"]);function kQo(a){return!xQo.has(a.kind)}function ido(a){return a.filter(kQo)}var qF={reason:"other"},yB=class{constructor(i){this._shouldBeBlocked=Le(this,!1);this._version=0;this._session=i.session,this.message=i.message,this._variableData=i.variableData,this.timestamp=i.timestamp,this._attempt=i.attempt??0,this.modeInfo=i.modeInfo,this._confirmation=i.confirmation,this._locationData=i.locationData,this._attachedContext=i.attachedContext,this.isCompleteAddedRequest=i.isCompleteAddedRequest??!1,this.modelId=i.modelId,this.id=i.restoredId??"request_"+_t(),this._editedFileEvents=i.editedFileEvents,this.userSelectedTools=i.userSelectedTools}get shouldBeBlocked(){return this._shouldBeBlocked}setShouldBeBlocked(i){this._shouldBeBlocked.set(i,void 0)}get session(){return this._session}get attempt(){return this._attempt}get variableData(){return this._variableData}set variableData(i){this._version++,this._variableData=i}get confirmation(){return this._confirmation}get locationData(){return this._locationData}get attachedContext(){return this._attachedContext}get editedFileEvents(){return this._editedFileEvents}get version(){return this._version}adoptTo(i){this._session=i}},KVt=class{constructor(i){this._responseRepr="";this._markdownContent="";this._responseParts=i,this._updateRepr()}get value(){return this._responseParts}toString(){return this._responseRepr}getMarkdown(){return this._markdownContent}_updateRepr(){this._responseRepr=this.partsToRepr(this._responseParts),this._markdownContent=this._responseParts.map(i=>i.kind==="inlineReference"?this.inlineRefToRepr(i):i.kind==="markdownContent"||i.kind==="markdownVuln"?i.content.value:"").filter(i=>i.length>0).join("")}partsToRepr(i){let e=[],t=[],o=!1;for(let n of i){let r;switch(n.kind){case"clearToPreviousToolInvocation":t=[],e.length=0,o=!1;continue;case"treeData":case"progressMessage":case"codeblockUri":case"extensions":case"pullRequest":case"undoStop":case"workspaceEdit":case"elicitation2":case"elicitationSerialized":case"thinking":case"hook":case"multiDiffData":case"mcpServersStarting":case"questionCarousel":case"disabledClaudeHooks":continue;case"toolInvocation":case"toolInvocationSerialized":r=this.getToolInvocationText(n);break;case"inlineReference":r={text:this.inlineRefToRepr(n)};break;case"command":r={text:n.command.title,isBlock:!0};break;case"textEditGroup":case"notebookEditGroup":o=!0;continue;case"confirmation":if(n.message instanceof xe){r={text:`${n.title}
${n.message.value}`,isBlock:!0};break}r={text:`${n.title}
${n.message}`,isBlock:!0};break;case"markdownContent":case"markdownVuln":case"progressTask":case"progressTaskSerialized":case"warning":r={text:n.content.value};break;default:continue}r.isBlock?(t.length&&(e.push(t.join("")),t=[]),e.push(r.text)):t.push(r.text)}return t.length&&e.push(t.join("")),o&&e.push(d(7623,null)),e.join(`
`)}inlineRefToRepr(i){return"uri"in i.inlineReference?this.uriToRepr(i.inlineReference.uri):"name"in i.inlineReference?"`"+i.inlineReference.name+"`":this.uriToRepr(i.inlineReference)}getToolInvocationText(i){let e="",t="";if(i.pastTenseMessage?e=typeof i.pastTenseMessage=="string"?i.pastTenseMessage:i.pastTenseMessage.value:e=typeof i.invocationMessage=="string"?i.invocationMessage:i.invocationMessage.value,i.toolSpecificData&&i.toolSpecificData.kind==="terminal"){e="Ran terminal command";let n=fR(i.toolSpecificData);t=n.commandLine.userEdited??n.commandLine.toolEdited??n.commandLine.original}let o=e;if(t&&(o+=`: ${t}`),i.kind==="toolInvocationSerialized"||i.kind==="toolInvocation"&&lo.isComplete(i)){let n=lo.resultDetails(i);if(n&&"input"in n){let r=i.kind==="toolInvocationSerialized"||lo.isComplete(i)?"Completed":"Errored";o+=`
${r} with input: ${n.input}`}}return{text:o,isBlock:!0}}uriToRepr(i){return i.scheme===Y.http||i.scheme===Y.https?i.toString(!1):Ye(i)}},Zwi=class extends KVt{constructor(e,t){let o=e.value.findIndex(n=>n.kind==="undoStop"&&n.id===t);e.value[o+1]?.kind==="codeblockUri"&&e.value[o-1]?.kind==="markdownContent"&&o--;super(o===-1?e.value.slice():e.value.slice(0,o));this.undoStop=t}},eCi=class extends KVt{constructor(e){super(Yl(e).map(t=>"kind"in t?t:Mr(t)?{content:t,kind:"markdownContent"}:{kind:"treeData",treeData:t}));this._onDidChangeValue=new E;this._citations=[]}get onDidChangeValue(){return this._onDidChangeValue.event}dispose(){this._onDidChangeValue.dispose()}clear(){this._responseParts=[],this._updateRepr(!0)}clearToPreviousToolInvocation(e){let t=-1;for(let o=this._responseParts.length-1;o>=0;o--){let n=this._responseParts[o];if(n.kind==="toolInvocation"||n.kind==="toolInvocationSerialized"){t=o;break}}t!==-1?this._responseParts=this._responseParts.slice(0,t+1):this._responseParts=[],e&&this._responseParts.push({kind:"warning",content:new xe(e)}),this._updateRepr(!0)}updateContent(e,t){if(e.kind==="clearToPreviousToolInvocation"){e.reason===2?this.clearToPreviousToolInvocation(d(7622,null)):e.reason===1?this.clearToPreviousToolInvocation(d(7624,null)):this.clearToPreviousToolInvocation();return}else if(e.kind==="markdownContent"){let o=this._responseParts.filter(n=>n.kind!=="textEditGroup").at(-1);if(!o||o.kind!=="markdownContent"||!GVt(o.content,e.content))this._responseParts.push(e);else{let n=this._responseParts.indexOf(o);this._responseParts[n]={...o,content:ZZ(o.content,e.content)}}this._updateRepr(t)}else if(e.kind==="thinking"){let o=this._responseParts.filter(l=>l.kind!=="textEditGroup").at(-1),n=o&&o.kind==="thinking"?Array.isArray(o.value)?o.value.join(""):o.value||"":"",r=Array.isArray(e.value)?e.value.join(""):e.value||"",s=l=>l.length===0;if(!o||o.kind!=="thinking"||s(r)||s(n)||!GVt(new xe(n),new xe(r)))this._responseParts.push(e);else{let l=this._responseParts.indexOf(o);this._responseParts[l]={...o,value:ZZ(new xe(n),new xe(r)).value}}this._updateRepr(t)}else if(e.kind==="textEdit"||e.kind==="notebookEdit"){let o=Zo.parse(e.uri)?.notebook,n=o??e.uri,r=e.isExternalEdit;if(e.kind==="textEdit"&&!o)this._mergeOrPushTextEditGroup(n,e.edits,e.done,r);else if(e.kind==="textEdit"){let s=e.edits.map(l=>({uri:e.uri,edit:l}));this._mergeOrPushNotebookEditGroup(n,s,e.done,r)}else this._mergeOrPushNotebookEditGroup(n,e.edits,e.done,r);this._updateRepr(t)}else if(e.kind==="progressTask"){let o=this._responseParts.push(e)-1;this._updateRepr(t);let n=e.onDidAddProgress(()=>{this._updateRepr(!1)});e.task?.().then(r=>{n.dispose(),typeof r=="string"&&(this._responseParts[o].content=new xe(r)),this._updateRepr(!1)})}else e.kind==="toolInvocation"?(ux(o=>{e.state.read(o),this._updateRepr(!1),lo.isComplete(e,o)&&o.dispose()}),this._responseParts.push(e),this._updateRepr(t)):e.kind==="externalToolInvocationUpdate"?(this._handleExternalToolInvocationUpdate(e),this._updateRepr(t)):(this._responseParts.push(e),this._updateRepr(t))}addCitation(e){this._citations.push(e),this._updateRepr()}_mergeOrPushTextEditGroup(e,t,o,n){for(let r of this._responseParts)if(r.kind==="textEditGroup"&&!r.done&&Xe(r.uri,e)){r.edits.push(t),r.done=o;return}this._responseParts.push({kind:"textEditGroup",uri:e,edits:[t],done:o,isExternalEdit:n})}_mergeOrPushNotebookEditGroup(e,t,o,n){for(let r of this._responseParts)if(r.kind==="notebookEditGroup"&&!r.done&&Xe(r.uri,e)){r.edits.push(t),r.done=o;return}this._responseParts.push({kind:"notebookEditGroup",uri:e,edits:[t],done:o,isExternalEdit:n})}_handleExternalToolInvocationUpdate(e){let t=this._responseParts.findLast(r=>r.kind==="toolInvocation"&&r.toolCallId===e.toolCallId);if(t){e.isComplete&&t.didExecuteTool({content:[],toolResultMessage:e.pastTenseMessage,toolResultError:e.errorMessage}),e.toolSpecificData!==void 0&&(t.toolSpecificData=e.toolSpecificData);return}let o={id:e.toolName,source:Rn.External,displayName:e.toolName,modelDescription:e.toolName},n=new JZ({invocationMessage:e.invocationMessage,pastTenseMessage:e.pastTenseMessage,toolSpecificData:e.toolSpecificData},o,e.toolCallId,e.subagentInvocationId,void 0,{},void 0);e.isComplete&&(n.didExecuteTool({content:[],toolResultMessage:e.pastTenseMessage,toolResultError:e.errorMessage}),e.toolSpecificData!==void 0&&(n.toolSpecificData=e.toolSpecificData)),this._responseParts.push(n)}_updateRepr(e){super._updateRepr(),this._onDidChangeValue&&(this._responseRepr+=this._citations.length?`
`+nCi(this._citations):"",e||this._onDidChangeValue.fire())}},CMe=class extends C{constructor(e){super();this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._modelState=Le(this,{value:0});this._shouldBeBlocked=Le(this,!1);this._contentReferences=[];this._codeCitations=[];this._progressMessages=[];this._isStale=!1;this._session=e.session,this._agent=e.agent,this._slashCommand=e.slashCommand,this.requestId=e.requestId,this._timestamp=e.timestamp||Date.now(),e.modelState&&this._modelState.set(e.modelState,void 0),this._timeSpentWaitingAccumulator=e.timeSpentWaiting||0,this._vote=e.vote,this._voteDownReason=e.voteDownReason,this._result=e.result,this._followups=e.followups?[...e.followups]:void 0,this.isCompleteAddedRequest=e.isCompleteAddedRequest??!1,this._shouldBeRemovedOnSend=e.shouldBeRemovedOnSend,this._shouldBeBlocked.set(e.shouldBeBlocked??!1,void 0),this._isStale=Array.isArray(e.responseContent)&&(e.responseContent.length!==0||Mr(e.responseContent)&&e.responseContent.value.length!==0),this._response=this._register(new eCi(e.responseContent)),this._codeBlockInfos=e.codeBlockInfos?[...e.codeBlockInfos]:void 0;let t=Nr(this,this.onDidChange),o=t.map((s,l)=>{t.read(l);for(let c of this._response.value){if(c.kind==="toolInvocation"){let u=c.state.read(l);if(u.type===lo.StateKind.WaitingForConfirmation){let p=u.confirmationMessages?.title;return p?Mr(p)?p.value:p:void 0}if(u.type===lo.StateKind.WaitingForPostApproval)return d(7626,null)}if(c.kind==="confirmation"&&!c.isUsed)return c.title;if(c.kind==="questionCarousel"&&!c.isUsed)return d(7625,null);if(c.kind==="elicitation2"&&c.state.read(l)==="pending"){let u=c.title;return Mr(u)?u.value:u}}}),n=o.map(s=>!!s).map(s=>s?Date.now():void 0);this.isPendingConfirmation=n.map((s,l)=>s?{startedWaitingAt:s,detail:o.read(l)}:void 0),this.isInProgress=t.map((s,l)=>(t.read(l),!o.read(l)&&!this.shouldBeRemovedOnSend&&(this._modelState.read(l).value===0||this._modelState.read(l).value===4))),this._register(this._response.onDidChangeValue(()=>this._onDidChange.fire(qF))),this.id=e.restoredId??"response_"+_t();let r;this.confirmationAdjustedTimestamp=Ce(s=>{let l=this.isPendingConfirmation.read(s);return l?(this._modelState.set({value:4},void 0),r||(r=l.startedWaitingAt)):r&&(this._modelState.read(s).value===4&&this._modelState.set({value:0},void 0),this._timeSpentWaitingAccumulator+=Date.now()-r,r=void 0),this._timestamp+this._timeSpentWaitingAccumulator}).recomputeInitiallyAndOnChange(this._store)}get shouldBeBlocked(){return this._shouldBeBlocked}get request(){return this.session.getRequests().find(e=>e.id===this.requestId)}get session(){return this._session}get shouldBeRemovedOnSend(){return this._shouldBeRemovedOnSend}get isComplete(){return this._modelState.get().value!==0&&this._modelState.get().value!==4}get timestamp(){return this._timestamp}set shouldBeRemovedOnSend(e){this._shouldBeRemovedOnSend!==e&&(this._shouldBeRemovedOnSend=e,this._onDidChange.fire(qF))}get isCanceled(){return this._modelState.get().value===2}get completedAt(){let e=this._modelState.get();if(e.value===1||e.value===2||e.value===3)return e.completedAt}get state(){let e=this._modelState.get().value;return e===1&&this._result?.errorDetails&&this.result?.errorDetails?.code!=="canceled"?3:e}get stateT(){return this._modelState.get()}get vote(){return this._vote}get voteDownReason(){return this._voteDownReason}get followups(){return this._followups}get entireResponse(){return this._finalizedResponse||this._response}get result(){return this._result}get usage(){return this._usage}get username(){return this.session.responderUsername}get agent(){return this._agent}get slashCommand(){return this._slashCommand}get agentOrSlashCommandDetected(){return this._agentOrSlashCommandDetected??!1}get usedContext(){return this._usedContext}get contentReferences(){return Array.from(this._contentReferences)}get codeCitations(){return this._codeCitations}get progressMessages(){return this._progressMessages}get isStale(){return this._isStale}get response(){let e=this._shouldBeRemovedOnSend?.afterUndoStop;return e?(this._responseView?.undoStop!==e&&(this._responseView=new Zwi(this._response,e)),this._responseView):this._finalizedResponse||this._response}get codeBlockInfos(){return this._codeBlockInfos}initializeCodeBlockInfos(e){if(this._codeBlockInfos)throw new ni("Code block infos have already been initialized");this._codeBlockInfos=[...e]}setBlockedState(e){this._shouldBeBlocked.set(e,void 0)}updateContent(e,t){this._response.updateContent(e,t)}addUndoStop(e){this._onDidChange.fire({reason:"undoStop",id:e.id}),this._response.updateContent(e,!0)}applyReference(e){e.kind==="usedContext"?this._usedContext=e:e.kind==="reference"&&(this._contentReferences.push(e),this._onDidChange.fire(qF))}applyCodeCitation(e){this._codeCitations.push(e),this._response.addCitation(e),this._onDidChange.fire(qF)}setAgent(e,t){this._agent=e,this._slashCommand=t,this._agentOrSlashCommandDetected=!e.isDefault||!!t,this._onDidChange.fire(qF)}setResult(e){this._result=e,this._onDidChange.fire(qF)}setUsage(e){this._usage=e,this._onDidChange.fire(qF)}complete(){if(this.isComplete)return;this._result?.errorDetails?.responseIsRedacted&&this._response.clear();let e=this._result?.errorDetails&&this._result.errorDetails.code!=="canceled"?3:1;this._modelState.set({value:e,completedAt:Date.now()},void 0),this._onDidChange.fire({reason:"completedRequest"})}cancel(){this._modelState.set({value:2,completedAt:Date.now()},void 0),this._onDidChange.fire({reason:"completedRequest"})}setFollowups(e){this._followups=e,this._onDidChange.fire(qF)}setVote(e){this._vote=e,this._onDidChange.fire(qF)}setVoteDownReason(e){this._voteDownReason=e,this._onDidChange.fire(qF)}setEditApplied(e,t){return!this.response.value.includes(e)||!e.state?!1:(e.state.applied=t,this._onDidChange.fire(qF),!0)}adoptTo(e){this._session=e,this._onDidChange.fire(qF)}finalizeUndoState(){this._finalizedResponse=this.response,this._responseView=void 0,this._shouldBeRemovedOnSend=void 0}toJSON(){let e=this._modelState.get(),t=this.isPendingConfirmation.get();return{responseId:this.id,result:this.result,responseMarkdownInfo:this.codeBlockInfos?.map(o=>({suggestionId:o.suggestionId})),followups:this.followups,modelState:e.value===0||e.value===4?{value:2,completedAt:Date.now()}:e,vote:this.vote,voteDownReason:this.voteDownReason,slashCommand:this.slashCommand,usedContext:this.usedContext,contentReferences:this.contentReferences,codeCitations:this.codeCitations,timestamp:this._timestamp,timeSpentWaiting:(t?Date.now()-t.startedWaitingAt:0)+this._timeSpentWaitingAccumulator}}};function qVt(a){return EQo(a),"version"in a?a.version===2?{...a,version:3,customTitle:a.computedTitle}:a:{version:3,...a,customTitle:void 0}}function EQo(a){a.sessionId||(a.sessionId=_t()),a.creationDate||(a.creationDate=TQo()),a.initialLocation==="editing-session"&&(a.initialLocation="panel")}function TQo(){let a=new Date;return a.setFullYear(a.getFullYear()-1),a.getTime()}function jVt(a){return!!a&&Array.isArray(a.requests)&&typeof a.responderUsername=="string"}function _Qo(a){let i=a;return jVt(a)&&typeof i.creationDate=="number"&&typeof i.sessionId=="string"&&a.requests.every(e=>!e.usedContext||MYi(e.usedContext))}var tCi=class{constructor(i){this._state=rg({debugName:"inputModelState",equalsFn:uo},i),this.state=this._state}setState(i){let e=this._state.get();this._state.set({attachments:[],mode:{id:"agent",kind:"agent"},selectedModel:void 0,inputText:"",selections:[],contrib:{},...e,...i},void 0)}clearState(){this._state.set(void 0,void 0)}toJSON(){let i=this.state.get();if(!i)return;let e=i.attachments.filter(t=>!(MY(t)||CYi(t)&&qx(t.value)));return{contrib:i.contrib,attachments:e,mode:i.mode,selectedModel:i.selectedModel?{identifier:i.selectedModel.identifier,metadata:i.selectedModel.metadata}:void 0,inputText:i.inputText,selections:i.selections}}},Eb=class extends C{constructor(e,t,o,n,r,s){super();this.logService=o;this.chatAgentService=n;this.chatEditingService=r;this.chatService=s;this._onDidDispose=this._register(new E);this.onDidDispose=this._onDidDispose.event;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._pendingRequests=[];this._onDidChangePendingRequests=this._register(new E);this.onDidChangePendingRequests=this._onDidChangePendingRequests.event;this._isImported=!1;this._canUseTools=!0;this.currentEditedFileEvents=new vt;this._checkpoint=void 0;let l=e?.value,c=jVt(l),u=c&&_Qo(l);l&&!c&&this.logService.warn(`ChatModel#constructor: Loaded malformed session data: ${JSON.stringify(l)}`),this._isImported=!!l&&c&&!u,t.resource?(this._sessionId=P_(t.resource),this._sessionResource=t.resource):u?(this._sessionId=l.sessionId,this._sessionResource=cs.forSession(l.sessionId)):(this._sessionId=_t(),this._sessionResource=cs.forSession(this._sessionId)),this._disableBackgroundKeepAlive=t.disableBackgroundKeepAlive??!1,this._requests=l?this._deserialize(l):[],this._timestamp=u&&l.creationDate||Date.now(),this._customTitle=u?l.customTitle:void 0;let p=t.inputState||(u&&l.inputState?l.inputState:void 0);if(this.inputModel=new tCi(p&&{attachments:p.attachments,mode:p.mode,selectedModel:p.selectedModel&&{identifier:p.selectedModel.identifier,metadata:p.selectedModel.metadata},contrib:p.contrib,inputText:p.inputText,selections:p.selections}),this.dataSerializer=e?.serializer,this._initialResponderUsername=l?.responderUsername,this._repoData=u&&l.repoData?l.repoData:void 0,u&&l.pendingRequests&&(this._pendingRequests=this._deserializePendingRequests(l.pendingRequests)),this._initialLocation=l?.initialLocation??t.initialLocation,this._canUseTools=t.canUseTools,this.lastRequestObs=ui(this,this.onDidChange,()=>this._requests.at(-1)),this._register(he(h=>{let g=this.lastRequestObs.read(h);g?.response&&h.store.add(g.response.onDidChange(async f=>{!this._editingSession||f.reason!=="completedRequest"||this._onDidChange.fire({kind:"completedRequest",request:g})}))})),this.requestInProgress=this.lastRequestObs.map((h,g)=>h?.response?.isInProgress.read(g)??!1),this.requestNeedsInput=this.lastRequestObs.map((h,g)=>{let f=h?.response?.isPendingConfirmation.read(g);if(f)return{title:this.title,detail:f.detail}}),this.initialLocation==="panel"&&!t.disableBackgroundKeepAlive){let h=this._register(new me);this._register(he(g=>{let f=this.requestInProgress.read(g),v=this.requestNeedsInput.read(g),b=f||!!v;b&&!h.value?h.value=s.acquireExistingSession(this._sessionResource):!b&&h.value&&h.clear()}))}}static getDefaultTitle(e){let t=e.at(0)?.message??"";return(typeof t=="string"?t:t.text).split(`
`)[0].substring(0,200)}get contributedChatSession(){return this._contributedChatSession}setContributedChatSession(e){this._contributedChatSession=e}get repoData(){return this._repoData}setRepoData(e){this._repoData=e}getPendingRequests(){return this._pendingRequests}setPendingRequests(e){let t=new Map(this._pendingRequests.map(n=>[n.request.id,n])),o=[];for(let{requestId:n,kind:r}of e){let s=t.get(n);s&&o.push(s.kind===r?s:{request:s.request,kind:r,sendOptions:s.sendOptions})}this._pendingRequests.length=0,this._pendingRequests.push(...o),this._onDidChangePendingRequests.fire()}addPendingRequest(e,t,o){let n={request:e,kind:t,sendOptions:o};if(t==="steering"){let r=0;for(let s=0;s<this._pendingRequests.length&&this._pendingRequests[s].kind==="steering";s++)r=s+1;this._pendingRequests.splice(r,0,n)}else this._pendingRequests.push(n);return this._onDidChangePendingRequests.fire(),n}removePendingRequest(e){let t=this._pendingRequests.findIndex(o=>o.request.id===e);t!==-1&&(this._pendingRequests.splice(t,1),this._onDidChangePendingRequests.fire())}dequeuePendingRequest(){let e=this._pendingRequests.shift();return e&&this._onDidChangePendingRequests.fire(),e}dequeueAllSteeringRequests(){let e=[];for(;this._pendingRequests.at(0)?.kind==="steering";)e.push(this._pendingRequests.shift());return e.length>0&&this._onDidChangePendingRequests.fire(),e}clearPendingRequests(){this._pendingRequests.length>0&&(this._pendingRequests.length=0,this._onDidChangePendingRequests.fire())}get sessionId(){return this._sessionId}get sessionResource(){return this._sessionResource}get hasRequests(){return this._requests.length>0}get lastRequest(){return this._requests.at(-1)}get timestamp(){return this._timestamp}get timing(){let e=this._requests.at(-1),t=e?.response,o=e?.timestamp,n=t?.completedAt??t?.timestamp;return{created:this._timestamp,lastRequestStarted:o,lastRequestEnded:n}}get lastMessageDate(){return this._requests.at(-1)?.timestamp??this._timestamp}get _defaultAgent(){return this.chatAgentService.getDefaultAgent("panel","ask")}get responderUsername(){return this._defaultAgent?.fullName??this._initialResponderUsername??""}get isImported(){return this._isImported}get customTitle(){return this._customTitle}get title(){return this._customTitle||Eb.getDefaultTitle(this._requests)}get hasCustomTitle(){return this._customTitle!==void 0}get editingSession(){return this._editingSession}get initialLocation(){return this._initialLocation}get canUseTools(){return this._canUseTools}get willKeepAlive(){return!this._disableBackgroundKeepAlive}startEditingSession(e,t){let o=this._editingSession??=this._register(t?this.chatEditingService.transferEditingSession(this,t):e?this.chatEditingService.startOrContinueGlobalEditingSession(this):this.chatEditingService.createEditingSession(this));if(!this._disableBackgroundKeepAlive){let n=this._register(new me);this._register(he(r=>{let s=o.entries.read(r).some(l=>l.state.read(r)===0);s&&!n.value?n.value=this.chatService.acquireExistingSession(this._sessionResource):!s&&n.value&&n.clear()}))}this._register(he(n=>{this._setDisabledRequests(o.requestDisablement.read(n))}))}notifyEditingAction(e){let t=e.outcome==="accepted"?1:e.outcome==="rejected"?2:e.outcome==="userModified"?3:null;t!==null&&(!this.currentEditedFileEvents.has(e.uri)||this.currentEditedFileEvents.get(e.uri)?.eventKind===1)&&this.currentEditedFileEvents.set(e.uri,{eventKind:t,uri:e.uri})}_deserialize(e){let t=Wo(e,{serializer:!0})?e.value.requests:e.requests;if(!Array.isArray(t))return this.logService.error(`Ignoring malformed session data: ${JSON.stringify(e)}`),[];try{return t.map(o=>this._deserializeRequest(o))}catch(o){return this.logService.error("Failed to parse chat data",o),[]}}_deserializeRequest(e){let t=typeof e.message=="string"?this.getParsedRequestFromString(e.message):EYi(e.message),o=this.reviveVariableData(e.variableData),n=new yB({session:this,message:t,variableData:o,timestamp:e.timestamp??-1,restoredId:e.requestId,confirmation:e.confirmation,editedFileEvents:e.editedFileEvents,modelId:e.modelId});if(n.shouldBeRemovedOnSend=e.isHidden?{requestId:e.requestId}:e.shouldBeRemovedOnSend,e.response||e.result||e.responseErrorDetails){let r=e.agent&&"metadata"in e.agent?pTt(e.agent):void 0,s="responseErrorDetails"in e?{errorDetails:e.responseErrorDetails}:e.result,l=e.modelState||{value:e.isCanceled?2:1,completedAt:Date.now()};if((l.value===0||l.value===4)&&(l={value:2,completedAt:Date.now()}),e.response)for(let c of e.response)Wo(c,{kind:!0})&&c.kind==="questionCarousel"&&(c.isUsed=!0);n.response=new CMe({responseContent:e.response??[new xe(e.response)],session:this,agent:r,slashCommand:e.slashCommand,requestId:n.id,modelState:l,vote:e.vote,timestamp:e.timestamp,voteDownReason:e.voteDownReason,result:s,followups:e.followups,restoredId:e.responseId,timeSpentWaiting:e.timeSpentWaiting,shouldBeBlocked:n.shouldBeBlocked.get(),codeBlockInfos:e.responseMarkdownInfo?.map(c=>({suggestionId:c.suggestionId}))}),n.response.shouldBeRemovedOnSend=e.isHidden?{requestId:e.requestId}:e.shouldBeRemovedOnSend,e.usedContext&&n.response.applyReference(Xn(e.usedContext)),e.contentReferences?.forEach(c=>n.response.applyReference(Xn(c))),e.codeCitations?.forEach(c=>n.response.applyCodeCitation(Xn(c)))}return n}reviveVariableData(e){let t=e&&Array.isArray(e.variables)?e:{variables:[]};return t.variables=t.variables.map(uV.fromExport),t}getParsedRequestFromString(e){let t=[new pb(new di(0,e.length),{startColumn:1,startLineNumber:1,endColumn:1,endLineNumber:1},e)];return{text:e,parts:t}}_deserializePendingRequests(e){try{return e.map(t=>({id:t.id,request:this._deserializeRequest(t.request),kind:t.kind,sendOptions:{...t.sendOptions,userSelectedTools:t.sendOptions.userSelectedTools?Oo(t.sendOptions.userSelectedTools):void 0}}))}catch(t){return this.logService.error("Failed to parse pending chat requests",t),[]}}getRequests(){return this._requests}resetCheckpoint(){for(let e of this._requests)e.setShouldBeBlocked(!1),e.response&&e.response.setBlockedState(!1)}setCheckpoint(e){let t,o=-1;if(!(e!==void 0&&(this._requests.forEach((n,r)=>{n.id===e&&(o=r,t=n,n.setShouldBeBlocked(!0))}),!t))){for(let n=this._requests.length-1;n>=0;n-=1){let r=this._requests[n];this._checkpoint&&!t?(r.setShouldBeBlocked(!1),r.response&&r.response.setBlockedState(!1)):t&&n>=o?(r.setShouldBeBlocked(!0),r.response&&r.response.setBlockedState(!0)):t&&n<o&&(r.setShouldBeBlocked(!1),r.response&&r.response.setBlockedState(!1))}this._checkpoint=t}}get checkpoint(){return this._checkpoint}_setDisabledRequests(e){this._requests.forEach(t=>{let o=e.find(n=>n.requestId===t.id);t.shouldBeRemovedOnSend=o,t.response&&(t.response.shouldBeRemovedOnSend=o)}),this._onDidChange.fire({kind:"setHidden"})}addRequest(e,t,o,n,r,s,l,c,u,p,h,g,f){let v=[...this.currentEditedFileEvents.values()];this.currentEditedFileEvents.clear();let b=new yB({restoredId:f,session:this,message:e,variableData:t,timestamp:Date.now(),attempt:o,modeInfo:n,confirmation:l,locationData:c,attachedContext:u,isCompleteAddedRequest:p,modelId:h,editedFileEvents:v.length?v:void 0,userSelectedTools:g});return b.response=new CMe({responseContent:[],session:this,agent:r,slashCommand:s,requestId:b.id,isCompleteAddedRequest:p,codeBlockInfos:void 0}),this._requests.push(b),this._onDidChange.fire({kind:"addRequest",request:b}),b}setCustomTitle(e){this._customTitle=e,this._onDidChange.fire({kind:"setCustomTitle",title:e})}updateRequest(e,t){e.variableData=t,this._onDidChange.fire({kind:"changedRequest",request:e})}adoptRequest(e){let t=e.session,o=t._requests.findIndex(n=>n.id===e.id);o!==-1&&(t._requests.splice(o,1),e.adoptTo(this),e.response?.adoptTo(this),this._requests.push(e),t._onDidChange.fire({kind:"removeRequest",requestId:e.id,responseId:e.response?.id,reason:2}),this._onDidChange.fire({kind:"addRequest",request:e}))}acceptResponseProgress(e,t,o){if(e.response||(e.response=new CMe({responseContent:[],session:this,requestId:e.id,codeBlockInfos:void 0})),e.response.isComplete)throw new Error("acceptResponseProgress: Adding progress to a completed response");t.kind==="usedContext"||t.kind==="reference"?e.response.applyReference(t):t.kind==="codeCitation"?e.response.applyCodeCitation(t):t.kind==="move"?this._onDidChange.fire({kind:"move",target:t.uri,range:t.range}):t.kind==="codeblockUri"&&t.isEdit?(e.response.addUndoStop({id:t.undoStopId??_t(),kind:"undoStop"}),e.response.updateContent(t,o)):t.kind==="progressTaskResult"?this.logService.error(`Couldn't handle progress: ${JSON.stringify(t)}`):e.response.updateContent(t,o)}removeRequest(e,t=0){let o=this._requests.findIndex(r=>r.id===e),n=this._requests[o];o!==-1&&(this._onDidChange.fire({kind:"removeRequest",requestId:n.id,responseId:n.response?.id,reason:t}),this._requests.splice(o,1),n.response?.dispose())}cancelRequest(e){e.response&&e.response.cancel()}setResponse(e,t){e.response||(e.response=new CMe({responseContent:[],session:this,requestId:e.id,codeBlockInfos:void 0})),e.response.setResult(t)}setFollowups(e,t){e.response&&e.response.setFollowups(t)}setResponseModel(e,t){e.response=t,this._onDidChange.fire({kind:"addResponse",response:t})}toExport(){return{responderUsername:this.responderUsername,initialLocation:this.initialLocation,requests:this._requests.map(e=>{let t={...e.message,parts:e.message.parts.map(r=>r&&"toJSON"in r?r.toJSON():r)},o=e.response?.agent,n=o&&"toJSON"in o?o.toJSON():o?{...o}:void 0;return{requestId:e.id,message:t,variableData:tdo.toExport(e.variableData),response:e.response?e.response.entireResponse.value.map(r=>r.kind==="treeData"?r.treeData:r.kind==="markdownContent"?r.content:r):void 0,shouldBeRemovedOnSend:e.shouldBeRemovedOnSend,agent:n,timestamp:e.timestamp,confirmation:e.confirmation,editedFileEvents:e.editedFileEvents,modelId:e.modelId,...e.response?.toJSON()}})}}toJSON(){return{version:3,...this.toExport(),sessionId:this.sessionId,creationDate:this._timestamp,customTitle:this._customTitle,inputState:this.inputModel.toJSON()}}dispose(){this._requests.forEach(e=>e.response?.dispose()),this._onDidDispose.fire(),super.dispose()}};Eb=I([m(2,ne),m(3,br),m(4,dl),m(5,Si)],Eb);function oCi(a,i){return{variables:a.variables.map(e=>({...e,range:e.range&&{start:e.range.start-i,endExclusive:e.range.endExclusive-i}}))}}function GVt(a,i){if(a.baseUri&&i.baseUri){if(!(a.baseUri.scheme===i.baseUri.scheme&&a.baseUri.authority===i.baseUri.authority&&a.baseUri.path===i.baseUri.path&&a.baseUri.query===i.baseUri.query&&a.baseUri.fragment===i.baseUri.fragment))return!1}else if(a.baseUri||i.baseUri)return!1;return uo(a.isTrusted,i.isTrusted)&&a.supportHtml===i.supportHtml&&a.supportThemeIcons===i.supportThemeIcons}function ZZ(a,i){let e=typeof i=="string"?i:i.value;return{value:a.value+e,isTrusted:a.isTrusted,supportThemeIcons:a.supportThemeIcons,supportHtml:a.supportHtml,baseUri:a.baseUri}}function nCi(a){if(a.length===0)return"";let i=a.reduce((t,o)=>t.add(o.license),new Set);return i.size===1?d(7620,null,i.size):d(7621,null,i.size)}function odo(a){return{modeInfo:a.modeInfo,userSelectedModelId:a.userSelectedModelId,userSelectedTools:a.userSelectedTools?.get(),location:a.location,locationData:a.locationData,attempt:a.attempt,noCommandDetection:a.noCommandDetection,agentId:a.agentId,agentIdSilent:a.agentIdSilent,slashCommand:a.slashCommand,confirmation:a.confirmation}}var wB;(t=>{t.scheme="vscode-chat-response-resource";function i(o,n,r,s){return A.from({scheme:t.scheme,authority:b$(Je.fromString(o.toString())),path:`/tool/${n}/${r}`+(s?`/${s}`:"")})}t.createUri=i;function e(o){if(o.scheme!==t.scheme)return;let n=o.path.split("/");if(n.length<5)return;let[,r,s,l]=n;if(r!=="tool")return;let c;try{c=A.parse(Fbe(o.authority).toString())}catch(u){if(u instanceof SyntaxError)c=cs.forSession(o.authority);else throw u}return{sessionResource:c,toolCallId:s,index:Number(l)}}t.parseUri=e})(wB||={});var QVt="application/vnd.code.additional-editor-data",qZe=class{constructor(i,e,t,o,n){this.chatWidgetService=i;this.extensionService=e;this.fileService=t;this.environmentService=o;this.logService=n;this.kind=new Is("chat.attach.image");this.providedPasteEditKinds=[this.kind];this.copyMimeTypes=[];this.pasteMimeTypes=["image/*"];this.imagesFolder=je(this.environmentService.workspaceStorageHome,"vscode-chat-images"),VEt(this.fileService,this.logService,this.imagesFolder)}async provideDocumentPasteEdits(i,e,t,o,n){if(!this.extensionService.extensions.some(w=>Ea(w,"chatReferenceBinaryData")))return;let r=["image/png","image/jpeg","image/jpg","image/bmp","image/gif","image/tiff"],s,l;for(let w of r)if(l=t.get(w),l){s=w;break}if(!l||!s)return;let c=await l.asFile()?.data();if(n.isCancellationRequested||!c)return;let u=this.chatWidgetService.getWidgetByInputUri(i.uri);if(!u)return;let p=u.attachmentModel.attachments,h=d(7446,null),g=h;for(let w=2;p.some(k=>k.name===g);w++)g=`${h} ${w}`;let f=await WEt(this.fileService,this.imagesFolder,c,s);if(n.isCancellationRequested||!f)return;let v=await k_(c);if(n.isCancellationRequested||!v)return;let b=await DQo(v,s,n,g,f);if(n.isCancellationRequested||!b||u.attachmentModel.getAttachmentIDs().has(b.id))return;let y=ndo(i,[b],s,this.kind,d(7445,null),this.chatWidgetService);return sCi(y)}};qZe=I([m(2,be),m(3,Co),m(4,ne)],qZe);async function DQo(a,i,e,t,o){let n=await eee(a);if(!e.isCancellationRequested)return{kind:"image",value:a,id:n,name:t,icon:M.fileMedia,mimeType:i,isPasted:!0,references:[{reference:o,kind:"reference"}]}}async function eee(a){let i=await crypto.subtle.digest("SHA-256",a);return Array.from(new Uint8Array(i)).map(t=>t.toString(16).padStart(2,"0")).join("")}function jZe(a){return a.length<4?!1:Object.values({png:[137,80,78,71,13,10,26,10],jpeg:[255,216,255],bmp:[66,77],gif:[71,73,70,56],tiff:[73,73,42,0]}).some(e=>e.every((t,o)=>a[o]===t))}var YVt=class{constructor(){this.providedPasteEditKinds=[];this.copyMimeTypes=[QVt];this.pasteMimeTypes=[]}async prepareDocumentPaste(i,e,t,o){if(i.uri.scheme===Y.vscodeChatInput)return;let n=new bx,r={range:e[0],uri:i.uri.toJSON()};return n.append(QVt,NN(JSON.stringify(r))),n}},CB=class{constructor(i){this.chatWidgetService=i;this.kind=new Is("chat.attach.attachments");this.providedPasteEditKinds=[this.kind];this.copyMimeTypes=[CB.ATTACHMENT_MIME_TYPE];this.pasteMimeTypes=[CB.ATTACHMENT_MIME_TYPE]}static{this.ATTACHMENT_MIME_TYPE="application/vnd.chat.attachment+json"}async prepareDocumentPaste(i,e,t,o){let n=this.chatWidgetService.getWidgetByInputUri(i.uri);if(!n||!n.viewModel)return;let r=n.attachmentModel.attachments,s=WO(n);if(r.length===0&&s.length===0)return;let l=new bx;return l.append(CB.ATTACHMENT_MIME_TYPE,NN(JSON.stringify({attachments:r,dynamicVariables:s}))),l}async provideDocumentPasteEdits(i,e,t,o,n){let r=this.chatWidgetService.getWidgetByInputUri(i.uri);if(!r||!r.viewModel)return;let s=r.getContrib(JS.ID);if(!s)return;let l=t.get(Zn.text),u=await t.get(CB.ATTACHMENT_MIME_TYPE)?.asString(),p=await l?.asString();if(p===void 0||u===void 0||n.isCancellationRequested)return;let h;try{h=Xn(JSON.parse(u))}catch{}if(!Array.isArray(h?.attachments)&&!Array.isArray(h?.dynamicVariables))return;let g={insertText:p,title:d(7443,null),kind:this.kind,handledMimeType:CB.ATTACHMENT_MIME_TYPE,additionalEdit:{edits:[]}};return g.additionalEdit?.edits.push({resource:i.uri,redo:()=>{r.attachmentModel.addContext(...h.attachments);for(let f of h.dynamicVariables)s?.addReference(f);r.refreshParsedInput()},undo:()=>{r.attachmentModel.delete(...h.attachments.map(f=>f.id)),r.refreshParsedInput()}}),sCi(g)}};CB=I([m(0,At)],CB);var rCi=class{constructor(i,e){this.chatWidgetService=i;this.modelService=e;this.kind=new Is("chat.attach.text");this.providedPasteEditKinds=[this.kind];this.copyMimeTypes=[];this.pasteMimeTypes=[QVt]}async provideDocumentPasteEdits(i,e,t,o,n){if(i.uri.scheme!==Y.vscodeChatInput)return;let r=t.get(Zn.text),s=t.get("vscode-editor-data"),l=t.get(QVt);if(!s||!r||!l)return;let c=await r.asString(),u=JSON.parse(await s.asString()),p=JSON.parse(await l.asString()),h=this.chatWidgetService.getWidgetByInputUri(i.uri);if(!h)return;let g=p.range.startLineNumber,f=p.range.endLineNumber;if(g===f){let y=this.modelService.getModel(A.revive(p.uri));if(!y||y.getLineContent(g)!==c)return}let v=LQo(c,A.revive(p.uri),u.mode,p.range);if(n.isCancellationRequested||!v||h.attachmentModel.getAttachmentIDs().has(v.id))return;let S=ndo(i,[v],Zn.text,this.kind,d(7444,null),this.chatWidgetService);return S.yieldTo=[{kind:Is.Empty.append("text","plain")}],sCi(S)}};function LQo(a,i,e,t){let o=Ye(i),n=t.startLineNumber,r=t.endLineNumber,s=`Copied Selection of Code:
From the file: ${o} From lines ${n} to ${r}
\`\`\`${a}\`\`\``,l=n===r?d(7442,null):d(7441,null,r+1-n);return{kind:"paste",value:s,id:`${o}${n}${r}${t.startColumn}${t.endColumn}`,name:`${o} ${l}`,icon:M.code,pastedLines:l,language:e,fileName:i.toString(),copiedFrom:{uri:i,range:t},code:a,references:[{reference:i,kind:"reference"}]}}function ndo(a,i,e,t,o,n){let r=i.length===1?i[0].name:d(7440,null,i[0].name,i.length-1),s={resource:a.uri,variable:i,undo:()=>{let l=n.getWidgetByInputUri(a.uri);if(!l)throw new Error("No widget found for undo");l.attachmentModel.delete(...i.map(c=>c.id))},redo:()=>{let l=n.getWidgetByInputUri(a.uri);if(!l)throw new Error("No widget found for redo");l.attachmentModel.addContext(...i)},metadata:{needsConfirmation:!1,label:r}};return{insertText:"",title:o,kind:t,handledMimeType:e,additionalEdit:{edits:[s]}}}function sCi(a){return{edits:[a],dispose:()=>{}}}var kMe=class extends C{constructor(i,e,t,o,n,r,s,l){super(),this._register(e.documentPasteEditProvider.register({scheme:Y.vscodeChatInput,pattern:"*",hasAccessToAllModels:!0},i.createInstance(CB))),this._register(e.documentPasteEditProvider.register({scheme:Y.vscodeChatInput,pattern:"*",hasAccessToAllModels:!0},new qZe(t,o,n,s,l))),this._register(e.documentPasteEditProvider.register({scheme:Y.vscodeChatInput,pattern:"*",hasAccessToAllModels:!0},new rCi(t,r))),this._register(e.documentPasteEditProvider.register("*",new YVt)),this._register(e.documentPasteEditProvider.register("*",new YVt))}};kMe=I([m(0,F),m(1,zt),m(2,At),m(3,lt),m(4,be),m(5,Ct),m(6,Co),m(7,ne)],kMe);var jF=ae("IChatAttachmentResolveService"),EMe=class{constructor(i,e,t,o,n){this.fileService=i;this.editorService=e;this.textModelService=t;this.extensionService=o;this.dialogService=n}async resolveEditorAttachContext(i){if(Hxe(i))return await this.resolveUntitledEditorAttachContext(i);if(!i.resource)return;let e;try{e=await this.fileService.stat(i.resource)}catch{return}if(!e.isDirectory&&!e.isFile)return;let t=await this.resolveImageEditorAttachContext(i.resource);return t?this.extensionService.extensions.some(o=>Ea(o,"chatReferenceBinaryData"))?t:void 0:await this.resolveResourceAttachContext(i.resource,e.isDirectory)}async resolveUntitledEditorAttachContext(i){if(i.resource)return await this.resolveResourceAttachContext(i.resource,!1);let e=this.editorService.editors.filter(t=>t instanceof qm);for(let t of e)if((await t.resolve()).textEditorModel?.getValue()===i.contents)return await this.resolveResourceAttachContext(t.resource,!1)}async resolveResourceAttachContext(i,e){let t=0;if(!e){let o;try{let n=await this.textModelService.createModelReference(i);o=n.object.getLanguageId(),n.dispose()}catch{t=2}if(/\.(svg)$/i.test(i.path)&&(t=2),o){let n=Mf(o);if(n==="prompt")return mP(i,"vscode.prompt.file");if(n==="instructions")return mP(i,"vscode.prompt.instructions.root")}}return{kind:e?"directory":"file",value:i,id:i.toString(),name:Ye(i),omittedState:t}}async resolveImageEditorAttachContext(i,e,t){if(!i)return;if(t){if(!X4(t))return}else{let l=rdo.exec(i.path);if(!l)return;t=MQo(l)}let o=Ye(i),n;if(e)n=e;else{let l;try{l=await this.fileService.stat(i)}catch{return}let c=await this.fileService.readFile(i);if(l.size>30*1024*1024)throw this.dialogService.error(d(5987,null),d(5988,null,o)),new Error("Image is too large");n=c.value}let r=/\.gif$/i.test(i.path);return(await this.resolveImageAttachContext([{id:i.toString(),name:o,data:n.buffer,icon:M.fileMedia,resource:i,mimeType:t,omittedState:r?1:0}]))[0]}resolveImageAttachContext(i){return Promise.all(i.map(async e=>({id:e.id||await eee(e.data),name:e.name,fullName:e.resource?e.resource.path:void 0,value:await k_(e.data,e.mimeType),icon:e.icon,kind:"image",isFile:!1,isDirectory:!1,omittedState:e.omittedState||0,references:e.resource?[{reference:e.resource,kind:"reference"}]:[]})))}resolveMarkerAttachContext(i){return i.map(e=>{let t;return"severity"in e?t=uP.fromMarker(e):t={filterUri:A.revive(e.uri),filterSeverity:4},uP.toEntry(t)})}resolveSymbolsAttachContext(i){return i.map(e=>{let t=A.file(e.fsPath);return{kind:"symbol",id:RQo(t,e.range),value:{uri:t,range:e.range},symbolKind:e.kind,icon:sh.toIcon(e.kind),fullName:e.name,name:e.name}})}resolveNotebookOutputAttachContext(i){let e=qn(this.editorService.activeEditorPane);if(!e)return[];let t=bZe(i.outputId,e);if(!t)return[];let o=t.pickedMimeType?.mimeType;if(o&&$Ze.includes(o)){let n=zVt(t,o,e);return n?[n]:[]}return[]}async resolveDirectoryImages(i){let e=[];return await this._collectDirectoryImages(i,e),e}async _collectDirectoryImages(i,e){let t;try{t=await this.fileService.resolve(i)}catch{return}if(!t.children)return;let o=[];for(let n of t.children)n.isDirectory&&!n.isSymbolicLink?o.push(this._collectDirectoryImages(n.resource,e)):n.isFile&&!n.isSymbolicLink&&rdo.test(n.resource.path)&&o.push(this.resolveImageEditorAttachContext(n.resource).then(r=>{r&&e.push(r)}).catch(()=>{}));await Promise.all(o)}resolveSourceControlHistoryItemAttachContext(i){return i.map(e=>({id:e.historyItem.id,name:e.name,value:A.revive(e.resource),historyItem:{...e.historyItem,references:[]},kind:"scmHistoryItem"}))}};EMe=I([m(0,be),m(1,ee),m(2,Nt),m(3,lt),m(4,ct)],EMe);function RQo(a,i){let e="";return i&&(e=`:${i.startLineNumber}`,i.startLineNumber!==i.endLineNumber&&(e+=`-${i.endLineNumber}`)),a.fsPath+e}var rdo=new RegExp(`\\.(${Object.keys($Vt).join("|")})$`,"i");function MQo(a){let i=a[1].toLowerCase();return $Vt[i]}var{basename:tee,dirname:lCi}=Lo,YZe=".prompt.md",XZe=".instructions.md",o2=".chatmode.md",iee=".agent.md",J4="SKILL.md",sdo="AGENTS.md",JVt="CLAUDE.md",ado="CLAUDE.local.md",cCi=".claude",ZVt="copilot-instructions.md",JZe=".github/prompts",dCi=".github/instructions",eBt=".github/chatmodes",n2=".github/agents",i2=".claude/agents",tBt="~/.copilot/agents",aCi=".claude/rules",ldo=".github/hooks";var ZZe=[{path:".github/skills",source:"github-workspace",storage:"local"},{path:".agents/skills",source:"agents-workspace",storage:"local"},{path:".claude/skills",source:"claude-workspace",storage:"local"},{path:"~/.copilot/skills",source:"copilot-personal",storage:"user"},{path:"~/.agents/skills",source:"agents-personal",storage:"user"},{path:"~/.claude/skills",source:"claude-personal",storage:"user"}],iBt=[{path:dCi,source:"github-workspace",storage:"local"},{path:aCi,source:"claude-workspace",storage:"local"},{path:"~/.copilot/instructions",source:"copilot-personal",storage:"user"},{path:"~/"+aCi,source:"claude-personal",storage:"user"}],PQo=[{path:JZe,source:"github-workspace",storage:"local"}],AQo=[{path:n2,source:"github-workspace",storage:"local"},{path:i2,source:"claude-workspace",storage:"local"},{path:"~/"+i2,source:"claude-personal",storage:"user"},{path:tBt,source:"copilot-personal",storage:"user"}],eet=[{path:".github/hooks",source:"github-workspace",storage:"local"},{path:".claude/settings.local.json",source:"claude-workspace-local",storage:"local"},{path:".claude/settings.json",source:"claude-workspace",storage:"local"},{path:"~/.claude/settings.json",source:"claude-personal",storage:"user"}];function cdo(a){let i=lCi(a.path);return i.endsWith("/"+n2)||i.endsWith("/"+i2)||NQo(a)}function oBt(a){return lCi(a.path).endsWith("/"+i2)}function NQo(a){return lCi(a.path).endsWith(tBt.substring(1))}function oee(a){return a.path.includes("/"+aCi+"/")}function TMe(a){let i=tee(a.path);if(i.endsWith(YZe))return"prompt";if(i.endsWith(XZe)||i===ZVt)return"instructions";if(i.endsWith(o2)||i.endsWith(iee))return"agent";if(i.toLowerCase()===J4.toLowerCase())return"skill";if(i.endsWith(".md")&&i!=="README.md"&&cdo(a))return"agent";if(i.endsWith(".md")&&i!=="README.md"&&oee(a))return"instructions";if(i.toLowerCase().endsWith(".json"))return"hook"}function uCi(a){return TMe(a)!==void 0}function nBt(a){switch(a){case"instructions":return XZe;case"prompt":return YZe;case"agent":return iee;case"skill":return J4;case"hook":return".json";default:throw new Error("Unknown prompt type")}}function lme(a){switch(a){case"instructions":return iBt;case"prompt":return PQo;case"agent":return AQo;case"skill":return ZZe;case"hook":return eet;default:throw new Error("Unknown prompt type")}}function Tb(a){let i=tee(a.path),e=[YZe,XZe,o2,iee];for(let t of e)if(i.endsWith(t))return tee(a.path,t);return i===ZVt||i.toLowerCase()===J4.toLowerCase()||i.endsWith(".md")&&i!=="README.md"&&cdo(a)||i.endsWith(".md")&&i!=="README.md"&&oee(a)?tee(a.path,".md"):tee(a.path)}function ddo(a,i=[],e={}){let o=new pCi(a).scan();return new mCi(o,a,i,e).parse()}function uI(a,i,e,t){return{type:a,startOffset:i,endOffset:e,rawValue:t?.rawValue??"",value:t?.value??"",format:t?.format??"none",indent:t?.indent??0}}var pCi=class{constructor(i){this.input=i;this.pos=0;this.tokens=[];this.flowDepth=0;this.seenBlockColon=!1}scan(){for(;this.pos<this.input.length;)this.scanLine();return this.tokens.push(uI(13,this.pos,this.pos)),this.tokens}scanLine(){if(this.seenBlockColon=!1,this.peekChar()===`
`){this.tokens.push(uI(8,this.pos,this.pos+1)),this.pos++;return}if(this.peekChar()==="\r"){let t=this.pos+(this.input[this.pos+1]===`
`?2:1);this.tokens.push(uI(8,this.pos,t)),this.pos=t;return}let i=this.pos,e=0;for(;this.pos<this.input.length&&(this.input[this.pos]===" "||this.input[this.pos]===" ");)e++,this.pos++;if(e>0&&this.tokens.push(uI(9,i,this.pos,{indent:e})),this.pos>=this.input.length||this.peekChar()===`
`||this.peekChar()==="\r"){if(this.pos<this.input.length){let t=this.pos,o=this.peekChar()==="\r"&&this.input[this.pos+1]===`
`?this.pos+2:this.pos+1;this.tokens.push(uI(8,t,o)),this.pos=o}return}if(e===0&&this.input.length-this.pos>=3){let t=this.input[this.pos],o=this.input[this.pos+1],n=this.input[this.pos+2],r=this.input[this.pos+3],s=r===void 0||r===" "||r===" "||r===`
`||r==="\r";if(t==="-"&&o==="-"&&n==="-"&&s){this.tokens.push(uI(11,this.pos,this.pos+3)),this.pos+=3,this.scanLineContent(),this.scanNewline();return}if(t==="."&&o==="."&&n==="."&&s){this.tokens.push(uI(12,this.pos,this.pos+3)),this.pos+=3,this.scanLineContent(),this.scanNewline();return}}if(this.peekChar()==="#"){this.scanComment(),this.scanNewline();return}if(this.peekChar()==="%"){for(;this.pos<this.input.length&&this.input[this.pos]!==`
`&&this.input[this.pos]!=="\r";)this.pos++;this.scanNewline();return}this.scanLineContent(),this.scanNewline()}scanLineContent(){for(;this.pos<this.input.length&&this.peekChar()!==`
`&&this.peekChar()!=="\r"&&(this.skipInlineWhitespace(),!(this.pos>=this.input.length||this.peekChar()===`
`||this.peekChar()==="\r"));){let i=this.peekChar();if(i==="#"){this.scanComment();break}else if(i==="{")this.flowDepth++,this.tokens.push(uI(4,this.pos,this.pos+1)),this.pos++;else if(i==="}"&&this.flowDepth>0)this.flowDepth--,this.tokens.push(uI(5,this.pos,this.pos+1)),this.pos++;else if(i==="[")this.flowDepth++,this.tokens.push(uI(6,this.pos,this.pos+1)),this.pos++;else if(i==="]"&&this.flowDepth>0)this.flowDepth--,this.tokens.push(uI(7,this.pos,this.pos+1)),this.pos++;else if(i===","&&this.flowDepth>0)this.tokens.push(uI(3,this.pos,this.pos+1)),this.pos++;else if(i==="-"&&this.isBlockDash())this.tokens.push(uI(2,this.pos,this.pos+1)),this.pos++;else if(i===":"&&this.isBlockColon())this.tokens.push(uI(1,this.pos,this.pos+1)),this.pos++,this.flowDepth===0&&(this.seenBlockColon=!0);else if(i===":"&&this.flowDepth>0&&this.lastTokenIsJsonLike())this.tokens.push(uI(1,this.pos,this.pos+1)),this.pos++;else if(i==="'"||i==='"')this.scanQuotedScalar(i);else if((i==="|"||i===">")&&this.flowDepth===0&&this.isBlockScalarStart()){this.scanBlockScalar(i);break}else this.scanUnquotedScalar()}}isBlockDash(){let i=this.input[this.pos+1];return i===void 0||i===" "||i===" "||i===`
`||i==="\r"}isBlockColon(){if(this.seenBlockColon&&this.flowDepth===0)return!1;let i=this.input[this.pos+1];return i===void 0||i===" "||i===" "||i===`
`||i==="\r"||this.flowDepth>0&&(i===","||i==="}"||i==="]")}lastTokenIsJsonLike(){for(let i=this.tokens.length-1;i>=0;i--){let e=this.tokens[i];if(!(e.type===8||e.type===9||e.type===10))return e.type===0&&e.format!=="none"||e.type===5||e.type===7}return!1}scanQuotedScalar(i){let e=this.pos;this.pos++;let t="",o=0;for(;this.pos<this.input.length;){let r=this.input[this.pos];if(r===i){if(i==="'"&&this.input[this.pos+1]==="'"){t+="'",this.pos+=2,o=0;continue}this.pos++;let s=this.input.substring(e,this.pos);this.tokens.push(uI(0,e,this.pos,{rawValue:s,value:t,format:i==="'"?"single":"double"}));return}if(i==='"'&&r==="\\"){let s=this.input[this.pos+1];if(s===`
`||s==="\r"){this.pos++,this.consumeNewline(),this.skipInlineWhitespace(),o=0;continue}switch(s){case"n":t+=`
`;break;case"t":t+=" ";break;case"\\":t+="\\";break;case'"':t+='"';break;case"/":t+="/";break;case"r":t+="\r";break;case"0":t+="\0";break;case"a":t+="\x07";break;case"b":t+="\b";break;case"e":t+="\x1B";break;case"v":t+="\v";break;case"f":t+="\f";break;case" ":t+=" ";break;case"_":t+="\xA0";break;case"x":{let l=this.input.substring(this.pos+2,this.pos+4),c=parseInt(l,16);l.length===2&&!isNaN(c)?(t+=String.fromCharCode(c),this.pos+=4):(t+="\\x",this.pos+=2),o=0;continue}case"u":{let l=this.input.substring(this.pos+2,this.pos+6),c=parseInt(l,16);l.length===4&&!isNaN(c)?(t+=String.fromCodePoint(c),this.pos+=6):(t+="\\u",this.pos+=2),o=0;continue}case"U":{let l=this.input.substring(this.pos+2,this.pos+10),c=parseInt(l,16);l.length===8&&!isNaN(c)?(t+=String.fromCodePoint(c),this.pos+=10):(t+="\\U",this.pos+=2),o=0;continue}default:t+="\\"+(s??"");break}this.pos+=2,o=0;continue}if(r===`
`||r==="\r"){o>0&&(t=t.substring(0,t.length-o)),o=0,this.consumeNewline();let s=0;for(;this.pos<this.input.length;){this.skipInlineWhitespace();let l=this.input[this.pos];if(l===`
`||l==="\r")s++,this.consumeNewline();else break}s>0?t+=`
`.repeat(s):t+=" ";continue}r===" "||r===" "?o++:o=0,t+=r,this.pos++}let n=this.input.substring(e,this.pos);this.tokens.push(uI(0,e,this.pos,{rawValue:n,value:t,format:i==="'"?"single":"double"}))}scanUnquotedScalar(){let i=this.pos,e=this.pos;for(;this.pos<this.input.length;){let o=this.input[this.pos];if(o===`
`||o==="\r"||this.flowDepth>0&&(o===","||o==="}"||o==="]")||this.flowDepth>0&&(o==="{"||o==="[")||o===":"&&this.isBlockColon()||o==="#"&&this.pos>i&&(this.input[this.pos-1]===" "||this.input[this.pos-1]===" "))break;this.pos++,o!==" "&&o!==" "&&(e=this.pos)}let t=this.input.substring(i,e);this.tokens.push(uI(0,i,e,{rawValue:t,value:t,format:"none"}))}isBlockScalarStart(){let i=this.pos+1;for(;i<this.input.length;){let t=this.input[i];if(t>="1"&&t<="9"){i++;continue}if(t==="+"||t==="-"){i++;continue}break}for(;i<this.input.length&&(this.input[i]===" "||this.input[i]===" ");)i++;if(i>=this.input.length)return!0;let e=this.input[i];return e===`
`||e==="\r"||e==="#"}scanBlockScalar(i){let e=this.pos;this.pos++;let t=0,o="clip";for(let h=0;h<2;h++)if(this.pos<this.input.length){let g=this.input[this.pos];g>="1"&&g<="9"&&t===0?(t=parseInt(g,10),this.pos++):g==="-"&&o==="clip"?(o="strip",this.pos++):g==="+"&&o==="clip"&&(o="keep",this.pos++)}for(;this.pos<this.input.length&&(this.input[this.pos]===" "||this.input[this.pos]===" ");)this.pos++;if(this.pos<this.input.length&&this.input[this.pos]==="#")for(;this.pos<this.input.length&&this.input[this.pos]!==`
`&&this.input[this.pos]!=="\r";)this.pos++;this.consumeNewline();let n=this.getParentBlockIndent(e),r=t>0?n+t:0,s=[],l=0;for(;this.pos<this.input.length;){let h=this.pos,g=0;for(;this.pos<this.input.length&&this.input[this.pos]===" ";)g++,this.pos++;if(this.pos>=this.input.length||this.input[this.pos]===`
`||this.input[this.pos]==="\r"){if(r>0&&g>=r){let b=this.input.substring(h+r,this.pos);s.push(b),b===""?l++:l=0}else s.push(""),l++;this.consumeNewline();continue}if(g===0&&this.input.length-this.pos>=3){let b=this.input[this.pos],S=this.input[this.pos+1],y=this.input[this.pos+2],w=this.input[this.pos+3],k=w===void 0||w===" "||w===" "||w===`
`||w==="\r";if(b==="-"&&S==="-"&&y==="-"&&k||b==="."&&S==="."&&y==="."&&k){this.pos=h;break}}if(r===0){if(g<=n){this.pos=h;break}r=g}if(g<r){this.pos=h;break}let f=h+r;for(;this.pos<this.input.length&&this.input[this.pos]!==`
`&&this.input[this.pos]!=="\r";)this.pos++;let v=this.input.substring(f,this.pos);s.push(v),l=0,this.consumeNewline()}let c;if(i==="|")c=s.join(`
`);else{c="";let h=!1,g=!1,f=!1;for(let v=0;v<s.length;v++){let b=s[v],S=b.length>0&&(b[0]===" "||b[0]===" ");b===""?(c+=`
`,g=!0):v===0?(c=b,h=S,f=!0):g?((h||S)&&f?c+=`
`+b:c+=b,h=S,g=!1,f=!0):S||h?(c+=`
`+b,h=S,f=!0):(c+=" "+b,h=!1,f=!0)}}if(l>0){let h=c.length;for(;h>0&&c[h-1]===`
`;)h--;c=c.substring(0,h)}let u=s.some(h=>h!=="");switch(o){case"clip":u&&(c+=`
`);break;case"keep":u?c+=`
`.repeat(l+1):c=`
`.repeat(l);break;case"strip":break}let p=this.input.substring(e,this.pos);this.tokens.push(uI(0,e,this.pos,{rawValue:p,value:c,format:i==="|"?"literal":"folded"}))}getParentBlockIndent(i){for(let e=this.tokens.length-1;e>=0;e--){let t=this.tokens[e];if(!(t.type===8||t.type===10||t.type===9)){if(t.type===1){for(let o=e-1;o>=0;o--){let n=this.tokens[o];if(!(n.type===8||n.type===10||n.type===9))return this.getColumnAt(n.startOffset)}return 0}if(t.type===2)return this.getColumnAt(t.startOffset);if(t.type===11)return-1;break}}return 0}getColumnAt(i){let e=0,t=i-1;for(;t>=0&&this.input[t]!==`
`&&this.input[t]!=="\r";)e++,t--;return e}scanComment(){let i=this.pos;for(;this.pos<this.input.length&&this.input[this.pos]!==`
`&&this.input[this.pos]!=="\r";)this.pos++;this.tokens.push(uI(10,i,this.pos,{rawValue:this.input.substring(i,this.pos),value:this.input.substring(i,this.pos)}))}scanNewline(){let i=this.pos;this.consumeNewline()&&this.tokens.push(uI(8,i,this.pos))}skipInlineWhitespace(){for(;this.pos<this.input.length;){let i=this.input[this.pos];if(i===" "||i===" ")this.pos++;else break}}consumeNewline(){return this.pos>=this.input.length?!1:this.input[this.pos]==="\r"&&this.input[this.pos+1]===`
`?(this.pos+=2,!0):this.input[this.pos]===`
`||this.input[this.pos]==="\r"?(this.pos++,!0):!1}peekChar(){return this.input[this.pos]}},mCi=class{constructor(i,e,t,o){this.tokens=i;this.input=e;this.errors=t;this.options=o;this.pos=0}parse(){return this.skipNewlinesAndComments(),this.currentToken().type===11&&(this.advance(),this.skipNewlinesAndComments()),this.currentToken().type===13||this.currentToken().type===12?void 0:this.parseValue(-1)}currentToken(){return this.tokens[this.pos]}peek(i=0){return this.tokens[Math.min(this.pos+i,this.tokens.length-1)]}advance(){let i=this.tokens[this.pos];return i.type!==13&&this.pos++,i}expect(i){let e=this.currentToken();return e.type===i?this.advance():e}emitError(i,e,t,o){this.errors.push({message:i,startOffset:e,endOffset:t,code:o})}skipNewlinesAndComments(){for(;this.currentToken().type===8||this.currentToken().type===10||this.currentToken().type===9&&this.isFollowedByNewlineOrComment();)this.advance()}isFollowedByNewlineOrComment(){let i=this.peek(1);return i.type===8||i.type===10||i.type===13}currentIndent(){return this.currentToken().type===9?this.currentToken().indent:0}parseValue(i){this.skipNewlinesAndComments();let e=this.currentToken(),t=e.type===9?this.peek(1):e;if(t.type===4||t.type===6)return e.type===9&&this.advance(),t.type===4?this.parseFlowMap():this.parseFlowSeq();let o=this.currentIndent();if(this.peekPastIndent().type===2)return this.parseBlockSequence(o);if(this.looksLikeMapping())return this.parseBlockMapping(o);if(e.type===0||e.type===9)return this.parseScalar(i)}peekPastIndent(){return this.currentToken().type===9?this.peek(1):this.currentToken()}looksLikeMapping(){let i=0;return this.peek(i).type===9&&i++,this.peek(i).type===0&&(i++,this.peek(i).type===1)}parseScalar(i=-1){this.currentToken().type===9&&this.advance();let e=this.expect(0);return e.format!=="none"?this.scalarFromToken(e):this.parsePlainMultiline(e,i)}parsePlainMultiline(i,e){let t=i.value,o=i.endOffset;for(;;){let n=this.pos,r=0,s=!1;for(;this.pos<this.tokens.length;){let c=this.currentToken();if(c.type===10)break;if(c.type===8){this.advance();let u=this.currentToken();if(u.type===8){r++;continue}if(u.type===9){let p=this.peek(1);if(p.type===8||p.type===13){r++,this.advance();continue}if(p.type===10)break;if(u.indent>e){s=!0;break}else break}if(u.type===13||u.type===11||u.type===12)break;if(e<0){s=!0;break}break}if(c.type===9)break;break}if(!s){this.pos=n;break}if(this.currentToken().type===9&&this.advance(),this.currentToken().type!==0){if(this.currentToken().type===2){let c=this.advance(),u="-";if(this.currentToken().type===0){let p=this.advance();u="- "+p.value,o=p.endOffset}else o=c.endOffset;r>0?t+=`
`.repeat(r):t+=" ",t+=u;continue}this.pos=n;break}if(this.peek(1).type===1){this.pos=n;break}let l=this.advance();r>0?t+=`
`.repeat(r):t+=" ",t+=l.value,o=l.endOffset}return{type:"scalar",value:t,rawValue:this.input.substring(i.startOffset,o),startOffset:i.startOffset,endOffset:o,format:"none"}}parseBlockMapping(i,e=!1){let t=this.currentToken().startOffset,o=[],n=new Set;if(e){let s=this.parseMappingEntry(i);s&&(n.add(s.key.value),o.push(s))}for(;this.currentToken().type!==13&&(this.skipNewlinesAndComments(),this.currentToken().type!==13);){let s=this.currentIndent();if(s<i)break;if(s!==i)if(s>i)this.emitError(d(150,null,i,s),this.currentToken().startOffset,this.currentToken().endOffset,"unexpected-indentation");else break;if(!this.looksLikeMapping())break;let l=this.parseMappingEntry(i);if(!l)break;!this.options.allowDuplicateKeys&&n.has(l.key.value)&&this.emitError(d(143,null,l.key.value),l.key.startOffset,l.key.endOffset,"duplicate-key"),n.add(l.key.value),o.push(l)}let r=o.length>0?o[o.length-1].value.endOffset:t;return{type:"map",properties:o,style:"block",startOffset:t,endOffset:r}}parseMappingEntry(i){this.currentToken().type===9&&this.advance();let e=this.expect(0),t=this.scalarFromToken(e),o=this.expect(1);if(o.type!==1){this.emitError(d(144,null),o.startOffset,o.endOffset,"expected-colon");return}let n=this.parseMappingValue(i,o);return{key:t,value:n}}parseMappingValue(i,e){let t=this.currentToken();if(t.type===4)return this.parseFlowMap();if(t.type===6)return this.parseFlowSeq();if(t.type===0){this.currentToken().type===9&&this.advance();let r=this.advance();return r.format!=="none"?this.scalarFromToken(r):this.parsePlainMultiline(r,i)}if(this.skipNewlinesAndComments(),this.currentToken().type===13)return this.emitError(d(149,null),e.startOffset,e.endOffset,"missing-value"),this.makeEmptyScalar(e.endOffset);let n=this.currentIndent();return n===i&&this.peekPastIndent().type===2?this.parseValue(i)??this.makeEmptyScalar(e.endOffset):n<=i?(this.emitError(d(149,null),e.startOffset,e.endOffset,"missing-value"),this.makeEmptyScalar(e.endOffset)):this.parseValue(i)??this.makeEmptyScalar(e.endOffset)}parseBlockSequence(i){let e=[],t=this.currentToken().startOffset,o=t,n=!0;for(;this.currentToken().type!==13&&(this.skipNewlinesAndComments(),this.currentToken().type!==13);){let r;if(n&&this.currentToken().type===2?r=this.currentToken().startOffset-this.getLineStart(this.currentToken().startOffset):r=this.currentIndent(),n=!1,r<i)break;if(r!==i)if(r>i)this.emitError(d(150,null,i,r),this.currentToken().startOffset,this.currentToken().endOffset,"unexpected-indentation");else break;if(this.peekPastIndent().type!==2)break;this.currentToken().type===9&&this.advance();let l=this.advance(),c=this.parseSequenceItemValue(i,l);e.push(c),o=c.endOffset}return{type:"sequence",items:e,style:"block",startOffset:t,endOffset:o}}parseSequenceItemValue(i,e){let t=this.currentToken();if(t.type===10&&this.advance(),t.type===4)return this.parseFlowMap();if(t.type===6)return this.parseFlowSeq();if(t.type===2){let n=t.startOffset-this.getLineStart(t.startOffset);return this.parseBlockSequence(n)}if(t.type===0){if(this.peek(1).type===1){let n=t.startOffset-this.getLineStart(t.startOffset);return this.parseBlockMapping(n,!0)}return this.parseScalar(i)}return this.skipNewlinesAndComments(),this.currentToken().type===13?(this.emitError(d(148,null),e.startOffset,e.endOffset,"missing-value"),this.makeEmptyScalar(e.endOffset)):this.currentIndent()<=i?(this.emitError(d(148,null),e.startOffset,e.endOffset,"missing-value"),this.makeEmptyScalar(e.endOffset)):this.parseValue(i)??this.makeEmptyScalar(e.endOffset)}getLineStart(i){let e=i-1;for(;e>=0&&this.input[e]!==`
`&&this.input[e]!=="\r";)e--;return e+1}parseFlowMap(){let i=this.advance(),e=[];for(this.skipFlowWhitespace();this.currentToken().type!==5&&this.currentToken().type!==13;){let o;if(this.currentToken().type===0)o=this.parseFlowScalar();else{this.emitError(d(147,null),this.currentToken().startOffset,this.currentToken().endOffset,"expected-key");break}this.skipFlowWhitespace();let n;this.currentToken().type===1?(this.advance(),this.skipFlowWhitespace(),n=this.parseFlowValue()):n=this.makeEmptyScalar(o.endOffset),e.push({key:o,value:n}),this.skipFlowWhitespace(),this.currentToken().type===3&&(this.advance(),this.skipFlowWhitespace())}let t=this.currentToken();return t.type===5?this.advance():this.emitError(d(145,null),t.startOffset,t.endOffset,"expected-flow-map-end"),{type:"map",properties:e,style:"flow",startOffset:i.startOffset,endOffset:t.type===5?t.endOffset:t.startOffset}}parseFlowSeq(){let i=this.advance(),e=[];for(this.skipFlowWhitespace();this.currentToken().type!==7&&this.currentToken().type!==13;){let o;if(this.currentToken().type===4)o=this.parseFlowMap();else if(this.currentToken().type===6)o=this.parseFlowSeq();else if(this.currentToken().type===0)o=this.parseFlowScalar();else{this.emitError(d(151,null),this.currentToken().startOffset,this.currentToken().endOffset,"unexpected-token"),this.advance();continue}e.push(o),this.skipFlowWhitespace(),this.currentToken().type===3&&(this.advance(),this.skipFlowWhitespace())}let t=this.currentToken();return t.type===7?this.advance():this.emitError(d(146,null),t.startOffset,t.endOffset,"expected-flow-seq-end"),{type:"sequence",items:e,style:"flow",startOffset:i.startOffset,endOffset:t.type===7?t.endOffset:t.startOffset}}parseFlowScalar(){let i=this.advance();if(i.format!=="none")return this.scalarFromToken(i);let e=i.value,t=i.endOffset;for(;;){let o=!1,n=this.pos;for(;n<this.tokens.length;){let s=this.tokens[n];if(s.type===8)o=!0,n++;else if(s.type===9||s.type===10)n++;else break}if(!o||n>=this.tokens.length)break;let r=this.tokens[n];if(r.type===0&&r.format==="none")this.pos=n+1,e+=" "+r.value,t=r.endOffset;else break}return{type:"scalar",value:e,rawValue:this.input.substring(i.startOffset,t),startOffset:i.startOffset,endOffset:t,format:"none"}}parseFlowValue(){return this.currentToken().type===4?this.parseFlowMap():this.currentToken().type===6?this.parseFlowSeq():this.currentToken().type===0?this.parseFlowScalar():this.makeEmptyScalar(this.currentToken().startOffset)}skipFlowWhitespace(){for(;;){let i=this.currentToken().type;if(i===8||i===9||i===10)this.advance();else break}}scalarFromToken(i){return{type:"scalar",value:i.value,rawValue:i.rawValue,startOffset:i.startOffset,endOffset:i.endOffset,format:i.format}}makeEmptyScalar(i){return{type:"scalar",value:"",rawValue:"",startOffset:i,endOffset:i,format:"none"}}};var tet=class{constructor(){}parse(i,e){let t=a1i(e);if(t.length===0)return new rBt(i,void 0,void 0);let o,n,r=0;if(t[0].match(/^---[\s\r\n]*$/)){let s=t.findIndex((c,u)=>u>0&&c.match(/^---[\s\r\n]*$/));s===-1?(s=t.length,r=t.length):r=s+1;let l=new z(2,1,s+1,1);o=new gCi(l,i,t)}if(r<t.length){let s=new z(r+1,1,t.length+1,1);n=new fCi(s,t,i)}return new rBt(i,o,n)}},rBt=class{constructor(i,e,t){this.uri=i;this.header=e;this.body=t}},Hi;(N=>(N.name="name",N.description="description",N.agent="agent",N.mode="mode",N.model="model",N.applyTo="applyTo",N.paths="paths",N.tools="tools",N.handOffs="handoffs",N.advancedOptions="advancedOptions",N.argumentHint="argument-hint",N.excludeAgent="excludeAgent",N.target="target",N.infer="infer",N.license="license",N.compatibility="compatibility",N.metadata="metadata",N.agents="agents",N.userInvokable="user-invokable",N.userInvocable="user-invocable",N.disableModelInvocation="disable-model-invocation",N.hooks="hooks"))(Hi||={});var gCi=class{constructor(i,e,t){this.range=i;this.uri=e;this.linesWithEOL=t}get _parsedHeader(){if(this._parsed===void 0){let i=[],e=this.linesWithEOL.slice(this.range.startLineNumber-1,this.range.endLineNumber-1).join(""),t=ddo(e,i),o=new AM(e),n=({startOffset:c,endOffset:u})=>{let p=o.getPosition(c),h=o.getPosition(u),g=this.range.startLineNumber-1;return new z(p.lineNumber+g,p.column,h.lineNumber+g,h.column)},r=c=>{switch(c.type){case"scalar":return{type:"scalar",value:c.value,range:n(c),format:c.format};case"sequence":return{type:"sequence",items:c.items.map(u=>r(u)),range:n(c)};case"map":return{type:"map",properties:c.properties.map(p=>({key:r(p.key),value:r(p.value)})),range:n(c)}}},s=[],l=i.map(c=>({message:c.message,range:n(c),code:c.code}));if(t)if(t.type!=="map")l.push({message:"Invalid header, expecting <key: value> pairs",range:this.range,code:"INVALID_YAML"});else for(let c of t.properties)s.push({key:c.key.value,range:n({startOffset:c.key.startOffset,endOffset:c.value.endOffset}),value:r(c.value)});this._parsed={node:t,attributes:s,errors:l}}return this._parsed}get attributes(){return this._parsedHeader.attributes}getAttribute(i){return this._parsedHeader.attributes.find(e=>e.key===i)}get errors(){return this._parsedHeader.errors}getStringAttribute(i){let e=this._parsedHeader.attributes.find(t=>t.key===i);if(e?.value.type==="scalar")return e.value.value}get name(){return this.getStringAttribute(Hi.name)}get description(){return this.getStringAttribute(Hi.description)}get agent(){return this.getStringAttribute(Hi.agent)??this.getStringAttribute(Hi.mode)}get model(){return this.getStringOrStringArrayAttribute(Hi.model)}get applyTo(){return this.getStringAttribute(Hi.applyTo)}get paths(){return this.getStringOrStringArrayAttribute(Hi.paths)}get argumentHint(){return this.getStringAttribute(Hi.argumentHint)}get target(){return this.getStringAttribute(Hi.target)}get infer(){return this.getBooleanAttribute(Hi.infer)}get tools(){let i=this._parsedHeader.attributes.find(t=>t.key===Hi.tools);if(!i)return;let e=i.value;if(e.type==="scalar"&&(e=xB(e)),e.type==="sequence"){let t=[];for(let o of e.items)o.type==="scalar"&&o.value&&t.push(o.value);return t}}get handOffs(){let i=this._parsedHeader.attributes.find(e=>e.key===Hi.handOffs);if(i&&i.value.type==="sequence"){let e=[];for(let t of i.value.items)if(t.type==="map"){let o,n,r,s,l,c;for(let u of t.properties)u.key.value==="agent"&&u.value.type==="scalar"?o=u.value.value:u.key.value==="label"&&u.value.type==="scalar"?n=u.value.value:u.key.value==="prompt"&&u.value.type==="scalar"?r=u.value.value:u.key.value==="send"&&u.value.type==="scalar"?s=hCi(u.value):u.key.value==="showContinueOn"&&u.value.type==="scalar"?l=hCi(u.value):u.key.value==="model"&&u.value.type==="scalar"&&(c=u.value.value);if(o&&n&&r!==void 0){let u={agent:o,label:n,prompt:r,...s!==void 0?{send:s}:{},...l!==void 0?{showContinueOn:l}:{},...c!==void 0?{model:c}:{}};e.push(u)}}return e}}getStringArrayAttribute(i){let e=this._parsedHeader.attributes.find(t=>t.key===i);if(e&&e.value.type==="sequence"){let t=[];for(let o of e.value.items)o.type==="scalar"&&o.value&&t.push(o.value);return t}}getStringOrStringArrayAttribute(i){let e=this._parsedHeader.attributes.find(t=>t.key===i);if(e){if(e.value.type==="scalar")return[e.value.value];if(e.value.type==="sequence"){let t=[];for(let o of e.value.items)o.type==="scalar"&&t.push(o.value);return t}}}get agents(){return this.getStringArrayAttribute(Hi.agents)}get userInvocable(){return this.getBooleanAttribute(Hi.userInvocable)??this.getBooleanAttribute(Hi.userInvokable)}get disableModelInvocation(){return this.getBooleanAttribute(Hi.disableModelInvocation)}get hooksRaw(){let i=this._parsedHeader.attributes.find(e=>e.key===Hi.hooks);if(i?.value.type==="map")return i.value}getBooleanAttribute(i){let e=this._parsedHeader.attributes.find(t=>t.key===i);if(e?.value.type==="scalar")return hCi(e.value)}};function hCi(a){if(a.value==="true")return!0;if(a.value==="false")return!1}var fCi=class{constructor(i,e,t){this.range=i;this.linesWithEOL=e;this.uri=t}get fileReferences(){return this.getParsedBody().fileReferences}get variableReferences(){return this.getParsedBody().variableReferences}get offset(){return this.getParsedBody().bodyOffset}getParsedBody(){if(this._parsed===void 0){let i=[],e=[],t=[],o=ht.reduce(ht.slice(this.linesWithEOL,0,this.range.startLineNumber-1),(l,c)=>c.length+l,0),n=!1,r,s=0;for(let l=this.range.startLineNumber-1,c=o;l<this.range.endLineNumber-1;l++){let u=this.linesWithEOL[l],p=u.trimStart(),h=/^(?<fence>(`{3,}|~{3,}))/u.exec(p);if(h){let y=h.groups.fence,w=y[0],k=y.length,T=p.slice(y.length);if(!n){n=!0,r=w,s=k,c+=u.length;continue}if(r===w&&k>=s&&/^\s*$/.test(T)){n=!1,r=void 0,s=0,c+=u.length;continue}}if(n){c+=u.length;continue}let g=[];for(let y of u.matchAll(/`[^`]+`/g))g.push({start:y.index,end:y.index+y[0].length});let f=y=>g.some(w=>y>=w.start&&y<w.end),v=u.matchAll(/\[(.*?)\]\((.+?)\)/g);for(let y of v){if(y.index>0&&u[y.index-1]==="!"||f(y.index))continue;let w=y.index+y[0].length-1,k=y.index+y[0].length-y[2].length-1,T=new z(l+1,k+1,l+1,w+1);e.push({content:y[2],range:T,isMarkdownLink:!0}),i.push(new z(l+1,y.index+1,l+1,y.index+y[0].length+1))}let b=/#file:(?<filePath>[^\s#]+)|#tool:(?<toolName>[\w_\-\.\/]+)/gi,S=u.matchAll(b);for(let y of S){let w=y[0],k=new z(l+1,y.index+1,l+1,y.index+w.length+1);if(i.some(U=>z.areIntersectingOrTouching(U,k))||f(y.index))continue;let T=y.groups?.filePath||y.groups?.toolName;if(!T)continue;let N=y.index+w.length-T.length,O=y.index+w.length,V=new z(l+1,N+1,l+1,O+1);y.groups?.filePath?e.push({content:y.groups?.filePath,range:V,isMarkdownLink:!1}):y.groups?.toolName&&t.push({name:y.groups?.toolName,range:V,offset:c+y.index})}c+=u.length}this._parsed={fileReferences:e.sort((l,c)=>z.compareRangesUsingStarts(l.range,c.range)),variableReferences:t,bodyOffset:o}}return this._parsed}getContent(){return this.linesWithEOL.slice(this.range.startLineNumber-1,this.range.endLineNumber-1).join("")}resolveFilePath(i){try{if(i.startsWith("/"))return this.uri.with({path:i});if(i.match(/^[a-zA-Z]+:\//))return A.parse(i);{let e=ci(this.uri);return je(e,i)}}catch{return}}};function xB(a){let i=[],e=a.value,t=a.range.getStartPosition(),o=0,n=r=>r===" "||r===" ";for(;o<e.length;){for(;o<e.length&&n(e[o]);)o++;if(o>=e.length)break;let r=o,s="",l,c,u=e[o];if(u==='"'||u==="'"){let p=u;for(o++;o<e.length&&e[o]!==p;)s+=e[o],o++;l=o+1,o<e.length&&o++,c=p==='"'?"double":"single"}else{let p=o;for(;o<e.length&&e[o]!==",";)s+=e[o],o++;s=s.trimEnd(),l=p+s.length,c="none"}for(i.push({type:"scalar",value:s,range:new z(t.lineNumber,t.column+r,t.lineNumber,t.column+l),format:c});o<e.length&&n(e[o]);)o++;o<e.length&&e[o]===","&&o++}return{type:"sequence",items:i,range:a.range}}var Z4;(e=>(e.mcpServers="mcp-servers",e.github="github"))(Z4||={});var oet;(i=>i.disallowedTools="disallowedTools")(oet||={});function aBt(a){return a==="vscode"||a==="github-copilot"||a==="claude"||a==="undefined"}var cme=[{name:"true"},{name:"false"}],OQo=[{name:"vscode"},{name:"github-copilot"}],udo={[Hi.name]:{type:"scalar",description:d(7768,null)},[Hi.description]:{type:"scalar",description:d(7766,null)},[Hi.argumentHint]:{type:"scalar",description:d(7765,null)},[Hi.model]:{type:"scalar | sequence",description:d(7767,null)},[Hi.tools]:{type:"scalar | sequence",description:d(7769,null),defaults:["[]","['search', 'edit', 'web']"]},[Hi.agent]:{type:"scalar",description:d(7764,null)},[Hi.mode]:{type:"scalar",description:d(7764,null)}},pdo={[Hi.name]:{type:"scalar",description:d(7763,null)},[Hi.description]:{type:"scalar",description:d(7761,null)},[Hi.applyTo]:{type:"scalar",description:d(7760,null),defaults:["'**'","'**/*.ts, **/*.js'","'**/*.php'","'**/*.py'"]},[Hi.excludeAgent]:{type:"scalar | sequence",description:d(7762,null)}},mdo={[Hi.name]:{type:"scalar",description:d(7755,null)},[Hi.description]:{type:"scalar",description:d(7748,null)},[Hi.argumentHint]:{type:"scalar",description:d(7747,null)},[Hi.model]:{type:"scalar | sequence",description:d(7754,null)},[Hi.tools]:{type:"scalar | sequence",description:d(7757,null),defaults:["[]","[search, edit, web]"]},[Hi.handOffs]:{type:"sequence",description:d(7751,null)},[Hi.target]:{type:"scalar",description:d(7756,null),enums:OQo},[Hi.infer]:{type:"scalar",description:d(7753,null),enums:cme},[Hi.agents]:{type:"sequence",description:d(7746,null),defaults:['["*"]']},[Hi.userInvocable]:{type:"scalar",description:d(7758,null),enums:cme},[Hi.userInvokable]:{type:"scalar",description:d(7759,null),enums:cme},[Hi.disableModelInvocation]:{type:"scalar",description:d(7749,null),enums:cme},[Hi.advancedOptions]:{type:"map",description:d(7745,null)},[Z4.github]:{type:"map",description:d(7750,null)},[Hi.hooks]:{type:"map",description:d(7752,null)}},hdo={[Hi.name]:{type:"scalar",description:d(7776,null)},[Hi.description]:{type:"scalar",description:d(7772,null)},[Hi.argumentHint]:{type:"scalar",description:d(7770,null)},[Hi.userInvocable]:{type:"scalar",description:d(7777,null),enums:cme},[Hi.userInvokable]:{type:"scalar",description:d(7778,null),enums:cme},[Hi.disableModelInvocation]:{type:"scalar",description:d(7773,null),enums:cme},[Hi.license]:{type:"scalar | map",description:d(7774,null)},[Hi.compatibility]:{type:"scalar | map",description:d(7771,null)},[Hi.metadata]:{type:"map",description:d(7775,null)}},iet={prompt:Object.keys(udo),instructions:Object.keys(pdo),agent:Object.keys(mdo),skill:Object.keys(hdo),hook:[]},FQo=[Hi.name,Hi.description,Hi.tools,Hi.target,Z4.mcpServers,Z4.github,Hi.infer],WQo={prompt:iet.prompt.filter(a=>!sBt(a)),instructions:iet.instructions.filter(a=>!sBt(a)),agent:iet.agent.filter(a=>!sBt(a)),skill:iet.skill.filter(a=>!sBt(a)),hook:[]};function vCi(a,i,e){return e==="claude"?a==="instructions"?Object.keys(Sdo):Object.keys(bdo):e==="github-copilot"&&a==="agent"?FQo:i?iet[a]:WQo[a]}function sBt(a){return a===Hi.advancedOptions||a===Hi.excludeAgent||a===Hi.mode||a===Hi.infer||a===Hi.userInvokable}function _Me(a,i,e){switch(i){case"instructions":return e==="claude"?Sdo[a]:pdo[a];case"skill":return hdo[a];case"agent":return e==="claude"?bdo[a]:mdo[a];case"prompt":return udo[a];default:return}}var gdo=[{name:jp.execute,description:d(7742,null)},{name:jp.read,description:d(7743,null)},{name:jp.edit,description:d(7741,null)},{name:jp.search,description:d(7744,null)},{name:jp.agent,description:d(7740,null)}],nee=[{name:"Bash",description:d(7714,null),toolEquivalent:[jp.execute]},{name:"Edit",description:d(7715,null),toolEquivalent:["edit/editNotebook","edit/editFiles"]},{name:"Glob",description:d(7716,null),toolEquivalent:["search/fileSearch"]},{name:"Grep",description:d(7717,null),toolEquivalent:["search/textSearch"]},{name:"Read",description:d(7733,null),toolEquivalent:["read/readFile","read/getNotebookSummary"]},{name:"Write",description:d(7739,null),toolEquivalent:["edit/createDirectory","edit/createFile","edit/createJupyterNotebook"]},{name:"WebFetch",description:d(7737,null),toolEquivalent:[jp.web]},{name:"WebSearch",description:d(7738,null),toolEquivalent:[jp.web]},{name:"Task",description:d(7736,null),toolEquivalent:[jp.agent]},{name:"Skill",description:d(7734,null),toolEquivalent:[]},{name:"LSP",description:d(7720,null),toolEquivalent:[]},{name:"NotebookEdit",description:d(7725,null),toolEquivalent:["edit/editNotebook"]},{name:"AskUserQuestion",description:d(7713,null),toolEquivalent:["vscode/askQuestions"]},{name:"MCPSearch",description:d(7721,null),toolEquivalent:[]}],lBt=[{name:"sonnet",description:d(7735,null),modelEquivalent:"Claude Sonnet 4.5 (copilot)"},{name:"opus",description:d(7726,null),modelEquivalent:"Claude Opus 4.6 (copilot)"},{name:"haiku",description:d(7718,null),modelEquivalent:"Claude Haiku 4.5 (copilot)"},{name:"inherit",description:d(7719,null),modelEquivalent:void 0}];function fdo(a){let i=[];for(let e of a){let t=lBt.find(o=>o.name===e);t&&t.modelEquivalent&&i.push(t.modelEquivalent)}return i}function vdo(a){let i=[];for(let e of a){let t=nee.find(o=>o.name===e);t&&i.push(...t.toolEquivalent)}return i}var bdo={name:{type:"scalar",description:d(7707,null)},description:{type:"scalar",description:d(7701,null)},tools:{type:"sequence",description:d(7712,null),defaults:["Read, Edit, Bash"],items:nee},disallowedTools:{type:"sequence",description:d(7702,null),defaults:["Write, Edit, Bash"],items:nee},model:{type:"scalar",description:d(7706,null),defaults:["sonnet","opus","haiku","inherit"],enums:lBt},permissionMode:{type:"scalar",description:d(7708,null),defaults:["default","acceptEdits","dontAsk","bypassPermissions","plan"],enums:[{name:"default",description:d(7729,null)},{name:"acceptEdits",description:d(7727,null)},{name:"plan",description:d(7732,null)},{name:"delegate",description:d(7730,null)},{name:"dontAsk",description:d(7731,null)},{name:"bypassPermissions",description:d(7728,null)}]},skills:{type:"sequence",description:d(7711,null)},mcpServers:{type:"sequence",description:d(7704,null)},hooks:{type:"object",description:d(7703,null)},memory:{type:"scalar",description:d(7705,null),defaults:["user","project","local"],enums:[{name:"user",description:d(7724,null)},{name:"project",description:d(7723,null)},{name:"local",description:d(7722,null)}]}},Sdo={description:{type:"scalar",description:d(7709,null)},paths:{type:"sequence",description:d(7710,null)}};function ree(a){return a==="vscode"||a==="undefined"}function mD(a,i){let e=i instanceof A?i:i.uri;if(a==="agent"){if(ci(e).path.endsWith(`/${i2}`))return"claude";if(!(i instanceof A)){let o=i.target;if(o==="github-copilot"||o==="vscode")return o}return"undefined"}else if(a==="instructions"&&oee(e))return"claude";return"undefined"}var Pv=ae("chatModeService"),e3=class extends C{constructor(e,t,o,n,r,s){super();this.promptsService=e;this.chatAgentService=t;this.logService=n;this.storageService=r;this.configurationService=s;this._customModeInstances=new Map;this._onDidChangeChatModes=this._register(new E);this.onDidChangeChatModes=this._onDidChangeChatModes.event;this.hasCustomModes=ie.Modes.hasCustomChatModes.bindTo(o),this.agentModeDisabledByPolicy=ie.Modes.agentModeDisabledByPolicy.bindTo(o),this.updateAgentModePolicyContextKey(),this.loadCachedModes(),this.refreshCustomPromptModes(!0),this._register(this.promptsService.onDidChangeCustomAgents(()=>{this.refreshCustomPromptModes(!0)})),this._register(this.storageService.onWillSaveState(()=>this.saveCachedModes())),this._register(this.configurationService.onDidChangeConfiguration(c=>{c.affectsConfiguration("chat.agent.enabled")&&(this.updateAgentModePolicyContextKey(),this._onDidChangeChatModes.fire())}));let l=this.chatAgentService.hasToolsAgent;this._register(this.chatAgentService.onDidChangeAgents(()=>{l!==this.chatAgentService.hasToolsAgent&&(l=this.chatAgentService.hasToolsAgent,this._onDidChangeChatModes.fire())}))}static{this.CUSTOM_MODES_STORAGE_KEY="chat.customModes"}loadCachedModes(){try{let e=this.storageService.getObject(e3.CUSTOM_MODES_STORAGE_KEY,1);e&&this.deserializeCachedModes(e)}catch(e){this.logService.error(e,"Failed to load cached custom agents")}}deserializeCachedModes(e){if(!Array.isArray(e)){this.logService.error("Invalid cached custom modes data: expected array");return}for(let t of e)if(BQo(t)&&t.uri)try{let o=t.visibility??{userInvocable:!0,agentInvocable:t.infer!==!1};if(!o.userInvocable)continue;let n=A.revive(t.uri),r={uri:n,name:t.name,description:t.description,tools:t.customTools,model:Ae(t.model)?[t.model]:t.model,argumentHint:t.argumentHint,agentInstructions:t.modeInstructions??{content:t.body??"",toolReferences:[]},handOffs:t.handOffs,target:t.target??"undefined",visibility:o,agents:t.agents,source:zQo(t.source)??{storage:"local"}},s=new cBt(r);this._customModeInstances.set(n.toString(),s)}catch(o){this.logService.error(o,"Failed to revive cached custom agent")}this.hasCustomModes.set(this._customModeInstances.size>0)}saveCachedModes(){try{let e=Array.from(this._customModeInstances.values());this.storageService.store(e3.CUSTOM_MODES_STORAGE_KEY,e,1,1)}catch(e){this.logService.warn("Failed to save cached custom agents",e)}}async refreshCustomPromptModes(e){try{let t=await this.promptsService.getCustomAgents(ve.None),o=new Set;for(let n of t){if(!n.visibility.userInvocable)continue;let r=n.uri.toString();o.add(r);let s=this._customModeInstances.get(r);s?s.updateData(n):(s=new cBt(n),this._customModeInstances.set(r,s))}for(let[n]of this._customModeInstances.entries())o.has(n)||this._customModeInstances.delete(n);this.hasCustomModes.set(this._customModeInstances.size>0)}catch(t){this.logService.error(t,"Failed to load custom agents"),this._customModeInstances.clear(),this.hasCustomModes.set(!1)}e&&this._onDidChangeChatModes.fire()}getModes(){return{builtin:this.getBuiltinModes(),custom:this.getCustomModes()}}findModeById(e){return this.getBuiltinModes().find(t=>t.id===e)??this._customModeInstances.get(e)}findModeByName(e){return this.getBuiltinModes().find(t=>t.name.get()===e)??this.getCustomModes().find(t=>t.name.get()===e)}getBuiltinModes(){let e=[Pl.Ask];return(this.chatAgentService.hasToolsAgent||this.isAgentModeDisabledByPolicy())&&e.unshift(Pl.Agent),e.push(Pl.Edit),e}getCustomModes(){return this.chatAgentService.hasToolsAgent||this.isAgentModeDisabledByPolicy()?Array.from(this._customModeInstances.values()):[]}updateAgentModePolicyContextKey(){this.agentModeDisabledByPolicy.set(this.isAgentModeDisabledByPolicy())}isAgentModeDisabledByPolicy(){return this.configurationService.inspect("chat.agent.enabled").policyValue===!1}};e3=I([m(0,nr),m(1,br),m(2,X),m(3,ne),m(4,le),m(5,B)],e3);function BQo(a){if(typeof a!="object"||a===null)return!1;let i=a;return typeof i.id=="string"&&typeof i.name=="string"&&typeof i.kind=="string"&&(i.description===void 0||typeof i.description=="string")&&(i.customTools===void 0||Array.isArray(i.customTools))&&(i.modeInstructions===void 0||typeof i.modeInstructions=="object"&&i.modeInstructions!==null)&&(i.model===void 0||typeof i.model=="string"||Array.isArray(i.model))&&(i.argumentHint===void 0||typeof i.argumentHint=="string")&&(i.handOffs===void 0||Array.isArray(i.handOffs))&&(i.uri===void 0||typeof i.uri=="object"&&i.uri!==null)&&(i.source===void 0||HQo(i.source))&&(i.target===void 0||aBt(i.target))&&(i.visibility===void 0||IYi(i.visibility))&&(i.agents===void 0||Array.isArray(i.agents))}var cBt=class{constructor(i){this.kind="agent";this.id=i.uri.toString(),this._nameObservable=Le("name",i.name),this._descriptionObservable=Le("description",i.description),this._customToolsObservable=Le("customTools",i.tools),this._modelObservable=Le("model",i.model),this._argumentHintObservable=Le("argumentHint",i.argumentHint),this._handoffsObservable=Le("handOffs",i.handOffs),this._targetObservable=Le("target",i.target),this._visibilityObservable=Le("visibility",i.visibility),this._agentsObservable=Le("agents",i.agents),this._modeInstructions=Le("_modeInstructions",i.agentInstructions),this._uriObservable=Le("uri",i.uri),this._source=i.source}get name(){return this._nameObservable}get description(){return this._descriptionObservable}get icon(){return Oo(void 0)}get isBuiltin(){return dBt(this)}get customTools(){return this._customToolsObservable}get model(){return this._modelObservable}get argumentHint(){return this._argumentHintObservable}get modeInstructions(){return this._modeInstructions}get uri(){return this._uriObservable}get label(){return this.name}get handOffs(){return this._handoffsObservable}get source(){return this._source}get target(){return this._targetObservable}get visibility(){return this._visibilityObservable}get agents(){return this._agentsObservable}updateData(i){Ui(e=>{this._nameObservable.set(i.name,e),this._descriptionObservable.set(i.description,e),this._customToolsObservable.set(i.tools,e),this._modelObservable.set(i.model,e),this._argumentHintObservable.set(i.argumentHint,e),this._handoffsObservable.set(i.handOffs,e),this._targetObservable.set(i.target,e),this._visibilityObservable.set(i.visibility,e),this._agentsObservable.set(i.agents,e),this._modeInstructions.set(i.agentInstructions,e),this._uriObservable.set(i.uri,e),this._source=i.source})}toJSON(){return{id:this.id,name:this.name.get(),description:this.description.get(),kind:this.kind,customTools:this.customTools.get(),model:this.model.get(),argumentHint:this.argumentHint.get(),modeInstructions:this.modeInstructions.get(),uri:this.uri.get(),handOffs:this.handOffs.get(),source:UQo(this._source),target:this.target.get(),visibility:this.visibility.get(),agents:this.agents.get()}}};function HQo(a){if(typeof a!="object"||a===null)return!1;let i=a;return i.storage==="extension"?typeof i.extensionId=="string":i.storage==="plugin"?oh(i.pluginUri):i.storage==="local"||i.storage==="user"}function UQo(a){if(a)return a.storage==="extension"?{storage:"extension",extensionId:a.extensionId.value,type:a.type}:a.storage==="plugin"?{storage:"plugin",pluginUri:a.pluginUri}:{storage:a.storage}}function zQo(a){if(a)return a.storage==="extension"?{storage:"extension",extensionId:new Ei(a.extensionId),type:a.type??"contribution"}:a.storage==="plugin"?{storage:"plugin",pluginUri:A.revive(a.pluginUri)}:{storage:a.storage}}var net=class{constructor(i,e,t,o){this.kind=i;this.name=Oo(i),this.label=Oo(e),this.description=Le("description",t),this.icon=Oo(o),this.target=Oo("undefined")}get isBuiltin(){return dBt(this)}get id(){return this.kind}toJSON(){return{id:this.id,name:this.name.get(),description:this.description.get(),kind:this.kind}}},Pl;(t=>(t.Ask=new net("ask","Ask",d(7590,null),M.question),t.Edit=new net("edit","Edit",d(7591,null),M.edit),t.Agent=new net("agent","Agent",d(7589,null),M.agent)))(Pl||={});function dBt(a){return a.id===Pl.Ask.id||a.id===Pl.Edit.id||a.id===Pl.Agent.id}function t3(a){let i=a.source?.storage;return i==="local"||i==="user"?String(Ir(a.name.get())):a.name.get()}var KQo=250,GQo=500,$Qo=250,qQo=1e3,bCi=10,jQo=2,DMe=class{constructor(i){this.logService=i;let e=Date.now();this._data={totalTime:0,lastUpdateTime:e,impliedWordLoadRate:0,lastWordCount:0,firstMarkdownTime:void 0,bootstrapActive:!0,wordCountAtBootstrapExit:void 0,updatesWithNewWords:0},this._publicData={impliedWordLoadRate:0,lastWordCount:0}}get data(){return this._publicData}get internalData(){return this._data}update(i){let{totalWordCount:e}=i;if(e===this._data.lastWordCount){this.trace("Update- no new words");return}let t=Date.now(),o=e-this._data.lastWordCount,n=this._data.lastWordCount===0,r=this._data.firstMarkdownTime,s=this._data.wordCountAtBootstrapExit;typeof r!="number"&&e>0&&(r=t);let l=this._data.updatesWithNewWords+1;n&&(this._data.lastUpdateTime=t);let c=o>bCi?qQo:$Qo,u=Math.min(t-this._data.lastUpdateTime,c),p=this._data.totalTime+u,h=n&&e>bCi?GQo:KQo,g=this._data.bootstrapActive;if(g){let w=r;typeof w=="number"&&l>=jQo&&e>=bCi?(g=!1,p=Math.max(t-w,u),s=this._data.lastWordCount,this.trace("Has stable data")):p=Math.max(p,h)}let f=typeof s=="number"?Math.max(e-s,0):e,v=p,b=g?e:f,S=v>0?b/(v/1e3):0;this._data={totalTime:p,lastUpdateTime:t,impliedWordLoadRate:S,lastWordCount:e,firstMarkdownTime:r,bootstrapActive:g,wordCountAtBootstrapExit:s,updatesWithNewWords:l},this._publicData={impliedWordLoadRate:S,lastWordCount:e};let y=g?e:f;return this.trace(`Update- got ${y} words over last ${p}ms = ${S} words/s`),this._data}trace(i){this.logService.trace(`ChatStreamStatsTracker#update: ${i}`)}};DMe=I([m(0,ne)],DMe);var SCi=/(?<![a-zA-Z0-9])(?<dollars>\${1,2})(?!\.|\(["'])((?:\\.|[^\\\n])*?(?:\\.|[^\\\n\$]))\k<dollars>(?![a-zA-Z0-9])/,LMe="vscode-katex-container",ret="data-latex",QQo=new RegExp("^"+SCi.source),uBt;(n=>{let a=/^(\${1,2})\n((?:\\[^]|[^\\])+?)\n\1(?:\n|$)/;function i(r,s={}){return{extensions:[t(s,e(r,s,!1)),o(s,e(r,s,!0))]}}n.extension=i;function e(r,s,l){return c=>{let u;try{let p=r.renderToString(c.text,{...s,throwOnError:!0,displayMode:c.displayMode});u=`<span class="${LMe}" ${ret}="${hpt(c.text)}">${p}</span>`}catch{u=c.raw}return u+(l?`
`:"")}}function t(r,s){let l=QQo;return{name:"inlineKatex",level:"inline",start(c){let u,p=c;for(;p;){if(u=p.indexOf("$"),u===-1)return;if(p.substring(u).match(l))return u;p=p.substring(u+1).replace(/^\$+/,"")}},tokenizer(c,u){let p=c.match(l);if(p)return{type:"inlineKatex",raw:p[0],text:p[2].trim(),displayMode:p[1].length===2}},renderer:s}}function o(r,s){return{name:"blockKatex",level:"block",start(l){return l.match(new RegExp(a.source,"m"))?.index},tokenizer(l,c){let u=l.match(a);if(u)return{type:"blockKatex",raw:u[0],text:u[2].trim(),displayMode:u[1].length===2}},renderer:s}}})(uBt||={});var sT=String.raw,XQo=sT`(?<!\\)`+sT`(!?\[`+sT`(?:`+sT`[^\[\]\\]|`+sT`\\.|`+sT`\[[^\[\]]*\]`+sT`)*`+sT`\])`+sT`(\(\s*)`+sT`(`+sT`[^\s\(\)<](?:[^\s\(\)]|\([^\s\(\)]*?\))*|`+sT`<(?:\\[<>]|[^<>])+>`+sT`)`+sT`\s*(?:"[^"]*"|'[^']*'|\([^\(\)]*\))?\s*`+sT`\)`;function ICi(a,i){let t=new RegExp("(?:"+XQo+")|(?:"+SCi.source+sT`)|\p{sc=Han}|=+|\++|-+|[^\s\|\p{sc=Han}|=|\+|\-|${"`"}]+`,"gu"),o=Array.from(a.matchAll(t)),n=o.slice(0,i),r=i>=o.length?a.length:n.length?n.at(-1).index+n.at(-1)[0].length:0,s=a.substring(0,r);return{value:s,returnedWordCount:n.length===0?s.length?1:0:n.length,isFullString:r>=a.length,totalWordCount:o.length}}function Ido(a){return ICi(a,Number.MAX_SAFE_INTEGER).returnedWordCount}function Rr(a){return!!a&&typeof a=="object"&&"message"in a}function Vi(a){return!!a&&typeof a.setVote<"u"}function pBt(a){return!!a&&typeof a=="object"&&a.kind==="pendingDivider"}function hD(a){return Rr(a)||Vi(a)}function ydo(a){if(!Vi(a))throw new Error("Expected item to be IChatResponseViewModel")}var see=class extends C{constructor(e,t,o,n){super();this._model=e;this.codeBlockModelCollection=t;this._options=o;this.instantiationService=n;this._onDidDisposeModel=this._register(new E);this.onDidDisposeModel=this._onDidDisposeModel.event;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._items=[];this._inputPlaceholder=void 0;this._editing=void 0;e.getRequests().forEach((r,s)=>{let l=this.instantiationService.createInstance(RMe,r);this._items.push(l),r.response&&this.onAddResponse(r.response)}),this._register(e.onDidDispose(()=>this._onDidDisposeModel.fire())),this._register(e.onDidChangePendingRequests(()=>this._onDidChange.fire(null))),this._register(e.onDidChange(r=>{if(r.kind==="addRequest"){let l=this.instantiationService.createInstance(RMe,r.request);this._items.push(l),r.request.response&&this.onAddResponse(r.request.response)}else if(r.kind==="addResponse")this.onAddResponse(r.response);else if(r.kind==="removeRequest"){let l=this._items.findIndex(u=>Rr(u)&&u.id===r.requestId);l>=0&&this._items.splice(l,1);let c=r.responseId&&this._items.findIndex(u=>Vi(u)&&u.id===r.responseId);if(typeof c=="number"&&c>=0){let p=this._items.splice(c,1)[0];p instanceof i3&&p.dispose()}}let s=r.kind==="addRequest"?{kind:"addRequest"}:r.kind==="initialize"?{kind:"initialize"}:r.kind==="setHidden"?{kind:"setHidden"}:null;this._onDidChange.fire(s)}))}get inputPlaceholder(){return this._inputPlaceholder}get model(){return this._model}setInputPlaceholder(e){this._inputPlaceholder=e,this._onDidChange.fire({kind:"changePlaceholder"})}resetInputPlaceholder(){this._inputPlaceholder=void 0,this._onDidChange.fire({kind:"changePlaceholder"})}get sessionResource(){return this._model.sessionResource}onAddResponse(e){let t=this.instantiationService.createInstance(i3,e,this);this._register(t.onDidChange(()=>this._onDidChange.fire(null))),this._items.push(t)}getItems(){let e=this._items.filter(o=>!o.shouldBeRemovedOnSend||o.shouldBeRemovedOnSend.afterUndoStop);this._options?.maxVisibleItems!==void 0&&e.length>this._options.maxVisibleItems&&(e=e.slice(-this._options.maxVisibleItems));let t=this._model.getPendingRequests();if(t.length>0){let o=t.filter(r=>r.kind==="steering"),n=t.filter(r=>r.kind==="queued");if(o.length>0){e.push({kind:"pendingDivider",id:"pending-divider-steering",sessionResource:this._model.sessionResource,isComplete:!0,dividerKind:"steering",currentRenderedHeight:void 0});for(let r of o){let s=this.instantiationService.createInstance(RMe,r.request,r.kind);e.push(s)}}if(n.length>0){e.push({kind:"pendingDivider",id:"pending-divider-queued",sessionResource:this._model.sessionResource,isComplete:!0,dividerKind:"queued",currentRenderedHeight:void 0});for(let r of n){let s=this.instantiationService.createInstance(RMe,r.request,r.kind);e.push(s)}}}return e}get editing(){return this._editing}setEditing(e){this.editing&&e&&this.editing.id===e.id||(this._editing=e)}dispose(){super.dispose(),Ue(this._items.filter(e=>e instanceof i3))}};see=I([m(3,F)],see);var RMe=class{constructor(i,e){this._model=i;this._pendingKind=e}get id(){return this._model.id}get dataId(){return`${this.id}_${this._model.version+(this._model.response?.isComplete?1:0)}`}get sessionResource(){return this._model.session.sessionResource}get username(){return"User"}get avatarIcon(){return M.account}get message(){return this._model.message}get messageText(){return this.message.text}get attempt(){return this._model.attempt}get variables(){return this._model.variableData.variables}get contentReferences(){return this._model.response?.contentReferences}get confirmation(){return this._model.confirmation}get isComplete(){return this._model.response?.isComplete??!1}get isCompleteAddedRequest(){return this._model.isCompleteAddedRequest}get shouldBeRemovedOnSend(){return this._model.shouldBeRemovedOnSend}get shouldBeBlocked(){return this._model.shouldBeBlocked}get slashCommand(){return this._model.response?.slashCommand}get agentOrSlashCommandDetected(){return this._model.response?.agentOrSlashCommandDetected??!1}get modelId(){return this._model.modelId}get timestamp(){return this._model.timestamp}get pendingKind(){return this._pendingKind}},i3=class extends C{constructor(e,t,o,n){super();this._model=e;this.session=t;this.instantiationService=o;this.chatAgentNameService=n;this._modelChangeCount=0;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this.renderData=void 0;this._vulnerabilitiesListExpanded=!1;e.isComplete||(this.liveUpdateTracker=this.instantiationService.createInstance(DMe)),this._register(e.onDidChange(()=>{if(this.liveUpdateTracker){let r=Ido(e.entireResponse.getMarkdown());this.liveUpdateTracker.update({totalWordCount:r})}this._modelChangeCount++,this._onDidChange.fire()}))}get model(){return this._model}get id(){return this._model.id}get dataId(){return this._model.id+`_${this._modelChangeCount}`+(this.isLast?"_last":"")}get sessionResource(){return this._model.session.sessionResource}get username(){return this.agent?this.chatAgentNameService.getAgentNameRestriction(this.agent)?this.agent.fullName||this.agent.name:Hj(this.agent):this._model.username}get agent(){return this._model.agent}get slashCommand(){return this._model.slashCommand}get agentOrSlashCommandDetected(){return this._model.agentOrSlashCommandDetected}get response(){return this._model.response}get usedContext(){return this._model.usedContext}get contentReferences(){return this._model.contentReferences}get codeCitations(){return this._model.codeCitations}get progressMessages(){return this._model.progressMessages}get isComplete(){return this._model.isComplete}get isCanceled(){return this._model.isCanceled}get shouldBeBlocked(){return this._model.shouldBeBlocked}get shouldBeRemovedOnSend(){return this._model.shouldBeRemovedOnSend}get isCompleteAddedRequest(){return this._model.isCompleteAddedRequest}get replyFollowups(){return this._model.followups?.filter(e=>e.kind==="reply")}get result(){return this._model.result}get errorDetails(){return this.result?.errorDetails}get vote(){return this._model.vote}get voteDownReason(){return this._model.voteDownReason}get requestId(){return this._model.requestId}get isStale(){return this._model.isStale}get isLast(){return this.session.getItems().at(-1)===this}get usedReferencesExpanded(){if(typeof this._usedReferencesExpanded=="boolean")return this._usedReferencesExpanded}set usedReferencesExpanded(e){this._usedReferencesExpanded=e}get vulnerabilitiesListExpanded(){return this._vulnerabilitiesListExpanded}set vulnerabilitiesListExpanded(e){this._vulnerabilitiesListExpanded=e}get contentUpdateTimings(){return this.liveUpdateTracker?.data}setVote(e){this._modelChangeCount++,this._model.setVote(e)}setVoteDownReason(e){this._modelChangeCount++,this._model.setVoteDownReason(e)}setEditApplied(e,t){this._modelChangeCount++,this._model.setEditApplied(e,t)}};i3=I([m(2,F),m(3,mz)],i3);var set=class extends ml{constructor(e,t,o,n,r,s,l,c,u){let p=new class extends Eo{constructor(){super(e.item,e.alt?.item,{},e.hideActions,e.menuKeybinding,r,u);this.elementGetter=()=>{}}async run(...g){let f=Zu.get(t),v=f?.lightBulbState.get(),b=this.elementGetter();if(f&&v&&b){let{bottom:S,left:y}=b.getBoundingClientRect();await f.showCodeActions(v.trigger,v.actions,{x:y,y:S})}}};super(p,{draggable:!1},o,n,r,s,l,c);this._editor=t;this._lightBulbStore=this._store.add(new me);p.elementGetter=()=>this.element}render(e){super.render(e),this._updateFromLightBulb()}getTooltip(){return this._currentTitle??super.getTooltip()}_updateFromLightBulb(){let e=Zu.get(this._editor);if(!e)return;let t=new P;this._lightBulbStore.value=t,t.add(he(o=>{let n=e.lightBulbState.read(o);if(this.label){let r=n?.icon??M.lightBulb,s=q.asClassNameArray(r);this.label.className="",this.label.classList.add("codicon","action-label",...s)}this._currentTitle=n?.title,this.updateTooltip()}))}};set=I([m(2,_e),m(3,Ne),m(4,X),m(5,De),m(6,ze),m(7,Bi),m(8,ge)],set);var aet=class extends ml{constructor(i,e,t,o,n,r,s){super(i,{draggable:!1},e,t,o,n,r,s),this.options.label=!0,this.options.icon=!1,this._kbLabel=e.lookupKeybinding(i.id)?.getLabel()??void 0}updateLabel(){this.label&&Fi(this.label,this.action.label,...this._kbLabel?[_("span.inline-chat-keybinding",void 0,this._kbLabel)]:[])}};aet=I([m(1,_e),m(2,Ne),m(3,X),m(4,De),m(5,ze),m(6,Bi)],aet);var aee=class extends C{constructor(e,t,o){super();this._editor=e;this._id=`inline-chat-content-widget-${aee._idPool++}`;this._position=null;this._isVisible=!1;this._onDidRunAction=this._store.add(new E);this.onDidRunAction=this._onDidRunAction.event;this.allowEditorOverflow=!0;this.suppressMouseDown=!1;this._domNode=_(".inline-chat-content-widget");let n=this._store.add(o.createInstance(Ln,this._domNode,D.InlineChatEditorAffordance,{telemetrySource:"inlineChatEditorAffordance",hiddenItemStrategy:0,menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:()=>!0,useSeparatorsInPrimaryActions:!0},actionViewItemProvider:r=>{if(r instanceof Eo&&r.id===w1)return o.createInstance(set,r,this._editor);if(r instanceof Eo&&(r.id===XZ||r.id===Bwi||r.id==="inlineChat.fixDiagnostics"))return o.createInstance(aet,r)}}));this._store.add(n.actionRunner.onDidRun(r=>{this._onDidRunAction.fire(r.action.id),this._hide()})),this._store.add(he(r=>{let s=t.read(r);s?this._show(s):this._hide()}))}static{this._idPool=0}_show(e){e.isEmpty()?this._showAtLineStart(e.getPosition().lineNumber):this._showAtSelection(e),this._isVisible?this._editor.layoutContentWidget(this):(this._editor.addContentWidget(this),this._isVisible=!0)}_showAtSelection(e){let t=e.getPosition(),n=e.getDirection()===1?1:2;this._position={position:t,preference:[n]}}_showAtLineStart(e){let t=this._editor.getModel();if(!t)return;let o=t.getOptions().tabSize,n=this._editor.getOptions().get(59),r=t.getLineContent(e),s=eq(r,o),l=s<0?!0:n.spaceWidth*s>22,c=e;if(!l){let p=g=>{let f=t.getLineContent(g);return/^\s*$|^\s+/.test(f)},h=t.getLineCount();e>1&&p(e-1)?c=e-1:e<h&&p(e+1)&&(c=e+1)}let u=/^\S\s*$/.test(t.getLineContent(c))?2:1;this._position={position:{lineNumber:c,column:u},preference:[0]}}_hide(){this._isVisible&&(this._isVisible=!1,this._editor.removeContentWidget(this))}getId(){return this._id}getDomNode(){return this._domNode}getPosition(){return this._position}beforeRender(){let e=this._editor.getPosition(),t=e?this._editor.getLineHeightForPosition(e):this._editor.getOption(75);return this._domNode.style.setProperty("--vscode-inline-chat-affordance-height",`${t}px`),null}dispose(){this._isVisible&&this._editor.removeContentWidget(this),super.dispose()}};aee=I([m(2,F)],aee);var MMe=class extends Z1{constructor(e,t,o,n,r,s,l,c,u,p){let h=u.createMenu(D.InlineChatEditorAffordance,p),g=ui(h.onDidChange,()=>h.getActions({renderShortTitle:!1})),v=Zu.get(e.editor)?.lightBulbState,b=Ce(y=>{let w=t.read(y);if(!w)return;let k=[];for(let[,G]of g.read(y)){let $=[];for(let te of G)te instanceof Eo&&$.push({command:{id:te.item.id,title:te.label},icon:q.isThemeIcon(te.item.icon)?te.item.icon:void 0});$.length>0&&k.push($)}let T=w.getPosition(),N=new ro(T.lineNumber,T.lineNumber+1),O=new q7(void 0,"",k,void 0,void 0,void 0,!0),V=v?.read(y),U=V?V.icon:M.sparkle;return new $7(O,N,new j7(()=>{},()=>{}),void 0,{icon:U})}),S=Le({},!1);super(e,b,Oo("inactive"),Oo(0),Oo(!1),S,n,r,s,l,c);this._onDidRunAction=this._store.add(new E);this.onDidRunAction=this._onDidRunAction.event;this._store.add(h),this._store.add(this.onDidCloseWithCommand(y=>this._onDidRunAction.fire(y)))}};MMe=I([m(2,_e),m(3,tt),m(4,F),m(5,Bi),m(6,De),m(7,eC),m(8,qt),m(9,X)],MMe);var PMe=class extends C{$d;$e;$f;$g=Le(this,void 0);$h=Le(this,void 0);constructor(i,e,t,o,n,r,s,l){super(),this.$d=i,this.$e=e,this.$f=t;let c=os(this.$d),u=pr("inlineChat.affordance","off",o),p=kM(c.cursorSelection,500),h=this.$h,g=Vwi.bindTo(l);this._store.add({dispose:()=>g.reset()});let f=!1,v;this._store.add(_s(c.selections,(w,k,T)=>{f=T.every(N=>N.reason===3),(!w||w.length!==1||w[0].isEmpty()||!f)&&h.set(void 0,void 0)})),this._store.add(he(w=>{let k=p.read(w);if(!k||k.isEmpty()||!f||this.$d.getModel()?.getValueInRange(k).match(/^\s+$/)){h.set(void 0,void 0),v=void 0;return}v=_t();let T=u.read(void 0);(T==="gutter"||T==="editor")&&s.publicLog2("inlineChatAffordance/shown",{mode:T,id:v,commandId:""}),h.set(k,void 0)})),this._store.add(he(w=>{n.sentimentObs.read(w).hidden&&h.set(void 0,void 0)}));let b=Ce(w=>{Nr(this,r.onDidChangeSessions).read(w);let k=c.model.read(w);return k?r.getSessionByTextModel(k.uri)!==void 0:!1});this._store.add(he(w=>{b.read(w)&&h.set(void 0,void 0)})),this._store.add(this.$d.onContextMenu(()=>{h.set(void 0,void 0)})),this._store.add(he(w=>{c.isFocused.read(w)||h.set(void 0,void 0)})),this._store.add(he(w=>{let k=h.read(w),T=u.read(w);g.set(k!==void 0&&(T==="editor"||T==="gutter"))}));let S=this._store.add(this.$f.createInstance(MMe,c,Ce(w=>u.read(w)==="gutter"?h.read(w):void 0))),y=this.$f.createInstance(aee,this.$d,Ce(w=>u.read(w)==="editor"?h.read(w):void 0));this._store.add(y),this._store.add(H.any(y.onDidRunAction,S.onDidRunAction)(w=>{v&&s.publicLog2("inlineChatAffordance/selected",{mode:u.get(),id:v,commandId:w})})),this._store.add(he(w=>{let k=u.read(w),T=k==="editor"||k==="gutter",N=Zu.get(this.$d);N&&(N.onlyLightBulbWithEmptySelection=T)})),this._store.add(he(w=>{let k=this.$g.read(w);if(!k)return;this.$d.revealLineInCenterIfOutsideViewport(k.lineNumber,1);let N=this.$d.getDomNode().getBoundingClientRect(),O=k.rect.left-N.left;this.$e.show(k.lineNumber,O,k.above,k.placeholder)})),this._store.add(he(w=>{this.$e.position.read(w)===null&&this.$g.set(void 0,void 0)}))}dismiss(){this.$h.set(void 0,void 0)}async showMenuAtSelection(i){So(this.$d.hasModel());let e=this.$d.getSelection().getDirection(),t=this.$d.getPosition(),o=this.$d.getDomNode(),n=this.$d.getScrolledVisiblePosition(t),r=o.getBoundingClientRect(),s=r.left+n.left,l=r.top+n.top;this.$g.set({rect:new DOMRect(s,l,0,n.height),above:e===1,lineNumber:t.lineNumber,placeholder:i},void 0),await gf(this.$e.position,c=>c===null)}};PMe=I([m(2,F),m(3,B),m(4,vr),m(5,Ik),m(6,Te),m(7,X)],PMe);var Iwu=J("multiDiffEditor.headerBackground",{dark:"#262626",light:"tab.inactiveBackground",hcDark:"tab.inactiveBackground",hcLight:"tab.inactiveBackground"},d(254,null)),ywu=J("multiDiffEditor.background",qo,d(252,null)),wwu=J("multiDiffEditor.border",{dark:"sideBarSectionHeader.border",light:"#cccccc",hcDark:"sideBarSectionHeader.border",hcLight:"#cccccc"},d(253,null));var hBt=class{constructor(i,e){this.viewModel=i;this.deltaScrollVertical=e}getId(){return this.viewModel}},lee=class extends C{constructor(e,t,o,n,r){super();this._container=e;this._overflowWidgetsDomNode=t;this._workbenchUIElementFactory=o;this._instantiationService=n;this._viewModel=Le(this,void 0),this._collapsed=Ce(this,c=>this._viewModel.read(c)?.collapsed.read(c)),this._editorContentHeight=Le(this,500),this.contentHeight=Ce(this,c=>(this._collapsed.read(c)?0:this._editorContentHeight.read(c))+this._outerEditorHeight),this._modifiedContentWidth=Le(this,0),this._modifiedWidth=Le(this,0),this._originalContentWidth=Le(this,0),this._originalWidth=Le(this,0),this.maxScroll=Ce(this,c=>{let u=this._modifiedContentWidth.read(c)-this._modifiedWidth.read(c),p=this._originalContentWidth.read(c)-this._originalWidth.read(c);return u>p?{maxScroll:u,width:this._modifiedWidth.read(c)}:{maxScroll:p,width:this._originalWidth.read(c)}}),this._elements=bt("div.multiDiffEntry",[bt("div.header@header",[bt("div.header-content",[bt("div.collapse-button@collapseButton"),bt("div.file-path",[bt("div.title.modified.show-file-icons@primaryPath",[]),bt("div.status.deleted@status",["R"]),bt("div.title.original.show-file-icons@secondaryPath",[])]),bt("div.actions@actions")])]),bt("div.editorParent",[bt("div.editorContainer@editor")])]),this.editor=this._register(this._instantiationService.createInstance(Hu,this._elements.editor,{overflowWidgetsDomNode:this._overflowWidgetsDomNode,fixedOverflowWidgets:!0},{})),this.isModifedFocused=os(this.editor.getModifiedEditor()).isFocused,this.isOriginalFocused=os(this.editor.getOriginalEditor()).isFocused,this.isFocused=Ce(this,c=>this.isModifedFocused.read(c)||this.isOriginalFocused.read(c)),this._resourceLabel=this._workbenchUIElementFactory.createResourceLabel?this._register(this._workbenchUIElementFactory.createResourceLabel(this._elements.primaryPath)):void 0,this._resourceLabel2=this._workbenchUIElementFactory.createResourceLabel?this._register(this._workbenchUIElementFactory.createResourceLabel(this._elements.secondaryPath)):void 0,this._dataStore=this._register(new P),this._headerHeight=40,this._lastScrollTop=-1,this._isSettingScrollTop=!1;let s=new Mi(this._elements.collapseButton,{});this._register(he(c=>{s.element.className="",s.icon=this._collapsed.read(c)?M.chevronRight:M.chevronDown})),this._register(s.onDidClick(()=>{this._viewModel.get()?.collapsed.set(!this._collapsed.get(),void 0)})),this._register(he(c=>{this._elements.editor.style.display=this._collapsed.read(c)?"none":"block"})),this._register(this.editor.getModifiedEditor().onDidLayoutChange(c=>{let u=this.editor.getModifiedEditor().getLayoutInfo().contentWidth;this._modifiedWidth.set(u,void 0)})),this._register(this.editor.getOriginalEditor().onDidLayoutChange(c=>{let u=this.editor.getOriginalEditor().getLayoutInfo().contentWidth;this._originalWidth.set(u,void 0)})),this._register(this.editor.onDidContentSizeChange(c=>{x6(u=>{this._editorContentHeight.set(c.contentHeight,u),this._modifiedContentWidth.set(this.editor.getModifiedEditor().getContentWidth(),u),this._originalContentWidth.set(this.editor.getOriginalEditor().getContentWidth(),u)})})),this._register(this.editor.getOriginalEditor().onDidScrollChange(c=>{if(this._isSettingScrollTop||!c.scrollTopChanged||!this._data)return;let u=c.scrollTop-this._lastScrollTop;this._data.deltaScrollVertical(u)})),this._register(he(c=>{let u=this._viewModel.read(c)?.isActive.read(c);this._elements.root.classList.toggle("active",u)})),this._container.appendChild(this._elements.root),this._outerEditorHeight=this._headerHeight,this._contextKeyService=this._register(r.createScoped(this._elements.actions));let l=this._register(this._instantiationService.createChild(new Io([X,this._contextKeyService])));this._register(l.createInstance(Ln,this._elements.actions,D.MultiDiffEditorFileToolbar,{actionRunner:this._register(new cwe(()=>this._viewModel.get()?.modifiedUri??this._viewModel.get()?.originalUri)),menuOptions:{shouldForwardArgs:!0},toolbarOptions:{primaryGroup:c=>c.startsWith("navigation")},actionViewItemProvider:(c,u)=>Ca(l,c,u)}))}setScrollLeft(e){this._modifiedContentWidth.get()-this._modifiedWidth.get()>this._originalContentWidth.get()-this._originalWidth.get()?this.editor.getModifiedEditor().setScrollLeft(e):this.editor.getOriginalEditor().setScrollLeft(e)}setData(e){this._data=e;function t(n){return{...n,scrollBeyondLastLine:!1,hideUnchangedRegions:{enabled:!0},scrollbar:{vertical:"hidden",horizontal:"hidden",handleMouseWheel:!1,useShadows:!1},renderOverviewRuler:!1,fixedOverflowWidgets:!0,overviewRulerBorder:!1}}if(!e){x6(n=>{this._viewModel.set(void 0,n),this.editor.setDiffModel(null,n),this._dataStore.clear()});return}let o=e.viewModel.documentDiffItem;if(x6(n=>{this._resourceLabel?.setUri(e.viewModel.modifiedUri??e.viewModel.originalUri,{strikethrough:e.viewModel.modifiedUri===void 0});let r=!1,s=!1,l=!1,c="";e.viewModel.modifiedUri&&e.viewModel.originalUri&&e.viewModel.modifiedUri.path!==e.viewModel.originalUri.path?(c="R",r=!0):e.viewModel.modifiedUri?e.viewModel.originalUri||(c="A",l=!0):(c="D",s=!0),this._elements.status.classList.toggle("renamed",r),this._elements.status.classList.toggle("deleted",s),this._elements.status.classList.toggle("added",l),this._elements.status.innerText=c,this._resourceLabel2?.setUri(r?e.viewModel.originalUri:void 0,{strikethrough:!0}),this._dataStore.clear(),this._viewModel.set(e.viewModel,n),this.editor.setDiffModel(e.viewModel.diffEditorViewModelRef,n),this.editor.updateOptions(t(o.options??{}))}),o.onOptionsDidChange&&this._dataStore.add(o.onOptionsDidChange(()=>{this.editor.updateOptions(t(o.options??{}))})),e.viewModel.isAlive.recomputeInitiallyAndOnChange(this._dataStore,n=>{n||this.setData(void 0)}),e.viewModel.documentDiffItem.contextKeys)for(let[n,r]of Object.entries(e.viewModel.documentDiffItem.contextKeys))this._contextKeyService.createKey(n,r)}render(e,t,o,n){this._elements.root.style.visibility="visible",this._elements.root.style.top=`${e.start}px`,this._elements.root.style.height=`${e.length}px`,this._elements.root.style.width=`${t}px`,this._elements.root.style.position="absolute";let r=e.length-this._headerHeight,s=Math.max(0,Math.min(n.start-e.start,r));this._elements.header.style.transform=`translateY(${s}px)`,x6(l=>{this.editor.layout({width:t-16-2,height:e.length-this._outerEditorHeight})});try{this._isSettingScrollTop=!0,this._lastScrollTop=o,this.editor.getOriginalEditor().setScrollTop(o)}finally{this._isSettingScrollTop=!1}this._elements.header.classList.toggle("shadow",s>0||o>0),this._elements.header.classList.toggle("collapsed",s===r)}hide(){this._elements.root.style.top="-100000px",this._elements.root.style.visibility="hidden"}};lee=I([m(3,F),m(4,X)],lee);var gBt=class{constructor(i){this._create=i;this._unused=new Set;this._used=new Set;this._itemData=new Map}getUnusedObj(i){let e;if(this._unused.size===0)e=this._create(i),this._itemData.set(e,i);else{let t=[...this._unused.values()];e=t.find(o=>this._itemData.get(o).getId()===i.getId())??t[0],this._unused.delete(e),this._itemData.set(e,i),e.setData(i)}return this._used.add(e),{object:e,dispose:()=>{this._used.delete(e),this._unused.size>5?e.dispose():this._unused.add(e)}}}dispose(){for(let i of this._used)i.dispose();for(let i of this._unused)i.dispose();this._used.clear(),this._unused.clear()}};var AMe=class extends C{constructor(e,t,o,n,r,s){super();this._element=e;this._dimension=t;this._viewModel=o;this._workbenchUIElementFactory=n;this._parentContextKeyService=r;this._parentInstantiationService=s;this._scrollableElements=bt("div.scrollContent",[bt("div@content",{style:{overflow:"hidden"}}),bt("div.monaco-editor@overflowWidgetsDomNode",{})]),this._scrollable=this._register(new UT({forceIntegerValues:!1,scheduleAtNextAnimationFrame:u=>$r(Me(this._element),u),smoothScrollDuration:100})),this._scrollableElement=this._register(new AN(this._scrollableElements.root,{vertical:1,horizontal:1,useShadows:!1},this._scrollable)),this._elements=bt("div.monaco-component.multiDiffEditor",{},[bt("div",{},[this._scrollableElement.getDomNode()]),bt("div.placeholder@placeholder",{},[bt("div")])]),this._sizeObserver=this._register(new Fye(this._element,void 0)),this._objectPool=this._register(new gBt(u=>{let p=this._instantiationService.createInstance(lee,this._scrollableElements.content,this._scrollableElements.overflowWidgetsDomNode,this._workbenchUIElementFactory);return p.setData(u),p})),this.scrollTop=ui(this,this._scrollableElement.onScroll,()=>this._scrollableElement.getScrollPosition().scrollTop),this.scrollLeft=ui(this,this._scrollableElement.onScroll,()=>this._scrollableElement.getScrollPosition().scrollLeft),this._viewItemsInfo=Ce(this,u=>{let p=this._viewModel.read(u);if(!p)return{items:[],getItem:v=>{throw new ni}};let h=p.items.read(u),g=new Map;return{items:h.map(v=>{let b=u.store.add(new yCi(v,this._objectPool,this.scrollLeft,y=>{this._scrollableElement.setScrollPosition({scrollTop:this._scrollableElement.getScrollPosition().scrollTop+y})})),S=this._lastDocStates?.[b.getKey()];return S&&Ui(y=>{b.setViewState(S,y)}),g.set(v,b),b}),getItem:v=>g.get(v)}}),this._viewItems=this._viewItemsInfo.map(this,u=>u.items),this._spaceBetweenPx=0,this._totalHeight=this._viewItems.map(this,(u,p)=>u.reduce((h,g)=>h+g.contentHeight.read(p)+this._spaceBetweenPx,0)),this.activeControl=Ce(this,u=>{let p=this._viewModel.read(u)?.activeDiffItem.read(u);return p?this._viewItemsInfo.read(u).getItem(p).template.read(u)?.editor:void 0}),this._contextKeyService=this._register(this._parentContextKeyService.createScoped(this._element)),this._instantiationService=this._register(this._parentInstantiationService.createChild(new Io([X,this._contextKeyService]))),this._contextKeyService.createKey(ue.inMultiDiffEditor.key,!0),this._lastDocStates={},this._register(Ga((u,p)=>{let h=this._viewModel.read(u);if(h&&h.contextKeys)for(let[g,f]of Object.entries(h.contextKeys)){let v=this._contextKeyService.createKey(g,void 0);v.set(f),p.add(Z(()=>v.reset()))}}));let l=this._parentContextKeyService.createKey(ue.multiDiffEditorAllCollapsed.key,!1);this._register(he(u=>{let p=this._viewModel.read(u);if(p){let h=p.items.read(u).every(g=>g.collapsed.read(u));l.set(h)}})),this._register(he(u=>{let p=this._dimension.read(u);this._sizeObserver.observe(p)}));let c=Ce(u=>{if(this._viewItems.read(u).length>0)return;let h=this._viewModel.read(u);return!h||h.isLoading.read(u)?d(255,null):d(256,null)});this._register(he(u=>{let p=c.read(u);this._elements.placeholder.innerText=p??"",this._elements.placeholder.classList.toggle("visible",!!p)})),this._scrollableElements.content.style.position="relative",this._register(he(u=>{let p=this._sizeObserver.height.read(u);this._scrollableElements.root.style.height=`${p}px`;let h=this._totalHeight.read(u);this._scrollableElements.content.style.height=`${h}px`;let g=this._sizeObserver.width.read(u),f=g,v=this._viewItems.read(u),b=Z2e(v,tl(S=>S.maxScroll.read(u).maxScroll,qd));if(b){let S=b.maxScroll.read(u);f=g+S.maxScroll}this._scrollableElement.setScrollDimensions({width:g,height:p,scrollHeight:h,scrollWidth:f})})),e.replaceChildren(this._elements.root),this._register(Z(()=>{e.replaceChildren()})),this._register(he(u=>{let p=this._viewModel.read(u);if(p&&!p.isLoading.read(u)){if(p.items.read(u).length===0||p.activeDiffItem.read(u))return;this.goToNextChange()}})),this._register(this._register(he(u=>{x6(p=>{this.render(u)})})))}setScrollState(e){this._scrollableElement.setScrollPosition({scrollLeft:e.left,scrollTop:e.top})}getRootElement(){return this._elements.root}getContextKeyService(){return this._contextKeyService}getScopedInstantiationService(){return this._instantiationService}reveal(e,t){let o=this._viewItems.get(),n=o.findIndex(u=>u.viewModel.originalUri?.toString()===e.original?.toString()&&u.viewModel.modifiedUri?.toString()===e.modified?.toString());if(n===-1)throw new ni("Resource not found in diff editor");let r=o[n];this._viewModel.get().activeDiffItem.setCache(r.viewModel,void 0);let s=0;for(let u=0;u<n;u++)s+=o[u].contentHeight.get()+this._spaceBetweenPx;this._scrollableElement.setScrollPosition({scrollTop:s});let l=r.template.get()?.editor,c="original"in e?l?.getOriginalEditor():l?.getModifiedEditor();c&&t?.range&&(c.revealRangeInCenter(t.range),JQo(c,t.range))}getViewState(){return{scrollState:{top:this.scrollTop.get(),left:this.scrollLeft.get()},docStates:Object.fromEntries(this._viewItems.get().map(e=>[e.getKey(),e.getViewState()]))}}setViewState(e){this.setScrollState(e.scrollState),this._lastDocStates=e.docStates,Ui(t=>{if(e.docStates)for(let o of this._viewItems.get()){let n=e.docStates[o.getKey()];n&&o.setViewState(n,t)}})}findDocumentDiffItem(e){return this._viewItems.get().find(o=>o.viewModel.diffEditorViewModel.model.modified.uri.toString()===e.toString()||o.viewModel.diffEditorViewModel.model.original.uri.toString()===e.toString())?.viewModel.documentDiffItem}tryGetCodeEditor(e){let t=this._viewItems.get().find(n=>n.viewModel.diffEditorViewModel.model.modified.uri.toString()===e.toString()||n.viewModel.diffEditorViewModel.model.original.uri.toString()===e.toString()),o=t?.template.get()?.editor;if(o)return t.viewModel.diffEditorViewModel.model.modified.uri.toString()===e.toString()?{diffEditor:o,editor:o.getModifiedEditor()}:{diffEditor:o,editor:o.getOriginalEditor()}}goToNextChange(){this._navigateToChange("next")}goToPreviousChange(){this._navigateToChange("previous")}_navigateToChange(e){let t=this._viewItems.get();if(t.length===0)return;let o=this._viewModel.get()?.activeDiffItem.get(),n=o?t.findIndex(c=>c.viewModel===o):-1;if(n===-1){this._goToFile(0,"first");return}let r=t[n];r.viewModel.collapsed.get()&&r.viewModel.collapsed.set(!1,void 0);let s=r.template.get()?.editor;if(s?.getDiffComputationResult()?.changes2?.length){let c=s.getModifiedEditor().getPosition()?.lineNumber||1,u=s.getDiffComputationResult().changes2;if(e==="next"?u.some(h=>h.modified.startLineNumber>c):u.some(h=>h.modified.endLineNumberExclusive<=c)){s.goToDiff(e);return}}let l=(n+(e==="next"?1:-1)+t.length)%t.length;this._goToFile(l,e==="next"?"first":"last")}_goToFile(e,t){let o=this._viewItems.get()[e];o.viewModel.collapsed.get()&&o.viewModel.collapsed.set(!1,void 0),this.reveal({original:o.viewModel.originalUri,modified:o.viewModel.modifiedUri});let n=o.template.get()?.editor;if(n?.getDiffComputationResult()?.changes2?.length)if(t==="first")n.revealFirstDiff();else{let r=n.getDiffComputationResult().changes2.at(-1),s=n.getModifiedEditor();s.setPosition({lineNumber:r.modified.startLineNumber,column:1}),s.revealLineInCenter(r.modified.startLineNumber)}n?.focus()}render(e){let t=this.scrollTop.read(e),o=0,n=0,r=0,s=this._sizeObserver.height.read(e),l=di.ofStartAndLength(t,s),c=this._sizeObserver.width.read(e);for(let u of this._viewItems.read(e)){let p=u.contentHeight.read(e),h=Math.min(p,s),g=di.ofStartAndLength(n,h),f=di.ofStartAndLength(r,p);if(f.isBefore(l))o-=p-h,u.hide();else if(f.isAfter(l))u.hide();else{let v=Math.max(0,Math.min(l.start-f.start,p-h));o-=v;let b=di.ofStartAndLength(t+o,s);u.render(g,v,c,b)}n+=h+this._spaceBetweenPx,r+=p+this._spaceBetweenPx}this._scrollableElements.content.style.transform=`translateY(${-(t+o)}px)`}};AMe=I([m(4,X),m(5,F)],AMe);function JQo(a,i){let e=a.getModel(),t=a.createDecorationsCollection([{range:i,options:{description:"symbol-navigate-action-highlight",className:"symbolHighlight"}}]);setTimeout(()=>{a.getModel()===e&&t.clear()},350)}var yCi=class extends C{constructor(e,t,o,n){super();this.viewModel=e;this._objectPool=t;this._scrollLeft=o;this._deltaScrollVertical=n;this._templateRef=this._register(X0(this,void 0));this.contentHeight=Ce(this,e=>this._templateRef.read(e)?.object.contentHeight?.read(e)??this.viewModel.lastTemplateData.read(e).contentHeight);this.maxScroll=Ce(this,e=>this._templateRef.read(e)?.object.maxScroll.read(e)??{maxScroll:0,scrollWidth:0});this.template=Ce(this,e=>this._templateRef.read(e)?.object);this._isHidden=Le(this,!1);this._isFocused=Ce(this,e=>this.template.read(e)?.isFocused.read(e)??!1);this.viewModel.setIsFocused(this._isFocused,void 0),this._register(he(r=>{let s=this._scrollLeft.read(r);this._templateRef.read(r)?.object.setScrollLeft(s)})),this._register(he(r=>{let s=this._templateRef.read(r);!s||!this._isHidden.read(r)||s.object.isFocused.read(r)||this._clear()}))}dispose(){this._clear(),super.dispose()}toString(){return`VirtualViewItem(${this.viewModel.documentDiffItem.modified?.uri.toString()})`}getKey(){return this.viewModel.getKey()}getViewState(){return Ui(e=>{this._updateTemplateData(e)}),{collapsed:this.viewModel.collapsed.get(),selections:this.viewModel.lastTemplateData.get().selections}}setViewState(e,t){this.viewModel.collapsed.set(e.collapsed,t),this._updateTemplateData(t);let o=this.viewModel.lastTemplateData.get(),n=e.selections?.map(Yt.liftSelection);this.viewModel.lastTemplateData.set({...o,selections:n},t);let r=this._templateRef.get();r&&n&&r.object.editor.setSelections(n)}_updateTemplateData(e){let t=this._templateRef.get();t&&this.viewModel.lastTemplateData.set({contentHeight:t.object.contentHeight.get(),selections:t.object.editor.getSelections()??void 0},e)}_clear(){let e=this._templateRef.get();e&&Ui(t=>{this._updateTemplateData(t),e.object.hide(),this._templateRef.set(void 0,t)})}hide(){this._isHidden.set(!0,void 0)}render(e,t,o,n){this._isHidden.set(!1,void 0);let r=this._templateRef.get();if(!r){r=this._objectPool.getUnusedObj(new hBt(this.viewModel,this._deltaScrollVertical)),this._templateRef.set(r,void 0);let s=this.viewModel.lastTemplateData.get().selections;s&&r.object.editor.setSelections(s)}r.object.render(e,o,t,n)}};var cee=class extends C{constructor(e,t,o){super();this._element=e;this._workbenchUIElementFactory=t;this._instantiationService=o;this._dimension=Le(this,void 0);this._viewModel=Le(this,void 0);this._widgetImpl=Ce(this,e=>(Cx(lee,e),e.store.add(this._instantiationService.createInstance(Cx(AMe,e),this._element,this._dimension,this._viewModel,this._workbenchUIElementFactory))));this._activeControl=Ce(this,e=>this._widgetImpl.read(e).activeControl.read(e));this.onDidChangeActiveControl=H.fromObservableLight(this._activeControl);this._register(EM(this._widgetImpl))}reveal(e,t){this._widgetImpl.get().reveal(e,t)}createViewModel(e){return new Jke(e,this._instantiationService)}setViewModel(e){this._viewModel.set(e,void 0)}layout(e){this._dimension.set(e,void 0)}getActiveControl(){return this._activeControl.get()}getViewState(){return this._widgetImpl.get().getViewState()}setViewState(e){this._widgetImpl.get().setViewState(e)}tryGetCodeEditor(e){return this._widgetImpl.get().tryGetCodeEditor(e)}getRootElement(){return this._widgetImpl.get().getRootElement()}getContextKeyService(){return this._widgetImpl.get().getContextKeyService()}getScopedInstantiationService(){return this._widgetImpl.get().getScopedInstantiationService()}findDocumentDiffItem(e){return this._widgetImpl.get().findDocumentDiffItem(e)}goToNextChange(){this._widgetImpl.get().goToNextChange()}goToPreviousChange(){this._widgetImpl.get().goToPreviousChange()}};cee=I([m(2,F)],cee);var Eg=class extends zO{constructor(e,t,o,n,r,s,l,c,u){super(Eg.ID,e,"multiDiffEditor",o,t,r,c,n,s,l);this.editorProgressService=u;this._multiDiffEditorWidget=void 0}static{this.ID="multiDiffEditor"}get viewModel(){return this._viewModel}createEditor(e){this._multiDiffEditorWidget=this._register(this.instantiationService.createInstance(cee,e,this.instantiationService.createInstance(cet))),this._register(this._multiDiffEditorWidget.onDidChangeActiveControl(()=>{this._onDidChangeControl.fire()})),this._contentOverlay=this._register(new wCi(this._multiDiffEditorWidget.getRootElement(),this._multiDiffEditorWidget.getContextKeyService(),this._multiDiffEditorWidget.getScopedInstantiationService()))}async setInput(e,t,o,n){await super.setInput(e,t,o,n),this._viewModel=await e.getViewModel(),this._contentOverlay?.updateResource(e.resource),this._multiDiffEditorWidget.setViewModel(this._viewModel);let r=this.loadEditorViewState(e,o);r&&this._multiDiffEditorWidget.setViewState(r),this._applyOptions(t)}setOptions(e){this._applyOptions(e)}_applyOptions(e){let t=e?.viewState;!t||!t.revealData||this._multiDiffEditorWidget?.reveal(t.revealData.resource,{range:t.revealData.range?z.lift(t.revealData.range):void 0,highlight:!0})}async clearInput(){await super.clearInput(),this._contentOverlay?.updateResource(void 0),this._multiDiffEditorWidget.setViewModel(void 0)}layout(e){this._multiDiffEditorWidget.layout(e)}getControl(){return this._multiDiffEditorWidget.getActiveControl()}focus(){super.focus(),this._multiDiffEditorWidget?.getActiveControl()?.focus()}hasFocus(){return this._multiDiffEditorWidget?.getActiveControl()?.hasTextFocus()||super.hasFocus()}computeEditorViewState(e){return this._multiDiffEditorWidget.getViewState()}tracksEditorViewState(e){return e instanceof xu}toEditorViewStateResource(e){return e.resource}tryGetCodeEditor(e){return this._multiDiffEditorWidget.tryGetCodeEditor(e)}findDocumentDiffItem(e){let t=this._multiDiffEditorWidget.findDocumentDiffItem(e);return t?t.multiDiffEditorItem:void 0}goToNextChange(){this._multiDiffEditorWidget?.goToNextChange()}goToPreviousChange(){this._multiDiffEditorWidget?.goToPreviousChange()}async showWhile(e){return this.editorProgressService.showWhile(e)}};Eg=I([m(1,F),m(2,Te),m(3,De),m(4,le),m(5,ee),m(6,Et),m(7,Nn),m(8,rd)],Eg);var wCi=class extends C{constructor(e,t,o){super();this.resourceObs=Le(this,void 0);let n=o.createInstance(Ble,D.MultiDiffEditorContent,t,this.resourceObs);n.element.classList.add("multi-diff-root-floating-menu"),this._register(n);let r=Ce(s=>{let l=this.resourceObs.read(s),c=n.hasActions.read(s);return l!==void 0&&c});this._register(he(s=>{r.read(s)&&(e.appendChild(n.element),s.store.add(Z(()=>{n.element.remove()})))}))}updateResource(e){this.resourceObs.set(e,void 0)}},cet=class{constructor(i){this._instantiationService=i}createResourceLabel(i){let e=this._instantiationService.createInstance(rk,i,{});return{setUri(t,o={}){t?e.element.setFile(t,{strikethrough:o.strikethrough}):e.element.clear()},dispose(){e.dispose()}}}};cet=I([m(0,F)],cet);var kB=class{constructor(i,e){this._scmService=i;this._activityService=e}static{this._scheme="scm-multi-diff-source"}static getMultiDiffSourceUri(i,e){return A.from({scheme:kB._scheme,query:JSON.stringify({repositoryUri:i,groupId:e})})}static parseUri(i){if(i.scheme!==kB._scheme)return;let e;try{e=JSON.parse(i.query)}catch{return}if(typeof e!="object"||e===null)return;let{repositoryUri:t,groupId:o}=e;if(!(typeof t!="string"||typeof o!="string"))return{repositoryUri:A.parse(t),groupId:o}}canHandleUri(i){return kB.parseUri(i)!==void 0}async resolveDiffSource(i){let{repositoryUri:e,groupId:t}=kB.parseUri(i),o=await gf(ui(this,this._scmService.onDidAddRepository,()=>[...this._scmService.repositories].find(l=>l.provider.rootUri?.toString()===e.toString()))),n=await gf(ui(this,o.provider.onDidChangeResourceGroups,()=>o.provider.groups.find(l=>l.id===t))),s=ui(this._activityService.onDidChangeActivity,()=>[...this._activityService.getViewContainerActivities("workbench.view.scm")]).map(l=>!l.some(c=>c.badge instanceof PC));return await gf(s,l=>l),new CCi(n,o)}};kB=I([m(0,$c),m(1,zl)],kB);var $C=class{constructor(i){this._scmService=i}static{this.scheme="scm-history-item"}static getMultiDiffSourceUri(i,e,t,o){return A.from({scheme:$C.scheme,path:i.rootUri?.fsPath,query:JSON.stringify({repositoryId:i.id,historyItemId:e,historyItemParentId:t,historyItemDisplayId:o})},!0)}static parseUri(i){if(i.scheme!==$C.scheme)return;let e;try{e=JSON.parse(i.query)}catch{return}if(typeof e!="object"||e===null)return;let{repositoryId:t,historyItemId:o,historyItemParentId:n,historyItemDisplayId:r}=e;if(!(typeof t!="string"||typeof o!="string"||typeof n!="string"&&n!==void 0||typeof r!="string"&&r!==void 0))return{repositoryId:t,historyItemId:o,historyItemParentId:n,historyItemDisplayId:r}}canHandleUri(i){return $C.parseUri(i)!==void 0}async resolveDiffSource(i){let{repositoryId:e,historyItemId:t,historyItemParentId:o,historyItemDisplayId:n}=$C.parseUri(i),l=await this._scmService.getRepository(e)?.provider.historyProvider.get()?.provideHistoryItemChanges(t,o)??[];return{resources:fbe.const(l.map(u=>{let p=u.modifiedUri?`${No(u.modifiedUri.fsPath)} (${n??t})`:void 0;return new ik(u.originalUri,u.modifiedUri,u.modifiedUri,p)}))}}};$C=I([m(0,$c)],$C);var CCi=class{constructor(i,e){this._group=i;this._repository=e;this._resources=ui(this._group.onDidChangeResources,()=>this._group.resources.map(t=>new ik(t.multiDiffEditorOriginalUri,t.multiDiffEditorModifiedUri,t.sourceUri))),this.resources=new pN(this._resources),this.contextKeys={scmResourceGroup:this._group.id,scmProvider:this._repository.provider.providerId}}},dme=class extends C{static{this.ID="workbench.contrib.scmMultiDiffSourceResolver"}constructor(i,e){super(),this._register(e.registerResolver(i.createInstance($C))),this._register(e.registerResolver(i.createInstance(kB)))}};dme=I([m(0,F),m(1,Rz)],dme);var NMe=class a extends K{static async openMultiFileDiffEditor(i,e,t,o,n){if(!t)return;let r=kB.getMultiDiffSourceUri(t.toString(),o);return await i.openEditor({label:e,multiDiffSource:r,options:n})}constructor(){super({id:"_workbench.openScmMultiDiffEditor",title:L(11616,"Open Changes"),f1:!1})}async run(i,e){let t=i.get(ee);await a.openMultiFileDiffEditor(t,e.title,A.revive(e.repositoryUri),e.resourceGroupId)}};function wdo(a){if(!a.dataTransfer?.types.includes(Ll.SCM_HISTORY_ITEM))return;let i=a.dataTransfer?.getData(Ll.SCM_HISTORY_ITEM);if(i)return JSON.parse(i)}var ume=class extends C{static{this.ID="workbench.contrib.chat.scmHistoryItemContextContribution"}constructor(i,e,t){super(),this._store.add(i.registerChatContextItem(e.createInstance(o3))),this._store.add(t.registerTextModelContentProvider($C.scheme,e.createInstance(det))),this._store.add(t.registerTextModelContentProvider(r2.scheme,e.createInstance(r2)))}};ume=I([m(0,uS),m(1,F),m(2,Nt)],ume);var o3=class{constructor(i){this._scmViewService=i;this.type="pickerPick";this.label=d(13074,null);this.icon=M.gitCommit;this._delayer=new ya(200)}static asAttachment(i,e){let t=e.parentIds.length>0?e.parentIds[0]:void 0,o=$C.getMultiDiffSourceUri(i,e.id,t,e.displayId),n=`$(${M.repo.id})\xA0${i.name}\xA0$(${M.gitCommit.id})\xA0${e.displayId??e.id}`;return{id:e.id,name:n,value:o,historyItem:{...e,references:[]},kind:"scmHistoryItem"}}isEnabled(i){let e=this._scmViewService.activeRepository.get(),t=!!i.attachmentCapabilities.supportsSourceControlAttachments;return e?.repository.provider.historyProvider.get()!==void 0&&t}asPicker(i){return{placeholder:d(13075,null),picks:Xde((e,t)=>{let o=e.trim()!==""?e.trim():void 0,n=this._scmViewService.activeRepository.get(),r=n?.repository.provider.historyProvider.get();if(!n||!r)return Promise.resolve([]);let s=si([r.historyItemRef.get(),r.historyItemRemoteRef.get(),r.historyItemBaseRef.get()]).map(l=>l.id);return this._delayer.trigger(()=>r.provideHistoryItems({historyItemRefs:s,filterText:o,limit:100},t).then(l=>l?l.map(c=>{let u=[`${c.displayId??c.id}`];return c.author&&u.push(c.author),c.statistics&&u.push(`${c.statistics.files} ${d(13076,null)}`),c.timestamp&&u.push(Bs(c.timestamp,!0,!0)),{iconClass:q.asClassName(M.gitCommit),label:c.subject,detail:u.join(`$(${M.circleSmallFilled.id})`),asAttachment:()=>o3.asAttachment(n.repository.provider,c)}}):[]))})}}};o3=I([m(0,au)],o3);var det=class{constructor(i,e){this._modelService=i;this._scmService=e}async provideTextContent(i){let e=$C.parseUri(i);if(!e)return null;let t=this._modelService.getModel(i);if(t)return t;let{repositoryId:o,historyItemId:n}=e,r=this._scmService.getRepository(o),s=r?.provider.historyProvider.get();if(!r||!s)return null;let l=await s.resolveHistoryItemChatContext(n);return l?this._modelService.createModel(l,null,i,!1):null}};det=I([m(0,Ct),m(1,$c)],det);var r2=class{constructor(i,e){this._modelService=i;this._scmService=e}static{this.scheme="scm-history-item-change-range"}async provideTextContent(i){let e=this._parseUri(i);if(!e)return null;let t=this._modelService.getModel(i);if(t)return t;let{repositoryId:o,start:n,end:r}=e,s=this._scmService.getRepository(o),l=s?.provider.historyProvider.get();if(!s||!l)return null;let c=await l.resolveHistoryItemChangeRangeChatContext(r,n,i.path);return c?this._modelService.createModel(c,null,i,!1):null}_parseUri(i){if(i.scheme!==r2.scheme)return;let e;try{e=JSON.parse(i.query)}catch{return}if(typeof e!="object"||e===null)return;let{repositoryId:t,start:o,end:n}=e;if(!(typeof t!="string"||typeof o!="string"||typeof n!="string"))return{repositoryId:t,start:o,end:n}}};r2=I([m(0,Ct),m(1,$c)],r2);W(class extends K{constructor(){super({id:"workbench.scm.action.graph.addHistoryItemToChat",title:d(13072,null),f1:!1,menu:{id:D.SCMHistoryItemContext,group:"z_chat",order:1,when:ie.enabled}})}async run(a,i,e){let o=await a.get(At).revealWidget();!i||!e||!o||o.attachmentModel.addContext(o3.asAttachment(i,e))}});W(class extends K{constructor(){super({id:"workbench.scm.action.graph.summarizeHistoryItem",title:d(13073,null),f1:!1,menu:{id:D.SCMHistoryItemContext,group:"z_chat",order:2,when:ie.enabled}})}async run(a,i,e){let o=await a.get(At).revealWidget();!i||!e||!o||(o.attachmentModel.addContext(o3.asAttachment(i,e)),await o.acceptInput("Summarize the attached history item"))}});W(class extends K{constructor(){super({id:"workbench.scm.action.graph.addHistoryItemChangeToChat",title:d(13072,null),f1:!1,menu:{id:D.SCMHistoryItemChangeContext,group:"z_chat",order:1,when:ie.enabled}})}async run(a,i,e){let o=await a.get(At).revealWidget();!i||!e.modifiedUri||!o||o.attachmentModel.addContext({id:e.uri.toString(),name:`${Ye(e.modifiedUri)}`,value:e.modifiedUri,historyItem:i,kind:"scmHistoryItemChange"})}});var uet=ae("IChatWidgetHistoryService"),ZQo=40,OMe=class extends C{constructor(e){super();this._onDidChangeHistory=this._register(new E);this.changed=!1;this.onDidChangeHistory=this._onDidChangeHistory.event;this.memento=new Bl("interactive-session",e);let t=this.memento.getMemento(1,1);this.viewState=t,this._register(e.onWillSaveState(()=>{this.changed&&(this.memento.saveMemento(),this.changed=!1)}))}getHistory(e){let t=this.getKey(e);return(this.viewState.history?.[t]??[]).map(n=>this.migrateHistoryEntry(n))}migrateHistoryEntry(e){if(e.inputText!==void 0)return e;let t=e,o=t.state??{},n,r;if(o.chatMode)if(typeof o.chatMode=="string")n=o.chatMode,r=Object.values(cc).includes(o.chatMode)?o.chatMode:void 0;else if(typeof o.chatMode=="object"&&o.chatMode!==null){let s=o.chatMode;n=s.id??"ask",r=s.id&&Object.values(cc).includes(s.id)?s.id:void 0}else n="ask",r="ask";else n="ask",r="ask";return{inputText:t.text??"",attachments:o.chatContextAttachments??[],mode:{id:n,kind:r},contrib:t.state||{},selectedModel:void 0,selections:[]}}getKey(e){return e==="panel"?ake:e}append(e,t){this.viewState.history??={};let o=this.getKey(e);this.viewState.history[o]=this.getHistory(e).concat(t).slice(-ZQo),this.changed=!0,this._onDidChangeHistory.fire({kind:"append",entry:t})}clearHistory(){this.viewState.history={},this.changed=!0,this._onDidChangeHistory.fire({kind:"clear"})}};OMe=I([m(0,le)],OMe);var dee=class extends C{constructor(e,t){super();this.location=e;this.chatWidgetHistoryService=t;this._overlay=[];this._history=this.chatWidgetHistoryService.getHistory(this.location),this._currentIndex=this._history.length,this._register(this.chatWidgetHistoryService.onDidChangeHistory(o=>{if(o.kind==="append"){let n=this._history.length;this._history=this.chatWidgetHistoryService.getHistory(this.location);let r=this._history.length;n===r?(this._overlay.shift(),this._currentIndex<this._history.length&&(this._currentIndex=Math.max(this._currentIndex-1,0))):this._currentIndex===n&&(this._currentIndex=r)}else o.kind==="clear"&&(this._history=[],this._currentIndex=0,this._overlay=[])}))}get values(){return this.chatWidgetHistoryService.getHistory(this.location)}isAtEnd(){return this._currentIndex===Math.max(this._history.length,this._overlay.length)}isAtStart(){return this._currentIndex===0}overlay(e){this._overlay[this._currentIndex]=e}resetCursor(){this._currentIndex=this._history.length}previous(){return this._currentIndex=Math.max(this._currentIndex-1,0),this.current()}next(){return this._currentIndex=Math.min(this._currentIndex+1,this._history.length),this.current()}current(){return this._overlay[this._currentIndex]??this._history[this._currentIndex]}append(e){this._overlay=[],this._currentIndex=this._history.length,e6o(this._history.at(-1),e)||this.chatWidgetHistoryService.append(this.location,e)}};dee=I([m(1,uet)],dee);function e6o(a,i){return!(!a||!i||a.inputText!==i.inputText||!$i(a.attachments,i.attachments,(e,t)=>e.id===t.id))}var Cdo=ae("ILanguageModelStatsService"),FMe=class extends C{constructor(e,t){super();this.extensionFeaturesManagementService=e;for(let o in t.keys(-1,0))(o.startsWith("languageModelStats.")||o.startsWith("languageModelAccess."))&&t.remove(o,-1)}async update(e,t,o,n){await this.extensionFeaturesManagementService.getAccess(t,fBt)}};FMe=I([m(0,YI),m(1,le)],FMe);var fBt="copilot";oe.as(Ds.ExtensionFeaturesRegistry).registerExtensionFeature({id:fBt,label:d(7618,null),description:d(7619,null),icon:M.copilot,access:{canToggle:!1},accessDataLabel:d(7617,null)});var gD=ae("ILanguageModelToolsConfirmationService");var t6o="screenshot-focused-window";function vBt(a){return{id:t6o,name:d(6025,null),value:a.buffer,kind:"image"}}var vi=L(5374,"Chat"),im="workbench.action.chat.newChat",xdo="workbench.action.chat.newEditSession",bBt="workbench.action.openChat",qC="workbench.action.chat.open",pI="workbench.action.chat.triggerSetup",n3="workbench.action.chat.triggerSetupSupportAnonymousAction",i6o="workbench.action.chat.toggle",s2="workbench.action.chat.generateAgentInstructions",pet="workbench.action.chat.generateOnDemandInstructions",r3="workbench.action.chat.generatePrompt",s3="workbench.action.chat.generateSkill",a3="workbench.action.chat.generateAgent",kCi="workbench.action.chat.generateHook",met="workbench.action.chat.insertForkConversationCommand",SBt={manageSettingsUrl:to.defaultChatAgent?.manageSettingsUrl??"",provider:to.defaultChatAgent?.provider??{enterprise:{id:""}},completionsAdvancedSetting:to.defaultChatAgent?.completionsAdvancedSetting??"",completionsMenuCommand:to.defaultChatAgent?.completionsMenuCommand??""},fy=new D("workbench.chat.menu.config"),o6o="workbench.action.chat.openQuotaExceededDialog",IBt=class extends K{constructor(e,t){super({...e,icon:M.chatSparkle,f1:!0,category:vi,precondition:x.and(ie.Setup.hidden.negate(),ie.Setup.disabled.negate())});this.mode=t}async run(e,t){t=typeof t=="string"?{query:t}:t;let o=e.get(Si),n=e.get(At),r=e.get(jn),s=e.get(oi),l=e.get(br),c=e.get(F),u=e.get(ge),p=e.get(Pv),h=e.get(be),g=e.get(Wr),f=e.get($c),v=e.get(ne),b=e.get(B),S=n.lastFocusedWidget;if((!this.mode||!S||!ts(S.domNode))&&(S=await n.revealWidget()),!S)return;let y=(t?.mode?p.findModeByName(t?.mode):void 0)??this.mode;if(y&&await this.handleSwitchToMode(y,S,c,u),t?.modelSelector){let T=(await g.selectLanguageModels(t.modelSelector)).sort().at(0);if(!T)throw new Error(`No language models found matching selector: ${JSON.stringify(t.modelSelector)}.`);let N=g.lookupLanguageModel(T);if(!N)throw new Error(`Language model not loaded: ${T}.`);S.input.setCurrentLanguageModel({metadata:N,identifier:T})}if(t?.toolsInclude||t?.toolsExclude){let k=S.input.selectedLanguageModel.get()?.metadata,T=Array.from(r.getTools(k)),N=Array.from(r.getToolSetsForModel(k)),O=s6o({allTools:T,allToolSets:N,toolsInclude:t.toolsInclude,toolsExclude:t.toolsExclude});for(let V of O.unknownIdentifiers)v.warn(`Tool filtering: Unknown identifier '${V}' - no matching tool or toolset found.`);S.input.selectedToolsModel.set(O.enablementMap,!0)}if(t?.previousRequests?.length&&S.viewModel)for(let{request:k,response:T}of t.previousRequests)o.addCompleteRequest(S.viewModel.sessionResource,k,void 0,0,{message:T});if(t?.attachScreenshot){let k=await s.getScreenshot();k&&S.attachmentModel.addContext(vBt(k))}if(t?.attachFiles)for(let k of t.attachFiles){let T=k instanceof A?k:k.uri,N=k instanceof A?void 0:k.range;await h.exists(T)&&S.attachmentModel.addFile(T,N)}if(t?.attachHistoryItemChanges)for(let k of t.attachHistoryItemChanges){let N=f.getRepository(A.file(k.uri.path))?.provider.historyProvider.get();if(!N)continue;let O=await N.resolveHistoryItem(k.historyItemId);O&&S.attachmentModel.addContext({id:k.uri.toString(),name:`${Ye(k.uri)}`,value:k.uri,historyItem:O,kind:"scmHistoryItemChange"})}if(t?.attachHistoryItemChangeRanges)for(let k of t.attachHistoryItemChangeRanges){let T=f.getRepository(A.file(k.end.uri.path)),N=T?.provider.historyProvider.get();if(!T||!N)continue;let[O,V]=await Promise.all([N.resolveHistoryItem(k.start.historyItemId),N.resolveHistoryItem(k.end.historyItemId)]);if(!O||!V)continue;let U=k.end.uri.with({scheme:r2.scheme,query:JSON.stringify({repositoryId:T.id,start:O.id,end:k.end.historyItemId})});S.attachmentModel.addContext({id:U.toString(),name:`${Ye(U)}`,value:U,historyItemChangeStart:{uri:k.start.uri,historyItem:O},historyItemChangeEnd:{uri:k.end.uri,historyItem:{...V,displayId:k.end.historyItemId}},kind:"scmHistoryItemChangeRange"})}let w;if(t?.query&&(t.isPartialQuery?S.setInput(t.query):(S.viewModel||await H.toPromise(S.onDidChangeViewModel),await n6o(l,S.input.currentModeKind),S.setInput(t.query),w=S.acceptInput())),t?.toolIds&&t.toolIds.length>0)for(let k of t.toolIds){let T=r.getTool(k);T&&S.attachmentModel.addContext({id:T.id,name:T.displayName,fullName:T.displayName,value:void 0,icon:q.isThemeIcon(T.icon)?T.icon:void 0,kind:"tool"})}if(S.focusInput(),t?.blockOnResponse){let k=await w;if(k){let T=b.getValue("chat.autoReply");await new Promise(O=>{let V=k.onDidChange(async()=>{if(k.isComplete){V.dispose(),O();return}if(k.isPendingConfirmation.get()){let G=k.response.value.some($=>$.kind==="questionCarousel"&&!$.isUsed);if(T&&G)return;V.dispose(),O()}})});let N=r6o(k);return N?{...k.result,...N}:{...k.result}}}}async handleSwitchToMode(e,t,o,n){let r=t.input.currentModeKind;if(e){let s=t.viewModel?.model,l=s?await o.invokeFunction(get,r,e.kind,s.getRequests().length,s):{needToClearSession:!1};if(!l)return;t.input.setChatMode(e.id),l.needToClearSession&&await n.executeCommand(im)}}};async function n6o(a,i){a.getDefaultAgent("panel",i)||await Promise.race([H.toPromise(H.filter(a.onDidChangeAgents,()=>!!a.getDefaultAgent("panel",i))),Pi(6e4).then(()=>{throw new Error("Timed out waiting for default agent")})])}function r6o(a){for(let i of a.response.value){if(i.kind==="toolInvocation"){let e=i.state.get();if(e.type===lo.StateKind.WaitingForConfirmation)return{type:"confirmation",kind:"toolInvocation",toolId:i.toolId};if(e.type===lo.StateKind.WaitingForPostApproval)return{type:"confirmation",kind:"toolPostApproval",toolId:i.toolId}}if(i.kind==="confirmation"&&!i.isUsed)return{type:"confirmation",kind:"confirmation",title:i.title,data:i.data};if(i.kind==="questionCarousel"&&!i.isUsed)return{type:"confirmation",kind:"questionCarousel",questions:i.questions};if(i.kind==="elicitation2"&&i.state.get()==="pending"){let e=i.title;return{type:"confirmation",kind:"elicitation",title:typeof e=="string"?e:e.value}}}}var xCi=class extends IBt{constructor(){super({id:qC,title:L(5414,"Open Chat"),keybinding:{weight:200,primary:2599,mac:{primary:2343}},menu:[{id:D.ChatTitleBarMenu,group:"a_open",order:1}]})}};function ECi(a){return`workbench.action.chat.open${a.name.get()}`}var pme=class extends IBt{constructor(i,e){super({id:ECi(i),title:L(5417,"Open Chat ({0})",i.label.get()),keybinding:e},i)}};function Ldo(){W(xCi),W(class extends pme{constructor(){super(Pl.Ask)}}),W(class extends pme{constructor(){super(Pl.Agent,{when:x.has("config.chat.agent.enabled"),weight:200,primary:3111,linux:{primary:3623}})}}),W(class extends pme{constructor(){super(Pl.Edit)}}),W(class extends K{constructor(){super({id:i6o,title:L(5423,"Toggle Chat"),category:vi})}async run(e){let t=e.get(fi),o=e.get(Ft),n=e.get(Ri),r=e.get(At),s=n.getViewLocationById(Vr);o.isViewVisible(Vr)?this.updatePartVisibility(t,s,!1):(this.updatePartVisibility(t,s,!0),(await r.revealWidget())?.focusInput())}updatePartVisibility(e,t,o){let n;switch(t){case 1:n="workbench.parts.panel";break;case 0:n="workbench.parts.sidebar";break;case 2:n="workbench.parts.auxiliarybar";break}n&&e.setPartHidden(!o,n)}}),W(class extends K{constructor(){super({id:bBt,title:L(5409,"New Chat Editor"),icon:M.plus,f1:!0,category:vi,precondition:ie.enabled,keybinding:{weight:200,primary:2092,when:x.and(ie.inChatSession,ie.inChatEditor)},menu:[{id:D.ChatTitleBarMenu,group:"b_new",order:0},{id:D.ChatNewMenu,group:"2_new",order:2},{id:D.EditorTitle,group:"navigation",when:x.and(fr.isEqualTo(Va.EditorID),ie.newChatButtonExperimentIcon.notEqualsTo("copilot"),ie.newChatButtonExperimentIcon.notEqualsTo("new-session"),ie.newChatButtonExperimentIcon.notEqualsTo("comment")),order:1}]})}async run(e){await e.get(At).openSession(cs.getNewSessionUri(),Un,{pinned:!0})}}),W(class extends K{constructor(){super({id:bBt+".copilotIcon",title:L(5409,"New Chat Editor"),icon:M.copilot,f1:!1,category:vi,precondition:ie.enabled,menu:[{id:D.EditorTitle,group:"navigation",when:x.and(fr.isEqualTo(Va.EditorID),ie.newChatButtonExperimentIcon.isEqualTo("copilot")),order:1}]})}async run(e){await e.get(At).openSession(cs.getNewSessionUri(),Un,{pinned:!0})}}),W(class extends K{constructor(){super({id:bBt+".newSessionIcon",title:L(5409,"New Chat Editor"),icon:M.newSession,f1:!1,category:vi,precondition:ie.enabled,menu:[{id:D.EditorTitle,group:"navigation",when:x.and(fr.isEqualTo(Va.EditorID),ie.newChatButtonExperimentIcon.isEqualTo("new-session")),order:1}]})}async run(e){await e.get(At).openSession(cs.getNewSessionUri(),Un,{pinned:!0})}}),W(class extends K{constructor(){super({id:bBt+".commentIcon",title:L(5409,"New Chat Editor"),icon:M.comment,f1:!1,category:vi,precondition:ie.enabled,menu:[{id:D.EditorTitle,group:"navigation",when:x.and(fr.isEqualTo(Va.EditorID),ie.newChatButtonExperimentIcon.isEqualTo("comment")),order:1}]})}async run(e){await e.get(At).openSession(cs.getNewSessionUri(),Un,{pinned:!0})}}),W(class extends K{constructor(){super({id:"workbench.action.openChatToSide",title:L(5410,"New Chat Editor to the Side"),f1:!0,category:vi,precondition:ie.enabled})}async run(e){await e.get(At).openSession(cs.getNewSessionUri(),vn,{pinned:!0})}}),W(class extends K{constructor(){super({id:"workbench.action.newChatWindow",title:L(5407,"New Chat Window"),f1:!0,category:vi,precondition:ie.enabled,menu:[{id:D.ChatTitleBarMenu,group:"b_new",order:1},{id:D.ChatNewMenu,group:"2_new",order:3}]})}async run(e){await e.get(At).openSession(cs.getNewSessionUri(),hg,{pinned:!0,auxiliary:{compact:!0,bounds:{width:640,height:640}}})}}),W(class extends K{constructor(){super({id:"workbench.action.chat.clearInputHistory",title:L(5402,"Clear Input History"),precondition:ie.enabled,category:vi,f1:!0})}async run(e,...t){e.get(uet).clearHistory()}}),W(class extends wl{constructor(){super({id:"chat.action.focus",title:L(5369,"Focus Chat List"),precondition:x.and(ie.inChatInput),category:vi,keybinding:[{when:x.and(ie.inputCursorAtTop,ie.inQuickChat.negate()),primary:2064,weight:100},{when:x.and(x.or(Zy,Jae),ie.inQuickChat.negate()),primary:2064,weight:100},{when:x.and(ie.inChatSession,ie.inQuickChat),primary:2066,weight:200}]})}runEditorCommand(e,t){let o=t.getModel()?.uri;o&&e.get(At).getWidgetByInputUri(o)?.focusResponseItem()}}),W(class extends wl{constructor(){super({id:"workbench.chat.action.focusLastFocused",title:L(5370,"Focus Last Focused Chat List Item"),precondition:x.and(ie.inChatInput),category:vi,keybinding:[{when:x.and(ie.inputCursorAtTop,ie.inQuickChat.negate()),primary:3088,weight:101},{when:x.and(x.or(Zy,Jae),ie.inQuickChat.negate()),primary:3088,weight:101},{when:x.and(ie.inChatSession,ie.inQuickChat),primary:3090,weight:201}]})}runEditorCommand(e,t){let o=t.getModel()?.uri;o&&e.get(At).getWidgetByInputUri(o)?.focusResponseItem(!0)}}),W(class extends K{constructor(){super({id:"workbench.action.chat.focusInput",title:L(5403,"Focus Chat Input"),f1:!1,keybinding:[{primary:2066,weight:200,when:x.and(ie.inChatSession,ie.inChatInput.negate(),ie.inQuickChat.negate())},{when:x.and(ie.inChatSession,ie.inChatInput.negate(),ie.inQuickChat),primary:2064,weight:200}]})}run(e,...t){e.get(At).lastFocusedWidget?.focusInput()}}),W(class kdo extends K{static{this.ID="workbench.action.chat.focusTodosView"}constructor(){super({id:kdo.ID,title:L(5406,"Toggle Focus Between TODOs and Input"),category:vi,f1:!0,precondition:ie.chatModeKind.isEqualTo("agent"),keybinding:[{weight:201,primary:3122,when:x.or(x.and(ie.inChatInput,ie.chatModeKind.isEqualTo("agent")),x.and(ie.inChatTodoList,ie.chatModeKind.isEqualTo("agent")))}]})}run(e){let o=e.get(At).lastFocusedWidget;(!o||!o.toggleTodosViewFocus())&&Jo(d(5380,null))}}),W(class Edo extends K{static{this.ID="workbench.action.chat.focusQuestionCarousel"}constructor(){super({id:Edo.ID,title:L(5404,"Chat: Toggle Focus Between Question and Input"),category:vi,f1:!0,precondition:ie.inChatSession,keybinding:[{weight:200,primary:3103,when:x.and(ie.inChatSession,ie.Editing.hasQuestionCarousel)}]})}run(e){let o=e.get(At).lastFocusedWidget;(!o||!o.toggleQuestionCarouselFocus())&&Jo(d(5377,null))}}),W(class Tdo extends K{static{this.ID="workbench.action.chat.previousQuestion"}constructor(){super({id:Tdo.ID,title:L(5411,"Chat: Previous Question"),category:vi,f1:!0,precondition:x.and(ie.inChatSession,ie.Editing.hasQuestionCarousel),keybinding:[{weight:200,primary:558,when:x.and(ie.inChatQuestionCarousel,ie.Editing.hasQuestionCarousel)}]})}run(e){e.get(At).lastFocusedWidget?.navigateToPreviousQuestion()}}),W(class _do extends K{static{this.ID="workbench.action.chat.nextQuestion"}constructor(){super({id:_do.ID,title:L(5408,"Chat: Next Question"),category:vi,f1:!0,precondition:x.and(ie.inChatSession,ie.Editing.hasQuestionCarousel),keybinding:[{weight:200,primary:556,when:x.and(ie.inChatQuestionCarousel,ie.Editing.hasQuestionCarousel)}]})}run(e){e.get(At).lastFocusedWidget?.navigateToNextQuestion()}}),W(class Ddo extends K{static{this.ID="workbench.action.chat.focusTip"}constructor(){super({id:Ddo.ID,title:L(5405,"Chat: Toggle Focus Between Tip and Input"),category:vi,f1:!0,precondition:ie.inChatSession,keybinding:[{weight:200,primary:3162,when:x.or(ie.inChatSession,ie.inChatTip)}]})}run(e){let o=e.get(At).lastFocusedWidget;(!o||!o.toggleTipFocus())&&Jo(d(5379,null))}}),W(class extends K{constructor(){super({id:"workbench.action.chat.showContextUsage",title:L(5412,"Show Context Window Usage"),category:vi,f1:!0,precondition:ie.enabled})}async run(e){let t=e.get(At);(t.lastFocusedWidget??await t.revealWidget())?.input.showContextUsageDetails()}}),W(class extends K{constructor(){super({id:"workbench.action.chat.toggleShowContextUsage",title:L(5378,"Show Context Usage"),category:vi,toggled:x.equals("config.chat.contextUsage.enabled",!0),menu:{id:D.ChatWelcomeContext,group:"1_display",order:1,when:ie.inChatEditor.negate()}})}async run(e){let t=e.get(B),o=t.getValue("chat.contextUsage.enabled");await t.updateValue("chat.contextUsage.enabled",!o)}});let a=x.and(ie.enabled,x.notEquals(`config.${SBt.completionsAdvancedSetting}.authProvider`,SBt.provider.enterprise.id));W(class extends K{constructor(){super({id:"workbench.action.chat.manageSettings",title:L(5413,"Manage Chat"),category:vi,f1:!0,precondition:x.and(x.or(ie.Entitlement.planFree,ie.Entitlement.planPro,ie.Entitlement.planProPlus),a),menu:{id:D.ChatTitleBarMenu,group:"y_manage",order:1,when:a}})}async run(i){i.get(Qe).open(A.parse(SBt.manageSettingsUrl))}}),W(class extends K{constructor(){super({id:"workbench.action.chat.showExtensionsUsingCopilot",title:L(5421,"Show Extensions using Copilot"),f1:!0,category:c5,precondition:ie.enabled})}async run(e){e.get(zi).openSearch(`@contribute:${fBt}`)}}),W(class extends K{constructor(){super({id:"workbench.action.chat.configureCodeCompletions",title:L(5386,"Configure Inline Suggestions..."),precondition:x.and(ie.Setup.installed,ie.Setup.disabled.negate(),ie.Setup.untrusted.negate()),menu:{id:D.ChatTitleBarMenu,group:"f_completions",order:10}})}async run(e){e.get(ge).executeCommand(SBt.completionsMenuCommand)}}),W(class extends K{constructor(){super({id:o6o,title:d(5424,null)})}async run(e){let t=e.get(vr),o=e.get(ge),n=e.get(ct),r=e.get(Te),s,l=t.quotas.chat?.percentRemaining===0,c=t.quotas.completions?.percentRemaining===0;if(l&&!c?s=d(5383,null):c&&!l?s=d(5384,null):s=d(5382,null),t.quotas.resetDate){let h=t.quotas.resetDateHasTime?Wu.DateTimeFormat(Dr,{year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"numeric"}):Wu.DateTimeFormat(Dr,{year:"numeric",month:"long",day:"numeric"}),g=new Date(t.quotas.resetDate);s=[s,d(5418,null,h.value.format(g))].join(" ")}let u=t.entitlement===5,p=u?d(5427,null):void 0;await n.prompt({type:"none",message:d(5387,null),cancelButton:{label:d(5388,null),run:()=>{}},buttons:[{label:u?d(5426,null):d(5425,null),run:()=>{let h="workbench.action.chat.upgradePlan";r.publicLog2("workbenchActionExecuted",{id:h,from:"chat-dialog"}),o.executeCommand(h)}}],custom:{icon:M.copilotWarningLarge,markdownDetails:si([{markdown:new xe(s,!0)},p?{markdown:new xe(p,!0)}:void 0])}})}}),W(class extends K{constructor(){super({id:"workbench.action.chat.resetTrustedTools",title:L(5419,"Reset Tool Confirmations"),category:vi,f1:!0,precondition:ie.enabled})}run(e){e.get(gD).resetToolAutoConfirmation(),e.get(Ne).info(d(5420,null))}}),W(class extends K{constructor(){super({id:s2,title:L(5394,"Generate Agent Instructions"),category:vi,icon:M.sparkle,f1:!0,precondition:ie.enabled})}async run(e){await e.get(ge).executeCommand("workbench.action.chat.open",{mode:"agent",query:"/init",isPartialQuery:!1})}}),W(class extends K{constructor(){super({id:pet,title:L(5395,"Generate On-Demand Instructions"),category:vi,icon:M.sparkle,f1:!0,precondition:ie.enabled})}async run(e){await e.get(ge).executeCommand("workbench.action.chat.open",{mode:"agent",query:"/create-instructions ",isPartialQuery:!0})}}),W(class extends K{constructor(){super({id:r3,title:L(5396,"Generate Prompt File"),shortTitle:L(5397,"Generate Prompt"),category:vi,icon:M.sparkle,f1:!0,precondition:ie.enabled})}async run(e){await e.get(ge).executeCommand("workbench.action.chat.open",{mode:"agent",query:"/create-prompt ",isPartialQuery:!0})}}),W(class extends K{constructor(){super({id:s3,title:L(5398,"Generate Skill"),shortTitle:L(5399,"Generate Skill"),category:vi,icon:M.sparkle,f1:!0,precondition:ie.enabled})}async run(e){await e.get(ge).executeCommand("workbench.action.chat.open",{mode:"agent",query:"/create-skill ",isPartialQuery:!0})}}),W(class extends K{constructor(){super({id:a3,title:L(5389,"Generate Custom Agent"),shortTitle:L(5390,"Generate Agent"),category:vi,icon:M.sparkle,f1:!0,precondition:ie.enabled})}async run(e){await e.get(ge).executeCommand("workbench.action.chat.open",{mode:"agent",query:"/create-agent ",isPartialQuery:!0})}}),W(class extends K{constructor(){super({id:kCi,title:L(5392,"Generate Hook"),shortTitle:L(5393,"Generate Hook"),category:vi,icon:M.sparkle,f1:!0,precondition:ie.enabled})}async run(e){await e.get(ge).executeCommand("workbench.action.chat.open",{mode:"agent",query:"/create-hook ",isPartialQuery:!0})}}),W(class extends K{constructor(){super({id:met,title:L(5400,"Insert Fork Command"),shortTitle:L(5401,"Insert /fork"),category:vi,icon:M.repoForked,f1:!0,precondition:ie.enabled})}async run(e){await e.get(ge).executeCommand("workbench.action.chat.open",{query:"/fork ",isPartialQuery:!0})}}),W(class extends K{constructor(){super({id:"workbench.action.chat.openFeatureSettings",title:L(5415,"Chat Settings"),shortTitle:d(5416,null),category:vi,f1:!0,precondition:ie.enabled,menu:[{id:fy,when:x.and(ie.enabled,x.equals("view",Vr)),order:15,group:"3_configure"},{id:D.ChatWelcomeContext,group:"2_settings",order:1}]})}async run(e){e.get(Po).openSettings({query:"@feature:chat "})}}),fe.appendMenuItem(D.ViewTitle,{submenu:fy,title:L(5385,"Configure Chat"),group:"navigation",when:x.equals("view",Vr),icon:M.gear,order:6})}function TCi(a,i=!0){return Rr(a)?(i?`${a.username}: `:"")+a.messageText:(i?`${a.username}: `:"")+a.response.toString()}function s6o(a){let{allTools:i,allToolSets:e,toolsInclude:t,toolsExclude:o}=a,n=new Map,r=new Set,s=(g,f)=>f.has(g.id)?(r.add(g.id),!0):g.toolReferenceName&&f.has(g.toolReferenceName)?(r.add(g.toolReferenceName),!0):!1,l=(g,f)=>f.has(g.id)?(r.add(g.id),!0):f.has(g.referenceName)?(r.add(g.referenceName),!0):!1,c=new Set;if(t){let g=new Set(t);for(let f of e)if(l(f,g))for(let v of f.getTools())n.set(v,!0);for(let f of i)s(f,g)?(n.set(f,!0),c.add(f)):n.has(f)||n.set(f,!1);for(let f of e)for(let v of f.getTools())s(v,g)?(n.set(v,!0),c.add(v)):n.has(v)||n.set(v,!1)}else{for(let g of i)n.set(g,!0);for(let g of e)for(let f of g.getTools())n.set(f,!0)}if(o){let g=new Set(o);for(let f of e)if(l(f,g))for(let v of f.getTools())c.has(v)||n.set(v,!1);for(let f of i)s(f,g)&&n.set(f,!1);for(let f of e)for(let v of f.getTools())s(v,g)&&n.set(v,!1)}let u=new Set([...t??[],...o??[]]),p=[];for(let g of u)r.has(g)||p.push(g);if(Array.from(n.entries()).filter(([g,f])=>f&&!Km(g)).length===0)throw new Error("Tool filtering resulted in zero enabled tools. At least one tool must be enabled.");for(let g of e){let f=Array.from(g.getTools()),v=f.length>0&&f.every(b=>n.get(b)===!0);n.set(g,v)}return{enablementMap:n,unknownIdentifiers:p}}async function het(a,i,e){return FQe(a,e,{messageOverride:i})}async function get(a,i,e,t,o){if(!o?.editingSession||i===e)return{needToClearSession:!1};let n=a.get(ct);if((i==="edit"||e==="edit")&&t>0){let s=d(5422,null);return o.editingSession.entries.get().filter(u=>u.state.get()===0).length>0?await het(o,s,n)?{needToClearSession:!0}:!1:(await n.confirm({title:d(5371,null),message:d(5373,null),primaryButton:d(5372,null),type:"info"})).confirmed?{needToClearSession:!0}:!1}return{needToClearSession:!1}}async function yBt(a,i,e){let t=a.viewModel?.model.sessionResource,o=e??(t?fg(t):qp);if(XI(a.viewContext)&&o!==qp){let n=A.from({scheme:o,path:`/untitled-${_t()}`});await(await i.openView(Vr)).loadSession(n)}else await a.clear()}fe.appendMenuItem(D.EditorContext,{submenu:D.ChatTextEditorMenu,group:"1_chat",order:5,title:d(5391,null),when:x.and(ie.Setup.hidden.negate(),ie.Setup.disabled.negate())});W(class extends K{constructor(){super({id:"workbench.action.chat.toggleDefaultVisibility",title:L(5381,"Show View by Default"),toggled:x.equals("config.workbench.secondarySideBar.defaultVisibility","hidden").negate(),f1:!1,menu:{id:D.ViewTitle,when:x.and(x.equals("view",Vr),ie.panelLocation.isEqualTo(2)),order:0,group:"5_configure"}})}async run(i){let e=i.get(B),t=e.getValue("workbench.secondarySideBar.defaultVisibility");e.updateValue("workbench.secondarySideBar.defaultVisibility",t!=="hidden"?"hidden":"visible")}});W(class extends K{constructor(){super({id:"workbench.action.chat.editToolApproval",title:L(5376,"Manage Tool Approval"),metadata:{description:L(5375,"Edit/manage the tool approval and confirmation preferences for AI chat agents.")},precondition:ie.enabled,f1:!0,category:vi})}async run(i,e){let t=i.get(gD),o=i.get(jn);t.manageConfirmationPreferences([...o.getAllToolsIncludingDisabled()],e?{defaultScope:e}:void 0)}});var WMe=new Q("chatEdits.isGlobalEditingSession",void 0,d(6444,null)),mI=new Q("chatEdits.hasEditorModifications",void 0,d(6447,null)),uee=new Q("chatEdits.isCurrentlyBeingModified",void 0,d(6448,null)),pee=new Q("chatEdits.isReviewModeEnabled",!0,d(6446,null)),EB=new Q("chatEdits.isRequestInProgress",!1,d(6445,null)),a6o=new Q("chatEdits.requestCount",0,d(6449,null)),wBt=new Q("chatEdits.cursorInChangeRange",!1,d(6443,null)),mme=class{constructor(i,e){this._store=new P;let t=this._store.add(new jt),o=ui(this,H.any(e.onDidAddGroup,e.onDidRemoveGroup),()=>e.groups);this._store.add(he(n=>{let r=new Set(t.keys());for(let s of o.read(n))r.delete(s),!t.has(s)&&t.set(s,i.createInstance(fet,s));for(let s of r)t.deleteAndDispose(s)}))}static{this.ID="chat.edits.editorContextKeys"}dispose(){this._store.dispose()}};mme=I([m(0,F),m(1,Et)],mme);var fet=class{constructor(i,e,t,o){this._store=new P;this._ctxIsGlobalEditingSession=WMe.bindTo(i.scopedContextKeyService),this._ctxHasEditorModification=mI.bindTo(i.scopedContextKeyService),this._ctxIsCurrentlyBeingModified=uee.bindTo(i.scopedContextKeyService),this._ctxHasRequestInProgress=EB.bindTo(i.scopedContextKeyService),this._ctxReviewModeEnabled=pee.bindTo(i.scopedContextKeyService),this._ctxRequestCount=a6o.bindTo(i.scopedContextKeyService);let n=ui(this,i.onDidModelChange,()=>i.activeEditor),r=Ce(s=>{let l=n.read(s),c=no.getOriginalUri(l,{supportSideBySide:1});if(!c){this._reset();return}return new vet(c,t,e).value.read(s)});this._store.add(he(s=>{let l=r.read(s);if(!l){this._reset();return}let{session:c,entry:u}=l,p=o.getSession(c.chatSessionResource);this._ctxHasEditorModification.set(u?.state.read(s)===0),this._ctxIsGlobalEditingSession.set(c.isGlobalEditingSession),this._ctxReviewModeEnabled.set(u?u.reviewMode.read(s):!1),this._ctxHasRequestInProgress.set(p?.requestInProgress.read(s)??!1),this._ctxIsCurrentlyBeingModified.set(!!u?.isCurrentlyBeingModifiedBy.read(s));let h=p?ui(this,p.onDidChange,()=>p.getRequests().length):Oo(0);this._ctxRequestCount.set(h.read(s))}))}_reset(){this._ctxIsGlobalEditingSession.reset(),this._ctxHasEditorModification.reset(),this._ctxHasRequestInProgress.reset(),this._ctxReviewModeEnabled.reset(),this._ctxRequestCount.reset()}dispose(){this._store.dispose(),this._reset()}};fet=I([m(1,Ik),m(2,dl),m(3,Si)],fet);var vet=class{constructor(i,e,t){let o=ui(this,t.onDidChangeSessions,()=>t.getSessionByTextModel(i)),n=e.editingSessionsObs.map((r,s)=>{for(let l of r){let c=l.readEntry(i,s);if(c)return{session:l,entry:c,isInlineChat:!1}}});this.value=Ce(r=>{let s=o.read(r);return s?{session:s.editingSession,entry:s.editingSession.readEntry(i,r),isInlineChat:!0}:n.read(r)})}};vet=I([m(1,dl),m(2,Ik)],vet);function l6o(a,i){let e=[],t=[];for(let o=a.original.startLineNumber;o<a.original.endLineNumberExclusive;o++){let n=i.originalModel.getLineContent(o);e.push(n)}for(let o=a.modified.startLineNumber;o<a.modified.endLineNumberExclusive;o++){let n=i.modifiedModel.getLineContent(o);t.push(n)}return{originalText:e.join(`
`),modifiedText:t.join(`
`)}}function c6o(a,i=5){if(a.length===0)return[];let e=[],t=[a[0]];for(let o=1;o<a.length;o++){let n=t[0],r=a[o],s=n.modified.startLineNumber;r.modified.startLineNumber-s<=i?t.push(r):(e.push(t),t=[r])}return t.length>0&&e.push(t),e}var _Ci=class a extends C{constructor(e,t,o,n,r,s){super();this._editor=e;this._changes=t;this._chatWidgetService=n;this._viewsService=r;this._chatSessionResource=s;this._id=`chat-explanation-widget-${a._idPool++}`;this._explanationItems=new Map;this._position=null;this._explanations=[];this._isExpanded=!0;this._isAllRead=!1;this._disposed=!1;this._startLineNumber=1;this._eventStore=this._register(new P);this._uri=o.modifiedModel.uri,this._rangeHighlightDecoration=this._editor.createDecorationsCollection(),this._explanations=this._changes.map(c=>{let{originalText:u,modifiedText:p}=l6o(c,o);return{startLineNumber:c.modified.startLineNumber,endLineNumber:c.modified.endLineNumberExclusive-1,explanation:d(6464,null),read:!1,loading:!0,originalText:u,modifiedText:p}}),this._domNode=_("div.chat-explanation-widget"),this._headerNode=_("div.chat-explanation-header"),this._readIndicator=_("div.chat-explanation-read-indicator"),this._updateReadIndicator(),this._headerNode.appendChild(this._readIndicator),this._titleNode=_("span.chat-explanation-title"),this._updateTitle(),this._headerNode.appendChild(this._titleNode),this._headerNode.appendChild(_("span.chat-explanation-spacer")),this._toggleButton=_("div.chat-explanation-toggle"),this._updateToggleButton(),this._headerNode.appendChild(this._toggleButton),this._dismissButton=_("div.chat-explanation-dismiss"),this._dismissButton.appendChild(Qo(M.close)),this._dismissButton.title=d(6461,null),this._headerNode.appendChild(this._dismissButton),this._domNode.appendChild(this._headerNode),this._bodyNode=_("div.chat-explanation-body"),this._buildExplanationItems(),this._domNode.appendChild(this._bodyNode);let l=_("div.chat-explanation-arrow");this._domNode.appendChild(l),this._setupEventHandlers(),this._domNode.classList.add("visible"),this._editor.addOverlayWidget(this)}static{this._idPool=0}_setupEventHandlers(){this._eventStore.add(j(this._readIndicator,"click",e=>{e.stopPropagation(),this._isAllRead=!this._isAllRead;for(let t of this._explanations)t.read=this._isAllRead;this._updateReadIndicator(),this._updateExplanationItemsReadState()})),this._eventStore.add(j(this._toggleButton,"click",e=>{e.stopPropagation(),this._toggleExpanded()})),this._eventStore.add(j(this._headerNode,"click",()=>{this._toggleExpanded()})),this._eventStore.add(j(this._dismissButton,"click",e=>{e.stopPropagation(),this._dismiss()}))}_toggleExpanded(){this._isExpanded=!this._isExpanded,this._bodyNode.classList.toggle("collapsed",!this._isExpanded),this._updateToggleButton(),this._editor.layoutOverlayWidget(this)}_dismiss(){this._domNode.classList.add("fadeOut");let e=()=>{this.dispose()},t=setTimeout(e,150);this._domNode.addEventListener("animationend",()=>{clearTimeout(t),e()},{once:!0})}_updateReadIndicator(){Rt(this._readIndicator);let e=this._explanations.every(o=>o.read),t=this._explanations.some(o=>o.read);this._isAllRead=e,e?(this._readIndicator.appendChild(Qo(M.circle)),this._readIndicator.classList.add("read"),this._readIndicator.classList.remove("partial","unread"),this._readIndicator.title=d(6469,null)):t?(this._readIndicator.appendChild(Qo(M.circleFilled)),this._readIndicator.classList.remove("read","unread"),this._readIndicator.classList.add("partial"),this._readIndicator.title=d(6467,null)):(this._readIndicator.appendChild(Qo(M.circleFilled)),this._readIndicator.classList.remove("read","partial"),this._readIndicator.classList.add("unread"),this._readIndicator.title=d(6468,null))}_updateTitle(){let e=this._explanations.length;e===1?this._titleNode.textContent=d(6471,null):this._titleNode.textContent=d(6470,null,e)}_updateToggleButton(){Rt(this._toggleButton),this._isExpanded?(this._toggleButton.appendChild(Qo(M.chevronUp)),this._toggleButton.title=d(6460,null)):(this._toggleButton.appendChild(Qo(M.chevronDown)),this._toggleButton.title=d(6462,null))}_buildExplanationItems(){Rt(this._bodyNode),this._explanationItems.clear();for(let e=0;e<this._explanations.length;e++){let t=this._explanations[e],o=_("div.chat-explanation-item"),n=_("span.chat-explanation-line-info");t.startLineNumber===t.endLineNumber?n.textContent=d(6465,null,t.startLineNumber):n.textContent=d(6466,null,t.startLineNumber,t.endLineNumber),o.appendChild(n);let r=_("span.chat-explanation-text");if(t.loading){let c=Qo(q.modify(M.loading,"spin"));c.classList.add("chat-explanation-loading"),r.appendChild(c);let u=document.createTextNode(" "+t.explanation);r.appendChild(u)}else r.textContent=t.explanation;o.appendChild(r);let s=_("div.chat-explanation-item-read");this._updateItemReadIndicator(s,t.read),o.appendChild(s);let l=_("div.chat-explanation-reply-button");l.appendChild(Qo(M.arrowRight)),l.title=d(6463,null),o.appendChild(l),this._eventStore.add(j(l,"click",async c=>{c.stopPropagation();let u=new z(t.startLineNumber,1,t.endLineNumber,1),p;this._chatSessionResource?p=await this._chatWidgetService.openSession(this._chatSessionResource):(await this._viewsService.openView(Vr,!0),p=this._chatWidgetService.lastFocusedWidget),p&&p.attachmentModel.addContext(p.attachmentModel.asFileVariableEntry(this._uri,u))})),this._eventStore.add(j(o,"click",c=>{c.stopPropagation(),t.read=!t.read,this._updateItemReadIndicator(s,t.read),this._updateReadIndicator()})),this._eventStore.add(j(o,"mouseenter",()=>{let c=new z(t.startLineNumber,1,t.endLineNumber,this._editor.getModel()?.getLineMaxColumn(t.endLineNumber)??1);this._rangeHighlightDecoration.set([{range:c,options:{description:"chat-explanation-range-highlight",className:"rangeHighlight",isWholeLine:!0,linesDecorationsClassName:"chat-explanation-range-glyph"}},{range:c,options:{description:"chat-explanation-range-highlight-overview",overviewRuler:{color:Ss(y9),position:7}}}])})),this._eventStore.add(j(o,"mouseleave",()=>{this._rangeHighlightDecoration.clear()})),this._explanationItems.set(e,{item:o,readIndicator:s,textElement:r}),this._bodyNode.appendChild(o)}}setExplanationByLineNumber(e,t,o){for(let n=0;n<this._explanations.length;n++){let r=this._explanations[n];if(r.startLineNumber===e&&r.endLineNumber===t)return r.explanation=o,r.loading=!1,this._updateExplanationText(n),!0}return!1}get explanationCount(){return this._explanations.length}_updateExplanationText(e){let t=this._explanationItems.get(e),o=this._explanations[e];t&&o&&(Rt(t.textElement),t.textElement.textContent=o.explanation)}_updateItemReadIndicator(e,t){Rt(e),t?(e.appendChild(Qo(M.circle)),e.classList.add("read"),e.classList.remove("unread")):(e.appendChild(Qo(M.circleFilled)),e.classList.remove("read"),e.classList.add("unread"))}_updateExplanationItemsReadState(){this._explanationItems.forEach(({readIndicator:e},t)=>{let o=this._explanations[t];this._updateItemReadIndicator(e,o.read)})}layout(e){if(this._disposed)return;this._startLineNumber=e;let t=this._editor.getOption(75),{contentLeft:o,contentWidth:n,verticalScrollbarWidth:r}=this._editor.getLayoutInfo(),s=this._editor.getScrollTop(),l=yl(this._domNode)||280;this._position={stackOrdinal:2,preference:{top:this._editor.getTopForLineNumber(e)-s-t,left:o+n-(2*r+l)}},this._editor.layoutOverlayWidget(this)}toggle(e){this._domNode.classList.toggle("visible",e),e&&this._explanations.length>0&&this.layout(this._explanations[0].startLineNumber)}relayout(){this._startLineNumber&&this.layout(this._startLineNumber)}getId(){return this._id}getDomNode(){return this._domNode}getPosition(){return this._position}dispose(){this._disposed||(this._disposed=!0,this._rangeHighlightDecoration.clear(),this._editor.removeOverlayWidget(this),super.dispose())}},VMe=class extends C{constructor(e,t,o,n,r){super();this._editor=e;this._chatWidgetService=t;this._viewsService=o;this._modelUri=r;this._widgets=[];this._visible=!1;this._register(this._editor.onDidChangeModel(()=>{let s=this._editor.getModel()?.uri;if(this._modelUri)if(s&&s.toString()===this._modelUri.toString())for(let l of this._widgets)l.toggle(this._visible),l.relayout();else for(let l of this._widgets)l.toggle(!1)})),this._register(he(s=>{let c=n.state.read(s).get(this._modelUri);c?(this._diffInfo=c.diffInfo,this._chatSessionResource=c.chatSessionResource,this._widgets.length===0&&this._diffInfo&&this._createWidgets(this._diffInfo,this._chatSessionResource),c.progress==="complete"&&this._handleExplanations(this._modelUri,c.explanations),this.show()):this.hide()}))}_createWidgets(e,t){if(e.identical||e.changes.length===0)return;let o=c6o(e.changes,5);for(let n of o){let r=new _Ci(this._editor,n,e,this._chatWidgetService,this._viewsService,t);this._widgets.push(r),this._register(r),r.layout(n[0].modified.startLineNumber)}this._register(H.any(this._editor.onDidScrollChange,this._editor.onDidLayoutChange)(()=>{for(let n of this._widgets)n.relayout()}))}_handleExplanations(e,t){if(!(!this._modelUri||e.toString()!==this._modelUri.toString())){for(let o of t)for(let n of this._widgets)if(n.setExplanationByLineNumber(o.startLineNumber,o.endLineNumber,o.explanation))break}}show(){this._visible=!0;for(let e of this._widgets)e.toggle(!0),e.relayout()}hide(){this._visible=!1;for(let e of this._widgets)e.toggle(!1)}_clearWidgets(){for(let e of this._widgets)e.dispose();this._widgets.length=0}dispose(){this._clearWidgets(),super.dispose()}};var hme=ae("chatEditingExplanationModelManager");function d6o(a,i){let e=[],t=[];for(let o=a.original.startLineNumber;o<a.original.endLineNumberExclusive;o++){let n=i.originalModel.getLineContent(o);e.push(n)}for(let o=a.modified.startLineNumber;o<a.modified.endLineNumberExclusive;o++){let n=i.modifiedModel.getLineContent(o);t.push(n)}return{originalText:e.join(`
`),modifiedText:t.join(`
`)}}var bet=class extends C{constructor(e){super();this._languageModelsService=e;this._state=Le(this,new vt);this.state=this._state}_updateUriState(e,t){let o=this._state.get(),n=new vt(o);n.set(e,t),this._state.set(n,void 0)}_updateUriStatePartial(e,t){let o=this._state.get(),n=o.get(e);if(n){let r=new vt(o);r.set(e,{...n,...t}),this._state.set(r,void 0)}}_removeUris(e){let t=this._state.get(),o=new vt(t);for(let n of e)o.delete(n);this._state.set(o,void 0)}generateExplanations(e,t,o){let n=e.map(l=>l.modifiedModel.uri),r=new $e(o);for(let l of e)this._updateUriState(l.modifiedModel.uri,{progress:"loading",explanations:[],diffInfo:l,chatSessionResource:t});let s=this._doGenerateExplanations(e,r.token);return{uris:n,completed:s,dispose:()=>{r.dispose(!0),this._removeUris(n)}}}async _doGenerateExplanations(e,t){let o=[];for(let s of e)s.changes.length===0||s.identical?this._updateUriStatePartial(s.modifiedModel.uri,{progress:"complete",explanations:[]}):o.push(s);if(o.length===0)return;let n=o.map(s=>{let l=s.modifiedModel.uri,c=Ye(l),u=s.changes.map(p=>{let{originalText:h,modifiedText:g}=d6o(p,s);return{startLineNumber:p.modified.startLineNumber,endLineNumber:p.modified.endLineNumberExclusive-1,originalText:h,modifiedText:g}});return{uri:l,fileName:c,changes:u}}),r=n.reduce((s,l)=>s+l.changes.length,0);try{let s=await this._languageModelsService.selectLanguageModels({vendor:"copilot",id:"copilot-fast"});if(!s.length){for(let b of n)this._updateUriStatePartial(b.uri,{progress:"error",explanations:[],errorMessage:d(6459,null)});return}if(t.isCancellationRequested)return;let l=0,c=n.map(b=>b.changes.map(S=>{let y=`=== CHANGE ${l} (File: ${b.fileName}, Lines ${S.startLineNumber}-${S.endLineNumber}) ===
BEFORE:
${S.originalText||"(empty)"}
AFTER:
${S.modifiedText||"(empty)"}`;return l++,y}).join(`
`)).join(`
`),u=n.length,p=`Analyze these ${r} code changes across ${u} file${u>1?"s":""} and provide a brief explanation for each one.
These changes are part of a single coherent modification, so consider how they relate to each other.
${c}
Respond with a JSON array containing exactly ${r} objects, one for each change in order.
Each object should have an "explanation" field with a brief sentence (max 15 words) explaining what changed and why.
Be specific about the actual code changes. Return ONLY valid JSON, no markdown.
Example response format:
[{"explanation": "Added null check to prevent crash"}, {"explanation": "Renamed variable for clarity"}]`,h=await this._languageModelsService.sendChatRequest(s[0],void 0,[{role:1,content:[{type:"text",value:p}]}],{},t),g="";for await(let b of h.stream){if(t.isCancellationRequested)return;if(Array.isArray(b))for(let S of b)S.type==="text"&&(g+=S.value);else b.type==="text"&&(g+=b.value)}if(await h.result,t.isCancellationRequested)return;let f=[];try{let b=g.trim();b.startsWith("```")&&(b=b.replace(/^```(?:json)?\n?/,"").replace(/\n?```$/,"")),f=JSON.parse(b)}catch{}let v=0;for(let b of n){let S=[];for(let y of b.changes){let w=f[v]?.explanation?.trim()||d(6457,null);S.push({uri:b.uri,startLineNumber:y.startLineNumber,endLineNumber:y.endLineNumber,originalText:y.originalText,modifiedText:y.modifiedText,explanation:w}),v++}this._updateUriStatePartial(b.uri,{progress:"complete",explanations:S})}}catch(s){if(!t.isCancellationRequested){let l=s instanceof Error?s.message:d(6458,null);for(let c of n)this._updateUriStatePartial(c.uri,{progress:"error",explanations:[],errorMessage:l})}}}};bet=I([m(0,Wr)],bet);we(hme,bet,1);var l3=class extends K{constructor(i){super({category:vi,...i})}async run(i,...e){let t=i.get(F),o=i.get(dl),n=i.get(ee),r=no.getOriginalUri(n.activeEditorPane?.input,{supportSideBySide:1});if(!r||!n.activeEditorPane)return;let s=o.editingSessionsObs.get().find(u=>u.getEntry(r));if(!s)return;let l=s.getEntry(r),c=l.getEditorIntegration(n.activeEditorPane);return t.invokeFunction(this.runChatEditingCommand.bind(this),s,l,c,...e)}},CBt=class extends l3{constructor(e){super({id:e?"chatEditor.action.navigateNext":"chatEditor.action.navigatePrevious",title:e?L(6438,"Go to Next Chat Edit"):L(6439,"Go to Previous Chat Edit"),icon:e?M.arrowDown:M.arrowUp,precondition:x.and(ie.enabled,mI),keybinding:{primary:e?575:1599,weight:200,when:x.and(mI,x.or(ue.focus,$u))},f1:!0,menu:{id:D.ChatEditingEditorContent,group:"navigate",order:e?3:2,when:x.and(pee,mI)}});this.next=e}async runChatEditingCommand(e,t,o,n){let r=e.get(F);(this.next?n.next(!1):n.previous(!1))||await r.invokeFunction(OCi,t,o,this.next)||(this.next?n.next(!0):n.previous(!0))}};async function OCi(a,i,e,t){let o=a.get(ee),n=i.entries.get(),r=n.indexOf(e),s;for(;r=(r+(t?1:-1)+n.length)%n.length,s=n[r],s.state.get()!==0;)if(s===e)return!1;let l=await o.openEditor({resource:s.modifiedURI,options:{revealIfOpened:!1,revealIfVisible:!1}},Un);return l?(i.entries.get().includes(s)&&s.getEditorIntegration(l).reveal(t),!0):!1}var xBt=class extends l3{constructor(e,t){super({id:e,title:t?L(6422,"Keep Chat Edits"):L(6432,"Undo Chat Edits"),shortTitle:t?L(6423,"Keep"):L(6433,"Undo"),tooltip:t?L(6424,"Keep Chat Edits in this File"):L(6434,"Undo Chat Edits in this File"),precondition:x.and(mI,uee.negate()),icon:t?M.check:M.discard,f1:!0,keybinding:{when:x.or(ue.focus,rr),weight:210,primary:t?3127:3116},menu:{id:D.ChatEditingEditorContent,group:"a_resolve",order:t?0:1,when:x.and(t?void 0:pee,x.or(WMe,EB.negate()))}});this._keep=t}async runChatEditingCommand(e,t,o,n){let r=e.get(F);this._keep?t.accept(o.modifiedURI):t.reject(o.modifiedURI),await r.invokeFunction(OCi,t,o,!0)}},gme=class a extends xBt{static{this.ID="chatEditor.action.accept"}constructor(){super(a.ID,!0)}},Iet=class a extends xBt{static{this.ID="chatEditor.action.reject"}constructor(){super(a.ID,!1)}},Rdo="chatEditor.action.acceptHunk",Mdo="chatEditor.action.undoHunk",kBt=class extends l3{constructor(e){super({id:e?Rdo:Mdo,title:e?L(6428,"Keep this Change"):L(6441,"Undo this Change"),shortTitle:e?L(6429,"Keep"):L(6442,"Undo"),precondition:x.and(mI,uee.negate()),f1:!0,keybinding:{when:x.and(wBt,x.or(ue.focus,$u)),weight:201,primary:e?2103:2092},menu:{id:D.ChatEditingEditorHunk,order:1}});this._accept=e}async runChatEditingCommand(e,t,o,n,...r){let s=e.get(F);this._accept?await n.acceptNearestChange(r[0]):await n.rejectNearestChange(r[0]),o.changesCount.get()===0&&await s.invokeFunction(OCi,t,o,!0)}},DCi=class extends kBt{static{this.ID=Rdo}constructor(){super(!0)}},LCi=class extends kBt{static{this.ID=Mdo}constructor(){super(!1)}},RCi=class extends l3{constructor(){super({id:"chatEditor.action.toggleDiff",title:L(6431,"Toggle Diff Editor for Chat Edits"),category:vi,toggled:{condition:x.or(ue.inDiffEditor,fr.isEqualTo(SY)),icon:M.goToFile},precondition:x.and(mI),icon:M.diffSingle,keybinding:{when:ue.focus,weight:200,primary:1601},menu:[{id:D.ChatEditingEditorHunk,order:10},{id:D.ChatEditingEditorContent,group:"a_resolve",order:2,when:x.and(pee)},{id:D.ChatEditorInlineExecute,group:"a_resolve",order:2,when:x.and(pee,FZe)}]})}runChatEditingCommand(i,e,t,o,...n){o.toggleDiff(n[0])}},MCi=class extends l3{constructor(){super({id:"chatEditor.action.showAccessibleDiffView",title:L(6430,"Show Accessible Diff View for Chat Edits"),f1:!0,precondition:x.and(mI,uee.negate()),keybinding:{when:x.and(ue.focus,$a),weight:200,primary:65}})}runChatEditingCommand(i,e,t,o){o.enableAccessibleDiffView()}},PCi=class extends l3{constructor(){super({id:"chatEditor.action.reviewChanges",title:L(6440,"Review"),precondition:x.and(mI,uee.negate()),menu:[{id:D.ChatEditingEditorContent,group:"a_resolve",order:3,when:x.and(pee.negate(),uee.negate(),x.or(WMe,EB.negate()))}]})}runChatEditingCommand(i,e,t,o,...n){t.enableReviewModeUntilSettled()}},ACi=class a extends l3{static{this.ID="chatEditor.action.acceptAllEdits"}constructor(){super({id:a.ID,title:L(6426,"Keep All Chat Edits"),tooltip:L(6427,"Keep All Chat Edits in this Session"),precondition:x.and(mI,uee.negate()),icon:M.checkAll,f1:!0,keybinding:{when:x.or(ue.focus,rr),weight:210,primary:2615}})}async runChatEditingCommand(i,e,t,o,...n){await e.accept()}},EBt=class extends K{constructor(e){super({id:e?"chatEditing.multidiff.acceptAllFiles":"chatEditing.multidiff.discardAllFiles",title:e?d(6425,null):d(6435,null),icon:e?M.check:M.discard,menu:{when:x.equals("resourceScheme",_z),id:D.EditorTitle,order:e?0:1,group:"navigation"}});this.accept=e}async run(e,...t){let o=e.get(dl),n=e.get(ee),r=e.get(Et),s=e.get(fo),c=lp(t,n,r,s).groupedEditors[0];if(!c)return;let u=c.editors[0];if(!(u instanceof xu)||!u.resource)return;let{chatSessionResource:p}=EQe(u.resource),h=o.getEditingSession(p);h&&(this.accept?await h.accept():await h.reject(),n.closeEditor({editor:u,groupId:c.group.id}))}},u6o=[_z,"copilotcli-worktree-changes","copilotcloud-pr-changes"],NCi=class extends K{constructor(){super({id:"chatEditing.multidiff.explain",title:d(6436,null),menu:{when:x.and(x.or(...u6o.map(e=>x.equals("resourceScheme",e))),x.has("config.chat.editing.explainChanges.enabled")),id:D.MultiDiffEditorContent,order:10}});this._widgetsByInput=new WeakMap}async run(e,...t){let o=e.get(ee),n=e.get(hme),r=e.get(At),s=e.get(Ft),l=e.get(dl),c=o.activeEditorPane;if(!c||!(c instanceof Eg)||!c.viewModel)return;let u=c.input;if(!u)return;this._widgetsByInput.get(u)?.dispose();let p=new P;this._widgetsByInput.set(u,p),H.once(u.onWillDispose)(()=>{p.dispose(),this._widgetsByInput.delete(u)});let g=c.viewModel.items.get(),f;if(u instanceof xu&&u.resource?.scheme===_z&&(f=EQe(u.resource).chatSessionResource),!f){let S=g.map(y=>{let w=y.documentDiffItem,k=w?.multiDiffEditorItem?.goToFileUri;if(k)return k;let T=w?.multiDiffEditorItem?.modifiedUri??y.modifiedUri;if(T?.path)return A.file(T.path)}).filter(y=>!!y);for(let y of l.editingSessionsObs.get())if(S.some(w=>y.getEntry(w))){f=y.chatSessionResource;break}}let v=new Map;for(let S of g){let y=S.modifiedUri;if(!y)continue;let w=c.tryGetCodeEditor(y);if(!w)continue;let k=S.diffEditorViewModel;await k.waitForDiff();let T=k.diff.get();if(!T||T.identical)continue;let N=y.toString(),O=v.get(N);O?O.changes.push(...T.mappings.map(V=>V.lineRangeMapping)):v.set(N,{editor:w.editor,changes:T.mappings.map(V=>V.lineRangeMapping),originalModel:k.model.original,modifiedModel:k.model.modified})}let b=[];for(let S of v.values()){let y={changes:S.changes,identical:!1,originalModel:S.originalModel,modifiedModel:S.modifiedModel};b.push(y);let w=new VMe(S.editor,r,s,n,y.modifiedModel.uri);p.add(w)}b.length>0&&p.add(n.generateExplanations(b,f,ve.None))}};function Pdo(){W(class extends CBt{constructor(){super(!0)}}),W(class extends CBt{constructor(){super(!1)}}),W(PCi),W(gme),W(Iet),W(ACi),W(DCi),W(LCi),W(RCi),W(MCi),W(class extends EBt{constructor(){super(!0)}}),W(class extends EBt{constructor(){super(!1)}}),W(NCi),fe.appendMenuItem(D.ChatEditingEditorContent,{command:{id:FCi,title:d(6437,null),precondition:x.false()},group:"navigate",order:-1,when:x.and(pee,mI)})}var FCi="chatEditor.navigation.bearings";var Cet=class extends Lr{constructor(e,t,o,n,r,s=[gme.ID]){super(void 0,e,{...t,icon:!1,label:!0,keybindingNotRenderedWithLabel:!0});this._entry=o;this._editor=n;this._keybindingService=r;this._primaryActionIds=s;this._reveal=this._store.add(new me)}render(e){if(super.render(e),this._primaryActionIds.includes(this._action.id)&&this.element?.classList.add("primary"),this._action.id===gme.ID){let t=this._store.add(new me);this._store.add(he(o=>{So(this.label),So(this.element);let n=this._entry.read(o)?.autoAcceptController.read(o);if(n){let r=-100*(n.remaining/n.total);this.element.style.setProperty("--vscode-action-item-auto-timeout",`${r}%`),this.element.classList.toggle("auto",!0),t.value=$be(this.element,()=>n.cancel())}else this.element.classList.toggle("auto",!1),t.clear()}))}}set actionRunner(e){super.actionRunner=e,this._editor&&(this._reveal.value=e.onWillRun(t=>{this._editor.focus()}))}get actionRunner(){return super.actionRunner}getTooltip(){let e=super.getTooltip();return e&&this._keybindingService.appendKeybinding(e,this._action.id)}},yet=class extends C{constructor(e,t,o){super();this._editor=e;this._keybindingService=t;this._instaService=o;this._showStore=this._store.add(new P);this._session=Le(this,void 0);this._entry=Le(this,void 0);this._navigationBearings=Le(this,{changeCount:-1,activeIdx:-1,entriesCount:-1});this._domNode=document.createElement("div"),this._domNode.classList.add("chat-editor-overlay-widget"),this._isBusy=Ce(s=>this._entry.read(s)?.waitsForLastEdits.read(s));let n=document.createElement("div");n.classList.add("chat-editor-overlay-progress"),R(n,Qo(q.modify(M.loading,"spin")));let r=R(n,_("span.progress-message"));this._domNode.appendChild(n),this._store.add(he(s=>{let l=this._isBusy.read(s);this._domNode.classList.toggle("busy",l),r.innerText=""})),this._toolbarNode=document.createElement("div"),this._toolbarNode.classList.add("chat-editor-overlay-toolbar")}dispose(){this.hide(),super.dispose()}getDomNode(){return this._domNode}show(e,t,o){this._showStore.clear(),Ui(n=>{this._session.set(e,n),this._entry.set(t,n)}),this._showStore.add(he(n=>{let r=o.entryIndex.read(n),s=o.changeIndex.read(n),l=e.entries.read(n),c=r!==void 0&&s!==void 0?s:-1,u=0;for(let p=0;p<l.length;p++){let h=l[p].changesCount.read(n);u+=h,r!==void 0&&p<r&&(c+=h)}this._navigationBearings.set({changeCount:u,activeIdx:c,entriesCount:l.length},void 0)})),this._domNode.appendChild(this._toolbarNode),this._showStore.add(Z(()=>this._toolbarNode.remove())),this._showStore.add(this._instaService.createInstance(Ln,this._toolbarNode,D.ChatEditingEditorContent,{telemetrySource:"chatEditor.overlayToolbar",hiddenItemStrategy:0,toolbarOptions:{primaryGroup:()=>!0,useSeparatorsInPrimaryActions:!0},menuOptions:{renderShortTitle:!0},actionViewItemProvider:(n,r)=>{let s=this;if(n.id===FCi)return new class extends Lr{constructor(){super(void 0,n,{...r,icon:!1,label:!0,keybindingNotRenderedWithLabel:!0})}render(l){super.render(l),l.classList.add("label-item"),this._store.add(he(c=>{So(this.label);let{changeCount:u,activeIdx:p}=s._navigationBearings.read(c);if(u>0){let h=p===-1?"1":`${p+1}`;this.label.innerText=d(6451,null,h,u)}else this.label.innerText=d(6450,null);this.updateTooltip()}))}getTooltip(){let{changeCount:l,entriesCount:c}=s._navigationBearings.get();if(l===-1||c===-1)return;let u;return l===1&&c===1?u=d(6452,null):l===1?u=d(6453,null,c):c===1?u=d(6455,null,l):u=d(6456,null,l,c),s._isBusy.get()?d(6454,null,u):u}};if(n.id===gme.ID||n.id===Iet.ID)return new Cet(n,r,s._entry,s._editor,s._keybindingService)}}))}hide(){Ui(e=>{this._session.set(void 0,e),this._entry.set(void 0,e),this._navigationBearings.set({changeCount:-1,activeIdx:-1,entriesCount:-1},e)}),this._showStore.clear()}};yet=I([m(1,_e),m(2,F)],yet);var wet=class{constructor(i,e,t,o){this._store=new P;this._domNode=document.createElement("div");this._domNode.classList.add("chat-editing-editor-overlay"),this._domNode.style.position="absolute",this._domNode.style.bottom="24px",this._domNode.style.right="24px",this._domNode.style.zIndex="100";let n=t.createInstance(yet,e);this._domNode.appendChild(n.getDomNode()),this._store.add(Z(()=>this._domNode.remove())),this._store.add(n);let r=()=>{i.contains(this._domNode)||i.appendChild(this._domNode)},s=()=>{i.contains(this._domNode)&&(n.hide(),this._domNode.remove())},l=Nr(this,H.any(e.onDidActiveEditorChange,e.onDidModelChange)),c=hs({equalsFn:Xe},p=>{l.read(p);let h=e.activeEditorPane;return no.getOriginalUri(h?.input,{supportSideBySide:1})}),u=Ce(p=>{l.read(p);let h=c.read(p);if(h)for(let g of o.editingSessionsObs.read(p)){if(!g.isGlobalEditingSession)continue;let f=g.readEntry(h,p);if(f)return{session:g,entry:f}}});this._store.add(he(p=>{let h=u.read(p);if(!h){s();return}let{session:g,entry:f}=h;if(f?.state.read(p)===0){let v=e.activeEditorPane;So(v);let b=Ce(y=>f?f.getEditorIntegration(v).currentIndex.read(y):0),S=Ce(y=>f?g.entries.read(y).indexOf(f):0);n.show(g,f,{entryIndex:S,changeIndex:b}),r()}else s()}))}dispose(){this._store.dispose()}};wet=I([m(2,F),m(3,dl)],wet);var fme=class{constructor(i,e){this._store=new P;let t=ui(this,H.any(i.onDidAddGroup,i.onDidRemoveGroup),()=>i.groups),o=this._store.add(new jt);this._store.add(he(n=>{let r=new Set(o.keys()),s=t.read(n);for(let l of s)if(l instanceof Uf&&(r.delete(l),!o.has(l))){let c=e.createChild(new Io([X,l.scopedContextKeyService])),u=l.element,p=c.createInstance(wet,u,l);o.set(l,hn(p,c))}for(let l of r)o.deleteAndDispose(l)}))}static{this.ID="chat.edits.editorOverlay"}dispose(){this._store.dispose()}};fme=I([m(0,Et),m(1,F)],fme);var BMe=class extends C{constructor(e,t,o,n,r,s){super();this._editorObs=e;this._contextKeyService=t;this._menuService=o;this._position=Le(this,null);this.position=this._position;this._showStore=this._store.add(new P);this._anchorLineNumber=0;this._anchorLeft=0;this._anchorAbove=!1;this._domNode=_(".inline-chat-gutter-menu"),this._container=R(this._domNode,_(".inline-chat-gutter-container")),this._inputContainer=R(this._container,_(".input")),this._toolbarContainer=R(this._container,_(".toolbar"));let l=R(this._domNode,_(".inline-chat-gutter-actions")),c=this._store.add(new ji(l,{orientation:1,preventLoopNavigation:!0})),u=this._store.add(this._menuService.createMenu(D.ChatEditorInlineMenu,this._contextKeyService)),p=()=>{let V=Vm(u.getActions({shouldForwardArgs:!0}));c.clear(),c.push(V),mm(V.length>0,l)};this._store.add(u.onDidChange(p)),p();let h=Kf(s);h.wordWrap="off",h.wrappingStrategy="advanced",h.lineNumbers="off",h.glyphMargin=!1,h.lineDecorationsWidth=0,h.lineNumbersMinChars=0,h.folding=!1,h.minimap={enabled:!1},h.scrollbar={vertical:"hidden",horizontal:"hidden",alwaysConsumeMouseWheel:!0},h.renderLineHighlight="none",h.fontFamily=HN,h.fontSize=13,h.lineHeight=20,h.cursorWidth=1,h.padding={top:2,bottom:2};let g={isSimpleWidget:!0,contributions:aa.getSomeEditorContributions([GW.ID])};this._input=this._store.add(n.createInstance(jr,this._inputContainer,h,g));let f=this._store.add(r.createModel("",null,A.parse(`gutter-input:${Date.now()}`),!0));this._input.setModel(f);let v=this._store.add(n.createInstance(Ln,this._toolbarContainer,D.InlineChatInput,{telemetrySource:"inlineChatInput.toolbar",hiddenItemStrategy:-1,toolbarOptions:{primaryGroup:()=>!0},menuOptions:{shouldForwardArgs:!0}})),b=rb.get(this._editorObs.editor);this._stickyScrollHeight=b?ui(b.onDidChangeStickyScrollHeight,()=>b.stickyScrollWidgetHeight):Oo(0);let S=Le(this,0),y=new eL(()=>{S.set(yl(v.getElement()),void 0)});this._store.add(y),this._store.add(y.observe(v.getElement()));let w=ui(this,this._input.onDidChangeModelContent,()=>this._input.getContentWidth()),k=ui(this,this._input.onDidContentSizeChange,()=>this._input.getContentHeight());this._layoutData=Ce(V=>{let G=w.read(V)+6+S.read(V),$=220,te=600,pe=this._input.getOption(149)==="on"?te:Math.max($,Math.min(G,te)),de=this._input.getOption(75),se=Math.min(k.read(V),3*de);return G>pe&&this._input.updateOptions({wordWrap:"on"}),{editorPad:6,toolbarWidth:S.read(V),totalWidth:pe,height:se}}),this._store.add(he(V=>{let{editorPad:U,toolbarWidth:G,totalWidth:$,height:te}=this._layoutData.read(V),pe=$-G-U;this._container.style.width=`${$}px`,this._inputContainer.style.width=`${pe}px`,this._input.layout({width:pe,height:te})})),this._store.add(this._input.onDidFocusEditorText(()=>this._container.classList.add("focused"))),this._store.add(this._input.onDidBlurEditorText(()=>this._container.classList.remove("focused"))),this._store.add(this._input.onDidScrollChange(V=>{this._toolbarContainer.classList.toggle("fake-scroll-decoration",V.scrollTop>0)}));let T=Nwi.bindTo(this._contextKeyService);this._store.add(this._input.onDidChangeModelContent(()=>{T.set(this._input.getModel().getValue().trim().length>0)})),this._store.add(Z(()=>T.reset()));let N=Owi.bindTo(this._contextKeyService);this._store.add(this._input.onDidFocusEditorText(()=>N.set(!0))),this._store.add(this._input.onDidBlurEditorText(()=>N.set(!1))),this._store.add(Z(()=>N.reset())),this._store.add(this._input.onKeyDown(V=>{if(V.keyCode===18&&!c.isEmpty()){let U=this._input.getModel(),G=this._input.getPosition();G&&G.lineNumber===U.getLineCount()&&(V.preventDefault(),V.stopPropagation(),c.focus(0))}})),this._store.add(j(c.domNode,"keydown",V=>{let U=new Ii(V);if(U.keyCode===9)U.preventDefault(),U.stopPropagation(),this.hide();else if(U.keyCode===16){let G=c.viewItems[0];G?.element&&ts(G.element)&&(U.preventDefault(),U.stopPropagation(),this._input.focus())}},!0));let O=this._store.add(Vn(this._domNode));this._store.add(O.onDidBlur(()=>this.hide()))}get value(){return this._input.getModel().getValue().trim()}show(e,t,o,n){this._showStore.clear(),this._input.updateOptions({wordWrap:"off",placeholder:n}),this._input.getModel().setValue(""),this._anchorLineNumber=e,this._anchorLeft=t,this._anchorAbove=o,this._updatePosition(),this._showStore.add(this._editorObs.createOverlayWidget({domNode:this._domNode,position:this._position,minContentWidthInPx:Oo(0),allowEditorOverflow:!0})),o&&this._updatePosition(),this._showStore.add(this._editorObs.editor.onDidScrollChange(()=>{let s=this._editorObs.editor.getVisibleRanges().some(c=>this._anchorLineNumber>=c.startLineNumber&&this._anchorLineNumber<=c.endLineNumber),l=!!this._input.getModel().getValue();!s&&!l?this.hide():this._updatePosition()})),setTimeout(()=>this._input.focus(),0)}_updatePosition(){let e=this._editorObs.editor,t=e.getOption(75),o=e.getTopForLineNumber(this._anchorLineNumber)-e.getScrollTop(),n=o;if(this._anchorAbove){let g=this._domNode.offsetHeight;n=o-g}else n=o+t;let r=this._stickyScrollHeight.get(),s=e.getLayoutInfo(),l=this._domNode.offsetHeight,c=r,u=s.height-l,p=Math.max(c,Math.min(n,u)),h=p!==n;this._domNode.classList.toggle("clamped",h),this._position.set({preference:{top:p,left:this._anchorLeft},stackOrdinal:1e4},void 0)}hide(){let e=this._editorObs.editor.getDomNode();e&&ts(e)&&this._editorObs.editor.focus(),this._position.set(null,void 0),this._input.getModel().setValue(""),this._showStore.clear()}};BMe=I([m(1,X),m(2,qt),m(3,F),m(4,Ct),m(5,B)],BMe);var HMe=class extends C{constructor(e,t,o,n){super();this._editorObs=e;this._instaService=t;this._keybindingService=o;this._logService=n;this._domNode=document.createElement("div");this._showStore=this._store.add(new P);this._position=Le(this,null);this._minContentWidthInPx=Oo(0);this._domNode.classList.add("inline-chat-session-overlay-widget"),this._container=document.createElement("div"),this._domNode.appendChild(this._container),this._container.classList.add("inline-chat-session-overlay-container"),this._statusNode=document.createElement("div"),this._statusNode.classList.add("status"),this._icon=R(this._statusNode,_("span")),this._message=R(this._statusNode,_("span.message")),this._container.appendChild(this._statusNode),this._toolbarNode=document.createElement("div"),this._toolbarNode.classList.add("toolbar");let r=rb.get(this._editorObs.editor);this._stickyScrollHeight=r?ui(r.onDidChangeStickyScrollHeight,()=>r.stickyScrollWidgetHeight):Oo(0)}show(e){So(this._editorObs.editor.hasModel()),this._showStore.clear();let t=Ce(c=>e.editingSession.readEntry(e.uri,c)),o=Ce(c=>{let u=e?.chatModel;if(!e||!u)return;let p=u.lastRequestObs.read(c)?.response;if(!p)return{message:d(10600,null),icon:q.modify(M.loading,"spin")};if(p.isComplete){if(p.result?.errorDetails)return{message:d(10598,null),icon:M.error};let v=t.read(c)?.changesCount.read(c)??0;return{message:v===0?d(10595,null):v===1?d(10596,null):d(10597,null,v),icon:M.check}}if(p.isPendingConfirmation.read(c))return{message:d(10599,null),icon:M.error};let g=ff({equalsFn:()=>!1},p.onDidChange,()=>p.response.value).read(c).filter(f=>f.kind==="progressMessage"||f.kind==="toolInvocation").at(-1);return g?.kind==="toolInvocation"?{message:g.invocationMessage,icon:q.modify(M.loading,"spin")}:g?.kind==="progressMessage"?{message:g.content,icon:q.modify(M.loading,"spin")}:{message:d(10600,null),icon:q.modify(M.loading,"spin")}});this._showStore.add(he(c=>{let u=o.read(c);u?(this._message.innerText=qa(u.message),this._icon.className="",this._icon.classList.add(...q.asClassNameArray(u.icon))):(this._message.innerText="",this._icon.className="")})),this._showStore.add(he(c=>{let p=e.chatModel.lastRequestObs.read(c)?.response?.isPendingConfirmation.read(c);p&&this._logService.info(`[InlineChat] UNEXPECTED approval needed: ${p.detail??"unknown"}`)})),this._container.appendChild(this._toolbarNode),this._showStore.add(Z(()=>this._toolbarNode.remove()));let n=this;this._showStore.add(this._instaService.createInstance(Ln,this._toolbarNode,D.ChatEditorInlineExecute,{telemetrySource:"inlineChatProgress.overlayToolbar",hiddenItemStrategy:0,toolbarOptions:{primaryGroup:()=>!0,useSeparatorsInPrimaryActions:!0},menuOptions:{renderShortTitle:!0},actionViewItemProvider:(c,u)=>{let p=["inlineChat2.cancel","inlineChat2.keep","inlineChat2.close"];if(p.concat(["inlineChat2.undo"]).includes(c.id))return new Cet(c,{...u,keybinding:void 0},t,void 0,n._keybindingService,p)}}));let r=this._editorObs.getOption(75),s=Le(this,0),l=new eL(()=>{s.set(this._domNode.offsetWidth,void 0)});this._showStore.add(l),this._showStore.add(l.observe(this._domNode)),this._showStore.add(he(c=>{let u=this._editorObs.layoutInfo.read(c),p=this._stickyScrollHeight.read(c),h=s.read(c),g=Math.round(r.read(c)*2/3),f=u.contentWidth-2*g;this._domNode.style.maxWidth=`${f}px`;let v=p+g,b=u.width-h-u.verticalScrollbarWidth-u.minimap.minimapWidth-g;this._position.set({preference:{top:v,left:b},stackOrdinal:1e4},void 0)})),this._showStore.add(this._editorObs.createOverlayWidget({domNode:this._domNode,position:this._position,minContentWidthInPx:this._minContentWidthInPx,allowEditorOverflow:!1}))}hide(){this._position.set(null,void 0),this._showStore.clear()}};HMe=I([m(1,F),m(2,_e),m(3,ne)],HMe);var xet=class extends _x{constructor(e,t,o,n,r,s){super(e);this._options=t;this._contextMenuService=o;this._keybindingService=n;this._hoverService=s;this._store=new P;this._updateStore=new P;this._onDidChange=new E;this.onDidChange=this._onDidChange.event;this._actionRunner=this._store.add(new as),t?.telemetrySource&&this._actionRunner.onDidRun(l=>{r.publicLog2("workbenchActionExecuted",{id:l.action.id,from:t.telemetrySource})},void 0,this._store)}dispose(){this._onDidChange.dispose(),this._updateStore.dispose(),this._store.dispose(),super.dispose()}update(e,t){let o=this._options?.buttonConfigProvider??(()=>({showLabel:!0}));this._updateStore.clear(),this.clear();let n=this._updateStore.add(Gg());for(let r=0;r<e.length;r++){let s=r>0,l=e[r],c,u,p=l.tooltip||l.label;if(l instanceof $l||(p=this._keybindingService.appendKeybinding(p,l.id)),l instanceof $l&&l.actions.length>0){let[v,...b]=l.actions;c=v,u=this.addButtonWithDropdown({secondary:o(c,r)?.isSecondary??s,actionRunner:this._actionRunner,actions:b,contextMenuProvider:this._contextMenuService,ariaLabel:p,supportIcons:!0,small:this._options?.small})}else c=l,u=this.addButton({secondary:o(c,r)?.isSecondary??s,ariaLabel:p,supportIcons:!0,small:this._options?.small});u.enabled=c.enabled,u.checked=c.checked??!1,u.element.classList.add("default-colors");let h=o(c,r)?.showLabel??!0,g=o(c,r)?.customClass,f=o(c,r)?.customLabel;if(g&&u.element.classList.add(g),h?u.label=f??c.label:u.element.classList.add("monaco-text-button"),o(c,r)?.showIcon)if(c instanceof Eo&&q.isThemeIcon(c.item.icon))if(!h)u.icon=c.item.icon;else{let v=f??c.label;u.label=Mr(v)?new xe(`$(${c.item.icon.id}) ${v.value}`,{isTrusted:v.isTrusted,supportThemeIcons:!0,supportHtml:v.supportHtml}):`$(${c.item.icon.id}) ${v}`}else c.class&&u.element.classList.add(...c.class.split(" "));this._updateStore.add(this._hoverService.setupManagedHover(n,u.element,p)),this._updateStore.add(u.onDidClick(async()=>{if(this._options?.disableWhileRunning){u.enabled=!1;try{await this._actionRunner.run(c)}finally{u.enabled=c.enabled}}else this._actionRunner.run(c)}))}if(t.length>0){let r=this.addButton({secondary:!0,ariaLabel:d(1803,null),small:this._options?.small});r.icon=M.dropDownButton,r.element.classList.add("default-colors","monaco-text-button"),r.enabled=!0,this._updateStore.add(this._hoverService.setupManagedHover(n,r.element,d(1803,null))),this._updateStore.add(r.onDidClick(async()=>{this._contextMenuService.showContextMenu({getAnchor:()=>r.element,getActions:()=>t,actionRunner:this._actionRunner,onHide:()=>r.element.setAttribute("aria-expanded","false")}),r.element.setAttribute("aria-expanded","true")}))}this._onDidChange.fire(this)}};xet=I([m(2,ze),m(3,_e),m(4,Te),m(5,tt)],xet);var QF=class extends xet{constructor(i,e,t,o,n,r,s,l,c){super(i,t,r,s,l,c);let u=o.createMenu(e,n);this._store.add(u);let p=()=>{this.clear();let h=hl(u.getActions(t?.menuOptions),t?.toolbarOptions?.primaryGroup);super.update(h.primary,h.secondary)};this._store.add(u.onDidChange(p)),p()}dispose(){super.dispose()}update(i){throw new Error("Use Menu or WorkbenchButtonBar")}};QF=I([m(3,qt),m(4,X),m(5,ze),m(6,_e),m(7,Te),m(8,tt)],QF);var Ado="workbench.action.chat.markHelpful",mee="workbench.action.chat.markUnhelpful",UMe="config.telemetry.feedback.enabled";function Ndo(){W(class extends K{constructor(){super({id:"workbench.action.chat.markHelpful",title:L(5565,"Helpful"),f1:!1,category:vi,icon:M.thumbsup,toggled:ie.responseVote.isEqualTo("up"),menu:[{id:D.ChatMessageFooter,group:"navigation",order:2,when:x.and(ie.extensionParticipantRegistered,ie.isResponse,ie.responseHasError.negate(),x.has(UMe))},{id:IB,group:"navigation",order:1,when:x.and(ie.extensionParticipantRegistered,ie.isResponse,ie.responseHasError.negate(),x.has(UMe))}]})}run(i,...e){let t=e[0];if(!Vi(t))return;i.get(Si).notifyUserAction({agentId:t.agent?.id,command:t.slashCommand?.name,sessionResource:t.session.sessionResource,requestId:t.requestId,result:t.result,action:{kind:"vote",direction:1,reason:void 0}}),t.setVote(1),t.setVoteDownReason(void 0)}}),W(class extends K{constructor(){super({id:mee,title:L(5568,"Unhelpful"),f1:!1,category:vi,icon:M.thumbsdown,toggled:ie.responseVote.isEqualTo("down"),menu:[{id:D.ChatMessageFooter,group:"navigation",order:3,when:x.and(ie.extensionParticipantRegistered,ie.isResponse,x.has(UMe))},{id:IB,group:"navigation",order:2,when:x.and(ie.extensionParticipantRegistered,ie.isResponse,ie.responseHasError.negate(),x.has(UMe))}]})}run(i,...e){let t=e[0];if(!Vi(t))return;let o=e[1];if(typeof o!="string")return;t.setVote(0),t.setVoteDownReason(o),i.get(Si).notifyUserAction({agentId:t.agent?.id,command:t.slashCommand?.name,sessionResource:t.session.sessionResource,requestId:t.requestId,result:t.result,action:{kind:"vote",direction:0,reason:t.voteDownReason}})}}),W(class extends K{constructor(){super({id:"workbench.action.chat.reportIssueForBug",title:L(5567,"Report Issue"),f1:!1,category:vi,icon:M.report,menu:[{id:D.ChatMessageFooter,group:"navigation",order:4,when:x.and(ie.responseSupportsIssueReporting,ie.isResponse,x.has(UMe))},{id:IB,group:"navigation",order:3,when:x.and(ie.responseSupportsIssueReporting,ie.isResponse,x.has(UMe))}]})}run(i,...e){let t=e[0];if(!Vi(t))return;i.get(Si).notifyUserAction({agentId:t.agent?.id,command:t.slashCommand?.name,sessionResource:t.session.sessionResource,requestId:t.requestId,result:t.result,action:{kind:"bug"}})}}),W(class extends K{constructor(){super({id:"workbench.action.chat.retry",title:L(5562,"Retry"),f1:!1,category:vi,icon:M.refresh,menu:[{id:D.ChatMessageFooter,group:"navigation",when:x.and(ie.isResponse,x.in(ie.itemId.key,ie.lastItemId.key))},{id:D.ChatEditingWidgetToolbar,group:"navigation",when:Yj,order:0}]})}async run(i,...e){let t=i.get(At),o=i.get(NO),n=i.get(Si),r=i.get(B),s=i.get(ct),l=e[0];if(yXi(l)&&(l=t.getWidgetBySessionResource(l.sessionResource)?.viewModel?.getItems().at(-1)),!Vi(l))return;let c=n.getSession(l.sessionResource),u=c?.getRequests();if(!u)return;let p=u?.findIndex(b=>b.id===l.requestId),h=t.getWidgetBySessionResource(l.sessionResource),g=h?.input.currentModeKind;if(c&&(g==="edit"||g==="agent")){let b=h?.viewModel?.model.editingSession;if(!b)return;let S=b.entries.get().filter(T=>T.lastModifyingRequestId===l.requestId),w=S.length>0&&r.getValue("chat.editing.confirmEditRequestRetry")===!0?await s.confirm({title:d(5564,null),message:S.length===1?d(5560,null,Ye(S[0].modifiedURI)):d(5563,null,S.length),primaryButton:d(5561,null),checkbox:{label:d(5559,null),checked:!1},type:"info"}):{confirmed:!0};if(!w.confirmed)return;w.checkboxChecked&&await r.updateValue("chat.editing.confirmEditRequestRetry",!1);let k=u[p];k&&await b.restoreSnapshot(k.id,void 0)}let f=c?.getRequests().find(b=>b.id===l.requestId),v=h?.input.currentLanguageModel;o.acceptRequest(l.sessionResource),n.resendRequest(f,{userSelectedModelId:v,attempt:(f?.attempt??-1)+1,...h?.getModeRequestOptions()})}}),W(class extends K{constructor(){super({id:"workbench.action.chat.insertIntoNotebook",title:L(5566,"Insert into Notebook"),f1:!1,category:vi,icon:M.insert,menu:{id:D.ChatMessageFooter,group:"navigation",isHiddenByDefault:!0,when:x.and(Ua,ie.isResponse,ie.responseIsFiltered.negate())}})}async run(i,...e){let t=e[0];if(!Vi(t))return;let o=i.get(ee);if(o.activeEditorPane?.getId()===qL){let n=o.activeEditorPane.getControl();if(!n.hasModel()||n.isReadOnly)return;let r=t.response.toString(),s=p6o(r),l=n.getFocus(),c=Math.max(l.end,0);await i.get(ma).apply([new Iv(n.textModel.uri,{editType:1,index:c,count:0,cells:s.map(p=>{let h=p.type==="markdown"?1:2,g=p.type==="markdown"?"markdown":p.language,f=p.type==="markdown"?"text/markdown":`text/x-${p.language}`;return{cellKind:h,language:g,mime:f,source:p.content,outputs:[],metadata:{}}})})],{quotableLabel:"Insert into Notebook"})}}})}function p6o(a){let e=new Yc.Lexer().lex(a),t=[],o="";return e.forEach(n=>{n.type==="code"?(o.trim()&&(t.push({type:"markdown",content:o}),o=""),t.push({type:"code",language:n.lang||"",content:n.text})):o+=n.raw}),o.trim()&&t.push({type:"markdown",content:o}),t}var _Bt="http://_vscodecontentref_";function VCi(a){let i=0,e=[];for(let t of a){let o=e.findLastIndex(r=>r.kind!=="textEditGroup"&&r.kind!=="undoStop"),n=e[o];if(t.kind==="inlineReference"){let r=t.name;r||(A.isUri(t.inlineReference)?r=Ye(t.inlineReference):nv(t.inlineReference)?r=Ye(t.inlineReference.uri):r=t.inlineReference.name);let s=n?.kind==="markdownContent"?n.content.value:"";if(g6o(s))if(n?.kind==="markdownContent"){let l=ZZ(n.content,new xe(r));e[o]={...n,content:l}}else e.push({content:new xe(r),kind:"markdownContent"});else{let l=i++,c=A.parse(_Bt).with({path:String(l)}),u=`[${r}](${c.toString()})`,p={[l]:t};if(n?.kind==="markdownContent"){let h=ZZ(n.content,new xe(u));e[o]={...n,content:h,inlineReferences:{...p,...n.inlineReferences||{}}}}else e.push({content:new xe(u),inlineReferences:p,kind:"markdownContent"})}}else if(t.kind==="markdownContent"&&n?.kind==="markdownContent")if(GVt(n.content,t.content)){let r=ZZ(n.content,t.content);e[o]={...n,content:r}}else n.inlineReferences&&h6o(n.content.value)?e[o]={...n,content:{...t.content,value:n.content.value+t.content.value}}:e.push(t);else if(t.kind==="markdownVuln"){let s=`<vscode_annotation details='${encodeURIComponent(JSON.stringify(t.vulnerabilities))}'>${t.content.value}</vscode_annotation>`;if(n?.kind==="markdownContent"){let l=ZZ(n.content,new xe(s));e[o]={...n,content:l}}else e.push({content:new xe(s),kind:"markdownContent"})}else if(t.kind==="codeblockUri"){if(n?.kind==="markdownContent"){let r=t.isEdit?" isEdit":"",s=t.subAgentInvocationId?` subAgentInvocationId="${encodeURIComponent(t.subAgentInvocationId)}"`:"",l=`<vscode_codeblock_uri${r}${s}>${t.uri.toString()}</vscode_codeblock_uri>`,c=ZZ(n.content,new xe(l));e.splice(o,1),e.push({...n,content:c})}}else e.push(t)}return e}var m6o=new RegExp(`^(\\[.*?\\]\\(${_Bt}/\\d+\\))+$`);function h6o(a){return m6o.test(a)}function g6o(a){let i=a.split(`
`),e=!1,t="",o=0,n=[];for(let r of i){let s=r.trimStart();if(e){let c=TBt(s,t);c>=o&&s.substring(c).trim()===""&&(e=!1,n.length=0);continue}let l=s[0];if(l==="`"||l==="~"){let c=TBt(s,l);if(c>=3&&(l==="~"||!s.substring(c).includes("`"))){e=!0,t=l,o=c,n.length=0;continue}}n.push(r)}return e||f6o(n.join(`
`))}function TBt(a,i){let e=0;for(;e<a.length&&a[e]===i;)e++;return e}function f6o(a){let i=0;for(;i<a.length;){if(a[i]!=="`"){i++;continue}let e=TBt(a.substring(i),"`");i+=e;let t=!1;for(;i<a.length;){if(a[i]!=="`"){i++;continue}let o=TBt(a.substring(i),"`");if(i+=o,o===e){t=!0;break}}if(!t)return!0}return!1}function zMe(a){let i=/<vscode_codeblock_uri( isEdit)?( subAgentInvocationId="([^"]*)")?>([\s\S]*?)<\/vscode_codeblock_uri>/ms.exec(a);if(i){let[e,t,,o,n]=i;if(n){let r=A.parse(n),s=a.substring(0,i.index)+a.substring(i.index+e.length),l;if(o)try{l=decodeURIComponent(o)}catch{l=o}return{uri:r,textWithoutResult:s,isEdit:!!t,subAgentInvocationId:l}}}}function Odo(a){let i=/<vscode_codeblock_uri[^>]* subAgentInvocationId="([^"]*)"/ms.exec(a);if(i)try{return decodeURIComponent(i[1])}catch{return i[1]}}function Fdo(a){return a.includes("<vscode_codeblock_uri isEdit")}function Wdo(a){let i=[],e=a,t;for(;(t=/<vscode_annotation details='(.*?)'>(.*?)<\/vscode_annotation>/ms.exec(e))!==null;){let[o,n,r]=t,s=t.index,l=e.substring(0,s),c=l.split(`
`).length-1,u=r.split(`
`).length-1,p=l.lastIndexOf(`
`),h=s-(p+1)+1,g=(l+r).lastIndexOf(`
`),f=s+r.length-(g+1)+1;try{JSON.parse(decodeURIComponent(n)).forEach(({title:b,description:S})=>i.push({title:b,description:S,range:{startLineNumber:c+1,startColumn:h,endLineNumber:c+u+1,endColumn:f}}))}catch{}e=e.substring(0,s)+r+e.substring(s+o.length)}return{newText:e,vulnerabilities:i}}var a2=class{constructor(i,e,t,o,n){this.questions=i;this.allowSkip=e;this.resolveId=t;this.data=o;this.isUsed=n;this.kind="questionCarousel";this.completion=new Go}toJSON(){return{kind:this.kind,questions:this.questions,allowSkip:this.allowSkip,resolveId:this.resolveId,data:this.data,isUsed:this.isUsed}}};var YF=class extends C{constructor(e,t,o){super();this.tag=e;this.languageService=t;this.textModelService=o;this._models=new Map;this.maxModelCount=100;this._register(this.languageService.onDidChange(async()=>{for(let n of this._models.values()){if(!n.inLanguageId)continue;let r=(await n.model).object,s=r.getLanguageId();(!s||s===Fr)&&this.trySetTextModelLanguage(n.inLanguageId,r.textEditorModel)}}))}dispose(){super.dispose(),this.clear()}get(e,t,o){let n=this._models.get(this.getKey(e,t,o));if(n)return{model:n.model.then(r=>r.object.textEditorModel),vulns:n.vulns,codemapperUri:n.codemapperUri,isEdit:n.isEdit,subAgentInvocationId:n.subAgentInvocationId}}getOrCreate(e,t,o){let n=this.get(e,t,o);if(n)return n;let r=this.getCodeBlockUri(e,t,o),s=this.textModelService.createModelReference(r);for(this._models.set(this.getKey(e,t,o),{model:s,vulns:[],inLanguageId:void 0,codemapperUri:void 0});this._models.size>this.maxModelCount;){let l=ht.first(this._models.keys());if(!l)break;this.delete(l)}return{model:s.then(l=>l.object.textEditorModel),vulns:[],codemapperUri:void 0}}delete(e){let t=this._models.get(e);t&&(t.model.then(o=>o.dispose()),this._models.delete(e))}clear(){this._models.forEach(async e=>await e.model.then(t=>t.dispose())),this._models.clear()}updateSync(e,t,o,n){let r=this.getOrCreate(e,t,o);return this.updateInternalCodeBlockEntry(n,e,t,o),this.get(e,t,o)??r}markCodeBlockCompleted(e,t,o){this._models.get(this.getKey(e,t,o))}async update(e,t,o,n){let r=this.getOrCreate(e,t,o),s=this.updateInternalCodeBlockEntry(n,e,t,o),l=await r.model;if(!l||l.isDisposed())return r;n.languageId&&this.trySetTextModelLanguage(n.languageId,l);let c=l.getValue(1);if(s===c)return r;if(s.startsWith(c)){let u=s.slice(c.length),p=l.getLineCount(),h=l.getLineMaxColumn(p);l.applyEdits([{range:new z(p,h,p,h),text:u}])}else l.setValue(s);return r}updateInternalCodeBlockEntry(e,t,o,n){let r=this._models.get(this.getKey(t,o,n));r&&(r.inLanguageId=e.languageId);let s=Wdo(e.text),l=v6o(s.newText,e.languageId);r&&(r.vulns=s.vulnerabilities);let c=zMe(l);return c&&(r&&(r.codemapperUri=c.uri,r.isEdit=c.isEdit,r.subAgentInvocationId=c.subAgentInvocationId),l=c.textWithoutResult),e.isComplete&&this.markCodeBlockCompleted(t,o,n),l}trySetTextModelLanguage(e,t){let o=this.languageService.getLanguageIdByLanguageName(e);o&&o!==t.getLanguageId()&&t.setLanguage(o)}getKey(e,t,o){return`${e.toString()}/${t.id}/${o}`}getCodeBlockUri(e,t,o){let n=this.getUriMetaData(t),r=this.tag?`${this.tag}-${o}`:`${o}`,s=Qd(Je.wrap(new TextEncoder().encode(e.toString())),!1,!0);return A.from({scheme:Y.vscodeChatCodeBlock,authority:s,path:`/${t.id}/${r}`,fragment:n?JSON.stringify(n):void 0})}getUriMetaData(e){if(Vi(e))return{references:e.contentReferences.map(t=>{if(typeof t.reference=="string")return;let o=PYi(t.reference)?t.reference.value:t.reference;if(o)return A.isUri(o)?{uri:o.toJSON()}:{uri:o.uri.toJSON(),range:o.range}})}}};YF=I([m(1,kt),m(2,Nt)],YF);function v6o(a,i){return i==="php"&&!a.trim().startsWith("<?")?`<?php
${a}`:a}var DBt=Re("extension-default-icon",M.extensionsLarge,d(16886,null)),XF=Re("extensions-verified-publisher",M.verifiedFilled,d(16888,null)),ket=J("extensionIcon.verifiedForeground",WI,d(16887,null),!1);var l2=class extends C{constructor(e,t,o){super();this.chatAgentService=e;this.extensionService=t;this.chatAgentNameService=o;this._onDidChangeContents=this._register(new E);this.onDidChangeContents=this._onDidChangeContents.event;let n=bt(".chat-agent-hover@root",[bt(".chat-agent-hover-header",[bt(".chat-agent-hover-icon@icon"),bt(".chat-agent-hover-details",[bt(".chat-agent-hover-name@name"),bt(".chat-agent-hover-extension",[bt(".chat-agent-hover-extension-name@extensionName"),bt(".chat-agent-hover-separator@separator"),bt(".chat-agent-hover-publisher@publisher")])])]),bt(".chat-agent-hover-warning@warning"),bt("span.chat-agent-hover-description@description")]);this.domNode=n.root,this.icon=n.icon,this.name=n.name,this.extensionName=n.extensionName,this.description=n.description,n.separator.textContent="|";let r=_("span.extension-verified-publisher",void 0,Qo(XF));this.publisherName=_("span.chat-agent-hover-publisher-name"),R(n.publisher,r,this.publisherName),n.warning.appendChild(Qo(M.warning)),n.warning.appendChild(_("span",void 0,d(7097,null)))}setAgent(e){let t=this.chatAgentService.getAgent(e);if(t.metadata.icon instanceof A){let r=_("img.icon");r.src=gn.uriToBrowserUri(t.metadata.icon).toString(!0),this.icon.replaceChildren(_(".avatar",void 0,r))}else if(t.metadata.themeIcon){let r=_(q.asCSSSelector(t.metadata.themeIcon));this.icon.replaceChildren(_(".avatar.codicon-avatar",void 0,r))}this.domNode.classList.toggle("noExtensionName",!!t.isDynamic);let o=this.chatAgentNameService.getAgentNameRestriction(t);this.name.textContent=o?`@${t.name}`:Hj(t),this.extensionName.textContent=t.extensionDisplayName,this.publisherName.textContent=t.publisherDisplayName??t.extensionPublisherId;let n=t.description??"";if(n&&(n.match(/[\.\?\!] *$/)||(n+=".")),this.description.textContent=n,this.domNode.classList.toggle("allowedName",o),this.domNode.classList.toggle("verifiedPublisher",!1),!t.isDynamic){let r=this._register(new $e);this.extensionService.getExtensions([{id:t.extensionId.value}],r.token).then(s=>{r.dispose(),s[0]?.publisherDomain?.verified&&(this.domNode.classList.toggle("verifiedPublisher",!0),this._onDidChangeContents.fire())})}}};l2=I([m(0,br),m(1,zi),m(2,mz)],l2);function KMe(a,i){return{actions:[{commandId:mRe,label:d(7098,null),run:()=>{let e=a();e&&i.executeCommand(mRe,[e.extensionId.value])}}]}}var Eet=Object.freeze(["b","blockquote","br","code","del","em","h1","h2","h3","h4","h5","h6","hr","i","ins","li","ol","p","pre","s","strong","sub","sup","table","tbody","td","th","thead","tr","ul","a","img","span","div","input"]),hee=class{constructor(i,e,t,o,n){this.hoverService=o;this.markdownRendererService=n}render(i,e,t){e={...e,sanitizerConfig:{replaceWithPlaintext:!0,allowedTags:{override:Eet},...e?.sanitizerConfig,allowedLinkSchemes:{augment:[to.urlProtocol]},remoteImageIsAllowed:r=>!1}};let o=i&&i.supportHtml?{...i,value:`<body>
${i.value}</body>`}:i,n=this.markdownRendererService.render(o,e,t);n.element.normalize();for(let r of n.element.childNodes)r.nodeType===Node.TEXT_NODE&&r.textContent?.trim()&&r.replaceWith(_("p",void 0,r.textContent));return this.attachCustomHover(n)}attachCustomHover(i){let e=new P;return i.element.querySelectorAll("a").forEach(t=>{if(t.title){let o=t.title;t.title="",e.add(this.hoverService.setupManagedHover(Ni("element"),t,o))}}),{element:i.element,dispose:()=>{i.dispose(),e.dispose()}}}};hee=I([m(0,kt),m(1,Qe),m(2,B),m(3,tt),m(4,Qn)],hee);var GMe=class extends C{constructor(e,t,o){super();this._hoverService=o;this.domNode=document.createElement("span");this.domNode.classList.add("chat-agent-command"),this.domNode.setAttribute("aria-label",e.name),this.domNode.setAttribute("role","button");let n=_t(),r=document.createElement("span");this.domNode.appendChild(r),r.innerText=yu+e.name,this._store.add(this._hoverService.setupDelayedHover(r,{content:e.description,style:1},{groupId:n}));let s=d(7099,null,yu,e.name),l=new Mi(this.domNode,{ariaLabel:s});l.icon=M.close,this._store.add(l.onDidClick(()=>t())),this._store.add(l),this._store.add(this._hoverService.setupDelayedHover(l.element,{content:s,style:1},{groupId:n}))}hasSameContent(e,t,o){return!1}};GMe=I([m(2,tt)],GMe);var $Me=class extends C{constructor(e,t,o,n){super();this.content=e;this.domNode=_(".chat-rate-limited-widget"),R(this.domNode,_("span")).classList.add(...q.asClassNameArray(M.info));let s=R(this.domNode,_(".chat-rate-limited-message")),l=R(s,_("div"));l.textContent=d(7100,null);let c=this._register(new Mi(s,{...Ko,supportIcons:!0}));c.label=d(7101,null),c.element.classList.add("chat-rate-limited-button"),this._register(c.onDidClick(async()=>{let u="workbench.action.chat.triggerSetup";o.publicLog2("workbenchActionExecuted",{id:u,from:"chat-response"}),await t.executeCommand(u)}))}hasSameContent(e){return e.kind===this.content.kind&&!!e.errorDetails.isRateLimited}addDisposable(e){this._register(e)}};$Me=I([m(1,ge),m(2,Te),m(3,vr)],$Me);function qMe(a,i){let e=new P;return e.add(j(a,re.CLICK,t=>{t.detail!==2&&($t.stop(t,!0),i(BCi(new yn(Me(a),t))))})),e.add(j(a,re.DBLCLICK,t=>{$t.stop(t,!0),i(BCi(new yn(Me(a),t),!0))})),e.add(j(a,re.KEY_DOWN,t=>{let o=BCi(new Ii(t));o&&($t.stop(t,!0),i(o))})),e}function BCi(a,i){if(a instanceof Ii){let e;return a.equals(3)||it&&a.equals(2066)?e=!1:a.equals(10)&&(e=!0),typeof e>"u"?void 0:{editorOptions:{preserveFocus:e,pinned:!e},openToSide:!1}}else return{editorOptions:{preserveFocus:!i,pinned:i||a.middleButton},openToSide:a.ctrlKey||a.metaKey||a.altKey}}var JF="revealInExplorer",jMe="workbench.action.files.revert",LBt="explorer.openToSide",RBt="explorer.openWith",MBt="selectForCompare",PBt="compareSelected",ABt="compareFiles",Tet="workbench.files.action.compareWithSaved",vme="copyFilePath",bme="copyRelativeFilePath",_et="workbench.action.files.saveAs",NBt=L(10327,"Save As..."),QMe="workbench.action.files.save",HCi=L(10325,"Save"),OBt="workbench.action.files.saveWithoutFormatting",Vdo=L(10328,"Save without Formatting"),YMe="saveAll",Bdo=L(10326,"Save All"),Sme="workbench.files.action.saveAllInGroup",FBt="workbench.action.files.saveFiles",c3=new Q("groupFocusedInOpenEditors",!1),XMe=new Q("dirtyEditorFocusedInOpenEditors",!1),Det=new Q("readonlyEditorFocusedInOpenEditors",!1),WBt=new Q("openEditorsSelectedFileOrUntitled",!0),Let=new Q("resourceSelectedForCompare",!1),VBt="removeRootFolder",Hdo=d(10324,null),Udo="previousCompressedFolder",zdo="nextCompressedFolder",Kdo="firstCompressedFolder",Gdo="lastCompressedFolder",ZF="workbench.action.files.newUntitledFile",BBt=L(10323,"New Untitled Text File"),$do="workbench.action.files.newFile";var HBt=class{constructor(i){this.root=new UBt;for(let[e,t]of i)for(let o of t)this.root.add(e,o)}toString(){return this.root.toString()}getAttributes(i,e){let t=i.lastIndexOf(".");return t<1?{dirname:e,basename:i,extname:""}:{dirname:e,basename:i.substring(0,t),extname:i.substring(t+1)}}nest(i,e){let t=new UBt;for(let r of i){let s=this.getAttributes(r,e),l=this.root.get(r,s);for(let c of l)t.add(c,r)}let o=(r,s=new Set)=>{if(s.has(r))return[];s.add(r);let l=this.getAttributes(r,e),c=t.get(r,l);return c.length===0?[r]:c.length===1&&c[0]===r?[r]:c.flatMap(u=>o(u,s))},n=new Map;for(let r of i){let s=o(r);s.length===0&&(s=[r]);for(let l of s){let c=n.get(l);c||n.set(l,c=new Set),r!==l&&c.add(r)}}return n}},UBt=class a{constructor(){this.value=new UCi;this.map=new Map}add(i,e){if(i==="")this.value.add(i,e);else if(i[0]==="*")this.value.add(i,e);else{let t=i[0],o=i.slice(1),n=this.map.get(t);n||this.map.set(t,n=new a),n.add(o,e)}}get(i,e){let t=[];t.push(...this.value.get(i,e));let o=i[0],n=i.slice(1),r=this.map.get(o);return r&&t.push(...r.get(n,e)),t}toString(i=""){let e=[];return this.value.hasItems&&e.push(`* =>
`+this.value.toString(i+" ")),[...this.map.entries()].map(([t,o])=>e.push("^"+t+` =>
`+o.toString(i+" "))),e.map(t=>i+t).join(`
`)}},UCi=class a{constructor(){this.star=[];this.epsilon=[];this.map=new Map;this.hasItems=!1}add(i,e){if(this.hasItems=!0,i==="*")this.star.push(new zBt(e));else if(i==="")this.epsilon.push(new zBt(e));else{let t=i[i.length-1],o=i.slice(0,i.length-1);if(t==="*")throw Error("Unexpected star in SufTrie key: "+i);{let n=this.map.get(t);n||this.map.set(t,n=new a),n.add(o,e)}}}get(i,e){let t=[];i===""&&t.push(...this.epsilon.map(s=>s.substitute(e))),this.star.length&&t.push(...this.star.map(s=>s.substitute(e,i)));let o=i[i.length-1],n=i.slice(0,i.length-1),r=this.map.get(o);return r&&t.push(...r.get(n,e)),t}toString(i=""){let e=[];return this.star.length&&e.push("* => "+this.star.join("; ")),this.epsilon.length&&e.push("\u03B5 => "+this.epsilon.join("; ")),[...this.map.entries()].map(([t,o])=>e.push(t+`$ =>
`+o.toString(i+" "))),e.map(t=>i+t).join(`
`)}};var qdo=/\$[({](capture|basename|dirname|extname)[)}]/g,zBt=class{constructor(i){this.tokens=[];qdo.lastIndex=0;let e,t=0;for(;e=qdo.exec(i);){let o=i.slice(t,e.index);this.tokens.push(o);let n=e[1];switch(n){case"basename":case"dirname":case"extname":case"capture":this.tokens.push({capture:n});break;default:throw Error("unknown substitution type: "+n)}t=e.index+e[0].length}if(t!==i.length){let o=i.slice(t,i.length);this.tokens.push(o)}}substitute(i,e){return this.tokens.map(t=>{if(typeof t=="string")return t;switch(t.capture){case"basename":return i.basename;case"dirname":return i.dirname;case"extname":return i.extname;case"capture":return e||""}}).join("")}};var KBt=class{constructor(i,e,t,o,n){this.contextService=i;this.uriIdentityService=e;this._onDidChangeRoots=new E;let r=()=>this._roots=this.contextService.getWorkspace().folders.map(s=>new Tg(s.uri,t,o,n,void 0,!0,!1,!1,!1,s.name));r(),this._listener=this.contextService.onDidChangeWorkspaceFolders(()=>{r(),this._onDidChangeRoots.fire()})}get roots(){return this._roots}get onDidChangeRoots(){return this._onDidChangeRoots.event}findAll(i){return si(this.roots.map(e=>e.find(i)))}findClosest(i){let e=this.contextService.getWorkspaceFolder(i);if(e){let t=this.roots.find(o=>this.uriIdentityService.extUri.isEqual(o.resource,e.uri));if(t)return t.find(i)}return null}dispose(){this._onDidChangeRoots.dispose(),Ue(this._listener)}},gee=class gee{constructor(i,e,t,o,n,r,s,l,c,u=Ra(i),p,h=!1){this.resource=i;this.fileService=e;this.configService=t;this.filesConfigService=o;this._parent=n;this._isDirectory=r;this._isSymbolicLink=s;this._readonly=l;this._locked=c;this._name=u;this._mtime=p;this._unknown=h;this.error=void 0;this._isExcluded=!1;this.markedAsFindResult=!1;this._isDirectoryResolved=!1}get isExcluded(){return this._isExcluded?!0:this._parent?this._parent.isExcluded:!1}set isExcluded(i){this._isExcluded=i}hasChildren(i){return this.hasNests?this.nestedChildren?.some(e=>i(e))??!1:this.isDirectory}get hasNests(){return!!this.nestedChildren?.length}get isDirectoryResolved(){return this._isDirectoryResolved}get isSymbolicLink(){return!!this._isSymbolicLink}get isDirectory(){return!!this._isDirectory}get isReadonly(){return this.filesConfigService.isReadonly(this.resource,{resource:this.resource,name:this.name,readonly:this._readonly,locked:this._locked})}get mtime(){return this._mtime}get name(){return this._name}get isUnknown(){return this._unknown}get parent(){return this._parent}get root(){return this._parent?this._parent.root:this}get children(){return new Map}updateName(i){this._parent?.removeChild(this),this._name=i,this._parent?.addChild(this)}getId(){let i=this.root.resource.toString()+"::"+this.resource.toString();return this.isMarkedAsFiltered()&&(i+="::findFilterResult"),i}toString(){return`ExplorerItem: ${this.name}`}get isRoot(){return this===this.root}static create(i,e,t,o,n,r){let s=new gee(o.resource,i,e,t,n,o.isDirectory,o.isSymbolicLink,o.readonly,o.locked,o.name,o.mtime,!o.isFile&&!o.isDirectory);if(s.isDirectory&&(s._isDirectoryResolved=!!o.children||!!r&&r.some(l=>La(l,s.resource)),o.children))for(let l=0,c=o.children.length;l<c;l++){let u=gee.create(i,e,t,o.children[l],s,r);s.addChild(u)}return s}static mergeLocalWithDisk(i,e){if(i.resource.toString()!==e.resource.toString())return;let t=i.isDirectory||e.isDirectory;if(!(t&&e._isDirectoryResolved&&!i._isDirectoryResolved)&&(e.resource=i.resource,e.isRoot||e.updateName(i.name),e._isDirectory=i.isDirectory,e._mtime=i.mtime,e._isDirectoryResolved=i._isDirectoryResolved,e._isSymbolicLink=i.isSymbolicLink,e.error=i.error,t&&i._isDirectoryResolved)){let o=new vt;e.children.forEach(n=>{o.set(n.resource,n)}),e.children.clear(),i.children.forEach(n=>{let r=o.get(n.resource);r?(gee.mergeLocalWithDisk(n,r),e.addChild(r),o.delete(n.resource)):e.addChild(n)}),o.forEach(n=>{n instanceof d3&&e.addChild(n)})}}addChild(i){i._parent=this,i.updateResource(!1),this.children.set(this.getPlatformAwareName(i.name),i)}getChild(i){return this.children.get(this.getPlatformAwareName(i))}fetchChildren(i){let e=this.configService.getValue({resource:this.root.resource}).explorer.fileNesting;return e.enabled&&this.nestedChildren?this.nestedChildren:(async()=>{if(!this._isDirectoryResolved){let o=i==="modified";this.error=void 0;try{let n=await this.fileService.resolve(this.resource,{resolveSingleChildDescendants:!0,resolveMetadata:o}),r=gee.create(this.fileService,this.configService,this.filesConfigService,n,this);gee.mergeLocalWithDisk(r,this)}catch(n){throw this.error=n,n}this._isDirectoryResolved=!0}let t=[];if(e.enabled){let o=[],n=[];for(let s of this.children.entries())s[1].nestedParent=void 0,s[1].isDirectory?n.push(s):o.push(s);let r=this.fileNester.nest(o.map(([s])=>s),this.getPlatformAwareName(this.name));for(let[s,l]of o){let c=r.get(s);if(c!==void 0){l.nestedChildren=[];for(let u of c.keys()){let p=Oi(this.children.get(u));l.nestedChildren.push(p),p.nestedParent=l}t.push(l)}else l.nestedChildren=void 0}for(let[s,l]of n.values())t.push(l)}else this.children.forEach(o=>{t.push(o)});return t})()}get fileNester(){if(!this.root._fileNester){let i=this.configService.getValue({resource:this.root.resource}).explorer.fileNesting,e=Object.entries(i.patterns).filter(t=>typeof t[0]=="string"&&typeof t[1]=="string"&&t[0]&&t[1]).map(([t,o])=>[this.getPlatformAwareName(t.trim()),o.split(",").map(n=>this.getPlatformAwareName(n.trim().replace(/\u200b/g,"").trim())).filter(n=>n!=="")]);this.root._fileNester=new HBt(e)}return this.root._fileNester}removeChild(i){this.nestedChildren=void 0,this.children.delete(this.getPlatformAwareName(i.name))}forgetChildren(){this.children.clear(),this.nestedChildren=void 0,this._isDirectoryResolved=!1,this._fileNester=void 0}getPlatformAwareName(i){return this.fileService.hasCapability(this.resource,1024)?i:i.toLowerCase()}move(i){this.nestedParent?.removeChild(this),this._parent?.removeChild(this),i.removeChild(this),i.addChild(this),this.updateResource(!0)}updateResource(i){this._parent&&(this.resource=je(this._parent.resource,this.name)),i&&this.isDirectory&&this.children.forEach(e=>{e.updateResource(!0)})}rename(i){this.updateName(i.name),this._mtime=i.mtime,this.updateResource(!0)}find(i){let e=!this.fileService.hasCapability(i,1024);return i&&this.resource.scheme===i.scheme&&mr(this.resource.authority,i.authority)&&(e?Uk(i.path,this.resource.path):i.path.startsWith(this.resource.path))?this.findByPath(ih(i.path,Lo.sep),this.resource.path.length,e):null}findByPath(i,e,t){if(b1i(ih(this.resource.path,Lo.sep),i,t))return this;if(this.isDirectory){for(;e<i.length&&i[e]===Lo.sep;)e++;let o=i.indexOf(Lo.sep,e);o===-1&&(o=i.length);let n=i.substring(e,o),r=this.children.get(this.getPlatformAwareName(n));if(r)return r.findByPath(i,o,t)}return null}isMarkedAsFiltered(){return this.markedAsFindResult}markItemAndParentsAsFiltered(){this.markedAsFindResult=!0,this.parent?.markItemAndParentsAsFiltered()}unmarkItemAndChildren(){this.markedAsFindResult=!1,this.children.forEach(i=>i.unmarkItemAndChildren())}};I([mi],gee.prototype,"children",1);var Tg=gee,d3=class extends Tg{constructor(i,e,t,o,n){super(A.file(""),i,e,t,o,n),this._isDirectoryResolved=!0}};var za=ae("explorerService");function b6o(a){let i=a.lastFocusedList,e=i?.getHTMLElement();if(e&&sa(e)){let t;if(i instanceof hc){let o=i.getFocusedElements();o.length&&(t=o[0])}else if(i instanceof gv){let o=i.getFocus();o.length&&(t=o[0])}return t}}function Ime(a,i,e){if(A.isUri(a))return a;let t=b6o(e);return t instanceof Tg?t.resource:t instanceof wh?t.getResource():no.getOriginalUri(i.activeEditor,{supportSideBySide:1})}function e0(a,i,e,t,o){let n=i.lastFocusedList,r=n?.getHTMLElement();if(r&&sa(r)){if(n instanceof gv&&n.getFocus().every(u=>u instanceof Tg)){let u=o.getContext(!0,!0);if(u.length)return u.map(p=>p.resource)}if(n instanceof hc){let u=si(n.getSelectedElements().filter(v=>v instanceof wh).map(v=>v.getResource())),p=n.getFocusedElements(),h=p.length?p[0]:void 0,g;if(A.isUri(a))g=a.toString();else if(h instanceof wh){let v=h.getResource();g=v?v.toString():void 0}let f=u.findIndex(v=>v.toString()===g);if(f!==-1){let v=u[f];return u.splice(f,1),u.unshift(v),u}}}let l=t.activeGroup.selectedEditors;if(l.length>1&&A.isUri(a)){let u=l.findIndex(p=>p.matches({resource:a}));if(u!==-1){let p=l[u];return l.splice(u,1),l.unshift(p),l.map(h=>no.getOriginalUri(h)).filter(h=>!!h)}}let c=Ime(a,e,i);return c?[c]:[]}function zCi(a){let i=a.get(fo).lastFocusedList,e=i?.getHTMLElement();if(e&&sa(e)&&i instanceof hc){let t=si(i.getSelectedElements().filter(s=>s instanceof wh)),o=i.getFocusedElements(),n=o.length?o[0]:void 0,r;return n instanceof wh&&(r=n),t.some(s=>s===r)?t:r?[r]:void 0}}var TB=class{constructor(i,e,t,o,n){this.progressService=i;this.dialogService=e;this.explorerService=t;this.editorService=o;this.fileService=n}static{this.MAX_PARALLEL_UPLOADS=20}upload(i,e){let t=new $e,o=this.progressService.withProgress({location:10,delay:800,cancellable:!0,title:d(10357,null)},async n=>this.doUpload(i,this.toTransfer(e),n,t.token),()=>t.dispose(!0));return this.progressService.withProgress({location:Cb,delay:500},()=>o),o}toTransfer(i){if(_zi(i))return i.dataTransfer;let e={items:[]};for(let t of i)e.items.push({webkitGetAsEntry:()=>({name:t.name,isDirectory:!1,isFile:!0,createReader:()=>{throw new Error("Unsupported for files")},file:o=>o(t)})});return e}async doUpload(i,e,t,o){let n=e.items,r=[];for(let p of n)r.push(p.webkitGetAsEntry());let s=[],l={startTime:Date.now(),progressScheduler:new wM(p=>{t.report(p[p.length-1])},1e3),filesTotal:r.length,filesUploaded:0,totalBytesUploaded:0},c=new OT(TB.MAX_PARALLEL_UPLOADS);await fn.settled(r.map(p=>c.queue(async()=>{if(o.isCancellationRequested)return;if(i&&p.name&&i.getChild(p.name)){let{confirmed:g}=await this.dialogService.confirm(GCi(p.name));if(!g||(await this.explorerService.applyBulkEdit([new tu(je(i.resource,p.name),void 0,{recursive:!0,folder:i.getChild(p.name)?.isDirectory})],{undoLabel:d(10354,null,p.name),progressLabel:d(10355,null,p.name)}),o.isCancellationRequested))return}let h=await this.doUploadEntry(p,i.resource,i,t,l,o);h&&s.push(h)}))),l.progressScheduler.dispose();let u=s[0];!o.isCancellationRequested&&u?.isFile&&await this.editorService.openEditor({resource:u.resource,options:{pinned:!0}})}async doUploadEntry(i,e,t,o,n,r){if(r.isCancellationRequested||!i.name||!i.isFile&&!i.isDirectory)return;let s=0,l=(u,p)=>{s+=p,n.totalBytesUploaded+=p;let h=n.totalBytesUploaded/((Date.now()-n.startTime)/1e3),g;u<ll.MB?n.filesTotal===1?g=`${i.name}`:g=d(10359,null,n.filesUploaded,n.filesTotal,ll.formatSize(h)):g=d(10358,null,i.name,ll.formatSize(s),ll.formatSize(u),ll.formatSize(h)),n.progressScheduler.work({message:g})};n.filesUploaded++,l(0,0);let c=je(e,i.name);if(i.isFile){let u=await new Promise((p,h)=>i.file(p,h));return r.isCancellationRequested?void 0:(typeof u.stream=="function"&&u.size>ll.MB?await this.doUploadFileBuffered(c,u,l,r):await this.doUploadFileUnbuffered(c,u,l),{isFile:!0,resource:c})}else{if(await this.fileService.createFolder(c),r.isCancellationRequested)return;let u=i.createReader(),p=[],h=!1;do{let S=await new Promise((y,w)=>u.readEntries(y,w));S.length>0?p.push(...S):h=!0}while(!h&&!r.isCancellationRequested);n.filesTotal+=p.length;let g=t?.getChild(i.name)||void 0,f=[],v=[];for(let S of p)S.isFile?f.push(S):S.isDirectory&&v.push(S);let b=new OT(TB.MAX_PARALLEL_UPLOADS);await fn.settled(f.map(S=>b.queue(()=>this.doUploadEntry(S,c,g,o,n,r))));for(let S of v)await this.doUploadEntry(S,c,g,o,n,r);return{isFile:!1,resource:c}}}async doUploadFileBuffered(i,e,t,o){let n=Obe({highWaterMark:10}),r=this.fileService.writeFile(i,n);try{let s=e.stream().getReader(),l=await s.read();for(;!l.done&&!o.isCancellationRequested;){let c=Je.wrap(l.value);if(await n.write(c),o.isCancellationRequested)break;t(e.size,c.byteLength),l=await s.read()}n.end(void 0)}catch(s){n.error(s),n.end()}o.isCancellationRequested||await r}doUploadFileUnbuffered(i,e,t){return new Promise((o,n)=>{let r=new FileReader;r.onload=async s=>{try{if(s.target?.result instanceof ArrayBuffer){let l=Je.wrap(new Uint8Array(s.target.result));await this.fileService.writeFile(i,l),t(e.size,l.byteLength)}else throw new Error("Could not read from dropped file.");o()}catch(l){n(l)}},r.readAsArrayBuffer(e)})}};TB=I([m(0,Bo),m(1,ct),m(2,za),m(3,ee),m(4,be)],TB);var JMe=class{constructor(i,e,t,o,n,r,s,l,c,u,p){this.fileService=i;this.hostService=e;this.contextService=t;this.configurationService=o;this.dialogService=n;this.workspaceEditingService=r;this.explorerService=s;this.editorService=l;this.progressService=c;this.notificationService=u;this.instantiationService=p}async import(i,e,t){let o=new $e,n=this.progressService.withProgress({location:10,delay:800,cancellable:!0,title:d(10339,null)},async()=>await this.doImport(i,e,t,o.token),()=>o.dispose(!0));return this.progressService.withProgress({location:Cb,delay:500},()=>n),n}async doImport(i,e,t,o){let n=si((await this.instantiationService.invokeFunction(c=>TIe(c,e))).map(c=>c.resource));await Promise.all(n.map(c=>this.fileService.activateProvider(c.scheme)));let r=si(n.filter(c=>this.fileService.hasProvider(c))),s=await this.fileService.resolveAll(r.map(c=>({resource:c})));if(o.isCancellationRequested)return;this.hostService.focus(t);let l=s.filter(c=>c.success&&c.stat?.isDirectory).map(c=>({uri:c.stat.resource}));if(l.length>0&&i.isRoot){let c;(b=>(b[b.Copy=1]="Copy",b[b.Add=2]="Add"))(c||={});let u=[{label:l.length>1?d(10337,null):d(10335,null),run:()=>1}],p,h=this.contextService.getWorkspace().folders.map(f=>f.uri.scheme);l.some(f=>h.indexOf(f.uri.scheme)>=0)?(u.unshift({label:l.length>1?d(10330,null):d(10329,null),run:()=>2}),p=l.length>1?d(10348,null):d(10347,null,Ye(l[0].uri))):p=l.length>1?d(10336,null):d(10334,null,Ye(l[0].uri));let{result:g}=await this.dialogService.prompt({type:St.Info,message:p,buttons:u,cancelButton:!0});if(g===2)return this.workspaceEditingService.addFolders(l);if(g===1)return this.importResources(i,r,o)}else if(i instanceof Tg)return this.importResources(i,r,o)}async importResources(i,e,t){if(e&&e.length>0){let o=await this.fileService.resolve(i.resource);if(t.isCancellationRequested)return;let n=new Set,r=this.fileService.hasCapability(i.resource,1024);o.children&&o.children.forEach(h=>{n.add(r?h.name:h.name.toLowerCase())});let s=0,l=si(await fn.settled(e.map(async h=>{if(!await this.fileService.exists(h)){s++;return}if(!(n.has(r?Ye(h):Ye(h).toLowerCase())&&!(await this.dialogService.confirm(GCi(Ye(h)))).confirmed))return h})));s>0&&this.notificationService.error(s>1?d(10350,null):d(10349,null));let c=l.map(h=>{let g=Ye(h),f=je(i.resource,g);return new tu(h,f,{overwrite:!0,copy:!0})}),u=this.configurationService.getValue().explorer.confirmUndo;if(await this.explorerService.applyBulkEdit(c,{undoLabel:l.length===1?d(10351,null,Ye(l[0])):d(10352,null,l.length),progressLabel:l.length===1?d(10338,null,Ye(l[0])):d(10340,null,l.length),progressLocation:10,confirmBeforeUndo:u==="verbose"||u==="default"}),this.configurationService.getValue().explorer.autoOpenDroppedFile&&c.length===1){let h=this.explorerService.findClosest(c[0].newResource);h&&!h.isDirectory&&this.editorService.openEditor({resource:h.resource,options:{pinned:!0}})}}}};JMe=I([m(0,be),m(1,oi),m(2,Pe),m(3,B),m(4,ct),m(5,Of),m(6,za),m(7,ee),m(8,Bo),m(9,Ne),m(10,F)],JMe);var u3=class{constructor(i,e,t,o,n,r){this.fileService=i;this.explorerService=e;this.progressService=t;this.logService=o;this.fileDialogService=n;this.storageService=r}static{this.LAST_USED_DOWNLOAD_PATH_STORAGE_KEY="workbench.explorer.downloadPath"}download(i){let e=new $e,t=this.progressService.withProgress({location:10,delay:800,cancellable:Gt,title:d(10344,null)},async o=>this.doDownload(i,o,e),()=>e.dispose(!0));return this.progressService.withProgress({location:Cb,delay:500},()=>t),t}async doDownload(i,e,t){for(let o of i){if(t.token.isCancellationRequested)return;Gt?await this.doDownloadBrowser(o.resource,e,t):await this.doDownloadNative(o,e,t)}}async doDownloadBrowser(i,e,t){let o=await this.fileService.resolve(i,{resolveMetadata:!0});if(t.token.isCancellationRequested)return;let n=32*ll.MB,r=o.isDirectory||o.size>n,s=Ki();if(r&&Sx.supported(s))try{let l=await s.showDirectoryPicker(),c={startTime:Date.now(),progressScheduler:new wM(u=>{e.report(u[u.length-1])},1e3),filesTotal:o.isDirectory?0:1,filesDownloaded:0,totalBytesDownloaded:0,fileBytesDownloaded:0};if(o.isDirectory){let u=await l.getDirectoryHandle(o.name,{create:!0});await this.downloadFolderBrowser(o,u,c,t.token)}else await this.downloadFileBrowser(l,o,c,t.token);c.progressScheduler.dispose()}catch(l){this.logService.warn(l),t.cancel()}else if(o.isFile){let l;try{l=(await this.fileService.readFile(o.resource,{limits:{size:n}},t.token)).value.buffer}catch{l=gn.uriToBrowserUri(o.resource)}t.token.isCancellationRequested||Nzi(l,o.name)}}async downloadFileBufferedBrowser(i,e,t,o){let n=await this.fileService.readFileStream(i,void 0,o);if(o.isCancellationRequested){e.close();return}return new Promise((r,s)=>{let l=n.value,c=new P;c.add(Z(()=>e.close())),c.add(wd(o.onCancellationRequested)(()=>{c.dispose(),s(CI())})),j0(l,{onData:u=>{e.write(u.buffer),this.reportProgress(n.name,n.size,u.byteLength,t)},onError:u=>{c.dispose(),s(u)},onEnd:()=>{c.dispose(),r()}},o)})}async downloadFileUnbufferedBrowser(i,e,t,o){let n=await this.fileService.readFile(i,void 0,o);o.isCancellationRequested||(e.write(n.value.buffer),this.reportProgress(n.name,n.size,n.value.byteLength,t)),e.close()}async downloadFileBrowser(i,e,t,o){t.filesDownloaded++,t.fileBytesDownloaded=0,this.reportProgress(e.name,0,0,t);let r=await(await i.getFileHandle(e.name,{create:!0})).createWritable();return e.size>ll.MB?this.downloadFileBufferedBrowser(e.resource,r,t,o):this.downloadFileUnbufferedBrowser(e.resource,r,t,o)}async downloadFolderBrowser(i,e,t,o){if(i.children){t.filesTotal+=i.children.map(n=>n.isFile).length;for(let n of i.children){if(o.isCancellationRequested)return;if(n.isFile)await this.downloadFileBrowser(e,n,t,o);else{let r=await e.getDirectoryHandle(n.name,{create:!0}),s=await this.fileService.resolve(n.resource,{resolveMetadata:!0});await this.downloadFolderBrowser(s,r,t,o)}}}}reportProgress(i,e,t,o){o.fileBytesDownloaded+=t,o.totalBytesDownloaded+=t;let n=o.totalBytesDownloaded/((Date.now()-o.startTime)/1e3),r;e<ll.MB?o.filesTotal===1?r=i:r=d(10346,null,o.filesDownloaded,o.filesTotal,ll.formatSize(n)):r=d(10345,null,i,ll.formatSize(o.fileBytesDownloaded),ll.formatSize(e),ll.formatSize(n)),o.progressScheduler.work({message:r})}async doDownloadNative(i,e,t){e.report({message:i.name});let o,n=this.storageService.get(u3.LAST_USED_DOWNLOAD_PATH_STORAGE_KEY,-1);n?o=je(A.file(n),i.name):o=je(i.isDirectory?await this.fileDialogService.defaultFolderPath(Y.file):await this.fileDialogService.defaultFilePath(Y.file),i.name);let r=await this.fileDialogService.showSaveDialog({availableFileSystems:[Y.file],saveLabel:d(10342,null),title:d(10331,null),defaultUri:o});r?(this.storageService.store(u3.LAST_USED_DOWNLOAD_PATH_STORAGE_KEY,ci(r).fsPath,-1,1),await this.explorerService.applyBulkEdit([new tu(i.resource,r,{overwrite:!0,copy:!0})],{undoLabel:d(10341,null,i.name),progressLabel:d(10343,null,i.name),progressLocation:10})):t.cancel()}};u3=I([m(0,be),m(1,za),m(2,Bo),m(3,ne),m(4,dn),m(5,le)],u3);function GCi(a){return{message:d(10333,null,a),detail:d(10353,null),primaryButton:d(10356,null),type:"warning"}}function Qdo(a){return a.length>1?{message:d(10332,null,a.length),detail:Xw(a)+`
`+d(10353,null),primaryButton:d(10356,null),type:"warning"}:GCi(Ye(a[0]))}var wme="explorer.newFile",$Ci=L(10245,"New File..."),tPe="explorer.newFolder",qCi=L(10246,"New Folder..."),Xdo=d(10255,null),Jdo=d(10214,null),Zdo=d(10208,null),euo=d(10251,null),iHt=new Q("fileCopied",!1),jCi="explorer.download",tuo=d(10229,null),QCi="explorer.upload",iuo=d(10277,null),Ydo="explorer.confirmDelete",S6o=5e6;async function ouo(a,i){a&&(a.indexOf("/")>=0||a.indexOf("\\")>=0)&&await i.refresh()}async function YCi(a,i,e,t,o,n,r,s=!1,l=!1){let c;r?c=ri?d(10217,null):d(10218,null):c=d(10216,null);let u=fGe(n,f=>f.resource),p=new Set;for(let f of u)for(let v of i.getDirty(f.resource))p.add(v);if(p.size){let f;if(u.length>1?f=d(10224,null):u[0].isDirectory?p.size===1?f=d(10226,null,u[0].name):f=d(10225,null,u[0].name,p.size):f=d(10223,null,u[0].name),(await e.confirm({type:"warning",message:f,detail:d(10227,null),primaryButton:c})).confirmed)s=!0;else return}if(!s){let f=u.filter(v=>o.isReadonly(v.resource));if(f.length){let v;if(f.length>1?v=d(10252,null):f[0].isDirectory?v=d(10254,null,u[0].name):v=d(10253,null,u[0].name),!(await e.confirm({type:"warning",message:v,detail:d(10206,null),primaryButton:d(10205,null)})).confirmed)return}}let h,g=u.some(f=>f.isDirectory)?d(10240,null):u.length>1?d(10261,null):d(10260,null);if(s||t.getValue(Ydo)===!1)h={confirmed:!0};else if(r){let{message:f,detail:v}=I6o(u);v+=v?`
`:"",ri?v+=u.length>1?d(10274,null):d(10273,null):v+=u.length>1?d(10276,null):d(10275,null),h=await e.confirm({message:f,detail:v,primaryButton:c,checkbox:{label:d(10228,null)}})}else{let{message:f,detail:v}=y6o(u);v+=v?`
`:"",v+=g,h=await e.confirm({type:"warning",message:f,detail:v,primaryButton:c})}if(h.confirmed&&h.checkboxChecked===!0&&await t.updateValue(Ydo,!1),!!h.confirmed)try{let f=u.map(b=>new tu(b.resource,void 0,{recursive:!0,folder:b.isDirectory,ignoreIfNotExists:l,skipTrashBin:!r,maxSize:S6o})),v={undoLabel:u.length>1?d(10215,null,u.length):d(10219,null,u[0].name),progressLabel:u.length>1?d(10221,null,u.length):d(10222,null,u[0].name)};await a.applyBulkEdit(f,v)}catch(f){let v,b,S;if(r?(v=ri?d(10184,null):d(10272,null),b=g,S=d(10220,null)):(v=In(f,!1),S=d(10263,null)),(await e.confirm({type:"warning",message:v,detail:b,primaryButton:S})).confirmed)return r&&(r=!1),s=!0,l=!0,YCi(a,i,e,t,o,n,r,s,l)}}function I6o(a){return nuo(a)?{message:d(10198,null,a.length),detail:Xw(a.map(i=>i.resource))}:a.length>1?a[0].isDirectory?{message:d(10201,null,a.length),detail:Xw(a.map(i=>i.resource))}:{message:d(10200,null,a.length),detail:Xw(a.map(i=>i.resource))}:a[0].isDirectory&&!a[0].isSymbolicLink?{message:d(10199,null,a[0].name),detail:""}:{message:d(10197,null,a[0].name),detail:""}}function y6o(a){return nuo(a)?{message:d(10193,null,a.length),detail:Xw(a.map(i=>i.resource))}:a.length>1?a[0].isDirectory?{message:d(10196,null,a.length),detail:Xw(a.map(i=>i.resource))}:{message:d(10195,null,a.length),detail:Xw(a.map(i=>i.resource))}:a[0].isDirectory?{message:d(10194,null,a[0].name),detail:""}:{message:d(10192,null,a[0].name),detail:""}}function nuo(a){let i=a.find(t=>t.isDirectory),e=a.find(t=>!t.isDirectory);return!!i&&!!e}async function GBt(a,i,e,t,o,n){let r=typeof o.resource=="string"?o.resource:Ra(o.resource),s=je(t.resource,r);if(!(n==="disabled"&&!await C6o(i,e,s))){for(;!o.allowOverwrite&&a.findClosest(s);)n!=="disabled"&&(r=w6o(r,!!o.isDirectory,n)),s=je(t.resource,r);return s}}function w6o(a,i,e){if(e==="simple"){let p=a,h="";i||(h=Am(a),p=No(a,h));let g=/^(.+ copy)( \d+)?$/;return g.test(p)?p.replace(g,(f,v,b)=>{let S=b?parseInt(b):1;return S===0?`${v}`:S<1073741824?`${v} ${S+1}`:`${v}${b} copy`})+h:`${p} copy${h}`}let t="[\\.\\-_]",o=1073741824,n=RegExp("(.*"+t+")(\\d+)(\\..*)$");if(!i&&a.match(n))return a.replace(n,(p,h,g,f)=>{let v=parseInt(g);return v<o?h+String(v+1).padStart(g.length,"0")+f:`${h}${g}.1${f}`});let r=RegExp("(\\d+)("+t+".*)(\\..*)$");if(!i&&a.match(r))return a.replace(r,(p,h,g,f)=>{let v=parseInt(h);return v<o?String(v+1).padStart(h.length,"0")+g+f:`${h}${g}.1${f}`});let s=RegExp("(\\d+)(\\..*)$");if(!i&&a.match(s))return a.replace(s,(p,h,g)=>{let f=parseInt(h);return f<o?String(f+1).padStart(h.length,"0")+g:`${h}.1${g}`});let l=a.lastIndexOf(".");if(!i&&l>=0)return`${a.substr(0,l)}.1${a.substr(l)}`;let c=RegExp("(\\d+)$");if(!i&&l===-1&&a.match(c))return a.replace(c,(p,h)=>{let g=parseInt(h);return g<o?String(g+1).padStart(h.length,"0"):`${h}.1`});let u=RegExp("(.*)(\\d*)$");return!i&&l===-1&&a.match(u)?a.replace(u,(p,h,g)=>{let f=parseInt(g);return isNaN(f)&&(f=0),f<o?h+String(f+1).padStart(g.length,"0"):`${h}${g}.1`}):i&&a.match(/(\d+)$/)?a.replace(/(\d+)$/,(p,...h)=>{let g=parseInt(h[0]);return g<o?String(g+1).padStart(h[0].length,"0"):`${h[0]}.1`}):i&&a.match(/^(\d+)/)?a.replace(/^(\d+)(.*)$/,(p,...h)=>{let g=parseInt(h[0]);return g<o?String(g+1).padStart(h[0].length,"0")+h[1]:`${h[0]}${h[1]}.1`}):`${a}.1`}async function C6o(a,i,e){if(!await a.exists(e))return!0;let{confirmed:o}=await i.confirm({type:St.Warning,message:d(10203,null,No(e.path)),primaryButton:d(10258,null)});return o}var $Bt=class a extends K{static{this.ID="workbench.files.action.compareFileWith"}static{this.LABEL=L(10238,"Compare Active File With...")}constructor(){super({id:a.ID,title:a.LABEL,f1:!0,category:We.File,precondition:fr,metadata:{description:L(10187,"Opens a picker to select a file to diff with the active editor.")}})}async run(i){let e=i.get(ee),t=i.get(Nt),o=i.get(Ge),n=e.activeEditor,r=no.getOriginalUri(n);if(r&&t.canHandleResource(r)){let s=await o.quickAccess.pick("",{itemActivation:2});if(s?.length===1){let l=s[0].resource;A.isUri(l)&&t.canHandleResource(l)&&e.openEditor({original:{resource:r},modified:{resource:l},options:{pinned:!0}})}}}},Pet=class a extends K{static{this.ID="workbench.action.toggleAutoSave"}constructor(){super({id:a.ID,title:L(10270,"Toggle Auto Save"),f1:!0,category:We.File,metadata:{description:L(10271,"Toggle the ability to save files automatically after typing")}})}run(i){return i.get(lr).toggleAutoSave()}},Ret=class extends st{constructor(e,t,o,n,r){super(e,t);this.commandService=o;this.notificationService=n;this.workingCopyService=r;this.lastDirtyState=this.workingCopyService.hasDirty,this.enabled=this.lastDirtyState,this.registerListeners()}registerListeners(){this._register(this.workingCopyService.onDidChangeDirty(e=>this.updateEnablement(e)))}updateEnablement(e){let t=e.isDirty()||this.workingCopyService.hasDirty;this.lastDirtyState!==t&&(this.enabled=t,this.lastDirtyState=this.enabled)}async run(e){try{await this.doRun(e)}catch(t){this.notificationService.error(In(t,!1))}}};Ret=I([m(2,ge),m(3,Ne),m(4,Wa)],Ret);var ZMe=class extends Ret{static{this.ID="workbench.files.action.saveAllInGroup"}static{this.LABEL=d(10264,null)}get class(){return"explorer-action "+q.asClassName(M.saveAll)}doRun(i){return this.commandService.executeCommand(Sme,{},i)}},fee=class extends st{constructor(e,t,o){super(e,t,q.asClassName(M.closeAll));this.commandService=o}static{this.ID="workbench.files.action.closeGroup"}static{this.LABEL=d(10186,null)}run(e){return this.commandService.executeCommand(f7e,{},e)}};fee=I([m(2,ge)],fee);var qBt=class a extends K{static{this.ID="workbench.files.action.focusFilesExplorer"}static{this.LABEL=L(10236,"Focus on Files Explorer")}constructor(){super({id:a.ID,title:a.LABEL,f1:!0,category:We.File,metadata:{description:L(10237,"Moves focus to the file explorer view container.")}})}async run(i){await i.get(ds).openPaneComposite(Hf,0,!0)}},jBt=class a extends K{static{this.ID="workbench.files.action.showActiveFileInExplorer"}static{this.LABEL=L(10267,"Reveal Active File in Explorer View")}constructor(){super({id:a.ID,title:a.LABEL,f1:!0,category:We.File,metadata:{description:L(10268,"Reveals and selects the active file within the explorer view.")}})}async run(i){let e=i.get(ge),t=i.get(ee),o=no.getOriginalUri(t.activeEditor,{supportSideBySide:1});o&&e.executeCommand(JF,o)}},QBt=class a extends K{static{this.ID="workbench.action.files.showOpenedFileInNewWindow"}static{this.LABEL=L(10247,"Open Active Editor in New Empty Workspace")}constructor(){super({id:a.ID,title:a.LABEL,f1:!0,category:We.File,precondition:xY,metadata:{description:L(10248,"Opens the active editor in a new window with no folders open.")}})}async run(i){let e=i.get(ee),t=i.get(oi),o=i.get(ct),n=i.get(be),r=no.getOriginalUri(e.activeEditor,{supportSideBySide:1});r&&n.hasProvider(r)?t.openWindow([{fileUri:r}],{forceNewWindow:!0}):o.error(d(10249,null))}};function ruo(a,i,e,t){if(e=k6o(e),!e||e.length===0||/^\s+$/.test(e))return{content:d(10230,null),severity:St.Error};if(e[0]==="/"||e[0]==="\\")return{content:d(10234,null),severity:St.Error};let o=si(e.split(/[\\/]/)),n=i.parent;if(e!==i.name){let r=n?.getChild(e);if(r&&r!==i)return{content:d(10233,null,e),severity:St.Error}}if(o.some(r=>!a.hasValidBasename(i.resource,t,r))){let r=e.replace(/\*/g,"\\*");return{content:d(10239,null,x6o(r)),severity:St.Error}}return o.some(r=>/^\s|\s$/.test(r))?{content:d(10235,null),severity:St.Warning}:null}function x6o(a){return a?.length>255?`${a.substr(0,255)}...`:a}function k6o(a){return a&&(a=qD(a," "),a=ih(a,"/"),a=ih(a,"\\"),a)}var YBt=class a extends K{static{this.ID="workbench.files.action.compareNewUntitledTextFiles"}static{this.LABEL=L(10188,"Compare New Untitled Text Files")}constructor(){super({id:a.ID,title:a.LABEL,f1:!0,category:We.File,metadata:{description:L(10189,"Opens a new diff editor with two untitled files.")}})}async run(i){await i.get(ee).openEditor({original:{resource:void 0},modified:{resource:void 0},options:{pinned:!0}})}},XBt=class a extends K{static{this.ID="workbench.files.action.compareWithClipboard"}static{this.LABEL=L(10190,"Compare Active File with Clipboard")}static{this.SCHEME_COUNTER=0}constructor(){super({id:a.ID,title:a.LABEL,f1:!0,category:We.File,keybinding:{primary:Ai(2089,33),weight:200},metadata:{description:L(10191,"Opens a new diff editor to compare the active file with the contents of the clipboard.")}})}async run(i){let e=i.get(ee),t=i.get(F),o=i.get(Nt),n=i.get(be),r=no.getOriginalUri(e.activeEditor,{supportSideBySide:1}),s=`clipboardCompare${a.SCHEME_COUNTER++}`;if(r&&(n.hasProvider(r)||r.scheme===Y.untitled)){if(!this.registrationDisposal){let u=t.createInstance(Met);this.registrationDisposal=o.registerTextModelContentProvider(s,u)}let l=Ye(r),c=d(10185,null,l);await e.openEditor({original:{resource:r.with({scheme:s})},modified:{resource:r},label:c,options:{pinned:!0}}).finally(()=>{Ue(this.registrationDisposal),this.registrationDisposal=void 0})}}dispose(){Ue(this.registrationDisposal),this.registrationDisposal=void 0}},Met=class{constructor(i,e,t){this.clipboardService=i;this.languageService=e;this.modelService=t}async provideTextContent(i){let e=await this.clipboardService.readText();return this.modelService.createModel(e,this.languageService.createByFilepathOrFirstLine(i),i)}};Met=I([m(0,Wi),m(1,kt),m(2,Ct)],Met);function E6o(a,i,e){a.prompt(St.Error,In(i,!1),[{label:d(10262,null),run:()=>e()}])}async function suo(a,i){let e=a.get(za),t=a.get(be),o=a.get(B),n=a.get(lr),r=a.get(ee),s=a.get(Ft),l=a.get(Ne),c=a.get(yo),u=a.get(ge),p=a.get(wn),h=!s.isViewVisible(Cb),g=await s.openView(Cb,!0);if(h&&await Pi(500),!g){if(i)throw new Error("Open a folder or workspace first.");return u.executeCommand(ZF)}let f=e.getContext(!1),v=f.length>0?f[0]:void 0,b;if(v?b=v.isDirectory?v:v.parent||e.roots[0]:b=e.roots[0],b.isReadonly)throw new Error("Parent folder is readonly.");let S=new d3(t,o,n,b,i);b.addChild(S);let y=async k=>{try{let T=je(b.resource,k);k.endsWith("/")&&(i=!0),await e.applyBulkEdit([new tu(void 0,T,{folder:i})],{undoLabel:d(10212,null,k),progressLabel:d(10213,null,k),confirmBeforeUndo:!0}),await ouo(k,e),i?await e.select(T,!0):await r.openEditor({resource:T,options:{pinned:!0}})}catch(T){E6o(l,T,()=>y(k))}},w=(await c.getEnvironment())?.os??zo;await e.setEditable(S,{validationMessage:k=>ruo(p,S,k,w),onFinish:async(k,T)=>{b.removeChild(S),await e.setEditable(S,null),T&&y(k)}})}qe.registerCommand({id:wme,handler:async a=>{await suo(a,!1)}});qe.registerCommand({id:tPe,handler:async a=>{await suo(a,!0)}});var auo=async a=>{let i=a.get(za),e=a.get(Ne),t=a.get(yo),o=a.get(wn),n=a.get(B),r=i.getContext(!1),s=r.length>0?r[0]:void 0;if(!s)return;let l=(await t.getEnvironment())?.os??zo;await i.setEditable(s,{validationMessage:c=>ruo(o,s,c,l),onFinish:async(c,u)=>{if(u){let p=s.parent.resource,h=je(p,c);if(s.resource.toString()!==h.toString())try{await i.applyBulkEdit([new tu(s.resource,h)],{confirmBeforeUndo:n.getValue().explorer.confirmUndo==="verbose",undoLabel:d(10256,null,s.name,c),progressLabel:d(10257,null,s.name,c)}),await ouo(c,i)}catch(g){e.error(g)}}await i.setEditable(s,null)}})},luo=async a=>{let e=a.get(za).getContext(!0).filter(t=>!t.isRoot);e.length&&await YCi(a.get(za),a.get(kp),a.get(ct),a.get(B),a.get(lr),e,!0)},XCi=async a=>{let e=a.get(za).getContext(!0).filter(t=>!t.isRoot);e.length&&await YCi(a.get(za),a.get(kp),a.get(ct),a.get(B),a.get(lr),e,!1)},yme=!1,cuo=async a=>{let i=a.get(za),e=i.getContext(!0);e.length>0&&(await i.setToCopy(e,!1),yme=!1)},duo=async a=>{let i=a.get(za),e=i.getContext(!0);e.length>0&&(await i.setToCopy(e,!0),yme=!0)},T6o=async a=>{let i=a.get(za),e=a.get(Ne),t=a.get(F),o=i.getContext(!0),n=o.length?o:i.roots,r=t.createInstance(u3);try{await r.download(n)}catch(s){throw e.error(s),s}};qe.registerCommand({id:jCi,handler:T6o});var _6o=async a=>{let i=a.get(za),e=a.get(Ne),t=a.get(F),o=i.getContext(!1),n=o.length?o[0]:i.roots[0];try{let r=await Ozi();r&&await t.createInstance(TB).upload(n,r)}catch(r){throw e.error(r),r}};qe.registerCommand({id:QCi,handler:_6o});var uuo=async(a,i)=>{let e=a.get(Wi),t=a.get(za),o=a.get(be),n=a.get(Ne),r=a.get(ee),s=a.get(B),l=a.get(dt),c=a.get(ct),u=a.get(oi),p=t.getContext(!1),g=i&&i.length>0&&s.getValue("explorer.confirmPasteNative"),f=await D6o(i,e,u);if(g&&f.files.length>=1){let w=f.files.length>1?d(10202,null,f.files.length):d(10204,null,No(f.type==="paths"?f.files[0].fsPath:f.files[0].name)),k=f.files.length>1?Xw(f.files.map(N=>{if(A.isUri(N))return N.fsPath;if(f.type==="paths"){let O=Ix(N);if(O)return O}return N.name})):void 0,T=await c.confirm({message:w,detail:k,checkbox:{label:d(10228,null)},primaryButton:d(10250,null)});if(!T.confirmed)return;T.checkboxChecked===!0&&await s.updateValue("explorer.confirmPasteNative",!1)}let v=p.length?p[0]:t.roots[0],b=s.getValue().explorer.incrementalNaming;if(t.getEditable())return;try{let w=[];if(f.type==="paths"){let k=si(await Promise.all(f.files.map(async T=>{if(v.resource.toString()!==T.toString()&&La(v.resource,T))throw new Error(d(10232,null));let N=await o.stat(T),O;l.extUri.isEqual(v.resource,T)?O=v.parent:O=v.isDirectory?v:v.parent;let V=await GBt(t,o,c,O,{resource:T,isDirectory:N.isDirectory,allowOverwrite:yme||b==="disabled"},b);if(V)return{source:T,target:V}})));if(k.length>=1)if(yme){let T=k.map(O=>new tu(O.source,O.target,{overwrite:b==="disabled"})),N={confirmBeforeUndo:s.getValue().explorer.confirmUndo==="verbose",progressLabel:k.length>1?d(10243,null,k.length):d(10244,null,Ra(k[0].target)),undoLabel:k.length>1?d(10241,null,k.length):d(10242,null,Ra(k[0].target))};await t.applyBulkEdit(T,N)}else{let T=k.map(N=>new tu(N.source,N.target,{copy:!0,overwrite:b==="disabled"}));await y(k.map(N=>N.target),T)}w=k.map(T=>T.target)}else{let k=si(await Promise.all(f.files.map(async T=>{let N=v.isDirectory?v:v.parent,O=await GBt(t,o,c,N,{resource:T.name,isDirectory:!1,allowOverwrite:yme||b==="disabled"},b);if(O)return{target:O,edit:new tu(void 0,O,{overwrite:b==="disabled",contents:(async()=>Je.wrap(new Uint8Array(await T.arrayBuffer())))()})}})));await y(k.map(T=>T.target),k.map(T=>T.edit)),w=k.map(T=>T.target)}if(w.length){let k=w[0];if(await t.select(k),w.length===1){let T=t.findClosest(k);T&&!T.isDirectory&&await r.openEditor({resource:T.resource,options:{pinned:!0,preserveFocus:!0}})}}}catch(w){n.error(In(new Error(d(10231,null,Cn(w))),!1))}finally{yme&&(await t.setToCopy([],!1),yme=!1)}async function y(w,k){let T=s.getValue().explorer.confirmUndo,N={confirmBeforeUndo:T==="default"||T==="verbose",progressLabel:w.length>1?d(10210,null,w.length):d(10211,null,Ra(w[0])),undoLabel:w.length>1?d(10207,null,w.length):d(10209,null,Ra(w[0]))};await t.applyBulkEdit(k,N)}};async function D6o(a,i,e){if(a&&a.length>0){let t=[...a].map(o=>Ix(o)).filter(o=>!!o&&Xl(o)).map(o=>A.file(o));return t.length?{type:"paths",files:t}:{type:"data",files:[...a].filter(o=>!Ix(o))}}else return{type:"paths",files:fGe(await i.readResources(),t=>t)}}var puo=async a=>{let i=a.get(ee),t=a.get(za).getContext(!0);await i.openEditors(t.filter(o=>!o.isDirectory).map(o=>({resource:o.resource,options:{preserveFocus:!0}})))},ePe=class extends K{constructor(e,t,o){super({id:e,title:t,f1:!0,category:We.File,precondition:YEt});this.newReadonlyState=o}async run(e){let t=e.get(ee),o=e.get(lr),n=no.getOriginalUri(t.activeEditor,{supportSideBySide:1});n&&await o.updateReadonly(n,this.newReadonlyState)}},JBt=class a extends ePe{static{this.ID="workbench.action.files.setActiveEditorReadonlyInSession"}static{this.LABEL=L(10265,"Set Active Editor Read-only in Session")}constructor(){super(a.ID,a.LABEL,!0)}},ZBt=class a extends ePe{static{this.ID="workbench.action.files.setActiveEditorWriteableInSession"}static{this.LABEL=L(10266,"Set Active Editor Writeable in Session")}constructor(){super(a.ID,a.LABEL,!1)}},eHt=class a extends ePe{static{this.ID="workbench.action.files.toggleActiveEditorReadonlyInSession"}static{this.LABEL=L(10269,"Toggle Active Editor Read-only in Session")}constructor(){super(a.ID,a.LABEL,"toggle")}},tHt=class a extends ePe{static{this.ID="workbench.action.files.resetActiveEditorReadonlyInSession"}static{this.LABEL=L(10259,"Reset Active Editor Read-only in Session")}constructor(){super(a.ID,a.LABEL,"reset")}};var hI=class extends ek{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super(e,t,v,u,h,g,f,S,y);this.instantiationService=c;this.textModelService=p;this.pathService=b;this.forceOpenAs=0;this.model=void 0;this.cachedTextFileModelReference=void 0;this.modelListeners=this._register(new P);this.model=this.textFileService.files.get(e),o&&this.setPreferredName(o),n&&this.setPreferredDescription(n),r&&this.setPreferredEncoding(r),s&&this.setPreferredLanguageId(s),typeof l=="string"&&this.setPreferredContents(l),this._register(this.textFileService.files.onDidCreate(w=>this.onDidCreateTextFileModel(w))),this.model&&this.registerModelListeners(this.model)}get typeId(){return pue}get editorId(){return Ys.id}get capabilities(){let e=32;return this.model?this.model.isReadonly()&&(e|=2):this.fileService.hasProvider(this.resource)?this.filesConfigurationService.isReadonly(this.resource)&&(e|=2):e|=4,e&2||(e|=128),e}onDidCreateTextFileModel(e){Xe(e.resource,this.resource)&&(this.model=e,this.registerModelListeners(e))}registerModelListeners(e){this.modelListeners.clear(),this.modelListeners.add(e.onDidChangeDirty(()=>this._onDidChangeDirty.fire())),this.modelListeners.add(e.onDidChangeReadonly(()=>this._onDidChangeCapabilities.fire())),this.modelListeners.add(e.onDidSaveError(()=>this._onDidChangeDirty.fire())),this.modelListeners.add(H.once(e.onWillDispose)(()=>{this.modelListeners.clear(),this.model=void 0}))}getName(){return this.preferredName||super.getName()}setPreferredName(e){this.allowLabelOverride()&&this.preferredName!==e&&(this.preferredName=e,this._onDidChangeLabel.fire())}allowLabelOverride(){return this.resource.scheme!==this.pathService.defaultUriScheme&&this.resource.scheme!==Y.vscodeUserData&&this.resource.scheme!==Y.file&&this.resource.scheme!==Y.vscodeRemote}getPreferredName(){return this.preferredName}isReadonly(){return this.model?this.model.isReadonly():this.filesConfigurationService.isReadonly(this.resource)}getDescription(e){return this.preferredDescription||super.getDescription(e)}setPreferredDescription(e){this.allowLabelOverride()&&this.preferredDescription!==e&&(this.preferredDescription=e,this._onDidChangeLabel.fire())}getPreferredDescription(){return this.preferredDescription}getTitle(e){let t=super.getTitle(e),o=this.getPreferredTitle();return o&&(t=`${o} (${t})`),t}getPreferredTitle(){if(this.preferredName&&this.preferredDescription)return`${this.preferredName} ${this.preferredDescription}`;if(this.preferredName||this.preferredDescription)return this.preferredName??this.preferredDescription}getEncoding(){return this.model?this.model.getEncoding():this.preferredEncoding}getPreferredEncoding(){return this.preferredEncoding}async setEncoding(e,t){return this.setPreferredEncoding(e),this.model?.setEncoding(e,t)}setPreferredEncoding(e){this.preferredEncoding=e,this.setForceOpenAsText()}getLanguageId(){return this.model?this.model.getLanguageId():this.preferredLanguageId}getPreferredLanguageId(){return this.preferredLanguageId}setLanguageId(e,t){this.setPreferredLanguageId(e),this.model?.setLanguageId(e,t)}setPreferredLanguageId(e){this.preferredLanguageId=e,this.setForceOpenAsText()}setPreferredContents(e){this.preferredContents=e,this.setForceOpenAsText()}setForceOpenAsText(){this.forceOpenAs=1}setForceOpenAsBinary(){this.forceOpenAs=2}isDirty(){return!!this.model?.isDirty()}isSaving(){return this.model?.hasState(0)||this.model?.hasState(3)||this.model?.hasState(5)?!1:this.filesConfigurationService.hasShortAutoSaveDelay(this)?!0:super.isSaving()}prefersEditorPane(e){return this.forceOpenAs===2?e.find(t=>t.typeId===UPt):e.find(t=>t.typeId===mF)}resolve(e){return this.forceOpenAs===2?this.doResolveAsBinary():this.doResolveAsText(e)}async doResolveAsText(e){try{let t=this.preferredContents;this.preferredContents=void 0,await this.textFileService.files.resolve(this.resource,{languageId:this.preferredLanguageId,encoding:this.preferredEncoding,contents:typeof t=="string"?lae(t):void 0,reload:{async:!0},allowBinary:this.forceOpenAs===1,reason:1,limits:this.ensureLimits(e)}),this.cachedTextFileModelReference||(this.cachedTextFileModelReference=await this.textModelService.createModelReference(this.resource));let o=this.cachedTextFileModelReference.object;return this.isDisposed()&&this.disposeModelReference(),o}catch(t){if(t.textFileOperationResult===0)return this.doResolveAsBinary();throw t}}async doResolveAsBinary(){let e=this.instantiationService.createInstance(hK,this.preferredResource,this.getName());return await e.resolve(),e}isResolved(){return!!this.model}async rename(e,t){return{editor:{resource:t,encoding:this.getEncoding(),options:{viewState:Dj(this,e,this.editorService)}}}}toUntyped(e){let t={resource:this.preferredResource,forceFile:!0,options:{override:this.editorId}};return typeof e?.preserveViewState=="number"&&(t.encoding=this.getEncoding(),t.languageId=this.getLanguageId(),t.contents=(()=>{let o=this.textFileService.files.get(this.resource);if(o?.isDirty()&&!o.textEditorModel.isTooLargeForHeapOperation())return o.textEditorModel.getValue()})(),t.options={...t.options,viewState:Dj(this,e.preserveViewState,this.editorService)}),t}matches(e){return this===e?!0:e instanceof hI?Xe(e.resource,this.resource):QS(e)?super.matches(e):!1}dispose(){this.model=void 0,this.disposeModelReference(),super.dispose()}disposeModelReference(){Ue(this.cachedTextFileModelReference),this.cachedTextFileModelReference=void 0}};hI=I([m(7,F),m(8,Ho),m(9,Nt),m(10,ot),m(11,be),m(12,lr),m(13,ee),m(14,wn),m(15,Nn),m(16,Sv)],hI);var rxi="saveConflictResolutionContext",JCi="conflictResolution",sxi="learnMoreDirtyWriteError",muo=d(10170,null),Cme=class extends C{constructor(e,t,o,n,r,s,l){super();this.notificationService=e;this.textFileService=t;this.editorService=n;this.instantiationService=s;this.storageService=l;this.messages=new vt;this.activeConflictResolutionResource=void 0;this.conflictResolutionContext=new Q(rxi,!1,!0).bindTo(o);let c=this._register(s.createInstance(wR));this._register(r.registerTextModelContentProvider(JCi,c)),this.textFileService.files.saveErrorHandler=this,this.registerListeners()}static{this.ID="workbench.contrib.textFileSaveErrorHandler"}registerListeners(){this._register(this.textFileService.files.onDidSave(e=>this.onFileSavedOrReverted(e.model.resource))),this._register(this.textFileService.files.onDidRevert(e=>this.onFileSavedOrReverted(e.resource))),this._register(this.editorService.onDidActiveEditorChange(()=>this.onActiveEditorChanged()))}onActiveEditorChanged(){let e=!1,t,o=this.editorService.activeEditor;o instanceof Fa&&o.original.resource?.scheme===JCi&&(e=!0,t=o.modified.resource),this.conflictResolutionContext.set(e),this.activeConflictResolutionResource=t}onFileSavedOrReverted(e){let t=this.messages.get(e);t&&(t.close(),this.messages.delete(e))}onSaveError(e,t,o){let n=e,r=t.resource,s,l=[],c=[];if(n.fileOperationResult===3)if(this.activeConflictResolutionResource&&Xe(this.activeConflictResolutionResource,t.resource)){if(this.storageService.getBoolean(sxi,-1))return;s=muo,l.push(this.instantiationService.createInstance(iPe)),c.push(this.instantiationService.createInstance(Aet))}else s=d(10169,null,Ye(r)),l.push(this.instantiationService.createInstance(Net,t)),l.push(this.instantiationService.createInstance(nxi,t,o)),c.push(this.instantiationService.createInstance(Fet));else{let h=n.fileOperationResult===5,g=h&&n.options?.unlock,f=n.fileOperationResult===6,v=r.scheme===Y.file;v&&(f||g)?l.push(this.instantiationService.createInstance(exi,t,o,!!g)):h?l.push(this.instantiationService.createInstance(oxi,t,o)):l.push(this.instantiationService.createInstance(txi,t,o)),l.push(this.instantiationService.createInstance(Oet,t)),l.push(this.instantiationService.createInstance(ixi,t)),h?g&&v?s=ri?d(10162,null,Ye(r)):d(10163,null,Ye(r)):s=d(10161,null,Ye(r)):v&&f?s=ri?d(10159,null,Ye(r)):d(10160,null,Ye(r)):s=d(10154,null,Ye(r),In(e,!1))}let u={primary:l,secondary:c},p=this.notificationService.notify({id:`${Ir(t.resource.toString())}`,severity:St.Error,message:s,actions:u});H.once(p.onDidClose)(()=>{Ue(l),Ue(c)}),this.messages.set(t.resource,p)}dispose(){super.dispose(),this.messages.clear()}};Cme=I([m(0,Ne),m(1,Ho),m(2,X),m(3,ee),m(4,Nt),m(5,F),m(6,le)],Cme);var ZCi=[];function L6o(){for(;ZCi.length>0;)ZCi.pop()?.close()}var iPe=class extends st{constructor(e){super("workbench.files.action.resolveConflictLearnMore",d(10155,null));this.openerService=e}async run(){await this.openerService.open(A.parse("https://go.microsoft.com/fwlink/?linkid=868264"))}};iPe=I([m(0,Qe)],iPe);var Aet=class extends st{constructor(e){super("workbench.files.action.resolveConflictLearnMoreDoNotShowAgain",d(10153,null));this.storageService=e}async run(e){this.storageService.store(sxi,!0,-1,0),e.dispose()}};Aet=I([m(0,le)],Aet);var Net=class extends st{constructor(e,t,o,n,r){super("workbench.files.action.resolveConflict",d(10151,null));this.model=e;this.editorService=t;this.notificationService=o;this.instantiationService=n;this.productService=r}async run(){if(!this.model.isDisposed()){let e=this.model.resource,t=Ye(e),o=d(10166,null,t,t,this.productService.nameLong);await wR.open(e,JCi,o,this.editorService,{pinned:!0});let n={primary:[this.instantiationService.createInstance(iPe)]},r=this.notificationService.notify({id:`${Ir(e.toString())}`,severity:St.Info,message:muo,actions:n,neverShowAgain:{id:sxi,isSecondary:!0}});H.once(r.onDidClose)(()=>Ue(n.primary)),ZCi.push(r)}}};Net=I([m(1,ee),m(2,Ne),m(3,F),m(4,nt)],Net);var exi=class extends st{constructor(e,t,o){super("workbench.files.action.saveModelElevated",o?ri?d(10157,null):d(10158,null):ri?d(10167,null):d(10168,null));this.model=e;this.options=t;this.triedToUnlock=o}async run(){this.model.isDisposed()||await this.model.save({...this.options,writeElevated:!0,writeUnlock:this.triedToUnlock,reason:1})}},txi=class extends st{constructor(e,t){super("workbench.files.action.saveModel",d(10164,null));this.model=e;this.options=t}async run(){this.model.isDisposed()||await this.model.save({...this.options,reason:1})}},ixi=class extends st{constructor(e){super("workbench.files.action.revertModel",d(10165,null));this.model=e}async run(){this.model.isDisposed()||await this.model.revert()}},Oet=class extends st{constructor(e,t){super("workbench.files.action.saveModelAs",NBt.value);this.model=e;this.editorService=t}async run(){if(!this.model.isDisposed()){let e=this.findEditor();e&&await this.editorService.save(e,{saveAs:!0,reason:1})}}findEditor(){let e,t=this.editorService.findEditors(this.model.resource,{supportSideBySide:1});for(let o of t)if(o.editor instanceof hI){e=o;break}else e||(e=o);return e}};Oet=I([m(1,ee)],Oet);var oxi=class extends st{constructor(e,t){super("workbench.files.action.unlock",d(10156,null));this.model=e;this.options=t}async run(){this.model.isDisposed()||await this.model.save({...this.options,writeUnlock:!0,reason:1})}},nxi=class extends st{constructor(e,t){super("workbench.files.action.saveIgnoreModifiedSince",d(10156,null));this.model=e;this.options=t}async run(){this.model.isDisposed()||await this.model.save({...this.options,ignoreModifiedSince:!0,reason:1})}},Fet=class extends st{constructor(e){super("workbench.files.action.configureSaveConflict",d(10152,null));this.preferencesService=e}async run(){this.preferencesService.openSettings({query:"files.saveConflictResolution"})}};Fet=I([m(0,Po)],Fet);var huo=(a,i)=>fuo(a,i,!0),guo=(a,i)=>fuo(a,i,!1);async function fuo(a,i,e){let t=a.get(ee);if(!A.isUri(i))return;let o=t.activeEditorPane;if(!o)return;let n=o.input,r=o.group;if(L6o(),e){let s={ignoreModifiedSince:!0,reason:1};await t.save({editor:n,groupId:r.id},s)}else await t.revert({editor:n,groupId:r.id});return await t.openEditor({resource:i},r),r.closeEditor(n)}var nHt=_,ww=class extends zr{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super(e,l,n,s,c,o,t,v,u,h);this.editorGroupService=r;this.telemetryService=p;this.workingCopyService=g;this.filesConfigurationService=f;this.fileService=b;this.needsRefresh=!1;this.elements=[];this.blockFocusActiveEditorTracking=!1;this.structuralRefreshDelay=0,this.sortOrder=s.getValue("explorer.openEditors.sortOrder"),this.registerUpdateEvents(),this._register(this.configurationService.onDidChangeConfiguration(S=>this.onConfigurationChange(S))),this._register(this.workingCopyService.onDidChangeDirty(S=>this.updateDirtyIndicator(S)))}static{this.DEFAULT_VISIBLE_OPEN_EDITORS=9}static{this.DEFAULT_MIN_VISIBLE_OPEN_EDITORS=0}static{this.ID="workbench.explorer.openEditorsView"}static{this.NAME=L(10504,"Open Editors")}registerUpdateEvents(){let e=()=>{if(!this.isBodyVisible()||!this.list){this.needsRefresh=!0;return}this.listRefreshScheduler?.schedule(this.structuralRefreshDelay)},t=this._register(new jt),o=n=>{let r=n.onDidModelChange(s=>{if(this.listRefreshScheduler?.isScheduled())return;if(!this.isBodyVisible()||!this.list){this.needsRefresh=!0;return}let l=this.getIndex(n,s.editor);switch(s.kind){case 8:this.focusActiveEditor();break;case 1:case 2:l>=0&&this.list.splice(l,1,[n]);break;case 14:case 13:case 10:case 11:case 9:this.list.splice(l,1,[new wh(s.editor,n)]),this.focusActiveEditor();break;case 5:case 7:case 6:e();break}});t.set(n.id,r)};this.editorGroupService.groups.forEach(n=>o(n)),this._register(this.editorGroupService.onDidAddGroup(n=>{o(n),e()})),this._register(this.editorGroupService.onDidMoveGroup(()=>e())),this._register(this.editorGroupService.onDidChangeActiveGroup(()=>this.focusActiveEditor())),this._register(this.editorGroupService.onDidRemoveGroup(n=>{t.deleteAndDispose(n.id),e()}))}renderHeaderTitle(e){super.renderHeaderTitle(e,this.title);let t=R(e,nHt(".open-editors-dirty-count-container"));this.dirtyCountElement=R(t,nHt(".dirty-count.monaco-count-badge.long")),this.dirtyCountElement.style.backgroundColor=wt(rv),this.dirtyCountElement.style.color=wt(Yw),this.dirtyCountElement.style.border=`1px solid ${wt(gi)}`,this.updateDirtyIndicator()}renderBody(e){super.renderBody(e),e.classList.add("open-editors"),e.classList.add("show-file-icons");let t=new Wet;this.list&&this.list.dispose(),this.listLabels&&this.listLabels.clear(),this.dnd=new oHt(this.sortOrder,this.instantiationService,this.editorGroupService),this.listLabels=this.instantiationService.createInstance(Za,{onDidChangeVisibility:this.onDidChangeBodyVisibility}),this.list=this.instantiationService.createInstance(Rl,"OpenEditors",e,t,[new rHt(this.keybindingService,this.instantiationService),new sHt(this.listLabels,this.instantiationService,this.keybindingService,this.configurationService)],{identityProvider:{getId:r=>r instanceof wh?r.getId():r.id.toString()},dnd:this.dnd,overrideStyles:this.getLocationBasedColors().listOverrideStyles,accessibilityProvider:new lxi}),this._register(this.list),this._register(this.listLabels);let o=[];this.listRefreshScheduler=this._register(new Dt(()=>{if(!this.list)return;o=Ue(o);let r=this.list.length,s=this.getElements();this.list.splice(0,this.list.length,s),this.focusActiveEditor(),r!==this.list.length&&this.updateSize(),this.needsRefresh=!1,(this.sortOrder==="alphabetical"||this.sortOrder==="fullPath")&&s.forEach(l=>{l instanceof wh&&o.push(l.editor.onDidChangeLabel(()=>this.listRefreshScheduler?.schedule()))})},this.structuralRefreshDelay)),this.updateSize(),this.handleContextKeys(),this._register(this.list.onContextMenu(r=>this.onListContextMenu(r))),this._register(this.list.onMouseMiddleClick(r=>{if(r&&r.element instanceof wh){if(zxe(r.element.group,r.element.editor,2,this.editorGroupService.partOptions))return;r.element.group.closeEditor(r.element.editor,{preserveFocus:!0})}})),this._register(this.list.onDidOpen(r=>{let s=r.element;if(s)if(s instanceof wh){if(Vp(r.browserEvent)&&r.browserEvent.button===1)return;this.withActiveEditorFocusTrackingDisabled(()=>{this.openEditor(s,{preserveFocus:r.editorOptions.preserveFocus,pinned:r.editorOptions.pinned,sideBySide:r.sideBySide})})}else this.withActiveEditorFocusTrackingDisabled(()=>{this.editorGroupService.activateGroup(s),r.editorOptions.preserveFocus||s.focus()});else return})),this.listRefreshScheduler.schedule(0),this._register(this.onDidChangeBodyVisibility(r=>{r&&this.needsRefresh&&this.listRefreshScheduler?.schedule(0)}));let n=this.viewDescriptorService.getViewContainerModel(this.viewDescriptorService.getViewContainerByViewId(this.id));this._register(n.onDidChangeAllViewDescriptors(()=>{this.updateSize()}))}handleContextKeys(){if(!this.list)return;woo.bindTo(this.list.contextKeyService),C7e.bindTo(this.list.contextKeyService);let e=c3.bindTo(this.contextKeyService),t=XMe.bindTo(this.contextKeyService),o=Det.bindTo(this.contextKeyService),n=WBt.bindTo(this.contextKeyService),r=this.instantiationService.createInstance(Fo);this._register(r),this._register(this.list.onDidChangeFocus(s=>{r.reset(),e.reset(),t.reset(),o.reset();let l=s.elements.length?s.elements[0]:void 0;if(l instanceof wh){let c=l.getResource();t.set(l.editor.isDirty()&&!l.editor.isSaving()),o.set(!!l.editor.isReadonly()),r.set(c??null)}else l&&e.set(!0)})),this._register(this.list.onDidChangeSelection(s=>{let l=s.elements.every(c=>{if(c instanceof wh){let u=c.getResource();return u&&(u.scheme===Y.untitled||this.fileService.hasProvider(u))}return!1});n.set(l)}))}focus(){super.focus(),this.list?.domFocus()}layoutBody(e,t){super.layoutBody(e,t),this.list?.layout(e,t)}get showGroups(){return this.editorGroupService.groups.length>1}getElements(){return this.elements=[],this.editorGroupService.getGroups(2).forEach(e=>{this.showGroups&&this.elements.push(e);let t=e.editors.map(o=>new wh(o,e));this.sortOrder==="alphabetical"?t=t.sort((o,n)=>h7e(o.editor.getName(),n.editor.getName())):this.sortOrder==="fullPath"&&(t=t.sort((o,n)=>{let r=o.editor.resource,s=n.editor.resource;if(r===void 0&&s===void 0)return h7e(o.editor.getName(),n.editor.getName());if(r===void 0)return-1;if(s===void 0)return 1;{let l=r.scheme,c=s.scheme;return l!==Y.file&&c!==Y.file?dx.compare(r,s):l!==Y.file?-1:c!==Y.file?1:dx.compare(r,s)}})),this.elements.push(...t)}),this.elements}getIndex(e,t){return t?this.elements.findIndex(o=>o instanceof wh&&o.editor===t&&o.group.id===e.id):this.elements.findIndex(o=>!(o instanceof wh)&&o.id===e.id)}openEditor(e,t){e&&(this.telemetryService.publicLog2("workbenchActionExecuted",{id:"workbench.files.openFile",from:"openEditors"}),t.sideBySide&&t.preserveFocus||this.editorGroupService.activateGroup(e.group),(t.sideBySide?this.editorGroupService.sideGroup:e.group).openEditor(e.editor,t))}onListContextMenu(e){if(!e.element)return;let t=e.element;this.contextMenuService.showContextMenu({menuId:D.OpenEditorsContext,menuActionOptions:{shouldForwardArgs:!0,arg:t instanceof wh?no.getOriginalUri(t.editor):{}},contextKeyService:this.list?.contextKeyService,getAnchor:()=>e.anchor,getActionsContext:()=>t instanceof wh?{groupId:t.groupId,editorIndex:t.group.getIndexOfEditor(t.editor)}:{groupId:t.id}})}withActiveEditorFocusTrackingDisabled(e){this.blockFocusActiveEditorTracking=!0;try{e()}finally{this.blockFocusActiveEditorTracking=!1}}focusActiveEditor(){if(!(!this.list||this.blockFocusActiveEditorTracking)){if(this.list.length&&this.editorGroupService.activeGroup){let e=this.getIndex(this.editorGroupService.activeGroup,this.editorGroupService.activeGroup.activeEditor);if(e>=0){try{this.list.setFocus([e]),this.list.setSelection([e]),this.list.reveal(e)}catch{}return}}this.list.setFocus([]),this.list.setSelection([])}}onConfigurationChange(e){e.affectsConfiguration("explorer.openEditors")&&this.updateSize(),(e.affectsConfiguration("explorer.decorations")||e.affectsConfiguration("explorer.openEditors.sortOrder"))&&(this.sortOrder=this.configurationService.getValue("explorer.openEditors.sortOrder"),this.dnd&&(this.dnd.sortOrder=this.sortOrder),this.listRefreshScheduler?.schedule())}updateSize(){this.minimumBodySize=this.orientation===0?this.getMinExpandedBodySize():170,this.maximumBodySize=this.orientation===0?this.getMaxExpandedBodySize():Number.POSITIVE_INFINITY}updateDirtyIndicator(e){if(e&&e.isDirty()&&!(e.capabilities&2)&&this.filesConfigurationService.hasShortAutoSaveDelay(e.resource))return;let t=this.workingCopyService.dirtyCount;t===0?this.dirtyCountElement.classList.add("hidden"):(this.dirtyCountElement.textContent=d(10499,null,t),this.dirtyCountElement.classList.remove("hidden"))}get elementCount(){return this.editorGroupService.groups.map(e=>e.count).reduce((e,t)=>e+t,this.showGroups?this.editorGroupService.groups.length:0)}getMaxExpandedBodySize(){let e=this.configurationService.getValue("explorer.openEditors.minVisible");return typeof e!="number"&&(e=ww.DEFAULT_MIN_VISIBLE_OPEN_EDITORS),this.viewDescriptorService.getViewContainerModel(this.viewDescriptorService.getViewContainerByViewId(this.id)).visibleViewDescriptors.length<=1?Number.POSITIVE_INFINITY:Math.max(this.elementCount,e)*Wet.ITEM_HEIGHT}getMinExpandedBodySize(){let e=this.configurationService.getValue("explorer.openEditors.visible");return typeof e!="number"&&(e=ww.DEFAULT_VISIBLE_OPEN_EDITORS),this.computeMinExpandedBodySize(e)}computeMinExpandedBodySize(e=ww.DEFAULT_VISIBLE_OPEN_EDITORS){return Math.min(Math.max(e,1),this.elementCount)*Wet.ITEM_HEIGHT}setStructuralRefreshDelay(e){this.structuralRefreshDelay=e}getOptimalWidth(){if(!this.list)return super.getOptimalWidth();let e=this.list.getHTMLElement(),t=[].slice.call(e.querySelectorAll(".open-editor > a"));return jbe(e,t)}};ww=I([m(1,F),m(2,Ri),m(3,ze),m(4,Et),m(5,B),m(6,_e),m(7,X),m(8,De),m(9,Te),m(10,tt),m(11,Wa),m(12,lr),m(13,Qe),m(14,be)],ww);var axi=class extends as{async run(i){if(this.editor)return super.run(i,{groupId:this.editor.groupId,editorIndex:this.editor.group.getIndexOfEditor(this.editor.editor)})}},Wet=class a{static{this.ITEM_HEIGHT=22}getHeight(i){return a.ITEM_HEIGHT}getTemplateId(i){return i instanceof wh?sHt.ID:rHt.ID}},rHt=class a{constructor(i,e){this.keybindingService=i;this.instantiationService=e}static{this.ID="editorgroup"}get templateId(){return a.ID}renderTemplate(i){let e=Object.create(null);e.root=R(i,nHt(".editor-group")),e.name=R(e.root,nHt("span.name")),e.actionBar=new ji(i);let t=this.instantiationService.createInstance(ZMe,ZMe.ID,ZMe.LABEL),o=this.keybindingService.lookupKeybinding(t.id);e.actionBar.push(t,{icon:!0,label:!1,keybinding:o?o.getLabel():void 0});let n=this.instantiationService.createInstance(fee,fee.ID,fee.LABEL),r=this.keybindingService.lookupKeybinding(n.id);return e.actionBar.push(n,{icon:!0,label:!1,keybinding:r?r.getLabel():void 0}),e}renderElement(i,e,t){t.editorGroup=i,t.name.textContent=i.label,t.actionBar.context={groupId:i.id}}disposeTemplate(i){i.actionBar.dispose()}},sHt=class a{constructor(i,e,t,o){this.labels=i;this.instantiationService=e;this.keybindingService=t;this.configurationService=o;this.closeEditorAction=this.instantiationService.createInstance(SJ,SJ.ID,SJ.LABEL),this.unpinEditorAction=this.instantiationService.createInstance(gF,gF.ID,gF.LABEL)}static{this.ID="openeditor"}get templateId(){return a.ID}renderTemplate(i){let e=Object.create(null);return e.container=i,e.actionRunner=new axi,e.actionBar=new ji(i,{actionRunner:e.actionRunner}),e.root=this.labels.create(i),e}renderElement(i,e,t){let o=i.editor;t.actionRunner.editor=i,t.container.classList.toggle("dirty",o.isDirty()&&!o.isSaving()),t.container.classList.toggle("sticky",i.isSticky()),t.root.setResource({resource:no.getOriginalUri(o,{supportSideBySide:3}),name:o.getName(),description:o.getDescription(1)},{italic:i.isPreview(),extraClasses:["open-editor"].concat(i.editor.getLabelExtraClasses()),fileDecorations:this.configurationService.getValue().explorer.decorations,title:o.getTitle(2),icon:o.getIcon()});let n=i.isSticky()?this.unpinEditorAction:this.closeEditorAction;t.actionBar.hasAction(n)||(t.actionBar.isEmpty()||t.actionBar.clear(),t.actionBar.push(n,{icon:!0,label:!1,keybinding:this.keybindingService.lookupKeybinding(n.id)?.getLabel()}))}disposeTemplate(i){i.actionBar.dispose(),i.root.dispose(),i.actionRunner.dispose()}},oHt=class{constructor(i,e,t){this.instantiationService=e;this.editorGroupService=t;this._sortOrder=i}set sortOrder(i){this._sortOrder=i}get dropHandler(){return this.instantiationService.createInstance(sF,{allowWorkspaceOpen:!1})}getDragURI(i){if(i instanceof wh){let e=i.getResource();if(e)return e.toString()}return null}getDragLabel(i){if(i.length>1)return String(i.length);let e=i[0];return e instanceof wh?e.editor.getName():e.label}onDragStart(i,e){let t=i.elements,o=[];if(t)for(let n of t)n instanceof wh&&o.push(n);o.length&&this.instantiationService.invokeFunction(Ig,o,e)}onDragOver(i,e,t,o,n){if(i instanceof p1&&!gu(n,Aa.FILES,Ll.FILES))return!1;if(this._sortOrder!=="editorOrder")return i instanceof $y?!1:{accept:!0,effect:{type:1},feedback:[-1]};let r;switch(o){case 0:case 1:r=t===0&&e instanceof Uf?"drop-target-after":"drop-target-before";break;case 2:case 3:r="drop-target-after";break}return{accept:!0,effect:{type:1,position:r},feedback:[t]}}drop(i,e,t,o,n){let r=e instanceof wh?e.group:e||this.editorGroupService.groups[this.editorGroupService.count-1],s=e instanceof wh?e.group.getIndexOfEditor(e.editor):0;switch(o){case 0:case 1:e instanceof Uf&&r.index!==0&&(r=this.editorGroupService.groups[r.index-1],s=r.count);break;case 3:case 2:e instanceof wh&&s++;break}if(i instanceof $y){for(let l of i.elements){let c=l.group.getIndexOfEditor(l.editor);l.group===r&&c<s&&s--,l.group.moveEditor(l.editor,r,{index:s,preserveFocus:!0}),s++}this.editorGroupService.activateGroup(r)}else this.dropHandler.handleDrop(n,It,()=>r,()=>r.focus(),{index:s})}dispose(){}};I([mi],oHt.prototype,"dropHandler",1);var lxi=class{getWidgetAriaLabel(){return d(10505,null)}getAriaLabel(i){return i instanceof wh?`${i.editor.getName()}, ${i.editor.getDescription()}`:i.ariaLabel}},R6o="workbench.action.toggleEditorGroupLayout";W(class extends K{constructor(){super({id:"workbench.action.toggleEditorGroupLayout",title:L(10500,"Toggle Vertical/Horizontal Editor Layout"),f1:!0,keybinding:{primary:1557,mac:{primary:2581},weight:200},icon:M.editorLayout,menu:{id:D.ViewTitle,group:"navigation",when:x.and(x.equals("view",ww.ID),iS),order:10}})}async run(a){let i=a.get(Et),e=i.orientation===1?0:1;i.setGroupOrientation(e),i.activeGroup.focus()}});fe.appendMenuItem(D.MenubarLayoutMenu,{group:"5_flip",command:{id:R6o,title:{...L(10502,"Flip Layout"),mnemonicTitle:d(10501,null)}},order:1});W(class extends K{constructor(){super({id:"workbench.action.files.saveAll",title:Bdo,f1:!0,icon:M.saveAll,menu:{id:D.ViewTitle,group:"navigation",when:x.equals("view",ww.ID),order:20}})}async run(a){await a.get(ge).executeCommand(YMe)}});W(class extends K{constructor(){super({id:"openEditors.closeAll",title:vue.LABEL,f1:!1,icon:M.closeAll,menu:{id:D.ViewTitle,group:"navigation",when:x.equals("view",ww.ID),order:30}})}async run(a){let i=a.get(F),e=new vue;await i.invokeFunction(t=>e.run(t))}});W(class extends K{constructor(){super({id:"openEditors.newUntitledFile",title:L(10503,"New Untitled Text File"),f1:!1,icon:M.newFile,menu:{id:D.ViewTitle,group:"navigation",when:x.equals("view",ww.ID),order:5}})}async run(a){await a.get(ge).executeCommand(ZF)}});var buo=(a,i,e)=>{if(Array.isArray(i)){let t=a.get(oi),o=a.get(Co);i=i.map(n=>nwe(n)&&n.workspaceUri.scheme===Y.untitled?{workspaceUri:je(o.untitledWorkspacesHome,n.workspaceUri.path,y4i)}:n),t.openWindow(i,e)}},Suo=(a,i)=>{a.get(oi).openWindow(i)};yt.registerCommandAndKeybindingRule({weight:200,when:xoo,primary:2051,mac:{primary:259},id:LBt,handler:async(a,i)=>{let e=a.get(ee),t=a.get(be),o=a.get(za),n=e0(i,a.get(fo),e,a.get(Et),o);if(n.length){let r=n.filter(p=>p.scheme===Y.untitled),s=n.filter(p=>p.scheme!==Y.untitled),u=(await Promise.all(s.map(async p=>{let h=o.findClosest(p);return h||await t.stat(p)}))).filter(p=>!p.isDirectory).map(p=>({resource:p.resource,options:{pinned:!0}})).concat(...r.map(p=>({resource:p,options:{pinned:!0}})));await e.openEditors(u,vn)}}});yt.registerCommandAndKeybindingRule({weight:210,when:x.and(WC,lu.toNegated()),primary:3,mac:{primary:2066},id:"explorer.openAndPassFocus",handler:async(a,i)=>{let e=a.get(ee),o=a.get(za).getContext(!0);o.length&&await e.openEditors(o.map(n=>({resource:n.resource,options:{preserveFocus:!1,pinned:!0}})))}});var cxi="showModifications",vee=[];yt.registerCommandAndKeybindingRule({id:Tet,when:void 0,weight:200,primary:Ai(2089,34),handler:async(a,i)=>{let e=a.get(F),t=a.get(Nt),o=a.get(ee),n=a.get(be),r=a.get(fo),s=!1;if(vee.length===0){s=!0;let c=e.createInstance(wR);vee.push(c),vee.push(t.registerTextModelContentProvider(cxi,c))}let l=Ime(i,o,r);if(l&&n.hasProvider(l)){let c=Ye(l),u=d(10318,null,c,c);try{await wR.open(l,cxi,u,o,{pinned:!0}),s&&vee.push(o.onDidVisibleEditorsChange(()=>{o.editors.some(p=>!!no.getCanonicalUri(p,{supportSideBySide:2,filterByScheme:cxi}))||(vee=Ue(vee))}))}catch{vee=Ue(vee)}}}});var uxi,dxi;qe.registerCommand({id:MBt,handler:(a,i)=>{uxi=Ime(i,a.get(ee),a.get(fo)),dxi||(dxi=Let.bindTo(a.get(X))),dxi.set(!0)}});qe.registerCommand({id:PBt,handler:async(a,i)=>{let e=a.get(ee),t=e0(i,a.get(fo),e,a.get(Et),a.get(za));return t.length===2?e.openEditor({original:{resource:t[0]},modified:{resource:t[1]},options:{pinned:!0}}):!0}});qe.registerCommand({id:ABt,handler:(a,i)=>{let e=a.get(ee),t=Ime(i,e,a.get(fo));uxi&&t&&e.openEditor({original:{resource:uxi},modified:{resource:t},options:{pinned:!0}})}});async function pxi(a,i,e,t,o){if(a.length){let n=ri?`\r
`:`
`,r,s=i?"explorer.copyRelativePathSeparator":"explorer.copyPathSeparator",l=o.getValue(s);(l==="/"||l==="\\")&&(r=l);let c=a.map(u=>t.getUriLabel(u,{relative:i,noPrefix:!0,separator:r})).join(n);await e.writeText(c)}}var Iuo=async(a,i)=>{let e=e0(i,a.get(fo),a.get(ee),a.get(Et),a.get(za));await pxi(e,!1,a.get(Wi),a.get(ot),a.get(B))};yt.registerCommandAndKeybindingRule({weight:200,when:ue.focus.toNegated(),primary:2593,win:{primary:1569},id:vme,handler:Iuo});yt.registerCommandAndKeybindingRule({weight:200,when:ue.focus,primary:Ai(2089,2593),win:{primary:1569},id:vme,handler:Iuo});var yuo=async(a,i)=>{let e=e0(i,a.get(fo),a.get(ee),a.get(Et),a.get(za));await pxi(e,!0,a.get(Wi),a.get(ot),a.get(B))};yt.registerCommandAndKeybindingRule({weight:200,when:ue.focus.toNegated(),primary:3617,win:{primary:Ai(2089,3105)},id:bme,handler:yuo});yt.registerCommandAndKeybindingRule({weight:200,when:ue.focus,primary:Ai(2089,3617),win:{primary:Ai(2089,3105)},id:bme,handler:yuo});yt.registerCommandAndKeybindingRule({weight:200,when:void 0,primary:Ai(2089,46),id:"workbench.action.files.copyPathOfActiveFile",handler:async a=>{let e=a.get(ee).activeEditor,t=no.getOriginalUri(e,{supportSideBySide:1});await pxi(t?[t]:[],!1,a.get(Wi),a.get(ot),a.get(B))}});qe.registerCommand({id:JF,handler:async(a,i)=>{let e=a.get(Ft),t=a.get(Pe),o=a.get(za),n=a.get(ee),r=a.get(fo),s=Ime(i,n,r);if(s&&t.isInsideWorkspace(s)){let l=await e.openView(Cb,!1);if(l){let c=l.autoReveal;l.autoReveal=!1,l.setExpanded(!0),await o.select(s,"force"),l.focus(),l.autoReveal=c}}else{let l=e.getViewWithId(ww.ID);l&&(l.setExpanded(!0),l.focus())}}});qe.registerCommand({id:RBt,handler:async(a,i)=>{let e=a.get(ee),t=a.get(fo),o=Ime(i,e,t);if(o)return e.openEditor({resource:o,options:{override:0,source:1}})}});async function mxi(a,i){let e=a.get(Et),t=a.get(Kt),o=a.get(Ho),n=zCi(a);if(!n){let s=e.activeGroup;s.activeEditor&&(n=[],s.activeEditor instanceof ga&&!i?.saveAs&&!(s.activeEditor.primary.hasCapability(4)||s.activeEditor.secondary.hasCapability(4))&&s.activeEditor.secondary.isModified()?(n.push({groupId:s.id,editor:s.activeEditor.primary}),n.push({groupId:s.id,editor:s.activeEditor.secondary})):n.push({groupId:s.id,editor:s.activeEditor}))}if(!n||n.length===0)return;await hxi(a,n,i);let r=t.getFocusedCodeEditor();if(r instanceof zc&&!r.isSimpleWidget){let s=r.getModel()?.uri;s&&!n.some(({editor:l})=>Xe(no.getCanonicalUri(l,{supportSideBySide:1}),s))&&(o.files.get(s)?.isReadonly()||await o.save(s,i))}}function wuo(a,i,e){let t=[];for(let o of i)for(let n of o.getEditors(0))n.isDirty()&&t.push({groupId:o.id,editor:n});return hxi(a,t,e)}async function hxi(a,i,e){let t=a.get(ee),o=a.get(Ne),n=a.get(F);try{await t.save(i,e)}catch(r){if(!so(r)){let s=[pi({id:"workbench.action.files.saveEditors",label:d(10320,null),run:()=>n.invokeFunction(c=>hxi(c,i,e))})],l=i.filter(({editor:c})=>!c.hasCapability(4));l.length>0&&s.push(pi({id:"workbench.action.files.revertEditors",label:l.length>1?d(10322,null):d(10321,null),run:()=>t.revert(l)})),o.notify({id:i.map(({editor:c})=>Ir(c.resource?.toString())).join(),severity:St.Error,message:d(10317,null,i.map(({editor:c})=>c.getName()).join(", "),In(r,!1)),actions:{primary:s}})}}}yt.registerCommandAndKeybindingRule({when:void 0,weight:200,primary:2097,id:QMe,handler:a=>mxi(a,{reason:1,force:!0})});yt.registerCommandAndKeybindingRule({when:void 0,weight:200,primary:Ai(2089,49),win:{primary:Ai(2089,3121)},id:OBt,handler:a=>mxi(a,{reason:1,force:!0,skipSaveParticipants:!0})});yt.registerCommandAndKeybindingRule({id:_et,weight:200,when:void 0,primary:3121,handler:a=>mxi(a,{reason:1,saveAs:!0})});yt.registerCommandAndKeybindingRule({when:void 0,weight:200,primary:void 0,mac:{primary:2609},win:{primary:Ai(2089,49)},id:YMe,handler:a=>wuo(a,a.get(Et).getGroups(1),{reason:1})});qe.registerCommand({id:Sme,handler:(a,i,e)=>{let t=a.get(Et),o=lp([e],a.get(ee),t,a.get(fo)),n;return o.groupedEditors.length?n=o.groupedEditors.map(({group:r})=>r):n=t.getGroups(1),wuo(a,n,{reason:1})}});qe.registerCommand({id:FBt,handler:async a=>(await a.get(ee).saveAll({includeUntitled:!1,reason:1})).success});qe.registerCommand({id:jMe,handler:async a=>{let i=a.get(Et),e=a.get(ee),t=zCi(a);if(!t){let o=i.activeGroup;o.activeEditor&&(t=[{groupId:o.id,editor:o.activeEditor}])}if(!(!t||t.length===0))try{await e.revert(t.filter(({editor:o})=>!o.hasCapability(4)),{force:!0})}catch(o){a.get(Ne).error(d(10316,null,t.map(({editor:r})=>r.getName()).join(", "),In(o,!1)))}}});qe.registerCommand({id:VBt,handler:(a,i)=>{let e=a.get(Pe),t=a.get(dt),o=e.getWorkspace(),n=e0(i,a.get(fo),a.get(ee),a.get(Et),a.get(za)).filter(s=>o.folders.some(l=>t.extUri.isEqual(l.uri,s)));return n.length===0?a.get(ge).executeCommand(d7e.ID):a.get(Of).removeFolders(n)}});yt.registerCommandAndKeybindingRule({weight:210,when:x.and(WC,uue,x7e.negate()),primary:15,id:Udo,handler:a=>{let e=a.get(ds).getActivePaneComposite(0);if(e?.getId()!==Hf)return;e.getViewPaneContainer().getExplorerView().previousCompressedStat()}});yt.registerCommandAndKeybindingRule({weight:210,when:x.and(WC,uue,k7e.negate()),primary:17,id:zdo,handler:a=>{let e=a.get(ds).getActivePaneComposite(0);if(e?.getId()!==Hf)return;e.getViewPaneContainer().getExplorerView().nextCompressedStat()}});yt.registerCommandAndKeybindingRule({weight:210,when:x.and(WC,uue,x7e.negate()),primary:14,id:Kdo,handler:a=>{let e=a.get(ds).getActivePaneComposite(0);if(e?.getId()!==Hf)return;e.getViewPaneContainer().getExplorerView().firstCompressedStat()}});yt.registerCommandAndKeybindingRule({weight:210,when:x.and(WC,uue,k7e.negate()),primary:13,id:Gdo,handler:a=>{let e=a.get(ds).getActivePaneComposite(0);if(e?.getId()!==Hf)return;e.getViewPaneContainer().getExplorerView().lastCompressedStat()}});yt.registerCommandAndKeybindingRule({weight:200,when:null,primary:Gt?ri?Ai(2089,44):2604:2092,secondary:Gt?[2092]:void 0,id:ZF,metadata:{description:BBt,args:[{isOptional:!0,name:"New Untitled Text File arguments",description:"The editor view type or language ID if known",schema:{type:"object",properties:{viewType:{type:"string"},languageId:{type:"string"}}}}]},handler:async(a,i)=>{await a.get(ee).openEditor({resource:void 0,options:{override:i?.viewType,pinned:!0},languageId:i?.languageId})}});qe.registerCommand({id:$do,handler:async(a,i)=>{let e=a.get(ee),t=a.get(dn),o=a.get(be),n=d(10319,null),r=je(await t.defaultFilePath(),i?.fileName??"Untitled.txt"),s=await t.showSaveDialog({saveLabel:n,title:n,defaultUri:r});s&&(await o.createFile(s,void 0,{overwrite:!0}),await e.openEditor({resource:s,options:{override:i?.viewType,pinned:!0},languageId:i?.languageId}))}});W($Bt);W(qBt);W(jBt);W(XBt);W(YBt);W(Pet);W(QBt);W(JBt);W(ZBt);W(eHt);W(tHt);qe.registerCommand("_files.windowOpen",buo);qe.registerCommand("_files.newWindow",Suo);var p3=10,Cuo="renameFile";yt.registerCommandAndKeybindingRule({id:Cuo,weight:200+p3,when:x.and(WC,FC.toNegated(),pF),primary:60,mac:{primary:3},handler:auo});var xuo="moveFileToTrash";yt.registerCommandAndKeybindingRule({id:xuo,weight:200+p3,when:x.and(WC,due),primary:20,mac:{primary:2049,secondary:[20]},handler:luo});var aHt="deleteFile";yt.registerCommandAndKeybindingRule({id:aHt,weight:200+p3,when:WC,primary:1044,mac:{primary:2561},handler:XCi});yt.registerCommandAndKeybindingRule({id:aHt,weight:200+p3,when:x.and(WC,due.toNegated()),primary:20,mac:{primary:2049},handler:XCi});var kuo="filesExplorer.cut";yt.registerCommandAndKeybindingRule({id:kuo,weight:200+p3,when:x.and(WC,FC.toNegated(),pF),primary:2102,handler:duo});var Euo="filesExplorer.copy";yt.registerCommandAndKeybindingRule({id:Euo,weight:200+p3,when:x.and(WC,FC.toNegated()),primary:2081,handler:cuo});var gxi="filesExplorer.paste";qe.registerCommand(gxi,uuo);yt.registerKeybindingRule({id:`^${gxi}`,weight:200+p3,when:x.and(WC,pF),primary:2100});yt.registerCommandAndKeybindingRule({id:"filesExplorer.cancelCut",weight:200+p3,when:x.and(WC,BPt),primary:9,handler:async a=>{await a.get(za).setToCopy([],!0)}});yt.registerCommandAndKeybindingRule({id:"filesExplorer.openFilePreserveFocus",weight:200+p3,when:x.and(WC,lu.toNegated()),primary:10,handler:puo});var Vet={id:vme,title:d(10289,null)},Bet={id:bme,title:d(10291,null)},oPe={id:JF,title:d(10309,null)};Het(vme,Vet.title,Fo.IsFileSystemResource,"1_cutcopypaste",!0);Het(bme,Bet.title,Fo.IsFileSystemResource,"1_cutcopypaste",!0);Het(oPe.id,oPe.title,Fo.IsFileSystemResource,"2_files",!1,1);function Het(a,i,e,t,o,n){let r=o!==!0?Oj.negate():void 0;fe.appendMenuItem(D.EditorTitleContext,{command:{id:a,title:i,precondition:r},when:e,group:t,order:n})}Tuo("workbench.files.action.acceptLocalChanges",d(10278,null),M.check,-10,huo);Tuo("workbench.files.action.revertLocalChanges",d(10312,null),M.discard,-9,guo);function Tuo(a,i,e,t,o){qe.registerCommand(a,o),fe.appendMenuItem(D.EditorTitle,{command:{id:a,title:i,icon:e},when:x.equals(rxi,!0),group:"navigation",order:t})}function HR({id:a,title:i,category:e,metadata:t},o){fe.appendMenuItem(D.CommandPalette,{command:{id:a,title:i,category:e,metadata:t},when:o})}HR({id:vme,title:L(10290,"Copy Path of Active File"),category:We.File});HR({id:bme,title:L(10292,"Copy Relative Path of Active File"),category:We.File});HR({id:QMe,title:HCi,category:We.File});HR({id:OBt,title:Vdo,category:We.File});HR({id:Sme,title:L(10314,"Save All in Group"),category:We.File});HR({id:FBt,title:L(10315,"Save All Files"),category:We.File});HR({id:jMe,title:L(10310,"Revert File"),category:We.File});HR({id:Tet,title:L(10283,"Compare Active File with Saved"),category:We.File,metadata:{description:L(10284,"Opens a new diff editor to compare the active file with the version on disk.")}});HR({id:_et,title:NBt,category:We.File});HR({id:wme,title:$Ci,category:We.File},mC.notEqualsTo("0"));HR({id:tPe,title:qCi,category:We.File,metadata:{description:L(10305,"Create a new folder or directory")}},mC.notEqualsTo("0"));HR({id:ZF,title:BBt,category:We.File});var fxi=x.or(Fo.IsFileSystemResource,Fo.Scheme.isEqualTo(Y.untitled)),lHt={id:LBt,title:d(10307,null)};fe.appendMenuItem(D.OpenEditorsContext,{group:"navigation",order:10,command:lHt,when:fxi});fe.appendMenuItem(D.OpenEditorsContext,{group:"1_open",order:10,command:{id:f_e,title:d(10308,null)},when:x.and(AO,c3.toNegated())});fe.appendMenuItem(D.OpenEditorsContext,{group:"1_cutcopypaste",order:10,command:Vet,when:Fo.IsFileSystemResource});fe.appendMenuItem(D.OpenEditorsContext,{group:"1_cutcopypaste",order:20,command:Bet,when:Fo.IsFileSystemResource});fe.appendMenuItem(D.OpenEditorsContext,{group:"2_save",order:10,command:{id:QMe,title:HCi,precondition:XMe},when:x.or(Fo.Scheme.isEqualTo(Y.untitled),x.and(c3.toNegated(),Det.toNegated(),x8e.toNegated()))});fe.appendMenuItem(D.OpenEditorsContext,{group:"2_save",order:20,command:{id:jMe,title:d(10311,null),precondition:XMe},when:x.and(c3.toNegated(),Det.toNegated(),Fo.Scheme.notEqualsTo(Y.untitled),x8e.toNegated())});fe.appendMenuItem(D.OpenEditorsContext,{group:"2_save",order:30,command:{id:Sme,title:d(10313,null),precondition:R8e},when:c3});fe.appendMenuItem(D.OpenEditorsContext,{group:"3_compare",order:10,command:{id:Tet,title:d(10287,null),precondition:XMe},when:x.and(Fo.IsFileSystemResource,x8e.toNegated(),AW.toNegated())});var _uo={id:ABt,title:d(10288,null)};fe.appendMenuItem(D.OpenEditorsContext,{group:"3_compare",order:20,command:_uo,when:x.and(Fo.HasResource,Let,fxi,AW.toNegated())});var Duo={id:MBt,title:d(10286,null)};fe.appendMenuItem(D.OpenEditorsContext,{group:"3_compare",order:30,command:Duo,when:x.and(Fo.HasResource,fxi,AW.toNegated())});var vxi={id:PBt,title:d(10285,null)};fe.appendMenuItem(D.OpenEditorsContext,{group:"3_compare",order:30,command:vxi,when:x.and(Fo.HasResource,AW,WBt)});fe.appendMenuItem(D.EditorTitleContext,{group:"1_compare",order:30,command:vxi,when:x.and(Fo.HasResource,ZEt,eTt)});fe.appendMenuItem(D.OpenEditorsContext,{group:"4_close",order:10,command:{id:OC,title:d(10279,null)},when:c3.toNegated()});fe.appendMenuItem(D.OpenEditorsContext,{group:"4_close",order:20,command:{id:g_e,title:d(10281,null)},when:c3.toNegated()});fe.appendMenuItem(D.OpenEditorsContext,{group:"4_close",order:30,command:{id:cue,title:d(10282,null)}});fe.appendMenuItem(D.OpenEditorsContext,{group:"4_close",order:40,command:{id:B5,title:d(10280,null)}});fe.appendMenuItem(D.ExplorerContext,{group:"navigation",order:4,command:{id:wme,title:$Ci,precondition:pF},when:lu});fe.appendMenuItem(D.ExplorerContext,{group:"navigation",order:6,command:{id:tPe,title:qCi,precondition:pF},when:lu});fe.appendMenuItem(D.ExplorerContext,{group:"navigation",order:10,command:lHt,when:x.and(lu.toNegated(),Fo.HasResource)});fe.appendMenuItem(D.ExplorerContext,{group:"navigation",order:20,command:{id:RBt,title:d(10295,null)},when:x.and(lu.toNegated(),VPt)});fe.appendMenuItem(D.ExplorerContext,{group:"3_compare",order:20,command:_uo,when:x.and(lu.toNegated(),Fo.HasResource,Let,AW.toNegated())});fe.appendMenuItem(D.ExplorerContext,{group:"3_compare",order:30,command:Duo,when:x.and(lu.toNegated(),Fo.HasResource,AW.toNegated())});fe.appendMenuItem(D.ExplorerContext,{group:"3_compare",order:30,command:vxi,when:x.and(lu.toNegated(),Fo.HasResource,AW)});fe.appendMenuItem(D.ExplorerContext,{group:"5_cutcopypaste",order:8,command:{id:kuo,title:d(10293,null)},when:x.and(FC.toNegated(),pF)});fe.appendMenuItem(D.ExplorerContext,{group:"5_cutcopypaste",order:10,command:{id:Euo,title:Zdo},when:FC.toNegated()});fe.appendMenuItem(D.ExplorerContext,{group:"5_cutcopypaste",order:20,command:{id:gxi,title:euo,precondition:x.and(pF,iHt)},when:lu});fe.appendMenuItem(D.ExplorerContext,{group:"5b_importexport",order:10,command:{id:jCi,title:tuo},when:x.or(x.and(ep.toNegated(),Fo.Scheme.notEqualsTo(Y.file)),x.and(ep,lu.toNegated(),FC.toNegated()),x.and(ep,qEt))});fe.appendMenuItem(D.ExplorerContext,{group:"5b_importexport",order:20,command:{id:QCi,title:iuo},when:x.and(ep,lu,pF)});fe.appendMenuItem(D.ExplorerContext,{group:"6_copypath",order:10,command:Vet,when:Fo.IsFileSystemResource});fe.appendMenuItem(D.ExplorerContext,{group:"6_copypath",order:20,command:Bet,when:Fo.IsFileSystemResource});fe.appendMenuItem(D.ExplorerContext,{group:"2_workspace",order:10,command:{id:e_e,title:sPt},when:x.and(FC,x.or(T_,Qa.isEqualTo("workspace")))});fe.appendMenuItem(D.ExplorerContext,{group:"2_workspace",order:30,command:{id:VBt,title:Hdo},when:x.and(FC,lu,x.and(mC.notEqualsTo("0"),x.or(T_,Qa.isEqualTo("workspace"))))});fe.appendMenuItem(D.ExplorerContext,{group:"7_modification",order:10,command:{id:Cuo,title:Xdo,precondition:pF},when:FC.toNegated()});fe.appendMenuItem(D.ExplorerContext,{group:"7_modification",order:20,command:{id:xuo,title:Jdo},alt:{id:aHt,title:d(10294,null)},when:x.and(FC.toNegated(),due)});fe.appendMenuItem(D.ExplorerContext,{group:"7_modification",order:20,command:{id:aHt,title:d(10294,null)},when:x.and(FC.toNegated(),due.toNegated())});for(let a of[D.EmptyEditorGroupContext,D.EditorTabsBarContext])fe.appendMenuItem(a,{command:{id:ZF,title:d(10304,null)},group:"1_file",order:10}),fe.appendMenuItem(a,{command:{id:"workbench.action.quickOpen",title:d(10306,null)},group:"1_file",order:20});fe.appendMenuItem(D.MenubarFileMenu,{group:"1_new",command:{id:ZF,title:d(10299,null)},order:1});fe.appendMenuItem(D.MenubarFileMenu,{group:"4_save",command:{id:QMe,title:d(10301,null),precondition:x.or(fr,x.and($5,sV))},order:1});fe.appendMenuItem(D.MenubarFileMenu,{group:"4_save",command:{id:_et,title:d(10303,null),precondition:x.or(fr,x.and($5,sV))},order:2});fe.appendMenuItem(D.MenubarFileMenu,{group:"4_save",command:{id:YMe,title:d(10302,null),precondition:R8e},order:3});fe.appendMenuItem(D.MenubarFileMenu,{group:"5_autosave",command:{id:Pet.ID,title:d(10296,null),toggled:x.notEquals("config.files.autoSave","off")},order:1});fe.appendMenuItem(D.MenubarFileMenu,{group:"6_close",command:{id:jMe,title:d(10300,null),precondition:x.or(x.and(XEt),x.and(Fo.Scheme.notEqualsTo(Y.untitled),$5,sV))},order:1});fe.appendMenuItem(D.MenubarFileMenu,{group:"6_close",command:{id:OC,title:d(10297,null),precondition:x.or(fr,x.and($5,sV))},order:2});fe.appendMenuItem(D.MenubarGoMenu,{group:"3_global_nav",command:{id:"workbench.action.quickOpen",title:d(10298,null)},order:1});fe.appendMenuItem(D.ChatAttachmentsContext,{group:"navigation",order:10,command:lHt,when:x.and(Fo.IsFileSystemResource,lu.toNegated())});fe.appendMenuItem(D.ChatAttachmentsContext,{group:"navigation",order:20,command:oPe,when:Fo.IsFileSystemResource});fe.appendMenuItem(D.ChatAttachmentsContext,{group:"1_cutcopypaste",order:10,command:Vet,when:Fo.IsFileSystemResource});fe.appendMenuItem(D.ChatAttachmentsContext,{group:"1_cutcopypaste",order:20,command:Bet,when:Fo.IsFileSystemResource});for(let a of[D.ChatInlineResourceAnchorContext,D.ChatInputResourceAttachmentContext])fe.appendMenuItem(a,{group:"navigation",order:10,command:lHt,when:x.and(Fo.HasResource,lu.toNegated())}),fe.appendMenuItem(a,{group:"navigation",order:20,command:oPe,when:Fo.IsFileSystemResource}),fe.appendMenuItem(a,{group:"1_cutcopypaste",order:10,command:Vet,when:Fo.IsFileSystemResource}),fe.appendMenuItem(a,{group:"1_cutcopypaste",order:20,command:Bet,when:Fo.IsFileSystemResource});function zet(a){return Array.isArray(a.repositories)&&Array.isArray(a.visibleRepositories)}function fd(a){return!!a.provider&&!!a.input}function mA(a){return!!a.validateInput&&typeof a.value=="string"}function hA(a){return a.type==="actionButton"}function vy(a){return!!a.provider&&!!a.resources}function gA(a){return!!a.sourceUri&&vy(a.resourceGroup)}function m3(a){return Xp.isResourceNode(a)&&vy(a.context)}function fA(a){return a.type==="historyItemViewModel"}function nPe(a){return a.type==="historyItemLoadMore"}function h3(a){return a.type==="historyItemChangeViewModel"}function rPe(a){return Xp.isResourceNode(a)&&fA(a.context)}function _B(a){return a.type==="artifactGroup"}function g3(a){return Xp.isResourceNode(a)&&_B(a.context)}function UR(a){return a.type==="artifact"}var Luo=(a,i)=>a instanceof Eo&&i instanceof Eo?a.id===i.id&&a.enabled===i.enabled&&a.hideActions?.isHidden===i.hideActions?.isHidden:a.id===i.id&&a.enabled===i.enabled;function bee(a,i,e,t){let o=[],n=[],r=()=>{let{primary:s,secondary:l}=hl(a.getActions({arg:t,shouldForwardArgs:!0}),e);$i(o,s,Luo)&&$i(n,l,Luo)||(o=s,n=l,i(s,l))};return r(),a.onDidChange(r)}function f3(a,i){return Ef(a.getActions({arg:i,shouldForwardArgs:!0}),"inline").secondary}var Uet=class extends st{constructor(e,t){super(`statusbaraction{${e.id}}`,Sxi(e),"",!0);this.command=e;this.commandService=t;this.commandTitle=e.title,this.tooltip=e.tooltip||""}run(){return this.commandService.executeCommand(this.command.id,...this.command.arguments||[])}},bxi=class extends Lr{constructor(i,e){super(null,i,{...e,icon:!1,label:!0}),this._commandTitle=i.commandTitle}render(i){i.classList.add("scm-status-bar-action"),super.render(i)}updateLabel(){if(this.options.label&&this.label){let i=Bn(this._commandTitle??this.action.label).map(e=>{if(typeof e=="string"){let t=document.createElement("span");return t.textContent=e,t}return e});Fi(this.label,...i)}}};function See(a){return(i,e)=>i instanceof Uet?new bxi(i,e):Ca(a,i,e)}function v3(a){return`${a.providerId}:${a.label}${a.rootUri?`:${a.rootUri.toString()}`:""}`}function cHt(a){return a.groups.reduce((i,e)=>i+e.resources.length,0)}function dHt(a){return`${a.displayId??a.id} - ${a.subject}`}function uHt(a,i){return q.isThemeIcon(i.provider.iconPath)?a?.pinned===!0&&a?.repository.id===i.id&&i.provider.iconPath.id===M.repo.id?M.repoPinned:i.provider.iconPath:M.repo}function Sxi(a){let i;if(typeof a.arguments?.[0]=="string"){let e=a.arguments[0].lastIndexOf("/");if(i=e!==-1?a.arguments[0].substring(0,e):a.arguments[0],i=i.replace(/^(?:git\.|remoteHub\.)/,"").trim(),i.length===0)return;i=i[0].toLocaleUpperCase()+i.slice(1)}return i}var b3={style:1,position:{hoverPosition:2},trapFocus:!0},Pee={groupId:"chat-attachments"},Ruo=["display","position","margin","padding","font-size","font-family","color","background-color"],wk=class extends C{constructor(e,t,o,n,r,s,l,c,u){super();this.attachment=e;this.options=t;this.currentLanguageModel=r;this.commandService=s;this.openerService=l;this.configurationService=c;this.terminalService=u;this._onDidDelete=this._register(new E);this._onDidOpen=this._register(new E);this.element=R(o,_(".chat-attached-context-attachment.show-file-icons")),this.attachClearButton(),this.label=n.create(this.element,{supportIcons:!0,hoverTargetOverride:this.element}),this._register(this.label),this.element.tabIndex=0,this.element.role="button",this._register(j(this.element,re.AUXCLICK,p=>{p.button===1&&this.options.supportsDeletion&&!this.attachment.range&&(p.preventDefault(),p.stopPropagation(),this._onDidDelete.fire(p))}))}get onDidDelete(){return this._onDidDelete.event}get onDidOpen(){return this._onDidOpen.event}modelSupportsVision(){return Muo(this.currentLanguageModel)}attachClearButton(){if(this.attachment.range||!this.options.supportsDeletion)return;let e=new Mi(this.element,{supportIcons:!0,hoverDelegate:Gg(),title:d(5990,null)});e.element.tabIndex=-1,e.icon=M.close,this._register(e),this._register(H.once(e.onDidClick)(t=>{this._onDidDelete.fire(t)})),this._register(Vo(this.element,re.KEY_DOWN,t=>{(t.keyCode===1||t.keyCode===20)&&this._onDidDelete.fire(t.browserEvent)}))}addResourceOpenHandlers(e,t){this.element.style.cursor="pointer",this._register(qMe(this.element,async o=>{this.attachment.kind==="directory"?await this.openResource(e,o,!0):await this.openResource(e,o,!1,t)}))}async openResource(e,t,o,n){if(o){this.commandService.executeCommand(oPe.id,e);return}if(e.scheme===Y.vscodeTerminal){this.terminalService?.openResource(e);return}let r=n?{selection:n}:void 0,s={fromUserGesture:!0,openToSide:t.openToSide,editorOptions:{...r,...t.editorOptions}};await this.openerService.open(e,s),this._onDidOpen.fire(),this.element.focus()}};wk=I([m(5,ge),m(6,Qe),m(7,B),m(8,Yo)],wk);function Muo(a){return a?.metadata.capabilities?.vision??!1}var Iee=class extends wk{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super(o,s,l,c,r,u,p,h);this.themeService=g;this.hoverService=f;this.languageModelsService=v;this.instantiationService=b;let S=No(e.path),y=wc(e.path),w=`${S} ${y}`,k=t?d(6002,null,w,t.startLineNumber,t.endLineNumber):d(6000,null,w);if(o.omittedState===2)k=d(6009,null,o.name),this.renderOmittedWarning(w,k);else{let T={hidePath:!0,title:n?.options?.status?.description};this.label.setFile(e,o.kind==="file"?{...T,fileKind:0,range:t}:{...T,fileKind:1,icon:this.themeService.getFileIconTheme().hasFolderIcons?void 0:X$})}this.element.ariaLabel=k,this.instantiationService.invokeFunction(T=>{this._register(Ket(T,this.element,e))}),this.addResourceOpenHandlers(e,t)}renderOmittedWarning(e,t){let o=_("div.chat-attached-context-pill",{},_("span.codicon.codicon-warning")),n=_("span.chat-attached-context-custom-text",{},e);this.element.appendChild(o),this.element.appendChild(n);let r=_("div.chat-attached-context-hover");r.setAttribute("aria-label",t),this.element.classList.add("warning"),r.textContent=d(6001,null,this.currentLanguageModel?this.languageModelsService.lookupLanguageModel(this.currentLanguageModel.identifier)?.name:this.currentLanguageModel??"This model"),this._register(this.hoverService.setupDelayedHover(this.element,{...b3,content:r},Pee))}};Iee=I([m(8,ge),m(9,Qe),m(10,B),m(11,De),m(12,tt),m(13,Wr),m(14,F)],Iee);var yee=class extends wk{constructor(e,t,o,n,r,s,l,c,u,p){super(e,o,n,r,t,s,l,c,p);this.hoverService=u;this.terminalService=p;let h=d(6015,null,e.command),g=()=>this.openResource(e.resource,{editorOptions:{preserveFocus:!0}},!1,void 0);this._register(M6o(this.element,e,h,this.hoverService,g)),this._register(j(this.element,re.KEY_DOWN,async f=>{let v=new Ii(f);(v.equals(3)||v.equals(10))&&($t.stop(f,!0),await g())}))}};yee=I([m(5,ge),m(6,Qe),m(7,B),m(8,tt),m(9,Yo)],yee);function M6o(a,i,e,t,o){let n=new P;a.ariaLabel=e,a.style.cursor="pointer";let r=_("span");r.classList.add(...q.asClassNameArray(M.terminal));let s=_("div.chat-attached-context-pill",{},r),l=_("span.chat-attached-context-custom-text",{},i.command);return a.appendChild(s),a.appendChild(l),n.add(j(a,re.CLICK,c=>{c.preventDefault(),c.stopPropagation(),o()})),n.add(t.setupDelayedHover(a,()=>P6o(e,i),Pee)),n}function P6o(a,i){{let e=_("div.chat-attached-context-hover");e.setAttribute("aria-label",a);let t=_("div",{},typeof i.exitCode=="number"?d(6017,null,i.command,i.exitCode):d(6016,null));t.classList.add("attachment-additional-info");let o=_("pre.chat-terminal-command-block");if(e.append(t,o),i.output&&i.output.trim().length>0){let n=_("div",{},d(6018,null));n.classList.add("attachment-additional-info");let r=_("pre.chat-terminal-command-output"),s=i.output.split(`
`),l=[];for(let c of s){if(l.length>=5){l.push("...");break}let u=c.trim();u.length!==0&&(u.length>80?l.push(`${u.slice(0,80)}...`):l.push(u))}r.textContent=l.join(`
`),e.append(n,r)}return{...b3,content:e}}}var wee=class extends wk{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super(t,n,r,s,o,l,c,u);this.hoverService=p;this.languageModelsService=h;this.labelService=f;this.chatEntitlementService=v;let b;t.omittedState===2?b=d(6010,null,t.name):t.omittedState===1?b=d(6012,null,t.name):b=d(6003,null,t.name);let S=t.references?.[0]?.reference;e=S&&A.isUri(S)?S:void 0;let y=async()=>{e&&await this.openResource(e,{editorOptions:{preserveFocus:!0}},!1,void 0)},w=this.currentLanguageModel?this.languageModelsService.lookupLanguageModel(this.currentLanguageModel.identifier)?.name??this.currentLanguageModel.identifier:"Current model",k=e?this.labelService.getUriLabel(e):t.fullName||t.name;this._register(Puo(e,t.name,k,this.element,t.value,this.hoverService,b,w,y,this.currentLanguageModel,t.omittedState,this.chatEntitlementService.previewFeaturesDisabled)),e&&(this.addResourceOpenHandlers(e,void 0),g.invokeFunction(T=>{this._register(Ket(T,this.element,e))}))}};wee=I([m(6,ge),m(7,Qe),m(8,B),m(9,tt),m(10,Wr),m(11,F),m(12,ot),m(13,vr)],wee);function Puo(a,i,e,t,o,n,r,s,l,c,u,p){let h=new P;u===1&&t.classList.add("partial-warning"),t.ariaLabel=r,t.style.position="relative",a&&(t.style.cursor="pointer",h.add(j(t,"click",l)));let g=Muo(c),f=_("div.chat-attached-context-pill",{},_(g&&!p?"span.codicon.codicon-file-media":"span.codicon.codicon-warning")),v=_("span.chat-attached-context-custom-text",{},i);t.appendChild(f),t.appendChild(v);let b=_("div.chat-attached-context-hover");if(b.setAttribute("aria-label",r),p)t.classList.add("warning"),b.textContent=d(6005,null),h.add(n.setupDelayedHover(t,{content:b,style:1}));else if(!g&&c||u===2)t.classList.add("warning"),b.textContent=d(6004,null,s??"This model"),h.add(n.setupDelayedHover(t,{content:b,style:1}));else{h.add(n.setupDelayedHover(t,{content:b,style:1}));let S=new Blob([o],{type:"image/png"}),y=URL.createObjectURL(S),w=_("img.chat-attached-context-pill-image",{src:y,alt:""}),k=_("div.chat-attached-context-pill",{},w),T=t.querySelector(".chat-attached-context-pill");T&&T.replaceWith(k);let N=_("img.chat-attached-context-image",{src:y,alt:""}),O=_("div.chat-attached-context-image-container",{},N);if(b.appendChild(O),a){let V=_("a.chat-attached-context-url",{},u===1?d(6006,null):e),U=_("div.chat-attached-context-url-separator");h.add(j(V,"click",()=>l())),b.append(U,V)}N.onload=()=>{URL.revokeObjectURL(y)},N.onerror=()=>{let V=_("div.chat-attached-context-pill",{},_("span.codicon.codicon-file-media")),U=_("div.chat-attached-context-pill",{},V),G=t.querySelector(".chat-attached-context-pill");G&&G.replaceWith(U)}}return h}var Cee=class extends wk{constructor(e,t,o,n,r,s,l,c,u,p){super(e,o,n,r,t,s,l,c);this.hoverService=u;this.instantiationService=p;let h=d(5989,null,e.name);this.element.ariaLabel=h;let g=["file-icon",`${e.language}-lang-file-icon`],f,v;if(e.copiedFrom){f=e.copiedFrom.uri,v=e.copiedFrom.range;let w=No(f.path);this.label.setLabel(w,void 0,{extraClasses:g})}else this.label.setLabel(e.fileName,void 0,{extraClasses:g});this.element.appendChild(_("span.attachment-additional-info",{},`Pasted ${e.pastedLines}`)),this.element.style.position="relative";let b=e.copiedFrom?.uri,S=new xe(`${b?this.instantiationService.invokeFunction(w=>w.get(ot).getUriLabel(b,{relative:!0})):e.fileName}
---
\`\`\`${e.language}
${e.code}
\`\`\``);this._register(this.hoverService.setupDelayedHover(this.element,{...b3,content:S},Pee));let y=e.copiedFrom?.uri;y&&(this._register(this.instantiationService.invokeFunction(Ket,this.element,y)),this.addResourceOpenHandlers(y,v))}};Cee=I([m(5,ge),m(6,Qe),m(7,B),m(8,tt),m(9,F)],Cee);var xee=class extends wk{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super(o,s,l,c,r,u,p,h);this.contextKeyService=g;this.instantiationService=f;this.hoverService=v;this.modelService=b;this.languageService=S;this._tooltipHover=this._register(new me);let y=o.fullName??o.name;if(MY(o)&&o.icon&&(q.isFile(o.icon)||q.isFolder(o.icon))&&o.resourceUri){let w=q.isFolder(o.icon)?1:0,k=js(this.modelService,this.languageService,o.resourceUri,w);this.label.setLabel(y,n?.options?.status?.description,{extraClasses:k})}else{let w=o.icon?.id?`$(${o.icon.id})\xA0${y}`:y;this.label.setLabel(w,n?.options?.status?.description)}if(this.element.ariaLabel=d(5989,null,o.name),o.kind==="diagnostic"&&(o.filterUri?(e=o.filterUri?A.revive(o.filterUri):void 0,t=o.filterRange):(this.element.style.cursor="pointer",this._register(j(this.element,re.CLICK,()=>{this.commandService.executeCommand("workbench.panel.markers.view.focus")})))),o.kind==="symbol"&&this._register(this.instantiationService.invokeFunction(Ixi,this.element,this.contextKeyService,{...o,kind:o.symbolKind},D.ChatInputSymbolAttachmentContext)),MY(o)&&o.commandId){this.element.style.cursor="pointer";let w=o.handle;this._register(j(this.element,re.CLICK,async()=>{await this.instantiationService.invokeFunction(T=>T.get(Q_)).executeChatContextItemCommand(w)}))}o.kind==="debugEvents"&&(this.element.style.cursor="pointer",this._register(j(this.element,re.CLICK,()=>{let w=new Date(o.snapshotTime),k=`before:${w.getFullYear()}-${String(w.getMonth()+1).padStart(2,"0")}-${String(w.getDate()).padStart(2,"0")}T${String(w.getHours()).padStart(2,"0")}:${String(w.getMinutes()).padStart(2,"0")}:${String(w.getSeconds()).padStart(2,"0")}`;this.commandService.executeCommand("workbench.action.chat.openAgentDebugPanelForSession",o.sessionResource,k)}))),(MY(o)||o.kind==="generic")&&o.tooltip&&this._setupTooltipHover(o.tooltip),e&&this.addResourceOpenHandlers(e,t)}_setupTooltipHover(e){this._tooltipHover.value=this.hoverService.setupDelayedHover(this.element,{content:e,appearance:{showPointer:!0}})}};xee=I([m(8,ge),m(9,Qe),m(10,B),m(11,X),m(12,F),m(13,tt),m(14,Ct),m(15,kt)],xee);var kee=class extends wk{constructor(e,t,o,n,r,s,l,c,u,p){super(e,o,n,r,t,s,l,c);this.labelService=u;this.instantiationService=p;this.hintElement=R(this.element,_("span.prompt-type")),this.updateLabel(e),this.instantiationService.invokeFunction(h=>{this._register(Ket(h,this.element,e.value))}),this.addResourceOpenHandlers(e.value,void 0)}updateLabel(e){let t=e.value,o=No(t.path),n=wc(t.path),r=`${o} ${n}`,s=e.id.startsWith("vscode.prompt.file"),l=s?d(6014,null,r):d(6007,null,r),c=s?d(6021,null):d(6019,null),u=this.labelService.getUriLabel(t)+(e.originLabel?`
${e.originLabel}`:"");this.element.classList.remove("warning","error");let p=Tb(t);this.label.setFile(A.file(p),{fileKind:0,hidePath:!0,range:void 0,title:u,icon:q.fromId(M.bookmark.id),extraClasses:[]}),this.hintElement.innerText=c,this.element.ariaLabel=l}};kee=I([m(5,ge),m(6,Qe),m(7,B),m(8,ot),m(9,F)],kee);var Eee=class extends wk{constructor(i,e,t,o,n,r,s,l,c,u){if(super(i,t,o,n,e,r,s,l),i.settingId){let p=()=>c.openSettings({jsonEditor:!1,query:`@id:${i.settingId}`});this.element.style.cursor="pointer",this._register(j(this.element,re.CLICK,async h=>{$t.stop(h,!0),p()})),this._register(j(this.element,re.KEY_DOWN,async h=>{let g=new Ii(h);(g.equals(3)||g.equals(10))&&($t.stop(h,!0),p())}))}this.label.setLabel(d(6020,null),void 0,void 0),this._register(u.setupDelayedHover(this.element,{...b3,content:i.value},Pee))}};Eee=I([m(5,ge),m(6,Qe),m(7,B),m(8,Po),m(9,tt)],Eee);var Tee=class extends wk{constructor(i,e,t,o,n,r,s,l,c,u){super(i,t,o,n,e,s,l,c);let p=ht.find(r.getTools(e?.metadata),v=>v.id===i.id)??ht.find(r.getToolSetsForModel(e?.metadata),v=>v.id===i.id),h=i.name,g=i.icon??M.tools;Km(p)?h=p.referenceName:p&&(h=p.toolReferenceName??h),this.label.setLabel(`$(${g.id})\xA0${h}`,void 0),this.element.style.cursor="pointer",this.element.ariaLabel=d(5989,null,h);let f;Km(p)?f=d(6024,null,p.description??p.referenceName,p.source.label):p&&(f=d(6023,null,p.userDescription??p.modelDescription,p.source.label)),f&&this._register(u.setupDelayedHover(this.element,{...b3,content:f},Pee))}};Tee=I([m(5,jn),m(6,ge),m(7,Qe),m(8,B),m(9,tt)],Tee);var _ee=class extends wk{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super(t,n,r,s,o,l,c,u);this.hoverService=p;this.languageModelsService=h;this.notebookService=g;this.instantiationService=f;this.chatEntitlementService=v;switch(t.mimeType){case"application/vnd.code.notebook.error":{this.renderErrorOutput(e,t);break}case"image/png":case"image/jpeg":case"image/svg":{this.renderImageOutput(e,t);break}default:this.renderGenericOutput(e,t)}this.instantiationService.invokeFunction(b=>{this._register(Ket(b,this.element,e))}),this.addResourceOpenHandlers(e,void 0)}getAriaLabel(e){return d(6008,null,e.name)}renderErrorOutput(e,t){let o=t.name,n=t.icon?.id?`$(${t.icon.id})\xA0${o}`:o,r=this.getOutputItem(e,t)?.data.buffer??new Uint8Array,s;try{let l=JSON.parse(new TextDecoder().decode(r));l.name&&l.message&&(s=`${l.name}: ${l.message}`)}catch{}this.label.setLabel(n,void 0,{title:s}),this.element.ariaLabel=this.getAriaLabel(t)}renderGenericOutput(e,t){this.element.ariaLabel=this.getAriaLabel(t),this.label.setFile(e,{hidePath:!0,icon:q.fromId("output")})}renderImageOutput(e,t){let o;t.omittedState===2?o=d(6011,null,t.name):t.omittedState===1?o=d(6013,null,t.name):o=this.getAriaLabel(t);let n=async()=>await this.openResource(e,{editorOptions:{preserveFocus:!0}},!1,void 0),r=this.currentLanguageModel?this.languageModelsService.lookupLanguageModel(this.currentLanguageModel.identifier)?.name??this.currentLanguageModel.identifier:void 0,s=this.getOutputItem(e,t)?.data.buffer??new Uint8Array;this._register(Puo(e,t.name,t.name,this.element,s,this.hoverService,o,r,n,this.currentLanguageModel,t.omittedState,this.chatEntitlementService.previewFeaturesDisabled))}getOutputItem(e,t){let o=Zo.parseCellOutputUri(e);if(!o||typeof o.cellHandle!="number"||typeof o.outputIndex!="number")return;let n=this.notebookService.getNotebookTextModel(o.notebook);if(!n)return;let r=n.cells.find(l=>l.handle===o.cellHandle);return r?(r.outputs.length>o.outputIndex?r.outputs[o.outputIndex]:void 0)?.outputs.find(l=>l.mime===t.mimeType):void 0}};_ee=I([m(6,ge),m(7,Qe),m(8,B),m(9,tt),m(10,Wr),m(11,un),m(12,F),m(13,vr)],_ee);var Dee=class extends wk{constructor(e,t,o,n,r,s,l,c,u,p){super(e,o,n,r,t,s,l,c);this.editorService=u;this.hoverService=p;let h=d(5992,null,e.name);this.element.ariaLabel=h,this.element.style.position="relative",this.element.style.cursor="pointer";let g=e.name,f=e.icon?.id?`$(${e.icon.id})\xA0${g}`:g;this.label.setLabel(f,void 0,{title:d(5991,null,g)}),this._register(this.hoverService.setupDelayedHover(this.element,this.getHoverContent(e),Pee)),this._register(j(this.element,re.CLICK,async()=>{await this.openElementAttachment(e)}))}getHoverContent(e){if(!this.shouldRenderRichElementHover(e))return this.getSimpleHoverContent(e);let t=_("div.chat-attached-context-hover.chat-element-hover"),o=_("div.chat-element-hover-content"),n=[];{let c=_("div.chat-element-hover-section"),u=_("div.chat-element-hover-header",{},d(5995,null));c.appendChild(u);let p=_("pre.chat-element-hover-code"),h=_("code"),g=this.formatElementTag(e);h.textContent=g,p.appendChild(h);let f=this._register(new Pa(p,{horizontal:1,vertical:2}));n.push(f),c.appendChild(f.getDomNode()),o.appendChild(c)}let r=this.getComputedStyleEntriesForHover(e.computedStyles);if(r.length>0){let c=_("div.chat-element-hover-section"),u=_("div.chat-element-hover-header",{},d(5994,null));c.appendChild(u);let p=_("div.chat-element-hover-table");for(let[g,f]of r){let v=_("div.chat-element-hover-row");v.appendChild(_("span.chat-element-hover-label",{},`${g}:`));let b=_("span.chat-element-hover-value");if((g==="color"||g==="background-color")&&f){let S=_("span.chat-element-hover-color-swatch");S.style.backgroundColor=f,b.appendChild(S)}b.appendChild(document.createTextNode(f)),v.appendChild(b),p.appendChild(v)}c.appendChild(p);let h=_("button.chat-element-hover-show-more",{type:"button"},d(5999,null));this._register(j(h,re.CLICK,async g=>{$t.stop(g,!0),await this.openElementAttachment(e)})),c.appendChild(h),o.appendChild(c)}if(e.ancestors&&e.ancestors.length>1){let c=_("div.chat-element-hover-section"),u=_("div.chat-element-hover-header",{},d(5996,null));c.appendChild(u);let p=[];for(let v=0;v<e.ancestors.length;v++){let b=e.ancestors[v],S=" ".repeat(v),y=this.formatAncestorTag(b);p.push(`${S}${y}`)}let h=_("pre.chat-element-hover-code"),g=_("code");g.textContent=p.join(`
`),h.appendChild(g);let f=this._register(new Pa(h,{horizontal:1,vertical:2}));n.push(f),c.appendChild(f.getDomNode()),o.appendChild(c)}if(e.attributes&&Object.keys(e.attributes).length>0){let c=_("div.chat-element-hover-section"),u=_("div.chat-element-hover-header",{},d(5993,null));c.appendChild(u);let p=_("div.chat-element-hover-table");for(let[h,g]of Object.entries(e.attributes)){let f=_("div.chat-element-hover-row");f.appendChild(_("span.chat-element-hover-label",{},`${h}:`)),f.appendChild(_("span.chat-element-hover-value",{},g)),p.appendChild(f)}c.appendChild(p),o.appendChild(c)}if(e.dimensions){let c=_("div.chat-element-hover-section"),u=_("div.chat-element-hover-header",{},d(5998,null));c.appendChild(u);let p=_("div.chat-element-hover-table"),h=[["top:",e.dimensions.top],["left:",e.dimensions.left],["width:",e.dimensions.width],["height:",e.dimensions.height]];for(let[g,f]of h){let v=_("div.chat-element-hover-row");v.appendChild(_("span.chat-element-hover-label",{},g)),v.appendChild(_("span.chat-element-hover-value",{},`${Math.round(f)}px`)),p.appendChild(v)}c.appendChild(p),o.appendChild(c)}if(e.innerText){let c=_("div.chat-element-hover-section"),u=_("div.chat-element-hover-header",{},d(5997,null));c.appendChild(u),c.appendChild(_("div.chat-element-hover-text",{},e.innerText)),o.appendChild(c)}let s=this._register(new Pa(o,{vertical:1,horizontal:2,consumeMouseWheelIfScrollbarIsNeeded:!0})),l=s.getDomNode();return l.classList.add("chat-element-hover-scrollable"),t.appendChild(l),{...b3,content:t,additionalClasses:["chat-element-data-hover"],onDidShow:()=>{for(let c of n)c.scanDomNode();s.scanDomNode()}}}shouldRenderRichElementHover(e){return!!(e.dimensions||e.innerText||e.ancestors&&e.ancestors.length>0||e.attributes&&Object.keys(e.attributes).length>0||e.computedStyles&&Object.keys(e.computedStyles).length>0)}getSimpleHoverContent(e){let t=e.value?.toString()??"",o=new xe;return o.appendText(e.fullName??e.name),t.trim().length>0&&(o.appendMarkdown(`
`),o.appendCodeblock("text",t)),{...b3,content:o}}getComputedStyleEntriesForHover(e){if(!e)return[];let t=[];for(let o of Ruo){if(o==="margin"||o==="padding"){let r=this.getBoxShorthandValue(e,o);if(typeof r=="string"){t.push([o,r]);continue}}let n=e[o];typeof n=="string"&&t.push([o,n])}return t.length>0?t:Object.entries(e).slice(0,Ruo.length)}getBoxShorthandValue(e,t){let o=e[`${t}-top`],n=e[`${t}-right`],r=e[`${t}-bottom`],s=e[`${t}-left`];return typeof o=="string"&&typeof n=="string"&&typeof r=="string"&&typeof s=="string"?`${o} ${n} ${r} ${s}`:e[t]}async openElementAttachment(e){let t=e.value?.toString()||"";await this.editorService.openEditor({resource:void 0,contents:t,options:{pinned:!0}})}formatElementTag(e){let t=e.value?.toString()??"",o=t.match(/\n\n(<[^>]+>)/);if(o)return o[1];let n=t.match(/<([^>]+)>/);return n?`<${n[1]}>`:`<${e.name}>`}formatAncestorTag(e){let t=[`<${e.tagName}`];return e.classNames?.length&&t.push(` class="${e.classNames.join(" ")}"`),e.id&&t.push(` id="${e.id}"`),t.join("")+">"}};Dee=I([m(5,ge),m(6,Qe),m(7,B),m(8,ee),m(9,tt)],Dee);var Lee=class extends wk{constructor(i,e,t,o,n,r,s,l,c,u,p){super(i,t,o,n,e,r,c,u),this.label.setLabel(i.name,void 0),this.element.style.cursor="pointer",this.element.ariaLabel=d(5989,null,i.name);let{content:h,disposables:g}=B6e(s,i.historyItem,!1);this._store.add(l.setupDelayedHover(this.element,{...b3,content:h},Pee)),this._store.add(g),this._store.add(j(this.element,re.CLICK,f=>{$t.stop(f,!0),this._openAttachment(i)})),this._store.add(j(this.element,re.KEY_DOWN,f=>{let v=new Ii(f);(v.equals(3)||v.equals(10))&&($t.stop(f,!0),this._openAttachment(i))}))}async _openAttachment(i){await this.commandService.executeCommand("_workbench.openMultiDiffEditor",{title:dHt(i.historyItem),multiDiffSourceUri:i.value})}};Lee=I([m(5,ge),m(6,Qn),m(7,tt),m(8,Qe),m(9,B),m(10,De)],Lee);var Ree=class extends wk{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super(e,o,n,r,t,s,u,p);this.editorService=g;let f=`\xA0$(${M.gitCommit.id})${e.historyItem.displayId??e.historyItem.id}`;this.label.setFile(e.value,{fileKind:0,hidePath:!0,nameSuffix:f}),this.element.ariaLabel=d(5989,null,e.name);let{content:v,disposables:b}=B6e(c,e.historyItem,!1);this._store.add(l.setupDelayedHover(this.element,{...b3,content:v},Pee)),this._store.add(b),this.addResourceOpenHandlers(e.value,void 0)}async openResource(e,t,o,n){let s=this.attachment.historyItem;await this.editorService.openEditor({resource:e,label:`${No(e.path)} (${s.displayId??s.id})`,options:{...t.editorOptions}},t.openToSide?vn:void 0)}};Ree=I([m(5,ge),m(6,tt),m(7,Qn),m(8,Qe),m(9,B),m(10,De),m(11,ee)],Ree);var Mee=class extends wk{constructor(e,t,o,n,r,s,l,c,u){super(e,o,n,r,t,s,l,c);this.editorService=u;let p=e.historyItemChangeStart.historyItem.displayId??e.historyItemChangeStart.historyItem.id,h=e.historyItemChangeEnd.historyItem.displayId??e.historyItemChangeEnd.historyItem.id,g=`\xA0$(${M.gitCommit.id})${p}..${h}`;this.label.setFile(e.value,{fileKind:0,hidePath:!0,nameSuffix:g}),this.element.ariaLabel=d(5989,null,e.name),this.addResourceOpenHandlers(e.value,void 0)}async openResource(e,t,o,n){let r=this.attachment,s=r.historyItemChangeStart,l=r.historyItemChangeEnd,c=`${No(s.uri.fsPath)} (${s.historyItem.displayId??s.historyItem.id})`,u=`${No(l.uri.fsPath)} (${l.historyItem.displayId??l.historyItem.id})`;await this.editorService.openEditor({original:{resource:s.uri},modified:{resource:l.uri},label:`${c} \u2194 ${u}`,options:{...t.editorOptions}},t.openToSide?vn:void 0)}};Mee=I([m(5,ge),m(6,Qe),m(7,B),m(8,ee)],Mee);function Ket(a,i,e){let t=a.get(X),o=a.get(F),n=new P,r=n.add(t.createScoped(i));return Auo(a,r,e),i.draggable=!0,n.add(j(i,"dragstart",s=>{o.invokeFunction(l=>Ig(l,[e],s)),s.dataTransfer?.setDragImage(i,0,0)})),n.add(A6o(a,i,r,D.ChatInputResourceAttachmentContext,e)),n}function Ixi(a,i,e,t,o){let n=a.get(F),r=a.get(zt),s=a.get(Nt),l=a.get(ze),c=a.get(qt),u=new P;i.draggable=!0,u.add(j(i,"dragstart",v=>{n.invokeFunction(b=>Ig(b,[{resource:t.value.uri,selection:t.value.range}],v)),_Ie([{fsPath:t.value.uri.fsPath,range:t.value.range,name:t.name,kind:t.kind}],v),v.dataTransfer?.setDragImage(i,0,0)}));let p=u.add(e.createScoped(i));Get.bindTo(p).set(t.value.uri.toString()),Auo(a,p,t.value.uri);let h,g=()=>{h||(h=[[ue.hasDefinitionProvider.bindTo(p),r.definitionProvider],[ue.hasReferenceProvider.bindTo(p),r.referenceProvider],[ue.hasImplementationProvider.bindTo(p),r.implementationProvider],[ue.hasTypeDefinitionProvider.bindTo(p),r.typeDefinitionProvider]])},f=async()=>{g();let v=await s.createModelReference(t.value.uri);try{let b=v.object.textEditorModel;for(let[S,y]of h)S.set(y.has(b))}finally{v.dispose()}};return u.add(j(i,re.CONTEXT_MENU,async v=>{let b=new yn(Me(v),v);$t.stop(v,!0);try{await f()}catch(S){console.error(S)}l.showContextMenu({contextKeyService:p,getAnchor:()=>b,getActions:()=>{let S=c.getMenuActions(o,p,{arg:t.value});return Uc(S)}})})),u}function Auo(a,i,e){let t=a.get(be),o=a.get(kt),n=a.get(Ct);new CY(i,t,o,n).set(e)}function A6o(a,i,e,t,o,n){let r=a.get(ze),s=a.get(qt);return j(i,re.CONTEXT_MENU,async l=>{let c=new yn(Me(l),l);$t.stop(l,!0);try{await n?.()}catch(u){console.error(u)}r.showContextMenu({contextKeyService:e,getAnchor:()=>c,getActions:()=>{let u=s.getMenuActions(t,e,{arg:o});return Uc(u)}})})}var Get=new Q("chatAttachmentResource",void 0,{type:"URI",description:d(6022,null)});var Aee=ae("chatAttachmentWidgetRegistry"),pHt=class{constructor(){this._factories=new Map}registerFactory(i,e){return this._factories.set(i,e),{dispose:()=>{this._factories.get(i)===e&&this._factories.delete(i)}}}createWidget(i,e,t){let o=this._factories.get(i.kind);if(o)return o(i,e,t)}};var Nee=class extends C{constructor(e,t,o){super();this.instantiationService=t;this.chatAttachmentWidgetRegistry=o;this.attachedContextDisposables=this._register(new P);this._onDidChangeVisibility=this._register(new E);this._showingAll=!1;this._variables=e.variables,this.contentReferences=e.contentReferences??[],this.limit=e.limit,this.domNode=e.domNode??_(".chat-attached-context"),this._contextResourceLabels=this._register(this.instantiationService.createInstance(Za,{onDidChangeVisibility:this._onDidChangeVisibility.event})),this.initAttachedContext(this.domNode),this.domNode.childElementCount||(this.domNode=void 0)}updateVariables(e){this._variables=e,this.domNode&&this.initAttachedContext(this.domNode)}initAttachedContext(e){Rt(e),this.attachedContextDisposables.clear();let t=this.getVisibleAttachments(),o=this.limit&&this._variables.length>this.limit&&!this._showingAll;for(let n of t)this.renderAttachment(n,e);o&&this.renderShowMoreButton(e)}getVisibleAttachments(){return!this.limit||this._showingAll?this._variables:this._variables.slice(0,this.limit)}renderShowMoreButton(e){let t=this._variables.length-(this.limit??0),o=_("div.chat-attached-context-attachment.chat-attachments-show-more-button");o.setAttribute("role","button"),o.setAttribute("tabindex","0"),o.style.cursor="pointer";let n=_("div.chat-attached-context-pill",{},_("span.codicon.codicon-ellipsis")),r=_("span.chat-attached-context-custom-text");r.textContent=`${t} more`,o.appendChild(n),o.appendChild(r);let s=()=>{this._showingAll=!0,this.initAttachedContext(e)};this.attachedContextDisposables.add(j(o,"click",s)),this.attachedContextDisposables.add(j(o,"keydown",l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),s())})),e.appendChild(o),this.attachedContextDisposables.add({dispose:()=>o.remove()})}renderAttachment(e,t){let o=A.isUri(e.value)?e.value:e.value&&typeof e.value=="object"&&"uri"in e.value&&A.isUri(e.value.uri)?e.value.uri:void 0,n=e.value&&typeof e.value=="object"&&"range"in e.value&&z.isIRange(e.value.range)?e.value.range:void 0,r=this.contentReferences.find(h=>typeof h.reference=="object"&&"variableName"in h.reference&&h.reference.variableName===e.name||A.isUri(h.reference)&&No(h.reference.path)===e.name),l=r?.options?.status?.kind===3||r?.options?.status?.kind===2,c;if(e.kind==="tool"||e.kind==="toolset")c=this.instantiationService.createInstance(Tee,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else if(STt(e))c=this.instantiationService.createInstance(Dee,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else if(pV(e))e.omittedState=l?2:e.omittedState,c=this.instantiationService.createInstance(wee,o,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else if(pP(e)){if(e.automaticallyAdded)return;c=this.instantiationService.createInstance(kee,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels)}else if(PY(e)){if(e.automaticallyAdded)return;c=this.instantiationService.createInstance(Eee,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels)}else if(o&&(e.kind==="file"||e.kind==="directory"))c=this.instantiationService.createInstance(Iee,o,n,e,r,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else if(xYi(e))c=this.instantiationService.createInstance(yee,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else if(fTt(e))c=this.instantiationService.createInstance(Cee,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else if(o&&bTt(e))c=this.instantiationService.createInstance(_ee,o,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else if(ITt(e))c=this.instantiationService.createInstance(Lee,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else if(yTt(e))c=this.instantiationService.createInstance(Ree,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else if(wTt(e))c=this.instantiationService.createInstance(Mee,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else{if(vTt(e))return;c=this.chatAttachmentWidgetRegistry.createWidget(e,{shouldFocusClearButton:!1,supportsDeletion:!1},t)??this.instantiationService.createInstance(xee,o,n,e,r,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels)}let u=null;l&&c.element.classList.add("warning");let p=r?.options?.status?.description;if(l){u=`${u}${p?` ${p}`:""}`;for(let h of[".monaco-icon-suffix-container",".monaco-icon-name-container"]){let g=c.label?.element.querySelector(h);g&&g.classList.add("warning")}}if(this._register(j(c.element,"contextmenu",h=>this.contextMenuHandler?.(e,h))),this.attachedContextDisposables.isDisposed){c.dispose();return}u&&(c.element.ariaLabel=u),this.attachedContextDisposables.add(c)}};Nee=I([m(1,F),m(2,Aee)],Nee);var mHt=class{constructor(i,e,t,o=!1){this.location=e;this.parent=t;this.ignoreCase=o;if(e[e.length-1]==="\\")throw Error("Unexpected path format, do not use trailing backslashes");e[e.length-1]!=="/"&&(e+="/"),this.isPathIgnored=this.parseIgnoreFile(i,this.location,this.parent)}updateContents(i){this.isPathIgnored=this.parseIgnoreFile(i,this.location,this.parent)}isPathIncludedInTraversal(i,e){if(i[0]!=="/"||i[i.length-1]==="/")throw Error("Unexpected path format, expected to begin with slash and end without. got:"+i);return!this.isPathIgnored(i,e)}isArbitraryPathIgnored(i,e){if(i[0]!=="/"||i[i.length-1]==="/")throw Error("Unexpected path format, expected to begin with slash and end without. got:"+i);let t=i.split("/").filter(r=>r),o=!1,n="";for(let r=0;r<t.length;r++){let s=r===t.length-1,l=t[r];if(n=n+"/"+l,!this.isPathIncludedInTraversal(n,s?e:!0)){o=!0;break}}return o}gitignoreLinesToExpression(i,e,t){let o=i.map(r=>this.gitignoreLineToGlob(r,e)),n=Object.create(null);for(let r of o)n[r]=!0;return zm(n,{trimForExclusions:t,ignoreCase:this.ignoreCase})}parseIgnoreFile(i,e,t){let o=i.split(`
`).map(v=>v.trim()).filter(v=>v&&v[0]!=="#"),n=o.filter(v=>!v.endsWith("/")),r=n.filter(v=>!v.includes("!")),s=this.gitignoreLinesToExpression(r,e,!0),l=n.filter(v=>v.includes("!")).map(v=>v.replace(/!/g,"")),c=this.gitignoreLinesToExpression(l,e,!1),u=o.filter(v=>!v.includes("!")),p=this.gitignoreLinesToExpression(u,e,!0),h=o.filter(v=>v.includes("!")).map(v=>v.replace(/!/g,"")),g=this.gitignoreLinesToExpression(h,e,!1);return(v,b)=>(this.ignoreCase?Uk(v,e):v.startsWith(e))?b&&p(v)&&!g(v)||s(v)&&!c(v)?!0:t?t.isPathIgnored(v,b):!1:!1}gitignoreLineToGlob(i,e){let t=i.indexOf("/");return t===-1||t===i.length-1?i="**/"+i:(t===0?e.slice(-1)==="/"&&(i=i.slice(1)):e.slice(-1)!=="/"&&(i="/"+i),i=e+i),i}};var yxi=class extends C{constructor(){super(...arguments);this._onDidRegisterDescriptor=this._register(new E);this.onDidRegisterDescriptor=this._onDidRegisterDescriptor.event;this.descriptors=[]}register(e){this.descriptors.push(e),this._onDidRegisterDescriptor.fire(e)}create(e,t,o){return this.descriptors.map(n=>{let r=n.create(e,t);return o.add(r),r})}},hHt=new yxi;oe.add("workbench.registry.explorer.fileContributions",hHt);var $et=class a{static{this.ITEM_HEIGHT=22}getHeight(i){return a.ITEM_HEIGHT}getTemplateId(i){return S3.ID}},gHt=new E,sPe=class{constructor(i,e,t,o,n,r,s,l,c,u){this.fileFilter=i;this.findProvider=e;this.progressService=t;this.configService=o;this.notificationService=n;this.layoutService=r;this.fileService=s;this.explorerService=l;this.contextService=c;this.filesConfigService=u}getParent(i){if(i.parent)return i.parent;throw new Error("getParent only supported for cached parents")}hasChildren(i){return Array.isArray(i)||i.hasChildren(e=>this.fileFilter.filter(e,1))}getChildren(i){if(Array.isArray(i))return i;if(this.findProvider.isShowingFilterResults())return Array.from(i.children.values());let e=i.error,t=this.explorerService.sortOrderConfiguration.sortOrder,o=i.fetchChildren(t);if(Array.isArray(o))return o;let n=o.then(r=>(i instanceof Tg&&i.isRoot&&!i.error&&e&&this.contextService.getWorkbenchState()!==2&&gHt.fire(i.resource),r),r=>{if(i instanceof Tg&&i.isRoot)if(this.contextService.getWorkbenchState()===2){let s=new Tg(i.resource,this.fileService,this.configService,this.filesConfigService,void 0,void 0,!1);return s.error=r,[s]}else gHt.fire(i.resource);else this.notificationService.error(r);return[]});return this.progressService.withProgress({location:1,delay:this.layoutService.isRestored()?800:1500},r=>n),n}};sPe=I([m(2,Bo),m(3,B),m(4,Ne),m(5,fi),m(6,be),m(7,za),m(8,Pe),m(9,lr)],sPe);var fHt=class extends Tg{},wxi=class{constructor(){this._tree=new Map;this._highlightedItems=new Map}get highlightedItems(){return Array.from(this._highlightedItems.values())}get(i){let e=this.find(i);if(e===void 0)return 0;let{treeLayer:t,relPath:o}=e;return this._highlightedItems.set(o,i),t.childMatches}find(i){let e=this._tree.get(i.root.name);if(e===void 0)return;let t=Fc(i.root.resource,i.resource);if(t===void 0||t.startsWith(".."))throw new Error("Resource is not a child of the root");if(t==="")return{treeLayer:e,relPath:t};let o=e;for(let n of t.split("/")){if(!o.stats[n])return;o=o.stats[n]}return{treeLayer:o,relPath:t}}add(i,e){let t=Fc(e.resource,i);if(t===void 0||t.startsWith(".."))throw new Error("Resource is not a child of the root");let o=this._tree.get(e.name);o||(o={childMatches:0,stats:{},isMatch:!1},this._tree.set(e.name,o)),o.childMatches++;let n=o;for(let r of t.split("/"))n.stats[r]||(n.stats[r]={childMatches:0,stats:{},isMatch:!1}),n=n.stats[r],n.childMatches++;n.childMatches--,n.isMatch=!0}isMatch(i){let e=this.find(i);if(e===void 0)return!1;let{treeLayer:t}=e;return t.isMatch}clear(){this._tree.clear()}},aPe=class{constructor(i,e,t,o,n,r,s,l,c){this.filesFilter=i;this.treeProvider=e;this.searchService=t;this.fileService=o;this.configurationService=n;this.filesConfigService=r;this.progressService=s;this.explorerService=l;this.sessionId=0;this.phantomParents=new Set;this.findHighlightTree=new wxi;this.explorerFindActiveContextKey=HPt.bindTo(c)}get highlightTree(){return this.findHighlightTree}isShowingFilterResults(){return!!this.filterSessionStartState}isVisible(i){return!this.filterSessionStartState||this.explorerService.isEditable(i)?!0:this.filterSessionStartState.rootsWithProviders.has(i.root)?i.isMarkedAsFiltered():!0}startSession(){this.sessionId++}async endSession(){this.filterSessionStartState&&await this.endFilterSession(),this.highlightSessionStartState&&this.endHighlightSession()}async find(i,e,t){let o=this.doFind(i,e,t);return await this.progressService.withProgress({location:1,delay:750},n=>o)}async doFind(i,e,t){return e.findMode===0?(this.filterSessionStartState&&await this.endFilterSession(),this.highlightSessionStartState||this.startHighlightSession(),await this.doHighlightFind(i,e.matchType,t)):(this.highlightSessionStartState&&this.endHighlightSession(),this.filterSessionStartState||this.startFilterSession(),await this.doFilterFind(i,e.matchType,t))}startFilterSession(){let i=this.treeProvider(),e=i.getInput();if(!e)return;let t=this.explorerService.roots.filter(o=>this.searchSupportsScheme(o.resource.scheme));this.filterSessionStartState={viewState:i.getViewState(),input:e,rootsWithProviders:new Set(t)},this.explorerFindActiveContextKey.set(!0)}async doFilterFind(i,e,t){if(!this.filterSessionStartState)throw new Error("ExplorerFindProvider: no session state");let o=Array.from(this.filterSessionStartState.rootsWithProviders),n=await this.getSearchResults(i,o,e,t);if(t.isCancellationRequested)return;this.clearPhantomElements();for(let{explorerRoot:l,files:c,directories:u}of n)this.addWorkspaceFilterResults(l,c,u);await this.treeProvider().setInput(this.filterSessionStartState.input);let s=n.some(({hitMaxResults:l})=>l);return{isMatch:l=>l.isMarkedAsFiltered(),matchCount:n.reduce((l,{files:c,directories:u})=>l+c.length+u.length,0),warningMessage:s?d(10497,null):void 0}}addWorkspaceFilterResults(i,e,t){let o=[...e.map(n=>({resource:n,isDirectory:!1})),...t.map(n=>({resource:n,isDirectory:!0}))];for(let{resource:n,isDirectory:r}of o){let s=i.find(n);if(s&&s.root===i){s.markItemAndParentsAsFiltered();continue}let l=this.createPhantomItems(n,i,r);if(l.length===0)throw new Error("Phantom item was not created even though it is not in the model");let c=l[0].parent;c instanceof fHt||this.phantomParents.add(c),l[l.length-1].markItemAndParentsAsFiltered()}}createPhantomItems(i,e,t){let o=Fc(e.resource,i);if(!o)throw new Error("Resource is not a child of the root");let n=[],r=e,s=e.resource,l=o.split("/");for(let c of l){s=s.with({path:`${s.path}/${c}`});let u=r.getChild(c);if(!u){let p=l[l.length-1]===c?t:!0;u=new fHt(s,this.fileService,this.configurationService,this.filesConfigService,r,p),r.addChild(u),n.push(u)}r=u}return n}async endFilterSession(){if(this.clearPhantomElements(),this.explorerFindActiveContextKey.set(!1),!this.filterSessionStartState)throw new Error("ExplorerFindProvider: no session state to restore");await this.treeProvider().setInput(this.filterSessionStartState.input,this.filterSessionStartState.viewState),this.filterSessionStartState=void 0,this.explorerService.refresh()}clearPhantomElements(){for(let i of this.phantomParents)i.forgetChildren();this.phantomParents.clear(),this.explorerService.roots.forEach(i=>i.unmarkItemAndChildren())}startHighlightSession(){let i=this.explorerService.roots.filter(e=>this.searchSupportsScheme(e.resource.scheme));this.highlightSessionStartState={rootsWithProviders:new Set(i)}}async doHighlightFind(i,e,t){if(!this.highlightSessionStartState)throw new Error("ExplorerFindProvider: no highlight session state");let o=Array.from(this.highlightSessionStartState.rootsWithProviders),n=await this.getSearchResults(i,o,e,t);if(t.isCancellationRequested)return;this.clearHighlights();for(let{explorerRoot:s,files:l,directories:c}of n)this.addWorkspaceHighlightResults(s,l.concat(c));let r=n.some(({hitMaxResults:s})=>s);return{isMatch:s=>this.findHighlightTree.isMatch(s)||this.findHighlightTree.get(s)>0&&this.treeProvider().isCollapsed(s),matchCount:n.reduce((s,{files:l,directories:c})=>s+l.length+c.length,0),warningMessage:r?d(10497,null):void 0}}addWorkspaceHighlightResults(i,e){let t=new Set,o=r=>{for(;r;)t.add(r),r=r.parent};for(let r of e){let s=i.find(r);if(s&&s.root===i){this.findHighlightTree.add(r,i),o(s.parent);continue}let l=F6o(r,i);l&&(this.findHighlightTree.add(r,i),o(l.parent))}let n=this.treeProvider();for(let r of t)n.hasNode(r)&&n.rerender(r)}endHighlightSession(){this.highlightSessionStartState=void 0,this.clearHighlights()}clearHighlights(){let i=this.treeProvider();for(let e of this.findHighlightTree.highlightedItems)i.hasNode(e)&&i.rerender(e);this.findHighlightTree.clear()}searchSupportsScheme(i){return i!==Y.file&&i!==Y.vscodeRemote?!1:this.searchService.schemeHasFileSearchProvider(i)}async getSearchResults(i,e,t,o){let n=i.toLowerCase(),r=t===0;return await Promise.all(e.map((s,l)=>this.searchInWorkspace(n,s,l,r,o)))}async searchInWorkspace(i,e,t,o,n){let r=o?W6o(i):V6o(i),s=MP(this.configurationService.getValue({resource:e.resource}))||{},l={folderQueries:[{folder:e.resource,disregardIgnoreFiles:!this.configurationService.getValue("explorer.excludeGitIgnore")}],type:1,shouldGlobMatchFilePattern:!0,cacheKey:`explorerfindprovider:${e.name}:${t}:${this.sessionId}`,excludePattern:s,ignoreGlobCase:!0},c,u;try{[c,u]=await Promise.all([this.searchService.fileSearch({...l,filePattern:`**/${r}`,maxResults:512},n),this.searchService.fileSearch({...l,filePattern:`**/${r}/**`},n)])}catch(v){if(!so(v))throw v}if(!c||!u||n.isCancellationRequested)return{explorerRoot:e,files:[],directories:[],hitMaxResults:!1};let p=c.results.map(v=>v.resource),h=O6o(u.results.map(v=>v.resource),e,r),g=p.filter(v=>!this.filesFilter.isIgnored(v,e.resource,!1)),f=h.filter(v=>!this.filesFilter.isIgnored(v,e.resource,!0));return{explorerRoot:e,files:g,directories:f,hitMaxResults:!!c.limitHit||!!u.limitHit}}};aPe=I([m(2,Jp),m(3,be),m(4,B),m(5,lr),m(6,Bo),m(7,za),m(8,X)],aPe);function O6o(a,i,e){let t=new Mn;for(let n of a){let r=Fc(i.resource,n);if(!r)throw new Error("Resource is not a child of the root");let s=i.resource,l=r.split("/").slice(0,-1);for(let c of l)s=s.with({path:`${s.path}/${c}`}),t.add(s)}let o=[];for(let n of t){let r=n.path.split("/"),s=r[r.length-1];!s||!Cp(e,s,{ignoreCase:!0})||o.push(n)}return o}function F6o(a,i){let e=Fc(i.resource,a);if(!e)throw new Error("Resource is not a child of the root");let t=i,o=i.resource,n=e.split("/");for(let r of n){o=o.with({path:`${o.path}/${r}`});let s=t.getChild(r);if(!s)return t;t=s}}function W6o(a){return a?"*"+a.split("").join("*")+"*":"*"}function V6o(a){return a?"*"+a+"*":"*"}var vHt=class{constructor(i,e,t,o,n){this.id=i;this.items=e;this.depth=o;this.collapsed=n;this._onDidChange=new E;this.onDidChange=this._onDidChange.event;this._index=e.length-1,this.updateLabels(t),this._updateLabelDisposable=t.label.onDidRender(()=>this.updateLabels(t))}static{this.ID=0}get index(){return this._index}get count(){return this.items.length}get current(){return this.items[this._index]}get currentId(){return`${this.id}_${this.index}`}get labels(){return this._labels}updateLabels(i){this._labels=Array.from(i.container.querySelectorAll(".label-name"));let e="";for(let t=0;t<this.labels.length;t++){let o=e.length?`${this.items[t].name}, compact, ${e}`:this.items[t].name;this.labels[t].setAttribute("aria-label",o),this.labels[t].setAttribute("aria-level",`${this.depth+t}`),e=e.length?`${this.items[t].name} ${e}`:this.items[t].name}this.updateCollapsed(this.collapsed),this._index<this.labels.length&&this.labels[this._index].classList.add("active")}previous(){this._index<=0||this.setIndex(this._index-1)}next(){this._index>=this.items.length-1||this.setIndex(this._index+1)}first(){this._index!==0&&this.setIndex(0)}last(){this._index!==this.items.length-1&&this.setIndex(this.items.length-1)}setIndex(i){i<0||i>=this.items.length||(this.labels[this._index].classList.remove("active"),this._index=i,this.labels[this._index].classList.add("active"),this._onDidChange.fire())}updateCollapsed(i){this.collapsed=i;for(let e=0;e<this.labels.length;e++)this.labels[e].setAttribute("aria-expanded",i?"false":"true")}dispose(){this._onDidChange.dispose(),this._updateLabelDisposable.dispose()}},S3=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h){this.labels=e;this.highlightTree=t;this.updateWidth=o;this.contextViewService=n;this.themeService=r;this.configurationService=s;this.explorerService=l;this.labelService=c;this.contextService=u;this.contextMenuService=p;this.instantiationService=h;this.compressedNavigationControllers=new Map;this._onDidChangeActiveDescendant=new xI;this.onDidChangeActiveDescendant=this._onDidChangeActiveDescendant.event;this.config=this.configurationService.getValue();let g=()=>{let f=this.configurationService.getValue("workbench.tree.indent"),v=Math.max(22-f,0);i.style.setProperty("--vscode-explorer-align-offset-margin-left",`${v}px`)};this.configListener=this.configurationService.onDidChangeConfiguration(f=>{f.affectsConfiguration("explorer")&&(this.config=this.configurationService.getValue()),f.affectsConfiguration("workbench.tree.indent")&&g()}),g()}static{this.ID="file"}getWidgetAriaLabel(){return d(10498,null)}get templateId(){return S3.ID}renderTemplate(i){let e=new P,t=e.add(this.labels.create(i,{supportHighlights:!0}));e.add(t.onDidRender(()=>{$r(Me(n.container),()=>{try{n.currentContext&&this.updateWidth(n.currentContext)}catch{}})}));let o=hHt.create(this.instantiationService,i,e);e.add(hHt.onDidRegisterDescriptor(r=>{let s=r.create(this.instantiationService,i);o.push(e.add(s)),s.setResource(n.currentContext?.resource)}));let n={templateDisposables:e,elementDisposables:e.add(new P),label:t,container:i,contribs:o};return n}renderElement(i,e,t){let o=i.element;t.currentContext=o;let n=this.explorerService.getEditableData(o);t.label.element.classList.remove("compressed"),n?(t.label.element.style.display="none",t.contribs.forEach(r=>r.setResource(void 0)),t.elementDisposables.add(this.renderInputBox(t.container,o,n))):(t.label.element.style.display="flex",this.renderStat(o,o.name,void 0,i.filterData,t))}renderCompressedElements(i,e,t){let o=i.element.elements[i.element.elements.length-1];t.currentContext=o;let n=i.element.elements.filter(s=>this.explorerService.isEditable(s)),r=n.length===0?void 0:this.explorerService.getEditableData(n[0]);if(r)t.label.element.classList.remove("compressed"),t.label.element.style.display="none",t.contribs.forEach(s=>s.setResource(void 0)),t.elementDisposables.add(this.renderInputBox(t.container,n[0],r));else{t.label.element.classList.add("compressed"),t.label.element.style.display="flex";let s=`compressed-explorer_${vHt.ID++}`,l=i.element.elements.map(h=>h.name),c=i.filterData;if(c&&c.length>2){let h=l.join("/").length-l[l.length-1].length;c=[c[0],c[1]+h,...c.slice(2)]}this.renderStat(o,l,s,c,t);let u=new vHt(s,i.element.elements,t,i.depth,i.collapsed);t.elementDisposables.add(u);let p=this.compressedNavigationControllers.get(o)??[];this.compressedNavigationControllers.set(o,[...p,u]),t.elementDisposables.add(this._onDidChangeActiveDescendant.add(u.onDidChange)),t.elementDisposables.add(j(t.container,"mousedown",h=>{let g=bHt(h.target);g&&u.setIndex(g.index)})),t.elementDisposables.add(Z(()=>{let h=this.compressedNavigationControllers.get(o)??[],g=h.findIndex(f=>f===u);if(g<0)throw new Error("Disposing unknown navigation controller");h.length===1?this.compressedNavigationControllers.delete(o):h.splice(g,1)}))}}renderStat(i,e,t,o,n){n.label.element.style.display="flex";let r=["explorer-item"];this.explorerService.isCut(i)&&r.push("cut");let s=this.themeService.getFileIconTheme();n.container.parentElement?.parentElement?.querySelector(".monaco-tl-twistie")?.classList.toggle("force-twistie",i.hasNests&&s.hidesExplorerArrows);let c=s.hasFileIcons&&(s.hidesExplorerArrows||!s.hasFolderIcons),u=i.nestedParent&&c;n.contribs.forEach(h=>h.setResource(i.resource)),n.label.setResource({resource:i.resource,name:e},{fileKind:i.isRoot?2:i.isDirectory?1:0,extraClasses:u?[...r,"align-nest-icon-with-parent-icon"]:r,fileDecorations:this.config.explorer.decorations,matches:ua(o),separator:this.labelService.getSeparator(i.resource.scheme,i.resource.authority),domId:t});let p=i.isDirectory?this.highlightTree.get(i):0;if(p>0){let h=new fv(n.label.element.lastElementChild,{},{...BS,badgeBackground:wt(WGi),badgeBorder:wt(VGi)});h.setCount(p),h.setTitleFormat(d(10490,null,p)),n.elementDisposables.add(h)}n.label.element.classList.toggle("highlight-badge",p>0)}renderInputBox(i,e,t){let o=this.labels.create(i),n=["explorer-item","explorer-item-edited"],r=e.isRoot?2:e.isDirectory?1:0,s=this.themeService.getFileIconTheme(),l=s.hasFileIcons&&(s.hidesExplorerArrows||!s.hasFolderIcons),c=e.nestedParent&&l,u={hidePath:!0,hideLabel:!0,fileKind:r,extraClasses:c?[...n,"align-nest-icon-with-parent-icon"]:n},p=e.name?ci(e.resource):e.resource,h=e.name||"";o.setFile(je(p,h||" "),u),o.element.firstElementChild.style.display="none";let g=new Dc(o.element,this.contextViewService,{validationOptions:{validation:w=>{let k=t.validationMessage(w);return!k||k.severity!==St.Error?null:{content:k.content,formatContent:!0,type:3}}},ariaLabel:d(10491,null),inputBoxStyles:pl}),f=h.lastIndexOf("."),v="prefix";g.value=h,g.focus(),g.select({start:0,end:f>0&&!e.isDirectory?f:h.length});let b=wd((w,k)=>{o.element.style.display="none";let T=g.value;Ue(y),o.element.remove(),k&&t.onFinish(T,w)}),S=()=>{if(g.isInputValid()){let w=t.validationMessage(g.value);w?g.showMessage({content:w.content,formatContent:!0,type:w.severity===St.Info?1:w.severity===St.Warning?2:3}):g.hideMessage()}};S();let y=[g,g.onDidChange(w=>{o.setFile(je(p,w||" "),u)}),Vo(g.inputElement,re.KEY_DOWN,w=>{if(w.equals(60)){let k=g.value.lastIndexOf(".");if(e.isDirectory||k===-1)return;v==="prefix"?(v="all",g.select({start:0,end:g.value.length})):v==="all"?(v="suffix",g.select({start:k+1,end:g.value.length})):(v="prefix",g.select({start:0,end:k}))}else w.equals(3)?g.validate()||b(!0,!0):w.equals(9)&&b(!1,!0)}),Vo(g.inputElement,re.KEY_UP,w=>{S()}),j(g.inputElement,re.BLUR,async()=>{for(;;){await Pi(0);let w=g.inputElement.ownerDocument;if(!w.hasFocus())break;if(sa(g.inputElement))return;if(Ao(w.activeElement)&&Qbe(w.activeElement,"context-view"))await H.toPromise(this.contextMenuService.onDidHideContextMenu);else break}b(g.isInputValid(),!0)}),o];return Z(()=>{b(!1,!1)})}disposeElement(i,e,t){t.currentContext=void 0,t.elementDisposables.clear()}disposeCompressedElements(i,e,t){t.currentContext=void 0,t.elementDisposables.clear()}disposeTemplate(i){i.templateDisposables.dispose()}getCompressedNavigationController(i){return this.compressedNavigationControllers.get(i)}getAriaLabel(i){return i.name}getAriaLevel(i){let e=0,t=i.parent;for(;t;)t=t.parent,e++;return this.contextService.getWorkbenchState()===3&&(e=e+1),e}getActiveDescendantId(i){return this.compressedNavigationControllers.get(i)?.[0]?.currentId??void 0}dispose(){this.configListener.dispose()}};S3=I([m(4,_n),m(5,De),m(6,B),m(7,za),m(8,ot),m(9,Pe),m(10,ze),m(11,F)],S3);var lPe=class{constructor(i,e,t,o,n,r){this.contextService=i;this.configurationService=e;this.explorerService=t;this.editorService=o;this.uriIdentityService=n;this.fileService=r;this.hiddenExpressionPerRoot=new Map;this.editorsAffectingFilter=new Set;this._onDidChange=new E;this.toDispose=[];this.ignoreFileResourcesPerRoot=new Map;this.ignoreTreesPerRoot=new Map;this.toDispose.push(this._onDidChange),this.toDispose.push(this.contextService.onDidChangeWorkspaceFolders(()=>this.updateConfiguration())),this.toDispose.push(this.configurationService.onDidChangeConfiguration(s=>{(s.affectsConfiguration("files.exclude")||s.affectsConfiguration("explorer.excludeGitIgnore"))&&this.updateConfiguration()})),this.toDispose.push(this.fileService.onDidFilesChange(s=>{for(let[l,c]of this.ignoreFileResourcesPerRoot.entries())c.forEach(async u=>{s.contains(u,0)&&await this.processIgnoreFile(l,u,!0),s.contains(u,2)&&(this.ignoreTreesPerRoot.get(l)?.delete(ci(u)),c.delete(u),this._onDidChange.fire())})})),this.toDispose.push(this.editorService.onDidVisibleEditorsChange(()=>{let s=this.editorService.visibleEditors,l=!1;for(let c of s){if(!c.resource)continue;if(this.explorerService.findClosest(c.resource)?.isExcluded){l=!0;break}}for(let c of this.editorsAffectingFilter)if(!s.includes(c)){l=!0;break}l&&(this.editorsAffectingFilter.clear(),this._onDidChange.fire())})),this.updateConfiguration()}get onDidChange(){return this._onDidChange.event}updateConfiguration(){let i=!1,e=!1;this.contextService.getWorkspace().folders.forEach(t=>{let o=this.configurationService.getValue({resource:t.uri}),n=o?.files?.exclude||Object.create(null),r=o.explorer.excludeGitIgnore;if(r&&!this.ignoreTreesPerRoot.has(t.uri.toString())&&(e=!0,this.ignoreFileResourcesPerRoot.set(t.uri.toString(),new Mn),this.ignoreTreesPerRoot.set(t.uri.toString(),Yu.forUris(l=>this.uriIdentityService.extUri.ignorePathCasing(l)))),!r&&this.ignoreTreesPerRoot.has(t.uri.toString())&&(e=!0,this.ignoreFileResourcesPerRoot.delete(t.uri.toString()),this.ignoreTreesPerRoot.delete(t.uri.toString())),!i){let l=this.hiddenExpressionPerRoot.get(t.uri.toString());i=!l||!uo(l.original,n)}let s=Xi(n);this.hiddenExpressionPerRoot.set(t.uri.toString(),{original:s,parsed:zm(s)})}),(i||e)&&(this.editorsAffectingFilter.clear(),this._onDidChange.fire())}async processIgnoreFile(i,e,t){let o=ci(e),n=this.ignoreTreesPerRoot.get(i);if(!n||!t&&n.has(o))return;let r=await this.fileService.readFile(e);if(t)n.get(o)?.updateContents(r.value.toString());else{let s=n.findSubstr(o),l=!this.fileService.hasCapability(e,1024),c=new mHt(r.value.toString(),o.path,s,l);n.set(o,c),this.ignoreFileResourcesPerRoot.get(i)?.has(e)||this.ignoreFileResourcesPerRoot.get(i)?.add(e)}this._onDidChange.fire()}filter(i,e){return i.name===".gitignore"&&this.ignoreTreesPerRoot.has(i.root.resource.toString())?(this.processIgnoreFile(i.root.resource.toString(),i.resource,!1),!0):this.isVisible(i,e)}isVisible(i,e){if(i.isExcluded=!1,e===0)return i.isExcluded=!0,!1;if(this.explorerService.getEditableData(i))return!0;if((this.hiddenExpressionPerRoot.get(i.root.resource.toString())?.parsed(SM(i.root.resource.path,i.resource.path),i.name,r=>!!i.parent?.getChild(r))?!0:this.isIgnored(i.resource,i.root.resource,i.isDirectory))||i.parent?.isExcluded){i.isExcluded=!0;let s=this.editorService.visibleEditors.find(l=>l.resource&&this.uriIdentityService.extUri.isEqualOrParent(l.resource,i.resource));return s&&i.root===this.explorerService.findClosestRoot(i.resource)?(this.editorsAffectingFilter.add(s),!0):!1}return!0}isIgnored(i,e,t){let n=this.ignoreTreesPerRoot.get(e.toString())?.findSubstr(i)?.isPathIncludedInTraversal(i.path,t);return n===void 0?!1:!n}dispose(){Ue(this.toDispose)}};lPe=I([m(0,Pe),m(1,B),m(2,za),m(3,ee),m(4,dt),m(5,be)],lPe);var cPe=class{constructor(i,e){this.explorerService=i;this.contextService=e}compare(i,e){if(i.isRoot){if(e.isRoot){let l=this.contextService.getWorkspaceFolder(i.resource),c=this.contextService.getWorkspaceFolder(e.resource);return l&&c?l.index-c.index:-1}return-1}if(e.isRoot)return 1;let t=this.explorerService.sortOrderConfiguration.sortOrder,o=this.explorerService.sortOrderConfiguration.lexicographicOptions;this.explorerService.sortOrderConfiguration.reverse&&([i,e]=[e,i]);let r,s;switch(o){case"upper":r=Uio,s=$io;break;case"lower":r=zio,s=qio;break;case"unicode":r=Kio,s=jio;break;default:r=h7e,s=Gio}switch(t){case"type":if(i.isDirectory&&!e.isDirectory)return-1;if(e.isDirectory&&!i.isDirectory)return 1;if(i.isDirectory&&e.isDirectory)return r(i.name,e.name);break;case"filesFirst":if(i.isDirectory&&!e.isDirectory)return 1;if(e.isDirectory&&!i.isDirectory)return-1;break;case"foldersNestsFiles":if(i.isDirectory&&!e.isDirectory)return-1;if(e.isDirectory&&!i.isDirectory)return 1;if(i.hasNests&&!e.hasNests)return-1;if(e.hasNests&&!i.hasNests)return 1;break;case"mixed":break;default:if(i.isDirectory&&!e.isDirectory)return-1;if(e.isDirectory&&!i.isDirectory)return 1;break}switch(t){case"type":return s(i.name,e.name);case"modified":return i.mtime!==e.mtime?i.mtime&&e.mtime&&i.mtime<e.mtime?1:-1:r(i.name,e.name);default:return r(i.name,e.name)}}};cPe=I([m(0,za),m(1,Pe)],cPe);var aT=class{constructor(i,e,t,o,n,r,s,l,c,u){this.isCollapsed=i;this.explorerService=e;this.editorService=t;this.dialogService=o;this.contextService=n;this.fileService=r;this.configurationService=s;this.instantiationService=l;this.workspaceEditingService=c;this.uriIdentityService=u;this.compressedDropTargetDisposable=C.None;this.disposables=new P;this.dropEnabled=!1;let p=h=>{(!h||h.affectsConfiguration("explorer.enableDragAndDrop"))&&(this.dropEnabled=this.configurationService.getValue("explorer.enableDragAndDrop"))};p(void 0),this.disposables.add(this.configurationService.onDidChangeConfiguration(h=>p(h)))}static{this.CONFIRM_DND_SETTING_KEY="explorer.confirmDragAndDrop"}onDragOver(i,e,t,o,n){if(!this.dropEnabled)return!1;if(e){let r=aT.getCompressedStatFromDragEvent(e,n);if(r){let s=bHt(n.target);if(s&&s.index<s.count-1){let l=this.handleDragOver(i,r,t,o,n);return l?(s.element!==this.compressedDragOverElement&&(this.compressedDragOverElement=s.element,this.compressedDropTargetDisposable.dispose(),this.compressedDropTargetDisposable=Z(()=>{s.element.classList.remove("drop-target"),this.compressedDragOverElement=void 0}),s.element.classList.add("drop-target")),typeof l=="boolean"?l:{...l,feedback:[]}):(this.compressedDropTargetDisposable.dispose(),!1)}}}return this.compressedDropTargetDisposable.dispose(),this.handleDragOver(i,e,t,o,n)}handleDragOver(i,e,t,o,n){let r=n&&(n.ctrlKey&&!it||n.altKey&&it),s=i instanceof p1,c={type:s||r?0:1,position:"drop-target"};if(s){if(!gu(n,Aa.FILES,Ll.FILES,Aa.RESOURCES))return!1}else{if(i instanceof Zqe)return!1;{let u=aT.getStatsFromDragAndDropData(i),p=u.every(h=>h.isRoot);if(!e)return!r&&u.every(h=>!!h.parent&&h.parent.isRoot)?!1:p?{accept:!0,effect:{type:1,position:"drop-target-after"}}:{accept:!0,bubble:0,effect:c,autoExpand:!1};if(!Array.isArray(u)||!r&&u.every(h=>h.isReadonly)||u.some(h=>h.isRoot?!1:!!(this.uriIdentityService.extUri.isEqual(h.resource,e.resource)||!r&&this.uriIdentityService.extUri.isEqual(ci(h.resource),e.resource)||this.uriIdentityService.extUri.isEqualOrParent(e.resource,h.resource))))return!1;if(p){if(!e.isRoot)return!1;let h;switch(o){case 0:case 1:h="drop-target-before";break;case 2:case 3:h="drop-target-after";break}return{accept:!0,effect:{type:1,position:h}}}}}if(e){if(e.isDirectory)return e.isReadonly?!1:{accept:!0,bubble:0,effect:c,autoExpand:!0};if(this.contextService.getWorkspace().folders.every(u=>u.uri.toString()!==e.resource.toString()))return{accept:!0,bubble:1,effect:c}}else return{accept:!0,bubble:0,effect:c};return!1}getDragURI(i){return this.explorerService.isEditable(i)?null:i.resource.toString()}getDragLabel(i,e){return i.length===1?aT.getCompressedStatFromDragEvent(i[0],e).name:String(i.length)}onDragStart(i,e){let t=aT.getStatsFromDragAndDropData(i,e);if(t.length&&e.dataTransfer){this.instantiationService.invokeFunction(n=>Ig(n,t,e));let o=t.filter(n=>n.resource.scheme===Y.file).map(n=>n.resource.fsPath);o.length&&e.dataTransfer.setData(Ll.FILES,JSON.stringify(o))}}async drop(i,e,t,o,n){if(this.compressedDropTargetDisposable.dispose(),e){let s=aT.getCompressedStatFromDragEvent(e,n);s&&(e=s)}if(e||(e=this.explorerService.roots[this.explorerService.roots.length-1],o=3),!e.isDirectory&&e.parent&&(e=e.parent),e.isReadonly)return;let r=e;if(r)try{i instanceof p1?!Gt||xx(this.contextService.getWorkspace())&&Sx.supported(It)?await this.instantiationService.createInstance(JMe).import(r,n,It):await this.instantiationService.createInstance(TB).upload(e,n):await this.handleExplorerDrop(i,r,t,o,n)}catch(s){this.dialogService.error(In(s))}}async handleExplorerDrop(i,e,t,o,n){let r=aT.getStatsFromDragAndDropData(i),s=new Map(r.map(h=>[h,this.isCollapsed(h)]));for(let[h,g]of s)if(g){let f=h.nestedChildren;if(f)for(let v of f)s.set(v,!0)}let l=fGe([...s.keys()],h=>h.resource),c=n.ctrlKey&&!it||n.altKey&⁢if(!c&&this.configurationService.getValue(aT.CONFIRM_DND_SETTING_KEY)){let h=l.length>1&&l.every(v=>v.isRoot)?d(10486,null):l.length>1?d(10484,null,l.length,e.name):l[0].isRoot?d(10485,null,l[0].name):d(10483,null,l[0].name,e.name),g=l.length>1&&!l.every(v=>v.isRoot)?Xw(l.map(v=>v.resource)):void 0,f=await this.dialogService.confirm({message:h,detail:g,checkbox:{label:d(10489,null)},primaryButton:d(10493,null)});if(!f.confirmed)return;f.checkboxChecked===!0&&await this.configurationService.updateValue(aT.CONFIRM_DND_SETTING_KEY,!1)}await this.doHandleRootDrop(l.filter(h=>h.isRoot),e,o);let p=l.filter(h=>!h.isRoot);return c?this.doHandleExplorerDropOnCopy(p,e):this.doHandleExplorerDropOnMove(p,e)}async doHandleRootDrop(i,e,t){if(i.length===0)return;let o=this.contextService.getWorkspace().folders,n,r=[],s=[],l=[];for(let c=0;c<o.length;c++){let u={uri:o[c].uri,name:o[c].name};e instanceof Tg&&this.uriIdentityService.extUri.isEqual(o[c].uri,e.resource)&&(n=c);for(let p of i)if(this.uriIdentityService.extUri.isEqual(o[c].uri,p.resource)){r.push(c);break}i.every(p=>p.resource.toString()!==o[c].uri.toString())?s.push(u):l.push(u)}if(n===void 0)n=s.length;else{switch(t){case 3:case 2:n++;break}for(let c of r)c<n&&n--}return s.splice(n,0,...l),this.workspaceEditingService.updateFolders(0,s.length,s)}async doHandleExplorerDropOnCopy(i,e){let t=this.configurationService.getValue().explorer,o=[];for(let{resource:s,isDirectory:l}of i){let c=t.incrementalNaming==="disabled",u=await GBt(this.explorerService,this.fileService,this.dialogService,e,{resource:s,isDirectory:l,allowOverwrite:c},t.incrementalNaming);if(!u)continue;let p=new tu(s,u,{copy:!0,overwrite:c});o.push(p)}let n=Nuo(i);await this.explorerService.applyBulkEdit(o,{confirmBeforeUndo:t.confirmUndo==="default"||t.confirmUndo==="verbose",undoLabel:d(10487,null,n),progressLabel:d(10488,null,n)});let r=o.filter(s=>{let l=s.newResource?this.explorerService.findClosest(s.newResource):void 0;return l&&!l.isDirectory}).map(s=>({resource:s.newResource,options:{pinned:!0}}));await this.editorService.openEditors(r)}async doHandleExplorerDropOnMove(i,e){let t=i.filter(r=>!r.isReadonly).map(r=>new tu(r.resource,je(e.resource,r.name))),o=Nuo(i),n={confirmBeforeUndo:this.configurationService.getValue().explorer.confirmUndo==="verbose",undoLabel:d(10492,null,o),progressLabel:d(10494,null,o)};try{await this.explorerService.applyBulkEdit(t,n)}catch(r){if(r.fileOperationResult===4){let s=[];for(let u of t)u.newResource&&await this.fileService.exists(u.newResource)&&s.push(u.newResource);let l=Qdo(s),{confirmed:c}=await this.dialogService.confirm(l);c&&await this.explorerService.applyBulkEdit(t.map(u=>new tu(u.oldResource,u.newResource,{overwrite:!0})),n)}else throw r}}static getStatsFromDragAndDropData(i,e){return i.context?i.context:e&&i.elements.length===1?(i.context=[aT.getCompressedStatFromDragEvent(i.elements[0],e)],i.context):i.elements}static getCompressedStatFromDragEvent(i,e){let t=Me(e).document.elementFromPoint(e.clientX,e.clientY),o=bHt(t);if(o){let{count:n,index:r}=o,s=n-1;for(;s>r&&i.parent;)i=i.parent,s--;return i}return i}onDragEnd(){this.compressedDropTargetDisposable.dispose()}dispose(){this.compressedDropTargetDisposable.dispose()}};aT=I([m(1,za),m(2,ee),m(3,ct),m(4,Pe),m(5,be),m(6,B),m(7,F),m(8,Of),m(9,dt)],aT);function bHt(a){if(!Ao(a))return null;let i=a;for(;i&&!i.classList.contains("monaco-list-row");){if(i.classList.contains("label-name")&&i.hasAttribute("data-icon-label-count")){let e=Number(i.getAttribute("data-icon-label-count")),t=Number(i.getAttribute("data-icon-label-index"));if(Xo(e)&&Xo(t))return{element:i,count:e,index:t}}i=i.parentElement}return null}function Ouo(a){return!!bHt(a)}var SHt=class{isIncompressible(i){return i.isRoot||!i.isDirectory||i instanceof d3||!i.parent||i.parent.isRoot}};function Nuo(a){return a.length===1?a[0].name:a.every(i=>i.isDirectory)?d(10496,null,a.length):a.every(i=>!i.isDirectory)?d(10495,null,a.length):`${a.length} files and folders`}function B6o(a){if(a.isRoot&&a.error)return{tooltip:d(10472,null,In(a.error)),letter:"!",color:PGi};if(a.isSymbolicLink)return{tooltip:d(10474,null),letter:"\u2937"};if(a.isUnknown)return{tooltip:d(10475,null),letter:"?"};if(a.isExcluded)return{color:hgt}}var dPe=class{constructor(i,e){this.explorerService=i;this.label=d(10473,null);this._onDidChange=new E;this.toDispose=new P;this.toDispose.add(this._onDidChange),this.toDispose.add(e.onDidChangeWorkspaceFolders(t=>{this._onDidChange.fire(t.changed.concat(t.added).map(o=>o.uri))})),this.toDispose.add(gHt.event((t=>{this._onDidChange.fire([t])})))}get onDidChange(){return this._onDidChange.event}async provideDecorations(i){let e=this.explorerService.findClosest(i);if(!e)throw new Error("ExplorerItem not found");return B6o(e)}dispose(){this.toDispose.dispose()}};dPe=I([m(0,za),m(1,Pe)],dPe);function H6o(a,i){for(let e of i)if(a.hasNode(e)&&!a.isCollapsed(e)){for(let[,t]of e.children.entries())if(a.hasNode(t)&&a.isCollapsible(t)&&!a.isCollapsed(t))return!0}return!1}function U6o(a,i){for(let e of i)if(a.hasNode(e)&&!a.isCollapsed(e))return!0;return!1}var z6o={getId:a=>a instanceof d3?`new:${a.getId()}`:a.getId()};function K6o(a,i,e,t){let o;o=a.length?a[0]:void 0,e&&i.length>1&&(o=void 0);let n=o&&t.getCompressedNavigationController(o),r=n?.length?n[0]:void 0;o=r?r.current:o;let s=[];for(let l of i){let u=t.getCompressedNavigationController(l)?.at(0);if(u&&o&&u===r){l===o&&s.push(l);continue}u?s.push(...u.items):s.push(l)}return o?e&&s.indexOf(o)>=0?s:[o]:e?s:[]}var zR=class extends zr{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N,O,V,U,G){super(e,p,t,g,h,o,n,U,b,y);this.contextService=r;this.progressService=s;this.editorService=l;this.editorResolverService=c;this.layoutService=u;this.decorationService=f;this.labelService=v;this.telemetryService=S;this.explorerService=w;this.storageService=k;this.clipboardService=T;this.fileService=N;this.uriIdentityService=O;this.commandService=V;this.accessibilityService=G;this._autoReveal=!1;this.delegate=e.delegate,this.resourceContext=n.createInstance(Fo),this._register(this.resourceContext),this.parentReadonlyContext=ivi.bindTo(h),this.folderContext=lu.bindTo(h),this.readonlyContext=tvi.bindTo(h),this.availableEditorIdsContext=VPt.bindTo(h),this.rootContext=FC.bindTo(h),this.resourceMoveableToTrash=due.bindTo(h),this.compressedFocusContext=uue.bindTo(h),this.compressedFocusFirstContext=x7e.bindTo(h),this.compressedFocusLastContext=k7e.bindTo(h),this.viewHasSomeCollapsibleRootItem=Coo.bindTo(h),this.viewVisibleContextKey=$5.bindTo(h),this.explorerService.registerView(this)}static{this.TREE_VIEW_STATE_STORAGE_KEY="workbench.explorer.treeViewState"}get singleViewPaneContainerTitle(){return this.name}get autoReveal(){return this._autoReveal}set autoReveal(e){this._autoReveal=e}get name(){return this.labelService.getWorkspaceLabel(this.contextService.getWorkspace())}get title(){return this.name}set title(e){}setVisible(e){this.viewVisibleContextKey.set(e),super.setVisible(e)}get fileCopiedContextKey(){return iHt.bindTo(this.contextKeyService)}get resourceCutContextKey(){return BPt.bindTo(this.contextKeyService)}renderHeader(e){super.renderHeader(e),this.dragHandler=new IIe(e,()=>this.setExpanded(!0));let t=e.querySelector(".title"),o=()=>{t.textContent=this.name,this.updateTitle(this.name),this.ariaHeaderLabel=d(10480,null,this.name),t.setAttribute("aria-label",this.ariaHeaderLabel)};this._register(this.contextService.onDidChangeWorkspaceName(o)),this._register(this.labelService.onDidChangeFormatters(o)),o()}layoutBody(e,t){super.layoutBody(e,t),this.tree.layout(e,t)}renderBody(e){super.renderBody(e),this.container=e,this.treeContainer=R(e,_(".explorer-folders-view")),this.createTree(this.treeContainer),this._register(this.labelService.onDidChangeFormatters(()=>{this._onDidChangeTitleArea.fire()})),this.onConfigurationUpdated(void 0),this._register(this.editorService.onDidActiveEditorChange(()=>{this.selectActiveFile()})),this._register(this.configurationService.onDidChangeConfiguration(t=>this.onConfigurationUpdated(t))),this._register(this.onDidChangeBodyVisibility(async t=>{t&&(await this.setTreeInput(),this.updateAnyCollapsedContext(),this.selectActiveFile(!0))})),this._register(j(Me(this.container),re.PASTE,async t=>{!this.hasFocus()||this.readonlyContext.get()||t.clipboardData?.files?.length&&await this.commandService.executeCommand("filesExplorer.paste",t.clipboardData?.files)}))}focus(){if(super.focus(),this.tree.domFocus(),this.tree.getFocusedPart()===0){let e=this.tree.getFocus();e.length===1&&this._autoReveal&&this.tree.reveal(e[0],.5)}}hasFocus(){return ts(this.container)}getFocus(){return this.tree.getFocus()}focusNext(){this.tree.focusNext()}focusLast(){this.tree.focusLast()}getContext(e){let t=this.tree.getFocusedPart()===1?this.tree.getStickyScrollFocus():this.tree.getFocus();return K6o(t,this.tree.getSelection(),e,this.renderer)}isItemVisible(e){return this.filter?this.filter.filter(e,1):!1}isItemCollapsed(e){return this.tree.isCollapsed(e)}async setEditable(e,t){t?(this.horizontalScrolling=this.tree.options.horizontalScrolling,this.horizontalScrolling&&this.tree.updateOptions({horizontalScrolling:!1}),await this.tree.expand(e.parent)):(this.horizontalScrolling!==void 0&&this.tree.updateOptions({horizontalScrolling:this.horizontalScrolling}),this.horizontalScrolling=void 0,this.treeContainer.classList.remove("highlight")),await this.refresh(!1,e.parent,!1),t?(this.treeContainer.classList.add("highlight"),this.tree.reveal(e)):this.tree.domFocus()}async selectActiveFile(e=this._autoReveal){if(this._autoReveal){let t=no.getCanonicalUri(this.editorService.activeEditor,{supportSideBySide:1});if(t){let o=this.tree.getFocus(),n=this.tree.getSelection();return o.length===1&&this.uriIdentityService.extUri.isEqual(o[0].resource,t)&&n.length===1&&this.uriIdentityService.extUri.isEqual(n[0].resource,t)?void 0:this.explorerService.select(t,e)}}}createTree(e){this.filter=this.instantiationService.createInstance(lPe),this._register(this.filter),this._register(this.filter.onDidChange(()=>this.refresh(!0)));let t=this.instantiationService.createInstance(Za,{onDidChangeVisibility:this.onDidChangeBodyVisibility});this._register(t),this.findProvider=this.instantiationService.createInstance(aPe,this.filter,()=>this.tree);let o=l=>this.tree.updateWidth(l);this.renderer=this.instantiationService.createInstance(S3,e,t,this.findProvider.highlightTree,o),this._register(this.renderer),this._register(DB(e,this.themeService));let n=()=>{let l=this.configurationService.getValue("explorer.compactFolders");return this.accessibilityService.isScreenReaderOptimized()?!1:l},r=l=>this.configurationService.getValue({resource:l?.root.resource}).explorer.fileNesting;this.tree=this.instantiationService.createInstance(qI,"FileExplorer",e,new $et,new SHt,[this.renderer],this.instantiationService.createInstance(sPe,this.filter,this.findProvider),{compressionEnabled:n(),accessibilityProvider:this.renderer,identityProvider:z6o,keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:l=>{if(!this.explorerService.isEditable(l))return l.name},getCompressedNodeKeyboardNavigationLabel:l=>{if(!l.some(c=>this.explorerService.isEditable(c)))return l.map(c=>c.name).join("/")}},multipleSelectionSupport:!0,filter:this.filter,sorter:this.instantiationService.createInstance(cPe),dnd:this.instantiationService.createInstance(aT,l=>this.isItemCollapsed(l)),collapseByDefault:l=>!(l instanceof Tg&&(l.hasNests&&r(l).expand||this.findProvider.isShowingFilterResults())),autoExpandSingleChildren:!0,expandOnlyOnTwistieClick:l=>{if(l instanceof Tg){if(l.hasNests)return!0;if(this.configurationService.getValue("workbench.tree.expandMode")==="doubleClick")return!0}return!1},paddingBottom:$et.ITEM_HEIGHT,overrideStyles:this.getLocationBasedColors().listOverrideStyles,findProvider:this.findProvider}),this._register(this.tree),this._register(this.themeService.onDidColorThemeChange(()=>this.tree.rerender()));let s=H.filter(this.configurationService.onDidChangeConfiguration,l=>l.affectsConfiguration("explorer.compactFolders"));this._register(s(l=>this.tree.updateOptions({compressionEnabled:n()}))),this._register(this.accessibilityService.onDidChangeScreenReaderOptimized(()=>{this.tree.updateOptions({compressionEnabled:n()})})),ovi.bindTo(this.tree.contextKeyService),C7e.bindTo(this.tree.contextKeyService),this._register(this.tree.onDidChangeFocus(l=>this.onFocusChanged(l.elements))),this.onFocusChanged([]),this._register(this.tree.onDidOpen(async l=>{let c=l.element;if(!c)return;if(!(ag(l.browserEvent)&&l.browserEvent.shiftKey)){if(c.isDirectory||this.explorerService.isEditable(void 0))return;this.telemetryService.publicLog2("workbenchActionExecuted",{id:"workbench.files.openFile",from:"explorer"});try{this.delegate?.willOpenElement(l.browserEvent),await this.editorService.openEditor({resource:c.resource,options:{preserveFocus:l.editorOptions.preserveFocus,pinned:l.editorOptions.pinned,source:1}},l.sideBySide?vn:Un)}finally{this.delegate?.didOpenElement()}}})),this._register(this.tree.onContextMenu(l=>this.onContextMenu(l))),this._register(this.tree.onDidScroll(async l=>{let c=this.explorerService.getEditable();l.scrollTopChanged&&c&&this.tree.getRelativeTop(c.stat)===null&&await c.data.onFinish("",!1)})),this._register(this.tree.onDidChangeCollapseState(l=>{let c=l.node.element?.element;c&&this.renderer.getCompressedNavigationController(Array.isArray(c)?c[0]:c)?.forEach(p=>p.updateCollapsed(l.node.collapsed)),this.updateAnyCollapsedContext()})),this.updateAnyCollapsedContext(),this._register(this.tree.onMouseDblClick(l=>{let c=this.configurationService.getValue("workbench.list.scrollByPage");l.element===null&&!c&&this.commandService.executeCommand(wme)})),this._register(this.storageService.onWillSaveState(()=>{this.storeTreeViewState()}))}onConfigurationUpdated(e){if(!e||e.affectsConfiguration("explorer.autoReveal")){let t=this.configurationService.getValue();this._autoReveal=t?.explorer?.autoReveal}e&&(e.affectsConfiguration("explorer.decorations.colors")||e.affectsConfiguration("explorer.decorations.badges"))&&this.refresh(!0)}storeTreeViewState(){this.storageService.store(zR.TREE_VIEW_STATE_STORAGE_KEY,JSON.stringify(this.tree.getViewState()),1,1)}setContextKeys(e){let t=this.contextService.getWorkspace().folders,o=e?e.resource:t[t.length-1].uri;if(e=e||this.explorerService.findClosest(o),this.resourceContext.set(o),this.folderContext.set(!!e&&e.isDirectory),this.readonlyContext.set(!!e&&!!e.isReadonly),this.parentReadonlyContext.set(!!e?.parent?.isReadonly),this.rootContext.set(!!e&&e.isRoot),o){let n=o?this.editorResolverService.getEditors(o).map(r=>r.id):[];this.availableEditorIdsContext.set(n.join(","))}else this.availableEditorIdsContext.reset()}async onContextMenu(e){if(Oh(e.browserEvent.target))return;let t=e.element,o=e.anchor;if(Ao(o)&&t){let l=this.renderer.getCompressedNavigationController(t);l&&l.length>0&&(ag(e.browserEvent)||Ouo(e.browserEvent.target)?o=l[0].labels[l[0].index]:l.forEach(c=>c.last()))}this.fileCopiedContextKey.set(await this.clipboardService.hasResources()),this.setContextKeys(t);let n=this.tree.getSelection(),r=this.explorerService.roots,s;if(t instanceof Tg){let l=this.renderer.getCompressedNavigationController(t);s=l?.length?l[0].current.resource:t.resource}else s=r.length===1?r[0].resource:{};this.contextMenuService.showContextMenu({menuId:D.ExplorerContext,menuActionOptions:{arg:s,shouldForwardArgs:!0},contextKeyService:this.tree.contextKeyService,getAnchor:()=>o,onHide:l=>{l&&this.tree.domFocus()},getActionsContext:()=>t&&n&&n.indexOf(t)>=0?n.map(l=>l.resource):t instanceof Tg?[t.resource]:[]})}onFocusChanged(e){let t=e.at(0);if(this.setContextKeys(t),t){let n=!!this.configurationService.getValue().files?.enableTrash,r=this.fileService.hasCapability(t.resource,4096);this.resourceMoveableToTrash.set(n&&r)}else this.resourceMoveableToTrash.reset();let o=t&&this.renderer.getCompressedNavigationController(t);if(!o){this.compressedFocusContext.set(!1);return}this.compressedFocusContext.set(!0),o.forEach(n=>{this.updateCompressedNavigationContextKeys(n)})}refresh(e,t,o=!0){if(!this.tree||!this.isBodyVisible()||t&&!this.tree.hasNode(t)||this.findProvider?.isShowingFilterResults()&&e)return Promise.resolve(void 0);o&&this.explorerService.isEditable(void 0)&&this.tree.domFocus();let n=t||this.tree.getInput();return this.tree.updateChildren(n,e,!!t)}getOptimalWidth(){let e=this.tree.getHTMLElement(),t=[].slice.call(e.querySelectorAll(".explorer-item .label-name"));return jbe(e,t)}async setTreeInput(){if(!this.isBodyVisible())return Promise.resolve(void 0);this.setTreeInputPromise&&await this.setTreeInputPromise;let e=!this.tree.getInput();e&&sn("code/willResolveExplorer");let t=this.explorerService.roots,o=t[0];(this.contextService.getWorkbenchState()!==2||t[0].error)&&(o=t);let n;if(this.tree?.getInput())n=this.tree.getViewState();else{let l=this.storageService.get(zR.TREE_VIEW_STATE_STORAGE_KEY,1);l&&(n=JSON.parse(l))}let r=this.tree.getInput(),s=this.setTreeInputPromise=this.tree.setInput(o,n).then(async()=>{if(Array.isArray(o)){if(!n||r instanceof Tg)for(let l=0;l<Math.min(o.length,5);l++)try{await this.tree.expand(o[l])}catch{}if(!r&&o.length===1&&this.configurationService.getValue().explorer.expandSingleFolderWorkspaces&&await this.tree.expand(o[0]).catch(()=>{}),Array.isArray(r)){let l=new vt;r.forEach(c=>l.set(c.resource,!0)),await Promise.all(o.map(async c=>{if(!l.has(c.resource))try{await this.tree.expand(c)}catch{}}))}}e&&sn("code/didResolveExplorer")});this.progressService.withProgress({location:1,delay:this.layoutService.isRestored()?800:1500},l=>s),await s,this.decorationsProvider||(this.decorationsProvider=new dPe(this.explorerService,this.contextService),this._register(this.decorationService.registerDecorationsProvider(this.decorationsProvider)))}async selectResource(e,t=this._autoReveal,o=0){if(o===2||!e||!this.isBodyVisible())return;this.setTreeInputPromise&&await this.setTreeInputPromise;let n=this.explorerService.findClosestRoot(e);for(;n&&n.resource.toString()!==e.toString();){try{await this.tree.expand(n)}catch{return this.selectResource(e,t,o+1)}if(!n.children.size)n=null;else for(let r of n.children.values()){if(this.uriIdentityService.extUri.isEqualOrParent(e,r.resource)){n=r;break}n=null}}if(n){if(n===this.tree.getInput()){this.tree.setFocus([]),this.tree.setSelection([]);return}try{n.nestedParent&&await this.tree.expand(n.nestedParent),(t===!0||t==="force")&&this.tree.getRelativeTop(n)===null&&this.tree.reveal(n,.5),this.tree.setFocus([n]),this.tree.setSelection([n])}catch{return this.selectResource(e,t,o+1)}}}itemsCopied(e,t,o){this.fileCopiedContextKey.set(e.length>0),this.resourceCutContextKey.set(t&&e.length>0),o?.forEach(n=>this.tree.rerender(n)),t&&e.forEach(n=>this.tree.rerender(n))}expandAll(){this.explorerService.isEditable(void 0)&&this.tree.domFocus(),this.tree.expandAll()}collapseAll(){this.explorerService.isEditable(void 0)&&this.tree.domFocus();let e=this.tree.getInput();if(Array.isArray(e)&&H6o(this.tree,e)){e.forEach(t=>{t.children.forEach(o=>this.tree.hasNode(o)&&this.tree.collapse(o,!0))});return}this.tree.collapseAll()}previousCompressedStat(){let e=this.tree.getFocus();if(!e.length)return;this.renderer.getCompressedNavigationController(e[0]).forEach(o=>{o.previous(),this.updateCompressedNavigationContextKeys(o)})}nextCompressedStat(){let e=this.tree.getFocus();if(!e.length)return;this.renderer.getCompressedNavigationController(e[0]).forEach(o=>{o.next(),this.updateCompressedNavigationContextKeys(o)})}firstCompressedStat(){let e=this.tree.getFocus();if(!e.length)return;this.renderer.getCompressedNavigationController(e[0]).forEach(o=>{o.first(),this.updateCompressedNavigationContextKeys(o)})}lastCompressedStat(){let e=this.tree.getFocus();if(!e.length)return;this.renderer.getCompressedNavigationController(e[0]).forEach(o=>{o.last(),this.updateCompressedNavigationContextKeys(o)})}updateCompressedNavigationContextKeys(e){this.compressedFocusFirstContext.set(e.index===0),this.compressedFocusLastContext.set(e.index===e.count-1)}updateAnyCollapsedContext(){let e=this.tree.getInput();if(e===void 0)return;let t=Array.isArray(e)?e:Array.from(e.children.values());this.viewHasSomeCollapsibleRootItem.set(U6o(this.tree,t)),this.storeTreeViewState()}hasPhantomElements(){return!!this.findProvider?.isShowingFilterResults()}dispose(){this.dragHandler?.dispose(),super.dispose()}};I([mi],zR.prototype,"fileCopiedContextKey",1),I([mi],zR.prototype,"resourceCutContextKey",1),zR=I([m(1,ze),m(2,Ri),m(3,F),m(4,Pe),m(5,Bo),m(6,ee),m(7,ul),m(8,fi),m(9,_e),m(10,X),m(11,B),m(12,Cv),m(13,ot),m(14,De),m(15,Te),m(16,tt),m(17,za),m(18,le),m(19,Wi),m(20,be),m(21,dt),m(22,ge),m(23,Qe),m(24,Bi)],zR);function DB(a,i){a.classList.add("file-icon-themable-tree"),a.classList.add("show-file-icons");let e=t=>{a.classList.toggle("align-icons-and-twisties",t.hasFileIcons&&!t.hasFolderIcons),a.classList.toggle("hide-arrows",t.hidesExplorerArrows===!0)};return e(i.getFileIconTheme()),i.onDidFileIconThemeChange(e)}var Fuo=x.or(x.and(lu,pF),x.and(lu.toNegated(),ivi.toNegated()));W(class extends K{constructor(){super({id:"workbench.files.action.createFileFromExplorer",title:d(10478,null),f1:!1,icon:M.newFile,precondition:Fuo,menu:{id:D.ViewTitle,group:"navigation",when:x.equals("view",Cb),order:10}})}run(a){a.get(ge).executeCommand(wme)}});W(class extends K{constructor(){super({id:"workbench.files.action.createFolderFromExplorer",title:d(10479,null),f1:!1,icon:M.newFolder,precondition:Fuo,menu:{id:D.ViewTitle,group:"navigation",when:x.equals("view",Cb),order:20}})}run(a){a.get(ge).executeCommand(tPe)}});W(class extends K{constructor(){super({id:"workbench.files.action.refreshFilesExplorer",title:L(10481,"Refresh Explorer"),f1:!0,icon:M.refresh,menu:{id:D.ViewTitle,group:"navigation",when:x.equals("view",Cb),order:30},metadata:{description:L(10482,"Forces a refresh of the Explorer.")},precondition:HPt.negate()})}async run(a){let i=a.get(Ft),e=a.get(za);await i.openView(Cb),await e.refresh()}});W(class extends K{constructor(){super({id:"workbench.files.action.collapseExplorerFolders",title:L(10476,"Collapse Folders in Explorer"),f1:!0,icon:M.collapseAll,menu:{id:D.ViewTitle,group:"navigation",when:x.equals("view",Cb),order:40},metadata:{description:L(10477,"Folds all folders in the Explorer.")}})}run(a){let e=a.get(Ft).getViewWithId(Cb);e!==null&&e.collapseAll()}});var LB=class{constructor(i){this._itemFactory=i;this.pool=[];this._inUse=new Set}get inUse(){return this._inUse}get(){if(this.pool.length>0){let e=this.pool.pop();return this._inUse.add(e),e}let i=this._itemFactory();return this._inUse.add(i),i}release(i){this._inUse.delete(i),this.pool.push(i)}clear(){for(let i of this.pool)i.dispose();this.pool.length=0}dispose(){this.clear();for(let i of this._inUse)i.dispose();this._inUse.clear()}};var uPe=class extends C{constructor(e,t,o,n,r,s){super();this.content=e;this.hoverService=o;this.chatService=n;this.editorService=r;this.instantiationService=s;this.ELEMENT_HEIGHT=22;this.MAX_ITEMS_SHOWN=6;this.diffsBetweenRequests=new Map;this.isCollapsed=!0;this.fileChangesDiffsObservable=this.computeFileChangesDiffs(e);let l=_(".checkpoint-file-changes-summary-header");this.domNode=_(".checkpoint-file-changes-summary",void 0,l),this.domNode.tabIndex=0,this._register(this.renderHeader(l)),this._register(this.renderFilesList(this.domNode))}computeFileChangesDiffs({requestId:e,sessionResource:t}){return this.chatService.chatModels.map(o=>ht.find(o,n=>Xe(n.sessionResource,t))).map(o=>o?.editingSession?.getDiffsForFilesInRequest(e)).map((o,n)=>o?.read(n)||ht.empty())}getCachedEntryDiffBetweenRequests(e,t,o,n){let r=`${t}\0${o}\0${n}`,s=this.diffsBetweenRequests.get(r);return s||(s=e.getEntryDiffBetweenRequests(t,o,n),this.diffsBetweenRequests.set(r,s)),s}renderHeader(e){let t=e.appendChild(_(".chat-file-changes-label")),o=new oO(t,{});this._register(he(s=>{let l=this.fileChangesDiffsObservable.read(s);o.label=l.length===1?"Changed 1 file":`Changed ${l.length} files`}));let n=()=>{o.icon=this.isCollapsed?M.chevronRight:M.chevronDown,this.domNode.classList.toggle("chat-file-changes-collapsed",this.isCollapsed)};n();let r=new P;return r.add(o),r.add(o.onDidClick(()=>{this.isCollapsed=!this.isCollapsed,n()})),r.add(this.renderViewAllFileChangesButton(o.element)),Z(()=>r.dispose())}renderViewAllFileChangesButton(e){let t=e.appendChild(_(".chat-view-changes-icon")),o=this.hoverService.setupDelayedHover(t,()=>({content:L(7102,"View All File Changes")}));return t.classList.add(...q.asClassNameArray(M.diffMultiple)),t.setAttribute("role","button"),t.tabIndex=0,hn(o,j(t,"click",n=>{let r=this.fileChangesDiffsObservable.get().map(c=>({originalUri:c.originalURI,modifiedUri:c.modifiedURI})),s=A.parse(`multi-diff-editor:${new Date().getMilliseconds().toString()+Math.random().toString()}`),l=this.instantiationService.createInstance(xu,s,"Checkpoint File Changes",r.map(c=>new ik(c.originalUri,c.modifiedUri,void 0)),!1);this.editorService.openEditor(l),$t.stop(n,!0)}))}renderFilesList(e){let t=new P;this.list=t.add(this.instantiationService.createInstance(qet)).get();let o=this.list.getHTMLElement();return e.appendChild(o.parentElement),t.add(this.list.onDidOpen(n=>{let r=n.element;if(!r)return;let s={original:{resource:r.originalURI},modified:{resource:r.modifiedURI},options:{preserveFocus:!0}};this.editorService.openEditor(s)})),t.add(this.list.onContextMenu(n=>{$t.stop(n.browserEvent,!0)})),t.add(he(n=>{let r=this.fileChangesDiffsObservable.read(n),l=Math.min(r.length,this.MAX_ITEMS_SHOWN)*this.ELEMENT_HEIGHT;this.list.layout(l),o.style.height=l+"px",this.list.splice(0,this.list.length,r)})),t}hasSameContent(e,t,o){return e.kind==="changesSummary"&&e.requestId===this.content.requestId}addDisposable(e){this._register(e)}};uPe=I([m(2,tt),m(3,Si),m(4,ee),m(5,F)],uPe);var qet=class extends C{constructor(e,t){super();this.instantiationService=e;this.themeService=t;this._resourcePool=this._register(new LB(()=>this.listFactory()))}listFactory(){let e=_(".chat-summary-list"),t=new P;t.add(DB(e,this.themeService));let o=t.add(this.instantiationService.createInstance(Za,{onDidChangeVisibility:()=>C.None}));return{list:t.add(this.instantiationService.createInstance(Rl,"ChatListRenderer",e,new Cxi,[this.instantiationService.createInstance(IHt,o)],{alwaysConsumeMouseWheel:!1})),dispose:()=>{t.dispose()}}}get(){return this._resourcePool.get().list}};qet=I([m(0,F),m(1,De)],qet);var Cxi=class{getHeight(i){return 22}getTemplateId(i){return IHt.TEMPLATE_ID}},IHt=class a{constructor(i){this.labels=i;this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="collapsibleChangesSummaryListRenderer"}static{this.CHANGES_SUMMARY_CLASS_NAME="insertions-and-deletions"}renderTemplate(i){let e=this.labels.create(i,{supportHighlights:!0,supportIcons:!0});return{label:e,dispose:()=>e.dispose()}}renderElement(i,e,t){let o=t.label;o.setFile(i.modifiedURI,{fileKind:0,title:i.modifiedURI.path});let n=o.element;if(t.changesElement?.remove(),!i.identical&&!i.isBusy){let r=n.appendChild(_(`.${a.CHANGES_SUMMARY_CLASS_NAME}`)),s=r.appendChild(_(".insertions"));s.textContent=`+${i.added}`;let l=r.appendChild(_(".deletions"));l.textContent=`-${i.removed}`,t.changesElement=r}}disposeTemplate(i){i.dispose()}};var pPe=class extends C{constructor(e,t,o,n){super();this.editorService=o;this.telemetryService=n;let r=nCi(e.citations),s=bt(".chat-code-citation-message@root",[bt("span.chat-code-citation-label@label"),bt(".chat-code-citation-button-container@button")]);s.label.textContent=r+" - ";let l=this._register(new Mi(s.button,{buttonBackground:void 0,buttonBorder:void 0,buttonForeground:void 0,buttonHoverBackground:void 0,buttonSecondaryBackground:void 0,buttonSecondaryForeground:void 0,buttonSecondaryHoverBackground:void 0,buttonSeparator:void 0}));l.label=d(7103,null),this._register(l.onDidClick(()=>{let c=`# Code Citations
`+e.citations.map(u=>`## License: ${u.license}
${u.value.toString()}
\`\`\`
${u.snippet}
\`\`\`
`).join(`
`);this.editorService.openEditor({resource:void 0,contents:c,languageId:"markdown"}),this.telemetryService.publicLog2("openedChatCodeCitations")})),this.domNode=s.root}hasSameContent(e,t,o){return e.kind==="codeCitations"}};pPe=I([m(2,ee),m(3,Te)],pPe);var G6o=_,mPe=class extends C{constructor(e,t,o){super();this.commandService=o;this.domNode=G6o(".chat-command-button");let n=!Vi(t.element)||!t.element.isStale;if(this.renderButton(this.domNode,e.command,n),e.additionalCommands)for(let r of e.additionalCommands)this.renderButton(this.domNode,r,n,!0)}renderButton(e,t,o,n){let r=o?t.tooltip:d(7104,null),s=this._register(new Mi(e,{...Ko,supportIcons:!0,title:r,secondary:n}));s.label=t.title,s.enabled=o,this._register(s.onDidClick(()=>this.commandService.executeCommand(t.id,...t.arguments??[])))}hasSameContent(e){return e.kind==="command"}};mPe=I([m(2,ge)],mPe);var Av=ae("chatMarkdownAnchorService"),yHt=class extends C{constructor(){super(...arguments);this._widgets=[];this._lastFocusedWidget=void 0}get lastFocusedAnchor(){return this._lastFocusedWidget}setLastFocusedList(e){this._lastFocusedWidget=e}register(e){if(this._widgets.some(o=>o===e))throw new Error("Cannot register the same widget multiple times");this._widgets.push(e);let t=e.getHTMLElement();return sa(t)&&this.setLastFocusedList(e),hn(j(t,"focus",()=>this.setLastFocusedList(e)),Z(()=>this._widgets.splice(this._widgets.indexOf(e),1)),j(t,"blur",()=>{this._lastFocusedWidget===e&&this.setLastFocusedList(void 0)}))}};function Wuo(a,i){let e=i.getValue("chat.editorAssociations")??{},t=Object.keys(e).sort((o,n)=>n.length-o.length);for(let o of t)if(eX(o,a))return e[o]}function Ck(a,i,e,t){a.querySelectorAll("a").forEach(n=>{let r=n.textContent?.trim(),s=!1,l,c=n.getAttribute("data-href"),u;if(c)try{u=A.parse(c)}catch{}if(!r)s=!0;else if(u){let h=new URLSearchParams(u.query).get("vscodeLinkType");h&&(l={vscodeLinkType:h,linkText:r},s=!0)}if(s&&u?.scheme){let p=i.createInstance(RB,n,{kind:"inlineReference",inlineReference:u},l);t.add(e.register(p)),t.add(p)}})}var RB=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super();this.element=e;this.inlineReference=t;this.metadata=o;this.configurationService=n;this.notebookDocumentService=S;this.openerService=y;this.data="uri"in t.inlineReference?t.inlineReference:"name"in t.inlineReference?{kind:"symbol",symbol:t.inlineReference}:{uri:t.inlineReference},e.classList.add(RB.className,"show-file-icons");let w,k,T;if(this.data.kind==="symbol"){let U=this.data.symbol;T=this.data.symbol.location,w=[this.data.symbol.name],k=["codicon",...js(f,h,void 0,void 0,sh.toIcon(U.kind))],this._store.add(u.invokeFunction(G=>Ixi(G,e,r,{value:U.location,name:U.name,kind:U.kind},D.ChatInlineSymbolAnchorContext)))}else{T=this.data;let U=this.metadata?.linkText??p.getUriBasenameLabel(T.uri);if(T.range&&this.data.kind!=="symbol"){let ke=T.range.startLineNumber===T.range.endLineNumber?`:${T.range.startLineNumber}`:`:${T.range.startLineNumber}-${T.range.endLineNumber}`;w=[U,_("span.label-suffix",void 0,ke)]}else T.uri.scheme==="vscode-notebook-cell"&&this.data.kind!=="symbol"?w=[`${U} \u2022 cell${this.getCellIndex(T.uri)}`]:w=[U];let G=T.uri.path.endsWith("/")?1:0,$=()=>js(f,h,T.uri,G,G===1&&!b.getFileIconTheme().hasFolderIcons?X$:void 0);k=$();let te=()=>{N.classList.remove(...k),k=$(),N.classList.add(...k)};this._register(b.onDidFileIconThemeChange(()=>{te()}));let pe=!1;l.stat(T.uri).then(ke=>{pe=ke.isDirectory,ke.isDirectory&&(G=1,te())}).catch(()=>{});let de=this._register(r.createScoped(e));Get.bindTo(de).set(T.uri.toString());let se=lu.bindTo(de),Se=!1;this._register(j(e,re.CONTEXT_MENU,async ke=>{let Ee=new yn(Me(ke),ke);$t.stop(ke,!0),Se||(Se=!0,new CY(de,l,h,f).set(T.uri)),se.set(pe),!this._store.isDisposed&&s.showContextMenu({contextKeyService:de,getAnchor:()=>Ee,getActions:()=>{let He=g.getMenuActions(D.ChatInlineResourceAnchorContext,de,{arg:T.uri});return Uc(He)}})})),T.range&&(T.range.startLineNumber===T.range.endLineNumber?e.setAttribute("aria-label",d(7119,null,U,T.range.startLineNumber)):e.setAttribute("aria-label",d(7120,null,U,T.range.startLineNumber,T.range.endLineNumber)))}let N=_("span.icon");N.classList.add(...k),e.replaceChildren(N,_("span.icon-label",{},...w));let O=T.range?`${T.range.startLineNumber},${T.range.startColumn}`:"";e.setAttribute("data-href",(O?T.uri.with({fragment:O}):T.uri).toString());let V=p.getUriLabel(T.uri,{relative:!0});this._register(c.setupManagedHover(Ni("element"),e,V)),this.updateAppearance(),this._register(this.configurationService.onDidChangeConfiguration(U=>{U.affectsConfiguration("chat.inlineReferences.style")&&this.updateAppearance()})),this.data.kind!=="symbol"&&(e.draggable=!0,this._register(j(e,"dragstart",U=>{let G={resource:T.uri,selection:T.range};u.invokeFunction($=>Ig($,[G],U)),U.dataTransfer?.setDragImage(e,0,0)}))),this._register(j(e,"click",async U=>{$t.stop(U,!0);let $={override:Wuo(T.uri,this.configurationService)};T.range&&($.selection=T.range),await this.openerService.open(T.uri,{fromUserGesture:!0,editorOptions:$})}))}static{this.className="chat-inline-anchor-widget"}getHTMLElement(){return this.element}updateAppearance(){let t=this.configurationService.getValue("chat.inlineReferences.style")==="link";this.element.classList.toggle("link-style",t)}getCellIndex(e){let o=this.notebookDocumentService.getNotebook(e)?.getCellIndex(e)??-1;return o>=0?` ${o+1}`:""}};RB=I([m(3,B),m(4,X),m(5,ze),m(6,be),m(7,tt),m(8,F),m(9,ot),m(10,kt),m(11,qt),m(12,Ct),m(13,Te),m(14,De),m(15,Ij),m(16,Qe)],RB);W(class Vuo extends K{static{this.id="chat.inlineResourceAnchor.addFileToChat"}constructor(){super({id:Vuo.id,title:L(7115,"Add File to Chat"),menu:[{id:D.ChatInlineResourceAnchorContext,group:"chat",order:1,when:lu.negate()}]})}async run(i,e){let o=i.get(At).lastFocusedWidget;o&&o.attachmentModel.addFile(e)}});W(class Buo extends K{static{this.id="chat.inlineResourceAnchor.copyResource"}constructor(){super({id:Buo.id,title:L(7116,"Copy"),f1:!1,precondition:Get,keybinding:{weight:200,primary:2081}})}async run(i){let e=i.get(Av),t=i.get(Wi),o=e.lastFocusedAnchor;if(!o)return;let n=o.data.kind==="symbol"?o.data.symbol.location.uri:o.data.uri;t.writeResources([n])}});W(class Huo extends K{static{this.id="chat.inlineResourceAnchor.openToSide"}constructor(){super({id:Huo.id,title:L(7118,"Open to the Side"),f1:!1,precondition:Get,keybinding:{weight:402,primary:2051,mac:{primary:259}},menu:[D.ChatInlineSymbolAnchorContext,D.ChatInputSymbolAttachmentContext].map(i=>({id:i,group:"navigation",order:1}))})}async run(i,e){let t=i.get(ee),o=i.get(B),n=this.getTarget(i,e);if(!n)return;let r=A.isUri(n)?n:n.uri,s=Wuo(r,o),l=A.isUri(n)?{resource:n,options:{override:s}}:{resource:n.uri,options:{override:s,selection:{startColumn:n.range.startColumn,startLineNumber:n.range.startLineNumber}}};await t.openEditors([l],vn)}getTarget(i,e){let t=i.get(Av);if(e)return e;let o=t.lastFocusedAnchor;if(o)return o.data.kind==="symbol"?o.data.symbol.location:o.data.uri}});W(class Uuo extends K{static{this.id="chat.inlineSymbolAnchor.goToDefinition"}constructor(){super({id:Uuo.id,title:{...L(7117,"Go to Definition"),mnemonicTitle:d(7124,null)},menu:[D.ChatInlineSymbolAnchorContext,D.ChatInputSymbolAttachmentContext].map(i=>({id:i,group:"4_symbol_nav",order:1.1,when:ue.hasDefinitionProvider}))})}async run(i,e){let t=i.get(Kt),o=i.get(F);await zuo(t,e);let n=new NW({openToSide:!1,openInPeek:!1,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0});return o.invokeFunction(r=>n.run(r))}});async function zuo(a,i){await a.openCodeEditor({resource:i.uri,options:{selection:{startColumn:i.range.startColumn,startLineNumber:i.range.startLineNumber}}},null)}async function xxi(a,i,e){let t=a.get(Kt),o=a.get(ge);return await zuo(t,e),o.executeCommand(i)}W(class Kuo extends K{static{this.id="chat.inlineSymbolAnchor.goToTypeDefinitions"}constructor(){super({id:Kuo.id,title:{...L(7123,"Go to Type Definitions"),mnemonicTitle:d(7127,null)},menu:[D.ChatInlineSymbolAnchorContext,D.ChatInputSymbolAttachmentContext].map(i=>({id:i,group:"4_symbol_nav",order:1.1,when:ue.hasTypeDefinitionProvider}))})}async run(i,e){await xxi(i,"editor.action.goToTypeDefinition",e)}});W(class Guo extends K{static{this.id="chat.inlineSymbolAnchor.goToImplementations"}constructor(){super({id:Guo.id,title:{...L(7121,"Go to Implementations"),mnemonicTitle:d(7125,null)},menu:[D.ChatInlineSymbolAnchorContext,D.ChatInputSymbolAttachmentContext].map(i=>({id:i,group:"4_symbol_nav",order:1.2,when:ue.hasImplementationProvider}))})}async run(i,e){await xxi(i,"editor.action.goToImplementation",e)}});W(class $uo extends K{static{this.id="chat.inlineSymbolAnchor.goToReferences"}constructor(){super({id:$uo.id,title:{...L(7122,"Go to References"),mnemonicTitle:d(7126,null)},menu:[D.ChatInlineSymbolAnchorContext,D.ChatInputSymbolAttachmentContext].map(i=>({id:i,group:"4_symbol_nav",order:1.3,when:ue.hasReferenceProvider}))})}async run(i,e){await xxi(i,"editor.action.goToReferences",e)}});function quo(a,i){let e=new P;for(let t of a.querySelectorAll("table")){if(!Ao(t))continue;q6o(t);let o=t.parentElement,n=t.nextSibling,r=document.createElement("div");r.appendChild(t);let s=e.add(new Pa(r,{vertical:2,horizontal:1})),l=s.getDomNode();l.classList.add("rendered-markdown-table-scroll-wrapper"),o?.insertBefore(l,n),i.value.add(()=>{s.scanDomNode()}),s.scanDomNode()}return e}var $6o=3;function q6o(a){let i=a.rows,e=[];for(let o of i)for(let n=0;n<o.cells.length;n++){let r=o.cells[n].textContent?.length??0;r>(e[n]??0)&&(e[n]=r)}let t=i[0];if(t)for(let o=0;o<t.cells.length;o++){let n=e[o];n!==void 0&&n>1&&(t.cells[o].style.minWidth=Math.min(n,$6o)+"ch")}}var xme=class{static getSanitizerOptions(i){return{allowedTags:{override:[...i.allowedTags,...j6o]},allowedAttributes:{override:[...i.allowedAttributes,"stretchy","encoding","accent",ret,"d","viewBox","preserveAspectRatio","class",{attributeName:"style",shouldKeep:(e,t)=>this.sanitizeKatexStyles(t.attrValue)}]}}}static{this.tempSanitizerRule=new co(()=>{let i=new CSSStyleSheet;i.insertRule(".temp{}");let e=i.cssRules[0];if(!(e instanceof CSSStyleRule))throw new Error("Invalid CSS rule");return e.style})}static sanitizeStyles(i,e){let t=this.tempSanitizerRule.value;t.cssText=i;let o=[];for(let n=0;n<t.length;n++){let r=t[n];if(e.includes(r)){let s=t.getPropertyValue(r);/^(([\d\.\-]+\w*\s?)+|\w+)$/.test(s)&&o.push(`${r}: ${s}`)}}return o.join("; ")}static sanitizeKatexStyles(i){let e=["display","position","font-family","font-style","font-weight","font-size","height","min-height","max-height","width","min-width","max-width","margin","margin-top","margin-right","margin-bottom","margin-left","padding","padding-top","padding-right","padding-bottom","padding-left","top","left","right","bottom","vertical-align","transform","border","border-top-width","border-right-width","border-bottom-width","border-left-width","color","white-space","text-align","line-height","float","clear"];return this.sanitizeStyles(i,e)}static{this._katexPromise=new co(async()=>(this._katex=await bg("katex","dist/katex.min.js"),this._katex))}static getExtension(i,e={}){if(this._katex)return this.ensureKatexStyles(i),uBt.extension(this._katex,e)}static async loadExtension(i,e={}){let t=await this._katexPromise.value;return this.ensureKatexStyles(i),uBt.extension(t,e)}static ensureKatexStyles(i){let e=i.document;if(!e.querySelector("link.katex")){let t=document.createElement("link");t.classList.add("katex"),t.rel="stylesheet",t.href=H_t("katex","dist/katex.min.css"),e.head.appendChild(t)}}},j6o=Object.freeze(["semantics","annotation","math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts","svg","altglyph","altglyphdef","altglyphitem","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]);function juo(a){let i=a.split(`
`),e=[],t=[];for(let o of i)if(o.startsWith("- "))e.push(o.substring(2));else if(o.startsWith("-"))e.push(o.substring(1));else if(o.startsWith("+ "))t.push(o.substring(2));else if(o.startsWith("+"))t.push(o.substring(1));else if(o.startsWith(" ")){let n=o.substring(1);e.push(n),t.push(n)}else!o.startsWith("@@")&&!o.startsWith("---")&&!o.startsWith("+++")&&!o.startsWith("diff ")&&(e.push(o),t.push(o));return{before:e.join(`
`),after:t.join(`
`)}}var kxi=class extends gg{constructor(e,t){super();this._original=e;this._modified=t;this.original=this._original.object.textEditorModel,this.modified=this._modified.object.textEditorModel}dispose(){super.dispose(),this._original.dispose(),this._modified.dispose()}},kme=class extends C{constructor(e,t,o,n,r,s){super();this.modelService=n;this.textModelService=r;this.languageService=s;this.modelRef=this._register(new me);this.comparePart=this._register(t.get());let l=A.from({scheme:Y.vscodeChatCodeBlock,path:`/chat-diff-original-${e.codeBlockIndex}-${_t()}`}),c=A.from({scheme:Y.vscodeChatCodeBlock,path:`/chat-diff-modified-${e.codeBlockIndex}-${_t()}`}),u=this.languageService.createById(e.languageId);this._register(this.modelService.createModel(e.beforeContent,u,l,!1)),this._register(this.modelService.createModel(e.afterContent,u,c,!1));let p=Promise.all([this.textModelService.createModelReference(l),this.textModelService.createModelReference(c)]).then(([g,f])=>new kxi(g,f)),h={element:e.element,isReadOnly:e.isReadOnly,horizontalPadding:e.horizontalPadding,edit:{uri:e.codeBlockResource||c,edits:[],kind:"textEditGroup",done:!0},diffData:p.then(async g=>(this.modelRef.value=g,{original:g.original,modified:g.modified,originalSha1:await Q0(g.original.getValue())}))};this.comparePart.object.render(h,o,ve.None),this.element=this.comparePart.object.element}layout(e){this.comparePart.object.layout(e)}reset(){this.modelRef.clear()}};kme=I([m(3,Ct),m(4,Nt),m(5,kt)],kme);var QKu=J("agentStatusIndicator.background",{dark:Oe.white.transparent(.05),light:Oe.black.transparent(.05),hcDark:null,hcLight:null},d(8073,null)),YKu=J("chat.requestBorder",{dark:new Oe(new Bt(255,255,255,.1)),light:new Oe(new Bt(0,0,0,.1)),hcDark:gi,hcLight:gi},d(8080,null)),Quo=J("chat.requestBackground",{dark:ei(qo,.62),light:ei(qo,.62),hcDark:gm,hcLight:null},d(8079,null)),I3=J("chat.slashCommandBackground",{dark:"#26477866",light:"#adceff7a",hcDark:Oe.white,hcLight:rv},d(8084,null)),y3=J("chat.slashCommandForeground",{dark:"#85b6ff",light:"#26569e",hcDark:Oe.black,hcLight:Yw},d(8085,null)),XKu=J("chat.avatarBackground",{dark:"#1f1f1f",light:"#f2f2f2",hcDark:Oe.black,hcLight:Oe.white},d(8074,null)),JKu=J("chat.avatarForeground",ko,d(8075,null)),ZKu=J("chat.editedFileForeground",{light:"#895503",dark:"#E2C08D",hcDark:"#E2C08D",hcLight:"#895503"},d(8076,null)),e2u=J("chat.requestCodeBorder",{dark:"#004972B8",light:"#0e639c40",hcDark:null,hcLight:null},d(8083,null),!0),t2u=J("chat.requestBubbleBackground",{light:ei(sv,.3),dark:ei(sv,.3),hcDark:null,hcLight:null},d(8081,null),!0),i2u=J("chat.requestBubbleHoverBackground",{dark:ei(sv,.6),light:ei(sv,.6),hcDark:null,hcLight:null},d(8082,null),!0),o2u=J("chat.checkpointSeparator",{dark:"#585858",light:"#a9a9a9",hcDark:"#a9a9a9",hcLight:"#a5a5a5"},d(8087,null)),n2u=J("chat.linesAddedForeground",{dark:"#54B054",light:"#107C10",hcDark:"#54B054",hcLight:"#107C10"},d(8077,null),!0),r2u=J("chat.linesRemovedForeground",{dark:"#FC6A6A",light:"#BC2F32",hcDark:"#F48771",hcLight:"#B5200D"},d(8078,null),!0),s2u=J("chat.thinkingShimmer",{dark:"#ffffff",light:"#000000",hcDark:"#ffffff",hcLight:"#000000"},d(8086,null),!0);var Exi="http://_vscodedecoration_",wHt="http://_chatagent_",Yuo="http://_chatslash_";function Txi(a,i,e,t){let o=t.get(mz),n=t.get(br),r=o.getAgentNameRestriction(a),s=`${r?a.name:Hj(a)}`;r&&n.agentHasDupeName(a.id)&&(s+=` (${a.publisherDisplayName})`);let c={agentId:a.id,sessionResource:i,name:s,isClickable:e};return`[${a.name}](${wHt}?${encodeURIComponent(JSON.stringify(c))})`}function Xuo(a,i,e){let t=`${yu}${i.name}`,o={agentId:a.id,command:i.name,sessionResource:e};return`[${t}](${Yuo}?${encodeURIComponent(JSON.stringify(o))})`}var Oee=class{constructor(i,e,t,o,n,r,s,l,c,u,p){this.keybindingService=i;this.logService=e;this.chatAgentService=t;this.instantiationService=o;this.hoverService=n;this.chatService=r;this.chatWidgetService=s;this.commandService=l;this.labelService=c;this.toolsService=u;this.chatMarkdownAnchorService=p}convertParsedRequestToMarkdown(i,e){let t="";for(let o of e.parts)o instanceof pb?t+=o.text:o instanceof zu?t+=this.instantiationService.invokeFunction(n=>Txi(o.agent,i,!1,n)):t+=this.genericDecorationToMarkdown(o);return t}genericDecorationToMarkdown(i){let e=i instanceof tR&&i.data instanceof A?i.data:void 0,o={title:e?this.labelService.getUriLabel(e,{relative:!0}):i instanceof jx?i.slashCommand.detail:i instanceof Pf?i.command.description:i instanceof Qx?i.name:i instanceof ZS?this.toolsService.getTool(i.toolId)?.userDescription:""};return`[${i.text}](${Exi}?${encodeURIComponent(JSON.stringify(o))})`}walkTreeAndAnnotateReferenceLinks(i,e){let t=new P;return e.querySelectorAll("a").forEach(o=>{let n=o.getAttribute("data-href");if(n)if(n.startsWith(wHt)){let r;try{r=JSON.parse(decodeURIComponent(n.slice(wHt.length+1)))}catch(s){this.logService.error("Invalid chat widget render data JSON",In(s))}r&&o.replaceWith(this.renderAgentWidget(r,t))}else if(n.startsWith(Yuo)){let r;try{r=JSON.parse(decodeURIComponent(n.slice(wHt.length+1)))}catch(s){this.logService.error("Invalid chat slash command render data JSON",In(s))}r&&o.replaceWith(this.renderSlashCommandWidget(o.textContent,r,t))}else if(n.startsWith(Exi)){let r;try{r=JSON.parse(decodeURIComponent(n.slice(Exi.length+1)))}catch{}o.replaceWith(this.renderResourceWidget(o.textContent,r,t))}else n.startsWith(_Bt)?this.renderFileWidget(i,n,o,t):n.startsWith("command:")&&this.injectKeybindingHint(o,n,this.keybindingService)}),t}renderAgentWidget(i,e){let t=`${vg}${i.name}`,o;if(i.isClickable){o=_("span.chat-agent-widget");let s=e.add(new Mi(o,{buttonBackground:wt(I3),buttonForeground:wt(y3),buttonHoverBackground:void 0}));s.label=t,e.add(s.onDidClick(()=>{let l=this.chatAgentService.getAgent(i.agentId),c=this.chatWidgetService.getWidgetBySessionResource(i.sessionResource)||this.chatWidgetService.lastFocusedWidget;!c||!l||this.chatService.sendRequest(c.viewModel.sessionResource,l.metadata.sampleRequest??"",{location:c.location,agentId:l.id,userSelectedModelId:c.input.currentLanguageModel,modeInfo:c.input.currentModeInfo})}))}else o=this.renderResourceWidget(t,void 0,e);let n=this.chatAgentService.getAgent(i.agentId),r=new co(()=>e.add(this.instantiationService.createInstance(l2)));return e.add(this.hoverService.setupManagedHover(Ni("element"),o,()=>(r.value.setAgent(i.agentId),r.value.domNode),n&&KMe(()=>n,this.commandService))),o}renderSlashCommandWidget(i,e,t){let o=_("span.chat-agent-widget.chat-command-widget"),n=this.chatAgentService.getAgent(e.agentId),r=t.add(new Mi(o,{buttonBackground:wt(I3),buttonForeground:wt(y3),buttonHoverBackground:void 0}));return r.label=i,t.add(r.onDidClick(()=>{let s=this.chatWidgetService.getWidgetBySessionResource(e.sessionResource)||this.chatWidgetService.lastFocusedWidget;if(!s||!n)return;let l=n.slashCommands.find(c=>c.name===e.command);this.chatService.sendRequest(s.viewModel.sessionResource,l?.sampleRequest??"",{location:s.location,agentId:n.id,slashCommand:e.command,userSelectedModelId:s.input.currentLanguageModel,modeInfo:s.input.currentModeInfo})})),o}renderFileWidget(i,e,t,o){let n=A.parse(e),r=i.inlineReferences?.[n.path.slice(1)];if(!r){this.logService.error("Invalid chat widget render data JSON");return}let s=o.add(this.instantiationService.createInstance(RB,t,r,void 0));o.add(this.chatMarkdownAnchorService.register(s))}renderResourceWidget(i,e,t){let o=_("span.chat-resource-widget"),n=_("span",void 0,i);return e?.title&&t.add(this.hoverService.setupManagedHover(Ni("element"),o,e.title)),o.appendChild(n),o}injectKeybindingHint(i,e,t){let o=e.match(/command:([^\)]+)/)?.[1];o&&(i.textContent=t.appendKeybinding(i.textContent||"",o))}};Oee=I([m(0,_e),m(1,ne),m(2,br),m(3,F),m(4,tt),m(5,Si),m(6,At),m(7,ge),m(8,ot),m(9,jn),m(10,Av)],Oee);function CHt(a,i,e=!0){for(let t=i.length-1;t>=0;t--){let o=i.slice(0,t),n=i[t],r=Q6o(a,n,o,e);if(r)return r}return null}function Q6o(a,i,e,t){let o=null;for(let n=a.tokenColors.length-1;n>=0;n--){let r=a.tokenColors[n];if(t&&!r.settings.foreground)continue;let s;if(typeof r.scope=="string")s=r.scope.split(/,/).map(l=>l.trim());else if(Array.isArray(r.scope))s=r.scope;else continue;for(let l=0,c=s.length;l<c;l++){let u=s[l],p=new _xi(u,r.settings);p.matches(i,e)&&p.isMoreSpecific(o)&&(o=p)}}return o}var _xi=class a{constructor(i,e){this.rawSelector=i,this.settings=e;let t=this.rawSelector.split(/ /);this.scope=t[t.length-1],this.parentScopes=t.slice(0,t.length-1)}matches(i,e){return a._matches(this.scope,this.parentScopes,i,e)}static _cmp(i,e){if(i===null&&e===null)return 0;if(i===null)return-1;if(e===null)return 1;if(i.scope.length!==e.scope.length)return i.scope.length-e.scope.length;let t=i.parentScopes.length,o=e.parentScopes.length;if(t!==o)return t-o;for(let n=0;n<t;n++){let r=i.parentScopes[n].length,s=e.parentScopes[n].length;if(r!==s)return r-s}return 0}isMoreSpecific(i){return a._cmp(this,i)>0}static _matchesOne(i,e){let t=i+".";return i===e||e.substring(0,t.length)===t}static _matches(i,e,t,o){if(!this._matchesOne(i,t))return!1;let n=e.length-1,r=o.length-1;for(;n>=0&&r>=0;)this._matchesOne(e[n],o[r])&&n--,r--;return n===-1}};var Kr=_,t0=class extends C{static{this.ID="editor.contrib.inspectEditorTokens"}static get(i){return i.getContribution(t0.ID)}constructor(i,e,t,o,n,r,s){super(),this._editor=i,this._textMateService=e,this._themeService=o,this._languageService=t,this._notificationService=n,this._configurationService=r,this._languageFeaturesService=s,this._widget=null,this._register(this._editor.onDidChangeModel(l=>this.stop())),this._register(this._editor.onDidChangeModelLanguage(l=>this.stop())),this._register(this._editor.onKeyUp(l=>l.keyCode===9&&this.stop()))}dispose(){this.stop(),super.dispose()}launch(){this._widget||this._editor.hasModel()&&this._editor.getModel().uri.scheme!==Y.vscodeNotebookCell&&(this._widget=new Lxi(this._editor,this._textMateService,this._languageService,this._themeService,this._notificationService,this._configurationService,this._languageFeaturesService))}stop(){this._widget&&(this._widget.dispose(),this._widget=null)}toggle(){this._widget?this.stop():this.launch()}};t0=I([m(1,f4),m(2,kt),m(3,Gp),m(4,Ne),m(5,B),m(6,zt)],t0);var Dxi=class extends xi{constructor(){super({id:"editor.action.inspectTMScopes",label:L(8307,"Developer: Inspect Editor Tokens and Scopes"),precondition:void 0})}run(i,e){t0.get(e)?.toggle()}};function Juo(a){a.length>40&&(a=a.substr(0,20)+"\u2026"+a.substr(a.length-20));let i="";for(let e=0,t=a.length;e<t;e++){let o=a.charCodeAt(e);switch(o){case 9:i+="\u2192";break;case 32:i+="\xB7";break;default:i+=String.fromCharCode(o)}}return i}var Lxi=class a extends C{constructor(e,t,o,n,r,s,l){super();this.allowEditorOverflow=!0;this._isDisposed=!1,this._editor=e,this._languageService=o,this._themeService=n,this._textMateService=t,this._notificationService=r,this._configurationService=s,this._languageFeaturesService=l,this._model=this._editor.getModel(),this._domNode=document.createElement("div"),this._domNode.className="token-inspect-widget",this._currentRequestCancellationTokenSource=new $e,this._beginCompute(this._editor.getPosition()),this._register(this._editor.onDidChangeCursorPosition(c=>this._beginCompute(this._editor.getPosition()))),this._register(n.onDidColorThemeChange(c=>this._beginCompute(this._editor.getPosition()))),this._register(s.onDidChangeConfiguration(c=>c.affectsConfiguration("editor.semanticHighlighting.enabled")&&this._beginCompute(this._editor.getPosition()))),this._editor.addContentWidget(this)}static{this._ID="editor.contrib.inspectEditorTokensWidget"}dispose(){this._isDisposed=!0,this._editor.removeContentWidget(this),this._currentRequestCancellationTokenSource.cancel(),super.dispose()}getId(){return a._ID}_beginCompute(e){let t=this._textMateService.createTokenizer(this._model.getLanguageId()),o=this._computeSemanticTokens(e),n=this._model.tokenization.tokens.get(),r=n instanceof i1?n:void 0;Rt(this._domNode),this._domNode.appendChild(document.createTextNode(d(8308,null))),Promise.all([t,o]).then(([s,l])=>{if(this._isDisposed)return;let c=r?.tree.get();this._compute(s,l,c,e),this._domNode.style.maxWidth=`${Math.max(this._editor.getLayoutInfo().width*.66,500)}px`,this._editor.layoutContentWidget(this)},s=>{this._notificationService.warn(s),setTimeout(()=>{t0.get(this._editor)?.stop()})})}_isSemanticColoringEnabled(){let e=this._configurationService.getValue(Nle,{overrideIdentifier:this._model.getLanguageId(),resource:this._model.uri})?.enabled;return typeof e=="boolean"?e:this._themeService.getColorTheme().semanticHighlighting}_compute(e,t,o,n){let r=e&&this._getTokensAtPosition(e,n),s=t&&this._getSemanticTokenAtPosition(t,n),l=o&&this._getTreeSitterTokenAtPosition(o,n);if(!r&&!s&&!l){Fi(this._domNode,"No grammar or semantic tokens available.");return}let c=r?.metadata,u=s?.metadata,p=s&&Juo(this._model.getValueInRange(s.range)),h=r&&Juo(this._model.getLineContent(n.lineNumber).substring(r.token.startIndex,r.token.endIndex)),g=s&&this._model.getValueLengthInRange(s.range),f=r&&r.token.endIndex-r.token.startIndex,v=p||h||"",b=g||f||0;if(Fi(this._domNode,Kr("h2.tiw-token",void 0,v,Kr("span.tiw-token-length",void 0,`${b} ${b===1?"char":"chars"}`))),R(this._domNode,Kr("hr.tiw-metadata-separator",{style:"clear:both"})),R(this._domNode,Kr("table.tiw-metadata-table",void 0,Kr("tbody",void 0,Kr("tr",void 0,Kr("td.tiw-metadata-key",void 0,"language"),Kr("td.tiw-metadata-value",void 0,c?.languageId||"")),Kr("tr",void 0,Kr("td.tiw-metadata-key",void 0,"standard token type"),Kr("td.tiw-metadata-value",void 0,this._tokenTypeToString(c?.tokenType||0))),...this._formatMetadata(u,c)))),s){R(this._domNode,Kr("hr.tiw-metadata-separator"));let S=R(this._domNode,Kr("table.tiw-metadata-table",void 0)),y=R(S,Kr("tbody",void 0,Kr("tr",void 0,Kr("td.tiw-metadata-key",void 0,"semantic token type"),Kr("td.tiw-metadata-value",void 0,s.type))));if(s.modifiers.length&&R(y,Kr("tr",void 0,Kr("td.tiw-metadata-key",void 0,"modifiers"),Kr("td.tiw-metadata-value",void 0,s.modifiers.join(" ")))),s.metadata){let w=["foreground","bold","italic","underline","strikethrough"],k={},T=new Array;for(let N of w)if(s.metadata[N]!==void 0){let O=s.definitions[N],V=this._renderTokenStyleDefinition(O,N),U=V.map($=>Ao($)?$.outerHTML:$).join(),G=k[U];G||(k[U]=G=[],T.push([V,U])),G.push(N)}for(let[N,O]of T)R(y,Kr("tr",void 0,Kr("td.tiw-metadata-key",void 0,k[O].join(", ")),Kr("td.tiw-metadata-value",void 0,...N)))}}if(r){let S=this._themeService.getColorTheme();R(this._domNode,Kr("hr.tiw-metadata-separator"));let y=R(this._domNode,Kr("table.tiw-metadata-table")),w=R(y,Kr("tbody"));h&&h!==v&&R(w,Kr("tr",void 0,Kr("td.tiw-metadata-key",void 0,"textmate token"),Kr("td.tiw-metadata-value",void 0,`${h} (${h.length})`)));let k=new Array;for(let O=r.token.scopes.length-1;O>=0;O--)k.push(r.token.scopes[O]),O>0&&k.push(Kr("br"));R(w,Kr("tr",void 0,Kr("td.tiw-metadata-key",void 0,"textmate scopes"),Kr("td.tiw-metadata-value.tiw-metadata-scopes",void 0,...k)));let T=CHt(S,r.token.scopes,!1),N=s?.metadata?.foreground;if(T){if(N!==r.metadata.foreground){let O=Kr("code.tiw-theme-selector",void 0,T.rawSelector,Kr("br"),JSON.stringify(T.settings,null," "));N&&(O=Kr("s",void 0,O)),R(w,Kr("tr",void 0,Kr("td.tiw-metadata-key",void 0,"foreground"),Kr("td.tiw-metadata-value",void 0,O)))}}else N||R(w,Kr("tr",void 0,Kr("td.tiw-metadata-key",void 0,"foreground"),Kr("td.tiw-metadata-value",void 0,"No theme selector")))}if(l){let S=l[l.length-1];R(this._domNode,Kr("hr.tiw-metadata-separator"));let y=R(this._domNode,Kr("table.tiw-metadata-table")),w=R(y,Kr("tbody"));R(w,Kr("tr",void 0,Kr("td.tiw-metadata-key",void 0,`tree-sitter token ${S.id}`),Kr("td.tiw-metadata-value",void 0,`${S.text}`)));let k=new Array,T=l.length-1,N=l[T];for(;N.parent||T>0;)k.push(N.type),N=N.parent??l[--T],N&&k.push(Kr("br"));R(w,Kr("tr",void 0,Kr("td.tiw-metadata-key",void 0,"tree-sitter tree"),Kr("td.tiw-metadata-value.tiw-metadata-scopes",void 0,...k)));let V=this._model.tokenization.tokens.get().tokenizationImpl.get()?.captureAtPosition(n.lineNumber,n.column);V&&V.length>0&&R(w,Kr("tr",void 0,Kr("td.tiw-metadata-key",void 0,"foreground"),Kr("td.tiw-metadata-value",void 0,V.map(U=>U.name).join(" "))))}}_formatMetadata(e,t){let o=new Array;function n(u){let p=e?.[u]||t?.[u];if(p!==void 0){let h=e?.[u]?"tiw-metadata-semantic":"";o.push(Kr("tr",void 0,Kr("td.tiw-metadata-key",void 0,u),Kr(`td.tiw-metadata-value.${h}`,void 0,p)))}return p}let r=n("foreground"),s=n("background");if(r&&s){let u=Oe.fromHex(s),p=Oe.fromHex(r);u.isOpaque()?o.push(Kr("tr",void 0,Kr("td.tiw-metadata-key",void 0,"contrast ratio"),Kr("td.tiw-metadata-value",void 0,u.getContrastRatio(p.makeOpaque(u)).toFixed(2)))):o.push(Kr("tr",void 0,Kr("td.tiw-metadata-key",void 0,"Contrast ratio cannot be precise for background colors that use transparency"),Kr("td.tiw-metadata-value")))}let l=new Array;function c(u){let p;e&&e[u]?p=Kr("span.tiw-metadata-semantic",void 0,u):t&&t[u]&&(p=u),p&&(l.length&&l.push(" "),l.push(p))}return c("bold"),c("italic"),c("underline"),c("strikethrough"),l.length&&o.push(Kr("tr",void 0,Kr("td.tiw-metadata-key",void 0,"font style"),Kr("td.tiw-metadata-value",void 0,...l))),o}_decodeMetadata(e){let t=this._themeService.getColorTheme().tokenColorMap,o=Qu.getLanguageId(e),n=Qu.getTokenType(e),r=Qu.getFontStyle(e),s=Qu.getForeground(e),l=Qu.getBackground(e);return{languageId:this._languageService.languageIdCodec.decodeLanguageId(o),tokenType:n,bold:r&2?!0:void 0,italic:r&1?!0:void 0,underline:r&4?!0:void 0,strikethrough:r&8?!0:void 0,foreground:t[s],background:t[l]}}_tokenTypeToString(e){switch(e){case 0:return"Other";case 1:return"Comment";case 2:return"String";case 3:return"RegEx";default:return"??"}}_getTokensAtPosition(e,t){let o=t.lineNumber,n=this._getStateBeforeLine(e,o),r=e.tokenizeLine(this._model.getLineContent(o),n),s=e.tokenizeLine2(this._model.getLineContent(o),n),l=0;for(let u=r.tokens.length-1;u>=0;u--){let p=r.tokens[u];if(t.column-1>=p.startIndex){l=u;break}}let c=0;for(let u=s.tokens.length>>>1;u>=0;u--)if(t.column-1>=s.tokens[u<<1]){c=u;break}return{token:r.tokens[l],metadata:this._decodeMetadata(s.tokens[(c<<1)+1])}}_getStateBeforeLine(e,t){let o=null;for(let n=1;n<t;n++)o=e.tokenizeLine(this._model.getLineContent(n),o).ruleStack;return o}isSemanticTokens(e){return e&&e.data}async _computeSemanticTokens(e){if(!this._isSemanticColoringEnabled())return null;let t=this._languageFeaturesService.documentSemanticTokensProvider.ordered(this._model);if(t.length){let n=t[0],r=await Promise.resolve(n.provideDocumentSemanticTokens(this._model,null,this._currentRequestCancellationTokenSource.token));if(this.isSemanticTokens(r))return{tokens:r,legend:n.getLegend()}}let o=this._languageFeaturesService.documentRangeSemanticTokensProvider.ordered(this._model);if(o.length){let n=o[0],r=e.lineNumber,s=new z(r,1,r,this._model.getLineMaxColumn(r)),l=await Promise.resolve(n.provideDocumentRangeSemanticTokens(this._model,s,this._currentRequestCancellationTokenSource.token));if(this.isSemanticTokens(l))return{tokens:l,legend:n.getLegend()}}return null}_getSemanticTokenAtPosition(e,t){let o=e.tokens.data,n=this._model.getLanguageId(),r=0,s=0,l=t.lineNumber-1,c=t.column-1;for(let u=0;u<o.length;u+=5){let p=o[u],h=o[u+1],g=o[u+2],f=o[u+3],v=o[u+4],b=r+p,S=p===0?s+h:h;if(l===b&&S<=c&&c<S+g){let y=e.legend.tokenTypes[f]||"not in legend (ignored)",w=[],k=v;for(let $=0;k>0&&$<e.legend.tokenModifiers.length;$++)k&1&&w.push(e.legend.tokenModifiers[$]),k=k>>1;k>0&&w.push("not in legend (ignored)");let T=new z(b+1,S+1,b+1,S+1+g),N={},O=this._themeService.getColorTheme().tokenColorMap,U=this._themeService.getColorTheme().getTokenStyleMetadata(y,w,n,!0,N),G;return U&&(G={languageId:void 0,tokenType:0,bold:U?.bold,italic:U?.italic,underline:U?.underline,strikethrough:U?.strikethrough,foreground:O[U?.foreground||0],background:void 0}),{type:y,modifiers:w,range:T,metadata:G,definitions:N}}r=b,s=S}return null}_walkTreeforPosition(e,t){let o=this._model.getOffsetAt(t);e.gotoFirstChild();let n=!1,r=null;do e.currentNode.startIndex<=o&&o<e.currentNode.endIndex?(n=!0,r=e.currentNode):n=!1;while(n?e.gotoFirstChild():e.gotoNextSibling());return r}_getTreeSitterTokenAtPosition(e,t){let o=[],n=e?.tree.get();for(;n;){let r=n.walk(),s=this._walkTreeforPosition(r,t);r.delete(),s?(o.push(s),e=e?.getInjectionTrees(s.startIndex,e.languageId),n=e?.tree.get()):n=void 0}return o.length>0?o:null}_renderTokenStyleDefinition(e,t){let o=new Array;if(e===void 0)return o;let n=this._themeService.getColorTheme();if(Array.isArray(e)){let r={};n.resolveScopes(e,r);let s=r[t];if(s&&r.scope){let l=Kr("ul.tiw-metadata-values"),c=Array.isArray(s.scope)?s.scope:[String(s.scope)];for(let u of c)l.appendChild(Kr("li.tiw-metadata-value.tiw-metadata-scopes",void 0,u));return o.push(r.scope.join(" "),l,Kr("code.tiw-theme-selector",void 0,JSON.stringify(s.settings,null," "))),o}return o}else if(rxe.is(e)){let r=n.getTokenStylingRuleScope(e);return r==="setting"?(o.push(`User settings: ${e.selector.id} - ${this._renderStyleProperty(e.style,t)}`),o):(r==="theme"&&o.push(`Color theme: ${e.selector.id} - ${this._renderStyleProperty(e.style,t)}`),o)}else{let r=n.resolveTokenStyleValue(e);return o.push(`Default: ${r?this._renderStyleProperty(r,t):""}`),o}}_renderStyleProperty(e,t){return t==="foreground"?e.foreground?Oe.Format.CSS.formatHexA(e.foreground,!0):"":e[t]!==void 0?String(e[t]):""}getDomNode(){return this._domNode}getPosition(){return{position:this._editor.getPosition(),preference:[2,1]}}};go(t0.ID,t0,4);Jt(Dxi);var i0=_,Zuo="vscode-local-file";function epo(a){let i;try{i=JSON.parse(a)}catch{throw new Error("Could not parse code block local file data")}let e;try{e=A.revive(i?.uri)}catch{throw new Error("Invalid code block local file data URI")}let t;return i.range&&(t=new z(i.range.startLineNumber+1,i.range.startColumn+1,i.range.endLineNumber+1,i.range.endColumn+1)),{uri:e,range:t}}var hPe=10,w3=class extends C{constructor(e,t,o,n,r=!1,s,l,c,u,p){super();this.editorOptions=e;this.menuId=t;this.isSimpleWidget=r;this.modelService=c;this.configurationService=u;this.accessibilityService=p;this.currentScrollWidth=0;this.isDisposed=!1;this.element=i0(".interactive-result-code-block"),this.resourceContextKey=s.createInstance(CY),this.contextKeyService=this._register(l.createScoped(this.element));let h=this._register(s.createChild(new Io([X,this.contextKeyService]))),g=R(this.element,i0(".interactive-result-editor"));this.editor=this.createEditor(h,g,{...Kf(this.configurationService),readOnly:!0,lineNumbers:"off",selectOnLineNumbers:!0,scrollBeyondLastLine:!1,lineDecorationsWidth:8,dragAndDrop:!1,padding:{top:this.verticalPadding,bottom:this.verticalPadding},mouseWheelZoom:!1,scrollbar:{vertical:"hidden",alwaysConsumeMouseWheel:!1},definitionLinkOpensInPeek:!1,gotoLocation:{multiple:"goto",multipleDeclarations:"goto",multipleDefinitions:"goto",multipleImplementations:"goto"},ariaLabel:d(7250,null),overflowWidgetsDomNode:n,tabFocusMode:!0,...this.getEditorOptionsFromConfig()});let f=R(this.element,i0(".interactive-result-code-block-toolbar")),v=this._register(this.editor.contextKeyService.createScoped(f)),b=this._register(h.createChild(new Io([X,v])));this.toolbar=this._register(b.createInstance(Ln,f,t,{menuOptions:{shouldForwardArgs:!0}}));let S=R(this.element,i0(".interactive-result-vulns")),y=R(S,i0(".interactive-result-vulns-header",void 0));this.vulnsButton=this._register(new Mi(y,{buttonBackground:void 0,buttonBorder:void 0,buttonForeground:void 0,buttonHoverBackground:void 0,buttonSecondaryBackground:void 0,buttonSecondaryForeground:void 0,buttonSecondaryHoverBackground:void 0,buttonSeparator:void 0,supportIcons:!0})),this.vulnsListElement=R(S,i0("ul.interactive-result-vulns-list")),this._register(this.vulnsButton.onDidClick(()=>{let w=this.currentCodeBlockData.element;w.vulnerabilitiesListExpanded=!w.vulnerabilitiesListExpanded,this.vulnsButton.label=this.getVulnerabilitiesLabel(),this.element.classList.toggle("chat-vulnerabilities-collapsed",!w.vulnerabilitiesListExpanded),this.layout()})),this._register(this.toolbar.onDidChangeDropdownVisibility(w=>{f.classList.toggle("force-visibility",w)})),this._configureForScreenReader(),this._register(this.accessibilityService.onDidChangeScreenReaderOptimized(()=>this._configureForScreenReader())),this._register(this.configurationService.onDidChangeConfiguration(w=>{w.affectedKeys.has("accessibility.verbosity.panelChat")&&this._configureForScreenReader()})),this._register(this.editorOptions.onDidChange(()=>{this.editor.updateOptions(this.getEditorOptionsFromConfig())})),this._register(this.editor.onDidScrollChange(w=>{this.currentScrollWidth=w.scrollWidth})),this._register(this.editor.onDidContentSizeChange(w=>{w.contentHeightChanged&&this.layout()})),this._register(this.editor.onDidBlurEditorWidget(()=>{this.element.classList.remove("focused"),Xb.get(this.editor)?.stopHighlighting(),this.clearWidgets()})),this._register(this.editor.onDidFocusEditorWidget(()=>{this.element.classList.add("focused"),Xb.get(this.editor)?.restoreViewState(!0)})),this._register(H.any(this.editor.onDidChangeModel,this.editor.onDidChangeModelContent)(()=>{this.currentCodeBlockData&&this.updateContexts(this.currentCodeBlockData)})),o.onDidScroll&&this._register(o.onDidScroll(w=>{this.clearWidgets()}))}get verticalPadding(){return this.currentCodeBlockData?.renderOptions?.verticalPadding??hPe}dispose(){this.isDisposed=!0,super.dispose()}get uri(){return this.editor.getModel()?.uri}createEditor(e,t,o){return this._register(e.createInstance(jr,t,o,{isSimpleWidget:this.isSimpleWidget,contributions:aa.getSomeEditorContributions([ry.ID,ly,Hm.ID,Xb.ID,$W.ID,I1.ID,wO.ID,kl.ID,Yg.ID,iu.ID,S_.ID,El.ID,Qr.ID,Xy.ID,Fx.ID,t0.ID])}))}focus(){this.editor.focus()}updatePaddingForLayout(){let e=this.currentScrollWidth>this.editor.getLayoutInfo().contentWidth,t=this.editor.getLayoutInfo().horizontalScrollbarHeight,o=e?Math.max(this.verticalPadding-t,2):this.verticalPadding;this.editor.updateOptions({padding:{top:this.verticalPadding,bottom:o}})}_configureForScreenReader(){let e=this.toolbar.getElement();this.accessibilityService.isScreenReaderOptimized()?e.style.display="block":e.style.display=""}getEditorOptionsFromConfig(){return{wordWrap:this.editorOptions.configuration.resultEditor.wordWrap,fontLigatures:this.editorOptions.configuration.resultEditor.fontLigatures,bracketPairColorization:this.editorOptions.configuration.resultEditor.bracketPairColorization,fontFamily:this.editorOptions.configuration.resultEditor.fontFamily==="default"?Yd.fontFamily:this.editorOptions.configuration.resultEditor.fontFamily,fontSize:this.editorOptions.configuration.resultEditor.fontSize,fontWeight:this.editorOptions.configuration.resultEditor.fontWeight,lineHeight:this.editorOptions.configuration.resultEditor.lineHeight,...this.currentCodeBlockData?.renderOptions?.editorOptions}}layout(e=this.lastLayoutWidth){if(e===void 0)return;this.lastLayoutWidth=e;let t=this.getContentHeight(),o=t;this.currentCodeBlockData?.renderOptions?.maxHeightInLines&&(o=Math.min(t,this.editor.getOption(75)*this.currentCodeBlockData?.renderOptions?.maxHeightInLines)),e=e-2-(this.currentCodeBlockData?.renderOptions?.reserveWidth??0),this.editor.layout({width:Rr(this.currentCodeBlockData?.element)?e*.9:e,height:o},!0),this.updatePaddingForLayout()}getContentHeight(){if(this.currentCodeBlockData?.range){let e=this.currentCodeBlockData.range.endLineNumber-this.currentCodeBlockData.range.startLineNumber+1,t=this.editor.getOption(75);return e*t+2*this.verticalPadding}return this.editor.getContentHeight()}async render(e,t){this.currentCodeBlockData=e,e.parentContextKeyService&&this.contextKeyService.updateParent(e.parentContextKeyService),this.getEditorOptionsFromConfig().wordWrap==="on"&&this.layout(t),!(!await this.updateEditor(e)||this.isDisposed||this.currentCodeBlockData!==e)&&(this.editor.updateOptions({...this.getEditorOptionsFromConfig()}),this.editor.getOption(8)||this.editor.updateOptions({ariaLabel:d(7251,null,e.codeBlockIndex+1)}),this.layout(t),this.toolbar.setAriaLabel(d(7252,null,e.codeBlockIndex+1)),e.renderOptions?.hideToolbar?xo(this.toolbar.getElement()):bn(this.toolbar.getElement()),e.vulns?.length&&Vi(e.element)?(Rt(this.vulnsListElement),this.element.classList.remove("no-vulns"),this.element.classList.toggle("chat-vulnerabilities-collapsed",!e.element.vulnerabilitiesListExpanded),R(this.vulnsListElement,...e.vulns.map(n=>i0("li",void 0,i0("span.chat-vuln-title",void 0,n.title)," "+n.description))),this.vulnsButton.label=this.getVulnerabilitiesLabel()):this.element.classList.add("no-vulns"),this.layout())}reset(){this.clearWidgets(),this.currentCodeBlockData=void 0}onDidRemount(){this.currentCodeBlockData&&this.editor.renderAsync(!0)}clearWidgets(){kl.get(this.editor)?.hideContentHover(),Yg.get(this.editor)?.hideGlyphHover()}async updateEditor(e){let t=await e.textModel;return this.isDisposed||this.currentCodeBlockData!==e||!t||t.isDisposed()?!1:(this.editor.setModel(t),e.range&&(this.editor.setSelection(e.range),this.editor.revealRangeInCenter(e.range,1)),this.updateContexts(e),!0)}getVulnerabilitiesLabel(){return!this.currentCodeBlockData||!this.currentCodeBlockData.vulns?"":`${this.currentCodeBlockData.vulns.length>1?d(7261,null,this.currentCodeBlockData.vulns.length):d(7262,null,1)} $(${(o=>o.vulnerabilitiesListExpanded?M.chevronDown:M.chevronRight)(this.currentCodeBlockData.element).id})`}updateContexts(e){let t=this.editor.getModel();t&&(this.toolbar.context={code:t.getTextBuffer().getValueInRange(e.range??t.getFullModelRange(),0),codeBlockIndex:e.codeBlockIndex,element:e.element,languageId:t.getLanguageId(),codemapperUri:e.codemapperUri,chatSessionResource:e.chatSessionResource},this.resourceContextKey.set(t.uri))}};w3=I([m(5,F),m(6,X),m(7,Ct),m(8,B),m(9,Bi)],w3);var gPe=class extends C{constructor(e,t){super();this._modelService=t;this._register(e.registerTextModelContentProvider(Y.vscodeChatCodeBlock,this))}async provideTextContent(e){let t=this._modelService.getModel(e);return t||this._modelService.createModel("",null,e)}};gPe=I([m(0,Nt),m(1,Ct)],gPe);var fPe=class extends C{constructor(e,t,o,n,r=!1,s,l,c,u,p,h,g){super();this.options=e;this.menuId=t;this.isSimpleWidget=r;this.modelService=c;this.configurationService=u;this.accessibilityService=p;this.labelService=h;this.openerService=g;this._lastDiffEditorViewModel=this._store.add(new me);this.currentScrollWidth=0;this.currentHorizontalPadding=0;this.element=i0(".interactive-result-code-block"),this.element.classList.add("compare"),this.messageElement=R(this.element,i0(".message")),this.messageElement.setAttribute("role","status"),this.messageElement.tabIndex=0,this.contextKeyService=this._register(l.createScoped(this.element));let f=this._register(s.createChild(new Io([X,this.contextKeyService],[rd,new class{show(w,k){return zbt}async showWhile(w,k){await w}}]))),v=this.editorHeader=R(this.element,i0(".interactive-result-header.show-file-icons")),b=R(this.element,i0(".interactive-result-editor"));this.diffEditor=this.createDiffEditor(f,b,{...Kf(this.configurationService),lineNumbers:"on",selectOnLineNumbers:!0,scrollBeyondLastLine:!1,lineDecorationsWidth:12,dragAndDrop:!1,padding:{top:hPe,bottom:hPe},mouseWheelZoom:!1,scrollbar:{vertical:"hidden",alwaysConsumeMouseWheel:!1},definitionLinkOpensInPeek:!1,gotoLocation:{multiple:"goto",multipleDeclarations:"goto",multipleDefinitions:"goto",multipleImplementations:"goto"},ariaLabel:d(7250,null),overflowWidgetsDomNode:n,...this.getEditorOptionsFromConfig()}),this.resourceLabel=this._register(f.createInstance(rk,v,{supportIcons:!0}));let S=this._register(this.diffEditor.getModifiedEditor().contextKeyService.createScoped(v)),y=this._register(f.createChild(new Io([X,S])));this.toolbar=this._register(y.createInstance(Ln,v,t,{menuOptions:{shouldForwardArgs:!0}})),this._configureForScreenReader(),this._register(this.accessibilityService.onDidChangeScreenReaderOptimized(()=>this._configureForScreenReader())),this._register(this.configurationService.onDidChangeConfiguration(w=>{w.affectedKeys.has("accessibility.verbosity.panelChat")&&this._configureForScreenReader()})),this._register(this.options.onDidChange(()=>{this.diffEditor.updateOptions(this.getEditorOptionsFromConfig())})),this._register(this.diffEditor.getModifiedEditor().onDidScrollChange(w=>{this.currentScrollWidth=w.scrollWidth})),this._register(this.diffEditor.getModifiedEditor().onDidBlurEditorWidget(()=>{this.element.classList.remove("focused"),Xb.get(this.diffEditor.getModifiedEditor())?.stopHighlighting(),this.clearWidgets()})),this._register(this.diffEditor.getModifiedEditor().onDidFocusEditorWidget(()=>{this.element.classList.add("focused"),Xb.get(this.diffEditor.getModifiedEditor())?.restoreViewState(!0)})),o.onDidScroll&&this._register(o.onDidScroll(w=>{this.clearWidgets()}))}get uri(){return this.diffEditor.getModifiedEditor().getModel()?.uri}createDiffEditor(e,t,o){let n={isSimpleWidget:this.isSimpleWidget,contributions:aa.getSomeEditorContributions([ry.ID,ly,Hm.ID,Xb.ID,$W.ID,I1.ID,wO.ID,kl.ID,Yg.ID,S_.ID])};return this._register(e.createInstance(Hu,t,{scrollbar:{useShadows:!1,alwaysConsumeMouseWheel:!1,ignoreHorizontalScrollbarInContentHeight:!0},renderMarginRevertIcon:!1,diffCodeLens:!1,scrollBeyondLastLine:!1,stickyScroll:{enabled:!1},originalAriaLabel:d(7260,null),modifiedAriaLabel:d(7259,null),diffAlgorithm:"advanced",readOnly:!1,isInEmbeddedEditor:!0,useInlineViewWhenSpaceIsLimited:!0,experimental:{useTrueInlineView:!0},renderSideBySideInlineBreakpoint:300,renderOverviewRuler:!1,compactMode:!0,hideUnchangedRegions:{enabled:!0,contextLineCount:1},renderGutterMenu:!1,lineNumbersMinChars:1,...o},{originalEditor:n,modifiedEditor:n}))}focus(){this.diffEditor.focus()}updatePaddingForLayout(){let e=this.currentScrollWidth>this.diffEditor.getModifiedEditor().getLayoutInfo().contentWidth,t=this.diffEditor.getModifiedEditor().getLayoutInfo().horizontalScrollbarHeight,o=e?Math.max(hPe-t,2):hPe;this.diffEditor.updateOptions({padding:{top:hPe,bottom:o}})}_configureForScreenReader(){let e=this.toolbar.getElement();e.style.display="block",this.accessibilityService.isScreenReaderOptimized()&&(e.ariaLabel=d(7249,null))}getEditorOptionsFromConfig(){return{wordWrap:this.options.configuration.resultEditor.wordWrap,fontLigatures:this.options.configuration.resultEditor.fontLigatures,bracketPairColorization:this.options.configuration.resultEditor.bracketPairColorization,fontFamily:this.options.configuration.resultEditor.fontFamily==="default"?Yd.fontFamily:this.options.configuration.resultEditor.fontFamily,fontSize:this.options.configuration.resultEditor.fontSize,fontWeight:this.options.configuration.resultEditor.fontWeight,lineHeight:this.options.configuration.resultEditor.lineHeight}}layout(e=this.lastLayoutWidth){if(e===void 0)return;this.lastLayoutWidth=e;let t=2,o=nh(this.editorHeader),n=this.diffEditor.getModel()?this.diffEditor.getContentHeight():nh(this.messageElement),r=new ai(e-t-this.currentHorizontalPadding*2,o+n);this.element.style.width=`${r.width}px`,this.diffEditor.layout(r.with(void 0,n-t)),this.updatePaddingForLayout()}async render(e,t,o){this.currentHorizontalPadding=e.horizontalPadding||0,e.parentContextKeyService&&this.contextKeyService.updateParent(e.parentContextKeyService),this.options.configuration.resultEditor.wordWrap==="on"&&this.layout(t),await this.updateEditor(e,o),this.layout(t),this.diffEditor.updateOptions({ariaLabel:d(7253,null),readOnly:!!e.isReadOnly}),this.resourceLabel.element.setFile(e.edit.uri,{fileKind:0,fileDecorations:{colors:!0,badges:!1}})}reset(){this.clearWidgets()}clearWidgets(){kl.get(this.diffEditor.getOriginalEditor())?.hideContentHover(),kl.get(this.diffEditor.getModifiedEditor())?.hideContentHover(),Yg.get(this.diffEditor.getOriginalEditor())?.hideGlyphHover(),Yg.get(this.diffEditor.getModifiedEditor())?.hideGlyphHover()}async updateEditor(e,t){if(!Vi(e.element))return;let o=!!(e.edit.state?.applied??0);if(ie.editApplied.bindTo(this.contextKeyService).set(o),this.element.classList.toggle("no-diff",o),o){So(e.edit.state?.applied);let r=this.labelService.getUriLabel(e.edit.uri,{relative:!0,noPrefix:!0}),s;e.edit.state.applied===1?s=d(7254,null,r):e.edit.state.applied<0?s=d(7256,null,r):s=d(7255,null,e.edit.state.applied,r);let l=RL(s,{renderCodeSegments:!0,actionHandler:{callback:()=>{this.openerService.open(e.edit.uri,{fromUserGesture:!0,allowCommands:!1})},disposables:this._store}});Fi(this.messageElement,l)}let n=await e.diffData;if(!o&&n){let r=this.diffEditor.createViewModel({original:n.original,modified:n.modified});if(await r.waitForDiff(),t.isCancellationRequested)return;let s=H.any(n.original.onWillDispose,n.modified.onWillDispose)(()=>{this.diffEditor.setModel(null)});this.diffEditor.setModel(r),this._lastDiffEditorViewModel.value=hn(s,r)}else this.diffEditor.setModel(null),this._lastDiffEditorViewModel.value=void 0;this.toolbar.context={edit:e.edit,element:e.element,diffEditor:this.diffEditor,toggleDiffViewMode:()=>{let s=!!this.diffEditor.getModifiedEditor().contextKeyService.getContextKeyValue(ue.diffEditorInlineMode.key);this.diffEditor.updateOptions({renderSideBySide:s,compactMode:!s,useInlineViewWhenSpaceIsLimited:!1}),this.layout()}}}};fPe=I([m(5,F),m(6,X),m(7,Ct),m(8,B),m(9,Bi),m(10,ot),m(11,Qe)],fPe);var vPe=class{constructor(i,e,t){this.modelService=i;this.editorService=e;this.dialogService=t;this._sha1=new Wue}async apply(i,e,t){if(!i.response.value.includes(e)||e.state?.applied)return;if(!t)for(let n of this.editorService.listDiffEditors()){if(!n.getContainerDomNode().isConnected)continue;let r=n.getModel();if(!r||!Xe(r.original.uri,e.uri)||r.modified.uri.scheme!==Y.vscodeChatCodeCompareBlock){t=n;break}}let o=t?await this._applyWithDiffEditor(t,e):await this._apply(e);i.setEditApplied(e,o)}async _applyWithDiffEditor(i,e){let t=i.getModel();if(!t)return 0;let o=i.getDiffComputationResult();if(!o||o.identical||!await this._checkSha1(t.original,e))return 0;let n=new _L(t.modified),r=o.changes2.map(s=>s.toRangeMapping().toTextEdit(n).toSingleEditOperation());return t.original.pushStackElement(),t.original.pushEditOperations(null,r,()=>null),t.original.pushStackElement(),r.length}async _apply(i){let e=await this.modelService.createModelReference(i.uri);try{if(!await this._checkSha1(e.object.textEditorModel,i))return 0;e.object.textEditorModel.pushStackElement();let t=0;for(let o of i.edits){let n=o.map(Qk.asEditOperation);e.object.textEditorModel.pushEditOperations(null,n,()=>null),t+=n.length}return e.object.textEditorModel.pushStackElement(),t}finally{e.dispose()}}async _checkSha1(i,e){return!(e.state?.sha1&&this._sha1.computeSHA1(i)&&this._sha1.computeSHA1(i)!==e.state.sha1&&!(await this.dialogService.confirm({message:d(7257,null),detail:d(7258,null)})).confirmed)}discard(i,e){i.response.value.includes(e)&&(e.state?.applied||i.setEditApplied(e,-1))}};vPe=I([m(0,Nt),m(1,Kt),m(2,ct)],vPe);var gI=class extends C{constructor(){super(...arguments);this._extension=null}get extension(){return this._extension}set extension(e){this._extension=e,this.update()}update(){this.render()}};function o0(a,i){let e=new P;return e.add(j(a,re.CLICK,Ybe(i))),e.add(j(a,re.KEY_UP,t=>{let o=new Ii(t);(o.equals(10)||o.equals(3))&&(t.preventDefault(),t.stopPropagation(),i())})),e}var c2=class extends gI{constructor(e){super();this.iconLoadingDisposable=this._register(new me);this.iconErrorDisposable=this._register(new me);this.element=R(e,_(".extension-icon")),this.iconElement=R(this.element,_("img.icon",{alt:""})),this.iconElement.style.display="none",this.defaultIconElement=R(this.element,_(q.asCSSSelector(DBt))),this.defaultIconElement.style.display="none",this.render(),this._register(Z(()=>this.clear()))}clear(){this.iconUrl=void 0,this.iconElement.src="",this.iconElement.style.display="none",this.defaultIconElement.style.display="none",this.iconErrorDisposable.clear(),this.iconLoadingDisposable.clear()}render(){if(!this.extension){this.clear();return}this.extension.iconUrl?this.iconUrl!==this.extension.iconUrl&&(this.iconElement.style.display="inherit",this.defaultIconElement.style.display="none",this.iconUrl=this.extension.iconUrl,this.iconErrorDisposable.value=j(this.iconElement,"error",()=>{this.extension?.iconUrlFallback?this.iconElement.src=this.extension.iconUrlFallback:(this.iconElement.style.display="none",this.defaultIconElement.style.display="inherit")},{once:!0}),this.iconElement.src=this.iconUrl,this.iconElement.complete?this.iconElement.style.visibility="inherit":(this.iconElement.style.visibility="hidden",this.iconLoadingDisposable.value=j(this.iconElement,"load",()=>{this.iconElement.style.visibility="inherit"}))):(this.iconUrl=void 0,this.iconElement.style.display="none",this.iconElement.src="",this.defaultIconElement.style.display="inherit",this.iconErrorDisposable.clear(),this.iconLoadingDisposable.clear())}},MB=class extends gI{constructor(e,t,o){super();this.container=e;this.small=t;this.hoverService=o;this.disposables=this._register(new P);this.render(),this._register(Z(()=>this.clear()))}clear(){this.container.innerText="",this.disposables.clear()}render(){if(this.clear(),!this.extension||this.small&&this.extension.state!==3)return;let e=MB.getInstallLabel(this.extension,this.small);if(!e)return;let t=this.small?this.container:R(this.container,_("span.install",{tabIndex:0}));R(t,_("span"+q.asCSSSelector(Lyi)));let o=R(t,_("span.count"));o.textContent=e,this.small||this.disposables.add(this.hoverService.setupManagedHover(Ni("mouse"),this.container,d(9967,null)))}static getInstallLabel(e,t){let o=e.installCount;if(!o)return;let n;return t?o>1e6?n=`${Math.floor(o/1e5)/10}M`:o>1e3?n=`${Math.floor(o/1e3)}K`:n=String(o):n=o.toLocaleString(Dr),n}};MB=I([m(2,tt)],MB);var Fee=class extends gI{constructor(e,t,o,n){super();this.container=e;this.small=t;this.hoverService=o;this.openerService=n;this.disposables=this._register(new P);e.classList.add("extension-ratings"),this.small&&e.classList.add("small"),this.render(),this._register(Z(()=>this.clear()))}clear(){this.container.innerText="",this.disposables.clear()}render(){if(this.clear(),!this.extension||this.small&&this.extension.state!==3||this.extension.rating===void 0||this.small&&!this.extension.ratingCount||!this.extension.url)return;let e=Math.round(this.extension.rating*2)/2;if(this.small){R(this.container,_("span"+q.asCSSSelector(qJe)));let t=R(this.container,_("span.count"));t.textContent=String(e)}else{let t=R(this.container,_("span.rating.clickable",{tabIndex:0}));for(let o=1;o<=5;o++)e>=o?R(t,_("span"+q.asCSSSelector(qJe))):e>=o-.5?R(t,_("span"+q.asCSSSelector(Ilo))):R(t,_("span"+q.asCSSSelector(PWt)));if(this.extension.ratingCount){let o=R(t,_("span",void 0,` (${this.extension.ratingCount})`));o.style.paddingLeft="1px"}this.containerHover=this._register(this.hoverService.setupManagedHover(Ni("mouse"),t,"")),this.containerHover.update(d(9974,null,e)),t.setAttribute("role","link"),this.extension.ratingUrl&&this.disposables.add(o0(t,()=>this.openerService.open(A.parse(this.extension.ratingUrl))))}}};Fee=I([m(2,tt),m(3,Qe)],Fee);var Wee=class extends gI{constructor(e,t,o,n,r){super();this.container=e;this.small=t;this.extensionsWorkbenchService=o;this.hoverService=n;this.openerService=r;this.disposables=this._register(new P);this.render(),this._register(Z(()=>this.clear()))}clear(){this.element?.remove(),this.disposables.clear()}render(){if(this.clear(),!this.extension||this.extension.resourceExtension||this.extension.local?.source==="resource")return;this.element=R(this.container,_(".publisher"));let e=_(".publisher-name.ellipsis");e.textContent=this.extension.publisherDisplayName;let t=_(".verified-publisher");if(R(t,_("span.extension-verified-publisher.clickable"),Qo(XF)),this.small)this.extension.publisherDomain?.verified&&R(this.element,t),R(this.element,e);else{if(this.element.classList.toggle("clickable",!!this.extension.url),this.element.setAttribute("role","button"),this.element.tabIndex=0,this.containerHover=this.disposables.add(this.hoverService.setupManagedHover(Ni("mouse"),this.element,d(9972,null,this.extension.publisherDisplayName))),R(this.element,e),this.extension.publisherDomain?.verified){R(this.element,t);let o=A.parse(this.extension.publisherDomain.link);t.tabIndex=0,t.setAttribute("role","button"),this.containerHover.update(d(9986,null,this.extension.publisherDomain.link)),t.setAttribute("role","link"),R(t,_("span.extension-verified-publisher-domain",void 0,o.authority.startsWith("www.")?o.authority.substring(4):o.authority)),this.disposables.add(o0(t,()=>this.openerService.open(o)))}this.extension.url&&this.disposables.add(o0(this.element,()=>this.extensionsWorkbenchService.openSearch(`publisher:"${this.extension?.publisherDisplayName}"`)))}}};Wee=I([m(2,zi),m(3,tt),m(4,Qe)],Wee);var bPe=class extends gI{constructor(e,t,o){super();this.container=e;this.hoverService=t;this.openerService=o;this.disposables=this._register(new P);this.render()}render(){if(Fi(this.container),this.disposables.clear(),!this.extension?.publisherSponsorLink)return;let e=R(this.container,_("span.sponsor.clickable",{tabIndex:0}));this.disposables.add(this.hoverService.setupManagedHover(Ni("mouse"),e,this.extension?.publisherSponsorLink.toString()??"")),e.setAttribute("role","link");let t=Qo($Je),o=_("span",void 0,d(9979,null));R(e,t,o),this.disposables.add(o0(e,()=>{this.openerService.open(this.extension.publisherSponsorLink)}))}};bPe=I([m(1,tt),m(2,Qe)],bPe);var SPe=class extends gI{constructor(e,t){super();this.parent=e;this.extensionRecommendationsService=t;this.disposables=this._register(new P);this.render(),this._register(Z(()=>this.clear())),this._register(this.extensionRecommendationsService.onDidChangeRecommendations(()=>this.render()))}clear(){this.element?.remove(),this.element=void 0,this.disposables.clear()}render(){if(this.clear(),!this.extension||this.extension.state===1||this.extension.deprecationInfo)return;if(this.extensionRecommendationsService.getAllRecommendationsWithReason()[this.extension.identifier.id.toLowerCase()]){this.element=R(this.parent,_("div.extension-bookmark"));let t=R(this.element,_(".recommendation"));R(t,_("span"+q.asCSSSelector(Slo)))}}};SPe=I([m(1,nD)],SPe);var xHt=class extends gI{constructor(e){super();this.parent=e;this.disposables=this._register(new P);this.render(),this._register(Z(()=>this.clear()))}clear(){this.element?.remove(),this.element=void 0,this.disposables.clear()}render(){if(this.clear(),this.extension?.state===1?this.extension.preRelease:this.extension?.hasPreReleaseVersion){this.element=R(this.parent,_("div.extension-bookmark"));let e=R(this.element,_(".pre-release"));R(e,_("span"+q.asCSSSelector(Myi)))}}},Vee=class extends gI{constructor(e,t,o,n){super();this.tooltip=t;this.extensionManagementServerService=o;this.instantiationService=n;this.remoteBadge=this._register(new me);this.element=R(e,_("")),this.render(),this._register(Z(()=>this.clear()))}clear(){this.remoteBadge.value?.element.remove(),this.remoteBadge.clear()}render(){if(this.clear(),!this.extension||!this.extension.local||!this.extension.server||!(this.extensionManagementServerService.localExtensionManagementServer&&this.extensionManagementServerService.remoteExtensionManagementServer)||this.extension.server!==this.extensionManagementServerService.remoteExtensionManagementServer)return;let e;this.tooltip&&this.extensionManagementServerService.remoteExtensionManagementServer&&(e=d(9976,null,this.extensionManagementServerService.remoteExtensionManagementServer.label)),this.remoteBadge.value=this.instantiationService.createInstance(Eme,blo,e),R(this.element,this.remoteBadge.value.element)}};Vee=I([m(2,Gc),m(3,F)],Vee);var Eme=class extends C{constructor(e,t,o,n,r){super();this.icon=e;this.tooltip=t;this.labelService=n;this.themeService=r;this.element=_("div.extension-badge.extension-icon-badge"),this.elementHover=this._register(o.setupManagedHover(Ni("mouse"),this.element,"")),this.render()}render(){R(this.element,_("span"+q.asCSSSelector(this.icon)));let e=()=>{if(!this.element)return;let t=this.themeService.getColorTheme().getColor(m7i),o=this.themeService.getColorTheme().getColor(h7i);this.element.style.backgroundColor=t?t.toString():"",this.element.style.color=o?o.toString():""};if(e(),this._register(this.themeService.onDidColorThemeChange(()=>e())),this.tooltip){let t=()=>{this.element&&this.elementHover.update(this.tooltip)};this._register(this.labelService.onDidChangeFormatters(()=>t())),t()}}};Eme=I([m(2,tt),m(3,ot),m(4,De)],Eme);var kHt=class extends gI{constructor(e){super();this.parent=e;this.render(),this._register(Z(()=>this.clear()))}clear(){this.element?.remove(),this.countBadge?.dispose(),this.countBadge=void 0}render(){this.clear(),!(!this.extension||!this.extension.categories?.some(e=>e.toLowerCase()==="extension packs")||!this.extension.extensionPack.length)&&(this.element=R(this.parent,_(".extension-badge.extension-pack-badge")),this.countBadge=new fv(this.element,{},BS),this.countBadge.setCount(this.extension.extensionPack.length))}},Bee=class extends gI{constructor(e,t,o,n,r,s,l,c){super();this.container=e;this.small=t;this.hoverService=o;this.contextService=n;this.uriIdentityService=r;this.explorerService=s;this.viewsService=l;this.extensionGalleryManifest=null;this.disposables=this._register(new P);this.render(),this._register(Z(()=>this.clear())),c.getExtensionGalleryManifest().then(u=>{this._store.isDisposed||(this.extensionGalleryManifest=u,this.render())})}clear(){this.element?.remove(),this.disposables.clear()}render(){if(this.clear(),!this.extension)return;if(this.extension?.private){this.element=R(this.container,_(".extension-kind-indicator")),(!this.small||this.extensionGalleryManifest?.capabilities.extensions?.includePublicExtensions&&this.extensionGalleryManifest?.capabilities.extensions?.includePrivateExtensions)&&R(this.element,_("span"+q.asCSSSelector(Ryi))),this.small||R(this.element,_("span.private-extension-label",void 0,d(9971,null)));return}if(!this.small)return;let e=this.extension.resourceExtension?.location??(this.extension.local?.source==="resource"?this.extension.local?.location:void 0);if(!e)return;this.element=R(this.container,_(".extension-kind-indicator"));let t=this.contextService.getWorkspaceFolder(e);t&&this.extension.isWorkspaceScoped?(this.element.textContent=d(9987,null),this.element.classList.add("clickable"),this.element.setAttribute("role","button"),this.disposables.add(this.hoverService.setupManagedHover(Ni("mouse"),this.element,this.uriIdentityService.extUri.relativePath(t.uri,e))),this.disposables.add(o0(this.element,()=>{this.viewsService.openView(Cb,!0).then(()=>this.explorerService.select(e,!0))}))):(this.disposables.add(this.hoverService.setupManagedHover(Ni("mouse"),this.element,e.path)),this.element.textContent=d(9968,null))}};Bee=I([m(2,tt),m(3,Pe),m(4,dt),m(5,za),m(6,Ft),m(7,vv)],Bee);var IPe=class extends gI{constructor(e,t,o,n,r){super();this.container=e;this.configurationService=t;this.extensionsWorkbenchService=o;this.hoverService=n;this.userDataSyncEnablementService=r;this.disposables=this._register(new P);this._register(H.filter(this.configurationService.onDidChangeConfiguration,s=>s.affectsConfiguration("settingsSync.ignoredExtensions"))(()=>this.render())),this._register(r.onDidChangeEnablement(()=>this.update())),this.render()}render(){if(this.disposables.clear(),this.container.innerText="",this.extension&&this.extension.state===1&&this.userDataSyncEnablementService.isEnabled()&&this.extensionsWorkbenchService.isExtensionIgnoredToSync(this.extension)){let e=R(this.container,_("span.extension-sync-ignored"+q.asCSSSelector(GJe)));this.disposables.add(this.hoverService.setupManagedHover(Ni("mouse"),e,d(9981,null))),e.classList.add(...q.asClassNameArray(GJe))}}};IPe=I([m(1,B),m(2,zi),m(3,tt),m(4,_l)],IPe);var yPe=class extends gI{constructor(e,t){super();this.container=e;this.hoverService=t;this.disposables=this._register(new P)}render(){this.disposables.clear(),this.container.innerText="";let e=this.extension?.runtimeState,t=typeof e?.reason=="string"?e.reason:"";if(e&&/restart|reload/i.test(t)){let o=R(this.container,_("span.extension-restart-required"+q.asCSSSelector(wlo)));R(this.container,_("span.extension-restart-required-label",void 0,d(9977,null))),this.disposables.add(this.hoverService.setupManagedHover(Ni("mouse"),o,t))}}};yPe=I([m(1,tt)],yPe);var wPe=class extends gI{constructor(e,t,o,n,r){super();this.extensionViewState=e;this.container=t;this.extensionFeaturesManagementService=n;this.extensionsWorkbenchService=r;this._register(o.onDidChangeExtensionsStatus(s=>{this.extension&&s.some(l=>Ot({id:l.value},this.extension.identifier))&&this.update()})),this._register(n.onDidChangeAccessData(s=>{this.extension&&Ei.equals(this.extension.identifier.id,s.extension)&&this.update()}))}render(){if(this.container.innerText="",!this.extension)return;if(this.extensionViewState.filters.featureId&&this.extension.state===1){let t=this.extensionFeaturesManagementService.getAllAccessDataForExtension(new Ei(this.extension.identifier.id)).get(this.extensionViewState.filters.featureId),o=oe.as(Ds.ExtensionFeaturesRegistry).getExtensionFeature(this.extensionViewState.filters.featureId);if(o?.icon&&t){let n=R(this.container,_("span.activationTime"));n.textContent=d(9964,null,t.accessTimes.length);let r=R(this.container,_("span"+q.asCSSSelector(o.icon)));r.style.paddingLeft="4px";return}}let e=this.extensionsWorkbenchService.getExtensionRuntimeStatus(this.extension);if(e?.activationTimes){let t=e.activationTimes.codeLoadingTime+e.activationTimes.activateCallTime;R(this.container,_("span"+q.asCSSSelector(ylo)));let o=R(this.container,_("span.activationTime"));o.textContent=`${t}ms`}}};wPe=I([m(2,lt),m(3,YI),m(4,zi)],wPe);var Hee=class extends gI{constructor(e,t,o,n,r,s,l,c,u){super();this.options=e;this.extensionStatusAction=t;this.extensionsWorkbenchService=o;this.extensionFeaturesManagementService=n;this.hoverService=r;this.configurationService=s;this.extensionRecommendationsService=l;this.themeService=c;this.contextService=u;this.hover=this._register(new me)}render(){this.hover.value=void 0,this.extension&&(this.hover.value=this.hoverService.setupManagedHover({delay:this.configurationService.getValue("workbench.hover.delay"),showHover:(e,t)=>this.hoverService.showInstantHover({...e,additionalClasses:["extension-hover"],position:{hoverPosition:this.options.position(),forcePosition:!0},persistence:{hideOnKeyDown:!0}},t),placement:"element"},this.options.target,{markdown:()=>Promise.resolve(this.getHoverMarkdown()),markdownNotSupportedFallback:void 0},{appearance:{showHoverHint:!0}}))}getHoverMarkdown(){if(!this.extension)return;let e=new xe("",{isTrusted:!0,supportThemeIcons:!0});e.appendMarkdown(`**${this.extension.displayName}**`),vke(this.extension.version)&&e.appendMarkdown(` <span style="background-color:#8080802B;">** _v${this.extension.version}${this.extension.isPreReleaseVersion?" (pre-release)":""}_** </span>`),e.appendText(`
`);let t=!1;if(this.extension.private&&(e.appendMarkdown(`$(${Ryi.id}) ${d(9971,null)}`),t=!0),this.extension.state===1){let p=MB.getInstallLabel(this.extension,!0);if(p&&(t&&e.appendText(" | "),e.appendMarkdown(`$(${Lyi.id}) ${p}`),t=!0),this.extension.rating){t&&e.appendText(" | ");let h=Math.round(this.extension.rating*2)/2;e.appendMarkdown(`$(${qJe.id}) [${h}](${this.extension.url}&ssr=false#review-details)`),t=!0}this.extension.publisherSponsorLink&&(t&&e.appendText(" | "),e.appendMarkdown(`$(${$Je.id}) [${d(9979,null)}](${this.extension.publisherSponsorLink})`),t=!0)}t&&e.appendText(`
`);let o=this.extension.resourceExtension?.location??(this.extension.local?.source==="resource"?this.extension.local?.location:void 0);if(o&&(this.extension.isWorkspaceScoped&&this.contextService.isInsideWorkspace(o)?e.appendMarkdown(d(9987,null)):e.appendMarkdown(d(9968,null)),e.appendText(`
`)),this.extension.description&&(e.appendMarkdown(`${this.extension.description}`),e.appendText(`
`)),this.extension.publisherDomain?.verified){let p=this.themeService.getColorTheme().getColor(ket),h=d(9973,null,`[${A.parse(this.extension.publisherDomain.link).authority}](${this.extension.publisherDomain.link})`);e.appendMarkdown(`<span style="color:${p?Oe.Format.CSS.formatHex(p):"#ffffff"};">$(${XF.id})</span> ${h}`),e.appendText(`
`)}this.extension.outdated&&(e.appendMarkdown(d(9985,null)),e.appendMarkdown(` <span style="background-color:#8080802B;">** _v${this.extension.latestVersion}_** </span>`),e.appendText(`
`));let n=Hee.getPreReleaseMessage(this.extension),r=this.extensionsWorkbenchService.getExtensionRuntimeStatus(this.extension),s=this.extensionFeaturesManagementService.getAllAccessDataForExtension(new Ei(this.extension.identifier.id)),l=this.extensionStatusAction.status,c=this.extension.runtimeState,u=this.getRecommendationMessage(this.extension);if(r||s.size||l.length||c||u||n){if(e.appendMarkdown("---"),e.appendText(`
`),r){if(r.activationTimes){let p=r.activationTimes.codeLoadingTime+r.activationTimes.activateCallTime;e.appendMarkdown(`${d(9959,null)}${r.activationTimes.activationReason.startup?` (${d(9980,null)})`:""}: \`${p}ms\``),e.appendText(`
`)}if(r.runtimeErrors.length||r.messages.length){let p=r.runtimeErrors.length||r.messages.some(v=>v.type===gt.Error),h=r.messages.some(v=>v.type===gt.Warning),g=r.runtimeErrors.length?`[${r.runtimeErrors.length===1?d(9983,null):d(9984,null,r.runtimeErrors.length)}](${ic("extension.open",this.extension.identifier.id,"features")})`:void 0,f=r.messages.length?`[${r.messages.length===1?d(9969,null):d(9970,null,r.messages.length)}](${ic("extension.open",this.extension.identifier.id,"features")})`:void 0;e.appendMarkdown(`$(${p?gS.id:h?_u.id:kg.id}) This extension has reported `),g&&f?e.appendMarkdown(`${g} and ${f}`):e.appendMarkdown(`${g||f}`),e.appendText(`
`)}}if(s.size){let p=oe.as(Ds.ExtensionFeaturesRegistry);for(let[h,g]of s)if(g?.accessTimes.length){let f=p.getExtensionFeature(h);f&&(e.appendMarkdown(d(9965,null,f.label)),e.appendMarkdown(`: [${d(9982,null,g.accessTimes.length,f.accessDataLabel??f.label)}](${ic("extension.open",this.extension.identifier.id,"features")})`),e.appendText(`
`))}}for(let p of l)p.icon&&e.appendMarkdown(`$(${p.icon.id}) `),e.appendMarkdown(p.message.value),e.appendText(`
`);if(c&&(e.appendMarkdown(`$(${kg.id}) `),e.appendMarkdown(`${c.reason}`),e.appendText(`
`)),n){let p=this.themeService.getColorTheme().getColor(X6o);e.appendMarkdown(`<span style="color:${p?Oe.Format.CSS.formatHex(p):"#ffffff"};">$(${Myi.id})</span> ${n}`),e.appendText(`
`)}u&&(e.appendMarkdown(u),e.appendText(`
`))}return e}getRecommendationMessage(e){if(e.state===1||e.deprecationInfo)return;let t=this.extensionRecommendationsService.getAllRecommendationsWithReason()[e.identifier.id.toLowerCase()];if(!t?.reasonText)return;let o=this.themeService.getColorTheme().getColor(xlo);return`<span style="color:${o?Oe.Format.CSS.formatHex(o):"#ffffff"};">$(${PWt.id})</span> ${t.reasonText}`}static getPreReleaseMessage(e){if(!e.hasPreReleaseVersion||e.isBuiltin||e.isPreReleaseVersion||e.preRelease)return;let t=`[${d(9978,null)}](${ic("workbench.extensions.action.showPreReleaseVersion",e.identifier.id)})`;return d(9966,null,t)}};Hee=I([m(2,zi),m(3,YI),m(4,tt),m(5,B),m(6,nD),m(7,De),m(8,Pe)],Hee);var CPe=class extends gI{constructor(e,t,o){super();this.container=e;this.extensionStatusAction=t;this.markdownRendererService=o;this.renderDisposables=this._register(new me);this._onDidRender=this._register(new E);this.onDidRender=this._onDidRender.event;this.render(),this._register(t.onDidChangeStatus(()=>this.render()))}render(){Fi(this.container),this.renderDisposables.value=void 0;let e=new P;this.renderDisposables.value=e;let t=this.extensionStatusAction.status;if(t.length){let o=new xe("",{isTrusted:!0,supportThemeIcons:!0});for(let r=0;r<t.length;r++){let s=t[r];s.icon&&o.appendMarkdown(`$(${s.icon.id}) `),o.appendMarkdown(s.message.value),r<t.length-1&&o.appendText(`
`)}let n=e.add(this.markdownRendererService.render(o));R(this.container,n.element)}this._onDidRender.fire()}};CPe=I([m(2,Qn)],CPe);var xPe=class extends gI{constructor(e,t,o){super();this.container=e;this.extensionRecommendationsService=t;this.extensionIgnoredRecommendationsService=o;this._onDidRender=this._register(new E);this.onDidRender=this._onDidRender.event;this.render(),this._register(this.extensionRecommendationsService.onDidChangeRecommendations(()=>this.render()))}render(){Fi(this.container);let e=this.getRecommendationStatus();e&&(e.icon&&R(this.container,_(`div${q.asCSSSelector(e.icon)}`)),R(this.container,_("div.recommendation-text",void 0,e.message))),this._onDidRender.fire()}getRecommendationStatus(){if(!this.extension||this.extension.deprecationInfo||this.extension.state===1)return;let e=this.extensionRecommendationsService.getAllRecommendationsWithReason();if(e[this.extension.identifier.id.toLowerCase()]){let t=e[this.extension.identifier.id.toLowerCase()].reasonText;if(t)return{icon:PWt,message:t}}else if(this.extensionIgnoredRecommendationsService.globalIgnoredRecommendations.indexOf(this.extension.identifier.id.toLowerCase())!==-1)return{icon:void 0,message:d(9975,null)}}};xPe=I([m(1,nD),m(2,uk)],xPe);var Y6o=J("extensionIcon.starForeground",{light:"#DF6100",dark:"#FF8E00",hcDark:"#FF8E00",hcLight:WI},d(9962,null),!1),X6o=J("extensionIcon.preReleaseForeground",{dark:"#1d9271",light:"#1d9271",hcDark:"#1d9271",hcLight:WI},d(9963,null),!1),Uqu=J("extensionIcon.sponsorForeground",{light:"#B51E78",dark:"#D758B3",hcDark:null,hcLight:"#B51E78"},d(9961,null),!1),J6o=J("extensionIcon.privateForeground",{dark:"#ffffff60",light:"#00000060",hcDark:"#ffffff60",hcLight:"#00000060"},d(9960,null));is((a,i)=>{let e=a.getColor(Y6o);e&&(i.addRule(`.extension-ratings .codicon-extensions-star-full, .extension-ratings .codicon-extensions-star-half { color: ${e}; }`),i.addRule(`.monaco-hover.extension-hover .markdown-hover .hover-contents ${q.asCSSSelector(qJe)} { color: ${e}; }`));let t=a.getColor(ket);t&&i.addRule(`${q.asCSSSelector(XF)} { color: ${t}; }`),i.addRule(`.monaco-hover.extension-hover .markdown-hover .hover-contents ${q.asCSSSelector($Je)} { color: var(--vscode-extensionIcon-sponsorForeground); }`),i.addRule(`.extension-editor > .header > .details > .subtitle .sponsor ${q.asCSSSelector($Je)} { color: var(--vscode-extensionIcon-sponsorForeground); }`);let o=a.getColor(J6o);o&&i.addRule(`.extension-private-badge { color: ${o}; }`)});var Z6o=72,kPe=class{getHeight(){return Z6o}getTemplateId(){return"extension"}},Tme=class{constructor(i,e,t,o,n,r,s,l){this.extensionViewState=i;this.options=e;this.instantiationService=t;this.notificationService=o;this.extensionService=n;this.extensionsWorkbenchService=r;this.extensionEnablementService=s;this.contextMenuService=l}get templateId(){return"extension"}renderTemplate(i){let e=this.instantiationService.createInstance(SPe,R(i,_(".extension-bookmark-container"))),t=this.instantiationService.createInstance(xHt,R(i,_(".extension-bookmark-container"))),o=R(i,_(".extension-list-item")),n=R(o,_(".icon-container")),r=this.instantiationService.createInstance(c2,n),s=this.instantiationService.createInstance(Vee,n,!1),l=this.instantiationService.createInstance(kHt,n),c=R(o,_(".details")),u=R(c,_(".header-container")),p=R(u,_(".header")),h=R(p,_("span.name")),g=R(p,_("span.restart-required")),f=R(p,_("span.install-count")),v=R(p,_("span.ratings")),b=R(p,_("span.sync-ignored")),S=R(p,_("span")),y=R(p,_("span.activation-status")),w=R(c,_(".description.ellipsis")),k=R(c,_(".footer")),T=this.instantiationService.createInstance(Wee,R(k,_(".publisher-container")),!0),N=new ji(k,{actionViewItemProvider:(de,se)=>{if(de instanceof qK)return new dRe(de,{...se,icon:!0,label:!0,menuActionsOrProvider:{getActions:()=>de.menuActions},menuActionClassNames:de.menuActionClassNames},this.contextMenuService);if(de instanceof fB)return de.createActionViewItem(se)},focusOnlyEnabledItems:!0});N.setFocusable(!1);let O=N.onDidRun(({error:de})=>de&&this.notificationService.error(de)),V=this.instantiationService.createInstance(cD),U=[this.instantiationService.createInstance(UF),this.instantiationService.createInstance(HF,!0),this.instantiationService.createInstance(nA,!1),this.instantiationService.createInstance(TZ),this.instantiationService.createInstance(uRe),this.instantiationService.createInstance(FR),this.instantiationService.createInstance(KC),this.instantiationService.createInstance(T4,!1),this.instantiationService.createInstance(_Z),this.instantiationService.createInstance(DZ),V,this.instantiationService.createInstance(rA)],G=this.instantiationService.createInstance(Hee,{target:i,position:this.options.hoverOptions.position},V),$=[r,e,t,s,l,T,G,this.instantiationService.createInstance(IPe,b),this.instantiationService.createInstance(yPe,g),this.instantiationService.createInstance(wPe,this.extensionViewState,y),this.instantiationService.createInstance(MB,f,!0),this.instantiationService.createInstance(Fee,v,!0),this.instantiationService.createInstance(Bee,S,!0)],te=this.instantiationService.createInstance(dX,[...U,...$]);N.push(U,{icon:!0,label:!0});let pe=hn(...U,...$,N,O,te);return{root:i,element:o,name:h,installCount:f,ratings:v,description:w,disposables:[pe],actionbar:N,extensionDisposables:[],set extension(de){te.extension=de}}}renderPlaceholder(i,e){e.element.classList.add("loading"),e.root.removeAttribute("aria-label"),e.root.removeAttribute("data-extension-id"),e.extensionDisposables=Ue(e.extensionDisposables),e.name.textContent="",e.description.textContent="",e.installCount.style.display="none",e.ratings.style.display="none",e.extension=null}renderElement(i,e,t){t.element.classList.remove("loading"),t.root.setAttribute("data-extension-id",i.identifier.id),i.state!==3&&!i.server&&(i=this.extensionsWorkbenchService.local.filter(n=>n.server===i.server&&Ot(n.identifier,i.identifier))[0]||i),t.extensionDisposables=Ue(t.extensionDisposables);let o=()=>{let n=i.state===1&&!!i.local&&!this.extensionEnablementService.isEnabled(i.local),r=!!i.deprecationInfo;t.element.classList.toggle("deprecated",r),t.root.classList.toggle("disabled",n)};o(),this.extensionService.onDidChangeExtensions(()=>o(),this,t.extensionDisposables),t.name.textContent=i.displayName,t.description.textContent=i.description,t.installCount.style.display="",t.ratings.style.display="",t.extension=i,i.gallery&&i.gallery.properties&&i.gallery.properties.localizedLanguages&&i.gallery.properties.localizedLanguages.length&&(t.description.textContent=i.gallery.properties.localizedLanguages.map(n=>n[0].toLocaleUpperCase()+n.slice(1)).join(", ")),this.extensionViewState.onFocus(n=>{Ot(i.identifier,n.identifier)&&t.actionbar.setFocusable(!0)},this,t.extensionDisposables),this.extensionViewState.onBlur(n=>{Ot(i.identifier,n.identifier)&&t.actionbar.setFocusable(!1)},this,t.extensionDisposables)}disposeElement(i,e,t){t.extensionDisposables=Ue(t.extensionDisposables)}disposeTemplate(i){i.extensionDisposables=Ue(i.extensionDisposables),i.disposables=Ue(i.disposables)}};Tme=I([m(2,F),m(3,Ne),m(4,lt),m(5,zi),m(6,Os),m(7,ze)],Tme);is((a,i)=>{let e=a.getColor(ket);if(e){let t=e.transparent(.5).makeOpaque(DO(a));i.addRule(`.extensions-list .monaco-list .monaco-list-row.disabled:not(.selected) .author .verified-publisher ${q.asCSSSelector(XF)} { color: ${t}; }`)}});function tpo(a){return{isResolved:!!a,promise:null,cts:null,promiseIndexes:new Set,elements:a||[]}}function Rxi(a){return{firstPage:a,total:a.length,pageSize:a.length,getPage:(i,e)=>Promise.resolve(a)}}var Tm=class{constructor(i){this.pages=[];this.onDidIncrementLength=H.None;this.pager=Array.isArray(i)?Rxi(i):i;let e=Math.ceil(this.pager.total/this.pager.pageSize);this.pages=[tpo(this.pager.firstPage.slice()),...ig(e-1).map(()=>tpo())]}get length(){return this.pager.total}isResolved(i){let e=Math.floor(i/this.pager.pageSize);return!!this.pages[e].isResolved}get(i){let e=Math.floor(i/this.pager.pageSize),t=i%this.pager.pageSize;return this.pages[e].elements[t]}resolve(i,e){if(e.isCancellationRequested)return Promise.reject(new ho);let t=Math.floor(i/this.pager.pageSize),o=i%this.pager.pageSize,n=this.pages[t];if(n.isResolved)return Promise.resolve(n.elements[o]);n.promise||(n.cts=new $e,n.promise=this.pager.getPage(t,n.cts.token).then(s=>{n.elements=s,n.isResolved=!0,n.promise=null,n.cts=null},s=>(n.isResolved=!1,n.promise=null,n.cts=null,Promise.reject(s))));let r=e.onCancellationRequested(()=>{n.cts&&(n.promiseIndexes.delete(i),n.promiseIndexes.size===0&&n.cts.cancel())});return n.promiseIndexes.add(i),n.promise.then(()=>n.elements[o]).finally(()=>r.dispose())}},C3=class{constructor(i,e=500){this.model=i;this.timeout=e}get length(){return this.model.length}get onDidIncrementLength(){return this.model.onDidIncrementLength}isResolved(i){return this.model.isResolved(i)}get(i){return this.model.get(i)}resolve(i,e){return new Promise((t,o)=>{if(e.isCancellationRequested)return o(new ho);let n=setTimeout(()=>{if(e.isCancellationRequested)return o(new ho);r.dispose(),this.model.resolve(i,e).then(t,o)},this.timeout),r=e.onCancellationRequested(()=>{clearTimeout(n),r.dispose(),o(new ho)})})}};var EHt=class{constructor(i){this.items=[];this._hasNextPage=!0;this._onDidIncrementLength=new E;this.loadingPromise=null;this.pager=i,this.items=[...i.firstPage.items],this._hasNextPage=i.firstPage.hasMore}get onDidIncrementLength(){return this._onDidIncrementLength.event}get length(){return this.items.length+(this._hasNextPage?1:0)}isResolved(i){return i===this.items.length&&this._hasNextPage?!1:i<this.items.length}get(i){if(i<this.items.length)return this.items[i];throw new Error("Item not resolved yet")}async resolve(i,e){if(e.isCancellationRequested)return Promise.reject(new ho);if(i===this.items.length&&this._hasNextPage&&await this.loadNextPage(e),i<this.items.length)return this.items[i];throw new Error("Index out of bounds")}async loadNextPage(i){if(!this._hasNextPage)return;if(this.loadingPromise){await this.loadingPromise;return}let e=this.pager.getNextPage(i);this.loadingPromise=e.then(t=>{this.items.push(...t.items),this._hasNextPage=t.hasMore,this.loadingPromise=null,this._onDidIncrementLength.fire(this.length)},t=>{throw this.loadingPromise=null,t}),await this.loadingPromise}dispose(){this._onDidIncrementLength.dispose()}};function ipo(a){if(!a)return"";let i=a.publisherDomain?.verified?d(9902,null,a.publisherDisplayName):d(9900,null,a.publisherDisplayName),e=a?.deprecationInfo?d(9899,null):"",t=a?.rating?d(9901,null,a.rating.toFixed(2),a.ratingCount):"";return`${a.displayName}, ${e?`${e}, `:""}${a.version}, ${i}, ${a.description} ${t?`, ${t}`:""}`}var Uee=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.extensionsWorkbenchService=r;this.contextMenuService=u;this.contextKeyService=p;this.instantiationService=h;this.logService=g;this.contextMenuActionRunner=this._register(new as);this.modalNavigationDisposable=this._register(new me);this._register(this.contextMenuActionRunner.onDidRun(({error:b})=>b&&c.error(b)));let f=new kPe,v=h.createInstance(Tme,n,{hoverOptions:{position:()=>{let b=s.getViewLocationById(t);return b===0?l.getSideBarPosition()===0?1:0:b===2?l.getSideBarPosition()===0?0:1:1}}});this.list=h.createInstance(F1,`${t}-Extensions`,e,f,[v],{multipleSelectionSupport:!1,setRowLineHeight:!1,horizontalScrolling:!1,accessibilityProvider:{getAriaLabel(b){return ipo(b)},getWidgetAriaLabel(){return d(9903,null)}},overrideStyles:qz(s.getViewLocationById(t)).listOverrideStyles,openOnSingleClick:!0,...o}),this._register(this.list.onContextMenu(b=>this.onContextMenu(b),this)),this._register(this.list),this._register(H.debounce(H.filter(this.list.onDidOpen,b=>b.element!==null),(b,S)=>S,75,!0)(b=>{this.openExtension(b.element,{sideByside:b.sideBySide,...b.editorOptions})}))}setModel(e){this.list.model=new C3(e)}layout(e,t){this.list.layout(e,t)}openExtension(e,t){e=this.extensionsWorkbenchService.local.filter(o=>Ot(o.identifier,e.identifier))[0]||e,this.extensionsWorkbenchService.open(e,{...t,modal:t.sideByside?void 0:Axi(e,()=>this.list.model,(o,n)=>Ot(o.identifier,n.identifier),(o,n)=>this.extensionsWorkbenchService.open(o,{pinned:!1,modal:n}),this.modalNavigationDisposable,this.logService)})}async onContextMenu(e){if(e.element){let t=new P,o=t.add(this.instantiationService.createInstance(rA)),n=e.element&&this.extensionsWorkbenchService.local.find(l=>Ot(l.identifier,e.element.identifier)&&(!e.element.server||e.element.server===l.server))||e.element;o.extension=n;let r=[];o.enabled?r=await o.getActionGroups():n&&(r=await Nyi(n,this.contextKeyService,this.instantiationService),r.forEach(l=>l.forEach(c=>{c instanceof oa&&(c.extension=n)})));let s=[];for(let l of r){for(let c of l)s.push(c),Ac(c)&&t.add(c);s.push(new li)}s.pop(),this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>s,actionRunner:this.contextMenuActionRunner,onHide:()=>t.dispose()})}}};Uee=I([m(4,zi),m(5,Ri),m(6,fi),m(7,Ne),m(8,ze),m(9,X),m(10,F),m(11,ne)],Uee);var EPe=class extends C{constructor(e,t,o){super();this.instantiationService=o;this.element=R(e,_(".extensions-grid-view")),this.renderer=this.instantiationService.createInstance(Tme,{onFocus:H.None,onBlur:H.None,filters:{}},{hoverOptions:{position(){return 2}}}),this.delegate=t,this.disposableStore=this._register(new P)}setExtensions(e){this.disposableStore.clear(),e.forEach((t,o)=>this.renderExtension(t,o))}renderExtension(e,t){let o=R(this.element,_(".extension-container"));o.style.height=`${this.delegate.getHeight()}px`,o.setAttribute("tabindex","0");let n=this.renderer.renderTemplate(o);this.disposableStore.add(Z(()=>this.renderer.disposeTemplate(n)));let r=this.instantiationService.createInstance(TPe);r.extension=e,n.name.setAttribute("tabindex","0");let s=l=>{l instanceof Ii&&l.keyCode!==3||(r.run(l.ctrlKey||l.metaKey),l.stopPropagation(),l.preventDefault())};this.disposableStore.add(j(n.name,re.CLICK,l=>s(new yn(Me(n.name),l)))),this.disposableStore.add(j(n.name,re.KEY_DOWN,l=>s(new Ii(l)))),this.disposableStore.add(j(o,re.KEY_DOWN,l=>s(new Ii(l)))),this.renderer.renderElement(e,t,n)}};EPe=I([m(2,F)],EPe);var Mxi=class{hasChildren({hasChildren:i}){return i}getChildren(i){return i.getChildren()}},Pxi=class{getHeight(i){return 62}getTemplateId({extension:i}){return i?zee.TEMPLATE_ID:THt.TEMPLATE_ID}},zee=class{constructor(i){this.instantiationService=i}static{this.TEMPLATE_ID="extension-template"}get templateId(){return zee.TEMPLATE_ID}renderTemplate(i){i.classList.add("extension");let e=this.instantiationService.createInstance(c2,i),t=R(i,_(".details")),o=R(t,_(".header")),n=R(o,_("span.name")),r=this.instantiationService.createInstance(TPe),s=[j(n,"click",p=>{r.run(p.ctrlKey||p.metaKey),p.stopPropagation(),p.preventDefault()}),e,r],l=R(o,_("span.identifier")),c=R(t,_(".footer")),u=R(c,_(".author"));return{name:n,identifier:l,author:u,extensionDisposables:s,set extensionData(p){e.extension=p.extension,r.extension=p.extension}}}renderElement(i,e,t){let o=i.element.extension;t.name.textContent=o.displayName,t.identifier.textContent=o.identifier.id,t.author.textContent=o.publisherDisplayName,t.extensionData=i.element}disposeTemplate(i){i.extensionDisposables=Ue(i.extensionDisposables)}};zee=I([m(0,F)],zee);var THt=class a{static{this.TEMPLATE_ID="unknown-extension-template"}get templateId(){return a.TEMPLATE_ID}renderTemplate(i){let e=R(i,_("div.unknown-extension"));return R(e,_("span.error-marker")).textContent=d(9898,null),R(e,_("span.message")).textContent=d(9904,null),{identifier:R(e,_("span.message"))}}renderElement(i,e,t){t.identifier.textContent=i.element.extension.identifier.id}disposeTemplate(i){}},TPe=class extends st{constructor(e){super("extensions.action.openExtension","");this.extensionsWorkdbenchService=e}set extension(e){this._extension=e}run(e){return this._extension?this.extensionsWorkdbenchService.open(this._extension,{sideByside:e}):Promise.resolve()}};TPe=I([m(0,zi)],TPe);var _Pe=class extends nu{constructor(i,e,t,o,n,r,s,l){let c=new Pxi,u=new Mxi,p=[r.createInstance(zee),r.createInstance(THt)],h={getId({extension:g,parent:f}){return f?this.getId(f)+"/"+g.identifier.id:g.identifier.id}};super("ExtensionsTree",e,c,p,u,{indent:40,identityProvider:h,multipleSelectionSupport:!1,overrideStyles:t,accessibilityProvider:{getAriaLabel(g){return ipo(g.extension)},getWidgetAriaLabel(){return d(9903,null)}}},r,o,n,s),this.setInput(i),this.disposables.add(this.onDidChangeSelection(g=>{ag(g.browserEvent)&&l.open(g.elements[0].extension,{sideByside:!1})}))}};_Pe=I([m(3,X),m(4,fo),m(5,F),m(6,B),m(7,zi)],_Pe);var _Ht=class a{constructor(i,e,t,o){this.extension=i,this.parent=e,this.getChildrenExtensionIds=t,this.extensionsWorkbenchService=o,this.childrenExtensionIds=this.getChildrenExtensionIds(i)}get hasChildren(){return dr(this.childrenExtensionIds)}async getChildren(){return this.hasChildren?(await jet(this.childrenExtensionIds,this.extensionsWorkbenchService)).map(e=>new a(e,this,this.getChildrenExtensionIds,this.extensionsWorkbenchService)):null}};async function jet(a,i){let e=i.local.reduce((n,r)=>(n.set(r.identifier.id.toLowerCase(),r),n),new Map),t=[],o=[];for(let n of a){let r=n.toLowerCase(),s=e.get(r);s?t.push(s):o.push(r)}if(o.length){let n=await i.getExtensions(o.map(r=>({id:r})),ve.None);t.push(...n)}return t}function Axi(a,i,e,t,o,n){let r=i();if(!r)return;let s=r.length;if(s<=1)return;let l=-1;for(let h=0;h<s;h++)if(r.isResolved(h)&&e(r.get(h),a)){l=h;break}if(l===-1)return;let c=(h,g)=>{let f=i()?.length??0;t(g,{navigation:{total:f,current:h,navigate:p}})},u,p=h=>{u?.cancel(),u=o.value=new $e;let g=u.token,f=i();!f||h<0||h>=f.length||(f.isResolved(h)?c(h,f.get(h)):f.resolve(h,g).then(v=>{g.isCancellationRequested||c(h,v)},v=>{so(v)||n.error(`Error while resolving item at index ${h} for modal navigation`,v)}))};return{navigation:{total:s,current:l,navigate:p}}}is((a,i)=>{let e=a.getColor(c9);e&&i.addRule(`.extensions-grid-view .extension-container:focus { background-color: ${e}; outline: none; }`);let t=a.getColor(ZSe);t&&i.addRule(`.extensions-grid-view .extension-container:focus { color: ${t}; }`);let o=a.getColor(ko),n=a.getColor(qo);if(o&&n){let r=o.transparent(.9).makeOpaque(n);i.addRule(`.extensions-grid-view .extension-container:not(.disabled) .author { color: ${r}; }`);let s=o.transparent(.5).makeOpaque(n);i.addRule(`.extensions-grid-view .extension-container.disabled { color: ${s}; }`)}});var d2=class extends C{constructor(e,t,o){super();this.extensionsContent=e;this.domNode=_(".chat-extensions-content-part");let n=R(this.domNode,_(".loading-extensions-element"));R(n,_(q.asCSSSelector(q.modify(M.loading,"spin"))),_("span.loading-message",void 0,d(7110,null)));let r=R(this.domNode,_(".extensions-list")),s=this._register(o.createInstance(Uee,r,Vr,{alwaysConsumeMouseWheel:!1},{onFocus:H.None,onBlur:H.None,filters:{}}));jet(e.extensions,t).then(l=>{n.remove(),!this._store.isDisposed&&(s.setModel(new Tm(l)),s.layout())})}get codeblocks(){return[]}get codeblocksPartId(){}hasSameContent(e,t,o){return e.kind==="extensions"&&e.extensions.length===this.extensionsContent.extensions.length&&e.extensions.every(n=>this.extensionsContent.extensions.includes(n))}addDisposable(e){this._register(e)}};d2=I([m(1,zi),m(2,F)],d2);var LPe=_,lT=class extends C{constructor(e,t,o,n=!1,r=0,s,l,c,u,p,h,g,f,v,b){super();this.markdown=e;this.editorPool=o;this.codeBlockModelCollection=u;this.rendererOptions=p;this.textModelService=f;this.instantiationService=v;this.aiEditTelemetryService=b;this.codeblocksPartId=String(++lT.ID_POOL);this._onDidChangeHeight=this._register(new E);this.onDidChangeHeight=this._onDidChangeHeight.event;this.allRefs=[];this._codeblocks=[];this.mathLayoutParticipants=new Set;let S=t.element,y=ju(t.content,V=>V.kind==="undoStop",t.contentIndex)?.id,w=r,k=0;this.domNode=LPe("div.chat-markdown-part"),this.rendererOptions.accessibilityOptions?.statusMessage&&(this.domNode.ariaLabel=this.rendererOptions.accessibilityOptions.statusMessage,g.getValue("accessibility.verboseChatProgressUpdates")&&Or(this.rendererOptions.accessibilityOptions.statusMessage));let T=g.getValue("chat.math.enabled"),N=this._register(new me),O=()=>{if(this._store.isDisposed)return;let V=new P;N.value=V,Rt(this.domNode),this.allRefs.length=0,this._codeblocks.length=0,this.mathLayoutParticipants.clear(),w=r,k=0;let U=[],G=T?si([xme.getExtension(Me(t.container),{throwOnError:!1})]):[],$={gfm:!0,breaks:!0},te=V.add(s.render(e.content,{sanitizerConfig:xme.getSanitizerOptions({allowedTags:Eet,allowedAttributes:Sje}),fillInIncompleteTokens:n,codeBlockRendererSync:(se,Se,ke)=>{let Ee=!Vi(t.element)||t.element.isComplete||!ke||Nxi(ke);if((!Se||Se.startsWith("<vscode_codeblock_uri")&&!Se.includes(`
`))&&!Ee){let _o=LPe("div");return _o.style.display="none",_o}if(se==="diff"&&ke&&this.rendererOptions.allowInlineDiffs){let _o=ke.match(/^```diff:(\w+)/);if(_o&&Vi(t.element)){let sr=_o[1],ln=zMe(Se),{before:en,after:Ws}=juo(ln?.textWithoutResult??Se),ba={element:t.element,codeBlockIndex:w++,languageId:sr,beforeContent:en,afterContent:Ws,codeBlockResource:ln?.uri,isReadOnly:!0,horizontalPadding:this.rendererOptions.horizontalPadding},Id=this.instantiationService.createInstance(kme,ba,t.diffEditorPool,t.currentWidth.get()),Dg={object:Id,isStale:()=>!1,dispose:()=>Id.dispose()};return this.allRefs.push(Dg),U.push(Dg),Id.element}}if(se==="vscode-extensions")return V.add(v.createInstance(d2,{kind:"extensions",extensions:Se.split(",")})).domNode;let He=w++,Ve=k++,Fe,Qt,Ze,Ti;if(mr(se,Zuo))try{let _o=epo(Se);Qt=_o.range&&z.lift(_o.range),Fe=this.textModelService.createModelReference(_o.uri).then(ln=>(V.isDisposed||V.add(ln),ln.object.textEditorModel))}catch{return LPe("div")}else if(Vi(S)||Rr(S)){let _o=this.codeBlockModelCollection.getOrCreate(S.sessionResource,S,He),sr=this.codeBlockModelCollection.updateSync(S.sessionResource,S,He,{text:Se,languageId:se,isComplete:Ee});Ze=_o.vulns,Ti=sr,Fe=_o.model}else Fe=void 0;let ti=Vi(S)&&S.errorDetails?.responseIsFiltered,bo={...this.rendererOptions.codeBlockRenderOptions};ti!==void 0&&(bo.hideToolbar=ti);let Ro={languageId:se,textModel:Fe,codeBlockIndex:He,codeBlockPartIndex:Ve,element:S,range:Qt,parentContextKeyService:h,vulns:Ze,codemapperUri:Ti?.codemapperUri,renderOptions:bo,chatSessionResource:S.sessionResource};if(S.isCompleteAddedRequest||!Ti?.codemapperUri||!Ti.isEdit){let _o=this.renderCodeBlock(Ro,Se,Ee,c);this.allRefs.push(_o);let sr=this.codeblocksPartId,ln=new class{constructor(){this.ownerMarkdownPartId=sr;this.codeBlockIndex=He;this.elementId=S.id;this.chatSessionResource=S.sessionResource;this.languageId=se;this.isStreamingEdit=!1;this.editDeltaInfo=zy.fromText(Se);this.codemapperUri=void 0;this.uriPromise=Fe?.then(en=>en.uri)??Promise.resolve(void 0)}get uri(){return _o.object.uri}focus(){_o.object.focus()}};return this._codeblocks.push(ln),U.push(_o),_o.object.element}else{let _o=Rr(S)?S.id:S.requestId,sr=this.renderCodeBlockPill(S.sessionResource,_o,y,Ro.codemapperUri);Vi(Ro.element)&&this.codeBlockModelCollection.update(Ro.element.sessionResource,Ro.element,Ro.codeBlockIndex,{text:Se,languageId:Ro.languageId,isComplete:Ee}).then(Ws=>{this._codeblocks[Ro.codeBlockPartIndex].codemapperUri=Ws.codemapperUri}),this.allRefs.push(sr);let ln=this.codeblocksPartId,en=new class{constructor(){this.ownerMarkdownPartId=ln;this.codeBlockIndex=He;this.elementId=S.id;this.codemapperUri=Ti?.codemapperUri;this.chatSessionResource=S.sessionResource;this.isStreamingEdit=!Ee;this.uriPromise=Promise.resolve(void 0);this.languageId=se;this.editDeltaInfo=zy.fromText(Se)}get uri(){}focus(){return sr.object.element.focus()}};return this._codeblocks.push(en),U.push(sr),sr.object.element}},markedOptions:$,markedExtensions:G,...l},this.domNode));Vi(S)&&!S.model.codeBlockInfos&&S.model.isComplete&&S.model.initializeCodeBlockInfos(this._codeblocks.map(se=>({suggestionId:this.aiEditTelemetryService.createSuggestionId({presentation:"codeBlock",feature:"sideBarChat",editDeltaInfo:se.editDeltaInfo,languageId:se.languageId,modeId:S.model.request?.modeInfo?.modeId,modelId:S.model.request?.modelId,applyCodeBlockSuggestionId:void 0,source:void 0})})));let pe=v.createInstance(Oee);V.add(pe.walkTreeAndAnnotateReferenceLinks(e,te.element));let de=new co(()=>{let se=new ResizeObserver(()=>this.mathLayoutParticipants.forEach(Se=>Se()));return se.observe(this.domNode),V.add(Z(()=>se.disconnect())),this.mathLayoutParticipants});for(let se of this.domNode.querySelectorAll(".katex-display")){if(!Ao(se))continue;let Se=new Pa(se.cloneNode(!0),{vertical:2,horizontal:1});U.push(Se),se.replaceWith(Se.getDomNode()),de.value.add(()=>{Se.scanDomNode()}),Se.scanDomNode()}U.push(quo(this.domNode,de)),U.reverse().forEach(se=>V.add(se))};O(),T&&!xme.getExtension(Me(t.container))&&xme.loadExtension(Me(t.container)).then(()=>{O()}).catch(V=>{console.error("Failed to load MarkedKatexSupport extension:",V)})}static{this.ID_POOL=0}get codeblocks(){return this._codeblocks}renderCodeBlockPill(e,t,o,n){let r=this.instantiationService.createInstance(DPe,e,t,o);return n&&r.render(n),{object:r,isStale:()=>!1,dispose:()=>r.dispose()}}renderCodeBlock(e,t,o,n){let r=this.editorPool.get(),s=r.object;return this.codeBlockModelCollection.update(e.element.sessionResource,e.element,e.codeBlockIndex,{text:t,languageId:e.languageId,isComplete:o}).then(l=>{this._codeblocks[e.codeBlockPartIndex].codemapperUri=l.codemapperUri}),s.render(e,n).then(()=>{!this._store.isDisposed&&Rr(e.element)&&this._onDidChangeHeight.fire()}),r}hasSameContent(e){if(e.kind!=="markdownContent")return!1;if(e.content.value===this.markdown.content.value)return!0;let t=this._codeblocks.at(-1);return t&&t.codemapperUri!==void 0&&t.isStreamingEdit?e.content.value.lastIndexOf("```")===this.markdown.content.value.lastIndexOf("```"):!1}layout(e){this.allRefs.forEach((t,o)=>{if(t.object instanceof w3)t.object.layout(e);else if(t.object instanceof kme)t.object.layout(e);else if(t.object instanceof DPe){let n=this._codeblocks[o];n.codemapperUri&&t.object.uri?.toString()!==n.codemapperUri.toString()&&t.object.render(n.codemapperUri)}}),this.mathLayoutParticipants.forEach(t=>t())}onDidRemount(){for(let e of this.allRefs)e.object instanceof w3&&e.object.onDidRemount()}addDisposable(e){this._register(e)}};lT=I([m(10,X),m(11,B),m(12,Nt),m(13,F),m(14,rS)],lT);function Nxi(a){return a=a.trim(),!!a.match(/\n```+$/)}var DPe=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.sessionResource=e;this.requestId=t;this.inUndoStop=o;this.labelService=n;this.editorService=r;this.modelService=s;this.languageService=l;this.contextMenuService=c;this.contextKeyService=u;this.menuService=p;this.hoverService=h;this.chatService=g;this.configurationService=f;this.hover=this._register(new me);this.progressStore=this._store.add(new P);this.element=LPe("div.chat-codeblock-pill-container"),this.statusIndicatorContainer=LPe("div.status-indicator-container"),this.pillElement=LPe(".chat-codeblock-pill-widget"),this.pillElement.tabIndex=0,this.pillElement.classList.add("show-file-icons"),this.pillElement.role="button",this.element.appendChild(this.statusIndicatorContainer),this.element.appendChild(this.pillElement);let v=()=>this.element.classList.toggle("show-checkmarks",!!this.configurationService.getValue("accessibility.chat.showCheckmarks"));v(),this._register(this.configurationService.onDidChangeConfiguration(b=>{b.affectsConfiguration("accessibility.chat.showCheckmarks")&&v()})),this.registerListeners()}get uri(){return this._uri}registerListeners(){this._register(qMe(this.pillElement,e=>this.showDiff(e))),this._register(j(this.pillElement,re.CONTEXT_MENU,e=>{let t=new yn(Me(e),e);$t.stop(e,!0),this.contextMenuService.showContextMenu({contextKeyService:this.contextKeyService,getAnchor:()=>t,getActions:()=>{if(!this.uri)return[];let o=this.menuService.getMenuActions(D.ChatEditingCodeBlockContext,this.contextKeyService,{arg:{sessionResource:this.sessionResource,requestId:this.requestId,uri:this.uri,stopId:this.inUndoStop}});return Uc(o)}})}))}showDiff({editorOptions:e,openToSide:t}){this.currentDiff?this.editorService.openEditor({original:{resource:this.currentDiff.originalURI},modified:{resource:this.currentDiff.modifiedURI},options:e},t?vn:void 0):this.uri&&this.editorService.openEditor({resource:this.uri,options:e},t?vn:void 0)}render(e){this.progressStore.clear(),this._uri=e;let t=this.chatService.getSession(this.sessionResource),o=this.labelService.getUriBasenameLabel(e),n=_("span.status-icon"),r=_("span.status-label",{},"");this.statusIndicatorContainer.replaceChildren(n,r);let s=_("span.icon"),l=_("span.icon-label",{},o),c=_("span.label-detail",{},""),u=_("span.progress-fill");this.pillElement.replaceChildren(u,s,l,c);let p=this.labelService.getUriLabel(e,{relative:!0});this.updateTooltip(p);let h=t?.editingSession;if(!h)return;let g=Ce(S=>{let y=h.readEntry(e,S);return y&&h.getEntryDiffBetweenStops(y.modifiedURI,this.requestId,this.inUndoStop)}).map((S,y)=>S?.read(y)),f=Ce(S=>{let w=h.readEntry(e,S)?.isCurrentlyBeingModifiedBy.read(S);return!!w&&w.responseModel.requestId===this.requestId&&w.undoStopId===this.inUndoStop}),v=[],b=[];this.progressStore.add(he(S=>{if(n.classList.remove(...v),s.classList.remove(...b),f.read(S)){let y=q.modify(M.loading,"spin");v=q.asClassNameArray(y),n.classList.add(...v);let w=h.readEntry(e,S),k=Math.floor((w?.rewriteRatio.read(S)||0)*100);r.textContent=d(7128,null),this.configurationService.getValue("chat.agent.codeBlockProgress")?(u.style.width=`${k}%`,this.pillElement.classList.add("progress-filling"),c.textContent=""):(u.style.width="0%",this.pillElement.classList.remove("progress-filling"),c.textContent=k===0||!k?d(7133,null):d(7129,null,k))}else{let y=M.check;v=q.asClassNameArray(y),n.classList.add(...v),r.textContent=d(7132,null);let w=e.path.endsWith("/")?1:0;b=js(this.modelService,this.languageService,e,w),s.classList.add(...b),this.pillElement.classList.remove("progress-filling"),u.style.width="0%",c.textContent=""}})),this.progressStore.add(ux(S=>{let y=g.read(S);if(y===void 0)return;let w=this.pillElement.querySelector(".label-added")??this.pillElement.appendChild(_("span.label-added")),k=this.pillElement.querySelector(".label-removed")??this.pillElement.appendChild(_("span.label-removed"));if(y&&!y?.identical&&!y?.quitEarly){this.currentDiff=y,w.textContent=`+${y.added}`,k.textContent=`-${y.removed}`;let T=y.added===1?d(7135,null):d(7134,null,y.added),N=y.removed===1?d(7131,null):d(7130,null,y.removed),O=d(7136,null,o,T,N);this.element.ariaLabel=O,y.isFinal&&S.dispose()}}))}updateTooltip(e){this.tooltip=e,this.hover.value||(this.hover.value=this.hoverService.setupDelayedHover(this.pillElement,()=>({content:this.tooltip,style:1,position:{hoverPosition:2},persistence:{hideOnKeyDown:!0}})))}};DPe=I([m(3,ot),m(4,ee),m(5,Ct),m(6,kt),m(7,ze),m(8,X),m(9,qt),m(10,tt),m(11,Si),m(12,B)],DPe);var u2=class extends C{constructor(e,t,o,n){super();this.element=e;this._title=t;this._renderer=n;this._onDidChangeHeight=this._register(new E);this.onDidChangeHeight=this._onDidChangeHeight.event;this._renderedTitle=this._register(new me);if(e.classList.add("chat-query-title-part"),this._renderedTitle.value=n.render(this.toMdString(t),{asyncRenderCallback:()=>this._onDidChangeHeight.fire()}),e.append(this._renderedTitle.value.element),o){let r=this.toMdString(o),s=this._register(n.render(r,{asyncRenderCallback:()=>this._onDidChangeHeight.fire()})),l=document.createElement("small");l.appendChild(s.element),e.append(l)}}get title(){return this._title}set title(e){this._title=e;let t=this._renderer.render(this.toMdString(e),{asyncRenderCallback:()=>this._onDidChangeHeight.fire()}),o=this._renderedTitle.value?.element;o?.parentElement?o.replaceWith(t.element):this.element.appendChild(t.element),this._renderedTitle.value=t}toMdString(e){return typeof e=="string"?new xe("",{supportThemeIcons:!0}).appendText(e):new xe(e.value,{supportThemeIcons:!0,isTrusted:e.isTrusted})}};u2=I([m(3,Qn)],u2);var Qet=class extends C{constructor(e,t,o,n,r,s){super();this.context=e;this.instantiationService=o;this._markdownRendererService=n;this._onDidClick=this._register(new E);let{title:l,subtitle:c,message:u,buttons:p}=t,h=bt(".chat-confirmation-widget-container@container",[bt(".chat-confirmation-widget@root",[bt(".chat-confirmation-widget-title@title"),bt(".chat-confirmation-widget-message-container",[bt(".chat-confirmation-widget-message@message"),bt(".chat-buttons-container@buttonsContainer",[bt(".chat-buttons@buttons"),bt(".chat-toolbar@toolbar")])])])]);if(opo(h.container,l,u),this._domNode=h.root,this._register(o.createInstance(u2,h.title,l,c)),this.messageElement=h.message,p.forEach(g=>{let f={...Ko,small:!0,secondary:g.isSecondary,title:g.tooltip,disabled:g.disabled},v;g.moreActions?v=new $I(h.buttons,{...f,contextMenuProvider:r,addPrimaryActionToDropdown:!1,actions:g.moreActions.map(b=>b instanceof li?b:this._register(new st(b.label,b.label,void 0,!b.disabled,()=>(this._onDidClick.fire(b),Promise.resolve()))))}):v=new Mi(h.buttons,f),this._register(v),v.label=g.label,this._register(v.onDidClick(()=>this._onDidClick.fire(g))),g.onDidChangeDisablement&&this._register(g.onDidChangeDisablement(b=>v.enabled=!b))}),t?.toolbarData){let g=s.createOverlay([["chatConfirmationPartType",t.toolbarData.partType],["chatConfirmationPartSource",t.toolbarData.partSource]]),f=this._register(o.createChild(new Io([X,g])));this._register(f.createInstance(Ln,h.toolbar,D.ChatConfirmationMenu,{menuOptions:{arg:t.toolbarData.arg,shouldForwardArgs:!0}}))}}get onDidClick(){return this._onDidClick.event}get domNode(){return this._domNode}setShowButtons(e){this.domNode.classList.toggle("hideButtons",!e)}renderMessage(e){this.messageElement.append(e)}};Qet=I([m(2,F),m(3,Qn),m(4,ze),m(5,X)],Qet);var RPe=class extends Qet{constructor(i,e,t,o,n,r){super(i,e,t,o,n,r),this.updateMessage(e.message)}updateMessage(i){this._renderedMessage?.remove();let e=this._register(this._markdownRendererService.render(typeof i=="string"?new xe(i):i));this.renderMessage(e.element),this._renderedMessage=e.element}};RPe=I([m(2,F),m(3,Qn),m(4,ze),m(5,X)],RPe);var MPe=class extends C{constructor(e,t,o,n,r,s,l){super();this._context=e;this.instantiationService=o;this.markdownRendererService=n;this.contextMenuService=r;this.chatMarkdownAnchorService=l;this._onDidClick=this._register(new E);this.markdownContentPart=this._register(new me);let{title:c,subtitle:u,message:p,buttons:h,icon:g}=t,f=bt(".chat-confirmation-widget-container@container",[bt(".chat-confirmation-widget2@root",[bt(".chat-confirmation-widget-title",[bt(".chat-title@title"),bt(".chat-toolbar-container@buttonsContainer",[bt(".chat-toolbar@toolbar")])]),bt(".chat-confirmation-widget-message@message"),bt(".chat-confirmation-widget-buttons",[bt(".chat-buttons@buttons")])])]);if(opo(f.container,c,p),this._domNode=f.root,this._buttonsDomNode=f.buttons,this._register(o.createInstance(u2,f.title,new xe(g?`$(${g.id}) ${typeof c=="string"?c:c.value}`:typeof c=="string"?c:c.value),u)),this.messageElement=f.message,this.updateButtons(h),t?.toolbarData){let v=s.createOverlay([["chatConfirmationPartType",t.toolbarData.partType],["chatConfirmationPartSource",t.toolbarData.partSource]]),b=this._register(o.createChild(new Io([X,v])));this._register(b.createInstance(Ln,f.toolbar,D.ChatConfirmationMenu,{menuOptions:{arg:t.toolbarData.arg,shouldForwardArgs:!0}}))}}get onDidClick(){return this._onDidClick.event}get domNode(){return this._domNode}setShowButtons(e){this.domNode.classList.toggle("hideButtons",!e)}get codeblocksPartId(){return this.markdownContentPart.value?.codeblocksPartId}get codeblocks(){return this.markdownContentPart.value?.codeblocks}updateButtons(e){for(;this._buttonsDomNode.children.length>0;)this._buttonsDomNode.children[0].remove();for(let t of e){let o={...Ko,small:!0,secondary:t.isSecondary,title:t.tooltip,disabled:t.disabled},n;t.moreActions?n=new $I(this._buttonsDomNode,{...o,contextMenuProvider:this.contextMenuService,addPrimaryActionToDropdown:!1,actions:t.moreActions.map(r=>r instanceof li?r:this._register(new st(r.label,r.label,void 0,!r.disabled,()=>(this._onDidClick.fire(r),Promise.resolve()))))}):n=new Mi(this._buttonsDomNode,o),this._register(n),n.label=t.label,this._register(n.onDidClick(()=>this._onDidClick.fire(t))),t.onDidChangeDisablement&&this._register(t.onDidChangeDisablement(r=>n.enabled=!r))}}renderMessage(e){if(this.markdownContentPart.clear(),!Ao(e)){let t=this._register(this.instantiationService.createInstance(lT,{kind:"markdownContent",content:typeof e=="string"?new xe().appendMarkdown(e):e},this._context,this._context.editorPool,!1,this._context.codeBlockStartIndex,this.markdownRendererService,void 0,this._context.currentWidth.get(),this._context.codeBlockModelCollection,{allowInlineDiffs:!0,horizontalPadding:6}));Ck(t.domNode,this.instantiationService,this.chatMarkdownAnchorService,this._store),this.markdownContentPart.value=t,e=t.domNode}for(let t of this.messageElement.children)t.remove();this.messageElement.append(e)}};MPe=I([m(2,F),m(3,Qn),m(4,ze),m(5,X),m(6,Av)],MPe);var Kee=class extends MPe{constructor(i,e,t,o,n,r,s){super(i,e,t,o,n,r,s),this.renderMessage(e.message)}updateMessage(i){this._renderedMessage?.remove();let e=this._register(this.markdownRendererService.render(typeof i=="string"?new xe(i):i));this.renderMessage(e.element),this._renderedMessage=e.element}};Kee=I([m(2,F),m(3,Qn),m(4,ze),m(5,X),m(6,Av)],Kee);var Gee=class extends MPe{constructor(i,e,t,o,n,r,s){super(i,e,t,o,n,r,s),this.renderMessage(e.message)}};Gee=I([m(2,F),m(3,Qn),m(4,ze),m(5,X),m(6,Av)],Gee);function opo(a,i,e){a.tabIndex=0;let t=typeof i=="string"?i:i.value,o=typeof e=="string"?e:e&&"value"in e?e.value:e&&"textContent"in e?e.textContent:"";a.setAttribute("aria-label",d(7107,null,t,o)),a.classList.add("chat-confirmation-widget-container")}var PPe=class extends C{constructor(e,t,o,n,r){super();this.instantiationService=o;this.chatService=n;let s=t.element,l=e.buttons?e.buttons.map(u=>({label:u,data:e.data,isSecondary:u!==e.buttons?.[0]})):[{label:d(7105,null),data:e.data},{label:d(7106,null),data:e.data,isSecondary:!0}],c=this._register(this.instantiationService.createInstance(RPe,t,{title:e.title,buttons:l,message:e.message}));c.setShowButtons(!e.isUsed),this._register(c.onDidClick(async u=>{if(Vi(s)){let p=`${u.label}: "${e.title}"`,h=u.isSecondary?{rejectedConfirmationData:[u.data]}:{acceptedConfirmationData:[u.data]};h.agentId=s.agent?.id,h.slashCommand=s.slashCommand?.name,h.confirmation=u.label;let g=r.getWidgetBySessionResource(s.sessionResource);h.userSelectedModelId=g?.input.currentLanguageModel,h.modeInfo=g?.input.currentModeInfo,h.location=g?.location,Object.assign(h,g?.getModeRequestOptions());let f=await this.chatService.sendRequest(s.sessionResource,p,h);Gj.isSent(f)&&(e.isUsed=!0,c.setShowButtons(!1))}})),this.domNode=c.domNode}hasSameContent(e){return e.kind==="confirmation"}addDisposable(e){this._register(e)}};PPe=I([m(2,F),m(3,Si),m(4,At)],PPe);var _me=class extends C{constructor(e,t,o,n=!1,r){super();this.isSimpleWidget=n;this._pool=this._register(new LB(()=>r.createInstance(w3,e,D.ChatCodeBlock,t,o,this.isSimpleWidget)))}inUse(){return this._pool.inUse}get(){let e=this._pool.get(),t=!1;return{object:e,isStale:()=>t,dispose:()=>{e.reset(),t=!0,this._pool.release(e)}}}clear(){this._pool.clear()}};_me=I([m(4,F)],_me);var APe=class extends C{constructor(e,t,o,n=!1,r){super();this.isSimpleWidget=n;this._pool=this._register(new LB(()=>r.createInstance(fPe,e,D.ChatCompareBlock,t,o,this.isSimpleWidget)))}inUse(){return this._pool.inUse}get(){let e=this._pool.get(),t=!1;return{object:e,isStale:()=>t,dispose:()=>{e.reset(),t=!0,this._pool.release(e)}}}clear(){this._pool.clear()}};APe=I([m(4,F)],APe);var NPe=class extends C{constructor(i){super(),this._collection=new Oxi(i)}acquire(i,e,t,o){return this._collection.acquire(i.toString(),i,e,t,o)}};NPe=I([m(0,Ct)],NPe);var Oxi=class extends Ww{constructor(e){super();this.modelService=e}createReferencedObject(e,t,o,n,r){return this.modelService.createModel(o,n,t,r)}destroyReferencedObject(e,t){t.dispose()}};var Wxi="workbench.action.chat.acceptElicitation",Fxi=class extends K{constructor(){super({id:Wxi,title:L(5471,"Accept Request"),f1:!1,category:vi,keybinding:{when:x.and(ie.inChatSession,ie.Editing.hasElicitationRequest),primary:2051,weight:201}})}async run(i){let t=i.get(At).lastFocusedWidget;if(!t)return;let o=t.viewModel?.getItems();if(o?.length)for(let n=o.length-1;n>=0;n--){let r=o[n];if(Vi(r)){for(let s of r.response.value)if(s.kind==="elicitation2"&&s.state.get()==="pending"){await s.accept(!0),t.focusInput();return}}}}};function npo(){W(Fxi)}var OPe=class extends C{constructor(e,t,o,n,r,s){super();this.elicitation=e;this.instantiationService=o;this.chatAccessibilityService=n;this.contextKeyService=r;this.keybindingService=s;let l=[];if(e.kind==="elicitation2"){let p=this.keybindingService.appendKeybinding(e.acceptButtonLabel,Wxi);l.push({label:e.acceptButtonLabel,tooltip:p,data:!0,moreActions:e.moreActions?.map(g=>({label:g.label,data:g,run:g.run}))}),e.rejectButtonLabel&&e.reject&&l.push({label:e.rejectButtonLabel,data:!1,isSecondary:!0}),this._register(he(g=>{e.isHidden?.read(g)&&this.domNode.remove()}));let h=ie.Editing.hasElicitationRequest.bindTo(this.contextKeyService);this._register(he(g=>{h.set(e.state.read(g)==="pending")})),this._register(Z(()=>h.reset())),this.chatAccessibilityService.acceptElicitation(e)}let c=this._register(this.instantiationService.createInstance(Kee,t,{title:e.title,subtitle:e.subtitle,buttons:l,message:this.getMessageToRender(e),toolbarData:{partType:"elicitation",partSource:e.source?.type,arg:e}}));this._confirmWidget=c,c.setShowButtons(e.kind==="elicitation2"&&e.state.get()==="pending"),this._register(c.onDidClick(async p=>{if(e.kind!=="elicitation2")return;let h;typeof p.data=="boolean"&&p.data===!0||p.data&&typeof p.data=="object"&&"run"in p.data&&"label"in p.data?h=p.data:h=void 0,h!==void 0?await e.accept(h):e.reject&&await e.reject(),c.setShowButtons(!1),c.updateMessage(this.getMessageToRender(e))})),this.domNode=c.domNode,this.domNode.tabIndex=0;let u=this.getMessageToRender(e);this.domNode.ariaLabel=e.title+" "+(typeof u=="string"?u:u.value||"")}get codeblocks(){return this._confirmWidget.codeblocks}get codeblocksPartId(){return this._confirmWidget.codeblocksPartId}getMessageToRender(e){if(!e.acceptedResult)return e.message;let t=Mr(e.message)?xe.lift(e.message):new xe(e.message);return t.appendCodeblock("json",JSON.stringify(e.acceptedResult,null,2)),t}hasSameContent(e){return e===this.elicitation}addDisposable(e){this._register(e)}};OPe=I([m(2,F),m(3,NO),m(4,X),m(5,_e)],OPe);var rpo=_,FPe=class extends C{constructor(e,t,o,n){super();this.errorDetails=o;this.domNode=this._register(new Dme(e,t,n)).domNode}hasSameContent(e){return e.kind===this.errorDetails.kind}},Dme=class extends C{constructor(i,e,t){super(),this.domNode=rpo(".chat-notification-widget"),this.domNode.tabIndex=0;let o,n;switch(i){case 1:o=M.warning,n=".chat-warning-codicon";break;case 2:o=M.error,n=".chat-error-codicon";break;case 0:o=M.info,n=".chat-info-codicon";break}this.domNode.appendChild(rpo(n,void 0,Qo(o)));let r=this._register(t.render(e));this.domNode.appendChild(r.element)}};var apo=_,WPe=class extends C{constructor(e,t,o,n,r,s,l,c,u,p){super();this.errorDetails=o;this.chatAccessibilityService=p;let h=s.element;ydo(h),this.domNode=apo(".chat-error-confirmation"),this.domNode.append(this._register(new Dme(e,t,r)).domNode);let g={...Ko},f=R(this.domNode,apo(".chat-buttons-container"));n.forEach(v=>{let b=this._register(new Mi(f,g));b.label=v.label,this._register(b.onDidClick(async()=>{let S=v.label,y=v.isSecondary?{rejectedConfirmationData:[v.data]}:{acceptedConfirmationData:[v.data]};y.agentId=h.agent?.id,y.slashCommand=h.slashCommand?.name,y.confirmation=v.label;let w=c.getWidgetBySessionResource(h.sessionResource);y.userSelectedModelId=w?.input.currentLanguageModel,Object.assign(y,w?.getModeRequestOptions()),this.chatAccessibilityService.acceptRequest(h.sessionResource),await u.sendRequest(h.sessionResource,S,y)}))})}hasSameContent(e){return e.kind===this.errorDetails.kind&&e.isLast===this.errorDetails.isLast}addDisposable(e){this._register(e)}};WPe=I([m(6,F),m(7,At),m(8,Si),m(9,NO)],WPe);var e9o="workbench.action.chat.previousQuestion",t9o="workbench.action.chat.nextQuestion",k3=class extends C{constructor(e,t,o,n,r,s,l,c){super();this.carousel=e;this._options=o;this._markdownRendererService=n;this._hoverService=r;this._accessibilityService=s;this._contextKeyService=l;this._keybindingService=c;this._onDidChangeHeight=this._register(new E);this.onDidChangeHeight=this._onDidChangeHeight.event;this._currentIndex=0;this._answers=new Map;this._isSkipped=!1;this._textInputBoxes=new Map;this._singleSelectItems=new Map;this._multiSelectCheckboxes=new Map;this._freeformTextareas=new Map;this._inputBoxes=this._register(new P);this._questionRenderStore=this._register(new me);this._interactiveUIStore=this._register(new me);this.domNode=_(".chat-question-carousel-container"),this._inChatQuestionCarouselContextKey=ie.inChatQuestionCarousel.bindTo(this._contextKeyService);let u=this._register(Vn(this.domNode));if(this._register(u.onDidFocus(()=>this._inChatQuestionCarouselContextKey.set(!0))),this._register(u.onDidBlur(()=>this._inChatQuestionCarouselContextKey.set(!1))),this._register({dispose:()=>this._inChatQuestionCarouselContextKey.reset()}),this.domNode.tabIndex=0,this.domNode.setAttribute("role","region"),this.domNode.setAttribute("aria-roledescription",d(7160,null)),this._updateAriaLabel(),e instanceof a2&&(typeof e.draftCurrentIndex=="number"&&(this._currentIndex=Math.max(0,Math.min(e.draftCurrentIndex,e.questions.length-1))),e.draftAnswers))for(let[g,f]of Object.entries(e.draftAnswers))this._answers.set(g,f);if(e.data)for(let[g,f]of Object.entries(e.data))this._answers.set(g,f);let p=Vi(t.element)&&t.element.isComplete;if(e.isUsed||p){this._isSkipped=!0,this.domNode.classList.add("chat-question-carousel-used"),this.renderSummary();return}let h=new P;if(this._interactiveUIStore.value=h,this._questionContainer=_(".chat-question-carousel-content"),this.domNode.append(this._questionContainer),e.allowSkip){this._closeButtonContainer=_(".chat-question-close-container");let g=d(7162,null),f=h.add(new Mi(this._closeButtonContainer,{...Ko,secondary:!0,supportIcons:!0}));f.label=`$(${M.close.id})`,f.element.classList.add("chat-question-close"),f.element.setAttribute("aria-label",g),h.add(this._hoverService.setupDelayedHover(f.element,{content:g})),this._skipAllButton=f}this._skipAllButton&&h.add(this._skipAllButton.onDidClick(()=>this.ignore())),h.add(j(this.domNode,re.KEY_DOWN,g=>{let f=new Ii(g);if(f.keyCode===9&&this.carousel.allowSkip)g.preventDefault(),g.stopPropagation(),this.ignore();else if(f.keyCode===3&&(f.metaKey||f.ctrlKey))g.preventDefault(),g.stopPropagation(),this.submit();else if(f.keyCode===3&&!f.shiftKey){let v=g.target,b=v.tagName==="INPUT"&&v.type==="text",S=v.tagName==="TEXTAREA"&&v.classList.contains("chat-question-freeform-textarea");(b||S)&&(g.preventDefault(),g.stopPropagation(),this.handleNextOrSubmit())}else(f.ctrlKey||f.metaKey)&&(f.keyCode===1||f.keyCode===20)&&g.stopPropagation()})),this.renderCurrentQuestion()}saveCurrentAnswer(){let e=this.carousel.questions[this._currentIndex],t=this.getCurrentAnswer();t!==void 0?this._answers.set(e.id,t):this._answers.delete(e.id),this.persistDraftState()}persistDraftState(){this.carousel.isUsed||!(this.carousel instanceof a2)||(this.carousel.draftAnswers=Object.fromEntries(this._answers.entries()),this.carousel.draftCurrentIndex=this._currentIndex)}navigate(e){let t=this._currentIndex+e;t>=0&&t<this.carousel.questions.length&&(this.saveCurrentAnswer(),this._currentIndex=t,this.persistDraftState(),this.renderCurrentQuestion(!0),this.domNode.focus())}handleNextOrSubmit(){this.saveCurrentAnswer(),this._currentIndex<this.carousel.questions.length-1?(this._currentIndex++,this.persistDraftState(),this.renderCurrentQuestion(!0)):(this._options.onSubmit(this._answers),this.hideAndShowSummary())}submit(){this.saveCurrentAnswer(),this._options.onSubmit(this._answers),this.hideAndShowSummary()}_focusContainerAndAnnounce(){this.domNode.focus();let e=this.carousel.questions[this._currentIndex];if(e){let t=e.message??e.title,o=this.getQuestionText(t),n=this.carousel.questions.length,r=n===1?o:d(7159,null,this._currentIndex+1,n,o);this._accessibilityService.alert(r)}}hideAndShowSummary(){this._isSkipped=!0,this.domNode.classList.add("chat-question-carousel-used"),this.clearInteractiveResources(),Rt(this.domNode),this.renderSummary(),this._onDidChangeHeight.fire()}clearInteractiveResources(){this._interactiveUIStore.clear(),this._questionRenderStore.clear(),this._inputBoxes.clear(),this._textInputBoxes.clear(),this._singleSelectItems.clear(),this._multiSelectCheckboxes.clear(),this._freeformTextareas.clear(),this._prevButton=void 0,this._nextButton=void 0,this._submitButton=void 0,this._skipAllButton=void 0,this._questionContainer=void 0,this._closeButtonContainer=void 0,this._footerRow=void 0,this._stepIndicator=void 0,this._submitHint=void 0,this._inputScrollable=void 0}layoutInputScrollable(e){if(!this._questionContainer)return;let t=e.getDomNode(),o=t.firstElementChild;if(!Ao(o))return;(t.style.height!==""||t.style.maxHeight!=="")&&(t.style.height="",t.style.maxHeight=""),(o.style.height!==""||o.style.maxHeight!=="")&&(o.style.height="",o.style.maxHeight="");let n=this._questionContainer.clientHeight,r=Me(this._questionContainer).getComputedStyle(this._questionContainer),s=Number.parseFloat(r.paddingTop||"0")+Number.parseFloat(r.paddingBottom||"0"),l=Array.from(this._questionContainer.children).filter(g=>g!==t).reduce((g,f)=>g+f.offsetHeight,0),c=Math.floor(n-s-l),u=o.scrollHeight,h=`${Math.max(0,Math.min(c,u))}px`;(t.style.height!==h||t.style.maxHeight!==h)&&(t.style.height=h,t.style.maxHeight=h),(o.style.height!==h||o.style.maxHeight!==h)&&(o.style.height=h,o.style.maxHeight=h),e.scanDomNode()}skip(){if(this._isSkipped||!this.carousel.allowSkip)return!1;let e=this.getDefaultAnswers();this._options.onSubmit(e),this._answers.clear();for(let[t,o]of e)this._answers.set(t,o);return this.hideAndShowSummary(),!0}ignore(){return this._isSkipped||!this.carousel.allowSkip?!1:(this._isSkipped=!0,this._options.onSubmit(void 0),this.clearInteractiveResources(),this.domNode.classList.add("chat-question-carousel-used"),Rt(this.domNode),this.renderSkippedMessage(),this._onDidChangeHeight.fire(),!0)}getDefaultAnswers(){let e=new Map;for(let t of this.carousel.questions){let o=this.getDefaultAnswerForQuestion(t);o!==void 0&&e.set(t.id,o)}return e}getDefaultAnswerForQuestion(e){switch(e.type){case"text":return e.defaultValue;case"singleSelect":{let t=typeof e.defaultValue=="string"?e.defaultValue:void 0,n=(t!==void 0?e.options?.find(r=>r.id===t):void 0)?.value;return n!==void 0?{selectedValue:n,freeformValue:void 0}:void 0}case"multiSelect":{let t=Array.isArray(e.defaultValue)?e.defaultValue:typeof e.defaultValue=="string"?[e.defaultValue]:[],o=e.options?.filter(n=>t.includes(n.id)).map(n=>n.value).filter(n=>n!==void 0)??[];return o.length>0?{selectedValues:o,freeformValue:void 0}:void 0}default:return e.defaultValue}}_shouldAutoFocus(){return this._options.shouldAutoFocus===!1?!1:!this._accessibilityService.isScreenReaderOptimized()}_updateAriaLabel(){let e=this.carousel.questions[this._currentIndex];if(!e){this.domNode.setAttribute("aria-label",d(7152,null));return}let t=e.message??e.title,o=this.getQuestionText(t),n=this.carousel.questions.length;n===1?this.domNode.setAttribute("aria-label",d(7161,null,o)):this.domNode.setAttribute("aria-label",d(7155,null,this._currentIndex+1,n,o))}focus(){this.domNode.focus()}hasFocus(){return ts(this.domNode)}navigateToPreviousQuestion(){return this._currentIndex<=0?!1:(this.navigate(-1),!0)}navigateToNextQuestion(){return this._currentIndex>=this.carousel.questions.length-1?!1:(this.navigate(1),!0)}renderCurrentQuestion(e=!1){if(!this._questionContainer)return;let t=new P;this._questionRenderStore.value=t,this._inputScrollable=void 0,this._inputBoxes.clear(),this._textInputBoxes.clear(),this._singleSelectItems.clear(),this._multiSelectCheckboxes.clear(),this._freeformTextareas.clear(),Rt(this._questionContainer);let o=this.carousel.questions[this._currentIndex];if(!o)return;let n=_(".chat-question-header-row"),r=_(".chat-question-title-row"),s=o.message??o.title;if(s){let b=_(".chat-question-title"),S=this.getQuestionText(s);b.setAttribute("aria-label",S);let y=Mr(s)?xe.lift(s):new xe(s),w=t.add(this._markdownRendererService.render(y));b.appendChild(w.element),r.appendChild(b)}n.appendChild(r),this._closeButtonContainer&&r.appendChild(this._closeButtonContainer),this._questionContainer.appendChild(n);let l=_(".chat-question-input-container");this.renderInput(l,o);let c=t.add(new Pa(l,{vertical:3,horizontal:2,consumeMouseWheelIfScrollbarIsNeeded:!0}));this._inputScrollable=c;let u=c.getDomNode();u.classList.add("chat-question-input-scrollable"),this._questionContainer.appendChild(u),this.carousel.questions.length===1?this.renderSingleQuestionFooter():this.renderFooter();let h=!1,g=t.add(new me),f=()=>{h||(h=!0,g.value=Ah(Me(this.domNode),()=>{h=!1,this.layoutInputScrollable(c)}))},v=t.add(new eL(()=>f()));t.add(v.observe(u)),t.add(v.observe(l)),f(),t.add(Ah(Me(this.domNode),()=>{l.scrollTop=0,l.scrollLeft=0,c.setScrollPosition({scrollTop:0,scrollLeft:0}),c.scanDomNode()})),this._updateAriaLabel(),e&&this._accessibilityService.isScreenReaderOptimized()&&this._focusContainerAndAnnounce(),this._onDidChangeHeight.fire()}renderFooter(){if(!this._footerRow){let e=this._interactiveUIStore.value;if(!e)return;this._footerRow=_(".chat-question-footer-row");let t=_(".chat-question-footer-left.chat-question-carousel-nav");t.setAttribute("role","navigation"),t.setAttribute("aria-label",d(7156,null));let o=_(".chat-question-nav-arrows"),n=this.getLabelWithKeybinding(d(7170,null),e9o),r=e.add(new Mi(o,{...Ko,secondary:!0,supportIcons:!0}));r.element.classList.add("chat-question-nav-arrow","chat-question-nav-prev"),r.label=`$(${M.chevronLeft.id})`,r.element.setAttribute("aria-label",n),e.add(this._hoverService.setupDelayedHover(r.element,{content:n})),e.add(r.onDidClick(()=>this.navigate(-1))),this._prevButton=r;let s=this.getLabelWithKeybinding(d(7169,null),t9o),l=e.add(new Mi(o,{...Ko,secondary:!0,supportIcons:!0}));l.element.classList.add("chat-question-nav-arrow","chat-question-nav-next"),l.label=`$(${M.chevronRight.id})`,l.element.setAttribute("aria-label",s),e.add(this._hoverService.setupDelayedHover(l.element,{content:s})),e.add(l.onDidClick(()=>this.navigate(1))),this._nextButton=l,t.appendChild(o),this._stepIndicator=_(".chat-question-step-indicator"),t.appendChild(this._stepIndicator),this._footerRow.appendChild(t);let c=_(".chat-question-footer-right"),u=_("span.chat-question-submit-hint");u.textContent=it?d(7165,null):d(7166,null),c.appendChild(u),this._submitHint=u;let p=e.add(new Mi(c,{...Ko}));p.element.classList.add("chat-question-submit-button"),p.label=d(7171,null),e.add(p.onDidClick(()=>this.submit())),this._submitButton=p,this._footerRow.appendChild(c),this.domNode.append(this._footerRow)}this.updateFooterState()}updateFooterState(){if(this._prevButton&&(this._prevButton.enabled=this._currentIndex>0),this._nextButton&&(this._nextButton.enabled=this._currentIndex<this.carousel.questions.length-1),this._stepIndicator&&(this._stepIndicator.textContent=d(7164,null,this._currentIndex+1,this.carousel.questions.length)),this._submitButton){let e=this._currentIndex===this.carousel.questions.length-1;this._submitButton.element.style.display=e?"":"none",this._submitHint&&(this._submitHint.style.display=e?"":"none")}}renderSingleQuestionFooter(){if(!this._footerRow){let e=this._interactiveUIStore.value;if(!e)return;this._footerRow=_(".chat-question-footer-row");let t=_(".chat-question-footer-left.chat-question-carousel-nav");t.setAttribute("role","navigation"),t.setAttribute("aria-label",d(7156,null)),this._footerRow.appendChild(t);let o=_(".chat-question-footer-right"),n=_("span.chat-question-submit-hint");n.textContent=it?d(7165,null):d(7166,null),o.appendChild(n),this._submitHint=n;let r=e.add(new Mi(o,{...Ko}));r.element.classList.add("chat-question-submit-button"),r.label=d(7171,null),e.add(r.onDidClick(()=>this.submit())),this._submitButton=r,this._footerRow.appendChild(o),this.domNode.append(this._footerRow)}}getLabelWithKeybinding(e,t){let o=this._keybindingService.lookupKeybinding(t,this._contextKeyService)?.getLabel();return o?d(7153,null,e,o):e}renderInput(e,t){switch(t.type){case"text":this.renderTextInput(e,t);break;case"singleSelect":this.renderSingleSelect(e,t);break;case"multiSelect":this.renderMultiSelect(e,t);break}}setupTextareaAutoResize(e){let t=()=>{e.style.height="auto",e.style.height=`${Math.min(e.scrollHeight,200)}px`,this._inputScrollable&&this.layoutInputScrollable(this._inputScrollable),this._onDidChangeHeight.fire()};return this._inputBoxes.add(j(e,re.INPUT,t)),t}renderTextInput(e,t){let o=this._inputBoxes.add(new Dc(e,void 0,{placeholder:d(7151,null),inputBoxStyles:pl}));this._inputBoxes.add(o.onDidChange(()=>this.saveCurrentAnswer()));let n=this._answers.get(t.id);n!==void 0?o.value=String(n):t.defaultValue!==void 0&&(o.value=String(t.defaultValue)),this._textInputBoxes.set(t.id,o),this._shouldAutoFocus()&&this._inputBoxes.add(Ah(Me(o.element),()=>o.focus()))}renderSingleSelect(e,t){let o=t.options||[],n=_(".chat-question-list");n.setAttribute("role","listbox"),n.setAttribute("aria-label",t.title),n.tabIndex=0,e.appendChild(n);let r=this._answers.get(t.id),s=typeof r=="object"&&r!==null&&Wo(r,{freeformValue:!0})?r.freeformValue:void 0,l=typeof r=="object"&&r!==null&&Wo(r,{selectedValue:!0})?r.selectedValue:r,c=typeof t.defaultValue=="string"?t.defaultValue:void 0,u=-1;o.forEach((y,w)=>{(l!==void 0&&y.value===l||u===-1&&!s&&c!==void 0&&y.id===c)&&(u=w)});let p=[],h=[],g=y=>{p.forEach((k,T)=>{let N=T===y;k.classList.toggle("selected",N),k.setAttribute("aria-selected",String(N));let O=h[T];O.classList.toggle("codicon",N),O.classList.toggle("codicon-check",N)}),y>=0&&y<p.length&&n.setAttribute("aria-activedescendant",p[y].id);let w=this._singleSelectItems.get(t.id);w&&(w.selectedIndex=y),this.saveCurrentAnswer()};o.forEach((y,w)=>{let k=w===u,T=_(".chat-question-list-item");T.setAttribute("role","option"),T.setAttribute("aria-selected",String(k)),T.setAttribute("aria-label",d(7158,null,w+1,y.label)),T.id=`option-${t.id}-${w}`,T.tabIndex=-1;let N=_(".chat-question-list-number");N.textContent=`${w+1}`,T.appendChild(N);let O=_(".chat-question-list-indicator");k&&O.classList.add("codicon","codicon-check"),h.push(O);let V=_(".chat-question-list-label"),U=y.label.indexOf(" - ");if(U!==-1){T.classList.add("has-description");let G=_("span.chat-question-list-label-title");G.textContent=y.label.substring(0,U),V.appendChild(G);let $=_("span.chat-question-list-label-desc");$.textContent=y.label.substring(U+3),V.appendChild($)}else V.textContent=y.label;T.appendChild(V),T.appendChild(O),k&&T.classList.add("selected"),this._inputBoxes.add(j(T,re.CLICK,G=>{G.preventDefault(),G.stopPropagation(),g(w);let $=this._freeformTextareas.get(t.id);$&&($.value=""),this.handleNextOrSubmit()})),this._inputBoxes.add(this._hoverService.setupDelayedHover(T,{content:y.label,position:{hoverPosition:2},appearance:{showPointer:!0}})),n.appendChild(T),p.push(T)}),this._singleSelectItems.set(t.id,{items:p,selectedIndex:u}),u>=0&&u<p.length&&n.setAttribute("aria-activedescendant",p[u].id);let f=_(".chat-question-freeform"),v=_(".chat-question-freeform-number");v.textContent=`${o.length+1}`,f.appendChild(v);let b=_("textarea.chat-question-freeform-textarea");b.placeholder=d(7150,null),b.rows=1,s!==void 0&&(b.value=s);let S=this.setupTextareaAutoResize(b);if(this._inputBoxes.add(j(b,re.INPUT,()=>{b.value.length>0?g(-1):this.saveCurrentAnswer()})),f.appendChild(b),e.appendChild(f),this._freeformTextareas.set(t.id,b),this._inputBoxes.add(j(n,re.KEY_DOWN,y=>{let w=new Ii(y),k=this._singleSelectItems.get(t.id);if(!k||!p.length)return;let T=k.selectedIndex;if(w.keyCode===18)y.preventDefault(),T=Math.min(k.selectedIndex+1,p.length-1);else if(w.keyCode===16)y.preventDefault(),T=Math.max(k.selectedIndex-1,0);else if((w.keyCode===3||w.keyCode===10)&&!w.metaKey&&!w.ctrlKey){y.preventDefault(),y.stopPropagation(),this.handleNextOrSubmit();return}else if(w.keyCode>=22&&w.keyCode<=30){let N=w.keyCode-22;N<p.length?(y.preventDefault(),g(N)):N===p.length&&(y.preventDefault(),g(-1),b.focus());return}T!==k.selectedIndex&&T>=0&&g(T)})),s!==void 0&&this._inputBoxes.add(Ah(Me(b),()=>S())),this._shouldAutoFocus()){if(s)this._inputBoxes.add(Ah(Me(b),()=>{b.focus()}));else if(p.length>0){let y=u>=0?u:0;u<0&&g(0),this._inputBoxes.add(Ah(Me(n),()=>{p[y]?.focus()}))}}}renderMultiSelect(e,t){let o=t.options||[],n=_(".chat-question-list");n.setAttribute("role","listbox"),n.setAttribute("aria-multiselectable","true"),n.setAttribute("aria-label",t.title),n.tabIndex=0,e.appendChild(n);let r=this._answers.get(t.id),s=typeof r=="object"&&r!==null&&Wo(r,{freeformValue:!0})?r.freeformValue:void 0,l=typeof r=="object"&&r!==null&&Wo(r,{selectedValues:!0})?r.selectedValues:Array.isArray(r)?r:[],c=Array.isArray(t.defaultValue)?t.defaultValue:typeof t.defaultValue=="string"?[t.defaultValue]:[],u=[],p=[],h=0,g=-1;o.forEach((y,w)=>{let k=!1;l&&l.length>0?k=l.includes(y.value):!s&&c.includes(y.id)&&(k=!0);let T=_(".chat-question-list-item.multi-select");T.setAttribute("role","option"),T.setAttribute("aria-selected",String(k)),T.setAttribute("aria-label",d(7158,null,w+1,y.label)),T.id=`option-${t.id}-${w}`,T.tabIndex=-1;let N=_(".chat-question-list-number");N.textContent=`${w+1}`,T.appendChild(N);let O=this._inputBoxes.add(new hv(y.label,k,kf));O.domNode.classList.add("chat-question-list-checkbox"),O.domNode.tabIndex=-1,T.appendChild(O.domNode);let V=_(".chat-question-list-label"),U=y.label.indexOf(" - ");if(U!==-1){T.classList.add("has-description");let G=_("span.chat-question-list-label-title");G.textContent=y.label.substring(0,U),V.appendChild(G);let $=_("span.chat-question-list-label-desc");$.textContent=y.label.substring(U+3),V.appendChild($)}else V.textContent=y.label;T.appendChild(V),k&&(T.classList.add("checked"),g===-1&&(g=w)),this._inputBoxes.add(O.onChange(()=>{T.classList.toggle("checked",O.checked),T.setAttribute("aria-selected",String(O.checked)),this.saveCurrentAnswer()})),this._inputBoxes.add(j(T,re.CLICK,G=>{h=w,G.target!==O.domNode&&!O.domNode.contains(G.target)&&O.domNode.click()})),this._inputBoxes.add(this._hoverService.setupDelayedHover(T,{content:y.label,position:{hoverPosition:2},appearance:{showPointer:!0}})),n.appendChild(T),u.push(O),p.push(T)}),this._multiSelectCheckboxes.set(t.id,u);let f=_(".chat-question-freeform"),v=_(".chat-question-freeform-number");v.textContent=`${o.length+1}`,f.appendChild(v);let b=_("textarea.chat-question-freeform-textarea");b.placeholder=d(7150,null),b.rows=1,s!==void 0&&(b.value=s);let S=this.setupTextareaAutoResize(b);if(this._inputBoxes.add(j(b,re.INPUT,()=>this.saveCurrentAnswer())),f.appendChild(b),e.appendChild(f),this._freeformTextareas.set(t.id,b),this._inputBoxes.add(j(n,re.KEY_DOWN,y=>{let w=new Ii(y);if(p.length){if(w.keyCode===18)y.preventDefault(),h=Math.min(h+1,p.length-1),p[h].focus();else if(w.keyCode===16)y.preventDefault(),h=Math.max(h-1,0),p[h].focus();else if(w.keyCode===3&&!w.metaKey&&!w.ctrlKey)y.preventDefault(),y.stopPropagation(),this.handleNextOrSubmit();else if(w.keyCode===10)y.preventDefault(),h>=0&&h<u.length&&u[h].domNode.click();else if(w.keyCode>=22&&w.keyCode<=30){let k=w.keyCode-22;k<u.length?(y.preventDefault(),u[k].domNode.click()):k===u.length&&(y.preventDefault(),b.focus())}}})),s!==void 0&&this._inputBoxes.add(Ah(Me(b),()=>S())),this._shouldAutoFocus()){if(s)this._inputBoxes.add(Ah(Me(b),()=>{b.focus()}));else if(p.length>0){let y=g>=0?g:0;h=y,this._inputBoxes.add(Ah(Me(n),()=>{p[y]?.focus()}))}}}getCurrentAnswer(){let e=this.carousel.questions[this._currentIndex];if(e)switch(e.type){case"text":return this._textInputBoxes.get(e.id)?.value??e.defaultValue;case"singleSelect":{let t=this._singleSelectItems.get(e.id),o;t&&t.selectedIndex>=0&&(o=e.options?.[t.selectedIndex]?.value),o===void 0&&typeof e.defaultValue=="string"&&(o=e.options?.find(l=>l.id===e.defaultValue)?.value);let n=this._freeformTextareas.get(e.id),r=n?.value!==""?n?.value:void 0;return r?{selectedValue:void 0,freeformValue:r}:o!==void 0?{selectedValue:o,freeformValue:void 0}:void 0}case"multiSelect":{let t=this._multiSelectCheckboxes.get(e.id),o=[];t&&t.forEach((s,l)=>{if(s.checked){let c=e.options?.[l]?.value;c!==void 0&&o.push(c)}});let n=this._freeformTextareas.get(e.id),r=n?.value!==""?n?.value:void 0;return r||o.length>0?{selectedValues:o,freeformValue:r}:void 0}default:return e.defaultValue}}renderSkippedMessage(){let e=_(".chat-question-carousel-summary"),t=_(".chat-question-summary-skipped");t.textContent=d(7163,null),e.appendChild(t),this.domNode.appendChild(e)}renderSummary(){if(this._answers.size===0){this.carousel.isUsed&&this.renderSkippedMessage();return}let e=_(".chat-question-carousel-summary");for(let t of this.carousel.questions){let o=this._answers.get(t.id),n=_(".chat-question-summary-item"),r=_("div.chat-question-summary-label"),s=t.message??t.title,l=typeof s=="string"?s:s.value;if(l=l.replace(/[:\s]+$/,""),r.textContent=d(7168,null,l),n.appendChild(r),o!==void 0){let c=this.formatAnswerForSummary(t,o),u=_("div.chat-question-summary-answer-title");u.textContent=d(7167,null,c),n.appendChild(u)}else{let c=_("div.chat-question-summary-unanswered");c.textContent=d(7157,null),n.appendChild(c)}e.appendChild(n)}this.domNode.appendChild(e)}formatAnswerForSummary(e,t){switch(e.type){case"text":return String(t);case"singleSelect":{if(typeof t=="object"&&t!==null&&Wo(t,{selectedValue:!0})){let{selectedValue:n,freeformValue:r}=t,s=e.options?.find(l=>l.value===n)?.label;return r||(s??String(n??""))}return typeof t=="object"&&t!==null&&Wo(t,{freeformValue:!0})?t.freeformValue??"":e.options?.find(n=>n.value===t)?.label??String(t)}case"multiSelect":{if(typeof t=="object"&&t!==null&&Wo(t,{selectedValues:!0})){let{selectedValues:o,freeformValue:n}=t,r=(o??[]).map(s=>e.options?.find(l=>l.value===s)?.label??String(s));return n&&r.push(n),r.join(d(7154,null))}return Array.isArray(t)?t.map(o=>e.options?.find(n=>n.value===o)?.label??String(o)).join(d(7154,null)):String(t)}default:return String(t)}}getQuestionText(e){let t=typeof e=="string"?new xe(e):e;return qa(t)}hasSameContent(e,t,o){return!this._isSkipped&&!this.carousel.isUsed&&Vi(o)&&o.isComplete?!1:e.kind==="questionCarousel"&&e===this.carousel}addDisposable(e){this._register(e)}dispose(){!this._isSkipped&&!this.carousel.isUsed&&this.saveCurrentAnswer(),super.dispose()}};k3=I([m(3,Qn),m(4,tt),m(5,Bi),m(6,X),m(7,_e)],k3);function DHt(a,i,e=5e3){return new Promise((t,o)=>{let n=new P;n.add(he(r=>{let l=a.servers.read(r).find(i);l&&(l.start({promptType:"all-untrusted"}).then(c=>{c.state===ir.Kind.Error&&l.showOutput()}),t(),n.dispose())})),n.add(nn(()=>{n.dispose(),o(new ho)},e))})}async function n0(a,i,e){let t=await a.start(i),o=new P,n=await new Promise(r=>{if(e?.isCancellationRequested||t.state===ir.Kind.Error||t.state===ir.Kind.Stopped)return r(!1);e&&o.add(e.onCancellationRequested(()=>{r(!1)})),o.add(he(s=>{let l=a.connectionState.read(s).state;(l===ir.Kind.Error||l===ir.Kind.Stopped)&&r(!1),a.cacheState.read(s)===5&&r(!0)}))});return o.dispose(),n&&await Pi(0),n}function BPe(a,i){let e=a.serverMetadata.read(i);return{type:"mcp",serverLabel:e?.serverName,instructions:e?.serverInstructions,label:a.definition.label,collectionId:a.collection.id,definitionId:a.definition.id}}function lpo(a,i){let e=!1;if(a.protocol==="http:"){let t=i?.connection.get()?.launchDefinition;t&&t.type===2&&t.uri.authority.toLowerCase()===a.host.toLowerCase()&&(e=!0)}else a.protocol==="https:"&&(e=!0);return e}function cpo(a){return a.task!==void 0}function dpo(a,i,e){return new Promise(t=>{ux(o=>{if(e){if(e.isCancellationRequested){o.dispose(),t(void 0);return}o.store.add(e.onCancellationRequested(()=>{o.dispose(),t(void 0)}))}let r=a.servers.read(o).find(i);r&&(t(r),o.dispose())})})}function LHt(a,i,e=""){let t=typeof i.data=="string"?i.data:JSON.stringify(i.data);switch(i.logger&&(t=`${i.logger}: ${t}`),e&&(t=`${e} ${t}`),i?.level){case"debug":a.debug(t);break;case"info":case"notice":a.info(t);break;case"warning":a.warn(t);break;case"error":case"critical":case"alert":case"emergency":a.error(t);break;default:a.info(t);break}}function $ee(a){let i=lo.executionConfirmedOrDenied(a);if(!(!i||typeof i=="boolean"))return i9o(i)}function i9o(a){let i;switch(a.type){case 2:i=d(7317,null,qy({title:"`"+a.id+"`",id:"workbench.action.openSettings",arguments:[a.id]},!1));break;case 3:i=a.scope==="session"?d(7315,null):a.scope==="workspace"?d(7316,null):d(7314,null),i+=" ("+qy({title:d(7318,null),id:"workbench.action.chat.editToolApproval",arguments:[a.scope]})+")";break;case 1:return a.reason?typeof a.reason=="string"?new xe(a.reason,{isTrusted:!0}):a.reason:void 0;case 4:case 0:default:return}return new xe(i,{isTrusted:!0})}var fD=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.chatContentMarkdownRenderer=t;this.toolInvocation=l;this.instantiationService=u;this.chatMarkdownAnchorService=p;this.configurationService=h;this.renderedMessage=this._register(new me);this._fileWidgetStore=this._register(new P);this.currentContent=e.content;let g=o.content.slice(o.contentIndex+1);if(this.showSpinner=n??upo(g,o.element),this.isHidden=r!==!0&&g.some(k=>k.kind!=="progressMessage"),this.isHidden){this.domNode=_("");return}this.showSpinner&&this.configurationService.getValue("accessibility.verboseChatProgressUpdates")&&Jo(fu(qa(e.content)));let f=s&&q.isEqual(s,q.modify(M.loading,"spin")),v=(c??(!s||f))&&this.showSpinner,b=v?M.check:s??(this.showSpinner?q.modify(M.loading,"spin"):M.check),S=this.chatContentMarkdownRenderer.render(e.content);S.element.classList.add("progress-step"),Ck(S.element,this.instantiationService,this.chatMarkdownAnchorService,this._fileWidgetStore);let y=this.createApprovalMessage(),w=this._register(u.createInstance(vA,S.element,b,y));this.domNode=w.domNode,v&&this.domNode.classList.add("shimmer-progress"),this.renderedMessage.value=S}updateMessage(e){if(this.isHidden)return;let t=this._register(this.chatContentMarkdownRenderer.render(e));t.element.classList.add("progress-step"),this._fileWidgetStore.clear(),Ck(t.element,this.instantiationService,this.chatMarkdownAnchorService,this._fileWidgetStore),this.renderedMessage.value?this.renderedMessage.value.element.replaceWith(t.element):this.domNode.appendChild(t.element),this.renderedMessage.value=t}hasSameContent(e,t,o){if(t.some(r=>r.kind!=="progressMessage")&&!this.isHidden)return!1;let n=upo(t,o);return e.kind==="progressMessage"&&e.content.value!==this.currentContent.value?!1:e.kind==="progressMessage"&&this.showSpinner===n}createApprovalMessage(){return this.toolInvocation&&$ee(this.toolInvocation)}};fD=I([m(8,F),m(9,Av),m(10,B)],fD);function upo(a,i){return Vi(i)&&!i.isComplete&&a.length===0}var vA=class extends C{constructor(i,e,t,o){super(),this.domNode=_(".progress-container");let n=_("div");n.classList.add(...q.asClassNameArray(e)),t&&(this._register(o.setupDelayedHover(n,{content:t,style:1})),this._register(o.setupDelayedHover(i,{content:t,style:1}))),R(this.domNode,n),i.classList.add("progress-step"),R(this.domNode,i)}};vA=I([m(3,tt)],vA);var Lme=class extends fD{constructor(i,e,t,o,n,r,s){let l={kind:"progressMessage",content:new xe().appendText(d(7149,null))};super(l,e,t,void 0,void 0,void 0,void 0,!0,o,n,r),this._register(s.onDidPrepareToolCallBecomeUnresponsive(c=>{Xe(t.element.sessionResource,c.sessionResource)&&this.updateMessage(new xe(d(7148,null,c.toolData.displayName)))}))}hasSameContent(i,e,t){return i.kind==="working"}};Lme=I([m(3,F),m(4,Av),m(5,B),m(6,jn)],Lme);var HPe=class extends C{constructor(e,t,o,n,r,s){super();this.data=e;this.context=t;this.mcpService=o;this.instantiationService=n;this._openerService=r;this._markdownRendererService=s;this.interactionMd=this._register(new me);this.showSpecificServersScheduler=this._register(new Dt(()=>this.updateDetailedProgress(this.data.state.get()),2500));this.previousParts=new co(()=>Vi(this.context.element)?this.context.element.session.getItems().filter((e,t)=>Vi(e)&&t<this.context.elementIndex).flatMap(e=>e.response.value.filter(t=>t.kind==="mcpServersStarting")).map(e=>e.state?.get()):[]);this.domNode=_(".chat-mcp-servers-interaction"),e.state&&this._register(he(l=>{let c=e.state.read(l);this.updateForState(c)}))}updateForState(e){e.working?this.workingProgressPart?this.workingProgressPart&&this.updateDetailedProgress(e):this.showSpecificServersScheduler.isScheduled()||this.showSpecificServersScheduler.schedule():(this.workingProgressPart?.domNode.remove(),this.workingProgressPart=void 0,this.showSpecificServersScheduler.cancel());let t=e.serversRequiringInteraction.filter(o=>!(this.data.didStartServerIds?.includes(o.id)||this.previousParts.value.some(n=>n?.serversRequiringInteraction.some(r=>o.id===r.id))));t.length>0?this.interactionMd.value?this.updateInteractionRequired(this.interactionMd.value.element,t):this.renderInteractionRequired(t):t.length===0&&this.interactionContainer&&(this.interactionContainer.remove(),this.interactionContainer=void 0)}createServerCommandLinks(e){return e.map(t=>qy({title:"`"+BM(t.label)+"`",id:"workbench.mcp.serverOptions",arguments:[t.id]},!1)).join(", ")}updateDetailedProgress(e){let t=qy({title:d(7137,null),id:"workbench.mcp.skipAutostart"}),o;if(e.starting.length===0)o=new xe(void 0,{isTrusted:!0}).appendText(d(7142,null)+" ").appendMarkdown(t);else{let n=this.createServerCommandLinks(e.starting);o=new xe(void 0,{isTrusted:!0}).appendMarkdown(d(7141,null,n)+" ").appendMarkdown(t)}this.workingProgressPart?this.workingProgressPart.updateMessage(o):(this.workingProgressPart=this._register(this.instantiationService.createInstance(fD,{kind:"progressMessage",content:o},this._markdownRendererService,this.context,!0,!0,void 0,void 0,!1)),this.domNode.appendChild(this.workingProgressPart.domNode))}renderInteractionRequired(e){this.interactionContainer=_(".chat-mcp-servers-interaction-hint");let t=_(".chat-mcp-servers-message"),o=_(".chat-mcp-servers-icon");o.classList.add(...q.asClassNameArray(M.mcp));let{messageMd:n}=this.createInteractionMessage(e);t.appendChild(o),t.appendChild(n.element),this.interactionContainer.appendChild(t),this.domNode.prepend(this.interactionContainer)}updateInteractionRequired(e,t){let{messageMd:o}=this.createInteractionMessage(t);e.replaceWith(o.element)}createInteractionMessage(e){let t=e.length,o=this.createServerCommandLinks(e),n=t===1?d(7139,null,o,"#start"):d(7138,null,o,"#start"),r=new xe(n,{isTrusted:!0}),s=this.interactionMd.value=this._markdownRendererService.render(r,{actionHandler:c=>c.startsWith("command:")?zM(this._openerService,c,!0):(this._start(l),Promise.resolve(!0))}),l=[...s.element.querySelectorAll("a")].find(c=>!c.getAttribute("data-href")?.startsWith("command:"));return l?(l.setAttribute("role","button"),l.href="",{messageMd:s,startLink:l}):{messageMd:s,startLink:void 0}}async _start(e){e.style.pointerEvents="none",e.style.opacity="0.7";try{if(!this.data.state)return;let o=this.data.state.get().serversRequiringInteraction;for(let n=0;n<o.length;n++){let r=o[n];e.textContent=d(7140,null,r.label);let s=this.mcpService.servers.get().find(l=>l.definition.id===r.id);s&&(await n0(s,{promptType:"all-untrusted"}),this.data.didStartServerIds??=[],this.data.didStartServerIds.push(r.id))}this.interactionContainer&&(this.interactionContainer.remove(),this.interactionContainer=void 0)}catch{e.style.pointerEvents="",e.style.opacity="",e.textContent="Start now?"}}hasSameContent(e){return e.kind==="mcpServersStarting"}addDisposable(e){this._register(e)}};HPe=I([m(2,es),m(3,F),m(4,Qe),m(5,Qn)],HPe);var Ts;(T=>{T.PROMPT_LOCATIONS_KEY="chat.promptFilesLocations",T.INSTRUCTIONS_LOCATION_KEY="chat.instructionsFilesLocations",T.MODE_LOCATION_KEY="chat.modeFilesLocations",T.AGENTS_LOCATION_KEY="chat.agentFilesLocations",T.SKILLS_LOCATION_KEY="chat.agentSkillsLocations",T.HOOKS_LOCATION_KEY="chat.hookFilesLocations",T.PROMPT_FILES_SUGGEST_KEY="chat.promptFilesRecommendations",T.USE_COPILOT_INSTRUCTION_FILES="github.copilot.chat.codeGeneration.useInstructionFiles",T.USE_AGENT_MD="chat.useAgentsMdFile",T.USE_NESTED_AGENT_MD="chat.useNestedAgentsMdFiles",T.USE_CLAUDE_MD="chat.useClaudeMdFile",T.USE_AGENT_SKILLS="chat.useAgentSkills",T.USE_CHAT_HOOKS="chat.useHooks",T.USE_CLAUDE_HOOKS="chat.useClaudeHooks",T.USE_CUSTOM_AGENT_HOOKS="chat.useCustomAgentHooks",T.USE_SKILL_ADHERENCE_PROMPT="chat.experimental.useSkillAdherencePrompt",T.INCLUDE_APPLYING_INSTRUCTIONS="chat.includeApplyingInstructions",T.INCLUDE_REFERENCED_INSTRUCTIONS="chat.includeReferencedInstructions";function y(N,O){let V=Bxi(O),U=N.getValue(V);if(!(U==null||Array.isArray(U))&&typeof U=="object"){let G={};for(let[$,te]of Object.entries(U)){let pe=$.trim(),de=ppo(te);de!==void 0&&pe&&(G[pe]=de)}return G}}T.getLocationsValue=y;function w(N,O){let V=y(N,O),U=lme(O);if(V&&typeof V=="object"){let G=[],$=new Set(U.map(te=>te.path));for(let te of U)V[te.path]!==!1&&G.push(te);for(let[te,pe]of Object.entries(V)){if(pe===!1||$.has(te))continue;let de=RHt(te)?"user":"local";G.push({path:te,source:de==="local"?"config-personal":"config-workspace",storage:de})}return G}return[]}T.promptSourceFolders=w;function k(N,O){let V=N.getValue(T.PROMPT_FILES_SUGGEST_KEY,{resource:O});if(!V||typeof V!="object"||Array.isArray(V))return;let U={};for(let[G,$]of Object.entries(V)){let te=G.trim();if(!te)continue;if(typeof $=="boolean"){U[te]=$;continue}if(typeof $=="string"){let de=$.trim();de&&(U[te]=de);continue}let pe=ppo($);pe!==void 0&&(U[te]=pe)}return Object.keys(U).length>0?U:void 0}T.getPromptFilesRecommendationsValue=k})(Ts||={});function Bxi(a){switch(a){case"instructions":return Ts.INSTRUCTIONS_LOCATION_KEY;case"prompt":return Ts.PROMPT_LOCATIONS_KEY;case"agent":return Ts.AGENTS_LOCATION_KEY;case"skill":return Ts.SKILLS_LOCATION_KEY;case"hook":return Ts.HOOKS_LOCATION_KEY;default:throw new Error("Unknown prompt type")}}function ppo(a){if(typeof a=="boolean")return a;if(typeof a=="string"){let i=a.trim().toLowerCase();return i==="true"?!0:i==="false"?!1:void 0}}function RHt(a){return a.startsWith("~/")}var UPe=class extends C{constructor(e,t,o){super();this._openerService=t;this._markdownRendererService=o;this.domNode=_(".chat-disabled-claude-hooks");let n=_(".chat-disabled-claude-hooks-message"),r=_(".chat-disabled-claude-hooks-icon");r.classList.add(...q.asClassNameArray(M.info));let s=qy({title:d(7108,null),id:"workbench.action.openSettings",arguments:[Ts.USE_CLAUDE_HOOKS]}),l=d(7109,null,s),c=new xe(l,{isTrusted:!0}),u=this._register(this._markdownRendererService.render(c,{actionHandler:p=>zM(this._openerService,p,!0)}));n.appendChild(r),n.appendChild(u.element),this.domNode.appendChild(n)}hasSameContent(e){return e.kind==="disabledClaudeHooks"}addDisposable(e){this._register(e)}};UPe=I([m(1,Qe),m(2,Qn)],UPe);var E3=_,o9o=22,n9o=6,zPe=class extends C{constructor(e,t,o,n,r,s){super();this.content=e;this._element=t;this.instantiationService=o;this.editorService=n;this.themeService=r;this.contextKeyService=s;this.isCollapsed=!1;this.readOnly=e.readOnly??!1,this.diffData=uN(this.content.multiDiffData)?this.content.multiDiffData.map(c=>c):Oo(this.content.multiDiffData);let l=E3(".checkpoint-file-changes-summary-header");this.domNode=E3(".checkpoint-file-changes-summary",void 0,l),this.domNode.tabIndex=0,this.isCollapsed=e?.collapsed??!1,this._register(this.renderHeader(l)),this._register(this.renderFilesList(this.domNode))}renderHeader(e){let t=e.appendChild(E3(".chat-file-changes-label")),o=new oO(t,{});this._register(he(s=>{let l=this.diffData.read(s).resources.length;o.label=l===1?d(7145,null):d(7144,null,l)}));let n=()=>{o.icon=this.isCollapsed?M.chevronRight:M.chevronDown,this.domNode.classList.toggle("chat-file-changes-collapsed",this.isCollapsed)};n();let r=new P;return r.add(o),r.add(o.onDidClick(()=>{this.isCollapsed=!this.isCollapsed,n()})),this.readOnly||r.add(this.renderViewAllFileChangesButton(o.element)),r.add(this.renderContributedButtons(o.element)),Z(()=>r.dispose())}renderViewAllFileChangesButton(e){let t=e.appendChild(E3(".chat-view-changes-icon"));return t.classList.add(...q.asClassNameArray(M.diffMultiple)),t.title=d(7146,null),j(t,"click",o=>{let n=A.parse(`multi-diff-editor:${new Date().getMilliseconds().toString()+Math.random().toString()}`),{title:r,resources:s}=this.diffData.get(),l=this.instantiationService.createInstance(xu,n,r||"Multi-Diff",s.map(u=>new ik(u.originalUri,u.modifiedUri,u.goToFileUri)),!1),c=o.altKey;this.editorService.openEditor(l,c?vn:Un),$t.stop(o,!0)})}renderContributedButtons(e){let t=e.appendChild(E3(".chat-multidiff-contributed-buttons")),o=new P,n=fg(this._element.sessionResource),r=this.contextKeyService.createOverlay([[ie.agentSessionType.key,n]]),s=o.add(this.instantiationService.createChild(new Io([X,r]))),l={...this._element.sessionResource,$mid:1};return o.add(s.createInstance(Ln,t,D.ChatMultiDiffContext,{menuOptions:{arg:l,shouldForwardArgs:!0},toolbarOptions:{primaryGroup:()=>!0}})),o}renderFilesList(e){let t=new P,o=e.appendChild(E3(".chat-summary-list"));t.add(DB(o,this.themeService));let n=t.add(this.instantiationService.createInstance(Za,{onDidChangeVisibility:H.None}));return this.list=t.add(this.instantiationService.createInstance(Rl,"ChatMultiDiffList",o,new Hxi,[this.instantiationService.createInstance(Uxi,n)],{identityProvider:{getId:r=>r.uri.toString()},setRowLineHeight:!0,horizontalScrolling:!1,supportDynamicHeights:!1,mouseSupport:!this.readOnly,alwaysConsumeMouseWheel:!1,accessibilityProvider:{getAriaLabel:r=>r.uri.path,getWidgetAriaLabel:()=>d(7147,null)}})),this._register(he(r=>{let{resources:s}=this.diffData.read(r),l=[];for(let u of s){let p=u.modifiedUri||u.originalUri||u.goToFileUri;if(!p)continue;let h={uri:p};u.originalUri&&u.modifiedUri&&(h.diff={originalURI:u.originalUri,modifiedURI:u.modifiedUri,isFinal:!0,quitEarly:!1,identical:!1,added:u.added||0,removed:u.removed||0,isBusy:!1}),l.push(h)}this.list.splice(0,this.list.length,l);let c=Math.min(l.length,n9o)*o9o;this.list.layout(c),o.style.height=`${c}px`})),this.readOnly||t.add(this.list.onDidOpen(r=>{r.element&&(r.element.diff?this.editorService.openEditor({original:{resource:r.element.diff.originalURI},modified:{resource:r.element.diff.modifiedURI},options:{preserveFocus:!0}}):this.editorService.openEditor({resource:r.element.uri,options:{preserveFocus:!0}}))})),t}hasSameContent(e){return e.kind==="multiDiffData"&&this.diffData.get().resources.length===(uN(e.multiDiffData)?e.multiDiffData.get().resources.length:e.multiDiffData.resources.length)}addDisposable(e){this._register(e)}};zPe=I([m(2,F),m(3,ee),m(4,De),m(5,X)],zPe);var Hxi=class{getHeight(){return 22}getTemplateId(){return"chatMultiDiffItem"}},Uxi=class a{constructor(i){this.labels=i;this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="chatMultiDiffItem"}static{this.CHANGES_SUMMARY_CLASS_NAME="insertions-and-deletions"}renderTemplate(i){let e=this.labels.create(i,{supportHighlights:!0,supportIcons:!0});return{label:e,dispose:()=>e.dispose()}}renderElement(i,e,t){t.label.setFile(i.uri,{fileKind:0,title:i.uri.path});let o=t.label.element;if(t.changesElement?.remove(),i.diff?.added||i.diff?.removed){let n=o.appendChild(E3(`.${a.CHANGES_SUMMARY_CLASS_NAME}`)),r=n.appendChild(E3(".insertions"));r.textContent=`+${i.diff.added}`;let s=n.appendChild(E3(".deletions"));s.textContent=`-${i.diff.removed}`,n.setAttribute("aria-label",d(7143,null,i.diff.added,i.diff.removed)),t.changesElement=n}}disposeTemplate(i){i.dispose()}};var KPe=class extends C{constructor(e,t){super();this.pullRequestContent=e;this.commandService=t;this.domNode=_(".chat-pull-request-content-part");let o=R(this.domNode,_(".container")),n=R(o,_(".content-container")),r=R(n,_(".title-container"));R(r,_(".icon")).classList.add(...q.asClassNameArray(M.gitPullRequest));let l=R(r,_("a.title"));l.textContent=`${this.pullRequestContent.title} - ${this.pullRequestContent.author}`,this.pullRequestContent.uri&&(l.href=this.pullRequestContent.uri?.toString()),this._register(j(l,"click",c=>{c.preventDefault(),c.stopPropagation(),this.commandService.executeCommand(this.pullRequestContent.command.id,...this.pullRequestContent.command.arguments??[])}))}hasSameContent(e,t,o){return e.kind==="pullRequest"}addDisposable(e){this._register(e)}};KPe=I([m(1,ge)],KPe);var MHt=_,mpo=!1,hpo=!1,GPe=class extends C{constructor(e,t,o,n,r,s,l){super();this.content=t;let c=e.errorDetails;So(!!c,"errorDetails"),this.domNode=MHt(".chat-quota-error-widget"),R(this.domNode,MHt("span")).classList.add(...q.asClassNameArray(M.warning));let p=R(this.domNode,MHt(".chat-quota-error-message")),h=this._register(o.render(new xe(c.message)));R(p,h.element);let g;switch(l.entitlement){case 6:case 7:g=d(7173,null);break;case 5:g=d(7174,null);break}let f=!1,v=()=>{!hpo||f||(f=!0,R(p,MHt(".chat-quota-wait-warning",void 0,d(7175,null))))},b=!1,S=()=>{if(!mpo||b)return;b=!0;let y=this._register(new Mi(p,{buttonBackground:void 0,buttonForeground:wt(WI)}));y.element.classList.add("chat-quota-error-secondary-button"),y.label=d(7172,null),this._register(y.onDidClick(()=>{let w=n.getWidgetBySessionResource(e.sessionResource);w&&(w.rerunLastRequest(),hpo=!0,v())}))};if(g){let y=this._register(new Mi(p,{...Ko,supportIcons:!0}));y.label=g,y.element.classList.add("chat-quota-error-button"),this._register(y.onDidClick(async()=>{let w=l.entitlement===5?"workbench.action.chat.upgradePlan":"workbench.action.chat.manageOverages";s.publicLog2("workbenchActionExecuted",{id:w,from:"chat-response"}),await r.executeCommand(w),mpo=!0,S()}))}S(),v()}hasSameContent(e){return e.kind===this.content.kind&&!!e.errorDetails.isQuotaExceeded}addDisposable(e){this._register(e)}};GPe=I([m(3,At),m(4,ge),m(5,Te),m(6,vr)],GPe);var cT=class extends C{constructor(e,t,o,n,r){super();this.title=e;this.hoverMessage=o;this.hoverService=n;this._renderedTitleWithWidgets=this._register(new me);this._isExpanded=Le(this,!1);this._overrideIcon=Le(this,void 0);this._contentInitialized=!1;this.element=t.element,this.hasFollowingContent=t.contentIndex+1<t.content.length,this._showCheckmarks=pr("accessibility.chat.showCheckmarks",!1,r)}get icon(){return this._overrideIcon.get()}set icon(e){this._overrideIcon.set(e,void 0)}get domNode(){return this._domNode??=this.init(),this._domNode}init(){let e=this.title,t=_(".chat-used-context-label",void 0),o=this._register(new oO(t,{buttonBackground:void 0,buttonBorder:void 0,buttonForeground:void 0,buttonHoverBackground:void 0,buttonSecondaryBackground:void 0,buttonSecondaryForeground:void 0,buttonSecondaryHoverBackground:void 0,buttonSeparator:void 0}));this._collapseButton=o,this._domNode=_(".chat-used-context",void 0,t),o.label=e;let n=_("span.chat-collapsible-hover-chevron.codicon.codicon-chevron-right",{"aria-hidden":"true"});return o.element.appendChild(n),this.hoverMessage&&this._register(this.hoverService.setupDelayedHover(o.iconElement,{content:this.hoverMessage,style:1})),this._register(o.onDidClick(()=>{let r=this._isExpanded.get();this._isExpanded.set(!r,void 0)})),this._isExpanded.set(this.isExpanded(),void 0),this._register(he(r=>{let s=this._isExpanded.read(r),l=this._overrideIcon.read(r),c=this._showCheckmarks.read(r);l&&(o.icon=l),this._domNode?.classList.toggle("show-checkmarks",c),n.classList.toggle("codicon-chevron-right",!s),n.classList.toggle("codicon-chevron-down",s),this._domNode?.classList.toggle("chat-used-context-collapsed",!s),this.updateAriaLabel(o.element,typeof e=="string"?e:e.value,s),(s||this.shouldInitEarly())&&!this._contentInitialized&&(this._contentInitialized=!0,this._contentElement=this.initContent(),this._domNode?.appendChild(this._contentElement))})),this._domNode}shouldInitEarly(){return!1}updateAriaLabel(e,t,o){e.ariaLabel=t,e.ariaExpanded=String(o)}addDisposable(e){this._register(e)}get expanded(){return this._isExpanded}isExpanded(){return this._isExpanded.get()}setExpanded(e){this._isExpanded.set(e,void 0)}setTitle(e){this.title=e,this._collapseButton&&(this._collapseButton.label=e,this.updateAriaLabel(this._collapseButton.element,e,this.isExpanded()))}setTitleWithWidgets(e,t,o,n){if(this._store.isDisposed||!this._collapseButton)return;let r=n.render(e);r.element.classList.add("collapsible-title-content"),Ck(r.element,t,o,this._store);let s=this._collapseButton.labelElement;s.textContent="",s.appendChild(r.element);let l=r.element.textContent||"";this.updateAriaLabel(this._collapseButton.element,l,this.isExpanded()),this._renderedTitleWithWidgets.value=r}};cT=I([m(3,tt),m(4,B)],cT);var zxi=_,T3=class extends cT{constructor(e,t,o,n,r,s,l,c,u,p,h){super(t??(e.length>1?d(7181,null,e.length):d(7182,null,1)),o,r,p,h);this.data=e;this.contentReferencesListPool=n;this.openerService=s;this.menuService=l;this.instantiationService=c;this.contextMenuService=u;this.icon=M.check}initContent(){let t=this._register(this.contentReferencesListPool.get()).object;this._register(t.onDidOpen(l=>{if(l.element&&"reference"in l.element&&typeof l.element.reference=="object"){let c="variableName"in l.element.reference?l.element.reference.value:l.element.reference,u=A.isUri(c)?c:c?.uri;u&&this.openerService.open(u,{fromUserGesture:!0,editorOptions:{...l.editorOptions,selection:c&&"range"in c?c.range:void 0}})}})),this._register(t.onContextMenu(l=>{$t.stop(l.browserEvent,!0);let c=l.element&&Yet(l.element);c&&this.contextMenuService.showContextMenu({getAnchor:()=>l.anchor,getActions:()=>{let u=this.menuService.getMenuActions(D.ChatAttachmentsContext,t.contextKeyService,{shouldForwardArgs:!0,arg:c});return Uc(u)}})}));let o=this._register(this.instantiationService.createInstance(Fo));this._register(t.onDidChangeFocus(l=>{o.reset();let c=l.elements.length?l.elements[0]:void 0,u=c&&Yet(c);o.set(u??null)}));let s=Math.min(this.data.length,6)*22;return t.layout(s),t.getHTMLElement().style.height=`${s}px`,t.splice(0,t.length,this.data),t.getHTMLElement().parentElement}hasSameContent(e,t,o){return e.kind==="references"&&e.references.length===this.data.length&&!!t.length===this.hasFollowingContent}};T3=I([m(5,Qe),m(6,qt),m(7,F),m(8,ze),m(9,tt),m(10,B)],T3);var $Pe=class extends T3{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,t,o,n,void 0,s,l,c,u,p,h);this.options=r;e.length===0&&xo(this.domNode)}isExpanded(){let e=this.element;return e.usedReferencesExpanded??!!(this.options.expandedWhenEmptyResponse&&e.response.value.length===0)}setExpanded(e){let t=this.element;t.usedReferencesExpanded=!this.isExpanded()}};$Pe=I([m(5,Qe),m(6,qt),m(7,F),m(8,ze),m(9,tt),m(10,B)],$Pe);var qee=class extends C{constructor(e,t,o,n,r,s){super();this._onDidChangeVisibility=e;this.menuId=t;this.listOptions=o;this.instantiationService=n;this.themeService=r;this.labelService=s;this._pool=this._register(new LB(()=>this.listFactory()))}get inUse(){return this._pool.inUse}listFactory(){let e=new P,t=e.add(this.instantiationService.createInstance(Za,{onDidChangeVisibility:this._onDidChangeVisibility})),o=zxi(".chat-used-context-list");return e.add(DB(o,this.themeService)),{list:this.instantiationService.createInstance(Rl,"ChatListRenderer",o,new Kxi,[this.instantiationService.createInstance(jee,t,this.menuId)],{...this.listOptions,alwaysConsumeMouseWheel:!1,accessibilityProvider:{getAriaLabel:r=>{if(r.kind==="warning")return r.content.value;let s=r.reference;return typeof s=="string"?s:"variableName"in s?s.variableName:A.isUri(s)?No(s.path):No(s.uri.path)},getWidgetAriaLabel:()=>d(7177,null)},dnd:{getDragURI:r=>Yet(r)?.toString()??null,getDragLabel:(r,s)=>{let l=si(r.map(Yet));if(l.length)return l.length===1?this.labelService.getUriLabel(l[0],{relative:!0}):`${l.length}`},dispose:()=>{},onDragOver:()=>!1,drop:()=>{},onDragStart:(r,s)=>{try{let l=r.getData(),c=si(l.map(Yet));this.instantiationService.invokeFunction(u=>Ig(u,c,s))}catch{}}}}),dispose:()=>e.dispose()}}get(){let e=this._pool.get(),t=!1;return{object:e.list,isStale:()=>t,dispose:()=>{t=!0,this._pool.release(e)}}}clear(){this._pool.clear()}};qee=I([m(3,F),m(4,De),m(5,ot)],qee);var Kxi=class{getHeight(i){return 22}getTemplateId(i){return jee.TEMPLATE_ID}},jee=class{constructor(i,e,t,o,n,r){this.labels=i;this.menuId=e;this.themeService=t;this.productService=o;this.instantiationService=n;this.contextKeyService=r;this.templateId=jee.TEMPLATE_ID}static{this.TEMPLATE_ID="chatCollapsibleListRenderer"}renderTemplate(i){let e=new P,t=e.add(this.labels.create(i,{supportHighlights:!0,supportIcons:!0})),o=zxi(".working-set-line-counts"),n=_(".working-set-lines-added"),r=_(".working-set-lines-removed");o.appendChild(n),o.appendChild(r),t.element.appendChild(o);let s,l,c;if(this.menuId){l=zxi(".chat-collapsible-list-action-bar"),c=e.add(this.contextKeyService.createScoped(l));let u=e.add(this.instantiationService.createChild(new Io([X,c])));s=e.add(u.createInstance(Ln,l,this.menuId,{menuOptions:{shouldForwardArgs:!0,arg:void 0}})),t.element.appendChild(l)}return{templateDisposables:e,label:t,toolbar:s,actionBarContainer:l,contextKeyService:c,fileDiffsContainer:o,addedSpan:n,removedSpan:r}}getReferenceIcon(i){return q.isThemeIcon(i.iconPath)?i.iconPath:Ip(this.themeService.getColorTheme().type)&&i.iconPath?.dark?i.iconPath?.dark:i.iconPath?.light}renderElement(i,e,t){if(i.kind==="warning"){t.label.setResource({name:i.content.value},{icon:M.warning});return}let o=i.reference,n=this.getReferenceIcon(i);t.label.element.style.display="flex";let r;if(typeof o=="object"&&"variableName"in o)if(o.value){let s=A.isUri(o.value)?o.value:o.value.uri;t.label.setResource({resource:s,name:Ra(s),description:`#${o.variableName}`,range:"range"in o.value?o.value.range:void 0},{icon:n,title:i.options?.status?.description??i.title})}else if(o.variableName.startsWith("kernelVariable")){let l=`${o.variableName.split(":")[1]}`;t.label.setLabel("Kernel variable",l,{title:i.options?.status?.description})}else t.label.setLabel(o.variableName,void 0,{title:i.options?.status?.description??i.title});else if(typeof o=="string")t.label.setLabel(o,void 0,{iconPath:A.isUri(n)?n:void 0,title:i.options?.status?.description??i.title});else{let s="uri"in o?o.uri:o;r=s;let l=i.excluded?["excluded"]:[];if(s.scheme==="https"&&S6(s.authority,"github.com")&&s.path.includes("/tree/"))t.label.setResource(r9o(s),{icon:M.github,title:i.title,strikethrough:i.excluded,extraClasses:l});else if(s.scheme===this.productService.urlProtocol&&S6(s.authority,AEe)){let c=s.path.substring(1);t.label.setResource({resource:s,name:c},{icon:M.settingsGear,title:d(7180,null,c),strikethrough:i.excluded,extraClasses:l})}else $0(s,Y.mailto,Y.http,Y.https)?t.label.setResource({resource:s,name:s.toString(!0)},{icon:n??M.globe,title:i.options?.status?.description??i.title??s.toString(!0),strikethrough:i.excluded,extraClasses:l}):t.label.setFile(s,{fileKind:0,fileDecorations:void 0,range:"range"in o?o.range:void 0,title:i.options?.status?.description??i.title,strikethrough:i.excluded,extraClasses:l})}for(let s of[".monaco-icon-suffix-container",".monaco-icon-name-container"]){let l=t.label.element.querySelector(s);l&&(i.options?.status?.kind===3||i.options?.status?.kind===2?l.classList.add("warning"):l.classList.remove("warning"))}if(i.state!==void 0){if(t.actionBarContainer){let s=i?.options?.diffMeta;if(s){if(!t.fileDiffsContainer||!t.addedSpan||!t.removedSpan)return;t.addedSpan.textContent=`+${s.added}`,t.removedSpan.textContent=`-${s.removed}`,t.fileDiffsContainer.setAttribute("aria-label",d(7178,null,s.added,s.removed))}t.label.element.querySelector(".monaco-icon-name-container")?.classList.add("modified")}t.toolbar&&(t.toolbar.context=r),t.contextKeyService&&i.state!==void 0&&sR.bindTo(t.contextKeyService).set(i.state)}}disposeTemplate(i){i.templateDisposables.dispose()}};jee=I([m(2,De),m(3,nt),m(4,F),m(5,X)],jee);function r9o(a){let i=a.path.split("/").slice(1,3).join("/"),e=a.path.split("/").slice(5),t=e.at(-1),o=s9o(a);return{resource:a,name:t??e.join("/"),description:[i,...e.slice(0,-1)].join("/"),range:o}}function s9o(a){if(!a.fragment)return;let i=a.fragment.match(/\bL(\d+)(?:-L(\d+))?/);if(!i)return;let e=parseInt(i[1]);if(isNaN(e))return;let t=i[2]?parseInt(i[2]):e;if(!isNaN(t))return{startLineNumber:e,startColumn:1,endLineNumber:t,endColumn:1}}function Yet(a){if(a.kind==="warning")return null;let{reference:i}=a;return typeof i=="string"||"variableName"in i?null:A.isUri(i)?i:i.uri}W(class gpo extends K{static{this.id="workbench.action.chat.addToChatAction"}constructor(){super({id:gpo.id,title:{...L(7176,"Add File to Chat")},f1:!1,menu:[{id:D.ChatAttachmentsContext,group:"chat",order:1,when:x.and(Fo.IsFileSystemResource,lu.negate())}]})}async run(i,e){let t=i.get(At);if(!e)return;let o=t.lastFocusedWidget;o&&o.attachmentModel.addFile(e)}});W(class fpo extends K{static{this.id="workbench.action.chat.copyLink"}constructor(){super({id:fpo.id,title:{...L(7179,"Copy Link")},f1:!1,menu:[{id:D.ChatAttachmentsContext,group:"chat",order:0,when:x.or(Fo.Scheme.isEqualTo(Y.http),Fo.Scheme.isEqualTo(Y.https))}]})}async run(i,e){await i.get(Wi).writeResources([e])}});var qPe=class extends C{constructor(e,t,o,n,r){super();this.task=e;if(e.progress.length){this.isSettled=!0;let s=this._register(r.createInstance(T3,e.progress,e.content.value,n,t,void 0));this.domNode=_(".chat-progress-task"),this.domNode.appendChild(s.domNode)}else{let s=e.kind==="progressTask"?e.isSettled():!0;this.isSettled=s;let l=!s&&!n.element.isComplete,c=this._register(r.createInstance(fD,e,o,n,l,!0,void 0,void 0,void 0));this.domNode=c.domNode}}hasSameContent(e){return e.kind==="progressTask"&&this.task.kind==="progressTask"&&e.isSettled()!==this.isSettled?!1:e.kind===this.task.kind&&e.progress.length===this.task.progress.length}addDisposable(e){this._register(e)}};qPe=I([m(4,F)],qPe);var vpo=_,bpo=ae("ICodeCompareModelService"),jPe=class extends C{constructor(e,t,o,n,r,s){super();this.codeCompareModelService=s;let l=t.element;if(So(Vi(l)),o.renderTextEditsAsSummary?.(e.uri))l.response.value.every(c=>c.kind==="textEditGroup")?this.domNode=vpo(".interactive-edits-summary",void 0,l.isComplete?l.isCanceled?d(7201,null):d(7202,null):""):this.domNode=vpo("div");else{let c=new $e,u=!1;this._register(Z(()=>{u=!0,c.dispose(!0)})),this.comparePart=this._register(n.get());let p={element:l,edit:e,diffData:(async()=>{let h=await this.codeCompareModelService.createModel(l,e);if(u){h.dispose();return}return this._register(h),{modified:h.object.modified.textEditorModel,original:h.object.original.textEditorModel,originalSha1:h.object.originalSha1}})()};this.comparePart.object.render(p,r,c.token),this.domNode=this.comparePart.object.element}}layout(e){this.comparePart?.object.layout(e)}hasSameContent(e){return e.kind==="textEditGroup"}addDisposable(e){this._register(e)}};jPe=I([m(5,bpo)],jPe);var Xet=class{constructor(i,e,t){this.textModelService=i;this.modelService=e;this.chatService=t}async createModel(i,e){let t=await this.textModelService.createModelReference(e.uri),o=await this.textModelService.createModelReference(this.modelService.createModel(i_(t.object.textEditorModel.createSnapshot()),{languageId:t.object.textEditorModel.getLanguageId(),onDidChange:H.None},A.from({scheme:Y.vscodeChatCodeBlock,path:e.uri.path,query:_t()}),!1).uri),n=new qH(Z(()=>{t.dispose(),o.dispose()})),r="";if(e.state)r=e.state.sha1;else{let c=new Wue;c.canComputeSHA1(t.object.textEditorModel)&&(r=c.computeSHA1(t.object.textEditorModel),e.state={sha1:r,applied:0})}let s=this.chatService.getSession(i.sessionResource),l=[];for(let c of s.getRequests())if(c.response){for(let u of c.response.response.value)if(!(u.kind!=="textEditGroup"||u.state?.applied||!Xe(u.uri,e.uri)))for(let p of u.edits){let h=p.map(Qk.asEditOperation);l.push(h)}if(c.response===i.model)break}for(let c of l)o.object.textEditorModel.pushEditOperations(null,c,()=>null);return n.acquire(),setTimeout(()=>n.release(),5e3),{object:{originalSha1:r,original:t.object,modified:o.object},dispose(){n.release()}}}};Xet=I([m(0,Nt),m(1,Ct),m(2,Si)],Xet);we(bpo,Xet,1);function Spo(a){return(Array.isArray(a.value)?a.value.join(""):a.value||"").trim()}function Gxi(a){let i=a.toLowerCase();return i.includes("search")||i.includes("grep")||i.includes("find")||i.includes("list")||i.includes("semantic")||i.includes("changes")||i.includes("codebase")?M.search:i.includes("read")||i.includes("get_file")||i.includes("problems")?M.book:i.includes("edit")||i.includes("create")||i.includes("replace")?M.pencil:i.includes("terminal")?M.terminal:M.tools}function _3(a){let i=_("span.chat-thinking-icon");return i.classList.add(...q.asClassNameArray(a)),i}function Ipo(a){let i=a.match(/^\*\*([^*]+)\*\*/);return i?i[1]:void 0}var Jet=200;var l9o=[d(7212,null),d(7213,null),d(7214,null),d(7215,null),d(7216,null)],c9o=[d(7209,null),d(7210,null),d(7211,null)],d9o=[d(7217,null),d(7218,null),d(7219,null),d(7220,null),d(7221,null)],vD=class extends cT{constructor(e,t,o,n,r,s,l,c,u){let p=Spo(e),h=Ipo(p)??"Working";super(h,t,void 0,u,s);this.chatContentMarkdownRenderer=o;this.streamingCompleted=n;this.instantiationService=r;this.configurationService=s;this.chatMarkdownAnchorService=l;this.languageModelsService=c;this._onDidChangeHeight=this._register(new E);this.defaultTitle=d(7207,null);this.fixedScrollingMode=!1;this.autoScrollEnabled=!0;this.extractedTitles=[];this.toolInvocationCount=0;this.appendedItemCount=0;this.isActive=!0;this.toolInvocations=[];this.allThinkingParts=[];this.hookCount=0;this.lazyItems=[];this.hasExpandedOnce=!1;this.availableMessagesByCategory=new Map;this.toolWrappersByCallId=new Map;this.toolDisposables=this._register(new jt);this.pendingRemovals=[];this.isUpdatingDimensions=!1;this.id=e.id,this.content=e,this.allThinkingParts.push(e);let g=this.configurationService.getValue("chat.agent.thinkingStyle")??"collapsed";this.fixedScrollingMode=g==="fixedScrolling",this.currentTitle=h,h!==this.defaultTitle&&(this.lastExtractedTitle=h),this.currentThinkingValue=p,p.trim()&&this.appendedItemCount++,this.configurationService.getValue("accessibility.verboseChatProgressUpdates")&&Jo(d(7208,null)),g==="collapsed"?this.setExpanded(!1):g==="collapsedPreview"?this.setExpanded(!this.streamingCompleted&&!this.element.isComplete):this.setExpanded(!1);let f=this.domNode;if(f.classList.add("chat-thinking-box"),!this.streamingCompleted&&!this.element.isComplete&&(this.fixedScrollingMode||f.classList.add("chat-thinking-active")),!this.fixedScrollingMode&&!this.streamingCompleted&&!this.element.isComplete&&this._collapseButton){let b=this._collapseButton.labelElement;b.textContent="",this.titleShimmerSpan=_("span.chat-thinking-title-shimmer"),this.titleShimmerSpan.textContent=h,b.appendChild(this.titleShimmerSpan)}this.fixedScrollingMode&&(f.classList.add("chat-thinking-fixed-mode"),this.currentTitle=this.defaultTitle),this._register(he(b=>{let S=this.expanded.read(b);this._collapseButton&&(this.streamingCompleted||this.element.isComplete?this._collapseButton.icon=M.check:this.fixedScrollingMode||(S?this._collapseButton.icon=M.chevronDown:this._collapseButton.icon=M.circleFilled))})),this._register(he(b=>{let S=this._isExpanded.read(b);if(S&&!this.hasExpandedOnce&&this.lazyItems.length>0){this.hasExpandedOnce=!0;for(let y of this.lazyItems)this.materializeLazyItem(y)}if(S&&!this.shouldAllowExpansion()){this.setExpanded(!1);return}this._onDidChangeHeight.fire()}));let v=this.lastExtractedTitle??"";!this.fixedScrollingMode&&!this._isExpanded.get()&&this.setTitle(v),this._collapseButton&&this._register(this._collapseButton.onDidClick(()=>{if(this.streamingCompleted||this.fixedScrollingMode)return;this.isExpanded()?(this.setTitle(this.defaultTitle,!0),this.currentTitle=this.defaultTitle):this.lastExtractedTitle?this.setTitle(this.lastExtractedTitle):(this.setTitle(this.defaultTitle,!0),this.currentTitle=this.defaultTitle)}))}getRandomWorkingMessage(e="tool"){let t=this.availableMessagesByCategory.get(e);if(!t||t.length===0){let n;switch(e){case"thinking":n=[...l9o];break;case"terminal":n=[...c9o];break;default:n=[...d9o];break}let r=this.configurationService.getValue("chat.agent.thinking.phrases"),s=Array.isArray(r?.phrases)?r.phrases.filter(c=>typeof c=="string").map(c=>c.trim()).filter(c=>c.length>0):[],l=r?.mode==="replace"?"replace":"append";s.length>0?l==="replace"?t=[...s]:t=[...n,...s]:t=n,this.availableMessagesByCategory.set(e,t)}let o=Math.floor(Math.random()*t.length);return t.splice(o,1)[0]}shouldInitEarly(){return this.fixedScrollingMode&&!this.streamingCompleted}initContent(){this.wrapper=_(".chat-used-context-list.chat-thinking-collapsible"),this.streamingCompleted||this.wrapper.classList.add("chat-thinking-streaming");let e=this.lazyItems.some(t=>t.kind==="thinking");if(this.currentThinkingValue&&!e&&(this.textContainer=_(".chat-thinking-item.markdown-content"),this.wrapper.appendChild(this.textContainer),this.renderMarkdown(this.currentThinkingValue)),!this.streamingCompleted&&!this.element.isComplete){this.workingSpinnerElement=_(".chat-thinking-item.chat-thinking-spinner-item");let t=_3(M.circleFilled);this.workingSpinnerElement.appendChild(t),this.workingSpinnerLabel=_("span.chat-thinking-spinner-label"),this.workingSpinnerLabel.textContent=this.getRandomWorkingMessage("thinking"),this.workingSpinnerElement.appendChild(this.workingSpinnerLabel),this.wrapper.appendChild(this.workingSpinnerElement)}if(this.fixedScrollingMode){this.scrollableElement=this._register(new Pa(this.wrapper,{vertical:1,horizontal:2,handleMouseWheel:!0,alwaysConsumeMouseWheel:!1})),this._register(this.scrollableElement.onScroll(o=>this.handleScroll(o.scrollTop)));let t=new MutationObserver(()=>{this.streamingCompleted||this.syncDimensionsAndScheduleScroll()});return t.observe(this.wrapper,{childList:!0,subtree:!0,characterData:!0}),this.mutationObserverDisposable={dispose:()=>t.disconnect()},this._register(this.mutationObserverDisposable),this._register(this._onDidChangeHeight.event(()=>{this.syncDimensionsAndScheduleScroll()})),this.syncDimensionsAndScheduleScroll(),this.updateDropdownClickability(),this.scrollableElement.getDomNode()}return this.updateDropdownClickability(),this.wrapper}handleScroll(e){if(!this.scrollableElement||this.isUpdatingDimensions)return;let t=this.scrollableElement.getScrollDimensions(),o=t.scrollHeight-t.height;o<=0||e>=o-10?this.autoScrollEnabled=!0:this.autoScrollEnabled=!1}syncDimensionsAndScheduleScroll(){if(this.autoScrollEnabled&&this.scrollableElement){this.isUpdatingDimensions=!0;try{this.updateScrollDimensions(),this.scrollToBottom()}finally{this.isUpdatingDimensions=!1}return}this.pendingScrollDisposable||(this.pendingScrollDisposable=$r(Me(this.domNode),()=>{if(this.pendingScrollDisposable=void 0,!this._store.isDisposed){this.isUpdatingDimensions=!0;try{this.updateScrollDimensions()}finally{this.isUpdatingDimensions=!1}}}))}updateScrollDimensions(){if(!this.scrollableElement||!this.domNode.classList.contains("chat-used-context-collapsed"))return;let t=this.wrapper.scrollHeight,o=Math.min(t,Jet);this.scrollableElement.setScrollDimensions({width:this.scrollableElement.getDomNode().clientWidth,scrollWidth:this.wrapper.scrollWidth,height:o,scrollHeight:t}),this.updateDropdownClickability(t)}scrollToBottom(){if(!this.scrollableElement)return;let e=this.wrapper.scrollHeight,t=Math.min(e,Jet);e>t&&this.scrollableElement.setScrollPosition({scrollTop:e-t})}updateScrollDimensionsForCompletion(){if(!this.scrollableElement||!this.fixedScrollingMode)return;let e=this.wrapper.scrollHeight,t=Math.min(e,Jet);this.scrollableElement.setScrollDimensions({width:this.scrollableElement.getDomNode().clientWidth,scrollWidth:this.wrapper.scrollWidth,height:t,scrollHeight:e}),e<=Jet&&this.scrollableElement.setScrollPosition({scrollTop:0})}renderMarkdown(e,t){if(this._store.isDisposed)return;let o=e.trim();if(!o){this.markdownResult&&(this.markdownResult.dispose(),this.markdownResult=void 0),this.textContainer&&Rt(this.textContainer);return}let n=o;o.startsWith("**")&&o.endsWith("**")&&(n=o.slice(2,-2));let r=t?this.markdownResult?.element:void 0;this.markdownResult&&(this.markdownResult.dispose(),this.markdownResult=void 0);let s=this._register(this.chatContentMarkdownRenderer.render(new xe(n),{fillInIncompleteTokens:!0,asyncRenderCallback:()=>this._onDidChangeHeight.fire(),codeBlockRendererSync:(l,c,u)=>{let p=_("code");return p.textContent=c,p}},r));this.markdownResult=s,r||this.textContainer&&(Rt(this.textContainer),this.textContainer.appendChild(_3(M.circleFilled)),this.textContainer.appendChild(s.element))}setFinalizedTitle(e){if(!this._collapseButton)return;let t=this._collapseButton.labelElement;t.textContent="";let o=e.indexOf(" ");if(o===-1)t.textContent=e;else{let n=e.substring(0,o),r=e.substring(o),s=_("span");s.textContent=n,t.appendChild(s);let l=_("span.chat-thinking-title-detail-text");l.textContent=r,t.appendChild(l)}this._collapseButton.element.ariaLabel=e}setDropdownClickable(e){this._collapseButton&&(this._collapseButton.element.style.pointerEvents=e?"auto":"none"),!e&&this.streamingCompleted&&this.setFinalizedTitle(this.lastExtractedTitle??this.currentTitle)}shouldAllowExpansion(){if(this.toolInvocationCount>0||this.lazyItems.length>0||this.wrapper&&Array.from(this.wrapper.children).filter(s=>s!==this.workingSpinnerElement).length>1)return!0;let e=this.currentThinkingValue.trim(),t=this.lastExtractedTitle??this.currentTitle,n=(r=>r.replace(/\*\*(.+?)\*\*/g,"$1").replace(/\*(.+?)\*/g,"$1").replace(/`(.+?)`/g,"$1").trim())(e);return!(!n||n===t)}updateDropdownClickability(e){let t=this.shouldAllowExpansion();t&&this.fixedScrollingMode&&!this.streamingCompleted&&!this.element.isComplete&&this.wrapper&&(e??this.wrapper.scrollHeight)<=Jet&&(t=!1),!t&&this.isExpanded()&&this.setExpanded(!1),this.setDropdownClickable(t)}appendToWrapper(e){this.wrapper&&(this.workingSpinnerElement&&this.workingSpinnerElement.parentNode===this.wrapper?this.wrapper.insertBefore(e,this.workingSpinnerElement):this.wrapper.appendChild(e))}resetId(){this.id=void 0}collapseContent(){this.setExpanded(!1)}updateThinking(e){if(this._store.isDisposed)return;this.content=e;for(let c of this.lazyItems)if(c.kind==="thinking"&&c.content.id===e.id){c.content=e;break}let t=Spo(e),o=t;if(o===this.currentThinkingValue)return;let n=this.currentThinkingValue,r=!!(this.markdownResult&&o.startsWith(n)&&o.length>n.length);this.currentThinkingValue=o,this.renderMarkdown(o,r),this.fixedScrollingMode&&this.scrollableElement&&this.syncDimensionsAndScheduleScroll();let s=Ipo(t);if(s&&s!==this.currentTitle&&(this.extractedTitles.includes(s)||this.extractedTitles.push(s),this.lastExtractedTitle=s),!s||s===this.currentTitle)return;let l=this.lastExtractedTitle??"";!this.fixedScrollingMode&&!this._isExpanded.get()&&this.setTitle(l),this.updateDropdownClickability()}getIsActive(){return this.isActive}markAsInactive(){this.isActive=!1,this.domNode.classList.remove("chat-thinking-active"),this.processPendingRemovals(),this.workingSpinnerElement&&(this.workingSpinnerElement.remove(),this.workingSpinnerElement=void 0,this.workingSpinnerLabel=void 0)}finalizeTitleIfDefault(){if(this.processPendingRemovals(),this.wrapper&&this.wrapper.classList.remove("chat-thinking-streaming"),this.domNode.classList.remove("chat-thinking-active"),this.streamingCompleted=!0,this.mutationObserverDisposable&&(this.mutationObserverDisposable.dispose(),this.mutationObserverDisposable=void 0),this.workingSpinnerElement&&(this.workingSpinnerElement.remove(),this.workingSpinnerElement=void 0,this.workingSpinnerLabel=void 0),this._collapseButton&&(this._collapseButton.icon=M.check),this.updateScrollDimensionsForCompletion(),this.updateDropdownClickability(),this.content.generatedTitle){this.currentTitle=this.content.generatedTitle,this.setFinalizedTitle(this.content.generatedTitle);return}let e=this.toolInvocations.find(o=>o.generatedTitle)?.generatedTitle??this.allThinkingParts.find(o=>o.generatedTitle)?.generatedTitle;if(e){this.currentTitle=e,this.content.generatedTitle=e,this.setGeneratedTitleOnAllParts(e),this.setFinalizedTitle(e);return}if(this.appendedItemCount===1&&this.currentThinkingValue.trim()===""){if(!this.singleItemInfo){let o=this.lazyItems.find(n=>n.kind==="tool"&&n.originalParent);if(o&&o.kind==="tool"){let n=o.lazy.value;this.singleItemInfo={element:n.domNode,originalParent:o.originalParent,originalNextSibling:this.domNode},n.disposable&&this._register(n.disposable)}}if(this.singleItemInfo&&this.restoreSingleItemToOriginalPosition())return}if(this.extractedTitles.length===1&&this.toolInvocationCount===0){let o=this.extractedTitles[0];this.currentTitle=o,this.content.generatedTitle=o,this.setGeneratedTitleOnAllParts(o),this.setFinalizedTitle(o);return}if(!(this.configurationService.getValue("chat.agent.thinking.generateTitles")??!0)){this.setFallbackTitle();return}this.generateTitleViaLLM()}setGeneratedTitleOnAllParts(e){for(let t of this.toolInvocations)t.generatedTitle=e;for(let t of this.allThinkingParts)t.generatedTitle=e}async generateTitleViaLLM(){let e=new $e,t=setTimeout(()=>e.cancel(),5e3);try{let o=await this.languageModelsService.selectLanguageModels({vendor:"copilot",id:"copilot-fast"});if(!o.length){this.setFallbackTitle();return}if(e.token.isCancellationRequested){this.setFallbackTitle();return}let n;this.extractedTitles.length>0?n=this.extractedTitles.join(", "):n=this.currentThinkingValue.substring(0,1e3);let r=`Summarize the following content in a SINGLE sentence (under 10 words) using past tense. Follow these rules strictly:
OUTPUT FORMAT:
- MUST be a single sentence
- MUST be under 10 words
- The FIRST word MUST be a past tense verb (e.g. "Updated", "Reviewed", "Created", "Searched", "Analyzed")
- No quotes, no trailing punctuation
GENERAL:
- The content may include tool invocations (file edits, reads, searches, terminal commands), reasoning headers, or raw thinking text
- For reasoning headers or thinking text (no tool calls), summarize WHAT was considered/analyzed, NOT that thinking occurred
- For thinking-only summaries, use phrases like: "Considered...", "Planned...", "Analyzed...", "Reviewed..."
TOOL NAME FILTERING:
- NEVER include tool names like "Replace String in File", "Multi Replace String in File", "Create File", "Read File", etc. in the output
- If an action says "Edited X and used Replace String in File", output ONLY the action on X
- Tool names describe HOW something was done, not WHAT was done - always omit them
VOCABULARY - Use varied synonyms for natural-sounding summaries:
- For edits: "Updated", "Modified", "Changed", "Refactored", "Fixed", "Adjusted"
- For reads: "Reviewed", "Examined", "Checked", "Inspected", "Analyzed", "Explored"
- For creates: "Created", "Added", "Generated"
- For searches: "Searched for", "Looked up", "Investigated"
- For terminal: "Ran command", "Executed"
- For reasoning/thinking: "Considered", "Planned", "Analyzed", "Reviewed", "Evaluated"
- Choose the synonym that best fits the context
${this.hookCount>0?`BLOCKED/DENIED CONTENT (hooks detected):
- Only mention "blocked" if the content explicitly includes hook results that blocked or warned about a tool (e.g. "Blocked terminal" or "Warning for read_file")
- If blocked items are present alongside normal tool calls, briefly note the block but do NOT let it dominate the summary: e.g. "Updated file.ts, blocked terminal"
`:`IMPORTANT: Do NOT use words like "blocked", "denied", or "tried" in the summary - there are no hooks or blocked items in this content. Just summarize normally.
`}RULES FOR TOOL CALLS:
1. If the SAME file was both edited AND read: Use a combined phrase like "Reviewed and updated <filename>"
2. If exactly ONE file was edited: Start with an edit synonym + "<filename>" (include actual filename)
3. If exactly ONE file was read: Start with a read synonym + "<filename>" (include actual filename)
4. If MULTIPLE files were edited: Start with an edit synonym + "X files"
5. If MULTIPLE files were read: Start with a read synonym + "X files"
6. If BOTH edits AND reads occurred on DIFFERENT files: Combine them naturally
7. For searches: Say "searched for <term>" or "looked up <term>" with the actual search term, NOT "searched for files"
8. After the file info, you may add a brief summary of other actions if space permits
9. NEVER say "1 file" - always use the actual filename when there's only one file
RULES FOR REASONING HEADERS (no tool calls):
1. If the input contains reasoning/analysis headers without actual tool invocations, summarize the main topic and what was considered
2. Use past tense verbs that indicate thinking, not doing: "Considered", "Planned", "Analyzed", "Evaluated"
3. Focus on WHAT was being thought about, not that thinking occurred
RULES FOR RAW THINKING TEXT:
1. Extract the main topic or question being considered from the text
2. Identify any specific files, functions, or concepts mentioned
3. Summarize as "Analyzed <topic>" or "Considered <specific thing>"
4. If discussing code structure: "Reviewed <component/architecture>"
5. If discussing a problem: "Analyzed <problem description>"
6. If discussing implementation: "Planned <feature/change>"
EXAMPLES WITH TOOLS:
- "Read HomePage.tsx, Edited HomePage.tsx" \u2192 "Reviewed and updated HomePage.tsx"
- "Edited HomePage.tsx" \u2192 "Updated HomePage.tsx"
- "Edited config.css and used Replace String in File" \u2192 "Modified config.css"
- "Edited App.tsx, used Multi Replace String in File" \u2192 "Refactored App.tsx"
- "Read config.json, Read package.json" \u2192 "Reviewed 2 files"
- "Edited App.tsx, Read utils.ts" \u2192 "Updated App.tsx and checked utils.ts"
- "Edited App.tsx, Read utils.ts, Read types.ts" \u2192 "Updated App.tsx and reviewed 2 files"
- "Edited index.ts, Edited styles.css, Ran terminal command" \u2192 "Modified 2 files and ran command"
- "Read README.md, Searched for AuthService" \u2192 "Checked README.md and searched for AuthService"
- "Searched for login, Searched for authentication" \u2192 "Searched for login and authentication"
- "Edited api.ts, Edited models.ts, Read schema.json" \u2192 "Updated 2 files and reviewed schema.json"
- "Edited Button.tsx, Edited Button.css, Edited index.ts" \u2192 "Modified 3 files"
- "Searched codebase for error handling" \u2192 "Looked up error handling"
${this.hookCount>0?`EXAMPLES WITH BLOCKED CONTENT (from hooks):
- "Blocked terminal, Edited config.ts" \u2192 "Edited config.ts, terminal was blocked"
- "Blocked terminal, Blocked read_file" \u2192 "Two tools were blocked by hooks"
- "Warning for read_file, Edited utils.ts" \u2192 "Edited utils.ts with a hook warning"
`:""}EXAMPLES WITH REASONING HEADERS (no tools):
- "Analyzing component architecture" \u2192 "Considered component architecture"
- "Planning refactor strategy" \u2192 "Planned refactor strategy"
- "Reviewing error handling approach, Considering edge cases" \u2192 "Analyzed error handling approach"
- "Understanding the codebase structure" \u2192 "Reviewed codebase structure"
- "Thinking about implementation options" \u2192 "Considered implementation options"
EXAMPLES WITH RAW THINKING TEXT:
- "I need to understand how the authentication flow works in this app..." \u2192 "Analyzed authentication flow"
- "Let me think about how to refactor this component to be more maintainable..." \u2192 "Planned component refactoring"
- "The error seems to be coming from the database connection..." \u2192 "Investigated database connection issue"
- "Looking at the UserService class, I see it handles..." \u2192 "Reviewed UserService implementation"
Content: ${n}`,s=await this.languageModelsService.sendChatRequest(o[0],void 0,[{role:1,content:[{type:"text",value:r}]}],{},e.token),l="";for await(let c of s.stream){if(e.token.isCancellationRequested)break;if(Array.isArray(c))for(let u of c)u.type==="text"&&(l+=u.value);else c.type==="text"&&(l+=c.value)}if(e.token.isCancellationRequested){this.setFallbackTitle();return}if(await s.result,l=l.trim(),l.includes("can't assist with that")){this.setFallbackTitle();return}if(l&&!this._store.isDisposed){this.currentTitle=l,this.setFinalizedTitle(l),this.content.generatedTitle=l,this.setGeneratedTitleOnAllParts(l);return}}catch{}finally{clearTimeout(t),e.dispose()}this.setFallbackTitle()}restoreSingleItemToOriginalPosition(){if(!this.singleItemInfo)return!1;let{element:e,originalParent:t,originalNextSibling:o}=this.singleItemInfo;return e.childElementCount>1?(this.singleItemInfo=void 0,!1):(o&&o.parentNode===t?t.insertBefore(e,o):t.appendChild(e),xo(this.domNode),this.singleItemInfo=void 0,!0)}setFallbackTitle(){let e=this.appendedItemCount>0?d(7206,null,this.appendedItemCount,this.appendedItemCount===1?"":"s"):d(7205,null);this.currentTitle=e,this.wrapper&&this.wrapper.classList.remove("chat-thinking-streaming"),this.domNode.classList.remove("chat-thinking-active"),this.streamingCompleted=!0,this._collapseButton&&(this._collapseButton.icon=M.check,this.setFinalizedTitle(e)),this.updateDropdownClickability()}appendItem(e,t,o,n){if(this.processPendingRemovals(),this.trackToolMetadata(t,o),this.appendedItemCount++,this.workingSpinnerLabel){let s=o&&(o.kind==="toolInvocation"||o.kind==="toolInvocationSerialized")&&o.toolSpecificData?.kind==="terminal"?"terminal":"tool";this.workingSpinnerLabel.textContent=this.getRandomWorkingMessage(s)}if(this.isExpanded()||this.hasExpandedOnce||this.fixedScrollingMode&&!this.streamingCompleted){let r=e();if(this.appendItemToDOM(r.domNode,t,o,n),r.disposable){let s=o&&(o.kind==="toolInvocation"||o.kind==="toolInvocationSerialized")?o.toolCallId:void 0;s?this.toolDisposables.get(s)?.add(r.disposable):this._register(r.disposable)}}else{let r={kind:"tool",lazy:new co(e),toolInvocationId:t,toolInvocationOrMarkdown:o,originalParent:n,isHook:!o&&!!t};this.lazyItems.push(r)}this.updateDropdownClickability()}removeLazyItem(e){let t=this.lazyItems.findIndex(r=>r.kind==="tool"&&r.toolInvocationId===e);if(t===-1)return!1;let o=this.lazyItems[t];this.lazyItems.splice(t,1),this.appendedItemCount--,o.kind==="tool"&&o.isHook?this.hookCount=Math.max(0,this.hookCount-1):this.toolInvocationCount--;let n=this.toolInvocations.findIndex(r=>(r.kind==="toolInvocation"||r.kind==="toolInvocationSerialized")&&r.toolId===e);return n!==-1&&this.toolInvocations.splice(n,1),this.updateDropdownClickability(),!0}processPendingRemovals(){if(this.pendingRemovalFlushDisposable?.dispose(),this.pendingRemovalFlushDisposable=void 0,this.pendingRemovals.length===0)return;let e=this.pendingRemovals;this.pendingRemovals=[];for(let t of e)this.removeStreamingToolEntry(t.toolCallId,t.toolLabel)}schedulePendingRemovalsFlush(){this.pendingRemovalFlushDisposable||(this.pendingRemovalFlushDisposable=$r(Me(this.domNode),()=>{this.pendingRemovalFlushDisposable=void 0,!this._store.isDisposed&&this.processPendingRemovals()}))}removeStreamingToolEntry(e,t){this.toolDisposables.deleteAndDispose(e);let o=this.toolWrappersByCallId.get(e);o&&(o.remove(),this.toolWrappersByCallId.delete(e));let n=this.lazyItems.findIndex(l=>l.kind==="tool"&&l.toolInvocationOrMarkdown&&(l.toolInvocationOrMarkdown.kind==="toolInvocation"||l.toolInvocationOrMarkdown.kind==="toolInvocationSerialized")&&l.toolInvocationOrMarkdown.toolCallId===e);n!==-1&&this.lazyItems.splice(n,1),this.appendedItemCount=Math.max(0,this.appendedItemCount-1),this.toolInvocationCount=Math.max(0,this.toolInvocationCount-1);let r=this.toolInvocations.findIndex(l=>(l.kind==="toolInvocation"||l.kind==="toolInvocationSerialized")&&l.toolCallId===e);r!==-1&&this.toolInvocations.splice(r,1);let s=this.extractedTitles.indexOf(t);s!==-1&&this.extractedTitles.splice(s,1),this.updateDropdownClickability(),this._onDidChangeHeight.fire()}trackToolMetadata(e,t){if(!e)return;!t?this.hookCount++:this.toolInvocationCount++;let n;if(t&&(t.kind==="toolInvocation"||t.kind==="toolInvocationSerialized")&&t.invocationMessage){if(n=typeof t.invocationMessage=="string"?t.invocationMessage:t.invocationMessage.value,this.toolInvocations.push(t),t.kind==="toolInvocation"){let l=n,c=!1,u=lo.isStreaming(t),p=new P;this.toolDisposables.set(t.toolCallId,p);let h=f=>{if(f&&f!==l){let v=this.extractedTitles.indexOf(l),b=this.extractedTitles.indexOf(f);v!==-1?b!==-1&&b!==v?this.extractedTitles.splice(v,1):this.extractedTitles[v]=f:b===-1&&this.extractedTitles.push(f),l=f,this.lastExtractedTitle=f,!this.fixedScrollingMode&&!this._isExpanded.read(void 0)&&this.setTitle(f)}},g=he(f=>{if(c)return;let v=t.state.read(f);if(u&&v.type!==lo.StateKind.Streaming&&(u=!1,t.presentation==="hidden")){this.pendingRemovals.push({toolCallId:t.toolCallId,toolLabel:l}),this.schedulePendingRemovalsFlush(),c=!0;return}if(v.type===lo.StateKind.Completed||v.type===lo.StateKind.Cancelled){c=!0;return}if(v.type===lo.StateKind.Streaming){u=!0;let S=v.streamingMessage.read(f);if(S){let y=typeof S=="string"?S:S.value;h(y)}return}if(v.type===lo.StateKind.Executing){let S=v.progress.read(f);if(S.message){let y=typeof S.message=="string"?S.message:S.message.value;h(y)}else{let y=t.invocationMessage;if(y){let w=typeof y=="string"?y:y.value;h(w)}}return}let b=t.invocationMessage;if(b){let S=typeof b=="string"?b:b.value;h(S)}});p.add(g)}}else if(t?.kind==="markdownContent"){let s=zMe(t.content.value);if(s?.uri){let l=Ye(s.uri);n=d(7203,null,l)}else n=d(7204,null)}else n=e;this.extractedTitles.includes(n)||this.extractedTitles.push(n),this.lastExtractedTitle=n,!this.fixedScrollingMode&&!this._isExpanded.get()&&this.setTitle(n)}appendItemToDOM(e,t,o,n){if(!e.hasChildNodes()||e.textContent?.trim()==="")return;this.appendedItemCount===1&&n?this.singleItemInfo={element:e,originalParent:n,originalNextSibling:this.domNode}:this.singleItemInfo=void 0;let r=_(".chat-thinking-tool-wrapper"),s=o?.kind==="markdownContent",l=o&&(o.kind==="toolInvocation"||o.kind==="toolInvocationSerialized")&&o.toolSpecificData?.kind==="terminal",c;if(s)c=M.pencil;else if(l){let g=o.toolSpecificData?.terminalCommandState?.exitCode;c=g!==void 0&&g!==0?M.error:M.terminal}else e.classList.contains("chat-hook-outcome-blocked")?c=M.error:e.classList.contains("chat-hook-outcome-warning")?c=M.warning:c=t?Gxi(t):M.tools;let u=_3(c);r.appendChild(u),r.appendChild(e),o&&(o.kind==="toolInvocation"||o.kind==="toolInvocationSerialized")&&o.toolCallId&&this.toolWrappersByCallId.set(o.toolCallId,r),this.appendToWrapper(r),this.fixedScrollingMode&&this.scrollableElement&&this.syncDimensionsAndScheduleScroll()}materializeLazyItem(e){if(e.kind==="thinking"){this.appendToWrapper(e.textContainer),this.textContainer=e.textContainer,this.id=e.content.id,this.updateThinking(e.content);return}if(this.workingSpinnerLabel){let n=e.toolInvocationOrMarkdown&&(e.toolInvocationOrMarkdown.kind==="toolInvocation"||e.toolInvocationOrMarkdown.kind==="toolInvocationSerialized")&&e.toolInvocationOrMarkdown.toolSpecificData?.kind==="terminal"?"terminal":"tool";this.workingSpinnerLabel.textContent=this.getRandomWorkingMessage(n)}if(e.lazy.hasValue)return;let t=e.lazy.value;if(this.appendItemToDOM(t.domNode,e.toolInvocationId,e.toolInvocationOrMarkdown,e.originalParent),t.disposable){let o=e.toolInvocationOrMarkdown&&(e.toolInvocationOrMarkdown.kind==="toolInvocation"||e.toolInvocationOrMarkdown.kind==="toolInvocationSerialized")?e.toolInvocationOrMarkdown.toolCallId:void 0;o?this.toolDisposables.get(o)?.add(t.disposable):this._register(t.disposable)}}setupThinkingContainer(e){if(!this._store.isDisposed){if(this.appendedItemCount++,this.allThinkingParts.push(e),this.textContainer=_(".chat-thinking-item.markdown-content"),e.value){if(this.isExpanded()||this.hasExpandedOnce||this.fixedScrollingMode&&!this.streamingCompleted)this.appendToWrapper(this.textContainer),this.id=e.id,this.updateThinking(e);else{this.content=e,this.id=e.id;let t={kind:"thinking",textContainer:this.textContainer,content:e};this.lazyItems.push(t)}this.workingSpinnerLabel&&(this.workingSpinnerLabel.textContent=this.getRandomWorkingMessage("thinking"))}this.updateDropdownClickability()}}setTitle(e,t){if(!e||this.element.isComplete)return;if(t){if(this._collapseButton){let s=this._collapseButton.labelElement;s.textContent="";let l=_("span");l.textContent=e,s.appendChild(l),this._collapseButton.element.ariaLabel=e}this.titleShimmerSpan=void 0,this.titleDetailContainer=void 0,this.titleDetailRendered&&(this.titleDetailRendered.dispose(),this.titleDetailRendered=void 0),this.currentTitle=e;return}this.lastExtractedTitle=e;let o=`Working: ${e}`;if(this.currentTitle=o,!this._collapseButton)return;let n=this._collapseButton.labelElement;(!this.titleShimmerSpan||!this.titleShimmerSpan.parentElement)&&(n.textContent="",this.titleShimmerSpan=_("span.chat-thinking-title-shimmer"),n.appendChild(this.titleShimmerSpan)),this.titleShimmerSpan.textContent="Working: ",this.titleDetailRendered&&(this.titleDetailRendered.dispose(),this.titleDetailRendered=void 0);let r=this.chatContentMarkdownRenderer.render(new xe(e));r.element.classList.add("collapsible-title-content","chat-thinking-title-detail"),Ck(r.element,this.instantiationService,this.chatMarkdownAnchorService,this._store),this.titleDetailRendered=r,this.titleDetailContainer?this.titleDetailContainer.replaceWith(r.element):n.appendChild(r.element),this.titleDetailContainer=r.element,this._collapseButton.element.ariaLabel=o,this._collapseButton.element.ariaExpanded=String(this.isExpanded())}hasSameContent(e,t,o){return e.kind==="toolInvocation"||e.kind==="toolInvocationSerialized"||e.kind==="markdownContent"||e.kind==="hook"?!0:e.kind!=="thinking"?!1:e?.id!==this.id}dispose(){this.isActive=!1,this.markdownResult&&(this.markdownResult.dispose(),this.markdownResult=void 0),this.titleDetailRendered&&(this.titleDetailRendered.dispose(),this.titleDetailRendered=void 0),this.workingSpinnerElement&&(this.workingSpinnerElement.remove(),this.workingSpinnerElement=void 0,this.workingSpinnerLabel=void 0),this.pendingRemovalFlushDisposable?.dispose(),this.pendingRemovalFlushDisposable=void 0,this.pendingScrollDisposable?.dispose(),super.dispose()}};vD=I([m(4,F),m(5,B),m(6,Av),m(7,Wr),m(8,tt)],vD);var Rme=class extends cT{constructor(e,t,o,n,r,s){super(e,o,void 0,r,s);this.markdownContent=t;this.chatContentMarkdownRenderer=n;this.icon=M.check}initContent(){let e=_(".chat-collapsible-markdown-content.chat-used-context-list");if(this.markdownContent){this.contentElement=_(".chat-collapsible-markdown-body");let t=this._register(this.chatContentMarkdownRenderer.render(new xe(this.markdownContent)));this.contentElement.appendChild(t.element),e.appendChild(this.contentElement)}return e}hasSameContent(e,t,o){return!1}};Rme=I([m(4,tt),m(5,B)],Rme);function Mme(a){return!!a&&A.isUri(a.sessionResource)&&a.$mid===19}var bA=class extends K{constructor(i){super({category:vi,...i})}run(i,...e){let t=Nme(i,e);if(!(!t||!t.editingSession))return this.runEditingSessionAction(i,t.editingSession,t.chatWidget,...e)}};function Nme(a,i){let e=i.at(0),t=Mme(e)?e:void 0,o=a.get(At),n=a.get(dl),r=t?o.getWidgetBySessionResource(t.sessionResource):void 0;return r||(r=o.lastFocusedWidget??o.getWidgetsByLocations("panel").find(l=>l.supportsChangingModes)),r?.viewModel?{editingSession:n.getEditingSession(r.viewModel.model.sessionResource),chatWidget:r}:void 0}var Zet=class extends bA{runEditingSessionAction(i,e,t,...o){let n=[];if(A.isUri(o[0])?n.push(o[0]):t&&n.push(...t.input.selectedElements),!!n.length)return this.runWorkingSetAction(i,e,t,...n)}};W(class extends Zet{constructor(){super({id:"chatEditing.openFileInDiff",title:L(6419,"Open Changes in Diff Editor"),icon:M.diffSingle,menu:[{id:D.ChatEditingWidgetModifiedFilesToolbar,when:x.equals(sR.key,0),order:2,group:"navigation"}]})}async runWorkingSetAction(i,e,t,...o){let n=i.get(ee);for(let r of o){let s=n.activeEditorPane;if(s||(s=await n.openEditor({resource:r})),!s)return;e.getEntry(r)?.getEditorIntegration(s).toggleDiff(void 0,!0)}}});W(class extends Zet{constructor(){super({id:"chatEditing.acceptFile",title:L(6387,"Keep"),icon:M.check,menu:[{when:x.and(x.equals("resourceScheme",_z),x.notIn(Oke.key,kQe.key)),id:D.MultiDiffEditorFileToolbar,order:0,group:"navigation"},{id:D.ChatEditingWidgetModifiedFilesToolbar,when:x.equals(sR.key,0),order:0,group:"navigation"}]})}async runWorkingSetAction(i,e,t,...o){await e.accept(...o)}});W(class extends Zet{constructor(){super({id:"chatEditing.discardFile",title:L(6416,"Undo"),icon:M.discard,menu:[{when:x.and(x.equals("resourceScheme",_z),x.notIn(Oke.key,kQe.key)),id:D.MultiDiffEditorFileToolbar,order:2,group:"navigation"},{id:D.ChatEditingWidgetModifiedFilesToolbar,when:x.equals(sR.key,0),order:1,group:"navigation"}]})}async runWorkingSetAction(i,e,t,...o){await e.reject(...o)}});var $xi=class extends bA{constructor(){super({id:"chatEditing.acceptAllFiles",title:d(6386,null),icon:M.check,tooltip:d(6388,null),precondition:Zx,keybinding:{primary:2051,when:x.and(Zx,ie.inChatInput),weight:200},menu:[{id:D.ChatEditingWidgetToolbar,group:"navigation",order:0,when:x.and(Yj.negate(),x.and(Zx))}]})}async runEditingSessionAction(i,e,t,...o){await e.accept()}};W($xi);var qxi=class extends bA{constructor(){super({id:"chatEditing.discardAllFiles",title:d(6415,null),icon:M.discard,tooltip:d(6417,null),precondition:Zx,menu:[{id:D.ChatEditingWidgetToolbar,group:"navigation",order:1,when:x.and(Yj.negate(),Zx)}],keybinding:{when:x.and(Zx,ie.inChatInput,ie.inputHasText.negate()),weight:200,primary:2049}})}async runEditingSessionAction(i,e,t,...o){await u9o(i,e)}};W(qxi);var jxi=class a extends bA{static{this.ID="chatEditing.toggleExplanationWidget"}constructor(){super({id:a.ID,title:d(6418,null),tooltip:d(6420,null),precondition:Zx,menu:[{id:D.ChatEditingWidgetToolbar,group:"navigation",order:2,when:x.and(Zx,x.has("config.chat.editing.explainChanges.enabled"))}]})}async runEditingSessionAction(i,e,t,...o){e.hasExplanations()?e.clearExplanations():await e.triggerExplanationGeneration()}};W(jxi);async function u9o(a,i){let e=a.get(ct),t=i.entries.get().filter(o=>o.state.get()===0);return t.length>0&&!(await e.confirm({title:d(6393,null),message:t.length===1?d(6391,null,Ye(t[0].modifiedURI)):d(6390,null,t.length),primaryButton:d(6392,null),type:"info"})).confirmed?!1:(await i.reject(),!0)}var Pme=class a extends bA{static{this.ID="chatEditing.viewChanges"}static{this.LABEL=d(6413,null)}constructor(){super({id:a.ID,title:{value:a.LABEL,original:a.LABEL},tooltip:a.LABEL,f1:!0,icon:M.diffMultiple,precondition:Zx,menu:[{id:D.ChatEditingWidgetToolbar,group:"navigation",order:4,when:x.and(Yj.negate(),x.and(zce,Zx))}]})}async runEditingSessionAction(i,e,t,...o){await e.show()}};W(Pme);var ett=class a extends K{static{this.ID="chatEditing.viewAllSessionChanges"}constructor(){super({id:a.ID,title:L(6412,"View All Changes"),icon:M.diffMultiple,category:vi,precondition:ie.hasAgentSessionChanges,menu:[{id:D.ChatEditingSessionChangesToolbar,group:"navigation",order:10,when:ie.hasAgentSessionChanges},{id:D.AgentSessionItemToolbar,group:"navigation",order:0,when:x.and(ie.hasAgentSessionChanges,$p.negate())}]})}async run(i,e){let t=i.get(ia),o=i.get(ge),n=i.get(dl);if(!A.isUri(e)&&!gR(e))return;let r=A.isUri(e)?e:e.resource,s=t.getSession(r),l=s?.changes;if(!s||!l)return;if(s.providerType==="copilotcli"||s.providerType==="copilot-cloud-agent"){if(!Array.isArray(l)||l.length===0)return;let u=l.map(p=>({originalUri:p.originalUri,modifiedUri:p.modifiedUri}));await o.executeCommand("_workbench.openMultiDiffEditor",{multiDiffSourceUri:r.with({scheme:r.scheme+"-worktree-changes"}),title:d(6410,null),resources:u}),s?.setRead(!0);return}await n.getEditingSession(r)?.show(),s?.setRead(!0)}};W(ett);async function ypo(a,i,e){let t=a.get(B),o=a.get(ct),r=a.get(At).getWidgetBySessionResource(i),l=a.get(Si).getSession(i);if(!l)return;let c=l.editingSession;if(!c)return;let u=l.getRequests(),p=u.findIndex(k=>k.id===e);if(p===-1)return;let h=u.length-p,g=u.slice(p),f=new Set(g.map(k=>k.id)),v=c.entries.get().filter(k=>f.has(k.lastModifyingRequestId))??[],b=v.length>0&&t.getValue("chat.editing.confirmEditRequestRemoval")===!0,S;h===1?v.length===1?S=d(6402,null,Ye(v[0].modifiedURI)):S=d(6403,null,v.length):v.length===1?S=d(6398,null,Ye(v[0].modifiedURI)):S=d(6399,null,v.length);let y=b?await o.confirm({title:h===1?d(6404,null):d(6401,null,h),message:S,primaryButton:d(6400,null),checkbox:{label:d(6397,null),checked:!1},type:"info"}):{confirmed:!0};if(!y.confirmed){r?.viewModel?.model.setCheckpoint(void 0);return}y.checkboxChecked&&await t.updateValue("chat.editing.confirmEditRequestRemoval",!1);let w=u[p].id;await c.restoreSnapshot(w,void 0)}async function wpo(a,i){let e=Rr(i)?i.id:Vi(i)?i.requestId:void 0;e&&await ypo(a,i.sessionResource,e)}W(class extends K{constructor(){super({id:"workbench.action.chat.undoEdits",title:L(6409,"Undo Requests"),f1:!1,category:vi,icon:M.discard,keybinding:{primary:20,mac:{primary:2049},when:x.and(ie.inChatSession,ue.textInputFocus.negate(),ie.inChatQuestionCarousel.negate()),weight:200},menu:[{id:D.ChatMessageTitle,group:"navigation",order:2,when:x.and(x.equals("config.chat.editRequests","input").negate(),x.equals("config.chat.checkpoints.enabled",!1),ie.lockedToCodingAgent.negate())}]})}async run(i,...e){let t=e[0],o=i.get(At),n=i.get(B),r=hD(t)&&o.getWidgetBySessionResource(t.sessionResource)||o.lastFocusedWidget;!Vi(t)&&!Rr(t)&&(t=r?.getFocus()),t&&(await wpo(i,t),Rr(t)&&n.getValue("chat.undoRequests.restoreInput")&&(r?.focusInput(),r?.input.setValue(t.messageText,!1)))}});W(class extends K{constructor(){super({id:"workbench.action.chat.restoreCheckpoint",title:L(6405,"Restore Checkpoint"),tooltip:L(6407,"Restores workspace and chat to this point"),f1:!1,category:vi,keybinding:{primary:20,mac:{primary:2049},when:x.and(ie.inChatSession,ue.textInputFocus.negate(),ie.inChatQuestionCarousel.negate()),weight:200},menu:[{id:D.ChatMessageCheckpoint,group:"navigation",order:2,when:x.and(ie.isRequest,ie.lockedToCodingAgent.negate())}]})}async run(i,...e){let t=e[0],o=i.get(At),n=hD(t)&&o.getWidgetBySessionResource(t.sessionResource)||o.lastFocusedWidget;!Vi(t)&&!Rr(t)&&(t=n?.getFocus()),t&&(Rr(t)&&(n?.focusInput(),n?.input.setValue(t.messageText,!1)),n?.viewModel?.model.setCheckpoint(t.id),await wpo(i,t))}});W(class extends K{constructor(){super({id:"workbench.action.chat.restoreLastCheckpoint",title:L(6408,"Restore to Last Checkpoint"),f1:!0,category:vi,icon:M.discard,precondition:x.and(ie.inChatSession,x.equals("config.chat.checkpoints.enabled",!0),ie.lockedToCodingAgent.negate())})}async run(i,...e){let t=e[0],o=i.get(At),n=i.get(Si),r=hD(t)&&o.getWidgetBySessionResource(t.sessionResource)||o.lastFocusedWidget;!Vi(t)&&!Rr(t)&&(t=r?.getFocus());let s=r?.viewModel?.sessionResource??(hD(t)?t.sessionResource:void 0);if(!s)return;let l=n.getSession(s);if(!l?.editingSession)return;let c=l.checkpoint;if(!c){Jo(d(6406,null));return}r?.viewModel?.model.setCheckpoint(c.id),r?.focusInput(),r?.input.setValue(c.message.text,!1),await ypo(i,s,c.id)}});W(class extends K{constructor(){super({id:"workbench.action.chat.editRequests",title:L(6394,"Edit Request"),f1:!1,category:vi,icon:M.edit,keybinding:{primary:3,when:x.and(ie.inChatSession,ue.textInputFocus.negate()),weight:200},menu:[{id:D.ChatMessageTitle,group:"navigation",order:2,when:x.and(x.or(x.equals("config.chat.editRequests","hover"),x.equals("config.chat.editRequests","input")))}]})}async run(i,...e){let t=e[0],o=i.get(At),n=hD(t)&&o.getWidgetBySessionResource(t.sessionResource)||o.lastFocusedWidget;!Vi(t)&&!Rr(t)&&(t=n?.getFocus()),t&&Rr(t)&&n?.startEditing(t.id)}});W(class Cpo extends K{static{this.id="chat.openFileUpdatedBySnapshot"}constructor(){super({id:Cpo.id,title:d(6395,null),menu:[{id:D.ChatEditingCodeBlockContext,group:"navigation",order:0}]})}async run(i,...e){let t=e[0];if(!t?.sessionResource)return;await i.get(ee).openEditor({resource:t.uri})}});W(class xpo extends K{static{this.id="chat.openFileSnapshot"}constructor(){super({id:xpo.id,title:d(6396,null),menu:[{id:D.ChatEditingCodeBlockContext,group:"navigation",order:1}]})}async run(i,...e){let t=e[0];if(!t?.sessionResource)return;let o=i.get(Si),n=i.get(dl),r=i.get(ee),s=o.getSession(t.sessionResource);if(!s)return;let l=n.getEditingSession(s.sessionResource)?.getSnapshotUri(t.requestId,t.uri,t.stopId);if(l){let c=await r.openEditor({resource:l,label:d(6411,null,Ye(t.uri)),options:{activation:1}});pn(c)&&c.updateOptions({readOnly:!0})}}});W(class extends bA{constructor(){super({id:"workbench.action.edits.addFilesFromReferences",title:L(6389,"Add Files From References"),f1:!1,category:vi,menu:{id:D.ChatInputSymbolAttachmentContext,group:"navigation",order:1,when:x.and(ie.chatModeKind.isEqualTo("ask"),ue.hasReferenceProvider)}})}async runEditingSessionAction(i,e,t,...o){if(o.length===0||!nv(o[0]))return;let n=i.get(Nt),r=i.get(zt),s=o[0],c=(await n.createModelReference(s.uri)).object.textEditorModel;if(!c)return;let u=new Ie(s.range.startLineNumber,s.range.startColumn),[p,h,g]=await Promise.all([this.getReferences(u,c,r),this.getDefinitions(u,c,r),this.getImplementations(u,c,r)]),f=[];for(let v of[...h,...g,...p])f.push(t.attachmentModel.asFileVariableEntry(v.uri));t.attachmentModel.addContext(...f)}async getReferences(i,e,t){let o=t.referenceProvider.all(e);return(await Promise.all(o.map(async r=>await r.provideReferences(e,i,{includeDeclaration:!0},ve.None)??[]))).flat()}async getDefinitions(i,e,t){let o=t.definitionProvider.all(e);return(await Promise.all(o.map(async r=>await r.provideDefinition(e,i,ve.None)??[]))).flat()}async getImplementations(i,e,t){let o=t.implementationProvider.all(e);return(await Promise.all(o.map(async r=>await r.provideImplementation(e,i,ve.None)??[]))).flat()}});var Ame=class a extends bA{static{this.Id="chatEditing.viewPreviousEdits"}static{this.Label=d(6414,null)}constructor(){super({id:a.Id,title:{value:a.Label,original:a.Label},tooltip:a.Label,f1:!0,icon:M.diffMultiple,precondition:x.and(ie.enabled,Zx.negate()),menu:[{id:D.ChatEditingWidgetToolbar,group:"navigation",order:4,when:x.and(Yj.negate(),x.and(zce,Zx.negate()))}]})}async runEditingSessionAction(i,e,t,...o){await e.show(!0)}};W(Ame);qe.registerCommand("_chat.editSessions.accept",async(a,i)=>{if(i.length===0)return;let e=i.map(o=>A.revive(o)),t=a.get(dl);for(let o of t.editingSessionsObs.get())await o.accept(...e)});var QPe=class extends Oje{constructor(e,t,o,n,r){super(e,t);this._options=t;this.actionWidgetService=o;this.keybindingService=n;this.telemetryService=r;this._enabled=!0}show(){if(!this._enabled)return;let e=this._options.actionBarActions??this._options.actionBarActionProvider?.getActions()??[],t=this._options.actions??this._options.actionProvider?.getActions()??[],o=t.find(g=>g.checked),n=o,r=[],s=new Map;for(let g of t){let f=g.category;f||(f={label:"",order:Number.MIN_SAFE_INTEGER}),s.has(f.label)||s.set(f.label,[]),s.get(f.label).push(g)}let l=Array.from(s.entries()).sort((g,f)=>{let v=g[1][0]?.category?.order??Number.MAX_SAFE_INTEGER,b=f[1][0]?.category?.order??Number.MAX_SAFE_INTEGER;return v-b});for(let g=0;g<l.length;g++){let[f,v]=l[g];(v[0]?.category?.showHeader??!1)&&f&&r.push({kind:"header",label:f,canPreview:!1,disabled:!1,hideIcon:!1});for(let S of v)r.push({item:S,tooltip:S.tooltip,description:S.description,hover:S.hover,toolbarActions:S.toolbarActions,kind:"action",canPreview:!1,group:{title:"",icon:S.icon??q.fromId(S.checked?M.check.id:M.blank.id)},disabled:!S.enabled,hideIcon:!1,label:S.label,keybinding:this._options.showItemKeybindings?this.keybindingService.lookupKeybinding(S.id):void 0});g<l.length-1&&r.push({label:"",kind:"separator",canPreview:!1,disabled:!1,hideIcon:!1})}let c=Pn(),u=new Set(e.map(g=>g.id)),p={onSelect:(g,f)=>{u.has(g.id)||(n=g),this.actionWidgetService.hide(),g.run()},onHide:()=>{this.hide(),Ao(c)&&c.focus(),this._emitCloseEvent(o,n)}};if(e.length){r.length&&r.push({label:"",kind:"separator",canPreview:!1,disabled:!1,hideIcon:!1});for(let g of e)r.push({item:g,tooltip:g.tooltip,kind:"action",canPreview:!1,group:{title:"",icon:q.fromId(M.blank.id)},disabled:!g.enabled,hideIcon:!1,label:g.label})}let h={isChecked(g){return g.kind==="action"&&!!g?.item?.checked},getRole:g=>{switch(g.kind){case"action":return g.item&&u.has(g.item.id)?"menuitem":"menuitemcheckbox";case"separator":return"separator";default:return"separator"}},getWidgetRole:()=>"menu"};super.show(),this.actionWidgetService.show(this._options.label??"",!1,r,p,this._options.getAnchor?.()??this.element,void 0,[],h,this._options.listOptions)}setEnabled(e){this._enabled=e}_emitCloseEvent(e,t){let o=e,n=t;this._options.reporter&&this.telemetryService.publicLog2("actionWidgetDropdownClosed",{id:this._options.reporter.id,name:this._options.reporter.name,selectionChanged:o?.id!==n?.id,optionIdBefore:this._options.reporter.includeOptions?o?.id:void 0,optionIdAfter:this._options.reporter.includeOptions?n?.id:void 0,optionLabelBefore:this._options.reporter.includeOptions?o?.label:void 0,optionLabelAfter:this._options.reporter.includeOptions?n?.label:void 0})}};QPe=I([m(2,nl),m(3,_e),m(4,Te)],QPe);var r0=class extends oc{constructor(e,t,o,n,r,s){super(void 0,e);this.actionWidgetOptions=t;this._actionWidgetService=o;this._keybindingService=n;this._contextKeyService=r;this._telemetryService=s;this.actionItem=null}render(e){this.actionItem=e;let t=o=>(this.element=R(o,_("a.action-label")),this.renderLabel(this.element));this.actionWidgetDropdown=this._register(new QPe(e,{...this.actionWidgetOptions,labelRenderer:t},this._actionWidgetService,this._keybindingService,this._telemetryService)),this._register(this.actionWidgetDropdown.onDidChangeVisibility(o=>{this.element?.setAttribute("aria-expanded",`${o}`)})),this.updateTooltip(),this.updateEnabled()}renderLabel(e){return e.classList.add("codicon"),this._action.label&&this._register(yp().setupManagedHover(this.options.hoverDelegate??Ni("mouse"),e,this._action.label)),null}updateAriaLabel(){this.element&&this.setAriaLabelAttributes(this.element)}setAriaLabelAttributes(e){e.setAttribute("role","button"),e.setAttribute("aria-haspopup","true"),e.setAttribute("aria-expanded","false"),e.ariaLabel=this.getTooltip()+" - "+(e.textContent||this._action.label)||""}getTooltip(){let e=this.action.tooltip??this.action.label;return this._keybindingService.appendKeybinding(e,this.action.id,this._contextKeyService)}show(){this.actionWidgetDropdown?.show()}updateEnabled(){let e=!this.action.enabled;this.actionItem?.classList.toggle("disabled",e),this.element?.classList.toggle("disabled",e),this.actionWidgetDropdown?.setEnabled(!e)}};r0=I([m(2,nl),m(3,_e),m(4,X),m(5,Te)],r0);function AHt(a){let i=a.match(/(?:github\.com)[/:](?<owner>[^/]+)\/(?<repo>[^/.]+)/);if(i?.groups)return`${i.groups.owner}/${i.groups.repo}`}async function kpo(a,i){try{let e=`${a}/.git`,t=A.file(e),o;try{if((await i.stat(t)).isDirectory)o=A.file(`${e}/config`);else{let u=(await i.readFile(t)).value.toString().trim().replace(/^gitdir:\s*/,""),h=(u.startsWith("/")?u:`${a}/${u}`).replace(/\/worktrees\/[^/]+$/,"");o=A.file(`${h}/config`)}}catch{return}let s=(await i.readFile(o)).value.toString().match(/\[remote\s+"origin"\][^[]*url\s*=\s*(.+)/m);if(s?.[1])return AHt(s[1].trim())}catch{}}var Qxi=class a extends K{static{this.ID="workbench.action.chat.continueChatInSession"}constructor(){super({id:a.ID,title:L(5459,"Continue Chat in..."),tooltip:d(5460,null),precondition:x.and(ie.enabled,ie.requestInProgress.negate(),ie.remoteJobCreating.negate(),ie.hasCanDelegateProviders),menu:[{id:D.ChatExecute,group:"navigation",order:3.4,when:x.and(ie.lockedToCodingAgent.negate(),ie.hasCanDelegateProviders)},{id:D.EditorContent,group:"continueIn",when:x.and(x.equals(Fo.Scheme.key,Y.untitled),x.equals(Fo.LangId.key,PE),x.notEquals(sR.key,0),mI.negate(),ie.hasCanDelegateProviders)}]})}async run(){}},Qee=class extends r0{constructor(e,t,o,n,r,s,l,c,u){super(e,{actionProvider:Qee.actionProvider(s,l,t),actionBarActions:Qee.getActionBarActions(c),reporter:{id:"ChatContinueInSession",name:"ChatContinueInSession",includeOptions:!0}},o,r,n,u);this.location=t;this.contextKeyService=n}static getActionBarActions(e){let t="https://aka.ms/vscode-continue-chat-in";return[{id:"workbench.action.chat.continueChatInSession.learnMore",label:d(5458,null),tooltip:d(5458,null),class:void 0,enabled:!0,run:async()=>{await e.open(A.parse(t))}}]}static actionProvider(e,t,o){return{getActions:()=>{let n=[],r=e.getAllChatSessionContributions(),s=r.find(c=>c.type==="copilotcli");s&&s.canDelegate&&n.push(this.toAction("copilotcli",s,t,o));let l=r.find(c=>c.type==="copilot-cloud-agent");return l&&l.canDelegate&&n.push(this.toAction("copilot-cloud-agent",l,t,o)),n.length===0&&(n.push(this.toSetupAction("copilotcli",t)),n.push(this.toSetupAction("copilot-cloud-agent",t))),n}}}static toAction(e,t,o,n){return{id:t.type,enabled:!0,icon:A_(e),class:void 0,description:`@${t.name}`,label:XS(e),tooltip:d(5463,null,XS(e)),category:{label:d(5461,null),order:0,showHeader:!0},run:()=>o.invokeFunction(r=>n==="editor"?new Xxi().run(r,t):new ttt().run(r,t))}}static toSetupAction(e,t){return{id:e,enabled:!0,icon:A_(e),class:void 0,label:XS(e),tooltip:d(5463,null,XS(e)),category:{label:d(5461,null),order:0,showHeader:!0},run:()=>t.invokeFunction(o=>o.get(ge).executeCommand(pI))}}renderLabel(e){if(this.location==="editor"){let t=bt("span.action-widget-delegate-label",[bt("span",{className:q.asClassName(M.forward)}),bt("span",[d(5462,null)])]);return e.appendChild(t.root),null}else{let t=this.contextKeyService.contextMatchesRules(ie.remoteJobCreating)?M.sync:M.forward;return e.classList.add(...q.asClassNameArray(t)),super.renderLabel(e)}}};Qee=I([m(2,nl),m(3,X),m(4,_e),m(5,Ls),m(6,F),m(7,Qe),m(8,Te)],Qee);var Yxi="workbench.action.chat.openNewSessionEditor",ttt=class{constructor(){}openUntitledEditor(i,e){i.executeCommand(`${Yxi}.${e.type}`)}async extractRepoNwoFromSession(i,e,t,o,n){let r=n.repoData;if(r?.remoteUrl){let l=AHt(r.remoteUrl);if(l)return l}let s=i.getSession(o);if(s?.metadata){let l=s.metadata,c=l.owner,u=l.name;if(c&&u)return`${c}/${u}`;let p=l.repositoryNwo;if(p?.includes("/"))return p;let h=l.repositoryUrl;if(h){let f=AHt(h);if(f)return f}let g=l.workingDirectoryPath??l.repositoryPath??l.worktreePath;if(g){let f=await kpo(g,t);if(f)return f}}for(let l of["repositories","repository"]){let c=e.getSessionOption(o,l);if(c){let u=typeof c=="string"?c:c.id;if(u){if(u.split("/").filter(Boolean).length===2)return u;let h=AHt(u);if(h)return h;try{let g=A.parse(u);if(g.authority==="github"){let f=g.path.split("/").filter(Boolean);if(f.length>=2)return`${f[0]}/${f[1]}`}}catch{}if(Xl(u)){let g=await kpo(u,t);if(g)return g}}}}}async run(i,e,t){let o=i.get(X),n=i.get(ge),r=i.get(At),s=i.get(br),l=i.get(Si),c=i.get(ee),u=i.get(ia),p=i.get(Ls),h=i.get(be),g=ie.remoteJobCreating.bindTo(o);try{g.set(!0);let f=t??r.lastFocusedWidget;if(!f||!f.viewModel)return this.openUntitledEditor(n,e);let v=f.viewModel.model;if(!v)return;let b=f.viewModel.sessionResource,S=v.getRequests(),y=f.getInput();if(!y){if(!S.length)return this.openUntitledEditor(n,e);y="implement this."}let w=f.input.getAttachedAndImplicitContext();if(f.input.acceptInput(!0),f.location==="editor"){let pe=c.activeTextEditorControl;if(pe){let de=pe.getModel(),se;de&&U6(de)&&(se=de.uri);let Se=pe.getSelection();se&&Se&&w.add({kind:"file",id:"vscode.implicit.selection",name:Ye(se),value:{uri:se,range:Se}})}}let k=e.type,T=$p.getValue(o),N=Rf(b);if(T&&N&&N!==k){let de=XI(f.viewContext)?`workbench.action.chat.openNewSessionSidebar.${k}`:`${Yxi}.${k}`,se=2e4,Se=S.map(Ve=>{let Fe=`User: ${Ve.message.text}`,Qt=Ve.response?.response?`Assistant: ${Ve.response.response.getMarkdown()}`:"";return Qt?`${Fe}
${Qt}`:Fe}).join(`
`);Se.length>se&&(Se=Se.substring(Se.length-se));let ke=Se?`The following is the conversation history from a previous ${XS(N)} session. Continue working on it.
${Se}
User: ${y}`:y,Ee=[],He=await this.extractRepoNwoFromSession(u,p,h,b,v);He&&Ee.push({optionId:"repositories",value:He}),await n.executeCommand(de,{prompt:ke,attachedContext:w.asArray(),initialSessionOptions:Ee.length>0?Ee:void 0});return}let O=s.getDefaultAgent("panel"),G=i.get(F).createInstance(AE).parseChatRequestWithReferences(WO(f),gz(f),y,"panel"),$=v.addRequest(G,{variables:w.asArray()},0,void 0,O);await l.removeRequest(b,$.id);let te=await l.sendRequest(b,y,{agentIdSilent:k,attachedContext:w.asArray(),userSelectedModelId:f.input.currentLanguageModel,...f.getModeRequestOptions()});Gj.isSent(te)&&await f.handleDelegationExitIfNeeded(O,te.data.agent)}catch(f){throw console.error("[Delegation] Error creating remote coding agent job",f),f}finally{g.set(!1)}}},Xxi=class{constructor(){}async run(i,e){try{let o=i.get(ee).activeTextEditorControl,n=i.get(ge);if(!o)return;let r=o.getModel();if(!r||!U6(r))return;let s=r.uri,l=[mP(s,"vscode.prompt.file",void 0,!1,[])],c=`Follow instructions in [${Ye(s)}](${s.toString()}).`;await n.executeCommand(`${Yxi}.${e.type}`,{prompt:c,attachedContext:l})}catch(t){throw console.error("Error creating remote agent job from editor",t),t}}},PHt=class extends C{static{this.ID="chat.continueChatInSessionActionRendering"}constructor(i,e){super();let t=i.register(D.EditorContent,Qxi.ID,(o,n,r)=>{if(o instanceof Eo)return e.createInstance(Qee,o,"editor")});Mp(t)}};PHt=I([m(0,Yy),m(1,F)],PHt);var NHt=class extends K{async run(i,...e){let t=e[0],o=i.get(Te),n=i.get(At),r=t?.widget??n.lastFocusedWidget,s=r?.input.pendingDelegationTarget;if(s&&s!=="local")return await this.handleDelegation(i,r,s);if(r?.viewModel?.editing){let l=i.get(B),c=i.get(ct),p=i.get(Si).getSession(r.viewModel.sessionResource);if(!p)return;let h=p.editingSession;if(!h)return;let g=r.viewModel?.editing.id;if(g){let f=p.getRequests(),v=f.findIndex(V=>V.id===g),b=f.length-v,S=f.slice(v),y=new Set(S.map(V=>V.id)),w=h.entries.get().filter(V=>y.has(V.lastModifyingRequestId))??[],k=w.length>0&&l.getValue("chat.editing.confirmEditRequestRemoval")===!0,T;b===1?w.length===1?T=d(5479,null,Ye(w[0].modifiedURI)):T=d(5480,null,w.length):w.length===1?T=d(5475,null,Ye(w[0].modifiedURI)):T=d(5476,null,w.length);let N=k?await c.confirm({title:b===1?d(5481,null):d(5478,null,b),message:T,primaryButton:d(5477,null),checkbox:{label:d(5474,null),checked:!1},type:"info"}):{confirmed:!0};if(N.confirmed)b>0&&o.publicLog2("chat.undoEditsConfirmation",{editRequestType:l.getValue("chat.editRequests"),outcome:"applied",editsUndoCount:b});else{o.publicLog2("chat.undoEditsConfirmation",{editRequestType:l.getValue("chat.editRequests"),outcome:"cancelled",editsUndoCount:b});return}N.checkboxChecked&&await l.updateValue("chat.editing.confirmEditRequestRemoval",!1);let O=f[v].id;await h.restoreSnapshot(O,void 0)}}else r?.viewModel?.model.checkpoint&&r.viewModel.model.setCheckpoint(void 0);r?.acceptInput(t?.inputValue)}async handleDelegation(i,e,t){let r=i.get(Ls).getAllChatSessionContributions().find(s=>Rf(s.type)===t);if(!r)throw new Error(`No contribution found for delegation target: ${t}`);if(r.canDelegate===!1)throw new Error(`The contribution for delegation target: ${t} does not support delegation.`);return new ttt().run(i,r,e)}},p9o=x.or(ie.requestInProgress,ie.Editing.hasToolConfirmation,ie.Editing.hasQuestionCarousel),m9o=x.and(ie.requestInProgress,ie.inputHasText.negate()),h9o=x.or(ie.Editing.hasToolConfirmation,x.and(ie.Editing.hasQuestionCarousel,ie.inputHasText.negate())),Epo=x.or(ie.Editing.hasQuestionCarousel.negate(),ie.inputHasText),YPe=ie.requestInProgress.negate(),SA=class a extends NHt{static{this.ID="workbench.action.chat.submit"}constructor(){let i=ie.chatModeKind.isEqualTo("ask"),e=x.and(ie.inputHasText,YPe,ie.chatSessionOptionsValid);super({id:a.ID,title:L(5494,"Send"),f1:!1,category:vi,icon:M.arrowUp,precondition:e,toggled:{condition:ie.lockedToCodingAgent,icon:M.arrowUp,tooltip:d(5499,null)},keybinding:{when:x.and(ie.inChatInput,ie.withinEditSessionDiff.negate()),primary:3,weight:100},menu:[{id:D.ChatExecute,order:4,when:x.and(YPe,i,ie.withinEditSessionDiff.negate(),Epo),group:"navigation",alt:{id:"workbench.action.chat.sendToNewChat",title:L(5473,"Send to New Chat"),icon:M.plus}},{id:D.ChatEditorInlineExecute,group:"navigation",order:4,when:x.and(x.or(mI.negate(),ie.inputHasText),YPe,ie.requestInProgress.negate(),i)}]})}},aki="workbench.action.chat.toggleAgentMode",Jxi=class a extends K{static{this.ID=aki}constructor(){super({id:a.ID,title:L(5497,"Switch to Next Agent"),f1:!0,category:vi,precondition:x.and(ie.enabled,ie.requestInProgress.negate())})}async run(i,...e){let t=i.get(ge),o=i.get(F),n=i.get(Pv),r=i.get(Te),s=i.get(At),l=e.at(0),c;if(l?.sessionResource?c=s.getWidgetBySessionResource(l.sessionResource):c=Nme(i,e)?.chatWidget,!c)return;let p=c.viewModel?.model?.getRequests().length??0,h=(l&&(n.findModeById(l.modeId)||n.findModeByName(l.modeId)))??this.getNextMode(c,p,n),g=c.input.currentModeObs.get();if(h.id===g.id)return;let f=await o.invokeFunction(get,c.input.currentModeKind,h.kind,p,c.viewModel?.model);if(!f)return;let v=h.source?.storage??"builtin",b=h.source?.storage==="extension"?h.source.extensionId.value:void 0,S=h.customTools?.get()?.length??0,y=h.handOffs?.get()?.length??0,w=h.uri?.get(),k=w?oBt(w):void 0;r.publicLog2("chat.modeChange",{fromMode:t3(g),mode:t3(h),requestCount:p,storage:v,extensionId:b,toolsCount:S,handoffsCount:y,isClaudeAgent:k}),c.input.setChatMode(h.id),f.needToClearSession&&await t.executeCommand(im)}getNextMode(i,e,t){let o=t.getModes(),n=[...o.builtin.filter(l=>l.kind!=="edit"||e===0),...o.custom??[]],r=n.findIndex(l=>l.id===i.input.currentModeObs.get().id);return n[(r+1)%n.length]}},Zxi=class a extends K{static{this.ID="workbench.action.chat.switchToNextModel"}constructor(){super({id:a.ID,title:L(5496,"Switch to Next Model"),category:vi,f1:!0,precondition:ie.enabled})}run(i,...e){i.get(At).lastFocusedWidget?.input.switchToNextModel()}},Ome=class a extends K{static{this.ID="workbench.action.chat.openModelPicker"}constructor(){super({id:a.ID,title:L(5489,"Open Model Picker"),category:vi,f1:!1,keybinding:{primary:2649,weight:200,when:ie.inChatInput},precondition:ie.enabled,menu:{id:D.ChatInput,order:3,group:"navigation",when:x.and(x.or(ie.lockedToCodingAgent.negate(),ie.chatSessionHasTargetedModels),x.or(x.equals(ie.location.key,"panel"),x.equals(ie.location.key,"editor"),x.equals(ie.location.key,"notebook"),x.equals(ie.location.key,"terminal")),x.or(ie.inAgentSessionsWelcome.negate(),ie.chatSessionHasTargetedModels,ie.agentSessionType.isEqualTo("local")))}})}async run(i,...e){let t=i.get(At),o=t.lastFocusedWidget;o&&(await t.reveal(o),o.input.openModelPicker())}},itt=class a extends K{static{this.ID="workbench.action.chat.openPermissionPicker"}constructor(){super({id:a.ID,title:L(5491,"Open Permission Picker"),tooltip:d(5501,null),category:vi,f1:!1,precondition:ie.enabled,menu:{id:D.ChatInputSecondary,order:10,group:"navigation",when:x.and(ie.enabled,ie.location.isEqualTo("panel"),ie.chatModeKind.notEqualsTo("ask"),ie.inQuickChat.negate(),ie.lockedToCodingAgent.negate(),$p.negate())}})}async run(i){let t=i.get(At).lastFocusedWidget;t&&t.input.openPermissionPicker()}},Fme=class a extends K{static{this.ID="workbench.action.chat.openModePicker"}constructor(){super({id:a.ID,title:L(5490,"Open Agent Picker"),tooltip:d(5500,null),category:vi,f1:!1,precondition:ie.enabled,keybinding:{when:x.and(ie.inChatInput,ie.location.isEqualTo("panel")),primary:2137,weight:100},menu:[{id:D.ChatInput,order:1,when:x.and(ie.enabled,ie.location.isEqualTo("panel"),ie.inQuickChat.negate(),x.or(ie.lockedToCodingAgent.negate(),ie.chatSessionHasCustomAgentTarget),x.or(ie.inAgentSessionsWelcome.negate(),ie.chatSessionHasCustomAgentTarget,ie.agentSessionType.isEqualTo("local"))),group:"navigation"}]})}async run(i,...e){let o=i.get(At).lastFocusedWidget;o&&o.input.openModePicker()}},Yee=class a extends K{static{this.ID="workbench.action.chat.openSessionTargetPicker"}constructor(){super({id:a.ID,title:L(5492,"Open Session Target Picker"),tooltip:d(5502,null),category:vi,f1:!1,precondition:x.and(ie.enabled,x.or(ie.chatSessionIsEmpty,ie.inAgentSessionsWelcome),ie.currentlyEditingInput.negate(),ie.currentlyEditing.negate()),menu:[{id:D.ChatInput,order:0,when:x.and(ie.enabled,ie.location.isEqualTo("panel"),ie.inQuickChat.negate(),ie.chatSessionIsEmpty,$p),group:"navigation"},{id:D.ChatInputSecondary,order:0,when:x.and(ie.enabled,ie.location.isEqualTo("panel"),ie.inQuickChat.negate(),$p.negate(),ie.chatSessionIsEmpty),group:"navigation"}]})}async run(i,...e){let o=i.get(At).lastFocusedWidget;o&&o.input.openSessionTargetPicker()}},XPe=class a extends K{static{this.ID="workbench.action.chat.openDelegationPicker"}constructor(){super({id:a.ID,title:L(5488,"Open Delegation Picker"),tooltip:d(5482,null),category:vi,f1:!1,precondition:x.and(ie.enabled,ie.chatSessionIsEmpty.negate(),ie.currentlyEditingInput.negate(),ie.currentlyEditing.negate()),menu:[{id:D.ChatInput,order:.5,when:x.and(ie.enabled,ie.location.isEqualTo("panel"),ie.inQuickChat.negate(),ie.chatSessionIsEmpty.negate(),$p),group:"navigation"},{id:D.ChatInputSecondary,order:.5,when:x.and(ie.enabled,ie.location.isEqualTo("panel"),ie.inQuickChat.negate(),ie.chatSessionIsEmpty.negate(),$p.negate()),group:"navigation"}]})}async run(i,...e){let o=i.get(At).lastFocusedWidget;o&&o.input.openDelegationPicker()}},JPe=class a extends K{static{this.ID="workbench.action.chat.openWorkspacePicker"}constructor(){super({id:a.ID,title:L(5493,"Open Workspace Picker"),tooltip:d(5498,null),category:vi,f1:!1,precondition:x.and(ie.enabled,ie.inAgentSessionsWelcome),menu:[{id:D.ChatInput,order:.6,when:x.and(ie.inAgentSessionsWelcome,ie.chatSessionType.isEqualTo("local"),$p),group:"navigation"},{id:D.ChatInputSecondary,order:.6,when:x.and(ie.inAgentSessionsWelcome,ie.chatSessionType.isEqualTo("local"),$p.negate()),group:"navigation"}]})}async run(i,...e){}},ott=class a extends K{static{this.ID="workbench.action.chat.chatSessionPrimaryPicker"}constructor(){super({id:a.ID,title:L(5487,"Open Primary Session Picker"),category:vi,f1:!1,precondition:ie.enabled,menu:{id:D.ChatInput,order:4,group:"navigation",when:x.and(ie.chatSessionHasModels,x.or(ie.lockedToCodingAgent,x.and(ie.inAgentSessionsWelcome,ie.chatSessionType.notEqualsTo("local"))))}})}async run(i,...e){let o=i.get(At).lastFocusedWidget;o&&o.input.openChatSessionPicker()}},g9o="workbench.action.chat.changeModel",eki=class a extends K{static{this.ID=g9o}constructor(){super({id:a.ID,title:L(5486,"Change Model"),category:vi,f1:!1,precondition:ie.enabled})}run(i,...e){let t=e[0];So(typeof t.vendor=="string"&&typeof t.id=="string"&&typeof t.family=="string");let n=i.get(At).getAllWidgets();for(let r of n)r.input.switchModel(t)}},tki=class a extends NHt{static{this.ID="workbench.action.edits.submit"}constructor(){let i=x.and(x.or(YPe,ie.editingRequestType.isEqualTo(ie.EditingRequestType.Sent)),ie.editingRequestType.notEqualsTo(ie.EditingRequestType.QueueOrSteer)),e=ie.chatModeKind.notEqualsTo("ask"),t=x.and(ie.inputHasText,i,ie.chatSessionOptionsValid);super({id:a.ID,title:L(5483,"Send"),f1:!1,category:vi,icon:M.arrowUp,precondition:t,menu:[{id:D.ChatExecute,order:4,when:x.and(i,e,Epo),group:"navigation",alt:{id:"workbench.action.chat.sendToNewChat",title:L(5473,"Send to New Chat"),icon:M.plus}}]})}},iki=class a extends K{static{this.ID="workbench.action.chat.submitWithoutDispatching"}constructor(){let i=x.and(ie.inputHasText,YPe,ie.chatModeKind.isEqualTo("ask"));super({id:a.ID,title:L(5495,"Send"),f1:!1,category:vi,precondition:i,keybinding:{when:ie.inChatInput,primary:1539,weight:100}})}run(i,...e){let t=e[0],o=i.get(At);(t?.widget??o.lastFocusedWidget)?.acceptInput(t?.inputValue,{noCommandDetection:!0})}},oki=class a extends K{static{this.ID="workbench.action.chat.submitWithCodebase"}constructor(){let i=x.and(ie.inputHasText,YPe);super({id:a.ID,title:L(5472,"Send with {0}",`${su}codebase`),precondition:i,keybinding:{when:ie.inChatInput,primary:2051,weight:100}})}run(i,...e){let t=e[0],o=i.get(At),n=t?.widget??o.lastFocusedWidget;if(!n)return;let s=i.get(jn).getToolByName("codebase");s&&(n.input.attachmentModel.addContext({id:s.id,name:s.displayName??"",fullName:s.displayName??"",value:void 0,icon:q.isThemeIcon(s.icon)?s.icon:void 0,kind:"tool"}),n.acceptInput())}},nki=class extends K{constructor(){let i=ie.inputHasText;super({id:"workbench.action.chat.sendToNewChat",title:L(5473,"Send to New Chat"),precondition:i,category:vi,f1:!1,keybinding:{weight:200,primary:3075,when:ie.inChatInput}})}async run(i,...e){let t=e[0],o=i.get(At),n=i.get(Ft),r=i.get(ct),s=i.get(Si),l=t?.widget??o.lastFocusedWidget;if(!l)return;let c=l.getInput();l.viewModel&&s.cancelCurrentRequestForSession(l.viewModel.sessionResource,"newSessionAction"),!(l.viewModel?.model&&!await het(l.viewModel.model,void 0,r))&&(l.setInput(""),await yBt(l,n),l.acceptInput(c,{storeToHistory:!0}))}},ntt="workbench.action.chat.cancel",rki=class a extends K{static{this.ID=ntt}constructor(){super({id:a.ID,title:L(5484,"Cancel"),f1:!1,category:vi,icon:M.stopCircle,menu:[{id:D.ChatExecute,when:x.and(x.or(m9o,h9o),ie.remoteJobCreating.negate(),ie.currentlyEditing.negate()),order:4,group:"navigation"},{id:D.ChatEditorInlineExecute,when:x.and(WMe.negate(),EB,FZe.negate()),order:4,group:"navigation"}],keybinding:{weight:200,primary:2057,when:x.and(p9o,ie.remoteJobCreating.negate()),win:{primary:513}}})}run(i,...e){let t=e[0],o=i.get(At),n=i.get(ne),r=i.get(Te),s=t?.widget??o.lastFocusedWidget;if(!s){r.publicLog2(j8e,{source:"cancelAction",reason:"noWidget",requestInProgress:"unknown",pendingRequests:0}),n.info("ChatCancelAction#run: No focused chat widget was found");return}let l=i.get(Si);s.viewModel?l.cancelCurrentRequestForSession(s.viewModel.sessionResource,"cancelAction"):(r.publicLog2(j8e,{source:"cancelAction",reason:"noViewModel",requestInProgress:"unknown",pendingRequests:0}),n.info("ChatCancelAction#run: Canceled chat widget has no view model"))}},f9o="workbench.edit.chat.cancel",ski=class a extends K{static{this.ID=f9o}constructor(){super({id:a.ID,title:L(5485,"Cancel Edit"),f1:!1,category:vi,icon:M.x,menu:[{id:D.ChatMessageTitle,group:"navigation",order:1,when:x.and(ie.isRequest,ie.currentlyEditing,x.equals("config.chat.editRequests","input"))}],keybinding:{primary:9,when:x.and(ie.inChatInput,ue.hoverVisible.toNegated(),ue.hasNonEmptySelection.toNegated(),ue.hasMultipleSelections.toNegated(),x.or(ie.currentlyEditing,ie.currentlyEditingInput)),weight:95}})}run(i,...e){let t=e[0],o=i.get(At),n=t?.widget??o.lastFocusedWidget;n&&n.finishedEditing()}};function Tpo(){W(SA),W(tki),W(iki),W(rki),W(nki),W(oki),W(Jxi),W(Zxi),W(Ome),W(itt),W(Fme),W(Yee),W(XPe),W(JPe),W(ott),W(eki),W(ski)}function PB(a){return(i,e,t)=>new rtt(a,i,e,t)}var rtt=class extends CM{constructor(e,t,o,n){let r=()=>{let c=n.get(e.key,t);if(c!==void 0)try{return e.fromStorage(c)}catch{return e.defaultValue}return e.defaultValue},s=r();super(new Pu(void 0,`storage/${e.key}`,void 0),s,hf,Il.ofCaller());this.opts=e;this.storageScope=t;this.storageTarget=o;this.storageService=n;this._store=new P;this._noStorageUpdateNeeded=!1;let l=n.onDidChangeValue(t,e.key,this._store);this._store.add(l(c=>{if(c.external&&c.key===e.key){this._noStorageUpdateNeeded=!0;try{this.set(r(),void 0)}finally{this._noStorageUpdateNeeded=!1}}}))}_setValue(e){if(super._setValue(e),this._noStorageUpdateNeeded)return;let t=this.opts.toStorage(this.get());this.storageService.store(this.opts.key,t,this.storageScope,this.storageTarget)}dispose(){this._store.dispose()}};rtt=I([m(3,le)],rtt);var _po=/^[\w\/\.-]+$/;function OHt(a,i){switch(i){case"'":return`'${a}'`;case'"':return`"${a}"`}return _po.test(a)?a:`'${a}'`}function Dpo(a,i){let e=a.items.find(o=>o.type==="scalar"&&_po.test(o.value)),t=e?i.getValueInRange(e.range).charAt(0):void 0;return t==="'"||t==='"'?t:""}var p2=class{constructor(i,e,t){this._codeEditorService=i;this._promptsService=e;this._languageModelToolsService=t}async openAndRewriteTools(i,e,t){let o=await this._codeEditorService.openCodeEditor({resource:i},this._codeEditorService.getFocusedCodeEditor());if(!o||!o.hasModel())return;let n=o.getModel(),r=this._promptsService.getParsedPromptFile(n);if(!r.header)return;let s=r.header.getAttribute(Hi.tools);if(s)if(o.setSelection(s.range),e===void 0){this.rewriteAttribute(n,"",s.range);return}else this.rewriteTools(n,e,s.value.range,s.value.type==="scalar")}rewriteTools(i,e,t,o){let r=this._languageModelToolsService.toFullReferenceNames(e).map(l=>OHt(l)).join(", "),s=o?r:`[${r}]`;this.rewriteAttribute(i,s,t)}rewriteAttribute(i,e,t){i.pushStackElement(),i.pushEditOperations(null,[An.replaceMove(t,e)],()=>null),i.pushStackElement()}async openAndRewriteName(i,e,t){let o=await this._codeEditorService.openCodeEditor({resource:i},this._codeEditorService.getFocusedCodeEditor());if(!o||!o.hasModel())return;let n=o.getModel(),r=this._promptsService.getParsedPromptFile(n);if(!r.header)return;let s=r.header.getAttribute(Hi.name);s&&(s.value.type==="scalar"&&s.value.value===e||(o.setSelection(s.range),this.rewriteAttribute(n,e,s.value.range)))}};p2=I([m(0,Kt),m(1,nr),m(2,jn)],p2);var Wme;(n=>{function a(r){let s=new Map,l=new Map;for(let[c,u]of r.entries())Km(c)?s.set(c.id,u):l.set(c.id,u);return{toolSets:s,tools:l}}n.fromMap=a;function i(r){return yi(r)&&r.version===void 0&&(r.disabledTools===void 0||Array.isArray(r.disabledTools))&&(r.disabledToolSets===void 0||Array.isArray(r.disabledToolSets))}function e(r){return yi(r)&&r.version===2&&Array.isArray(r.toolSetEntries)&&Array.isArray(r.toolEntries)}function t(r){try{let s=JSON.parse(r);if(e(s))return{toolSets:new Map(s.toolSetEntries),tools:new Map(s.toolEntries)};if(i(s)){let l=s.disabledToolSets?.map(u=>[u,!1]),c=s.disabledTools?.map(u=>[u,!1]);return{toolSets:new Map(l),tools:new Map(c)}}}catch{}return{toolSets:new Map,tools:new Map}}n.fromStorage=t;function o(r){let s={version:2,toolSetEntries:Array.from(r.toolSets.entries()),toolEntries:Array.from(r.tools.entries())};return JSON.stringify(s)}n.toStorage=o})(Wme||={});var ZPe=class extends C{constructor(e,t,o,n,r){super();this._mode=e;this.languageModel=t;this._toolsService=o;this._instantiationService=r;this._sessionStates=new w$;this.entriesMap=Ce(e=>{let t=new Map,o=this.languageModel.read(e)?.metadata,n=this._mode.read(e),r=this._sessionStates.observable.read(e).get(n.id);if(!r&&n.kind==="agent"){let s=n.customTools?.read(e);s&&(r=Wme.fromMap(this._toolsService.toToolAndToolSetEnablementMap(s,o)))}r||(r=this._globalState.read(e));for(let s of this._currentTools.read(e))s.canBeReferencedInPrompt&&t.set(s,r.tools.get(s.id)!==!1);for(let s of this._toolsService.getToolSetsForModel(o,e)){let l=r.toolSets.get(s.id)!==!1;t.set(s,l);for(let c of s.getTools(e))t.set(c,l||r.tools.get(c.id)===!0)}return t});this.userSelectedTools=Ce(e=>{let t={},o=this.entriesMap.read(e);for(let[n,r]of o)Km(n)||(t[n.id]=r);return t});let s=PB({key:"chat/selectedTools",defaultValue:{toolSets:new Map,tools:new Map},fromStorage:Wme.fromStorage,toStorage:Wme.toStorage});this._globalState=this._store.add(s(0,1,n)),this._currentTools=t.map(l=>o.observeTools(l?.metadata)).map((l,c)=>l.read(c))}get entriesScope(){let e=this._mode.get();return this._sessionStates.has(e.id)?1:e.kind==="agent"&&e.customTools?.get()&&e.uri?e.source?.storage!=="extension"?2:3:0}get currentMode(){return this._mode.get()}resetSessionEnablementState(){let e=this._mode.get();this._sessionStates.delete(e.id)}set(e,t){let o=this._mode.get();if(t||this._sessionStates.has(o.id)){this._sessionStates.set(o.id,Wme.fromMap(e));return}if(o.kind==="agent"&&o.customTools?.get()&&o.uri)if(o.source?.storage!=="extension"){this.updateCustomModeTools(o.uri.get(),e);return}else{this._sessionStates.set(o.id,Wme.fromMap(e));return}this._globalState.set(Wme.fromMap(e),void 0)}async updateCustomModeTools(e,t){await this._instantiationService.createInstance(p2).openAndRewriteTools(e,t,ve.None)}};ZPe=I([m(2,jn),m(3,le),m(4,F)],ZPe);var v9o=/("[^"\\]*(?:\\.[^"\\]*)*")|('[^'\\]*(?:\\.[^'\\]*)*')|(\/\*[^\/\*]*(?:(?:\*|\/)[^\/\*]*)*?\*\/)|(\/{2,}.*?(?:(?:\r?\n)|$))|(,\s*[}\]])/g;function b9o(a){return a.replace(v9o,function(i,e,t,o,n,r){if(o)return"";if(n){let s=n.length;return n[s-1]===`
`?n[s-2]==="\r"?`\r
`:`
`:""}else return r?i.substring(1):i})}function xk(a){let i=b9o(a);try{return JSON.parse(i)}catch{let t=i.replace(/,\s*([}\]])/g,"$1");return JSON.parse(t)}}var lki=[],cki=[],Lpo="vscode://schemas/toolsets",S9o={id:Lpo,allowComments:!0,allowTrailingCommas:!0,defaultSnippets:[{label:d(7080,null),body:{"${1:toolSetName}":{tools:["${2:someTool}","${3:anotherTool}"],description:"${4:description}",icon:"${5:tools}"}}}],type:"object",description:d(7085,null),additionalProperties:{type:"object",required:["tools"],additionalProperties:!1,properties:{tools:{description:d(7083,null),type:"array",minItems:1,items:{type:"string",enum:lki,enumDescriptions:cki}},icon:{description:d(7082,null),type:"string",enum:Array.from(k$(),a=>a.id),markdownEnumDescriptions:Array.from(k$(),a=>`$(${a.id})`)},description:{description:d(7081,null),type:"string"}}}},I9o=oe.as(ea.JSONContribution),stt=class a{static{this.suffix=".toolsets.jsonc"}static isToolSetFileName(i){return Ye(i).endsWith(a.suffix)}static from(i,e){if(!yi(i))throw new Error("Invalid tool set data");let t=new Map;for(let[o,n]of Object.entries(i))Jl(o)&&e.error("Tool set name cannot be empty"),JA(n.tools)&&e.error(`Tool set '${o}' cannot have an empty tools array`),t.set(o,{name:o,tools:n.tools,description:n.description,icon:n.icon});return new class extends a{}(t)}constructor(i){this.entries=Object.freeze(new Map(i))}},Vme=class extends C{constructor(e,t,o,n,r,s){super();this._languageModelToolsService=o;this._userDataProfileService=n;this._fileService=r;this._logService=s;Promise.allSettled([e.whenInstalledExtensionsRegistered,t.when(3)]).then(()=>this._initToolSets());let l=ui(this,o.onDidChangeTools,()=>Array.from(o.getAllToolsIncludingDisabled())),c=this._store.add(new P);this._store.add(he(u=>{let p=l.read(u),h=this._languageModelToolsService.toolSets.read(u),g=[];for(let f of p)f.canBeReferencedInPrompt&&g.push({name:f.toolReferenceName??f.displayName,sourceLabel:Rn.classify(f.source).label,sourceOrdinal:Rn.classify(f.source).ordinal,description:f.userDescription??f.modelDescription});for(let f of h)g.push({name:f.referenceName,sourceLabel:Rn.classify(f.source).label,sourceOrdinal:Rn.classify(f.source).ordinal,description:f.description});lki.length=0,cki.length=0,g.sort((f,v)=>f.sourceOrdinal!==v.sourceOrdinal?f.sourceOrdinal-v.sourceOrdinal:f.sourceLabel!==v.sourceLabel?f.sourceLabel.localeCompare(v.sourceLabel):f.name.localeCompare(v.name));for(let f of g)lki.push(f.name),cki.push(d(7084,null,f.sourceLabel,f.name,f.description));c.clear(),I9o.registerSchema(Lpo,S9o,c)}))}static{this.ID="chat.userToolSets"}_initToolSets(){let e=ui(this,this._userDataProfileService.onDidChangeCurrentProfile,()=>this._userDataProfileService.currentProfile.promptsHome),t=Nr(this,this._languageModelToolsService.onDidChangeTools),o=Nr(this,H.filter(this._fileService.onDidFilesChange,s=>s.affects(e.get()))),n=this._store.add(new P),r=async s=>{try{return(await this._fileService.resolve(s)).children??[]}catch{return[]}};this._store.add(he(async s=>{n.clear(),t.read(s),o.read(s);let l=e.read(s),c=new $e;n.add(Z(()=>c.dispose(!0)));let u=await r(l);if(!c.token.isCancellationRequested)for(let p of u){if(!p.isFile||!stt.isToolSetFileName(p.resource))continue;n.add(this._fileService.watch(p.resource));let h;try{let g=await this._fileService.readFile(p.resource,void 0,c.token),f=xk(g.value.toString());h=stt.from(f,this._logService)}catch(g){this._logService.error(`Error reading tool set file ${p.resource.toString()}:`,g);continue}if(c.token.isCancellationRequested)return;for(let[g,f]of h.entries){let v=[],b=[];if(f.tools.forEach(y=>{let w=this._languageModelToolsService.getToolByName(y);if(w){v.push(w);return}let k=this._languageModelToolsService.getToolSetByName(y);if(k){b.push(k);return}}),v.length===0&&b.length===0)continue;let S=this._languageModelToolsService.createToolSet({type:"user",file:p.resource,label:Ye(p.resource)},`user/${p.resource.toString()}/${g}`,g,{icon:f.icon?q.fromId(f.icon):void 0,description:f.description});Ui(y=>{n.add(S),v.forEach(w=>n.add(S.addTool(w,y))),b.forEach(w=>n.add(S.addToolSet(w,y)))})}}}))}};Vme=I([m(0,lt),m(1,ao),m(2,jn),m(3,mn),m(4,be),m(5,ne)],Vme);var eAe=class a extends K{static{this.ID="chat.configureToolSets"}constructor(){super({id:a.ID,title:L(7075,"Configure Tool Sets..."),shortTitle:d(7078,null),category:vi,f1:!0,precondition:x.and(ie.enabled,ie.Tools.toolsCount.greater(0)),menu:{id:fy,when:x.equals("view",Vr),order:11,group:"2_level"}})}async run(i){let e=i.get(jn),t=i.get(Ge),o=i.get(ee),n=i.get(mn),r=i.get(be),s=i.get(Ho),l=[];l.push({label:d(7076,null),alwaysShow:!0,iconClass:q.asClassName(M.plus)});for(let p of e.toolSets.get())p.source.type==="user"&&l.push({label:p.referenceName,toolset:p,tooltip:p.description,iconClass:q.asClassName(p.icon)});let c=await t.pick(l,{canPickMany:!1,placeHolder:d(7077,null)});if(!c)return;let u;if(c.toolset)So(c.toolset.source.type==="user"),u=c.toolset.source.file;else{let p=await t.input({placeHolder:d(7079,null),validateInput:async h=>{if(!h)return d(7073,null);if(!nU(h))return d(7074,null,h)}});if(Jl(p))return;u=je(n.currentProfile.promptsHome,`${p}${stt.suffix}`),await r.exists(u)||await s.write(u,["// Place your tool sets here...","// Example:","// {",'// "toolSetName": {','// "tools": [','// "someTool",','// "anotherTool"',"// ],",'// "description": "description",','// "icon": "tools"',"// }","// }"].join(`
`))}await o.openEditor({resource:u,options:{pinned:!0}})}};function w9o(a){return a.itemType==="bucket"}function FHt(a){return a.itemType==="toolset"}function att(a){return a.itemType==="tool"}function C9o(a){return a.itemType==="callback"}function Mpo(a,i=!1){return a?q.isThemeIcon(a)?{iconClass:q.asClassName(a)}:{iconPath:a}:i?{iconClass:q.asClassName(M.tools)}:{}}function Rpo(a,i){let e=Mpo(a.icon,!0);return{itemType:"tool",tool:a,id:a.id,label:a.toolReferenceName??a.displayName,description:a.userDescription??a.modelDescription,checked:i,...e}}function x9o(a,i,e){let t=Mpo(a.icon),o=[];if(a.source.type==="user"){let n=a.source.file;o.push({iconClass:q.asClassName(M.edit),tooltip:d(5586,null),action:()=>e.openEditor({resource:n})})}return{itemType:"toolset",toolset:a,buttons:o,id:a.id,label:a.referenceName,description:a.description,checked:i,children:void 0,collapsed:!0,...t}}async function WHt(a,i,e,t,o,n,r){let s=a.get(Ge),l=a.get(es),c=a.get(md),u=a.get(ge),p=a.get(zi),h=a.get(ee),g=a.get(Nf),f=a.get(jn),v=a.get(gD),b=a.get(Te),S=new Map;for(let te of l.servers.get())for(let pe of te.tools.get())S.set(pe.id,te);function y(te){let pe=o?new Map([...o()].map(([Fe,Qt])=>[Fe.id,Qt])):void 0;if(!pe){let Fe=new Map;for(let Qt of f.getTools(n))Qt.canBeReferencedInPrompt&&Fe.set(Qt,!1);for(let Qt of f.getToolSetsForModel(n))Fe.set(Qt,!1);pe=Fe}te?.forEach((Fe,Qt)=>{pe.set(Qt.id,Fe)});let de=[],se=new Map,Se=Fe=>{switch(Fe.type){case"mcp":case"extension":return Rn.toKey(Fe);case"internal":return 1 .toString();case"user":return 0 .toString();case"external":throw new Error("should not be reachable");default:Hr(Fe)}},ke=new Map(l.servers.get().map(Fe=>[Fe.definition.id,{server:Fe,seen:!1}])),Ee=(Fe,Qt)=>{if(Fe.type==="mcp"){let Ze=ke.get(Fe.definitionId);if(!Ze)return;Ze.seen=!0;let Ti=Ze.server,ti=[],bo=c.collections.get().find(Ws=>Ws.id===Ti.collection.id);bo?.source?ti.push({iconClass:q.asClassName(M.settingsGear),tooltip:d(5582,null,bo.label),action:()=>bo.source?bo.source instanceof Ei?p.open(bo.source.value,{tab:"features",feature:"mcp"}):g.open(bo.source,{tab:"configuration"}):void 0}):bo?.presentation?.origin&&ti.push({iconClass:q.asClassName(M.settingsGear),tooltip:d(5582,null,bo.label),action:()=>h.openEditor({resource:bo.presentation.origin})}),Ti.connectionState.get().state===ir.Kind.Error&&ti.push({iconClass:q.asClassName(M.warning),tooltip:d(5588,null),action:()=>Ti.showOutput()});let Ro=Ti.cacheState.get(),_o=[],sr=!0;(Ro===0||Ro===2)&&(sr=!1,_o.push({itemType:"callback",iconClass:q.asClassName(M.sync),label:d(5589,null),pickable:!1,run:()=>(k.busy=!0,(async()=>{if(!await n0(Ti,{promptType:"all-untrusted"})){Ti.showOutput(),k.hide();return}k.busy=!1,y(T())})(),!1)}));let ln={itemType:"bucket",ordinal:2,id:Qt,label:Fe.label,checked:void 0,collapsed:sr,children:_o,buttons:ti,sortOrder:2},en=Ti.serverMetadata.get()?.icons.getUrl(22);return en?ln.iconPath=en:ln.iconClass=q.asClassName(M.mcp),ln}else return Fe.type==="extension"?{itemType:"bucket",ordinal:3,id:Qt,label:Fe.label,checked:void 0,children:[],buttons:[],collapsed:!0,iconClass:q.asClassName(M.extensions),sortOrder:3}:Fe.type==="internal"?{itemType:"bucket",ordinal:1,id:Qt,label:d(5585,null),checked:void 0,children:[],buttons:[],collapsed:!1,sortOrder:1}:{itemType:"bucket",ordinal:0,id:Qt,label:d(5591,null),checked:void 0,children:[],buttons:[],collapsed:!0,sortOrder:4}},He=Fe=>{let Qt=Se(Fe),Ze=se.get(Qt);return Ze||(Ze=Ee(Fe,Qt),Ze&&se.set(Qt,Ze)),Ze};for(let Fe of f.getToolSetsForModel(n)){if(!pe.has(Fe.id))continue;let Qt=He(Fe.source);if(!Qt)continue;let Ze=pe.get(Fe.id)===!0;if(Fe.source.type==="mcp")Qt.toolset=Fe,Ze&&(Qt.checked=Ze);else{let Ti=x9o(Fe,Ze,h);Qt.children.push(Ti);let ti=[];for(let bo of Fe.getTools()){let Ro=Ze||pe.get(bo.id)===!0,_o=Rpo(bo,Ro);ti.push(_o)}ti.length>0&&(Ti.children=ti)}}for(let Fe of f.getAllToolsIncludingDisabled()){if(!Fe.canBeReferencedInPrompt||!pe.has(Fe.id))continue;let Qt=He(Fe.source);if(!Qt)continue;let Ze=Qt.checked===!0||pe.get(Fe.id)===!0,Ti=Rpo(Fe,Ze);Qt.children.push(Ti)}for(let{server:Fe,seen:Qt}of ke.values()){let Ze=Fe.cacheState.get();!Qt&&(Ze===0||Ze===2)&&He({type:"mcp",definitionId:Fe.definition.id,label:Fe.definition.label,instructions:"",serverLabel:"",collectionId:Fe.collection.id})}let Ve=Array.from(se.values()).sort((Fe,Qt)=>Fe.sortOrder!==Qt.sortOrder?Fe.sortOrder-Qt.sortOrder:Fe.label.localeCompare(Qt.label));for(let Fe of Ve){de.push(Fe),Fe.children.sort((Qt,Ze)=>Qt.label.localeCompare(Ze.label));for(let Qt of Fe.children)FHt(Qt)&&Qt.children&&Qt.children.sort((Ze,Ti)=>Ze.label.localeCompare(Ti.label))}for(let Fe of Ve){let Qt=Fe.ordinal===2,Ze=Ti=>{if(!v.toolCanManageConfirmation(Ti.tool))return;let ti=Ti.tool,bo=Qt?Fe.children.flatMap(_o=>att(_o)?[_o.tool]:FHt(_o)&&_o.children?_o.children.filter(att).map(sr=>sr.tool):[]):[ti],Ro=Ti.buttons?[...Ti.buttons]:[];Ro.push({iconClass:q.asClassName(M.pass),tooltip:d(5587,null),keepOpen:!0,action:()=>v.manageConfirmationPreferences(bo,{focusToolId:ti.id})}),Ti.buttons=Ro};for(let Ti of Fe.children)if(att(Ti))Ze(Ti);else if(FHt(Ti)&&Ti.children)for(let ti of Ti.children)att(ti)&&Ze(ti)}de.length===0?k.placeholder=d(5590,null):k.placeholder=i,k.setItemTree(de)}let w=new P,k=w.add(s.createQuickTree());k.placeholder=i,k.description=t,k.matchOnDescription=!0,k.matchOnLabel=!0,k.sortByLabel=!1,y(),w.add(k.onDidTriggerItemButton(te=>{te.button&&typeof te.button.action=="function"&&(te.button.action(),w.dispose())}));let T=()=>{let te=new Map,pe=de=>{for(let se of de)if(w9o(se)){if(se.toolset){let Se=se.checked===!0;te.set(se.toolset,Se)}pe(se.children)}else FHt(se)?(te.set(se.toolset,se.checked===!0),se.children&&pe(se.children)):att(se)&&te.set(se.tool,se.checked||te.get(se.tool)===!0)};return pe(k.itemTree),te},N=!1,O=w.add(new E);w.add(k.onDidAccept(()=>{let pe=k.activeItems.find(C9o);if(!pe){N=!0,k.hide();return}pe.run()!==!1&&O.fire()}));let V={iconClass:q.asClassName(M.mcp),tooltip:d(5581,null)},U={iconClass:q.asClassName(M.extensions),tooltip:d(5580,null)},G={iconClass:q.asClassName(M.gear),tooltip:d(5583,null)};k.title=d(5584,null),k.buttons=[V,U,G],w.add(k.onDidTriggerButton(te=>{te===V?u.executeCommand("workbench.mcp.addConfiguration"):te===U?p.openSearch("@tag:language-model-tools"):te===G&&u.executeCommand(eAe.ID),k.hide()})),r&&w.add(r.onCancellationRequested(()=>{k.hide()}));let $=T();return k.show(),await Promise.race([H.toPromise(H.any(k.onDidHide,O.event),w)]),T9o(e,b,$,T(),c),w.dispose(),N?T():void 0}function k9o(a,i){let e=a.source;switch(e.type){case"internal":return{category:"builtin",name:a.id};case"extension":return{category:"extension",name:a.id,extensionId:e.extensionId.value};case"mcp":{let t=i.collections.get().find(o=>o.id===e.collectionId);return t?.source instanceof Ei?{category:"extension-mcp",extensionId:t.source.value}:{category:"user-mcp"}}case"user":return{category:"user-toolset"};case"external":return{category:"user-toolset"};default:Hr(e)}}function E9o(a,i,e){let t={builtinEnabled:0,builtinDisabled:0,extensionEnabled:0,extensionDisabled:0,extensionMcpEnabled:0,extensionMcpDisabled:0,userMcpEnabled:0,userMcpDisabled:0,userToolsetEnabled:0,userToolsetDisabled:0,details:""},o=[];for(let[n,r]of i){if((a.get(n)??!1)===r)continue;let l=k9o(n,e),c=r;switch(l.category){case"builtin":c?t.builtinEnabled++:t.builtinDisabled++,o.push({category:"builtin",name:l.name,enabled:c});break;case"extension":c?t.extensionEnabled++:t.extensionDisabled++,o.push({category:"extension",name:l.name,extensionId:l.extensionId,enabled:c});break;case"extension-mcp":c?t.extensionMcpEnabled++:t.extensionMcpDisabled++,o.push({category:"extension-mcp",extensionId:l.extensionId,enabled:c});break;case"user-mcp":c?t.userMcpEnabled++:t.userMcpDisabled++,o.push({category:"user-mcp",enabled:c});break;case"user-toolset":c?t.userToolsetEnabled++:t.userToolsetDisabled++,o.push({category:"user-toolset",enabled:c});break}}return t.details=JSON.stringify(o),t}function T9o(a,i,e,t,o){let n=E9o(e,t,o),r=n.builtinEnabled>0||n.builtinDisabled>0||n.extensionEnabled>0||n.extensionDisabled>0||n.extensionMcpEnabled>0||n.extensionMcpDisabled>0||n.userMcpEnabled>0||n.userMcpDisabled>0||n.userToolsetEnabled>0||n.userToolsetDisabled>0;i.publicLog2("chatToolPickerClosed",{source:a,changed:r,builtinEnabled:n.builtinEnabled,builtinDisabled:n.builtinDisabled,extensionEnabled:n.extensionEnabled,extensionDisabled:n.extensionDisabled,extensionMcpEnabled:n.extensionMcpEnabled,extensionMcpDisabled:n.extensionMcpDisabled,userMcpEnabled:n.userMcpEnabled,userMcpDisabled:n.userMcpDisabled,userToolsetEnabled:n.userToolsetEnabled,userToolsetDisabled:n.userToolsetDisabled,details:n.details})}var D3="workbench.action.chat.acceptTool",ctt="workbench.action.chat.skipTool",Ppo="workbench.action.chat.acceptToolPostExecution",Apo="workbench.action.chat.skipToolPostExecution",VHt=class extends K{run(i,e){let t=i.get(At),o=e?.sessionResource?t.getWidgetBySessionResource(e.sessionResource):t.lastFocusedWidget,n=o?.viewModel?.getItems().at(-1);if(Vi(n)){for(let r of n.model.response.value){let s=r.kind==="toolInvocation"?r.state.get():void 0;if(s?.type===lo.StateKind.WaitingForConfirmation||s?.type===lo.StateKind.WaitingForPostApproval){s.confirm(this.getReason());break}}o?.focusInput()}}},dki=class extends VHt{constructor(){super({id:D3,title:L(5569,"Accept"),f1:!1,category:vi,keybinding:{when:x.and(ie.inChatSession,ie.Editing.hasToolConfirmation),primary:2051,weight:201}})}getReason(){return{type:4}}},uki=class extends VHt{constructor(){super({id:ctt,title:L(5570,"Skip"),f1:!1,category:vi,keybinding:{when:x.and(ie.inChatSession,ie.Editing.hasToolConfirmation),primary:2563,weight:201}})}getReason(){return{type:5}}},ltt=class a extends K{static{this.ID="workbench.action.chat.configureTools"}constructor(){super({id:a.ID,title:d(5579,null),icon:M.settings,f1:!1,category:vi,precondition:ie.chatModeKind.isEqualTo("agent"),menu:[{when:x.and(ie.chatModeKind.isEqualTo("agent"),ie.lockedToCodingAgent.negate()),id:D.ChatInput,group:"navigation",order:100}]})}async run(i,...e){let t=i.get(F),o=i.get(At),n=i.get(Te),r=o.lastFocusedWidget;if(r||(r=this.extractWidget(e)),!r)return;let s=this.extractSource(e)??"chatInput",l,c,{entriesScope:u,entriesMap:p}=r.input.selectedToolsModel;switch(u){case 1:l=d(5578,null),c=d(5574,null);break;case 2:l=d(5575,null),c=d(5571,null,r.input.currentModeObs.get().label.get());break;case 3:l=d(5577,null),c=d(5573,null,r.input.currentModeObs.get().label.get());break;case 0:l=d(5576,null),c=d(5572,null);break}let h=new $e,g=r.input.currentModeObs.get(),f=he(b=>{g.id!==r.input.currentModeObs.read(b).id&&h.cancel()});try{let b=await t.invokeFunction(WHt,l,s,c,()=>p.get(),r.input.selectedLanguageModel.get()?.metadata,h.token);b&&r.input.selectedToolsModel.set(b,!1)}finally{f.dispose(),h.dispose()}let v=r.input.selectedToolsModel.entriesMap.get();n.publicLog2("chat/selectedTools",{total:v.size,enabled:ht.reduce(v,(b,[S,y])=>y?b+1:b,0)})}extractWidget(i){function e(t){return!!t&&typeof t=="object"&&!!t.widget}for(let t of i)if(e(t))return t.widget}extractSource(i){function e(t){return!!t&&typeof t=="object"&&!!t.source}for(let t of i)if(e(t))return t.source}};function Npo(){W(dki),W(uki),W(ltt)}var Nv=class a extends C{constructor(e){super();this.toolInvocation=e;this._onNeedsRerender=this._register(new E);this.onNeedsRerender=this._onNeedsRerender.event;this._codeBlocksPartId="tool-"+a.idPool++}static{this.idPool=0}get codeblocksPartId(){return this._codeBlocksPartId}getIcon(){let e=this.toolInvocation,t=lo.executionConfirmedOrDenied(e);return t?.type===5?M.circleSlash:t?.type===0?M.error:lo.isComplete(e)?M.check:q.modify(M.loading,"spin")}};var Bme=class extends Nv{get codeblocks(){return this._confirmWidget?.codeblocks||[]}get codeblocksPartId(){return this._confirmWidget?.codeblocksPartId||"<none>"}constructor(i,e,t,o,n,r,s){if(super(i),i.toolSpecificData?.kind!=="extensions")throw new Error("Tool specific data is missing or not of kind extensions");let l=i.toolSpecificData;this.domNode=_("");let c=this._register(s.createInstance(d2,l));R(this.domNode,c.domNode);let u=i.state.get();if(u.type===lo.StateKind.WaitingForConfirmation){let p=d(7264,null),h=t.appendKeybinding(p,D3),g=d(7265,null),f=t.appendKeybinding(g,ntt),v=this._register(new E),b=[{label:p,data:{type:4},tooltip:h,disabled:!0,onDidChangeDisablement:v.event},{label:g,data:{type:0},isSecondary:!0,tooltip:f}],S=this._register(s.createInstance(Kee,e,{title:u.confirmationMessages?.title??d(7266,null),message:u.confirmationMessages?.message??d(7267,null),buttons:b}));this._confirmWidget=S,R(this.domNode,S.domNode),this._register(S.onDidClick(k=>{lo.confirmWith(i,k.data),n.getWidgetBySessionResource(e.element.sessionResource)?.focusInput()}));let y=ie.Editing.hasToolConfirmation.bindTo(o);y.set(!0),this._register(Z(()=>y.reset()));let w=this._register(r.onInstallExtension(k=>{l.extensions.some(T=>Ot({id:T},k.identifier))&&(w.dispose(),v.fire(!1))}))}}};Bme=I([m(2,_e),m(3,X),m(4,At),m(5,ls),m(6,F)],Bme);var _9o=100,Xee=class extends C{constructor(e,t,o,n){super();this._instantiationService=t;this._contextMenuService=o;this._fileService=n;let r=bt(".chat-collapsible-io-resource-group",[bt(".chat-collapsible-io-resource-items@items"),bt(".chat-collapsible-io-resource-actions@actions")]);this.domNode=r.root,this._fillInResourceGroup(e,r.items,r.actions)}async _fillInResourceGroup(e,t,o){let n=[],r=[];for(let c=0;c<e.length;c++){let u=e[c];if(u.mimeType&&X4(u.mimeType))if(u.base64Value)n.push({kind:"file",id:_t(),name:Ye(u.uri),fullName:u.uri.path,value:u.uri}),r.push({index:c,part:u});else if(u.value)n.push({kind:"image",id:_t(),name:Ye(u.uri),value:u.value,mimeType:u.mimeType,isURL:!1,references:[{kind:"reference",reference:u.uri}]});else{let p=await this._fileService.readFile(u.uri).then(h=>h.value.buffer,()=>{});p?n.push({kind:"image",id:_t(),name:Ye(u.uri),value:p,mimeType:u.mimeType,isURL:!1,references:[{kind:"reference",reference:u.uri}]}):n.push({kind:"file",id:_t(),name:Ye(u.uri),fullName:u.uri.path,value:u.uri})}else n.push({kind:"file",id:_t(),name:Ye(u.uri),fullName:u.uri.path,value:u.uri})}if(this._store.isDisposed)return;let s=this._register(this._instantiationService.createInstance(Nee,{variables:n,limit:5,contentReferences:void 0,domNode:void 0}));s.contextMenuHandler=(c,u)=>{let p=n.indexOf(c),h=e[p];h&&(u.preventDefault(),u.stopPropagation(),this._contextMenuService.showContextMenu({menuId:D.ChatToolOutputResourceContext,menuActionOptions:{shouldForwardArgs:!0},getAnchor:()=>({x:u.pageX,y:u.pageY}),getActionsContext:()=>({parts:[h]})}))},t.appendChild(s.domNode);let l=this._register(this._instantiationService.createInstance(Ln,o,D.ChatToolOutputResourceToolbar,{menuOptions:{shouldForwardArgs:!0}}));l.context={parts:e},r.length>0&&this._register(nn(()=>{for(let{index:c,part:u}of r)try{let p=Sl(u.base64Value).buffer;n[c]={kind:"image",id:_t(),name:Ye(u.uri),value:p,mimeType:u.mimeType,isURL:!1,references:[{kind:"reference",reference:u.uri}]}}catch{}s.updateVariables(n)},_9o))}};Xee=I([m(1,F),m(2,ze),m(3,be)],Xee);var pki=class a extends K{static{this.ID="chat.toolOutput.save"}constructor(){super({id:a.ID,title:L(7183,"Save..."),icon:M.cloudDownload,menu:[{id:D.ChatToolOutputResourceToolbar,group:"navigation",order:1},{id:D.ChatToolOutputResourceContext}]})}async run(i,e){let t=i.get(dn),o=i.get(be),n=i.get(Ne),r=i.get(Bo),s=i.get(Pe),l=i.get(ge),c=i.get(ot),u=await t.defaultFilePath(),p=async(g,f,v)=>{let b=f?je(v,Ye(g.uri)):v;try{if(g.kind==="data")await o.copy(g.uri,b,!0);else{let S=await o.readFile(g.uri);await o.writeFile(b,S.value)}}catch(S){n.error(d(7184,null,Ye(g.uri),S))}},h=async(g,f)=>{await r.withProgress({location:15,delay:5e3,title:d(7185,null)},async v=>{for(let b of f)await b(),v.report({increment:1,total:f.length})}),s.isInsideWorkspace(g)?l.executeCommand(JF,g):n.info(d(7186,null,c.getUriLabel(g)))};if(e.parts.length===1){let g=e.parts[0],f=await t.pickFileToSave(je(u,Ye(g.uri)));if(!f)return;await h(f,[()=>p(g,!1,f)])}else{let g=await t.showOpenDialog({title:d(7187,null),canSelectFiles:!1,canSelectFolders:!0,canSelectMany:!1,defaultUri:s.getWorkspace().folders[0]?.uri});if(!g?.length)return;await h(g[0],e.parts.map(f=>()=>p(f,!0,g[0])))}}};W(pki);var L3=class extends C{constructor(e,t,o,n,r,s,l){super();this.context=e;this.parts=t;this._instantiationService=o;this.contextKeyService=n;this._markdownRendererService=r;this.modelService=s;this.languageService=l;this._editorReferences=[];this.codeblocks=[];this.domNode=this.createOutputContents()}toMdString(e){return typeof e=="string"?new xe("").appendText(e):new xe(e.value,{isTrusted:e.isTrusted})}createOutputContents(){let e=_("div");for(let t=0;t<this.parts.length;t++){let o=this.parts[t];if(o.kind==="code"){let r=[o];for(;t+1<this.parts.length&&this.parts[t+1].kind==="code";)r.push(this.parts[++t]);this.addCodeBlock(r,e);continue}let n=[];for(let r=t;r<this.parts.length;r++){let s=this.parts[r];if(s.kind!=="data")break;n.push(s)}this.addResourceGroup(n,e),t+=n.length-1}return e}addResourceGroup(e,t){let o=this._register(this._instantiationService.createInstance(Xee,e));t.appendChild(o.domNode)}addCodeBlock(e,t){let o=e[0];if(o.title){let c=_("div.chat-confirmation-widget-title"),u=this._register(this._markdownRendererService.render(this.toMdString(o.title)));c.appendChild(u.element),t.appendChild(c)}let n=e.map(c=>c.data).join(`
`),r=this._register(this.modelService.createModel(n,this.languageService.createById(o.languageId),void 0,!0)),s={languageId:o.languageId,textModel:Promise.resolve(r),codeBlockIndex:o.codeBlockIndex,codeBlockPartIndex:0,element:this.context.element,parentContextKeyService:this.contextKeyService,renderOptions:o.options,chatSessionResource:this.context.element.sessionResource},l=this._register(this.context.editorPool.get());l.object.render(s,this.context.currentWidth.get()),t.appendChild(l.object.element),this._editorReferences.push(l),this.codeblocks.push({ownerMarkdownPartId:o.ownerMarkdownPartId,codeBlockIndex:o.codeBlockIndex,elementId:this.context.element.id,uri:r.uri,uriPromise:Promise.resolve(r.uri),codemapperUri:void 0,chatSessionResource:this.context.element.sessionResource,focus:()=>{}})}layout(e){this._editorReferences.forEach(t=>t.object.layout(e))}};L3=I([m(2,F),m(3,X),m(4,Qn),m(5,Ct),m(6,kt)],L3);var Jee=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super();this.context=n;this.input=r;this.output=s;this.contextKeyService=u;this._instantiationService=p;this.modelService=g;this.languageService=f;this.chatMarkdownAnchorService=v;this.configurationService=b;this._editorReferences=[];this._contentInitialized=!1;let S=bt(".chat-confirmation-widget-container"),y=bt(".chat-confirmation-widget-title-inner"),w=bt(".chat-confirmation-widget");this.domNode=S.root,S.root.appendChild(w.root),this._titlePart=this._register(p.createInstance(u2,y.root,e,t)),Ck(y.root,this._instantiationService,this.chatMarkdownAnchorService,this._store);let k=document.createElement("span");k.style.flexGrow="1";let T=this._register(new oO(w.root,{}));T.element.classList.add("chat-confirmation-widget-title","monaco-text-button"),T.labelElement.append(y.root);let N=_("span.chat-collapsible-hover-chevron.codicon.codicon-chevron-right");N.setAttribute("aria-hidden","true"),T.element.appendChild(N);let O=pr("accessibility.chat.showCheckmarks",!1,this.configurationService),V=this._expanded=Le(this,c);this._register(he($=>{let te=V.read($),pe=O.read($);if(w.root.classList.toggle("collapsed",!te),l?T.icon=M.error:T.icon=s?M.check:q.modify(M.loading,"spin"),S.root.classList.toggle("show-checkmarks",pe),N.classList.toggle("codicon-chevron-right",!te),N.classList.toggle("codicon-chevron-down",te),te&&!this._contentInitialized){this._contentInitialized=!0;let de=bt(".chat-confirmation-widget-message");de.root.appendChild(this.createMessageContents()),w.root.appendChild(de.root)}}));let U=$=>{if(!$.defaultPrevented){let te=V.get();V.set(!te,void 0),$.preventDefault()}};this._register(T.onDidClick(U));let G=this.output?.parts.filter($=>$.kind==="data").filter($=>!$.audience||$.audience.includes(1));if(G?.length){let te=this._register(this._instantiationService.createInstance(L3,this.context,G)).domNode;te.classList.add("chat-collapsible-top-level-resource-group"),S.root.appendChild(te),this._register(he(pe=>{te.style.display=V.read(pe)?"none":""}))}}get codeblocks(){return this._outputSubPart?.codeblocks??[]}set title(e){this._titlePart.title=e}get title(){return this._titlePart.title}get expanded(){return this._expanded.get()}createMessageContents(){let e=bt("div",[bt("h3@inputTitle"),bt("div@input"),bt("h3@outputTitle"),bt("div@output")]),{input:t,output:o}=this;if(e.inputTitle.textContent=d(7243,null),this.addCodeBlock(t,e.input),!o)e.output.remove(),e.outputTitle.remove();else{e.outputTitle.textContent=d(7244,null);let n=this._register(this._instantiationService.createInstance(L3,this.context,o.parts));this._outputSubPart=n,e.output.appendChild(n.domNode)}return e.root}addCodeBlock(e,t){let o=this._register(this.modelService.createModel(e.data,this.languageService.createById(e.languageId),void 0,!0)),n={languageId:e.languageId,textModel:Promise.resolve(o),codeBlockIndex:e.codeBlockIndex,codeBlockPartIndex:0,element:this.context.element,parentContextKeyService:this.contextKeyService,renderOptions:e.options,chatSessionResource:this.context.element.sessionResource},r=this._register(this.context.editorPool.get());r.object.render(n,this.context.currentWidth.get()||300),t.appendChild(r.object.element),this._editorReferences.push(r)}hasSameContent(e,t,o){return!1}layout(e){this._editorReferences.forEach(t=>t.object.layout(e)),this._outputSubPart?.layout(e)}};Jee=I([m(8,X),m(9,F),m(10,tt),m(11,Ct),m(12,kt),m(13,Av),m(14,B)],Jee);var m2=class extends Nv{static{this._expandedByDefault=new WeakMap}get codeblocks(){return this.collapsibleListPart.codeblocks}constructor(i,e,t,o,n,r,s,l,c,u,p,h){super(i);let g=t,f=w=>({kind:"code",data:w,languageId:"json",codeBlockIndex:g++,ownerMarkdownPartId:this.codeblocksPartId,options:{hideToolbar:!0,reserveWidth:19,maxHeightInLines:13,verticalPadding:5,editorOptions:{wordWrap:"on"}}}),v=s;typeof s=="string"&&(v=[{type:"embed",value:s,isText:!0}]);let b=this.collapsibleListPart=this._register(c.createInstance(Jee,o,n,this.getAutoApproveMessageContent(),e,f(r),v&&v.length>0?{parts:v.map((w,k)=>{let T=w.type==="ref"||w.uri?Ye(w.uri):w.mimeType&&K6(w.mimeType)?`file${K6(w.mimeType)}`:"file"+(w.isText?".txt":".bin");if(w.type==="ref")return{kind:"data",uri:w.uri,mimeType:w.mimeType};if(w.isText&&!w.asResource)return f(w.value);{let N=wB.createUri(e.element.sessionResource,i.toolCallId,k,T);return w.isText?{kind:"data",value:new TextEncoder().encode(w.value),mimeType:w.mimeType,uri:N,audience:w.audience}:{kind:"data",base64Value:w.value,mimeType:w.mimeType,uri:N,audience:w.audience}}})}:void 0,l,l&&h.getValue("chat.tools.autoExpandFailures")||(m2._expandedByDefault.get(i)??!1)));this._register(Z(()=>m2._expandedByDefault.set(i,b.expanded)));let S=i.kind==="toolInvocation"?i.state.map((w,k)=>w.type===lo.StateKind.Executing?w.progress.read(k):void 0):void 0,y=new co(()=>this._register(new fb(b.domNode)));S&&this._register(he(w=>{let k=S?.read(w);k?.message&&(b.title=k.message),k?.progress&&!lo.isComplete(i,w)&&y.value.setWorked(k.progress*100)})),this.domNode=b.domNode}getAutoApproveMessageContent(){return $ee(this.toolInvocation)}};m2=I([m(8,F),m(9,Ct),m(10,kt),m(11,B)],m2);var dtt=ae("chatResponseResourceFileSystemProvider"),tAe=class extends C{constructor(e,t){super();this.chatService=e;this._fileService=t;this.onDidChangeCapabilities=H.None;this.onDidChangeFile=H.None;this.capabilities=19474;this._associated=new vt;this._sessionAssociations=new vt;this._register(this.chatService.onDidDisposeSession(o=>{for(let n of o.sessionResource){let r=this._sessionAssociations.get(n);if(r){for(let s of r)this._associated.delete(s);this._sessionAssociations.delete(n)}}}))}associate(e,t,o){let n=_t(),r=A.from({scheme:wB.scheme,path:`/assoc/${n}`+(o?`/${o}`:"")});this._associated.set(r,t);let s=this._sessionAssociations.get(e);return s||(s=new Mn,this._sessionAssociations.set(e,s)),s.add(r),r}readFile(e){return Promise.resolve(this.lookupURI(e))}readFileStream(e){let t=_I(o=>Je.concat(o.map(n=>Je.wrap(n))).buffer);return Promise.resolve(this.lookupURI(e)).then(o=>t.end(o)),t}async stat(e){let t=await this.lookupURI(e);return{type:1,ctime:0,mtime:0,size:t.length}}delete(){throw Jr("fs is readonly","NoPermissions")}watch(){return C.None}mkdir(){throw Jr("fs is readonly","NoPermissions")}readdir(){return Promise.resolve([])}rename(){throw Jr("fs is readonly","NoPermissions")}writeFile(){throw Jr("fs is readonly","NoPermissions")}findMatchingInvocation(e){let t=wB.parseUri(e);if(!t)throw Jr("File not found","EntryNotFound");let{sessionResource:o,toolCallId:n,index:r}=t,s=this.chatService.getSession(o);if(!s)throw Jr("File not found","EntryNotFound");let l=s.getRequests();for(let c=l.length-1;c>=0;c--){let p=l[c].response?.entireResponse.value.find(h=>(h.kind==="toolInvocation"||h.kind==="toolInvocationSerialized")&&h.toolCallId===n);if(p)return{result:p,index:r}}throw Jr("File not found","EntryNotFound")}lookupURI(e){let t=this._associated.get(e);if(t){if(t instanceof Uint8Array)return t;let l=Sl(t.base64).buffer;return this._associated.set(e,l),l}let{result:o,index:n}=this.findMatchingInvocation(e),r=lo.resultDetails(o);if(!mV(r))throw Jr("Tool does not have I/O","EntryNotFound");let s=r.output.at(n);if(!s)throw Jr("Tool does not have part","EntryNotFound");return s.type==="ref"?this._fileService.readFile(s.uri).then(l=>l.value.buffer):s.isText?new TextEncoder().encode(s.value):Sl(s.value).buffer}};tAe=I([m(0,Si),m(1,be)],tAe);var Hme=class extends C{static{this.ID="chatResponseResourceWorkbenchContribution"}constructor(i,e){super(),this._register(e.registerProvider(wB.scheme,i))}};Hme=I([m(0,dtt),m(1,be)],Hme);function L9o(a){return{transformIncoming:i=>i.scheme==="vscode-remote"?{scheme:"file",path:i.path,query:i.query,fragment:i.fragment}:i.scheme==="file"?{scheme:"vscode-local",path:i.path,query:i.query,fragment:i.fragment}:i,transformOutgoing:i=>i.scheme==="file"?{scheme:"vscode-remote",authority:a,path:i.path,query:i.query,fragment:i.fragment}:i.scheme==="vscode-local"?{scheme:"file",path:i.path,query:i.query,fragment:i.fragment}:i,transformOutgoingScheme:i=>i==="file"?"vscode-remote":i==="vscode-local"?"file":i}}function Opo(a){return new CFt(L9o(a))}var iAe=class extends C{constructor(i,e,t,o,n){super();let r=i.readDefinitions().map(({collection:h})=>h?.presentation?.origin&&n.getWorkspaceFolder(h.presentation?.origin)?.uri),s=async()=>{let h=e.lastModeDebugged;await i.stop(),await i.start({debug:h})},l=!1;this._register(he(h=>{let g=i.readDefinitions().read(h);if(!g.collection||!g.server||!g.server.devMode){l=!1;return}l||!t.delegates.read(h).some(v=>v.canStart(g.collection,g.server))||(i.start(),l=!0)}));let c=i.readDefinitions().map(h=>!!h.server?.devMode?.debug);this._register(Mre(c,({lastValue:h,newValue:g})=>{g&&!uo(h,g)&&s()}));let u=hs({equalsFn:$i},h=>{let f=i.readDefinitions().read(h).server?.devMode?.watch;return typeof f=="string"?[f]:f}),p=this._register(new um);this._register(he(h=>{let g=u.read(h),f=r.read(h);if(!g||!f)return;let v=g.filter(k=>!k.startsWith("!")),b=g.filter(k=>k.startsWith("!")).map(k=>k.slice(1));h.store.add(o.watch(f,{includes:v,excludes:b,recursive:!0}));let S=!o.hasCapability(f,1024),y=v.map(k=>zm({base:f.fsPath,pattern:k},{ignoreCase:S})),w=b.map(k=>zm({base:f.fsPath,pattern:k},{ignoreCase:S}));h.store.add(o.onDidFilesChange(k=>{for(let T of[k.rawAdded,k.rawDeleted,k.rawUpdated])for(let N of T)if(y.some(O=>O(N.fsPath))&&!w.some(O=>O(N.fsPath))){p.queue(s);break}}))}))}};iAe=I([m(2,md),m(3,be),m(4,Pe)],iAe);var oAe=ae("mcpDevModeDebugging"),BHt="127.0.0.1",Zee=class{constructor(i,e){this._debugService=i;this._commandService=e}async transform(i,e){if(!i.devMode?.debug||e.type!==1)return e;let t=await this.getDebugPort(),o=`MCP: ${i.label}`,n={startedByUser:!1,suppressDebugView:!0},r={internalConsoleOptions:"neverOpen",suppressMultipleSessionWarning:!0};switch(i.devMode.debug.type){case"node":{if(!/node[0-9]*$/.test(e.command))throw new Error(d(11393,null,e.command));return this._debugService.startDebugging(void 0,{type:"pwa-node",request:"attach",name:o,port:t,host:BHt,timeout:3e4,continueOnAttach:!0,...r},n),{...e,args:[`--inspect-brk=${BHt}:${t}`,...e.args]}}case"debugpy":{if(!/python[0-9.]*$/.test(e.command))throw new Error(d(11394,null,e.command));let s,l=["--wait-for-client","--connect",`${BHt}:${t}`,...e.args];if(i.devMode.debug.debugpyPath)s=i.devMode.debug.debugpyPath;else try{let c=await this._commandService.executeCommand("python.getDebugpyPackagePath");c&&(s=e.command,l=[c,...l])}catch{}return s||(s="debugpy"),await Promise.race([this._debugService.startDebugging(void 0,{type:"debugpy",name:o,request:"attach",listen:{host:BHt,port:t},...r},n),this.ensureListeningOnPort(t)]),{...e,command:s,args:l}}default:Hr(i.devMode.debug,`Unknown debug type ${JSON.stringify(i.devMode.debug)}`)}}ensureListeningOnPort(i){return Promise.resolve()}getDebugPort(){return Promise.resolve(9230)}};Zee=I([m(0,Li),m(1,ge)],Zee);var Fpo=["image/webp","image/png","image/jpeg","image/jpg","image/gif"];function R9o(a,i,e){let t=a.mimeType?.toLowerCase()||i$e(a.src);if(!t||!Fpo.includes(t)){e.debug(`Ignoring icon with unsupported mime type: ${a.src} (${t}), allowed: ${Fpo.join(", ")}`);return}let o=A.parse(a.src);if(o.scheme==="data")return o;if(o.scheme==="https"||o.scheme==="http"){if(i.type!==2){e.debug(`Ignoring icon with HTTP/HTTPS URL: ${a.src} as the MCP server is not launched with HTTP transport.`);return}let n=i.uri.authority.toLowerCase();if(o.authority.toLowerCase()!==n){e.debug(`Ignoring icon with untrusted authority: ${a.src}, expected authority: ${n}`);return}return o}if(o.scheme==="file"){if(i.type!==1){e.debug(`Ignoring icon with file URL: ${a.src} as the MCP server is not launched as a local process.`);return}return o}e.debug(`Ignoring icon with unsupported scheme: ${a.src}. Allowed: data:, http:, https:, file:`)}function Wpo(a,i,e){let t=[];for(let o of a.icons||[]){let n=R9o(o,i,e);if(!n)continue;let r=typeof o.sizes=="string"?o.sizes.split(" "):Array.isArray(o.sizes)?o.sizes:[];t.push({src:n,theme:o.theme==="light"?0:o.theme==="dark"?1:2,sizes:r.map(s=>{let[l,c]=s.toLowerCase().split("x");return{width:Number(l)||0,height:Number(c)||0}}).sort((s,l)=>s.width-l.width)})}return t.sort((o,n)=>o.sizes[0]?.width-n.sizes[0]?.width),t}var h2=class a{constructor(i){this._icons=i}static fromStored(i){return a.fromParsed(i?.map(e=>({src:A.revive(e.src),theme:e.theme,sizes:e.sizes})))}static fromParsed(i){return new a(i||[])}getUrl(i){let e=this.getSizeWithTheme(i,1);if(e?.theme===2)return{dark:e.src};let t=this.getSizeWithTheme(i,0);if(!(!t&&!e))return{dark:(e||t).src,light:t?.src}}getSizeWithTheme(i,e){let t;for(let o of this._icons)if(o.theme===e||o.theme===2||o.theme===void 0){t=o;let n=o.sizes.find(r=>r.width>=i);if(n)return{...o,sizes:[n]}}return t}};var rAe=ae("mcpSandboxService"),nAe=class extends C{constructor(e,t,o,n,r){super();this._fileService=e;this._environmentService=t;this._logService=o;this._mcpResourceScannerService=n;this._remoteAgentService=r;this._defaultAllowedDomains=["registry.npmjs.org"];this._sandboxConfigPerConfigurationTarget=new Map;this._pathJoin=(e,...t)=>(e===1?Ms:Lo).join(...t);this._getPathDelimiter=async e=>await this._getOperatingSystem(e)===1?Ms.delimiter:Lo.delimiter;this._sandboxSettingsId=_t(),this._remoteEnvDetailsPromise=this._remoteAgentService.getEnvironment()}async isEnabled(e,t){return await this._getOperatingSystem(t)===1?!1:!!e.sandboxEnabled}async launchInSandboxIfEnabled(e,t,o,n){if(t.type!==1)return t;if(await this.isEnabled(e,o)){this._logService.trace(`McpSandboxService: Launching with config target ${n}`);let r=await this._resolveSandboxLaunchDetails(n,o,t.sandbox,t.cwd),s=this._getSandboxCommandArgs(t.command,t.args,r.sandboxConfigPath),l=await this._getSandboxEnvVariables(t.env,r.tempDir,r.rgPath,o);if(r.srtPath)return r.execPath?{...t,command:r.execPath,args:[r.srtPath,...s],env:l,type:1}:{...t,command:r.srtPath,args:s,env:l,type:1};r.execPath||this._logService.warn("McpSandboxService: execPath is unavailable, launching without sandbox runtime wrapper"),this._logService.debug(`McpSandboxService: launch details for server ${e.label} - command: ${t.command}, args: ${t.args.join(" ")}`)}return t}getSandboxConfigSuggestionMessage(e,t,o){let n=this._getSandboxConfigSuggestions(t,o);if(!n)return;let r=n.allowWrite,s=n.allowedDomains,l=[];if(s.length){let u=s.map(p=>`"${p}"`).join(", ");l.push(d(11424,null,u))}if(r.length){let u=r.map(p=>`"${p}"`).join(", ");l.push(d(11425,null,u))}let c={};return s.length&&(c.network={allowedDomains:[...s]}),r.length&&(c.filesystem={allowWrite:[...r]}),{message:d(11426,null,e,l.join(`
`)),sandboxConfig:c}}async applySandboxConfigSuggestion(e,t,o,n,r){let s=this._toMcpResourceTarget(o),l=!1;return await this._mcpResourceScannerService.updateSandboxConfig(c=>{let u=c.sandbox,p=r?.network?.allowedDomains??[],h=r?.filesystem?.allowWrite??[],g=new Set(u?.network?.allowedDomains??[]);for(let b of p)b&&!g.has(b)&&g.add(b);let f=new Set(u?.filesystem?.allowWrite??[]);for(let b of h)b&&!f.has(b)&&f.add(b);if(p.length===0&&h.length===0)return c;l=!0;let v={};return g.size>0&&(v.network={...u?.network,allowedDomains:[...g]}),f.size>0&&(v.filesystem={...u?.filesystem,allowWrite:[...f]}),{...c,sandbox:v}},t,s),l}_getSandboxConfigSuggestions(e,t){if(!e.length)return;let o=new Set,n=new Set,r=new Set(t?.filesystem?.allowWrite??[]),s=new Set(t?.network?.allowedDomains??[]);for(let l of e)l.kind==="network"&&l.host&&!s.has(l.host)&&n.add(l.host),l.kind==="filesystem"&&l.path&&!r.has(l.path)&&o.add(l.path);if(!(!o.size&&!n.size))return{allowWrite:[...o],allowedDomains:[...n]}}_toMcpResourceTarget(e){switch(e){case 2:case 3:case 4:return 2;case 5:return 5;case 6:return 6;default:return 2}}async _resolveSandboxLaunchDetails(e,t,o,n){let r=await this._getOperatingSystem(t);if(r===1)return{execPath:void 0,srtPath:void 0,rgPath:void 0,sandboxConfigPath:void 0,tempDir:void 0};let s=await this._getAppRoot(t),l=await this._getExecPath(r,s,t),c=await this._getTempDir(t),u=this._pathJoin(r,s,"node_modules","@anthropic-ai","sandbox-runtime","dist","cli.js"),p=this._pathJoin(r,s,"node_modules","@vscode","ripgrep","bin","rg"),h=c?await this._updateSandboxConfig(c,e,o,n):void 0;return this._logService.debug(`McpSandboxService: Updated sandbox config path: ${h}`),{execPath:l,srtPath:u,rgPath:p,sandboxConfigPath:h,tempDir:c}}async _getExecPath(e,t,o){if(o)return this._pathJoin(e,t,"node")}async _getSandboxEnvVariables(e,t,o,n){let r={...e};return t&&(r={...r,TMPDIR:t.path,SRT_DEBUG:"true"}),o&&(r={...r,PATH:r.PATH?`${r.PATH}${await this._getPathDelimiter(n)}${wc(o)}`:wc(o)}),n||(r={...r,ELECTRON_RUN_AS_NODE:"1"}),r.VSCODE_INSPECTOR_OPTIONS=null,r}_getSandboxCommandArgs(e,t,o){let n=[];return o&&n.push("--settings",o),n.push(e,...t),n}async _getRemoteEnv(e){return e?this._remoteEnvDetailsPromise:null}async _getOperatingSystem(e){let t=await this._getRemoteEnv(e);return t?t.os:zo}async _getAppRoot(e){let t=await this._getRemoteEnv(e);return t?t.appRoot.path:wc(gn.asFileUri("").path)}async _getTempDir(e){let t=await this._getRemoteEnv(e);if(t)return t.tmpDir;let n=this._environmentService.tmpDir;return n||this._logService.warn("McpSandboxService: Cannot create sandbox settings file because no tmpDir is available in this environment"),n}async _updateSandboxConfig(e,t,o,n){let r=this._withDefaultSandboxConfig(o,n),s,l=ise(t);return this._sandboxConfigPerConfigurationTarget.has(l)?s=A.parse(this._sandboxConfigPerConfigurationTarget.get(l)):(s=A.joinPath(e,`vscode-${l}-mcp-sandbox-settings-${this._sandboxSettingsId}.json`),this._sandboxConfigPerConfigurationTarget.set(l,s.toString())),await this._fileService.createFile(s,Je.fromString(JSON.stringify(r,null," ")),{overwrite:!0}),s.path}_withDefaultSandboxConfig(e,t){let o=new Set(e?.filesystem?.allowWrite??[]);for(let r of this._getDefaultAllowWrite(t?[t]:void 0))r&&o.add(r);let n=new Set(e?.network?.allowedDomains??[]);for(let r of this._defaultAllowedDomains)r&&n.add(r);return{...e,network:{allowedDomains:[...n],deniedDomains:e?.network?.deniedDomains??[]},filesystem:{allowWrite:[...o],denyRead:e?.filesystem?.denyRead??[],denyWrite:e?.filesystem?.denyWrite??[]}}}_getDefaultAllowWrite(e){let t=["~/.npm"];for(let o of e??[]){let n=o.trim();n&&t.push(n)}return t}};nAe=I([m(0,be),m(1,Co),m(2,ne),m(3,MJ),m(4,yo)],nAe);var HHt=class extends C{constructor(){super(...arguments);this._serverTasks=this._register(new jt);this._clientTasks=this._register(new jt);this._onDidUpdateTask=this._register(new E);this.onDidUpdateTask=this._onDidUpdateTask.event}setHandler(e){for(let t of this._clientTasks.values())t.setHandler(e)}getClientTask(e){return this._clientTasks.get(e)}adoptClientTask(e){this._clientTasks.set(e.id,e)}abandonClientTask(e){this._clientTasks.deleteAndDispose(e)}createTask(e,t){let o=_t(),n=new Date().toISOString(),r=Date.now(),s={taskId:o,status:"working",createdAt:n,ttl:e,lastUpdatedAt:new Date().toISOString(),pollInterval:1e3},l=new P,c=new $e;l.add(Z(()=>c.dispose(!0)));let u=this._executeTask(o,t,c.token);return e?l.add(nn(()=>this._serverTasks.deleteAndDispose(o),e)):u.finally(()=>{let p=this._register(nn(()=>{this._serverTasks.deleteAndDispose(o),this._store.delete(p)},6e4))}),this._serverTasks.set(o,{task:s,cts:c,dispose:()=>l.dispose(),createdAtTime:r,executionPromise:u}),{task:s}}async _executeTask(e,t,o){try{let n=await t(o);this._updateTaskStatus(e,"completed",void 0,n)}catch(n){n instanceof ho?this._updateTaskStatus(e,"cancelled","Task was cancelled by the client"):n instanceof gb?this._updateTaskStatus(e,"failed",n.message,void 0,{code:n.code,message:n.message,data:n.data}):n instanceof Error?this._updateTaskStatus(e,"failed",n.message,void 0,{code:Tv.INTERNAL_ERROR,message:n.message}):this._updateTaskStatus(e,"failed","Unknown error",void 0,{code:Tv.INTERNAL_ERROR,message:"Unknown error"})}}_updateTaskStatus(e,t,o,n,r){let s=this._serverTasks.get(e);s&&(s.task.status=t,s.task.lastUpdatedAt=new Date().toISOString(),o!==void 0&&(s.task.statusMessage=o),n!==void 0&&(s.result=n),r!==void 0&&(s.error=r),this._onDidUpdateTask.fire({...s.task}))}getTask(e){let t=this._serverTasks.get(e);if(!t)throw new gb(Tv.INVALID_PARAMS,`Task not found: ${e}`);return{...t.task}}async getTaskResult(e){let t=this._serverTasks.get(e);if(!t)throw new gb(Tv.INVALID_PARAMS,`Task not found: ${e}`);(t.task.status==="working"||t.task.status==="input_required")&&await t.executionPromise;let o=this._serverTasks.get(e);if(!o)throw new gb(Tv.INVALID_PARAMS,`Task not found: ${e}`);if(o.error)throw new gb(o.error.code,o.error.message,o.error.data);if(!o.result)throw new gb(Tv.INTERNAL_ERROR,"Task completed but no result available");return o.result}cancelTask(e){let t=this._serverTasks.get(e);if(!t)throw new gb(Tv.INVALID_PARAMS,`Task not found: ${e}`);if(t.task.status==="completed"||t.task.status==="failed"||t.task.status==="cancelled")throw new gb(Tv.INVALID_PARAMS,`Cannot cancel task in ${t.task.status} status`);return t.task.status="cancelled",t.task.statusMessage="Task was cancelled by the client",t.cts.cancel(),{...t.task}}listTasks(){let e=[];for(let t of this._serverTasks.values())e.push({...t.task});return{tasks:e}}};var UHt=class a{constructor(i,e){this.template=i;this.template=i,this.components=e}static parse(i){let e=[],t=/\{([^{}]+)\}/g,o,n=0;for(;o=t.exec(i);){let[r,s]=o;if(e.push(i.slice(n,o.index)),n=o.index+r.length,i[o.index-1]==="{"||i[n]==="}"){e.push(s);continue}let l="",c=s;c.length>0&&a._isOperator(c[0])&&(l=c[0],c=c.slice(1));let u=c.split(",").map(p=>{let h=p,g=!1,f=!1,v,b=!1;h.endsWith("*")&&(g=!0,f=!0,h=h.slice(0,-1));let S=h.match(/^(.*?):(\d+)$/);return S&&(h=S[1],v=parseInt(S[2],10)),h.endsWith("?")&&(b=!0,h=h.slice(0,-1)),{explodable:g,name:h,optional:b,prefixLength:v,repeatable:f}});e.push({expression:r,operator:l,variables:u})}return e.push(i.slice(n)),new a(i,e)}static{this._operators=["+","#",".","/",";","?","&"]}static _isOperator(i){return a._operators.includes(i)}resolve(i){let e="";for(let t of this.components)typeof t=="string"?e+=t:e+=this._expand(t,i);return e}_expand(i,e){let t=i.operator,o=i.variables;if(o.length===0)return i.expression;let n=[],r=t===";"||t==="?"||t==="&",s=t==="+"||t==="#",l=t==="#",c=t===".",u=t==="/",p=t==="?",h=t==="&",g=t===";",f="";t==="+"?f="":t==="#"?f="#":t==="."?f=".":t==="/"?f="":t===";"?f=";":t==="?"?f="?":t==="&"&&(f="&");for(let b of o){let S=e[b.name],y=Object.prototype.hasOwnProperty.call(e,b.name);if(S==null||Array.isArray(S)&&S.length===0){if(g){y&&S==null&&n.push(b.name);continue}if(p||h){y&&n.push(a._formPair(b.name,"",r));continue}continue}if(typeof S=="object"&&!Array.isArray(S)){if(b.explodable){let T=[];for(let N in S)if(Object.prototype.hasOwnProperty.call(S,N)){let O=String(S[N]);g||p||h||c?T.push(N+"="+O):u?T.push("/"+N+"="+a._encode(O,s)):T.push(N+"="+a._encode(O,s))}c?n.push(T.join(".")):u?n.push(T.join("")):g?n.push(T.join(";")):p||h?n.push(T.join("&")):n.push(T.join(","))}else{let T=[];for(let O in S)Object.prototype.hasOwnProperty.call(S,O)&&(T.push(O),T.push(String(S[O])));let N=T.join(",");c?n.push(N):g||p||h?n.push(b.name+"="+N):n.push(N)}continue}if(Array.isArray(S)){b.explodable?c?n.push(S.join(".")):u?n.push(S.map(T=>"/"+a._encode(T,s)).join("")):g?n.push(S.map(T=>b.name+"="+String(T)).join(";")):p||h?n.push(S.map(T=>b.name+"="+String(T)).join("&")):n.push(S.map(T=>a._encode(T,s)).join(",")):c?n.push(S.join(",")):g||p||h?n.push(b.name+"="+S.join(",")):n.push(S.map(T=>a._encode(T,s)).join(","));continue}let w=String(S);b.prefixLength!==void 0&&(w=w.substring(0,b.prefixLength));let k=a._encode(w,t==="+"||t==="#");g||p||h?n.push(b.name+"="+k):c?n.push(k):u?n.push("/"+k):n.push(k)}let v="";if(c){let b=n.filter(S=>S!=="");v=b.length?f+b.join("."):""}else if(u){let b=n.filter(S=>S!=="");v=b.length?b.join(""):"",v&&!v.startsWith("/")&&(v="/"+v)}else g?v=n.length?f+n.map(b=>b.replace(/=\s*$/,"")).join(";"):"":p||h?v=n.length?f+n.join("&"):"":l?v=f+n.join(","):v=n.join(",");return v}static _encode(i,e){return e?encodeURI(i):M9o(i)}static _formPair(i,e,t){return t?i+"="+encodeURIComponent(String(e)):encodeURIComponent(String(e))}};function M9o(a){let i="";for(let e=0;e<a.length;e++){let t=a.charCodeAt(e);t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||t===45||t===46||t===95||t===126?i+=a[e]:i+="%"+t.toString(16).toUpperCase()}return i}var N9o={serverName:void 0,serverIcons:[],serverInstructions:void 0,trustedAtNonce:void 0,nonce:void 0,tools:[],prompts:void 0,capabilities:void 0},Vpo=/[^a-z0-9_-]/gi,Ume=class extends C{constructor(e,t){super();this.didChange=!1;this.cache=new il(128);this.extensionServers=new Map;let o="mcpToolCache";this._register(t.onWillSaveState(()=>{this.didChange&&(t.store(o,{extensionServers:[...this.extensionServers],serverTools:this.cache.toJSON()},e,1),this.didChange=!1)}));try{let n=t.getObject(o,e);this.extensionServers=new Map(n?.extensionServers??[]),n?.serverTools?.forEach(([r,s])=>this.cache.set(r,s))}catch{}}reset(){this.cache.clear(),this.extensionServers.clear(),this.didChange=!0}get(e){return this.cache.get(e)}store(e,t){let o=this.get(e)||N9o;this.cache.set(e,{...o,...t}),this.didChange=!0}getServers(e){return this.extensionServers.get(e)}storeServers(e,t){t?this.extensionServers.set(e,t):this.extensionServers.delete(e),this.didChange=!0}};Ume=I([m(1,le)],Ume);var sAe=class{constructor(i,e,t,o,n,r){this._definitionId=i;this._cache=e;this._fromStaticDefinition=t;this._fromCache=o;this._toT=n;this.defaultValue=r;this.fromServerPromise=Le(this,void 0);this.fromServer=Ce(i=>this.fromServerPromise.read(i)?.promiseResult.read(i)?.data);this.value=Ce(i=>{let t=this.fromServer.read(i)?.data??this._fromStaticDefinition?.read(i)??this.fromCache?.data??this.defaultValue;return this._toT(t,i)})}get fromCache(){let i=this._cache.get(this._definitionId);return i?{data:this._fromCache(i),nonce:i.nonce}:void 0}hasStaticDefinition(i){return!!this._fromStaticDefinition?.read(i)}},Ov=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N){super();this.definition=t;this._requiresExtensionActivation=n;this._primitiveCache=r;this._mcpRegistry=l;this._extensionService=u;this._loggerService=p;this._outputService=h;this._telemetryService=g;this._commandService=f;this._instantiationService=v;this._dialogService=b;this._notificationService=S;this._openerService=y;this._samplingService=w;this._elicitationService=k;this._mcpSandboxService=T;this._taskManager=this._register(new HHt);this._connectionSequencer=new Nm;this._connection=this._register(X0(this,void 0));this.connection=this._connection;this.connectionState=Ce(e=>this._connection.read(e)?.state.read(e)??{state:ir.Kind.Stopped});this.cacheState=Ce(e=>{let t=()=>this._fullDefinitions.read(e)?.server?.cacheNonce,o=()=>this._tools.hasStaticDefinition(e)?1:this._tools.fromCache?t()===this._tools.fromCache.nonce?1:2:0,n=this._tools.fromServerPromise.read(e),r=this.connectionState.read(e);if(ir.canBeStarted(r.state)||!n)return o();let l=n?.promiseResult.read(e);return l?l.error?o():l.data?.nonce===t()?5:2:this._tools.fromCache?4:3});this._lastModeDebugged=!1;this._isQuietStart=!1;this._isSandboxSuggestionDialogVisible=!1;this._potentialSandboxBlocks=[];this._potentialSandboxBlockListener=this._register(new me);this.runningToolCalls=new Set;this.collection=e,this._fullDefinitions=this._mcpRegistry.getServerDefinition(this.collection,this.definition),this._loggerId=`mcpServer.${t.id}`,this._logger=this._register(p.createLogger(this._loggerId,{hidden:!0,name:`MCP: ${t.label}`}));let O=this;this._register(this._instantiationService.createInstance(iAe,this,{get lastModeDebugged(){return O._lastModeDebugged}})),this._register(Z(()=>p.deregisterLogger(this._loggerId)));let V=o?Le(this,o.map($=>({uri:$,name:Ye($)}))):ui(this,c.onDidChangeWorkspaceFolders,()=>c.getWorkspace().folders),U=N.remoteAuthority?Opo(N.remoteAuthority):void 0;this._register(he($=>{let te=this._connection.read($)?.handler.read($);te&&(te.roots=V.read($).filter(pe=>pe.uri.authority===(e.remoteAuthority||"")).map(pe=>{let de=A.from(U?.transformIncoming(pe.uri)??pe.uri);return de.scheme===Y.file&&(de=A.file(Hp(de.fsPath,!0))),{name:pe.name,uri:de.toString()}}))})),this._register(he($=>{let te=this._connection.read($),pe=te?.handler.read($);pe?this._populateLiveData(pe,te?.definition.cacheNonce,$.store):this._tools&&this.resetLiveData()})),this._register(he($=>{let te=this._connection.read($);this._potentialSandboxBlockListener.value=te?.onPotentialSandboxBlock(pe=>this.recordPotentialSandboxBlock(pe))}));let G=Ce($=>{let te=this._fullDefinitions.read($).server;return te&&te.cacheNonce!==this._tools.fromCache?.nonce?te.staticMetadata:void 0});this._tools=new sAe(this.definition.id,this._primitiveCache,G.map($=>{let te=$?.tools?.filter(pe=>pe.availability===0).map(pe=>pe.definition);return te?.length?new Au(this._getValidatedTools(te)):void 0}).map(($,te)=>$?.promiseResult.read(te)?.data),$=>$.tools,$=>$.map(te=>this._instantiationService.createInstance(utt,this,s,te)).sort((te,pe)=>te.compare(pe)),[]),this._prompts=new sAe(this.definition.id,this._primitiveCache,void 0,$=>$.prompts||[],$=>$.map(te=>new mki(this,te)),[]),this._serverMetadata=new sAe(this.definition.id,this._primitiveCache,G.map($=>$?this._toStoredMetadata($?.serverInfo,$?.instructions):void 0),$=>({serverName:$.serverName,serverInstructions:$.serverInstructions,serverIcons:$.serverIcons}),$=>({serverName:$?.serverName,serverInstructions:$?.serverInstructions,icons:h2.fromStored($?.serverIcons)}),void 0),this._capabilities=new sAe(this.definition.id,this._primitiveCache,G.map($=>$?.capabilities!==void 0?Bpo($.capabilities):void 0),$=>$.capabilities,$=>$,void 0)}static async callOn(e,t,o=ve.None){await e.start({promptType:"all-untrusted"});let n=!1,r,s=new Promise((l,c)=>{r=he(u=>{let p=e.connection.read(u);if(!p||n)return;let h=p.handler.read(u);if(!h){let g=p.state.read(u);if(g.state===ir.Kind.Error){c(new u6e(`MCP server could not be started: ${g.message}`));return}else if(g.state===ir.Kind.Stopped){c(new u6e("MCP server has stopped"));return}else return}l(t(h,p)),n=!0})});return pm(s,o).finally(()=>r.dispose())}get capabilities(){return this._capabilities.value}get tools(){return this._tools.value}get prompts(){return this._prompts.value}get serverMetadata(){return this._serverMetadata.value}get trustedAtNonce(){return this._primitiveCache.get(this.definition.id)?.trustedAtNonce}set trustedAtNonce(e){this._primitiveCache.store(this.definition.id,{trustedAtNonce:e})}get logger(){return this._logger}readDefinitions(){return this._fullDefinitions}showOutput(e){return this._loggerService.setVisibility(this._loggerId,!0),this._outputService.showChannel(this._loggerId,e)}resources(e){let t=new $e(e);return new Fp(async o=>{await Ov.callOn(this,async n=>{for await(let r of n.listResourcesIterable({},t.token))if(o.emitOne(r.map(s=>new hki(this,s,h2.fromParsed(this._parseIcons(s))))),t.token.isCancellationRequested)return})},()=>t.dispose(!0))}resourceTemplates(e){return Ov.callOn(this,async t=>(await t.listResourceTemplates({},e)).map(n=>new gki(this,n,h2.fromParsed(this._parseIcons(n)))),e)}start({interaction:e,autoTrustChanges:t,promptType:o,debug:n,errorOnUserInteraction:r}={}){return e?.participants.set(this.definition.id,{s:"unknown"}),this._connectionSequencer.queue(async()=>{let s=bJe(this.collection.id.slice(YJi.length));if(this._requiresExtensionActivation&&!this._extensionService.activationEventIsDone(s)&&(await this._extensionService.activateByEvent(s),await Promise.all(this._mcpRegistry.delegates.get().map(p=>p.waitForInitialProviderPromises())),this._store.isDisposed))return{state:ir.Kind.Stopped};let l=this._connection.get();if(this._isQuietStart=!!r,l&&ir.canBeStarted(l.state.get().state)&&(l.dispose(),l=void 0,this._connection.set(l,void 0)),!l){this._lastModeDebugged=!!n;let p=this;if(l=await this._mcpRegistry.resolveConnection({interaction:e,autoTrustChanges:t,promptType:o,trustNonceBearer:{get trustedAtNonce(){return p.trustedAtNonce},set trustedAtNonce(h){p.trustedAtNonce=h}},logger:this._logger,collectionRef:this.collection,definitionRef:this.definition,debug:n,errorOnUserInteraction:r,taskManager:this._taskManager}),!l)return{state:ir.Kind.Stopped};if(this._store.isDisposed)return l.dispose(),{state:ir.Kind.Stopped};this._connection.set(l,void 0),l.definition.devMode&&this.showOutput()}this._potentialSandboxBlocks.length=0;let c=Date.now(),u=await l.start({createMessageRequestHandler:(p,h)=>this._samplingService.sample({isDuringToolCall:this.runningToolCalls.size>0,server:this,params:p},h).then(g=>g.sample),elicitationRequestHandler:async(p,h)=>{let g=l.handler.get()?.serverInfo;g&&this._telemetryService.publicLog2("mcp.elicitationRequested",{serverName:g.name,serverVersion:g.version});let f=await this._elicitationService.elicit(this,ht.first(this.runningToolCalls),p,h||ve.None);return f.dispose(),f.value}});if(this._telemetryService.publicLog2("mcp/serverBootState",{state:ir.toKindString(u.state),time:Date.now()-c}),r&&u.state===ir.Kind.Running){let p;u=await new Promise((h,g)=>{p=he(f=>{l.handler.read(f)&&h(u);let b=l.state.read(f);b.state===ir.Kind.Stopped&&b.reason==="needs-user-interaction"&&g(new dw("auth")),ir.isRunning(b)||h(b)})}).finally(()=>p.dispose())}if(u.state===ir.Kind.Error){let p;u=await new Promise((h,g)=>{p=he(f=>{let v=this._connection.read(f),b=v?.state.read(f);v&&b?.state===ir.Kind.Error&&(this._isQuietStart?g(new dw("start")):this.showInteractiveError(v,b,this._lastModeDebugged))})}).finally(()=>p.dispose())}return u}).finally(()=>{e?.participants.set(this.definition.id,{s:"resolved"})})}showInteractiveError(e,t,o){if(e.definition.sandboxEnabled){this.showSandboxConfigSuggestionFromPotentialBlocks(e,this._potentialSandboxBlocks)||this._notificationService.warn(d(11438,null,e.definition.label,t.message));return}if(t.code==="ENOENT"&&e.launchDefinition.type===1){let n;switch(e.launchDefinition.command){case"uvx":n="https://aka.ms/vscode-mcp-install/uvx";break;case"npx":n="https://aka.ms/vscode-mcp-install/npx";break;case"dnx":n="https://aka.ms/vscode-mcp-install/dnx";break;case"dotnet":n="https://aka.ms/vscode-mcp-install/dotnet";break}let r=[{label:d(11427,null),run:()=>this.showOutput()}];if(e.definition.devMode?.debug?.type==="debugpy"&&o){this._notificationService.prompt(St.Error,d(11431,null,e.launchDefinition.command,e.definition.label),[...r,{label:d(11441,null),run:()=>this._openerService.open(A.parse("https://aka.ms/vscode-mcp-install/debugpy"))}]);return}n&&r.push({label:d(11439,null,e.launchDefinition.command),run:()=>this._openerService.open(A.parse(n))}),this._notificationService.prompt(St.Error,d(11440,null,e.launchDefinition.command,e.definition.label),r)}else this._notificationService.warn(d(11438,null,e.definition.label,t.message))}showSandboxConfigSuggestionFromPotentialBlocks(e,t){if(!e.definition.sandboxEnabled||!t.length||this._isSandboxSuggestionDialogVisible)return!1;if(this._isQuietStart)throw new dw("sandbox-suggestion");let o=this._fullDefinitions.get().collection?.sandbox,n=this._mcpSandboxService.getSandboxConfigSuggestionMessage(e.definition.label,t,o);return n?(this._confirmAndApplySandboxConfigSuggestion(e,t,n),!0):(this._removePotentialSandboxBlocks(t),!1)}_confirmAndApplySandboxConfigSuggestion(e,t,o){let n=e.definition.presentation?.origin?.uri??this.collection.presentation?.origin,r=this._fullDefinitions.get().collection?.configTarget;this._isSandboxSuggestionDialogVisible=!0,this._dialogService.confirm({type:"warning",message:d(11435,null,e.definition.label),detail:o.message,primaryButton:d(11437,null),cancelButton:d(11436,null)}).then(async s=>{if(s.confirmed){if(!n||r===void 0){this._notificationService.warn(d(11434,null,e.definition.label));return}try{await this._mcpSandboxService.applySandboxConfigSuggestion(e.definition,n,r,t,o.sandboxConfig)&&(this._removePotentialSandboxBlocks(t),this._notificationService.info(d(11433,null,e.definition.label)))}catch(l){this._notificationService.error(d(11432,null,e.definition.label,l instanceof Error?l.message:String(l)))}}}).finally(()=>{this._isSandboxSuggestionDialogVisible=!1})}recordPotentialSandboxBlock(e){this._potentialSandboxBlocks.push(e),this._potentialSandboxBlocks.length>200&&this._potentialSandboxBlocks.splice(0,this._potentialSandboxBlocks.length-200);let t=this._connection.get();t?.state.get().state===ir.Kind.Running&&this.showSandboxConfigSuggestionFromPotentialBlocks(t,this._potentialSandboxBlocks)}_removePotentialSandboxBlocks(e){if(!e.length||!this._potentialSandboxBlocks.length)return;let t=new Set(e);this._potentialSandboxBlocks=this._potentialSandboxBlocks.filter(o=>!t.has(o))}stop(){return this._connection.get()?.stop()||Promise.resolve()}awaitToolRefresh(){return new Promise(e=>{ux(t=>{this._tools.fromServerPromise.read(t)?.promiseResult.read(t)&&e()})})}resetLiveData(){Ui(e=>{this._tools.fromServerPromise.set(void 0,e),this._prompts.fromServerPromise.set(void 0,e)})}async _normalizeTool(e){let t=e._meta?.ui,o=3;t?.visibility&&Array.isArray(t.visibility)&&(o&=0,t.visibility.includes("model")&&(o|=1),t.visibility.includes("app")&&(o|=2));let n={...e,serverToolName:e.name,_icons:this._parseIcons(e),visibility:o,uiResourceUri:t?.resourceUri};n.description||(this._logger.warn(`Tool ${n.name} does not have a description. Tools must be accurately described to be called`),n.description="<empty>"),Vpo.test(n.name)&&(this._logger.warn(`Tool ${JSON.stringify(n.name)} is invalid. Tools names may only contain [a-z0-9_-]`),n.name=n.name.replace(Vpo,"_")),n.inputSchema&&!n.inputSchema.properties&&(n.inputSchema={...n.inputSchema,properties:{}});let r=[],s=JSON.stringify(n.inputSchema);try{let u=A.parse("https://json-schema.org/draft-07/schema");r=await this._commandService.executeCommand("json.validate",u,s)||[]}catch{}if(!r.length)return n;let l=zL(s);return{error:r.map(u=>{let p=Bci(l,u.range[0].character),h=p&&`/${Vci(p).join("/")}`;return u.message+(h?` (at ${h})`:"")})}}async _getValidatedTools(e){let t="",o=await Promise.all(e.map(r=>this._normalizeTool(r))),n=[];for(let[r,s]of o.entries())if("error"in s){t+=d(11430,null,e[r].name)+`
`;for(let l of s.error)t+=` - ${l}
`;t+=` - Schema: ${JSON.stringify(e[r].inputSchema)}
`}else n.push(s);return t&&(this._logger.warn(`${e.length-n.length} tools have invalid JSON schemas and will be omitted`),O9o(this._instantiationService,this.definition.label,t)),n}_parseIcons(e){let t=this._connection.get();return t?Wpo(e,t.launchDefinition,this._logger):[]}_setServerTools(e,t,o){let n=t.then(async r=>{this._logger.info(`Discovered ${r.length} tools`);let s=await this._getValidatedTools(r);return this._primitiveCache.store(this.definition.id,{tools:s,nonce:e}),{data:s,nonce:e}});return this._tools.fromServerPromise.set(new Au(n),o),n}_setServerPrompts(e,t,o){let n=t.then(r=>{let s=r.map(l=>({...l,_icons:this._parseIcons(l)}));return this._primitiveCache.store(this.definition.id,{prompts:s,nonce:e}),{data:s,nonce:e}});return this._prompts.fromServerPromise.set(new Au(n),o),n}_toStoredMetadata(e,t){return{serverName:e?e.title||e.name:void 0,serverInstructions:t,serverIcons:e?this._parseIcons(e):void 0}}_setServerMetadata(e,{serverInfo:t,instructions:o,capabilities:n},r){let s=this._toStoredMetadata(t,o);this._serverMetadata.fromServerPromise.set(Au.resolved({nonce:e,data:s}),r);let l=Bpo(n);this._capabilities.fromServerPromise.set(Au.resolved({data:l,nonce:e}),r),this._primitiveCache.store(this.definition.id,{...s,nonce:e,capabilities:l})}_populateLiveData(e,t,o){let n=new $e;o.add(Z(()=>n.dispose(!0)));let r=l=>{let c=e.capabilities.tools?e.listTools({},n.token):Promise.resolve([]);return this._setServerTools(t,c,l)},s=l=>{let c=e.capabilities.prompts?e.listPrompts({},n.token):Promise.resolve([]);return this._setServerPrompts(t,c,l)};o.add(e.onDidChangeToolList(()=>{this._logger.info("Tool list changed, refreshing tools..."),r(void 0)})),o.add(e.onDidChangePromptList(()=>{this._logger.info("Prompts list changed, refreshing prompts..."),s(void 0)})),Ui(l=>{this._setServerMetadata(t,{serverInfo:e.serverInfo,instructions:e.serverInstructions,capabilities:e.capabilities},l),s(l),r(l).then(u=>{this._telemetryService.publicLog2("mcp/serverBoot",{supportsLogging:!!e.capabilities.logging,supportsPrompts:!!e.capabilities.prompts,supportsResources:!!e.capabilities.resources,toolCount:u.data.length,serverName:e.serverInfo.name,serverVersion:e.serverInfo.version})})})}};Ov=I([m(6,md),m(7,Pe),m(8,lt),m(9,ol),m(10,Ml),m(11,Te),m(12,ge),m(13,F),m(14,ct),m(15,Ne),m(16,Qe),m(17,h5),m(18,m6e),m(19,rAe),m(20,Vt)],Ov);var mki=class{constructor(i,e){this._server=i;this._definition=e;this.id=ppi(this._server.definition.label+"."+e.name),this.name=e.name,this.title=e.title,this.description=e.description,this.arguments=e.arguments||[],this.icons=h2.fromStored(this._definition._icons)}async resolve(i,e){return(await Ov.callOn(this._server,o=>o.getPrompt({name:this._definition.name,arguments:i},e),e)).messages}async complete(i,e,t,o){return(await Ov.callOn(this._server,r=>r.complete({ref:{type:"ref/prompt",name:this._definition.name},argument:{name:i,value:e},context:{arguments:t}},o),o)).completion.values}};function Bpo(a){let i=0;return a.logging&&(i|=1),a.completions&&(i|=2),a.prompts&&(i|=4,a.prompts.listChanged&&(i|=8)),a.resources&&(i|=16,a.resources.subscribe&&(i|=32),a.resources.listChanged&&(i|=64)),a.tools&&(i|=128,a.tools.listChanged&&(i|=256)),i}var utt=class{constructor(i,e,t,o){this._server=i;this._definition=t;this._elicitationService=o;this.referenceName=t.name.replaceAll(".","_"),this.id=(e+t.name).replaceAll(".","_").slice(0,64),this.icons=h2.fromStored(this._definition._icons),this.visibility=t.visibility??3}get definition(){return this._definition}get uiResourceUri(){return this._definition.uiResourceUri}async call(i,e,t){e&&this._server.runningToolCalls.add(e);try{return await this._callWithProgress(i,void 0,e,t)}finally{e&&this._server.runningToolCalls.delete(e)}}async callWithProgress(i,e,t,o){t&&this._server.runningToolCalls.add(t);try{return await this._callWithProgress(i,e,t,o)}finally{t&&this._server.runningToolCalls.delete(t)}}_callWithProgress(i,e,t,o=ve.None,n=!0){let r=this._definition.serverToolName??this._definition.name,s=e?_t():void 0,l=new P;return Ov.callOn(this._server,async c=>{e&&l.add(c.onDidReceiveProgressNotification(f=>{f.params.progressToken===s&&e.report({message:f.params.message,progress:f.params.total!==void 0&&f.params.progress!==void 0?f.params.progress/f.params.total:void 0})}));let u={progressToken:s};t?.chatSessionResource&&(u["vscode.conversationId"]=P_(t.chatSessionResource)),t?.chatRequestId&&(u["vscode.requestId"]=t.chatRequestId);let p=this._definition.execution?.taskSupport,g=c.capabilities.tasks?.requests?.tools?.call!==void 0&&(p==="required"||p==="optional");try{let f=await c.callTool({name:r,arguments:i,task:g?{}:void 0,_meta:u},o,e?v=>e.report({message:v}):void 0);return await this._server.awaitToolRefresh(),f}catch(f){if(f instanceof gX&&f.code===Tv.URL_ELICITATION_REQUIRED&&n)return await this._handleElicitationErr(f,t,o),this._callWithProgress(i,e,t,o,!1);let v=this._server.connectionState.get();if(n&&v.state===ir.Kind.Error&&v.shouldRetry)return this._callWithProgress(i,e,t,o,!1);throw f}finally{l.dispose()}},o)}async _handleElicitationErr(i,e,t){let o=i.data?.elicitations;if(Array.isArray(o)&&o.length>0)for(let n of o){let r=await this._elicitationService.elicit(this._server,e,n,t);try{if(r.value.action!=="accept")throw i;r.kind===1&&await r.wait}finally{r.dispose()}}}compare(i){return this._definition.name.localeCompare(i.definition.name)}};utt=I([m(3,m6e)],utt);function O9o(a,i,e){a.invokeFunction(t=>{let o=t.get(Ne),n=t.get(ee);o.notify({severity:St.Warning,message:d(11428,null,i),actions:{primary:[{class:void 0,enabled:!0,id:"mcpBadSchema.show",tooltip:"",label:d(11429,null),run:()=>{n.openEditor({resource:void 0,contents:e})}}]}})})}var hki=class{constructor(i,e,t){this.icons=t;this.mcpUri=e.uri,this.title=e.title,this.uri=uw.fromServer(i.definition,e.uri),this.name=e.name,this.description=e.description,this.mimeType=e.mimeType,this.sizeInBytes=e.size}},gki=class{constructor(i,e,t){this._server=i;this._definition=e;this.icons=t;this.name=e.name,this.description=e.description,this.mimeType=e.mimeType,this.title=e.title,this.template=UHt.parse(e.uriTemplate)}resolveURI(i){let e=this.template.resolve(i);return uw.fromServer(this._server.definition,e)}async complete(i,e,t,o){return(await Ov.callOn(this._server,r=>r.complete({ref:{type:"ref/resource",uri:this._definition.uriTemplate},argument:{name:i,value:e},context:{arguments:iSe(t,s=>Array.isArray(s)?s.join("/"):s)}},o),o)).completion.values}};var lAe=class extends C{constructor(e,t,o){super();this._uiData=e;this._mcpService=t;let n=ui(o.onDidColorThemeChange,()=>{let r=o.getColorTheme().type;return r==="dark"||r==="hcDark"?"dark":"light"});this.hostContext=Ce(r=>({theme:n.read(r),styles:{variables:{"--color-background-primary":"var(--vscode-editor-background)","--color-background-secondary":"var(--vscode-sideBar-background)","--color-background-tertiary":"var(--vscode-activityBar-background)","--color-background-inverse":"var(--vscode-editor-foreground)","--color-background-ghost":"transparent","--color-background-info":"var(--vscode-inputValidation-infoBackground)","--color-background-danger":"var(--vscode-inputValidation-errorBackground)","--color-background-success":"var(--vscode-diffEditor-insertedTextBackground)","--color-background-warning":"var(--vscode-inputValidation-warningBackground)","--color-background-disabled":"var(--vscode-editor-inactiveSelectionBackground)","--color-text-primary":"var(--vscode-foreground)","--color-text-secondary":"var(--vscode-descriptionForeground)","--color-text-tertiary":"var(--vscode-disabledForeground)","--color-text-inverse":"var(--vscode-editor-background)","--color-text-info":"var(--vscode-textLink-foreground)","--color-text-danger":"var(--vscode-errorForeground)","--color-text-success":"var(--vscode-testing-iconPassed)","--color-text-warning":"var(--vscode-editorWarning-foreground)","--color-text-disabled":"var(--vscode-disabledForeground)","--color-text-ghost":"var(--vscode-descriptionForeground)","--color-border-primary":"var(--vscode-widget-border)","--color-border-secondary":"var(--vscode-editorWidget-border)","--color-border-tertiary":"var(--vscode-panel-border)","--color-border-inverse":"var(--vscode-foreground)","--color-border-ghost":"transparent","--color-border-info":"var(--vscode-inputValidation-infoBorder)","--color-border-danger":"var(--vscode-inputValidation-errorBorder)","--color-border-success":"var(--vscode-testing-iconPassed)","--color-border-warning":"var(--vscode-inputValidation-warningBorder)","--color-border-disabled":"var(--vscode-disabledForeground)","--color-ring-primary":"var(--vscode-focusBorder)","--color-ring-secondary":"var(--vscode-focusBorder)","--color-ring-inverse":"var(--vscode-focusBorder)","--color-ring-info":"var(--vscode-inputValidation-infoBorder)","--color-ring-danger":"var(--vscode-inputValidation-errorBorder)","--color-ring-success":"var(--vscode-testing-iconPassed)","--color-ring-warning":"var(--vscode-inputValidation-warningBorder)","--font-sans":"var(--vscode-font-family)","--font-mono":"var(--vscode-editor-font-family)","--font-weight-normal":"normal","--font-weight-medium":"500","--font-weight-semibold":"600","--font-weight-bold":"bold","--font-text-xs-size":"10px","--font-text-sm-size":"11px","--font-text-md-size":"13px","--font-text-lg-size":"14px","--font-heading-xs-size":"16px","--font-heading-sm-size":"18px","--font-heading-md-size":"20px","--font-heading-lg-size":"24px","--font-heading-xl-size":"32px","--font-heading-2xl-size":"40px","--font-heading-3xl-size":"48px","--border-radius-xs":"2px","--border-radius-sm":"3px","--border-radius-md":"4px","--border-radius-lg":"6px","--border-radius-xl":"8px","--border-radius-full":"9999px","--border-width-regular":"1px","--font-text-xs-line-height":"1.5","--font-text-sm-line-height":"1.5","--font-text-md-line-height":"1.5","--font-text-lg-line-height":"1.5","--font-heading-xs-line-height":"1.25","--font-heading-sm-line-height":"1.25","--font-heading-md-line-height":"1.25","--font-heading-lg-line-height":"1.25","--font-heading-xl-line-height":"1.25","--font-heading-2xl-line-height":"1.25","--font-heading-3xl-line-height":"1.25","--shadow-hairline":"0 0 0 1px var(--vscode-widget-shadow)","--shadow-sm":"0 1px 2px 0 var(--vscode-widget-shadow)","--shadow-md":"0 4px 6px -1px var(--vscode-widget-shadow)","--shadow-lg":"0 10px 15px -3px var(--vscode-widget-shadow)"}},displayMode:"inline",availableDisplayModes:["inline"],locale:abe,platform:Gt?"web":sbe?"mobile":"desktop",deviceCapabilities:{touch:ws.isTouchDevice(),hover:ws.isHoverDevice()}}))}get uiData(){return this._uiData}async log(e){let t=await this._getServer(ve.None);t&&LHt(t.logger,e,"[App UI]")}async _getServer(e){return dpo(this._mcpService,t=>t.definition.id===this._uiData.serverDefinitionId&&t.collection.id===this._uiData.collectionId,e)}async loadResource(e){let t=await this._getServer(e);if(!t)throw new Error("MCP server not found for UI resource");let o=await Ov.callOn(t,c=>c.readResource({uri:this._uiData.resourceUri},e),e);if(!o.contents||o.contents.length===0)throw new Error("UI resource not found on server");let n=o.contents[0],r,s=n.mimeType||"text/html";if(Wo(n,{text:!0}))r=n.text;else if(Wo(n,{blob:!0}))r=Sl(n.blob).toString();else throw new Error("UI resource has no content");return{...n._meta?.ui,html:r,mimeType:s}}async callTool(e,t,o){let n=await this._getServer(o);if(!n)throw new Error("MCP server not found for tool call");await n0(n,void 0,o);let r=n.tools.get().find(l=>l.definition.name===e);if(!r||!(r.visibility&2))throw new Error(`Tool not found on server: ${e}`);let s=await r.call(t,void 0,o);return{content:s.content,isError:s.isError,_meta:s._meta,structuredContent:s.structuredContent}}async readResource(e,t){let o=await this._getServer(t);if(!o)throw new Error("MCP server not found");return await Ov.callOn(o,n=>n.readResource({uri:e},t),t)}};lAe=I([m(1,es),m(2,De)],lAe);var zHt;(S=>(S.LATEST_PROTOCOL_VERSION="2026-01-26",S.OPEN_LINK_METHOD="ui/open-link",S.MESSAGE_METHOD="ui/message",S.SANDBOX_PROXY_READY_METHOD="ui/notifications/sandbox-proxy-ready",S.SANDBOX_RESOURCE_READY_METHOD="ui/notifications/sandbox-resource-ready",S.SIZE_CHANGED_METHOD="ui/notifications/size-changed",S.TOOL_INPUT_METHOD="ui/notifications/tool-input",S.TOOL_INPUT_PARTIAL_METHOD="ui/notifications/tool-input-partial",S.TOOL_RESULT_METHOD="ui/notifications/tool-result",S.TOOL_CANCELLED_METHOD="ui/notifications/tool-cancelled",S.HOST_CONTEXT_CHANGED_METHOD="ui/notifications/host-context-changed",S.RESOURCE_TEARDOWN_METHOD="ui/resource-teardown",S.INITIALIZE_METHOD="ui/initialize",S.INITIALIZED_METHOD="ui/notifications/initialized",S.REQUEST_DISPLAY_MODE_METHOD="ui/request-display-mode",S.UPDATE_MODEL_CONTEXT_METHOD="ui/update-model-context",S.DOWNLOAD_FILE_METHOD="ui/download-file"))(zHt||={});var F9o="chatMcpApp.origins",R3=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.toolInvocation=e;this.renderData=t;this._container=o;this._instantiationService=s;this._chatWidgetService=l;this._webviewService=c;this._chatResponseResourceFsProvider=p;this._logService=h;this._productService=g;this._openerService=f;this._disposeCts=this._register(new $e);this._announcedCapabilities=!1;this._latestCsp=void 0;this._loadState=Le(this,{status:"loading"});this.loadState=this._loadState;this._onDidChangeHeight=this._register(new E);this.onDidChangeHeight=this._onDidChangeHeight.event;this._downloadParts=Le(this,[]);this.downloadParts=this._downloadParts;this._originStore=new $j(F9o,u),this._webviewOrigin=this._originStore.getOrigin("mcpApp",t.serverDefinitionId),this._mcpToolCallUI=this._register(this._instantiationService.createInstance(lAe,t)),this._height=R3.heightCache.get(this.toolInvocation)??300,this._webview=this._register(this._webviewService.createWebviewElement({origin:this._webviewOrigin,title:d(7268,null),options:{purpose:"chatOutputItem",enableFindWidget:!1,disableServiceWorker:!0,retainContextWhenHidden:!0},contentOptions:{allowMultipleAPIAcquire:!0,allowScripts:!0,allowForms:!0},extension:void 0}));let v=Me(this._container);this._webview.mountTo(this._container,v),this.hostContext=this._mcpToolCallUI.hostContext.map((b,S)=>({...b,containerDimensions:{width:r.read(S),maxHeight:n.read(S)},toolCall:{toolCallId:this.toolInvocation.toolCallId,toolName:this.toolInvocation.toolId}})),this._register(he(b=>{let S=this.hostContext.read(b);this._announcedCapabilities&&this._sendNotification({method:"ui/notifications/host-context-changed",params:S})})),this._register(this._webview.onMessage(async({message:b})=>{await this._handleWebviewMessage(b)})),this._loadContent()}static{this.heightCache=new WeakMap}get height(){return this._height}remount(){this._webview.reinitializeAfterDismount(),this._announcedCapabilities=!1}retry(){this._loadState.set({status:"loading"},void 0),this._loadContent()}async _loadContent(){let e=this._disposeCts.token;try{let t=await this._mcpToolCallUI.loadResource(e);if(e.isCancellationRequested)return;let o=this._injectPreamble(t);this._announcedCapabilities=!1,this._latestCsp=t.csp,this._webview.setHtml(o),this._loadState.set({status:"loaded"},void 0)}catch(t){this._logService.error("[MCP App] Error loading app:",t),this._loadState.set({status:"error",error:t},void 0)}}_injectPreamble({html:e,csp:t}){let o=l=>(l?.join(" ")||"").replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',"""),r=`<meta http-equiv="Content-Security-Policy" content="${`
default-src 'none';
script-src 'self' 'unsafe-inline' ${o(t?.resourceDomains)};
style-src 'self' 'unsafe-inline' ${o(t?.resourceDomains)};
connect-src 'self' ${o(t?.connectDomains)};
img-src 'self' data: ${o(t?.resourceDomains)};
font-src 'self' ${o(t?.resourceDomains)};
media-src 'self' data: ${o(t?.resourceDomains)};
frame-src ${o(t?.frameDomains)||"'none'"};
object-src 'none';
base-uri ${o(t?.baseUriDomains)||"'self'"};
`}">`;return this._prependToHead(e,r+`
<script>(() => {
const api = acquireVsCodeApi();
const setMessageSource = (obj, src) => new Proxy(obj, {
get: (target, prop) => {
if (prop === 'source') {
return src;
}
return target[prop];
}
});
const wrappedFns = new WeakMap();
let patchedPostMessage = (message, transfer) => api.postMessage(message, transfer);
const wrap = target => new Proxy(target, {
set: (obj, prop, value) => {
if (prop === 'postMessage') {
patchedPostMessage = (message, transfer) => value.call(target, message, transfer);
} else {
obj[prop] = value;
}
return true;
},
get: (obj, prop) => {
if (prop === 'postMessage') {
return patchedPostMessage;
}
return obj[prop];
},
});
const originalAddEventListener = window.addEventListener.bind(window);
window.addEventListener = (type, listener, options) => {
if (type === 'message') {
const originalListener = listener;
const wrappedListener = (event) => {
if (event.origin === document.location.origin && event.source !== window) { event = setMessageSource(event, window.parent); }
originalListener(event);
};
wrappedFns.set(originalListener, wrappedListener);
listener = wrappedListener;
}
return originalAddEventListener(type, listener, options);
};
const originalRemoveEventListener = window.removeEventListener.bind(window);
window.removeEventListener = (type, listener, options) => {
const wrappedListener = wrappedFns.get(listener) || listener;
return originalRemoveEventListener(type, wrappedListener, options);
};
window.parent = wrap(window.parent);
// Scroll boundary detection: bubble wheel events to parent when at scroll boundaries
const shouldBubbleScroll = (event) => {
// First check element-level scrolling (for elements with overflow: auto/scroll)
for (let node = event.target; node; node = node.parentNode) {
if (!(node instanceof Element)) {
continue;
}
// Skip HTML and BODY - we check document-level scroll separately
if (node === document.documentElement || node === document.body) {
continue;
}
// Check if the element can actually scroll
const overflow = window.getComputedStyle(node).overflowY;
if (overflow === 'hidden' || overflow === 'visible') {
continue;
}
// Scroll up: if there's content above (scrollTop > 0), don't bubble
if (event.deltaY < 0 && node.scrollTop > 0) {
return false;
}
// Scroll down: if there's content below, don't bubble
if (event.deltaY > 0 && node.scrollTop + node.clientHeight < node.scrollHeight) {
// Account for rounding: scrollTop isn't rounded but scrollHeight/clientHeight are
if (node.scrollHeight - node.scrollTop - node.clientHeight < 2) {
continue;
}
return false;
}
}
// Check document-level scrolling (works even with overflow: visible on html/body)
const docEl = document.documentElement;
const scrollTop = window.scrollY || docEl.scrollTop || document.body.scrollTop || 0;
const scrollHeight = Math.max(docEl.scrollHeight, document.body.scrollHeight);
const clientHeight = docEl.clientHeight;
const scrollableDistance = scrollHeight - clientHeight;
if (scrollableDistance > 2) {
// Document is scrollable
if (event.deltaY < 0 && scrollTop > 0) {
return false;
}
if (event.deltaY > 0 && scrollTop < scrollableDistance - 2) {
return false;
}
}
return true;
};
window.addEventListener('wheel', (event) => {
if (event.defaultPrevented || !shouldBubbleScroll(event)) {
return;
}
api.postMessage({
method: 'ui/notifications/sandbox-wheel',
params: {
deltaMode: event.deltaMode,
deltaX: event.deltaX,
deltaY: event.deltaY,
deltaZ: event.deltaZ,
}
});
}, { passive: true });
})();</script>
`)}_prependToHead(e,t){let o=e.match(/<head[^>]*>/i);if(o){let r=o.index+o[0].length;return e.slice(0,r)+`
`+t+e.slice(r)}let n=e.match(/<html[^>]*>/i);if(n){let r=n.index+n[0].length;return e.slice(0,r)+`
<head>`+t+"</head>"+e.slice(r)}return`<!DOCTYPE html><html><head>${t}</head><body>${e}</body></html>`}async _handleWebviewMessage(e){let t=e,o=this._disposeCts.token;try{let n={};switch(t.method){case"ui/initialize":n=await this._handleInitialize(t.params);break;case"tools/call":n=await this._handleToolsCall(t.params,o);break;case"resources/read":n=await this._handleResourcesRead(t.params,o);break;case"ping":break;case"ui/notifications/size-changed":this._handleSizeChanged(t.params);break;case"ui/open-link":n=await this._handleOpenLink(t.params);break;case"ui/download-file":n=await this._handleDownloadFile(t.params);break;case"ui/request-display-mode":n={mode:"inline"};break;case"ui/notifications/initialized":break;case"ui/message":n=await this._handleUiMessage(t.params);break;case"ui/update-model-context":n=await this._handleUpdateModelContext(t.params);break;case"notifications/message":await this._mcpToolCallUI.log(t.params);break;case"ui/notifications/sandbox-wheel":this._handleSandboxWheel(t.params);break;default:{let r=t;r.id!==void 0&&await this._sendError(r.id,-32601,`Method not found: ${r.method}`);return}}Wo(t,{id:!0})&&await this._sendResponse(t.id,n)}catch(n){if(this._logService.error(`[MCP App] Error handling ${t.method}:`,n),Wo(t,{id:!0})){let r=n instanceof Error?n.message:String(n);await this._sendError(t.id,-32e3,r)}}}async _handleInitialize(e){this._announcedCapabilities=!0;let t;try{t=JSON.parse(this.renderData.input)}catch{t=this.renderData.input}let o=this._register(nn(async()=>{if(this._store.delete(o),await this._sendNotification({method:"ui/notifications/tool-input",params:{arguments:t}}),this.toolInvocation.kind==="toolInvocationSerialized")this._sendToolResult(this.toolInvocation.resultDetails);else if(this.toolInvocation.kind==="toolInvocation"){let n=this.toolInvocation;this._register(ux(r=>{let s=n.state.read(r);s.type===lo.StateKind.Completed&&(this._sendToolResult(s.resultDetails),r.dispose())}))}}));return{protocolVersion:zHt.LATEST_PROTOCOL_VERSION,hostInfo:{name:this._productService.nameLong,version:this._productService.version},hostCapabilities:{openLinks:{},serverTools:{listChanged:!0},serverResources:{listChanged:!0},logging:{},sandbox:{csp:this._latestCsp,permissions:{clipboardWrite:{}}},updateModelContext:{audio:{},image:{},resourceLink:{},resource:{},structuredContent:{}},downloadFile:{}},hostContext:this.hostContext.get()}}_sendToolResult(e){mV(e)&&e.mcpOutput&&this._sendNotification({method:"ui/notifications/tool-result",params:e.mcpOutput})}async _handleUiMessage(e){let t=this._chatWidgetService.getWidgetBySessionResource(this.renderData.sessionResource);return t?Jl(t.getInput())?(t.setInput(e.content.filter(o=>o.type==="text").map(o=>o.text).join(`
`)),t.attachmentModel.clearAndSetContext(...e.content.map((o,n)=>{let r=`mcpui-${n}-${Date.now()}`;if(o.type==="image")return{kind:"image",value:Sl(o.data).buffer,id:r,name:"Image"};if(o.type==="resource_link"){let s=uw.fromServer({id:this.renderData.serverDefinitionId,label:""},o.uri);return{kind:"file",value:s,id:r,name:Ye(s)}}else return}).filter(mo)),t.focusInput(),{isError:!1}):{isError:!0}:{isError:!0}}async _handleUpdateModelContext(e){let t=this._chatWidgetService.getWidgetBySessionResource(this.renderData.sessionResource);if(!t)return{};let o=`mcpui-context-${Ir(this.renderData.serverDefinitionId)}-`,n=t.attachmentModel.getAttachmentIDs(),r=Array.from(n).filter(c=>c.startsWith(o)),s=[],l=0;if(e.content)for(let c of e.content){let u=`${o}${l++}`;if(c.type==="image")s.push({kind:"image",value:Sl(c.data).buffer,id:u,name:"Image",mimeType:c.mimeType});else if(c.type==="resource_link"){let p=uw.fromServer({id:this.renderData.serverDefinitionId,label:""},c.uri);s.push({kind:"file",value:p,id:u,name:Ye(p)})}else if(c.type==="text"){let p=c.text.replaceAll(/\s+/g," ").trim(),h=20;s.push({kind:"generic",value:c.text,id:u,tooltip:new xe().appendCodeblock("plaintext",c.text),name:p.length>h?p.slice(0,h)+"\u2026":p})}}if(e.structuredContent&&Object.keys(e.structuredContent).length>0){let c=`${o}structured`,u=JSON.stringify(e.structuredContent,null,2);s.push({kind:"generic",value:u,tooltip:new xe().appendCodeblock("json",u),id:c,name:"UI Data"})}return t.attachmentModel.updateContext(r,s),{}}_handleSizeChanged(e){e.height!==void 0&&e.height!==this._height&&(this._height=e.height,R3.heightCache.set(this.toolInvocation,e.height),this._onDidChangeHeight.fire())}_handleSandboxWheel(e){let t=!1,o={wheelDeltaX:e.deltaX,wheelDeltaY:-e.deltaY,wheelDelta:Math.abs(e.deltaY),deltaX:e.deltaX,deltaY:-e.deltaY,deltaZ:e.deltaZ,deltaMode:e.deltaMode,preventDefault:()=>{t=!0},stopPropagation:()=>{},get defaultPrevented(){return t}};this._chatWidgetService.getWidgetBySessionResource(this.renderData.sessionResource)?.delegateScrollFromMouseWheelEvent(o)}async _handleDownloadFile(e){let t=[],o=!1;for(let n of e.contents)try{if(n.type==="resource"){let r=n.resource,s=A.parse(r.uri),l=Wo(r,{text:!0})?new TextEncoder().encode(r.text):{base64:r.blob},c=this._chatResponseResourceFsProvider.associate(this.renderData.sessionResource,l,Ye(s));t.push({kind:"data",mimeType:r.mimeType,uri:c})}else if(n.type==="resource_link"){let r=uw.fromServer({id:this.renderData.serverDefinitionId,label:""},n.uri);t.push({kind:"data",mimeType:n.mimeType,uri:r})}}catch(r){o=!0,this._logService.warn("[MCP App] Failed to process ui/download-file content",r)}if(t.length>0){let n=this._downloadParts.get();this._downloadParts.set([...n,...t],void 0)}return o?{isError:!0}:{}}async _handleOpenLink(e){return{isError:!await this._openerService.open(e.url)}}async _handleToolsCall(e,t){if(!e?.name)throw new Error("Missing tool name in tools/call request");return this._mcpToolCallUI.callTool(e.name,e.arguments||{},t)}async _handleResourcesRead(e,t){if(!e?.uri)throw new Error("Missing uri in resources/read request");return this._mcpToolCallUI.readResource(e.uri,t)}async _sendResponse(e,t){await this._webview.postMessage({jsonrpc:"2.0",id:e,result:t})}async _sendError(e,t,o){await this._webview.postMessage({jsonrpc:"2.0",id:e,error:{code:t,message:o}})}async _sendNotification(e){await this._webview.postMessage({jsonrpc:"2.0",...e})}dispose(){this._disposeCts.dispose(!0),super.dispose()}};R3=I([m(5,F),m(6,At),m(7,wm),m(8,le),m(9,dtt),m(10,ne),m(11,nt),m(12,Qe)],R3);var Hpo=.75,cAe=class extends Nv{constructor(e,t,o,n,r,s){super(e);this._renderData=n;this._instantiationService=r;this._markdownRendererService=s;this.codeblocks=[];this._progressPart=this._register(new me);this._downloadWidget=this._register(new me);this.domNode=_("div.mcp-app-part"),this._webviewContainer=_("div.mcp-app-webview"),this._webviewContainer.style.maxHeight=`${Hpo*100}vh`,this._webviewContainer.style.minHeight="100px",this._webviewContainer.style.height="300px",this.domNode.appendChild(this._webviewContainer),this._downloadContainer=_("div.mcp-app-downloads"),this.domNode.appendChild(this._downloadContainer);let l=Me(this.domNode),c=()=>Hpo*l.innerHeight,u=Le("mcpAppMaxHeight",c());j(l,"resize",()=>u.set(c(),void 0)),this._model=this._register(this._instantiationService.createInstance(R3,e,this._renderData,this._webviewContainer,u,o.currentWidth)),this._updateContainerHeight(),this._register(he(p=>{let h=this._model.loadState.read(p);this._handleLoadStateChange(this._webviewContainer,h)})),this._register(this._model.onDidChangeHeight(()=>{this._updateContainerHeight()})),this._register(he(p=>{let h=this._model.downloadParts.read(p);if(h.length===0){this._downloadWidget.clear(),Rt(this._downloadContainer);return}Rt(this._downloadContainer);let g=this._instantiationService.createInstance(Xee,h);this._downloadWidget.value=g,this._downloadContainer.appendChild(g.domNode)})),this._register(t(()=>{this._model.remount()})),this._register(o.onDidChangeVisibility(p=>{p&&this._model.remount()}))}_handleLoadStateChange(e,t){switch(this._progressPart.value&&this._progressPart.value.domNode.remove(),this._progressPart.clear(),this._errorNode&&(this._errorNode.remove(),this._errorNode=void 0),t.status){case"loading":{e.style.display="none";let o=_("span");o.textContent=d(7269,null);let n=this._instantiationService.createInstance(vA,o,q.modify(M.loading,"spin"),void 0);this._progressPart.value=n,this.domNode.appendChild(n.domNode);break}case"loaded":{e.style.display="";break}case"error":{e.style.display="none",this._showError(this.domNode,t.error);break}}}_updateContainerHeight(){this._webviewContainer.style.height=`${this._model.height}px`}_showError(e,t){let o=_(".mcp-app-error"),n=new xe;n.appendText(d(7270,null,t.message||String(t)));let r=this._register(new Dme(2,n,this._markdownRendererService));o.appendChild(r.domNode);let s=R(o,_(".chat-buttons-container")),l=this._register(new Mi(s,Ko));l.label=d(7271,null),this._register(l.onDidClick(()=>{this._model.retry()})),e.appendChild(o),this._errorNode=o}};cAe=I([m(4,F),m(5,Qn)],cAe);var zme=class extends Nv{constructor(e,t,o,n,r,s){super(e);this.codeblocks=[];let l=this._register(s.createInstance(T3,n.map(c=>({kind:"reference",reference:c})),o,t,r,$ee(e)));l.icon=M.check,this.domNode=l.domNode}};zme=I([m(5,F)],zme);var M3=class extends Nv{static{this._expandedByDefault=new WeakMap}get codeblocks(){return this.collapsibleListPart.codeblocks}constructor(i,e,t,o,n,r,s,l,c,u,p){super(i);let h=t,g=(w,k)=>({kind:"code",data:w,languageId:"plaintext",codeBlockIndex:h++,ownerMarkdownPartId:this.codeblocksPartId,options:{hideToolbar:!0,reserveWidth:19,maxHeightInLines:13,verticalPadding:5,editorOptions:{wordWrap:"on"}}}),f=g(r.input,"Input"),v=r.output?[g(r.output,"Output")]:void 0,b=this.collapsibleListPart=this._register(l.createInstance(Jee,o,n,this.getAutoApprovalMessageContent(),e,f,v?{parts:v}:void 0,s,s&&p.getValue("chat.tools.autoExpandFailures")||(M3._expandedByDefault.get(i)??!1)));this._register(Z(()=>M3._expandedByDefault.set(i,b.expanded)));let S=i.kind==="toolInvocation"?i.state.map((w,k)=>w.type===lo.StateKind.Executing?w.progress.read(k):void 0):void 0,y=new co(()=>this._register(new fb(b.domNode)));S&&this._register(he(w=>{let k=S?.read(w);k?.message&&(b.title=k.message),k?.progress&&!lo.isComplete(i,w)&&y.value.setWorked(k.progress*100)})),this.domNode=b.domNode}getAutoApprovalMessageContent(){return $ee(this.toolInvocation)}};M3=I([m(7,F),m(8,Ct),m(9,kt),m(10,B)],M3);var Kme=class extends Nv{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N){super(e);this.context=o;this.renderer=n;this.editorPool=r;this.currentWidthDelegate=s;this.codeBlockModelCollection=l;this.codeBlockStartIndex=c;this.instantiationService=u;this.dialogService=p;this.keybindingService=h;this.modelService=g;this.languageService=f;this.configurationService=v;this.contextKeyService=b;this.chatWidgetService=S;this.preferencesService=y;this.storageService=w;this.terminalChatService=k;this.codeblocks=[];let O=e.state.get();if(O.type!==lo.StateKind.WaitingForConfirmation||!O.confirmationMessages?.title)throw new Error("Confirmation messages are missing");t=fR(t);let{title:V,message:U,disclaimer:G,terminalCustomActions:$}=O.confirmationMessages,te=t.presentationOverrides?.commandLine??t.confirmation?.commandLine??(t.commandLine.toolEdited??t.commandLine.original).trimStart(),pe=t.confirmation?.cdPrefix??"",de=!!t.presentationOverrides,se=this.configurationService.getValue(ty.EnableAutoApprove)===!0,Se=this.storageService.getBoolean("chat.tools.terminal.autoApprove.warningAccepted",-1,!1),ke;if(se){if(ke=[],!Se&&(ke.push({label:d(7273,null),data:{type:"enable"}}),ke.push(new li),$))for(let ti of $)ti instanceof li||(ti.disabled=!0);$&&ke.push(...$),ke.length===0&&(ke=void 0)}let Ee={hideToolbar:!0,reserveWidth:19,verticalPadding:5,editorOptions:{wordWrap:"on",readOnly:de,tabFocusMode:!0,ariaLabel:typeof V=="string"?V:V.value}},He=this.languageService.getLanguageIdByLanguageName(t.presentationOverrides?.language??t.language??"sh")??"shellscript",Ve=this._register(this.modelService.createModel(te,this.languageService.createById(He),this._getUniqueCodeBlockUri(),!0));jut(T.createModelReference(Ve.uri),this._store);let Fe=this._register(this.editorPool.get());Fe.object.render({codeBlockIndex:this.codeBlockStartIndex,codeBlockPartIndex:0,element:this.context.element,languageId:He,renderOptions:Ee,textModel:Promise.resolve(Ve),chatSessionResource:this.context.element.sessionResource},this.currentWidthDelegate()),this.codeblocks.push({codeBlockIndex:this.codeBlockStartIndex,codemapperUri:void 0,elementId:this.context.element.id,focus:()=>Fe.object.focus(),ownerMarkdownPartId:this.codeblocksPartId,uri:Ve.uri,uriPromise:Promise.resolve(Ve.uri),chatSessionResource:this.context.element.sessionResource}),this._register(Ve.onDidChangeContent(ti=>{let bo=Ve.getValue();bo!==te?t.commandLine.userEdited=pe+bo:t.commandLine.userEdited=void 0}));let Qt=bt(".chat-confirmation-message-terminal",[bt(".chat-confirmation-message-terminal-editor@editor"),bt(".chat-confirmation-message-terminal-disclaimer@disclaimer")]);R(Qt.editor,Fe.object.element),this._register(N.setupDelayedHover(Qt.editor,{content:U||"",style:1,position:{hoverPosition:0}}));let Ze=this._register(this.instantiationService.createInstance(Gee,this.context,{title:V,icon:M.terminal,message:Qt.root,buttons:this._createButtons(ke)}));G&&this._appendMarkdownPart(Qt.disclaimer,G,Ee);let Ti=ie.Editing.hasToolConfirmation.bindTo(this.contextKeyService);Ti.set(!0),this._register(Z(()=>Ti.reset())),this._register(Ze.onDidClick(async ti=>{let bo=!0,Ro=ti.data,_o=0;if(typeof Ro=="boolean")Ro&&(_o=4,t.autoApproveInfo&&(t.autoApproveInfo=void 0));else if(typeof Ro!="boolean")switch(Ro.type){case"enable":{if(await this._showAutoApproveWarning()){if(this.storageService.store("chat.tools.terminal.autoApprove.warningAccepted",!0,-1,0),t.autoApproveInfo)_o=4;else if($){for(let ln of $)ln instanceof li||(ln.disabled=!1);Ze.updateButtons(this._createButtons($)),bo=!1}}else bo=!1;break}case"skip":{_o=5;break}case"newRule":{let Id=function(uu,Jm){return uu.map(Dh=>{if(Jm==="session")return`\`${Dh.key}\``;let Rp=Jm==="workspace"?5:2,Uv=ic(lw.OpenTerminalSettingsLink,Rp);return`[\`${Dh.key}\`](${Uv.toString()} "${d(7283,null)}")`}).join(", ")},sr=Yl(Ro.rule),ln=sr.filter(uu=>uu.scope==="session"),en=sr.filter(uu=>uu.scope==="workspace"),Ws=sr.filter(uu=>uu.scope==="user"),ba=this.context.element.sessionResource;for(let uu of ln)this.terminalChatService.addSessionAutoApproveRule(ba,uu.key,uu.value);if(en.length>0){let Jm=this.configurationService.inspect(ty.AutoApprove).workspaceValue??{};if(yi(Jm)){let Dh={...Jm};for(let Rp of en)Dh[Rp.key]=Rp.value;await this.configurationService.updateValue(ty.AutoApprove,Dh,5)}else throw this.preferencesService.openSettings({jsonEditor:!0,target:5,revealSetting:{key:ty.AutoApprove}}),new Zs("Cannot add new rule, existing workspace setting is unexpected format")}if(Ws.length>0){let Jm=this.configurationService.inspect(ty.AutoApprove).userValue??{};if(yi(Jm)){let Dh={...Jm};for(let Rp of Ws)Dh[Rp.key]=Rp.value;await this.configurationService.updateValue(ty.AutoApprove,Dh,2)}else throw this.preferencesService.openSettings({jsonEditor:!0,target:2,revealSetting:{key:ty.AutoApprove}}),new Zs("Cannot add new rule, existing setting is unexpected format")}let Dg={isTrusted:{enabledCommands:[lw.OpenTerminalSettingsLink]}},yd=[];ln.length>0&&yd.push(ln.length===1?d(7277,null,Id(ln,"session")):d(7278,null,Id(ln,"session"))),en.length>0&&yd.push(en.length===1?d(7281,null,Id(en,"workspace")):d(7282,null,Id(en,"workspace"))),Ws.length>0&&yd.push(Ws.length===1?d(7279,null,Id(Ws,"user")):d(7280,null,Id(Ws,"user"))),yd.length>0&&(t.autoApproveInfo=new xe(yd.join(", "),Dg)),_o=4;break}case"configure":{this.preferencesService.openSettings({target:2,query:`@id:${ty.AutoApprove}`}),bo=!1;break}case"sessionApproval":{let sr=this.context.element.sessionResource;this.terminalChatService.setChatSessionAutoApproval(sr,!0);let ln=ic(lw.DisableSessionAutoApproval,sr),en={isTrusted:{enabledCommands:[lw.DisableSessionAutoApproval]}};t.autoApproveInfo=new xe(`${d(7284,null)} ([${d(7285,null)}](${ln.toString()}))`,en),_o=4;break}}bo&&(lo.confirmWith(e,{type:_o}),this.chatWidgetService.getWidgetBySessionResource(this.context.element.sessionResource)?.focusInput())})),this.domNode=Ze.domNode}_createButtons(e){let t=(o,n,r=o)=>{let s=this.keybindingService.appendKeybinding(r,n);return{label:o,tooltip:s}};return[{...t(d(7287,null),D3),data:!0,moreActions:e},{...t(d(7288,null),ctt,d(7286,null)),data:{type:"skip"},isSecondary:!0}]}async _showAutoApproveWarning(){return(await this.dialogService.prompt({type:gt.Info,message:d(7276,null),buttons:[{label:d(7272,null),run:()=>!0}],cancelButton:!0,custom:{icon:M.shield,markdownDetails:[{markdown:new xe(d(7274,null))},{markdown:new xe(`[${d(7275,null)}](https://code.visualstudio.com/docs/copilot/security#_security-considerations)`)}]}})).result===!0}_getUniqueCodeBlockUri(){return A.from({scheme:Y.vscodeChatCodeBlock,path:_t()})}_appendMarkdownPart(e,t,o){let n=this._register(this.instantiationService.createInstance(lT,{kind:"markdownContent",content:typeof t=="string"?new xe().appendMarkdown(t):t},this.context,this.editorPool,!1,this.codeBlockStartIndex,this.renderer,void 0,this.currentWidthDelegate(),this.codeBlockModelCollection,{codeBlockRenderOptions:o}));R(e,n.domNode)}};Kme=I([m(8,F),m(9,ct),m(10,_e),m(11,Ct),m(12,kt),m(13,B),m(14,X),m(15,At),m(16,Po),m(17,le),m(18,kv),m(19,Nt),m(20,tt)],Kme);var KHt=class extends C{constructor(e){super();this._options=e;this._commandFinished=!1;this._receivedData=!1;this._onDidRequestExpand=this._register(new E);this.onDidRequestExpand=this._onDidRequestExpand.event;this._setupListeners()}_setupListeners(){let e=this._register(new P),t=this._options.commandDetection;e.add(t.onCommandExecuted(()=>{this._options.shouldAutoExpand()&&!this._noDataTimeout&&(this._noDataTimeout=nn(()=>{this._noDataTimeout=void 0;let o=this._options.shouldAutoExpand(),n=this._options.hasRealOutput();o&&n&&(this._dataEventTimeout?.dispose(),this._dataEventTimeout=void 0,this._onDidRequestExpand.fire())},500,e))})),e.add(this._options.onWillData(()=>{this._receivedData||(this._receivedData=!0,this._options.shouldAutoExpand()&&!this._dataEventTimeout&&(this._dataEventTimeout=nn(()=>{this._dataEventTimeout=void 0;let o=this._options.shouldAutoExpand(),n=this._options.hasRealOutput();!this._commandFinished&&o&&n&&(this._noDataTimeout?.dispose(),this._noDataTimeout=void 0,this._onDidRequestExpand.fire())},50,e)))})),e.add(t.onCommandFinished(()=>{this._commandFinished=!0,this._clearAutoExpandTimeouts()}))}_clearAutoExpandTimeouts(){this._dataEventTimeout?.dispose(),this._dataEventTimeout=void 0,this._noDataTimeout?.dispose(),this._noDataTimeout=void 0}};var vki=Re("terminal-view-icon",M.terminal,d(14136,null)),Upo=Re("terminal-rename",M.edit,d(14127,null)),GHt=Re("terminal-kill",M.trash,d(14125,null)),zpo=Re("terminal-new",M.add,d(14126,null)),Kpo=Re("terminal-configure-profile",M.gear,d(14124,null)),Gpo=Re("terminal-decoration-mark",M.circleSmallFilled,d(14134,null)),bki=Re("terminal-decoration-incomplete",M.circle,d(14133,null)),$po=Re("terminal-decoration-error",M.errorSmall,d(14132,null)),qpo=Re("terminal-decoration-success",M.circleFilled,d(14135,null)),jpo=Re("terminal-command-history-remove",M.close,d(14131,null)),Qpo=Re("terminal-command-history-output",M.output,d(14130,null)),Ypo=Re("terminal-command-history-fuzzy-search",M.searchFuzzy,d(14128,null)),Xpo=Re("terminal-command-history-open-file",M.symbolReference,d(14129,null));function Iki(a,i,e){let t=e?`${d(14262,null)}
---
`:"";if(a)if(a.markProperties||i)if(a.markProperties?.hoverMessage||i)t=a.markProperties?.hoverMessage||i||"";else return"";else if(Xo(a.duration)){let o=z6(a.duration);a.exitCode?a.exitCode===-1?t+=d(14256,null,Bs(a.timestamp,!0),o):t+=d(14258,null,Bs(a.timestamp,!0),o,a.exitCode):t+=d(14261,null,Bs(a.timestamp,!0),o)}else a.exitCode?a.exitCode===-1?t+=d(14255,null,Bs(a.timestamp,!0)):t+=d(14257,null,Bs(a.timestamp,!0),a.exitCode):t+=d(14259,null);else if(i)t=i;else return"";return t}var Ski=d(14254,null),Jpo=d(14253,null);function $Ht(a,i){if(a)return Iki(a);if(!i)return"";let e=i.timestamp,t=i.exitCode,o=i.duration;if(typeof e!="number"||e===void 0)return"";let n="",r=Bs(e,!0);if(typeof o=="number"){let s=z6(Math.max(o,0));t?t===-1?n+=d(14256,null,r,s):n+=d(14258,null,r,s,t):n+=d(14261,null,r,s)}else t?t===-1?n+=d(14255,null,r):n+=d(14257,null,r,t):n+=d(14260,null,r);return n}function qHt(a,i,e=Date.now()){let t="unknown",o=a?.exitCode??i?.exitCode,n=Ski,r=a?.timestamp??i?.timestamp,s=Ski,l,c=Ski;typeof r=="number"&&(s=new Date(r).toLocaleString()),a?a.exitCode===void 0?(t="running",n=Jpo,l=r!==void 0?Math.max(0,e-r):void 0):a.exitCode!==0?(t="error",n=String(a.exitCode),l=a.duration??(r!==void 0?Math.max(0,e-r):void 0)):(t="success",n=String(a.exitCode),l=a.duration??(r!==void 0?Math.max(0,e-r):void 0)):i&&(i.exitCode===void 0?(t="running",n=Jpo,l=r!==void 0?Math.max(0,e-r):void 0):i.exitCode!==0?(t="error",n=String(i.exitCode),l=i.duration):(t="success",n=String(i.exitCode),l=i.duration)),typeof l=="number"&&(c=z6(Math.max(l,0)));let u=[],p=bki;switch(t){case"running":case"unknown":u.push("default-color","default"),p=bki;break;case"error":u.push("error"),p=$po;break;case"success":u.push("success"),p=qpo;break}let h=$Ht(a,i);return{status:t,icon:p,classNames:u,exitCode:o,exitCodeText:n,startTimestamp:r,startText:s,duration:l,durationText:c,hoverMessage:h}}function dAe(a,i){if(!i)return;let e=a.inspect("terminal.integrated.fontSize").value,t=a.inspect("terminal.integrated.fontSize").defaultValue,o=a.inspect("terminal.integrated.lineHeight").value;if(Xo(e)&&Xo(t)&&Xo(o)){let n=e/t<=1?e/t:1;i.style.width=`${n*16}px`,i.style.height=`${n*16*o}px`,i.style.fontSize=`${n*16}px`,i.style.marginLeft=`${n*-17}px`}}var jC=class extends C{constructor(){super(...arguments);this._map=new Map;this._onDidAddCapability=this._register(new E);this._onDidRemoveCapability=this._register(new E)}get onDidAddCapability(){return this._onDidAddCapability.event}get onDidRemoveCapability(){return this._onDidRemoveCapability.event}get onDidChangeCapabilities(){return H.map(H.any(this._onDidAddCapability.event,this._onDidRemoveCapability.event),()=>{},this._store)}get onDidAddCommandDetectionCapability(){return H.map(H.filter(this.onDidAddCapability,e=>e.id===2,this._store),e=>e.capability,this._store)}get onDidRemoveCommandDetectionCapability(){return H.map(H.filter(this.onDidRemoveCapability,e=>e.id===2,this._store),()=>{},this._store)}get onDidAddCwdDetectionCapability(){return H.map(H.filter(this.onDidAddCapability,e=>e.id===0,this._store),e=>e.capability,this._store)}get onDidRemoveCwdDetectionCapability(){return H.map(H.filter(this.onDidRemoveCapability,e=>e.id===0,this._store),()=>{},this._store)}get items(){return this._map.keys()}createOnDidRemoveCapabilityOfTypeEvent(e){return H.map(H.filter(this.onDidRemoveCapability,t=>t.id===e),t=>t.capability)}createOnDidAddCapabilityOfTypeEvent(e){return H.map(H.filter(this.onDidAddCapability,t=>t.id===e),t=>t.capability)}add(e,t){this._map.set(e,t),this._onDidAddCapability.fire(yki(e,t))}get(e){return this._map.get(e)}remove(e){let t=this._map.get(e);t&&(this._map.delete(e),this._onDidRemoveCapability.fire(yki(e,t)))}has(e){return this._map.has(e)}};I([mi],jC.prototype,"onDidChangeCapabilities",1),I([mi],jC.prototype,"onDidAddCommandDetectionCapability",1),I([mi],jC.prototype,"onDidRemoveCommandDetectionCapability",1),I([mi],jC.prototype,"onDidAddCwdDetectionCapability",1),I([mi],jC.prototype,"onDidRemoveCwdDetectionCapability",1);var P3=class extends C{constructor(){super(...arguments);this._stores=[];this._onDidAddCapability=this._register(new E);this._onDidRemoveCapability=this._register(new E)}get onDidAddCapability(){return this._onDidAddCapability.event}get onDidRemoveCapability(){return this._onDidRemoveCapability.event}get onDidChangeCapabilities(){return H.map(H.any(this._onDidAddCapability.event,this._onDidRemoveCapability.event),()=>{},this._store)}get onDidAddCommandDetectionCapability(){return H.map(H.filter(this.onDidAddCapability,e=>e.id===2,this._store),e=>e.capability,this._store)}get onDidRemoveCommandDetectionCapability(){return H.map(H.filter(this.onDidRemoveCapability,e=>e.id===2,this._store),()=>{},this._store)}get onDidAddCwdDetectionCapability(){return H.map(H.filter(this.onDidAddCapability,e=>e.id===0,this._store),e=>e.capability,this._store)}get onDidRemoveCwdDetectionCapability(){return H.map(H.filter(this.onDidRemoveCapability,e=>e.id===0,this._store),()=>{},this._store)}get items(){return this._items()}createOnDidRemoveCapabilityOfTypeEvent(e){return H.map(H.filter(this.onDidRemoveCapability,t=>t.id===e),t=>t.capability)}createOnDidAddCapabilityOfTypeEvent(e){return H.map(H.filter(this.onDidAddCapability,t=>t.id===e),t=>t.capability)}*_items(){for(let e of this._stores)for(let t of e.items)yield t}has(e){for(let t of this._stores)for(let o of t.items)if(o===e)return!0;return!1}get(e){for(let t of this._stores){let o=t.get(e);if(o)return o}}add(e){this._stores.push(e);for(let t of e.items)this._onDidAddCapability.fire(yki(t,e.get(t)));this._register(e.onDidAddCapability(t=>this._onDidAddCapability.fire(t))),this._register(e.onDidRemoveCapability(t=>this._onDidRemoveCapability.fire(t)))}};I([mi],P3.prototype,"onDidChangeCapabilities",1),I([mi],P3.prototype,"onDidAddCommandDetectionCapability",1),I([mi],P3.prototype,"onDidRemoveCommandDetectionCapability",1),I([mi],P3.prototype,"onDidAddCwdDetectionCapability",1),I([mi],P3.prototype,"onDidRemoveCwdDetectionCapability",1);function yki(a,i){return{id:a,capability:i}}function up(a,i,e=!1){ptt.INSTANCE.registerTerminalContribution({id:a,ctor:i,canRunInDetachedTerminals:e})}var mtt;(i=>{function a(){return ptt.INSTANCE.getTerminalContributions()}i.getTerminalContributions=a})(mtt||={});var ptt=class a{constructor(){this._terminalContributions=[]}static{this.INSTANCE=new a}registerTerminalContribution(i){this._terminalContributions.push(i)}getTerminalContributions(){return this._terminalContributions.slice(0)}};oe.add("terminal.contributions",ptt.INSTANCE);var uAe=class{constructor(){this._attached=new Map}attachToElement(i){this._container||(this._container=document.createElement("div"),this._container.classList.add("terminal-widget-container"),i.appendChild(this._container))}dispose(){this._container&&(this._container.remove(),this._container=void 0),this._attached.forEach(i=>i.dispose()),this._attached.clear()}attachWidget(i){if(this._container)return this._attached.get(i.id)?.dispose(),i.attach(this._container),this._attached.set(i.id,i),{dispose:()=>{this._attached.get(i.id)===i&&(this._attached.delete(i.id),i.dispose())}}}};var pAe=class extends C{constructor(e,t,o){super();this._xterm=e;this._widgets=this._register(new uAe);this._contributions=new Map;this._attachDisposables=this._register(new me);this.onData=this._xterm.raw.onData;let n=t.capabilities??new jC;this._register(n),this.capabilities=n,this._register(e);let r=mtt.getTerminalContributions();for(let s of r){if(this._contributions.has(s.id)){mt(new Error(`Cannot have two terminal contributions with the same id ${s.id}`));continue}if(s.canRunInDetachedTerminals===!1)continue;let l;try{l=o.createInstance(s.ctor,{instance:this,processManager:t.processInfo,widgetManager:this._widgets}),this._contributions.set(s.id,l),this._register(l)}catch(c){mt(c)}}this._register(new jo(QD)).trigger(()=>{for(let s of this._contributions.values())s.xtermReady?.(this._xterm)})}get xterm(){return this._xterm}get selection(){return this._xterm&&this.hasSelection()?this._xterm.raw.getSelection():void 0}hasSelection(){return this._xterm.hasSelection()}clearSelection(){this._xterm.clearSelection()}focus(e){(e||!Ki().getSelection()?.toString())&&this.xterm.focus()}attachToElement(e,t){this.domElement=e;let o=this._xterm.attachToElement(e,t);this._widgets.attachToElement(o);let n=new P,r=()=>{setTimeout(()=>this.focus(!0),0)};n.add(j(e,re.MOUSE_DOWN,r)),this._attachDisposables.value=n}forceScrollbarVisibility(){this.domElement?.classList.add("force-scrollbar")}resetScrollbarVisibility(){this.domElement?.classList.remove("force-scrollbar")}getContribution(e){return this._contributions.get(e)}};pAe=I([m(2,F)],pAe);var Gme=class extends C{constructor(e){super();this.processState=3;this.ptyProcessReady=Promise.resolve();this.initialCwd="";this.shouldPersist=!1;this.hasWrittenData=!1;this.hasChildProcesses=!1;this.shellIntegrationNonce="";Object.assign(this,e),this.capabilities=this._register(new jC)}};function emo(a,i,e){if(e){let n=Oe.fromHex(e);if(n)return n}let t=a.getColor(lX);if(t)return t;let o=ie.inChatEditor.getValue(i);return a.getColor(o?qo:jS)}function tmo(a,i){let e=0;for(let t=0;t<a.length;t++){let o=a.getLine(t);if(!o)continue;let n=Math.min(o.length,i);for(let r=n-1;r>=0;r--)if(o.getCell(r)?.getChars()){e=Math.max(e,r+1);break}}return e}function W9o(a,i,e,t=50){let o=Math.max(0,e-t),n=e;for(let r=o;r<n;r++)if(a.charCodeAt(r)!==i.charCodeAt(r))return!1;return!0}function jHt(a,i){return Math.max(i-a,0)}async function imo(a,i,e){let t=i.executedMarker,o=i.endMarker;if(!o||o.isDisposed)return;if(!t||t.isDisposed){let c=a.raw,u=c.buffer.active,p=[-(u.baseY+u.cursorY),-u.baseY,0],h;for(let S of p)if(h=c.registerMarker(S),h)break;if(!h||h.isDisposed)return{text:"",lineCount:0};let g=h.line,f;try{f=await a.getRangeAsVT(h,o,!0)}catch(S){e?.("fallback",S);return}finally{h.dispose()}if(!f)return{text:"",lineCount:0};let v=o.line,b=jHt(g,v);return{text:f,lineCount:b}}let n=t.line,r=o.line,s=jHt(n,r),l;try{l=await a.getRangeAsVT(t,o,!0)}catch(c){e?.("primary",c);return}return l?{text:l,lineCount:s}:{text:"",lineCount:0}}var mAe=class extends C{constructor(e,t,o,n){super();this._xtermTerminal=e;this._command=t;this._terminalService=o;this._contextKeyService=n;this._streamingDisposables=this._register(new P);this._onDidUpdateEmitter=this._register(new E);this.onDidUpdate=this._onDidUpdateEmitter.event;this._onDidInputEmitter=this._register(new E);this.onDidInput=this._onDidInputEmitter.event;this._lastVT="";this._lineCount=0;this._maxColumnWidth=0;this._dirtyScheduled=!1;this._isStreaming=!1;this._register(Z(()=>{this._stopStreaming()}))}async attach(e){if(this._store.isDisposed)return;let t;try{t=await this._getOrCreateTerminal()}catch(o){if(o instanceof ho)return;throw o}this._store.isDisposed||this._attachedContainer!==e&&(e.classList.add("chat-terminal-output-terminal"),t.attachToElement(e,{enableGpu:!1}),this._attachedContainer=e)}async renderCommand(){if(this._store.isDisposed)return;let e;try{e=await this._getOrCreateTerminal()}catch(r){if(r instanceof ho)return;throw r}if(this._store.isDisposed)return;let t;try{t=await this._getCommandOutputAsVT(this._xtermTerminal)}catch{}if(!t||this._store.isDisposed)return;await new Promise(r=>{if(!!this._lastVT&&t.text.length>=this._lastVT.length&&this._vtBoundaryMatches(t.text,this._lastVT.length)){let l=t.text.slice(this._lastVT.length);l?e.xterm.write(l,r):r()}else{let l=this._lastVT?`\x1Bc${t.text}`:t.text;l?e.xterm.write(l,r):r()}}),this._lastVT=t.text;let o=this._xtermTerminal.raw;return o&&(this._sourceRaw=o,this._lastUpToDateCursorY=this._getAbsoluteCursorY(o),!this._isStreaming&&(!this._command.endMarker||this._command.endMarker.isDisposed)&&this._startStreaming(o)),this._lineCount=this._getRenderedLineCount(),this._command.endMarker&&!this._command.endMarker.isDisposed&&this._lineCount<=100&&(this._maxColumnWidth=this._computeMaxColumnWidth()),{lineCount:this._lineCount,maxColumnWidth:this._maxColumnWidth}}async _getCommandOutputAsVT(e){if(this._store.isDisposed)return;let t=this._command.executedMarker??this._command.commandExecutedMarker;if(!t)return;let o=this._command.endMarker,n=await e.getRangeAsVT(t,o,o?.line!==t.line);if(!this._store.isDisposed)return n?{text:n}:{text:""}}_getRenderedLineCount(){let e=this._command.endMarker;if(this._command.executedMarker&&e&&!e.isDisposed){let o=this._command.executedMarker.line,n=e.line;return jHt(o,n)}let t=this._command.executedMarker??this._command.commandExecutedMarker;if(t&&this._sourceRaw){let o=this._sourceRaw.buffer.active,n=o.baseY+o.cursorY;return jHt(t.line,n)}return this._lineCount}_computeMaxColumnWidth(){let e=this._detachedTerminal;return e?tmo(e.xterm.buffer.active,e.xterm.cols):0}async _getOrCreateTerminal(){if(this._detachedTerminal)return this._detachedTerminal;if(this._detachedTerminalPromise)return this._detachedTerminalPromise;if(this._store.isDisposed)throw new ho;let e=(async()=>{let t={getBackgroundColor:r=>emo(r,this._contextKeyService)},o=new Gme({initialCwd:""}),n=await this._terminalService.createDetachedTerminal({cols:this._xtermTerminal.raw.cols??80,rows:10,readonly:!1,processInfo:o,disableOverviewRuler:!0,colorProvider:t});if(this._store.isDisposed)throw o.dispose(),n.dispose(),new ho;return this._detachedTerminal=n,this._register(o),this._register(n),this._register(n.onData(r=>this._onDidInputEmitter.fire(r))),n})();return this._detachedTerminalPromise=e,e}_startStreaming(e){this._store.isDisposed||this._isStreaming||(this._isStreaming=!0,this._streamingDisposables.add(H.any(e.onCursorMove,e.onLineFeed,e.onWriteParsed)(()=>this._handleCursorEvent())),this._streamingDisposables.add(e.onData(()=>this._handleCursorEvent())))}_stopStreaming(){this._isStreaming&&(this._streamingDisposables.clear(),this._isStreaming=!1,this._lowestDirtyCursorY=void 0,this._sourceRaw=void 0)}_handleCursorEvent(){if(this._store.isDisposed||!this._sourceRaw)return;let e=this._getAbsoluteCursorY(this._sourceRaw);this._lowestDirtyCursorY=this._lowestDirtyCursorY===void 0?e:Math.min(this._lowestDirtyCursorY,e),this._scheduleFlush()}_scheduleFlush(){this._dirtyScheduled||this._store.isDisposed||(this._dirtyScheduled=!0,queueMicrotask(()=>{this._dirtyScheduled=!1,!this._store.isDisposed&&this._flushDirtyRange()}))}_flushDirtyRange(){this._store.isDisposed||this._flushPromise||(this._flushPromise=this._doFlushDirtyRange().finally(()=>{this._flushPromise=void 0}))}async _doFlushDirtyRange(){if(this._store.isDisposed)return;let e=this._xtermTerminal.raw,t=this._detachedTerminal;if(!t)try{t=await this._getOrCreateTerminal()}catch(h){if(h instanceof ho)return;throw h}if(this._store.isDisposed)return;let o=t?.xterm;if(!e||!o)return;this._sourceRaw=e;let n=this._getAbsoluteCursorY(e),r=this._lastUpToDateCursorY??n,s=this._lowestDirtyCursorY??n;this._lowestDirtyCursorY=void 0;let l=Math.min(r,s),c=await this._getCommandOutputAsVT(this._xtermTerminal);if(!c||this._store.isDisposed)return;if(c.text===this._lastVT){this._lastUpToDateCursorY=n,this._command.endMarker&&!this._command.endMarker.isDisposed&&this._stopStreaming();return}let u=!!this._lastVT&&l>=r&&c.text.length>=this._lastVT.length&&this._vtBoundaryMatches(c.text,this._lastVT.length);await new Promise(h=>{if(u){let g=c.text.slice(this._lastVT.length);g?o.write(g,h):h()}else{let g=this._lastVT?`\x1Bc${c.text}`:c.text;g?o.write(g,h):h()}}),this._lastVT=c.text,this._lineCount=this._getRenderedLineCount(),this._lastUpToDateCursorY=n,this._command.endMarker&&!this._command.endMarker.isDisposed&&(this._lineCount<=100&&(this._maxColumnWidth=this._computeMaxColumnWidth()),this._stopStreaming()),this._onDidUpdateEmitter.fire({lineCount:this._lineCount,maxColumnWidth:this._maxColumnWidth})}_getAbsoluteCursorY(e){return e.buffer.active.baseY+e.buffer.active.cursorY}_vtBoundaryMatches(e,t){return W9o(e,this._lastVT,t)}};mAe=I([m(2,Yo),m(3,X)],mAe);var hAe=class extends C{constructor(e,t,o,n){super();this._getTheme=t;this._terminalService=o;this._contextKeyService=n;this._dirty=!0;this._output=e;let r=this._register(new Gme({initialCwd:""}));this._detachedTerminal=this._terminalService.createDetachedTerminal({cols:80,rows:10,readonly:!0,processInfo:r,disableOverviewRuler:!0,colorProvider:{getBackgroundColor:s=>{let l=this._getTheme()?.background;return emo(s,this._contextKeyService,l)}}}).then(s=>this._store.isDisposed?(s.dispose(),s):this._register(s))}async _getTerminal(){if(!this._detachedTerminal)throw new Error("Detached terminal not initialized");return this._detachedTerminal}setOutput(e){this._output=e,this._dirty=!0}async attach(e){let t=await this._getTerminal();if(this._store.isDisposed)return;e.classList.add("chat-terminal-output-terminal"),(this._attachedContainer!==e||e.firstChild===null)&&(t.attachToElement(e,{enableGpu:!1}),this._attachedContainer=e),this._container=e,this._applyTheme(e)}async render(){let e=this._output;if(!e)return;if(!this._dirty)return{lineCount:this._lastRenderedLineCount??e.lineCount,maxColumnWidth:this._lastRenderedMaxColumnWidth};let t=await this._getTerminal();if(this._store.isDisposed)return;this._container&&this._applyTheme(this._container);let o=e.text??"",n=e.lineCount??this._estimateLineCount(o);if(!o)return this._dirty=!1,this._lastRenderedLineCount=n,this._lastRenderedMaxColumnWidth=0,{lineCount:0,maxColumnWidth:0};if(await new Promise(r=>t.xterm.write(o,r)),!this._store.isDisposed)return this._dirty=!1,this._lastRenderedLineCount=n,this._shouldComputeMaxColumnWidth(n)&&(this._lastRenderedMaxColumnWidth=this._computeMaxColumnWidth(t)),{lineCount:n,maxColumnWidth:this._lastRenderedMaxColumnWidth}}_computeMaxColumnWidth(e){return tmo(e.xterm.buffer.active,e.xterm.cols)}_estimateLineCount(e){if(!e)return 0;let t=e.replace(/\r/g,""),o=t.split(`
`),n=t.endsWith(`
`)?o.length-1:o.length;return Math.max(n,1)}_shouldComputeMaxColumnWidth(e){return e<=100}_applyTheme(e){let t=this._getTheme();if(!t){e.style.removeProperty("background-color"),e.style.removeProperty("color");return}t.background&&(e.style.backgroundColor=t.background),t.foreground&&(e.style.color=t.foreground)}};hAe=I([m(2,Yo),m(3,X)],hAe);var omo=1,V9o=10,nmo=50,B9o=10,H9o=100,U9o=2,wki=new WeakMap,htt=class extends C{constructor(e,t){super();this._options=e;this._hoverService=t;let o=bt("span.chat-terminal-command-decoration@decoration",{role:"img",tabIndex:0});this._element=o.decoration,this._attachElementToContainer()}_attachElementToContainer(){let e=this._options.getCommandBlock();if(!e)return;let t=this._element;if(!t.isConnected||t.parentElement!==e){let o=this._options.getIconElement();o&&o.parentElement===e?o.insertAdjacentElement("afterend",t):e.insertBefore(t,e.firstElementChild??null)}this._register(this._hoverService.setupDelayedHover(t,()=>({content:this._getHoverText()}))),this._attachInteractionHandlers(t)}_getHoverText(){let e=this._options.getResolvedCommand(),t=this._options.terminalData.terminalCommandState;return $Ht(e,t)||""}update(e){this._attachElementToContainer();let t=this._element,o=e??this._options.getResolvedCommand();this._apply(t,o)}_apply(e,t){let o=this._options.terminalData,n=o.terminalCommandState;if(t){let u=o.terminalCommandState??{};o.terminalCommandState={...u,exitCode:t.exitCode,timestamp:t.timestamp??u.timestamp,duration:t.duration??u.duration},n=o.terminalCommandState}else if(!n){let u=Date.now();o.terminalCommandState={exitCode:void 0,timestamp:u},n=o.terminalCommandState}let r=qHt(t,n),s=$Ht(t,n);e.className="chat-terminal-command-decoration terminal-command-decoration",e.classList.add("codicon");for(let u of r.classNames)e.classList.add(u);e.classList.add(...q.asClassNameArray(r.icon));let l=!e.classList.contains("default");e.tabIndex=l?0:-1,l?e.removeAttribute("aria-disabled"):e.setAttribute("aria-disabled","true");let c=s||r.hoverMessage;c?e.setAttribute("aria-label",c):e.removeAttribute("aria-label")}_attachInteractionHandlers(e){this._interactionElement!==e&&(this._interactionElement=e)}};htt=I([m(1,tt)],htt);var gAe=class extends Nv{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super(e);this._instantiationService=u;this._terminalChatService=p;this._terminalService=h;this._contextKeyService=g;this._chatWidgetService=f;this._keybindingService=v;this._configurationService=b;this._showOutputAction=this._register(new me);this._showOutputActionAdded=!1;this._focusAction=this._register(new me);this._continueInBackgroundAction=this._register(new me);this._userToggledOutput=!1;this._isInThinkingContainer=!1;this._usesCollapsibleWrapper=!1;this._elementIndex=o.elementIndex,this._contentIndex=o.contentIndex,this._sessionResource=o.element.sessionResource,t=fR(t),this._terminalData=t,this._terminalCommandUri=t.terminalCommandUri?A.revive(t.terminalCommandUri):void 0,this._storedCommandId=this._terminalCommandUri?new URLSearchParams(this._terminalCommandUri.query??"").get("command")??void 0:void 0,this._isSerializedInvocation=e.kind==="toolInvocationSerialized";let S=bt(".chat-terminal-content-part@container",[bt(".chat-terminal-content-title@title",[bt(".chat-terminal-command-block@commandBlock")]),bt(".chat-terminal-content-message@message")]);this._titleElement=S.title;let y=(t.commandLine.forDisplay??t.commandLine.userEdited??t.commandLine.toolEdited??t.commandLine.original).trimStart();this._commandText=y,this._terminalOutputContextKey=ie.inChatTerminalToolOutput.bindTo(this._contextKeyService),this._decoration=this._register(this._instantiationService.createInstance(htt,{terminalData:this._terminalData,getCommandBlock:()=>S.commandBlock,getIconElement:()=>{},getResolvedCommand:()=>this._getResolvedCommand()}));let w=t.presentationOverrides?.commandLine??y,k=t.presentationOverrides?.language??t.language,T=this._register(u.createInstance(u2,S.commandBlock,new xe([`\`\`\`${k}`,`${w.replaceAll("```","\\`\\`\\`")}`,"```"].join(`
`),{supportThemeIcons:!0}),void 0));this._register(T.onDidChangeHeight(()=>{this._decoration.update()})),this._outputView=this._register(this._instantiationService.createInstance(gtt,()=>this._ensureTerminalInstance(),()=>this._getResolvedCommand(),()=>this._terminalData.terminalCommandOutput,()=>this._commandText,()=>this._terminalData.terminalTheme)),S.container.append(this._outputView.domNode),this._register(this._outputView.onDidFocus(()=>this._handleOutputFocus())),this._register(this._outputView.onDidBlur(ke=>this._handleOutputBlur(ke))),this._register(Z(()=>this._handleDispose())),this._register(this._keybindingService.onDidUpdateKeybindings(()=>{this._focusAction.value?.refreshKeybindingTooltip(),this._showOutputAction.value?.refreshKeybindingTooltip()}));let N=bt(".chat-terminal-action-bar@actionBar");S.title.append(N.root),this._actionBar=this._register(new ji(N.actionBar,{})),this._initializeTerminalActions(),this._terminalService.whenConnected.then(()=>this._initializeTerminalActions());let O;e.pastTenseMessage&&(O=`${typeof e.pastTenseMessage=="string"?e.pastTenseMessage:e.pastTenseMessage.value}`);let U={kind:"markdownContent",content:new xe(O,{supportThemeIcons:!0,isTrusted:Mr(e.pastTenseMessage)?e.pastTenseMessage.isTrusted:!1})},$={codeBlockRenderOptions:{hideToolbar:!0,reserveWidth:19,verticalPadding:5,editorOptions:{wordWrap:"on"}},accessibilityOptions:O?{statusMessage:d(7304,null,fu(O))}:void 0};this.markdownPart=this._register(u.createInstance(lT,U,o,r,!1,l,n,{},s(),c,$)),S.message.append(this.markdownPart.domNode);let te=this._register(u.createInstance(vA,S.container,this.getIcon(),t.autoApproveInfo));this._decoration.update();let pe=this._configurationService.getValue("chat.agent.thinking.terminalTools"),de=this._configurationService.getValue("chat.tools.terminal.simpleCollapsible"),se=e.kind==="toolInvocation"&&lo.getConfirmationMessages(e);if(this._isInThinkingContainer=pe&&!se,this._usesCollapsibleWrapper=this._isInThinkingContainer||de,this._usesCollapsibleWrapper)this.domNode=this._createCollapsibleWrapper(te.domNode,w,e,o);else{this.domNode=te.domNode;let ke=()=>this.domNode.classList.toggle("show-checkmarks",!!this._configurationService.getValue("accessibility.chat.showCheckmarks"));ke(),this._register(this._configurationService.onDidChangeConfiguration(Ee=>{Ee.affectsConfiguration("accessibility.chat.showCheckmarks")&&ke()}))}let Se=!!t.terminalCommandOutput;(wki.get(e)||this._isInThinkingContainer&&lo.isComplete(e)&&Se)&&this._toggleOutput(!0),this._register(this._terminalChatService.registerProgressPart(this))}get codeblocks(){return this.markdownPart?.codeblocks??[]}get elementIndex(){return this._elementIndex}get contentIndex(){return this._contentIndex}_createCollapsibleWrapper(e,t,o,n){let r=t.length>nmo?t.substring(0,nmo)+"...":t,s=lo.isComplete(o),c=this._configurationService.getValue("chat.tools.autoExpandFailures")&&this._terminalData.terminalCommandState?.exitCode!==void 0&&this._terminalData.terminalCommandState.exitCode!==0,u=!s||c,p=this._register(this._instantiationService.createInstance(Stt,r,e,n,u,s));this._thinkingCollapsibleWrapper=p;let h=!0;return this._register(he(g=>{let f=p.expanded.read(g);if(h){h=!1;return}this._toggleOutput(f)})),p.domNode}expandCollapsibleWrapper(){this._thinkingCollapsibleWrapper?.expand()}markCollapsibleWrapperComplete(){this._thinkingCollapsibleWrapper?.markComplete()}async _initializeTerminalActions(){if(this._store.isDisposed)return;let e=this._terminalData.terminalToolSessionId;if(!e){this._addActions();return}let t=async n=>{if(this._store.isDisposed)return;if(!n){this._isSerializedInvocation&&this._clearCommandAssociation(),this._addActions(void 0,e);return}this._terminalInstance!==n&&(this._terminalInstance=n,this._registerInstanceListener(n)),this._addActions(n,e)},o=await this._terminalChatService.getTerminalInstanceByToolSessionId(e);if(await t(o),o||this._addActions(void 0,e),!this._store.isDisposed){if(!this._terminalSessionRegistration){let n=this._terminalChatService.onDidRegisterTerminalInstanceWithToolSession(async r=>{let s=await this._terminalChatService.getTerminalInstanceByToolSessionId(e);r===s&&(this._terminalSessionRegistration?.dispose(),this._terminalSessionRegistration=void 0,await t(r))});this._terminalSessionRegistration=this._store.add(n)}this._store.add(this._terminalChatService.onDidContinueInBackground(n=>{n===e&&(this._terminalData.didContinueInBackground=!0,this._removeContinueInBackgroundAction())}))}}_addActions(e,t){if(this._store.isDisposed)return;let o=this._actionBar;this._removeFocusAction();let n=this._getResolvedCommand(e);if(this._removeContinueInBackgroundAction(),e){let r=e&&t?this._terminalChatService.isBackgroundTerminal(t):!1,s=this._instantiationService.createInstance(vtt,e,n,this._terminalCommandUri,this._storedCommandId,r);if(this._focusAction.value=s,o.push(s,{icon:!0,label:!1,index:0}),t&&!this._terminalData.isBackground&&!this._terminalData.didContinueInBackground&&n?.exitCode===void 0&&this._terminalData.terminalCommandState?.exitCode===void 0){let c=this._instantiationService.createInstance(btt,t);this._continueInBackgroundAction.value=c,o.push(c,{icon:!0,label:!1,index:0})}}this._ensureShowOutputAction(n),this._decoration.update(n)}_getResolvedCommand(e){let t=e??this._terminalInstance;if(t)return this._resolveCommand(t)}_ensureShowOutputAction(e){if(this._store.isDisposed||this._usesCollapsibleWrapper)return;let t=e??this._getResolvedCommand(),o=!!this._terminalData.terminalCommandOutput;if(!t&&!o)return;let n=this._showOutputAction.value;if(!n){n=this._instantiationService.createInstance(ftt,()=>this._toggleOutputFromAction()),this._showOutputAction.value=n;let s=this._configurationService.getValue("chat.tools.autoExpandFailures"),l=t?.exitCode??this._terminalData.terminalCommandState?.exitCode;l!==void 0&&l!==0&&s&&this._toggleOutput(!0)}n.syncPresentation(this._outputView.isExpanded);let r=this._actionBar;if(this._showOutputActionAdded){let s=r.viewItems.findIndex(l=>l.action===n);if(s>=0&&s!==r.length()-1)r.pull(s),this._showOutputActionAdded=!1;else if(s>=0)return}this._showOutputActionAdded||(r.push([n],{icon:!0,label:!1}),this._showOutputActionAdded=!0)}_clearCommandAssociation(e){this._terminalCommandUri=void 0,this._storedCommandId=void 0,e?.clearPersistentData&&(this._terminalData.terminalCommandUri&&delete this._terminalData.terminalCommandUri,this._terminalData.terminalToolSessionId&&delete this._terminalData.terminalToolSessionId),this._decoration.update()}_shouldAutoExpand(){return!this._outputView.isExpanded&&!this._userToggledOutput&&!this._store.isDisposed&&!wki.get(this.toolInvocation)}_registerInstanceListener(e){let t=this._register(new me),o=async()=>{let s=this._resolveCommand(e);return this._addActions(e,this._terminalData.terminalToolSessionId),s},n=async s=>{if(t.clear(),!s){await o();return}let l=new P,c=0,u=()=>{if(this._terminalData.terminalCommandOutput?.text?.trim())return!0;let g=this._getResolvedCommand(e);if(!g?.executedMarker||e.isDisposed)return!1;let f=e.xterm?.raw.buffer.active;return f?f.baseY+f.cursorY>g.executedMarker.line?!0:c>U9o:!1},p=l.add(new KHt({commandDetection:s,onWillData:e.onWillData,shouldAutoExpand:()=>this._shouldAutoExpand(),hasRealOutput:u}));l.add(p.onDidRequestExpand(()=>{this._usesCollapsibleWrapper&&this.expandCollapsibleWrapper(),this._toggleOutput(!0)})),l.add(e.onWillData(()=>{c++})),l.add(s.onCommandExecuted(()=>{this._addActions(e,this._terminalData.terminalToolSessionId)})),l.add(s.onCommandFinished(()=>{this._addActions(e,this._terminalData.terminalToolSessionId);let g=this._getResolvedCommand(e);this._handleCommandCompletion(g),g?.endMarker&&t.clear()})),t.value=l;let h=await o();if(h?.endMarker){t.clear(),this._handleCommandCompletion(h);return}};n(e.capabilities.get(2)),this._register(e.capabilities.onDidAddCommandDetectionCapability(s=>n(s)));let r=this._register(e.onDisposed(()=>{this._terminalInstance===e&&(this._terminalInstance=void 0),this._clearCommandAssociation({clearPersistentData:!0}),t.clear(),this._store.isDisposed||this._actionBar.clear(),this._removeFocusAction(),this._showOutputActionAdded=!1,this._showOutputAction.clear(),this._addActions(void 0,this._terminalData.terminalToolSessionId),r.dispose()}))}_removeFocusAction(){if(this._store.isDisposed)return;let e=this._actionBar,t=this._focusAction.value;if(e&&t){let o=e.viewItems.findIndex(n=>n.action===t);o>=0&&e.pull(o)}this._focusAction.clear()}_removeContinueInBackgroundAction(){if(this._store.isDisposed)return;let e=this._actionBar,t=this._continueInBackgroundAction.value;if(e&&t){let o=e.viewItems.findIndex(n=>n.action===t);o>=0&&e.pull(o)}this._continueInBackgroundAction.clear()}_handleCommandCompletion(e){this.markCollapsibleWrapperComplete(),e?.exitCode===0&&this._outputView.isExpanded&&!this._userToggledOutput&&this._toggleOutput(!1),this._configurationService.getValue("chat.tools.autoExpandFailures")&&e?.exitCode!==void 0&&e.exitCode!==0&&this._thinkingCollapsibleWrapper&&this.expandCollapsibleWrapper()}async _toggleOutput(e){let t=await this._outputView.toggle(e),o=this._outputView.isExpanded;return this._titleElement.classList.toggle("chat-terminal-content-title-no-bottom-radius",o),this._showOutputAction.value?.syncPresentation(o),t&&wki.set(this.toolInvocation,o),t}async _ensureTerminalInstance(){return this._terminalInstance?.isDisposed&&(this._terminalInstance=void 0),!this._terminalInstance&&this._terminalData.terminalToolSessionId&&(this._terminalInstance=await this._terminalChatService.getTerminalInstanceByToolSessionId(this._terminalData.terminalToolSessionId),this._terminalInstance?.isDisposed&&(this._terminalInstance=void 0)),this._terminalInstance}_handleOutputFocus(){this._terminalOutputContextKey.set(!0),this._terminalChatService.setFocusedProgressPart(this),this._outputView.updateAriaLabel()}_handleOutputBlur(e){let t=e.relatedTarget;this._outputView.containsElement(t)||(this._terminalOutputContextKey.reset(),this._terminalChatService.clearFocusedProgressPart(this))}_handleDispose(){this._terminalOutputContextKey.reset(),this._terminalChatService.clearFocusedProgressPart(this)}getCommandAndOutputAsText(){return this._outputView.getCommandAndOutputAsText()}focusOutput(){this._outputView.focus()}_focusChatInput(){this._chatWidgetService.getWidgetBySessionResource(this._sessionResource)?.focusInput()}async focusTerminal(){if(this._focusAction.value){await this._focusAction.value.run();return}this._terminalCommandUri&&this._terminalService.openResource(this._terminalCommandUri)}async toggleOutputFromKeyboard(){if(this._userToggledOutput=!0,!this._outputView.isExpanded){await this._toggleOutput(!0),this.focusOutput();return}await this._collapseOutputAndFocusInput()}async _toggleOutputFromAction(){if(this._userToggledOutput=!0,!this._outputView.isExpanded){await this._toggleOutput(!0);return}await this._toggleOutput(!1)}async _collapseOutputAndFocusInput(){this._outputView.isExpanded&&await this._toggleOutput(!1),this._focusChatInput()}_resolveCommand(e){if(e.isDisposed)return;let t=e.capabilities.get(2);if(!t)return;let o=this._terminalData.terminalCommandId;if(!o)return;let n=t.commands;if(n&&n.length>0){let s=n.find(l=>l.id===o);if(s)return s}let r=t.executingCommandObject;if(r&&r.id===o)return r}};gAe=I([m(8,F),m(9,kv),m(10,Yo),m(11,X),m(12,At),m(13,_e),m(14,B)],gAe);var gtt=class extends C{constructor(e,t,o,n,r,s,l,c,u,p){super();this._ensureTerminalInstance=e;this._resolveCommand=t;this._getTerminalCommandOutput=o;this._getCommandText=n;this._getStoredTheme=r;this._accessibleViewService=s;this._instantiationService=l;this._terminalConfigurationService=c;this._themeService=u;this._contextKeyService=p;this._isAtBottom=!0;this._isProgrammaticScroll=!1;this._onDidFocusEmitter=this._register(new E);this._onDidBlurEmitter=this._register(new E);let h=bt(".chat-terminal-output-container@container",[bt(".chat-terminal-output-body@body",[bt(".chat-terminal-output-content@content",[bt(".chat-terminal-output-terminal@terminal"),bt(".chat-terminal-output-empty@empty")])])]);this.domNode=h.container,this.domNode.classList.add("collapsed"),this._outputBody=h.body,this._contentContainer=h.content,this._terminalContainer=h.terminal,this._emptyElement=h.empty,this._contentContainer.appendChild(this._emptyElement),this._register(j(this.domNode,re.FOCUS_IN,()=>this._onDidFocusEmitter.fire())),this._register(j(this.domNode,re.FOCUS_OUT,f=>this._onDidBlurEmitter.fire(f)));let g=new ResizeObserver(()=>this._handleResize());g.observe(this.domNode),this._register(Z(()=>g.disconnect())),this._applyBackgroundColor(),this._register(this._themeService.onDidColorThemeChange(()=>this._applyBackgroundColor()))}get isExpanded(){return this.domNode.classList.contains("expanded")}get onDidFocus(){return this._onDidFocusEmitter.event}get onDidBlur(){return this._onDidBlurEmitter.event}async toggle(e){let t=this.isExpanded;return e===t?(e&&await this._updateTerminalContent(),!1):e?(this._scrollableContainer||await this._createScrollableContainer(),await this._updateTerminalContent(),this._setExpanded(!0),this._layoutOutput(),this._scrollOutputToBottom(),this._scheduleOutputRelayout(),!0):(this._setExpanded(!1),this._isAtBottom=!0,!0)}focus(){this._scrollableContainer?.getDomNode().focus()}containsElement(e){return!!e&&this.domNode.contains(e)}updateAriaLabel(){if(!this._scrollableContainer)return;let t=this._resolveCommand()?.command??this._getCommandText();if(!t)return;let o=d(7295,null,t),n=this._scrollableContainer.getDomNode();n.setAttribute("role","region");let r=this._accessibleViewService.getOpenAriaHint("accessibility.verbosity.terminalChatOutput"),s=r?o+", "+r:o;n.setAttribute("aria-label",s)}getCommandAndOutputAsText(){let e=this._resolveCommand(),t=e?.command??this._getCommandText();if(!t)return;let o=d(7294,null,t);if(e){let l=e.getOutput();if(!l||l.trim().length===0)return`${o}
${d(7292,null)}`;let c=l.split(`
`);return`${o}
${c.join(`
`).trimEnd()}`}let n=this._getTerminalCommandOutput();if(!n)return`${o}
${d(7297,null)}`;let r=CS(n.text??"");if(!r.trim().length)return`${o}
${d(7292,null)}`;let s=r.trimEnd();return n.truncated&&(s+=`
${d(7296,null)}`),`${o}
${s}`}_setExpanded(e){this.domNode.classList.toggle("expanded",e),this.domNode.classList.toggle("collapsed",!e)}async _createScrollableContainer(){this._scrollableContainer=this._register(new Pa(this._outputBody,{vertical:2,horizontal:2,handleMouseWheel:!0}));let e=this._scrollableContainer.getDomNode();e.tabIndex=0,this.domNode.appendChild(e),this.updateAriaLabel(),this._register(j(this.domNode,re.MOUSE_ENTER,()=>{this._scrollableContainer?.updateOptions({horizontal:1})})),this._register(j(this.domNode,re.MOUSE_LEAVE,()=>{this._scrollableContainer?.updateOptions({horizontal:2})})),this._register(j(this.domNode,re.FOCUS_IN,()=>{this._scrollableContainer?.updateOptions({horizontal:1})})),this._register(j(this.domNode,re.FOCUS_OUT,()=>{this._scrollableContainer?.updateOptions({horizontal:2})})),this._register(this._scrollableContainer.onScroll(()=>{this._isProgrammaticScroll||(this._isAtBottom=this._computeIsAtBottom())}))}async _updateTerminalContent(){let e=await this._resolveLiveTerminal(),t=e?this._resolveCommand():void 0,o=this._getTerminalCommandOutput();if(!(e&&t&&await this._renderLiveOutput(e,t))){if(this._disposeLiveMirror(),o){await this._renderSnapshotOutput(o);return}this._renderUnavailableMessage(e)}}async _renderLiveOutput(e,t){if(this._mirror)return!0;if(await e.xtermReadyPromise,this._store.isDisposed||e.isDisposed||!e.xterm)return this._disposeLiveMirror(),!1;let o=this._register(this._instantiationService.createInstance(mAe,e.xterm,t));this._mirror=o,this._register(o.onDidUpdate(l=>{l.lineCount&&l.lineCount>0&&this._hideEmptyMessage(),this._layoutOutput(l.lineCount),this._isAtBottom&&this._scrollOutputToBottom()})),this._register(o.onDidInput(l=>{e.isDisposed||e.sendText(l,!1)})),await o.attach(this._terminalContainer);let n=await o.renderCommand(),r=!!t.endMarker,s=n&&n.lineCount&&n.lineCount>0;if(!s)for(let l=0;l<B9o&&!s;l++){if(await Pi(H9o),this._store.isDisposed)return!0;if(n=await o.renderCommand(),s=n&&n.lineCount&&n.lineCount>0,r=!!t.endMarker,r)break}return s?this._hideEmptyMessage():r&&this._showEmptyMessage(d(7292,null)),this._layoutOutput(n?.lineCount??0),!0}async _renderSnapshotOutput(e){if(this._snapshotMirror){this._layoutOutput(e.lineCount??0);return}if(this._store.isDisposed)return;Rt(this._terminalContainer),this._snapshotMirror=this._register(this._instantiationService.createInstance(hAe,e,this._getStoredTheme)),await this._snapshotMirror.attach(this._terminalContainer),this._snapshotMirror.setOutput(e);let t=await this._snapshotMirror.render();!!e.text&&e.text.length>0?this._hideEmptyMessage():this._showEmptyMessage(d(7292,null));let n=t?.lineCount??e.lineCount??0;this._layoutOutput(n)}_renderUnavailableMessage(e){Rt(this._terminalContainer),this._lastRenderedLineCount=void 0,e?this._showEmptyMessage(d(7291,null)):this._showEmptyMessage(d(7293,null))}async _resolveLiveTerminal(){let e=await this._ensureTerminalInstance();return e&&!e.isDisposed?e:void 0}_showEmptyMessage(e){this._emptyElement.textContent=e,this._terminalContainer.classList.add("chat-terminal-output-terminal-no-output"),this.domNode.classList.add("chat-terminal-output-container-no-output")}_hideEmptyMessage(){this._emptyElement.textContent="",this._terminalContainer.classList.remove("chat-terminal-output-terminal-no-output"),this.domNode.classList.remove("chat-terminal-output-container-no-output")}_disposeLiveMirror(){this._mirror&&(this._mirror.dispose(),this._mirror=void 0)}_scheduleOutputRelayout(){Ki().requestAnimationFrame(()=>{this._layoutOutput(),this._scrollOutputToBottom()})}_handleResize(){this._scrollableContainer&&(this.isExpanded?(this._layoutOutput(),this._scrollOutputToBottom()):this._scrollableContainer.scanDomNode())}_layoutOutput(e){if(!this._scrollableContainer||(e!==void 0?this._lastRenderedLineCount=e:e=this._lastRenderedLineCount,this._scrollableContainer.scanDomNode(),!this.isExpanded||e===void 0))return;let t=this._scrollableContainer.getDomNode(),o=this._computeRowHeightPx(),n=this._getOutputPadding(),r=o*omo+n,s=o*V9o+n,l=this._getOutputContentHeight(e,o,n),c=Math.min(l,s),u=Math.max(this._outputBody.clientHeight,r),p=Math.min(c,u);t.style.height=p<s?`${p}px`:"",this._scrollableContainer.scanDomNode()}_computeIsAtBottom(){if(!this._scrollableContainer)return!0;let e=this._scrollableContainer.getScrollDimensions();return this._scrollableContainer.getScrollPosition().scrollTop>=e.scrollHeight-e.height-5}_scrollOutputToBottom(){if(!this._scrollableContainer)return;this._isProgrammaticScroll=!0;let e=this._scrollableContainer.getScrollDimensions();this._scrollableContainer.setScrollPosition({scrollTop:e.scrollHeight}),this._isProgrammaticScroll=!1}_getOutputContentHeight(e,t,o){return(Math.max(e,omo)+1)*t+o}_getOutputPadding(){let e=cU(this._outputBody),t=Number.parseFloat(e.paddingTop||"0"),o=Number.parseFloat(e.paddingBottom||"0");return t+o}_computeRowHeightPx(){let e=Ki(),t=this._terminalConfigurationService.getFont(e),o=Xo(t.charHeight)&&t.charHeight>0,n=Xo(t.fontSize)&&t.fontSize>0,r=Xo(t.lineHeight)&&t.lineHeight>0,s=(o?t.charHeight:n?t.fontSize:1)??1,l=r?t.lineHeight:1,c=Math.ceil(s*l);return Math.max(c,1)}_applyBackgroundColor(){let e=this._themeService.getColorTheme(),t=ie.inChatEditor.getValue(this._contextKeyService),o=e.getColor(t?qo:jS);o&&(this.domNode.style.backgroundColor=o.toString())}};gtt=I([m(5,Wd),m(6,F),m(7,ku),m(8,De),m(9,X)],gtt);var ftt=class extends st{constructor(e,t,o){super(lw.ToggleChatTerminalOutput,d(7303,null),q.asClassName(M.chevronRight),!0);this._toggle=e;this._keybindingService=t;this._telemetryService=o;this._expanded=!1;this._updateTooltip()}async run(){this._telemetryService.publicLog2("terminal/chatToggleOutput",{previousExpanded:this._expanded}),await this._toggle()}syncPresentation(e){this._expanded=e,this._updatePresentation(),this._updateTooltip()}refreshKeybindingTooltip(){this._updateTooltip()}_updatePresentation(){this._expanded?(this.label=d(7300,null),this.class=q.asClassName(M.chevronDown)):(this.label=d(7303,null),this.class=q.asClassName(M.chevronRight))}_updateTooltip(){this.tooltip=this._keybindingService.appendKeybinding(this.label,lw.FocusMostRecentChatTerminalOutput)}};ftt=I([m(1,_e),m(2,Te)],ftt);var vtt=class extends st{constructor(e,t,o,n,r,s,l,c,u,p){super(lw.FocusChatInstanceAction,r?d(7302,null):d(7299,null),q.asClassName(M.openInProduct),!0);this._instance=e;this._command=t;this._commandUri=o;this._commandId=n;this._terminalService=s;this._terminalEditorService=l;this._terminalGroupService=c;this._keybindingService=u;this._telemetryService=p;this._updateTooltip()}async run(){this.label=this._instance?.shellLaunchConfig.hideFromUser?d(7301,null):d(7299,null),this._updateTooltip();let e="none",t="panel";if(this._instance?(e="instance",t=this._instance.target===2?"editor":"panel"):this._commandUri&&(e="commandUri"),this._telemetryService.publicLog2("terminal/chatFocusInstance",{target:e,location:t}),this._instance){this._terminalService.setActiveInstance(this._instance),this._instance.target===2?this._terminalEditorService.openEditor(this._instance):await this._terminalGroupService.showPanel(!0),this._terminalService.setActiveInstance(this._instance),await this._instance.focusWhenReady(!0);let o=this._resolveCommand();o&&this._instance.xterm?.markTracker.revealCommand(o);return}this._commandUri&&this._terminalService.openResource(this._commandUri)}refreshKeybindingTooltip(){this._updateTooltip()}_resolveCommand(){if(this._command&&!this._command.endMarker?.isDisposed)return this._command;if(!this._instance||!this._commandId)return this._command;let t=this._instance.capabilities.get(2)?.commands.find(o=>o.id===this._commandId);return t&&(this._command=t),this._command}_updateTooltip(){this.tooltip=this._keybindingService.appendKeybinding(this.label,lw.FocusMostRecentChatTerminal)}};vtt=I([m(5,Yo),m(6,xv),m(7,jl),m(8,_e),m(9,Te)],vtt);var btt=class extends st{constructor(e,t){super(lw.ContinueInBackground,d(7298,null),q.asClassName(M.debugContinue),!0);this._terminalToolSessionId=e;this._terminalChatService=t}async run(){this._terminalChatService.continueInBackground(this._terminalToolSessionId)}};btt=I([m(1,kv)],btt);var Stt=class extends cT{constructor(i,e,t,o,n,r,s){let l=n?`Ran \`${i}\``:`Running \`${i}\``;super(l,t,void 0,r,s),this._terminalContentElement=e,this._commandText=i,this._isComplete=n,this.domNode.classList.add("chat-terminal-thinking-collapsible"),n&&(this.icon=M.check),this._setCodeFormattedTitle(),this.setExpanded(o)}_setCodeFormattedTitle(){if(!this._collapseButton)return;let i=this._collapseButton.labelElement;i.textContent="";let e=this._isComplete?d(7289,null):d(7290,null),t=document.createTextNode(e),o=document.createElement("code");o.textContent=this._commandText,i.appendChild(t),i.appendChild(o)}markComplete(){this._isComplete||(this._isComplete=!0,this.icon=M.check,this._setCodeFormattedTitle())}initContent(){let i=_(".chat-used-context-list.chat-terminal-thinking-content");return i.appendChild(this._terminalContentElement),i}expand(){this.setExpanded(!0)}hasSameContent(i,e,t){return!1}};Stt=I([m(5,tt),m(6,B)],Stt);var ete=class extends Nv{constructor(e,t,o,n,r,s,l){super(e);this.toolInvocation=e;this.context=t;this.instantiationService=o;this.keybindingService=n;this.contextKeyService=r;this.chatWidgetService=s;this.languageModelToolsService=l;if(e.kind!=="toolInvocation")throw new Error("Confirmation only works with live tool invocations")}render(e){let{keybindingService:t,languageModelToolsService:o,toolInvocation:n}=this,r=n.state.get(),s=r.type===lo.StateKind.WaitingForConfirmation?r.confirmationMessages?.customButtons:void 0,l;if(s&&s.length>0)l=s.map((g,f)=>({label:g,data:()=>{this.confirmWith(n,{type:4,selectedButton:g})},isSecondary:f>0}));else{let g=t.appendKeybinding(e.allowLabel,e.allowActionId),f=t.appendKeybinding(e.skipLabel,e.skipActionId),v=this.additionalPrimaryActions(),b=v.find(k=>"scope"in k&&k.scope==="session"),S={label:e.allowLabel,tooltip:g,data:()=>{this.confirmWith(n,{type:4})}},y=b??S,w=b?[S,...v.filter(k=>k!==b)]:v;l=[{label:y.label,tooltip:y.tooltip,data:y.data,moreActions:w.length>0?w:void 0},{label:d(7263,null),tooltip:f,data:()=>{this.confirmWith(n,{type:5})},isSecondary:!0}]}let c=this.createContentElement(),u=o.getTool(n.toolId),p=this._register(this.instantiationService.createInstance(Gee,this.context,{title:this.getTitle(),icon:u?.icon&&"id"in u.icon?u.icon:M.tools,subtitle:e.subtitle,buttons:l,message:c,toolbarData:{arg:n,partType:e.partType,partSource:n.source.type}})),h=ie.Editing.hasToolConfirmation.bindTo(this.contextKeyService);h.set(!0),this._register(p.onDidClick(g=>{g.data(),this.chatWidgetService.getWidgetBySessionResource(this.context.element.sessionResource)?.focusInput()})),this._register(Z(()=>h.reset())),this.domNode=p.domNode}confirmWith(e,t){lo.confirmWith(e,t)}additionalPrimaryActions(){return[]}};ete=I([m(2,F),m(3,_e),m(4,X),m(5,At),m(6,jn)],ete);var z9o=45,$me=class extends ete{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){let w=e.state.get();if(w.type!==lo.StateKind.WaitingForConfirmation||!w.confirmationMessages?.title)throw new Error("Confirmation messages are missing");super(e,t,c,u,h,g,b);this.renderer=o;this.editorPool=n;this.currentWidthDelegate=r;this.codeBlockModelCollection=s;this.codeBlockStartIndex=l;this.languageService=p;this.commandService=f;this.markerService=v;this.chatMarkdownAnchorService=S;this.confirmationService=y;this.markdownParts=[];this.render({allowActionId:D3,skipActionId:ctt,allowLabel:w.confirmationMessages.confirmResults?d(7306,null):d(7305,null),skipLabel:d(7311,null),partType:"chatToolConfirmation",subtitle:typeof e.originMessage=="string"?e.originMessage:e.originMessage?.value})}get codeblocks(){return this.markdownParts.flatMap(e=>e.codeblocks)}additionalPrimaryActions(){let e=super.additionalPrimaryActions(),t=this.toolInvocation.state.get();if(t.type!==lo.StateKind.WaitingForConfirmation)return e;if(t.confirmationMessages?.allowAutoConfirm!==!1){let o=this.confirmationService.getPreConfirmActions({toolId:this.toolInvocation.toolId,source:this.toolInvocation.source,parameters:t.parameters,chatSessionResource:this.context.element.sessionResource});for(let n of o)n.divider&&e.push(new li),e.push({label:n.label,tooltip:n.detail,scope:n.scope,data:async()=>{await n.select()&&this.confirmWith(this.toolInvocation,{type:4})}})}return t.confirmationMessages?.confirmResults&&e.unshift({label:d(7307,null),data:()=>{t.confirmationMessages.confirmResults=void 0,this.confirmWith(this.toolInvocation,{type:4})}},new li),e}createContentElement(){let e=this.toolInvocation.state.get();if(e.type!==lo.StateKind.WaitingForConfirmation)return"";let{message:t,disclaimer:o}=e.confirmationMessages,n=this.toolInvocation;if(typeof t=="string"&&!o)return t;{let r={hideToolbar:!0,reserveWidth:19,verticalPadding:5,editorOptions:{tabFocusMode:!0,ariaLabel:this.getTitle()}},s=bt("div",[bt(".message@messageContainer",[bt(".message-wrapper@message"),bt(".see-more@showMore",[bt("a",[d(7310,null)])])]),bt(".editor@editor"),bt(".disclaimer@disclaimer")]);if(n.toolSpecificData?.kind==="input"&&n.toolSpecificData.rawInput&&!mf(n.toolSpecificData.rawInput)){let p=document.createElement("h3");p.textContent=d(7308,null),s.editor.appendChild(p);let h=n.toolSpecificData,g={hideToolbar:!0,reserveWidth:19,maxHeightInLines:13,verticalPadding:5,editorOptions:{wordWrap:"off",readOnly:!1,ariaLabel:this.getTitle()}},f=this.languageService.getLanguageIdByLanguageName("json"),v=JSON.stringify(h.rawInput??{},null,1),b=IM(v,`
`)>2,y=this._register(this.context.inlineTextModels.acquire(RYi(n.toolCallId),v.replace(/\n */g," "),this.languageService.createById(f),!0)).object,w=_t(),k=q8e(n.toolId),T=new Dt(async()=>{let O=[],V=await this.commandService.executeCommand("json.validate",k,y.getValue());for(let U of V??[])U.range&&U.message&&O.push({severity:U.severity==="Error"?8:4,message:U.message,startLineNumber:U.range[0].line+1,startColumn:U.range[0].character+1,endLineNumber:U.range[1].line+1,endColumn:U.range[1].character+1,code:U.code?String(U.code):void 0});this.markerService.changeOne(w,y.uri,O)},500);T.schedule(),this._register(y.onDidChangeContent(()=>T.schedule())),this._register(Z(()=>this.markerService.remove(w,[y.uri]))),this._register(T);let N=this._register(this.editorPool.get());if(N.object.render({codeBlockIndex:this.codeBlockStartIndex,codeBlockPartIndex:0,element:this.context.element,languageId:f??"json",renderOptions:g,textModel:Promise.resolve(y),chatSessionResource:this.context.element.sessionResource},this.currentWidthDelegate()),this.codeblocks.push({codeBlockIndex:this.codeBlockStartIndex,codemapperUri:void 0,elementId:this.context.element.id,focus:()=>N.object.focus(),ownerMarkdownPartId:this.codeblocksPartId,uri:y.uri,uriPromise:Promise.resolve(y.uri),chatSessionResource:this.context.element.sessionResource}),this._register(y.onDidChangeContent(O=>{try{h.rawInput=JSON.parse(y.getValue())}catch{}})),s.editor.append(N.object.element),b){let O=bt("div.see-more",[bt("a@link")]);O.link.textContent=d(7309,null),this._register(C$(O.link,()=>{try{let V=JSON.parse(y.getValue());y.setValue(JSON.stringify(V,null,2)),N.object.editor.updateOptions({tabFocusMode:!1}),N.object.editor.updateOptions({wordWrap:"on"})}catch{}O.root.remove()})),s.editor.append(O.root)}}let l=this._makeMarkdownPart(s.message,t,r),c=this._register(new t9(l.domNode,void 0)),u=()=>{let p=c.getHeight()>z9o;s.messageContainer.classList.contains("can-see-more")!==p&&s.messageContainer.classList.toggle("can-see-more",p)};return this._register(j(s.showMore,"click",()=>{s.messageContainer.classList.toggle("can-see-more",!1),c.dispose()})),this._register(c.onDidChange(u)),c.startObserving(),o?this._makeMarkdownPart(s.disclaimer,o,r):s.disclaimer.remove(),s.root}}getTitle(){let e=this.toolInvocation.state.get();if(e.type!==lo.StateKind.WaitingForConfirmation)return"";let t=e.confirmationMessages?.title;return t?typeof t=="string"?t:t.value:""}_makeMarkdownPart(e,t,o){let n=this._register(this.instantiationService.createInstance(lT,{kind:"markdownContent",content:typeof t=="string"?new xe().appendMarkdown(t):t},this.context,this.editorPool,!1,this.codeBlockStartIndex,this.renderer,void 0,this.currentWidthDelegate(),this.codeBlockModelCollection,{codeBlockRenderOptions:o}));return Ck(n.domNode,this.instantiationService,this.chatMarkdownAnchorService,this._store),e.append(n.domNode),n}};$me=I([m(7,F),m(8,_e),m(9,kt),m(10,X),m(11,At),m(12,ge),m(13,Ns),m(14,jn),m(15,Av),m(16,gD)],$me);var Cki=ae("IChatToolOutputStateCache"),smo="chat/toolOutputStateCache",K9o=100,Itt=class{constructor(i){this._cache=new il(K9o,.75);let e=i.get(smo,1,"{}");this._deserialize(e);let t=H.filter(i.onWillSaveState,o=>o.reason===1);H.once(t)(()=>{i.store(smo,this._serialize(),1,1)})}get(i){return this._cache.get(i)}set(i,e){this._cache.set(i,e)}_serialize(){let i=Object.create(null);for(let[e,t]of this._cache)i[e]=t;return JSON.stringify(i)}_deserialize(i){try{let e=JSON.parse(i);for(let t in e){let o=e[t];typeof o.webviewOrigin=="string"&&typeof o.height=="number"&&this._cache.set(t,o)}}catch{}}};Itt=I([m(0,le)],Itt);we(Cki,Itt,1);var fAe=class extends Nv{constructor(e,t,o,n,r,s,l){super(e);this.context=t;this.onDidRemount=o;this.chatOutputItemRendererService=n;this.chatWidgetService=r;this.instantiationService=s;this.stateCache=l;this.codeblocks=[];this._disposeCts=this._register(new $e);let c=e.kind==="toolInvocation"?lo.resultDetails(e):{output:{type:"data",mimeType:e.resultDetails.output.mimeType,value:Sl(e.resultDetails.output.base64Data)}};if(this.domNode=_("div.tool-output-part"),e.invocationMessage){let u=_(".output-title");if(this.domNode.appendChild(u),typeof e.invocationMessage=="string")u.textContent=e.invocationMessage;else{let p=this._register(nb(e.invocationMessage));u.appendChild(p.element)}}this.domNode.appendChild(this.createOutputPart(e,c))}dispose(){this._disposeCts.dispose(!0),super.dispose()}createOutputPart(e,t){let o=_("div.webview-output");o.style.maxHeight="80vh";let n=this.stateCache.get(e.toolCallId)??{height:0,webviewOrigin:_t()};this.stateCache.set(e.toolCallId,n),n.height&&(o.style.height=`${n.height}px`),n.webviewOrigin&&(n.webviewOrigin=n.webviewOrigin);let r=_("span");r.textContent=d(7313,null);let s=this._register(this.instantiationService.createInstance(vA,r,q.modify(M.loading,"spin"),void 0));return o.appendChild(s.domNode),this.chatOutputItemRendererService.renderOutputPart(t.output.mimeType,t.output.value.buffer,o,{origin:n.webviewOrigin,webviewState:n.webviewState},this._disposeCts.token).then(l=>{this._disposeCts.token.isCancellationRequested||(this._register(l),s.domNode.remove(),this._register(l.webview.onDidUpdateState(c=>{n.webviewState=c})),this._register(l.onDidChangeHeight(c=>{n.height=c})),this._register(l.webview.onDidWheel(c=>{this.chatWidgetService.getWidgetBySessionResource(this.context.element.sessionResource)?.delegateScrollFromMouseWheelEvent({...c,preventDefault:()=>{},stopPropagation:()=>{}})})),this._register(this.context.onDidChangeVisibility(c=>{c&&l.reinitialize()})),this._register(this.onDidRemount(()=>{l.reinitialize()})))},l=>{if(so(l))return;console.error("Error rendering tool output:",l);let c=_(".output-error"),u=_(".output-error-header");R(c,u);let p=_("div");p.classList.add(...q.asClassNameArray(M.error)),u.append(p);let h=_(".output-error-title");h.textContent=d(7312,null),u.append(h);let g=_(".output-error-details");g.textContent=l?.message||String(l),c.append(g),s.domNode.replaceWith(c)}),o}};fAe=I([m(3,UEe),m(4,At),m(5,F),m(6,Cki)],fAe);var qme=class extends ete{constructor(e,t,o,n,r,s,l,c){super(e,t,o,n,r,s,l);this.confirmationService=c;this._codeblocks=[];let u=e.pastTenseMessage||e.invocationMessage;this.render({allowActionId:Ppo,skipActionId:Apo,allowLabel:d(7319,null),skipLabel:d(7323,null),partType:"chatToolPostConfirmation",subtitle:typeof u=="string"?u:u?.value})}get codeblocks(){return this._codeblocks}createContentElement(){if(this.toolInvocation.kind!=="toolInvocation")throw new Error("post-approval not supported for serialized data");let e=this.toolInvocation.state.get();if(e.type!==lo.StateKind.WaitingForPostApproval)throw new Error("Tool invocation is not waiting for post-approval");return this.createResultsDisplay(this.toolInvocation,e.contentForModel)}getTitle(){return d(7320,null)}additionalPrimaryActions(){let e=super.additionalPrimaryActions(),t=this.toolInvocation.state.get();if(t.type!==lo.StateKind.WaitingForPostApproval)return e;let o=this.confirmationService.getPostConfirmActions({toolId:this.toolInvocation.toolId,source:this.toolInvocation.source,parameters:t.parameters});for(let n of o)n.divider&&e.push(new li),e.push({label:n.label,tooltip:n.detail,scope:n.scope,data:async()=>{await n.select()&&this.confirmWith(this.toolInvocation,{type:4})}});return e}createResultsDisplay(e,t){let o=_(".tool-postconfirm-display");if(!t||t.length===0)return o.textContent=d(7322,null),o;let n=[];for(let[r,s]of t.entries())if(s.kind==="text")n.push({kind:"code",title:s.title,data:s.value,languageId:"plaintext",codeBlockIndex:r,ownerMarkdownPartId:this.codeblocksPartId,options:{hideToolbar:!0,reserveWidth:19,maxHeightInLines:13,verticalPadding:5,editorOptions:{wordWrap:"on",readOnly:!0}}});else if(s.kind==="promptTsx"){let l=$8e(s);n.push({kind:"code",data:l,languageId:"json",codeBlockIndex:r,ownerMarkdownPartId:this.codeblocksPartId,options:{hideToolbar:!0,reserveWidth:19,maxHeightInLines:13,verticalPadding:5,editorOptions:{wordWrap:"on",readOnly:!0}}})}else if(s.kind==="data"){let l=s.value.mimeType,c=s.value.data;if(l?.startsWith("image/")){let u=K6(l)?`image${K6(l)}`:"image.bin",p=wB.createUri(this.context.element.sessionResource,e.toolCallId,r,u);n.push({kind:"data",value:c.buffer,mimeType:l,uri:p,audience:s.audience})}else{let u=new TextDecoder("utf-8",{fatal:!0});try{let p=u.decode(c.buffer);n.push({kind:"code",data:p,languageId:"plaintext",codeBlockIndex:r,ownerMarkdownPartId:this.codeblocksPartId,options:{hideToolbar:!0,reserveWidth:19,maxHeightInLines:13,verticalPadding:5,editorOptions:{wordWrap:"on",readOnly:!0}}})}catch{let p=c.toString();n.push({kind:"code",data:p,languageId:"plaintext",codeBlockIndex:r,ownerMarkdownPartId:this.codeblocksPartId,options:{hideToolbar:!0,reserveWidth:19,maxHeightInLines:13,verticalPadding:5,editorOptions:{wordWrap:"on",readOnly:!0}}})}}}if(n.length>0){let r=this._register(this.instantiationService.createInstance(L3,this.context,n));return this._codeblocks.push(...r.codeblocks),r.domNode.classList.add("tool-postconfirm-display"),r.domNode}return o.textContent=d(7321,null),o}};qme=I([m(2,F),m(3,_e),m(4,X),m(5,At),m(6,jn),m(7,gD)],qme);var vAe=class extends Nv{constructor(e,t,o,n,r,s){super(e);this.context=t;this.renderer=o;this.announcedToolProgressKeys=n;this.instantiationService=r;this.configurationService=s;this.codeblocks=[];this.domNode=this.createProgressPart();let l=()=>this.domNode.classList.toggle("show-checkmarks",!!this.configurationService.getValue("accessibility.chat.showCheckmarks"));l(),this._register(this.configurationService.onDidChangeConfiguration(c=>{c.affectsConfiguration("accessibility.chat.showCheckmarks")&&l()}))}createProgressPart(){if(lo.isComplete(this.toolInvocation)&&this.toolIsConfirmed&&this.toolInvocation.pastTenseMessage){let t=this.getAnnouncementKey("complete"),o=this.toolInvocation.pastTenseMessage??this.toolInvocation.invocationMessage;if(!this.hasMeaningfulContent(o))return document.createElement("div");let n=this.toolInvocation.kind==="toolInvocation"&&this.hasMeaningfulContent(o)?this.computeShouldAnnounce(t):!1,r=this.renderProgressContent(o,n);return this._register(r),r.domNode}else{let t=document.createElement("div");return this._register(he(o=>{let n,r=this.getAnnouncementKey("progress");if(this.toolInvocation.kind==="toolInvocation"){let c=this.toolInvocation.state.read(o);c.type===lo.StateKind.Cancelled&&c.reasonMessage?n=c.reasonMessage:c.type===lo.StateKind.Executing?n=c.progress.read(o)?.message??this.toolInvocation.invocationMessage:n=this.toolInvocation.invocationMessage}else n=this.toolInvocation.invocationMessage;if(!this.hasMeaningfulContent(n)){Rt(t);return}let s=this.toolInvocation.kind==="toolInvocation"&&this.hasMeaningfulContent(n)?this.computeShouldAnnounce(r):!1,l=o.store.add(this.renderProgressContent(n,s));Fi(t,l.domNode)})),t}}get toolIsConfirmed(){let e=lo.executionConfirmedOrDenied(this.toolInvocation);return!!e&&e.type!==0}renderProgressContent(e,t){typeof e=="string"&&(e=new xe().appendText(e));let o={kind:"progressMessage",content:e};t&&this.provideScreenReaderStatus(e);let n=this.toolInvocation.toolId==="copilot_askQuestions"||this.toolInvocation.toolId==="vscode_askQuestions";return this.instantiationService.createInstance(fD,o,this.renderer,this.context,void 0,!0,this.getIcon(),this.toolInvocation,n?void 0:!1)}getAnnouncementKey(e){return`${e}:${this.toolInvocation.toolCallId}`}computeShouldAnnounce(e){return!this.announcedToolProgressKeys||!this.configurationService.getValue("accessibility.verboseChatProgressUpdates")||this.announcedToolProgressKeys.has(e)?!1:(this.announcedToolProgressKeys.add(e),!0)}provideScreenReaderStatus(e){let t=typeof e=="string"?e:fu(qa(e,{useLinkFormatter:!0}));Or(t)}hasMeaningfulContent(e){return e?(typeof e=="string"?e:e.value).trim().length>0:!1}};vAe=I([m(4,F),m(5,B)],vAe);var bAe=class extends Nv{constructor(e,t,o,n){super(e);this.context=t;this.renderer=o;this.instantiationService=n;this.codeblocks=[];this.domNode=this.createStreamingPart()}createStreamingPart(){let e=document.createElement("div");if(this.toolInvocation.kind!=="toolInvocation")return e;let t=this.toolInvocation;return t.state.get().type!==lo.StateKind.Streaming||this._register(he(n=>{let r=t.state.read(n);if(r.type!==lo.StateKind.Streaming){Rt(e),this._onNeedsRerender.fire();return}let l=r.streamingMessage.read(n)??t.invocationMessage,c=typeof l=="string"?l:l.value;if(!c||c.trim().length===0){Rt(e);return}let p={kind:"progressMessage",content:typeof l=="string"?new xe().appendText(l):l},h=n.store.add(this.instantiationService.createInstance(fD,p,this.renderer,this.context,void 0,!0,this.getIcon(),t,!1));Fi(e,h.domNode)})),e}};bAe=I([m(3,F)],bAe);var tte=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.toolInvocation=e;this.context=t;this.renderer=o;this.listPool=n;this.editorPool=r;this.currentWidthDelegate=s;this.codeBlockModelCollection=l;this.announcedToolProgressKeys=c;this.codeBlockStartIndex=u;this.instantiationService=p;this.chatTodoListService=h;this._onDidRemount=this._register(new E);if(this.domNode=_(".chat-tool-invocation-part"),e.presentation==="hidden")return;if(e.toolSpecificData?.kind==="todoList"){let S=t.element.sessionResource,y=e.toolSpecificData.todoList.map((w,k)=>{let T=parseInt(w.id,10);return{id:Number.isNaN(T)?k+1:T,title:w.title,status:w.status}});this.chatTodoListService.setTodos(S,y)}if(e.kind==="toolInvocation"){let S=e.state.get().type;this._register(he(y=>{e.state.read(y).type!==S&&v()}))}let g=this._register(new P),f=document.createElement("div");this.domNode.appendChild(f);let v=()=>{if(g.clear(),e.presentation==="hiddenAfterComplete"&&lo.isComplete(e)){xo(this.domNode);return}bn(this.domNode),this.subPart=g.add(this.createToolInvocationSubPart()),f.replaceWith(this.subPart.domNode),f=this.subPart.domNode;let S=this.subPart instanceof $me||this.subPart instanceof Kme||this.subPart instanceof Bme||this.subPart instanceof qme;this.domNode.classList.toggle("has-confirmation",S),g.add(this.subPart.onNeedsRerender(v))},b=this.getMcpAppRenderData();if(b){let S=Ce(w=>{let k=lo.executionConfirmedOrDenied(e,w);return!!k&&k.type!==0&&k.type!==5}),y=document.createElement("div");this.domNode.appendChild(y),this._register(he(w=>{S.read(w)?(this.mcpAppPart=w.store.add(this.instantiationService.createInstance(cAe,this.toolInvocation,this._onDidRemount.event,t,b)),y.replaceWith(this.mcpAppPart.domNode),y=this.mcpAppPart.domNode):(this.mcpAppPart=void 0,Rt(y))}))}v()}get codeblocks(){let e=this.subPart?.codeblocks??[];return this.mcpAppPart&&e.push(...this.mcpAppPart.codeblocks),e}get codeblocksPartId(){return this.subPart?.codeblocksPartId}createToolInvocationSubPart(){if(this.toolInvocation.kind==="toolInvocation"){if(this.toolInvocation.toolSpecificData?.kind==="extensions")return this.instantiationService.createInstance(Bme,this.toolInvocation,this.context);let t=this.toolInvocation.state.get();if(t.type===lo.StateKind.Streaming)return this.instantiationService.createInstance(bAe,this.toolInvocation,this.context,this.renderer);if(t.type===lo.StateKind.WaitingForConfirmation)return this.toolInvocation.toolSpecificData?.kind==="terminal"?this.instantiationService.createInstance(Kme,this.toolInvocation,this.toolInvocation.toolSpecificData,this.context,this.renderer,this.editorPool,this.currentWidthDelegate,this.codeBlockModelCollection,this.codeBlockStartIndex):this.instantiationService.createInstance($me,this.toolInvocation,this.context,this.renderer,this.editorPool,this.currentWidthDelegate,this.codeBlockModelCollection,this.codeBlockStartIndex);if(t.type===lo.StateKind.WaitingForPostApproval)return this.instantiationService.createInstance(qme,this.toolInvocation,this.context)}if(this.toolInvocation.toolSpecificData?.kind==="terminal")return this.instantiationService.createInstance(gAe,this.toolInvocation,this.toolInvocation.toolSpecificData,this.context,this.renderer,this.editorPool,this.currentWidthDelegate,this.codeBlockStartIndex,this.codeBlockModelCollection);if(this.toolInvocation.toolSpecificData?.kind==="resources"&&this.toolInvocation.toolSpecificData.values.length>0)return this.instantiationService.createInstance(zme,this.toolInvocation,this.context,this.toolInvocation.pastTenseMessage??this.toolInvocation.invocationMessage,this.toolInvocation.toolSpecificData.values,this.listPool);if(this.toolInvocation.toolSpecificData?.kind==="simpleToolInvocation")return this.instantiationService.createInstance(M3,this.toolInvocation,this.context,this.codeBlockStartIndex,this.toolInvocation.pastTenseMessage??this.toolInvocation.invocationMessage,this.toolInvocation.originMessage,this.toolInvocation.toolSpecificData,!1);let e=lo.resultDetails(this.toolInvocation);return Array.isArray(e)&&e.length?this.instantiationService.createInstance(zme,this.toolInvocation,this.context,this.toolInvocation.pastTenseMessage??this.toolInvocation.invocationMessage,e,this.listPool):zj(e)?this.instantiationService.createInstance(fAe,this.toolInvocation,this.context,this._onDidRemount.event):mV(e)?this.instantiationService.createInstance(m2,this.toolInvocation,this.context,this.codeBlockStartIndex,this.toolInvocation.pastTenseMessage??this.toolInvocation.invocationMessage,this.toolInvocation.originMessage,e.input,e.output,!!e.isError):this.toolInvocation.kind==="toolInvocation"&&this.toolInvocation.toolSpecificData?.kind==="input"&&!lo.isComplete(this.toolInvocation)?this.instantiationService.createInstance(m2,this.toolInvocation,this.context,this.codeBlockStartIndex,this.toolInvocation.invocationMessage,this.toolInvocation.originMessage,typeof this.toolInvocation.toolSpecificData.rawInput=="string"?this.toolInvocation.toolSpecificData.rawInput:JSON.stringify(this.toolInvocation.toolSpecificData.rawInput,null,2),void 0,!1):this.instantiationService.createInstance(vAe,this.toolInvocation,this.context,this.renderer,this.announcedToolProgressKeys)}getMcpAppRenderData(){let e=this.toolInvocation.toolSpecificData;if(e?.kind==="input"&&e.mcpAppData){let t=typeof e.rawInput=="string"?e.rawInput:JSON.stringify(e.rawInput,null,2);return{resourceUri:e.mcpAppData.resourceUri,serverDefinitionId:e.mcpAppData.serverDefinitionId,collectionId:e.mcpAppData.collectionId,input:t,sessionResource:this.context.element.sessionResource}}}onDidRemount(){this._onDidRemount.fire()}hasSameContent(e,t,o){return(e.kind==="toolInvocation"||e.kind==="toolInvocationSerialized")&&this.toolInvocation.toolCallId===e.toolCallId}addDisposable(e){this._register(e)}};tte=I([m(9,F),m(10,dF)],tte);var QHt=100,KR=class extends cT{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){let{description:v,agentName:b,prompt:S,modelName:y}=KR.extractSubagentInfo(t),k=`${b||d(7190,null)}: ${v}`;super(k,o,void 0,g,f);this.subAgentInvocationId=e;this.context=o;this.chatContentMarkdownRenderer=n;this.listPool=r;this.editorPool=s;this.currentWidthDelegate=l;this.codeBlockModelCollection=c;this.announcedToolProgressKeys=u;this.instantiationService=p;this.chatMarkdownAnchorService=h;this.isActive=!0;this.hasToolItems=!1;this.lazyItems=[];this.hasExpandedOnce=!1;this.pendingPromptRender=!1;this._hoverDisposable=this._register(new me);this.toolsWaitingForConfirmation=0;this.userManuallyExpanded=!1;this.autoExpandedForConfirmation=!1;this.description=v,this.agentName=b,this.prompt=S,this.modelName=y,this.isInitiallyComplete=this.element.isComplete;let T=this.domNode;if(T.classList.add("chat-thinking-box","chat-thinking-fixed-mode","chat-subagent-part"),this.element.isComplete||T.classList.add("chat-thinking-active"),!this.element.isComplete&&this._collapseButton){let N=this._collapseButton.labelElement;N.textContent="",this.titleShimmerSpan=_("span.chat-thinking-title-shimmer"),this.titleShimmerSpan.textContent=k,N.appendChild(this.titleShimmerSpan)}this._collapseButton&&!this.element.isComplete&&(this._collapseButton.icon=M.circleFilled),this._register(he(N=>{this.expanded.read(N),this._collapseButton&&(!this.element.isComplete&&this.isActive?this._collapseButton.icon=M.circleFilled:this._collapseButton.icon=M.check)})),this._register(he(N=>{this._isExpanded.read(N)&&!this.hasExpandedOnce&&(this.hasExpandedOnce=!0,this.materializePendingContent())})),this.setExpanded(!1),this._register(he(N=>{this._isExpanded.read(N)?this.autoExpandedForConfirmation||(this.userManuallyExpanded=!0):(this.autoExpandedForConfirmation&&(this.autoExpandedForConfirmation=!1),this.userManuallyExpanded&&(this.userManuallyExpanded=!1))})),this.layoutScheduler=this._register(new jpt(this.domNode,()=>this.performLayout())),this.updateHover(),this.renderPromptSection(),this.watchToolCompletion(t)}static isParentSubagentTool(e){return e.toolSpecificData?.kind==="subagent"&&!e.subAgentInvocationId}static extractSubagentInfo(e){let t=d(7188,null);if(!KR.isParentSubagentTool(e))return{description:t,agentName:void 0,prompt:void 0,modelName:void 0};if(e.toolSpecificData?.kind==="subagent")return{description:e.toolSpecificData.description??t,agentName:e.toolSpecificData.agentName,prompt:e.toolSpecificData.prompt,modelName:e.toolSpecificData.modelName};if(e.kind==="toolInvocation"){let o=e.state.get(),n=o.type!==lo.StateKind.Streaming?o.parameters:void 0;return{description:n?.description??t,agentName:n?.agentName,prompt:n?.prompt,modelName:void 0}}return{description:t,agentName:void 0,prompt:void 0,modelName:void 0}}initContent(){this.wrapper=_(".chat-used-context-list.chat-thinking-collapsible"),this.hasToolItems||(this.wrapper.style.display="none"),this.materializePendingContent();let e=this._register(new eL(()=>this.layoutScheduler.schedule()));return this._register(e.observe(this.wrapper)),this.wrapper}renderPromptSection(){if(!(!this.prompt||this.promptContainer)){if(!this.wrapper||this.isInitiallyComplete&&!this.isExpanded()&&!this.hasExpandedOnce){this.pendingPromptRender=!0;return}this.pendingPromptRender=!1,this.doRenderPromptSection()}}doRenderPromptSection(){if(!this.prompt||this.promptContainer)return;let e=this.prompt.split(`
`),t=e[0]||d(7191,null),o=e.slice(1).join(`
`).trim(),n=s9t(t,QHt),s=t.length>QHt?n+"\u2026":n,l=t.length>n.length?t.slice(n.length).trim():"",c=l?l+(o?`
`+o:""):o||this.prompt,u=this._register(this.instantiationService.createInstance(Rme,s,c,this.context,this.chatContentMarkdownRenderer));this.promptContainer=_(".chat-thinking-tool-wrapper.chat-subagent-section");let p=_3(M.comment);this.promptContainer.appendChild(p),this.promptContainer.appendChild(u.domNode),this.wrapper&&(this.wrapper.firstChild?this.wrapper.insertBefore(this.promptContainer,this.wrapper.firstChild):R(this.wrapper,this.promptContainer),this.wrapper.style.display==="none"&&(this.wrapper.style.display=""))}getIsActive(){return this.isActive}markAsInactive(){this.isActive=!1,this.domNode.classList.remove("chat-thinking-active"),this._collapseButton&&(this._collapseButton.icon=M.check),this.finalizeTitle(),this.setExpanded(!1)}finalizeTitle(){this.updateTitle(),this._collapseButton&&(this._collapseButton.icon=M.check)}updateTitle(){let e=this.agentName||d(7190,null),t=`${e}: ${this.description}`,o=this.currentRunningToolMessage&&this.isActive?` \u2014 ${this.currentRunningToolMessage}`:"";if(!this._collapseButton)return;let n=this._collapseButton.labelElement;if(!this.isActive){n.textContent="",this.titleShimmerSpan=void 0,this.titleDetailRendered&&(this.titleDetailRendered.dispose(),this.titleDetailRendered=void 0),this.titleDetailContainer=void 0;let s=_("span");s.textContent=`${e}:`,n.appendChild(s);let l=_("span.chat-thinking-title-detail-text");l.textContent=` ${this.description}`,n.appendChild(l),this._collapseButton.element.ariaLabel=t,this._collapseButton.element.ariaExpanded=String(this.isExpanded());return}if((!this.titleShimmerSpan||!this.titleShimmerSpan.parentElement)&&(n.textContent="",this.titleShimmerSpan=_("span.chat-thinking-title-shimmer"),n.appendChild(this.titleShimmerSpan)),this.titleShimmerSpan.textContent=t,this.titleDetailRendered&&(this.titleDetailRendered.dispose(),this.titleDetailRendered=void 0),!o)this.titleDetailContainer&&(this.titleDetailContainer.remove(),this.titleDetailContainer=void 0);else{let s=this.chatContentMarkdownRenderer.render(new xe(o));s.element.classList.add("collapsible-title-content","chat-thinking-title-detail"),Ck(s.element,this.instantiationService,this.chatMarkdownAnchorService,this._store),this.titleDetailRendered=s,this.titleDetailContainer?this.titleDetailContainer.replaceWith(s.element):n.appendChild(s.element),this.titleDetailContainer=s.element}let r=`${t}${o}`;this._collapseButton.element.ariaLabel=r,this._collapseButton.element.ariaExpanded=String(this.isExpanded())}updateHover(){!this.modelName||!this._collapseButton||(this._hoverDisposable.value=this.hoverService.setupDelayedHover(this._collapseButton.element,{content:d(7189,null,this.modelName)}))}trackToolState(e){if(e.kind!=="toolInvocation")return;let t=e.invocationMessage,o=typeof t=="string"?t:t.value;this.currentRunningToolMessage=o,this.updateTitle();let n=!1;this._register(he(r=>{let s=e.state.read(r),l=s.type===lo.StateKind.WaitingForConfirmation||s.type===lo.StateKind.WaitingForPostApproval;l&&!n?(this.toolsWaitingForConfirmation++,this.isExpanded()||(this.autoExpandedForConfirmation=!0,this.setExpanded(!0))):!l&&n&&(this.toolsWaitingForConfirmation--,this.toolsWaitingForConfirmation===0&&this.autoExpandedForConfirmation&&!this.userManuallyExpanded&&(this.autoExpandedForConfirmation=!1,this.setExpanded(!1))),n=l}))}watchToolCompletion(e){if(KR.isParentSubagentTool(e))if(e.kind==="toolInvocation"){let t=e.state.get().type===lo.StateKind.Streaming;this._register(he(o=>{let n=e.state.read(o);if(n.type===lo.StateKind.Completed){t=!1;let r=(n.contentForModel||[]).filter(s=>s.kind==="text").map(s=>s.value);r.length>0&&this.renderResultText(r.join(`
`)),e.toolSpecificData?.kind==="subagent"&&e.toolSpecificData.modelName&&(this.modelName=e.toolSpecificData.modelName,this.updateHover()),this.markAsInactive()}else if(t&&n.type!==lo.StateKind.Streaming){t=!1;let{description:r,agentName:s,prompt:l,modelName:c}=KR.extractSubagentInfo(e);this.description=r,this.agentName=s,this.prompt=l,c&&(this.modelName=c,this.updateHover()),this.renderPromptSection(),this.updateTitle()}}))}else e.toolSpecificData?.kind==="subagent"&&e.toolSpecificData.result&&(this.renderResultText(e.toolSpecificData.result),this.markAsInactive())}renderResultText(e){if(!(this.resultContainer||!e)){if(!this.wrapper||this.isInitiallyComplete&&!this.isExpanded()&&!this.hasExpandedOnce){this.pendingResultText=e;return}this.pendingResultText=void 0,this.doRenderResultText(e)}}doRenderResultText(e){if(this.resultContainer||!e)return;let t=e.split(`
`),o=t[0]||"",n=t.slice(1).join(`
`).trim(),r=s9t(o,QHt),l=o.length>QHt?r+"\u2026":r,c=o.length>r.length?o.slice(r.length).trim():"",u=c?c+(n?`
`+n:""):n,p=this._register(this.instantiationService.createInstance(Rme,l,u,this.context,this.chatContentMarkdownRenderer));this.resultContainer=_(".chat-thinking-tool-wrapper.chat-subagent-section");let h=_3(M.check);this.resultContainer.appendChild(h),this.resultContainer.appendChild(p.domNode),this.wrapper&&(R(this.wrapper,this.resultContainer),this.wrapper.style.display==="none"&&(this.wrapper.style.display=""))}appendToolInvocation(e,t){if(this.hasToolItems||(this.hasToolItems=!0,this.wrapper&&(this.wrapper.style.display="")),this.trackToolState(e),this.isExpanded()||this.hasExpandedOnce){let o=this.createToolPart(e,t);this.appendToolPartToDOM(o,e)}else{let o={kind:"tool",lazy:new co(()=>this.createToolPart(e,t)),toolInvocation:e,codeBlockStartIndex:t};this.lazyItems.push(o)}}appendMarkdownItem(e,t,o,n){if(this.isExpanded()||this.hasExpandedOnce){let r=e();this.appendMarkdownItemToDOM(r.domNode),r.disposable&&this._register(r.disposable)}else{let r={kind:"markdown",lazy:new co(e)};this.lazyItems.push(r)}}appendHookItem(e,t){let o=t.stopReason?t.toolDisplayName?d(7192,null,t.toolDisplayName):d(7193,null):t.toolDisplayName?d(7194,null,t.toolDisplayName):d(7195,null);if(this.currentRunningToolMessage=o,this.updateTitle(),this.isExpanded()||this.hasExpandedOnce){let n=e();this.appendHookItemToDOM(n.domNode,t),n.disposable&&this._register(n.disposable)}else{let n={kind:"hook",lazy:new co(e),hookPart:t};this.lazyItems.push(n)}}appendHookItemToDOM(e,t){let o=_(".chat-thinking-tool-wrapper"),n=t.stopReason?M.error:M.warning,r=_3(n);o.appendChild(r),o.appendChild(e),this.hasToolItems||(this.hasToolItems=!0,this.wrapper&&(this.wrapper.style.display="")),this.wrapper&&(this.resultContainer?this.wrapper.insertBefore(o,this.resultContainer):this.wrapper.appendChild(o)),this.lastItemWrapper=o,this.layoutScheduler.schedule()}appendMarkdownItemToDOM(e){if(!e.hasChildNodes()||e.textContent?.trim()==="")return;let t=_(".chat-thinking-tool-wrapper"),o=_3(M.edit);t.appendChild(e),t.insertBefore(o,t.firstChild),this.wrapper&&(this.resultContainer?this.wrapper.insertBefore(t,this.resultContainer):this.wrapper.appendChild(t)),this.lastItemWrapper=t,this.layoutScheduler.schedule()}shouldInitEarly(){return!1}createToolPart(e,t){let o=this.instantiationService.createInstance(tte,e,this.context,this.chatContentMarkdownRenderer,this.listPool,this.editorPool,this.currentWidthDelegate,this.codeBlockModelCollection,this.announcedToolProgressKeys,t);return this._register(o),o}appendToolPartToDOM(e,t){let o=e.domNode;if(!o.hasChildNodes()||o.textContent?.trim()==="")return;let n=_(".chat-thinking-tool-wrapper"),r=Gxi(t.toolId),s=_3(r);n.appendChild(o),t.kind==="toolInvocation"?this._register(he(l=>{let c=t.state.read(l);c.type===lo.StateKind.WaitingForConfirmation||c.type===lo.StateKind.WaitingForPostApproval?s.remove():s.parentElement||n.insertBefore(s,n.firstChild)})):n.insertBefore(s,n.firstChild),this.wrapper&&(this.resultContainer?this.wrapper.insertBefore(n,this.resultContainer):this.wrapper.appendChild(n)),this.lastItemWrapper=n,this.layoutScheduler.schedule()}materializeLazyItem(e){if(!e.lazy.hasValue){if(e.kind==="tool"){let t=e.lazy.value;this.appendToolPartToDOM(t,e.toolInvocation)}else if(e.kind==="markdown"){let t=e.lazy.value;this.appendMarkdownItemToDOM(t.domNode),t.disposable&&this._register(t.disposable)}else if(e.kind==="hook"){let t=e.lazy.value;this.appendHookItemToDOM(t.domNode,e.hookPart),t.disposable&&this._register(t.disposable)}}}materializePendingContent(){if(this.wrapper){this.pendingPromptRender&&(this.pendingPromptRender=!1,this.doRenderPromptSection());for(let e of this.lazyItems)this.materializeLazyItem(e);if(this.pendingResultText){let e=this.pendingResultText;this.pendingResultText=void 0,this.doRenderResultText(e)}}}performLayout(){if(this.lastItemWrapper&&this.wrapper){let e=this.lastItemWrapper.offsetHeight;e>0&&this.wrapper.style.setProperty("--chat-subagent-last-item-height",`${e}px`)}if(this.isActive&&!this.isInitiallyComplete&&this.wrapper){let e=this.wrapper.scrollHeight;this.wrapper.scrollTop=e}}hasSameContent(e,t,o){if(e.kind==="markdownContent")return!0;if(e.kind==="hook"&&e.subAgentInvocationId)return this.subAgentInvocationId===e.subAgentInvocationId;if((e.kind==="toolInvocation"||e.kind==="toolInvocationSerialized")&&(e.subAgentInvocationId||KR.isParentSubagentTool(e))){let n=e.subAgentInvocationId??e.toolCallId;return this.subAgentInvocationId&&n?this.subAgentInvocationId===n:!this.subAgentInvocationId&&!n}return!1}};KR=I([m(9,F),m(10,Av),m(11,tt),m(12,B)],KR);var G9o=_,ite=class extends C{constructor(e,t,o){super();this.openerService=o;let n=this._register(t.get());this.tree=n.object,this.onDidFocus=this.tree.onDidFocus,this._register(this.tree.onDidOpen(r=>{r.element&&!("children"in r.element)&&this.openerService.open(r.element.uri)})),this._register(this.tree.onContextMenu(r=>{r.browserEvent.preventDefault(),r.browserEvent.stopPropagation()})),this.tree.setInput(e).then(()=>{n.isStale()||this.tree.layout()}),this.domNode=this.tree.getHTMLElement().parentElement}domFocus(){this.tree.domFocus()}hasSameContent(e){return e.kind==="treeData"}addDisposable(e){this._register(e)}};ite=I([m(2,Qe)],ite);var SAe=class extends C{constructor(e,t,o,n){super();this._onDidChangeVisibility=e;this.instantiationService=t;this.configService=o;this.themeService=n;this._pool=this._register(new LB(()=>this.treeFactory()))}get inUse(){return this._pool.inUse}treeFactory(){let e=new P,t=e.add(this.instantiationService.createInstance(Za,{onDidChangeVisibility:this._onDidChangeVisibility})),o=G9o(".interactive-response-progress-tree");return e.add(DB(o,this.themeService)),{tree:this.instantiationService.createInstance(qI,"ChatListRenderer",o,new xki,new kki,[new Eki(t,this.configService.getValue("explorer.decorations"))],new Tki,{collapseByDefault:()=>!1,expandOnlyOnTwistieClick:()=>!1,identityProvider:{getId:r=>r.uri.toString()},accessibilityProvider:{getAriaLabel:r=>r.label,getWidgetAriaLabel:()=>d(7245,null)},alwaysConsumeMouseWheel:!1}),dispose:()=>e.dispose()}}get(){let e=this._pool.get(),t=!1;return{object:e.tree,isStale:()=>t,dispose:()=>{t=!0,this._pool.release(e)}}}clear(){this._pool.clear()}};SAe=I([m(1,F),m(2,B),m(3,De)],SAe);var xki=class a{static{this.ITEM_HEIGHT=22}getHeight(i){return a.ITEM_HEIGHT}getTemplateId(i){return"chatListTreeTemplate"}},kki=class{isIncompressible(i){return!i.children}},Eki=class{constructor(i,e){this.labels=i;this.decorations=e;this.templateId="chatListTreeTemplate"}renderCompressedElements(i,e,t){t.label.element.style.display="flex";let o=i.element.elements.map(n=>n.label);t.label.setResource({resource:i.element.elements[0].uri,name:o},{title:i.element.elements[0].label,fileKind:i.children?1:0,extraClasses:["explorer-item"],fileDecorations:this.decorations})}renderTemplate(i){let e=new P,t=e.add(this.labels.create(i,{supportHighlights:!0}));return{templateDisposables:e,label:t}}renderElement(i,e,t){t.label.element.style.display="flex",!i.children.length&&i.element.type!==2?t.label.setFile(i.element.uri,{fileKind:0,hidePath:!0,fileDecorations:this.decorations}):t.label.setResource({resource:i.element.uri,name:i.element.label},{title:i.element.label,fileKind:1,fileDecorations:this.decorations})}disposeTemplate(i){i.templateDisposables.dispose()}},Tki=class{hasChildren(i){return!!i.children}async getChildren(i){return i.children??[]}};var IAe=class extends C{constructor(e,t,o,n,r,s){super();this.workspaceEdit=e;this.instantiationService=n;this.chatMarkdownAnchorService=r;this.labelService=s;this.domNode=_(".chat-workspace-edit-content-part");let l=(c,u)=>{let p=this._register(o.render(new xe(c,{isTrusted:!0})));p.element.classList.add("progress-step"),Ck(p.element,this.instantiationService,this.chatMarkdownAnchorService,this._store);let h=this._register(this.instantiationService.createInstance(vA,p.element,u,void 0));R(this.domNode,h.domNode)};for(let c of e.edits)c.oldResource&&!c.newResource?l(d(7247,null,this.labelService.getUriBasenameLabel(c.oldResource)),M.trash):!c.oldResource&&c.newResource?l(d(7246,null,c.newResource.toString()),M.newFile):c.oldResource&&c.newResource&&l(d(7248,null,this.labelService.getUriBasenameLabel(c.oldResource),c.newResource.toString()),M.arrowRight)}hasSameContent(e,t,o){if(e.kind!=="workspaceEdit"||e.edits.length!==this.workspaceEdit.edits.length)return!1;for(let n=0;n<e.edits.length;n++){let r=e.edits[n],s=this.workspaceEdit.edits[n];if(r.oldResource?.toString()!==s.oldResource?.toString()||r.newResource?.toString()!==s.newResource?.toString())return!1}return!0}};IAe=I([m(3,F),m(4,Av),m(5,ot)],IAe);function $9o(a){return CC[a]?.label??a}var ote=class extends cT{constructor(e,t,o,n){let r=$9o(e.hookType),s=!!e.stopReason,l=!!e.systemMessage,c=e.toolDisplayName,u=s?c?d(7112,null,c,r):d(7111,null,r):c?d(7114,null,c,r):d(7113,null,r);super(u,t,void 0,o,n);this.hookPart=e;this.icon=s?M.error:l?M.warning:M.check,s?this.domNode.classList.add("chat-hook-outcome-blocked"):l&&this.domNode.classList.add("chat-hook-outcome-warning"),this.setExpanded(!1)}initContent(){let e=_(".chat-hook-details.chat-used-context-list");if(this.hookPart.stopReason){let o=_(".chat-hook-reason",void 0,this.hookPart.stopReason);e.appendChild(o)}let t=this.hookPart.hookType==="PreToolUse"||this.hookPart.hookType==="PostToolUse";if(this.hookPart.systemMessage&&(t||!this.hookPart.stopReason)){let o=_(".chat-hook-message",void 0,this.hookPart.systemMessage);e.appendChild(o)}return e}hasSameContent(e,t,o){return e.kind!=="hook"?!1:e.hookType===this.hookPart.hookType&&e.stopReason===this.hookPart.stopReason&&e.systemMessage===this.hookPart.systemMessage&&e.toolDisplayName===this.hookPart.toolDisplayName}};ote=I([m(2,tt),m(3,B)],ote);var yAe=class extends C{constructor(e,t,o,n,r){super();this.configService=e;this.dialogService=t;this.logService=o;this.storageService=n;this.languageModelsService=r;this._register(H.runAndSubscribe(this.configService.onDidChangeConfiguration,s=>{(!s||s.affectsConfiguration("chat.autoReply"))&&this.configService.getValue("chat.autoReply")!==!0&&this.storageService.remove("chat.autoReply.optIn",-1)}))}async shouldAutoReply(){return this.configService.getValue("chat.autoReply")?this.checkOptIn():!1}async autoReply(e,t,o,n,r){if(r.isCancellationRequested||e.isUsed||e.questions.length===0)return;let s=this.buildFallbackCarouselAnswers(e,n),l=s,c=await this.getModelId(o);if(c&&!r.isCancellationRequested)try{let u=await this.requestAnswers(c,e,n,r);u.size>0&&(l=this.mergeAnswers(e,u,s))}catch(u){this.logService.debug("#ChatQuestionCarousel: Failed to resolve auto reply",In(u))}r.isCancellationRequested||e.isUsed||await t(l)}async checkOptIn(){return this.storageService.getBoolean("chat.autoReply.optIn",-1,!1)?!0:(await this.dialogService.prompt({type:gt.Warning,message:d(7366,null),buttons:[{label:d(7364,null),run:()=>!0},{label:d(7363,null),run:()=>!1}],custom:{icon:M.warning,disableCloseAction:!0,markdownDetails:[{markdown:new xe(d(7365,null))}]}})).result!==!0?(await this.configService.updateValue("chat.autoReply",!1),!1):(this.storageService.store("chat.autoReply.optIn",!0,-1,0),!0)}async getModelId(e){if(!e)return;let t=await this.languageModelsService.selectLanguageModels({id:e});if(t.length>0)return t[0];if(e.startsWith("copilot/"))return t=await this.languageModelsService.selectLanguageModels({vendor:"copilot",family:e.replace(/^copilot\//,"")}),t[0]}buildPrompt(e,t,o){let n=e.questions.map(s=>({id:s.id,type:s.type,title:s.title,message:typeof s.message=="string"?s.message:s.message?.value,options:s.options?.map(l=>({id:l.id,label:l.label}))??[],allowFreeformInput:s.allowFreeformInput??!1})),r=[];return t&&r.push(`Original user request: ${JSON.stringify(t)}`),["Choose default answers for the following questions.","Return a JSON object keyed by question id.","For text questions, the value should be a string.",'For singleSelect questions, the value should be { "selectedId": string } or { "freeform": string }.','For multiSelect questions, the value should be { "selectedIds": string[] } and may include { "freeform": string }.',"If a question allows freeform input and has no options, return a freeform answer based on the user request when possible.","Use option ids from the provided options.",...r,"Questions:",JSON.stringify(n),o?"Return ONLY valid JSON. Do not include markdown or explanations.":void 0].filter(Boolean).join(`
`)}async requestAnswers(e,t,o,n){let r=this.buildPrompt(t,o,!1),s=await this.languageModelsService.sendChatRequest(e,void 0,[{role:1,content:[{type:"text",value:r}]}],{},n),l=await Tce(s),c=this.parseAnswers(l,t);if(c.size>0||n.isCancellationRequested)return c;let u=this.buildPrompt(t,o,!0),p=await this.languageModelsService.sendChatRequest(e,void 0,[{role:1,content:[{type:"text",value:u}]}],{},n),h=await Tce(p);return this.parseAnswers(h,t)}parseAnswers(e,t){let o=this.tryParseJsonObject(e);if(!o)return new Map;let n=new Map;for(let r of t.questions){let s=o[r.id],l=this.resolveAnswerFromRaw(r,s);l!==void 0&&n.set(r.id,l)}return n}mergeAnswers(e,t,o){let n=new Map;for(let r of e.questions){let s=o.get(r.id);if(this.hasDefaultValue(r)&&s!==void 0){n.set(r.id,s);continue}if(t.has(r.id)){n.set(r.id,t.get(r.id));continue}s!==void 0&&n.set(r.id,s)}return n}hasDefaultValue(e){switch(e.type){case"text":return e.defaultValue!==void 0;case"singleSelect":return typeof e.defaultValue=="string";case"multiSelect":return Array.isArray(e.defaultValue)?e.defaultValue.length>0:typeof e.defaultValue=="string"}}resolveAnswerFromRaw(e,t){switch(e.type){case"text":{if(typeof t=="string"){let o=t.trim();return o.length>0?o:void 0}if(t&&typeof t=="object"&&Wo(t,{value:!0})&&typeof t.value=="string"){let o=t.value.trim();return o.length>0?o:void 0}return}case"singleSelect":{let o,n;if(typeof t=="string"?o=t:t&&typeof t=="object"&&(Wo(t,{selectedId:!0})&&typeof t.selectedId=="string"?o=t.selectedId:Wo(t,{selectedLabel:!0})&&typeof t.selectedLabel=="string"&&(o=t.selectedLabel),Wo(t,{freeform:!0})&&typeof t.freeform=="string"&&(n=t.freeform)),n&&n.trim().length>0)return{selectedValue:void 0,freeformValue:n.trim()};let r=o?this.matchQuestionOption(e,o):void 0;return r?{selectedValue:r.value,freeformValue:void 0}:void 0}case"multiSelect":{let o=[],n;if(Array.isArray(t))o=t.filter(l=>typeof l=="string");else if(typeof t=="string")o=t.split(",").map(l=>l.trim()).filter(l=>l.length>0);else if(t&&typeof t=="object"){if(Wo(t,{selectedIds:!0})){let l=t.selectedIds;Array.isArray(l)&&(o=l.filter(c=>typeof c=="string"))}Wo(t,{freeform:!0})&&typeof t.freeform=="string"&&(n=t.freeform)}let r=o.map(l=>this.matchQuestionOption(e,l)?.value).filter(l=>l!==void 0),s=n?.trim();return r.length>0||s&&s.length>0?{selectedValues:r,freeformValue:s}:void 0}}}matchQuestionOption(e,t){let o=e.options??[];if(!o.length)return;let n=t.trim().toLowerCase(),r=Number.parseInt(n,10);if(!Number.isNaN(r)&&r>0&&r<=o.length){let u=o[r-1];return{id:u.id,value:u.value}}let s=o.find(u=>u.id.toLowerCase()===n);if(s)return{id:s.id,value:s.value};let l=o.find(u=>u.label.toLowerCase()===n);if(l)return{id:l.id,value:l.value};let c=o.find(u=>u.label.toLowerCase().includes(n));if(c)return{id:c.id,value:c.value}}buildFallbackCarouselAnswers(e,t){let o=new Map;for(let n of e.questions){let r=this.getFallbackAnswerForQuestion(n,t);r!==void 0&&o.set(n.id,r)}return o}getFallbackAnswerForQuestion(e,t){let o=t?.trim()||d(7367,null);switch(e.type){case"text":return e.defaultValue??o;case"singleSelect":{let n=typeof e.defaultValue=="string"?e.defaultValue:void 0,r=n?e.options?.find(s=>s.id===n):void 0;return r?{selectedValue:r.value,freeformValue:void 0}:e.options&&e.options.length>0?{selectedValue:e.options[0].value,freeformValue:void 0}:e.allowFreeformInput?{selectedValue:void 0,freeformValue:o}:void 0}case"multiSelect":{let n=Array.isArray(e.defaultValue)?e.defaultValue:typeof e.defaultValue=="string"?[e.defaultValue]:[],r=e.options?.filter(s=>n.includes(s.id)).map(s=>s.value).filter(s=>s!==void 0)??[];return r.length>0?{selectedValues:r,freeformValue:void 0}:e.options&&e.options.length>0?{selectedValues:[e.options[0].value],freeformValue:void 0}:e.allowFreeformInput?{selectedValues:[],freeformValue:o}:void 0}}}tryParseJsonObject(e){let t=e.trim();if(!t)return;let o=t.indexOf("{"),n=t.lastIndexOf("}"),r=o>=0&&n>o?t.slice(o,n+1):t;try{let s=JSON.parse(r);if(s&&typeof s=="object"&&!Array.isArray(s))return s}catch{return}}};yAe=I([m(0,B),m(1,ct),m(2,ne),m(3,le),m(4,Wr)],yAe);var sf=_,amo="GitHub Copilot",q9o=!1,j9o="chat-most-recent-response";function Q9o(a){switch(a){case"confetti":return 1;case"floatingThumbs":return 2;case"pulseWave":return 3;case"radiantLines":return 4;default:return}}var A3=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k){super();this.rendererOptions=t;this.delegate=o;this.codeBlockModelCollection=n;this.viewModel=s;this.instantiationService=l;this.configService=c;this.logService=u;this.contextKeyService=p;this.themeService=h;this.commandService=g;this.hoverService=f;this.chatWidgetService=v;this.chatEntitlementService=b;this.chatService=S;this.accessibilitySignalService=y;this.accessibilityService=w;this.environmentService=k;this.codeBlocksByResponseId=new Map;this.codeBlocksByEditorUri=new vt;this.fileTreesByResponseId=new Map;this.focusedFileTreesByResponseId=new Map;this.templateDataByRequestId=new Map;this.responseTemplateDataByRequestId=new Map;this.pendingQuestionCarousels=new vt;this._autoRepliedQuestionCarousels=new Set;this._notifiedQuestionCarousels=new Set;this._onDidClickFollowup=this._register(new E);this.onDidClickFollowup=this._onDidClickFollowup.event;this._onDidClickRerunWithAgentOrCommandDetection=this._register(new E);this.onDidClickRerunWithAgentOrCommandDetection=this._onDidClickRerunWithAgentOrCommandDetection.event;this._onDidClickRequest=this._register(new E);this.onDidClickRequest=this._onDidClickRequest.event;this._onDidRerender=this._register(new E);this.onDidRerender=this._onDidRerender.event;this._onDidDispose=this._register(new E);this.onDidDispose=this._onDidDispose.event;this._onDidFocusOutside=this._register(new E);this.onDidFocusOutside=this._onDidFocusOutside.event;this._onDidChangeItemHeight=this._register(new E);this.onDidChangeItemHeight=this._onDidChangeItemHeight.event;this._onDidUpdateViewModel=this._register(new E);this._currentLayoutWidth=Le(this,0);this._isVisible=!0;this._onDidChangeVisibility=this._register(new E);this._announcedToolProgressKeys=new Set;this.chatContentMarkdownRenderer=this.instantiationService.createInstance(hee),this.markdownDecorationsRenderer=this.instantiationService.createInstance(Oee),this._editorPool=this._register(this.instantiationService.createInstance(_me,e,o,r,!1)),this._toolEditorPool=this._register(this.instantiationService.createInstance(_me,e,o,r,!0)),this._diffEditorPool=this._register(this.instantiationService.createInstance(APe,e,o,r,!1)),this._treePool=this._register(this.instantiationService.createInstance(SAe,this._onDidChangeVisibility.event)),this._contentReferencesListPool=this._register(this.instantiationService.createInstance(qee,this._onDidChangeVisibility.event,void 0,void 0)),this._register(this.instantiationService.createInstance(gPe)),this._inlineTextModels=this._register(this.instantiationService.createInstance(NPe)),this._toolInvocationCodeBlockCollection=this._register(this.instantiationService.createInstance(YF,"tools")),this._autoReply=this._register(this.instantiationService.createInstance(yAe)),this._register(this.chatService.onDidSubmitRequest(T=>{let N=this.pendingQuestionCarousels.get(T.chatSessionResource);if(N){for(let O of N)O.skip();N.clear()}}))}static{this.ID="item"}set pendingDragController(e){this._pendingDragController=e}updateOptions(e){this.rendererOptions={...this.rendererOptions,...e}}get templateId(){return A3.ID}editorsInUse(){return ht.concat(this._editorPool.inUse(),this._toolEditorPool.inUse())}traceLayout(e,t){q9o?this.logService.info(`ChatListItemRenderer#${e}: ${t}`):this.logService.trace(`ChatListItemRenderer#${e}: ${t}`)}fireItemHeightChange(e,t){if(!e.currentElement||!e.rowContainer.isConnected)return;let o=t??e.rowContainer.getBoundingClientRect().height;if(o===0||!o)return;let n=Math.ceil(o);e.currentElement.currentRenderedHeight=n,e.currentElement!==this._elementBeingRendered&&this._onDidChangeItemHeight.fire({element:e.currentElement,height:n})}getProgressiveRenderRate(e){let t;(l=>(l[l.Min=40]="Min",l[l.Max=2e3]="Max"))(t||={});let o=80,n=e.contentUpdateTimings?.impliedWordLoadRate;return e.isComplete?typeof n=="number"?Kn(n,80,2e3):80:typeof n=="number"?Kn(n,40,2e3):8}getCodeBlockInfosForResponse(e){return this.codeBlocksByResponseId.get(e.id)??[]}updateViewModel(e){this.viewModel=e,this._announcedToolProgressKeys.clear(),this._autoRepliedQuestionCarousels.clear(),this._notifiedQuestionCarousels.clear(),this.codeBlocksByEditorUri.clear(),this.codeBlocksByResponseId.clear(),this.fileTreesByResponseId.clear(),this.focusedFileTreesByResponseId.clear(),this.responseTemplateDataByRequestId.clear(),this._editorPool.clear(),this._toolEditorPool.clear(),this._diffEditorPool.clear(),this._treePool.clear(),this._contentReferencesListPool.clear(),this._onDidUpdateViewModel.fire()}getCodeBlockInfoForEditor(e){return this.codeBlocksByEditorUri.get(e)}getFileTreeInfosForResponse(e){return this.fileTreesByResponseId.get(e.id)??[]}getLastFocusedFileTreeForResponse(e){let t=this.fileTreesByResponseId.get(e.id),o=this.focusedFileTreesByResponseId.get(e.id);if(t?.length&&o!==void 0&&o<t.length)return t[o]}getTemplateDataForRequestId(e){if(!e)return;let t=this.templateDataByRequestId.get(e);if(t&&t.currentElement?.id===e)return t;t&&this.templateDataByRequestId.delete(e)}setVisible(e){this._isVisible=e,this._onDidChangeVisibility.fire(e)}layout(e){let t=e-40;if(t!==this._currentLayoutWidth.get()){this._currentLayoutWidth.set(t,void 0);for(let o of this._editorPool.inUse())o.layout(t);for(let o of this._toolEditorPool.inUse())o.layout(t);for(let o of this._diffEditorPool.inUse())o.layout(t)}}renderTemplate(e){let t=new P,o=R(e,sf(".chat-row-disabled-overlay")),n=R(e,sf(".interactive-item-container"));this.rendererOptions.renderStyle==="compact"&&n.classList.add("interactive-item-compact");let r=n,s=n,l;if(this.rendererOptions.renderStyle==="minimal"){n.classList.add("interactive-item-compact"),n.classList.add("minimal");let Ve=R(n,sf(".column.left")),Fe=R(n,sf(".column.right"));r=Ve,l=Fe,s=Fe}let c=R(r,sf(".header")),u=t.add(this.contextKeyService.createScoped(n)),p=t.add(this.instantiationService.createChild(new Io([X,u]))),h=R(n,sf(".request-hover")),g;this.rendererOptions.noHeader?c.classList.add("hidden"):g=t.add(p.createInstance(Ln,h,D.ChatMessageTitle,{menuOptions:{shouldForwardArgs:!0},toolbarOptions:{shouldInlineSubmenu:Ve=>Ve.actions.length<=1}})),this.hoverHidden(h);let f=R(n,sf(".checkpoint-container"));R(f,sf(".checkpoint-line-left"));let v=t.add(p.createInstance(Ln,f,D.ChatMessageCheckpoint,{actionViewItemProvider:(Ve,Fe)=>{if(Ve instanceof Eo)return this.instantiationService.createInstance(VR,Ve,{hoverDelegate:Fe.hoverDelegate})},renderDropdownAsChildElement:!0,menuOptions:{shouldForwardArgs:!0},toolbarOptions:{shouldInlineSubmenu:Ve=>Ve.actions.length<=1}}));R(f,sf(".checkpoint-line-right"));let b=R(c,sf(".user")),S=R(b,sf(".avatar-container")),y=R(b,sf("h3.username"));y.tabIndex=0;let w=R(l??b,sf("span.detail-container")),k=R(w,sf("span.detail"));R(w,sf("span.chat-animated-ellipsis"));let T=R(s,sf(".value")),N=t.add(new P),O=R(n,sf(".chat-footer-toolbar"));this.rendererOptions.noFooter&&O.classList.add("hidden");let V=t.add(p.createInstance(Ln,O,D.ChatMessageFooter,{menuOptions:{shouldForwardArgs:!0,renderShortTitle:!0},toolbarOptions:{shouldInlineSubmenu:Ve=>Ve.actions.length<=1},actionViewItemProvider:(Ve,Fe)=>{if(Ve instanceof Eo&&Ve.item.id===mee)return p.createInstance(jme,Ve,Fe);if(Ve instanceof Eo&&Ve.item.id===Ado){let Qt=Q9o(this.configService.getValue("chat.upvoteAnimation"));return p.createInstance(ml,Ve,{...Fe,onClickAnimation:Qt})}return Ca(p,Ve,Fe)}})),U=R(V.getElement(),sf(".chat-footer-details"));U.tabIndex=0;let G=R(n,sf(".checkpoint-restore-container"));R(G,sf(".checkpoint-line-left"));let $=R(G,sf("span.checkpoint-label-text"));$.textContent=d(7340,null);let te=R(G,sf("span.checkpoint-dot-separator"));te.textContent="\xB7",te.setAttribute("aria-hidden","true");let pe=t.add(p.createInstance(Ln,G,D.ChatMessageRestoreCheckpoint,{actionViewItemProvider:(Ve,Fe)=>{if(Ve instanceof Eo)return this.instantiationService.createInstance(VR,Ve,{hoverDelegate:Fe.hoverDelegate})},renderDropdownAsChildElement:!0,menuOptions:{shouldForwardArgs:!0},toolbarOptions:{shouldInlineSubmenu:Ve=>Ve.actions.length<=1}}));R(G,sf(".checkpoint-line-right"));let de=t.add(this.instantiationService.createInstance(l2)),se=()=>{if(Vi(Ee.currentElement)&&Ee.currentElement.agent&&!Ee.currentElement.agent.isDefault)return de.setAgent(Ee.currentElement.agent.id),de.domNode},Se=KMe(()=>Vi(Ee.currentElement)?Ee.currentElement.agent:void 0,this.commandService);t.add(this.hoverService.setupManagedHover(Ni("element"),b,se,Se)),t.add(j(b,re.KEY_DOWN,Ve=>{let Fe=new Ii(Ve);if(Fe.equals(10)||Fe.equals(3)){let Qt=se();Qt&&this.hoverService.showInstantHover({content:Qt,target:b,trapFocus:!0,actions:Se.actions},!0)}else Fe.equals(9)&&this.hoverService.hideHover()}));let ke=document.createElement("connection-observer");R(e,ke);let Ee={header:c,avatarContainer:S,requestHover:h,username:y,detail:k,value:T,rowContainer:n,elementDisposables:N,templateDisposables:t,contextKeyService:u,instantiationService:p,agentHover:de,titleToolbar:g,footerToolbar:V,footerDetailsContainer:U,disabledOverlay:o,checkpointToolbar:v,checkpointRestoreToolbar:pe,checkpointContainer:f,checkpointRestoreContainer:G};ke.onDidDisconnect=()=>{Ee.renderedPartsMounted=!1},t.add(this._onDidUpdateViewModel.event(()=>{(!Ee.currentElement||!this.viewModel?.sessionResource||!Xe(Ee.currentElement.sessionResource,this.viewModel.sessionResource))&&this.clearRenderedParts(Ee)})),t.add(j(o,re.CLICK,Ve=>{if(!this.viewModel?.editing)return;let Fe=Ee.currentElement;!Fe||Fe.id===this.viewModel.editing.id||o.classList.contains("disabled")&&(Ve.preventDefault(),Ve.stopPropagation(),this._onDidFocusOutside.fire())}));let He=t.add(new eL(Ve=>{let Fe=Ve[0];Fe&&this.fireItemHeightChange(Ee,Fe.borderBoxSize.at(0)?.blockSize)}));return t.add(He.observe(n)),Ee}renderElement(e,t,o){this._elementBeingRendered=e.element;try{this.renderChatTreeItem(e.element,t,o)}finally{this._elementBeingRendered=void 0}}clearRenderedParts(e){e.renderedParts&&(Ue(si(e.renderedParts)),e.renderedParts=void 0,Rt(e.value)),e.titleToolbar&&(e.titleToolbar.context=void 0),e.footerToolbar.context=void 0,e.checkpointToolbar.context=void 0,e.checkpointRestoreToolbar.context=void 0}renderChatTreeItem(e,t,o){if(o.currentElement&&o.currentElement.id!==e.id){this.traceLayout("renderChatTreeItem",`Rendering a different element into the template, index=${t}`);let b=this.templateDataByRequestId.get(o.currentElement.id);b&&b.currentElement?.id!==o.currentElement.id&&this.templateDataByRequestId.delete(o.currentElement.id),this.clearRenderedParts(o)}if(o.currentElement=e,this.templateDataByRequestId.set(e.id,o),pBt(e)){this.renderPendingDivider(e,o);return}let n=Rr(e)?"request":Vi(e)?"response":pBt(e)?"pendingDivider":"welcome";this.traceLayout("renderElement",`${n}, index=${t}`),ie.isResponse.bindTo(o.contextKeyService).set(Vi(e)),ie.itemId.bindTo(o.contextKeyService).set(e.id),ie.isRequest.bindTo(o.contextKeyService).set(Rr(e)),ie.isPendingRequest.bindTo(o.contextKeyService).set(Rr(e)&&!!e.pendingKind),ie.responseDetectedAgentCommand.bindTo(o.contextKeyService).set(Vi(e)&&e.agentOrSlashCommandDetected),Vi(e)?(ie.responseSupportsIssueReporting.bindTo(o.contextKeyService).set(!!e.agent?.metadata.supportIssueReporting),ie.responseVote.bindTo(o.contextKeyService).set(e.vote===1?"up":e.vote===0?"down":"")):ie.responseVote.bindTo(o.contextKeyService).set(""),o.titleToolbar&&(o.titleToolbar.context=e),o.footerToolbar.context=e,Vi(e)&&e.result?.details?(o.footerDetailsContainer.textContent=e.result.details,o.footerDetailsContainer.classList.remove("hidden")):o.footerDetailsContainer.classList.add("hidden"),ie.responseHasError.bindTo(o.contextKeyService).set(Vi(e)&&!!e.errorDetails);let r=!!(Vi(e)&&e.errorDetails?.responseIsFiltered);ie.responseIsFiltered.bindTo(o.contextKeyService).set(r);let s=this.chatWidgetService.getWidgetBySessionResource(e.sessionResource)?.location;o.rowContainer.classList.toggle("editing-session",s==="panel"),o.rowContainer.classList.toggle("interactive-request",Rr(e)),o.rowContainer.classList.toggle("interactive-response",Vi(e)),o.rowContainer.classList.remove("pending-item","pending-divider","pending-request"),o.dragHandle?.remove(),o.dragHandle=void 0,delete o.rowContainer.dataset.pendingRequestId,delete o.rowContainer.dataset.pendingKind;let l=ZX(this.delegate.currentChatMode(),this.rendererOptions.progressMessageAtBottomOfResponse);o.rowContainer.classList.toggle("show-detail-progress",Vi(e)&&!e.isComplete&&!e.progressMessages.length&&!l),this.rendererOptions.noHeader||this.renderAvatar(e,o),o.username.textContent=e.username,o.username.classList.toggle("hidden",e.username===amo||this.environmentService.isSessionsWindow),o.avatarContainer.classList.toggle("hidden",e.username===amo||this.environmentService.isSessionsWindow),this.hoverHidden(o.requestHover),Rt(o.detail),Vi(e)&&this.renderDetail(e,o),o.checkpointToolbar.context=e;let c=this.configService.getValue("chat.checkpoints.enabled")&&(this.rendererOptions.restorable??!0),u=Rr(e)&&!!e.pendingKind;if(o.checkpointContainer.classList.toggle("hidden",Vi(e)||u||!c),o.footerToolbar.refresh(),o.checkpointToolbar.refresh(),o.checkpointRestoreToolbar.refresh(),Vi(e)&&(this.responseTemplateDataByRequestId.set(e.requestId,o),o.elementDisposables.add(Z(()=>this.responseTemplateDataByRequestId.delete(e.requestId)))),!u){let b=S=>{let y=Rr(e)?e.id:Vi(e)?e.requestId:void 0;if(!y)return;let w=this.templateDataByRequestId.get(y),k=this.responseTemplateDataByRequestId.get(y);w?.checkpointContainer.classList.toggle("group-hovered",S),k?.rowContainer.classList.toggle("group-hovered",S)};o.elementDisposables.add(j(o.rowContainer,re.MOUSE_ENTER,()=>b(!0))),o.elementDisposables.add(j(o.rowContainer,re.MOUSE_LEAVE,()=>b(!1))),o.elementDisposables.add(Z(()=>b(!1)))}let p=this.viewModel?.model.checkpoint&&!this.viewModel?.editing&&t===this.delegate.getListLength()-1&&!u;o.checkpointRestoreContainer.classList.toggle("hidden",!(p&&c));let h=e.id===this.viewModel?.editing?.id,g=this.configService.getValue("chat.editRequests")==="input";o.elementDisposables.add(he(b=>{let S=e.shouldBeBlocked.read(b);o.disabledOverlay.classList.toggle("disabled",S&&!h&&this.viewModel?.editing!==void 0)})),o.rowContainer.classList.toggle("editing",h&&!g),o.rowContainer.classList.toggle("editing-input",h&&g),o.requestHover.classList.toggle("editing",h&&g),o.requestHover.classList.toggle("hidden",!!this.viewModel?.editing&&!h||Vi(e)||!this.rendererOptions.editable),o.requestHover.classList.toggle("expanded",this.configService.getValue("chat.editRequests")==="hover"),o.requestHover.classList.toggle("checkpoints-enabled",c),o.elementDisposables.add(Vo(o.rowContainer,re.CLICK,b=>{let S=o.currentElement;S&&this.viewModel?.editing&&S.id!==this.viewModel.editing.id&&(b.stopPropagation(),b.preventDefault(),this._onDidFocusOutside.fire())}));let f=o.rowContainer.parentElement?.parentElement?.parentElement;f?.classList.toggle("request",Rr(e)),f?.classList.toggle("response",Vi(e)),o.rowContainer.classList.toggle(j9o,t===this.delegate.getListLength()-1),o.rowContainer.classList.toggle("confirmation-message",Rr(e)&&!!e.confirmation);let v=Vi(e)&&!this.rendererOptions.noHeader;if(o.header?.classList.toggle("header-disabled",!v),Rr(e)&&e.confirmation&&this.renderConfirmationAction(e,o),Vi(e)&&t===this.delegate.getListLength()-1&&(!e.isComplete||e.renderData)){this.traceLayout("renderElement",`start progressive render, index=${t}`);let b=o.elementDisposables.add(new ZD),S=y=>{try{this.doNextProgressiveRender(e,t,o,!!y)&&b.cancel()}catch(w){b.cancel(),this.logService.error(w)}};b.cancelAndSet(S,50,Me(o.rowContainer)),S(!0)}else Vi(e)?this.renderChatResponseBasic(e,t,o):Rr(e)&&this.renderChatRequest(e,t,o);o.renderedPartsMounted=!0}renderPendingDivider(e,t){t.rowContainer.classList.add("pending-item"),t.rowContainer.classList.add("pending-divider"),t.rowContainer.classList.remove("interactive-request","interactive-response","pending-request"),t.avatarContainer.classList.add("hidden"),t.username.classList.add("hidden"),t.requestHover.classList.add("hidden"),t.checkpointContainer.classList.add("hidden"),t.checkpointRestoreContainer.classList.add("hidden"),t.footerToolbar.getElement().classList.add("hidden"),t.titleToolbar&&t.titleToolbar.getElement().classList.add("hidden"),Rt(t.value),Rt(t.detail);let o=_(".pending-divider-content"),n=R(o,_("span.pending-divider-label"));e.dividerKind==="steering"?(n.textContent=d(7358,null),n.title=d(7359,null)):(n.textContent=d(7352,null),n.title=d(7353,null)),t.value.appendChild(o)}renderDetail(e,t){if(Rt(t.detail),e.agentOrSlashCommandDetected){let o=e.slashCommand?d(7361,null,`${yu}${e.slashCommand.name}`):d(7360,null);Fi(t.detail,RL(o,{actionHandler:{disposables:t.elementDisposables,callback:n=>{this._onDidClickRerunWithAgentOrCommandDetection.fire(e)}}},sf("span.agentOrSlashCommandDetected")))}else this.rendererOptions.renderStyle!=="minimal"&&!e.isComplete&&!ZX(this.delegate.currentChatMode(),this.rendererOptions.progressMessageAtBottomOfResponse)&&(t.detail.textContent=d(7362,null))}renderConfirmationAction(e,t){if(Rt(t.detail),e.confirmation){R(t.detail,sf("span.codicon.codicon-check",{"aria-hidden":"true"})),R(t.detail,sf("span.confirmation-text",void 0,d(7339,null,e.confirmation))),t.header?.classList.remove("header-disabled"),t.header?.classList.add("partially-disabled");let o=()=>t.detail.classList.toggle("show-checkmarks",!!this.configService.getValue("accessibility.chat.showCheckmarks"));o(),t.elementDisposables.add(this.configService.onDidChangeConfiguration(n=>{n.affectsConfiguration("accessibility.chat.showCheckmarks")&&o()}))}}renderAvatar(e,t){if(pBt(e))return;let o;if(Vi(e)?o=this.getAgentIcon(e.agent?.metadata):Rr(e)?o=e.avatarIcon??M.account:o=M.account,o instanceof A){let n=_("img.icon");n.src=gn.uriToBrowserUri(o).toString(!0),t.avatarContainer.replaceChildren(_(".avatar",void 0,n))}else{let n=_(q.asCSSSelector(o));t.avatarContainer.replaceChildren(_(".avatar.codicon-avatar",void 0,n))}}getAgentIcon(e){return e?.themeIcon?e.themeIcon:e?.iconDark&&Ip(this.themeService.getColorTheme().type)?e.iconDark:e?.icon?e.icon:M.chatSparkle}renderChatResponseBasic(e,t,o){if(o.rowContainer.classList.toggle("chat-response-loading",Vi(e)&&!e.isComplete),e.isComplete||e.isCanceled){let c=this.getLastThinkingPart(o.renderedParts);c?.domNode&&c.getIsActive()&&(c.finalizeTitleIfDefault(),c.markAsInactive()),this.finalizeAllSubagentParts(o)}let n=[];e.errorDetails?.responseIsFiltered||(n.push({kind:"references",references:e.contentReferences}),n.push(...VCi(e.response.value)),e.codeCitations.length&&n.push({kind:"codeCitations",citations:e.codeCitations})),e.model.response===e.model.entireResponse&&e.errorDetails?.message&&e.errorDetails.message!==t6&&n.push({kind:"errorDetails",errorDetails:e.errorDetails,isLast:t===this.delegate.getListLength()-1});let s=this.getChatFileChangesSummaryPart(e);s&&n.push(s);let l=this.diff(o.renderedParts??[],n,e);this.renderChatContentDiff(l,n,e,t,o)}shouldShowWorkingProgress(e,t,o){if(e.agentOrSlashCommandDetected||this.rendererOptions.renderStyle==="minimal"||e.isComplete||!ZX(this.delegate.currentChatMode(),this.rendererOptions.progressMessageAtBottomOfResponse)||t.some(u=>u.kind==="toolInvocation"&&lo.isStreaming(u)))return!1;let n=ju(t,u=>u.kind!=="markdownContent"||u.content.value.trim().length>0);if(t.some(u=>u.kind==="thinking")||this.getLastThinkingPart(o.renderedParts)||this.configService.getValue("chat.agent.thinking.collapsedTools")!=="off"&&t.some(u=>(u.kind==="toolInvocation"||u.kind==="toolInvocationSerialized")&&this.shouldPinPart(u,e)))return!1;let l=(o.renderedParts??[]).some(u=>u instanceof vD),c=t.some(u=>u.kind==="markdownContent"&&this.hasEditCodeblockUri(u));return l&&c||this.getSubagentPart(o.renderedParts)?!1:!!(!n||n.kind==="references"||(n.kind==="toolInvocation"||n.kind==="toolInvocationSerialized")&&(lo.isComplete(n)||n.presentation==="hidden")||(n.kind==="textEditGroup"||n.kind==="notebookEditGroup")&&n.done&&!t.some(u=>u.kind==="toolInvocation"&&!lo.isComplete(u))||n.kind==="progressTask"&&n.deferred.isSettled||n.kind==="mcpServersStarting"||n.kind==="disabledClaudeHooks"||n.kind==="hook")}getChatFileChangesSummaryPart(e){if(this.shouldShowFileChangesSummary(e)&&e.model.entireResponse.value.some(t=>t.kind==="textEditGroup"||t.kind==="notebookEditGroup"))return{kind:"changesSummary",requestId:e.requestId,sessionResource:e.sessionResource}}renderChatRequest(e,t,o){if(o.rowContainer.classList.toggle("chat-response-loading",!1),o.rowContainer.classList.toggle("pending-request",!!e.pendingKind),e.pendingKind&&this._pendingDragController&&(o.rowContainer.dataset.pendingRequestId=e.id,o.rowContainer.dataset.pendingKind=e.pendingKind,(this.viewModel?.model.getPendingRequests()??[]).filter(c=>c.kind===e.pendingKind).length>1)){let c=_(".chat-pending-drag-handle"+q.asCSSSelector(M.gripper));o.rowContainer.prepend(c),o.dragHandle=c,this._pendingDragController.attachDragHandle(e,c,o.rowContainer,o.elementDisposables)}e.id===this.viewModel?.editing?.id&&this._onDidRerender.fire(o),this.configService.getValue("chat.editRequests")!=="none"&&this.rendererOptions.editable&&o.elementDisposables.add(j(o.rowContainer,re.KEY_DOWN,l=>{let c=new Ii(l);(c.equals(10)||c.equals(3))&&this.viewModel?.editing?.id!==e.id&&(c.preventDefault(),c.stopPropagation(),this._onDidClickRequest.fire(o))}));let n=[];if(!e.confirmation){let l=AYi(e.message)?e.message.message:this.markdownDecorationsRenderer.convertParsedRequestToMarkdown(e.sessionResource,e.message);n=[{content:new xe(l),kind:"markdownContent"}],this.rendererOptions.renderStyle==="minimal"&&!e.isComplete?(o.value.classList.add("inline-progress"),o.elementDisposables.add(Z(()=>o.value.classList.remove("inline-progress"))),n.push({content:new xe("<span></span>",{supportHtml:!0}),kind:"markdownContent"})):o.value.classList.remove("inline-progress")}Rt(o.value);let r=[],s=!1;if(n.forEach((l,c)=>{let u={element:e,elementIndex:t,contentIndex:c,content:n,container:o.rowContainer,editorPool:this._editorPool,diffEditorPool:this._diffEditorPool,codeBlockModelCollection:this.codeBlockModelCollection,currentWidth:this._currentLayoutWidth,onDidChangeVisibility:this._onDidChangeVisibility.event,inlineTextModels:this._inlineTextModels,get codeBlockStartIndex(){return r.reduce((h,g)=>h+(g.codeblocks?.length??0),0)},get treeStartIndex(){return r.filter(h=>h instanceof ite).length}},p=this.renderChatContentPart(l,o,u);if(p){if(this.rendererOptions.renderDetectedCommandsWithRequest&&!s&&e.agentOrSlashCommandDetected&&e.slashCommand&&l.kind==="markdownContent"){p.domNode&&(p.domNode.style.display="inline-flex");let h=this.instantiationService.createInstance(GMe,e.slashCommand,()=>this._onDidClickRerunWithAgentOrCommandDetection.fire({sessionResource:e.sessionResource,requestId:e.id}));o.value.appendChild(h.domNode),r.push(h),s=!0}p.domNode&&o.value.appendChild(p.domNode),r.push(p)}}),o.renderedParts&&Ue(o.renderedParts),o.renderedParts=r,e.variables.length){let l=this.renderAttachments(e.variables,e.contentReferences,o);l.domNode&&o.value.appendChild(l.domNode),o.elementDisposables.add(l)}}doNextProgressiveRender(e,t,o,n){if(!this._isVisible)return!0;if(e.isCanceled)return this.traceLayout("doNextProgressiveRender",`canceled, index=${t}`),e.renderData=void 0,this.renderChatResponseBasic(e,t,o),!0;o.rowContainer.classList.toggle("chat-response-loading",!0),this.traceLayout("doNextProgressiveRender",`START progressive render, index=${t}`);let r=this.getNextProgressiveRenderContent(e,o),s=this.diff(o.renderedParts??[],r.content,e);return s.every(c=>c===null)?r.moreContentAvailable?(this.traceLayout("doNextProgressiveRender","not rendering any new content this tick, but more available"),!1):e.isComplete?(this.traceLayout("doNextProgressiveRender",`END progressive render, index=${t} and clearing renderData, response is complete`),e.renderData=void 0,this.renderChatResponseBasic(e,t,o),!0):(this.traceLayout("doNextProgressiveRender","caught up with the stream- no new content to render"),!0):(this.traceLayout("doNextProgressiveRender",`doing progressive render, ${s.length} parts to render`),this.renderChatContentDiff(s,r.content,e,t,o),!1)}renderChatContentDiff(e,t,o,n,r){let s=r.renderedParts??[];r.renderedParts=s;let l=e.findLastIndex(c=>c?.kind==="markdownContent");e.forEach((c,u)=>{let p=r.renderedParts?.[u],h=c?.kind==="markdownContent"&&u===l&&o.isComplete;if(!c){r.renderedPartsMounted||p?.onDidRemount?.();return}if(p){if(c.kind==="thinking"&&p instanceof vD){Array.isArray(c.value)||p.updateThinking(c),s[u]=p;return}else if(p instanceof vD&&this.shouldPinPart(c,o)&&!h){s[u]=p;return}if(p.dispose(),p.domNode){let S=Nh(p.domNode,"chat-thinking-tool-wrapper");S&&S.replaceWith(p.domNode)}}let g=s.slice(0,u),f={element:o,elementIndex:n,content:t,contentIndex:u,container:r.rowContainer,editorPool:this._editorPool,diffEditorPool:this._diffEditorPool,codeBlockModelCollection:this.codeBlockModelCollection,currentWidth:this._currentLayoutWidth,onDidChangeVisibility:this._onDidChangeVisibility.event,inlineTextModels:this._inlineTextModels,get codeBlockStartIndex(){return g.reduce((S,y)=>S+(y.codeblocks?.length??0),0)},get treeStartIndex(){return g.filter(S=>S instanceof ite).length}};if(this.getLastThinkingPart(s)&&(c.kind==="toolInvocation"||c.kind==="toolInvocationSerialized"||c.kind==="markdownContent"||c.kind==="textEditGroup"||c.kind==="hook")&&this.shouldPinPart(c,o)&&!h){let S=this.renderChatContentPart(c,r,f);S&&(s[u]=S,p instanceof Lme&&p?.domNode&&p.domNode.remove());return}let b=this.renderChatContentPart(c,r,f);if(b){s[u]=b;try{p?.domNode?b.domNode?p.domNode.replaceWith(b.domNode):p.domNode.remove():b.domNode&&!b.domNode.parentElement&&r.value.appendChild(b.domNode)}catch(S){this.logService.error("ChatListItemRenderer#renderChatContentDiff: error replacing part",S)}}else p?.domNode?.remove()});for(let c=e.length;c<s.length;c++){let u=s[c];u&&(u.dispose(),u.domNode?.remove(),delete s[c])}}getNextProgressiveRenderContent(e,t){let o=this.getDataForProgressiveRender(e),n=this.configService.getValue("chat.experimental.renderMarkdownImmediately")===!0,r=VCi(e.response.value);this.traceLayout("getNextProgressiveRenderContent",`Want to render ${o.numWordsToRender} at ${o.rate} words/s, counting...`);let s=o.numWordsToRender,l=[];l.push({kind:"references",references:e.contentReferences});let c=!1;for(let f=0;f<r.length;f++){let v=r[f];if(v.kind==="markdownContent"&&!n){let b=ICi(v.content.value,s);if(this.traceLayout("getNextProgressiveRenderContent",` Chunk ${f}: Want to render ${s} words and found ${b.returnedWordCount} words. Total words in chunk: ${b.totalWordCount}`),s-=b.returnedWordCount,b.isFullString){l.push(v);for(let S of r.slice(f+1))if(S.kind!=="markdownContent")f++,l.push(S);else break}else c=!0,l.push({...v,content:new xe(b.value,v.content)});if(s<=0){r.slice(f+1).some(S=>S.kind==="markdownContent")&&(c=!0);break}}else l.push(v)}let u=e.contentUpdateTimings?.lastWordCount??0,p=o.numWordsToRender-s,h=u-p;this.traceLayout("getNextProgressiveRenderContent",`Want to render ${o.numWordsToRender} words. Rendering ${p} words. Buffer: ${h} words`),p>0&&p!==e.renderData?.renderedWordCount&&(e.renderData={lastRenderTime:Date.now(),renderedWordCount:p,renderedParts:l}),this.shouldShowWorkingProgress(e,l,t)&&l.push({kind:"working"});let g=this.getChatFileChangesSummaryPart(e);return g&&l.push(g),{content:l,moreContentAvailable:c}}shouldShowFileChangesSummary(e){let t=fg(e.sessionResource)===qp;return e.isComplete&&t&&this.configService.getValue("chat.checkpoints.showFileChanges")}getDataForProgressiveRender(e){let t=e.response.value.some(s=>s.kind==="markdownContent"&&s.content.value.trim().length>0);if(!e.isComplete&&t&&(e.contentUpdateTimings?e.contentUpdateTimings.lastWordCount:0)===0)return{numWordsToRender:Number.MAX_SAFE_INTEGER,rate:Number.MAX_SAFE_INTEGER};let o=e.renderData??{lastRenderTime:0,renderedWordCount:0},n=this.getProgressiveRenderRate(e);return{numWordsToRender:o.lastRenderTime===0?1:o.renderedWordCount+Math.floor((Date.now()-o.lastRenderTime)/1e3*n),rate:n}}diff(e,t,o){let n=[],r=Vi(o)&&o.isComplete,s=t.findLastIndex(l=>l.kind==="markdownContent");for(let l=0;l<t.length;l++){let c=t[l],u=e[l];if(c.kind==="markdownContent"&&l===s&&r&&this.isRenderedPartInsideThinking(u)){n.push(c);continue}!u||!u.hasSameContent(c,t.slice(l+1),o)?n.push(c):n.push(null)}return n}isRenderedPartInsideThinking(e){return e?.domNode?!!Nh(e.domNode,"chat-thinking-box"):!1}hasEditCodeblockUri(e){return e.kind!=="markdownContent"?!1:Fdo(e.content.value)}isCodeblockComplete(e,t){return e.kind!=="markdownContent"?!0:!Vi(t)||t.isComplete||Nxi(e.content.value)}shouldPinPart(e,t){let o=this.configService.getValue("chat.agent.thinking.collapsedTools");if(e.kind==="thinking"||e.kind==="working"||e.kind==="undoStop")return!0;if(e.kind==="hook")return e.subAgentInvocationId?!1:e.hookType==="PreToolUse"||e.hookType==="PostToolUse";if(o==="off")return!1;if(this.hasEditCodeblockUri(e)||e.kind==="textEditGroup")return!0;if((e.kind==="toolInvocation"||e.kind==="toolInvocationSerialized")&&e.source?.type==="mcp"||(e.kind==="toolInvocation"||e.kind==="toolInvocationSerialized")&&e.toolId.toLowerCase().includes("mermaid")||(e.kind==="toolInvocation"||e.kind==="toolInvocationSerialized")&&(e.toolId==="copilot_askQuestions"||e.toolId==="vscode_askQuestions")||(e.kind==="toolInvocation"||e.kind==="toolInvocationSerialized")&&cmo(e))return!1;let l=(e.kind==="toolInvocation"||e.kind==="toolInvocationSerialized")&&e.toolSpecificData?.kind==="terminal",c=t&&t.sessionResource.scheme!==Y.vscodeChatInput&&t.sessionResource.scheme!==Y.vscodeLocalChatSession&&e.kind==="toolInvocationSerialized"&&e.toolSpecificData?.kind==="terminal";if(l&&!c)return e.kind==="toolInvocation"&&lo.getConfirmationMessages(e)?!1:!!this.configService.getValue("chat.agent.thinking.terminalTools");if(e.kind==="toolInvocation"){if(lo.isStreaming(e))return!0;let u=e.state.get();return u.type===lo.StateKind.WaitingForConfirmation||u.type===lo.StateKind.WaitingForPostApproval?!1:!lo.getConfirmationMessages(e)}return e.kind==="toolInvocationSerialized"}getLastThinkingPart(e){if(!(!e||e.length===0))for(let t=e.length-1;t>=0;t--){let o=e[t];if(o instanceof vD&&o.getIsActive())return o}}isThinkingLookAheadComplete(e,t){if(t?.isComplete)return!0;for(let o=e.contentIndex+1;o<e.content.length;o++){let n=e.content[o];if(!this.shouldPinPart(n,t))return!0}return!1}getSubagentPart(e,t){if(!(!e||e.length===0))for(let o=e.length-1;o>=0;o--){let n=e[o];if(n instanceof KR&&(t&&n.subAgentInvocationId===t||!t&&n.getIsActive()))return n}}finalizeAllSubagentParts(e){if(e.renderedParts)for(let t of e.renderedParts)t instanceof KR&&t.getIsActive()&&t.markAsInactive()}handleSubagentToolGrouping(e,t,o,n,r){this.finalizeCurrentThinkingPart(o,n);let s=this.getSubagentPart(n.renderedParts,t);if(s)return _ki(e)||s.appendToolInvocation(e,r),s;let l=this.instantiationService.createInstance(KR,t,e,o,this.chatContentMarkdownRenderer,this._contentReferencesListPool,this._toolEditorPool,()=>this._currentLayoutWidth.get(),this._toolInvocationCodeBlockCollection,this._announcedToolProgressKeys);return _ki(e)||l.appendToolInvocation(e,r),l}finalizeCurrentThinkingPart(e,t){let o=this.getLastThinkingPart(t.renderedParts);if(!o)return;this.configService.getValue("chat.agent.thinkingStyle")==="collapsedPreview"&&o.collapseContent(),o.finalizeTitleIfDefault(),o.resetId(),o.markAsInactive()}renderChatContentPart(e,t,o){try{if(e.kind==="thinking"&&(Array.isArray(e.value)?e.value.length===0:e.value===""))return this.getLastThinkingPart(t.renderedParts)?.resetId(),this.renderNoContent(c=>e.kind===c.kind);let n=Vi(o.element),r=this.shouldPinPart(e,n?o.element:void 0);if(o.element.isComplete&&!r)for(let l of this.templateDataByRequestId.values())l.renderedParts&&this.getLastThinkingPart(l.renderedParts)?.getIsActive()&&this.finalizeCurrentThinkingPart(o,l);let s=(e.kind==="toolInvocation"||e.kind==="toolInvocationSerialized")&&cmo(e);if(o.element.isComplete&&!s)for(let l of this.templateDataByRequestId.values())this.finalizeAllSubagentParts(l);return e.kind==="treeData"?this.renderTreeData(e,t,o):e.kind==="multiDiffData"?this.renderMultiDiffData(e,t,o):e.kind==="progressMessage"?this.instantiationService.createInstance(fD,e,this.chatContentMarkdownRenderer,o,void 0,void 0,void 0,void 0,e.shimmer):e.kind==="working"?this.instantiationService.createInstance(Lme,e,this.chatContentMarkdownRenderer,o):e.kind==="progressTask"||e.kind==="progressTaskSerialized"?this.renderProgressTask(e,t,o):e.kind==="command"?this.instantiationService.createInstance(mPe,e,o):e.kind==="textEditGroup"?this.renderTextEdit(o,e,t):e.kind==="confirmation"?this.renderConfirmation(o,e,t):e.kind==="warning"?this.instantiationService.createInstance(FPe,1,e.content,e,this.chatContentMarkdownRenderer):e.kind==="hook"?this.renderHookPart(e,o,t):e.kind==="markdownContent"?this.renderMarkdown(e,t,o):e.kind==="references"?Vi(o.element)&&o.element.agent?.isDefault&&!o.element.agent.modes.includes("ask")?this.renderNoContent(l=>l.kind===e.kind):this.renderContentReferencesListData(e,void 0,o,t):e.kind==="codeCitations"?this.renderCodeCitations(e,o,t):e.kind==="toolInvocation"||e.kind==="toolInvocationSerialized"?this.renderToolInvocation(e,o,t):e.kind==="extensions"?this.renderExtensionsContent(e,o,t):e.kind==="pullRequest"?this.renderPullRequestContent(e,o,t):e.kind==="undoStop"?this.renderUndoStop(e):e.kind==="errorDetails"?this.renderChatErrorDetails(o,e,t):e.kind==="elicitation2"||e.kind==="elicitationSerialized"?this.renderElicitation(o,e,t):e.kind==="questionCarousel"?this.renderQuestionCarousel(o,e,t):e.kind==="changesSummary"?this.renderChangesSummary(e,o,t):e.kind==="mcpServersStarting"?this.renderMcpServersInteractionRequired(e,o,t):e.kind==="disabledClaudeHooks"?this.renderDisabledClaudeHooks(e,o):e.kind==="thinking"?this.renderThinkingPart(e,o,t):e.kind==="workspaceEdit"?this.instantiationService.createInstance(IAe,e,o,this.chatContentMarkdownRenderer):this.renderNoContent(l=>e.kind===l.kind)}catch(n){Jo(`Chat error: ${In(n,!1)}`),this.logService.error("ChatListItemRenderer#renderChatContentPart: error rendering content",In(n,!0));let r=this.instantiationService.createInstance(FPe,2,new xe(d(7355,null)+`: ${In(n,!1)}`),e,this.chatContentMarkdownRenderer);return{dispose:()=>r.dispose(),domNode:r.domNode,hasSameContent:(s=>e.kind===s.kind)}}}dispose(){this._announcedToolProgressKeys.clear(),super.dispose()}renderChatErrorDetails(e,t,o){if(!Vi(e.element))return this.renderNoContent(r=>t.kind===r.kind);let n=e.elementIndex===this.delegate.getListLength()-1;if(t.errorDetails.isQuotaExceeded)return this.instantiationService.createInstance(GPe,e.element,t,this.chatContentMarkdownRenderer);if(t.errorDetails.isRateLimited&&this.chatEntitlementService.anonymous)return this.instantiationService.createInstance($Me,t);if(t.errorDetails.confirmationButtons&&n){let r=t.errorDetails.level??2;return this.instantiationService.createInstance(WPe,r,new xe(t.errorDetails.message),t,t.errorDetails.confirmationButtons,this.chatContentMarkdownRenderer,e)}else{let r=t.errorDetails.level??2;return this.instantiationService.createInstance(FPe,r,new xe(t.errorDetails.message),t,this.chatContentMarkdownRenderer)}}renderUndoStop(e){return this.renderNoContent(t=>t.kind===e.kind&&t.id===e.id)}renderNoContent(e){return{dispose:()=>{},domNode:void 0,hasSameContent:e}}renderTreeData(e,t,o){let n=e.treeData,r=this.instantiationService.createInstance(ite,n,this._treePool);if(Vi(o.element)){let s={treeDataId:n.uri.toString(),treeIndex:o.treeStartIndex,focus(){r.domFocus()}};r.addDisposable(r.onDidFocus(()=>{this.focusedFileTreesByResponseId.set(o.element.id,s.treeIndex)}));let l=this.fileTreesByResponseId.get(o.element.id)??[];l.push(s),this.fileTreesByResponseId.set(o.element.id,Uo(l,c=>c.treeDataId)),r.addDisposable(Z(()=>this.fileTreesByResponseId.set(o.element.id,l.filter(c=>c.treeDataId!==n.uri.toString()))))}return r}renderMultiDiffData(e,t,o){return this.instantiationService.createInstance(zPe,e,o.element)}renderContentReferencesListData(e,t,o,n){return this.instantiationService.createInstance($Pe,e.references,t,o,this._contentReferencesListPool,{expandedWhenEmptyResponse:ZX(this.delegate.currentChatMode(),this.rendererOptions.referencesExpandedWhenEmptyResponse)})}renderCodeCitations(e,t,o){return this.instantiationService.createInstance(pPe,e,t)}handleRenderedCodeblocks(e,t,o){if(!t.addDisposable||t.codeblocksPartId===void 0)return;let n=this.codeBlocksByResponseId.get(e.id)??[];this.codeBlocksByResponseId.set(e.id,n),t.addDisposable(Z(()=>{let r=this.codeBlocksByResponseId.get(e.id);r&&t.codeblocks?.forEach((s,l)=>{r[o+l]?.ownerMarkdownPartId===t.codeblocksPartId&&delete r[o+l]})})),t.codeblocks?.forEach((r,s)=>{n[o+s]=r,t.addDisposable(nbe(r.uriPromise,l=>{l&&(this.codeBlocksByEditorUri.set(l,r),t.addDisposable(Z(()=>{this.codeBlocksByEditorUri.get(l)?.ownerMarkdownPartId===t.codeblocksPartId&&this.codeBlocksByEditorUri.delete(l)})))}))})}renderToolInvocation(e,t,o){this.configService.getValue("chat.agent.thinking.collapsedTools")==="off"&&this.finalizeCurrentThinkingPart(t,o);let n=t.codeBlockStartIndex,r,s=()=>(r=this.instantiationService.createInstance(tte,e,t,this.chatContentMarkdownRenderer,this._contentReferencesListPool,this._toolEditorPool,()=>this._currentLayoutWidth.get(),this._toolInvocationCodeBlockCollection,this._announcedToolProgressKeys,n),this.handleRenderedCodeblocks(t.element,r,n),{domNode:r.domNode,part:r}),l=this.configService.getValue("chat.agent.thinking.collapsedTools");if(Vi(t.element)&&l!=="off"){let p=this.getLastThinkingPart(o.renderedParts);if(!p&&e.presentation!=="hidden"&&this.shouldPinPart(e,t.element)&&l==="always"){let h=this.renderThinkingPart({kind:"thinking"},t,o);return h instanceof vD&&(h.appendItem(s,e.toolId,e,o.value),this.setupConfirmationTransitionWatcher(e,h,()=>r,s,t,o)),h}if(this.shouldPinPart(e,t.element)){if(p&&e.presentation!=="hidden")return p.appendItem(s,e.toolId,e,o.value),this.setupConfirmationTransitionWatcher(e,p,()=>r,s,t,o),this.renderNoContent((h,g,f)=>r?r.hasSameContent(h,g,f):e.kind===h.kind)}else this.finalizeCurrentThinkingPart(t,o)}let c=dmo(e);if(c&&Vi(t.element)&&e.presentation!=="hidden")return this.handleSubagentToolGrouping(e,c,t,o,n);let{part:u}=s();return u}setupConfirmationTransitionWatcher(e,t,o,n,r,s){if(e.kind!=="toolInvocation")return;let l=()=>{let g=o();if(g?.domNode){let f=g.domNode.parentElement;f?.classList.contains("chat-thinking-tool-wrapper")&&f.remove(),s.value.appendChild(g.domNode)}else{t.removeLazyItem(e.toolId);let{domNode:f}=n();s.value.appendChild(f)}this.finalizeCurrentThinkingPart(r,s)},c=e.state.get();if(c.type===lo.StateKind.WaitingForConfirmation||c.type===lo.StateKind.WaitingForPostApproval){l();return}if(!(g=>g===lo.StateKind.Streaming||g===lo.StateKind.Executing)(c.type))return;let p=!1,h=he(g=>{let f=e.state.read(g);if(f.type===lo.StateKind.WaitingForConfirmation||f.type===lo.StateKind.WaitingForPostApproval){if(p)return;p=!0,h.dispose(),l()}});t.addDisposable(h)}renderExtensionsContent(e,t,o){return this.instantiationService.createInstance(d2,e)}renderHookPart(e,t,o){if(!(e.stopReason||e.systemMessage))return this.renderNoContent(s=>s.kind==="hook"&&s.hookType===e.hookType);if(e.subAgentInvocationId){let s=this.getSubagentPart(o.renderedParts,e.subAgentInvocationId);if(s)return s.appendHookItem(()=>{let l=this.instantiationService.createInstance(ote,e,t);return{domNode:l.domNode,disposable:l}},e),this.renderNoContent(l=>l.kind==="hook"&&l.hookType===e.hookType&&l.subAgentInvocationId===e.subAgentInvocationId)}if(e.hookType==="PreToolUse"||e.hookType==="PostToolUse"){let s=e.stopReason?e.toolDisplayName?d(7342,null,e.toolDisplayName):d(7343,null):e.toolDisplayName?d(7344,null,e.toolDisplayName):d(7345,null),l=this.getLastThinkingPart(o.renderedParts);if(!l){let c=this.renderThinkingPart({kind:"thinking"},t,o);c instanceof vD&&(l=c)}if(l)return l.appendItem(()=>{let c=this.instantiationService.createInstance(ote,e,t);return{domNode:c.domNode,disposable:c}},s,void 0,o.value),l}return this.instantiationService.createInstance(ote,e,t)}renderPullRequestContent(e,t,o){return this.instantiationService.createInstance(KPe,e)}renderProgressTask(e,t,o){return Vi(o.element)?this.instantiationService.createInstance(qPe,e,this._contentReferencesListPool,this.chatContentMarkdownRenderer,o):void 0}renderConfirmation(e,t,o){return this.instantiationService.createInstance(PPe,t,e)}renderElicitation(e,t,o){return(t.kind==="elicitationSerialized"?t.isHidden:t.isHidden?.get())?this.renderNoContent(r=>t.kind===r.kind):(this.finalizeCurrentThinkingPart(e,o),this.instantiationService.createInstance(OPe,t,e))}renderQuestionCarousel(e,t,o){this.finalizeCurrentThinkingPart(e,o),this._notifyOnQuestionCarousel(e,t);let n=Vi(e.element)?this.chatWidgetService.getWidgetBySessionResource(e.element.sessionResource):void 0,r=n?n.getInput()==="":!0,s=n?.input.currentLanguageModel,l=Vi(e.element)?e.element.requestId:void 0,c=Vi(e.element)?this.getRequestMessageText(e.element):void 0,u=async(v,b)=>{let S=v?Object.fromEntries(v):void 0;t.data=S??{},t.isUsed=!0,t instanceof a2&&(t.draftAnswers=void 0,t.draftCurrentIndex=void 0,t.completion.complete({answers:S})),Vi(e.element)&&t.resolveId&&this.chatService.notifyQuestionCarouselAnswer(e.element.requestId,t.resolveId,S),this.removeCarouselFromTracking(e,b);let y=t.resolveId??`${l}_${e.contentIndex}`;n?.input.clearQuestionCarousel(void 0,y)},p=Vi(e.element)&&e.element.isComplete,h=n?.input.questionCarousel!==void 0;if(t.isUsed||p){p&&!t.isUsed&&Vi(e.element)&&t.resolveId&&(t.data={},t.isUsed=!0,t instanceof a2&&(t.draftAnswers=void 0,t.draftCurrentIndex=void 0,t.completion.complete({answers:void 0})),this.chatService.notifyQuestionCarouselAnswer(e.element.requestId,t.resolveId,void 0),this.pendingQuestionCarousels.get(e.element.sessionResource)?.clear()),p&&h&&l&&n?.input.clearQuestionCarousel(l);let v=this.instantiationService.createInstance(k3,t,e,{shouldAutoFocus:!1,onSubmit:async b=>u(b,v)});return v}let f=!!this.viewModel?.editing?void 0:n?.input.renderQuestionCarousel(t,e,{shouldAutoFocus:r,onSubmit:async v=>u(v,f)});if(!f){let v=this.instantiationService.createInstance(k3,t,e,{shouldAutoFocus:r,onSubmit:async b=>u(b,v)});return this.maybeAutoReplyToQuestionCarousel(e,t,v,b=>u(b,v),s,c),v}if(this.maybeAutoReplyToQuestionCarousel(e,t,f,v=>u(v,f),s,c),Vi(e.element)&&t.allowSkip&&!t.isUsed){let v=this.pendingQuestionCarousels.get(e.element.sessionResource);v||(v=new Set,this.pendingQuestionCarousels.set(e.element.sessionResource,v)),v.has(f)||(v.add(f),f.addDisposable({dispose:()=>this.removeCarouselFromTracking(e,f)}))}return this.renderNoContent((v,b,S)=>{if(t.isUsed||Vi(S)&&S.isComplete)return!1;if(v.kind==="questionCarousel"){let y=v;return t.resolveId&&y.resolveId?t.resolveId===y.resolveId:v===t}return!1})}_getCarouselStableKey(e,t){let o=Vi(e.element)?e.element.requestId:void 0;if(!(!o||!t.resolveId))return`${o}::${t.resolveId}`}_notifyOnQuestionCarousel(e,t){if(t.isUsed)return;let o=this._getCarouselStableKey(e,t);if(o&&this._notifiedQuestionCarousels.has(o))return;let n=t.questions.length,r=t.questions.length>0&&t.questions[0].message?t.questions[0].message:d(7336,null),s=typeof r=="string"?r:r.value,l=n===1?d(7335,null,s):d(7334,null,n,s);this.accessibilityService.alert(l),o&&this._notifiedQuestionCarousels.add(o);let c=n===1?d(7338,null):d(7337,null,n);this.accessibilitySignalService.playSignal($o.chatUserActionRequired,{allowManyInParallel:!0,customAlertMessage:c})}maybeAutoReplyToQuestionCarousel(e,t,o,n,r,s){if(t.isUsed)return;let l=this._getCarouselStableKey(e,t);if(l){if(this._autoRepliedQuestionCarousels.has(l))return;this._autoRepliedQuestionCarousels.add(l)}this._autoReply.shouldAutoReply().then(c=>{let u=this._isAutopilotForContext(e);if(!c&&!u){l&&this._autoRepliedQuestionCarousels.delete(l);return}let p=new $e;o.addDisposable(Z(()=>{p.cancel(),p.dispose()})),this._autoReply.autoReply(t,n,r,s,p.token).catch(h=>{this.logService.debug("#ChatQuestionCarousel: Auto reply failed",In(h))})})}getRequestMessageText(e){let t=e.requestId;return e.session.getItems().find(r=>Rr(r)&&r.id===t)?.messageText}_isAutopilotForContext(e){return!!(Vi(e.element)&&e.element.model.request?.modeInfo?.permissionLevel==="autopilot"||Vi(e.element)&&(this.chatWidgetService.getWidgetBySessionResource(e.element.sessionResource)??this.chatWidgetService.lastFocusedWidget)?.input.currentModeInfo.permissionLevel==="autopilot")}removeCarouselFromTracking(e,t){if(Vi(e.element)){let o=this.pendingQuestionCarousels.get(e.element.sessionResource);o&&o.delete(t)}}renderChangesSummary(e,t,o){return this.instantiationService.createInstance(uPe,e,t)}renderAttachments(e,t,o){return this.instantiationService.createInstance(Nee,{variables:e,contentReferences:t,domNode:void 0})}renderTextEdit(e,t,o){return this.instantiationService.createInstance(jPe,t,e,this.rendererOptions,this._diffEditorPool,this._currentLayoutWidth.get())}renderMarkdown(e,t,o){let n=o.element,r=Vi(n)&&n.isComplete&&!n.renderData,s=r?o.content.findLastIndex(g=>g.kind==="thinking"||g.kind==="toolInvocation"||g.kind==="toolInvocationSerialized"):-1,l=r&&o.contentIndex>s;(!this.hasEditCodeblockUri(e)||l)&&this.finalizeCurrentThinkingPart(o,t);let c=Vi(n)&&(!n.isComplete||n.isCanceled||n.errorDetails?.responseIsFiltered||n.errorDetails?.responseIsIncomplete||!!n.renderData),u=o.codeBlockStartIndex,p=t.instantiationService.createInstance(lT,e,o,this._editorPool,c,u,this.chatContentMarkdownRenderer,void 0,this._currentLayoutWidth.get(),this.codeBlockModelCollection,{});p.addDisposable(p.onDidChangeHeight(()=>this.fireItemHeightChange(t))),Rr(n)&&(p.domNode.tabIndex=0,this.configService.getValue("chat.editRequests")==="inline"&&this.rendererOptions.editable&&(p.domNode.classList.add("clickable"),p.addDisposable(j(p.domNode,re.CLICK,g=>{if(this.viewModel?.editing?.id===n.id)return;let f=g.target;if(f.tagName==="A")return;let v=Me(t.rowContainer).getSelection();if(v&&!v.isCollapsed&&v.toString().length>0)return;let b=Nh(f,"monaco-editor");b&&Array.from(this.editorsInUse()).find(y=>y.element.contains(b))?.editor.getSelection()?.isEmpty()===!1||(g.preventDefault(),g.stopPropagation(),this._onDidClickRequest.fire(t))})),p.addDisposable(this.hoverService.setupManagedHover(Ni("element"),p.domNode,d(7357,null),{trapFocus:!0}))),p.addDisposable(j(p.domNode,re.FOCUS,()=>{this.hoverVisible(t.requestHover)})),p.addDisposable(j(p.domNode,re.BLUR,()=>{this.hoverHidden(t.requestHover)}))),this.handleRenderedCodeblocks(n,p,u);let h=this.configService.getValue("chat.agent.thinking.collapsedTools");if(Vi(o.element)&&h!=="off"&&!l){let g=this.isCodeblockComplete(e,o.element),f=Odo(e.content.value);if(f){let b=this.getSubagentPart(t.renderedParts,f);if(b&&p?.domNode&&g)return b.appendMarkdownItem(()=>({domNode:p.domNode,disposable:p}),p.codeblocksPartId,e,t.value),b}let v=this.getLastThinkingPart(t.renderedParts);if(!v&&p?.domNode&&this.shouldPinPart(e,o.element)&&h==="always"&&g){let b=this.renderThinkingPart({kind:"thinking"},o,t);return b instanceof vD&&b.appendItem(()=>({domNode:p.domNode,disposable:p}),p.codeblocksPartId,e,t.value),b}this.shouldPinPart(e,o.element)&&g?v&&p?.domNode&&v.appendItem(()=>({domNode:p.domNode,disposable:p}),p.codeblocksPartId,e,t.value):this.shouldPinPart(e,o.element)||this.finalizeCurrentThinkingPart(o,t)}return p}renderThinkingPart(e,t,o){e.id||(e.id=Date.now().toString());let n=Vi(t.element)?t.element:void 0,r=this.isThinkingLookAheadComplete(t,n);if(Array.isArray(e.value)){if(e.value.length<1)return this.getLastThinkingPart(o.renderedParts)?.finalizeTitleIfDefault(),this.renderNoContent(c=>e.kind===c.kind);let s;for(let l of e.value)if(l){let c=s instanceof vD&&s.getIsActive()?s:void 0;if(c)c.setupThinkingContainer({...e,value:l});else{let u={...e,value:l};s=o.instantiationService.createInstance(vD,u,t,this.chatContentMarkdownRenderer,r)}}return s??this.renderNoContent(l=>e.kind===l.kind)}else{let s=this.getLastThinkingPart(o.renderedParts);return s?(s.setupThinkingContainer(e),s):o.instantiationService.createInstance(vD,e,t,this.chatContentMarkdownRenderer,r)}}disposeElement(e,t,o,n){this.traceLayout("disposeElement",`Disposing element, index=${t}`),o.elementDisposables.clear(),o.currentElement&&!this.viewModel?.editing&&this.templateDataByRequestId.delete(o.currentElement.id),Rr(e.element)&&e.element.id===this.viewModel?.editing?.id&&n?.onScroll&&this._onDidDispose.fire(o),o.titleToolbar&&(o.titleToolbar.context=void 0),o.footerToolbar.context=void 0,o.checkpointToolbar.context=void 0,o.checkpointRestoreToolbar.context=void 0}renderMcpServersInteractionRequired(e,t,o){return this.instantiationService.createInstance(HPe,e,t)}renderDisabledClaudeHooks(e,t){return this.instantiationService.createInstance(UPe,t)}disposeTemplate(e){this.clearRenderedParts(e),e.templateDisposables.dispose()}hoverVisible(e){e.style.opacity="1"}hoverHidden(e){e.style.opacity="0"}};A3=I([m(6,F),m(7,B),m(8,ne),m(9,X),m(10,De),m(11,ge),m(12,tt),m(13,At),m(14,vr),m(15,Si),m(16,tr),m(17,Bi),m(18,Vt)],A3);var YHt=class extends d1{constructor(e){super();this.defaultElementHeight=e}estimateHeight(e){return e.currentRenderedHeight??this.defaultElementHeight}getTemplateId(e){return A3.ID}hasDynamicHeight(e){return!0}},lmo={incorrectCode:d(7347,null),didNotFollowInstructions:d(7341,null),missingContext:d(7348,null),offensiveOrUnsafe:d(7349,null),poorlyWrittenOrFormatted:d(7351,null),refusedAValidRequest:d(7354,null),incompleteCode:d(7346,null),willReportIssue:d(7356,null),other:d(7350,null)},jme=class extends wp{constructor(e,t,o,n,r,s){super(e,{getActions:()=>this.getActions()},s,{...t,classNames:q.asClassNameArray(M.thumbsdown)});this.commandService=o;this.issueService=n;this.logService=r}getActions(){return[this.getVoteDownDetailAction("incorrectCode"),this.getVoteDownDetailAction("didNotFollowInstructions"),this.getVoteDownDetailAction("incompleteCode"),this.getVoteDownDetailAction("missingContext"),this.getVoteDownDetailAction("poorlyWrittenOrFormatted"),this.getVoteDownDetailAction("refusedAValidRequest"),this.getVoteDownDetailAction("offensiveOrUnsafe"),this.getVoteDownDetailAction("other"),{id:"reportIssue",label:lmo.willReportIssue,tooltip:"",enabled:!0,class:void 0,run:async e=>{if(!Vi(e)){this.logService.error("ChatVoteDownButton#run: invalid context");return}await this.commandService.executeCommand(mee,e,"willReportIssue"),await this.issueService.openReporter({extensionId:e.agent?.extensionId.value})}}]}render(e){super.render(e),this.element?.classList.toggle("checked",this.action.checked)}getVoteDownDetailAction(e){let t=lmo[e];return{id:mee,label:t,tooltip:"",enabled:!0,checked:this._context.voteDownReason===e,class:void 0,run:async o=>{if(!Vi(o)){this.logService.error("ChatVoteDownButton#getVoteDownDetailAction: invalid context");return}await this.commandService.executeCommand(mee,o,e)}}}};jme=I([m(2,ge),m(3,UC),m(4,ne),m(5,ze)],jme);function _ki(a){return a.toolSpecificData?.kind==="subagent"&&!a.subAgentInvocationId}function dmo(a){return _ki(a)?a.toolCallId:a.subAgentInvocationId}function cmo(a){return!!dmo(a)}var XHt=ae("chatLayoutService");function Y9o(){return{applyingInstructionsCount:0,referencedInstructionsCount:0,agentInstructionsCount:0,listedInstructionsCount:0,totalInstructionsCount:0,claudeRulesCount:0,claudeMdCount:0,claudeAgentsCount:0}}var nte=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g){this._modeKind=i;this._enabledTools=e;this._enabledSubagents=t;this._sessionResource=o;this._promptsService=n;this._logService=r;this._labelService=s;this._configurationService=l;this._workspaceService=c;this._fileService=u;this._remoteAgentService=p;this._telemetryService=h;this._languageModelToolsService=g;this._parseResults=new vt}async _parseInstructionsFile(i,e){if(this._parseResults.has(i))return this._parseResults.get(i);try{let t=await this._promptsService.parseNew(i,e);return this._parseResults.set(i,t),t}catch(t){this._logService.error(`[InstructionsContextComputer] Failed to parse instruction file: ${i}`,t);return}}async collect(i,e){let t=await this._promptsService.getInstructionFiles(e,this._sessionResource);this._logService.trace(`[InstructionsContextComputer] ${t.length} instruction files available.`);let o=Y9o(),n=this._getContext(i);await this.addApplyingInstructions(t,n,i,o,e),await this._addReferencedInstructions(i,o,e),await this._addAgentInstructions(i,o,e);let r=await this._getInstructionsWithPatternsList(t,i,o,e);r&&(i.add(r),o.listedInstructionsCount++),this.sendTelemetry(o)}sendTelemetry(i){i.totalInstructionsCount=i.agentInstructionsCount+i.referencedInstructionsCount+i.applyingInstructionsCount+i.listedInstructionsCount,this._telemetryService.publicLog2("instructionsCollected",i)}async addApplyingInstructions(i,e,t,o,n){if(!this._configurationService.getValue(Ts.INCLUDE_APPLYING_INSTRUCTIONS)&&this._modeKind!=="edit"){this._logService.trace("[InstructionsContextComputer] includeApplyingInstructions is disabled and agent kind is not Edit. No applying instructions will be added.");return}for(let{uri:s}of i){let l=await this._parseInstructionsFile(s,n);if(!l){this._logService.trace(`[InstructionsContextComputer] Unable to read: ${s}`);continue}let c=l.header?.applyTo,u=l.header?.paths,p=oee(s),h=p?u?.join(", ")??"**":c;if(!h){this._logService.trace(`[InstructionsContextComputer] No 'applyTo' found: ${s}`);continue}if(e.instructions.has(s)){this._logService.trace(`[InstructionsContextComputer] Skipping already processed instruction file: ${s}`);continue}let g=this._matches(e.files,h);if(g){this._logService.trace(`[InstructionsContextComputer] Match for ${s} with ${g.pattern}${g.file?` for file ${g.file}`:""}`);let f=g.file?d(7657,null,h,this._labelService.getUriLabel(g.file,{relative:!0})):d(7655,null);t.add(mP(s,"vscode.prompt.instructions.root",f,!0)),o.applyingInstructionsCount++,p&&o.claudeRulesCount++}else this._logService.trace(`[InstructionsContextComputer] No match for ${s} with ${h}`)}}_getContext(i){let e=new Mn,t=new Mn;for(let o of i.asArray())if(pP(o))t.add(o.value);else{let n=uV.toUri(o);n&&e.add(n)}return{files:e,instructions:t}}async _addAgentInstructions(i,e,t){let o={logInfo:l=>this._logService.trace(`[InstructionsContextComputer] ${l}`)},n=await this._promptsService.listAgentInstructions(t,o),r=new Uj,s=new Uj;for(let{uri:l,type:c}of n){let u=mP(l,"vscode.prompt.instructions.root",void 0,!0);r.add(u),c==="copilotInstructionsMd"&&s.add(u),e.agentInstructionsCount++,c==="claudeMd"&&e.claudeMdCount++,o.logInfo(`Agent instruction file added: ${l.toString()}`)}if(s.length>0){await this._addReferencedInstructions(s,e,t);for(let l of s.asArray())i.add(l)}for(let l of r.asArray())i.add(l)}_getApplyToPattern(i,e){if(i)return i;if(e&&e.length>0)return e.join(", ")}_matches(i,e){let t=HL(e,","),o=n=>{if(n=n.trim(),n.length!==0){if(n==="**"||n==="**/*"||n==="*")return{pattern:n};!n.startsWith("/")&&!n.startsWith("**/")&&(n="**/"+n);for(let r of i)if(Cp(n,r.path,{ignoreCase:!0}))return{pattern:n,file:r}}};for(let n of t){let r=o(n);if(r)return r}}_getTool(i){if(!this._enabledTools)return;let e=this._languageModelToolsService.getToolByName(i);if(e&&this._enabledTools[e.id])return{tool:e,variable:`#tool:${this._languageModelToolsService.getFullReferenceName(e)}`}}async _getInstructionsWithPatternsList(i,e,t,o){let n=this._getTool("readFile"),r=this._getTool(Kj.runSubagent),l=(await this._remoteAgentService.getEnvironment())?.os,c=f=>X9o(f,l),u=[];if(n){let v=this._configurationService.getValue(Ts.USE_NESTED_AGENT_MD)?this._promptsService.listNestedAgentMDs(o):Promise.resolve([]);u.push("<instructions>"),u.push("Here is a list of instruction files that contain rules for working with this codebase."),u.push("These files are important for understanding the codebase structure, conventions, and best practices."),u.push("Please make sure to follow the rules specified in these files when working with the codebase."),u.push(`If the file is not already available as attachment, use the ${n.variable} tool to acquire it.`),u.push("Make sure to acquire the instructions before working with the codebase.");let b=!1;for(let{uri:k}of i){let T=await this._parseInstructionsFile(k,o);if(T){if(u.push("<instruction>"),T.header){let{description:N,applyTo:O,paths:V}=T.header;N&&u.push(`<description>${N}</description>`),u.push(`<file>${c(k)}</file>`);let U=this._getApplyToPattern(O,V);U&&u.push(`<applyTo>${U}</applyTo>`)}else u.push(`<file>${c(k)}</file>`);u.push("</instruction>"),b=!0}}let S=await v;for(let{uri:k}of S){let T=this._labelService.getUriLabel(ci(k),{relative:!0}),N=T.trim().length===0?d(7654,null):d(7653,null,T);u.push("<instruction>"),u.push(`<description>${N}</description>`),u.push(`<file>${c(k)}</file>`),u.push("</instruction>"),b=!0}b?u.push("</instructions>","",""):u.length=0;let w=(await this._promptsService.findAgentSkills(o,this._sessionResource))?.filter(k=>!k.disableModelInvocation);if(w&&w.length>0){let k=this._configurationService.getValue(Ts.USE_SKILL_ADHERENCE_PROMPT);u.push("<skills>"),k?(u.push("Skills provide specialized capabilities, domain knowledge, and refined workflows for producing high-quality outputs. Each skill folder contains tested instructions for specific domains like testing strategies, API design, or performance optimization. Multiple skills can be combined when a task spans different domains."),u.push(`BLOCKING REQUIREMENT: When a skill applies to the user's request, you MUST load and read the SKILL.md file IMMEDIATELY as your first action, BEFORE generating any other response or taking action on the task. Use ${n.variable} to load the relevant skill(s).`),u.push("NEVER just mention or reference a skill in your response without actually reading it first. If a skill is relevant, load it before proceeding."),u.push("How to determine if a skill applies:"),u.push("1. Review the available skills below and match their descriptions against the user's request"),u.push("2. If any skill's domain overlaps with the task, load that skill immediately"),u.push("3. When multiple skills apply (e.g., a flowchart in documentation), load all relevant skills"),u.push("Examples:"),u.push(`- "Help me write unit tests for this module" -> Load the testing skill via ${n.variable} FIRST, then proceed`),u.push(`- "Optimize this slow function" -> Load the performance-profiling skill via ${n.variable} FIRST, then proceed`),u.push('- "Add a discount code field to checkout" -> Load both the checkout-flow and form-validation skills FIRST'),u.push("Available skills:")):(u.push("Here is a list of skills that contain domain specific knowledge on a variety of topics."),u.push("Each skill comes with a description of the topic and a file path that contains the detailed instructions."),u.push(`When a user asks you to perform a task that falls within the domain of a skill, use the ${n.variable} tool to acquire the full instructions from the file URI.`));for(let T of w)u.push("<skill>"),u.push(`<name>${T.name}</name>`),T.description&&u.push(`<description>${T.description}</description>`),u.push(`<file>${c(T.uri)}</file>`),u.push("</skill>");u.push("</skills>","","")}}if(r&&this._configurationService.getValue("chat.customAgentInSubagent.enabled")){let f=(()=>{if(!this._enabledSubagents||this._enabledSubagents.includes("*"))return b=>b.visibility.agentInvocable;{let b=this._enabledSubagents;return S=>b.includes(S.name)}})(),v=await this._promptsService.getCustomAgents(o,this._sessionResource);if(v.length>0){u.push("<agents>"),u.push("Here is a list of agents that can be used when running a subagent."),u.push("Each agent has optionally a description with the agent's purpose and expertise. When asked to run a subagent, choose the most appropriate agent from this list."),u.push(`Use the ${r.variable} tool with the agent name to run the subagent.`);for(let b of v)f(b)&&(u.push("<agent>"),u.push(`<name>${b.name}</name>`),b.description&&u.push(`<description>${b.description}</description>`),b.argumentHint&&u.push(`<argumentHint>${b.argumentHint}</argumentHint>`),u.push("</agent>"),oBt(b.uri)&&t.claudeAgentsCount++);u.push("</agents>","","")}}if(u.length===0)return;let p=u.join(`
`),h=[],g=f=>{if(f){let v=p.indexOf(f.variable);for(;v>=0;)h.push(Dce(f.tool,new di(v,v+f.variable.length))),v=p.indexOf(f.variable,v+1)}};return g(n),g(r),kYi(p,!0,h)}async _addReferencedInstructions(i,e,t){if(!this._configurationService.getValue(Ts.INCLUDE_REFERENCED_INSTRUCTIONS)&&this._modeKind!=="edit"){this._logService.trace("[InstructionsContextComputer] includeReferencedInstructions is disabled and agent kind is not Edit. No referenced instructions will be added.");return}let n=new Mn,r=[];for(let l of i.asArray())pP(l)&&(n.has(l.value)||(r.push(l.value),n.add(l.value)));let s=r.pop();for(;s;){let l=await this._parseInstructionsFile(s,t);if(l&&l.body){let c=[];for(let u of l.body.fileReferences){let p=l.body.resolveFilePath(u.content);p&&!n.has(p)&&(uCi(p)||this._workspaceService.getWorkspaceFolder(p)!==void 0)&&(c.push({resource:p}),n.add(p))}if(c.length>0){let u=await this._fileService.resolveAll(c);for(let p=0;p<u.length;p++){let h=u[p],g=c[p].resource;if(h.success&&h.stat?.isFile){uCi(g)&&r.push(g);let f=d(7656,null,Ye(s));i.add(mP(g,"vscode.prompt.instructions",f,!0)),e.referencedInstructionsCount++,this._logService.trace(`[InstructionsContextComputer] ${g.toString()} added, referenced by ${s.toString()}`)}}}}s=r.pop()}}};nte=I([m(4,nr),m(5,ne),m(6,ot),m(7,B),m(8,Pe),m(9,be),m(10,yo),m(11,Te),m(12,jn)],nte);function X9o(a,i){if(a.scheme===Y.file||a.scheme===Y.vscodeRemote){let e=a.fsPath;return i!==void 0?i===1?e.replace(/\//g,"\\"):e.replace(/\\/g,"/"):e}return a.toString()}var wAe=class extends C{constructor(e,t){super();this.contextMenuService=e;this.chatSessionsService=t;this._onDidChangeHeight=this._register(new E);this.onDidChangeHeight=this._onDidChangeHeight.event;this._onDidSelectPrompt=this._register(new E);this.onDidSelectPrompt=this._onDidSelectPrompt.event;this.buttonDisposables=new Map;this.domNode=this.createSuggestNextWidget()}get height(){return this.domNode.style.display==="none"?0:this.domNode.offsetHeight}getCurrentMode(){return this._currentMode}createSuggestNextWidget(){let e=_(".chat-suggest-next-widget.chat-welcome-view-suggested-prompts");return e.style.display="none",this.titleElement=R(e,_(".chat-welcome-view-suggested-prompts-title")),this.promptsContainer=e,e}render(e){let t=e.handOffs?.get();if(!t||t.length===0){this.hide();return}this._currentMode=e;let o=e.name.get()||e.label.get()||d(7196,null);this.titleElement.textContent=d(7197,null,o);let n=[];for(let r=1;r<this.promptsContainer.children.length;r++)n.push(this.promptsContainer.children[r]);for(let r of n){let s=this.buttonDisposables.get(r);s&&(s.dispose(),this.buttonDisposables.delete(r)),this.promptsContainer.removeChild(r)}for(let r of t){let s=this.createPromptButton(r);this.promptsContainer.appendChild(s)}this.domNode.style.display="flex",this._onDidChangeHeight.fire()}createPromptButton(e){let t=new P,o=e.label,n=()=>this._currentMode?.handOffs?.get()?.find(h=>h.label===o)??e,r=_(".chat-welcome-view-suggested-prompt");r.setAttribute("tabindex","0"),r.setAttribute("role","button"),r.setAttribute("aria-label",d(7198,null,e.label));let s=R(r,_(".chat-welcome-view-suggested-prompt-title"));s.textContent=e.label;let l=e.showContinueOn??!0,u=this.chatSessionsService.getAllChatSessionContributions().filter(p=>{if(!p.canDelegate)return!1;let h=Rf(p.type);return h!==void 0&&uTt(h)});if(l&&u.length>0){r.classList.add("chat-suggest-next-has-dropdown");let p=R(r,_(".chat-suggest-next-dropdown"));p.setAttribute("tabindex","0"),p.setAttribute("role","button"),p.setAttribute("aria-label",d(7199,null,e.label)),p.setAttribute("aria-haspopup","true"),R(p,_(".chat-suggest-next-separator")).setAttribute("aria-hidden","true"),R(p,_(".codicon.codicon-chevron-down.dropdown-chevron")).setAttribute("aria-hidden","true");let f=(v,b)=>{v.preventDefault(),v.stopPropagation();let S=u.map(y=>{let w=Rf(y.type),k=A_(w),T=XS(w);return new st(y.type,d(7200,null,T),q.isThemeIcon(k)?q.asClassName(k):void 0,!0,()=>{let N=n();N&&this._onDidSelectPrompt.fire({handoff:N,agentId:y.name})})});this.contextMenuService.showContextMenu({getAnchor:()=>b||p,getActions:()=>S,autoSelectFirstItem:!0})};t.add(j(p,"click",v=>{f(v,p)})),t.add(j(p,"keydown",v=>{(v.key==="Enter"||v.key===" ")&&f(v,p)})),t.add(j(r,"click",v=>{if(Ao(v.target)&&v.target.closest(".chat-suggest-next-dropdown"))return;let b=n();b&&this._onDidSelectPrompt.fire({handoff:b})}))}else t.add(j(r,"click",()=>{let p=n();p&&this._onDidSelectPrompt.fire({handoff:p})}));return t.add(j(r,"keydown",p=>{if(p.key==="Enter"||p.key===" "){p.preventDefault();let h=n();h&&this._onDidSelectPrompt.fire({handoff:h})}})),this.buttonDisposables.set(r,t),r}hide(){this.domNode.style.display!=="none"&&(this._currentMode=void 0,this.domNode.style.display="none",this._onDidChangeHeight.fire())}dispose(){for(let e of this.buttonDisposables.values())e.dispose();this.buttonDisposables.clear(),super.dispose()}};wAe=I([m(0,ze),m(1,Ls)],wAe);function umo(a,i,e,t,o){return i&&i!=="local"&&JHt(a,i)?a.filter(n=>n.metadata?.targetChatSessionType===i&&n.metadata?.isUserSelectable):a.filter(n=>!n.metadata?.targetChatSessionType&&n.metadata?.isUserSelectable&&Lki(n,e)&&Rki(n,t,o))}function Lki(a,i){return i==="agent"?R_.suitableForAgentMode(a.metadata):!0}function Rki(a,i,e){return i!=="editor"||!e?!0:!!a.metadata.capabilities?.toolCalling}function JHt(a,i){return i?a.some(e=>e.metadata.targetChatSessionType===i):!1}function ZHt(a,i,e){return JHt(i,e)?a.metadata.targetChatSessionType===e:!a.metadata.targetChatSessionType}function pmo(a,i){return a.find(e=>e.metadata.isDefaultForLocation[i])||a[0]}function Mki(a,i,e,t){let o=e.find(n=>n.identifier===a);return o?!i||o.metadata.isDefaultForLocation[t]?{shouldRestore:!0,model:o}:{shouldRestore:!1,model:o}:{shouldRestore:!1,model:void 0}}function mmo(a,i,e,t){return!a||!i.some(o=>o.identifier===a.identifier)||!Lki(a,e.currentModeKind)||!Rki(a,e.location,e.isInlineChatV2Enabled)||!ZHt(a,t,e.sessionType)}function hmo(a,i,e,t,o){if(i&&i.identifier===a.identifier)return{action:"keep"};if(!ZHt(a,e,t))return{action:"default"};if(o){if(!Lki(a,o.currentModeKind))return{action:"default"};if(!Rki(a,o.location,o.isInlineChatV2Enabled))return{action:"default"}}return{action:"apply"}}function gmo(a,i,e){if(a.length>0){let t=new Set(a.map(o=>o.metadata.vendor));return[...a,...i.filter(o=>!t.has(o.metadata.vendor)&&e.has(o.metadata.vendor))]}return i}function fmo(a,i){return a?!i.some(e=>e.identifier===a):!0}function vmo(a,i,e,t){return e.metadata.isUserSelectable?Mki(a,i,[e],t).shouldRestore:!1}var CAe=class extends C{constructor(e,t,o){super();this.fileService=e;this.webContentExtractorService=t;this.chatAttachmentResolveService=o;this._attachments=new Map;this._fileWatchers=this._register(new jt);this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event}get attachments(){return Array.from(this._attachments.values())}get size(){return this._attachments.size}get fileAttachments(){return this.attachments.filter(e=>e.kind==="file"&&A.isUri(e.value)).map(e=>e.value)}getAttachmentIDs(){return new Set(this._attachments.keys())}async addFile(e,t){if(/\.(png|jpe?g|gif|bmp|webp)$/i.test(e.path)){let o=await this.asImageVariableEntry(e);o&&this.addContext(o);return}else this.addContext(this.asFileVariableEntry(e,t))}addFolder(e){this.addContext({kind:"directory",value:e,id:e.toString(),name:Ye(e)})}clear(e=!1){if(e){let t=Array.from(this._attachments.keys());this._attachments.clear(),this._fileWatchers.clearAndDisposeAll(),this._onDidChange.fire({deleted:t,added:[],updated:[]})}else{let t=[],o=Array.from(this._attachments.keys());for(let n of o){let r=this._attachments.get(n);r&&!pP(r)&&(this._attachments.delete(n),this._fileWatchers.deleteAndDispose(n),t.push(n))}this._onDidChange.fire({deleted:t,added:[],updated:[]})}}addContext(...e){e=e.filter(t=>!this._attachments.has(t.id)),this.updateContext(ht.empty(),e)}clearAndSetContext(...e){this.updateContext(Array.from(this._attachments.keys()),e)}delete(...e){this.updateContext(e,ht.empty())}updateContext(e,t){let o=[],n=[],r=[];for(let s of e)this._attachments.get(s)&&(this._attachments.delete(s),o.push(s),this._fileWatchers.deleteAndDispose(s));for(let s of t){let l=this._attachments.get(s.id);l?uo(l,s)||(this._fileWatchers.deleteAndDispose(s.id),this._attachments.set(s.id,s),r.push(s),this._watchAttachment(s)):(this._attachments.set(s.id,s),n.push(s),this._watchAttachment(s))}(o.length>0||n.length>0||r.length>0)&&this._onDidChange.fire({deleted:o,added:n,updated:r})}_watchAttachment(e){let t=uV.toUri(e);if(!t||t.scheme!==Y.file)return;let o=this.fileService.createWatcher(t,{recursive:!1,excludes:[]}),n=o.onDidChange(r=>{r.contains(t,2)&&this.updateContext([e.id],ht.empty())});this._fileWatchers.set(e.id,hn(n,o))}asFileVariableEntry(e,t){return{kind:"file",value:t?{uri:e,range:t}:e,id:e.toString()+(t?.toString()??""),name:Ye(e)}}async asImageVariableEntry(e){if(e.scheme===Y.file&&await this.fileService.canHandleResource(e))return await this.chatAttachmentResolveService.resolveImageEditorAttachContext(e);if(e.scheme===Y.http||e.scheme===Y.https){let t=await this.webContentExtractorService.readImage(e,ve.None);if(t)return await this.chatAttachmentResolveService.resolveImageEditorAttachContext(e,t)}}};CAe=I([m(0,be),m(1,t2),m(2,jF)],CAe);var Qme=class extends C{constructor(e,t,o,n,r,s,l,c){super();this.codeEditorService=e;this.editorService=t;this.chatWidgetService=o;this.chatService=n;this.chatEditingService=r;this.configurationService=s;this.ignoredFilesService=l;this.chatContextService=c;this._currentCancelTokenSource=this._register(new me),this._implicitContextEnablement=this.configurationService.getValue("chat.implicitContext.enabled");let u=this._register(new P);this._register(H.runAndSubscribe(t.onDidActiveEditorChange,(()=>{u.clear();let p=this.findActiveCodeEditor();p&&u.add(H.debounce(H.any(p.onDidChangeModel,p.onDidChangeModelLanguage,p.onDidChangeCursorSelection,p.onDidScrollChange),()=>{},500)(()=>this.updateImplicitContext()));let h=this.findActiveNotebookEditor();if(h){let f=u.add(new P);u.add(h.onDidChangeActiveCell(()=>{f.clear();let v=this.codeEditorService.getActiveCodeEditor();v&&v.getModel()?.uri.scheme===Y.vscodeNotebookCell&&f.add(H.debounce(H.any(v.onDidChangeModel,v.onDidChangeCursorSelection,v.onDidScrollChange),()=>{},500)(()=>this.updateImplicitContext()))})),u.add(H.debounce(H.any(h.onDidChangeModel,h.onDidChangeActiveCell),()=>{},500)(()=>this.updateImplicitContext()))}let g=this.findActiveWebviewEditor();g&&u.add(H.debounce(g.input.webview.onMessage,()=>{},500)(()=>{this.updateImplicitContext()})),this.updateImplicitContext()}))),this._register(he(p=>{this.chatEditingService.editingSessionsObs.read(p),this.updateImplicitContext()})),this._register(this.configurationService.onDidChangeConfiguration(p=>{p.affectsConfiguration("chat.implicitContext.enabled")&&(this._implicitContextEnablement=this.configurationService.getValue("chat.implicitContext.enabled"),this.updateImplicitContext())})),this._register(this.chatService.onDidSubmitRequest(({chatSessionResource:p})=>{let h=this.chatWidgetService.getWidgetBySessionResource(p);h?.input.implicitContext&&this._implicitContextEnablement[h.location]==="first"&&h.viewModel?.getItems().length!==0&&h.input.implicitContext.setValues([])})),this._register(this.chatWidgetService.onDidAddWidget(async p=>{await this.updateImplicitContext(p)}))}static{this.ID="chat.implicitContext"}findActiveCodeEditor(){let e=this.codeEditorService.getActiveCodeEditor();if(e){let t=e.getModel();if(t?.uri.scheme===Y.vscodeNotebookCell)return;if(t)return e}for(let t of this.editorService.getVisibleTextEditorControls(0)){let o=ca(t);if(!o)continue;if(o.getModel())return o}}findActiveWebviewEditor(){let e=this.editorService.activeEditorPane;if(e?.input instanceof wu)return e}findActiveNotebookEditor(){return qn(this.editorService.activeEditorPane)}async updateImplicitContext(e){let t=this._currentCancelTokenSource.value=new $e,o=this.findActiveCodeEditor(),n=o?.getModel(),r=o?.getSelection(),s,l=!1,c,u;if(n){if(c=n.getLanguageId(),r&&!r.isEmpty())s={uri:n.uri,range:r},l=!0;else if(this.configurationService.getValue("chat.implicitContext.suggestedContext"))s=n.uri;else{let b=o?.getVisibleRanges();if(b&&b.length>0){let S=b[0];b.slice(1).forEach(y=>{S=S.plusRange(y)}),s={uri:n.uri,range:S}}else s=n.uri}u=await this.chatContextService.contextForResource(n.uri,c)}let p=this.findActiveNotebookEditor();if(p?.isReplHistory)s=void 0;else if(p){let b=p.getActiveCell();if(b){let S=this.codeEditorService.getActiveCodeEditor(),y=S?.getSelection(),w=S?.getVisibleRanges()||[];s=b.uri;let k=S?.getModel();if(k&&Xe(k.uri,b.uri)){if(y&&!y.isEmpty())s={uri:b.uri,range:y},l=!0;else if(w.length>0&&!J9o(k,w)){let T=w[0];w.slice(1).forEach(N=>{T=T.plusRange(N)}),s={uri:b.uri,range:T}}}}else s=p.textModel?.uri}let h=this.findActiveWebviewEditor();if(h?.input?.resource){let b=await this.chatContextService.contextForResource(h.input.resource);b&&(s=b)}let g=s instanceof A?s:qx(s)?void 0:s?.uri;if(g&&(await this.ignoredFilesService.fileIsIgnored(g,t.token)||g.path.endsWith(".copilotmd"))&&(s=void 0),t.token.isCancellationRequested)return;let f=c&&Mf(c)!==void 0,v=e?[e]:[...this.chatWidgetService.getWidgetsByLocations("panel"),...this.chatWidgetService.getWidgetsByLocations("editor")];for(let b of v){if(!b.input.implicitContext)continue;let S=this._implicitContextEnablement[b.location],y=b.viewModel?.getItems().length===0;if((S==="always"||S==="first"&&y)&&!f){let w=!!this.editorService.activeEditor;(s!==void 0||!b.input.implicitContext.hasValue||!w)&&b.input.implicitContext.setValues([{value:s,isSelection:l},{value:u,isSelection:!1}])}else b.input.implicitContext.setValues([])}}};Qme=I([m(0,Kt),m(1,ee),m(2,At),m(3,Si),m(4,dl),m(5,B),m(6,jxe),m(7,Q_)],Qme);function J9o(a,i){return i.length===1&&i[0].startLineNumber===1&&i[0].startColumn===1&&i[0].endLineNumber===a.getLineCount()&&i[0].endColumn===a.getLineMaxColumn(i[0].endLineNumber)}var eUt=class extends C{constructor(){super(...arguments);this._onDidChangeValue=this._register(new E);this.onDidChangeValue=this._onDidChangeValue.event;this._values=this._register(new jt);this._valuesDisposables=this._register(new P);this._enabled=!1}setValues(e){if(this._valuesDisposables.clear(),this._values.clearAndDisposeAll(),!e||e.length===0){this._onDidChangeValue.fire();return}let t=e.filter(o=>o.value!==void 0);for(let o of t){let n=new Pki;n.setValue(o.value,o.isSelection),n.enabled=this._enabled;let r=new P;r.add(n.onDidChangeValue(()=>{this._onDidChangeValue.fire()})),r.add(n),this._values.set(n,r)}this._onDidChangeValue.fire()}get values(){return Array.from(this._values.keys())}get hasEnabled(){return Array.from(this._values.keys()).some(e=>e.enabled)}setEnabled(e){this._enabled=e,this.values.forEach(t=>t.enabled=e)}get hasValue(){return this.values.some(e=>e.value!==void 0)}get hasNonUri(){return this.values.some(e=>e.value!==void 0&&!A.isUri(e.value))}getLocations(){return this.values.filter(e=>nv(e.value)).map(e=>e.value)}getUris(){return this.values.filter(e=>A.isUri(e.value)).map(e=>e.value)}get hasNonStringContext(){return this.values.some(e=>e.value!==void 0&&!qx(e.value))}enabledBaseEntries(e){return this.values.flatMap(t=>t.enabled||e&&nv(t.value)?t.toBaseEntries():[])}},Pki=class extends C{constructor(){super(...arguments);this.kind="implicit";this.isFile=!0;this._isSelection=!1;this._onDidChangeValue=this._register(new E);this.onDidChangeValue=this._onDidChangeValue.event;this._enabled=!1}get id(){return A.isUri(this.value)?"vscode.implicit.file":qx(this.value)?"vscode.implicit.string":this.value?this._isSelection?"vscode.implicit.selection":"vscode.implicit.viewport":"vscode.implicit"}get name(){if(A.isUri(this.value))return`file:${Ye(this.value)}`;if(nv(this.value))return`file:${Ye(this.value.uri)}`;if(qx(this.value)){if(this.value.name===void 0&&this.value.resourceUri===void 0)throw new Error("ChatContextItem must have either a label or a resourceUri");return this.value.name??Ye(this.value.resourceUri)}return"implicit"}get modelDescription(){if(A.isUri(this.value))return"User's active file";if(qx(this.value)){if(this.value.name===void 0&&this.value.resourceUri===void 0)throw new Error("ChatContextItem must have either a label or a resourceUri");let e=this.value.name??Ye(this.value.resourceUri);return this.value.modelDescription??`User's active context from ${e}`}else return this._isSelection?"User's active selection":"User's current visible code"}get isSelection(){return this._isSelection}get value(){return this._value}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._onDidChangeValue.fire()}get uri(){return qx(this.value)?this.value.uri:this._uri}get icon(){if(qx(this.value))return this.value.icon}setValue(e,t){qx(e)?this._value=e:(this._value=e,this._uri=A.isUri(e)?e:e?.uri),this._isSelection=t,this._onDidChangeValue.fire()}toBaseEntries(){return this.value?qx(this.value)?[{kind:"string",id:this.id,name:this.name,value:this.value.value??this.name,modelDescription:this.modelDescription,icon:this.value.icon,uri:this.value.uri,resourceUri:this.value.resourceUri,handle:this.value.handle,commandId:this.value.commandId}]:[{kind:"file",id:this.id,name:this.name,value:this.value,modelDescription:this.modelDescription}]:[]}};var xAe=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super();this.widgetRef=e;this.isAttachmentAlreadyAttached=t;this.attachment=o;this.resourceLabels=n;this.attachmentModel=r;this.domNode=s;this.contextKeyService=l;this.contextMenuService=c;this.labelService=u;this.menuService=p;this.fileService=h;this.languageService=g;this.modelService=f;this.hoverService=v;this.configService=b;this.chatContextService=S;this.renderDisposables=this._register(new P);this.renderedCount=0;this.render()}render(){this.renderDisposables.clear(),this.renderedCount=0;for(let e of this.attachment.values){let t=e.uri,o=nv(e.value)?e.value.range:void 0,n=qx(e.value)?e.value.handle:void 0;this.isAttachmentAlreadyAttached(t,o,n)||(this.renderMainContext(e,e.isSelection),this.renderedCount++)}}get hasRenderedContexts(){return this.renderedCount>0}renderMainContext(e,t){let o=_(".chat-attached-context-attachment.show-file-icons.implicit");this.domNode.appendChild(o),o.tabIndex=0,o.classList.toggle("disabled",!e.enabled);let n=e.uri,r=n?.scheme===Y.vscodeNotebookCell?d(6026,null):d(6032,null);if(this.configService.getValue("chat.implicitContext.suggestedContext")){if(t){let g=d(6035,null),f=this.renderDisposables.add(new Mi(o,{supportIcons:!0,title:g}));f.icon=M.pinned,this.renderDisposables.add(f.onDidClick(async v=>{v.stopPropagation(),v.preventDefault(),await this.pinSelection()}))}else{let g=e.enabled?d(6029,null,r):"",f=this.renderDisposables.add(new Mi(o,{supportIcons:!0,title:g}));f.icon=e.enabled?M.x:M.plus,this.renderDisposables.add(f.onDidClick(async v=>{v.stopPropagation(),v.preventDefault(),e.enabled||await this.convertToRegularAttachment(e),e.enabled=!1}))}!e.enabled&&t&&o.classList.remove("disabled"),this.renderDisposables.add(j(o,re.CLICK,async g=>{!e.enabled&&!t&&await this.convertToRegularAttachment(e)})),this.renderDisposables.add(j(o,re.KEY_DOWN,async g=>{let f=new Ii(g);(f.equals(3)||f.equals(10))&&!e.enabled&&!t&&(g.preventDefault(),g.stopPropagation(),await this.convertToRegularAttachment(e))}))}else{let g=e.enabled?d(6029,null,r):d(6030,null,r),f=this.renderDisposables.add(new Mi(o,{supportIcons:!0,title:g}));f.icon=e.enabled?M.eye:M.eyeClosed,this.renderDisposables.add(f.onDidClick(v=>{v.stopPropagation(),e.enabled=!e.enabled}))}let l=this.resourceLabels.create(o,{supportIcons:!0}),c,u;qx(e.value)?(u=e.value.tooltip,c=this.renderString(l,e.name,e.icon,e.value.resourceUri,u,d(6034,null))):c=this.renderResource(e.value,e.isSelection,e.enabled,l,o),(u||c)&&this.renderDisposables.add(this.hoverService.setupDelayedHover(o,{content:u??c,appearance:{showPointer:!0}}));let p=this.renderDisposables.add(this.contextKeyService.createScoped(o));this.renderDisposables.add(new Fo(p,this.fileService,this.languageService,this.modelService)).set(n),this.renderDisposables.add(j(o,re.CONTEXT_MENU,async g=>{let f=new yn(Me(g),g);$t.stop(g,!0),this.contextMenuService.showContextMenu({contextKeyService:p,getAnchor:()=>f,getActions:()=>{let v=this.menuService.getMenuActions(D.ChatInputResourceAttachmentContext,p,{arg:n});return Uc(v)}})}))}renderString(e,t,o,n,r,s){let l=r?void 0:s;if(o&&(q.isFile(o)||q.isFolder(o))&&n){let c=q.isFolder(o)?1:0,u=js(this.modelService,this.languageService,n,c);e.setLabel(t,void 0,{extraClasses:u,title:l})}else e.setLabel(t,void 0,{iconPath:o,title:l});return l}renderResource(e,t,o,n,r){let s=A.isUri(e)?e:e.uri,l=A.isUri(e)||!t?void 0:e.range,c=s.scheme===Y.vscodeNotebookCell?d(6026,null):d(6032,null),u=Ye(s),p=ci(s),h=`${u} ${p}`,g=l?d(6028,null,c,h,l.startLineNumber,l.endLineNumber):d(6027,null,c,h),f=this.labelService.getUriLabel(s,{relative:!0}),v=d(6033,null,c),b=d(6031,null,c),y=`${o||t?v:b}
${f}`;return n.setFile(s,{fileKind:0,hidePath:!0,range:l,title:y}),r.ariaLabel=g,y}async convertToRegularAttachment(e){if(e.value){if(qx(e.value)){e.value.value===void 0&&await this.chatContextService.resolveChatContext(e.value);let t={kind:"string",value:e.value.value,id:e.id,name:e.name,icon:e.value.icon,modelDescription:e.modelDescription,uri:e.value.uri,resourceUri:e.value.resourceUri,tooltip:e.value.tooltip,commandId:e.value.commandId,handle:e.value.handle};this.attachmentModel.addContext(t)}else{let t=A.isUri(e.value)?e.value:e.value.uri;t.scheme===Y.vscodeNotebookCell&&nv(e.value)?this.attachmentModel.addFile(t,e.value.range):this.attachmentModel.addFile(t)}this.widgetRef()?.focusInput()}}async pinSelection(){for(let e of this.attachment.values)if(!(!e.value||!e.isSelection)&&!A.isUri(e.value)&&!qx(e.value)){let t=e.value;this.attachmentModel.addFile(t.uri,t.range)}this.widgetRef()?.focusInput()}};xAe=I([m(6,X),m(7,ze),m(8,ot),m(9,qt),m(10,be),m(11,kt),m(12,Ct),m(13,tt),m(14,B),m(15,Q_)],xAe);var g2=class extends r0{constructor(e,t,o,n,r,s,l,c){let{group:u,item:p}=t,h={...e,label:p?.name||u.name,tooltip:p?.description??u.description??u.name,run:()=>{}},g={actionProvider:{getActions:()=>this.getDropdownActions()},actionBarActionProvider:void 0,reporter:{id:u.id,name:`ChatSession:${u.name}`,includeOptions:!1}};super(h,g,n,s,r,c);this.delegate=o;this.commandService=l;this.currentOption=p,this._register(this.delegate.onDidChangeOption(f=>{this.currentOption=f,this.element&&this.renderLabel(this.element),this.updateEnabled()}))}getDropdownActions(){let e=this.delegate.getCurrentOption();if(e?.locked)return[this.createLockedOptionAction(e)];let t=this.delegate.getOptionGroup();if(!t)return[];let o=t.items.map(n=>{let r=n.id===e?.id;return{id:n.id,enabled:!n.locked,icon:n.icon,checked:r,class:void 0,description:n.description,tooltip:n.description??n.name,label:n.name,run:()=>{this.delegate.setOption(n)}}});if(t.commands?.length){let n=o.length>0;for(let r of t.commands){let s=r.arguments?[...r.arguments]:[],l=this.delegate.getSessionResource();l&&s.unshift(l),o.push({id:r.command,enabled:!0,checked:!1,class:void 0,description:void 0,tooltip:r.tooltip??r.title,label:r.title,category:n?{label:"",order:Number.MAX_SAFE_INTEGER}:void 0,run:()=>{this.commandService.executeCommand(r.command,...s)}})}}return o}createLockedOptionAction(e){return{id:e.id,enabled:!1,icon:e.icon,checked:!0,class:void 0,description:e.description,tooltip:e.description??e.name,label:e.name,run:()=>{}}}renderLabel(e){let t=[];e.classList.add("chat-session-option-picker");let o=this.delegate.getOptionGroup(),n=this.currentOption?.default&&this.currentOption?.icon;return this.currentOption?.icon&&t.push(Qo(this.currentOption.icon)),n||t.push(_("span.chat-session-option-label",void 0,this.currentOption?.name??o?.description??d(6612,null))),t.push(...Bn("$(chevron-down)")),Fi(e,...t),this.setAriaLabelAttributes(e),null}render(e){this.container=e,super.render(e),e.classList.add(this.getContainerClass()),this.currentOption?.locked&&e.classList.add("locked")}getContainerClass(){return"chat-sessionPicker-item"}updateEnabled(){let e=this.action.enabled;this.currentOption?.locked&&(this.action.enabled=!1),super.updateEnabled(),this.action.enabled=e,this.container&&this.container.classList.toggle("locked",!!this.currentOption?.locked)}};g2=I([m(3,nl),m(4,X),m(5,_e),m(6,ge),m(7,Te)],g2);function Z9o(a){return!!a&&typeof a.optionItem=="object"}var f2=class extends g2{constructor(e,t,o,n,r,s,l,c,u,p){super(e,t,o,n,r,s,u,p);this.quickInputService=l;this.logService=c}static{this.SEE_MORE_ID="__see_more__"}getDropdownActions(){let e=this.delegate.getCurrentOption();if(e?.locked)return[this.createLockedOptionAction(e)];let t=this.delegate.getOptionGroup();if(!t)return[];let o=t.items.map(n=>{let r=n.id===e?.id;return{id:n.id,enabled:!n.locked,icon:n.icon,checked:r,class:void 0,description:n.description,tooltip:n.description??n.name,label:n.name,run:()=>{this.delegate.setOption(n)}}});return t.onSearch&&o.push({id:f2.SEE_MORE_ID,enabled:!0,checked:!1,class:"searchable-picker-see-more",description:void 0,tooltip:d(6660,null),label:d(6659,null),run:()=>{this.showSearchableQuickPick(t)}}),o}renderLabel(e){let t=[],o=this.delegate.getOptionGroup();e.classList.add("chat-session-option-picker"),o?.icon&&t.push(Qo(o.icon));let n=this.currentOption?.name??o?.name??d(6661,null);return t.push(_("span.chat-session-option-label",void 0,n)),t.push(...Bn("$(chevron-down)")),Fi(e,...t),this.setAriaLabelAttributes(e),null}getContainerClass(){return"chat-searchable-option-picker-item"}async showSearchableQuickPick(e){if(e.onSearch){let t=new P,o=this.quickInputService.createQuickPick();t.add(o),o.placeholder=e.description??d(6662,null,e.name),o.matchOnDescription=!0,o.matchOnDetail=!0,o.ignoreFocusOut=!0,o.busy=!0,o.show();let n,r=t.add(new jo(300)),s=async l=>{n?.cancel(),n?.dispose(),n=new $e;let c=n.token;o.busy=!0;try{let u=await e.onSearch(l,c);c.isCancellationRequested||(o.items=u.map(p=>this.createQuickPickItem(p)))}catch(u){c.isCancellationRequested||this.logService.error("Error fetching searchable option items:",u)}finally{c.isCancellationRequested||(o.busy=!1)}};return await s(""),t.add(o.onDidChangeValue(l=>{r.trigger(()=>s(l))})),new Promise(l=>{t.add(o.onDidAccept(()=>{let c=o.selectedItems[0];if(Z9o(c)){let u=c.optionItem;u.locked||this.delegate.setOption(u)}o.hide()})),t.add(o.onDidHide(()=>{n?.cancel(),n?.dispose(),t.dispose(),l()}))})}}createQuickPickItem(e){let t=e.icon?q.asClassName(e.icon):void 0;return{label:e.name,description:e.description,iconClass:t,disabled:e.locked,optionItem:e}}show(){let e=this.delegate.getOptionGroup();e&&this.showSearchableQuickPick(e)}};f2=I([m(3,nl),m(4,X),m(5,_e),m(6,Ge),m(7,ne),m(8,ge),m(9,Te)],f2);var Aki=class{getHeight(i){return 22}getTemplateId(i){return tUt.TEMPLATE_ID}},tUt=class a{constructor(){this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="todoListRenderer"}renderTemplate(i){let e=new P,t=R(i,_("li.todo-item"));t.setAttribute("role","listitem");let o=R(t,_(".todo-status-icon.codicon"));o.setAttribute("aria-hidden","true");let n=R(t,_(".todo-content")),r=e.add(new Lc(n,{supportIcons:!1}));return{templateDisposables:e,todoElement:t,statusIcon:o,iconLabel:r}}renderElement(i,e,t){let{todoElement:o,statusIcon:n,iconLabel:r}=t;n.className=`todo-status-icon codicon ${this.getStatusIconClass(i.status)}`,n.style.color=this.getStatusIconColor(i.status),r.setLabel(i.title);let s=this.getStatusText(i.status),l=d(7236,null,i.title,s);o.setAttribute("aria-label",l)}disposeTemplate(i){i.templateDisposables.dispose()}getStatusText(i){switch(i){case"completed":return d(7237,null);case"in-progress":return d(7238,null);default:return d(7239,null)}}getStatusIconClass(i){switch(i){case"completed":return"codicon-pass";case"in-progress":return"codicon-record";default:return"codicon-circle-outline"}}getStatusIconColor(i){switch(i){case"completed":return"var(--vscode-charts-green)";case"in-progress":return"var(--vscode-charts-blue)";default:return"var(--vscode-foreground)"}}},kAe=class extends C{constructor(e,t,o){super();this.chatTodoListService=e;this.instantiationService=t;this.contextKeyService=o;this._isExpanded=!1;this._userManuallyExpanded=!1;this._inChatTodoListContextKey=ie.inChatTodoList.bindTo(o),this.domNode=this.createChatTodoWidget();let n=this._register(Vn(this.domNode));this._register(n.onDidFocus(()=>this._inChatTodoListContextKey.set(!0))),this._register(n.onDidBlur(()=>this._inChatTodoListContextKey.set(!1))),this._register(this.contextKeyService.onDidChangeContext(r=>{r.affectsSome(new Set([ie.requestInProgress.key]))&&this.updateClearButtonState()}))}get height(){return this.domNode.style.display==="none"?0:this.domNode.offsetHeight}hideWidget(){this.domNode.style.display="none"}createChatTodoWidget(){let e=_(".chat-todo-list-widget");e.style.display="none";let t=_(".todo-list-expand");this.expandoButton=this._register(new Mi(t,{supportIcons:!0})),this.expandoButton.element.setAttribute("aria-expanded",String(this._isExpanded)),this.expandoButton.element.setAttribute("aria-controls","todo-list-container");let o=_(".todo-list-title-section");return this.expandIcon=_(".expand-icon.codicon"),this.expandIcon.classList.add(this._isExpanded?"codicon-chevron-down":"codicon-chevron-right"),this.expandIcon.setAttribute("aria-hidden","true"),this.titleElement=_(".todo-list-title"),this.titleElement.id="todo-list-title",this.titleElement.textContent=d(7240,null),this.clearButtonContainer=_(".todo-clear-button-container"),this.createClearButton(),o.appendChild(this.expandIcon),o.appendChild(this.titleElement),this.expandoButton.element.appendChild(o),this.expandoButton.element.appendChild(this.clearButtonContainer),this.todoListContainer=_(".todo-list-container"),this.todoListContainer.style.display=this._isExpanded?"block":"none",this.todoListContainer.id="todo-list-container",this.todoListContainer.setAttribute("role","list"),this.todoListContainer.setAttribute("aria-labelledby","todo-list-title"),e.appendChild(t),e.appendChild(this.todoListContainer),this._register(this.expandoButton.onDidClick(()=>{this.toggleExpanded()})),e}createClearButton(){this.clearButton=new Mi(this.clearButtonContainer,{supportIcons:!0,ariaLabel:d(7231,null)}),this.clearButton.element.tabIndex=0,this.clearButton.icon=M.clearAll,this._register(this.clearButton),this._register(this.clearButton.onDidClick(()=>{this.clearAllTodos()}))}render(e){if(!e){this.hideWidget();return}Xe(this._currentSessionResource,e)||(this._userManuallyExpanded=!1,this._currentSessionResource=e,this.hideWidget()),this.updateTodoDisplay()}clear(e,t=!1){if(!e||this.domNode.style.display==="none")return;let o=this.chatTodoListService.getTodos(e);(t||o.length>0&&!o.some(r=>r.status!=="completed"))&&this.clearAllTodos()}hasTodos(){return this.domNode.classList.contains("has-todos")&&!!this._todoList&&this._todoList.length>0}hasFocus(){return ts(this.todoListContainer)}focus(){return this.hasTodos()?(this._isExpanded||this.toggleExpanded(),this._todoList?.domFocus(),this.hasFocus()):!1}updateTodoDisplay(){if(!this._currentSessionResource)return;let e=this.chatTodoListService.getTodos(this._currentSessionResource);if(!(e.length>0)){this.domNode.classList.remove("has-todos");return}this.domNode.classList.add("has-todos"),this.renderTodoList(e),this.domNode.style.display="block"}renderTodoList(e){this.updateTitleElement(this.titleElement,e),e.every(c=>c.status==="not-started")&&(this._userManuallyExpanded=!1),this._todoList||(this._todoList=this._register(this.instantiationService.createInstance(Rl,"ChatTodoListRenderer",this.todoListContainer,new Aki,[new tUt],{alwaysConsumeMouseWheel:!1,accessibilityProvider:{getAriaLabel:c=>{let u=this.getStatusText(c.status);return d(7236,null,c.title,u)},getWidgetAriaLabel:()=>d(7242,null)}})));let r=Math.min(e.length,6)*22;this._todoList.layout(r),this._todoList.getHTMLElement().style.height=`${r}px`,this._todoList.splice(0,this._todoList.length,e);let s=e.some(c=>c.status==="in-progress"),l=e.some(c=>c.status==="completed");this.updateClearButtonState(),(s||l)&&this._isExpanded&&!this._userManuallyExpanded&&(this._isExpanded=!1,this.expandoButton.element.setAttribute("aria-expanded","false"),this.todoListContainer.style.display="none",this.expandIcon.classList.remove("codicon-chevron-down"),this.expandIcon.classList.add("codicon-chevron-right"),this.updateTitleElement(this.titleElement,e))}toggleExpanded(){if(this._isExpanded=!this._isExpanded,this._userManuallyExpanded=!0,this.expandIcon.classList.toggle("codicon-chevron-down",this._isExpanded),this.expandIcon.classList.toggle("codicon-chevron-right",!this._isExpanded),this.todoListContainer.style.display=this._isExpanded?"block":"none",this._currentSessionResource){let e=this.chatTodoListService.getTodos(this._currentSessionResource);this.updateTitleElement(this.titleElement,e)}}clearAllTodos(){this._currentSessionResource&&(this.chatTodoListService.setTodos(this._currentSessionResource,[]),this.hideWidget())}updateClearButtonState(){if(!this._currentSessionResource)return;let t=this.chatTodoListService.getTodos(this._currentSessionResource).some(r=>r.status==="in-progress"),n=(ie.requestInProgress.getValue(this.contextKeyService)??!1)&&t;this.clearButton.enabled=!n,n?this.clearButton.setTitle(d(7232,null)):this.clearButton.setTitle(d(7231,null))}updateTitleElement(e,t){e.textContent="";let o=t.filter(h=>h.status==="completed").length,n=t.length,r=t.filter(h=>h.status==="in-progress"),s=r.length>0?r[0]:void 0,l=t.filter(h=>h.status==="not-started"),c=l.length>0?l[0]:void 0,u=r.length>0?o+1:Math.max(1,o),p=this._isExpanded?d(7233,null):d(7235,null);if(this.expandoButton.element.setAttribute("aria-label",p),this.expandoButton.element.setAttribute("aria-expanded",this._isExpanded?"true":"false"),this._isExpanded){let h=_("span");h.textContent=n>0?d(7241,null,u,n):d(7240,null),e.appendChild(h)}else{let h=s||c;if(h){let g=_(".codicon");h===s?(g.classList.add("codicon-record"),g.style.color="var(--vscode-charts-blue)"):(g.classList.add("codicon-circle-outline"),g.style.color="var(--vscode-foreground)"),g.style.marginRight="4px",g.style.verticalAlign="middle",e.appendChild(g);let f=_("span");f.textContent=d(7234,null,h.title,u,n),f.style.verticalAlign="middle",f.style.overflow="hidden",f.style.textOverflow="ellipsis",f.style.whiteSpace="nowrap",f.style.minWidth="0",e.appendChild(f)}else if(o>0&&o===n){let g=_("span");g.textContent=d(7241,null,n,n),g.style.verticalAlign="middle",e.appendChild(g)}}}getStatusText(e){switch(e){case"completed":return d(7237,null);case"in-progress":return d(7238,null);default:return d(7239,null)}}};kAe=I([m(0,dF),m(1,F),m(2,X)],kAe);var e7o=/^data:image\/[a-z]+;base64,/,t7o=/^https?:\/\/.+/,EAe=class extends Jd{constructor(e,t,o,n,r,s,l,c){super(n);this.widgetRef=e;this.attachmentModel=t;this.styles=o;this.extensionService=r;this.webContentExtractorService=s;this.logService=l;this.chatAttachmentResolveService=c;this.overlays=new Map;this.overlayTextBackground="";this.disableOverlay=!1;this.currentActiveTarget=void 0;this.updateStyles(),this._register(Z(()=>{this.overlays.forEach(({overlay:u,disposable:p})=>{p.dispose(),u.remove()}),this.overlays.clear(),this.currentActiveTarget=void 0,this.overlayText?.remove(),this.overlayText=void 0}))}addOverlay(e,t){this.removeOverlay(e);let{overlay:o,disposable:n}=this.createOverlay(e,t);this.overlays.set(e,{overlay:o,disposable:n})}removeOverlay(e){this.currentActiveTarget===e&&(this.currentActiveTarget=void 0);let t=this.overlays.get(e);t&&(t.overlay.remove(),t.disposable.dispose(),this.overlays.delete(e))}setDisabledOverlay(e){this.disableOverlay=e}createOverlay(e,t){let o=document.createElement("div");o.classList.add("chat-dnd-overlay"),this.updateOverlayStyles(o),t.appendChild(o);let n=new Om(e,{onDragOver:r=>{this.disableOverlay||(r.stopPropagation(),r.preventDefault(),e!==this.currentActiveTarget&&(this.currentActiveTarget&&this.setOverlay(this.currentActiveTarget,void 0),this.currentActiveTarget=e,this.onDragEnter(r,e)))},onDragLeave:r=>{this.disableOverlay||(e===this.currentActiveTarget&&(this.currentActiveTarget=void 0),this.onDragLeave(r,e))},onDrop:r=>{this.disableOverlay||(r.stopPropagation(),r.preventDefault(),e===this.currentActiveTarget&&(this.currentActiveTarget=void 0,this.onDrop(r,e)))}});return{overlay:o,disposable:n}}onDragEnter(e,t){let o=this.guessDropType(e);this.updateDropFeedback(e,t,o)}onDragLeave(e,t){this.updateDropFeedback(e,t,void 0)}onDrop(e,t){this.updateDropFeedback(e,t,void 0),this.drop(e)}async drop(e){let t=await this.resolveAttachmentsFromDragEvent(e);t.length!==0&&this.attachmentModel.addContext(...t)}updateDropFeedback(e,t,o){let n=o!==void 0;e.dataTransfer&&(e.dataTransfer.dropEffect=n?"copy":"none"),this.setOverlay(t,o)}guessDropType(e){if(gu(e,Ll.NOTEBOOK_CELL_OUTPUT))return 7;if(gu(e,Ll.SCM_HISTORY_ITEM))return 8;if(i7o(e))return this.extensionService.extensions.some(t=>Ea(t,"chatReferenceBinaryData"))?3:void 0;if(gu(e,"text/html"))return 5;if(gu(e,Ll.SYMBOLS))return 4;if(gu(e,Ll.MARKERS))return 6;if(gu(e,Aa.FILES))return 1;if(gu(e,Ll.EDITORS))return 0;if(gu(e,Zn.uriList,Ll.FILES,Aa.RESOURCES,Aa.INTERNAL_URI_LIST))return 2}isDragEventSupported(e){return this.guessDropType(e)!==void 0}getDropTypeName(e){switch(e){case 0:return d(7326,null);case 1:return d(7326,null);case 2:return d(7327,null);case 3:return d(7328,null);case 4:return d(7332,null);case 6:return d(7330,null);case 5:return d(7333,null);case 7:return d(7329,null);case 8:return d(7331,null)}}async resolveAttachmentsFromDragEvent(e){if(!this.isDragEventSupported(e))return[];if(gu(e,Ll.NOTEBOOK_CELL_OUTPUT)){let r=B$i(e);if(r)return this.chatAttachmentResolveService.resolveNotebookOutputAttachContext(r)}if(gu(e,Ll.SCM_HISTORY_ITEM)){let r=wdo(e);if(r)return this.chatAttachmentResolveService.resolveSourceControlHistoryItemAttachContext(r)}let t=W$i(e);if(t)return this.chatAttachmentResolveService.resolveMarkerAttachContext(t);if(gu(e,Ll.SYMBOLS)){let r=F$i(e);return this.chatAttachmentResolveService.resolveSymbolsAttachContext(r)}let o=iqe(e);if(o.length>0)return si(await Promise.all(o.map(r=>this.chatAttachmentResolveService.resolveEditorAttachContext(r))));let n=e.dataTransfer?.getData(Aa.INTERNAL_URI_LIST);if(n){let r=Uy.parse(n);if(r.length)return si(await Promise.all(r.map(s=>this.chatAttachmentResolveService.resolveEditorAttachContext({resource:A.parse(s)}))))}return!gu(e,Aa.INTERNAL_URI_LIST)&&gu(e,Zn.uriList)&&(gu(e,Zn.html)||gu(e,Zn.text))?this.resolveHTMLAttachContext(e):[]}async downloadImageAsUint8Array(e){try{let n=await this.webContentExtractorService.readImage(A.parse(e),ve.None);if(n)return n.buffer}catch(n){this.logService.warn("Fetch failed:",n)}let t=this.widgetRef(),o=t?.inputEditor.getSelection();o&&t&&t.inputEditor.executeEdits("chatInsertUrl",[{range:o,text:e}]),this.logService.warn(`Image URLs must end in .jpg, .png, .gif, .webp, or .bmp. Failed to fetch image from this URL: ${e}`)}async resolveHTMLAttachContext(e){let t=new Set(this.attachmentModel.attachments.map(u=>u.name)),o=()=>{let u=d(7325,null),p=u,h=1;for(;t.has(p);)p=`${u} ${++h}`;return t.add(p),p},n=async u=>{let p=A.parse(u);if(e7o.test(u))return{data:mdi(u),name:o(),resource:p};if(t7o.test(u)){let h=await this.downloadImageAsUint8Array(u);if(h)return{data:h,name:o(),resource:p,id:u}}},r=async u=>{try{let p=await u.arrayBuffer();return{data:new Uint8Array(p),name:o()}}catch(p){this.logService.error("Error reading file:",p)}},s=[],l=n7o(e);if(l.length){let u=await Promise.all(l.map(p=>r(p)));s.push(...u.filter(p=>!!p))}let c=o7o(e);if(c.length){let u=await Promise.all(c.map(n));s.push(...u.filter(p=>!!p))}return await this.chatAttachmentResolveService.resolveImageAttachContext(s)}setOverlay(e,t){this.overlayText?.remove(),this.overlayText=void 0;let{overlay:o}=this.overlays.get(e);if(t!==void 0){let r=Bn(`$(${M.attach.id}) ${this.getOverlayText(t)}`).map(s=>typeof s=="string"?_("span.overlay-text",void 0,s):s);this.overlayText=_("span.attach-context-overlay-text",void 0,...r),this.overlayText.style.backgroundColor=this.overlayTextBackground,o.appendChild(this.overlayText)}o.classList.toggle("visible",t!==void 0)}getOverlayText(e){let t=this.getDropTypeName(e);return d(7324,null,t)}updateOverlayStyles(e){e.style.backgroundColor=this.getColor(this.styles.overlayBackground)||"",e.style.color=this.getColor(this.styles.listForeground)||""}updateStyles(){this.overlays.forEach(e=>this.updateOverlayStyles(e.overlay)),this.overlayTextBackground=this.getColor(this.styles.listBackground)||""}};EAe=I([m(3,De),m(4,lt),m(5,t2),m(6,ne),m(7,jF)],EAe);function i7o(a){if(gu(a,"image"))return!0;if(gu(a,Aa.FILES)){let i=a.dataTransfer?.files;if(i&&i.length>0)return Array.from(i).some(t=>t.type.startsWith("image/"));let e=a.dataTransfer?.items;if(e&&e.length>0)return Array.from(e).some(t=>t.type.startsWith("image/"))}return!1}function o7o(a,i){let e=a.dataTransfer?.getData("text/uri-list");if(e)try{let t=Uy.parse(e);if(t.length>0)return t}catch(t){return i?.error("Error parsing URI list:",t),[]}return[]}function n7o(a){let i=a.dataTransfer?.files;return i?Array.from(i).filter(e=>e.type.startsWith("image/")):[]}var r7o=_,TAe=class extends C{constructor(e,t,o,n,r,s){super();this.location=o;this.options=n;this.clickHandler=r;this.chatAgentService=s;let l=R(e,r7o(".interactive-session-followups"));t.forEach(c=>this.renderFollowup(l,c))}renderFollowup(e,t){if(!this.chatAgentService.getDefaultAgent(this.location))return;let o=ETt(this.chatAgentService,this.location,"",t.agentId,t.subCommand);if(o===void 0)return;let n=t.kind==="reply"?t.title||t.message:t.title,r=t.kind==="reply"?t.message:t.title,s=(o+(t.tooltip||r)).trim(),l=this._register(new Mi(e,{...this.options,title:s}));t.kind==="reply"?l.element.classList.add("interactive-followup-reply"):t.kind==="command"&&l.element.classList.add("interactive-followup-command"),l.element.ariaLabel=d(7383,null,n),l.label=new xe(n),this._register(l.onDidClick(()=>this.clickHandler(t)))}};TAe=I([m(5,br)],TAe);var ytt=new class{constructor(){this.widgets=[]}register(a,i,e){this.widgets.push({id:a,ctor:i,when:e})}getWidgets(){return this.widgets}},_Ae=class extends C{constructor(e,t,o){super();this.container=e;this.contextKeyService=t;this.instantiationService=o;this.renderedWidgets=new Map;this.update(),this._register(this.contextKeyService.onDidChangeContext(n=>{let r=new Set;for(let s of ytt.getWidgets())if(s.when)for(let l of s.when.keys())r.add(l);n.affectsSome(r)&&this.update()}))}update(){let e=new Set;for(let t of ytt.getWidgets())this.contextKeyService.contextMatchesRules(t.when)&&e.add(t.id);for(let[t,o]of this.renderedWidgets)e.has(t)||(o.widget.domNode.remove(),o.disposables.dispose(),this.renderedWidgets.delete(t));for(let t of ytt.getWidgets())if(e.has(t.id)&&!this.renderedWidgets.has(t.id)){let o=new P,n=this.instantiationService.createInstance(t.ctor);o.add(n),this.renderedWidgets.set(t.id,{descriptor:t,widget:n,disposables:o}),this.container.appendChild(n.domNode)}}get height(){let e=0;for(let t of this.renderedWidgets.values())e+=t.widget.height;return e}dispose(){for(let e of this.renderedWidgets.values())e.widget.domNode.remove(),e.disposables.dispose();this.renderedWidgets.clear(),super.dispose()}};_Ae=I([m(1,X),m(2,F)],_Ae);var s0=class extends r0{constructor(e,t,o,n,r,s,l){let c={...t,getAnchor:()=>this.getAnchorElement()};super(e,c,n,r,s,l);this.pickerOptions=o;this._register(he(u=>{let p=this.pickerOptions.hideChevrons.read(u);this.element&&(this.element.classList.toggle("hide-chevrons",p),this.renderLabel(this.element))}))}getAnchorElement(){return this.element&&Ki().document.contains(this.element)?this.element:this.pickerOptions.getOverflowAnchor?.()??this.element}render(e){super.render(e),e.classList.add("chat-input-picker-item");let t=this.pickerOptions.hideChevrons.get();this.element&&(this.element.classList.toggle("hide-chevrons",t),this.renderLabel(this.element))}};s0=I([m(3,nl),m(4,_e),m(5,X),m(6,Te)],s0);var s7o={label:d(7478,null),order:1},a7o={label:d(7479,null),order:2},N3=class extends s0{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,{actionProvider:{getActions:()=>{let b=this._getSelectedSessionType(),S=[...this._getAdditionalActions().map(y=>({...e,...y}))];for(let y of this._sessionTypeItems)this._isVisible(y.type)&&S.push({...e,id:y.commandId,label:y.label,checked:b===y.type,icon:A_(y.type),enabled:this._isSessionTypeEnabled(y.type),category:this._getSessionCategory(y),description:this._getSessionDescription(y),tooltip:"",hover:{content:y.hoverDescription,position:this.pickerOptions.hoverPosition},run:async()=>{this._run(y)}});return S}},actionBarActionProvider:{getActions:()=>[this._getLearnMore()]},showItemKeybindings:!0,reporter:{id:"ChatSessionTypePicker",name:"ChatSessionTypePicker",includeOptions:!0}},n,r,s,l,h);this.chatSessionPosition=t;this.delegate=o;this.keybindingService=s;this.chatSessionsService=c;this.commandService=u;this.openerService=p;this._sessionTypeItems=[];this._register(this.chatSessionsService.onDidChangeAvailability(()=>{this._updateAgentSessionItems()})),this._updateAgentSessionItems()}_run(e){this.delegate.setActiveSessionProvider?this.delegate.setActiveSessionProvider(e.type):this.commandService.executeCommand(e.commandId,this.chatSessionPosition),this.element&&this.renderLabel(this.element)}_getSelectedSessionType(){return this.delegate.getActiveSessionProvider()}_getAdditionalActions(){return[]}_getLearnMore(){let e="https://code.visualstudio.com/docs/copilot/agents/overview";return{id:"workbench.action.chat.agentOverview.learnMore",label:d(7477,null),tooltip:e,class:void 0,enabled:!0,run:async()=>{await this.openerService.open(A.parse(e))}}}_updateAgentSessionItems(){let t=[{type:"local",label:XS("local"),hoverDescription:kdi("local"),commandId:"workbench.action.chat.openNewChatSessionInPlace.local"}],o=this.chatSessionsService.getAllChatSessionContributions();for(let n of o){let r=Rf(n.type);r&&t.push({type:r,label:XS(r),hoverDescription:kdi(r),commandId:n.canDelegate?`workbench.action.chat.openNewChatSessionInPlace.${n.type}`:`workbench.action.chat.openNewChatSessionExternal.${n.type}`})}this._sessionTypeItems=t}_isVisible(e){return!0}_isSessionTypeEnabled(e){return e==="local"?!0:!!this.chatSessionsService.getChatSessionContribution(e)}_getSessionCategory(e){return dTt(e.type)?s7o:a7o}_getSessionDescription(e){}render(e){super.render(e),e.classList.add("chat-session-target-picker-item")}renderLabel(e){this.setAriaLabelAttributes(e);let t=this._getSelectedSessionType(),o=XS(t??"local"),n=A_(t??"local"),r=[];return r.push(...Bn(`$(${n.id})`)),r.push(_("span.chat-input-picker-label",void 0,o)),r.push(...Bn("$(chevron-down)")),Fi(e,...r),null}};N3=I([m(4,nl),m(5,_e),m(6,X),m(7,Ls),m(8,ge),m(9,Qe),m(10,Te)],N3);var Yme=class extends N3{constructor(i,e,t,o,n,r,s,l,c,u,p){super(i,e,t,o,n,r,s,l,c,u,p),this._isSessionsWindow=$p.getValue(s)===!0}_run(i){this.delegate.setPendingDelegationTarget&&this.delegate.setPendingDelegationTarget(i.type),this.element&&this.renderLabel(this.element)}_getSelectedSessionType(){let i=this.delegate.getPendingDelegationTarget?this.delegate.getPendingDelegationTarget():void 0;return i||this.delegate.getActiveSessionProvider()}_isSessionTypeEnabled(i){let t=this.chatSessionsService.getAllChatSessionContributions().find(n=>Rf(n.type)===i),o=this.delegate.getActiveSessionProvider();return!this._isSessionsWindow&&o!=="local"||this._isSessionsWindow&&o!=="copilotcli"||t&&!t.canDelegate&&o!==i?!1:this._getSelectedSessionType()!==i}_isVisible(i){return this._isSessionsWindow&&i==="local"?!1:this.delegate.getActiveSessionProvider()===i?!0:uTt(i)}_getSessionCategory(i){return dTt(i.type)?{label:d(7429,null),order:1,showHeader:!0}:{label:d(7430,null),order:2,showHeader:!1}}_getLearnMore(){let i="https://aka.ms/vscode-continue-chat-in";return{id:"workbench.action.chat.agentOverview.learnMoreHandOff",label:d(7426,null),tooltip:i,class:void 0,enabled:!0,run:async()=>{await this.openerService.open(A.parse(i))}}}_getAdditionalActions(){return this._isSessionsWindow?[]:[{id:"newChatSession",class:void 0,label:d(7427,null),tooltip:"",hover:{content:"",position:this.pickerOptions.hoverPosition},checked:!1,icon:M.plus,enabled:!0,category:{label:d(7428,null),order:0,showHeader:!1},description:this.keybindingService.lookupKeybinding(im)?.getLabel()||void 0,run:async()=>{this.commandService.executeCommand(im,this.chatSessionPosition)}}]}};Yme=I([m(4,nl),m(5,_e),m(6,X),m(7,Ls),m(8,ge),m(9,Qe),m(10,Te)],Yme);function wtt(a,i,e){let t=e.defaultChatAgent?.chatExtensionId;if(!t)return!1;let o=Ei.equals(i,t),n=a.path.includes("/github/");return o&&n}function bmo(a,i,e){if(a.storage!=="extension")return!1;let t=e.defaultChatAgent?.chatExtensionId;return!t||!Ei.equals(a.extensionId,t)?!1:!wtt(i,a.extensionId,e)}var Smo=a=>{switch(a.name.get().toLowerCase()){case"ask":return M.ask;case"edit":return M.edit;case"plan":return M.tasklist;default:return}},DAe=class extends s0{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){let S=Le("modePickerAssignments",{showOldAskMode:!1}),y=t.customAgentTarget?.()??"undefined",w={label:d(7448,null),order:0},k={label:d(7449,null),order:1},T={label:d(7451,null),order:999,showHeader:!0},N=l.inspect("chat.agent.enabled").policyValue===!1,O=(te,pe)=>{let de=te.kind==="agent"&&N,se=r.getDefaultAgent("panel",te.kind)?.description??e.tooltip,Se=[];if(te.kind==="agent"&&!de&&te.uri){let ke,Ee,He;te.source?.storage==="extension"?(Ee=M.eye,He=`viewAgent:${te.id}`,ke=d(7452,null,te.label.get())):(Ee=M.edit,He=`editAgent:${te.id}`,ke=d(7450,null,te.label.get()));let Ve=te.uri;Se.push({id:He,label:ke,tooltip:ke,class:q.asClassName(Ee),enabled:!0,run:async()=>{v.open(Ve.get())}})}return{...e,id:ECi(te),label:te.label.get(),icon:de?q.fromId(M.lock.id):te.icon.get(),class:de?"disabled-by-policy":void 0,enabled:!de,checked:!de&&pe.id===te.id,tooltip:"",hover:{content:se,position:this.pickerOptions.hoverPosition},toolbarActions:Se,run:async()=>{if(de)return;let ke=await h.executeCommand(aki,{modeId:te.id,sessionResource:this.delegate.sessionResource()});return this.element&&this.renderLabel(this.element),ke},category:de?T:w}},V=(te,pe)=>({...O(te,pe),tooltip:"",hover:{content:te.description.get()??r.getDefaultAgent("panel",te.kind)?.description??e.tooltip,position:this.pickerOptions.hoverPosition},icon:te.icon.get()??(Ctt(te,this._productService)?Smo(te):void 0),category:N?T:k}),U={getActions:()=>{let te=u.getModes(),pe=t.currentMode.get(),de=te.custom.filter(Ve=>{let Fe=Ve.target.get();return Fe===y||Fe==="undefined"}),se=wI(de,Ve=>Ctt(Ve,this._productService)?"builtin":"custom"),Se=pe.id===Pl.Agent.id,ke={...O(Pl.Agent,Pl.Agent),checked:Se};ke.category=w;let Ee=se.builtin?.map(Ve=>{let Fe=V(Ve,pe);return Fe.category=w,Fe})??[],He=se.custom?.map(Ve=>V(Ve,pe))??[];return[ke,...Ee,...He]}},G={getActions:()=>{let te=u.getModes(),pe=t.currentMode.get(),de=te.builtin.find(Fe=>Fe.id===Pl.Agent.id),se=te.builtin.filter(Fe=>Fe.id!==Pl.Agent.id&&Imo(Fe,S.get(),N)),Se=te.custom.filter(Fe=>Ctt(Fe,this._productService)?Imo(Fe,S.get(),N):!0),ke=wI(Se,Fe=>Ctt(Fe,this._productService)?"builtin":"custom"),Ee=ke.builtin?.map(Fe=>{let Qt=V(Fe,pe);return Qt.category=N?T:w,Qt})??[];Ee.sort((Fe,Qt)=>Fe.label.localeCompare(Qt.label));let He=ke.custom?.map(Fe=>V(Fe,pe))??[];return He.sort((Fe,Qt)=>Fe.label.localeCompare(Qt.label)),si([de&&O(de,pe),...se.map(Fe=>Fe&&O(Fe,pe)),...Ee,...He])}},$={actionProvider:y!=="undefined"?U:G,actionBarActionProvider:{getActions:()=>this.getModePickerActionBarActions()},showItemKeybindings:!0,reporter:{id:"ChatModePicker",name:"ChatModePicker",includeOptions:!0}};super(e,$,o,n,s,c,f);this.delegate=t;this.contextKeyService=c;this.menuService=p;this._productService=g;this._register(he(te=>{this.delegate.currentMode.read(te).label.read(te),this.element&&this.renderLabel(this.element)})),b.getTreatment("chat.showOldAskMode").then(te=>{S.set({showOldAskMode:te==="enabled"},void 0)}),this._register(b.onDidRefetchAssignments(async()=>{S.set({showOldAskMode:await b.getTreatment("chat.showOldAskMode")==="enabled"},void 0)}))}getModePickerActionBarActions(){let e=this.menuService.createMenu(D.ChatModePicker,this.contextKeyService),t=Vm(e.getActions({renderShortTitle:!0}));return e.dispose(),t}render(e){super.render(e),e.classList.add("chat-mode-picker-item")}renderLabel(e){this.setAriaLabelAttributes(e);let t=this.delegate.currentMode.get(),o=t.label.get(),n=t.icon.get();!n&&Ctt(t,this._productService)&&(n=Smo(t));let r=[],s=this.pickerOptions.hideChevrons.get();return n&&r.push(...Bn(`$(${n.id})`)),(!s||!n)&&r.push(_("span.chat-input-picker-label",void 0,o)),s||r.push(...Bn("$(chevron-down)")),Fi(e,...r),null}};DAe=I([m(3,nl),m(4,br),m(5,_e),m(6,B),m(7,X),m(8,Pv),m(9,qt),m(10,ge),m(11,nt),m(12,Te),m(13,Qe),m(14,kC)],DAe);function Ctt(a,i){if(a.isBuiltin)return!0;if(a.source?.storage!=="extension")return!1;let e=i.defaultChatAgent?.chatExtensionId;if(!e||a.source.extensionId.value!==e)return!1;let t=a.uri?.get();return t?!wtt(t,a.source.extensionId,i):!0}function Imo(a,i,e){return a.id===Pl.Edit.id||a.name.get().toLowerCase()==="edit"?a.id===Pl.Edit.id?e:!e:a.id===Pl.Ask.id||a.name.get().toLowerCase()==="ask"?a.id===Pl.Ask.id?i.showOldAskMode||e:!(i.showOldAskMode||e):!0}var iUt=new Set;function ymo(a){return!!(iUt.has(a)||a==="autoApprove"&&iUt.has("autopilot"))}var LAe=class extends s0{constructor(e,t,o,n,r,s,l,c,u){let p=()=>c.inspect("chat.tools.global.autoApprove").policyValue===!1,h=()=>c.getValue("chat.autopilot.enabled")!==!1;super(e,{actionProvider:{getActions:()=>{let f=t.currentPermissionLevel.get(),v=p(),b=[{...e,id:"chat.permissions.default",label:d(7473,null),description:d(7476,null),icon:q.fromId(M.shield.id),checked:f==="default",tooltip:"",hover:{content:d(7474,null),position:o.hoverPosition},run:async()=>{t.setPermissionLevel("default"),this.element&&this.renderLabel(this.element)}},{...e,id:"chat.permissions.autoApprove",label:d(7453,null),description:d(7458,null),icon:q.fromId(M.warning.id),checked:f==="autoApprove",enabled:!v,tooltip:v?d(7457,null):"",hover:{content:v?d(7456,null):d(7454,null),position:o.hoverPosition},run:async()=>{if(!ymo("autoApprove")){if((await this.dialogService.prompt({type:gt.Warning,message:d(7462,null),buttons:[{label:d(7460,null),run:()=>!0},{label:d(7459,null),run:()=>!1}],custom:{icon:M.warning,markdownDetails:[{markdown:new xe(d(7461,null))}]}})).result!==!0)return;iUt.add("autoApprove")}t.setPermissionLevel("autoApprove"),this.element&&this.renderLabel(this.element)}}];return h()&&b.push({...e,id:"chat.permissions.autopilot",label:d(7463,null),description:d(7468,null),icon:q.fromId(M.rocket.id),checked:f==="autopilot",enabled:!v,tooltip:v?d(7467,null):"",hover:{content:v?d(7466,null):d(7464,null),position:o.hoverPosition},run:async()=>{if(!ymo("autopilot")){if((await this.dialogService.prompt({type:gt.Warning,message:d(7472,null),buttons:[{label:d(7470,null),run:()=>!0},{label:d(7469,null),run:()=>!1}],custom:{icon:M.rocket,markdownDetails:[{markdown:new xe(d(7471,null))}]}})).result!==!0)return;iUt.add("autopilot")}t.setPermissionLevel("autopilot"),this.element&&this.renderLabel(this.element)}}),b}},reporter:{id:"ChatPermissionPicker",name:"ChatPermissionPicker",includeOptions:!0},listOptions:{descriptionBelow:!0,minWidth:255}},o,n,r,s,l);this.delegate=t;this.dialogService=u}renderLabel(e){this.setAriaLabelAttributes(e);let t=this.delegate.currentPermissionLevel.get(),o,n;switch(t){case"autopilot":o=M.rocket,n=d(7465,null);break;case"autoApprove":o=M.warning,n=d(7455,null);break;default:o=M.shield,n=d(7475,null);break}let r=[];return r.push(...Bn(`$(${o.id})`)),r.push(_("span.chat-input-picker-label",void 0,n)),r.push(...Bn("$(chevron-down)")),Fi(e,...r),e.classList.toggle("warning",t==="autopilot"),e.classList.toggle("info",t==="autoApprove"),null}refresh(){this.element&&this.renderLabel(this.element)}};LAe=I([m(3,nl),m(4,_e),m(5,X),m(6,Te),m(7,B),m(8,ct)],LAe);var Xme=class extends s0{constructor(e,t,o,n,r,s,l,c){super(e,{actionProvider:{getActions:()=>{let g=this.delegate.getSelectedWorkspace(),v=this.delegate.getWorkspaces().map(b=>({...e,id:`workspace.${b.uri.toString()}`,label:b.label,checked:g?.uri.toString()===b.uri.toString(),icon:b.isFolder?{id:"folder"}:{id:"file-symlink-directory"},enabled:!0,tooltip:b.uri.fsPath,run:async()=>{this.delegate.setSelectedWorkspace(b),this.element&&this.renderLabel(this.element)}}));return v.push({...e,id:"workspace.openFolder",label:d(7480,null),checked:!1,enabled:!0,tooltip:d(7481,null),run:async()=>{this.commandService.executeCommand(this.delegate.openFolderCommand)}}),v}},actionBarActionProvider:{getActions:()=>[]},showItemKeybindings:!1,reporter:{id:"ChatWorkspacePicker",name:"ChatWorkspacePicker",includeOptions:!1}},o,n,r,s,c);this.delegate=t;this.commandService=l;this._register(this.delegate.onDidChangeSelectedWorkspace(()=>{this.element&&this.renderLabel(this.element)})),this._register(this.delegate.onDidChangeWorkspaces(()=>{this.element&&this.renderLabel(this.element)}))}renderLabel(e){this.setAriaLabelAttributes(e);let t=this.delegate.getSelectedWorkspace(),o=[];if(t){let n=t.label||Ye(t.uri);o.push(...Bn("$(folder)")),o.push(_("span.chat-input-picker-label",void 0,n))}else o.push(...Bn("$(folder)")),o.push(_("span.chat-input-picker-label",void 0,d(7482,null)));return this.pickerOptions.hideChevrons.get()||o.push(...Bn("$(chevron-down)")),Fi(e,...o),null}};Xme=I([m(3,nl),m(4,_e),m(5,X),m(6,ge),m(7,Te)],Xme);var kk=_,RAe=class extends C{constructor(e,t,o){super();this.instantiationService=e;this.menuService=t;this.contextKeyService=o;this.domNode=kk(".chat-context-usage-details"),this.quotaItem=this.domNode.appendChild(kk(".quota-indicator"));let n=this.domNode.insertBefore(kk("div.header"),this.quotaItem);n.textContent=d(7494,null);let r=this.quotaItem.appendChild(kk(".quota-label"));this.tokenCountLabel=r.appendChild(kk("span")),this.percentageLabel=r.appendChild(kk("span.quota-value"));let s=this.quotaItem.appendChild(kk(".quota-bar"));this.progressFill=s.appendChild(kk(".quota-bit")),this.tokenDetailsContainer=this.domNode.appendChild(kk(".token-details-container")),this.warningMessage=this.domNode.appendChild(kk("div.description")),this.warningMessage.textContent=d(7496,null),this.warningMessage.style.display="none",this.actionsSection=this.domNode.appendChild(kk(".actions-section"));let l=this.actionsSection.appendChild(kk(".button-bar-container"));this._register(this.instantiationService.createInstance(QF,l,D.ChatContextUsageActions,{toolbarOptions:{primaryGroup:()=>!0},buttonConfigProvider:()=>({isSecondary:!0})}));let c=this._register(this.menuService.createMenu(D.ChatContextUsageActions,this.contextKeyService)),u=()=>{let p=c.getActions(),h=p.length>0&&p.some(([,g])=>g.length>0);this.actionsSection.style.display=h?"":"none"};this._register(c.onDidChange(u)),u()}update(e){let{percentage:t,usedTokens:o,totalContextWindow:n,promptTokenDetails:r}=e;this.tokenCountLabel.textContent=d(7498,null,this.formatTokenCount(o,1),this.formatTokenCount(n,0)),this.percentageLabel.textContent=d(7497,null,t.toFixed(0)),this.progressFill.style.width=`${Math.min(100,t)}%`,this.quotaItem.classList.remove("warning","error"),t>=90?this.quotaItem.classList.add("error"):t>=75&&this.quotaItem.classList.add("warning"),this.renderTokenDetails(r,t),this.warningMessage.style.display=t>=75?"":"none"}formatTokenCount(e,t){let o=1e6-500*Math.pow(10,-t);return e>=o?`${(e/1e6).toFixed(t)}M`:e>=1e3?`${(e/1e3).toFixed(t)}K`:e.toString()}renderTokenDetails(e,t){if(Rt(this.tokenDetailsContainer),!e||e.length===0){this.tokenDetailsContainer.style.display="none";return}this.tokenDetailsContainer.style.display="";let o=new Map,n=0;for(let r of e){let s=o.get(r.category)||[];s.push({label:r.label,percentageOfPrompt:r.percentageOfPrompt}),o.set(r.category,s),n+=r.percentageOfPrompt}if(n<100){let r=100-n;o.set(d(7499,null),[{label:d(7495,null),percentageOfPrompt:r}])}for(let[r,s]of o){let l=s.filter(p=>p.percentageOfPrompt/100*t>=.05);if(l.length===0)continue;let c=this.tokenDetailsContainer.appendChild(kk(".token-category")),u=c.appendChild(kk(".token-category-header"));u.textContent=r;for(let p of l){let h=c.appendChild(kk(".token-detail-item")),g=h.appendChild(kk(".token-detail-label"));g.textContent=p.label;let f=p.percentageOfPrompt/100*t,v=h.appendChild(kk(".token-detail-value"));v.textContent=`${f.toFixed(1)}%`}}}focus(){this.domNode.focus()}};RAe=I([m(0,F),m(1,qt),m(2,X)],RAe);var Nki=_,Oki=class a{static{this.CENTER_X=18}static{this.CENTER_Y=18}static{this.RADIUS=14}constructor(){let i=a.RADIUS;this.circumference=2*Math.PI*i,this.domNode=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.domNode.setAttribute("viewBox","0 0 36 36"),this.domNode.classList.add("circular-progress");let e=document.createElementNS("http://www.w3.org/2000/svg","circle");e.setAttribute("cx",String(a.CENTER_X)),e.setAttribute("cy",String(a.CENTER_Y)),e.setAttribute("r",String(i)),e.classList.add("progress-bg"),this.domNode.appendChild(e),this.progressCircle=document.createElementNS("http://www.w3.org/2000/svg","circle"),this.progressCircle.setAttribute("cx",String(a.CENTER_X)),this.progressCircle.setAttribute("cy",String(a.CENTER_Y)),this.progressCircle.setAttribute("r",String(i)),this.progressCircle.classList.add("progress-arc"),this.progressCircle.setAttribute("stroke-dasharray",String(this.circumference)),this.progressCircle.setAttribute("stroke-dashoffset",String(this.circumference)),this.domNode.appendChild(this.progressCircle)}setProgress(i){let e=Math.max(0,Math.min(100,i)),t=this.circumference-e/100*this.circumference;this.progressCircle.setAttribute("stroke-dashoffset",String(t))}},v2=class extends C{constructor(e,t,o,n,r,s){super();this.hoverService=e;this.instantiationService=t;this.languageModelsService=o;this.contextKeyService=n;this.storageService=r;this.configurationService=s;this._onDidChangeVisibility=this._register(new E);this.onDidChangeVisibility=this._onDidChangeVisibility.event;this._isVisible=Le(this,!1);this._lastRequestDisposable=this._register(new me);this._hoverDisposable=this._register(new me);this._contextUsageDetails=this._register(new me);this._hoverOptions={id:v2._HOVER_ID,appearance:{showPointer:!0,compact:!0},persistence:{hideOnHover:!1},trapFocus:!0};this.domNode=Nki(".chat-context-usage-widget"),this.domNode.style.display="none",this.domNode.setAttribute("tabindex","0"),this.domNode.setAttribute("role","button"),this.domNode.setAttribute("aria-label",d(7500,null));let l=this.domNode.appendChild(Nki(".icon-container"));this.progressIndicator=new Oki,l.appendChild(this.progressIndicator.domNode),this.percentageLabel=this.domNode.appendChild(Nki(".percentage-label")),this._contextUsageOpenedKey=ie.contextUsageHasBeenOpened.bindTo(this.contextKeyService),this.storageService.getBoolean(v2._OPENED_STORAGE_KEY,1,!1)&&this._contextUsageOpenedKey.set(!0),this._enabled=this.configurationService.getValue("chat.contextUsage.enabled")!==!1,this._register(this.configurationService.onDidChangeConfiguration(c=>{c.affectsConfiguration("chat.contextUsage.enabled")&&(this._enabled=this.configurationService.getValue("chat.contextUsage.enabled")!==!1,this._enabled?this.currentData&&this.show():this.hide())})),this.setupHover()}get isVisible(){return this._isVisible}static{this._OPENED_STORAGE_KEY="chat.contextUsage.hasBeenOpened"}static{this._HOVER_ID="chat.contextUsage"}showDetails(){let e=this._createDetails();return e?(this.hoverService.showInstantHover({...this._hoverOptions,content:e.domNode,target:this.domNode,persistence:{hideOnHover:!1,sticky:!0}},!0),this._markOpened(),!0):!1}_createDetails(){if(!(!this._isVisible.get()||!this.currentData))return this._contextUsageDetails.value||(this._contextUsageDetails.value=this.instantiationService.createInstance(RAe)),this._contextUsageDetails.value.update(this.currentData),this._contextUsageDetails.value}_markOpened(){this._contextUsageOpenedKey.set(!0),this.storageService.store(v2._OPENED_STORAGE_KEY,!0,1,1)}setupHover(){this._hoverDisposable.clear();let e=new P;this._hoverDisposable.value=e,e.add(this.hoverService.setupDelayedHover(this.domNode,()=>({...this._hoverOptions,content:this._createDetails()?.domNode??""}))),e.add(j(this.domNode,re.CLICK,t=>{t.stopPropagation(),this.showDetails()})),e.add(j(this.domNode,re.KEY_DOWN,t=>{let o=new Ii(t);(o.equals(10)||o.equals(3))&&(t.preventDefault(),this.showDetails())}))}update(e){if(this._lastRequestDisposable.clear(),!e){this.currentData=void 0,this.hide();return}if(!e.response||!e.modelId){this.currentData||this.hide();return}let t=e.response,o=e.modelId;this.updateFromResponse(t,o),this._lastRequestDisposable.value=t.onDidChange(()=>{this.updateFromResponse(t,o)})}updateFromResponse(e,t){let o=e.usage,n=this.languageModelsService.lookupLanguageModel(t),r=n?.maxInputTokens,s=n?.maxOutputTokens;if(!o||!r||r<=0||!s||s<=0){this.currentData||this.hide();return}let l=o.promptTokens,c=o.promptTokenDetails,u=r+s,p=l+s,h=Math.min(100,p/u*100);this.render(h,p,u,c),this.show()}render(e,t,o,n){this.currentData={usedTokens:t,totalContextWindow:o,percentage:e,promptTokenDetails:n},this.progressIndicator.setProgress(e);let r=Math.round(e);this.percentageLabel.textContent=`${r}%`,this.domNode.setAttribute("aria-label",d(7501,null,r)),this.domNode.classList.remove("warning","error"),e>=90?this.domNode.classList.add("error"):e>=75&&this.domNode.classList.add("warning")}show(){this._enabled&&this.domNode.style.display==="none"&&(this.domNode.style.display="",this._isVisible.set(!0,void 0),this._onDidChangeVisibility.fire())}hide(){this.domNode.style.display!=="none"&&(this.domNode.style.display="none",this._isVisible.set(!1,void 0),this._onDidChangeVisibility.fire())}};v2=I([m(0,tt),m(1,F),m(2,Wr),m(3,X),m(4,le),m(5,B)],v2);function MAe(a,i){let e=zYi(a);return e?BTt(e,i):!1}function l7o(a){let i=new xe("",{isTrusted:!0,supportThemeIcons:!0});switch(a){case"available for download":i.appendMarkdown(d(7404,null));break;case"downloaded":case"ready":i.appendMarkdown(d(7406,null));break;default:i.appendMarkdown(d(7403,null));break}return i}var AAe={Other:"other"};function PAe(a,i){return{item:a,kind:"action",label:a.label,description:a.description,group:{title:"",icon:a.icon??q.fromId(a.checked?M.check.id:M.blank.id)},hideIcon:!1,section:a.section,hover:i?{content:u7o(i)}:void 0}}function xtt(a,i,e,t){return{id:a.identifier,enabled:!0,icon:a.metadata.statusIcon,checked:a.identifier===i,class:void 0,description:a.metadata.multiplier??a.metadata.detail,tooltip:a.metadata.name,label:a.metadata.name,section:t,run:()=>e(a)}}function c7o(a,i,e,t,o,n,r,s,l,c,u){let p=[];if(a.length===0&&p.push(PAe({id:"auto",enabled:!0,checked:!0,class:void 0,tooltip:d(7402,null),label:d(7402,null),run:()=>{}})),!l){let f=a.find(b=>b.metadata.id==="auto"&&b.metadata.vendor==="copilot");f&&p.push(PAe(xtt(f,i,r),f));let v=a.filter(b=>b!==f).sort((b,S)=>{let y=b.metadata.vendor.localeCompare(S.metadata.vendor);return y!==0?y:b.metadata.name.localeCompare(S.metadata.name)});for(let b of v)p.push(PAe(xtt(b,i,r),b));return p}let h=dP(u.entitlement),g=[];if(a.length){let f=new Map,v=new Map;for(let O of a)f.set(O.identifier,O),v.set(O.metadata.id,O);let b=new Set,S=(O,V)=>{b.add(O),V&&b.add(V)},y=O=>f.get(O)??v.get(O),w=O=>h?O.minVSCodeVersion&&!MAe(o,O.minVSCodeVersion)?"update":"admin":"upgrade",k=a.find(O=>O.metadata.id==="auto"&&O.metadata.vendor==="copilot");k&&(S(k.identifier,k.metadata.id),p.push(PAe(xtt(k,i,r),k)));let T=[],N=O=>{if(b.has(O))return!1;let V=y(O);if(V&&!b.has(V.identifier)){S(V.identifier,V.metadata.id);let U=t[V.metadata.id];return U?.minVSCodeVersion&&!MAe(o,U.minVSCodeVersion)?T.push({kind:"unavailable",id:V.metadata.id,entry:U,reason:"update"}):T.push({kind:"available",model:V}),!0}if(!V){let U=t[O];if(U&&!U.exists)return S(O),T.push({kind:"unavailable",id:O,entry:U,reason:w(U)}),!0}return!1};i&&i!==k?.identifier&&N(i);for(let O of e)N(O);for(let[O,V]of Object.entries(t)){if(!V.featured||b.has(O))continue;let U=y(O);U&&!b.has(U.identifier)?(S(U.identifier,U.metadata.id),V.minVSCodeVersion&&!MAe(o,V.minVSCodeVersion)?T.push({kind:"unavailable",id:O,entry:V,reason:"update"}):T.push({kind:"available",model:U})):!U&&!V.exists&&(S(O),T.push({kind:"unavailable",id:O,entry:V,reason:w(V)}))}if(T.length>0){T.sort((O,V)=>{let U=O.kind==="available"?0:1,G=V.kind==="available"?0:1;if(U!==G)return U-G;let $=O.kind==="available"?O.model.metadata.name:O.entry.label,te=V.kind==="available"?V.model.metadata.name:V.entry.label;return $.localeCompare(te)});for(let O of T)O.kind==="available"?p.push(PAe(xtt(O.model,i,r),O.model)):p.push(wmo(O.id,O.entry,O.reason,s,n))}if(g=a.filter(O=>!b.has(O.identifier)&&!b.has(O.metadata.id)).sort((O,V)=>{let U=t[O.metadata.id]??t[O.identifier],G=t[V.metadata.id]??t[V.identifier],$=U?.minVSCodeVersion&&!MAe(o,U.minVSCodeVersion)?1:0,te=G?.minVSCodeVersion&&!MAe(o,G.minVSCodeVersion)?1:0;if($!==te)return $-te;let pe=O.metadata.vendor==="copilot"?0:1,de=V.metadata.vendor==="copilot"?0:1;if(pe!==de)return pe-de;let se=O.metadata.vendor.localeCompare(V.metadata.vendor);return se!==0?se:O.metadata.name.localeCompare(V.metadata.name)}),g.length>0){p.length>0&&p.push({kind:"separator"}),p.push({item:{id:"otherModels",enabled:!0,checked:!1,class:void 0,tooltip:d(7405,null),label:d(7405,null),run:()=>{}},kind:"action",label:d(7405,null),group:{title:"",icon:M.chevronDown},hideIcon:!1,section:AAe.Other,isSectionToggle:!0});for(let O of g){let V=t[O.metadata.id]??t[O.identifier];V?.minVSCodeVersion&&!MAe(o,V.minVSCodeVersion)?p.push(wmo(O.metadata.id,V,"update",s,n,AAe.Other)):p.push(PAe(xtt(O,i,r,AAe.Other),O))}}}return(u.entitlement===5||u.entitlement===6||u.entitlement===7||u.entitlement===8||u.entitlement===9||u.isInternal)&&(p.push({kind:"separator",section:g.length?AAe.Other:void 0}),p.push({item:{id:"manageModels",enabled:!0,checked:!1,class:void 0,tooltip:d(7397,null),label:d(7396,null),run:()=>{c.executeCommand(V8e)}},kind:"action",label:d(7396,null),group:{title:"",icon:M.blank},hideIcon:!1,section:g.length?AAe.Other:void 0,showAlways:!0})),p}function d7o(){return{isChecked(a){return a.kind==="action"?!!a?.item?.checked:void 0},getRole:a=>{switch(a.kind){case"action":return"menuitemradio";case"separator":return"separator";default:return"separator"}},getWidgetRole:()=>"menu"}}function wmo(a,i,e,t,o,n){let r;e==="upgrade"?r=new xe(d(7410,null),{isTrusted:!0}):e==="update"?r=d(7408,null):r=t?new xe(d(7400,null,t),{isTrusted:!0}):d(7398,null);let s;return e==="upgrade"?(s=new xe("",{isTrusted:!0,supportThemeIcons:!0}),s.appendMarkdown(d(7409,null))):e==="update"?s=l7o(o):(s=new xe("",{isTrusted:!0,supportThemeIcons:!0}),s.appendMarkdown(d(7399,null))),{item:{id:a,enabled:!1,checked:!1,class:void 0,tooltip:i.label,label:i.label,description:typeof r=="string"?r:void 0,run:()=>{}},kind:"action",label:i.label,description:r,group:{title:"",icon:q.fromId(M.blank.id)},disabled:!0,hideIcon:!1,className:"chat-model-picker-unavailable",section:n,hover:{content:s}}}var NAe=class extends C{constructor(e,t,o,n,r,s,l,c){super();this._delegate=e;this._actionWidgetService=t;this._commandService=o;this._telemetryService=n;this._languageModelsService=r;this._productService=s;this._entitlementService=l;this._updateService=c;this._onDidChangeSelection=this._register(new E);this.onDidChangeSelection=this._onDidChangeSelection.event}get selectedModel(){return this._selectedModel}get domNode(){return this._domNode}setHideChevrons(e){this._hideChevrons=e,this._register(he(t=>{let o=e.read(t);this._domNode&&this._domNode.classList.toggle("hide-chevrons",o),this._renderLabel()}))}setSelectedModel(e){this._selectedModel=e,this._renderLabel()}setBadge(e){this._badge=e,this._updateBadge()}render(e){this._domNode=R(e,_("a.action-label")),this._domNode.tabIndex=0,this._domNode.setAttribute("role","button"),this._domNode.setAttribute("aria-haspopup","true"),this._domNode.setAttribute("aria-expanded","false"),this._hideChevrons?.get()&&this._domNode.classList.toggle("hide-chevrons",!0),this._badgeIcon=R(this._domNode,_("span.model-picker-badge")),this._updateBadge(),this._renderLabel(),this._register(j(this._domNode,re.MOUSE_DOWN,t=>{t.button===0&&($t.stop(t,!0),this.show())})),this._register(j(this._domNode,re.KEY_DOWN,t=>{let o=new Ii(t);(o.equals(3)||o.equals(10))&&($t.stop(t,!0),this.show())}))}show(e){let t=e??this._domNode;if(!t)return;let o=this._selectedModel,n=v=>{this._telemetryService.publicLog2("chat.modelChange",{fromModel:o?.metadata.vendor==="copilot"?new Im(o.identifier):"unknown",toModel:v.metadata.vendor==="copilot"?new Im(v.identifier):"unknown"}),this._selectedModel=v,this._renderLabel(),this._onDidChangeSelection.fire(v)},r=this._delegate.getModels(),s=dP(this._entitlementService.entitlement),l=this._languageModelsService.getModelsControlManifest(),c=s?l.paid:l.free,u=c7o(r,this._selectedModel?.identifier,this._languageModelsService.getRecentlyUsedModelIds(),c,this._productService.version,this._updateService.state.type,n,this._productService.defaultChatAgent?.manageSettingsUrl,this._delegate.canManageModels(),this._commandService,this._entitlementService),p={showFilter:r.length>=10,filterPlaceholder:d(7407,null),focusFilterOnOpen:!0,collapsedByDefault:new Set([AAe.Other]),minWidth:200},h=Pn(),g={onSelect:v=>{this._actionWidgetService.hide(),v.run()},onHide:()=>{this._domNode?.setAttribute("aria-expanded","false"),Ao(h)&&h.focus()}};this._domNode?.setAttribute("aria-expanded","true"),this._actionWidgetService.show("ChatModelPicker",!1,u,g,t,void 0,[],d7o(),p);let f=Pn();Wre(f)&&f.classList.contains("action-list-filter-input")&&f.classList.add("chat-model-picker-filter-input")}_updateBadge(){if(this._badgeIcon)if(this._badge){let e=this._badge==="info"?M.info:M.warning;Fi(this._badgeIcon,Qo(e)),this._badgeIcon.style.display="",this._badgeIcon.classList.toggle("info",this._badge==="info"),this._badgeIcon.classList.toggle("warning",this._badge==="warning")}else this._badgeIcon.style.display="none"}_renderLabel(){if(!this._domNode)return;let{name:e,statusIcon:t}=this._selectedModel?.metadata||{},o=[];if(t){let r=Qo(t);o.push(r)}o.push(_("span.chat-input-picker-label",void 0,e??d(7402,null))),this._badgeIcon&&o.push(this._badgeIcon),o.push(...Bn("$(chevron-down)")),Fi(this._domNode,...o);let n=this._selectedModel?.metadata.name??d(7402,null);this._domNode.ariaLabel=d(7401,null,n)}};NAe=I([m(1,nl),m(2,ge),m(3,Te),m(4,Wr),m(5,nt),m(6,vr),m(7,zd)],NAe);function u7o(a){let i=a.metadata.id==="auto"&&a.metadata.vendor==="copilot",e=new xe("",{isTrusted:!0,supportThemeIcons:!0});if(e.appendMarkdown(`**${a.metadata.name}**`),e.appendText(`
`),a.metadata.statusIcon&&a.metadata.tooltip&&(a.metadata.statusIcon&&e.appendMarkdown(`$(${a.metadata.statusIcon.id}) `),e.appendMarkdown(`${a.metadata.tooltip}`),e.appendText(`
`)),a.metadata.multiplier&&(e.appendMarkdown(`${d(7412,null,a.metadata.multiplier)}`),e.appendText(`
`)),!i&&(a.metadata.maxInputTokens||a.metadata.maxOutputTokens)){let t=(a.metadata.maxInputTokens??0)+(a.metadata.maxOutputTokens??0);e.appendMarkdown(`${d(7411,null)}: `),e.appendMarkdown(`${p7o(t)}`),e.appendText(`
`)}return e}function p7o(a){return a>=1e6?`${(a/1e6).toFixed(1)}M`:a>=1e3?`${(a/1e3).toFixed(0)}K`:a.toString()}var rte=class extends oc{constructor(e,t,o,n,r,s){super(void 0,e);this.pickerOptions=o;this._contextKeyService=r;this.keybindingService=s;this._managedHover=this._register(new me);this._pickerWidget=this._register(n.createInstance(NAe,t)),this._pickerWidget.setSelectedModel(t.currentModel.get()),this._pickerWidget.setHideChevrons(o.hideChevrons),this._register(he(l=>{let c=t.currentModel.read(l);this._pickerWidget.setSelectedModel(c),this._updateTooltip()})),this._register(this._pickerWidget.onDidChangeSelection(l=>t.setModel(l)))}render(e){this._pickerWidget.render(e),this.element=this._pickerWidget.domNode,this._updateTooltip(),e.classList.add("chat-input-picker-item")}_getAnchorElement(){return this.element&&Ki().document.contains(this.element)?this.element:this.pickerOptions.getOverflowAnchor?.()??this.element}openModelPicker(){this._showPicker()}show(){this._showPicker()}_showPicker(){this._pickerWidget.show(this._getAnchorElement())}_updateTooltip(){if(!this.element)return;let e=this._getHoverContents();typeof e=="string"&&e?this._managedHover.value=yp().setupManagedHover(Ni("mouse"),this.element,e):this._managedHover.clear()}_getHoverContents(){let e=d(7447,null),t=this.keybindingService.lookupKeybinding(this._action.id,this._contextKeyService)?.getLabel();t&&(e+=` (${t})`);let{statusIcon:o,tooltip:n}=this._pickerWidget.selectedModel?.metadata||{};return o&&n?`${e} \u2022 ${n}`:e}};rte=I([m(3,F),m(4,X),m(5,_e)],rte);var OAe=_,Cmo=250,xmo=20,oUt={compact:{top:2,bottom:2},default:{top:12,bottom:12}},kmo="chat.cachedLanguageModels.v2",m7o=320;var h7o=PB({defaultValue:void 0,key:"chat.untitledInputState",toStorage:JSON.stringify,fromStorage(a){let i=JSON.parse(a);if(i.selectedModel&&!i.selectedModel.metadata.isDefaultForLocation){let e=i.selectedModel.metadata.isDefault,t={panel:!!e};Nu(i.selectedModel.metadata,{isDefaultForLocation:t}),delete i.selectedModel.metadata.isDefault}return i}}),F3=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N,O,V,U,G,$,te,pe,de,se,Se){super();this.location=e;this.options=t;this.inline=n;this.modelService=r;this.instantiationService=s;this.contextKeyService=l;this.configurationService=c;this.keybindingService=u;this.accessibilityService=p;this.languageModelsService=h;this.logService=g;this.fileService=f;this.editorService=v;this.themeService=b;this.textModelResolverService=S;this.storageService=y;this.agentService=w;this.sharedWebExtracterService=k;this.experimentService=T;this.entitlementService=N;this.chatModeService=O;this.toolService=V;this.chatService=U;this.chatSessionsService=G;this.chatContextService=$;this.agentSessionsService=te;this.workspaceContextService=pe;this.layoutService=de;this.viewDescriptorService=se;this._chatAttachmentWidgetRegistry=Se;this._workingSetCollapsed=Le("chatInputPart.workingSetCollapsed",!0);this._stableInputPartWidth=Le("chatInputPart.stableInputPartWidth",0);this._chatInputTodoListWidget=this._register(new me);this._chatQuestionCarouselWidgets=this._register(new jt);this._questionCarouselResponseIds=new Map;this._questionCarouselSessionResources=new Map;this._chatEditingTodosDisposables=this._register(new P);this._onDidLoadInputState=this._register(new E);this.onDidLoadInputState=this._onDidLoadInputState.event;this._toolbarRelayoutScheduler=this._register(new Dt(()=>{typeof this.cachedWidth=="number"&&this.layout(this.cachedWidth)},0));this._onDidFocus=this._register(new E);this.onDidFocus=this._onDidFocus.event;this._onDidBlur=this._register(new E);this.onDidBlur=this._onDidBlur.event;this._onDidChangeContext=this._register(new E);this.onDidChangeContext=this._onDidChangeContext.event;this._onDidAcceptFollowup=this._register(new E);this.onDidAcceptFollowup=this._onDidAcceptFollowup.event;this._onDidClickOverlay=this._register(new E);this.onDidClickOverlay=this._onDidClickOverlay.event;this._indexOfLastAttachedContextDeletedWithKeyboard=-1;this._indexOfLastOpenedContext=-1;this._onDidChangeVisibility=this._register(new E);this.inputEditorHeight=0;this.followupsDisposables=this._register(new P);this.overlayClickListener=this._register(new me);this.attachedContextDisposables=this._register(new me);this._widgetController=this._register(new me);this._contextUsageDisposables=this._register(new me);this.height=Le(this,0);this._modelSyncDisposables=this._register(new P);this._isSyncingToOrFromInputModel=!1;this.chatSessionPickerWidgets=new Map;this._waitForPersistedLanguageModel=this._register(new me);this._chatSessionOptionEmitters=new Map;this._optionContextKeys=new Map;this._currentLanguageModel=Le("_currentLanguageModel",void 0);this._onDidChangeCurrentChatMode=this._register(new E);this.onDidChangeCurrentChatMode=this._onDidChangeCurrentChatMode.event;this.inputUri=A.parse(`${Y.vscodeChatInput}:input-${F3._counter++}`);this._workingSetLinesAddedSpan=new co(()=>_(".working-set-lines-added"));this._workingSetLinesRemovedSpan=new co(()=>_(".working-set-lines-removed"));this._chatEditsActionsDisposables=this._register(new P);this._chatEditsDisposables=this._register(new P);this._renderingChatEdits=this._register(new me);this._attemptedWorkingSetEntriesCount=0;this._chatSessionIsEmpty=!1;this._pendingDelegationTarget=void 0;this._currentSessionType=void 0;this._syncTextDebounced=this._register(new Dt(()=>this._syncInputStateToModel(),150)),this._emptyInputState=this._register(h7o(1,0,this.storageService)),this._contextResourceLabels=this._register(this.instantiationService.createInstance(Za,{onDidChangeVisibility:this._onDidChangeVisibility.event})),this._currentModeObservable=Le("currentMode",this.options.defaultMode??Pl.Agent),this._currentPermissionLevel=Le("permissionLevel","default"),this._register(this.editorService.onDidActiveEditorChange(()=>{this._indexOfLastOpenedContext=-1,this.refreshChatSessionPickers()})),this._register(this.chatSessionsService.onDidChangeSessionOptions(Ee=>{let He=this._widget?.viewModel?.model.sessionResource;He&&Xe(He,Ee)&&this.refreshChatSessionPickers()})),this._register(this.chatSessionsService.onDidChangeOptionGroups(Ee=>{let He=this._widget?.viewModel?.model.sessionResource;if(He){let Ve=this.chatService.getChatSessionFromInternalUri(He),Fe=this.options.sessionTypePickerDelegate?.getActiveSessionProvider?.();(Ve?.chatSessionType===Ee||Fe===Ee)&&this.refreshChatSessionPickers()}})),this.options.sessionTypePickerDelegate?.onDidChangeActiveSessionProvider&&this._register(this.options.sessionTypePickerDelegate.onDidChangeActiveSessionProvider(async Ee=>{this.computeVisibleOptionGroups(),this.agentSessionTypeKey.set(Ee),this.updateWidgetLockStateFromSessionType(Ee),this.refreshChatSessionPickers()})),this._attachmentModel=this._register(this.instantiationService.createInstance(CAe)),this._register(this._attachmentModel.onDidChange(()=>this._syncInputStateToModel())),this.selectedToolsModel=this._register(this.instantiationService.createInstance(ZPe,this.currentModeObs,this._currentLanguageModel)),this.dnd=this._register(this.instantiationService.createInstance(EAe,()=>this._widget,this._attachmentModel,o)),this.inputEditorMaxHeight=this.options.renderStyle==="compact"?Cmo/3:Cmo;let ke=this.options.renderStyle==="compact"?oUt.compact:oUt.default;if(this.inputEditorMinHeight=this.options.inputEditorMinLines?this.options.inputEditorMinLines*xmo+ke.top+ke.bottom:void 0,this.inputEditorHasText=ie.inputHasText.bindTo(l),this.chatCursorAtTop=ie.inputCursorAtTop.bindTo(l),this.inputEditorHasFocus=ie.inputHasFocus.bindTo(l),this._hasQuestionCarouselContextKey=ie.Editing.hasQuestionCarousel.bindTo(l),this.chatModeKindKey=ie.chatModeKind.bindTo(l),this.chatModeNameKey=ie.chatModeName.bindTo(l),this.chatModelIdKey=ie.chatModelId.bindTo(l),this.permissionLevelKey=ie.chatPermissionLevel.bindTo(l),this.withinEditSessionKey=ie.withinEditSessionDiff.bindTo(l),this.filePartOfEditSessionKey=ie.filePartOfEditSession.bindTo(l),this.chatSessionHasOptions=ie.chatSessionHasModels.bindTo(l),this.chatSessionOptionsValid=ie.chatSessionOptionsValid.bindTo(l),this.agentSessionTypeKey=ie.agentSessionType.bindTo(l),this.options.sessionTypePickerDelegate?.getActiveSessionProvider){let Ee=this.options.sessionTypePickerDelegate.getActiveSessionProvider();Ee&&this.agentSessionTypeKey.set(Ee)}this.chatSessionHasCustomAgentTarget=ie.chatSessionHasCustomAgentTarget.bindTo(l),this.chatSessionHasTargetedModels=ie.chatSessionHasTargetedModels.bindTo(l),this.history=this._register(this.instantiationService.createInstance(dee,this.location)),this._register(this.configurationService.onDidChangeConfiguration(Ee=>{let He={};Ee.affectsConfiguration("accessibility.verbosity.panelChat")&&(He.ariaLabel=this._getAriaLabel()),Ee.affectsConfiguration("editor.wordSegmenterLocales")&&(He.wordSegmenterLocales=this.configurationService.getValue("editor.wordSegmenterLocales")),Ee.affectsConfiguration("editor.autoClosingBrackets")&&(He.autoClosingBrackets=this.configurationService.getValue("editor.autoClosingBrackets")),Ee.affectsConfiguration("editor.autoClosingQuotes")&&(He.autoClosingQuotes=this.configurationService.getValue("editor.autoClosingQuotes")),Ee.affectsConfiguration("editor.autoSurround")&&(He.autoSurround=this.configurationService.getValue("editor.autoSurround")),this.inputEditor.updateOptions(He)})),this._chatEditsListPool=this._register(this.instantiationService.createInstance(qee,this._onDidChangeVisibility.event,D.ChatEditingWidgetModifiedFilesToolbar,{verticalScrollMode:3})),this._hasFileAttachmentContextKey=ie.hasFileAttachments.bindTo(l),this.initSelectedModel(),this._register(this.languageModelsService.onDidChangeLanguageModels(()=>{fmo(this._currentLanguageModel.get()?.identifier,this.getModels())&&this.setCurrentLanguageModelToDefault()})),this._register(this.onDidChangeCurrentChatMode(()=>{this.accessibilityService.alert(this._currentModeObservable.get().label.get()),this._inputEditor&&this._inputEditor.updateOptions({ariaLabel:this._getAriaLabel()}),this.setImplicitContextEnablement()})),this._register(he(Ee=>{let He=this._currentLanguageModel.read(Ee);this.chatModelIdKey.set(He?.metadata.id.toLowerCase()??""),He?.metadata.name&&this.accessibilityService.alert(He.metadata.name),this._inputEditor?.updateOptions({ariaLabel:this._getAriaLabel()})})),this._register(this.chatModeService.onDidChangeChatModes(()=>this.validateCurrentChatMode())),this._register(he(Ee=>{let He=this._currentModeObservable.read(Ee);this.chatModeKindKey.set(He.kind),this.chatModeNameKey.set(He.name.read(Ee));let Ve=He.model?.read(Ee);Ve&&this.switchModelByQualifiedName(Ve)})),this._register(he(Ee=>{let He=this._currentModeObservable.read(Ee),Ve=He.name.read(Ee),Fe=this._widget?.viewModel?.model.sessionResource;if(Fe){let Qt=this.chatService.getChatSessionFromInternalUri(Fe);if(Qt){let Ze=!0,Ti=this.chatSessionsService.getSessionOption(Qt.chatSessionResource,aTt);if(typeof Ti<"u"){let ti=(typeof Ti=="string"?Ti:Ti.id)||Pl.Agent.id;Ze=ti===Pl.Agent.id?He.id!==Pl.Agent.id:He.label.read(void 0)!==ti}Ze&&this.chatSessionsService.notifySessionOptionsChange(Qt.chatSessionResource,[{optionId:aTt,value:He.isBuiltin?"":Ve}]).catch(ti=>this.logService.error("Failed to notify extension of agent change:",ti))}}})),this.validateCurrentChatMode()}static{this._counter=0}get attachmentModel(){return this._attachmentModel}getAttachedContext(){let e=new Uj;return e.add(...this.attachmentModel.attachments,...this.chatContextService.getWorkspaceContextItems()),e}getAttachedAndImplicitContext(){let e=this.getAttachedContext();if(this.implicitContext){let t=this.implicitContext.enabledBaseEntries(this.configurationService.getValue("chat.implicitContext.suggestedContext"));e.add(...t)}return e}get implicitContext(){return this._implicitContext}get inputContainerElement(){return this.inputContainer}get gettingStartedTipContainerElement(){return this.chatGettingStartedTipContainer}get inputEditor(){return this._inputEditor}get currentLanguageModel(){return this._currentLanguageModel.get()?.identifier}get selectedLanguageModel(){return this._currentLanguageModel}get currentModeKind(){let e=this._currentModeObservable.get();return e.kind==="agent"&&!this.agentService.hasToolsAgent?"edit":e.kind}get currentModeObs(){return this._currentModeObservable}get currentPermissionLevelObs(){return this._currentPermissionLevel}get currentModeInfo(){let e=this._currentModeObservable.get(),t=e.isBuiltin?this.currentModeKind:"custom",o=e.modeInstructions?.get();return{kind:this.currentModeKind,isBuiltin:e.isBuiltin,modeInstructions:o?{uri:e.uri?.get(),name:e.name.get(),content:o.content,toolReferences:this.toolService.toToolReferences(o.toolReferences),metadata:o.metadata,isBuiltin:e.isBuiltin}:void 0,modeId:t,modeName:t3(e),applyCodeBlockSuggestionId:void 0,permissionLevel:this._currentPermissionLevel.get()}}get selectedElements(){let e=[],o=this._chatEditList?.object?.getSelectedElements()??[];for(let n of o)n.kind==="reference"&&A.isUri(n.reference)&&e.push(n.reference);return e}get attemptedWorkingSetEntriesCount(){return this._attemptedWorkingSetEntriesCount}get pendingDelegationTarget(){return this._pendingDelegationTarget}setImplicitContextEnablement(){this.implicitContext&&this.configurationService.getValue("chat.implicitContext.suggestedContext")&&this.implicitContext.setEnabled(this._currentModeObservable.get().name.get().toLowerCase()==="ask")}setIsWithinEditSession(e,t){this.withinEditSessionKey.set(e),this.filePartOfEditSessionKey.set(t)}getSelectedModelStorageKey(){let e=this._currentSessionType;return e&&this.hasModelsTargetingSessionType()?`chat.currentLanguageModel.${this.location}.${e}`:`chat.currentLanguageModel.${this.location}`}getSelectedModelIsDefaultStorageKey(){let e=this._currentSessionType;return e&&this.hasModelsTargetingSessionType()?`chat.currentLanguageModel.${this.location}.${e}.isDefault`:`chat.currentLanguageModel.${this.location}.isDefault`}initSelectedModel(){let e=this.storageService.get(this.getSelectedModelStorageKey(),-1),t=this.storageService.getBoolean(this.getSelectedModelIsDefaultStorageKey(),-1,!0);if(e){let o=Mki(e,t,this.getModels(),this.location);o.shouldRestore&&o.model?(this.setCurrentLanguageModel(o.model),this.checkModelSupported()):o.model||(this._waitForPersistedLanguageModel.value=this.languageModelsService.onDidChangeLanguageModels(n=>{let r=this.languageModelsService.lookupLanguageModel(e);if(r){this._waitForPersistedLanguageModel.clear();let s={metadata:r,identifier:e};vmo(e,t,s,this.location)&&(this.setCurrentLanguageModel(s),this.checkModelSupported())}else this.setCurrentLanguageModelToDefault()}))}this._register(this._onDidChangeCurrentChatMode.event(()=>{this.checkModelSupported()}))}setEditing(e,t){this.currentlyEditingInputKey?.set(e),this.editingSentRequestKey?.set(t)}switchModel(e){let o=this.getModels().find(n=>n.metadata.vendor===e.vendor&&n.metadata.id===e.id&&n.metadata.family===e.family);o&&this.setCurrentLanguageModel(o)}switchModelByQualifiedName(e){let t=this.getModels();for(let o of e){let n=t.find(r=>R_.matchesQualifiedName(o,r.metadata));if(n)return this.setCurrentLanguageModel(n),!0}return this.logService.warn(`[chat] Node of the models "${e.join(", ")}" not found. Use format "<name> (<vendor>)", e.g. "GPT-4o (copilot)".`),!1}switchToNextModel(){let e=this.getModels();if(e.length>0){let o=(e.findIndex(n=>n.identifier===this._currentLanguageModel.get()?.identifier)+1)%e.length;this.setCurrentLanguageModel(e[o])}}openModelPicker(){this.modelWidget?.show()}openModePicker(){this.modeWidget?.show()}openPermissionPicker(){this.permissionWidget?.show()}setPermissionLevel(e){this._currentPermissionLevel.set(e,void 0),this.permissionLevelKey.set(e),this.permissionWidget?.refresh()}openSessionTargetPicker(){this.sessionTargetWidget?.show()}openDelegationPicker(){this.delegationWidget?.show()}openChatSessionPicker(){this.chatSessionPickerWidgets?.values()?.next().value?.show()}createChatSessionPickerWidgets(e){this._lastSessionPickerAction=e;let t=this.computeVisibleOptionGroups();if(!t)return[];let{visibleGroupIds:o,optionGroups:n,effectiveSessionType:r}=t;this.disposeSessionPickerWidgets();let s=[];for(let l of n){if(!o.has(l.id))continue;let c=this.getCurrentOptionForGroup(l.id),u={group:l,item:c},p={getCurrentOption:()=>this.getCurrentOptionForGroup(l.id),onDidChangeOption:this.getOrCreateOptionEmitter(l.id).event,setOption:g=>{this.updateOptionContextKey(l.id,g.id),this.getOrCreateOptionEmitter(l.id).fire(g);let f=this._widget?.viewModel?.model.sessionResource,v=f?this.chatService.getChatSessionFromInternalUri(f):void 0;v&&this.chatSessionsService.notifySessionOptionsChange(v.chatSessionResource,[{optionId:l.id,value:g}]).catch(b=>this.logService.error(`Failed to notify extension of ${l.id} change:`,b)),this.refreshChatSessionPickers()},getOptionGroup:()=>this.chatSessionsService.getOptionGroupsForSessionType(r)?.find(f=>f.id===l.id),getSessionResource:()=>this._widget?.viewModel?.model.sessionResource},h=this.instantiationService.createInstance(l.searchable?f2:g2,e,u,p);this.chatSessionPickerWidgets.set(l.id,h),s.push(h)}return s}setInputModel(e,t){this._inputModel=e,this._modelSyncDisposables.clear(),this.selectedToolsModel.resetSessionEnablementState(),this._chatSessionIsEmpty=t,t&&!this.configurationService.getValue("chat.tools.global.autoApprove")&&!pz(this._currentPermissionLevel.get())&&(this._currentPermissionLevel.set("default",void 0),this.permissionLevelKey.set("default"),this.permissionWidget?.refresh()),t&&this._setEmptyModelState(),this._modelSyncDisposables.add(he(o=>{let n=e.state.read(o);!n&&this._chatSessionIsEmpty&&(n=this._emptyInputState.read(void 0)),this._syncFromModel(n)}))}_setEmptyModelState(){let e=this.getDefaultModeExperimentStorageKey();if(!this.storageService.getBoolean(e,1,!1)){let o=this.entitlementService.anonymous;this.experimentService.getTreatment("chat.defaultMode").then((n=>{if(o&&(n="agent"),typeof n=="string"){this.storageService.store(e,!0,1,1);let r=dYi(n);r&&(this.logService.trace(`Applying default mode from experiment: ${r}`),this.setChatMode(r,!1),this.checkModelSupported())}}))}}_syncFromModel(e){if(!this._isSyncingToOrFromInputModel)try{if(this._isSyncingToOrFromInputModel=!0,e&&this._currentModeObservable.get().id!==e.mode.id&&this.setChatMode(e.mode.id,!1),e?.selectedModel){let o=this.getAllMergedModels(),n=this.getCurrentSessionType(),r=hmo(e.selectedModel,this._currentLanguageModel.get(),o,n,{location:this.location,currentModeKind:this.currentModeKind,isInlineChatV2Enabled:!!this.configurationService.getValue("inlineChat.enableV2"),sessionType:n});r.action==="apply"?this.setCurrentLanguageModel(e.selectedModel):r.action==="default"&&this.setCurrentLanguageModelToDefault()}let t=this._attachmentModel.attachments;e?$i(t,e.attachments)||this._attachmentModel.clearAndSetContext(...e.attachments):this._attachmentModel.clear(),this._inputEditor&&(this._inputEditor.setValue(e?.inputText||""),e?.selections.length&&this._inputEditor.setSelections(e.selections)),e&&this._widget?.contribs.forEach(o=>{o.setInputState?.(e.contrib)})}finally{this._isSyncingToOrFromInputModel=!1}}_syncInputStateToModel(){if(this._isSyncingToOrFromInputModel)return;this._isSyncingToOrFromInputModel=!0;let e=this.getCurrentInputState();this._chatSessionIsEmpty&&this._emptyInputState.set(e,void 0),this._inputModel?.setState(e),this._isSyncingToOrFromInputModel=!1}setCurrentLanguageModel(e){this._currentLanguageModel.set(e,void 0),this.cachedWidth&&this.layout(this.cachedWidth),this.storageService.store(this.getSelectedModelStorageKey(),e.identifier,-1,0),this.storageService.store(this.getSelectedModelIsDefaultStorageKey(),!!e.metadata.isDefaultForLocation[this.location],-1,0),this._syncInputStateToModel()}checkModelSupported(){let e=this._currentLanguageModel.get(),t=this.getAllMergedModels();mmo(e,this.getModels(),{location:this.location,currentModeKind:this.currentModeKind,isInlineChatV2Enabled:!!this.configurationService.getValue("inlineChat.enableV2"),sessionType:this.getCurrentSessionType()},t)&&this.setCurrentLanguageModelToDefault()}setChatMode(e,t=!0){if(!this.options.supportsChangingModes)return;let o=this.chatModeService.findModeById(e)??this.chatModeService.findModeByName(e)??this.chatModeService.findModeById("agent")??Pl.Ask;this.setChatMode2(o,t)}setChatMode2(e,t=!0){this.options.supportsChangingModes&&(this._currentModeObservable.set(e,void 0),this._onDidChangeCurrentChatMode.fire(),this._syncInputStateToModel())}getAllMergedModels(){let e=this.storageService.getObject(kmo,-1,[]),t=this.languageModelsService.getLanguageModelIds().map(r=>({identifier:r,metadata:this.languageModelsService.lookupLanguageModel(r)})),o=new Set(this.languageModelsService.getVendors().map(r=>r.vendor)),n=gmo(t,e,o);return t.length>0&&this.storageService.store(kmo,n,-1,1),n}getModels(){let e=this.getAllMergedModels();return e.sort((t,o)=>t.metadata.name.localeCompare(o.metadata.name)),umo(e,this.getCurrentSessionType(),this.currentModeKind,this.location,!!this.configurationService.getValue("inlineChat.enableV2"))}getCurrentSessionType(){let e=this.options.sessionTypePickerDelegate?.getActiveSessionProvider?.();if(e)return e;let t=this._widget?.viewModel?.model.sessionResource;return(t?this.chatService.getChatSessionFromInternalUri(t):void 0)?.chatSessionType}hasModelsTargetingSessionType(){return JHt(this.getAllMergedModels(),this.getCurrentSessionType())}isModelValidForCurrentSession(e){return ZHt(e,this.getAllMergedModels(),this.getCurrentSessionType())}checkModelInSessionPool(){let e=this._currentLanguageModel.get();e&&!this.isModelValidForCurrentSession(e)&&this.setCurrentLanguageModelToDefault()}preselectModelFromSessionHistory(){let e=this._widget?.viewModel?.model.sessionResource,t=e?this.chatService.getChatSessionFromInternalUri(e):void 0;if(!(t&&this.chatSessionsService.requiresCustomModelsForSessionType(t.chatSessionType)))return;let n=this._widget?.viewModel?.model.getRequests();if(!n||n.length===0)return;let r;for(let c=n.length-1;c>=0;c--)if(n[c].modelId){r=n[c].modelId;break}if(!r)return;let s=()=>{let c=this.getModels(),u=c.find(p=>p.identifier===r);return u||(u=c.find(p=>p.metadata.id===r)),u},l=s();if(l){this.setCurrentLanguageModel(l);return}this._waitForPersistedLanguageModel.value=this.languageModelsService.onDidChangeLanguageModels(()=>{let c=s();c&&(this._waitForPersistedLanguageModel.clear(),this.setCurrentLanguageModel(c))})}setCurrentLanguageModelToDefault(){let e=this.getModels(),t=pmo(e,this.location);t&&this.setCurrentLanguageModel(t)}getCurrentInputState(){let e=this._currentModeObservable.get(),t={inputText:this._inputEditor?.getValue()??"",attachments:this._attachmentModel.attachments,mode:{id:e.id,kind:e.kind},selectedModel:this._currentLanguageModel.get(),selections:this._inputEditor?.getSelections()||[],contrib:{}};for(let o of this._widget?.contribs||ht.empty())o.getInputState?.(t.contrib);return t}_getAriaLabel(){let e=this.configurationService.getValue("accessibility.verbosity.panelChat"),t;e&&(t=this.keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getLabel());let o=this._currentModeObservable.get(),n=this._currentLanguageModel.get()?.metadata.name,r=n?d(7395,null,n):"",s="";if(o.isBuiltin)switch(this.currentModeKind){case"agent":s=d(7391,null);break;case"edit":s=d(7394,null);break;case"ask":default:s=d(7392,null);break}else{let l=this.currentModeObs.get();s=d(7393,null,l.label.get(),l.description.get())}return e?t?d(7384,null,s,r,t):d(7390,null,s,r):d(7389,null,s,r)}validateCurrentChatMode(){let e=this._currentModeObservable.get(),t=this.chatModeService.findModeById(e.id),o=this.configurationService.getValue("chat.agent.enabled");if(!t){this.setChatMode(o?"agent":"ask");return}if(e.kind==="agent"&&!o){this.setChatMode("ask");return}}getDefaultModeExperimentStorageKey(){return`chat.${this.options.widgetViewKindTag}.hasSetDefaultModeByExperiment`}logInputHistory(){let e=this.history.values.map(t=>JSON.stringify(t)).join(`
`);this.logService.info(`[${this.location}] Chat input history:`,e)}setVisible(e){this._onDidChangeVisibility.fire(e)}get generating(){return this._generating?.defer.p}startGenerating(){return this.logService.trace("ChatWidget#startGenerating"),this._generating?this._generating.rc++:this._generating={rc:1,defer:new Go},Z(()=>{this.logService.trace("ChatWidget#doneGenerating"),this._generating&&!--this._generating.rc&&(this._generating.defer.complete(),this._generating=void 0)})}get element(){return this.container}async showPreviousValue(){if(this.history.isAtStart())return;let e=this.getCurrentInputState();(e.inputText||e.attachments.length)&&this.history.overlay(e),this.navigateHistory(!0)}async showNextValue(){if(this.history.isAtEnd())return;let e=this.getCurrentInputState();(e.inputText||e.attachments.length)&&this.history.overlay(e),this.navigateHistory(!1)}async navigateHistory(e){let t=e?this.history.previous():this.history.next(),o=t?.attachments??[];o.length>0&&(o=(await Promise.all(o.map(async l=>{if(pV(l)&&l.references?.length&&A.isUri(l.references[0].reference)){let c=l.references[0].reference;try{let u=c.toString(!0).startsWith("http")?await this.sharedWebExtracterService.readImage(c,ve.None):(await this.fileService.readFile(c)).value;if(!u)return;let p={...l};return p.value=pV(l)&&l.isPasted?u.buffer:await k_(u.buffer),p}catch(u){this.logService.error("Failed to fetch and reference.",u);return}}return l}))).filter(l=>l!==void 0)),this._attachmentModel.clearAndSetContext(...o);let n=t?.inputText??"",r=t?.contrib??{};Or(n),this.setValue(n,!0),this._widget?.contribs.forEach(l=>{l.setInputState?.(r)}),this._onDidLoadInputState.fire();let s=this._inputEditor.getModel();s&&(e?this._inputEditor.setPosition({lineNumber:1,column:1}):this._inputEditor.setPosition(Fki(s)))}setValue(e,t){this.inputEditor.setValue(e);let o=this.inputEditor.getModel();o&&this.inputEditor.setPosition(Fki(o))}focus(){this._inputEditor.focus()}hasFocus(){return this._inputEditor.hasWidgetFocus()}focusTodoList(){return this._chatInputTodoListWidget.value?.focus()??!1}isTodoListFocused(){return this._chatInputTodoListWidget.value?.hasFocus()??!1}hasVisibleTodos(){return this._chatInputTodoListWidget.value?.hasTodos()??!1}async acceptInput(e){if(e){let t=this.getCurrentInputState();this.history.append(this._getFilteredEntry(t))}this._chatSessionIsEmpty&&(this._chatSessionIsEmpty=!1,this._emptyInputState.set(void 0,void 0)),this.attachmentModel.clear(),this._onDidLoadInputState.fire(),this.accessibilityService.isScreenReaderOptimized()&&it?this._acceptInputForVoiceover():(this._inputEditor.focus(),this._inputEditor.setValue(""))}validateAgentMode(){!this.agentService.hasToolsAgent&&this._currentModeObservable.get().kind==="agent"&&this.setChatMode("edit")}_getFilteredEntry(e){let t=e.attachments.map(o=>{if(pV(o)&&o.references?.length&&o.value){let n={...o};return n.value=void 0,n}return o});return{...e,attachments:t}}_acceptInputForVoiceover(){let e=this._inputEditor.getDomNode();e&&(e.remove(),this._inputEditor.setValue(""),this._inputEditorElement.appendChild(e),this._inputEditor.focus())}_handleAttachedContextChange(){this._hasFileAttachmentContextKey.set(!!this._attachmentModel.attachments.find(e=>e.kind==="file")),this.renderAttachedContext()}getOrCreateOptionEmitter(e){let t=this._chatSessionOptionEmitters.get(e);return t||(t=this._register(new E),this._chatSessionOptionEmitters.set(e,t)),t}getOrCreateOptionContextKey(e){if(!this._scopedContextKeyService)return;let t=this._optionContextKeys.get(e);return t||(t=new Q(`chatSessionOption.${e}`,"").bindTo(this._scopedContextKeyService),this._optionContextKeys.set(e,t)),t}updateOptionContextKey(e,t){let o=t.trim(),n=this.getOrCreateOptionContextKey(e);n&&n.set(o)}evaluateOptionGroupVisibility(e){if(!e.when||!this._scopedContextKeyService)return!0;let t=x.deserialize(e.when);return t?this._scopedContextKeyService.contextMatchesRules(t):!0}computeVisibleOptionGroups(){let e=()=>{this.chatSessionHasOptions.set(!1),this.chatSessionOptionsValid.set(!0)},t=this._widget?.viewModel?.model.sessionResource,o=t?this.chatService.getChatSessionFromInternalUri(t):void 0,n=o&&this.chatSessionsService.getCustomAgentTargetForSessionType(o.chatSessionType);this.chatSessionHasCustomAgentTarget.set(n!=="undefined");let r=o&&this.chatSessionsService.requiresCustomModelsForSessionType(o.chatSessionType);if(this.chatSessionHasTargetedModels.set(!!r),n){let h=this.chatSessionsService.getSessionOption(o.chatSessionResource,aTt);if(typeof h<"u"){let g=(typeof h=="string"?h:h.id)||Pl.Agent.id,f=this._currentModeObservable.get();(g===Pl.Agent.id?f.id!==Pl.Agent.id:f.label.get()!==g)&&this.setChatMode(g)}}let l=this.options.sessionTypePickerDelegate?.getActiveSessionProvider?.()??o?.chatSessionType;if(!l){e();return}let c=this.chatSessionsService.getOptionGroupsForSessionType(l);if(!c||c.length===0){e();return}if(o)for(let h of c){let g=this.chatSessionsService.getSessionOption(o.chatSessionResource,h.id);if(g){let f=typeof g=="string"?g:g.id;this.updateOptionContextKey(h.id,f)}}let u=new Set;for(let h of c){let g=h.items.length>0||(h.commands||[]).length>0,f=this.evaluateOptionGroupVisibility(h),v=!o||this.chatSessionsService.getSessionOption(o.chatSessionResource,h.id)!==void 0;g&&f&&v&&u.add(h.id)}if(u.size===0){e();return}let p=!0;if(o)for(let h of u){let g=c.find(v=>v.id===h),f=this.chatSessionsService.getSessionOption(o.chatSessionResource,h);if(g&&f){let v=typeof f=="string"?f:f.id;if(!g.items.some(b=>b.id===v)&&typeof f=="string"){p=!1;break}}}return this.chatSessionHasOptions.set(!0),this.chatSessionOptionsValid.set(p),{visibleGroupIds:u,optionGroups:c,ctx:o,effectiveSessionType:l}}refreshChatSessionPickers(){let e=this.computeVisibleOptionGroups();if(!e){this.hideAllSessionPickerWidgets();return}let{visibleGroupIds:t,optionGroups:o,ctx:n}=e,r=new Set(this.chatSessionPickerWidgets.keys());if((r.size!==t.size||!Array.from(t).every(l=>r.has(l)))&&this._lastSessionPickerAction&&this.chatSessionPickerContainer){let l=this.createChatSessionPickerWidgets(this._lastSessionPickerAction);Rt(this.chatSessionPickerContainer);for(let c of l){let u=_(".action-item.chat-sessionPicker-item");c.render(u),this.chatSessionPickerContainer.appendChild(u)}}if(this.chatSessionPickerContainer&&(this.chatSessionPickerContainer.style.display=""),n)for(let[l]of this.chatSessionPickerWidgets.entries()){let c=this.chatSessionsService.getSessionOption(n.chatSessionResource,l);if(c){let u=o.find(p=>p.id===l);if(u){let p=typeof c=="string"?c:c.id,h=u.items.find(g=>g.id===p);h&&typeof c=="string"?this.getOrCreateOptionEmitter(l).fire(h):typeof c!="string"&&this.getOrCreateOptionEmitter(l).fire(c)}}}}hideAllSessionPickerWidgets(){this.chatSessionPickerContainer&&(this.chatSessionPickerContainer.style.display="none")}disposeSessionPickerWidgets(){for(let e of this.chatSessionPickerWidgets.values())e.dispose();this.chatSessionPickerWidgets.clear()}getCurrentOptionForGroup(e){let t=this._widget?.viewModel?.model.sessionResource;if(!t)return;let o=this.chatService.getChatSessionFromInternalUri(t);if(!o||this.chatSessionsService.getSessionOption(o.chatSessionResource,e)===void 0)return;let n=this.getEffectiveSessionType(o,this.options.sessionTypePickerDelegate),s=this.chatSessionsService.getOptionGroupsForSessionType(n)?.find(c=>c.id===e);if(!s||s.items.length===0)return;let l=this.chatSessionsService.getSessionOption(o.chatSessionResource,e);if(!l)return s.items.find(u=>u.default);if(typeof l=="string"){let c=l.trim();return s.items.find(u=>u.id===c)}else return l}getEffectiveSessionType(e,t){return this.options.sessionTypePickerDelegate?.getActiveSessionProvider?.()||e?.chatSessionType||""}updateAgentSessionTypeContextKey(){let e=this._widget?.viewModel?.model.sessionResource,t=this.options.sessionTypePickerDelegate,n=t?.setActiveSessionProvider&&t?.getActiveSessionProvider?.()||(e?fg(e):"");this.agentSessionTypeKey.set(n)}updateWidgetLockStateFromSessionType(e){if(e===qp){this._widget?.unlockFromCodingAgent();return}let t=this.chatSessionsService.getChatSessionContribution(e);t?this._widget?.lockToCodingAgent(t.name,t.displayName,t.type):this._widget?.unlockFromCodingAgent()}tryUpdateWidgetController(){let e=this._widget?.viewModel?.model.sessionResource;if(!e)return;let t=this.options.sessionTypePickerDelegate;if(!((t?.setActiveSessionProvider&&t?.getActiveSessionProvider?.()||this._pendingDelegationTarget||fg(e))===qp)){this._widgetController.clear();return}this._widgetController.value||(this._widgetController.value=this.instantiationService.createInstance(_Ae,this.chatInputWidgetsContainer))}showContextUsageDetails(){return this.contextUsageWidget?.showDetails()??!1}updateContextUsageWidget(){this._contextUsageDisposables.clear();let e=this._widget?.viewModel?.model;if(!e||!this.contextUsageWidget)return;let t=new P;this._contextUsageDisposables.value=t,t.add(e.onDidChange(o=>{(o.kind==="addRequest"||o.kind==="completedRequest")&&this.contextUsageWidget?.update(e.lastRequest)})),this.contextUsageWidget.update(e.lastRequest)}render(e,t,o){this._widget=o,this.computeVisibleOptionGroups();let n=this.options.sessionTypePickerDelegate;if(n?.setActiveSessionProvider&&n?.getActiveSessionProvider){let V=n.getActiveSessionProvider();V&&this.updateWidgetLockStateFromSessionType(V)}this._register(o.onDidChangeViewModel(V=>{this._pendingDelegationTarget=void 0,this.updateAgentSessionTypeContextKey(),this.refreshChatSessionPickers(),this.tryUpdateWidgetController(),this.updateContextUsageWidget();let U=!1;if(V.currentSessionResource){for(let $ of this._questionCarouselSessionResources.values())if(Xe($,V.currentSessionResource)){U=!0;break}}this._questionCarouselSessionResources.size>0&&(!V.currentSessionResource||!U)&&this.clearQuestionCarousel();let G=this.getCurrentSessionType();V.currentSessionResource&&G!==this._currentSessionType&&(this._currentSessionType=G,this.initSelectedModel(),this.checkModelInSessionPool()),this.preselectModelFromSessionHistory()}));let r;this.options.renderStyle==="compact"?r=bt(".interactive-input-part",[bt(".interactive-input-and-edit-session",[bt(".chat-question-carousel-widget-container@chatQuestionCarouselContainer"),bt(".chat-input-widgets-container@chatInputWidgetsContainer"),bt(".chat-todo-list-widget-container@chatInputTodoListWidgetContainer"),bt(".chat-editing-session@chatEditingSessionWidgetContainer"),bt(".chat-getting-started-tip-container@chatGettingStartedTipContainer"),bt(".interactive-input-and-side-toolbar@inputAndSideToolbar",[bt(".chat-input-container@inputContainer",[bt(".chat-editor-container@editorContainer"),bt(".chat-input-toolbars@inputToolbars")])]),bt(".chat-secondary-toolbar@secondaryToolbar",[bt(".chat-context-usage-container@contextUsageWidgetContainer")]),bt(".chat-attachments-container@attachmentsContainer",[bt(".chat-attached-context@attachedContextContainer")]),bt(".interactive-input-followups@followupsContainer")])]):r=bt(".interactive-input-part",[bt(".chat-question-carousel-widget-container@chatQuestionCarouselContainer"),bt(".interactive-input-followups@followupsContainer"),bt(".chat-input-widgets-container@chatInputWidgetsContainer"),bt(".chat-todo-list-widget-container@chatInputTodoListWidgetContainer"),bt(".chat-editing-session@chatEditingSessionWidgetContainer"),bt(".chat-getting-started-tip-container@chatGettingStartedTipContainer"),bt(".interactive-input-and-side-toolbar@inputAndSideToolbar",[bt(".chat-input-container@inputContainer",[bt(".chat-attachments-container@attachmentsContainer",[bt(".chat-attached-context@attachedContextContainer")]),bt(".chat-editor-container@editorContainer"),bt(".chat-input-toolbars@inputToolbars")])]),bt(".chat-secondary-toolbar@secondaryToolbar",[bt(".chat-context-usage-container@contextUsageWidgetContainer")])]),this.container=r.root,this.chatInputOverlay=_(".chat-input-overlay"),e.append(this.container),this.container.append(this.chatInputOverlay),this.container.classList.toggle("compact",this.options.renderStyle==="compact"),this._scopedContextKeyService=this._register(this.contextKeyService.createScoped(this.container)),this.followupsContainer=r.followupsContainer;let s=r.inputAndSideToolbar,l=r.inputContainer;this.inputContainer=l;let c=r.editorContainer;this.attachmentsContainer=r.attachmentsContainer,this.attachedContextContainer=r.attachedContextContainer;let u=r.inputToolbars;this.secondaryToolbarContainer=r.secondaryToolbar,(this.options.isSessionsWindow||this.options.renderStyle==="compact")&&(this.secondaryToolbarContainer.style.display="none"),this.chatEditingSessionWidgetContainer=r.chatEditingSessionWidgetContainer,this.chatInputTodoListWidgetContainer=r.chatInputTodoListWidgetContainer,this.chatGettingStartedTipContainer=r.chatGettingStartedTipContainer,this.chatGettingStartedTipContainer.style.display="none",this.chatQuestionCarouselContainer=r.chatQuestionCarouselContainer,this.chatInputWidgetsContainer=r.chatInputWidgetsContainer,this.contextUsageWidgetContainer=r.contextUsageWidgetContainer,(this.options.isSessionsWindow||this.options.renderStyle==="compact")&&u.prepend(this.contextUsageWidgetContainer),this.contextUsageWidget=this._register(this.instantiationService.createInstance(v2)),this.contextUsageWidgetContainer.appendChild(this.contextUsageWidget.domNode),this.options.enableImplicitContext&&!this._implicitContext?(this._implicitContext=this._register(this.instantiationService.createInstance(eUt)),this.setImplicitContextEnablement(),this._register(this._implicitContext.onDidChangeValue(()=>{this._indexOfLastAttachedContextDeletedWithKeyboard=-1,this._handleAttachedContextChange()}))):!this.options.enableImplicitContext&&this._implicitContext&&(this._implicitContext?.dispose(),this._implicitContext=void 0),this.tryUpdateWidgetController(),this._register(this._attachmentModel.onDidChange(V=>{V.added.length>0&&(this._indexOfLastAttachedContextDeletedWithKeyboard=-1),this._handleAttachedContextChange()})),this.renderChatEditingSessionState(null),this.dnd.addOverlay(this.options.dndContainer??e,this.options.dndContainer??e);let p=this._register(this.contextKeyService.createScoped(l));ie.inChatInput.bindTo(p).set(!0),this.currentlyEditingInputKey=ie.currentlyEditingInput.bindTo(p),this.editingSentRequestKey=ie.editingRequestType.bindTo(this.contextKeyService);let h=this._register(this.instantiationService.createChild(new Io([X,p]))),{historyNavigationBackwardsEnablement:g,historyNavigationForwardsEnablement:f}=this._register(qM(p,this));this.historyNavigationBackwardsEnablement=g,this.historyNavigationForewardsEnablement=f;let v=Kf(this.configurationService);v.overflowWidgetsDomNode=this.options.editorOverflowWidgetsDomNode,v.pasteAs=zb.pasteAs.defaultValue,v.readOnly=!1,v.ariaLabel=this._getAriaLabel(),v.fontFamily=HN,v.fontSize=13,v.lineHeight=xmo,v.padding=this.options.renderStyle==="compact"?oUt.compact:oUt.default,v.cursorWidth=1,v.wrappingStrategy="advanced",v.bracketPairColorization={enabled:!1},v.autoClosingBrackets=this.configurationService.getValue("editor.autoClosingBrackets"),v.autoClosingQuotes=this.configurationService.getValue("editor.autoClosingQuotes"),v.autoSurround=this.configurationService.getValue("editor.autoSurround"),v.suggest={showIcons:!0,showSnippets:!1,showWords:!0,showStatusBar:!1,insertMode:"insert"},v.scrollbar=this.options.renderStyle==="compact"?{...v.scrollbar??{},vertical:"hidden"}:{...v.scrollbar??{},vertical:"auto",verticalScrollbarSize:7},v.stickyScroll={enabled:!1},this._inputEditorElement=R(c,OAe(Emo));let b=xLe();b.contributions?.push(...aa.getSomeEditorContributions([kl.ID,Yg.ID,lh.ID,ou.ID,Fx.ID])),this._inputEditor=this._register(h.createInstance(jr,this._inputEditorElement,v,b)),El.get(this._inputEditor)?.forceRenderingAbove(),v.overflowWidgetsDomNode?.classList.add("hideSuggestTextIcons"),this._inputEditorElement.classList.add("hideSuggestTextIcons"),this._register(this._inputEditor.onKeyDown(V=>{if(V.keyCode===3&&!spt(V))for(let U of this.keybindingService.lookupKeybindings(SA.ID)){let G=U.getDispatchChords();if(G.length===1&&G[0]==="[Enter]"){V.preventDefault();break}}})),this._register(this._inputEditor.onDidChangeModelContent(()=>{let V=Math.min(this._inputEditor.getContentHeight(),this.inputEditorMaxHeight);V!==this.inputEditorHeight&&(this.inputEditorHeight=V,this.cachedWidth&&this._layout(this.cachedWidth));let U=this._inputEditor.getModel(),G=!!U&&U.getValue().trim().length>0;this.inputEditorHasText.set(G),this._syncTextDebounced.schedule()})),this._register(this._inputEditor.onDidContentSizeChange(V=>{V.contentHeightChanged&&(this.inputEditorHeight=this.inline?this.inputEditorHeight:V.contentHeight,this.cachedWidth&&this._layout(this.cachedWidth))})),this._register(this._inputEditor.onDidFocusEditorText(()=>{this.inputEditorHasFocus.set(!0),this._onDidFocus.fire(),l.classList.toggle("focused",!0)})),this._register(this._inputEditor.onDidBlurEditorText(()=>{this.inputEditorHasFocus.set(!1),l.classList.toggle("focused",!1),this._onDidBlur.fire()})),this._register(this._inputEditor.onDidBlurEditorWidget(()=>{ou.get(this._inputEditor)?.clearWidgets(),lh.get(this._inputEditor)?.clearWidgets()}));let S=this._register(Gg()),{location:y,isMaximized:w}=this.getWidgetLocationInfo(o),k={getOverflowAnchor:()=>this.inputActionsToolbar.getElement(),actionContext:{widget:o},hideChevrons:Ce(V=>this._stableInputPartWidth.read(V)<m7o),hoverPosition:{forcePosition:!0,hoverPosition:y==="sidebarRight"&&!w?0:1}};if(this._register(Vo(u,re.CLICK,V=>this.inputEditor.focus())),this._register(Vo(this.attachmentsContainer,re.CLICK,V=>this.inputEditor.focus())),this.inputActionsToolbar=this._register(this.instantiationService.createInstance(Ln,this.options.renderInputToolbarBelowInput?this.attachmentsContainer:u,D.ChatInput,{telemetrySource:this.options.menus.telemetrySource,menuOptions:{shouldForwardArgs:!0},hiddenItemStrategy:-1,hoverDelegate:S,responsiveBehavior:{enabled:!0,kind:"last",minItems:1,actionMinWidth:22},actionViewItemProvider:(V,U)=>{if(V.id===Ome.ID&&V instanceof Eo){this._currentLanguageModel||this.setCurrentLanguageModelToDefault();let G={currentModel:this._currentLanguageModel,setModel:$=>{this._waitForPersistedLanguageModel.clear(),this.setCurrentLanguageModel($),this.renderAttachedContext()},getModels:()=>this.getModels(),canManageModels:()=>{let $=this.getCurrentSessionType();return!$||$===qp}};return this.modelWidget=this.instantiationService.createInstance(rte,V,G,k)}else if(V.id===Fme.ID&&V instanceof Eo){let G={currentMode:this._currentModeObservable,sessionResource:()=>this._widget?.viewModel?.sessionResource,customAgentTarget:()=>{let $=this._widget?.viewModel?.model.sessionResource,te=$&&this.chatService.getChatSessionFromInternalUri($);return(te&&this.chatSessionsService.getCustomAgentTargetForSessionType(te.chatSessionType))??"undefined"}};return this.modeWidget=this.instantiationService.createInstance(DAe,V,G,k)}else if((V.id===Yee.ID||V.id===XPe.ID)&&V instanceof Eo){let G=()=>{let de=this._widget?.viewModel?.sessionResource;return de?Rf(de):void 0},$=this.options.sessionTypePickerDelegate??{getActiveSessionProvider:()=>G(),getPendingDelegationTarget:()=>this._pendingDelegationTarget,setPendingDelegationTarget:de=>{let se=G()===de;this._pendingDelegationTarget=se?void 0:de,this.updateWidgetLockStateFromSessionType(de),this.updateAgentSessionTypeContextKey(),this.refreshChatSessionPickers()}},te=!!this.options.sessionTypePickerDelegate?.setActiveSessionProvider,pe=V.id===Yee.ID||te?N3:Yme;return this.sessionTargetWidget=this.instantiationService.createInstance(pe,V,y==="editor"?"editor":"sidebar",$,k)}else{if(V.id===JPe.ID&&V instanceof Eo)return this.workspaceContextService.getWorkbenchState()===1&&this.options.workspacePickerDelegate?this.instantiationService.createInstance(Xme,V,this.options.workspacePickerDelegate,k):new nUt(V);if(V.id===ott.ID&&V instanceof Eo){let G=this.createChatSessionPickerWidgets(V);return G.length===0?new nUt(V):this.instantiationService.createInstance(Wki,V,G)}}}})),this.inputActionsToolbar.getElement().classList.add("chat-input-toolbar"),this.inputActionsToolbar.context={widget:o},this._register(this.inputActionsToolbar.onDidChangeMenuItems(()=>{let U=this.inputActionsToolbar.getElement().querySelector(".chat-sessionPicker-container");this.chatSessionPickerContainer=U,this.cachedWidth&&typeof this.cachedInputToolbarWidth=="number"&&this.cachedInputToolbarWidth!==this.inputActionsToolbar.getItemsWidth()&&this._toolbarRelayoutScheduler.schedule()})),this.executeToolbar=this._register(this.instantiationService.createInstance(Ln,u,this.options.menus.executeToolbar,{telemetrySource:this.options.menus.telemetrySource,menuOptions:{shouldForwardArgs:!0},hoverDelegate:S,hiddenItemStrategy:-1})),this.executeToolbar.getElement().classList.add("chat-execute-toolbar"),this.executeToolbar.context={widget:o},this._register(this.executeToolbar.onDidChangeMenuItems(()=>{this.cachedWidth&&typeof this.cachedExecuteToolbarWidth=="number"&&this.cachedExecuteToolbarWidth!==this.executeToolbar.getItemsWidth()&&this._toolbarRelayoutScheduler.schedule()})),this.options.menus.inputSideToolbar){let V=this._register(this.instantiationService.createInstance(Ln,s,this.options.menus.inputSideToolbar,{telemetrySource:this.options.menus.telemetrySource,menuOptions:{shouldForwardArgs:!0},hoverDelegate:S}));this.inputSideToolbarContainer=V.getElement(),V.getElement().classList.add("chat-side-toolbar"),V.context={widget:o}}this.secondaryToolbar=this._register(this.instantiationService.createInstance(Ln,this.secondaryToolbarContainer,D.ChatInputSecondary,{telemetrySource:this.options.menus.telemetrySource,menuOptions:{shouldForwardArgs:!0},hiddenItemStrategy:-1,hoverDelegate:S,actionViewItemProvider:(V,U)=>{if((V.id===Yee.ID||V.id===XPe.ID)&&V instanceof Eo){let G=()=>{let de=this._widget?.viewModel?.sessionResource;return de?Rf(de):void 0},$=this.options.sessionTypePickerDelegate??{getActiveSessionProvider:()=>G(),getPendingDelegationTarget:()=>this._pendingDelegationTarget,setPendingDelegationTarget:de=>{let se=G()===de;this._pendingDelegationTarget=se?void 0:de,this.updateWidgetLockStateFromSessionType(de),this.updateAgentSessionTypeContextKey(),this.refreshChatSessionPickers()}},te=!!this.options.sessionTypePickerDelegate?.setActiveSessionProvider,pe=V.id===Yee.ID||te?N3:Yme;return this.sessionTargetWidget=this.instantiationService.createInstance(pe,V,y==="editor"?"editor":"sidebar",$,k)}else if(V.id===JPe.ID&&V instanceof Eo){if(this.workspaceContextService.getWorkbenchState()===1&&this.options.workspacePickerDelegate)return this.instantiationService.createInstance(Xme,V,this.options.workspacePickerDelegate,k);{let G=new oc(void 0,V);return G.element&&(G.element.style.display="none"),G}}else if(V.id===itt.ID&&V instanceof Eo){let G={currentPermissionLevel:this._currentPermissionLevel,setPermissionLevel:$=>{this._currentPermissionLevel.set($,void 0),this.permissionLevelKey.set($)}};return this.permissionWidget=this.instantiationService.createInstance(LAe,V,G,k)}}})),this.secondaryToolbar.getElement().classList.add("chat-secondary-input-toolbar"),this.secondaryToolbar.context={widget:o};let T=this.modelService.getModel(this.inputUri);if(T||(T=this.modelService.createModel("",null,this.inputUri,!0)),this.textModelResolverService.createModelReference(this.inputUri).then(V=>{if(this._store.isDisposed){V.dispose();return}this._register(V)}),this.inputModel=T,this.inputModel.updateOptions({bracketColorizationOptions:{enabled:!1,independentColorPoolPerBracketType:!1}}),this._inputEditor.setModel(this.inputModel),t){this.inputModel.setValue(t);let V=this.inputModel.getLineCount();this._inputEditor.setPosition({lineNumber:V,column:this.inputModel.getLineMaxColumn(V)})}let N=()=>{let V=this._inputEditor.getModel();if(!V)return;let U=this._inputEditor.getPosition();if(!U)return;let G=U.lineNumber===1&&U.column===1;this.chatCursorAtTop.set(G),this.historyNavigationBackwardsEnablement.set(G),this.historyNavigationForewardsEnablement.set(U.equals(Fki(V))),this._syncInputStateToModel()};this._register(this._inputEditor.onDidChangeCursorPosition(V=>N())),N(),this._register(this.themeService.onDidFileIconThemeChange(()=>{this.renderAttachedContext()})),this.renderAttachedContext();let O=this._register(new eL(()=>{let V=this.container.offsetHeight;this.height.set(V,void 0)}));if(this._register(O.observe(this.container)),this.options.renderStyle==="compact"){let V=this._register(new eL(()=>{this.cachedWidth&&this.layout(this.cachedWidth)}));this._register(V.observe(u))}}toggleChatInputOverlay(e){this.chatInputOverlay.classList.toggle("disabled",e),e?this.overlayClickListener.value=Vo(this.chatInputOverlay,re.CLICK,t=>{t.preventDefault(),t.stopPropagation(),this._onDidClickOverlay.fire()}):this.overlayClickListener.clear()}renderAttachedContext(){let e=this.attachedContextContainer,t=new P;this.attachedContextDisposables.value=t,Rt(e),t.add(Vo(this.attachmentsContainer,re.KEY_DOWN,c=>{this.handleAttachmentNavigation(c)}));let o=[...this.attachmentModel.attachments.entries()],n=!!o.length,r=!1,l=this.configurationService.getValue("chat.implicitContext.suggestedContext")?this._implicitContext?.hasValue??!1:this._implicitContext?.values.some(c=>c.enabled||c.isSelection)??!1;if(this._implicitContext&&l){let c=(p,h,g)=>this._attachmentModel.attachments.some(f=>{let v=A.isUri(f.value)?f.value:nv(f.value)?f.value.uri:void 0,b=nv(f.value)?f.value.range:void 0;return g!==void 0&&MY(f)&&f.handle===g?!0:p&&v&&Xe(p,v)?h&&b?z.equalsRange(h,b):!h&&!b:!1}),u=this.instantiationService.createInstance(xAe,()=>this._widget,c,this._implicitContext,this._contextResourceLabels,this._attachmentModel,e);t.add(u),r=u.hasRenderedContexts}mm(!!(this.options.renderInputToolbarBelowInput||n||r),this.attachmentsContainer),mm(n||r,this.attachedContextContainer),o.length||(this._indexOfLastAttachedContextDeletedWithKeyboard=-1,this._indexOfLastOpenedContext=-1);for(let[c,u]of o){let p=A.isUri(u.value)?u.value:nv(u.value)?u.value.uri:void 0,h=nv(u.value)?u.value.range:void 0,g=c===Math.min(this._indexOfLastAttachedContextDeletedWithKeyboard,this.attachmentModel.size-1)&&this._indexOfLastAttachedContextDeletedWithKeyboard>-1,f,v={shouldFocusClearButton:g,supportsDeletion:!0},b=this._currentLanguageModel.get();u.kind==="tool"||u.kind==="toolset"?f=this.instantiationService.createInstance(Tee,u,b,v,e,this._contextResourceLabels):p&&bTt(u)?f=this.instantiationService.createInstance(_ee,p,u,b,v,e,this._contextResourceLabels):pP(u)?f=this.instantiationService.createInstance(kee,u,b,v,e,this._contextResourceLabels):PY(u)?f=this.instantiationService.createInstance(Eee,u,void 0,v,e,this._contextResourceLabels):p&&(u.kind==="file"||u.kind==="directory")?f=this.instantiationService.createInstance(Iee,p,h,u,void 0,b,v,e,this._contextResourceLabels):u.kind==="terminalCommand"?f=this.instantiationService.createInstance(yee,u,b,v,e,this._contextResourceLabels):pV(u)?f=this.instantiationService.createInstance(wee,p,u,b,v,e,this._contextResourceLabels):STt(u)?f=this.instantiationService.createInstance(Dee,u,b,v,e,this._contextResourceLabels):fTt(u)?f=this.instantiationService.createInstance(Cee,u,b,v,e,this._contextResourceLabels):ITt(u)?f=this.instantiationService.createInstance(Lee,u,b,v,e,this._contextResourceLabels):yTt(u)?f=this.instantiationService.createInstance(Ree,u,b,v,e,this._contextResourceLabels):wTt(u)?f=this.instantiationService.createInstance(Mee,u,b,v,e,this._contextResourceLabels):f=this._chatAttachmentWidgetRegistry.createWidget(u,v,e)??this.instantiationService.createInstance(xee,p,h,u,void 0,b,v,e,this._contextResourceLabels),g&&f.element.focus(),c===Math.min(this._indexOfLastOpenedContext,this.attachmentModel.size-1)&&f.element.focus(),t.add(f),t.add(f.onDidDelete(S=>{this.handleAttachmentDeletion(S,c,u)})),t.add(f.onDidOpen(S=>{this.handleAttachmentOpen(c,u)}))}this._indexOfLastOpenedContext=-1}handleAttachmentDeletion(e,t,o){if(ag(e)&&(this._indexOfLastAttachedContextDeletedWithKeyboard=t),this._attachmentModel.delete(o.id),this.configurationService.getValue("chat.implicitContext.enableImplicitContext"))for(let n of this._implicitContext?.values||[]){let r=A.isUri(n?.value)&&A.isUri(o.value)&&Xe(n.value,o.value);n?.isFile&&r&&(n.enabled=!1)}this._attachmentModel.size===0&&this.focus(),this._onDidChangeContext.fire({removed:[o]}),this.renderAttachedContext()}handleAttachmentOpen(e,t){this._indexOfLastOpenedContext=e,this._indexOfLastAttachedContextDeletedWithKeyboard=-1,this._attachmentModel.size===0&&this.focus()}handleAttachmentNavigation(e){if(!e.equals(15)&&!e.equals(17))return;let t=Array.from(this.attachedContextContainer.querySelectorAll(".chat-attached-context-attachment"));if(!t.length)return;let o=Me(this.attachmentsContainer).document.activeElement,n=t.findIndex(s=>s===o),r=n;e.equals(15)?r=n>0?n-1:t.length-1:e.equals(17)&&(r=n<t.length-1?n+1:0),r!==-1&&(t[r].focus(),e.preventDefault(),e.stopPropagation())}async renderChatTodoListWidget(e){if(this.configurationService.getValue("chat.tools.todos.showWidget")!==!1){if(!this._chatInputTodoListWidget.value){let o=this._chatEditingTodosDisposables.add(this.instantiationService.createInstance(kAe));this._chatInputTodoListWidget.value=o,Rt(this.chatInputTodoListWidgetContainer),R(this.chatInputTodoListWidgetContainer,o.domNode)}this._chatInputTodoListWidget.value.render(e)}}clearTodoListWidget(e,t){this._chatInputTodoListWidget.value?.clear(e,t)}renderQuestionCarousel(e,t,o){let n=e.resolveId??`${Vi(t.element)?t.element.requestId:""}_${t.contentIndex}`,r=this._chatQuestionCarouselWidgets.get(n);if(r)return r;Vi(t.element)&&(this._questionCarouselResponseIds.set(n,t.element.requestId),this._questionCarouselSessionResources.set(n,t.element.sessionResource));let s=this.instantiationService.createInstance(k3,e,t,o);return this._chatQuestionCarouselWidgets.set(n,s),this._hasQuestionCarouselContextKey?.set(!0),R(this.chatQuestionCarouselContainer,s.domNode),s}clearQuestionCarousel(e,t){if(t!==void 0){let o=this._chatQuestionCarouselWidgets.get(t);o&&(o.domNode.remove(),this._chatQuestionCarouselWidgets.deleteAndDispose(t)),this._questionCarouselResponseIds.delete(t),this._questionCarouselSessionResources.delete(t)}else if(e!==void 0){for(let[o,n]of this._questionCarouselResponseIds)if(n===e){let r=this._chatQuestionCarouselWidgets.get(o);r&&(r.domNode.remove(),this._chatQuestionCarouselWidgets.deleteAndDispose(o)),this._questionCarouselResponseIds.delete(o),this._questionCarouselSessionResources.delete(o)}}else this._chatQuestionCarouselWidgets.clearAndDisposeAll(),this._questionCarouselResponseIds.clear(),this._questionCarouselSessionResources.clear(),Rt(this.chatQuestionCarouselContainer);this._hasQuestionCarouselContextKey?.set(this._chatQuestionCarouselWidgets.size>0)}get questionCarousel(){for(let e of this._chatQuestionCarouselWidgets.values())if(e.hasFocus())return e;return this._chatQuestionCarouselWidgets.size>0?this._chatQuestionCarouselWidgets.values().next().value:void 0}focusQuestionCarousel(){let e=this.questionCarousel;return e?(e.focus(),!0):!1}isQuestionCarouselFocused(){for(let e of this._chatQuestionCarouselWidgets.values())if(e.hasFocus())return!0;return!1}navigateToPreviousQuestion(){return this.questionCarousel?.navigateToPreviousQuestion()??!1}navigateToNextQuestion(){return this.questionCarousel?.navigateToNextQuestion()??!1}setWorkingSetCollapsed(e){this._workingSetCollapsed.set(e,void 0)}renderChatEditingSessionState(e){mm(!!e,this.chatEditingSessionWidgetContainer),e&&(Xe(e.chatSessionResource,this._lastEditingSessionResource)||this._workingSetCollapsed.set(!0,void 0),this._lastEditingSessionResource=e.chatSessionResource);let t=hs({equalsFn:$i},l=>{let c=e?.chatSessionResource??this._widget?.viewModel?.model.sessionResource;return c&&fg(c)==="copilotcli"?[]:e?.entries.read(l).filter(u=>u.state.read(l)===0)||[]}),o=Ce(l=>{let c=new Mn,u=[];for(let p of t.read(l))if(p.state.read(l)===0&&!c.has(p.modifiedURI)){c.add(p.modifiedURI);let h=p.linesAdded?.read(l),g=p.linesRemoved?.read(l);u.push({reference:p.modifiedURI,state:0,kind:"reference",options:{status:void 0,diffMeta:{added:h??0,removed:g??0},isDeletion:!!p.isDeletion,originalUri:p.isDeletion?p.originalURI:void 0}})}return u.sort((p,h)=>p.kind==="reference"&&h.kind==="reference"?p.state===h.state||p.state===void 0||h.state===void 0?p.reference.toString().localeCompare(h.reference.toString()):p.state-h.state:0),u}),n=ui(this,this.agentSessionsService.model.onDidChangeSessions,()=>{let l=this._widget?.viewModel?.model?.sessionResource;if(!l)return ht.empty();let c=this.agentSessionsService.getSession(l);return c?.changes instanceof Array?c.changes:ht.empty()}),r=Ce(l=>n.read(l).map(c=>({reference:ike(c)?c.modifiedUri??c.uri:c.modifiedUri,state:1,kind:"reference",options:{diffMeta:{added:c.insertions,removed:c.deletions},isDeletion:c.modifiedUri===void 0,originalUri:c.originalUri,status:void 0}}))),s=Ce(l=>o.read(l).length>0||r.read(l).length>0);this._renderingChatEdits.value=he(l=>{this.options.renderWorkingSet&&s.read(l)?this.renderChatEditingSessionWithEntries(l.store,e,o,r):(Rt(this.chatEditingSessionWidgetContainer),this._chatEditsDisposables.clear(),this._chatEditList=void 0)})}renderChatEditingSessionWithEntries(e,t,o,n){let r=this.chatEditingSessionWidgetContainer.querySelector(".chat-editing-session-container.show-file-icons")??R(this.chatEditingSessionWidgetContainer,OAe(".chat-editing-session-container.show-file-icons")),s=r.querySelector(".chat-editing-session-overview")??R(r,OAe(".chat-editing-session-overview")),l=s.querySelector(".working-set-title")??R(s,OAe(".working-set-title"));this._chatEditsActionsDisposables.clear();let c=s.querySelector(".chat-editing-session-actions")??R(s,OAe(".chat-editing-session-actions")),u=t?.chatSessionResource||this._widget?.viewModel?.model.sessionResource,p=this._chatEditsActionsDisposables.add(this.contextKeyService.createScoped(c));u&&p.createKey(ie.agentSessionType.key,fg(u)),this._chatEditsActionsDisposables.add(tc(ie.hasAgentSessionChanges,p,w=>!!n.read(w)?.length));let h=this._chatEditsActionsDisposables.add(this.instantiationService.createChild(new Io([X,p]))),g=r.querySelector(".chat-editing-session-list")??R(r,OAe(".chat-editing-session-list")),f=this._chatEditsActionsDisposables.add(new oO(l,{supportIcons:!0,secondary:!0,ariaLabel:d(7388,null)})),v=Ce(w=>{let k=o.read(w),T=n.read(w),N=0,O=0;if(k.length>0)for(let $ of k)$.kind==="reference"&&$.options?.diffMeta&&(N+=$.options.diffMeta.added,O+=$.options.diffMeta.removed);else for(let $ of T)$.kind==="reference"&&$.options?.diffMeta&&(N+=$.options.diffMeta.added,O+=$.options.diffMeta.removed);let V=k.length>0?k.length:T.length,U=k.length===0&&T.length>0,G=k.length>0||T.length>0;return{files:V,added:N,removed:O,shouldShowEditingSession:G,topLevelIsSessionMenu:U}}),b=v.map(w=>w.topLevelIsSessionMenu);e.add(he(w=>{let k=b.read(w);w.store.add(h.createInstance(QF,c,k?D.ChatEditingSessionChangesToolbar:D.ChatEditingWidgetToolbar,{telemetrySource:this.options.menus.telemetrySource,small:!0,menuOptions:u?k?{args:[u,this.agentSessionsService.getSession(u)?.metadata]}:{arg:{$mid:19,sessionResource:u}}:void 0,disableWhileRunning:k,buttonConfigProvider:T=>{if(T.id===Pme.ID||T.id===Ame.Id||T.id===ett.ID)return{showIcon:!0,showLabel:!1,isSecondary:!0}}}))})),e.add(he(w=>{let{files:k,added:T,removed:N,shouldShowEditingSession:O}=v.read(w),V=k===1?d(7387,null):d(7386,null,k);f.label=V,f.element.setAttribute("aria-label",d(7385,null,V,T,N)),this._workingSetLinesAddedSpan.value.textContent=`+${T}`,this._workingSetLinesRemovedSpan.value.textContent=`-${N}`,mm(O,this.chatEditingSessionWidgetContainer)}));let S=_(".working-set-line-counts");f.element.appendChild(S),S.appendChild(this._workingSetLinesAddedSpan.value),S.appendChild(this._workingSetLinesRemovedSpan.value);let y=()=>{this._workingSetCollapsed.set(!this._workingSetCollapsed.get(),void 0)};if(this._chatEditsActionsDisposables.add(f.onDidClick(y)),this._chatEditsActionsDisposables.add(j(s,"click",w=>{w.defaultPrevented||w.target.closest(".monaco-button")||y()})),this._chatEditsActionsDisposables.add(he(w=>{let k=this._workingSetCollapsed.read(w);f.icon=k?M.chevronRight:M.chevronDown,g.classList.toggle("collapsed",k)})),!this._chatEditList){this._chatEditList=this._chatEditsListPool.get();let w=this._chatEditList.object;this._chatEditsDisposables.add(this._chatEditList),this._chatEditsDisposables.add(w.onDidFocus(()=>{this._onDidFocus.fire()})),this._chatEditsDisposables.add(w.onDidOpen(async k=>{if(k.element?.kind==="reference"&&A.isUri(k.element.reference)){let T=k.element.reference,N=k.element.options?.originalUri;if(k.element.options?.isDeletion&&N){await this.editorService.openEditor({resource:N,options:k.editorOptions},k.sideBySide?vn:Un);return}if(N){await this.editorService.openEditor({original:{resource:N},modified:{resource:T},options:k.editorOptions},k.sideBySide?vn:Un);return}let O=t?.getEntry(T),V=await this.editorService.openEditor({resource:T,options:k.editorOptions},k.sideBySide?vn:Un);V&&O?.getEditorIntegration(V).reveal(!0,k.editorOptions.preserveFocus)}})),this._chatEditsDisposables.add(j(w.getHTMLElement(),"click",k=>{this.hasFocus()||this._onDidFocus.fire()},!0)),R(g,w.getHTMLElement()),R(r,g)}e.add(he(w=>{let k=o.read(w),T=n.read(w),N=k.concat(T),U=Math.min(N.length,6)*22,G=this._chatEditList.object;G.layout(U),G.getHTMLElement().style.height=`${U}px`,G.splice(0,G.length,N)}))}async renderFollowups(e,t){this.options.renderFollowups&&(this.followupsDisposables.clear(),Rt(this.followupsContainer),e&&e.length>0&&this.followupsDisposables.add(this.instantiationService.createInstance(TAe,this.followupsContainer,e,this.location,void 0,o=>this._onDidAcceptFollowup.fire({followup:o,response:t}))))}layout(e){return this.cachedWidth=e,this._stableInputPartWidth.set(e,void 0),this._layout(e)}_layout(e,t=!0){let o=this.getLayoutData(),n=e-o.inputPartHorizontalPadding;this.followupsContainer.style.width=`${n}px`;let r=this._inputEditor.getScrollWidth(),s=e-o.inputPartHorizontalPadding-o.editorBorder-o.inputPartHorizontalPaddingInside-o.toolbarsWidth-o.sideToolbarWidth,l=this.inputEditorMinHeight?Math.max(this.inputEditorMinHeight,Math.min(this._inputEditor.getContentHeight(),this.inputEditorMaxHeight)):Math.min(this._inputEditor.getContentHeight(),this.inputEditorMaxHeight),c={width:s,height:l};if((!this.previousInputEditorDimension||this.previousInputEditorDimension.width!==c.width||this.previousInputEditorDimension.height!==c.height)&&(this._inputEditor.layout(c),this.previousInputEditorDimension=c),t&&r<10)return this._layout(e,!1)}getLayoutData(){let e=this.inputSideToolbarContainer?yl(this.inputSideToolbarContainer):0,t=()=>{let n=this.cachedExecuteToolbarWidth=this.executeToolbar.getItemsWidth(),r=this.cachedInputToolbarWidth=this.inputActionsToolbar.getItemsWidth(),s=(this.executeToolbar.getItemsLength()-1)*4,l=this.inputActionsToolbar.getItemsLength()?(this.inputActionsToolbar.getItemsLength()-1)*4:0,c=yl(this.contextUsageWidgetContainer);return n+s+c+(this.options.renderInputToolbarBelowInput?0:r+l+12)};return{editorBorder:2,inputPartHorizontalPadding:this.options.renderStyle==="compact"?16:24,inputPartHorizontalPaddingInside:this.options.renderStyle==="compact"?12:10,toolbarsWidth:this.options.renderStyle==="compact"?t():0,sideToolbarWidth:e>0?e+4:0}}getWidgetLocationInfo(e){if(_ce(e.viewContext))return{location:"editor",isMaximized:!1};if(XI(e.viewContext)){let t=this.viewDescriptorService.getViewLocationById(e.viewContext.viewId),o=this.layoutService.getSideBarPosition();switch(t){case 1:return{location:"panel",isMaximized:this.layoutService.isPanelMaximized()};case 2:return{location:o===0?"sidebarRight":"sidebarLeft",isMaximized:this.layoutService.isAuxiliaryBarMaximized()};case 0:default:return{location:o===0?"sidebarLeft":"sidebarRight",isMaximized:!1}}}return{location:"editor",isMaximized:!1}}};F3=I([m(4,Ct),m(5,F),m(6,X),m(7,B),m(8,_e),m(9,Bi),m(10,Wr),m(11,ne),m(12,be),m(13,ee),m(14,De),m(15,Nt),m(16,le),m(17,br),m(18,t2),m(19,kC),m(20,vr),m(21,Pv),m(22,jn),m(23,Si),m(24,Ls),m(25,Q_),m(26,ia),m(27,Pe),m(28,fi),m(29,Ri),m(30,Aee)],F3);function Fki(a){return{lineNumber:a.getLineCount(),column:a.getLineLength(a.getLineCount())+1}}var Emo=".interactive-input-editor";kLe(Emo);var Wki=class extends Lr{constructor(e,t,o){super(null,e,o??{});this.widgets=t}render(e){e.classList.add("chat-sessionPicker-container");for(let t of this.widgets){let o=_(".action-item.chat-sessionPicker-item");t.render(o),e.appendChild(o)}}dispose(){for(let e of this.widgets)e.dispose();super.dispose()}},nUt=class extends oc{constructor(i){super(void 0,i)}render(i){super.render(i),i.style.display="none"}};var Vki=(a,i)=>{let e=a.get(_e),t=a.get(X),o=e.lookupKeybinding(D3,t)?.getAriaLabel(),n=e.lookupKeybinding(ntt,t)?.getAriaLabel(),r=i.map(l=>{let c=l.state.get();if(c.type===lo.StateKind.WaitingForPostApproval){let g=mV(c.resultDetails)?c.resultDetails.input:zj(c.resultDetails)?void 0:DTt(c.contentForModel);return{title:d(5284,null),detail:g}}if(!(c.type===lo.StateKind.WaitingForConfirmation&&c.confirmationMessages?.message))return;let u="";if(l.toolSpecificData)if(l.toolSpecificData.kind==="terminal"){let g=fR(l.toolSpecificData);u=g.commandLine.toolEdited??g.commandLine.original}else l.toolSpecificData.kind==="extensions"?u=JSON.stringify(l.toolSpecificData.extensions):l.toolSpecificData.kind==="input"&&(u=JSON.stringify(l.toolSpecificData.rawInput));let p=c.confirmationMessages?.title;return{title:((typeof p=="string"?p:p?.value||"")+(u?": "+u:"")).trim(),detail:void 0}}).filter(mo),s=o&&n?d(5283,null,r.map(l=>l.title).join(", "),o,n):d(5281,null,r.map(l=>l.title).join(", "));return r.some(l=>l.detail)&&(s+=" "+d(5282,null,r.map(l=>l.detail?l.detail:"").join(" "))),s},FAe=class{constructor(i,e){this._accessibleViewService=i;this._instantiationService=e}getWidgetRole(){return"list"}getRole(i){return"listitem"}getWidgetAriaLabel(){return d(5270,null)}getAriaLabel(i){return Rr(i)?i.messageText:Vi(i)?this._getLabelWithInfo(i):""}_getLabelWithInfo(i){let e=this._accessibleViewService.getOpenAriaHint("accessibility.verbosity.panelChat"),t="",o=i.response.value.filter(g=>g.kind==="toolInvocation"),n="";o.length&&o.filter(f=>{let v=f.state.get().type;return v===lo.StateKind.WaitingForConfirmation||v===lo.StateKind.WaitingForPostApproval}).length&&(n=this._instantiationService.invokeFunction(Vki,o));let r=Yc.lexer(i.response.toString()).filter(g=>g.type==="table")?.length??0,s="";switch(r){case 0:break;case 1:s=d(5280,null);break;default:s=d(5274,null,r);break}let l=i.response.value.filter(g=>g.kind==="treeData").length??0,c="";switch(l){case 0:break;case 1:c=d(5279,null);break;default:c=d(5273,null,l);break}let u=i.response.value.filter(g=>g.kind==="elicitation2"||g.kind==="elicitationSerialized"),p="";for(let g of u){let f=typeof g.title=="string"?g.title:g.title.value,v=typeof g.message=="string"?g.message:g.message.value;p+=f+" "+v}let h=Yc.lexer(i.response.toString()).filter(g=>g.type==="code")?.length??0;switch(h){case 0:t=e?d(5276,null,n,c,p,s,i.response.toString(),e):d(5275,null,c,p,s,i.response.toString());break;case 1:t=e?d(5278,null,n,c,p,s,i.response.toString(),e):d(5277,null,c,p,s,i.response.toString());break;default:t=e?d(5272,null,n,c,p,s,h,i.response.toString(),e):d(5271,null,c,p,h,s,i.response.toString());break}return t}};FAe=I([m(0,Wd),m(1,F)],FAe);var AB=class extends C{constructor(e,t,o,n,r,s,l){super();this.foreground=t;this.inputEditorBackgroundColor=o;this.resultEditorBackgroundColor=n;this.configurationService=r;this.themeService=s;this.viewDescriptorService=l;this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._register(this.themeService.onDidColorThemeChange(c=>this.update())),this._register(this.viewDescriptorService.onDidChangeLocation(c=>{c.views.some(u=>u.id===e)&&this.update()})),this._register(this.configurationService.onDidChangeConfiguration(c=>{AB.relevantSettingIds.some(u=>c.affectsConfiguration(u))&&this.update()})),this.update()}static{this.lineHeightEm=1.4}get configuration(){return this._config}static{this.relevantSettingIds=["chat.editor.lineHeight","chat.editor.fontSize","chat.editor.fontFamily","chat.editor.fontWeight","chat.editor.wordWrap","editor.cursorBlinking","editor.fontLigatures","editor.accessibilitySupport","editor.bracketPairColorization.enabled","editor.bracketPairColorization.independentColorPoolPerBracketType"]}update(){let e=this.configurationService.getValue("editor"),t=this.configurationService.getValue("chat")?.editor,o=this.configurationService.getValue("editor.accessibilitySupport");this._config={foreground:this.themeService.getColorTheme().getColor(this.foreground),inputEditor:{backgroundColor:this.themeService.getColorTheme().getColor(this.inputEditorBackgroundColor),accessibilitySupport:o},resultEditor:{backgroundColor:this.themeService.getColorTheme().getColor(this.resultEditorBackgroundColor),fontSize:t.fontSize,fontFamily:t.fontFamily==="default"?e.fontFamily:t.fontFamily,fontWeight:t.fontWeight,lineHeight:t.lineHeight?t.lineHeight:AB.lineHeightEm*t.fontSize,bracketPairColorization:{enabled:this.configurationService.getValue("editor.bracketPairColorization.enabled"),independentColorPoolPerBracketType:this.configurationService.getValue("editor.bracketPairColorization.independentColorPoolPerBracketType")},wordWrap:t.wordWrap,fontLigatures:e.fontLigatures}},this._onDidChange.fire()}};AB=I([m(4,B),m(5,De),m(6,Ri)],AB);var Tmo="data-pending-request-id",g7o="data-pending-kind",_mo="chat-pending-dragging",WAe=class extends C{constructor(e,t,o){super();this._getViewModel=t;this._chatService=o;this._insertIndicator=_(".chat-pending-insert-indicator"),e.append(this._insertIndicator),this._register(Z(()=>this._insertIndicator.remove())),this._register(new Om(e,{onDragOver:n=>this._onDragOver(n),onDragLeave:()=>this._hideIndicator(),onDragEnd:()=>this._onDragEnd(),onDrop:n=>this._onDrop(n)}))}attachDragHandle(e,t,o,n){t.setAttribute("draggable","true"),n.add(j(t,re.DRAG_START,r=>{!r.dataTransfer||!e.pendingKind||(this._dragState={element:e,pendingKind:e.pendingKind},o.classList.add(_mo),r.dataTransfer.setDragImage(o,0,0),r.dataTransfer.effectAllowed="move")})),n.add(j(t,re.DRAG_END,()=>{o.classList.remove(_mo),this._onDragEnd()}))}_onDragOver(e){if(!this._dragState)return;let t=this._findDropTarget(e);if(!t){this._hideIndicator();return}e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="move");let o=t.row.getBoundingClientRect(),n=o.top+o.height/2,r=e.clientY<n;this._showIndicator(t.row,r)}_onDrop(e){if(this._hideIndicator(),!this._dragState)return;let t=this._findDropTarget(e);if(!t)return;e.preventDefault();let o=t.row.getBoundingClientRect(),n=o.top+o.height/2,r=e.clientY<n;this._reorder(this._dragState.element,t.requestId,r),this._dragState=void 0}_onDragEnd(){this._hideIndicator(),this._dragState=void 0}_showIndicator(e,t){let o=e.getBoundingClientRect(),n=this._insertIndicator.parentElement.getBoundingClientRect();this._insertIndicator.style.display="block",this._insertIndicator.style.left=`${o.left-n.left}px`,this._insertIndicator.style.width=`${o.width}px`,this._insertIndicator.style.top=t?`${o.top-n.top}px`:`${o.bottom-n.top}px`}_hideIndicator(){this._insertIndicator.style.display="none"}_findDropTarget(e){if(!this._dragState)return;let t=e.target?.closest?.(`[${Tmo}]`);if(!t)return;let o=t.getAttribute(Tmo);if(!(t.getAttribute(g7o)!==this._dragState.pendingKind||o===this._dragState.element.id))return{row:t,requestId:o}}_reorder(e,t,o){let n=this._getViewModel();if(!n)return;let r=n.model.getPendingRequests(),s=e.pendingKind,l=[],c=[];for(let f of r)(f.kind===s?l:c).push(f);let u=l.findIndex(f=>f.request.id===e.id);if(u===-1)return;let[p]=l.splice(u,1),h=l.findIndex(f=>f.request.id===t);if(h===-1)return;o||h++,l.splice(h,0,p);let g=(s==="steering"?[...l,...c]:[...c,...l]).map(f=>({requestId:f.request.id,kind:f.kind}));this._chatService.setPendingRequests(n.sessionResource,g)}};WAe=I([m(2,Si)],WAe);var ste=class extends C{constructor(e,t,o,n,r,s,l,c,u){super();this.instantiationService=o;this.contextKeyService=n;this.chatService=r;this.contextMenuService=s;this.logService=l;this.configurationService=c;this.chatAccessibilityService=u;this._onDidScroll=this._register(new E);this.onDidScroll=this._onDidScroll.event;this._onDidChangeContentHeight=this._register(new E);this.onDidChangeContentHeight=this._onDidChangeContentHeight.event;this._onDidClickFollowup=this._register(new E);this.onDidClickFollowup=this._onDidClickFollowup.event;this._onDidFocus=this._register(new E);this.onDidFocus=this._onDidFocus.event;this._onDidChangeItemHeight=this._register(new E);this.onDidChangeItemHeight=this._onDidChangeItemHeight.event;this._visible=!0;this._mostRecentlyFocusedItemIndex=-1;this._scrollLock=!0;this._suppressAutoScroll=!1;this._settingChangeCounter=0;this._visibleChangeCount=0;this._bodyDimension=null;this._previousLastItemMinHeight=null;this._viewModel=t.viewModel,this._codeBlockModelCollection=t.codeBlockModelCollection??this._register(this.instantiationService.createInstance(YF,"chatListWidget")),this._location=t.location,this._getCurrentLanguageModelId=t.getCurrentLanguageModelId,this._getCurrentModeInfo=t.getCurrentModeInfo,this._lastItemIdContextKey=ie.lastItemId.bindTo(this.contextKeyService),this._container=e;let p=this._register(this.instantiationService.createChild(new Io([X,this.contextKeyService])));this._renderStyle=t.renderStyle;let h=t.overflowWidgetsDomNode??document.createElement("div");t.overflowWidgetsDomNode||(h.classList.add("chat-overflow-widget-container","monaco-editor"),this._container.append(h),this._register(Z(()=>h.remove())));let g=t.editorOptions??this._register(p.createInstance(AB,t.viewId,"foreground",t.inputEditorBackground??"chat.requestEditor.background",t.resultEditorBackground??"chat.responseEditor.background")),f=p.createInstance(YHt,t.defaultElementHeight??200),v={getListLength:()=>this._tree.getNode(null).visibleChildrenCount,onDidScroll:this.onDidScroll,container:this._container,currentChatMode:t.currentChatMode??(()=>"ask")};this._renderer=this._register(p.createInstance(A3,g,t.rendererOptions??{},v,this._codeBlockModelCollection,h,this._viewModel)),this._register(this._renderer.onDidClickFollowup(S=>{this._onDidClickFollowup.fire(S)})),this._register(this._renderer.onDidChangeItemHeight(S=>{this._updateElementHeight(S.element,S.height);let y=this._viewModel?.getItems().at(-2);S.element.id===y?.id&&this.updateLastItemMinHeight(),this._onDidChangeItemHeight.fire(S)})),this._register(this._renderer.onDidClickRerunWithAgentOrCommandDetection(S=>{let y=this.chatService.getSession(S.sessionResource)?.getRequests().find(w=>w.id===S.requestId);if(y){let w={noCommandDetection:!0,attempt:y.attempt+1,location:this._location,userSelectedModelId:this._getCurrentLanguageModelId?.(),modeInfo:this._getCurrentModeInfo?.()};this.chatAccessibilityService.acceptRequest(S.sessionResource),this.chatService.resendRequest(y,w).catch(k=>this.logService.error("FAILED to rerun request",k))}})),this._renderer.pendingDragController=this._register(p.createInstance(WAe,this._container,()=>this._viewModel));let b=t.styles??{};this._tree=this._register(p.createInstance(mg,"ChatList",this._container,f,[this._renderer],{identityProvider:{getId:S=>S.id},horizontalScrolling:!1,alwaysConsumeMouseWheel:!1,supportDynamicHeights:!0,hideTwistiesOfChildlessElements:!0,accessibilityProvider:this.instantiationService.createInstance(FAe),keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:S=>Rr(S)?S.message:Vi(S)?S.response.value:""},setRowLineHeight:!1,scrollToActiveElement:!0,filter:t.filter,overrideStyles:{listFocusBackground:b.listBackground,listInactiveFocusBackground:b.listBackground,listActiveSelectionBackground:b.listBackground,listFocusAndSelectionBackground:b.listBackground,listInactiveSelectionBackground:b.listBackground,listHoverBackground:b.listBackground,listBackground:b.listBackground,listFocusForeground:b.listForeground,listHoverForeground:b.listForeground,listInactiveFocusForeground:b.listForeground,listInactiveSelectionForeground:b.listForeground,listActiveSelectionForeground:b.listForeground,listFocusAndSelectionForeground:b.listForeground,listActiveSelectionIconForeground:void 0,listInactiveSelectionIconForeground:void 0}})),this._scrollDownButton=this._register(new Mi(this._container,{buttonBackground:wt(H$),buttonForeground:wt(Fse),buttonHoverBackground:wt(Wse),buttonSecondaryBackground:void 0,buttonSecondaryForeground:void 0,buttonSecondaryHoverBackground:void 0,buttonSeparator:void 0,supportIcons:!0})),this._scrollDownButton.element.classList.add("chat-scroll-down"),this._scrollDownButton.label=`$(${M.chevronDown.id})`,this._scrollDownButton.element.style.display="none",this._register(this._scrollDownButton.onDidClick(()=>{this.setScrollLock(!0),this.scrollToEnd()})),this._register(this._tree.onDidChangeContentHeight(()=>{this._onDidChangeContentHeight.fire()})),this._register(this._tree.onDidFocus(()=>{this._onDidFocus.fire()})),this._register(this._tree.onDidChangeFocus(()=>{let S=this.getFocus();if(S&&S.length>0){let y=S[0],k=this.getItems().findIndex(T=>T===y);k!==-1&&(this._mostRecentlyFocusedItemIndex=k)}})),this._register(this._tree.onDidScroll(S=>{this._onDidScroll.fire(S),this.updateScrollDownButtonVisibility()})),this._register(this._tree.onContextMenu(S=>{this.handleContextMenu(S)})),this._register(this.configurationService.onDidChangeConfiguration(S=>{(S.affectsConfiguration("chat.editRequests")||S.affectsConfiguration("chat.checkpoints.enabled"))&&(this._settingChangeCounter++,this.refresh())}))}get onDidClickRequest(){return this._renderer.onDidClickRequest}get onDidRerender(){return this._renderer.onDidRerender}get onDidDispose(){return this._renderer.onDidDispose}get onDidFocusOutside(){return this._renderer.onDidFocusOutside}get domNode(){return this._container}get scrollTop(){return this._tree.scrollTop}set scrollTop(e){this._tree.scrollTop=e}get scrollHeight(){return this._tree.scrollHeight}get renderHeight(){return this._tree.renderHeight}get contentHeight(){return this._tree.contentHeight}get isScrolledToBottom(){return this._tree.scrollTop+this._tree.renderHeight>=this._tree.scrollHeight-2}get lastItem(){return this._lastItem}updateScrollDownButtonVisibility(){let e=!this.isScrolledToBottom&&!this._scrollLock;this._scrollDownButton.element.style.display=e?"":"none"}handleContextMenu(e){e.browserEvent.preventDefault(),e.browserEvent.stopPropagation();let t=e.element,n=e.browserEvent.target.closest(`.${LMe}`)!==null,r=this.contextKeyService.createOverlay([[ie.responseIsFiltered.key,Vi(t)&&!!t.errorDetails?.responseIsFiltered],[ie.isKatexMathElement.key,n]]);this.contextMenuService.showContextMenu({menuId:D.ChatContext,menuActionOptions:{shouldForwardArgs:!0},contextKeyService:r,getAnchor:()=>e.anchor,getActionsContext:()=>t})}setViewModel(e){this._viewModel=e,this._renderer.updateViewModel(e)}refresh(){if(!this._viewModel){this._tree.setChildren(null,[]),this._lastItem=void 0,this._lastItemIdContextKey.set([]);return}let e=this._viewModel.getItems();this._lastItem=e.at(-1),this._lastItemIdContextKey.set(this._lastItem?[this._lastItem.id]:[]);let t=e.map(n=>({element:n,collapsed:!1,collapsible:!1})),o=this._viewModel.editing;this._withPersistedAutoScroll(()=>{this._tree.setChildren(null,t,{diffIdentityProvider:{getId:n=>{let r=Rr(n)||Vi(n)?n.dataId:n.id,s=Rr(n)||Vi(n)?n.shouldBeRemovedOnSend:void 0,l=Rr(n)&&o?.id===n.id,c=Rr(n)||Vi(n)?n.shouldBeBlocked.get():!1;return r+`${Vi(n)&&n.renderData?`_${this._visibleChangeCount}`:""}`+(Vi(n)?`_${n.contentReferences.length}`:"")+`_${s?`${s.afterUndoStop||"1"}`:"0"}_${l?"edit":""}_${c?"blocked":""}`+(Rr(n)?`_${o?"1":"0"}`:"")+`_setting${this._settingChangeCounter}`+(Rr(n)&&n.contentReferences?`_${n.contentReferences?.length}`:"")}}})})}setScrollLock(e){this._scrollLock=e,this.updateScrollDownButtonVisibility()}get scrollLock(){return this._scrollLock}setVisibleChangeCount(e){this._visibleChangeCount=e}scrollToCurrentItem(e){if(!this._viewModel?.editing||!e||!this._tree.hasElement(e))return;let t=this._tree.getRelativeTop(e);(t===null||t<0||t>1)&&this._tree.reveal(e,0)}rerender(){this._tree.rerender()}getItems(){let e=[],t=this._tree.getNode(null);for(let o of t.children)o.element&&e.push(o.element);return e}delegateScrollFromMouseWheelEvent(e){this._tree.delegateScrollFromMouseWheelEvent(e)}hasElement(e){return this._tree.hasElement(e)}_updateElementHeight(e,t){this._tree.hasElement(e)&&this._visible&&this._withPersistedAutoScroll(()=>{this._tree.updateElementHeight(e,t)})}reveal(e,t){this._tree.reveal(e,t)}getFocus(){return this._tree.getFocus().filter(e=>e!==null)}setFocus(e){this._tree.setFocus(e)}focusItem(e){this.hasElement(e)&&(this._tree.setFocus([e]),this._tree.domFocus())}focusLastItem(e){let t=this.getItems();if(t.length===0)return-1;let o;return e&&this._mostRecentlyFocusedItemIndex>=0&&this._mostRecentlyFocusedItemIndex<t.length?o=this._mostRecentlyFocusedItemIndex:o=t.length-1,this._tree.setFocus([t[o]]),this._tree.domFocus(),o}scrollToEnd(){if(this._lastItem){let e=Math.max(this._lastItem.currentRenderedHeight??0,1e6);this._tree.hasElement(this._lastItem)&&this._tree.reveal(this._lastItem,e)}}set suppressAutoScroll(e){this._suppressAutoScroll=e}_withPersistedAutoScroll(e){if(this._suppressAutoScroll){e();return}let t=this.isScrolledToBottom;e(),t&&this.scrollToEnd()}focus(){this._tree.domFocus()}isDOMFocused(){return this._tree.isDOMFocused()}getCodeBlockInfosForResponse(e){return this._renderer.getCodeBlockInfosForResponse(e)}getCodeBlockInfoForEditor(e){return this._renderer.getCodeBlockInfoForEditor(e)}getFileTreeInfosForResponse(e){return this._renderer.getFileTreeInfosForResponse(e)}getLastFocusedFileTreeForResponse(e){return this._renderer.getLastFocusedFileTreeForResponse(e)}editorsInUse(){return this._renderer.editorsInUse()}getTemplateDataForRequestId(e){if(e)return this._renderer.getTemplateDataForRequestId(e)}updateRendererOptions(e){this._renderer.updateOptions(e)}setVisible(e){this._visible=e,this._renderer.setVisible(e)}layout(e,t){this._bodyDimension=new ai(t??this._container.clientWidth,e),this.updateLastItemMinHeight(),this._tree.layout(e,t),this._renderer.layout(t??this._container.clientWidth)}updateLastItemMinHeight(){if(!this._bodyDimension)return;let e=this._bodyDimension.height;if(this._renderStyle==="compact"||this._renderStyle==="minimal")this._container.style.removeProperty("--chat-current-response-min-height");else{let t=this._viewModel?.getItems().at(-2),n=Math.min(Rr(t)||Vi(t)?t.currentRenderedHeight??150:150,200),r=Math.max(e-(n+10),0);if(this._container.style.setProperty("--chat-current-response-min-height",r+"px"),r!==this._previousLastItemMinHeight){this._previousLastItemMinHeight=r;let s=this._viewModel?.getItems().at(-1);s&&this._visible&&this._tree.hasElement(s)&&this._updateElementHeight(s,void 0)}}}};ste=I([m(2,F),m(3,X),m(4,Si),m(5,ze),m(6,ne),m(7,B),m(8,NO)],ste);var Bki=class extends C{constructor(){super(...arguments);this.descriptors=[];this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event}register(e){this.descriptors.push(e),this._onDidChange.fire()}get(){return this.descriptors}},NB=new Bki;oe.add("workbench.registry.chat.viewsWelcome",NB);var ktt=_,VAe=class extends C{constructor(e,t,o,n,r){super();this.container=e;this.delegate=t;this.location=o;this.contextKeyService=n;this.instantiationService=r;this.enabled=!1;this.enabledDisposables=this._register(new P);this.renderDisposables=this._register(new P);this._isShowingWelcome=Le(this,!1);this.element=R(this.container,_(".chat-view-welcome")),this._register(H.runAndSubscribe(t.onDidChangeViewWelcomeState,()=>this.update())),this._register(NB.onDidChange(()=>this.update(!0)))}get isShowingWelcome(){return this._isShowingWelcome}getMatchingWelcomeView(){return NB.get().filter(o=>this.contextKeyService.contextMatchesRules(o.when)).at(0)}update(e){let t=this.delegate.shouldShowWelcome();if(this.enabled===t&&!e)return;if(this.enabled=t,this.enabledDisposables.clear(),!t){this.container.classList.toggle("chat-view-welcome-visible",!1),this.renderDisposables.clear(),this._isShowingWelcome.set(!1,void 0);return}let o=NB.get();if(o.length){this.render(o);let n=new Set(o.flatMap(r=>r.when.keys()));this.enabledDisposables.add(this.contextKeyService.onDidChangeContext(r=>{r.affectsSome(n)&&this.render(o)}))}}render(e){this.renderDisposables.clear(),Rt(this.element);let o=e.filter(n=>this.contextKeyService.contextMatchesRules(n.when)).at(0);if(o){let n={icon:o.icon,title:o.title,message:o.content},r=this.renderDisposables.add(this.instantiationService.createInstance(Jme,n,{firstLinkToButton:!0,location:this.location}));this.element.appendChild(r.element),this.container.classList.toggle("chat-view-welcome-visible",!0),this._isShowingWelcome.set(!0,void 0)}else this.container.classList.toggle("chat-view-welcome-visible",!1),this._isShowingWelcome.set(!1,void 0)}};VAe=I([m(3,X),m(4,F)],VAe);var Jme=class extends C{constructor(e,t,o,n,r){super();this.content=e;this.openerService=o;this.logService=n;this.markdownRendererService=r;this.element=_(".chat-welcome-view");try{let s=R(this.element,ktt(".chat-welcome-view-icon"));if(e.useLargeIcon&&s.classList.add("large-icon"),e.icon){if(q.isThemeIcon(e.icon)){let p=Qo(e.icon);s.appendChild(p)}else if(A.isUri(e.icon)){let p=Na(e.icon),h=new Ly;h.update(p);let g=`chat-welcome-icon-${h.digest()}`,f=`.chat-welcome-view-icon.${g}`;Vh(f,`
mask: ${p} no-repeat 50% 50%;
-webkit-mask: ${p} no-repeat 50% 50%;
background-color: var(--vscode-icon-foreground);
`),s.classList.add(g,"custom-icon")}}let l=R(this.element,ktt(".chat-welcome-view-title"));l.textContent=e.title;let c=R(this.element,ktt(".chat-welcome-view-message")),u=this.renderMarkdownMessageContent(e.message,t);if(R(c,u.element),e.additionalMessage){let p=R(this.element,ktt(".chat-welcome-view-disclaimer"));if(typeof e.additionalMessage=="string")p.textContent=e.additionalMessage;else{let h=this.renderMarkdownMessageContent(e.additionalMessage,t);p.appendChild(h.element)}}if(e.tips){let p=R(this.element,ktt(".chat-welcome-view-tips")),h=this._register(this.markdownRendererService.render(e.tips));p.appendChild(h.element)}}catch(s){this.logService.error("Failed to render chat view welcome content",s)}}needsRerender(e){return this.content.title!==e.title||this.content.message.value!==e.message.value||this.content.additionalMessage!==e.additionalMessage||this.content.tips?.value!==e.tips?.value}renderMarkdownMessageContent(e,t){let o=this._register(this.markdownRendererService.render(e)),n=t?.firstLinkToButton?o.element.querySelector("a"):void 0;if(n){let r=n.getAttribute("data-href"),s=this._register(new Mi(n.parentElement,Ko));s.label=n.textContent??"",r&&this._register(s.onDidClick(()=>{this.openerService.open(r,{allowCommands:!0})})),n.replaceWith(s.element)}return o}};Jme=I([m(2,Qe),m(3,ne),m(4,Qn)],Jme);var rUt=class a extends C{constructor(e,t,o){super();this._chatService=e;this._storageService=t;this._getActiveContextKeyService=o;this._register(this._chatService.onDidSubmitRequest(n=>{let r=n.message??this._chatService.getSession(n.chatSessionResource)?.lastRequest?.message;if(!r)return;for(let c of r.parts)if(c.kind===jx.Kind){let u=c;if(a._isCreateSlashCommand(u.slashCommand.command)){this._markUsed();return}}let s=r.text.trimStart(),l=/^\/(create-(?:instructions|prompt|agent|skill))(?:\s|$)/.exec(s);l&&a._isCreateSlashCommand(l[1])&&this._markUsed()}))}static{this._USED_CREATE_SLASH_COMMANDS_KEY="chat.tips.usedCreateSlashCommands"}syncContextKey(e){let t=this._storageService.getBoolean(a._USED_CREATE_SLASH_COMMANDS_KEY,-1,!1);ie.hasUsedCreateSlashCommands.bindTo(e).set(t)}_markUsed(){if(this._storageService.getBoolean(a._USED_CREATE_SLASH_COMMANDS_KEY,-1,!1))return;this._storageService.store(a._USED_CREATE_SLASH_COMMANDS_KEY,!0,-1,1);let e=this._getActiveContextKeyService();e&&ie.hasUsedCreateSlashCommands.bindTo(e).set(!0)}static _isCreateSlashCommand(e){switch(e){case"create-instructions":case"create-prompt":case"create-agent":case"create-skill":return!0;default:return!1}}};var IA={DismissedTips:"chat.tip.dismissed",LastTipId:"chat.tip.lastTipId",ThinkingPhrasesEverModified:"chat.tip.thinkingPhrasesEverModified"},Zme={ExecutedCommands:"chat.tips.executedCommands",UsedModes:"chat.tips.usedModes",InvokedTools:"chat.tips.invokedTools"},bD={AttachFilesReferenceUsed:"chat.tips.attachFiles.referenceUsed",CreateAgentInstructionsUsed:"chat.tips.createAgentInstructions.commandUsed",CreatePromptUsed:"chat.tips.createPrompt.commandUsed",CreateAgentUsed:"chat.tips.createAgent.commandUsed",CreateSkillUsed:"chat.tips.createSkill.commandUsed",ForkConversationUsed:"chat.tips.forkConversation.commandUsed"};var ehe=class extends C{constructor(e,t,o,n,r,s){super();this._storageService=o;this._promptsService=n;this._languageModelToolsService=r;this._logService=s;this._commandListener=this._register(new me);this._toolListener=this._register(new me);this._excludedByFiles=new Set;this._fileCheckGeneration=new Map;this._fileChecksInFlight=new Map;let l=this._readApplicationWithProfileFallback(Zme.ExecutedCommands);this._executedCommands=new Set(l?JSON.parse(l):[]);let c=this._readApplicationWithProfileFallback(Zme.UsedModes);this._usedModes=new Set(c?JSON.parse(c):[]);let u=this._readApplicationWithProfileFallback(Zme.InvokedTools);this._invokedTools=new Set(u?JSON.parse(u):[]),this._pendingCommands=new Set;for(let p of e)for(let h of p.excludeWhenCommandsExecuted??[])this._executedCommands.has(h)||this._pendingCommands.add(h);this._pendingModes=new Set;for(let p of e)for(let h of p.excludeWhenModesUsed??[])this._usedModes.has(h)||this._pendingModes.add(h);this._pendingTools=new Set;for(let p of e)for(let h of p.excludeWhenToolsInvoked??[])this._invokedTools.has(h)||this._pendingTools.add(h);this._pendingCommands.size>0&&(this._commandListener.value=t.onDidExecuteCommand(p=>{this.recordCommandExecuted(p.commandId)})),this._pendingTools.size>0&&(this._toolListener.value=this._languageModelToolsService.onDidInvokeTool(p=>{this._pendingTools.has(p.toolId)&&(this._invokedTools.add(p.toolId),this._pendingTools.delete(p.toolId),this._persistSet(Zme.InvokedTools,this._invokedTools)),this._pendingTools.size===0&&this._toolListener.clear()})),this._tipsWithFileExclusions=e.filter(p=>p.excludeWhenPromptFilesExist);for(let p of this._tipsWithFileExclusions)p.excludeWhenPromptFilesExist.excludeUntilChecked&&this._excludedByFiles.add(p.id),this._checkForPromptFiles(p);this._register(this._promptsService.onDidChangeCustomAgents(()=>{for(let p of this._tipsWithFileExclusions)p.excludeWhenPromptFilesExist.promptType==="agent"&&this._checkForPromptFiles(p)}))}recordCommandExecuted(e){this._pendingCommands.has(e)&&(this._executedCommands.add(e),this._persistSet(Zme.ExecutedCommands,this._executedCommands),this._pendingCommands.delete(e),this._pendingCommands.size===0&&this._commandListener.clear())}recordCurrentMode(e){if(this._pendingModes.size===0)return;let t=!1,o=e.getContextKeyValue(ie.chatModeKind.key);o&&!this._usedModes.has(o)&&(this._usedModes.add(o),this._pendingModes.delete(o),t=!0);let n=e.getContextKeyValue(ie.chatModeName.key);n&&!this._usedModes.has(n)&&(this._usedModes.add(n),this._pendingModes.delete(n),t=!0),t&&this._persistSet(Zme.UsedModes,this._usedModes)}isExcluded(e){if(e.excludeWhenCommandsExecuted){for(let t of e.excludeWhenCommandsExecuted)if(this._executedCommands.has(t))return this._logService.debug("#ChatTips: tip excluded because command was executed",e.id,t),!0}if(e.excludeWhenModesUsed){for(let t of e.excludeWhenModesUsed)if(this._usedModes.has(t))return this._logService.debug("#ChatTips: tip excluded because mode was used",e.id,t),!0}if(e.excludeWhenToolsInvoked){for(let t of e.excludeWhenToolsInvoked)if(this._invokedTools.has(t))return this._logService.debug("#ChatTips: tip excluded because tool was invoked",e.id,t),!0}return e.excludeWhenPromptFilesExist&&this._excludedByFiles.has(e.id)?(this._logService.debug("#ChatTips: tip excluded because prompt files exist",e.id),!0):!1}refreshPromptFileExclusions(){for(let e of this._tipsWithFileExclusions)e.excludeWhenPromptFilesExist.excludeUntilChecked&&this._excludedByFiles.add(e.id),this._checkForPromptFiles(e)}async _checkForPromptFiles(e){let t=this._fileChecksInFlight.get(e.id);if(t){await t;return}let o=this._doCheckForPromptFiles(e);this._fileChecksInFlight.set(e.id,o);try{await o}finally{this._fileChecksInFlight.get(e.id)===o&&this._fileChecksInFlight.delete(e.id)}}async _doCheckForPromptFiles(e){let t=e.excludeWhenPromptFilesExist,o=(this._fileCheckGeneration.get(e.id)??0)+1;this._fileCheckGeneration.set(e.id,o);try{let[n,r]=await Promise.all([this._promptsService.listPromptFiles(t.promptType,ve.None),t.agentFileType?this._promptsService.listAgentInstructions(ve.None):Promise.resolve([])]);if(this._fileCheckGeneration.get(e.id)!==o)return;let s=n.length>0,l=t.agentFileType?r.some(u=>u.type===t.agentFileType):!1;s||l?this._excludedByFiles.add(e.id):this._excludedByFiles.delete(e.id)}catch{if(this._fileCheckGeneration.get(e.id)!==o)return;t.excludeUntilChecked&&this._excludedByFiles.add(e.id)}}_persistSet(e,t){this._storageService.store(e,JSON.stringify([...t]),-1,1)}_readApplicationWithProfileFallback(e){let t=this._storageService.get(e,-1);if(t)return t;let o=this._storageService.get(e,0);return o&&this._storageService.store(e,o,-1,1),o}};ehe=I([m(1,ge),m(2,le),m(3,nr),m(4,jn),m(5,ne)],ehe);function BAe(a,i){let e=a.keybindingService.lookupKeybinding(i);return e?` (${e.getLabel()})`:""}function Hki(a){let i=/\[.*?\]\(command:([^?\s)]+)/g,e=new Set,t;for(;(t=i.exec(a))!==null;)e.add(t[1]);return[...e]}var a0=[{id:"tip.switchToAuto",tier:"foundational",priority:0,buildMessage(a){return new xe(d(6832,null))},onlyWhenModelIds:["gpt-4.1"]},{id:"tip.init",tier:"foundational",priority:50,buildMessage(a){let i=BAe(a,s2);return new xe(d(6827,null,"/init",s2,i))},when:ie.chatSessionType.isEqualTo(qp),excludeWhenCommandsExecuted:[s2,bD.CreateAgentInstructionsUsed]},{id:"tip.createPrompt",tier:"foundational",buildMessage(a){let i=BAe(a,r3);return new xe(d(6824,null,"/create-prompt",r3,i))},when:ie.chatSessionType.isEqualTo(qp),excludeWhenCommandsExecuted:[r3,bD.CreatePromptUsed]},{id:"tip.createAgent",tier:"foundational",priority:30,buildMessage(a){let i=BAe(a,a3);return new xe(d(6823,null,"/create-agent",a3,i))},when:ie.chatSessionType.isEqualTo(qp),excludeWhenCommandsExecuted:[a3,bD.CreateAgentUsed]},{id:"tip.createSkill",tier:"foundational",priority:40,buildMessage(a){let i=BAe(a,s3);return new xe(d(6825,null,"/create-skill",s3,i))},when:ie.chatSessionType.isEqualTo(qp),excludeWhenCommandsExecuted:[s3,bD.CreateSkillUsed]},{id:"tip.planMode",tier:"foundational",priority:20,buildMessage(a){let i=BAe(a,"workbench.action.chat.openPlan");return new xe(d(6830,null,"Plan agent",i))},when:ie.chatModeName.notEqualsTo("Plan"),excludeWhenCommandsExecuted:["workbench.action.chat.openPlan"],excludeWhenModesUsed:["Plan"]},{id:"tip.attachFiles",tier:"qol",buildMessage(){return new xe(d(6821,null))},excludeWhenCommandsExecuted:["workbench.action.chat.attachContext","workbench.action.chat.attachFile","workbench.action.chat.attachFolder","workbench.action.chat.attachSelection",bD.AttachFilesReferenceUsed]},{id:"tip.codeActions",tier:"qol",buildMessage(){return new xe(d(6822,null))},excludeWhenCommandsExecuted:["inlineChat.start"]},{id:"tip.undoChanges",tier:"qol",buildMessage(){return new xe(d(6834,null))},when:x.and(ie.chatSessionType.isEqualTo(qp),x.or(ie.chatModeKind.isEqualTo("agent"),ie.chatModeKind.isEqualTo("edit"))),excludeWhenCommandsExecuted:["workbench.action.chat.restoreCheckpoint","workbench.action.chat.restoreLastCheckpoint"]},{id:"tip.messageQueueing",tier:"qol",buildMessage(){return new xe(d(6829,null))},when:ie.chatModeKind.isEqualTo("agent"),excludeWhenCommandsExecuted:["workbench.action.chat.queueMessage","workbench.action.chat.steerWithMessage"]},{id:"tip.forkConversation",tier:"qol",buildMessage(a){let i=BAe(a,met);return new xe(d(6826,null,"/fork",met,i))},excludeWhenCommandsExecuted:[met,"workbench.action.chat.forkConversation",bD.ForkConversationUsed]},{id:"tip.agenticBrowser",tier:"qol",buildMessage(){return new xe(d(6820,null,"agentic browser integration"))},when:x.and(ie.chatModeKind.isEqualTo("agent"),x.notEquals("config.workbench.browser.enableChatTools",!0)),excludeWhenSettingsChanged:["workbench.browser.enableChatTools"],dismissWhenCommandsClicked:["workbench.action.openSettings"]},{id:"tip.mermaid",tier:"qol",buildMessage(){return new xe(d(6828,null))},when:ie.chatModeKind.isEqualTo("agent"),excludeWhenToolsInvoked:["renderMermaidDiagram"]},{id:"tip.subagents",tier:"qol",buildMessage(){return new xe(d(6831,null))},when:ie.chatModeKind.isEqualTo("agent"),excludeWhenToolsInvoked:["runSubagent"]},{id:"tip.thinkingPhrases",tier:"qol",buildMessage(){return new xe(d(6833,null,"thinking phrases","chat.agent.thinking.phrases"))},when:ie.chatModeKind.isEqualTo("agent"),excludeWhenSettingsChanged:["chat.agent.thinking.phrases"],dismissWhenCommandsClicked:["workbench.action.openSettings"]}];var ZRp=bD.AttachFilesReferenceUsed,f7o=bD.CreateAgentInstructionsUsed,v7o=bD.CreatePromptUsed,b7o=bD.CreateAgentUsed,S7o=bD.CreateSkillUsed,I7o=bD.ForkConversationUsed,l0=ae("chatTipService"),HAe=class extends C{constructor(e,t,o,n,r,s,l,c,u,p){super();this._productService=e;this._configurationService=t;this._storageService=o;this._chatService=n;this._logService=s;this._chatEntitlementService=l;this._commandService=c;this._telemetryService=u;this._keybindingService=p;this._onDidDismissTip=this._register(new E);this.onDidDismissTip=this._onDidDismissTip.event;this._onDidNavigateTip=this._register(new E);this.onDidNavigateTip=this._onDidNavigateTip.event;this._onDidHideTip=this._register(new E);this.onDidHideTip=this._onDidHideTip.event;this._onDidDisableTips=this._register(new E);this.onDidDisableTips=this._onDidDisableTips.event;this._tipsHiddenForSession=!1;this._tipCommandListener=this._register(new me);this._tracker=this._register(r.createInstance(ehe,a0)),this._createSlashCommandsUsageTracker=this._register(new rUt(this._chatService,this._storageService,()=>this._contextKeyService)),this._register(this._chatEntitlementService.onDidChangeQuotaExceeded(()=>{this._chatEntitlementService.quotas.chat?.percentRemaining===0&&this._shownTip&&this.hideTip()})),this._register(this._chatService.onDidSubmitRequest(h=>{let g=h.message??this._chatService.getSession(h.chatSessionResource)?.lastRequest?.message;if(!g)return;this._hasFileOrFolderReference(g)&&this._tracker.recordCommandExecuted(bD.AttachFilesReferenceUsed);let f=this._getSlashCommandTrackingId(g);f&&this._tracker.recordCommandExecuted(f),this._hideShownTipIfNowIneligible()})),this._thinkingPhrasesEverModified=this._storageService.getBoolean(IA.ThinkingPhrasesEverModified,-1,!1),!this._thinkingPhrasesEverModified&&this._isSettingModified("chat.agent.thinking.phrases")&&(this._thinkingPhrasesEverModified=!0,this._storageService.store(IA.ThinkingPhrasesEverModified,!0,-1,1)),this._thinkingPhrasesEverModified||this._register(this._configurationService.onDidChangeConfiguration(h=>{h.affectsConfiguration("chat.agent.thinking.phrases")&&(this._thinkingPhrasesEverModified=!0,this._storageService.store(IA.ThinkingPhrasesEverModified,!0,-1,1))}))}_hasFileOrFolderReference(e){return e.parts.some(t=>{if(t.kind!==tR.Kind)return!1;let o=t;return o.isFile===!0||o.isDirectory===!0})}_getSlashCommandTrackingId(e){for(let n of e.parts){if(n.kind===jx.Kind){let r=n.slashCommand.command;return this._toSlashCommandTrackingId(r)}if(n.kind===Pf.Kind){let r=n.command.name;return this._toSlashCommandTrackingId(r)}}let t=e.text.trimStart(),o=/^(?:@\S+\s+)?\/(init|create-(?:instructions|prompt|agent|skill)|fork)(?:\s|$)/.exec(t);return o?this._toSlashCommandTrackingId(o[1]):void 0}_toSlashCommandTrackingId(e){switch(e){case"init":case"create-instructions":return f7o;case"create-prompt":return v7o;case"create-agent":return b7o;case"create-skill":return S7o;case"fork":return I7o;default:return}}recordSlashCommandUsage(e){let t=this._toSlashCommandTrackingId(e);t&&(this._tracker.recordCommandExecuted(t),this._hideShownTipIfNowIneligible())}resetSession(){this._shownTip=void 0,this._tipRequestId=void 0,this._contextKeyService=void 0,this._tipsHiddenForSession=!1}dismissTip(){if(this._shownTip){this._logTipTelemetry(this._shownTip.id,"dismissed");let e=new Set(this._getDismissedTipIds());e.add(this._shownTip.id),this._storageService.store(IA.DismissedTips,JSON.stringify([...e]),-1,1)}this._tipRequestId=void 0,this._onDidDismissTip.fire()}dismissTipForSession(){this.dismissTip(),this.hideTipsForSession()}clearDismissedTips(){this._storageService.remove(IA.DismissedTips,-1),this._storageService.remove(IA.DismissedTips,0),this._shownTip=void 0,this._tipRequestId=void 0,this._contextKeyService=void 0,this._tipsHiddenForSession=!1,this._onDidDismissTip.fire()}_getDismissedTipIds(){let e=this._readApplicationWithProfileFallback(IA.DismissedTips);if(!e)return[];try{let t=JSON.parse(e);if(this._logService.debug("#ChatTips dismissed:",t),!Array.isArray(t))return[];let o=new Set(a0.map(r=>r.id)),n=new Set;for(let r of t)typeof r=="string"&&o.has(r)&&n.add(r);return[...n]}catch{return[]}}hideTip(){this._shownTip&&this._logTipTelemetry(this._shownTip.id,"hidden"),this._shownTip=void 0,this._tipRequestId=void 0,this._onDidHideTip.fire()}hideTipsForSession(){this._tipsHiddenForSession||(this._tipsHiddenForSession=!0,this._shownTip=void 0,this._tipRequestId=void 0,this._onDidHideTip.fire())}async disableTips(){this._shownTip&&this._logTipTelemetry(this._shownTip.id,"disabled"),this._shownTip=void 0,this._tipRequestId=void 0,await this._configurationService.updateValue("chat.tips.enabled",!1,1),this._onDidDisableTips.fire()}getWelcomeTip(e){if(this._createSlashCommandsUsageTracker.syncContextKey(e),this._tracker.recordCurrentMode(e),this._tracker.refreshPromptFileExclusions(),!this._configurationService.getValue("chat.tips.enabled")||this._tipsHiddenForSession||(this._contextKeyService=e,!this._isCopilotEnabled())||this._chatEntitlementService.entitlement===1||!this._isChatLocation(e)||e.getContextKeyValue(ie.foregroundSessionCount.key)!==1||this._isChatQuotaExceeded(e))return;if(this._tipRequestId==="welcome"&&this._shownTip){if(this._shownTip.id!=="tip.switchToAuto"){let n=a0.find(r=>r.id==="tip.switchToAuto");if(n&&!new Set(this._getDismissedTipIds()).has(n.id)&&this._isEligible(n,e)){this._shownTip=n,this._storageService.store(IA.LastTipId,n.id,-1,0);let s=this._createTip(n);return this._logTipTelemetry(n.id,"shown"),this._trackTipCommandClicks(n),this._onDidNavigateTip.fire(s),s}}if(!this._isEligible(this._shownTip,e)){if(this._tracker.isExcluded(this._shownTip)){this.hideTip();return}let n=this._findNextEligibleTip(this._shownTip.id,e);if(n){this._shownTip=n,this._storageService.store(IA.LastTipId,n.id,-1,0);let r=this._createTip(n);return this._onDidNavigateTip.fire(r),r}this.hideTip();return}return this._createTip(this._shownTip)}return this._pickTip("welcome",e)}_findNextEligibleTip(e,t){this._createSlashCommandsUsageTracker.syncContextKey(t);let o=a0.findIndex(r=>r.id===e);if(o===-1)return;let n=new Set(this._getDismissedTipIds());for(let r=1;r<a0.length;r++){let s=(o+r)%a0.length,l=a0[s];if(!n.has(l.id)&&this._isEligible(l,t))return l}}_hideShownTipIfNowIneligible(){!this._shownTip||!this._contextKeyService||this._tipsHiddenForSession||this._isEligible(this._shownTip,this._contextKeyService)||this.hideTip()}_pickTip(e,t){this._createSlashCommandsUsageTracker.syncContextKey(t),this._tracker.recordCurrentMode(t);let o=new Set(this._getDismissedTipIds()),n=a0.filter(s=>!o.has(s.id)&&this._isEligible(s,t)),r=this._selectTipByTier(n);if(r)return this._storageService.store(IA.LastTipId,r.id,-1,0),this._tipRequestId=e,this._shownTip=r,this._logTipTelemetry(r.id,"shown"),this._trackTipCommandClicks(r),this._createTip(r)}_selectTipByTier(e){let t=e.filter(r=>r.tier==="foundational");if(t.length)return this._sortByPriorityAndCatalogOrder(t)[0];let o=e.filter(r=>r.tier==="qol");if(!o.length)return;let n=Math.floor(Math.random()*o.length);return o[n]}navigateToNextTip(){if(this._contextKeyService)return this._navigateTip(1,this._contextKeyService)}navigateToPreviousTip(){if(this._contextKeyService)return this._navigateTip(-1,this._contextKeyService)}getNextEligibleTip(){if(!this._contextKeyService||!this._shownTip)return;let e=this._contextKeyService;this._createSlashCommandsUsageTracker.syncContextKey(e);let t=this._shownTip.id,o=this._getOrderedEligibleTips(e,{includeTipId:t});if(!o.length)return;let n=o.findIndex(s=>s.id===t),r=this._getNextTipFromOrderedList(o,n,t);if(r)return this._shownTip=r,this._tipRequestId="welcome",this._storageService.store(IA.LastTipId,r.id,-1,0),this._logTipTelemetry(r.id,"shown"),this._trackTipCommandClicks(r),this._createTip(r)}_getNextTipFromOrderedList(e,t,o){if(!e.length)return;let r=t===-1?0:t;for(let s=1;s<=e.length;s++){let l=(r+s)%e.length,c=e[l];if(c.id!==o)return c}}hasMultipleTips(){return this._contextKeyService?(this._createSlashCommandsUsageTracker.syncContextKey(this._contextKeyService),this._hasNavigableTip(this._contextKeyService)):!1}_navigateTip(e,t){if(this._createSlashCommandsUsageTracker.syncContextKey(t),!this._shownTip)return;let o=this._getOrderedEligibleTips(t);if(!o.length)return;let n=o.findIndex(c=>c.id===this._shownTip.id);if(o.length===1&&n!==-1)return;let r=e===1?0:o.length-1,s=n===-1?r:(n+e+o.length)%o.length,l=o[s];if(l){this._logTipTelemetry(this._shownTip.id,e===1?"navigateNext":"navigatePrevious"),this._shownTip=l,this._tipRequestId="welcome",this._storageService.store(IA.LastTipId,l.id,-1,0),this._logTipTelemetry(l.id,"shown"),this._trackTipCommandClicks(l);let c=this._createTip(l);return this._onDidNavigateTip.fire(c),c}}_hasNavigableTip(e){let t=this._getOrderedEligibleTips(e);return t.length?this._shownTip?t.length>1?!0:t[0].id!==this._shownTip.id:t.length>1:!1}_getOrderedEligibleTips(e,t){let o=new Set(this._getDismissedTipIds()),n=a0.filter(l=>t?.includeTipId&&l.id===t.includeTipId?!0:t?.excludeShownTip&&this._shownTip&&l.id===this._shownTip.id?!1:!o.has(l.id)&&this._isEligible(l,e)),r=this._sortByPriorityAndCatalogOrder(n.filter(l=>l.tier==="foundational")),s=this._sortByPriorityAndCatalogOrder(n.filter(l=>l.tier==="qol"));return[...r,...s]}_sortByPriorityAndCatalogOrder(e){return[...e].sort((t,o)=>{let n=t.priority??Number.POSITIVE_INFINITY,r=o.priority??Number.POSITIVE_INFINITY;if(n!==r)return n-r;let s=a0.findIndex(c=>c.id===t.id),l=a0.findIndex(c=>c.id===o.id);return s-l})}_isEligible(e,t){if(e.onlyWhenModelIds?.length){let o=this._getCurrentChatModelId(t);if(!e.onlyWhenModelIds.some(r=>o===r||o.startsWith(`${r}-`)))return!1}return e.excludeWhenSettingsChanged?.some(o=>this._isSettingModified(o))?(this._logService.debug("#ChatTips: tip excluded because setting was modified",e.id,e.excludeWhenSettingsChanged),!1):e.when&&!t.contextMatchesRules(e.when)?(this._logService.debug("#ChatTips: tip is not eligible due to when clause",e.id,e.when.serialize()),!1):this._tracker.isExcluded(e)?!1:e.id==="tip.thinkingPhrases"&&this._thinkingPhrasesEverModified?(this._logService.debug("#ChatTips: tip excluded because thinking phrases setting was previously modified",e.id),!1):(this._logService.debug("#ChatTips: tip is eligible",e.id),!0)}_isSettingModified(e){let t=this._configurationService.inspect(e);return t.userValue!==void 0||t.userLocalValue!==void 0||t.userRemoteValue!==void 0||t.workspaceValue!==void 0||t.workspaceFolderValue!==void 0}_getCurrentChatModelId(e){let t=l=>{let c=l?.toLowerCase()??"";return c?c.includes("/")?c.split("/").at(-1)??"":c:""},o=t(e.getContextKeyValue(ie.chatModelId.key));if(o)return o;let n=e.getContextKeyValue(ie.location.key)??"panel",r=e.getContextKeyValue(ie.chatSessionType.key)??"",s=r?[`chat.currentLanguageModel.${n}.${r}`,`chat.currentLanguageModel.${n}`]:[`chat.currentLanguageModel.${n}`];for(let l of s){let c=this._storageService.get(l,-1),u=t(c);if(u)return u}return""}_isChatLocation(e){let t=e.getContextKeyValue(ie.location.key);return!t||t==="panel"}_isChatQuotaExceeded(e){return e.getContextKeyValue(ie.chatQuotaExceeded.key)===!0}_isCopilotEnabled(){return!!this._productService.defaultChatAgent?.chatExtensionId}_createTip(e){let t={keybindingService:this._keybindingService},o=e.buildMessage(t),n=d(6835,null,o.value),r=Hki(n),s=new xe(n,{isTrusted:r.length>0?{enabledCommands:r}:!1});return{id:e.id,content:s,enabledCommands:r}}_logTipTelemetry(e,t,o){this._telemetryService.publicLog2("chatTip",{tipId:e,action:t,commandId:o})}_trackTipCommandClicks(e){this._tipCommandListener.clear();let t={keybindingService:this._keybindingService},o=e.buildMessage(t),n=Hki(o.value);if(!n.length)return;let r=new Set(n),s=new Set(e.dismissWhenCommandsClicked);this._tipCommandListener.value=this._commandService.onDidExecuteCommand(l=>{r.has(l.commandId)&&this._shownTip?.id===e.id&&(this._logTipTelemetry(e.id,"commandClicked",l.commandId),s.has(l.commandId)&&this.dismissTip(),this.hideTipsForSession())})}_readApplicationWithProfileFallback(e){let t=this._storageService.get(e,-1);if(t)return t;let o=this._storageService.get(e,0);return o&&this._storageService.store(e,o,-1,1),o}};HAe=I([m(0,nt),m(1,B),m(2,le),m(3,Si),m(4,F),m(5,ne),m(6,vr),m(7,ge),m(8,Te),m(9,_e)],HAe);var Dmo=_,UAe=class extends C{constructor(e,t,o,n,r,s,l,c,u,p){super();this._renderer=t;this._chatTipService=o;this._contextMenuService=n;this._menuService=r;this._contextKeyService=s;this._instantiationService=l;this._openerService=c;this._commandService=u;this._chatEntitlementService=p;this._onDidHide=this._register(new E);this.onDidHide=this._onDidHide.event;this._renderedContent=this._register(new me);this._toolbar=this._register(new me);this.domNode=Dmo(".chat-tip-widget"),this.domNode.tabIndex=0,this.domNode.setAttribute("role","region"),this.domNode.setAttribute("aria-roledescription",d(7229,null)),this._inChatTipContextKey=ie.inChatTip.bindTo(this._contextKeyService),this._multipleChatTipsContextKey=ie.multipleChatTips.bindTo(this._contextKeyService);let h=this._register(Vn(this.domNode));this._register(h.onDidFocus(()=>this._inChatTipContextKey.set(!0))),this._register(h.onDidBlur(()=>this._inChatTipContextKey.set(!1))),this._register({dispose:()=>{this._inChatTipContextKey.reset(),this._multipleChatTipsContextKey.reset()}}),this._renderTip(e),this._register(this._chatTipService.onDidDismissTip(()=>{this._onDidHide.fire()})),this._register(this._chatTipService.onDidNavigateTip(g=>{this._renderTip(g),Ah(Me(this.domNode),()=>this.focus())})),this._register(this._chatTipService.onDidHideTip(()=>{this._onDidHide.fire()})),this._register(this._chatTipService.onDidDisableTips(()=>{this._onDidHide.fire()})),this._register(j(this.domNode,re.CONTEXT_MENU,g=>{$t.stop(g,!0);let f=new yn(Me(this.domNode),g);this._contextMenuService.showContextMenu({getAnchor:()=>f,getActions:()=>{let v=this._menuService.getMenuActions(D.ChatTipContext,this._contextKeyService);return Uc(v)}})}))}hasFocus(){return ts(this.domNode)}focus(){this.domNode.focus()}_renderTip(e){Rt(this.domNode),this._toolbar.clear(),this._multipleChatTipsContextKey.set(this._chatTipService.hasMultipleTips());let t=this._renderer.render(e.content,{actionHandler:(l,c)=>{this._handleTipAction(l,c).catch(mt)}});this._renderedContent.value=t,this.domNode.appendChild(t.element);let o=Dmo(".chat-tip-toolbar");this._toolbar.value=this._instantiationService.createInstance(Ln,o,D.ChatTipToolbar,{menuOptions:{shouldForwardArgs:!0}}),this.domNode.appendChild(o);let n=t.element.textContent??d(7222,null),s=/\[.*?\]\(.*?\)/.test(e.content.value)?d(7230,null,n):n;this.domNode.setAttribute("aria-label",s)}async _handleTipAction(e,t){e.startsWith("command:")&&this._shouldTriggerSetup()&&!await this._commandService.executeCommand(pI)||await zM(this._openerService,e,t.isTrusted)}_shouldTriggerSetup(){return this._chatEntitlementService.sentiment?.installed?this._chatEntitlementService.entitlement===1:!0}};UAe=I([m(2,l0),m(3,ze),m(4,qt),m(5,X),m(6,F),m(7,Qe),m(8,ge),m(9,vr)],UAe);W(class extends K{constructor(){super({id:"workbench.action.chat.previousTip",title:L(7227,"Previous tip"),icon:M.chevronLeft,precondition:ie.multipleChatTips,f1:!1,menu:[{id:D.ChatTipToolbar,group:"navigation",order:1}]})}async run(i){i.get(l0).navigateToPreviousTip()}});W(class extends K{constructor(){super({id:"workbench.action.chat.nextTip",title:L(7226,"Next tip"),icon:M.chevronRight,precondition:ie.multipleChatTips,f1:!1,menu:[{id:D.ChatTipToolbar,group:"navigation",order:2}]})}async run(i){i.get(l0).navigateToNextTip()}});W(class extends K{constructor(){super({id:"workbench.action.chat.dismissTipToolbar",title:L(7225,"Dismiss tip"),icon:M.check,f1:!1,menu:[{id:D.ChatTipToolbar,group:"navigation",order:3}]})}async run(i){i.get(l0).dismissTipForSession()}});W(class extends K{constructor(){super({id:"workbench.action.chat.dismissTip",title:L(7224,"Dismiss this tip"),f1:!1,menu:[{id:D.ChatTipContext,group:"chatTip",order:1}]})}async run(i){i.get(l0).dismissTipForSession()}});W(class extends K{constructor(){super({id:"workbench.action.chat.disableTips",title:L(7223,"Disable tips"),icon:M.bellSlash,f1:!1,menu:[{id:D.ChatTipContext,group:"chatTip",order:2},{id:D.ChatTipToolbar,group:"navigation",order:5}]})}async run(i){let e=i.get(l0),t=i.get(ge);await e.disableTips(),await t.executeCommand("workbench.action.openSettings","chat.tips.enabled")}});W(class extends K{constructor(){super({id:"workbench.action.chat.resetDismissedTips",title:L(7228,"Reset Dismissed Tips"),f1:!0,precondition:ie.enabled})}async run(i){i.get(l0).clearDismissedTips()}});var sUt=_;function aUt(a){return _ce(a.viewContext)&&!!a.viewContext.isQuickChat}function y7o(a){return _ce(a.viewContext)&&!!a.viewContext.isInlineChat}var Lmo={supportsFileAttachments:!0,supportsToolAttachments:!0,supportsMCPAttachments:!0,supportsImageAttachments:!0,supportsSearchResultAttachments:!0,supportsInstructionAttachments:!0,supportsSourceControlAttachments:!0,supportsProblemAttachments:!0,supportsSymbolAttachments:!0,supportsTerminalAttachments:!0,supportsPromptAttachments:!0,supportsHandOffs:!0},Uki=d(7376,null),Cw=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N,O,V,U,G,$,te,pe,de,se){super();this.viewOptions=o;this.styles=n;this.codeEditorService=r;this.configurationService=s;this.dialogService=l;this.contextKeyService=c;this.instantiationService=u;this.chatService=p;this.chatAgentService=h;this.chatWidgetService=g;this.chatAccessibilityService=f;this.logService=v;this.themeService=b;this.chatSlashCommandService=S;this.telemetryService=w;this.promptsService=k;this.toolsService=T;this.chatModeService=N;this.chatLayoutService=O;this.chatEntitlementService=V;this.chatSessionsService=U;this.agentSessionsService=G;this.chatTodoListService=$;this.lifecycleService=te;this.chatAttachmentResolveService=pe;this.chatTipService=de;this.chatDebugService=se;this._onDidSubmitAgent=this._register(new E);this.onDidSubmitAgent=this._onDidSubmitAgent.event;this._onDidChangeAgent=this._register(new E);this.onDidChangeAgent=this._onDidChangeAgent.event;this._onDidFocus=this._register(new E);this.onDidFocus=this._onDidFocus.event;this._onDidChangeViewModel=this._register(new E);this.onDidChangeViewModel=this._onDidChangeViewModel.event;this._onDidScroll=this._register(new E);this.onDidScroll=this._onDidScroll.event;this._onDidAcceptInput=this._register(new E);this.onDidAcceptInput=this._onDidAcceptInput.event;this._onDidHide=this._register(new E);this.onDidHide=this._onDidHide.event;this._onDidShow=this._register(new E);this.onDidShow=this._onDidShow.event;this._onDidChangeParsedInput=this._register(new E);this.onDidChangeParsedInput=this._onDidChangeParsedInput.event;this._onDidChangeActiveInputEditor=this._register(new E);this.onDidChangeActiveInputEditor=this._onDidChangeActiveInputEditor.event;this._onWillMaybeChangeHeight=this._register(new E);this.onWillMaybeChangeHeight=this._onWillMaybeChangeHeight.event;this._onDidChangeHeight=this._register(new E);this.onDidChangeHeight=this._onDidChangeHeight.event;this._onDidChangeContentHeight=this._register(new E);this.onDidChangeContentHeight=this._onDidChangeContentHeight.event;this._onDidChangeEmptyState=this._register(new E);this.onDidChangeEmptyState=this._onDidChangeEmptyState.event;this.contribs=[];this.visibilityTimeoutDisposable=this._register(new me);this.visibilityAnimationFrameDisposable=this._register(new me);this.inputPartDisposable=this._register(new me);this.inlineInputPartDisposable=this._register(new me);this.recentlyRestoredCheckpoint=!1;this.welcomePart=this._register(new me);this._gettingStartedTipPart=this._register(new me);this.visibleChangeCount=0;this._visible=!1;this._isRenderingWelcome=!1;this._attachmentCapabilities=Lmo;this.viewModelDisposables=this._register(new P);this._editingSession=Le(this,void 0);this._viewModelObs=ui(this,this.onDidChangeViewModel,()=>this.viewModel);this._lockedToCodingAgentContextKey=ie.lockedToCodingAgent.bindTo(this.contextKeyService),this._agentSupportsAttachmentsContextKey=ie.agentSupportsAttachments.bindTo(this.contextKeyService),this._sessionIsEmptyContextKey=ie.chatSessionIsEmpty.bindTo(this.contextKeyService),this._hasPendingRequestsContextKey=ie.hasPendingRequests.bindTo(this.contextKeyService),this._sessionHasDebugDataContextKey=ie.chatSessionHasDebugData.bindTo(this.contextKeyService),this._register(this.chatDebugService.onDidAddEvent(ke=>{let Ee=this.viewModel?.sessionResource;Ee&&ke.sessionResource.toString()===Ee.toString()&&this._sessionHasDebugDataContextKey.set(!0)})),this.viewContext=t??{};let Se=this._viewModelObs;typeof e=="object"?this._location=e:this._location={location:e},ie.inChatSession.bindTo(c).set(!0),ie.location.bindTo(c).set(this._location.location),ie.inQuickChat.bindTo(c).set(aUt(this)),this.agentInInput=ie.inputHasAgent.bindTo(c),this.requestInProgress=ie.requestInProgress.bindTo(c),this._register(this.chatEntitlementService.onDidChangeAnonymous(()=>this.renderWelcomeViewContentIfNeeded())),this._register(this.configurationService.onDidChangeConfiguration(ke=>{if(ke.affectsConfiguration("chat.tips.enabled")){if(this.configurationService.getValue("chat.tips.enabled"))this.updateChatViewVisibility();else if(this.inputPart){this._gettingStartedTipPartRef=void 0,this._gettingStartedTipPart.clear();let Ee=this.inputPart.gettingStartedTipContainerElement;Rt(Ee),mm(!1,Ee)}}})),this._register(tc(kQe,c,ke=>{let Ee=this._editingSession.read(ke);return Ee?Ee.entries.read(ke).filter(Fe=>Fe.state.read(ke)!==0).map(Fe=>Fe.entryId):void 0})),this._register(tc(Zx,c,ke=>(this._editingSession.read(ke)?.entries.read(ke)??[]).filter(Fe=>Fe.state.read(ke)===0).length>0)),this._register(tc(zce,c,ke=>{let Ee=this._editingSession.read(ke);return Ee?Ee.entries.read(ke).length>0:!1})),this._register(tc(T_t,c,ke=>this._editingSession.read(ke)!==null)),this._register(tc(ie.chatEditingCanUndo,c,ke=>this._editingSession.read(ke)?.canUndo.read(ke)||!1)),this._register(tc(ie.chatEditingCanRedo,c,ke=>this._editingSession.read(ke)?.canRedo.read(ke)||!1)),this._register(tc(Yj,c,ke=>{let Ee=Se.read(ke)?.model;if(!this._editingSession.read(ke)||!Ee)return!1;let Ve=ui(this,Ee.onDidChange,()=>Ee.getRequests().at(-1)?.response).read(ke);return Ve?.result?.errorDetails&&!Ve?.result?.errorDetails.responseIsIncomplete})),this._codeBlockModelCollection=this._register(u.createInstance(YF,void 0)),this.chatSuggestNextWidget=this._register(this.instantiationService.createInstance(wAe)),this._register(he(ke=>{let Ee=Se.read(ke),Ve=y.editingSessionsObs.read(ke).find(Qt=>Xe(Qt.chatSessionResource,Ee?.sessionResource));if(this._editingSession.set(void 0,void 0),this.renderChatEditingSessionState(),!Ve)return;let Fe=Ve.entries.read(ke);for(let Qt of Fe)Qt.state.read(ke);this._editingSession.set(Ve,void 0),ke.store.add(Ve.onDidDispose(()=>{this._editingSession.set(void 0,void 0),this.renderChatEditingSessionState()})),ke.store.add(this.inputEditor.onDidChangeModelContent(()=>{this.getInput()===""&&this.refreshParsedInput()})),this.renderChatEditingSessionState()})),this._register(this.codeEditorService.registerCodeEditorOpenHandler(async(ke,Ee,He)=>{let Ve=ke.resource;if(Ve.scheme!==Y.vscodeChatCodeBlock)return null;let Fe=Ve.path.split("/").at(1);if(!Fe)return null;let Qt=this.viewModel?.getItems().find(Ze=>Ze.id===Fe);if(!Qt)return null;this.reveal(Qt),await Pi(0);for(let Ze of this.listWidget.editorsInUse())if(ar.isEqual(Ze.uri,Ve,!0)){let Ti=Ze.editor,ti=0,bo=Ti.getDomNode();if(bo){let Ro=Nh(bo,"monaco-list-row");Ro&&(ti=gN(bo).top-gN(Ro).top)}if(ke.options?.selection){let Ro=Ti.getTopForPosition(ke.options.selection.startLineNumber,ke.options.selection.startColumn);ti+=Ro,Ti.focus(),Ti.setSelection({startLineNumber:ke.options.selection.startLineNumber,startColumn:ke.options.selection.startColumn,endLineNumber:ke.options.selection.endLineNumber??ke.options.selection.startLineNumber,endColumn:ke.options.selection.endColumn??ke.options.selection.startColumn})}return this.reveal(Qt,ti),Ti}return null})),this._register(this.onDidChangeParsedInput(()=>this.updateChatInputContext())),this._register(this.chatTodoListService.onDidUpdateTodos(ke=>{Xe(this.viewModel?.sessionResource,ke)&&this.inputPart.renderChatTodoListWidget(ke)}))}static{this.CONTRIBS=[]}get domNode(){return this.container}get visible(){return this._visible}set viewModel(e){if(this._viewModel===e)return;let t=this._viewModel?.sessionResource;this.viewModelDisposables.clear(),this._viewModel=e,e?(this.viewModelDisposables.add(e),this.logService.debug("ChatWidget#setViewModel: have viewModel"),e.model.requestInProgress.get()&&this.chatAccessibilityService.acceptRequest(e.sessionResource,!0)):this.logService.debug("ChatWidget#setViewModel: no viewModel"),this._onDidChangeViewModel.fire({previousSessionResource:t,currentSessionResource:this._viewModel?.sessionResource})}get viewModel(){return this._viewModel}get parsedInput(){if(this.parsedChatRequest===void 0){if(!this.viewModel)return{text:"",parts:[]};this.parsedChatRequest=this.instantiationService.createInstance(AE).parseChatRequestWithReferences(WO(this),gz(this),this.getInput(),this.location,{selectedAgent:this._lastSelectedAgent,mode:this.input.currentModeKind,attachmentCapabilities:this.attachmentCapabilities,forcedAgent:this._lockedAgent?.id?this.chatAgentService.getAgent(this._lockedAgent.id):void 0}),this._onDidChangeParsedInput.fire()}return this.parsedChatRequest}get scopedContextKeyService(){return this.contextKeyService}get location(){return this._location.location}get supportsChangingModes(){return!!this.viewOptions.supportsChangingModes}get locationData(){return this._location.resolveData?.()}set lastSelectedAgent(e){this.parsedChatRequest=void 0,this._lastSelectedAgent=e,this._updateAgentCapabilitiesContextKeys(e),this._onDidChangeParsedInput.fire()}get lastSelectedAgent(){return this._lastSelectedAgent}_updateAgentCapabilitiesContextKeys(e){let t=e?.capabilities??(this._lockedAgent?this.chatSessionsService.getCapabilitiesForSessionType(this._lockedAgent.id):void 0);this._attachmentCapabilities=t??Lmo;let o=Object.keys(DM(this._attachmentCapabilities,(n,r)=>r===!0)).length>0;this._agentSupportsAttachmentsContextKey.set(o)}get supportsFileReferences(){return!!this.viewOptions.supportsFileReferences}get attachmentCapabilities(){return this._attachmentCapabilities}get input(){return this.viewModel?.editing&&this.configurationService.getValue("chat.editRequests")!=="input"?this.inlineInputPart:this.inputPart}get inputPart(){return this.inputPartDisposable.value}get inlineInputPart(){return this.inlineInputPartDisposable.value}get inputEditor(){return this.input.inputEditor}get contentHeight(){return this.input.height.get()+this.listWidget.contentHeight+this.chatSuggestNextWidget.height}get scrollTop(){return this.listWidget.scrollTop}set scrollTop(e){this.listWidget.scrollTop=e}get attachmentModel(){return this.input.attachmentModel}render(e){let t=XI(this.viewContext)?this.viewContext.viewId:void 0;this.editorOptions=this._register(this.instantiationService.createInstance(AB,t,this.styles.listForeground,this.styles.inputEditorBackground,this.styles.resultEditorBackground));let o=this.viewOptions.renderInputOnTop??!1,n=this.viewOptions.renderFollowups??!o,r=this.viewOptions.renderStyle,s=this.viewOptions.renderInputToolbarBelowInput??!1;this.container=R(e,sUt(".interactive-session")),this.welcomeMessageContainer=R(this.container,sUt(".chat-welcome-view-container",{style:"display: none"})),this._register(Vo(this.welcomeMessageContainer,re.CLICK,()=>this.focusInput())),this._register(this.chatSuggestNextWidget.onDidChangeHeight(()=>{this.bodyDimension&&this.layout(this.bodyDimension.height,this.bodyDimension.width)})),this._register(this.chatSuggestNextWidget.onDidSelectPrompt(({handoff:c,agentId:u})=>{this.handleNextPromptSelection(c,u)})),o?(this.createInput(this.container,{renderFollowups:n,renderStyle:r,renderInputToolbarBelowInput:s}),this.listContainer=R(this.container,sUt(".interactive-list"))):(this.listContainer=R(this.container,sUt(".interactive-list")),R(this.container,this.chatSuggestNextWidget.domNode),this.createInput(this.container,{renderFollowups:n,renderStyle:r,renderInputToolbarBelowInput:s})),this.renderWelcomeViewContentIfNeeded(),this.createList(this.listContainer,{editable:!y7o(this)&&!aUt(this),...this.viewOptions.rendererOptions,renderStyle:r}),this._register(j(e,re.MOUSE_WHEEL,c=>{c.defaultPrevented||gs(c.target,this.container)||this.listWidget.delegateScrollFromMouseWheelEvent(c)})),this._register(he(c=>{let u=this.chatLayoutService.fontFamily.read(c),p=this.chatLayoutService.fontSize.read(c);this.container.style.setProperty("--vscode-chat-font-family",u),this.container.style.fontSize=`${p}px`,this.visible&&this.listWidget.rerender()})),this._register(H.runAndSubscribe(this.editorOptions.onDidChange,()=>this.onDidStyleChange())),this.viewModel&&(this.onDidChangeItems(),this.listWidget.scrollToEnd()),this.contribs=Cw.CONTRIBS.map(c=>{try{return this._register(this.instantiationService.createInstance(c,this))}catch(u){this.logService.error("Failed to instantiate chat widget contrib",In(u));return}}).filter(mo),this._register(this.chatWidgetService.register(this));let l=ui(this.onDidChangeParsedInput,()=>this.parsedInput);this._register(he(c=>{let u=l.read(c),p=new Map,h=new Set;for(let g of this.attachmentModel.attachments)g.range&&h.add(g.id);for(let g of u.parts)if(g instanceof ZS||g instanceof OO||g instanceof tR){let f=g.toVariableEntry();p.set(f.id,f),h.delete(f.id)}this.attachmentModel.updateContext(h,p.values())})),this.focusedInputDOM||(this.focusedInputDOM=this.container.appendChild(_(".focused-input-dom")))}focusInput(){this.input.focus(),this._onDidFocus.fire()}focusTodosView(){return this.input.hasVisibleTodos()?this.input.focusTodoList():!1}toggleTodosViewFocus(){return this.input.hasVisibleTodos()?this.input.isTodoListFocused()?(this.focusInput(),!0):this.input.focusTodoList():!1}focusQuestionCarousel(){return this.input.questionCarousel?this.input.focusQuestionCarousel():!1}toggleQuestionCarouselFocus(){return this.input.questionCarousel?this.input.isQuestionCarouselFocused()?(this.focusInput(),!0):this.input.focusQuestionCarousel():!1}navigateToPreviousQuestion(){return this.input.questionCarousel?this.input.navigateToPreviousQuestion():!1}navigateToNextQuestion(){return this.input.questionCarousel?this.input.navigateToNextQuestion():!1}toggleTipFocus(){return this._gettingStartedTipPartRef?.hasFocus()?(this.focusInput(),!0):this._gettingStartedTipPartRef?(this._gettingStartedTipPartRef.focus(),!0):!1}hasInputFocus(){return this.input.hasFocus()}refreshParsedInput(){if(!this.viewModel)return;let e=this.parsedChatRequest;this.parsedChatRequest=this.instantiationService.createInstance(AE).parseChatRequestWithReferences(WO(this),gz(this),this.getInput(),this.location,{selectedAgent:this._lastSelectedAgent,mode:this.input.currentModeKind,attachmentCapabilities:this.attachmentCapabilities}),(!e||!Ddi.equals(e,this.parsedChatRequest))&&this._onDidChangeParsedInput.fire()}getSibling(e,t){if(!Vi(e))return;let o=this.viewModel?.getItems();if(!o)return;let n=o.filter(l=>Vi(l)),r=n.indexOf(e);if(r===void 0)return;let s=t==="next"?r+1:r-1;if(!(s<0||s>n.length-1))return n[s]}async clear(){this.logService.debug("ChatWidget#clear"),this._dynamicMessageLayoutData&&(this._dynamicMessageLayoutData.enabled=!0),this.viewModel?.editing&&this.finishedEditing(),this.viewModel&&this.viewModel.resetInputPlaceholder(),this._lockedAgent?this.lockToCodingAgent(this._lockedAgent.name,this._lockedAgent.displayName,this._lockedAgent.id):this.unlockFromCodingAgent(),this.inputPart.clearTodoListWidget(this.viewModel?.sessionResource,!0),this.chatSuggestNextWidget.hide(),await this.viewOptions.clear?.()}onDidChangeItems(e){(this._visible||!this.viewModel)&&((this.viewModel?.getItems()??[]).length>0?this.updateChatViewVisibility():this.renderWelcomeViewContentIfNeeded(),this._onWillMaybeChangeHeight.fire(),this.listWidget.setVisibleChangeCount(this.visibleChangeCount),this.listWidget.refresh(),!e&&this._dynamicMessageLayoutData&&this.layoutDynamicChatTreeItemMode(),this.renderFollowups())}updateChatViewVisibility(){if(this.viewModel){let e=this.viewOptions.renderStyle!=="compact"&&this.viewOptions.renderStyle!=="minimal",t=this.viewModel.getItems().length;if(mm(t===0,this.welcomeMessageContainer),mm(t!==0,this.listContainer),e&&this.inputPart){let o=this.inputPart.gettingStartedTipContainerElement;t===0?this.renderGettingStartedTipIfNeeded():(this._gettingStartedTipPartRef=void 0,this._gettingStartedTipPart.clear(),Rt(o),mm(!1,o))}}this.container.classList.toggle("chat-view-getting-started-disabled",this.chatEntitlementService.sentiment.installed),this._onDidChangeEmptyState.fire()}isEmpty(){return(this.viewModel?.getItems().length??0)===0}renderWelcomeViewContentIfNeeded(){if(!this._isRenderingWelcome){this._isRenderingWelcome=!0;try{if(this.viewOptions.renderStyle==="compact"||this.viewOptions.renderStyle==="minimal"||this.lifecycleService.willShutdown)return;if(!(this.viewModel?.getItems().length??0)){let t=this.chatAgentService.getDefaultAgent(this.location,this.input.currentModeKind),o;if(this.chatEntitlementService.anonymous&&!this.chatEntitlementService.sentiment.installed){let r=to.defaultChatAgent.provider;o=new xe(d(7382,null,r.default.name,r.default.name,to.defaultChatAgent.termsStatementUrl,to.defaultChatAgent.privacyStatementUrl),{isTrusted:!0})}else o=t?.metadata.additionalWelcomeMessage;!o&&!this._lockedAgent&&(o=this._getGenerateInstructionsMessage());let n=this.getWelcomeViewContent(o);(!this.welcomePart.value||this.welcomePart.value.needsRerender(n))&&(Rt(this.welcomeMessageContainer),this.welcomePart.value=this.instantiationService.createInstance(Jme,n,{location:this.location,isWidgetAgentWelcomeViewContent:this.input?.currentModeKind==="agent"}),R(this.welcomeMessageContainer,this.welcomePart.value.element))}this.updateChatViewVisibility()}finally{this._isRenderingWelcome=!1}}}renderGettingStartedTipIfNeeded(){if(!this.inputPart)return;let e=this.inputPart.gettingStartedTipContainerElement,t=this.chatTipService.getWelcomeTip(this.contextKeyService);if(!t){this._gettingStartedTipPart.value&&(this._gettingStartedTipPartRef=void 0,this._gettingStartedTipPart.clear(),Rt(e)),mm(!1,e);return}if(this._gettingStartedTipPart.value){mm(!0,e);return}let o=new P,n=this.instantiationService.createInstance(hee),r=o.add(this.instantiationService.createInstance(UAe,t,n));e.appendChild(r.domNode),this._gettingStartedTipPartRef=r,o.add(r.onDidHide(()=>{r.domNode.remove(),this._gettingStartedTipPartRef=void 0,this._gettingStartedTipPart.clear(),mm(!1,e),this.focusInput()})),this._gettingStartedTipPart.value=o,mm(!0,e)}_getGenerateInstructionsMessage(){return this._instructionFilesCheckPromise||(this._instructionFilesCheckPromise=this._checkForAgentInstructionFiles(),this._register(nbe(this._instructionFilesCheckPromise,e=>{this._instructionFilesExist=e,(this.viewModel?.getItems().length??0)===0&&this.renderWelcomeViewContentIfNeeded()}))),this._instructionFilesExist===!0?new xe(""):this._instructionFilesExist===!1?new xe(d(7377,null,`command:${s2}`),{isTrusted:{enabledCommands:[s2]}}):new xe("")}async _checkForAgentInstructionFiles(){try{return(await this.promptsService.listAgentInstructions(ve.None)).length>0}catch(e){return this.logService.warn("[ChatWidget] Error checking for instruction files:",e),!1}}getWelcomeViewContent(e){if(this.isLockedToCodingAgent){let o=this._lockedAgent?this.chatSessionsService.getIconForSessionType(this._lockedAgent.id):void 0,n=this._lockedAgent?this.chatSessionsService.getWelcomeTitleForSessionType(this._lockedAgent.id):void 0,r=this._lockedAgent?this.chatSessionsService.getWelcomeMessageForSessionType(this._lockedAgent.id):void 0,s=r?new xe(r):this._lockedAgent?.prefix==="@copilot "?new xe(d(7379,null,this._lockedAgent.prefix,"https://aka.ms/coding-agent-docs")+Uki,{isTrusted:!0}):new xe(d(7381,null,this._lockedAgent?.prefix)+Uki);return{title:n??d(7378,null,this._lockedAgent?.prefix),message:s,icon:o??M.sendToRemoteAgent,additionalMessage:e,useLargeIcon:!!o}}let t;return this.input.currentModeKind==="ask"?t=d(7375,null):this.input.currentModeKind==="edit"?t=d(7380,null):t=d(7368,null),{title:t,message:new xe(Uki),icon:M.chatSparkle,additionalMessage:e}}async renderChatEditingSessionState(){this.input&&this.input.renderChatEditingSessionState(this._editingSession.get()??null)}async renderFollowups(){let e=this.listWidget.lastItem;e&&Vi(e)&&e.isComplete?this.input.renderFollowups(e.replyFollowups,e):this.input.renderFollowups(void 0,void 0)}renderChatSuggestNextWidget(){if(this.lifecycleService.willShutdown)return;if(this.isLockedToCodingAgent&&!this._attachmentCapabilities.supportsHandOffs){this.chatSuggestNextWidget.hide();return}let e=this.viewModel?.getItems()??[];if(!e.length)return;let t=e[e.length-1];if(!(t&&Vi(t)&&t.isComplete))return;let n=this.input.currentModeObs.get(),r=n?.handOffs?.get();if(n&&r&&r.length>0){let l=this.chatSuggestNextWidget.domNode.style.display==="none";this.chatSuggestNextWidget.render(n),l&&this.telemetryService.publicLog2("chat.handoffWidgetShown",{agent:t3(n),handoffCount:r.length})}else this.chatSuggestNextWidget.hide();this.bodyDimension&&this.layout(this.bodyDimension.height,this.bodyDimension.width)}handleNextPromptSelection(e,t){this.chatSuggestNextWidget.hide();let o=e.prompt,n=this.input.currentModeObs.get(),r=e.agent?this.chatModeService.findModeByName(e.agent):void 0;this.telemetryService.publicLog2("chat.handoffClicked",{fromAgent:t3(n),toAgent:t||(r?t3(r):""),hasPrompt:!!o,autoSend:!!e.send}),t?(this.input.setValue(`@${t} ${o}`,!1),this.input.focus(),this.acceptInput().catch(s=>this.logService.error("Failed to handle handoff continueOn",s))):e.agent&&(this._switchToAgentByName(e.agent),e.model&&this.input.switchModelByQualifiedName([e.model]),this.input.setValue(o,!1),this.input.focus(),e.send&&this.acceptInput())}async handleDelegationExitIfNeeded(e,t){if(this._shouldExitAfterDelegation(e,t)){this.logService.debug(`[Delegation] Will exit after delegation: sourceAgent=${e?.id}, targetAgent=${t?.id}`);try{await this._handleDelegationExit()}catch(o){this.logService.error("[Delegation] Failed to handle delegation exit",o)}}}_shouldExitAfterDelegation(e,t){if(!t)return this.logService.debug("[Delegation] _shouldExitAfterDelegation: false (no targetAgent)"),!1;if(!this.configurationService.getValue("chat.exitAfterDelegation"))return this.logService.debug("[Delegation] _shouldExitAfterDelegation: false (ExitAfterDelegation config disabled)"),!1;if(e&&e.id===t.id)return this.logService.debug("[Delegation] _shouldExitAfterDelegation: false (source and target agents are the same)"),!1;if(!XI(this.viewContext))return this.logService.debug("[Delegation] _shouldExitAfterDelegation: false (not in chat view context)"),!1;let o=this.chatSessionsService.getChatSessionContribution(t.id);return o?o.canDelegate!==!0?(this.logService.debug(`[Delegation] _shouldExitAfterDelegation: false (contribution.canDelegate=${o.canDelegate}, expected true)`),!1):(this.logService.debug("[Delegation] _shouldExitAfterDelegation: true"),!0):(this.logService.debug(`[Delegation] _shouldExitAfterDelegation: false (no contribution found for targetAgent.id=${t.id})`),!1)}async _handleDelegationExit(){let e=this.viewModel;if(!e){this.logService.debug("[Delegation] _handleDelegationExit: no viewModel, returning");return}let t=e.sessionResource;this.logService.debug(`[Delegation] _handleDelegationExit: parentSessionResource=${t.toString()}`);let o=()=>{let r=e.getItems(),s=r[r.length-1];return s&&Vi(s)&&s.model&&s.isComplete&&!s.model.isPendingConfirmation.get()?!!!s.result?.errorDetails:!1};if(o()){this.logService.debug("[Delegation] Response complete, archiving session before clearing"),await this.archiveLocalParentSession(t),await this.clear();return}this.logService.debug("[Delegation] Waiting for response to complete..."),await new Promise(r=>{let s=e.onDidChange(()=>{o()&&(c(),r(!0))}),l=setTimeout(()=>{this.logService.debug("[Delegation] Timeout waiting for response to complete"),c(),r(!1)},3e4),c=()=>{clearTimeout(l),s.dispose()}})?(this.logService.debug("[Delegation] Response completed, archiving session before clearing"),await this.archiveLocalParentSession(t),await this.clear()):this.logService.debug("[Delegation] Not clearing (timeout or error)")}async archiveLocalParentSession(e){if(e.scheme!==Y.vscodeLocalChatSession&&!$p.getValue(this.contextKeyService))return;this.logService.debug(`[Delegation] archiveLocalParentSession: archiving session ${e.toString()}`),await this.chatService.getSession(e)?.editingSession?.accept();let t=this.agentSessionsService.getSession(e);t?(t.setArchived(!0),this.logService.debug("[Delegation] archiveLocalParentSession: session archived successfully")):this.logService.warn(`[Delegation] archiveLocalParentSession: session not found in agentSessionsService for ${e.toString()}`)}setVisible(e){let t=this._visible;this._visible=e,this.visibleChangeCount++,this.listWidget.setVisible(e),this.input.setVisible(e),e?t||(this.visibilityTimeoutDisposable.value=nn(()=>{this._visible&&this.onDidChangeItems(!0)},0),this.visibilityAnimationFrameDisposable.value=$r(Me(this.listContainer),()=>{this._onDidShow.fire()})):t&&this._onDidHide.fire()}createList(e,t){let o=document.createElement("div");o.classList.add("chat-overflow-widget-container","monaco-editor"),e.append(o),this.listWidget=this._register(this.instantiationService.createInstance(ste,e,{rendererOptions:t,renderStyle:this.viewOptions.renderStyle,defaultElementHeight:this.viewOptions.defaultElementHeight??200,overflowWidgetsDomNode:o,styles:{listForeground:this.styles.listForeground,listBackground:this.styles.listBackground},currentChatMode:()=>this.input.currentModeKind,filter:this.viewOptions.filter?{filter:this.viewOptions.filter.bind(this.viewOptions)}:void 0,codeBlockModelCollection:this._codeBlockModelCollection,viewModel:this.viewModel,editorOptions:this.editorOptions,location:this.location,getCurrentLanguageModelId:()=>this.input.currentLanguageModel,getCurrentModeInfo:()=>this.input.currentModeInfo})),this._register(this.listWidget.onDidClickRequest(async n=>{this.clickedRequest(n)})),this._register(this.listWidget.onDidRerender(n=>{Rr(n.currentElement)&&this.configurationService.getValue("chat.editRequests")!=="input"&&(n.rowContainer.contains(this.inputContainer)||n.rowContainer.appendChild(this.inputContainer),this.input.focus())})),this._register(this.listWidget.onDidDispose(()=>{this.focusedInputDOM.appendChild(this.inputContainer),this.input.focus()})),this._register(this.listWidget.onDidFocusOutside(()=>{this.finishedEditing()})),this._register(this.listWidget.onDidClickFollowup(n=>{this.acceptInput(n.message)})),this._register(this.listWidget.onDidChangeContentHeight(()=>{this._onDidChangeContentHeight.fire()})),this._register(this.listWidget.onDidFocus(()=>{this._onDidFocus.fire()})),this._register(this.listWidget.onDidScroll(()=>{this._onDidScroll.fire()}))}startEditing(e){let t=this.listWidget.getTemplateDataForRequestId(e);t&&this.clickedRequest(t)}clickedRequest(e){let t=e.currentElement;if(Rr(t)&&!this.viewModel?.editing){let o=this.viewModel?.model.getRequests();if(!o||!this.viewModel?.sessionResource)return;this.viewModel?.model.checkpoint&&(this.recentlyRestoredCheckpoint=!0),this.viewModel?.model.setCheckpoint(t.id);let n=[],r=new Set,s=h=>{let g=h.range?`${h.id}:${h.range.start}-${h.range.endExclusive}`:h.id;r.has(g)||vTt(h)||(pP(h)||PY(h))&&h.automaticallyAdded||(r.add(g),n.push(h))};for(let h=o.length-1;h>=0;h-=1){let g=o[h];g.id===t.id&&(g.setShouldBeBlocked(!1),g.attachedContext?.forEach(s))}t.variables.forEach(s),this.viewModel?.setEditing(t),e?.contextKeyService&&ie.currentlyEditing.bindTo(e.contextKeyService).set(!0);let l=t.pendingKind===void 0?ie.EditingRequestType.Sent:ie.EditingRequestType.QueueOrSteer,c=this.configurationService.getValue("chat.editRequests")==="input";if(this.inputPart?.setEditing(!!this.viewModel?.editing&&c,l),c)this.inputPart.element.classList.add("editing");else{let h=e.rowContainer;this.inputContainer=_(".chat-edit-input-container"),h.appendChild(this.inputContainer),this.createInput(this.inputContainer),this.input.setChatMode(this.inputPart.currentModeObs.get().id),this.input.setPermissionLevel(this.inputPart.currentModeInfo.permissionLevel??"default"),this.input.setEditing(!0,l),this._onDidChangeActiveInputEditor.fire()}this.inputPart.toggleChatInputOverlay(!c),n.length>0&&this.input.attachmentModel.addContext(...n),this.inputPart.dnd.setDisabledOverlay(!c),this.input.renderAttachedContext(),this.input.setValue(t.messageText,!1);let u=this.getContrib(JS.ID),p=this.input.inputEditor.getModel();if(u&&p){let h=p.getValueLength();for(let g of n)if(g.range){if(g.range.start>=g.range.endExclusive||g.range.start<0||g.range.endExclusive>h)continue;let f=p.getPositionAt(g.range.start),v=p.getPositionAt(g.range.endExclusive);u.addReference({id:g.id,range:new z(f.lineNumber,f.column,v.lineNumber,v.column),data:g.value,fullName:g.fullName,icon:g.icon,modelDescription:g.modelDescription,isFile:g.kind==="file",isDirectory:g.kind==="directory"})}}this.listWidget.suppressAutoScroll=!0,this.onDidChangeItems(),this.input.inputEditor.focus(),this._register(this.inputPart.onDidClickOverlay(()=>{this.viewModel?.editing&&this.configurationService.getValue("chat.editRequests")!=="input"&&this.finishedEditing()})),c||(this._register(this.inlineInputPart.inputEditor.onDidChangeModelContent(()=>{this.listWidget.scrollToCurrentItem(t)})),this._register(this.inlineInputPart.inputEditor.onDidChangeCursorSelection(h=>{this.listWidget.scrollToCurrentItem(t)})))}this.telemetryService.publicLog2("chat.startEditingRequests",{editRequestType:this.configurationService.getValue("chat.editRequests")})}finishedEditing(e){this.listWidget.suppressAutoScroll=!1;let t=this.listWidget.getTemplateDataForRequestId(this.viewModel?.editing?.id);this.recentlyRestoredCheckpoint?this.recentlyRestoredCheckpoint=!1:this.viewModel?.model.setCheckpoint(void 0),this.inputPart.dnd.setDisabledOverlay(!1),t?.contextKeyService&&ie.currentlyEditing.bindTo(t.contextKeyService).set(!1);let o=this.configurationService.getValue("chat.editRequests")==="input";if(!o){this.inputPart.setChatMode(this.input.currentModeObs.get().id),this.inputPart.setPermissionLevel(this.input.currentModeInfo.permissionLevel??"default");let n=this.input.selectedLanguageModel.get();n&&this.inputPart.switchModel(n.metadata),this.inputPart?.toggleChatInputOverlay(!1);try{t?.rowContainer?.contains(this.inputContainer)?t.rowContainer.removeChild(this.inputContainer):this.inputContainer.parentElement&&this.inputContainer.parentElement.removeChild(this.inputContainer)}catch(r){this.logService.error("Error occurred while finishing editing:",r)}this.inputContainer=_(".empty-chat-state"),this.input.dispose()}o&&this.inputPart.element.classList.remove("editing"),this.viewModel?.setEditing(void 0),this.inputPart?.setEditing(!1,void 0),o||this._onDidChangeActiveInputEditor.fire(),this.onDidChangeItems(),this.telemetryService.publicLog2("chat.editRequestsFinished",{editRequestType:this.configurationService.getValue("chat.editRequests"),editCanceled:!e}),this.inputPart.focus()}getWidgetViewKindTag(){return this.viewContext?XI(this.viewContext)?"view":"quick":"editor"}createInput(e,t){let o={renderFollowups:t?.renderFollowups??!0,renderStyle:t?.renderStyle==="minimal"?"compact":t?.renderStyle,renderInputToolbarBelowInput:t?.renderInputToolbarBelowInput??!1,menus:{executeToolbar:D.ChatExecute,telemetrySource:"chatWidget",...this.viewOptions.menus},editorOverflowWidgetsDomNode:this.viewOptions.editorOverflowWidgetsDomNode,enableImplicitContext:this.viewOptions.enableImplicitContext,renderWorkingSet:this.viewOptions.enableWorkingSet==="explicit",supportsChangingModes:this.viewOptions.supportsChangingModes,dndContainer:this.viewOptions.dndContainer,inputEditorMinLines:this.viewOptions.inputEditorMinLines,widgetViewKindTag:this.getWidgetViewKindTag(),defaultMode:this.viewOptions.defaultMode,sessionTypePickerDelegate:this.viewOptions.sessionTypePickerDelegate,workspacePickerDelegate:this.viewOptions.workspacePickerDelegate,isSessionsWindow:this.viewOptions.isSessionsWindow};if(this.viewModel?.editing){let s=this.listWidget.getTemplateDataForRequestId(this.viewModel?.editing?.id),l=this._register(this.instantiationService.createChild(new Io([X,s?.contextKeyService])));this.inlineInputPartDisposable.value=l.createInstance(F3,this.location,o,this.styles,!0)}else this.inputPartDisposable.value=this.instantiationService.createInstance(F3,this.location,o,this.styles,!1),this._register(he(s=>{this.inputPart.height.read(s),this.listWidget&&(this.bodyDimension&&this.layout(this.bodyDimension.height,this.bodyDimension.width),this._onDidChangeContentHeight.fire())}));this.input.render(e,"",this),this.bodyDimension?.width&&this.input.layout(this.bodyDimension.width),this._register(this.input.onDidLoadInputState(()=>{this.refreshParsedInput()})),this._register(this.input.onDidFocus(()=>this._onDidFocus.fire())),this._register(this.input.onDidAcceptFollowup(s=>{if(!this.viewModel)return;let l="";if(s.followup.agentId&&s.followup.agentId!==this.chatAgentService.getDefaultAgent(this.location,this.input.currentModeKind)?.id){let c=this.chatAgentService.getAgent(s.followup.agentId);if(!c)return;this.lastSelectedAgent=c,l=`${vg}${c.name} `,s.followup.subCommand&&(l+=`${yu}${s.followup.subCommand} `)}else!s.followup.agentId&&s.followup.subCommand&&this.chatSlashCommandService.hasCommand(s.followup.subCommand)&&(l=`${yu}${s.followup.subCommand} `);l+=s.followup.message,this.acceptInput(l),s.response&&this.chatService.notifyUserAction({sessionResource:this.viewModel.sessionResource,requestId:s.response.requestId,agentId:s.response.agent?.id,command:s.response.slashCommand?.name,result:s.response.result,action:{kind:"followUp",followup:s.followup}})})),this._register(this.inputEditor.onDidChangeModelContent(()=>{this.parsedChatRequest=void 0,this.updateChatInputContext()})),this._register(this.chatAgentService.onDidChangeAgents(()=>{this.parsedChatRequest=void 0,this.renderWelcomeViewContentIfNeeded()})),this._register(this.input.onDidChangeCurrentChatMode(()=>{this.renderWelcomeViewContentIfNeeded(),this.refreshParsedInput(),this.renderFollowups(),this.renderChatSuggestNextWidget()}));let n=new Set([ie.foregroundSessionCount.key]);this._register(this.contextKeyService.onDidChangeContext(s=>{s.affectsSome(n)&&this.isEmpty()&&this.renderGettingStartedTipIfNeeded()}));let r;this._register(he(s=>{let l=this.inputPart.selectedLanguageModel.read(s)?.identifier;if(r===void 0){r=l;return}r!==l&&(r=l,this._gettingStartedTipPartRef&&this.chatTipService.getWelcomeTip(this.contextKeyService))})),this._register(he(s=>{let l=new Set,c=new Set;for(let[p,h]of this.input.selectedToolsModel.entriesMap.read(s))h&&(Km(p)?l.add(p.id):c.add(p.id));let u=this.input.attachmentModel.attachments.filter(p=>p.kind==="tool"&&!c.has(p.id)||p.kind==="toolset"&&!l.has(p.id)).map(p=>p.id);this.input.attachmentModel.updateContext(u,ht.empty()),this.refreshParsedInput()}))}onDidStyleChange(){this.container.style.setProperty("--vscode-interactive-result-editor-background-color",this.editorOptions.configuration.resultEditor.backgroundColor?.toString()??""),this.container.style.setProperty("--vscode-interactive-session-foreground",this.editorOptions.configuration.foreground?.toString()??""),this.container.style.setProperty("--vscode-chat-list-background",this.themeService.getColorTheme().getColor(this.styles.listBackground)?.toString()??"")}setModel(e){if(!this.container)throw new Error("Call render() before setModel()");if(!e){this.viewModel?.editing&&this.finishedEditing(),this.viewModel=void 0,this.onDidChangeItems(),this._hasPendingRequestsContextKey.set(!1);return}if(Xe(e.sessionResource,this.viewModel?.sessionResource))return;this.viewModel?.editing&&this.finishedEditing(),this.inputPart.clearTodoListWidget(e.sessionResource,!1),this.chatSuggestNextWidget.hide(),this.chatTipService.resetSession(),this._gettingStartedTipPartRef=void 0,this._gettingStartedTipPart.clear();let t=this.inputPart.gettingStartedTipContainerElement;if(Rt(t),mm(!1,t),this._codeBlockModelCollection.clear(),this.inputPart.setInputModel(e.inputModel,e.getRequests().length===0),this.viewModel=this.instantiationService.createInstance(see,e,this._codeBlockModelCollection,void 0),this.listWidget.setViewModel(this.viewModel),this._lockedAgent){let l=this.chatSessionsService.getInputPlaceholderForSessionType(this._lockedAgent.id);l||(l=d(7369,null,this._lockedAgent.id)),this.viewModel.setInputPlaceholder(l),this.inputEditor.updateOptions({placeholder:l})}else this.viewModel.inputPlaceholder&&this.inputEditor.updateOptions({placeholder:this.viewModel.inputPlaceholder});let n=this.configurationService.getValue("chat.experimental.renderMarkdownImmediately")?QD:0;this.viewModelDisposables.add(H.runAndSubscribe(H.accumulate(this.viewModel.onDidChange,n),(l=>{!this.viewModel||this._store.isDisposed||(this.requestInProgress.set(this.viewModel.model.requestInProgress.get()),l?.some(c=>c?.kind==="changePlaceholder")&&this.inputEditor.updateOptions({placeholder:this.viewModel.inputPlaceholder}),this.onDidChangeItems(),l?.some(c=>c?.kind==="addRequest")&&this.visible&&this.listWidget.scrollToEnd())}))),this.viewModelDisposables.add(this.viewModel.onDidDisposeModel(()=>{this.viewModel?.editing&&this.finishedEditing(),this.viewModel=void 0,this.onDidChangeItems()})),this._sessionIsEmptyContextKey.set(e.getRequests().length===0),this._sessionHasDebugDataContextKey.set(this.chatDebugService.getEvents(e.sessionResource).length>0);let r=0,s=l=>{let c=e.getPendingRequests(),u=c.length;this._hasPendingRequestsContextKey.set(u>0);let p=c.filter(h=>h.kind==="steering").length;l&&p>0&&r===0&&Or(d(7374,null)),r=p};s(!1),this.viewModelDisposables.add(e.onDidChangePendingRequests(()=>s(!0))),this.refreshParsedInput(),this.viewModelDisposables.add(e.onDidChange(l=>{l.kind==="setAgent"&&(this._onDidChangeAgent.fire({agent:l.agent,slashCommand:l.command}),this._updateAgentCapabilitiesContextKeys(l.agent)),l.kind==="addRequest"&&(this.inputPart.clearTodoListWidget(this.viewModel?.sessionResource,!1),this._sessionIsEmptyContextKey.set(!1)),l.kind==="removeRequest"&&(this.inputPart.clearTodoListWidget(this.viewModel?.sessionResource,!0),this.chatSuggestNextWidget.hide(),this._sessionIsEmptyContextKey.set((this.viewModel?.model.getRequests().length??0)===0)),l.kind==="completedRequest"&&((this.viewModel?.model.getRequests().at(-1)?.response?.isCanceled??!1)&&this.inputPart.clearTodoListWidget(this.viewModel?.sessionResource,!0),this.renderChatSuggestNextWidget(),this.visible&&this.viewModel?.sessionResource&&this.agentSessionsService.getSession(this.viewModel.sessionResource)?.setRead(!0))})),this.listWidget&&this.visible&&(this.onDidChangeItems(),this.listWidget.scrollToEnd()),this.updateChatInputContext(),this.input.renderChatTodoListWidget(this.viewModel.sessionResource)}getFocus(){return this.listWidget.getFocus()[0]??void 0}reveal(e,t){this.listWidget.reveal(e,t)}focus(e){this.listWidget.hasElement(e)&&this.listWidget.focusItem(e)}setInputPlaceholder(e){this.viewModel?.setInputPlaceholder(e)}resetInputPlaceholder(){this.viewModel?.resetInputPlaceholder()}setInput(e=""){this.input.setValue(e,!1),this.refreshParsedInput()}getInput(){return this.input.inputEditor.getValue()}getContrib(e){return this.contribs.find(t=>t.id===e)}lockToCodingAgent(e,t,o){this._lockedAgent={id:o,name:e,prefix:`@${e} `,displayName:t},this._lockedToCodingAgentContextKey.set(!0),this.renderWelcomeViewContentIfNeeded();let n=this.chatAgentService.getAgent(o);this._updateAgentCapabilitiesContextKeys(n),this.listWidget?.updateRendererOptions({restorable:!1,editable:!1,noFooter:!0,progressMessageAtBottomOfResponse:!0}),this.visible&&this.listWidget?.rerender()}unlockFromCodingAgent(){this._lockedAgent=void 0,this._lockedToCodingAgentContextKey.set(!1),this._updateAgentCapabilitiesContextKeys(void 0),this.renderWelcomeViewContentIfNeeded(),this.viewModel&&this.viewModel.resetInputPlaceholder(),this.inputEditor?.updateOptions({placeholder:void 0}),this.listWidget?.updateRendererOptions({restorable:!0,editable:!0,noFooter:!1,progressMessageAtBottomOfResponse:e=>e!=="ask"}),this.visible&&this.listWidget?.rerender()}get isLockedToCodingAgent(){return!!this._lockedAgent}get lockedAgentId(){return this._lockedAgent?.id}logInputHistory(){this.input.logInputHistory()}async acceptInput(e,t){return this._acceptInput(e?{query:e}:void 0,t)}async rerunLastRequest(){if(!this.viewModel)return;let e=this.viewModel.sessionResource,t=this.chatService.getSession(e)?.getRequests().at(-1);if(!t)return;let o={attempt:t.attempt+1,location:this.location,userSelectedModelId:this.input.currentLanguageModel,modeInfo:this.input.currentModeInfo};return await this.chatService.resendRequest(t,o)}async _applyPromptFileIfSet(e){let t=this.parsedInput.parts.find(p=>p instanceof Qx);if(!t)return;this.chatTipService.recordSlashCommandUsage(t.name);let o=await this.promptsService.resolvePromptSlashCommand(t.name,ve.None);if(!o)return;let n=o.parsedPromptFile,r=n.body?.variableReferences.map(({name:p,offset:h})=>({name:p,range:new di(h,h+p.length+1)}))??[],s=this.toolsService.toToolReferences(r);e.attachedContext.insertFirst(mP(n.uri,"vscode.prompt.file",void 0,!0,s)),e.input=this.parsedInput.parts.filter(p=>!(p instanceof Qx)).map(p=>p.text).join("").trim();let l=o.promptPath,c={storage:l.storage};l.storage==="extension"?(c.extensionId=l.extension.identifier.value,c.promptName=o.name):c.promptNameHash=Ir(o.name).toString(16),this.telemetryService.publicLog2("chat.promptRun",c);let u=e.input.trim();e.input=`Follow instructions in [${Ye(n.uri)}](${n.uri.toString()}).`,u&&(e.input+=`
${u}`),n.header&&await this._applyPromptMetadata(n.header,e)}async _acceptInput(e,t={}){if(!e&&this.input.generating){let v=Date.now();if(await this.input.generating,Date.now()-v>500)return}for(;!this._viewModel&&!this._store.isDisposed;)await H.toPromise(this.onDidChangeViewModel,this._store);if(!this.viewModel)return;if(this.viewOptions.submitHandler){let f=e?e.query:this.getInput();if(await this.viewOptions.submitHandler(f,this.input.currentModeKind))return}this._onDidAcceptInput.fire(),this.listWidget.setScrollLock(this.isLockedToCodingAgent||!!ZX(this.input.currentModeKind,this.viewOptions.autoScroll));let o=this.getInput(),n={input:e?e.query:o,attachedContext:t?.enableImplicitContext===!1?this.input.getAttachedContext():this.input.getAttachedAndImplicitContext()},r=!e,s=this.viewModel?.editing;if(s){let f=this.viewModel.editing.pendingKind;if(f!==void 0){let v=this.viewModel.editing.id;this.chatService.removePendingRequest(this.viewModel.sessionResource,v),t.queue??=f}else this.chatService.cancelCurrentRequestForSession(this.viewModel.sessionResource,"acceptInput-editing"),t.queue=void 0;this.finishedEditing(!0),this.viewModel.model?.setCheckpoint(void 0)}let l=this.viewModel.model,c=l.requestInProgress.get();if(t.alwaysQueue&&(t.queue??="queued"),l.requestNeedsInput.get()&&!l.getPendingRequests().length&&(this.chatService.cancelCurrentRequestForSession(this.viewModel.sessionResource,"acceptInput-needsInput"),t.queue??="queued"),c&&(t.queue??="queued"),!t.alwaysQueue&&!c&&!s&&!await this.confirmPendingRequestsBeforeSend(l,t))return;if(await this._applyPromptFileIfSet(n),await this._autoAttachInstructions(n),this.viewOptions.enableWorkingSet!==void 0&&this.input.currentModeKind==="edit"){let f=new Mn,v=n.attachedContext,b=this.viewModel.model.getRequests();for(let S of b)for(let y of S.variableData.variables)if(A.isUri(y.value)&&y.kind==="file"){let w=y.value;f.has(w)||(v.add(y),f.add(y.value))}n.attachedContext=v,this.telemetryService.publicLog2("chatEditing/workingSetSize",{originalSize:f.size,actualSize:f.size})}if(this.input.validateAgentMode(),this.viewModel.model.checkpoint){let f=this.viewModel.model.getRequests();for(let v=f.length-1;v>=0;v-=1){let b=f[v];b.shouldBeBlocked&&this.chatService.removeRequest(this.viewModel.sessionResource,b.id)}}let u=await this._resolveDirectoryImageAttachments(n.attachedContext.asArray()),p=this.viewModel.sessionResource,h=await this.chatService.sendRequest(this.viewModel.sessionResource,n.input,{userSelectedModelId:this.input.currentLanguageModel,location:this.location,locationData:this._location.resolveData?.(),parserContext:{selectedAgent:this._lastSelectedAgent,mode:this.input.currentModeKind,attachmentCapabilities:this._lastSelectedAgent?.capabilities??this.attachmentCapabilities},attachedContext:n.attachedContext.asArray(),resolvedVariables:u,noCommandDetection:t?.noCommandDetection,...this.getModeRequestOptions(),modeInfo:this.input.currentModeInfo,agentIdSilent:this._lockedAgent?.id,queue:t?.queue,pauseQueue:t?.alwaysQueue});if(Gj.isRejected(h))return;this.updateChatViewVisibility(),this.input.acceptInput(t?.storeToHistory??r);let g=Gj.isQueued(h)?await h.deferred:h;if(Gj.isSent(g))return this._onDidSubmitAgent.fire({agent:g.data.agent,slashCommand:g.data.slashCommand}),this.handleDelegationExitIfNeeded(this._lockedAgent,g.data.agent),g.data.responseCreatedPromise.then(()=>{this.chatAccessibilityService.acceptRequest(p),g.data.responseCompletePromise.then(()=>{let f=this.viewModel?.getItems().filter(Vi),v=f?.[f.length-1];if(this.chatAccessibilityService.acceptResponse(this,this.container,v,p,t?.isVoiceInput),v?.result?.nextQuestion){let{prompt:b,participant:S,command:y}=v.result.nextQuestion,w=ETt(this.chatAgentService,this.location,b,S,y);w&&this.input.setValue(w,!1)}})}),g.data.responseCreatedPromise}async _resolveDirectoryImageAttachments(e){let t=[];for(let n of e)n.kind==="directory"&&A.isUri(n.value)&&t.push(this.chatAttachmentResolveService.resolveDirectoryImages(n.value));return t.length===0?[]:(await Promise.all(t)).flat()}async confirmPendingRequestsBeforeSend(e,t){if(t.queue||!(e.getPendingRequests().length>0))return!0;let n=await this.dialogService.prompt({type:"question",message:d(7372,null),detail:d(7370,null),buttons:[{label:d(7371,null),run:()=>"keep"},{label:d(7373,null),run:()=>"remove"}],cancelButton:!0});if(!n.result)return!1;if(n.result==="remove")for(let r of[...e.getPendingRequests()])this.chatService.removePendingRequest(e.sessionResource,r.request.id);return!0}getModeRequestOptions(){let e=this.viewModel?.sessionResource,t=this.input.selectedToolsModel.userSelectedTools,o=t.get(),n=Ce(r=>{let s=this._viewModelObs.read(r)?.sessionResource;if(Xe(s,e)){let l=t.read(r);return o=l,l}return o});return{modeInfo:this.input.currentModeInfo,userSelectedTools:n}}getCodeBlockInfosForResponse(e){return this.listWidget.getCodeBlockInfosForResponse(e)}getCodeBlockInfoForEditor(e){return this.listWidget.getCodeBlockInfoForEditor(e)}getFileTreeInfosForResponse(e){return this.listWidget.getFileTreeInfosForResponse(e)}getLastFocusedFileTreeForResponse(e){return this.listWidget.getLastFocusedFileTreeForResponse(e)}focusResponseItem(e){this.listWidget.focusLastItem(e)}layout(e,t){t=Math.min(t,this.viewOptions.renderStyle==="minimal"?t:950),this.bodyDimension=new ai(t,e),this.viewModel?.editing&&this.inlineInputPart?.layout(t),this.inputPart.layout(t);let o=this.inputPart.height.get(),n=this.chatSuggestNextWidget.height,r=this.listWidget.isScrolledToBottom,s=this.listWidget.lastItem,l=Math.max(0,e-o-n);this.listWidget.layout(l,t),this.welcomeMessageContainer.style.height=`${l}px`;let c=Vi(s)&&s.renderData;r&&(!c||ZX(this.input.currentModeKind,this.viewOptions.autoScroll))&&this.listWidget.scrollToEnd(),this.listContainer.style.height=`${l}px`,this._onDidChangeHeight.fire(e)}setDynamicChatTreeItemLayout(e,t){this._dynamicMessageLayoutData={numOfMessages:e,maxHeight:t,enabled:!0},this._register(this.listWidget.onDidChangeItemHeight(()=>this.layoutDynamicChatTreeItemMode()));let o=this._register(new me);this._register(this.listWidget.onDidScroll(n=>{this._dynamicMessageLayoutData?.enabled&&(o.value=$r(Me(this.listContainer),()=>{if(!n.scrollTopChanged||n.heightChanged||n.scrollHeightChanged)return;let r=n.height,s=n.scrollHeight-r-n.scrollTop;if(s===0)return;let l=this._dynamicMessageLayoutData?.maxHeight??t,c=this.bodyDimension?.width??this.container.offsetWidth;this.input.layout(c);let u=this.input.height.get(),p=this.chatSuggestNextWidget.height,h=Math.min(r+s,l-u-p);this.layout(h+u+p,c)}))}))}updateDynamicChatTreeItemLayout(e,t){this._dynamicMessageLayoutData={numOfMessages:e,maxHeight:t,enabled:!0};let o=!1,n=this.bodyDimension.height,r=this.bodyDimension.width;t<this.bodyDimension.height&&(n=t,o=!0);let s=this.container.offsetWidth;this.bodyDimension?.width!==s&&(r=s,o=!0),o&&this.layout(n,r)}get isDynamicChatTreeItemLayoutEnabled(){return this._dynamicMessageLayoutData?.enabled??!1}set isDynamicChatTreeItemLayoutEnabled(e){this._dynamicMessageLayoutData&&(this._dynamicMessageLayoutData.enabled=e)}layoutDynamicChatTreeItemMode(){if(!this.viewModel||!this._dynamicMessageLayoutData?.enabled)return;let e=this.bodyDimension?.width??this.container.offsetWidth;this.input.layout(e);let t=this.input.height.get(),o=this.chatSuggestNextWidget.height,n=this.viewModel.getItems(),r=n.slice(-this._dynamicMessageLayoutData.numOfMessages),s=r.some(c=>c.currentRenderedHeight===void 0),l=s?this._dynamicMessageLayoutData.maxHeight:r.reduce((c,u)=>c+u.currentRenderedHeight,0);this.layout(Math.min(t+o+l+(n.length>2?18:0),this._dynamicMessageLayoutData.maxHeight),e),(s||!l)&&this.listWidget.scrollToEnd()}saveState(){}getViewState(){return this.input.getCurrentInputState()}updateChatInputContext(){let e=this.parsedInput.parts.find(t=>t instanceof zu);this.agentInInput.set(!!e)}async _switchToAgentByName(e){let t=this.input.currentModeObs.get();if(e!==t.name.get()){let o=this.chatModeService.findModeByName(e);if(o){if(t.kind!==o.kind){let n=await this.instantiationService.invokeFunction(get,t.kind,o.kind,this.viewModel?.model.getRequests().length??0,this.viewModel?.model);if(!n)return;n.needToClearSession&&await this.clear()}this.input.setChatMode(o.id)}}}async _applyPromptMetadata({agent:e,tools:t,model:o},n){if(t!==void 0&&!e&&this.input.currentModeKind!=="agent"&&(e=Pl.Agent.name.get()),e&&this._switchToAgentByName(e),t!==void 0&&this.input.currentModeKind==="agent"){let r=this.toolsService.toToolAndToolSetEnablementMap(t,this.input.selectedLanguageModel.get()?.metadata);this.input.selectedToolsModel.set(r,!0)}o!==void 0&&this.input.switchModelByQualifiedName(o)}async _autoAttachInstructions({attachedContext:e}){this.logService.debug("ChatWidget#_autoAttachInstructions: prompt files are always enabled");let t=this.input.currentModeKind==="agent"?this.input.selectedToolsModel.userSelectedTools.get():void 0,o=this.input.currentModeKind==="agent"?this.input.currentModeObs.get().agents?.get():void 0,n=this._viewModel?.model.sessionResource;await this.instantiationService.createInstance(nte,this.input.currentModeKind,t,o,n).collect(e,ve.None)}delegateScrollFromMouseWheelEvent(e){this.listWidget.delegateScrollFromMouseWheelEvent(e)}};Cw=I([m(4,Kt),m(5,B),m(6,ct),m(7,X),m(8,F),m(9,Si),m(10,br),m(11,At),m(12,NO),m(13,ne),m(14,De),m(15,FO),m(16,dl),m(17,Te),m(18,nr),m(19,jn),m(20,Pv),m(21,XHt),m(22,vr),m(23,Ls),m(24,ia),m(25,dF),m(26,ao),m(27,jF),m(28,l0),m(29,em)],Cw);var the=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g){this._options=e;this._instantiationService=t;this._contextKeyService=o;this._keybindingService=n;this._accessibilityService=r;this._configurationService=s;this._accessibleViewService=l;this._textModelResolverService=c;this._chatService=u;this._hoverService=p;this._chatEntitlementService=h;this._markdownRendererService=g;this._elements=bt("div.inline-chat@root",[bt("div.chat-widget@chatWidget"),bt("div.accessibleViewer@accessibleViewer"),bt("div.status@status",[bt("div.label.info.hidden@infoLabel"),bt("div.actions.hidden@toolbar1"),bt("div.label.status.hidden@statusLabel"),bt("div.actions.secondary.hidden@toolbar2"),bt("div.label.disclaimer.hidden@disclaimerLabel")])]);this._store=new P;this._onDidChangeHeight=this._store.add(new E);this.onDidChangeHeight=H.filter(this._onDidChangeHeight.event,i=>!this._isLayouting);this._requestInProgress=Le(this,!1);this.requestInProgress=this._requestInProgress;this._isLayouting=!1;this.scopedContextKeyService=this._store.add(o.createScoped(this._elements.chatWidget));let f=t.createChild(new Io([X,this.scopedContextKeyService]),this._store);this._chatWidget=f.createInstance(Cw,i,{isInlineChat:!0},{autoScroll:!0,defaultElementHeight:32,renderStyle:"minimal",renderInputOnTop:!1,renderFollowups:!0,supportsFileReferences:!0,filter:G=>!Vi(G)||G.errorDetails?!0:!(G.response.value.length===0||G.response.value.every(te=>te.kind==="textEditGroup"&&e.chatWidgetViewOptions?.rendererOptions?.renderTextEditsAsSummary?.(te.uri))),dndContainer:this._elements.root,defaultMode:Pl.Ask,...e.chatWidgetViewOptions},{listForeground:qco,listBackground:Hwi,overlayBackground:_E,inputEditorBackground:Gb,resultEditorBackground:qo}),this._elements.root.classList.toggle("in-zone-widget",!!e.inZoneWidget),this._chatWidget.render(this._elements.chatWidget),this._elements.chatWidget.style.setProperty(TN(Quo),wt(Hwi)),this._chatWidget.setVisible(!0),this._store.add(this._chatWidget);let v=ie.isResponse.bindTo(this.scopedContextKeyService),b=ie.responseVote.bindTo(this.scopedContextKeyService),S=ie.responseSupportsIssueReporting.bindTo(this.scopedContextKeyService),y=ie.responseHasError.bindTo(this.scopedContextKeyService),w=ie.responseIsFiltered.bindTo(this.scopedContextKeyService),k=this._store.add(new P);this._store.add(this._chatWidget.onDidChangeViewModel(()=>{k.clear();let G=this._chatWidget.viewModel;G&&(k.add(Z(()=>{U.context=void 0,v.reset(),b.reset(),y.reset(),w.reset(),S.reset()})),k.add(G.onDidChange(()=>{this._requestInProgress.set(G.model.requestInProgress.get(),void 0);let $=G.getItems().at(-1);U.context=$,v.set(Vi($)),b.set(Vi($)?$.vote===0?"down":$.vote===1?"up":"":""),y.set(Vi($)&&$.errorDetails!==void 0),w.set(!!(Vi($)&&$.errorDetails?.responseIsFiltered)),S.set(Vi($)&&($.agent?.metadata.supportIssueReporting??!1)),this._onDidChangeHeight.fire()})),this._onDidChangeHeight.fire())})),this._store.add(this.chatWidget.onDidChangeContentHeight(()=>{this._onDidChangeHeight.fire()})),this._ctxResponseFocused=Wco.bindTo(this._contextKeyService);let T=this._store.add(Vn(this.domNode));this._store.add(T.onDidBlur(()=>this._ctxResponseFocused.set(!1))),this._store.add(T.onDidFocus(()=>this._ctxResponseFocused.set(!0))),this._ctxInputEditorFocused=Y4.bindTo(o),this._store.add(this._chatWidget.inputEditor.onDidFocusEditorWidget(()=>this._ctxInputEditorFocused.set(!0))),this._store.add(this._chatWidget.inputEditor.onDidBlurEditorWidget(()=>this._ctxInputEditorFocused.set(!1)));let N=e.statusMenuId instanceof D?e.statusMenuId:e.statusMenuId.menu,O=e.statusMenuId instanceof D?void 0:e.statusMenuId.options,V=f.createInstance(QF,this._elements.toolbar1,N,{toolbarOptions:{primaryGroup:"0_main"},telemetrySource:e.chatWidgetViewOptions?.menus?.telemetrySource,menuOptions:{renderShortTitle:!0},...O});this._store.add(V.onDidChange(()=>this._onDidChangeHeight.fire())),this._store.add(V);let U=f.createInstance(Ln,this._elements.toolbar2,e.secondaryMenuId??D.for(""),{telemetrySource:e.chatWidgetViewOptions?.menus?.telemetrySource,menuOptions:{renderShortTitle:!0,shouldForwardArgs:!0},actionViewItemProvider:(G,$)=>G instanceof Eo&&G.item.id===mee?f.createInstance(jme,G,$):Ca(f,G,$)});this._store.add(U.onDidChangeMenuItems(()=>this._onDidChangeHeight.fire())),this._store.add(U),this._store.add(this._configurationService.onDidChangeConfiguration(G=>{G.affectsConfiguration("accessibility.verbosity.inlineChat")&&this._updateAriaLabel()})),this._elements.root.tabIndex=0,this._elements.statusLabel.tabIndex=0,this._updateAriaLabel(),this._setupDisclaimer(),this._store.add(this._hoverService.setupManagedHover(Ni("element"),this._elements.statusLabel,()=>this._elements.statusLabel.dataset.title)),this._store.add(this._chatService.onDidPerformUserAction(G=>{Xe(G.sessionResource,this._chatWidget.viewModel?.model.sessionResource)&&G.action.kind==="vote"&&this.updateStatus(d(10610,null),{resetAfter:1250})}))}_updateAriaLabel(){if(this._elements.root.ariaLabel=this._accessibleViewService.getOpenAriaHint("accessibility.verbosity.inlineChat"),this._accessibilityService.isScreenReaderOptimized()){let i=w7o;if(this._configurationService.getValue("accessibility.verbosity.inlineChat")){let e=this._keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getLabel();i=e?d(10611,null,e):d(10612,null)}this._chatWidget.inputEditor.updateOptions({ariaLabel:i})}}_setupDisclaimer(){let i=this._store.add(new P);this._store.add(he(e=>{i.clear(),Fi(this._elements.disclaimerLabel);let t=this._chatEntitlementService.sentimentObs.read(e),o=this._chatEntitlementService.anonymousObs.read(e),n=this._chatService.requestInProgressObs.read(e),r=!t.installed&&o&&!n;if(this._elements.disclaimerLabel.classList.toggle("hidden",!r),r){let s=i.add(this._markdownRendererService.render(new xe(d(10613,null,to.defaultChatAgent?.provider?.default?.name??"",to.defaultChatAgent?.provider?.default?.name??"",to.defaultChatAgent?.termsStatementUrl??"",to.defaultChatAgent?.privacyStatementUrl??""),{isTrusted:!0})));this._elements.disclaimerLabel.appendChild(s.element)}this._onDidChangeHeight.fire()}))}dispose(){this._store.dispose()}get domNode(){return this._elements.root}get chatWidget(){return this._chatWidget}saveState(){this._chatWidget.saveState()}layout(i){let e=this.contentHeight;this._isLayouting=!0;try{this._doLayout(i)}finally{this._isLayouting=!1,this.contentHeight!==e&&this._onDidChangeHeight.fire()}}_doLayout(i){let e=this._getExtraHeight(),t=nh(this._elements.status);this._elements.root.style.height=`${i.height-e}px`,this._elements.root.style.width=`${i.width}px`,this._chatWidget.layout(i.height-t-e,i.width)}get contentHeight(){let i={chatWidgetContentHeight:this._chatWidget.contentHeight,statusHeight:nh(this._elements.status),extraHeight:this._getExtraHeight()};return i.chatWidgetContentHeight+i.statusHeight+i.extraHeight}get minHeight(){let i=100;for(let t of this._chatWidget.viewModel?.getItems()??[])if(Vi(t)&&t.response.value.some(o=>o.kind==="textEditGroup"&&!o.state?.applied)){i=270;break}let e=this.contentHeight;return e-=this._chatWidget.contentHeight,e+=Math.min(this._chatWidget.input.height.get()+i,this._chatWidget.contentHeight),e}_getExtraHeight(){return this._options.inZoneWidget?1:6}get value(){return this._chatWidget.getInput()}set value(i){this._chatWidget.setInput(i)}selectAll(){this._chatWidget.inputEditor.setSelection(new Yt(1,1,Number.MAX_SAFE_INTEGER,1))}set placeholder(i){this._chatWidget.setInputPlaceholder(i)}toggleStatus(i){this._elements.toolbar1.classList.toggle("hidden",!i),this._elements.toolbar2.classList.toggle("hidden",!i),this._elements.status.classList.toggle("hidden",!i),this._elements.infoLabel.classList.toggle("hidden",!i),this._onDidChangeHeight.fire()}updateToolbar(i){this._elements.root.classList.toggle("toolbar",i),this._elements.toolbar1.classList.toggle("hidden",!i),this._elements.toolbar2.classList.toggle("hidden",!i),this._elements.status.classList.toggle("actions",i),this._elements.infoLabel.classList.toggle("hidden",i),this._onDidChangeHeight.fire()}async getCodeBlockInfo(i){let{viewModel:e}=this._chatWidget;if(!e)return;let o=e.getItems().filter(u=>Vi(u)).at(-1);if(!o)return;let n=e.codeBlockModelCollection.get(e.sessionResource,o,i);if(n)return n.model;let r=o.response.getMarkdown(),s=0,l;return S5i(q9(r),u=>{u.type==="code"&&(s===i&&(l={text:u.text,lang:u.lang||""}),s++)}),l?e.codeBlockModelCollection.updateSync(e.sessionResource,o,i,{text:l.text,languageId:l.lang,isComplete:!0}).model:void 0}get responseContent(){return this._chatWidget.viewModel?.model.getRequests()?.at(-1)?.response?.response.toString()}getChatModel(){return this._chatWidget.viewModel?.model}setChatModel(i){i.inputModel.setState({inputText:"",selections:[]}),this._chatWidget.setModel(i)}updateInfo(i){this._elements.infoLabel.classList.toggle("hidden",!i);let e=Bn(i);Fi(this._elements.infoLabel,...e),this._onDidChangeHeight.fire()}updateStatus(i,e={}){let t=typeof e.resetAfter=="number";if(t&&!this._elements.statusLabel.dataset.state){let n=this._elements.statusLabel.innerText,r=this._elements.statusLabel.dataset.title,s=Array.from(this._elements.statusLabel.classList.values());setTimeout(()=>{this.updateStatus(n,{classes:s,keepMessage:!0,title:r})},e.resetAfter)}let o=Bn(i);Fi(this._elements.statusLabel,...o),this._elements.statusLabel.className=`label status ${(e.classes??[]).join(" ")}`,this._elements.statusLabel.classList.toggle("hidden",!i),t?this._elements.statusLabel.dataset.state="temp":delete this._elements.statusLabel.dataset.state,e.title?this._elements.statusLabel.dataset.title=e.title:delete this._elements.statusLabel.dataset.title,this._onDidChangeHeight.fire()}reset(){this._chatWidget.attachmentModel.clear(!0),this._chatWidget.saveState(),Fi(this._elements.statusLabel),this._elements.statusLabel.classList.toggle("hidden",!0),this._elements.toolbar1.classList.add("hidden"),this._elements.toolbar2.classList.add("hidden"),this.updateInfo(""),this._elements.accessibleViewer.classList.toggle("hidden",!0),this._onDidChangeHeight.fire()}focus(){this._chatWidget.focusInput()}hasFocus(){return this.domNode.contains(Pn())}};the=I([m(2,F),m(3,X),m(4,_e),m(5,Bi),m(6,B),m(7,Wd),m(8,Nt),m(9,Si),m(10,tt),m(11,vr),m(12,Qn)],the);var w7o=d(10609,null),zAe=class extends the{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v){let b=g.getContainer(Me(e.getContainerDomNode())).appendChild(_(".inline-chat-overflow.monaco-editor"));super(i,{...t,chatWidgetViewOptions:{...t.chatWidgetViewOptions,editorOverflowWidgetsDomNode:b}},r,o,n,s,l,c,u,p,h,f,v),this._store.add(Z(()=>{b.remove()}))}_doLayout(i){let e=i.height;super._doLayout(i.with(void 0,e)),this._elements.root.style.height=`${i.height-this._getExtraHeight()}px`}reset(){this.chatWidget.setInput(),super.reset()}};zAe=I([m(3,X),m(4,_e),m(5,F),m(6,Bi),m(7,B),m(8,Wd),m(9,Nt),m(10,Si),m(11,tt),m(12,nc),m(13,vr),m(14,Qn)],zAe);var ate=class extends aO{constructor(e,t,o,n,r,s,l){super(o.editor,ate._options);this._instaService=r;this._logService=s;this.notebookEditor=o.notebookEditor,this._ctxCursorPosition=Fwi.bindTo(l),this._disposables.add(Z(()=>{this._ctxCursorPosition.reset()})),this.widget=this._instaService.createInstance(zAe,e,this.editor,{statusMenuId:{menu:FVt,options:{buttonConfigProvider:(p,h)=>{let g=h>0;return new Set([zco,Kco,Gco]).has(p.id)?{isSecondary:g,showIcon:!0,showLabel:!1}:{isSecondary:g}}}},secondaryMenuId:IB,inZoneWidget:!0,chatWidgetViewOptions:{menus:{telemetrySource:"interactiveEditorWidget-toolbar",inputSideToolbar:$co},clear:n,...t,rendererOptions:{renderTextEditsAsSummary:p=>Xe(p,o.editor.getModel()?.uri),renderDetectedCommandsWithRequest:!0,...t?.rendererOptions},defaultMode:Pl.Ask}}),this._disposables.add(this.widget);let c;this._disposables.add(this.widget.chatWidget.onWillMaybeChangeHeight(()=>{this.position&&(c=this._createZoneAndScrollRestoreFn(this.position))})),this._disposables.add(this.widget.onDidChangeHeight(()=>{if(this.position&&!this._usesResizeHeight){c??=this._createZoneAndScrollRestoreFn(this.position);let p=this._computeHeight();this._relayout(p.linesValue),c?.(),c=void 0}})),this.create(),this._disposables.add(he(p=>{let h=this.widget.requestInProgress.read(p);this.domNode.firstElementChild?.classList.toggle("busy",h)})),this._disposables.add(j(this.domNode,"click",p=>{!this.editor.hasWidgetFocus()&&!this.widget.hasFocus()&&this.editor.focus()},!0));let u=()=>{!this.position||!this.editor.hasModel()?this._ctxCursorPosition.reset():this.position.lineNumber===this.editor.getPosition().lineNumber?this._ctxCursorPosition.set("above"):this.position.lineNumber+1===this.editor.getPosition().lineNumber?this._ctxCursorPosition.set("below"):this._ctxCursorPosition.reset()};this._disposables.add(this.editor.onDidChangeCursorPosition(p=>u())),this._disposables.add(this.editor.onDidFocusEditorText(p=>u())),u()}static{this._options={showFrame:!0,frameWidth:1,isResizeable:!0,showArrow:!1,isAccessible:!0,className:"inline-chat-widget",keepEditorSelection:!0,showInHiddenAreas:!0,ordinal:5e4}}_fillContainer(e){e.style.setProperty("--vscode-inlineChat-background","var(--vscode-editor-background)"),e.appendChild(this.widget.domNode)}_doLayout(e){this._updatePadding();let t=this.editor.getLayoutInfo(),o=t.contentWidth-t.verticalScrollbarWidth;this._dimension=new ai(o,e),this.widget.layout(this._dimension)}_computeHeight(){let e=this.widget.contentHeight,t=this.notebookEditor?.getLayoutInfo().height??this.editor.getLayoutInfo().height,o=this._decoratingElementsHeight()+Math.min(e,Math.max(this.widget.minHeight,t*.42));return{linesValue:o/this.editor.getOption(75),pixelsValue:o}}_getResizeBounds(){let e=this.editor.getOption(75),t=this._decoratingElementsHeight(),o=t+this.widget.minHeight,n=t+this.widget.contentHeight;return{minLines:o/e,maxLines:n/e}}_onWidth(e){this._dimension&&this._doLayout(this._dimension.height)}show(e){So(this.container),this._updatePadding();let t=this._createZoneAndScrollRestoreFn(e);super.show(e,this._computeHeight().linesValue),this.widget.chatWidget.setVisible(!0),this.widget.focus(),t()}_updatePadding(){So(this.container);let e=this.editor.getLayoutInfo(),t=e.glyphMarginWidth+e.lineNumbersWidth+e.decorationsWidth;this.container.style.paddingLeft=`${t}px`}reveal(e){let t=this.editor.getOption(131),o=t.enabled?t.maxLineCount:0;this.editor.revealLines(e.lineNumber+o,e.lineNumber+o,1),this.updatePositionAndHeight(e)}updatePositionAndHeight(e){let t=this._createZoneAndScrollRestoreFn(e);super.updatePositionAndHeight(e,this._usesResizeHeight?void 0:this._computeHeight().linesValue),t()}_createZoneAndScrollRestoreFn(e){let t=jqe.capture(this.editor),o=e.lineNumber<=1?1:1+e.lineNumber;return()=>{t.restore(this.editor);let n=this.editor.getScrollTop(),r=this.editor.getTopForLineNumber(o),s=r-this._computeHeight().pixelsValue,l=this.editor.getLayoutInfo().height,c=this.editor.getBottomForLineNumber(o),u=s,p=!1;c>=n+l&&(u=c-l,p=!0),(u<n||p)&&(this._logService.trace("[IE] REVEAL zone",{zoneTop:s,lineTop:r,lineBottom:c,scrollTop:n,newScrollTop:u,forceScrollTop:p}),this.editor.setScrollTop(u,1))}}revealRange(e,t){}hide(){let e=jqe.capture(this.editor);this._ctxCursorPosition.reset(),this.widget.chatWidget.setVisible(!1),super.hide(),Or(d(10614,null)),e.restore(this.editor)}};ate=I([m(4,F),m(5,ne),m(6,X)],ate);var lUt=class{static isInlineChatRunOptions(i){if(typeof i!="object"||i===null)return!1;let{initialSelection:e,initialRange:t,message:o,autoSend:n,position:r,attachments:s,modelSelector:l,resolveOnResponse:c,attachDiagnostics:u}=i;return!(typeof o<"u"&&typeof o!="string"||typeof n<"u"&&typeof n!="boolean"||typeof t<"u"&&!z.isIRange(t)||typeof e<"u"&&!Yt.isISelection(e)||typeof r<"u"&&!Ie.isIPosition(r)||typeof s<"u"&&(!Array.isArray(s)||!s.every(p=>p instanceof A))||typeof l<"u"&&!hYi(l)||typeof c<"u"&&typeof c!="boolean"||typeof u<"u"&&typeof u!="boolean")}};function C7o(a,i){return`${a.getId()},${i.id}`}var _m=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){this._editor=i;this._instaService=e;this._notebookEditorService=t;this._inlineChatSessionService=o;this._configurationService=s;this._webContentExtractorService=l;this._fileService=c;this._chatAttachmentResolveService=u;this._editorService=p;this._markerDecorationsService=h;this._languageModelService=g;this._logService=f;this._chatEditingService=v;this._chatService=b;this._store=new P;this._isActiveController=Le(this,!1);let S=os(i),y=OZe.bindTo(r),w=OVt.bindTo(r),k=Wwi.bindTo(r),T=pr("inlineChat.notebookAgent",!1,this._configurationService);this._renderMode=pr("inlineChat.renderMode","zone",this._configurationService),this._store.add(he(de=>{let se=S.model.read(de);if(!se){w.set(!1);return}let Se=this._chatEditingService.editingSessionsObs.read(de),ke=!1;for(let Ee of Se){let He=Ee.entries.read(de);for(let Ve of He)if(Xe(Ve.modifiedURI,se.uri)){ke=!0;break}if(ke)break}w.set(ke)}));let N=this._inputWidget=this._store.add(this._instaService.createInstance(BMe,S)),O=this._store.add(this._instaService.createInstance(HMe,S));this.inputOverlayWidget=this._store.add(this._instaService.createInstance(PMe,this._editor,N)),this._zone=new co(()=>{So(this._editor.hasModel(),"[Illegal State] widget should only be created when the editor has a model");let de={location:"editor",resolveData:()=>{So(this._editor.hasModel());let ke=this._editor.getSelection(),Ee=this._editor.getModel().uri;return{type:"editor",id:C7o(this._editor,this._editor.getModel()),selection:this._editor.getSelection(),document:Ee,wholeRange:ke}}},se=this._notebookEditorService.getNotebookForPossibleCell(this._editor);se&&(de.location="notebook",T.get()&&(de.resolveData=()=>(So(this._editor.hasModel()),{type:"notebook",sessionInputUri:this._editor.getModel().uri})));let Se=this._instaService.createInstance(ate,de,{enableWorkingSet:"implicit",enableImplicitContext:!1,renderInputOnTop:!1,renderInputToolbarBelowInput:!0,filter:ke=>Vi(ke)?!!ke.model.isPendingConfirmation.get():!1,menus:{telemetrySource:"inlineChatWidget",executeToolbar:D.ChatEditorInlineExecute,inputSideToolbar:D.ChatEditorInlineInputSide},defaultMode:Pl.Ask},{editor:this._editor,notebookEditor:se},()=>Promise.resolve());return this._store.add(Se),Se.domNode.classList.add("inline-chat-2"),Se});let V=Nr(this,o.onDidChangeSessions);this._currentSession=Ce(de=>{V.read(de);let se=S.model.read(de);return(se&&o.getSessionByTextModel(se.uri))??void 0});let U;this._store.add(he(de=>{let se=this._currentSession.read(de);if(!se){if(this._isActiveController.set(!1,void 0),U&&!U.chatModel.hasRequests){let ke=U.chatModel.inputModel.state.read(void 0);(!ke||!ke.inputText&&ke.attachments.length===0)&&(U.dispose(),U=void 0)}return}U=se;let Se=!1;for(let ke of n.listCodeEditors())if(_m.get(ke)?._isActiveController.read(void 0)){Se=!0;break}!Se&&S.isFocused.read(de)&&this._isActiveController.set(!0,void 0)}));let G=Le(this,void 0);this._store.add(he(de=>{let se=S.model.read(de),Se=this._currentSession.read(de),ke=this._isActiveController.read(de);!Se||!ke||!se?G.set(void 0,void 0):G.set(Se,void 0)}));let $=G.map((de,se)=>de?.initialSelection.isEmpty()?d(10591,null):d(10592,null));this._store.add(he(de=>{let se=G.read(de),Se=this._renderMode.read(de);se?Se==="hover"?(this._zone.value.widget.chatWidget.setModel(se.chatModel),this._zone.rawValue?.hide(),y.set(!0)):(y.set(!0),this._zone.value.widget.chatWidget.setModel(se.chatModel),this._zone.value.position||(this._zone.value.widget.chatWidget.setInputPlaceholder($.read(de)),this._zone.value.widget.chatWidget.input.renderAttachedContext(),this._zone.value.show(se.initialPosition)),this._zone.value.reveal(this._zone.value.position),this._zone.value.widget.focus()):(this._zone.rawValue?.hide(),this._zone.rawValue?.widget.chatWidget.setModel(void 0),i.focus(),y.reset())})),this._store.add(he(de=>{let se=G.read(de),Se=this._renderMode.read(de);if(!se||Se!=="hover"){k.set(!1),O.hide();return}let ke=se.chatModel.lastRequestObs.read(de),Ee=ke?.response?.isInProgress.read(de),He=!!ke?.response?.isPendingConfirmation.read(de),Ve=!!ke?.response?.result?.errorDetails;k.set(He);let Fe=se.editingSession.readEntry(se.uri,de),Qt=Fe?Fe.state.read(de)===0:!1;Ee||Qt||He||Ve?O.show(se):O.hide()})),this._store.add(he(de=>{let se=G.read(de);if(se){let Se=se.editingSession.entries.read(de),ke=Zo.parse(se.uri),Ee=Se.filter(He=>!(Xe(He.modifiedURI,se.uri)||ke&&Xe(ke.notebook,He.modifiedURI)));for(let He of Ee)this._editorService.openEditor({resource:He.modifiedURI},vn).catch(mt)}}));let te=G.map((de,se)=>de?ui(this,de.chatModel.onDidChange,()=>de.chatModel.getRequests().at(-1)).read(se)?.response:void 0),pe=te.map((de,se)=>{if(de)return ui(this,de.onDidChange,()=>de.response.value.findLast(Se=>Se.kind==="progressMessage")).read(se)});this._store.add(he(de=>{let se=te.read(de);if(this._zone.rawValue?.widget.updateInfo(""),!se?.isInProgress.read(de))se?.result?.errorDetails&&(this._zone.rawValue?.widget.updateInfo(`$(error) ${se.result.errorDetails.message}`),Jo(se.result.errorDetails.message)),this._zone.rawValue?.widget.domNode.classList.toggle("request-in-progress",!1),this._zone.rawValue?.widget.chatWidget.setInputPlaceholder($.read(de));else{this._zone.rawValue?.widget.domNode.classList.toggle("request-in-progress",!0);let Se=se.request?.message.text,ke=pe.read(de);ke&&(Se=qa(ke.content)),this._zone.rawValue?.widget.chatWidget.setInputPlaceholder(Se||d(10590,null))}})),this._store.add(he(de=>{let se=G.read(de);if(!se)return;let Se=se.editingSession.readEntry(se.uri,de);Se?.state.read(de)===0&&Se?.enableReviewModeUntilSettled()})),this._store.add(he(de=>{let se=G.read(de),Se=se?.editingSession.readEntry(se.uri,de),ke=this._editorService.visibleEditorPanes.find(Ee=>Ee.getControl()===this._editor||klo(Ee,this._editor));if(ke&&Se&&Se?.getEditorIntegration(ke),Se?.diffInfo&&this._zone.value.position){let{position:Ee}=this._zone.value,He=Se.diffInfo.read(de);for(let Ve of He.changes)if(Ve.modified.contains(Ee.lineNumber)){this._zone.value.updatePositionAndHeight(new Ie(Ve.modified.startLineNumber-1,1));break}}}))}static{this.ID="editor.contrib.inlineChatController"}static get(i){return i.getContribution(_m.ID)??void 0}get widget(){return this._zone.value.widget}get isActive(){return!!this._currentSession.get()}get inputWidget(){return this._inputWidget}dispose(){this._store.dispose()}getWidgetPosition(){return this._zone.rawValue?.position}focus(){this._zone.rawValue?.widget.focus()}async run(i){So(this._editor.hasModel());let e=this._editor.getModel().uri,t=this._inlineChatSessionService.getSessionByTextModel(e);t&&(await t.editingSession.accept(),t.dispose()),this._isActiveController.set(!0,void 0);let o=this._inlineChatSessionService.createSession(this._editor),n=new P;try{if(await this._applyModelDefaults(o,n),i&&(i.attachDiagnostics??=this._configurationService.getValue("inlineChat.renderMode")==="zone"),i?.attachDiagnostics){let r=[];for(let[s,l]of this._markerDecorationsService.getLiveMarkers(e))if(s.intersectRanges(this._editor.getSelection())){let c=uP.fromMarker(l);r.push(uP.toEntry(c))}if(r.length>0){this._zone.value.widget.chatWidget.attachmentModel.addContext(...r);let s=r.length>1?d(10589,null):d(10588,null);this._zone.value.widget.chatWidget.input.setValue(s,!0),i.message=s,this._zone.value.widget.chatWidget.inputEditor.setSelection(new Yt(1,1,Number.MAX_SAFE_INTEGER,1))}}if(i&&lUt.isInlineChatRunOptions(i)){if(i.initialRange&&this._editor.revealRange(i.initialRange),i.initialSelection&&this._editor.setSelection(i.initialSelection),i.attachments&&(await Promise.all(i.attachments.map(async r=>{await this._zone.value.widget.chatWidget.attachmentModel.addFile(r)})),delete i.attachments),i.modelSelector){let r=(await this._languageModelService.selectLanguageModels(i.modelSelector)).sort().at(0);if(!r)throw new Error(`No language models found matching selector: ${JSON.stringify(i.modelSelector)}.`);let s=this._languageModelService.lookupLanguageModel(r);if(!s)throw new Error(`Language model not loaded: ${r}.`);this._zone.value.widget.chatWidget.input.setCurrentLanguageModel({metadata:s,identifier:r})}i.message&&(this._zone.value.widget.chatWidget.setInput(i.message),i.autoSend&&await this._zone.value.widget.chatWidget.acceptInput())}if(i?.resolveOnResponse){let r=Ce(s=>{let l=o.editingSession.readEntry(e,s);return l?.state.read(s)===0&&!l?.isCurrentlyBeingModifiedBy.read(s)});return await gf(r,s=>s===!0),!0}else return await H.toPromise(o.editingSession.onDidDispose),!(o.editingSession.getEntry(e)?.state.get()===2)}finally{n.dispose()}}async acceptSession(){let i=this._currentSession.get();i&&(await i.editingSession.accept(),i.dispose())}async rejectSession(){let i=this._currentSession.get();i&&(this._chatService.cancelCurrentRequestForSession(i.chatModel.sessionResource,"inlineChatReject"),await i.editingSession.reject(),i.dispose())}async _selectVendorDefaultModel(i){let e=this._zone.value.widget.chatWidget.input.selectedLanguageModel.get();if(e&&!e.metadata.isDefaultForLocation[i.chatModel.initialLocation]){let t=await this._languageModelService.selectLanguageModels({vendor:e.metadata.vendor});for(let o of t){let n=this._languageModelService.lookupLanguageModel(o);if(n?.isDefaultForLocation[i.chatModel.initialLocation]){this._zone.value.widget.chatWidget.input.setCurrentLanguageModel({metadata:n,identifier:o});break}}}}async _applyModelDefaults(i,e){let t=_m._userSelectedModel,o=this._configurationService.getValue("inlineChat.defaultModel"),n=!1;t&&(n=this._zone.value.widget.chatWidget.input.switchModelByQualifiedName([t]),n||(_m._userSelectedModel=void 0)),!n&&o&&(n=this._zone.value.widget.chatWidget.input.switchModelByQualifiedName([o]),n||this._logService.warn(`inlineChat.defaultModel setting value '${o}' did not match any available model. Falling back to vendor default.`)),n||await this._selectVendorDefaultModel(i);let r;e.add(he(s=>{let l=this._zone.value.widget.chatWidget.input.selectedLanguageModel.read(s);if(l){if(!r){r=l.identifier;return}r!==l.identifier&&(_m._userSelectedModel=R_.asQualifiedName(l.metadata),r=l.identifier)}}))}async createImageAttachment(i){if(this._currentSession.get()){if(i.scheme===Y.file){if(await this._fileService.canHandleResource(i))return await this._chatAttachmentResolveService.resolveImageEditorAttachContext(i)}else if(i.scheme===Y.http||i.scheme===Y.https){let t=await this._webContentExtractorService.readImage(i,ve.None);if(t)return await this._chatAttachmentResolveService.resolveImageEditorAttachContext(i,t)}}}};_m=I([m(1,F),m(2,Zc),m(3,Ik),m(4,Kt),m(5,X),m(6,B),m(7,t2),m(8,be),m(9,jF),m(10,ee),m(11,RU),m(12,Wr),m(13,ne),m(14,dl),m(15,Si)],_m);async function cUt(a,i,e,t,o){if(!i.hasModel())return!1;let n=a.get(Si),r=i.getModel().uri,s=n.startNewLocalSession("editor"),l=s.object;l.startEditingSession(!0);let c=new P;c.add(s);let u=l?.addRequest({text:"",parts:[]},{variables:[]},0,{kind:void 0,modeId:"applyCodeBlock",modeInstructions:void 0,isBuiltin:!0,applyCodeBlockSuggestionId:o});So(u.response),u.response.updateContent({kind:"textEdit",uri:r,edits:[],done:!1});for await(let g of e){if(t.isCancellationRequested){u.response.cancel();break}u.response.updateContent({kind:"textEdit",uri:r,edits:g,done:!1})}u.response.updateContent({kind:"textEdit",uri:r,edits:[],done:!0}),t.isCancellationRequested||u.response.complete();let p=Ce(g=>{let f=l.editingSession?.readEntry(r,g);if(!f)return!1;let v=f.state.read(g);return v===1||v===2}),h=gf(p,Boolean);return await wa(h,t),c.dispose(),!0}async function Rmo(a,i,e,t){let o=a.get(Si),r=a.get(un).hasSupportedNotebooks(i),s=o.startNewLocalSession("editor"),l=s.object;l.startEditingSession(!0);let c=new P;c.add(s);let u=l?.addRequest({text:"",parts:[]},{variables:[]},0);So(u.response),r?u.response.updateContent({kind:"notebookEdit",uri:i,edits:[],done:!1}):u.response.updateContent({kind:"textEdit",uri:i,edits:[],done:!1});for await(let g of e){if(t.isCancellationRequested){u.response.cancel();break}g.every(x7o)?u.response.updateContent({kind:"notebookEdit",uri:i,edits:g,done:!1}):u.response.updateContent({kind:"textEdit",uri:g[0],edits:g[1],done:!1})}r?u.response.updateContent({kind:"notebookEdit",uri:i,edits:[],done:!0}):u.response.updateContent({kind:"textEdit",uri:i,edits:[],done:!0}),t.isCancellationRequested||u.response.complete();let p=Ce(g=>{let f=l.editingSession?.readEntry(i,g);if(!f)return!1;let v=f.state.read(g);return v===1||v===2}),h=gf(p,Boolean);return await wa(h,t),c.dispose(),!0}function x7o(a){return!(A.isUri(a)||Array.isArray(a))}var Ett=class a extends K{static{this.ID="notebook.action.indentUsingTabs"}constructor(){super({id:a.ID,title:d(11856,null),precondition:void 0})}run(i,...e){zki(i,!1,!1)}},Ttt=class a extends K{static{this.ID="notebook.action.indentUsingSpaces"}constructor(){super({id:a.ID,title:d(11855,null),precondition:void 0})}run(i,...e){zki(i,!0,!1)}},_tt=class a extends K{static{this.ID="notebook.action.changeTabDisplaySize"}constructor(){super({id:a.ID,title:d(11851,null),precondition:void 0})}run(i,...e){zki(i,!0,!0)}},Dtt=class a extends K{static{this.ID="notebook.action.convertIndentationToSpaces"}constructor(){super({id:a.ID,title:d(11853,null),precondition:void 0})}run(i,...e){Mmo(i,!0)}},Ltt=class a extends K{static{this.ID="notebook.action.convertIndentationToTabs"}constructor(){super({id:a.ID,title:d(11854,null),precondition:void 0})}run(i,...e){Mmo(i,!1)}};function zki(a,i,e){let t=a.get(ee),o=a.get(B),n=a.get(Zc),r=a.get(Ge),s=t.activeEditorPane?.input;if(!k8e(s)||!n.retrieveExistingWidgetFromURI(s.resource)?.value)return;let u=[1,2,3,4,5,6,7,8].map(g=>({id:g.toString(),label:g.toString()})),p=o.getValue(ft.cellEditorOptionsCustomizations),h=p["editor.insertSpaces"];delete p["editor.indentSize"],delete p["editor.tabSize"],delete p["editor.insertSpaces"],setTimeout(()=>{r.pick(u,{placeHolder:d(11857,null)}).then(g=>{if(g){let f=parseInt(g.label,10);e?o.updateValue(ft.cellEditorOptionsCustomizations,{...p,"editor.tabSize":f,"editor.indentSize":f,"editor.insertSpaces":h}):o.updateValue(ft.cellEditorOptionsCustomizations,{...p,"editor.tabSize":f,"editor.indentSize":f,"editor.insertSpaces":i})}})},50)}function Mmo(a,i){let e=a.get(ee),t=a.get(B),o=a.get(ne),n=a.get(Nt),r=a.get(Zc),s=a.get(ma),l=e.activeEditorPane?.input;if(!k8e(l))return;let u=r.retrieveExistingWidgetFromURI(l.resource)?.value?.textModel;if(!u)return;let p=new P;try{Promise.all(u.cells.map(async h=>{let g=await n.createModelReference(h.uri);p.add(g);let f=g.object.textEditorModel,v=h.textModel?.getOptions();if(!v)return;let b=k7o(f,v.tabSize,i);s.apply(b,{label:d(11852,null),code:"undoredo.convertIndentation"})})).then(()=>{let h=t.getValue(ft.cellEditorOptionsCustomizations),g=h["editor.indentSize"],f=h["editor.tabSize"];delete h["editor.indentSize"],delete h["editor.tabSize"],delete h["editor.insertSpaces"],t.updateValue(ft.cellEditorOptionsCustomizations,{...h,"editor.tabSize":f,"editor.indentSize":g,"editor.insertSpaces":i}),p.dispose()})}catch{o.error("Failed to convert indentation to spaces for notebook cells.")}}function k7o(a,i,e){if(a.getLineCount()===1&&a.getLineMaxColumn(1)===1)return[];let t="";for(let r=0;r<i;r++)t+=" ";let o=new RegExp(t,"gi"),n=[];for(let r=1,s=a.getLineCount();r<=s;r++){let l=a.getLineFirstNonWhitespaceColumn(r);if(l===0&&(l=a.getLineMaxColumn(r)),l===1)continue;let c=new z(r,1,r,l),u=a.getValueInRange(c),p=e?u.replace(/\t/ig,t):u.replace(o," ");n.push(new ja(a.uri,{range:c,text:p}))}return n}W(Ttt);W(Ett);W(_tt);W(Dtt);W(Ltt);var lte=_;function cte(a){let i=lte(".");return i.classList.add("debug-view-content","file-icon-themable-tree"),a.appendChild(i),i}var Pmo=(a,i)=>{let e=a.name.length,t=a.name.length+2,o=[],n=[];for(let r of i)r.start<e&&o.push({start:r.start,end:Math.min(r.end,e)}),r.end>t&&n.push({start:Math.max(r.start-t,0),end:r.end-t});return{name:o,value:n}},dUt={getKeyboardNavigationLabel(a){let i=a.getSession()?.rememberedCapabilities?.supportsANSIStyling;return`${a.name}: ${i?CS(a.value):a.value}`}},b2=class{constructor(i,e){this.debugService=i;this.debugVisualizer=e}async getChildren(i){let e=this.debugService.getViewModel(),t=await this.doGetChildren(i);return Promise.all(t.map(async o=>{let n=e.getVisualizedExpression(o);if(typeof n=="string"){let r=await this.debugVisualizer.getVisualizedNodeFor(n,o);if(r)return e.setVisualizedExpression(o,r),r}else if(n)return n;return o}))}};b2=I([m(0,Li),m(1,qY)],b2);var OB=class{constructor(i,e,t){this.debugService=i;this.contextViewService=e;this.hoverService=t}renderTemplate(i){let e=new P,t=R(i,lte(".expression")),o=R(t,lte("span.name")),n=R(t,lte("span.lazy-button"));n.classList.add(...q.asClassNameArray(M.eye)),e.add(this.hoverService.setupManagedHover(Ni("mouse"),n,d(8586,null)));let r=R(t,lte("span.type")),s=R(t,lte("span.value")),l=e.add(new Oa(o)),c=R(t,lte(".inputBoxContainer")),u;this.renderActionBar&&(R(t,lte(".span.actionbar-spacer")),u=e.add(new ji(t)));let p={expression:t,name:o,type:r,value:s,label:l,inputBoxContainer:c,actionBar:u,elementDisposable:new P,templateDisposable:e,lazyButton:n,currentElement:void 0};return e.add(j(n,re.CLICK,()=>{p.currentElement&&this.debugService.getViewModel().evaluateLazyExpression(p.currentElement)})),p}renderExpressionElement(i,e,t){t.currentElement=i,this.renderExpression(e.element,t,ua(e.filterData)),t.actionBar&&this.renderActionBar(t.actionBar,i,t);let o=this.debugService.getViewModel().getSelectedExpression();if(i===o?.expression||i instanceof Hl&&i.errorMessage){let n=this.getInputBoxOptions(i,!!o?.settingWatch);n&&t.elementDisposable.add(this.renderInputBox(t.name,t.value,t.inputBoxContainer,n))}}renderInputBox(i,e,t,o){i.style.display="none",e.style.display="none",t.style.display="initial",Rt(t);let n=new Dc(t,this.contextViewService,{...o,inputBoxStyles:pl});n.value=o.initialValue,n.focus(),n.select();let r=wd((l,c)=>{i.style.display="",e.style.display="",t.style.display="none";let u=n.value;Ue(s),c&&(this.debugService.getViewModel().setSelectedExpression(void 0,!1),o.onFinish(u,l))}),s=[n,Vo(n.inputElement,re.KEY_DOWN,l=>{let c=l.equals(9),u=l.equals(3);(c||u)&&(l.preventDefault(),l.stopPropagation(),r(u,!0))}),j(n.inputElement,re.BLUR,()=>{r(!0,!0)}),j(n.inputElement,re.CLICK,l=>{l.preventDefault(),l.stopPropagation()})];return Z(()=>{r(!1,!1)})}disposeElement(i,e,t){t.elementDisposable.clear()}disposeTemplate(i){i.elementDisposable.dispose(),i.templateDisposable.dispose()}};OB=I([m(0,Li),m(1,_n),m(2,tt)],OB);var E7o=0,Rtt=()=>`topReplElement:${E7o++}`,xw=class{constructor(i,e,t,o,n,r){this.session=i;this.id=e;this.value=t;this.severity=o;this.sourceData=n;this.expression=r;this._count=1;this._onDidChangeCount=new E}toString(i=!1){let e=this.value;for(let o=1;o<this.count;o++)e+=(e.endsWith(`
`)?"":`
`)+this.value;let t=this.sourceData&&i?` ${this.sourceData.source.name}`:"";return e+t}getId(){return this.id}getChildren(){return this.expression?.getChildren()||Promise.resolve([])}set count(i){this._count=i,this._onDidChangeCount.fire()}get count(){return this._count}get onDidChangeCount(){return this._onDidChangeCount.event}get hasChildren(){return!!this.expression?.hasChildren}},ohe=class{constructor(i,e,t,o){this.session=i;this.expression=e;this.severity=t;this.sourceData=o;this.id=_t();this.hasChildren=e.hasChildren}getSession(){return this.session}getChildren(){return this.expression.getChildren()}toString(){return this.expression.toString()}getId(){return this.id}},uUt=class a{constructor(i,e,t,o,n){this.id=i;this.name=e;this.valueObj=t;this.sourceData=o;this.annotation=n}static{this.MAX_CHILDREN=1e3}getId(){return this.id}getSession(){}get value(){return this.valueObj===null?"null":Array.isArray(this.valueObj)?`Array[${this.valueObj.length}]`:yi(this.valueObj)?"Object":Ae(this.valueObj)?`"${this.valueObj}"`:String(this.valueObj)||""}get hasChildren(){return Array.isArray(this.valueObj)&&this.valueObj.length>0||yi(this.valueObj)&&Object.getOwnPropertyNames(this.valueObj).length>0}evaluateLazy(){throw new Error("Method not implemented.")}getChildren(){let i=[];return Array.isArray(this.valueObj)?i=this.valueObj.slice(0,a.MAX_CHILDREN).map((e,t)=>new a(`${this.id}:${t}`,String(t),e)):yi(this.valueObj)&&(i=Object.getOwnPropertyNames(this.valueObj).slice(0,a.MAX_CHILDREN).map((e,t)=>new a(`${this.id}:${t}`,e,this.valueObj[e]))),Promise.resolve(i)}toString(){return`${this.name}
${this.value}`}},dte=class{constructor(i){this.value=i;this.id=_t()}toString(){return this.value}getId(){return this.id}},yA=class extends vP{constructor(e){super(void 0,void 0,0,_t());this.originalExpression=e;this._available=!0}get available(){return this._available}async evaluateExpression(e,t,o,n){let r=await super.evaluateExpression(e,t,o,n);return this._available=r,r}toString(){return`${this.value}`}},S2=class a{constructor(i,e,t,o){this.session=i;this.name=e;this.autoExpand=t;this.sourceData=o;this.children=[];this.ended=!1;this.id=`replGroup:${a.COUNTER++}`}static{this.COUNTER=0}get hasChildren(){return!0}getId(){return this.id}toString(i=!1){let e=i&&this.sourceData?` ${this.sourceData.source.name}`:"";return this.name+e}addChild(i){let e=this.children.length?this.children[this.children.length-1]:void 0;e instanceof a&&!e.hasEnded?e.addChild(i):this.children.push(i)}getChildren(){return this.children}end(){let i=this.children.length?this.children[this.children.length-1]:void 0;i instanceof a&&!i.hasEnded?i.end():this.ended=!0}get hasEnded(){return this.ended}};function ihe(a,i){return!a&&!i?!0:a&&i?a.column===i.column&&a.lineNumber===i.lineNumber&&a.source.uri.toString()===i.source.uri.toString():!1}var pUt=class a{constructor(i){this.configurationService=i;this.replElements=[];this._onDidChangeElements=new E;this.onDidChangeElements=this._onDidChangeElements.event}getReplElements(){return this.replElements}async addReplExpression(i,e,t){this.addReplElement(new dte(t));let o=new yA(t);await o.evaluateExpression(t,i,e,"repl"),this.addReplElement(o)}appendToRepl(i,{output:e,expression:t,sev:o,source:n}){let r="\x1B[2J",s=e.lastIndexOf(r);if(s!==-1&&(this.removeReplExpressions(),this.appendToRepl(i,{output:d(9347,null),sev:gt.Ignore}),e=e.substring(s+r.length)),t){this.addReplElement(e?new xw(i,Rtt(),e,o,n,t):new ohe(i,t,o,n));return}this.appendOutputToRepl(i,e,o,n)}appendOutputToRepl(i,e,t,o){let n=this.configurationService.getValue("debug"),r=this.replElements.length?this.replElements[this.replElements.length-1]:void 0;if(r instanceof xw&&r.severity===t&&ihe(r.sourceData,o)&&!r.value.endsWith(`
`)&&!r.value.endsWith(`\r
`)&&r.count===1){let s=r.value+e;this.replElements[this.replElements.length-1]=new xw(i,Rtt(),s,t,o),this._onDidChangeElements.fire(void 0),n.console.collapseIdenticalLines&&s.endsWith(`
`)&&this.tryCollapseCompleteLine(t,o),n.console.collapseIdenticalLines&&s.includes(`
`)&&this.splitIntoLines(s).length>1&&this.applyLineLevelCollapsing(i,t,o);return}if(n.console.collapseIdenticalLines&&e.includes(`
`))this.processMultiLineOutput(i,e,t,o);else{if(r instanceof xw&&r.severity===t&&ihe(r.sourceData,o)&&r.value===e&&n.console.collapseIdenticalLines){r.count++;return}let s=new xw(i,Rtt(),e,t,o);this.addReplElement(s)}}tryCollapseCompleteLine(i,e){if(this.replElements.length<2)return;let t=this.replElements[this.replElements.length-1],o=this.replElements[this.replElements.length-2];t instanceof xw&&o instanceof xw&&t.severity===i&&o.severity===i&&ihe(t.sourceData,e)&&ihe(o.sourceData,e)&&t.value===o.value&&t.count===1&&t.value.endsWith(`
`)&&(o.count+=t.count,this.replElements.pop(),this._onDidChangeElements.fire(void 0))}processMultiLineOutput(i,e,t,o){let n=this.splitIntoLines(e);for(let r of n){if(r.length===0)continue;let s=this.replElements.length?this.replElements[this.replElements.length-1]:void 0;if(s instanceof xw&&s.severity===t&&ihe(s.sourceData,o)&&s.value===r)s.count++;else{let l=new xw(i,Rtt(),r,t,o);this.addReplElement(l)}}}splitIntoLines(i){let e=[],t=0;for(;t<i.length;){let o=i.indexOf(`
`,t);if(o===-1){e.push(i.substring(t));break}e.push(i.substring(t,o+1)),t=o+1}return e}applyLineLevelCollapsing(i,e,t){let o=this.replElements[this.replElements.length-1];if(!(o instanceof xw)||o.severity!==e||!ihe(o.sourceData,t))return;let n=this.splitIntoLines(o.value);if(!(n.length<=1)){this.replElements.pop();for(let r of n){if(r.length===0)continue;let s=this.replElements.length?this.replElements[this.replElements.length-1]:void 0;if(s instanceof xw&&s.severity===e&&ihe(s.sourceData,t)&&s.value===r)s.count++;else{let l=new xw(i,Rtt(),r,e,t);this.addReplElement(l)}}this._onDidChangeElements.fire(void 0)}}startGroup(i,e,t,o){let n=new S2(i,e,t,o);this.addReplElement(n)}endGroup(){let i=this.replElements[this.replElements.length-1];i instanceof S2&&i.end()}addReplElement(i){let e=this.replElements.length?this.replElements[this.replElements.length-1]:void 0;if(e instanceof S2&&!e.hasEnded)e.addChild(i);else{this.replElements.push(i);let t=this.configurationService.getValue("debug");this.replElements.length>t.console.maximumLines&&this.replElements.splice(0,this.replElements.length-t.console.maximumLines)}this._onDidChangeElements.fire(i)}removeReplExpressions(){this.replElements.length>0&&(this.replElements=[],this._onDidChangeElements.fire(void 0))}clone(){let i=new a(this.configurationService);return i.replElements=this.replElements.slice(),i}};function Kki(a,i,e,t,o){let n=document.createElement("span"),r=a.length,s=[],l,c,u,p=!1,h=0,g=0,f="";for(;h<r;){let T=!1;if(a.charCodeAt(h)===27&&a.charAt(h+1)==="["){let N=h;h+=2;let O="";for(;h<r;){let V=a.charAt(h);if(O+=V,h++,V.match(/^[ABCDHIJKfhmpsu]$/)){T=!0;break}}if(T){if(g+=2+O.length,Amo(n,f,s,i,e,l,c,u,t,h-f.length-g,o),f="",O.match(/^(?:[34][0-8]|9[0-7]|10[0-7]|[0-9]|2[1-5,7-9]|[34]9|5[8,9]|1[0-9])(?:;[349][0-7]|10[0-7]|[013]|[245]|[34]9)?(?:;[012]?[0-9]?[0-9])*;?m$/)){let V=O.slice(0,-1).split(";").filter(U=>U!=="").map(U=>parseInt(U,10));if(V[0]===38||V[0]===48||V[0]===58){let U=V[0]===38?"foreground":V[0]===48?"background":"underline";V[1]===5?w(V,U):V[1]===2&&y(V,U)}else S(V)}}else h=N}T===!1&&(f+=a.charAt(h),h++)}return f&&Amo(n,f,s,i,e,l,c,u,t,h-f.length,o),n;function v(T,N){T==="foreground"?l=N:T==="background"?c=N:T==="underline"&&(u=N),s=s.filter(O=>O!==`code-${T}-colored`),N!==void 0&&s.push(`code-${T}-colored`)}function b(){let T=l;v("foreground",c),v("background",T)}function S(T){for(let N of T)switch(N){case 0:{s=[],l=void 0,c=void 0;break}case 1:{s=s.filter(O=>O!=="code-bold"),s.push("code-bold");break}case 2:{s=s.filter(O=>O!=="code-dim"),s.push("code-dim");break}case 3:{s=s.filter(O=>O!=="code-italic"),s.push("code-italic");break}case 4:{s=s.filter(O=>O!=="code-underline"&&O!=="code-double-underline"),s.push("code-underline");break}case 5:{s=s.filter(O=>O!=="code-blink"),s.push("code-blink");break}case 6:{s=s.filter(O=>O!=="code-rapid-blink"),s.push("code-rapid-blink");break}case 7:{p||(p=!0,b());break}case 8:{s=s.filter(O=>O!=="code-hidden"),s.push("code-hidden");break}case 9:{s=s.filter(O=>O!=="code-strike-through"),s.push("code-strike-through");break}case 10:{s=s.filter(O=>!O.startsWith("code-font"));break}case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:case 20:{s=s.filter(O=>!O.startsWith("code-font")),s.push(`code-font-${N-10}`);break}case 21:{s=s.filter(O=>O!=="code-underline"&&O!=="code-double-underline"),s.push("code-double-underline");break}case 22:{s=s.filter(O=>O!=="code-bold"&&O!=="code-dim");break}case 23:{s=s.filter(O=>O!=="code-italic"&&O!=="code-font-10");break}case 24:{s=s.filter(O=>O!=="code-underline"&&O!=="code-double-underline");break}case 25:{s=s.filter(O=>O!=="code-blink"&&O!=="code-rapid-blink");break}case 27:{p&&(p=!1,b());break}case 28:{s=s.filter(O=>O!=="code-hidden");break}case 29:{s=s.filter(O=>O!=="code-strike-through");break}case 53:{s=s.filter(O=>O!=="code-overline"),s.push("code-overline");break}case 55:{s=s.filter(O=>O!=="code-overline");break}case 39:{v("foreground",void 0);break}case 49:{v("background",void 0);break}case 59:{v("underline",void 0);break}case 73:{s=s.filter(O=>O!=="code-superscript"&&O!=="code-subscript"),s.push("code-superscript");break}case 74:{s=s.filter(O=>O!=="code-superscript"&&O!=="code-subscript"),s.push("code-subscript");break}case 75:{s=s.filter(O=>O!=="code-superscript"&&O!=="code-subscript");break}default:{k(N);break}}}function y(T,N){if(T.length>=5&&T[2]>=0&&T[2]<=255&&T[3]>=0&&T[3]<=255&&T[4]>=0&&T[4]<=255){let O=new Bt(T[2],T[3],T[4]);v(N,O)}}function w(T,N){let O=T[2],V=T7o(O);if(V)v(N,V);else if(O>=0&&O<=15){if(N==="underline"){let U=nS[O];v(N,`--vscode-debug-ansi-${U}`);return}O+=30,O>=38&&(O+=52),N==="background"&&(O+=10),k(O)}}function k(T){let N,O;if(T>=30&&T<=37?(O=T-30,N="foreground"):T>=90&&T<=97?(O=T-90+8,N="foreground"):T>=40&&T<=47?(O=T-40,N="background"):T>=100&&T<=107&&(O=T-100+8,N="background"),O!==void 0&&N){let V=nS[O];v(N,`--vscode-debug-ansi-${V.replaceAll(".","-")}`)}}}function Amo(a,i,e,t,o,n,r,s,l,c,u){if(!a||!i)return;let p=t.linkify(i,u,!0,o,void 0,l?.map(h=>({start:h.start-c,end:h.end-c,extraClasses:h.extraClasses})));p.className=e.join(" "),n&&(p.style.color=typeof n=="string"?`var(${n})`:Oe.Format.CSS.formatRGB(new Oe(n))),r&&(p.style.backgroundColor=typeof r=="string"?`var(${r})`:Oe.Format.CSS.formatRGB(new Oe(r))),s&&(p.style.textDecorationColor=typeof s=="string"?`var(${s})`:Oe.Format.CSS.formatRGB(new Oe(s))),a.appendChild(p)}function T7o(a){if(a%1===0)if(a>=16&&a<=231){a-=16;let i=a%6;a=(a-i)/6;let e=a%6;a=(a-e)/6;let t=a,o=255/5;return i=Math.round(i*o),e=Math.round(e*o),t=Math.round(t*o),new Bt(t,e,i)}else if(a>=232&&a<=255){a-=232;let i=Math.round(a/23*255);return new Bt(i,i,i)}else return}is((a,i)=>{let e=[{selector:".monaco-workbench .sidebar, .monaco-workbench .auxiliarybar",bg:a.getColor(op)},{selector:".monaco-workbench .panel",bg:a.getColor(jS)},{selector:".monaco-workbench .monaco-list-row.selected",bg:a.getColor(xf)},{selector:".monaco-workbench .monaco-list-row.focused",bg:a.getColor(pgt)},{selector:".monaco-workbench .monaco-list:focus .monaco-list-row.focused",bg:a.getColor(c9)},{selector:".monaco-workbench .monaco-list:focus .monaco-list-row.selected",bg:a.getColor(Wy)},{selector:".debug-hover-widget",bg:a.getColor(qT)}];for(let{selector:t,bg:o}of e){let n=nS.map(r=>{let s=a.getColor(r);if(s)return`--vscode-debug-ansi-${r.replaceAll(".","-")}:${o?o.ensureConstrast(s,4):s}`}).filter(mo);i.addRule(`${t} { ${n.join(";")} }`)}});var SD=ae("extensionHostDebugService");async function Omo(a){let i=a.get(Ge),e=a.get(Li),t=a.get(ee),o=e.getModel().getSessions(!1),n=a.get(Ct),r=a.get(kt),s=a.get(ot),l=new P,c=i.createQuickPick({useSeparators:!0});l.add(c),c.matchOnLabel=c.matchOnDescription=c.matchOnDetail=c.sortByLabel=!1,c.placeholder=d(9346,null),c.items=await Nmo(c.value,o,t,n,r,s),l.add(c.onDidChangeValue(async()=>{c.items=await Nmo(c.value,o,t,n,r,s)})),l.add(c.onDidAccept(()=>{c.selectedItems[0].accept(),c.hide()})),l.add(c.onDidHide(()=>l.dispose())),c.show()}async function _7o(a,i,e,t,o,n){let r=[];return r.push({type:"separator",label:a.name}),(await a.getLoadedSources()).forEach(l=>{let c=D7o(l,i,e,t,o,n);c&&r.push(c)}),r}async function Nmo(a,i,e,t,o,n){let r=[],s=await Promise.all(i.map(l=>_7o(l,a,e,t,o,n)));for(let l of s)for(let c of l)r.push(c);return r}function D7o(a,i,e,t,o,n){let r=n.getUriBasenameLabel(a.uri),s=n.getUriLabel(ci(a.uri)),l=Up(i,r,!0),c=Up(i,s,!0);if(l||c)return{label:r,description:s==="."?void 0:s,highlights:{label:l??void 0,description:c??void 0},iconClasses:js(t,o,a.uri),accept:()=>{a.available&&a.openInEditor(e,{startLineNumber:0,startColumn:0,endLineNumber:0,endColumn:0})}}}var vd=_;function fte(a){let i=new hv("",!1,kf);return i.domNode.tabIndex=-1,a.add(i),i}var R7o=9;var FB=class{constructor(i,e){this.uri=i;this.breakpoints=e}getId(){return this.uri.toString()}get enabled(){return this.breakpoints.every(i=>i.enabled)}get indeterminate(){let i=this.breakpoints.filter(e=>e.enabled).length;return i>0&&i<this.breakpoints.length}};function Fmo(a){return a instanceof wv?"source":a instanceof iI?"instruction":"exception"}var KAe=class extends zr{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super(e,n,t,u,h,p,r,g,s,b);this.debugService=o;this.editorService=l;this.contextViewService=c;this.labelService=f;this.languageService=S;this.needsRefresh=!1;this.needsStateChange=!1;this.ignoreLayout=!1;this.collapsedState=new Set;this.menu=v.createMenu(D.DebugBreakpointsContext,h),this._register(this.menu),this.breakpointItemType=O_.bindTo(h),this.breakpointIsDataBytes=Gdi.bindTo(h),this.breakpointHasMultipleModes=$di.bindTo(h),this.breakpointSupportsCondition=t_t.bindTo(h),this.breakpointInputFocused=ZTt.bindTo(h),this._register(this.debugService.getModel().onDidChangeBreakpoints(()=>this.onBreakpointsChange())),this._register(this.debugService.getViewModel().onDidFocusSession(()=>this.onBreakpointsChange())),this._register(this.debugService.onDidChangeState(()=>this.onStateChange())),this.hintDelayer=this._register(new Dt(()=>this.updateBreakpointsHint(!0),4e3))}getPresentation(){return this.configurationService.getValue("debug.breakpointsView.presentation")}renderBody(e){super.renderBody(e),this.element.classList.add("debug-pane"),e.classList.add("debug-breakpoints"),this.tree=this.instantiationService.createInstance(PL,"BreakpointsView",e,new Gki(this),[this.instantiationService.createInstance(ute),this.instantiationService.createInstance(pte,this.menu,this.breakpointHasMultipleModes,this.breakpointSupportsCondition,this.breakpointItemType),new mUt(this.menu,this.breakpointHasMultipleModes,this.breakpointSupportsCondition,this.breakpointItemType,this.debugService,this.hoverService),new fUt(this,this.debugService,this.contextViewService),this.instantiationService.createInstance(mte,this.menu,this.breakpointSupportsCondition,this.breakpointItemType),new hUt(this,this.debugService,this.contextViewService,this.hoverService,this.labelService),this.instantiationService.createInstance(hte,this.menu,this.breakpointHasMultipleModes,this.breakpointSupportsCondition,this.breakpointItemType,this.breakpointIsDataBytes),new gUt(this,this.debugService,this.contextViewService,this.hoverService,this.labelService),this.instantiationService.createInstance(gte)],{compressionEnabled:this.getPresentation()==="tree",hideTwistiesOfChildlessElements:!0,identityProvider:{getId:o=>o.getId()},keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:o=>o instanceof FB?Ra(o.uri):o instanceof wv?`${Ra(o.uri)}:${o.lineNumber}`:o instanceof tI?o.name:o instanceof ZI?o.description:o instanceof SP?o.label||o.filter:o instanceof iI?`0x${o.address.toString(16)}`:"",getCompressedNodeKeyboardNavigationLabel:o=>o.map(n=>n instanceof FB?Ra(n.uri):"").join("/")},accessibilityProvider:new $ki(this.debugService,this.labelService),multipleSelectionSupport:!1,overrideStyles:this.getLocationBasedColors().listOverrideStyles}),this._register(this.tree),Cke.bindTo(this.tree.contextKeyService),this._register(this.tree.onContextMenu(this.onTreeContextMenu,this)),this._register(this.tree.onMouseMiddleClick(async({element:o})=>{o instanceof wv?await this.debugService.removeBreakpoints(o.getId()):o instanceof tI?await this.debugService.removeFunctionBreakpoints(o.getId()):o instanceof ZI?await this.debugService.removeDataBreakpoints(o.getId()):o instanceof iI?await this.debugService.removeInstructionBreakpoints(o.instructionReference,o.offset):o instanceof FB&&await this.debugService.removeBreakpoints(o.breakpoints.map(n=>n.getId()))})),this._register(this.tree.onDidOpen(async o=>{let n=o.element;n&&(Vp(o.browserEvent)&&o.browserEvent.button===1||(n instanceof wv&&GAe(n,o.sideBySide,o.editorOptions.preserveFocus||!1,o.editorOptions.pinned||!o.editorOptions.preserveFocus,this.debugService,this.editorService),n instanceof iI&&(await this.editorService.openEditor(nR.instance)).goToInstructionAndOffset(n.instructionReference,n.offset,Vp(o.browserEvent)&&o.browserEvent.detail===2),Vp(o.browserEvent)&&o.browserEvent.detail===2&&n instanceof tI&&n!==this.inputBoxData?.breakpoint&&this.renderInputBox({breakpoint:n,type:"name"})))})),this._register(this.tree.onDidChangeCollapseState(o=>{let n=o.node.element;n instanceof FB&&(o.node.collapsed?this.collapsedState.add(n.getId()):this.collapsedState.delete(n.getId()),this.updateSize())})),this._register(this.configurationService.onDidChangeConfiguration(o=>{if(o.affectsConfiguration("debug.breakpointsView.presentation")){let n=this.getPresentation();this.tree.updateOptions({compressionEnabled:n==="tree"}),this.onBreakpointsChange()}})),this.setTreeInput(),this._register(this.onDidChangeBodyVisibility(o=>{o&&(this.needsRefresh&&this.onBreakpointsChange(),this.needsStateChange&&this.onStateChange())}));let t=this.viewDescriptorService.getViewContainerModel(this.viewDescriptorService.getViewContainerByViewId(this.id));this._register(t.onDidChangeAllViewDescriptors(()=>{this.updateSize()}))}renderHeaderTitle(e,t){super.renderHeaderTitle(e,t);let o=R(e,vd("span.breakpoint-warning"));this.hintContainer=this._register(new Lc(o,{supportIcons:!0,hoverDelegate:{showHover:(n,r)=>this.hoverService.showInstantHover({content:n.content,target:this.hintContainer.element},r),delay:this.configurationService.getValue("workbench.hover.delay")}})),xo(this.hintContainer.element)}focus(){super.focus(),this.tree?.domFocus()}renderInputBox(e){this._inputBoxData=e,this.onBreakpointsChange(),this._inputBoxData=void 0}get inputBoxData(){return this._inputBoxData}layoutBody(e,t){if(!this.ignoreLayout){super.layoutBody(e,t),this.tree?.layout(e,t);try{this.ignoreLayout=!0,this.updateSize()}finally{this.ignoreLayout=!1}}}onTreeContextMenu(e){let t=e.element;if(t instanceof FB){this.breakpointItemType.set("breakpointFolder");let{secondary:l}=Ef(this.menu.getActions({arg:t,shouldForwardArgs:!1}),"inline");this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>l,getActionsContext:()=>t});return}let o=t instanceof wv?"breakpoint":t instanceof SP?"exceptionBreakpoint":t instanceof tI?"functionBreakpoint":t instanceof ZI?"dataBreakpoint":t instanceof iI?"instructionBreakpoint":void 0;this.breakpointItemType.set(o);let n=this.debugService.getViewModel().focusedSession,r=t instanceof SP?t.supportsCondition:!n||!!n.capabilities.supportsConditionalBreakpoints;this.breakpointSupportsCondition.set(r),this.breakpointIsDataBytes.set(t instanceof ZI&&t.src.type===1),this.breakpointHasMultipleModes.set(this.debugService.getModel().getBreakpointModes(Fmo(t)).length>1);let{secondary:s}=Ef(this.menu.getActions({arg:e.element,shouldForwardArgs:!1}),"inline");this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>s,getActionsContext:()=>t})}updateSize(){let e=this.viewDescriptorService.getViewContainerModel(this.viewDescriptorService.getViewContainerByViewId(this.id)),t=22;this.minimumBodySize=this.orientation===0?Math.min(R7o*t,this.tree.contentHeight):170,this.maximumBodySize=this.orientation===0&&e.visibleViewDescriptors.length>1?this.tree.contentHeight:Number.POSITIVE_INFINITY}updateBreakpointsHint(e=!1){if(!this.hintContainer)return;let t=this.debugService.getViewModel().focusedSession?.configuration.type,o=t?this.debugService.getAdapterManager().getDebugger(t):void 0,n=o?.strings?.unverifiedBreakpoints,r=n&&this.debugService.getModel().getBreakpoints().filter(s=>{if(s.verified||!s.enabled)return!1;let l=this.languageService.guessLanguageIdByFilepathOrFirstLine(s.uri);return l&&o.interestedInLanguage(l)});if(n&&r?.length&&this.debugService.getModel().areBreakpointsActivated())if(e){let s=new xe(void 0,{isTrusted:!0}).appendMarkdown(n);this.hintContainer.setLabel("$(warning)",void 0,{title:{markdown:s,markdownNotSupportedFallback:n}}),bn(this.hintContainer.element)}else this.hintDelayer.schedule();else xo(this.hintContainer.element)}onBreakpointsChange(){this.isBodyVisible()?(this.tree&&(this.setTreeInput(),this.needsRefresh=!1),this.updateBreakpointsHint(),this.updateSize()):this.needsRefresh=!0}onStateChange(){if(this.isBodyVisible()){this.needsStateChange=!1;let e=this.debugService.getViewModel().focusedThread,t=!1;if(e&&e.stoppedDetails&&e.stoppedDetails.hitBreakpointIds&&e.stoppedDetails.hitBreakpointIds.length>0){let o=e.stoppedDetails.hitBreakpointIds,r=this.flatElements.find(s=>{let l=s.getIdFromAdapter(e.session.getId());return typeof l=="number"&&o.indexOf(l)!==-1});r&&(this.tree.setFocus([r]),this.tree.setSelection([r]),t=!0,this.autoFocusedElement=r)}if(!t){let o=this.tree.getFocus(),n=this.tree.getSelection();this.autoFocusedElement&&$i(o,n)&&n.includes(this.autoFocusedElement)&&(this.tree.setFocus([]),this.tree.setSelection([])),this.autoFocusedElement=void 0}this.updateBreakpointsHint()}else this.needsStateChange=!0}setTreeInput(){let e=this.getTreeElements();this.tree.setChildren(null,e)}getTreeElements(){let e=this.debugService.getModel(),t=this.debugService.getViewModel().focusedSession?.getId(),o=this.getPresentation()==="tree",n=[];for(let s of e.getExceptionBreakpointsForSession(t))n.push({element:s,incompressible:!0});for(let s of e.getFunctionBreakpoints())n.push({element:s,incompressible:!0});for(let s of e.getDataBreakpoints())n.push({element:s,incompressible:!0});let r=e.getBreakpoints();if(o&&r.length>0){let s=new Map;for(let l of r){let c=l.uri.toString();s.has(c)||s.set(c,[]),s.get(c).push(l)}for(let[l,c]of s){let u=A.parse(l),p=new FB(u,c);c.sort((g,f)=>g.lineNumber-f.lineNumber);let h=c.map(g=>({element:g,incompressible:!1}));n.push({element:p,incompressible:!1,collapsed:this.collapsedState.has(p.getId()),children:h})}}else for(let s of r)n.push({element:s,incompressible:!0});for(let s of e.getInstructionBreakpoints())n.push({element:s,incompressible:!0});return n}get flatElements(){let e=this.debugService.getModel(),t=this.debugService.getViewModel().focusedSession?.getId();return e.getExceptionBreakpointsForSession(t).concat(e.getFunctionBreakpoints()).concat(e.getDataBreakpoints()).concat(e.getBreakpoints()).concat(e.getInstructionBreakpoints())}};KAe=I([m(1,ze),m(2,Li),m(3,_e),m(4,F),m(5,De),m(6,ee),m(7,_n),m(8,B),m(9,Ri),m(10,X),m(11,Qe),m(12,ot),m(13,qt),m(14,tt),m(15,kt)],KAe);var Gki=class{constructor(i){this.view=i}getHeight(i){return 22}getTemplateId(i){if(i instanceof FB)return ute.ID;if(i instanceof wv)return pte.ID;if(i instanceof tI){let e=this.view.inputBoxData?.breakpoint;return!i.name||e&&e.getId()===i.getId()?hUt.ID:mte.ID}if(i instanceof SP){let e=this.view.inputBoxData?.breakpoint;return e&&e.getId()===i.getId()?fUt.ID:mUt.ID}if(i instanceof ZI){let e=this.view.inputBoxData?.breakpoint;return e&&e.getId()===i.getId()?gUt.ID:hte.ID}return i instanceof iI?gte.ID:""}},Mtt=new Map,ute=class{constructor(i,e,t){this.debugService=i;this.labelService=e;this.hoverService=t}static{this.ID="breakpointFolder"}get templateId(){return ute.ID}renderTemplate(i){let e=Object.create(null);return e.elementDisposables=new P,e.templateDisposables=new P,e.templateDisposables.add(e.elementDisposables),e.container=i,i.classList.add("breakpoint","breakpoint-folder"),e.templateDisposables.add(Z(()=>{i.classList.remove("breakpoint","breakpoint-folder")})),e.checkbox=new v7("",!1,kf),e.checkbox.domNode.tabIndex=-1,e.templateDisposables.add(e.checkbox),e.templateDisposables.add(e.checkbox.onChange(()=>{let t=e.checkbox.checked,o=t==="mixed"?!0:t;for(let n of e.context.breakpoints)this.debugService.enableOrDisableBreakpoints(o,n)})),R(e.container,e.checkbox.domNode),e.name=R(e.container,vd("span.name")),R(e.container,vd("span.file-path")),e.actionBar=new ji(e.container),e.templateDisposables.add(e.actionBar),e}renderElement(i,e,t){let o=i.element;t.context=o,t.name.textContent=this.labelService.getUriBasenameLabel(o.uri),t.container.classList.toggle("disabled",!this.debugService.getModel().areBreakpointsActivated());let n=this.labelService.getUriLabel(o.uri,{relative:!0});t.elementDisposables.add(this.hoverService.setupManagedHover(Ni("mouse"),t.container,n)),o.indeterminate?t.checkbox.checked="mixed":t.checkbox.checked=o.enabled,t.actionBar.clear();let r=t.elementDisposables.add(new st("debug.removeBreakpointsInFile",d(8687,null),q.asClassName(M.close),!0,async()=>{for(let s of o.breakpoints)await this.debugService.removeBreakpoints(s.getId())}));t.actionBar.push(r,{icon:!0,label:!1})}renderCompressedElements(i,e,t){let o=i.element.elements,n=o[o.length-1];t.context=n;let r=o.map(c=>Ra(c.uri));t.name.textContent=r.join("/");let s=this.labelService.getUriLabel(n.uri,{relative:!0});t.elementDisposables.add(this.hoverService.setupManagedHover(Ni("mouse"),t.container,s)),n.indeterminate?t.checkbox.checked="mixed":t.checkbox.checked=n.enabled,t.actionBar.clear();let l=t.elementDisposables.add(new st("debug.removeBreakpointsInFile",d(8687,null),q.asClassName(M.close),!0,async()=>{for(let c of n.breakpoints)await this.debugService.removeBreakpoints(c.getId())}));t.actionBar.push(l,{icon:!0,label:!1})}disposeElement(i,e,t){t.elementDisposables.clear()}disposeCompressedElements(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.templateDisposables.dispose()}};ute=I([m(0,Li),m(1,ot),m(2,tt)],ute);var pte=class{constructor(i,e,t,o,n,r,s,l){this.menu=i;this.breakpointHasMultipleModes=e;this.breakpointSupportsCondition=t;this.breakpointItemType=o;this.debugService=n;this.hoverService=r;this.labelService=s;this.textModelService=l}static{this.ID="breakpoints"}get templateId(){return pte.ID}renderTemplate(i){let e=Object.create(null);e.elementDisposables=new P,e.templateDisposables=new P,e.templateDisposables.add(e.elementDisposables),e.breakpoint=i,i.classList.add("breakpoint"),e.templateDisposables.add(Z(()=>{i.classList.remove("breakpoint")})),e.icon=vd(".icon"),e.checkbox=fte(e.templateDisposables),e.templateDisposables.add(e.checkbox.onChange(()=>{this.debugService.enableOrDisableBreakpoints(!e.context.enabled,e.context)})),R(e.breakpoint,e.icon),R(e.breakpoint,e.checkbox.domNode),e.name=R(e.breakpoint,vd("span.name")),e.filePath=R(e.breakpoint,vd("span.file-path")),e.actionBar=new ji(e.breakpoint),e.templateDisposables.add(e.actionBar);let t=R(e.breakpoint,vd(".badge-container"));return e.badge=R(t,vd("span.line-number.monaco-count-badge")),e}renderElement(i,e,t){let o=i.element;t.context=o,i.depth>1?this.renderBreakpointLineLabel(o,t):this.renderBreakpointFileLabel(o,t),this.renderBreakpointCommon(o,t)}renderCompressedElements(i,e,t){let o=i.element.elements[i.element.elements.length-1];t.context=o,this.renderBreakpointFileLabel(o,t),this.renderBreakpointCommon(o,t)}renderBreakpointCommon(i,e){e.breakpoint.classList.toggle("disabled",!this.debugService.getModel().areBreakpointsActivated());let t=i.lineNumber.toString();i.column&&(t+=`:${i.column}`),i.modeLabel&&(t=`${i.modeLabel}: ${t}`),e.badge.textContent=t,e.checkbox.checked=i.enabled;let{message:o,icon:n}=I2(this.debugService.state,this.debugService.getModel().areBreakpointsActivated(),i,this.labelService,this.debugService.getModel());e.icon.className=q.asClassName(n),e.elementDisposables.add(this.hoverService.setupManagedHover(Ni("mouse"),e.breakpoint,i.message||o||"")),(this.debugService.state===3||this.debugService.state===2)&&!i.verified&&e.breakpoint.classList.add("disabled");let s=this.debugService.getViewModel().focusedSession;this.breakpointSupportsCondition.set(!s||!!s.capabilities.supportsConditionalBreakpoints),this.breakpointItemType.set("breakpoint"),this.breakpointHasMultipleModes.set(this.debugService.getModel().getBreakpointModes("source").length>1);let{primary:l}=hl(this.menu.getActions({arg:i,shouldForwardArgs:!0}),"inline");e.actionBar.clear(),e.actionBar.push(l,{icon:!0,label:!1}),Mtt.set(i.getId(),e.actionBar.domNode)}renderBreakpointFileLabel(i,e){e.name.textContent=Ra(i.uri),e.filePath.textContent=this.labelService.getUriLabel(ci(i.uri),{relative:!0})}renderBreakpointLineLabel(i,e){e.name.textContent=d(8676,null),e.filePath.textContent="",this.textModelService.createModelReference(i.uri).then(t=>{if(e.context!==i){t.dispose();return}e.elementDisposables.add(t);let o=t.object.textEditorModel;if(o&&i.lineNumber<=o.getLineCount()){let n=o.getLineContent(i.lineNumber).trim();e.name.textContent=n||d(8655,null)}else e.name.textContent=d(8675,null)}).catch(()=>{e.context===i&&(e.name.textContent=d(8631,null))})}disposeElement(i,e,t){t.elementDisposables.clear()}disposeCompressedElements(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.templateDisposables.dispose()}};pte=I([m(4,Li),m(5,tt),m(6,ot),m(7,Nt)],pte);var mUt=class a{constructor(i,e,t,o,n,r){this.menu=i;this.breakpointHasMultipleModes=e;this.breakpointSupportsCondition=t;this.breakpointItemType=o;this.debugService=n;this.hoverService=r}static{this.ID="exceptionbreakpoints"}get templateId(){return a.ID}renderTemplate(i){let e=Object.create(null);e.elementDisposables=new P,e.templateDisposables=new P,e.templateDisposables.add(e.elementDisposables),e.breakpoint=R(i,vd(".breakpoint")),e.checkbox=fte(e.templateDisposables),e.templateDisposables.add(e.checkbox.onChange(()=>{this.debugService.enableOrDisableBreakpoints(!e.context.enabled,e.context)})),R(e.breakpoint,e.checkbox.domNode),e.name=R(e.breakpoint,vd("span.name")),e.condition=R(e.breakpoint,vd("span.condition")),e.breakpoint.classList.add("exception"),e.actionBar=new ji(e.breakpoint),e.templateDisposables.add(e.actionBar);let t=R(e.breakpoint,vd(".badge-container"));return e.badge=R(t,vd("span.line-number.monaco-count-badge")),e}renderElement(i,e,t){let o=i.element;this.renderExceptionBreakpoint(o,t)}renderCompressedElements(i,e,t){let o=i.element.elements[i.element.elements.length-1];this.renderExceptionBreakpoint(o,t)}renderExceptionBreakpoint(i,e){e.context=i,e.name.textContent=i.label||`${i.filter} exceptions`;let t=i.verified?i.description||e.name.textContent:i.message||d(8692,null);e.elementDisposables.add(this.hoverService.setupManagedHover(Ni("mouse"),e.breakpoint,t)),e.breakpoint.classList.toggle("disabled",!i.verified),e.checkbox.checked=i.enabled,e.condition.textContent=i.condition||"",e.elementDisposables.add(this.hoverService.setupManagedHover(Ni("mouse"),e.condition,d(8661,null,i.condition))),i.modeLabel?(e.badge.textContent=i.modeLabel,e.badge.style.display="block"):e.badge.style.display="none",this.breakpointSupportsCondition.set(i.supportsCondition),this.breakpointItemType.set("exceptionBreakpoint"),this.breakpointHasMultipleModes.set(this.debugService.getModel().getBreakpointModes("exception").length>1);let{primary:o}=hl(this.menu.getActions({arg:i,shouldForwardArgs:!0}),"inline");e.actionBar.clear(),e.actionBar.push(o,{icon:!0,label:!1}),Mtt.set(i.getId(),e.actionBar.domNode)}disposeElement(i,e,t){t.elementDisposables.clear()}disposeCompressedElements(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.templateDisposables.dispose()}},mte=class{constructor(i,e,t,o,n,r){this.menu=i;this.breakpointSupportsCondition=e;this.breakpointItemType=t;this.debugService=o;this.hoverService=n;this.labelService=r}static{this.ID="functionbreakpoints"}get templateId(){return mte.ID}renderTemplate(i){let e=Object.create(null);e.elementDisposables=new P,e.templateDisposables=new P,e.templateDisposables.add(e.elementDisposables),e.breakpoint=R(i,vd(".breakpoint")),e.icon=vd(".icon"),e.checkbox=fte(e.templateDisposables),e.templateDisposables.add(e.checkbox.onChange(()=>{this.debugService.enableOrDisableBreakpoints(!e.context.enabled,e.context)})),R(e.breakpoint,e.icon),R(e.breakpoint,e.checkbox.domNode),e.name=R(e.breakpoint,vd("span.name")),e.condition=R(e.breakpoint,vd("span.condition")),e.actionBar=new ji(e.breakpoint),e.templateDisposables.add(e.actionBar);let t=R(e.breakpoint,vd(".badge-container"));return e.badge=R(t,vd("span.line-number.monaco-count-badge")),e}renderElement(i,e,t){this.renderFunctionBreakpoint(i.element,t)}renderCompressedElements(i,e,t){this.renderFunctionBreakpoint(i.element.elements[i.element.elements.length-1],t)}renderFunctionBreakpoint(i,e){e.context=i,e.name.textContent=i.name;let{icon:t,message:o}=I2(this.debugService.state,this.debugService.getModel().areBreakpointsActivated(),i,this.labelService,this.debugService.getModel());e.icon.className=q.asClassName(t),e.elementDisposables.add(this.hoverService.setupManagedHover(Ni("mouse"),e.icon,o||"")),e.checkbox.checked=i.enabled,e.elementDisposables.add(this.hoverService.setupManagedHover(Ni("mouse"),e.breakpoint,o||"")),i.condition&&i.hitCondition?e.condition.textContent=d(8660,null,i.condition,i.hitCondition):e.condition.textContent=i.condition||i.hitCondition||"",i.modeLabel?(e.badge.textContent=i.modeLabel,e.badge.style.display="block"):e.badge.style.display="none";let n=this.debugService.getViewModel().focusedSession;e.breakpoint.classList.toggle("disabled",n&&!n.capabilities.supportsFunctionBreakpoints||!this.debugService.getModel().areBreakpointsActivated()),n&&!n.capabilities.supportsFunctionBreakpoints&&e.elementDisposables.add(this.hoverService.setupManagedHover(Ni("mouse"),e.breakpoint,d(8669,null))),this.breakpointSupportsCondition.set(!n||!!n.capabilities.supportsConditionalBreakpoints),this.breakpointItemType.set("functionBreakpoint");let{primary:r}=hl(this.menu.getActions({arg:i,shouldForwardArgs:!0}),"inline");e.actionBar.clear(),e.actionBar.push(r,{icon:!0,label:!1}),Mtt.set(i.getId(),e.actionBar.domNode)}disposeElement(i,e,t){t.elementDisposables.clear()}disposeCompressedElements(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.templateDisposables.dispose()}};mte=I([m(3,Li),m(4,tt),m(5,ot)],mte);var hte=class{constructor(i,e,t,o,n,r,s,l){this.menu=i;this.breakpointHasMultipleModes=e;this.breakpointSupportsCondition=t;this.breakpointItemType=o;this.breakpointIsDataBytes=n;this.debugService=r;this.hoverService=s;this.labelService=l}static{this.ID="databreakpoints"}get templateId(){return hte.ID}renderTemplate(i){let e=Object.create(null);e.breakpoint=R(i,vd(".breakpoint")),e.elementDisposables=new P,e.templateDisposables=new P,e.templateDisposables.add(e.elementDisposables),e.icon=vd(".icon"),e.checkbox=fte(e.templateDisposables),e.templateDisposables.add(e.checkbox.onChange(()=>{this.debugService.enableOrDisableBreakpoints(!e.context.enabled,e.context)})),R(e.breakpoint,e.icon),R(e.breakpoint,e.checkbox.domNode),e.name=R(e.breakpoint,vd("span.name")),e.accessType=R(e.breakpoint,vd("span.access-type")),e.condition=R(e.breakpoint,vd("span.condition")),e.actionBar=new ji(e.breakpoint),e.templateDisposables.add(e.actionBar);let t=R(e.breakpoint,vd(".badge-container"));return e.badge=R(t,vd("span.line-number.monaco-count-badge")),e}renderElement(i,e,t){this.renderDataBreakpoint(i.element,t)}renderCompressedElements(i,e,t){this.renderDataBreakpoint(i.element.elements[i.element.elements.length-1],t)}renderDataBreakpoint(i,e){e.context=i,e.name.textContent=i.description;let{icon:t,message:o}=I2(this.debugService.state,this.debugService.getModel().areBreakpointsActivated(),i,this.labelService,this.debugService.getModel());e.icon.className=q.asClassName(t),e.elementDisposables.add(this.hoverService.setupManagedHover(Ni("mouse"),e.icon,o||"")),e.checkbox.checked=i.enabled,e.elementDisposables.add(this.hoverService.setupManagedHover(Ni("mouse"),e.breakpoint,o||"")),i.modeLabel?(e.badge.textContent=i.modeLabel,e.badge.style.display="block"):e.badge.style.display="none";let n=this.debugService.getViewModel().focusedSession;if(e.breakpoint.classList.toggle("disabled",n&&!n.capabilities.supportsDataBreakpoints||!this.debugService.getModel().areBreakpointsActivated()),n&&!n.capabilities.supportsDataBreakpoints&&e.elementDisposables.add(this.hoverService.setupManagedHover(Ni("mouse"),e.breakpoint,d(8644,null))),i.accessType){let s=i.accessType==="read"?d(8683,null):i.accessType==="write"?d(8694,null):d(8623,null);e.accessType.textContent=s}else e.accessType.textContent="";i.condition&&i.hitCondition?e.condition.textContent=d(8660,null,i.condition,i.hitCondition):e.condition.textContent=i.condition||i.hitCondition||"",this.breakpointSupportsCondition.set(!n||!!n.capabilities.supportsConditionalBreakpoints),this.breakpointHasMultipleModes.set(this.debugService.getModel().getBreakpointModes("data").length>1),this.breakpointItemType.set("dataBreakpoint"),this.breakpointIsDataBytes.set(i.src.type===1);let{primary:r}=hl(this.menu.getActions({arg:i,shouldForwardArgs:!0}),"inline");e.actionBar.clear(),e.actionBar.push(r,{icon:!0,label:!1}),Mtt.set(i.getId(),e.actionBar.domNode),this.breakpointIsDataBytes.reset()}disposeElement(i,e,t){t.elementDisposables.clear()}disposeCompressedElements(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.templateDisposables.dispose()}};hte=I([m(5,Li),m(6,tt),m(7,ot)],hte);var gte=class{constructor(i,e,t){this.debugService=i;this.hoverService=e;this.labelService=t}static{this.ID="instructionBreakpoints"}get templateId(){return gte.ID}renderTemplate(i){let e=Object.create(null);e.elementDisposables=new P,e.templateDisposables=new P,e.templateDisposables.add(e.elementDisposables),e.breakpoint=R(i,vd(".breakpoint")),e.icon=vd(".icon"),e.checkbox=fte(e.templateDisposables),e.templateDisposables.add(e.checkbox.onChange(()=>{this.debugService.enableOrDisableBreakpoints(!e.context.enabled,e.context)})),R(e.breakpoint,e.icon),R(e.breakpoint,e.checkbox.domNode),e.name=R(e.breakpoint,vd("span.name")),e.address=R(e.breakpoint,vd("span.file-path")),e.actionBar=new ji(e.breakpoint),e.templateDisposables.add(e.actionBar);let t=R(e.breakpoint,vd(".badge-container"));return e.badge=R(t,vd("span.line-number.monaco-count-badge")),e}renderElement(i,e,t){this.renderInstructionBreakpoint(i.element,t)}renderCompressedElements(i,e,t){this.renderInstructionBreakpoint(i.element.elements[i.element.elements.length-1],t)}renderInstructionBreakpoint(i,e){e.context=i,e.breakpoint.classList.toggle("disabled",!this.debugService.getModel().areBreakpointsActivated()),e.name.textContent="0x"+i.address.toString(16),e.elementDisposables.add(this.hoverService.setupManagedHover(Ni("mouse"),e.name,d(8646,null,i.address.toString()))),e.checkbox.checked=i.enabled;let{message:t,icon:o}=I2(this.debugService.state,this.debugService.getModel().areBreakpointsActivated(),i,this.labelService,this.debugService.getModel());e.icon.className=q.asClassName(o),e.elementDisposables.add(this.hoverService.setupManagedHover(Ni("mouse"),e.breakpoint,i.message||t||"")),(this.debugService.state===3||this.debugService.state===2)&&!i.verified&&e.breakpoint.classList.add("disabled"),i.modeLabel?(e.badge.textContent=i.modeLabel,e.badge.style.display="block"):e.badge.style.display="none"}disposeElement(i,e,t){t.elementDisposables.clear()}disposeCompressedElements(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.templateDisposables.dispose()}};gte=I([m(0,Li),m(1,tt),m(2,ot)],gte);var hUt=class a{constructor(i,e,t,o,n){this.view=i;this.debugService=e;this.contextViewService=t;this.hoverService=o;this.labelService=n}static{this.ID="functionbreakpointinput"}get templateId(){return a.ID}renderTemplate(i){let e=Object.create(null),t=new P,o=R(i,vd(".breakpoint"));e.icon=vd(".icon"),e.checkbox=fte(t),R(o,e.icon),R(o,e.checkbox.domNode),this.view.breakpointInputFocused.set(!0);let n=R(o,vd(".inputBoxContainer")),r=new Dc(n,this.contextViewService,{inputBoxStyles:pl});t.add(r);let s=l=>{e.updating=!0;try{this.view.breakpointInputFocused.set(!1);let c=e.breakpoint.getId();l?(e.type==="name"&&this.debugService.updateFunctionBreakpoint(c,{name:r.value}),e.type==="condition"&&this.debugService.updateFunctionBreakpoint(c,{condition:r.value}),e.type==="hitCount"&&this.debugService.updateFunctionBreakpoint(c,{hitCondition:r.value})):e.type==="name"&&!e.breakpoint.name?this.debugService.removeFunctionBreakpoints(c):this.view.renderInputBox(void 0)}finally{e.updating=!1}};return t.add(Vo(r.inputElement,"keydown",l=>{let c=l.equals(9),u=l.equals(3);(c||u)&&(l.preventDefault(),l.stopPropagation(),s(u))})),t.add(j(r.inputElement,"blur",()=>{e.updating||s(!!r.value)})),e.inputBox=r,e.elementDisposables=new P,e.templateDisposables=t,e.templateDisposables.add(e.elementDisposables),e}renderElement(i,e,t){let o=i.element;t.breakpoint=o,t.type=this.view.inputBoxData?.type||"name";let{icon:n,message:r}=I2(this.debugService.state,this.debugService.getModel().areBreakpointsActivated(),o,this.labelService,this.debugService.getModel());t.icon.className=q.asClassName(n),t.elementDisposables.add(this.hoverService.setupManagedHover(Ni("mouse"),t.icon,r||"")),t.checkbox.checked=o.enabled,t.checkbox.disable(),t.inputBox.value=o.name||"";let s=d(8668,null),l=d(8667,null);t.type==="condition"?(t.inputBox.value=o.condition||"",s=d(8664,null),l=d(8663,null)):t.type==="hitCount"&&(t.inputBox.value=o.hitCondition||"",s=d(8666,null),l=d(8665,null)),t.inputBox.setAriaLabel(l),t.inputBox.setPlaceHolder(s),setTimeout(()=>{t.inputBox.focus(),t.inputBox.select()},0)}renderCompressedElements(i,e,t){}disposeElement(i,e,t){t.elementDisposables.clear()}disposeCompressedElements(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.templateDisposables.dispose()}},gUt=class a{constructor(i,e,t,o,n){this.view=i;this.debugService=e;this.contextViewService=t;this.hoverService=o;this.labelService=n}static{this.ID="databreakpointinput"}get templateId(){return a.ID}renderTemplate(i){let e=Object.create(null),t=new P,o=R(i,vd(".breakpoint"));e.icon=vd(".icon"),e.checkbox=fte(t),R(o,e.icon),R(o,e.checkbox.domNode),this.view.breakpointInputFocused.set(!0);let n=R(o,vd(".inputBoxContainer")),r=new Dc(n,this.contextViewService,{inputBoxStyles:pl});t.add(r);let s=l=>{e.updating=!0;try{this.view.breakpointInputFocused.set(!1);let c=e.breakpoint.getId();l?(e.type==="condition"&&this.debugService.updateDataBreakpoint(c,{condition:r.value}),e.type==="hitCount"&&this.debugService.updateDataBreakpoint(c,{hitCondition:r.value})):this.view.renderInputBox(void 0)}finally{e.updating=!1}};return t.add(Vo(r.inputElement,"keydown",l=>{let c=l.equals(9),u=l.equals(3);(c||u)&&(l.preventDefault(),l.stopPropagation(),s(u))})),t.add(j(r.inputElement,"blur",()=>{e.updating||s(!!r.value)})),e.inputBox=r,e.elementDisposables=new P,e.templateDisposables=t,e.templateDisposables.add(e.elementDisposables),e}renderElement(i,e,t){let o=i.element;t.breakpoint=o,t.type=this.view.inputBoxData?.type||"condition";let{icon:n,message:r}=I2(this.debugService.state,this.debugService.getModel().areBreakpointsActivated(),o,this.labelService,this.debugService.getModel());t.icon.className=q.asClassName(n),t.elementDisposables.add(this.hoverService.setupManagedHover(Ni("mouse"),t.icon,r??"")),t.checkbox.checked=o.enabled,t.checkbox.disable(),t.inputBox.value="";let s="",l="";t.type==="condition"?(t.inputBox.value=o.condition||"",s=d(8639,null),l=d(8638,null)):t.type==="hitCount"&&(t.inputBox.value=o.hitCondition||"",s=d(8641,null),l=d(8640,null)),t.inputBox.setAriaLabel(l),t.inputBox.setPlaceHolder(s),setTimeout(()=>{t.inputBox.focus(),t.inputBox.select()},0)}renderCompressedElements(i,e,t){}disposeElement(i,e,t){t.elementDisposables.clear()}disposeCompressedElements(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.templateDisposables.dispose()}},fUt=class a{constructor(i,e,t){this.view=i;this.debugService=e;this.contextViewService=t}static{this.ID="exceptionbreakpointinput"}get templateId(){return a.ID}renderTemplate(i){let e=new P,t=R(i,vd(".breakpoint"));t.classList.add("exception");let o=fte(e);R(t,o.domNode),this.view.breakpointInputFocused.set(!0);let n=R(t,vd(".inputBoxContainer")),r=new Dc(n,this.contextViewService,{ariaLabel:d(8657,null),inputBoxStyles:pl});e.add(r);let s=u=>{if(!c.currentBreakpoint)return;this.view.breakpointInputFocused.set(!1);let p=c.currentBreakpoint.condition;u&&(p=r.value!==""?r.value:void 0),this.debugService.setExceptionBreakpointCondition(c.currentBreakpoint,p)};e.add(Vo(r.inputElement,"keydown",u=>{let p=u.equals(9),h=u.equals(3);(p||h)&&(u.preventDefault(),u.stopPropagation(),s(h))})),e.add(j(r.inputElement,"blur",()=>{setTimeout(()=>{s(!0)})}));let l=new P;e.add(l);let c={inputBox:r,checkbox:o,templateDisposables:e,elementDisposables:new P};return c}renderElement(i,e,t){let o=i.element,n=o.conditionDescription||d(8658,null);t.inputBox.setPlaceHolder(n),t.currentBreakpoint=o,t.checkbox.checked=o.enabled,t.checkbox.disable(),t.inputBox.value=o.condition||"",setTimeout(()=>{t.inputBox.focus(),t.inputBox.select()},0)}renderCompressedElements(i,e,t){}disposeElement(i,e,t){t.elementDisposables.clear()}disposeCompressedElements(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.templateDisposables.dispose()}},$ki=class{constructor(i,e){this.debugService=i;this.labelService=e}getWidgetAriaLabel(){return d(8629,null)}getRole(){return"checkbox"}isChecked(i){return i instanceof FB,i.enabled}getAriaLabel(i){if(i instanceof FB)return d(8628,null,Ra(i.uri),i.breakpoints.length);if(i instanceof SP)return i.toString();let{message:e}=I2(this.debugService.state,this.debugService.getModel().areBreakpointsActivated(),i,this.labelService,this.debugService.getModel()),t=i.toString();return e?`${t}, ${e}`:t}};function GAe(a,i,e,t,o,n){if(a.uri.scheme===vC&&o.state===0)return Promise.resolve(void 0);let r=a.endLineNumber?{startLineNumber:a.lineNumber,endLineNumber:a.endLineNumber,startColumn:a.column||1,endColumn:a.endColumn||1073741824}:{startLineNumber:a.lineNumber,startColumn:a.column||1,endLineNumber:a.lineNumber,endColumn:a.column||1073741824};return n.openEditor({resource:a.uri,options:{preserveFocus:e,selection:r,revealIfOpened:!0,selectionRevealType:1,pinned:t}},i?vn:Un)}function I2(a,i,e,t,o){let n=a===3||a===2,r=e instanceof ZI?Xyi:e instanceof tI?Qyi:e.logMessage?KWt:zF;if(!e.enabled||!i)return{icon:r.disabled,message:e.logMessage?d(8649,null):d(8648,null)};let s=u=>e.message?u.concat(", "+e.message):u;if(n&&e instanceof wv&&e.pending)return{icon:zF.pending};if(n&&!e.verified)return{icon:r.unverified,message:e.message?e.message:e.logMessage?d(8693,null):d(8691,null),showAdapterUnverifiedMessage:!0};if(e instanceof ZI)return e.supported?{icon:r.regular,message:e.message||d(8632,null)}:{icon:r.unverified,message:d(8645,null)};if(e instanceof tI){if(!e.supported)return{icon:r.unverified,message:d(8670,null)};let u=[];return u.push(e.message||d(8662,null)),e.condition&&u.push(d(8659,null,e.condition)),e.hitCondition&&u.push(d(8671,null,e.hitCondition)),{icon:r.regular,message:s(u.join(`
`))}}if(e instanceof iI){if(!e.supported)return{icon:r.unverified,message:d(8674,null)};let u=[];return e.message?u.push(e.message):e.instructionReference?u.push(d(8673,null,e.instructionReference)):u.push(d(8672,null)),e.hitCondition&&u.push(d(8671,null,e.hitCondition)),{icon:r.regular,message:s(u.join(`
`))}}let l;if(e instanceof wv&&e.triggeredBy&&(l=o.getBreakpoints().find(u=>u.getId()===e.triggeredBy)),e.logMessage||e.condition||e.hitCondition||l){let u=[],p=e.logMessage?KWt.regular:Yyi.regular;return e.supported||(p=GWt,u.push(d(8630,null))),e.logMessage&&u.push(d(8677,null,e.logMessage)),e.condition&&u.push(d(8659,null,e.condition)),e.hitCondition&&u.push(d(8671,null,e.hitCondition)),l&&u.push(d(8690,null,`${t.getUriLabel(l.uri,{relative:!0})}: ${l.lineNumber}`)),{icon:p,message:s(u.join(`
`))}}let c=e.message?e.message:e instanceof wv&&t?t.getUriLabel(e.uri):d(8627,null);return{icon:r.regular,message:c}}W(class extends K{constructor(){super({id:"workbench.debug.viewlet.action.addFunctionBreakpointAction",title:{...L(8626,"Add Function Breakpoint"),mnemonicTitle:d(8681,null)},f1:!0,icon:Ulo,menu:[{id:D.ViewTitle,group:"navigation",order:10,when:x.equals("view",Xx)},{id:D.MenubarNewBreakpointMenu,group:"1_breakpoints",order:3,when:fa}]})}async run(a){let i=a.get(Li);await a.get(Ft).openView(Xx),i.addFunctionBreakpoint()}});var vUt=class extends K{async run(i,e){let t=i.get(Li),o=t.getViewModel().focusedSession;if(!o)return;let n;e&&e.src.type===1&&(n=`${e.src.address} + ${e.src.bytes}`);let r=i.get(Ge),s=i.get(Ne),l=await this.getRange(r,n);if(!l)return;let c;try{c=await o.dataBytesBreakpointInfo(l.address,l.bytes)}catch(h){s.error(d(8637,null,l.address,h.message))}if(!c?.dataId)return;let u="write";if(c.accessTypes&&c.accessTypes?.length>1){let h=c.accessTypes.map(f=>({label:f})),g=await r.pick(h,{placeHolder:d(8633,null)});if(!g)return;u=g.label}let p={type:1,...l};e&&await t.removeDataBreakpoints(e.getId()),await t.addDataBreakpoint({description:c.description,src:p,canPersist:!0,accessTypes:c.accessTypes,accessType:u,initialSessionData:{session:o,dataId:c.dataId}})}getRange(i,e){return new Promise(t=>{let o=new P,n=o.add(i.createInputBox());n.prompt=d(8643,null),n.placeholder=d(8642,null),e&&(n.value=e,n.valueSelection=[0,e.length]),o.add(n.onDidChangeValue(r=>{let s=this.parseAddress(r,!1);n.validationMessage=s?.error})),o.add(n.onDidAccept(()=>{let r=this.parseAddress(n.value,!0);Wo(r,{error:!0})?n.validationMessage=r.error:t(r),n.dispose()})),o.add(n.onDidHide(()=>{t(void 0),o.dispose()})),n.ignoreFocusOut=!0,n.show()})}parseAddress(i,e){let t=/^(\S+)\s*(?:([+-])\s*(\S+))?/.exec(i);if(!t)return{error:d(8634,null)};let o=p=>e?/^0x[0-9a-f]*|[0-9]*$/i.test(p):/^0x[0-9a-f]+|[0-9]+$/i.test(p),[,n,r="+",s="1"]=t;for(let p of[n,s])if(!o(p))return{error:d(8636,null,p)};if(!e)return;let l=BigInt(n),c=BigInt(s),u=`0x${l.toString(16)}`;return r==="-"?l>c?{error:d(8635,null,n,s)}:{address:u,bytes:Number(c-l)}:{address:u,bytes:Number(c)}}};W(class extends vUt{constructor(){super({id:"workbench.debug.viewlet.action.addDataBreakpointOnAddress",title:{...L(8625,"Add Data Breakpoint at Address"),mnemonicTitle:d(8678,null)},f1:!0,icon:zlo,menu:[{id:D.ViewTitle,group:"navigation",order:11,when:x.and(xke,x.equals("view",Xx))},{id:D.MenubarNewBreakpointMenu,group:"1_breakpoints",order:4,when:xke}]})}});W(class extends vUt{constructor(){super({id:"workbench.debug.viewlet.action.editDataBreakpointOnAddress",title:L(8652,"Edit Address..."),menu:[{id:D.DebugBreakpointsContext,when:x.and(xke,Gdi),group:"navigation",order:15}]})}});W(class extends K{constructor(){super({id:"workbench.debug.viewlet.action.toggleBreakpointsActivatedAction",title:L(8624,"Toggle Activate Breakpoints"),f1:!0,icon:Glo,menu:{id:D.ViewTitle,group:"navigation",order:20,when:x.equals("view",Xx)}})}run(a){let i=a.get(Li);i.setBreakpointsActivated(!i.getModel().areBreakpointsActivated())}});W(class extends K{constructor(){super({id:"workbench.debug.viewlet.action.removeBreakpoint",title:d(8686,null),icon:M.removeClose,menu:[{id:D.DebugBreakpointsContext,group:"3_modification",order:10,when:O_.notEqualsTo("exceptionBreakpoint")},{id:D.DebugBreakpointsContext,group:"inline",order:20,when:O_.notEqualsTo("exceptionBreakpoint")}]})}async run(a,i){let e=a.get(Li);i instanceof wv?await e.removeBreakpoints(i.getId()):i instanceof tI?await e.removeFunctionBreakpoints(i.getId()):i instanceof ZI?await e.removeDataBreakpoints(i.getId()):i instanceof iI&&await e.removeInstructionBreakpoints(i.instructionReference,i.offset)}});W(class extends K{constructor(){super({id:"workbench.debug.viewlet.action.removeAllBreakpoints",title:{...L(8685,"Remove All Breakpoints"),mnemonicTitle:d(8682,null)},f1:!0,icon:Klo,menu:[{id:D.ViewTitle,group:"navigation",order:30,when:x.equals("view",Xx)},{id:D.DebugBreakpointsContext,group:"3_modification",order:20,when:x.and(jj,O_.notEqualsTo("exceptionBreakpoint"))},{id:D.MenubarDebugMenu,group:"5_breakpoints",order:3,when:fa}]})}run(a){let i=a.get(Li);i.removeBreakpoints(),i.removeFunctionBreakpoints(),i.removeDataBreakpoints(),i.removeInstructionBreakpoints()}});W(class extends K{constructor(){super({id:"workbench.debug.viewlet.action.enableAllBreakpoints",title:{...L(8656,"Enable All Breakpoints"),mnemonicTitle:d(8680,null)},f1:!0,precondition:fa,menu:[{id:D.DebugBreakpointsContext,group:"z_commands",order:10,when:x.and(jj,O_.notEqualsTo("exceptionBreakpoint"))},{id:D.MenubarDebugMenu,group:"5_breakpoints",order:1,when:fa}]})}async run(a){await a.get(Li).enableOrDisableBreakpoints(!0)}});W(class extends K{constructor(){super({id:"workbench.debug.viewlet.action.disableAllBreakpoints",title:{...L(8647,"Disable All Breakpoints"),mnemonicTitle:d(8679,null)},f1:!0,precondition:fa,menu:[{id:D.DebugBreakpointsContext,group:"z_commands",order:20,when:x.and(jj,O_.notEqualsTo("exceptionBreakpoint"))},{id:D.MenubarDebugMenu,group:"5_breakpoints",order:2,when:fa}]})}async run(a){await a.get(Li).enableOrDisableBreakpoints(!1)}});W(class extends K{constructor(){super({id:"workbench.debug.viewlet.action.reapplyBreakpointsAction",title:L(8684,"Reapply All Breakpoints"),f1:!0,precondition:Xa,menu:[{id:D.DebugBreakpointsContext,group:"z_commands",order:30,when:x.and(jj,O_.notEqualsTo("exceptionBreakpoint"))}]})}async run(a){await a.get(Li).setBreakpointsActivated(!0)}});W(class extends K{constructor(){super({id:"workbench.debug.viewlet.action.toggleBreakpointsPresentation",title:L(8689,"Toggle Breakpoints View Presentation"),f1:!0,icon:zWt,menu:{id:D.ViewTitle,group:"navigation",order:10,when:x.equals("view",Xx)}})}async run(a){let i=a.get(B),t=i.getValue("debug.breakpointsView.presentation")==="tree"?"list":"tree";await i.updateValue("debug.breakpointsView.presentation",t)}});W(class extends Fn{constructor(){super({id:"debug.editBreakpoint",viewId:Xx,title:d(8651,null),icon:M.edit,precondition:t_t,menu:[{id:D.DebugBreakpointsContext,when:O_.notEqualsTo("functionBreakpoint"),group:"navigation",order:10},{id:D.DebugBreakpointsContext,group:"inline",order:10}]})}async runInView(a,i,e){let t=a.get(Li),o=a.get(ee);if(e instanceof wv){let n=await GAe(e,!1,!1,!0,t,o);if(n){let r=n.getControl();pn(r)&&r.getContribution(fP)?.showBreakpointWidget(e.lineNumber,e.column)}}else if(e instanceof tI){let n=a.get(ze),r=[new st("breakpoint.editCondition",d(8651,null),void 0,!0,async()=>i.renderInputBox({breakpoint:e,type:"condition"})),new st("breakpoint.editCondition",d(8653,null),void 0,!0,async()=>i.renderInputBox({breakpoint:e,type:"hitCount"}))],s=Mtt.get(e.getId());s&&n.showContextMenu({getActions:()=>r,getAnchor:()=>s,onHide:()=>Ue(r)})}else i.renderInputBox({breakpoint:e,type:"condition"})}});W(class extends Fn{constructor(){super({id:"debug.editFunctionBreakpoint",viewId:Xx,title:d(8650,null),menu:[{id:D.DebugBreakpointsContext,group:"navigation",order:10,when:O_.isEqualTo("functionBreakpoint")}]})}runInView(a,i,e){i.renderInputBox({breakpoint:e,type:"name"})}});W(class extends Fn{constructor(){super({id:"debug.editFunctionBreakpointHitCount",viewId:Xx,title:d(8653,null),precondition:t_t,menu:[{id:D.DebugBreakpointsContext,group:"navigation",order:20,when:x.or(O_.isEqualTo("functionBreakpoint"),O_.isEqualTo("dataBreakpoint"))}]})}runInView(a,i,e){i.renderInputBox({breakpoint:e,type:"hitCount"})}});W(class extends Fn{constructor(){super({id:"debug.editBreakpointMode",viewId:Xx,title:d(8654,null),menu:[{id:D.DebugBreakpointsContext,group:"navigation",order:20,when:x.and($di,x.or(O_.isEqualTo("breakpoint"),O_.isEqualTo("exceptionBreakpoint"),O_.isEqualTo("instructionBreakpoint")))}]})}async runInView(a,i,e){let t=a.get(Li),o=Fmo(e),n=t.getModel().getBreakpointModes(o),r=await a.get(Ge).pick(n.map(s=>({label:s.label,description:s.description,mode:s.mode})),{placeHolder:d(8688,null)});if(r)if(o==="source"){let s=new Map;s.set(e.getId(),{mode:r.mode,modeLabel:r.label}),t.updateBreakpoints(e.originalUri,s,!1)}else e instanceof iI?(t.removeInstructionBreakpoints(e.instructionReference,e.offset),t.addInstructionBreakpoint({...e.toJSON(),mode:r.mode,modeLabel:r.label})):e instanceof SP&&(e.mode=r.mode,e.modeLabel=r.label,t.setExceptionBreakpointCondition(e,e.condition))}});async function Vmo(a,i){let e=a.get(Ge),t=a.get(Li),o=a.get(Ft),n=a.get(ge),r=new P,s=e.createQuickPick({useSeparators:!0});r.add(s),s.matchOnLabel=s.matchOnDescription=s.matchOnDetail=s.sortByLabel=!1,s.placeholder=d(9047,null);let l=Wmo(s.value,i,t,o,n);s.items=l.picks,s.activeItems=l.activeItems,r.add(s.onDidChangeValue(async()=>{s.items=Wmo(s.value,i,t,o,n).picks})),r.add(s.onDidAccept(()=>{s.selectedItems[0].accept(),s.hide(),r.dispose()})),s.show()}function Wmo(a,i,e,t,o){let n=[],r=[],s=e.getViewModel().focusedSession,l=e.getModel().getSessions(!1),c=[];l.forEach(p=>{p.compact&&p.parentSession&&r.push(p.parentSession)}),l.forEach(p=>{let h=r.includes(p);if(p.parentSession||n.push({type:"separator",label:h?p.name:void 0}),!h){let g=P7o(p,a,e,t,o);g&&(n.push(g),p.getId()===s?.getId()&&c.push(g))}}),n.length&&n.push({type:"separator"});let u=d(9049,null);return n.push({label:`$(plus) ${u}`,ariaLabel:u,accept:()=>o.executeCommand(i)}),{picks:n,activeItems:c}}function M7o(a){let i=a.configuration.name.length?a.configuration.name:a.name,e=a.compact?void 0:a.parentSession?.configuration.name,t="",o="";return e&&(o=d(9048,null,i,e),t=e),{label:i,description:t,ariaLabel:o}}function P7o(a,i,e,t,o){let n=M7o(a),r=Up(i,n.label,!0);if(r)return{label:n.label,description:n.description,ariaLabel:n.ariaLabel,highlights:{label:r},accept:()=>{e.focusStackFrame(void 0,void 0,a,{explicit:!0}),t.isViewVisible(ld)||t.openView(ld,!0)}}}var nhe="debug.addConfiguration",bUt="editor.debug.action.copyAddress",SUt="editor.debug.action.toggleBreakpoint",Ptt="editor.debug.action.toggleInlineBreakpoint",jki="debug.copyStackTrace",Qki="workbench.action.debug.reverseContinue",Yki="workbench.action.debug.stepBack",y2="workbench.action.debug.restart",IUt="workbench.action.debug.terminateThread",w2="workbench.action.debug.stepOver",C2="workbench.action.debug.stepInto",Xki="workbench.action.debug.stepIntoTarget",x2="workbench.action.debug.stepOut",W3="workbench.action.debug.pause",GR="workbench.action.debug.disconnect",$Ae="workbench.action.debug.disconnectAndSuspend",uT="workbench.action.debug.stop",Jki="workbench.action.debug.restartFrame",k2="workbench.action.debug.continue",Bmo="workbench.debug.action.focusRepl",Att="debug.jumpToCursor",qAe="workbench.action.debug.focusProcess",V3="workbench.action.debug.selectandstart",yUt="workbench.action.debug.selectDebugConsole",Zki="workbench.action.debug.selectDebugSession",E2="workbench.action.debug.configure",d0="workbench.action.debug.start",Ntt="workbench.action.debug.run",eEi="debug.renameWatchExpression",Hmo="debug.copyWatchExpression",tEi="debug.setWatchExpression",iEi="debug.removeWatchExpression",oEi="workbench.action.debug.nextConsole",nEi="workbench.action.debug.prevConsole",rEi="workbench.action.debug.showLoadedScripts",sEi="workbench.action.debug.callStackTop",aEi="workbench.action.debug.callStackBottom",lEi="workbench.action.debug.callStackUp",cEi="workbench.action.debug.callStackDown",Ott="debug.addToWatchExpressions",vte="debug.copyEvaluatePath",B3="workbench.debug.viewlet.action.copyValue",Ftt="debug.breakWhenValueChanges",Wtt="debug.breakWhenValueIsAccessed",Vtt="debug.breakWhenValueIsRead",A7o="debug.toggleExceptionBreakpoints",N7o="debug.attachToCurrentCodeRenderer",bte=L(8892,"Debug"),Ste=L(8904,"Restart"),Ite=L(8914,"Step Over"),yte=L(8911,"Step Into"),Umo=L(8912,"Step Into Target"),wte=L(8913,"Step Out"),Cte=L(8902,"Pause"),H3=L(8893,"Disconnect"),Btt=L(8894,"Disconnect and Suspend"),T2=L(8915,"Stop"),xte=L(8888,"Continue"),zmo=L(8896,"Focus Session"),Kmo=L(8905,"Select and Start Debugging"),jAe=d(8900,null,"launch.json"),Htt=L(8909,"Start Debugging"),dEi=L(8910,"Start Without Debugging"),Gmo=L(8898,"Focus Next Debug Console"),$mo=L(8903,"Focus Previous Debug Console"),qmo=L(8901,"Open Loaded Script..."),jmo=L(8885,"Navigate to Top of Call Stack"),Qmo=L(8883,"Navigate to Bottom of Call Stack"),Ymo=L(8886,"Navigate Up Call Stack"),Xmo=L(8884,"Navigate Down Call Stack"),QAe=L(8890,"Copy as Expression"),Utt=L(8891,"Copy Value"),wUt=L(8889,"Copy Address"),ztt=L(8881,"Add to Watch"),Jmo=L(8906,"Select Debug Console"),Zmo=L(8907,"Select Debug Session"),Ktt="debug ",Gtt="debug consoles ",dT;function CUt(a){dT=a}function O7o(a){return a&&typeof a.sessionId=="string"&&typeof a.threadId=="string"}async function c0(a,i,e){let t=a.get(Li),o;if(O7o(i)){let n=t.getModel().getSession(i.sessionId);n&&(o=n.getAllThreads().find(r=>r.getId()===i.threadId))}else if(uEi(i)){let n=t.getModel().getSession(i.sessionId);if(n){let r=n.getAllThreads();o=r.length>0?r[0]:void 0}}if(!o&&(o=t.getViewModel().focusedThread,!o)){let n=t.getViewModel().focusedSession,r=n?n.getAllThreads():void 0;o=r&&r.length?r[0]:void 0}o&&await e(o)}function F7o(a){return a&&typeof a.sessionId=="string"&&typeof a.threadId=="string"&&typeof a.frameId=="string"}function eho(a,i){if(F7o(i)){let e=a.getModel().getSession(i.sessionId);if(e){let t=e.getAllThreads().find(o=>o.getId()===i.threadId);if(t)return t.getCallStack().find(o=>o.getId()===i.frameId)}}else return a.getViewModel().focusedStackFrame}function uEi(a){return a&&typeof a.sessionId=="string"}async function tho(a,i){let e=a.get(Li),t=a.get(Ft),o=e.getModel().getSessions(!0).filter(s=>s.hasSeparateRepl()),n=e.getViewModel().focusedSession,r=0;if(o.length>0&&n){for(;n&&!n.hasSeparateRepl();)n=n.parentSession;if(n){let s=o.indexOf(n);i?r=s===o.length-1?0:s+1:r=s===0?o.length-1:s-1}}await e.focusStackFrame(void 0,void 0,o[r],{explicit:!0}),t.isViewVisible(ld)||await t.openView(ld,!0)}async function iho(a,i){let e=a.getViewModel().focusedStackFrame;if(e){let t=e.thread.getCallStack(),o=t.findIndex(r=>r.frameId===e.frameId),n;if(i){if(o>=t.length-1)if(e.thread.reachedEndOfCallStack){nho(a);return}else await a.getModel().fetchCallstack(e.thread,20),t=e.thread.getCallStack(),o=t.findIndex(r=>r.frameId===e.frameId);n=qki(!0,t,o)}else{if(o<=0){oho(a);return}n=qki(!1,t,o)}n&&a.focusStackFrame(n,void 0,void 0,{preserveFocus:!1})}}async function oho(a){let i=a.getViewModel().focusedThread;if(i){await a.getModel().fetchCallstack(i);let e=i.getCallStack();if(e.length>0){let t=qki(!1,e,0);t&&a.focusStackFrame(t,void 0,void 0,{preserveFocus:!1})}}}function nho(a){let i=a.getViewModel().focusedThread;i&&a.focusStackFrame(i.getTopStackFrame(),void 0,void 0,{preserveFocus:!1})}function qki(a,i,e){e>=i.length?e=i.length-1:e<0&&(e=0);let t=e,o;do if(a?t===i.length-1?t=0:t++:t===0?t=i.length-1:t--,o=i[t],!kz(o))return o;while(t!==e)}qe.registerCommand({id:jki,handler:async(a,i,e)=>{let t=a.get(sL),o=a.get(Wi),n=a.get(Li),r=eho(n,e);if(r){let s=t.getEOL(r.source.uri);await o.writeText(r.thread.getCallStack().map(l=>l.toString()).join(s))}}});qe.registerCommand({id:Qki,handler:async(a,i,e)=>{await c0(a,e,t=>t.reverseContinue())}});qe.registerCommand({id:Yki,handler:async(a,i,e)=>{let t=a.get(X);xz.getValue(t)?await c0(a,e,o=>o.stepBack("instruction")):await c0(a,e,o=>o.stepBack())}});qe.registerCommand({id:IUt,handler:async(a,i,e)=>{await c0(a,e,t=>t.terminate())}});qe.registerCommand({id:Att,handler:async a=>{let e=a.get(Li).getViewModel().focusedStackFrame,o=a.get(ee).activeTextEditorControl,n=a.get(Ne),r=a.get(Ge);if(e&&pn(o)&&o.hasModel()){let s=o.getPosition(),l=o.getModel().uri,c=e.thread.session.getSourceForUri(l);if(c){let p=(await e.thread.session.gotoTargets(c.raw,s.lineNumber,s.column))?.body.targets;if(p&&p.length){let h=p[0].id;if(p.length>1){let g=p.map(v=>({label:v.label,_id:v.id})),f=await r.pick(g,{placeHolder:d(8887,null)});if(!f)return;h=f._id}return await e.thread.session.goto(e.thread.threadId,h).catch(g=>n.warn(g))}}}return n.warn(d(8899,null))}});qe.registerCommand({id:sEi,handler:async(a,i,e)=>{let t=a.get(Li);nho(t)}});qe.registerCommand({id:aEi,handler:async(a,i,e)=>{let t=a.get(Li);await oho(t)}});qe.registerCommand({id:lEi,handler:async(a,i,e)=>{let t=a.get(Li);iho(t,!1)}});qe.registerCommand({id:cEi,handler:async(a,i,e)=>{let t=a.get(Li);iho(t,!0)}});fe.appendMenuItem(D.EditorContext,{command:{id:Att,title:d(8897,null),category:bte},when:x.and(Nce,ue.editorTextFocus),group:"debug",order:3});yt.registerCommandAndKeybindingRule({id:oEi,weight:201,when:BO,primary:2060,mac:{primary:3166},handler:async(a,i,e)=>{tho(a,!0)}});yt.registerCommandAndKeybindingRule({id:nEi,weight:201,when:BO,primary:2059,mac:{primary:3164},handler:async(a,i,e)=>{tho(a,!1)}});yt.registerCommandAndKeybindingRule({id:y2,weight:200,primary:3135,when:Xa,handler:async(a,i,e)=>{let t=a.get(Li),o=a.get(B),n;if(uEi(e)?n=t.getModel().getSession(e.sessionId):n=t.getViewModel().focusedSession,n){let r=o.getValue("debug").showSubSessionsInToolBar;for(;!r&&n.lifecycleManagedByParent&&n.parentSession;)n=n.parentSession;n.removeReplExpressions(),await t.restartSession(n)}else{let{launch:r,name:s}=t.getConfigurationManager().selectedConfiguration;await t.startDebugging(r,s,{noDebug:!1,startedByUser:!0})}}});yt.registerCommandAndKeybindingRule({id:w2,weight:200,primary:68,when:Fs.isEqualTo("stopped"),handler:async(a,i,e)=>{let t=a.get(X);xz.getValue(t)?await c0(a,e,o=>o.next("instruction")):await c0(a,e,o=>o.next())}});var rho=Gt&&ri?581:69;yt.registerCommandAndKeybindingRule({id:C2,weight:210,primary:rho,when:Fs.notEqualsTo("inactive"),handler:async(a,i,e)=>{let t=a.get(X);xz.getValue(t)?await c0(a,e,o=>o.stepIn("instruction")):await c0(a,e,o=>o.stepIn())}});yt.registerCommandAndKeybindingRule({id:x2,weight:200,primary:1093,when:Fs.isEqualTo("stopped"),handler:async(a,i,e)=>{let t=a.get(X);xz.getValue(t)?await c0(a,e,o=>o.stepOut("instruction")):await c0(a,e,o=>o.stepOut())}});yt.registerCommandAndKeybindingRule({id:W3,weight:202,primary:64,when:Fs.isEqualTo("running"),handler:async(a,i,e)=>{await c0(a,e,t=>t.pause())}});yt.registerCommandAndKeybindingRule({id:Xki,primary:rho|2048,when:x.and(BY,Xa,Fs.isEqualTo("stopped")),weight:200,handler:async(a,i,e)=>{let t=a.get(Ge),o=a.get(Li),n=o.getViewModel().focusedSession,r=o.getViewModel().focusedStackFrame;if(!r||!n)return;let s=await a.get(ee).openEditor({resource:r.source.uri,options:{revealIfOpened:!0}}),l;if(s){let p=s?.getControl();pn(p)&&(l=p)}let c=new P,u=c.add(t.createQuickPick());u.busy=!0,u.show(),c.add(u.onDidChangeActive(([p])=>{l&&p&&p.target.line!==void 0&&(l.revealLineInCenterIfOutsideViewport(p.target.line),l.setSelection({startLineNumber:p.target.line,startColumn:p.target.column||1,endLineNumber:p.target.endLine||p.target.line,endColumn:p.target.endColumn||p.target.column||1}))})),c.add(u.onDidAccept(()=>{u.activeItems.length&&n.stepIn(r.thread.threadId,u.activeItems[0].target.id)})),c.add(u.onDidHide(()=>c.dispose())),n.stepInTargets(r.frameId).then(p=>{u.busy=!1,p?.length?u.items=p?.map(h=>({target:h,label:h.label})):u.placeholder=d(8895,null)})}});async function pEi(a,i,e,t,o){let n=a.get(Li),r;uEi(e)?r=n.getModel().getSession(e.sessionId):r=n.getViewModel().focusedSession;let l=a.get(B).getValue("debug").showSubSessionsInToolBar;for(;!l&&r&&r.lifecycleManagedByParent&&r.parentSession;)r=r.parentSession;await n.stopSession(r,t,o)}yt.registerCommandAndKeybindingRule({id:GR,weight:200,primary:1087,when:x.and(fC,Xa),handler:(a,i,e)=>pEi(a,i,e,!0)});qe.registerCommand({id:$Ae,handler:(a,i,e)=>pEi(a,i,e,!0,!0)});yt.registerCommandAndKeybindingRule({id:uT,weight:200,primary:1087,when:x.and(fC.toNegated(),Xa),handler:(a,i,e)=>pEi(a,i,e,!1)});qe.registerCommand({id:Jki,handler:async(a,i,e)=>{let t=a.get(Li),o=a.get(Ne),n=eho(t,e);if(n)try{await n.restart()}catch(r){o.error(r)}}});yt.registerCommandAndKeybindingRule({id:k2,weight:210,primary:63,when:Fs.isEqualTo("stopped"),handler:async(a,i,e)=>{await c0(a,e,t=>t.continue())}});qe.registerCommand({id:rEi,handler:async a=>{await Omo(a)}});qe.registerCommand({id:"debug.startFromConfig",handler:async(a,i)=>{await a.get(Li).startDebugging(void 0,i)}});qe.registerCommand({id:qAe,handler:async(a,i)=>{let e=a.get(Li),t=a.get(ee);i=h_t(i,e.getModel().getSessions()),await e.focusStackFrame(void 0,void 0,i,{explicit:!0});let o=e.getViewModel().focusedStackFrame;o&&await o.openInEditor(t,!0)}});qe.registerCommand({id:V3,handler:async(a,i,e)=>{let t=a.get(Ge),o=a.get(Li);if(i){let n=o.getConfigurationManager(),r=await n.getDynamicProviders();for(let s of r)if(s.type===i){let l=await s.pick();if(l){await n.selectConfiguration(l.launch,l.config.name,l.config,{type:s.type}),o.startDebugging(l.launch,l.config,{noDebug:e?.noDebug,startedByUser:!0});return}}}t.quickAccess.show(Ktt)}});qe.registerCommand({id:yUt,handler:async a=>{a.get(Ge).quickAccess.show(Gtt)}});qe.registerCommand({id:Zki,handler:async a=>{Vmo(a,V3)}});yt.registerCommandAndKeybindingRule({id:d0,weight:200,primary:63,when:x.and(fa,Fs.isEqualTo("inactive")),handler:async(a,i)=>{let e=a.get(Li);await mQe(a.get(B),a.get(ee));let{launch:t,name:o,getConfig:n}=e.getConfigurationManager().selectedConfiguration,r=await n(),s=r?Object.assign(Xi(r),i?.config):o;await e.startDebugging(t,s,{noDebug:i?.noDebug,startedByUser:!0},!1)}});yt.registerCommandAndKeybindingRule({id:Ntt,weight:200,primary:2111,mac:{primary:319},when:x.and(fa,Fs.notEqualsTo(oR(1))),handler:async a=>{await a.get(ge).executeCommand(d0,{noDebug:!0})}});yt.registerCommandAndKeybindingRule({id:"debug.toggleBreakpoint",weight:205,when:x.and(Cke,$h.toNegated()),primary:10,handler:a=>{let i=a.get(fo),e=a.get(Li),t=i.lastFocusedList;if(t instanceof hc){let o=t.getFocusedElements();o&&o.length&&e.enableOrDisableBreakpoints(!o[0].enabled,o[0])}}});yt.registerCommandAndKeybindingRule({id:"debug.enableOrDisableBreakpoint",weight:200,primary:void 0,when:ue.editorTextFocus,handler:a=>{let i=a.get(Li),t=a.get(ee).activeTextEditorControl;if(pn(t)){let o=t.getModel();if(o){let n=t.getPosition();if(n){let r=i.getModel().getBreakpoints({uri:o.uri,lineNumber:n.lineNumber});r.length&&i.enableOrDisableBreakpoints(!r[0].enabled,r[0])}}}}});yt.registerCommandAndKeybindingRule({id:eEi,weight:205,when:rQe,primary:60,mac:{primary:3},handler:(a,i)=>{let e=a.get(Li);if(!(i instanceof Jc)){let o=a.get(fo).lastFocusedList;if(o){let n=o.getFocus();Array.isArray(n)&&n[0]instanceof Jc&&(i=n[0])}}i instanceof Jc&&e.getViewModel().setSelectedExpression(i,!1)}});qe.registerCommand({id:tEi,handler:async(a,i)=>{let e=a.get(Li);(i instanceof Jc||i instanceof Hl)&&e.getViewModel().setSelectedExpression(i,!0)}});yt.registerCommandAndKeybindingRule({id:"debug.setVariable",weight:205,when:JTt,primary:60,mac:{primary:3},handler:a=>{let i=a.get(fo),e=a.get(Li),t=i.lastFocusedList;if(t){let o=t.getFocus();Array.isArray(o)&&o[0]instanceof Hl&&e.getViewModel().setSelectedExpression(o[0],!1)}}});yt.registerCommandAndKeybindingRule({id:iEi,weight:200,when:x.and(rQe,FY.toNegated()),primary:20,mac:{primary:2049},handler:(a,i)=>{let e=a.get(Li);if(i instanceof Jc){e.removeWatchExpressions(i.getId());return}let o=a.get(fo).lastFocusedList;if(o){let n=o.getFocus();if(Array.isArray(n)&&n[0]instanceof Jc){let r=o.getSelection();r&&r.indexOf(n[0])>=0&&(n=r),n.forEach(s=>e.removeWatchExpressions(s.getId()))}}}});qe.registerCommand({id:Ftt,handler:async a=>{let i=a.get(Li);dT&&await i.addDataBreakpoint({description:dT.description,src:{type:0,dataId:dT.dataId},canPersist:!!dT.canPersist,accessTypes:dT.accessTypes,accessType:"write"})}});qe.registerCommand({id:Wtt,handler:async a=>{let i=a.get(Li);dT&&await i.addDataBreakpoint({description:dT.description,src:{type:0,dataId:dT.dataId},canPersist:!!dT.canPersist,accessTypes:dT.accessTypes,accessType:"readWrite"})}});qe.registerCommand({id:Vtt,handler:async a=>{let i=a.get(Li);dT&&await i.addDataBreakpoint({description:dT.description,src:{type:0,dataId:dT.dataId},canPersist:!!dT.canPersist,accessTypes:dT.accessTypes,accessType:"read"})}});yt.registerCommandAndKeybindingRule({id:"debug.removeBreakpoint",weight:200,when:x.and(Cke,ZTt.toNegated()),primary:20,mac:{primary:2049},handler:a=>{let i=a.get(fo),e=a.get(Li),t=i.lastFocusedList;if(t instanceof hc){let o=t.getFocusedElements(),n=o.length?o[0]:void 0;n instanceof wv?e.removeBreakpoints(n.getId()):n instanceof tI?e.removeFunctionBreakpoints(n.getId()):n instanceof ZI&&e.removeDataBreakpoints(n.getId())}}});yt.registerCommandAndKeybindingRule({id:"debug.installAdditionalDebuggers",weight:200,when:void 0,primary:void 0,handler:async(a,i)=>{let e=a.get(zi),t="@category:debuggers";return typeof i=="string"&&(t+=` ${i}`),e.openSearch(t)}});W(class extends K{constructor(){super({id:nhe,title:L(8879,"Add Configuration..."),category:bte,f1:!0,menu:{id:D.EditorContent,when:x.and(x.regex(Fo.Path.key,/\.vscode[/\\]launch\.json$/),fr.isEqualTo(mF))}})}async run(i,e){let t=i.get(Li).getConfigurationManager(),o=t.getLaunches().find(n=>n.uri.toString()===e)||t.selectedConfiguration.launch;if(o){let{editor:n,created:r}=await o.openConfigFile({preserveFocus:!1});if(n&&!r){let s=n.getControl();s&&await s.getContribution(gV)?.addLaunchConfiguration()}}}});var W7o=a=>{let i=a.get(Li),t=a.get(ee).activeTextEditorControl;if(pn(t)){let o=t.getPosition();if(o&&t.hasModel()&&i.canSetBreakpointsIn(t.getModel())){let n=t.getModel().uri;i.getModel().getBreakpoints({lineNumber:o.lineNumber,uri:n}).some(s=>s.sessionAgnosticData.column===o.column||!s.column&&o.column<=1)||i.addBreakpoints(n,[{lineNumber:o.lineNumber,column:o.column>1?o.column:void 0}])}}};yt.registerCommandAndKeybindingRule({weight:200,primary:1091,when:ue.editorTextFocus,id:Ptt,handler:W7o});fe.appendMenuItem(D.EditorContext,{command:{id:Ptt,title:d(8880,null),category:bte},when:x.and(Xa,kce.toNegated(),ue.editorTextFocus,ie.inChatSession.toNegated()),group:"debug",order:1});yt.registerCommandAndKeybindingRule({id:"debug.openBreakpointToSide",weight:200,when:Cke,primary:2051,secondary:[515],handler:a=>{let e=a.get(fo).lastFocusedList;if(e instanceof hc){let t=e.getFocusedElements();if(t.length&&t[0]instanceof wv)return GAe(t[0],!0,!1,!0,a.get(Li),a.get(ee))}}});W(class extends K{constructor(){super({id:A7o,title:L(8916,"Toggle Exception Breakpoints"),category:bte,f1:!0,precondition:fa})}async run(i){let e=i.get(Li),t=i.get(Ge),o=e.getModel(),n=e.getViewModel().focusedSession||o.getSessions()[0],r=n?o.getExceptionBreakpointsForSession(n.getId()):o.getExceptionBreakpoints();if(r.length===0)return;if(r.length===1){let c=r[0];await e.enableOrDisableBreakpoints(!c.enabled,c);return}let s=new P,l=s.add(t.createQuickPick());l.placeholder=d(8908,null),l.canSelectMany=!0,l.matchOnDescription=!0,l.matchOnDetail=!0,l.items=r.map(c=>({label:c.label,description:c.description,picked:c.enabled,breakpoint:c})),l.selectedItems=l.items.filter(c=>c.picked),s.add(l.onDidAccept(()=>{let c=l.selectedItems,u=[],p=[];for(let g of r){let f=c.some(v=>v.breakpoint===g);f&&!g.enabled?u.push(g):!f&&g.enabled&&p.push(g)}let h=[];for(let g of u)h.push(e.enableOrDisableBreakpoints(!0,g));for(let g of p)h.push(e.enableOrDisableBreakpoints(!1,g));Promise.all(h).then(()=>s.dispose())})),s.add(l.onDidHide(()=>s.dispose())),l.show()}});yt.registerCommandAndKeybindingRule({id:"debug.openView",weight:200,when:fa.toNegated(),primary:63,secondary:[2111],handler:async a=>{await a.get(ds).openPaneComposite(jh,0,!0)}});W(class extends K{constructor(){super({id:N7o,title:L(8882,"Attach to Current Code Renderer")})}async run(a){let i=a.get(Co);if(!i.isExtensionDevelopment&&!i.extensionTestsLocationURI)throw new Error("Refusing to attach to renderer outside of development context");let e=sg(It);return await a.get(SD).attachToCurrentWindowRenderer(e)}});var sho="\\u0000-\\u0020\\u007f-\\u009f",V7o=new RegExp("(?:[a-zA-Z][a-zA-Z0-9+.-]{2,}:\\/\\/|data:|www\\.)[^\\s"+sho+'"]{2,}[^\\s'+sho+`"')}\\],:;.!?]`,"ug"),B7o=/(?:[a-zA-Z]:(?:(?:\\|\/)[\w\s\.@\-\(\)\[\]{}!#$%^&'`~+=]+)+)/,H7o=/(?:(?:\~|\.+)(?:(?:\\|\/)[\w\s\.@\-\(\)\[\]{}!#$%^&'`~+=]+)+)/,U7o=new RegExp(`(${B7o.source}|${H7o.source})`),z7o=/((?:\~|\.+)?(?:\/[\w\s\.@\-\(\)\[\]{}!#$%^&'`~+=]+)+)/,K7o=/(?::(?:line\s+)?([\d]+))?(?::([\d]+))?/,G7o=new RegExp(`${ri?U7o.source:z7o.source}${K7o.source}`,"g"),$7o=/:(?:line\s+)?([\d]+)(?::([\d]+))?$/,q7o=2e3;var kte=class{constructor(i,e,t,o,n,r,s,l){this.editorService=i;this.fileService=e;this.openerService=t;this.pathService=o;this.tunnelService=n;this.environmentService=r;this.configurationService=s;this.hoverService=l}linkify(i,e,t,o,n,r){return this._linkify(i,e,t,o,n,r)}_linkify(i,e,t,o,n,r,s){if(t){let c=i.split(`
`);for(let h=0;h<c.length-1;h++)c[h]=c[h]+`
`;c[c.length-1]||c.pop();let u=c.map(h=>this._linkify(h,e,!1,o,n,r,s));if(u.length===1)return u[0];let p=document.createElement("span");return u.forEach(h=>p.appendChild(h)),p}let l=document.createElement("span");for(let c of this.detectLinks(i))try{let u;switch(c.kind){case"text":u=s?this.linkifyLocation(c.value,s.locationReference,s.session,e):document.createTextNode(c.value);break;case"web":u=this.createWebLink(n?i:void 0,c.value,e);break;case"path":{let p=c.captures[0],h=c.captures[1]?Number(c.captures[1]):0,g=c.captures[2]?Number(c.captures[2]):0;u=this.createPathLink(n?i:void 0,c.value,p,h,g,o,e);break}default:u=document.createTextNode(c.value)}l.append(...this.applyHighlights(u,c.index,c.value.length,r))}catch{l.appendChild(document.createTextNode(c.value))}return l}applyHighlights(i,e,t,o){let n=[],r=e,s=e+t;for(let l of o||[]){if(l.end<=r||l.start>=s)continue;l.start>r&&(n.push(i.textContent.substring(r-e,l.start-e)),r=l.start);let c=Math.min(l.end,s),u=i.textContent.substring(r-e,c-e),p=document.createElement("span");p.classList.add("highlight"),l.extraClasses&&p.classList.add(...l.extraClasses),p.textContent=u,n.push(p),r=c}return r===e?ht.single(i):(r<s&&n.push(i.textContent.substring(r-e)),Ao(i)?(Fi(i,...n),ht.single(i)):n)}linkifyLocation(i,e,t,o){let n=this.createLink(i);return this.decorateLink(n,void 0,i,o,async r=>{let s=await t.resolveLocationReference(e);await s.source.openInEditor(this.editorService,{startLineNumber:s.line,startColumn:s.column,endLineNumber:s.endLine??s.line,endColumn:s.endColumn??s.column},r)}),n}makeReferencedLinkDetector(i,e){return{linkify:(t,o,n,r,s,l)=>this._linkify(t,o,n,r,s,l,{locationReference:i,session:e}),linkifyLocation:this.linkifyLocation.bind(this)}}createWebLink(i,e,t){let o=this.createLink(e),n=A.parse(e),r=$7o.exec(n.path);return r&&(n=n.with({path:n.path.slice(0,r.index),fragment:`L${r[0].slice(1)}`})),this.decorateLink(o,n,i,t,async()=>{if(n.scheme===Y.file){let s=n.fsPath,l=await this.pathService.path,c=th(l.sep===Lo.sep&&ri?s.replace(/\\/g,Lo.sep):s),u=A.parse(c);if(!await this.fileService.exists(u))return;await this.editorService.openEditor({resource:u,options:{pinned:!0,selection:r?{startLineNumber:+r[1],startColumn:r[2]?+r[2]:1}:void 0}});return}this.openerService.open(e,{allowTunneling:!!this.environmentService.remoteAuthority&&this.configurationService.getValue("remote.forwardOnOpen")})}),o}createPathLink(i,e,t,o,n,r,s){if(t[0]==="/"&&t[1]==="/")return document.createTextNode(e);let l=o>0?{selection:{startLineNumber:o,startColumn:n>0?n:1}}:{};if(t[0]==="."){if(!r)return document.createTextNode(e);let p=r.toResource(t),h=this.createLink(e);return this.decorateLink(h,p,i,s,g=>this.editorService.openEditor({resource:p,options:{...l,preserveFocus:g}})),h}if(t[0]==="~"){let p=this.pathService.resolvedUserHome;p&&(t=Ld(p.fsPath,t.substring(1)))}let c=this.createLink(e);c.tabIndex=0;let u=A.file(th(t));return this.fileService.stat(u).then(p=>{p.isDirectory||this.decorateLink(c,u,i,s,h=>this.editorService.openEditor({resource:u,options:{...l,preserveFocus:h}}))}).catch(()=>{}),c}createLink(i){let e=document.createElement("a");return e.textContent=i,e}decorateLink(i,e,t,o,n){if(o.store.isDisposed)return;i.classList.add("link");let r=e&&this.tunnelService.canTunnel(e)?d(9093,null):d(9094,null),s=i.ariaLabel=t?it?d(9092,null,r,t):d(9091,null,r,t):it?d(9090,null,r):d(9089,null,r);o.type===0?o.store.add(this.hoverService.setupManagedHover(Ni("element"),i,s)):o.type!==2&&(i.title=s),o.store.add(j(i,"mousemove",l=>{i.classList.toggle("pointer",it?l.metaKey:l.ctrlKey)})),o.store.add(j(i,"mouseleave",()=>{i.classList.remove("pointer")})),o.store.add(j(i,"click",l=>{let c=Me(i).getSelection();!c||c.type==="Range"||(it?l.metaKey:l.ctrlKey)&&(l.preventDefault(),l.stopImmediatePropagation(),n(!1))})),o.store.add(j(i,"keydown",l=>{let c=new Ii(l);(c.keyCode===3||c.keyCode===10)&&(c.preventDefault(),c.stopPropagation(),n(c.keyCode===10))}))}detectLinks(i){if(i.length>q7o)return[{kind:"text",value:i,captures:[],index:0}];let e=[V7o,G7o],t=["web","path"],o=[],n=(r,s,l)=>{if(s>=e.length){o.push({value:r,kind:"text",captures:[],index:l});return}let c=e[s],u=0,p;for(c.lastIndex=0;(p=c.exec(r))!==null;){let g=r.substring(u,p.index);g&&n(g,s+1,l+u);let f=p[0];o.push({value:f,kind:t[s],captures:p.slice(1),index:l+p.index}),u=p.index+f.length}let h=r.substring(u);h&&n(h,s+1,l+u)};return n(i,0,0),o}};kte=I([m(0,ee),m(1,be),m(2,Qe),m(3,wn),m(4,ap),m(5,Vt),m(6,B),m(7,tt)],kte);var Q7o=1024,Y7o=/^(true|false)$/i,X7o=/^(['"]).*\1$/;var J7o=Object.keys({value:0,unavailable:0,error:0,changed:0,boolean:0,string:0,number:0}),$R=class{constructor(i,e,t,o){this.commandService=i;this.hoverService=o;this.linkDetector=t.createInstance(kte),this.displayType=pr("debug.showVariableTypes",!1,e)}renderVariable(i,e,t={}){let o=this.displayType.get(),n=Pmo(e,t.highlights||[]);if(e.available){i.type.textContent="";let s=e.name;e.value&&typeof e.name=="string"&&(e.type&&o?(s+=": ",i.type.textContent=e.type+" ="):s+=" ="),i.label.set(s,n.name,e.type&&!o?e.type:e.name),i.name.classList.toggle("virtual",e.presentationHint?.kind==="virtual"),i.name.classList.toggle("internal",e.presentationHint?.visibility==="internal")}else e.value&&typeof e.name=="string"&&e.name&&i.label.set(":");i.expression.classList.toggle("lazy",!!e.presentationHint?.lazy);let r=[{id:B3,args:[e,[e]]}];return e.evaluateName&&r.push({id:vte,args:[{variable:e}]}),this.renderValue(i.value,e,{showChanged:t.showChanged,maxValueLength:Q7o,hover:{commands:r},highlights:n.value,colorize:!0,session:e.getSession()})}renderValue(i,e,t={}){let o=new P,n=t.session?.rememberedCapabilities?.supportsANSIStyling??t.wasANSI??!1,r=typeof e=="string"?e:e.value;for(let p of J7o)i.classList.remove(p);i.classList.add("value"),r===null||(e instanceof Jc||e instanceof Hl||e instanceof yA)&&!e.available?(i.classList.add("unavailable"),r!==Jc.DEFAULT_VALUE&&i.classList.add("error")):(typeof e!="string"&&t.showChanged&&e.valueChanged&&r!==Jc.DEFAULT_VALUE&&(i.classList.add("changed"),e.valueChanged=!1),t.colorize&&typeof e!="string"&&(e.type==="number"||e.type==="boolean"||e.type==="string"?i.classList.add(e.type):isNaN(+r)?Y7o.test(r)?i.classList.add("boolean"):X7o.test(r)&&i.classList.add("string"):i.classList.add("number"))),t.maxValueLength&&r&&r.length>t.maxValueLength&&(r=r.substring(0,t.maxValueLength)+"..."),r||(r="");let s=t.session??(e instanceof vP?e.getSession():void 0),l=t.hover===!1?{type:0,store:o}:{type:2,store:o};Rt(i);let c=t.locationReference??(e instanceof vP&&e.valueLocationReference),u=this.linkDetector;if(c&&s&&(u=this.linkDetector.makeReferencedLinkDetector(c,s)),n?i.appendChild(Kki(r,u,s?s.root:void 0,t.highlights,l)):i.appendChild(u.linkify(r,l,!1,s?.root,!0,t.highlights)),t.hover!==!1){let{commands:p=[]}=t.hover||{};o.add(this.hoverService.setupManagedHover(Ni("mouse"),i,()=>{let h=_("div"),g=_("div.hover-row"),f=R(g,_("div.hover-contents")),v=R(f,_("pre.debug-var-hover-pre"));return n?v.appendChild(Kki(r,this.linkDetector,s?s.root:void 0,t.highlights,l)):v.textContent=r,h.appendChild(g),h},{actions:p.map(({id:h,args:g})=>{let f=qe.getCommand(h)?.metadata?.description;return{label:typeof f=="string"?f:f?f.value:h,commandId:h,run:()=>this.commandService.executeCommand(h,...g)}})}))}return o}};$R=I([m(0,ge),m(1,B),m(2,F),m(3,tt)],$R);var mEi=_,xUt=!0,kUt,YAe=class extends zr{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super(e,n,t,r,c,l,s,u,p,h);this.debugService=o;this.menuService=g;this.needsRefresh=!1;this.savedViewState=new Map;this.autoExpandedScopes=new Set;this.updateTreeScheduler=this._register(new Dt(async()=>{let f=this.debugService.getViewModel().focusedStackFrame;this.needsRefresh=!1;let v=this.tree.getInput();if(v&&this.savedViewState.set(v.getId(),this.tree.getViewState()),!f){await this.tree.setInput(null);return}let b=this.savedViewState.get(f.getId());await this.tree.setInput(f,b);let y=(await f.getScopes()).find(w=>!w.expensive);y&&this.tree.hasNode(y)&&(this.autoExpandedScopes.add(y.getId()),await this.tree.expand(y))},400))}get treeSelection(){return this.tree.getSelection()}renderBody(e){super.renderBody(e),this.element.classList.add("debug-pane"),e.classList.add("debug-variables");let t=cte(e),o=this.instantiationService.createInstance($R);this.tree=this.instantiationService.createInstance(nu,"VariablesView",t,new gEi,[this.instantiationService.createInstance(qR,o),this.instantiationService.createInstance(Ek,o),new TUt,new _Ut],this.instantiationService.createInstance(hEi),{accessibilityProvider:new fEi,identityProvider:{getId:r=>r.getId()},keyboardNavigationLabelProvider:dUt,overrideStyles:this.getLocationBasedColors().listOverrideStyles}),this._register(Ek.rendererOnVisualizationRange(this.debugService.getViewModel(),this.tree)),this.tree.setInput(this.debugService.getViewModel().focusedStackFrame??null),JTt.bindTo(this.tree.contextKeyService),this._register(this.debugService.getViewModel().onDidFocusStackFrame(r=>{if(!this.isBodyVisible()){this.needsRefresh=!0;return}let s=r.explicit?0:void 0;this.updateTreeScheduler.schedule(s)})),this._register(this.debugService.getViewModel().onWillUpdateViews(()=>{let r=this.debugService.getViewModel().focusedStackFrame;r&&xUt&&r.forgetScopes(),xUt=!0,this.tree.updateChildren()})),this._register(this.tree),this._register(this.tree.onMouseDblClick(r=>this.onMouseDblClick(r))),this._register(this.tree.onContextMenu(async r=>await this.onContextMenu(r))),this._register(this.onDidChangeBodyVisibility(r=>{r&&this.needsRefresh&&this.updateTreeScheduler.schedule()}));let n;this._register(this.debugService.getViewModel().onDidSelectExpression(r=>{let s=r?.expression;s&&this.tree.hasNode(s)?(n=this.tree.options.horizontalScrolling,n&&this.tree.updateOptions({horizontalScrolling:!1}),this.tree.rerender(s)):!r&&n!==void 0&&(this.tree.updateOptions({horizontalScrolling:n}),n=void 0)})),this._register(this.debugService.getViewModel().onDidEvaluateLazyExpression(async r=>{r instanceof Hl&&this.tree.hasNode(r)&&(await this.tree.updateChildren(r,!1,!0),await this.tree.expand(r))})),this._register(this.debugService.onDidEndSession(()=>{this.savedViewState.clear(),this.autoExpandedScopes.clear()}))}layoutBody(e,t){super.layoutBody(t,e),this.tree.layout(e,t)}focus(){super.focus(),this.tree.domFocus()}collapseAll(){this.tree.collapseAll()}onMouseDblClick(e){this.canSetExpressionValue(e.element)&&this.debugService.getViewModel().setSelectedExpression(e.element,!1)}canSetExpressionValue(e){let t=this.debugService.getViewModel().focusedSession;return t?e instanceof rR?!!e.treeItem.canEdit:!t.capabilities?.supportsSetVariable&&!t.capabilities?.supportsSetExpression?!1:e instanceof Hl&&!e.presentationHint?.attributes?.includes("readOnly")&&!e.presentationHint?.lazy:!1}async onContextMenu(e){let t=e.element;if(t instanceof Tz)return this.openContextMenuForScope(e,t);if(!(!(t instanceof Hl)||!t.value))return vEi(this.contextKeyService,this.menuService,this.contextMenuService,D.DebugVariablesContext,e)}openContextMenuForScope(e,t){let o={scope:{name:t.name}},n=this.menuService.getMenuActions(D.DebugScopesContext,this.contextKeyService,{arg:o,shouldForwardArgs:!1}),{secondary:r}=Ef(n,"inline");this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>r})}};YAe=I([m(1,ze),m(2,Li),m(3,_e),m(4,B),m(5,F),m(6,Ri),m(7,X),m(8,Qe),m(9,De),m(10,tt),m(11,qt)],YAe);async function vEi(a,i,e,t,o){let n=o.element;if(!(n instanceof Hl)||!n.value)return;let r=await Z7o(a,n),s=bEi(n),l=i.getMenuActions(t,r,{arg:s,shouldForwardArgs:!1}),{secondary:c}=Ef(l,"inline");e.showContextMenu({getAnchor:()=>o.anchor,getActions:()=>c})}var bEi=a=>({sessionId:a.getSession()?.getId(),container:a.parent instanceof Jc?{expression:a.parent.name}:a.parent.toDebugProtocolObject(),variable:a.toDebugProtocolObject()});async function Z7o(a,i){let e=i.getSession();if(!e||!e.capabilities.supportsDataBreakpoints)return EUt(a,i);let t=[],o=await e.dataBreakpointInfo(i.name,i.parent.reference),n=o?.dataId,r=o?.accessTypes;if(CUt(o),!r)t.push([Cz.key,!!n]);else for(let s of r)switch(s){case"read":t.push([UY.key,!!n]);break;case"write":t.push([Cz.key,!!n]);break;case"readWrite":t.push([HY.key,!!n]);break}return EUt(a,i,t)}function EUt(a,i,e=[]){return kUt=i,g_t(a,i,e)}function aho(a){return a instanceof NE}var hEi=class extends b2{hasChildren(i){return i?aho(i)?!0:i.hasChildren:!1}doGetChildren(i){return aho(i)?i.getScopes():i.getChildren()}},gEi=class{getHeight(i){return 22}getTemplateId(i){return i instanceof vQe?_Ut.ID:i instanceof Tz?TUt.ID:i instanceof rR?Ek.ID:qR.ID}},TUt=class a{static{this.ID="scope"}get templateId(){return a.ID}renderTemplate(i){let e=R(i,mEi(".scope")),t=new Oa(e);return{name:e,label:t}}renderElement(i,e,t){t.label.set(i.element.name,ua(i.filterData))}disposeTemplate(i){i.label.dispose()}},_Ut=class a{static{this.ID="scopeError"}get templateId(){return a.ID}renderTemplate(i){let e=R(i,mEi(".scope"));return{error:R(e,mEi(".error"))}}renderElement(i,e,t){t.error.innerText=i.element.name}disposeTemplate(){}},Ek=class extends OB{constructor(e,t,o,n,r,s){super(t,o,n);this.expressionRenderer=e;this.menuService=r;this.contextKeyService=s}static{this.ID="viz"}static rendererOnVisualizationRange(e,t){return e.onDidChangeVisualization(({original:o})=>{if(!t.hasNode(o))return;let n=t.getParentElement(o);t.updateChildren(n,!1,!1)})}get templateId(){return Ek.ID}renderElement(e,t,o){o.elementDisposable.clear(),super.renderExpressionElement(e.element,e,o)}renderExpression(e,t,o){let n=e,r=n.name;n.value&&typeof n.name=="string"&&(r+=":"),t.label.set(r,o,n.name),t.elementDisposable.add(this.expressionRenderer.renderValue(t.value,n,{showChanged:!1,maxValueLength:1024,colorize:!0,session:e.getSession()}))}getInputBoxOptions(e){let t=e;return{initialValue:e.value,ariaLabel:d(9192,null),validationOptions:{validation:()=>t.errorMessage?{content:t.errorMessage}:null},onFinish:(o,n)=>{t.errorMessage=void 0,n&&t.edit(o).then(()=>{xUt=!1,this.debugService.getViewModel().updateViews()})}}}renderActionBar(e,t,o){let n=t,r=n.original?EUt(this.contextKeyService,n.original):this.contextKeyService,s=n.original?bEi(n.original):void 0,l=this.menuService.getMenuActions(D.DebugVariablesContext,r,{arg:s,shouldForwardArgs:!1}),{primary:c}=Ef(l,"inline");if(n.original){let u=pi({id:"debugViz",label:d(9187,null),class:q.asClassName(M.eye),run:()=>this.debugService.getViewModel().setVisualizedExpression(n.original,void 0)});u.checked=!0,c.push(u),e.domNode.style.display="initial"}e.clear(),e.context=s,e.push(c,{icon:!0,label:!1})}};Ek=I([m(1,Li),m(2,_n),m(3,tt),m(4,qt),m(5,X)],Ek);var qR=class extends OB{constructor(e,t,o,n,r,s,l,c){super(s,l,c);this.expressionRenderer=e;this.menuService=t;this.contextKeyService=o;this.visualization=n;this.contextMenuService=r}static{this.ID="variable"}get templateId(){return qR.ID}renderExpression(e,t,o){t.elementDisposable.add(this.expressionRenderer.renderVariable(t,e,{highlights:o,showChanged:!0}))}renderElement(e,t,o){o.elementDisposable.clear(),super.renderExpressionElement(e.element,e,o)}getInputBoxOptions(e){let t=e;return{initialValue:e.value,ariaLabel:d(9192,null),validationOptions:{validation:()=>t.errorMessage?{content:t.errorMessage}:null},onFinish:(o,n)=>{t.errorMessage=void 0;let r=this.debugService.getViewModel().focusedStackFrame;n&&t.value!==o&&r&&t.setVariable(o,r).then(()=>{xUt=!1,this.debugService.getViewModel().updateViews()})}}}renderActionBar(e,t,o){let n=t,r=EUt(this.contextKeyService,n),s=bEi(n),l=this.menuService.getMenuActions(D.DebugVariablesContext,r,{arg:s,shouldForwardArgs:!1}),{primary:c}=Ef(l,"inline");e.clear(),e.context=s,e.push(c,{icon:!0,label:!1});let u=new $e;o.elementDisposable.add(Z(()=>u.dispose(!0))),this.visualization.getApplicableFor(t,u.token).then(p=>{o.elementDisposable.add(p);let h=t instanceof rR&&t.original||t,g=p.object.map(f=>pi({id:"debugViz",label:f.name,class:f.iconClass||"debug-viz-icon",run:this.useVisualizer(f,h,u.token)}));g.length===0||(g.length===1?e.push(g[0],{icon:!0,label:!1}):e.push(pi({id:"debugViz",label:d(9188,null),class:q.asClassName(M.eye),run:()=>this.pickVisualizer(g,h,o)}),{icon:!0,label:!1}))})}pickVisualizer(e,t,o){this.contextMenuService.showContextMenu({getAnchor:()=>o.actionBar.getContainer(),getActions:()=>e})}useVisualizer(e,t,o){return async()=>{let n=await e.resolve(o);if(!o.isCancellationRequested)if(n.type===0)e.execute();else{let r=await this.visualization.getVisualizedNodeFor(n.id,t);r&&this.debugService.getViewModel().setVisualizedExpression(t,r)}}}};qR=I([m(1,qt),m(2,X),m(3,qY),m(4,ze),m(5,Li),m(6,_n),m(7,tt)],qR);var fEi=class{getWidgetAriaLabel(){return d(9190,null)}getAriaLabel(i){return i instanceof Tz?d(9191,null,i.name):i instanceof Hl?d(9189,null,i.name,i.value):null}},SEi="debug.setVariable";qe.registerCommand({id:SEi,handler:a=>{a.get(Li).getViewModel().setSelectedExpression(kUt,!1)}});qe.registerCommand({metadata:{description:Utt},id:B3,handler:async(a,i,e)=>{let t=a.get(Li),o=a.get(Wi),n="",r;if(i)i instanceof Hl||i instanceof Jc?(n="watch",r=[i]):(n="variables",r=kUt?[kUt]:[]);else{let p=a.get(Ft),h=p.getFocusedView(),g;if(h?.id===Yx?(g=p.getActiveViewWithId(Yx),n="watch"):h?.id===Iz&&(g=p.getActiveViewWithId(Iz),n="variables"),!g)return;r=g.treeSelection.filter(f=>f instanceof Jc||f instanceof Hl)}let s=t.getViewModel().focusedStackFrame,l=t.getViewModel().focusedSession;if(!s||!l||r.length===0)return;let c=l.capabilities.supportsClipboardContext?"clipboard":n,u=r.map(p=>p instanceof Hl?p.evaluateName||p.value:p.name);try{let p=await Promise.all(u.map(g=>l.evaluate(g,s.frameId,c))),h=si(p).map(g=>g.body.result);h.length&&o.writeText(h.join(`
`))}catch{let h=r.map(g=>g.value);o.writeText(h.join(`
`))}}});var $tt="workbench.debug.viewlet.action.viewMemory",lho="ms-vscode.hexeditor",eYo="hexEditor.hexedit";qe.registerCommand({id:$tt,handler:async(a,i,e)=>{let t=a.get(Li),o,n;if("sessionId"in i){if(!i.sessionId||!i.variable.memoryReference)return;o=i.sessionId,n=i.variable.memoryReference}else{if(!i.memoryReference)return;let h=t.getViewModel().focusedSession;if(!h)return;o=h.getId(),n=i.memoryReference}let r=a.get(zi),s=a.get(ee),l=a.get(Ne),c=a.get(lt),u=a.get(Te);(await c.getExtension(lho)||await tYo(r,l))&&(u.publicLog("debug/didViewMemory",{debugType:t.getModel().getSession(o)?.configuration.type}),await s.openEditor({resource:hXi(o,n),options:{revealIfOpened:!0,override:eYo}},vn))}});async function tYo(a,i){try{return await a.install(lho,{justification:d(9193,null),enable:!0},15),!0}catch(e){return i.error(e),!1}}qe.registerCommand({metadata:{description:QAe},id:vte,handler:async(a,i)=>{let e=a.get(Wi);i instanceof Hl?await e.writeText(i.evaluateName):await e.writeText(i.variable.evaluateName)}});qe.registerCommand({metadata:{description:ztt},id:Ott,handler:async(a,i)=>{a.get(Li).addWatchExpression(i.variable.evaluateName)}});W(class extends Fn{constructor(){super({id:"variables.collapse",viewId:Iz,title:d(9186,null),f1:!1,icon:M.collapseAll,menu:{id:D.ViewTitle,group:"navigation",when:x.equals("view",Iz)}})}runInView(a,i){i.collapseAll()}});var XAe=_;async function cho(a,i){if(!a)return null;let t=(await a.getChildren()).filter(o=>i[0]===o.name);return t.length!==1?null:i.length===1?t[0]:cho(t[0],i.slice(1))}async function iYo(a,i){let t=(await a.getScopes()).filter(n=>!n.expensive),o=si(await Promise.all(t.map(n=>cho(n,i))));return o.length>0&&o.every(n=>n.value===o[0].value)?o[0]:void 0}var WB=class{constructor(i,e,t,o,n,r){this.editor=i;this.debugService=e;this.instantiationService=t;this.menuService=o;this.contextKeyService=n;this.contextMenuService=r;this.allowEditorOverflow=!0;this.isUpdatingTree=!1;this.highlightDecorations=this.editor.createDecorationsCollection(),this.toDispose=[],this.showAtPosition=null,this.positionPreference=[1,2],this.debugHoverComputer=this.instantiationService.createInstance(qtt,this.editor),this.expressionRenderer=this.instantiationService.createInstance($R)}static{this.ID="debug.hoverWidget"}get isShowingComplexValue(){return this.complexValueContainer?.hidden===!1}create(){this.domNode=XAe(".debug-hover-widget"),this.complexValueContainer=R(this.domNode,XAe(".complex-value")),this.complexValueTitle=R(this.complexValueContainer,XAe(".title")),this.treeContainer=R(this.complexValueContainer,XAe(".debug-hover-tree")),this.treeContainer.setAttribute("role","tree");let i=R(this.complexValueContainer,XAe(".tip"));i.textContent=d(8950,null,it?"Option":"Alt");let e=this.instantiationService.createInstance(yEi);this.tree=this.instantiationService.createInstance(nu,"DebugHover",this.treeContainer,new wEi,[this.instantiationService.createInstance(qR,this.expressionRenderer),this.instantiationService.createInstance(Ek,this.expressionRenderer)],e,{accessibilityProvider:new IEi,mouseSupport:!1,horizontalScrolling:!0,useShadows:!1,keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:t=>t.name},overrideStyles:{listBackground:qT}}),this.toDispose.push(Ek.rendererOnVisualizationRange(this.debugService.getViewModel(),this.tree)),this.toDispose.push(this.tree),this.valueContainer=XAe(".value"),this.valueContainer.tabIndex=0,this.valueContainer.setAttribute("role","tooltip"),this.scrollbar=new Pa(this.valueContainer,{horizontal:2}),this.domNode.appendChild(this.scrollbar.getDomNode()),this.toDispose.push(this.scrollbar),this.editor.applyFontInfo(this.domNode),this.domNode.style.backgroundColor=wt(qT),this.domNode.style.border=`1px solid ${wt(OU)}`,this.domNode.style.color=wt(s9),this.toDispose.push(this.tree.onContextMenu(async t=>await this.onContextMenu(t))),this.toDispose.push(this.tree.onDidChangeContentHeight(()=>{this.isUpdatingTree||this.layoutTreeAndContainer()})),this.toDispose.push(this.tree.onDidChangeContentWidth(()=>{this.isUpdatingTree||this.layoutTreeAndContainer()})),this.registerListeners(),this.editor.addContentWidget(this)}async onContextMenu(i){let e=i.element;if(!(!(e instanceof Hl)||!e.value))return vEi(this.contextKeyService,this.menuService,this.contextMenuService,D.DebugHoverContext,i)}registerListeners(){this.toDispose.push(Vo(this.domNode,"keydown",i=>{i.equals(9)&&this.hide()})),this.toDispose.push(this.editor.onDidChangeConfiguration(i=>{i.hasChanged(59)&&this.editor.applyFontInfo(this.domNode)})),this.toDispose.push(this.debugService.getViewModel().onDidEvaluateLazyExpression(async i=>{i instanceof Hl&&this.tree.hasNode(i)&&(await this.tree.updateChildren(i,!1,!0),await this.tree.expand(i))}))}isHovered(){return!!this.domNode?.matches(":hover")}isVisible(){return!!this._isVisible}willBeVisible(){return!!this.showCancellationSource}getId(){return WB.ID}getDomNode(){return this.domNode}isInSafeTriangle(i,e){return this._isVisible&&!!this.safeTriangle?.contains(i,e)}async showAt(i,e,t){this.showCancellationSource?.dispose(!0);let o=this.showCancellationSource=new $e,n=this.debugService.getViewModel().focusedSession;if(!n||!this.editor.hasModel())return this.hide(),1;let r=await this.debugHoverComputer.compute(i,o.token);if(o.token.isCancellationRequested)return this.hide(),2;if(!r.range)return this.hide(),1;if(this.isVisible()&&!r.rangeChanged)return 0;let s=await this.debugHoverComputer.evaluate(n);return o.token.isCancellationRequested?(this.hide(),2):!s||s instanceof Jc&&!s.available?(this.hide(),1):(this.highlightDecorations.set([{range:r.range,options:WB._HOVER_HIGHLIGHT_DECORATION_OPTIONS}]),this.doShow(n,r.range.getStartPosition(),s,e,t))}static{this._HOVER_HIGHLIGHT_DECORATION_OPTIONS=po.register({description:"bdebug-hover-highlight",className:"hoverHighlight"})}async doShow(i,e,t,o,n){this.domNode||this.create(),this.showAtPosition=e;let r=new P;if(this._isVisible={store:r},!t.hasChildren){this.complexValueContainer.hidden=!0,this.valueContainer.hidden=!1,r.add(this.expressionRenderer.renderValue(this.valueContainer,t,{showChanged:!1,colorize:!0,hover:!1,session:i})),this.valueContainer.title="",this.editor.layoutContentWidget(this),this.safeTriangle=n&&new RGe(n.posx,n.posy,this.domNode),this.scrollbar.scanDomNode(),o&&(this.editor.render(),this.valueContainer.focus());return}this.valueContainer.hidden=!0,this.expressionToRender=t,r.add(this.expressionRenderer.renderValue(this.complexValueTitle,t,{hover:!1,session:i})),this.editor.layoutContentWidget(this),this.safeTriangle=n&&new RGe(n.posx,n.posy,this.domNode),this.tree.scrollTop=0,this.tree.scrollLeft=0,this.complexValueContainer.hidden=!1,o&&(this.editor.render(),this.tree.domFocus())}layoutTreeAndContainer(){this.layoutTree(),this.editor.layoutContentWidget(this)}layoutTree(){let e=1/0;if(this.showAtPosition){let r=this.editor.getDomNode()?.offsetTop||0,s=this.treeContainer.offsetTop+r,l=this.editor.getTopForLineNumber(this.showAtPosition.lineNumber,!0)-this.editor.getScrollTop();s<l&&(e=l+r-22)}let t=Math.min(Math.max(266,this.editor.getLayoutInfo().height*.55),this.tree.contentHeight+10,e),o=this.tree.contentWidth,n=Kn(o,400,550);this.tree.layout(t,n),this.treeContainer.style.height=`${t}px`,this.scrollbar.scanDomNode()}beforeRender(){if(this.expressionToRender){let i=this.expressionToRender;this.expressionToRender=void 0,this.isUpdatingTree=!0,this.tree.setInput(i).finally(()=>{this.isUpdatingTree=!1})}return null}afterRender(i){i&&(this.positionPreference=[i])}hide(){this.showCancellationSource&&(this.showCancellationSource.dispose(!0),this.showCancellationSource=void 0),this._isVisible&&(ts(this.domNode)&&this.editor.focus(),this._isVisible.store.dispose(),this._isVisible=void 0,this.highlightDecorations.clear(),this.editor.layoutContentWidget(this),this.positionPreference=[1,2])}getPosition(){return this._isVisible?{position:this.showAtPosition,preference:this.positionPreference}:null}dispose(){this.toDispose=Ue(this.toDispose)}};WB=I([m(1,Li),m(2,F),m(3,qt),m(4,X),m(5,ze)],WB);var IEi=class{getWidgetAriaLabel(){return d(8951,null)}getAriaLabel(i){return d(8952,null,i.name,i.value)}},yEi=class extends b2{hasChildren(i){return i.hasChildren}doGetChildren(i){return i.getChildren()}},wEi=class{getHeight(i){return 18}getTemplateId(i){return i instanceof rR?Ek.ID:qR.ID}},qtt=class{constructor(i,e,t,o){this.editor=i;this.debugService=e;this.languageFeaturesService=t;this.logService=o}async compute(i,e){if(!this.debugService.getViewModel().focusedSession||!this.editor.hasModel())return{rangeChanged:!1};let o=this.editor.getModel(),n=await m_t(this.languageFeaturesService,o,i,e);if(!n)return{rangeChanged:!1};let{range:r,matchingExpression:s}=n,l=!this._current?.range.equalsRange(r);return this._current={expression:s,range:z.lift(r)},{rangeChanged:l,range:this._current.range}}async evaluate(i){if(!this._current){this.logService.error("No expression to evaluate");return}let e=this.editor.getModel(),t=e&&i.getSourceForUri(e?.uri);if(i.capabilities.supportsEvaluateForHovers){let o=new Jc(this._current.expression);return await o.evaluate(i,this.debugService.getViewModel().focusedStackFrame,"hover",void 0,t?{line:this._current.range.startLineNumber,column:this._current.range.startColumn,source:t.raw}:void 0),o}else{let o=this.debugService.getViewModel().focusedStackFrame;if(o)return await iYo(o,si(this._current.expression.split(".").map(n=>n.trim())))}}};qtt=I([m(1,Li),m(2,zt),m(3,ne)],qtt);var jtt=_,oYo=J("debugExceptionWidget.border","#a31515",d(9086,null)),nYo=J("debugExceptionWidget.background",{dark:"#420b0d",light:"#f1dfde",hcDark:"#420b0d",hcLight:"#f1dfde"},d(9085,null)),Ete=class extends aO{constructor(e,t,o,n,r,s){super(e,{showFrame:!0,showArrow:!0,isAccessible:!0,frameWidth:1,className:"exception-widget-container"});this.exceptionInfo=t;this.debugSession=o;this.shouldScroll=n;this.instantiationService=s;this.applyTheme(r.getColorTheme()),this._disposables.add(r.onDidColorThemeChange(this.applyTheme.bind(this))),this.create();let l=new Dt(()=>this._doLayout(void 0,void 0),50);this._disposables.add(this.editor.onDidLayoutChange(()=>l.schedule())),this._disposables.add(l)}applyTheme(e){this.backgroundColor=e.getColor(nYo);let t=e.getColor(oYo);this.style({arrowColor:t,frameColor:t})}_applyStyles(){this.container&&(this.container.style.backgroundColor=this.backgroundColor?this.backgroundColor.toString():""),super._applyStyles()}_fillContainer(e){this.setCssClass("exception-widget");let t=this.editor.getOption(59);e.style.fontSize=`${t.fontSize}px`,e.style.lineHeight=`${t.lineHeight}px`,e.tabIndex=0;let o=jtt(".title"),n=jtt(".label");R(o,n);let r=jtt(".actions");R(o,r),n.textContent=this.exceptionInfo.id?d(9088,null,this.exceptionInfo.id):d(9087,null);let s=n.textContent;if(this._disposables.add(new ji(r)).push(new st("editor.closeExceptionWidget",d(9084,null),q.asClassName(lE),!0,async()=>{this.editor.getContribution(gV)?.closeExceptionWidget()}),{label:!1,icon:!0}),R(e,o),this.exceptionInfo.description){let c=jtt(".description");c.textContent=this.exceptionInfo.description,s+=", "+this.exceptionInfo.description,R(e,c)}if(this.exceptionInfo.details&&this.exceptionInfo.details.stackTrace){let c=jtt(".stack-trace"),u=this.instantiationService.createInstance(kte),p={store:this._disposables,type:0},h=u.linkify(this.exceptionInfo.details.stackTrace,p,!0,this.debugSession?this.debugSession.root:void 0,void 0);c.appendChild(h),R(e,c),s+=", "+this.exceptionInfo.details.stackTrace}e.setAttribute("aria-label",s)}_doLayout(e,t){this.container.style.height="initial";let o=this.editor.getOption(75),n=Math.round(o/3),r=Math.ceil((this.container.offsetHeight+n)/o);this._relayout(r)}revealRange(e,t){this.shouldScroll()&&super.revealRange(e,t)}focus(){this.container?.focus()}hasFocus(){return this.container?ts(this.container):!1}getWhitespaceHeight(){if(!this._viewZone||!this._viewZone.id)return 0;let t=this.editor.getWhitespaces().find(o=>o.id===this._viewZone.id);return t?t.height:0}};Ete=I([m(4,De),m(5,F)],Ete);var rYo=100,sYo=150,aYo=500,dho=200,V1p=J("editor.inlineValuesForeground",{dark:"#ffffff80",light:"#00000080",hcDark:"#ffffff80",hcLight:"#00000080"},d(8949,null)),B1p=J("editor.inlineValuesBackground","#ffc80033",d(8948,null)),CEi=class{constructor(i,e){this.column=i;this.text=e}};function lYo(a){if(a.includes(",")&&a.includes("=")){let t=(o=>{let n=[],r=0,s=0;for(let u=0;u<o.length;u++)if(o[u]==="="){if(r===0){r++;continue}let p=o.lastIndexOf(",",u);p!==-1&&p>=s&&(n.push(p),s=p+1),r++}let l=[],c=0;for(let u of n)l.push(o.substring(c,u).trim()),c=u+1;return c<o.length&&l.push(o.substring(c).trim()),l})(a).map(o=>{let n=o.indexOf("=");if(n!==-1){let r=" ".repeat(n+2),[s,...l]=o.split(/\r?\n/);return[s,...l.map(c=>r+c)].join(`
`)}return o});return new xe().appendCodeblock("",t.join(`,
`))}return new xe().appendCodeblock("",a)}function rhe(a,i,e,t=1073741824,o=sYo){let n=i;return i.length>o&&(i=i.substring(0,o)+"..."),[{range:{startLineNumber:a,endLineNumber:a,startColumn:t,endColumn:t},options:{description:`${e}-inline-value-decoration-spacer`,after:{content:rN,cursorStops:3},showIfCollapsed:!0}},{range:{startLineNumber:a,endLineNumber:a,startColumn:t,endColumn:t},options:{description:`${e}-inline-value-decoration`,after:{content:cYo(i),inlineClassName:`${e}-inline-value`,inlineClassNameAffectsLetterSpacing:!0,cursorStops:3},showIfCollapsed:!0,hoverMessage:lYo(n)}}]}function cYo(a){return a.replace(/[ \t\n]/g,rN)}function dYo(a,i,e,t){let o=new Map;for(let r of a)if(o.set(r.name,r.value),o.size>=rYo)break;let n=new Map;return o.forEach((r,s)=>{let l=t.get(s);if(l)for(let c of l)i.some(u=>c>=u.startLineNumber&&c<=u.endLineNumber)&&(n.has(c)||n.set(c,[]),n.get(c).indexOf(s)===-1&&n.get(c).push(s))}),[...n].map(([r,s])=>({line:r,variables:s.sort((l,c)=>{let u=e.getLineContent(r);return u.indexOf(l)-u.indexOf(c)}).map(l=>({name:l,value:o.get(l)}))}))}function uYo(a,i,e){if(a.getLineLength(i)>aYo)return;let o=a.getLineContent(i);a.tokenization.forceTokenization(i);let n=a.tokenization.getLineTokens(i);for(let r=0,s=n.getCount();r<s;r++)if(n.getStandardTokenType(r)===0){F6.lastIndex=0;let c=n.getStartOffset(r),u=n.getEndOffset(r),p=o.substring(c,u),h=F6.exec(p);if(h){let g=h[0];e.has(g)||e.set(g,[]),e.get(g).push(i)}}}var U3=class{constructor(i,e,t,o,n,r,s,l,c,u,p){this.editor=i;this.debugService=e;this.instantiationService=t;this.commandService=o;this.configurationService=n;this.hostService=r;this.uriIdentityService=s;this.languageFeaturesService=c;this.editorService=p;this.mouseDown=!1;this.gutterIsHovered=!1;this.altListener=new me;this.altPressed=!1;this.displayedStore=new P;this.allowScrollToExceptionWidget=!0;this.shouldScrollToExceptionWidget=()=>this.allowScrollToExceptionWidget;this.defaultHoverLockout=new me;this.oldDecorations=this.editor.createDecorationsCollection(),this.debounceInfo=u.for(c.inlineValuesProvider,"InlineValues",{min:dho}),this.hoverWidget=this.instantiationService.createInstance(WB,this.editor),this.toDispose=[this.defaultHoverLockout,this.altListener,this.displayedStore],this.registerListeners(),this.exceptionWidgetVisible=s_t.bindTo(l),this.toggleExceptionWidget()}registerListeners(){this.toDispose.push(this.debugService.getViewModel().onDidFocusStackFrame(i=>this.onFocusStackFrame(i.stackFrame))),this.toDispose.push(this.editor.onMouseDown(i=>this.onEditorMouseDown(i))),this.toDispose.push(this.editor.onMouseUp(()=>this.mouseDown=!1)),this.toDispose.push(this.editor.onMouseMove(i=>this.onEditorMouseMove(i))),this.toDispose.push(this.editor.onMouseLeave(i=>{let e=this.hoverWidget.getDomNode();if(!e)return;let t=e.getBoundingClientRect();(i.event.posx<t.left||i.event.posx>t.right||i.event.posy<t.top||i.event.posy>t.bottom)&&this.hideHoverWidget()})),this.toDispose.push(this.editor.onKeyDown(i=>this.onKeyDown(i))),this.toDispose.push(this.editor.onDidChangeModelContent(()=>{this._wordToLineNumbersMap=void 0,this.updateInlineValuesScheduler.schedule()})),this.toDispose.push(this.debugService.getViewModel().onWillUpdateViews(()=>this.updateInlineValuesScheduler.schedule())),this.toDispose.push(this.debugService.getViewModel().onDidEvaluateLazyExpression(()=>this.updateInlineValuesScheduler.schedule())),this.toDispose.push(this.editor.onDidChangeModel(async()=>{this.addDocumentListeners(),this.toggleExceptionWidget(),this.hideHoverWidget(),this._wordToLineNumbersMap=void 0;let i=this.debugService.getViewModel().focusedStackFrame;await this.updateInlineValueDecorations(i)})),this.toDispose.push(this.editor.onDidScrollChange(()=>{this.hideHoverWidget();let i=this.editor.getModel();i&&this.languageFeaturesService.inlineValuesProvider.has(i)&&this.updateInlineValuesScheduler.schedule()})),this.toDispose.push(this.configurationService.onDidChangeConfiguration(i=>{i.affectsConfiguration("editor.hover")&&this.updateHoverConfiguration()})),this.toDispose.push(this.debugService.onDidChangeState(i=>{i!==2&&this.toggleExceptionWidget()})),this.updateHoverConfiguration()}updateHoverConfiguration(){let i=this.editor.getModel();i&&(this.editorHoverOptions=this.configurationService.getValue("editor.hover",{resource:i.uri,overrideIdentifier:i.getLanguageId()}))}addDocumentListeners(){let i=this.debugService.getViewModel().focusedStackFrame,e=this.editor.getModel();e&&this.applyDocumentListeners(e,i)}applyDocumentListeners(i,e){if(!e||!this.uriIdentityService.extUri.isEqual(i.uri,e.source.uri)){this.altListener.clear();return}let t=this.editor.getContainerDomNode().ownerDocument;this.altListener.value=j(t,"keydown",o=>{if(new Ii(o).keyCode===6){this.altPressed=!0;let r=this.hoverWidget.isVisible();this.hoverWidget.hide(),this.defaultHoverLockout.clear(),r&&this.hoverPosition&&this.showEditorHover(this.hoverPosition.position,!1);let s=new On(t,"keyup"),l=H.any(this.hostService.onDidChangeFocus,s.event)(c=>{let u;ag(c)&&(u=new Ii(c)),(!u||u.keyCode===6)&&(this.altPressed=!1,this.preventDefaultEditorHover(),l.dispose(),s.dispose())})}})}async showHover(i,e,t){this.preventDefaultEditorHover();let o=this.debugService.getViewModel().focusedStackFrame,n=this.editor.getModel();o&&n&&this.uriIdentityService.extUri.isEqual(o.source.uri,n.uri)?await this.hoverWidget.showAt(i,e,t)===1&&this.showEditorHover(i,e):this.showEditorHover(i,e)}preventDefaultEditorHover(){if(this.defaultHoverLockout.value||this.editorHoverOptions?.enabled==="off")return;this.editor.getContribution(kl.ID)?.hideContentHover(),this.editor.updateOptions({hover:{enabled:"off"}}),this.defaultHoverLockout.value={dispose:()=>{this.editor.updateOptions({hover:{enabled:this.editorHoverOptions?.enabled??"on"}})}}}showEditorHover(i,e){let t=this.editor.getContribution(kl.ID),o=new z(i.lineNumber,i.column,i.lineNumber,i.column);this.defaultHoverLockout.clear(),t?.showContentHover(o,1,0,e)}async onFocusStackFrame(i){let e=this.editor.getModel();e&&(this.applyDocumentListeners(e,i),i&&this.uriIdentityService.extUri.isEqual(i.source.uri,e.uri)?await this.toggleExceptionWidget():this.hideHoverWidget()),await this.updateInlineValueDecorations(i)}get hoverDelay(){let i=this.editorHoverOptions?.delay||0,e=Kn(2-(i-300)/600,1,2);return i*e}get showHoverScheduler(){let i=new Dt(()=>{this.hoverPosition&&!this.altPressed&&this.showHover(this.hoverPosition.position,!1,this.hoverPosition.event)},this.hoverDelay);return this.toDispose.push(i),i}hideHoverWidget(){this.hoverWidget.willBeVisible()&&this.hoverWidget.hide(),this.showHoverScheduler.cancel(),this.defaultHoverLockout.clear()}onEditorMouseDown(i){this.mouseDown=!0,!(i.target.type===9&&i.target.detail===WB.ID)&&this.hideHoverWidget()}onEditorMouseMove(i){if(this.debugService.state!==2)return;let e=i.target,t=it?"metaKey":"ctrlKey";this.altPressed||(e.type===2?(this.defaultHoverLockout.clear(),this.gutterIsHovered=!0):this.gutterIsHovered&&(this.gutterIsHovered=!1,this.updateHoverConfiguration())),!((e.type===9&&e.detail===WB.ID||this.hoverWidget.isInSafeTriangle(i.event.posx,i.event.posy))&&((this.editorHoverOptions?.sticky??!0)||this.hoverWidget.isShowingComplexValue||i.event[t]))&&(e.type===6?e.position&&!Ie.equals(e.position,this.hoverPosition?.position||null)&&!this.hoverWidget.isInSafeTriangle(i.event.posx,i.event.posy)&&(this.hoverPosition={position:e.position,event:i.event},this.preventDefaultEditorHover(),this.showHoverScheduler.schedule(this.hoverDelay)):this.mouseDown||this.hideHoverWidget())}onKeyDown(i){let e=it?57:5;i.keyCode!==e&&i.keyCode!==6&&this.hideHoverWidget()}async toggleExceptionWidget(){let i=this.editor.getModel(),e=this.debugService.getViewModel().focusedStackFrame,t=e?e.thread.getCallStack():null;if(!i||!e||!t||t.length===0){this.closeExceptionWidget();return}let o=t.find(r=>!!(r&&r.source&&r.source.available&&r.source.presentationHint!=="deemphasize"));if(!o||o!==e){this.closeExceptionWidget();return}let n=this.uriIdentityService.extUri.isEqual(o.source.uri,i.uri);if(this.exceptionWidget&&!n)this.closeExceptionWidget();else if(n){let s=this.editorService.activeTextEditorControl===this.editor,l=await e.thread.exceptionInfo;l&&(s?this.showExceptionWidget(l,this.debugService.getViewModel().focusedSession,o.range.startLineNumber,o.range.startColumn):this.showExceptionWidgetWithoutScroll(l,this.debugService.getViewModel().focusedSession,o.range.startLineNumber,o.range.startColumn))}}showExceptionWidget(i,e,t,o){this.exceptionWidget&&this.exceptionWidget.dispose(),this.exceptionWidget=this.instantiationService.createInstance(Ete,this.editor,i,e,this.shouldScrollToExceptionWidget),this.exceptionWidget.show({lineNumber:t,column:o},0),this.exceptionWidget.focus(),this.editor.revealRangeInCenter({startLineNumber:t,startColumn:o,endLineNumber:t,endColumn:o}),this.exceptionWidgetVisible.set(!0)}showExceptionWidgetWithoutScroll(i,e,t,o){this.exceptionWidget&&this.exceptionWidget.dispose(),this.allowScrollToExceptionWidget=!1;let n=this.editor.getScrollTop(),r=this.editor.getVisibleRanges();if(r.length===0){this.exceptionWidget=this.instantiationService.createInstance(Ete,this.editor,i,e,this.shouldScrollToExceptionWidget),this.exceptionWidget.show({lineNumber:t,column:o},0),this.exceptionWidgetVisible.set(!0),this.allowScrollToExceptionWidget=!0;return}let s=r[0].startLineNumber;if(this.exceptionWidget=this.instantiationService.createInstance(Ete,this.editor,i,e,this.shouldScrollToExceptionWidget),this.exceptionWidget.show({lineNumber:t,column:o},0),this.exceptionWidgetVisible.set(!0),t<s){let l=this.exceptionWidget.getWhitespaceHeight();this.editor.setScrollTop(n+l,1)}this.allowScrollToExceptionWidget=!0}closeExceptionWidget(){if(this.exceptionWidget){let i=this.exceptionWidget.hasFocus();this.exceptionWidget.dispose(),this.exceptionWidget=void 0,this.exceptionWidgetVisible.set(!1),i&&this.editor.focus()}}async addLaunchConfiguration(){let i=this.editor.getModel();if(!i)return;let e,t,o=()=>{let r=0;Wx(i.getValue(),{onObjectProperty:s=>{t=s},onArrayBegin:s=>{t==="configurations"&&r===0&&(e=i.getPositionAt(s+1)),r++},onArrayEnd:()=>{r--}})};if(o(),!e){let{tabSize:r,insertSpaces:s}=i.getOptions(),l=i.getEOL(),c=No(i.uri.fsPath)==="launch.json"?Sb(i.getValue(),["configurations"],[],{tabSize:r,insertSpaces:s,eol:l})[0]:Sb(i.getValue(),["launch"],{configurations:[]},{tabSize:r,insertSpaces:s,eol:l})[0],u=i.getPositionAt(c.offset),p=u.lineNumber,h=new z(p,u.column,p,i.getLineMaxColumn(p));i.pushEditOperations(null,[An.replace(h,c.content)],()=>null),o()}if(!e)return;this.editor.focus(),await(r=>(i.getLineLastNonWhitespaceColumn(r.lineNumber)>r.column&&(this.editor.setPosition(r),this.instantiationService.invokeFunction(s=>{rL.LineBreakInsert.runEditorCommand(s,this.editor,null)})),this.editor.setPosition(r),this.commandService.executeCommand(yle.ID)))(e),await this.commandService.executeCommand("editor.action.triggerSuggest")}get removeInlineValuesScheduler(){return new Dt(()=>{this.displayedStore.clear(),this.oldDecorations.clear()},100)}get updateInlineValuesScheduler(){let i=this.editor.getModel();return new Dt(async()=>await this.updateInlineValueDecorations(this.debugService.getViewModel().focusedStackFrame),i?this.debounceInfo.get(i):dho)}async updateInlineValueDecorations(i){let e="{0} = {1}",o=this.editor.getModel(),n=this.configurationService.getValue("debug").inlineValues;if(!(n===!0||n==="on"||n==="auto"&&o&&this.languageFeaturesService.inlineValuesProvider.has(o))||!o||!i||o.uri.toString()!==i.source.uri.toString()){this.removeInlineValuesScheduler.isScheduled()||this.removeInlineValuesScheduler.schedule();return}this.removeInlineValuesScheduler.cancel(),this.displayedStore.clear();let s=this.editor.getVisibleRangesPlusViewportAboveBelow(),l,c=new $e;if(this.displayedStore.add(Z(()=>c.dispose(!0))),this.languageFeaturesService.inlineValuesProvider.has(o)){let p=async(S,y)=>{let w=await i.getMostSpecificScopes(i.range),k=y?S:S.toLowerCase();for(let T of w){let O=(await T.getChildren()).find(V=>y?V.name===k:V.name.toLowerCase()===k);if(O)return O.value}},h={frameId:i.frameId,stoppedLocation:new z(i.range.startLineNumber,i.range.startColumn+1,i.range.endLineNumber,i.range.endColumn+1)},g=this.languageFeaturesService.inlineValuesProvider.ordered(o).reverse();l=[];let f=new Map,v=g.flatMap(S=>s.map(y=>Promise.resolve(S.provideInlineValues(o,y,h,c.token)).then(async w=>{if(w)for(let k of w){let T;switch(k.type){case"text":T=k.text;break;case"variable":{let N=k.variableName;N||(N=o.getLineContent(k.range.startLineNumber).substring(k.range.startColumn-1,k.range.endColumn-1));let O=await p(N,k.caseSensitiveLookup);O&&(T=id(e,N,O));break}case"expression":{let N=k.expression;if(N||(N=o.getLineContent(k.range.startLineNumber).substring(k.range.startColumn-1,k.range.endColumn-1)),N){let O=new Jc(N);await O.evaluate(i.thread.session,i,"watch",!0),O.available&&(T=id(e,N,O.value))}break}}if(T){let N=k.range.startLineNumber,O=f.get(N);O||(O=[],f.set(N,O)),O.some(V=>V.text===T)||O.push(new CEi(k.range.startColumn,T))}}},w=>{ss(w)}))),b=Date.now();await Promise.all(v),this.updateInlineValuesScheduler.delay=this.debounceInfo.update(o,Date.now()-b),f.forEach((S,y)=>{if(S.length>0){S=S.sort((O,V)=>O.column-V.column);let w=S.map(O=>O.text).join(", "),k=this.editor.getLayoutInfo().width,T=this.editor.getOption(59),N=Math.floor((k-50)/T.typicalHalfwidthCharacterWidth);l.push(...rhe(y,w,"debug",void 0,N))}})}else{let p=await i.getMostSpecificScopes(i.range),h=await Promise.all(p.map(async f=>({scope:f,variables:await f.getChildren()}))),g=new Map;for(let{scope:f,variables:v}of h){let b=new z(0,0,i.range.startLineNumber,i.range.startColumn);f.range&&(b=b.setStartPosition(f.range.startLineNumber,f.range.startColumn));let S=s.map(w=>w.intersectRanges(b)).filter(mo);this._wordToLineNumbersMap??=new xEi(o);for(let w of S)this._wordToLineNumbersMap.ensureRangePopulated(w);let y=dYo(v,S,o,this._wordToLineNumbersMap.value);for(let{line:w,variables:k}of y){let T=g.get(w);T||(T=new Map,g.set(w,T));for(let{name:N,value:O}of k)T.has(N)||T.set(N,O)}}l=[...g.entries()].flatMap(([f,v])=>{let b=[...v].map(([k,T])=>`${k} = ${T}`).join(", "),S=this.editor.getLayoutInfo().width,y=this.editor.getOption(59),w=Math.floor((S-50)/y.typicalHalfwidthCharacterWidth);return rhe(f,b,"debug",void 0,w)})}if(c.token.isCancellationRequested)return;let u;if(this.editor.getOption(149)!=="off"){let p=this.editor.getPosition();p&&this.editor.getVisibleRanges().some(h=>h.containsPosition(p))&&(u={position:p,top:this.editor.getTopForPosition(p.lineNumber,p.column)})}if(this.oldDecorations.set(l),u){let p=this.editor.getTopForPosition(u.position.lineNumber,u.position.column);this.editor.setScrollTop(this.editor.getScrollTop()-(u.top-p),1)}}dispose(){this.hoverWidget?.dispose(),this.configurationWidget?.dispose(),this.exceptionWidget?.dispose(),this.toDispose=Ue(this.toDispose)}};I([mi],U3.prototype,"showHoverScheduler",1),I([mi],U3.prototype,"removeInlineValuesScheduler",1),I([mi],U3.prototype,"updateInlineValuesScheduler",1),U3=I([m(1,Li),m(2,F),m(3,ge),m(4,B),m(5,oi),m(6,dt),m(7,X),m(8,zt),m(9,jg),m(10,ee)],U3);var xEi=class{constructor(i){this.model=i;this.value=new Map;this.intervals=new Uint8Array(Math.ceil(i.getLineCount()/8))}ensureRangePopulated(i){for(let e=i.startLineNumber;e<=i.endLineNumber;e++){let t=e>>3,o=1<<(e&7);this.intervals[t]&o||(uYo(this.model,e,this.value),this.intervals[t]|=o)}}};qe.registerCommand("_executeInlineValueProvider",async(a,i,e,t)=>{if(So(A.isUri(i)),So(z.isIRange(e)),!t||typeof t.frameId!="number"||!z.isIRange(t.stoppedLocation))throw Br("context");let o=a.get(Ct).getModel(i);if(!o)throw Br("uri");let n=z.lift(e),{inlineValuesProvider:r}=a.get(zt),s=r.ordered(o);return(await Promise.all(s.map(c=>c.provideInlineValues(o,n,t,ve.None)))).flat().filter(mo)});var DUt=class{constructor(i,e){this.column=i;this.text=e}},u0=class extends C{constructor(e,t,o,n,r,s){super();this.notebookEditor=e;this.notebookKernelService=t;this.notebookExecutionStateService=o;this.languageFeaturesService=n;this.configurationService=r;this.debugService=s;this.cellDecorationIds=new Map;this.cellContentListeners=new vt;this.currentCancellationTokenSources=new vt;this._register(this.notebookExecutionStateService.onDidChangeExecution(async l=>{this.configurationService.getValue(ft.notebookInlineValues)!=="off"&&l.type===0&&await this.updateInlineVariables(l)})),this._register(H.runAndSubscribe(this.configurationService.onDidChangeConfiguration,l=>{(!l||l.affectsConfiguration(ft.notebookInlineValues))&&this.configurationService.getValue(ft.notebookInlineValues)==="off"&&this.clearNotebookInlineDecorations()}))}static{this.id="notebook.inlineVariablesController"}static{this.MAX_CELL_LINES=5e3}async updateInlineVariables(e){if(e.changed)return;let t=this.notebookEditor.getCellByHandle(e.cellHandle);if(!t)return;let o=this.currentCancellationTokenSources.get(t.uri);o&&o.cancel(),this.currentCancellationTokenSources.set(t.uri,new $e);let n=this.currentCancellationTokenSources.get(t.uri).token;if(this.debugService.state!==0){this._clearNotebookInlineDecorations();return}if(!this.notebookEditor.textModel?.uri||!Xe(this.notebookEditor.textModel.uri,e.notebook))return;let r=await t.resolveTextModel();if(!r)return;let s=this.configurationService.getValue(ft.notebookInlineValues),l=this.languageFeaturesService.inlineValuesProvider.has(r);if(s==="off"||s==="auto"&&!l)return;this.clearCellInlineDecorations(t);let c=[];if(l){let u=r.getLineCount(),p=r.getLineMaxColumn(u),h={frameId:0,stoppedLocation:new z(u,p,u,p)},g=this.languageFeaturesService.inlineValuesProvider.ordered(r).reverse(),f=new Map,v=new z(1,1,u,p),b=g.flatMap(S=>Promise.resolve(S.provideInlineValues(r,v,h,n)).then(async y=>{if(!y)return;let w=this.notebookEditor.textModel;if(!w)return;let k=this.notebookKernelService.getMatchingKernel(w),T=[];if(y.some(N=>N.type==="variable")){if(!this.notebookEditor.hasModel())return;let N=k.selected?.provideVariables(e.notebook,void 0,"named",0,n);if(N)for await(let O of N)T.push(O)}for(let N of y){let O;switch(N.type){case"text":O=N.text;break;case"variable":{let V=N.variableName;if(!V)continue;let U=T.find(G=>G.name===V)?.value;if(!U)continue;O=id("{0} = {1}",V,U);break}case"expression":continue}if(O){let V=N.range.startLineNumber,U=f.get(V);U||(U=[],f.set(V,U)),U.some(G=>G.text===O)||U.push(new DUt(N.range.startColumn,O))}}},y=>{ss(y)}));await Promise.all(b),f.forEach((S,y)=>{if(S.length>0){S.sort((N,O)=>N.column-O.column);let w=S.map(N=>N.text).join(", "),k=t.layoutInfo.editorWidth,T=t.layoutInfo.fontInfo;if(T&&t.textModel){let N=Math.floor((k-50)/T.typicalHalfwidthCharacterWidth),O=t.textModel.getLineLength(y),V=Math.max(0,N-O);c.push(...rhe(y,w,"nb",void 0,V))}else c.push(...rhe(y,w,"nb"))}})}else if(s==="on"){if(!this.notebookEditor.hasModel())return;let p=this.notebookKernelService.getMatchingKernel(this.notebookEditor.textModel)?.selected?.provideVariables(e.notebook,void 0,"named",0,n);if(!p)return;let h=[];for await(let k of p)h.push(k);let g=h.map(k=>k.name),f=t.textModel;if(!f||f.getLineCount()>u0.MAX_CELL_LINES)return;let v=new Set,b=this.getFunctionRanges(f),S=this.getCommentedRanges(f),y=[...b,...S],w=new Map;for(let k of g){if(v.has(k))continue;let T=new RegExp(`\\b${k}\\b(?!\\w)`,"g"),N=null,O=!1,V=f.getValue().split(`
`);for(let U=V.length-1;U>=0;U--){let G=V[U],$;for(;($=T.exec(G))!==null;){let te=$.index,pe=new Ie(U+1,te+1);if(!this.isPositionInRanges(pe,y)){N={line:U+1,column:te+1},O=!0;break}}if(O)break}if(N){let U=k+" = "+h.find($=>$.name===k)?.value,G=w.get(N.line);G||(G=[],w.set(N.line,G)),G.some($=>$.text===U)||G.push(new DUt(N.column,U))}v.add(k)}w.forEach((k,T)=>{if(k.length>0){k.sort((U,G)=>U.column-G.column);let N=k.map(U=>U.text).join(", "),O=t.layoutInfo.editorWidth,V=t.layoutInfo.fontInfo;if(V&&t.textModel){let U=Math.floor((O-50)/V.typicalHalfwidthCharacterWidth),G=t.textModel.getLineLength(T),$=Math.max(0,U-G);c.push(...rhe(T,N,"nb",void 0,$))}else c.push(...rhe(T,N,"nb"))}})}c.length>0&&(this.updateCellInlineDecorations(t,c),this.initCellContentListener(t))}getFunctionRanges(e){return e.getLanguageId()==="python"?this.getPythonFunctionRanges(e.getValue()):this.getBracedFunctionRanges(e.getValue())}getPythonFunctionRanges(e){let t=[],o=e.split(`
`),n=-1,r=!1,s=-1,l=/^(\s*)(async\s+)?(?:def\s+\w+|class\s+\w+)\s*\([^)]*\)\s*:/;for(let c=0;c<o.length;c++){let u=o[c],p=u.match(l);if(p){r&&p[1].length<=s&&(t.push(new z(n+1,1,c,u.length+1)),r=!1),r||(r=!0,n=c,s=p[1].length);continue}if(r){if(u.trim()==="")continue;(u.match(/^\s*/)?.[0].length??0)<=s&&(t.push(new z(n+1,1,c,u.length+1)),r=!1,s=-1)}}return r&&t.push(new z(n+1,1,o.length,o[o.length-1].length+1)),t}getBracedFunctionRanges(e){let t=[],o=e.split(`
`),n=0,r=-1,s=!1,l=/\b(?:function\s+\w+|(?:async\s+)?(?:\w+\s*=\s*)?\([^)]*\)\s*=>|class\s+\w+|(?:public|private|protected|static)?\s*\w+\s*\([^)]*\)\s*{)/;for(let c=0;c<o.length;c++){let u=o[c];for(let p of u)p==="{"?(!s&&l.test(u)&&(s=!0,r=c),n++):p==="}"&&(n--,n===0&&s&&(t.push(new z(r+1,1,c+1,u.length+1)),s=!1))}return t}getCommentedRanges(e){return this._getCommentedRanges(e)}_getCommentedRanges(e){try{return this.getCommentedRangesByAccurateTokenization(e)}catch{return this.getCommentedRangesByManualParsing(e)}}getCommentedRangesByAccurateTokenization(e){let t=[],o=e.getLineCount();if(o>u0.MAX_CELL_LINES)return t;for(let n=1;n<=o;n++){e.tokenization.hasAccurateTokensForLine(n)||e.tokenization.forceTokenization(n);let r=e.tokenization.getLineTokens(n);if(r.getCount()===0)continue;let s;for(let l=0;l<r.getCount();l++){let c=r.getStandardTokenType(l);if(c===1||c===2||c===3){s===void 0&&(s=r.getStartOffset(l));let u=r.getEndOffset(l),p=l===r.getCount()-1,h=!p&&r.getStandardTokenType(l+1)!==c;(p||h)&&(t.push(new z(n,s+1,n,u+1)),s=void 0)}else s=void 0}}return t}getCommentedRangesByManualParsing(e){let t=[],o=e.getValue().split(`
`),n=e.getLanguageId(),r=n==="python"?"#":n==="javascript"||n==="typescript"?"//":null,s=n==="javascript"||n==="typescript"?{start:"/*",end:"*/"}:null,l=!1,c=-1,u=-1;for(let p=0;p<o.length;p++){let h=o[p];if(h.trim().length!==0){if(s){if(!l){let f=h.indexOf(s.start);f!==-1&&(l=!0,c=p,u=f)}if(l){let f=h.indexOf(s.end);f!==-1&&(t.push(new z(c+1,u+1,p+1,f+s.end.length+1)),l=!1);continue}}if(!l&&r&&h.trimLeft().startsWith(r)){let f=h.indexOf(r);t.push(new z(p+1,f+1,p+1,h.length+1))}}}return l&&t.push(new z(c+1,u+1,o.length,o[o.length-1].length+1)),t}isPositionInRanges(e,t){return t.some(o=>o.containsPosition(e))}updateCellInlineDecorations(e,t){let o=this.cellDecorationIds.get(e)??[];this.cellDecorationIds.set(e,e.deltaModelDecorations(o,t))}initCellContentListener(e){let t=e.textModel;t&&this.cellContentListeners.set(e.uri,t.onDidChangeContent(()=>{this.clearCellInlineDecorations(e)}))}clearCellInlineDecorations(e){let t=this.cellDecorationIds.get(e)??[];t&&(e.deltaModelDecorations(t,[]),this.cellDecorationIds.delete(e));let o=this.cellContentListeners.get(e.uri);o&&(o.dispose(),this.cellContentListeners.delete(e.uri))}_clearNotebookInlineDecorations(){this.cellDecorationIds.forEach((e,t)=>{this.clearCellInlineDecorations(t)})}clearNotebookInlineDecorations(){this._clearNotebookInlineDecorations()}dispose(){super.dispose(),this._clearNotebookInlineDecorations(),this.currentCancellationTokenSources.forEach(e=>e.cancel()),this.currentCancellationTokenSources.clear(),this.cellContentListeners.forEach(e=>e.dispose()),this.cellContentListeners.clear()}};u0=I([m(1,Tl),m(2,rs),m(3,zt),m(4,B),m(5,Li)],u0);tm(u0.id,u0);W(class extends qu{constructor(){super({id:"notebook.clearAllInlineValues",title:d(11717,null)})}runWithContext(i,e){return e.notebookEditor.getContribution(u0.id).clearNotebookInlineDecorations(),Promise.resolve()}});var pYo="notebook.clearAllCellsOutputs",mYo="notebook.cell.edit",hYo="notebook.cell.delete",uho="notebook.quitEditAllCells",gYo="notebook.cell.clearOutputs",kEi="notebook.selectIndentation",fYo="notebook.commentSelectedCells";W(class extends gd{constructor(){super({id:mYo,title:d(11791,null),keybinding:{when:x.and($u,x.not(Uu),ue.hoverFocused.toNegated(),yZ.toNegated()),primary:3,weight:200},menu:{id:D.NotebookCellTitle,when:x.and(Kl.isEqualTo(!0),hS.isEqualTo("markup"),wZ.toNegated(),bw),order:1,group:VF},icon:Yao})}async runWithContext(i,e){if(!e.notebookEditor.hasModel())return;await e.notebookEditor.focusNotebookCell(e.cell,"editor");let t=e.cell?xZ(e,e.cell):void 0;t&&t.hasTextFocus()&&_m.get(t)?.getWidgetPosition()?.lineNumber===t.getPosition()?.lineNumber&&_m.get(t)?.focus()}});var pho=x.and(rr,$h,Y4.toNegated());W(class extends gd{constructor(){super({id:udi,title:d(11792,null),menu:{id:D.NotebookCellTitle,when:x.and(hS.isEqualTo("markup"),wZ,bw),order:4,group:VF},icon:Xao,keybinding:[{when:x.and(pho,ue.hoverVisible.toNegated(),ue.hasNonEmptySelection.toNegated(),ue.hasMultipleSelections.toNegated()),primary:9,weight:rf-5},{when:x.and(rr,PR),primary:9,weight:205},{when:x.and(pho,hS.isEqualTo("markup")),primary:259,win:{primary:2563},weight:rf-5}]})}async runWithContext(i,e){e.cell.cellKind===1&&e.cell.updateEditState(0,udi),await e.notebookEditor.focusNotebookCell(e.cell,"container",{skipReveal:!0})}});W(class extends qu{constructor(){super({id:uho,title:d(11793,null)})}async runWithContext(i,e){if(!e.notebookEditor.hasModel())return;let t=e.notebookEditor.getViewModel();if(!t)return;let o=e.notebookEditor.getActiveCell();t.viewCells.filter(r=>r.cellKind===1&&r.getEditState()===1).forEach(r=>{r.updateEditState(0,uho)}),o&&await e.notebookEditor.focusNotebookCell(o,"container",{skipReveal:!0})}});W(class extends gd{constructor(){super({id:hYo,title:d(11790,null),keybinding:{primary:20,mac:{primary:2049},when:x.and(rr,x.not(Uu),yZ.toNegated()),weight:200},menu:[{id:D.NotebookCellDelete,when:Kl,group:VF},{id:D.InteractiveCellDelete,group:VF}],icon:jao})}async runWithContext(i,e){if(!e.notebookEditor.hasModel())return;let t,n=i.get(rs).getCellExecution(e.cell.uri)?.state,r=i.get(B);if(n===3&&r.getValue(ft.confirmDeleteRunningCell)){let s=i.get(ct),l=d(11779,null);t=await s.confirm({type:"question",message:d(11780,null),primaryButton:l,checkbox:{label:d(11782,null)}})}else t={confirmed:!0};t.confirmed&&(t.checkboxChecked===!0&&await r.updateValue(ft.confirmDeleteRunningCell,!1),Pco(e.notebookEditor,e.cell))}});W(class extends gd{constructor(){super({id:gYo,title:d(11777,null),menu:[{id:D.NotebookCellTitle,when:x.and(hS.isEqualTo("code"),wyi,gk,Kl,bw,WJe.toNegated()),order:6,group:zao},{id:D.NotebookOutputToolbar,when:x.and(gk,Kl,bw,bWt,WJe)}],keybinding:{when:x.and(rr,x.not(Uu),gk,Kl,bw),primary:532,weight:200},icon:xyi})}async runWithContext(i,e){let t=i.get(rs),o=e.notebookEditor;if(!o.hasModel()||!o.textModel.length)return;let n=e.cell,r=o.textModel.cells.indexOf(n.model);if(r<0)return;let s=!o.isReadOnly;o.textModel.applyEdits([{editType:2,index:r,outputs:[]}],!0,void 0,()=>{},void 0,s),t.getCellExecution(e.cell.uri)?.state!==3&&e.notebookEditor.textModel.applyEdits([{editType:9,index:r,internalMetadata:{runStartTime:null,runStartTimeAdjustment:null,runEndTime:null,executionOrder:null,lastRunSuccess:null}}],!0,void 0,()=>{},void 0,s)}});W(class extends qu{constructor(){super({id:pYo,title:d(11776,null),precondition:yWt,menu:[{id:D.EditorTitle,when:x.and(Ua,x.notEquals("config.notebook.globalToolbar",!0)),group:"navigation",order:0},{id:D.NotebookToolbar,when:x.and(wyi,x.equals("config.notebook.globalToolbar",!0)),group:"navigation/execute",order:10}],icon:xyi})}async runWithContext(i,e){let t=i.get(rs),o=e.notebookEditor;if(!o.hasModel()||!o.textModel.length)return;let n=!o.isReadOnly;o.textModel.applyEdits(o.textModel.cells.map((l,c)=>({editType:2,index:c,outputs:[]})),!0,void 0,()=>{},void 0,n);let r=o.textModel.cells.map((l,c)=>{if(t.getCellExecution(l.uri)?.state!==3)return{editType:9,index:c,internalMetadata:{runStartTime:null,runStartTimeAdjustment:null,runEndTime:null,executionOrder:null,lastRunSuccess:null}}}).filter(l=>!!l);r.length&&e.notebookEditor.textModel.applyEdits(r,!0,void 0,()=>{},void 0,n),o.getContribution(u0.id).clearNotebookInlineDecorations()}});W(class extends gd{constructor(){super({id:AEt,title:d(11775,null),keybinding:{weight:200,primary:Ai(2089,43),when:x.and(rr,Kl,bw)},metadata:{description:d(11775,null),args:[{name:"range",description:"The cell range",schema:{type:"object",required:["start","end"],properties:{start:{type:"number"},end:{type:"number"}}}},{name:"language",description:"The target cell language",schema:{type:"string"}}]}})}getCellContextFromArgs(i,e,...t){if(!e||typeof e.start!="number"||typeof e.end!="number"||e.start>=e.end)return;let o=t.length&&typeof t[0]=="string"?t[0]:void 0,n=this.getEditorContextFromArgsOrActive(i);if(!(!n||!n.notebookEditor.hasModel()||e.start>=n.notebookEditor.getLength()))return{notebookEditor:n.notebookEditor,cell:n.notebookEditor.cellAt(e.start),language:o}}async runWithContext(i,e){e.language?await this.setLanguage(e,e.language):await this.showLanguagePicker(i,e)}async showLanguagePicker(i,e){let t=[],o=[],n=i.get(kt),r=i.get(Ct),s=i.get(Ge),l=i.get(eS),c=i.get(Tl),u=e.notebookEditor.activeKernel?.supportedLanguages;if(!u){let S=c.getMatchingKernel(e.notebookEditor.textModel).all.flatMap(y=>y.supportedLanguages);u=S.length>0?S:n.getRegisteredLanguageIds()}new Set([...u,"markdown"]).forEach(b=>{let S;(e.cell.cellKind===1?b==="markdown":b===e.cell.language)?S=d(11785,null,b):S=d(11786,null,b);let y=n.getLanguageName(b);if(!y)return;let w={label:y,iconClasses:js(r,n,this.getFakeResource(y,n)),description:S,languageId:b};b==="markdown"||b===e.cell.language?t.push(w):o.push(w)}),o.sort((b,S)=>b.description.localeCompare(S.description));let h={label:d(11774,null)},g=[h,{type:"separator",label:d(11787,null)},...t,{type:"separator"},...o],f=await s.pick(g,{placeHolder:d(11796,null)}),v=f===h?await l.detectLanguage(e.cell.uri):f?.languageId;v&&await this.setLanguage(e,v)}async setLanguage(i,e){await mho(e,i)}getFakeResource(i,e){let t,o=e.getLanguageIdByLanguageName(i);if(o){let n=e.getExtensions(o);if(n.length)t=A.file(n[0]);else{let r=e.getFilenames(o);r.length&&(t=A.file(r[0]))}}return t}});W(class extends gd{constructor(){super({id:T8e,title:L(11781,"Accept Detected Language for Cell"),f1:!0,precondition:x.and(Kl,bw),keybinding:{primary:1570,weight:200}})}async runWithContext(i,e){let t=i.get(eS),o=i.get(Ne),s=[...i.get(Tl).getSelectedOrSuggestedKernel(e.notebookEditor.textModel)?.supportedLanguages??[]];s.push("markdown");let l=await t.detectLanguage(e.cell.uri,s);l?mho(l,e):o.warn(d(11788,null))}});async function mho(a,i){if(a==="markdown"&&i.cell?.language!=="markdown"){let e=i.notebookEditor.getCellIndex(i.cell);await SMe(1,{cell:i.cell,notebookEditor:i.notebookEditor,ui:!0},"markdown",Zn.markdown);let t=i.notebookEditor.cellAt(e);t&&await i.notebookEditor.focusNotebookCell(t,"editor")}else if(a!=="markdown"&&i.cell?.cellKind===1)await SMe(2,{cell:i.cell,notebookEditor:i.notebookEditor,ui:!0},a);else{let e=i.notebookEditor.textModel.cells.indexOf(i.cell.model);i.notebookEditor.textModel.applyEdits([{editType:4,index:e,language:a}],!0,void 0,()=>{},void 0,!i.notebookEditor.isReadOnly)}}W(class extends qu{constructor(){super({id:kEi,title:L(11797,"Select Indentation"),f1:!0,precondition:x.and(Ua,Kl,bw)})}async runWithContext(i,e){await this.showNotebookIndentationPicker(i,e)}async showNotebookIndentationPicker(i,e){let t=i.get(Ge),o=i.get(ee),n=i.get(F),r=qn(o.activeEditorPane);if(!r||r.isDisposed)return t.pick([{label:d(11789,null)}]);if(r.isReadOnly)return t.pick([{label:d(11794,null)}]);let s=[new Ett,new Ttt,new _tt,new Ltt,new Dtt].map(c=>({id:c.desc.id,label:c.desc.title.toString(),run:()=>{n.invokeFunction(c.run)}}));s.splice(3,0,{type:"separator",label:d(11783,null)}),s.unshift({type:"separator",label:d(11784,null)});let l=await t.pick(s,{placeHolder:d(11795,null),matchOnDetail:!0});l&&(l.run(),e.notebookEditor.focus())}});W(class extends xg{constructor(){super({id:fYo,title:d(11778,null),keybinding:{when:x.and(rr,Kl,x.not(Uu)),primary:2138,weight:200}})}async runWithContext(i,e){let t=i.get(bs);e.selectedCells.forEach(async o=>{let n=await o.resolveTextModel(),r=o.commentOptions,s=new oCe(t,new Yt(1,1,n.getLineCount(),n.getLineMaxColumn(n.getLineCount())),n.getOptions().tabSize,0,r.insertSpace??!0,r.ignoreEmptyLines??!0,!1),l=o.getSelections(),c=l.map(p=>n._setTrackedRange(null,p,1));V9.executeCommands(n,l,[s]);let u=c.map(p=>n._getTrackedRange(p)).filter(p=>!!p).map(p=>new Yt(p.startLineNumber,p.startColumn,p.endLineNumber,p.endColumn));o.setSelections(u??[])})}});qe.registerCommand("_resolveNotebookContentProvider",a=>a.get(un).getContributedNotebookTypes().map(t=>{let o=t.selectors.map(n=>typeof n=="string"||eP(n)?n:pkt(n)?{include:n.include,exclude:n.exclude}:null).filter(n=>n!==null);return{viewType:t.id,displayName:t.displayName,filenamePattern:o,options:{transientCellMetadata:t.options.transientCellMetadata,transientDocumentMetadata:t.options.transientDocumentMetadata,transientOutputs:t.options.transientOutputs}}}));qe.registerCommand("_resolveNotebookKernels",async(a,i)=>{let e=a.get(Tl),t=A.revive(i.uri);return e.getMatchingKernel({uri:t,notebookType:i.viewType}).all.map(n=>({id:n.id,label:n.label,description:n.description,detail:n.detail,isPreferred:!1,preloads:n.preloadUris}))});var vYo=5e3,bYo=1e3,SYo=200,JAe=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.prompt=e;this._quickInputService=t;this._terminalService=o;this._searchService=n;this._workspaceContextService=r;this._labelService=s;this._fileService=l;this._modelService=c;this._languageService=u;this._terminalGroupService=p;this._instantiationService=h;this._codeEditorService=g;this._editorService=f;this.quickPick=this._register(t.createQuickPick({useSeparators:!0}))}async createArgs(e){let{quickPick:t,prompt:o}=this;t.totalSteps=o.arguments.length,t.step=0,t.ignoreFocusOut=!0,t.sortByLabel=!1;let n={},r=[];for(let s=0;s<o.arguments.length;s++){let l=o.arguments[s],c=r.at(s);t.step=s+1,t.placeholder=l.required?l.description:`${l.description||""} (${d(11248,null)})`,t.title=d(11246,null,l.title||l.name),t.value=c?.value??(n.hasOwnProperty(l.name)&&n[l.name]||""),t.items=c?.items??[],t.activeItems=c?.activeItems??[],t.buttons=s>0?[this._quickInputService.backButton]:[];let u=await this._getArg(l,!!c,n,e);if(u.type==="back")s-=2;else{if(u.type==="cancel")return;u.type==="arg"?(r[s]={value:t.value,items:t.items.slice(),activeItems:t.activeItems.slice()},n[l.name]=u.value):Hr(u)}}return t.value="",t.placeholder=d(11234,null),t.busy=!0,n}async _getArg(e,t,o,n){let{quickPick:r}=this,s=new P,l=Le(this,r.value),c=[{name:d(11245,null),observer:this._promptCompletions(e,l,o)},{name:d(11236,null),observer:this._activeFileCompletions()},{name:d(11240,null),observer:this._fileCompletions(l)}];s.add(he(u=>{if(t){l.read(u);return}let p=[];p.push({id:"insert-text",label:d(11239,null),iconClass:q.asClassName(M.textSize),action:"text",alwaysShow:!0}),p.push({id:"run-command",label:d(11237,null),description:d(11238,null),iconClass:q.asClassName(M.terminal),action:"command",alwaysShow:!0});let h=!1;for(let b of c){let S=b.observer.read(u);h||=S.busy,S.picks&&(p.push({label:b.name,type:"separator"}),p=p.concat(S.picks))}let g=r.activeItems;r.busy=h,r.items=p;let f=p.find(b=>g.some(S=>S.id===b.id)),v=c[0].observer;f?r.activeItems=[f]:v.read(u).picks?.length?r.activeItems=[p[3]]:h?r.activeItems=[]:r.activeItems=[p[0]]}));try{let u=await new Promise(h=>{n&&s.add(n.onCancellationRequested(()=>{h(void 0)})),s.add(r.onDidChangeValue(g=>{r.validationMessage=void 0,l.set(g,void 0)})),s.add(r.onDidAccept(()=>{let g=r.selectedItems[0];!r.value&&e.required&&(!g||g.action==="text"||g.action==="command")?r.validationMessage=d(11241,null):h(g||{id:"insert-text",label:"",action:"text"})})),s.add(r.onDidTriggerButton(()=>{h("back")})),s.add(r.onDidHide(()=>{h(void 0)})),r.show()});if(u==="back")return{type:"back"};if(u===void 0)return{type:"cancel"};s.clear();let p=new $e;switch(s.add(Z(()=>p.dispose(!0))),s.add(r.onDidHide(()=>s.dispose())),u.action){case"text":return{type:"arg",value:r.value||void 0};case"command":return r.value?(r.busy=!0,{type:"arg",value:await this._getTerminalOutput(r.value,p.token)}):{type:"arg",value:void 0};case"suggest":return{type:"arg",value:u.label};case"file":return r.busy=!0,{type:"arg",value:await this._fileService.readFile(u.uri).then(h=>h.value.toString())};case"selectedText":return{type:"arg",value:u.selectedText};default:Hr(u)}}finally{s.dispose()}}_promptCompletions(e,t,o){let n={};for(let[r,s]of Object.entries(o))s&&(n[r]=s);return this._asyncCompletions(t,async(r,s)=>(await this.prompt.complete(e.name,r,n,s)).map(c=>({id:`suggest:${c}`,label:c,action:"suggest"})))}_fileCompletions(e){let t=this._instantiationService.createInstance(aS);return this._asyncCompletions(e,async(o,n)=>{if(!o)return[];let r=t.file(this._workspaceContextService.getWorkspace().folders,{filePattern:o,maxResults:10}),{results:s}=await this._searchService.fileSearch(r,n);return s.map(l=>({id:l.resource.toString(),label:Ye(l.resource),description:this._labelService.getUriLabel(l.resource),iconClasses:js(this._modelService,this._languageService,l.resource),uri:l.resource,action:"file"}))})}_activeFileCompletions(){let e=Nr(this,this._editorService.onDidActiveEditorChange),t=Ce(r=>(e.read(r),this._codeEditorService.getActiveCodeEditor())),o=t.map(r=>r?Nr(this,r.onDidChangeModel).map(()=>r.getModel()?.uri):void 0).map((r,s)=>r?.read(s)),n=t.map(r=>r?Nr(this,r.onDidChangeCursorSelection).map(()=>({range:r.getSelection(),model:r.getModel()})):void 0).map((r,s)=>r?.read(s));return Ce(r=>{let s=o.read(r);if(!s)return{busy:!1,picks:[]};let l=[];l.push({id:"active-file",label:d(11235,null),description:this._labelService.getUriLabel(s),iconClasses:js(this._modelService,this._languageService,s),uri:s,action:"file"});let c=n.read(r);if(c&&c.model&&c.range&&!c.range.isEmpty()){let u=c.model.getValueInRange(c.range),p=c.range.endLineNumber-c.range.startLineNumber+1,h=p===1?d(11244,null,c.range.startLineNumber):d(11243,null,p);l.push({id:"selected-text",label:d(11242,null),description:h,selectedText:u,iconClass:q.asClassName(M.selection),uri:s,action:"selectedText"})}return{picks:l,busy:!1}})}_asyncCompletions(e,t){return Ce(n=>{let r=e.read(n),s=new $e;return n.store.add(Z(()=>s.dispose(!0))),new Au(Pi(SYo,s.token).then(()=>t(r,s.token)).catch(()=>[]))}).map((n,r)=>{let s=n.promiseResult.read(r);return{picks:s?.data||[],busy:s===void 0}})}async _getTerminalOutput(e,t){let o=this._terminal??=this._register(await this._terminalService.createTerminal({config:{name:d(11247,null),isTransient:!0,forceShellIntegration:!0,isFeatureTerminal:!0},location:1}));this._terminalService.setActiveInstance(o),this._terminalGroupService.showPanel(!1);let n=o.capabilities.get(2);if(n)return this._getTerminalOutputInner(o,e,n,t);let r=new P;return await new Promise(s=>{r.add(o.capabilities.onDidAddCapability(l=>{l.id===2&&(r.dispose(),s(this._getTerminalOutputInner(o,e,l.capability,t)))})),r.add(t.onCancellationRequested(()=>{r.dispose(),s(void 0)})),r.add(nn(()=>{r.dispose(),s(this._getTerminalOutputInner(o,e,void 0,t))},vYo))})}async _getTerminalOutputInner(e,t,o,n){let r=new P;return new Promise(s=>{let l="";if(r.add(e.onLineData(c=>l+=c+`
`)),o)r.add(o.onCommandFinished(c=>s(c.getOutput()||l)));else{let c=r.add(new Dt(()=>s(l),bYo));r.add(e.onData(()=>c.schedule()))}r.add(n.onCancellationRequested(()=>s(void 0))),r.add(e.onDisposed(()=>s(void 0))),e.runCommand(t,!0)}).finally(()=>{r.dispose()})}};JAe=I([m(1,Ge),m(2,Yo),m(3,Jp),m(4,Pe),m(5,ot),m(6,be),m(7,Ct),m(8,kt),m(9,jl),m(10,F),m(11,Kt),m(12,ee)],JAe);var ZAe=class extends Ma{constructor(e,t,o,n,r,s){super();this.contextViewProvider=t;this.contextKeyService=n;this.configurationService=r;this.keybindingService=s;this._onSubmit=this._register(new E);this.onSubmit=this._onSubmit.event;this._onCancel=this._register(new E);this.onCancel=this._onCancel.event;o={ariaLabel:d(13156,null),...o},this.width=o.width??100,this.render(o),e.appendChild(this.domNode)}static{this.OPTION_CHANGE="optionChange"}dispose(){super.dispose(),this.inputFocusTracker?.dispose()}setWidth(e){this.width=e,this.contextViewProvider.layout(),this.setInputWidth()}getValue(){return this.inputBox.value}setValue(e){this.inputBox.value!==e&&(this.inputBox.value=e)}select(){this.inputBox.select()}focus(){this.inputBox.focus()}inputHasFocus(){return this.inputBox.hasFocus()}setInputWidth(){this.inputBox.width=this.width-this.getSubcontrolsWidth()-2}getSubcontrolsWidth(){return 0}getHistory(){return this.inputBox.getHistory()}clearHistory(){this.inputBox.clearHistory()}prependHistory(e){this.inputBox.prependHistory(e)}clear(){this.setValue("")}onSearchSubmit(){this.inputBox.addToHistory()}showNextTerm(){this.inputBox.showNextValue()}showPreviousTerm(){this.inputBox.showPreviousValue()}render(e){this.domNode=document.createElement("div"),this.domNode.classList.add("monaco-findInput");let t=e.history||[];this.inputBox=this._register(new D1(this.domNode,this.contextViewProvider,{placeholder:e.placeholder,showPlaceholderOnFocus:e.showPlaceholderOnFocus,tooltip:e.tooltip,ariaLabel:e.ariaLabel,validationOptions:{validation:void 0},history:new Set(t),showHistoryHint:()=>ML(this.keybindingService),inputBoxStyles:e.inputBoxStyles},this.contextKeyService)),this._register(this.inputBox.onDidChange(()=>this._onSubmit.fire(!0))),this.inputFocusTracker=Vn(this.inputBox.inputElement),this.onkeyup(this.inputBox.inputElement,n=>this.onInputKeyUp(n));let o=document.createElement("div");o.className="controls",this.renderSubcontrols(o),this.domNode.appendChild(o),this.setInputWidth()}renderSubcontrols(e){}onInputKeyUp(e){switch(e.keyCode){case 3:this.onSearchSubmit(),this._onSubmit.fire(!1);return;case 9:this._onCancel.fire();return}}};ZAe=I([m(3,X),m(4,B),m(5,_e)],ZAe);var Tte=class extends ZAe{constructor(e,t,o,n,r,s){super(e,t,o,n,r,s);this._onChangeSearchInEditorsBoxEmitter=this._register(new E);this.onChangeSearchInEditorsBox=this._onChangeSearchInEditorsBoxEmitter.event}dispose(){super.dispose(),this.useSearchInEditorsBox.dispose()}onlySearchInOpenEditors(){return this.useSearchInEditorsBox.checked}setOnlySearchInOpenEditors(e){this.useSearchInEditorsBox.checked=e,this._onChangeSearchInEditorsBoxEmitter.fire()}getSubcontrolsWidth(){return super.getSubcontrolsWidth()+this.useSearchInEditorsBox.width()}renderSubcontrols(e){this.useSearchInEditorsBox=this._register(new Kh({icon:M.book,title:d(13157,null),isChecked:!1,...qg})),this._register(this.useSearchInEditorsBox.onChange(t=>{this._onChangeSearchInEditorsBoxEmitter.fire(),t||this.inputBox.focus()})),e.appendChild(this.useSearchInEditorsBox.domNode),super.renderSubcontrols(e)}};Tte=I([m(3,X),m(4,B),m(5,_e)],Tte);var _te=class extends ZAe{constructor(e,t,o,n,r,s){super(e,t,o,n,r,s);this._onChangeIgnoreBoxEmitter=this._register(new E);this.onChangeIgnoreBox=this._onChangeIgnoreBoxEmitter.event}dispose(){super.dispose(),this.useExcludesAndIgnoreFilesBox.dispose()}useExcludesAndIgnoreFiles(){return this.useExcludesAndIgnoreFilesBox.checked}setUseExcludesAndIgnoreFiles(e){this.useExcludesAndIgnoreFilesBox.checked=e,this._onChangeIgnoreBoxEmitter.fire()}getSubcontrolsWidth(){return super.getSubcontrolsWidth()+this.useExcludesAndIgnoreFilesBox.width()}renderSubcontrols(e){this.useExcludesAndIgnoreFilesBox=this._register(new Kh({icon:M.exclude,actionClassName:"useExcludesAndIgnoreFiles",title:d(13158,null),isChecked:!0,...qg})),this._register(this.useExcludesAndIgnoreFilesBox.onChange(t=>{this._onChangeIgnoreBoxEmitter.fire(),t||this.inputBox.focus()})),e.appendChild(this.useExcludesAndIgnoreFilesBox.domNode),super.renderSubcontrols(e)}};_te=I([m(3,X),m(4,B),m(5,_e)],_te);var she=Re("search-details",M.ellipsis,d(13358,null)),hho=Re("search-see-more",M.goToSearch,d(13367,null)),gho=Re("search-show-context",M.listSelection,d(13370,null)),LUt=Re("search-hide-replace",M.chevronRight,d(13360,null)),EEi=Re("search-show-replace",M.chevronDown,d(13371,null)),fho=Re("search-replace-all",M.replaceAll,d(13365,null)),RUt=Re("search-replace",M.replace,d(13366,null)),vho=Re("search-remove",M.close,d(13364,null)),MUt=Re("search-refresh",M.refresh,d(13363,null)),bho=Re("search-collapse-results",M.collapseAll,d(13357,null)),Sho=Re("search-expand-results",M.expandAll,d(13359,null)),Iho=Re("search-tree",M.listTree,d(13369,null)),yho=Re("search-list",M.listFlat,d(13368,null)),who=Re("search-clear-results",M.clearAll,d(13356,null)),Cho=Re("search-stop",M.searchStop,d(13374,null)),TEi=Re("search-view-icon",M.searchLarge,d(13375,null)),xho=Re("search-new-editor",M.newFile,d(13361,null)),kho=Re("search-open-in-file",M.goToFile,d(13362,null)),C2p=Re("search-sparkle-filled",M.sparkleFilled,d(13373,null)),x2p=Re("search-sparkle-empty",M.sparkle,d(13372,null));var PUt=(a,i,e,t,o,n,r)=>{let s=_("div.providerMessage"),l=lS(a.text);R(s,_("."+Px.className(a.type===1?gt.Info:gt.Warning).split(" ").join(".")));for(let c of l.nodes)if(typeof c=="string")R(s,document.createTextNode(c));else{let u=i.createInstance(Xg,s,c,{opener:async p=>{if(!a.trusted)return;let h=A.parse(p,!0);h.scheme===Y.command&&a.trusted?(await o.executeCommand(h.path))?.triggerSearch&&r():h.scheme===Y.https?t.open(h):h.scheme===Y.command&&!a.trusted?e.error(d(13377,null,p)):e.error(d(13376,null,p))}});n.add(u)}return s};function z3(a,i){do if(i.includes(a))return!0;while(!wA(a.parent())&&(a=a.parent()));return!1}var Eho="plainTextSearch",Tho="aiTextSearch";function _Ei(a){let i=[],e=a;for(;!jf(e);)i.push(e),e=e.parent();return i}var _ho="SEARCH_MODEL_",DEi="SEARCH_RESULT_",eNe="TEXT_SEARCH_HEADING_",Qtt="FOLDER_MATCH_",Ytt="FILE_MATCH_",Xtt="MATCH_";function AUt(a){let i={elements:[],added:!1,removed:!1};return a.forEach(e=>{e.added&&(i.added=!0),e.removed&&(i.removed=!0),i.elements=i.elements.concat(e.elements)}),i}function wA(a){return typeof a=="object"&&a!==null&&typeof a.id=="function"&&a.id().startsWith(DEi)}function jf(a){return typeof a=="object"&&a!==null&&typeof a.id=="function"&&a.id().startsWith(eNe)}function Dho(a){return jf(a)&&typeof a.replace=="function"&&typeof a.replaceAll=="function"}function bd(a){return typeof a=="object"&&a!==null&&typeof a.id=="function"&&a.id().startsWith(Qtt)}function K3(a){return bd(a)&&a.resource instanceof A}function _2(a){return K3(a)&&typeof a.createAndConfigureFileMatch=="function"}function p0(a){return bd(a)&&typeof a.createAndConfigureFileMatch=="function"}function fl(a){return typeof a=="object"&&a!==null&&typeof a.id=="function"&&a.id().startsWith(Ytt)}function Ka(a){return typeof a=="object"&&a!==null&&typeof a.id=="function"&&a.id().startsWith(Xtt)}function Lho(a){return typeof a=="object"&&a!==null&&typeof a.id=="function"&&a.id().startsWith(eNe)}function Jtt(a){let i=[],e=[];return a.forEach(t=>{fl(t)?e.push(t):i.push(t)}),e.concat(i.map(t=>t.allDownstreamFileMatches()).flat())}function Ztt(a){return a&&a.getFullRange&&a.getFullRange()instanceof z}var eit=class a{static{this.ITEM_HEIGHT=22}getHeight(i){return a.ITEM_HEIGHT}getTemplateId(i){if(bd(i))return $3.TEMPLATE_ID;if(fl(i))return q3.TEMPLATE_ID;if(Ka(i))return j3.TEMPLATE_ID;if(jf(i))return G3.TEMPLATE_ID;throw console.error("Invalid search tree element",i),new Error("Invalid search tree element")}},G3=class extends C{constructor(e,t,o,n){super();this.labels=e;this.contextService=t;this.instantiationService=o;this.contextKeyService=n;this.templateId=G3.TEMPLATE_ID}static{this.TEMPLATE_ID="textResultMatch"}renderTemplate(e){let t=new P,o=R(e,_(".textsearchresult")),n=this.labels.create(o,{supportDescriptionHighlights:!0,supportHighlights:!0,supportIcons:!0});t.add(n);let r=R(o,_(".actionBarContainer")),s=t.add(this.contextKeyService.createScoped(e)),l=t.add(this.instantiationService.createChild(new Io([X,s]))),c=t.add(l.createInstance(Ln,r,D.SearchActionMenu,{menuOptions:{shouldForwardArgs:!0},highlightToggledItems:!0,hiddenItemStrategy:0,toolbarOptions:{primaryGroup:u=>/^inline/.test(u)}}));return{label:n,disposables:t,actions:c,contextKeyService:s}}async renderElement(e,t,o){if(Dho(e.element))o.label.setLabel(d(13389,null)),Ci.AIResultsTitle.bindTo(o.contextKeyService).set(!1),Ci.MatchFocusKey.bindTo(o.contextKeyService).set(!1),Ci.FileFocusKey.bindTo(o.contextKeyService).set(!1),Ci.FolderFocusKey.bindTo(o.contextKeyService).set(!1);else{try{await e.element.parent().searchModel.getAITextResultProviderName()}catch{}let n=d(13387,null);o.label.setLabel(`$(${M.searchSparkle.id}) ${n}`),Ci.AIResultsTitle.bindTo(o.contextKeyService).set(!0),Ci.MatchFocusKey.bindTo(o.contextKeyService).set(!1),Ci.FileFocusKey.bindTo(o.contextKeyService).set(!1),Ci.FolderFocusKey.bindTo(o.contextKeyService).set(!1)}}disposeTemplate(e){e.disposables.dispose()}renderCompressedElements(e,t,o){}};G3=I([m(1,Pe),m(2,F),m(3,X)],G3);var $3=class extends C{constructor(e,t,o,n,r,s){super();this.searchView=e;this.labels=t;this.contextService=o;this.labelService=n;this.instantiationService=r;this.contextKeyService=s;this.templateId=$3.TEMPLATE_ID}static{this.TEMPLATE_ID="folderMatch"}renderCompressedElements(e,t,o){let n=e.element,r=n.elements[n.elements.length-1],s=n.elements.map(l=>l.name());if(r.resource){let l=_2(r)?2:1;o.label.setResource({resource:r.resource,name:s},{fileKind:l,separator:this.labelService.getSeparator(r.resource.scheme)})}else o.label.setLabel(d(13388,null));this.renderFolderDetails(r,o)}renderTemplate(e){let t=new P,o=R(e,_(".foldermatch")),n=this.labels.create(o,{supportDescriptionHighlights:!0,supportHighlights:!0});t.add(n);let r=new fv(R(o,_(".badge")),{},BS);t.add(r);let s=R(o,_(".actionBarContainer")),l=new P;t.add(l);let c=t.add(this.contextKeyService.createScoped(e));Ci.AIResultsTitle.bindTo(c).set(!1),Ci.MatchFocusKey.bindTo(c).set(!1),Ci.FileFocusKey.bindTo(c).set(!1),Ci.FolderFocusKey.bindTo(c).set(!0);let u=t.add(this.instantiationService.createChild(new Io([X,c]))),p=t.add(u.createInstance(Ln,s,D.SearchActionMenu,{menuOptions:{shouldForwardArgs:!0},hiddenItemStrategy:0,toolbarOptions:{primaryGroup:h=>/^inline/.test(h)}}));return{label:n,badge:r,actions:p,disposables:t,elementDisposables:l,contextKeyService:c}}renderElement(e,t,o){let n=e.element;if(n.resource){let r=this.contextService.getWorkspaceFolder(n.resource);r&&Xe(r.uri,n.resource)?o.label.setFile(n.resource,{fileKind:2,hidePath:!0}):o.label.setFile(n.resource,{fileKind:1,hidePath:this.searchView.isTreeLayoutViewVisible})}else o.label.setLabel(d(13388,null));Ci.IsEditableItemKey.bindTo(o.contextKeyService).set(!n.hasOnlyReadOnlyMatches()),o.elementDisposables.add(n.onChange(()=>{Ci.IsEditableItemKey.bindTo(o.contextKeyService).set(!n.hasOnlyReadOnlyMatches())})),this.renderFolderDetails(n,o)}disposeElement(e,t,o){o.elementDisposables.clear()}disposeCompressedElements(e,t,o){o.elementDisposables.clear()}disposeTemplate(e){e.disposables.dispose()}renderFolderDetails(e,t){let o=e.recursiveMatchCount();t.badge.setCount(o),t.badge.setTitleFormat(o>1?d(13386,null,o):d(13385,null,o)),t.actions.context={viewer:this.searchView.getControl(),element:e}}};$3=I([m(2,Pe),m(3,ot),m(4,F),m(5,X)],$3);var q3=class extends C{constructor(e,t,o,n,r,s){super();this.searchView=e;this.labels=t;this.contextService=o;this.configurationService=n;this.instantiationService=r;this.contextKeyService=s;this.templateId=q3.TEMPLATE_ID}static{this.TEMPLATE_ID="fileMatch"}renderCompressedElements(e,t,o){throw new Error("Should never happen since node is incompressible.")}renderTemplate(e){let t=new P,o=new P;t.add(o);let n=R(e,_(".filematch")),r=this.labels.create(n);t.add(r);let s=new fv(R(n,_(".badge")),{},BS);t.add(s);let l=R(n,_(".actionBarContainer")),c=t.add(this.contextKeyService.createScoped(e));Ci.AIResultsTitle.bindTo(c).set(!1),Ci.MatchFocusKey.bindTo(c).set(!1),Ci.FileFocusKey.bindTo(c).set(!0),Ci.FolderFocusKey.bindTo(c).set(!1);let u=t.add(this.instantiationService.createChild(new Io([X,c]))),p=t.add(u.createInstance(Ln,l,D.SearchActionMenu,{menuOptions:{shouldForwardArgs:!0},hiddenItemStrategy:0,toolbarOptions:{primaryGroup:h=>/^inline/.test(h)}}));return{el:n,label:r,badge:s,actions:p,disposables:t,elementDisposables:o,contextKeyService:c}}renderElement(e,t,o){let n=e.element;o.el.setAttribute("data-resource",n.resource.toString());let r=this.configurationService.getValue("search").decorations;o.label.setFile(n.resource,{range:Ztt(n)?n.getFullRange():void 0,hidePath:this.searchView.isTreeLayoutViewVisible&&!p0(n.parent()),hideIcon:!1,fileDecorations:{colors:r.colors,badges:r.badges}});let s=n.count();o.badge.setCount(s),o.badge.setTitleFormat(s>1?d(13391,null,s):d(13390,null,s)),o.actions.context={viewer:this.searchView.getControl(),element:n},Ci.IsEditableItemKey.bindTo(o.contextKeyService).set(!n.hasOnlyReadOnlyMatches()),o.elementDisposables.add(n.onChange(()=>{Ci.IsEditableItemKey.bindTo(o.contextKeyService).set(!n.hasOnlyReadOnlyMatches())})),o.el.parentElement?.parentElement?.querySelector(".monaco-tl-twistie")?.classList.add("force-twistie")}disposeElement(e,t,o){o.elementDisposables.clear()}disposeTemplate(e){e.disposables.dispose()}};q3=I([m(2,Pe),m(3,B),m(4,F),m(5,X)],q3);var j3=class extends C{constructor(e,t,o,n,r,s){super();this.searchView=e;this.contextService=t;this.configurationService=o;this.instantiationService=n;this.contextKeyService=r;this.hoverService=s;this.templateId=j3.TEMPLATE_ID}static{this.TEMPLATE_ID="match"}renderCompressedElements(e,t,o){throw new Error("Should never happen since node is incompressible.")}renderTemplate(e){e.classList.add("linematch");let t=R(e,_("span.matchLineNum")),o=R(e,_("a.plain.match")),n=R(o,_("span")),r=R(o,_("span.findInFileMatch")),s=R(o,_("span.replaceMatch")),l=R(o,_("span")),c=R(e,_("span.actionBarContainer")),u=new P,p=u.add(this.contextKeyService.createScoped(e));Ci.AIResultsTitle.bindTo(p).set(!1),Ci.MatchFocusKey.bindTo(p).set(!0),Ci.FileFocusKey.bindTo(p).set(!1),Ci.FolderFocusKey.bindTo(p).set(!1);let h=u.add(this.instantiationService.createChild(new Io([X,p]))),g=u.add(h.createInstance(Ln,c,D.SearchActionMenu,{menuOptions:{shouldForwardArgs:!0},hiddenItemStrategy:0,toolbarOptions:{primaryGroup:f=>/^inline/.test(f)}}));return{parent:o,before:n,match:r,replace:s,after:l,lineNumber:t,actions:g,disposables:u,contextKeyService:p}}renderElement(e,t,o){let n=e.element,r=n.preview(),s=this.searchView.model.isReplaceActive()&&!!this.searchView.model.replaceString&&!n.isReadonly;o.before.textContent=r.before,o.match.textContent=r.inside,o.match.classList.toggle("replace",s),o.replace.textContent=s?n.replaceString:"",o.after.textContent=r.after;let l=(r.fullBefore+(s?n.replaceString:r.inside)+r.after).trim().substr(0,999);o.disposables.add(this.hoverService.setupManagedHover(Ni("mouse"),o.parent,l)),Ci.IsEditableItemKey.bindTo(o.contextKeyService).set(!n.isReadonly);let c=n.range().endLineNumber-n.range().startLineNumber,u=c>0?`+${c}`:"",p=this.configurationService.getValue("search").showLineNumbers,h=p?`${n.range().startLineNumber}:`:"";o.lineNumber.classList.toggle("show",c>0||p),o.lineNumber.textContent=h+u,o.disposables.add(this.hoverService.setupManagedHover(Ni("mouse"),o.lineNumber,this.getMatchTitle(n,p))),o.actions.context={viewer:this.searchView.getControl(),element:n}}disposeTemplate(e){e.disposables.dispose()}getMatchTitle(e,t){let o=e.range().startLineNumber,n=e.range().endLineNumber-e.range().startLineNumber,r=t?d(13380,null,o,n)+" ":"",s=n>0?"+ "+d(13381,null,n):"";return r+s}};j3=I([m(1,Pe),m(2,B),m(3,F),m(4,X),m(5,tt)],j3);var tNe=class{constructor(i,e){this.searchView=i;this.labelService=e}getWidgetAriaLabel(){return d(13384,null)}getAriaLabel(i){if(bd(i)){let e=i.allDownstreamFileMatches().reduce((t,o)=>t+o.count(),0);return i.resource?d(13379,null,e,i.name()):d(13382,null,e)}if(fl(i)){let e=this.labelService.getUriLabel(i.resource,{relative:!0})||i.resource.fsPath;return d(13378,null,i.count(),i.name(),wc(e))}if(Ka(i)){let e=i,t=this.searchView.model,o=t.isReplaceActive()&&!!t.replaceString,n=e.getMatchString(),r=e.range(),s=e.text().substr(0,r.endColumn+150);return o?d(13383,null,s,r.startColumn,n,e.replaceString):d(13392,null,s,r.startColumn,n)}return null}};tNe=I([m(1,ot)],tNe);function Dte(a){return a&&typeof a.bindNotebookEditorWidget=="function"&&typeof a.updateMatchesForEditorWidget=="function"&&typeof a.unbindNotebookEditorWidget=="function"&&typeof a.updateNotebookHighlights=="function"&&fl(a)}function VB(a){return typeof a=="object"&&a!==null&&typeof a.parent=="function"&&typeof a.cellParent=="object"&&typeof a.isWebviewMatch=="function"&&typeof a.cellIndex=="number"&&(typeof a.webviewIndex=="number"||a.webviewIndex===void 0)&&(typeof a.cell=="object"||a.cell===void 0)}var LEi=-1,REi=-1;function CA(a,i,e="default"){if(fl(a)&&bd(i))return 1;if(fl(i)&&bd(a))return-1;if(bd(a)&&bd(i)){if(LEi=a.index(),REi=i.index(),LEi!==-1&&REi!==-1)return LEi-REi;if(Ztt(a)&&Ztt(i))return a.rank-i.rank;switch(e){case"countDescending":return i.count()-a.count();case"countAscending":return a.count()-i.count();case"type":return kfi(a.name(),i.name());case"fileNames":return jE(a.name(),i.name());default:return!a.resource||!i.resource?0:lJ(a.resource.fsPath,i.resource.fsPath)||jE(a.name(),i.name())}}if(fl(a)&&fl(i))switch(e){case"countDescending":return i.count()-a.count();case"countAscending":return a.count()-i.count();case"type":return kfi(a.name(),i.name());case"fileNames":return jE(a.name(),i.name());case"modified":{let t=a.fileStat,o=i.fileStat;if(t&&o)return o.mtime-t.mtime}default:return lJ(a.resource.fsPath,i.resource.fsPath)||jE(a.name(),i.name())}return VB(a)&&VB(i)?IYo(a,i):Ka(a)&&Ka(i)?z.compareRangesUsingStarts(a.range(),i.range()):0}function IYo(a,i){return a.cellIndex===i.cellIndex?a.webviewIndex!==void 0&&i.webviewIndex!==void 0?a.webviewIndex-i.webviewIndex:a.webviewIndex===void 0&&i.webviewIndex===void 0?z.compareRangesUsingStarts(a.range(),i.range()):a.webviewIndex!==void 0?1:-1:a.cellIndex<i.cellIndex?-1:1}function NUt(a,i,e="default"){let t=_Ei(a),o=_Ei(i),n=t.length-1,r=o.length-1;for(;n>=0&&r>=0;){if(t[n].id()!==o[r].id())return CA(t[n],o[r],e);n--,r--}let s=n===0,l=r===0;return s&&!l?1:!s&&l?-1:0}var vl=L(13300,"Search");function Rho(a){let i=Pc(a);return!!(i&&ts(i.getContainer()))}function Pc(a){return a.getActiveViewWithId(ny)}function tit(a,i,e){let t=a.getSelection().filter(o=>o!==null).sort((o,n)=>NUt(o,n,e.sortOrder));return i&&!(t.length>1&&t.includes(i))&&(t=[i]),t}function Mho(a,i){return i?!i||a.includes(i)||yYo(a,i):!1}function yYo(a,i){for(let e of a)if(fl(e)&&Ka(i)&&e.matches().includes(i)||bd(e)&&(fl(i)&&e.getDownstreamFileMatch(i.resource)||Ka(i)&&e.getDownstreamFileMatch(i.parent().resource)))return!0;return!1}function Q3(a,i){return a.openView(ny,i).then(e=>e??void 0)}var _b=new Q("inSearchEditor",!1),iNe="search-editor",OUt="search/editor",PEi="searchEditorFindMatch",iit="workbench.editor.searchEditor",Pho="search.action.openNewEditor",ahe="search.action.openEditor",FUt="toggleSearchEditorContextLines",oit="workbench.editorinputs.searchEditorInput";var oNe=class extends C{constructor(e,t,o,n,r){super();this._onDidChange=this._register(new E);this.onDidChange=this._onDidChange.event;this._markupInput=!0;this._markupPreview=!0;this._codeInput=!0;this._codeOutput=!0;this._findScope={findScopeType:"none"};this._markupInput=e,this._markupPreview=t,this._codeInput=o,this._codeOutput=n,this._findScope=r,this._initialMarkupInput=e,this._initialMarkupPreview=t,this._initialCodeInput=o,this._initialCodeOutput=n}get markupInput(){return this._markupInput}set markupInput(e){this._markupInput!==e&&(this._markupInput=e,this._onDidChange.fire({markupInput:e}))}get markupPreview(){return this._markupPreview}set markupPreview(e){this._markupPreview!==e&&(this._markupPreview=e,this._onDidChange.fire({markupPreview:e}))}get codeInput(){return this._codeInput}set codeInput(e){this._codeInput!==e&&(this._codeInput=e,this._onDidChange.fire({codeInput:e}))}get codeOutput(){return this._codeOutput}set codeOutput(e){this._codeOutput!==e&&(this._codeOutput=e,this._onDidChange.fire({codeOutput:e}))}get findScope(){return this._findScope}set findScope(e){this._findScope!==e&&(this._findScope=e,this._onDidChange.fire({findScope:!0}))}isModified(){return this._markupInput!==this._initialMarkupInput||this._markupPreview!==this._initialMarkupPreview||this._codeInput!==this._initialCodeInput||this._codeOutput!==this._initialCodeOutput}update(e){this._markupInput=e.markupInput,this._markupPreview=e.markupPreview,this._codeInput=e.codeInput,this._codeOutput=e.codeOutput,this._findScope=e.findScope}};var wYo=d(11675,null),CYo=d(11688,null),xYo=d(11677,null),kYo=d(11676,null),EYo=d(11682,null),TYo=d(11674,null),_Yo=d(11681,null),DYo=d(11678,null),LYo=d(11689,null),RYo=d(11680,null),MYo=d(11679,null),_$p=Re("find-filter",M.filter,d(11673,null)),PYo=d(11683,null),AYo=d(11686,null),NYo=d(11687,null),OYo=d(11684,null),FYo=d(11685,null),nNe=419,Aho=4,nit=class extends wp{constructor(e,t,o,n,r){super(t,{getActions:()=>this.getActions()},r,{...o,actionRunner:n,classNames:t.class,anchorAlignmentProvider:()=>1});this.filters=e}render(e){super.render(e),this.updateChecked()}getActions(){let e={checked:this.filters.markupInput,class:void 0,enabled:!0,id:"findInMarkdownInput",label:AYo,run:async()=>{this.filters.markupInput=!this.filters.markupInput},tooltip:""},t={checked:this.filters.markupPreview,class:void 0,enabled:!0,id:"findInMarkdownInput",label:NYo,run:async()=>{this.filters.markupPreview=!this.filters.markupPreview},tooltip:""},o={checked:this.filters.codeInput,class:void 0,enabled:!0,id:"findInCodeInput",label:OYo,run:async()=>{this.filters.codeInput=!this.filters.codeInput},tooltip:""},n={checked:this.filters.codeOutput,class:void 0,enabled:!0,id:"findInCodeOutput",label:FYo,run:async()=>{this.filters.codeOutput=!this.filters.codeOutput},tooltip:"",dispose:()=>null};return cbe?[e,o]:[e,t,new li,o,n]}updateChecked(){this.element.classList.toggle("checked",this._action.checked)}};nit=I([m(4,ze)],nit);var rit=class extends C{constructor(e,t,o,n,r=PYo){super();this.filters=e;this.contextMenuService=t;this.instantiationService=o;this._actionbar=null;this._toggleStyles=n.toggleStyles,this._filtersAction=this._register(new st("notebookFindFilterAction",r,"notebook-filters "+q.asClassName(MWt))),this._filtersAction.checked=!1,this._filterButtonContainer=_(".find-filter-button"),this._filterButtonContainer.classList.add("monaco-custom-toggle"),this.createFilters(this._filterButtonContainer)}get container(){return this._filterButtonContainer}width(){return 22}enable(){this.container.setAttribute("aria-disabled",String(!1))}disable(){this.container.setAttribute("aria-disabled",String(!0))}set visible(e){this._filterButtonContainer.style.display=e?"":"none"}get visible(){return this._filterButtonContainer.style.display!=="none"}applyStyles(e){let t=this._toggleStyles;this._filterButtonContainer.style.border="1px solid transparent",this._filterButtonContainer.style.borderRadius="3px",this._filterButtonContainer.style.borderColor=e&&t.inputActiveOptionBorder||"",this._filterButtonContainer.style.color=e&&t.inputActiveOptionForeground||"inherit",this._filterButtonContainer.style.backgroundColor=e&&t.inputActiveOptionBackground||""}createFilters(e){this._actionbar=this._register(new ji(e,{actionViewItemProvider:(t,o)=>{if(t.id===this._filtersAction.id)return this.instantiationService.createInstance(nit,this.filters,t,o,this._register(new as))}})),this._actionbar.push(this._filtersAction,{icon:!0,label:!1})}},NEi=class extends _1{constructor(e,t,o,n,r,s,l){super(r,s,l);this.filters=e;this.contextMenuService=o;this.instantiationService=n;this._filterChecked=!1;this._register(qM(t,this.inputBox)),this._findFilter=this._register(new rit(e,o,n,l)),this.inputBox.paddingRight=(this.caseSensitive?.width()??0)+(this.wholeWords?.width()??0)+(this.regex?.width()??0)+this._findFilter.width(),this.controls.appendChild(this._findFilter.container)}setEnabled(e){super.setEnabled(e),e&&!this._filterChecked?this.regex?.enable():this.regex?.disable()}updateFilterState(e){this._filterChecked=e,this.regex&&(this._filterChecked?(this.regex.disable(),this.regex.domNode.tabIndex=-1,this.regex.domNode.classList.toggle("disabled",!0)):(this.regex.enable(),this.regex.domNode.tabIndex=0,this.regex.domNode.classList.toggle("disabled",!1))),this._findFilter.applyStyles(this._filterChecked)}getCellToolbarActions(e){return hl(e.getActions({shouldForwardArgs:!0}),t=>/^inline/.test(t))}},rNe=class extends Ma{constructor(e,t,o,n,r,s,l=new G1,c,u,p){super();this._contextViewService=e;this._configurationService=o;this.contextMenuService=n;this.instantiationService=r;this._state=l;this._notebookEditor=c;this._findWidgetSearchHistory=u;this._replaceWidgetHistory=p;this._resizeOriginalWidth=nNe;this._isVisible=!1;this._isReplaceVisible=!1;this.foundMatch=!1;this.cellSelectionDecorationIds=[];this.textSelectionDecorationIds=[];this._register(this._state);let h=this._configurationService.getValue(ft.findFilters)??{markupSource:!0,markupPreview:!0,codeSource:!0,codeOutput:!0},g=this._configurationService.getValue("editor.find.history"),f=this._configurationService.getValue("editor.find.replaceHistory");this._filters=this._register(new oNe(h.markupSource,h.markupPreview,h.codeSource,h.codeOutput,{findScopeType:"none"})),this._state.change({filters:this._filters},!1),this._register(this._filters.onDidChange(()=>{this._state.change({filters:this._filters},!1)})),this._domNode=document.createElement("div"),this._domNode.classList.add("simple-fr-find-part-wrapper"),this._register(H.runAndSubscribe(this._configurationService.onDidChangeConfiguration,w=>{(!w||w.affectsConfiguration(ft.globalToolbar))&&(this._notebookEditor.notebookOptions.getLayoutConfiguration().globalToolbar?this._domNode.style.top="26px":this._domNode.style.top="0px")})),this._register(this._state.onFindReplaceStateChange(w=>this._onStateChanged(w))),this._scopedContextKeyService=this._register(t.createScoped(this._domNode));let v=_(".find-replace-progress");this._progressBar=this._register(new fb(v,kx)),this._domNode.appendChild(v);let b=t.getContextKeyValue("notebookType")==="interactive",S={groupId:"simple-find-widget"};this._toggleReplaceBtn=this._register(new KS({label:_Yo,className:"codicon toggle left",hoverLifecycleOptions:S,onTrigger:b?()=>{}:()=>{this._isReplaceVisible=!this._isReplaceVisible,this._state.change({isReplaceRevealed:this._isReplaceVisible},!1),this._updateReplaceViewDisplay()}},s)),this._toggleReplaceBtn.setEnabled(!b),this._toggleReplaceBtn.setExpanded(this._isReplaceVisible),this._domNode.appendChild(this._toggleReplaceBtn.domNode),this._innerFindDomNode=document.createElement("div"),this._innerFindDomNode.classList.add("simple-fr-find-part"),this._findInput=this._register(new NEi(this._filters,this._scopedContextKeyService,this.contextMenuService,this.instantiationService,null,this._contextViewService,{label:wYo,placeholder:CYo,validation:w=>{if(w.length===0||!this._findInput.getRegex())return null;try{return new RegExp(w),null}catch(k){return this.foundMatch=!1,this.updateButtons(this.foundMatch),{content:k.message}}},flexibleWidth:!0,showCommonFindToggles:!0,inputBoxStyles:pl,toggleStyles:qg,history:g==="workspace"?this._findWidgetSearchHistory:new Set([])})),this._updateFindHistoryDelayer=new jo(500),this.oninput(this._findInput.domNode,w=>{this.foundMatch=this.onInputChanged(),this.updateButtons(this.foundMatch),this._delayedUpdateFindHistory()}),this._register(this._findInput.inputBox.onDidChange(()=>{this._state.change({searchString:this._findInput.getValue()},!0)})),this._findInput.setRegex(!!this._state.isRegex),this._findInput.setCaseSensitive(!!this._state.matchCase),this._findInput.setWholeWords(!!this._state.wholeWord),this._register(this._findInput.onDidOptionChange(()=>{this._state.change({isRegex:this._findInput.getRegex(),wholeWord:this._findInput.getWholeWords(),matchCase:this._findInput.getCaseSensitive()},!0)})),this._register(this._state.onFindReplaceStateChange(()=>{this._findInput.setRegex(this._state.isRegex),this._findInput.setWholeWords(this._state.wholeWord),this._findInput.setCaseSensitive(this._state.matchCase),this._replaceInput.setPreserveCase(this._state.preserveCase)})),this._matchesCount=document.createElement("div"),this._matchesCount.className="matchesCount",this._updateMatchesCount(),this.prevBtn=this._register(new KS({label:xYo,icon:k5e,hoverLifecycleOptions:S,onTrigger:()=>{this.find(!0)}},s)),this.nextBtn=this._register(new KS({label:kYo,icon:E5e,hoverLifecycleOptions:S,onTrigger:()=>{this.find(!1)}},s)),this.inSelectionToggle=this._register(new Kh({icon:Soi,title:EYo,isChecked:!1,hoverLifecycleOptions:S,inputActiveOptionBackground:wt(dW),inputActiveOptionBorder:wt(cW),inputActiveOptionForeground:wt(V$)})),this.inSelectionToggle.domNode.style.display="inline",this._register(this.inSelectionToggle.onChange(()=>{if(this.inSelectionToggle.checked){let k=this._notebookEditor.getSelections(),T=this._notebookEditor.getSelectionViewModels()[0].getSelections();k.length>1||k.some(N=>N.end-N.start>1)?(this._filters.findScope={findScopeType:"cells",selectedCellRanges:k},this.setCellSelectionDecorations()):T.length>1||T.some(N=>N.endLineNumber-N.startLineNumber>=1)?(this._filters.findScope={findScopeType:"text",selectedCellRanges:k,selectedTextRanges:T},this.setTextSelectionDecorations(T,this._notebookEditor.getSelectionViewModels()[0])):(this._filters.findScope={findScopeType:"cells",selectedCellRanges:k},this.setCellSelectionDecorations())}else this._filters.findScope={findScopeType:"none"},this.clearCellSelectionDecorations(),this.clearTextSelectionDecorations()}));let y=this._register(new KS({label:TYo,icon:lE,hoverLifecycleOptions:S,onTrigger:()=>{this.hide()}},s));this._innerFindDomNode.appendChild(this._findInput.domNode),this._innerFindDomNode.appendChild(this._matchesCount),this._innerFindDomNode.appendChild(this.prevBtn.domNode),this._innerFindDomNode.appendChild(this.nextBtn.domNode),this._innerFindDomNode.appendChild(this.inSelectionToggle.domNode),this._innerFindDomNode.appendChild(y.domNode),this._domNode.appendChild(this._innerFindDomNode),this.onkeyup(this._innerFindDomNode,w=>{if(w.equals(9)){this.hide(),w.preventDefault();return}}),this._focusTracker=this._register(Vn(this._domNode)),this._register(this._focusTracker.onDidFocus(this.onFocusTrackerFocus.bind(this))),this._register(this._focusTracker.onDidBlur(this.onFocusTrackerBlur.bind(this))),this._findInputFocusTracker=this._register(Vn(this._findInput.domNode)),this._register(this._findInputFocusTracker.onDidFocus(this.onFindInputFocusTrackerFocus.bind(this))),this._register(this._findInputFocusTracker.onDidBlur(this.onFindInputFocusTrackerBlur.bind(this))),this._register(j(this._innerFindDomNode,"click",w=>{w.stopPropagation()})),this._innerReplaceDomNode=document.createElement("div"),this._innerReplaceDomNode.classList.add("simple-fr-replace-part"),this._replaceInput=this._register(new R1(null,void 0,{label:DYo,placeholder:LYo,history:f==="workspace"?this._replaceWidgetHistory:new Set([]),inputBoxStyles:pl,toggleStyles:qg,hoverLifecycleOptions:S},t,!1)),this._innerReplaceDomNode.appendChild(this._replaceInput.domNode),this._replaceInputFocusTracker=this._register(Vn(this._replaceInput.domNode)),this._register(this._replaceInputFocusTracker.onDidFocus(this.onReplaceInputFocusTrackerFocus.bind(this))),this._register(this._replaceInputFocusTracker.onDidBlur(this.onReplaceInputFocusTrackerBlur.bind(this))),this._updateReplaceHistoryDelayer=new jo(500),this.oninput(this._replaceInput.domNode,w=>{this._delayedUpdateReplaceHistory()}),this._register(this._replaceInput.inputBox.onDidChange(()=>{this._state.change({replaceString:this._replaceInput.getValue()},!0)})),this._domNode.appendChild(this._innerReplaceDomNode),this._updateReplaceViewDisplay(),this._replaceBtn=this._register(new KS({label:RYo,icon:Ioi,hoverLifecycleOptions:S,onTrigger:()=>{this.replaceOne()}},s)),this._replaceAllBtn=this._register(new KS({label:MYo,icon:yoi,hoverLifecycleOptions:S,onTrigger:()=>{this.replaceAll()}},s)),this._innerReplaceDomNode.appendChild(this._replaceBtn.domNode),this._innerReplaceDomNode.appendChild(this._replaceAllBtn.domNode),this._resizeSash=this._register(new pv(this._domNode,{getVerticalSashLeft:()=>0},{orientation:0,size:2})),this._register(this._resizeSash.onDidStart(()=>{this._resizeOriginalWidth=this._getDomWidth()})),this._register(this._resizeSash.onDidChange(w=>{let k=this._resizeOriginalWidth+w.startX-w.currentX;k<nNe&&(k=nNe);let T=this._getMaxWidth();k>T&&(k=T),this._domNode.style.width=`${k}px`,this._isReplaceVisible&&(this._replaceInput.width=yl(this._findInput.domNode)),this._findInput.inputBox.layout()})),this._register(this._resizeSash.onDidReset(()=>{let w=this._getDomWidth(),k=nNe;w<=nNe&&(k=this._getMaxWidth()),this._domNode.style.width=`${k}px`,this._isReplaceVisible&&(this._replaceInput.width=yl(this._findInput.domNode)),this._findInput.inputBox.layout()}))}_getMaxWidth(){return this._notebookEditor.getLayoutInfo().width-64}_getDomWidth(){return yl(this._domNode)-Aho*2}getCellToolbarActions(e){return hl(e.getActions({shouldForwardArgs:!0}),t=>/^inline/.test(t))}get inputValue(){return this._findInput.getValue()}get replaceValue(){return this._replaceInput.getValue()}get replacePattern(){return this._state.isRegex?VIt(this.replaceValue):S7.fromStaticValue(this.replaceValue)}get focusTracker(){return this._focusTracker}get isVisible(){return this._isVisible}_onStateChanged(e){this._updateButtons(),this._updateMatchesCount()}_updateButtons(){this._findInput.setEnabled(this._isVisible),this._replaceInput.setEnabled(this._isVisible&&this._isReplaceVisible);let e=this._state.searchString.length>0;this._replaceBtn.setEnabled(this._isVisible&&this._isReplaceVisible&&e),this._replaceAllBtn.setEnabled(this._isVisible&&this._isReplaceVisible&&e),this._domNode.classList.toggle("replaceToggled",this._isReplaceVisible),this._toggleReplaceBtn.setExpanded(this._isReplaceVisible),this.foundMatch=this._state.matchesCount>0,this.updateButtons(this.foundMatch)}setCellSelectionDecorations(){let e=[];this._notebookEditor.getSelectionViewModels().forEach(o=>{e.push(o.handle)});let t=[];for(let o of e)t.push({handle:o,options:{className:"nb-multiCellHighlight",outputClassName:"nb-multiCellHighlight"}});this.cellSelectionDecorationIds=this._notebookEditor.deltaCellDecorations([],t)}clearCellSelectionDecorations(){this._notebookEditor.deltaCellDecorations(this.cellSelectionDecorationIds,[])}setTextSelectionDecorations(e,t){this._notebookEditor.changeModelDecorations(o=>{let n=[];for(let r of e)n.push({ownerId:t.handle,decorations:[{range:r,options:{description:"text search range for notebook search scope",isWholeLine:!0,className:"nb-findScope"}}]});this.textSelectionDecorationIds=o.deltaDecorations([],n)})}clearTextSelectionDecorations(){this._notebookEditor.changeModelDecorations(e=>{e.deltaDecorations(this.textSelectionDecorationIds,[])})}_updateMatchesCount(){}dispose(){super.dispose(),this._domNode.remove()}getDomNode(){return this._domNode}reveal(e){if(e&&this._findInput.setValue(e),this._isVisible){this._findInput.select();return}this._isVisible=!0,this.updateButtons(this.foundMatch),setTimeout(()=>{this._domNode.classList.add("visible","visible-transition"),this._domNode.setAttribute("aria-hidden","false"),this._findInput.select()},0)}focus(){this._findInput.focus()}show(e,t){e&&this._findInput.setValue(e),this._isVisible=!0,setTimeout(()=>{this._domNode.classList.add("visible","visible-transition"),this._domNode.setAttribute("aria-hidden","false"),(t?.focus??!0)&&this.focus()},0)}showWithReplace(e,t){e&&this._findInput.setValue(e),t&&this._replaceInput.setValue(t),this._isVisible=!0,this._isReplaceVisible=!0,this._state.change({isReplaceRevealed:this._isReplaceVisible},!1),this._updateReplaceViewDisplay(),setTimeout(()=>{this._domNode.classList.add("visible","visible-transition"),this._domNode.setAttribute("aria-hidden","false"),this._updateButtons(),this._replaceInput.focus()},0)}_updateReplaceViewDisplay(){this._isReplaceVisible?this._innerReplaceDomNode.style.display="flex":this._innerReplaceDomNode.style.display="none",this._replaceInput.width=yl(this._findInput.domNode)}hide(){this._isVisible&&(this.inSelectionToggle.checked=!1,this._notebookEditor.deltaCellDecorations(this.cellSelectionDecorationIds,[]),this._notebookEditor.changeModelDecorations(e=>{e.deltaDecorations(this.textSelectionDecorationIds,[])}),this._domNode.classList.remove("visible-transition"),this._domNode.setAttribute("aria-hidden","true"),setTimeout(()=>{this._isVisible=!1,this.updateButtons(this.foundMatch),this._domNode.classList.remove("visible")},200))}_delayedUpdateFindHistory(){this._updateFindHistoryDelayer.trigger(this._updateFindHistory.bind(this))}_updateFindHistory(){this._findInput.inputBox.addToHistory()}_delayedUpdateReplaceHistory(){this._updateReplaceHistoryDelayer.trigger(this._updateReplaceHistory.bind(this))}_updateReplaceHistory(){this._replaceInput.inputBox.addToHistory()}_getRegexValue(){return this._findInput.getRegex()}_getWholeWordValue(){return this._findInput.getWholeWords()}_getCaseSensitiveValue(){return this._findInput.getCaseSensitive()}updateButtons(e){let t=this.inputValue.length>0;this.prevBtn.setEnabled(this._isVisible&&t&&e),this.nextBtn.setEnabled(this._isVisible&&t&&e)}};rNe=I([m(0,_n),m(1,X),m(2,B),m(3,ze),m(4,F),m(5,tt)],rNe);is((a,i)=>{i.addRule(`
.notebook-editor {
--notebook-find-width: ${nNe}px;
--notebook-find-horizontal-padding: ${Aho}px;
}
`)});var WUt=class extends L1{constructor(e,t,o,n,r,s,l,c){super(e,t,o,n);this.contextMenuService=r;this.instantiationService=s;this.filters=l;this._filterChecked=!1;this._onDidChangeAIToggle=this._register(new E);this.onDidChangeAIToggle=this._onDidChangeAIToggle.event;this._findFilter=this._register(new rit(l,r,s,o,d(13355,null))),this._updatePadding(),this.controls.appendChild(this._findFilter.container),this._findFilter.container.classList.add("monaco-custom-toggle"),this.filterVisible=c}_updatePadding(){this.inputBox.paddingRight=(this.caseSensitive?.visible?this.caseSensitive.width():0)+(this.wholeWords?.visible?this.wholeWords.width():0)+(this.regex?.visible?this.regex.width():0)+(this._findFilter.visible?this._findFilter.width():0)}set filterVisible(e){this._findFilter.visible=e,this.updateFilterStyles(),this._updatePadding()}setEnabled(e){super.setEnabled(e),e&&(!this._filterChecked||!this._findFilter.visible)?this.regex?.enable():this.regex?.disable()}updateFilterStyles(){this._filterChecked=!this.filters.markupInput||!this.filters.markupPreview||!this.filters.codeInput||!this.filters.codeOutput,this._findFilter.applyStyles(this._filterChecked)}};var Who=26,sNe=class a extends st{constructor(e){super(a.ID,"",q.asClassName(fho),!1);this._searchWidget=e}static{this.ID="search.action.replaceAll"}set searchWidget(e){this._searchWidget=e}run(){return this._searchWidget?this._searchWidget.triggerReplaceAll():Promise.resolve()}},OEi={groupId:"search-widget"},Nho=it?256:2048;function Oho(a,i,e){let t=!!i.match(/\n/);if(e&&(t||e.clientHeight>Who)&&e.selectionStart>0){a.stopPropagation();return}}function Fho(a,i,e){let t=!!i.match(/\n/);if(e&&(t||e.clientHeight>Who)&&e.selectionEnd<e.value.length){a.stopPropagation();return}}var jR=class extends Ma{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.contextViewService=o;this.contextKeyService=n;this.keybindingService=r;this.clipboardServce=s;this.configurationService=l;this.accessibilityService=c;this.contextMenuService=u;this.instantiationService=p;this.editorService=h;this.ignoreGlobalFindBufferOnNextFocus=!1;this.previousGlobalFindBufferValue=null;this._accessibilityHelpHintAnnounced=!1;this._onSearchSubmit=this._register(new E);this.onSearchSubmit=this._onSearchSubmit.event;this._onSearchCancel=this._register(new E);this.onSearchCancel=this._onSearchCancel.event;this._onReplaceToggled=this._register(new E);this.onReplaceToggled=this._onReplaceToggled.event;this._onReplaceStateChange=this._register(new E);this.onReplaceStateChange=this._onReplaceStateChange.event;this._onPreserveCaseChange=this._register(new E);this.onPreserveCaseChange=this._onPreserveCaseChange.event;this._onReplaceValueChanged=this._register(new E);this.onReplaceValueChanged=this._onReplaceValueChanged.event;this._onReplaceAll=this._register(new E);this.onReplaceAll=this._onReplaceAll.event;this._onBlur=this._register(new E);this.onBlur=this._onBlur.event;this._onDidHeightChange=this._register(new E);this.onDidHeightChange=this._onDidHeightChange.event;this._onDidToggleContext=this._register(new E);this.onDidToggleContext=this._onDidToggleContext.event;this.replaceActive=Ci.ReplaceActiveKey.bindTo(this.contextKeyService),this.searchInputBoxFocused=Ci.SearchInputBoxFocusedKey.bindTo(this.contextKeyService),this.replaceInputBoxFocused=Ci.ReplaceInputBoxFocusedKey.bindTo(this.contextKeyService);let g=t.notebookOptions??{isInNotebookMarkdownInput:!0,isInNotebookMarkdownPreview:!0,isInNotebookCellInput:!0,isInNotebookCellOutput:!0};this._notebookFilters=this._register(new oNe(g.isInNotebookMarkdownInput,g.isInNotebookMarkdownPreview,g.isInNotebookCellInput,g.isInNotebookCellOutput,{findScopeType:"none"})),this._register(this._notebookFilters.onDidChange(()=>{this.searchInput&&this.searchInput.updateFilterStyles()})),this._register(this.editorService.onDidEditorsChange(f=>{this.searchInput&&f.event.editor instanceof ha&&(f.event.kind===5||f.event.kind===6)&&(this.searchInput.filterVisible=this._hasNotebookOpen())})),this._replaceHistoryDelayer=new jo(500),this._toggleReplaceButtonListener=this._register(new me),this.render(e,t),this._register(this.configurationService.onDidChangeConfiguration(f=>{f.affectsConfiguration("editor.accessibilitySupport")&&this.updateAccessibilitySupport()})),this._register(this.accessibilityService.onDidChangeScreenReaderOptimized(()=>this.updateAccessibilitySupport())),this.updateAccessibilitySupport()}static{this.INPUT_MAX_HEIGHT=134}static{this.REPLACE_ALL_DISABLED_LABEL=d(13453,null)}static{this.REPLACE_ALL_ENABLED_LABEL=e=>e.appendKeybinding(d(13454,null),sNe.ID)}_hasNotebookOpen(){return this.editorService.editors.some(t=>t instanceof ha)}getNotebookFilters(){return this._notebookFilters}focus(e=!0,t=!1,o=!1){this.ignoreGlobalFindBufferOnNextFocus=o,t&&this.isReplaceShown()?this.replaceInput&&(this._updateSearchInputAriaLabel(!1),this.replaceInput.focus(),e&&this.replaceInput.select()):this.searchInput&&(this._updateSearchInputAriaLabel(!0),this.searchInput.focus(),e&&this.searchInput.select())}_updateSearchInputAriaLabel(e){if(!this.searchInput)return;let t=d(13452,null);if(e&&!this._accessibilityHelpHintAnnounced&&this.configurationService.getValue("accessibility.verbosity.find")&&this.accessibilityService.isScreenReaderOptimized()){let o=this.keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getAriaLabel();o&&(t+=", "+d(13450,null,o),this._accessibilityHelpHintAnnounced=!0,this._labelResetTimeout?.dispose(),this._labelResetTimeout=nn(()=>{this.searchInput&&this.searchInput.inputBox.setAriaLabel(d(13452,null))},1e3))}this.searchInput.inputBox.setAriaLabel(t)}setWidth(e){this.searchInput?.inputBox.layout(),this.replaceInput&&(this.replaceInput.width=e-28,this.replaceInput.inputBox.layout())}clear(){this.searchInput?.clear(),this.replaceInput?.setValue(""),this.setReplaceAllActionState(!1)}isReplaceShown(){return this.replaceContainer?!this.replaceContainer.classList.contains("disabled"):!1}isReplaceActive(){return!!this.replaceActive.get()}getReplaceValue(){return this.replaceInput?.getValue()??""}toggleReplace(e){(e===void 0||e!==this.isReplaceShown())&&this.onToggleReplaceButton()}getSearchHistory(){return this.searchInput?.inputBox.getHistory()??[]}getReplaceHistory(){return this.replaceInput?.inputBox.getHistory()??[]}prependSearchHistory(e){this.searchInput?.inputBox.prependHistory(e)}prependReplaceHistory(e){this.replaceInput?.inputBox.prependHistory(e)}clearHistory(){this.searchInput?.inputBox.clearHistory(),this.replaceInput?.inputBox.clearHistory()}showNextSearchTerm(){this.searchInput?.inputBox.showNextValue()}showPreviousSearchTerm(){this.searchInput?.inputBox.showPreviousValue()}showNextReplaceTerm(){this.replaceInput?.inputBox.showNextValue()}showPreviousReplaceTerm(){this.replaceInput?.inputBox.showPreviousValue()}searchInputHasFocus(){return!!this.searchInputBoxFocused.get()}replaceInputHasFocus(){return!!this.replaceInput?.inputBox.hasFocus()}focusReplaceAllAction(){this.replaceActionBar?.focus(!0)}focusRegexAction(){this.searchInput?.focusOnRegex()}set replaceButtonVisibility(e){this.toggleReplaceButton&&(this.toggleReplaceButton.element.style.display=e?"":"none")}render(e,t){this.domNode=R(e,_(".search-widget")),this.domNode.style.position="relative",t._hideReplaceToggle||this.renderToggleReplaceButton(this.domNode),this.renderSearchInput(this.domNode,t),this.renderReplaceInput(this.domNode,t)}updateAccessibilitySupport(){this.searchInput?.setFocusInputOnOptionClick(!this.accessibilityService.isScreenReaderOptimized())}renderToggleReplaceButton(e){let t={buttonBackground:void 0,buttonBorder:void 0,buttonForeground:void 0,buttonHoverBackground:void 0,buttonSecondaryBackground:void 0,buttonSecondaryForeground:void 0,buttonSecondaryHoverBackground:void 0,buttonSeparator:void 0,title:d(13457,null),hoverDelegate:Ni("element")};this.toggleReplaceButton=this._register(new Mi(e,t)),this.toggleReplaceButton.element.setAttribute("aria-expanded","false"),this.toggleReplaceButton.element.classList.add("toggle-replace-button"),this.toggleReplaceButton.icon=LUt,this._toggleReplaceButtonListener.value=this.toggleReplaceButton.onDidClick(()=>this.onToggleReplaceButton())}renderSearchInput(e,t){let o=t.searchHistory||[],n={label:d(13452,null),validation:s=>this.validateSearchInput(s),placeholder:d(13455,null),appendCaseSensitiveLabel:this.keybindingService.appendKeybinding("","toggleSearchCaseSensitive"),appendWholeWordsLabel:this.keybindingService.appendKeybinding("","toggleSearchWholeWord"),appendRegexLabel:this.keybindingService.appendKeybinding("","toggleSearchRegex"),history:new Set(o),showHistoryHint:()=>ML(this.keybindingService),flexibleHeight:!0,flexibleMaxHeight:jR.INPUT_MAX_HEIGHT,showCommonFindToggles:!0,inputBoxStyles:t.inputBoxStyles,toggleStyles:t.toggleStyles,hoverLifecycleOptions:OEi},r=R(e,_(".search-container.input-box"));this.searchInput=this._register(new WUt(r,this.contextViewService,n,this.contextKeyService,this.contextMenuService,this.instantiationService,this._notebookFilters,this._hasNotebookOpen())),this._register(this.searchInput.onKeyDown(s=>this.onSearchInputKeyDown(s))),this.searchInput.setValue(t.value||""),this.searchInput.setRegex(!!t.isRegex),this.searchInput.setCaseSensitive(!!t.isCaseSensitive),this.searchInput.setWholeWords(!!t.isWholeWords),this._register(this.searchInput.onCaseSensitiveKeyDown(s=>this.onCaseSensitiveKeyDown(s))),this._register(this.searchInput.onRegexKeyDown(s=>this.onRegexKeyDown(s))),this._register(this.searchInput.inputBox.onDidChange(()=>this.onSearchInputChanged())),this._register(this.searchInput.inputBox.onDidHeightChange(()=>this._onDidHeightChange.fire())),this._register(this.onReplaceValueChanged(()=>{this._replaceHistoryDelayer.trigger(()=>this.replaceInput?.inputBox.addToHistory())})),this.searchInputFocusTracker=this._register(Vn(this.searchInput.inputBox.inputElement)),this._register(this.searchInputFocusTracker.onDidFocus(async()=>{this.searchInputBoxFocused.set(!0);let s=this.searchConfiguration.globalFindClipboard;if(!this.ignoreGlobalFindBufferOnNextFocus&&s){let l=await this.clipboardServce.readFindText();l&&this.previousGlobalFindBufferValue!==l&&(this.searchInput?.inputBox.addToHistory(),this.searchInput?.setValue(l),this.searchInput?.select()),this.previousGlobalFindBufferValue=l}this.ignoreGlobalFindBufferOnNextFocus=!1})),this._register(this.searchInputFocusTracker.onDidBlur(()=>this.searchInputBoxFocused.set(!1))),this.showContextToggle=new Kh({isChecked:!1,title:this.keybindingService.appendKeybinding(d(13458,null),FUt),icon:gho,hoverLifecycleOptions:OEi,...qg}),this._register(this.showContextToggle.onChange(()=>this.onContextLinesChanged())),t.showContextToggle&&(this.contextLinesInput=new Dc(r,this.contextViewService,{type:"number",inputBoxStyles:pl}),this.contextLinesInput.element.classList.add("context-lines-input"),this.contextLinesInput.value=""+(this.configurationService.getValue("search").searchEditor.defaultNumberOfContextLines??1),this._register(this.contextLinesInput.onDidChange(s=>{s!=="0"&&(this.showContextToggle.checked=!0),this.onContextLinesChanged()})),R(r,this.showContextToggle.domNode))}onContextLinesChanged(){this._onDidToggleContext.fire(),this.contextLinesInput.value.includes("-")&&(this.contextLinesInput.value="0"),this._onDidToggleContext.fire()}setContextLines(e){this.contextLinesInput&&(e===0?this.showContextToggle.checked=!1:(this.showContextToggle.checked=!0,this.contextLinesInput.value=""+e))}renderReplaceInput(e,t){this.replaceContainer=R(e,_(".replace-container.disabled"));let o=R(this.replaceContainer,_(".replace-input"));this.replaceInput=this._register(new R1(o,this.contextViewService,{label:d(13451,null),placeholder:d(13456,null),appendPreserveCaseLabel:this.keybindingService.appendKeybinding("","toggleSearchPreserveCase"),history:new Set(t.replaceHistory),showHistoryHint:()=>ML(this.keybindingService),flexibleHeight:!0,flexibleMaxHeight:jR.INPUT_MAX_HEIGHT,inputBoxStyles:t.inputBoxStyles,toggleStyles:t.toggleStyles,hoverLifecycleOptions:OEi},this.contextKeyService,!0)),this._register(this.replaceInput.onDidOptionChange(n=>{n||this.replaceInput&&this._onPreserveCaseChange.fire(this.replaceInput.getPreserveCase())})),this._register(this.replaceInput.onKeyDown(n=>this.onReplaceInputKeyDown(n))),this.replaceInput.setValue(t.replaceValue||""),this._register(this.replaceInput.inputBox.onDidChange(()=>this._onReplaceValueChanged.fire())),this._register(this.replaceInput.inputBox.onDidHeightChange(()=>this._onDidHeightChange.fire())),this.replaceAllAction=new sNe(this),this.replaceAllAction.label=jR.REPLACE_ALL_DISABLED_LABEL,this.replaceActionBar=this._register(new ji(this.replaceContainer)),this.replaceActionBar.push([this.replaceAllAction],{icon:!0,label:!1}),this.onkeydown(this.replaceActionBar.domNode,n=>this.onReplaceActionbarKeyDown(n)),this.replaceInputFocusTracker=this._register(Vn(this.replaceInput.inputBox.inputElement)),this._register(this.replaceInputFocusTracker.onDidFocus(()=>this.replaceInputBoxFocused.set(!0))),this._register(this.replaceInputFocusTracker.onDidBlur(()=>this.replaceInputBoxFocused.set(!1))),this._register(this.replaceInput.onPreserveCaseKeyDown(n=>this.onPreserveCaseKeyDown(n)))}triggerReplaceAll(){return this._onReplaceAll.fire(),Promise.resolve()}onToggleReplaceButton(){this.replaceContainer?.classList.toggle("disabled"),this.isReplaceShown()?(this.toggleReplaceButton?.element.classList.remove(...q.asClassNameArray(LUt)),this.toggleReplaceButton?.element.classList.add(...q.asClassNameArray(EEi))):(this.toggleReplaceButton?.element.classList.remove(...q.asClassNameArray(EEi)),this.toggleReplaceButton?.element.classList.add(...q.asClassNameArray(LUt))),this.toggleReplaceButton?.element.setAttribute("aria-expanded",this.isReplaceShown()?"true":"false"),this.updateReplaceActiveState(),this._onReplaceToggled.fire()}setValue(e){this.searchInput?.setValue(e)}setReplaceAllActionState(e){this.replaceAllAction&&this.replaceAllAction.enabled!==e&&(this.replaceAllAction.enabled=e,this.replaceAllAction.label=e?jR.REPLACE_ALL_ENABLED_LABEL(this.keybindingService):jR.REPLACE_ALL_DISABLED_LABEL,this.updateReplaceActiveState())}updateReplaceActiveState(){let e=this.isReplaceActive(),t=this.isReplaceShown()&&!!this.replaceAllAction?.enabled;e!==t&&(this.replaceActive.set(t),this._onReplaceStateChange.fire(t),this.replaceInput?.inputBox.layout())}validateSearchInput(e){if(e.length===0||!this.searchInput?.getRegex())return null;try{new RegExp(e,"u")}catch(t){return{content:t.message}}return null}onSearchInputChanged(){if(this.searchInput?.clearMessage(),this.setReplaceAllActionState(!1),this.searchConfiguration.searchOnType)if(this.searchInput?.getRegex())try{let e=new RegExp(this.searchInput.getValue(),"ug"),t=`
~!@#$%^&*()_+
\`1234567890-=
qwertyuiop[]\\
QWERTYUIOP{}|
asdfghjkl;'
ASDFGHJKL:"
zxcvbnm,./
ZXCVBNM<>? `.match(e)?.length??0,o=t<50?1:t<100?5:10;this.submitSearch(!0,this.searchConfiguration.searchOnTypeDebouncePeriod*o)}catch{}else this.submitSearch(!0,this.searchConfiguration.searchOnTypeDebouncePeriod)}onSearchInputKeyDown(e){if(e.equals(Nho|3)&&(this.searchInput?.inputBox.insertAtCursor(`
`),e.preventDefault()),e.equals(3))this.searchInput?.onSearchSubmit(),this.submitSearch(),e.preventDefault();else if(e.equals(9))this._onSearchCancel.fire({focus:!0}),e.preventDefault();else if(e.equals(2))this.isReplaceShown()?this.replaceInput?.focus():this.searchInput?.focusOnCaseSensitive(),e.preventDefault();else if(e.equals(16))Oho(e,this.searchInput?.getValue()??"",this.searchInput?.domNode.querySelector("textarea")??null);else if(e.equals(18))Fho(e,this.searchInput?.getValue()??"",this.searchInput?.domNode.querySelector("textarea")??null);else if(e.equals(11)){let t=this.searchInput?.inputBox.inputElement;t&&(t.setSelectionRange(0,0),t.focus(),e.preventDefault())}else if(e.equals(12)){let t=this.searchInput?.inputBox.inputElement;if(t){let o=t.value.length;t.setSelectionRange(o,o),t.focus(),e.preventDefault()}}}onCaseSensitiveKeyDown(e){e.equals(1026)&&this.isReplaceShown()&&(this.replaceInput?.focus(),e.preventDefault())}onRegexKeyDown(e){e.equals(2)&&this.isReplaceShown()&&(this.replaceInput?.focusOnPreserve(),e.preventDefault())}onPreserveCaseKeyDown(e){e.equals(2)?(this.isReplaceActive()?this.focusReplaceAllAction():this._onBlur.fire(),e.preventDefault()):e.equals(1026)&&(this.focusRegexAction(),e.preventDefault())}onReplaceInputKeyDown(e){e.equals(Nho|3)&&(this.replaceInput?.inputBox.insertAtCursor(`
`),e.preventDefault()),e.equals(3)?(this.submitSearch(),e.preventDefault()):e.equals(2)?(this.searchInput?.focusOnCaseSensitive(),e.preventDefault()):e.equals(1026)?(this.searchInput?.focus(),e.preventDefault()):e.equals(16)?Oho(e,this.replaceInput?.getValue()??"",this.replaceInput?.domNode.querySelector("textarea")??null):e.equals(18)&&Fho(e,this.replaceInput?.getValue()??"",this.replaceInput?.domNode.querySelector("textarea")??null)}onReplaceActionbarKeyDown(e){e.equals(1026)&&(this.focusRegexAction(),e.preventDefault())}async submitSearch(e=!1,t=0){if(this.searchInput?.validate(),!this.searchInput?.inputBox.isInputValid())return;let o=this.searchInput.getValue(),n=this.searchConfiguration.globalFindClipboard;o&&n&&await this.clipboardServce.writeFindText(o),this._onSearchSubmit.fire({triggeredOnType:e,delay:t})}getContextLines(){return this.showContextToggle.checked?+this.contextLinesInput.value:0}modifyContextLines(e){let o=+this.contextLinesInput.value+(e?1:-1);this.showContextToggle.checked=o!==0,this.contextLinesInput.value=""+o}toggleContextLines(){this.showContextToggle.checked=!this.showContextToggle.checked,this.onContextLinesChanged()}dispose(){this.setReplaceAllActionState(!1),super.dispose()}get searchConfiguration(){return this.configurationService.getValue("search")}};jR=I([m(2,_n),m(3,X),m(4,_e),m(5,Wi),m(6,B),m(7,Bi),m(8,ze),m(9,F),m(10,ee)],jR);function Vho(){yt.registerCommandAndKeybindingRule({id:sNe.ID,weight:200,when:x.and(Ci.SearchViewVisibleKey,Ci.ReplaceActiveKey,L3i),primary:2563,handler:a=>{let i=a.get(Ft);if(Rho(i)){let e=Pc(i);e&&new sNe(e.searchAndReplaceWidget).run()}}})}var fI=ae("replaceService");var aNe=ae("searchHistoryService"),xA=class{constructor(i){this.storageService=i;this._onDidClearHistory=new E;this.onDidClearHistory=this._onDidClearHistory.event}static{this.SEARCH_HISTORY_KEY="workbench.search.history"}clearHistory(){this.storageService.remove(xA.SEARCH_HISTORY_KEY,1),this._onDidClearHistory.fire()}load(){let i,e=this.storageService.get(xA.SEARCH_HISTORY_KEY,1);if(e)try{i=JSON.parse(e)}catch{}return i||{}}save(i){mf(i)?this.storageService.remove(xA.SEARCH_HISTORY_KEY,1):this.storageService.store(xA.SEARCH_HISTORY_KEY,JSON.stringify(i),1,0)}};xA=I([m(0,le)],xA);var Bho=`
`,FEi=a=>i=>new z(i.startLineNumber+a,i.startColumn,i.endLineNumber+a,i.endColumn),WYo=(a,i)=>{let e=n=>`${a.range().startLineNumber+n}`,t=a.fullPreviewLines(),o=[];return t.forEach((n,r)=>{let s=e(r),c=` ${" ".repeat(i-s.length)}${s}: `,u=c.length,p=c+(n.split(/\r?\n?$/,1)[0]||""),h=({start:b,end:S})=>new z(1,(b??1)+u,1,(S??n.length+1)+u),g=a.rangeInPreview(),f=g.startLineNumber===g.endLineNumber,v;f?v=h({start:g.startColumn,end:g.endColumn}):r===0?v=h({start:g.startColumn}):r===t.length-1?v=h({end:g.endColumn}):v=h({}),o.push({lineNumber:s,line:p,ranges:[v]})}),o};function VYo(a,i){let e=a.textMatches().length>0?Hho(a.resource,a.textMatches().sort(CA),a.context,i):void 0,t=Dte(a)?a.cellMatches().sort((o,n)=>o.cellIndex-n.cellIndex).sort().filter(o=>o.contentMatches.length>0).map((o,n)=>BYo(o,i,n===0)):[];return[e,...t].filter(o=>!!o)}function Hho(a,i,e,t,o=!0){let n=i[i.length-1].range().endLineNumber.toString().length,r=o?[`${t(a)}:`]:[],s=[],l={},c=[];e.forEach((h,g)=>c.push({line:h,lineNumber:g})),c.sort((h,g)=>h.lineNumber-g.lineNumber);let u,p=new Set;for(i.forEach(h=>{WYo(h,n).forEach(g=>{if(!p.has(g.lineNumber)){for(;c.length&&c[0].lineNumber<+g.lineNumber;){let{line:f,lineNumber:v}=c.shift();u!==void 0&&v!==u+1&&r.push(""),r.push(` ${" ".repeat(n-`${v}`.length)}${v} ${f}`),u=v}l[g.lineNumber]=r.length,p.add(g.lineNumber),r.push(g.line),u=+g.lineNumber}s.push(...g.ranges.map(FEi(l[g.lineNumber])))})});c.length;){let{line:h,lineNumber:g}=c.shift();r.push(` ${g} ${h}`)}return{text:r,matchRanges:s}}function BYo(a,i,e){return Hho(a.cell?.uri??a.parent.resource,a.contentMatches.sort(CA),a.context,i,e)}var HYo=(a,i,e,t)=>({query:a.contentPattern.pattern,isRegexp:!!a.contentPattern.isRegExp,isCaseSensitive:!!a.contentPattern.isCaseSensitive,matchWholeWord:!!a.contentPattern.isWordMatch,filesToExclude:e,filesToInclude:i,showIncludesExcludes:!!(i||e||a?.userDisabledExcludesAndIgnoreFiles),useExcludeSettingsAndIgnoreFiles:a?.userDisabledExcludesAndIgnoreFiles===void 0?!0:!a.userDisabledExcludesAndIgnoreFiles,contextLines:t,onlyOpenEditors:!!a.onlyOpenEditors,notebookSearchConfig:{includeMarkupInput:!!a.contentPattern.notebookInfo?.isInNotebookMarkdownInput,includeMarkupPreview:!!a.contentPattern.notebookInfo?.isInNotebookMarkdownPreview,includeCodeInput:!!a.contentPattern.notebookInfo?.isInNotebookCellInput,includeOutput:!!a.contentPattern.notebookInfo?.isInNotebookCellOutput}}),Uho=a=>(t=>t.filter(o=>o!==!1&&o!==null&&o!==void 0))([`# Query: ${(t=>t.replace(/\\/g,"\\\\").replace(/\n/g,"\\n"))(a.query??"")}`,(a.isCaseSensitive||a.matchWholeWord||a.isRegexp||a.useExcludeSettingsAndIgnoreFiles===!1)&&`# Flags: ${si([a.isCaseSensitive&&"CaseSensitive",a.matchWholeWord&&"WordMatch",a.isRegexp&&"RegExp",a.onlyOpenEditors&&"OpenEditors",a.useExcludeSettingsAndIgnoreFiles===!1&&"IgnoreExcludeSettings"]).join(" ")}`,a.filesToInclude?`# Including: ${a.filesToInclude}`:void 0,a.filesToExclude?`# Excluding: ${a.filesToExclude}`:void 0,a.contextLines?`# ContextLines: ${a.contextLines}`:void 0,""]).join(Bho);var WEi=()=>({query:"",filesToInclude:"",filesToExclude:"",isRegexp:!1,isCaseSensitive:!1,useExcludeSettingsAndIgnoreFiles:!0,matchWholeWord:!1,contextLines:0,showIncludesExcludes:!1,onlyOpenEditors:!1,notebookSearchConfig:{includeMarkupInput:!0,includeMarkupPreview:!1,includeCodeInput:!0,includeOutput:!0}}),UYo=a=>{let i=WEi(),e=o=>{let n="";for(let r=0;r<o.length;r++)if(o[r]==="\\"){r++;let s=o[r];if(s==="n")n+=`
`;else if(s==="\\")n+="\\";else throw Error(d(13494,null))}else n+=o[r];return n},t=/^# ([^:]*): (.*)$/;for(let o of a){let n=t.exec(o);if(!n)continue;let[,r,s]=n;switch(r){case"Query":i.query=e(s);break;case"Including":i.filesToInclude=s;break;case"Excluding":i.filesToExclude=s;break;case"ContextLines":i.contextLines=+s;break;case"Flags":i.isRegexp=s.indexOf("RegExp")!==-1,i.isCaseSensitive=s.indexOf("CaseSensitive")!==-1,i.useExcludeSettingsAndIgnoreFiles=s.indexOf("IgnoreExcludeSettings")===-1,i.matchWholeWord=s.indexOf("WordMatch")!==-1,i.onlyOpenEditors=s.indexOf("OpenEditors")!==-1}}return i.showIncludesExcludes=!!(i.filesToInclude||i.filesToExclude||!i.useExcludeSettingsAndIgnoreFiles),i},VUt=(a,i,e,t,o,n,r)=>{if(!a.query)throw Error("Internal Error: Expected query, got null");let s=HYo(a.query,i,e,t),l=a.fileCount()>1?d(13496,null,a.fileCount()):d(13498,null),c=a.count()>1?d(13497,null,a.count()):d(13499,null),u=[a.count()?`${c} - ${l}`:d(13495,null)];r&&u.push(d(13500,null)),u.push("");let p=(g,f)=>CA(g,f,n),h=zYo(a.folderMatches().sort(p).map(g=>g.allDownstreamFileMatches().sort(p).flatMap(f=>VYo(f,o))).flat());return{matchRanges:h.matchRanges.map(FEi(u.length)),text:u.concat(h.text).join(Bho),config:s}},zYo=a=>{let i=[],e=[];return a.forEach(t=>{t.matchRanges.map(FEi(i.length)).forEach(o=>e.push(o)),t.text.forEach(o=>i.push(o)),i.push("")}),{text:i,matchRanges:e}},BUt=async(a,i)=>{let t=(await a.get(Ho).read(i)).value;return VEi(t)},VEi=a=>{let i=[],e=[],t=!0;for(let o of a.split(/\r?\n/g))t?(i.push(o),o===""&&(t=!1)):e.push(o);return{config:UYo(i),text:e.join(`
`)}};var lNe=class{constructor(i){this.config=i;this._onConfigDidUpdate=new E;this.onConfigDidUpdate=this._onConfigDidUpdate.event}updateConfig(i){this.config=i,this._onConfigDidUpdate.fire(i)}},HUt=class{constructor(i){this.resource=i}async resolve(){return Oi(cNe.models.get(this.resource)).resolve()}},BEi=class{constructor(){this.models=new vt}initializeModelFromExistingModel(i,e,t){if(this.models.has(e))throw Error("Unable to contruct model for resource that already exists");let o=i.get(kt),n=i.get(Ct),r=i.get(F),s=i.get(Gm),l;this.models.set(e,{resolve:()=>(l||(l=(async()=>{let c=await this.tryFetchModelFromBackupService(e,o,n,s,r);return c||Promise.resolve({resultsModel:n.getModel(e)??n.createModel("",o.createById(Vz),e),configurationModel:new lNe(t)})})()),l)})}initializeModelFromRawData(i,e,t,o){if(this.models.has(e))throw Error("Unable to contruct model for resource that already exists");let n=i.get(kt),r=i.get(Ct),s=i.get(F),l=i.get(Gm),c;this.models.set(e,{resolve:()=>(c||(c=(async()=>{let u=await this.tryFetchModelFromBackupService(e,n,r,l,s);return u||Promise.resolve({resultsModel:r.createModel(o??"",n.createById(Vz),e),configurationModel:new lNe(t)})})()),c)})}initializeModelFromExistingFile(i,e,t){if(this.models.has(e))throw Error("Unable to contruct model for resource that already exists");let o=i.get(kt),n=i.get(Ct),r=i.get(F),s=i.get(Gm),l;this.models.set(e,{resolve:async()=>(l||(l=(async()=>{let c=await this.tryFetchModelFromBackupService(e,o,n,s,r);if(c)return c;let{text:u,config:p}=await r.invokeFunction(BUt,t);return{resultsModel:n.createModel(u??"",o.createById(Vz),e),configurationModel:new lNe(p)}})()),l)})}async tryFetchModelFromBackupService(i,e,t,o,n){let r=await o.resolve({resource:i,typeId:OUt}),s=t.getModel(i);if(!s&&r){let l=await W9(r.value);s=t.createModel(l,e.createById(Vz),i)}if(s){let l=s.getValue(),{text:c,config:u}=VEi(l);return t.destroyModel(i),{resultsModel:t.createModel(c??"",e.createById(Vz),i),configurationModel:new lNe(u)}}else return}},cNe=new BEi;var dNe=".code-search",KYo=Re("search-editor-label-icon",M.search,d(13491,null)),pp=class extends Us{constructor(e,t,o,n,r,s,l,c,u,p){super();this.modelUri=e;this.backingUri=t;this.modelService=o;this.textFileService=n;this.fileDialogService=r;this.instantiationService=s;this.workingCopyService=l;this.telemetryService=c;this.pathService=u;this.dirty=!1;this._onDidChangeContent=this._register(new E);this.onDidChangeContent=this._onDidChangeContent.event;this._onDidSave=this._register(new E);this.onDidSave=this._onDidSave.event;this.oldDecorationsIDs=[];if(this.model=s.createInstance(HUt,e),this.modelUri.scheme!==iNe)throw Error("SearchEditorInput must be invoked with a SearchEditorScheme uri");this.memento=new Bl(pp.ID,p),this._register(p.onWillSaveState(()=>this.memento.saveMemento()));let h=this,g=new class{constructor(){this.typeId=OUt;this.resource=h.modelUri;this.capabilities=h.hasCapability(4)?2:0;this.onDidChangeDirty=h.onDidChangeDirty;this.onDidChangeContent=h.onDidChangeContent;this.onDidSave=h.onDidSave}get name(){return h.getName()}isDirty(){return h.isDirty()}isModified(){return h.isDirty()}backup(f){return h.backup(f)}save(f){return h.save(0,f).then(v=>!!v)}revert(f){return h.revert(0,f)}};this._register(this.workingCopyService.registerWorkingCopy(g))}static{this.ID=oit}get typeId(){return pp.ID}get editorId(){return this.typeId}getIcon(){return KYo}get capabilities(){let e=0;return this.backingUri||(e|=4),e}get resource(){return this.backingUri||this.modelUri}async save(e,t){if(!(await this.resolveModels()).resultsModel.isDisposed())return this.backingUri?(await this.textFileService.write(this.backingUri,await this.serializeForDisk(),t),this.setDirty(!1),this._onDidSave.fire({reason:t?.reason,source:t?.source}),this):this.saveAs(e,t)}tryReadConfigSync(){return this._cachedConfigurationModel?.config}async serializeForDisk(){let{configurationModel:e,resultsModel:t}=await this.resolveModels();return Uho(e.config)+`
`+t.getValue()}registerConfigChangeListeners(e){this.configChangeListenerDisposable?.dispose(),this.isDisposed()||(this.configChangeListenerDisposable=e.onConfigDidUpdate(()=>{this.lastLabel!==this.getName()&&(this._onDidChangeLabel.fire(),this.lastLabel=this.getName()),this.memento.getMemento(1,1).searchConfig=e.config}),this._register(this.configChangeListenerDisposable))}async resolveModels(){return this.model.resolve().then(e=>(this._cachedResultsModel=e.resultsModel,this._cachedConfigurationModel=e.configurationModel,this.lastLabel!==this.getName()&&(this._onDidChangeLabel.fire(),this.lastLabel=this.getName()),this.registerConfigChangeListeners(e.configurationModel),e))}async saveAs(e,t){let o=await this.fileDialogService.pickFileToSave(await this.suggestFileName(),t?.availableFileSystems);if(o){this.telemetryService.publicLog2("searchEditor/saveSearchResults");let n=await this.serializeForDisk();if(await this.textFileService.create([{resource:o,value:n,options:{overwrite:!0}}])){if(this.setDirty(!1),!Xe(o,this.modelUri)){let r=this.instantiationService.invokeFunction(kA,{fileUri:o,from:"existingFile"});return r.setMatchRanges(this.getMatchRanges()),r}return this}}}getName(e=12){let t=n=>n.length<e?n:`${n.slice(0,e-3)}...`;if(this.backingUri){let n=no.getOriginalUri(this);return d(13493,null,No((n??this.backingUri).path,dNe))}let o=this._cachedConfigurationModel?.config?.query?.trim();return o?d(13493,null,t(o)):d(13492,null)}setDirty(e){let t=this.dirty;this.dirty=e,t!==e&&this._onDidChangeDirty.fire()}isDirty(){return this.dirty}async rename(e,t){if(ms(t)===dNe)return{editor:this.instantiationService.invokeFunction(kA,{from:"existingFile",fileUri:t})}}dispose(){this.modelService.destroyModel(this.modelUri),super.dispose()}matches(e){return super.matches(e)?!0:e instanceof pp?!!(e.modelUri.fragment&&e.modelUri.fragment===this.modelUri.fragment)||!!(e.backingUri&&Xe(e.backingUri,this.backingUri)):!1}getMatchRanges(){return(this._cachedResultsModel?.getAllDecorations()??[]).filter(e=>e.options.className===PEi).filter(({range:e})=>!(e.startColumn===1&&e.endColumn===1)).map(({range:e})=>e)}async setMatchRanges(e){this.oldDecorationsIDs=(await this.resolveModels()).resultsModel.deltaDecorations(this.oldDecorationsIDs,e.map(t=>({range:t,options:{description:"search-editor-find-match",className:PEi,stickiness:1}})))}async revert(e,t){if(t?.soft){this.setDirty(!1);return}if(this.backingUri){let{config:o,text:n}=await this.instantiationService.invokeFunction(BUt,this.backingUri),{resultsModel:r,configurationModel:s}=await this.resolveModels();r.setValue(n),s.updateConfig(o)}else(await this.resolveModels()).resultsModel.setValue("");super.revert(e,t),this.setDirty(!1)}async backup(e){let t=await this.serializeForDisk();return e.isCancellationRequested?{}:{content:Nbe(Je.fromString(t))}}async suggestFileName(){let t=((await this.resolveModels()).configurationModel.config.query.replace(/[^\w \-_]+/g,"_")||"Search")+dNe;return je(await this.fileDialogService.defaultFilePath(this.pathService.defaultUriScheme),t)}toUntyped(){if(!this.hasCapability(4))return{resource:this.resource,options:{override:pp.ID}}}copy(){let e=A.from({scheme:iNe,fragment:`${Math.random()}`}),t=this._cachedConfigurationModel?.config??{},o=this._cachedResultsModel?.getValue()??"";return this.instantiationService.invokeFunction(kA,{from:"rawData",config:t,resultsContents:o,modelUri:e})}};pp=I([m(2,Ct),m(3,Ho),m(4,dn),m(5,F),m(6,Wa),m(7,Te),m(8,wn),m(9,le)],pp);var kA=(a,i)=>{let e=a.get(le),t=a.get(B),o=a.get(F),n;if(i.from==="model"||i.from==="rawData"&&i.modelUri?n=i.modelUri:n=A.from({scheme:iNe,fragment:`${Math.random()}`}),!cNe.models.has(n))if(i.from==="existingFile")o.invokeFunction(r=>cNe.initializeModelFromExistingFile(r,n,i.fileUri));else{let r=t.getValue("search").searchEditor,s=r.reusePriorSearchConfiguration,l=r.defaultNumberOfContextLines,c=s?new Bl(pp.ID,e).getMemento(1,1).searchConfig??{}:{},p={...WEi(),...c,...i.config};l!=null&&(p.contextLines=i?.config?.contextLines??l),i.from==="rawData"?(i.resultsContents&&(p.contextLines=0),o.invokeFunction(h=>cNe.initializeModelFromRawData(h,n,p,i.resultsContents))):o.invokeFunction(h=>cNe.initializeModelFromExistingModel(h,n,p))}return o.createInstance(pp,n,i.from==="existingFile"?i.fileUri:i.from==="model"?i.backupOf:void 0)};var zho=a=>{let i=a.get(ee);i.activeEditor instanceof pp&&i.activeEditorPane.toggleCaseSensitive()},Kho=a=>{let i=a.get(ee);i.activeEditor instanceof pp&&i.activeEditorPane.toggleWholeWords()},Gho=a=>{let i=a.get(ee);i.activeEditor instanceof pp&&i.activeEditorPane.toggleRegex()},$ho=a=>{let i=a.get(ee);i.activeEditor instanceof pp&&i.activeEditorPane.toggleContextLines()},HEi=(a,i)=>{let e=a.get(ee);e.activeEditor instanceof pp&&e.activeEditorPane.modifyContextLines(i)},qho=a=>{let i=a.get(ee);i.activeEditor instanceof pp&&i.activeEditorPane.focusAllResults()};async function jho(a){let i=a.get(Ft),e=a.get(F),t=Pc(i);t?await e.invokeFunction(uNe,{filesToInclude:t.searchIncludePattern.getValue(),onlyOpenEditors:t.searchIncludePattern.onlySearchInOpenEditors(),filesToExclude:t.searchExcludePattern.getValue(),isRegexp:t.searchAndReplaceWidget.searchInput?.getRegex(),isCaseSensitive:t.searchAndReplaceWidget.searchInput?.getCaseSensitive(),matchWholeWord:t.searchAndReplaceWidget.searchInput?.getWholeWords(),useExcludeSettingsAndIgnoreFiles:t.searchExcludePattern.useExcludesAndIgnoreFiles(),showIncludesExcludes:!!(t.searchIncludePattern.getValue()||t.searchExcludePattern.getValue()||!t.searchExcludePattern.useExcludesAndIgnoreFiles())}):await e.invokeFunction(uNe)}var uNe=async(a,i={},e=!1)=>{let t=a.get(ee),o=a.get(Et),n=a.get(Te),r=a.get(F),s=a.get(B),l=a.get(sp),c=a.get(Pe),p=a.get(zs).getLastActiveWorkspaceRoot(Y.file),h=p?c.getWorkspaceFolder(p)??void 0:void 0,g=t.activeTextEditorControl,f,v="";if(g){Ec(g)?g.getOriginalEditor().hasTextFocus()?f=g.getOriginalEditor():f=g.getModifiedEditor():f=g;let T=f?.getSelection();if(v=(T&&f?.getModel()?.getValueInRange(T))??"",T?.isEmpty()&&s.getValue("search").seedWithNearestWord){let N=f.getModel()?.getWordAtPosition(T.getStartPosition());N&&(v=N.word)}}else t.activeEditor instanceof pp&&(v=t.activeEditorPane.getSelected());n.publicLog2("searchEditor/openNewSearchEditor");let S={query:i.location==="new"||s.getValue("editor").find.seedSearchStringFromSelection?v:void 0};for(let T of Object.entries(i)){let N=T[0],O=T[1];O!==void 0&&(S[N]=typeof O=="string"?await l.resolveAsync(h,O):O)}let y=t.getEditors(0).find(T=>T.editor.typeId===pp.ID),w;if(y&&S.location==="reuse"){let T=o.getGroup(y.groupId);if(!T)throw new Error("Invalid group id for search editor");let N=y.editor;w=await T.openEditor(N),v?w.setQuery(v):w.selectQuery(),w.setSearchConfig(S)}else{let T=r.invokeFunction(kA,{config:S,resultsContents:"",from:"rawData"});w=await t.openEditor(T,{pinned:!0},e?vn:Un)}let k=s.getValue("search").searchOnType;(S.triggerSearch===!0||S.triggerSearch!==!1&&k&&S.query)&&w.triggerSearch({focusResults:S.focusResults}),S.focusResults||w.focusSearchInput()},UUt=async(a,i,e,t,o)=>{if(!i.query){console.error("Expected searchResult.query to be defined. Got",i);return}let n=a.get(ee),r=a.get(Te),s=a.get(F),l=a.get(ot),c=a.get(B),u=c.getValue("search").sortOrder;r.publicLog2("searchEditor/createEditorFromSearchResult");let p=b=>l.getUriLabel(b,{relative:!0}),{text:h,matchRanges:g,config:f}=VUt(i,e,t,0,p,u);f.onlyOpenEditors=o;let v=c.getValue("search").searchEditor.defaultNumberOfContextLines;if(i.isDirty||v===0||v===null){let b=s.invokeFunction(kA,{resultsContents:h,config:f,from:"rawData"});await n.openEditor(b,{pinned:!0}),b.setMatchRanges(g)}else{let b=s.invokeFunction(kA,{from:"rawData",resultsContents:"",config:{...f,contextLines:v}});(await n.openEditor(b,{pinned:!0})).triggerSearch()}};var Lte=ae("searchViewModelWorkbenchService");function GYo(a,i,e){let t=a[0].range.startLineNumber,o=a[a.length-1].range.endLineNumber,n=[];for(let r=t;r<=o;r++)n.push(i.getLineContent(r));return new LX(n.join(`
`)+`
`,a.map(r=>new z(r.range.startLineNumber-1,r.range.startColumn-1,r.range.endLineNumber-1,r.range.endColumn-1)),e)}function zUt(a,i,e){let t=-1,o=[],n=[];return a.forEach(r=>{r.range.startLineNumber!==t&&(n=[],o.push(n)),n.push(r),t=r.range.endLineNumber}),o.map(r=>GYo(r,i,e))}function pNe(a,i,e){let t=[],o=-1;for(let n=0;n<a.length;n++){let{start:r,end:s}=Qho(a[n]);if(typeof e.surroundingContext=="number"&&e.surroundingContext>0){let u=Math.max(o+1,r-e.surroundingContext);for(let p=u;p<r;p++)t.push({text:i.getLineContent(p+1),lineNumber:p+1})}t.push(a[n]);let l=a[n+1],c=l?Qho(l).start:Number.MAX_VALUE;if(typeof e.surroundingContext=="number"&&e.surroundingContext>0){let u=Math.min(c-1,s+e.surroundingContext,i.getLineCount()-1);for(let p=s+1;p<=u;p++)t.push({text:i.getLineContent(p+1),lineNumber:p+1})}o=s}return t}function Qho(a){let i=a.rangeLocations.map(o=>o.source),e=i[0].startLineNumber,t=i[i.length-1].endLineNumber;return{start:e,end:t}}function X3(a,i,e){let t=a.previewText.split(`
`);return a.rangeLocations.map(o=>{let n=o.preview;return new sit(i,t,n,o.source,e)})}var KUt=class KUt{constructor(i,e,t,o,n=!1){this._parent=i;this._fullPreviewLines=e;this._isReadonly=n;this._oneLinePreviewText=e[t.startLineNumber];let r=t.startLineNumber===t.endLineNumber?t.endColumn:this._oneLinePreviewText.length;this._rangeInPreviewText=new U6e(1,t.startColumn+1,r+1),this._range=new z(o.startLineNumber+1,o.startColumn+1,o.endLineNumber+1,o.endColumn+1),this._fullPreviewRange=t,this._id=Xtt+this._parent.resource.toString()+">"+this._range+this.getMatchString()}static{this.MAX_PREVIEW_CHARS=250}id(){return this._id}parent(){return this._parent}text(){return this._oneLinePreviewText}range(){return this._range}preview(){let i=this._oneLinePreviewText.substring(0,this._rangeInPreviewText.startColumn-1),e=c1i(i,26,"\u2026"),t=this.getMatchString(),o=this._oneLinePreviewText.substring(this._rangeInPreviewText.endColumn-1),n=KUt.MAX_PREVIEW_CHARS-e.length;return t=t.substr(0,n),n-=t.length,o=o.substr(0,n),{before:e,fullBefore:i,inside:t,after:o}}get replaceString(){let i=this.parent().parent().searchModel;if(!i.replacePattern)throw new Error("searchModel.replacePattern must be set before accessing replaceString");let e=this.fullMatchText(),t=i.replacePattern.getReplaceString(e,i.preserveCase);if(t!==null)return t;let o=e.replace(/\r\n/g,`
`);if(o!==e&&(t=i.replacePattern.getReplaceString(o,i.preserveCase),t!==null))return t;let n=this.fullMatchText(!0);if(t=i.replacePattern.getReplaceString(n,i.preserveCase),t!==null)return t;let r=n.replace(/\r\n/g,`
`);return r!==n&&(t=i.replacePattern.getReplaceString(r,i.preserveCase),t!==null)?t:i.replacePattern.pattern}fullMatchText(i=!1){let e;return i?e=this._fullPreviewLines:(e=this._fullPreviewLines.slice(this._fullPreviewRange.startLineNumber,this._fullPreviewRange.endLineNumber+1),e[e.length-1]=e[e.length-1].slice(0,this._fullPreviewRange.endColumn),e[0]=e[0].slice(this._fullPreviewRange.startColumn)),e.join(`
`)}rangeInPreview(){return{...this._fullPreviewRange,startColumn:this._fullPreviewRange.startColumn+1,endColumn:this._fullPreviewRange.endColumn+1}}fullPreviewLines(){return this._fullPreviewLines.slice(this._fullPreviewRange.startLineNumber,this._fullPreviewRange.endLineNumber+1)}getMatchString(){return this._oneLinePreviewText.substring(this._rangeInPreviewText.startColumn-1,this._rangeInPreviewText.endColumn-1)}get isReadonly(){return this._isReadonly}};I([mi],KUt.prototype,"preview",1);var sit=KUt;var m0=class extends C{constructor(e,t,o,n,r,s,l,c,u){super();this._query=e;this._previewOptions=t;this._maxResults=o;this._parent=n;this.rawMatch=r;this._closestRoot=s;this.modelService=l;this.replaceService=c;this._onChange=this._register(new E);this.onChange=this._onChange.event;this._onDispose=this._register(new E);this.onDispose=this._onDispose.event;this._model=null;this._modelListener=null;this._selectedMatch=null;this._modelDecorations=[];this._context=new Map;this.replaceQ=Promise.resolve();this._resource=this.rawMatch.resource,this._textMatches=new Map,this._removedTextMatches=new Set,this._updateScheduler=this._register(new Dt(this.updateMatchesForModel.bind(this),250)),this._name=new co(()=>u.getUriBasenameLabel(this.resource))}static{this._CURRENT_FIND_MATCH=po.register({description:"search-current-find-match",stickiness:1,zIndex:13,className:"currentFindMatch",inlineClassName:"currentFindMatchInline",overviewRuler:{color:If(MN),position:2},minimap:{color:If(a9),position:1}})}static{this._FIND_MATCH=po.register({description:"search-find-match",stickiness:1,className:"findMatch",inlineClassName:"findMatchInline",overviewRuler:{color:If(MN),position:2},minimap:{color:If(a9),position:1}})}static getDecorationOption(e){return e?m0._CURRENT_FIND_MATCH:m0._FIND_MATCH}get context(){return new Map(this._context)}get closestRoot(){return this._closestRoot}hasReadonlyMatches(){return this.matches().some(e=>e.isReadonly)}createMatches(){let e=this.modelService.getModel(this._resource);e?(this.bindModel(e),this.updateMatchesForModel()):this.rawMatch.results&&this.rawMatch.results.filter(ZO).forEach(t=>{X3(t,this,!1).forEach(o=>this.add(o))})}bindModel(e){this._model=e,this._modelListener=new P,this._modelListener.add(this._model.onDidChangeContent(()=>{this._updateScheduler.schedule()})),this._modelListener.add(this._model.onWillDispose(()=>this.onModelWillDispose())),this.updateHighlights()}onModelWillDispose(){this.updateMatchesForModel(),this.unbindModel()}unbindModel(){this._model&&(this._updateScheduler.cancel(),this._model.changeDecorations(e=>{this._modelDecorations=e.deltaDecorations(this._modelDecorations,[])}),this._model=null,this._modelListener.dispose())}updateMatchesForModel(){if(!this._model)return;this._textMatches=new Map;let e=this._query.isWordMatch&&this._query.wordSeparators?this._query.wordSeparators:null,t=this._model.findMatches(this._query.pattern,this._model.getFullModelRange(),!!this._query.isRegExp,!!this._query.isCaseSensitive,e,!1,this._maxResults??y5);this.updateMatches(t,!0,this._model,!1)}async updatesMatchesForLineAfterReplace(e,t){if(!this._model)return;let o={startLineNumber:e,startColumn:this._model.getLineMinColumn(e),endLineNumber:e,endColumn:this._model.getLineMaxColumn(e)};Array.from(this._textMatches.values()).filter(l=>l.range().startLineNumber===e).forEach(l=>this._textMatches.delete(l.id()));let r=this._query.isWordMatch&&this._query.wordSeparators?this._query.wordSeparators:null,s=this._model.findMatches(this._query.pattern,o,!!this._query.isRegExp,!!this._query.isCaseSensitive,r,!1,this._maxResults??y5);this.updateMatches(s,t,this._model,!1)}updateMatches(e,t,o,n){let r=zUt(e,o,this._previewOptions);r.forEach(s=>{X3(s,this,n).forEach(l=>{this._removedTextMatches.has(l.id())||(this.add(l),this.isMatchSelected(l)&&(this._selectedMatch=l))})}),this.addContext(pNe(r,o,this.parent().parent().query)),this._onChange.fire({forceUpdateModel:t}),this.updateHighlights()}updateHighlights(){this._model&&this._model.changeDecorations(e=>{let t=this.parent().showHighlights?this.matches().map(o=>({range:o.range(),options:m0.getDecorationOption(this.isMatchSelected(o))})):[];this._modelDecorations=e.deltaDecorations(this._modelDecorations,t)})}id(){return Ytt+this.resource.toString()}parent(){return this._parent}get hasChildren(){return this._textMatches.size>0}matches(){return[...this._textMatches.values()]}textMatches(){return Array.from(this._textMatches.values())}remove(e){Array.isArray(e)||(e=[e]);for(let t of e)this.removeMatch(t),this._removedTextMatches.add(t.id());this._onChange.fire({didRemove:!0})}async replace(e){return this.replaceQ=this.replaceQ.finally(async()=>{await this.replaceService.replace(e),await this.updatesMatchesForLineAfterReplace(e.range().startLineNumber,!1)})}setSelectedMatch(e){e&&(!this._textMatches.has(e.id())||this.isMatchSelected(e))||(this._selectedMatch=e,this.updateHighlights())}getSelectedMatch(){return this._selectedMatch}isMatchSelected(e){return!!this._selectedMatch&&this._selectedMatch.id()===e.id()}count(){return this.matches().length}get resource(){return this._resource}name(){return this._name.value}addContext(e){return e?e.filter((o=>!ZO(o))).forEach(o=>this._context.set(o.lineNumber,o.text)):void 0}add(e,t){this._textMatches.set(e.id(),e),t&&this._onChange.fire({forceUpdateModel:!0})}removeMatch(e){this._textMatches.delete(e.id()),this.isMatchSelected(e)?(this.setSelectedMatch(null),this._findMatchDecorationModel?.clearCurrentFindMatchDecoration()):this.updateHighlights()}async resolveFileStat(e){this._fileStat=await e.stat(this.resource).catch(()=>{})}get fileStat(){return this._fileStat}set fileStat(e){this._fileStat=e}dispose(){this.setSelectedMatch(null),this.unbindModel(),this._onDispose.fire(),super.dispose()}hasOnlyReadOnlyMatches(){return this.matches().every(e=>e.isReadonly)}};m0=I([m(6,Ct),m(7,fI),m(8,ot)],m0);var Rte=class{constructor(i){this._modelService=i;this._decorationId=null;this._model=null;this._modelDisposables=new P}removeHighlightRange(){if(this._model&&this._decorationId){let i=this._decorationId;this._model.changeDecorations(e=>{e.removeDecoration(i)})}this._decorationId=null}highlightRange(i,e,t=0){let o;A.isUri(i)?o=this._modelService.getModel(i):o=i,o&&this.doHighlightRange(o,e)}doHighlightRange(i,e){this.removeHighlightRange(),i.changeDecorations(t=>{this._decorationId=t.addDecoration(e,Rte._RANGE_HIGHLIGHT_DECORATION)}),this.setModel(i)}setModel(i){this._model!==i&&(this.clearModelListeners(),this._model=i,this._modelDisposables.add(this._model.onDidChangeDecorations(e=>{this.clearModelListeners(),this.removeHighlightRange(),this._model=null})),this._modelDisposables.add(this._model.onWillDispose(()=>{this.clearModelListeners(),this.removeHighlightRange(),this._model=null})))}clearModelListeners(){this._modelDisposables.clear()}dispose(){this._model&&(this.removeHighlightRange(),this._model=null),this._modelDisposables.dispose()}static{this._RANGE_HIGHLIGHT_DECORATION=po.register({description:"search-range-highlight",stickiness:1,className:"rangeHighlight",isWholeLine:!0})}};Rte=I([m(0,Ct)],Rte);function GUt(a){return"cellResults"in a}var ait="rawCell#";function Yho(a,i){let e=-1,t=[],o=[];return a.forEach(r=>{r.range.startLineNumber!==e&&o.length>0&&(t.push([...o]),o=[]),o.push(r),e=r.range.endLineNumber}),o.length>0&&t.push([...o]),t.map(r=>{let s=[],l=r[0].range.startLineNumber,c=r[r.length-1].range.endLineNumber;for(let u=l;u<=c;u++)s.push(i.getLineContent(u));return new LX(s.join(`
`)+`
`,r.map(u=>new z(u.range.startLineNumber-1,u.range.startColumn-1,u.range.endLineNumber-1,u.range.endColumn-1)))})}var $Ut=class extends C{constructor(e,t,o){super();this._source=e;this._inputTextBuffer=t;this._outputs=o;this._outputTextBuffers=void 0}_getFullModelRange(e){let t=e.getLineCount();return new z(1,1,t,this._getLineMaxColumn(e,t))}_getLineMaxColumn(e,t){if(t<1||t>e.getLineCount())throw new Error("Illegal value for lineNumber");return e.getLineLength(t)+1}get inputTextBuffer(){if(!this._inputTextBuffer){let e=new cq;e.acceptChunk(this._source);let t=e.finish(!0),{textBuffer:o,disposable:n}=t.create(1);this._inputTextBuffer=o,this._register(n)}return this._inputTextBuffer}get outputTextBuffers(){return this._outputTextBuffers||(this._outputTextBuffers=this._outputs.map(e=>{let t=new cq;t.acceptChunk(e);let o=t.finish(!0),{textBuffer:n,disposable:r}=o.create(1);return this._register(r),n})),this._outputTextBuffers}findInInputs(e){let o=new Oy(e,!1,!1,null).parseSearchRequest();if(!o)return[];let n=this._getFullModelRange(this.inputTextBuffer);return this.inputTextBuffer.findMatchesLineByLine(n,o,!0,5e3)}findInOutputs(e){let o=new Oy(e,!1,!1,null).parseSearchRequest();return o?this.outputTextBuffers.map(n=>{let r=n.findMatchesLineByLine(this._getFullModelRange(n),o,!0,5e3);if(r.length!==0)return{textBuffer:n,matches:r}}).filter(n=>!!n):[]}};function Xho(a){return jUt(a)?a.cell.id:`${ait}${a.index}`}function qUt(a){return"cellResults"in a&&a.cellResults instanceof Array&&a.cellResults.every(jUt)}function jUt(a){return"cell"in a}function QUt(a,i){return Yho(a,i.textBuffer)}function YUt(a){return a.map(i=>i.searchPreviewInfo?new LX(i.searchPreviewInfo.line,new z(0,i.searchPreviewInfo.range.start,0,i.searchPreviewInfo.range.end),void 0,i.index):void 0).filter(i=>!!i)}var Mte=class extends sit{constructor(e,t,o,n,r){super(e.parent,t,o,n,!1);this._cellParent=e;this._id=Xtt+this._parent.resource.toString()+">"+this._cellParent.cellIndex+(r?"_"+r:"")+"_"+this.notebookMatchTypeString()+this._range+this.getMatchString(),this._webviewIndex=r}parent(){return this._cellParent.parent}get cellParent(){return this._cellParent}notebookMatchTypeString(){return this.isWebviewMatch()?"webview":"content"}isWebviewMatch(){return this._webviewIndex!==void 0}get isReadonly(){return super.isReadonly||!this._cellParent.hasCellViewModel()||this.isWebviewMatch()}get cellIndex(){return this._cellParent.cellIndex}get webviewIndex(){return this._webviewIndex}get cell(){return this._cellParent.cell}},XUt=class{constructor(i,e,t){this._parent=i;this._cell=e;this._cellIndex=t;this._contentMatches=new Map,this._webviewMatches=new Map,this._context=new Map}hasCellViewModel(){return!(this._cell instanceof $Ut)}get context(){return new Map(this._context)}matches(){return[...this._contentMatches.values(),...this._webviewMatches.values()]}get contentMatches(){return Array.from(this._contentMatches.values())}get webviewMatches(){return Array.from(this._webviewMatches.values())}remove(i){Array.isArray(i)||(i=[i]);for(let e of i)this._contentMatches.delete(e.id()),this._webviewMatches.delete(e.id())}clearAllMatches(){this._contentMatches.clear(),this._webviewMatches.clear()}addContentMatches(i){Jho(i,this).forEach(t=>{this._contentMatches.set(t.id(),t)}),this.addContext(i)}addContext(i){this.cell&&this.cell.resolveTextModel().then(e=>{pNe(i,e,this.parent.parent().query).filter((n=>!ZO(n))).map(n=>({...n,lineNumber:n.lineNumber+1})).forEach(n=>{this._context.set(n.lineNumber,n.text)})})}addWebviewMatches(i){Jho(i,this).forEach(t=>{this._webviewMatches.set(t.id(),t)})}setCellModel(i){this._cell=i}get parent(){return this._parent}get id(){return this._cell?.id??`${ait}${this.cellIndex}`}get cellIndex(){return this._cellIndex}get cell(){return this._cell}},lhe=class extends m0{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,t,o,n,r,s,c,u,p);this.searchInstanceID=l;this.notebookEditorService=h;this._notebookEditorWidget=null;this._editorWidgetListener=null;this._cellMatches=new Map,this._notebookUpdateScheduler=this._register(new Dt(this.updateMatchesForEditorWidget.bind(this),250))}get cellContext(){let e=new Map;return this._cellMatches.forEach(t=>{e.set(t.id,t.context)}),e}getCellMatch(e){return this._cellMatches.get(e)}addCellMatch(e){let t=new XUt(this,jUt(e)?e.cell:void 0,e.index);this._cellMatches.set(t.id,t),this.addWebviewMatchesToCell(t.id,e.webviewResults),this.addContentMatchesToCell(t.id,e.contentResults)}addWebviewMatchesToCell(e,t){let o=this.getCellMatch(e);o!==void 0&&o.addWebviewMatches(t)}addContentMatchesToCell(e,t){let o=this.getCellMatch(e);o!==void 0&&o.addContentMatches(t)}revealCellRange(e,t){!this._notebookEditorWidget||!e.cell||(e.webviewIndex!==void 0?this._notebookEditorWidget.getCellIndex(e.cell)!==void 0&&this._notebookEditorWidget.revealCellOffsetInCenter(e.cell,t??0):(e.cell.updateEditState(e.cell.getEditState(),"focusNotebookCell"),this._notebookEditorWidget.setCellEditorSelection(e.cell,e.range()),this._notebookEditorWidget.revealRangeInCenterIfOutsideViewportAsync(e.cell,e.range())))}bindNotebookEditorWidget(e){this._notebookEditorWidget!==e&&(this._notebookEditorWidget=e,this._editorWidgetListener=this._notebookEditorWidget.textModel?.onDidChangeContent(t=>{t.rawEvents.some(o=>o.kind===10||o.kind===1)&&this._notebookUpdateScheduler.schedule()})??null,this._addNotebookHighlights())}unbindNotebookEditorWidget(e){e&&this._notebookEditorWidget!==e||(this._notebookEditorWidget&&(this._notebookUpdateScheduler.cancel(),this._editorWidgetListener?.dispose()),this._removeNotebookHighlights(),this._notebookEditorWidget=null)}updateNotebookHighlights(){this.parent().showHighlights?(this._addNotebookHighlights(),this.setNotebookFindMatchDecorationsUsingCellMatches(Array.from(this._cellMatches.values()))):this._removeNotebookHighlights()}_addNotebookHighlights(){this._notebookEditorWidget&&(this._findMatchDecorationModel?.stopWebviewFind(),this._findMatchDecorationModel?.dispose(),this._findMatchDecorationModel=new NRe(this._notebookEditorWidget,this.searchInstanceID),this._selectedMatch instanceof Mte&&this.highlightCurrentFindMatchDecoration(this._selectedMatch))}_removeNotebookHighlights(){this._findMatchDecorationModel&&(this._findMatchDecorationModel?.stopWebviewFind(),this._findMatchDecorationModel?.dispose(),this._findMatchDecorationModel=void 0)}updateNotebookMatches(e,t){if(!this._notebookEditorWidget)return;let o=new Map(this._cellMatches);this._notebookEditorWidget.getId()!==this._lastEditorWidgetIdForUpdate&&(this._cellMatches.clear(),this._lastEditorWidgetIdForUpdate=this._notebookEditorWidget.getId()),e.forEach(n=>{let r=this._cellMatches.get(n.cell.id);if(this._notebookEditorWidget&&!r){let l=this._notebookEditorWidget.getCellIndex(n.cell),c=o.get(`${ait}${l}`);c&&(c.setCellModel(n.cell),c.clearAllMatches(),r=c)}r?.clearAllMatches();let s=r??new XUt(this,n.cell,n.index);s.addContentMatches(QUt(n.contentMatches,n.cell)),s.addWebviewMatches(YUt(n.webviewMatches)),this._cellMatches.set(s.id,s)}),this._findMatchDecorationModel?.setAllFindMatchesDecorations(e),this._selectedMatch instanceof Mte&&this.highlightCurrentFindMatchDecoration(this._selectedMatch),this._onChange.fire({forceUpdateModel:t})}setNotebookFindMatchDecorationsUsingCellMatches(e){if(!this._findMatchDecorationModel)return;let t=si(e.map(o=>{let n=si(o.webviewMatches.map(s=>{if(s.webviewIndex)return{index:s.webviewIndex}}));if(!o.cell)return;let r=o.contentMatches.map(s=>new vU(s.range(),[s.text()]));return new V4(o.cell,o.cellIndex,r,n)}));try{this._findMatchDecorationModel.setAllFindMatchesDecorations(t)}catch{}}async updateMatchesForEditorWidget(){if(!this._notebookEditorWidget)return;this._textMatches=new Map;let e=this._query.isWordMatch&&this._query.wordSeparators?this._query.wordSeparators:null,t=await this._notebookEditorWidget.find(this._query.pattern,{regex:this._query.isRegExp,wholeWord:this._query.isWordMatch,caseSensitive:this._query.isCaseSensitive,wordSeparators:e??void 0,includeMarkupInput:this._query.notebookInfo?.isInNotebookMarkdownInput,includeMarkupPreview:this._query.notebookInfo?.isInNotebookMarkdownPreview,includeCodeInput:this._query.notebookInfo?.isInNotebookCellInput,includeOutput:this._query.notebookInfo?.isInNotebookCellOutput},ve.None,!1,!0,this.searchInstanceID);this.updateNotebookMatches(t,!0)}async showMatch(e){let t=await this.highlightCurrentFindMatchDecoration(e);this.setSelectedMatch(e),this.revealCellRange(e,t)}async highlightCurrentFindMatchDecoration(e){return!this._findMatchDecorationModel||!e.cell?null:e.webviewIndex===void 0?this._findMatchDecorationModel.highlightCurrentFindMatchDecorationInCell(e.cell,e.range()):this._findMatchDecorationModel.highlightCurrentFindMatchDecorationInWebview(e.cell,e.webviewIndex)}matches(){let e=Array.from(this._cellMatches.values()).flatMap(t=>t.matches());return[...super.matches(),...e]}removeMatch(e){e instanceof Mte?(e.cellParent.remove(e),e.cellParent.matches().length===0&&this._cellMatches.delete(e.cellParent.id),this.isMatchSelected(e)?(this.setSelectedMatch(null),this._findMatchDecorationModel?.clearCurrentFindMatchDecoration()):this.updateHighlights(),this.setNotebookFindMatchDecorationsUsingCellMatches(this.cellMatches())):super.removeMatch(e)}cellMatches(){return Array.from(this._cellMatches.values())}createMatches(){let e=this.modelService.getModel(this._resource);if(e)this.bindModel(e),this.updateMatchesForModel();else{let t=this.notebookEditorService.retrieveExistingWidgetFromURI(this.resource);t?.value&&this.bindNotebookEditorWidget(t.value),this.rawMatch.results&&this.rawMatch.results.filter(ZO).forEach(o=>{X3(o,this,!1).forEach(n=>this.add(n))}),(qUt(this.rawMatch)||GUt(this.rawMatch))&&(this.rawMatch.cellResults?.forEach(o=>this.addCellMatch(o)),this.setNotebookFindMatchDecorationsUsingCellMatches(this.cellMatches()),this._onChange.fire({forceUpdateModel:!0})),this.addContext(this.rawMatch.results)}}get hasChildren(){return super.hasChildren||this._cellMatches.size>0}setSelectedMatch(e){if(e){if(!this.isMatchSelected(e)&&VB(e)){this._selectedMatch=e;return}if(!this._textMatches.has(e.id())||this.isMatchSelected(e))return}this._selectedMatch=e,this.updateHighlights()}dispose(){this.unbindNotebookEditorWidget(),super.dispose()}};lhe=I([m(7,Ct),m(8,fI),m(9,ot),m(10,Zc)],lhe);function Jho(a,i){let e=[];return a.forEach(t=>{let o=t.previewText.split(`
`);t.rangeLocations.map(n=>{let r=n.preview,s=new Mte(i,o,r,n.source,t.webviewIndex);e.push(s)})}),e}var Pte=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this._resource=e;this._index=o;this._query=n;this._parent=r;this._searchResult=s;this._closestRoot=l;this.replaceService=c;this.instantiationService=u;this.uriIdentityService=h;this._onChange=this._register(new E);this.onChange=this._onChange.event;this._onDispose=this._register(new E);this.onDispose=this._onDispose.event;this._replacingAll=!1;this._fileMatches=new vt,this._folderMatches=new vt,this._folderMatchesMap=Yu.forUris(g=>this.uriIdentityService.extUri.ignorePathCasing(g)),this._unDisposedFileMatches=new vt,this._unDisposedFolderMatches=new vt,this._name=new co(()=>this.resource?p.getUriBasenameLabel(this.resource):""),this._id=Qtt+t}get searchModel(){return this._searchResult.searchModel}get showHighlights(){return this._parent.showHighlights}get closestRoot(){return this._closestRoot}set replacingAll(e){this._replacingAll=e}id(){return this._id}get resource(){return this._resource}index(){return this._index}name(){return this._name.value}parent(){return this._parent}isAIContributed(){return!1}get hasChildren(){return this._fileMatches.size>0||this._folderMatches.size>0}bindModel(e){let t=this._fileMatches.get(e.uri);t?t.bindModel(e):this.getFolderMatch(e.uri)?.getDownstreamFileMatch(e.uri)?.bindModel(e)}createIntermediateFolderMatch(e,t,o,n,r){let s=this._register(this.instantiationService.createInstance(mNe,e,t,o,n,this,this._searchResult,r));return this.configureIntermediateMatch(s),this.doAddFolder(s),s}configureIntermediateMatch(e){let t=e.onChange(o=>this.onFolderChange(e,o));this._register(e.onDispose(()=>t.dispose()))}clear(e=!1){let t=this.allDownstreamFileMatches();this.disposeMatches(),this._onChange.fire({elements:t,removed:!0,added:!1,clearingAll:e})}remove(e){Array.isArray(e)||(e=[e]);let t=Jtt(e);this.doRemoveFile(t)}async replace(e){return this.replaceService.replace([e]).then(()=>{this.doRemoveFile([e],!0,!0,!0)})}replaceAll(){let e=this.matches();return this.batchReplace(e)}matches(){return[...this.fileMatchesIterator(),...this.folderMatchesIterator()]}fileMatchesIterator(){return this._fileMatches.values()}folderMatchesIterator(){return this._folderMatches.values()}isEmpty(){return this.fileCount()+this.folderCount()===0}getDownstreamFileMatch(e){let t=this._fileMatches.get(e);if(t)return t;let n=this.getFolderMatch(e)?.getDownstreamFileMatch(e);return n||null}allDownstreamFileMatches(){let e=[],t=this.folderMatchesIterator();for(let o of t)e=e.concat(o.allDownstreamFileMatches());return[...this.fileMatchesIterator(),...e]}fileCount(){return this._fileMatches.size}folderCount(){return this._folderMatches.size}count(){return this.fileCount()+this.folderCount()}recursiveFileCount(){return this.allDownstreamFileMatches().length}recursiveMatchCount(){return this.allDownstreamFileMatches().reduce((e,t)=>e+t.count(),0)}get query(){return this._query}doAddFile(e){this._fileMatches.set(e.resource,e),this._unDisposedFileMatches.delete(e.resource)}hasOnlyReadOnlyMatches(){return Array.from(this._fileMatches.values()).every(e=>e.hasOnlyReadOnlyMatches())}uriHasParent(e,t){return this.uriIdentityService.extUri.isEqualOrParent(t,e)&&!this.uriIdentityService.extUri.isEqual(t,e)}isInParentChain(e){let t=this;for(;t instanceof Pte;){if(t.id()===e.id())return!0;t=t.parent()}return!1}getFolderMatch(e){return this._folderMatchesMap.findSubstr(e)}doAddFolder(e){if(this.resource&&!this.uriHasParent(this.resource,e.resource))throw Error(`${e.resource} does not belong as a child of ${this.resource}`);if(this.isInParentChain(e))throw Error(`${e.resource} is a parent of ${this.resource}`);this._folderMatches.set(e.resource,e),this._folderMatchesMap.set(e.resource,e),this._unDisposedFolderMatches.delete(e.resource)}async batchReplace(e){let t=Jtt(e);await this.replaceService.replace(t),this.doRemoveFile(t,!0,!0,!0)}onFileChange(e,t=!1){let o=!1;this._fileMatches.has(e.resource)||(this.doAddFile(e),o=!0),e.count()===0&&(this.doRemoveFile([e],!1,!1),o=!1,t=!0),this._replacingAll||this._onChange.fire({elements:[e],added:o,removed:t})}onFolderChange(e,t){this._folderMatches.has(e.resource)||this.doAddFolder(e),e.isEmpty()&&(this._folderMatches.delete(e.resource),e.dispose()),this._onChange.fire(t)}doRemoveFile(e,t=!0,o=!0,n=!1){let r=[];for(let s of e)if(this._fileMatches.get(s.resource)){if(n&&s.hasReadonlyMatches())continue;this._fileMatches.delete(s.resource),t?s.dispose():this._unDisposedFileMatches.set(s.resource,s),r.push(s)}else{let l=this.getFolderMatch(s.resource);if(l)l.doRemoveFile([s],t,o);else throw Error(`FileMatch ${s.resource} is not located within FolderMatch ${this.resource}`)}o&&this._onChange.fire({elements:r,removed:!0})}async bindNotebookEditorWidget(e,t){let o=this._fileMatches.get(t);if(Dte(o))if(o)o.bindNotebookEditorWidget(e),await o.updateMatchesForEditorWidget();else{let n=this.folderMatchesIterator();for(let r of n)await r.bindNotebookEditorWidget(e,t)}}addFileMatch(e,t,o){let n=[],r=[];e.forEach(l=>{let c=this.getDownstreamFileMatch(l.resource);if(c)l.results&&l.results.filter(ZO).forEach(u=>{X3(u,c,!1).forEach(p=>c.add(p))}),(qUt(l)||GUt(l))&&l.cellResults?.forEach(u=>{if(Dte(c)){let p=c.getCellMatch(Xho(u));p?(p.addContentMatches(u.contentResults),p.addWebviewMatches(u.webviewResults)):c.addCellMatch(u)}}),r.push(c),l.results&&l.results.length>0&&c.addContext(l.results);else if(_2(this)||p0(this)){let u=this.createAndConfigureFileMatch(l,o);n.push(u)}});let s=[...n,...r];!t&&s.length&&this._onChange.fire({elements:s,added:!!n.length})}unbindNotebookEditorWidget(e,t){let o=this._fileMatches.get(t);if(Dte(o))if(o)o.unbindNotebookEditorWidget(e);else{let n=this.folderMatchesIterator();for(let r of n)r.unbindNotebookEditorWidget(e,t)}}disposeMatches(){[...this._fileMatches.values()].forEach(e=>e.dispose()),[...this._folderMatches.values()].forEach(e=>e.disposeMatches()),[...this._unDisposedFileMatches.values()].forEach(e=>e.dispose()),[...this._unDisposedFolderMatches.values()].forEach(e=>e.disposeMatches()),this._fileMatches.clear(),this._folderMatches.clear(),this._unDisposedFileMatches.clear(),this._unDisposedFolderMatches.clear()}dispose(){this.disposeMatches(),this._onDispose.fire(),super.dispose()}};Pte=I([m(7,fI),m(8,F),m(9,ot),m(10,dt)],Pte);var mNe=class extends Pte{constructor(i,e,t,o,n,r,s,l,c,u,p){super(i,e,t,o,n,r,s,l,c,u,p),this._normalizedResource=new co(()=>this.uriIdentityService.extUri.removeTrailingPathSeparator(this.uriIdentityService.extUri.normalizePath(this.resource)))}get resource(){return this._resource}get normalizedResource(){return this._normalizedResource.value}};mNe=I([m(7,fI),m(8,F),m(9,ot),m(10,dt)],mNe);var hNe=class extends mNe{constructor(i,e,t,o,n,r,s,l,c){super(i,e,t,o,n,n.parent(),null,r,s,l,c)}normalizedUriParent(i){return this.uriIdentityService.extUri.normalizePath(this.uriIdentityService.extUri.dirname(i))}uriEquals(i,e){return this.uriIdentityService.extUri.isEqual(i,e)}createFileMatch(i,e,t,o,n,r,s){let l=this.instantiationService.createInstance(lhe,i,e,t,o,n,r,s);l.createMatches(),o.doAddFile(l);let c=l.onChange(({didRemove:u})=>o.onFileChange(l,u));return this._register(l.onDispose(()=>c.dispose())),l}createAndConfigureFileMatch(i,e){if(!this.uriHasParent(this.resource,i.resource))throw Error(`${i.resource} is not a descendant of ${this.resource}`);let t=[],o=this.normalizedUriParent(i.resource);for(;!this.uriEquals(this.normalizedResource,o);){t.unshift(o);let l=o;if(o=this.uriIdentityService.extUri.removeTrailingPathSeparator(this.normalizedUriParent(o)),this.uriEquals(l,o))throw Error(`${i.resource} is not correctly configured as a child of ${this.normalizedResource}`)}let n=this.closestRoot??this,r=this;for(let l=0;l<t.length;l++){let c=r.getFolderMatch(t[l]);c||(c=r.createIntermediateFolderMatch(t[l],t[l].toString(),-1,this._query,n)),r=c}let s=typeof this._query.contentPattern=="string"?{pattern:this._query.contentPattern}:this._query.contentPattern;return this.createFileMatch(s,this._query.previewOptions,this._query.maxResults,r,i,n,e)}};hNe=I([m(5,fI),m(6,F),m(7,ot),m(8,dt)],hNe);var gNe=class extends Pte{constructor(i,e,t,o,n,r,s,l){super(null,i,e,t,o,o.parent(),null,n,r,s,l)}createAndConfigureFileMatch(i,e){let t=typeof this._query.contentPattern=="string"?{pattern:this._query.contentPattern}:this._query.contentPattern,o=this._register(this.instantiationService.createInstance(lhe,t,this._query.previewOptions,this._query.maxResults,this,i,null,e));o.createMatches(),this.doAddFile(o);let n=o.onChange(({didRemove:r})=>this.onFileChange(o,r));return this._register(o.onDispose(()=>n.dispose())),o}};gNe=I([m(4,fI),m(5,F),m(6,ot),m(7,dt)],gNe);var che=class extends C{constructor(e,t,o,n){super();this._allowOtherResults=e;this._parent=t;this.instantiationService=o;this.uriIdentityService=n;this._onChange=this._register(new E);this.onChange=this._onChange.event;this._isDirty=!1;this._showHighlights=!1;this._query=null;this.disposePastResults=()=>Promise.resolve();this._folderMatches=[];this._otherFilesMatch=null;this._folderMatchesMap=Yu.forUris(e=>this.uriIdentityService.extUri.ignorePathCasing(e));this.resource=null;this.hidden=!1;this._rangeHighlightDecorations=this.instantiationService.createInstance(Rte),this._register(this.onChange(r=>{r.removed&&(this._isDirty=!this.isEmpty())}))}hide(){this.hidden=!0,this.clear()}parent(){return this._parent}get hasChildren(){return this._folderMatches.length>0}get isDirty(){return this._isDirty}getFolderMatch(e){let t=this._folderMatchesMap.findSubstr(e);return!t&&this._allowOtherResults&&this._otherFilesMatch?this._otherFilesMatch:t}add(e,t,o=!1){let{byFolder:n,other:r}=this.groupFilesByFolder(e);n.forEach(s=>{if(!s.length)return;this.getFolderMatch(s[0].resource)?.addFileMatch(s,o,t)}),this.isAIContributed||this._otherFilesMatch?.addFileMatch(r,o,t),this.disposePastResults()}remove(e,t=!1){Array.isArray(e)||(e=[e]),e.forEach(s=>{bd(s)&&s.clear()});let o=e.filter(s=>fl(s)),{byFolder:n,other:r}=this.groupFilesByFolder(o);n.forEach(s=>{s.length&&this.getFolderMatch(s[0].resource)?.remove(s)}),r.length&&this.getFolderMatch(r[0].resource)?.remove(r)}groupFilesByFolder(e){let t=new vt,o=[];return this._folderMatches.forEach(n=>t.set(n.resource,[])),e.forEach(n=>{let r=this.getFolderMatch(n.resource);if(!r)return;let s=r.resource;s?t.get(s).push(n):o.push(n)}),{byFolder:t,other:o}}isEmpty(){return this.folderMatches().every(e=>e.isEmpty())}findFolderSubstr(e){return this._folderMatchesMap.findSubstr(e)}clearQuery(){let e=this.folderMatches();this.disposePastResults=async()=>{e.forEach(t=>t.clear()),e.forEach(t=>t.dispose()),this._isDirty=!1},this.cachedSearchComplete=void 0,this._rangeHighlightDecorations.removeHighlightRange(),this._folderMatchesMap=Yu.forUris(t=>this.uriIdentityService.extUri.ignorePathCasing(t))}folderMatches(){return this._otherFilesMatch&&this._allowOtherResults?[...this._folderMatches,this._otherFilesMatch]:this._folderMatches}disposeMatches(){this.folderMatches().forEach(e=>e.dispose()),this._folderMatches=[],this._folderMatchesMap=Yu.forUris(e=>this.uriIdentityService.extUri.ignorePathCasing(e)),this._rangeHighlightDecorations.removeHighlightRange()}matches(){let e=[];return this.folderMatches().forEach(t=>{e.push(t.allDownstreamFileMatches())}),[].concat(...e)}get showHighlights(){return this._showHighlights}toggleHighlights(e){if(this._showHighlights===e)return;this._showHighlights=e;let t=null;this.matches().forEach(o=>{o.updateHighlights(),Dte(o)&&o.updateNotebookHighlights(),t||(t=o.getSelectedMatch())}),this._showHighlights&&t?this._rangeHighlightDecorations.highlightRange(t.parent().resource,t.range()):this._rangeHighlightDecorations.removeHighlightRange()}get rangeHighlightDecorations(){return this._rangeHighlightDecorations}fileCount(){return this.folderMatches().reduce((e,t)=>e+t.recursiveFileCount(),0)}count(){return this.matches().reduce((e,t)=>e+t.count(),0)}clear(e=!0){this.cachedSearchComplete=void 0,this.folderMatches().forEach(t=>t.clear(e)),this.disposeMatches(),this._folderMatches=[],this._otherFilesMatch=null}async dispose(){this._rangeHighlightDecorations.dispose(),this.disposeMatches(),super.dispose(),await this.disposePastResults()}};che=I([m(2,F),m(3,dt)],che);var fNe=class extends che{constructor(e,t,o,n){super(!0,e,t,o);this.replaceService=n}id(){return eNe+Eho}get isAIContributed(){return!1}replace(e){return this.getFolderMatch(e.resource)?.replace(e)??Promise.resolve()}name(){return"Text"}replaceAll(e){return this.replacingAll=!0,this.replaceService.replace(this.matches(),e).then(()=>{this.replacingAll=!1,this.clear()},()=>{this.replacingAll=!1})}set replacingAll(e){this.folderMatches().forEach(t=>{t.replacingAll=e})}get query(){return this._query}set query(e){this.clearQuery(),e&&(this._folderMatches=(e&&e.folderQueries||[]).map(t=>t.folder).map((t,o)=>this._createBaseFolderMatch(t,t.toString(),o,e)),this._folderMatches.forEach(t=>this._folderMatchesMap.set(t.resource,t)),this._otherFilesMatch=this._createBaseFolderMatch(null,"otherFiles",this._folderMatches.length+1,e),this._query=e)}_createBaseFolderMatch(e,t,o,n){let r;e?r=this._register(this.createWorkspaceRootWithResourceImpl(e,t,o,n)):r=this._register(this.createNoRootWorkspaceImpl(t,o,n));let s=r.onChange(l=>this._onChange.fire(l));return this._register(r.onDispose(()=>s.dispose())),r}createWorkspaceRootWithResourceImpl(e,t,o,n){return this.instantiationService.createInstance(hNe,e,t,o,n,this)}createNoRootWorkspaceImpl(e,t,o){return this._register(this.instantiationService.createInstance(gNe,e,t,o,this))}};fNe=I([m(1,F),m(2,dt),m(3,fI)],fNe);var J3=class extends che{constructor(i,e,t){super(!1,i,e,t),this.hidden=!0}name(){return"AI"}id(){return eNe+Tho}get isAIContributed(){return!0}get query(){return this._query}set query(i){this.clearQuery(),i&&(this._folderMatches=(i&&i.folderQueries||[]).map(e=>e.folder).map((e,t)=>this._createBaseFolderMatch(e,e.toString(),t,i)),this._folderMatches.forEach(e=>this._folderMatchesMap.set(e.resource,e)),this._query=i)}fileCount(){let i=new Mn;for(let e of this.folderMatches())if(!e.isEmpty())for(let t of e.allDownstreamFileMatches())i.add(t.resource);return i.size}_createBaseFolderMatch(i,e,t,o){let n=this._register(this.createWorkspaceRootWithResourceImpl(i,e,t,o)),r=n.onChange(s=>this._onChange.fire(s));return this._register(n.onDispose(()=>r.dispose())),n}createWorkspaceRootWithResourceImpl(i,e,t,o){return this.instantiationService.createInstance(dhe,i,e,t,o,this)}};J3=I([m(1,F),m(2,dt)],J3);var dhe=class extends C{constructor(e,t,o,n,r,s,l){super();this._resource=e;this._index=o;this._query=n;this._parent=r;this.instantiationService=s;this._onChange=this._register(new E);this.onChange=this._onChange.event;this._onDispose=this._register(new E);this.onDispose=this._onDispose.event;this.latestRank=0;this.replacingAll=!1;this._fileMatches=new Map,this._id=Qtt+t,this._name=new co(()=>this.resource?l.getUriBasenameLabel(this.resource):""),this._unDisposedFileMatches=new Map}get resource(){return this._resource}id(){return this._id}index(){return this._index}name(){return this._name.value}count(){return this._fileMatches.size}doAddFile(e){this._fileMatches.set(e.id(),e)}createAndConfigureFileMatch(e,t){let o=this.instantiationService.createInstance(lit,this._query.contentPattern,this._query.previewOptions,this._query.maxResults,this,e,this,e.resource.toString()+"_"+Date.now().toString(),this.latestRank++);o.createMatches(),this.doAddFile(o);let n=o.onChange(({didRemove:r})=>this.onFileChange(o,r));return this._register(o.onDispose(()=>n.dispose())),o}isAIContributed(){return!0}onFileChange(e,t=!1){let o=!1;this._fileMatches.has(e.id())||(this.doAddFile(e),o=!0),e.count()===0&&(this.doRemoveFile([e],!1,!1),o=!1,t=!0),this._onChange.fire({elements:[e],added:o,removed:t})}get hasChildren(){return this._fileMatches.size>0}parent(){return this._parent}matches(){return[...this._fileMatches.values()]}allDownstreamFileMatches(){return[...this._fileMatches.values()]}remove(e){Array.isArray(e)||(e=[e]);let t=Jtt(e);this.doRemoveFile(t)}addFileMatch(e,t,o){let n=[],r=[];e.forEach(l=>{let c=this.createAndConfigureFileMatch(l,o);n.push(c)});let s=[...n,...r];!t&&s.length&&this._onChange.fire({elements:s,added:!!n.length})}isEmpty(){return this.recursiveFileCount()===0}clear(e){let t=this.allDownstreamFileMatches();t.length>0&&(this.disposeMatches(),this._onChange.fire({elements:t,removed:!0,added:!1,clearingAll:e}))}get showHighlights(){return this._parent.showHighlights}get searchModel(){return this._searchResult.searchModel}get _searchResult(){return this._parent.parent()}get query(){return this._query}getDownstreamFileMatch(e){for(let t of this._fileMatches.values())if(t.resource.toString()===e.toString())return t;return null}replaceAll(){throw new Error("Cannot replace in AI search")}recursiveFileCount(){return this._fileMatches.size}doRemoveFile(e,t=!0,o=!0,n=!1){let r=[];for(let s of e)if(this._fileMatches.get(s.id())){if(n&&s.hasReadonlyMatches())continue;this._fileMatches.delete(s.id()),t?s.dispose():this._unDisposedFileMatches.set(s.id(),s),r.push(s)}o&&this._onChange.fire({elements:r,removed:!0})}replace(e){throw new Error("Cannot replace in AI search")}bindModel(e){}unbindNotebookEditorWidget(e,t){}bindNotebookEditorWidget(e,t){return Promise.resolve()}hasOnlyReadOnlyMatches(){return Array.from(this._fileMatches.values()).every(e=>e.hasOnlyReadOnlyMatches())}fileMatchesIterator(){return this._fileMatches.values()}folderMatchesIterator(){return[].values()}recursiveMatchCount(){return this._fileMatches.size}disposeMatches(){[...this._fileMatches.values()].forEach(e=>e.dispose()),[...this._unDisposedFileMatches.values()].forEach(e=>e.dispose()),this._fileMatches.clear()}dispose(){this.disposeMatches(),this._onDispose.fire(),super.dispose()}};dhe=I([m(5,F),m(6,ot)],dhe);var lit=class extends m0{constructor(e,t,o,n,r,s,l,c,u,p,h){super({pattern:e},t,o,n,r,s,u,p,h);this._id=l;this.rank=c}id(){return Ytt+this._id}getFullRange(){let e,t;for(let o of this.matches()){let n=o.range().getStartPosition(),r=o.range().getEndPosition();(e===void 0||n.isBefore(e))&&(e=n),t===void 0?t=r:r.isBefore(t)||(t=r)}if(!(e===void 0||t===void 0))return new z(e.lineNumber,e.column,t.lineNumber,t.column)}rangeAsString(){let e=this.getFullRange();if(e)return e.startLineNumber+":"+e.startColumn+"-"+e.endLineNumber+":"+e.endColumn}name(){let e=this.rangeAsString();return super.name()+e?" "+e:""}createMatches(){this.rawMatch.results&&this.rawMatch.results.filter(ZO).forEach(e=>{X3(e,this,!0).forEach(t=>this.add(t))})}};lit=I([m(8,Ct),m(9,fI),m(10,ot)],lit);W(class extends K{constructor(){super({id:"search.action.clearHistory",title:L(13342,"Clear Search History"),category:vl,f1:!0})}async run(i){qYo(i)}});W(class extends K{constructor(){super({id:"search.action.cancel",title:L(13341,"Cancel Search"),icon:Cho,category:vl,f1:!0,precondition:pEe.isEqualTo(0).negate(),keybinding:{weight:200,when:x.and(Ci.SearchViewVisibleKey,rc),primary:9},menu:[{id:D.ViewTitle,group:"navigation",order:0,when:x.and(x.equals("view",ny),pEe.isEqualTo(2))}]})}run(i){return YYo(i)}});W(class extends K{constructor(){super({id:"search.action.refreshSearchResults",title:L(13346,"Refresh"),icon:MUt,precondition:Ci.ViewHasSearchPatternKey,category:vl,f1:!0,menu:[{id:D.ViewTitle,group:"navigation",order:0,when:x.and(x.equals("view",ny),pEe.isEqualTo(2).negate())}]})}run(i,...e){return XYo(i)}});W(class extends K{constructor(){super({id:"search.action.collapseSearchResults",title:L(13344,"Collapse All"),category:vl,icon:bho,f1:!0,precondition:x.and(Ci.HasSearchResults,Ci.ViewHasSomeCollapsibleKey),menu:[{id:D.ViewTitle,group:"navigation",order:4,when:x.and(x.equals("view",ny),x.or(Ci.HasSearchResults.negate(),Ci.ViewHasSomeCollapsibleKey))}]})}run(i,...e){return JYo(i)}});W(class extends K{constructor(){super({id:"search.action.expandSearchResults",title:L(13345,"Expand All"),category:vl,icon:Sho,f1:!0,precondition:x.and(Ci.HasSearchResults,Ci.ViewHasSomeCollapsibleKey.toNegated()),menu:[{id:D.ViewTitle,group:"navigation",order:4,when:x.and(x.equals("view",ny),Ci.HasSearchResults,Ci.ViewHasSomeCollapsibleKey.toNegated())}]})}async run(i,...e){return jYo(i)}});W(class extends K{constructor(){super({id:"search.action.clearSearchResults",title:L(13343,"Clear Search Results"),category:vl,icon:who,f1:!0,precondition:x.or(Ci.HasSearchResults,Ci.ViewHasSearchPatternKey,Ci.ViewHasReplacePatternKey,Ci.ViewHasFilePatternKey),menu:[{id:D.ViewTitle,group:"navigation",order:1,when:x.equals("view",ny)}]})}run(i,...e){return QYo(i)}});W(class extends K{constructor(){super({id:"search.action.viewAsTree",title:L(13349,"View as Tree"),category:vl,icon:yho,f1:!0,precondition:x.and(Ci.HasSearchResults,Ci.InTreeViewKey.toNegated()),menu:[{id:D.ViewTitle,group:"navigation",order:2,when:x.and(x.equals("view",ny),Ci.InTreeViewKey.toNegated())}]})}async run(i,...e){let t=Pc(i.get(Ft));t&&await t.setTreeView(!0)}});W(class extends K{constructor(){super({id:"search.action.viewAsList",title:L(13348,"View as List"),category:vl,icon:Iho,f1:!0,precondition:x.and(Ci.HasSearchResults,Ci.InTreeViewKey),menu:[{id:D.ViewTitle,group:"navigation",order:2,when:x.and(x.equals("view",ny),Ci.InTreeViewKey)}]})}async run(i,...e){let t=Pc(i.get(Ft));t&&await t.setTreeView(!1)}});W(class extends K{constructor(){super({id:"search.action.searchWithAI",title:L(13347,"Search with AI"),category:vl,f1:!0,precondition:Ci.hasAIResultProvider,keybinding:{weight:200,when:x.and(Ci.hasAIResultProvider,Ci.SearchViewFocusedKey),primary:2087}})}async run(i,...e){let t=Pc(i.get(Ft));t&&t.requestAIResults()}});var qYo=a=>{a.get(aNe).clearHistory()};async function jYo(a){let i=a.get(Ft),e=Pc(i);if(e){let t=e.getControl();await vNe(t,void 0)}}async function vNe(a,i){if(i){if(!a.hasNode(i))return;await a.expand(i,!0)}let e=a.getNode(i)?.children;if(e)for(let t of e){if(wA(t.element))throw Error("SearchResult should not be a child of a RenderableMatch");vNe(a,t.element)}}function QYo(a){let i=a.get(Ft);Pc(i)?.clearSearchResults()}function YYo(a){let i=a.get(Ft);Pc(i)?.cancelSearch()}function XYo(a){let i=a.get(Ft),e=Pc(i);e?.triggerQueryChange({preserveFocus:!1,shouldUpdateAISearch:!e.model.searchResult.aiTextSearchResult.hidden})}function JYo(a){let i=a.get(Ft),e=Pc(i);if(e){let t=e.getControl(),o=t.navigate(),n=o.first(),r=!1,s=!1;do n=o.next();while(jf(n));if(_2(n)||e.isTreeLayoutViewVisible){for(;n=o.next();)if(!jf(n)){if(Ka(n)){r=!0;break}if(e.isTreeLayoutViewVisible&&!s){let c=n;if(bd(n)){let p=t.getCompressedTreeNode(n)?.elements[0].element;c=p&&!Ka(p)&&!jf(p)&&!wA(p)?p:n}let u=c.parent();jf(u)||_2(u)||p0(u)||wA(u)||(s=!0)}}}if(r){n=o.first();do fl(n)&&t.collapse(n);while(n=o.next())}else if(s){if(n=o.first(),n)do{let c=n;if(bd(n)){let p=t.getCompressedTreeNode(n)?.elements[0].element;c=p&&!Ka(p)&&!wA(p)?p:n}let u=c.parent();(_2(u)||p0(u))&&(t.hasNode(n)?t.collapse(n,!0):t.collapseAll())}while(n=o.next())}else if(jf(o.first())){n=o.first();do{if(!n)break;jf(t.getParentElement(n))&&t.collapse(n)}while(n=o.next())}else t.collapseAll();let l=t.getFocus()[0]?.parent();l&&(bd(l)||fl(l))&&t.hasNode(l)&&t.isCollapsed(l)&&(t.domFocus(),t.focusFirst(),t.setSelection(t.getFocus()))}}var ID=_;var Zho=d(13440,null),ego=75,D2=class extends zr{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,k,T,N,O,V,U,G,$,te,pe,de,se){super(e,V,N,g,b,h,p,G,k,$);this.fileService=t;this.editorService=o;this.codeEditorService=n;this.progressService=r;this.notificationService=s;this.dialogService=l;this.commandService=c;this.contextViewService=u;this.contextService=f;this.searchViewModelWorkbenchService=v;this.replaceService=S;this.textFileService=y;this.preferencesService=w;this.searchHistoryService=T;this.accessibilityService=O;this.storageService=U;this.notebookService=te;this.logService=pe;this.accessibilitySignalService=de;this.telemetryService=se;this.isDisposed=!1;this.lastFocusState="input";this.messageDisposables=new P;this.currentEditorCursorListener=this._register(new me);this.currentSearchQ=Promise.resolve();this.pauseSearching=!1;this._visibleMatches=0;this._cachedKeywords=[];this.container=_(".search-view"),this.viewletVisible=Ci.SearchViewVisibleKey.bindTo(this.contextKeyService),this.firstMatchFocused=Ci.FirstMatchFocusKey.bindTo(this.contextKeyService),this.fileMatchOrMatchFocused=Ci.FileMatchOrMatchFocusKey.bindTo(this.contextKeyService),this.fileMatchOrFolderMatchFocus=Ci.FileMatchOrFolderMatchFocusKey.bindTo(this.contextKeyService),this.fileMatchOrFolderMatchWithResourceFocus=Ci.FileMatchOrFolderMatchWithResourceFocusKey.bindTo(this.contextKeyService),this.fileMatchFocused=Ci.FileFocusKey.bindTo(this.contextKeyService),this.folderMatchFocused=Ci.FolderFocusKey.bindTo(this.contextKeyService),this.folderMatchWithResourceFocused=Ci.ResourceFolderFocusKey.bindTo(this.contextKeyService),this.searchResultHeaderFocused=Ci.SearchResultHeaderFocused.bindTo(this.contextKeyService),this.hasSearchResultsKey=Ci.HasSearchResults.bindTo(this.contextKeyService),this.matchFocused=Ci.MatchFocusKey.bindTo(this.contextKeyService),this.searchStateKey=pEe.bindTo(this.contextKeyService),this.hasSearchPatternKey=Ci.ViewHasSearchPatternKey.bindTo(this.contextKeyService),this.hasReplacePatternKey=Ci.ViewHasReplacePatternKey.bindTo(this.contextKeyService),this.hasFilePatternKey=Ci.ViewHasFilePatternKey.bindTo(this.contextKeyService),this.hasSomeCollapsibleResultKey=Ci.ViewHasSomeCollapsibleKey.bindTo(this.contextKeyService),this.treeViewKey=Ci.InTreeViewKey.bindTo(this.contextKeyService),this.refreshTreeController=this._register(this.instantiationService.createInstance(dit,this,()=>this.searchConfig)),this._register(this.contextKeyService.onDidChangeContext(Se=>{let ke=Ci.hasAIResultProvider.keys();Se.affectsSome(new Set(ke))&&this.refreshHasAISetting()})),this.contextKeyService=this._register(this.contextKeyService.createScoped(this.container)),Ci.SearchViewFocusedKey.bindTo(this.contextKeyService).set(!0),this.inputBoxFocused=Ci.InputBoxFocusedKey.bindTo(this.contextKeyService),this.inputPatternIncludesFocused=Ci.PatternIncludesFocusedKey.bindTo(this.contextKeyService),this.inputPatternExclusionsFocused=Ci.PatternExcludesFocusedKey.bindTo(this.contextKeyService),this.isEditableItem=Ci.IsEditableItemKey.bindTo(this.contextKeyService),this.instantiationService=this._register(this.instantiationService.createChild(new Io([X,this.contextKeyService]))),this._register(this.configurationService.onDidChangeConfiguration(async Se=>{Se.affectsConfiguration("search.sortOrder")&&(this.searchConfig.sortOrder==="modified"&&this.removeFileStats(),await this.refreshTreeController.queue())})),this.viewModel=this.searchViewModelWorkbenchService.searchModel,this.queryBuilder=this.instantiationService.createInstance(aS),this.memento=new Bl(this.id,U),this.viewletState=this.memento.getMemento(1,1),this._register(this.fileService.onDidFilesChange(Se=>this.onFilesChanged(Se))),this._register(this.textFileService.untitled.onWillDispose(Se=>this.onUntitledDidDispose(Se.resource))),this._register(this.contextService.onDidChangeWorkbenchState(()=>this.onDidChangeWorkbenchState())),this._register(this.searchHistoryService.onDidClearHistory(()=>this.clearHistory())),this._register(this.configurationService.onDidChangeConfiguration(Se=>this.onConfigurationUpdated(Se))),this.delayedRefresh=this._register(new jo(250)),this.addToSearchHistoryDelayer=this._register(new jo(2e3)),this.toggleCollapseStateDelayer=this._register(new jo(100)),this.triggerQueryDelayer=this._register(new jo(0)),this.treeAccessibilityProvider=this.instantiationService.createInstance(tNe,this),this.isTreeLayoutViewVisible=this.viewletState.view?.treeLayout??this.searchConfig.defaultViewMode==="tree",this._refreshResultsScheduler=this._register(new Dt(this._updateResults.bind(this),80)),this._register(this.storageService.onWillSaveState(()=>{this._saveSearchHistoryService()})),this._register(this.storageService.onDidChangeValue(1,xA.SEARCH_HISTORY_KEY,this._store)(()=>{let Se=this.searchHistoryService.load();Se.include&&this.inputPatternIncludes.prependHistory(Se.include),Se.exclude&&this.inputPatternExcludes.prependHistory(Se.exclude),Se.search&&this.searchWidget.prependSearchHistory(Se.search),Se.replace&&this.searchWidget.prependReplaceHistory(Se.replace)})),this.changedWhileHidden=this.hasSearchResults()}static{this.ACTIONS_RIGHT_CLASS_NAME="actions-right"}get cachedResults(){return this._cachedResults}async queueRefreshTree(){return this.refreshTreeController.queue()}get isTreeLayoutViewVisible(){return this.treeViewKey.get()??!1}set isTreeLayoutViewVisible(e){this.treeViewKey.set(e)}async setTreeView(e){if(e!==this.isTreeLayoutViewVisible)return this.isTreeLayoutViewVisible=e,this.updateIndentStyles(this.themeService.getFileIconTheme()),this.refreshTreeController.queue()}get state(){return this.searchStateKey.get()??0}set state(e){this.searchStateKey.set(e)}getContainer(){return this.container}get searchResult(){return this.viewModel&&this.viewModel.searchResult}get model(){return this.viewModel}async refreshHasAISetting(){let e=this.shouldShowAIResults();if(!(!this.tree||!this.tree.hasNode(this.searchResult))){if(e&&!this.tree.hasNode(this.searchResult.aiTextSearchResult)){if(this.model.searchResult.getCachedSearchComplete(!1))return this.refreshAndUpdateCount()}else if(!e&&this.tree.hasNode(this.searchResult.aiTextSearchResult))return this.refreshAndUpdateCount()}}onDidChangeWorkbenchState(){this.contextService.getWorkbenchState()!==1&&this.searchWithoutFolderMessageElement&&xo(this.searchWithoutFolderMessageElement)}refreshInputs(){this.pauseSearching=!0,this.searchWidget.setValue(this.viewModel.searchResult.query?.contentPattern.pattern??""),this.searchWidget.setReplaceAllActionState(!1),this.searchWidget.toggleReplace(!0),this.inputPatternIncludes.setOnlySearchInOpenEditors(this.viewModel.searchResult.query?.onlyOpenEditors||!1),this.inputPatternExcludes.setUseExcludesAndIgnoreFiles(!this.viewModel.searchResult.query?.userDisabledExcludesAndIgnoreFiles||!0),this.searchIncludePattern.setValue(""),this.searchExcludePattern.setValue(""),this.pauseSearching=!1}async replaceSearchModel(e,t){let o;this.progressService.withProgress({location:this.getProgressLocation(),delay:0},r=>new Promise(s=>o=s));let n=setTimeout(()=>{this.state=2},2e3);this._refreshResultsScheduler.schedule(),e.location=0,e.replaceActive=this.viewModel.isReplaceActive(),e.replaceString=this.searchWidget.getReplaceValue(),this._onSearchResultChangedDisposable?.dispose(),this._onSearchResultChangedDisposable=this._register(e.onSearchResultChanged(async r=>this.onSearchResultsChanged(r))),this.searchViewModelWorkbenchService.searchModel=e,this.viewModel=e,this.tree.setInput(this.viewModel.searchResult),await this.onSearchResultsChanged(),this.refreshInputs(),t.then(r=>(clearTimeout(n),this.onSearchComplete(o,void 0,void 0,r)),r=>(clearTimeout(n),this.onSearchError(r,o,void 0,void 0))),await this.expandIfSingularResult()}renderBody(e){super.renderBody(e),this.container=R(e,_(".search-view")),this.searchWidgetsContainerElement=R(this.container,ID(".search-widgets-container")),this.createSearchWidget(this.searchWidgetsContainerElement);let t=this.searchHistoryService.load(),o=this.viewletState.query?.filePatterns||"",n=this.viewletState.query?.folderExclusions||"",r=t.exclude||[],s=this.viewletState.query?.folderIncludes||"",l=t.include||[],c=this.viewletState.query?.onlyOpenEditors||!1,u=this.viewletState.query?.queryDetailsExpanded||"",p=typeof this.viewletState.query?.useExcludesAndIgnoreFiles=="boolean"?this.viewletState.query.useExcludesAndIgnoreFiles:!0;this.queryDetails=R(this.searchWidgetsContainerElement,ID(".query-details"));let h=d(13399,null);this.toggleQueryDetailsButton=R(this.queryDetails,ID(".more"+q.asCSSSelector(she),{tabindex:0,role:"button","aria-label":h})),this._register(this.hoverService.setupManagedHover(Ni("element"),this.toggleQueryDetailsButton,h)),this._register(j(this.toggleQueryDetailsButton,re.CLICK,w=>{$t.stop(w),this.toggleQueryDetails(!this.accessibilityService.isScreenReaderOptimized())})),this._register(j(this.toggleQueryDetailsButton,re.KEY_UP,w=>{let k=new Ii(w);(k.equals(3)||k.equals(10))&&($t.stop(w),this.toggleQueryDetails(!1))})),this._register(j(this.toggleQueryDetailsButton,re.KEY_DOWN,w=>{new Ii(w).equals(1026)&&(this.searchWidget.isReplaceActive()?this.searchWidget.focusReplaceAllAction():this.searchWidget.isReplaceShown()?this.searchWidget.replaceInput?.focusOnPreserve():this.searchWidget.focusRegexAction(),$t.stop(w))}));let g=R(this.queryDetails,ID(".file-types.includes")),f=d(13444,null);R(g,ID("h4",void 0,f)),this.inputPatternIncludes=this._register(this.instantiationService.createInstance(Tte,g,this.contextViewService,{ariaLabel:f,placeholder:d(13415,null),showPlaceholderOnFocus:!0,history:l,inputBoxStyles:pl})),this.inputPatternIncludes.setValue(s),this.inputPatternIncludes.setOnlySearchInOpenEditors(c),this._register(this.inputPatternIncludes.onCancel(()=>this.cancelSearch(!1))),this._register(this.inputPatternIncludes.onChangeSearchInEditorsBox(()=>this.triggerQueryChange())),this.trackInputBox(this.inputPatternIncludes.inputFocusTracker,this.inputPatternIncludesFocused);let v=R(this.queryDetails,ID(".file-types.excludes")),b=d(13443,null);R(v,ID("h4",void 0,b)),this.inputPatternExcludes=this._register(this.instantiationService.createInstance(_te,v,this.contextViewService,{ariaLabel:b,placeholder:d(13414,null),showPlaceholderOnFocus:!0,history:r,inputBoxStyles:pl})),this.inputPatternExcludes.setValue(n),this.inputPatternExcludes.setUseExcludesAndIgnoreFiles(p),this._register(this.inputPatternExcludes.onCancel(()=>this.cancelSearch(!1))),this._register(this.inputPatternExcludes.onChangeIgnoreBox(()=>this.triggerQueryChange())),this.trackInputBox(this.inputPatternExcludes.inputFocusTracker,this.inputPatternExclusionsFocused);let S=()=>this.hasFilePatternKey.set(this.inputPatternIncludes.getValue().length>0||this.inputPatternExcludes.getValue().length>0);S();let y=w=>{this.triggerQueryChange({triggeredOnType:w,delay:this.searchConfig.searchOnTypeDebouncePeriod}),w&&S()};this._register(this.inputPatternIncludes.onSubmit(y)),this._register(this.inputPatternExcludes.onSubmit(y)),this.messagesElement=R(this.container,ID(".messages.text-search-provider-messages")),this.contextService.getWorkbenchState()===1&&this.showSearchWithoutFolderMessage(),this.createSearchResultsView(this.container),(o!==""||n!==""||s!==""||u!==""||!p)&&this.toggleQueryDetails(!0,!0,!0),this._onSearchResultChangedDisposable=this._register(this.viewModel.onSearchResultChanged(async w=>await this.onSearchResultsChanged(w))),this._onAIResultChangedDisposable?.dispose(),this._onAIResultChangedDisposable=this._register(this.viewModel.searchResult.aiTextSearchResult.onChange(w=>{this.tree&&this.tree.hasNode(this.searchResult.aiTextSearchResult)&&!w.removed&&this.tree.updateChildren(this.searchResult.aiTextSearchResult)})),this._register(this.onDidChangeBodyVisibility(w=>this.onVisibilityChanged(w))),this.updateIndentStyles(this.themeService.getFileIconTheme()),this._register(this.themeService.onDidFileIconThemeChange(this.updateIndentStyles,this))}updateIndentStyles(e){this.resultsElement.classList.toggle("hide-arrows",this.isTreeLayoutViewVisible&&e.hidesExplorerArrows)}async onVisibilityChanged(e){this.viewletVisible.set(e),e?this.changedWhileHidden&&(await this.refreshAndUpdateCount(),this.changedWhileHidden=!1):this.lastFocusState="input",this.viewModel?.searchResult.toggleHighlights(e)}get searchAndReplaceWidget(){return this.searchWidget}get searchIncludePattern(){return this.inputPatternIncludes}get searchExcludePattern(){return this.inputPatternExcludes}createSearchWidget(e){let t=this.viewletState.query?.contentPattern||"",o=this.viewletState.query?.replaceText||"",n=this.viewletState.query?.regex===!0,r=this.viewletState.query?.wholeWords===!0,s=this.viewletState.query?.caseSensitive===!0,l=this.searchHistoryService.load(),c=l.search||this.viewletState.query?.searchHistory||[],u=l.replace||this.viewletState.query?.replaceHistory||[],p=typeof this.viewletState.view?.showReplace=="boolean"?this.viewletState.view.showReplace:!0,h=this.viewletState.query?.preserveCase===!0,g=this.viewletState.query?.isInNotebookMarkdownInput??!0,f=this.viewletState.query?.isInNotebookMarkdownPreview??!0,v=this.viewletState.query?.isInNotebookCellInput??!0,b=this.viewletState.query?.isInNotebookCellOutput??!0;if(this.searchWidget=this._register(this.instantiationService.createInstance(jR,e,{value:t,replaceValue:o,isRegex:n,isCaseSensitive:s,isWholeWords:r,searchHistory:c,replaceHistory:u,preserveCase:h,inputBoxStyles:pl,toggleStyles:qg,notebookOptions:{isInNotebookMarkdownInput:g,isInNotebookMarkdownPreview:f,isInNotebookCellInput:v,isInNotebookCellOutput:b}})),!this.searchWidget.searchInput||!this.searchWidget.replaceInput){this.logService.warn(`Cannot fully create search widget. Search or replace input undefined. SearchInput: ${this.searchWidget.searchInput}, ReplaceInput: ${this.searchWidget.replaceInput}`);return}p&&this.searchWidget.toggleReplace(!0),this._register(this.searchWidget.onSearchSubmit(w=>{let k=this.configurationService.getValue("search").searchView.semanticSearchBehavior;k==="auto"&&this.logService.info("SearchView: Automatically rendering AI results"),this.triggerQueryChange({...w,shouldKeepAIResults:!1,shouldUpdateAISearch:k==="auto"})})),this._register(this.searchWidget.onSearchCancel(({focus:w})=>this.cancelSearch(w))),this._register(this.searchWidget.searchInput.onDidOptionChange(()=>{this.triggerQueryChange({shouldKeepAIResults:!0})})),this._register(this.searchWidget.getNotebookFilters().onDidChange(()=>this.triggerQueryChange({shouldKeepAIResults:!0})));let S=()=>this.hasSearchPatternKey.set(this.searchWidget.searchInput?this.searchWidget.searchInput.getValue().length>0:!1);S(),this._register(this.searchWidget.searchInput.onDidChange(()=>S()));let y=()=>this.hasReplacePatternKey.set(this.searchWidget.getReplaceValue().length>0);y(),this._register(this.searchWidget.replaceInput.inputBox.onDidChange(()=>y())),this._register(this.searchWidget.onDidHeightChange(()=>this.reLayout())),this._register(this.searchWidget.onReplaceToggled(()=>this.reLayout())),this._register(this.searchWidget.onReplaceStateChange(async w=>{this.viewModel.replaceActive=w,await this.refreshTreeController.queue()})),this._register(this.searchWidget.onPreserveCaseChange(async w=>{this.viewModel.preserveCase=w,await this.refreshTreeController.queue()})),this._register(this.searchWidget.onReplaceValueChanged(()=>{this.viewModel.replaceString=this.searchWidget.getReplaceValue(),this.delayedRefresh.trigger(async()=>this.refreshTreeController.queue())})),this._register(this.searchWidget.onBlur(()=>{this.toggleQueryDetailsButton.focus()})),this._register(this.searchWidget.onReplaceAll(()=>this.replaceAll())),this.trackInputBox(this.searchWidget.searchInputFocusTracker),this.trackInputBox(this.searchWidget.replaceInputFocusTracker)}shouldShowAIResults(){return!!Ci.hasAIResultProvider.getValue(this.contextKeyService)}async onConfigurationUpdated(e){if(e&&(e.affectsConfiguration("search.decorations.colors")||e.affectsConfiguration("search.decorations.badges")))return this.refreshTreeController.queue()}trackInputBox(e,t){e&&(this._register(e.onDidFocus(()=>{this.lastFocusState="input",this.inputBoxFocused.set(!0),t?.set(!0)})),this._register(e.onDidBlur(()=>{this.inputBoxFocused.set(this.searchWidget.searchInputHasFocus()||this.searchWidget.replaceInputHasFocus()||this.inputPatternIncludes.inputHasFocus()||this.inputPatternExcludes.inputHasFocus()),t?.set(!1)})))}async onSearchResultsChanged(e){if(this.isVisible())return this.refreshAndUpdateCount(e);this.changedWhileHidden=!0}async refreshAndUpdateCount(e){return this.searchWidget.setReplaceAllActionState(!this.viewModel.searchResult.isEmpty()),this.updateSearchResultCount(this.viewModel.searchResult.query.userDisabledExcludesAndIgnoreFiles,this.viewModel.searchResult.query?.onlyOpenEditors,e?.clearingAll),this.refreshTreeController.queue(e)}originalShouldCollapse(e){let t=this.searchConfig.collapseResults;return t==="alwaysCollapse"||!Ka(e)&&e.count()>10&&t!=="alwaysExpand"?3:2}shouldCollapseAccordingToConfig(e){return this.originalShouldCollapse(e)===3}replaceAll(){if(this.viewModel.searchResult.count()===0)return;let e=this.viewModel.searchResult.count(),t=this.viewModel.searchResult.fileCount(),o=this.searchWidget.getReplaceValue()||"",n=this.buildAfterReplaceAllMessage(e,t,o),r,s;this.progressService.withProgress({location:this.getProgressLocation(),delay:100,total:e},c=>(s=c,new Promise(u=>r=u)));let l={title:d(13425,null),message:this.buildReplaceAllConfirmationMessage(e,t,o),primaryButton:d(13424,null)};this.dialogService.confirm(l).then(c=>{c.confirmed?(this.searchWidget.setReplaceAllActionState(!1),this.viewModel.searchResult.replaceAll(s).then(()=>{r();let u=this.clearMessage();R(u,n),this.reLayout()},u=>{r(),so(u),this.notificationService.error(u)})):r()})}buildAfterReplaceAllMessage(e,t,o){return e===1?t===1?o?d(13427,null,e,t,o):d(13417,null,e,t):o?d(13429,null,e,t,o):d(13419,null,e,t):t===1?o?d(13431,null,e,t,o):d(13421,null,e,t):o?d(13433,null,e,t,o):d(13423,null,e,t)}buildReplaceAllConfirmationMessage(e,t,o){let r=(s=>{if(!s)return s;let l=s.split(`
`);return l.length>10?l.slice(0,10).join(`
`)+`
...`:s})(o);return e===1?t===1?r?d(13416,null,e,t,r):d(13426,null,e,t):r?d(13418,null,e,t,r):d(13428,null,e,t):t===1?r?d(13420,null,e,t,r):d(13430,null,e,t):r?d(13422,null,e,t,r):d(13432,null,e,t)}clearMessage(){this.searchWithoutFolderMessageElement=void 0;let e=this.messagesElement.style.display==="none";Rt(this.messagesElement),bn(this.messagesElement),this.messageDisposables.clear();let t=R(this.messagesElement,ID(".message"));return e&&this.reLayout(),t}createSearchResultsView(e){this.resultsElement=R(e,ID(".results.show-file-icons.file-icon-themable-tree"));let t=this.instantiationService.createInstance(eit),o={getId(r){return r.id()}};this.searchDataSource=this.instantiationService.createInstance(cit,this),this.treeLabels=this._register(this.instantiationService.createInstance(Za,{onDidChangeVisibility:this.onDidChangeBodyVisibility})),this.tree=this._register(this.instantiationService.createInstance(qI,"SearchView",this.resultsElement,t,{isIncompressible:r=>!(bd(r)&&!jf(r.parent())&&!_2(r.parent())&&!p0(r.parent()))},[this._register(this.instantiationService.createInstance($3,this,this.treeLabels)),this._register(this.instantiationService.createInstance(q3,this,this.treeLabels)),this._register(this.instantiationService.createInstance(G3,this.treeLabels)),this._register(this.instantiationService.createInstance(j3,this))],this.searchDataSource,{identityProvider:o,accessibilityProvider:this.treeAccessibilityProvider,dnd:this.instantiationService.createInstance(k5,r=>fl(r)?r.resource:Ka(r)?fL(r.parent().resource,r.range()):null),multipleSelectionSupport:!0,selectionNavigation:!0,overrideStyles:this.getLocationBasedColors().listOverrideStyles,paddingBottom:eit.ITEM_HEIGHT,collapseByDefault:r=>jf(r)?r.isAIContributed:bd(r)&&r.matches().length===1&&bd(r.matches()[0])?!1:this.shouldCollapseAccordingToConfig(r)})),Ci.SearchResultListFocusedKey.bindTo(this.tree.contextKeyService),this.tree.setInput(this.viewModel.searchResult),this._register(this.tree.onContextMenu(r=>this.onContextMenu(r)));let n=()=>this.toggleCollapseStateDelayer.trigger(()=>this.hasSomeCollapsibleResultKey.set(this.hasSomeCollapsible()));n(),this._register(this.tree.onDidChangeCollapseState(()=>n())),this._register(this.tree.onDidChangeModel(()=>n())),this._register(H.debounce(this.tree.onDidOpen,(r,s)=>s,ego,!0)(r=>{if(Ka(r.element)){let s=r.element;this.currentSelectedFileMatch?.setSelectedMatch(null),this.currentSelectedFileMatch=s.parent(),this.currentSelectedFileMatch.setSelectedMatch(s),this.onFocus(s,r.editorOptions.preserveFocus,r.sideBySide,r.editorOptions.pinned)}})),this._register(H.debounce(this.tree.onDidChangeFocus,(r,s)=>s,ego,!0)(()=>{let r=this.tree.getSelection(),s=this.tree.getFocus()[0];r.length>1&&Ka(s)&&this.onFocus(s,!0)})),this._register(H.any(this.tree.onDidFocus,this.tree.onDidChangeFocus)(()=>{let r=this.tree.getFocus()[0];if(this.tree.isDOMFocused()){let l=this.tree.getFirstElementChild(this.tree.getInput());this.firstMatchFocused.set(l===r),this.fileMatchOrMatchFocused.set(!!r),this.fileMatchFocused.set(fl(r)),this.folderMatchFocused.set(bd(r)),this.matchFocused.set(Ka(r)),this.fileMatchOrFolderMatchFocus.set(fl(r)||bd(r)),this.fileMatchOrFolderMatchWithResourceFocus.set(fl(r)||K3(r)),this.folderMatchWithResourceFocused.set(K3(r)),this.searchResultHeaderFocused.set(Lho(r)),this.lastFocusState="tree"}let s=!1;Ka(r)?s=!r.isReadonly:(fl(r)||bd(r))&&(s=!r.hasOnlyReadOnlyMatches()),this.isEditableItem.set(s)})),this._register(this.tree.onDidBlur(()=>{this.firstMatchFocused.reset(),this.fileMatchOrMatchFocused.reset(),this.fileMatchFocused.reset(),this.folderMatchFocused.reset(),this.matchFocused.reset(),this.fileMatchOrFolderMatchFocus.reset(),this.fileMatchOrFolderMatchWithResourceFocus.reset(),this.folderMatchWithResourceFocused.reset(),this.searchResultHeaderFocused.reset(),this.isEditableItem.reset()})),this._register(this.editorService.onDidActiveEditorChange(()=>{let r=ca(this.editorService.activeTextEditorControl);this.currentEditorCursorListener.value=r?.onDidChangeCursorPosition(()=>{this.currentSelectedFileMatch?.setSelectedMatch(null),this.currentSelectedFileMatch=void 0})}))}onContextMenu(e){e.browserEvent.preventDefault(),e.browserEvent.stopPropagation();let t=this.tree.getSelection(),o,n;t&&t.length>0?(o=e.element,n=t):n=e.element,this.contextMenuService.showContextMenu({menuId:D.SearchContext,menuActionOptions:{shouldForwardArgs:!0,arg:o},contextKeyService:this.contextKeyService,getAnchor:()=>e.anchor,getActionsContext:()=>n})}hasSomeCollapsible(){let e=this.getControl(),t=e.navigate(),o=t.first(),n=this.shouldShowAIResults();do if(o&&!e.isCollapsed(o)&&(!n||!jf(o)))return!0;while(o=t.next());return!1}async selectNextMatch(){if(!this.hasSearchResults())return;let[e]=this.tree.getSelection();e&&!Ka(e)&&this.tree.isCollapsed(e)&&await this.tree.expand(e);let t=this.tree.navigate(e),o=t.next();for(o||(o=t.first());o&&!Ka(o);)this.tree.isCollapsed(o)&&await this.tree.expand(o),o=t.next();if(o){o===e&&this.tree.setFocus([]);let n=IE(void 0,!1,!1);this.tree.setFocus([o],n),this.tree.setSelection([o],n),this.tree.reveal(o);let r=this.treeAccessibilityProvider.getAriaLabel(o);r&&Or(r)}}async selectPreviousMatch(){if(!this.hasSearchResults())return;let[e]=this.tree.getSelection(),t=this.tree.navigate(e),o=t.previous();for(;!o||!Ka(o)&&!this.tree.isCollapsed(o);){let n=o?t.previous():t.last();if(!o&&!n)return;o=n}for(;o&&!Ka(o);){let n=t.next();if(!n)break;await this.tree.expand(o),t=this.tree.navigate(n),o=n?t.previous():t.last()}if(o){o===e&&this.tree.setFocus([]);let n=IE(void 0,!1,!1);this.tree.setFocus([o],n),this.tree.setSelection([o],n),this.tree.reveal(o);let r=this.treeAccessibilityProvider.getAriaLabel(o);r&&Or(r)}}moveFocusToResults(){this.tree.domFocus()}focus(){if(super.focus(),this.lastFocusState==="input"||!this.hasSearchResults()){let e=this.searchConfig.seedOnFocus?this.updateTextFromSelection({allowSearchOnType:!1}):!1;this.searchWidget.focus(void 0,void 0,e)}else this.tree.domFocus()}updateTextFromFindWidgetOrSelection({allowUnselectedWord:e=!0,allowSearchOnType:t=!0}){let o=this.editorService.activeTextEditorControl;if(pn(o)&&!o?.hasTextFocus()){let n=Tf.get(o);if(n&&n.isFindInputFocused())return this.updateTextFromFindWidget(n,{allowSearchOnType:t});o=this.codeEditorService.listCodeEditors().find(s=>s instanceof zc&&s.getParentEditor()===o&&s.hasTextFocus())??o}return this.updateTextFromSelection({allowUnselectedWord:e,allowSearchOnType:t},o)}updateTextFromFindWidget(e,{allowSearchOnType:t=!0}){if(!this.searchConfig.seedWithNearestWord&&(Ki().getSelection()?.toString()??"")==="")return!1;let o=e.getState().searchString;return o===""?!1:(this.searchWidget.searchInput?.setCaseSensitive(e.getState().matchCase),this.searchWidget.searchInput?.setWholeWords(e.getState().wholeWord),this.searchWidget.searchInput?.setRegex(e.getState().isRegex),this.updateText(o,t),!0)}updateTextFromSelection({allowUnselectedWord:e=!0,allowSearchOnType:t=!0},o){let n=this.configurationService.getValue("editor").find.seedSearchStringFromSelection;if(!n||n==="never")return!1;let r=this.getSearchTextFromEditor(e,o);return r===null?!1:(this.searchWidget.searchInput?.getRegex()&&(r=Yr(r)),this.updateText(r,t),!0)}updateText(e,t=!0){t&&!this.viewModel.searchResult.isDirty?this.searchWidget.setValue(e):(this.pauseSearching=!0,this.searchWidget.setValue(e),this.pauseSearching=!1)}focusNextInputBox(){if(this.searchWidget.searchInputHasFocus()){this.searchWidget.isReplaceShown()?this.searchWidget.focus(!0,!0):this.moveFocusFromSearchOrReplace();return}if(this.searchWidget.replaceInputHasFocus()){this.moveFocusFromSearchOrReplace();return}if(this.inputPatternIncludes.inputHasFocus()){this.inputPatternExcludes.focus(),this.inputPatternExcludes.select();return}if(this.inputPatternExcludes.inputHasFocus()){this.selectTreeIfNotSelected();return}}moveFocusFromSearchOrReplace(){this.showsFileTypes()?this.toggleQueryDetails(!0,this.showsFileTypes()):this.selectTreeIfNotSelected()}focusPreviousInputBox(){if(!this.searchWidget.searchInputHasFocus()){if(this.searchWidget.replaceInputHasFocus()){this.searchWidget.focus(!0);return}if(this.inputPatternIncludes.inputHasFocus()){this.searchWidget.focus(!0,!0);return}if(this.inputPatternExcludes.inputHasFocus()){this.inputPatternIncludes.focus(),this.inputPatternIncludes.select();return}if(this.tree.isDOMFocused()){this.moveFocusFromResults();return}}}moveFocusFromResults(){this.showsFileTypes()?this.toggleQueryDetails(!0,!0,!1,!0):this.searchWidget.focus(!0,!0)}reLayout(){if(this.isDisposed||!this.size)return;let e=this.searchConfig.actionsPosition;this.getContainer().classList.toggle(D2.ACTIONS_RIGHT_CLASS_NAME,e==="right"),this.searchWidget.setWidth(this.size.width-28),this.inputPatternExcludes.setWidth(this.size.width-28),this.inputPatternIncludes.setWidth(this.size.width-28);let t=nh(this.searchWidgetsContainerElement),o=nh(this.messagesElement);this.tree.layout(this.size.height-t-o,this.size.width-28)}layoutBody(e,t){super.layoutBody(e,t),this.size=new ai(t,e),this.reLayout()}getControl(){return this.tree}allSearchFieldsClear(){return this.searchWidget.getReplaceValue()===""&&(!this.searchWidget.searchInput||this.searchWidget.searchInput.getValue()==="")}allFilePatternFieldsClear(){return this.searchExcludePattern.getValue()===""&&this.searchIncludePattern.getValue()===""}hasSearchResults(){return!this.viewModel.searchResult.isEmpty()}clearSearchResults(e=!0){this.viewModel.searchResult.clear(),this.showEmptyStage(!0),this.contextService.getWorkbenchState()===1&&this.showSearchWithoutFolderMessage(),e&&(this.allSearchFieldsClear()&&this.clearFilePatternFields(),this.searchWidget.clear()),this.viewModel.cancelSearch(),this.viewModel.cancelAISearch(),this.tree.ariaLabel=d(13395,null),this.accessibilitySignalService.playSignal($o.clear),this.reLayout()}clearFilePatternFields(){this.searchExcludePattern.clear(),this.searchIncludePattern.clear()}cancelSearch(e=!0){return this.viewModel.cancelSearch()&&this.viewModel.cancelAISearch()?(e&&this.searchWidget.focus(),!0):!1}selectTreeIfNotSelected(){if(this.tree.getNode(void 0)&&(this.tree.domFocus(),this.tree.getSelection().length===0)){let t=IE();this.tree.focusNext(void 0,void 0,t),this.tree.setSelection(this.tree.getFocus(),t)}}getSearchTextFromEditor(e,t){if(ts(this.getContainer())||(t=t??this.editorService.activeTextEditorControl,!t))return null;let o=this.searchConfig.seedWithNearestWord&&e;return zEi(o,t)}showsFileTypes(){return this.queryDetails.classList.contains("more")}toggleCaseSensitive(){this.searchWidget.searchInput?.setCaseSensitive(!this.searchWidget.searchInput.getCaseSensitive()),this.triggerQueryChange({shouldKeepAIResults:!0})}toggleWholeWords(){this.searchWidget.searchInput?.setWholeWords(!this.searchWidget.searchInput.getWholeWords()),this.triggerQueryChange({shouldKeepAIResults:!0})}toggleRegex(){this.searchWidget.searchInput?.setRegex(!this.searchWidget.searchInput.getRegex()),this.triggerQueryChange({shouldKeepAIResults:!0})}togglePreserveCase(){this.searchWidget.replaceInput?.setPreserveCase(!this.searchWidget.replaceInput.getPreserveCase()),this.triggerQueryChange({shouldKeepAIResults:!0})}setSearchParameters(e={}){typeof e.isCaseSensitive=="boolean"&&this.searchWidget.searchInput?.setCaseSensitive(e.isCaseSensitive),typeof e.matchWholeWord=="boolean"&&this.searchWidget.searchInput?.setWholeWords(e.matchWholeWord),typeof e.isRegex=="boolean"&&this.searchWidget.searchInput?.setRegex(e.isRegex),typeof e.filesToInclude=="string"&&this.searchIncludePattern.setValue(String(e.filesToInclude)),typeof e.filesToExclude=="string"&&this.searchExcludePattern.setValue(String(e.filesToExclude)),typeof e.query=="string"&&this.searchWidget.searchInput?.setValue(e.query),typeof e.replace=="string"?this.searchWidget.replaceInput?.setValue(e.replace):this.searchWidget.replaceInput&&this.searchWidget.replaceInput.getValue()!==""&&this.searchWidget.replaceInput.setValue(""),typeof e.triggerSearch=="boolean"&&e.triggerSearch&&this.triggerQueryChange(),typeof e.preserveCase=="boolean"&&this.searchWidget.replaceInput?.setPreserveCase(e.preserveCase),typeof e.useExcludeSettingsAndIgnoreFiles=="boolean"&&this.inputPatternExcludes.setUseExcludesAndIgnoreFiles(e.useExcludeSettingsAndIgnoreFiles),typeof e.onlyOpenEditors=="boolean"&&this.searchIncludePattern.setOnlySearchInOpenEditors(e.onlyOpenEditors)}toggleQueryDetails(e=!0,t,o,n){t=typeof t>"u"?!this.queryDetails.classList.contains("more"):!!t,this.viewletState.query||(this.viewletState.query={}),this.viewletState.query.queryDetailsExpanded=t,o=!!o,t?(this.toggleQueryDetailsButton.setAttribute("aria-expanded","true"),this.queryDetails.classList.add("more"),e&&(n?(this.inputPatternExcludes.focus(),this.inputPatternExcludes.select()):(this.inputPatternIncludes.focus(),this.inputPatternIncludes.select()))):(this.toggleQueryDetailsButton.setAttribute("aria-expanded","false"),this.queryDetails.classList.remove("more"),e&&this.searchWidget.focus()),!o&&this.size&&this.reLayout()}searchInFolders(e=[]){this._searchWithIncludeOrExclude(!0,e)}searchOutsideOfFolders(e=[]){this._searchWithIncludeOrExclude(!1,e)}_searchWithIncludeOrExclude(e,t){if(!t.length||t.some(o=>o===".")){this.inputPatternIncludes.setValue(""),this.searchWidget.focus();return}this.showsFileTypes()||this.toggleQueryDetails(!0,!0),(e?this.inputPatternIncludes:this.inputPatternExcludes).setValue(t.join(", ")),this.searchWidget.focus(!1)}triggerQueryChange(e){let t={preserveFocus:!0,triggeredOnType:!1,delay:0,...e};if(!(t.triggeredOnType&&!this.searchConfig.searchOnType)&&!this.pauseSearching){let o=t.triggeredOnType?t.delay:0;this.triggerQueryDelayer.trigger(()=>{this._onQueryChanged(t.preserveFocus,t.triggeredOnType,t.shouldKeepAIResults,t.shouldUpdateAISearch)},o)}}_getExcludePattern(){return this.inputPatternExcludes.getValue().trim()}_getIncludePattern(){return this.inputPatternIncludes.getValue().trim()}_onQueryChanged(e,t=!1,o=!1,n=!1){if(!this.searchWidget.searchInput?.inputBox.isInputValid())return;let r=this.searchWidget.searchInput.getRegex(),s=this.searchWidget.getNotebookFilters().markupInput,l=this.searchWidget.getNotebookFilters().markupPreview,c=this.searchWidget.getNotebookFilters().codeInput,u=this.searchWidget.getNotebookFilters().codeOutput,p=this.searchWidget.searchInput.getWholeWords(),h=this.searchWidget.searchInput.getCaseSensitive(),g=this.searchWidget.searchInput.getValue(),f=this._getExcludePattern(),v=this._getIncludePattern(),b=this.inputPatternExcludes.useExcludesAndIgnoreFiles(),S=this.inputPatternIncludes.onlySearchInOpenEditors();if(g.length===0){this.clearSearchResults(!1),this.clearMessage(),this.clearAIResults();return}let y={pattern:g,isRegExp:r,isCaseSensitive:h,isWordMatch:p,notebookInfo:{isInNotebookMarkdownInput:s,isInNotebookMarkdownPreview:l,isInNotebookCellInput:c,isInNotebookCellOutput:u}},w=[{pattern:this.inputPatternExcludes.getValue()}],k=this.inputPatternIncludes.getValue(),T=y.isRegExp?1e4:1e3,N={_reason:"searchView",extraFileResources:this.instantiationService.invokeFunction(SX),maxResults:this.searchConfig.maxResults??void 0,disregardIgnoreFiles:!b||void 0,disregardExcludeSettings:!b||void 0,ignoreGlobCase:!Wn||void 0,onlyOpenEditors:S,excludePattern:w,includePattern:k,previewOptions:{matchLines:1,charsPerLine:T},isSmartCase:this.searchConfig.smartCase,expandPatterns:!0},O=this.contextService.getWorkspace().folders,V=G=>{this.searchWidget.searchInput?.showMessage({content:G.message,type:3}),this.viewModel.searchResult.clear()},U;try{U=this.queryBuilder.text(y,O.map(G=>G.uri),N)}catch(G){V(G);return}this.validateQuery(U).then(()=>{!o&&n&&this.tree.hasNode(this.searchResult.aiTextSearchResult)&&this.tree.collapse(this.searchResult.aiTextSearchResult),this.onQueryTriggered(U,N,f,v,t,o,n),e||this.searchWidget.focus(!1,void 0,!0)},V)}validateQuery(e){let t=e.folderQueries.map(o=>this.fileService.exists(o.folder).catch(()=>!1));return Promise.all(t).then(o=>{let n=e.folderQueries.filter((r,s)=>o[s]);if(!e.folderQueries.length||n.length)e.folderQueries=n;else{let r=e.folderQueries[0].folder.fsPath,s=d(13442,null,r);return Promise.reject(new Error(s))}})}onQueryTriggered(e,t,o,n,r,s,l){this.addToSearchHistoryDelayer.trigger(()=>{this.searchWidget.searchInput?.onSearchSubmit(),this.inputPatternExcludes.onSearchSubmit(),this.inputPatternIncludes.onSearchSubmit()}),this.viewModel.cancelSearch(!0),s||this.clearAIResults(),this.currentSearchQ=this.currentSearchQ.then(()=>this.doSearch(e,o,n,r,s,l)).then(()=>{},()=>{})}async _updateResults(){if(this.state!==0)try{let e=this.viewModel.searchResult.fileCount();this._visibleMatches!==e&&(this._visibleMatches=e,await this.refreshAndUpdateCount())}finally{this._refreshResultsScheduler.schedule()}}async expandIfSingularResult(){if(this.searchConfig.collapseResults!=="alwaysCollapse"&&this.viewModel.searchResult.matches().length===1){let t=this.viewModel.searchResult.matches()[0];await this.tree.expandTo(t),t.count()<50&&await this.tree.expand(t)}}appendSearchWithAIButton(e){let t=this.keybindingService.appendKeybinding(d(13447,null),"search.action.searchWithAI"),o=d(13445,null),n=this.messageDisposables.add(new h0(o,()=>{this.commandService.executeCommand("search.action.searchWithAI")},this.hoverService,t));R(e,n.element)}async onSearchComplete(e,t,o,n,r=!0,s){this.state=0,e(),r&&await this.refreshAndUpdateCount();let l=!this.viewModel.searchResult.isEmpty(),c=this.searchResult.getCachedSearchComplete(!0);if(n?.exit!==1){if(Ci.AIResultsRequested.bindTo(this.contextKeyService).set(this.shouldShowAIResults()&&!!c),n&&this.tree.hasNode(this.searchResult.aiTextSearchResult)&&this.tree.isCollapsed(this.searchResult.aiTextSearchResult)){this.tree.expand(this.searchResult.aiTextSearchResult);return}if(l)this.viewModel.searchResult.toggleHighlights(this.isVisible()),Or(d(13393,null,this.viewModel.searchResult.count(),this.viewModel.searchResult.fileCount()));else{let u=!!t,p=!!o,h;n?this.inputPatternIncludes.onlySearchInOpenEditors()?p&&u?h=d(13403,null,o,t):p?h=d(13402,null,o):u?h=d(13400,null,t):h=d(13401,null):p&&u?h=d(13407,null,o,t):p?h=d(13406,null,o):u?h=d(13404,null,t):h=d(13405,null):h=Zho,Or(h);let g=this.clearMessage();if(R(g,h),this.shouldShowAIResults()&&(this.appendSearchWithAIButton(g),R(g,ID("span",void 0," - "))),n)if(p||u){let f=this.messageDisposables.add(new h0(d(13435,null),this.onSearchAgain.bind(this),this.hoverService));R(g,f.element)}else{let f=this.messageDisposables.add(new h0(d(13413,null),this.onOpenSettings.bind(this),this.hoverService));R(g,f.element)}else{let f=this.messageDisposables.add(new h0(d(13434,null),()=>this.triggerQueryChange({preserveFocus:!1}),this.hoverService));R(g,f.element)}this.contextService.getWorkbenchState()===1&&this.showSearchWithoutFolderMessage(),this.reLayout()}if(n&&n.limitHit&&n.messages.push({type:2,text:d(13441,null)}),n&&n.messages)for(let u of n.messages)this.addMessage(u);this.reLayout()}}async onSearchError(e,t,o,n,r,s=!0){return this.state=0,so(e)?this.onSearchComplete(t,o,n,r,s):(t(),this.searchWidget.searchInput?.showMessage({content:e.message,type:3}),this.viewModel.searchResult.clear(),Promise.resolve())}clearAIResults(){this.model.searchResult.aiTextSearchResult.hidden=!0,this.refreshTreeController.clearAllPending(),this._pendingSemanticSearchPromise=void 0,this._cachedResults=void 0,this._cachedKeywords=[],this.model.cancelAISearch(!0),this.model.clearAiSearchResults()}async requestAIResults(){this.logService.info(`SearchView: Requesting semantic results from keybinding. Cached: ${!!this.cachedResults}`),(!this.cachedResults||this.cachedResults.results.length===0)&&!this._pendingSemanticSearchPromise&&this.clearAIResults(),this.model.searchResult.aiTextSearchResult.hidden=!1,await this.queueRefreshTree(),await vNe(this.getControl(),this.model.searchResult.aiTextSearchResult)}async addAIResults(){let e=this._getExcludePattern(),t=this._getIncludePattern();this.searchWidget.searchInput?.clearMessage(),this.showEmptyStage(),this._visibleMatches=0,this.tree.setSelection([]),this.tree.setFocus([]),this.viewModel.replaceString=this.searchWidget.getReplaceValue();let o=this._pendingSemanticSearchPromise;o||(this.viewModel.searchResult.setAIQueryUsingTextQuery(),o=this._pendingSemanticSearchPromise=this.viewModel.aiSearch(()=>{this._pendingSemanticSearchPromise===o&&(this._pendingSemanticSearchPromise=void 0)})),o.then(n=>(this.updateSearchResultCount(this.viewModel.searchResult.query?.userDisabledExcludesAndIgnoreFiles,this.viewModel.searchResult.query?.onlyOpenEditors,!1),this.onSearchComplete(()=>{},e,t,n,!1,n.aiKeywords)),n=>this.onSearchError(n,()=>{},e,t,void 0,!1))}doSearch(e,t,o,n,r,s){let l;this.progressService.withProgress({location:this.getProgressLocation(),delay:n?300:0},p=>new Promise(h=>l=h)),this.searchWidget.searchInput?.clearMessage(),this.state=1,this.showEmptyStage(),this.model.searchResult.aiTextSearchResult.hidden&&s&&(this.logService.info(`SearchView: Semantic search visible. Keep semantic results: ${r}. Update semantic search: ${s}`),this.model.searchResult.aiTextSearchResult.hidden=!1);let c=setTimeout(()=>{this.state=2},2e3);this._visibleMatches=0,this._refreshResultsScheduler.schedule(),this.searchWidget.setReplaceAllActionState(!1),this.tree.setSelection([]),this.tree.setFocus([]),this.viewModel.replaceString=this.searchWidget.getReplaceValue();let u=this.viewModel.search(e);return(!r||s)&&this.viewModel.searchResult.setAIQueryUsingTextQuery(e),this.configurationService.getValue("search").searchView.keywordSuggestions&&this.getKeywordSuggestions(),u.asyncResults.then(p=>{clearTimeout(c);let h=this.configurationService.getValue("search").searchView.semanticSearchBehavior;return p.results.length===0&&h==="runOnEmpty"&&(this.logService.info("SearchView: Requesting semantic results on empty search."),this.model.searchResult.aiTextSearchResult.hidden=!1),this.onSearchComplete(l,t,o,p)},p=>(clearTimeout(c),this.onSearchError(p,l,t,o)))}onOpenSettings(e){$t.stop(e,!1),this.openSettings("@id:files.exclude,search.exclude,search.useParentIgnoreFiles,search.useGlobalIgnoreFiles,search.useIgnoreFiles")}openSettings(e){let t={query:e};return this.contextService.getWorkbenchState()!==1?this.preferencesService.openWorkspaceSettings(t):this.preferencesService.openUserSettings(t)}onSearchAgain(){this.inputPatternExcludes.setValue(""),this.inputPatternIncludes.setValue(""),this.inputPatternIncludes.setOnlySearchInOpenEditors(!1),this.triggerQueryChange({preserveFocus:!1})}onEnableExcludes(){this.toggleQueryDetails(!1,!0),this.searchExcludePattern.setUseExcludesAndIgnoreFiles(!0)}onDisableSearchInOpenEditors(){this.toggleQueryDetails(!1,!0),this.inputPatternIncludes.setOnlySearchInOpenEditors(!1)}updateSearchResultCount(e,t,o=!1){if(this._cachedKeywords.length>0)return;let n=this.viewModel.searchResult.fileCount(this.viewModel.searchResult.aiTextSearchResult.hidden),r=this.viewModel.searchResult.count(this.viewModel.searchResult.aiTextSearchResult.hidden);this.hasSearchResultsKey.set(n>0);let s=this.messagesElement.style.display==="none",l=this.clearMessage(),c=o?"":this.buildResultCountMessage(r,n);if(this.tree.ariaLabel=c+d(13397,null,this.searchResult.query?.contentPattern.pattern??""),R(l,c),n>0){if(e){let h=" - "+d(13449,null)+" ",g=this.messageDisposables.add(new h0(d(13396,null),this.onEnableExcludes.bind(this),this.hoverService,d(13448,null)));R(l,ID("span",void 0,h,"(",g.element,")"))}if(t){let h=" - "+d(13408,null)+" ",g=this.messageDisposables.add(new h0(d(13409,null),this.onDisableSearchInOpenEditors.bind(this),this.hoverService,d(13394,null)));R(l,ID("span",void 0,h,"(",g.element,")"))}R(l," - ");let u=this.keybindingService.appendKeybinding(d(13412,null),"search.action.openInEditor"),p=this.messageDisposables.add(new h0(d(13411,null),()=>this.instantiationService.invokeFunction(UUt,this.searchResult,this.searchIncludePattern.getValue(),this.searchExcludePattern.getValue(),this.searchIncludePattern.onlySearchInOpenEditors()),this.hoverService,u));R(l,p.element),this.shouldShowAIResults()&&(R(l," - "),this.appendSearchWithAIButton(l)),this.reLayout()}else s||xo(this.messagesElement)}handleKeywordClick(e,t){this.searchWidget.searchInput?.setValue(e),this.triggerQueryChange({preserveFocus:!1,triggeredOnType:!1,shouldKeepAIResults:!1}),this.telemetryService.publicLog2("searchKeywordClick",{index:t,maxKeywords:this._cachedKeywords.length})}updateKeywordSuggestionUI(e){let t=this.messagesElement.firstChild;if(this._cachedKeywords.length>0){if(this._cachedKeywords.length>=3)return;R(t,", ");let o=this._cachedKeywords.length,n=this.messageDisposables.add(new h0(e.keyword,()=>this.handleKeywordClick(e.keyword,o),this.hoverService));R(t,n.element)}else{let o=this.clearMessage();o.classList.add("ai-keywords");let n=d(13398,null);R(o,n);let r=this.messageDisposables.add(new h0(e.keyword,()=>this.handleKeywordClick(e.keyword,0),this.hoverService));R(o,r.element)}this._cachedKeywords.push(e.keyword)}async getKeywordSuggestions(){let e=this._pendingSemanticSearchPromise;e||(this.viewModel.searchResult.setAIQueryUsingTextQuery(),e=this._pendingSemanticSearchPromise=this.viewModel.aiSearch(t=>{if(t&&DLt(t)){this.updateKeywordSuggestionUI(t);return}this._pendingSemanticSearchPromise===e&&(this._pendingSemanticSearchPromise=void 0)})),this._cachedResults=await e}addMessage(e){let t=this.messagesElement.firstChild;t&&R(t,PUt(e,this.instantiationService,this.notificationService,this.openerService,this.commandService,this.messageDisposables,()=>this.triggerQueryChange()))}buildResultCountMessage(e,t){return e===1&&t===1?d(13436,null,e,t):e===1?d(13438,null,e,t):t===1?d(13437,null,e,t):d(13439,null,e,t)}showSearchWithoutFolderMessage(){this.searchWithoutFolderMessageElement=this.clearMessage();let e=R(this.searchWithoutFolderMessageElement,ID("p",void 0,d(13446,null))),t=this.messageDisposables.add(new h0(d(13410,null),()=>{this.commandService.executeCommand(nK.ID).catch(o=>mt(o))},this.hoverService));R(e,t.element)}showEmptyStage(e=!1){((this.messagesElement.firstChild?.textContent?.indexOf(Zho)??-1)>-1||e||!this.configurationService.getValue().search.searchOnType)&&xo(this.messagesElement),bn(this.resultsElement),this.currentSelectedFileMatch=void 0}shouldOpenInNotebookEditor(e,t){return VB(e)||t.scheme!==Y.untitled&&this.notebookService.getContributedNotebookTypes(t).length>0}onFocus(e,t,o,n){let r=this.configurationService.getValue().search.useReplacePreview,s=Ka(e)?e.parent().resource:e.resource;return r&&this.viewModel.isReplaceActive()&&this.viewModel.replaceString&&!this.shouldOpenInNotebookEditor(e,s)?this.replaceService.openReplacePreview(e,t,o,n):this.open(e,t,o,n,s)}async open(e,t,o,n,r){let s=UEi(e,this.viewModel),l=Ka(e)?e.parent().matches():[],c=r??(Ka(e)?e.parent().resource:e.resource),u,p={preserveFocus:t,pinned:n,selection:s,revealIfVisible:!0};try{u=await this.editorService.openEditor({resource:c,options:p},o?vn:Un);let h=u?.getControl();Ka(e)&&t&&pn(h)?this.viewModel.searchResult.getRangeHighlightDecorations().highlightRange(h.getModel(),e.range()):this.viewModel.searchResult.getRangeHighlightDecorations().removeHighlightRange()}catch(h){mt(h);return}if(u instanceof uD){let h=e.parent();if(Ka(e))if(VB(e))e.parent().showMatch(e);else{let g=u.getControl();if(g){h.bindNotebookEditorWidget(g),await h.updateMatchesForEditorWidget();let f=l.findIndex(S=>S.id()===e.id()),v=h.matches(),b=f>=v.length?v[v.length-1]:v[f];VB(b)&&(h.showMatch(b),(!this.tree.getFocus().includes(b)||!this.tree.getSelection().includes(b))&&(this.tree.setSelection([b],IE()),this.tree.setFocus([b])))}}}}openEditorWithMultiCursor(e){let t=Ka(e)?e.parent().resource:e.resource;return this.editorService.openEditor({resource:t,options:{preserveFocus:!1,pinned:!0,revealIfVisible:!0}}).then(o=>{if(o){let n=null;if(fl(e)?n=e:Ka(e)&&(n=e.parent()),n){let r=n.matches().map(l=>new Yt(l.range().startLineNumber,l.range().startColumn,l.range().endLineNumber,l.range().endColumn)),s=ca(o.getControl());s&&Z7.get(s)?.selectAllUsingSelections(r)}}this.viewModel.searchResult.getRangeHighlightDecorations().removeHighlightRange()},mt)}onUntitledDidDispose(e){if(!this.viewModel)return;let t=this.viewModel.searchResult.matches();for(let o=0,n=t.length;o<n;o++)e.toString()===t[o].resource.toString()&&this.viewModel.searchResult.remove(t[o]);t=this.viewModel.searchResult.matches(!0);for(let o=0,n=t.length;o<n;o++)e.toString()===t[o].resource.toString()&&this.viewModel.searchResult.remove(t[o])}onFilesChanged(e){if(!this.viewModel||this.searchConfig.sortOrder!=="modified"&&!e.gotDeleted())return;let t=this.viewModel.searchResult.matches();if(e.gotDeleted()){let o=t.filter(n=>e.contains(n.resource,2));this.viewModel.searchResult.remove(o)}else{let o=t.filter(n=>e.contains(n.resource));o.length&&this.searchConfig.sortOrder==="modified"&&this.updateFileStats(o).then(async()=>this.refreshTreeController.queue())}}get searchConfig(){return this.configurationService.getValue("search")}clearHistory(){this.searchWidget.clearHistory(),this.inputPatternExcludes.clearHistory(),this.inputPatternIncludes.clearHistory()}saveState(){if(!this.searchWidget)return;let e=this.inputPatternExcludes?.getValue().trim()??"",t=this.inputPatternIncludes?.getValue().trim()??"",o=this.inputPatternIncludes?.onlySearchInOpenEditors()??!1,n=this.inputPatternExcludes?.useExcludesAndIgnoreFiles()??!0,r=this.viewModel.preserveCase;if(this.viewletState.query||(this.viewletState.query={}),this.searchWidget.searchInput){let l=this.searchWidget.searchInput.getRegex(),c=this.searchWidget.searchInput.getWholeWords(),u=this.searchWidget.searchInput.getCaseSensitive(),p=this.searchWidget.searchInput.getValue(),h=this.searchWidget.getNotebookFilters().codeInput,g=this.searchWidget.getNotebookFilters().codeOutput,f=this.searchWidget.getNotebookFilters().markupInput,v=this.searchWidget.getNotebookFilters().markupPreview;this.viewletState.query.contentPattern=p,this.viewletState.query.regex=l,this.viewletState.query.wholeWords=c,this.viewletState.query.caseSensitive=u,this.viewletState.query.isInNotebookMarkdownInput=f,this.viewletState.query.isInNotebookMarkdownPreview=v,this.viewletState.query.isInNotebookCellInput=h,this.viewletState.query.isInNotebookCellOutput=g}this.viewletState.query.folderExclusions=e,this.viewletState.query.folderIncludes=t,this.viewletState.query.useExcludesAndIgnoreFiles=n,this.viewletState.query.preserveCase=r,this.viewletState.query.onlyOpenEditors=o;let s=this.searchAndReplaceWidget.isReplaceShown();this.viewletState.view||(this.viewletState.view={}),this.viewletState.view.showReplace=s,this.viewletState.view.treeLayout=this.isTreeLayoutViewVisible,this.viewletState.query.replaceText=s&&this.searchWidget.getReplaceValue(),this._saveSearchHistoryService(),this.memento.saveMemento(),super.saveState()}_saveSearchHistoryService(){if(this.searchWidget===void 0)return;let e=Object.create(null),t=this.searchWidget.getSearchHistory();t&&t.length&&(e.search=t);let o=this.searchWidget.getReplaceHistory();o&&o.length&&(e.replace=o);let n=this.inputPatternExcludes.getHistory();n&&n.length&&(e.exclude=n);let r=this.inputPatternIncludes.getHistory();r&&r.length&&(e.include=r),this.searchHistoryService.save(e)}async updateFileStats(e){let t=e.map(o=>o.resolveFileStat(this.fileService));await Promise.all(t)}removeFileStats(){for(let e of this.searchResult.matches())e.fileStat=void 0;for(let e of this.searchResult.matches(!0))e.fileStat=void 0}dispose(){this.isDisposed=!0,this.saveState(),super.dispose()}};D2=I([m(1,be),m(2,ee),m(3,Kt),m(4,Bo),m(5,Ne),m(6,ct),m(7,ge),m(8,_n),m(9,F),m(10,Ri),m(11,B),m(12,Pe),m(13,Lte),m(14,X),m(15,fI),m(16,Ho),m(17,Po),m(18,De),m(19,aNe),m(20,ze),m(21,Bi),m(22,_e),m(23,le),m(24,Qe),m(25,tt),m(26,un),m(27,ne),m(28,tr),m(29,Te)],D2);var h0=class extends C{constructor(i,e,t,o){super(),this.element=ID("a.pointer",{tabindex:0},i),this._register(t.setupManagedHover(Ni("mouse"),this.element,o)),this.addEventHandlers(e)}addEventHandlers(i){let e=t=>{$t.stop(t,!1),i(t)};this._register(j(this.element,re.CLICK,e)),this._register(j(this.element,re.KEY_DOWN,t=>{let o=new Ii(t);(o.equals(10)||o.equals(3))&&(e(t),o.preventDefault(),o.stopPropagation())}))}};function UEi(a,i){let e=null;if(Ka(a)&&(e=a),fl(a)&&a.count()>0&&(e=a.matches()[a.matches().length-1]),e){let t=e.range();if(i.isReplaceActive()&&i.replaceString){let o=e.replaceString;return{startLineNumber:t.startLineNumber,startColumn:t.startColumn,endLineNumber:t.startLineNumber,endColumn:t.startColumn+o.length}}return t}}function zEi(a,i){let e=i;if(Ec(e)&&(e.getOriginalEditor().hasTextFocus()?e=e.getOriginalEditor():e=e.getModifiedEditor()),!pn(e)||!e.hasModel())return null;let t=e.getSelection();if(!t)return null;if(t.isEmpty())return a?e.getModel().getWordAtPosition(t.getStartPosition())?.word??null:null;let o="";for(let n=t.startLineNumber;n<=t.endLineNumber;n++){let r=e.getModel().getLineContent(n);n===t.endLineNumber&&(r=r.substring(0,t.endColumn-1)),n===t.startLineNumber&&(r=r.substring(t.startColumn-1)),n!==t.startLineNumber&&(r=`
`+r),o+=r}return o}var cit=class{constructor(i,e){this.searchView=i;this.configurationService=e}get searchConfig(){return this.configurationService.getValue("search")}createSearchResultIterator(i){let e=[];if(this.searchView.shouldShowAIResults()&&i.searchModel.hasPlainResults&&!i.aiTextSearchResult.hidden&&e.push(i.aiTextSearchResult),!i.plainTextSearchResult.isEmpty()){if(!this.searchView.shouldShowAIResults()||i.aiTextSearchResult.hidden)return this.createTextSearchResultIterator(i.plainTextSearchResult);e.push(i.plainTextSearchResult)}return e}createTextSearchResultIterator(i){let e=i.folderMatches().filter(t=>!t.isEmpty()).sort(CA);return e.length===1?this.createFolderIterator(e[0]):e}createFolderIterator(i){let e=this.searchView.isTreeLayoutViewVisible?i.matches():i.allDownstreamFileMatches(),t=e;return i instanceof dhe||(t=e.sort((o,n)=>CA(o,n,this.searchConfig.sortOrder))),t}createFileIterator(i){return i.matches().sort(CA)}hasChildren(i){return Ka(i)?!1:jf(i)&&i.isAIContributed?!0:i.hasChildren}getChildren(i){return wA(i)?this.createSearchResultIterator(i):jf(i)?i.isAIContributed&&(!this.searchView.model.hasAIResults||this.searchView._pendingSemanticSearchPromise)?this.searchView.cachedResults?this.createTextSearchResultIterator(i):(this.searchView.addAIResults(),new Promise(e=>{let t=i.onChange(()=>{t.dispose(),e(this.createTextSearchResultIterator(i))})})):this.createTextSearchResultIterator(i):bd(i)?this.createFolderIterator(i):fl(i)?this.createFileIterator(i):[]}getParent(i){let e=i.parent();if(wA(e))throw new Error("Invalid element passed to getParent");return e}};cit=I([m(1,B)],cit);var dit=class extends C{constructor(e,t,o){super();this.searchView=e;this.geSearchConfig=t;this.fileService=o;this.queuedIChangeEvents=[];this.refreshTreeThrottler=this._register(new um)}clearAllPending(){this.searchView.getControl().cancelAllRefreshPromises(!0)}async queue(e){return e&&this.queuedIChangeEvents.push(e),this.refreshTreeThrottler.queue(this.refreshTreeUsingQueue.bind(this))}async refreshTreeUsingQueue(){let e=this.queuedIChangeEvents.length===0?void 0:{elements:this.queuedIChangeEvents.map(t=>t.elements).flat(),added:this.queuedIChangeEvents.some(t=>t.added),removed:this.queuedIChangeEvents.some(t=>t.removed),clearingAll:this.queuedIChangeEvents.some(t=>t.clearingAll)};return this.queuedIChangeEvents=[],this.refreshTree(e)}async retrieveFileStats(){let e=this.searchView.model.searchResult.matches().filter(t=>!t.fileStat).map(t=>t.resolveFileStat(this.fileService));await Promise.all(e)}async refreshTree(e){let t=this.geSearchConfig();!e||e.added||e.removed?t.sortOrder==="modified"?await this.retrieveFileStats().then(()=>this.searchView.getControl().updateChildren(void 0)):await this.searchView.getControl().updateChildren(void 0):t.sortOrder==="countAscending"||t.sortOrder==="countDescending"?await this.searchView.getControl().updateChildren(void 0):e.elements.every(n=>this.searchView.getControl().hasNode(n))?await Promise.all(e.elements.map(async n=>{await this.searchView.getControl().updateChildren(n),this.searchView.getControl().rerender(n)})):this.searchView.getControl().updateChildren(void 0)}};dit=I([m(2,be)],dit);var Tk=class extends yh{constructor(e,t,o,n,r){super(Tk.PREFIX,{canAcceptInBackground:!0,noResultsPick:{label:d(13459,null)}});this.labelService=e;this.openerService=t;this.editorService=o;this.configurationService=n;this.codeEditorService=r;this.delayer=this._register(new ya(Tk.TYPING_SEARCH_DELAY))}static{this.PREFIX="#"}static{this.TYPING_SEARCH_DELAY=200}static{this.TREAT_AS_GLOBAL_SYMBOL_TYPES=new Set([4,9,0,10,2,3,1])}get defaultFilterValue(){let e=this.codeEditorService.getFocusedCodeEditor();if(e)return R7(e)??void 0}get configuration(){let e=this.configurationService.getValue().workbench?.editor;return{openEditorPinned:!e?.enablePreviewFromQuickOpen||!e?.enablePreview,openSideBySideDirection:e?.openSideBySideDirection}}_getPicks(e,t,o){return this.getSymbolPicks(e,void 0,o)}async getSymbolPicks(e,t,o){return this.delayer.trigger(async()=>o.isCancellationRequested?[]:this.doGetSymbolPicks(uF(e),t,o),t?.delay)}async doGetSymbolPicks(e,t,o){let n,r;e.values&&e.values.length>1?(n=m_e(e.values[0]),r=m_e(e.values.slice(1))):n=e;let s=await VDt(n.original,o);if(o.isCancellationRequested)return[];let l=[],c=this.configuration.openSideBySideDirection;for(let{symbol:u,provider:p}of s){if(t?.skipLocal&&!Tk.TREAT_AS_GLOBAL_SYMBOL_TYPES.has(u.kind)&&u.containerName)continue;let h=u.name,g,f,v=!1;if(n.original.length>0&&(n!==e&&([g,f]=dJ(h,{...e,values:void 0},0,0),typeof g=="number"&&(v=!0)),typeof g!="number"&&([g,f]=dJ(h,n,0,0),typeof g!="number")))continue;let b=u.location.uri,S;if(b){let T=this.labelService.getUriLabel(b,{relative:!0});u.containerName?S=`${u.containerName} \u2022 ${T}`:S=T}let y,w;if(!v&&r&&r.original.length>0){if(S&&([y,w]=dJ(S,r)),typeof y!="number")continue;typeof g=="number"&&(g+=y)}let k=u.tags?u.tags.indexOf(1)>=0:!1;l.push({symbol:u,resource:b,score:g,iconClass:q.asClassName(sh.toIcon(u.kind)),label:h,ariaLabel:h,highlights:k?void 0:{label:f,description:w},description:S,strikethrough:k,buttons:[{iconClass:c==="right"?q.asClassName(M.splitHorizontal):q.asClassName(M.splitVertical),tooltip:c==="right"?d(13461,null):d(13460,null)}],trigger:(T,N)=>(this.openSymbol(p,u,o,{keyMods:N,forceOpenSideBySide:!0}),1),accept:async(T,N)=>this.openSymbol(p,u,o,{keyMods:T,preserveFocus:N.inBackground,forcePinned:N.inBackground})})}return t?.skipSorting||l.sort((u,p)=>this.compareSymbols(u,p)),l}async openSymbol(e,t,o,n){let r=t;typeof e.resolveWorkspaceSymbol=="function"&&(r=await e.resolveWorkspaceSymbol(t,o)||t,o.isCancellationRequested)||(r.location.uri.scheme===Y.http||r.location.uri.scheme===Y.https?await this.openerService.open(r.location.uri,{fromUserGesture:!0,allowContributedOpeners:!0}):await this.editorService.openEditor({resource:r.location.uri,options:{preserveFocus:n?.preserveFocus,pinned:n.keyMods.ctrlCmd||n.forcePinned||this.configuration.openEditorPinned,selection:r.location.range?z.collapseToStart(r.location.range):void 0}},n.keyMods.alt||this.configuration.openEditorPinned&&n.keyMods.ctrlCmd||n?.forceOpenSideBySide?vn:Un))}compareSymbols(e,t){if(typeof e.score=="number"&&typeof t.score=="number"){if(e.score>t.score)return-1;if(e.score<t.score)return 1}if(e.symbol&&t.symbol){let o=e.symbol.name.toLowerCase(),n=t.symbol.name.toLowerCase(),r=o.localeCompare(n);if(r!==0)return r}if(e.symbol&&t.symbol){let o=sh.toIcon(e.symbol.kind).id,n=sh.toIcon(t.symbol.kind).id;return o.localeCompare(n)}return 0}};Tk=I([m(0,ot),m(1,Qe),m(2,ee),m(3,B),m(4,Kt)],Tk);var uhe=class extends C{static{this.ID="workbench.contributions.searchChatContextContribution"}constructor(i,e){super(),this._store.add(e.registerChatContextItem(i.createInstance(uit))),this._store.add(e.registerChatContextItem(i.createInstance(mit))),this._store.add(e.registerChatContextItem(this._store.add(i.createInstance(pit))))}};uhe=I([m(0,F),m(1,uS)],uhe);var uit=class{constructor(i,e,t){this._contextKeyService=i;this._viewsService=e;this._labelService=t;this.type="valuePick";this.label=d(13352,null);this.icon=M.search;this.ordinal=500}isEnabled(i){return!!Ci.HasSearchResults.getValue(this._contextKeyService)&&!!i.attachmentCapabilities.supportsSearchResultAttachments}async asAttachment(){let i=this._viewsService.getViewWithId(ny);return i instanceof D2?i.model.searchResult.matches().map(e=>({kind:"file",id:e.resource.toString(),value:e.resource,name:this._labelService.getUriBasenameLabel(e.resource)})):[]}};uit=I([m(0,X),m(1,Ft),m(2,ot)],uit);var pit=class{constructor(i){this._instantiationService=i;this.type="pickerPick";this.label=d(13354,null);this.icon=M.symbolField;this.ordinal=-200}dispose(){this._provider?.dispose()}isEnabled(i){return!!i.attachmentCapabilities.supportsSymbolAttachments}asPicker(){return{placeholder:d(13353,null),picks:Xde((i,e)=>(this._provider??=this._instantiationService.createInstance(Tk),this._provider.getSymbolPicks(i,void 0,e).then(t=>{let o=[];for(let n of t){if(!n.symbol)continue;let r={kind:"symbol",id:JSON.stringify(n.symbol.location),value:n.symbol.location,symbolKind:n.symbol.kind,icon:sh.toIcon(n.symbol.kind),fullName:n.label,name:n.symbol.name};o.push({label:n.symbol.name,iconClass:q.asClassName(sh.toIcon(n.symbol.kind)),asAttachment(){return r}})}return o})))}}};pit=I([m(0,F)],pit);var mit=class{constructor(i,e,t,o,n,r,s,l,c){this._searchService=i;this._labelService=e;this._modelService=t;this._languageService=o;this._configurationService=n;this._workspaceService=r;this._fileService=s;this._historyService=l;this._instantiationService=c;this.type="pickerPick";this.label=d(13351,null);this.icon=M.folder;this.ordinal=600}asPicker(){return{placeholder:d(13350,null),picks:Xde(async(i,e)=>{let t=this._workspaceService.getWorkspace().folders.map(r=>r.uri),o=[];if((await rXo(t,this._fileService)).forEach(r=>o.push(this._createPickItem(r,1))),this._historyService.getHistory().filter(r=>r.resource&&this._instantiationService.invokeFunction(s=>oke(s,r.resource.scheme))).slice(0,30).forEach(r=>o.push(this._createPickItem(r.resource,0))),i==="")return o;let n=[];return await Promise.all(t.map(async r=>{let{folders:s,files:l}=await KEi(r,i,!0,e,void 0,this._configurationService,this._searchService);for(let c of s)n.push(this._createPickItem(c,1));for(let c of l)n.push(this._createPickItem(c,0))})),n.sort((r,s)=>Al(r.label,s.label)),n})}}_createPickItem(i,e){return{label:Ye(i),description:this._labelService.getUriLabel(ci(i),{relative:!0}),iconClasses:js(this._modelService,this._languageService,i,e),asAttachment:()=>({kind:e===0?"file":"directory",id:i.toString(),value:i,name:Ye(i)})}}};mit=I([m(0,Jp),m(1,ot),m(2,Ct),m(3,kt),m(4,B),m(5,Pe),m(6,be),m(7,zs),m(8,F)],mit);async function KEi(a,i,e,t,o,n,r){let s=e?iXo(i):oXo(i),l=MP(n.getValue({resource:a}))||{},c={folderQueries:[{folder:a,disregardIgnoreFiles:n.getValue("explorer.excludeGitIgnore")}],type:1,shouldGlobMatchFilePattern:!0,cacheKey:o,excludePattern:l,sortByScore:!0,ignoreGlobCase:!0},u;try{u=await r.fileSearch({...c,filePattern:`{**/${s}/**,**/${s}}`},t)}catch(g){if(!so(g))throw g}if(!u||t?.isCancellationRequested)return{files:[],folders:[]};let p=u.results.map(g=>g.resource);return{folders:nXo(p,a,s),files:p}}function iXo(a){return a?"*"+a.split("").join("*")+"*":"*"}function oXo(a){return a?"*"+a+"*":"*"}function nXo(a,i,e){let t=new Mn;for(let n of a){let r=Fc(i,n);if(!r)throw new Error("Resource is not a child of the workspace");let s=i,l=r.split("/").slice(0,-1);for(let c of l)s=s.with({path:`${s.path}/${c}`}),t.add(s)}let o=[];for(let n of t){let r=n.path.split("/"),s=r[r.length-1];!s||!Cp(e,s,{ignoreCase:!0})||o.push(n)}return o}async function rXo(a,i){let e=[];for(let t of a){let o=i.getProvider(t.scheme);if(!o)continue;let n=await o.readdir(t);for(let[r,s]of n){let l=je(t,r);s===2&&e.push(l)}}return e}var sXo={generic:`- generic (category: "discovery"): File discovery for instructions, skills, agents, hooks. Resolving returns a fileList with full file paths, load status, skip reasons, and source folders. Always resolve these for questions about customization files.
- generic (other): Miscellaneous logs. Resolving returns additional text details.`,toolCall:"- toolCall: A tool invocation. Resolving returns tool name, input, output, status, and duration.",modelTurn:"- modelTurn: An LLM round-trip. Resolving returns model name, token usage, timing, errors, and prompt sections.",subagentInvocation:"- subagentInvocation: A sub-agent spawn. Resolving returns agent name, status, duration, and counts.",userMessage:"- userMessage: The full prompt sent to the model. Resolving returns the complete message and all prompt sections (system prompt, instructions, context). Essential for understanding what the model received.",agentResponse:"- agentResponse: The model's response. Resolving returns the full response text and sections."};function aXo(a){let i=[];for(let e of a){let t=e.created.toISOString(),o=e.id?` [id=${e.id}]`:"";switch(e.kind){case"generic":i.push(`[${t}]${o} ${e.level>=3?"ERROR":e.level>=2?"WARN":"INFO"}: ${e.name}${e.details?" - "+e.details:""}${e.category?" (category: "+e.category+")":""}`);break;case"toolCall":i.push(`[${t}]${o} TOOL_CALL: ${e.toolName}${e.result?" result="+e.result:""}${e.durationInMillis!==void 0?" duration="+e.durationInMillis+"ms":""}`);break;case"modelTurn":i.push(`[${t}]${o} MODEL_TURN: ${e.requestName??"unknown"}${e.model?" model="+e.model:""}${e.inputTokens!==void 0?" tokens(in="+e.inputTokens+",out="+(e.outputTokens??"?")+")":""}${e.durationInMillis!==void 0?" duration="+e.durationInMillis+"ms":""}`);break;case"subagentInvocation":i.push(`[${t}]${o} SUBAGENT: ${e.agentName}${e.status?" status="+e.status:""}${e.durationInMillis!==void 0?" duration="+e.durationInMillis+"ms":""}`);break;case"userMessage":i.push(`[${t}]${o} USER_MESSAGE: ${e.message.substring(0,200)}${e.message.length>200?"...":""} (${e.sections.length} sections)`);break;case"agentResponse":i.push(`[${t}]${o} AGENT_RESPONSE: ${e.message.substring(0,200)}${e.message.length>200?"...":""} (${e.sections.length} sections)`);break;default:{let n=e;break}}}return i.join(`
`)}async function bNe(a,i){i.markDebugDataAttached(a),i.hasInvokedProviders(a)||await i.invokeProviders(a);let e=i.getEvents(a),t=e.length>0?aXo(e):d(6241,null);return{id:"chatDebugEvents",name:d(6240,null),icon:M.output,kind:"debugEvents",snapshotTime:Date.now(),sessionResource:a,value:t,modelDescription:`These are the debug event logs from the current chat conversation. Analyze them to help answer the user's troubleshooting question.
CRITICAL INSTRUCTION: You MUST call the resolveDebugEventDetails tool on relevant events BEFORE answering. The log lines below are only summaries \u2014 they do NOT contain the actual data (file paths, prompt content, tool I/O, etc.). The real information is only available by resolving events. Never answer based solely on the summary lines. Always resolve first, then answer.
Call resolveDebugEventDetails in parallel on all events that could be relevant to the user's question. When in doubt, resolve more events rather than fewer.
IMPORTANT: Do NOT mention event IDs, tool resolution steps, or internal debug mechanics in your response. The user does not know about debug events or event IDs. Present your findings directly and naturally, as if you simply know the answer. Never say things like "I need to resolve events" or show event IDs.
Event types and what resolving them returns:
`+Object.values(sXo).join(`
`)}}var $Ei=/\/[\p{L}0-9_.:-]*/gu,GEi=/(@|\/)[\p{L}0-9_.:-]*/gu,hit=class extends C{constructor(e,t,o,n,r,s,l){super();this.languageFeaturesService=e;this.chatWidgetService=t;this.chatSlashCommandService=o;this.promptsService=n;this._register(this.languageFeaturesService.completionProvider.register({scheme:Y.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"globalSlashCommands",triggerCharacters:[yu],provideCompletionItems:async(c,u,p,h)=>{let g=this.chatWidgetService.getWidgetByInputUri(c.uri);if(!g||!g.viewModel)return null;let f;if(g.lockedAgentId){if(!g.attachmentCapabilities.supportsPromptAttachments)return null;let w=g.viewModel.model.sessionResource,k=w&&r.getChatSessionFromInternalUri(w);f=(k?s.getCustomAgentTargetForSessionType(k.chatSessionType):void 0)??"undefined"}let v=TA(c,u,$Ei);if(!v)return null;if(!phe(c,v)||g.parsedInput.parts.find(w=>w instanceof zu))return;let y=this.chatSlashCommandService.getCommands(g.location,g.input.currentModeKind);return y?{suggestions:y.filter(w=>g.lockedAgentId?!(w.modes&&w.modes.length&&!w.modes.includes("agent")||w.target&&f&&w.target!==f):!0).map((w,k)=>{let T=`/${w.command}`;return{label:{label:T,description:w.detail},insertText:w.executeImmediately?"":`${T} `,documentation:w.detail,range:v,sortText:w.sortText??"a".repeat(k+1),kind:18,command:w.executeImmediately?{id:SA.ID,title:T,arguments:[{widget:g,inputValue:`${T} `}]}:void 0}})}:null}})),this._register(this.languageFeaturesService.completionProvider.register({scheme:Y.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"globalSlashCommandsAt",triggerCharacters:[vg],provideCompletionItems:async(c,u,p,h)=>{let g=this.chatWidgetService.getWidgetByInputUri(c.uri);if(!g||!g.viewModel)return null;let f=TA(c,u,/@\w*/g);if(!f)return null;if(!phe(c,f))return;let v=this.chatSlashCommandService.getCommands(g.location,g.input.currentModeKind);return!v||g.lockedAgentId?null:{suggestions:v.map((b,S)=>{let y=`${yu}${b.command}`;return{label:{label:y,description:b.detail},insertText:b.executeImmediately?"":`${y} `,documentation:b.detail,range:f,filterText:`${vg}${b.command}`,sortText:b.sortText??"z".repeat(S+1),kind:18,command:b.executeImmediately?{id:SA.ID,title:y,arguments:[{widget:g,inputValue:`${y} `}]}:void 0}})}}})),this._register(this.languageFeaturesService.completionProvider.register({scheme:Y.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"promptSlashCommands",triggerCharacters:[yu],provideCompletionItems:async(c,u,p,h)=>{let g=this.chatWidgetService.getWidgetByInputUri(c.uri);if(!g||!g.viewModel)return null;let f=TA(c,u,$Ei);if(!f)return null;if(!phe(c,f)||g.parsedInput.parts.find(w=>w instanceof zu))return;let S=await this.promptsService.getPromptSlashCommands(h);if(S.length===0||g.lockedAgentId&&!g.attachmentCapabilities.supportsPromptAttachments)return null;let y=S.filter(w=>{if(g.lockedAgentId){if(w.promptPath.extension)return!1;try{let k=TMe(w.promptPath.uri);if(k&&k==="hook")return!1}catch{}}return!0}).filter(w=>w.parsedPromptFile?.header?.userInvocable!==!1);return y.length===0?null:{suggestions:y.map((w,k)=>{let T=`/${w.name}`,N=w.description;return{label:{label:T,description:N},insertText:`${T} `,documentation:w.description,range:f,sortText:"a".repeat(k+1),kind:18}})}}})),this._register(this.languageFeaturesService.completionProvider.register({scheme:Y.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"mcpPromptSlashCommands",triggerCharacters:[yu],provideCompletionItems:async(c,u,p,h)=>{let g=this.chatWidgetService.getWidgetByInputUri(c.uri);if(!g||!g.viewModel)return null;let f=TA(c,u,/\/[\p{L}0-9_.-]*/gu);if(!f)return null;if(phe(c,f))return g.lockedAgentId?null:{suggestions:l.servers.get().flatMap(v=>v.prompts.get().map(b=>{let S=`/mcp.${b.id}`;return{label:{label:S,description:b.description},command:{id:JUt.ID,title:b.name,arguments:[c,v,b,`${S} `]},insertText:`${S} `,range:f,kind:18}}))}}}))}};hit=I([m(0,zt),m(1,At),m(2,FO),m(3,nr),m(4,Si),m(5,Ls),m(6,es)],hit);oe.as(Qi.Workbench).registerWorkbenchContribution(hit,4);var git=class extends C{constructor(e,t,o,n,r){super();this.languageFeaturesService=e;this.chatWidgetService=t;this.chatAgentService=o;this.chatAgentNameService=n;this.chatSessionsService=r;let s={_debugDisplayName:"chatAgentSubcommand",triggerCharacters:[yu],provideCompletionItems:async(l,c,u,p)=>{let h=this.chatWidgetService.getWidgetByInputUri(l.uri);if(!h||!h.viewModel)return;let g=TA(l,c,$Ei);if(!g)return;let f=this.getCurrentAgentForWidget(h);if(!(!f||f.command))return{suggestions:f.agent.slashCommands.map((v,b)=>{let S=`/${v.name}`;return{label:S,insertText:`${S} `,documentation:v.description,range:g,kind:18}})}}};this._register(this.languageFeaturesService.completionProvider.register({scheme:Y.vscodeChatInput,hasAccessToAllModels:!0},s)),this._register(this.languageFeaturesService.completionProvider.register({scheme:Y.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"chatAgentAndSubcommand",triggerCharacters:[vg],provideCompletionItems:async(l,c,u,p)=>{let h=this.chatWidgetService.getWidgetByInputUri(l.uri),g=h?.viewModel;if(!h||!g)return;if(h.lockedAgentId)return null;let f=TA(l,c,GEi);if(!f)return null;if(!phe(l,f))return;let v=this.chatAgentService.getAgents().filter(T=>T.locations.includes(h.location)),b=this.chatSessionsService.getAllChatSessionContributions(),S=new Set(b.map(T=>T.type)),y=v.filter(T=>!S.has(T.id)),w=(T,N)=>{let O=T.id==="github.copilot.terminalPanel"?"0000":"";return`${vg}${O}${T.name}.${N}`};return{suggestions:v.filter(T=>!T.isDefault).filter(T=>!S.has(T.id)).map(T=>{let{label:N,isDupe:O}=this.getAgentCompletionDetails(T),V=T.description;return{label:O?{label:N,description:T.description,detail:` (${T.publisherDisplayName})`}:N,documentation:V,filterText:`${vg}${T.name}`,insertText:`${N} `,range:f,kind:18,sortText:`${vg}${T.name}`,command:{id:Z3.ID,title:Z3.ID,arguments:[{agent:T,widget:h}]}}}).concat(si(y.flatMap(T=>T.slashCommands.map((N,O)=>{if(T.isDefault&&this.chatAgentService.getDefaultAgent(h.location,h.input.currentModeKind)?.id!==T.id)return;let{label:V,isDupe:U}=this.getAgentCompletionDetails(T),G=`${V} ${yu}${N.name}`,$={label:U?{label:G,description:N.description,detail:U?` (${T.publisherDisplayName})`:void 0}:G,documentation:N.description,filterText:w(T,N.name),commitCharacters:[" "],insertText:G+" ",range:f,kind:18,sortText:`x${vg}${T.name}${N.name}`,command:{id:Z3.ID,title:Z3.ID,arguments:[{agent:T,widget:h}]}};if(T.isDefault){let te=`${yu}${N.name}`;$.label=te,$.insertText=`${te} `,$.documentation=N.description}return $}))))}}})),this._register(this.languageFeaturesService.completionProvider.register({scheme:Y.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"chatAgentAndSubcommand",triggerCharacters:[yu],provideCompletionItems:async(l,c,u,p)=>{let h=this.chatWidgetService.getWidgetByInputUri(l.uri),g=h?.viewModel;if(!h||!g)return;if(h.lockedAgentId)return null;let f=TA(l,c,GEi);if(!f)return null;if(!phe(l,f))return;let v=this.chatAgentService.getAgents().filter(b=>b.locations.includes(h.location)&&b.modes.includes(h.input.currentModeKind)).filter(b=>!this.chatSessionsService.getChatSessionContribution(b.id));return{suggestions:si(v.flatMap(b=>b.slashCommands.map((S,y)=>{if(b.isDefault&&this.chatAgentService.getDefaultAgent(h.location,h.input.currentModeKind)?.id!==b.id)return;let{label:w,isDupe:k}=this.getAgentCompletionDetails(b),T=`${yu}${S.name}`,N=b.id==="github.copilot.terminalPanel"?"z":"",O=`${yu}${N}${b.name}${S.name}`,V={label:{label:T,description:w,detail:k?` (${b.publisherDisplayName})`:void 0},commitCharacters:[" "],insertText:`${w} ${T} `,documentation:`(${w}) ${S.description??""}`,range:f,kind:18,sortText:O,command:{id:Z3.ID,title:Z3.ID,arguments:[{agent:b,widget:h}]}};if(b.isDefault){let U=`${yu}${S.name}`;V.label=U,V.insertText=`${U} `,V.documentation=S.description}return V})))}}})),this._register(this.languageFeaturesService.completionProvider.register({scheme:Y.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"installChatExtensions",triggerCharacters:[vg],provideCompletionItems:async(l,c,u,p)=>{if(!l.getLineContent(1).startsWith(vg))return;let h=this.chatWidgetService.getWidgetByInputUri(l.uri);if(h?.location!=="panel"||h.input.currentModeKind!=="ask")return;if(h.lockedAgentId)return null;let g=TA(l,c,GEi);if(!g||!phe(l,g))return;let f=d(7434,null);return{suggestions:[{label:f,insertText:"",range:g,kind:18,command:{id:"workbench.extensions.search",title:"",arguments:["@tag:chat-participant"]},filterText:vg+f,sortText:"zzz"}]}}}))}getCurrentAgentForWidget(e){if(e.lockedAgentId){let s=this.chatAgentService.getAgent(e.lockedAgentId);return s&&{agent:s}}let t=e.parsedInput.parts,o=t.findIndex(s=>s instanceof zu);if(o<0)return;let n=t[o],r=t.find(s=>s instanceof Pf||s instanceof Qx);if(r)return{agent:n.agent,command:r instanceof Pf?r.command.name:void 0};for(let s of t.slice(o+1))if(!(s instanceof pb)||!s.text.trim().match(/^(\/[\p{L}0-9_.:-]*)?$/u))return;return{agent:n.agent}}getAgentCompletionDetails(e){let t=this.chatAgentNameService.getAgentNameRestriction(e),o=`${vg}${t?e.name:Hj(e)}`,n=t&&this.chatAgentService.agentHasDupeName(e.id);return{label:o,isDupe:n}}};git=I([m(0,zt),m(1,At),m(2,br),m(3,mz),m(4,Ls)],git);oe.as(Qi.Workbench).registerWorkbenchContribution(git,4);var Z3=class a extends K{static{this.ID="workbench.action.chat.assignSelectedAgent"}constructor(){super({id:a.ID,title:""})}async run(i,...e){let t=e[0];!t||!t.widget||!t.agent||(t.agent.modes.includes(t.widget.input.currentModeKind)||t.widget.input.setChatMode(t.agent.modes[0]),t.widget.lastSelectedAgent=t.agent)}};W(Z3);var JUt=class a extends K{static{this.ID="workbench.action.chat.startParameterizedPrompt"}constructor(){super({id:a.ID,title:""})}async run(i,e,t,o,n){if(!e||!o)return;let r=i.get(F),s=i.get(Ne),l=i.get(At),c=i.get(be),u=await l.revealWidget(!0);if(!u)return;let p=e.getFullModelRange().collapseToEnd(),h=()=>e.findMatches(n,!0,!1,!0,null,!1)[0],g=S=>e.applyEdits([{range:h()?.range||p,text:S}]),f=new P,v=f.add(new $e);f.add(u.input.startGenerating()),f.add(e.onDidChangeContent(()=>{h()&&v.cancel()})),e.changeDecorations(S=>{let y=S.addDecoration(p,{description:"mcp-prompt-spinner",showIfCollapsed:!0,after:{content:" ",inlineClassNameAffectsLetterSpacing:!0,inlineClassName:q.asClassName(q.modify(M.loading,"spin"))+" chat-prompt-spinner"}});f.add(Z(()=>{e.changeDecorations(w=>w.removeDecoration(y))}))});let b=f.add(r.createInstance(JAe,o));try{await t.start();let S=await b.createArgs();if(!S){g("");return}let y;try{y=await o.resolve(S,v.token)}catch(O){v.token.isCancellationRequested||s.error(d(7435,null,String(O))),g("");return}let w=[],k=async(O,V,U,G=!1)=>{let $;if(U)for(let te of[A.parse(U),uw.fromServer(t.definition,U)])try{$||=await c.exists(te)?te:void 0}catch{}if(G)$?w.push({id:_t(),kind:"file",value:$,name:Ye($)}):w.push({id:_t(),kind:"generic",value:V,name:d(7437,null)});else if(O&&X4(O)){let te=await k_(V).catch(()=>Sl(V).buffer);u.attachmentModel.addContext({id:_t(),name:d(7436,null),fullName:d(7436,null),value:te,kind:"image",references:$&&[{reference:$,kind:"reference"}]})}else $&&w.push({id:_t(),kind:"file",value:$,name:Ye($)})},T=y.some(O=>O.role!==y[0].role),N="";for(let O of y)switch(O.content.type){case"text":N&&(N+=`
`),T&&(N+=`--${O.role.toUpperCase()}
`),N+=O.content.text;break;case"resource":"text"in O.content.resource?await k(O.content.resource.mimeType,O.content.resource.text,O.content.resource.uri,!0):await k(O.content.resource.mimeType,O.content.resource.blob,O.content.resource.uri);break;case"image":case"audio":await k(O.content.mimeType,O.content.data);break}w.length&&u.attachmentModel.addContext(...w),g(N)}finally{f.dispose()}}};W(JUt);var SNe=class{constructor(i,e){this.widget=i;this.variable=e}},EA=class extends C{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.historyService=e;this.workspaceContextService=t;this.searchService=o;this.labelService=n;this.languageFeaturesService=r;this.chatWidgetService=s;this.outlineService=l;this.editorService=c;this.configurationService=u;this.codeEditorService=p;this.chatAgentService=h;this.instantiationService=g;this.chatDebugService=f;let v=new RegExp(`${su}[^\\s]*`,"g");this.registerVariableCompletions("fileAndFolder",async({widget:b,range:S},y)=>{if(!b.supportsFileReferences)return;let w={suggestions:[]};if(b.lockedAgentId){let k=this.chatAgentService.getAgent(b.lockedAgentId);if(k&&!k.capabilities?.supportsFileAttachments)return w}return await this.addFileAndFolderEntries(b,w,S,y),w},v),this.registerVariableCompletions("selection",({widget:b,range:S},y)=>{if(!b.supportsFileReferences||b.location==="editor")return;let w=this.findActiveCodeEditor();if(!pn(w))return;let k=w.getModel()?.uri,T=w.getSelection();if(!T||!k||T.isEmpty())return;let N=this.labelService.getUriBasenameLabel(k),O=`${su}file:${N}:${T.startLineNumber}-${T.endLineNumber}`,V=`:${T.startLineNumber}:${T.startColumn}-${T.endLineNumber}:${T.endColumn}`,U=this.labelService.getUriLabel(k,{relative:!0})+V,G={suggestions:[]};return G.suggestions.push({label:{label:`${su}selection`,description:U},filterText:`${su}selection`,insertText:S.varWord?.endColumn===S.replace.endColumn?`${O} `:O,range:S,kind:18,sortText:"z",command:{id:EA.addReferenceCommand,title:"",arguments:[new SNe(b,{id:"vscode.selection",isFile:!0,range:{startLineNumber:S.replace.startLineNumber,startColumn:S.replace.startColumn,endLineNumber:S.replace.endLineNumber,endColumn:S.replace.startColumn+O.length},data:{range:T,uri:k}})]}}),G}),this.registerVariableCompletions("symbol",({widget:b,range:S,position:y,model:w},k)=>{if(!b.supportsFileReferences)return null;let T={suggestions:[]},N=TA(w,y,new RegExp(`${su}[^\\s]*`,"g"),!0);return N&&this.addSymbolEntries(b,T,N,k),T}),this.registerVariableCompletions("debugEventsSnapshot",({widget:b,range:S})=>{if(b.location!=="panel")return;let y=b.viewModel?.sessionResource;if(!y||this.chatDebugService.getEvents(y).length===0)return;let w=`${su}debugEventsSnapshot`,k={suggestions:[]};return k.suggestions.push({label:{label:w,description:d(7432,null)},filterText:w,insertText:"",range:S,kind:18,sortText:"z",command:{id:EA.addDebugEventsSnapshotCommand,title:"",arguments:[b]}}),k}),this._register(qe.registerCommand(EA.addReferenceCommand,(b,S)=>(So(S instanceof SNe),this.cmdAddReference(S)))),this._register(qe.registerCommand(EA.addDebugEventsSnapshotCommand,async(b,S)=>{let y=S.viewModel?.sessionResource;if(!y)return;let w=await bNe(y,this.chatDebugService);S.attachmentModel.addContext(w)}))}static{this.addReferenceCommand="_addReferenceCmd"}static{this.addDebugEventsSnapshotCommand="_addDebugEventsSnapshotCmd"}static{this.VariableNameDef=new RegExp(`${su}[\\w:-]*`,"g")}findActiveCodeEditor(){let e=this.codeEditorService.getActiveCodeEditor();if(e){let t=e.getModel();if(t?.uri.scheme===Y.vscodeNotebookCell)return;if(t)return e}for(let t of this.editorService.getVisibleTextEditorControls(0)){let o=ca(t);if(!o)continue;if(o.getModel())return o}}registerVariableCompletions(e,t,o=EA.VariableNameDef){this._register(this.languageFeaturesService.completionProvider.register({scheme:Y.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:`chatVarCompletions-${e}`,triggerCharacters:[su],provideCompletionItems:async(n,r,s,l)=>{let c=this.chatWidgetService.getWidgetByInputUri(n.uri);if(!c)return;let u=TA(n,r,o,!0);if(u)return t({model:n,position:r,widget:c,range:u,context:s},l)}}))}async addFileAndFolderEntries(e,t,o,n){let r=(u,p,h,g)=>{let f=this.labelService.getUriBasenameLabel(u),v=`${su}file:${f}`,b=this.labelService.getUriLabel(u,{relative:!0}),S=h?d(7433,null,b,h):b,y=g?" ":"!";return{label:{label:f,description:S},filterText:`${su}${f}`,insertText:o.varWord?.endColumn===o.replace.endColumn?`${v} `:v,range:o,kind:p===0?20:23,sortText:y,command:{id:EA.addReferenceCommand,title:"",arguments:[new SNe(e,{id:u.toString(),isFile:p===0,isDirectory:p===1,range:{startLineNumber:o.replace.startLineNumber,startColumn:o.replace.startColumn,endLineNumber:o.replace.endLineNumber,endColumn:o.replace.startColumn+v.length},data:u})]}}},s;o.varWord?.word&&o.varWord.word.startsWith(su)&&(s=o.varWord.word.toLowerCase().slice(1));let l=new Mn,c=t.suggestions.length;for(let[u,p]of this.historyService.getHistory().entries()){let h=Lj(p)?p.modified.resource:p.resource;if(!h||l.has(h)||!this.instantiationService.invokeFunction(f=>oke(f,h.scheme)))continue;if(s){let f=this.labelService.getUriBasenameLabel(h).toLowerCase();if(!Jqe(s,0,s.length,f,0,f.length))continue}if(l.add(h),t.suggestions.push(r(h,0,u===0?d(7431,null):void 0,u===0))-c>=5)break}if(s){let u=this.updateCacheKey(),p=this.workspaceContextService.getWorkspace().folders.map(h=>h.uri);for(let h of p){let{folders:g,files:f}=await KEi(h,s,!0,n,u.key,this.configurationService,this.searchService);for(let v of f)l.has(v)||(t.suggestions.push(r(v,0)),l.add(v));for(let v of g)l.has(v)||(t.suggestions.push(r(v,1)),l.add(v))}}t.incomplete=!0}addSymbolEntries(e,t,o,n){let s=new En,l=(h,g)=>{let f=`${su}sym:${h.name}`,v=h.location.uri,b=this.labelService.getUriLabel(v,{relative:!0}),S=g?"{":"|";return{label:{label:h.name,description:b},filterText:`${su}${h.name}`,insertText:o.varWord?.endColumn===o.replace.endColumn?`${f} `:f,range:o,kind:sh.toCompletionKind(h.kind),sortText:S,command:{id:EA.addReferenceCommand,title:"",arguments:[new SNe(e,{id:`vscode.symbol/${JSON.stringify(h.location)}`,fullName:h.name,range:{startLineNumber:o.replace.startLineNumber,startColumn:o.replace.startColumn,endLineNumber:o.replace.endLineNumber,endColumn:o.replace.startColumn+f.length},data:h.location,icon:sh.toIcon(h.kind)})]}}},c;o.varWord?.word&&o.varWord.word.startsWith(su)&&(c=o.varWord.word.toLowerCase().slice(1));let u=[];for(let h of this.outlineService.getCachedModels()){let g=h.asListOfDocumentSymbols();for(let f of g)u.push({symbol:f,uri:h.uri})}let p=!1;for(let h of u){if(s.elapsed()>100||n.isCancellationRequested){p=!0;break}t.suggestions.push(l({...h.symbol,location:{uri:h.uri,range:h.symbol.range}},c??""))}t.incomplete=!!c||p}updateCacheKey(){return this.cacheKey&&Date.now()-this.cacheKey.time>6e4&&(this.searchService.clearCache(this.cacheKey.key),this.cacheKey=void 0),this.cacheKey||(this.cacheKey={key:_t(),time:Date.now()}),this.cacheKey.time=Date.now(),this.cacheKey}cmdAddReference(e){e.widget.getContrib(JS.ID)?.addReference(e.variable)}};EA=I([m(0,zs),m(1,Pe),m(2,Jp),m(3,ot),m(4,zt),m(5,At),m(6,f_),m(7,ee),m(8,B),m(9,Kt),m(10,br),m(11,F),m(12,em)],EA);oe.as(Qi.Workbench).registerWorkbenchContribution(EA,4);function TA(a,i,e,t=!1){let o=My(i.column,e,a.getLineContent(i.lineNumber),0);if(!o&&a.getWordUntilPosition(i).word||!o&&i.column>1&&a.getValueInRange(new z(i.lineNumber,i.column-1,i.lineNumber,i.column))!==" "||o&&t&&a.getWordUntilPosition({lineNumber:i.lineNumber,column:o.startColumn}).word)return;let n,r;return o?(n=new z(i.lineNumber,o.startColumn,i.lineNumber,i.column),r=new z(i.lineNumber,o.startColumn,i.lineNumber,o.endColumn)):n=r=z.fromPositions(i),{insert:n,replace:r,varWord:o}}function phe(a,i){let e=new z(1,1,i.replace.startLineNumber,i.replace.startColumn);return!!a.getValueInRange(e).match(/^\s*$/)}var mhe=class extends C{constructor(e,t,o){super();this.languageFeaturesService=e;this.chatWidgetService=t;this.chatAgentService=o;this._register(this.languageFeaturesService.completionProvider.register({scheme:Y.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"chatVariables",triggerCharacters:[su],provideCompletionItems:async(n,r,s,l)=>{let c=this.chatWidgetService.getWidgetByInputUri(n.uri);if(!c)return null;if(c.lockedAgentId){let f=this.chatAgentService.getAgent(c.lockedAgentId);if(f&&!f.capabilities?.supportsToolAttachments)return null}let u=TA(n,r,mhe.VariableNameDef,!0);if(!u)return null;let p=new Set;for(let f of c.parsedInput.parts)f instanceof ZS?p.add(f.toolName):f instanceof OO&&p.add(f.name);let h=[],g=c.input.selectedToolsModel.entriesMap.get();for(let[f,v]of g){if(!v)continue;let b,S,y;if(Km(f))b=f.description,y=f.referenceName;else{let k=f.source;b=d(7438,null,k.label,f.displayName),y=f.toolReferenceName??f.displayName,S=f.userDescription??f.modelDescription}if(p.has(y))continue;let w=`${su}${y}`;h.push({label:w,range:u,detail:b,documentation:S,insertText:w+" ",kind:27})}return{suggestions:h}}}))}static{this.VariableNameDef=new RegExp(`(?<=^|\\s)${su}\\w*`,"g")}};mhe=I([m(0,zt),m(1,At),m(2,br)],mhe);oe.as(Qi.Workbench).registerWorkbenchContribution(mhe,4);var hhe=new Q("notebookChatAgentRegistered",!1,d(11769,null));async function igo(a,i,e,t,o,n){let r=a.get(B),s=a.get(ge);if(r.getValue(ft.cellGenerate)||r.getValue(ft.cellChat)){let l=i.notebookEditor.getActiveCell(),c=l?.getTextLength()===0&&n!=="insertToolbar"?l:await Awi(a,i,2,"below",!0);if(c){c.enableAutoLanguageDetection(),await i.notebookEditor.revealFirstLineIfOutsideViewport(c);let u=i.notebookEditor.codeEditors.find(p=>p[0]===c)?.[1];u&&(u.focus(),s.executeCommand("inlineChat.start"))}}}W(class extends qu{constructor(){super({id:"notebook.cell.chat.start",title:{value:"$(sparkle) "+d(11761,null),original:"$(sparkle) Generate"},tooltip:d(11762,null),metadata:{description:d(11762,null),args:[{name:"args",schema:{type:"object",required:["index"],properties:{index:{type:"number"},input:{type:"string"},autoSend:{type:"boolean"}}}}]},f1:!1,keybinding:{when:x.and(rr,Kl.isEqualTo(!0),x.not(Uu),hhe,x.or(x.equals(`config.${ft.cellChat}`,!0),x.equals(`config.${ft.cellGenerate}`,!0))),weight:200,primary:2087,secondary:[Ai(2089,39)]},menu:[{id:D.NotebookCellBetween,group:"inline",order:-1,when:x.and(Kl.isEqualTo(!0),hhe,x.or(x.equals(`config.${ft.cellChat}`,!0),x.equals(`config.${ft.cellGenerate}`,!0)))}]})}getEditorContextFromArgsOrActive(a,...i){let[e]=i;if(!e){let n=iRe(a);if(!n)return;let r=n.getActiveCell();return r?{cell:r,notebookEditor:n,input:void 0,autoSend:void 0}:void 0}if(typeof e!="object"||typeof e.index!="number")return;let t=iRe(a);return t?{cell:e.index<=0?void 0:t.cellAt(e.index-1),notebookEditor:t,input:e.input,autoSend:e.autoSend}:void 0}async runWithContext(a,i){let e=Math.max(0,i.cell?i.notebookEditor.getCellIndex(i.cell)+1:0);await igo(a,i,e,i.input,i.autoSend,i.source)}});W(class extends qu{constructor(){super({id:"notebook.cell.chat.startAtTop",title:{value:"$(sparkle) "+d(11761,null),original:"$(sparkle) Generate"},tooltip:d(11762,null),f1:!1,menu:[{id:D.NotebookCellListTop,group:"inline",order:-1,when:x.and(Kl.isEqualTo(!0),hhe,x.or(x.equals(`config.${ft.cellChat}`,!0),x.equals(`config.${ft.cellGenerate}`,!0)))}]})}async runWithContext(a,i){await igo(a,i,0,"",!1)}});fe.appendMenuItem(D.NotebookToolbar,{command:{id:"notebook.cell.chat.start",icon:M.sparkle,title:d(11759,null),tooltip:d(11760,null)},order:-10,group:"navigation/add",when:x.and(Kl.isEqualTo(!0),x.notEquals("config.notebook.insertToolbarLocation","betweenCells"),x.notEquals("config.notebook.insertToolbarLocation","hidden"),hhe,x.or(x.equals(`config.${ft.cellChat}`,!0),x.equals(`config.${ft.cellGenerate}`,!0)))});var qEi=class extends wl{constructor(){super({id:"notebook.inlineChat.acceptChangesAndRun",title:L(11756,"Accept and Run"),shortTitle:d(11757,null),tooltip:d(11758,null),icon:M.check,f1:!0,precondition:x.and(Kl.isEqualTo(!0),OZe),keybinding:void 0,menu:[{id:FVt,group:"0_main",order:2,when:x.and(Kl.isEqualTo(!0),ie.inputHasText.toNegated(),Vco.toNegated(),Bco.isEqualTo("messagesAndEdits"))}]})}runEditorCommand(i,e){let t=Epe(i.get(ee)),o=_m.get(e);if(!t||!o)return;let r=t.notebookEditor.codeEditors.find(s=>s[1]===e)?.[0];if(r)return o.acceptSession(),t.notebookEditor.executeNotebookCells(ht.single(r))}};W(qEi);var ZUt="kernelVariable",INe=class extends C{constructor(e,t,o,n,r,s,l){super();this.editorService=o;this.chatWidgetService=n;this.notebookKernelService=r;this.languageFeaturesService=s;this._register(l.registerChatContextItem(new fit(this.editorService,this.notebookKernelService))),this._ctxHasProvider=hhe.bindTo(e);let c=()=>{let u=!!t.getDefaultAgent("notebook");this._ctxHasProvider.set(u)};c(),this._register(t.onDidChangeAgents(c)),this._register(this.languageFeaturesService.completionProvider.register({scheme:Y.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"chatKernelDynamicCompletions",triggerCharacters:[su],provideCompletionItems:async(u,p,h,g)=>{let f=this.chatWidgetService.getWidgetByInputUri(u.uri);if(!f||!f.supportsFileReferences||f.location!=="notebook")return null;let v=new RegExp(`${su}\\w*`,"g"),b=TA(u,p,v,!0);if(!b)return null;let S={suggestions:[]},y=new z(p.lineNumber,b.replace.startColumn,p.lineNumber,b.replace.startColumn+`${su}${ZUt}:`.length);return S.suggestions.push({label:`${su}${ZUt}`,insertText:`${su}${ZUt}:`,detail:d(11767,null),range:b,kind:18,command:{id:ghe.ID,title:ghe.ID,arguments:[{widget:f,range:y}]},sortText:"z"}),await this.addKernelVariableCompletion(f,S,b,g),S}})),yyi.bindTo(e).set($Ze)}static{this.ID="workbench.contrib.notebookChatContribution"}async addKernelVariableCompletion(e,t,o,n){let r;o.varWord?.word&&o.varWord.word.startsWith(su)&&(r=o.varWord.word.toLowerCase().slice(1));let s=qn(this.editorService.activeEditorPane)?.getViewModel()?.notebookDocument;if(!s)return;let l=this.notebookKernelService.getMatchingKernel(s).selected;if(!l?.hasVariableProvider)return;let u=l.provideVariables(s.uri,void 0,"named",0,ve.None);for await(let p of u)r&&!p.name.toLowerCase().includes(r)||t.suggestions.push({label:{label:p.name,description:p.type},insertText:`${su}${ZUt}:${p.name} `,filterText:`${su}${p.name}`,range:o,kind:4,sortText:"z",command:{id:ghe.ID,title:ghe.ID,arguments:[{widget:e,range:o.insert,variable:p.name}]},detail:p.type,documentation:p.value})}};INe=I([m(0,X),m(1,br),m(2,ee),m(3,At),m(4,Tl),m(5,zt),m(6,uS)],INe);var ghe=class a extends K{constructor(){super({id:a.ID,title:""})}static{this.ID="notebook.chat.selectAndInsertKernelVariable"}async run(i,...e){let t=i.get(ee),o=i.get(Tl),n=i.get(Ge),r=qn(t.activeEditorPane)?.getViewModel()?.notebookDocument;if(!r)return;let s=e[0];if(!s||!("widget"in s)||!("range"in s))return;let l=s.widget,c=s.range,u=s.variable;if(u!==void 0){this.addVariableReference(l,u,c,!1);return}let p=o.getMatchingKernel(r).selected;if(!p?.hasVariableProvider)return;let g=p.provideVariables(r.uri,void 0,"named",0,ve.None),f=[];for await(let S of g)f.push({label:S.name,description:S.value,detail:S.type});let v=f.length>0?d(11768,null):d(11765,null),b=await n.pick(f,{placeHolder:v});b&&this.addVariableReference(l,b.label,c,!0)}addVariableReference(i,e,t,o){if(t){let n=`#kernelVariable:${e}`;if(o&&!i.inputEditor.executeEdits("chatInsertFile",[{range:t,text:n+" "}]))return;i.getContrib(JS.ID)?.addReference({id:"vscode.notebook.variable",range:{startLineNumber:t.startLineNumber,startColumn:t.startColumn,endLineNumber:t.endLineNumber,endColumn:t.startColumn+n.length},data:e,fullName:e,icon:R6.variable})}else i.attachmentModel.addContext({id:"vscode.notebook.variable",name:e,value:e,icon:R6.variable,kind:"generic"})}},fit=class{constructor(i,e){this.editorService=i;this.notebookKernelService=e;this.type="pickerPick";this.label=d(11763,null);this.icon=M.serverEnvironment}isEnabled(i){return i.location==="notebook"&&!!qn(this.editorService.activeEditorPane)?.getViewModel()?.notebookDocument}asPicker(){let i=(async()=>{let e=qn(this.editorService.activeEditorPane)?.getViewModel()?.notebookDocument;if(!e)return[];let t=this.notebookKernelService.getMatchingKernel(e).selected;if(!t?.hasVariableProvider)return[];let n=t.provideVariables(e.uri,void 0,"named",0,ve.None),r=[];for await(let s of n)r.push({label:s.name,description:s.value,asAttachment:()=>({kind:"generic",id:"vscode.notebook.variable",name:s.name,value:s.value,icon:R6.variable})});return r})();return{placeholder:d(11764,null),picks:i}}};fit=I([m(0,ee),m(1,Tl)],fit);W(class extends K{constructor(){super({id:"notebook.cellOutput.addToChat",title:d(11766,null),menu:{id:D.NotebookOutputToolbar,when:x.and(gk,x.in(XLe.key,yyi.key)),order:10,group:"notebook_chat_actions"},category:jm,icon:zJe,precondition:ie.enabled})}getNoteboookEditor(i,e){return e&&"notebookEditor"in e?e.notebookEditor:qn(i.activeEditorPane)}async run(i,e){let t=this.getNoteboookEditor(i.get(ee),e);if(!t)return;let o;if(e&&"outputId"in e&&typeof e.outputId=="string"?o=bZe(e.outputId,t):e&&"outputViewModel"in e&&(o=e.outputViewModel),!o){let l=t.getActiveCell();if(!l)return;l.focusedOutputId!==void 0?o=l.outputsViewModels.find(c=>c.model.outputId===l.focusedOutputId):o=l.outputsViewModels.find(c=>c.pickedMimeType?.isTrusted)}if(!o)return;let n=o.pickedMimeType?.mimeType,r=i.get(At),s=await r.revealWidget();if(s&&n&&$Ze.includes(n)){let l=zVt(o,n,t);if(!l)return;s.attachmentModel.addContext(l),(await r.revealWidget())?.focusInput()}}});W(ghe);pt(INe.ID,INe,ut.BlockRestore);var fhe=new Q("notebookVariableViewEnabled",!1);var lXo="notebook.openVariablesView";W(class extends qu{constructor(){super({id:lXo,title:L(11870,"Variables"),icon:DWt,menu:[{id:D.InteractiveToolbar,group:"navigation",when:x.and(tRe,x.notEquals("jupyter.kernel.isjupyter",!0),fhe)},{id:D.EditorTitle,order:-1,group:"navigation",when:x.and(tRe,x.notEquals("jupyter.kernel.isjupyter",!0),x.notEquals("config.notebook.globalToolbar",!0),fhe)},{id:D.NotebookToolbar,order:-1,group:"navigation",when:x.and(tRe,x.notEquals("jupyter.kernel.isjupyter",!0),x.equals("config.notebook.globalToolbar",!0),fhe)}]})}async runWithContext(i,e){i.get(Ft).openView("workbench.notebook.variables",!0)}});var jEi="workbench.editor.empty.hint",Ate=class extends C{constructor(e,t,o,n,r){super();this.editor=e;this.configurationService=t;this.inlineChatSessionService=o;this.chatAgentService=n;this.instantiationService=r;this._register(this.editor.onDidChangeModel(()=>this.update())),this._register(this.editor.onDidChangeModelLanguage(()=>this.update())),this._register(this.editor.onDidChangeModelContent(()=>this.update())),this._register(this.chatAgentService.onDidChangeAgents(()=>this.update())),this._register(this.editor.onDidChangeModelDecorations(()=>this.update())),this._register(this.editor.onDidChangeConfiguration(s=>{s.hasChanged(104)&&this.update()})),this._register(this.configurationService.onDidChangeConfiguration(s=>{s.affectsConfiguration(jEi)&&this.update()})),this._register(o.onWillStartSession(s=>{this.editor===s&&this.textHintContentWidget?.dispose()})),this._register(o.onDidChangeSessions(()=>{this.update()}))}static{this.ID="editor.contrib.emptyTextEditorHint"}shouldRenderHint(){if(this.configurationService.getValue(jEi)==="hidden"||this.editor.getOption(104))return!1;let t=this.editor.getModel(),o=t?.getLanguageId();if(!t||o===bEe||o===SEe||o===Vz||this.inlineChatSessionService.getSessionByTextModel(t.uri)||this.editor.getModel()?.getValueLength()||!!this.editor.getLineDecorations(1)?.find(l=>l.options.beforeContentClassName||l.options.afterContentClassName||l.options.before?.content||l.options.after?.content))return!1;let r=!!this.chatAgentService.getDefaultAgent("editor"),s=t?.uri.scheme===Y.untitled&&o===Fr;return r||s}update(){let e=this.shouldRenderHint();e&&!this.textHintContentWidget?this.textHintContentWidget=this.instantiationService.createInstance(vhe,this.editor):!e&&this.textHintContentWidget&&(this.textHintContentWidget.dispose(),this.textHintContentWidget=void 0)}dispose(){super.dispose(),this.textHintContentWidget?.dispose()}};Ate=I([m(1,B),m(2,Ik),m(3,br),m(4,F)],Ate);var vhe=class extends C{constructor(e,t,o,n,r,s,l){super();this.editor=e;this.commandService=t;this.configurationService=o;this.keybindingService=n;this.chatAgentService=r;this.telemetryService=s;this.contextMenuService=l;this.isVisible=!1;this.ariaLabel="";this._register(this.editor.onDidChangeConfiguration(u=>{this.domNode&&u.hasChanged(59)&&this.editor.applyFontInfo(this.domNode)}));let c=H.debounce(this.editor.onDidFocusEditorText,()=>{},500);this._register(c(()=>{this.editor.hasTextFocus()&&this.isVisible&&this.ariaLabel&&this.configurationService.getValue("accessibility.verbosity.emptyEditorHint")&&Or(this.ariaLabel)})),this.editor.addContentWidget(this)}static{this.ID="editor.widget.emptyHint"}getId(){return vhe.ID}disableHint(e){let t=()=>{this.configurationService.updateValue(jEi,"hidden"),this.dispose(),this.editor.focus()};if(!e){t();return}this.contextMenuService.showContextMenu({getAnchor:()=>new yn(Ki(),e),getActions:()=>[{id:"workench.action.disableEmptyEditorHint",label:d(8292,null),tooltip:d(8292,null),enabled:!0,class:void 0,run:()=>{t()}}]})}getHint(){let e=this.chatAgentService.getActivatedAgents().filter(h=>h.locations.includes("editor")).length>0,t={disposables:this._store,callback:(h,g)=>{switch(h){case"0":e?n(g.browserEvent):r(g.browserEvent);break;case"1":e?r(g.browserEvent):this.disableHint();break;case"2":this.disableHint();break}}},o="inlineChat.start",n=async h=>{h.stopPropagation(),this.telemetryService.publicLog2("workbenchActionExecuted",{id:o,from:"hint"}),await this.commandService.executeCommand(o,{from:"hint"})},r=async h=>{h.stopPropagation(),this.editor.focus(),this.telemetryService.publicLog2("workbenchActionExecuted",{id:bJ.ID,from:"hint"}),await this.commandService.executeCommand(bJ.ID),this.editor.focus()},l=[o,bJ.ID].map(h=>this.keybindingService.lookupKeybinding(h)?.getLabel()),c=(e?d(8294,null,l.at(0)??"",l.at(1)??""):d(8295,null,l.at(1)??"")).replaceAll(" ()",""),u=RL(c,{actionHandler:t,renderCodeSegments:!1});u.style.fontStyle="italic";let p=e?d(8290,null,...l):d(8291,null,...l);for(let h of u.querySelectorAll("a"))h.style.cursor="pointer";return{hintElement:u,ariaLabel:p}}getDomNode(){if(!this.domNode){this.domNode=_(".empty-editor-hint"),this.domNode.style.width="max-content",this.domNode.style.paddingLeft="4px";let{hintElement:e,ariaLabel:t}=this.getHint();this.domNode.append(e),this.ariaLabel=t.concat(d(8293,null,"accessibility.verbosity.emptyEditorHint")),this._register(j(this.domNode,"click",()=>{this.editor.focus()})),this.editor.applyFontInfo(this.domNode);let o=this.editor.getLineHeightForPosition(new Ie(1,1));this.domNode.style.lineHeight=o+"px"}return this.domNode}getPosition(){return{position:{lineNumber:1,column:1},preference:[0]}}dispose(){super.dispose(),this.editor.removeContentWidget(this)}};vhe=I([m(1,ge),m(2,B),m(3,_e),m(4,br),m(5,Te),m(6,ze)],vhe);go(Ate.ID,Ate,0);var yNe=class extends Ate{constructor(e,t,o,n,r,s){super(e,o,n,r,s);this._editorService=t;let l=qn(this._editorService.activeEditorPane);l&&this._register(l.onDidChangeActiveCell(()=>this.update()))}static{this.CONTRIB_ID="notebook.editor.contrib.emptyCellEditorHint"}shouldRenderHint(){let e=this.editor.getModel();if(!e||!(e?.uri.scheme===Y.vscodeNotebookCell))return!1;let o=qn(this._editorService.activeEditorPane);return!(!o||!o.isDisposed||!super.shouldRenderHint()||o.getActiveCell()?.uri.fragment!==e.uri.fragment)}};yNe=I([m(1,ee),m(2,B),m(3,Ik),m(4,br),m(5,F)],yNe);go(yNe.CONTRIB_ID,yNe,0);var e1t=!1;function dXo(){e1t=!e1t}function e8(a,i){e1t&&a.info(`[NotebookClipboard]: ${i}`)}function ogo(a){let i=a.get(ne),e=a.get(ee),t=qn(e.activeEditorPane);if(!t){e8(i,"[Revive Webview] No notebook editor found for active editor pane, bypass");return}if(!t.hasEditorFocus()){e8(i,"[Revive Webview] Notebook editor is not focused, bypass");return}if(!t.hasWebviewFocus()){e8(i,"[Revive Webview] Notebook editor backlayer webview is not focused, bypass");return}let o=t.getViewModel();if(!(o&&o.viewCells.every(n=>!n.outputIsFocused&&!n.outputIsHovered)))return{editor:t,loggerService:i}}function uXo(a){let i=ogo(a);if(!i)return;let e=i.editor.getInnerWebview();return e8(i.loggerService,"[Revive Webview] Notebook editor backlayer webview is focused"),e}function vit(a,i){let e=uXo(a);return e?(i(e),!0):!1}function pXo(a,i){let e=ogo(a);return e?i(e.editor):!1}var bit=105;BT.addImplementation(bit,"notebook-webview",a=>vit(a,i=>i.undo()));HT.addImplementation(bit,"notebook-webview",a=>vit(a,i=>i.redo()));$M?.addImplementation(bit,"notebook-webview",a=>vit(a,i=>i.copy()));GM?.addImplementation(bit,"notebook-webview",a=>vit(a,i=>i.paste()));EW?.addImplementation(bit,"notebook-webview",a=>vit(a,i=>i.cut()));function ngo(a,i,e){if(!a.hasModel())return!1;let t=a.textModel;if(a.isReadOnly)return!1;let o={kind:1,focus:a.getFocus(),selections:a.getSelections()};if(i){let n=a.getCellIndex(i),r=typeof n=="number"?n+1:0;t.applyEdits([{editType:1,index:r,count:0,cells:e.items.map(s=>jK(s))}],!0,o,()=>({kind:1,focus:{start:r,end:r+1},selections:[{start:r,end:r+e.items.length}]}),void 0,!0)}else{if(a.getLength()!==0)return!1;t.applyEdits([{editType:1,index:0,count:0,cells:e.items.map(n=>jK(n))}],!0,o,()=>({kind:1,focus:{start:0,end:1},selections:[{start:1,end:e.items.length+1}]}),void 0,!0)}return!0}function rgo(a,i,e){if(!i.hasModel())return!1;if(i.hasOutputTextSelection())return Me(i.getDomNode()).document.execCommand("copy"),!0;let t=a.get(Wi),o=a.get(un),n=i.getSelections();if(e){let l=i.getCellIndex(e);if(!n.find(u=>u.start<=l&&l<u.end))return t.writeText(e.getText()),o.setToCopy([e.model],!0),!0}let r=wY(i,i.getSelections()),s=_8e(i,r);return s.length?(t.writeText(s.map(l=>l.getText()).join(`
`)),o.setToCopy(s.map(l=>l.model),!0),!0):!1}function sgo(a,i,e){if(!i.hasModel()||i.isReadOnly)return!1;let t=i.textModel,o=a.get(Wi),n=a.get(un),r=i.getSelections();if(e){let f=i.getCellIndex(e);if(!r.find(b=>b.start<=f&&f<b.end)){o.writeText(e.getText());let b=i.getFocus(),S=b.end<=f?b:{start:b.start-1,end:b.end-1},y=r.map(w=>w.end<=f?w:{start:w.start-1,end:w.end-1});return t.applyEdits([{editType:1,index:f,count:1,cells:[]}],!0,{kind:1,focus:i.getFocus(),selections:r},()=>({kind:1,focus:S,selections:y}),void 0,!0),n.setToCopy([e.model],!1),!0}}let s=i.getFocus();if(!r.find(f=>f.start<=s.start&&s.end<=f.end)){let f=i.cellAt(s.start);o.writeText(f.getText());let v=s.end===i.getLength()?{start:s.start-1,end:s.end-1}:s,b=r.map(S=>S.end<=s.start?S:{start:S.start-1,end:S.end-1});return t.applyEdits([{editType:1,index:s.start,count:1,cells:[]}],!0,{kind:1,focus:i.getFocus(),selections:r},()=>({kind:1,focus:v,selections:b}),void 0,!0),n.setToCopy([f.model],!1),!0}let c=wY(i,i.getSelections()),u=_8e(i,c);if(!u.length)return!1;o.writeText(u.map(f=>f.getText()).join(`
`));let p=c.map(f=>({editType:1,index:f.start,count:f.end-f.start,cells:[]})),h=c[0].start,g=h<t.cells.length-1?h:Math.max(t.cells.length-2,0);return t.applyEdits(p,!0,{kind:1,focus:i.getFocus(),selections:c},()=>({kind:1,focus:{start:g,end:g+1},selections:[{start:g,end:g+1}]}),void 0,!0),n.setToCopy(u.map(f=>f.model),!1),!0}var wNe=class extends C{constructor(e){super();this._editorService=e;let t=105;$M&&this._register($M.addImplementation(t,"notebook-clipboard",o=>this.runCopyAction(o))),GM&&this._register(GM.addImplementation(t,"notebook-clipboard",o=>this.runPasteAction(o))),EW&&this._register(EW.addImplementation(t,"notebook-clipboard",o=>this.runCutAction(o)))}static{this.ID="workbench.contrib.notebookClipboard"}_getContext(){let e=qn(this._editorService.activeEditorPane),t=e?.getActiveCell();return{editor:e,activeCell:t}}_focusInsideEmebedMonaco(e){let t=Me(e.getDomNode()).getSelection();if(t?.rangeCount!==1)return!1;let o=t.getRangeAt(0);if(o.startContainer===o.endContainer&&o.endOffset-o.startOffset===0)return!1;let n=o.commonAncestorContainer,r=e.getDomNode();if(!r.contains(n))return!1;for(;n&&n!==r;){if(n.classList&&n.classList.contains("monaco-editor"))return!0;n=n.parentNode}return!1}runCopyAction(e){let t=e.get(ne),o=Pn();if(Ao(o)&&Oh(o))return e8(t,"[NotebookEditor] focus is on input or textarea element, bypass"),!1;let{editor:n}=this._getContext();return n?n.hasEditorFocus()?this._focusInsideEmebedMonaco(n)?(e8(t,"[NotebookEditor] focus is on embed monaco editor, bypass"),!1):(e8(t,"[NotebookEditor] run copy actions on notebook model"),rgo(e,n,void 0)):(e8(t,"[NotebookEditor] focus is outside of the notebook editor, bypass"),!1):(e8(t,"[NotebookEditor] no active notebook editor, bypass"),!1)}runPasteAction(e){let t=Pn();if(t&&Oh(t))return!1;let{editor:o,activeCell:n}=this._getContext();if(!o||!o.hasEditorFocus()||this._focusInsideEmebedMonaco(o))return!1;let s=e.get(un).getToCopy();return s?ngo(o,n,s):!1}runCutAction(e){let t=Pn();if(t&&Oh(t))return!1;let{editor:o}=this._getContext();return!o||!o.hasEditorFocus()||this._focusInsideEmebedMonaco(o)?!1:sgo(e,o,void 0)}};wNe=I([m(0,ee)],wNe);pt(wNe.ID,wNe,ut.BlockRestore);var mXo="notebook.cell.copy",hXo="notebook.cell.cut",gXo="notebook.cell.paste",fXo="notebook.cell.pasteAbove";W(class extends gd{constructor(){super({id:mXo,title:d(11655,null),menu:{id:D.NotebookCellTitle,when:rr,group:"1_copy",order:2},keybinding:kr?void 0:{primary:2081,win:{primary:2081,secondary:[2067]},when:x.and(rr,x.not(Uu)),weight:200}})}async runWithContext(a,i){rgo(a,i.notebookEditor,i.cell)}});W(class extends gd{constructor(){super({id:hXo,title:d(11656,null),menu:{id:D.NotebookCellTitle,when:x.and(rr,Kl,bw),group:"1_copy",order:1},keybinding:kr?void 0:{when:x.and(rr,x.not(Uu)),primary:2102,win:{primary:2102,secondary:[1044]},weight:200}})}async runWithContext(a,i){sgo(a,i.notebookEditor,i.cell)}});W(class extends qu{constructor(){super({id:gXo,title:d(11657,null),menu:{id:D.NotebookCellTitle,when:x.and(rr,Kl),group:"1_copy",order:3},keybinding:kr?void 0:{when:x.and(rr,x.not(Uu)),primary:2100,win:{primary:2100,secondary:[1043]},linux:{primary:2100,secondary:[1043]},weight:100}})}async runWithContext(a,i){let t=a.get(un).getToCopy();!i.notebookEditor.hasModel()||i.notebookEditor.isReadOnly||t&&ngo(i.notebookEditor,i.cell,t)}});W(class extends gd{constructor(){super({id:fXo,title:d(11658,null),keybinding:{when:x.and(rr,x.not(Uu)),primary:3124,weight:rf}})}async runWithContext(a,i){let t=a.get(un).getToCopy(),o=i.notebookEditor,n=o.textModel;if(o.isReadOnly||!t)return;let r={kind:1,focus:o.getFocus(),selections:o.getSelections()},s=i.notebookEditor.getCellIndex(i.cell),l=s;n.applyEdits([{editType:1,index:s,count:0,cells:t.items.map(c=>jK(c))}],!0,r,()=>({kind:1,focus:{start:l,end:l+1},selections:[{start:l,end:l+t.items.length}]}),void 0,!0)}});W(class extends K{constructor(){super({id:"workbench.action.toggleNotebookClipboardLog",title:L(11659,"Toggle Notebook Clipboard Troubleshooting"),category:We.Developer,f1:!0})}run(a){dXo(),e1t&&a.get(ge).executeCommand(iK)}});W(class extends gd{constructor(){super({id:"notebook.cell.output.selectAll",title:d(11654,null),keybinding:{primary:2079,when:x.and(rr,PR),weight:Kao}})}async runWithContext(a,i){pXo(a,e=>{if(!e.hasEditorFocus())return!1;if(e.hasEditorFocus()&&!e.hasWebviewFocus())return!0;let t=e.getActiveCell();return!t||!t.outputIsFocused||!e.hasWebviewFocus()||(t.inputInOutputIsFocused?e.selectInputContents(t):e.selectOutputContent(t)),!0})}});var Sit="find-hide-transition",CNe="find-show-transition",QEi=69,YEi=200,kw=class extends C{constructor(e,t){super();this.notebookEditor=e;this.instantiationService=t;this._widget=new co(()=>this._register(this.instantiationService.createInstance(Iit,this.notebookEditor)))}static{this.id="workbench.notebook.find"}get widget(){return this._widget.value}show(e,t){return this._widget.value.show(e,t)}hide(){this._widget.rawValue?.hide()}replace(e){return this._widget.value.replace(e)}isVisible(){return this._widget.rawValue?.isVisible??!1}findNext(){this._widget.rawValue&&this._widget.value.findNext()}findPrevious(){this._widget.rawValue&&this._widget.value.findPrevious()}};kw=I([m(1,F)],kw);var Iit=class extends rNe{constructor(e,t,o,n,r,s,l,c){let u=h_.getOrCreate(c),p=g_.getOrCreate(c);super(t,o,n,r,l,s,new G1,e,u,p);this._isFocused=!1;this._showTimeout=null;this._hideTimeout=null;this._findModel=new FRe(this._notebookEditor,this._state,this._configurationService),R(this._notebookEditor.getDomNode(),this.getDomNode()),this._findWidgetFocused=gWt.bindTo(o),this._findWidgetVisible=fE.bindTo(o),this._register(this._findInput.onKeyDown(h=>this._onFindInputKeyDown(h))),this._register(this._replaceInput.onKeyDown(h=>this._onReplaceInputKeyDown(h))),this._register(this._state.onFindReplaceStateChange(h=>{if(this.onInputChanged(),h.isSearching&&(this._state.isSearching?this._progressBar.infinite().show(YEi):this._progressBar.stop().hide()),this._findModel.currentMatch>=0){let f=this._findModel.getCurrentMatch();this._replaceBtn.setEnabled(f.isModelMatch)}let g=this._findModel.findMatches;this._replaceAllBtn.setEnabled(g.length>0&&g.find(f=>f.webviewMatches.length>0)===void 0),h.filters&&this._findInput.updateFilterState(this._state.filters?.isModified()??!1)})),this._register(j(this.getDomNode(),re.FOCUS,h=>{this._previousFocusElement=Ao(h.relatedTarget)?h.relatedTarget:void 0},!0))}get findModel(){return this._findModel}get isFocused(){return this._isFocused}_onFindInputKeyDown(e){if(e.equals(3)){this.find(!1),e.preventDefault();return}else if(e.equals(1027)){this.find(!0),e.preventDefault();return}}_onReplaceInputKeyDown(e){if(e.equals(3)){this.replaceOne(),e.preventDefault();return}}onInputChanged(){this._state.change({searchString:this.inputValue},!1);let e=this._findModel.findMatches;return!!(e&&e.length)}findIndex(e){this._findModel.find({index:e})}find(e){this._findModel.find({previous:e})}findNext(){this.find(!1)}findPrevious(){this.find(!0)}replaceOne(){if(!this._notebookEditor.hasModel()||!this._findModel.findMatches.length)return;this._findModel.ensureFindMatches(),this._findModel.currentMatch<0&&this._findModel.find({previous:!1});let e=this._findModel.getCurrentMatch(),t=e.cell;if(e.isModelMatch){let o=e.match;this._progressBar.infinite().show(YEi);let r=this.replacePattern.buildReplaceString(o.matches,this._state.preserveCase);this._notebookEditor.getViewModel().replaceOne(t,o.range,r).then(()=>{this._progressBar.stop()})}else console.error("Replace does not work for output match")}replaceAll(){if(!this._notebookEditor.hasModel())return;this._progressBar.infinite().show(YEi);let e=this.replacePattern,t=this._findModel.findMatches,o=[];t.forEach(r=>{r.contentMatches.forEach(s=>{let l=s.matches;o.push(e.buildReplaceString(l,this._state.preserveCase))})}),this._notebookEditor.getViewModel().replaceAll(this._findModel.findMatches,o).then(()=>{this._progressBar.stop()})}findFirst(){}onFocusTrackerFocus(){this._findWidgetFocused.set(!0),this._isFocused=!0}onFocusTrackerBlur(){this._previousFocusElement=void 0,this._findWidgetFocused.reset(),this._isFocused=!1}onReplaceInputFocusTrackerFocus(){}onReplaceInputFocusTrackerBlur(){}onFindInputFocusTrackerFocus(){}onFindInputFocusTrackerBlur(){}async show(e,t){let o=this._state.searchString!==e;super.show(e,t),this._state.change({searchString:e??this._state.searchString,isRevealed:!0},!1),this._findWidgetVisible.set(!0),typeof t?.matchIndex=="number"?(this._findModel.findMatches.length||await this._findModel.research(),this.findIndex(t.matchIndex)):t?.focus!==!1&&this._findInput.select(),!o&&t?.searchStringSeededFrom&&this._findModel.refreshCurrentMatch(t.searchStringSeededFrom),this._showTimeout===null&&(this._hideTimeout!==null&&(Me(this.getDomNode()).clearTimeout(this._hideTimeout),this._hideTimeout=null,this._notebookEditor.removeClassName(Sit)),this._notebookEditor.addClassName(CNe),this._showTimeout=Me(this.getDomNode()).setTimeout(()=>{this._notebookEditor.removeClassName(CNe),this._showTimeout=null},200))}replace(e,t){super.showWithReplace(e,t),this._state.change({searchString:e??"",replaceString:t??"",isRevealed:!0},!1),this._replaceInput.select(),this._showTimeout===null&&(this._hideTimeout!==null&&(Me(this.getDomNode()).clearTimeout(this._hideTimeout),this._hideTimeout=null,this._notebookEditor.removeClassName(Sit)),this._notebookEditor.addClassName(CNe),this._showTimeout=Me(this.getDomNode()).setTimeout(()=>{this._notebookEditor.removeClassName(CNe),this._showTimeout=null},200))}hide(){if(super.hide(),this._state.change({isRevealed:!1},!1),this._findWidgetVisible.set(!1),this._findModel.clear(),this._notebookEditor.findStop(),this._progressBar.stop(),this._hideTimeout===null&&(this._showTimeout!==null&&(Me(this.getDomNode()).clearTimeout(this._showTimeout),this._showTimeout=null,this._notebookEditor.removeClassName(CNe)),this._notebookEditor.addClassName(Sit),this._hideTimeout=Me(this.getDomNode()).setTimeout(()=>{this._notebookEditor.removeClassName(Sit)},200)),this._previousFocusElement&&this._previousFocusElement.offsetParent&&(this._previousFocusElement.focus(),this._previousFocusElement=void 0),this._notebookEditor.hasModel())for(let e=0;e<this._notebookEditor.getLength();e++){let t=this._notebookEditor.cellAt(e);t.getEditState()===1&&t.editStateSource==="find"&&t.updateEditState(0,"closeFind")}}_updateMatchesCount(){if(!this._findModel||!this._findModel.findMatches)return;this._matchesCount.style.minWidth=QEi+"px",this._matchesCount.title="",this._matchesCount.firstChild?.remove();let e;if(this._state.matchesCount>0){let t=String(this._state.matchesCount);this._state.matchesCount>=rO&&(t+="+");let o=this._findModel.currentMatch<0?"?":String(this._findModel.currentMatch+1);e=id(T5e,o,t)}else e=w7;this._matchesCount.appendChild(document.createTextNode(e)),Jo(this._getAriaLabel(e,this._state.currentMatch,this._state.searchString)),QEi=Math.max(QEi,this._matchesCount.clientWidth)}_getAriaLabel(e,t,o){return e===w7?o===""?d(11691,null,e):d(11690,null,e,o):d(11692,null,e,o)}dispose(){this._notebookEditor?.removeClassName(CNe),this._notebookEditor?.removeClassName(Sit),this._findModel.dispose(),super.dispose()}};Iit=I([m(1,_n),m(2,X),m(3,B),m(4,ze),m(5,tt),m(6,F),m(7,le)],Iit);tm(kw.id,kw);W(class extends K{constructor(){super({id:"notebook.hideFind",title:L(11672,"Hide Find in Notebook"),keybinding:{when:x.and(rr,fE),primary:9,weight:105}})}async run(a){let i=a.get(ee),e=qn(i.activeEditorPane);if(!e)return;e.getContribution(kw.id).hide(),e.focus()}});W(class extends xg{constructor(){super({id:"notebook.find",title:L(11671,"Find in Notebook"),keybinding:{when:x.and(rr,x.or(Ua,FJe),ue.focus.toNegated()),primary:2084,weight:200}})}async runWithContext(a,i){let e=a.get(ee),t=qn(e.activeEditorPane);if(!t)return;t.getContribution(kw.id).show(void 0,{findScope:{findScopeType:"none"}})}});function vXo(a,i){if(i.uri.scheme===Y.vscodeNotebookCell){let e=Zo.parse(i.uri);if(e&&Xe(e.notebook,a))return!0}return!1}function ago(a,i){if(i.seedSearchStringFromSelection==="single"){let e=R7(a,i.seedSearchStringFromSelection,i.seedSearchStringFromNonEmptySelection);if(e)return{searchString:e,selection:a.getSelection()}}else if(i.seedSearchStringFromSelection==="multiple"&&!i.updateSearchScope){let e=R7(a,i.seedSearchStringFromSelection);if(e)return{searchString:e,selection:a.getSelection()}}}function lgo(a,i,e){if(!i||!e.hasModel())return!1;if(!i.hasEditorFocus()&&!i.hasWebviewFocus()){let t=a.get(Kt),o=t.getFocusedCodeEditor()||t.getActiveCodeEditor();return!!(i.hasModel()&&o&&o.hasModel()&&vXo(i.textModel.uri,o.getModel()))}return!0}function cgo(a,i,e,t=!0){if(!i||!e||!a||!e.hasModel())return!1;let o=ago(e,{forceRevealReplace:!1,seedSearchStringFromSelection:e.getOption(50).seedSearchStringFromSelection!=="never"?"single":"none",seedSearchStringFromNonEmptySelection:e.getOption(50).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:e.getOption(50).globalFindClipboard,shouldFocus:1,shouldAnimate:!0,updateSearchScope:!1,loop:e.getOption(50).loop}),n,r=e.getModel().uri,s=Zo.parse(r);if(o?.selection&&s){let l=i.getCellByHandle(s.handle);l&&(n={searchStringSeededFrom:{cell:l,range:o.selection},focus:t})}else n={focus:t};return a.show(o?.searchString,n),!0}function dgo(a,i,e){let t=a.get(ee),o=qn(t.activeEditorPane);if(!lgo(a,o,i))return!1;let n=o?.getContribution(kw.id);return n?n.isVisible()?(e?n.findNext():n.findPrevious(),!0):cgo(n,o,i,!1):!1}async function ugo(a,i){let e=a.get(ee),t=qn(e.activeEditorPane);if(!t)return;let o=t.getContribution(kw.id);o&&o.isVisible()&&(i?o.findNext():o.findPrevious())}uri.addImplementation(100,(a,i,e)=>{let t=a.get(ee),o=qn(t.activeEditorPane);if(!lgo(a,o,i))return!1;let n=o?.getContribution(kw.id);return cgo(n,o,i,!0)});hri.addImplementation(100,(a,i,e)=>{let t=a.get(ee),o=qn(t.activeEditorPane);if(!o||!i.hasModel())return!1;let n=o.getContribution(kw.id),r=ago(i,{forceRevealReplace:!1,seedSearchStringFromSelection:i.getOption(50).seedSearchStringFromSelection!=="never"?"single":"none",seedSearchStringFromNonEmptySelection:i.getOption(50).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:i.getOption(50).globalFindClipboard,shouldFocus:1,shouldAnimate:!0,updateSearchScope:!1,loop:i.getOption(50).loop});return n?(n.replace(r?.searchString),!0):!1});pri.addImplementation(100,(a,i,e)=>dgo(a,i,!0));mri.addImplementation(100,(a,i,e)=>dgo(a,i,!1));W(class extends K{constructor(){super({id:"notebook.findNext.fromWidget",title:L(11669,"Find Next"),keybinding:{when:x.and(rr,fE),primary:61,mac:{primary:2085,secondary:[61]},weight:201}})}async run(a){return ugo(a,!0)}});W(class extends K{constructor(){super({id:"notebook.findPrevious.fromWidget",title:L(11670,"Find Previous"),keybinding:{when:x.and(rr,fE),primary:1085,mac:{primary:3109,secondary:[1085]},weight:201}})}async run(a){return ugo(a,!1)}});var bXo="notebook.addFindMatchToSelection",SXo="notebook.selectAllFindMatches";var QC={IsNotebookMultiCursor:new Q("isNotebookMultiSelect",!1),NotebookMultiSelectCursorState:new Q("notebookMultiSelectCursorState",0)},yD=class extends C{constructor(e,t,o,n,r,s,l){super();this.notebookEditor=e;this.contextKeyService=t;this.textModelService=o;this.languageConfigurationService=n;this.accessibilityService=r;this.configurationService=s;this.undoRedoService=l;this.word="",this.trackedCells=[],this.totalMatchesCount=0,this._onDidChangeAnchorCell=this._register(new E),this.onDidChangeAnchorCell=this._onDidChangeAnchorCell.event,this.anchorDisposables=this._register(new P),this.cursorsDisposables=this._register(new P),this.cursorsControllers=new vt,this.state=0,this._nbIsMultiSelectSession=QC.IsNotebookMultiCursor.bindTo(this.contextKeyService),this._nbMultiSelectState=QC.NotebookMultiSelectCursorState.bindTo(this.contextKeyService),this.anchorCell=this.notebookEditor.activeCellAndCodeEditor,this._register(this.onDidChangeAnchorCell(async()=>{await this.syncCursorsControllers(),this.syncAnchorListeners()}))}static{this.id="notebook.multiCursorController"}getState(){return this.state}syncAnchorListeners(){if(this.anchorDisposables.clear(),!this.anchorCell)throw new Error("Anchor cell is undefined");this.anchorDisposables.add(this.anchorCell[1].onWillType(e=>{let t=new VM;this.trackedCells.forEach(o=>{let n=this.cursorsControllers.get(o.cellViewModel.uri);n&&o.cellViewModel.handle!==this.anchorCell?.[0].handle&&n.type(t,e,"keyboard")})})),this.anchorDisposables.add(this.anchorCell[1].onDidType(()=>{this.state=2,this._nbMultiSelectState.set(2);let e=this.cursorsControllers.get(this.anchorCell[0].uri);if(!e)return;let t=this.notebookEditor.activeCodeEditor?.getSelections();t&&(e.setSelections(new VM,"keyboard",t,3),this.trackedCells.forEach(o=>{let n=this.cursorsControllers.get(o.cellViewModel.uri);n&&(o.initialSelection=n.getSelection(),o.matchSelections=[])}),this.updateLazyDecorations())})),this.anchorDisposables.add(this.anchorCell[1].onDidChangeCursorSelection(e=>{if(e.source==="mouse"){this.resetToIdleState();return}if(!e.oldSelections||e.reason===0||e.reason===2)return;let t={deltaStartCol:e.selection.startColumn-e.oldSelections[0].startColumn,deltaStartLine:e.selection.startLineNumber-e.oldSelections[0].startLineNumber,deltaEndCol:e.selection.endColumn-e.oldSelections[0].endColumn,deltaEndLine:e.selection.endLineNumber-e.oldSelections[0].endLineNumber},o=e.selection.getDirection();this.trackedCells.forEach(n=>{let r=this.cursorsControllers.get(n.cellViewModel.uri);if(!r)return;let s=r.getSelections().map(l=>{let c=l.startColumn+t.deltaStartCol,u=l.startLineNumber+t.deltaStartLine,p=l.endColumn+t.deltaEndCol,h=l.endLineNumber+t.deltaEndLine;return Yt.createWithDirection(u,c,h,p,o)});r.setSelections(new VM,e.source,s,3)}),this.updateLazyDecorations()})),this.anchorDisposables.add(this.anchorCell[1].onWillTriggerEditorOperationEvent(e=>{this.handleEditorOperationEvent(e)})),this.anchorDisposables.add(this.anchorCell[1].onDidBlurEditorWidget(()=>{(this.state===1||this.state===2)&&this.resetToIdleState()}))}async syncCursorsControllers(){this.cursorsDisposables.clear(),await Promise.all(this.trackedCells.map(async e=>{let t=await this.createCursorController(e);if(!t)return;this.cursorsControllers.set(e.cellViewModel.uri,t);let o=e.matchSelections;t.setSelections(new VM,void 0,o,3)})),this.updateLazyDecorations()}async createCursorController(e){let o=(await this.textModelService.createModelReference(e.cellViewModel.uri)).object.textEditorModel;if(!o)return;let n=this.constructCursorSimpleModel(e.cellViewModel),r=this.constructCoordinatesConverter(),s=e.editorConfig,l=this.cursorsDisposables.add(new wye(o,n,r,new rW(o.getLanguageId(),o.getOptions(),s,this.languageConfigurationService)));return l.setSelections(new VM,void 0,e.matchSelections,3),l}constructCoordinatesConverter(){return{convertViewPositionToModelPosition(e){return e},convertViewRangeToModelRange(e){return e},validateViewPosition(e,t){return e},validateViewRange(e,t){return e},convertModelPositionToViewPosition(e,t,o,n){return e},convertModelRangeToViewRange(e,t){return e},modelPositionIsVisible(e){return!0},getModelLineViewLineCount(e){return 1},getViewLineNumberOfModelPosition(e,t){return e}}}constructCursorSimpleModel(e){return{getLineCount(){return e.textBuffer.getLineCount()},getLineContent(t){return e.textBuffer.getLineContent(t)},getLineMinColumn(t){return e.textBuffer.getLineMinColumn(t)},getLineMaxColumn(t){return e.textBuffer.getLineMaxColumn(t)},getLineFirstNonWhitespaceColumn(t){return e.textBuffer.getLineFirstNonWhitespaceColumn(t)},getLineLastNonWhitespaceColumn(t){return e.textBuffer.getLineLastNonWhitespaceColumn(t)},normalizePosition(t,o){return t},getLineIndentColumn(t){return yye(e.textBuffer.getLineContent(t))+1}}}handleEditorOperationEvent(e){this.trackedCells.forEach(t=>{if(t.cellViewModel.handle===this.anchorCell?.[0].handle)return;let o=new VM,n=this.cursorsControllers.get(t.cellViewModel.uri);n&&this.executeEditorOperation(n,o,e)})}executeEditorOperation(e,t,o){switch(o.handlerId){case"compositionStart":e.startComposition(t);break;case"compositionEnd":e.endComposition(t,o.source);break;case"replacePreviousChar":{let n=o.payload;e.compositionType(t,n.text||"",n.replaceCharCnt||0,0,0,o.source);break}case"compositionType":{let n=o.payload;e.compositionType(t,n.text||"",n.replacePrevCharCnt||0,n.replaceNextCharCnt||0,n.positionDelta||0,o.source);break}case"paste":{let n=o.payload;e.paste(t,n.text||"",n.pasteOnNewLine||!1,n.multicursorText||null,o.source);break}case"cut":e.cut(t,o.source);break}}updateViewModelSelections(){for(let e of this.trackedCells){let t=this.cursorsControllers.get(e.cellViewModel.uri);if(!t)return;e.cellViewModel.setSelections(t.getSelections())}}updateFinalUndoRedo(){if(!this.anchorCell?.[1].getModel())return;let t=new vt,o=[];this.trackedCells.forEach(n=>{if(!n.undoRedoHistory)return;o.push(n.cellViewModel.uri);let s=this.undoRedoService.getElements(n.cellViewModel.uri).past.slice(),l=n.undoRedoHistory.past.slice(),c=s.slice(l.length);c.length!==0&&(t.set(n.cellViewModel.uri,c),this.undoRedoService.removeElements(n.cellViewModel.uri),l.forEach(u=>{this.undoRedoService.pushElement(u)}))}),this.undoRedoService.pushElement({type:1,resources:o,label:"Multi Cursor Edit",code:"multiCursorEdit",confirmBeforeUndo:!1,undo:async()=>{t.forEach(async n=>{n.reverse().forEach(async r=>{await r.undo()})})},redo:async()=>{t.forEach(async n=>{n.forEach(async r=>{await r.redo()})})}})}resetToIdleState(){this.state=0,this._nbMultiSelectState.set(0),this._nbIsMultiSelectSession.set(!1),this.updateFinalUndoRedo(),this.trackedCells.forEach(e=>{this.clearDecorations(e),e.cellViewModel.setSelections([e.initialSelection])}),this.anchorDisposables.clear(),this.anchorCell=void 0,this.cursorsDisposables.clear(),this.cursorsControllers.clear(),this.trackedCells=[],this.totalMatchesCount=0,this.startPosition=void 0,this.word=""}async findAndTrackNextSelection(e){if(this.state===0){let t=e.textModel;if(!t)return;let o=e.getSelections()[0],n=this.getWord(o,t);if(!n)return;this.word=n.word;let r=this.notebookEditor.textModel;if(r){let c=r.findMatches(this.word,!1,!0,tW);this.totalMatchesCount=c.reduce((u,p)=>u+p.matches.length,0)}let s=this.notebookEditor.getCellIndex(e);if(s===void 0)return;this.startPosition={cellIndex:s,position:new Ie(o.startLineNumber,n.startColumn)};let l=new Yt(o.startLineNumber,n.startColumn,o.startLineNumber,n.endColumn);if(e.setSelections([l]),this.anchorCell=this.notebookEditor.activeCellAndCodeEditor,!this.anchorCell||this.anchorCell[0].handle!==e.handle)throw new Error("Active cell is not the same as the cell passed as context");if(!(this.anchorCell[1]instanceof jr))throw new Error("Active cell is not an instance of CodeEditorWidget");await this.updateTrackedCell(e,[l]),this._nbIsMultiSelectSession.set(!0),this.state=1,this._nbMultiSelectState.set(1),this._onDidChangeAnchorCell.fire()}else if(this.state===1){let t=this.notebookEditor.textModel;if(!t)return;let o=this.notebookEditor.getCellIndex(e);if(o===void 0||!this.startPosition||this.trackedCells.reduce((l,c)=>l+c.matchSelections.length,0)>=this.totalMatchesCount)return;let r=t.findNextMatch(this.word,{cellIndex:o,position:e.getSelections()[e.getSelections().length-1].getEndPosition()},!1,!0,tW,this.startPosition);if(!r)return;let s=this.notebookEditor.getCellByHandle(r.cell.handle);if(!s)return;if(r.cell.handle===e.handle){let l=[...e.getSelections(),Yt.fromRange(r.match.range,0)],c=await this.updateTrackedCell(e,l);s.setSelections(c.matchSelections)}else if(r.cell.handle!==e.handle){await this.notebookEditor.revealRangeInViewAsync(s,r.match.range),await this.notebookEditor.focusNotebookCell(s,"editor");let l=await this.updateTrackedCell(s,[Yt.fromRange(r.match.range,0)]);if(s.setSelections(l.matchSelections),this.anchorCell=this.notebookEditor.activeCellAndCodeEditor,!this.anchorCell||!(this.anchorCell[1]instanceof jr))throw new Error("Active cell is not an instance of CodeEditorWidget");this._onDidChangeAnchorCell.fire(),this.initializeMultiSelectDecorations(this.trackedCells.find(c=>c.cellViewModel.handle===e.handle))}}}async selectAllMatches(e,t){let o=this.notebookEditor.textModel;o&&(t?await this.handleFindWidgetSelectAllMatches(t):await this.handleCellEditorSelectAllMatches(o,e),await this.syncCursorsControllers(),this.syncAnchorListeners(),this.updateLazyDecorations())}async handleFindWidgetSelectAllMatches(e){if(this.state===0&&e.length){await this.notebookEditor.focusNotebookCell(e[0].cell,"editor"),this.anchorCell=this.notebookEditor.activeCellAndCodeEditor,this.trackedCells=[];for(let t of e)this.updateTrackedCell(t.cell,t.contentMatches.map(o=>Yt.fromRange(o.range,0))),this.anchorCell&&t.cell.handle===this.anchorCell[0].handle&&t.cell.setSelections(t.contentMatches.map(o=>Yt.fromRange(o.range,0)));this._nbIsMultiSelectSession.set(!0),this.state=1,this._nbMultiSelectState.set(1)}}async handleCellEditorSelectAllMatches(e,t){if(this.state===0){let o=t.textModel;if(!o)return;let n=t.getSelections()[0],r=this.getWord(n,o);if(!r)return;this.word=r.word;let s=this.notebookEditor.getCellIndex(t);if(s===void 0)return;if(this.startPosition={cellIndex:s,position:new Ie(n.startLineNumber,r.startColumn)},this.anchorCell=this.notebookEditor.activeCellAndCodeEditor,!this.anchorCell||this.anchorCell[0].handle!==t.handle)throw new Error("Active cell is not the same as the cell passed as context");if(!(this.anchorCell[1]instanceof jr))throw new Error("Active cell is not an instance of CodeEditorWidget");let l=e.findMatches(this.word,!1,!0,tW);this.trackedCells=[];for(let c of l)if(await this.updateTrackedCell(c.cell,c.matches.map(u=>Yt.fromRange(u.range,0))),c.cell.handle===t.handle){let u=this.notebookEditor.getCellByHandle(c.cell.handle);u&&u.setSelections(c.matches.map(p=>Yt.fromRange(p.range,0)))}this._nbIsMultiSelectSession.set(!0),this.state=1,this._nbMultiSelectState.set(1)}else if(this.state===1){let o=e.findMatches(this.word,!1,!0,tW);for(let n of o)await this.updateTrackedCell(n.cell,n.matches.map(r=>Yt.fromRange(r.range,0)))}}async updateTrackedCell(e,t){let o=e instanceof M4?this.notebookEditor.getCellByHandle(e.handle):e;if(!o)throw new Error("Cell not found");let n=this.trackedCells.find(r=>r.cellViewModel.handle===o.handle);if(n)this.clearDecorations(n),n.matchSelections=t;else{let r=o.getSelections()[0];(await o.resolveTextModel()).pushStackElement();let l=this.constructCellEditorOptions(o),c=l.getRawOptions(),u={cursorStyle:kmt(c.cursorStyle),cursorBlinking:gYt(c.cursorBlinking),cursorSmoothCaretAnimation:c.cursorSmoothCaretAnimation};n={cellViewModel:o,initialSelection:r,matchSelections:t,editorConfig:l,cursorConfig:u,decorationIds:[],undoRedoHistory:this.undoRedoService.getElements(o.uri)},this.trackedCells.push(n)}return n}async deleteLeft(){this.trackedCells.forEach(e=>{let t=this.cursorsControllers.get(e.cellViewModel.uri);if(!t)return;let[,o]=wN.deleteLeft(t.getPrevEditOperationType(),t.context.cursorConfig,t.context.model,t.getSelections(),t.getAutoClosedCharacters()),n=V9.executeCommands(t.context.model,t.getSelections(),o);n&&t.setSelections(new VM,void 0,n,3)}),this.updateLazyDecorations()}async deleteRight(){this.trackedCells.forEach(e=>{let t=this.cursorsControllers.get(e.cellViewModel.uri);if(!t)return;let[,o]=wN.deleteRight(t.getPrevEditOperationType(),t.context.cursorConfig,t.context.model,t.getSelections());if(e.cellViewModel.handle!==this.anchorCell?.[0].handle){let n=V9.executeCommands(t.context.model,t.getSelections(),o);if(!n)return;t.setSelections(new VM,void 0,n,3)}else t.setSelections(new VM,void 0,e.cellViewModel.getSelections(),3)}),this.updateLazyDecorations()}async undo(){let e=[];for(let t of this.trackedCells){let o=await t.cellViewModel.resolveTextModel();o&&e.push(o)}await Promise.all(e.map(t=>t.undo())),this.updateViewModelSelections(),this.updateLazyDecorations()}async redo(){let e=[];for(let t of this.trackedCells){let o=await t.cellViewModel.resolveTextModel();o&&e.push(o)}await Promise.all(e.map(t=>t.redo())),this.updateViewModelSelections(),this.updateLazyDecorations()}constructCellEditorOptions(e){let t=new $F(this.notebookEditor.getBaseCellEditorOptions(e.language),this.notebookEditor.notebookOptions,this.configurationService),o=t.getUpdatedValue(e.internalMetadata,e.uri);return t.dispose(),new i9(!1,D.EditorContent,o,null,this.accessibilityService)}initializeMultiSelectDecorations(e){if(!e)return;let t=[];e.matchSelections.forEach(o=>{t.push({range:Yt.fromPositions(o.getEndPosition()),options:{description:"",className:this.getClassName(e.cursorConfig,!0)}})}),e.decorationIds=e.cellViewModel.deltaModelDecorations(e.decorationIds,t)}updateLazyDecorations(){this.trackedCells.forEach(e=>{if(e.cellViewModel.handle===this.anchorCell?.[0].handle)return;let t=this.cursorsControllers.get(e.cellViewModel.uri);if(!t)return;let o=t.getSelections(),n=[];o?.map(r=>{r.isEmpty()||n.push({range:r,options:{description:"",className:this.getClassName(e.cursorConfig,!1)}}),n.push({range:Yt.fromPositions(r.getPosition()),options:{description:"",zIndex:1e4,className:this.getClassName(e.cursorConfig,!0)}})}),e.decorationIds=e.cellViewModel.deltaModelDecorations(e.decorationIds,n)})}clearDecorations(e){e.decorationIds=e.cellViewModel.deltaModelDecorations(e.decorationIds,[])}getWord(e,t){let o=e.startLineNumber,n=e.startColumn;return t.isDisposed()?null:t.getWordAtPosition({lineNumber:o,column:n})}getClassName(e,t){let o=t?".nb-multicursor-cursor":".nb-multicursor-selection";if(t){switch(e.cursorStyle){case 1:break;case 2:o+=".nb-cursor-block-style";break;case 3:o+=".nb-cursor-underline-style";break;case 4:o+=".nb-cursor-line-thin-style";break;case 5:o+=".nb-cursor-block-outline-style";break;case 6:o+=".nb-cursor-underline-thin-style";break;default:break}switch(e.cursorBlinking){case 1:o+=".nb-blink";break;case 2:o+=".nb-smooth";break;case 3:o+=".nb-phase";break;case 4:o+=".nb-expand";break;case 5:o+=".nb-solid";break;default:o+=".nb-solid";break}(e.cursorSmoothCaretAnimation==="on"||e.cursorSmoothCaretAnimation==="explicit")&&(o+=".nb-smooth-caret-animation")}return o}dispose(){super.dispose(),this.anchorDisposables.dispose(),this.cursorsDisposables.dispose(),this.trackedCells.forEach(e=>{this.clearDecorations(e)}),this.trackedCells=[]}};yD=I([m(1,X),m(2,Nt),m(3,bs),m(4,Bi),m(5,B),m(6,Cl)],yD);var XEi=class extends qu{constructor(){super({id:SXo,title:d(11703,null),precondition:x.and(x.equals("config.notebook.multiCursor.enabled",!0)),keybinding:{when:x.or(x.and(x.equals("config.notebook.multiCursor.enabled",!0),Ua,AR),x.and(x.equals("config.notebook.multiCursor.enabled",!0),gWt)),primary:3114,weight:200}})}async runWithContext(i,e){let t=i.get(ee),o=qn(t.activeEditorPane);if(!o||!e.cell)return;let n=o.getContribution(yD.id),r=o.getContribution(kw.id);if(r.widget.isFocused){let s=r.widget.findModel;n.selectAllMatches(e.cell,s.findMatches)}else n.selectAllMatches(e.cell)}},JEi=class extends qu{constructor(){super({id:bXo,title:d(11699,null),precondition:x.and(x.equals("config.notebook.multiCursor.enabled",!0),Ua,AR),keybinding:{when:x.and(x.equals("config.notebook.multiCursor.enabled",!0),Ua,AR),primary:2082,weight:200}})}async runWithContext(i,e){let t=i.get(ee),o=qn(t.activeEditorPane);if(!o||!e.cell)return;o.getContribution(yD.id).findAndTrackNextSelection(e.cell)}},ZEi=class extends qu{constructor(){super({id:"noteMultiCursor.exit",title:d(11702,null),precondition:x.and(x.equals("config.notebook.multiCursor.enabled",!0),Ua,QC.IsNotebookMultiCursor),keybinding:{when:x.and(x.equals("config.notebook.multiCursor.enabled",!0),Ua,QC.IsNotebookMultiCursor),primary:9,weight:200}})}async runWithContext(i,e){let t=i.get(ee),o=qn(t.activeEditorPane);if(!o)return;o.getContribution(yD.id).resetToIdleState()}},eTi=class extends qu{constructor(){super({id:"noteMultiCursor.deleteLeft",title:d(11700,null),precondition:x.and(x.equals("config.notebook.multiCursor.enabled",!0),Ua,QC.IsNotebookMultiCursor,x.or(QC.NotebookMultiSelectCursorState.isEqualTo(1),QC.NotebookMultiSelectCursorState.isEqualTo(2))),keybinding:{when:x.and(x.equals("config.notebook.multiCursor.enabled",!0),Ua,QC.IsNotebookMultiCursor,x.or(QC.NotebookMultiSelectCursorState.isEqualTo(1),QC.NotebookMultiSelectCursorState.isEqualTo(2))),primary:1,weight:200}})}async runWithContext(i,e){let t=i.get(ee),o=qn(t.activeEditorPane);if(!o)return;o.getContribution(yD.id).deleteLeft()}},tTi=class extends qu{constructor(){super({id:"noteMultiCursor.deleteRight",title:d(11701,null),precondition:x.and(x.equals("config.notebook.multiCursor.enabled",!0),Ua,QC.IsNotebookMultiCursor,x.or(QC.NotebookMultiSelectCursorState.isEqualTo(1),QC.NotebookMultiSelectCursorState.isEqualTo(2))),keybinding:{when:x.and(x.equals("config.notebook.multiCursor.enabled",!0),Ua,QC.IsNotebookMultiCursor,x.or(QC.NotebookMultiSelectCursorState.isEqualTo(1),QC.NotebookMultiSelectCursorState.isEqualTo(2))),primary:20,weight:200}})}async runWithContext(i,e){let t=i.get(ee),o=qn(t.activeEditorPane);if(!o)return;let n=o.activeCodeEditor;if(!n)return;rL.DeleteRight.runEditorCommand(i,n,null),o.getContribution(yD.id).deleteRight()}},xNe=class extends C{constructor(e,t){super();this._editorService=e;this.configurationService=t;if(!this.configurationService.getValue("notebook.multiCursor.enabled"))return;let o=10005;this._register(BT.addImplementation(o,"notebook-multicursor-undo-redo",()=>{let n=qn(this._editorService.activeEditorPane);return!n||!n.hasModel()?!1:n.getContribution(yD.id).undo()},x.and(x.equals("config.notebook.multiCursor.enabled",!0),Ua,QC.IsNotebookMultiCursor))),this._register(HT.addImplementation(o,"notebook-multicursor-undo-redo",()=>{let n=qn(this._editorService.activeEditorPane);return!n||!n.hasModel()?!1:n.getContribution(yD.id).redo()},x.and(x.equals("config.notebook.multiCursor.enabled",!0),Ua,QC.IsNotebookMultiCursor)))}static{this.ID="workbench.contrib.notebook.multiCursorUndoRedo"}};xNe=I([m(0,ee),m(1,B)],xNe);tm(yD.id,yD);pt(xNe.ID,xNe,ut.BlockRestore);W(XEi);W(JEi);W(ZEi);W(eTi);W(tTi);var Tit=class{constructor(i){this._editorService=i}canParticipate(){let e=qn(this._editorService.activeEditorPane)?.getContribution(yD.id);return e?e.getState()!==2:!0}},yit=class{constructor(i,e,t,o,n,r){this.editorWorkerService=i;this.languageFeaturesService=e;this.instantiationService=t;this.textModelService=o;this.bulkEditService=n;this.configurationService=r}async participate(i,e,t,o){if(!i.model||!(i.model instanceof AV)||e.reason===2||!this.configurationService.getValue(ft.formatOnSave))return;t.report({message:d(11739,null)});let r=i.model.notebookModel,s=await this.instantiationService.invokeFunction(bhe.checkAndRunFormatCodeAction,r,t,o),l=new P;try{if(!s){let c=await Promise.all(r.cells.map(async u=>{let p=await this.textModelService.createModelReference(u.uri);l.add(p);let h=p.object.textEditorModel,g=await u4e(this.editorWorkerService,this.languageFeaturesService,h,2,o),f=[];return g?(f.push(...g.map(v=>new ja(h.uri,v,h.getVersionId()))),f):[]}));await this.bulkEditService.apply(c.flat(),{label:d(11737,null),code:"undoredo.formatNotebook"})}}finally{t.report({increment:100}),l.dispose()}}};yit=I([m(0,$s),m(1,zt),m(2,F),m(3,Nt),m(4,ma),m(5,B)],yit);var wit=class extends Tit{constructor(e,t,o,n){super(t);this.configurationService=e;this.editorService=t;this.textModelService=o;this.bulkEditService=n}async participate(e,t,o,n){let r=this.configurationService.getValue("files.trimTrailingWhitespace"),s=this.configurationService.getValue("files.trimTrailingWhitespaceInRegexAndStrings");r&&this.canParticipate()&&await this.doTrimTrailingWhitespace(e,t.reason===2,s,o)}async doTrimTrailingWhitespace(e,t,o,n){if(!e.model||!(e.model instanceof AV))return;let r=new P,s=e.model.notebookModel,l=iTi(this.editorService),c=[],u=[];try{let h=(await Promise.all(s.cells.map(async g=>{if(g.cellKind!==2)return[];let f=await this.textModelService.createModelReference(g.uri);r.add(f);let v=f.object.textEditorModel;if(l&&g.uri.toString()===l.getModel()?.uri.toString()&&(u=l.getSelections()??[],t)){c=u.map(w=>w.getPosition());let y=Qr.get(l)?.getSessionEnclosingRange();if(y)for(let w=y.startLineNumber;w<=y.endLineNumber;w++)c.push(new Ie(w,v.getLineMaxColumn(w)))}let S=b4e(v,c,o);return S.length?S.map(y=>new ja(v.uri,{...y,text:y.text||""},v.getVersionId())):[]}))).flat().filter(g=>g!==void 0);await this.bulkEditService.apply(h,{label:d(11744,null),code:"undoredo.notebookTrimTrailingWhitespace"})}finally{n.report({increment:100}),r.dispose()}}};wit=I([m(0,B),m(1,ee),m(2,Nt),m(3,ma)],wit);var Cit=class extends Tit{constructor(e,t,o){super(t);this.configurationService=e;this.editorService=t;this.bulkEditService=o}async participate(e,t,o,n){this.configurationService.getValue("files.trimFinalNewlines")&&this.canParticipate()&&await this.doTrimFinalNewLines(e,t.reason===2,o)}findLastNonEmptyLine(e){for(let t=e.getLineCount();t>=1;t--)if(e.getLineLength(t))return t;return 0}async doTrimFinalNewLines(e,t,o){if(!e.model||!(e.model instanceof AV))return;let n=new P,r=e.model.notebookModel,s=iTi(this.editorService);try{let c=(await Promise.all(r.cells.map(async u=>{if(u.cellKind!==2)return;let p=0,h=s&&u.uri.toString()===s.getModel()?.uri.toString();if(t&&h){let S=s.getSelections()??[];for(let y of S)p=Math.max(p,y.selectionStartLineNumber)}let g=u.textBuffer,f=this.findLastNonEmptyLine(g),v=Math.max(f+1,p+1);if(v>g.getLineCount())return;let b=new z(v,1,g.getLineCount(),g.getLineLastNonWhitespaceColumn(g.getLineCount()));if(!b.isEmpty())return new ja(u.uri,{range:b,text:""},u.textModel?.getVersionId())}))).flat().filter(u=>u!==void 0);await this.bulkEditService.apply(c,{label:d(11743,null),code:"undoredo.trimFinalNewLines"})}finally{o.report({increment:100}),n.dispose()}}};Cit=I([m(0,B),m(1,ee),m(2,ma)],Cit);var xit=class extends Tit{constructor(e,t,o){super(o);this.configurationService=e;this.bulkEditService=t;this.editorService=o}async participate(e,t,o,n){this.configurationService.getValue(ft.insertFinalNewline)&&this.canParticipate()&&await this.doInsertFinalNewLine(e,t.reason===2,o)}async doInsertFinalNewLine(e,t,o){if(!e.model||!(e.model instanceof AV))return;let n=new P,r=e.model.notebookModel,s=iTi(this.editorService),l;s&&(l=s.getSelections()??[]);try{let u=(await Promise.all(r.cells.map(async p=>{if(p.cellKind!==2)return;let h=p.textBuffer.getLineCount(),g=p.textBuffer.getLineFirstNonWhitespaceColumn(h)===0;if(!(!h||g))return new ja(p.uri,{range:new z(h+1,p.textBuffer.getLineLength(h),h+1,p.textBuffer.getLineLength(h)),text:p.textBuffer.getEOL()},p.textModel?.getVersionId())}))).filter(p=>p!==void 0);await this.bulkEditService.apply(u,{label:d(11738,null),code:"undoredo.insertFinalNewLine"}),s&&l&&s.setSelections(l)}finally{o.report({increment:100}),n.dispose()}}};xit=I([m(0,B),m(1,ma),m(2,ee)],xit);var kit=class{constructor(i,e,t,o,n){this.configurationService=i;this.logService=e;this.workspaceTrustManagementService=t;this.textModelService=o;this.instantiationService=n}async participate(i,e,t,o){if(!this.workspaceTrustManagementService.isWorkspaceTrusted()||!i.model||!(i.model instanceof AV))return;let r="";if(e.reason===2)return;if(e.reason===1)r="explicit";else return;let s=i.model.notebookModel,l=this.configurationService.getValue(ft.codeActionsOnSave),c=Array.isArray(l)?l:Object.keys(l).filter(v=>l[v]),u=this.createCodeActionsOnSave(c),p=u.filter(v=>l[v.value]==="never"||l[v.value]===!1),h=u.filter(v=>l[v.value]===r||l[v.value]===!0),g=h.filter(v=>!gr.Notebook.contains(v)),f=h.filter(v=>gr.Notebook.contains(v));if(f.length){let v=new P;t.report({message:d(11742,null)});try{let b=s.cells[0],S=await this.textModelService.createModelReference(b.uri);v.add(S);let y=S.object.textEditorModel;await this.instantiationService.invokeFunction(bhe.applyOnSaveGenericCodeActions,y,f,p,t,o)}catch{this.logService.error("Failed to apply notebook code action on save")}finally{t.report({increment:100}),v.dispose()}}if(g.length){Array.isArray(l)||g.sort((b,S)=>gr.SourceFixAll.contains(b)?gr.SourceFixAll.contains(S)?0:-1:gr.SourceFixAll.contains(S)?1:0);let v=new P;t.report({message:d(11740,null)});try{await Promise.all(s.cells.map(async b=>{let S=await this.textModelService.createModelReference(b.uri);v.add(S);let y=S.object.textEditorModel;await this.instantiationService.invokeFunction(bhe.applyOnSaveGenericCodeActions,y,g,p,t,o)}))}catch{this.logService.error("Failed to apply code action on save")}finally{t.report({increment:100}),v.dispose()}}}createCodeActionsOnSave(i){let e=i.map(t=>new Is(t));return e.filter(t=>e.every(o=>o.equals(t)||!o.contains(t)))}};kit=I([m(0,B),m(1,ne),m(2,ns),m(3,Nt),m(4,F)],kit);var bhe=class a{static async checkAndRunFormatCodeAction(i,e,t,o){let n=i.get(F),r=i.get(Nt),s=i.get(ne),l=i.get(B),c=new P,u=!1;t.report({message:d(11741,null)});try{let p=e.cells[0],h=await r.createModelReference(p.uri);c.add(h);let g=h.object.textEditorModel,f=l.getValue(ft.defaultFormatter);u=await n.invokeFunction(a.applyOnSaveFormatCodeAction,g,new Is("notebook.format"),[],f,t,o)}catch{s.error("Failed to apply notebook format action on save")}finally{t.report({increment:100}),c.dispose()}return u}static async applyOnSaveGenericCodeActions(i,e,t,o,n,r){let s=i.get(F),l=i.get(zt),c=i.get(ne),u=new class{constructor(){this._names=new Set}_report(){n.report({message:d(11736,null,[...this._names].map(p=>`'${p}'`).join(", "),"command:workbench.action.openSettings?%5B%22notebook.codeActionsOnSave%22%5D")})}report(p){p.displayName&&!this._names.has(p.displayName)&&(this._names.add(p.displayName),this._report())}};for(let p of t){let h=await a.getActionsToRun(e,p,o,l,u,r);if(r.isCancellationRequested){h.dispose();return}try{for(let g of h.validActions){let f=g.action.edit?.edits,v=!1;if(!g.action.kind?.startsWith("notebook"))for(let b of f??[]){let S=b;if(!(S.resource&&Xe(S.resource,e.uri))){v=!0;break}}if(v){c.warn("Failed to apply code action on save, applied to multiple resources.");continue}if(n.report({message:d(11735,null,g.action.title)}),await s.invokeFunction(Nq,g,"onSave",{},r),r.isCancellationRequested)return}}catch{}finally{h.dispose()}}}static async applyOnSaveFormatCodeAction(i,e,t,o,n,r,s){let l=i.get(F),c=i.get(zt),u=i.get(ne),p=new class{constructor(){this._names=new Set}_report(){r.report({message:d(11736,null,[...this._names].map(g=>`'${g}'`).join(", "),"command:workbench.action.openSettings?%5B%22notebook.defaultFormatter%22%5D")})}report(g){g.displayName&&!this._names.has(g.displayName)&&(this._names.add(g.displayName),this._report())}},h=await a.getActionsToRun(e,t,o,c,p,s);if(h.validActions.length>1&&!n&&u.warn("More than one format code action is provided, the 0th one will be used. A default can be specified via `notebook.defaultFormatter` in your settings."),s.isCancellationRequested)return h.dispose(),!1;try{let g=n?h.validActions.find(f=>f.provider?.extensionId===n):h.validActions[0];if(!g||(r.report({message:d(11735,null,g.action.title)}),await l.invokeFunction(Nq,g,"onSave",{},s),s.isCancellationRequested))return!1}catch{return u.error("Failed to apply notebook format code action on save"),!1}finally{h.dispose()}return!0}static getActionsToRun(i,e,t,o,n,r){return DL(o.codeActionProvider,i,i.getFullModelRange(),{type:1,triggerAction:"save participants",filter:{include:e,excludes:t,includeSourceActions:!0}},n,r)}};function iTi(a){let i=a.activeEditorPane;return qn(i)?.activeCodeEditor}var Eit=class extends C{constructor(e,t){super();this.instantiationService=e;this.workingCopyFileService=t;this.registerSaveParticipants()}registerSaveParticipants(){this._register(this.workingCopyFileService.addSaveParticipant(this.instantiationService.createInstance(wit))),this._register(this.workingCopyFileService.addSaveParticipant(this.instantiationService.createInstance(kit))),this._register(this.workingCopyFileService.addSaveParticipant(this.instantiationService.createInstance(yit))),this._register(this.workingCopyFileService.addSaveParticipant(this.instantiationService.createInstance(xit))),this._register(this.workingCopyFileService.addSaveParticipant(this.instantiationService.createInstance(Cit)))}};Eit=I([m(0,F),m(1,kp)],Eit);var IXo=oe.as(Qi.Workbench);IXo.registerWorkbenchContribution(Eit,3);W(class extends K{constructor(){super({id:"notebook.format",title:L(11693,"Format Notebook"),category:jm,precondition:x.and(Ua,Kl),keybinding:{when:ue.editorTextFocus.toNegated(),primary:1572,linux:{primary:3111},weight:200},f1:!0,menu:{id:D.EditorContext,when:x.and(ue.inCompositeEditor,ue.hasDocumentFormattingProvider),group:"1_modification",order:1.3}})}async run(a){let i=a.get(ee),e=a.get(Nt),t=a.get($s),o=a.get(zt),n=a.get(ma),r=a.get(F),s=qn(i.activeEditorPane);if(!s||!s.hasModel())return;let l=s.textModel,c=await r.invokeFunction(bhe.checkAndRunFormatCodeAction,l,bm.None,ve.None),u=new P;try{if(!c){let p=await Promise.all(l.cells.map(async h=>{let g=await e.createModelReference(h.uri);u.add(g);let f=g.object.textEditorModel,v=await u4e(t,o,f,1,ve.None),b=[];if(v){for(let S of v)b.push(new ja(f.uri,S,f.getVersionId()));return b}return[]}));await n.apply(p.flat(),{label:d(11696,null),code:"undoredo.formatNotebook"})}}finally{u.dispose()}}});Jt(class extends xi{constructor(){super({id:"notebook.formatCell",label:L(11694,"Format Cell"),precondition:x.and(Ua,Kl,ue.inCompositeEditor,ue.writable,ue.hasDocumentFormattingProvider),kbOpts:{kbExpr:x.and(ue.editorTextFocus),primary:1572,linux:{primary:3111},weight:100},contextMenuOpts:{group:"1_modification",order:1.301}})}async run(i,e){e.hasModel()&&await i.get(F).invokeFunction(vle,e,1,bm.None,ve.None,!0)}});var _it=class{constructor(i,e,t,o,n,r){this.bulkEditService=i;this.languageFeaturesService=e;this.textModelService=t;this.editorWorkerService=o;this.configurationService=n;this._notebookService=r}async onWillExecuteCell(i){if(!this.configurationService.getValue(ft.formatOnCellExecution))return;let t=new P;try{let o=await Promise.all(i.map(async n=>{let r=this._notebookService.getNotebookTextModel(n.notebook);if(!r)return[];let s;for(let h of r.cells)if(h.handle===n.cellHandle){s=h;break}if(!s)return[];let l=await this.textModelService.createModelReference(s.uri);t.add(l);let c=l.object.textEditorModel,u=await u4e(this.editorWorkerService,this.languageFeaturesService,c,2,ve.None),p=[];return u?(p.push(...u.map(h=>new ja(c.uri,h,c.getVersionId()))),p):[]}));await this.bulkEditService.apply(o.flat(),{label:d(11695,null),code:"undoredo.notebooks.onWillExecuteFormat"})}finally{t.dispose()}}};_it=I([m(0,ma),m(1,zt),m(2,Nt),m(3,$s),m(4,B),m(5,un)],_it);var Dit=class extends C{constructor(e,t){super();this.instantiationService=e;this.notebookExecutionService=t;this.registerKernelExecutionParticipants()}registerKernelExecutionParticipants(){this._register(this.notebookExecutionService.registerExecutionParticipant(this.instantiationService.createInstance(_it)))}};Dit=I([m(0,F),m(1,AY)],Dit);var yXo=oe.as(Qi.Workbench);yXo.registerWorkbenchContribution(Dit,3);var t1t="hasOpenedNotebook",pgo="hasShownNotebookGettingStarted",Lit=class extends C{constructor(i,e,t,o,n){super();let r=Fao.bindTo(t),s=new Bl("notebookGettingStarted2",e),l=s.getMemento(0,0);l[t1t]&&r.set(!0);let c=n.getValue(ft.openGettingStarted)&&!l[pgo];if(!l[t1t]||c){let u=()=>{r.set(!0),l[t1t]=!0,c&&(o.executeCommand("workbench.action.openWalkthrough",{category:"notebooks",step:"notebookProfile"},!0),l[pgo]=!0),s.saveMemento()};if(i.activeEditor?.typeId===ha.ID){u();return}let p=this._register(i.onDidActiveEditorChange(()=>{i.activeEditor?.typeId===ha.ID&&(p.dispose(),u())}))}}};Lit=I([m(0,ee),m(1,le),m(2,X),m(3,ge),m(4,B)],Lit);oe.as(Qi.Workbench).registerWorkbenchContribution(Lit,3);W(class extends K{constructor(){super({id:"workbench.notebook.layout.gettingStarted",title:L(11697,"Reset notebook getting started"),f1:!0,precondition:x.equals(`config.${ft.openGettingStarted}`,!0),category:We.Developer})}run(i){let e=i.get(le),t=new Bl("notebookGettingStarted",e),o=t.getMemento(0,0);o[t1t]=void 0,t.saveMemento()}});var wXo="notebook.toggleCellToolbarPosition",oTi=class extends K{constructor(){super({id:wXo,title:L(11698,"Toggle Cell Toolbar Position"),menu:[{id:D.NotebookCellTitle,group:"View",order:1}],category:jm,f1:!1})}async run(i,e){let t=e&&e.ui?e.notebookEditor:void 0;if(t&&t.hasModel()){let o=t.textModel.viewType,n=i.get(B),r=n.getValue(ft.cellToolbarLocation),s=this.togglePosition(o,r);await n.updateValue(ft.cellToolbarLocation,s)}}togglePosition(i,e){if(typeof e=="string")if(["left","right","hidden"].indexOf(e)>=0){let t=e==="right"?"left":"right",o={default:e};return o[i]=t,o}else{let t={default:"right"};return t[i]="left",t}else{let o=(e[i]??e.default??"right")==="right"?"left":"right",n={...e};return n[i]=o,n}}};W(oTi);var kNe=class{constructor(i,e,t){this._markerService=i;this._configService=t;this._dispoables=e.registerProvider(this)}static{this.ID="workbench.contrib.markerListProvider"}dispose(){this._dispoables.dispose()}getMarkerList(i){if(!i)return;let e=Zo.parse(i);if(e)return new rle(t=>Zo.parse(t)?.notebook.toString()===e.notebook.toString(),this._markerService,this._configService)}};kNe=I([m(0,Ns),m(1,X5e),m(2,B)],kNe);var She=class extends C{constructor(e,t){super();this._notebookEditor=e;this._markerService=t;this._markersOverviewRulerDecorations=[];this._update(),this._register(this._notebookEditor.onDidChangeModel(()=>this._update())),this._register(this._markerService.onMarkerChanged(o=>{o.some(n=>this._notebookEditor.getCellsInRange().some(r=>Xe(r.uri,n)))&&this._update()}))}static{this.id="workbench.notebook.markerDecoration"}_update(){if(!this._notebookEditor.hasModel())return;let e=[];this._notebookEditor.getCellsInRange().forEach(t=>{this._markerService.read({resource:t.uri,severities:12}).forEach(n=>{let r=n.severity===8?av:Bh,s={startLineNumber:n.startLineNumber,startColumn:n.startColumn,endLineNumber:n.endLineNumber,endColumn:n.endColumn};e.push({handle:t.handle,options:{overviewRuler:{color:r,modelRanges:[s],includeOutput:!1,position:4}}})})}),this._markersOverviewRulerDecorations=this._notebookEditor.deltaCellDecorations(this._markersOverviewRulerDecorations,e)}};I([OM(100)],She.prototype,"_update",1),She=I([m(1,Ns)],She);pt(kNe.ID,kNe,ut.BlockRestore);tm(She.id,She);var CXo="notebook.focusTop",xXo="notebook.focusBottom",kXo="notebook.focusPreviousEditor",EXo="notebook.focusNextEditor",TXo="notebook.cell.focusInOutput",_Xo="notebook.cell.focusOutOutput",nTi="notebook.centerActiveCell",DXo="notebook.cell.cursorPageUp",LXo="notebook.cell.cursorPageUpSelect",RXo="notebook.cell.cursorPageDown",MXo="notebook.cell.cursorPageDownSelect";W(class extends K{constructor(){super({id:"notebook.cell.nullAction",title:d(11714,null),keybinding:[{when:yZ,primary:18,weight:201},{when:yZ,primary:16,weight:201}],f1:!1})}run(){}});W(class extends gd{constructor(){super({id:EXo,title:d(11704,null),keybinding:[{when:x.and(rr,$a.negate(),x.equals("config.notebook.navigation.allowNavigateToSurroundingCells",!0),x.and(x.has(Uu),ue.editorTextFocus,tce.notEqualsTo("top"),tce.notEqualsTo("none"),x.or(ice.isEqualTo("end"),ice.isEqualTo("both"))),ue.isEmbeddedDiffEditor.negate()),primary:18,weight:rf},{when:x.and(rr,$a.negate(),x.equals("config.notebook.navigation.allowNavigateToSurroundingCells",!0),x.and(hS.isEqualTo("markup"),wZ.isEqualTo(!1),VJe),ue.isEmbeddedDiffEditor.negate()),primary:18,weight:200},{when:x.and(rr,PR),primary:2066,mac:{primary:2322},weight:200},{when:x.and(AR,$a),primary:2060,mac:{primary:267},weight:201}]})}async runWithContext(i,e){let t=e.notebookEditor,o=e.cell,n=t.getCellIndex(o);if(typeof n!="number"||n>=t.getLength()-1)return;let r=o.textBuffer.getLineCount(),s=e.cell??e.selectedCells?.[0],l=s?xZ(e,s):void 0;if(l&&l.hasTextFocus()&&_m.get(l)?.getWidgetPosition()?.lineNumber===r)_m.get(l)?.focus();else{let c=t.cellAt(n+1),u=c.cellKind===1&&c.getEditState()===0?"container":"editor";await t.focusNotebookCell(c,u,{focusEditorLine:1})}}});W(class extends gd{constructor(){super({id:kXo,title:d(11705,null),keybinding:[{when:x.and(rr,$a.negate(),x.equals("config.notebook.navigation.allowNavigateToSurroundingCells",!0),x.and(x.has(Uu),ue.editorTextFocus,tce.notEqualsTo("bottom"),tce.notEqualsTo("none"),x.or(ice.isEqualTo("start"),ice.isEqualTo("both"))),ue.isEmbeddedDiffEditor.negate()),primary:16,weight:rf},{when:x.and(rr,$a.negate(),x.equals("config.notebook.navigation.allowNavigateToSurroundingCells",!0),x.and(hS.isEqualTo("markup"),wZ.isEqualTo(!1),VJe),ue.isEmbeddedDiffEditor.negate()),primary:16,weight:200},{when:x.and(AR,$a),primary:2059,mac:{primary:267},weight:201}]})}async runWithContext(i,e){let t=e.notebookEditor,o=e.cell,n=t.getCellIndex(o);if(typeof n!="number"||n<1||t.getLength()===0)return;let r=t.cellAt(n-1),s=r.cellKind===1&&r.getEditState()===0?"container":"editor",l=r.textBuffer.getLineCount();await t.focusNotebookCell(r,s,{focusEditorLine:l});let c=xZ(e,r);c&&_m.get(c)?.getWidgetPosition()?.lineNumber===l&&_m.get(c)?.focus()}});W(class extends qu{constructor(){super({id:CXo,title:d(11710,null),keybinding:[{when:x.and(rr,x.not(Uu)),primary:2062,weight:200},{when:x.and(rr,x.not(Uu)),mac:{primary:2064},weight:200}]})}async runWithContext(a,i){let e=i.notebookEditor;if(e.getLength()===0)return;let t=e.cellAt(0);await e.focusNotebookCell(t,"container")}});W(class extends qu{constructor(){super({id:xXo,title:d(11711,null),keybinding:[{when:x.and(rr,x.not(Uu)),primary:2061,mac:void 0,weight:200},{when:x.and(rr,x.not(Uu)),mac:{primary:2066},weight:200}]})}async runWithContext(a,i){let e=i.notebookEditor;if(!e.hasModel()||e.getLength()===0)return;let t=e.getLength()-1,o=e.getPreviousVisibleCellIndex(t);if(o){let n=e.cellAt(o);await e.focusNotebookCell(n,"container")}}});W(class extends gd{constructor(){super({id:TXo,title:L(11712,"Focus In Active Cell Output"),f1:!0,keybinding:[{when:x.and(mS.negate(),Zy,gk),primary:2066,weight:200},{primary:3090,mac:{primary:2322},weight:200}],precondition:Wao})}async runWithContext(a,i){let e=i.notebookEditor,t=i.cell;return Pi(0).then(()=>e.focusNotebookCell(t,"output"))}});W(class extends gd{constructor(){super({id:_Xo,title:d(11713,null),keybinding:{primary:3088,mac:{primary:2320},weight:200},precondition:x.and(rr,PR)})}async runWithContext(a,i){let e=i.notebookEditor,t=i.cell;await e.focusNotebookCell(t,"editor")}});W(class extends gd{constructor(){super({id:nTi,title:d(11716,null),keybinding:{when:rr,primary:2090,mac:{primary:298},weight:200}})}async runWithContext(i,e){return e.notebookEditor.revealInCenter(e.cell)}});W(class extends gd{constructor(){super({id:DXo,title:d(11708,null),keybinding:[{when:x.and(rr,x.has(Uu),ue.editorTextFocus),primary:11,weight:rf}]})}async runWithContext(a,i){aa.getEditorCommand("cursorPageUp").runCommand(a,{pageSize:i1t(i)})}});W(class extends gd{constructor(){super({id:LXo,title:d(11709,null),keybinding:[{when:x.and(rr,x.has(Uu),ue.editorTextFocus,PR.negate()),primary:1035,weight:rf}]})}async runWithContext(a,i){aa.getEditorCommand("cursorPageUpSelect").runCommand(a,{pageSize:i1t(i)})}});W(class extends gd{constructor(){super({id:RXo,title:d(11706,null),keybinding:[{when:x.and(rr,x.has(Uu),ue.editorTextFocus),primary:12,weight:rf}]})}async runWithContext(a,i){aa.getEditorCommand("cursorPageDown").runCommand(a,{pageSize:i1t(i)})}});W(class extends gd{constructor(){super({id:MXo,title:d(11707,null),keybinding:[{when:x.and(rr,x.has(Uu),ue.editorTextFocus,PR.negate()),primary:1036,weight:rf}]})}async runWithContext(a,i){aa.getEditorCommand("cursorPageDownSelect").runCommand(a,{pageSize:i1t(i)})}});function i1t(a){let e=a.notebookEditor.getViewModel().layoutInfo,t=e?.fontInfo.lineHeight||17;return Math.max(1,Math.floor((e?.height||0)/t)-2)}oe.as(ii.Configuration).registerConfiguration({id:"notebook",order:100,type:"object",properties:{"notebook.navigation.allowNavigateToSurroundingCells":{type:"boolean",default:!0,markdownDescription:d(11715,null)}}});var PXo={default:{[ft.focusIndicator]:"gutter",[ft.insertToolbarLocation]:"both",[ft.globalToolbar]:!0,[ft.cellToolbarLocation]:{default:"right"},[ft.compactView]:!0,[ft.showCellStatusBar]:"visible",[ft.consolidatedRunButton]:!0,[ft.undoRedoPerCell]:!1},jupyter:{[ft.focusIndicator]:"gutter",[ft.insertToolbarLocation]:"notebookToolbar",[ft.globalToolbar]:!0,[ft.cellToolbarLocation]:{default:"left"},[ft.compactView]:!0,[ft.showCellStatusBar]:"visible",[ft.consolidatedRunButton]:!1,[ft.undoRedoPerCell]:!0},colab:{[ft.focusIndicator]:"border",[ft.insertToolbarLocation]:"betweenCells",[ft.globalToolbar]:!1,[ft.cellToolbarLocation]:{default:"right"},[ft.compactView]:!1,[ft.showCellStatusBar]:"hidden",[ft.consolidatedRunButton]:!0,[ft.undoRedoPerCell]:!1}};async function AXo(a,i){let e=[];for(let t in i)e.push(a.updateValue(t,i[t]));await Promise.all(e)}W(class extends K{constructor(){super({id:"notebook.setProfile",title:d(11734,null)})}async run(a,i){if(!NXo(i))return;let e=a.get(B);return AXo(e,PXo[i.profile])}});function NXo(a){let i=a;return i.profile==="colab"||i.profile==="default"||i.profile==="jupyter"}var Rit=class{constructor(i,e){this._notebookService=i;this._languageService=e;this.viewType="*"}async provideCellStatusBarItems(i,e,t){let n=this._notebookService.getNotebookTextModel(i)?.cells[e];if(!n)return;let r=[],s=n.language;if(n.cellKind===1)s="markdown";else if(this._languageService.getLanguageIdByLanguageName(n.language))s=this._languageService.getLanguageName(s)??s;else{let c=d(11652,null,n.language);r.push({text:"$(dialog-warning)",command:{id:"workbench.extensions.search",arguments:[`@tag:${n.language}`],title:"Search Extensions"},tooltip:c,alignment:2,priority:-Number.MAX_SAFE_INTEGER+1})}return r.push({text:s,command:AEt,tooltip:d(11651,null),alignment:2,priority:-Number.MAX_SAFE_INTEGER}),{items:r}}};Rit=I([m(0,un),m(1,kt)],Rit);var Mit=class{constructor(i,e,t,o,n,r){this._notebookService=i;this._notebookKernelService=e;this._languageService=t;this._configurationService=o;this._languageDetectionService=n;this._keybindingService=r;this.viewType="*";this.cache=new vt}async provideCellStatusBarItems(i,e,t){let o=this._notebookService.getNotebookTextModel(i),n=o?.cells[e];if(!n)return;let r=this._configurationService.getValue("workbench.editor.languageDetectionHints");if(!(typeof r=="object"&&r?.notebookEditors))return;let l=n.uri,c=n.textModel?.getVersionId();if(!c)return;let u=n.cellKind===1?"markdown":this._languageService.getLanguageIdByLanguageName(n.language)||n.language;this.cache.has(l)||this.cache.set(l,{cellLanguage:u,updateTimestamp:0,contentVersion:1});let p=this.cache.get(l);if(p.cellLanguage!==u||p.updateTimestamp<Date.now()-1e3&&p.contentVersion!==c){p.updateTimestamp=Date.now(),p.cellLanguage=u,p.contentVersion=c;let g=this._notebookKernelService.getSelectedOrSuggestedKernel(o);if(g){let f=[...g.supportedLanguages,"markdown"];p.guess=await this._languageDetectionService.detectLanguage(n.uri,f)}}let h=[];if(p.guess&&u!==p.guess){let g=this._languageService.getLanguageName(p.guess)||p.guess,f=this._keybindingService.appendKeybinding(d(11650,null,g),T8e);h.push({text:"$(lightbulb-autofix)",command:T8e,tooltip:f,alignment:2,priority:-Number.MAX_SAFE_INTEGER+1})}return{items:h}}};Mit=I([m(0,un),m(1,Tl),m(2,kt),m(3,B),m(4,eS),m(5,_e)],Mit);var Pit=class extends C{constructor(i,e){super(),[Rit,Mit].forEach(o=>{this._register(e.registerCellStatusBarItemProvider(i.createInstance(o)))})}};Pit=I([m(0,F),m(1,qX)],Pit);oe.as(Qi.Workbench).registerWorkbenchContribution(Pit,3);var ENe=class extends C{constructor(e){super();this._notebookEditor=e;this._onDidChangeVisibleCells=this._register(new E);this.onDidChangeVisibleCells=this._onDidChangeVisibleCells.event;this._viewModelDisposables=this._register(new P);this._visibleCells=[];this._register(this._notebookEditor.onDidChangeVisibleRanges(this._updateVisibleCells,this)),this._register(this._notebookEditor.onDidChangeModel(this._onModelChange,this)),this._updateVisibleCells()}get visibleCells(){return this._visibleCells}_onModelChange(){this._viewModelDisposables.clear(),this._notebookEditor.hasModel()&&this._viewModelDisposables.add(this._notebookEditor.onDidChangeViewCells(()=>this.updateEverything())),this.updateEverything()}updateEverything(){this._onDidChangeVisibleCells.fire({added:[],removed:Array.from(this._visibleCells)}),this._visibleCells=[],this._updateVisibleCells()}_updateVisibleCells(){if(!this._notebookEditor.hasModel())return;let e=Lf(this._notebookEditor.visibleRanges).map(l=>this._notebookEditor.cellAt(l)).filter(mo),t=new Set(e.map(l=>l.handle)),o=new Set(this._visibleCells.map(l=>l.handle)),n=HH(o,t),r=n.added.map(l=>this._notebookEditor.getCellByHandle(l)).filter(mo),s=n.removed.map(l=>this._notebookEditor.getCellByHandle(l)).filter(mo);this._visibleCells=e,this._onDidChangeVisibleCells.fire({added:r,removed:s})}};var TNe=class extends C{constructor(e,t){super();this._notebookEditor=e;this._notebookCellStatusBarService=t;this._visibleCells=new Map;this._observer=this._register(new ENe(this._notebookEditor)),this._register(this._observer.onDidChangeVisibleCells(this._updateVisibleCells,this)),this._updateEverything(),this._register(this._notebookCellStatusBarService.onDidChangeProviders(this._updateEverything,this)),this._register(this._notebookCellStatusBarService.onDidChangeItems(this._updateEverything,this))}static{this.id="workbench.notebook.statusBar.contributed"}_updateEverything(){let e=this._observer.visibleCells.filter(s=>!this._visibleCells.has(s.handle)),t=new Set(this._observer.visibleCells.map(s=>s.handle)),o=Array.from(this._visibleCells.keys()),n=o.filter(s=>!t.has(s)),r=o.filter(s=>t.has(s));this._updateVisibleCells({added:e,removed:n.map(s=>({handle:s}))}),r.forEach(s=>this._visibleCells.get(s)?.update())}_updateVisibleCells(e){let t=this._notebookEditor.getViewModel();if(t){for(let o of e.added){let n=new rTi(t,o,this._notebookCellStatusBarService);this._visibleCells.set(o.handle,n)}for(let o of e.removed)this._visibleCells.get(o.handle)?.dispose(),this._visibleCells.delete(o.handle)}}dispose(){super.dispose(),this._visibleCells.forEach(e=>e.dispose()),this._visibleCells.clear()}};TNe=I([m(1,qX)],TNe);var rTi=class extends C{constructor(e,t,o){super();this._notebookViewModel=e;this._cell=t;this._notebookCellStatusBarService=o;this._currentItemIds=[];this._currentItemLists=[];this._isDisposed=!1;this._updateThrottler=this._register(new um);this._register(Z(()=>this._activeToken?.dispose(!0))),this._updateSoon(),this._register(this._cell.model.onDidChangeContent(()=>this._updateSoon())),this._register(this._cell.model.onDidChangeLanguage(()=>this._updateSoon())),this._register(this._cell.model.onDidChangeMetadata(()=>this._updateSoon())),this._register(this._cell.model.onDidChangeInternalMetadata(()=>this._updateSoon())),this._register(this._cell.model.onDidChangeOutputs(()=>this._updateSoon()))}update(){this._updateSoon()}_updateSoon(){setTimeout(()=>{this._isDisposed||this._updateThrottler.queue(()=>this._update())},0)}async _update(){let e=this._notebookViewModel.getCellIndex(this._cell),t=this._notebookViewModel.notebookDocument.uri,o=this._notebookViewModel.notebookDocument.viewType;this._activeToken?.dispose(!0);let n=this._activeToken=new $e,r=await this._notebookCellStatusBarService.getStatusBarItemsForCell(t,e,o,n.token);if(n.token.isCancellationRequested){r.forEach(c=>c.dispose&&c.dispose());return}let s=r.map(c=>c.items).flat(),l=this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds,[{handle:this._cell.handle,items:s}]);this._currentItemLists.forEach(c=>c.dispose&&c.dispose()),this._currentItemLists=r,this._currentItemIds=l}dispose(){super.dispose(),this._isDisposed=!0,this._activeToken?.dispose(!0),this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds,[{handle:this._cell.handle,items:[]}]),this._currentItemLists.forEach(e=>e.dispose&&e.dispose())}};tm(TNe.id,TNe);function Ihe(a,i=!0){if(i&&a<1e3)return`${a}ms`;let e=Math.floor(a/1e3/60),t=Math.floor(a/1e3)%60,o=Math.floor(a%1e3/100);return e>0?`${e}m ${t}.${o}s`:`${t}.${o}s`}var _Ne=class extends C{constructor(e,t){super();this._notebookEditor=e;this._itemFactory=t;this._visibleCells=new Map;this._observer=this._register(new ENe(this._notebookEditor)),this._register(this._observer.onDidChangeVisibleCells(this._updateVisibleCells,this)),this._updateEverything()}_updateEverything(){this._visibleCells.forEach(Ue),this._visibleCells.clear(),this._updateVisibleCells({added:this._observer.visibleCells,removed:[]})}_updateVisibleCells(e){let t=this._notebookEditor.getViewModel();if(t){for(let o of e.removed)this._visibleCells.get(o.handle)?.dispose(),this._visibleCells.delete(o.handle);for(let o of e.added)this._visibleCells.set(o.handle,this._itemFactory(t,o))}}dispose(){super.dispose(),this._visibleCells.forEach(Ue),this._visibleCells.clear()}},L2=class extends C{static{this.id="workbench.notebook.statusBar.execState"}constructor(i,e){super(),this._register(new _Ne(i,(t,o)=>e.createInstance(yhe,t,o)))}};L2=I([m(1,F)],L2);tm(L2.id,L2);var yhe=class extends C{constructor(e,t,o){super();this._notebookViewModel=e;this._cell=t;this._executionStateService=o;this._currentItemIds=[];this._clearExecutingStateTimer=this._register(new me);this._update(),this._register(this._executionStateService.onDidChangeExecution(n=>{n.type===0&&n.affectsCell(this._cell.uri)&&this._update()})),this._register(this._cell.model.onDidChangeInternalMetadata(()=>this._update()))}static{this.MIN_SPINNER_TIME=500}async _update(){let e=this._getItemsForCell();Array.isArray(e)&&(this._currentItemIds=this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds,[{handle:this._cell.handle,items:e}]))}_getItemsForCell(){let e=this._executionStateService.getCellExecution(this._cell.uri);if(e?.state===3&&typeof this._showedExecutingStateTime!="number")this._showedExecutingStateTime=Date.now();else if(e?.state!==3&&typeof this._showedExecutingStateTime=="number"){let o=yhe.MIN_SPINNER_TIME-(Date.now()-this._showedExecutingStateTime);if(o>0){this._clearExecutingStateTimer.value||(this._clearExecutingStateTimer.value=nn(()=>{this._showedExecutingStateTime=void 0,this._clearExecutingStateTimer.clear(),this._update()},o));return}else this._showedExecutingStateTime=void 0}return this._getItemForState(e,this._cell.internalMetadata)}_getItemForState(e,t){let o=e?.state,{lastRunSuccess:n}=t;return!o&&n?[{text:`$(${xWt.id})`,color:Ss(Ico),tooltip:d(11646,null),alignment:1,priority:Number.MAX_SAFE_INTEGER}]:!o&&n===!1?[{text:`$(${oRe.id})`,color:Ss(wco),tooltip:d(11644,null),alignment:1,priority:Number.MAX_SAFE_INTEGER}]:o===2||o===1?[{text:`$(${kWt.id})`,tooltip:d(11645,null),alignment:1,priority:Number.MAX_SAFE_INTEGER}]:o===3?[{text:`$(${(e?.didPause?Sw:q.modify(Sw,"spin")).id})`,tooltip:d(11643,null),alignment:1,priority:Number.MAX_SAFE_INTEGER}]:[]}dispose(){super.dispose(),this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds,[{handle:this._cell.handle,items:[]}])}};yhe=I([m(2,rs)],yhe);var R2=class extends C{static{this.id="workbench.notebook.statusBar.execTimer"}constructor(i,e){super(),this._register(new _Ne(i,(t,o)=>e.createInstance(whe,t,o)))}};R2=I([m(1,F)],R2);tm(R2.id,R2);var OXo=200,whe=class extends C{constructor(e,t,o,n,r){super();this._notebookViewModel=e;this._cell=t;this._executionStateService=o;this._notebookService=n;this._configurationService=r;this._currentItemIds=[];this._isVerbose=this._configurationService.getValue(ft.cellExecutionTimeVerbosity)==="verbose",this._scheduler=this._register(new Dt(()=>this._update(),whe.UPDATE_INTERVAL)),this._update(),this._register(this._cell.model.onDidChangeInternalMetadata(()=>this._update())),this._register(this._configurationService.onDidChangeConfiguration(s=>{s.affectsConfiguration(ft.cellExecutionTimeVerbosity)&&(this._isVerbose=this._configurationService.getValue(ft.cellExecutionTimeVerbosity)==="verbose",this._update())}))}static{this.UPDATE_INTERVAL=100}async _update(){let e,t=this._executionStateService.getCellExecution(this._cell.uri),o=t?.state,n=this._cell.internalMetadata.runStartTime,r=this._cell.internalMetadata.runStartTimeAdjustment??0,s=this._cell.internalMetadata.runEndTime;if(t?.didPause)e=void 0;else if(o===3)typeof n=="number"&&(e=this._getTimeItem(n,Date.now(),r),this._scheduler.schedule());else if(!o&&typeof n=="number"&&typeof s=="number"){let c=Date.now()-n+r,u=s-n,p=this._cell.internalMetadata.renderDuration??{};e=this._getTimeItem(n,s,void 0,{timerDuration:c,executionDuration:u,renderDuration:p})}let l=e?[e]:[];!l.length&&t?this._deferredUpdate||(this._deferredUpdate=nn(()=>{this._deferredUpdate=void 0,this._currentItemIds=this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds,[{handle:this._cell.handle,items:l}])},OXo,this._store)):(this._deferredUpdate?.dispose(),this._deferredUpdate=void 0,this._currentItemIds=this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds,[{handle:this._cell.handle,items:l}]))}_getTimeItem(e,t,o=0,n){let r=t-e+o,s,l=new Date(t).toLocaleTimeString(Dr);if(n){let{renderDuration:u,executionDuration:p,timerDuration:h}=n,g="";for(let f in u){let v=this._notebookService.getRendererInfo(f),b=encodeURIComponent(JSON.stringify({extensionId:v?.extensionId.value??"",issueBody:`Auto-generated text from notebook cell performance - Please add an explanation for the performance issue, including cell content if possible.
The duration for the renderer, ${v?.displayName??f}, is slower than expected.
Execution Time: ${Ihe(p)}
Renderer Duration: ${Ihe(u[f])}
`})),S=u[f]>200&&p<2e3||u[f]>1e3,y=v?.displayName??f,w=S?`[${y}](command:workbench.action.openIssueReporter?${b})`:`**${y}**`;g+=`- ${w} ${Ihe(u[f])}
`}g+=`
*${d(11648,null)}*
`,s={value:d(11647,null,l,Ihe(p),Ihe(h-p),g),isTrusted:!0}}return{text:this._isVerbose?d(11649,null,l,Ihe(r,!1)):Ihe(r,!1),alignment:1,priority:Number.MAX_SAFE_INTEGER-5,tooltip:s}}dispose(){super.dispose(),this._deferredUpdate?.dispose(),this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds,[{handle:this._cell.handle,items:[]}])}};whe=I([m(2,rs),m(3,un),m(4,B)],whe);var Ait=class{constructor(i,e,t,o,n){let r=new P;this.dispose=r.dispose.bind(r);let s=()=>{r.clear(),t.selectKernelForNotebook(e,i)};r.add(i.onDidChangeContent(l=>{for(let c of l.rawEvents)switch(c.kind){case 10:case 1:case 2:case 5:n.trace("IMPLICIT kernel selection because of change event",c.kind),s();break}})),r.add(o.hoverProvider.register({scheme:Y.vscodeNotebookCell,pattern:i.uri.path},{provideHover(){n.trace("IMPLICIT kernel selection because of hover"),s()}}))}};Ait=I([m(2,Tl),m(3,zt),m(4,ne)],Ait);var Nit=class extends C{constructor(e,t,o,n){super();this._editorService=e;this._statusbarService=t;this._notebookKernelService=o;this._instantiationService=n;this._editorDisposables=this._register(new P);this._kernelInfoElement=this._register(new P);this._register(this._editorService.onDidActiveEditorChange(()=>this._updateStatusbar())),this._updateStatusbar()}_updateStatusbar(){this._editorDisposables.clear();let e=qn(this._editorService.activeEditorPane);if(!e){this._kernelInfoElement.clear();return}let t=()=>{if(e.notebookOptions.getDisplayOptions().globalToolbar){this._kernelInfoElement.clear();return}let o=e.textModel;o?this._showKernelStatus(o):this._kernelInfoElement.clear()};this._editorDisposables.add(this._notebookKernelService.onDidAddKernel(t)),this._editorDisposables.add(this._notebookKernelService.onDidChangeSelectedNotebooks(t)),this._editorDisposables.add(this._notebookKernelService.onDidChangeNotebookAffinity(t)),this._editorDisposables.add(e.onDidChangeModel(t)),this._editorDisposables.add(e.notebookOptions.onDidChangeOptions(t)),t()}_showKernelStatus(e){this._kernelInfoElement.clear();let{selected:t,suggestions:o,all:n}=this._notebookKernelService.getMatchingKernel(e),r=(o.length===1?o[0]:void 0)??n.length===1?n[0]:void 0,s=!1;if(n.length!==0)if(t||r){let l=t;l||(l=r,s=!0,this._kernelInfoElement.add(this._instantiationService.createInstance(Ait,e,l)));let c=l.description??l.detail??l.label;this._kernelInfoElement.add(this._statusbarService.addEntry({name:d(11663,null),text:`$(notebook-kernel-select) ${l.label}`,ariaLabel:l.label,tooltip:s?d(11668,null,c):c,command:tT},tT,1,10)),this._kernelInfoElement.add(l.onDidChange(()=>this._showKernelStatus(e)))}else this._kernelInfoElement.add(this._statusbarService.addEntry({name:d(11665,null),text:d(11660,null),ariaLabel:d(11660,null),command:tT,kind:"prominent"},tT,1,10))}};Nit=I([m(0,ee),m(1,Tr),m(2,Tl),m(3,F)],Nit);var Oit=class extends C{constructor(e,t){super();this._editorService=e;this._statusbarService=t;this._itemDisposables=this._register(new P);this._accessor=this._register(new me);this._register(this._editorService.onDidActiveEditorChange(()=>this._update())),this._update()}_update(){this._itemDisposables.clear();let e=qn(this._editorService.activeEditorPane);e?(this._itemDisposables.add(e.onDidChangeSelection(()=>this._show(e))),this._itemDisposables.add(e.onDidChangeActiveCell(()=>this._show(e))),this._show(e)):this._accessor.clear()}_show(e){if(!e.hasModel()){this._accessor.clear();return}let t=this._getSelectionsText(e);if(!t){this._accessor.clear();return}let o={name:d(11661,null),text:t,ariaLabel:t,command:nTi};this._accessor.value?this._accessor.value.update(o):this._accessor.value=this._statusbarService.addEntry(o,"notebook.activeCellStatus",1,100)}_getSelectionsText(e){if(!e.hasModel())return;let t=e.getActiveCell();if(!t)return;let o=e.getCellIndex(t)+1,n=e.getSelections().reduce((s,l)=>s+(l.end-l.start),0),r=e.getLength();return n>1?d(11664,null,o,n):d(11666,null,o,r)}};Oit=I([m(0,ee),m(1,Tr)],Oit);var Fit=class extends C{constructor(e,t,o){super();this._editorService=e;this._statusbarService=t;this._configurationService=o;this._itemDisposables=this._register(new P);this._accessor=this._register(new me);this._register(this._editorService.onDidActiveEditorChange(()=>this._update())),this._register(this._configurationService.onDidChangeConfiguration(n=>{(n.affectsConfiguration("editor")||n.affectsConfiguration("notebook"))&&this._update()})),this._update()}static{this.ID="selectNotebookIndentation"}_update(){this._itemDisposables.clear();let e=qn(this._editorService.activeEditorPane);e?(this._show(e),this._itemDisposables.add(e.onDidChangeSelection(()=>{this._accessor.clear(),this._show(e)}))):this._accessor.clear()}_show(e){if(!e.hasModel()){this._accessor.clear();return}let t=e.getActiveCell()?.textModel?.getOptions();if(!t){this._accessor.clear();return}let o=e.notebookOptions.getDisplayOptions().editorOptionsCustomizations,n=o?.["editor.indentSize"]??t?.indentSize,r=o?.["editor.insertSpaces"]??t?.insertSpaces,s=o?.["editor.tabSize"]??t?.tabSize,l=typeof n=="number"?n:s,u=r?`Spaces: ${l}`:`Tab Size: ${l}`;if(!u){this._accessor.clear();return}let p={name:d(11662,null),text:u,ariaLabel:u,tooltip:d(11667,null),command:kEi};this._accessor.value?this._accessor.value.update(p):this._accessor.value=this._statusbarService.addEntry(p,"notebook.status.indentation",1,100.4)}};Fit=I([m(0,ee),m(1,Tr),m(2,B)],Fit);var DNe=class extends C{constructor(e){super();this.editorGroupService=e;for(let t of e.parts)this.createNotebookStatus(t);this._register(e.onDidCreateAuxiliaryEditorPart(t=>this.createNotebookStatus(t)))}static{this.ID="notebook.contrib.editorStatus"}createNotebookStatus(e){let t=new P;H.once(e.onWillDispose)(()=>t.dispose());let o=this.editorGroupService.getScopedInstantiationService(e);t.add(o.createInstance(Nit)),t.add(o.createInstance(Oit)),t.add(o.createInstance(Fit))}};DNe=I([m(0,Et)],DNe);pt(DNe.ID,DNe,ut.AfterRestored);var LNe=class extends C{constructor(e){super();this._editorService=e;let t=105;this._register(BT.addImplementation(t,"notebook-undo-redo",()=>{let o=qn(this._editorService.activeEditorPane),n=o?.getViewModel();return o&&o.hasEditorFocus()&&o.hasModel()&&n?n.undo().then(r=>{if(r?.length){for(let s=0;s<o.getLength();s++){let l=o.cellAt(s);l.cellKind===1&&r.find(c=>c.fragment===l.model.uri.fragment)&&l.updateEditState(1,"undo")}o?.setOptions({cellOptions:{resource:r[0]},preserveFocus:!0})}}):!1})),this._register(HT.addImplementation(t,"notebook-undo-redo",()=>{let o=qn(this._editorService.activeEditorPane),n=o?.getViewModel();return o&&o.hasEditorFocus()&&o.hasModel()&&n?n.redo().then(r=>{if(r?.length){for(let s=0;s<o.getLength();s++){let l=o.cellAt(s);l.cellKind===1&&r.find(c=>c.fragment===l.model.uri.fragment)&&l.updateEditState(1,"redo")}o?.setOptions({cellOptions:{resource:r[0]},preserveFocus:!0})}}):!1}))}static{this.ID="workbench.contrib.notebookUndoRedo"}};LNe=I([m(0,ee)],LNe);pt(LNe.ID,LNe,ut.BlockRestore);var FXo="notebook.cell.moveUp",WXo="notebook.cell.moveDown",VXo="notebook.cell.copyUp",BXo="notebook.cell.copyDown";W(class extends gd{constructor(){super({id:FXo,title:L(11633,"Move Cell Up"),icon:Jao,keybinding:{primary:528,when:x.and(rr,$h.toNegated()),weight:200},menu:{id:D.NotebookCellTitle,when:x.equals("config.notebook.dragAndDropEnabled",!1),group:"3_edit",order:14}})}async runWithContext(a,i){return Dwi(i,"up")}});W(class extends gd{constructor(){super({id:WXo,title:L(11632,"Move Cell Down"),icon:Zao,keybinding:{primary:530,when:x.and(rr,$h.toNegated()),weight:200},menu:{id:D.NotebookCellTitle,when:x.equals("config.notebook.dragAndDropEnabled",!1),group:"3_edit",order:14}})}async runWithContext(a,i){return Dwi(i,"down")}});W(class extends gd{constructor(){super({id:VXo,title:L(11624,"Copy Cell Up"),keybinding:{primary:1552,when:x.and(rr,$h.toNegated()),weight:200}})}async runWithContext(a,i){return Lwi(i,"up")}});W(class extends gd{constructor(){super({id:BXo,title:L(11623,"Copy Cell Down"),keybinding:{primary:1554,when:x.and(rr,$h.toNegated()),weight:200},menu:{id:D.NotebookCellTitle,when:x.and(rr,Kl,bw),group:"3_edit",order:13}})}async runWithContext(a,i){return Lwi(i,"down")}});var HXo="notebook.cell.split",UXo="notebook.cell.joinSelected",zXo="notebook.cell.joinAbove",KXo="notebook.cell.joinBelow";W(class extends gd{constructor(){super({id:HXo,title:L(11634,"Split Cell"),menu:{id:D.NotebookCellTitle,when:x.and(Kl,bw,JLe.toNegated()),order:5,group:VF},icon:elo,keybinding:{when:x.and(rr,Kl,bw,ue.editorTextFocus),primary:Ai(2089,3165),weight:200}})}async runWithContext(a,i){if(i.notebookEditor.isReadOnly)return;let e=a.get(ma),t=i.cell,o=i.notebookEditor.getCellIndex(t),n=t.focusMode===0?[{lineNumber:1,column:1}]:t.getSelectionsStartPosition();if(n&&n.length>0){if(await t.resolveTextModel(),!t.hasModel())return;let r=Nco(t,n);if(r){let s=t.language,l=t.cellKind,c=t.mime,u=await t.resolveTextModel();await e.apply([new ja(t.uri,{range:u.getFullModelRange(),text:r[0]}),new Iv(i.notebookEditor.textModel.uri,{editType:1,index:o+1,count:0,cells:r.slice(1).map(p=>({cellKind:l,language:s,mime:c,source:p,outputs:[],metadata:{}}))})],{quotableLabel:"Split Notebook Cell"}),i.notebookEditor.cellAt(o+1)?.updateEditState(t.getEditState(),"splitCell")}}}});W(class extends gd{constructor(){super({id:zXo,title:L(11629,"Join With Previous Cell"),keybinding:{when:rr,primary:1832,weight:200},menu:{id:D.NotebookCellTitle,when:x.and(rr,Kl),group:"3_edit",order:10}})}async runWithContext(a,i){let e=a.get(ma);return Rwi(e,i,"above")}});W(class extends gd{constructor(){super({id:KXo,title:L(11630,"Join With Next Cell"),keybinding:{when:rr,primary:808,weight:200},menu:{id:D.NotebookCellTitle,when:x.and(rr,Kl),group:"3_edit",order:11}})}async runWithContext(a,i){let e=a.get(ma);return Rwi(e,i,"below")}});W(class extends gd{constructor(){super({id:UXo,title:L(11631,"Join Selected Cells"),menu:{id:D.NotebookCellTitle,when:x.and(rr,Kl),group:"3_edit",order:12}})}async runWithContext(a,i){let e=a.get(ma),t=a.get(Ne);return Aco(e,t,i)}});var GXo="notebook.cell.changeToCode",$Xo="notebook.cell.changeToMarkdown";W(class extends xg{constructor(){super({id:GXo,title:L(11617,"Change Cell to Code"),keybinding:{when:x.and(rr,x.not(Uu),PR.toNegated()),primary:55,weight:200},precondition:x.and(Ua,hS.isEqualTo("markup")),menu:{id:D.NotebookCellTitle,when:x.and(rr,Kl,bw,hS.isEqualTo("markup")),group:"3_edit"}})}async runWithContext(i,e){await SMe(2,e)}});W(class extends xg{constructor(){super({id:$Xo,title:L(11618,"Change Cell to Markdown"),keybinding:{when:x.and(rr,x.not(Uu),PR.toNegated()),primary:43,weight:200},precondition:x.and(Ua,hS.isEqualTo("code")),menu:{id:D.NotebookCellTitle,when:x.and(rr,Kl,bw,hS.isEqualTo("code")),group:"3_edit"}})}async runWithContext(i,e){await SMe(1,e,"markdown",Zn.markdown)}});var qXo="notebook.cell.collapseCellInput",jXo="notebook.cell.collapseCellOutput",QXo="notebook.cell.collapseAllCellInputs",YXo="notebook.cell.expandAllCellInputs",XXo="notebook.cell.collapseAllCellOutputs",JXo="notebook.cell.expandAllCellOutputs",ZXo="notebook.cell.toggleOutputs",eJo="notebook.cell.toggleOutputScrolling";W(class extends xg{constructor(){super({id:qXo,title:L(11621,"Collapse Cell Input"),keybinding:{when:x.and($u,JLe.toNegated(),$h.toNegated()),primary:Ai(2089,2081),weight:200}})}parseArgs(i,...e){return BK(i,...e)}async runWithContext(i,e){e.ui?e.cell.isInputCollapsed=!0:e.selectedCells.forEach(t=>t.isInputCollapsed=!0)}});W(class extends xg{constructor(){super({id:Kxe,title:L(11627,"Expand Cell Input"),keybinding:{when:x.and($u,JLe),primary:Ai(2089,2081),weight:200}})}parseArgs(i,...e){return BK(i,...e)}async runWithContext(i,e){e.ui?e.cell.isInputCollapsed=!1:e.selectedCells.forEach(t=>t.isInputCollapsed=!1)}});W(class extends xg{constructor(){super({id:jXo,title:L(11622,"Collapse Cell Output"),keybinding:{when:x.and($u,HJe.toNegated(),$h.toNegated(),gk),primary:Ai(2089,50),weight:200}})}async runWithContext(i,e){e.ui?e.cell.isOutputCollapsed=!0:e.selectedCells.forEach(t=>t.isOutputCollapsed=!0)}});W(class extends xg{constructor(){super({id:NEt,title:L(11628,"Expand Cell Output"),keybinding:{when:x.and($u,HJe),primary:Ai(2089,50),weight:200}})}async runWithContext(i,e){e.ui?e.cell.isOutputCollapsed=!1:e.selectedCells.forEach(t=>t.isOutputCollapsed=!1)}});W(class extends xg{constructor(){super({id:ZXo,precondition:$u,title:L(11635,"Toggle Outputs"),metadata:{description:d(11636,null),args:UJe}})}parseArgs(a,...i){return BK(a,...i)}async runWithContext(a,i){let e=[];i.ui?e=[i.cell]:i.selectedCells&&(e=i.selectedCells);for(let t of e)t.isOutputCollapsed=!t.isOutputCollapsed}});W(class extends xg{constructor(){super({id:QXo,title:L(11619,"Collapse All Cell Inputs"),f1:!0})}async runWithContext(i,e){o1t(e.notebookEditor,t=>t.isInputCollapsed=!0)}});W(class extends xg{constructor(){super({id:YXo,title:L(11625,"Expand All Cell Inputs"),f1:!0})}async runWithContext(i,e){o1t(e.notebookEditor,t=>t.isInputCollapsed=!1)}});W(class extends xg{constructor(){super({id:XXo,title:L(11620,"Collapse All Cell Outputs"),f1:!0})}async runWithContext(i,e){o1t(e.notebookEditor,t=>t.isOutputCollapsed=!0)}});W(class extends xg{constructor(){super({id:JXo,title:L(11626,"Expand All Cell Outputs"),f1:!0})}async runWithContext(i,e){o1t(e.notebookEditor,t=>t.isOutputCollapsed=!1)}});W(class extends xg{constructor(){super({id:eJo,title:L(11637,"Toggle Scroll Cell Output"),keybinding:{when:x.and($u,$h.toNegated(),gk),primary:Ai(2089,55),weight:200}})}toggleOutputScrolling(i,e,t){let o=i.model.metadata;if(o){let n=o.scrollable!==void 0?o.scrollable:e,r=t||!n;o.scrollable=r,i.resetRenderer()}}async runWithContext(i,e){let t=i.get(B).getValue(ft.outputScrolling);e.ui?(e.cell.outputsViewModels.forEach(o=>{this.toggleOutputScrolling(o,t,e.cell.isOutputCollapsed)}),e.cell.isOutputCollapsed=!1):e.selectedCells.forEach(o=>{o.outputsViewModels.forEach(n=>{this.toggleOutputScrolling(n,t,o.isOutputCollapsed)}),o.isOutputCollapsed=!1})}});function o1t(a,i){for(let e=0;e<a.getLength();e++){let t=a.cellAt(e);i(t,e)}}var RNe=class extends C{constructor(e,t,o){super();this._notebookEditor=e;this._notebookService=t;this._warmupDocument=null;this._warmupViewport=new Dt(()=>this._warmupViewportNow(),200),this._register(this._warmupViewport),this._register(this._notebookEditor.onDidScroll(()=>{this._warmupViewport.schedule()})),this._warmupDocument=new Dt(()=>this._warmupDocumentNow(),200),this._register(this._warmupDocument),this._register(this._notebookEditor.onDidAttachViewModel(()=>{this._notebookEditor.hasModel()&&this._warmupDocument?.schedule()})),this._notebookEditor.hasModel()&&this._warmupDocument?.schedule()}static{this.id="workbench.notebook.viewportWarmup"}_warmupDocumentNow(){if(this._notebookEditor.hasModel())for(let e=0;e<this._notebookEditor.getLength();e++){let t=this._notebookEditor.cellAt(e);t?.cellKind===1&&t?.getEditState()===0&&!t.isInputCollapsed||t?.cellKind===2&&this._warmupCodeCell(t)}}_warmupViewportNow(){if(this._notebookEditor.isDisposed||!this._notebookEditor.hasModel())return;let e=this._notebookEditor.getVisibleRangesPlusViewportAboveAndBelow();Lf(e).forEach(t=>{let o=this._notebookEditor.cellAt(t);o?.cellKind===1&&o?.getEditState()===0&&!o.isInputCollapsed?this._notebookEditor.createMarkupPreview(o):o?.cellKind===2&&this._warmupCodeCell(o)})}_warmupCodeCell(e){if(e.isOutputCollapsed)return;let t=e.outputsViewModels;for(let o of t.slice(0,vRe)){let[n,r]=o.resolveMimeTypes(this._notebookEditor.textModel,void 0);if(!n.find(u=>u.isTrusted)||n.length===0)continue;let s=n[r];if(!s||!this._notebookEditor.hasModel())return;let l=this._notebookService.getRendererInfo(s.rendererId);if(!l)return;let c={type:1,renderer:l,source:o,mimeType:s.mimeType};this._notebookEditor.createOutput(e,c,0,!0)}}};RNe=I([m(1,un),m(2,Bi)],RNe);tm(RNe.id,RNe);var Wit=class extends C{constructor(e){super();this._notebookEditor=e;this._localStore=this._register(new P);this._cellDisposables=[];this._enabled=!1;this._cellStatusItems=[];this._register(this._notebookEditor.onDidChangeModel(()=>{this._update()})),this._update()}static{this.id="workbench.notebook.troubleshoot"}toggle(){this._enabled=!this._enabled,this._update()}_update(){this._localStore.clear(),this._cellDisposables.forEach(e=>e.dispose()),this._cellDisposables=[],this._removeNotebookOverlay(),this._notebookEditor.hasModel()&&this._enabled&&(this._updateListener(),this._createNotebookOverlay(),this._createCellOverlays())}_log(e,t){if(this._enabled){let o=this._notebookEditor.getViewHeight(e);console.log(`cell#${e.handle}`,t,`${o} -> ${e.layoutInfo.totalHeight}`)}}_createCellOverlays(){if(this._notebookEditor.hasModel()){for(let e=0;e<this._notebookEditor.getLength();e++){let t=this._notebookEditor.cellAt(e);this._createCellOverlay(t,e)}this._localStore.add(this._notebookEditor.onDidChangeViewCells(e=>{let t=e.splices.reduce((o,[,,n])=>[...o,...n],[]);for(let o=0;o<t.length;o++){let n=this._notebookEditor.getCellIndex(t[o]);n!==void 0&&this._createCellOverlay(t[o],n)}}))}}_createNotebookOverlay(){if(!this._notebookEditor.hasModel())return;let e=this._notebookEditor.getLayoutInfo().listViewOffsetTop,t=this._notebookEditor.scrollTop,o=Mo.div({style:{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",pointerEvents:"none",zIndex:"1000"}},[Mo.div({style:{position:"absolute",top:`${e}px`,left:"0",width:"100%",height:"2px",backgroundColor:"rgba(0, 0, 255, 0.7)"}}),Mo.div({style:{position:"absolute",top:`${e}px`,left:"10px",backgroundColor:"rgba(0, 0, 255, 0.7)",color:"white",fontSize:"11px",fontWeight:"bold",padding:"2px 6px",borderRadius:"3px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:"1001"}},[`ScrollTop: ${t}px`])]).keepUpdated(this._store);this._notebookOverlayDomNode=o.element,this._notebookOverlayDomNode&&this._notebookEditor.getDomNode().appendChild(this._notebookOverlayDomNode),this._localStore.add(this._notebookEditor.onDidScroll(()=>{let n=this._notebookEditor.scrollTop,r=this._notebookEditor.getLayoutInfo().listViewOffsetTop;if(this._notebookOverlayDomNode){let s=this._notebookOverlayDomNode.querySelector("div:nth-child(2)");s&&(s.textContent=`ScrollTop: ${n}px`,s.style.top=`${r}px`);let l=this._notebookOverlayDomNode.querySelector("div:first-child");l&&(l.style.top=`${r}px`)}}))}_createCellOverlay(e,t){let o=document.createElement("div");o.style.position="absolute",o.style.top="0",o.style.left="0",o.style.width="100%",o.style.height="100%",o.style.pointerEvents="none",o.style.zIndex="1000";let n=document.createElement("div");n.style.position="absolute",n.style.top="0",n.style.left="0",n.style.width="100%",n.style.height="2px",n.style.backgroundColor="rgba(255, 0, 0, 0.7)",o.appendChild(n);let r=()=>{let c=e.textBuffer.getEOL()===`
`?"LF":"CRLF",u="";return e.layoutInfo.layoutState>0&&(u=`| AbsoluteTopOfElement: ${this._notebookEditor.getAbsoluteTopOfElement(e)}px`),`cell #${t} (handle: ${e.handle}) ${u} | EOL: ${c}`},s=document.createElement("div");s.textContent=r(),s.style.position="absolute",s.style.top="0px",s.style.right="10px",s.style.backgroundColor="rgba(255, 0, 0, 0.5)",s.style.color="white",s.style.fontSize="11px",s.style.fontWeight="bold",s.style.padding="2px 6px",s.style.borderRadius="3px",s.style.whiteSpace="nowrap",s.style.pointerEvents="none",s.style.zIndex="1001",o.appendChild(s);let l;if(this._notebookEditor.changeCellOverlays(c=>{l=c.addOverlay({cell:e,domNode:o})}),l){let c=()=>{s.textContent=r(),l&&this._notebookEditor.changeCellOverlays(p=>{p.layoutOverlay(l)})},u=this._cellDisposables[t];u.add(e.onDidChangeLayout(p=>{c()})),u.add(e.textBuffer.onDidChangeContent(()=>{c()})),e.textModel&&u.add(e.textModel.onDidChangeContent(()=>{c()})),u.add(this._notebookEditor.onDidChangeLayout(()=>{c()})),u.add(Z(()=>{this._notebookEditor.changeCellOverlays(p=>{l&&p.removeOverlay(l)})}))}}_removeNotebookOverlay(){this._notebookOverlayDomNode&&(this._notebookOverlayDomNode.remove(),this._notebookOverlayDomNode=void 0)}_updateListener(){if(!this._notebookEditor.hasModel())return;for(let o=0;o<this._notebookEditor.getLength();o++){let n=this._notebookEditor.cellAt(o),r=new P;this._cellDisposables.push(r),r.add(n.onDidChangeLayout(s=>{this._log(n,s)}))}this._localStore.add(this._notebookEditor.onDidChangeViewCells(o=>{[...o.splices].reverse().forEach(r=>{let[s,l,c]=r,u=this._cellDisposables.splice(s,l,...c.map(p=>{let h=new P;return h.add(p.onDidChangeLayout(g=>{this._log(p,g)})),h}));Ue(u)});let n=o.splices.reduce((r,[,,s])=>[...r,...s],[]);for(let r=0;r<n.length;r++){let s=this._notebookEditor.getCellIndex(n[r]);s!==void 0&&this._createCellOverlay(n[r],s)}}));let e=this._notebookEditor.getViewModel(),t=[];this._enabled&&(t=this._getItemsForCells()),this._cellStatusItems=e.deltaCellStatusBarItems(this._cellStatusItems,t)}_getItemsForCells(){let e=[];for(let t=0;t<this._notebookEditor.getLength();t++)e.push({handle:t,items:[{text:`index: ${t}`,alignment:1,priority:Number.MAX_SAFE_INTEGER}]});return e}dispose(){Ue(this._cellDisposables),this._removeNotebookOverlay(),this._localStore.clear(),super.dispose()}};tm(Wit.id,Wit);W(class extends K{constructor(){super({id:"notebook.toggleLayoutTroubleshoot",title:L(11747,"Toggle Notebook Layout Troubleshoot"),category:We.Developer,f1:!0})}async run(a){let i=a.get(ee),e=qn(i.activeEditorPane);if(!e)return;e.getContribution(Wit.id)?.toggle()}});W(class extends K{constructor(){super({id:"notebook.inspectLayout",title:L(11746,"Inspect Notebook Layout"),category:We.Developer,f1:!0})}async run(a){let i=a.get(ee),e=qn(i.activeEditorPane);if(!(!e||!e.hasModel()))for(let t=0;t<e.getLength();t++){let o=e.cellAt(t);console.log(`cell#${o.handle}`,o.layoutInfo)}}});W(class extends K{constructor(){super({id:"notebook.clearNotebookEdtitorTypeCache",title:L(11745,"Clear Notebook Editor Type Cache"),category:We.Developer,f1:!0})}async run(a){a.get(un).clearEditorCache()}});var Vit=class extends C{constructor(e,t,o){super();this._debugService=e;this._editorService=o;let n=new vt;this._register(t.onWillAddNotebookDocument(r=>{n.set(r.uri,r.onWillAddRemoveCells(s=>{let l=this._debugService.getModel();if(l.getBreakpoints().length&&s.rawEvent.kind===1)for(let c of s.rawEvent.changes){let[u,p]=c;if(p>0){let h=r.cells.slice(u,u+p);for(let g of h)l.getBreakpoints({uri:g.uri}).forEach(v=>this._debugService.removeBreakpoints(v.getId()))}}}))})),this._register(t.onWillRemoveNotebookDocument(r=>{this.updateBreakpoints(r),n.get(r.uri)?.dispose(),n.delete(r.uri)})),this._register(this._debugService.getModel().onDidChangeBreakpoints(r=>{let s=r?.added?.find(l=>Wo(l,{uri:!0})&&l.uri.scheme===Y.vscodeNotebookCell);if(s){let l=Zo.parse(s.uri);if(!l)return;let c=qn(this._editorService.activeEditorPane);if(!c||!c.hasModel()||c.textModel.uri.toString()!==l.notebook.toString())return;let u=c.getCellByHandle(l.handle);if(!u)return;c.focusElement(u)}}))}updateBreakpoints(e){let t=this._debugService.getModel().getBreakpoints();if(!t.length||!e.cells.length)return;let o=new vt;e.cells.forEach((n,r)=>{o.set(n.uri,r)}),t.forEach(n=>{let r=o.get(n.uri);if(typeof r!="number")return;let s=Zo.parse(n.uri)?.notebook;if(!s)return;let l=Zo.generate(s,r);Xe(l,n.uri)||(this._debugService.removeBreakpoints(n.getId()),this._debugService.addBreakpoints(l,[{column:n.column,condition:n.condition,enabled:n.enabled,hitCondition:n.hitCondition,logMessage:n.logMessage,lineNumber:n.lineNumber}]))})}};Vit=I([m(0,Li),m(1,un),m(2,ee)],Vit);oe.as(Qi.Workbench).registerWorkbenchContribution(Vit,3);var Bit=class extends C{constructor(e,t){super();this._debugService=e;this._notebookExecutionStateService=t;this._pausedCells=new Set;this._register(e.getModel().onDidChangeCallStack(()=>{this.onDidChangeCallStack(!0),this._scheduler.schedule()})),this._scheduler=this._register(new Dt(()=>this.onDidChangeCallStack(!1),2e3))}async onDidChangeCallStack(e){let t=new Set;for(let o of this._debugService.getModel().getSessions())for(let n of o.getAllThreads()){let r=n.getCallStack();e&&!r.length&&(r=n.getStaleCallStack()),r.forEach(s=>{Zo.parse(s.source.uri)&&(t.add(s.source.uri.toString()),this.editIsPaused(s.source.uri,!0))})}for(let o of this._pausedCells)t.has(o)||(this.editIsPaused(A.parse(o),!1),this._pausedCells.delete(o));t.forEach(o=>this._pausedCells.add(o))}editIsPaused(e,t){if(Zo.parse(e)){let n=this._notebookExecutionStateService.getCellExecution(e);n&&(n.isPaused!==t||!n.didPause)&&n.update([{editType:3,didPause:!0,isPaused:t}])}}};Bit=I([m(0,Li),m(1,rs)],Bit);oe.as(Qi.Workbench).registerWorkbenchContribution(Bit,3);var sTi=class{constructor(){this._registeredGutterActionsGenerators=new Set}registerGutterActionsGenerator(i){return this._registeredGutterActionsGenerators.add(i),{dispose:()=>{this._registeredGutterActionsGenerators.delete(i)}}}getGutterActionsGenerators(){return Array.from(this._registeredGutterActionsGenerators.values())}};oe.add("gutterActionsRegistry",new sTi);var Hit=oe.as("gutterActionsRegistry"),Nte=class extends C{constructor(e,t,o,n,r){super();this.editor=e;this.contextMenuService=t;this.menuService=o;this.contextKeyService=n;this.instantiationService=r;this._register(this.editor.onMouseDown(s=>this.doShow(s,!1)))}static{this.ID="workbench.contrib.editorLineNumberContextMenu"}show(e){this.doShow(e,!0)}doShow(e,t){let o=this.editor.getModel();if(!e.event.rightButton&&!(it&&e.event.leftButton&&e.event.ctrlKey)&&!t||e.target.type!==3&&e.target.type!==2||!e.target.position||!o)return;let n=e.target.position.lineNumber,r=this.contextKeyService.createOverlay([["editorLineNumber",n]]),s=this.menuService.createMenu(D.EditorLineNumberContext,r),l=[];this.instantiationService.invokeFunction(c=>{for(let p of Hit.getGutterActionsGenerators()){let h=new Map;p({lineNumber:n,editor:this.editor,accessor:c},{push:(g,f="navigation")=>{let v=h.get(f)??[];v.push(g),h.set(f,v)}});for(let[g,f]of h.entries())l.push([g,f])}l.sort((p,h)=>p[0].localeCompare(h[0]));let u=s.getActions({arg:{lineNumber:n,uri:o.uri},shouldForwardArgs:!0});if(l.push(...u),e.target.type===3){let p=this.editor.getSelections(),h={startLineNumber:n,endLineNumber:n,startColumn:1,endColumn:o.getLineLength(n)+1};p?.some(f=>!f.isEmpty()&&f.intersectRanges(h)!==null)||this.editor.setSelection(h,"api")}this.contextMenuService.showContextMenu({getAnchor:()=>e.event,getActions:()=>li.join(...l.map(p=>p[1])),onHide:()=>s.dispose()})})}};Nte=I([m(1,ze),m(2,qt),m(3,X),m(4,F)],Nte);go(Nte.ID,Nte,1);var MNe=_,aTi=ae("privateBreakpointWidgetService"),mgo="breakpointwidgetdecoration";function tJo(a){return a.getModel().bracketPairs.getBracketPairsInRange(z.fromPositions(a.getPosition())).some(t=>t.openingBracketInfo.bracketText==="{")}function iJo(a,i){let e=a.getColor(od)?.transparent(.4);return[{range:{startLineNumber:0,endLineNumber:0,startColumn:0,endColumn:1},renderOptions:{after:{contentText:i,color:e?e.toString():void 0}}}]}var PNe=class extends aO{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super(e,{showFrame:!0,showArrow:!1,frameWidth:1,isAccessible:!0});this.lineNumber=t;this.column=o;this.contextViewService=r;this.debugService=s;this.themeService=l;this.instantiationService=c;this.modelService=u;this.codeEditorService=p;this._configurationService=h;this.languageFeaturesService=g;this.keybindingService=f;this.labelService=v;this.textModelService=b;this.hoverService=S;this.conditionInput="";this.hitCountInput="";this.logMessageInput="";this.availableBreakpoints=[];this.store=new P;let y=this.editor.getModel();if(y){let w=y.uri,k=this.debugService.getModel().getBreakpoints({lineNumber:this.lineNumber,column:this.column,uri:w});this.breakpoint=k.length?k[0]:void 0}n===void 0?this.breakpoint&&!this.breakpoint.condition&&!this.breakpoint.hitCondition&&this.breakpoint.logMessage?this.context=2:this.breakpoint&&!this.breakpoint.condition&&this.breakpoint.hitCondition?this.context=1:this.breakpoint&&this.breakpoint.triggeredBy?this.context=3:this.context=0:this.context=n,this.store.add(this.debugService.getModel().onDidChangeBreakpoints(w=>{this.breakpoint&&w&&w.removed&&w.removed.indexOf(this.breakpoint)>=0&&this.dispose(),this.context===3&&this.selectBreakpointBox&&this.updateTriggerBreakpointList()})),this.store.add(this.codeEditorService.registerDecorationType("breakpoint-widget",mgo,{})),this.create()}get placeholder(){let e=this.keybindingService.lookupKeybinding(n1t.ID)?.getLabel()||"Enter",t=this.keybindingService.lookupKeybinding(r1t.ID)?.getLabel()||"Escape";switch(this.context){case 2:return d(8699,null,e,t);case 1:return d(8698,null,e,t);default:return d(8697,null,e,t)}}getInputValue(e){switch(this.context){case 2:return e&&e.logMessage?e.logMessage:this.logMessageInput;case 1:return e&&e.hitCondition?e.hitCondition:this.hitCountInput;default:return e&&e.condition?e.condition:this.conditionInput}}rememberInput(){if(this.context!==3){let e=this.input.getModel().getValue();switch(this.context){case 2:this.logMessageInput=e;break;case 1:this.hitCountInput=e;break;default:this.conditionInput=e}}}setInputMode(){if(this.editor.hasModel()){let e=this.context===2?Fr:this.editor.getModel().getLanguageId();this.input.getModel().setLanguage(e)}}show(e){let t=this.input.getModel().getLineCount();super.show(e,t+1)}fitHeightToContent(){let e=this.input.getModel().getLineCount();this._relayout(e+1)}_fillContainer(e){this.setCssClass("breakpoint-widget");let t=this.store.add(new aE([{text:d(8700,null)},{text:d(8701,null)},{text:d(8702,null)},{text:d(8708,null)}],this.context,this.contextViewService,pE,{ariaLabel:d(8696,null),useCustomDrawn:!HS(this._configurationService)}));this.selectContainer=MNe(".breakpoint-select-container"),t.render(R(e,this.selectContainer)),this.store.add(t.onDidSelect(o=>{this.rememberInput(),this.context=o.index,this.updateContextInput()})),this.createModesInput(e),this.inputContainer=MNe(".inputContainer"),this.store.add(this.hoverService.setupManagedHover(Ni("mouse"),this.inputContainer,this.placeholder)),this.createBreakpointInput(R(e,this.inputContainer)),this.input.getModel().setValue(this.getInputValue(this.breakpoint)),this.store.add(this.input.getModel().onDidChangeContent(()=>{this.fitHeightToContent()})),this.input.setPosition({lineNumber:1,column:this.input.getModel().getLineMaxColumn(1)}),this.createTriggerBreakpointInput(e),this.updateContextInput(),setTimeout(()=>this.focusInput(),150)}createModesInput(e){let t=this.debugService.getModel().getBreakpointModes("source");if(t.length<=1)return;let o=this.selectModeBox=new aE([{text:d(8695,null),isDisabled:!0},...t.map(s=>({text:s.label,description:s.description}))],t.findIndex(s=>s.mode===this.breakpoint?.mode)+1,this.contextViewService,pE,{useCustomDrawn:!HS(this._configurationService)});this.store.add(o),this.store.add(o.onDidSelect(s=>{this.modeInput=t[s.index-1]}));let n=MNe(".select-mode-container"),r=MNe(".select-box-container");R(n,r),o.render(r),R(e,n)}createTriggerBreakpointInput(e){this.availableBreakpoints=this.debugService.getModel().getBreakpoints().filter(l=>l!==this.breakpoint&&!l.logMessage);let t=this.buildBreakpointOptions(),o=this.availableBreakpoints.findIndex(l=>this.breakpoint?.triggeredBy===l.getId()),n=this.selectBreakpointBox=this.store.add(new aE(t,o+1,this.contextViewService,pE,{ariaLabel:d(8706,null),useCustomDrawn:!HS(this._configurationService)}));this.store.add(n.onDidSelect(l=>{l.index===0?this.triggeredByBreakpointInput=void 0:this.triggeredByBreakpointInput=this.availableBreakpoints[l.index-1]})),this.selectBreakpointContainer=MNe(".select-breakpoint-container"),this.store.add(j(this.selectBreakpointContainer,re.KEY_DOWN,l=>{new Ii(l).equals(9)&&this.close(!1)}));let r=MNe(".select-box-container");R(this.selectBreakpointContainer,r),n.render(r),R(e,this.selectBreakpointContainer);let s=new Mi(this.selectBreakpointContainer,Ko);s.label=d(8705,null),this.store.add(s.onDidClick(()=>this.close(!0))),this.store.add(s)}buildBreakpointOptions(){let e=[{text:d(8704,null),isDisabled:!0},...this.availableBreakpoints.map(t=>({text:`${this.labelService.getUriLabel(t.uri,{relative:!0})}: ${t.lineNumber}`,description:d(8707,null)}))];for(let[t,o]of this.availableBreakpoints.entries())this.textModelService.createModelReference(o.uri).then(n=>{try{e[t+1].description=n.object.textEditorModel.getLineContent(o.lineNumber).trim()}finally{n.dispose()}}).catch(()=>{e[t+1].description=d(8703,null)});return e}updateTriggerBreakpointList(){this.availableBreakpoints=this.debugService.getModel().getBreakpoints().filter(o=>o!==this.breakpoint&&!o.logMessage);let e=0;if(this.triggeredByBreakpointInput){let o=this.availableBreakpoints.findIndex(n=>n.getId()===this.triggeredByBreakpointInput?.getId());o!==-1?e=o+1:this.triggeredByBreakpointInput=void 0}let t=this.buildBreakpointOptions();this.selectBreakpointBox.setOptions(t,e)}updateContextInput(){if(this.context===3)this.inputContainer.hidden=!0,this.selectBreakpointContainer.hidden=!1,this.selectBreakpointBox&&this.updateTriggerBreakpointList();else{this.inputContainer.hidden=!1,this.selectBreakpointContainer.hidden=!0,this.setInputMode();let e=this.getInputValue(this.breakpoint);this.input.getModel().setValue(e),this.focusInput()}}_doLayout(e,t){this.heightInPx=e,this.input.layout({height:e,width:t-113}),this.centerInputVertically()}_onWidth(e){typeof this.heightInPx=="number"&&this._doLayout(this.heightInPx,e)}createBreakpointInput(e){let t=this.instantiationService.createChild(new Io([aTi,this]));this.store.add(t);let o=this.createEditorOptions(),n=xLe();this.input=t.createInstance(jr,e,o,n),zdi.bindTo(this.input.contextKeyService).set(!0);let r=this.modelService.createModel("",null,A.parse(`${vC}:${this.editor.getId()}:breakpointinput`),!0);this.editor.hasModel()&&r.setLanguage(this.editor.getModel().getLanguageId()),this.input.setModel(r),this.setInputMode(),this.store.add(r);let s=()=>{let c=this.input.getModel().getValue()?[]:iJo(this.themeService.getColorTheme(),this.placeholder);this.input.setDecorationsByType("breakpoint-widget",mgo,c)};this.store.add(this.input.getModel().onDidChangeContent(()=>s())),this.store.add(this.themeService.onDidColorThemeChange(()=>s())),this.store.add(this.languageFeaturesService.completionProvider.register({scheme:vC,hasAccessToAllModels:!0},{_debugDisplayName:"breakpointWidget",provideCompletionItems:(l,c,u,p)=>{let h,g=this.editor.getModel();return g&&(this.context===0||this.context===2&&tJo(this.input))?h=Sle(this.languageFeaturesService.completionProvider,g,new Ie(this.lineNumber,1),new Jq(void 0,new Set().add(28)),u,p).then(f=>{let v=0;if(this.context===0)v=c.column-1;else{let b=this.input.getModel().getValue();for(;c.column-2-v>=0&&b[c.column-2-v]!=="{"&&b[c.column-2-v]!==" ";)v++}return{suggestions:f.items.map(b=>(b.completion.range=z.fromPositions(c.delta(0,-v),c),b.completion))}}):h=Promise.resolve({suggestions:[]}),h}})),this.store.add(this._configurationService.onDidChangeConfiguration(l=>{(l.affectsConfiguration("editor.fontSize")||l.affectsConfiguration("editor.lineHeight"))&&(this.input.updateOptions(this.createEditorOptions()),this.centerInputVertically())}))}createEditorOptions(){let e=this._configurationService.getValue("editor"),t=Kf(this._configurationService);return t.fontSize=e.fontSize,t.fontFamily=e.fontFamily,t.lineHeight=e.lineHeight,t.fontLigatures=e.fontLigatures,t.ariaLabel=this.placeholder,t}centerInputVertically(){if(this.container&&typeof this.heightInPx=="number"){let e=this.input.getOption(75),t=this.input.getModel().getLineCount(),o=(this.heightInPx-t*e)/2;this.inputContainer.style.marginTop=o+"px"}}close(e){if(e){let t,o,n,r,s,l;if(this.rememberInput(),(this.conditionInput||this.context===0)&&(t=this.conditionInput),(this.hitCountInput||this.context===1)&&(o=this.hitCountInput),(this.logMessageInput||this.context===2)&&(n=this.logMessageInput),this.selectModeBox&&(s=this.modeInput?.mode,l=this.modeInput?.label),this.context===3&&(t=void 0,o=void 0,n=void 0,r=this.triggeredByBreakpointInput?.getId()),this.breakpoint){let c=new Map;c.set(this.breakpoint.getId(),{condition:t,hitCondition:o,logMessage:n,triggeredBy:r,mode:s,modeLabel:l}),this.debugService.updateBreakpoints(this.breakpoint.originalUri,c,!1).then(void 0,mt)}else{let c=this.editor.getModel();c&&this.debugService.addBreakpoints(c.uri,[{lineNumber:this.lineNumber,column:this.column,enabled:!0,condition:t,hitCondition:o,logMessage:n,triggeredBy:r,mode:s,modeLabel:l}])}}this.dispose()}focusInput(){this.context===3?this.selectBreakpointBox.focus():this.input.focus()}dispose(){super.dispose(),this.input.dispose(),Ue(this.store),setTimeout(()=>this.editor.focus(),0)}};PNe=I([m(4,_n),m(5,Li),m(6,De),m(7,F),m(8,Ct),m(9,Kt),m(10,B),m(11,zt),m(12,_e),m(13,ot),m(14,Nt),m(15,tt)],PNe);var n1t=class a extends xc{static{this.ID="breakpointWidget.action.acceptInput"}constructor(){super({id:a.ID,precondition:nQe,kbOpts:{kbExpr:zdi,primary:3,weight:100}})}runEditorCommand(i,e){i.get(aTi).close(!0)}},r1t=class a extends xc{static{this.ID="closeBreakpointWidget"}constructor(){super({id:a.ID,precondition:nQe,kbOpts:{kbExpr:ue.textInputFocus,primary:9,secondary:[1033],weight:100}})}runEditorCommand(i,e,t){let o=e.getContribution(fP);if(o)return o.closeBreakpointWidget();i.get(aTi).close(!1)}};qi(new n1t);qi(new r1t);var oJo=_,nJo={description:"breakpoint-helper-decoration",glyphMarginClassName:q.asClassName(eZe),glyphMargin:{position:3},glyphMarginHoverMessage:new xe().appendText(d(8594,null)),stickiness:1};function rJo(a,i,e,t,o,n){let r=[];return e.forEach(s=>{if(s.lineNumber>i.getLineCount())return;let l=e.some(p=>p!==s&&p.lineNumber===s.lineNumber),c=i.getLineFirstNonWhitespaceColumn(s.lineNumber),u=i.validateRange(s.column?new z(s.lineNumber,s.column,s.lineNumber,s.column+1):new z(s.lineNumber,c,s.lineNumber,c+1));r.push({options:sJo(a,i,s,t,o,n,l),range:u})}),r}function sJo(a,i,e,t,o,n,r){let s=a.get(Li),l=a.get(kt),c=a.get(ot),{icon:u,message:p,showAdapterUnverifiedMessage:h}=I2(t,o,e,c,s.getModel()),g,f;if(h){let S;f=s.getModel().getSessions().map(y=>{let w=s.getAdapterManager().getDebugger(y.configuration.type),k=w?.strings?.unverifiedBreakpoints;if(k)return S||(S=l.guessLanguageIdByFilepathOrFirstLine(e.uri)??void 0),S&&w.interestedInLanguage(S)?k:void 0}).find(y=>!!y)}if(p)if(g=new xe(void 0,{isTrusted:!0,supportThemeIcons:!0}),e.condition||e.hitCondition){let S=i.getLanguageId();g.appendCodeblock(S,p),f&&g.appendMarkdown("$(warning) "+f)}else g.appendText(p),f&&g.appendMarkdown(`
$(warning) `+f);else f&&(g=new xe(void 0,{isTrusted:!0,supportThemeIcons:!0}).appendMarkdown(f));let v=null;n&&(v={color:Ss(s1t),position:1});let b=e.column&&(r||e.column>i.getLineFirstNonWhitespaceColumn(e.lineNumber));return{description:"breakpoint-decoration",glyphMargin:{position:3},glyphMarginClassName:q.asClassName(u),glyphMarginHoverMessage:g,stickiness:1,before:b?{content:rN,inlineClassName:"debug-breakpoint-placeholder",inlineClassNameAffectsLetterSpacing:!0}:void 0,overviewRuler:v,zIndex:9999}}async function aJo(a,i,e){return e.capabilities.supportsBreakpointLocationsRequest?await Promise.all(Uo(i,t=>t).map(async t=>{try{return{lineNumber:t,positions:await e.breakpointsLocations(a.uri,t)}}catch{return{lineNumber:t,positions:[]}}})):[]}function lJo(a,i,e){let t=[];for(let{positions:o,lineNumber:n}of e){if(o.length===0)continue;let r=a.getLineFirstNonWhitespaceColumn(n),s=a.getLineLastNonWhitespaceColumn(n);o.forEach(l=>{let c=new z(l.lineNumber,l.column,l.lineNumber,l.column+1);if(l.column<=r&&!i.some(p=>p.range.startColumn>r&&p.range.startLineNumber===l.lineNumber)||l.column>s)return;let u=i.find(p=>p.range.equalsRange(c));u&&u.inlineWidget||t.push({range:c,options:{description:"breakpoint-placeholder-decoration",stickiness:1,before:u?void 0:{content:rN,inlineClassName:"debug-breakpoint-placeholder",inlineClassNameAffectsLetterSpacing:!0}},breakpoint:u?u.breakpoint:void 0})})}return t}var ANe=class{constructor(i,e,t,o,n,r,s,l){this.editor=i;this.debugService=e;this.contextMenuService=t;this.instantiationService=o;this.dialogService=r;this.configurationService=s;this.labelService=l;this.breakpointHintDecoration=null;this.toDispose=[];this.ignoreDecorationsChangedEvent=!1;this.ignoreBreakpointsChangeEvent=!1;this.breakpointDecorations=[];this.candidateDecorations=[];this.breakpointWidgetVisible=nQe.bindTo(n),this.setDecorationsScheduler=new Dt(()=>this.setDecorations(),30),this.setDecorationsScheduler.schedule(),this.registerListeners()}getContextMenuActionsAtPosition(i,e){if(!this.debugService.getAdapterManager().hasEnabledDebuggers())return[];if(!this.debugService.canSetBreakpointsIn(e))return[];let t=this.debugService.getModel().getBreakpoints({lineNumber:i,uri:e.uri});return this.getContextMenuActions(t,e.uri,i)}registerListeners(){this.toDispose.push(this.editor.onMouseDown(async i=>{if(!this.debugService.getAdapterManager().hasEnabledDebuggers())return;let e=this.editor.getModel();if(!i.target.position||!e||i.target.type!==2||i.target.detail.isAfterLines||!this.marginFreeFromNonDebugDecorations(i.target.position.lineNumber)&&!i.target.element?.className.includes("breakpoint"))return;let t=this.debugService.canSetBreakpointsIn(e),o=i.target.position.lineNumber,n=e.uri;if(!(i.event.rightButton||it&&i.event.leftButton&&i.event.ctrlKey)){let r=this.debugService.getModel().getBreakpoints({uri:n,lineNumber:o});if(r.length){let s=i.event.shiftKey,l=r.some(c=>c.enabled);if(s)r.forEach(c=>this.debugService.enableOrDisableBreakpoints(!l,c));else if(!Wn&&r.some(c=>!!c.condition||!!c.logMessage||!!c.hitCondition||!!c.triggeredBy)){let c=r.every(g=>!!g.logMessage),u=c?d(8615,null):d(8591,null),p=d(8592,null,u.toLowerCase(),c?d(8616,null):d(8595,null)),h=d(8593,null,u.toLowerCase(),c?d(8616,null):d(8595,null));await this.dialogService.prompt({type:gt.Info,message:l?h:p,buttons:[{label:d(8621,null,u),run:()=>r.forEach(g=>this.debugService.removeBreakpoints(g.getId()))},{label:d(8605,null,l?d(8601,null):d(8610,null),u),run:()=>r.forEach(g=>this.debugService.enableOrDisableBreakpoints(!l,g))}],cancelButton:!0})}else l?r.forEach(c=>this.debugService.removeBreakpoints(c.getId())):r.forEach(c=>this.debugService.enableOrDisableBreakpoints(!l,c))}else if(t)if(i.event.middleButton){let s=this.configurationService.getValue("debug").gutterMiddleClickAction;if(s!=="none"){let l;switch(s){case"logpoint":l=2;break;case"conditionalBreakpoint":l=0;break;case"triggeredBreakpoint":l=3}this.showBreakpointWidget(o,void 0,l)}}else this.debugService.addBreakpoints(n,[{lineNumber:o}])}})),og.pointerEvents&&Vb||(this.toDispose.push(this.editor.onMouseMove(i=>{if(!this.debugService.getAdapterManager().hasEnabledDebuggers())return;let e=-1,t=this.editor.getModel();t&&i.target.position&&(i.target.type===2||i.target.type===3)&&this.debugService.canSetBreakpointsIn(t)&&this.marginFreeFromNonDebugDecorations(i.target.position.lineNumber)&&(i.target.detail.isAfterLines||(e=i.target.position.lineNumber)),this.ensureBreakpointHintDecoration(e)})),this.toDispose.push(this.editor.onMouseLeave(()=>{this.ensureBreakpointHintDecoration(-1)}))),this.toDispose.push(this.editor.onDidChangeModel(async()=>{this.closeBreakpointWidget(),await this.setDecorations()})),this.toDispose.push(this.debugService.getModel().onDidChangeBreakpoints(()=>{!this.ignoreBreakpointsChangeEvent&&!this.setDecorationsScheduler.isScheduled()&&this.setDecorationsScheduler.schedule()})),this.toDispose.push(this.debugService.onDidChangeState(()=>{this.setDecorationsScheduler.isScheduled()||this.setDecorationsScheduler.schedule()})),this.toDispose.push(this.editor.onDidChangeModelDecorations(()=>this.onModelDecorationsChanged())),this.toDispose.push(this.configurationService.onDidChangeConfiguration(async i=>{(i.affectsConfiguration("debug.showBreakpointsInOverviewRuler")||i.affectsConfiguration("debug.showInlineBreakpointCandidates"))&&await this.setDecorations()}))}getContextMenuActions(i,e,t,o){let n=[];if(i.length===1){let r=i[0].logMessage?d(8615,null):d(8591,null);n.push(pi({id:"debug.removeBreakpoint",label:d(8617,null,r),enabled:!0,run:async()=>{await this.debugService.removeBreakpoints(i[0].getId())}})),n.push(pi({id:"workbench.debug.action.editBreakpointAction",label:d(8606,null,r),enabled:!0,run:()=>Promise.resolve(this.showBreakpointWidget(i[0].lineNumber,i[0].column))})),n.push(pi({id:"workbench.debug.viewlet.action.toggleBreakpoint",label:i[0].enabled?d(8602,null,r):d(8611,null,r),enabled:!0,run:()=>this.debugService.enableOrDisableBreakpoints(!i[0].enabled,i[0])}))}else if(i.length>1){let r=i.slice().sort((s,l)=>s.column&&l.column?s.column-l.column:1);n.push(new $l("debug.removeBreakpoints",d(8618,null),r.map(s=>pi({id:"removeInlineBreakpoint",label:s.column?d(8619,null,s.column):d(8620,null),enabled:!0,run:()=>this.debugService.removeBreakpoints(s.getId())})))),n.push(new $l("debug.editBreakpoints",d(8607,null),r.map(s=>pi({id:"editBreakpoint",label:s.column?d(8608,null,s.column):d(8609,null),enabled:!0,run:()=>Promise.resolve(this.showBreakpointWidget(s.lineNumber,s.column))})))),n.push(new $l("debug.enableDisableBreakpoints",d(8614,null),r.map(s=>pi({id:s.enabled?"disableColumnBreakpoint":"enableColumnBreakpoint",label:s.enabled?s.column?d(8604,null,s.column):d(8603,null):s.column?d(8613,null,s.column):d(8612,null),enabled:!0,run:()=>this.debugService.enableOrDisableBreakpoints(!s.enabled,s)}))))}else n.push(pi({id:"addBreakpoint",label:d(8587,null),enabled:!0,run:()=>this.debugService.addBreakpoints(e,[{lineNumber:t,column:o}])})),n.push(pi({id:"addConditionalBreakpoint",label:d(8588,null),enabled:!0,run:()=>Promise.resolve(this.showBreakpointWidget(t,o,0))})),n.push(pi({id:"addLogPoint",label:d(8589,null),enabled:!0,run:()=>Promise.resolve(this.showBreakpointWidget(t,o,2))})),n.push(pi({id:"addTriggeredBreakpoint",label:d(8590,null),enabled:!0,run:()=>Promise.resolve(this.showBreakpointWidget(t,o,3))}));return this.debugService.state===2&&(n.push(new li),n.push(pi({id:"runToLine",label:d(8622,null),enabled:!0,run:()=>this.debugService.runTo(e,t).catch(mt)}))),n}marginFreeFromNonDebugDecorations(i){let e=this.editor.getLineDecorations(i);if(e)for(let{options:t}of e){let o=t.glyphMarginClassName;if(!o)continue;if(!(o.includes("codicon-")||o.startsWith("coverage-deco-"))||o.includes("codicon-testing-")||o.includes("codicon-merge-")||o.includes("codicon-arrow-")||o.includes("codicon-loading")||o.includes("codicon-fold")||o.includes("codicon-gutter-lightbulb")||o.includes("codicon-lightbulb-sparkle"))return!1}return!0}ensureBreakpointHintDecoration(i){this.editor.changeDecorations(e=>{this.breakpointHintDecoration&&(e.removeDecoration(this.breakpointHintDecoration),this.breakpointHintDecoration=null),i!==-1&&(this.breakpointHintDecoration=e.addDecoration({startLineNumber:i,startColumn:1,endLineNumber:i,endColumn:1},nJo))})}async setDecorations(){if(!this.editor.hasModel())return;let i=(u,p)=>{let h=lJo(t,this.breakpointDecorations,p),g=u.deltaDecorations(this.candidateDecorations.map(f=>f.decorationId),h);this.candidateDecorations.forEach(f=>{f.inlineWidget.dispose()}),this.candidateDecorations=g.map((f,v)=>{let b=h[v],S=b.breakpoint?I2(this.debugService.state,this.debugService.getModel().areBreakpointsActivated(),b.breakpoint,this.labelService,this.debugService.getModel()).icon:zF.disabled,y=()=>this.getContextMenuActions(b.breakpoint?[b.breakpoint]:[],e.getModel().uri,b.range.startLineNumber,b.range.startColumn),w=new Uit(e,f,q.asClassName(S),b.breakpoint,this.debugService,this.contextMenuService,y);return{decorationId:f,inlineWidget:w}})},e=this.editor,t=e.getModel(),o=this.debugService.getModel().getBreakpoints({uri:t.uri}),n=this.configurationService.getValue("debug"),r=this.instantiationService.invokeFunction(u=>rJo(u,t,o,this.debugService.state,this.debugService.getModel().areBreakpointsActivated(),n.showBreakpointsInOverviewRuler)),s=this.debugService.getViewModel().focusedSession,l=n.showInlineBreakpointCandidates&&s?aJo(this.editor.getModel(),r.map(u=>u.range.startLineNumber),s):Promise.resolve([]),c=await Promise.race([l,Pi(500).then(()=>{})]);c===void 0&&l.then(u=>e.changeDecorations(p=>i(p,u)));try{this.ignoreDecorationsChangedEvent=!0,e.changeDecorations(u=>{let p=u.deltaDecorations(this.breakpointDecorations.map(h=>h.decorationId),r);this.breakpointDecorations.forEach(h=>{h.inlineWidget?.dispose()}),this.breakpointDecorations=p.map((h,g)=>{let f,v=o[g];if(r[g].options.before){let b=()=>this.getContextMenuActions([v],e.getModel().uri,v.lineNumber,v.column);f=new Uit(e,h,r[g].options.glyphMarginClassName,v,this.debugService,this.contextMenuService,b)}return{decorationId:h,breakpoint:v,range:r[g].range,inlineWidget:f}}),c&&i(u,c)})}finally{this.ignoreDecorationsChangedEvent=!1}for(let u of this.breakpointDecorations)u.inlineWidget&&this.editor.layoutContentWidget(u.inlineWidget)}async onModelDecorationsChanged(){if(this.breakpointDecorations.length===0||this.ignoreDecorationsChangedEvent||!this.editor.hasModel())return;let i=!1,e=this.editor.getModel();if(this.breakpointDecorations.forEach(o=>{if(i)return;let n=e.getDecorationRange(o.decorationId);n&&!o.range.equalsRange(n)&&(i=!0,o.range=n)}),!i)return;let t=new Map;for(let o=0,n=this.breakpointDecorations.length;o<n;o++){let r=this.breakpointDecorations[o],s=e.getDecorationRange(r.decorationId);s&&r.breakpoint&&t.set(r.breakpoint.getId(),{lineNumber:s.startLineNumber,column:r.breakpoint.column?s.startColumn:void 0})}try{this.ignoreBreakpointsChangeEvent=!0,await this.debugService.updateBreakpoints(e.uri,t,!0)}finally{this.ignoreBreakpointsChangeEvent=!1}}showBreakpointWidget(i,e,t){this.breakpointWidget?.dispose(),this.breakpointWidget=this.instantiationService.createInstance(PNe,this.editor,i,e,t),this.breakpointWidget.show({lineNumber:i,column:1}),this.breakpointWidgetVisible.set(!0)}closeBreakpointWidget(){this.breakpointWidget&&(this.breakpointWidget.dispose(),this.breakpointWidget=void 0,this.breakpointWidgetVisible.reset(),this.editor.focus())}dispose(){this.breakpointWidget?.dispose(),this.setDecorationsScheduler.dispose(),this.editor.removeDecorations(this.breakpointDecorations.map(i=>i.decorationId)),Ue(this.toDispose)}};ANe=I([m(1,Li),m(2,ze),m(3,F),m(4,X),m(5,ct),m(6,B),m(7,ot)],ANe);Hit.registerGutterActionsGenerator(({lineNumber:a,editor:i,accessor:e},t)=>{let o=i.getModel(),n=e.get(Li);if(!o||!n.getAdapterManager().hasEnabledDebuggers()||!n.canSetBreakpointsIn(o))return;let r=i.getContribution(fP);if(!r)return;let s=r.getContextMenuActionsAtPosition(a,o);for(let l of s)t.push(l,"2_debug")});var Uit=class{constructor(i,e,t,o,n,r,s){this.editor=i;this.decorationId=e;this.breakpoint=o;this.debugService=n;this.contextMenuService=r;this.getContextMenuActions=s;this.allowEditorOverflow=!1;this.suppressMouseDown=!0;this.toDispose=[];this.range=this.editor.getModel().getDecorationRange(e),this.toDispose.push(this.editor.onDidChangeModelDecorations(()=>{let c=this.editor.getModel().getDecorationRange(this.decorationId);this.range&&!this.range.equalsRange(c)&&(this.range=c,this.editor.layoutContentWidget(this),this.updateSize())})),this.create(t),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this)}create(i){this.domNode=oJo(".inline-breakpoint-widget"),i&&this.domNode.classList.add(...i.split(" ")),this.toDispose.push(j(this.domNode,re.CLICK,async e=>{switch(this.breakpoint?.enabled){case void 0:await this.debugService.addBreakpoints(this.editor.getModel().uri,[{lineNumber:this.range.startLineNumber,column:this.range.startColumn}]);break;case!0:await this.debugService.removeBreakpoints(this.breakpoint.getId());break;case!1:this.debugService.enableOrDisableBreakpoints(!0,this.breakpoint);break}})),this.toDispose.push(j(this.domNode,re.CONTEXT_MENU,e=>{let t=new yn(Me(this.domNode),e),o=this.getContextMenuActions();this.contextMenuService.showContextMenu({getAnchor:()=>t,getActions:()=>o,getActionsContext:()=>this.breakpoint,onHide:()=>jH(o)})})),this.updateSize(),this.toDispose.push(this.editor.onDidChangeConfiguration(e=>{(e.hasChanged(61)||e.hasChanged(75))&&this.updateSize()}))}updateSize(){let i=this.range?this.editor.getLineHeightForPosition(this.range.getStartPosition()):this.editor.getOption(75);this.domNode.style.height=`${i}px`,this.domNode.style.width=`${Math.ceil(.8*i)}px`,this.domNode.style.marginLeft="4px"}getId(){return _t()}getDomNode(){return this.domNode}getPosition(){return this.range?(this.domNode.classList.toggle("line-start",this.range.startColumn===1),{position:{lineNumber:this.range.startLineNumber,column:this.range.startColumn-1},preference:[0]}):null}dispose(){this.editor.removeContentWidget(this),Ue(this.toDispose)}};I([mi],Uit.prototype,"getId",1);is((a,i)=>{let e=".monaco-editor .glyph-margin-widgets, .monaco-workbench .debug-breakpoints, .monaco-workbench .disassembly-view, .monaco-editor .contentWidgets",t=a.getColor(s1t);t&&(i.addRule(`${e} {
${$Wt.map(l=>`${q.asCSSSelector(l.regular)}`).join(`,
`)},
${q.asCSSSelector(GWt)},
${q.asCSSSelector(eZe)}:not([class*='codicon-debug-breakpoint']):not([class*='codicon-debug-stackframe']),
${q.asCSSSelector(zF.regular)}${q.asCSSSelector(Npe)}::after,
${q.asCSSSelector(zF.regular)}${q.asCSSSelector(Ape)}::after {
color: ${t} !important;
}
}`),i.addRule(`${e} {
${q.asCSSSelector(zF.pending)} {
color: ${t} !important;
font-size: 12px !important;
}
}`));let o=a.getColor(cJo);o&&i.addRule(`${e} {
${$Wt.map(l=>q.asCSSSelector(l.disabled)).join(`,
`)} {
color: ${o};
}
}`);let n=a.getColor(dJo);n&&i.addRule(`${e} {
${$Wt.map(l=>q.asCSSSelector(l.unverified)).join(`,
`)} {
color: ${n};
}
}`);let r=a.getColor(uJo);r&&i.addRule(`
.monaco-editor .debug-top-stack-frame-column {
color: ${r} !important;
}
${e} {
${q.asCSSSelector(Ape)} {
color: ${r} !important;
}
}
`);let s=a.getColor(pJo);s&&i.addRule(`${e} {
${q.asCSSSelector(Npe)} {
color: ${s} !important;
}
}`)});var s1t=J("debugIcon.breakpointForeground","#E51400",d(8598,null)),cJo=J("debugIcon.breakpointDisabledForeground","#848484",d(8597,null)),dJo=J("debugIcon.breakpointUnverifiedForeground","#848484",d(8600,null)),uJo=J("debugIcon.breakpointCurrentStackframeForeground",{dark:"#FFCC00",light:"#BE8700",hcDark:"#FFCC00",hcLight:"#BE8700"},d(8596,null)),pJo=J("debugIcon.breakpointStackframeForeground","#89D185",d(8599,null));var ONe=J("editor.stackFrameHighlightBackground",{dark:"#ffff0033",light:"#ffff6673",hcDark:"#ffff0033",hcLight:"#ffff6673"},d(8710,null)),FNe=J("editor.focusedStackFrameHighlightBackground",{dark:"#7abd7a4d",light:"#cee7ce73",hcDark:"#7abd7a4d",hcLight:"#cee7ce73"},d(8709,null)),a1t=1,mJo={description:"top-stack-frame-margin",glyphMarginClassName:q.asClassName(Ape),glyphMargin:{position:3},zIndex:9999,stickiness:a1t,overviewRuler:{position:7,color:Ss(ONe)}},hJo={description:"focused-stack-frame-margin",glyphMarginClassName:q.asClassName(Npe),glyphMargin:{position:3},zIndex:9999,stickiness:a1t,overviewRuler:{position:7,color:Ss(FNe)}},lTi={description:"top-stack-frame-decoration",isWholeLine:!0,className:"debug-top-stack-frame-line",stickiness:a1t},gJo={description:"focused-stack-frame-decoration",isWholeLine:!0,className:"debug-focused-stack-frame-line",stickiness:a1t},cTi=a=>({description:"top-stack-frame-inline-decoration",before:{content:"\uEB8B",inlineClassName:a?"debug-top-stack-frame-column start-of-line":"debug-top-stack-frame-column",inlineClassNameAffectsLetterSpacing:!0}});function fJo(a,i,e){let t=[],o=new z(a.range.startLineNumber,a.range.startColumn,a.range.startLineNumber,1073741824),n=new z(a.range.startLineNumber,a.range.startColumn,a.range.startLineNumber,a.range.startColumn+1),r=a.thread.getTopStackFrame();return a.getId()===r?.getId()?(i&&t.push({options:mJo,range:n}),t.push({options:lTi,range:o}),a.range.startColumn>1&&t.push({options:cTi(e),range:o})):(i&&t.push({options:hJo,range:n}),t.push({options:gJo,range:o})),t}var NNe=class extends C{constructor(e,t,o,n){super();this.editor=e;this.debugService=t;this.uriIdentityService=o;this.logService=n;this.decorations=this.editor.createDecorationsCollection();let r=()=>this.decorations.set(this.createCallStackDecorations());this._register(H.any(this.debugService.getViewModel().onDidFocusStackFrame,this.debugService.getModel().onDidChangeCallStack)(()=>{r()})),this._register(this.editor.onDidChangeModel(s=>{s.newModelUrl&&r()})),r()}createCallStackDecorations(){let e=this.editor;if(!e.hasModel())return[];let t=this.debugService.getViewModel().focusedStackFrame,o=[];return this.debugService.getModel().getSessions().forEach(n=>{let r=n===t?.thread.session;n.getAllThreads().forEach(s=>{if(s.stopped){let l=s.getCallStack(),c=[];l.length>0&&(t&&!t.equals(l[0])&&c.push(t),c.push(l[0])),c.forEach(u=>{if(u&&this.uriIdentityService.extUri.isEqual(u.source.uri,e.getModel()?.uri)){if(u.range.startLineNumber>e.getModel()?.getLineCount()||u.range.startLineNumber<1){this.logService.warn(`CallStackEditorContribution: invalid stack frame line number: ${u.range.startLineNumber}`);return}let p=e.getModel().getLineFirstNonWhitespaceColumn(u.range.startLineNumber)>=u.range.startColumn;o.push(...fJo(u,r,p))}})}})}),Uo(o,n=>`${n.options.className} ${n.options.glyphMarginClassName} ${n.range.startLineNumber} ${n.range.startColumn}`)}dispose(){super.dispose(),this.decorations.clear()}};NNe=I([m(1,Li),m(2,dt),m(3,ne)],NNe);var WNe=class extends C{constructor(e,t,o){super();this._notebookEditor=e;this._debugService=t;this._notebookExecutionStateService=o;this._currentTopDecorations=[];this._currentOtherDecorations=[];this._executingCellDecorations=[];let n=this._register(new jo(200));this._register(t.getModel().onDidChangeCallStack(()=>this.updateExecutionDecorations())),this._register(t.getViewModel().onDidFocusStackFrame(()=>this.updateExecutionDecorations())),this._register(o.onDidChangeExecution(r=>{r.type===0&&this._notebookEditor.textModel&&r.affectsNotebook(this._notebookEditor.textModel.uri)&&n.trigger(()=>this.updateExecutionDecorations())}))}static{this.id="workbench.notebook.debug.pausedCellDecorations"}updateExecutionDecorations(){let e=this._notebookEditor.textModel?this._notebookExecutionStateService.getCellExecutionsByHandleForNotebook(this._notebookEditor.textModel.uri):void 0,t=[],o,n=l=>{let c=Zo.parse(l.source.uri);if(c&&c.notebook.toString()===this._notebookEditor.textModel?.uri.toString())return{handle:c.handle,range:l.range}};for(let l of this._debugService.getModel().getSessions())for(let c of l.getAllThreads()){let u=c.getTopStackFrame();if(u){let p=n(u);p&&(t.push(p),e?.delete(p.handle))}}let r=this._debugService.getViewModel().focusedStackFrame;if(r&&r.thread.stopped){let l=n(r);l&&!t.some(c=>c.handle===l?.handle&&z.equalsRange(c.range,l?.range))&&(o=l,e?.delete(o.handle))}this.setTopFrameDecoration(t),this.setFocusedFrameDecoration(o);let s=e?Array.from(e.entries()).filter(([l,c])=>c.state===3).map(([l])=>l):[];this.setExecutingCellDecorations(s)}setTopFrameDecoration(e){let t=e.map(({handle:o,range:n})=>{let r={overviewRuler:{color:ONe,includeOutput:!1,modelRanges:[n],position:7}};return{handle:o,options:r}});this._currentTopDecorations=this._notebookEditor.deltaCellDecorations(this._currentTopDecorations,t)}setFocusedFrameDecoration(e){let t=[];if(e){let o={overviewRuler:{color:FNe,includeOutput:!1,modelRanges:[e.range],position:7}};t=[{handle:e.handle,options:o}]}this._currentOtherDecorations=this._notebookEditor.deltaCellDecorations(this._currentOtherDecorations,t)}setExecutingCellDecorations(e){let t=e.map(o=>{let n={overviewRuler:{color:yco,includeOutput:!1,modelRanges:[new z(0,0,0,0)],position:1}};return{handle:o,options:n}});this._executingCellDecorations=this._notebookEditor.deltaCellDecorations(this._executingCellDecorations,t)}};WNe=I([m(1,Li),m(2,rs)],WNe);tm(WNe.id,WNe);var VNe=class extends C{constructor(e,t,o){super();this._notebookEditor=e;this._debugService=t;this._configService=o;this._currentDecorations=[];this._register(t.getModel().onDidChangeBreakpoints(()=>this.updateDecorations())),this._register(o.onDidChangeConfiguration(n=>n.affectsConfiguration("debug.showBreakpointsInOverviewRuler")&&this.updateDecorations()))}static{this.id="workbench.notebook.debug.notebookBreakpointDecorations"}updateDecorations(){let t=this._configService.getValue("debug.showBreakpointsInOverviewRuler")?this._debugService.getModel().getBreakpoints().map(o=>{let n=Zo.parse(o.uri);if(!n||n.notebook.toString()!==this._notebookEditor.textModel.uri.toString())return null;let r={overviewRuler:{color:s1t,includeOutput:!1,modelRanges:[new z(o.lineNumber,0,o.lineNumber,0)],position:1}};return{handle:n.handle,options:r}}).filter(o=>!!o):[];this._currentDecorations=this._notebookEditor.deltaCellDecorations(this._currentDecorations,t)}};VNe=I([m(1,Li),m(2,B)],VNe);tm(VNe.id,VNe);var Che=class extends C{constructor(e,t,o){super();this._notebookEditor=e;this._notebookExecutionStateService=t;this._userActivity=o;this._activityMutex=this._register(new me);this._register(e.onDidScroll(()=>this._update())),this._register(t.onDidChangeExecution(n=>{n.notebook.toString()===this._notebookEditor.textModel?.uri.toString()&&this._update()})),this._register(e.onDidChangeModel(()=>this._update()))}static{this.id="workbench.notebook.executionEditorProgress"}_update(){if(!this._notebookEditor.hasModel())return;let e=this._notebookExecutionStateService.getCellExecutionsForNotebook(this._notebookEditor.textModel?.uri).filter(l=>l.state===3),t=this._notebookExecutionStateService.getExecution(this._notebookEditor.textModel?.uri),o=l=>{for(let c of this._notebookEditor.visibleRanges)for(let u of this._notebookEditor.getCellsInRange(c))if(u.handle===l.cellHandle){let p=this._notebookEditor.getAbsoluteTopOfElement(u);if(this._notebookEditor.scrollTop<p+5)return!0}return!1},n=e.length||t;n&&!this._activityMutex.value?this._activityMutex.value=this._userActivity.markActive():!n&&this._activityMutex.value&&this._activityMutex.clear();let r=e.length&&!e.some(o)&&!e.some(l=>l.isPaused);!!t||r?this._notebookEditor.showProgress():this._notebookEditor.hideProgress()}};I([OM(100)],Che.prototype,"_update",1),Che=I([m(1,rs),m(2,Cde)],Che);tm(Che.id,Che);var zit=class extends C{constructor(e,t,o){super();this._notebookKernelService=e;this._extensionService=t;this._notebookLoggingService=o;this._detectionMap=new Map;this._localDisposableStore=this._register(new P);this._registerListeners()}_registerListeners(){this._localDisposableStore.clear(),this._localDisposableStore.add(this._extensionService.onWillActivateByEvent(t=>{if(t.event.startsWith("onNotebook:")){if(this._extensionService.activationEventIsDone(t.event))return;let o=t.event.substring(11);if(o==="*")return;let n=!1,r=this._extensionService.getExtensionsStatus();if(this._extensionService.extensions.forEach(s=>{r[s.identifier.value].activationTimes||s.activationEvents?.includes(t.event)&&(n=!0)}),n&&!this._detectionMap.has(o)){this._notebookLoggingService.debug("KernelDetection",`start extension activation for ${o}`);let s=this._notebookKernelService.registerNotebookKernelDetectionTask({notebookType:o});this._detectionMap.set(o,s)}}}));let e=null;this._localDisposableStore.add(this._extensionService.onDidChangeExtensionsStatus(()=>{e&&clearTimeout(e),e=setTimeout(()=>{let t=[];for(let[o,n]of this._detectionMap)this._extensionService.activationEventIsDone(`onNotebook:${o}`)&&(this._notebookLoggingService.debug("KernelDetection",`finish extension activation for ${o}`),t.push(o),n.dispose());t.forEach(o=>{this._detectionMap.delete(o)})})})),this._localDisposableStore.add({dispose:()=>{e&&clearTimeout(e)}})}};zit=I([m(0,Tl),m(1,lt),m(2,_v)],zit);oe.as(Qi.Workbench).registerWorkbenchContribution(zit,3);var t8=class extends C{constructor(e,t,o,n,r){super();this.notebookEditor=e;this.notebookExecutionStateService=t;this.markerService=o;this.chatAgentService=n;this.configurationService=r;this.enabled=!1;this.listening=!1;this.diagnosticsByHandle=new Map;this.updateEnabled(),this._register(n.onDidChangeAgents(()=>this.updateEnabled())),this._register(r.onDidChangeConfiguration(s=>{s.affectsConfiguration(ft.cellFailureDiagnostics)&&this.updateEnabled()}))}static{this.ID="workbench.notebook.cellDiagnostics"}hasNotebookAgent(){return!!this.chatAgentService.getAgents().find(t=>t.locations.includes("notebook"))}updateEnabled(){let e=this.configurationService.getValue(ft.cellFailureDiagnostics);this.enabled&&(!e||!this.hasNotebookAgent())?(this.enabled=!1,this.clearAll()):!this.enabled&&e&&this.hasNotebookAgent()&&(this.enabled=!0,this.listening||(this.listening=!0,this._register(H.accumulate(this.notebookExecutionStateService.onDidChangeExecution,200)(t=>this.handleChangeExecutionState(t)))))}handleChangeExecutionState(e){if(!this.enabled)return;let t=new Set;for(let o of e.reverse()){let n=this.notebookEditor.textModel?.uri;o.type===0&&n&&o.affectsNotebook(n)&&!t.has(o.cellHandle)&&(t.add(o.cellHandle),o.changed?this.clear(o.cellHandle):this.setDiagnostics(o.cellHandle))}}clearAll(){for(let e of this.diagnosticsByHandle.keys())this.clear(e)}clear(e){let t=this.diagnosticsByHandle.get(e);if(t){for(let o of t)o.dispose();this.diagnosticsByHandle.delete(e)}}setDiagnostics(e){if(this.diagnosticsByHandle.has(e))return;let t=this.notebookEditor.getCellByHandle(e);if(!t||t.cellKind!==2)return;let o=t.model.internalMetadata;if(t instanceof Qm&&!o.lastRunSuccess&&o?.error?.location){let n=[],r=o.error.name?`${o.error.name}: ${o.error.message}`:o.error.message,s=this.createMarkerData(r,o.error.location);this.markerService.changeOne(t8.ID,t.uri,[s]),n.push(Z(()=>this.markerService.changeOne(t8.ID,t.uri,[]))),t.executionErrorDiagnostic.set(o.error,void 0),n.push(Z(()=>t.executionErrorDiagnostic.set(void 0,void 0))),n.push(he(l=>{t.executionErrorDiagnostic.read(l)||this.clear(e)})),n.push(t.model.onDidChangeOutputs(()=>{t.model.outputs.length===0&&this.clear(e)})),n.push(t.model.onDidChangeContent(()=>{this.clear(e)})),this.diagnosticsByHandle.set(e,n)}}createMarkerData(e,t){return{severity:8,message:e,startLineNumber:t.startLineNumber+1,startColumn:t.startColumn+1,endLineNumber:t.endLineNumber+1,endColumn:t.endColumn+1,source:"Cell Execution Error"}}dispose(){super.dispose(),this.clearAll()}};t8=I([m(1,rs),m(2,Ns),m(3,br),m(4,B)],t8);tm(t8.ID,t8);var l1t="notebook.cell.openFailureActions",vJo="notebook.cell.chat.fixError",bJo="notebook.cell.chat.explainError";W(class extends gd{constructor(){super({id:l1t,title:L(11639,"Show Cell Failure Actions"),precondition:x.and(Cpe,kpe,AR.toNegated()),f1:!0,keybinding:{when:x.and(Cpe,kpe,AR.toNegated()),primary:2137,weight:200}})}async runWithContext(a,i){if(i.cell instanceof Qm){let e=i.cell.executionErrorDiagnostic.get();if(e?.location){let t=z.lift({startLineNumber:e.location.startLineNumber+1,startColumn:e.location.startColumn+1,endLineNumber:e.location.endLineNumber+1,endColumn:e.location.endColumn+1});i.notebookEditor.setCellEditorSelection(i.cell,z.lift(t));let o=xZ(i,i.cell);o&&Zu.get(o)?.manualTriggerAtCurrentPosition(d(11638,null),"other (default)",{include:gr.QuickFix})}}}});W(class extends gd{constructor(){super({id:vJo,title:L(11641,"Fix Cell Error"),precondition:x.and(Cpe,kpe,AR.toNegated()),f1:!0})}async runWithContext(a,i){if(i.cell instanceof Qm){let e=i.cell.executionErrorDiagnostic.get();if(e?.location){let t=z.lift({startLineNumber:e.location.startLineNumber+1,startColumn:e.location.startColumn+1,endLineNumber:e.location.endLineNumber+1,endColumn:e.location.endColumn+1});i.notebookEditor.setCellEditorSelection(i.cell,z.lift(t));let o=xZ(i,i.cell);if(o){let n=_m.get(o),r=e.name?`${e.name}: ${e.message}`:e.message;n&&await n.run({message:"/fix "+r,initialRange:t,autoSend:!0})}}}}});W(class extends gd{constructor(){super({id:bJo,title:L(11640,"Explain Cell Error"),precondition:x.and(Cpe,kpe,AR.toNegated()),f1:!0})}async runWithContext(a,i){if(i.cell instanceof Qm){let e=i.cell.executionErrorDiagnostic.get();if(e?.message){let o=await a.get(At).revealWidget(),n=e.name?`${e.name}: ${e.message}`:e.message;o?.acceptInput("@workspace /explain "+n)}}}});var BNe=class extends C{static{this.id="workbench.notebook.statusBar.diagtnostic"}constructor(i,e){super(),this._register(new _Ne(i,(t,o)=>o instanceof Qm?e.createInstance(Kit,t,o):C.None))}};BNe=I([m(1,F)],BNe);tm(BNe.id,BNe);var Kit=class extends C{constructor(e,t,o,n){super();this._notebookViewModel=e;this.cell=t;this.keybindingService=o;this.chatAgentService=n;this._currentItemIds=[];this._register(he(r=>this.updateSparkleItem(r.readObservable(t.executionErrorDiagnostic))))}hasNotebookAgent(){return!!this.chatAgentService.getAgents().find(t=>t.locations.includes("notebook"))}async updateSparkleItem(e){let t;e?.location&&this.hasNotebookAgent()&&(t={text:"$(sparkle)",tooltip:this.keybindingService.appendKeybinding(d(11642,null),l1t),alignment:1,command:l1t,priority:Number.MAX_SAFE_INTEGER-1});let o=t?[t]:[];this._currentItemIds=this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds,[{handle:this.cell.handle,items:o}])}dispose(){super.dispose(),this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds,[{handle:this.cell.handle,items:[]}])}};Kit=I([m(2,_e),m(3,br)],Kit);var HNe=class extends C{constructor(e,t){super();this.notebookEditor=e;this.configurationService=t;this.isEnabled=!1;this.cellDecorationIds=new Map;this.anchorDisposables=new P;this.isEnabled=this.configurationService.getValue("editor.selectionHighlight"),this._register(this.configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration("editor.selectionHighlight")&&(this.isEnabled=this.configurationService.getValue("editor.selectionHighlight"))})),this._register(this.notebookEditor.onDidChangeActiveCell(async()=>{if(!this.isEnabled||(this.anchorCell=this.notebookEditor.activeCellAndCodeEditor,!this.anchorCell))return;let o=this.notebookEditor.getActiveCell();o&&(o.editorAttached||await H.toPromise(o.onDidChangeEditorAttachState),this.clearNotebookSelectionDecorations(),this.anchorDisposables.clear(),this.anchorDisposables.add(this.anchorCell[1].onDidChangeCursorPosition(n=>{if(n.reason!==3){this.clearNotebookSelectionDecorations();return}this.anchorCell&&this.notebookEditor.hasModel()&&(this.clearNotebookSelectionDecorations(),this._update(this.notebookEditor))})),this.notebookEditor.getEditorViewState().editorFocused&&this.notebookEditor.hasModel()&&this._update(this.notebookEditor))}))}static{this.id="notebook.selectionHighlighter"}_update(e){if(!this.anchorCell||!this.isEnabled)return;let t=this.anchorCell[0].textModel;if(!t||t.isTooLargeForTokenization())return;let o=this.anchorCell[0].getSelections()[0];if(o.startLineNumber!==o.endLineNumber||o.isEmpty())return;let n=this.getSearchText(o,t);if(!n)return;let r=e.textModel.findMatches(n,!1,!0,null);for(let s of r){let l=e.getCellByHandle(s.cell.handle);l&&this.updateCellDecorations(l,s.matches)}}updateCellDecorations(e,t){let o=t.map(s=>Yt.fromRange(s.range,0)),n=[];o?.map(s=>{s.isEmpty()||n.push({range:s,options:{description:"",className:".nb-selection-highlight"}})});let r=this.cellDecorationIds.get(e)??[];this.cellDecorationIds.set(e,e.deltaModelDecorations(r,n))}clearNotebookSelectionDecorations(){this.cellDecorationIds.forEach((e,t)=>{let o=this.cellDecorationIds.get(t)??[];o&&(t.deltaModelDecorations(o,[]),this.cellDecorationIds.delete(t))})}getSearchText(e,t){return t.getValueInRange(e).replace(/\r\n/g,`
`)}dispose(){super.dispose(),this.anchorDisposables.dispose()}};HNe=I([m(1,B)],HNe);tm(HNe.id,HNe);var om=class extends pa{constructor(e,t,o,n,r,s,l,c,u){super(om.ID,e,l,o,c);this.instantiationService=t;this._parentContextKeyService=n;this.notebookEditorWorkerService=r;this.configurationService=s;this.notebookService=u;this.modelSpecificResources=this._register(new P),this.ctxAllCollapsed=this._parentContextKeyService.createKey(kco.key,!1),this.ctxHasUnchangedCells=this._parentContextKeyService.createKey(tme.key,!1),this.ctxHiddenUnchangedCells=this._parentContextKeyService.createKey(kZe.key,!0),this._notebookOptions=t.createInstance(nT,this.window,!1,void 0),this._register(this._notebookOptions)}static{this.ID=f9i}get textModel(){return this._model?.modified.notebook}get notebookOptions(){return this._notebookOptions}get fontInfo(){return this._fontInfo||(this._fontInfo=this.createFontInfo()),this._fontInfo}layout(e,t){this._multiDiffEditorWidget.layout(e)}createFontInfo(){let e=this.configurationService.getValue("editor");return Fy.readFontInfo(this.window,LS(e,Xd.getInstance(this.window).value))}createEditor(e){this._multiDiffEditorWidget=this._register(this.instantiationService.createInstance(cee,e,this.instantiationService.createInstance(Git))),this._register(this._multiDiffEditorWidget.onDidChangeActiveControl(()=>{this._onDidChangeControl.fire()}))}async setInput(e,t,o,n){super.setInput(e,t,o,n);let r=await e.resolve();this._model!==r&&(this._detachModel(),this._model=r);let s=this.modelSpecificResources.add(new JRe),l=this.instantiationService.createInstance($Z,this.fontInfo.lineHeight);this.viewModel=this.modelSpecificResources.add(new aMe(r,this.notebookEditorWorkerService,this.configurationService,s,this.notebookService,l,void 0,!0)),await this.viewModel.computeDiff(this.modelSpecificResources.add(new $e).token),this.ctxHasUnchangedCells.set(this.viewModel.hasUnchangedCells),this.ctxHasUnchangedCells.set(this.viewModel.hasUnchangedCells);let c=this.modelSpecificResources.add(NZ.createInput(this.viewModel,this.instantiationService));this.widgetViewModel=this.modelSpecificResources.add(await c.getViewModel());let u=new WeakSet;this.modelSpecificResources.add(he(p=>{if(!this.widgetViewModel||!this.viewModel)return;let h=this.widgetViewModel.items.read(p),g=this.viewModel.value;h.length===g.length&&Ui(f=>{h.forEach(v=>{if(u.has(v))return;u.add(v);let b=g.find(S=>S.modifiedUri?.toString()===v.modifiedUri?.toString()&&S.originalUri?.toString()===v.originalUri?.toString());b&&b.type==="unchanged"&&v.collapsed.set(!0,f)})})})),this._multiDiffEditorWidget.setViewModel(this.widgetViewModel)}_detachModel(){this.viewModel=void 0,this.modelSpecificResources.clear()}_generateFontFamily(){return this.fontInfo.fontFamily??'"SF Mono", Monaco, Menlo, Consolas, "Ubuntu Mono", "Liberation Mono", "DejaVu Sans Mono", "Courier New", monospace'}setOptions(e){super.setOptions(e)}getControl(){return this._multiDiffEditorWidget.getActiveControl()}focus(){super.focus(),this._multiDiffEditorWidget?.getActiveControl()?.focus()}hasFocus(){return this._multiDiffEditorWidget?.getActiveControl()?.hasTextFocus()||super.hasFocus()}clearInput(){super.clearInput(),this._multiDiffEditorWidget.setViewModel(void 0),this.modelSpecificResources.clear(),this.viewModel=void 0,this.widgetViewModel=void 0}expandAll(){this.widgetViewModel&&(this.widgetViewModel.expandAll(),this.ctxAllCollapsed.set(!1))}collapseAll(){this.widgetViewModel&&(this.widgetViewModel.collapseAll(),this.ctxAllCollapsed.set(!0))}hideUnchanged(){this.viewModel&&(this.viewModel.includeUnchanged=!1,this.ctxHiddenUnchangedCells.set(!0))}showUnchanged(){this.viewModel&&(this.viewModel.includeUnchanged=!0,this.ctxHiddenUnchangedCells.set(!1))}getDiffElementViewModel(e){if(e.scheme===Y.vscodeNotebookCellOutput||e.scheme===Y.vscodeNotebookCellOutputDiff||e.scheme===Y.vscodeNotebookCellMetadata||e.scheme===Y.vscodeNotebookCellMetadataDiff){let t=Zo.parseCellPropertyUri(e,e.scheme);t&&(e=Zo.generate(t.notebook,t.handle))}return e.scheme===Y.vscodeNotebookMetadata?this.viewModel?.items.find(t=>t.type==="modifiedMetadata"||t.type==="unchangedMetadata"):this.viewModel?.items.find(t=>{switch(t.type){case"delete":return t.original?.uri.toString()===e.toString();case"insert":return t.modified?.uri.toString()===e.toString();case"modified":case"unchanged":return t.modified?.uri.toString()===e.toString()||t.original?.uri.toString()===e.toString();default:return}})}};om=I([m(1,F),m(2,De),m(3,X),m(4,JK),m(5,B),m(6,Te),m(7,le),m(8,un)],om);var Git=class{constructor(i,e,t){this._instantiationService=i;this.notebookDocumentService=e;this.notebookService=t}createResourceLabel(i){let e=this._instantiationService.createInstance(rk,i,{}),t=this;return{setUri(o,n={}){if(!o)e.element.clear();else{let r="",s="",l;if(o.scheme===Y.vscodeNotebookCell){let c=o.scheme===Y.vscodeNotebookCell?t.notebookDocumentService.getNotebook(o):void 0,u=Y.vscodeNotebookCell?t.notebookDocumentService.getNotebook(o)?.getCellIndex(o):void 0;if(c&&u!==void 0){r=d(11909,null,`${u+1}`);let p=c?t.notebookService.getNotebookTextModel(c?.uri):void 0,h=p&&u!==void 0?p.cells[u].language:void 0;l=h?Y1(h):void 0}}else o.scheme===Y.vscodeNotebookCellMetadata||o.scheme===Y.vscodeNotebookCellMetadataDiff?s=d(11910,null):(o.scheme===Y.vscodeNotebookCellOutput||o.scheme===Y.vscodeNotebookCellOutputDiff)&&(s=d(11911,null));e.element.setResource({name:r,description:s},{strikethrough:n.strikethrough,forceLabel:!0,hideIcon:!l,extraClasses:l})}},dispose(){e.dispose()}}}};Git=I([m(0,F),m(1,Ij),m(2,un)],Git);W(class extends K{constructor(){super({id:"notebook.diff.openFile",icon:M.goToFile,title:L(11895,"Open File"),precondition:x.or(fr.isEqualTo(Xm.ID),fr.isEqualTo(om.ID)),menu:[{id:D.EditorTitle,group:"navigation",when:x.or(fr.isEqualTo(Xm.ID),fr.isEqualTo(om.ID))}]})}async run(a){let i=a.get(ee),e=i.activeEditorPane;if(e&&(e instanceof Xm||e instanceof om)){let o=e.input.modified.resource;await i.openEditor({resource:o})}}});W(class extends K{constructor(){super({id:"notebook.diff.cell.toggleCollapseUnchangedRegions",title:L(11891,"Toggle Collapse Unchanged Regions"),icon:M.map,toggled:x.has("config.diffEditor.hideUnchangedRegions.enabled"),precondition:fr.isEqualTo(Xm.ID),menu:{id:D.EditorTitle,group:"navigation",when:fr.isEqualTo(Xm.ID)}})}run(a,...i){let e=a.get(B),t=!e.getValue("diffEditor.hideUnchangedRegions.enabled");e.updateValue("diffEditor.hideUnchangedRegions.enabled",t)}});W(class extends K{constructor(){super({id:"notebook.diff.switchToText",icon:tlo,title:L(11899,"Open Text Diff Editor"),precondition:x.or(fr.isEqualTo(Xm.ID),fr.isEqualTo(om.ID)),menu:[{id:D.EditorTitle,group:"navigation",when:x.or(fr.isEqualTo(Xm.ID),fr.isEqualTo(om.ID))}]})}async run(a){let i=a.get(ee),e=i.activeEditorPane;if(e&&(e instanceof Xm||e instanceof om)){let t=e.input;await i.openEditor({original:{resource:t.original.resource},modified:{resource:t.resource},label:t.getName(),options:{preserveFocus:!1,override:Ys.id}})}}});W(class extends K{constructor(){super({id:"notebook.diffEditor.showUnchangedCells",title:L(11901,"Show Unchanged Cells"),icon:M.unfold,precondition:x.and(fr.isEqualTo(om.ID),x.has(tme.key)),menu:{when:x.and(fr.isEqualTo(om.ID),x.has(tme.key),x.equals(kZe.key,!0)),id:D.EditorTitle,order:22,group:"navigation"}})}run(a,...i){let e=a.get(ee).activeEditorPane;e&&e instanceof om&&e.showUnchanged()}});W(class extends K{constructor(){super({id:"notebook.diffEditor.hideUnchangedCells",title:L(11883,"Hide Unchanged Cells"),icon:M.fold,precondition:x.and(fr.isEqualTo(om.ID),x.has(tme.key)),menu:{when:x.and(fr.isEqualTo(om.ID),x.has(tme.key),x.equals(kZe.key,!1)),id:D.EditorTitle,order:22,group:"navigation"}})}run(a,...i){let e=a.get(ee).activeEditorPane;e&&e instanceof om&&e.hideUnchanged()}});W(class extends K{constructor(){super({id:"notebook.diffEditor.2.goToCell",title:L(11882,"Go To Cell"),icon:M.goToFile,menu:{when:x.and(fr.isEqualTo(om.ID),x.equals(H4.key,"Cell"),x.notEquals(U4.key,"delete")),id:D.MultiDiffEditorFileToolbar,order:0,group:"navigation"}})}async run(i,...e){let t=e[0],o=i.get(ee);o.activeEditorPane instanceof om&&await o.openEditor({resource:t,options:{selectionRevealType:1}})}});W(class extends K{constructor(){super({id:"notebook.diff.revertMetadata",title:d(11896,null),icon:kZ,f1:!1,menu:{id:D.NotebookDiffDocumentMetadata,when:xZe},precondition:xZe})}run(a,i){!i||!(a.get(ee).activeEditorPane instanceof Xm)||i.modifiedDocumentTextModel.applyEdits([{editType:5,metadata:i.originalMetadata.metadata}],!0,void 0,()=>{},void 0,!0)}});var ggo=d(11887,null);W(class extends K{constructor(){super({id:"notebook.diffEditor.2.cell.revertInput",title:ggo,icon:kZ,menu:{when:x.and(fr.isEqualTo(om.ID),x.equals(H4.key,"Cell"),x.equals(U4.key,"modified")),id:D.MultiDiffEditorFileToolbar,order:2,group:"navigation"}})}async run(a,...i){let e=i[0],o=a.get(ee).activeEditorPane;if(!(o instanceof om))return;let n=o.getDiffElementViewModel(e);if(n&&n instanceof GC){let r=n.modified,s=n.original;if(!s||!r)return;await a.get(ma).apply([new ja(r.uri,{range:r.textModel.getFullModelRange(),text:s.textModel.getValue()})],{quotableLabel:"Revert Notebook Cell Content Change"})}}});var SJo=d(11889,null);W(class extends K{constructor(){super({id:"notebook.diffEditor.2.cell.revertOutputs",title:SJo,icon:kZ,f1:!1,menu:{when:x.and(fr.isEqualTo(om.ID),x.equals(H4.key,"Output"),x.equals(U4.key,"modified")),id:D.MultiDiffEditorFileToolbar,order:2,group:"navigation"}})}async run(a,...i){let e=i[0],o=a.get(ee).activeEditorPane;if(!(o instanceof om))return;let n=o.getDiffElementViewModel(e);if(n&&n instanceof GC){let r=n.original,s=n.modifiedDocument.cells.findIndex(l=>l.handle===n.modified.handle);if(s===-1)return;n.mainDocumentTextModel.applyEdits([{editType:2,index:s,outputs:r.outputs}],!0,void 0,()=>{},void 0,!0)}}});var fgo=d(11888,null);W(class extends K{constructor(){super({id:"notebook.diffEditor.2.cell.revertMetadata",title:fgo,icon:kZ,f1:!1,menu:{when:x.and(fr.isEqualTo(om.ID),x.equals(H4.key,"Metadata"),x.equals(U4.key,"modified")),id:D.MultiDiffEditorFileToolbar,order:2,group:"navigation"}})}async run(a,...i){let e=i[0],o=a.get(ee).activeEditorPane;if(!(o instanceof om))return;let n=o.getDiffElementViewModel(e);if(n&&n instanceof GC){let r=n.original,s=n.modifiedDocument.cells.findIndex(l=>l.handle===n.modified.handle);if(s===-1)return;n.mainDocumentTextModel.applyEdits([{editType:3,index:s,metadata:r.metadata}],!0,void 0,()=>{},void 0,!0)}}});W(class extends K{constructor(){super({id:"notebook.diff.cell.revertMetadata",title:fgo,icon:kZ,f1:!1,menu:{id:D.NotebookDiffCellMetadataTitle,when:eme},precondition:eme})}run(a,i){if(!i||!(i instanceof GC))return;let e=i.original,t=i.modified,o=i.mainDocumentTextModel.cells.indexOf(t.textModel);if(o===-1)return;let n=[{editType:3,index:o,metadata:e.metadata}];i.original.language&&i.modified.language!==i.original.language&&n.push({editType:4,index:o,language:i.original.language}),i.modifiedDocument.applyEdits(n,!0,void 0,()=>{},void 0,!0)}});W(class extends K{constructor(){super({id:"notebook.diff.cell.switchOutputRenderingStyleToText",title:d(11890,null),icon:olo,f1:!1,menu:{id:D.NotebookDiffCellOutputsTitle,when:wVt}})}run(a,i){i&&(i.renderOutput=!i.renderOutput)}});W(class extends K{constructor(){super({id:"notebook.diff.cell.revertOutputs",title:d(11889,null),icon:kZ,f1:!1,menu:{id:D.NotebookDiffCellOutputsTitle,when:eme},precondition:eme})}run(a,i){if(!i||!(i instanceof GC))return;let e=i.original,t=i.modified,o=i.mainDocumentTextModel.cells.indexOf(t.textModel);o!==-1&&i.mainDocumentTextModel.applyEdits([{editType:2,index:o,outputs:e.outputs}],!0,void 0,()=>{},void 0,!0)}});W(class extends K{constructor(){super({id:"notebook.toggle.diff.cell.ignoreTrimWhitespace",title:d(11884,null),icon:ilo,f1:!1,menu:{id:D.NotebookDiffCellInputTitle,when:Zpe,order:1},precondition:Zpe,toggled:x.equals(bwi,!1)})}run(a,i){let e=i;if(!e?.modified)return;let t=e.modified.uri,o=a.get(Nn),n="diffEditor.ignoreTrimWhitespace",r=o.getValue(t,n);o.updateValue(t,n,!r)}});W(class extends K{constructor(){super({id:"notebook.diff.cell.revertInput",title:ggo,icon:kZ,f1:!1,menu:{id:D.NotebookDiffCellInputTitle,when:Zpe,order:2},precondition:Zpe})}run(a,i){if(!i)return;let e=i.original,t=i.modified;return!e||!t?void 0:a.get(ma).apply([new ja(t.uri,{range:t.textModel.getFullModelRange(),text:e.textModel.getValue()})],{quotableLabel:"Revert Notebook Cell Content Change"})}});var c1t=class extends K{constructor(e,t,o,n,r,s,l){super({id:e,title:t,precondition:o,menu:[{id:D.EditorTitle,group:"notebook",when:o,order:r}],toggled:n});this.toggleOutputs=s;this.toggleMetadata=l}async run(e){let t=e.get(B);if(this.toggleOutputs!==void 0){let o=t.getValue("notebook.diff.ignoreOutputs");t.updateValue("notebook.diff.ignoreOutputs",!o)}if(this.toggleMetadata!==void 0){let o=t.getValue("notebook.diff.ignoreMetadata");t.updateValue("notebook.diff.ignoreMetadata",!o)}}};W(class extends c1t{constructor(){super("notebook.diff.showOutputs",L(11898,"Show Outputs Differences"),x.or(fr.isEqualTo(Xm.ID),fr.isEqualTo(om.ID)),x.notEquals("config.notebook.diff.ignoreOutputs",!0),2,!0,void 0)}});W(class extends c1t{constructor(){super("notebook.diff.showMetadata",L(11897,"Show Metadata Differences"),x.or(fr.isEqualTo(Xm.ID),fr.isEqualTo(om.ID)),x.notEquals("config.notebook.diff.ignoreMetadata",!0),1,void 0,!0)}});W(class extends K{constructor(){super({id:"notebook.diff.action.previous",title:d(11886,null),icon:rlo,f1:!1,keybinding:{primary:1597,weight:200,when:fr.isEqualTo(Xm.ID)},menu:{id:D.EditorTitle,group:"navigation",when:fr.isEqualTo(Xm.ID)}})}run(a){let i=a.get(ee);if(i.activeEditorPane?.getId()!==lY)return;i.activeEditorPane.getControl()?.previousChange()}});W(class extends K{constructor(){super({id:"notebook.diff.action.next",title:d(11885,null),icon:slo,f1:!1,keybinding:{primary:573,weight:200,when:fr.isEqualTo(Xm.ID)},menu:{id:D.EditorTitle,group:"navigation",when:fr.isEqualTo(Xm.ID)}})}run(a){let i=a.get(ee);if(i.activeEditorPane?.getId()!==lY)return;i.activeEditorPane.getControl()?.nextChange()}});W(class extends K{constructor(){super({id:"notebook.diff.inline.toggle",title:d(11894,null),menu:{id:D.EditorTitle,group:"1_diff",order:10,when:x.and(fr.isEqualTo(Xm.ID),x.equals("config.notebook.diff.experimental.toggleInline",!0),mI.negate(),EB.negate())}})}run(a){let i=a.get(ee);if(i.activeEditorPane?.getId()!==lY)return;i.activeEditorPane.getControl()?.toggleInlineView()}});oe.as(ii.Configuration).registerConfiguration({id:"notebook",order:100,type:"object",properties:{"notebook.diff.ignoreMetadata":{type:"boolean",default:!1,markdownDescription:d(11892,null)},"notebook.diff.ignoreOutputs":{type:"boolean",default:!1,markdownDescription:d(11893,null)},"notebook.diff.experimental.toggleInline":{type:"boolean",default:typeof to.quality=="string"&&to.quality!=="stable",markdownDescription:d(11900,null)}}});var UNe=class extends C{constructor(e,t,o,n){super();this._instantiationService=e;this._logService=t;this._notebookService=o;this._accessibilitySignalService=n;this._executions=new vt;this._notebookExecutions=new vt;this._notebookListeners=new vt;this._cellListeners=new vt;this._lastFailedCells=new vt;this._lastCompletedCellHandles=new vt;this._onDidChangeExecution=this._register(new E);this.onDidChangeExecution=this._onDidChangeExecution.event;this._onDidChangeLastRunFailState=this._register(new E);this.onDidChangeLastRunFailState=this._onDidChangeLastRunFailState.event}getLastFailedCellForNotebook(e){let t=this._lastFailedCells.get(e);return t?.visible?t.cellHandle:void 0}getLastCompletedCellForNotebook(e){return this._lastCompletedCellHandles.get(e)}forceCancelNotebookExecutions(e){let t=this._executions.get(e);if(t)for(let o of t.values())this._onCellExecutionDidComplete(e,o.cellHandle,o);this._notebookExecutions.has(e)&&this._onExecutionDidComplete(e)}getCellExecution(e){let t=Zo.parse(e);if(!t)throw new Error(`Not a cell URI: ${e}`);let o=this._executions.get(t.notebook);if(o)return o.get(t.handle)}getExecution(e){return this._notebookExecutions.get(e)?.[0]}getCellExecutionsForNotebook(e){let t=this._executions.get(e);return t?Array.from(t.values()):[]}getCellExecutionsByHandleForNotebook(e){let t=this._executions.get(e);return t?new Map(t.entries()):void 0}_onCellExecutionDidChange(e,t,o){this._onDidChangeExecution.fire(new jit(e,t,o))}_onCellExecutionDidComplete(e,t,o,n){let r=this._executions.get(e);if(!r){this._logService.debug(`NotebookExecutionStateService#_onCellExecutionDidComplete - unknown notebook ${e.toString()}`);return}o.dispose();let s=Zo.generate(e,t);this._cellListeners.get(s)?.dispose(),this._cellListeners.delete(s),r.delete(t),r.size===0&&(this._executions.delete(e),this._notebookListeners.get(e)?.dispose(),this._notebookListeners.delete(e)),n!==void 0&&(n?(this._executions.size===0&&this._accessibilitySignalService.playSignal($o.notebookCellCompleted),this._clearLastFailedCell(e)):(this._accessibilitySignalService.playSignal($o.notebookCellFailed),this._setLastFailedCell(e,t)),this._lastCompletedCellHandles.set(e,t)),this._onDidChangeExecution.fire(new jit(e,t))}_onExecutionDidChange(e,t){this._onDidChangeExecution.fire(new Qit(e,t))}_onExecutionDidComplete(e){let t=this._notebookExecutions.get(e);if(!Array.isArray(t)){this._logService.debug(`NotebookExecutionStateService#_onCellExecutionDidComplete - unknown notebook ${e.toString()}`);return}this._notebookExecutions.delete(e),this._onDidChangeExecution.fire(new Qit(e)),t.forEach(o=>o.dispose())}createCellExecution(e,t){let o=this._notebookService.getNotebookTextModel(e);if(!o)throw new Error(`Notebook not found: ${e.toString()}`);let n=this._executions.get(e);if(!n){let s=this._instantiationService.createInstance(zNe,e);this._notebookListeners.set(e,s),n=new Map,this._executions.set(e,n)}let r=n.get(t);return r||(r=this._createNotebookCellExecution(o,t),n.set(t,r),r.initialize(),this._onDidChangeExecution.fire(new jit(e,t,r))),r}createExecution(e){let t=this._notebookService.getNotebookTextModel(e);if(!t)throw new Error(`Notebook not found: ${e.toString()}`);if(!this._notebookListeners.has(e)){let n=this._instantiationService.createInstance(zNe,e);this._notebookListeners.set(e,n)}let o=this._notebookExecutions.get(e);return o||(o=this._createNotebookExecution(t),this._notebookExecutions.set(e,o),this._onDidChangeExecution.fire(new Qit(e,o[0]))),o[0]}_createNotebookCellExecution(e,t){let o=e.uri,n=this._instantiationService.createInstance($it,t,e),r=hn(n.onDidUpdate(()=>this._onCellExecutionDidChange(o,t,n)),n.onDidComplete(s=>this._onCellExecutionDidComplete(o,t,n,s)));return this._cellListeners.set(Zo.generate(o,t),r),n}_createNotebookExecution(e){let t=e.uri,o=this._instantiationService.createInstance(qit,e),n=hn(o.onDidUpdate(()=>this._onExecutionDidChange(t,o)),o.onDidComplete(()=>this._onExecutionDidComplete(t)));return[o,n]}_setLastFailedCell(e,t){let o=this._lastFailedCells.get(e),n=this._notebookService.getNotebookTextModel(e);if(!n)return;let r={cellHandle:t,disposable:o?o.disposable:this._getFailedCellListener(n),visible:!0};this._lastFailedCells.set(e,r),this._onDidChangeLastRunFailState.fire({visible:!0,notebook:e})}_setLastFailedCellVisibility(e,t){let o=this._lastFailedCells.get(e);o&&this._lastFailedCells.set(e,{cellHandle:o.cellHandle,disposable:o.disposable,visible:t}),this._onDidChangeLastRunFailState.fire({visible:t,notebook:e})}_clearLastFailedCell(e){let t=this._lastFailedCells.get(e);t&&(t.disposable?.dispose(),this._lastFailedCells.delete(e)),this._onDidChangeLastRunFailState.fire({visible:!1,notebook:e})}_getFailedCellListener(e){return e.onWillAddRemoveCells(t=>{let o=this._lastFailedCells.get(e.uri)?.cellHandle;if(o!==void 0){let n=e.cells.findIndex(r=>r.handle===o);t.rawEvent.changes.forEach(([r,s,l])=>{s&&n>=r&&n<r+s&&this._setLastFailedCellVisibility(e.uri,!1),l.some(c=>c.handle===o)&&this._setLastFailedCellVisibility(e.uri,!0)})}})}dispose(){super.dispose(),this._executions.forEach(e=>{e.forEach(t=>t.dispose()),e.clear()}),this._executions.clear(),this._notebookExecutions.forEach(e=>{e.forEach(t=>t.dispose())}),this._notebookExecutions.clear(),this._cellListeners.forEach(e=>e.dispose()),this._notebookListeners.forEach(e=>e.dispose()),this._lastFailedCells.forEach(e=>e.disposable.dispose())}};UNe=I([m(0,F),m(1,ne),m(2,un),m(3,tr)],UNe);var jit=class{constructor(i,e,t){this.notebook=i;this.cellHandle=e;this.changed=t;this.type=0}affectsCell(i){let e=Zo.parse(i);return!!e&&Xe(this.notebook,e.notebook)&&this.cellHandle===e.handle}affectsNotebook(i){return Xe(this.notebook,i)}},Qit=class{constructor(i,e){this.notebook=i;this.changed=e;this.type=1}affectsNotebook(i){return Xe(this.notebook,i)}},zNe=class extends C{constructor(e,t,o,n,r,s){super();this._notebookService=t;this._notebookKernelService=o;this._notebookExecutionService=n;this._notebookExecutionStateService=r;this._logService=s;this._logService.debug(`NotebookExecution#ctor ${e.toString()}`);let l=this._notebookService.getNotebookTextModel(e);if(!l)throw new Error("Notebook not found: "+e);this._notebookModel=l,this._register(this._notebookModel.onWillAddRemoveCells(c=>this.onWillAddRemoveCells(c))),this._register(this._notebookModel.onWillDispose(()=>this.onWillDisposeDocument()))}cancelAll(){this._logService.debug("NotebookExecutionListeners#cancelAll");let e=this._notebookExecutionStateService.getCellExecutionsForNotebook(this._notebookModel.uri);this._notebookExecutionService.cancelNotebookCellHandles(this._notebookModel,e.map(t=>t.cellHandle))}onWillDisposeDocument(){this._logService.debug("NotebookExecution#onWillDisposeDocument"),this.cancelAll()}onWillAddRemoveCells(e){let t=this._notebookExecutionStateService.getCellExecutionsByHandleForNotebook(this._notebookModel.uri),o=new Set,n=new Set;if(t&&e.rawEvent.changes.forEach(([r,s])=>{s&&this._notebookModel.cells.slice(r,r+s).map(c=>c.handle).forEach(c=>{let u=t.get(c);u?.state===3?o.add(c):u&&n.add(c)})}),o.size||n.size){let r=this._notebookKernelService.getSelectedOrSuggestedKernel(this._notebookModel);if(r){let l=r.implementsInterrupt?[...o]:[...o,...n];this._logService.debug(`NotebookExecution#onWillAddRemoveCells, ${JSON.stringify([...l])}`),l.length&&r.cancelNotebookCellExecution(this._notebookModel.uri,l)}}}};zNe=I([m(1,un),m(2,Tl),m(3,AY),m(4,rs),m(5,ne)],zNe);function IJo(a,i){if(a.editType===1)return{editType:2,handle:a.cellHandle,append:a.append,outputs:a.outputs};if(a.editType===2)return{editType:7,items:a.items,append:a.append,outputId:a.outputId};if(a.editType===3){let e={};return typeof a.executionOrder<"u"&&(e.executionOrder=a.executionOrder),typeof a.runStartTime<"u"&&(e.runStartTime=a.runStartTime),{editType:9,handle:i,internalMetadata:e}}throw new Error("Unknown cell update type"